From: support Date: Tue, 14 Mar 2023 16:31:12 +0000 (+0000) Subject: Built motion from commit 06eb8eb0.|2.6.31 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=c0d66c3533d6f1bc19196d37c2b4efd3fc6ab152;p=motion2.git Built motion from commit 06eb8eb0.|2.6.31 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a56ecc1..8985b31 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-14T08:13:08.676Z", + "time": "2023-03-14T16:22:36.960Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index f4f254a..3540e85 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-03-14T08:13:08.676Z", + "time": "2023-03-14T16:22:36.960Z", "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 b9fc98e..4add2f4 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 _0x4832=['integration','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[body]','sequelize','VIRTUAL','getDataValue','STRING','contactManager'];(function(_0x383b7b,_0x42bdcb){var _0x1c5220=function(_0x8079d){while(--_0x8079d){_0x383b7b['push'](_0x383b7b['shift']());}};_0x1c5220(++_0x42bdcb);}(_0x4832,0x1c9));var _0x2483=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x4832[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x2483('0x0'));module['exports']={'name':{'type':Sequelize[_0x2483('0x1')],'get':function(_0x57814a){return this[_0x2483('0x2')]('action');}},'action':{'type':Sequelize[_0x2483('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2483('0x4'),_0x2483('0x5'),'motionbar','jscripty','urlForward',_0x2483('0x6'),_0x2483('0x7'),_0x2483('0x8')]],'msg':_0x2483('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x2483('0x3')](0x1000),'comment':_0x2483('0xa')},'data3':{'type':Sequelize[_0x2483('0x3')](0x1000),'comment':_0x2483('0xb')},'data4':{'type':Sequelize[_0x2483('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x2483('0x3')](0x1000),'comments':_0x2483('0xc')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x2483('0xd')}}; \ No newline at end of file +var _0xc61a=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','urlForward','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x1651c1,_0x27772d){var _0x55b7dc=function(_0xc5cd1a){while(--_0xc5cd1a){_0x1651c1['push'](_0x1651c1['shift']());}};_0x55b7dc(++_0x27772d);}(_0xc61a,0x6e));var _0xac61=function(_0x31827b,_0x31cac2){_0x31827b=_0x31827b-0x0;var _0x2d1184=_0xc61a[_0x31827b];return _0x2d1184;};'use strict';var Sequelize=require('sequelize');module[_0xac61('0x0')]={'name':{'type':Sequelize[_0xac61('0x1')],'get':function(_0x468972){return this[_0xac61('0x2')](_0xac61('0x3'));}},'action':{'type':Sequelize[_0xac61('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xac61('0x5'),_0xac61('0x6'),'motionbar','jscripty',_0xac61('0x7'),_0xac61('0x8'),'bot','script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xac61('0x9')},'data1':{'type':Sequelize[_0xac61('0x4')](0x1000),'comment':_0xac61('0xa')},'data2':{'type':Sequelize[_0xac61('0x4')](0x1000),'comment':_0xac61('0xb')},'data3':{'type':Sequelize['STRING'](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[_0xac61('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xac61('0xc')},'data6':{'type':Sequelize['STRING'],'comments':_0xac61('0xd')},'data7':{'type':Sequelize['TEXT'],'comments':_0xac61('0xe')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index fec7b39..c591402 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 _0x720e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','Content-Range','reject','save','update','then','destroy','error','name','send','body','Action','find','catch','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring'];(function(_0xf0dbfd,_0x30e309){var _0x423d36=function(_0x4f699c){while(--_0x4f699c){_0xf0dbfd['push'](_0xf0dbfd['shift']());}};_0x423d36(++_0x30e309);}(_0x720e,0x74));var _0xe720=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x720e[_0x14e9f0];return _0xa63f7e;};'use strict';var emlformat=require(_0xe720('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe720('0x1'));var jsonpatch=require(_0xe720('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe720('0x3'));var Mustache=require(_0xe720('0x4'));var util=require('util');var path=require(_0xe720('0x5'));var sox=require(_0xe720('0x6'));var csv=require(_0xe720('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe720('0x8'));var _=require(_0xe720('0x9'));var squel=require(_0xe720('0xa'));var crypto=require(_0xe720('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe720('0x7'));var querystring=require(_0xe720('0xc'));var Papa=require(_0xe720('0xd'));var Redis=require(_0xe720('0xe'));var authService=require(_0xe720('0xf'));var qs=require(_0xe720('0x10'));var as=require(_0xe720('0x11'));var hardwareService=require(_0xe720('0x12'));var logger=require(_0xe720('0x13'))('api');var utils=require(_0xe720('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe720('0x15'));var db=require(_0xe720('0x16'))['db'];function respondWithStatusCode(_0xbeb431,_0x23701f){_0x23701f=_0x23701f||0xcc;return function(_0x3b9329){if(_0x3b9329){return _0xbeb431[_0xe720('0x17')](_0x23701f);}return _0xbeb431['status'](_0x23701f)[_0xe720('0x18')]();};}function respondWithResult(_0x2dae4f,_0x3d946e){_0x3d946e=_0x3d946e||0xc8;return function(_0x6ba971){if(_0x6ba971){return _0x2dae4f['status'](_0x3d946e)['json'](_0x6ba971);}};}function respondWithFilteredResult(_0x5c86f5,_0x652dca){return function(_0xce4899){if(_0xce4899){var _0x654868=typeof _0x652dca[_0xe720('0x19')]===_0xe720('0x1a')&&typeof _0x652dca['limit']===_0xe720('0x1a');var _0x5ac472=_0xce4899['count'];var _0x3905ea=_0x654868?0x0:_0x652dca['offset'];var _0x1016c7=_0x654868?_0xce4899[_0xe720('0x1b')]:_0x652dca[_0xe720('0x19')]+_0x652dca[_0xe720('0x1c')];var _0x43489d;if(_0x1016c7>=_0x5ac472){_0x1016c7=_0x5ac472;_0x43489d=0xc8;}else{_0x43489d=0xce;}_0x5c86f5[_0xe720('0x1d')](_0x43489d);return _0x5c86f5['set'](_0xe720('0x1e'),_0x3905ea+'-'+_0x1016c7+'/'+_0x5ac472)['json'](_0xce4899);}return null;};}function patchUpdates(_0x101770){return function(_0x543382){try{jsonpatch['apply'](_0x543382,_0x101770,!![]);}catch(_0x4832b5){return BPromise[_0xe720('0x1f')](_0x4832b5);}return _0x543382[_0xe720('0x20')]();};}function saveUpdates(_0xc9a2cd,_0x777d04){return function(_0x40d40a){if(_0x40d40a){return _0x40d40a[_0xe720('0x21')](_0xc9a2cd)[_0xe720('0x22')](function(_0x18a11a){return _0x18a11a;});}return null;};}function removeEntity(_0x5406d4,_0x75feb3){return function(_0x2bac7c){if(_0x2bac7c){return _0x2bac7c[_0xe720('0x23')]()['then'](function(){_0x5406d4[_0xe720('0x1d')](0xcc)[_0xe720('0x18')]();});}};}function handleEntityNotFound(_0x446987,_0x13c7f3){return function(_0x27ccfb){if(!_0x27ccfb){_0x446987[_0xe720('0x17')](0x194);}return _0x27ccfb;};}function handleError(_0x6c56d6,_0x1072b5){_0x1072b5=_0x1072b5||0x1f4;return function(_0x11022e){logger[_0xe720('0x24')](_0x11022e['stack']);if(_0x11022e['name']){delete _0x11022e[_0xe720('0x25')];}_0x6c56d6[_0xe720('0x1d')](_0x1072b5)[_0xe720('0x26')](_0x11022e);};}exports[_0xe720('0x21')]=function(_0x28b04c,_0x17c0cc){if(_0x28b04c[_0xe720('0x27')]['id']){delete _0x28b04c[_0xe720('0x27')]['id'];}return db[_0xe720('0x28')][_0xe720('0x29')]({'where':{'id':_0x28b04c['params']['id']}})['then'](handleEntityNotFound(_0x17c0cc,null))['then'](saveUpdates(_0x28b04c[_0xe720('0x27')],null))['then'](respondWithResult(_0x17c0cc,null))[_0xe720('0x2a')](handleError(_0x17c0cc,null));};exports['destroy']=function(_0x25f7da,_0x226c9f){return db[_0xe720('0x28')][_0xe720('0x29')]({'where':{'id':_0x25f7da['params']['id']}})[_0xe720('0x22')](handleEntityNotFound(_0x226c9f,null))['then'](removeEntity(_0x226c9f,null))[_0xe720('0x2a')](handleError(_0x226c9f,null));}; \ No newline at end of file +var _0x4901=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','sendStatus','error','stack','name','send','update','body','Action','find','then','catch','eml-format','rimraf','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x52788c,_0x235d0a){var _0x203c56=function(_0x394882){while(--_0x394882){_0x52788c['push'](_0x52788c['shift']());}};_0x203c56(++_0x235d0a);}(_0x4901,0x12d));var _0x1490=function(_0x550033,_0x244c08){_0x550033=_0x550033-0x0;var _0x41735f=_0x4901[_0x550033];return _0x41735f;};'use strict';var emlformat=require(_0x1490('0x0'));var rimraf=require(_0x1490('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1490('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1490('0x3'));var util=require(_0x1490('0x4'));var path=require('path');var sox=require(_0x1490('0x5'));var csv=require(_0x1490('0x6'));var ejs=require(_0x1490('0x7'));var fs=require('fs');var fs_extra=require(_0x1490('0x8'));var _=require(_0x1490('0x9'));var squel=require(_0x1490('0xa'));var crypto=require('crypto');var jsforce=require(_0x1490('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1490('0x6'));var querystring=require(_0x1490('0xc'));var Papa=require(_0x1490('0xd'));var Redis=require(_0x1490('0xe'));var authService=require(_0x1490('0xf'));var qs=require(_0x1490('0x10'));var as=require(_0x1490('0x11'));var hardwareService=require(_0x1490('0x12'));var logger=require('../../config/logger')(_0x1490('0x13'));var utils=require(_0x1490('0x14'));var config=require(_0x1490('0x15'));var licenseUtil=require(_0x1490('0x16'));var db=require(_0x1490('0x17'))['db'];function respondWithStatusCode(_0x53b63a,_0x534e14){_0x534e14=_0x534e14||0xcc;return function(_0x39d9e2){if(_0x39d9e2){return _0x53b63a['sendStatus'](_0x534e14);}return _0x53b63a[_0x1490('0x18')](_0x534e14)[_0x1490('0x19')]();};}function respondWithResult(_0x5d9d95,_0x3f40d6){_0x3f40d6=_0x3f40d6||0xc8;return function(_0x2202c9){if(_0x2202c9){return _0x5d9d95[_0x1490('0x18')](_0x3f40d6)[_0x1490('0x1a')](_0x2202c9);}};}function respondWithFilteredResult(_0x5ac258,_0x366652){return function(_0x1c3ede){if(_0x1c3ede){var _0x2bfcb5=typeof _0x366652[_0x1490('0x1b')]==='undefined'&&typeof _0x366652[_0x1490('0x1c')]==='undefined';var _0x11eec6=_0x1c3ede[_0x1490('0x1d')];var _0x5eb357=_0x2bfcb5?0x0:_0x366652[_0x1490('0x1b')];var _0x3ae55a=_0x2bfcb5?_0x1c3ede[_0x1490('0x1d')]:_0x366652['offset']+_0x366652[_0x1490('0x1c')];var _0x575992;if(_0x3ae55a>=_0x11eec6){_0x3ae55a=_0x11eec6;_0x575992=0xc8;}else{_0x575992=0xce;}_0x5ac258[_0x1490('0x18')](_0x575992);return _0x5ac258[_0x1490('0x1e')](_0x1490('0x1f'),_0x5eb357+'-'+_0x3ae55a+'/'+_0x11eec6)[_0x1490('0x1a')](_0x1c3ede);}return null;};}function patchUpdates(_0x40c184){return function(_0x294c68){try{jsonpatch[_0x1490('0x20')](_0x294c68,_0x40c184,!![]);}catch(_0x981ca){return BPromise[_0x1490('0x21')](_0x981ca);}return _0x294c68[_0x1490('0x22')]();};}function saveUpdates(_0x2e2c61,_0x242b21){return function(_0x1e076a){if(_0x1e076a){return _0x1e076a['update'](_0x2e2c61)['then'](function(_0x6b5725){return _0x6b5725;});}return null;};}function removeEntity(_0x239051,_0x1c616f){return function(_0x41d8d2){if(_0x41d8d2){return _0x41d8d2['destroy']()['then'](function(){_0x239051[_0x1490('0x18')](0xcc)[_0x1490('0x19')]();});}};}function handleEntityNotFound(_0x53564a,_0x33e029){return function(_0x29a060){if(!_0x29a060){_0x53564a[_0x1490('0x23')](0x194);}return _0x29a060;};}function handleError(_0x2e9924,_0x50e5d9){_0x50e5d9=_0x50e5d9||0x1f4;return function(_0x5ed16b){logger[_0x1490('0x24')](_0x5ed16b[_0x1490('0x25')]);if(_0x5ed16b[_0x1490('0x26')]){delete _0x5ed16b[_0x1490('0x26')];}_0x2e9924['status'](_0x50e5d9)[_0x1490('0x27')](_0x5ed16b);};}exports[_0x1490('0x28')]=function(_0x256bdf,_0x45dda9){if(_0x256bdf[_0x1490('0x29')]['id']){delete _0x256bdf['body']['id'];}return db[_0x1490('0x2a')][_0x1490('0x2b')]({'where':{'id':_0x256bdf['params']['id']}})['then'](handleEntityNotFound(_0x45dda9,null))[_0x1490('0x2c')](saveUpdates(_0x256bdf['body'],null))[_0x1490('0x2c')](respondWithResult(_0x45dda9,null))[_0x1490('0x2d')](handleError(_0x45dda9,null));};exports['destroy']=function(_0x251e43,_0x497d20){return db[_0x1490('0x2a')][_0x1490('0x2b')]({'where':{'id':_0x251e43['params']['id']}})[_0x1490('0x2c')](handleEntityNotFound(_0x497d20,null))[_0x1490('0x2c')](removeEntity(_0x497d20,null))[_0x1490('0x2d')](handleError(_0x497d20,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index dedc043..a951e1e 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 _0x12a7=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions'];(function(_0x2c621b,_0x5b44cb){var _0x38fce9=function(_0x2b1ad6){while(--_0x2b1ad6){_0x2c621b['push'](_0x2c621b['shift']());}};_0x38fce9(++_0x5b44cb);}(_0x12a7,0x198));var _0x712a=function(_0x5e306c,_0x663434){_0x5e306c=_0x5e306c-0x0;var _0x455ccb=_0x12a7[_0x5e306c];return _0x455ccb;};'use strict';var _=require(_0x712a('0x0'));var util=require(_0x712a('0x1'));var logger=require('../../config/logger')(_0x712a('0x2'));var moment=require(_0x712a('0x3'));var BPromise=require(_0x712a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x712a('0x5'));var rimraf=require(_0x712a('0x6'));var config=require(_0x712a('0x7'));var attributes=require(_0x712a('0x8'));module['exports']=function(_0x3c5cd1,_0x305dba){return _0x3c5cd1[_0x712a('0x9')](_0x712a('0xa'),attributes,{'tableName':_0x712a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05fe=['lodash','util','api','moment','bluebird','../../config/environment','./action.attributes','define','Action'];(function(_0x5e8460,_0x2003b5){var _0x3d50fd=function(_0x4c499f){while(--_0x4c499f){_0x5e8460['push'](_0x5e8460['shift']());}};_0x3d50fd(++_0x2003b5);}(_0x05fe,0x1a7));var _0xe05f=function(_0x97ac71,_0x5a0b5f){_0x97ac71=_0x97ac71-0x0;var _0x180617=_0x05fe[_0x97ac71];return _0x180617;};'use strict';var _=require(_0xe05f('0x0'));var util=require(_0xe05f('0x1'));var logger=require('../../config/logger')(_0xe05f('0x2'));var moment=require(_0xe05f('0x3'));var BPromise=require(_0xe05f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe05f('0x5'));var attributes=require(_0xe05f('0x6'));module['exports']=function(_0x3b4bea,_0xf65e86){return _0x3b4bea[_0xe05f('0x7')](_0xe05f('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index f8d781c..a646f81 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 _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x814b,0x1a2));var _0xb814=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x814b[_0x350343];return _0x9afc1c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x4975,0x86));var _0x5497=function(_0xbd0612,_0x2ca7f2){_0xbd0612=_0xbd0612-0x0;var _0x576af3=_0x4975[_0xbd0612];return _0x576af3;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 860c2ae..e13c97e 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 _0x3d8a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','destroy','exports','util','connect-timeout','Router'];(function(_0x3cdba4,_0x38853d){var _0x5b35bc=function(_0x3d77e7){while(--_0x3d77e7){_0x3cdba4['push'](_0x3cdba4['shift']());}};_0x5b35bc(++_0x38853d);}(_0x3d8a,0xdd));var _0xa3d8=function(_0x5e3c31,_0x4c0e35){_0x5e3c31=_0x5e3c31-0x0;var _0x576b70=_0x3d8a[_0x5e3c31];return _0x576b70;};'use strict';var multer=require('multer');var util=require(_0xa3d8('0x0'));var path=require('path');var timeout=require(_0xa3d8('0x1'));var express=require('express');var router=express[_0xa3d8('0x2')]();var fs_extra=require(_0xa3d8('0x3'));var auth=require(_0xa3d8('0x4'));var interaction=require(_0xa3d8('0x5'));var config=require(_0xa3d8('0x6'));var controller=require(_0xa3d8('0x7'));router[_0xa3d8('0x8')](_0xa3d8('0x9'),auth[_0xa3d8('0xa')](),controller[_0xa3d8('0xb')]);router['delete'](_0xa3d8('0x9'),auth[_0xa3d8('0xa')](),controller[_0xa3d8('0xc')]);module[_0xa3d8('0xd')]=router; \ No newline at end of file +var _0xd8e7=['../../components/auth/service','../../components/interaction/service','put','isAuthenticated','update','delete','destroy','exports','connect-timeout','Router'];(function(_0x4b290e,_0x222dc3){var _0x52867b=function(_0x385c58){while(--_0x385c58){_0x4b290e['push'](_0x4b290e['shift']());}};_0x52867b(++_0x222dc3);}(_0xd8e7,0xa8));var _0x7d8e=function(_0x1da2b9,_0x135d82){_0x1da2b9=_0x1da2b9-0x0;var _0xe0f9fc=_0xd8e7[_0x1da2b9];return _0xe0f9fc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7d8e('0x0'));var express=require('express');var router=express[_0x7d8e('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7d8e('0x2'));var interaction=require(_0x7d8e('0x3'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x7d8e('0x4')]('/:id',auth[_0x7d8e('0x5')](),controller[_0x7d8e('0x6')]);router[_0x7d8e('0x7')]('/:id',auth[_0x7d8e('0x5')](),controller[_0x7d8e('0x8')]);module[_0x7d8e('0x9')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1fbaf69..ece6caa 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 _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x310656,_0x23e449){var _0x1c5440=function(_0xf1b2c8){while(--_0xf1b2c8){_0x310656['push'](_0x310656['shift']());}};_0x1c5440(++_0x23e449);}(_0xeda8,0x104));var _0x8eda=function(_0x4e3e75,_0x100105){_0x4e3e75=_0x4e3e75-0x0;var _0x50b091=_0xeda8[_0x4e3e75];return _0x50b091;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file +var _0x4819=['TEXT','exports','STRING'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x4819,0xcd));var _0x9481=function(_0x47ee23,_0x58aad2){_0x47ee23=_0x47ee23-0x0;var _0x5b4718=_0x4819[_0x47ee23];return _0x5b4718;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b0779fe..0826b14 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 _0x2c5e=['clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','operator','AnalyticMetric','keyBy','select','from','output','web','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','savename','countTable','COUNT(*)','run','runReport','IS\x20EMPTY','alias','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','CustomReports','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse'];(function(_0x2ef2ba,_0x50540c){var _0x1805b0=function(_0x4e5849){while(--_0x4e5849){_0x2ef2ba['push'](_0x2ef2ba['shift']());}};_0x1805b0(++_0x50540c);}(_0x2c5e,0x165));var _0xe2c5=function(_0x4e9274,_0x49576e){_0x4e9274=_0x4e9274-0x0;var _0x8b474c=_0x2c5e[_0x4e9274];return _0x8b474c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2c5('0x0'));var zipdir=require(_0xe2c5('0x1'));var jsonpatch=require(_0xe2c5('0x2'));var rp=require('request-promise');var moment=require(_0xe2c5('0x3'));var BPromise=require(_0xe2c5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe2c5('0x5'));var csv=require(_0xe2c5('0x6'));var ejs=require(_0xe2c5('0x7'));var fs=require('fs');var fs_extra=require(_0xe2c5('0x8'));var _=require(_0xe2c5('0x9'));var squel=require(_0xe2c5('0xa'));var crypto=require(_0xe2c5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe2c5('0x6'));var querystring=require(_0xe2c5('0xc'));var Papa=require(_0xe2c5('0xd'));var Redis=require('ioredis');var authService=require(_0xe2c5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe2c5('0xf'));var hardwareService=require(_0xe2c5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xe2c5('0x11'));var config=require(_0xe2c5('0x12'));var licenseUtil=require(_0xe2c5('0x13'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x20a16f,_0x54cd66){_0x54cd66=_0x54cd66||0xcc;return function(_0x1a2df8){if(_0x1a2df8){return _0x20a16f['sendStatus'](_0x54cd66);}return _0x20a16f[_0xe2c5('0x14')](_0x54cd66)[_0xe2c5('0x15')]();};}function respondWithResult(_0x565533,_0x376a97){_0x376a97=_0x376a97||0xc8;return function(_0x2189e1){if(_0x2189e1){return _0x565533['status'](_0x376a97)[_0xe2c5('0x16')](_0x2189e1);}};}function respondWithFilteredResult(_0x58e887,_0x1a535c){return function(_0x3cda92){if(_0x3cda92){var _0x2ffc46=typeof _0x1a535c[_0xe2c5('0x17')]==='undefined'&&typeof _0x1a535c[_0xe2c5('0x18')]===_0xe2c5('0x19');var _0x412f81=_0x3cda92['count'];var _0x1678ad=_0x2ffc46?0x0:_0x1a535c[_0xe2c5('0x17')];var _0x10562a=_0x2ffc46?_0x3cda92['count']:_0x1a535c[_0xe2c5('0x17')]+_0x1a535c[_0xe2c5('0x18')];var _0x5b255;if(_0x10562a>=_0x412f81){_0x10562a=_0x412f81;_0x5b255=0xc8;}else{_0x5b255=0xce;}_0x58e887[_0xe2c5('0x14')](_0x5b255);return _0x58e887[_0xe2c5('0x1a')](_0xe2c5('0x1b'),_0x1678ad+'-'+_0x10562a+'/'+_0x412f81)[_0xe2c5('0x16')](_0x3cda92);}return null;};}function patchUpdates(_0x11a629){return function(_0x55acea){try{jsonpatch[_0xe2c5('0x1c')](_0x55acea,_0x11a629,!![]);}catch(_0x33eb88){return BPromise[_0xe2c5('0x1d')](_0x33eb88);}return _0x55acea['save']();};}function saveUpdates(_0xdb979,_0x1a3235){return function(_0x3f690d){if(_0x3f690d){return _0x3f690d[_0xe2c5('0x1e')](_0xdb979)[_0xe2c5('0x1f')](function(_0x5ee850){return _0x5ee850;});}return null;};}function removeEntity(_0xd149a3,_0x35880c){return function(_0x19ca30){if(_0x19ca30){return _0x19ca30[_0xe2c5('0x20')]()[_0xe2c5('0x1f')](function(){var _0x4a61da=_0x19ca30[_0xe2c5('0x21')]({'plain':!![]});var _0x34e603='CustomReports';return db[_0xe2c5('0x22')][_0xe2c5('0x20')]({'where':{'type':_0x34e603,'resourceId':_0x4a61da['id']}})[_0xe2c5('0x1f')](function(){return _0x19ca30;});})[_0xe2c5('0x1f')](function(){_0xd149a3[_0xe2c5('0x14')](0xcc)[_0xe2c5('0x15')]();});}};}function handleEntityNotFound(_0x31c30b,_0x5d11fe){return function(_0x509b80){if(!_0x509b80){_0x31c30b[_0xe2c5('0x23')](0x194);}return _0x509b80;};}function handleError(_0x4b3672,_0x468ff7){_0x468ff7=_0x468ff7||0x1f4;return function(_0x1abdc8){logger[_0xe2c5('0x24')](_0x1abdc8['stack']);if(_0x1abdc8[_0xe2c5('0x25')]){delete _0x1abdc8[_0xe2c5('0x25')];}_0x4b3672[_0xe2c5('0x14')](_0x468ff7)[_0xe2c5('0x26')](_0x1abdc8);};}exports['index']=function(_0x23e6c8,_0x4d7bf8){var _0x9e700c={},_0x4ae816={},_0x4c9b90={'count':0x0,'rows':[]};var _0x43f76e=_[_0xe2c5('0x27')](db[_0xe2c5('0x28')][_0xe2c5('0x29')],function(_0x5a69ce){return{'name':_0x5a69ce[_0xe2c5('0x2a')],'type':_0x5a69ce[_0xe2c5('0x2b')][_0xe2c5('0x2c')]};});_0x4ae816['model']=_['map'](_0x43f76e,_0xe2c5('0x25'));_0x4ae816[_0xe2c5('0x2d')]=_[_0xe2c5('0x2e')](_0x23e6c8['query']);_0x4ae816['filters']=_[_0xe2c5('0x2f')](_0x4ae816[_0xe2c5('0x30')],_0x4ae816['query']);_0x9e700c['attributes']=_[_0xe2c5('0x2f')](_0x4ae816['model'],qs[_0xe2c5('0x31')](_0x23e6c8[_0xe2c5('0x2d')][_0xe2c5('0x31')]));_0x9e700c[_0xe2c5('0x32')]=_0x9e700c[_0xe2c5('0x32')][_0xe2c5('0x33')]?_0x9e700c[_0xe2c5('0x32')]:_0x4ae816['model'];if(!_0x23e6c8['query'][_0xe2c5('0x34')](_0xe2c5('0x35'))){_0x9e700c[_0xe2c5('0x18')]=qs[_0xe2c5('0x18')](_0x23e6c8['query'][_0xe2c5('0x18')]);_0x9e700c[_0xe2c5('0x17')]=qs[_0xe2c5('0x17')](_0x23e6c8[_0xe2c5('0x2d')]['offset']);}_0x9e700c[_0xe2c5('0x36')]=qs[_0xe2c5('0x37')](_0x23e6c8['query']['sort']);_0x9e700c[_0xe2c5('0x38')]=qs['filters'](_[_0xe2c5('0x39')](_0x23e6c8[_0xe2c5('0x2d')],_0x4ae816[_0xe2c5('0x3a')]),_0x43f76e);if(_0x23e6c8['query'][_0xe2c5('0x3b')]){_0x9e700c[_0xe2c5('0x38')]=_['merge'](_0x9e700c['where'],{'$or':_[_0xe2c5('0x27')](_0x43f76e,function(_0x30ce10){if(_0x30ce10['type']!==_0xe2c5('0x3c')){var _0x214bca={};_0x214bca[_0x30ce10['name']]={'$like':'%'+_0x23e6c8[_0xe2c5('0x2d')]['filter']+'%'};return _0x214bca;}})});}_0x9e700c=_[_0xe2c5('0x3d')]({},_0x9e700c,_0x23e6c8[_0xe2c5('0x3e')]);var _0x42261e={'where':_0x9e700c['where']};return db['AnalyticCustomReport'][_0xe2c5('0x3f')](_0x42261e)[_0xe2c5('0x1f')](function(_0x142cd3){_0x4c9b90[_0xe2c5('0x3f')]=_0x142cd3;if(_0x23e6c8[_0xe2c5('0x2d')][_0xe2c5('0x40')]){_0x9e700c[_0xe2c5('0x41')]=[{'all':!![]}];}return db[_0xe2c5('0x28')][_0xe2c5('0x42')](_0x9e700c);})[_0xe2c5('0x1f')](function(_0xc945f4){_0x4c9b90[_0xe2c5('0x43')]=_0xc945f4;return _0x4c9b90;})['then'](respondWithFilteredResult(_0x4d7bf8,_0x9e700c))[_0xe2c5('0x44')](handleError(_0x4d7bf8,null));};exports[_0xe2c5('0x45')]=function(_0x161d7a,_0x5dc06c){var _0x1e88de={'raw':![],'where':{'id':_0x161d7a[_0xe2c5('0x46')]['id']}},_0x34f01a={};_0x34f01a[_0xe2c5('0x30')]=_['keys'](db[_0xe2c5('0x28')][_0xe2c5('0x29')]);_0x34f01a[_0xe2c5('0x2d')]=_[_0xe2c5('0x2e')](_0x161d7a[_0xe2c5('0x2d')]);_0x34f01a['filters']=_[_0xe2c5('0x2f')](_0x34f01a[_0xe2c5('0x30')],_0x34f01a[_0xe2c5('0x2d')]);_0x1e88de[_0xe2c5('0x32')]=_['intersection'](_0x34f01a[_0xe2c5('0x30')],qs[_0xe2c5('0x31')](_0x161d7a[_0xe2c5('0x2d')][_0xe2c5('0x31')]));_0x1e88de[_0xe2c5('0x32')]=_0x1e88de[_0xe2c5('0x32')]['length']?_0x1e88de[_0xe2c5('0x32')]:_0x34f01a[_0xe2c5('0x30')];if(_0x161d7a['query'][_0xe2c5('0x40')]){_0x1e88de[_0xe2c5('0x41')]=[{'all':!![]}];}_0x1e88de=_['merge']({},_0x1e88de,_0x161d7a[_0xe2c5('0x3e')]);return db[_0xe2c5('0x28')][_0xe2c5('0x47')](_0x1e88de)['then'](handleEntityNotFound(_0x5dc06c,null))[_0xe2c5('0x1f')](respondWithResult(_0x5dc06c,null))[_0xe2c5('0x44')](handleError(_0x5dc06c,null));};exports[_0xe2c5('0x48')]=function(_0x1e15b1,_0x527666){return db[_0xe2c5('0x28')][_0xe2c5('0x48')](_0x1e15b1[_0xe2c5('0x49')],{})[_0xe2c5('0x1f')](function(_0x133c12){var _0x13e207=_0x1e15b1['user'][_0xe2c5('0x21')]({'plain':!![]});if(!_0x13e207)throw new Error(_0xe2c5('0x4a'));if(_0x13e207[_0xe2c5('0x4b')]===_0xe2c5('0x4c')){var _0x16e234=_0x133c12['get']({'plain':!![]});var _0x55ed85='Reports';return db[_0xe2c5('0x4d')][_0xe2c5('0x47')]({'where':{'name':_0x55ed85,'userProfileId':_0x13e207[_0xe2c5('0x4e')]},'raw':!![]})[_0xe2c5('0x1f')](function(_0x13516d){if(_0x13516d&&_0x13516d[_0xe2c5('0x4f')]===0x0){return db[_0xe2c5('0x22')][_0xe2c5('0x48')]({'name':_0x16e234[_0xe2c5('0x25')],'resourceId':_0x16e234['id'],'type':_0xe2c5('0x50'),'sectionId':_0x13516d['id']},{})[_0xe2c5('0x1f')](function(){return _0x133c12;});}else{return _0x133c12;}})['catch'](function(_0x3fcb6f){logger[_0xe2c5('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fcb6f);throw _0x3fcb6f;});}return _0x133c12;})[_0xe2c5('0x1f')](respondWithResult(_0x527666,0xc9))[_0xe2c5('0x44')](handleError(_0x527666,null));};exports[_0xe2c5('0x1e')]=function(_0x3cb5e0,_0x315d7f){if(_0x3cb5e0[_0xe2c5('0x49')]['id']){delete _0x3cb5e0[_0xe2c5('0x49')]['id'];}return db[_0xe2c5('0x28')][_0xe2c5('0x47')]({'where':{'id':_0x3cb5e0[_0xe2c5('0x46')]['id']}})[_0xe2c5('0x1f')](handleEntityNotFound(_0x315d7f,null))[_0xe2c5('0x1f')](saveUpdates(_0x3cb5e0[_0xe2c5('0x49')],null))[_0xe2c5('0x1f')](respondWithResult(_0x315d7f,null))[_0xe2c5('0x44')](handleError(_0x315d7f,null));};exports[_0xe2c5('0x20')]=function(_0x5ab94c,_0x2cce28){return db['AnalyticCustomReport']['find']({'where':{'id':_0x5ab94c[_0xe2c5('0x46')]['id']}})[_0xe2c5('0x1f')](handleEntityNotFound(_0x2cce28,null))[_0xe2c5('0x1f')](removeEntity(_0x2cce28,null))[_0xe2c5('0x44')](handleError(_0x2cce28,null));};exports[_0xe2c5('0x51')]=function(_0x1b871f,_0x5c3cd3){var _0x579fd0=0xa;var _0x1bd2b0=[_0xe2c5('0x52'),'left_join',_0xe2c5('0x53'),_0xe2c5('0x54')];var _0x5d943a={'SUM':_0xe2c5('0x55'),'COUNT':_0xe2c5('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe2c5('0x57'),'MIN':_0xe2c5('0x58'),'AVG':_0xe2c5('0x59'),'GROUP_CONCAT':_0xe2c5('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x9c679e={'SEC_TO_TIME':_0xe2c5('0x5b'),'DATE':_0xe2c5('0x5c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe2c5('0x5d')};var _0x513a93=function(_0x520b17){return!_['includes']([_0xe2c5('0x5e'),_0xe2c5('0x5f'),'IS\x20EMPTY',_0xe2c5('0x60')],_0x520b17);};var _0x3619a6=function(_0x32b8c1){if(!_0x32b8c1||!_0x32b8c1[_0xe2c5('0x61')][_0xe2c5('0x33')]){return'';}for(var _0x43c27c='(',_0x1aee9b=0x0;_0x1aee9b<_0x32b8c1[_0xe2c5('0x61')][_0xe2c5('0x33')];_0x1aee9b+=0x1){_0x1aee9b>0x0&&(_0x43c27c+='\x20'+_0x32b8c1['operator']+'\x20');_0x43c27c+=_0x32b8c1[_0xe2c5('0x61')][_0x1aee9b][_0xe2c5('0x62')]?_0x3619a6(_0x32b8c1[_0xe2c5('0x61')][_0x1aee9b][_0xe2c5('0x62')]):_0x32b8c1['rules'][_0x1aee9b][_0xe2c5('0x63')]+'\x20'+_0x32b8c1[_0xe2c5('0x61')][_0x1aee9b]['condition']+(_0x513a93(_0x32b8c1['rules'][_0x1aee9b][_0xe2c5('0x64')])?'\x20'+_0x32b8c1['rules'][_0x1aee9b][_0xe2c5('0x65')]:'');}return _0x43c27c+')';};var _0x1ded4a={'where':{'id':_0x1b871f['params']['id']}},_0x331609,_0x48d3c4,_0xf76320,_0x3a3c50,_0x2172f4;_0x1ded4a=_[_0xe2c5('0x3d')]({},_0x1ded4a,_0x1b871f[_0xe2c5('0x3e')]);return db['AnalyticCustomReport'][_0xe2c5('0x47')](_0x1ded4a)[_0xe2c5('0x1f')](function(_0x5d2fa2){if(_0x5d2fa2){_0x331609=_0x5d2fa2;return _0x5d2fa2[_0xe2c5('0x66')]();}return null;})[_0xe2c5('0x1f')](function(_0x4a2cdc){if(_0x4a2cdc){if(!_0x4a2cdc[_0xe2c5('0x33')]){throw new db[(_0xe2c5('0x67'))][(_0xe2c5('0x68'))](_0xe2c5('0x69'),0x193);}_0x48d3c4=_0x4a2cdc;return db['AnalyticMetric'][_0xe2c5('0x42')]({'raw':!![]});}return null;})[_0xe2c5('0x1f')](function(_0xda88b4){if(_0xda88b4){_0xf76320=_['keyBy'](_0xda88b4,'id');var _0x5ec358;var _0x2f9d1d=squel['select']();_0x2f9d1d['from'](_0x331609[_0xe2c5('0x6a')]);for(var _0xefe69e=0x0;_0xefe69e<_0x48d3c4['length'];_0xefe69e+=0x1){_0x5ec358=_0x48d3c4[_0xefe69e]['MetricId']?_0xf76320[_0x48d3c4[_0xefe69e][_0xe2c5('0x6b')]][_0xe2c5('0x6c')]:_0x48d3c4[_0xefe69e]['field'];_0x5ec358=_0x48d3c4[_0xefe69e][_0xe2c5('0x6d')]?_[_0xe2c5('0x6e')](_0x5d943a[_0x48d3c4[_0xefe69e]['function']],'%s',_0x5ec358):_0x5ec358;_0x5ec358=_0x48d3c4[_0xefe69e][_0xe2c5('0x6f')]?_[_0xe2c5('0x6e')](_0x9c679e[_0x48d3c4[_0xefe69e][_0xe2c5('0x6f')]],'%s',_0x5ec358):_0x5ec358;if(_0x48d3c4[_0xefe69e][_0xe2c5('0x70')]){_0x2f9d1d[_0xe2c5('0x62')](_0x5ec358);}_0x48d3c4[_0xefe69e][_0xe2c5('0x71')]&&_0x2f9d1d[_0xe2c5('0x36')](_0x5ec358,_0x48d3c4[_0xefe69e]['orderBy']===_0xe2c5('0x72')?![]:!![]);_0x2f9d1d[_0xe2c5('0x63')](_0x5ec358,_0x48d3c4[_0xefe69e]['alias']||_0x5ec358);}if(_0x331609[_0xe2c5('0x73')]){_0x331609[_0xe2c5('0x73')]=JSON['parse'](_0x331609[_0xe2c5('0x73')]);for(var _0xb12860=0x0;_0xb12860<_0x331609['joins'][_0xe2c5('0x33')];_0xb12860+=0x1){if(_0x331609[_0xe2c5('0x73')][_0xb12860][_0xe2c5('0x2b')]&&_[_0xe2c5('0x74')](_0x1bd2b0,_0x331609[_0xe2c5('0x73')][_0xb12860][_0xe2c5('0x2b')])&&_0x331609['joins'][_0xb12860][_0xe2c5('0x75')]&&_0x331609[_0xe2c5('0x73')][_0xb12860][_0xe2c5('0x76')]&&_0x331609[_0xe2c5('0x73')][_0xb12860][_0xe2c5('0x77')]){_0x2f9d1d[_0x331609[_0xe2c5('0x73')][_0xb12860][_0xe2c5('0x2b')]](_0x331609[_0xe2c5('0x73')][_0xb12860][_0xe2c5('0x76')],null,util['format'](_0xe2c5('0x78'),_0x331609[_0xe2c5('0x6a')],_0x331609[_0xe2c5('0x73')][_0xb12860][_0xe2c5('0x75')],_0x331609['joins'][_0xb12860]['foreignTable'],_0x331609[_0xe2c5('0x73')][_0xb12860][_0xe2c5('0x77')]));}}}if(_0x331609['conditions']){_0x331609[_0xe2c5('0x79')]=JSON[_0xe2c5('0x7a')](_0x331609[_0xe2c5('0x79')]);_0x2f9d1d[_0xe2c5('0x38')](_0x3619a6(_0x331609[_0xe2c5('0x79')]['group']));}_0x2172f4=_0x2f9d1d[_0xe2c5('0x7b')]();_0x2f9d1d[_0xe2c5('0x18')](_0x579fd0);_0x2f9d1d[_0xe2c5('0x17')](0x0);logger[_0xe2c5('0x7c')](_0xe2c5('0x7d'),_0x2f9d1d[_0xe2c5('0x7e')]());return dbH[_0xe2c5('0x7f')][_0xe2c5('0x2d')](_0x2f9d1d['toString'](),{'type':dbH['sequelize'][_0xe2c5('0x80')][_0xe2c5('0x81')]});}})[_0xe2c5('0x1f')](respondWithResult(_0x5c3cd3,null))[_0xe2c5('0x44')](handleError(_0x5c3cd3,null));};function runReport(_0x1b396e,_0x4e61d0,_0x56e7c9){var _0x646a4a=_0x4e61d0[_0xe2c5('0x25')];var _0x58b264=0xa;var _0xe39dd0=[_0xe2c5('0x52'),_0xe2c5('0x82'),_0xe2c5('0x53'),_0xe2c5('0x54')];var _0x5b1a2e={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe2c5('0x83'),'MAX':_0xe2c5('0x57'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe2c5('0x84'),'GROUP_CONCAT DESC':_0xe2c5('0x85')};var _0x19f983={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe2c5('0x5c'),'HOUR':_0xe2c5('0x86'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe2c5('0x5d')};var _0x87b0d4=function(_0x2b83fb){return!_[_0xe2c5('0x74')]([_0xe2c5('0x5e'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xe2c5('0x60')],_0x2b83fb);};var _0x1b9dfe=function(_0xf243cf){if(!_0xf243cf||!_0xf243cf[_0xe2c5('0x61')]['length']){return'';}for(var _0x1fa381='(',_0x5cf72b=0x0;_0x5cf72b<_0xf243cf[_0xe2c5('0x61')][_0xe2c5('0x33')];_0x5cf72b+=0x1){_0x5cf72b>0x0&&(_0x1fa381+='\x20'+_0xf243cf[_0xe2c5('0x87')]+'\x20');_0x1fa381+=_0xf243cf[_0xe2c5('0x61')][_0x5cf72b][_0xe2c5('0x62')]?_0x1b9dfe(_0xf243cf[_0xe2c5('0x61')][_0x5cf72b]['group']):_0xf243cf[_0xe2c5('0x61')][_0x5cf72b][_0xe2c5('0x63')]+'\x20'+_0xf243cf[_0xe2c5('0x61')][_0x5cf72b][_0xe2c5('0x64')]+(_0x87b0d4(_0xf243cf[_0xe2c5('0x61')][_0x5cf72b][_0xe2c5('0x64')])?'\x20'+_0xf243cf[_0xe2c5('0x61')][_0x5cf72b]['value']:'');}return _0x1fa381+')';};var _0x3f0f04={'where':{'id':_0x1b396e['id']}},_0x593c17,_0x3b49ff,_0x378773,_0x466915,_0x957be8;_0x3f0f04=_[_0xe2c5('0x3d')]({},_0x3f0f04,_0x56e7c9);return db[_0xe2c5('0x28')][_0xe2c5('0x47')](_0x3f0f04)[_0xe2c5('0x1f')](function(_0x36dfba){if(_0x36dfba){_0x593c17=_0x36dfba;return _0x36dfba[_0xe2c5('0x66')]();}return null;})['then'](function(_0x57cf1b){if(_0x57cf1b){if(!_0x57cf1b['length']){throw new db['Sequelize'][(_0xe2c5('0x68'))](_0xe2c5('0x69'),0x193);}_0x3b49ff=_0x57cf1b;return db[_0xe2c5('0x88')][_0xe2c5('0x42')]({'raw':!![]});}return null;})[_0xe2c5('0x1f')](function(_0x283a84){if(_0x283a84){_0x378773=_[_0xe2c5('0x89')](_0x283a84,'id');var _0x32777c;var _0x9656e0=squel[_0xe2c5('0x8a')]();_0x9656e0[_0xe2c5('0x8b')](_0x593c17[_0xe2c5('0x6a')]);for(var _0x425516=0x0;_0x425516<_0x3b49ff[_0xe2c5('0x33')];_0x425516+=0x1){_0x32777c=_0x3b49ff[_0x425516][_0xe2c5('0x6b')]?_0x378773[_0x3b49ff[_0x425516][_0xe2c5('0x6b')]][_0xe2c5('0x6c')]:_0x3b49ff[_0x425516][_0xe2c5('0x63')];_0x32777c=_0x3b49ff[_0x425516][_0xe2c5('0x6d')]?_[_0xe2c5('0x6e')](_0x5b1a2e[_0x3b49ff[_0x425516][_0xe2c5('0x6d')]],'%s',_0x32777c):_0x32777c;_0x32777c=_0x3b49ff[_0x425516][_0xe2c5('0x6f')]?_[_0xe2c5('0x6e')](_0x19f983[_0x3b49ff[_0x425516][_0xe2c5('0x6f')]],'%s',_0x32777c):_0x32777c;if(_0x3b49ff[_0x425516][_0xe2c5('0x70')]){_0x9656e0[_0xe2c5('0x62')](_0x32777c);}_0x3b49ff[_0x425516][_0xe2c5('0x71')]&&_0x9656e0[_0xe2c5('0x36')](_0x32777c,_0x3b49ff[_0x425516][_0xe2c5('0x71')]===_0xe2c5('0x72')?![]:!![]);_0x9656e0[_0xe2c5('0x63')](_0x32777c,_0x3b49ff[_0x425516]['alias']||_0x32777c);}if(_0x593c17['joins']){_0x593c17[_0xe2c5('0x73')]=JSON[_0xe2c5('0x7a')](_0x593c17[_0xe2c5('0x73')]);for(var _0x306530=0x0;_0x306530<_0x593c17[_0xe2c5('0x73')][_0xe2c5('0x33')];_0x306530+=0x1){if(_0x593c17[_0xe2c5('0x73')][_0x306530]['type']&&_[_0xe2c5('0x74')](_0xe39dd0,_0x593c17[_0xe2c5('0x73')][_0x306530][_0xe2c5('0x2b')])&&_0x593c17[_0xe2c5('0x73')][_0x306530][_0xe2c5('0x75')]&&_0x593c17[_0xe2c5('0x73')][_0x306530][_0xe2c5('0x76')]&&_0x593c17[_0xe2c5('0x73')][_0x306530][_0xe2c5('0x77')]){_0x9656e0[_0x593c17[_0xe2c5('0x73')][_0x306530][_0xe2c5('0x2b')]](_0x593c17[_0xe2c5('0x73')][_0x306530][_0xe2c5('0x76')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x593c17['table'],_0x593c17[_0xe2c5('0x73')][_0x306530][_0xe2c5('0x75')],_0x593c17[_0xe2c5('0x73')][_0x306530][_0xe2c5('0x76')],_0x593c17[_0xe2c5('0x73')][_0x306530][_0xe2c5('0x77')]));}}}if(_0x593c17[_0xe2c5('0x79')]){_0x593c17[_0xe2c5('0x79')]=JSON[_0xe2c5('0x7a')](_0x593c17[_0xe2c5('0x79')]);_0x9656e0['where'](_0x1b9dfe(_0x593c17['conditions'][_0xe2c5('0x62')]));}_0x957be8=_0x9656e0[_0xe2c5('0x7b')]();_0x9656e0[_0xe2c5('0x18')](_0x58b264);_0x9656e0['offset'](0x0);return;}})[_0xe2c5('0x1f')](function(){if(_0x4e61d0[_0xe2c5('0x8c')]===_0xe2c5('0x8d')){return null;}var _0x3c761c=_['merge'](_0x4e61d0,{'name':_0x4e61d0['fullPath']||_0x4e61d0[_0xe2c5('0x25')]||_0x593c17[_0xe2c5('0x25')],'basename':_0x646a4a,'savename':util[_0xe2c5('0x6f')]('%s-%s.%s',_0x4e61d0[_0xe2c5('0x25')]||_0x593c17[_0xe2c5('0x25')],require('randomstring')[_0xe2c5('0x8e')](0x4),_0x4e61d0[_0xe2c5('0x8c')]||_0xe2c5('0x8f')),'reportId':_0x593c17['id'],'reportType':_0xe2c5('0x90')});return db[_0xe2c5('0x91')][_0xe2c5('0x48')](_0x3c761c,{'raw':!![]});})['then'](function(_0x43794f){if(_0x593c17[_0xe2c5('0x6a')]===_0xe2c5('0x92')){_0x957be8[_0xe2c5('0x38')](_0x593c17[_0xe2c5('0x6a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4e61d0[_0xe2c5('0x93')],_0x4e61d0[_0xe2c5('0x94')]);}else{_0x957be8[_0xe2c5('0x38')](_0x593c17['table']+_0xe2c5('0x95'),_0x4e61d0[_0xe2c5('0x93')],_0x4e61d0[_0xe2c5('0x94')]);}if(_0x43794f){logger[_0xe2c5('0x96')](_0xe2c5('0x97'),_0x957be8[_0xe2c5('0x7e')]());require(_0xe2c5('0x98'))['fork'](path[_0xe2c5('0x52')](__dirname,'../../components/export/',_0x43794f[_0xe2c5('0x8c')]),[_0x43794f['id'],_0x957be8[_0xe2c5('0x7e')](),path[_0xe2c5('0x52')](__dirname,'../../files/reports',_0x43794f[_0xe2c5('0x99')]),_0x646a4a]);return _0x43794f;}else{var _0x1dbecb=squel['select']();_0x1dbecb['from']('('+_0x957be8[_0xe2c5('0x7e')]()+')',_0xe2c5('0x9a'));_0x1dbecb[_0xe2c5('0x63')](_0xe2c5('0x9b'),'count');_0x957be8['limit'](_0x4e61d0[_0xe2c5('0x18')]||_0x58b264);_0x957be8[_0xe2c5('0x17')](_0x4e61d0['offset']||0x0);return dbH[_0xe2c5('0x7f')][_0xe2c5('0x2d')](_0x1dbecb[_0xe2c5('0x7e')](),{'type':dbH[_0xe2c5('0x7f')]['QueryTypes'][_0xe2c5('0x81')]})[_0xe2c5('0x1f')](function(_0x284693){if(!_0x284693['length']){_0x466915=0x0;}else{_0x466915=_0x284693[0x0]['count']||0x0;}return dbH['sequelize'][_0xe2c5('0x2d')](_0x957be8[_0xe2c5('0x7e')](),{'type':dbH['sequelize'][_0xe2c5('0x80')]['SELECT']});})['then'](function(_0x3da87a){return{'rows':_0x3da87a||[],'count':_0x466915};});}});}exports[_0xe2c5('0x9c')]=function(_0x412fed,_0x139394){return runReport(_0x412fed[_0xe2c5('0x46')],_0x412fed[_0xe2c5('0x2d')],_0x412fed[_0xe2c5('0x3e')])[_0xe2c5('0x1f')](respondWithResult(_0x139394,null))[_0xe2c5('0x44')](handleError(_0x139394,null));};exports[_0xe2c5('0x9d')]=runReport;exports['query']=function(_0x368901,_0x3e1d54){var _0x881443=0xa;var _0x33da53=[_0xe2c5('0x52'),_0xe2c5('0x82'),_0xe2c5('0x53'),_0xe2c5('0x54')];var _0x524969={'SUM':_0xe2c5('0x55'),'COUNT':_0xe2c5('0x56'),'COUNT DISTINCT':_0xe2c5('0x83'),'MAX':_0xe2c5('0x57'),'MIN':_0xe2c5('0x58'),'AVG':_0xe2c5('0x59'),'GROUP_CONCAT':_0xe2c5('0x5a'),'GROUP_CONCAT ASC':_0xe2c5('0x84'),'GROUP_CONCAT DESC':_0xe2c5('0x85')};var _0xfea9cb={'SEC_TO_TIME':_0xe2c5('0x5b'),'DATE':_0xe2c5('0x5c'),'HOUR':_0xe2c5('0x86'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe2c5('0x5d')};var _0x14f738=function(_0x2c2c58){return!_[_0xe2c5('0x74')]([_0xe2c5('0x5e'),_0xe2c5('0x5f'),_0xe2c5('0x9e'),_0xe2c5('0x60')],_0x2c2c58);};var _0x2259c6=function(_0x46f495){if(!_0x46f495||!_0x46f495[_0xe2c5('0x61')][_0xe2c5('0x33')]){return'';}for(var _0x1be912='(',_0x5117af=0x0;_0x5117af<_0x46f495['rules'][_0xe2c5('0x33')];_0x5117af+=0x1){_0x5117af>0x0&&(_0x1be912+='\x20'+_0x46f495[_0xe2c5('0x87')]+'\x20');_0x1be912+=_0x46f495[_0xe2c5('0x61')][_0x5117af][_0xe2c5('0x62')]?_0x2259c6(_0x46f495[_0xe2c5('0x61')][_0x5117af]['group']):_0x46f495[_0xe2c5('0x61')][_0x5117af][_0xe2c5('0x63')]+'\x20'+_0x46f495[_0xe2c5('0x61')][_0x5117af]['condition']+(_0x14f738(_0x46f495[_0xe2c5('0x61')][_0x5117af][_0xe2c5('0x64')])?'\x20'+_0x46f495['rules'][_0x5117af][_0xe2c5('0x65')]:'');}return _0x1be912+')';};var _0x497136={'where':{'id':_0x368901[_0xe2c5('0x46')]['id']}},_0x1fecaa,_0x21a6fa,_0x4bb56d,_0x51e5d8,_0x4ab270;_0x497136=_[_0xe2c5('0x3d')]({},_0x497136,_0x368901[_0xe2c5('0x3e')]);return db[_0xe2c5('0x28')][_0xe2c5('0x47')](_0x497136)[_0xe2c5('0x1f')](function(_0xd3af34){if(_0xd3af34){_0x1fecaa=_0xd3af34;return _0xd3af34['getFields']();}return null;})[_0xe2c5('0x1f')](function(_0x48a1dc){if(_0x48a1dc){if(!_0x48a1dc[_0xe2c5('0x33')]){throw new db[(_0xe2c5('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x21a6fa=_0x48a1dc;return db[_0xe2c5('0x88')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3946a8){if(_0x3946a8){_0x4bb56d=_['keyBy'](_0x3946a8,'id');var _0x1ba773;var _0x58339b=squel[_0xe2c5('0x8a')]();_0x58339b[_0xe2c5('0x8b')](_0x1fecaa['table']);for(var _0xacf392=0x0;_0xacf392<_0x21a6fa[_0xe2c5('0x33')];_0xacf392+=0x1){_0x1ba773=_0x21a6fa[_0xacf392][_0xe2c5('0x6b')]?_0x4bb56d[_0x21a6fa[_0xacf392][_0xe2c5('0x6b')]][_0xe2c5('0x6c')]:_0x21a6fa[_0xacf392][_0xe2c5('0x63')];_0x1ba773=_0x21a6fa[_0xacf392]['function']?_[_0xe2c5('0x6e')](_0x524969[_0x21a6fa[_0xacf392]['function']],'%s',_0x1ba773):_0x1ba773;_0x1ba773=_0x21a6fa[_0xacf392]['format']?_[_0xe2c5('0x6e')](_0xfea9cb[_0x21a6fa[_0xacf392][_0xe2c5('0x6f')]],'%s',_0x1ba773):_0x1ba773;if(_0x21a6fa[_0xacf392][_0xe2c5('0x70')]){_0x58339b[_0xe2c5('0x62')](_0x1ba773);}_0x21a6fa[_0xacf392]['orderBy']&&_0x58339b['order'](_0x1ba773,_0x21a6fa[_0xacf392]['orderBy']==='DESC'?![]:!![]);_0x58339b[_0xe2c5('0x63')](_0x1ba773,_0x21a6fa[_0xacf392][_0xe2c5('0x9f')]||_0x1ba773);}if(_0x1fecaa[_0xe2c5('0x73')]){_0x1fecaa[_0xe2c5('0x73')]=JSON['parse'](_0x1fecaa[_0xe2c5('0x73')]);for(var _0x123b1a=0x0;_0x123b1a<_0x1fecaa[_0xe2c5('0x73')][_0xe2c5('0x33')];_0x123b1a+=0x1){if(_0x1fecaa[_0xe2c5('0x73')][_0x123b1a][_0xe2c5('0x2b')]&&_[_0xe2c5('0x74')](_0x33da53,_0x1fecaa[_0xe2c5('0x73')][_0x123b1a]['type'])&&_0x1fecaa[_0xe2c5('0x73')][_0x123b1a][_0xe2c5('0x75')]&&_0x1fecaa[_0xe2c5('0x73')][_0x123b1a][_0xe2c5('0x76')]&&_0x1fecaa[_0xe2c5('0x73')][_0x123b1a][_0xe2c5('0x77')]){_0x58339b[_0x1fecaa[_0xe2c5('0x73')][_0x123b1a][_0xe2c5('0x2b')]](_0x1fecaa[_0xe2c5('0x73')][_0x123b1a][_0xe2c5('0x76')],null,util[_0xe2c5('0x6f')](_0xe2c5('0x78'),_0x1fecaa['table'],_0x1fecaa[_0xe2c5('0x73')][_0x123b1a][_0xe2c5('0x75')],_0x1fecaa[_0xe2c5('0x73')][_0x123b1a][_0xe2c5('0x76')],_0x1fecaa[_0xe2c5('0x73')][_0x123b1a][_0xe2c5('0x77')]));}}}if(_0x1fecaa['conditions']){_0x1fecaa[_0xe2c5('0x79')]=JSON[_0xe2c5('0x7a')](_0x1fecaa['conditions']);_0x58339b[_0xe2c5('0x38')](_0x2259c6(_0x1fecaa[_0xe2c5('0x79')][_0xe2c5('0x62')]));}_0x4ab270=_0x58339b[_0xe2c5('0x7b')]();_0x58339b['limit'](_0x881443);_0x58339b[_0xe2c5('0x17')](0x0);logger[_0xe2c5('0x7c')](_0xe2c5('0x7d'),_0x58339b[_0xe2c5('0x7e')]());return dbH[_0xe2c5('0x7f')][_0xe2c5('0x2d')](_0x58339b[_0xe2c5('0x7e')](),{'type':dbH[_0xe2c5('0x7f')]['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x4ab270[_0xe2c5('0x7e')]()};})['then'](respondWithResult(_0x3e1d54,null))[_0xe2c5('0x44')](handleError(_0x3e1d54,null));}; \ No newline at end of file +var _0xeb82=['UserProfileResource','then','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','field','function','replace','format','orderBy','order','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','sequelize','toString','QueryTypes','SELECT','right_join','GROUP_CONCAT(%s)','DATE(%s)','IS\x20NULL','getFields','select','groupBy','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','output','savename','COUNT(*)','runReport','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','get','CustomReports'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xeb82,0x127));var _0x2eb8=function(_0x5f44ba,_0x1f318e){_0x5f44ba=_0x5f44ba-0x0;var _0x312dbe=_0xeb82[_0x5f44ba];return _0x312dbe;};'use strict';var emlformat=require(_0x2eb8('0x0'));var rimraf=require(_0x2eb8('0x1'));var zipdir=require(_0x2eb8('0x2'));var jsonpatch=require(_0x2eb8('0x3'));var rp=require(_0x2eb8('0x4'));var moment=require(_0x2eb8('0x5'));var BPromise=require(_0x2eb8('0x6'));var Mustache=require(_0x2eb8('0x7'));var util=require(_0x2eb8('0x8'));var path=require(_0x2eb8('0x9'));var sox=require('sox');var csv=require(_0x2eb8('0xa'));var ejs=require(_0x2eb8('0xb'));var fs=require('fs');var fs_extra=require(_0x2eb8('0xc'));var _=require('lodash');var squel=require(_0x2eb8('0xd'));var crypto=require(_0x2eb8('0xe'));var jsforce=require(_0x2eb8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2eb8('0xa'));var querystring=require('querystring');var Papa=require(_0x2eb8('0x10'));var Redis=require(_0x2eb8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2eb8('0x12'));var as=require(_0x2eb8('0x13'));var hardwareService=require(_0x2eb8('0x14'));var logger=require(_0x2eb8('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2eb8('0x16'));var db=require(_0x2eb8('0x17'))['db'];var dbH=require(_0x2eb8('0x17'))[_0x2eb8('0x18')];function respondWithStatusCode(_0x152956,_0x4780f1){_0x4780f1=_0x4780f1||0xcc;return function(_0x5a1e2d){if(_0x5a1e2d){return _0x152956[_0x2eb8('0x19')](_0x4780f1);}return _0x152956[_0x2eb8('0x1a')](_0x4780f1)[_0x2eb8('0x1b')]();};}function respondWithResult(_0x29f5c8,_0x4aebf2){_0x4aebf2=_0x4aebf2||0xc8;return function(_0x1d3d50){if(_0x1d3d50){return _0x29f5c8[_0x2eb8('0x1a')](_0x4aebf2)[_0x2eb8('0x1c')](_0x1d3d50);}};}function respondWithFilteredResult(_0x26c215,_0x1509ca){return function(_0x952f5e){if(_0x952f5e){var _0x2e5ae7=typeof _0x1509ca['offset']===_0x2eb8('0x1d')&&typeof _0x1509ca[_0x2eb8('0x1e')]===_0x2eb8('0x1d');var _0x5995ef=_0x952f5e[_0x2eb8('0x1f')];var _0x5f4fdc=_0x2e5ae7?0x0:_0x1509ca[_0x2eb8('0x20')];var _0x2baabb=_0x2e5ae7?_0x952f5e[_0x2eb8('0x1f')]:_0x1509ca[_0x2eb8('0x20')]+_0x1509ca[_0x2eb8('0x1e')];var _0x768bdb;if(_0x2baabb>=_0x5995ef){_0x2baabb=_0x5995ef;_0x768bdb=0xc8;}else{_0x768bdb=0xce;}_0x26c215[_0x2eb8('0x1a')](_0x768bdb);return _0x26c215[_0x2eb8('0x21')](_0x2eb8('0x22'),_0x5f4fdc+'-'+_0x2baabb+'/'+_0x5995ef)[_0x2eb8('0x1c')](_0x952f5e);}return null;};}function patchUpdates(_0xd94cbc){return function(_0x54b6b9){try{jsonpatch[_0x2eb8('0x23')](_0x54b6b9,_0xd94cbc,!![]);}catch(_0x5bff37){return BPromise['reject'](_0x5bff37);}return _0x54b6b9[_0x2eb8('0x24')]();};}function saveUpdates(_0x49c8aa,_0x2ef573){return function(_0x3314bb){if(_0x3314bb){return _0x3314bb[_0x2eb8('0x25')](_0x49c8aa)['then'](function(_0x31b89e){return _0x31b89e;});}return null;};}function removeEntity(_0x33c3e4,_0x50095e){return function(_0x1342ae){if(_0x1342ae){return _0x1342ae[_0x2eb8('0x26')]()['then'](function(){var _0x3ff22b=_0x1342ae[_0x2eb8('0x27')]({'plain':!![]});var _0x5ca671=_0x2eb8('0x28');return db[_0x2eb8('0x29')][_0x2eb8('0x26')]({'where':{'type':_0x5ca671,'resourceId':_0x3ff22b['id']}})[_0x2eb8('0x2a')](function(){return _0x1342ae;});})[_0x2eb8('0x2a')](function(){_0x33c3e4[_0x2eb8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e47eb,_0x393585){return function(_0xd77d4e){if(!_0xd77d4e){_0x4e47eb[_0x2eb8('0x19')](0x194);}return _0xd77d4e;};}function handleError(_0x1c51a0,_0x5381f0){_0x5381f0=_0x5381f0||0x1f4;return function(_0x1cbe2d){logger['error'](_0x1cbe2d['stack']);if(_0x1cbe2d['name']){delete _0x1cbe2d[_0x2eb8('0x2b')];}_0x1c51a0[_0x2eb8('0x1a')](_0x5381f0)[_0x2eb8('0x2c')](_0x1cbe2d);};}exports[_0x2eb8('0x2d')]=function(_0x15b988,_0x57cde1){var _0x25159b={},_0x3d1ed2={},_0x267e4c={'count':0x0,'rows':[]};var _0x33e399=_[_0x2eb8('0x2e')](db[_0x2eb8('0x2f')][_0x2eb8('0x30')],function(_0x29104e){return{'name':_0x29104e[_0x2eb8('0x31')],'type':_0x29104e['type'][_0x2eb8('0x32')]};});_0x3d1ed2['model']=_[_0x2eb8('0x2e')](_0x33e399,_0x2eb8('0x2b'));_0x3d1ed2[_0x2eb8('0x33')]=_[_0x2eb8('0x34')](_0x15b988[_0x2eb8('0x33')]);_0x3d1ed2[_0x2eb8('0x35')]=_[_0x2eb8('0x36')](_0x3d1ed2['model'],_0x3d1ed2[_0x2eb8('0x33')]);_0x25159b[_0x2eb8('0x37')]=_['intersection'](_0x3d1ed2[_0x2eb8('0x38')],qs[_0x2eb8('0x39')](_0x15b988[_0x2eb8('0x33')]['fields']));_0x25159b[_0x2eb8('0x37')]=_0x25159b['attributes'][_0x2eb8('0x3a')]?_0x25159b['attributes']:_0x3d1ed2[_0x2eb8('0x38')];if(!_0x15b988[_0x2eb8('0x33')][_0x2eb8('0x3b')](_0x2eb8('0x3c'))){_0x25159b[_0x2eb8('0x1e')]=qs[_0x2eb8('0x1e')](_0x15b988[_0x2eb8('0x33')][_0x2eb8('0x1e')]);_0x25159b['offset']=qs[_0x2eb8('0x20')](_0x15b988[_0x2eb8('0x33')][_0x2eb8('0x20')]);}_0x25159b['order']=qs[_0x2eb8('0x3d')](_0x15b988['query'][_0x2eb8('0x3d')]);_0x25159b[_0x2eb8('0x3e')]=qs[_0x2eb8('0x35')](_[_0x2eb8('0x3f')](_0x15b988[_0x2eb8('0x33')],_0x3d1ed2[_0x2eb8('0x35')]),_0x33e399);if(_0x15b988[_0x2eb8('0x33')][_0x2eb8('0x40')]){_0x25159b[_0x2eb8('0x3e')]=_[_0x2eb8('0x41')](_0x25159b[_0x2eb8('0x3e')],{'$or':_[_0x2eb8('0x2e')](_0x33e399,function(_0x1c8874){if(_0x1c8874[_0x2eb8('0x42')]!==_0x2eb8('0x43')){var _0x53f5ee={};_0x53f5ee[_0x1c8874[_0x2eb8('0x2b')]]={'$like':'%'+_0x15b988[_0x2eb8('0x33')][_0x2eb8('0x40')]+'%'};return _0x53f5ee;}})});}_0x25159b=_[_0x2eb8('0x41')]({},_0x25159b,_0x15b988[_0x2eb8('0x44')]);var _0x5b733a={'where':_0x25159b[_0x2eb8('0x3e')]};return db[_0x2eb8('0x2f')][_0x2eb8('0x1f')](_0x5b733a)[_0x2eb8('0x2a')](function(_0x4f5e04){_0x267e4c[_0x2eb8('0x1f')]=_0x4f5e04;if(_0x15b988[_0x2eb8('0x33')][_0x2eb8('0x45')]){_0x25159b[_0x2eb8('0x46')]=[{'all':!![]}];}return db[_0x2eb8('0x2f')][_0x2eb8('0x47')](_0x25159b);})[_0x2eb8('0x2a')](function(_0x1a8f75){_0x267e4c[_0x2eb8('0x48')]=_0x1a8f75;return _0x267e4c;})[_0x2eb8('0x2a')](respondWithFilteredResult(_0x57cde1,_0x25159b))[_0x2eb8('0x49')](handleError(_0x57cde1,null));};exports[_0x2eb8('0x4a')]=function(_0x719ec1,_0x355df2){var _0x153207={'raw':![],'where':{'id':_0x719ec1[_0x2eb8('0x4b')]['id']}},_0x1bafc4={};_0x1bafc4['model']=_[_0x2eb8('0x34')](db[_0x2eb8('0x2f')][_0x2eb8('0x30')]);_0x1bafc4[_0x2eb8('0x33')]=_[_0x2eb8('0x34')](_0x719ec1[_0x2eb8('0x33')]);_0x1bafc4[_0x2eb8('0x35')]=_[_0x2eb8('0x36')](_0x1bafc4[_0x2eb8('0x38')],_0x1bafc4[_0x2eb8('0x33')]);_0x153207[_0x2eb8('0x37')]=_[_0x2eb8('0x36')](_0x1bafc4[_0x2eb8('0x38')],qs['fields'](_0x719ec1[_0x2eb8('0x33')]['fields']));_0x153207['attributes']=_0x153207['attributes'][_0x2eb8('0x3a')]?_0x153207[_0x2eb8('0x37')]:_0x1bafc4[_0x2eb8('0x38')];if(_0x719ec1[_0x2eb8('0x33')][_0x2eb8('0x45')]){_0x153207[_0x2eb8('0x46')]=[{'all':!![]}];}_0x153207=_[_0x2eb8('0x41')]({},_0x153207,_0x719ec1['options']);return db[_0x2eb8('0x2f')][_0x2eb8('0x4c')](_0x153207)[_0x2eb8('0x2a')](handleEntityNotFound(_0x355df2,null))[_0x2eb8('0x2a')](respondWithResult(_0x355df2,null))[_0x2eb8('0x49')](handleError(_0x355df2,null));};exports[_0x2eb8('0x4d')]=function(_0x38d089,_0x2cabcd){return db[_0x2eb8('0x2f')][_0x2eb8('0x4d')](_0x38d089[_0x2eb8('0x4e')],{})['then'](function(_0x5ca651){var _0xa7df2c=_0x38d089[_0x2eb8('0x4f')][_0x2eb8('0x27')]({'plain':!![]});if(!_0xa7df2c)throw new Error(_0x2eb8('0x50'));if(_0xa7df2c[_0x2eb8('0x51')]===_0x2eb8('0x4f')){var _0x1c3084=_0x5ca651[_0x2eb8('0x27')]({'plain':!![]});var _0x3625a6=_0x2eb8('0x52');return db[_0x2eb8('0x53')][_0x2eb8('0x4c')]({'where':{'name':_0x3625a6,'userProfileId':_0xa7df2c[_0x2eb8('0x54')]},'raw':!![]})[_0x2eb8('0x2a')](function(_0x229381){if(_0x229381&&_0x229381[_0x2eb8('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x1c3084[_0x2eb8('0x2b')],'resourceId':_0x1c3084['id'],'type':_0x2eb8('0x28'),'sectionId':_0x229381['id']},{})[_0x2eb8('0x2a')](function(){return _0x5ca651;});}else{return _0x5ca651;}})[_0x2eb8('0x49')](function(_0x115c2a){logger['error'](_0x2eb8('0x56'),_0x115c2a);throw _0x115c2a;});}return _0x5ca651;})[_0x2eb8('0x2a')](respondWithResult(_0x2cabcd,0xc9))['catch'](handleError(_0x2cabcd,null));};exports[_0x2eb8('0x25')]=function(_0x3a0f2b,_0x2fd80f){if(_0x3a0f2b[_0x2eb8('0x4e')]['id']){delete _0x3a0f2b['body']['id'];}return db['AnalyticCustomReport'][_0x2eb8('0x4c')]({'where':{'id':_0x3a0f2b['params']['id']}})['then'](handleEntityNotFound(_0x2fd80f,null))[_0x2eb8('0x2a')](saveUpdates(_0x3a0f2b[_0x2eb8('0x4e')],null))['then'](respondWithResult(_0x2fd80f,null))[_0x2eb8('0x49')](handleError(_0x2fd80f,null));};exports['destroy']=function(_0x1ebd1c,_0x284382){return db[_0x2eb8('0x2f')][_0x2eb8('0x4c')]({'where':{'id':_0x1ebd1c[_0x2eb8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x284382,null))[_0x2eb8('0x2a')](removeEntity(_0x284382,null))[_0x2eb8('0x49')](handleError(_0x284382,null));};exports[_0x2eb8('0x57')]=function(_0x228619,_0x341ed5){var _0x294fdb=0xa;var _0x375cd=[_0x2eb8('0x58'),_0x2eb8('0x59'),'right_join',_0x2eb8('0x5a')];var _0x504ad9={'SUM':_0x2eb8('0x5b'),'COUNT':_0x2eb8('0x5c'),'COUNT DISTINCT':_0x2eb8('0x5d'),'MAX':_0x2eb8('0x5e'),'MIN':_0x2eb8('0x5f'),'AVG':_0x2eb8('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2eb8('0x61'),'GROUP_CONCAT DESC':_0x2eb8('0x62')};var _0x195a5f={'SEC_TO_TIME':_0x2eb8('0x63'),'DATE':'DATE(%s)','HOUR':_0x2eb8('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5d11dc=function(_0x3eae4d){return!_[_0x2eb8('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2eb8('0x66')],_0x3eae4d);};var _0xd8ed42=function(_0x2fba24){if(!_0x2fba24||!_0x2fba24[_0x2eb8('0x67')][_0x2eb8('0x3a')]){return'';}for(var _0x7d7452='(',_0x4daa1a=0x0;_0x4daa1a<_0x2fba24['rules'][_0x2eb8('0x3a')];_0x4daa1a+=0x1){_0x4daa1a>0x0&&(_0x7d7452+='\x20'+_0x2fba24[_0x2eb8('0x68')]+'\x20');_0x7d7452+=_0x2fba24[_0x2eb8('0x67')][_0x4daa1a]['group']?_0xd8ed42(_0x2fba24['rules'][_0x4daa1a][_0x2eb8('0x69')]):_0x2fba24['rules'][_0x4daa1a]['field']+'\x20'+_0x2fba24[_0x2eb8('0x67')][_0x4daa1a][_0x2eb8('0x6a')]+(_0x5d11dc(_0x2fba24[_0x2eb8('0x67')][_0x4daa1a][_0x2eb8('0x6a')])?'\x20'+_0x2fba24[_0x2eb8('0x67')][_0x4daa1a][_0x2eb8('0x6b')]:'');}return _0x7d7452+')';};var _0xb26e53={'where':{'id':_0x228619[_0x2eb8('0x4b')]['id']}},_0x2b57c6,_0x112bab,_0x58f49c,_0x9a34eb,_0x287c0c;_0xb26e53=_[_0x2eb8('0x41')]({},_0xb26e53,_0x228619[_0x2eb8('0x44')]);return db[_0x2eb8('0x2f')][_0x2eb8('0x4c')](_0xb26e53)['then'](function(_0x2c4fcf){if(_0x2c4fcf){_0x2b57c6=_0x2c4fcf;return _0x2c4fcf['getFields']();}return null;})[_0x2eb8('0x2a')](function(_0x4ccc6c){if(_0x4ccc6c){if(!_0x4ccc6c[_0x2eb8('0x3a')]){throw new db[(_0x2eb8('0x6c'))][(_0x2eb8('0x6d'))](_0x2eb8('0x6e'),0x193);}_0x112bab=_0x4ccc6c;return db[_0x2eb8('0x6f')][_0x2eb8('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3bb894){if(_0x3bb894){_0x58f49c=_[_0x2eb8('0x70')](_0x3bb894,'id');var _0x3a4fcc;var _0x33f3b5=squel['select']();_0x33f3b5[_0x2eb8('0x71')](_0x2b57c6[_0x2eb8('0x72')]);for(var _0x4c9af1=0x0;_0x4c9af1<_0x112bab[_0x2eb8('0x3a')];_0x4c9af1+=0x1){_0x3a4fcc=_0x112bab[_0x4c9af1]['MetricId']?_0x58f49c[_0x112bab[_0x4c9af1][_0x2eb8('0x73')]][_0x2eb8('0x74')]:_0x112bab[_0x4c9af1][_0x2eb8('0x75')];_0x3a4fcc=_0x112bab[_0x4c9af1][_0x2eb8('0x76')]?_[_0x2eb8('0x77')](_0x504ad9[_0x112bab[_0x4c9af1]['function']],'%s',_0x3a4fcc):_0x3a4fcc;_0x3a4fcc=_0x112bab[_0x4c9af1][_0x2eb8('0x78')]?_[_0x2eb8('0x77')](_0x195a5f[_0x112bab[_0x4c9af1][_0x2eb8('0x78')]],'%s',_0x3a4fcc):_0x3a4fcc;if(_0x112bab[_0x4c9af1]['groupBy']){_0x33f3b5['group'](_0x3a4fcc);}_0x112bab[_0x4c9af1][_0x2eb8('0x79')]&&_0x33f3b5[_0x2eb8('0x7a')](_0x3a4fcc,_0x112bab[_0x4c9af1][_0x2eb8('0x79')]===_0x2eb8('0x7b')?![]:!![]);_0x33f3b5['field'](_0x3a4fcc,_0x112bab[_0x4c9af1][_0x2eb8('0x7c')]||_0x3a4fcc);}if(_0x2b57c6['joins']){_0x2b57c6[_0x2eb8('0x7d')]=JSON[_0x2eb8('0x7e')](_0x2b57c6[_0x2eb8('0x7d')]);for(var _0x5f1d4d=0x0;_0x5f1d4d<_0x2b57c6[_0x2eb8('0x7d')]['length'];_0x5f1d4d+=0x1){if(_0x2b57c6[_0x2eb8('0x7d')][_0x5f1d4d][_0x2eb8('0x42')]&&_[_0x2eb8('0x65')](_0x375cd,_0x2b57c6[_0x2eb8('0x7d')][_0x5f1d4d][_0x2eb8('0x42')])&&_0x2b57c6[_0x2eb8('0x7d')][_0x5f1d4d]['parentKey']&&_0x2b57c6[_0x2eb8('0x7d')][_0x5f1d4d][_0x2eb8('0x7f')]&&_0x2b57c6[_0x2eb8('0x7d')][_0x5f1d4d][_0x2eb8('0x80')]){_0x33f3b5[_0x2b57c6['joins'][_0x5f1d4d]['type']](_0x2b57c6['joins'][_0x5f1d4d][_0x2eb8('0x7f')],null,util['format'](_0x2eb8('0x81'),_0x2b57c6[_0x2eb8('0x72')],_0x2b57c6[_0x2eb8('0x7d')][_0x5f1d4d][_0x2eb8('0x82')],_0x2b57c6[_0x2eb8('0x7d')][_0x5f1d4d][_0x2eb8('0x7f')],_0x2b57c6[_0x2eb8('0x7d')][_0x5f1d4d][_0x2eb8('0x80')]));}}}if(_0x2b57c6[_0x2eb8('0x83')]){_0x2b57c6[_0x2eb8('0x83')]=JSON[_0x2eb8('0x7e')](_0x2b57c6[_0x2eb8('0x83')]);_0x33f3b5['where'](_0xd8ed42(_0x2b57c6[_0x2eb8('0x83')][_0x2eb8('0x69')]));}_0x287c0c=_0x33f3b5[_0x2eb8('0x84')]();_0x33f3b5[_0x2eb8('0x1e')](_0x294fdb);_0x33f3b5[_0x2eb8('0x20')](0x0);logger[_0x2eb8('0x85')]('Limited\x20Query:',_0x33f3b5['toString']());return dbH[_0x2eb8('0x86')][_0x2eb8('0x33')](_0x33f3b5[_0x2eb8('0x87')](),{'type':dbH[_0x2eb8('0x86')][_0x2eb8('0x88')][_0x2eb8('0x89')]});}})[_0x2eb8('0x2a')](respondWithResult(_0x341ed5,null))[_0x2eb8('0x49')](handleError(_0x341ed5,null));};function runReport(_0x1e2d04,_0x28d981,_0x2aca15){var _0x11af52=_0x28d981[_0x2eb8('0x2b')];var _0xf89269=0xa;var _0x4ee527=[_0x2eb8('0x58'),_0x2eb8('0x59'),_0x2eb8('0x8a'),_0x2eb8('0x5a')];var _0x69094={'SUM':'SUM(%s)','COUNT':_0x2eb8('0x5c'),'COUNT DISTINCT':_0x2eb8('0x5d'),'MAX':_0x2eb8('0x5e'),'MIN':_0x2eb8('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2eb8('0x8b'),'GROUP_CONCAT ASC':_0x2eb8('0x61'),'GROUP_CONCAT DESC':_0x2eb8('0x62')};var _0x3438b6={'SEC_TO_TIME':_0x2eb8('0x63'),'DATE':_0x2eb8('0x8c'),'HOUR':_0x2eb8('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x54da83=function(_0x298209){return!_[_0x2eb8('0x65')]([_0x2eb8('0x8d'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2eb8('0x66')],_0x298209);};var _0x214b9b=function(_0x5970b7){if(!_0x5970b7||!_0x5970b7['rules'][_0x2eb8('0x3a')]){return'';}for(var _0x290a6e='(',_0xb4f5e0=0x0;_0xb4f5e0<_0x5970b7['rules'][_0x2eb8('0x3a')];_0xb4f5e0+=0x1){_0xb4f5e0>0x0&&(_0x290a6e+='\x20'+_0x5970b7['operator']+'\x20');_0x290a6e+=_0x5970b7[_0x2eb8('0x67')][_0xb4f5e0][_0x2eb8('0x69')]?_0x214b9b(_0x5970b7[_0x2eb8('0x67')][_0xb4f5e0][_0x2eb8('0x69')]):_0x5970b7[_0x2eb8('0x67')][_0xb4f5e0][_0x2eb8('0x75')]+'\x20'+_0x5970b7[_0x2eb8('0x67')][_0xb4f5e0][_0x2eb8('0x6a')]+(_0x54da83(_0x5970b7['rules'][_0xb4f5e0][_0x2eb8('0x6a')])?'\x20'+_0x5970b7['rules'][_0xb4f5e0][_0x2eb8('0x6b')]:'');}return _0x290a6e+')';};var _0x3c6a93={'where':{'id':_0x1e2d04['id']}},_0x181aa5,_0x2d74df,_0x7a146d,_0x4e6cc9,_0x386c11;_0x3c6a93=_['merge']({},_0x3c6a93,_0x2aca15);return db[_0x2eb8('0x2f')]['find'](_0x3c6a93)['then'](function(_0x556def){if(_0x556def){_0x181aa5=_0x556def;return _0x556def[_0x2eb8('0x8e')]();}return null;})['then'](function(_0x3ca71a){if(_0x3ca71a){if(!_0x3ca71a[_0x2eb8('0x3a')]){throw new db['Sequelize'][(_0x2eb8('0x6d'))](_0x2eb8('0x6e'),0x193);}_0x2d74df=_0x3ca71a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x188d7e){if(_0x188d7e){_0x7a146d=_['keyBy'](_0x188d7e,'id');var _0x131689;var _0xef2c5a=squel[_0x2eb8('0x8f')]();_0xef2c5a[_0x2eb8('0x71')](_0x181aa5[_0x2eb8('0x72')]);for(var _0x2273a3=0x0;_0x2273a3<_0x2d74df[_0x2eb8('0x3a')];_0x2273a3+=0x1){_0x131689=_0x2d74df[_0x2273a3]['MetricId']?_0x7a146d[_0x2d74df[_0x2273a3][_0x2eb8('0x73')]][_0x2eb8('0x74')]:_0x2d74df[_0x2273a3][_0x2eb8('0x75')];_0x131689=_0x2d74df[_0x2273a3][_0x2eb8('0x76')]?_[_0x2eb8('0x77')](_0x69094[_0x2d74df[_0x2273a3][_0x2eb8('0x76')]],'%s',_0x131689):_0x131689;_0x131689=_0x2d74df[_0x2273a3][_0x2eb8('0x78')]?_[_0x2eb8('0x77')](_0x3438b6[_0x2d74df[_0x2273a3]['format']],'%s',_0x131689):_0x131689;if(_0x2d74df[_0x2273a3][_0x2eb8('0x90')]){_0xef2c5a[_0x2eb8('0x69')](_0x131689);}_0x2d74df[_0x2273a3][_0x2eb8('0x79')]&&_0xef2c5a['order'](_0x131689,_0x2d74df[_0x2273a3][_0x2eb8('0x79')]===_0x2eb8('0x7b')?![]:!![]);_0xef2c5a[_0x2eb8('0x75')](_0x131689,_0x2d74df[_0x2273a3][_0x2eb8('0x7c')]||_0x131689);}if(_0x181aa5[_0x2eb8('0x7d')]){_0x181aa5[_0x2eb8('0x7d')]=JSON[_0x2eb8('0x7e')](_0x181aa5[_0x2eb8('0x7d')]);for(var _0x1f6865=0x0;_0x1f6865<_0x181aa5[_0x2eb8('0x7d')][_0x2eb8('0x3a')];_0x1f6865+=0x1){if(_0x181aa5[_0x2eb8('0x7d')][_0x1f6865][_0x2eb8('0x42')]&&_[_0x2eb8('0x65')](_0x4ee527,_0x181aa5[_0x2eb8('0x7d')][_0x1f6865]['type'])&&_0x181aa5['joins'][_0x1f6865]['parentKey']&&_0x181aa5['joins'][_0x1f6865][_0x2eb8('0x7f')]&&_0x181aa5[_0x2eb8('0x7d')][_0x1f6865]['foreignKey']){_0xef2c5a[_0x181aa5['joins'][_0x1f6865][_0x2eb8('0x42')]](_0x181aa5[_0x2eb8('0x7d')][_0x1f6865][_0x2eb8('0x7f')],null,util[_0x2eb8('0x78')](_0x2eb8('0x81'),_0x181aa5[_0x2eb8('0x72')],_0x181aa5[_0x2eb8('0x7d')][_0x1f6865][_0x2eb8('0x82')],_0x181aa5[_0x2eb8('0x7d')][_0x1f6865]['foreignTable'],_0x181aa5[_0x2eb8('0x7d')][_0x1f6865]['foreignKey']));}}}if(_0x181aa5[_0x2eb8('0x83')]){_0x181aa5['conditions']=JSON[_0x2eb8('0x7e')](_0x181aa5[_0x2eb8('0x83')]);_0xef2c5a[_0x2eb8('0x3e')](_0x214b9b(_0x181aa5['conditions']['group']));}_0x386c11=_0xef2c5a[_0x2eb8('0x84')]();_0xef2c5a[_0x2eb8('0x1e')](_0xf89269);_0xef2c5a[_0x2eb8('0x20')](0x0);return;}})[_0x2eb8('0x2a')](function(){if(_0x28d981['output']===_0x2eb8('0x91')){return null;}var _0x27425c=_[_0x2eb8('0x41')](_0x28d981,{'name':_0x28d981[_0x2eb8('0x92')]||_0x28d981['name']||_0x181aa5[_0x2eb8('0x2b')],'basename':_0x11af52,'savename':util['format'](_0x2eb8('0x93'),_0x28d981[_0x2eb8('0x2b')]||_0x181aa5[_0x2eb8('0x2b')],require(_0x2eb8('0x94'))[_0x2eb8('0x95')](0x4),_0x28d981['output']||_0x2eb8('0x96')),'reportId':_0x181aa5['id'],'reportType':_0x2eb8('0x97')});return db[_0x2eb8('0x98')]['create'](_0x27425c,{'raw':!![]});})[_0x2eb8('0x2a')](function(_0x3d431e){if(_0x181aa5['table']===_0x2eb8('0x99')){_0x386c11[_0x2eb8('0x3e')](_0x181aa5[_0x2eb8('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x28d981[_0x2eb8('0x9a')],_0x28d981[_0x2eb8('0x9b')]);}else{_0x386c11[_0x2eb8('0x3e')](_0x181aa5[_0x2eb8('0x72')]+_0x2eb8('0x9c'),_0x28d981[_0x2eb8('0x9a')],_0x28d981[_0x2eb8('0x9b')]);}if(_0x3d431e){logger[_0x2eb8('0x9d')](_0x2eb8('0x9e'),_0x386c11[_0x2eb8('0x87')]());require('child_process')[_0x2eb8('0x9f')](path[_0x2eb8('0x58')](__dirname,_0x2eb8('0xa0'),_0x3d431e[_0x2eb8('0xa1')]),[_0x3d431e['id'],_0x386c11[_0x2eb8('0x87')](),path[_0x2eb8('0x58')](__dirname,'../../files/reports',_0x3d431e[_0x2eb8('0xa2')]),_0x11af52]);return _0x3d431e;}else{var _0x3429ee=squel[_0x2eb8('0x8f')]();_0x3429ee['from']('('+_0x386c11[_0x2eb8('0x87')]()+')','countTable');_0x3429ee[_0x2eb8('0x75')](_0x2eb8('0xa3'),_0x2eb8('0x1f'));_0x386c11['limit'](_0x28d981[_0x2eb8('0x1e')]||_0xf89269);_0x386c11[_0x2eb8('0x20')](_0x28d981[_0x2eb8('0x20')]||0x0);return dbH[_0x2eb8('0x86')][_0x2eb8('0x33')](_0x3429ee[_0x2eb8('0x87')](),{'type':dbH['sequelize']['QueryTypes'][_0x2eb8('0x89')]})[_0x2eb8('0x2a')](function(_0x5bd861){if(!_0x5bd861[_0x2eb8('0x3a')]){_0x4e6cc9=0x0;}else{_0x4e6cc9=_0x5bd861[0x0]['count']||0x0;}return dbH[_0x2eb8('0x86')][_0x2eb8('0x33')](_0x386c11[_0x2eb8('0x87')](),{'type':dbH[_0x2eb8('0x86')]['QueryTypes'][_0x2eb8('0x89')]});})['then'](function(_0x204f13){return{'rows':_0x204f13||[],'count':_0x4e6cc9};});}});}exports['run']=function(_0x4885b2,_0x3b39ce){return runReport(_0x4885b2[_0x2eb8('0x4b')],_0x4885b2[_0x2eb8('0x33')],_0x4885b2[_0x2eb8('0x44')])[_0x2eb8('0x2a')](respondWithResult(_0x3b39ce,null))[_0x2eb8('0x49')](handleError(_0x3b39ce,null));};exports[_0x2eb8('0xa4')]=runReport;exports['query']=function(_0x5e0011,_0x5d0cd7){var _0x4d6300=0xa;var _0xf83778=[_0x2eb8('0x58'),'left_join',_0x2eb8('0x8a'),_0x2eb8('0x5a')];var _0x2b747b={'SUM':'SUM(%s)','COUNT':_0x2eb8('0x5c'),'COUNT DISTINCT':_0x2eb8('0x5d'),'MAX':_0x2eb8('0x5e'),'MIN':_0x2eb8('0x5f'),'AVG':_0x2eb8('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2eb8('0x62')};var _0x3e9c44={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2eb8('0x8c'),'HOUR':_0x2eb8('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2eb8('0xa5')};var _0x5b80a9=function(_0x467edc){return!_['includes']([_0x2eb8('0x8d'),'IS\x20NOT\x20NULL',_0x2eb8('0xa6'),_0x2eb8('0x66')],_0x467edc);};var _0x4dbc69=function(_0x25b083){if(!_0x25b083||!_0x25b083[_0x2eb8('0x67')][_0x2eb8('0x3a')]){return'';}for(var _0x107eeb='(',_0x5ce4b6=0x0;_0x5ce4b6<_0x25b083[_0x2eb8('0x67')][_0x2eb8('0x3a')];_0x5ce4b6+=0x1){_0x5ce4b6>0x0&&(_0x107eeb+='\x20'+_0x25b083['operator']+'\x20');_0x107eeb+=_0x25b083[_0x2eb8('0x67')][_0x5ce4b6][_0x2eb8('0x69')]?_0x4dbc69(_0x25b083[_0x2eb8('0x67')][_0x5ce4b6][_0x2eb8('0x69')]):_0x25b083[_0x2eb8('0x67')][_0x5ce4b6]['field']+'\x20'+_0x25b083[_0x2eb8('0x67')][_0x5ce4b6][_0x2eb8('0x6a')]+(_0x5b80a9(_0x25b083[_0x2eb8('0x67')][_0x5ce4b6][_0x2eb8('0x6a')])?'\x20'+_0x25b083[_0x2eb8('0x67')][_0x5ce4b6][_0x2eb8('0x6b')]:'');}return _0x107eeb+')';};var _0x5b13a1={'where':{'id':_0x5e0011[_0x2eb8('0x4b')]['id']}},_0x43f4ff,_0x488d12,_0x4df8bd,_0x1d7b71,_0x5c9d1b;_0x5b13a1=_[_0x2eb8('0x41')]({},_0x5b13a1,_0x5e0011['options']);return db[_0x2eb8('0x2f')]['find'](_0x5b13a1)[_0x2eb8('0x2a')](function(_0x150aa8){if(_0x150aa8){_0x43f4ff=_0x150aa8;return _0x150aa8[_0x2eb8('0x8e')]();}return null;})['then'](function(_0x3ceb8b){if(_0x3ceb8b){if(!_0x3ceb8b[_0x2eb8('0x3a')]){throw new db[(_0x2eb8('0x6c'))][(_0x2eb8('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x488d12=_0x3ceb8b;return db[_0x2eb8('0x6f')][_0x2eb8('0x47')]({'raw':!![]});}return null;})[_0x2eb8('0x2a')](function(_0x2fc168){if(_0x2fc168){_0x4df8bd=_[_0x2eb8('0x70')](_0x2fc168,'id');var _0x444a9d;var _0x5563fc=squel[_0x2eb8('0x8f')]();_0x5563fc[_0x2eb8('0x71')](_0x43f4ff['table']);for(var _0x562bb0=0x0;_0x562bb0<_0x488d12[_0x2eb8('0x3a')];_0x562bb0+=0x1){_0x444a9d=_0x488d12[_0x562bb0][_0x2eb8('0x73')]?_0x4df8bd[_0x488d12[_0x562bb0][_0x2eb8('0x73')]][_0x2eb8('0x74')]:_0x488d12[_0x562bb0][_0x2eb8('0x75')];_0x444a9d=_0x488d12[_0x562bb0]['function']?_[_0x2eb8('0x77')](_0x2b747b[_0x488d12[_0x562bb0][_0x2eb8('0x76')]],'%s',_0x444a9d):_0x444a9d;_0x444a9d=_0x488d12[_0x562bb0][_0x2eb8('0x78')]?_[_0x2eb8('0x77')](_0x3e9c44[_0x488d12[_0x562bb0][_0x2eb8('0x78')]],'%s',_0x444a9d):_0x444a9d;if(_0x488d12[_0x562bb0][_0x2eb8('0x90')]){_0x5563fc[_0x2eb8('0x69')](_0x444a9d);}_0x488d12[_0x562bb0][_0x2eb8('0x79')]&&_0x5563fc[_0x2eb8('0x7a')](_0x444a9d,_0x488d12[_0x562bb0][_0x2eb8('0x79')]==='DESC'?![]:!![]);_0x5563fc[_0x2eb8('0x75')](_0x444a9d,_0x488d12[_0x562bb0]['alias']||_0x444a9d);}if(_0x43f4ff['joins']){_0x43f4ff[_0x2eb8('0x7d')]=JSON[_0x2eb8('0x7e')](_0x43f4ff[_0x2eb8('0x7d')]);for(var _0x5a671b=0x0;_0x5a671b<_0x43f4ff[_0x2eb8('0x7d')][_0x2eb8('0x3a')];_0x5a671b+=0x1){if(_0x43f4ff['joins'][_0x5a671b][_0x2eb8('0x42')]&&_[_0x2eb8('0x65')](_0xf83778,_0x43f4ff[_0x2eb8('0x7d')][_0x5a671b][_0x2eb8('0x42')])&&_0x43f4ff['joins'][_0x5a671b]['parentKey']&&_0x43f4ff[_0x2eb8('0x7d')][_0x5a671b][_0x2eb8('0x7f')]&&_0x43f4ff[_0x2eb8('0x7d')][_0x5a671b]['foreignKey']){_0x5563fc[_0x43f4ff[_0x2eb8('0x7d')][_0x5a671b]['type']](_0x43f4ff[_0x2eb8('0x7d')][_0x5a671b]['foreignTable'],null,util['format'](_0x2eb8('0x81'),_0x43f4ff[_0x2eb8('0x72')],_0x43f4ff['joins'][_0x5a671b][_0x2eb8('0x82')],_0x43f4ff[_0x2eb8('0x7d')][_0x5a671b][_0x2eb8('0x7f')],_0x43f4ff['joins'][_0x5a671b][_0x2eb8('0x80')]));}}}if(_0x43f4ff[_0x2eb8('0x83')]){_0x43f4ff[_0x2eb8('0x83')]=JSON[_0x2eb8('0x7e')](_0x43f4ff[_0x2eb8('0x83')]);_0x5563fc['where'](_0x4dbc69(_0x43f4ff[_0x2eb8('0x83')][_0x2eb8('0x69')]));}_0x5c9d1b=_0x5563fc['clone']();_0x5563fc['limit'](_0x4d6300);_0x5563fc[_0x2eb8('0x20')](0x0);logger[_0x2eb8('0x85')](_0x2eb8('0xa7'),_0x5563fc[_0x2eb8('0x87')]());return dbH['sequelize'][_0x2eb8('0x33')](_0x5563fc[_0x2eb8('0x87')](),{'type':dbH['sequelize']['QueryTypes'][_0x2eb8('0x89')]});}})[_0x2eb8('0x2a')](function(){return{'sql':_0x5c9d1b[_0x2eb8('0x87')]()};})[_0x2eb8('0x2a')](respondWithResult(_0x5d0cd7,null))[_0x2eb8('0x49')](handleError(_0x5d0cd7,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index bde4465..09e2e64 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 _0x1dc9=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x37b72c,_0x1d89f8){var _0x510146=function(_0x75fef3){while(--_0x75fef3){_0x37b72c['push'](_0x37b72c['shift']());}};_0x510146(++_0x1d89f8);}(_0x1dc9,0xf6));var _0x91dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dc9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91dc('0x0'));var util=require(_0x91dc('0x1'));var logger=require(_0x91dc('0x2'))(_0x91dc('0x3'));var moment=require(_0x91dc('0x4'));var BPromise=require(_0x91dc('0x5'));var rp=require(_0x91dc('0x6'));var fs=require('fs');var path=require(_0x91dc('0x7'));var rimraf=require(_0x91dc('0x8'));var config=require(_0x91dc('0x9'));var attributes=require(_0x91dc('0xa'));module[_0x91dc('0xb')]=function(_0x45bec8,_0x2af4d5){return _0x45bec8['define'](_0x91dc('0xc'),attributes,{'tableName':_0x91dc('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d6c=['define','analytics_custom_reports','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x2abd03,_0x15bd78){var _0x397306=function(_0x203b1e){while(--_0x203b1e){_0x2abd03['push'](_0x2abd03['shift']());}};_0x397306(++_0x15bd78);}(_0x9d6c,0x183));var _0xc9d6=function(_0x25fec1,_0x30cec2){_0x25fec1=_0x25fec1-0x0;var _0xad6ae1=_0x9d6c[_0x25fec1];return _0xad6ae1;};'use strict';var _=require(_0xc9d6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc9d6('0x1'));var moment=require(_0xc9d6('0x2'));var BPromise=require(_0xc9d6('0x3'));var rp=require(_0xc9d6('0x4'));var fs=require('fs');var path=require(_0xc9d6('0x5'));var rimraf=require('rimraf');var config=require(_0xc9d6('0x6'));var attributes=require(_0xc9d6('0x7'));module[_0xc9d6('0x8')]=function(_0x3efee0,_0x5a2197){return _0x3efee0[_0xc9d6('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0xc9d6('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 11eee8b..2b4d6b0 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 _0x8548=['then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1bf923,_0x3f5ea4){var _0x2e91cb=function(_0x114461){while(--_0x114461){_0x1bf923['push'](_0x1bf923['shift']());}};_0x2e91cb(++_0x3f5ea4);}(_0x8548,0xa7));var _0x8854=function(_0x5d1ed1,_0x3be1c5){_0x5d1ed1=_0x5d1ed1-0x0;var _0xd74bb9=_0x8548[_0x5d1ed1];return _0xd74bb9;};'use strict';var _=require(_0x8854('0x0'));var util=require(_0x8854('0x1'));var moment=require(_0x8854('0x2'));var BPromise=require(_0x8854('0x3'));var rs=require(_0x8854('0x4'));var fs=require('fs');var Redis=require(_0x8854('0x5'));var db=require(_0x8854('0x6'))['db'];var utils=require(_0x8854('0x7'));var logger=require(_0x8854('0x8'))(_0x8854('0x9'));var config=require(_0x8854('0xa'));var jayson=require(_0x8854('0xb'));var client=jayson[_0x8854('0xc')][_0x8854('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3431a4,_0x2866bb,_0x469bb3){return new BPromise(function(_0x4b5e92,_0xb3e1c){return client[_0x8854('0xe')](_0x3431a4,_0x469bb3)[_0x8854('0xf')](function(_0x3ac48f){logger[_0x8854('0x10')](_0x8854('0x11'),_0x2866bb,_0x8854('0x12'));logger['debug'](_0x8854('0x13'),_0x2866bb,'request\x20sent',JSON[_0x8854('0x14')](_0x3ac48f));if(_0x3ac48f[_0x8854('0x15')]){if(_0x3ac48f['error'][_0x8854('0x16')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x2866bb,_0x3ac48f[_0x8854('0x15')]['message']);return _0xb3e1c(_0x3ac48f[_0x8854('0x15')][_0x8854('0x17')]);}logger[_0x8854('0x15')](_0x8854('0x11'),_0x2866bb,_0x3ac48f[_0x8854('0x15')][_0x8854('0x17')]);return _0x4b5e92(_0x3ac48f[_0x8854('0x15')]['message']);}else{logger[_0x8854('0x10')](_0x8854('0x11'),_0x2866bb,_0x8854('0x12'));_0x4b5e92(_0x3ac48f[_0x8854('0x18')]['message']);}})[_0x8854('0x19')](function(_0x35ac4d){logger['error'](_0x8854('0x11'),_0x2866bb,_0x35ac4d);_0xb3e1c(_0x35ac4d);});});} \ No newline at end of file +var _0x4725=['code','error','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x23a0e1,_0x3ec14f){var _0x311e1d=function(_0x7c0fad){while(--_0x7c0fad){_0x23a0e1['push'](_0x23a0e1['shift']());}};_0x311e1d(++_0x3ec14f);}(_0x4725,0x140));var _0x5472=function(_0x1054f4,_0x3ad078){_0x1054f4=_0x1054f4-0x0;var _0x376c1b=_0x4725[_0x1054f4];return _0x376c1b;};'use strict';var _=require(_0x5472('0x0'));var util=require(_0x5472('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5472('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5472('0x3'));var logger=require(_0x5472('0x4'))(_0x5472('0x5'));var config=require(_0x5472('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5472('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc1593b,_0x13e7ce,_0x27ffbf){return new BPromise(function(_0x5eddc7,_0x379415){return client[_0x5472('0x8')](_0xc1593b,_0x27ffbf)[_0x5472('0x9')](function(_0x4e63d3){logger[_0x5472('0xa')](_0x5472('0xb'),_0x13e7ce,_0x5472('0xc'));logger[_0x5472('0xd')](_0x5472('0xe'),_0x13e7ce,_0x5472('0xc'),JSON[_0x5472('0xf')](_0x4e63d3));if(_0x4e63d3['error']){if(_0x4e63d3['error'][_0x5472('0x10')]===0x1f4){logger[_0x5472('0x11')](_0x5472('0xb'),_0x13e7ce,_0x4e63d3[_0x5472('0x11')][_0x5472('0x12')]);return _0x379415(_0x4e63d3[_0x5472('0x11')][_0x5472('0x12')]);}logger[_0x5472('0x11')](_0x5472('0xb'),_0x13e7ce,_0x4e63d3[_0x5472('0x11')][_0x5472('0x12')]);return _0x5eddc7(_0x4e63d3[_0x5472('0x11')][_0x5472('0x12')]);}else{logger[_0x5472('0xa')](_0x5472('0xb'),_0x13e7ce,_0x5472('0xc'));_0x5eddc7(_0x4e63d3[_0x5472('0x13')][_0x5472('0x12')]);}})[_0x5472('0x14')](function(_0x57b2f9){logger[_0x5472('0x11')](_0x5472('0xb'),_0x13e7ce,_0x57b2f9);_0x379415(_0x57b2f9);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index cb45a56..ddc9d8a 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 _0x161d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','show','preview','run','/:id/query','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x1e1ab0,_0x538d0c){var _0x38a73a=function(_0x5a6d91){while(--_0x5a6d91){_0x1e1ab0['push'](_0x1e1ab0['shift']());}};_0x38a73a(++_0x538d0c);}(_0x161d,0x10d));var _0xd161=function(_0x2cc097,_0x2d065c){_0x2cc097=_0x2cc097-0x0;var _0xfd122a=_0x161d[_0x2cc097];return _0xfd122a;};'use strict';var multer=require(_0xd161('0x0'));var util=require(_0xd161('0x1'));var path=require(_0xd161('0x2'));var timeout=require(_0xd161('0x3'));var express=require(_0xd161('0x4'));var router=express['Router']();var fs_extra=require(_0xd161('0x5'));var auth=require(_0xd161('0x6'));var interaction=require(_0xd161('0x7'));var config=require(_0xd161('0x8'));var controller=require(_0xd161('0x9'));router[_0xd161('0xa')]('/',auth['isAuthenticated'](),controller[_0xd161('0xb')]);router[_0xd161('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd161('0xc')]);router[_0xd161('0xa')]('/:id/preview',auth['isAuthenticated'](),controller[_0xd161('0xd')]);router[_0xd161('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0xd161('0xe')]);router[_0xd161('0xa')](_0xd161('0xf'),auth[_0xd161('0x10')](),controller['query']);router[_0xd161('0x11')]('/',auth[_0xd161('0x10')](),controller[_0xd161('0x12')]);router[_0xd161('0x13')]('/:id',auth[_0xd161('0x10')](),controller[_0xd161('0x14')]);router[_0xd161('0x15')](_0xd161('0x16'),auth['isAuthenticated'](),controller[_0xd161('0x17')]);module[_0xd161('0x18')]=router; \ No newline at end of file +var _0x1fb1=['/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','/:id/preview','preview'];(function(_0x44f9c0,_0x391085){var _0x241aa7=function(_0x369f23){while(--_0x369f23){_0x44f9c0['push'](_0x44f9c0['shift']());}};_0x241aa7(++_0x391085);}(_0x1fb1,0x88));var _0x11fb=function(_0x173007,_0x1baef3){_0x173007=_0x173007-0x0;var _0x2af6b6=_0x1fb1[_0x173007];return _0x2af6b6;};'use strict';var multer=require('multer');var util=require(_0x11fb('0x0'));var path=require(_0x11fb('0x1'));var timeout=require(_0x11fb('0x2'));var express=require(_0x11fb('0x3'));var router=express['Router']();var fs_extra=require(_0x11fb('0x4'));var auth=require(_0x11fb('0x5'));var interaction=require(_0x11fb('0x6'));var config=require(_0x11fb('0x7'));var controller=require(_0x11fb('0x8'));router[_0x11fb('0x9')]('/',auth[_0x11fb('0xa')](),controller['index']);router['get'](_0x11fb('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x11fb('0xc'),auth[_0x11fb('0xa')](),controller[_0x11fb('0xd')]);router[_0x11fb('0x9')](_0x11fb('0xe'),auth[_0x11fb('0xa')](),controller[_0x11fb('0xf')]);router['get'](_0x11fb('0x10'),auth[_0x11fb('0xa')](),controller[_0x11fb('0x11')]);router[_0x11fb('0x12')]('/',auth[_0x11fb('0xa')](),controller[_0x11fb('0x13')]);router[_0x11fb('0x14')]('/:id',auth[_0x11fb('0xa')](),controller[_0x11fb('0x15')]);router[_0x11fb('0x16')]('/:id',auth[_0x11fb('0xa')](),controller[_0x11fb('0x17')]);module[_0x11fb('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 1c73515..a1009b1 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x46ed,0x168));var _0xd46e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x46ed[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0x687b=['STRING','TEXT','sequelize','exports'];(function(_0x2e6eef,_0x13b333){var _0x5905fd=function(_0x4a196c){while(--_0x4a196c){_0x2e6eef['push'](_0x2e6eef['shift']());}};_0x5905fd(++_0x13b333);}(_0x687b,0x14a));var _0xb687=function(_0x10b757,_0x3cf7ca){_0x10b757=_0x10b757-0x0;var _0x5fffd2=_0x687b[_0x10b757];return _0x5fffd2;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb687('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xb687('0x3')]},'joins':{'type':Sequelize[_0xb687('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ac3feb8..08fb0e4 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 _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x135ff6,_0x341d65){var _0x5fc3=function(_0x33bac2){while(--_0x33bac2){_0x135ff6['push'](_0x135ff6['shift']());}};_0x5fc3(++_0x341d65);}(_0x814b,0x1a2));var _0xb814=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x814b[_0x2468b5];return _0x1056e4;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file +var _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x6f5103,_0x4f2de2){var _0x2a0b75=function(_0x11514b){while(--_0x11514b){_0x6f5103['push'](_0x6f5103['shift']());}};_0x2a0b75(++_0x4f2de2);}(_0x4975,0x86));var _0x5497=function(_0x185595,_0x5a2733){_0x185595=_0x185595-0x0;var _0x40de98=_0x4975[_0x185595];return _0x40de98;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index d04a638..23d3c7d 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 _0x2408=['../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f3cd9,_0x588b41){var _0x17965e=function(_0x42db28){while(--_0x42db28){_0x2f3cd9['push'](_0x2f3cd9['shift']());}};_0x17965e(++_0x588b41);}(_0x2408,0x156));var _0x8240=function(_0x310083,_0x3889f7){_0x310083=_0x310083-0x0;var _0x2c2f7a=_0x2408[_0x310083];return _0x2c2f7a;};'use strict';var _=require(_0x8240('0x0'));var util=require(_0x8240('0x1'));var logger=require(_0x8240('0x2'))(_0x8240('0x3'));var moment=require(_0x8240('0x4'));var BPromise=require(_0x8240('0x5'));var rp=require(_0x8240('0x6'));var fs=require('fs');var path=require(_0x8240('0x7'));var rimraf=require('rimraf');var config=require(_0x8240('0x8'));var attributes=require(_0x8240('0x9'));module[_0x8240('0xa')]=function(_0x24ce82,_0x4fa08d){return _0x24ce82[_0x8240('0xb')](_0x8240('0xc'),attributes,{'tableName':_0x8240('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3a4=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','analytics_default_reports','lodash','util'];(function(_0x5b9986,_0x5d376a){var _0x2c3085=function(_0x1e0f8b){while(--_0x1e0f8b){_0x5b9986['push'](_0x5b9986['shift']());}};_0x2c3085(++_0x5d376a);}(_0xc3a4,0x1b6));var _0x4c3a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc3a4[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4c3a('0x0'));var util=require(_0x4c3a('0x1'));var logger=require(_0x4c3a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4c3a('0x3'));var rp=require(_0x4c3a('0x4'));var fs=require('fs');var path=require(_0x4c3a('0x5'));var rimraf=require(_0x4c3a('0x6'));var config=require(_0x4c3a('0x7'));var attributes=require(_0x4c3a('0x8'));module['exports']=function(_0x2e25b9,_0x33caa5){return _0x2e25b9['define']('AnalyticDefaultReport',attributes,{'tableName':_0x4c3a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 2c4f2c7..f9bc598 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 _0xf367=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0xf367,0x86));var _0x7f36=function(_0xf7f685,_0x4fb6c9){_0xf7f685=_0xf7f685-0x0;var _0x417a06=_0xf367[_0xf7f685];return _0x417a06;};'use strict';var _=require(_0x7f36('0x0'));var util=require(_0x7f36('0x1'));var moment=require(_0x7f36('0x2'));var BPromise=require(_0x7f36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f36('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f36('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7f36('0x6')][_0x7f36('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c83b5,_0x489e13,_0x48a858){return new BPromise(function(_0x4357c5,_0x1fe132){return client['request'](_0x4c83b5,_0x48a858)['then'](function(_0x43f798){logger[_0x7f36('0x8')](_0x7f36('0x9'),_0x489e13,_0x7f36('0xa'));logger[_0x7f36('0xb')](_0x7f36('0xc'),_0x489e13,'request\x20sent',JSON[_0x7f36('0xd')](_0x43f798));if(_0x43f798['error']){if(_0x43f798['error'][_0x7f36('0xe')]===0x1f4){logger[_0x7f36('0xf')](_0x7f36('0x9'),_0x489e13,_0x43f798[_0x7f36('0xf')][_0x7f36('0x10')]);return _0x1fe132(_0x43f798[_0x7f36('0xf')][_0x7f36('0x10')]);}logger[_0x7f36('0xf')](_0x7f36('0x9'),_0x489e13,_0x43f798[_0x7f36('0xf')][_0x7f36('0x10')]);return _0x4357c5(_0x43f798[_0x7f36('0xf')][_0x7f36('0x10')]);}else{logger['info'](_0x7f36('0x9'),_0x489e13,_0x7f36('0xa'));_0x4357c5(_0x43f798[_0x7f36('0x11')][_0x7f36('0x10')]);}})[_0x7f36('0x12')](function(_0x4e726a){logger[_0x7f36('0xf')](_0x7f36('0x9'),_0x489e13,_0x4e726a);_0x1fe132(_0x4e726a);});});} \ No newline at end of file +var _0x2853=['stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c57be,_0x51d3ad){var _0x1456c0=function(_0x2f4ded){while(--_0x2f4ded){_0x3c57be['push'](_0x3c57be['shift']());}};_0x1456c0(++_0x51d3ad);}(_0x2853,0x1e6));var _0x3285=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x2853[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x3285('0x0'));var util=require('util');var moment=require(_0x3285('0x1'));var BPromise=require('bluebird');var rs=require(_0x3285('0x2'));var fs=require('fs');var Redis=require(_0x3285('0x3'));var db=require(_0x3285('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3285('0x5'));var config=require(_0x3285('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3285('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x318d02,_0x33c812,_0x38f9e9){return new BPromise(function(_0xee2c2e,_0x22a596){return client[_0x3285('0x8')](_0x318d02,_0x38f9e9)[_0x3285('0x9')](function(_0x1c56aa){logger[_0x3285('0xa')](_0x3285('0xb'),_0x33c812,_0x3285('0xc'));logger[_0x3285('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x33c812,_0x3285('0xc'),JSON[_0x3285('0xe')](_0x1c56aa));if(_0x1c56aa[_0x3285('0xf')]){if(_0x1c56aa[_0x3285('0xf')][_0x3285('0x10')]===0x1f4){logger[_0x3285('0xf')](_0x3285('0xb'),_0x33c812,_0x1c56aa[_0x3285('0xf')][_0x3285('0x11')]);return _0x22a596(_0x1c56aa['error']['message']);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x33c812,_0x1c56aa[_0x3285('0xf')][_0x3285('0x11')]);return _0xee2c2e(_0x1c56aa['error'][_0x3285('0x11')]);}else{logger[_0x3285('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x33c812,_0x3285('0xc'));_0xee2c2e(_0x1c56aa[_0x3285('0x12')]['message']);}})[_0x3285('0x13')](function(_0x2a8794){logger['error'](_0x3285('0xb'),_0x33c812,_0x2a8794);_0x22a596(_0x2a8794);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 6d3cb43..f9d7edd 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 _0x469e=['get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x469e,0xe1));var _0xe469=function(_0x198247,_0x491c12){_0x198247=_0x198247-0x0;var _0x2b18bc=_0x469e[_0x198247];return _0x2b18bc;};'use strict';var multer=require(_0xe469('0x0'));var util=require(_0xe469('0x1'));var path=require(_0xe469('0x2'));var timeout=require('connect-timeout');var express=require(_0xe469('0x3'));var router=express[_0xe469('0x4')]();var fs_extra=require(_0xe469('0x5'));var auth=require(_0xe469('0x6'));var interaction=require(_0xe469('0x7'));var config=require('../../config/environment');var controller=require(_0xe469('0x8'));router[_0xe469('0x9')]('/',auth[_0xe469('0xa')](),controller[_0xe469('0xb')]);router[_0xe469('0x9')](_0xe469('0xc'),auth[_0xe469('0xa')](),controller[_0xe469('0xd')]);router[_0xe469('0x9')](_0xe469('0xe'),auth[_0xe469('0xa')](),controller[_0xe469('0xf')]);router[_0xe469('0x9')](_0xe469('0x10'),auth['isAuthenticated'](),controller[_0xe469('0x11')]);router[_0xe469('0x9')](_0xe469('0x12'),auth[_0xe469('0xa')](),controller[_0xe469('0x13')]);router[_0xe469('0x14')]('/',auth[_0xe469('0xa')](),controller[_0xe469('0x15')]);router[_0xe469('0x16')](_0xe469('0xc'),auth[_0xe469('0xa')](),controller[_0xe469('0x17')]);router[_0xe469('0x18')](_0xe469('0xc'),auth[_0xe469('0xa')](),controller['destroy']);module[_0xe469('0x19')]=router; \ No newline at end of file +var _0xc2e1=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/preview','/:id/run','run','/:id/query','post','create','put','update','destroy','exports','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2e1,0x1f3));var _0x1c2e=function(_0x1341e4,_0x58a32b){_0x1341e4=_0x1341e4-0x0;var _0x42173b=_0xc2e1[_0x1341e4];return _0x42173b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c2e('0x0'));var timeout=require(_0x1c2e('0x1'));var express=require('express');var router=express[_0x1c2e('0x2')]();var fs_extra=require(_0x1c2e('0x3'));var auth=require(_0x1c2e('0x4'));var interaction=require(_0x1c2e('0x5'));var config=require(_0x1c2e('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x1c2e('0x7')]('/',auth[_0x1c2e('0x8')](),controller['index']);router[_0x1c2e('0x7')](_0x1c2e('0x9'),auth[_0x1c2e('0x8')](),controller['show']);router[_0x1c2e('0x7')](_0x1c2e('0xa'),auth[_0x1c2e('0x8')](),controller['preview']);router[_0x1c2e('0x7')](_0x1c2e('0xb'),auth[_0x1c2e('0x8')](),controller[_0x1c2e('0xc')]);router['get'](_0x1c2e('0xd'),auth[_0x1c2e('0x8')](),controller['query']);router[_0x1c2e('0xe')]('/',auth[_0x1c2e('0x8')](),controller[_0x1c2e('0xf')]);router[_0x1c2e('0x10')](_0x1c2e('0x9'),auth['isAuthenticated'](),controller[_0x1c2e('0x11')]);router['delete'](_0x1c2e('0x9'),auth[_0x1c2e('0x8')](),controller[_0x1c2e('0x12')]);module[_0x1c2e('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8ae0a5a..6477f73 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 _0x0562=['manual','scheduled','INTEGER','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0562,0xed));var _0x2056=function(_0x8e6638,_0x35d195){_0x8e6638=_0x8e6638-0x0;var _0x2dc734=_0x0562[_0x8e6638];return _0x2dc734;};'use strict';var Sequelize=require(_0x2056('0x0'));var moment=require(_0x2056('0x1'));module[_0x2056('0x2')]={'name':{'type':Sequelize[_0x2056('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x2056('0x4')](_0x2056('0x5'),_0x2056('0x6'),_0x2056('0x7')),'allowNull':![],'defaultValue':_0x2056('0x5')},'savename':{'type':Sequelize[_0x2056('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x2056('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x2056('0x3')],'defaultValue':_0x2056('0x9')},'type':{'type':Sequelize[_0x2056('0x4')](_0x2056('0xa'),_0x2056('0xb')),'allowNull':![],'defaultValue':_0x2056('0xa')},'reportId':{'type':Sequelize[_0x2056('0xc')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x2056('0x3')]}}; \ No newline at end of file +var _0xa135=['exports','STRING','ENUM','csv','xlsx','DATE','Loading','manual','scheduled','INTEGER','moment'];(function(_0x3778d8,_0x5ce417){var _0x45a1b3=function(_0x28488a){while(--_0x28488a){_0x3778d8['push'](_0x3778d8['shift']());}};_0x45a1b3(++_0x5ce417);}(_0xa135,0x15f));var _0x5a13=function(_0x51e913,_0x3a9d0c){_0x51e913=_0x51e913-0x0;var _0xe6cf6b=_0xa135[_0x51e913];return _0xe6cf6b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5a13('0x0'));module[_0x5a13('0x1')]={'name':{'type':Sequelize[_0x5a13('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x5a13('0x3')](_0x5a13('0x4'),'pdf',_0x5a13('0x5')),'allowNull':![],'defaultValue':_0x5a13('0x4')},'savename':{'type':Sequelize[_0x5a13('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x5a13('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x5a13('0x2')],'defaultValue':_0x5a13('0x7')},'type':{'type':Sequelize[_0x5a13('0x3')](_0x5a13('0x8'),_0x5a13('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x5a13('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x5a13('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index c6e8506..6237e5f 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 _0x644f=['../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','merge','where','includeAll','include','AnalyticExtractedReport','show','params','keys','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','output','toLowerCase','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4fc450,_0x4ddc0a){var _0x59001a=function(_0x172f20){while(--_0x172f20){_0x4fc450['push'](_0x4fc450['shift']());}};_0x59001a(++_0x4ddc0a);}(_0x644f,0xa1));var _0xf644=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x644f[_0xbc4560];return _0x298cfb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf644('0x0'));var zipdir=require(_0xf644('0x1'));var jsonpatch=require(_0xf644('0x2'));var rp=require('request-promise');var moment=require(_0xf644('0x3'));var BPromise=require(_0xf644('0x4'));var Mustache=require(_0xf644('0x5'));var util=require(_0xf644('0x6'));var path=require('path');var sox=require(_0xf644('0x7'));var csv=require(_0xf644('0x8'));var ejs=require(_0xf644('0x9'));var fs=require('fs');var fs_extra=require(_0xf644('0xa'));var _=require('lodash');var squel=require(_0xf644('0xb'));var crypto=require(_0xf644('0xc'));var jsforce=require(_0xf644('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf644('0x8'));var querystring=require(_0xf644('0xe'));var Papa=require(_0xf644('0xf'));var Redis=require(_0xf644('0x10'));var authService=require(_0xf644('0x11'));var qs=require(_0xf644('0x12'));var as=require(_0xf644('0x13'));var hardwareService=require(_0xf644('0x14'));var logger=require(_0xf644('0x15'))('api');var utils=require(_0xf644('0x16'));var config=require(_0xf644('0x17'));var licenseUtil=require(_0xf644('0x18'));var db=require(_0xf644('0x19'))['db'];function respondWithStatusCode(_0x18095b,_0x3174f2){_0x3174f2=_0x3174f2||0xcc;return function(_0x57abb6){if(_0x57abb6){return _0x18095b['sendStatus'](_0x3174f2);}return _0x18095b[_0xf644('0x1a')](_0x3174f2)[_0xf644('0x1b')]();};}function respondWithResult(_0x136c44,_0x23d19e){_0x23d19e=_0x23d19e||0xc8;return function(_0x4bb78e){if(_0x4bb78e){return _0x136c44[_0xf644('0x1a')](_0x23d19e)['json'](_0x4bb78e);}};}function respondWithFilteredResult(_0x19cdcd,_0x3f96b7){return function(_0x391869){if(_0x391869){var _0x4061f4=typeof _0x3f96b7[_0xf644('0x1c')]===_0xf644('0x1d')&&typeof _0x3f96b7[_0xf644('0x1e')]===_0xf644('0x1d');var _0x2ce763=_0x391869[_0xf644('0x1f')];var _0x36c632=_0x4061f4?0x0:_0x3f96b7[_0xf644('0x1c')];var _0x44a344=_0x4061f4?_0x391869[_0xf644('0x1f')]:_0x3f96b7['offset']+_0x3f96b7[_0xf644('0x1e')];var _0x542781;if(_0x44a344>=_0x2ce763){_0x44a344=_0x2ce763;_0x542781=0xc8;}else{_0x542781=0xce;}_0x19cdcd[_0xf644('0x1a')](_0x542781);return _0x19cdcd[_0xf644('0x20')](_0xf644('0x21'),_0x36c632+'-'+_0x44a344+'/'+_0x2ce763)[_0xf644('0x22')](_0x391869);}return null;};}function patchUpdates(_0x5dc21c){return function(_0xba9157){try{jsonpatch[_0xf644('0x23')](_0xba9157,_0x5dc21c,!![]);}catch(_0x541641){return BPromise[_0xf644('0x24')](_0x541641);}return _0xba9157[_0xf644('0x25')]();};}function saveUpdates(_0x5209d7,_0x6cebe4){return function(_0x45cb08){if(_0x45cb08){return _0x45cb08[_0xf644('0x26')](_0x5209d7)[_0xf644('0x27')](function(_0xd47a42){return _0xd47a42;});}return null;};}function removeEntity(_0x488649,_0x53743e){return function(_0x1fe340){if(_0x1fe340){return _0x1fe340[_0xf644('0x28')]()['then'](function(){var _0x1bcf64=_0x1fe340[_0xf644('0x29')]({'plain':!![]});var _0x3f7777=_0xf644('0x2a');return db[_0xf644('0x2b')]['destroy']({'where':{'type':_0x3f7777,'resourceId':_0x1bcf64['id']}})['then'](function(){return _0x1fe340;});})[_0xf644('0x27')](function(){_0x488649[_0xf644('0x1a')](0xcc)[_0xf644('0x1b')]();});}};}function handleEntityNotFound(_0x1914bb,_0x2951ce){return function(_0x5bb1d0){if(!_0x5bb1d0){_0x1914bb[_0xf644('0x2c')](0x194);}return _0x5bb1d0;};}function handleError(_0x4c379b,_0x4a0b97){_0x4a0b97=_0x4a0b97||0x1f4;return function(_0x3d2702){logger[_0xf644('0x2d')](_0x3d2702[_0xf644('0x2e')]);if(_0x3d2702[_0xf644('0x2f')]){delete _0x3d2702['name'];}_0x4c379b[_0xf644('0x1a')](_0x4a0b97)[_0xf644('0x30')](_0x3d2702);};}exports[_0xf644('0x31')]=function(_0x1e4408,_0x22632f){var _0x20e736={},_0x52f9e2={},_0x4df32c={'count':0x0,'rows':[]};var _0x4881f1=_['map'](db['AnalyticExtractedReport'][_0xf644('0x32')],function(_0x36bba2){return{'name':_0x36bba2['fieldName'],'type':_0x36bba2['type'][_0xf644('0x33')]};});_0x52f9e2[_0xf644('0x34')]=_[_0xf644('0x35')](_0x4881f1,_0xf644('0x2f'));_0x52f9e2[_0xf644('0x36')]=_['keys'](_0x1e4408[_0xf644('0x36')]);_0x52f9e2[_0xf644('0x37')]=_[_0xf644('0x38')](_0x52f9e2[_0xf644('0x34')],_0x52f9e2[_0xf644('0x36')]);_0x20e736[_0xf644('0x39')]=_[_0xf644('0x38')](_0x52f9e2[_0xf644('0x34')],qs[_0xf644('0x3a')](_0x1e4408[_0xf644('0x36')][_0xf644('0x3a')]));_0x20e736[_0xf644('0x39')]=_0x20e736[_0xf644('0x39')]['length']?_0x20e736[_0xf644('0x39')]:_0x52f9e2[_0xf644('0x34')];if(!_0x1e4408[_0xf644('0x36')][_0xf644('0x3b')]('nolimit')){_0x20e736[_0xf644('0x1e')]=qs[_0xf644('0x1e')](_0x1e4408[_0xf644('0x36')][_0xf644('0x1e')]);_0x20e736[_0xf644('0x1c')]=qs[_0xf644('0x1c')](_0x1e4408[_0xf644('0x36')]['offset']);}_0x20e736['order']=qs['sort'](_0x1e4408[_0xf644('0x36')][_0xf644('0x3c')]);_0x20e736['where']=qs['filters'](_['pick'](_0x1e4408[_0xf644('0x36')],_0x52f9e2[_0xf644('0x37')]),_0x4881f1);if(_0x1e4408[_0xf644('0x36')]['filter']){_0x20e736['where']=_[_0xf644('0x3d')](_0x20e736['where'],{'$or':_[_0xf644('0x35')](_0x4881f1,function(_0x3f3882){if(_0x3f3882['type']!=='VIRTUAL'){var _0x43a217={};_0x43a217[_0x3f3882[_0xf644('0x2f')]]={'$like':'%'+_0x1e4408[_0xf644('0x36')]['filter']+'%'};return _0x43a217;}})});}_0x20e736=_[_0xf644('0x3d')]({},_0x20e736,_0x1e4408['options']);var _0x543f2f={'where':_0x20e736[_0xf644('0x3e')]};return db['AnalyticExtractedReport'][_0xf644('0x1f')](_0x543f2f)[_0xf644('0x27')](function(_0x57c6f0){_0x4df32c[_0xf644('0x1f')]=_0x57c6f0;if(_0x1e4408[_0xf644('0x36')][_0xf644('0x3f')]){_0x20e736[_0xf644('0x40')]=[{'all':!![]}];}return db[_0xf644('0x41')]['findAll'](_0x20e736);})[_0xf644('0x27')](function(_0x1b764c){_0x4df32c['rows']=_0x1b764c;return _0x4df32c;})[_0xf644('0x27')](respondWithFilteredResult(_0x22632f,_0x20e736))['catch'](handleError(_0x22632f,null));};exports[_0xf644('0x42')]=function(_0xbae6b8,_0x5f1968){var _0xeb2011={'raw':!![],'where':{'id':_0xbae6b8[_0xf644('0x43')]['id']}},_0x2acc7e={};_0x2acc7e[_0xf644('0x34')]=_['keys'](db[_0xf644('0x41')][_0xf644('0x32')]);_0x2acc7e[_0xf644('0x36')]=_[_0xf644('0x44')](_0xbae6b8[_0xf644('0x36')]);_0x2acc7e[_0xf644('0x37')]=_[_0xf644('0x38')](_0x2acc7e[_0xf644('0x34')],_0x2acc7e[_0xf644('0x36')]);_0xeb2011['attributes']=_[_0xf644('0x38')](_0x2acc7e[_0xf644('0x34')],qs[_0xf644('0x3a')](_0xbae6b8[_0xf644('0x36')][_0xf644('0x3a')]));_0xeb2011['attributes']=_0xeb2011['attributes'][_0xf644('0x45')]?_0xeb2011[_0xf644('0x39')]:_0x2acc7e['model'];if(_0xbae6b8[_0xf644('0x36')][_0xf644('0x3f')]){_0xeb2011[_0xf644('0x40')]=[{'all':!![]}];}_0xeb2011=_['merge']({},_0xeb2011,_0xbae6b8[_0xf644('0x46')]);return db[_0xf644('0x41')][_0xf644('0x47')](_0xeb2011)[_0xf644('0x27')](handleEntityNotFound(_0x5f1968,null))[_0xf644('0x27')](respondWithResult(_0x5f1968,null))[_0xf644('0x48')](handleError(_0x5f1968,null));};exports['create']=function(_0x2fce96,_0x4c7694){return db['AnalyticExtractedReport'][_0xf644('0x49')](_0x2fce96[_0xf644('0x4a')],{})[_0xf644('0x27')](function(_0x23f5bf){var _0x198e75=_0x2fce96[_0xf644('0x4b')][_0xf644('0x29')]({'plain':!![]});if(!_0x198e75)throw new Error(_0xf644('0x4c'));if(_0x198e75['role']===_0xf644('0x4b')){var _0x415cc7=_0x23f5bf[_0xf644('0x29')]({'plain':!![]});var _0x201264=_0xf644('0x2a');return db[_0xf644('0x4d')][_0xf644('0x47')]({'where':{'name':_0x201264,'userProfileId':_0x198e75['userProfileId']},'raw':!![]})[_0xf644('0x27')](function(_0x157094){if(_0x157094&&_0x157094[_0xf644('0x4e')]===0x0){return db[_0xf644('0x2b')]['create']({'name':_0x415cc7['name'],'resourceId':_0x415cc7['id'],'type':_0x157094[_0xf644('0x2f')],'sectionId':_0x157094['id']},{})[_0xf644('0x27')](function(){return _0x23f5bf;});}else{return _0x23f5bf;}})[_0xf644('0x48')](function(_0x3cec8c){logger[_0xf644('0x2d')](_0xf644('0x4f'),_0x3cec8c);throw _0x3cec8c;});}return _0x23f5bf;})[_0xf644('0x27')](respondWithResult(_0x4c7694,0xc9))[_0xf644('0x48')](handleError(_0x4c7694,null));};exports[_0xf644('0x26')]=function(_0x5dffde,_0x3a8ebf){if(_0x5dffde[_0xf644('0x4a')]['id']){delete _0x5dffde['body']['id'];}return db[_0xf644('0x41')][_0xf644('0x47')]({'where':{'id':_0x5dffde['params']['id']}})[_0xf644('0x27')](handleEntityNotFound(_0x3a8ebf,null))[_0xf644('0x27')](saveUpdates(_0x5dffde[_0xf644('0x4a')],null))[_0xf644('0x27')](respondWithResult(_0x3a8ebf,null))['catch'](handleError(_0x3a8ebf,null));};exports[_0xf644('0x28')]=function(_0x3494f7,_0x32d6e1){return db[_0xf644('0x41')][_0xf644('0x47')]({'where':{'id':_0x3494f7[_0xf644('0x43')]['id']}})['then'](handleEntityNotFound(_0x32d6e1,null))[_0xf644('0x27')](removeEntity(_0x32d6e1,null))[_0xf644('0x48')](handleError(_0x32d6e1,null));};exports[_0xf644('0x50')]=function(_0x534ebc,_0x49dbba,_0x147c7c){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x534ebc['params']['id']},'attributes':[_0xf644('0x2f'),_0xf644('0x51'),'savename','output'],'raw':!![]})[_0xf644('0x27')](handleEntityNotFound(_0x49dbba,null))[_0xf644('0x27')](function(_0x1bf80d){if(_0x1bf80d){if(!fs[_0xf644('0x52')](path[_0xf644('0x53')](config[_0xf644('0x54')],_0xf644('0x55'),_0x1bf80d[_0xf644('0x56')]))){throw new db[(_0xf644('0x57'))][(_0xf644('0x58'))](_0xf644('0x59'));}if(_0x534ebc[_0xf644('0x36')]['exists']){return _0x49dbba[_0xf644('0x2c')](0xc8);}return _0x49dbba[_0xf644('0x50')](path[_0xf644('0x53')](config['root'],_0xf644('0x55'),_0x1bf80d[_0xf644('0x56')]),util['format']('%s.%s',_0x1bf80d[_0xf644('0x51')]||_0x1bf80d['name'],_0x1bf80d[_0xf644('0x5a')][_0xf644('0x5b')]()));}})[_0xf644('0x48')](handleError(_0x49dbba,null));}; \ No newline at end of file +var _0x6d9c=['send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','count','includeAll','findAll','rows','catch','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','join','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','name'];(function(_0x3e99c0,_0x45c593){var _0x4d19a6=function(_0x26d7e){while(--_0x26d7e){_0x3e99c0['push'](_0x3e99c0['shift']());}};_0x4d19a6(++_0x45c593);}(_0x6d9c,0x98));var _0xc6d9=function(_0x439f02,_0x4df97e){_0x439f02=_0x439f02-0x0;var _0x1b4134=_0x6d9c[_0x439f02];return _0x1b4134;};'use strict';var emlformat=require(_0xc6d9('0x0'));var rimraf=require(_0xc6d9('0x1'));var zipdir=require(_0xc6d9('0x2'));var jsonpatch=require(_0xc6d9('0x3'));var rp=require(_0xc6d9('0x4'));var moment=require(_0xc6d9('0x5'));var BPromise=require(_0xc6d9('0x6'));var Mustache=require(_0xc6d9('0x7'));var util=require(_0xc6d9('0x8'));var path=require(_0xc6d9('0x9'));var sox=require(_0xc6d9('0xa'));var csv=require(_0xc6d9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6d9('0xc'));var _=require('lodash');var squel=require(_0xc6d9('0xd'));var crypto=require(_0xc6d9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc6d9('0xb'));var querystring=require(_0xc6d9('0xf'));var Papa=require(_0xc6d9('0x10'));var Redis=require(_0xc6d9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc6d9('0x12'));var as=require(_0xc6d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6d9('0x14'))('api');var utils=require(_0xc6d9('0x15'));var config=require(_0xc6d9('0x16'));var licenseUtil=require(_0xc6d9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33f997,_0x52dd85){_0x52dd85=_0x52dd85||0xcc;return function(_0x59ad2e){if(_0x59ad2e){return _0x33f997[_0xc6d9('0x18')](_0x52dd85);}return _0x33f997[_0xc6d9('0x19')](_0x52dd85)[_0xc6d9('0x1a')]();};}function respondWithResult(_0x36c959,_0x1c7b8e){_0x1c7b8e=_0x1c7b8e||0xc8;return function(_0x234233){if(_0x234233){return _0x36c959[_0xc6d9('0x19')](_0x1c7b8e)[_0xc6d9('0x1b')](_0x234233);}};}function respondWithFilteredResult(_0x3fb681,_0x27c273){return function(_0x4b3378){if(_0x4b3378){var _0x460803=typeof _0x27c273[_0xc6d9('0x1c')]===_0xc6d9('0x1d')&&typeof _0x27c273[_0xc6d9('0x1e')]===_0xc6d9('0x1d');var _0xd9915d=_0x4b3378['count'];var _0xb0babe=_0x460803?0x0:_0x27c273[_0xc6d9('0x1c')];var _0x81952f=_0x460803?_0x4b3378['count']:_0x27c273[_0xc6d9('0x1c')]+_0x27c273[_0xc6d9('0x1e')];var _0x1b489c;if(_0x81952f>=_0xd9915d){_0x81952f=_0xd9915d;_0x1b489c=0xc8;}else{_0x1b489c=0xce;}_0x3fb681['status'](_0x1b489c);return _0x3fb681[_0xc6d9('0x1f')](_0xc6d9('0x20'),_0xb0babe+'-'+_0x81952f+'/'+_0xd9915d)[_0xc6d9('0x1b')](_0x4b3378);}return null;};}function patchUpdates(_0x2b1c77){return function(_0x264acb){try{jsonpatch[_0xc6d9('0x21')](_0x264acb,_0x2b1c77,!![]);}catch(_0x3e1894){return BPromise[_0xc6d9('0x22')](_0x3e1894);}return _0x264acb[_0xc6d9('0x23')]();};}function saveUpdates(_0x59d12c,_0x14d7f0){return function(_0x59d705){if(_0x59d705){return _0x59d705[_0xc6d9('0x24')](_0x59d12c)[_0xc6d9('0x25')](function(_0x3caf8d){return _0x3caf8d;});}return null;};}function removeEntity(_0x3502fd,_0x2ab261){return function(_0x2c5b17){if(_0x2c5b17){return _0x2c5b17[_0xc6d9('0x26')]()['then'](function(){var _0x2d7540=_0x2c5b17[_0xc6d9('0x27')]({'plain':!![]});var _0x3443d0='ExtractedReports';return db['UserProfileResource'][_0xc6d9('0x26')]({'where':{'type':_0x3443d0,'resourceId':_0x2d7540['id']}})['then'](function(){return _0x2c5b17;});})[_0xc6d9('0x25')](function(){_0x3502fd[_0xc6d9('0x19')](0xcc)[_0xc6d9('0x1a')]();});}};}function handleEntityNotFound(_0x14f92f,_0x36e426){return function(_0x2afef4){if(!_0x2afef4){_0x14f92f[_0xc6d9('0x18')](0x194);}return _0x2afef4;};}function handleError(_0x1f436b,_0x15e4ec){_0x15e4ec=_0x15e4ec||0x1f4;return function(_0x384990){logger[_0xc6d9('0x28')](_0x384990['stack']);if(_0x384990[_0xc6d9('0x29')]){delete _0x384990['name'];}_0x1f436b['status'](_0x15e4ec)[_0xc6d9('0x2a')](_0x384990);};}exports[_0xc6d9('0x2b')]=function(_0x3ae26c,_0x546d2e){var _0x1979e6={},_0xecdb7d={},_0x401dd6={'count':0x0,'rows':[]};var _0x3d9d13=_[_0xc6d9('0x2c')](db['AnalyticExtractedReport'][_0xc6d9('0x2d')],function(_0x2c4d6e){return{'name':_0x2c4d6e[_0xc6d9('0x2e')],'type':_0x2c4d6e[_0xc6d9('0x2f')]['key']};});_0xecdb7d[_0xc6d9('0x30')]=_[_0xc6d9('0x2c')](_0x3d9d13,_0xc6d9('0x29'));_0xecdb7d['query']=_[_0xc6d9('0x31')](_0x3ae26c[_0xc6d9('0x32')]);_0xecdb7d[_0xc6d9('0x33')]=_['intersection'](_0xecdb7d['model'],_0xecdb7d['query']);_0x1979e6[_0xc6d9('0x34')]=_[_0xc6d9('0x35')](_0xecdb7d[_0xc6d9('0x30')],qs[_0xc6d9('0x36')](_0x3ae26c[_0xc6d9('0x32')][_0xc6d9('0x36')]));_0x1979e6[_0xc6d9('0x34')]=_0x1979e6[_0xc6d9('0x34')]['length']?_0x1979e6['attributes']:_0xecdb7d[_0xc6d9('0x30')];if(!_0x3ae26c['query'][_0xc6d9('0x37')](_0xc6d9('0x38'))){_0x1979e6[_0xc6d9('0x1e')]=qs[_0xc6d9('0x1e')](_0x3ae26c[_0xc6d9('0x32')][_0xc6d9('0x1e')]);_0x1979e6['offset']=qs['offset'](_0x3ae26c[_0xc6d9('0x32')][_0xc6d9('0x1c')]);}_0x1979e6[_0xc6d9('0x39')]=qs['sort'](_0x3ae26c['query'][_0xc6d9('0x3a')]);_0x1979e6[_0xc6d9('0x3b')]=qs[_0xc6d9('0x33')](_[_0xc6d9('0x3c')](_0x3ae26c['query'],_0xecdb7d[_0xc6d9('0x33')]),_0x3d9d13);if(_0x3ae26c[_0xc6d9('0x32')][_0xc6d9('0x3d')]){_0x1979e6[_0xc6d9('0x3b')]=_[_0xc6d9('0x3e')](_0x1979e6[_0xc6d9('0x3b')],{'$or':_[_0xc6d9('0x2c')](_0x3d9d13,function(_0x3c384a){if(_0x3c384a[_0xc6d9('0x2f')]!==_0xc6d9('0x3f')){var _0x3be5b4={};_0x3be5b4[_0x3c384a['name']]={'$like':'%'+_0x3ae26c[_0xc6d9('0x32')][_0xc6d9('0x3d')]+'%'};return _0x3be5b4;}})});}_0x1979e6=_[_0xc6d9('0x3e')]({},_0x1979e6,_0x3ae26c[_0xc6d9('0x40')]);var _0xa1e12d={'where':_0x1979e6[_0xc6d9('0x3b')]};return db[_0xc6d9('0x41')][_0xc6d9('0x42')](_0xa1e12d)[_0xc6d9('0x25')](function(_0x122e19){_0x401dd6[_0xc6d9('0x42')]=_0x122e19;if(_0x3ae26c[_0xc6d9('0x32')][_0xc6d9('0x43')]){_0x1979e6['include']=[{'all':!![]}];}return db[_0xc6d9('0x41')][_0xc6d9('0x44')](_0x1979e6);})[_0xc6d9('0x25')](function(_0x406db0){_0x401dd6[_0xc6d9('0x45')]=_0x406db0;return _0x401dd6;})[_0xc6d9('0x25')](respondWithFilteredResult(_0x546d2e,_0x1979e6))[_0xc6d9('0x46')](handleError(_0x546d2e,null));};exports['show']=function(_0x3a8d73,_0x10d1d8){var _0x28a4e6={'raw':!![],'where':{'id':_0x3a8d73['params']['id']}},_0x3ed4a8={};_0x3ed4a8[_0xc6d9('0x30')]=_[_0xc6d9('0x31')](db['AnalyticExtractedReport'][_0xc6d9('0x2d')]);_0x3ed4a8[_0xc6d9('0x32')]=_[_0xc6d9('0x31')](_0x3a8d73[_0xc6d9('0x32')]);_0x3ed4a8[_0xc6d9('0x33')]=_[_0xc6d9('0x35')](_0x3ed4a8[_0xc6d9('0x30')],_0x3ed4a8[_0xc6d9('0x32')]);_0x28a4e6[_0xc6d9('0x34')]=_[_0xc6d9('0x35')](_0x3ed4a8[_0xc6d9('0x30')],qs[_0xc6d9('0x36')](_0x3a8d73['query'][_0xc6d9('0x36')]));_0x28a4e6['attributes']=_0x28a4e6[_0xc6d9('0x34')][_0xc6d9('0x47')]?_0x28a4e6['attributes']:_0x3ed4a8[_0xc6d9('0x30')];if(_0x3a8d73[_0xc6d9('0x32')][_0xc6d9('0x43')]){_0x28a4e6[_0xc6d9('0x48')]=[{'all':!![]}];}_0x28a4e6=_[_0xc6d9('0x3e')]({},_0x28a4e6,_0x3a8d73[_0xc6d9('0x40')]);return db[_0xc6d9('0x41')][_0xc6d9('0x49')](_0x28a4e6)[_0xc6d9('0x25')](handleEntityNotFound(_0x10d1d8,null))['then'](respondWithResult(_0x10d1d8,null))[_0xc6d9('0x46')](handleError(_0x10d1d8,null));};exports['create']=function(_0x546b1d,_0x2fa5c5){return db[_0xc6d9('0x41')][_0xc6d9('0x4a')](_0x546b1d[_0xc6d9('0x4b')],{})[_0xc6d9('0x25')](function(_0xca09ab){var _0x37988b=_0x546b1d[_0xc6d9('0x4c')][_0xc6d9('0x27')]({'plain':!![]});if(!_0x37988b)throw new Error(_0xc6d9('0x4d'));if(_0x37988b[_0xc6d9('0x4e')]===_0xc6d9('0x4c')){var _0x26fb9d=_0xca09ab[_0xc6d9('0x27')]({'plain':!![]});var _0x1c6d82=_0xc6d9('0x4f');return db[_0xc6d9('0x50')][_0xc6d9('0x49')]({'where':{'name':_0x1c6d82,'userProfileId':_0x37988b['userProfileId']},'raw':!![]})[_0xc6d9('0x25')](function(_0x1e621a){if(_0x1e621a&&_0x1e621a[_0xc6d9('0x51')]===0x0){return db[_0xc6d9('0x52')]['create']({'name':_0x26fb9d[_0xc6d9('0x29')],'resourceId':_0x26fb9d['id'],'type':_0x1e621a['name'],'sectionId':_0x1e621a['id']},{})['then'](function(){return _0xca09ab;});}else{return _0xca09ab;}})[_0xc6d9('0x46')](function(_0x1ee4ec){logger[_0xc6d9('0x28')](_0xc6d9('0x53'),_0x1ee4ec);throw _0x1ee4ec;});}return _0xca09ab;})[_0xc6d9('0x25')](respondWithResult(_0x2fa5c5,0xc9))[_0xc6d9('0x46')](handleError(_0x2fa5c5,null));};exports[_0xc6d9('0x24')]=function(_0xfe7d82,_0x180f88){if(_0xfe7d82[_0xc6d9('0x4b')]['id']){delete _0xfe7d82['body']['id'];}return db[_0xc6d9('0x41')][_0xc6d9('0x49')]({'where':{'id':_0xfe7d82[_0xc6d9('0x54')]['id']}})[_0xc6d9('0x25')](handleEntityNotFound(_0x180f88,null))[_0xc6d9('0x25')](saveUpdates(_0xfe7d82[_0xc6d9('0x4b')],null))[_0xc6d9('0x25')](respondWithResult(_0x180f88,null))['catch'](handleError(_0x180f88,null));};exports[_0xc6d9('0x26')]=function(_0x5838a0,_0x1a0e1d){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x5838a0[_0xc6d9('0x54')]['id']}})[_0xc6d9('0x25')](handleEntityNotFound(_0x1a0e1d,null))['then'](removeEntity(_0x1a0e1d,null))['catch'](handleError(_0x1a0e1d,null));};exports[_0xc6d9('0x55')]=function(_0x139b76,_0xbfdd5f,_0x18009d){return db[_0xc6d9('0x41')][_0xc6d9('0x49')]({'where':{'id':_0x139b76[_0xc6d9('0x54')]['id']},'attributes':[_0xc6d9('0x29'),_0xc6d9('0x56'),_0xc6d9('0x57'),_0xc6d9('0x58')],'raw':!![]})[_0xc6d9('0x25')](handleEntityNotFound(_0xbfdd5f,null))['then'](function(_0x275df5){if(_0x275df5){if(!fs['existsSync'](path[_0xc6d9('0x59')](config['root'],_0xc6d9('0x5a'),_0x275df5[_0xc6d9('0x57')]))){throw new db[(_0xc6d9('0x5b'))]['ValidationError'](_0xc6d9('0x5c'));}if(_0x139b76[_0xc6d9('0x32')][_0xc6d9('0x5d')]){return _0xbfdd5f[_0xc6d9('0x18')](0xc8);}return _0xbfdd5f['download'](path[_0xc6d9('0x59')](config['root'],_0xc6d9('0x5a'),_0x275df5[_0xc6d9('0x57')]),util[_0xc6d9('0x5e')](_0xc6d9('0x5f'),_0x275df5[_0xc6d9('0x56')]||_0x275df5[_0xc6d9('0x29')],_0x275df5[_0xc6d9('0x58')][_0xc6d9('0x60')]()));}})['catch'](handleError(_0xbfdd5f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 9e5c13b..a0f16f6 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 _0x9562=['api','moment','bluebird','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger'];(function(_0x5204a3,_0x1c0f72){var _0x19f211=function(_0x519d81){while(--_0x519d81){_0x5204a3['push'](_0x5204a3['shift']());}};_0x19f211(++_0x1c0f72);}(_0x9562,0x19d));var _0x2956=function(_0x373c9c,_0x45fd5a){_0x373c9c=_0x373c9c-0x0;var _0x221fd9=_0x9562[_0x373c9c];return _0x221fd9;};'use strict';var _=require(_0x2956('0x0'));var util=require(_0x2956('0x1'));var logger=require(_0x2956('0x2'))(_0x2956('0x3'));var moment=require(_0x2956('0x4'));var BPromise=require(_0x2956('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2956('0x6'));var config=require(_0x2956('0x7'));var attributes=require(_0x2956('0x8'));module[_0x2956('0x9')]=function(_0x44540f,_0x132485){return _0x44540f[_0x2956('0xa')](_0x2956('0xb'),attributes,{'tableName':_0x2956('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1ac=['api','moment','bluebird','request-promise','../../config/environment','./analyticExtractedReport.attributes','define','lodash','util','../../config/logger'];(function(_0x48fcc3,_0x543107){var _0xa0f342=function(_0x356286){while(--_0x356286){_0x48fcc3['push'](_0x48fcc3['shift']());}};_0xa0f342(++_0x543107);}(_0xd1ac,0x151));var _0xcd1a=function(_0x2937ed,_0xe4ce3f){_0x2937ed=_0x2937ed-0x0;var _0x4cc289=_0xd1ac[_0x2937ed];return _0x4cc289;};'use strict';var _=require(_0xcd1a('0x0'));var util=require(_0xcd1a('0x1'));var logger=require(_0xcd1a('0x2'))(_0xcd1a('0x3'));var moment=require(_0xcd1a('0x4'));var BPromise=require(_0xcd1a('0x5'));var rp=require(_0xcd1a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcd1a('0x7'));var attributes=require(_0xcd1a('0x8'));module['exports']=function(_0x6cfadf,_0x3ef4d3){return _0x6cfadf[_0xcd1a('0x9')]('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 2fa5aac..45b6950 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 _0x6ad3=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x343dfb,_0xed8587){var _0x297fe2=function(_0x19cbbd){while(--_0x19cbbd){_0x343dfb['push'](_0x343dfb['shift']());}};_0x297fe2(++_0xed8587);}(_0x6ad3,0xe5));var _0x36ad=function(_0x3ff0f0,_0x5523bf){_0x3ff0f0=_0x3ff0f0-0x0;var _0x5dc82a=_0x6ad3[_0x3ff0f0];return _0x5dc82a;};'use strict';var _=require(_0x36ad('0x0'));var util=require('util');var moment=require(_0x36ad('0x1'));var BPromise=require(_0x36ad('0x2'));var rs=require(_0x36ad('0x3'));var fs=require('fs');var Redis=require(_0x36ad('0x4'));var db=require(_0x36ad('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36ad('0x6'))(_0x36ad('0x7'));var config=require(_0x36ad('0x8'));var jayson=require(_0x36ad('0x9'));var client=jayson[_0x36ad('0xa')][_0x36ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3363b6,_0x251039,_0x409eba){return new BPromise(function(_0x179359,_0x168861){return client[_0x36ad('0xc')](_0x3363b6,_0x409eba)['then'](function(_0x521379){logger[_0x36ad('0xd')](_0x36ad('0xe'),_0x251039,_0x36ad('0xf'));logger[_0x36ad('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x251039,_0x36ad('0xf'),JSON[_0x36ad('0x11')](_0x521379));if(_0x521379[_0x36ad('0x12')]){if(_0x521379[_0x36ad('0x12')]['code']===0x1f4){logger['error'](_0x36ad('0xe'),_0x251039,_0x521379['error'][_0x36ad('0x13')]);return _0x168861(_0x521379['error'][_0x36ad('0x13')]);}logger[_0x36ad('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x251039,_0x521379[_0x36ad('0x12')][_0x36ad('0x13')]);return _0x179359(_0x521379['error'][_0x36ad('0x13')]);}else{logger[_0x36ad('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x251039,_0x36ad('0xf'));_0x179359(_0x521379[_0x36ad('0x14')][_0x36ad('0x13')]);}})[_0x36ad('0x15')](function(_0x16ebd2){logger[_0x36ad('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x251039,_0x16ebd2);_0x168861(_0x16ebd2);});});} \ No newline at end of file +var _0xd523=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x38fb8b,_0x70dd0a){var _0x1ec681=function(_0x58f130){while(--_0x58f130){_0x38fb8b['push'](_0x38fb8b['shift']());}};_0x1ec681(++_0x70dd0a);}(_0xd523,0x153));var _0x3d52=function(_0x50380e,_0x387294){_0x50380e=_0x50380e-0x0;var _0x118fdc=_0xd523[_0x50380e];return _0x118fdc;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcc92,_0x189147,_0x2f3ebc){return new BPromise(function(_0x232bd4,_0x2e03c0){return client[_0x3d52('0xb')](_0x4fcc92,_0x2f3ebc)[_0x3d52('0xc')](function(_0x34c184){logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,'request\x20sent');logger[_0x3d52('0xf')](_0x3d52('0x10'),_0x189147,_0x3d52('0x11'),JSON[_0x3d52('0x12')](_0x34c184));if(_0x34c184[_0x3d52('0x13')]){if(_0x34c184['error'][_0x3d52('0x14')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x2e03c0(_0x34c184['error']['message']);}logger['error'](_0x3d52('0xe'),_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x232bd4(_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);}else{logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,_0x3d52('0x11'));_0x232bd4(_0x34c184[_0x3d52('0x16')][_0x3d52('0x15')]);}})[_0x3d52('0x17')](function(_0x15cc02){logger[_0x3d52('0x13')](_0x3d52('0xe'),_0x189147,_0x15cc02);_0x2e03c0(_0x15cc02);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e18102d..581ea3b 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 _0x52be=['index','get','/:id','isAuthenticated','show','/:id/download','download','create','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller'];(function(_0x1b7e01,_0x1c87af){var _0x5592cf=function(_0x5bb2fc){while(--_0x5bb2fc){_0x1b7e01['push'](_0x1b7e01['shift']());}};_0x5592cf(++_0x1c87af);}(_0x52be,0x1ae));var _0xe52b=function(_0x430095,_0x122722){_0x430095=_0x430095-0x0;var _0x115f8a=_0x52be[_0x430095];return _0x115f8a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe52b('0x0'));var express=require(_0xe52b('0x1'));var router=express[_0xe52b('0x2')]();var fs_extra=require(_0xe52b('0x3'));var auth=require(_0xe52b('0x4'));var interaction=require(_0xe52b('0x5'));var config=require('../../config/environment');var controller=require(_0xe52b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe52b('0x7')]);router[_0xe52b('0x8')](_0xe52b('0x9'),auth[_0xe52b('0xa')](),controller[_0xe52b('0xb')]);router[_0xe52b('0x8')](_0xe52b('0xc'),auth[_0xe52b('0xa')](),controller[_0xe52b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe52b('0xe')]);router['put'](_0xe52b('0x9'),auth[_0xe52b('0xa')](),controller[_0xe52b('0xf')]);router[_0xe52b('0x10')](_0xe52b('0x9'),auth[_0xe52b('0xa')](),controller[_0xe52b('0x11')]);module[_0xe52b('0x12')]=router; \ No newline at end of file +var _0x17db=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','isAuthenticated','show','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x46b1f8,_0x4ab4f5){var _0x26ee58=function(_0x45a283){while(--_0x45a283){_0x46b1f8['push'](_0x46b1f8['shift']());}};_0x26ee58(++_0x4ab4f5);}(_0x17db,0xb5));var _0xb17d=function(_0x4d5887,_0x44e238){_0x4d5887=_0x4d5887-0x0;var _0x268afe=_0x17db[_0x4d5887];return _0x268afe;};'use strict';var multer=require(_0xb17d('0x0'));var util=require(_0xb17d('0x1'));var path=require(_0xb17d('0x2'));var timeout=require(_0xb17d('0x3'));var express=require('express');var router=express[_0xb17d('0x4')]();var fs_extra=require(_0xb17d('0x5'));var auth=require(_0xb17d('0x6'));var interaction=require(_0xb17d('0x7'));var config=require(_0xb17d('0x8'));var controller=require(_0xb17d('0x9'));router[_0xb17d('0xa')]('/',auth['isAuthenticated'](),controller[_0xb17d('0xb')]);router[_0xb17d('0xa')]('/:id',auth[_0xb17d('0xc')](),controller[_0xb17d('0xd')]);router[_0xb17d('0xa')]('/:id/download',auth[_0xb17d('0xc')](),controller[_0xb17d('0xe')]);router[_0xb17d('0xf')]('/',auth[_0xb17d('0xc')](),controller[_0xb17d('0x10')]);router[_0xb17d('0x11')](_0xb17d('0x12'),auth['isAuthenticated'](),controller[_0xb17d('0x13')]);router[_0xb17d('0x14')](_0xb17d('0x12'),auth[_0xb17d('0xc')](),controller[_0xb17d('0x15')]);module[_0xb17d('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 152a16a..8b2850f 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 _0xa377=['sequelize','exports','STRING','BOOLEAN'];(function(_0x361003,_0x20ea1a){var _0x57d4c8=function(_0x1209b7){while(--_0x1209b7){_0x361003['push'](_0x361003['shift']());}};_0x57d4c8(++_0x20ea1a);}(_0xa377,0xd0));var _0x7a37=function(_0x5f2914,_0x3ea9fc){_0x5f2914=_0x5f2914-0x0;var _0x2f63bb=_0xa377[_0x5f2914];return _0x2f63bb;};'use strict';var Sequelize=require(_0x7a37('0x0'));module[_0x7a37('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x7a37('0x2')]},'function':{'type':Sequelize[_0x7a37('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x7a37('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x7a37('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x865b=['BOOLEAN','TEXT','STRING'];(function(_0x1a43ee,_0x269d43){var _0x1074f3=function(_0x2bb605){while(--_0x2bb605){_0x1a43ee['push'](_0x1a43ee['shift']());}};_0x1074f3(++_0x269d43);}(_0x865b,0x157));var _0xb865=function(_0x5182ea,_0x2bd893){_0x5182ea=_0x5182ea-0x0;var _0x272482=_0x865b[_0x5182ea];return _0x272482;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0xb865('0x0')]},'alias':{'type':Sequelize[_0xb865('0x1')]},'function':{'type':Sequelize[_0xb865('0x1')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xb865('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e575c30..67e6a0f 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 _0x6a04=['find','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','show','params','include','catch','create','body','bulkCreate'];(function(_0x11ad65,_0x352d3c){var _0x35590c=function(_0x2c3845){while(--_0x2c3845){_0x11ad65['push'](_0x11ad65['shift']());}};_0x35590c(++_0x352d3c);}(_0x6a04,0xf7));var _0x46a0=function(_0x3287f9,_0x18c5d8){_0x3287f9=_0x3287f9-0x0;var _0x39d93c=_0x6a04[_0x3287f9];return _0x39d93c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46a0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46a0('0x1'));var rp=require('request-promise');var moment=require(_0x46a0('0x2'));var BPromise=require(_0x46a0('0x3'));var Mustache=require(_0x46a0('0x4'));var util=require(_0x46a0('0x5'));var path=require(_0x46a0('0x6'));var sox=require(_0x46a0('0x7'));var csv=require(_0x46a0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46a0('0x9'));var squel=require(_0x46a0('0xa'));var crypto=require(_0x46a0('0xb'));var jsforce=require(_0x46a0('0xc'));var deskjs=require(_0x46a0('0xd'));var toCsv=require(_0x46a0('0x8'));var querystring=require('querystring');var Papa=require(_0x46a0('0xe'));var Redis=require('ioredis');var authService=require(_0x46a0('0xf'));var qs=require(_0x46a0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46a0('0x11'));var logger=require('../../config/logger')(_0x46a0('0x12'));var utils=require(_0x46a0('0x13'));var config=require(_0x46a0('0x14'));var licenseUtil=require(_0x46a0('0x15'));var db=require(_0x46a0('0x16'))['db'];function respondWithStatusCode(_0x488219,_0x2629fb){_0x2629fb=_0x2629fb||0xcc;return function(_0x10a95c){if(_0x10a95c){return _0x488219[_0x46a0('0x17')](_0x2629fb);}return _0x488219[_0x46a0('0x18')](_0x2629fb)['end']();};}function respondWithResult(_0x119390,_0x8122a2){_0x8122a2=_0x8122a2||0xc8;return function(_0x253f2c){if(_0x253f2c){return _0x119390[_0x46a0('0x18')](_0x8122a2)[_0x46a0('0x19')](_0x253f2c);}};}function respondWithFilteredResult(_0x36aa1f,_0x909406){return function(_0x2d718d){if(_0x2d718d){var _0x2b811e=typeof _0x909406['offset']===_0x46a0('0x1a')&&typeof _0x909406[_0x46a0('0x1b')]===_0x46a0('0x1a');var _0x581765=_0x2d718d[_0x46a0('0x1c')];var _0x2e28d9=_0x2b811e?0x0:_0x909406[_0x46a0('0x1d')];var _0x2eb2fa=_0x2b811e?_0x2d718d[_0x46a0('0x1c')]:_0x909406[_0x46a0('0x1d')]+_0x909406[_0x46a0('0x1b')];var _0x48b762;if(_0x2eb2fa>=_0x581765){_0x2eb2fa=_0x581765;_0x48b762=0xc8;}else{_0x48b762=0xce;}_0x36aa1f[_0x46a0('0x18')](_0x48b762);return _0x36aa1f['set']('Content-Range',_0x2e28d9+'-'+_0x2eb2fa+'/'+_0x581765)[_0x46a0('0x19')](_0x2d718d);}return null;};}function patchUpdates(_0x205020){return function(_0x2ebc2f){try{jsonpatch[_0x46a0('0x1e')](_0x2ebc2f,_0x205020,!![]);}catch(_0x44b173){return BPromise[_0x46a0('0x1f')](_0x44b173);}return _0x2ebc2f[_0x46a0('0x20')]();};}function saveUpdates(_0x4799af,_0xe5d3c0){return function(_0xfc7d96){if(_0xfc7d96){return _0xfc7d96[_0x46a0('0x21')](_0x4799af)['then'](function(_0xf579ce){return _0xf579ce;});}return null;};}function removeEntity(_0x3680ac,_0x30c43b){return function(_0x50fb05){if(_0x50fb05){return _0x50fb05[_0x46a0('0x22')]()[_0x46a0('0x23')](function(){_0x3680ac['status'](0xcc)[_0x46a0('0x24')]();});}};}function handleEntityNotFound(_0x4e1a8d,_0x5197a9){return function(_0xfc3d28){if(!_0xfc3d28){_0x4e1a8d[_0x46a0('0x17')](0x194);}return _0xfc3d28;};}function handleError(_0x23cda8,_0x30b0c2){_0x30b0c2=_0x30b0c2||0x1f4;return function(_0x7bdd59){logger[_0x46a0('0x25')](_0x7bdd59[_0x46a0('0x26')]);if(_0x7bdd59['name']){delete _0x7bdd59[_0x46a0('0x27')];}_0x23cda8[_0x46a0('0x18')](_0x30b0c2)[_0x46a0('0x28')](_0x7bdd59);};}exports[_0x46a0('0x29')]=function(_0x34326a,_0x6a186d){var _0x2b338c={},_0x1847d8={},_0x2e880f={'count':0x0,'rows':[]};var _0x1afb70=_[_0x46a0('0x2a')](db[_0x46a0('0x2b')][_0x46a0('0x2c')],function(_0x462cdd){return{'name':_0x462cdd[_0x46a0('0x2d')],'type':_0x462cdd[_0x46a0('0x2e')][_0x46a0('0x2f')]};});_0x1847d8[_0x46a0('0x30')]=_['map'](_0x1afb70,_0x46a0('0x27'));_0x1847d8[_0x46a0('0x31')]=_[_0x46a0('0x32')](_0x34326a[_0x46a0('0x31')]);_0x1847d8['filters']=_[_0x46a0('0x33')](_0x1847d8[_0x46a0('0x30')],_0x1847d8[_0x46a0('0x31')]);_0x2b338c[_0x46a0('0x34')]=_[_0x46a0('0x33')](_0x1847d8[_0x46a0('0x30')],qs[_0x46a0('0x35')](_0x34326a[_0x46a0('0x31')][_0x46a0('0x35')]));_0x2b338c[_0x46a0('0x34')]=_0x2b338c['attributes']['length']?_0x2b338c[_0x46a0('0x34')]:_0x1847d8[_0x46a0('0x30')];if(!_0x34326a[_0x46a0('0x31')][_0x46a0('0x36')](_0x46a0('0x37'))){_0x2b338c['limit']=qs['limit'](_0x34326a[_0x46a0('0x31')][_0x46a0('0x1b')]);_0x2b338c[_0x46a0('0x1d')]=qs['offset'](_0x34326a[_0x46a0('0x31')]['offset']);}_0x2b338c[_0x46a0('0x38')]=qs[_0x46a0('0x39')](_0x34326a[_0x46a0('0x31')][_0x46a0('0x39')]);_0x2b338c[_0x46a0('0x3a')]=qs[_0x46a0('0x3b')](_['pick'](_0x34326a['query'],_0x1847d8['filters']),_0x1afb70);if(_0x34326a[_0x46a0('0x31')][_0x46a0('0x3c')]){_0x2b338c[_0x46a0('0x3a')]=_[_0x46a0('0x3d')](_0x2b338c[_0x46a0('0x3a')],{'$or':_['map'](_0x1afb70,function(_0x47249f){if(_0x47249f[_0x46a0('0x2e')]!=='VIRTUAL'){var _0x27e31d={};_0x27e31d[_0x47249f['name']]={'$like':'%'+_0x34326a['query'][_0x46a0('0x3c')]+'%'};return _0x27e31d;}})});}_0x2b338c=_['merge']({},_0x2b338c,_0x34326a[_0x46a0('0x3e')]);var _0x37ba13={'where':_0x2b338c[_0x46a0('0x3a')]};return db['AnalyticFieldReport']['count'](_0x37ba13)[_0x46a0('0x23')](function(_0x1a7ace){_0x2e880f[_0x46a0('0x1c')]=_0x1a7ace;if(_0x34326a[_0x46a0('0x31')][_0x46a0('0x3f')]){_0x2b338c['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x46a0('0x40')](_0x2b338c);})[_0x46a0('0x23')](function(_0x12fbd9){_0x2e880f[_0x46a0('0x41')]=_0x12fbd9;return _0x2e880f;})[_0x46a0('0x23')](respondWithFilteredResult(_0x6a186d,_0x2b338c))['catch'](handleError(_0x6a186d,null));};exports[_0x46a0('0x42')]=function(_0x3aac10,_0x46ac49){var _0xd3a3cb={'raw':![],'where':{'id':_0x3aac10[_0x46a0('0x43')]['id']}},_0x8b72d2={};_0x8b72d2[_0x46a0('0x30')]=_[_0x46a0('0x32')](db[_0x46a0('0x2b')]['rawAttributes']);_0x8b72d2[_0x46a0('0x31')]=_[_0x46a0('0x32')](_0x3aac10[_0x46a0('0x31')]);_0x8b72d2[_0x46a0('0x3b')]=_[_0x46a0('0x33')](_0x8b72d2[_0x46a0('0x30')],_0x8b72d2[_0x46a0('0x31')]);_0xd3a3cb['attributes']=_[_0x46a0('0x33')](_0x8b72d2[_0x46a0('0x30')],qs[_0x46a0('0x35')](_0x3aac10[_0x46a0('0x31')][_0x46a0('0x35')]));_0xd3a3cb[_0x46a0('0x34')]=_0xd3a3cb[_0x46a0('0x34')]['length']?_0xd3a3cb[_0x46a0('0x34')]:_0x8b72d2[_0x46a0('0x30')];if(_0x3aac10[_0x46a0('0x31')][_0x46a0('0x3f')]){_0xd3a3cb[_0x46a0('0x44')]=[{'all':!![]}];}_0xd3a3cb=_[_0x46a0('0x3d')]({},_0xd3a3cb,_0x3aac10[_0x46a0('0x3e')]);return db[_0x46a0('0x2b')]['find'](_0xd3a3cb)['then'](handleEntityNotFound(_0x46ac49,null))['then'](respondWithResult(_0x46ac49,null))[_0x46a0('0x45')](handleError(_0x46ac49,null));};exports[_0x46a0('0x46')]=function(_0x3a8a80,_0x2f9013){return db[_0x46a0('0x2b')]['create'](_0x3a8a80[_0x46a0('0x47')],{})['then'](respondWithResult(_0x2f9013,0xc9))[_0x46a0('0x45')](handleError(_0x2f9013,null));};exports[_0x46a0('0x48')]=function(_0xbf2a27,_0x42efdf){return db[_0x46a0('0x2b')][_0x46a0('0x48')](_0xbf2a27['body'],{'raw':![],'individualHooks':!![]})[_0x46a0('0x23')](respondWithResult(_0x42efdf,0xc9))['catch'](handleError(_0x42efdf,null));};exports['update']=function(_0x3bbc24,_0x3483ec){if(_0x3bbc24[_0x46a0('0x47')]['id']){delete _0x3bbc24[_0x46a0('0x47')]['id'];}return db[_0x46a0('0x2b')][_0x46a0('0x49')]({'where':{'id':_0x3bbc24[_0x46a0('0x43')]['id']}})['then'](handleEntityNotFound(_0x3483ec,null))[_0x46a0('0x23')](saveUpdates(_0x3bbc24['body'],null))[_0x46a0('0x23')](respondWithResult(_0x3483ec,null))[_0x46a0('0x45')](handleError(_0x3483ec,null));};exports[_0x46a0('0x22')]=function(_0x39f1b1,_0x5655ab){return db[_0x46a0('0x2b')]['find']({'where':{'id':_0x39f1b1[_0x46a0('0x43')]['id']}})['then'](handleEntityNotFound(_0x5655ab,null))[_0x46a0('0x23')](removeEntity(_0x5655ab,null))[_0x46a0('0x45')](handleError(_0x5655ab,null));};exports[_0x46a0('0x4a')]=function(_0x2aebb1,_0x2fe367){return db[_0x46a0('0x2b')][_0x46a0('0x22')]({'where':{'id':_0x2aebb1[_0x46a0('0x31')][_0x46a0('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2fe367,0xcc))[_0x46a0('0x45')](handleError(_0x2fe367,null));};exports[_0x46a0('0x4c')]=function(_0x3ba4b9,_0x13b8ed,_0x263492){return db[_0x46a0('0x4d')]['findOne']({'where':{'id':_0x3ba4b9[_0x46a0('0x43')]['id']}})[_0x46a0('0x23')](handleEntityNotFound(_0x13b8ed,null))[_0x46a0('0x23')](function(_0x317a65){if(_0x317a65){return db[_0x46a0('0x4e')][_0x46a0('0x4f')](function(_0x37099c){return db[_0x46a0('0x2b')][_0x46a0('0x22')]({'where':{'CustomReportId':_0x3ba4b9[_0x46a0('0x43')]['id']},'transaction':_0x37099c})[_0x46a0('0x23')](function(_0x40059d){var _0x4f53f9=_['map'](_0x3ba4b9[_0x46a0('0x47')],function(_0x1041fd){delete _0x1041fd['id'];_0x1041fd['CustomReportId']=_0x3ba4b9[_0x46a0('0x43')]['id'];return _0x1041fd;});return db[_0x46a0('0x2b')][_0x46a0('0x48')](_0x4f53f9,{'transaction':_0x37099c});});})['then'](function(){return db['AnalyticFieldReport'][_0x46a0('0x40')]({'where':{'CustomReportId':_0x3ba4b9[_0x46a0('0x43')]['id']}});});}})[_0x46a0('0x23')](respondWithResult(_0x13b8ed,null))[_0x46a0('0x45')](handleError(_0x13b8ed,null));}; \ No newline at end of file +var _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','bulkCreate','body','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','CustomReportId','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x2d891b,_0x5280c2){var _0x597b84=function(_0x43a6bd){while(--_0x43a6bd){_0x2d891b['push'](_0x2d891b['shift']());}};_0x597b84(++_0x5280c2);}(_0xe14b,0x93));var _0xbe14=function(_0x3db575,_0x4407cb){_0x3db575=_0x3db575-0x0;var _0x3299da=_0xe14b[_0x3db575];return _0x3299da;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25'));_0x19252f[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x3c3613[_0xbe14('0x2e')]);_0x19252f[_0xbe14('0x30')]=_['intersection'](_0x19252f[_0xbe14('0x2d')],_0x19252f['query']);_0x1c7cc7['attributes']=_[_0xbe14('0x31')](_0x19252f['model'],qs[_0xbe14('0x32')](_0x3c3613[_0xbe14('0x2e')]['fields']));_0x1c7cc7['attributes']=_0x1c7cc7['attributes'][_0xbe14('0x33')]?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f['model'];if(!_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x3c3613['query']['limit']);_0x1c7cc7[_0xbe14('0x1c')]=qs['offset'](_0x3c3613['query']['offset']);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x30')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x2e')],_0x19252f[_0xbe14('0x30')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]){_0x1c7cc7[_0xbe14('0x39')]=_['merge'](_0x1c7cc7['where'],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x2951e1){if(_0x2951e1[_0xbe14('0x2b')]!=='VIRTUAL'){var _0x326329={};_0x326329[_0x2951e1[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]+'%'};return _0x326329;}})});}_0x1c7cc7=_[_0xbe14('0x3c')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3d')]);var _0x19fa30={'where':_0x1c7cc7[_0xbe14('0x39')]};return db[_0xbe14('0x28')]['count'](_0x19fa30)[_0xbe14('0x22')](function(_0x841b71){_0x34d648[_0xbe14('0x1b')]=_0x841b71;if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3e')]){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x1220c9){_0x34d648[_0xbe14('0x41')]=_0x1220c9;return _0x34d648;})['then'](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))['catch'](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0xe417b,_0x3272ae){var _0x51c859={'raw':![],'where':{'id':_0xe417b[_0xbe14('0x43')]['id']}},_0x5d5318={};_0x5d5318['model']=_['keys'](db[_0xbe14('0x28')][_0xbe14('0x29')]);_0x5d5318[_0xbe14('0x2e')]=_['keys'](_0xe417b['query']);_0x5d5318['filters']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],_0x5d5318[_0xbe14('0x2e')]);_0x51c859['attributes']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],qs[_0xbe14('0x32')](_0xe417b[_0xbe14('0x2e')]['fields']));_0x51c859['attributes']=_0x51c859[_0xbe14('0x34')][_0xbe14('0x33')]?_0x51c859[_0xbe14('0x34')]:_0x5d5318[_0xbe14('0x2d')];if(_0xe417b[_0xbe14('0x2e')]['includeAll']){_0x51c859['include']=[{'all':!![]}];}_0x51c859=_[_0xbe14('0x3c')]({},_0x51c859,_0xe417b[_0xbe14('0x3d')]);return db[_0xbe14('0x28')][_0xbe14('0x44')](_0x51c859)['then'](handleEntityNotFound(_0x3272ae,null))[_0xbe14('0x22')](respondWithResult(_0x3272ae,null))[_0xbe14('0x45')](handleError(_0x3272ae,null));};exports['create']=function(_0x396e40,_0x2a35e5){return db[_0xbe14('0x28')][_0xbe14('0x46')](_0x396e40['body'],{})['then'](respondWithResult(_0x2a35e5,0xc9))[_0xbe14('0x45')](handleError(_0x2a35e5,null));};exports[_0xbe14('0x47')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x28')][_0xbe14('0x47')](_0x4a1a37[_0xbe14('0x48')],{'raw':![],'individualHooks':!![]})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x45')](handleError(_0x5acf90,null));};exports[_0xbe14('0x21')]=function(_0x10cd86,_0x5a4068){if(_0x10cd86[_0xbe14('0x48')]['id']){delete _0x10cd86[_0xbe14('0x48')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x44')]({'where':{'id':_0x10cd86[_0xbe14('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a4068,null))[_0xbe14('0x22')](saveUpdates(_0x10cd86[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5a4068,null))[_0xbe14('0x45')](handleError(_0x5a4068,null));};exports[_0xbe14('0x49')]=function(_0x2dbeb1,_0x505829){return db['AnalyticFieldReport'][_0xbe14('0x44')]({'where':{'id':_0x2dbeb1[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x505829,null))['then'](removeEntity(_0x505829,null))['catch'](handleError(_0x505829,null));};exports[_0xbe14('0x4a')]=function(_0x134878,_0x50d78f){return db[_0xbe14('0x28')][_0xbe14('0x49')]({'where':{'id':_0x134878['query'][_0xbe14('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x50d78f,0xcc))[_0xbe14('0x45')](handleError(_0x50d78f,null));};exports[_0xbe14('0x4c')]=function(_0x12a9de,_0x550291,_0x435c8d){return db[_0xbe14('0x4d')]['findOne']({'where':{'id':_0x12a9de[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x550291,null))[_0xbe14('0x22')](function(_0x20c48d){if(_0x20c48d){return db[_0xbe14('0x4e')]['transaction'](function(_0x42a346){return db[_0xbe14('0x28')][_0xbe14('0x49')]({'where':{'CustomReportId':_0x12a9de[_0xbe14('0x43')]['id']},'transaction':_0x42a346})[_0xbe14('0x22')](function(_0x44084c){var _0x1dd6c7=_['map'](_0x12a9de[_0xbe14('0x48')],function(_0x1b47a4){delete _0x1b47a4['id'];_0x1b47a4[_0xbe14('0x4f')]=_0x12a9de[_0xbe14('0x43')]['id'];return _0x1b47a4;});return db[_0xbe14('0x28')][_0xbe14('0x47')](_0x1dd6c7,{'transaction':_0x42a346});});})[_0xbe14('0x22')](function(){return db[_0xbe14('0x28')][_0xbe14('0x40')]({'where':{'CustomReportId':_0x12a9de[_0xbe14('0x43')]['id']}});});}})[_0xbe14('0x22')](respondWithResult(_0x550291,null))['catch'](handleError(_0x550291,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 0c7115c..5de72bf 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 _0xc289=['moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api'];(function(_0xe61c27,_0xc59933){var _0x464922=function(_0x1487a2){while(--_0x1487a2){_0xe61c27['push'](_0xe61c27['shift']());}};_0x464922(++_0xc59933);}(_0xc289,0x14d));var _0x9c28=function(_0x17663e,_0x1c8293){_0x17663e=_0x17663e-0x0;var _0x46b63e=_0xc289[_0x17663e];return _0x46b63e;};'use strict';var _=require('lodash');var util=require(_0x9c28('0x0'));var logger=require(_0x9c28('0x1'))(_0x9c28('0x2'));var moment=require(_0x9c28('0x3'));var BPromise=require(_0x9c28('0x4'));var rp=require(_0x9c28('0x5'));var fs=require('fs');var path=require(_0x9c28('0x6'));var rimraf=require(_0x9c28('0x7'));var config=require('../../config/environment');var attributes=require(_0x9c28('0x8'));module['exports']=function(_0x4c559b,_0x3d0ae8){return _0x4c559b[_0x9c28('0x9')](_0x9c28('0xa'),attributes,{'tableName':_0x9c28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe74f=['api','moment','bluebird','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger'];(function(_0x222b8e,_0x2745ef){var _0x3a05d5=function(_0x20b594){while(--_0x20b594){_0x222b8e['push'](_0x222b8e['shift']());}};_0x3a05d5(++_0x2745ef);}(_0xe74f,0x1a0));var _0xfe74=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0xe74f[_0x5311a1];return _0x2acb9f;};'use strict';var _=require('lodash');var util=require(_0xfe74('0x0'));var logger=require(_0xfe74('0x1'))(_0xfe74('0x2'));var moment=require(_0xfe74('0x3'));var BPromise=require(_0xfe74('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfe74('0x5'));var attributes=require(_0xfe74('0x6'));module[_0xfe74('0x7')]=function(_0x37b49b,_0x5ed627){return _0x37b49b[_0xfe74('0x8')](_0xfe74('0x9'),attributes,{'tableName':_0xfe74('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index c09ee1e..58aac47 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 _0x783b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','ioredis','../../mysqldb'];(function(_0x9b126a,_0x2d0d68){var _0x18cb38=function(_0x1e3de9){while(--_0x1e3de9){_0x9b126a['push'](_0x9b126a['shift']());}};_0x18cb38(++_0x2d0d68);}(_0x783b,0x129));var _0xb783=function(_0x511289,_0x5bbae3){_0x511289=_0x511289-0x0;var _0x52959f=_0x783b[_0x511289];return _0x52959f;};'use strict';var _=require(_0xb783('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb783('0x1'));var db=require(_0xb783('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb783('0x3'))(_0xb783('0x4'));var config=require(_0xb783('0x5'));var jayson=require(_0xb783('0x6'));var client=jayson[_0xb783('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49a0fb,_0x5467e6,_0x401f2d){return new BPromise(function(_0x4f0501,_0xdcc4a0){return client[_0xb783('0x8')](_0x49a0fb,_0x401f2d)[_0xb783('0x9')](function(_0x5176e3){logger[_0xb783('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5467e6,'request\x20sent');logger[_0xb783('0xb')](_0xb783('0xc'),_0x5467e6,_0xb783('0xd'),JSON['stringify'](_0x5176e3));if(_0x5176e3['error']){if(_0x5176e3[_0xb783('0xe')][_0xb783('0xf')]===0x1f4){logger[_0xb783('0xe')](_0xb783('0x10'),_0x5467e6,_0x5176e3[_0xb783('0xe')][_0xb783('0x11')]);return _0xdcc4a0(_0x5176e3[_0xb783('0xe')][_0xb783('0x11')]);}logger[_0xb783('0xe')](_0xb783('0x10'),_0x5467e6,_0x5176e3[_0xb783('0xe')][_0xb783('0x11')]);return _0x4f0501(_0x5176e3['error'][_0xb783('0x11')]);}else{logger[_0xb783('0xa')](_0xb783('0x10'),_0x5467e6,_0xb783('0xd'));_0x4f0501(_0x5176e3[_0xb783('0x12')][_0xb783('0x11')]);}})[_0xb783('0x13')](function(_0x14bdbf){logger[_0xb783('0xe')](_0xb783('0x10'),_0x5467e6,_0x14bdbf);_0xdcc4a0(_0x14bdbf);});});} \ No newline at end of file +var _0x14de=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3a2333,_0x201c5d){var _0x50c8fc=function(_0xbcf917){while(--_0xbcf917){_0x3a2333['push'](_0x3a2333['shift']());}};_0x50c8fc(++_0x201c5d);}(_0x14de,0x1d4));var _0xe14d=function(_0x37f473,_0x11a7f2){_0x37f473=_0x37f473-0x0;var _0x24c9a5=_0x14de[_0x37f473];return _0x24c9a5;};'use strict';var _=require(_0xe14d('0x0'));var util=require(_0xe14d('0x1'));var moment=require(_0xe14d('0x2'));var BPromise=require(_0xe14d('0x3'));var rs=require(_0xe14d('0x4'));var fs=require('fs');var Redis=require(_0xe14d('0x5'));var db=require(_0xe14d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe14d('0x7'))(_0xe14d('0x8'));var config=require(_0xe14d('0x9'));var jayson=require(_0xe14d('0xa'));var client=jayson[_0xe14d('0xb')][_0xe14d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x113641,_0x39ae2a,_0x347a1f){return new BPromise(function(_0x25b9af,_0x33c8d2){return client[_0xe14d('0xd')](_0x113641,_0x347a1f)[_0xe14d('0xe')](function(_0x45f59e){logger[_0xe14d('0xf')](_0xe14d('0x10'),_0x39ae2a,_0xe14d('0x11'));logger[_0xe14d('0x12')](_0xe14d('0x13'),_0x39ae2a,_0xe14d('0x11'),JSON[_0xe14d('0x14')](_0x45f59e));if(_0x45f59e['error']){if(_0x45f59e[_0xe14d('0x15')][_0xe14d('0x16')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x39ae2a,_0x45f59e['error'][_0xe14d('0x17')]);return _0x33c8d2(_0x45f59e[_0xe14d('0x15')]['message']);}logger[_0xe14d('0x15')]('AnalyticFieldReport,\x20%s,\x20%s',_0x39ae2a,_0x45f59e['error'][_0xe14d('0x17')]);return _0x25b9af(_0x45f59e[_0xe14d('0x15')]['message']);}else{logger[_0xe14d('0xf')](_0xe14d('0x10'),_0x39ae2a,_0xe14d('0x11'));_0x25b9af(_0x45f59e[_0xe14d('0x18')]['message']);}})[_0xe14d('0x19')](function(_0x246734){logger[_0xe14d('0x15')](_0xe14d('0x10'),_0x39ae2a,_0x246734);_0x33c8d2(_0x246734);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 53ebe47..0db615c 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(_0x416468,_0x2e7a72){var _0x2ee9b7=function(_0xf354ce){while(--_0xf354ce){_0x416468['push'](_0x416468['shift']());}};_0x2ee9b7(++_0x2e7a72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x345736,_0x3817c2){var _0x36ca70=function(_0x172bac){while(--_0x172bac){_0x345736['push'](_0x345736['shift']());}};_0x36ca70(++_0x3817c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 bda839a..c7078da 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 _0x4157=['exports','STRING','name','sequelize'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0x4157,0xf3));var _0x7415=function(_0x27bdb2,_0x5ef3e0){_0x27bdb2=_0x27bdb2-0x0;var _0x42b1ea=_0x4157[_0x27bdb2];return _0x42b1ea;};'use strict';var Sequelize=require(_0x7415('0x0'));module[_0x7415('0x1')]={'name':{'type':Sequelize[_0x7415('0x2')],'allowNull':![],'unique':_0x7415('0x3')},'table':{'type':Sequelize[_0x7415('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x7415('0x2')]}}; \ No newline at end of file +var _0x8109=['TEXT','sequelize','STRING','name'];(function(_0x3f6df7,_0x96774d){var _0x59254e=function(_0x32d740){while(--_0x32d740){_0x3f6df7['push'](_0x3f6df7['shift']());}};_0x59254e(++_0x96774d);}(_0x8109,0xa9));var _0x9810=function(_0xceb6b5,_0x10684d){_0xceb6b5=_0xceb6b5-0x0;var _0x1128f1=_0x8109[_0xceb6b5];return _0x1128f1;};'use strict';var Sequelize=require(_0x9810('0x0'));module['exports']={'name':{'type':Sequelize[_0x9810('0x1')],'allowNull':![],'unique':_0x9810('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x9810('0x3')]},'description':{'type':Sequelize[_0x9810('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 166cb87..2ad5071 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x1bf7dc,_0x78a460){var _0x4731ad=function(_0x32cc9c){while(--_0x32cc9c){_0x1bf7dc['push'](_0x1bf7dc['shift']());}};_0x4731ad(++_0x78a460);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4c117d,_0xf11d85){_0x4c117d=_0x4c117d-0x0;var _0x1d1319=_0xe5b3[_0x4c117d];return _0x1d1319;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +var _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x84ab,0x12f));var _0xb84a=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x84ab[_0x2074db];return _0x27324c;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d855dce..0220da1 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 _0x3dd6=['request-promise','path','rimraf','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','api','moment','bluebird'];(function(_0xef31d4,_0x373a65){var _0x58442c=function(_0x5ae623){while(--_0x5ae623){_0xef31d4['push'](_0xef31d4['shift']());}};_0x58442c(++_0x373a65);}(_0x3dd6,0xcf));var _0x63dd=function(_0x42f3a5,_0x3a4470){_0x42f3a5=_0x42f3a5-0x0;var _0x1a7d74=_0x3dd6[_0x42f3a5];return _0x1a7d74;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x63dd('0x0'));var moment=require(_0x63dd('0x1'));var BPromise=require(_0x63dd('0x2'));var rp=require(_0x63dd('0x3'));var fs=require('fs');var path=require(_0x63dd('0x4'));var rimraf=require(_0x63dd('0x5'));var config=require('../../config/environment');var attributes=require(_0x63dd('0x6'));module['exports']=function(_0x32bad9,_0xf7e03e){return _0x32bad9[_0x63dd('0x7')](_0x63dd('0x8'),attributes,{'tableName':_0x63dd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4317=['./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53d02c,_0x41729e){var _0x137121=function(_0x1e6cf9){while(--_0x1e6cf9){_0x53d02c['push'](_0x53d02c['shift']());}};_0x137121(++_0x41729e);}(_0x4317,0x7c));var _0x7431=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4317[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var fs=require('fs');var path=require(_0x7431('0x5'));var rimraf=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var attributes=require(_0x7431('0x8'));module['exports']=function(_0x57adc1,_0x1e1f35){return _0x57adc1[_0x7431('0x9')](_0x7431('0xa'),attributes,{'tableName':_0x7431('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index aab7cfb..51a711b 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 _0x29a2=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x535c56,_0x3f5a88){var _0x116087=function(_0x1d8c08){while(--_0x1d8c08){_0x535c56['push'](_0x535c56['shift']());}};_0x116087(++_0x3f5a88);}(_0x29a2,0x1cf));var _0x229a=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0x29a2[_0x2e2681];return _0x368a64;};'use strict';var _=require(_0x229a('0x0'));var util=require(_0x229a('0x1'));var moment=require(_0x229a('0x2'));var BPromise=require(_0x229a('0x3'));var rs=require(_0x229a('0x4'));var fs=require('fs');var Redis=require(_0x229a('0x5'));var db=require(_0x229a('0x6'))['db'];var utils=require(_0x229a('0x7'));var logger=require(_0x229a('0x8'))(_0x229a('0x9'));var config=require(_0x229a('0xa'));var jayson=require(_0x229a('0xb'));var client=jayson[_0x229a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4c44,_0x32c8ee,_0x37fcfe){return new BPromise(function(_0x745f5,_0x45b173){return client['request'](_0x4d4c44,_0x37fcfe)['then'](function(_0x2a60c5){logger[_0x229a('0xd')](_0x229a('0xe'),_0x32c8ee,_0x229a('0xf'));logger[_0x229a('0x10')](_0x229a('0x11'),_0x32c8ee,_0x229a('0xf'),JSON[_0x229a('0x12')](_0x2a60c5));if(_0x2a60c5['error']){if(_0x2a60c5['error'][_0x229a('0x13')]===0x1f4){logger[_0x229a('0x14')](_0x229a('0xe'),_0x32c8ee,_0x2a60c5['error'][_0x229a('0x15')]);return _0x45b173(_0x2a60c5['error']['message']);}logger[_0x229a('0x14')](_0x229a('0xe'),_0x32c8ee,_0x2a60c5[_0x229a('0x14')][_0x229a('0x15')]);return _0x745f5(_0x2a60c5['error']['message']);}else{logger[_0x229a('0xd')](_0x229a('0xe'),_0x32c8ee,_0x229a('0xf'));_0x745f5(_0x2a60c5[_0x229a('0x16')][_0x229a('0x15')]);}})['catch'](function(_0x322c62){logger[_0x229a('0x14')](_0x229a('0xe'),_0x32c8ee,_0x322c62);_0x45b173(_0x322c62);});});} \ No newline at end of file +var _0xfae6=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x460f40,_0x1149a4){var _0x3c0ac8=function(_0x5af066){while(--_0x5af066){_0x460f40['push'](_0x460f40['shift']());}};_0x3c0ac8(++_0x1149a4);}(_0xfae6,0x14b));var _0x6fae=function(_0x546ef3,_0x1e7668){_0x546ef3=_0x546ef3-0x0;var _0x2f09cf=_0xfae6[_0x546ef3];return _0x2f09cf;};'use strict';var _=require(_0x6fae('0x0'));var util=require(_0x6fae('0x1'));var moment=require(_0x6fae('0x2'));var BPromise=require(_0x6fae('0x3'));var rs=require(_0x6fae('0x4'));var fs=require('fs');var Redis=require(_0x6fae('0x5'));var db=require(_0x6fae('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6fae('0x7'))('rpc');var config=require(_0x6fae('0x8'));var jayson=require(_0x6fae('0x9'));var client=jayson[_0x6fae('0xa')][_0x6fae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d77f0,_0x53faa7,_0x4ede8c){return new BPromise(function(_0x11e2c8,_0x1a5e93){return client[_0x6fae('0xc')](_0x4d77f0,_0x4ede8c)['then'](function(_0x28ef91){logger[_0x6fae('0xd')](_0x6fae('0xe'),_0x53faa7,_0x6fae('0xf'));logger[_0x6fae('0x10')](_0x6fae('0x11'),_0x53faa7,_0x6fae('0xf'),JSON[_0x6fae('0x12')](_0x28ef91));if(_0x28ef91['error']){if(_0x28ef91[_0x6fae('0x13')][_0x6fae('0x14')]===0x1f4){logger[_0x6fae('0x13')](_0x6fae('0xe'),_0x53faa7,_0x28ef91['error'][_0x6fae('0x15')]);return _0x1a5e93(_0x28ef91[_0x6fae('0x13')][_0x6fae('0x15')]);}logger[_0x6fae('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x53faa7,_0x28ef91[_0x6fae('0x13')][_0x6fae('0x15')]);return _0x11e2c8(_0x28ef91[_0x6fae('0x13')]['message']);}else{logger['info'](_0x6fae('0xe'),_0x53faa7,_0x6fae('0xf'));_0x11e2c8(_0x28ef91[_0x6fae('0x16')][_0x6fae('0x15')]);}})[_0x6fae('0x17')](function(_0xfcf761){logger[_0x6fae('0x13')](_0x6fae('0xe'),_0x53faa7,_0xfcf761);_0x1a5e93(_0xfcf761);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 1e6b0f3..fdbf9ae 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 _0xbc8d=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0xebb002,_0x12eade){var _0x512bab=function(_0x296b88){while(--_0x296b88){_0xebb002['push'](_0xebb002['shift']());}};_0x512bab(++_0x12eade);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdbc8('0x0'));var util=require('util');var path=require(_0xdbc8('0x1'));var timeout=require(_0xdbc8('0x2'));var express=require(_0xdbc8('0x3'));var router=express[_0xdbc8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdbc8('0x5'));var interaction=require(_0xdbc8('0x6'));var config=require(_0xdbc8('0x7'));var controller=require('./analyticMetric.controller');router[_0xdbc8('0x8')]('/',auth[_0xdbc8('0x9')](),controller[_0xdbc8('0xa')]);router['get'](_0xdbc8('0xb'),auth['isAuthenticated'](),controller[_0xdbc8('0xc')]);router[_0xdbc8('0xd')]('/',auth['isAuthenticated'](),controller[_0xdbc8('0xe')]);router[_0xdbc8('0xf')](_0xdbc8('0xb'),auth[_0xdbc8('0x9')](),controller[_0xdbc8('0x10')]);router[_0xdbc8('0x11')](_0xdbc8('0xb'),auth[_0xdbc8('0x9')](),controller[_0xdbc8('0x12')]);module[_0xdbc8('0x13')]=router; \ No newline at end of file +var _0x49e5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x15d143,_0x1fa379){var _0x4464d9=function(_0x2a92c0){while(--_0x2a92c0){_0x15d143['push'](_0x15d143['shift']());}};_0x4464d9(++_0x1fa379);}(_0x49e5,0x71));var _0x549e=function(_0x35495a,_0x3b8514){_0x35495a=_0x35495a-0x0;var _0x25105b=_0x49e5[_0x35495a];return _0x25105b;};'use strict';var multer=require(_0x549e('0x0'));var util=require(_0x549e('0x1'));var path=require(_0x549e('0x2'));var timeout=require(_0x549e('0x3'));var express=require(_0x549e('0x4'));var router=express['Router']();var fs_extra=require(_0x549e('0x5'));var auth=require(_0x549e('0x6'));var interaction=require(_0x549e('0x7'));var config=require(_0x549e('0x8'));var controller=require(_0x549e('0x9'));router['get']('/',auth[_0x549e('0xa')](),controller['index']);router['get'](_0x549e('0xb'),auth[_0x549e('0xa')](),controller[_0x549e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x549e('0xd')](_0x549e('0xb'),auth[_0x549e('0xa')](),controller[_0x549e('0xe')]);router[_0x549e('0xf')](_0x549e('0xb'),auth['isAuthenticated'](),controller[_0x549e('0x10')]);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 9e64afb..5b4a4a3 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xb49d=['exports','TEXT','sequelize'];(function(_0xec9926,_0x2ccd0b){var _0xdb9333=function(_0x334777){while(--_0x334777){_0xec9926['push'](_0xec9926['shift']());}};_0xdb9333(++_0x2ccd0b);}(_0xb49d,0x17f));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdb49('0x0'));module[_0xdb49('0x1')]={'tree':{'type':Sequelize[_0xdb49('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 50a6299..b065f29 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 _0xa91b=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','AnalyticTreeReport','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','intersection','includeAll','find','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x5e6f73,_0x3f27d8){var _0x432614=function(_0x56e42d){while(--_0x56e42d){_0x5e6f73['push'](_0x5e6f73['shift']());}};_0x432614(++_0x3f27d8);}(_0xa91b,0x84));var _0xba91=function(_0x2ff581,_0x5abe03){_0x2ff581=_0x2ff581-0x0;var _0x2d9a9c=_0xa91b[_0x2ff581];return _0x2d9a9c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba91('0x0'));var zipdir=require(_0xba91('0x1'));var jsonpatch=require(_0xba91('0x2'));var rp=require(_0xba91('0x3'));var moment=require(_0xba91('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba91('0x5'));var path=require(_0xba91('0x6'));var sox=require(_0xba91('0x7'));var csv=require(_0xba91('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba91('0x9'));var _=require(_0xba91('0xa'));var squel=require(_0xba91('0xb'));var crypto=require(_0xba91('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xba91('0xd'));var toCsv=require(_0xba91('0x8'));var querystring=require(_0xba91('0xe'));var Papa=require(_0xba91('0xf'));var Redis=require(_0xba91('0x10'));var authService=require(_0xba91('0x11'));var qs=require(_0xba91('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba91('0x13'));var logger=require(_0xba91('0x14'))(_0xba91('0x15'));var utils=require(_0xba91('0x16'));var config=require(_0xba91('0x17'));var licenseUtil=require(_0xba91('0x18'));var db=require(_0xba91('0x19'))['db'];function respondWithStatusCode(_0x3bcad7,_0x3a3595){_0x3a3595=_0x3a3595||0xcc;return function(_0x6a5e45){if(_0x6a5e45){return _0x3bcad7[_0xba91('0x1a')](_0x3a3595);}return _0x3bcad7[_0xba91('0x1b')](_0x3a3595)[_0xba91('0x1c')]();};}function respondWithResult(_0x5205e0,_0x3ed609){_0x3ed609=_0x3ed609||0xc8;return function(_0x435654){if(_0x435654){return _0x5205e0[_0xba91('0x1b')](_0x3ed609)[_0xba91('0x1d')](_0x435654);}};}function respondWithFilteredResult(_0x14d7d6,_0x138e1f){return function(_0x157f2a){if(_0x157f2a){var _0x1e4fa1=typeof _0x138e1f[_0xba91('0x1e')]===_0xba91('0x1f')&&typeof _0x138e1f[_0xba91('0x20')]===_0xba91('0x1f');var _0x2ac088=_0x157f2a[_0xba91('0x21')];var _0x26c1b9=_0x1e4fa1?0x0:_0x138e1f[_0xba91('0x1e')];var _0x49e4fc=_0x1e4fa1?_0x157f2a['count']:_0x138e1f[_0xba91('0x1e')]+_0x138e1f['limit'];var _0x1a3fd9;if(_0x49e4fc>=_0x2ac088){_0x49e4fc=_0x2ac088;_0x1a3fd9=0xc8;}else{_0x1a3fd9=0xce;}_0x14d7d6['status'](_0x1a3fd9);return _0x14d7d6[_0xba91('0x22')](_0xba91('0x23'),_0x26c1b9+'-'+_0x49e4fc+'/'+_0x2ac088)[_0xba91('0x1d')](_0x157f2a);}return null;};}function patchUpdates(_0x49705d){return function(_0x1c76c9){try{jsonpatch[_0xba91('0x24')](_0x1c76c9,_0x49705d,!![]);}catch(_0x2ca12b){return BPromise[_0xba91('0x25')](_0x2ca12b);}return _0x1c76c9[_0xba91('0x26')]();};}function saveUpdates(_0x1d52c5,_0x5c4a24){return function(_0x45bc7d){if(_0x45bc7d){return _0x45bc7d[_0xba91('0x27')](_0x1d52c5)[_0xba91('0x28')](function(_0x3d4348){return _0x3d4348;});}return null;};}function removeEntity(_0x2e551e,_0x13e2bb){return function(_0x48ce1f){if(_0x48ce1f){return _0x48ce1f[_0xba91('0x29')]()[_0xba91('0x28')](function(){_0x2e551e[_0xba91('0x1b')](0xcc)[_0xba91('0x1c')]();});}};}function handleEntityNotFound(_0x183bec,_0x4bdfc3){return function(_0x532fa7){if(!_0x532fa7){_0x183bec[_0xba91('0x1a')](0x194);}return _0x532fa7;};}function handleError(_0x54fc1b,_0x2d076a){_0x2d076a=_0x2d076a||0x1f4;return function(_0xe4b4da){logger[_0xba91('0x2a')](_0xe4b4da[_0xba91('0x2b')]);if(_0xe4b4da[_0xba91('0x2c')]){delete _0xe4b4da[_0xba91('0x2c')];}_0x54fc1b['status'](_0x2d076a)[_0xba91('0x2d')](_0xe4b4da);};}exports['index']=function(_0x25818c,_0x54aa3b){var _0x45a03f={},_0xb00447={},_0x4a01df={'count':0x0,'rows':[]};var _0x56acb0=_[_0xba91('0x2e')](db[_0xba91('0x2f')]['rawAttributes'],function(_0x2af7a0){return{'name':_0x2af7a0[_0xba91('0x30')],'type':_0x2af7a0[_0xba91('0x31')][_0xba91('0x32')]};});_0xb00447['model']=_[_0xba91('0x2e')](_0x56acb0,'name');_0xb00447[_0xba91('0x33')]=_[_0xba91('0x34')](_0x25818c[_0xba91('0x33')]);_0xb00447[_0xba91('0x35')]=_['intersection'](_0xb00447[_0xba91('0x36')],_0xb00447['query']);_0x45a03f[_0xba91('0x37')]=_['intersection'](_0xb00447[_0xba91('0x36')],qs[_0xba91('0x38')](_0x25818c[_0xba91('0x33')][_0xba91('0x38')]));_0x45a03f[_0xba91('0x37')]=_0x45a03f[_0xba91('0x37')][_0xba91('0x39')]?_0x45a03f[_0xba91('0x37')]:_0xb00447[_0xba91('0x36')];if(!_0x25818c[_0xba91('0x33')][_0xba91('0x3a')](_0xba91('0x3b'))){_0x45a03f[_0xba91('0x20')]=qs['limit'](_0x25818c[_0xba91('0x33')][_0xba91('0x20')]);_0x45a03f[_0xba91('0x1e')]=qs['offset'](_0x25818c[_0xba91('0x33')]['offset']);}_0x45a03f[_0xba91('0x3c')]=qs['sort'](_0x25818c[_0xba91('0x33')][_0xba91('0x3d')]);_0x45a03f[_0xba91('0x3e')]=qs['filters'](_[_0xba91('0x3f')](_0x25818c[_0xba91('0x33')],_0xb00447[_0xba91('0x35')]),_0x56acb0);if(_0x25818c[_0xba91('0x33')][_0xba91('0x40')]){_0x45a03f[_0xba91('0x3e')]=_[_0xba91('0x41')](_0x45a03f[_0xba91('0x3e')],{'$or':_[_0xba91('0x2e')](_0x56acb0,function(_0x4a753b){if(_0x4a753b['type']!==_0xba91('0x42')){var _0xb2a704={};_0xb2a704[_0x4a753b[_0xba91('0x2c')]]={'$like':'%'+_0x25818c[_0xba91('0x33')][_0xba91('0x40')]+'%'};return _0xb2a704;}})});}_0x45a03f=_[_0xba91('0x41')]({},_0x45a03f,_0x25818c[_0xba91('0x43')]);var _0x57f554={'where':_0x45a03f[_0xba91('0x3e')]};return db[_0xba91('0x2f')]['count'](_0x57f554)['then'](function(_0x159108){_0x4a01df[_0xba91('0x21')]=_0x159108;if(_0x25818c[_0xba91('0x33')]['includeAll']){_0x45a03f[_0xba91('0x44')]=[{'all':!![]}];}return db[_0xba91('0x2f')]['findAll'](_0x45a03f);})['then'](function(_0x37381d){_0x4a01df['rows']=_0x37381d;return _0x4a01df;})[_0xba91('0x28')](respondWithFilteredResult(_0x54aa3b,_0x45a03f))[_0xba91('0x45')](handleError(_0x54aa3b,null));};exports[_0xba91('0x46')]=function(_0x376d66,_0x22b523){var _0x4d7ffd={'raw':!![],'where':{'id':_0x376d66[_0xba91('0x47')]['id']}},_0xb793ac={};_0xb793ac[_0xba91('0x36')]=_[_0xba91('0x34')](db[_0xba91('0x2f')]['rawAttributes']);_0xb793ac[_0xba91('0x33')]=_[_0xba91('0x34')](_0x376d66['query']);_0xb793ac[_0xba91('0x35')]=_[_0xba91('0x48')](_0xb793ac[_0xba91('0x36')],_0xb793ac[_0xba91('0x33')]);_0x4d7ffd[_0xba91('0x37')]=_['intersection'](_0xb793ac[_0xba91('0x36')],qs[_0xba91('0x38')](_0x376d66[_0xba91('0x33')]['fields']));_0x4d7ffd[_0xba91('0x37')]=_0x4d7ffd['attributes'][_0xba91('0x39')]?_0x4d7ffd['attributes']:_0xb793ac[_0xba91('0x36')];if(_0x376d66['query'][_0xba91('0x49')]){_0x4d7ffd['include']=[{'all':!![]}];}_0x4d7ffd=_['merge']({},_0x4d7ffd,_0x376d66['options']);return db[_0xba91('0x2f')][_0xba91('0x4a')](_0x4d7ffd)[_0xba91('0x28')](handleEntityNotFound(_0x22b523,null))[_0xba91('0x28')](respondWithResult(_0x22b523,null))[_0xba91('0x45')](handleError(_0x22b523,null));};exports['create']=function(_0x32004a,_0x4de62c){return db[_0xba91('0x2f')]['create'](_0x32004a[_0xba91('0x4b')],{})[_0xba91('0x28')](respondWithResult(_0x4de62c,0xc9))[_0xba91('0x45')](handleError(_0x4de62c,null));};exports[_0xba91('0x27')]=function(_0x43b1ef,_0x1b1957){if(_0x43b1ef['body']['id']){delete _0x43b1ef[_0xba91('0x4b')]['id'];}return db[_0xba91('0x2f')][_0xba91('0x4a')]({'where':{'id':_0x43b1ef['params']['id']}})['then'](handleEntityNotFound(_0x1b1957,null))[_0xba91('0x28')](saveUpdates(_0x43b1ef['body'],null))['then'](respondWithResult(_0x1b1957,null))[_0xba91('0x45')](handleError(_0x1b1957,null));};exports[_0xba91('0x29')]=function(_0x1c8304,_0x127178){return db['AnalyticTreeReport'][_0xba91('0x4a')]({'where':{'id':_0x1c8304['params']['id']}})[_0xba91('0x28')](handleEntityNotFound(_0x127178,null))[_0xba91('0x28')](removeEntity(_0x127178,null))[_0xba91('0x45')](handleError(_0x127178,null));}; \ No newline at end of file +var _0xbd46=['catch','show','params','include','create','body','update','find','rimraf','zip-dir','fast-json-patch','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/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','save','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xbd46,0x9c));var _0x6bd4=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0xbd46[_0x509273];return _0x38ef40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6bd4('0x0'));var zipdir=require(_0x6bd4('0x1'));var jsonpatch=require(_0x6bd4('0x2'));var rp=require('request-promise');var moment=require(_0x6bd4('0x3'));var BPromise=require(_0x6bd4('0x4'));var Mustache=require(_0x6bd4('0x5'));var util=require('util');var path=require(_0x6bd4('0x6'));var sox=require(_0x6bd4('0x7'));var csv=require(_0x6bd4('0x8'));var ejs=require(_0x6bd4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6bd4('0xa'));var squel=require('squel');var crypto=require(_0x6bd4('0xb'));var jsforce=require(_0x6bd4('0xc'));var deskjs=require(_0x6bd4('0xd'));var toCsv=require(_0x6bd4('0x8'));var querystring=require(_0x6bd4('0xe'));var Papa=require(_0x6bd4('0xf'));var Redis=require(_0x6bd4('0x10'));var authService=require(_0x6bd4('0x11'));var qs=require(_0x6bd4('0x12'));var as=require(_0x6bd4('0x13'));var hardwareService=require(_0x6bd4('0x14'));var logger=require(_0x6bd4('0x15'))(_0x6bd4('0x16'));var utils=require('../../config/utils');var config=require(_0x6bd4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6bd4('0x18'))['db'];function respondWithStatusCode(_0x257bf2,_0x5d069e){_0x5d069e=_0x5d069e||0xcc;return function(_0x5636c9){if(_0x5636c9){return _0x257bf2[_0x6bd4('0x19')](_0x5d069e);}return _0x257bf2[_0x6bd4('0x1a')](_0x5d069e)[_0x6bd4('0x1b')]();};}function respondWithResult(_0x1d3a43,_0x53ba2a){_0x53ba2a=_0x53ba2a||0xc8;return function(_0x465d58){if(_0x465d58){return _0x1d3a43[_0x6bd4('0x1a')](_0x53ba2a)['json'](_0x465d58);}};}function respondWithFilteredResult(_0x3f52c8,_0x4797b7){return function(_0x2ae5a4){if(_0x2ae5a4){var _0x381c52=typeof _0x4797b7[_0x6bd4('0x1c')]===_0x6bd4('0x1d')&&typeof _0x4797b7[_0x6bd4('0x1e')]===_0x6bd4('0x1d');var _0x19a58a=_0x2ae5a4['count'];var _0x43d8f8=_0x381c52?0x0:_0x4797b7['offset'];var _0x435524=_0x381c52?_0x2ae5a4[_0x6bd4('0x1f')]:_0x4797b7[_0x6bd4('0x1c')]+_0x4797b7[_0x6bd4('0x1e')];var _0x1a8e43;if(_0x435524>=_0x19a58a){_0x435524=_0x19a58a;_0x1a8e43=0xc8;}else{_0x1a8e43=0xce;}_0x3f52c8[_0x6bd4('0x1a')](_0x1a8e43);return _0x3f52c8[_0x6bd4('0x20')]('Content-Range',_0x43d8f8+'-'+_0x435524+'/'+_0x19a58a)[_0x6bd4('0x21')](_0x2ae5a4);}return null;};}function patchUpdates(_0x42afb8){return function(_0x51054d){try{jsonpatch['apply'](_0x51054d,_0x42afb8,!![]);}catch(_0x50a7ec){return BPromise['reject'](_0x50a7ec);}return _0x51054d[_0x6bd4('0x22')]();};}function saveUpdates(_0x5e4714,_0x4b4ec7){return function(_0x11b865){if(_0x11b865){return _0x11b865['update'](_0x5e4714)[_0x6bd4('0x23')](function(_0x33fe1e){return _0x33fe1e;});}return null;};}function removeEntity(_0x50d8b3,_0x48c0d8){return function(_0x1ec4e4){if(_0x1ec4e4){return _0x1ec4e4[_0x6bd4('0x24')]()[_0x6bd4('0x23')](function(){_0x50d8b3[_0x6bd4('0x1a')](0xcc)[_0x6bd4('0x1b')]();});}};}function handleEntityNotFound(_0x427c22,_0x5ad9de){return function(_0x22c603){if(!_0x22c603){_0x427c22[_0x6bd4('0x19')](0x194);}return _0x22c603;};}function handleError(_0x14022f,_0x289884){_0x289884=_0x289884||0x1f4;return function(_0x3ec7db){logger[_0x6bd4('0x25')](_0x3ec7db[_0x6bd4('0x26')]);if(_0x3ec7db[_0x6bd4('0x27')]){delete _0x3ec7db['name'];}_0x14022f[_0x6bd4('0x1a')](_0x289884)[_0x6bd4('0x28')](_0x3ec7db);};}exports[_0x6bd4('0x29')]=function(_0x57aa91,_0x56e3c1){var _0x3f4e63={},_0x157326={},_0x51c0ff={'count':0x0,'rows':[]};var _0x25c051=_[_0x6bd4('0x2a')](db[_0x6bd4('0x2b')][_0x6bd4('0x2c')],function(_0x4fa01b){return{'name':_0x4fa01b[_0x6bd4('0x2d')],'type':_0x4fa01b[_0x6bd4('0x2e')][_0x6bd4('0x2f')]};});_0x157326[_0x6bd4('0x30')]=_[_0x6bd4('0x2a')](_0x25c051,'name');_0x157326[_0x6bd4('0x31')]=_[_0x6bd4('0x32')](_0x57aa91['query']);_0x157326['filters']=_[_0x6bd4('0x33')](_0x157326[_0x6bd4('0x30')],_0x157326[_0x6bd4('0x31')]);_0x3f4e63[_0x6bd4('0x34')]=_[_0x6bd4('0x33')](_0x157326['model'],qs[_0x6bd4('0x35')](_0x57aa91['query'][_0x6bd4('0x35')]));_0x3f4e63[_0x6bd4('0x34')]=_0x3f4e63[_0x6bd4('0x34')][_0x6bd4('0x36')]?_0x3f4e63[_0x6bd4('0x34')]:_0x157326[_0x6bd4('0x30')];if(!_0x57aa91[_0x6bd4('0x31')]['hasOwnProperty'](_0x6bd4('0x37'))){_0x3f4e63[_0x6bd4('0x1e')]=qs['limit'](_0x57aa91[_0x6bd4('0x31')][_0x6bd4('0x1e')]);_0x3f4e63[_0x6bd4('0x1c')]=qs['offset'](_0x57aa91['query']['offset']);}_0x3f4e63[_0x6bd4('0x38')]=qs['sort'](_0x57aa91[_0x6bd4('0x31')]['sort']);_0x3f4e63[_0x6bd4('0x39')]=qs[_0x6bd4('0x3a')](_[_0x6bd4('0x3b')](_0x57aa91[_0x6bd4('0x31')],_0x157326[_0x6bd4('0x3a')]),_0x25c051);if(_0x57aa91[_0x6bd4('0x31')][_0x6bd4('0x3c')]){_0x3f4e63[_0x6bd4('0x39')]=_[_0x6bd4('0x3d')](_0x3f4e63[_0x6bd4('0x39')],{'$or':_[_0x6bd4('0x2a')](_0x25c051,function(_0x10eb01){if(_0x10eb01['type']!==_0x6bd4('0x3e')){var _0x13c0e4={};_0x13c0e4[_0x10eb01['name']]={'$like':'%'+_0x57aa91[_0x6bd4('0x31')][_0x6bd4('0x3c')]+'%'};return _0x13c0e4;}})});}_0x3f4e63=_[_0x6bd4('0x3d')]({},_0x3f4e63,_0x57aa91[_0x6bd4('0x3f')]);var _0x593cf5={'where':_0x3f4e63[_0x6bd4('0x39')]};return db['AnalyticTreeReport'][_0x6bd4('0x1f')](_0x593cf5)[_0x6bd4('0x23')](function(_0x1ae61c){_0x51c0ff[_0x6bd4('0x1f')]=_0x1ae61c;if(_0x57aa91[_0x6bd4('0x31')][_0x6bd4('0x40')]){_0x3f4e63['include']=[{'all':!![]}];}return db[_0x6bd4('0x2b')]['findAll'](_0x3f4e63);})[_0x6bd4('0x23')](function(_0x3db5fe){_0x51c0ff[_0x6bd4('0x41')]=_0x3db5fe;return _0x51c0ff;})[_0x6bd4('0x23')](respondWithFilteredResult(_0x56e3c1,_0x3f4e63))[_0x6bd4('0x42')](handleError(_0x56e3c1,null));};exports[_0x6bd4('0x43')]=function(_0x467c46,_0x7a015e){var _0x22e767={'raw':!![],'where':{'id':_0x467c46[_0x6bd4('0x44')]['id']}},_0x5318a2={};_0x5318a2['model']=_['keys'](db[_0x6bd4('0x2b')][_0x6bd4('0x2c')]);_0x5318a2[_0x6bd4('0x31')]=_[_0x6bd4('0x32')](_0x467c46[_0x6bd4('0x31')]);_0x5318a2[_0x6bd4('0x3a')]=_[_0x6bd4('0x33')](_0x5318a2[_0x6bd4('0x30')],_0x5318a2[_0x6bd4('0x31')]);_0x22e767[_0x6bd4('0x34')]=_[_0x6bd4('0x33')](_0x5318a2[_0x6bd4('0x30')],qs[_0x6bd4('0x35')](_0x467c46[_0x6bd4('0x31')][_0x6bd4('0x35')]));_0x22e767['attributes']=_0x22e767[_0x6bd4('0x34')]['length']?_0x22e767[_0x6bd4('0x34')]:_0x5318a2[_0x6bd4('0x30')];if(_0x467c46[_0x6bd4('0x31')]['includeAll']){_0x22e767[_0x6bd4('0x45')]=[{'all':!![]}];}_0x22e767=_[_0x6bd4('0x3d')]({},_0x22e767,_0x467c46[_0x6bd4('0x3f')]);return db['AnalyticTreeReport']['find'](_0x22e767)[_0x6bd4('0x23')](handleEntityNotFound(_0x7a015e,null))[_0x6bd4('0x23')](respondWithResult(_0x7a015e,null))['catch'](handleError(_0x7a015e,null));};exports[_0x6bd4('0x46')]=function(_0x5186a6,_0x39193d){return db[_0x6bd4('0x2b')][_0x6bd4('0x46')](_0x5186a6[_0x6bd4('0x47')],{})[_0x6bd4('0x23')](respondWithResult(_0x39193d,0xc9))[_0x6bd4('0x42')](handleError(_0x39193d,null));};exports[_0x6bd4('0x48')]=function(_0x20f29c,_0xf815a9){if(_0x20f29c['body']['id']){delete _0x20f29c[_0x6bd4('0x47')]['id'];}return db[_0x6bd4('0x2b')]['find']({'where':{'id':_0x20f29c['params']['id']}})[_0x6bd4('0x23')](handleEntityNotFound(_0xf815a9,null))[_0x6bd4('0x23')](saveUpdates(_0x20f29c[_0x6bd4('0x47')],null))['then'](respondWithResult(_0xf815a9,null))[_0x6bd4('0x42')](handleError(_0xf815a9,null));};exports[_0x6bd4('0x24')]=function(_0x4bd1c,_0x2ae7d9){return db[_0x6bd4('0x2b')][_0x6bd4('0x49')]({'where':{'id':_0x4bd1c[_0x6bd4('0x44')]['id']}})[_0x6bd4('0x23')](handleEntityNotFound(_0x2ae7d9,null))['then'](removeEntity(_0x2ae7d9,null))['catch'](handleError(_0x2ae7d9,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index b8b343c..ec2d63c 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 _0x2e9a=['path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','util','api','moment','request-promise'];(function(_0x2dc1b3,_0x320a7a){var _0x34024f=function(_0x41ffb9){while(--_0x41ffb9){_0x2dc1b3['push'](_0x2dc1b3['shift']());}};_0x34024f(++_0x320a7a);}(_0x2e9a,0x151));var _0xa2e9=function(_0x5a1f3c,_0x991295){_0x5a1f3c=_0x5a1f3c-0x0;var _0x56fac6=_0x2e9a[_0x5a1f3c];return _0x56fac6;};'use strict';var _=require('lodash');var util=require(_0xa2e9('0x0'));var logger=require('../../config/logger')(_0xa2e9('0x1'));var moment=require(_0xa2e9('0x2'));var BPromise=require('bluebird');var rp=require(_0xa2e9('0x3'));var fs=require('fs');var path=require(_0xa2e9('0x4'));var rimraf=require(_0xa2e9('0x5'));var config=require(_0xa2e9('0x6'));var attributes=require(_0xa2e9('0x7'));module[_0xa2e9('0x8')]=function(_0x4cfd91,_0xc484a2){return _0x4cfd91['define'](_0xa2e9('0x9'),attributes,{'tableName':_0xa2e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2028=['rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x461e08,_0x32ea15){var _0x19a69c=function(_0x571759){while(--_0x571759){_0x461e08['push'](_0x461e08['shift']());}};_0x19a69c(++_0x32ea15);}(_0x2028,0x156));var _0x8202=function(_0x2d3510,_0x737bd1){_0x2d3510=_0x2d3510-0x0;var _0x55178b=_0x2028[_0x2d3510];return _0x55178b;};'use strict';var _=require(_0x8202('0x0'));var util=require(_0x8202('0x1'));var logger=require(_0x8202('0x2'))(_0x8202('0x3'));var moment=require(_0x8202('0x4'));var BPromise=require(_0x8202('0x5'));var rp=require(_0x8202('0x6'));var fs=require('fs');var path=require(_0x8202('0x7'));var rimraf=require(_0x8202('0x8'));var config=require(_0x8202('0x9'));var attributes=require(_0x8202('0xa'));module['exports']=function(_0x3e45a6,_0xa28abf){return _0x3e45a6[_0x8202('0xb')](_0x8202('0xc'),attributes,{'tableName':_0x8202('0xd'),'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 73b5748..4b5fef3 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 _0x7a54=['info','AnalyticTreeReport,\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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x2314f6,_0xd2884a){_0x2314f6=_0x2314f6-0x0;var _0x4d672d=_0x7a54[_0x2314f6];return _0x4d672d;};'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')]('AnalyticTreeReport,\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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x28a83b,_0x590948){var _0x55b99d=function(_0x2cf03d){while(--_0x2cf03d){_0x28a83b['push'](_0x28a83b['shift']());}};_0x55b99d(++_0x590948);}(_0x2ef3,0xba));var _0x32ef=function(_0x32dd43,_0x46e8c3){_0x32dd43=_0x32dd43-0x0;var _0x3b34c4=_0x2ef3[_0x32dd43];return _0x3b34c4;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 1259396..f465a73 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 _0x56ab=['destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x56ab,0x1d2));var _0xb56a=function(_0x4422e6,_0x163d34){_0x4422e6=_0x4422e6-0x0;var _0x1ac9eb=_0x56ab[_0x4422e6];return _0x1ac9eb;};'use strict';var multer=require(_0xb56a('0x0'));var util=require(_0xb56a('0x1'));var path=require(_0xb56a('0x2'));var timeout=require(_0xb56a('0x3'));var express=require('express');var router=express[_0xb56a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb56a('0x5'));var interaction=require(_0xb56a('0x6'));var config=require(_0xb56a('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xb56a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb56a('0x8')](_0xb56a('0x9'),auth[_0xb56a('0xa')](),controller['show']);router[_0xb56a('0xb')]('/',auth['isAuthenticated'](),controller[_0xb56a('0xc')]);router[_0xb56a('0xd')](_0xb56a('0x9'),auth[_0xb56a('0xa')](),controller['update']);router['delete']('/:id',auth[_0xb56a('0xa')](),controller[_0xb56a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x88e3=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','show','post'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x88e3,0x193));var _0x388e=function(_0x598408,_0x5e6f74){_0x598408=_0x598408-0x0;var _0x560720=_0x88e3[_0x598408];return _0x560720;};'use strict';var multer=require(_0x388e('0x0'));var util=require(_0x388e('0x1'));var path=require(_0x388e('0x2'));var timeout=require(_0x388e('0x3'));var express=require(_0x388e('0x4'));var router=express[_0x388e('0x5')]();var fs_extra=require(_0x388e('0x6'));var auth=require(_0x388e('0x7'));var interaction=require(_0x388e('0x8'));var config=require('../../config/environment');var controller=require(_0x388e('0x9'));router[_0x388e('0xa')]('/',auth[_0x388e('0xb')](),controller[_0x388e('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x388e('0xd')]);router[_0x388e('0xe')]('/',auth[_0x388e('0xb')](),controller[_0x388e('0xf')]);router[_0x388e('0x10')](_0x388e('0x11'),auth[_0x388e('0xb')](),controller[_0x388e('0x12')]);router[_0x388e('0x13')](_0x388e('0x11'),auth[_0x388e('0xb')](),controller[_0x388e('0x14')]);module[_0x388e('0x15')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index d90cefe..a60ac3f 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 _0xba33=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba33,0xf1));var _0x3ba3=function(_0x5297a,_0x3e8002){_0x5297a=_0x5297a-0x0;var _0x62508c=_0xba33[_0x5297a];return _0x62508c;};'use strict';var Sequelize=require(_0x3ba3('0x0'));module[_0x3ba3('0x1')]={'name':{'type':Sequelize[_0x3ba3('0x2')]},'basename':{'type':Sequelize[_0x3ba3('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xba6c=['STRING','sequelize'];(function(_0x39338d,_0x19b64b){var _0x273a6a=function(_0x15a7bf){while(--_0x15a7bf){_0x39338d['push'](_0x39338d['shift']());}};_0x273a6a(++_0x19b64b);}(_0xba6c,0x113));var _0xcba6=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0xba6c[_0x271060];return _0x40540b;};'use strict';var Sequelize=require(_0xcba6('0x0'));module['exports']={'name':{'type':Sequelize[_0xcba6('0x1')]},'basename':{'type':Sequelize[_0xcba6('0x1')]},'type':{'type':Sequelize[_0xcba6('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index cf9e753..9fe73fa 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 _0xc6e7=['limit','count','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','keys','includeAll','options','find','catch','clone','get','createdAt','updatedAt','body','create','params','originalname','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','root','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x47b7b2,_0x11acff){var _0x2dc3ca=function(_0x1a7dee){while(--_0x1a7dee){_0x47b7b2['push'](_0x47b7b2['shift']());}};_0x2dc3ca(++_0x11acff);}(_0xc6e7,0x93));var _0x7c6e=function(_0x514404,_0x30c948){_0x514404=_0x514404-0x0;var _0x1fc062=_0xc6e7[_0x514404];return _0x1fc062;};'use strict';var emlformat=require(_0x7c6e('0x0'));var rimraf=require(_0x7c6e('0x1'));var zipdir=require(_0x7c6e('0x2'));var jsonpatch=require(_0x7c6e('0x3'));var rp=require('request-promise');var moment=require(_0x7c6e('0x4'));var BPromise=require(_0x7c6e('0x5'));var Mustache=require('mustache');var util=require(_0x7c6e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7c6e('0x7'));var ejs=require(_0x7c6e('0x8'));var fs=require('fs');var fs_extra=require(_0x7c6e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7c6e('0xa'));var jsforce=require(_0x7c6e('0xb'));var deskjs=require(_0x7c6e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7c6e('0xd'));var Papa=require(_0x7c6e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c6e('0xf'));var as=require(_0x7c6e('0x10'));var hardwareService=require(_0x7c6e('0x11'));var logger=require(_0x7c6e('0x12'))(_0x7c6e('0x13'));var utils=require(_0x7c6e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7c6e('0x15'));var db=require(_0x7c6e('0x16'))['db'];function respondWithStatusCode(_0x51e581,_0x236c12){_0x236c12=_0x236c12||0xcc;return function(_0x27c3d3){if(_0x27c3d3){return _0x51e581['sendStatus'](_0x236c12);}return _0x51e581[_0x7c6e('0x17')](_0x236c12)['end']();};}function respondWithResult(_0x30a04b,_0x265dc7){_0x265dc7=_0x265dc7||0xc8;return function(_0x4e547c){if(_0x4e547c){return _0x30a04b[_0x7c6e('0x17')](_0x265dc7)[_0x7c6e('0x18')](_0x4e547c);}};}function respondWithFilteredResult(_0x52a8c2,_0x53b446){return function(_0x476e5b){if(_0x476e5b){var _0x5064a1=typeof _0x53b446[_0x7c6e('0x19')]===_0x7c6e('0x1a')&&typeof _0x53b446[_0x7c6e('0x1b')]===_0x7c6e('0x1a');var _0x1121fd=_0x476e5b[_0x7c6e('0x1c')];var _0x9bfa21=_0x5064a1?0x0:_0x53b446[_0x7c6e('0x19')];var _0x3747b0=_0x5064a1?_0x476e5b[_0x7c6e('0x1c')]:_0x53b446[_0x7c6e('0x19')]+_0x53b446['limit'];var _0x509293;if(_0x3747b0>=_0x1121fd){_0x3747b0=_0x1121fd;_0x509293=0xc8;}else{_0x509293=0xce;}_0x52a8c2[_0x7c6e('0x17')](_0x509293);return _0x52a8c2['set']('Content-Range',_0x9bfa21+'-'+_0x3747b0+'/'+_0x1121fd)['json'](_0x476e5b);}return null;};}function patchUpdates(_0x4e5283){return function(_0xb7bb80){try{jsonpatch[_0x7c6e('0x1d')](_0xb7bb80,_0x4e5283,!![]);}catch(_0x250205){return BPromise['reject'](_0x250205);}return _0xb7bb80[_0x7c6e('0x1e')]();};}function saveUpdates(_0x2f45f7,_0x1e0c28){return function(_0x1a9e21){if(_0x1a9e21){return _0x1a9e21[_0x7c6e('0x1f')](_0x2f45f7)['then'](function(_0x986f1e){return _0x986f1e;});}return null;};}function removeEntity(_0x197f89,_0x598f57){return function(_0x1177f6){if(_0x1177f6){return _0x1177f6[_0x7c6e('0x20')]()[_0x7c6e('0x21')](function(){_0x197f89[_0x7c6e('0x17')](0xcc)[_0x7c6e('0x22')]();});}};}function handleEntityNotFound(_0x5428a5,_0x3ae251){return function(_0x2d8e3d){if(!_0x2d8e3d){_0x5428a5[_0x7c6e('0x23')](0x194);}return _0x2d8e3d;};}function handleError(_0x7dc497,_0x2b9823){_0x2b9823=_0x2b9823||0x1f4;return function(_0x134478){logger[_0x7c6e('0x24')](_0x134478[_0x7c6e('0x25')]);if(_0x134478['name']){delete _0x134478[_0x7c6e('0x26')];}_0x7dc497[_0x7c6e('0x17')](_0x2b9823)[_0x7c6e('0x27')](_0x134478);};}exports[_0x7c6e('0x28')]=function(_0x5c24b0,_0x26f6c1){var _0x5bd5f2={},_0x1f0c60={},_0x4ecb8b={'count':0x0,'rows':[]};var _0x56abe8=_[_0x7c6e('0x29')](db[_0x7c6e('0x2a')][_0x7c6e('0x2b')],function(_0x494231){return{'name':_0x494231[_0x7c6e('0x2c')],'type':_0x494231[_0x7c6e('0x2d')][_0x7c6e('0x2e')]};});_0x1f0c60['model']=_[_0x7c6e('0x29')](_0x56abe8,_0x7c6e('0x26'));_0x1f0c60[_0x7c6e('0x2f')]=_['keys'](_0x5c24b0[_0x7c6e('0x2f')]);_0x1f0c60[_0x7c6e('0x30')]=_[_0x7c6e('0x31')](_0x1f0c60['model'],_0x1f0c60[_0x7c6e('0x2f')]);_0x5bd5f2[_0x7c6e('0x32')]=_[_0x7c6e('0x31')](_0x1f0c60[_0x7c6e('0x33')],qs[_0x7c6e('0x34')](_0x5c24b0[_0x7c6e('0x2f')][_0x7c6e('0x34')]));_0x5bd5f2[_0x7c6e('0x32')]=_0x5bd5f2[_0x7c6e('0x32')][_0x7c6e('0x35')]?_0x5bd5f2[_0x7c6e('0x32')]:_0x1f0c60['model'];if(!_0x5c24b0[_0x7c6e('0x2f')][_0x7c6e('0x36')](_0x7c6e('0x37'))){_0x5bd5f2['limit']=qs[_0x7c6e('0x1b')](_0x5c24b0[_0x7c6e('0x2f')]['limit']);_0x5bd5f2['offset']=qs[_0x7c6e('0x19')](_0x5c24b0['query']['offset']);}_0x5bd5f2[_0x7c6e('0x38')]=qs[_0x7c6e('0x39')](_0x5c24b0[_0x7c6e('0x2f')][_0x7c6e('0x39')]);_0x5bd5f2[_0x7c6e('0x3a')]=qs[_0x7c6e('0x30')](_[_0x7c6e('0x3b')](_0x5c24b0[_0x7c6e('0x2f')],_0x1f0c60[_0x7c6e('0x30')]),_0x56abe8);if(_0x5c24b0['query'][_0x7c6e('0x3c')]){_0x5bd5f2[_0x7c6e('0x3a')]=_[_0x7c6e('0x3d')](_0x5bd5f2[_0x7c6e('0x3a')],{'$or':_['map'](_0x56abe8,function(_0x3f5dbf){if(_0x3f5dbf[_0x7c6e('0x2d')]!=='VIRTUAL'){var _0x7ab74d={};_0x7ab74d[_0x3f5dbf[_0x7c6e('0x26')]]={'$like':'%'+_0x5c24b0[_0x7c6e('0x2f')]['filter']+'%'};return _0x7ab74d;}})});}_0x5bd5f2=_[_0x7c6e('0x3d')]({},_0x5bd5f2,_0x5c24b0['options']);var _0x300f7b={'where':_0x5bd5f2[_0x7c6e('0x3a')]};return db[_0x7c6e('0x2a')][_0x7c6e('0x1c')](_0x300f7b)[_0x7c6e('0x21')](function(_0x74646c){_0x4ecb8b['count']=_0x74646c;if(_0x5c24b0[_0x7c6e('0x2f')]['includeAll']){_0x5bd5f2[_0x7c6e('0x3e')]=[{'all':!![]}];}return db['Attachment'][_0x7c6e('0x3f')](_0x5bd5f2);})[_0x7c6e('0x21')](function(_0x5678a8){_0x4ecb8b[_0x7c6e('0x40')]=_0x5678a8;return _0x4ecb8b;})[_0x7c6e('0x21')](respondWithFilteredResult(_0x26f6c1,_0x5bd5f2))['catch'](handleError(_0x26f6c1,null));};exports[_0x7c6e('0x41')]=function(_0x482e3a,_0x2586fc){var _0xd1789f={'raw':!![],'where':{'id':_0x482e3a['params']['id']}},_0x22b928={};_0x22b928[_0x7c6e('0x33')]=_[_0x7c6e('0x42')](db['Attachment'][_0x7c6e('0x2b')]);_0x22b928[_0x7c6e('0x2f')]=_[_0x7c6e('0x42')](_0x482e3a[_0x7c6e('0x2f')]);_0x22b928[_0x7c6e('0x30')]=_[_0x7c6e('0x31')](_0x22b928[_0x7c6e('0x33')],_0x22b928[_0x7c6e('0x2f')]);_0xd1789f[_0x7c6e('0x32')]=_[_0x7c6e('0x31')](_0x22b928['model'],qs['fields'](_0x482e3a[_0x7c6e('0x2f')][_0x7c6e('0x34')]));_0xd1789f[_0x7c6e('0x32')]=_0xd1789f['attributes'][_0x7c6e('0x35')]?_0xd1789f[_0x7c6e('0x32')]:_0x22b928[_0x7c6e('0x33')];if(_0x482e3a[_0x7c6e('0x2f')][_0x7c6e('0x43')]){_0xd1789f['include']=[{'all':!![]}];}_0xd1789f=_[_0x7c6e('0x3d')]({},_0xd1789f,_0x482e3a[_0x7c6e('0x44')]);return db[_0x7c6e('0x2a')][_0x7c6e('0x45')](_0xd1789f)[_0x7c6e('0x21')](handleEntityNotFound(_0x2586fc,null))[_0x7c6e('0x21')](respondWithResult(_0x2586fc,null))[_0x7c6e('0x46')](handleError(_0x2586fc,null));};exports[_0x7c6e('0x47')]=function(_0x3cbae4,_0x4e0caa){var _0x53361b={'where':{'id':_0x3cbae4['params']['id']}},_0x3acf66={};_0x3acf66[_0x7c6e('0x33')]=_['keys'](db[_0x7c6e('0x2a')][_0x7c6e('0x2b')]);_0x53361b[_0x7c6e('0x32')]=_['intersection'](_0x3acf66[_0x7c6e('0x33')],qs[_0x7c6e('0x34')](_0x3cbae4['query'][_0x7c6e('0x34')]));_0x53361b['attributes']=_0x53361b[_0x7c6e('0x32')][_0x7c6e('0x35')]?_0x53361b[_0x7c6e('0x32')]:_0x3acf66[_0x7c6e('0x33')];if(_0x3cbae4[_0x7c6e('0x2f')][_0x7c6e('0x43')]){_0x53361b[_0x7c6e('0x3e')]=[{'all':!![]}];}_0x53361b=_[_0x7c6e('0x3d')]({},_0x53361b,_0x3cbae4['options']);return db[_0x7c6e('0x2a')][_0x7c6e('0x45')](_0x53361b)[_0x7c6e('0x21')](handleEntityNotFound(_0x4e0caa,null))[_0x7c6e('0x21')](function(_0xc65614){if(_0xc65614){var _0x4b0e8c=_0xc65614[_0x7c6e('0x48')]({'plain':!![]});_0x4b0e8c=qs['omit'](_0x4b0e8c,['id',_0x7c6e('0x49'),_0x7c6e('0x4a')]);_0x3cbae4[_0x7c6e('0x4b')]=_['omit'](_0x3cbae4[_0x7c6e('0x4b')],['id',_0x7c6e('0x49'),_0x7c6e('0x4a')]);return db[_0x7c6e('0x2a')][_0x7c6e('0x4c')](_[_0x7c6e('0x3d')](_0x4b0e8c,_0x3cbae4['body']),{'include':_0x3cbae4['query'][_0x7c6e('0x43')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4e0caa,0xc9))[_0x7c6e('0x46')](handleError(_0x4e0caa,null));};exports[_0x7c6e('0x1f')]=function(_0x7795c7,_0x9b12d6){if(_0x7795c7[_0x7c6e('0x4b')]['id']){delete _0x7795c7[_0x7c6e('0x4b')]['id'];}return db[_0x7c6e('0x2a')][_0x7c6e('0x45')]({'where':{'id':_0x7795c7[_0x7c6e('0x4d')]['id']}})[_0x7c6e('0x21')](handleEntityNotFound(_0x9b12d6,null))[_0x7c6e('0x21')](saveUpdates(_0x7795c7[_0x7c6e('0x4b')],null))[_0x7c6e('0x21')](respondWithResult(_0x9b12d6,null))[_0x7c6e('0x46')](handleError(_0x9b12d6,null));};exports[_0x7c6e('0x20')]=function(_0x1db4dd,_0x377742){return db[_0x7c6e('0x2a')]['find']({'where':{'id':_0x1db4dd[_0x7c6e('0x4d')]['id']}})[_0x7c6e('0x21')](handleEntityNotFound(_0x377742,null))[_0x7c6e('0x21')](removeEntity(_0x377742,null))[_0x7c6e('0x46')](handleError(_0x377742,null));};exports['create']=function(_0x415a0a,_0x4102b1,_0x5ba5d0){_0x415a0a[_0x7c6e('0x4b')][_0x7c6e('0x26')]=_0x415a0a['file'][_0x7c6e('0x4e')];_0x415a0a[_0x7c6e('0x4b')][_0x7c6e('0x4f')]=_0x415a0a[_0x7c6e('0x50')][_0x7c6e('0x51')];_0x415a0a[_0x7c6e('0x4b')][_0x7c6e('0x2d')]=_0x415a0a[_0x7c6e('0x50')][_0x7c6e('0x52')];return db[_0x7c6e('0x2a')][_0x7c6e('0x4c')](_0x415a0a[_0x7c6e('0x4b')])[_0x7c6e('0x21')](respondWithResult(_0x4102b1,0xc9))[_0x7c6e('0x46')](handleError(_0x4102b1,null));};exports[_0x7c6e('0x53')]=function(_0x524110,_0x20559a,_0x1d1478){return db['Attachment'][_0x7c6e('0x54')]({'where':{'id':_0x524110[_0x7c6e('0x4d')]['id']},'raw':!![]})[_0x7c6e('0x21')](handleEntityNotFound(_0x20559a,null))['then'](function(_0x948d33){if(_0x948d33){var _0x4441f8=_0x948d33[_0x7c6e('0x55')]!==null;var _0x373fd2=path['join'](config[_0x7c6e('0x56')],'server/files/attachments/');if(_0x4441f8){_0x373fd2=path['join'](_0x373fd2,'offline-chat/');}var _0x24dc82=path['join'](_0x373fd2,_0x948d33[_0x7c6e('0x4f')]);return _0x20559a[_0x7c6e('0x53')](_0x24dc82);}})['catch'](handleError(_0x20559a,null));}; \ No newline at end of file +var _0xfaf2=['file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','then','destroy','end','error','stack','name','index','map','Attachment','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','length','find','clone','params','updatedAt','body','omit','update','create'];(function(_0x56e231,_0x1a6ac9){var _0x57de50=function(_0x3f6e31){while(--_0x3f6e31){_0x56e231['push'](_0x56e231['shift']());}};_0x57de50(++_0x1a6ac9);}(_0xfaf2,0x168));var _0x2faf=function(_0x373fb8,_0x3fc212){_0x373fb8=_0x373fb8-0x0;var _0xa0ee40=_0xfaf2[_0x373fb8];return _0xa0ee40;};'use strict';var emlformat=require(_0x2faf('0x0'));var rimraf=require(_0x2faf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2faf('0x2'));var rp=require(_0x2faf('0x3'));var moment=require(_0x2faf('0x4'));var BPromise=require(_0x2faf('0x5'));var Mustache=require(_0x2faf('0x6'));var util=require(_0x2faf('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2faf('0x8'));var _=require(_0x2faf('0x9'));var squel=require('squel');var crypto=require(_0x2faf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2faf('0xb'));var toCsv=require(_0x2faf('0xc'));var querystring=require(_0x2faf('0xd'));var Papa=require(_0x2faf('0xe'));var Redis=require(_0x2faf('0xf'));var authService=require(_0x2faf('0x10'));var qs=require(_0x2faf('0x11'));var as=require(_0x2faf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2faf('0x13'))('api');var utils=require(_0x2faf('0x14'));var config=require(_0x2faf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2faf('0x16'))['db'];function respondWithStatusCode(_0x42fd3b,_0x60faa0){_0x60faa0=_0x60faa0||0xcc;return function(_0x2d83c7){if(_0x2d83c7){return _0x42fd3b[_0x2faf('0x17')](_0x60faa0);}return _0x42fd3b[_0x2faf('0x18')](_0x60faa0)['end']();};}function respondWithResult(_0x35241d,_0x19c632){_0x19c632=_0x19c632||0xc8;return function(_0x4c5db5){if(_0x4c5db5){return _0x35241d[_0x2faf('0x18')](_0x19c632)[_0x2faf('0x19')](_0x4c5db5);}};}function respondWithFilteredResult(_0x552025,_0x4d431a){return function(_0x2f573a){if(_0x2f573a){var _0x4f9e20=typeof _0x4d431a[_0x2faf('0x1a')]===_0x2faf('0x1b')&&typeof _0x4d431a[_0x2faf('0x1c')]===_0x2faf('0x1b');var _0x24a7b0=_0x2f573a['count'];var _0x73fcae=_0x4f9e20?0x0:_0x4d431a[_0x2faf('0x1a')];var _0x4ff659=_0x4f9e20?_0x2f573a['count']:_0x4d431a['offset']+_0x4d431a[_0x2faf('0x1c')];var _0x217e6f;if(_0x4ff659>=_0x24a7b0){_0x4ff659=_0x24a7b0;_0x217e6f=0xc8;}else{_0x217e6f=0xce;}_0x552025[_0x2faf('0x18')](_0x217e6f);return _0x552025[_0x2faf('0x1d')](_0x2faf('0x1e'),_0x73fcae+'-'+_0x4ff659+'/'+_0x24a7b0)[_0x2faf('0x19')](_0x2f573a);}return null;};}function patchUpdates(_0xf9f560){return function(_0x424ad8){try{jsonpatch['apply'](_0x424ad8,_0xf9f560,!![]);}catch(_0x25de36){return BPromise[_0x2faf('0x1f')](_0x25de36);}return _0x424ad8['save']();};}function saveUpdates(_0x5c6f03,_0xa4033){return function(_0x55fa28){if(_0x55fa28){return _0x55fa28['update'](_0x5c6f03)[_0x2faf('0x20')](function(_0x4470d4){return _0x4470d4;});}return null;};}function removeEntity(_0x54497c,_0x18d3b2){return function(_0x581954){if(_0x581954){return _0x581954[_0x2faf('0x21')]()[_0x2faf('0x20')](function(){_0x54497c[_0x2faf('0x18')](0xcc)[_0x2faf('0x22')]();});}};}function handleEntityNotFound(_0x243fad,_0x467081){return function(_0x217bd7){if(!_0x217bd7){_0x243fad['sendStatus'](0x194);}return _0x217bd7;};}function handleError(_0x2acd1f,_0x39d2d2){_0x39d2d2=_0x39d2d2||0x1f4;return function(_0x149c87){logger[_0x2faf('0x23')](_0x149c87[_0x2faf('0x24')]);if(_0x149c87[_0x2faf('0x25')]){delete _0x149c87[_0x2faf('0x25')];}_0x2acd1f['status'](_0x39d2d2)['send'](_0x149c87);};}exports[_0x2faf('0x26')]=function(_0x2ebc7b,_0x501c77){var _0x35e263={},_0x58e07e={},_0x39c5ee={'count':0x0,'rows':[]};var _0x336af3=_[_0x2faf('0x27')](db[_0x2faf('0x28')][_0x2faf('0x29')],function(_0x25f82d){return{'name':_0x25f82d[_0x2faf('0x2a')],'type':_0x25f82d['type']['key']};});_0x58e07e['model']=_['map'](_0x336af3,_0x2faf('0x25'));_0x58e07e[_0x2faf('0x2b')]=_[_0x2faf('0x2c')](_0x2ebc7b[_0x2faf('0x2b')]);_0x58e07e[_0x2faf('0x2d')]=_[_0x2faf('0x2e')](_0x58e07e[_0x2faf('0x2f')],_0x58e07e[_0x2faf('0x2b')]);_0x35e263[_0x2faf('0x30')]=_[_0x2faf('0x2e')](_0x58e07e['model'],qs[_0x2faf('0x31')](_0x2ebc7b[_0x2faf('0x2b')]['fields']));_0x35e263[_0x2faf('0x30')]=_0x35e263[_0x2faf('0x30')]['length']?_0x35e263[_0x2faf('0x30')]:_0x58e07e[_0x2faf('0x2f')];if(!_0x2ebc7b[_0x2faf('0x2b')][_0x2faf('0x32')]('nolimit')){_0x35e263[_0x2faf('0x1c')]=qs['limit'](_0x2ebc7b['query'][_0x2faf('0x1c')]);_0x35e263[_0x2faf('0x1a')]=qs[_0x2faf('0x1a')](_0x2ebc7b[_0x2faf('0x2b')]['offset']);}_0x35e263[_0x2faf('0x33')]=qs[_0x2faf('0x34')](_0x2ebc7b[_0x2faf('0x2b')][_0x2faf('0x34')]);_0x35e263[_0x2faf('0x35')]=qs[_0x2faf('0x2d')](_[_0x2faf('0x36')](_0x2ebc7b[_0x2faf('0x2b')],_0x58e07e['filters']),_0x336af3);if(_0x2ebc7b['query']['filter']){_0x35e263[_0x2faf('0x35')]=_[_0x2faf('0x37')](_0x35e263['where'],{'$or':_[_0x2faf('0x27')](_0x336af3,function(_0x2fa4c1){if(_0x2fa4c1[_0x2faf('0x38')]!==_0x2faf('0x39')){var _0x27d303={};_0x27d303[_0x2fa4c1[_0x2faf('0x25')]]={'$like':'%'+_0x2ebc7b[_0x2faf('0x2b')][_0x2faf('0x3a')]+'%'};return _0x27d303;}})});}_0x35e263=_[_0x2faf('0x37')]({},_0x35e263,_0x2ebc7b[_0x2faf('0x3b')]);var _0x3116ea={'where':_0x35e263[_0x2faf('0x35')]};return db[_0x2faf('0x28')][_0x2faf('0x3c')](_0x3116ea)[_0x2faf('0x20')](function(_0x3315b9){_0x39c5ee[_0x2faf('0x3c')]=_0x3315b9;if(_0x2ebc7b['query'][_0x2faf('0x3d')]){_0x35e263[_0x2faf('0x3e')]=[{'all':!![]}];}return db[_0x2faf('0x28')][_0x2faf('0x3f')](_0x35e263);})[_0x2faf('0x20')](function(_0x3718b3){_0x39c5ee[_0x2faf('0x40')]=_0x3718b3;return _0x39c5ee;})['then'](respondWithFilteredResult(_0x501c77,_0x35e263))[_0x2faf('0x41')](handleError(_0x501c77,null));};exports['show']=function(_0x542b36,_0x405695){var _0x1d399a={'raw':!![],'where':{'id':_0x542b36['params']['id']}},_0x1dae89={};_0x1dae89[_0x2faf('0x2f')]=_[_0x2faf('0x2c')](db[_0x2faf('0x28')][_0x2faf('0x29')]);_0x1dae89[_0x2faf('0x2b')]=_[_0x2faf('0x2c')](_0x542b36['query']);_0x1dae89['filters']=_['intersection'](_0x1dae89[_0x2faf('0x2f')],_0x1dae89[_0x2faf('0x2b')]);_0x1d399a[_0x2faf('0x30')]=_[_0x2faf('0x2e')](_0x1dae89[_0x2faf('0x2f')],qs['fields'](_0x542b36[_0x2faf('0x2b')][_0x2faf('0x31')]));_0x1d399a[_0x2faf('0x30')]=_0x1d399a['attributes'][_0x2faf('0x42')]?_0x1d399a[_0x2faf('0x30')]:_0x1dae89['model'];if(_0x542b36[_0x2faf('0x2b')][_0x2faf('0x3d')]){_0x1d399a[_0x2faf('0x3e')]=[{'all':!![]}];}_0x1d399a=_[_0x2faf('0x37')]({},_0x1d399a,_0x542b36[_0x2faf('0x3b')]);return db[_0x2faf('0x28')][_0x2faf('0x43')](_0x1d399a)[_0x2faf('0x20')](handleEntityNotFound(_0x405695,null))['then'](respondWithResult(_0x405695,null))['catch'](handleError(_0x405695,null));};exports[_0x2faf('0x44')]=function(_0x4439ba,_0xaa296b){var _0x301abd={'where':{'id':_0x4439ba[_0x2faf('0x45')]['id']}},_0x44f0a0={};_0x44f0a0[_0x2faf('0x2f')]=_['keys'](db[_0x2faf('0x28')]['rawAttributes']);_0x301abd[_0x2faf('0x30')]=_[_0x2faf('0x2e')](_0x44f0a0['model'],qs[_0x2faf('0x31')](_0x4439ba['query'][_0x2faf('0x31')]));_0x301abd[_0x2faf('0x30')]=_0x301abd['attributes']['length']?_0x301abd[_0x2faf('0x30')]:_0x44f0a0['model'];if(_0x4439ba['query'][_0x2faf('0x3d')]){_0x301abd[_0x2faf('0x3e')]=[{'all':!![]}];}_0x301abd=_['merge']({},_0x301abd,_0x4439ba[_0x2faf('0x3b')]);return db[_0x2faf('0x28')][_0x2faf('0x43')](_0x301abd)[_0x2faf('0x20')](handleEntityNotFound(_0xaa296b,null))[_0x2faf('0x20')](function(_0x2ccada){if(_0x2ccada){var _0x4794b5=_0x2ccada['get']({'plain':!![]});_0x4794b5=qs['omit'](_0x4794b5,['id','createdAt',_0x2faf('0x46')]);_0x4439ba[_0x2faf('0x47')]=_[_0x2faf('0x48')](_0x4439ba[_0x2faf('0x47')],['id','createdAt',_0x2faf('0x46')]);return db['Attachment']['create'](_[_0x2faf('0x37')](_0x4794b5,_0x4439ba[_0x2faf('0x47')]),{'include':_0x4439ba[_0x2faf('0x2b')][_0x2faf('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0xaa296b,0xc9))[_0x2faf('0x41')](handleError(_0xaa296b,null));};exports[_0x2faf('0x49')]=function(_0x9df0b9,_0x24b0b5){if(_0x9df0b9[_0x2faf('0x47')]['id']){delete _0x9df0b9[_0x2faf('0x47')]['id'];}return db[_0x2faf('0x28')]['find']({'where':{'id':_0x9df0b9['params']['id']}})[_0x2faf('0x20')](handleEntityNotFound(_0x24b0b5,null))[_0x2faf('0x20')](saveUpdates(_0x9df0b9[_0x2faf('0x47')],null))['then'](respondWithResult(_0x24b0b5,null))[_0x2faf('0x41')](handleError(_0x24b0b5,null));};exports[_0x2faf('0x21')]=function(_0x425d73,_0x5bbde8){return db['Attachment'][_0x2faf('0x43')]({'where':{'id':_0x425d73[_0x2faf('0x45')]['id']}})[_0x2faf('0x20')](handleEntityNotFound(_0x5bbde8,null))['then'](removeEntity(_0x5bbde8,null))[_0x2faf('0x41')](handleError(_0x5bbde8,null));};exports[_0x2faf('0x4a')]=function(_0x56711c,_0x106261,_0x3660c2){_0x56711c[_0x2faf('0x47')][_0x2faf('0x25')]=_0x56711c[_0x2faf('0x4b')][_0x2faf('0x4c')];_0x56711c['body'][_0x2faf('0x4d')]=_0x56711c['file'][_0x2faf('0x4e')];_0x56711c[_0x2faf('0x47')]['type']=_0x56711c[_0x2faf('0x4b')][_0x2faf('0x4f')];return db['Attachment'][_0x2faf('0x4a')](_0x56711c[_0x2faf('0x47')])['then'](respondWithResult(_0x106261,0xc9))[_0x2faf('0x41')](handleError(_0x106261,null));};exports['download']=function(_0x5a2cea,_0x1a81f6,_0xd06ce3){return db[_0x2faf('0x28')][_0x2faf('0x50')]({'where':{'id':_0x5a2cea[_0x2faf('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1a81f6,null))[_0x2faf('0x20')](function(_0x304841){if(_0x304841){var _0x4d7726=_0x304841[_0x2faf('0x51')]!==null;var _0x45a050=path['join'](config[_0x2faf('0x52')],_0x2faf('0x53'));if(_0x4d7726){_0x45a050=path[_0x2faf('0x54')](_0x45a050,_0x2faf('0x55'));}var _0x5acf3f=path[_0x2faf('0x54')](_0x45a050,_0x304841['basename']);return _0x1a81f6[_0x2faf('0x56')](_0x5acf3f);}})[_0x2faf('0x41')](handleError(_0x1a81f6,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index ca68749..060537c 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 _0xdd1a=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment','attachments'];(function(_0x3d1930,_0x3ce0a6){var _0x2e943e=function(_0x5d102d){while(--_0x5d102d){_0x3d1930['push'](_0x3d1930['shift']());}};_0x2e943e(++_0x3ce0a6);}(_0xdd1a,0x6c));var _0xadd1=function(_0x4ede3d,_0x4cb35e){_0x4ede3d=_0x4ede3d-0x0;var _0x1387bf=_0xdd1a[_0x4ede3d];return _0x1387bf;};'use strict';var _=require(_0xadd1('0x0'));var util=require('util');var logger=require(_0xadd1('0x1'))(_0xadd1('0x2'));var moment=require('moment');var BPromise=require(_0xadd1('0x3'));var rp=require(_0xadd1('0x4'));var fs=require('fs');var path=require(_0xadd1('0x5'));var rimraf=require(_0xadd1('0x6'));var config=require('../../config/environment');var attributes=require(_0xadd1('0x7'));module[_0xadd1('0x8')]=function(_0x32d03c,_0x4da46b){return _0x32d03c[_0xadd1('0x9')](_0xadd1('0xa'),attributes,{'tableName':_0xadd1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7baf=['exports','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./attachment.attributes'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7baf,0x19c));var _0xf7ba=function(_0x59480c,_0x32abf8){_0x59480c=_0x59480c-0x0;var _0x232117=_0x7baf[_0x59480c];return _0x232117;};'use strict';var _=require(_0xf7ba('0x0'));var util=require(_0xf7ba('0x1'));var logger=require(_0xf7ba('0x2'))(_0xf7ba('0x3'));var moment=require(_0xf7ba('0x4'));var BPromise=require(_0xf7ba('0x5'));var rp=require(_0xf7ba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf7ba('0x7'));module[_0xf7ba('0x8')]=function(_0x589f26,_0x10c257){return _0x589f26['define']('Attachment',attributes,{'tableName':_0xf7ba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index d732429..31c5b7d 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 _0xecd5=['options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateAttachment','Attachment','create'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xecd5,0x110));var _0x5ecd=function(_0x8af0f1,_0x5794c7){_0x8af0f1=_0x8af0f1-0x0;var _0x4afc64=_0xecd5[_0x8af0f1];return _0x4afc64;};'use strict';var _=require('lodash');var util=require(_0x5ecd('0x0'));var moment=require(_0x5ecd('0x1'));var BPromise=require(_0x5ecd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ecd('0x3'));var db=require(_0x5ecd('0x4'))['db'];var utils=require(_0x5ecd('0x5'));var logger=require(_0x5ecd('0x6'))('rpc');var config=require(_0x5ecd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ecd('0x8')][_0x5ecd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a1870,_0x42c752,_0x26d951){return new BPromise(function(_0x2cb71b,_0x946412){return client[_0x5ecd('0xa')](_0x4a1870,_0x26d951)[_0x5ecd('0xb')](function(_0x305f1b){logger[_0x5ecd('0xc')](_0x5ecd('0xd'),_0x42c752,_0x5ecd('0xe'));logger[_0x5ecd('0xf')](_0x5ecd('0x10'),_0x42c752,'request\x20sent',JSON[_0x5ecd('0x11')](_0x305f1b));if(_0x305f1b['error']){if(_0x305f1b['error'][_0x5ecd('0x12')]===0x1f4){logger[_0x5ecd('0x13')]('Attachment,\x20%s,\x20%s',_0x42c752,_0x305f1b['error'][_0x5ecd('0x14')]);return _0x946412(_0x305f1b[_0x5ecd('0x13')][_0x5ecd('0x14')]);}logger[_0x5ecd('0x13')]('Attachment,\x20%s,\x20%s',_0x42c752,_0x305f1b[_0x5ecd('0x13')][_0x5ecd('0x14')]);return _0x2cb71b(_0x305f1b['error'][_0x5ecd('0x14')]);}else{logger[_0x5ecd('0xc')]('Attachment,\x20%s,\x20%s',_0x42c752,_0x5ecd('0xe'));_0x2cb71b(_0x305f1b['result'][_0x5ecd('0x14')]);}})[_0x5ecd('0x15')](function(_0x1e8e64){logger[_0x5ecd('0x13')](_0x5ecd('0xd'),_0x42c752,_0x1e8e64);_0x946412(_0x1e8e64);});});}exports[_0x5ecd('0x16')]=function(_0x231da2){var _0x189c3b=this;return new Promise(function(_0x3078ea,_0x1f7309){return db[_0x5ecd('0x17')][_0x5ecd('0x18')](_0x231da2['body'],{'raw':_0x231da2[_0x5ecd('0x19')]?_0x231da2[_0x5ecd('0x19')][_0x5ecd('0x1a')]===undefined?!![]:![]:!![]})[_0x5ecd('0xb')](function(_0xea18b7){logger['info'](_0x5ecd('0x16'),_0x231da2);logger['debug'](_0x5ecd('0x16'),_0x231da2,JSON[_0x5ecd('0x11')](_0xea18b7));_0x3078ea(_0xea18b7);})[_0x5ecd('0x15')](function(_0x3c8e2b){logger[_0x5ecd('0x13')]('CreateAttachment',_0x3c8e2b[_0x5ecd('0x14')],_0x231da2);_0x1f7309(_0x189c3b[_0x5ecd('0x13')](0x1f4,_0x3c8e2b[_0x5ecd('0x14')]));});});}; \ No newline at end of file +var _0x0f9f=['debug','stringify','error','code','message','info','result','catch','body','options','raw','CreateAttachment','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent'];(function(_0x71e017,_0x550bc2){var _0x24fe13=function(_0x5baea0){while(--_0x5baea0){_0x71e017['push'](_0x71e017['shift']());}};_0x24fe13(++_0x550bc2);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x28479d,_0x1b8d89){_0x28479d=_0x28479d-0x0;var _0x45c08e=_0x0f9f[_0x28479d];return _0x45c08e;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));var BPromise=require(_0xf0f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f9('0x3'));var db=require(_0xf0f9('0x4'))['db'];var utils=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var config=require(_0xf0f9('0x8'));var jayson=require(_0xf0f9('0x9'));var client=jayson[_0xf0f9('0xa')][_0xf0f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45694e,_0x51a0ed,_0x448cf5){return new BPromise(function(_0x294b42,_0x5d1753){return client[_0xf0f9('0xc')](_0x45694e,_0x448cf5)[_0xf0f9('0xd')](function(_0x2d72c9){logger['info'](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));logger[_0xf0f9('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x51a0ed,'request\x20sent',JSON[_0xf0f9('0x11')](_0x2d72c9));if(_0x2d72c9[_0xf0f9('0x12')]){if(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x13')]===0x1f4){logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x5d1753(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x294b42(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}else{logger[_0xf0f9('0x15')](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));_0x294b42(_0x2d72c9[_0xf0f9('0x16')][_0xf0f9('0x14')]);}})[_0xf0f9('0x17')](function(_0x677b32){logger[_0xf0f9('0x12')]('Attachment,\x20%s,\x20%s',_0x51a0ed,_0x677b32);_0x5d1753(_0x677b32);});});}exports['CreateAttachment']=function(_0x350a48){var _0x3227cf=this;return new Promise(function(_0x4c4e17,_0x178e16){return db['Attachment']['create'](_0x350a48[_0xf0f9('0x18')],{'raw':_0x350a48[_0xf0f9('0x19')]?_0x350a48[_0xf0f9('0x19')][_0xf0f9('0x1a')]===undefined?!![]:![]:!![]})[_0xf0f9('0xd')](function(_0x4ed9ff){logger['info']('CreateAttachment',_0x350a48);logger[_0xf0f9('0x10')](_0xf0f9('0x1b'),_0x350a48,JSON[_0xf0f9('0x11')](_0x4ed9ff));_0x4c4e17(_0x4ed9ff);})['catch'](function(_0x4a8726){logger[_0xf0f9('0x12')]('CreateAttachment',_0x4a8726[_0xf0f9('0x14')],_0x350a48);_0x178e16(_0x3227cf[_0xf0f9('0x12')](0x1f4,_0x4a8726[_0xf0f9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 17fb3fd..940bb25 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(_0x59d097,_0x4cc598){var _0x6cb8a2=function(_0x39945b){while(--_0x39945b){_0x59d097['push'](_0x59d097['shift']());}};_0x6cb8a2(++_0x4cc598);}(_0xb10b,0x12a));var _0xbb10=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xb10b[_0x456fb1];return _0x4083d6;};'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 _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(_0x177004,_0x5d35b7){var _0x20552b=function(_0x54d359){while(--_0x54d359){_0x177004['push'](_0x177004['shift']());}};_0x20552b(++_0x5d35b7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xb10b[_0x3430aa];return _0x2ac5c;};'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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 69e0aa7..1837f7d 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 _0xa4ae=['blockedAt','admin','user','agent','domain','add','minutes','clearBlockUser','getLicense','catch','status','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','ad-login','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','activedirectory','undefined','baseDN','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','name','salt','role','disabled','blocked'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0xa4ae,0x101));var _0xea4a=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0xa4ae[_0x1c9c24];return _0x349c69;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0xea4a('0x0'));var ActiveDirectory=require(_0xea4a('0x1'));var BPromise=require(_0xea4a('0x2'));var util=require(_0xea4a('0x3'));var db=require('../../mysqldb')['db'];var authService=require(_0xea4a('0x4'));var utils=require(_0xea4a('0x5'));var config=require(_0xea4a('0x6'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0xae6d09){var _0x428da1=![];if(typeof _0xae6d09[_0xea4a('0x7')]!==_0xea4a('0x8')){_0x428da1=_0xae6d09[_0xea4a('0x7')][_0xea4a('0x9')]&&_0xae6d09[_0xea4a('0x7')]['url']&&_0xae6d09[_0xea4a('0x7')]['domain'];}return _0x428da1;}function adAuthenticate(_0x2406cf,_0x1de563,_0x184e54){return new BPromise(function(_0x1c201e,_0x455067){try{var _0x50f5a9=new ActiveDirectory(_0x2406cf);_0x50f5a9['authenticate'](_0x1de563,_0x184e54,function(_0x3d1c60,_0x29db90){if(_0x3d1c60){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x1de563,util['inspect'](_0x3d1c60,{'showHidden':![],'depth':null}));_0x455067(_0xea4a('0xa'));}else if(!_0x29db90){logger[_0xea4a('0xb')](_0xea4a('0xc'),_0x1de563);_0x455067('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x1c201e(_0x29db90);}});}catch(_0x1b99b7){_0x455067(_0x1b99b7);}});}function ActiveDirectoryAuthenticate(_0x312216,_0x12b22a,_0x4d2838,_0x4a4647){var _0x7f1d1f,_0x403957;if(!isActiveDirectoryConfigured(config)){logger[_0xea4a('0xb')](_0xea4a('0xd'),_0x12b22a);return _0x4a4647(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0xea4a('0xe')]({'where':{'id':0x1},'attributes':[_0xea4a('0xf'),_0xea4a('0x10')],'raw':!![]})[_0xea4a('0x11')](function(_0x31f04f){_0x7f1d1f=_0x31f04f;if(!_0x7f1d1f['adSsoEnabled']){logger[_0xea4a('0xb')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x12b22a);throw new Error(_0xea4a('0xa'));}return _0x312216['findOne']({'attributes':['id',_0xea4a('0x12'),'password',_0xea4a('0x13'),_0xea4a('0x14'),_0xea4a('0x15'),_0xea4a('0x16'),_0xea4a('0x17'),'online'],'where':{'name':_0x12b22a,'role':{'$or':[_0xea4a('0x18'),_0xea4a('0x19'),_0xea4a('0x1a')]},'adSsoEnabled':!![]}});})[_0xea4a('0x11')](function(_0xf97b69){if(!_0xf97b69||_0xf97b69&&_0xf97b69['name']!==_0x12b22a){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x403957=_0xf97b69;var _0x3db1b8=_0x403957[_0xea4a('0x12')]+'@'+config[_0xea4a('0x7')][_0xea4a('0x1b')];return adAuthenticate(config[_0xea4a('0x7')],_0x3db1b8,_0x4d2838);})[_0xea4a('0x11')](function(_0x3fe625){if(_0x403957[_0xea4a('0x15')]){throw new Error(_0xea4a('0xa'));}if(_0x7f1d1f[_0xea4a('0x10')]>0x0){if(_0x403957[_0xea4a('0x16')]){if(moment(_0x403957[_0xea4a('0x17')])[_0xea4a('0x1c')](_0x7f1d1f[_0xea4a('0x10')],_0xea4a('0x1d'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xea4a('0x1e')](_0x403957,0x0,![],null)[_0xea4a('0x11')](function(){return utils[_0xea4a('0x1f')](_0x403957);})[_0xea4a('0x11')](function(){return _0x4a4647(null,_0x403957);});}else{return utils[_0xea4a('0x1f')](_0x403957)[_0xea4a('0x11')](function(){return _0x4a4647(null,_0x403957);});}}else{return utils['getLicense'](_0x403957)[_0xea4a('0x11')](function(){return _0x4a4647(null,_0x403957);});}})[_0xea4a('0x20')](function(_0x543333){return _0x4a4647(null,![],_0x543333);});}function handleError(_0xcce38f,_0x461cf2,_0x48851a){return _0xcce38f[_0xea4a('0x21')](_0x461cf2||0x1f4)['send']({'message':_0x48851a?_0x48851a['message']||_0x48851a:''});}exports[_0xea4a('0x22')]=function(_0x50ac77,_0x2a1117,_0x5dff5c){passport[_0xea4a('0x23')]('ad-login',function(_0x4ebf16,_0x48acb9,_0x48536f){var _0x2a8b4e=_0x4ebf16||_0x48536f;if(_0x2a8b4e){return handleError(_0x2a1117,0x191,_0x2a8b4e);}if(!_0x48acb9){return handleError(_0x2a1117,0x194,{'message':_0xea4a('0x24')});}else{var _0x38d985={'payload':{'id':_0x48acb9['id'],'role':_0x48acb9[_0xea4a('0x14')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x38d985)[_0xea4a('0x11')](function(_0x418148){_0x2a1117[_0xea4a('0x25')]({'id':_0x48acb9['id'],'token':_0x418148,'statusCall':'','isAlreadyLogged':_0x48acb9[_0xea4a('0x26')]});});}})(_0x50ac77,_0x2a1117,_0x5dff5c);};passport['use'](_0xea4a('0x27'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x473f7a,_0x46b534,_0x1744a3){return ActiveDirectoryAuthenticate(db['User'],_0x473f7a,_0x46b534,_0x1744a3);})); \ No newline at end of file +var _0xbe2a=['json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','salt','role','disabled','blockedAt','online','admin','user','agent','add','minutes','getLicense','catch','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x51ff77,_0x42ff96){var _0x558c46=function(_0x3410df){while(--_0x3410df){_0x51ff77['push'](_0x51ff77['shift']());}};_0x558c46(++_0x42ff96);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x5808a8,_0x3e9e6b){_0x5808a8=_0x5808a8-0x0;var _0x2d324e=_0xbe2a[_0x5808a8];return _0x2d324e;};'use strict';var passport=require(_0xabe2('0x0'));var LocalStrategy=require(_0xabe2('0x1'))[_0xabe2('0x2')];var moment=require(_0xabe2('0x3'));var ActiveDirectory=require(_0xabe2('0x4'));var BPromise=require(_0xabe2('0x5'));var util=require(_0xabe2('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xabe2('0x7'));var utils=require('../../config/utils');var config=require(_0xabe2('0x8'));var logger=require(_0xabe2('0x9'))(_0xabe2('0xa'));function isActiveDirectoryConfigured(_0x475007){var _0x3538a0=![];if(typeof _0x475007[_0xabe2('0xb')]!=='undefined'){_0x3538a0=_0x475007[_0xabe2('0xb')][_0xabe2('0xc')]&&_0x475007[_0xabe2('0xb')][_0xabe2('0xd')]&&_0x475007[_0xabe2('0xb')][_0xabe2('0xe')];}return _0x3538a0;}function adAuthenticate(_0x53a91f,_0x27fbaa,_0x307e01){return new BPromise(function(_0x35ddd1,_0x546445){try{var _0x491e67=new ActiveDirectory(_0x53a91f);_0x491e67['authenticate'](_0x27fbaa,_0x307e01,function(_0x33f1ac,_0x515865){if(_0x33f1ac){logger[_0xabe2('0xf')](_0xabe2('0x10'),_0x27fbaa,util['inspect'](_0x33f1ac,{'showHidden':![],'depth':null}));_0x546445('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x515865){logger[_0xabe2('0xf')](_0xabe2('0x11'),_0x27fbaa);_0x546445(_0xabe2('0x12'));}else{_0x35ddd1(_0x515865);}});}catch(_0x11bbee){_0x546445(_0x11bbee);}});}function ActiveDirectoryAuthenticate(_0x7aaa50,_0xb8343d,_0x3d94a9,_0x3eb2e3){var _0x4196fd,_0x2bea88;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xabe2('0x13'),_0xb8343d);return _0x3eb2e3(null,![],{'message':_0xabe2('0x12')});}return db[_0xabe2('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0xabe2('0x15'),_0xabe2('0x16')],'raw':!![]})[_0xabe2('0x17')](function(_0x2d4bba){_0x4196fd=_0x2d4bba;if(!_0x4196fd['adSsoEnabled']){logger[_0xabe2('0xf')](_0xabe2('0x18'),_0xb8343d);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x7aaa50[_0xabe2('0x19')]({'attributes':['id',_0xabe2('0x1a'),'password',_0xabe2('0x1b'),_0xabe2('0x1c'),_0xabe2('0x1d'),'blocked',_0xabe2('0x1e'),_0xabe2('0x1f')],'where':{'name':_0xb8343d,'role':{'$or':[_0xabe2('0x20'),_0xabe2('0x21'),_0xabe2('0x22')]},'adSsoEnabled':!![]}});})[_0xabe2('0x17')](function(_0x5ad39d){if(!_0x5ad39d||_0x5ad39d&&_0x5ad39d[_0xabe2('0x1a')]!==_0xb8343d){throw new Error(_0xabe2('0x12'));}_0x2bea88=_0x5ad39d;var _0x493a16=_0x2bea88['name']+'@'+config[_0xabe2('0xb')][_0xabe2('0xe')];return adAuthenticate(config[_0xabe2('0xb')],_0x493a16,_0x3d94a9);})[_0xabe2('0x17')](function(_0x5c83fb){if(_0x2bea88[_0xabe2('0x1d')]){throw new Error(_0xabe2('0x12'));}if(_0x4196fd[_0xabe2('0x16')]>0x0){if(_0x2bea88['blocked']){if(moment(_0x2bea88[_0xabe2('0x1e')])[_0xabe2('0x23')](_0x4196fd['blockDuration'],_0xabe2('0x24'))>moment()){throw new Error(_0xabe2('0x12'));}return utils['clearBlockUser'](_0x2bea88,0x0,![],null)[_0xabe2('0x17')](function(){return utils['getLicense'](_0x2bea88);})[_0xabe2('0x17')](function(){return _0x3eb2e3(null,_0x2bea88);});}else{return utils[_0xabe2('0x25')](_0x2bea88)[_0xabe2('0x17')](function(){return _0x3eb2e3(null,_0x2bea88);});}}else{return utils[_0xabe2('0x25')](_0x2bea88)[_0xabe2('0x17')](function(){return _0x3eb2e3(null,_0x2bea88);});}})[_0xabe2('0x26')](function(_0x293e3e){return _0x3eb2e3(null,![],_0x293e3e);});}function handleError(_0x4a8738,_0x2250fd,_0x25365b){return _0x4a8738[_0xabe2('0x27')](_0x2250fd||0x1f4)[_0xabe2('0x28')]({'message':_0x25365b?_0x25365b[_0xabe2('0x29')]||_0x25365b:''});}exports['login']=function(_0x2824a2,_0x20ee27,_0x464a01){passport['authenticate'](_0xabe2('0x2a'),function(_0x2ea99d,_0x3d8d04,_0x2a4397){var _0x436a78=_0x2ea99d||_0x2a4397;if(_0x436a78){return handleError(_0x20ee27,0x191,_0x436a78);}if(!_0x3d8d04){return handleError(_0x20ee27,0x194,{'message':_0xabe2('0x2b')});}else{var _0x5c5451={'payload':{'id':_0x3d8d04['id'],'role':_0x3d8d04['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5c5451)['then'](function(_0x667d0b){_0x20ee27[_0xabe2('0x2c')]({'id':_0x3d8d04['id'],'token':_0x667d0b,'statusCall':'','isAlreadyLogged':_0x3d8d04['online']});});}})(_0x2824a2,_0x20ee27,_0x464a01);};passport[_0xabe2('0x2d')]('ad-login',new LocalStrategy({'usernameField':_0xabe2('0x1a'),'passwordField':'password'},function(_0x5ea4ea,_0x264e25,_0xffa094){return ActiveDirectoryAuthenticate(db[_0xabe2('0x2e')],_0x5ea4ea,_0x264e25,_0xffa094);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 4bac623..a439714 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 _0xbe0a=['exports','express','Router','./authActiveDirectory.controller','login'];(function(_0x2c71f3,_0xf2797a){var _0x4fff05=function(_0x4be68){while(--_0x4be68){_0x2c71f3['push'](_0x2c71f3['shift']());}};_0x4fff05(++_0xf2797a);}(_0xbe0a,0xd8));var _0xabe0=function(_0x5cf3ae,_0x519054){_0x5cf3ae=_0x5cf3ae-0x0;var _0xd0ac0c=_0xbe0a[_0x5cf3ae];return _0xd0ac0c;};'use strict';var express=require(_0xabe0('0x0'));var router=express[_0xabe0('0x1')]();var controller=require(_0xabe0('0x2'));router['post']('/',controller[_0xabe0('0x3')]);module[_0xabe0('0x4')]=router; \ No newline at end of file +var _0x3cb0=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x358e28,_0x2697f4){var _0x5b31e2=function(_0x3a2bfa){while(--_0x3a2bfa){_0x358e28['push'](_0x358e28['shift']());}};_0x5b31e2(++_0x2697f4);}(_0x3cb0,0x170));var _0x03cb=function(_0x5327d8,_0x15f5c0){_0x5327d8=_0x5327d8-0x0;var _0x4c4f4c=_0x3cb0[_0x5327d8];return _0x4c4f4c;};'use strict';var express=require(_0x03cb('0x0'));var router=express[_0x03cb('0x1')]();var controller=require(_0x03cb('0x2'));router[_0x03cb('0x3')]('/',controller[_0x03cb('0x4')]);module[_0x03cb('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 0bd143b..bdce72b 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x205b05,_0x5c50e2){var _0x254e78=function(_0x4ff33a){while(--_0x4ff33a){_0x205b05['push'](_0x205b05['shift']());}};_0x254e78(++_0x5c50e2);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _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(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7a54,0x106));var _0x47a5=function(_0x58a4ba,_0x9ae64){_0x58a4ba=_0x58a4ba-0x0;var _0x4bc09c=_0x7a54[_0x58a4ba];return _0x4bc09c;};'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 2c65927..6635ee8 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 _0xb33d=['login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb33d,0x72));var _0xdb33=function(_0x3890d7,_0x5d6229){_0x3890d7=_0x3890d7-0x0;var _0x224e89=_0xb33d[_0x3890d7];return _0x224e89;};'use strict';var express=require(_0xdb33('0x0'));var passport=require(_0xdb33('0x1'));var router=express['Router']();var controller=require(_0xdb33('0x2'));var userController=require(_0xdb33('0x3'));var authService=require(_0xdb33('0x4'));router[_0xdb33('0x5')]('/',controller[_0xdb33('0x6')]);router[_0xdb33('0x5')](_0xdb33('0x7'),controller[_0xdb33('0x8')],authService[_0xdb33('0x9')],userController[_0xdb33('0x6')],authService[_0xdb33('0xa')]);module[_0xdb33('0xb')]=router; \ No newline at end of file +var _0xf27a=['exports','express','passport','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf27a,0x79));var _0xaf27=function(_0x18da4a,_0x47c66d){_0x18da4a=_0x18da4a-0x0;var _0xc3d952=_0xf27a[_0x18da4a];return _0xc3d952;};'use strict';var express=require(_0xaf27('0x0'));var passport=require(_0xaf27('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0xaf27('0x2'));var authService=require(_0xaf27('0x3'));router[_0xaf27('0x4')]('/',controller['login']);router[_0xaf27('0x4')](_0xaf27('0x5'),controller[_0xaf27('0x6')],authService[_0xaf27('0x7')],userController[_0xaf27('0x8')],authService['setTokenCookie']);module[_0xaf27('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0e6e7e5..d2ab577 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 _0xd777=['../../components/auth/service','../../config/utils','client','http','allowedLoginAttempts','blockDuration','findOne','name','salt','disabled','blocked','blockedAt','loginAttempts','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','clearBlockUser','add','minutes','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','Reset\x20Email\x20sent!','reset','params','token','securePassword','passwordHistoryLimit','validatePasswordPattern','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','save','Password\x20reset!','local-login','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb'];(function(_0x1c09c9,_0x1fb1ca){var _0x479037=function(_0x3a4c95){while(--_0x3a4c95){_0x1c09c9['push'](_0x1c09c9['shift']());}};_0x479037(++_0x1fb1ca);}(_0xd777,0x140));var _0x7d77=function(_0x20048c,_0x337690){_0x20048c=_0x20048c-0x0;var _0x1d7f4b=_0xd777[_0x20048c];return _0x1d7f4b;};'use strict';var util=require(_0x7d77('0x0'));var passport=require(_0x7d77('0x1'));var LocalStrategy=require(_0x7d77('0x2'))[_0x7d77('0x3')];var jayson=require(_0x7d77('0x4'));var _=require(_0x7d77('0x5'));var rs=require(_0x7d77('0x6'));var moment=require('moment');var db=require(_0x7d77('0x7'))['db'];var authService=require(_0x7d77('0x8'));var utils=require(_0x7d77('0x9'));var client=jayson[_0x7d77('0xa')][_0x7d77('0xb')]({'port':0x232b});function localAuthenticate(_0x47399d,_0x13847c,_0x32b081,_0x2e9620){var _0x76ad34,_0xef8eb1;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x7d77('0xc'),_0x7d77('0xd')],'raw':!![]})['then'](function(_0x5eff97){_0x76ad34=_0x5eff97;return _0x47399d[_0x7d77('0xe')]({'attributes':['id',_0x7d77('0xf'),'password',_0x7d77('0x10'),'role',_0x7d77('0x11'),_0x7d77('0x12'),_0x7d77('0x13'),_0x7d77('0x14')],'where':{'name':_0x13847c,'role':{'$or':[_0x7d77('0x15'),'user','agent']}}});})['then'](function(_0x7a26ed){if(!_0x7a26ed||_0x7a26ed&&_0x7a26ed[_0x7d77('0xf')]!==_0x13847c){throw new Error(_0x7d77('0x16'));}else{_0xef8eb1=_0x7a26ed;return _0xef8eb1;}})[_0x7d77('0x17')](function(){_0xef8eb1['authenticate'](_0x32b081,function(_0xee7a43,_0x2bed21){var _0x38cfe9=_0xef8eb1['loginAttempts']+0x1;if(_0xee7a43){return _0x2e9620(_0xee7a43);}else if(!_0x2bed21){if(_0xef8eb1['disabled']){return _0x2e9620(null,![],{'message':_0x7d77('0x16')});}else if(_0x76ad34[_0x7d77('0xc')]>0x0){if(_0xef8eb1[_0x7d77('0x12')]){if(_0x76ad34['blockDuration']>0x0){if(moment(_0xef8eb1[_0x7d77('0x13')])['add'](_0x76ad34['blockDuration'],'minutes')>moment()){return _0x2e9620(null,![],{'message':_0x7d77('0x16')});}else{return utils[_0x7d77('0x18')](_0xef8eb1,_0x38cfe9,![],null)[_0x7d77('0x17')](function(){return _0x2e9620(null,![],{'message':_0x7d77('0x16')});});}}else{return _0x2e9620(null,![],{'message':_0x7d77('0x16')});}}else{if(_0x38cfe9>=_0x76ad34[_0x7d77('0xc')]){return utils[_0x7d77('0x18')](_0xef8eb1,0x0,!![],moment())[_0x7d77('0x17')](function(){return _0x2e9620(null,![],{'message':_0x7d77('0x16')});});}else{return utils['clearBlockUser'](_0xef8eb1,_0x38cfe9,![],null)[_0x7d77('0x17')](function(){return _0x2e9620(null,![],{'message':_0x7d77('0x16')});});}}}else{return _0x2e9620(null,![],{'message':_0x7d77('0x16')});}}else{if(_0xef8eb1[_0x7d77('0x11')]){return _0x2e9620(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x76ad34[_0x7d77('0xc')]>0x0){if(_0xef8eb1['blocked']){if(_0x76ad34[_0x7d77('0xd')]>0x0){if(moment(_0xef8eb1[_0x7d77('0x13')])[_0x7d77('0x19')](_0x76ad34[_0x7d77('0xd')],_0x7d77('0x1a'))>moment()){return _0x2e9620(null,![],{'message':_0x7d77('0x16')});}else{return utils[_0x7d77('0x18')](_0xef8eb1,0x0,![],null)[_0x7d77('0x17')](function(){return utils['getLicense'](_0xef8eb1);})[_0x7d77('0x17')](function(){return _0x2e9620(null,_0xef8eb1);});}}else{return _0x2e9620(null,![],{'message':_0x7d77('0x16')});}}else{return utils['clearBlockUser'](_0xef8eb1,0x0,![],null)[_0x7d77('0x17')](function(){return utils[_0x7d77('0x1b')](_0xef8eb1);})[_0x7d77('0x17')](function(){return _0x2e9620(null,_0xef8eb1);})[_0x7d77('0x1c')](function(_0x4e8dd0){return _0x2e9620(null,![],_0x4e8dd0);});}}else{if(_0xef8eb1[_0x7d77('0x12')]){return _0x2e9620(null,![],{'message':_0x7d77('0x16')});}else{return utils[_0x7d77('0x1b')](_0xef8eb1)[_0x7d77('0x17')](function(){return _0x2e9620(null,_0xef8eb1);});}}}});})[_0x7d77('0x1c')](function(_0x2897ec){return _0x2e9620(null,![],_0x2897ec);});}function sendServiceMail(_0x262731){return db['MailAccount'][_0x7d77('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x7d77('0xf'),_0x7d77('0x1e')],'include':[{'model':db[_0x7d77('0x1f')],'as':_0x7d77('0x20'),'include':[{'model':db[_0x7d77('0x21')],'as':_0x7d77('0x21')}]}]})[_0x7d77('0x17')](function(_0x1d8f11){if(!_0x1d8f11){throw new Error(_0x7d77('0x22'));}var _0x5dfaba=_0x1d8f11[_0x7d77('0x23')]();var _0x1ab678={'account':_0x5dfaba,'message':_[_0x7d77('0x24')]({'from':util[_0x7d77('0x25')](_0x7d77('0x26'),_0x1d8f11[_0x7d77('0xf')],_0x1d8f11['email']||_0x1d8f11[_0x7d77('0x20')]['user'])},_0x262731)};return client[_0x7d77('0x27')](_0x7d77('0x28'),_0x1ab678);})[_0x7d77('0x17')](function(_0x18154e){if(_0x18154e[_0x7d77('0x29')]){throw new Error(util[_0x7d77('0x25')](_0x7d77('0x2a'),_0x18154e[_0x7d77('0x29')]['message']||JSON[_0x7d77('0x2b')](_0x18154e[_0x7d77('0x29')])));}return!![];});}function handleError(_0x40a1e5,_0x136399,_0x3ebc16){return _0x40a1e5[_0x7d77('0x2c')](_0x136399||0x1f4)[_0x7d77('0x2d')]({'message':_0x3ebc16?_0x3ebc16[_0x7d77('0x2e')]||_0x3ebc16:''});}exports[_0x7d77('0x2f')]=function(_0xd9f077,_0x362df5,_0x5a149a){passport[_0x7d77('0x30')]('local-login',function(_0x27f738,_0x42ce9b,_0x43e2f7){var _0x109dad=_0x27f738||_0x43e2f7;if(_0x109dad){return handleError(_0x362df5,0x191,_0x109dad);}if(!_0x42ce9b){return handleError(_0x362df5,0x194,{'message':_0x7d77('0x31')});}else{var _0x660ea5={'payload':{'id':_0x42ce9b['id'],'role':_0x42ce9b['role']},'options':{'expiresIn':0x15180}};return authService[_0x7d77('0x32')](_0x660ea5)[_0x7d77('0x17')](function(_0x1131b8){_0x362df5[_0x7d77('0x33')]({'id':_0x42ce9b['id'],'token':_0x1131b8,'statusCall':'','isAlreadyLogged':_0x42ce9b['online']});});}})(_0xd9f077,_0x362df5,_0x5a149a);};exports['forgot']=function(_0x42e5f6,_0x2578ab){if(!_0x42e5f6[_0x7d77('0x34')][_0x7d77('0x1e')]){return handleError(_0x2578ab,0x1f4,{'message':_0x7d77('0x35')});}var _0x4981=rs[_0x7d77('0x36')]();_0x42e5f6['body'][_0x7d77('0x1e')]=_0x42e5f6[_0x7d77('0x34')][_0x7d77('0x1e')][_0x7d77('0x37')]()[_0x7d77('0x38')]();var _0x94f975;return db['Setting'][_0x7d77('0xe')]({'where':{'id':0x1},'attributes':[_0x7d77('0xc'),_0x7d77('0xd')],'raw':!![]})[_0x7d77('0x17')](function(_0x4ea68c){_0x94f975=_0x4ea68c;return db[_0x7d77('0x39')][_0x7d77('0x1d')]({'where':{'email':_0x42e5f6[_0x7d77('0x34')][_0x7d77('0x1e')]}});})['then'](function(_0x565db3){if(!_0x565db3){throw new Error(_0x7d77('0x3a'));}if(_0x565db3[_0x7d77('0x11')]){throw new Error(_0x7d77('0x3b'));}if(_0x565db3[_0x7d77('0x12')]){if(moment(_0x565db3['blockedAt'])[_0x7d77('0x19')](_0x94f975[_0x7d77('0xd')],'minutes')>moment()){throw new Error(_0x7d77('0x3c'));}else{_0x565db3[_0x7d77('0x12')]=![];_0x565db3['blockedAt']=null;}}_0x565db3['resetPasswordToken']=_0x4981;_0x565db3[_0x7d77('0x3d')]=Date[_0x7d77('0x3e')]()+0x36ee80;return _0x565db3['save']();})[_0x7d77('0x17')](function(){return sendServiceMail({'to':_0x42e5f6[_0x7d77('0x34')][_0x7d77('0x1e')],'subject':_0x7d77('0x3f'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7d77('0x40')+_0x7d77('0x41')+_0x42e5f6[_0x7d77('0x42')][_0x7d77('0x43')]+'/reset/'+_0x4981+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x7d77('0x17')](function(){_0x2578ab[_0x7d77('0x2c')](0xc8)['send']({'message':_0x7d77('0x44')});})[_0x7d77('0x1c')](function(_0x38ba5a){return handleError(_0x2578ab,0x1f4,_0x38ba5a);});};exports[_0x7d77('0x45')]=function(_0x4d1917,_0x5bdc8a){return db[_0x7d77('0x39')][_0x7d77('0x1d')]({'where':{'resetPasswordToken':_0x4d1917[_0x7d77('0x46')][_0x7d77('0x47')],'resetPasswordExpires':{'$gt':Date[_0x7d77('0x3e')]()}}})[_0x7d77('0x17')](function(_0x36d812){if(!_0x36d812){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0x7d77('0xe')]({'attributes':['id',_0x7d77('0x48'),'enforcePasswordHistory',_0x7d77('0x49')]})[_0x7d77('0x17')](function(_0x428b92){if(_0x428b92[_0x7d77('0x48')])authService[_0x7d77('0x4a')](_0x4d1917['body'][_0x7d77('0x4b')]);if(!_0x428b92[_0x7d77('0x4c')]||!_0x36d812[_0x7d77('0x4d')])return _0x36d812;authService[_0x7d77('0x4e')](_0x4d1917['body'][_0x7d77('0x4b')],_0x36d812[_0x7d77('0x4d')],_0x428b92[_0x7d77('0x49')]);return _0x36d812;})[_0x7d77('0x17')](function(){_0x36d812[_0x7d77('0x4b')]=_0x4d1917[_0x7d77('0x34')]['password'];_0x36d812['resetPasswordToken']=null;_0x36d812[_0x7d77('0x3d')]=null;return _0x36d812[_0x7d77('0x4f')]();});})[_0x7d77('0x17')](function(){_0x5bdc8a[_0x7d77('0x2c')](0xc8)[_0x7d77('0x2d')]({'message':_0x7d77('0x50')});})[_0x7d77('0x1c')](function(_0x1e268b){return handleError(_0x5bdc8a,0x1f4,_0x1e268b);});};passport['use'](_0x7d77('0x51'),new LocalStrategy({'usernameField':_0x7d77('0xf'),'passwordField':'password'},function(_0x11949c,_0x448c21,_0x10206a){return localAuthenticate(db[_0x7d77('0x39')],_0x11949c,_0x448c21,_0x10206a);})); \ No newline at end of file +var _0xae13=['passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords','resetPasswordExpires','Password\x20reset!','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','Setting','allowedLoginAttempts','blockDuration','password','salt','role','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','disabled','add','minutes','clearBlockUser','getLicense','catch','blocked','MailAccount','find','name','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','message','login','local-login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','findOne','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','Reset\x20Email\x20sent!','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory'];(function(_0x5bb70,_0x4aa248){var _0x1fe63a=function(_0x1bba30){while(--_0x1bba30){_0x5bb70['push'](_0x5bb70['shift']());}};_0x1fe63a(++_0x4aa248);}(_0xae13,0xb0));var _0x3ae1=function(_0x587675,_0x2489b7){_0x587675=_0x587675-0x0;var _0x3232f7=_0xae13[_0x587675];return _0x3232f7;};'use strict';var util=require(_0x3ae1('0x0'));var passport=require(_0x3ae1('0x1'));var LocalStrategy=require(_0x3ae1('0x2'))[_0x3ae1('0x3')];var jayson=require('jayson/promise');var _=require(_0x3ae1('0x4'));var rs=require(_0x3ae1('0x5'));var moment=require(_0x3ae1('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x3ae1('0x7'));var utils=require(_0x3ae1('0x8'));var client=jayson[_0x3ae1('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x836759,_0x1ca9a6,_0x3bd66a,_0x3670eb){var _0x15ea29,_0x54b620;return db[_0x3ae1('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x3ae1('0xb'),_0x3ae1('0xc')],'raw':!![]})['then'](function(_0x22db9b){_0x15ea29=_0x22db9b;return _0x836759['findOne']({'attributes':['id','name',_0x3ae1('0xd'),_0x3ae1('0xe'),_0x3ae1('0xf'),'disabled','blocked',_0x3ae1('0x10'),_0x3ae1('0x11')],'where':{'name':_0x1ca9a6,'role':{'$or':[_0x3ae1('0x12'),'user',_0x3ae1('0x13')]}}});})['then'](function(_0x566e49){if(!_0x566e49||_0x566e49&&_0x566e49['name']!==_0x1ca9a6){throw new Error(_0x3ae1('0x14'));}else{_0x54b620=_0x566e49;return _0x54b620;}})[_0x3ae1('0x15')](function(){_0x54b620[_0x3ae1('0x16')](_0x3bd66a,function(_0x17bad1,_0x566fca){var _0x1fb646=_0x54b620[_0x3ae1('0x11')]+0x1;if(_0x17bad1){return _0x3670eb(_0x17bad1);}else if(!_0x566fca){if(_0x54b620[_0x3ae1('0x17')]){return _0x3670eb(null,![],{'message':_0x3ae1('0x14')});}else if(_0x15ea29[_0x3ae1('0xb')]>0x0){if(_0x54b620['blocked']){if(_0x15ea29[_0x3ae1('0xc')]>0x0){if(moment(_0x54b620[_0x3ae1('0x10')])[_0x3ae1('0x18')](_0x15ea29[_0x3ae1('0xc')],_0x3ae1('0x19'))>moment()){return _0x3670eb(null,![],{'message':_0x3ae1('0x14')});}else{return utils[_0x3ae1('0x1a')](_0x54b620,_0x1fb646,![],null)[_0x3ae1('0x15')](function(){return _0x3670eb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3670eb(null,![],{'message':_0x3ae1('0x14')});}}else{if(_0x1fb646>=_0x15ea29[_0x3ae1('0xb')]){return utils['clearBlockUser'](_0x54b620,0x0,!![],moment())[_0x3ae1('0x15')](function(){return _0x3670eb(null,![],{'message':_0x3ae1('0x14')});});}else{return utils[_0x3ae1('0x1a')](_0x54b620,_0x1fb646,![],null)[_0x3ae1('0x15')](function(){return _0x3670eb(null,![],{'message':_0x3ae1('0x14')});});}}}else{return _0x3670eb(null,![],{'message':_0x3ae1('0x14')});}}else{if(_0x54b620['disabled']){return _0x3670eb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x15ea29[_0x3ae1('0xb')]>0x0){if(_0x54b620['blocked']){if(_0x15ea29[_0x3ae1('0xc')]>0x0){if(moment(_0x54b620['blockedAt'])[_0x3ae1('0x18')](_0x15ea29['blockDuration'],_0x3ae1('0x19'))>moment()){return _0x3670eb(null,![],{'message':_0x3ae1('0x14')});}else{return utils[_0x3ae1('0x1a')](_0x54b620,0x0,![],null)[_0x3ae1('0x15')](function(){return utils['getLicense'](_0x54b620);})[_0x3ae1('0x15')](function(){return _0x3670eb(null,_0x54b620);});}}else{return _0x3670eb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x3ae1('0x1a')](_0x54b620,0x0,![],null)['then'](function(){return utils[_0x3ae1('0x1b')](_0x54b620);})['then'](function(){return _0x3670eb(null,_0x54b620);})[_0x3ae1('0x1c')](function(_0x36ddd2){return _0x3670eb(null,![],_0x36ddd2);});}}else{if(_0x54b620[_0x3ae1('0x1d')]){return _0x3670eb(null,![],{'message':_0x3ae1('0x14')});}else{return utils[_0x3ae1('0x1b')](_0x54b620)[_0x3ae1('0x15')](function(){return _0x3670eb(null,_0x54b620);});}}}});})['catch'](function(_0x233885){return _0x3670eb(null,![],_0x233885);});}function sendServiceMail(_0x284070){return db[_0x3ae1('0x1e')][_0x3ae1('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x3ae1('0x20'),_0x3ae1('0x21')],'include':[{'model':db[_0x3ae1('0x22')],'as':'Smtp','include':[{'model':db[_0x3ae1('0x23')],'as':'CloudProvider'}]}]})['then'](function(_0x38a739){if(!_0x38a739){throw new Error(_0x3ae1('0x24'));}var _0xb85503=_0x38a739[_0x3ae1('0x25')]();var _0x57375a={'account':_0xb85503,'message':_['merge']({'from':util[_0x3ae1('0x26')](_0x3ae1('0x27'),_0x38a739[_0x3ae1('0x20')],_0x38a739['email']||_0x38a739[_0x3ae1('0x28')][_0x3ae1('0x29')])},_0x284070)};return client[_0x3ae1('0x2a')](_0x3ae1('0x2b'),_0x57375a);})['then'](function(_0x3a75a6){if(_0x3a75a6[_0x3ae1('0x2c')]){throw new Error(util[_0x3ae1('0x26')](_0x3ae1('0x2d'),_0x3a75a6['error']['message']||JSON['stringify'](_0x3a75a6[_0x3ae1('0x2c')])));}return!![];});}function handleError(_0x473b59,_0x4bd721,_0xadee46){return _0x473b59[_0x3ae1('0x2e')](_0x4bd721||0x1f4)[_0x3ae1('0x2f')]({'message':_0xadee46?_0xadee46[_0x3ae1('0x30')]||_0xadee46:''});}exports[_0x3ae1('0x31')]=function(_0x388c4e,_0x475745,_0x50eb59){passport[_0x3ae1('0x16')](_0x3ae1('0x32'),function(_0x2fb303,_0x529c98,_0x24fe3d){var _0x45d0fc=_0x2fb303||_0x24fe3d;if(_0x45d0fc){return handleError(_0x475745,0x191,_0x45d0fc);}if(!_0x529c98){return handleError(_0x475745,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x33ff67={'payload':{'id':_0x529c98['id'],'role':_0x529c98['role']},'options':{'expiresIn':0x15180}};return authService[_0x3ae1('0x33')](_0x33ff67)[_0x3ae1('0x15')](function(_0x2d3317){_0x475745[_0x3ae1('0x34')]({'id':_0x529c98['id'],'token':_0x2d3317,'statusCall':'','isAlreadyLogged':_0x529c98[_0x3ae1('0x35')]});});}})(_0x388c4e,_0x475745,_0x50eb59);};exports[_0x3ae1('0x36')]=function(_0x42a34a,_0x4e3324){if(!_0x42a34a[_0x3ae1('0x37')][_0x3ae1('0x21')]){return handleError(_0x4e3324,0x1f4,{'message':_0x3ae1('0x38')});}var _0x1534c9=rs['generate']();_0x42a34a['body'][_0x3ae1('0x21')]=_0x42a34a[_0x3ae1('0x37')][_0x3ae1('0x21')][_0x3ae1('0x39')]()[_0x3ae1('0x3a')]();var _0x5dad72;return db[_0x3ae1('0xa')][_0x3ae1('0x3b')]({'where':{'id':0x1},'attributes':[_0x3ae1('0xb'),_0x3ae1('0xc')],'raw':!![]})[_0x3ae1('0x15')](function(_0x41c6b0){_0x5dad72=_0x41c6b0;return db['User'][_0x3ae1('0x1f')]({'where':{'email':_0x42a34a[_0x3ae1('0x37')]['email']}});})[_0x3ae1('0x15')](function(_0x4d9516){if(!_0x4d9516){throw new Error(_0x3ae1('0x3c'));}if(_0x4d9516[_0x3ae1('0x17')]){throw new Error(_0x3ae1('0x3d'));}if(_0x4d9516[_0x3ae1('0x1d')]){if(moment(_0x4d9516[_0x3ae1('0x10')])['add'](_0x5dad72[_0x3ae1('0xc')],_0x3ae1('0x19'))>moment()){throw new Error(_0x3ae1('0x3e'));}else{_0x4d9516[_0x3ae1('0x1d')]=![];_0x4d9516[_0x3ae1('0x10')]=null;}}_0x4d9516[_0x3ae1('0x3f')]=_0x1534c9;_0x4d9516['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x4d9516[_0x3ae1('0x40')]();})[_0x3ae1('0x15')](function(){return sendServiceMail({'to':_0x42a34a[_0x3ae1('0x37')]['email'],'subject':_0x3ae1('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x3ae1('0x42')+_0x3ae1('0x43')+_0x42a34a[_0x3ae1('0x44')][_0x3ae1('0x45')]+_0x3ae1('0x46')+_0x1534c9+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x3ae1('0x15')](function(){_0x4e3324[_0x3ae1('0x2e')](0xc8)[_0x3ae1('0x2f')]({'message':_0x3ae1('0x47')});})['catch'](function(_0x39cd56){return handleError(_0x4e3324,0x1f4,_0x39cd56);});};exports['reset']=function(_0xd61f9f,_0x126984){return db[_0x3ae1('0x48')]['find']({'where':{'resetPasswordToken':_0xd61f9f[_0x3ae1('0x49')][_0x3ae1('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x3ae1('0x4b')]()}}})[_0x3ae1('0x15')](function(_0x18786d){if(!_0x18786d){throw new Error(_0x3ae1('0x4c'));}return db[_0x3ae1('0xa')][_0x3ae1('0x3b')]({'attributes':['id',_0x3ae1('0x4d'),_0x3ae1('0x4e'),_0x3ae1('0x4f')]})[_0x3ae1('0x15')](function(_0x45c435){if(_0x45c435['securePassword'])authService[_0x3ae1('0x50')](_0xd61f9f[_0x3ae1('0x37')]['password']);if(!_0x45c435['enforcePasswordHistory']||!_0x18786d['previousPasswords'])return _0x18786d;authService[_0x3ae1('0x51')](_0xd61f9f[_0x3ae1('0x37')]['password'],_0x18786d[_0x3ae1('0x52')],_0x45c435[_0x3ae1('0x4f')]);return _0x18786d;})[_0x3ae1('0x15')](function(){_0x18786d[_0x3ae1('0xd')]=_0xd61f9f[_0x3ae1('0x37')][_0x3ae1('0xd')];_0x18786d[_0x3ae1('0x3f')]=null;_0x18786d[_0x3ae1('0x53')]=null;return _0x18786d[_0x3ae1('0x40')]();});})[_0x3ae1('0x15')](function(){_0x126984[_0x3ae1('0x2e')](0xc8)[_0x3ae1('0x2f')]({'message':_0x3ae1('0x54')});})['catch'](function(_0x120b9b){return handleError(_0x126984,0x1f4,_0x120b9b);});};passport['use']('local-login',new LocalStrategy({'usernameField':_0x3ae1('0x20'),'passwordField':_0x3ae1('0xd')},function(_0x445bd3,_0x736ba5,_0x1fd44d){return localAuthenticate(db[_0x3ae1('0x48')],_0x445bd3,_0x736ba5,_0x1fd44d);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index f36612c..4a69931 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 _0xf77f=['post','/forgot','reset','Router','./authLocal.controller'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf77f,0x1ac));var _0xff77=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xf77f[_0x18b5e8];return _0x25baed;};'use strict';var express=require('express');var router=express[_0xff77('0x0')]();var controller=require(_0xff77('0x1'));router[_0xff77('0x2')]('/',controller['login']);router[_0xff77('0x2')](_0xff77('0x3'),controller['forgot']);router[_0xff77('0x2')]('/reset/:token',controller[_0xff77('0x4')]);module['exports']=router; \ No newline at end of file +var _0x55ad=['post','login','forgot','/reset/:token','reset','exports','express','Router'];(function(_0xc08437,_0x4e7ba2){var _0x524d42=function(_0x880b72){while(--_0x880b72){_0xc08437['push'](_0xc08437['shift']());}};_0x524d42(++_0x4e7ba2);}(_0x55ad,0x146));var _0xd55a=function(_0x22a86f,_0x4ca120){_0x22a86f=_0x22a86f-0x0;var _0x1ca28b=_0x55ad[_0x22a86f];return _0x1ca28b;};'use strict';var express=require(_0xd55a('0x0'));var router=express[_0xd55a('0x1')]();var controller=require('./authLocal.controller');router[_0xd55a('0x2')]('/',controller[_0xd55a('0x3')]);router[_0xd55a('0x2')]('/forgot',controller[_0xd55a('0x4')]);router[_0xd55a('0x2')](_0xd55a('0x5'),controller[_0xd55a('0x6')]);module[_0xd55a('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index b6fae4c..de50434 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 _0x7b58=['INTEGER','STRING','BOOLEAN'];(function(_0x37fdf7,_0x201f20){var _0x1edb3b=function(_0x2f1bbd){while(--_0x2f1bbd){_0x37fdf7['push'](_0x37fdf7['shift']());}};_0x1edb3b(++_0x201f20);}(_0x7b58,0x100));var _0x87b5=function(_0x23af31,_0x8a1add){_0x23af31=_0x23af31-0x0;var _0x49b82f=_0x7b58[_0x23af31];return _0x49b82f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x87b5('0x0')]},'status':{'type':Sequelize[_0x87b5('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x87b5('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0xfc3d=['sequelize','STRING'];(function(_0x1a89e4,_0x252986){var _0x25befe=function(_0x547ac5){while(--_0x547ac5){_0x1a89e4['push'](_0x1a89e4['shift']());}};_0x25befe(++_0x252986);}(_0xfc3d,0x1a4));var _0xdfc3=function(_0x19d8a1,_0x4ca87a){_0x19d8a1=_0x19d8a1-0x0;var _0x4235b8=_0xfc3d[_0x19d8a1];return _0x4235b8;};'use strict';var Sequelize=require(_0xdfc3('0x0'));module['exports']={'name':{'type':Sequelize[_0xdfc3('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xdfc3('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'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 86b5a9c..5c24801 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 _0x45f7=['map','Automation','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','findAll','catch','show','keys','find','create','body','params','addConditions','Condition','ids','omit','getConditions','findOne','order','pick','options','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index'];(function(_0x3e69fd,_0x33192e){var _0xa1031c=function(_0x1d5ce9){while(--_0x1d5ce9){_0x3e69fd['push'](_0x3e69fd['shift']());}};_0xa1031c(++_0x33192e);}(_0x45f7,0xdd));var _0x745f=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x45f7[_0x3b5ad9];return _0x611ae9;};'use strict';var emlformat=require(_0x745f('0x0'));var rimraf=require(_0x745f('0x1'));var zipdir=require(_0x745f('0x2'));var jsonpatch=require(_0x745f('0x3'));var rp=require(_0x745f('0x4'));var moment=require(_0x745f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x745f('0x6'));var util=require(_0x745f('0x7'));var path=require(_0x745f('0x8'));var sox=require(_0x745f('0x9'));var csv=require('to-csv');var ejs=require(_0x745f('0xa'));var fs=require('fs');var fs_extra=require(_0x745f('0xb'));var _=require(_0x745f('0xc'));var squel=require(_0x745f('0xd'));var crypto=require(_0x745f('0xe'));var jsforce=require(_0x745f('0xf'));var deskjs=require(_0x745f('0x10'));var toCsv=require(_0x745f('0x11'));var querystring=require(_0x745f('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x745f('0x13'));var qs=require(_0x745f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x745f('0x15'));var logger=require(_0x745f('0x16'))(_0x745f('0x17'));var utils=require(_0x745f('0x18'));var config=require(_0x745f('0x19'));var licenseUtil=require(_0x745f('0x1a'));var db=require(_0x745f('0x1b'))['db'];function respondWithStatusCode(_0xa26244,_0x24db77){_0x24db77=_0x24db77||0xcc;return function(_0x480fbd){if(_0x480fbd){return _0xa26244['sendStatus'](_0x24db77);}return _0xa26244['status'](_0x24db77)[_0x745f('0x1c')]();};}function respondWithResult(_0x342ee8,_0x54b203){_0x54b203=_0x54b203||0xc8;return function(_0x15e265){if(_0x15e265){return _0x342ee8[_0x745f('0x1d')](_0x54b203)['json'](_0x15e265);}};}function respondWithFilteredResult(_0xc0c79d,_0x27b637){return function(_0x366ff6){if(_0x366ff6){var _0x685bd0=typeof _0x27b637[_0x745f('0x1e')]===_0x745f('0x1f')&&typeof _0x27b637[_0x745f('0x20')]===_0x745f('0x1f');var _0x1f8457=_0x366ff6['count'];var _0xfa6e10=_0x685bd0?0x0:_0x27b637[_0x745f('0x1e')];var _0x2d3665=_0x685bd0?_0x366ff6[_0x745f('0x21')]:_0x27b637[_0x745f('0x1e')]+_0x27b637[_0x745f('0x20')];var _0x37a1cd;if(_0x2d3665>=_0x1f8457){_0x2d3665=_0x1f8457;_0x37a1cd=0xc8;}else{_0x37a1cd=0xce;}_0xc0c79d[_0x745f('0x1d')](_0x37a1cd);return _0xc0c79d[_0x745f('0x22')](_0x745f('0x23'),_0xfa6e10+'-'+_0x2d3665+'/'+_0x1f8457)[_0x745f('0x24')](_0x366ff6);}return null;};}function patchUpdates(_0x2bbea2){return function(_0x59d71e){try{jsonpatch[_0x745f('0x25')](_0x59d71e,_0x2bbea2,!![]);}catch(_0x9935db){return BPromise[_0x745f('0x26')](_0x9935db);}return _0x59d71e[_0x745f('0x27')]();};}function saveUpdates(_0x426b67,_0x24ade3){return function(_0x20fdb3){if(_0x20fdb3){return _0x20fdb3[_0x745f('0x28')](_0x426b67)['then'](function(_0x54e9b3){return _0x54e9b3;});}return null;};}function removeEntity(_0x4cf567,_0x26a1bb){return function(_0xa172a9){if(_0xa172a9){return _0xa172a9[_0x745f('0x29')]()[_0x745f('0x2a')](function(){_0x4cf567['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcd90f9,_0x36d2dc){return function(_0xd31505){if(!_0xd31505){_0xcd90f9[_0x745f('0x2b')](0x194);}return _0xd31505;};}function handleError(_0x2858ca,_0x242b41){_0x242b41=_0x242b41||0x1f4;return function(_0x9b9e9b){logger[_0x745f('0x2c')](_0x9b9e9b[_0x745f('0x2d')]);if(_0x9b9e9b[_0x745f('0x2e')]){delete _0x9b9e9b['name'];}_0x2858ca[_0x745f('0x1d')](_0x242b41)[_0x745f('0x2f')](_0x9b9e9b);};}exports[_0x745f('0x30')]=function(_0x169f42,_0x3ead16){var _0x58c26a={},_0x555cff={},_0x43df1e={'count':0x0,'rows':[]};var _0x4a35a4=_[_0x745f('0x31')](db[_0x745f('0x32')][_0x745f('0x33')],function(_0x181ffa){return{'name':_0x181ffa[_0x745f('0x34')],'type':_0x181ffa[_0x745f('0x35')][_0x745f('0x36')]};});_0x555cff[_0x745f('0x37')]=_[_0x745f('0x31')](_0x4a35a4,_0x745f('0x2e'));_0x555cff['query']=_['keys'](_0x169f42[_0x745f('0x38')]);_0x555cff[_0x745f('0x39')]=_[_0x745f('0x3a')](_0x555cff[_0x745f('0x37')],_0x555cff[_0x745f('0x38')]);_0x58c26a[_0x745f('0x3b')]=_[_0x745f('0x3a')](_0x555cff['model'],qs['fields'](_0x169f42[_0x745f('0x38')][_0x745f('0x3c')]));_0x58c26a[_0x745f('0x3b')]=_0x58c26a[_0x745f('0x3b')][_0x745f('0x3d')]?_0x58c26a[_0x745f('0x3b')]:_0x555cff[_0x745f('0x37')];if(!_0x169f42[_0x745f('0x38')][_0x745f('0x3e')](_0x745f('0x3f'))){_0x58c26a[_0x745f('0x20')]=qs['limit'](_0x169f42[_0x745f('0x38')][_0x745f('0x20')]);_0x58c26a[_0x745f('0x1e')]=qs[_0x745f('0x1e')](_0x169f42['query'][_0x745f('0x1e')]);}_0x58c26a['order']=qs[_0x745f('0x40')](_0x169f42['query'][_0x745f('0x40')]);_0x58c26a['where']=qs[_0x745f('0x39')](_['pick'](_0x169f42[_0x745f('0x38')],_0x555cff['filters']),_0x4a35a4);if(_0x169f42['query']['filter']){_0x58c26a[_0x745f('0x41')]=_[_0x745f('0x42')](_0x58c26a['where'],{'$or':_['map'](_0x4a35a4,function(_0x4cbb39){if(_0x4cbb39['type']!==_0x745f('0x43')){var _0xde108d={};_0xde108d[_0x4cbb39[_0x745f('0x2e')]]={'$like':'%'+_0x169f42[_0x745f('0x38')][_0x745f('0x44')]+'%'};return _0xde108d;}})});}_0x58c26a=_['merge']({},_0x58c26a,_0x169f42['options']);var _0x1de5d2={'where':_0x58c26a[_0x745f('0x41')]};return db[_0x745f('0x32')]['count'](_0x1de5d2)[_0x745f('0x2a')](function(_0x4060d2){_0x43df1e[_0x745f('0x21')]=_0x4060d2;if(_0x169f42['query'][_0x745f('0x45')]){_0x58c26a['include']=[{'all':!![]}];}return db[_0x745f('0x32')][_0x745f('0x46')](_0x58c26a);})[_0x745f('0x2a')](function(_0x4ad4da){_0x43df1e['rows']=_0x4ad4da;return _0x43df1e;})['then'](respondWithFilteredResult(_0x3ead16,_0x58c26a))[_0x745f('0x47')](handleError(_0x3ead16,null));};exports[_0x745f('0x48')]=function(_0x3a46ce,_0x22024e){var _0x41f70b={'raw':![],'where':{'id':_0x3a46ce['params']['id']}},_0x2b4a88={};_0x2b4a88[_0x745f('0x37')]=_[_0x745f('0x49')](db[_0x745f('0x32')][_0x745f('0x33')]);_0x2b4a88[_0x745f('0x38')]=_[_0x745f('0x49')](_0x3a46ce[_0x745f('0x38')]);_0x2b4a88[_0x745f('0x39')]=_[_0x745f('0x3a')](_0x2b4a88['model'],_0x2b4a88[_0x745f('0x38')]);_0x41f70b[_0x745f('0x3b')]=_['intersection'](_0x2b4a88[_0x745f('0x37')],qs[_0x745f('0x3c')](_0x3a46ce[_0x745f('0x38')]['fields']));_0x41f70b['attributes']=_0x41f70b['attributes']['length']?_0x41f70b[_0x745f('0x3b')]:_0x2b4a88[_0x745f('0x37')];if(_0x3a46ce[_0x745f('0x38')][_0x745f('0x45')]){_0x41f70b['include']=[{'all':!![]}];}_0x41f70b=_[_0x745f('0x42')]({},_0x41f70b,_0x3a46ce['options']);return db[_0x745f('0x32')][_0x745f('0x4a')](_0x41f70b)[_0x745f('0x2a')](handleEntityNotFound(_0x22024e,null))[_0x745f('0x2a')](respondWithResult(_0x22024e,null))[_0x745f('0x47')](handleError(_0x22024e,null));};exports[_0x745f('0x4b')]=function(_0x1c4e6d,_0x27b2b0){return db[_0x745f('0x32')][_0x745f('0x4b')](_0x1c4e6d[_0x745f('0x4c')],{})[_0x745f('0x2a')](respondWithResult(_0x27b2b0,0xc9))[_0x745f('0x47')](handleError(_0x27b2b0,null));};exports[_0x745f('0x28')]=function(_0x2c45d3,_0x713f50){if(_0x2c45d3[_0x745f('0x4c')]['id']){delete _0x2c45d3[_0x745f('0x4c')]['id'];}return db['Automation'][_0x745f('0x4a')]({'where':{'id':_0x2c45d3[_0x745f('0x4d')]['id']}})[_0x745f('0x2a')](handleEntityNotFound(_0x713f50,null))[_0x745f('0x2a')](saveUpdates(_0x2c45d3['body'],null))['then'](respondWithResult(_0x713f50,null))[_0x745f('0x47')](handleError(_0x713f50,null));};exports[_0x745f('0x29')]=function(_0x5e1980,_0x4cdb60){return db[_0x745f('0x32')][_0x745f('0x4a')]({'where':{'id':_0x5e1980[_0x745f('0x4d')]['id']}})[_0x745f('0x2a')](handleEntityNotFound(_0x4cdb60,null))[_0x745f('0x2a')](removeEntity(_0x4cdb60,null))[_0x745f('0x47')](handleError(_0x4cdb60,null));};exports[_0x745f('0x4e')]=function(_0x28de47,_0x8dd7d8,_0x5705d9){return db[_0x745f('0x4f')][_0x745f('0x4a')]({'where':{'id':_0x28de47[_0x745f('0x4d')]['id']}})[_0x745f('0x2a')](handleEntityNotFound(_0x8dd7d8,null))[_0x745f('0x2a')](function(_0x3bfced){if(_0x3bfced){return _0x3bfced[_0x745f('0x4e')](_0x28de47[_0x745f('0x4c')][_0x745f('0x50')],_[_0x745f('0x51')](_0x28de47['body'],[_0x745f('0x50'),'id'])||{});}})[_0x745f('0x2a')](respondWithResult(_0x8dd7d8,null))[_0x745f('0x47')](handleError(_0x8dd7d8,null));};exports[_0x745f('0x52')]=function(_0x2dbc47,_0x4136a0,_0x343ab2){var _0x3a0956={};var _0x2418aa={};var _0x404228;var _0x1a6632;return db[_0x745f('0x32')][_0x745f('0x53')]({'where':{'id':_0x2dbc47[_0x745f('0x4d')]['id']}})[_0x745f('0x2a')](handleEntityNotFound(_0x4136a0,null))[_0x745f('0x2a')](function(_0x43dc3c){if(_0x43dc3c){_0x404228=_0x43dc3c;_0x2418aa['model']=_[_0x745f('0x49')](db[_0x745f('0x4f')]['rawAttributes']);_0x2418aa[_0x745f('0x38')]=_[_0x745f('0x49')](_0x2dbc47[_0x745f('0x38')]);_0x2418aa[_0x745f('0x39')]=_[_0x745f('0x3a')](_0x2418aa[_0x745f('0x37')],_0x2418aa[_0x745f('0x38')]);_0x3a0956[_0x745f('0x3b')]=_['intersection'](_0x2418aa[_0x745f('0x37')],qs['fields'](_0x2dbc47[_0x745f('0x38')][_0x745f('0x3c')]));_0x3a0956[_0x745f('0x3b')]=_0x3a0956[_0x745f('0x3b')]['length']?_0x3a0956[_0x745f('0x3b')]:_0x2418aa[_0x745f('0x37')];_0x3a0956[_0x745f('0x54')]=qs[_0x745f('0x40')](_0x2dbc47[_0x745f('0x38')][_0x745f('0x40')]);_0x3a0956['where']=qs[_0x745f('0x39')](_[_0x745f('0x55')](_0x2dbc47[_0x745f('0x38')],_0x2418aa[_0x745f('0x39')]));if(_0x2dbc47['query'][_0x745f('0x44')]){_0x3a0956['where']=_[_0x745f('0x42')](_0x3a0956[_0x745f('0x41')],{'$or':_['map'](_0x3a0956['attributes'],function(_0x4f62c4){var _0x431cf0={};_0x431cf0[_0x4f62c4]={'$like':'%'+_0x2dbc47[_0x745f('0x38')][_0x745f('0x44')]+'%'};return _0x431cf0;})});}_0x3a0956=_[_0x745f('0x42')]({},_0x3a0956,_0x2dbc47[_0x745f('0x56')]);return _0x404228[_0x745f('0x52')](_0x3a0956);}})[_0x745f('0x2a')](function(_0x5c9669){if(_0x5c9669){_0x1a6632=_0x5c9669[_0x745f('0x3d')];if(!_0x2dbc47[_0x745f('0x38')][_0x745f('0x3e')](_0x745f('0x3f'))){_0x3a0956[_0x745f('0x20')]=qs['limit'](_0x2dbc47[_0x745f('0x38')][_0x745f('0x20')]);_0x3a0956[_0x745f('0x1e')]=qs[_0x745f('0x1e')](_0x2dbc47['query'][_0x745f('0x1e')]);}return _0x404228['getConditions'](_0x3a0956);}})['then'](function(_0x35103c){if(_0x35103c){return _0x35103c?{'count':_0x1a6632,'rows':_0x35103c}:null;}})['then'](respondWithResult(_0x4136a0,null))[_0x745f('0x47')](handleError(_0x4136a0,null));};exports[_0x745f('0x57')]=function(_0x42329d,_0xe0b9c2,_0x2b79bc){return db[_0x745f('0x58')][_0x745f('0x4a')]({'where':{'id':_0x42329d[_0x745f('0x4d')]['id']}})[_0x745f('0x2a')](handleEntityNotFound(_0xe0b9c2,null))[_0x745f('0x2a')](function(_0x2999d3){if(_0x2999d3){return _0x2999d3[_0x745f('0x57')](_0x42329d[_0x745f('0x4c')]['ids'],_[_0x745f('0x51')](_0x42329d[_0x745f('0x4c')],[_0x745f('0x50'),'id'])||{});}})[_0x745f('0x2a')](respondWithResult(_0xe0b9c2,null))[_0x745f('0x47')](handleError(_0xe0b9c2,null));};exports[_0x745f('0x59')]=function(_0x53bc49,_0x2e87fe,_0x9f5303){var _0x47c415={};var _0x2b1c3a={};var _0x20e50d;var _0x2a52f2;return db[_0x745f('0x32')][_0x745f('0x53')]({'where':{'id':_0x53bc49['params']['id']}})[_0x745f('0x2a')](handleEntityNotFound(_0x2e87fe,null))[_0x745f('0x2a')](function(_0x410091){if(_0x410091){_0x20e50d=_0x410091;_0x2b1c3a[_0x745f('0x37')]=_['keys'](db[_0x745f('0x58')][_0x745f('0x33')]);_0x2b1c3a[_0x745f('0x38')]=_['keys'](_0x53bc49['query']);_0x2b1c3a[_0x745f('0x39')]=_[_0x745f('0x3a')](_0x2b1c3a['model'],_0x2b1c3a[_0x745f('0x38')]);_0x47c415[_0x745f('0x3b')]=_[_0x745f('0x3a')](_0x2b1c3a[_0x745f('0x37')],qs[_0x745f('0x3c')](_0x53bc49['query'][_0x745f('0x3c')]));_0x47c415[_0x745f('0x3b')]=_0x47c415[_0x745f('0x3b')][_0x745f('0x3d')]?_0x47c415[_0x745f('0x3b')]:_0x2b1c3a['model'];_0x47c415[_0x745f('0x54')]=qs[_0x745f('0x40')](_0x53bc49[_0x745f('0x38')][_0x745f('0x40')]);_0x47c415['where']=qs['filters'](_[_0x745f('0x55')](_0x53bc49[_0x745f('0x38')],_0x2b1c3a['filters']));if(_0x53bc49[_0x745f('0x38')][_0x745f('0x44')]){_0x47c415[_0x745f('0x41')]=_[_0x745f('0x42')](_0x47c415[_0x745f('0x41')],{'$or':_['map'](_0x47c415['attributes'],function(_0x4ceb83){var _0x25198b={};_0x25198b[_0x4ceb83]={'$like':'%'+_0x53bc49[_0x745f('0x38')][_0x745f('0x44')]+'%'};return _0x25198b;})});}_0x47c415=_[_0x745f('0x42')]({},_0x47c415,_0x53bc49['options']);return _0x20e50d[_0x745f('0x59')](_0x47c415);}})['then'](function(_0x1e7bc9){if(_0x1e7bc9){_0x2a52f2=_0x1e7bc9[_0x745f('0x3d')];if(!_0x53bc49[_0x745f('0x38')][_0x745f('0x3e')](_0x745f('0x3f'))){_0x47c415[_0x745f('0x20')]=qs[_0x745f('0x20')](_0x53bc49[_0x745f('0x38')][_0x745f('0x20')]);_0x47c415[_0x745f('0x1e')]=qs['offset'](_0x53bc49[_0x745f('0x38')][_0x745f('0x1e')]);}return _0x20e50d[_0x745f('0x59')](_0x47c415);}})[_0x745f('0x2a')](function(_0x2eb27c){if(_0x2eb27c){return _0x2eb27c?{'count':_0x2a52f2,'rows':_0x2eb27c}:null;}})['then'](respondWithResult(_0x2e87fe,null))[_0x745f('0x47')](handleError(_0x2e87fe,null));}; \ No newline at end of file +var _0x3bc8=['../../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','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','map','Automation','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','params','destroy','ids','omit','getConditions','findOne','nolimit','addActions','Action','getActions','eml-format','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2468b5,_0x506b9e){var _0x1056e4=function(_0x26da1c){while(--_0x26da1c){_0x2468b5['push'](_0x2468b5['shift']());}};_0x1056e4(++_0x506b9e);}(_0x3bc8,0x96));var _0x83bc=function(_0x16b77e,_0x4a56a3){_0x16b77e=_0x16b77e-0x0;var _0x3ae284=_0x3bc8[_0x16b77e];return _0x3ae284;};'use strict';var emlformat=require(_0x83bc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x83bc('0x1'));var moment=require('moment');var BPromise=require(_0x83bc('0x2'));var Mustache=require(_0x83bc('0x3'));var util=require(_0x83bc('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x83bc('0x5'));var ejs=require(_0x83bc('0x6'));var fs=require('fs');var fs_extra=require(_0x83bc('0x7'));var _=require(_0x83bc('0x8'));var squel=require(_0x83bc('0x9'));var crypto=require(_0x83bc('0xa'));var jsforce=require(_0x83bc('0xb'));var deskjs=require(_0x83bc('0xc'));var toCsv=require(_0x83bc('0x5'));var querystring=require(_0x83bc('0xd'));var Papa=require(_0x83bc('0xe'));var Redis=require(_0x83bc('0xf'));var authService=require(_0x83bc('0x10'));var qs=require(_0x83bc('0x11'));var as=require(_0x83bc('0x12'));var hardwareService=require(_0x83bc('0x13'));var logger=require(_0x83bc('0x14'))('api');var utils=require(_0x83bc('0x15'));var config=require(_0x83bc('0x16'));var licenseUtil=require(_0x83bc('0x17'));var db=require(_0x83bc('0x18'))['db'];function respondWithStatusCode(_0x4bc8cd,_0x23ce5b){_0x23ce5b=_0x23ce5b||0xcc;return function(_0x4c355c){if(_0x4c355c){return _0x4bc8cd[_0x83bc('0x19')](_0x23ce5b);}return _0x4bc8cd[_0x83bc('0x1a')](_0x23ce5b)['end']();};}function respondWithResult(_0x9e0d1c,_0x154955){_0x154955=_0x154955||0xc8;return function(_0x5adb13){if(_0x5adb13){return _0x9e0d1c[_0x83bc('0x1a')](_0x154955)[_0x83bc('0x1b')](_0x5adb13);}};}function respondWithFilteredResult(_0x142991,_0x527fd9){return function(_0xa6a1e5){if(_0xa6a1e5){var _0x28ecfd=typeof _0x527fd9[_0x83bc('0x1c')]===_0x83bc('0x1d')&&typeof _0x527fd9[_0x83bc('0x1e')]===_0x83bc('0x1d');var _0x3ea520=_0xa6a1e5[_0x83bc('0x1f')];var _0xb53d60=_0x28ecfd?0x0:_0x527fd9['offset'];var _0x15f754=_0x28ecfd?_0xa6a1e5[_0x83bc('0x1f')]:_0x527fd9['offset']+_0x527fd9[_0x83bc('0x1e')];var _0x2a7a83;if(_0x15f754>=_0x3ea520){_0x15f754=_0x3ea520;_0x2a7a83=0xc8;}else{_0x2a7a83=0xce;}_0x142991[_0x83bc('0x1a')](_0x2a7a83);return _0x142991[_0x83bc('0x20')](_0x83bc('0x21'),_0xb53d60+'-'+_0x15f754+'/'+_0x3ea520)[_0x83bc('0x1b')](_0xa6a1e5);}return null;};}function patchUpdates(_0x27f3ad){return function(_0x4663b8){try{jsonpatch[_0x83bc('0x22')](_0x4663b8,_0x27f3ad,!![]);}catch(_0x1ed166){return BPromise['reject'](_0x1ed166);}return _0x4663b8[_0x83bc('0x23')]();};}function saveUpdates(_0x15abbe,_0x30468f){return function(_0x29a3c5){if(_0x29a3c5){return _0x29a3c5[_0x83bc('0x24')](_0x15abbe)[_0x83bc('0x25')](function(_0x1046d3){return _0x1046d3;});}return null;};}function removeEntity(_0x269a65,_0x44ea60){return function(_0x44f168){if(_0x44f168){return _0x44f168['destroy']()[_0x83bc('0x25')](function(){_0x269a65[_0x83bc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42f71f,_0x5e785d){return function(_0x6a14db){if(!_0x6a14db){_0x42f71f['sendStatus'](0x194);}return _0x6a14db;};}function handleError(_0x509582,_0x52adf3){_0x52adf3=_0x52adf3||0x1f4;return function(_0x215aae){logger[_0x83bc('0x26')](_0x215aae[_0x83bc('0x27')]);if(_0x215aae[_0x83bc('0x28')]){delete _0x215aae[_0x83bc('0x28')];}_0x509582[_0x83bc('0x1a')](_0x52adf3)[_0x83bc('0x29')](_0x215aae);};}exports['index']=function(_0x2f4cd0,_0x1a943c){var _0x90f18a={},_0x2773ef={},_0x124b7a={'count':0x0,'rows':[]};var _0x161edc=_[_0x83bc('0x2a')](db[_0x83bc('0x2b')][_0x83bc('0x2c')],function(_0x3149fa){return{'name':_0x3149fa[_0x83bc('0x2d')],'type':_0x3149fa[_0x83bc('0x2e')]['key']};});_0x2773ef[_0x83bc('0x2f')]=_[_0x83bc('0x2a')](_0x161edc,_0x83bc('0x28'));_0x2773ef['query']=_[_0x83bc('0x30')](_0x2f4cd0[_0x83bc('0x31')]);_0x2773ef[_0x83bc('0x32')]=_['intersection'](_0x2773ef[_0x83bc('0x2f')],_0x2773ef[_0x83bc('0x31')]);_0x90f18a[_0x83bc('0x33')]=_['intersection'](_0x2773ef['model'],qs['fields'](_0x2f4cd0[_0x83bc('0x31')][_0x83bc('0x34')]));_0x90f18a['attributes']=_0x90f18a[_0x83bc('0x33')]['length']?_0x90f18a['attributes']:_0x2773ef[_0x83bc('0x2f')];if(!_0x2f4cd0[_0x83bc('0x31')][_0x83bc('0x35')]('nolimit')){_0x90f18a[_0x83bc('0x1e')]=qs[_0x83bc('0x1e')](_0x2f4cd0[_0x83bc('0x31')][_0x83bc('0x1e')]);_0x90f18a[_0x83bc('0x1c')]=qs[_0x83bc('0x1c')](_0x2f4cd0[_0x83bc('0x31')][_0x83bc('0x1c')]);}_0x90f18a[_0x83bc('0x36')]=qs[_0x83bc('0x37')](_0x2f4cd0[_0x83bc('0x31')][_0x83bc('0x37')]);_0x90f18a[_0x83bc('0x38')]=qs[_0x83bc('0x32')](_[_0x83bc('0x39')](_0x2f4cd0[_0x83bc('0x31')],_0x2773ef[_0x83bc('0x32')]),_0x161edc);if(_0x2f4cd0[_0x83bc('0x31')][_0x83bc('0x3a')]){_0x90f18a['where']=_['merge'](_0x90f18a[_0x83bc('0x38')],{'$or':_[_0x83bc('0x2a')](_0x161edc,function(_0x151e73){if(_0x151e73[_0x83bc('0x2e')]!==_0x83bc('0x3b')){var _0x477958={};_0x477958[_0x151e73[_0x83bc('0x28')]]={'$like':'%'+_0x2f4cd0[_0x83bc('0x31')][_0x83bc('0x3a')]+'%'};return _0x477958;}})});}_0x90f18a=_[_0x83bc('0x3c')]({},_0x90f18a,_0x2f4cd0[_0x83bc('0x3d')]);var _0x8a246d={'where':_0x90f18a[_0x83bc('0x38')]};return db['Automation'][_0x83bc('0x1f')](_0x8a246d)[_0x83bc('0x25')](function(_0x51b2e4){_0x124b7a[_0x83bc('0x1f')]=_0x51b2e4;if(_0x2f4cd0[_0x83bc('0x31')][_0x83bc('0x3e')]){_0x90f18a[_0x83bc('0x3f')]=[{'all':!![]}];}return db[_0x83bc('0x2b')][_0x83bc('0x40')](_0x90f18a);})['then'](function(_0x1a1972){_0x124b7a[_0x83bc('0x41')]=_0x1a1972;return _0x124b7a;})[_0x83bc('0x25')](respondWithFilteredResult(_0x1a943c,_0x90f18a))[_0x83bc('0x42')](handleError(_0x1a943c,null));};exports[_0x83bc('0x43')]=function(_0x5d7611,_0x1687c3){var _0x140156={'raw':![],'where':{'id':_0x5d7611['params']['id']}},_0x43f606={};_0x43f606[_0x83bc('0x2f')]=_[_0x83bc('0x30')](db[_0x83bc('0x2b')][_0x83bc('0x2c')]);_0x43f606[_0x83bc('0x31')]=_[_0x83bc('0x30')](_0x5d7611[_0x83bc('0x31')]);_0x43f606['filters']=_[_0x83bc('0x44')](_0x43f606[_0x83bc('0x2f')],_0x43f606[_0x83bc('0x31')]);_0x140156[_0x83bc('0x33')]=_[_0x83bc('0x44')](_0x43f606['model'],qs[_0x83bc('0x34')](_0x5d7611[_0x83bc('0x31')][_0x83bc('0x34')]));_0x140156['attributes']=_0x140156[_0x83bc('0x33')][_0x83bc('0x45')]?_0x140156[_0x83bc('0x33')]:_0x43f606[_0x83bc('0x2f')];if(_0x5d7611['query'][_0x83bc('0x3e')]){_0x140156['include']=[{'all':!![]}];}_0x140156=_[_0x83bc('0x3c')]({},_0x140156,_0x5d7611[_0x83bc('0x3d')]);return db['Automation'][_0x83bc('0x46')](_0x140156)[_0x83bc('0x25')](handleEntityNotFound(_0x1687c3,null))['then'](respondWithResult(_0x1687c3,null))[_0x83bc('0x42')](handleError(_0x1687c3,null));};exports['create']=function(_0x4d4940,_0xb6d39f){return db[_0x83bc('0x2b')][_0x83bc('0x47')](_0x4d4940['body'],{})[_0x83bc('0x25')](respondWithResult(_0xb6d39f,0xc9))[_0x83bc('0x42')](handleError(_0xb6d39f,null));};exports[_0x83bc('0x24')]=function(_0x414c2f,_0x5c2570){if(_0x414c2f['body']['id']){delete _0x414c2f[_0x83bc('0x48')]['id'];}return db[_0x83bc('0x2b')][_0x83bc('0x46')]({'where':{'id':_0x414c2f[_0x83bc('0x49')]['id']}})[_0x83bc('0x25')](handleEntityNotFound(_0x5c2570,null))[_0x83bc('0x25')](saveUpdates(_0x414c2f[_0x83bc('0x48')],null))[_0x83bc('0x25')](respondWithResult(_0x5c2570,null))['catch'](handleError(_0x5c2570,null));};exports[_0x83bc('0x4a')]=function(_0x2ccd34,_0x30a94c){return db[_0x83bc('0x2b')][_0x83bc('0x46')]({'where':{'id':_0x2ccd34[_0x83bc('0x49')]['id']}})[_0x83bc('0x25')](handleEntityNotFound(_0x30a94c,null))[_0x83bc('0x25')](removeEntity(_0x30a94c,null))[_0x83bc('0x42')](handleError(_0x30a94c,null));};exports['addConditions']=function(_0xaa39a6,_0x5b0be9,_0x35effa){return db['Condition'][_0x83bc('0x46')]({'where':{'id':_0xaa39a6[_0x83bc('0x49')]['id']}})[_0x83bc('0x25')](handleEntityNotFound(_0x5b0be9,null))[_0x83bc('0x25')](function(_0x4e1803){if(_0x4e1803){return _0x4e1803['addConditions'](_0xaa39a6['body'][_0x83bc('0x4b')],_[_0x83bc('0x4c')](_0xaa39a6[_0x83bc('0x48')],[_0x83bc('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x5b0be9,null))[_0x83bc('0x42')](handleError(_0x5b0be9,null));};exports[_0x83bc('0x4d')]=function(_0x1989b8,_0x23d9e0,_0x39e485){var _0x6fb780={};var _0x2de92f={};var _0x19a369;var _0x3c0377;return db[_0x83bc('0x2b')][_0x83bc('0x4e')]({'where':{'id':_0x1989b8[_0x83bc('0x49')]['id']}})[_0x83bc('0x25')](handleEntityNotFound(_0x23d9e0,null))['then'](function(_0x402811){if(_0x402811){_0x19a369=_0x402811;_0x2de92f[_0x83bc('0x2f')]=_[_0x83bc('0x30')](db['Condition'][_0x83bc('0x2c')]);_0x2de92f['query']=_[_0x83bc('0x30')](_0x1989b8[_0x83bc('0x31')]);_0x2de92f[_0x83bc('0x32')]=_[_0x83bc('0x44')](_0x2de92f[_0x83bc('0x2f')],_0x2de92f[_0x83bc('0x31')]);_0x6fb780[_0x83bc('0x33')]=_['intersection'](_0x2de92f['model'],qs[_0x83bc('0x34')](_0x1989b8[_0x83bc('0x31')][_0x83bc('0x34')]));_0x6fb780[_0x83bc('0x33')]=_0x6fb780['attributes']['length']?_0x6fb780[_0x83bc('0x33')]:_0x2de92f[_0x83bc('0x2f')];_0x6fb780[_0x83bc('0x36')]=qs[_0x83bc('0x37')](_0x1989b8['query']['sort']);_0x6fb780[_0x83bc('0x38')]=qs[_0x83bc('0x32')](_['pick'](_0x1989b8['query'],_0x2de92f[_0x83bc('0x32')]));if(_0x1989b8[_0x83bc('0x31')]['filter']){_0x6fb780[_0x83bc('0x38')]=_[_0x83bc('0x3c')](_0x6fb780[_0x83bc('0x38')],{'$or':_[_0x83bc('0x2a')](_0x6fb780[_0x83bc('0x33')],function(_0x1050c5){var _0x496751={};_0x496751[_0x1050c5]={'$like':'%'+_0x1989b8[_0x83bc('0x31')][_0x83bc('0x3a')]+'%'};return _0x496751;})});}_0x6fb780=_['merge']({},_0x6fb780,_0x1989b8[_0x83bc('0x3d')]);return _0x19a369[_0x83bc('0x4d')](_0x6fb780);}})[_0x83bc('0x25')](function(_0x40717e){if(_0x40717e){_0x3c0377=_0x40717e[_0x83bc('0x45')];if(!_0x1989b8[_0x83bc('0x31')][_0x83bc('0x35')](_0x83bc('0x4f'))){_0x6fb780[_0x83bc('0x1e')]=qs[_0x83bc('0x1e')](_0x1989b8[_0x83bc('0x31')]['limit']);_0x6fb780[_0x83bc('0x1c')]=qs[_0x83bc('0x1c')](_0x1989b8[_0x83bc('0x31')][_0x83bc('0x1c')]);}return _0x19a369[_0x83bc('0x4d')](_0x6fb780);}})[_0x83bc('0x25')](function(_0x417560){if(_0x417560){return _0x417560?{'count':_0x3c0377,'rows':_0x417560}:null;}})[_0x83bc('0x25')](respondWithResult(_0x23d9e0,null))[_0x83bc('0x42')](handleError(_0x23d9e0,null));};exports[_0x83bc('0x50')]=function(_0x30316a,_0x24d158,_0x5d74b7){return db[_0x83bc('0x51')][_0x83bc('0x46')]({'where':{'id':_0x30316a[_0x83bc('0x49')]['id']}})[_0x83bc('0x25')](handleEntityNotFound(_0x24d158,null))[_0x83bc('0x25')](function(_0x255656){if(_0x255656){return _0x255656['addActions'](_0x30316a['body'][_0x83bc('0x4b')],_[_0x83bc('0x4c')](_0x30316a[_0x83bc('0x48')],[_0x83bc('0x4b'),'id'])||{});}})[_0x83bc('0x25')](respondWithResult(_0x24d158,null))[_0x83bc('0x42')](handleError(_0x24d158,null));};exports['getActions']=function(_0x22f58b,_0x2e2b37,_0xca3a34){var _0x4dee98={};var _0x4c9432={};var _0x233dcd;var _0x25a939;return db[_0x83bc('0x2b')][_0x83bc('0x4e')]({'where':{'id':_0x22f58b[_0x83bc('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e2b37,null))['then'](function(_0x3711e5){if(_0x3711e5){_0x233dcd=_0x3711e5;_0x4c9432[_0x83bc('0x2f')]=_[_0x83bc('0x30')](db[_0x83bc('0x51')][_0x83bc('0x2c')]);_0x4c9432['query']=_['keys'](_0x22f58b[_0x83bc('0x31')]);_0x4c9432[_0x83bc('0x32')]=_['intersection'](_0x4c9432[_0x83bc('0x2f')],_0x4c9432['query']);_0x4dee98[_0x83bc('0x33')]=_[_0x83bc('0x44')](_0x4c9432['model'],qs['fields'](_0x22f58b[_0x83bc('0x31')][_0x83bc('0x34')]));_0x4dee98[_0x83bc('0x33')]=_0x4dee98[_0x83bc('0x33')][_0x83bc('0x45')]?_0x4dee98[_0x83bc('0x33')]:_0x4c9432['model'];_0x4dee98['order']=qs['sort'](_0x22f58b[_0x83bc('0x31')][_0x83bc('0x37')]);_0x4dee98[_0x83bc('0x38')]=qs[_0x83bc('0x32')](_[_0x83bc('0x39')](_0x22f58b['query'],_0x4c9432['filters']));if(_0x22f58b[_0x83bc('0x31')][_0x83bc('0x3a')]){_0x4dee98[_0x83bc('0x38')]=_[_0x83bc('0x3c')](_0x4dee98[_0x83bc('0x38')],{'$or':_[_0x83bc('0x2a')](_0x4dee98[_0x83bc('0x33')],function(_0x3f4cd1){var _0x3ed6ee={};_0x3ed6ee[_0x3f4cd1]={'$like':'%'+_0x22f58b[_0x83bc('0x31')][_0x83bc('0x3a')]+'%'};return _0x3ed6ee;})});}_0x4dee98=_[_0x83bc('0x3c')]({},_0x4dee98,_0x22f58b[_0x83bc('0x3d')]);return _0x233dcd[_0x83bc('0x52')](_0x4dee98);}})[_0x83bc('0x25')](function(_0x275a12){if(_0x275a12){_0x25a939=_0x275a12['length'];if(!_0x22f58b[_0x83bc('0x31')][_0x83bc('0x35')]('nolimit')){_0x4dee98[_0x83bc('0x1e')]=qs[_0x83bc('0x1e')](_0x22f58b['query'][_0x83bc('0x1e')]);_0x4dee98[_0x83bc('0x1c')]=qs[_0x83bc('0x1c')](_0x22f58b[_0x83bc('0x31')][_0x83bc('0x1c')]);}return _0x233dcd[_0x83bc('0x52')](_0x4dee98);}})['then'](function(_0x5e97e8){if(_0x5e97e8){return _0x5e97e8?{'count':_0x25a939,'rows':_0x5e97e8}:null;}})[_0x83bc('0x25')](respondWithResult(_0x2e2b37,null))[_0x83bc('0x42')](handleError(_0x2e2b37,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 82987fc..d68ffb6 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 _0xe731=['../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe731,0x1aa));var _0x1e73=function(_0x5d0734,_0x4b2469){_0x5d0734=_0x5d0734-0x0;var _0xec1d5=_0xe731[_0x5d0734];return _0xec1d5;};'use strict';var _=require(_0x1e73('0x0'));var util=require(_0x1e73('0x1'));var logger=require(_0x1e73('0x2'))(_0x1e73('0x3'));var moment=require(_0x1e73('0x4'));var BPromise=require(_0x1e73('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e73('0x6'));var rimraf=require(_0x1e73('0x7'));var config=require(_0x1e73('0x8'));var attributes=require(_0x1e73('0x9'));module[_0x1e73('0xa')]=function(_0x4e9869,_0x39d1ef){return _0x4e9869[_0x1e73('0xb')](_0x1e73('0xc'),attributes,{'tableName':_0x1e73('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02f6=['moment','request-promise','path','../../config/environment','exports','define','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x37ae5b,_0x594afe){var _0x2c3284=function(_0x103803){while(--_0x103803){_0x37ae5b['push'](_0x37ae5b['shift']());}};_0x2c3284(++_0x594afe);}(_0x02f6,0x189));var _0x602f=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x02f6[_0x3712e2];return _0x1faff4;};'use strict';var _=require(_0x602f('0x0'));var util=require(_0x602f('0x1'));var logger=require(_0x602f('0x2'))('api');var moment=require(_0x602f('0x3'));var BPromise=require('bluebird');var rp=require(_0x602f('0x4'));var fs=require('fs');var path=require(_0x602f('0x5'));var rimraf=require('rimraf');var config=require(_0x602f('0x6'));var attributes=require('./automation.attributes');module[_0x602f('0x7')]=function(_0x18e567,_0xd3ac14){return _0x18e567[_0x602f('0x8')](_0x602f('0x9'),attributes,{'tableName':_0x602f('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 3b45545..1a77a41 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 _0xc35f=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','Automation,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x4384ca,_0x25bd39){var _0x30fc9e=function(_0x5728e3){while(--_0x5728e3){_0x4384ca['push'](_0x4384ca['shift']());}};_0x30fc9e(++_0x25bd39);}(_0xc35f,0x1ca));var _0xfc35=function(_0xcfa4c1,_0x1a1710){_0xcfa4c1=_0xcfa4c1-0x0;var _0x433125=_0xc35f[_0xcfa4c1];return _0x433125;};'use strict';var _=require(_0xfc35('0x0'));var util=require(_0xfc35('0x1'));var moment=require(_0xfc35('0x2'));var BPromise=require(_0xfc35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc35('0x4'));var db=require(_0xfc35('0x5'))['db'];var utils=require(_0xfc35('0x6'));var logger=require('../../config/logger')(_0xfc35('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc35('0x8')][_0xfc35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c92db,_0x47d695,_0x4283cd){return new BPromise(function(_0x290dcc,_0x43deed){return client['request'](_0x4c92db,_0x4283cd)[_0xfc35('0xa')](function(_0x13d7b9){logger[_0xfc35('0xb')]('Automation,\x20%s,\x20%s',_0x47d695,_0xfc35('0xc'));logger[_0xfc35('0xd')](_0xfc35('0xe'),_0x47d695,_0xfc35('0xc'),JSON['stringify'](_0x13d7b9));if(_0x13d7b9[_0xfc35('0xf')]){if(_0x13d7b9[_0xfc35('0xf')]['code']===0x1f4){logger[_0xfc35('0xf')](_0xfc35('0x10'),_0x47d695,_0x13d7b9[_0xfc35('0xf')]['message']);return _0x43deed(_0x13d7b9[_0xfc35('0xf')]['message']);}logger[_0xfc35('0xf')]('Automation,\x20%s,\x20%s',_0x47d695,_0x13d7b9[_0xfc35('0xf')][_0xfc35('0x11')]);return _0x290dcc(_0x13d7b9['error']['message']);}else{logger[_0xfc35('0xb')](_0xfc35('0x10'),_0x47d695,_0xfc35('0xc'));_0x290dcc(_0x13d7b9[_0xfc35('0x12')][_0xfc35('0x11')]);}})[_0xfc35('0x13')](function(_0x58aae3){logger[_0xfc35('0xf')](_0xfc35('0x10'),_0x47d695,_0x58aae3);_0x43deed(_0x58aae3);});});} \ No newline at end of file +var _0x8fcd=['catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x3c1b09,_0x2f3a4c){_0x3c1b09=_0x3c1b09-0x0;var _0x2e9c72=_0x8fcd[_0x3c1b09];return _0x2e9c72;};'use strict';var _=require(_0xd8fc('0x0'));var util=require(_0xd8fc('0x1'));var moment=require(_0xd8fc('0x2'));var BPromise=require(_0xd8fc('0x3'));var rs=require(_0xd8fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd8fc('0x5'));var logger=require(_0xd8fc('0x6'))(_0xd8fc('0x7'));var config=require(_0xd8fc('0x8'));var jayson=require(_0xd8fc('0x9'));var client=jayson[_0xd8fc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f3825,_0xa229b7,_0x507323){return new BPromise(function(_0x331add,_0x1519e5){return client[_0xd8fc('0xb')](_0x4f3825,_0x507323)[_0xd8fc('0xc')](function(_0x56baca){logger['info'](_0xd8fc('0xd'),_0xa229b7,'request\x20sent');logger['debug'](_0xd8fc('0xe'),_0xa229b7,_0xd8fc('0xf'),JSON['stringify'](_0x56baca));if(_0x56baca['error']){if(_0x56baca[_0xd8fc('0x10')][_0xd8fc('0x11')]===0x1f4){logger['error'](_0xd8fc('0xd'),_0xa229b7,_0x56baca[_0xd8fc('0x10')][_0xd8fc('0x12')]);return _0x1519e5(_0x56baca[_0xd8fc('0x10')][_0xd8fc('0x12')]);}logger['error'](_0xd8fc('0xd'),_0xa229b7,_0x56baca['error'][_0xd8fc('0x12')]);return _0x331add(_0x56baca[_0xd8fc('0x10')][_0xd8fc('0x12')]);}else{logger['info'](_0xd8fc('0xd'),_0xa229b7,_0xd8fc('0xf'));_0x331add(_0x56baca['result']['message']);}})[_0xd8fc('0x13')](function(_0x234b4d){logger[_0xd8fc('0x10')]('Automation,\x20%s,\x20%s',_0xa229b7,_0x234b4d);_0x1519e5(_0x234b4d);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f46db4c..edcad8f 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 _0xe14d=['isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','/:id','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get'];(function(_0x3247ac,_0x4fae7c){var _0x1837bb=function(_0x8b5cd8){while(--_0x8b5cd8){_0x3247ac['push'](_0x3247ac['shift']());}};_0x1837bb(++_0x4fae7c);}(_0xe14d,0x1ee));var _0xde14=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xe14d[_0x3826ad];return _0x17b900;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/:id',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0x9')](_0xde14('0xf'),auth['isAuthenticated'](),controller[_0xde14('0x10')]);router[_0xde14('0x11')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0x12')]);router[_0xde14('0x11')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0x13')]);router[_0xde14('0x11')](_0xde14('0xf'),auth[_0xde14('0xa')](),controller[_0xde14('0x14')]);router[_0xde14('0x15')](_0xde14('0x16'),auth[_0xde14('0xa')](),controller['update']);router['delete'](_0xde14('0x16'),auth[_0xde14('0xa')](),controller[_0xde14('0x17')]);module['exports']=router; \ No newline at end of file +var _0x7e81=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/conditions','/:id/actions','getActions','post','addConditions','addActions','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3f4829,_0x4cac68){var _0x4a9243=function(_0x983178){while(--_0x983178){_0x3f4829['push'](_0x3f4829['shift']());}};_0x4a9243(++_0x4cac68);}(_0x7e81,0xc5));var _0x17e8=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7e81[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x17e8('0x0'));var util=require(_0x17e8('0x1'));var path=require(_0x17e8('0x2'));var timeout=require(_0x17e8('0x3'));var express=require(_0x17e8('0x4'));var router=express[_0x17e8('0x5')]();var fs_extra=require(_0x17e8('0x6'));var auth=require(_0x17e8('0x7'));var interaction=require(_0x17e8('0x8'));var config=require(_0x17e8('0x9'));var controller=require('./automation.controller');router[_0x17e8('0xa')]('/',auth[_0x17e8('0xb')](),controller[_0x17e8('0xc')]);router[_0x17e8('0xa')](_0x17e8('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x17e8('0xa')](_0x17e8('0xe'),auth[_0x17e8('0xb')](),controller['getConditions']);router['get'](_0x17e8('0xf'),auth[_0x17e8('0xb')](),controller[_0x17e8('0x10')]);router[_0x17e8('0x11')]('/',auth[_0x17e8('0xb')](),controller['create']);router[_0x17e8('0x11')](_0x17e8('0xe'),auth['isAuthenticated'](),controller[_0x17e8('0x12')]);router[_0x17e8('0x11')](_0x17e8('0xf'),auth[_0x17e8('0xb')](),controller[_0x17e8('0x13')]);router[_0x17e8('0x14')](_0x17e8('0xd'),auth[_0x17e8('0xb')](),controller[_0x17e8('0x15')]);router[_0x17e8('0x16')](_0x17e8('0xd'),auth['isAuthenticated'](),controller[_0x17e8('0x17')]);module[_0x17e8('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 a13254a..bf027c5 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 _0x3312=['#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)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words'];(function(_0x3f5af4,_0x1a2d76){var _0xeecbd9=function(_0x3ce0c7){while(--_0x3ce0c7){_0x3f5af4['push'](_0x3f5af4['shift']());}};_0xeecbd9(++_0x1a2d76);}(_0x3312,0x1d7));var _0x2331=function(_0xb3a33e,_0x4048dc){_0xb3a33e=_0xb3a33e-0x0;var _0x1f8a1f=_0x3312[_0xb3a33e];return _0x1f8a1f;};'use strict';var Sequelize=require(_0x2331('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2331('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2331('0x2')](_0x2331('0x3')),'allowNull':![],'defaultValue':_0x2331('0x3')},'description':{'type':Sequelize[_0x2331('0x4')]},'active':{'type':Sequelize[_0x2331('0x5')],'defaultValue':0x0,'comment':_0x2331('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x2331('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x2331('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x2331('0x8')](0x3)[_0x2331('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2331('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2331('0x8')](0x3)[_0x2331('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2331('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2331('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2331('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2331('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2331('0x8')](0x5)[_0x2331('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2331('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x2331('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2331('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x2331('0x8')](0x3)[_0x2331('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x2331('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x2331('0x2')](_0x2331('0xe'),_0x2331('0xf'),_0x2331('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x2331('0x5')],'defaultValue':0x0,'comment':_0x2331('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x2331('0x8')](0x9)[_0x2331('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2331('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x2331('0x8')](0x9)[_0x2331('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2331('0x8')](0x9)[_0x2331('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2331('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2331('0x8')](0x9)[_0x2331('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2331('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x2331('0x8')](0x9)[_0x2331('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2331('0x8')](0x9)[_0x2331('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2331('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2331('0x8')](0x9)[_0x2331('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2331('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2331('0x8')](0x5)[_0x2331('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2331('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2331('0x8')](0x9)[_0x2331('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2331('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2331('0x2')](_0x2331('0x19'),_0x2331('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x2331('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x2331('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2331('0x1b')},'dialCutDigit':{'type':Sequelize[_0x2331('0x8')](0x3)[_0x2331('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2331('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2331('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2331('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2331('0x8')](0x5)[_0x2331('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x2331('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2331('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x2331('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2331('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2331('0x8')](0x3)[_0x2331('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2331('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2331('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2331('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x2331('0x8')](0x3)[_0x2331('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2331('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2331('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2331('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2331('0x8')](0x3)[_0x2331('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2331('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2331('0x8')](0x5)[_0x2331('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2331('0x25')}}; \ No newline at end of file +var _0x53ff=['INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ivr','STRING'];(function(_0x1a94d7,_0x22f74e){var _0x1a87ee=function(_0x56a684){while(--_0x56a684){_0x1a94d7['push'](_0x1a94d7['shift']());}};_0x1a87ee(++_0x22f74e);}(_0x53ff,0xb6));var _0xf53f=function(_0x3a6194,_0x4574e2){_0x3a6194=_0x3a6194-0x0;var _0x298116=_0x53ff[_0x3a6194];return _0x298116;};'use strict';var Sequelize=require(_0xf53f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf53f('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xf53f('0x2')),'allowNull':![],'defaultValue':_0xf53f('0x2')},'description':{'type':Sequelize[_0xf53f('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xf53f('0x4')](0x4)[_0xf53f('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf53f('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf53f('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xf53f('0x4')](0x3)[_0xf53f('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf53f('0x7')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf53f('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf53f('0x4')](0x5)[_0xf53f('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf53f('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf53f('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf53f('0x4')](0x5)[_0xf53f('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf53f('0x4')](0x3)[_0xf53f('0x5')],'defaultValue':0x3,'comment':_0xf53f('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf53f('0x4')](0x5)[_0xf53f('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf53f('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf53f('0x4')](0x3)[_0xf53f('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf53f('0xc')},'dialTimezone':{'type':Sequelize[_0xf53f('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf53f('0x3')],'defaultValue':_0xf53f('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xf53f('0xe')]('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xf53f('0xf')],'defaultValue':0x0,'comment':_0xf53f('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0xf53f('0x4')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf53f('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xf53f('0x4')](0x9)[_0xf53f('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf53f('0x4')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf53f('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf53f('0x4')](0x9)[_0xf53f('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xf53f('0x4')](0x9)[_0xf53f('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf53f('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf53f('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf53f('0x4')](0x9)[_0xf53f('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf53f('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf53f('0x4')](0x5)[_0xf53f('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf53f('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf53f('0x4')](0x9)[_0xf53f('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xf53f('0x16'),_0xf53f('0x17')),'defaultValue':_0xf53f('0x16')},'dialPrefix':{'type':Sequelize[_0xf53f('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf53f('0x4')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xf53f('0x4')](0x3)[_0xf53f('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf53f('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf53f('0x4')](0x3)[_0xf53f('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf53f('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf53f('0x4')](0x5)[_0xf53f('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xf53f('0x4')](0x3)[_0xf53f('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xf53f('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf53f('0x1a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf53f('0x4')](0x3)[_0xf53f('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf53f('0x4')](0x5)[_0xf53f('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf53f('0x1b')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xf53f('0x4')](0x5)[_0xf53f('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf53f('0x1c')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf53f('0x1d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf53f('0x4')](0x5)[_0xf53f('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf53f('0x1e')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 85eaf95..a328de6 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 _0x7af2=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','destroy','getHoppers','CmHopper','rawAttributes','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_contacts','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','spread','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x58fa07,_0xab2653){var _0x42d3b8=function(_0x57cc3e){while(--_0x57cc3e){_0x58fa07['push'](_0x58fa07['shift']());}};_0x42d3b8(++_0xab2653);}(_0x7af2,0x119));var _0x27af=function(_0x4ad3eb,_0xd2f959){_0x4ad3eb=_0x4ad3eb-0x0;var _0x2384e2=_0x7af2[_0x4ad3eb];return _0x2384e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];function respondWithStatusCode(_0x49a883,_0x406340){_0x406340=_0x406340||0xcc;return function(_0x203501){if(_0x203501){return _0x49a883[_0x27af('0x17')](_0x406340);}return _0x49a883[_0x27af('0x18')](_0x406340)[_0x27af('0x19')]();};}function respondWithResult(_0x1edb50,_0x234825){_0x234825=_0x234825||0xc8;return function(_0x3da435){if(_0x3da435){return _0x1edb50[_0x27af('0x18')](_0x234825)[_0x27af('0x1a')](_0x3da435);}};}function respondWithFilteredResult(_0x30f675,_0x9c2d4b){return function(_0x2d7800){if(_0x2d7800){var _0x3102c4=typeof _0x9c2d4b[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x9c2d4b[_0x27af('0x1d')]===_0x27af('0x1c');var _0x58583a=_0x2d7800[_0x27af('0x1e')];var _0x31d702=_0x3102c4?0x0:_0x9c2d4b['offset'];var _0x4e6e2f=_0x3102c4?_0x2d7800[_0x27af('0x1e')]:_0x9c2d4b[_0x27af('0x1b')]+_0x9c2d4b[_0x27af('0x1d')];var _0x31573a;if(_0x4e6e2f>=_0x58583a){_0x4e6e2f=_0x58583a;_0x31573a=0xc8;}else{_0x31573a=0xce;}_0x30f675[_0x27af('0x18')](_0x31573a);return _0x30f675['set'](_0x27af('0x1f'),_0x31d702+'-'+_0x4e6e2f+'/'+_0x58583a)[_0x27af('0x1a')](_0x2d7800);}return null;};}function patchUpdates(_0xcb4b90){return function(_0x5e7c19){try{jsonpatch[_0x27af('0x20')](_0x5e7c19,_0xcb4b90,!![]);}catch(_0x2eec5f){return BPromise[_0x27af('0x21')](_0x2eec5f);}return _0x5e7c19['save']();};}function saveUpdates(_0x2dce2b,_0x2460f4){return function(_0x30720b){if(_0x30720b){return _0x30720b[_0x27af('0x22')](_0x2dce2b)[_0x27af('0x23')](function(_0x396156){return _0x396156;});}return null;};}function removeEntity(_0x43dd9e,_0x35b36d){return function(_0x2e1bb0){if(_0x2e1bb0){return _0x2e1bb0['destroy']()['then'](function(){var _0x4b8fe6=_0x2e1bb0[_0x27af('0x24')]({'plain':!![]});var _0x4feaf1=_0x27af('0x25');return db[_0x27af('0x26')]['destroy']({'where':{'type':_0x4feaf1,'resourceId':_0x4b8fe6['id']}})[_0x27af('0x23')](function(){return _0x2e1bb0;});})[_0x27af('0x23')](function(){_0x43dd9e[_0x27af('0x18')](0xcc)[_0x27af('0x19')]();});}};}function handleEntityNotFound(_0x39b8ee,_0x3ca40e){return function(_0x775d4e){if(!_0x775d4e){_0x39b8ee['sendStatus'](0x194);}return _0x775d4e;};}function handleError(_0x14d5fc,_0x250d5b){_0x250d5b=_0x250d5b||0x1f4;return function(_0xadd38e){logger[_0x27af('0x27')](_0xadd38e[_0x27af('0x28')]);if(_0xadd38e[_0x27af('0x29')]){delete _0xadd38e[_0x27af('0x29')];}_0x14d5fc[_0x27af('0x18')](_0x250d5b)[_0x27af('0x2a')](_0xadd38e);};}exports[_0x27af('0x2b')]=function(_0x205e41,_0x4f4955){var _0x15e867={},_0x14b2e7={},_0x3800a1={'count':0x0,'rows':[]};var _0x575887=_[_0x27af('0x2c')](db[_0x27af('0x2d')]['rawAttributes'],function(_0x51bc97){return{'name':_0x51bc97[_0x27af('0x2e')],'type':_0x51bc97[_0x27af('0x2f')]['key']};});_0x14b2e7[_0x27af('0x30')]=_[_0x27af('0x2c')](_0x575887,_0x27af('0x29'));_0x14b2e7[_0x27af('0x31')]=_[_0x27af('0x32')](_0x205e41[_0x27af('0x31')]);_0x14b2e7[_0x27af('0x33')]=_[_0x27af('0x34')](_0x14b2e7[_0x27af('0x30')],_0x14b2e7[_0x27af('0x31')]);_0x15e867[_0x27af('0x35')]=_['intersection'](_0x14b2e7['model'],qs[_0x27af('0x36')](_0x205e41[_0x27af('0x31')]['fields']));_0x15e867[_0x27af('0x35')]=_0x15e867[_0x27af('0x35')]['length']?_0x15e867[_0x27af('0x35')]:_0x14b2e7[_0x27af('0x30')];if(!_0x205e41[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x15e867['limit']=qs[_0x27af('0x1d')](_0x205e41[_0x27af('0x31')]['limit']);_0x15e867['offset']=qs[_0x27af('0x1b')](_0x205e41[_0x27af('0x31')][_0x27af('0x1b')]);}_0x15e867[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x205e41[_0x27af('0x31')]['sort']);_0x15e867[_0x27af('0x3b')]=qs['filters'](_[_0x27af('0x3c')](_0x205e41[_0x27af('0x31')],_0x14b2e7[_0x27af('0x33')]),_0x575887);if(_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]){_0x15e867['where']=_[_0x27af('0x3e')](_0x15e867[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x575887,function(_0x3faebd){if(_0x3faebd[_0x27af('0x2f')]!==_0x27af('0x3f')){var _0x415d9f={};_0x415d9f[_0x3faebd[_0x27af('0x29')]]={'$like':'%'+_0x205e41[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x415d9f;}})});}_0x15e867=_[_0x27af('0x3e')]({},_0x15e867,_0x205e41[_0x27af('0x40')]);var _0x24ee9b={'where':_0x15e867[_0x27af('0x3b')]};return db['Campaign'][_0x27af('0x1e')](_0x24ee9b)[_0x27af('0x23')](function(_0x44534b){_0x3800a1[_0x27af('0x1e')]=_0x44534b;if(_0x205e41['query'][_0x27af('0x41')]){_0x15e867['include']=[{'all':!![]}];}return db['Campaign'][_0x27af('0x42')](_0x15e867);})[_0x27af('0x23')](function(_0x279f99){_0x3800a1[_0x27af('0x43')]=_0x279f99;return _0x3800a1;})[_0x27af('0x23')](respondWithFilteredResult(_0x4f4955,_0x15e867))[_0x27af('0x44')](handleError(_0x4f4955,null));};exports[_0x27af('0x45')]=function(_0x26eb28,_0x2269e8){var _0x100fcb={'raw':![],'where':{'id':_0x26eb28[_0x27af('0x46')]['id']}},_0x1e3c35={};_0x1e3c35['model']=_[_0x27af('0x32')](db[_0x27af('0x2d')]['rawAttributes']);_0x1e3c35['query']=_[_0x27af('0x32')](_0x26eb28[_0x27af('0x31')]);_0x1e3c35[_0x27af('0x33')]=_[_0x27af('0x34')](_0x1e3c35[_0x27af('0x30')],_0x1e3c35['query']);_0x100fcb[_0x27af('0x35')]=_['intersection'](_0x1e3c35[_0x27af('0x30')],qs[_0x27af('0x36')](_0x26eb28[_0x27af('0x31')][_0x27af('0x36')]));_0x100fcb[_0x27af('0x35')]=_0x100fcb[_0x27af('0x35')][_0x27af('0x47')]?_0x100fcb['attributes']:_0x1e3c35['model'];if(_0x26eb28[_0x27af('0x31')]['includeAll']){_0x100fcb[_0x27af('0x48')]=[{'all':!![]}];}_0x100fcb=_[_0x27af('0x3e')]({},_0x100fcb,_0x26eb28[_0x27af('0x40')]);return db[_0x27af('0x2d')][_0x27af('0x49')](_0x100fcb)[_0x27af('0x23')](handleEntityNotFound(_0x2269e8,null))[_0x27af('0x23')](respondWithResult(_0x2269e8,null))['catch'](handleError(_0x2269e8,null));};exports[_0x27af('0x4a')]=function(_0xc7e2a8,_0x20e180){return db[_0x27af('0x2d')][_0x27af('0x4a')](_0xc7e2a8['body'],{})[_0x27af('0x23')](function(_0x25f960){var _0x28ba64=_0xc7e2a8['user']['get']({'plain':!![]});if(!_0x28ba64)throw new Error(_0x27af('0x4b'));if(_0x28ba64[_0x27af('0x4c')]===_0x27af('0x4d')){var _0x5be44f=_0x25f960['get']({'plain':!![]});var _0x2fad23='IvrCampaigns';return db[_0x27af('0x4e')][_0x27af('0x49')]({'where':{'name':_0x2fad23,'userProfileId':_0x28ba64[_0x27af('0x4f')]},'raw':!![]})[_0x27af('0x23')](function(_0x38aa14){if(_0x38aa14&&_0x38aa14[_0x27af('0x50')]===0x0){return db[_0x27af('0x26')][_0x27af('0x4a')]({'name':_0x5be44f[_0x27af('0x29')],'resourceId':_0x5be44f['id'],'type':_0x38aa14[_0x27af('0x29')],'sectionId':_0x38aa14['id']},{})[_0x27af('0x23')](function(){return _0x25f960;});}else{return _0x25f960;}})['catch'](function(_0x76ed78){logger[_0x27af('0x27')](_0x27af('0x51'),_0x76ed78);throw _0x76ed78;});}return _0x25f960;})[_0x27af('0x23')](respondWithResult(_0x20e180,0xc9))[_0x27af('0x44')](handleError(_0x20e180,null));};exports[_0x27af('0x52')]=function(_0x20c155,_0x31eaa9){var _0x4c5b99={'where':{'id':_0x20c155['params']['id']}},_0x2e7b34={};_0x2e7b34[_0x27af('0x30')]=_[_0x27af('0x32')](db[_0x27af('0x2d')]['rawAttributes']);_0x4c5b99[_0x27af('0x35')]=_['intersection'](_0x2e7b34[_0x27af('0x30')],qs[_0x27af('0x36')](_0x20c155[_0x27af('0x31')]['fields']));_0x4c5b99[_0x27af('0x35')]=_0x4c5b99['attributes'][_0x27af('0x47')]?_0x4c5b99['attributes']:_0x2e7b34[_0x27af('0x30')];if(_0x20c155[_0x27af('0x31')][_0x27af('0x41')]){_0x4c5b99['include']=[{'all':!![]}];}_0x4c5b99=_['merge']({},_0x4c5b99,_0x20c155[_0x27af('0x40')]);return db[_0x27af('0x2d')][_0x27af('0x49')](_0x4c5b99)[_0x27af('0x23')](handleEntityNotFound(_0x31eaa9,null))['then'](function(_0x9e180){if(_0x9e180){var _0x306c56=_0x9e180[_0x27af('0x24')]({'plain':!![]});_0x306c56=qs[_0x27af('0x53')](_0x306c56,['id',_0x27af('0x54'),_0x27af('0x55')]);_0x20c155['body']=_[_0x27af('0x53')](_0x20c155[_0x27af('0x56')],['id',_0x27af('0x54'),_0x27af('0x55')]);return db['Campaign'][_0x27af('0x4a')](_['merge'](_0x306c56,_0x20c155[_0x27af('0x56')]),{'include':_0x20c155[_0x27af('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0x27af('0x23')](function(_0x13a5a8){var _0x5c8ff6=_0x20c155['user'][_0x27af('0x24')]({'plain':!![]});if(!_0x5c8ff6)throw new Error(_0x27af('0x4b'));if(_0x5c8ff6[_0x27af('0x4c')]==='user'){var _0x45877e=_0x13a5a8[_0x27af('0x24')]({'plain':!![]});var _0x57733f=_0x27af('0x25');return db[_0x27af('0x4e')]['find']({'where':{'name':_0x57733f,'userProfileId':_0x5c8ff6['userProfileId']},'raw':!![]})[_0x27af('0x23')](function(_0x1fa50b){if(_0x1fa50b&&_0x1fa50b['autoAssociation']===0x0){return db['UserProfileResource'][_0x27af('0x4a')]({'name':_0x45877e[_0x27af('0x29')],'resourceId':_0x45877e['id'],'type':_0x1fa50b[_0x27af('0x29')],'sectionId':_0x1fa50b['id']},{})[_0x27af('0x23')](function(){return _0x13a5a8;});}else{return _0x13a5a8;}})[_0x27af('0x44')](function(_0x3515ee){logger[_0x27af('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3515ee);throw _0x3515ee;});}return _0x13a5a8;});}})['then'](respondWithResult(_0x31eaa9,0xc9))[_0x27af('0x44')](handleError(_0x31eaa9,null));};exports[_0x27af('0x22')]=function(_0xa692f6,_0x881c59){if(_0xa692f6[_0x27af('0x56')]['id']){delete _0xa692f6[_0x27af('0x56')]['id'];}return db[_0x27af('0x2d')][_0x27af('0x49')]({'where':{'id':_0xa692f6[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x881c59,null))[_0x27af('0x23')](saveUpdates(_0xa692f6[_0x27af('0x56')],null))[_0x27af('0x23')](respondWithResult(_0x881c59,null))[_0x27af('0x44')](handleError(_0x881c59,null));};exports[_0x27af('0x57')]=function(_0x4932b8,_0x4601e9){return db['Campaign'][_0x27af('0x49')]({'where':{'id':_0x4932b8[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x4601e9,null))[_0x27af('0x23')](removeEntity(_0x4601e9,null))[_0x27af('0x44')](handleError(_0x4601e9,null));};exports[_0x27af('0x58')]=function(_0x2d1c61,_0x335a3b,_0x1816d0){var _0x5eee6b={'raw':!![],'where':{}};var _0x132ed4={};var _0x31a595={'count':0x0,'rows':[]};return db[_0x27af('0x2d')]['findOne']({'where':{'id':_0x2d1c61['params']['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x335a3b,null))['then'](function(_0x2e55a3){if(_0x2e55a3){_0x132ed4[_0x27af('0x30')]=_[_0x27af('0x32')](db[_0x27af('0x59')][_0x27af('0x5a')]);_0x132ed4['query']=_[_0x27af('0x32')](_0x2d1c61[_0x27af('0x31')]);_0x132ed4['filters']=_[_0x27af('0x34')](_0x132ed4[_0x27af('0x30')],_0x132ed4['query']);_0x5eee6b['attributes']=_[_0x27af('0x34')](_0x132ed4[_0x27af('0x30')],qs[_0x27af('0x36')](_0x2d1c61[_0x27af('0x31')][_0x27af('0x36')]));_0x5eee6b[_0x27af('0x35')]=_0x5eee6b[_0x27af('0x35')]['length']?_0x5eee6b[_0x27af('0x35')]:_0x132ed4[_0x27af('0x30')];if(!_0x2d1c61[_0x27af('0x31')][_0x27af('0x37')]('nolimit')){_0x5eee6b['limit']=qs[_0x27af('0x1d')](_0x2d1c61[_0x27af('0x31')][_0x27af('0x1d')]);_0x5eee6b[_0x27af('0x1b')]=qs['offset'](_0x2d1c61['query']['offset']);}_0x5eee6b[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x2d1c61[_0x27af('0x31')][_0x27af('0x3a')]);_0x5eee6b[_0x27af('0x3b')]=qs[_0x27af('0x33')](_['pick'](_0x2d1c61['query'],_0x132ed4[_0x27af('0x33')]));_0x5eee6b[_0x27af('0x3b')][_0x27af('0x5b')]=_0x2e55a3['id'];if(_0x2d1c61[_0x27af('0x31')]['filter']){_0x5eee6b['where']=_[_0x27af('0x3e')](_0x5eee6b[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x5eee6b[_0x27af('0x35')],function(_0x2b7e18){var _0x22e9ba={};_0x22e9ba[_0x2b7e18]={'$like':'%'+_0x2d1c61[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x22e9ba;})});}_0x5eee6b=_[_0x27af('0x3e')]({},_0x5eee6b,_0x2d1c61[_0x27af('0x40')]);return db[_0x27af('0x59')]['count']({'where':_0x5eee6b[_0x27af('0x3b')]})[_0x27af('0x23')](function(_0x1bfb41){_0x31a595['count']=_0x1bfb41;if(_0x2d1c61[_0x27af('0x31')][_0x27af('0x41')]){_0x5eee6b[_0x27af('0x48')]=[{'all':!![]}];}return db['CmHopper'][_0x27af('0x42')](_0x5eee6b);})['then'](function(_0x118d06){_0x31a595[_0x27af('0x43')]=_0x118d06;return _0x31a595;});}})[_0x27af('0x23')](respondWithFilteredResult(_0x335a3b,_0x5eee6b))[_0x27af('0x44')](handleError(_0x335a3b,null));};exports[_0x27af('0x5c')]=function(_0x290ea9,_0x4204bc,_0x1c62b4){var _0x587534={'raw':!![],'where':{}};var _0x76ae43={};var _0x4a2e9f={'count':0x0,'rows':[]};return db[_0x27af('0x2d')][_0x27af('0x5d')]({'where':{'id':_0x290ea9[_0x27af('0x46')]['id']}})['then'](handleEntityNotFound(_0x4204bc,null))['then'](function(_0xdf26ea){if(_0xdf26ea){_0x76ae43[_0x27af('0x30')]=_[_0x27af('0x32')](db['CmHopperHistory']['rawAttributes']);_0x76ae43['query']=_[_0x27af('0x32')](_0x290ea9[_0x27af('0x31')]);_0x76ae43['filters']=_[_0x27af('0x34')](_0x76ae43[_0x27af('0x30')],_0x76ae43['query']);_0x587534[_0x27af('0x35')]=_[_0x27af('0x34')](_0x76ae43[_0x27af('0x30')],qs[_0x27af('0x36')](_0x290ea9['query'][_0x27af('0x36')]));_0x587534[_0x27af('0x35')]=_0x587534[_0x27af('0x35')][_0x27af('0x47')]?_0x587534[_0x27af('0x35')]:_0x76ae43['model'];if(!_0x290ea9['query'][_0x27af('0x37')](_0x27af('0x38'))){_0x587534['limit']=qs[_0x27af('0x1d')](_0x290ea9[_0x27af('0x31')][_0x27af('0x1d')]);_0x587534[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0x290ea9[_0x27af('0x31')]['offset']);}_0x587534[_0x27af('0x39')]=qs['sort'](_0x290ea9[_0x27af('0x31')][_0x27af('0x3a')]);_0x587534[_0x27af('0x3b')]=qs[_0x27af('0x33')](_[_0x27af('0x3c')](_0x290ea9['query'],_0x76ae43[_0x27af('0x33')]));_0x587534[_0x27af('0x3b')][_0x27af('0x5b')]=_0xdf26ea['id'];if(_0x290ea9[_0x27af('0x31')][_0x27af('0x3d')]){_0x587534[_0x27af('0x3b')]=_['merge'](_0x587534[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x587534['attributes'],function(_0xa67082){var _0x5444df={};_0x5444df[_0xa67082]={'$like':'%'+_0x290ea9[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x5444df;})});}_0x587534=_[_0x27af('0x3e')]({},_0x587534,_0x290ea9[_0x27af('0x40')]);return db[_0x27af('0x5e')]['count']({'where':_0x587534[_0x27af('0x3b')]})[_0x27af('0x23')](function(_0x222993){_0x4a2e9f[_0x27af('0x1e')]=_0x222993;if(_0x290ea9[_0x27af('0x31')]['includeAll']){_0x587534[_0x27af('0x48')]=[{'all':!![]}];}return db[_0x27af('0x5e')]['findAll'](_0x587534);})[_0x27af('0x23')](function(_0x456f81){_0x4a2e9f[_0x27af('0x43')]=_0x456f81;return _0x4a2e9f;});}})[_0x27af('0x23')](respondWithFilteredResult(_0x4204bc,_0x587534))[_0x27af('0x44')](handleError(_0x4204bc,null));};exports['getHopperFinals']=function(_0x19fca2,_0x5de6c9,_0x102ae4){var _0x1d25bc={'raw':!![],'where':{}};var _0x5398e9={};var _0x2d196d={'count':0x0,'rows':[]};return db[_0x27af('0x2d')][_0x27af('0x5d')]({'where':{'id':_0x19fca2[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x5de6c9,null))[_0x27af('0x23')](function(_0x193ad7){if(_0x193ad7){_0x5398e9['model']=_[_0x27af('0x32')](db[_0x27af('0x5f')][_0x27af('0x5a')]);_0x5398e9[_0x27af('0x31')]=_[_0x27af('0x32')](_0x19fca2[_0x27af('0x31')]);_0x5398e9[_0x27af('0x33')]=_[_0x27af('0x34')](_0x5398e9['model'],_0x5398e9[_0x27af('0x31')]);_0x1d25bc[_0x27af('0x35')]=_['intersection'](_0x5398e9['model'],qs[_0x27af('0x36')](_0x19fca2[_0x27af('0x31')][_0x27af('0x36')]));_0x1d25bc[_0x27af('0x35')]=_0x1d25bc[_0x27af('0x35')][_0x27af('0x47')]?_0x1d25bc[_0x27af('0x35')]:_0x5398e9['model'];if(!_0x19fca2[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x1d25bc[_0x27af('0x1d')]=qs[_0x27af('0x1d')](_0x19fca2[_0x27af('0x31')]['limit']);_0x1d25bc[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0x19fca2[_0x27af('0x31')][_0x27af('0x1b')]);}_0x1d25bc['order']=qs['sort'](_0x19fca2[_0x27af('0x31')][_0x27af('0x3a')]);_0x1d25bc['where']=qs[_0x27af('0x33')](_['pick'](_0x19fca2[_0x27af('0x31')],_0x5398e9['filters']));_0x1d25bc[_0x27af('0x3b')][_0x27af('0x5b')]=_0x193ad7['id'];if(_0x19fca2[_0x27af('0x31')][_0x27af('0x3d')]){_0x1d25bc['where']=_[_0x27af('0x3e')](_0x1d25bc[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x1d25bc[_0x27af('0x35')],function(_0x40f8a0){var _0x431ec6={};_0x431ec6[_0x40f8a0]={'$like':'%'+_0x19fca2['query']['filter']+'%'};return _0x431ec6;})});}_0x1d25bc=_['merge']({},_0x1d25bc,_0x19fca2[_0x27af('0x40')]);return db['CmHopperFinal'][_0x27af('0x1e')]({'where':_0x1d25bc[_0x27af('0x3b')]})[_0x27af('0x23')](function(_0x59e66d){_0x2d196d['count']=_0x59e66d;if(_0x19fca2[_0x27af('0x31')][_0x27af('0x41')]){_0x1d25bc[_0x27af('0x48')]=[{'all':!![]}];}return db[_0x27af('0x5f')][_0x27af('0x42')](_0x1d25bc);})[_0x27af('0x23')](function(_0x9019){_0x2d196d[_0x27af('0x43')]=_0x9019;return _0x2d196d;});}})[_0x27af('0x23')](respondWithFilteredResult(_0x5de6c9,_0x1d25bc))[_0x27af('0x44')](handleError(_0x5de6c9,null));};exports[_0x27af('0x60')]=function(_0x15adcf,_0x1ba86c,_0x1a3ba7){var _0x25c1fa={'raw':!![],'where':{}};var _0x10d373={};var _0x4c412b={'count':0x0,'rows':[]};return db[_0x27af('0x2d')][_0x27af('0x5d')]({'where':{'id':_0x15adcf[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x1ba86c,null))[_0x27af('0x23')](function(_0x560260){if(_0x560260){_0x10d373[_0x27af('0x30')]=_[_0x27af('0x32')](db[_0x27af('0x61')][_0x27af('0x5a')]);_0x10d373[_0x27af('0x31')]=_['keys'](_0x15adcf[_0x27af('0x31')]);_0x10d373[_0x27af('0x33')]=_['intersection'](_0x10d373['model'],_0x10d373[_0x27af('0x31')]);_0x25c1fa['attributes']=_['intersection'](_0x10d373[_0x27af('0x30')],qs['fields'](_0x15adcf[_0x27af('0x31')][_0x27af('0x36')]));_0x25c1fa[_0x27af('0x35')]=_0x25c1fa['attributes'][_0x27af('0x47')]?_0x25c1fa['attributes']:_0x10d373[_0x27af('0x30')];if(!_0x15adcf[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x25c1fa[_0x27af('0x1d')]=qs[_0x27af('0x1d')](_0x15adcf[_0x27af('0x31')][_0x27af('0x1d')]);_0x25c1fa[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0x15adcf[_0x27af('0x31')][_0x27af('0x1b')]);}_0x25c1fa[_0x27af('0x39')]=qs[_0x27af('0x3a')](_0x15adcf[_0x27af('0x31')][_0x27af('0x3a')]);_0x25c1fa[_0x27af('0x3b')]=qs['filters'](_[_0x27af('0x3c')](_0x15adcf[_0x27af('0x31')],_0x10d373[_0x27af('0x33')]));_0x25c1fa[_0x27af('0x3b')]['CampaignId']=_0x560260['id'];if(_0x15adcf['query'][_0x27af('0x3d')]){_0x25c1fa['where']=_[_0x27af('0x3e')](_0x25c1fa[_0x27af('0x3b')],{'$or':_[_0x27af('0x2c')](_0x25c1fa[_0x27af('0x35')],function(_0x3b960d){var _0x5e2b86={};_0x5e2b86[_0x3b960d]={'$like':'%'+_0x15adcf['query'][_0x27af('0x3d')]+'%'};return _0x5e2b86;})});}_0x25c1fa=_['merge']({},_0x25c1fa,_0x15adcf[_0x27af('0x40')]);return db[_0x27af('0x61')][_0x27af('0x1e')]({'where':_0x25c1fa[_0x27af('0x3b')]})[_0x27af('0x23')](function(_0x46c09b){_0x4c412b[_0x27af('0x1e')]=_0x46c09b;if(_0x15adcf['query'][_0x27af('0x41')]){_0x25c1fa['include']=[{'all':!![]}];}return db[_0x27af('0x61')][_0x27af('0x42')](_0x25c1fa);})[_0x27af('0x23')](function(_0x29dc0d){_0x4c412b[_0x27af('0x43')]=_0x29dc0d;return _0x4c412b;});}})[_0x27af('0x23')](respondWithFilteredResult(_0x1ba86c,_0x25c1fa))[_0x27af('0x44')](handleError(_0x1ba86c,null));};exports['getLists']=function(_0x1dd20d,_0x2fcd91,_0x2f7a18){var _0x34c69b={};var _0x371bbf={};var _0x1ec11c;var _0x15e041;return db['Campaign']['findOne']({'where':{'id':_0x1dd20d[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x2fcd91,null))[_0x27af('0x23')](function(_0x37246a){if(_0x37246a){_0x1ec11c=_0x37246a;_0x371bbf[_0x27af('0x30')]=_['keys'](db['CmList'][_0x27af('0x5a')]);_0x371bbf[_0x27af('0x31')]=_[_0x27af('0x32')](_0x1dd20d[_0x27af('0x31')]);_0x371bbf[_0x27af('0x33')]=_['intersection'](_0x371bbf[_0x27af('0x30')],_0x371bbf[_0x27af('0x31')]);_0x34c69b['attributes']=_[_0x27af('0x34')](_0x371bbf[_0x27af('0x30')],qs['fields'](_0x1dd20d[_0x27af('0x31')][_0x27af('0x36')]));_0x34c69b[_0x27af('0x35')]=_0x34c69b[_0x27af('0x35')][_0x27af('0x47')]?_0x34c69b[_0x27af('0x35')]:_0x371bbf[_0x27af('0x30')];_0x34c69b['order']=qs[_0x27af('0x3a')](_0x1dd20d[_0x27af('0x31')][_0x27af('0x3a')]);_0x34c69b[_0x27af('0x3b')]=qs[_0x27af('0x33')](_[_0x27af('0x3c')](_0x1dd20d['query'],_0x371bbf[_0x27af('0x33')]));if(_0x1dd20d['query'][_0x27af('0x3d')]){_0x34c69b[_0x27af('0x3b')]=_[_0x27af('0x3e')](_0x34c69b['where'],{'$or':_[_0x27af('0x2c')](_0x34c69b[_0x27af('0x35')],function(_0x524cb2){var _0x4fb596={};_0x4fb596[_0x524cb2]={'$like':'%'+_0x1dd20d[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x4fb596;})});}_0x34c69b=_['merge']({},_0x34c69b,_0x1dd20d['options']);return _0x1ec11c['getLists'](_0x34c69b);}})[_0x27af('0x23')](function(_0x57dfe3){if(_0x57dfe3){_0x15e041=_0x57dfe3[_0x27af('0x47')];if(!_0x1dd20d[_0x27af('0x31')][_0x27af('0x37')]('nolimit')){_0x34c69b[_0x27af('0x1d')]=qs[_0x27af('0x1d')](_0x1dd20d[_0x27af('0x31')][_0x27af('0x1d')]);_0x34c69b[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0x1dd20d[_0x27af('0x31')][_0x27af('0x1b')]);}return _0x1ec11c[_0x27af('0x62')](_0x34c69b);}})['then'](function(_0xd0bbd4){if(_0xd0bbd4){return _0xd0bbd4?{'count':_0x15e041,'rows':_0xd0bbd4}:null;}})[_0x27af('0x23')](respondWithResult(_0x2fcd91,null))[_0x27af('0x44')](handleError(_0x2fcd91,null));};exports[_0x27af('0x63')]=function(_0x2c49a6,_0x3e306c,_0x259b87){var _0x49d24d,_0x20aab5;var _0x20a7e2=[];var _0x3ea469=moment()[_0x27af('0x64')](_0x27af('0x65'));return db[_0x27af('0x2d')][_0x27af('0x49')]({'where':{'id':_0x2c49a6['params']['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x3e306c,null))[_0x27af('0x23')](function(_0x104c67){if(_0x104c67){_0x20aab5=_0x104c67;return _0x104c67['addLists'](_0x2c49a6[_0x27af('0x56')][_0x27af('0x66')],_['omit'](_0x2c49a6[_0x27af('0x56')],[_0x27af('0x66'),'id'])||{});}return null;})['spread'](function(_0x308bf0){var _0x2559a1;var _0x4b22b1;_0x49d24d=_0x308bf0||[];var _0x1d7059=[];if(_0x308bf0){for(var _0x5c4985=0x0;_0x5c4985<_0x308bf0[_0x27af('0x47')];_0x5c4985+=0x1){var _0x37fdb9=_0x308bf0[_0x5c4985][_0x27af('0x24')]({'plain':!![]});_0x20aab5[_0x27af('0x67')]=_0x2c49a6[_0x27af('0x56')][_0x27af('0x67')]?_0x2c49a6[_0x27af('0x56')]['dialCheckDuplicateType']:_0x20aab5['dialCheckDuplicateType'];switch(_0x20aab5[_0x27af('0x67')]){case'always':_0x2559a1=squel[_0x27af('0x68')]()[_0x27af('0x69')](_0x27af('0x6a'))[_0x27af('0x6b')]([_0x27af('0x6c'),_0x27af('0x6d'),_0x27af('0x6e'),_0x27af('0x6f'),_0x27af('0x5b'),'createdAt',_0x27af('0x55')],squel[_0x27af('0x70')]()['field'](_0x27af('0x6c'),'phone')[_0x27af('0x71')](_0x27af('0x72'),_0x27af('0x6d'))[_0x27af('0x71')]('id',_0x27af('0x6e'))['field'](_0x37fdb9[_0x27af('0x73')]['toString'](),_0x27af('0x6f'))['field'](_0x2c49a6[_0x27af('0x46')]['id'][_0x27af('0x74')](),_0x27af('0x5b'))['field']('\x27'+_0x3ea469+'\x27',_0x27af('0x54'))['field']('\x27'+_0x3ea469+'\x27',_0x27af('0x55'))[_0x27af('0x75')]('cm_contacts')[_0x27af('0x3b')](_0x27af('0x76'))['where'](_0x27af('0x77'),_0x37fdb9[_0x27af('0x73')]['toString']())[_0x27af('0x3b')](_0x27af('0x78'))[_0x27af('0x3b')](_0x27af('0x79'),squel[_0x27af('0x70')]()[_0x27af('0x71')](_0x27af('0x7a'))[_0x27af('0x75')]('cm_hopper_final')['where'](_0x27af('0x7b'),_0x2c49a6[_0x27af('0x46')]['id'][_0x27af('0x74')]()))['where'](_0x27af('0x79'),squel[_0x27af('0x70')]()[_0x27af('0x71')](_0x27af('0x7c'))[_0x27af('0x75')](_0x27af('0x6a'))[_0x27af('0x3b')](_0x27af('0x7b'),_0x2c49a6[_0x27af('0x46')]['id'][_0x27af('0x74')]())))['toString']();break;case'onlyIfOpen':_0x2559a1=squel[_0x27af('0x68')]()[_0x27af('0x69')](_0x27af('0x6a'))[_0x27af('0x6b')]([_0x27af('0x6c'),_0x27af('0x6d'),_0x27af('0x6e'),_0x27af('0x6f'),_0x27af('0x5b'),'createdAt',_0x27af('0x55')],squel[_0x27af('0x70')]()[_0x27af('0x71')](_0x27af('0x6c'),_0x27af('0x6c'))[_0x27af('0x71')](_0x27af('0x72'),_0x27af('0x6d'))[_0x27af('0x71')]('id',_0x27af('0x6e'))[_0x27af('0x71')](_0x37fdb9[_0x27af('0x73')][_0x27af('0x74')](),_0x27af('0x6f'))[_0x27af('0x71')](_0x2c49a6[_0x27af('0x46')]['id'][_0x27af('0x74')](),'CampaignId')[_0x27af('0x71')]('\x27'+_0x3ea469+'\x27','createdAt')[_0x27af('0x71')]('\x27'+_0x3ea469+'\x27',_0x27af('0x55'))[_0x27af('0x75')](_0x27af('0x7d'))[_0x27af('0x3b')](_0x27af('0x76'))[_0x27af('0x3b')](_0x27af('0x77'),_0x37fdb9[_0x27af('0x73')][_0x27af('0x74')]())[_0x27af('0x3b')](_0x27af('0x78'))[_0x27af('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x27af('0x71')](_0x27af('0x7c'))['from'](_0x27af('0x6a'))[_0x27af('0x3b')](_0x27af('0x7b'),_0x2c49a6['params']['id'][_0x27af('0x74')]())))[_0x27af('0x74')]();break;default:_0x2559a1=squel[_0x27af('0x68')]()['into'](_0x27af('0x6a'))['fromQuery'](['phone','scheduledAt','ContactId',_0x27af('0x6f'),'CampaignId',_0x27af('0x54'),_0x27af('0x55')],squel[_0x27af('0x70')]()[_0x27af('0x71')]('phone',_0x27af('0x6c'))[_0x27af('0x71')](_0x27af('0x72'),_0x27af('0x6d'))['field']('id',_0x27af('0x6e'))['field'](_0x37fdb9['CmListId'][_0x27af('0x74')](),'ListId')[_0x27af('0x71')](_0x2c49a6[_0x27af('0x46')]['id'][_0x27af('0x74')](),_0x27af('0x5b'))[_0x27af('0x71')]('\x27'+_0x3ea469+'\x27',_0x27af('0x54'))[_0x27af('0x71')]('\x27'+_0x3ea469+'\x27',_0x27af('0x55'))['from'](_0x27af('0x7d'))[_0x27af('0x3b')](_0x27af('0x76'))['where'](_0x27af('0x77'),_0x37fdb9[_0x27af('0x73')][_0x27af('0x74')]())[_0x27af('0x3b')](_0x27af('0x78')))[_0x27af('0x74')]();}_0x4b22b1=squel[_0x27af('0x68')]()['into'](_0x27af('0x7e'))['fromQuery']([_0x27af('0x7f'),_0x27af('0x6d'),_0x27af('0x6c'),_0x27af('0x80'),_0x27af('0x54'),_0x27af('0x55')],squel['select']()[_0x27af('0x71')](_0x27af('0x81'),'id')['field'](_0x27af('0x72'),_0x27af('0x6d'))[_0x27af('0x71')](_0x27af('0x82'),_0x27af('0x6c'))[_0x27af('0x71')](_0x27af('0x83'),_0x27af('0x80'))[_0x27af('0x71')]('\x27'+_0x3ea469+'\x27',_0x27af('0x54'))['field']('\x27'+_0x3ea469+'\x27','updatedAt')[_0x27af('0x75')]('cm_contact_has_items','ci')[_0x27af('0x84')](_0x27af('0x6a'),'h',_0x27af('0x85'))[_0x27af('0x3b')](_0x27af('0x86'),_0x37fdb9['CmListId'][_0x27af('0x74')]())[_0x27af('0x3b')](_0x27af('0x87'),_0x2c49a6[_0x27af('0x46')]['id']['toString']())['where'](_0x27af('0x88'),_0x3ea469))[_0x27af('0x74')]();_0x1d7059[_0x27af('0x89')](db[_0x27af('0x8a')][_0x27af('0x31')](_0x2559a1));_0x20a7e2[_0x27af('0x89')](db[_0x27af('0x8a')]['query'](_0x4b22b1));}return BPromise[_0x27af('0x8b')](_0x1d7059);}})[_0x27af('0x23')](function(){return BPromise[_0x27af('0x8b')](_0x20a7e2);})[_0x27af('0x23')](function(){return _0x49d24d;})[_0x27af('0x23')](respondWithResult(_0x3e306c,null))[_0x27af('0x44')](handleError(_0x3e306c,null));};exports[_0x27af('0x8c')]=function(_0x46aed5,_0x3de42c,_0x5c4632){return db[_0x27af('0x2d')]['find']({'where':{'id':_0x46aed5[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x3de42c,null))[_0x27af('0x23')](function(_0x4e5787){if(_0x4e5787){return _0x4e5787[_0x27af('0x8c')](_0x46aed5['query'][_0x27af('0x66')]);}})[_0x27af('0x23')](function(_0xb09ec2){if(_0xb09ec2){return db[_0x27af('0x59')][_0x27af('0x57')]({'where':{'ListId':_0x46aed5[_0x27af('0x31')]['ids'],'CampaignId':_0x46aed5[_0x27af('0x46')]['id']}})['then'](function(){return _0xb09ec2;});}})['then'](respondWithStatusCode(_0x3de42c,null))[_0x27af('0x44')](handleError(_0x3de42c,null));};exports[_0x27af('0x8d')]=function(_0x2b1d86,_0x38ba34,_0x1b0824){var _0x4e9058={};var _0x116dda={};var _0x3c68cd;var _0x562392;return db[_0x27af('0x2d')][_0x27af('0x5d')]({'where':{'id':_0x2b1d86['params']['id']}})['then'](handleEntityNotFound(_0x38ba34,null))[_0x27af('0x23')](function(_0x2de182){if(_0x2de182){_0x3c68cd=_0x2de182;_0x116dda[_0x27af('0x30')]=_['keys'](db[_0x27af('0x8e')][_0x27af('0x5a')]);_0x116dda[_0x27af('0x31')]=_[_0x27af('0x32')](_0x2b1d86['query']);_0x116dda[_0x27af('0x33')]=_[_0x27af('0x34')](_0x116dda[_0x27af('0x30')],_0x116dda[_0x27af('0x31')]);_0x4e9058['attributes']=_['intersection'](_0x116dda[_0x27af('0x30')],qs[_0x27af('0x36')](_0x2b1d86[_0x27af('0x31')][_0x27af('0x36')]));_0x4e9058[_0x27af('0x35')]=_0x4e9058[_0x27af('0x35')][_0x27af('0x47')]?_0x4e9058[_0x27af('0x35')]:_0x116dda[_0x27af('0x30')];_0x4e9058['order']=qs['sort'](_0x2b1d86[_0x27af('0x31')][_0x27af('0x3a')]);_0x4e9058[_0x27af('0x3b')]=qs[_0x27af('0x33')](_['pick'](_0x2b1d86['query'],_0x116dda['filters']));if(_0x2b1d86[_0x27af('0x31')][_0x27af('0x3d')]){_0x4e9058[_0x27af('0x3b')]=_['merge'](_0x4e9058[_0x27af('0x3b')],{'$or':_['map'](_0x4e9058[_0x27af('0x35')],function(_0x3a484d){var _0x655cba={};_0x655cba[_0x3a484d]={'$like':'%'+_0x2b1d86[_0x27af('0x31')][_0x27af('0x3d')]+'%'};return _0x655cba;})});}_0x4e9058=_[_0x27af('0x3e')]({},_0x4e9058,_0x2b1d86['options']);return _0x3c68cd[_0x27af('0x8d')](_0x4e9058);}})[_0x27af('0x23')](function(_0x1b2f54){if(_0x1b2f54){_0x562392=_0x1b2f54[_0x27af('0x47')];if(!_0x2b1d86[_0x27af('0x31')][_0x27af('0x37')](_0x27af('0x38'))){_0x4e9058[_0x27af('0x1d')]=qs[_0x27af('0x1d')](_0x2b1d86['query'][_0x27af('0x1d')]);_0x4e9058['offset']=qs[_0x27af('0x1b')](_0x2b1d86['query'][_0x27af('0x1b')]);}return _0x3c68cd[_0x27af('0x8d')](_0x4e9058);}})[_0x27af('0x23')](function(_0x26ff49){if(_0x26ff49){return _0x26ff49?{'count':_0x562392,'rows':_0x26ff49}:null;}})[_0x27af('0x23')](respondWithResult(_0x38ba34,null))[_0x27af('0x44')](handleError(_0x38ba34,null));};exports[_0x27af('0x8f')]=function(_0x374a8c,_0x5e80eb,_0x580d23){var _0x8ae423,_0x335132;var _0x14c022=[];var _0x596f57=moment()['format'](_0x27af('0x65'));return db['Campaign'][_0x27af('0x49')]({'where':{'id':_0x374a8c['params']['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x5e80eb,null))[_0x27af('0x23')](function(_0xc4f7b8){if(_0xc4f7b8){_0x335132=_0xc4f7b8;return _0xc4f7b8[_0x27af('0x8f')](_0x374a8c[_0x27af('0x56')][_0x27af('0x66')],_[_0x27af('0x53')](_0x374a8c[_0x27af('0x56')],[_0x27af('0x66'),'id'])||{});}return null;})[_0x27af('0x90')](function(_0x3c38bb){var _0x424325;var _0x46c05a;_0x8ae423=_0x3c38bb||[];var _0x45a431=[];if(_0x3c38bb){for(var _0x10c294=0x0;_0x10c294<_0x3c38bb['length'];_0x10c294+=0x1){var _0x53dcad=_0x3c38bb[_0x10c294][_0x27af('0x24')]({'plain':!![]});_0x424325=squel[_0x27af('0x68')]()[_0x27af('0x69')]('cm_hopper_black')[_0x27af('0x6b')]([_0x27af('0x6c'),_0x27af('0x6e'),'ListId',_0x27af('0x5b'),_0x27af('0x54'),'updatedAt'],squel[_0x27af('0x70')]()[_0x27af('0x71')](_0x27af('0x6c'),_0x27af('0x6c'))[_0x27af('0x71')]('id','ContactId')[_0x27af('0x71')](_0x53dcad[_0x27af('0x73')][_0x27af('0x74')](),'ListId')['field'](_0x374a8c[_0x27af('0x46')]['id']['toString'](),_0x27af('0x5b'))[_0x27af('0x71')]('NOW()','createdAt')['field'](_0x27af('0x72'),_0x27af('0x55'))['from'](_0x27af('0x7d'))['where'](_0x27af('0x76'))[_0x27af('0x3b')](_0x27af('0x77'),_0x53dcad[_0x27af('0x73')]['toString']())[_0x27af('0x3b')](_0x27af('0x78')))[_0x27af('0x74')]();_0x45a431['push'](db['sequelize'][_0x27af('0x31')](_0x424325));}return BPromise['all'](_0x45a431);}})[_0x27af('0x23')](function(){return _0x8ae423;})[_0x27af('0x23')](respondWithResult(_0x5e80eb,null))[_0x27af('0x44')](handleError(_0x5e80eb,null));};exports['removeBlackLists']=function(_0x322ed6,_0x245c3c,_0x5d227e){return db[_0x27af('0x2d')][_0x27af('0x49')]({'where':{'id':_0x322ed6[_0x27af('0x46')]['id']}})[_0x27af('0x23')](handleEntityNotFound(_0x245c3c,null))[_0x27af('0x23')](function(_0x274612){if(_0x274612){return _0x274612['removeBlackLists'](_0x322ed6['query'][_0x27af('0x66')]);}})[_0x27af('0x23')](function(_0x254820){if(_0x254820){return db[_0x27af('0x61')][_0x27af('0x57')]({'where':{'ListId':_0x322ed6['query'][_0x27af('0x66')],'CampaignId':_0x322ed6[_0x27af('0x46')]['id']}})['then'](function(){return _0x254820;});}})[_0x27af('0x23')](respondWithStatusCode(_0x245c3c,null))[_0x27af('0x44')](handleError(_0x245c3c,null));}; \ No newline at end of file +var _0x0457=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','IvrCampaigns','destroy','then','end','error','stack','name','send','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','options','Campaign','includeAll','include','findAll','rows','catch','keys','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','clone','omit','createdAt','updatedAt','role','user','getHoppers','findOne','params','CmHopper','hasOwnProperty','pick','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','removeBlackLists','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x0457,0x11f));var _0x7045=function(_0x1a51db,_0x2eecdc){_0x1a51db=_0x1a51db-0x0;var _0xea0473=_0x0457[_0x1a51db];return _0xea0473;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7045('0x0'));var zipdir=require(_0x7045('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7045('0x2'));var moment=require(_0x7045('0x3'));var BPromise=require(_0x7045('0x4'));var Mustache=require(_0x7045('0x5'));var util=require(_0x7045('0x6'));var path=require(_0x7045('0x7'));var sox=require('sox');var csv=require(_0x7045('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7045('0x9'));var _=require(_0x7045('0xa'));var squel=require(_0x7045('0xb'));var crypto=require(_0x7045('0xc'));var jsforce=require(_0x7045('0xd'));var deskjs=require(_0x7045('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7045('0xf'));var Redis=require(_0x7045('0x10'));var authService=require(_0x7045('0x11'));var qs=require(_0x7045('0x12'));var as=require(_0x7045('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7045('0x14'))(_0x7045('0x15'));var utils=require(_0x7045('0x16'));var config=require(_0x7045('0x17'));var licenseUtil=require(_0x7045('0x18'));var db=require(_0x7045('0x19'))['db'];function respondWithStatusCode(_0x132ece,_0x5230a8){_0x5230a8=_0x5230a8||0xcc;return function(_0x12cfc2){if(_0x12cfc2){return _0x132ece[_0x7045('0x1a')](_0x5230a8);}return _0x132ece['status'](_0x5230a8)['end']();};}function respondWithResult(_0x426243,_0x1dee00){_0x1dee00=_0x1dee00||0xc8;return function(_0x47fc71){if(_0x47fc71){return _0x426243[_0x7045('0x1b')](_0x1dee00)[_0x7045('0x1c')](_0x47fc71);}};}function respondWithFilteredResult(_0x364b86,_0x38c059){return function(_0xb8fdae){if(_0xb8fdae){var _0x50ede5=typeof _0x38c059[_0x7045('0x1d')]===_0x7045('0x1e')&&typeof _0x38c059[_0x7045('0x1f')]===_0x7045('0x1e');var _0x16ee34=_0xb8fdae[_0x7045('0x20')];var _0x24a865=_0x50ede5?0x0:_0x38c059[_0x7045('0x1d')];var _0x3267a1=_0x50ede5?_0xb8fdae[_0x7045('0x20')]:_0x38c059['offset']+_0x38c059['limit'];var _0x6514;if(_0x3267a1>=_0x16ee34){_0x3267a1=_0x16ee34;_0x6514=0xc8;}else{_0x6514=0xce;}_0x364b86[_0x7045('0x1b')](_0x6514);return _0x364b86[_0x7045('0x21')](_0x7045('0x22'),_0x24a865+'-'+_0x3267a1+'/'+_0x16ee34)['json'](_0xb8fdae);}return null;};}function patchUpdates(_0x4a438d){return function(_0xd3ecd5){try{jsonpatch[_0x7045('0x23')](_0xd3ecd5,_0x4a438d,!![]);}catch(_0x2aae86){return BPromise['reject'](_0x2aae86);}return _0xd3ecd5[_0x7045('0x24')]();};}function saveUpdates(_0x45f89b,_0x4ac436){return function(_0x17edf7){if(_0x17edf7){return _0x17edf7[_0x7045('0x25')](_0x45f89b)['then'](function(_0x4c76f){return _0x4c76f;});}return null;};}function removeEntity(_0x4003ad,_0x1ac24f){return function(_0x466803){if(_0x466803){return _0x466803['destroy']()['then'](function(){var _0x3b66c8=_0x466803[_0x7045('0x26')]({'plain':!![]});var _0x1bca48=_0x7045('0x27');return db['UserProfileResource'][_0x7045('0x28')]({'where':{'type':_0x1bca48,'resourceId':_0x3b66c8['id']}})[_0x7045('0x29')](function(){return _0x466803;});})['then'](function(){_0x4003ad[_0x7045('0x1b')](0xcc)[_0x7045('0x2a')]();});}};}function handleEntityNotFound(_0x38658e,_0xc97840){return function(_0x4f41e8){if(!_0x4f41e8){_0x38658e[_0x7045('0x1a')](0x194);}return _0x4f41e8;};}function handleError(_0x349010,_0x37b288){_0x37b288=_0x37b288||0x1f4;return function(_0x2e7e65){logger[_0x7045('0x2b')](_0x2e7e65[_0x7045('0x2c')]);if(_0x2e7e65[_0x7045('0x2d')]){delete _0x2e7e65['name'];}_0x349010[_0x7045('0x1b')](_0x37b288)[_0x7045('0x2e')](_0x2e7e65);};}exports[_0x7045('0x2f')]=function(_0xee29f4,_0x2fdf19){var _0x565a28={},_0x25dd21={},_0x420fe7={'count':0x0,'rows':[]};var _0x5e7909=_[_0x7045('0x30')](db['Campaign']['rawAttributes'],function(_0x1b8147){return{'name':_0x1b8147[_0x7045('0x31')],'type':_0x1b8147[_0x7045('0x32')]['key']};});_0x25dd21[_0x7045('0x33')]=_[_0x7045('0x30')](_0x5e7909,_0x7045('0x2d'));_0x25dd21[_0x7045('0x34')]=_['keys'](_0xee29f4[_0x7045('0x34')]);_0x25dd21[_0x7045('0x35')]=_[_0x7045('0x36')](_0x25dd21['model'],_0x25dd21[_0x7045('0x34')]);_0x565a28[_0x7045('0x37')]=_[_0x7045('0x36')](_0x25dd21[_0x7045('0x33')],qs[_0x7045('0x38')](_0xee29f4[_0x7045('0x34')][_0x7045('0x38')]));_0x565a28['attributes']=_0x565a28['attributes'][_0x7045('0x39')]?_0x565a28['attributes']:_0x25dd21[_0x7045('0x33')];if(!_0xee29f4[_0x7045('0x34')]['hasOwnProperty'](_0x7045('0x3a'))){_0x565a28[_0x7045('0x1f')]=qs['limit'](_0xee29f4[_0x7045('0x34')][_0x7045('0x1f')]);_0x565a28[_0x7045('0x1d')]=qs[_0x7045('0x1d')](_0xee29f4[_0x7045('0x34')][_0x7045('0x1d')]);}_0x565a28[_0x7045('0x3b')]=qs[_0x7045('0x3c')](_0xee29f4[_0x7045('0x34')][_0x7045('0x3c')]);_0x565a28[_0x7045('0x3d')]=qs['filters'](_['pick'](_0xee29f4[_0x7045('0x34')],_0x25dd21[_0x7045('0x35')]),_0x5e7909);if(_0xee29f4[_0x7045('0x34')]['filter']){_0x565a28['where']=_['merge'](_0x565a28['where'],{'$or':_['map'](_0x5e7909,function(_0x3ca4c3){if(_0x3ca4c3[_0x7045('0x32')]!==_0x7045('0x3e')){var _0x6fec18={};_0x6fec18[_0x3ca4c3[_0x7045('0x2d')]]={'$like':'%'+_0xee29f4[_0x7045('0x34')][_0x7045('0x3f')]+'%'};return _0x6fec18;}})});}_0x565a28=_[_0x7045('0x40')]({},_0x565a28,_0xee29f4[_0x7045('0x41')]);var _0x333394={'where':_0x565a28[_0x7045('0x3d')]};return db[_0x7045('0x42')][_0x7045('0x20')](_0x333394)[_0x7045('0x29')](function(_0x5d4700){_0x420fe7[_0x7045('0x20')]=_0x5d4700;if(_0xee29f4[_0x7045('0x34')][_0x7045('0x43')]){_0x565a28[_0x7045('0x44')]=[{'all':!![]}];}return db[_0x7045('0x42')][_0x7045('0x45')](_0x565a28);})['then'](function(_0x92dded){_0x420fe7[_0x7045('0x46')]=_0x92dded;return _0x420fe7;})['then'](respondWithFilteredResult(_0x2fdf19,_0x565a28))[_0x7045('0x47')](handleError(_0x2fdf19,null));};exports['show']=function(_0x2df73f,_0x245adb){var _0x45b554={'raw':![],'where':{'id':_0x2df73f['params']['id']}},_0x20b1a5={};_0x20b1a5[_0x7045('0x33')]=_[_0x7045('0x48')](db[_0x7045('0x42')][_0x7045('0x49')]);_0x20b1a5[_0x7045('0x34')]=_[_0x7045('0x48')](_0x2df73f['query']);_0x20b1a5[_0x7045('0x35')]=_[_0x7045('0x36')](_0x20b1a5[_0x7045('0x33')],_0x20b1a5['query']);_0x45b554[_0x7045('0x37')]=_[_0x7045('0x36')](_0x20b1a5['model'],qs[_0x7045('0x38')](_0x2df73f[_0x7045('0x34')]['fields']));_0x45b554['attributes']=_0x45b554['attributes'][_0x7045('0x39')]?_0x45b554['attributes']:_0x20b1a5[_0x7045('0x33')];if(_0x2df73f['query'][_0x7045('0x43')]){_0x45b554[_0x7045('0x44')]=[{'all':!![]}];}_0x45b554=_['merge']({},_0x45b554,_0x2df73f[_0x7045('0x41')]);return db[_0x7045('0x42')]['find'](_0x45b554)[_0x7045('0x29')](handleEntityNotFound(_0x245adb,null))[_0x7045('0x29')](respondWithResult(_0x245adb,null))[_0x7045('0x47')](handleError(_0x245adb,null));};exports[_0x7045('0x4a')]=function(_0x3ab982,_0x26da26){return db[_0x7045('0x42')][_0x7045('0x4a')](_0x3ab982[_0x7045('0x4b')],{})[_0x7045('0x29')](function(_0x12ea05){var _0x25229a=_0x3ab982['user'][_0x7045('0x26')]({'plain':!![]});if(!_0x25229a)throw new Error(_0x7045('0x4c'));if(_0x25229a['role']==='user'){var _0x3774df=_0x12ea05[_0x7045('0x26')]({'plain':!![]});var _0x294997=_0x7045('0x27');return db[_0x7045('0x4d')][_0x7045('0x4e')]({'where':{'name':_0x294997,'userProfileId':_0x25229a[_0x7045('0x4f')]},'raw':!![]})[_0x7045('0x29')](function(_0x1ccaab){if(_0x1ccaab&&_0x1ccaab[_0x7045('0x50')]===0x0){return db[_0x7045('0x51')][_0x7045('0x4a')]({'name':_0x3774df['name'],'resourceId':_0x3774df['id'],'type':_0x1ccaab['name'],'sectionId':_0x1ccaab['id']},{})[_0x7045('0x29')](function(){return _0x12ea05;});}else{return _0x12ea05;}})[_0x7045('0x47')](function(_0x10cae2){logger[_0x7045('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10cae2);throw _0x10cae2;});}return _0x12ea05;})[_0x7045('0x29')](respondWithResult(_0x26da26,0xc9))[_0x7045('0x47')](handleError(_0x26da26,null));};exports[_0x7045('0x52')]=function(_0x2f0e5f,_0x4cfce6){var _0x52e713={'where':{'id':_0x2f0e5f['params']['id']}},_0x413340={};_0x413340[_0x7045('0x33')]=_['keys'](db[_0x7045('0x42')]['rawAttributes']);_0x52e713[_0x7045('0x37')]=_['intersection'](_0x413340[_0x7045('0x33')],qs[_0x7045('0x38')](_0x2f0e5f[_0x7045('0x34')]['fields']));_0x52e713[_0x7045('0x37')]=_0x52e713[_0x7045('0x37')][_0x7045('0x39')]?_0x52e713['attributes']:_0x413340[_0x7045('0x33')];if(_0x2f0e5f[_0x7045('0x34')][_0x7045('0x43')]){_0x52e713[_0x7045('0x44')]=[{'all':!![]}];}_0x52e713=_[_0x7045('0x40')]({},_0x52e713,_0x2f0e5f[_0x7045('0x41')]);return db[_0x7045('0x42')][_0x7045('0x4e')](_0x52e713)['then'](handleEntityNotFound(_0x4cfce6,null))[_0x7045('0x29')](function(_0x6298ed){if(_0x6298ed){var _0x515905=_0x6298ed['get']({'plain':!![]});_0x515905=qs[_0x7045('0x53')](_0x515905,['id',_0x7045('0x54'),_0x7045('0x55')]);_0x2f0e5f['body']=_[_0x7045('0x53')](_0x2f0e5f[_0x7045('0x4b')],['id',_0x7045('0x54'),_0x7045('0x55')]);return db[_0x7045('0x42')]['create'](_['merge'](_0x515905,_0x2f0e5f['body']),{'include':_0x2f0e5f[_0x7045('0x34')][_0x7045('0x43')]?[{'all':!![]}]:undefined})[_0x7045('0x29')](function(_0x2a2709){var _0x1bebf5=_0x2f0e5f['user'][_0x7045('0x26')]({'plain':!![]});if(!_0x1bebf5)throw new Error(_0x7045('0x4c'));if(_0x1bebf5[_0x7045('0x56')]===_0x7045('0x57')){var _0x5854f8=_0x2a2709[_0x7045('0x26')]({'plain':!![]});var _0x349b3e=_0x7045('0x27');return db[_0x7045('0x4d')][_0x7045('0x4e')]({'where':{'name':_0x349b3e,'userProfileId':_0x1bebf5['userProfileId']},'raw':!![]})[_0x7045('0x29')](function(_0x39fae3){if(_0x39fae3&&_0x39fae3[_0x7045('0x50')]===0x0){return db[_0x7045('0x51')][_0x7045('0x4a')]({'name':_0x5854f8[_0x7045('0x2d')],'resourceId':_0x5854f8['id'],'type':_0x39fae3['name'],'sectionId':_0x39fae3['id']},{})[_0x7045('0x29')](function(){return _0x2a2709;});}else{return _0x2a2709;}})[_0x7045('0x47')](function(_0x5bfece){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bfece);throw _0x5bfece;});}return _0x2a2709;});}})[_0x7045('0x29')](respondWithResult(_0x4cfce6,0xc9))[_0x7045('0x47')](handleError(_0x4cfce6,null));};exports[_0x7045('0x25')]=function(_0x2eea09,_0x2837e7){if(_0x2eea09[_0x7045('0x4b')]['id']){delete _0x2eea09[_0x7045('0x4b')]['id'];}return db[_0x7045('0x42')][_0x7045('0x4e')]({'where':{'id':_0x2eea09['params']['id']}})[_0x7045('0x29')](handleEntityNotFound(_0x2837e7,null))[_0x7045('0x29')](saveUpdates(_0x2eea09[_0x7045('0x4b')],null))[_0x7045('0x29')](respondWithResult(_0x2837e7,null))[_0x7045('0x47')](handleError(_0x2837e7,null));};exports[_0x7045('0x28')]=function(_0x295172,_0x43963f){return db[_0x7045('0x42')][_0x7045('0x4e')]({'where':{'id':_0x295172['params']['id']}})[_0x7045('0x29')](handleEntityNotFound(_0x43963f,null))[_0x7045('0x29')](removeEntity(_0x43963f,null))['catch'](handleError(_0x43963f,null));};exports[_0x7045('0x58')]=function(_0x5952c1,_0x4ebde2,_0x4223dc){var _0x337674={'raw':!![],'where':{}};var _0x22c2f9={};var _0x43c0c5={'count':0x0,'rows':[]};return db[_0x7045('0x42')][_0x7045('0x59')]({'where':{'id':_0x5952c1[_0x7045('0x5a')]['id']}})[_0x7045('0x29')](handleEntityNotFound(_0x4ebde2,null))[_0x7045('0x29')](function(_0x2e01dd){if(_0x2e01dd){_0x22c2f9[_0x7045('0x33')]=_[_0x7045('0x48')](db[_0x7045('0x5b')][_0x7045('0x49')]);_0x22c2f9[_0x7045('0x34')]=_['keys'](_0x5952c1[_0x7045('0x34')]);_0x22c2f9[_0x7045('0x35')]=_[_0x7045('0x36')](_0x22c2f9[_0x7045('0x33')],_0x22c2f9[_0x7045('0x34')]);_0x337674[_0x7045('0x37')]=_[_0x7045('0x36')](_0x22c2f9[_0x7045('0x33')],qs[_0x7045('0x38')](_0x5952c1[_0x7045('0x34')][_0x7045('0x38')]));_0x337674[_0x7045('0x37')]=_0x337674[_0x7045('0x37')][_0x7045('0x39')]?_0x337674['attributes']:_0x22c2f9['model'];if(!_0x5952c1[_0x7045('0x34')][_0x7045('0x5c')](_0x7045('0x3a'))){_0x337674[_0x7045('0x1f')]=qs['limit'](_0x5952c1[_0x7045('0x34')][_0x7045('0x1f')]);_0x337674[_0x7045('0x1d')]=qs[_0x7045('0x1d')](_0x5952c1[_0x7045('0x34')][_0x7045('0x1d')]);}_0x337674[_0x7045('0x3b')]=qs[_0x7045('0x3c')](_0x5952c1['query'][_0x7045('0x3c')]);_0x337674[_0x7045('0x3d')]=qs['filters'](_[_0x7045('0x5d')](_0x5952c1['query'],_0x22c2f9[_0x7045('0x35')]));_0x337674[_0x7045('0x3d')][_0x7045('0x5e')]=_0x2e01dd['id'];if(_0x5952c1[_0x7045('0x34')][_0x7045('0x3f')]){_0x337674[_0x7045('0x3d')]=_[_0x7045('0x40')](_0x337674[_0x7045('0x3d')],{'$or':_['map'](_0x337674[_0x7045('0x37')],function(_0x1441a9){var _0x488b4f={};_0x488b4f[_0x1441a9]={'$like':'%'+_0x5952c1[_0x7045('0x34')][_0x7045('0x3f')]+'%'};return _0x488b4f;})});}_0x337674=_['merge']({},_0x337674,_0x5952c1['options']);return db['CmHopper'][_0x7045('0x20')]({'where':_0x337674[_0x7045('0x3d')]})[_0x7045('0x29')](function(_0x54e6cd){_0x43c0c5[_0x7045('0x20')]=_0x54e6cd;if(_0x5952c1[_0x7045('0x34')][_0x7045('0x43')]){_0x337674[_0x7045('0x44')]=[{'all':!![]}];}return db[_0x7045('0x5b')][_0x7045('0x45')](_0x337674);})[_0x7045('0x29')](function(_0x485bef){_0x43c0c5[_0x7045('0x46')]=_0x485bef;return _0x43c0c5;});}})[_0x7045('0x29')](respondWithFilteredResult(_0x4ebde2,_0x337674))[_0x7045('0x47')](handleError(_0x4ebde2,null));};exports['getHopperHistories']=function(_0x42506a,_0x5ac475,_0x42ca05){var _0x1fd96d={'raw':!![],'where':{}};var _0x30c6d5={};var _0x22a4b4={'count':0x0,'rows':[]};return db[_0x7045('0x42')]['findOne']({'where':{'id':_0x42506a[_0x7045('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5ac475,null))[_0x7045('0x29')](function(_0x5753c8){if(_0x5753c8){_0x30c6d5[_0x7045('0x33')]=_[_0x7045('0x48')](db[_0x7045('0x5f')][_0x7045('0x49')]);_0x30c6d5['query']=_[_0x7045('0x48')](_0x42506a['query']);_0x30c6d5[_0x7045('0x35')]=_['intersection'](_0x30c6d5[_0x7045('0x33')],_0x30c6d5[_0x7045('0x34')]);_0x1fd96d['attributes']=_[_0x7045('0x36')](_0x30c6d5[_0x7045('0x33')],qs[_0x7045('0x38')](_0x42506a['query']['fields']));_0x1fd96d[_0x7045('0x37')]=_0x1fd96d['attributes'][_0x7045('0x39')]?_0x1fd96d[_0x7045('0x37')]:_0x30c6d5[_0x7045('0x33')];if(!_0x42506a[_0x7045('0x34')][_0x7045('0x5c')]('nolimit')){_0x1fd96d[_0x7045('0x1f')]=qs[_0x7045('0x1f')](_0x42506a[_0x7045('0x34')]['limit']);_0x1fd96d['offset']=qs[_0x7045('0x1d')](_0x42506a[_0x7045('0x34')]['offset']);}_0x1fd96d[_0x7045('0x3b')]=qs[_0x7045('0x3c')](_0x42506a[_0x7045('0x34')][_0x7045('0x3c')]);_0x1fd96d[_0x7045('0x3d')]=qs[_0x7045('0x35')](_['pick'](_0x42506a[_0x7045('0x34')],_0x30c6d5[_0x7045('0x35')]));_0x1fd96d[_0x7045('0x3d')][_0x7045('0x5e')]=_0x5753c8['id'];if(_0x42506a[_0x7045('0x34')]['filter']){_0x1fd96d[_0x7045('0x3d')]=_[_0x7045('0x40')](_0x1fd96d[_0x7045('0x3d')],{'$or':_['map'](_0x1fd96d[_0x7045('0x37')],function(_0x56373d){var _0xf2a9b1={};_0xf2a9b1[_0x56373d]={'$like':'%'+_0x42506a[_0x7045('0x34')]['filter']+'%'};return _0xf2a9b1;})});}_0x1fd96d=_['merge']({},_0x1fd96d,_0x42506a[_0x7045('0x41')]);return db[_0x7045('0x5f')][_0x7045('0x20')]({'where':_0x1fd96d['where']})['then'](function(_0xa064b7){_0x22a4b4['count']=_0xa064b7;if(_0x42506a['query'][_0x7045('0x43')]){_0x1fd96d['include']=[{'all':!![]}];}return db[_0x7045('0x5f')][_0x7045('0x45')](_0x1fd96d);})[_0x7045('0x29')](function(_0x3f3913){_0x22a4b4['rows']=_0x3f3913;return _0x22a4b4;});}})[_0x7045('0x29')](respondWithFilteredResult(_0x5ac475,_0x1fd96d))['catch'](handleError(_0x5ac475,null));};exports[_0x7045('0x60')]=function(_0x179214,_0x552e43,_0xdb98cf){var _0x27031b={'raw':!![],'where':{}};var _0x37f079={};var _0x89d997={'count':0x0,'rows':[]};return db[_0x7045('0x42')]['findOne']({'where':{'id':_0x179214[_0x7045('0x5a')]['id']}})[_0x7045('0x29')](handleEntityNotFound(_0x552e43,null))[_0x7045('0x29')](function(_0x6e3465){if(_0x6e3465){_0x37f079['model']=_[_0x7045('0x48')](db[_0x7045('0x61')][_0x7045('0x49')]);_0x37f079[_0x7045('0x34')]=_['keys'](_0x179214[_0x7045('0x34')]);_0x37f079['filters']=_[_0x7045('0x36')](_0x37f079['model'],_0x37f079[_0x7045('0x34')]);_0x27031b[_0x7045('0x37')]=_[_0x7045('0x36')](_0x37f079[_0x7045('0x33')],qs[_0x7045('0x38')](_0x179214[_0x7045('0x34')][_0x7045('0x38')]));_0x27031b[_0x7045('0x37')]=_0x27031b[_0x7045('0x37')]['length']?_0x27031b[_0x7045('0x37')]:_0x37f079['model'];if(!_0x179214[_0x7045('0x34')]['hasOwnProperty'](_0x7045('0x3a'))){_0x27031b['limit']=qs[_0x7045('0x1f')](_0x179214[_0x7045('0x34')][_0x7045('0x1f')]);_0x27031b[_0x7045('0x1d')]=qs[_0x7045('0x1d')](_0x179214[_0x7045('0x34')][_0x7045('0x1d')]);}_0x27031b[_0x7045('0x3b')]=qs[_0x7045('0x3c')](_0x179214[_0x7045('0x34')][_0x7045('0x3c')]);_0x27031b[_0x7045('0x3d')]=qs[_0x7045('0x35')](_['pick'](_0x179214['query'],_0x37f079[_0x7045('0x35')]));_0x27031b['where'][_0x7045('0x5e')]=_0x6e3465['id'];if(_0x179214[_0x7045('0x34')]['filter']){_0x27031b['where']=_[_0x7045('0x40')](_0x27031b[_0x7045('0x3d')],{'$or':_[_0x7045('0x30')](_0x27031b[_0x7045('0x37')],function(_0x175a07){var _0x41b98f={};_0x41b98f[_0x175a07]={'$like':'%'+_0x179214[_0x7045('0x34')][_0x7045('0x3f')]+'%'};return _0x41b98f;})});}_0x27031b=_[_0x7045('0x40')]({},_0x27031b,_0x179214[_0x7045('0x41')]);return db['CmHopperFinal'][_0x7045('0x20')]({'where':_0x27031b['where']})[_0x7045('0x29')](function(_0x3a7f1f){_0x89d997[_0x7045('0x20')]=_0x3a7f1f;if(_0x179214[_0x7045('0x34')]['includeAll']){_0x27031b[_0x7045('0x44')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7045('0x45')](_0x27031b);})[_0x7045('0x29')](function(_0x35154f){_0x89d997[_0x7045('0x46')]=_0x35154f;return _0x89d997;});}})[_0x7045('0x29')](respondWithFilteredResult(_0x552e43,_0x27031b))[_0x7045('0x47')](handleError(_0x552e43,null));};exports['getHopperBlacks']=function(_0x3b8da3,_0x1c37a5,_0x140a0f){var _0x129b48={'raw':!![],'where':{}};var _0xaea6bd={};var _0x5bb103={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3b8da3[_0x7045('0x5a')]['id']}})[_0x7045('0x29')](handleEntityNotFound(_0x1c37a5,null))[_0x7045('0x29')](function(_0x59422a){if(_0x59422a){_0xaea6bd[_0x7045('0x33')]=_['keys'](db[_0x7045('0x62')]['rawAttributes']);_0xaea6bd[_0x7045('0x34')]=_[_0x7045('0x48')](_0x3b8da3[_0x7045('0x34')]);_0xaea6bd[_0x7045('0x35')]=_[_0x7045('0x36')](_0xaea6bd[_0x7045('0x33')],_0xaea6bd[_0x7045('0x34')]);_0x129b48[_0x7045('0x37')]=_[_0x7045('0x36')](_0xaea6bd[_0x7045('0x33')],qs[_0x7045('0x38')](_0x3b8da3[_0x7045('0x34')][_0x7045('0x38')]));_0x129b48[_0x7045('0x37')]=_0x129b48[_0x7045('0x37')]['length']?_0x129b48['attributes']:_0xaea6bd['model'];if(!_0x3b8da3[_0x7045('0x34')][_0x7045('0x5c')]('nolimit')){_0x129b48['limit']=qs[_0x7045('0x1f')](_0x3b8da3[_0x7045('0x34')][_0x7045('0x1f')]);_0x129b48[_0x7045('0x1d')]=qs['offset'](_0x3b8da3[_0x7045('0x34')][_0x7045('0x1d')]);}_0x129b48[_0x7045('0x3b')]=qs[_0x7045('0x3c')](_0x3b8da3['query'][_0x7045('0x3c')]);_0x129b48[_0x7045('0x3d')]=qs[_0x7045('0x35')](_['pick'](_0x3b8da3[_0x7045('0x34')],_0xaea6bd['filters']));_0x129b48['where'][_0x7045('0x5e')]=_0x59422a['id'];if(_0x3b8da3['query'][_0x7045('0x3f')]){_0x129b48[_0x7045('0x3d')]=_['merge'](_0x129b48[_0x7045('0x3d')],{'$or':_[_0x7045('0x30')](_0x129b48['attributes'],function(_0x5ef2ba){var _0x3b2fff={};_0x3b2fff[_0x5ef2ba]={'$like':'%'+_0x3b8da3[_0x7045('0x34')][_0x7045('0x3f')]+'%'};return _0x3b2fff;})});}_0x129b48=_[_0x7045('0x40')]({},_0x129b48,_0x3b8da3[_0x7045('0x41')]);return db[_0x7045('0x62')][_0x7045('0x20')]({'where':_0x129b48[_0x7045('0x3d')]})[_0x7045('0x29')](function(_0x4cad8c){_0x5bb103[_0x7045('0x20')]=_0x4cad8c;if(_0x3b8da3[_0x7045('0x34')]['includeAll']){_0x129b48[_0x7045('0x44')]=[{'all':!![]}];}return db[_0x7045('0x62')][_0x7045('0x45')](_0x129b48);})[_0x7045('0x29')](function(_0x3b998b){_0x5bb103['rows']=_0x3b998b;return _0x5bb103;});}})['then'](respondWithFilteredResult(_0x1c37a5,_0x129b48))['catch'](handleError(_0x1c37a5,null));};exports[_0x7045('0x63')]=function(_0x471710,_0x381081,_0x1e3f14){var _0x3ed473={};var _0x58311c={};var _0x39dd30;var _0x3d775e;return db[_0x7045('0x42')][_0x7045('0x59')]({'where':{'id':_0x471710[_0x7045('0x5a')]['id']}})[_0x7045('0x29')](handleEntityNotFound(_0x381081,null))['then'](function(_0x23d96a){if(_0x23d96a){_0x39dd30=_0x23d96a;_0x58311c[_0x7045('0x33')]=_['keys'](db[_0x7045('0x64')]['rawAttributes']);_0x58311c['query']=_[_0x7045('0x48')](_0x471710['query']);_0x58311c['filters']=_[_0x7045('0x36')](_0x58311c[_0x7045('0x33')],_0x58311c[_0x7045('0x34')]);_0x3ed473[_0x7045('0x37')]=_['intersection'](_0x58311c[_0x7045('0x33')],qs['fields'](_0x471710[_0x7045('0x34')]['fields']));_0x3ed473[_0x7045('0x37')]=_0x3ed473[_0x7045('0x37')][_0x7045('0x39')]?_0x3ed473[_0x7045('0x37')]:_0x58311c[_0x7045('0x33')];_0x3ed473[_0x7045('0x3b')]=qs[_0x7045('0x3c')](_0x471710[_0x7045('0x34')][_0x7045('0x3c')]);_0x3ed473[_0x7045('0x3d')]=qs[_0x7045('0x35')](_['pick'](_0x471710[_0x7045('0x34')],_0x58311c[_0x7045('0x35')]));if(_0x471710[_0x7045('0x34')][_0x7045('0x3f')]){_0x3ed473['where']=_['merge'](_0x3ed473[_0x7045('0x3d')],{'$or':_[_0x7045('0x30')](_0x3ed473[_0x7045('0x37')],function(_0xff4946){var _0x3d005d={};_0x3d005d[_0xff4946]={'$like':'%'+_0x471710[_0x7045('0x34')][_0x7045('0x3f')]+'%'};return _0x3d005d;})});}_0x3ed473=_[_0x7045('0x40')]({},_0x3ed473,_0x471710[_0x7045('0x41')]);return _0x39dd30[_0x7045('0x63')](_0x3ed473);}})[_0x7045('0x29')](function(_0x78530b){if(_0x78530b){_0x3d775e=_0x78530b['length'];if(!_0x471710[_0x7045('0x34')][_0x7045('0x5c')](_0x7045('0x3a'))){_0x3ed473[_0x7045('0x1f')]=qs[_0x7045('0x1f')](_0x471710[_0x7045('0x34')][_0x7045('0x1f')]);_0x3ed473['offset']=qs['offset'](_0x471710[_0x7045('0x34')][_0x7045('0x1d')]);}return _0x39dd30['getLists'](_0x3ed473);}})['then'](function(_0x2386e6){if(_0x2386e6){return _0x2386e6?{'count':_0x3d775e,'rows':_0x2386e6}:null;}})[_0x7045('0x29')](respondWithResult(_0x381081,null))[_0x7045('0x47')](handleError(_0x381081,null));};exports[_0x7045('0x65')]=function(_0x1934de,_0x971c62,_0x47e3e0){var _0x117029,_0xe7cc7f;var _0x4b461f=[];var _0x904b9c=moment()['format'](_0x7045('0x66'));return db[_0x7045('0x42')]['find']({'where':{'id':_0x1934de[_0x7045('0x5a')]['id']}})['then'](handleEntityNotFound(_0x971c62,null))[_0x7045('0x29')](function(_0x3c7bb3){if(_0x3c7bb3){_0xe7cc7f=_0x3c7bb3;return _0x3c7bb3['addLists'](_0x1934de[_0x7045('0x4b')][_0x7045('0x67')],_['omit'](_0x1934de[_0x7045('0x4b')],[_0x7045('0x67'),'id'])||{});}return null;})['spread'](function(_0x4d0a41){var _0x22682a;var _0x2cdca0;_0x117029=_0x4d0a41||[];var _0x1aaf35=[];if(_0x4d0a41){for(var _0x5ed3f8=0x0;_0x5ed3f8<_0x4d0a41[_0x7045('0x39')];_0x5ed3f8+=0x1){var _0x277851=_0x4d0a41[_0x5ed3f8][_0x7045('0x26')]({'plain':!![]});_0xe7cc7f['dialCheckDuplicateType']=_0x1934de[_0x7045('0x4b')]['dialCheckDuplicateType']?_0x1934de[_0x7045('0x4b')][_0x7045('0x68')]:_0xe7cc7f[_0x7045('0x68')];switch(_0xe7cc7f[_0x7045('0x68')]){case _0x7045('0x69'):_0x22682a=squel['insert']()[_0x7045('0x6a')](_0x7045('0x6b'))[_0x7045('0x6c')]([_0x7045('0x6d'),_0x7045('0x6e'),_0x7045('0x6f'),_0x7045('0x70'),_0x7045('0x5e'),_0x7045('0x54'),_0x7045('0x55')],squel['select']()[_0x7045('0x71')]('phone',_0x7045('0x6d'))[_0x7045('0x71')](_0x7045('0x72'),_0x7045('0x6e'))['field']('id',_0x7045('0x6f'))[_0x7045('0x71')](_0x277851[_0x7045('0x73')][_0x7045('0x74')](),_0x7045('0x70'))['field'](_0x1934de[_0x7045('0x5a')]['id'][_0x7045('0x74')](),_0x7045('0x5e'))[_0x7045('0x71')]('\x27'+_0x904b9c+'\x27',_0x7045('0x54'))[_0x7045('0x71')]('\x27'+_0x904b9c+'\x27',_0x7045('0x55'))[_0x7045('0x75')](_0x7045('0x76'))[_0x7045('0x3d')](_0x7045('0x77'))[_0x7045('0x3d')](_0x7045('0x78'),_0x277851[_0x7045('0x73')][_0x7045('0x74')]())[_0x7045('0x3d')](_0x7045('0x79'))[_0x7045('0x3d')](_0x7045('0x7a'),squel[_0x7045('0x7b')]()[_0x7045('0x71')](_0x7045('0x7c'))[_0x7045('0x75')](_0x7045('0x7d'))['where'](_0x7045('0x7e'),_0x1934de['params']['id'][_0x7045('0x74')]()))[_0x7045('0x3d')](_0x7045('0x7a'),squel['select']()['field'](_0x7045('0x7f'))[_0x7045('0x75')](_0x7045('0x6b'))[_0x7045('0x3d')]('CampaignId\x20=\x20?',_0x1934de[_0x7045('0x5a')]['id'][_0x7045('0x74')]())))[_0x7045('0x74')]();break;case _0x7045('0x80'):_0x22682a=squel['insert']()[_0x7045('0x6a')](_0x7045('0x6b'))[_0x7045('0x6c')]([_0x7045('0x6d'),'scheduledAt',_0x7045('0x6f'),_0x7045('0x70'),_0x7045('0x5e'),_0x7045('0x54'),'updatedAt'],squel['select']()[_0x7045('0x71')](_0x7045('0x6d'),_0x7045('0x6d'))[_0x7045('0x71')](_0x7045('0x72'),_0x7045('0x6e'))[_0x7045('0x71')]('id',_0x7045('0x6f'))[_0x7045('0x71')](_0x277851[_0x7045('0x73')][_0x7045('0x74')](),_0x7045('0x70'))[_0x7045('0x71')](_0x1934de[_0x7045('0x5a')]['id'][_0x7045('0x74')](),_0x7045('0x5e'))[_0x7045('0x71')]('\x27'+_0x904b9c+'\x27',_0x7045('0x54'))['field']('\x27'+_0x904b9c+'\x27',_0x7045('0x55'))[_0x7045('0x75')](_0x7045('0x76'))[_0x7045('0x3d')](_0x7045('0x77'))['where']('ListId\x20=\x20?',_0x277851[_0x7045('0x73')][_0x7045('0x74')]())[_0x7045('0x3d')](_0x7045('0x79'))[_0x7045('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7045('0x71')]('COALESCE(phone,\x27\x27)')[_0x7045('0x75')](_0x7045('0x6b'))[_0x7045('0x3d')](_0x7045('0x7e'),_0x1934de[_0x7045('0x5a')]['id'][_0x7045('0x74')]())))[_0x7045('0x74')]();break;default:_0x22682a=squel[_0x7045('0x81')]()['into'](_0x7045('0x6b'))[_0x7045('0x6c')]([_0x7045('0x6d'),_0x7045('0x6e'),_0x7045('0x6f'),_0x7045('0x70'),'CampaignId','createdAt',_0x7045('0x55')],squel[_0x7045('0x7b')]()[_0x7045('0x71')](_0x7045('0x6d'),'phone')[_0x7045('0x71')](_0x7045('0x72'),_0x7045('0x6e'))[_0x7045('0x71')]('id','ContactId')[_0x7045('0x71')](_0x277851[_0x7045('0x73')][_0x7045('0x74')](),_0x7045('0x70'))['field'](_0x1934de[_0x7045('0x5a')]['id'][_0x7045('0x74')](),_0x7045('0x5e'))[_0x7045('0x71')]('\x27'+_0x904b9c+'\x27',_0x7045('0x54'))['field']('\x27'+_0x904b9c+'\x27',_0x7045('0x55'))['from'](_0x7045('0x76'))[_0x7045('0x3d')](_0x7045('0x77'))['where'](_0x7045('0x78'),_0x277851[_0x7045('0x73')][_0x7045('0x74')]())[_0x7045('0x3d')](_0x7045('0x79')))[_0x7045('0x74')]();}_0x2cdca0=squel['insert']()['into'](_0x7045('0x82'))[_0x7045('0x6c')]([_0x7045('0x83'),_0x7045('0x6e'),_0x7045('0x6d'),'OrderBy',_0x7045('0x54'),'updatedAt'],squel['select']()['field'](_0x7045('0x84'),'id')[_0x7045('0x71')](_0x7045('0x72'),_0x7045('0x6e'))[_0x7045('0x71')](_0x7045('0x85'),_0x7045('0x6d'))['field'](_0x7045('0x86'),_0x7045('0x87'))[_0x7045('0x71')]('\x27'+_0x904b9c+'\x27',_0x7045('0x54'))[_0x7045('0x71')]('\x27'+_0x904b9c+'\x27',_0x7045('0x55'))['from'](_0x7045('0x88'),'ci')['join']('cm_hopper','h',_0x7045('0x89'))[_0x7045('0x3d')](_0x7045('0x8a'),_0x277851[_0x7045('0x73')][_0x7045('0x74')]())[_0x7045('0x3d')](_0x7045('0x8b'),_0x1934de[_0x7045('0x5a')]['id'][_0x7045('0x74')]())[_0x7045('0x3d')](_0x7045('0x8c'),_0x904b9c))['toString']();_0x1aaf35[_0x7045('0x8d')](db[_0x7045('0x8e')]['query'](_0x22682a));_0x4b461f[_0x7045('0x8d')](db[_0x7045('0x8e')]['query'](_0x2cdca0));}return BPromise[_0x7045('0x8f')](_0x1aaf35);}})[_0x7045('0x29')](function(){return BPromise[_0x7045('0x8f')](_0x4b461f);})[_0x7045('0x29')](function(){return _0x117029;})[_0x7045('0x29')](respondWithResult(_0x971c62,null))[_0x7045('0x47')](handleError(_0x971c62,null));};exports[_0x7045('0x90')]=function(_0x5939a4,_0x500171,_0x2f7a61){return db['Campaign']['find']({'where':{'id':_0x5939a4[_0x7045('0x5a')]['id']}})['then'](handleEntityNotFound(_0x500171,null))[_0x7045('0x29')](function(_0x228057){if(_0x228057){return _0x228057['removeLists'](_0x5939a4[_0x7045('0x34')]['ids']);}})[_0x7045('0x29')](function(_0x1f514a){if(_0x1f514a){return db[_0x7045('0x5b')][_0x7045('0x28')]({'where':{'ListId':_0x5939a4['query']['ids'],'CampaignId':_0x5939a4[_0x7045('0x5a')]['id']}})['then'](function(){return _0x1f514a;});}})[_0x7045('0x29')](respondWithStatusCode(_0x500171,null))[_0x7045('0x47')](handleError(_0x500171,null));};exports[_0x7045('0x91')]=function(_0x35e781,_0x1d6acc,_0x45985f){var _0x3be697={};var _0x463559={};var _0x537da6;var _0x44808b;return db[_0x7045('0x42')][_0x7045('0x59')]({'where':{'id':_0x35e781[_0x7045('0x5a')]['id']}})[_0x7045('0x29')](handleEntityNotFound(_0x1d6acc,null))['then'](function(_0x4e36eb){if(_0x4e36eb){_0x537da6=_0x4e36eb;_0x463559[_0x7045('0x33')]=_[_0x7045('0x48')](db['CmList'][_0x7045('0x49')]);_0x463559[_0x7045('0x34')]=_[_0x7045('0x48')](_0x35e781[_0x7045('0x34')]);_0x463559['filters']=_[_0x7045('0x36')](_0x463559[_0x7045('0x33')],_0x463559[_0x7045('0x34')]);_0x3be697[_0x7045('0x37')]=_[_0x7045('0x36')](_0x463559[_0x7045('0x33')],qs[_0x7045('0x38')](_0x35e781[_0x7045('0x34')][_0x7045('0x38')]));_0x3be697[_0x7045('0x37')]=_0x3be697[_0x7045('0x37')][_0x7045('0x39')]?_0x3be697[_0x7045('0x37')]:_0x463559['model'];_0x3be697[_0x7045('0x3b')]=qs[_0x7045('0x3c')](_0x35e781[_0x7045('0x34')][_0x7045('0x3c')]);_0x3be697['where']=qs[_0x7045('0x35')](_['pick'](_0x35e781['query'],_0x463559[_0x7045('0x35')]));if(_0x35e781[_0x7045('0x34')][_0x7045('0x3f')]){_0x3be697[_0x7045('0x3d')]=_[_0x7045('0x40')](_0x3be697[_0x7045('0x3d')],{'$or':_[_0x7045('0x30')](_0x3be697[_0x7045('0x37')],function(_0x1b0b93){var _0x13d5d3={};_0x13d5d3[_0x1b0b93]={'$like':'%'+_0x35e781[_0x7045('0x34')][_0x7045('0x3f')]+'%'};return _0x13d5d3;})});}_0x3be697=_[_0x7045('0x40')]({},_0x3be697,_0x35e781['options']);return _0x537da6[_0x7045('0x91')](_0x3be697);}})[_0x7045('0x29')](function(_0x1a4bac){if(_0x1a4bac){_0x44808b=_0x1a4bac[_0x7045('0x39')];if(!_0x35e781[_0x7045('0x34')]['hasOwnProperty']('nolimit')){_0x3be697[_0x7045('0x1f')]=qs[_0x7045('0x1f')](_0x35e781[_0x7045('0x34')]['limit']);_0x3be697[_0x7045('0x1d')]=qs[_0x7045('0x1d')](_0x35e781['query'][_0x7045('0x1d')]);}return _0x537da6[_0x7045('0x91')](_0x3be697);}})['then'](function(_0x44f7d0){if(_0x44f7d0){return _0x44f7d0?{'count':_0x44808b,'rows':_0x44f7d0}:null;}})[_0x7045('0x29')](respondWithResult(_0x1d6acc,null))[_0x7045('0x47')](handleError(_0x1d6acc,null));};exports[_0x7045('0x92')]=function(_0x1bda89,_0x1ba3f8,_0xfa20b9){var _0x4553b8,_0x4bf68a;var _0x21ea40=[];var _0x1917b8=moment()['format'](_0x7045('0x66'));return db[_0x7045('0x42')][_0x7045('0x4e')]({'where':{'id':_0x1bda89[_0x7045('0x5a')]['id']}})[_0x7045('0x29')](handleEntityNotFound(_0x1ba3f8,null))[_0x7045('0x29')](function(_0x505651){if(_0x505651){_0x4bf68a=_0x505651;return _0x505651[_0x7045('0x92')](_0x1bda89[_0x7045('0x4b')][_0x7045('0x67')],_['omit'](_0x1bda89[_0x7045('0x4b')],['ids','id'])||{});}return null;})[_0x7045('0x93')](function(_0x4b35f1){var _0x276c10;var _0x45191f;_0x4553b8=_0x4b35f1||[];var _0x58b1a3=[];if(_0x4b35f1){for(var _0x46cd10=0x0;_0x46cd10<_0x4b35f1[_0x7045('0x39')];_0x46cd10+=0x1){var _0x188dcf=_0x4b35f1[_0x46cd10][_0x7045('0x26')]({'plain':!![]});_0x276c10=squel[_0x7045('0x81')]()['into']('cm_hopper_black')[_0x7045('0x6c')]([_0x7045('0x6d'),_0x7045('0x6f'),_0x7045('0x70'),_0x7045('0x5e'),_0x7045('0x54'),_0x7045('0x55')],squel[_0x7045('0x7b')]()['field']('phone',_0x7045('0x6d'))[_0x7045('0x71')]('id',_0x7045('0x6f'))[_0x7045('0x71')](_0x188dcf['CmListId'][_0x7045('0x74')](),_0x7045('0x70'))[_0x7045('0x71')](_0x1bda89[_0x7045('0x5a')]['id'][_0x7045('0x74')](),'CampaignId')[_0x7045('0x71')](_0x7045('0x72'),'createdAt')[_0x7045('0x71')](_0x7045('0x72'),_0x7045('0x55'))['from'](_0x7045('0x76'))[_0x7045('0x3d')]('deletedAt\x20IS\x20NULL')[_0x7045('0x3d')](_0x7045('0x78'),_0x188dcf[_0x7045('0x73')]['toString']())[_0x7045('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x7045('0x74')]();_0x58b1a3['push'](db['sequelize'][_0x7045('0x34')](_0x276c10));}return BPromise['all'](_0x58b1a3);}})[_0x7045('0x29')](function(){return _0x4553b8;})['then'](respondWithResult(_0x1ba3f8,null))[_0x7045('0x47')](handleError(_0x1ba3f8,null));};exports[_0x7045('0x94')]=function(_0xcd2ca7,_0x2531a4,_0x5df989){return db[_0x7045('0x42')]['find']({'where':{'id':_0xcd2ca7[_0x7045('0x5a')]['id']}})[_0x7045('0x29')](handleEntityNotFound(_0x2531a4,null))[_0x7045('0x29')](function(_0x378a09){if(_0x378a09){return _0x378a09['removeBlackLists'](_0xcd2ca7['query'][_0x7045('0x67')]);}})[_0x7045('0x29')](function(_0x1fbedb){if(_0x1fbedb){return db[_0x7045('0x62')][_0x7045('0x28')]({'where':{'ListId':_0xcd2ca7[_0x7045('0x34')][_0x7045('0x67')],'CampaignId':_0xcd2ca7[_0x7045('0x5a')]['id']}})[_0x7045('0x29')](function(){return _0x1fbedb;});}})[_0x7045('0x29')](respondWithStatusCode(_0x2531a4,null))[_0x7045('0x47')](handleError(_0x2531a4,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 14d2524..302d218 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(_0x15fb0b,_0x44b92d){var _0x423f50=function(_0x32b8c5){while(--_0x32b8c5){_0x15fb0b['push'](_0x15fb0b['shift']());}};_0x423f50(++_0x44b92d);}(_0x7a54,0x106));var _0x47a5=function(_0x57752e,_0x5e0ce3){_0x57752e=_0x57752e-0x0;var _0x433039=_0x7a54[_0x57752e];return _0x433039;};'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(_0x210ed6,_0x3dffa7){var _0x353e65=function(_0x4e5159){while(--_0x4e5159){_0x210ed6['push'](_0x210ed6['shift']());}};_0x353e65(++_0x3dffa7);}(_0x7a54,0x106));var _0x47a5=function(_0x23c1b2,_0x1769c9){_0x23c1b2=_0x23c1b2-0x0;var _0x300472=_0x7a54[_0x23c1b2];return _0x300472;};'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 1c0db17..c2520ee 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 _0xf822=['request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','Campaign','findAll','options','where','attributes','limit','include','map','model','GetCampaign','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s'];(function(_0x30e063,_0x21fec4){var _0x1aca47=function(_0x23aa40){while(--_0x23aa40){_0x30e063['push'](_0x30e063['shift']());}};_0x1aca47(++_0x21fec4);}(_0xf822,0x19e));var _0x2f82=function(_0x1878b0,_0x382c8b){_0x1878b0=_0x1878b0-0x0;var _0x1f128f=_0xf822[_0x1878b0];return _0x1f128f;};'use strict';var _=require(_0x2f82('0x0'));var util=require('util');var moment=require(_0x2f82('0x1'));var BPromise=require(_0x2f82('0x2'));var rs=require(_0x2f82('0x3'));var fs=require('fs');var Redis=require(_0x2f82('0x4'));var db=require(_0x2f82('0x5'))['db'];var utils=require(_0x2f82('0x6'));var logger=require('../../config/logger')(_0x2f82('0x7'));var config=require(_0x2f82('0x8'));var jayson=require(_0x2f82('0x9'));var client=jayson['client'][_0x2f82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50ec5d,_0x39a4db,_0x236d70){return new BPromise(function(_0x24b313,_0x28b802){return client[_0x2f82('0xb')](_0x50ec5d,_0x236d70)[_0x2f82('0xc')](function(_0x53ea43){logger[_0x2f82('0xd')](_0x2f82('0xe'),_0x39a4db,_0x2f82('0xf'));logger[_0x2f82('0x10')](_0x2f82('0x11'),_0x39a4db,_0x2f82('0xf'),JSON['stringify'](_0x53ea43));if(_0x53ea43['error']){if(_0x53ea43[_0x2f82('0x12')][_0x2f82('0x13')]===0x1f4){logger[_0x2f82('0x12')](_0x2f82('0xe'),_0x39a4db,_0x53ea43['error']['message']);return _0x28b802(_0x53ea43[_0x2f82('0x12')][_0x2f82('0x14')]);}logger[_0x2f82('0x12')]('Campaign,\x20%s,\x20%s',_0x39a4db,_0x53ea43[_0x2f82('0x12')][_0x2f82('0x14')]);return _0x24b313(_0x53ea43['error']['message']);}else{logger['info'](_0x2f82('0xe'),_0x39a4db,_0x2f82('0xf'));_0x24b313(_0x53ea43[_0x2f82('0x15')][_0x2f82('0x14')]);}})['catch'](function(_0x1cb680){logger['error'](_0x2f82('0xe'),_0x39a4db,_0x1cb680);_0x28b802(_0x1cb680);});});}exports['GetCampaign']=function(_0x2ac8dc){var _0xccbee0=this;return new Promise(function(_0x2c3ce9,_0x371720){return db[_0x2f82('0x16')][_0x2f82('0x17')]({'raw':_0x2ac8dc[_0x2f82('0x18')]?_0x2ac8dc[_0x2f82('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2ac8dc[_0x2f82('0x18')]?_0x2ac8dc[_0x2f82('0x18')][_0x2f82('0x19')]||null:null,'attributes':_0x2ac8dc['options']?_0x2ac8dc[_0x2f82('0x18')][_0x2f82('0x1a')]||null:null,'limit':_0x2ac8dc[_0x2f82('0x18')]?_0x2ac8dc[_0x2f82('0x18')][_0x2f82('0x1b')]||null:null,'include':_0x2ac8dc['options']?_0x2ac8dc[_0x2f82('0x18')][_0x2f82('0x1c')]?_[_0x2f82('0x1d')](_0x2ac8dc['options']['include'],function(_0x510bd0){return{'model':db[_0x510bd0[_0x2f82('0x1e')]],'as':_0x510bd0['as'],'attributes':_0x510bd0[_0x2f82('0x1a')],'include':_0x510bd0['include']?_['map'](_0x510bd0[_0x2f82('0x1c')],function(_0x452472){return{'model':db[_0x452472[_0x2f82('0x1e')]],'as':_0x452472['as'],'attributes':_0x452472[_0x2f82('0x1a')],'include':_0x452472[_0x2f82('0x1c')]?_['map'](_0x452472['include'],function(_0x30efa5){return{'model':db[_0x30efa5['model']],'as':_0x30efa5['as'],'attributes':_0x30efa5[_0x2f82('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29d54e){logger[_0x2f82('0xd')](_0x2f82('0x1f'),_0x2ac8dc);logger[_0x2f82('0x10')](_0x2f82('0x1f'),_0x2ac8dc,JSON['stringify'](_0x29d54e));_0x2c3ce9(_0x29d54e);})[_0x2f82('0x20')](function(_0x3f2e84){logger[_0x2f82('0x12')](_0x2f82('0x1f'),_0x3f2e84[_0x2f82('0x14')],_0x2ac8dc);_0x371720(_0xccbee0[_0x2f82('0x12')](0x1f4,_0x3f2e84[_0x2f82('0x14')]));});});}; \ No newline at end of file +var _0xa900=['Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','Campaign','findAll','options','raw','attributes','limit','include','map','model','GetCampaign','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','debug'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xa900,0x101));var _0x0a90=function(_0x3ccd5c,_0x1ee1a7){_0x3ccd5c=_0x3ccd5c-0x0;var _0x1be3e3=_0xa900[_0x3ccd5c];return _0x1be3e3;};'use strict';var _=require(_0x0a90('0x0'));var util=require(_0x0a90('0x1'));var moment=require(_0x0a90('0x2'));var BPromise=require(_0x0a90('0x3'));var rs=require(_0x0a90('0x4'));var fs=require('fs');var Redis=require(_0x0a90('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a90('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a90('0x7'));var jayson=require(_0x0a90('0x8'));var client=jayson[_0x0a90('0x9')][_0x0a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56a1e5,_0x3909ac,_0x4718e9){return new BPromise(function(_0x33e3cf,_0x4f2b58){return client[_0x0a90('0xb')](_0x56a1e5,_0x4718e9)[_0x0a90('0xc')](function(_0x36c82f){logger['info'](_0x0a90('0xd'),_0x3909ac,'request\x20sent');logger[_0x0a90('0xe')](_0x0a90('0xf'),_0x3909ac,'request\x20sent',JSON[_0x0a90('0x10')](_0x36c82f));if(_0x36c82f[_0x0a90('0x11')]){if(_0x36c82f[_0x0a90('0x11')][_0x0a90('0x12')]===0x1f4){logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x36c82f[_0x0a90('0x11')][_0x0a90('0x13')]);return _0x4f2b58(_0x36c82f[_0x0a90('0x11')][_0x0a90('0x13')]);}logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x36c82f[_0x0a90('0x11')]['message']);return _0x33e3cf(_0x36c82f['error'][_0x0a90('0x13')]);}else{logger[_0x0a90('0x14')](_0x0a90('0xd'),_0x3909ac,_0x0a90('0x15'));_0x33e3cf(_0x36c82f[_0x0a90('0x16')][_0x0a90('0x13')]);}})[_0x0a90('0x17')](function(_0x4c5979){logger[_0x0a90('0x11')](_0x0a90('0xd'),_0x3909ac,_0x4c5979);_0x4f2b58(_0x4c5979);});});}exports['GetCampaign']=function(_0x2c0719){var _0x5cbe3c=this;return new Promise(function(_0x619487,_0x44b75d){return db[_0x0a90('0x18')][_0x0a90('0x19')]({'raw':_0x2c0719['options']?_0x2c0719[_0x0a90('0x1a')][_0x0a90('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c0719[_0x0a90('0x1a')]?_0x2c0719['options']['where']||null:null,'attributes':_0x2c0719[_0x0a90('0x1a')]?_0x2c0719['options'][_0x0a90('0x1c')]||null:null,'limit':_0x2c0719['options']?_0x2c0719[_0x0a90('0x1a')][_0x0a90('0x1d')]||null:null,'include':_0x2c0719[_0x0a90('0x1a')]?_0x2c0719[_0x0a90('0x1a')][_0x0a90('0x1e')]?_[_0x0a90('0x1f')](_0x2c0719[_0x0a90('0x1a')][_0x0a90('0x1e')],function(_0x2c3431){return{'model':db[_0x2c3431[_0x0a90('0x20')]],'as':_0x2c3431['as'],'attributes':_0x2c3431[_0x0a90('0x1c')],'include':_0x2c3431[_0x0a90('0x1e')]?_[_0x0a90('0x1f')](_0x2c3431[_0x0a90('0x1e')],function(_0x569dc3){return{'model':db[_0x569dc3[_0x0a90('0x20')]],'as':_0x569dc3['as'],'attributes':_0x569dc3[_0x0a90('0x1c')],'include':_0x569dc3[_0x0a90('0x1e')]?_[_0x0a90('0x1f')](_0x569dc3['include'],function(_0x1711e2){return{'model':db[_0x1711e2[_0x0a90('0x20')]],'as':_0x1711e2['as'],'attributes':_0x1711e2[_0x0a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0a90('0xc')](function(_0xe4729b){logger[_0x0a90('0x14')](_0x0a90('0x21'),_0x2c0719);logger[_0x0a90('0xe')](_0x0a90('0x21'),_0x2c0719,JSON[_0x0a90('0x10')](_0xe4729b));_0x619487(_0xe4729b);})['catch'](function(_0x3c194e){logger[_0x0a90('0x11')](_0x0a90('0x21'),_0x3c194e['message'],_0x2c0719);_0x44b75d(_0x5cbe3c[_0x0a90('0x11')](0x1f4,_0x3c194e['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 4a2ca4f..ca0ce2a 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 _0x8e99=['getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','post','clone','addLists','addBlackLists','put','update','delete','destroy','/:id/lists','removeLists','removeBlackLists','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','show','/:id/hoppers'];(function(_0x50de90,_0x158e9f){var _0x141e90=function(_0x1ef6e7){while(--_0x1ef6e7){_0x50de90['push'](_0x50de90['shift']());}};_0x141e90(++_0x158e9f);}(_0x8e99,0x167));var _0x98e9=function(_0x5b7d66,_0x511699){_0x5b7d66=_0x5b7d66-0x0;var _0x3300b0=_0x8e99[_0x5b7d66];return _0x3300b0;};'use strict';var multer=require(_0x98e9('0x0'));var util=require(_0x98e9('0x1'));var path=require(_0x98e9('0x2'));var timeout=require('connect-timeout');var express=require(_0x98e9('0x3'));var router=express[_0x98e9('0x4')]();var fs_extra=require(_0x98e9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x98e9('0x6'));var config=require(_0x98e9('0x7'));var controller=require(_0x98e9('0x8'));router[_0x98e9('0x9')]('/',auth[_0x98e9('0xa')](),controller['index']);router[_0x98e9('0x9')]('/:id',auth[_0x98e9('0xa')](),controller[_0x98e9('0xb')]);router['get'](_0x98e9('0xc'),auth[_0x98e9('0xa')](),controller[_0x98e9('0xd')]);router[_0x98e9('0x9')](_0x98e9('0xe'),auth[_0x98e9('0xa')](),controller[_0x98e9('0xf')]);router[_0x98e9('0x9')]('/:id/hopper_finals',auth[_0x98e9('0xa')](),controller['getHopperFinals']);router[_0x98e9('0x9')](_0x98e9('0x10'),auth[_0x98e9('0xa')](),controller[_0x98e9('0x11')]);router['get']('/:id/lists',auth[_0x98e9('0xa')](),controller[_0x98e9('0x12')]);router[_0x98e9('0x9')](_0x98e9('0x13'),auth[_0x98e9('0xa')](),controller['getBlackLists']);router['post']('/',auth[_0x98e9('0xa')](),controller['create']);router[_0x98e9('0x14')]('/:id/clone',auth[_0x98e9('0xa')](),controller[_0x98e9('0x15')]);router[_0x98e9('0x14')]('/:id/lists',auth[_0x98e9('0xa')](),controller[_0x98e9('0x16')]);router[_0x98e9('0x14')](_0x98e9('0x13'),auth[_0x98e9('0xa')](),controller[_0x98e9('0x17')]);router[_0x98e9('0x18')]('/:id',auth[_0x98e9('0xa')](),controller[_0x98e9('0x19')]);router[_0x98e9('0x1a')]('/:id',auth[_0x98e9('0xa')](),controller[_0x98e9('0x1b')]);router['delete'](_0x98e9('0x1c'),auth[_0x98e9('0xa')](),controller[_0x98e9('0x1d')]);router[_0x98e9('0x1a')](_0x98e9('0x13'),auth[_0x98e9('0xa')](),controller[_0x98e9('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x0723=['/:id/clone','clone','addLists','addBlackLists','update','delete','destroy','removeLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./campaign.controller','get','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create'];(function(_0x858e17,_0x2d54e8){var _0x4cbfe5=function(_0x71b042){while(--_0x71b042){_0x858e17['push'](_0x858e17['shift']());}};_0x4cbfe5(++_0x2d54e8);}(_0x0723,0x101));var _0x3072=function(_0x4a4aa2,_0x3deb82){_0x4a4aa2=_0x4a4aa2-0x0;var _0x459fe9=_0x0723[_0x4a4aa2];return _0x459fe9;};'use strict';var multer=require(_0x3072('0x0'));var util=require('util');var path=require(_0x3072('0x1'));var timeout=require(_0x3072('0x2'));var express=require(_0x3072('0x3'));var router=express[_0x3072('0x4')]();var fs_extra=require(_0x3072('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3072('0x6'));var controller=require(_0x3072('0x7'));router[_0x3072('0x8')]('/',auth[_0x3072('0x9')](),controller['index']);router['get']('/:id',auth[_0x3072('0x9')](),controller['show']);router[_0x3072('0x8')](_0x3072('0xa'),auth[_0x3072('0x9')](),controller[_0x3072('0xb')]);router[_0x3072('0x8')](_0x3072('0xc'),auth['isAuthenticated'](),controller[_0x3072('0xd')]);router['get'](_0x3072('0xe'),auth[_0x3072('0x9')](),controller[_0x3072('0xf')]);router[_0x3072('0x8')]('/:id/hopper_black',auth[_0x3072('0x9')](),controller[_0x3072('0x10')]);router[_0x3072('0x8')](_0x3072('0x11'),auth[_0x3072('0x9')](),controller['getLists']);router[_0x3072('0x8')](_0x3072('0x12'),auth[_0x3072('0x9')](),controller[_0x3072('0x13')]);router[_0x3072('0x14')]('/',auth[_0x3072('0x9')](),controller[_0x3072('0x15')]);router['post'](_0x3072('0x16'),auth[_0x3072('0x9')](),controller[_0x3072('0x17')]);router[_0x3072('0x14')](_0x3072('0x11'),auth[_0x3072('0x9')](),controller[_0x3072('0x18')]);router['post'](_0x3072('0x12'),auth[_0x3072('0x9')](),controller[_0x3072('0x19')]);router['put']('/:id',auth[_0x3072('0x9')](),controller[_0x3072('0x1a')]);router[_0x3072('0x1b')]('/:id',auth[_0x3072('0x9')](),controller[_0x3072('0x1c')]);router[_0x3072('0x1b')](_0x3072('0x11'),auth['isAuthenticated'](),controller[_0x3072('0x1d')]);router[_0x3072('0x1b')](_0x3072('0x12'),auth[_0x3072('0x9')](),controller['removeBlackLists']);module[_0x3072('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f658442..260a5e0 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 _0x721e=['TEXT','medium','VIRTUAL','key','sequelize','STRING'];(function(_0x2f9d34,_0x94c708){var _0x2b935f=function(_0x2b392d){while(--_0x2b392d){_0x2f9d34['push'](_0x2f9d34['shift']());}};_0x2b935f(++_0x94c708);}(_0x721e,0x1d2));var _0xe721=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x721e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe721('0x0'));module['exports']={'key':{'type':Sequelize[_0xe721('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xe721('0x2')],'length':_0xe721('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xe721('0x1')]},'name':{'type':Sequelize[_0xe721('0x4')],'get':function(){return this['getDataValue'](_0xe721('0x5'));}}}; \ No newline at end of file +var _0x5680=['getDataValue','sequelize','STRING','TEXT','VIRTUAL'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x5680,0x1be));var _0x0568=function(_0x5eb79d,_0x4baed0){_0x5eb79d=_0x5eb79d-0x0;var _0x262444=_0x5680[_0x5eb79d];return _0x262444;};'use strict';var Sequelize=require(_0x0568('0x0'));module['exports']={'key':{'type':Sequelize[_0x0568('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x0568('0x2')],'length':'medium','allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x0568('0x3')],'get':function(){return this[_0x0568('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 043f4b9..2390e81 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 _0xe457=['The\x20inserted\x20key\x20already\x20exists.','create','user','get','UserProfileSection','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','apply','save','then','CannedAnswers','UserProfileResource','destroy','end','error','name','send','index','CannedAnswer','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','keys','rawAttributes','includeAll','find','catch','update','params','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError'];(function(_0x296b3c,_0x203828){var _0x53adfa=function(_0x50b597){while(--_0x50b597){_0x296b3c['push'](_0x296b3c['shift']());}};_0x53adfa(++_0x203828);}(_0xe457,0x1b8));var _0x7e45=function(_0x2805a5,_0x557279){_0x2805a5=_0x2805a5-0x0;var _0x282c1d=_0xe457[_0x2805a5];return _0x282c1d;};'use strict';var emlformat=require(_0x7e45('0x0'));var rimraf=require(_0x7e45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e45('0x2'));var rp=require(_0x7e45('0x3'));var moment=require('moment');var BPromise=require(_0x7e45('0x4'));var Mustache=require(_0x7e45('0x5'));var util=require(_0x7e45('0x6'));var path=require('path');var sox=require(_0x7e45('0x7'));var csv=require(_0x7e45('0x8'));var ejs=require(_0x7e45('0x9'));var fs=require('fs');var fs_extra=require(_0x7e45('0xa'));var _=require(_0x7e45('0xb'));var squel=require('squel');var crypto=require(_0x7e45('0xc'));var jsforce=require(_0x7e45('0xd'));var deskjs=require(_0x7e45('0xe'));var toCsv=require(_0x7e45('0x8'));var querystring=require('querystring');var Papa=require(_0x7e45('0xf'));var Redis=require(_0x7e45('0x10'));var authService=require(_0x7e45('0x11'));var qs=require(_0x7e45('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7e45('0x13'));var utils=require(_0x7e45('0x14'));var config=require(_0x7e45('0x15'));var licenseUtil=require(_0x7e45('0x16'));var db=require(_0x7e45('0x17'))['db'];function respondWithStatusCode(_0x1175eb,_0x56075d){_0x56075d=_0x56075d||0xcc;return function(_0x119ec3){if(_0x119ec3){return _0x1175eb[_0x7e45('0x18')](_0x56075d);}return _0x1175eb['status'](_0x56075d)['end']();};}function respondWithResult(_0x2b3dd9,_0x8b7acf){_0x8b7acf=_0x8b7acf||0xc8;return function(_0x4d9f2f){if(_0x4d9f2f){return _0x2b3dd9[_0x7e45('0x19')](_0x8b7acf)['json'](_0x4d9f2f);}};}function respondWithFilteredResult(_0x530c1f,_0x2418e8){return function(_0x2210a4){if(_0x2210a4){var _0x1e383b=typeof _0x2418e8['offset']===_0x7e45('0x1a')&&typeof _0x2418e8[_0x7e45('0x1b')]===_0x7e45('0x1a');var _0x5ecf27=_0x2210a4[_0x7e45('0x1c')];var _0x38b67c=_0x1e383b?0x0:_0x2418e8[_0x7e45('0x1d')];var _0x31d222=_0x1e383b?_0x2210a4['count']:_0x2418e8[_0x7e45('0x1d')]+_0x2418e8['limit'];var _0x48ca91;if(_0x31d222>=_0x5ecf27){_0x31d222=_0x5ecf27;_0x48ca91=0xc8;}else{_0x48ca91=0xce;}_0x530c1f[_0x7e45('0x19')](_0x48ca91);return _0x530c1f[_0x7e45('0x1e')]('Content-Range',_0x38b67c+'-'+_0x31d222+'/'+_0x5ecf27)[_0x7e45('0x1f')](_0x2210a4);}return null;};}function patchUpdates(_0x1dcc76){return function(_0x4c5dc4){try{jsonpatch[_0x7e45('0x20')](_0x4c5dc4,_0x1dcc76,!![]);}catch(_0x46d90a){return BPromise['reject'](_0x46d90a);}return _0x4c5dc4[_0x7e45('0x21')]();};}function saveUpdates(_0x29ad03,_0x42877d){return function(_0x24d915){if(_0x24d915){return _0x24d915['update'](_0x29ad03)[_0x7e45('0x22')](function(_0x417674){return _0x417674;});}return null;};}function removeEntity(_0x5f5bf0,_0x1bcc98){return function(_0x591c5c){if(_0x591c5c){return _0x591c5c['destroy']()[_0x7e45('0x22')](function(){var _0x154dae=_0x591c5c['get']({'plain':!![]});var _0x8fdc34=_0x7e45('0x23');return db[_0x7e45('0x24')][_0x7e45('0x25')]({'where':{'type':_0x8fdc34,'resourceId':_0x154dae['id']}})[_0x7e45('0x22')](function(){return _0x591c5c;});})[_0x7e45('0x22')](function(){_0x5f5bf0[_0x7e45('0x19')](0xcc)[_0x7e45('0x26')]();});}};}function handleEntityNotFound(_0x5147eb,_0x763990){return function(_0x3e419a){if(!_0x3e419a){_0x5147eb['sendStatus'](0x194);}return _0x3e419a;};}function handleError(_0x179e9a,_0x5b40f1){_0x5b40f1=_0x5b40f1||0x1f4;return function(_0x5b11d8){logger[_0x7e45('0x27')](_0x5b11d8['stack']);if(_0x5b11d8[_0x7e45('0x28')]){delete _0x5b11d8[_0x7e45('0x28')];}_0x179e9a[_0x7e45('0x19')](_0x5b40f1)[_0x7e45('0x29')](_0x5b11d8);};}exports[_0x7e45('0x2a')]=function(_0x1da340,_0x71755d){var _0x217014={},_0x414798={},_0x13dfe0={'count':0x0,'rows':[]};var _0x36c506=_['map'](db[_0x7e45('0x2b')]['rawAttributes'],function(_0x2bdccb){return{'name':_0x2bdccb[_0x7e45('0x2c')],'type':_0x2bdccb[_0x7e45('0x2d')][_0x7e45('0x2e')]};});_0x414798[_0x7e45('0x2f')]=_[_0x7e45('0x30')](_0x36c506,_0x7e45('0x28'));_0x414798[_0x7e45('0x31')]=_['keys'](_0x1da340[_0x7e45('0x31')]);_0x414798['filters']=_[_0x7e45('0x32')](_0x414798[_0x7e45('0x2f')],_0x414798[_0x7e45('0x31')]);_0x217014['attributes']=_[_0x7e45('0x32')](_0x414798['model'],qs['fields'](_0x1da340['query'][_0x7e45('0x33')]));_0x217014[_0x7e45('0x34')]=_0x217014['attributes'][_0x7e45('0x35')]?_0x217014['attributes']:_0x414798['model'];if(!_0x1da340['query'][_0x7e45('0x36')](_0x7e45('0x37'))){_0x217014[_0x7e45('0x1b')]=qs[_0x7e45('0x1b')](_0x1da340['query'][_0x7e45('0x1b')]);_0x217014[_0x7e45('0x1d')]=qs[_0x7e45('0x1d')](_0x1da340['query'][_0x7e45('0x1d')]);}_0x217014[_0x7e45('0x38')]=qs[_0x7e45('0x39')](_0x1da340[_0x7e45('0x31')][_0x7e45('0x39')]);_0x217014[_0x7e45('0x3a')]=qs[_0x7e45('0x3b')](_[_0x7e45('0x3c')](_0x1da340[_0x7e45('0x31')],_0x414798[_0x7e45('0x3b')]),_0x36c506);if(_0x1da340[_0x7e45('0x31')][_0x7e45('0x3d')]){_0x217014[_0x7e45('0x3a')]=_[_0x7e45('0x3e')](_0x217014[_0x7e45('0x3a')],{'$or':[{'key':{'$like':'%'+_0x1da340[_0x7e45('0x31')]['filter']+'%'}},{'value':{'$like':'%'+_0x1da340[_0x7e45('0x31')]['filter']+'%'}}]});}_0x217014=_[_0x7e45('0x3e')]({},_0x217014,_0x1da340[_0x7e45('0x3f')]);var _0x484a1b={'where':_0x217014[_0x7e45('0x3a')]};return db[_0x7e45('0x2b')]['count'](_0x484a1b)['then'](function(_0xb59186){_0x13dfe0['count']=_0xb59186;if(_0x1da340[_0x7e45('0x31')]['includeAll']){_0x217014[_0x7e45('0x40')]=[{'all':!![]}];}return db[_0x7e45('0x2b')][_0x7e45('0x41')](_0x217014);})[_0x7e45('0x22')](function(_0x39eb59){_0x13dfe0[_0x7e45('0x42')]=_0x39eb59;return _0x13dfe0;})[_0x7e45('0x22')](respondWithFilteredResult(_0x71755d,_0x217014))['catch'](handleError(_0x71755d,null));};exports[_0x7e45('0x43')]=function(_0xdac4e8,_0x10e91f){var _0xd2eb5f={'raw':!![],'where':{'id':_0xdac4e8['params']['id']}},_0x12806f={};_0x12806f[_0x7e45('0x2f')]=_[_0x7e45('0x44')](db[_0x7e45('0x2b')][_0x7e45('0x45')]);_0x12806f['query']=_['keys'](_0xdac4e8['query']);_0x12806f[_0x7e45('0x3b')]=_[_0x7e45('0x32')](_0x12806f[_0x7e45('0x2f')],_0x12806f[_0x7e45('0x31')]);_0xd2eb5f[_0x7e45('0x34')]=_[_0x7e45('0x32')](_0x12806f[_0x7e45('0x2f')],qs[_0x7e45('0x33')](_0xdac4e8[_0x7e45('0x31')][_0x7e45('0x33')]));_0xd2eb5f[_0x7e45('0x34')]=_0xd2eb5f[_0x7e45('0x34')][_0x7e45('0x35')]?_0xd2eb5f[_0x7e45('0x34')]:_0x12806f[_0x7e45('0x2f')];if(_0xdac4e8['query'][_0x7e45('0x46')]){_0xd2eb5f['include']=[{'all':!![]}];}_0xd2eb5f=_[_0x7e45('0x3e')]({},_0xd2eb5f,_0xdac4e8[_0x7e45('0x3f')]);return db['CannedAnswer'][_0x7e45('0x47')](_0xd2eb5f)['then'](handleEntityNotFound(_0x10e91f,null))[_0x7e45('0x22')](respondWithResult(_0x10e91f,null))[_0x7e45('0x48')](handleError(_0x10e91f,null));};exports[_0x7e45('0x49')]=function(_0x41f23e,_0x50a44a){if(_0x41f23e['body']['id']){delete _0x41f23e['body']['id'];}return db[_0x7e45('0x2b')][_0x7e45('0x47')]({'where':{'id':_0x41f23e[_0x7e45('0x4a')]['id']}})[_0x7e45('0x22')](handleEntityNotFound(_0x50a44a,null))['then'](saveUpdates(_0x41f23e[_0x7e45('0x4b')],null))[_0x7e45('0x22')](respondWithResult(_0x50a44a,null))[_0x7e45('0x48')](handleError(_0x50a44a,null));};exports[_0x7e45('0x25')]=function(_0x3e6516,_0x249a90){return db['CannedAnswer'][_0x7e45('0x47')]({'where':{'id':_0x3e6516[_0x7e45('0x4a')]['id']}})[_0x7e45('0x22')](handleEntityNotFound(_0x249a90,null))[_0x7e45('0x22')](removeEntity(_0x249a90,null))[_0x7e45('0x48')](handleError(_0x249a90,null));};exports['create']=function(_0x796ec8,_0x46b4be){var _0x2d65c5={'key':_0x796ec8['body'][_0x7e45('0x2e')]};if(_0x796ec8[_0x7e45('0x4b')][_0x7e45('0x4c')]){_0x2d65c5['MailAccountId']=_0x796ec8['body'][_0x7e45('0x4c')];}else if(_0x796ec8['body'][_0x7e45('0x4d')]){_0x2d65c5[_0x7e45('0x4d')]=_0x796ec8['body'][_0x7e45('0x4d')];}else if(_0x796ec8[_0x7e45('0x4b')][_0x7e45('0x4e')]){_0x2d65c5[_0x7e45('0x4e')]=_0x796ec8['body'][_0x7e45('0x4e')];}else if(_0x796ec8[_0x7e45('0x4b')][_0x7e45('0x4f')]){_0x2d65c5[_0x7e45('0x4f')]=_0x796ec8[_0x7e45('0x4b')][_0x7e45('0x4f')];}return db[_0x7e45('0x2b')][_0x7e45('0x47')]({'where':_0x2d65c5})[_0x7e45('0x22')](function(_0x255e00){if(_0x255e00){throw new db[(_0x7e45('0x50'))][(_0x7e45('0x51'))](_0x7e45('0x52'));}return db[_0x7e45('0x2b')][_0x7e45('0x53')](_0x796ec8['body']);})[_0x7e45('0x22')](function(_0x4d64af){var _0x21f29c=_0x796ec8[_0x7e45('0x54')][_0x7e45('0x55')]({'plain':!![]});if(!_0x21f29c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21f29c['role']==='user'){var _0x3e4cde=_0x4d64af[_0x7e45('0x55')]({'plain':!![]});return db[_0x7e45('0x56')][_0x7e45('0x47')]({'where':{'name':_0x7e45('0x23'),'userProfileId':_0x21f29c['userProfileId']},'raw':!![]})[_0x7e45('0x22')](function(_0x930b0e){if(_0x930b0e&&_0x930b0e['autoAssociation']===0x0){return db['UserProfileResource'][_0x7e45('0x53')]({'name':_0x3e4cde[_0x7e45('0x28')],'resourceId':_0x3e4cde['id'],'type':_0x930b0e[_0x7e45('0x28')],'sectionId':_0x930b0e['id']},{})['then'](function(){return _0x4d64af;});}else{return _0x4d64af;}})[_0x7e45('0x48')](function(_0x2c4294){logger[_0x7e45('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c4294);throw _0x2c4294;});}return _0x4d64af;})[_0x7e45('0x22')](respondWithResult(_0x46b4be,0xc9))['catch'](handleError(_0x46b4be,null));}; \ No newline at end of file +var _0xd1ae=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','sendStatus','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','merge','where','includeAll','include','findAll','show','params','keys','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xd1ae,0x1ed));var _0xed1a=function(_0x365bfb,_0x5bdba9){_0x365bfb=_0x365bfb-0x0;var _0x36ce50=_0xd1ae[_0x365bfb];return _0x36ce50;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xed1a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xed1a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xed1a('0x2'));var util=require('util');var path=require('path');var sox=require(_0xed1a('0x3'));var csv=require(_0xed1a('0x4'));var ejs=require(_0xed1a('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed1a('0x6'));var squel=require('squel');var crypto=require(_0xed1a('0x7'));var jsforce=require(_0xed1a('0x8'));var deskjs=require(_0xed1a('0x9'));var toCsv=require('to-csv');var querystring=require(_0xed1a('0xa'));var Papa=require(_0xed1a('0xb'));var Redis=require(_0xed1a('0xc'));var authService=require(_0xed1a('0xd'));var qs=require(_0xed1a('0xe'));var as=require(_0xed1a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed1a('0x10'))(_0xed1a('0x11'));var utils=require(_0xed1a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xed1a('0x13'));var db=require(_0xed1a('0x14'))['db'];function respondWithStatusCode(_0xacc3be,_0x4791fd){_0x4791fd=_0x4791fd||0xcc;return function(_0x1f77ac){if(_0x1f77ac){return _0xacc3be['sendStatus'](_0x4791fd);}return _0xacc3be[_0xed1a('0x15')](_0x4791fd)['end']();};}function respondWithResult(_0x4463fb,_0xa5c1b9){_0xa5c1b9=_0xa5c1b9||0xc8;return function(_0x3614bb){if(_0x3614bb){return _0x4463fb[_0xed1a('0x15')](_0xa5c1b9)[_0xed1a('0x16')](_0x3614bb);}};}function respondWithFilteredResult(_0x5a1665,_0x11a26a){return function(_0x27c165){if(_0x27c165){var _0x4e3357=typeof _0x11a26a[_0xed1a('0x17')]===_0xed1a('0x18')&&typeof _0x11a26a[_0xed1a('0x19')]===_0xed1a('0x18');var _0x281c9f=_0x27c165[_0xed1a('0x1a')];var _0x592454=_0x4e3357?0x0:_0x11a26a[_0xed1a('0x17')];var _0x75ee69=_0x4e3357?_0x27c165[_0xed1a('0x1a')]:_0x11a26a[_0xed1a('0x17')]+_0x11a26a[_0xed1a('0x19')];var _0x25d84c;if(_0x75ee69>=_0x281c9f){_0x75ee69=_0x281c9f;_0x25d84c=0xc8;}else{_0x25d84c=0xce;}_0x5a1665['status'](_0x25d84c);return _0x5a1665[_0xed1a('0x1b')](_0xed1a('0x1c'),_0x592454+'-'+_0x75ee69+'/'+_0x281c9f)['json'](_0x27c165);}return null;};}function patchUpdates(_0x100dbf){return function(_0x406f78){try{jsonpatch[_0xed1a('0x1d')](_0x406f78,_0x100dbf,!![]);}catch(_0x4d946c){return BPromise[_0xed1a('0x1e')](_0x4d946c);}return _0x406f78[_0xed1a('0x1f')]();};}function saveUpdates(_0x9ff71f,_0xc69878){return function(_0x2e5c9f){if(_0x2e5c9f){return _0x2e5c9f[_0xed1a('0x20')](_0x9ff71f)[_0xed1a('0x21')](function(_0x447288){return _0x447288;});}return null;};}function removeEntity(_0x4a628f,_0x1a7a61){return function(_0x25e2c8){if(_0x25e2c8){return _0x25e2c8['destroy']()['then'](function(){var _0x4a5713=_0x25e2c8['get']({'plain':!![]});var _0x575257='CannedAnswers';return db[_0xed1a('0x22')][_0xed1a('0x23')]({'where':{'type':_0x575257,'resourceId':_0x4a5713['id']}})[_0xed1a('0x21')](function(){return _0x25e2c8;});})[_0xed1a('0x21')](function(){_0x4a628f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39931b,_0x3e61d4){return function(_0x49efbe){if(!_0x49efbe){_0x39931b[_0xed1a('0x24')](0x194);}return _0x49efbe;};}function handleError(_0x5f48a1,_0xddf26b){_0xddf26b=_0xddf26b||0x1f4;return function(_0x1c9f98){logger[_0xed1a('0x25')](_0x1c9f98['stack']);if(_0x1c9f98[_0xed1a('0x26')]){delete _0x1c9f98[_0xed1a('0x26')];}_0x5f48a1[_0xed1a('0x15')](_0xddf26b)[_0xed1a('0x27')](_0x1c9f98);};}exports[_0xed1a('0x28')]=function(_0x4e0360,_0x46f077){var _0x5b7200={},_0x4b849c={},_0x4e525b={'count':0x0,'rows':[]};var _0x10993e=_[_0xed1a('0x29')](db[_0xed1a('0x2a')][_0xed1a('0x2b')],function(_0x3019ca){return{'name':_0x3019ca[_0xed1a('0x2c')],'type':_0x3019ca[_0xed1a('0x2d')][_0xed1a('0x2e')]};});_0x4b849c[_0xed1a('0x2f')]=_[_0xed1a('0x29')](_0x10993e,_0xed1a('0x26'));_0x4b849c[_0xed1a('0x30')]=_['keys'](_0x4e0360['query']);_0x4b849c['filters']=_[_0xed1a('0x31')](_0x4b849c[_0xed1a('0x2f')],_0x4b849c['query']);_0x5b7200[_0xed1a('0x32')]=_[_0xed1a('0x31')](_0x4b849c[_0xed1a('0x2f')],qs['fields'](_0x4e0360[_0xed1a('0x30')][_0xed1a('0x33')]));_0x5b7200['attributes']=_0x5b7200[_0xed1a('0x32')][_0xed1a('0x34')]?_0x5b7200[_0xed1a('0x32')]:_0x4b849c[_0xed1a('0x2f')];if(!_0x4e0360[_0xed1a('0x30')][_0xed1a('0x35')]('nolimit')){_0x5b7200['limit']=qs[_0xed1a('0x19')](_0x4e0360[_0xed1a('0x30')][_0xed1a('0x19')]);_0x5b7200[_0xed1a('0x17')]=qs['offset'](_0x4e0360[_0xed1a('0x30')]['offset']);}_0x5b7200[_0xed1a('0x36')]=qs[_0xed1a('0x37')](_0x4e0360[_0xed1a('0x30')][_0xed1a('0x37')]);_0x5b7200['where']=qs[_0xed1a('0x38')](_[_0xed1a('0x39')](_0x4e0360[_0xed1a('0x30')],_0x4b849c[_0xed1a('0x38')]),_0x10993e);if(_0x4e0360['query']['filter']){_0x5b7200['where']=_[_0xed1a('0x3a')](_0x5b7200[_0xed1a('0x3b')],{'$or':[{'key':{'$like':'%'+_0x4e0360[_0xed1a('0x30')]['filter']+'%'}},{'value':{'$like':'%'+_0x4e0360[_0xed1a('0x30')]['filter']+'%'}}]});}_0x5b7200=_[_0xed1a('0x3a')]({},_0x5b7200,_0x4e0360['options']);var _0x496eb5={'where':_0x5b7200['where']};return db[_0xed1a('0x2a')][_0xed1a('0x1a')](_0x496eb5)[_0xed1a('0x21')](function(_0x316385){_0x4e525b['count']=_0x316385;if(_0x4e0360[_0xed1a('0x30')][_0xed1a('0x3c')]){_0x5b7200[_0xed1a('0x3d')]=[{'all':!![]}];}return db[_0xed1a('0x2a')][_0xed1a('0x3e')](_0x5b7200);})[_0xed1a('0x21')](function(_0x3bcfb4){_0x4e525b['rows']=_0x3bcfb4;return _0x4e525b;})[_0xed1a('0x21')](respondWithFilteredResult(_0x46f077,_0x5b7200))['catch'](handleError(_0x46f077,null));};exports[_0xed1a('0x3f')]=function(_0x122c20,_0x53fcfb){var _0x2d1a10={'raw':!![],'where':{'id':_0x122c20[_0xed1a('0x40')]['id']}},_0x2ce477={};_0x2ce477['model']=_[_0xed1a('0x41')](db[_0xed1a('0x2a')]['rawAttributes']);_0x2ce477['query']=_[_0xed1a('0x41')](_0x122c20[_0xed1a('0x30')]);_0x2ce477[_0xed1a('0x38')]=_[_0xed1a('0x31')](_0x2ce477[_0xed1a('0x2f')],_0x2ce477[_0xed1a('0x30')]);_0x2d1a10[_0xed1a('0x32')]=_[_0xed1a('0x31')](_0x2ce477[_0xed1a('0x2f')],qs[_0xed1a('0x33')](_0x122c20[_0xed1a('0x30')][_0xed1a('0x33')]));_0x2d1a10[_0xed1a('0x32')]=_0x2d1a10[_0xed1a('0x32')]['length']?_0x2d1a10[_0xed1a('0x32')]:_0x2ce477[_0xed1a('0x2f')];if(_0x122c20['query'][_0xed1a('0x3c')]){_0x2d1a10[_0xed1a('0x3d')]=[{'all':!![]}];}_0x2d1a10=_[_0xed1a('0x3a')]({},_0x2d1a10,_0x122c20[_0xed1a('0x42')]);return db[_0xed1a('0x2a')][_0xed1a('0x43')](_0x2d1a10)[_0xed1a('0x21')](handleEntityNotFound(_0x53fcfb,null))['then'](respondWithResult(_0x53fcfb,null))['catch'](handleError(_0x53fcfb,null));};exports[_0xed1a('0x20')]=function(_0x52f49b,_0x40ae55){if(_0x52f49b[_0xed1a('0x44')]['id']){delete _0x52f49b[_0xed1a('0x44')]['id'];}return db[_0xed1a('0x2a')][_0xed1a('0x43')]({'where':{'id':_0x52f49b[_0xed1a('0x40')]['id']}})['then'](handleEntityNotFound(_0x40ae55,null))[_0xed1a('0x21')](saveUpdates(_0x52f49b[_0xed1a('0x44')],null))[_0xed1a('0x21')](respondWithResult(_0x40ae55,null))['catch'](handleError(_0x40ae55,null));};exports['destroy']=function(_0x59fbf2,_0x5e3094){return db[_0xed1a('0x2a')]['find']({'where':{'id':_0x59fbf2[_0xed1a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5e3094,null))['then'](removeEntity(_0x5e3094,null))['catch'](handleError(_0x5e3094,null));};exports[_0xed1a('0x45')]=function(_0xd24921,_0x32e27c){var _0x40f714={'key':_0xd24921['body']['key']};if(_0xd24921['body'][_0xed1a('0x46')]){_0x40f714['MailAccountId']=_0xd24921[_0xed1a('0x44')]['MailAccountId'];}else if(_0xd24921[_0xed1a('0x44')][_0xed1a('0x47')]){_0x40f714[_0xed1a('0x47')]=_0xd24921[_0xed1a('0x44')][_0xed1a('0x47')];}else if(_0xd24921[_0xed1a('0x44')][_0xed1a('0x48')]){_0x40f714[_0xed1a('0x48')]=_0xd24921['body'][_0xed1a('0x48')];}else if(_0xd24921['body'][_0xed1a('0x49')]){_0x40f714['ChatWebsiteId']=_0xd24921[_0xed1a('0x44')]['ChatWebsiteId'];}return db[_0xed1a('0x2a')][_0xed1a('0x43')]({'where':_0x40f714})[_0xed1a('0x21')](function(_0x5d484a){if(_0x5d484a){throw new db[(_0xed1a('0x4a'))][(_0xed1a('0x4b'))](_0xed1a('0x4c'));}return db[_0xed1a('0x2a')][_0xed1a('0x45')](_0xd24921[_0xed1a('0x44')]);})[_0xed1a('0x21')](function(_0x23f162){var _0x275bec=_0xd24921[_0xed1a('0x4d')][_0xed1a('0x4e')]({'plain':!![]});if(!_0x275bec)throw new Error(_0xed1a('0x4f'));if(_0x275bec[_0xed1a('0x50')]===_0xed1a('0x4d')){var _0x397d0c=_0x23f162[_0xed1a('0x4e')]({'plain':!![]});return db['UserProfileSection'][_0xed1a('0x43')]({'where':{'name':_0xed1a('0x51'),'userProfileId':_0x275bec[_0xed1a('0x52')]},'raw':!![]})[_0xed1a('0x21')](function(_0x41ceba){if(_0x41ceba&&_0x41ceba[_0xed1a('0x53')]===0x0){return db[_0xed1a('0x22')][_0xed1a('0x45')]({'name':_0x397d0c[_0xed1a('0x26')],'resourceId':_0x397d0c['id'],'type':_0x41ceba[_0xed1a('0x26')],'sectionId':_0x41ceba['id']},{})[_0xed1a('0x21')](function(){return _0x23f162;});}else{return _0x23f162;}})[_0xed1a('0x54')](function(_0x1452f8){logger[_0xed1a('0x25')](_0xed1a('0x55'),_0x1452f8);throw _0x1452f8;});}return _0x23f162;})[_0xed1a('0x21')](respondWithResult(_0x32e27c,0xc9))[_0xed1a('0x54')](handleError(_0x32e27c,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ddef68b..849a158 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 _0x08e8=['../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2467ae,_0x322985){var _0x31d4e1=function(_0x35624e){while(--_0x35624e){_0x2467ae['push'](_0x2467ae['shift']());}};_0x31d4e1(++_0x322985);}(_0x08e8,0xc9));var _0x808e=function(_0x36ebb3,_0x56b4c2){_0x36ebb3=_0x36ebb3-0x0;var _0xf57008=_0x08e8[_0x36ebb3];return _0xf57008;};'use strict';var _=require('lodash');var util=require(_0x808e('0x0'));var logger=require('../../config/logger')(_0x808e('0x1'));var moment=require(_0x808e('0x2'));var BPromise=require(_0x808e('0x3'));var rp=require(_0x808e('0x4'));var fs=require('fs');var path=require(_0x808e('0x5'));var rimraf=require(_0x808e('0x6'));var config=require(_0x808e('0x7'));var attributes=require(_0x808e('0x8'));module[_0x808e('0x9')]=function(_0xb4cdbe,_0x5c4278){return _0xb4cdbe['define'](_0x808e('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x808e('0xb'),'collate':_0x808e('0xc')});}; \ No newline at end of file +var _0x6a43=['../../config/environment','exports','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x9f3e89,_0x39b12c){var _0x12d365=function(_0x2d9326){while(--_0x2d9326){_0x9f3e89['push'](_0x9f3e89['shift']());}};_0x12d365(++_0x39b12c);}(_0x6a43,0xcc));var _0x36a4=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x6a43[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x36a4('0x0'));var util=require(_0x36a4('0x1'));var logger=require(_0x36a4('0x2'))(_0x36a4('0x3'));var moment=require(_0x36a4('0x4'));var BPromise=require(_0x36a4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x36a4('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x36a4('0x7')]=function(_0x119fcd,_0x5cddfc){return _0x119fcd['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x36a4('0x8'),'collate':_0x36a4('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index cf9c6de..a3fd90c 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(_0x12ffc2,_0x986256){var _0x3642b5=function(_0x5b173f){while(--_0x5b173f){_0x12ffc2['push'](_0x12ffc2['shift']());}};_0x3642b5(++_0x986256);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x138834,_0x1cd85a){var _0x4ddd18=function(_0x515f50){while(--_0x515f50){_0x138834['push'](_0x138834['shift']());}};_0x4ddd18(++_0x1cd85a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 843e130..b19ce6d 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 _0xb6fe=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xb6fe,0x77));var _0xeb6f=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0xb6fe[_0x4ce028];return _0x583d0c;};'use strict';var multer=require(_0xeb6f('0x0'));var util=require(_0xeb6f('0x1'));var path=require('path');var timeout=require(_0xeb6f('0x2'));var express=require(_0xeb6f('0x3'));var router=express[_0xeb6f('0x4')]();var fs_extra=require(_0xeb6f('0x5'));var auth=require(_0xeb6f('0x6'));var interaction=require(_0xeb6f('0x7'));var config=require('../../config/environment');var controller=require(_0xeb6f('0x8'));router[_0xeb6f('0x9')]('/',auth[_0xeb6f('0xa')](),controller[_0xeb6f('0xb')]);router[_0xeb6f('0x9')](_0xeb6f('0xc'),auth[_0xeb6f('0xa')](),controller[_0xeb6f('0xd')]);router[_0xeb6f('0xe')]('/',auth[_0xeb6f('0xa')](),controller[_0xeb6f('0xf')]);router['put'](_0xeb6f('0xc'),auth[_0xeb6f('0xa')](),controller[_0xeb6f('0x10')]);router[_0xeb6f('0x11')](_0xeb6f('0xc'),auth['isAuthenticated'](),controller[_0xeb6f('0x12')]);module[_0xeb6f('0x13')]=router; \ No newline at end of file +var _0x8991=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8991,0x131));var _0x1899=function(_0x370597,_0x39eaf2){_0x370597=_0x370597-0x0;var _0x3e5ca2=_0x8991[_0x370597];return _0x3e5ca2;};'use strict';var multer=require(_0x1899('0x0'));var util=require(_0x1899('0x1'));var path=require(_0x1899('0x2'));var timeout=require('connect-timeout');var express=require(_0x1899('0x3'));var router=express[_0x1899('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1899('0x5'));var interaction=require(_0x1899('0x6'));var config=require(_0x1899('0x7'));var controller=require('./cannedAnswer.controller');router[_0x1899('0x8')]('/',auth[_0x1899('0x9')](),controller[_0x1899('0xa')]);router[_0x1899('0x8')](_0x1899('0xb'),auth[_0x1899('0x9')](),controller['show']);router[_0x1899('0xc')]('/',auth[_0x1899('0x9')](),controller[_0x1899('0xd')]);router[_0x1899('0xe')](_0x1899('0xb'),auth[_0x1899('0x9')](),controller[_0x1899('0xf')]);router[_0x1899('0x10')](_0x1899('0xb'),auth[_0x1899('0x9')](),controller[_0x1899('0x11')]);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 0064321..1f64c8d 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 _0x477a=['STRING','INTEGER','sequelize','DATE','1970-01-01\x2000:00:01'];(function(_0x574583,_0x385ca9){var _0x569ff1=function(_0x53f809){while(--_0x53f809){_0x574583['push'](_0x574583['shift']());}};_0x569ff1(++_0x385ca9);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa477('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xa477('0x1')],'allowNull':![],'defaultValue':_0xa477('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xa477('0x3')]},'dst':{'type':Sequelize[_0xa477('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xa477('0x3')]},'lastapp':{'type':Sequelize[_0xa477('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xa477('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa477('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa477('0x3')]},'amaflags':{'type':Sequelize[_0xa477('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xa477('0x3')]},'userfield':{'type':Sequelize[_0xa477('0x3')]},'uniqueid':{'type':Sequelize[_0xa477('0x3')]},'linkedid':{'type':Sequelize[_0xa477('0x3')]},'sequence':{'type':Sequelize[_0xa477('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa477('0x3')]},'tag':{'type':Sequelize[_0xa477('0x3')]}}; \ No newline at end of file +var _0xa75b=['sequelize','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x15b192,_0x38c235){var _0x396e73=function(_0x4ba480){while(--_0x4ba480){_0x15b192['push'](_0x15b192['shift']());}};_0x396e73(++_0x38c235);}(_0xa75b,0x170));var _0xba75=function(_0x3e44f0,_0x369014){_0x3e44f0=_0x3e44f0-0x0;var _0xa99b61=_0xa75b[_0x3e44f0];return _0xa99b61;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xba75('0x1')},'clid':{'type':Sequelize[_0xba75('0x2')]},'src':{'type':Sequelize[_0xba75('0x2')]},'dst':{'type':Sequelize[_0xba75('0x2')]},'dcontext':{'type':Sequelize[_0xba75('0x2')]},'channel':{'type':Sequelize[_0xba75('0x2')]},'dstchannel':{'type':Sequelize[_0xba75('0x2')]},'lastapp':{'type':Sequelize[_0xba75('0x2')]},'lastdata':{'type':Sequelize[_0xba75('0x2')]},'duration':{'type':Sequelize[_0xba75('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xba75('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xba75('0x2')]},'amaflags':{'type':Sequelize[_0xba75('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xba75('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xba75('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xba75('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b07e6fe..c6844c2 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 _0xac95=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','catch','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','index','map','Cdr','type','key','model'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0xac95,0xa8));var _0x5ac9=function(_0x25bd14,_0x43fcc1){_0x25bd14=_0x25bd14-0x0;var _0x91eb8b=_0xac95[_0x25bd14];return _0x91eb8b;};'use strict';var emlformat=require(_0x5ac9('0x0'));var rimraf=require(_0x5ac9('0x1'));var zipdir=require(_0x5ac9('0x2'));var jsonpatch=require(_0x5ac9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ac9('0x4'));var Mustache=require(_0x5ac9('0x5'));var util=require('util');var path=require(_0x5ac9('0x6'));var sox=require(_0x5ac9('0x7'));var csv=require('to-csv');var ejs=require(_0x5ac9('0x8'));var fs=require('fs');var fs_extra=require(_0x5ac9('0x9'));var _=require(_0x5ac9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ac9('0xb'));var deskjs=require(_0x5ac9('0xc'));var toCsv=require(_0x5ac9('0xd'));var querystring=require(_0x5ac9('0xe'));var Papa=require(_0x5ac9('0xf'));var Redis=require(_0x5ac9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5ac9('0x11'));var as=require(_0x5ac9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ac9('0x13'))('api');var utils=require(_0x5ac9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5ac9('0x15'));var db=require(_0x5ac9('0x16'))['db'];function respondWithStatusCode(_0x371231,_0x40eb62){_0x40eb62=_0x40eb62||0xcc;return function(_0x4f9a04){if(_0x4f9a04){return _0x371231['sendStatus'](_0x40eb62);}return _0x371231[_0x5ac9('0x17')](_0x40eb62)['end']();};}function respondWithResult(_0x3a7d64,_0x364007){_0x364007=_0x364007||0xc8;return function(_0x50658c){if(_0x50658c){return _0x3a7d64[_0x5ac9('0x17')](_0x364007)[_0x5ac9('0x18')](_0x50658c);}};}function respondWithFilteredResult(_0x3f8fac,_0x122590){return function(_0x456ed9){if(_0x456ed9){var _0x2fe47e=typeof _0x122590[_0x5ac9('0x19')]===_0x5ac9('0x1a')&&typeof _0x122590[_0x5ac9('0x1b')]==='undefined';var _0x53a8db=_0x456ed9[_0x5ac9('0x1c')];var _0x193c56=_0x2fe47e?0x0:_0x122590[_0x5ac9('0x19')];var _0x4463ff=_0x2fe47e?_0x456ed9[_0x5ac9('0x1c')]:_0x122590[_0x5ac9('0x19')]+_0x122590[_0x5ac9('0x1b')];var _0x429bf3;if(_0x4463ff>=_0x53a8db){_0x4463ff=_0x53a8db;_0x429bf3=0xc8;}else{_0x429bf3=0xce;}_0x3f8fac[_0x5ac9('0x17')](_0x429bf3);return _0x3f8fac[_0x5ac9('0x1d')](_0x5ac9('0x1e'),_0x193c56+'-'+_0x4463ff+'/'+_0x53a8db)[_0x5ac9('0x18')](_0x456ed9);}return null;};}function patchUpdates(_0x2efa5f){return function(_0x479c6b){try{jsonpatch[_0x5ac9('0x1f')](_0x479c6b,_0x2efa5f,!![]);}catch(_0x1f5546){return BPromise[_0x5ac9('0x20')](_0x1f5546);}return _0x479c6b[_0x5ac9('0x21')]();};}function saveUpdates(_0x2d2ba5,_0x492679){return function(_0x45417d){if(_0x45417d){return _0x45417d[_0x5ac9('0x22')](_0x2d2ba5)['then'](function(_0x5e42a1){return _0x5e42a1;});}return null;};}function removeEntity(_0x5a4664,_0xc36d2){return function(_0x2e666b){if(_0x2e666b){return _0x2e666b['destroy']()['then'](function(){_0x5a4664[_0x5ac9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49352f,_0x2d1bb5){return function(_0x505acc){if(!_0x505acc){_0x49352f[_0x5ac9('0x23')](0x194);}return _0x505acc;};}function handleError(_0x3b77be,_0x770c48){_0x770c48=_0x770c48||0x1f4;return function(_0x3a7f68){logger[_0x5ac9('0x24')](_0x3a7f68[_0x5ac9('0x25')]);if(_0x3a7f68[_0x5ac9('0x26')]){delete _0x3a7f68[_0x5ac9('0x26')];}_0x3b77be[_0x5ac9('0x17')](_0x770c48)['send'](_0x3a7f68);};}exports[_0x5ac9('0x27')]=function(_0x14a7fe,_0x2a7db9){var _0x3a536c={},_0x3d51ab={},_0x58c9be={'count':0x0,'rows':[]};var _0x47f6ad=_[_0x5ac9('0x28')](db[_0x5ac9('0x29')]['rawAttributes'],function(_0x3a15cf){return{'name':_0x3a15cf['fieldName'],'type':_0x3a15cf[_0x5ac9('0x2a')][_0x5ac9('0x2b')]};});_0x3d51ab[_0x5ac9('0x2c')]=_['map'](_0x47f6ad,_0x5ac9('0x26'));_0x3d51ab[_0x5ac9('0x2d')]=_[_0x5ac9('0x2e')](_0x14a7fe[_0x5ac9('0x2d')]);_0x3d51ab[_0x5ac9('0x2f')]=_[_0x5ac9('0x30')](_0x3d51ab['model'],_0x3d51ab['query']);_0x3a536c[_0x5ac9('0x31')]=_['intersection'](_0x3d51ab['model'],qs[_0x5ac9('0x32')](_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x32')]));_0x3a536c[_0x5ac9('0x31')]=_0x3a536c[_0x5ac9('0x31')][_0x5ac9('0x33')]?_0x3a536c[_0x5ac9('0x31')]:_0x3d51ab[_0x5ac9('0x2c')];if(!_0x14a7fe[_0x5ac9('0x2d')]['hasOwnProperty'](_0x5ac9('0x34'))){_0x3a536c[_0x5ac9('0x1b')]=qs['limit'](_0x14a7fe['query'][_0x5ac9('0x1b')]);_0x3a536c[_0x5ac9('0x19')]=qs[_0x5ac9('0x19')](_0x14a7fe[_0x5ac9('0x2d')]['offset']);}_0x3a536c[_0x5ac9('0x35')]=qs['sort'](_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x36')]);_0x3a536c[_0x5ac9('0x37')]=qs[_0x5ac9('0x2f')](_[_0x5ac9('0x38')](_0x14a7fe[_0x5ac9('0x2d')],_0x3d51ab[_0x5ac9('0x2f')]),_0x47f6ad);if(_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x39')]){_0x3a536c[_0x5ac9('0x37')]=_[_0x5ac9('0x3a')](_0x3a536c[_0x5ac9('0x37')],{'$or':_['map'](_0x47f6ad,function(_0x5d57ff){if(_0x5d57ff[_0x5ac9('0x2a')]!==_0x5ac9('0x3b')){var _0x3003f6={};_0x3003f6[_0x5d57ff[_0x5ac9('0x26')]]={'$like':'%'+_0x14a7fe[_0x5ac9('0x2d')][_0x5ac9('0x39')]+'%'};return _0x3003f6;}})});}_0x3a536c=_['merge']({},_0x3a536c,_0x14a7fe[_0x5ac9('0x3c')]);var _0x16b74e={'where':_0x3a536c['where']};return db['Cdr']['count'](_0x16b74e)[_0x5ac9('0x3d')](function(_0xc6be86){_0x58c9be[_0x5ac9('0x1c')]=_0xc6be86;if(_0x14a7fe[_0x5ac9('0x2d')]['includeAll']){_0x3a536c[_0x5ac9('0x3e')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0x3a536c);})[_0x5ac9('0x3d')](function(_0x45bc9b){_0x58c9be['rows']=_0x45bc9b;return _0x58c9be;})[_0x5ac9('0x3d')](respondWithFilteredResult(_0x2a7db9,_0x3a536c))[_0x5ac9('0x3f')](handleError(_0x2a7db9,null));};exports['show']=function(_0x2a1c19,_0xba7c84){var _0x433634={'raw':!![],'where':{'id':_0x2a1c19[_0x5ac9('0x40')]['id']}},_0x1caf84={};_0x1caf84[_0x5ac9('0x2c')]=_[_0x5ac9('0x2e')](db[_0x5ac9('0x29')][_0x5ac9('0x41')]);_0x1caf84[_0x5ac9('0x2d')]=_[_0x5ac9('0x2e')](_0x2a1c19[_0x5ac9('0x2d')]);_0x1caf84['filters']=_[_0x5ac9('0x30')](_0x1caf84[_0x5ac9('0x2c')],_0x1caf84[_0x5ac9('0x2d')]);_0x433634['attributes']=_[_0x5ac9('0x30')](_0x1caf84[_0x5ac9('0x2c')],qs[_0x5ac9('0x32')](_0x2a1c19['query'][_0x5ac9('0x32')]));_0x433634[_0x5ac9('0x31')]=_0x433634[_0x5ac9('0x31')][_0x5ac9('0x33')]?_0x433634[_0x5ac9('0x31')]:_0x1caf84[_0x5ac9('0x2c')];if(_0x2a1c19['query']['includeAll']){_0x433634[_0x5ac9('0x3e')]=[{'all':!![]}];}_0x433634=_['merge']({},_0x433634,_0x2a1c19[_0x5ac9('0x3c')]);return db['Cdr'][_0x5ac9('0x42')](_0x433634)[_0x5ac9('0x3d')](handleEntityNotFound(_0xba7c84,null))[_0x5ac9('0x3d')](respondWithResult(_0xba7c84,null))[_0x5ac9('0x3f')](handleError(_0xba7c84,null));};exports[_0x5ac9('0x43')]=function(_0x671363,_0x324b7d){return db[_0x5ac9('0x29')][_0x5ac9('0x43')](_0x671363[_0x5ac9('0x44')],{})[_0x5ac9('0x3d')](respondWithResult(_0x324b7d,0xc9))['catch'](handleError(_0x324b7d,null));};exports[_0x5ac9('0x22')]=function(_0x4bb9c7,_0x482df4){if(_0x4bb9c7['body']['id']){delete _0x4bb9c7[_0x5ac9('0x44')]['id'];}return db[_0x5ac9('0x29')][_0x5ac9('0x42')]({'where':{'id':_0x4bb9c7['params']['id']}})[_0x5ac9('0x3d')](handleEntityNotFound(_0x482df4,null))[_0x5ac9('0x3d')](saveUpdates(_0x4bb9c7[_0x5ac9('0x44')],null))[_0x5ac9('0x3d')](respondWithResult(_0x482df4,null))[_0x5ac9('0x3f')](handleError(_0x482df4,null));};exports[_0x5ac9('0x45')]=function(_0x499fd3,_0x47a7b8){return db[_0x5ac9('0x29')][_0x5ac9('0x42')]({'where':{'id':_0x499fd3['params']['id']}})[_0x5ac9('0x3d')](handleEntityNotFound(_0x47a7b8,null))[_0x5ac9('0x3d')](removeEntity(_0x47a7b8,null))[_0x5ac9('0x3f')](handleError(_0x47a7b8,null));};exports[_0x5ac9('0x46')]=function(_0x6b3995,_0x575a3f){return db[_0x5ac9('0x29')][_0x5ac9('0x46')]()[_0x5ac9('0x3d')](respondWithResult(_0x575a3f,null))['catch'](handleError(_0x575a3f,null));}; \ No newline at end of file +var _0x0d4d=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','Cdr','rows','catch','show','params','keys','length','find','create','body','destroy','describe','eml-format','rimraf'];(function(_0x48a509,_0x30df45){var _0x4155e9=function(_0x29301f){while(--_0x29301f){_0x48a509['push'](_0x48a509['shift']());}};_0x4155e9(++_0x30df45);}(_0x0d4d,0x132));var _0xd0d4=function(_0x257628,_0x1e289b){_0x257628=_0x257628-0x0;var _0x375610=_0x0d4d[_0x257628];return _0x375610;};'use strict';var emlformat=require(_0xd0d4('0x0'));var rimraf=require(_0xd0d4('0x1'));var zipdir=require(_0xd0d4('0x2'));var jsonpatch=require(_0xd0d4('0x3'));var rp=require(_0xd0d4('0x4'));var moment=require(_0xd0d4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd0d4('0x6'));var util=require('util');var path=require(_0xd0d4('0x7'));var sox=require(_0xd0d4('0x8'));var csv=require('to-csv');var ejs=require(_0xd0d4('0x9'));var fs=require('fs');var fs_extra=require(_0xd0d4('0xa'));var _=require(_0xd0d4('0xb'));var squel=require('squel');var crypto=require(_0xd0d4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd0d4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd0d4('0xe'));var Papa=require(_0xd0d4('0xf'));var Redis=require(_0xd0d4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd0d4('0x11'));var as=require(_0xd0d4('0x12'));var hardwareService=require(_0xd0d4('0x13'));var logger=require(_0xd0d4('0x14'))(_0xd0d4('0x15'));var utils=require(_0xd0d4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd0d4('0x17'));var db=require(_0xd0d4('0x18'))['db'];function respondWithStatusCode(_0x29ee49,_0x2ddeca){_0x2ddeca=_0x2ddeca||0xcc;return function(_0x38ca06){if(_0x38ca06){return _0x29ee49[_0xd0d4('0x19')](_0x2ddeca);}return _0x29ee49['status'](_0x2ddeca)[_0xd0d4('0x1a')]();};}function respondWithResult(_0x2131c8,_0x10a175){_0x10a175=_0x10a175||0xc8;return function(_0x5d6dd7){if(_0x5d6dd7){return _0x2131c8['status'](_0x10a175)[_0xd0d4('0x1b')](_0x5d6dd7);}};}function respondWithFilteredResult(_0x186405,_0x553b47){return function(_0x29bda4){if(_0x29bda4){var _0x1e8608=typeof _0x553b47['offset']==='undefined'&&typeof _0x553b47[_0xd0d4('0x1c')]===_0xd0d4('0x1d');var _0x268e1a=_0x29bda4['count'];var _0x5cf4c6=_0x1e8608?0x0:_0x553b47['offset'];var _0x407cda=_0x1e8608?_0x29bda4[_0xd0d4('0x1e')]:_0x553b47[_0xd0d4('0x1f')]+_0x553b47['limit'];var _0x568c75;if(_0x407cda>=_0x268e1a){_0x407cda=_0x268e1a;_0x568c75=0xc8;}else{_0x568c75=0xce;}_0x186405[_0xd0d4('0x20')](_0x568c75);return _0x186405['set'](_0xd0d4('0x21'),_0x5cf4c6+'-'+_0x407cda+'/'+_0x268e1a)[_0xd0d4('0x1b')](_0x29bda4);}return null;};}function patchUpdates(_0x1dcc1b){return function(_0x485cd8){try{jsonpatch[_0xd0d4('0x22')](_0x485cd8,_0x1dcc1b,!![]);}catch(_0x4d9fac){return BPromise['reject'](_0x4d9fac);}return _0x485cd8[_0xd0d4('0x23')]();};}function saveUpdates(_0xda03dd,_0x49b6f0){return function(_0x50f959){if(_0x50f959){return _0x50f959[_0xd0d4('0x24')](_0xda03dd)[_0xd0d4('0x25')](function(_0x398a00){return _0x398a00;});}return null;};}function removeEntity(_0x4c94b1,_0x1d8033){return function(_0x1c0831){if(_0x1c0831){return _0x1c0831['destroy']()[_0xd0d4('0x25')](function(){_0x4c94b1['status'](0xcc)[_0xd0d4('0x1a')]();});}};}function handleEntityNotFound(_0x1b03ef,_0x16808c){return function(_0x5380c3){if(!_0x5380c3){_0x1b03ef['sendStatus'](0x194);}return _0x5380c3;};}function handleError(_0x131de5,_0x4e7cc1){_0x4e7cc1=_0x4e7cc1||0x1f4;return function(_0x50e7f0){logger[_0xd0d4('0x26')](_0x50e7f0[_0xd0d4('0x27')]);if(_0x50e7f0[_0xd0d4('0x28')]){delete _0x50e7f0[_0xd0d4('0x28')];}_0x131de5['status'](_0x4e7cc1)[_0xd0d4('0x29')](_0x50e7f0);};}exports[_0xd0d4('0x2a')]=function(_0x45acf8,_0x22e142){var _0x7eecce={},_0xefce4f={},_0x1b07e8={'count':0x0,'rows':[]};var _0x266b91=_[_0xd0d4('0x2b')](db['Cdr'][_0xd0d4('0x2c')],function(_0x7aa87e){return{'name':_0x7aa87e[_0xd0d4('0x2d')],'type':_0x7aa87e[_0xd0d4('0x2e')][_0xd0d4('0x2f')]};});_0xefce4f[_0xd0d4('0x30')]=_['map'](_0x266b91,'name');_0xefce4f[_0xd0d4('0x31')]=_['keys'](_0x45acf8[_0xd0d4('0x31')]);_0xefce4f[_0xd0d4('0x32')]=_[_0xd0d4('0x33')](_0xefce4f[_0xd0d4('0x30')],_0xefce4f[_0xd0d4('0x31')]);_0x7eecce[_0xd0d4('0x34')]=_[_0xd0d4('0x33')](_0xefce4f['model'],qs['fields'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x35')]));_0x7eecce['attributes']=_0x7eecce[_0xd0d4('0x34')]['length']?_0x7eecce['attributes']:_0xefce4f[_0xd0d4('0x30')];if(!_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x36')](_0xd0d4('0x37'))){_0x7eecce['limit']=qs['limit'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x1c')]);_0x7eecce[_0xd0d4('0x1f')]=qs['offset'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x1f')]);}_0x7eecce[_0xd0d4('0x38')]=qs[_0xd0d4('0x39')](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x39')]);_0x7eecce[_0xd0d4('0x3a')]=qs[_0xd0d4('0x32')](_['pick'](_0x45acf8[_0xd0d4('0x31')],_0xefce4f['filters']),_0x266b91);if(_0x45acf8['query'][_0xd0d4('0x3b')]){_0x7eecce['where']=_[_0xd0d4('0x3c')](_0x7eecce[_0xd0d4('0x3a')],{'$or':_[_0xd0d4('0x2b')](_0x266b91,function(_0x1d6329){if(_0x1d6329[_0xd0d4('0x2e')]!==_0xd0d4('0x3d')){var _0x560e77={};_0x560e77[_0x1d6329[_0xd0d4('0x28')]]={'$like':'%'+_0x45acf8[_0xd0d4('0x31')]['filter']+'%'};return _0x560e77;}})});}_0x7eecce=_['merge']({},_0x7eecce,_0x45acf8[_0xd0d4('0x3e')]);var _0x3e6527={'where':_0x7eecce[_0xd0d4('0x3a')]};return db['Cdr'][_0xd0d4('0x1e')](_0x3e6527)[_0xd0d4('0x25')](function(_0x230101){_0x1b07e8[_0xd0d4('0x1e')]=_0x230101;if(_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x3f')]){_0x7eecce[_0xd0d4('0x40')]=[{'all':!![]}];}return db[_0xd0d4('0x41')]['findAll'](_0x7eecce);})[_0xd0d4('0x25')](function(_0x4174e8){_0x1b07e8[_0xd0d4('0x42')]=_0x4174e8;return _0x1b07e8;})['then'](respondWithFilteredResult(_0x22e142,_0x7eecce))[_0xd0d4('0x43')](handleError(_0x22e142,null));};exports[_0xd0d4('0x44')]=function(_0x5db657,_0x11b77e){var _0x32d1c1={'raw':!![],'where':{'id':_0x5db657[_0xd0d4('0x45')]['id']}},_0x429b84={};_0x429b84[_0xd0d4('0x30')]=_[_0xd0d4('0x46')](db['Cdr'][_0xd0d4('0x2c')]);_0x429b84[_0xd0d4('0x31')]=_[_0xd0d4('0x46')](_0x5db657[_0xd0d4('0x31')]);_0x429b84['filters']=_[_0xd0d4('0x33')](_0x429b84[_0xd0d4('0x30')],_0x429b84[_0xd0d4('0x31')]);_0x32d1c1[_0xd0d4('0x34')]=_[_0xd0d4('0x33')](_0x429b84[_0xd0d4('0x30')],qs[_0xd0d4('0x35')](_0x5db657['query'][_0xd0d4('0x35')]));_0x32d1c1[_0xd0d4('0x34')]=_0x32d1c1['attributes'][_0xd0d4('0x47')]?_0x32d1c1[_0xd0d4('0x34')]:_0x429b84[_0xd0d4('0x30')];if(_0x5db657[_0xd0d4('0x31')][_0xd0d4('0x3f')]){_0x32d1c1[_0xd0d4('0x40')]=[{'all':!![]}];}_0x32d1c1=_['merge']({},_0x32d1c1,_0x5db657[_0xd0d4('0x3e')]);return db['Cdr'][_0xd0d4('0x48')](_0x32d1c1)[_0xd0d4('0x25')](handleEntityNotFound(_0x11b77e,null))['then'](respondWithResult(_0x11b77e,null))[_0xd0d4('0x43')](handleError(_0x11b77e,null));};exports['create']=function(_0x5d61d5,_0x1dad8b){return db['Cdr'][_0xd0d4('0x49')](_0x5d61d5[_0xd0d4('0x4a')],{})['then'](respondWithResult(_0x1dad8b,0xc9))[_0xd0d4('0x43')](handleError(_0x1dad8b,null));};exports['update']=function(_0xdf2562,_0x258cd1){if(_0xdf2562[_0xd0d4('0x4a')]['id']){delete _0xdf2562[_0xd0d4('0x4a')]['id'];}return db[_0xd0d4('0x41')][_0xd0d4('0x48')]({'where':{'id':_0xdf2562[_0xd0d4('0x45')]['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x258cd1,null))[_0xd0d4('0x25')](saveUpdates(_0xdf2562['body'],null))['then'](respondWithResult(_0x258cd1,null))[_0xd0d4('0x43')](handleError(_0x258cd1,null));};exports[_0xd0d4('0x4b')]=function(_0x333a5b,_0x6af64e){return db[_0xd0d4('0x41')][_0xd0d4('0x48')]({'where':{'id':_0x333a5b[_0xd0d4('0x45')]['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x6af64e,null))[_0xd0d4('0x25')](removeEntity(_0x6af64e,null))['catch'](handleError(_0x6af64e,null));};exports[_0xd0d4('0x4c')]=function(_0x5b23bb,_0x4b97e1){return db[_0xd0d4('0x41')]['describe']()[_0xd0d4('0x25')](respondWithResult(_0x4b97e1,null))[_0xd0d4('0x43')](handleError(_0x4b97e1,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 43e9327..f7b2395 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1d5cc5,_0x3b5590){var _0x1a1b07=function(_0x44ab26){while(--_0x44ab26){_0x1d5cc5['push'](_0x1d5cc5['shift']());}};_0x1a1b07(++_0x3b5590);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2ecd25,_0x208a4a){var _0xbc7ceb=function(_0x28ad5b){while(--_0x28ad5b){_0x2ecd25['push'](_0x2ecd25['shift']());}};_0xbc7ceb(++_0x208a4a);}(_0x7a54,0x106));var _0x47a5=function(_0x3bf46c,_0x3acbb5){_0x3bf46c=_0x3bf46c-0x0;var _0x3e8169=_0x7a54[_0x3bf46c];return _0x3e8169;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 0ffe4fc..314d5ed 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 _0x771d=['../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x277d91,_0x1d7d34){var _0xecff0a=function(_0x5c4ec7){while(--_0x5c4ec7){_0x277d91['push'](_0x277d91['shift']());}};_0xecff0a(++_0x1d7d34);}(_0x771d,0xf2));var _0xd771=function(_0x5f2062,_0x5d4868){_0x5f2062=_0x5f2062-0x0;var _0x595a19=_0x771d[_0x5f2062];return _0x595a19;};'use strict';var _=require(_0xd771('0x0'));var util=require(_0xd771('0x1'));var moment=require(_0xd771('0x2'));var BPromise=require(_0xd771('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd771('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd771('0x5'));var jayson=require(_0xd771('0x6'));var client=jayson[_0xd771('0x7')][_0xd771('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52d3c6,_0x4a9cf5,_0x27ca30){return new BPromise(function(_0x4f27a6,_0x4a1165){return client[_0xd771('0x9')](_0x52d3c6,_0x27ca30)['then'](function(_0x4736a4){logger[_0xd771('0xa')](_0xd771('0xb'),_0x4a9cf5,'request\x20sent');logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x4a9cf5,'request\x20sent',JSON[_0xd771('0xc')](_0x4736a4));if(_0x4736a4[_0xd771('0xd')]){if(_0x4736a4[_0xd771('0xd')][_0xd771('0xe')]===0x1f4){logger[_0xd771('0xd')](_0xd771('0xb'),_0x4a9cf5,_0x4736a4[_0xd771('0xd')][_0xd771('0xf')]);return _0x4a1165(_0x4736a4['error']['message']);}logger['error'](_0xd771('0xb'),_0x4a9cf5,_0x4736a4[_0xd771('0xd')][_0xd771('0xf')]);return _0x4f27a6(_0x4736a4[_0xd771('0xd')][_0xd771('0xf')]);}else{logger[_0xd771('0xa')](_0xd771('0xb'),_0x4a9cf5,_0xd771('0x10'));_0x4f27a6(_0x4736a4[_0xd771('0x11')][_0xd771('0xf')]);}})[_0xd771('0x12')](function(_0x5029c3){logger[_0xd771('0xd')]('Cdr,\x20%s,\x20%s',_0x4a9cf5,_0x5029c3);_0x4a1165(_0x5029c3);});});} \ No newline at end of file +var _0xd257=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','error','code','message','Cdr,\x20%s,\x20%s','info','catch','lodash','moment'];(function(_0x34966f,_0x132d0e){var _0x47db98=function(_0xe12a5c){while(--_0xe12a5c){_0x34966f['push'](_0x34966f['shift']());}};_0x47db98(++_0x132d0e);}(_0xd257,0xda));var _0x7d25=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0xd257[_0x26721d];return _0x1035c5;};'use strict';var _=require(_0x7d25('0x0'));var util=require('util');var moment=require(_0x7d25('0x1'));var BPromise=require(_0x7d25('0x2'));var rs=require(_0x7d25('0x3'));var fs=require('fs');var Redis=require(_0x7d25('0x4'));var db=require(_0x7d25('0x5'))['db'];var utils=require(_0x7d25('0x6'));var logger=require(_0x7d25('0x7'))(_0x7d25('0x8'));var config=require(_0x7d25('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d25('0xa')][_0x7d25('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x221675,_0x236db0,_0x2ccb63){return new BPromise(function(_0x1b4b3c,_0x5f4ee3){return client[_0x7d25('0xc')](_0x221675,_0x2ccb63)[_0x7d25('0xd')](function(_0x16f25b){logger['info']('Cdr,\x20%s,\x20%s',_0x236db0,_0x7d25('0xe'));logger[_0x7d25('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x236db0,_0x7d25('0xe'),JSON['stringify'](_0x16f25b));if(_0x16f25b[_0x7d25('0x10')]){if(_0x16f25b['error'][_0x7d25('0x11')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x236db0,_0x16f25b[_0x7d25('0x10')][_0x7d25('0x12')]);return _0x5f4ee3(_0x16f25b[_0x7d25('0x10')]['message']);}logger[_0x7d25('0x10')](_0x7d25('0x13'),_0x236db0,_0x16f25b['error']['message']);return _0x1b4b3c(_0x16f25b[_0x7d25('0x10')][_0x7d25('0x12')]);}else{logger[_0x7d25('0x14')](_0x7d25('0x13'),_0x236db0,_0x7d25('0xe'));_0x1b4b3c(_0x16f25b['result'][_0x7d25('0x12')]);}})[_0x7d25('0x15')](function(_0x41e04d){logger['error']('Cdr,\x20%s,\x20%s',_0x236db0,_0x41e04d);_0x5f4ee3(_0x41e04d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index b54b6de..40d9a0c 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 _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(_0x337e69,_0x11abb1){var _0x2289f3=function(_0x237caf){while(--_0x237caf){_0x337e69['push'](_0x337e69['shift']());}};_0x2289f3(++_0x11abb1);}(_0xb10b,0x12a));var _0xbb10=function(_0x533437,_0x4d59d1){_0x533437=_0x533437-0x0;var _0x53f4ce=_0xb10b[_0x533437];return _0x53f4ce;};'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 +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(_0x3db1b9,_0x57534b){var _0x5a9149=function(_0x3dd442){while(--_0x3dd442){_0x3db1b9['push'](_0x3db1b9['shift']());}};_0x5a9149(++_0x57534b);}(_0xb10b,0x12a));var _0xbb10=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0xb10b[_0x384231];return _0x2480bf;};'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 9b2a6e3..aa10087 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 _0x0306=['exports','STRING','noop','*,*,*,*'];(function(_0x50afd6,_0x106a96){var _0x5ccc53=function(_0x3a5bb7){while(--_0x3a5bb7){_0x50afd6['push'](_0x50afd6['shift']());}};_0x5ccc53(++_0x106a96);}(_0x0306,0x150));var _0x6030=function(_0x5814f9,_0x1c030f){_0x5814f9=_0x5814f9-0x0;var _0xd78980=_0x0306[_0x5814f9];return _0xd78980;};'use strict';var Sequelize=require('sequelize');module[_0x6030('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6030('0x1')],'allowNull':![],'defaultValue':_0x6030('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6030('0x1')],'defaultValue':_0x6030('0x3')}}; \ No newline at end of file +var _0xce49=['exports','STRING','TEXT'];(function(_0x29e3b6,_0x40b0b4){var _0x55d4b0=function(_0x55c58e){while(--_0x55c58e){_0x29e3b6['push'](_0x29e3b6['shift']());}};_0x55d4b0(++_0x40b0b4);}(_0xce49,0x1d1));var _0x9ce4=function(_0x334d99,_0x102158){_0x334d99=_0x334d99-0x0;var _0x346eed=_0xce49[_0x334d99];return _0x346eed;};'use strict';var Sequelize=require('sequelize');module[_0x9ce4('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9ce4('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9ce4('0x2')]()},'description':{'type':Sequelize['STRING']},'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 1da59cc..c74036f 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 _0x10b8=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','model','ChatApplication','rawAttributes','query','keys','filters','attributes','intersection','fields','length','includeAll','include','options','find','catch','body','params','eml-format','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x10b8,0x166));var _0x810b=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x10b8[_0xef8146];return _0x5a6cb0;};'use strict';var emlformat=require(_0x810b('0x0'));var rimraf=require(_0x810b('0x1'));var zipdir=require(_0x810b('0x2'));var jsonpatch=require(_0x810b('0x3'));var rp=require(_0x810b('0x4'));var moment=require(_0x810b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x810b('0x6'));var util=require(_0x810b('0x7'));var path=require(_0x810b('0x8'));var sox=require('sox');var csv=require(_0x810b('0x9'));var ejs=require(_0x810b('0xa'));var fs=require('fs');var fs_extra=require(_0x810b('0xb'));var _=require(_0x810b('0xc'));var squel=require(_0x810b('0xd'));var crypto=require(_0x810b('0xe'));var jsforce=require(_0x810b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x810b('0x9'));var querystring=require('querystring');var Papa=require(_0x810b('0x10'));var Redis=require(_0x810b('0x11'));var authService=require(_0x810b('0x12'));var qs=require(_0x810b('0x13'));var as=require(_0x810b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x810b('0x15'))(_0x810b('0x16'));var utils=require(_0x810b('0x17'));var config=require(_0x810b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x810b('0x19'))['db'];function respondWithStatusCode(_0x1cc57d,_0x24bb1d){_0x24bb1d=_0x24bb1d||0xcc;return function(_0x2069a9){if(_0x2069a9){return _0x1cc57d[_0x810b('0x1a')](_0x24bb1d);}return _0x1cc57d[_0x810b('0x1b')](_0x24bb1d)[_0x810b('0x1c')]();};}function respondWithResult(_0xcdb5c2,_0x26209b){_0x26209b=_0x26209b||0xc8;return function(_0x3e3e52){if(_0x3e3e52){return _0xcdb5c2['status'](_0x26209b)['json'](_0x3e3e52);}};}function respondWithFilteredResult(_0x249f8a,_0xbbc69b){return function(_0x1f2d52){if(_0x1f2d52){var _0xea1d2a=typeof _0xbbc69b[_0x810b('0x1d')]===_0x810b('0x1e')&&typeof _0xbbc69b[_0x810b('0x1f')]===_0x810b('0x1e');var _0x43f099=_0x1f2d52[_0x810b('0x20')];var _0x4a31a6=_0xea1d2a?0x0:_0xbbc69b[_0x810b('0x1d')];var _0x540741=_0xea1d2a?_0x1f2d52[_0x810b('0x20')]:_0xbbc69b[_0x810b('0x1d')]+_0xbbc69b[_0x810b('0x1f')];var _0x55ea1c;if(_0x540741>=_0x43f099){_0x540741=_0x43f099;_0x55ea1c=0xc8;}else{_0x55ea1c=0xce;}_0x249f8a[_0x810b('0x1b')](_0x55ea1c);return _0x249f8a['set'](_0x810b('0x21'),_0x4a31a6+'-'+_0x540741+'/'+_0x43f099)['json'](_0x1f2d52);}return null;};}function patchUpdates(_0x2906df){return function(_0x51b3be){try{jsonpatch[_0x810b('0x22')](_0x51b3be,_0x2906df,!![]);}catch(_0x24e74c){return BPromise[_0x810b('0x23')](_0x24e74c);}return _0x51b3be['save']();};}function saveUpdates(_0x1e3642,_0x483284){return function(_0x121178){if(_0x121178){return _0x121178[_0x810b('0x24')](_0x1e3642)[_0x810b('0x25')](function(_0x4578a5){return _0x4578a5;});}return null;};}function removeEntity(_0x4fdf04,_0x6196a7){return function(_0x525277){if(_0x525277){return _0x525277[_0x810b('0x26')]()[_0x810b('0x25')](function(){_0x4fdf04[_0x810b('0x1b')](0xcc)[_0x810b('0x1c')]();});}};}function handleEntityNotFound(_0x4fbde7,_0x2cf6e4){return function(_0x4bd4f9){if(!_0x4bd4f9){_0x4fbde7[_0x810b('0x1a')](0x194);}return _0x4bd4f9;};}function handleError(_0x466211,_0x46b9d3){_0x46b9d3=_0x46b9d3||0x1f4;return function(_0x550ab8){logger[_0x810b('0x27')](_0x550ab8[_0x810b('0x28')]);if(_0x550ab8[_0x810b('0x29')]){delete _0x550ab8[_0x810b('0x29')];}_0x466211[_0x810b('0x1b')](_0x46b9d3)[_0x810b('0x2a')](_0x550ab8);};}exports['show']=function(_0x4eb0f3,_0x190f9d){var _0x217c0a={'raw':!![],'where':{'id':_0x4eb0f3['params']['id']}},_0x18129d={};_0x18129d[_0x810b('0x2b')]=_['keys'](db[_0x810b('0x2c')][_0x810b('0x2d')]);_0x18129d[_0x810b('0x2e')]=_[_0x810b('0x2f')](_0x4eb0f3[_0x810b('0x2e')]);_0x18129d[_0x810b('0x30')]=_['intersection'](_0x18129d[_0x810b('0x2b')],_0x18129d['query']);_0x217c0a[_0x810b('0x31')]=_[_0x810b('0x32')](_0x18129d[_0x810b('0x2b')],qs['fields'](_0x4eb0f3[_0x810b('0x2e')][_0x810b('0x33')]));_0x217c0a['attributes']=_0x217c0a[_0x810b('0x31')][_0x810b('0x34')]?_0x217c0a[_0x810b('0x31')]:_0x18129d['model'];if(_0x4eb0f3[_0x810b('0x2e')][_0x810b('0x35')]){_0x217c0a[_0x810b('0x36')]=[{'all':!![]}];}_0x217c0a=_['merge']({},_0x217c0a,_0x4eb0f3[_0x810b('0x37')]);return db['ChatApplication'][_0x810b('0x38')](_0x217c0a)['then'](handleEntityNotFound(_0x190f9d,null))[_0x810b('0x25')](respondWithResult(_0x190f9d,null))[_0x810b('0x39')](handleError(_0x190f9d,null));};exports[_0x810b('0x24')]=function(_0x4b61e3,_0x3cbe75){if(_0x4b61e3[_0x810b('0x3a')]['id']){delete _0x4b61e3[_0x810b('0x3a')]['id'];}return db[_0x810b('0x2c')][_0x810b('0x38')]({'where':{'id':_0x4b61e3[_0x810b('0x3b')]['id']}})[_0x810b('0x25')](handleEntityNotFound(_0x3cbe75,null))[_0x810b('0x25')](saveUpdates(_0x4b61e3['body'],null))[_0x810b('0x25')](respondWithResult(_0x3cbe75,null))[_0x810b('0x39')](handleError(_0x3cbe75,null));};exports[_0x810b('0x26')]=function(_0x30cfc6,_0x4cb58c){return db[_0x810b('0x2c')][_0x810b('0x38')]({'where':{'id':_0x30cfc6[_0x810b('0x3b')]['id']}})[_0x810b('0x25')](handleEntityNotFound(_0x4cb58c,null))[_0x810b('0x25')](removeEntity(_0x4cb58c,null))[_0x810b('0x39')](handleError(_0x4cb58c,null));}; \ No newline at end of file +var _0xbf6e=['save','update','then','destroy','error','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','ChatApplication','find','body','params','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbf6e,0x149));var _0xebf6=function(_0x1b1cf1,_0x252de7){_0x1b1cf1=_0x1b1cf1-0x0;var _0x383298=_0xbf6e[_0x1b1cf1];return _0x383298;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebf6('0x0'));var jsonpatch=require(_0xebf6('0x1'));var rp=require(_0xebf6('0x2'));var moment=require(_0xebf6('0x3'));var BPromise=require(_0xebf6('0x4'));var Mustache=require(_0xebf6('0x5'));var util=require(_0xebf6('0x6'));var path=require('path');var sox=require(_0xebf6('0x7'));var csv=require(_0xebf6('0x8'));var ejs=require(_0xebf6('0x9'));var fs=require('fs');var fs_extra=require(_0xebf6('0xa'));var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x8'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf6('0x18'))['db'];function respondWithStatusCode(_0xedc361,_0x4919f1){_0x4919f1=_0x4919f1||0xcc;return function(_0x332ca0){if(_0x332ca0){return _0xedc361[_0xebf6('0x19')](_0x4919f1);}return _0xedc361[_0xebf6('0x1a')](_0x4919f1)[_0xebf6('0x1b')]();};}function respondWithResult(_0x3f69e6,_0x4dbf51){_0x4dbf51=_0x4dbf51||0xc8;return function(_0x4c01f4){if(_0x4c01f4){return _0x3f69e6['status'](_0x4dbf51)[_0xebf6('0x1c')](_0x4c01f4);}};}function respondWithFilteredResult(_0x1ae2f7,_0x50d80f){return function(_0x35570e){if(_0x35570e){var _0x2c980f=typeof _0x50d80f[_0xebf6('0x1d')]===_0xebf6('0x1e')&&typeof _0x50d80f[_0xebf6('0x1f')]===_0xebf6('0x1e');var _0x219621=_0x35570e[_0xebf6('0x20')];var _0x2d3984=_0x2c980f?0x0:_0x50d80f[_0xebf6('0x1d')];var _0x55fa31=_0x2c980f?_0x35570e['count']:_0x50d80f[_0xebf6('0x1d')]+_0x50d80f[_0xebf6('0x1f')];var _0x10051e;if(_0x55fa31>=_0x219621){_0x55fa31=_0x219621;_0x10051e=0xc8;}else{_0x10051e=0xce;}_0x1ae2f7[_0xebf6('0x1a')](_0x10051e);return _0x1ae2f7[_0xebf6('0x21')](_0xebf6('0x22'),_0x2d3984+'-'+_0x55fa31+'/'+_0x219621)[_0xebf6('0x1c')](_0x35570e);}return null;};}function patchUpdates(_0x80f523){return function(_0x4fb497){try{jsonpatch[_0xebf6('0x23')](_0x4fb497,_0x80f523,!![]);}catch(_0x81fdb3){return BPromise[_0xebf6('0x24')](_0x81fdb3);}return _0x4fb497[_0xebf6('0x25')]();};}function saveUpdates(_0x6303ac,_0x14c8ac){return function(_0x2f419e){if(_0x2f419e){return _0x2f419e[_0xebf6('0x26')](_0x6303ac)[_0xebf6('0x27')](function(_0x2e32c6){return _0x2e32c6;});}return null;};}function removeEntity(_0x232074,_0x2dd2ed){return function(_0x43c4e2){if(_0x43c4e2){return _0x43c4e2[_0xebf6('0x28')]()[_0xebf6('0x27')](function(){_0x232074[_0xebf6('0x1a')](0xcc)[_0xebf6('0x1b')]();});}};}function handleEntityNotFound(_0x1534b2,_0x3b58cb){return function(_0x4dadf7){if(!_0x4dadf7){_0x1534b2['sendStatus'](0x194);}return _0x4dadf7;};}function handleError(_0x2605a2,_0x4dc5be){_0x4dc5be=_0x4dc5be||0x1f4;return function(_0x230d84){logger[_0xebf6('0x29')](_0x230d84['stack']);if(_0x230d84['name']){delete _0x230d84[_0xebf6('0x2a')];}_0x2605a2[_0xebf6('0x1a')](_0x4dc5be)[_0xebf6('0x2b')](_0x230d84);};}exports[_0xebf6('0x2c')]=function(_0xedaaeb,_0x2dc0cf){var _0x7976d={'raw':!![],'where':{'id':_0xedaaeb['params']['id']}},_0x7551ce={};_0x7551ce[_0xebf6('0x2d')]=_[_0xebf6('0x2e')](db['ChatApplication'][_0xebf6('0x2f')]);_0x7551ce[_0xebf6('0x30')]=_['keys'](_0xedaaeb[_0xebf6('0x30')]);_0x7551ce[_0xebf6('0x31')]=_[_0xebf6('0x32')](_0x7551ce[_0xebf6('0x2d')],_0x7551ce[_0xebf6('0x30')]);_0x7976d[_0xebf6('0x33')]=_['intersection'](_0x7551ce[_0xebf6('0x2d')],qs[_0xebf6('0x34')](_0xedaaeb['query']['fields']));_0x7976d[_0xebf6('0x33')]=_0x7976d[_0xebf6('0x33')]['length']?_0x7976d[_0xebf6('0x33')]:_0x7551ce[_0xebf6('0x2d')];if(_0xedaaeb['query'][_0xebf6('0x35')]){_0x7976d[_0xebf6('0x36')]=[{'all':!![]}];}_0x7976d=_[_0xebf6('0x37')]({},_0x7976d,_0xedaaeb['options']);return db[_0xebf6('0x38')][_0xebf6('0x39')](_0x7976d)[_0xebf6('0x27')](handleEntityNotFound(_0x2dc0cf,null))[_0xebf6('0x27')](respondWithResult(_0x2dc0cf,null))['catch'](handleError(_0x2dc0cf,null));};exports['update']=function(_0x262af2,_0x46ef2d){if(_0x262af2['body']['id']){delete _0x262af2[_0xebf6('0x3a')]['id'];}return db[_0xebf6('0x38')]['find']({'where':{'id':_0x262af2[_0xebf6('0x3b')]['id']}})[_0xebf6('0x27')](handleEntityNotFound(_0x46ef2d,null))[_0xebf6('0x27')](saveUpdates(_0x262af2[_0xebf6('0x3a')],null))[_0xebf6('0x27')](respondWithResult(_0x46ef2d,null))['catch'](handleError(_0x46ef2d,null));};exports[_0xebf6('0x28')]=function(_0x48943e,_0x3a09fe){return db['ChatApplication'][_0xebf6('0x39')]({'where':{'id':_0x48943e[_0xebf6('0x3b')]['id']}})[_0xebf6('0x27')](handleEntityNotFound(_0x3a09fe,null))[_0xebf6('0x27')](removeEntity(_0x3a09fe,null))[_0xebf6('0x3c')](handleError(_0x3a09fe,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 1409030..98325cb 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 _0x0f69=['path','rimraf','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x0f69,0x173));var _0x90f6=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x0f69[_0x599e60];return _0x468e19;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x90f6('0x0'))('api');var moment=require(_0x90f6('0x1'));var BPromise=require(_0x90f6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90f6('0x3'));var rimraf=require(_0x90f6('0x4'));var config=require('../../config/environment');var attributes=require(_0x90f6('0x5'));module['exports']=function(_0x1840a5,_0x3dfd95){return _0x1840a5[_0x90f6('0x6')](_0x90f6('0x7'),attributes,{'tableName':_0x90f6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x90f6('0x9'),'collate':_0x90f6('0xa')});}; \ No newline at end of file +var _0xc856=['moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatApplication','chat_applications','lodash','util','../../config/logger','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc856,0x1a9));var _0x6c85=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xc856[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x6c85('0x0'));var util=require(_0x6c85('0x1'));var logger=require(_0x6c85('0x2'))(_0x6c85('0x3'));var moment=require(_0x6c85('0x4'));var BPromise=require(_0x6c85('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c85('0x6'));var rimraf=require(_0x6c85('0x7'));var config=require(_0x6c85('0x8'));var attributes=require('./chatApplication.attributes');module[_0x6c85('0x9')]=function(_0x1fe753,_0x3105c6){return _0x1fe753[_0x6c85('0xa')](_0x6c85('0xb'),attributes,{'tableName':_0x6c85('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e069e7d..4344cd2 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 _0x6741=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x576133,_0x13475d){var _0x551f27=function(_0x1211c5){while(--_0x1211c5){_0x576133['push'](_0x576133['shift']());}};_0x551f27(++_0x13475d);}(_0x6741,0x1b7));var _0x1674=function(_0x3b6eb8,_0x500573){_0x3b6eb8=_0x3b6eb8-0x0;var _0x2ef357=_0x6741[_0x3b6eb8];return _0x2ef357;};'use strict';var _=require('lodash');var util=require(_0x1674('0x0'));var moment=require(_0x1674('0x1'));var BPromise=require(_0x1674('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1674('0x3'));var db=require(_0x1674('0x4'))['db'];var utils=require(_0x1674('0x5'));var logger=require(_0x1674('0x6'))('rpc');var config=require(_0x1674('0x7'));var jayson=require(_0x1674('0x8'));var client=jayson[_0x1674('0x9')][_0x1674('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x195918,_0x429f92,_0xfdce6f){return new BPromise(function(_0x33b297,_0x4ab66d){return client[_0x1674('0xb')](_0x195918,_0xfdce6f)['then'](function(_0x272d9f){logger['info'](_0x1674('0xc'),_0x429f92,_0x1674('0xd'));logger[_0x1674('0xe')](_0x1674('0xf'),_0x429f92,_0x1674('0xd'),JSON[_0x1674('0x10')](_0x272d9f));if(_0x272d9f[_0x1674('0x11')]){if(_0x272d9f[_0x1674('0x11')][_0x1674('0x12')]===0x1f4){logger[_0x1674('0x11')](_0x1674('0xc'),_0x429f92,_0x272d9f[_0x1674('0x11')][_0x1674('0x13')]);return _0x4ab66d(_0x272d9f[_0x1674('0x11')][_0x1674('0x13')]);}logger[_0x1674('0x11')](_0x1674('0xc'),_0x429f92,_0x272d9f[_0x1674('0x11')][_0x1674('0x13')]);return _0x33b297(_0x272d9f[_0x1674('0x11')]['message']);}else{logger[_0x1674('0x14')](_0x1674('0xc'),_0x429f92,_0x1674('0xd'));_0x33b297(_0x272d9f[_0x1674('0x15')][_0x1674('0x13')]);}})[_0x1674('0x16')](function(_0xd2513f){logger[_0x1674('0x11')]('ChatApplication,\x20%s,\x20%s',_0x429f92,_0xd2513f);_0x4ab66d(_0xd2513f);});});} \ No newline at end of file +var _0x29cf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x342dd4,_0x538edf){var _0x4ec0fb=function(_0x5e50e0){while(--_0x5e50e0){_0x342dd4['push'](_0x342dd4['shift']());}};_0x4ec0fb(++_0x538edf);}(_0x29cf,0x131));var _0xf29c=function(_0x5432e1,_0x203946){_0x5432e1=_0x5432e1-0x0;var _0x572bdf=_0x29cf[_0x5432e1];return _0x572bdf;};'use strict';var _=require(_0xf29c('0x0'));var util=require(_0xf29c('0x1'));var moment=require(_0xf29c('0x2'));var BPromise=require(_0xf29c('0x3'));var rs=require(_0xf29c('0x4'));var fs=require('fs');var Redis=require(_0xf29c('0x5'));var db=require(_0xf29c('0x6'))['db'];var utils=require(_0xf29c('0x7'));var logger=require(_0xf29c('0x8'))(_0xf29c('0x9'));var config=require(_0xf29c('0xa'));var jayson=require(_0xf29c('0xb'));var client=jayson['client'][_0xf29c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x540f4b,_0x164016,_0x48cce6){return new BPromise(function(_0x21be39,_0x42300b){return client[_0xf29c('0xd')](_0x540f4b,_0x48cce6)[_0xf29c('0xe')](function(_0x1145b3){logger[_0xf29c('0xf')]('ChatApplication,\x20%s,\x20%s',_0x164016,_0xf29c('0x10'));logger[_0xf29c('0x11')](_0xf29c('0x12'),_0x164016,_0xf29c('0x10'),JSON['stringify'](_0x1145b3));if(_0x1145b3[_0xf29c('0x13')]){if(_0x1145b3[_0xf29c('0x13')]['code']===0x1f4){logger[_0xf29c('0x13')](_0xf29c('0x14'),_0x164016,_0x1145b3[_0xf29c('0x13')][_0xf29c('0x15')]);return _0x42300b(_0x1145b3['error'][_0xf29c('0x15')]);}logger[_0xf29c('0x13')](_0xf29c('0x14'),_0x164016,_0x1145b3[_0xf29c('0x13')][_0xf29c('0x15')]);return _0x21be39(_0x1145b3[_0xf29c('0x13')][_0xf29c('0x15')]);}else{logger['info'](_0xf29c('0x14'),_0x164016,_0xf29c('0x10'));_0x21be39(_0x1145b3[_0xf29c('0x16')]['message']);}})[_0xf29c('0x17')](function(_0x35bc3a){logger['error'](_0xf29c('0x14'),_0x164016,_0x35bc3a);_0x42300b(_0x35bc3a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 447d5a8..0eb2559 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 _0x60b7=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','destroy'];(function(_0x94acbd,_0x5856de){var _0x326ef6=function(_0x3fcf72){while(--_0x3fcf72){_0x94acbd['push'](_0x94acbd['shift']());}};_0x326ef6(++_0x5856de);}(_0x60b7,0x97));var _0x760b=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x60b7[_0x4a599b];return _0x2d53d3;};'use strict';var multer=require(_0x760b('0x0'));var util=require(_0x760b('0x1'));var path=require(_0x760b('0x2'));var timeout=require(_0x760b('0x3'));var express=require(_0x760b('0x4'));var router=express[_0x760b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x760b('0x6'));var interaction=require(_0x760b('0x7'));var config=require(_0x760b('0x8'));var controller=require(_0x760b('0x9'));router['get'](_0x760b('0xa'),auth[_0x760b('0xb')](),controller[_0x760b('0xc')]);router['put'](_0x760b('0xa'),auth[_0x760b('0xb')](),controller['update']);router['delete'](_0x760b('0xa'),auth[_0x760b('0xb')](),controller[_0x760b('0xd')]);module[_0x760b('0xe')]=router; \ No newline at end of file +var _0x61dc=['./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2338c4,_0x46e695){var _0x3e9d3d=function(_0x35f650){while(--_0x35f650){_0x2338c4['push'](_0x2338c4['shift']());}};_0x3e9d3d(++_0x46e695);}(_0x61dc,0x119));var _0xc61d=function(_0x9be86d,_0x2ba56a){_0x9be86d=_0x9be86d-0x0;var _0x239f44=_0x61dc[_0x9be86d];return _0x239f44;};'use strict';var multer=require(_0xc61d('0x0'));var util=require(_0xc61d('0x1'));var path=require(_0xc61d('0x2'));var timeout=require(_0xc61d('0x3'));var express=require(_0xc61d('0x4'));var router=express[_0xc61d('0x5')]();var fs_extra=require(_0xc61d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc61d('0x7'));var config=require('../../config/environment');var controller=require(_0xc61d('0x8'));router['get'](_0xc61d('0x9'),auth[_0xc61d('0xa')](),controller[_0xc61d('0xb')]);router[_0xc61d('0xc')](_0xc61d('0x9'),auth['isAuthenticated'](),controller[_0xc61d('0xd')]);router[_0xc61d('0xe')](_0xc61d('0x9'),auth['isAuthenticated'](),controller[_0xc61d('0xf')]);module[_0xc61d('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7e78b6c..a22b9fe 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 _0xce62=['exports','STRING','BOOLEAN','sequelize'];(function(_0x46fa62,_0x179ad8){var _0x10d07d=function(_0x4d96cb){while(--_0x4d96cb){_0x46fa62['push'](_0x46fa62['shift']());}};_0x10d07d(++_0x179ad8);}(_0xce62,0x83));var _0x2ce6=function(_0x383804,_0x5ccb5e){_0x383804=_0x383804-0x0;var _0x12153b=_0xce62[_0x383804];return _0x12153b;};'use strict';var Sequelize=require(_0x2ce6('0x0'));module[_0x2ce6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2ce6('0x2')]},'write':{'type':Sequelize[_0x2ce6('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe237=['BOOLEAN','sequelize','exports'];(function(_0x585e37,_0x464bde){var _0x472fe4=function(_0x2626f0){while(--_0x2626f0){_0x585e37['push'](_0x585e37['shift']());}};_0x472fe4(++_0x464bde);}(_0xe237,0xdc));var _0x7e23=function(_0x4c9247,_0x4db33c){_0x4c9247=_0x4c9247-0x0;var _0x5b05ee=_0xe237[_0x4c9247];return _0x5b05ee;};'use strict';var Sequelize=require(_0x7e23('0x0'));module[_0x7e23('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x7e23('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 3bab691..1f12197 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 _0x46a4=['../../config/logger','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','end','error','stack','name','index','ChatGroup','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','omit','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4a8420,_0x5cfe84){var _0x4dc158=function(_0x58bb35){while(--_0x58bb35){_0x4a8420['push'](_0x4a8420['shift']());}};_0x4dc158(++_0x5cfe84);}(_0x46a4,0x105));var _0x446a=function(_0xc24f1e,_0x8beb1b){_0xc24f1e=_0xc24f1e-0x0;var _0x2f69b4=_0x46a4[_0xc24f1e];return _0x2f69b4;};'use strict';var emlformat=require(_0x446a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x446a('0x1'));var rp=require(_0x446a('0x2'));var moment=require(_0x446a('0x3'));var BPromise=require(_0x446a('0x4'));var Mustache=require('mustache');var util=require(_0x446a('0x5'));var path=require(_0x446a('0x6'));var sox=require(_0x446a('0x7'));var csv=require(_0x446a('0x8'));var ejs=require(_0x446a('0x9'));var fs=require('fs');var fs_extra=require(_0x446a('0xa'));var _=require(_0x446a('0xb'));var squel=require(_0x446a('0xc'));var crypto=require('crypto');var jsforce=require(_0x446a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x446a('0x8'));var querystring=require(_0x446a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x446a('0xf'));var qs=require(_0x446a('0x10'));var as=require(_0x446a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x446a('0x12'))('api');var utils=require(_0x446a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x446a('0x14'));var db=require('../../mysqldb')['db'];config[_0x446a('0x15')]=_[_0x446a('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x446a('0x17'))(new Redis(config[_0x446a('0x15')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x3c7292,_0x16eabc){_0x16eabc=_0x16eabc||0xcc;return function(_0x274a4b){if(_0x274a4b){return _0x3c7292[_0x446a('0x18')](_0x16eabc);}return _0x3c7292[_0x446a('0x19')](_0x16eabc)['end']();};}function respondWithResult(_0x42671a,_0x1e234c){_0x1e234c=_0x1e234c||0xc8;return function(_0x423616){if(_0x423616){return _0x42671a['status'](_0x1e234c)[_0x446a('0x1a')](_0x423616);}};}function respondWithFilteredResult(_0x996ab9,_0x267e82){return function(_0x3c0718){if(_0x3c0718){var _0x460aa9=typeof _0x267e82['offset']===_0x446a('0x1b')&&typeof _0x267e82[_0x446a('0x1c')]===_0x446a('0x1b');var _0x1ef8c0=_0x3c0718[_0x446a('0x1d')];var _0x13f411=_0x460aa9?0x0:_0x267e82['offset'];var _0x2a8e3a=_0x460aa9?_0x3c0718['count']:_0x267e82[_0x446a('0x1e')]+_0x267e82[_0x446a('0x1c')];var _0x513775;if(_0x2a8e3a>=_0x1ef8c0){_0x2a8e3a=_0x1ef8c0;_0x513775=0xc8;}else{_0x513775=0xce;}_0x996ab9[_0x446a('0x19')](_0x513775);return _0x996ab9[_0x446a('0x1f')](_0x446a('0x20'),_0x13f411+'-'+_0x2a8e3a+'/'+_0x1ef8c0)[_0x446a('0x1a')](_0x3c0718);}return null;};}function patchUpdates(_0xacb394){return function(_0x5e1d57){try{jsonpatch['apply'](_0x5e1d57,_0xacb394,!![]);}catch(_0x5bd5ad){return BPromise[_0x446a('0x21')](_0x5bd5ad);}return _0x5e1d57[_0x446a('0x22')]();};}function saveUpdates(_0x283184,_0x2947d1){return function(_0x34a95d){if(_0x34a95d){return _0x34a95d[_0x446a('0x23')](_0x283184)[_0x446a('0x24')](function(_0x167668){return _0x167668;});}return null;};}function removeEntity(_0x163761,_0x5523f3){return function(_0x5b9e3c){if(_0x5b9e3c){return _0x5b9e3c['destroy']()[_0x446a('0x24')](function(){_0x163761['status'](0xcc)[_0x446a('0x25')]();});}};}function handleEntityNotFound(_0xa835b2,_0x5627de){return function(_0x16eb4f){if(!_0x16eb4f){_0xa835b2['sendStatus'](0x194);}return _0x16eb4f;};}function handleError(_0x71278f,_0x4b56b1){_0x4b56b1=_0x4b56b1||0x1f4;return function(_0x5de9af){logger[_0x446a('0x26')](_0x5de9af[_0x446a('0x27')]);if(_0x5de9af[_0x446a('0x28')]){delete _0x5de9af[_0x446a('0x28')];}_0x71278f[_0x446a('0x19')](_0x4b56b1)['send'](_0x5de9af);};}exports[_0x446a('0x29')]=function(_0x53ac42,_0x5c0fb1){var _0x524036={},_0x1bbfc2={},_0x533e9a={'count':0x0,'rows':[]};var _0x3c5684=_['map'](db[_0x446a('0x2a')][_0x446a('0x2b')],function(_0x473da8){return{'name':_0x473da8[_0x446a('0x2c')],'type':_0x473da8[_0x446a('0x2d')][_0x446a('0x2e')]};});_0x1bbfc2['model']=_['map'](_0x3c5684,'name');_0x1bbfc2['query']=_[_0x446a('0x2f')](_0x53ac42[_0x446a('0x30')]);_0x1bbfc2[_0x446a('0x31')]=_[_0x446a('0x32')](_0x1bbfc2[_0x446a('0x33')],_0x1bbfc2['query']);_0x524036[_0x446a('0x34')]=_[_0x446a('0x32')](_0x1bbfc2[_0x446a('0x33')],qs[_0x446a('0x35')](_0x53ac42['query'][_0x446a('0x35')]));_0x524036['attributes']=_0x524036['attributes'][_0x446a('0x36')]?_0x524036[_0x446a('0x34')]:_0x1bbfc2['model'];if(!_0x53ac42[_0x446a('0x30')][_0x446a('0x37')](_0x446a('0x38'))){_0x524036[_0x446a('0x1c')]=qs[_0x446a('0x1c')](_0x53ac42[_0x446a('0x30')][_0x446a('0x1c')]);_0x524036[_0x446a('0x1e')]=qs['offset'](_0x53ac42[_0x446a('0x30')][_0x446a('0x1e')]);}_0x524036[_0x446a('0x39')]=qs['sort'](_0x53ac42[_0x446a('0x30')][_0x446a('0x3a')]);_0x524036[_0x446a('0x3b')]=qs[_0x446a('0x31')](_[_0x446a('0x3c')](_0x53ac42['query'],_0x1bbfc2[_0x446a('0x31')]),_0x3c5684);if(_0x53ac42[_0x446a('0x30')][_0x446a('0x3d')]){_0x524036[_0x446a('0x3b')]=_[_0x446a('0x3e')](_0x524036['where'],{'$or':_[_0x446a('0x3f')](_0x3c5684,function(_0x489df9){if(_0x489df9['type']!==_0x446a('0x40')){var _0x4b59c9={};_0x4b59c9[_0x489df9[_0x446a('0x28')]]={'$like':'%'+_0x53ac42[_0x446a('0x30')][_0x446a('0x3d')]+'%'};return _0x4b59c9;}})});}_0x524036=_['merge']({},_0x524036,_0x53ac42['options']);var _0x332a76={'where':_0x524036[_0x446a('0x3b')]};return db[_0x446a('0x2a')][_0x446a('0x1d')](_0x332a76)[_0x446a('0x24')](function(_0x4bd6f6){_0x533e9a['count']=_0x4bd6f6;if(_0x53ac42[_0x446a('0x30')][_0x446a('0x41')]){_0x524036[_0x446a('0x42')]=[{'all':!![]}];}return db[_0x446a('0x2a')][_0x446a('0x43')](_0x524036);})[_0x446a('0x24')](function(_0x48c103){_0x533e9a[_0x446a('0x44')]=_0x48c103;return _0x533e9a;})['then'](respondWithFilteredResult(_0x5c0fb1,_0x524036))[_0x446a('0x45')](handleError(_0x5c0fb1,null));};exports[_0x446a('0x46')]=function(_0x9eb0f0,_0x203bd3){var _0x3afe54={'raw':!![],'where':{'id':_0x9eb0f0[_0x446a('0x47')]['id']}},_0x381656={};_0x381656[_0x446a('0x33')]=_[_0x446a('0x2f')](db[_0x446a('0x2a')][_0x446a('0x2b')]);_0x381656[_0x446a('0x30')]=_[_0x446a('0x2f')](_0x9eb0f0[_0x446a('0x30')]);_0x381656['filters']=_[_0x446a('0x32')](_0x381656[_0x446a('0x33')],_0x381656[_0x446a('0x30')]);_0x3afe54[_0x446a('0x34')]=_['intersection'](_0x381656[_0x446a('0x33')],qs['fields'](_0x9eb0f0[_0x446a('0x30')]['fields']));_0x3afe54[_0x446a('0x34')]=_0x3afe54[_0x446a('0x34')]['length']?_0x3afe54[_0x446a('0x34')]:_0x381656[_0x446a('0x33')];if(_0x9eb0f0[_0x446a('0x30')][_0x446a('0x41')]){_0x3afe54[_0x446a('0x42')]=[{'all':!![]}];}_0x3afe54=_[_0x446a('0x3e')]({},_0x3afe54,_0x9eb0f0[_0x446a('0x48')]);return db[_0x446a('0x2a')][_0x446a('0x49')](_0x3afe54)[_0x446a('0x24')](handleEntityNotFound(_0x203bd3,null))[_0x446a('0x24')](respondWithResult(_0x203bd3,null))['catch'](handleError(_0x203bd3,null));};exports[_0x446a('0x4a')]=function(_0x357cc3,_0x4f79db){return db[_0x446a('0x2a')][_0x446a('0x4a')](_0x357cc3[_0x446a('0x4b')],{})[_0x446a('0x24')](respondWithResult(_0x4f79db,0xc9))['catch'](handleError(_0x4f79db,null));};exports[_0x446a('0x23')]=function(_0x2a8c90,_0x41d1ea){if(_0x2a8c90[_0x446a('0x4b')]['id']){delete _0x2a8c90[_0x446a('0x4b')]['id'];}return db[_0x446a('0x2a')][_0x446a('0x49')]({'where':{'id':_0x2a8c90[_0x446a('0x47')]['id']}})['then'](handleEntityNotFound(_0x41d1ea,null))[_0x446a('0x24')](saveUpdates(_0x2a8c90[_0x446a('0x4b')],null))['then'](respondWithResult(_0x41d1ea,null))['catch'](handleError(_0x41d1ea,null));};exports['destroy']=function(_0x157036,_0x157eb8){return db['ChatGroup']['find']({'where':{'id':_0x157036[_0x446a('0x47')]['id']}})[_0x446a('0x24')](handleEntityNotFound(_0x157eb8,null))[_0x446a('0x24')](removeEntity(_0x157eb8,null))[_0x446a('0x45')](handleError(_0x157eb8,null));};exports[_0x446a('0x4c')]=function(_0x39b910,_0xa15ead){return db[_0x446a('0x2a')][_0x446a('0x4c')]()[_0x446a('0x24')](respondWithResult(_0xa15ead,null))[_0x446a('0x45')](handleError(_0xa15ead,null));};exports[_0x446a('0x4d')]=function(_0xc38f18,_0x40ca07,_0xd34dda){return db[_0x446a('0x4e')][_0x446a('0x1d')]({'where':{'ChatGroupId':_0xc38f18['params']['id'],'ToId':_0xc38f18[_0x446a('0x4f')]['id'],'read':![]}})[_0x446a('0x24')](function(_0x22744e){return{'id':_['toInteger'](_0xc38f18[_0x446a('0x47')]['id']),'count':_0x22744e};})['then'](respondWithResult(_0x40ca07,null))[_0x446a('0x45')](handleError(_0x40ca07,null));};exports[_0x446a('0x50')]=function(_0x360957,_0x3cac39,_0x403cab){return db['ChatGroup'][_0x446a('0x49')]({'where':{'id':_0x360957[_0x446a('0x47')]['id']}})[_0x446a('0x24')](handleEntityNotFound(_0x3cac39,null))[_0x446a('0x24')](function(_0x111a43){if(_0x111a43){return _0x111a43[_0x446a('0x50')](_0x360957[_0x446a('0x4b')]['ids'],_[_0x446a('0x51')](_0x360957['body'],[_0x446a('0x52'),'id'])||{});}})[_0x446a('0x24')](respondWithResult(_0x3cac39,null))[_0x446a('0x45')](handleError(_0x3cac39,null));};exports[_0x446a('0x53')]=function(_0x5a571e,_0x13c5d0,_0x1799cf){var _0x1b8150={};var _0x227612={};var _0xefc2fa;var _0x181460;return db[_0x446a('0x2a')][_0x446a('0x54')]({'where':{'id':_0x5a571e[_0x446a('0x47')]['id']}})[_0x446a('0x24')](handleEntityNotFound(_0x13c5d0,null))['then'](function(_0x2d05d3){if(_0x2d05d3){_0xefc2fa=_0x2d05d3;_0x227612[_0x446a('0x33')]=_[_0x446a('0x2f')](db[_0x446a('0x55')][_0x446a('0x2b')]);_0x227612[_0x446a('0x30')]=_[_0x446a('0x2f')](_0x5a571e['query']);_0x227612['filters']=_[_0x446a('0x32')](_0x227612[_0x446a('0x33')],_0x227612[_0x446a('0x30')]);_0x1b8150['attributes']=_[_0x446a('0x32')](_0x227612['model'],qs[_0x446a('0x35')](_0x5a571e['query']['fields']));_0x1b8150[_0x446a('0x34')]=_0x1b8150['attributes'][_0x446a('0x36')]?_0x1b8150['attributes']:_0x227612[_0x446a('0x33')];_0x1b8150[_0x446a('0x39')]=qs[_0x446a('0x3a')](_0x5a571e[_0x446a('0x30')]['sort']);_0x1b8150['where']=qs[_0x446a('0x31')](_[_0x446a('0x3c')](_0x5a571e[_0x446a('0x30')],_0x227612['filters']));if(_0x5a571e[_0x446a('0x30')][_0x446a('0x3d')]){_0x1b8150['where']=_[_0x446a('0x3e')](_0x1b8150['where'],{'$or':_[_0x446a('0x3f')](_0x1b8150['attributes'],function(_0x376d86){var _0x7cf586={};_0x7cf586[_0x376d86]={'$like':'%'+_0x5a571e[_0x446a('0x30')][_0x446a('0x3d')]+'%'};return _0x7cf586;})});}_0x1b8150=_[_0x446a('0x3e')]({},_0x1b8150,_0x5a571e[_0x446a('0x48')]);return _0xefc2fa[_0x446a('0x53')](_0x1b8150);}})['then'](function(_0x37b138){if(_0x37b138){_0x181460=_0x37b138[_0x446a('0x36')];if(!_0x5a571e[_0x446a('0x30')][_0x446a('0x37')]('nolimit')){_0x1b8150[_0x446a('0x1c')]=qs[_0x446a('0x1c')](_0x5a571e['query'][_0x446a('0x1c')]);_0x1b8150['offset']=qs[_0x446a('0x1e')](_0x5a571e[_0x446a('0x30')][_0x446a('0x1e')]);}return _0xefc2fa[_0x446a('0x53')](_0x1b8150);}})[_0x446a('0x24')](function(_0xd29f01){if(_0xd29f01){return _0xd29f01?{'count':_0x181460,'rows':_0xd29f01}:null;}})[_0x446a('0x24')](respondWithResult(_0x13c5d0,null))[_0x446a('0x45')](handleError(_0x13c5d0,null));};exports[_0x446a('0x56')]=function(_0x1952ae,_0x2a0e54,_0x1be1cc){return db[_0x446a('0x2a')]['find']({'where':{'id':_0x1952ae[_0x446a('0x47')]['id']}})[_0x446a('0x24')](handleEntityNotFound(_0x2a0e54,null))['then'](function(_0x1a633d){if(_0x1a633d){return _0x1a633d[_0x446a('0x56')](_0x1952ae[_0x446a('0x30')][_0x446a('0x52')]);}})['then'](respondWithStatusCode(_0x2a0e54,null))[_0x446a('0x45')](handleError(_0x2a0e54,null));};exports[_0x446a('0x57')]=function(_0x20b726,_0xbd2ca8,_0xc7232a){if(_0x20b726[_0x446a('0x4b')]['id']){delete _0x20b726[_0x446a('0x4b')]['id'];}return db[_0x446a('0x2a')]['find']({'where':{'id':_0x20b726[_0x446a('0x47')]['id']}})[_0x446a('0x24')](handleEntityNotFound(_0xbd2ca8,null))['then'](function(_0x425ce3){if(_0x425ce3){_0x20b726['body'][_0x446a('0x58')]=_0x425ce3['id'];return db['ChatInternalMessage']['create'](_0x20b726[_0x446a('0x4b')]);}})[_0x446a('0x24')](respondWithResult(_0xbd2ca8,null))[_0x446a('0x45')](handleError(_0xbd2ca8,null));};exports[_0x446a('0x59')]=function(_0x5d6e9f,_0x2c0b39,_0x550196){var _0x3623aa={};var _0x3876ca={};var _0x42d012;var _0x26f486;return db[_0x446a('0x2a')][_0x446a('0x54')]({'where':{'id':_0x5d6e9f[_0x446a('0x47')]['id']}})[_0x446a('0x24')](handleEntityNotFound(_0x2c0b39,null))[_0x446a('0x24')](function(_0x4be764){if(_0x4be764){_0x42d012=_0x4be764;_0x3876ca[_0x446a('0x33')]=_['keys'](db[_0x446a('0x4e')][_0x446a('0x2b')]);_0x3876ca[_0x446a('0x30')]=_[_0x446a('0x2f')](_0x5d6e9f[_0x446a('0x30')]);_0x3876ca[_0x446a('0x31')]=_[_0x446a('0x32')](_0x3876ca[_0x446a('0x33')],_0x3876ca['query']);_0x3623aa['attributes']=_[_0x446a('0x32')](_0x3876ca[_0x446a('0x33')],qs[_0x446a('0x35')](_0x5d6e9f[_0x446a('0x30')][_0x446a('0x35')]));_0x3623aa['attributes']=_0x3623aa['attributes']['length']?_0x3623aa[_0x446a('0x34')]:_0x3876ca[_0x446a('0x33')];_0x3623aa[_0x446a('0x39')]=qs['sort'](_0x5d6e9f['query'][_0x446a('0x3a')]);_0x3623aa['where']=qs[_0x446a('0x31')](_[_0x446a('0x3c')](_0x5d6e9f[_0x446a('0x30')],_0x3876ca[_0x446a('0x31')]));if(_0x5d6e9f['query'][_0x446a('0x3d')]){_0x3623aa[_0x446a('0x3b')]=_[_0x446a('0x3e')](_0x3623aa['where'],{'$or':_[_0x446a('0x3f')](_0x3623aa['attributes'],function(_0x2e50ef){var _0x20412c={};_0x20412c[_0x2e50ef]={'$like':'%'+_0x5d6e9f[_0x446a('0x30')][_0x446a('0x3d')]+'%'};return _0x20412c;})});}if(_0x5d6e9f[_0x446a('0x30')][_0x446a('0x5a')]){var _0xebacb8=_0x5d6e9f[_0x446a('0x30')][_0x446a('0x5a')][_0x446a('0x5b')](',');var _0x5a5e09={};_0x5a5e09[_0xebacb8[0x0]]={'$gte':moment(_0xebacb8[0x1])[_0x446a('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3623aa[_0x446a('0x3b')]=_[_0x446a('0x3e')](_0x3623aa['where'],_0x5a5e09);}_0x3623aa=_[_0x446a('0x3e')]({},_0x3623aa,_0x5d6e9f[_0x446a('0x48')]);return _0x42d012[_0x446a('0x59')](_0x3623aa);}})[_0x446a('0x24')](function(_0x8f6ddf){if(_0x8f6ddf){_0x26f486=_0x8f6ddf[_0x446a('0x36')];if(!_0x5d6e9f[_0x446a('0x30')][_0x446a('0x37')]('nolimit')){_0x3623aa[_0x446a('0x1c')]=qs['limit'](_0x5d6e9f[_0x446a('0x30')][_0x446a('0x1c')]);_0x3623aa[_0x446a('0x1e')]=qs['offset'](_0x5d6e9f['query']['offset']);}return _0x42d012[_0x446a('0x59')](_0x3623aa);}})[_0x446a('0x24')](function(_0x4bb1f5){if(_0x4bb1f5){return _0x4bb1f5?{'count':_0x26f486,'rows':_0x4bb1f5}:null;}})[_0x446a('0x24')](respondWithResult(_0x2c0b39,null))[_0x446a('0x45')](handleError(_0x2c0b39,null));}; \ No newline at end of file +var _0xa7a0=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','order','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','destroy','then','stack','name','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort'];(function(_0x4d83d0,_0xca2fd2){var _0x3883c6=function(_0x210cf4){while(--_0x210cf4){_0x4d83d0['push'](_0x4d83d0['shift']());}};_0x3883c6(++_0xca2fd2);}(_0xa7a0,0xdb));var _0x0a7a=function(_0x12bf18,_0x25fbc0){_0x12bf18=_0x12bf18-0x0;var _0x34276e=_0xa7a0[_0x12bf18];return _0x34276e;};'use strict';var emlformat=require(_0x0a7a('0x0'));var rimraf=require(_0x0a7a('0x1'));var zipdir=require(_0x0a7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a7a('0x3'));var BPromise=require(_0x0a7a('0x4'));var Mustache=require(_0x0a7a('0x5'));var util=require(_0x0a7a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0a7a('0x7'));var ejs=require(_0x0a7a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a7a('0x9'));var squel=require(_0x0a7a('0xa'));var crypto=require(_0x0a7a('0xb'));var jsforce=require(_0x0a7a('0xc'));var deskjs=require(_0x0a7a('0xd'));var toCsv=require(_0x0a7a('0x7'));var querystring=require(_0x0a7a('0xe'));var Papa=require(_0x0a7a('0xf'));var Redis=require(_0x0a7a('0x10'));var authService=require(_0x0a7a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a7a('0x12'));var logger=require('../../config/logger')(_0x0a7a('0x13'));var utils=require(_0x0a7a('0x14'));var config=require(_0x0a7a('0x15'));var licenseUtil=require(_0x0a7a('0x16'));var db=require(_0x0a7a('0x17'))['db'];config[_0x0a7a('0x18')]=_[_0x0a7a('0x19')](config[_0x0a7a('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a7a('0x1a'))(new Redis(config[_0x0a7a('0x18')]));require('./chatGroup.socket')[_0x0a7a('0x1b')](socket);function respondWithStatusCode(_0x3d477b,_0x25be16){_0x25be16=_0x25be16||0xcc;return function(_0x4b1d5d){if(_0x4b1d5d){return _0x3d477b[_0x0a7a('0x1c')](_0x25be16);}return _0x3d477b['status'](_0x25be16)[_0x0a7a('0x1d')]();};}function respondWithResult(_0x1a69b2,_0x332d6c){_0x332d6c=_0x332d6c||0xc8;return function(_0x3ff1c8){if(_0x3ff1c8){return _0x1a69b2[_0x0a7a('0x1e')](_0x332d6c)[_0x0a7a('0x1f')](_0x3ff1c8);}};}function respondWithFilteredResult(_0x141bb4,_0x2124f7){return function(_0x2cc243){if(_0x2cc243){var _0x29277a=typeof _0x2124f7[_0x0a7a('0x20')]===_0x0a7a('0x21')&&typeof _0x2124f7['limit']===_0x0a7a('0x21');var _0x4c3911=_0x2cc243[_0x0a7a('0x22')];var _0x581555=_0x29277a?0x0:_0x2124f7['offset'];var _0x380329=_0x29277a?_0x2cc243[_0x0a7a('0x22')]:_0x2124f7[_0x0a7a('0x20')]+_0x2124f7[_0x0a7a('0x23')];var _0x5756bb;if(_0x380329>=_0x4c3911){_0x380329=_0x4c3911;_0x5756bb=0xc8;}else{_0x5756bb=0xce;}_0x141bb4[_0x0a7a('0x1e')](_0x5756bb);return _0x141bb4[_0x0a7a('0x24')]('Content-Range',_0x581555+'-'+_0x380329+'/'+_0x4c3911)[_0x0a7a('0x1f')](_0x2cc243);}return null;};}function patchUpdates(_0x284d83){return function(_0xaded96){try{jsonpatch[_0x0a7a('0x25')](_0xaded96,_0x284d83,!![]);}catch(_0x408aef){return BPromise['reject'](_0x408aef);}return _0xaded96['save']();};}function saveUpdates(_0x50cf6b,_0x2f6925){return function(_0xeddc39){if(_0xeddc39){return _0xeddc39['update'](_0x50cf6b)['then'](function(_0x471b73){return _0x471b73;});}return null;};}function removeEntity(_0x32c5d9,_0x5d78f2){return function(_0x5a7549){if(_0x5a7549){return _0x5a7549[_0x0a7a('0x26')]()[_0x0a7a('0x27')](function(){_0x32c5d9[_0x0a7a('0x1e')](0xcc)[_0x0a7a('0x1d')]();});}};}function handleEntityNotFound(_0x34bc7c,_0x4c1df6){return function(_0x46976d){if(!_0x46976d){_0x34bc7c[_0x0a7a('0x1c')](0x194);}return _0x46976d;};}function handleError(_0x5a5152,_0x5c474b){_0x5c474b=_0x5c474b||0x1f4;return function(_0x430be9){logger['error'](_0x430be9[_0x0a7a('0x28')]);if(_0x430be9['name']){delete _0x430be9[_0x0a7a('0x29')];}_0x5a5152[_0x0a7a('0x1e')](_0x5c474b)['send'](_0x430be9);};}exports['index']=function(_0xdd8019,_0x55be97){var _0x5d633f={},_0x1c8ed0={},_0x515fcc={'count':0x0,'rows':[]};var _0x283f8e=_[_0x0a7a('0x2a')](db[_0x0a7a('0x2b')][_0x0a7a('0x2c')],function(_0x1afc8b){return{'name':_0x1afc8b[_0x0a7a('0x2d')],'type':_0x1afc8b[_0x0a7a('0x2e')]['key']};});_0x1c8ed0[_0x0a7a('0x2f')]=_[_0x0a7a('0x2a')](_0x283f8e,_0x0a7a('0x29'));_0x1c8ed0[_0x0a7a('0x30')]=_[_0x0a7a('0x31')](_0xdd8019[_0x0a7a('0x30')]);_0x1c8ed0[_0x0a7a('0x32')]=_[_0x0a7a('0x33')](_0x1c8ed0[_0x0a7a('0x2f')],_0x1c8ed0['query']);_0x5d633f[_0x0a7a('0x34')]=_[_0x0a7a('0x33')](_0x1c8ed0[_0x0a7a('0x2f')],qs['fields'](_0xdd8019['query'][_0x0a7a('0x35')]));_0x5d633f[_0x0a7a('0x34')]=_0x5d633f[_0x0a7a('0x34')]['length']?_0x5d633f['attributes']:_0x1c8ed0[_0x0a7a('0x2f')];if(!_0xdd8019[_0x0a7a('0x30')][_0x0a7a('0x36')](_0x0a7a('0x37'))){_0x5d633f[_0x0a7a('0x23')]=qs[_0x0a7a('0x23')](_0xdd8019[_0x0a7a('0x30')][_0x0a7a('0x23')]);_0x5d633f[_0x0a7a('0x20')]=qs[_0x0a7a('0x20')](_0xdd8019[_0x0a7a('0x30')]['offset']);}_0x5d633f['order']=qs[_0x0a7a('0x38')](_0xdd8019[_0x0a7a('0x30')][_0x0a7a('0x38')]);_0x5d633f['where']=qs[_0x0a7a('0x32')](_[_0x0a7a('0x39')](_0xdd8019[_0x0a7a('0x30')],_0x1c8ed0[_0x0a7a('0x32')]),_0x283f8e);if(_0xdd8019[_0x0a7a('0x30')][_0x0a7a('0x3a')]){_0x5d633f[_0x0a7a('0x3b')]=_[_0x0a7a('0x3c')](_0x5d633f[_0x0a7a('0x3b')],{'$or':_[_0x0a7a('0x2a')](_0x283f8e,function(_0x462130){if(_0x462130[_0x0a7a('0x2e')]!==_0x0a7a('0x3d')){var _0x7b86f7={};_0x7b86f7[_0x462130[_0x0a7a('0x29')]]={'$like':'%'+_0xdd8019[_0x0a7a('0x30')][_0x0a7a('0x3a')]+'%'};return _0x7b86f7;}})});}_0x5d633f=_[_0x0a7a('0x3c')]({},_0x5d633f,_0xdd8019[_0x0a7a('0x3e')]);var _0x408725={'where':_0x5d633f[_0x0a7a('0x3b')]};return db['ChatGroup'][_0x0a7a('0x22')](_0x408725)[_0x0a7a('0x27')](function(_0x2633c0){_0x515fcc[_0x0a7a('0x22')]=_0x2633c0;if(_0xdd8019['query'][_0x0a7a('0x3f')]){_0x5d633f[_0x0a7a('0x40')]=[{'all':!![]}];}return db['ChatGroup'][_0x0a7a('0x41')](_0x5d633f);})[_0x0a7a('0x27')](function(_0x292732){_0x515fcc[_0x0a7a('0x42')]=_0x292732;return _0x515fcc;})[_0x0a7a('0x27')](respondWithFilteredResult(_0x55be97,_0x5d633f))[_0x0a7a('0x43')](handleError(_0x55be97,null));};exports[_0x0a7a('0x44')]=function(_0x31e669,_0x61f47f){var _0x2064ad={'raw':!![],'where':{'id':_0x31e669[_0x0a7a('0x45')]['id']}},_0xf3a66f={};_0xf3a66f['model']=_['keys'](db['ChatGroup'][_0x0a7a('0x2c')]);_0xf3a66f[_0x0a7a('0x30')]=_[_0x0a7a('0x31')](_0x31e669[_0x0a7a('0x30')]);_0xf3a66f[_0x0a7a('0x32')]=_[_0x0a7a('0x33')](_0xf3a66f[_0x0a7a('0x2f')],_0xf3a66f[_0x0a7a('0x30')]);_0x2064ad[_0x0a7a('0x34')]=_[_0x0a7a('0x33')](_0xf3a66f['model'],qs[_0x0a7a('0x35')](_0x31e669[_0x0a7a('0x30')][_0x0a7a('0x35')]));_0x2064ad[_0x0a7a('0x34')]=_0x2064ad[_0x0a7a('0x34')][_0x0a7a('0x46')]?_0x2064ad[_0x0a7a('0x34')]:_0xf3a66f['model'];if(_0x31e669[_0x0a7a('0x30')][_0x0a7a('0x3f')]){_0x2064ad[_0x0a7a('0x40')]=[{'all':!![]}];}_0x2064ad=_[_0x0a7a('0x3c')]({},_0x2064ad,_0x31e669[_0x0a7a('0x3e')]);return db[_0x0a7a('0x2b')]['find'](_0x2064ad)[_0x0a7a('0x27')](handleEntityNotFound(_0x61f47f,null))['then'](respondWithResult(_0x61f47f,null))[_0x0a7a('0x43')](handleError(_0x61f47f,null));};exports[_0x0a7a('0x47')]=function(_0x5ef6b2,_0x522508){return db[_0x0a7a('0x2b')]['create'](_0x5ef6b2[_0x0a7a('0x48')],{})[_0x0a7a('0x27')](respondWithResult(_0x522508,0xc9))['catch'](handleError(_0x522508,null));};exports[_0x0a7a('0x49')]=function(_0x3e4e25,_0x571878){if(_0x3e4e25[_0x0a7a('0x48')]['id']){delete _0x3e4e25[_0x0a7a('0x48')]['id'];}return db[_0x0a7a('0x2b')]['find']({'where':{'id':_0x3e4e25[_0x0a7a('0x45')]['id']}})['then'](handleEntityNotFound(_0x571878,null))['then'](saveUpdates(_0x3e4e25[_0x0a7a('0x48')],null))[_0x0a7a('0x27')](respondWithResult(_0x571878,null))[_0x0a7a('0x43')](handleError(_0x571878,null));};exports[_0x0a7a('0x26')]=function(_0x129550,_0xa3ce46){return db[_0x0a7a('0x2b')][_0x0a7a('0x4a')]({'where':{'id':_0x129550['params']['id']}})[_0x0a7a('0x27')](handleEntityNotFound(_0xa3ce46,null))[_0x0a7a('0x27')](removeEntity(_0xa3ce46,null))[_0x0a7a('0x43')](handleError(_0xa3ce46,null));};exports[_0x0a7a('0x4b')]=function(_0x16fa22,_0x30e582){return db[_0x0a7a('0x2b')][_0x0a7a('0x4b')]()[_0x0a7a('0x27')](respondWithResult(_0x30e582,null))['catch'](handleError(_0x30e582,null));};exports['getUnread']=function(_0x201fb2,_0x4cef2d,_0x345b81){return db[_0x0a7a('0x4c')][_0x0a7a('0x22')]({'where':{'ChatGroupId':_0x201fb2[_0x0a7a('0x45')]['id'],'ToId':_0x201fb2[_0x0a7a('0x4d')]['id'],'read':![]}})[_0x0a7a('0x27')](function(_0xc9316e){return{'id':_[_0x0a7a('0x4e')](_0x201fb2[_0x0a7a('0x45')]['id']),'count':_0xc9316e};})[_0x0a7a('0x27')](respondWithResult(_0x4cef2d,null))[_0x0a7a('0x43')](handleError(_0x4cef2d,null));};exports[_0x0a7a('0x4f')]=function(_0x3bcdfb,_0x35e85f,_0x569c3b){return db['ChatGroup'][_0x0a7a('0x4a')]({'where':{'id':_0x3bcdfb[_0x0a7a('0x45')]['id']}})[_0x0a7a('0x27')](handleEntityNotFound(_0x35e85f,null))[_0x0a7a('0x27')](function(_0x1d693f){if(_0x1d693f){return _0x1d693f[_0x0a7a('0x4f')](_0x3bcdfb[_0x0a7a('0x48')]['ids'],_['omit'](_0x3bcdfb['body'],[_0x0a7a('0x50'),'id'])||{});}})[_0x0a7a('0x27')](respondWithResult(_0x35e85f,null))[_0x0a7a('0x43')](handleError(_0x35e85f,null));};exports[_0x0a7a('0x51')]=function(_0x12e4ec,_0x36852d,_0x11f867){var _0x283aa0={};var _0x434ab4={};var _0x2d2257;var _0x1cd11c;return db[_0x0a7a('0x2b')][_0x0a7a('0x52')]({'where':{'id':_0x12e4ec[_0x0a7a('0x45')]['id']}})[_0x0a7a('0x27')](handleEntityNotFound(_0x36852d,null))['then'](function(_0x33918d){if(_0x33918d){_0x2d2257=_0x33918d;_0x434ab4[_0x0a7a('0x2f')]=_[_0x0a7a('0x31')](db[_0x0a7a('0x53')][_0x0a7a('0x2c')]);_0x434ab4[_0x0a7a('0x30')]=_[_0x0a7a('0x31')](_0x12e4ec['query']);_0x434ab4[_0x0a7a('0x32')]=_[_0x0a7a('0x33')](_0x434ab4[_0x0a7a('0x2f')],_0x434ab4[_0x0a7a('0x30')]);_0x283aa0[_0x0a7a('0x34')]=_['intersection'](_0x434ab4[_0x0a7a('0x2f')],qs['fields'](_0x12e4ec[_0x0a7a('0x30')][_0x0a7a('0x35')]));_0x283aa0[_0x0a7a('0x34')]=_0x283aa0[_0x0a7a('0x34')][_0x0a7a('0x46')]?_0x283aa0['attributes']:_0x434ab4['model'];_0x283aa0['order']=qs[_0x0a7a('0x38')](_0x12e4ec[_0x0a7a('0x30')][_0x0a7a('0x38')]);_0x283aa0[_0x0a7a('0x3b')]=qs['filters'](_[_0x0a7a('0x39')](_0x12e4ec[_0x0a7a('0x30')],_0x434ab4[_0x0a7a('0x32')]));if(_0x12e4ec[_0x0a7a('0x30')][_0x0a7a('0x3a')]){_0x283aa0[_0x0a7a('0x3b')]=_[_0x0a7a('0x3c')](_0x283aa0[_0x0a7a('0x3b')],{'$or':_[_0x0a7a('0x2a')](_0x283aa0[_0x0a7a('0x34')],function(_0xdd843f){var _0x22a734={};_0x22a734[_0xdd843f]={'$like':'%'+_0x12e4ec['query'][_0x0a7a('0x3a')]+'%'};return _0x22a734;})});}_0x283aa0=_[_0x0a7a('0x3c')]({},_0x283aa0,_0x12e4ec[_0x0a7a('0x3e')]);return _0x2d2257[_0x0a7a('0x51')](_0x283aa0);}})[_0x0a7a('0x27')](function(_0x1e6152){if(_0x1e6152){_0x1cd11c=_0x1e6152[_0x0a7a('0x46')];if(!_0x12e4ec[_0x0a7a('0x30')][_0x0a7a('0x36')](_0x0a7a('0x37'))){_0x283aa0['limit']=qs['limit'](_0x12e4ec[_0x0a7a('0x30')][_0x0a7a('0x23')]);_0x283aa0['offset']=qs[_0x0a7a('0x20')](_0x12e4ec[_0x0a7a('0x30')][_0x0a7a('0x20')]);}return _0x2d2257[_0x0a7a('0x51')](_0x283aa0);}})[_0x0a7a('0x27')](function(_0x55b7b2){if(_0x55b7b2){return _0x55b7b2?{'count':_0x1cd11c,'rows':_0x55b7b2}:null;}})[_0x0a7a('0x27')](respondWithResult(_0x36852d,null))['catch'](handleError(_0x36852d,null));};exports[_0x0a7a('0x54')]=function(_0x1016c1,_0x2e45e8,_0xcfade7){return db['ChatGroup']['find']({'where':{'id':_0x1016c1[_0x0a7a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e45e8,null))[_0x0a7a('0x27')](function(_0x286605){if(_0x286605){return _0x286605[_0x0a7a('0x54')](_0x1016c1[_0x0a7a('0x30')]['ids']);}})[_0x0a7a('0x27')](respondWithStatusCode(_0x2e45e8,null))['catch'](handleError(_0x2e45e8,null));};exports[_0x0a7a('0x55')]=function(_0x28995e,_0x3197ac,_0x43bc43){if(_0x28995e[_0x0a7a('0x48')]['id']){delete _0x28995e[_0x0a7a('0x48')]['id'];}return db[_0x0a7a('0x2b')][_0x0a7a('0x4a')]({'where':{'id':_0x28995e[_0x0a7a('0x45')]['id']}})[_0x0a7a('0x27')](handleEntityNotFound(_0x3197ac,null))['then'](function(_0x10f5e2){if(_0x10f5e2){_0x28995e[_0x0a7a('0x48')][_0x0a7a('0x56')]=_0x10f5e2['id'];return db[_0x0a7a('0x4c')][_0x0a7a('0x47')](_0x28995e[_0x0a7a('0x48')]);}})['then'](respondWithResult(_0x3197ac,null))[_0x0a7a('0x43')](handleError(_0x3197ac,null));};exports['getMessages']=function(_0x47f776,_0x2cd324,_0x5dd34a){var _0xf28b3c={};var _0x1c9fa6={};var _0x1e62b5;var _0x16af93;return db['ChatGroup']['findOne']({'where':{'id':_0x47f776[_0x0a7a('0x45')]['id']}})[_0x0a7a('0x27')](handleEntityNotFound(_0x2cd324,null))['then'](function(_0x2e75ed){if(_0x2e75ed){_0x1e62b5=_0x2e75ed;_0x1c9fa6['model']=_['keys'](db[_0x0a7a('0x4c')]['rawAttributes']);_0x1c9fa6[_0x0a7a('0x30')]=_[_0x0a7a('0x31')](_0x47f776[_0x0a7a('0x30')]);_0x1c9fa6[_0x0a7a('0x32')]=_[_0x0a7a('0x33')](_0x1c9fa6[_0x0a7a('0x2f')],_0x1c9fa6['query']);_0xf28b3c[_0x0a7a('0x34')]=_[_0x0a7a('0x33')](_0x1c9fa6[_0x0a7a('0x2f')],qs[_0x0a7a('0x35')](_0x47f776[_0x0a7a('0x30')]['fields']));_0xf28b3c['attributes']=_0xf28b3c[_0x0a7a('0x34')][_0x0a7a('0x46')]?_0xf28b3c['attributes']:_0x1c9fa6[_0x0a7a('0x2f')];_0xf28b3c[_0x0a7a('0x57')]=qs[_0x0a7a('0x38')](_0x47f776['query']['sort']);_0xf28b3c[_0x0a7a('0x3b')]=qs[_0x0a7a('0x32')](_['pick'](_0x47f776[_0x0a7a('0x30')],_0x1c9fa6['filters']));if(_0x47f776[_0x0a7a('0x30')]['filter']){_0xf28b3c[_0x0a7a('0x3b')]=_[_0x0a7a('0x3c')](_0xf28b3c[_0x0a7a('0x3b')],{'$or':_['map'](_0xf28b3c[_0x0a7a('0x34')],function(_0x3355c4){var _0x196db7={};_0x196db7[_0x3355c4]={'$like':'%'+_0x47f776[_0x0a7a('0x30')]['filter']+'%'};return _0x196db7;})});}if(_0x47f776[_0x0a7a('0x30')][_0x0a7a('0x58')]){var _0x174ea2=_0x47f776[_0x0a7a('0x30')][_0x0a7a('0x58')]['split'](',');var _0x33bf10={};_0x33bf10[_0x174ea2[0x0]]={'$gte':moment(_0x174ea2[0x1])[_0x0a7a('0x59')](_0x0a7a('0x5a'))};_0xf28b3c[_0x0a7a('0x3b')]=_[_0x0a7a('0x3c')](_0xf28b3c[_0x0a7a('0x3b')],_0x33bf10);}_0xf28b3c=_[_0x0a7a('0x3c')]({},_0xf28b3c,_0x47f776['options']);return _0x1e62b5[_0x0a7a('0x5b')](_0xf28b3c);}})[_0x0a7a('0x27')](function(_0x503b65){if(_0x503b65){_0x16af93=_0x503b65[_0x0a7a('0x46')];if(!_0x47f776[_0x0a7a('0x30')][_0x0a7a('0x36')](_0x0a7a('0x37'))){_0xf28b3c['limit']=qs[_0x0a7a('0x23')](_0x47f776[_0x0a7a('0x30')][_0x0a7a('0x23')]);_0xf28b3c[_0x0a7a('0x20')]=qs[_0x0a7a('0x20')](_0x47f776[_0x0a7a('0x30')]['offset']);}return _0x1e62b5[_0x0a7a('0x5b')](_0xf28b3c);}})['then'](function(_0x167cc9){if(_0x167cc9){return _0x167cc9?{'count':_0x16af93,'rows':_0x167cc9}:null;}})[_0x0a7a('0x27')](respondWithResult(_0x2cd324,null))[_0x0a7a('0x43')](handleError(_0x2cd324,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6a9cd2e..43fa831 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 _0x9ac0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatGroup'];(function(_0x37e91a,_0x1bb627){var _0x1a9f0b=function(_0x49271a){while(--_0x49271a){_0x37e91a['push'](_0x37e91a['shift']());}};_0x1a9f0b(++_0x1bb627);}(_0x9ac0,0x116));var _0x09ac=function(_0x326a77,_0x29bae7){_0x326a77=_0x326a77-0x0;var _0x5c15a8=_0x9ac0[_0x326a77];return _0x5c15a8;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x09ac('0x0'))['db'][_0x09ac('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x09ac('0x2')](0x0);var events={'afterCreate':_0x09ac('0x3'),'afterUpdate':_0x09ac('0x4'),'afterDestroy':_0x09ac('0x5')};function emitEvent(_0x453674){return function(_0x546c3d,_0x339657,_0x46fd74){ChatGroupEvents[_0x09ac('0x6')](_0x453674+':'+_0x546c3d['id'],_0x546c3d);ChatGroupEvents[_0x09ac('0x6')](_0x453674,_0x546c3d);_0x46fd74(null);};}for(var e in events){if(events[_0x09ac('0x7')](e)){var event=events[e];ChatGroup[_0x09ac('0x8')](e,emitEvent(event));}}module[_0x09ac('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0xb199=['remove','emit','hook','exports','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x3ec359,_0x563c22){var _0x442c1a=function(_0x5ff505){while(--_0x5ff505){_0x3ec359['push'](_0x3ec359['shift']());}};_0x442c1a(++_0x563c22);}(_0xb199,0xdc));var _0x9b19=function(_0x4b1026,_0x169f6d){_0x4b1026=_0x4b1026-0x0;var _0x2fc515=_0xb199[_0x4b1026];return _0x2fc515;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x9b19('0x0'))['db'][_0x9b19('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9b19('0x2')](0x0);var events={'afterCreate':_0x9b19('0x3'),'afterUpdate':'update','afterDestroy':_0x9b19('0x4')};function emitEvent(_0x311b2f){return function(_0x1e94d9,_0x2a5bb4,_0x12c04e){ChatGroupEvents[_0x9b19('0x5')](_0x311b2f+':'+_0x1e94d9['id'],_0x1e94d9);ChatGroupEvents[_0x9b19('0x5')](_0x311b2f,_0x1e94d9);_0x12c04e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x9b19('0x6')](e,emitEvent(event));}}module[_0x9b19('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 4e2fd4f..5e5aaff 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 _0xd7f9=['path','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','api','moment','request-promise'];(function(_0x2c38af,_0x4035b2){var _0x37ca12=function(_0xcd3831){while(--_0xcd3831){_0x2c38af['push'](_0x2c38af['shift']());}};_0x37ca12(++_0x4035b2);}(_0xd7f9,0x146));var _0x9d7f=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0xd7f9[_0x3ef2d5];return _0x2fefb2;};'use strict';var _=require(_0x9d7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d7f('0x1'));var moment=require(_0x9d7f('0x2'));var BPromise=require('bluebird');var rp=require(_0x9d7f('0x3'));var fs=require('fs');var path=require(_0x9d7f('0x4'));var rimraf=require('rimraf');var config=require(_0x9d7f('0x5'));var attributes=require(_0x9d7f('0x6'));module['exports']=function(_0x4445dd,_0x299ea2){return _0x4445dd[_0x9d7f('0x7')](_0x9d7f('0x8'),attributes,{'tableName':_0x9d7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x000f=['./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x501233,_0x5aa6ee){var _0x46539e=function(_0x1e3cbd){while(--_0x1e3cbd){_0x501233['push'](_0x501233['shift']());}};_0x46539e(++_0x5aa6ee);}(_0x000f,0xc4));var _0xf000=function(_0x5933c4,_0x54ec99){_0x5933c4=_0x5933c4-0x0;var _0x15074e=_0x000f[_0x5933c4];return _0x15074e;};'use strict';var _=require(_0xf000('0x0'));var util=require(_0xf000('0x1'));var logger=require('../../config/logger')(_0xf000('0x2'));var moment=require(_0xf000('0x3'));var BPromise=require(_0xf000('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf000('0x5'));var rimraf=require(_0xf000('0x6'));var config=require(_0xf000('0x7'));var attributes=require(_0xf000('0x8'));module['exports']=function(_0x1aec36,_0xa369f4){return _0x1aec36[_0xf000('0x9')](_0xf000('0xa'),attributes,{'tableName':_0xf000('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 62e5615..9b701b0 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 _0xbf07=['util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','redis','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x270e70,_0x5344ae){var _0x26f003=function(_0x4b8205){while(--_0x4b8205){_0x270e70['push'](_0x270e70['shift']());}};_0x26f003(++_0x5344ae);}(_0xbf07,0x77));var _0x7bf0=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0xbf07[_0x631a3c];return _0x2bdfa3;};'use strict';var _=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var moment=require(_0x7bf0('0x2'));var BPromise=require(_0x7bf0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bf0('0x4'));var db=require(_0x7bf0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7bf0('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7bf0('0x7')]=_['defaults'](config[_0x7bf0('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x7bf0('0x8'))(new Redis(config[_0x7bf0('0x7')]));require(_0x7bf0('0x9'))[_0x7bf0('0xa')](socket);function respondWithRpcPromise(_0x27ad53,_0x38fb34,_0x59cad0){return new BPromise(function(_0x13d13f,_0x4d0a69){return client[_0x7bf0('0xb')](_0x27ad53,_0x59cad0)[_0x7bf0('0xc')](function(_0x2d39b6){logger[_0x7bf0('0xd')](_0x7bf0('0xe'),_0x38fb34,_0x7bf0('0xf'));logger[_0x7bf0('0x10')](_0x7bf0('0x11'),_0x38fb34,_0x7bf0('0xf'),JSON[_0x7bf0('0x12')](_0x2d39b6));if(_0x2d39b6[_0x7bf0('0x13')]){if(_0x2d39b6[_0x7bf0('0x13')][_0x7bf0('0x14')]===0x1f4){logger[_0x7bf0('0x13')](_0x7bf0('0xe'),_0x38fb34,_0x2d39b6[_0x7bf0('0x13')][_0x7bf0('0x15')]);return _0x4d0a69(_0x2d39b6[_0x7bf0('0x13')][_0x7bf0('0x15')]);}logger[_0x7bf0('0x13')]('ChatGroup,\x20%s,\x20%s',_0x38fb34,_0x2d39b6[_0x7bf0('0x13')][_0x7bf0('0x15')]);return _0x13d13f(_0x2d39b6[_0x7bf0('0x13')][_0x7bf0('0x15')]);}else{logger[_0x7bf0('0xd')]('ChatGroup,\x20%s,\x20%s',_0x38fb34,_0x7bf0('0xf'));_0x13d13f(_0x2d39b6[_0x7bf0('0x16')][_0x7bf0('0x15')]);}})[_0x7bf0('0x17')](function(_0x15f9d0){logger[_0x7bf0('0x13')](_0x7bf0('0xe'),_0x38fb34,_0x15f9d0);_0x4d0a69(_0x15f9d0);});});} \ No newline at end of file +var _0x8aaa=['rpc','../../config/environment','jayson/promise','http','redis','localhost','./chatGroup.socket','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8aaa,0x64));var _0xa8aa=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x8aaa[_0x525af9];return _0x129fbf;};'use strict';var _=require(_0xa8aa('0x0'));var util=require(_0xa8aa('0x1'));var moment=require(_0xa8aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8aa('0x3'));var fs=require('fs');var Redis=require(_0xa8aa('0x4'));var db=require(_0xa8aa('0x5'))['db'];var utils=require(_0xa8aa('0x6'));var logger=require(_0xa8aa('0x7'))(_0xa8aa('0x8'));var config=require(_0xa8aa('0x9'));var jayson=require(_0xa8aa('0xa'));var client=jayson['client'][_0xa8aa('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa8aa('0xc')],{'host':_0xa8aa('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8aa('0xc')]));require(_0xa8aa('0xe'))['register'](socket);function respondWithRpcPromise(_0x57680d,_0x4dd431,_0xc13b9c){return new BPromise(function(_0x3f3347,_0x3bf7e2){return client[_0xa8aa('0xf')](_0x57680d,_0xc13b9c)[_0xa8aa('0x10')](function(_0x225c0b){logger[_0xa8aa('0x11')]('ChatGroup,\x20%s,\x20%s',_0x4dd431,_0xa8aa('0x12'));logger['debug'](_0xa8aa('0x13'),_0x4dd431,_0xa8aa('0x12'),JSON[_0xa8aa('0x14')](_0x225c0b));if(_0x225c0b['error']){if(_0x225c0b['error'][_0xa8aa('0x15')]===0x1f4){logger[_0xa8aa('0x16')]('ChatGroup,\x20%s,\x20%s',_0x4dd431,_0x225c0b[_0xa8aa('0x16')][_0xa8aa('0x17')]);return _0x3bf7e2(_0x225c0b['error'][_0xa8aa('0x17')]);}logger[_0xa8aa('0x16')](_0xa8aa('0x18'),_0x4dd431,_0x225c0b[_0xa8aa('0x16')][_0xa8aa('0x17')]);return _0x3f3347(_0x225c0b['error'][_0xa8aa('0x17')]);}else{logger[_0xa8aa('0x11')]('ChatGroup,\x20%s,\x20%s',_0x4dd431,_0xa8aa('0x12'));_0x3f3347(_0x225c0b[_0xa8aa('0x19')][_0xa8aa('0x17')]);}})[_0xa8aa('0x1a')](function(_0x52a1cf){logger['error'](_0xa8aa('0x18'),_0x4dd431,_0x52a1cf);_0x3bf7e2(_0x52a1cf);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 806ecd6..318978e 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 _0x3f76=['length','chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0x3f76,0x1a9));var _0x63f7=function(_0x45569e,_0x3723fa){_0x45569e=_0x45569e-0x0;var _0x1364a0=_0x3f76[_0x45569e];return _0x1364a0;};'use strict';var ChatGroupEvents=require(_0x63f7('0x0'));var events=[_0x63f7('0x1'),_0x63f7('0x2'),_0x63f7('0x3')];function createListener(_0x2c8250,_0x172684){return function(_0x50609c){_0x172684[_0x63f7('0x4')](_0x2c8250,_0x50609c);};}function removeListener(_0x37a2d4,_0x2a1a0c){return function(){ChatGroupEvents[_0x63f7('0x5')](_0x37a2d4,_0x2a1a0c);};}exports[_0x63f7('0x6')]=function(_0x3ac695){for(var _0xd75eed=0x0,_0x10e928=events[_0x63f7('0x7')];_0xd75eed<_0x10e928;_0xd75eed++){var _0x2e888e=events[_0xd75eed];var _0x2d6c9b=createListener(_0x63f7('0x8')+_0x2e888e,_0x3ac695);ChatGroupEvents['on'](_0x2e888e,_0x2d6c9b);}}; \ No newline at end of file +var _0x4457=['emit','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x528f0e,_0x385bb3){var _0x545b0c=function(_0xdfa568){while(--_0xdfa568){_0x528f0e['push'](_0x528f0e['shift']());}};_0x545b0c(++_0x385bb3);}(_0x4457,0xba));var _0x7445=function(_0x146214,_0x13482f){_0x146214=_0x146214-0x0;var _0x2c2acb=_0x4457[_0x146214];return _0x2c2acb;};'use strict';var ChatGroupEvents=require(_0x7445('0x0'));var events=[_0x7445('0x1'),_0x7445('0x2'),'update'];function createListener(_0x14163a,_0x34b108){return function(_0x16611f){_0x34b108[_0x7445('0x3')](_0x14163a,_0x16611f);};}function removeListener(_0x25a07a,_0x10b0f0){return function(){ChatGroupEvents['removeListener'](_0x25a07a,_0x10b0f0);};}exports[_0x7445('0x4')]=function(_0xfd214b){for(var _0x3b7104=0x0,_0x413909=events[_0x7445('0x5')];_0x3b7104<_0x413909;_0x3b7104++){var _0x2df3fd=events[_0x3b7104];var _0x380ce9=createListener(_0x7445('0x6')+_0x2df3fd,_0xfd214b);ChatGroupEvents['on'](_0x2df3fd,_0x380ce9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 649d3fc..a650e3f 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 _0xb368=['update','delete','destroy','removeMembers','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','post','addMembers','put'];(function(_0x38f6b3,_0x192551){var _0x534a41=function(_0x250f37){while(--_0x250f37){_0x38f6b3['push'](_0x38f6b3['shift']());}};_0x534a41(++_0x192551);}(_0xb368,0x118));var _0x8b36=function(_0x4ae2c0,_0x151ec8){_0x4ae2c0=_0x4ae2c0-0x0;var _0x1d631b=_0xb368[_0x4ae2c0];return _0x1d631b;};'use strict';var multer=require(_0x8b36('0x0'));var util=require(_0x8b36('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8b36('0x2'));var router=express[_0x8b36('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8b36('0x4'));var interaction=require(_0x8b36('0x5'));var config=require(_0x8b36('0x6'));var controller=require('./chatGroup.controller');router[_0x8b36('0x7')]('/',auth['isAuthenticated'](),controller[_0x8b36('0x8')]);router['get'](_0x8b36('0x9'),auth[_0x8b36('0xa')](),controller['describe']);router[_0x8b36('0x7')](_0x8b36('0xb'),auth[_0x8b36('0xa')](),controller[_0x8b36('0xc')]);router[_0x8b36('0x7')](_0x8b36('0xd'),auth[_0x8b36('0xa')](),controller['getUnread']);router[_0x8b36('0x7')](_0x8b36('0xe'),auth[_0x8b36('0xa')](),controller[_0x8b36('0xf')]);router[_0x8b36('0x7')](_0x8b36('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0x8b36('0x11')]('/',auth[_0x8b36('0xa')](),controller['create']);router[_0x8b36('0x11')](_0x8b36('0xe'),auth[_0x8b36('0xa')](),controller[_0x8b36('0x12')]);router[_0x8b36('0x11')](_0x8b36('0x10'),auth[_0x8b36('0xa')](),controller['addMessage']);router[_0x8b36('0x13')]('/:id',auth[_0x8b36('0xa')](),controller[_0x8b36('0x14')]);router[_0x8b36('0x15')](_0x8b36('0xb'),auth[_0x8b36('0xa')](),controller[_0x8b36('0x16')]);router['delete']('/:id/members',auth[_0x8b36('0xa')](),controller[_0x8b36('0x17')]);module[_0x8b36('0x18')]=router; \ No newline at end of file +var _0x4fcd=['update','delete','destroy','removeMembers','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','create','post','addMembers','addMessage'];(function(_0xde713c,_0x565230){var _0x58e03c=function(_0x2c3af0){while(--_0x2c3af0){_0xde713c['push'](_0xde713c['shift']());}};_0x58e03c(++_0x565230);}(_0x4fcd,0x1c4));var _0xd4fc=function(_0xf93d8d,_0x12031c){_0xf93d8d=_0xf93d8d-0x0;var _0x232fb8=_0x4fcd[_0xf93d8d];return _0x232fb8;};'use strict';var multer=require(_0xd4fc('0x0'));var util=require('util');var path=require(_0xd4fc('0x1'));var timeout=require(_0xd4fc('0x2'));var express=require(_0xd4fc('0x3'));var router=express[_0xd4fc('0x4')]();var fs_extra=require(_0xd4fc('0x5'));var auth=require(_0xd4fc('0x6'));var interaction=require(_0xd4fc('0x7'));var config=require(_0xd4fc('0x8'));var controller=require(_0xd4fc('0x9'));router[_0xd4fc('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd4fc('0xa')](_0xd4fc('0xb'),auth[_0xd4fc('0xc')](),controller['describe']);router[_0xd4fc('0xa')](_0xd4fc('0xd'),auth[_0xd4fc('0xc')](),controller[_0xd4fc('0xe')]);router[_0xd4fc('0xa')](_0xd4fc('0xf'),auth['isAuthenticated'](),controller[_0xd4fc('0x10')]);router['get'](_0xd4fc('0x11'),auth['isAuthenticated'](),controller['getMembers']);router[_0xd4fc('0xa')](_0xd4fc('0x12'),auth[_0xd4fc('0xc')](),controller[_0xd4fc('0x13')]);router['post']('/',auth[_0xd4fc('0xc')](),controller[_0xd4fc('0x14')]);router[_0xd4fc('0x15')](_0xd4fc('0x11'),auth[_0xd4fc('0xc')](),controller[_0xd4fc('0x16')]);router['post'](_0xd4fc('0x12'),auth[_0xd4fc('0xc')](),controller[_0xd4fc('0x17')]);router['put']('/:id',auth[_0xd4fc('0xc')](),controller[_0xd4fc('0x18')]);router[_0xd4fc('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xd4fc('0x1a')]);router[_0xd4fc('0x19')](_0xd4fc('0x11'),auth[_0xd4fc('0xc')](),controller[_0xd4fc('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index bedc937..a9fea04 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 _0x7a96=['DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','long'];(function(_0x1c4c96,_0x108229){var _0x2b2ff8=function(_0x2c9dd9){while(--_0x2c9dd9){_0x1c4c96['push'](_0x1c4c96['shift']());}};_0x2b2ff8(++_0x108229);}(_0x7a96,0x18e));var _0x67a9=function(_0x28a180,_0x5bb5b0){_0x28a180=_0x28a180-0x0;var _0x1161d3=_0x7a96[_0x28a180];return _0x1161d3;};'use strict';var Sequelize=require(_0x67a9('0x0'));module[_0x67a9('0x1')]={'closed':{'type':Sequelize[_0x67a9('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x67a9('0x3')]},'ratingType':{'type':Sequelize[_0x67a9('0x4')](_0x67a9('0x5'),_0x67a9('0x6')),'defaultValue':_0x67a9('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x67a9('0x7')]},'mailTranscript':{'type':Sequelize[_0x67a9('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x67a9('0x8')]},'secondDisposition':{'type':Sequelize[_0x67a9('0x8')]},'thirdDisposition':{'type':Sequelize[_0x67a9('0x8')]},'note':{'type':Sequelize[_0x67a9('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x67a9('0x8')]},'osVersion':{'type':Sequelize[_0x67a9('0x8')]},'deviceModel':{'type':Sequelize[_0x67a9('0x8')]},'deviceVendor':{'type':Sequelize[_0x67a9('0x8')]},'deviceType':{'type':Sequelize[_0x67a9('0x8')]},'referer':{'type':Sequelize[_0x67a9('0x7')]},'customerIp':{'type':Sequelize[_0x67a9('0x8')]},'formData':{'type':Sequelize[_0x67a9('0x7')](_0x67a9('0x9'))},'read1stAt':{'type':Sequelize[_0x67a9('0xa')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x67a9('0x4')]('in',_0x67a9('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x67a9('0x8')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x67a9('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x67a9('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc7ff=['sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','long','DATE','out','INTEGER'];(function(_0x4131da,_0x124783){var _0x583242=function(_0x4c899f){while(--_0x4c899f){_0x4131da['push'](_0x4131da['shift']());}};_0x583242(++_0x124783);}(_0xc7ff,0x78));var _0xfc7f=function(_0x5e5088,_0x28cd71){_0x5e5088=_0x5e5088-0x0;var _0x3de657=_0xc7ff[_0x5e5088];return _0x3de657;};'use strict';var Sequelize=require(_0xfc7f('0x0'));module[_0xfc7f('0x1')]={'closed':{'type':Sequelize[_0xfc7f('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xfc7f('0x3')](_0xfc7f('0x4'),_0xfc7f('0x5')),'defaultValue':_0xfc7f('0x4')},'ratingMessage':{'type':Sequelize[_0xfc7f('0x6')]},'pathTranscript':{'type':Sequelize[_0xfc7f('0x6')]},'mailTranscript':{'type':Sequelize[_0xfc7f('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfc7f('0x7')]},'note':{'type':Sequelize[_0xfc7f('0x7')]},'browserName':{'type':Sequelize[_0xfc7f('0x7')]},'browserVersion':{'type':Sequelize[_0xfc7f('0x7')]},'osName':{'type':Sequelize[_0xfc7f('0x7')]},'osVersion':{'type':Sequelize[_0xfc7f('0x7')]},'deviceModel':{'type':Sequelize[_0xfc7f('0x7')]},'deviceVendor':{'type':Sequelize[_0xfc7f('0x7')]},'deviceType':{'type':Sequelize[_0xfc7f('0x7')]},'referer':{'type':Sequelize[_0xfc7f('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xfc7f('0x6')](_0xfc7f('0x8'))},'read1stAt':{'type':Sequelize[_0xfc7f('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfc7f('0x3')]('in',_0xfc7f('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfc7f('0x7')]},'customerPort':{'type':Sequelize[_0xfc7f('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xfc7f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfc7f('0xb')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1b05cac..608fc90 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 _0xa875=['limit','count','set','Content-Range','json','update','then','destroy','stack','render','merge','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','show','params','model','keys','attributes','intersection','fields','length','includeAll','include','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','user','name','email','POST','isNull','follow','vidaooMetadata','parse','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','ValidationError','updateAttributes','Contact','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','mimetype','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','%s%d','agentAlias','System','Visitor','ContactId','agentIdentifier','website_alias','agent_alias','agent_fullname','fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','nolimit','sort','where','filters','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','ChatInteractionId','options','includeAgent','push','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','read','Account','get','mkdirSync','Chat','Owner','closedAt','referer','customerIp','customerPort','N.A.','tail','createWriteStream','out','value','renderFile','views','transcript-','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','jayson/promise','client','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined'];(function(_0x5648e,_0x3ecae2){var _0x5a4270=function(_0x59bd8c){while(--_0x59bd8c){_0x5648e['push'](_0x5648e['shift']());}};_0x5a4270(++_0x3ecae2);}(_0xa875,0xab));var _0x5a87=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0xa875[_0x393500];return _0x120d3b;};'use strict';var rimraf=require(_0x5a87('0x0'));var zipdir=require(_0x5a87('0x1'));var rp=require(_0x5a87('0x2'));var moment=require('moment');var BPromise=require(_0x5a87('0x3'));var Mustache=require(_0x5a87('0x4'));var util=require('util');var path=require(_0x5a87('0x5'));var ejs=require(_0x5a87('0x6'));var fs=require('fs');var _=require(_0x5a87('0x7'));var Redis=require(_0x5a87('0x8'));var interaction=require(_0x5a87('0x9'));var qs=require(_0x5a87('0xa'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x5a87('0xb'));var config=require('../../config/environment');var db=require(_0x5a87('0xc'))['db'];config[_0x5a87('0xd')]=_[_0x5a87('0xe')](config[_0x5a87('0xd')],{'host':_0x5a87('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a87('0xd')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x5a87('0x10'));var client=jayson[_0x5a87('0x11')]['http']({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x34fd3a,_0x29767d,_0x2b4987,_0x343c42){return new BPromise(function(_0x35981c,_0x2bf644){var _0x492330=_0x343c42||client;return _0x492330[_0x5a87('0x12')](_0x34fd3a,_0x2b4987)['then'](function(_0x550409){logger[_0x5a87('0x13')](_0x5a87('0x14'),_0x29767d,'request\x20sent');logger[_0x5a87('0x15')](_0x5a87('0x16'),_0x29767d,_0x5a87('0x17'),JSON[_0x5a87('0x18')](_0x550409));if(_0x550409[_0x5a87('0x19')]){if(_0x550409[_0x5a87('0x19')][_0x5a87('0x1a')]===0x1f4){logger[_0x5a87('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x29767d,_0x550409[_0x5a87('0x19')]['message']);return _0x2bf644(_0x550409[_0x5a87('0x19')]['message']);}logger[_0x5a87('0x19')](_0x5a87('0x14'),_0x29767d,_0x550409[_0x5a87('0x19')][_0x5a87('0x1b')]);return _0x35981c(_0x550409[_0x5a87('0x19')][_0x5a87('0x1b')]);}else{logger[_0x5a87('0x13')](_0x5a87('0x14'),_0x29767d,_0x5a87('0x17'));_0x35981c(_0x550409['result'][_0x5a87('0x1b')]);}})[_0x5a87('0x1c')](function(_0x4c938f){logger[_0x5a87('0x19')](_0x5a87('0x14'),_0x29767d,_0x4c938f);_0x2bf644(_0x4c938f);});});}function respondWithStatusCode(_0x32ce34,_0x5d9618){_0x5d9618=_0x5d9618||0xcc;return function(_0x1f6eff){if(_0x1f6eff){return _0x32ce34[_0x5a87('0x1d')](_0x5d9618);}return _0x32ce34[_0x5a87('0x1e')](_0x5d9618)[_0x5a87('0x1f')]();};}function respondWithResult(_0x5bdcab,_0x2e03da){_0x2e03da=_0x2e03da||0xc8;return function(_0x308a3b){if(_0x308a3b){return _0x5bdcab[_0x5a87('0x1e')](_0x2e03da)['json'](_0x308a3b);}};}function respondWithFilteredResult(_0x21661a,_0x1820aa){return function(_0x52fd26){if(_0x52fd26){var _0x2346e1=typeof _0x1820aa[_0x5a87('0x20')]===_0x5a87('0x21')&&typeof _0x1820aa[_0x5a87('0x22')]===_0x5a87('0x21');var _0x169958=_0x52fd26['count'];var _0x26441d=_0x2346e1?0x0:_0x1820aa[_0x5a87('0x20')];var _0x5c3249=_0x2346e1?_0x52fd26[_0x5a87('0x23')]:_0x1820aa[_0x5a87('0x20')]+_0x1820aa[_0x5a87('0x22')];var _0x272d84;if(_0x5c3249>=_0x169958){_0x5c3249=_0x169958;_0x272d84=0xc8;}else{_0x272d84=0xce;}_0x21661a[_0x5a87('0x1e')](_0x272d84);return _0x21661a[_0x5a87('0x24')](_0x5a87('0x25'),_0x26441d+'-'+_0x5c3249+'/'+_0x169958)[_0x5a87('0x26')](_0x52fd26);}return null;};}function saveUpdates(_0x520b91){return function(_0x11f448){if(_0x11f448){return _0x11f448[_0x5a87('0x27')](_0x520b91)[_0x5a87('0x28')](function(_0x33cf17){return _0x33cf17;});}return null;};}function removeEntity(_0x31e96b){return function(_0x7c79a1){if(_0x7c79a1){return _0x7c79a1[_0x5a87('0x29')]()['then'](function(){_0x31e96b[_0x5a87('0x1e')](0xcc)[_0x5a87('0x1f')]();});}};}function handleEntityNotFound(_0x4b625b){return function(_0x5114e7){if(!_0x5114e7){_0x4b625b[_0x5a87('0x1d')](0x194);}return _0x5114e7;};}function handleError(_0x30e65a,_0x43b585){_0x43b585=_0x43b585||0x1f4;return function(_0x213473){logger[_0x5a87('0x19')](_0x213473[_0x5a87('0x2a')]);if(_0x213473['name']){delete _0x213473['name'];}_0x30e65a[_0x5a87('0x1e')](_0x43b585)['send'](_0x213473);};}function getMustacheRender(_0x7c3345,_0x4444a3){return Mustache[_0x5a87('0x2b')](_0x7c3345,_[_0x5a87('0x2c')](_0x4444a3['body'],{'contact':_0x4444a3[_0x5a87('0x2d')],'message':_0x4444a3[_0x5a87('0x1b')],'agent':_0x4444a3[_0x5a87('0x2e')],'interaction':_0x4444a3[_0x5a87('0x2f')],'account':_0x4444a3[_0x5a87('0x30')]}))||'';}exports[_0x5a87('0x31')]=function(_0x474120,_0x55561e){var _0x2e98ee={};var _0x46604f=_[_0x5a87('0x32')](db[_0x5a87('0x33')][_0x5a87('0x34')],function(_0x53eee1){return{'name':_0x53eee1[_0x5a87('0x35')],'type':_0x53eee1[_0x5a87('0x36')][_0x5a87('0x37')]};});_0x2e98ee=qs[_0x5a87('0x38')](_0x46604f,_0x474120);return interaction[_0x5a87('0x39')]('chat',_0x474120[_0x5a87('0x3a')],_0x474120['user'],_0x2e98ee,_0x46604f)[_0x5a87('0x28')](respondWithFilteredResult(_0x55561e,_0x2e98ee))[_0x5a87('0x1c')](handleError(_0x55561e,null));};exports[_0x5a87('0x3b')]=function(_0x7bd9f,_0x19894e){var _0x439cb9={'raw':![],'where':{'id':_0x7bd9f[_0x5a87('0x3c')]['id']}},_0x1cc097={};_0x1cc097[_0x5a87('0x3d')]=_[_0x5a87('0x3e')](db[_0x5a87('0x33')]['rawAttributes']);_0x1cc097[_0x5a87('0x3a')]=_[_0x5a87('0x3e')](_0x7bd9f['query']);_0x1cc097['filters']=_['intersection'](_0x1cc097[_0x5a87('0x3d')],_0x1cc097[_0x5a87('0x3a')]);_0x439cb9[_0x5a87('0x3f')]=_[_0x5a87('0x40')](_0x1cc097['model'],qs['fields'](_0x7bd9f[_0x5a87('0x3a')][_0x5a87('0x41')]));_0x439cb9[_0x5a87('0x3f')]=_0x439cb9[_0x5a87('0x3f')][_0x5a87('0x42')]?_0x439cb9[_0x5a87('0x3f')]:_0x1cc097[_0x5a87('0x3d')];if(_0x7bd9f[_0x5a87('0x3a')][_0x5a87('0x43')]){_0x439cb9[_0x5a87('0x44')]=[{'all':!![]}];}_0x439cb9=_[_0x5a87('0x2c')]({},_0x439cb9,_0x7bd9f['options']);return db[_0x5a87('0x33')][_0x5a87('0x45')](_0x439cb9)['then'](handleEntityNotFound(_0x19894e,null))[_0x5a87('0x28')](respondWithResult(_0x19894e,null))[_0x5a87('0x1c')](handleError(_0x19894e,null));};exports[_0x5a87('0x46')]=function(_0xc49bdf,_0x514f62){return db[_0x5a87('0x33')][_0x5a87('0x46')](_0xc49bdf[_0x5a87('0x47')],{})[_0x5a87('0x28')](respondWithResult(_0x514f62,0xc9))['catch'](handleError(_0x514f62,null));};exports[_0x5a87('0x27')]=function(_0x546245,_0x93c347){if(_0x546245[_0x5a87('0x47')]['id']){delete _0x546245[_0x5a87('0x47')]['id'];}return db['ChatInteraction'][_0x5a87('0x45')]({'where':{'id':_0x546245['params']['id']}})[_0x5a87('0x28')](handleEntityNotFound(_0x93c347,null))[_0x5a87('0x28')](saveUpdates(_0x546245['body'],null))[_0x5a87('0x28')](respondWithResult(_0x93c347,null))[_0x5a87('0x1c')](handleError(_0x93c347,null));};exports[_0x5a87('0x29')]=function(_0xc767b8,_0x2499af){return db[_0x5a87('0x33')][_0x5a87('0x45')]({'where':{'id':_0xc767b8[_0x5a87('0x3c')]['id']}})[_0x5a87('0x28')](handleEntityNotFound(_0x2499af,null))['then'](removeEntity(_0x2499af,null))[_0x5a87('0x1c')](handleError(_0x2499af,null));};exports['describe']=function(_0xab93fa,_0x1173b2){return db['ChatInteraction'][_0x5a87('0x48')]()[_0x5a87('0x28')](respondWithResult(_0x1173b2,null))[_0x5a87('0x1c')](handleError(_0x1173b2,null));};exports[_0x5a87('0x49')]=function(_0x53692f,_0x293465){var _0x3912f3=_0x53692f[_0x5a87('0x3c')]['id'];var _0x48db93;var _0x442a9f;var _0x1648af;return db[_0x5a87('0x33')][_0x5a87('0x4a')]({'where':{'id':_0x3912f3}})['then'](function(_0x43b5db){_0x48db93=_0x43b5db;return db[_0x5a87('0x4b')]['findOne']({'where':{'id':_0x43b5db[_0x5a87('0x4c')]},'attributes':['id',_0x5a87('0x4d'),_0x5a87('0x4e'),_0x5a87('0x4f'),_0x5a87('0x50'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x3ed9ac){if(_0x3ed9ac&&_0x3ed9ac[_0x5a87('0x4d')]&&_0x3ed9ac[_0x5a87('0x4e')]){_0x442a9f=_0x3ed9ac;var _0x271aff={'interaction':{'id':_0x3912f3},'agent':{'id':_0x53692f[_0x5a87('0x51')]['id'],'name':_0x53692f['user'][_0x5a87('0x52')],'fullname':_0x53692f['user']['fullname'],'email':_0x53692f['user'][_0x5a87('0x53')]},'contact':_0x53692f['body'][_0x5a87('0x2d')],'account':_0x53692f[_0x5a87('0x47')][_0x5a87('0x30')]};var _0x4262a8={'rejectUnauthorized':![],'method':_0x5a87('0x54'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x3ed9ac[_0x5a87('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x53692f['user'][_0x5a87('0x53')]],'buttons':null,'topic':_0x442a9f['vidaooTopic'],'note':_[_0x5a87('0x55')](_0x442a9f['vidaooNote'])?null:getMustacheRender(_0x442a9f[_0x5a87('0x50')],_0x271aff),'metadata':null},'redirect':_0x5a87('0x56'),'json':!![]};try{if(!_[_0x5a87('0x55')](_0x442a9f[_0x5a87('0x57')])){var _0x31445c=getMustacheRender(_0x442a9f[_0x5a87('0x57')],_0x271aff);var _0x225eb9=JSON[_0x5a87('0x58')](_0x31445c);_0x4262a8[_0x5a87('0x47')][_0x5a87('0x59')]=_0x225eb9;}}catch(_0x12faee){throw new db['Sequelize']['ValidationError'](_0x5a87('0x5a'));}return rp(_0x4262a8);}else{throw new db[(_0x5a87('0x5b'))]['ValidationError'](_0x5a87('0x5c'));}})[_0x5a87('0x28')](function(_0x3dbe22){_0x1648af=_0x3dbe22;if(_0x1648af['id']){var _0x40b0fd={'body':_0x1648af[_0x5a87('0x5d')],'ChatWebsiteId':_0x442a9f['id'],'ChatInteractionId':_0x48db93['id'],'direction':'out','UserId':_0x53692f[_0x5a87('0x51')]['id']};return db[_0x5a87('0x5e')][_0x5a87('0x46')](_0x40b0fd,{});}else{throw new db['Sequelize'][(_0x5a87('0x5f'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x5a87('0x28')](function(){return _0x48db93[_0x5a87('0x60')]({'vidaooSessionId':_0x1648af['id']});})[_0x5a87('0x28')](respondWithResult(_0x293465,null))[_0x5a87('0x1c')](handleError(_0x293465,null));};exports['customUpdate']=function(_0x483140,_0x28589f){if(_0x483140[_0x5a87('0x47')]['id']){delete _0x483140[_0x5a87('0x47')]['id'];}return db['ChatInteraction'][_0x5a87('0x45')]({'where':{'id':_0x483140[_0x5a87('0x3c')]['id']},'include':[{'model':db['CmContact'],'as':_0x5a87('0x61')}]})[_0x5a87('0x28')](handleEntityNotFound(_0x28589f,null))['then'](saveUpdates(_0x483140[_0x5a87('0x47')],null))[_0x5a87('0x28')](respondWithResult(_0x28589f,null))[_0x5a87('0x1c')](handleError(_0x28589f,null));};exports['abandon']=function(_0x127fb6,_0xf9d1e2){if(_0x127fb6['body']['id']){delete _0x127fb6['body']['id'];}return db[_0x5a87('0x33')][_0x5a87('0x45')]({'where':{'id':_0x127fb6[_0x5a87('0x3c')]['id']}})['then'](function(_0x14099b){if(!_0x14099b){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x5a87('0x62'));_0xf9d1e2[_0x5a87('0x1d')](0x194);}else{if(_0x14099b[_0x5a87('0x63')]){throw new db[(_0x5a87('0x5b'))][(_0x5a87('0x5f'))](_0x5a87('0x64'));}}return _0x14099b;})[_0x5a87('0x28')](function(_0x1d52ad){if(_0x1d52ad){return _0x1d52ad[_0x5a87('0x27')]({'closed':_0x127fb6['body']['closed'],'disposition':_0x127fb6[_0x5a87('0x47')][_0x5a87('0x65')]})['then'](function(_0x2c9b56){return _0x2c9b56;});}})['then'](function(){return respondWithRpcPromise(_0x5a87('0x66'),_0x5a87('0x67'),_0x127fb6[_0x5a87('0x47')],client9004);})[_0x5a87('0x28')](respondWithResult(_0xf9d1e2,null))['catch'](handleError(_0xf9d1e2,null));};exports[_0x5a87('0x68')]=function(_0x581c9b,_0x507391){_0x581c9b[_0x5a87('0x47')][_0x5a87('0x52')]=_0x581c9b[_0x5a87('0x69')][_0x5a87('0x6a')];_0x581c9b['body'][_0x5a87('0x6b')]=_0x581c9b[_0x5a87('0x69')][_0x5a87('0x6c')];_0x581c9b[_0x5a87('0x47')][_0x5a87('0x36')]=_0x581c9b['file'][_0x5a87('0x6d')];return db['Attachment'][_0x5a87('0x46')](_0x581c9b[_0x5a87('0x47')])[_0x5a87('0x28')](respondWithResult(_0x507391,0xc9))['catch'](handleError(_0x507391,null));};exports['attachmentDownload']=function(_0x25a236,_0x35b9d0){return db[_0x5a87('0x33')]['findOne']({'where':{'id':_0x25a236[_0x5a87('0x3c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x35b9d0,null))[_0x5a87('0x28')](function(_0x18201f){if(_0x18201f){if(_0x18201f[_0x5a87('0x6e')]){return _0x35b9d0[_0x5a87('0x1e')](0x193)['json']({'status':0x193,'message':_0x5a87('0x6f')});}return db[_0x5a87('0x70')][_0x5a87('0x4a')]({'where':{'id':_0x25a236[_0x5a87('0x3a')][_0x5a87('0x71')]},'raw':!![]})[_0x5a87('0x28')](handleEntityNotFound(_0x35b9d0,null));}})[_0x5a87('0x28')](function(_0x49a5c1){if(_0x49a5c1){var _0x18b794=_0x49a5c1[_0x5a87('0x72')]!==null;var _0x27fea1=path[_0x5a87('0x73')](config[_0x5a87('0x74')],_0x5a87('0x75'));if(_0x18b794){_0x27fea1=path['join'](_0x27fea1,_0x5a87('0x76'));}var _0x518579=path[_0x5a87('0x73')](_0x27fea1,_0x49a5c1[_0x5a87('0x6b')]);return _0x35b9d0[_0x5a87('0x77')](_0x518579);}})['catch'](handleError(_0x35b9d0,null));};exports[_0x5a87('0x78')]=function(_0x4ce0a0,_0x84e366){var _0x295108=null;var _0x2e94ee=null;var _0x2f434c=null;if(_0x4ce0a0[_0x5a87('0x47')]['id']){delete _0x4ce0a0[_0x5a87('0x47')]['id'];}if(_0x4ce0a0[_0x5a87('0x47')][_0x5a87('0x79')]){_0x2f434c=path['join'](config[_0x5a87('0x74')],_0x5a87('0x7a'),util[_0x5a87('0x7b')](_0x5a87('0x7c'),Date[_0x5a87('0x7d')]()));_0x4ce0a0['body'][_0x5a87('0x7e')]=_0x2f434c;}return db['ChatInteraction'][_0x5a87('0x45')]({'where':{'id':_0x4ce0a0[_0x5a87('0x3c')]['id']},'include':[{'model':db[_0x5a87('0x5e')],'as':_0x5a87('0x7f'),'include':[{'model':db['User'],'as':_0x5a87('0x80')}]}]})[_0x5a87('0x28')](handleEntityNotFound(_0x84e366,null))[_0x5a87('0x28')](saveUpdates(_0x4ce0a0['body'],null))[_0x5a87('0x28')](function(_0x174568){if(_0x174568){_0x295108=_0x174568;return db['ChatWebsite'][_0x5a87('0x45')]({'where':{'id':_0x295108[_0x5a87('0x4c')]}});}})[_0x5a87('0x28')](function(_0x3b832f){if(_0x3b832f){_0x2e94ee=_0x3b832f;return db[_0x5a87('0x81')][_0x5a87('0x45')]({'where':{'id':_0x295108['ContactId']}});}})[_0x5a87('0x28')](function(_0x35c99d){if(_0x35c99d){if(_0x2f434c){var _0x11e95b=null;for(var _0x3396d5=0x1;_0x3396d5<_0x295108[_0x5a87('0x7f')][_0x5a87('0x42')];++_0x3396d5){_0x11e95b=_0x295108[_0x5a87('0x7f')][_0x3396d5];var _0x324ff8=_0x11e95b[_0x5a87('0x63')]?util[_0x5a87('0x7b')](_0x5a87('0x82'),_0x2e94ee[_0x5a87('0x83')],_0x11e95b[_0x5a87('0x63')]):_0x5a87('0x84');var _0x106d07=_0x4ce0a0[_0x5a87('0x47')]['customer']||util[_0x5a87('0x7b')](_0x5a87('0x82'),_0x5a87('0x85'),_0x11e95b[_0x5a87('0x86')]);switch(_0x2e94ee[_0x5a87('0x87')]){case _0x5a87('0x88'):_0x324ff8=_0x11e95b[_0x5a87('0x63')]?util[_0x5a87('0x7b')](_0x5a87('0x82'),_0x2e94ee['agentAlias'],_0x11e95b['UserId']):_0x5a87('0x84');break;case _0x5a87('0x89'):_0x324ff8=_0x11e95b[_0x5a87('0x63')]?_0x11e95b['User']['alias']||_0x11e95b[_0x5a87('0x80')]['fullname']:'System';break;case _0x5a87('0x8a'):_0x324ff8=_0x11e95b[_0x5a87('0x63')]?_0x11e95b[_0x5a87('0x80')][_0x5a87('0x8b')]:_0x5a87('0x84');break;default:_0x324ff8=_0x11e95b[_0x5a87('0x63')]?util[_0x5a87('0x7b')]('%s%d',_0x2e94ee['agentAlias'],_0x11e95b[_0x5a87('0x63')]):_0x5a87('0x84');}var _0x1d53de=util[_0x5a87('0x7b')]('[%s]\x20%s:\x20%s\x0a',moment(_0x11e95b['createdAt'])[_0x5a87('0x7b')](_0x5a87('0x8c')),_0x11e95b[_0x5a87('0x8d')]==='in'?_0x106d07:_0x324ff8,_0x11e95b[_0x5a87('0x47')]);if(!_0x11e95b[_0x5a87('0x8e')]){fs[_0x5a87('0x8f')](_0x2f434c,_0x1d53de);}}return db['MailAccount'][_0x5a87('0x4a')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x5a87('0x90'),'raw':!![],'include':[{'model':db[_0x5a87('0x91')],'as':_0x5a87('0x91'),'raw':!![]}]}]});}}})[_0x5a87('0x28')](function(_0x5a528e){if(!_0x5a528e||!_0x5a528e[_0x5a87('0x90')]||!_0x4ce0a0[_0x5a87('0x47')])return _0x295108;var _0x568760=_0x5a528e[_0x5a87('0x92')]();return respondWithRpcPromise(_0x5a87('0x93'),_0x5a87('0x94'),{'account':_0x568760,'message':{'from':util[_0x5a87('0x7b')]('\x22%s\x22\x20<%s>',_0x5a528e['name'],_0x5a528e[_0x5a87('0x53')]||_0x5a528e[_0x5a87('0x90')]['user']),'to':_0x4ce0a0[_0x5a87('0x47')][_0x5a87('0x79')],'subject':_0x5a87('0x95'),'text':util[_0x5a87('0x7b')](_0x5a87('0x96'),_0x4ce0a0[_0x5a87('0x47')][_0x5a87('0x79')]),'attachments':[{'path':_0x2f434c}]}})['then'](function(){return _0x295108;})[_0x5a87('0x1c')](function(_0x51dfa4){logger[_0x5a87('0x19')](_0x51dfa4);});})[_0x5a87('0x28')](respondWithStatusCode(_0x84e366,0xc8))[_0x5a87('0x1c')](handleError(_0x84e366,null));};exports[_0x5a87('0x97')]=function(_0x4bc1ac,_0xb9f51d){return db['ChatMessage']['find']({'where':{'id':_0x4bc1ac[_0x5a87('0x3c')]['id']}})[_0x5a87('0x28')](handleEntityNotFound(_0xb9f51d,null))[_0x5a87('0x28')](function(_0x42e184){if(_0x42e184){return _0x42e184['addMessage'](_0x4bc1ac['body'][_0x5a87('0x98')],_[_0x5a87('0x99')](_0x4bc1ac[_0x5a87('0x47')],['ids','id'])||{});}})['then'](respondWithResult(_0xb9f51d,null))['catch'](handleError(_0xb9f51d,null));};exports['getMessages']=function(_0x454690,_0x2a5555){var _0x5e11bf={'raw':![],'where':{}};var _0x573b08={};var _0x49e833={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x454690[_0x5a87('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2a5555,null))[_0x5a87('0x28')](function(_0x6cf579){if(_0x6cf579){_0x573b08[_0x5a87('0x3d')]=_['keys'](db[_0x5a87('0x5e')][_0x5a87('0x34')]);_0x573b08[_0x5a87('0x3a')]=_[_0x5a87('0x3e')](_0x454690[_0x5a87('0x3a')]);_0x573b08['filters']=_[_0x5a87('0x40')](_0x573b08['model'],_0x573b08[_0x5a87('0x3a')]);_0x5e11bf[_0x5a87('0x3f')]=_['intersection'](_0x573b08[_0x5a87('0x3d')],qs[_0x5a87('0x41')](_0x454690[_0x5a87('0x3a')][_0x5a87('0x41')]));_0x5e11bf[_0x5a87('0x3f')]=_0x5e11bf[_0x5a87('0x3f')][_0x5a87('0x42')]?_0x5e11bf[_0x5a87('0x3f')]:_0x573b08['model'];if(!_0x454690[_0x5a87('0x3a')][_0x5a87('0x9a')](_0x5a87('0x9b'))){_0x5e11bf[_0x5a87('0x22')]=qs['limit'](_0x454690[_0x5a87('0x3a')]['limit']);_0x5e11bf[_0x5a87('0x20')]=qs['offset'](_0x454690[_0x5a87('0x3a')][_0x5a87('0x20')]);}_0x5e11bf['order']=qs[_0x5a87('0x9c')](_0x454690[_0x5a87('0x3a')][_0x5a87('0x9c')]);_0x5e11bf[_0x5a87('0x9d')]=qs[_0x5a87('0x9e')](_[_0x5a87('0x9f')](_0x454690['query'],_0x573b08['filters']));_0x5e11bf[_0x5a87('0x9d')]['ChatInteractionId']=_0x6cf579['id'];if(_0x454690['query'][_0x5a87('0xa0')]){_0x5e11bf[_0x5a87('0x9d')]=_[_0x5a87('0x2c')](_0x5e11bf[_0x5a87('0x9d')],{'$or':_[_0x5a87('0x32')](_0x5e11bf[_0x5a87('0x3f')],function(_0x387420){var _0x372fa2={};_0x372fa2[_0x387420]={'$like':'%'+_0x454690[_0x5a87('0x3a')]['filter']+'%'};return _0x372fa2;})});}if(_0x454690[_0x5a87('0x3a')][_0x5a87('0xa1')]){var _0x20733f=_0x454690[_0x5a87('0x3a')]['$gte'][_0x5a87('0xa2')](',');var _0x2042d9={};_0x2042d9[_0x20733f[0x0]]={'$gte':moment(_0x20733f[0x1])[_0x5a87('0x7b')](_0x5a87('0xa3'))};_0x5e11bf[_0x5a87('0x9d')]=_[_0x5a87('0x2c')](_0x5e11bf[_0x5a87('0x9d')],_0x2042d9);}_0x5e11bf=_[_0x5a87('0x2c')]({},_0x5e11bf,_0x454690['options']);return db[_0x5a87('0x5e')][_0x5a87('0x23')]({'where':_0x5e11bf[_0x5a87('0x9d')]})['then'](function(_0x53cbbc){_0x49e833[_0x5a87('0x23')]=_0x53cbbc;if(_0x454690[_0x5a87('0x3a')]['includeAll']){_0x5e11bf[_0x5a87('0x44')]=[{'all':!![]}];}return db['ChatMessage'][_0x5a87('0x39')](_0x5e11bf);})['then'](function(_0x44526a){_0x49e833[_0x5a87('0xa4')]=_0x44526a;return _0x49e833;});}})['then'](respondWithFilteredResult(_0x2a5555,_0x5e11bf))[_0x5a87('0x1c')](handleError(_0x2a5555,null));};exports[_0x5a87('0xa5')]=function(_0x505c43,_0x41f579){var _0x18b630={'where':{}},_0x3bb972={},_0x4cb704={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5a87('0x4a')]({'where':{'id':_0x505c43[_0x5a87('0x3c')]['id']}})[_0x5a87('0x28')](handleEntityNotFound(_0x41f579,null))['then'](function(_0x5d9d90){if(_0x5d9d90){_0x3bb972[_0x5a87('0x3d')]=_['keys'](db['ChatMessage'][_0x5a87('0x34')]);_0x3bb972[_0x5a87('0x3a')]=_[_0x5a87('0x3e')](_0x505c43[_0x5a87('0x3a')]);_0x3bb972[_0x5a87('0x9e')]=_[_0x5a87('0x40')](_0x3bb972[_0x5a87('0x3d')],_0x3bb972[_0x5a87('0x3a')]);_0x18b630[_0x5a87('0x3f')]=_[_0x5a87('0x40')](_0x3bb972[_0x5a87('0x3d')],qs[_0x5a87('0x41')](_0x505c43[_0x5a87('0x3a')][_0x5a87('0x41')]));_0x18b630['attributes']=_0x18b630[_0x5a87('0x3f')][_0x5a87('0x42')]?_0x18b630[_0x5a87('0x3f')]:_0x3bb972[_0x5a87('0x3d')];if(!_0x505c43[_0x5a87('0x3a')]['hasOwnProperty'](_0x5a87('0x9b'))){_0x18b630[_0x5a87('0x22')]=qs[_0x5a87('0x22')](_0x505c43['query']['limit']);_0x18b630[_0x5a87('0x20')]=qs[_0x5a87('0x20')](_0x505c43['query'][_0x5a87('0x20')]);}_0x18b630['order']=qs[_0x5a87('0x9c')](_0x505c43[_0x5a87('0x3a')][_0x5a87('0x9c')]);_0x18b630[_0x5a87('0x9d')]=qs[_0x5a87('0x9e')](_[_0x5a87('0x9f')](_0x505c43[_0x5a87('0x3a')],_0x3bb972[_0x5a87('0x9e')]));_0x18b630[_0x5a87('0x9d')][_0x5a87('0xa6')]=_0x5d9d90['id'];if(_0x505c43[_0x5a87('0x3a')]['filter']){_0x18b630[_0x5a87('0x9d')]=_[_0x5a87('0x2c')](_0x18b630['where'],{'$or':_[_0x5a87('0x32')](_0x18b630[_0x5a87('0x3f')],function(_0x239b51){var _0x4b433f={};_0x4b433f[_0x239b51]={'$like':'%'+_0x505c43[_0x5a87('0x3a')]['filter']+'%'};return _0x4b433f;})});}_0x18b630[_0x5a87('0x9d')][_0x5a87('0x8e')]=![];if(_0x505c43[_0x5a87('0x3a')]['id']){_0x18b630['where']['id']={'$gt':_0x505c43['query']['id']};}_0x18b630=_[_0x5a87('0x2c')]({},_0x18b630,_0x505c43[_0x5a87('0xa7')]);return db[_0x5a87('0x5e')][_0x5a87('0x23')]({'where':_0x18b630['where']})[_0x5a87('0x28')](function(_0x3822ca){_0x4cb704[_0x5a87('0x23')]=_0x3822ca;_0x18b630[_0x5a87('0x44')]=[];if(_0x505c43[_0x5a87('0x3a')][_0x5a87('0xa8')]){_0x18b630[_0x5a87('0x44')][_0x5a87('0xa9')]({'model':db[_0x5a87('0x80')],'as':'User','attributes':['id','fullname','alias']});}if(_0x505c43[_0x5a87('0x3a')][_0x5a87('0x43')]){_0x18b630[_0x5a87('0x44')]=[{'all':!![]}];}return db[_0x5a87('0x5e')][_0x5a87('0x39')](_0x18b630);})[_0x5a87('0x28')](function(_0x4939bf){_0x4cb704[_0x5a87('0xa4')]=_0x4939bf;return _0x4cb704;});}})[_0x5a87('0x28')](respondWithFilteredResult(_0x41f579,_0x18b630))[_0x5a87('0x1c')](handleError(_0x41f579,null));};exports[_0x5a87('0xaa')]=function(_0x9d0299,_0x468674){return db[_0x5a87('0x33')][_0x5a87('0x45')]({'where':{'id':_0x9d0299[_0x5a87('0x3c')]['id']}})[_0x5a87('0x28')](handleEntityNotFound(_0x468674,null))[_0x5a87('0x28')](function(_0x2174fe){if(_0x2174fe){return _0x2174fe[_0x5a87('0xab')](_0x9d0299[_0x5a87('0x47')][_0x5a87('0x98')],_[_0x5a87('0x99')](_0x9d0299['body'],['ids','id'])||{})['spread'](function(){return db[_0x5a87('0xac')][_0x5a87('0x39')]({'attributes':['id',_0x5a87('0x52'),_0x5a87('0xad')],'where':{'id':_0x9d0299['body'][_0x5a87('0x98')]}});})[_0x5a87('0x28')](function(_0x119258){socket[_0x5a87('0xae')](_0x5a87('0xaf'),{'id':Number(_0x9d0299['params']['id']),'tags':_0x119258||[]});return{'id':Number(_0x9d0299[_0x5a87('0x3c')]['id']),'tags':_0x119258||[]};});}})[_0x5a87('0x28')](respondWithResult(_0x468674,null))['catch'](handleError(_0x468674,null));};exports['removeTags']=function(_0x2e58c9,_0x41b923){return db[_0x5a87('0x33')][_0x5a87('0x45')]({'where':{'id':_0x2e58c9[_0x5a87('0x3c')]['id']}})['then'](handleEntityNotFound(_0x41b923,null))['then'](function(_0x40593d){if(_0x40593d){return _0x40593d[_0x5a87('0xb0')](_0x2e58c9['query'][_0x5a87('0x98')]);}})[_0x5a87('0x28')](respondWithStatusCode(_0x41b923,null))[_0x5a87('0x1c')](handleError(_0x41b923,null));};exports['download']=function(_0x5e55b7,_0x604835){var _0x448f27=moment()[_0x5a87('0xb1')]()[_0x5a87('0xb2')]();var _0x154a68=path[_0x5a87('0x73')](config[_0x5a87('0x74')],'server',_0x5a87('0xb3'),'tmp');var _0x465a11=path[_0x5a87('0x73')](config[_0x5a87('0x74')],'server',_0x5a87('0xb3'),_0x5a87('0xb4'));var _0xace5c3=path[_0x5a87('0x73')](_0x154a68,_0x448f27);var _0x3fa194=util[_0x5a87('0x7b')](_0x5a87('0xb5'),_0x5e55b7[_0x5a87('0x3c')]['id'],_0x448f27);var _0x3638b8=path[_0x5a87('0x73')](_0x154a68,_0x3fa194);var _0x18421c=[];_0x18421c[_0x5a87('0xa9')]({'model':db[_0x5a87('0x80')],'as':_0x5a87('0x80'),'attributes':['id',_0x5a87('0x8b')],'raw':!![]});_0x18421c[_0x5a87('0xa9')]({'model':db[_0x5a87('0x81')],'as':'Contact','attributes':['id',_0x5a87('0xb6'),_0x5a87('0xb7')],'raw':!![]});if(_0x5e55b7[_0x5a87('0x3a')][_0x5a87('0xb4')]){_0x18421c[_0x5a87('0xa9')]({'model':db[_0x5a87('0x70')],'as':'Attachment','raw':!![]});}var _0x4c7595=[{'model':db[_0x5a87('0x5e')],'as':_0x5a87('0x7f'),'attributes':['id',_0x5a87('0x47'),_0x5a87('0xb8'),'direction',_0x5a87('0x8e'),_0x5a87('0xb9')],'include':_0x18421c}];_0x4c7595[_0x5a87('0xa9')]({'model':db[_0x5a87('0x4b')],'as':_0x5a87('0xba'),'attributes':['id',_0x5a87('0x52')]});_0x4c7595['push']({'model':db[_0x5a87('0x80')],'as':'Owner','attributes':['id',_0x5a87('0x8b')]});return db[_0x5a87('0x33')][_0x5a87('0x45')]({'where':{'id':_0x5e55b7['params']['id']},'include':_0x4c7595})[_0x5a87('0x28')](handleEntityNotFound(_0x604835,null))['then'](function(_0x416031){if(_0x416031){var _0x1f1f62=_0x416031[_0x5a87('0xbb')]({'plain':!![]});fs[_0x5a87('0xbc')](_0xace5c3);var _0x112843={'channel':_0x5a87('0xbd'),'account':_0x1f1f62['Account'][_0x5a87('0x52')],'agent':_0x1f1f62['Owner']?_0x1f1f62[_0x5a87('0xbe')]['fullname']:'N.A.','createdAt':moment(_0x1f1f62[_0x5a87('0xb8')])[_0x5a87('0x7b')](_0x5a87('0xa3'))['toString'](),'closedAt':_0x1f1f62[_0x5a87('0x6e')]?moment(_0x1f1f62[_0x5a87('0xbf')])[_0x5a87('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5a87('0xb2')]():'','disposition':_0x1f1f62[_0x5a87('0x65')],'chatInfo':{'browser':_0x1f1f62['browserName'],'os':_0x1f1f62['osName'],'referer':_0x1f1f62[_0x5a87('0xc0')],'customerIp':_0x1f1f62[_0x5a87('0xc1')],'customerPort':_0x1f1f62[_0x5a87('0xc2')]?_0x1f1f62[_0x5a87('0xc2')]:_0x5a87('0xc3')},'messages':_(_0x1f1f62['Messages'])[_0x5a87('0xc4')]()[_0x5a87('0xa0')]({'secret':![]})[_0x5a87('0x32')](function(_0x1ecee8){if(_0x1ecee8[_0x5a87('0x70')]){var _0x60eac6=path[_0x5a87('0x73')](_0x465a11,_0x1ecee8[_0x5a87('0x70')][_0x5a87('0x6b')]);if(fs['existsSync'](_0x60eac6)){fs['createReadStream'](_0x60eac6)['pipe'](fs[_0x5a87('0xc5')](path[_0x5a87('0x73')](_0xace5c3,_0x1ecee8[_0x5a87('0x70')][_0x5a87('0x6b')])));}}return{'date':moment(_0x1ecee8[_0x5a87('0xb8')])['format'](_0x5a87('0xa3'))[_0x5a87('0xb2')](),'sender':_0x1ecee8[_0x5a87('0x8d')]===_0x5a87('0xc6')?_0x1ecee8[_0x5a87('0x80')]?_0x1ecee8['User'][_0x5a87('0x8b')]:'System':_0x1ecee8['Contact'][_0x5a87('0xb6')]+(_0x1ecee8[_0x5a87('0x61')][_0x5a87('0xb7')]?'\x20'+_0x1ecee8['Contact']['lastName']:''),'body':_0x1ecee8[_0x5a87('0x70')]?_0x1ecee8[_0x5a87('0x70')][_0x5a87('0x6b')]:_0x1ecee8[_0x5a87('0x47')],'direction':_0x1ecee8[_0x5a87('0x8d')]==='out'?'A':'C','secret':_0x1ecee8['secret'],'read':_0x1ecee8[_0x5a87('0xb9')],'attachment':_0x1ecee8[_0x5a87('0x70')]};})[_0x5a87('0xc7')]()};return ejs[_0x5a87('0xc8')](path[_0x5a87('0x73')](config[_0x5a87('0x74')],'server',_0x5a87('0xc9'),'downloadInteraction.ejs'),{'interaction':_0x112843})[_0x5a87('0x28')](function(_0x73e538){var _0x5846b4=path[_0x5a87('0x73')](_0xace5c3,_0x5a87('0xca')+_0x1f1f62['id']+'-'+_0x448f27+'.pdf');var _0x48c245={'path':_0x5846b4,'channel':_0x5a87('0xbd'),'interactionId':_0x1f1f62['id']};return pdf['createPdfFromHTML'](_0x73e538,_0x48c245);})[_0x5a87('0x28')](function(){return new Promise(function(_0x2d2a59,_0x228d12){zipdir(_0xace5c3,{'saveTo':_0x3638b8},function(_0x4b75e0,_0x1acaab){if(_0x4b75e0)return _0x228d12(_0x4b75e0);return _0x2d2a59(_0x1acaab);});})['then'](function(){return new BPromise(function(_0x522c78,_0x283f04){rimraf(_0xace5c3,function(_0x5e395d){if(_0x5e395d)_0x283f04(_0x5e395d);return _0x522c78();});});})[_0x5a87('0x28')](function(){return _0x604835[_0x5a87('0x77')](_0x3638b8,_0x3fa194,function(_0x5a9885){if(_0x5a9885){logger['error'](_0x5a87('0xcb'),_0x5a9885);}else{fs[_0x5a87('0xcc')](_0x3638b8);}});});});}else{return _0x604835[_0x5a87('0x1d')](0xc8);}})[_0x5a87('0x1c')](handleError(_0x604835,null));}; \ No newline at end of file +var _0x7bd4=['root','download','close','server/files/chat/upload/','transcript-%s.txt','pathTranscript','User','ChatWebsiteId','Messages','format','%s%d','agentAlias','System','customer','Visitor','ContactId','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','addMessage','ChatMessage','getMessages','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','ChatInteractionId','push','addTags','setTags','ids','omit','spread','Tag','color','emit','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Account','get','Chat','N.A.','closedAt','browserName','osName','customerIp','existsSync','createReadStream','pipe','createWriteStream','out','read','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','rimraf','zip-dir','moment','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','./chatInteraction.socket','register','client','http','request','then','request\x20sent','debug','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','end','name','send','render','merge','contact','agent','interaction','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','query','user','show','params','rawAttributes','keys','filters','model','attributes','intersection','length','includeAll','include','options','find','create','body','describe','createVidaooSession','ChatWebsite','vidaooEscalation','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','UserId','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','findOne','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join'];(function(_0x2124a2,_0x28bfdd){var _0x3ce1f3=function(_0x6bcfd1){while(--_0x6bcfd1){_0x2124a2['push'](_0x2124a2['shift']());}};_0x3ce1f3(++_0x28bfdd);}(_0x7bd4,0x127));var _0x47bd=function(_0x74c5d6,_0x4471d5){_0x74c5d6=_0x74c5d6-0x0;var _0x1891ae=_0x7bd4[_0x74c5d6];return _0x1891ae;};'use strict';var rimraf=require(_0x47bd('0x0'));var zipdir=require(_0x47bd('0x1'));var rp=require('request-promise');var moment=require(_0x47bd('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x47bd('0x3'));var ejs=require(_0x47bd('0x4'));var fs=require('fs');var _=require(_0x47bd('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x47bd('0x6'));var pdf=require(_0x47bd('0x7'));var logger=require(_0x47bd('0x8'))(_0x47bd('0x9'));var config=require('../../config/environment');var db=require(_0x47bd('0xa'))['db'];config['redis']=_['defaults'](config[_0x47bd('0xb')],{'host':_0x47bd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x47bd('0xd'))[_0x47bd('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x47bd('0xf')][_0x47bd('0x10')]({'port':0x232b});var client9004=jayson[_0x47bd('0xf')][_0x47bd('0x10')]({'port':0x232c});function respondWithRpcPromise(_0x21f046,_0x4beb3a,_0x295224,_0x44be0c){return new BPromise(function(_0x27a00d,_0xa68a5c){var _0x56e5b4=_0x44be0c||client;return _0x56e5b4[_0x47bd('0x11')](_0x21f046,_0x295224)[_0x47bd('0x12')](function(_0x4822fc){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4beb3a,_0x47bd('0x13'));logger[_0x47bd('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4beb3a,_0x47bd('0x13'),JSON['stringify'](_0x4822fc));if(_0x4822fc[_0x47bd('0x15')]){if(_0x4822fc[_0x47bd('0x15')][_0x47bd('0x16')]===0x1f4){logger[_0x47bd('0x15')](_0x47bd('0x17'),_0x4beb3a,_0x4822fc[_0x47bd('0x15')][_0x47bd('0x18')]);return _0xa68a5c(_0x4822fc[_0x47bd('0x15')]['message']);}logger[_0x47bd('0x15')](_0x47bd('0x17'),_0x4beb3a,_0x4822fc[_0x47bd('0x15')]['message']);return _0x27a00d(_0x4822fc[_0x47bd('0x15')][_0x47bd('0x18')]);}else{logger[_0x47bd('0x19')](_0x47bd('0x17'),_0x4beb3a,_0x47bd('0x13'));_0x27a00d(_0x4822fc['result']['message']);}})[_0x47bd('0x1a')](function(_0xf9f8c3){logger[_0x47bd('0x15')](_0x47bd('0x17'),_0x4beb3a,_0xf9f8c3);_0xa68a5c(_0xf9f8c3);});});}function respondWithStatusCode(_0x7582c9,_0x7c074b){_0x7c074b=_0x7c074b||0xcc;return function(_0x229964){if(_0x229964){return _0x7582c9['sendStatus'](_0x7c074b);}return _0x7582c9[_0x47bd('0x1b')](_0x7c074b)['end']();};}function respondWithResult(_0x2fc8f6,_0x52dac3){_0x52dac3=_0x52dac3||0xc8;return function(_0x42ef48){if(_0x42ef48){return _0x2fc8f6['status'](_0x52dac3)[_0x47bd('0x1c')](_0x42ef48);}};}function respondWithFilteredResult(_0x2acc5c,_0x5f05d5){return function(_0x176aa4){if(_0x176aa4){var _0x44cfbc=typeof _0x5f05d5[_0x47bd('0x1d')]===_0x47bd('0x1e')&&typeof _0x5f05d5['limit']===_0x47bd('0x1e');var _0xd60483=_0x176aa4[_0x47bd('0x1f')];var _0x3d8307=_0x44cfbc?0x0:_0x5f05d5['offset'];var _0x2da046=_0x44cfbc?_0x176aa4[_0x47bd('0x1f')]:_0x5f05d5[_0x47bd('0x1d')]+_0x5f05d5[_0x47bd('0x20')];var _0xea8491;if(_0x2da046>=_0xd60483){_0x2da046=_0xd60483;_0xea8491=0xc8;}else{_0xea8491=0xce;}_0x2acc5c[_0x47bd('0x1b')](_0xea8491);return _0x2acc5c[_0x47bd('0x21')](_0x47bd('0x22'),_0x3d8307+'-'+_0x2da046+'/'+_0xd60483)[_0x47bd('0x1c')](_0x176aa4);}return null;};}function saveUpdates(_0x4476b5){return function(_0x4e8fd6){if(_0x4e8fd6){return _0x4e8fd6[_0x47bd('0x23')](_0x4476b5)[_0x47bd('0x12')](function(_0x55da5b){return _0x55da5b;});}return null;};}function removeEntity(_0x38f2a7){return function(_0x230ac9){if(_0x230ac9){return _0x230ac9['destroy']()[_0x47bd('0x12')](function(){_0x38f2a7[_0x47bd('0x1b')](0xcc)[_0x47bd('0x24')]();});}};}function handleEntityNotFound(_0x4b50bf){return function(_0x5bac79){if(!_0x5bac79){_0x4b50bf['sendStatus'](0x194);}return _0x5bac79;};}function handleError(_0x86a141,_0x47910f){_0x47910f=_0x47910f||0x1f4;return function(_0x4cdd8b){logger[_0x47bd('0x15')](_0x4cdd8b['stack']);if(_0x4cdd8b['name']){delete _0x4cdd8b[_0x47bd('0x25')];}_0x86a141[_0x47bd('0x1b')](_0x47910f)[_0x47bd('0x26')](_0x4cdd8b);};}function getMustacheRender(_0x3b9c12,_0x106ada){return Mustache[_0x47bd('0x27')](_0x3b9c12,_[_0x47bd('0x28')](_0x106ada['body'],{'contact':_0x106ada[_0x47bd('0x29')],'message':_0x106ada[_0x47bd('0x18')],'agent':_0x106ada[_0x47bd('0x2a')],'interaction':_0x106ada[_0x47bd('0x2b')],'account':_0x106ada['account']}))||'';}exports[_0x47bd('0x2c')]=function(_0x2827e9,_0x3cf886){var _0x513460={};var _0x55ade4=_[_0x47bd('0x2d')](db[_0x47bd('0x2e')]['rawAttributes'],function(_0x365519){return{'name':_0x365519[_0x47bd('0x2f')],'type':_0x365519[_0x47bd('0x30')][_0x47bd('0x31')]};});_0x513460=qs[_0x47bd('0x32')](_0x55ade4,_0x2827e9);return interaction[_0x47bd('0x33')]('chat',_0x2827e9[_0x47bd('0x34')],_0x2827e9[_0x47bd('0x35')],_0x513460,_0x55ade4)[_0x47bd('0x12')](respondWithFilteredResult(_0x3cf886,_0x513460))['catch'](handleError(_0x3cf886,null));};exports[_0x47bd('0x36')]=function(_0x12bbcd,_0x46087e){var _0x57afae={'raw':![],'where':{'id':_0x12bbcd[_0x47bd('0x37')]['id']}},_0x55c1bc={};_0x55c1bc['model']=_['keys'](db['ChatInteraction'][_0x47bd('0x38')]);_0x55c1bc[_0x47bd('0x34')]=_[_0x47bd('0x39')](_0x12bbcd[_0x47bd('0x34')]);_0x55c1bc[_0x47bd('0x3a')]=_['intersection'](_0x55c1bc[_0x47bd('0x3b')],_0x55c1bc['query']);_0x57afae[_0x47bd('0x3c')]=_[_0x47bd('0x3d')](_0x55c1bc[_0x47bd('0x3b')],qs['fields'](_0x12bbcd['query']['fields']));_0x57afae[_0x47bd('0x3c')]=_0x57afae[_0x47bd('0x3c')][_0x47bd('0x3e')]?_0x57afae[_0x47bd('0x3c')]:_0x55c1bc[_0x47bd('0x3b')];if(_0x12bbcd[_0x47bd('0x34')][_0x47bd('0x3f')]){_0x57afae[_0x47bd('0x40')]=[{'all':!![]}];}_0x57afae=_[_0x47bd('0x28')]({},_0x57afae,_0x12bbcd[_0x47bd('0x41')]);return db[_0x47bd('0x2e')][_0x47bd('0x42')](_0x57afae)[_0x47bd('0x12')](handleEntityNotFound(_0x46087e,null))['then'](respondWithResult(_0x46087e,null))[_0x47bd('0x1a')](handleError(_0x46087e,null));};exports[_0x47bd('0x43')]=function(_0xe8eff6,_0x1d8fab){return db['ChatInteraction'][_0x47bd('0x43')](_0xe8eff6[_0x47bd('0x44')],{})[_0x47bd('0x12')](respondWithResult(_0x1d8fab,0xc9))['catch'](handleError(_0x1d8fab,null));};exports['update']=function(_0x58e548,_0x441e5c){if(_0x58e548[_0x47bd('0x44')]['id']){delete _0x58e548['body']['id'];}return db[_0x47bd('0x2e')]['find']({'where':{'id':_0x58e548['params']['id']}})[_0x47bd('0x12')](handleEntityNotFound(_0x441e5c,null))[_0x47bd('0x12')](saveUpdates(_0x58e548[_0x47bd('0x44')],null))[_0x47bd('0x12')](respondWithResult(_0x441e5c,null))[_0x47bd('0x1a')](handleError(_0x441e5c,null));};exports['destroy']=function(_0x4a1e3d,_0x35e580){return db[_0x47bd('0x2e')][_0x47bd('0x42')]({'where':{'id':_0x4a1e3d['params']['id']}})[_0x47bd('0x12')](handleEntityNotFound(_0x35e580,null))[_0x47bd('0x12')](removeEntity(_0x35e580,null))[_0x47bd('0x1a')](handleError(_0x35e580,null));};exports[_0x47bd('0x45')]=function(_0x19f969,_0x521c08){return db['ChatInteraction'][_0x47bd('0x45')]()[_0x47bd('0x12')](respondWithResult(_0x521c08,null))[_0x47bd('0x1a')](handleError(_0x521c08,null));};exports[_0x47bd('0x46')]=function(_0x410231,_0x16171d){var _0x2ead55=_0x410231[_0x47bd('0x37')]['id'];var _0x42d81d;var _0x435252;var _0x4bc48e;return db['ChatInteraction']['findOne']({'where':{'id':_0x2ead55}})[_0x47bd('0x12')](function(_0x52b308){_0x42d81d=_0x52b308;return db[_0x47bd('0x47')]['findOne']({'where':{'id':_0x52b308['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0x47bd('0x48'),'vidaooTopic',_0x47bd('0x49'),_0x47bd('0x4a')],'raw':!![]});})['then'](function(_0x4cbbd4){if(_0x4cbbd4&&_0x4cbbd4[_0x47bd('0x4b')]&&_0x4cbbd4['vidaooEscalation']){_0x435252=_0x4cbbd4;var _0x22b918={'interaction':{'id':_0x2ead55},'agent':{'id':_0x410231[_0x47bd('0x35')]['id'],'name':_0x410231[_0x47bd('0x35')][_0x47bd('0x25')],'fullname':_0x410231[_0x47bd('0x35')][_0x47bd('0x4c')],'email':_0x410231[_0x47bd('0x35')][_0x47bd('0x4d')]},'contact':_0x410231[_0x47bd('0x44')]['contact'],'account':_0x410231[_0x47bd('0x44')]['account']};var _0x218800={'rejectUnauthorized':![],'method':_0x47bd('0x4e'),'url':_0x47bd('0x4f'),'headers':{'X-APIKEY':_0x4cbbd4[_0x47bd('0x4b')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x410231[_0x47bd('0x35')][_0x47bd('0x4d')]],'buttons':null,'topic':_0x435252[_0x47bd('0x50')],'note':_['isNull'](_0x435252['vidaooNote'])?null:getMustacheRender(_0x435252[_0x47bd('0x49')],_0x22b918),'metadata':null},'redirect':_0x47bd('0x51'),'json':!![]};try{if(!_['isNull'](_0x435252['vidaooMetadata'])){var _0x47f5e1=getMustacheRender(_0x435252[_0x47bd('0x4a')],_0x22b918);var _0x308e93=JSON[_0x47bd('0x52')](_0x47f5e1);_0x218800[_0x47bd('0x44')][_0x47bd('0x53')]=_0x308e93;}}catch(_0x24da33){throw new db[(_0x47bd('0x54'))][(_0x47bd('0x55'))](_0x47bd('0x56'));}return rp(_0x218800);}else{throw new db[(_0x47bd('0x54'))][(_0x47bd('0x55'))](_0x47bd('0x57'));}})['then'](function(_0x5b147d){_0x4bc48e=_0x5b147d;if(_0x4bc48e['id']){var _0x17227b={'body':_0x4bc48e[_0x47bd('0x58')],'ChatWebsiteId':_0x435252['id'],'ChatInteractionId':_0x42d81d['id'],'direction':'out','UserId':_0x410231['user']['id']};return db['ChatMessage'][_0x47bd('0x43')](_0x17227b,{});}else{throw new db[(_0x47bd('0x54'))][(_0x47bd('0x55'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x47bd('0x12')](function(){return _0x42d81d['updateAttributes']({'vidaooSessionId':_0x4bc48e['id']});})[_0x47bd('0x12')](respondWithResult(_0x16171d,null))[_0x47bd('0x1a')](handleError(_0x16171d,null));};exports['customUpdate']=function(_0x39f438,_0x334bae){if(_0x39f438[_0x47bd('0x44')]['id']){delete _0x39f438['body']['id'];}return db[_0x47bd('0x2e')][_0x47bd('0x42')]({'where':{'id':_0x39f438[_0x47bd('0x37')]['id']},'include':[{'model':db[_0x47bd('0x59')],'as':'Contact'}]})[_0x47bd('0x12')](handleEntityNotFound(_0x334bae,null))[_0x47bd('0x12')](saveUpdates(_0x39f438[_0x47bd('0x44')],null))[_0x47bd('0x12')](respondWithResult(_0x334bae,null))['catch'](handleError(_0x334bae,null));};exports[_0x47bd('0x5a')]=function(_0x5c0ef9,_0xe85672){if(_0x5c0ef9['body']['id']){delete _0x5c0ef9[_0x47bd('0x44')]['id'];}return db[_0x47bd('0x2e')][_0x47bd('0x42')]({'where':{'id':_0x5c0ef9[_0x47bd('0x37')]['id']}})[_0x47bd('0x12')](function(_0xb0cd91){if(!_0xb0cd91){logger[_0x47bd('0x15')](_0x47bd('0x5b'),_0x47bd('0x5a'),0x194,_0x47bd('0x5c'));_0xe85672[_0x47bd('0x5d')](0x194);}else{if(_0xb0cd91[_0x47bd('0x5e')]){throw new db['Sequelize']['ValidationError']('Interaction\x20already\x20assigned');}}return _0xb0cd91;})[_0x47bd('0x12')](function(_0x1a52c3){if(_0x1a52c3){return _0x1a52c3[_0x47bd('0x23')]({'closed':_0x5c0ef9[_0x47bd('0x44')][_0x47bd('0x5f')],'disposition':_0x5c0ef9['body'][_0x47bd('0x60')]})[_0x47bd('0x12')](function(_0x1f4904){return _0x1f4904;});}})[_0x47bd('0x12')](function(){return respondWithRpcPromise(_0x47bd('0x61'),_0x47bd('0x5a'),_0x5c0ef9[_0x47bd('0x44')],client9004);})[_0x47bd('0x12')](respondWithResult(_0xe85672,null))[_0x47bd('0x1a')](handleError(_0xe85672,null));};exports[_0x47bd('0x62')]=function(_0x33cfc9,_0x1a64ad){_0x33cfc9[_0x47bd('0x44')][_0x47bd('0x25')]=_0x33cfc9[_0x47bd('0x63')][_0x47bd('0x64')];_0x33cfc9['body'][_0x47bd('0x65')]=_0x33cfc9[_0x47bd('0x63')][_0x47bd('0x66')];_0x33cfc9[_0x47bd('0x44')]['type']=_0x33cfc9[_0x47bd('0x63')][_0x47bd('0x67')];return db['Attachment'][_0x47bd('0x43')](_0x33cfc9[_0x47bd('0x44')])['then'](respondWithResult(_0x1a64ad,0xc9))[_0x47bd('0x1a')](handleError(_0x1a64ad,null));};exports[_0x47bd('0x68')]=function(_0x3035c3,_0x525703){return db[_0x47bd('0x2e')][_0x47bd('0x69')]({'where':{'id':_0x3035c3[_0x47bd('0x37')]['id']},'raw':!![]})[_0x47bd('0x12')](handleEntityNotFound(_0x525703,null))[_0x47bd('0x12')](function(_0x16d771){if(_0x16d771){if(_0x16d771[_0x47bd('0x5f')]){return _0x525703[_0x47bd('0x1b')](0x193)[_0x47bd('0x1c')]({'status':0x193,'message':_0x47bd('0x6a')});}return db[_0x47bd('0x6b')][_0x47bd('0x69')]({'where':{'id':_0x3035c3[_0x47bd('0x34')][_0x47bd('0x6c')]},'raw':!![]})[_0x47bd('0x12')](handleEntityNotFound(_0x525703,null));}})[_0x47bd('0x12')](function(_0x4a919){if(_0x4a919){var _0x558188=_0x4a919[_0x47bd('0x6d')]!==null;var _0x4c318e=path[_0x47bd('0x6e')](config[_0x47bd('0x6f')],'server/files/attachments/');if(_0x558188){_0x4c318e=path['join'](_0x4c318e,'offline-chat/');}var _0x2dee00=path[_0x47bd('0x6e')](_0x4c318e,_0x4a919[_0x47bd('0x65')]);return _0x525703[_0x47bd('0x70')](_0x2dee00);}})[_0x47bd('0x1a')](handleError(_0x525703,null));};exports[_0x47bd('0x71')]=function(_0x47e02e,_0x2f33e1){var _0x53691a=null;var _0x2c7b20=null;var _0x4bd01f=null;if(_0x47e02e[_0x47bd('0x44')]['id']){delete _0x47e02e[_0x47bd('0x44')]['id'];}if(_0x47e02e[_0x47bd('0x44')]['mailTranscript']){_0x4bd01f=path['join'](config[_0x47bd('0x6f')],_0x47bd('0x72'),util['format'](_0x47bd('0x73'),Date['now']()));_0x47e02e[_0x47bd('0x44')][_0x47bd('0x74')]=_0x4bd01f;}return db[_0x47bd('0x2e')][_0x47bd('0x42')]({'where':{'id':_0x47e02e['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x47bd('0x75')],'as':_0x47bd('0x75')}]}]})[_0x47bd('0x12')](handleEntityNotFound(_0x2f33e1,null))[_0x47bd('0x12')](saveUpdates(_0x47e02e['body'],null))[_0x47bd('0x12')](function(_0x26f1d1){if(_0x26f1d1){_0x53691a=_0x26f1d1;return db[_0x47bd('0x47')]['find']({'where':{'id':_0x53691a[_0x47bd('0x76')]}});}})[_0x47bd('0x12')](function(_0x45a64b){if(_0x45a64b){_0x2c7b20=_0x45a64b;return db[_0x47bd('0x59')][_0x47bd('0x42')]({'where':{'id':_0x53691a['ContactId']}});}})[_0x47bd('0x12')](function(_0x37fd86){if(_0x37fd86){if(_0x4bd01f){var _0x21caa5=null;for(var _0x236054=0x1;_0x236054<_0x53691a[_0x47bd('0x77')][_0x47bd('0x3e')];++_0x236054){_0x21caa5=_0x53691a[_0x47bd('0x77')][_0x236054];var _0x33e02c=_0x21caa5['UserId']?util[_0x47bd('0x78')](_0x47bd('0x79'),_0x2c7b20[_0x47bd('0x7a')],_0x21caa5[_0x47bd('0x5e')]):_0x47bd('0x7b');var _0x3c3ee7=_0x47e02e[_0x47bd('0x44')][_0x47bd('0x7c')]||util[_0x47bd('0x78')](_0x47bd('0x79'),_0x47bd('0x7d'),_0x21caa5[_0x47bd('0x7e')]);switch(_0x2c7b20[_0x47bd('0x7f')]){case _0x47bd('0x80'):_0x33e02c=_0x21caa5[_0x47bd('0x5e')]?util[_0x47bd('0x78')](_0x47bd('0x79'),_0x2c7b20[_0x47bd('0x7a')],_0x21caa5['UserId']):_0x47bd('0x7b');break;case _0x47bd('0x81'):_0x33e02c=_0x21caa5[_0x47bd('0x5e')]?_0x21caa5[_0x47bd('0x75')][_0x47bd('0x82')]||_0x21caa5[_0x47bd('0x75')]['fullname']:_0x47bd('0x7b');break;case _0x47bd('0x83'):_0x33e02c=_0x21caa5[_0x47bd('0x5e')]?_0x21caa5[_0x47bd('0x75')]['fullname']:_0x47bd('0x7b');break;default:_0x33e02c=_0x21caa5['UserId']?util[_0x47bd('0x78')](_0x47bd('0x79'),_0x2c7b20[_0x47bd('0x7a')],_0x21caa5['UserId']):_0x47bd('0x7b');}var _0x3732d2=util[_0x47bd('0x78')](_0x47bd('0x84'),moment(_0x21caa5[_0x47bd('0x85')])[_0x47bd('0x78')](_0x47bd('0x86')),_0x21caa5[_0x47bd('0x87')]==='in'?_0x3c3ee7:_0x33e02c,_0x21caa5[_0x47bd('0x44')]);if(!_0x21caa5[_0x47bd('0x88')]){fs[_0x47bd('0x89')](_0x4bd01f,_0x3732d2);}}return db['MailAccount'][_0x47bd('0x69')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x47bd('0x8a')],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x38cc97){if(!_0x38cc97||!_0x38cc97[_0x47bd('0x8b')]||!_0x47e02e[_0x47bd('0x44')])return _0x53691a;var _0xae91e7=_0x38cc97[_0x47bd('0x8c')]();return respondWithRpcPromise(_0x47bd('0x8d'),_0x47bd('0x8e'),{'account':_0xae91e7,'message':{'from':util[_0x47bd('0x78')](_0x47bd('0x8f'),_0x38cc97[_0x47bd('0x25')],_0x38cc97['email']||_0x38cc97[_0x47bd('0x8b')][_0x47bd('0x35')]),'to':_0x47e02e[_0x47bd('0x44')][_0x47bd('0x90')],'subject':_0x47bd('0x91'),'text':util[_0x47bd('0x78')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x47e02e[_0x47bd('0x44')][_0x47bd('0x90')]),'attachments':[{'path':_0x4bd01f}]}})[_0x47bd('0x12')](function(){return _0x53691a;})['catch'](function(_0x5560af){logger['error'](_0x5560af);});})[_0x47bd('0x12')](respondWithStatusCode(_0x2f33e1,0xc8))['catch'](handleError(_0x2f33e1,null));};exports[_0x47bd('0x92')]=function(_0x2b6764,_0x174d92){return db[_0x47bd('0x93')]['find']({'where':{'id':_0x2b6764[_0x47bd('0x37')]['id']}})[_0x47bd('0x12')](handleEntityNotFound(_0x174d92,null))[_0x47bd('0x12')](function(_0x4bea75){if(_0x4bea75){return _0x4bea75['addMessage'](_0x2b6764[_0x47bd('0x44')]['ids'],_['omit'](_0x2b6764[_0x47bd('0x44')],['ids','id'])||{});}})['then'](respondWithResult(_0x174d92,null))[_0x47bd('0x1a')](handleError(_0x174d92,null));};exports[_0x47bd('0x94')]=function(_0x3577af,_0x498773){var _0x454141={'raw':![],'where':{}};var _0x5e8222={};var _0x19ae71={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x47bd('0x69')]({'where':{'id':_0x3577af[_0x47bd('0x37')]['id']}})[_0x47bd('0x12')](handleEntityNotFound(_0x498773,null))[_0x47bd('0x12')](function(_0x9161a0){if(_0x9161a0){_0x5e8222[_0x47bd('0x3b')]=_[_0x47bd('0x39')](db[_0x47bd('0x93')][_0x47bd('0x38')]);_0x5e8222[_0x47bd('0x34')]=_[_0x47bd('0x39')](_0x3577af[_0x47bd('0x34')]);_0x5e8222[_0x47bd('0x3a')]=_[_0x47bd('0x3d')](_0x5e8222[_0x47bd('0x3b')],_0x5e8222[_0x47bd('0x34')]);_0x454141[_0x47bd('0x3c')]=_['intersection'](_0x5e8222[_0x47bd('0x3b')],qs[_0x47bd('0x95')](_0x3577af['query'][_0x47bd('0x95')]));_0x454141['attributes']=_0x454141[_0x47bd('0x3c')][_0x47bd('0x3e')]?_0x454141[_0x47bd('0x3c')]:_0x5e8222[_0x47bd('0x3b')];if(!_0x3577af[_0x47bd('0x34')][_0x47bd('0x96')](_0x47bd('0x97'))){_0x454141[_0x47bd('0x20')]=qs[_0x47bd('0x20')](_0x3577af['query'][_0x47bd('0x20')]);_0x454141['offset']=qs[_0x47bd('0x1d')](_0x3577af[_0x47bd('0x34')][_0x47bd('0x1d')]);}_0x454141[_0x47bd('0x98')]=qs['sort'](_0x3577af[_0x47bd('0x34')][_0x47bd('0x99')]);_0x454141[_0x47bd('0x9a')]=qs['filters'](_[_0x47bd('0x9b')](_0x3577af[_0x47bd('0x34')],_0x5e8222[_0x47bd('0x3a')]));_0x454141[_0x47bd('0x9a')]['ChatInteractionId']=_0x9161a0['id'];if(_0x3577af[_0x47bd('0x34')][_0x47bd('0x9c')]){_0x454141['where']=_['merge'](_0x454141[_0x47bd('0x9a')],{'$or':_[_0x47bd('0x2d')](_0x454141['attributes'],function(_0x5c2677){var _0x13a4ec={};_0x13a4ec[_0x5c2677]={'$like':'%'+_0x3577af[_0x47bd('0x34')][_0x47bd('0x9c')]+'%'};return _0x13a4ec;})});}if(_0x3577af[_0x47bd('0x34')][_0x47bd('0x9d')]){var _0xf3b21f=_0x3577af[_0x47bd('0x34')]['$gte'][_0x47bd('0x9e')](',');var _0x5a9ee0={};_0x5a9ee0[_0xf3b21f[0x0]]={'$gte':moment(_0xf3b21f[0x1])[_0x47bd('0x78')](_0x47bd('0x9f'))};_0x454141[_0x47bd('0x9a')]=_['merge'](_0x454141[_0x47bd('0x9a')],_0x5a9ee0);}_0x454141=_['merge']({},_0x454141,_0x3577af[_0x47bd('0x41')]);return db[_0x47bd('0x93')][_0x47bd('0x1f')]({'where':_0x454141[_0x47bd('0x9a')]})[_0x47bd('0x12')](function(_0x4c9646){_0x19ae71[_0x47bd('0x1f')]=_0x4c9646;if(_0x3577af['query'][_0x47bd('0x3f')]){_0x454141['include']=[{'all':!![]}];}return db[_0x47bd('0x93')][_0x47bd('0x33')](_0x454141);})[_0x47bd('0x12')](function(_0x562a40){_0x19ae71[_0x47bd('0xa0')]=_0x562a40;return _0x19ae71;});}})[_0x47bd('0x12')](respondWithFilteredResult(_0x498773,_0x454141))['catch'](handleError(_0x498773,null));};exports[_0x47bd('0xa1')]=function(_0x5ba967,_0xd9ac86){var _0x435e74={'where':{}},_0xb3916c={},_0x3b0e4e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x47bd('0x69')]({'where':{'id':_0x5ba967[_0x47bd('0x37')]['id']}})[_0x47bd('0x12')](handleEntityNotFound(_0xd9ac86,null))['then'](function(_0x57ec51){if(_0x57ec51){_0xb3916c[_0x47bd('0x3b')]=_['keys'](db['ChatMessage'][_0x47bd('0x38')]);_0xb3916c['query']=_['keys'](_0x5ba967['query']);_0xb3916c[_0x47bd('0x3a')]=_[_0x47bd('0x3d')](_0xb3916c['model'],_0xb3916c[_0x47bd('0x34')]);_0x435e74[_0x47bd('0x3c')]=_['intersection'](_0xb3916c[_0x47bd('0x3b')],qs[_0x47bd('0x95')](_0x5ba967['query'][_0x47bd('0x95')]));_0x435e74[_0x47bd('0x3c')]=_0x435e74[_0x47bd('0x3c')][_0x47bd('0x3e')]?_0x435e74[_0x47bd('0x3c')]:_0xb3916c['model'];if(!_0x5ba967['query'][_0x47bd('0x96')]('nolimit')){_0x435e74[_0x47bd('0x20')]=qs['limit'](_0x5ba967['query'][_0x47bd('0x20')]);_0x435e74[_0x47bd('0x1d')]=qs[_0x47bd('0x1d')](_0x5ba967[_0x47bd('0x34')][_0x47bd('0x1d')]);}_0x435e74[_0x47bd('0x98')]=qs[_0x47bd('0x99')](_0x5ba967[_0x47bd('0x34')]['sort']);_0x435e74[_0x47bd('0x9a')]=qs[_0x47bd('0x3a')](_[_0x47bd('0x9b')](_0x5ba967[_0x47bd('0x34')],_0xb3916c[_0x47bd('0x3a')]));_0x435e74['where'][_0x47bd('0xa2')]=_0x57ec51['id'];if(_0x5ba967['query']['filter']){_0x435e74[_0x47bd('0x9a')]=_[_0x47bd('0x28')](_0x435e74[_0x47bd('0x9a')],{'$or':_['map'](_0x435e74[_0x47bd('0x3c')],function(_0x31cc){var _0x1ae102={};_0x1ae102[_0x31cc]={'$like':'%'+_0x5ba967['query'][_0x47bd('0x9c')]+'%'};return _0x1ae102;})});}_0x435e74[_0x47bd('0x9a')][_0x47bd('0x88')]=![];if(_0x5ba967[_0x47bd('0x34')]['id']){_0x435e74[_0x47bd('0x9a')]['id']={'$gt':_0x5ba967['query']['id']};}_0x435e74=_[_0x47bd('0x28')]({},_0x435e74,_0x5ba967[_0x47bd('0x41')]);return db[_0x47bd('0x93')][_0x47bd('0x1f')]({'where':_0x435e74[_0x47bd('0x9a')]})['then'](function(_0x2da22f){_0x3b0e4e[_0x47bd('0x1f')]=_0x2da22f;_0x435e74[_0x47bd('0x40')]=[];if(_0x5ba967[_0x47bd('0x34')]['includeAgent']){_0x435e74[_0x47bd('0x40')][_0x47bd('0xa3')]({'model':db[_0x47bd('0x75')],'as':_0x47bd('0x75'),'attributes':['id',_0x47bd('0x4c'),'alias']});}if(_0x5ba967['query'][_0x47bd('0x3f')]){_0x435e74[_0x47bd('0x40')]=[{'all':!![]}];}return db[_0x47bd('0x93')]['findAll'](_0x435e74);})[_0x47bd('0x12')](function(_0x422506){_0x3b0e4e[_0x47bd('0xa0')]=_0x422506;return _0x3b0e4e;});}})[_0x47bd('0x12')](respondWithFilteredResult(_0xd9ac86,_0x435e74))[_0x47bd('0x1a')](handleError(_0xd9ac86,null));};exports[_0x47bd('0xa4')]=function(_0x1a68b0,_0x3d4fe7){return db[_0x47bd('0x2e')]['find']({'where':{'id':_0x1a68b0[_0x47bd('0x37')]['id']}})[_0x47bd('0x12')](handleEntityNotFound(_0x3d4fe7,null))[_0x47bd('0x12')](function(_0x170724){if(_0x170724){return _0x170724[_0x47bd('0xa5')](_0x1a68b0[_0x47bd('0x44')][_0x47bd('0xa6')],_[_0x47bd('0xa7')](_0x1a68b0[_0x47bd('0x44')],[_0x47bd('0xa6'),'id'])||{})[_0x47bd('0xa8')](function(){return db[_0x47bd('0xa9')]['findAll']({'attributes':['id',_0x47bd('0x25'),_0x47bd('0xaa')],'where':{'id':_0x1a68b0['body']['ids']}});})['then'](function(_0x49f119){socket[_0x47bd('0xab')]('chatInteractionTags:save',{'id':Number(_0x1a68b0[_0x47bd('0x37')]['id']),'tags':_0x49f119||[]});return{'id':Number(_0x1a68b0[_0x47bd('0x37')]['id']),'tags':_0x49f119||[]};});}})[_0x47bd('0x12')](respondWithResult(_0x3d4fe7,null))[_0x47bd('0x1a')](handleError(_0x3d4fe7,null));};exports['removeTags']=function(_0x480d95,_0x514006){return db[_0x47bd('0x2e')][_0x47bd('0x42')]({'where':{'id':_0x480d95['params']['id']}})[_0x47bd('0x12')](handleEntityNotFound(_0x514006,null))['then'](function(_0x58d72f){if(_0x58d72f){return _0x58d72f[_0x47bd('0xac')](_0x480d95[_0x47bd('0x34')][_0x47bd('0xa6')]);}})[_0x47bd('0x12')](respondWithStatusCode(_0x514006,null))[_0x47bd('0x1a')](handleError(_0x514006,null));};exports[_0x47bd('0x70')]=function(_0x30503e,_0x5181fe){var _0x4c4c7e=moment()[_0x47bd('0xad')]()['toString']();var _0x16dfa6=path['join'](config[_0x47bd('0x6f')],'server',_0x47bd('0xae'),_0x47bd('0xaf'));var _0xfa6b60=path[_0x47bd('0x6e')](config['root'],_0x47bd('0xb0'),'files',_0x47bd('0xb1'));var _0x4a3923=path[_0x47bd('0x6e')](_0x16dfa6,_0x4c4c7e);var _0x17e7c2=util['format'](_0x47bd('0xb2'),_0x30503e[_0x47bd('0x37')]['id'],_0x4c4c7e);var _0x1b1955=path[_0x47bd('0x6e')](_0x16dfa6,_0x17e7c2);var _0x296cd9=[];_0x296cd9[_0x47bd('0xa3')]({'model':db['User'],'as':_0x47bd('0x75'),'attributes':['id',_0x47bd('0x4c')],'raw':!![]});_0x296cd9[_0x47bd('0xa3')]({'model':db['CmContact'],'as':_0x47bd('0xb3'),'attributes':['id',_0x47bd('0xb4'),_0x47bd('0xb5')],'raw':!![]});if(_0x30503e[_0x47bd('0x34')][_0x47bd('0xb1')]){_0x296cd9[_0x47bd('0xa3')]({'model':db[_0x47bd('0x6b')],'as':_0x47bd('0x6b'),'raw':!![]});}var _0x5b894c=[{'model':db[_0x47bd('0x93')],'as':_0x47bd('0x77'),'attributes':['id',_0x47bd('0x44'),_0x47bd('0x85'),_0x47bd('0x87'),_0x47bd('0x88'),'read'],'include':_0x296cd9}];_0x5b894c['push']({'model':db[_0x47bd('0x47')],'as':_0x47bd('0xb6'),'attributes':['id','name']});_0x5b894c[_0x47bd('0xa3')]({'model':db[_0x47bd('0x75')],'as':'Owner','attributes':['id',_0x47bd('0x4c')]});return db[_0x47bd('0x2e')][_0x47bd('0x42')]({'where':{'id':_0x30503e[_0x47bd('0x37')]['id']},'include':_0x5b894c})['then'](handleEntityNotFound(_0x5181fe,null))[_0x47bd('0x12')](function(_0x42c0f8){if(_0x42c0f8){var _0x5e4cfd=_0x42c0f8[_0x47bd('0xb7')]({'plain':!![]});fs['mkdirSync'](_0x4a3923);var _0x38a476={'channel':_0x47bd('0xb8'),'account':_0x5e4cfd[_0x47bd('0xb6')][_0x47bd('0x25')],'agent':_0x5e4cfd['Owner']?_0x5e4cfd['Owner']['fullname']:_0x47bd('0xb9'),'createdAt':moment(_0x5e4cfd[_0x47bd('0x85')])['format'](_0x47bd('0x9f'))['toString'](),'closedAt':_0x5e4cfd['closed']?moment(_0x5e4cfd[_0x47bd('0xba')])[_0x47bd('0x78')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x5e4cfd['disposition'],'chatInfo':{'browser':_0x5e4cfd[_0x47bd('0xbb')],'os':_0x5e4cfd[_0x47bd('0xbc')],'referer':_0x5e4cfd['referer'],'customerIp':_0x5e4cfd[_0x47bd('0xbd')],'customerPort':_0x5e4cfd['customerPort']?_0x5e4cfd['customerPort']:_0x47bd('0xb9')},'messages':_(_0x5e4cfd[_0x47bd('0x77')])['tail']()['filter']({'secret':![]})['map'](function(_0x5077f3){if(_0x5077f3[_0x47bd('0x6b')]){var _0xea19a9=path['join'](_0xfa6b60,_0x5077f3[_0x47bd('0x6b')][_0x47bd('0x65')]);if(fs[_0x47bd('0xbe')](_0xea19a9)){fs[_0x47bd('0xbf')](_0xea19a9)[_0x47bd('0xc0')](fs[_0x47bd('0xc1')](path['join'](_0x4a3923,_0x5077f3[_0x47bd('0x6b')]['basename'])));}}return{'date':moment(_0x5077f3[_0x47bd('0x85')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x5077f3[_0x47bd('0x87')]===_0x47bd('0xc2')?_0x5077f3[_0x47bd('0x75')]?_0x5077f3['User'][_0x47bd('0x4c')]:_0x47bd('0x7b'):_0x5077f3[_0x47bd('0xb3')][_0x47bd('0xb4')]+(_0x5077f3['Contact']['lastName']?'\x20'+_0x5077f3[_0x47bd('0xb3')][_0x47bd('0xb5')]:''),'body':_0x5077f3[_0x47bd('0x6b')]?_0x5077f3['Attachment'][_0x47bd('0x65')]:_0x5077f3['body'],'direction':_0x5077f3[_0x47bd('0x87')]==='out'?'A':'C','secret':_0x5077f3[_0x47bd('0x88')],'read':_0x5077f3[_0x47bd('0xc3')],'attachment':_0x5077f3[_0x47bd('0x6b')]};})[_0x47bd('0xc4')]()};return ejs[_0x47bd('0xc5')](path[_0x47bd('0x6e')](config['root'],_0x47bd('0xb0'),_0x47bd('0xc6'),_0x47bd('0xc7')),{'interaction':_0x38a476})['then'](function(_0x452642){var _0x584731=path['join'](_0x4a3923,'transcript-'+_0x5e4cfd['id']+'-'+_0x4c4c7e+_0x47bd('0xc8'));var _0x3c4b16={'path':_0x584731,'channel':'Chat','interactionId':_0x5e4cfd['id']};return pdf[_0x47bd('0xc9')](_0x452642,_0x3c4b16);})[_0x47bd('0x12')](function(){return new Promise(function(_0x316dd8,_0x56e2ea){zipdir(_0x4a3923,{'saveTo':_0x1b1955},function(_0x34e8f2,_0x9ba4c0){if(_0x34e8f2)return _0x56e2ea(_0x34e8f2);return _0x316dd8(_0x9ba4c0);});})['then'](function(){return new BPromise(function(_0x7554dc,_0x3fc115){rimraf(_0x4a3923,function(_0x55c60a){if(_0x55c60a)_0x3fc115(_0x55c60a);return _0x7554dc();});});})[_0x47bd('0x12')](function(){return _0x5181fe[_0x47bd('0x70')](_0x1b1955,_0x17e7c2,function(_0xcfbccc){if(_0xcfbccc){logger[_0x47bd('0x15')](_0x47bd('0xca'),_0xcfbccc);}else{fs['unlinkSync'](_0x1b1955);}});});});}else{return _0x5181fe[_0x47bd('0x5d')](0xc8);}})[_0x47bd('0x1a')](handleError(_0x5181fe,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 4d0cd94..e96dcfd 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 _0x761a=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','setDataValue','map','findAll'];(function(_0x1b84a5,_0x5a035f){var _0x22c840=function(_0x1971dc){while(--_0x1971dc){_0x1b84a5['push'](_0x1b84a5['shift']());}};_0x22c840(++_0x5a035f);}(_0x761a,0xec));var _0xa761=function(_0x245e26,_0x4b44ba){_0x245e26=_0x245e26-0x0;var _0x1eeb24=_0x761a[_0x245e26];return _0x1eeb24;};'use strict';var EventEmitter=require(_0xa761('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xa761('0x1')];var ChatMessage=require(_0xa761('0x2'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xa761('0x3')](0x0);var events={'afterCreate':_0xa761('0x4'),'afterUpdate':_0xa761('0x5'),'afterDestroy':_0xa761('0x6')};function emitEvent(_0x433bac){return function(_0x3497c8,_0x356b25,_0x3c3676){_0x3497c8[_0xa761('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5bfb6a){_0x3497c8[_0xa761('0x8')]('Users',_0x5bfb6a[_0xa761('0x9')](function(_0xa74597){return{'id':_0xa74597['id']};}));return ChatMessage[_0xa761('0xa')]({'where':{'ChatInteractionId':_0x3497c8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa761('0xb')](function(_0x5074b8){_0x3497c8['setDataValue'](_0xa761('0xc'),_0x5074b8[_0xa761('0xd')]);ChatInteractionEvents[_0xa761('0xe')](_0x433bac+':'+_0x3497c8['id'],_0x3497c8);ChatInteractionEvents[_0xa761('0xe')](_0x433bac,_0x3497c8);_0x3c3676(null);})[_0xa761('0xf')](_0x3c3676(null));};}for(var e in events){if(events[_0xa761('0x10')](e)){var event=events[e];ChatInteraction[_0xa761('0x11')](e,emitEvent(event));}}module[_0xa761('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0xaac4=['exports','events','ChatMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','then','length','emit','catch','hasOwnProperty'];(function(_0x50b599,_0x36ec2b){var _0x4e6e92=function(_0x5cbbd3){while(--_0x5cbbd3){_0x50b599['push'](_0x50b599['shift']());}};_0x4e6e92(++_0x36ec2b);}(_0xaac4,0x79));var _0x4aac=function(_0x309e57,_0xe1c277){_0x309e57=_0x309e57-0x0;var _0x313c98=_0xaac4[_0x309e57];return _0x313c98;};'use strict';var EventEmitter=require(_0x4aac('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x4aac('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4aac('0x2')](0x0);var events={'afterCreate':_0x4aac('0x3'),'afterUpdate':_0x4aac('0x4'),'afterDestroy':_0x4aac('0x5')};function emitEvent(_0x38a03c){return function(_0xcd6b3e,_0x1effac,_0x4f2162){_0xcd6b3e['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5d522e){_0xcd6b3e[_0x4aac('0x6')](_0x4aac('0x7'),_0x5d522e[_0x4aac('0x8')](function(_0x4a4ade){return{'id':_0x4a4ade['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0xcd6b3e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4aac('0x9')](function(_0x1f5452){_0xcd6b3e[_0x4aac('0x6')]('unreadMessages',_0x1f5452[_0x4aac('0xa')]);ChatInteractionEvents[_0x4aac('0xb')](_0x38a03c+':'+_0xcd6b3e['id'],_0xcd6b3e);ChatInteractionEvents[_0x4aac('0xb')](_0x38a03c,_0xcd6b3e);_0x4f2162(null);})[_0x4aac('0xc')](_0x4f2162(null));};}for(var e in events){if(events[_0x4aac('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x4aac('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 957d92e..8ceeaf1 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 _0x58b7=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','chat_interactions'];(function(_0x21c0b5,_0x428974){var _0x4843b0=function(_0x225ab8){while(--_0x225ab8){_0x21c0b5['push'](_0x21c0b5['shift']());}};_0x4843b0(++_0x428974);}(_0x58b7,0x6c));var _0x758b=function(_0x3923b6,_0x2265f5){_0x3923b6=_0x3923b6-0x0;var _0x261041=_0x58b7[_0x3923b6];return _0x261041;};'use strict';var _=require(_0x758b('0x0'));var util=require('util');var logger=require(_0x758b('0x1'))(_0x758b('0x2'));var moment=require('moment');var BPromise=require(_0x758b('0x3'));var rp=require(_0x758b('0x4'));var fs=require('fs');var path=require(_0x758b('0x5'));var rimraf=require(_0x758b('0x6'));var config=require(_0x758b('0x7'));var attributes=require(_0x758b('0x8'));module[_0x758b('0x9')]=function(_0x3203e7,_0xb9d198){return _0x3203e7['define']('ChatInteraction',attributes,{'tableName':_0x758b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bd337,_0x1e12c3,_0x344720){if(_0x3bd337[_0x758b('0xb')]('closed')){_0x3bd337[_0x758b('0xc')]=moment()[_0x758b('0xd')](_0x758b('0xe'));}_0x344720(null,_0x3bd337);}},'charset':_0x758b('0xf'),'collate':_0x758b('0x10')});}; \ No newline at end of file +var _0x8018=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x14f07a,_0x522042){var _0x1ef147=function(_0x2b8926){while(--_0x2b8926){_0x14f07a['push'](_0x14f07a['shift']());}};_0x1ef147(++_0x522042);}(_0x8018,0x9b));var _0x8801=function(_0x62bcda,_0x43dc75){_0x62bcda=_0x62bcda-0x0;var _0x138e04=_0x8018[_0x62bcda];return _0x138e04;};'use strict';var _=require(_0x8801('0x0'));var util=require(_0x8801('0x1'));var logger=require(_0x8801('0x2'))(_0x8801('0x3'));var moment=require(_0x8801('0x4'));var BPromise=require('bluebird');var rp=require(_0x8801('0x5'));var fs=require('fs');var path=require(_0x8801('0x6'));var rimraf=require(_0x8801('0x7'));var config=require(_0x8801('0x8'));var attributes=require(_0x8801('0x9'));module[_0x8801('0xa')]=function(_0x210b32,_0x3ad365){return _0x210b32[_0x8801('0xb')](_0x8801('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x397921,_0x27d2a5,_0x1961b1){if(_0x397921[_0x8801('0xd')]('closed')){_0x397921[_0x8801('0xe')]=moment()[_0x8801('0xf')](_0x8801('0x10'));}_0x1961b1(null,_0x397921);}},'charset':'utf8mb4','collate':_0x8801('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 5ec6f11..55f30ba 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 _0x32d8=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','ChatInteraction','find','ids','omit','spread','AddTags','lodash','util','moment'];(function(_0x2fe7fa,_0x17da2d){var _0x1f51f0=function(_0x3d23e6){while(--_0x3d23e6){_0x2fe7fa['push'](_0x2fe7fa['shift']());}};_0x1f51f0(++_0x17da2d);}(_0x32d8,0x1aa));var _0x832d=function(_0x24fd75,_0x937198){_0x24fd75=_0x24fd75-0x0;var _0x591a95=_0x32d8[_0x24fd75];return _0x591a95;};'use strict';var _=require(_0x832d('0x0'));var util=require(_0x832d('0x1'));var moment=require(_0x832d('0x2'));var BPromise=require('bluebird');var rs=require(_0x832d('0x3'));var fs=require('fs');var Redis=require(_0x832d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x832d('0x5'));var logger=require(_0x832d('0x6'))(_0x832d('0x7'));var config=require('../../config/environment');var jayson=require(_0x832d('0x8'));var client=jayson[_0x832d('0x9')][_0x832d('0xa')]({'port':0x232a});config[_0x832d('0xb')]=_[_0x832d('0xc')](config[_0x832d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x832d('0xd'))(new Redis(config[_0x832d('0xb')]));require(_0x832d('0xe'))['register'](socket);function respondWithRpcPromise(_0x9b57a6,_0xa97526,_0x3164b2){return new BPromise(function(_0x3218de,_0x1a567c){return client['request'](_0x9b57a6,_0x3164b2)[_0x832d('0xf')](function(_0x523047){logger[_0x832d('0x10')](_0x832d('0x11'),_0xa97526,_0x832d('0x12'));logger['debug'](_0x832d('0x13'),_0xa97526,'request\x20sent',JSON[_0x832d('0x14')](_0x523047));if(_0x523047[_0x832d('0x15')]){if(_0x523047[_0x832d('0x15')][_0x832d('0x16')]===0x1f4){logger['error'](_0x832d('0x11'),_0xa97526,_0x523047[_0x832d('0x15')]['message']);return _0x1a567c(_0x523047[_0x832d('0x15')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0xa97526,_0x523047[_0x832d('0x15')][_0x832d('0x17')]);return _0x3218de(_0x523047['error'][_0x832d('0x17')]);}else{logger[_0x832d('0x10')](_0x832d('0x11'),_0xa97526,_0x832d('0x12'));_0x3218de(_0x523047['result'][_0x832d('0x17')]);}})[_0x832d('0x18')](function(_0x10b5b0){logger[_0x832d('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xa97526,_0x10b5b0);_0x1a567c(_0x10b5b0);});});}exports[_0x832d('0x19')]=function(_0x37c67d){var _0x43da3f=this;return new Promise(function(_0x44d46c,_0x2eed08){return db['ChatInteraction'][_0x832d('0x1a')](_0x37c67d[_0x832d('0x1b')],{'raw':_0x37c67d[_0x832d('0x1c')]?_0x37c67d[_0x832d('0x1c')][_0x832d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37c67d['options']?_0x37c67d[_0x832d('0x1c')][_0x832d('0x1e')]||null:null,'attributes':_0x37c67d[_0x832d('0x1c')]?_0x37c67d[_0x832d('0x1c')]['attributes']||null:null,'limit':_0x37c67d[_0x832d('0x1c')]?_0x37c67d[_0x832d('0x1c')][_0x832d('0x1f')]||null:null})[_0x832d('0xf')](function(_0x25d25f){logger[_0x832d('0x10')](_0x832d('0x19'),_0x37c67d);logger['debug'](_0x832d('0x19'),_0x37c67d,JSON[_0x832d('0x14')](_0x25d25f));_0x44d46c(_0x25d25f);})[_0x832d('0x18')](function(_0xfc9998){logger['error']('UpdateChatInteraction',_0xfc9998[_0x832d('0x17')],_0x37c67d);_0x2eed08(_0x43da3f[_0x832d('0x15')](0x1f4,_0xfc9998[_0x832d('0x17')]));});});};exports[_0x832d('0x20')]=function(_0x509877){return new Promise(function(_0x40f8c4,_0x56beb5){return db[_0x832d('0x21')][_0x832d('0x22')]({'where':_0x509877['options']?_0x509877[_0x832d('0x1c')][_0x832d('0x1e')]||null:null})[_0x832d('0xf')](function(_0x54a705){if(_0x54a705){return _0x54a705['addTags'](_0x509877['body'][_0x832d('0x23')],_[_0x832d('0x24')](_0x509877[_0x832d('0x1b')],[_0x832d('0x23'),'id'])||{});}})[_0x832d('0x25')](function(_0x369882){logger[_0x832d('0x10')]('AddTags',_0x509877);logger['debug'](_0x832d('0x26'),_0x509877,JSON['stringify'](_0x369882));_0x40f8c4(_0x369882);})[_0x832d('0x18')](function(_0x3a98f7){logger['error'](_0x832d('0x26'),_0x3a98f7[_0x832d('0x17')],_0x509877);_0x56beb5(_this[_0x832d('0x15')](0x1f4,_0x3a98f7['message']));});});}; \ No newline at end of file +var _0x93e3=['update','body','raw','options','where','attributes','limit','find','addTags','ids','omit','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x93e3,0x186));var _0x393e=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x93e3[_0x164af1];return _0x5d81a2;};'use strict';var _=require('lodash');var util=require(_0x393e('0x0'));var moment=require('moment');var BPromise=require(_0x393e('0x1'));var rs=require(_0x393e('0x2'));var fs=require('fs');var Redis=require(_0x393e('0x3'));var db=require(_0x393e('0x4'))['db'];var utils=require(_0x393e('0x5'));var logger=require(_0x393e('0x6'))(_0x393e('0x7'));var config=require(_0x393e('0x8'));var jayson=require(_0x393e('0x9'));var client=jayson[_0x393e('0xa')][_0x393e('0xb')]({'port':0x232a});config['redis']=_[_0x393e('0xc')](config['redis'],{'host':_0x393e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x393e('0xe')]));require('./chatInteraction.socket')[_0x393e('0xf')](socket);function respondWithRpcPromise(_0x1820ab,_0x580239,_0x12cf68){return new BPromise(function(_0x3b561f,_0x3caad3){return client['request'](_0x1820ab,_0x12cf68)[_0x393e('0x10')](function(_0xbce63f){logger[_0x393e('0x11')](_0x393e('0x12'),_0x580239,'request\x20sent');logger[_0x393e('0x13')](_0x393e('0x14'),_0x580239,_0x393e('0x15'),JSON[_0x393e('0x16')](_0xbce63f));if(_0xbce63f[_0x393e('0x17')]){if(_0xbce63f[_0x393e('0x17')][_0x393e('0x18')]===0x1f4){logger['error'](_0x393e('0x12'),_0x580239,_0xbce63f[_0x393e('0x17')][_0x393e('0x19')]);return _0x3caad3(_0xbce63f[_0x393e('0x17')][_0x393e('0x19')]);}logger[_0x393e('0x17')](_0x393e('0x12'),_0x580239,_0xbce63f[_0x393e('0x17')][_0x393e('0x19')]);return _0x3b561f(_0xbce63f['error']['message']);}else{logger[_0x393e('0x11')](_0x393e('0x12'),_0x580239,_0x393e('0x15'));_0x3b561f(_0xbce63f[_0x393e('0x1a')][_0x393e('0x19')]);}})[_0x393e('0x1b')](function(_0x51fcfe){logger[_0x393e('0x17')](_0x393e('0x12'),_0x580239,_0x51fcfe);_0x3caad3(_0x51fcfe);});});}exports[_0x393e('0x1c')]=function(_0x3e9276){var _0xa61833=this;return new Promise(function(_0x4690b3,_0x2a5407){return db[_0x393e('0x1d')][_0x393e('0x1e')](_0x3e9276[_0x393e('0x1f')],{'raw':_0x3e9276['options']?_0x3e9276['options'][_0x393e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e9276[_0x393e('0x21')]?_0x3e9276['options'][_0x393e('0x22')]||null:null,'attributes':_0x3e9276['options']?_0x3e9276[_0x393e('0x21')][_0x393e('0x23')]||null:null,'limit':_0x3e9276[_0x393e('0x21')]?_0x3e9276[_0x393e('0x21')][_0x393e('0x24')]||null:null})[_0x393e('0x10')](function(_0x378845){logger[_0x393e('0x11')](_0x393e('0x1c'),_0x3e9276);logger[_0x393e('0x13')](_0x393e('0x1c'),_0x3e9276,JSON[_0x393e('0x16')](_0x378845));_0x4690b3(_0x378845);})[_0x393e('0x1b')](function(_0x849207){logger[_0x393e('0x17')](_0x393e('0x1c'),_0x849207['message'],_0x3e9276);_0x2a5407(_0xa61833[_0x393e('0x17')](0x1f4,_0x849207['message']));});});};exports['AddTagsToChatInteraction']=function(_0x4827e4){return new Promise(function(_0x110061,_0x2a1266){return db[_0x393e('0x1d')][_0x393e('0x25')]({'where':_0x4827e4['options']?_0x4827e4[_0x393e('0x21')]['where']||null:null})['then'](function(_0x4285bf){if(_0x4285bf){return _0x4285bf[_0x393e('0x26')](_0x4827e4[_0x393e('0x1f')][_0x393e('0x27')],_[_0x393e('0x28')](_0x4827e4[_0x393e('0x1f')],[_0x393e('0x27'),'id'])||{});}})['spread'](function(_0xf65c9a){logger[_0x393e('0x11')]('AddTags',_0x4827e4);logger[_0x393e('0x13')]('AddTags',_0x4827e4,JSON[_0x393e('0x16')](_0xf65c9a));_0x110061(_0xf65c9a);})[_0x393e('0x1b')](function(_0x427424){logger[_0x393e('0x17')](_0x393e('0x29'),_0x427424[_0x393e('0x19')],_0x4827e4);_0x2a1266(_this[_0x393e('0x17')](0x1f4,_0x427424[_0x393e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 6d3c7d6..71f5efb 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 _0xeb89=['length','chatInteraction:','./chatInteraction.events','save','remove','emit','removeListener','register'];(function(_0x327ec1,_0x14e5be){var _0x36d595=function(_0x2d80c0){while(--_0x2d80c0){_0x327ec1['push'](_0x327ec1['shift']());}};_0x36d595(++_0x14e5be);}(_0xeb89,0x9a));var _0x9eb8=function(_0x1829c7,_0x34b9e0){_0x1829c7=_0x1829c7-0x0;var _0x2a76b6=_0xeb89[_0x1829c7];return _0x2a76b6;};'use strict';var ChatInteractionEvents=require(_0x9eb8('0x0'));var events=[_0x9eb8('0x1'),_0x9eb8('0x2'),'update'];function createListener(_0x50bd6b,_0x4414f2){return function(_0x2da9e9){_0x4414f2[_0x9eb8('0x3')](_0x50bd6b,_0x2da9e9);};}function removeListener(_0x1200db,_0x441bcc){return function(){ChatInteractionEvents[_0x9eb8('0x4')](_0x1200db,_0x441bcc);};}exports[_0x9eb8('0x5')]=function(_0x446884){for(var _0x2857b8=0x0,_0x477aed=events[_0x9eb8('0x6')];_0x2857b8<_0x477aed;_0x2857b8++){var _0x59dce1=events[_0x2857b8];var _0x3ba059=createListener(_0x9eb8('0x7')+_0x59dce1,_0x446884);ChatInteractionEvents['on'](_0x59dce1,_0x3ba059);}}; \ No newline at end of file +var _0x44f1=['update','removeListener','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44f1,0x169));var _0x144f=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x44f1[_0xae7c2f];return _0x5d7001;};'use strict';var ChatInteractionEvents=require(_0x144f('0x0'));var events=[_0x144f('0x1'),_0x144f('0x2'),_0x144f('0x3')];function createListener(_0x15c829,_0x120634){return function(_0x24f7aa){_0x120634['emit'](_0x15c829,_0x24f7aa);};}function removeListener(_0x5651d8,_0x678a34){return function(){ChatInteractionEvents[_0x144f('0x4')](_0x5651d8,_0x678a34);};}exports['register']=function(_0x1371bb){for(var _0x2d3657=0x0,_0x32c611=events[_0x144f('0x5')];_0x2d3657<_0x32c611;_0x2d3657++){var _0x72c006=events[_0x2d3657];var _0xe0347d=createListener(_0x144f('0x6')+_0x72c006,_0x1371bb);ChatInteractionEvents['on'](_0x72c006,_0xe0347d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 8913139..7b61ea7 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 _0xee59=['attachmentUpload','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','util','path','express','Router','fs-extra','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','diskStorage','join','root','server/files/attachments/','format','originalname','single','file'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xee59,0x1de));var _0x9ee5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9ee5('0x0'));var path=require(_0x9ee5('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ee5('0x2'));var router=express[_0x9ee5('0x3')]();var fs_extra=require(_0x9ee5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ee5('0x5'));var controller=require(_0x9ee5('0x6'));router['get']('/',auth[_0x9ee5('0x7')](),controller[_0x9ee5('0x8')]);router['get'](_0x9ee5('0x9'),auth['isAuthenticated'](),controller[_0x9ee5('0xa')]);router[_0x9ee5('0xb')](_0x9ee5('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x9ee5('0xd')]);router['get'](_0x9ee5('0xe'),auth[_0x9ee5('0xf')](),controller[_0x9ee5('0x10')]);router['get'](_0x9ee5('0x11'),auth['isAuthenticated'](),controller[_0x9ee5('0x12')]);router[_0x9ee5('0xb')](_0x9ee5('0x13'),auth[_0x9ee5('0xf')](),controller[_0x9ee5('0x14')]);router[_0x9ee5('0xb')]('/:id/download',auth[_0x9ee5('0x7')](),controller[_0x9ee5('0x15')]);router[_0x9ee5('0x16')]('/',auth[_0x9ee5('0x7')](),controller[_0x9ee5('0x17')]);router['post']('/:id/vidaoo',auth[_0x9ee5('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x9ee5('0x18')]({'destination':function(_0x473a68,_0x431f7b,_0x3035b2){_0x3035b2(null,path[_0x9ee5('0x19')](config[_0x9ee5('0x1a')],_0x9ee5('0x1b')));},'filename':function(_0x3f6c00,_0x380d41,_0x8f4423){_0x8f4423(null,util[_0x9ee5('0x1c')]('%s-%s',Date['now'](),_0x380d41[_0x9ee5('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9ee5('0x16')]('/:id/attachment_upload',upload[_0x9ee5('0x1e')](_0x9ee5('0x1f')),controller[_0x9ee5('0x20')]);router[_0x9ee5('0x16')](_0x9ee5('0x11'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x9ee5('0x21')](_0x9ee5('0x22'),_0x9ee5('0x23')),controller[_0x9ee5('0x24')]);router[_0x9ee5('0x25')](_0x9ee5('0xc'),auth[_0x9ee5('0x7')](),interaction[_0x9ee5('0x21')](_0x9ee5('0x22'),_0x9ee5('0x26')),controller[_0x9ee5('0x27')]);router['put'](_0x9ee5('0x28'),controller[_0x9ee5('0x29')]);router['put']('/:id/abandon',auth[_0x9ee5('0xf')](),controller[_0x9ee5('0x2a')]);router[_0x9ee5('0x25')](_0x9ee5('0x2b'),controller[_0x9ee5('0x2c')]);router['delete'](_0x9ee5('0xc'),auth[_0x9ee5('0x7')](),interaction[_0x9ee5('0x21')](_0x9ee5('0x22'),_0x9ee5('0x2d')),controller[_0x9ee5('0x2e')]);router[_0x9ee5('0x2f')](_0x9ee5('0x30'),auth[_0x9ee5('0x7')](),controller[_0x9ee5('0x31')]);module[_0x9ee5('0x32')]=router; \ No newline at end of file +var _0x3b6d=['destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','getMessages','/:id/my_messages','/:id/download','download','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','attachmentUpload','post','/:id/messages','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x3b6d,0x1b3));var _0xd3b6=function(_0x224d0d,_0x5b8646){_0x224d0d=_0x224d0d-0x0;var _0x364fa4=_0x3b6d[_0x224d0d];return _0x364fa4;};'use strict';var multer=require(_0xd3b6('0x0'));var util=require(_0xd3b6('0x1'));var path=require(_0xd3b6('0x2'));var timeout=require('connect-timeout');var express=require(_0xd3b6('0x3'));var router=express[_0xd3b6('0x4')]();var fs_extra=require(_0xd3b6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd3b6('0x6'));var config=require(_0xd3b6('0x7'));var controller=require(_0xd3b6('0x8'));router['get']('/',auth[_0xd3b6('0x9')](),controller[_0xd3b6('0xa')]);router[_0xd3b6('0xb')](_0xd3b6('0xc'),auth[_0xd3b6('0x9')](),controller[_0xd3b6('0xd')]);router[_0xd3b6('0xb')](_0xd3b6('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xd3b6('0xf')]);router[_0xd3b6('0xb')](_0xd3b6('0x10'),auth[_0xd3b6('0x11')](),controller['attachmentDownload']);router[_0xd3b6('0xb')]('/:id/messages',auth[_0xd3b6('0x9')](),controller[_0xd3b6('0x12')]);router['get'](_0xd3b6('0x13'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0xd3b6('0xb')](_0xd3b6('0x14'),auth[_0xd3b6('0x9')](),controller[_0xd3b6('0x15')]);router['post']('/',auth[_0xd3b6('0x9')](),controller[_0xd3b6('0x16')]);router['post'](_0xd3b6('0x17'),auth[_0xd3b6('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xd3b6('0x18')]({'destination':function(_0x5be2ab,_0x2708a5,_0x2dd603){_0x2dd603(null,path[_0xd3b6('0x19')](config[_0xd3b6('0x1a')],_0xd3b6('0x1b')));},'filename':function(_0x4fa2ef,_0x29856b,_0x29ca4a){_0x29ca4a(null,util[_0xd3b6('0x1c')](_0xd3b6('0x1d'),Date[_0xd3b6('0x1e')](),_0x29856b[_0xd3b6('0x1f')][_0xd3b6('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xd3b6('0x21')]('file'),controller[_0xd3b6('0x22')]);router[_0xd3b6('0x23')](_0xd3b6('0x24'),auth[_0xd3b6('0x11')](),controller['addMessage']);router[_0xd3b6('0x23')](_0xd3b6('0x25'),auth[_0xd3b6('0x9')](),interaction[_0xd3b6('0x26')](_0xd3b6('0x27'),_0xd3b6('0x28')),controller[_0xd3b6('0x29')]);router[_0xd3b6('0x2a')](_0xd3b6('0xe'),auth[_0xd3b6('0x9')](),interaction[_0xd3b6('0x26')](_0xd3b6('0x27'),_0xd3b6('0x2b')),controller[_0xd3b6('0x2c')]);router[_0xd3b6('0x2a')](_0xd3b6('0x2d'),controller[_0xd3b6('0x2e')]);router[_0xd3b6('0x2a')](_0xd3b6('0x2f'),auth[_0xd3b6('0x11')](),controller[_0xd3b6('0x30')]);router[_0xd3b6('0x2a')]('/:id/close',controller[_0xd3b6('0x31')]);router[_0xd3b6('0x32')](_0xd3b6('0xe'),auth[_0xd3b6('0x9')](),interaction[_0xd3b6('0x26')](_0xd3b6('0x27'),'chatinteraction:destroy'),controller[_0xd3b6('0x33')]);router[_0xd3b6('0x32')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd3b6('0x34')]);module[_0xd3b6('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 876132e..17683b8 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 _0x0621=['medium','exports'];(function(_0x37ef22,_0x348c92){var _0x49eeb3=function(_0x1ef837){while(--_0x1ef837){_0x37ef22['push'](_0x37ef22['shift']());}};_0x49eeb3(++_0x348c92);}(_0x0621,0x1f1));var _0x1062=function(_0x2b64ea,_0x496f37){_0x2b64ea=_0x2b64ea-0x0;var _0x275124=_0x0621[_0x2b64ea];return _0x275124;};'use strict';var Sequelize=require('sequelize');module[_0x1062('0x0')]={'body':{'type':Sequelize['TEXT'](_0x1062('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x408a=['INTEGER','sequelize','exports','TEXT','BOOLEAN'];(function(_0x14ddbc,_0x278ed4){var _0x49a1d0=function(_0x5743aa){while(--_0x5743aa){_0x14ddbc['push'](_0x14ddbc['shift']());}};_0x49a1d0(++_0x278ed4);}(_0x408a,0x11e));var _0xa408=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x408a[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xa408('0x0'));module[_0xa408('0x1')]={'body':{'type':Sequelize[_0xa408('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa408('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa408('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index c0eb5cd..e7ff8e1 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 _0xc373=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','isEmpty','agent','resourceId','push','createdAt','ToId','-createdAt','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','undefined','count','offset','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','limit','order'];(function(_0x1b60b7,_0x5f443c){var _0x4465fb=function(_0x26cb47){while(--_0x26cb47){_0x1b60b7['push'](_0x1b60b7['shift']());}};_0x4465fb(++_0x5f443c);}(_0xc373,0x10a));var _0x3c37=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0xc373[_0x265aa2];return _0x447a3a;};'use strict';var emlformat=require(_0x3c37('0x0'));var rimraf=require(_0x3c37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3c37('0x2'));var moment=require(_0x3c37('0x3'));var BPromise=require(_0x3c37('0x4'));var Mustache=require(_0x3c37('0x5'));var util=require(_0x3c37('0x6'));var path=require(_0x3c37('0x7'));var sox=require('sox');var csv=require(_0x3c37('0x8'));var ejs=require(_0x3c37('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c37('0xa'));var squel=require('squel');var crypto=require(_0x3c37('0xb'));var jsforce=require(_0x3c37('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c37('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c37('0xd'));var authService=require(_0x3c37('0xe'));var qs=require(_0x3c37('0xf'));var as=require(_0x3c37('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3c37('0x11'));var utils=require(_0x3c37('0x12'));var config=require(_0x3c37('0x13'));var licenseUtil=require(_0x3c37('0x14'));var db=require(_0x3c37('0x15'))['db'];config['redis']=_[_0x3c37('0x16')](config['redis'],{'host':_0x3c37('0x17'),'port':0x18eb});var socket=require(_0x3c37('0x18'))(new Redis(config['redis']));require(_0x3c37('0x19'))['register'](socket);function respondWithStatusCode(_0x5c886b,_0x18efb1){_0x18efb1=_0x18efb1||0xcc;return function(_0x274ddb){if(_0x274ddb){return _0x5c886b[_0x3c37('0x1a')](_0x18efb1);}return _0x5c886b[_0x3c37('0x1b')](_0x18efb1)[_0x3c37('0x1c')]();};}function respondWithResult(_0xd8b73f,_0x57a8d6){_0x57a8d6=_0x57a8d6||0xc8;return function(_0x31363e){if(_0x31363e){return _0xd8b73f[_0x3c37('0x1b')](_0x57a8d6)[_0x3c37('0x1d')](_0x31363e);}};}function respondWithFilteredResult(_0x3a1763,_0x14fda7){return function(_0x59406b){if(_0x59406b){var _0x345720=typeof _0x14fda7['offset']===_0x3c37('0x1e')&&typeof _0x14fda7['limit']===_0x3c37('0x1e');var _0x2bf9d1=_0x59406b[_0x3c37('0x1f')];var _0x54d9e8=_0x345720?0x0:_0x14fda7['offset'];var _0x3abb02=_0x345720?_0x59406b['count']:_0x14fda7[_0x3c37('0x20')]+_0x14fda7['limit'];var _0x52a5fc;if(_0x3abb02>=_0x2bf9d1){_0x3abb02=_0x2bf9d1;_0x52a5fc=0xc8;}else{_0x52a5fc=0xce;}_0x3a1763['status'](_0x52a5fc);return _0x3a1763['set'](_0x3c37('0x21'),_0x54d9e8+'-'+_0x3abb02+'/'+_0x2bf9d1)[_0x3c37('0x1d')](_0x59406b);}return null;};}function patchUpdates(_0x48ad00){return function(_0x55f674){try{jsonpatch['apply'](_0x55f674,_0x48ad00,!![]);}catch(_0x526cb4){return BPromise['reject'](_0x526cb4);}return _0x55f674[_0x3c37('0x22')]();};}function saveUpdates(_0x1f4c34,_0x5da888){return function(_0x1c4470){if(_0x1c4470){return _0x1c4470[_0x3c37('0x23')](_0x1f4c34)['then'](function(_0x5adbd1){return _0x5adbd1;});}return null;};}function removeEntity(_0x56e6bf,_0x4c5bf2){return function(_0x3cb279){if(_0x3cb279){return _0x3cb279[_0x3c37('0x24')]()[_0x3c37('0x25')](function(){_0x56e6bf[_0x3c37('0x1b')](0xcc)[_0x3c37('0x1c')]();});}};}function handleEntityNotFound(_0x1f98b9,_0x249aa4){return function(_0x5d6fcc){if(!_0x5d6fcc){_0x1f98b9[_0x3c37('0x1a')](0x194);}return _0x5d6fcc;};}function handleError(_0x3a8417,_0x2707d1){_0x2707d1=_0x2707d1||0x1f4;return function(_0x2c9c61){logger[_0x3c37('0x26')](_0x2c9c61[_0x3c37('0x27')]);if(_0x2c9c61['name']){delete _0x2c9c61[_0x3c37('0x28')];}_0x3a8417[_0x3c37('0x1b')](_0x2707d1)[_0x3c37('0x29')](_0x2c9c61);};}exports[_0x3c37('0x2a')]=function(_0x395322,_0x458c10){var _0x3ce032={},_0x4ce480={},_0x32add0={'count':0x0,'rows':[]};var _0xb3065c=_[_0x3c37('0x2b')](db[_0x3c37('0x2c')]['rawAttributes'],function(_0x42b222){return{'name':_0x42b222[_0x3c37('0x2d')],'type':_0x42b222[_0x3c37('0x2e')][_0x3c37('0x2f')]};});_0x4ce480['model']=_['map'](_0xb3065c,_0x3c37('0x28'));_0x4ce480[_0x3c37('0x30')]=_['keys'](_0x395322['query']);_0x4ce480[_0x3c37('0x31')]=_[_0x3c37('0x32')](_0x4ce480['model'],_0x4ce480[_0x3c37('0x30')]);_0x3ce032[_0x3c37('0x33')]=_[_0x3c37('0x32')](_0x4ce480[_0x3c37('0x34')],qs[_0x3c37('0x35')](_0x395322[_0x3c37('0x30')]['fields']));_0x3ce032[_0x3c37('0x33')]=_0x3ce032['attributes'][_0x3c37('0x36')]?_0x3ce032[_0x3c37('0x33')]:_0x4ce480[_0x3c37('0x34')];if(!_0x395322[_0x3c37('0x30')]['hasOwnProperty'](_0x3c37('0x37'))){_0x3ce032[_0x3c37('0x38')]=qs[_0x3c37('0x38')](_0x395322['query'][_0x3c37('0x38')]);_0x3ce032['offset']=qs[_0x3c37('0x20')](_0x395322[_0x3c37('0x30')][_0x3c37('0x20')]);}_0x3ce032[_0x3c37('0x39')]=qs['sort'](_0x395322[_0x3c37('0x30')][_0x3c37('0x3a')]);_0x3ce032[_0x3c37('0x3b')]=qs[_0x3c37('0x31')](_[_0x3c37('0x3c')](_0x395322[_0x3c37('0x30')],_0x4ce480[_0x3c37('0x31')]),_0xb3065c);if(_0x395322['query'][_0x3c37('0x3d')]){_0x3ce032[_0x3c37('0x3b')]=_[_0x3c37('0x3e')](_0x3ce032[_0x3c37('0x3b')],{'$or':_[_0x3c37('0x2b')](_0xb3065c,function(_0x562987){if(_0x562987[_0x3c37('0x2e')]!==_0x3c37('0x3f')){var _0x1c5185={};_0x1c5185[_0x562987[_0x3c37('0x28')]]={'$like':'%'+_0x395322[_0x3c37('0x30')][_0x3c37('0x3d')]+'%'};return _0x1c5185;}})});}_0x3ce032=_[_0x3c37('0x3e')]({},_0x3ce032,_0x395322[_0x3c37('0x40')]);var _0x78955d={'where':_0x3ce032[_0x3c37('0x3b')]};return db[_0x3c37('0x2c')][_0x3c37('0x1f')](_0x78955d)[_0x3c37('0x25')](function(_0x2c5fb3){_0x32add0['count']=_0x2c5fb3;if(_0x395322[_0x3c37('0x30')][_0x3c37('0x41')]){_0x3ce032[_0x3c37('0x42')]=[{'all':!![]}];}return db[_0x3c37('0x2c')]['findAll'](_0x3ce032);})[_0x3c37('0x25')](function(_0x47bf34){_0x32add0[_0x3c37('0x43')]=_0x47bf34;return _0x32add0;})[_0x3c37('0x25')](respondWithFilteredResult(_0x458c10,_0x3ce032))[_0x3c37('0x44')](handleError(_0x458c10,null));};exports[_0x3c37('0x45')]=function(_0xf4f45c,_0x9dcbd0){var _0x306619={'raw':!![],'where':{'id':_0xf4f45c[_0x3c37('0x46')]['id']}},_0x11d785={};_0x11d785[_0x3c37('0x34')]=_[_0x3c37('0x47')](db[_0x3c37('0x2c')][_0x3c37('0x48')]);_0x11d785[_0x3c37('0x30')]=_[_0x3c37('0x47')](_0xf4f45c[_0x3c37('0x30')]);_0x11d785[_0x3c37('0x31')]=_[_0x3c37('0x32')](_0x11d785[_0x3c37('0x34')],_0x11d785[_0x3c37('0x30')]);_0x306619['attributes']=_[_0x3c37('0x32')](_0x11d785[_0x3c37('0x34')],qs[_0x3c37('0x35')](_0xf4f45c[_0x3c37('0x30')][_0x3c37('0x35')]));_0x306619[_0x3c37('0x33')]=_0x306619[_0x3c37('0x33')][_0x3c37('0x36')]?_0x306619[_0x3c37('0x33')]:_0x11d785[_0x3c37('0x34')];if(_0xf4f45c[_0x3c37('0x30')][_0x3c37('0x41')]){_0x306619[_0x3c37('0x42')]=[{'all':!![]}];}_0x306619=_[_0x3c37('0x3e')]({},_0x306619,_0xf4f45c['options']);return db['ChatInternalMessage'][_0x3c37('0x49')](_0x306619)['then'](handleEntityNotFound(_0x9dcbd0,null))[_0x3c37('0x25')](respondWithResult(_0x9dcbd0,null))['catch'](handleError(_0x9dcbd0,null));};exports['create']=function(_0x512187,_0x1a886f){return db['ChatInternalMessage'][_0x3c37('0x4a')](_0x512187['body'],{})[_0x3c37('0x25')](respondWithResult(_0x1a886f,0xc9))['catch'](handleError(_0x1a886f,null));};exports[_0x3c37('0x23')]=function(_0x55c906,_0x6a4a50){if(_0x55c906[_0x3c37('0x4b')]['id']){delete _0x55c906[_0x3c37('0x4b')]['id'];}return db[_0x3c37('0x2c')][_0x3c37('0x49')]({'where':{'id':_0x55c906['params']['id']}})[_0x3c37('0x25')](handleEntityNotFound(_0x6a4a50,null))[_0x3c37('0x25')](saveUpdates(_0x55c906[_0x3c37('0x4b')],null))[_0x3c37('0x25')](respondWithResult(_0x6a4a50,null))[_0x3c37('0x44')](handleError(_0x6a4a50,null));};exports['destroy']=function(_0x436884,_0x12bb71){return db[_0x3c37('0x2c')][_0x3c37('0x49')]({'where':{'id':_0x436884['params']['id']}})[_0x3c37('0x25')](handleEntityNotFound(_0x12bb71,null))['then'](removeEntity(_0x12bb71,null))[_0x3c37('0x44')](handleError(_0x12bb71,null));};exports[_0x3c37('0x4c')]=function(_0x2c0a2e,_0x1a01dc){return db[_0x3c37('0x2c')][_0x3c37('0x4c')]()[_0x3c37('0x25')](respondWithResult(_0x1a01dc,null))[_0x3c37('0x44')](handleError(_0x1a01dc,null));};function wrapUser(_0x2b6e1a){return function(_0x3d8b0c){var _0x2a9059=_0x2b6e1a[_0x3c37('0x4d')]({'plain':!![]});_0x2a9059[_0x3c37('0x4e')]=[];if(_0x3d8b0c){_0x2a9059[_0x3c37('0x4f')]=_0x3d8b0c['createdAt'];_0x2a9059[_0x3c37('0x50')]=_0x3d8b0c;}else{_0x2a9059[_0x3c37('0x4f')]=moment(0x0)[_0x3c37('0x51')](_0x3c37('0x52'));_0x2a9059[_0x3c37('0x50')]={};}return _0x2a9059;};}exports[_0x3c37('0x53')]=function(_0x52862c,_0x392e42,_0x14ad01){var _0x36afb1=[];return db[_0x3c37('0x54')][_0x3c37('0x55')]({'where':{'role':['agent','admin',_0x3c37('0x56')]},'attributes':['id',_0x3c37('0x57'),_0x3c37('0x28'),_0x3c37('0x58'),_0x3c37('0x59'),'internal',_0x3c37('0x5a'),_0x3c37('0x5b'),_0x3c37('0x5c'),_0x3c37('0x5d')],'order':qs[_0x3c37('0x3a')](_0x3c37('0x5e')),'include':[{'model':db[_0x3c37('0x5f')],'as':_0x3c37('0x60'),'attributes':['id','name',_0x3c37('0x2e')],'through':{'attributes':[]}}]})[_0x3c37('0x25')](function(_0x2443d3){if(_0x2443d3){var _0x50bafc=_0x52862c['user'][_0x3c37('0x4d')]({'plain':!![]});if(!_0x50bafc)throw new Error(_0x3c37('0x61'));if(_0x50bafc['role']===_0x3c37('0x56')){return db[_0x3c37('0x62')][_0x3c37('0x49')]({'where':{'name':_0x3c37('0x63'),'userProfileId':_0x50bafc['userProfileId']},'raw':!![]})['then'](function(_0x54f3d0){if(_0x54f3d0){if(_0x54f3d0[_0x3c37('0x64')]===0x0){return db['UserProfileResource'][_0x3c37('0x55')]({'where':{'sectionId':_0x54f3d0['id']},'raw':!![]})['then'](function(_0xb9be73){var _0x345d35=[];if(_[_0x3c37('0x65')](_0xb9be73)){_0x345d35=_[_0x3c37('0x3d')](_0x2443d3,function(_0x8da64a){if(_0x8da64a[_0x3c37('0x58')]!=='agent'){return _0x8da64a;}});return _0x345d35;}else{for(var _0x33bb87=0x0;_0x33bb87<_0x2443d3[_0x3c37('0x36')];_0x33bb87++){var _0x1ec098=_0x2443d3[_0x33bb87];if(_0x1ec098[_0x3c37('0x58')]===_0x3c37('0x66')){var _0x59f5ac=_['find'](_0xb9be73,function(_0x1201e4){return _0x1201e4[_0x3c37('0x67')]===_0x1ec098['id'];});if(_0x59f5ac)_0x345d35[_0x3c37('0x68')](_0x1ec098);}else{_0x345d35['push'](_0x1ec098);}}return _0x345d35;}});}else{return _0x2443d3;}}else{var _0x3b9b89=_[_0x3c37('0x3d')](_0x2443d3,function(_0x446fb1){if(_0x446fb1[_0x3c37('0x58')]!==_0x3c37('0x66')){return _0x446fb1;}});return _0x3b9b89;}});}else{return _0x2443d3;}}})[_0x3c37('0x25')](function(_0x54e2be){var _0x4c4466=[];if(_0x54e2be){_0x36afb1=_0x54e2be;for(var _0x512e0d=0x0;_0x512e0d<_0x54e2be[_0x3c37('0x36')];_0x512e0d+=0x1){_0x36afb1[_0x512e0d][_0x3c37('0x4e')]=[];_0x4c4466[_0x3c37('0x68')](db[_0x3c37('0x2c')][_0x3c37('0x49')]({'where':{'FromId':[_0x52862c[_0x3c37('0x56')]['id'],_0x54e2be[_0x512e0d]['id']],'ToId':[_0x52862c[_0x3c37('0x56')]['id'],_0x54e2be[_0x512e0d]['id']],'ChatGroupId':null},'attributes':['id',_0x3c37('0x69'),'FromId',_0x3c37('0x6a'),'read','body'],'order':qs[_0x3c37('0x3a')](_0x3c37('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3c37('0x25')](wrapUser(_0x54e2be[_0x512e0d])));}return BPromise['all'](_0x4c4466);}return[];})[_0x3c37('0x25')](function(_0x16d8a0){return{'rows':_0x16d8a0,'count':_0x16d8a0[_0x3c37('0x36')]};})['then'](respondWithResult(_0x392e42,null))[_0x3c37('0x44')](handleError(_0x392e42,null));}; \ No newline at end of file +var _0x8eb7=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','offset','undefined','limit','apply','reject','save','then','destroy','name','send','index','ChatInternalMessage','rawAttributes','fieldName','key','model','map','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','findAll','rows','catch','show','include','create','body','update','find','params','describe','get','messages','lastMessageAt','lastMessage','format','getUsers','agent','admin','fullname','role','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','createdAt','ToId','read','-createdAt','all','rimraf'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x8eb7,0x143));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78eb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x78eb('0x1'));var rp=require(_0x78eb('0x2'));var moment=require(_0x78eb('0x3'));var BPromise=require(_0x78eb('0x4'));var Mustache=require(_0x78eb('0x5'));var util=require(_0x78eb('0x6'));var path=require(_0x78eb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x78eb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x78eb('0x9'));var squel=require('squel');var crypto=require(_0x78eb('0xa'));var jsforce=require(_0x78eb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x78eb('0xc'));var querystring=require('querystring');var Papa=require(_0x78eb('0xd'));var Redis=require(_0x78eb('0xe'));var authService=require(_0x78eb('0xf'));var qs=require(_0x78eb('0x10'));var as=require(_0x78eb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78eb('0x12'))(_0x78eb('0x13'));var utils=require(_0x78eb('0x14'));var config=require(_0x78eb('0x15'));var licenseUtil=require(_0x78eb('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x78eb('0x17')](config[_0x78eb('0x18')],{'host':_0x78eb('0x19'),'port':0x18eb});var socket=require(_0x78eb('0x1a'))(new Redis(config['redis']));require(_0x78eb('0x1b'))[_0x78eb('0x1c')](socket);function respondWithStatusCode(_0x4df912,_0x1c6231){_0x1c6231=_0x1c6231||0xcc;return function(_0x448872){if(_0x448872){return _0x4df912['sendStatus'](_0x1c6231);}return _0x4df912[_0x78eb('0x1d')](_0x1c6231)[_0x78eb('0x1e')]();};}function respondWithResult(_0x31599f,_0x156dcf){_0x156dcf=_0x156dcf||0xc8;return function(_0x58e05e){if(_0x58e05e){return _0x31599f[_0x78eb('0x1d')](_0x156dcf)[_0x78eb('0x1f')](_0x58e05e);}};}function respondWithFilteredResult(_0x5b6ef1,_0xaf273c){return function(_0x1435ee){if(_0x1435ee){var _0xd1c3e9=typeof _0xaf273c[_0x78eb('0x20')]==='undefined'&&typeof _0xaf273c['limit']===_0x78eb('0x21');var _0x2806e4=_0x1435ee['count'];var _0x5602f2=_0xd1c3e9?0x0:_0xaf273c[_0x78eb('0x20')];var _0x5f203c=_0xd1c3e9?_0x1435ee['count']:_0xaf273c[_0x78eb('0x20')]+_0xaf273c[_0x78eb('0x22')];var _0x141282;if(_0x5f203c>=_0x2806e4){_0x5f203c=_0x2806e4;_0x141282=0xc8;}else{_0x141282=0xce;}_0x5b6ef1[_0x78eb('0x1d')](_0x141282);return _0x5b6ef1['set']('Content-Range',_0x5602f2+'-'+_0x5f203c+'/'+_0x2806e4)['json'](_0x1435ee);}return null;};}function patchUpdates(_0x46296e){return function(_0x121691){try{jsonpatch[_0x78eb('0x23')](_0x121691,_0x46296e,!![]);}catch(_0x1de758){return BPromise[_0x78eb('0x24')](_0x1de758);}return _0x121691[_0x78eb('0x25')]();};}function saveUpdates(_0x484da3,_0x4181f7){return function(_0xaaaef7){if(_0xaaaef7){return _0xaaaef7['update'](_0x484da3)[_0x78eb('0x26')](function(_0x37a2cf){return _0x37a2cf;});}return null;};}function removeEntity(_0x4bded3,_0x1ce974){return function(_0x24def9){if(_0x24def9){return _0x24def9[_0x78eb('0x27')]()[_0x78eb('0x26')](function(){_0x4bded3[_0x78eb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45beb5,_0x1eaa6c){return function(_0x573232){if(!_0x573232){_0x45beb5['sendStatus'](0x194);}return _0x573232;};}function handleError(_0x3cbed9,_0x4cdec8){_0x4cdec8=_0x4cdec8||0x1f4;return function(_0x4761c6){logger['error'](_0x4761c6['stack']);if(_0x4761c6[_0x78eb('0x28')]){delete _0x4761c6[_0x78eb('0x28')];}_0x3cbed9[_0x78eb('0x1d')](_0x4cdec8)[_0x78eb('0x29')](_0x4761c6);};}exports[_0x78eb('0x2a')]=function(_0x5b41cd,_0x5ceef0){var _0x5e9b9c={},_0x2a6f24={},_0x5e9f6b={'count':0x0,'rows':[]};var _0x501c53=_['map'](db[_0x78eb('0x2b')][_0x78eb('0x2c')],function(_0x4a5574){return{'name':_0x4a5574[_0x78eb('0x2d')],'type':_0x4a5574['type'][_0x78eb('0x2e')]};});_0x2a6f24[_0x78eb('0x2f')]=_[_0x78eb('0x30')](_0x501c53,_0x78eb('0x28'));_0x2a6f24['query']=_[_0x78eb('0x31')](_0x5b41cd['query']);_0x2a6f24['filters']=_[_0x78eb('0x32')](_0x2a6f24[_0x78eb('0x2f')],_0x2a6f24['query']);_0x5e9b9c[_0x78eb('0x33')]=_[_0x78eb('0x32')](_0x2a6f24[_0x78eb('0x2f')],qs[_0x78eb('0x34')](_0x5b41cd[_0x78eb('0x35')]['fields']));_0x5e9b9c[_0x78eb('0x33')]=_0x5e9b9c[_0x78eb('0x33')][_0x78eb('0x36')]?_0x5e9b9c[_0x78eb('0x33')]:_0x2a6f24[_0x78eb('0x2f')];if(!_0x5b41cd['query'][_0x78eb('0x37')](_0x78eb('0x38'))){_0x5e9b9c[_0x78eb('0x22')]=qs[_0x78eb('0x22')](_0x5b41cd[_0x78eb('0x35')]['limit']);_0x5e9b9c[_0x78eb('0x20')]=qs[_0x78eb('0x20')](_0x5b41cd[_0x78eb('0x35')][_0x78eb('0x20')]);}_0x5e9b9c[_0x78eb('0x39')]=qs[_0x78eb('0x3a')](_0x5b41cd[_0x78eb('0x35')][_0x78eb('0x3a')]);_0x5e9b9c[_0x78eb('0x3b')]=qs[_0x78eb('0x3c')](_['pick'](_0x5b41cd[_0x78eb('0x35')],_0x2a6f24[_0x78eb('0x3c')]),_0x501c53);if(_0x5b41cd[_0x78eb('0x35')][_0x78eb('0x3d')]){_0x5e9b9c[_0x78eb('0x3b')]=_[_0x78eb('0x3e')](_0x5e9b9c[_0x78eb('0x3b')],{'$or':_[_0x78eb('0x30')](_0x501c53,function(_0x3edab2){if(_0x3edab2[_0x78eb('0x3f')]!==_0x78eb('0x40')){var _0x513302={};_0x513302[_0x3edab2[_0x78eb('0x28')]]={'$like':'%'+_0x5b41cd['query']['filter']+'%'};return _0x513302;}})});}_0x5e9b9c=_[_0x78eb('0x3e')]({},_0x5e9b9c,_0x5b41cd[_0x78eb('0x41')]);var _0x539765={'where':_0x5e9b9c[_0x78eb('0x3b')]};return db[_0x78eb('0x2b')]['count'](_0x539765)['then'](function(_0x4501b5){_0x5e9f6b[_0x78eb('0x42')]=_0x4501b5;if(_0x5b41cd['query']['includeAll']){_0x5e9b9c['include']=[{'all':!![]}];}return db[_0x78eb('0x2b')][_0x78eb('0x43')](_0x5e9b9c);})[_0x78eb('0x26')](function(_0x3fb18b){_0x5e9f6b[_0x78eb('0x44')]=_0x3fb18b;return _0x5e9f6b;})[_0x78eb('0x26')](respondWithFilteredResult(_0x5ceef0,_0x5e9b9c))[_0x78eb('0x45')](handleError(_0x5ceef0,null));};exports[_0x78eb('0x46')]=function(_0x51effb,_0xa1eb82){var _0x4f6573={'raw':!![],'where':{'id':_0x51effb['params']['id']}},_0x2b3a68={};_0x2b3a68[_0x78eb('0x2f')]=_[_0x78eb('0x31')](db['ChatInternalMessage'][_0x78eb('0x2c')]);_0x2b3a68[_0x78eb('0x35')]=_['keys'](_0x51effb['query']);_0x2b3a68[_0x78eb('0x3c')]=_[_0x78eb('0x32')](_0x2b3a68['model'],_0x2b3a68['query']);_0x4f6573['attributes']=_[_0x78eb('0x32')](_0x2b3a68[_0x78eb('0x2f')],qs['fields'](_0x51effb['query']['fields']));_0x4f6573[_0x78eb('0x33')]=_0x4f6573[_0x78eb('0x33')]['length']?_0x4f6573[_0x78eb('0x33')]:_0x2b3a68[_0x78eb('0x2f')];if(_0x51effb[_0x78eb('0x35')]['includeAll']){_0x4f6573[_0x78eb('0x47')]=[{'all':!![]}];}_0x4f6573=_[_0x78eb('0x3e')]({},_0x4f6573,_0x51effb[_0x78eb('0x41')]);return db['ChatInternalMessage']['find'](_0x4f6573)[_0x78eb('0x26')](handleEntityNotFound(_0xa1eb82,null))[_0x78eb('0x26')](respondWithResult(_0xa1eb82,null))[_0x78eb('0x45')](handleError(_0xa1eb82,null));};exports[_0x78eb('0x48')]=function(_0x41cdf8,_0x3d24b0){return db[_0x78eb('0x2b')][_0x78eb('0x48')](_0x41cdf8[_0x78eb('0x49')],{})[_0x78eb('0x26')](respondWithResult(_0x3d24b0,0xc9))[_0x78eb('0x45')](handleError(_0x3d24b0,null));};exports[_0x78eb('0x4a')]=function(_0x2f6305,_0x4484f4){if(_0x2f6305[_0x78eb('0x49')]['id']){delete _0x2f6305[_0x78eb('0x49')]['id'];}return db[_0x78eb('0x2b')][_0x78eb('0x4b')]({'where':{'id':_0x2f6305[_0x78eb('0x4c')]['id']}})[_0x78eb('0x26')](handleEntityNotFound(_0x4484f4,null))['then'](saveUpdates(_0x2f6305[_0x78eb('0x49')],null))['then'](respondWithResult(_0x4484f4,null))[_0x78eb('0x45')](handleError(_0x4484f4,null));};exports[_0x78eb('0x27')]=function(_0x586a49,_0x4d6828){return db[_0x78eb('0x2b')][_0x78eb('0x4b')]({'where':{'id':_0x586a49[_0x78eb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d6828,null))[_0x78eb('0x26')](removeEntity(_0x4d6828,null))[_0x78eb('0x45')](handleError(_0x4d6828,null));};exports[_0x78eb('0x4d')]=function(_0xa8bb98,_0x5875f8){return db[_0x78eb('0x2b')][_0x78eb('0x4d')]()[_0x78eb('0x26')](respondWithResult(_0x5875f8,null))[_0x78eb('0x45')](handleError(_0x5875f8,null));};function wrapUser(_0x265749){return function(_0x3eacce){var _0x36868c=_0x265749[_0x78eb('0x4e')]({'plain':!![]});_0x36868c[_0x78eb('0x4f')]=[];if(_0x3eacce){_0x36868c[_0x78eb('0x50')]=_0x3eacce['createdAt'];_0x36868c[_0x78eb('0x51')]=_0x3eacce;}else{_0x36868c[_0x78eb('0x50')]=moment(0x0)[_0x78eb('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x36868c[_0x78eb('0x51')]={};}return _0x36868c;};}exports[_0x78eb('0x53')]=function(_0x579625,_0x39a2cb,_0x23f863){var _0x32c3f5=[];return db['User'][_0x78eb('0x43')]({'where':{'role':[_0x78eb('0x54'),_0x78eb('0x55'),'user']},'attributes':['id',_0x78eb('0x56'),'name',_0x78eb('0x57'),'userpic',_0x78eb('0x58'),_0x78eb('0x59'),'lastLoginAt',_0x78eb('0x5a'),_0x78eb('0x5b')],'order':qs[_0x78eb('0x3a')](_0x78eb('0x5c')),'include':[{'model':db[_0x78eb('0x5d')],'as':'VoiceQueues','attributes':['id',_0x78eb('0x28'),'type'],'through':{'attributes':[]}}]})[_0x78eb('0x26')](function(_0x442060){if(_0x442060){var _0x3211a0=_0x579625[_0x78eb('0x5e')]['get']({'plain':!![]});if(!_0x3211a0)throw new Error(_0x78eb('0x5f'));if(_0x3211a0['role']===_0x78eb('0x5e')){return db[_0x78eb('0x60')][_0x78eb('0x4b')]({'where':{'name':_0x78eb('0x61'),'userProfileId':_0x3211a0[_0x78eb('0x62')]},'raw':!![]})[_0x78eb('0x26')](function(_0x25de74){if(_0x25de74){if(_0x25de74['autoAssociation']===0x0){return db[_0x78eb('0x63')]['findAll']({'where':{'sectionId':_0x25de74['id']},'raw':!![]})[_0x78eb('0x26')](function(_0x1457cb){var _0x26422d=[];if(_[_0x78eb('0x64')](_0x1457cb)){_0x26422d=_[_0x78eb('0x3d')](_0x442060,function(_0x3488bc){if(_0x3488bc[_0x78eb('0x57')]!==_0x78eb('0x54')){return _0x3488bc;}});return _0x26422d;}else{for(var _0x3b030a=0x0;_0x3b030a<_0x442060[_0x78eb('0x36')];_0x3b030a++){var _0x189a19=_0x442060[_0x3b030a];if(_0x189a19[_0x78eb('0x57')]===_0x78eb('0x54')){var _0x1df0f5=_[_0x78eb('0x4b')](_0x1457cb,function(_0x4b3500){return _0x4b3500[_0x78eb('0x65')]===_0x189a19['id'];});if(_0x1df0f5)_0x26422d['push'](_0x189a19);}else{_0x26422d[_0x78eb('0x66')](_0x189a19);}}return _0x26422d;}});}else{return _0x442060;}}else{var _0x2852e5=_[_0x78eb('0x3d')](_0x442060,function(_0x2f09e5){if(_0x2f09e5[_0x78eb('0x57')]!=='agent'){return _0x2f09e5;}});return _0x2852e5;}});}else{return _0x442060;}}})[_0x78eb('0x26')](function(_0x64243){var _0xb6a331=[];if(_0x64243){_0x32c3f5=_0x64243;for(var _0x2c8fde=0x0;_0x2c8fde<_0x64243[_0x78eb('0x36')];_0x2c8fde+=0x1){_0x32c3f5[_0x2c8fde][_0x78eb('0x4f')]=[];_0xb6a331['push'](db[_0x78eb('0x2b')][_0x78eb('0x4b')]({'where':{'FromId':[_0x579625[_0x78eb('0x5e')]['id'],_0x64243[_0x2c8fde]['id']],'ToId':[_0x579625[_0x78eb('0x5e')]['id'],_0x64243[_0x2c8fde]['id']],'ChatGroupId':null},'attributes':['id',_0x78eb('0x67'),'FromId',_0x78eb('0x68'),_0x78eb('0x69'),_0x78eb('0x49')],'order':qs['sort'](_0x78eb('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x78eb('0x26')](wrapUser(_0x64243[_0x2c8fde])));}return BPromise[_0x78eb('0x6b')](_0xb6a331);}return[];})[_0x78eb('0x26')](function(_0x25eaa6){return{'rows':_0x25eaa6,'count':_0x25eaa6[_0x78eb('0x36')]};})[_0x78eb('0x26')](respondWithResult(_0x39a2cb,null))[_0x78eb('0x45')](handleError(_0x39a2cb,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 9a56972..cb1f8a8 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 _0x6456=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x564208,_0xc63d5a){var _0x4e379d=function(_0x313cc5){while(--_0x313cc5){_0x564208['push'](_0x564208['shift']());}};_0x4e379d(++_0xc63d5a);}(_0x6456,0x15c));var _0x6645=function(_0x2d1406,_0x8a575e){_0x2d1406=_0x2d1406-0x0;var _0x31a9fb=_0x6456[_0x2d1406];return _0x31a9fb;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x6645('0x0'))['db'][_0x6645('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6645('0x2')](0x0);var events={'afterCreate':_0x6645('0x3'),'afterUpdate':_0x6645('0x4'),'afterDestroy':_0x6645('0x5')};function emitEvent(_0x4d40c1){return function(_0x48f59d,_0x4ae5e0,_0x54ebac){ChatInternalMessageEvents[_0x6645('0x6')](_0x4d40c1+':'+_0x48f59d['id'],_0x48f59d);ChatInternalMessageEvents['emit'](_0x4d40c1,_0x48f59d);_0x54ebac(null);};}for(var e in events){if(events[_0x6645('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x6645('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x96ab=['hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x96ab,0x146));var _0xb96a=function(_0x31af27,_0x5d701c){_0x31af27=_0x31af27-0x0;var _0x63baa=_0x96ab[_0x31af27];return _0x63baa;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xb96a('0x0'))['db'][_0xb96a('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb96a('0x2')](0x0);var events={'afterCreate':_0xb96a('0x3'),'afterUpdate':_0xb96a('0x4'),'afterDestroy':_0xb96a('0x5')};function emitEvent(_0x13809c){return function(_0x52e7be,_0x360ef4,_0xbe5590){ChatInternalMessageEvents[_0xb96a('0x6')](_0x13809c+':'+_0x52e7be['id'],_0x52e7be);ChatInternalMessageEvents[_0xb96a('0x6')](_0x13809c,_0x52e7be);_0xbe5590(null);};}for(var e in events){if(events[_0xb96a('0x7')](e)){var event=events[e];ChatInternalMessage[_0xb96a('0x8')](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 1f8ddd0..f288515 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 _0xaf7c=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','chat_internal_messages'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xaf7c,0xf2));var _0xcaf7=function(_0x5baa6d,_0x32779d){_0x5baa6d=_0x5baa6d-0x0;var _0xef22e2=_0xaf7c[_0x5baa6d];return _0xef22e2;};'use strict';var _=require('lodash');var util=require(_0xcaf7('0x0'));var logger=require(_0xcaf7('0x1'))(_0xcaf7('0x2'));var moment=require(_0xcaf7('0x3'));var BPromise=require(_0xcaf7('0x4'));var rp=require(_0xcaf7('0x5'));var fs=require('fs');var path=require(_0xcaf7('0x6'));var rimraf=require('rimraf');var config=require(_0xcaf7('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0xcaf7('0x8')]=function(_0x327082,_0xc2a410){return _0x327082['define']('ChatInternalMessage',attributes,{'tableName':_0xcaf7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcaf7('0xa'),'collate':_0xcaf7('0xb')});}; \ No newline at end of file +var _0xac78=['exports','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b1b54,_0x3011c6){var _0x1b4787=function(_0x5f2dcc){while(--_0x5f2dcc){_0x2b1b54['push'](_0x2b1b54['shift']());}};_0x1b4787(++_0x3011c6);}(_0xac78,0x147));var _0x8ac7=function(_0x5c9c8f,_0x19196e){_0x5c9c8f=_0x5c9c8f-0x0;var _0x119086=_0xac78[_0x5c9c8f];return _0x119086;};'use strict';var _=require(_0x8ac7('0x0'));var util=require(_0x8ac7('0x1'));var logger=require(_0x8ac7('0x2'))(_0x8ac7('0x3'));var moment=require(_0x8ac7('0x4'));var BPromise=require(_0x8ac7('0x5'));var rp=require(_0x8ac7('0x6'));var fs=require('fs');var path=require(_0x8ac7('0x7'));var rimraf=require(_0x8ac7('0x8'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x8ac7('0x9')]=function(_0x4b4554,_0x55db79){return _0x4b4554['define'](_0x8ac7('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8ac7('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 8bf88df..60f4148 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 _0x6ea5=['redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x340e0a,_0x36c551){var _0x337f39=function(_0x3ff086){while(--_0x3ff086){_0x340e0a['push'](_0x340e0a['shift']());}};_0x337f39(++_0x36c551);}(_0x6ea5,0xa5));var _0x56ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ea5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x56ea('0x0'));var util=require(_0x56ea('0x1'));var moment=require('moment');var BPromise=require(_0x56ea('0x2'));var rs=require(_0x56ea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56ea('0x4'))['db'];var utils=require(_0x56ea('0x5'));var logger=require('../../config/logger')(_0x56ea('0x6'));var config=require('../../config/environment');var jayson=require(_0x56ea('0x7'));var client=jayson[_0x56ea('0x8')][_0x56ea('0x9')]({'port':0x232a});config[_0x56ea('0xa')]=_['defaults'](config[_0x56ea('0xa')],{'host':_0x56ea('0xb'),'port':0x18eb});var socket=require(_0x56ea('0xc'))(new Redis(config[_0x56ea('0xa')]));require('./chatInternalMessage.socket')[_0x56ea('0xd')](socket);function respondWithRpcPromise(_0x10be8f,_0x3fb16a,_0x455d21){return new BPromise(function(_0x3d6a7f,_0x53cc05){return client[_0x56ea('0xe')](_0x10be8f,_0x455d21)[_0x56ea('0xf')](function(_0x287553){logger[_0x56ea('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x3fb16a,_0x56ea('0x11'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x3fb16a,_0x56ea('0x11'),JSON[_0x56ea('0x12')](_0x287553));if(_0x287553[_0x56ea('0x13')]){if(_0x287553[_0x56ea('0x13')][_0x56ea('0x14')]===0x1f4){logger['error'](_0x56ea('0x15'),_0x3fb16a,_0x287553[_0x56ea('0x13')][_0x56ea('0x16')]);return _0x53cc05(_0x287553[_0x56ea('0x13')][_0x56ea('0x16')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x3fb16a,_0x287553[_0x56ea('0x13')]['message']);return _0x3d6a7f(_0x287553[_0x56ea('0x13')][_0x56ea('0x16')]);}else{logger[_0x56ea('0x10')](_0x56ea('0x15'),_0x3fb16a,_0x56ea('0x11'));_0x3d6a7f(_0x287553[_0x56ea('0x17')][_0x56ea('0x16')]);}})[_0x56ea('0x18')](function(_0x48e040){logger['error'](_0x56ea('0x15'),_0x3fb16a,_0x48e040);_0x53cc05(_0x48e040);});});} \ No newline at end of file +var _0xfb1c=['then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb1c,0xd2));var _0xcfb1=function(_0x1b87fb,_0x3e6870){_0x1b87fb=_0x1b87fb-0x0;var _0xc7de31=_0xfb1c[_0x1b87fb];return _0xc7de31;};'use strict';var _=require(_0xcfb1('0x0'));var util=require(_0xcfb1('0x1'));var moment=require(_0xcfb1('0x2'));var BPromise=require(_0xcfb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfb1('0x4'));var db=require(_0xcfb1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfb1('0x6'))(_0xcfb1('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfb1('0x8'));var client=jayson['client'][_0xcfb1('0x9')]({'port':0x232a});config[_0xcfb1('0xa')]=_[_0xcfb1('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcfb1('0xc'))(new Redis(config[_0xcfb1('0xa')]));require(_0xcfb1('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e09b3,_0x2d1a8,_0x37ef5f){return new BPromise(function(_0x11788c,_0x5dc48f){return client[_0xcfb1('0xe')](_0x2e09b3,_0x37ef5f)[_0xcfb1('0xf')](function(_0xbdd0c8){logger[_0xcfb1('0x10')](_0xcfb1('0x11'),_0x2d1a8,'request\x20sent');logger[_0xcfb1('0x12')](_0xcfb1('0x13'),_0x2d1a8,_0xcfb1('0x14'),JSON['stringify'](_0xbdd0c8));if(_0xbdd0c8[_0xcfb1('0x15')]){if(_0xbdd0c8['error'][_0xcfb1('0x16')]===0x1f4){logger[_0xcfb1('0x15')](_0xcfb1('0x11'),_0x2d1a8,_0xbdd0c8[_0xcfb1('0x15')][_0xcfb1('0x17')]);return _0x5dc48f(_0xbdd0c8['error'][_0xcfb1('0x17')]);}logger[_0xcfb1('0x15')](_0xcfb1('0x11'),_0x2d1a8,_0xbdd0c8[_0xcfb1('0x15')]['message']);return _0x11788c(_0xbdd0c8[_0xcfb1('0x15')][_0xcfb1('0x17')]);}else{logger['info'](_0xcfb1('0x11'),_0x2d1a8,'request\x20sent');_0x11788c(_0xbdd0c8[_0xcfb1('0x18')]['message']);}})['catch'](function(_0x3f34e3){logger[_0xcfb1('0x15')](_0xcfb1('0x11'),_0x2d1a8,_0x3f34e3);_0x5dc48f(_0x3f34e3);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 5231ddf..fd913f4 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 _0xa227=['./chatInternalMessage.events','remove','emit','chatInternalMessage:'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa227,0x14c));var _0x7a22=function(_0x410749,_0x6122d7){_0x410749=_0x410749-0x0;var _0x37cfef=_0xa227[_0x410749];return _0x37cfef;};'use strict';var ChatInternalMessageEvents=require(_0x7a22('0x0'));var events=['save',_0x7a22('0x1'),'update'];function createListener(_0x1f4833,_0x103e9d){return function(_0x420593){_0x103e9d[_0x7a22('0x2')](_0x1f4833,_0x420593);};}function removeListener(_0x3365fa,_0x56679a){return function(){ChatInternalMessageEvents['removeListener'](_0x3365fa,_0x56679a);};}exports['register']=function(_0x23ca46){for(var _0x56bac3=0x0,_0x503506=events['length'];_0x56bac3<_0x503506;_0x56bac3++){var _0x453665=events[_0x56bac3];var _0x4a1029=createListener(_0x7a22('0x3')+_0x453665,_0x23ca46);ChatInternalMessageEvents['on'](_0x453665,_0x4a1029);}}; \ No newline at end of file +var _0xea93=['remove','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xea93,0x156));var _0x3ea9=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0xea93[_0x18aaaf];return _0x52d892;};'use strict';var ChatInternalMessageEvents=require(_0x3ea9('0x0'));var events=[_0x3ea9('0x1'),_0x3ea9('0x2'),'update'];function createListener(_0x1ed706,_0x3a558a){return function(_0x754c88){_0x3a558a[_0x3ea9('0x3')](_0x1ed706,_0x754c88);};}function removeListener(_0x8164a3,_0x4c4b36){return function(){ChatInternalMessageEvents[_0x3ea9('0x4')](_0x8164a3,_0x4c4b36);};}exports[_0x3ea9('0x5')]=function(_0x188743){for(var _0x187358=0x0,_0xd5e519=events[_0x3ea9('0x6')];_0x187358<_0xd5e519;_0x187358++){var _0x4edbbd=events[_0x187358];var _0x5cee0b=createListener(_0x3ea9('0x7')+_0x4edbbd,_0x188743);ChatInternalMessageEvents['on'](_0x4edbbd,_0x5cee0b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 1ad8d28..b42303d 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 _0x4b85=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','update','delete'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0x4b85,0x1b9));var _0x54b8=function(_0x4427ab,_0x1ab4e2){_0x4427ab=_0x4427ab-0x0;var _0x457ad4=_0x4b85[_0x4427ab];return _0x457ad4;};'use strict';var multer=require(_0x54b8('0x0'));var util=require(_0x54b8('0x1'));var path=require(_0x54b8('0x2'));var timeout=require(_0x54b8('0x3'));var express=require(_0x54b8('0x4'));var router=express[_0x54b8('0x5')]();var fs_extra=require(_0x54b8('0x6'));var auth=require(_0x54b8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x54b8('0x8'));var controller=require(_0x54b8('0x9'));router[_0x54b8('0xa')]('/',auth[_0x54b8('0xb')](),controller[_0x54b8('0xc')]);router[_0x54b8('0xa')](_0x54b8('0xd'),auth[_0x54b8('0xb')](),controller[_0x54b8('0xe')]);router['get'](_0x54b8('0xf'),auth[_0x54b8('0xb')](),controller[_0x54b8('0x10')]);router[_0x54b8('0xa')](_0x54b8('0x11'),auth[_0x54b8('0xb')](),controller[_0x54b8('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x54b8('0x11'),controller[_0x54b8('0x13')]);router[_0x54b8('0x14')](_0x54b8('0x11'),auth[_0x54b8('0xb')](),controller[_0x54b8('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd211=['connect-timeout','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','index','get','/describe','isAuthenticated','describe','getUsers','/:id','show','put','update','destroy','exports','multer','util','path'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0xd211,0x140));var _0x1d21=function(_0x41333f,_0x2e3785){_0x41333f=_0x41333f-0x0;var _0x4fe0cb=_0xd211[_0x41333f];return _0x4fe0cb;};'use strict';var multer=require(_0x1d21('0x0'));var util=require(_0x1d21('0x1'));var path=require(_0x1d21('0x2'));var timeout=require(_0x1d21('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1d21('0x4'));var interaction=require(_0x1d21('0x5'));var config=require('../../config/environment');var controller=require(_0x1d21('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1d21('0x7')]);router[_0x1d21('0x8')](_0x1d21('0x9'),auth[_0x1d21('0xa')](),controller[_0x1d21('0xb')]);router[_0x1d21('0x8')]('/users',auth[_0x1d21('0xa')](),controller[_0x1d21('0xc')]);router[_0x1d21('0x8')](_0x1d21('0xd'),auth['isAuthenticated'](),controller[_0x1d21('0xe')]);router['post']('/',auth[_0x1d21('0xa')](),controller['create']);router[_0x1d21('0xf')]('/:id',controller[_0x1d21('0x10')]);router['delete'](_0x1d21('0xd'),auth[_0x1d21('0xa')](),controller[_0x1d21('0x11')]);module[_0x1d21('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 5b84483..6cd290b 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 _0xae87=['STRING','TEXT','BOOLEAN','out'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xae87,0x1ce));var _0x7ae8=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0xae87[_0x3f8282];return _0x50f918;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7ae8('0x0')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7ae8('0x0')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7ae8('0x1')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x7ae8('0x2')]},'providerResponse':{'type':Sequelize[_0x7ae8('0x3')]}}; \ No newline at end of file +var _0xd824=['out','DATE','sequelize','exports','BOOLEAN','ENUM'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4d82('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4d82('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d82('0x3')]('in',_0x4d82('0x4')),'defaultValue':_0x4d82('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d82('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 7679fbd..78eb04b 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 _0xb04f=['Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','map','type','ChatMessage','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','accept','chat','acceptMessage','reject','UserId','user','agent','ChatInteraction','ChatInteractionId','interaction','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','contact','User','fullname','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','parse','formData','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','redis','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','chat-interactions','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set'];(function(_0x2f3ff8,_0x5f0185){var _0x3edbfc=function(_0x504618){while(--_0x504618){_0x2f3ff8['push'](_0x2f3ff8['shift']());}};_0x3edbfc(++_0x5f0185);}(_0xb04f,0xb1));var _0xfb04=function(_0xb093b4,_0x2544c0){_0xb093b4=_0xb093b4-0x0;var _0x3a3c3b=_0xb04f[_0xb093b4];return _0x3a3c3b;};'use strict';var util=require(_0xfb04('0x0'));var _=require(_0xfb04('0x1'));var Redis=require(_0xfb04('0x2'));var interactionService=require(_0xfb04('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xfb04('0x4'))(_0xfb04('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xfb04('0x6')]=_['defaults'](config[_0xfb04('0x6')],{'host':_0xfb04('0x7'),'port':0x18eb});var socket=require(_0xfb04('0x8'))(new Redis(config[_0xfb04('0x6')]));require(_0xfb04('0x9'))[_0xfb04('0xa')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfb04('0xb')][_0xfb04('0xc')]({'port':0x232c});var client9002=jayson[_0xfb04('0xb')][_0xfb04('0xc')]({'port':0x232a});var interaction_log=require(_0xfb04('0x4'))(_0xfb04('0xd'));function respondWithRpcPromise(_0xf8cc7c,_0x1f8a17,_0x56fcdd,_0x290bb9){return new Promise(function(_0x59aecf,_0x545735){var _0x23af45=_0x290bb9||client;return _0x23af45[_0xfb04('0xe')](_0xf8cc7c,_0x56fcdd)['then'](function(_0x24a4bf){logger[_0xfb04('0xf')](_0xfb04('0x10'),_0x1f8a17,_0xfb04('0x11'));logger[_0xfb04('0x12')](_0xfb04('0x13'),_0x1f8a17,'request\x20sent',JSON[_0xfb04('0x14')](_0x24a4bf));if(_0x24a4bf[_0xfb04('0x15')]){if(_0x24a4bf[_0xfb04('0x15')][_0xfb04('0x16')]===0x1f4){logger[_0xfb04('0x15')]('ChatMessage,\x20%s,\x20%s',_0x1f8a17,_0x24a4bf[_0xfb04('0x15')]['message']);return _0x545735(_0x24a4bf[_0xfb04('0x15')]['message']);}logger[_0xfb04('0x15')](_0xfb04('0x10'),_0x1f8a17,_0x24a4bf['error'][_0xfb04('0x17')]);return _0x59aecf(_0x24a4bf['error']['message']);}else{logger[_0xfb04('0xf')](_0xfb04('0x10'),_0x1f8a17,_0xfb04('0x11'));_0x59aecf(_0x24a4bf[_0xfb04('0x18')][_0xfb04('0x17')]);}})[_0xfb04('0x19')](function(_0x1b07cd){logger[_0xfb04('0x15')](_0xfb04('0x10'),_0x1f8a17,_0x1b07cd);_0x545735(_0x1b07cd);});});}function respondWithResult(_0x65615,_0x15ee60){_0x15ee60=_0x15ee60||0xc8;return function(_0x3cc7e6){if(_0x3cc7e6){return _0x65615[_0xfb04('0x1a')](_0x15ee60)[_0xfb04('0x1b')](_0x3cc7e6);}};}function respondWithFilteredResult(_0x5ed972,_0x106db2){return function(_0x3160fa){if(_0x3160fa){var _0x249b1d=typeof _0x106db2[_0xfb04('0x1c')]===_0xfb04('0x1d')&&typeof _0x106db2[_0xfb04('0x1e')]===_0xfb04('0x1d');var _0xe38ae1=_0x3160fa[_0xfb04('0x1f')];var _0x2f5fd5=_0x249b1d?0x0:_0x106db2[_0xfb04('0x1c')];var _0x1664ef=_0x249b1d?_0x3160fa[_0xfb04('0x1f')]:_0x106db2[_0xfb04('0x1c')]+_0x106db2[_0xfb04('0x1e')];var _0x117139;if(_0x1664ef>=_0xe38ae1){_0x1664ef=_0xe38ae1;_0x117139=0xc8;}else{_0x117139=0xce;}_0x5ed972[_0xfb04('0x1a')](_0x117139);return _0x5ed972[_0xfb04('0x20')](_0xfb04('0x21'),_0x2f5fd5+'-'+_0x1664ef+'/'+_0xe38ae1)[_0xfb04('0x1b')](_0x3160fa);}return null;};}function saveUpdates(_0x2aa308){return function(_0x4a6df5){if(_0x4a6df5){return _0x4a6df5[_0xfb04('0x22')](_0x2aa308)[_0xfb04('0x23')](function(_0x3e9e87){return _0x3e9e87;});}return null;};}function removeEntity(_0x27b2d4){return function(_0x1524d6){if(_0x1524d6){return _0x1524d6[_0xfb04('0x24')]()['then'](function(){_0x27b2d4[_0xfb04('0x1a')](0xcc)[_0xfb04('0x25')]();});}};}function handleEntityNotFound(_0x221f68){return function(_0x44054d){if(!_0x44054d){_0x221f68[_0xfb04('0x26')](0x194);}return _0x44054d;};}function handleError(_0x2f25d1,_0x25b0a8){_0x25b0a8=_0x25b0a8||0x1f4;return function(_0x41cbd8){logger[_0xfb04('0x15')](_0x41cbd8[_0xfb04('0x27')]);if(_0x41cbd8[_0xfb04('0x28')]){delete _0x41cbd8[_0xfb04('0x28')];}_0x2f25d1[_0xfb04('0x1a')](_0x25b0a8)[_0xfb04('0x29')](_0x41cbd8);};}exports[_0xfb04('0x2a')]=function(_0x285782,_0x1ec273){var _0x18300c={},_0x35a8c8={},_0x5911b7={'count':0x0,'rows':[]};var _0x25360e=_['map'](db['ChatMessage']['rawAttributes'],function(_0x2823fb){return{'name':_0x2823fb['fieldName'],'type':_0x2823fb['type'][_0xfb04('0x2b')]};});_0x35a8c8['model']=_['map'](_0x25360e,'name');_0x35a8c8[_0xfb04('0x2c')]=_[_0xfb04('0x2d')](_0x285782[_0xfb04('0x2c')]);_0x35a8c8[_0xfb04('0x2e')]=_[_0xfb04('0x2f')](_0x35a8c8[_0xfb04('0x30')],_0x35a8c8[_0xfb04('0x2c')]);_0x18300c['attributes']=_[_0xfb04('0x2f')](_0x35a8c8['model'],qs[_0xfb04('0x31')](_0x285782[_0xfb04('0x2c')][_0xfb04('0x31')]));_0x18300c['attributes']=_0x18300c[_0xfb04('0x32')][_0xfb04('0x33')]?_0x18300c[_0xfb04('0x32')]:_0x35a8c8[_0xfb04('0x30')];if(!_0x285782[_0xfb04('0x2c')][_0xfb04('0x34')](_0xfb04('0x35'))){_0x18300c[_0xfb04('0x1e')]=qs[_0xfb04('0x1e')](_0x285782[_0xfb04('0x2c')][_0xfb04('0x1e')]);_0x18300c[_0xfb04('0x1c')]=qs[_0xfb04('0x1c')](_0x285782[_0xfb04('0x2c')][_0xfb04('0x1c')]);}_0x18300c['order']=qs['sort'](_0x285782[_0xfb04('0x2c')][_0xfb04('0x36')]);_0x18300c['where']=qs['filters'](_[_0xfb04('0x37')](_0x285782[_0xfb04('0x2c')],_0x35a8c8[_0xfb04('0x2e')]),_0x25360e);if(_0x285782['query'][_0xfb04('0x38')]){_0x18300c['where']=_[_0xfb04('0x39')](_0x18300c[_0xfb04('0x3a')],{'$or':_[_0xfb04('0x3b')](_0x25360e,function(_0x4ea37b){if(_0x4ea37b[_0xfb04('0x3c')]!=='VIRTUAL'){var _0x496f83={};_0x496f83[_0x4ea37b['name']]={'$like':'%'+_0x285782['query']['filter']+'%'};return _0x496f83;}})});}_0x18300c=_[_0xfb04('0x39')]({},_0x18300c,_0x285782['options']);var _0x2f783c={'where':_0x18300c[_0xfb04('0x3a')]};return db[_0xfb04('0x3d')]['count'](_0x2f783c)[_0xfb04('0x23')](function(_0xffba8b){_0x5911b7[_0xfb04('0x1f')]=_0xffba8b;if(_0x285782[_0xfb04('0x2c')][_0xfb04('0x3e')]){_0x18300c[_0xfb04('0x3f')]=[{'all':!![]}];}return db[_0xfb04('0x3d')][_0xfb04('0x40')](_0x18300c);})[_0xfb04('0x23')](function(_0x5a7783){_0x5911b7[_0xfb04('0x41')]=_0x5a7783;return _0x5911b7;})[_0xfb04('0x23')](respondWithFilteredResult(_0x1ec273,_0x18300c))['catch'](handleError(_0x1ec273,null));};exports[_0xfb04('0x42')]=function(_0x45a893,_0x142b20){var _0x2a7447={'raw':!![],'where':{'id':_0x45a893[_0xfb04('0x43')]['id']}},_0x649b61={};_0x649b61[_0xfb04('0x30')]=_['keys'](db[_0xfb04('0x3d')][_0xfb04('0x44')]);_0x649b61['query']=_[_0xfb04('0x2d')](_0x45a893['query']);_0x649b61[_0xfb04('0x2e')]=_['intersection'](_0x649b61[_0xfb04('0x30')],_0x649b61[_0xfb04('0x2c')]);_0x2a7447[_0xfb04('0x32')]=_[_0xfb04('0x2f')](_0x649b61[_0xfb04('0x30')],qs['fields'](_0x45a893[_0xfb04('0x2c')][_0xfb04('0x31')]));_0x2a7447['attributes']=_0x2a7447[_0xfb04('0x32')][_0xfb04('0x33')]?_0x2a7447[_0xfb04('0x32')]:_0x649b61[_0xfb04('0x30')];if(_0x45a893['query']['includeAll']){_0x2a7447[_0xfb04('0x3f')]=[{'all':!![]}];}_0x2a7447=_['merge']({},_0x2a7447,_0x45a893['options']);return db[_0xfb04('0x3d')][_0xfb04('0x45')](_0x2a7447)[_0xfb04('0x23')](handleEntityNotFound(_0x142b20,null))[_0xfb04('0x23')](respondWithResult(_0x142b20,null))[_0xfb04('0x19')](handleError(_0x142b20,null));};exports[_0xfb04('0x46')]=function(_0x277a8d,_0x48f53d){return db['ChatMessage'][_0xfb04('0x46')](_0x277a8d[_0xfb04('0x47')],{})[_0xfb04('0x23')](respondWithResult(_0x48f53d,0xc9))['catch'](handleError(_0x48f53d,null));};exports[_0xfb04('0x22')]=function(_0x31ae35,_0x486b87){if(_0x31ae35[_0xfb04('0x47')]['id']){delete _0x31ae35['body']['id'];}return db['ChatMessage'][_0xfb04('0x45')]({'where':{'id':_0x31ae35[_0xfb04('0x43')]['id']}})['then'](handleEntityNotFound(_0x486b87,null))[_0xfb04('0x23')](saveUpdates(_0x31ae35[_0xfb04('0x47')],null))[_0xfb04('0x23')](respondWithResult(_0x486b87,null))[_0xfb04('0x19')](handleError(_0x486b87,null));};exports['destroy']=function(_0x3fa159,_0x196c08){return db[_0xfb04('0x3d')][_0xfb04('0x45')]({'where':{'id':_0x3fa159[_0xfb04('0x43')]['id']}})[_0xfb04('0x23')](handleEntityNotFound(_0x196c08,null))['then'](removeEntity(_0x196c08,null))[_0xfb04('0x19')](handleError(_0x196c08,null));};exports[_0xfb04('0x48')]=function(_0x24ff23,_0x55932){return db[_0xfb04('0x3d')]['describe']()[_0xfb04('0x23')](respondWithResult(_0x55932,null))[_0xfb04('0x19')](handleError(_0x55932,null));};exports[_0xfb04('0x49')]=function(_0x3412ee,_0x5a9abf){var _0x21d5a6=_0xfb04('0x4a');return interactionService[_0xfb04('0x4b')](_0x3412ee,_0x21d5a6)['then'](respondWithResult(_0x5a9abf,null))[_0xfb04('0x19')](handleError(_0x5a9abf,null));};exports[_0xfb04('0x4c')]=function(_0x9e7739,_0x50b9a9){var _0x47d8e1={'agent':{},'channel':_0xfb04('0x4a')};if(_0x9e7739[_0xfb04('0x47')]['id']){delete _0x9e7739['body']['id'];}_0x9e7739[_0xfb04('0x47')]['UserId']=_0x9e7739[_0xfb04('0x47')][_0xfb04('0x4d')]||_0x9e7739[_0xfb04('0x4e')]['id'];_0x47d8e1[_0xfb04('0x4f')]['id']=_0x9e7739[_0xfb04('0x47')][_0xfb04('0x4d')];return db[_0xfb04('0x3d')][_0xfb04('0x45')]({'where':{'id':_0x9e7739['params']['id'],'UserId':null}})[_0xfb04('0x23')](handleEntityNotFound(_0x50b9a9,null))[_0xfb04('0x23')](function(_0x158a9c){if(_0x158a9c){_0x47d8e1[_0xfb04('0x17')]=_0x158a9c['get']({'plain':!![]});return db[_0xfb04('0x50')][_0xfb04('0x45')]({'where':{'id':_0x158a9c[_0xfb04('0x51')]}});}return null;})['then'](handleEntityNotFound(_0x50b9a9,null))[_0xfb04('0x23')](function(_0x2b52e3){if(_0x2b52e3){_0x47d8e1[_0xfb04('0x52')]=_0x2b52e3[_0xfb04('0x53')]({'plain':!![]});interaction_log[_0xfb04('0xf')](_0xfb04('0x54'),_0x9e7739[_0xfb04('0x4e')]['id'],_0x9e7739[_0xfb04('0x4e')]['name'],_0x9e7739['user']['role'],_0x47d8e1[_0xfb04('0x52')]['id'],_0x9e7739[_0xfb04('0x47')]?JSON['stringify'](_0x9e7739[_0xfb04('0x47')]):_0xfb04('0x55'));return respondWithRpcPromise(_0xfb04('0x56'),_0xfb04('0x57'),_0x47d8e1);}return null;})[_0xfb04('0x23')](function(_0x44c70e){var _0x21ac53=_0xfb04('0x58')+_0x44c70e['message']['ContactId'];return db[_0xfb04('0x59')][_0xfb04('0x2c')](_0x21ac53,{'type':db['Sequelize']['QueryTypes'][_0xfb04('0x5a')],'raw':!![]})['then'](function(_0x311cd7){return _0x311cd7;});})[_0xfb04('0x23')](function(_0x43571b){if(_0x43571b){_0x47d8e1[_0xfb04('0x17')][_0xfb04('0x5b')]=_0x43571b[0x0];if(!_0x9e7739[_0xfb04('0x47')][_0xfb04('0x4d')])return;return db[_0xfb04('0x5c')]['find']({'where':{'id':_0x9e7739[_0xfb04('0x47')][_0xfb04('0x4d')],'role':_0xfb04('0x4f')},'attributes':['id',_0xfb04('0x28'),_0xfb04('0x5d'),'email',_0xfb04('0x5e')],'raw':!![]});}return null;})[_0xfb04('0x23')](function(_0x8e964e){if(!_0x8e964e)return null;_0x47d8e1[_0xfb04('0x17')][_0xfb04('0x4f')]=_0x8e964e;return _0x47d8e1;})[_0xfb04('0x23')](function(_0x1c6a47){if(_0x1c6a47){_0x1c6a47[_0xfb04('0x17')][_0xfb04('0x5f')]=util[_0xfb04('0x60')](_0xfb04('0x61'),_0x9e7739[_0xfb04('0x4e')][_0xfb04('0x28')]);_0x1c6a47[_0xfb04('0x17')][_0xfb04('0x62')]=_0x47d8e1[_0xfb04('0x62')];_0x1c6a47[_0xfb04('0x17')][_0xfb04('0x63')]=_0x47d8e1[_0xfb04('0x62')];_0x1c6a47[_0xfb04('0x17')][_0xfb04('0x64')]=_0xfb04('0x4c');respondWithRpcPromise('EventManager',_0xfb04('0x65'),{'event':_0xfb04('0x66'),'message':_[_0xfb04('0x39')](_0x47d8e1[_0xfb04('0x17')],JSON[_0xfb04('0x67')](_0x47d8e1[_0xfb04('0x52')][_0xfb04('0x68')]))},client9002);return _0x47d8e1;}return null;})[_0xfb04('0x23')](respondWithResult(_0x50b9a9,null))['catch'](handleError(_0x50b9a9,null));}; \ No newline at end of file +var _0x03c5=['defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','chat-interactions','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','undefined','count','offset','limit','set','json','then','destroy','end','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','create','body','update','find','describe','chat','acceptMessage','reject','UserId','user','get','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','ioredis','../../config/logger','api','../../mysqldb','redis'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x03c5,0x1e0));var _0x503c=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x03c5[_0x90a39a];return _0x2b62f7;};'use strict';var util=require('util');var _=require('lodash');var Redis=require(_0x503c('0x0'));var interactionService=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x503c('0x1'))(_0x503c('0x2'));var config=require('../../config/environment');var db=require(_0x503c('0x3'))['db'];config[_0x503c('0x4')]=_[_0x503c('0x5')](config[_0x503c('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x503c('0x6'))(new Redis(config['redis']));require(_0x503c('0x7'))[_0x503c('0x8')](socket);var jayson=require(_0x503c('0x9'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x503c('0xa')][_0x503c('0xb')]({'port':0x232a});var interaction_log=require(_0x503c('0x1'))(_0x503c('0xc'));function respondWithRpcPromise(_0x12b136,_0x1ea999,_0x5c1b89,_0x21547d){return new Promise(function(_0x1d3456,_0x37fec9){var _0x4b15dd=_0x21547d||client;return _0x4b15dd['request'](_0x12b136,_0x5c1b89)['then'](function(_0x3558ed){logger[_0x503c('0xd')](_0x503c('0xe'),_0x1ea999,_0x503c('0xf'));logger[_0x503c('0x10')](_0x503c('0x11'),_0x1ea999,_0x503c('0xf'),JSON[_0x503c('0x12')](_0x3558ed));if(_0x3558ed[_0x503c('0x13')]){if(_0x3558ed['error'][_0x503c('0x14')]===0x1f4){logger[_0x503c('0x13')](_0x503c('0xe'),_0x1ea999,_0x3558ed['error'][_0x503c('0x15')]);return _0x37fec9(_0x3558ed['error'][_0x503c('0x15')]);}logger[_0x503c('0x13')](_0x503c('0xe'),_0x1ea999,_0x3558ed[_0x503c('0x13')][_0x503c('0x15')]);return _0x1d3456(_0x3558ed['error'][_0x503c('0x15')]);}else{logger[_0x503c('0xd')](_0x503c('0xe'),_0x1ea999,'request\x20sent');_0x1d3456(_0x3558ed['result']['message']);}})['catch'](function(_0x4934c0){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1ea999,_0x4934c0);_0x37fec9(_0x4934c0);});});}function respondWithResult(_0x4a8bfc,_0x4063ab){_0x4063ab=_0x4063ab||0xc8;return function(_0x51887e){if(_0x51887e){return _0x4a8bfc[_0x503c('0x16')](_0x4063ab)['json'](_0x51887e);}};}function respondWithFilteredResult(_0x577b3e,_0x1a0278){return function(_0x1652e9){if(_0x1652e9){var _0x4ab8db=typeof _0x1a0278['offset']===_0x503c('0x17')&&typeof _0x1a0278['limit']===_0x503c('0x17');var _0x206c82=_0x1652e9[_0x503c('0x18')];var _0x43a5ad=_0x4ab8db?0x0:_0x1a0278[_0x503c('0x19')];var _0x342dd3=_0x4ab8db?_0x1652e9['count']:_0x1a0278[_0x503c('0x19')]+_0x1a0278[_0x503c('0x1a')];var _0xc4c13;if(_0x342dd3>=_0x206c82){_0x342dd3=_0x206c82;_0xc4c13=0xc8;}else{_0xc4c13=0xce;}_0x577b3e['status'](_0xc4c13);return _0x577b3e[_0x503c('0x1b')]('Content-Range',_0x43a5ad+'-'+_0x342dd3+'/'+_0x206c82)[_0x503c('0x1c')](_0x1652e9);}return null;};}function saveUpdates(_0x563925){return function(_0x338bf7){if(_0x338bf7){return _0x338bf7['update'](_0x563925)[_0x503c('0x1d')](function(_0x3717ac){return _0x3717ac;});}return null;};}function removeEntity(_0x25136e){return function(_0x9ed650){if(_0x9ed650){return _0x9ed650[_0x503c('0x1e')]()[_0x503c('0x1d')](function(){_0x25136e['status'](0xcc)[_0x503c('0x1f')]();});}};}function handleEntityNotFound(_0x109dc5){return function(_0xe0c064){if(!_0xe0c064){_0x109dc5['sendStatus'](0x194);}return _0xe0c064;};}function handleError(_0x323927,_0x2edf8a){_0x2edf8a=_0x2edf8a||0x1f4;return function(_0x48a9bd){logger[_0x503c('0x13')](_0x48a9bd[_0x503c('0x20')]);if(_0x48a9bd[_0x503c('0x21')]){delete _0x48a9bd[_0x503c('0x21')];}_0x323927[_0x503c('0x16')](_0x2edf8a)[_0x503c('0x22')](_0x48a9bd);};}exports[_0x503c('0x23')]=function(_0x14a561,_0x3cbb0b){var _0x3c00a1={},_0x1a1c79={},_0x17e7e8={'count':0x0,'rows':[]};var _0xff0b03=_[_0x503c('0x24')](db[_0x503c('0x25')]['rawAttributes'],function(_0x3a1a34){return{'name':_0x3a1a34[_0x503c('0x26')],'type':_0x3a1a34[_0x503c('0x27')][_0x503c('0x28')]};});_0x1a1c79[_0x503c('0x29')]=_[_0x503c('0x24')](_0xff0b03,_0x503c('0x21'));_0x1a1c79[_0x503c('0x2a')]=_['keys'](_0x14a561[_0x503c('0x2a')]);_0x1a1c79['filters']=_[_0x503c('0x2b')](_0x1a1c79[_0x503c('0x29')],_0x1a1c79[_0x503c('0x2a')]);_0x3c00a1[_0x503c('0x2c')]=_['intersection'](_0x1a1c79[_0x503c('0x29')],qs[_0x503c('0x2d')](_0x14a561[_0x503c('0x2a')][_0x503c('0x2d')]));_0x3c00a1[_0x503c('0x2c')]=_0x3c00a1['attributes'][_0x503c('0x2e')]?_0x3c00a1[_0x503c('0x2c')]:_0x1a1c79[_0x503c('0x29')];if(!_0x14a561[_0x503c('0x2a')][_0x503c('0x2f')]('nolimit')){_0x3c00a1['limit']=qs[_0x503c('0x1a')](_0x14a561[_0x503c('0x2a')][_0x503c('0x1a')]);_0x3c00a1[_0x503c('0x19')]=qs[_0x503c('0x19')](_0x14a561[_0x503c('0x2a')]['offset']);}_0x3c00a1[_0x503c('0x30')]=qs[_0x503c('0x31')](_0x14a561[_0x503c('0x2a')]['sort']);_0x3c00a1[_0x503c('0x32')]=qs[_0x503c('0x33')](_['pick'](_0x14a561['query'],_0x1a1c79['filters']),_0xff0b03);if(_0x14a561[_0x503c('0x2a')][_0x503c('0x34')]){_0x3c00a1['where']=_[_0x503c('0x35')](_0x3c00a1[_0x503c('0x32')],{'$or':_[_0x503c('0x24')](_0xff0b03,function(_0x31fedd){if(_0x31fedd[_0x503c('0x27')]!==_0x503c('0x36')){var _0x7fa9b9={};_0x7fa9b9[_0x31fedd[_0x503c('0x21')]]={'$like':'%'+_0x14a561[_0x503c('0x2a')]['filter']+'%'};return _0x7fa9b9;}})});}_0x3c00a1=_['merge']({},_0x3c00a1,_0x14a561[_0x503c('0x37')]);var _0x16907f={'where':_0x3c00a1[_0x503c('0x32')]};return db['ChatMessage'][_0x503c('0x18')](_0x16907f)['then'](function(_0x3989d4){_0x17e7e8[_0x503c('0x18')]=_0x3989d4;if(_0x14a561[_0x503c('0x2a')][_0x503c('0x38')]){_0x3c00a1['include']=[{'all':!![]}];}return db[_0x503c('0x25')][_0x503c('0x39')](_0x3c00a1);})[_0x503c('0x1d')](function(_0x587db6){_0x17e7e8['rows']=_0x587db6;return _0x17e7e8;})['then'](respondWithFilteredResult(_0x3cbb0b,_0x3c00a1))[_0x503c('0x3a')](handleError(_0x3cbb0b,null));};exports[_0x503c('0x3b')]=function(_0x3aef41,_0x54744b){var _0x36ef9c={'raw':!![],'where':{'id':_0x3aef41[_0x503c('0x3c')]['id']}},_0x538d21={};_0x538d21[_0x503c('0x29')]=_[_0x503c('0x3d')](db[_0x503c('0x25')]['rawAttributes']);_0x538d21[_0x503c('0x2a')]=_[_0x503c('0x3d')](_0x3aef41['query']);_0x538d21[_0x503c('0x33')]=_['intersection'](_0x538d21[_0x503c('0x29')],_0x538d21[_0x503c('0x2a')]);_0x36ef9c[_0x503c('0x2c')]=_[_0x503c('0x2b')](_0x538d21['model'],qs[_0x503c('0x2d')](_0x3aef41[_0x503c('0x2a')]['fields']));_0x36ef9c['attributes']=_0x36ef9c['attributes']['length']?_0x36ef9c['attributes']:_0x538d21[_0x503c('0x29')];if(_0x3aef41[_0x503c('0x2a')][_0x503c('0x38')]){_0x36ef9c[_0x503c('0x3e')]=[{'all':!![]}];}_0x36ef9c=_[_0x503c('0x35')]({},_0x36ef9c,_0x3aef41['options']);return db[_0x503c('0x25')]['find'](_0x36ef9c)[_0x503c('0x1d')](handleEntityNotFound(_0x54744b,null))[_0x503c('0x1d')](respondWithResult(_0x54744b,null))[_0x503c('0x3a')](handleError(_0x54744b,null));};exports[_0x503c('0x3f')]=function(_0x145c36,_0x5e657c){return db[_0x503c('0x25')]['create'](_0x145c36[_0x503c('0x40')],{})[_0x503c('0x1d')](respondWithResult(_0x5e657c,0xc9))[_0x503c('0x3a')](handleError(_0x5e657c,null));};exports[_0x503c('0x41')]=function(_0x538a5c,_0x3416d7){if(_0x538a5c[_0x503c('0x40')]['id']){delete _0x538a5c[_0x503c('0x40')]['id'];}return db[_0x503c('0x25')][_0x503c('0x42')]({'where':{'id':_0x538a5c[_0x503c('0x3c')]['id']}})[_0x503c('0x1d')](handleEntityNotFound(_0x3416d7,null))['then'](saveUpdates(_0x538a5c[_0x503c('0x40')],null))[_0x503c('0x1d')](respondWithResult(_0x3416d7,null))['catch'](handleError(_0x3416d7,null));};exports['destroy']=function(_0x126796,_0x329edd){return db[_0x503c('0x25')][_0x503c('0x42')]({'where':{'id':_0x126796[_0x503c('0x3c')]['id']}})[_0x503c('0x1d')](handleEntityNotFound(_0x329edd,null))[_0x503c('0x1d')](removeEntity(_0x329edd,null))[_0x503c('0x3a')](handleError(_0x329edd,null));};exports[_0x503c('0x43')]=function(_0x29c21c,_0x4c088e){return db[_0x503c('0x25')][_0x503c('0x43')]()[_0x503c('0x1d')](respondWithResult(_0x4c088e,null))['catch'](handleError(_0x4c088e,null));};exports['accept']=function(_0x4be7e3,_0x221608){var _0x4c5202=_0x503c('0x44');return interactionService[_0x503c('0x45')](_0x4be7e3,_0x4c5202)[_0x503c('0x1d')](respondWithResult(_0x221608,null))[_0x503c('0x3a')](handleError(_0x221608,null));};exports[_0x503c('0x46')]=function(_0x1e7391,_0x3638ac){var _0x1b2e41={'agent':{},'channel':'chat'};if(_0x1e7391[_0x503c('0x40')]['id']){delete _0x1e7391[_0x503c('0x40')]['id'];}_0x1e7391[_0x503c('0x40')][_0x503c('0x47')]=_0x1e7391['body'][_0x503c('0x47')]||_0x1e7391[_0x503c('0x48')]['id'];_0x1b2e41['agent']['id']=_0x1e7391[_0x503c('0x40')][_0x503c('0x47')];return db[_0x503c('0x25')]['find']({'where':{'id':_0x1e7391[_0x503c('0x3c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3638ac,null))['then'](function(_0x50df39){if(_0x50df39){_0x1b2e41['message']=_0x50df39[_0x503c('0x49')]({'plain':!![]});return db[_0x503c('0x4a')][_0x503c('0x42')]({'where':{'id':_0x50df39[_0x503c('0x4b')]}});}return null;})['then'](handleEntityNotFound(_0x3638ac,null))[_0x503c('0x1d')](function(_0x41c2ff){if(_0x41c2ff){_0x1b2e41['interaction']=_0x41c2ff[_0x503c('0x49')]({'plain':!![]});interaction_log[_0x503c('0xd')](_0x503c('0x4c'),_0x1e7391[_0x503c('0x48')]['id'],_0x1e7391[_0x503c('0x48')][_0x503c('0x21')],_0x1e7391[_0x503c('0x48')][_0x503c('0x4d')],_0x1b2e41[_0x503c('0x4e')]['id'],_0x1e7391[_0x503c('0x40')]?JSON['stringify'](_0x1e7391['body']):'null');return respondWithRpcPromise(_0x503c('0x4f'),_0x503c('0x50'),_0x1b2e41);}return null;})[_0x503c('0x1d')](function(_0x485de2){var _0x58d3cc=_0x503c('0x51')+_0x485de2[_0x503c('0x15')]['ContactId'];return db[_0x503c('0x52')][_0x503c('0x2a')](_0x58d3cc,{'type':db[_0x503c('0x53')][_0x503c('0x54')]['SELECT'],'raw':!![]})[_0x503c('0x1d')](function(_0x209afb){return _0x209afb;});})[_0x503c('0x1d')](function(_0x1b7572){if(_0x1b7572){_0x1b2e41[_0x503c('0x15')][_0x503c('0x55')]=_0x1b7572[0x0];if(!_0x1e7391['body'][_0x503c('0x47')])return;return db[_0x503c('0x56')][_0x503c('0x42')]({'where':{'id':_0x1e7391[_0x503c('0x40')][_0x503c('0x47')],'role':'agent'},'attributes':['id','name',_0x503c('0x57'),'email',_0x503c('0x58')],'raw':!![]});}return null;})[_0x503c('0x1d')](function(_0x2d10e9){if(!_0x2d10e9)return null;_0x1b2e41['message']['agent']=_0x2d10e9;return _0x1b2e41;})['then'](function(_0x540302){if(_0x540302){_0x540302[_0x503c('0x15')][_0x503c('0x59')]=util['format'](_0x503c('0x5a'),_0x1e7391[_0x503c('0x48')][_0x503c('0x21')]);_0x540302['message'][_0x503c('0x5b')]=_0x1b2e41[_0x503c('0x5b')];_0x540302[_0x503c('0x15')][_0x503c('0x5c')]=_0x1b2e41[_0x503c('0x5b')];_0x540302[_0x503c('0x15')][_0x503c('0x5d')]=_0x503c('0x46');respondWithRpcPromise(_0x503c('0x5e'),'EventManager',{'event':'rejectmessage','message':_[_0x503c('0x35')](_0x1b2e41[_0x503c('0x15')],JSON[_0x503c('0x5f')](_0x1b2e41[_0x503c('0x4e')][_0x503c('0x60')]))},client9002);return _0x1b2e41;}return null;})[_0x503c('0x1d')](respondWithResult(_0x3638ac,null))[_0x503c('0x3a')](handleError(_0x3638ac,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 7aa5278..eee7d1f 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 _0x22b4=['exports','events','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x43d57f,_0x11252d){var _0x533228=function(_0x39a974){while(--_0x39a974){_0x43d57f['push'](_0x43d57f['shift']());}};_0x533228(++_0x11252d);}(_0x22b4,0x139));var _0x422b=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x22b4[_0x411017];return _0x2adeea;};'use strict';var EventEmitter=require(_0x422b('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x422b('0x1')](0x0);var events={'afterCreate':_0x422b('0x2'),'afterUpdate':_0x422b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x49a6da){return function(_0x471aaf,_0x47794c,_0xf7591){ChatMessageEvents[_0x422b('0x4')](_0x49a6da+':'+_0x471aaf['id'],_0x471aaf);ChatMessageEvents['emit'](_0x49a6da,_0x471aaf);_0xf7591(null);};}for(var e in events){if(events[_0x422b('0x5')](e)){var event=events[e];ChatMessage[_0x422b('0x6')](e,emitEvent(event));}}module[_0x422b('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x9f45=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x480c77,_0x3d544c){var _0x6652dd=function(_0x60db55){while(--_0x60db55){_0x480c77['push'](_0x480c77['shift']());}};_0x6652dd(++_0x3d544c);}(_0x9f45,0x195));var _0x59f4=function(_0x13148b,_0x5b5d1d){_0x13148b=_0x13148b-0x0;var _0x51b830=_0x9f45[_0x13148b];return _0x51b830;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x59f4('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x59f4('0x1')](0x0);var events={'afterCreate':_0x59f4('0x2'),'afterUpdate':_0x59f4('0x3'),'afterDestroy':_0x59f4('0x4')};function emitEvent(_0x595d17){return function(_0x34a7cc,_0x371c46,_0x151988){ChatMessageEvents[_0x59f4('0x5')](_0x595d17+':'+_0x34a7cc['id'],_0x34a7cc);ChatMessageEvents['emit'](_0x595d17,_0x34a7cc);_0x151988(null);};}for(var e in events){if(events[_0x59f4('0x6')](e)){var event=events[e];ChatMessage[_0x59f4('0x7')](e,emitEvent(event));}}module[_0x59f4('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 04ae66f..a1168d6 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 _0x47ac=['path','define','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3c9740,_0x35e5cf){var _0xaab87e=function(_0x3af031){while(--_0x3af031){_0x3c9740['push'](_0x3c9740['shift']());}};_0xaab87e(++_0x35e5cf);}(_0x47ac,0x14c));var _0xc47a=function(_0x31df5d,_0x27705d){_0x31df5d=_0x31df5d-0x0;var _0x9dda18=_0x47ac[_0x31df5d];return _0x9dda18;};'use strict';var _=require(_0xc47a('0x0'));var util=require(_0xc47a('0x1'));var logger=require(_0xc47a('0x2'))('api');var moment=require(_0xc47a('0x3'));var BPromise=require(_0xc47a('0x4'));var rp=require(_0xc47a('0x5'));var fs=require('fs');var path=require(_0xc47a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module['exports']=function(_0x30360c,_0x48912d){return _0x30360c[_0xc47a('0x7')]('ChatMessage',attributes,{'tableName':_0xc47a('0x8'),'paranoid':![],'indexes':[{'name':_0xc47a('0x9'),'fields':['body'],'type':_0xc47a('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56f97f,_0x325c90,_0xce8fa5){var _0x562338=_0x30360c[_0xc47a('0xb')];var _0x5098f2=_0x56f97f[_0xc47a('0xc')]({'plain':!![]});if(_0x5098f2[_0xc47a('0xd')][_0xc47a('0xe')]()==='in'||_0x5098f2[_0xc47a('0xd')]['toLowerCase']()===_0xc47a('0xf')&&!_0x5098f2[_0xc47a('0x10')]&&!_[_0xc47a('0x11')](_0x5098f2[_0xc47a('0x12')])){_0x562338[_0xc47a('0x13')]['findOne']({'where':{'id':_0x5098f2['ChatInteractionId']}})[_0xc47a('0x14')](function(_0x4cc616){if(_0x4cc616){_0x4cc616[_0xc47a('0x15')]({'lastMsgAt':_0x5098f2[_0xc47a('0x16')],'lastMsgDirection':_0x5098f2[_0xc47a('0xd')][_0xc47a('0xe')]()});}})[_0xc47a('0x17')](function(_0x3cf306){console[_0xc47a('0x18')](_0x3cf306);});}_0xce8fa5();}},'charset':_0xc47a('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1ab8=['ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','ChatInteraction'];(function(_0x10e840,_0x5b3935){var _0x405caa=function(_0x46b707){while(--_0x46b707){_0x10e840['push'](_0x10e840['shift']());}};_0x405caa(++_0x5b3935);}(_0x1ab8,0x1e2));var _0x81ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1ab8[_0x432682];return _0x463d05;};'use strict';var _=require(_0x81ab('0x0'));var util=require(_0x81ab('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x81ab('0x2'));var rp=require(_0x81ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x81ab('0x4'));var config=require(_0x81ab('0x5'));var attributes=require(_0x81ab('0x6'));module['exports']=function(_0x17654c,_0x1e6b80){return _0x17654c[_0x81ab('0x7')]('ChatMessage',attributes,{'tableName':_0x81ab('0x8'),'paranoid':![],'indexes':[{'name':_0x81ab('0x9'),'fields':['body'],'type':_0x81ab('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3877a6,_0xbbfe63,_0x51c47f){var _0x3d31e3=_0x17654c[_0x81ab('0xb')];var _0x5387ec=_0x3877a6['get']({'plain':!![]});if(_0x5387ec[_0x81ab('0xc')][_0x81ab('0xd')]()==='in'||_0x5387ec[_0x81ab('0xc')][_0x81ab('0xd')]()===_0x81ab('0xe')&&!_0x5387ec['secret']&&!_[_0x81ab('0xf')](_0x5387ec[_0x81ab('0x10')])){_0x3d31e3[_0x81ab('0x11')]['findOne']({'where':{'id':_0x5387ec[_0x81ab('0x12')]}})[_0x81ab('0x13')](function(_0x351b54){if(_0x351b54){_0x351b54[_0x81ab('0x14')]({'lastMsgAt':_0x5387ec['createdAt'],'lastMsgDirection':_0x5387ec[_0x81ab('0xc')][_0x81ab('0xd')]()});}})[_0x81ab('0x15')](function(_0x361784){console[_0x81ab('0x16')](_0x361784);});}_0x51c47f();}},'charset':_0x81ab('0x17'),'collate':_0x81ab('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 23110cc..7cdd5bc 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 _0x8e29=['options','raw','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','request\x20sent','debug','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','result','CreateChatMessage','ChatMessage','create','body'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x8e29,0x143));var _0x98e2=function(_0xd63cd0,_0x5b2644){_0xd63cd0=_0xd63cd0-0x0;var _0x381c4b=_0x8e29[_0xd63cd0];return _0x381c4b;};'use strict';var _=require(_0x98e2('0x0'));var util=require(_0x98e2('0x1'));var moment=require('moment');var BPromise=require(_0x98e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x98e2('0x4'))(_0x98e2('0x5'));var config=require('../../config/environment');var jayson=require(_0x98e2('0x6'));var client=jayson[_0x98e2('0x7')][_0x98e2('0x8')]({'port':0x232a});config[_0x98e2('0x9')]=_[_0x98e2('0xa')](config['redis'],{'host':_0x98e2('0xb'),'port':0x18eb});var socket=require(_0x98e2('0xc'))(new Redis(config[_0x98e2('0x9')]));require(_0x98e2('0xd'))[_0x98e2('0xe')](socket);function respondWithRpcPromise(_0x5271ae,_0xc56b63,_0x1f6834){return new BPromise(function(_0x212b76,_0x363d8){return client[_0x98e2('0xf')](_0x5271ae,_0x1f6834)[_0x98e2('0x10')](function(_0x4b2a09){logger['info']('ChatMessage,\x20%s,\x20%s',_0xc56b63,_0x98e2('0x11'));logger[_0x98e2('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xc56b63,_0x98e2('0x11'),JSON[_0x98e2('0x13')](_0x4b2a09));if(_0x4b2a09[_0x98e2('0x14')]){if(_0x4b2a09['error']['code']===0x1f4){logger[_0x98e2('0x14')](_0x98e2('0x15'),_0xc56b63,_0x4b2a09[_0x98e2('0x14')][_0x98e2('0x16')]);return _0x363d8(_0x4b2a09['error']['message']);}logger[_0x98e2('0x14')](_0x98e2('0x15'),_0xc56b63,_0x4b2a09[_0x98e2('0x14')][_0x98e2('0x16')]);return _0x212b76(_0x4b2a09[_0x98e2('0x14')][_0x98e2('0x16')]);}else{logger[_0x98e2('0x17')](_0x98e2('0x15'),_0xc56b63,_0x98e2('0x11'));_0x212b76(_0x4b2a09[_0x98e2('0x18')][_0x98e2('0x16')]);}})['catch'](function(_0x402deb){logger[_0x98e2('0x14')](_0x98e2('0x15'),_0xc56b63,_0x402deb);_0x363d8(_0x402deb);});});}exports[_0x98e2('0x19')]=function(_0x5269f4){var _0x166386=this;return new Promise(function(_0x5217b7,_0x1c0831){return db[_0x98e2('0x1a')][_0x98e2('0x1b')](_0x5269f4[_0x98e2('0x1c')],{'raw':_0x5269f4[_0x98e2('0x1d')]?_0x5269f4[_0x98e2('0x1d')][_0x98e2('0x1e')]===undefined?!![]:![]:!![]})[_0x98e2('0x10')](function(_0x536e0f){logger[_0x98e2('0x17')](_0x98e2('0x19'),_0x5269f4);logger[_0x98e2('0x12')](_0x98e2('0x19'),_0x5269f4,JSON[_0x98e2('0x13')](_0x536e0f));_0x5217b7(_0x536e0f);})[_0x98e2('0x1f')](function(_0x3bef5b){logger[_0x98e2('0x14')](_0x98e2('0x19'),_0x3bef5b[_0x98e2('0x16')],_0x5269f4);_0x1c0831(_0x166386[_0x98e2('0x14')](0x1f4,_0x3bef5b[_0x98e2('0x16')]));});});}; \ No newline at end of file +var _0xc6c0=['stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','ChatMessage','create','body','options','CreateChatMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','debug'];(function(_0x390556,_0x5b64bd){var _0x11868e=function(_0x51bf69){while(--_0x51bf69){_0x390556['push'](_0x390556['shift']());}};_0x11868e(++_0x5b64bd);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0xc6c0[_0x39ffd1];return _0x31267e;};'use strict';var _=require(_0x0c6c('0x0'));var util=require('util');var moment=require(_0x0c6c('0x1'));var BPromise=require(_0x0c6c('0x2'));var rs=require(_0x0c6c('0x3'));var fs=require('fs');var Redis=require(_0x0c6c('0x4'));var db=require(_0x0c6c('0x5'))['db'];var utils=require(_0x0c6c('0x6'));var logger=require(_0x0c6c('0x7'))(_0x0c6c('0x8'));var config=require(_0x0c6c('0x9'));var jayson=require(_0x0c6c('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x0c6c('0xb')]=_[_0x0c6c('0xc')](config[_0x0c6c('0xb')],{'host':_0x0c6c('0xd'),'port':0x18eb});var socket=require(_0x0c6c('0xe'))(new Redis(config[_0x0c6c('0xb')]));require(_0x0c6c('0xf'))[_0x0c6c('0x10')](socket);function respondWithRpcPromise(_0x3c93f1,_0x278450,_0x4286b0){return new BPromise(function(_0x3769c2,_0x238229){return client[_0x0c6c('0x11')](_0x3c93f1,_0x4286b0)[_0x0c6c('0x12')](function(_0x5c9d9a){logger[_0x0c6c('0x13')]('ChatMessage,\x20%s,\x20%s',_0x278450,_0x0c6c('0x14'));logger[_0x0c6c('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x278450,_0x0c6c('0x14'),JSON[_0x0c6c('0x16')](_0x5c9d9a));if(_0x5c9d9a[_0x0c6c('0x17')]){if(_0x5c9d9a[_0x0c6c('0x17')][_0x0c6c('0x18')]===0x1f4){logger['error'](_0x0c6c('0x19'),_0x278450,_0x5c9d9a[_0x0c6c('0x17')][_0x0c6c('0x1a')]);return _0x238229(_0x5c9d9a[_0x0c6c('0x17')][_0x0c6c('0x1a')]);}logger[_0x0c6c('0x17')](_0x0c6c('0x19'),_0x278450,_0x5c9d9a['error'][_0x0c6c('0x1a')]);return _0x3769c2(_0x5c9d9a['error']['message']);}else{logger['info'](_0x0c6c('0x19'),_0x278450,'request\x20sent');_0x3769c2(_0x5c9d9a[_0x0c6c('0x1b')]['message']);}})[_0x0c6c('0x1c')](function(_0x1dfe87){logger[_0x0c6c('0x17')](_0x0c6c('0x19'),_0x278450,_0x1dfe87);_0x238229(_0x1dfe87);});});}exports['CreateChatMessage']=function(_0x1b9ed4){var _0x18b6d5=this;return new Promise(function(_0x326945,_0x1280fb){return db[_0x0c6c('0x1d')][_0x0c6c('0x1e')](_0x1b9ed4[_0x0c6c('0x1f')],{'raw':_0x1b9ed4[_0x0c6c('0x20')]?_0x1b9ed4[_0x0c6c('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x0c6c('0x12')](function(_0xc33069){logger[_0x0c6c('0x13')]('CreateChatMessage',_0x1b9ed4);logger[_0x0c6c('0x15')]('CreateChatMessage',_0x1b9ed4,JSON[_0x0c6c('0x16')](_0xc33069));_0x326945(_0xc33069);})[_0x0c6c('0x1c')](function(_0x4140e0){logger['error'](_0x0c6c('0x21'),_0x4140e0[_0x0c6c('0x1a')],_0x1b9ed4);_0x1280fb(_0x18b6d5[_0x0c6c('0x17')](0x1f4,_0x4140e0[_0x0c6c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 27a7267..6767aca 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 _0xeec6=['length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0xeec6,0x1c2));var _0x6eec=function(_0x2eac4f,_0x5173f9){_0x2eac4f=_0x2eac4f-0x0;var _0x58f73b=_0xeec6[_0x2eac4f];return _0x58f73b;};'use strict';var ChatMessageEvents=require(_0x6eec('0x0'));var events=[_0x6eec('0x1'),_0x6eec('0x2'),_0x6eec('0x3')];function createListener(_0x535568,_0x471d43){return function(_0x3e4f10){_0x471d43[_0x6eec('0x4')](_0x535568,_0x3e4f10);};}function removeListener(_0x2d7a15,_0x3e7b6b){return function(){ChatMessageEvents[_0x6eec('0x5')](_0x2d7a15,_0x3e7b6b);};}exports['register']=function(_0x185f31){for(var _0x3c6eda=0x0,_0x48064a=events[_0x6eec('0x6')];_0x3c6eda<_0x48064a;_0x3c6eda++){var _0x1c810e=events[_0x3c6eda];var _0x3443c2=createListener(_0x6eec('0x7')+_0x1c810e,_0x185f31);ChatMessageEvents['on'](_0x1c810e,_0x3443c2);}}; \ No newline at end of file +var _0x4fd7=['emit','register','./chatMessage.events','save','remove','update'];(function(_0x18df84,_0xa4e50e){var _0x55a38c=function(_0xe16c){while(--_0xe16c){_0x18df84['push'](_0x18df84['shift']());}};_0x55a38c(++_0xa4e50e);}(_0x4fd7,0xe6));var _0x74fd=function(_0x5ef312,_0x43d14e){_0x5ef312=_0x5ef312-0x0;var _0x147990=_0x4fd7[_0x5ef312];return _0x147990;};'use strict';var ChatMessageEvents=require(_0x74fd('0x0'));var events=[_0x74fd('0x1'),_0x74fd('0x2'),_0x74fd('0x3')];function createListener(_0x5bb9e2,_0x4fba38){return function(_0xfa6318){_0x4fba38[_0x74fd('0x4')](_0x5bb9e2,_0xfa6318);};}function removeListener(_0x59e3f1,_0x34f92f){return function(){ChatMessageEvents['removeListener'](_0x59e3f1,_0x34f92f);};}exports[_0x74fd('0x5')]=function(_0x480ec2){for(var _0x1959e1=0x0,_0xced36a=events['length'];_0x1959e1<_0xced36a;_0x1959e1++){var _0x1fd5b7=events[_0x1959e1];var _0x15563c=createListener('chatMessage:'+_0x1fd5b7,_0x480ec2);ChatMessageEvents['on'](_0x1fd5b7,_0x15563c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 3b4282e..0b48e82 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 _0x7af6=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','show','chat','chatmessage:create','create','put','/:id','update','accept','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x28e28e,_0x1ce087){var _0xdc369=function(_0x3a11c4){while(--_0x3a11c4){_0x28e28e['push'](_0x28e28e['shift']());}};_0xdc369(++_0x1ce087);}(_0x7af6,0xeb));var _0x67af=function(_0x691daa,_0xf4cbd1){_0x691daa=_0x691daa-0x0;var _0x1cdf4b=_0x7af6[_0x691daa];return _0x1cdf4b;};'use strict';var multer=require('multer');var util=require(_0x67af('0x0'));var path=require(_0x67af('0x1'));var timeout=require(_0x67af('0x2'));var express=require(_0x67af('0x3'));var router=express[_0x67af('0x4')]();var fs_extra=require(_0x67af('0x5'));var auth=require(_0x67af('0x6'));var interaction=require(_0x67af('0x7'));var config=require(_0x67af('0x8'));var controller=require(_0x67af('0x9'));router[_0x67af('0xa')]('/',auth[_0x67af('0xb')](),controller[_0x67af('0xc')]);router[_0x67af('0xa')](_0x67af('0xd'),auth[_0x67af('0xb')](),controller['describe']);router[_0x67af('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x67af('0xe')]);router['post']('/',auth[_0x67af('0xb')](),interaction['tracked'](_0x67af('0xf'),_0x67af('0x10')),controller[_0x67af('0x11')]);router[_0x67af('0x12')](_0x67af('0x13'),controller[_0x67af('0x14')]);router[_0x67af('0x12')]('/:id/accept',auth[_0x67af('0xb')](),controller[_0x67af('0x15')]);router['put']('/:id/reject',auth[_0x67af('0xb')](),controller['reject']);router[_0x67af('0x16')](_0x67af('0x13'),auth[_0x67af('0xb')](),controller[_0x67af('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6b6a=['get','isAuthenticated','/describe','describe','/:id','post','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller'];(function(_0x3e1c8a,_0x14ee71){var _0x5ccea3=function(_0x1064c7){while(--_0x1064c7){_0x3e1c8a['push'](_0x3e1c8a['shift']());}};_0x5ccea3(++_0x14ee71);}(_0x6b6a,0x1ee));var _0xa6b6=function(_0x4cf2b2,_0x41e205){_0x4cf2b2=_0x4cf2b2-0x0;var _0x4778db=_0x6b6a[_0x4cf2b2];return _0x4778db;};'use strict';var multer=require(_0xa6b6('0x0'));var util=require(_0xa6b6('0x1'));var path=require('path');var timeout=require(_0xa6b6('0x2'));var express=require(_0xa6b6('0x3'));var router=express[_0xa6b6('0x4')]();var fs_extra=require(_0xa6b6('0x5'));var auth=require(_0xa6b6('0x6'));var interaction=require(_0xa6b6('0x7'));var config=require(_0xa6b6('0x8'));var controller=require(_0xa6b6('0x9'));router[_0xa6b6('0xa')]('/',auth[_0xa6b6('0xb')](),controller['index']);router[_0xa6b6('0xa')](_0xa6b6('0xc'),auth[_0xa6b6('0xb')](),controller[_0xa6b6('0xd')]);router[_0xa6b6('0xa')](_0xa6b6('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xa6b6('0xf')]('/',auth[_0xa6b6('0xb')](),interaction[_0xa6b6('0x10')](_0xa6b6('0x11'),_0xa6b6('0x12')),controller['create']);router[_0xa6b6('0x13')](_0xa6b6('0xe'),controller[_0xa6b6('0x14')]);router[_0xa6b6('0x13')](_0xa6b6('0x15'),auth[_0xa6b6('0xb')](),controller[_0xa6b6('0x16')]);router[_0xa6b6('0x13')](_0xa6b6('0x17'),auth[_0xa6b6('0xb')](),controller[_0xa6b6('0x18')]);router[_0xa6b6('0x19')]('/:id',auth[_0xa6b6('0xb')](),controller[_0xa6b6('0x1a')]);module[_0xa6b6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f5fd6d2..55044a4 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 _0x757a=['exports','TEXT'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x757a,0xde));var _0xa757=function(_0x340dbf,_0x372446){_0x340dbf=_0x340dbf-0x0;var _0x5788e7=_0x757a[_0x340dbf];return _0x5788e7;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x757a=['exports','TEXT'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x757a,0xde));var _0xa757=function(_0x58f0be,_0x42b4c2){_0x58f0be=_0x58f0be-0x0;var _0x20bd35=_0x757a[_0x58f0be];return _0x20bd35;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index bc68de4..fa8b822 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x7a54,0x106));var _0x47a5=function(_0x135fab,_0x4379fa){_0x135fab=_0x135fab-0x0;var _0x15d3d7=_0x7a54[_0x135fab];return _0x15d3d7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x7a54,0x106));var _0x47a5=function(_0x21b40b,_0x4aacce){_0x21b40b=_0x21b40b-0x0;var _0x3051ea=_0x7a54[_0x21b40b];return _0x3051ea;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index fa7395d..631db81 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 _0xf44a=['hook','exports','events','ChatOfflineMessage','save','update','emit','hasOwnProperty'];(function(_0x45e1eb,_0x5ef730){var _0x1d1ed6=function(_0x378401){while(--_0x378401){_0x45e1eb['push'](_0x45e1eb['shift']());}};_0x1d1ed6(++_0x5ef730);}(_0xf44a,0x12a));var _0xaf44=function(_0x233494,_0x498a62){_0x233494=_0x233494-0x0;var _0x4547f9=_0xf44a[_0x233494];return _0x4547f9;};'use strict';var EventEmitter=require(_0xaf44('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xaf44('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf44('0x2'),'afterUpdate':_0xaf44('0x3'),'afterDestroy':'remove'};function emitEvent(_0x6e5c70){return function(_0x92b0cf,_0x4bc8dd,_0x18d704){ChatOfflineMessageEvents[_0xaf44('0x4')](_0x6e5c70+':'+_0x92b0cf['id'],_0x92b0cf);ChatOfflineMessageEvents['emit'](_0x6e5c70,_0x92b0cf);_0x18d704(null);};}for(var e in events){if(events[_0xaf44('0x5')](e)){var event=events[e];ChatOfflineMessage[_0xaf44('0x6')](e,emitEvent(event));}}module[_0xaf44('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xa026=['remove','emit','hook','exports','../../mysqldb','ChatOfflineMessage','save','update'];(function(_0x524cd2,_0xc188bc){var _0x593242=function(_0x36c3cd){while(--_0x36c3cd){_0x524cd2['push'](_0x524cd2['shift']());}};_0x593242(++_0xc188bc);}(_0xa026,0x1f4));var _0x6a02=function(_0xaa37af,_0x9c97e7){_0xaa37af=_0xaa37af-0x0;var _0x56d335=_0xa026[_0xaa37af];return _0x56d335;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x6a02('0x0'))['db'][_0x6a02('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a02('0x2'),'afterUpdate':_0x6a02('0x3'),'afterDestroy':_0x6a02('0x4')};function emitEvent(_0x401ae5){return function(_0x2e6db7,_0x3859d2,_0x5ac27b){ChatOfflineMessageEvents[_0x6a02('0x5')](_0x401ae5+':'+_0x2e6db7['id'],_0x2e6db7);ChatOfflineMessageEvents[_0x6a02('0x5')](_0x401ae5,_0x2e6db7);_0x5ac27b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x6a02('0x6')](e,emitEvent(event));}}module[_0x6a02('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 796de5e..12328b6 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 _0x126d=['utf8mb4_unicode_ci','define','chat_offline_messages','utf8mb4'];(function(_0x6f5598,_0xabeb74){var _0x1e1325=function(_0x1da246){while(--_0x1da246){_0x6f5598['push'](_0x6f5598['shift']());}};_0x1e1325(++_0xabeb74);}(_0x126d,0x15d));var _0xd126=function(_0x996ad4,_0x199f52){_0x996ad4=_0x996ad4-0x0;var _0x4d580a=_0x126d[_0x996ad4];return _0x4d580a;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x362430){return _0x362430[_0xd126('0x0')]('ChatOfflineMessage',attributes,{'tableName':_0xd126('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd126('0x2'),'collate':_0xd126('0x3')});}; \ No newline at end of file +var _0x01f6=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x493bd8,_0x2a2cda){var _0x6542ec=function(_0x5f0607){while(--_0x5f0607){_0x493bd8['push'](_0x493bd8['shift']());}};_0x6542ec(++_0x2a2cda);}(_0x01f6,0xfe));var _0x601f=function(_0x15fe68,_0xddc145){_0x15fe68=_0x15fe68-0x0;var _0x1d144c=_0x01f6[_0x15fe68];return _0x1d144c;};'use strict';var attributes=require(_0x601f('0x0'));module['exports']=function(_0x3dcffc){return _0x3dcffc[_0x601f('0x1')](_0x601f('0x2'),attributes,{'tableName':_0x601f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x601f('0x4'),'collate':_0x601f('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index d1909c7..042fd9a 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 _0x6b13=['jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e79d8,_0x3f2aa7){var _0x3c2e1c=function(_0xd2ccd4){while(--_0xd2ccd4){_0x1e79d8['push'](_0x1e79d8['shift']());}};_0x3c2e1c(++_0x3f2aa7);}(_0x6b13,0xd0));var _0x36b1=function(_0x8fb092,_0x883290){_0x8fb092=_0x8fb092-0x0;var _0xd63883=_0x6b13[_0x8fb092];return _0xd63883;};'use strict';var _=require('lodash');var util=require(_0x36b1('0x0'));var moment=require(_0x36b1('0x1'));var BPromise=require(_0x36b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36b1('0x3'));var db=require(_0x36b1('0x4'))['db'];var utils=require(_0x36b1('0x5'));var logger=require(_0x36b1('0x6'))(_0x36b1('0x7'));var config=require('../../config/environment');var jayson=require(_0x36b1('0x8'));var client=jayson[_0x36b1('0x9')][_0x36b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44e7b8,_0x3ff1d7,_0x11a9df){return new BPromise(function(_0x4964ef,_0x44b19b){return client[_0x36b1('0xb')](_0x44e7b8,_0x11a9df)[_0x36b1('0xc')](function(_0x5999fa){logger[_0x36b1('0xd')](_0x36b1('0xe'),_0x3ff1d7,_0x36b1('0xf'));logger[_0x36b1('0x10')](_0x36b1('0x11'),_0x3ff1d7,_0x36b1('0xf'),JSON[_0x36b1('0x12')](_0x5999fa));if(_0x5999fa['error']){if(_0x5999fa[_0x36b1('0x13')][_0x36b1('0x14')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3ff1d7,_0x5999fa[_0x36b1('0x13')][_0x36b1('0x15')]);return _0x44b19b(_0x5999fa[_0x36b1('0x13')]['message']);}logger[_0x36b1('0x13')](_0x36b1('0xe'),_0x3ff1d7,_0x5999fa['error']['message']);return _0x4964ef(_0x5999fa['error']['message']);}else{logger[_0x36b1('0xd')](_0x36b1('0xe'),_0x3ff1d7,_0x36b1('0xf'));_0x4964ef(_0x5999fa[_0x36b1('0x16')][_0x36b1('0x15')]);}})[_0x36b1('0x17')](function(_0x5828be){logger[_0x36b1('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3ff1d7,_0x5828be);_0x44b19b(_0x5828be);});});} \ No newline at end of file +var _0x17da=['stringify','code','error','message','result','catch','ChatOfflineMessage,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x3b3222,_0x3aab67){var _0xd1c9f5=function(_0x3c969d){while(--_0x3c969d){_0x3b3222['push'](_0x3b3222['shift']());}};_0xd1c9f5(++_0x3aab67);}(_0x17da,0x167));var _0xa17d=function(_0x3645cc,_0x25ba47){_0x3645cc=_0x3645cc-0x0;var _0x351979=_0x17da[_0x3645cc];return _0x351979;};'use strict';var _=require(_0xa17d('0x0'));var util=require('util');var moment=require(_0xa17d('0x1'));var BPromise=require(_0xa17d('0x2'));var rs=require(_0xa17d('0x3'));var fs=require('fs');var Redis=require(_0xa17d('0x4'));var db=require(_0xa17d('0x5'))['db'];var utils=require(_0xa17d('0x6'));var logger=require('../../config/logger')(_0xa17d('0x7'));var config=require('../../config/environment');var jayson=require(_0xa17d('0x8'));var client=jayson[_0xa17d('0x9')][_0xa17d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d0d8b,_0x237eef,_0x1762c8){return new BPromise(function(_0x26236f,_0x3af17c){return client[_0xa17d('0xb')](_0x4d0d8b,_0x1762c8)[_0xa17d('0xc')](function(_0x4b130f){logger[_0xa17d('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x237eef,_0xa17d('0xe'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x237eef,_0xa17d('0xe'),JSON[_0xa17d('0xf')](_0x4b130f));if(_0x4b130f['error']){if(_0x4b130f['error'][_0xa17d('0x10')]===0x1f4){logger[_0xa17d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x237eef,_0x4b130f[_0xa17d('0x11')][_0xa17d('0x12')]);return _0x3af17c(_0x4b130f[_0xa17d('0x11')][_0xa17d('0x12')]);}logger[_0xa17d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x237eef,_0x4b130f[_0xa17d('0x11')][_0xa17d('0x12')]);return _0x26236f(_0x4b130f[_0xa17d('0x11')][_0xa17d('0x12')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x237eef,'request\x20sent');_0x26236f(_0x4b130f[_0xa17d('0x13')][_0xa17d('0x12')]);}})[_0xa17d('0x14')](function(_0x5161aa){logger[_0xa17d('0x11')](_0xa17d('0x15'),_0x237eef,_0x5161aa);_0x3af17c(_0x5161aa);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 370e570..f5e419e 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 _0x1d83=['describe','post','create','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','index','get','/describe','isAuthenticated'];(function(_0x7b0bdf,_0x2c5ead){var _0x46c622=function(_0x52f1f7){while(--_0x52f1f7){_0x7b0bdf['push'](_0x7b0bdf['shift']());}};_0x46c622(++_0x2c5ead);}(_0x1d83,0x184));var _0x31d8=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0x1d83[_0x173113];return _0x3bea89;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x31d8('0x0'));var timeout=require(_0x31d8('0x1'));var express=require(_0x31d8('0x2'));var router=express[_0x31d8('0x3')]();var fs_extra=require(_0x31d8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x31d8('0x5'));var config=require(_0x31d8('0x6'));var controller=require(_0x31d8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x31d8('0x8')]);router[_0x31d8('0x9')](_0x31d8('0xa'),auth[_0x31d8('0xb')](),controller[_0x31d8('0xc')]);router[_0x31d8('0x9')]('/:id',auth[_0x31d8('0xb')](),controller['show']);router[_0x31d8('0xd')]('/',auth[_0x31d8('0xb')](),controller[_0x31d8('0xe')]);router['put'](_0x31d8('0xf'),auth[_0x31d8('0xb')](),controller[_0x31d8('0x10')]);router[_0x31d8('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x31d8('0x12')]);module[_0x31d8('0x13')]=router; \ No newline at end of file +var _0xa7fc=['../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x44aee4,_0x8a0f51){var _0x5d07af=function(_0x1449d9){while(--_0x1449d9){_0x44aee4['push'](_0x44aee4['shift']());}};_0x5d07af(++_0x8a0f51);}(_0xa7fc,0x193));var _0xca7f=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xa7fc[_0x4bc4c8];return _0x3bb121;};'use strict';var multer=require(_0xca7f('0x0'));var util=require(_0xca7f('0x1'));var path=require('path');var timeout=require(_0xca7f('0x2'));var express=require(_0xca7f('0x3'));var router=express['Router']();var fs_extra=require(_0xca7f('0x4'));var auth=require(_0xca7f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xca7f('0x6'));var controller=require(_0xca7f('0x7'));router[_0xca7f('0x8')]('/',auth[_0xca7f('0x9')](),controller[_0xca7f('0xa')]);router[_0xca7f('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xca7f('0xb')]);router[_0xca7f('0x8')](_0xca7f('0xc'),auth[_0xca7f('0x9')](),controller['show']);router['post']('/',auth[_0xca7f('0x9')](),controller['create']);router[_0xca7f('0xd')](_0xca7f('0xc'),auth['isAuthenticated'](),controller[_0xca7f('0xe')]);router[_0xca7f('0xf')](_0xca7f('0xc'),auth[_0xca7f('0x9')](),controller['destroy']);module[_0xca7f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 601a7ca..8d46492 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 _0x42cc=['STRING','ENUM','timeout','mouseOver','INTEGER','sequelize','exports'];(function(_0x3d7465,_0x213f3c){var _0x5c4d95=function(_0x9e61c0){while(--_0x9e61c0){_0x3d7465['push'](_0x3d7465['shift']());}};_0x5c4d95(++_0x213f3c);}(_0x42cc,0x178));var _0xc42c=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x42cc[_0x3a2a3c];return _0x50ac9a;};'use strict';var Sequelize=require(_0xc42c('0x0'));module[_0xc42c('0x1')]={'name':{'type':Sequelize[_0xc42c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc42c('0x3')]('mouseOver',_0xc42c('0x4')),'defaultValue':_0xc42c('0x5')},'selector':{'type':Sequelize[_0xc42c('0x2')]},'timeout':{'type':Sequelize[_0xc42c('0x6')]}}; \ No newline at end of file +var _0xe444=['mouseOver','timeout','sequelize','STRING'];(function(_0x3c7137,_0x4dc0c2){var _0x261fb0=function(_0x5b720){while(--_0x5b720){_0x3c7137['push'](_0x3c7137['shift']());}};_0x261fb0(++_0x4dc0c2);}(_0xe444,0x1be));var _0x4e44=function(_0x4e88a8,_0x2b067a){_0x4e88a8=_0x4e88a8-0x0;var _0xe3a4e3=_0xe444[_0x4e88a8];return _0xe3a4e3;};'use strict';var Sequelize=require(_0x4e44('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e44('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4e44('0x2'),_0x4e44('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x4e44('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 7c24332..d16feb4 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 _0x7a2d=['destroy','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','update','then'];(function(_0x1ad8d,_0x183ed3){var _0x38b2ff=function(_0x1f7467){while(--_0x1f7467){_0x1ad8d['push'](_0x1ad8d['shift']());}};_0x38b2ff(++_0x183ed3);}(_0x7a2d,0x142));var _0xd7a2=function(_0x3ec2ab,_0x419cf9){_0x3ec2ab=_0x3ec2ab-0x0;var _0xd88b13=_0x7a2d[_0x3ec2ab];return _0xd88b13;};'use strict';var emlformat=require(_0xd7a2('0x0'));var rimraf=require(_0xd7a2('0x1'));var zipdir=require(_0xd7a2('0x2'));var jsonpatch=require(_0xd7a2('0x3'));var rp=require(_0xd7a2('0x4'));var moment=require(_0xd7a2('0x5'));var BPromise=require(_0xd7a2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd7a2('0x7'));var sox=require(_0xd7a2('0x8'));var csv=require(_0xd7a2('0x9'));var ejs=require(_0xd7a2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7a2('0xb'));var squel=require(_0xd7a2('0xc'));var crypto=require(_0xd7a2('0xd'));var jsforce=require(_0xd7a2('0xe'));var deskjs=require(_0xd7a2('0xf'));var toCsv=require(_0xd7a2('0x9'));var querystring=require(_0xd7a2('0x10'));var Papa=require(_0xd7a2('0x11'));var Redis=require(_0xd7a2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd7a2('0x13'));var as=require(_0xd7a2('0x14'));var hardwareService=require(_0xd7a2('0x15'));var logger=require(_0xd7a2('0x16'))(_0xd7a2('0x17'));var utils=require(_0xd7a2('0x18'));var config=require(_0xd7a2('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x72ff99,_0x4d8a97){_0x4d8a97=_0x4d8a97||0xcc;return function(_0x58cde8){if(_0x58cde8){return _0x72ff99[_0xd7a2('0x1a')](_0x4d8a97);}return _0x72ff99[_0xd7a2('0x1b')](_0x4d8a97)[_0xd7a2('0x1c')]();};}function respondWithResult(_0x3724c5,_0x37f995){_0x37f995=_0x37f995||0xc8;return function(_0x42a6c5){if(_0x42a6c5){return _0x3724c5[_0xd7a2('0x1b')](_0x37f995)[_0xd7a2('0x1d')](_0x42a6c5);}};}function respondWithFilteredResult(_0x16e2d6,_0x292f64){return function(_0x47b226){if(_0x47b226){var _0x2dc1b7=typeof _0x292f64['offset']==='undefined'&&typeof _0x292f64[_0xd7a2('0x1e')]===_0xd7a2('0x1f');var _0x2e8c80=_0x47b226[_0xd7a2('0x20')];var _0x296784=_0x2dc1b7?0x0:_0x292f64[_0xd7a2('0x21')];var _0x510caa=_0x2dc1b7?_0x47b226['count']:_0x292f64[_0xd7a2('0x21')]+_0x292f64[_0xd7a2('0x1e')];var _0x2653b1;if(_0x510caa>=_0x2e8c80){_0x510caa=_0x2e8c80;_0x2653b1=0xc8;}else{_0x2653b1=0xce;}_0x16e2d6['status'](_0x2653b1);return _0x16e2d6['set'](_0xd7a2('0x22'),_0x296784+'-'+_0x510caa+'/'+_0x2e8c80)['json'](_0x47b226);}return null;};}function patchUpdates(_0x4f885a){return function(_0x217c19){try{jsonpatch['apply'](_0x217c19,_0x4f885a,!![]);}catch(_0x5b50d9){return BPromise[_0xd7a2('0x23')](_0x5b50d9);}return _0x217c19['save']();};}function saveUpdates(_0x5bd05f,_0x4fc69c){return function(_0x21da02){if(_0x21da02){return _0x21da02[_0xd7a2('0x24')](_0x5bd05f)[_0xd7a2('0x25')](function(_0x21be90){return _0x21be90;});}return null;};}function removeEntity(_0x2b17ca,_0x3a2be7){return function(_0x2bfde1){if(_0x2bfde1){return _0x2bfde1[_0xd7a2('0x26')]()[_0xd7a2('0x25')](function(){_0x2b17ca[_0xd7a2('0x1b')](0xcc)[_0xd7a2('0x1c')]();});}};}function handleEntityNotFound(_0x2601b3,_0x1c3580){return function(_0x5caa05){if(!_0x5caa05){_0x2601b3['sendStatus'](0x194);}return _0x5caa05;};}function handleError(_0x11a498,_0x52b1b4){_0x52b1b4=_0x52b1b4||0x1f4;return function(_0x41e24b){logger['error'](_0x41e24b[_0xd7a2('0x27')]);if(_0x41e24b[_0xd7a2('0x28')]){delete _0x41e24b[_0xd7a2('0x28')];}_0x11a498[_0xd7a2('0x1b')](_0x52b1b4)[_0xd7a2('0x29')](_0x41e24b);};}exports[_0xd7a2('0x2a')]=function(_0x1a69e4,_0x303dc5){var _0x43b81c={'raw':!![],'where':{'id':_0x1a69e4[_0xd7a2('0x2b')]['id']}},_0x410cce={};_0x410cce[_0xd7a2('0x2c')]=_[_0xd7a2('0x2d')](db[_0xd7a2('0x2e')][_0xd7a2('0x2f')]);_0x410cce['query']=_[_0xd7a2('0x2d')](_0x1a69e4[_0xd7a2('0x30')]);_0x410cce['filters']=_[_0xd7a2('0x31')](_0x410cce[_0xd7a2('0x2c')],_0x410cce['query']);_0x43b81c[_0xd7a2('0x32')]=_[_0xd7a2('0x31')](_0x410cce[_0xd7a2('0x2c')],qs['fields'](_0x1a69e4[_0xd7a2('0x30')][_0xd7a2('0x33')]));_0x43b81c[_0xd7a2('0x32')]=_0x43b81c['attributes'][_0xd7a2('0x34')]?_0x43b81c['attributes']:_0x410cce[_0xd7a2('0x2c')];if(_0x1a69e4[_0xd7a2('0x30')][_0xd7a2('0x35')]){_0x43b81c[_0xd7a2('0x36')]=[{'all':!![]}];}_0x43b81c=_['merge']({},_0x43b81c,_0x1a69e4[_0xd7a2('0x37')]);return db[_0xd7a2('0x2e')][_0xd7a2('0x38')](_0x43b81c)[_0xd7a2('0x25')](handleEntityNotFound(_0x303dc5,null))['then'](respondWithResult(_0x303dc5,null))[_0xd7a2('0x39')](handleError(_0x303dc5,null));};exports[_0xd7a2('0x3a')]=function(_0x2bd3a6,_0x446153){return db[_0xd7a2('0x2e')][_0xd7a2('0x3a')](_0x2bd3a6[_0xd7a2('0x3b')],{})[_0xd7a2('0x25')](respondWithResult(_0x446153,0xc9))[_0xd7a2('0x39')](handleError(_0x446153,null));};exports['update']=function(_0x356375,_0x475fae){if(_0x356375[_0xd7a2('0x3b')]['id']){delete _0x356375[_0xd7a2('0x3b')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x356375[_0xd7a2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x475fae,null))[_0xd7a2('0x25')](saveUpdates(_0x356375[_0xd7a2('0x3b')],null))['then'](respondWithResult(_0x475fae,null))[_0xd7a2('0x39')](handleError(_0x475fae,null));};exports[_0xd7a2('0x26')]=function(_0x189e21,_0x392ffe){return db[_0xd7a2('0x2e')][_0xd7a2('0x38')]({'where':{'id':_0x189e21[_0xd7a2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x392ffe,null))['then'](removeEntity(_0x392ffe,null))[_0xd7a2('0x39')](handleError(_0x392ffe,null));}; \ No newline at end of file +var _0xa990=['offset','limit','json','save','update','then','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count'];(function(_0xd5a77e,_0x784c86){var _0x414102=function(_0x313af7){while(--_0x313af7){_0xd5a77e['push'](_0xd5a77e['shift']());}};_0x414102(++_0x784c86);}(_0xa990,0xc9));var _0x0a99=function(_0x5d42e3,_0x241f86){_0x5d42e3=_0x5d42e3-0x0;var _0x2ed246=_0xa990[_0x5d42e3];return _0x2ed246;};'use strict';var emlformat=require(_0x0a99('0x0'));var rimraf=require(_0x0a99('0x1'));var zipdir=require(_0x0a99('0x2'));var jsonpatch=require(_0x0a99('0x3'));var rp=require(_0x0a99('0x4'));var moment=require(_0x0a99('0x5'));var BPromise=require(_0x0a99('0x6'));var Mustache=require(_0x0a99('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0a99('0x8'));var csv=require(_0x0a99('0x9'));var ejs=require(_0x0a99('0xa'));var fs=require('fs');var fs_extra=require(_0x0a99('0xb'));var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0x9'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a99('0x19'))['db'];function respondWithStatusCode(_0x3aaaad,_0x57ab88){_0x57ab88=_0x57ab88||0xcc;return function(_0xb6a34d){if(_0xb6a34d){return _0x3aaaad[_0x0a99('0x1a')](_0x57ab88);}return _0x3aaaad[_0x0a99('0x1b')](_0x57ab88)[_0x0a99('0x1c')]();};}function respondWithResult(_0x346061,_0x23d018){_0x23d018=_0x23d018||0xc8;return function(_0x18c124){if(_0x18c124){return _0x346061[_0x0a99('0x1b')](_0x23d018)['json'](_0x18c124);}};}function respondWithFilteredResult(_0x5a17e1,_0x2c40db){return function(_0x3ac17e){if(_0x3ac17e){var _0xb7356c=typeof _0x2c40db['offset']===_0x0a99('0x1d')&&typeof _0x2c40db['limit']==='undefined';var _0x20104c=_0x3ac17e[_0x0a99('0x1e')];var _0x3de006=_0xb7356c?0x0:_0x2c40db[_0x0a99('0x1f')];var _0x572ce5=_0xb7356c?_0x3ac17e['count']:_0x2c40db[_0x0a99('0x1f')]+_0x2c40db[_0x0a99('0x20')];var _0xbe23f3;if(_0x572ce5>=_0x20104c){_0x572ce5=_0x20104c;_0xbe23f3=0xc8;}else{_0xbe23f3=0xce;}_0x5a17e1[_0x0a99('0x1b')](_0xbe23f3);return _0x5a17e1['set']('Content-Range',_0x3de006+'-'+_0x572ce5+'/'+_0x20104c)[_0x0a99('0x21')](_0x3ac17e);}return null;};}function patchUpdates(_0x4d0c78){return function(_0x1e8d30){try{jsonpatch['apply'](_0x1e8d30,_0x4d0c78,!![]);}catch(_0x191ee4){return BPromise['reject'](_0x191ee4);}return _0x1e8d30[_0x0a99('0x22')]();};}function saveUpdates(_0x356681,_0x3b1d60){return function(_0x1c1e5c){if(_0x1c1e5c){return _0x1c1e5c[_0x0a99('0x23')](_0x356681)[_0x0a99('0x24')](function(_0x19c870){return _0x19c870;});}return null;};}function removeEntity(_0x1d803c,_0x398dd2){return function(_0x5745ca){if(_0x5745ca){return _0x5745ca['destroy']()[_0x0a99('0x24')](function(){_0x1d803c[_0x0a99('0x1b')](0xcc)[_0x0a99('0x1c')]();});}};}function handleEntityNotFound(_0x518617,_0x5d917c){return function(_0x371b31){if(!_0x371b31){_0x518617[_0x0a99('0x1a')](0x194);}return _0x371b31;};}function handleError(_0x1b0e94,_0x40e765){_0x40e765=_0x40e765||0x1f4;return function(_0x10e70f){logger[_0x0a99('0x25')](_0x10e70f[_0x0a99('0x26')]);if(_0x10e70f[_0x0a99('0x27')]){delete _0x10e70f[_0x0a99('0x27')];}_0x1b0e94['status'](_0x40e765)[_0x0a99('0x28')](_0x10e70f);};}exports['show']=function(_0x47bc34,_0x4e597b){var _0x223bdb={'raw':!![],'where':{'id':_0x47bc34[_0x0a99('0x29')]['id']}},_0x379c7e={};_0x379c7e[_0x0a99('0x2a')]=_[_0x0a99('0x2b')](db[_0x0a99('0x2c')][_0x0a99('0x2d')]);_0x379c7e['query']=_[_0x0a99('0x2b')](_0x47bc34[_0x0a99('0x2e')]);_0x379c7e[_0x0a99('0x2f')]=_[_0x0a99('0x30')](_0x379c7e['model'],_0x379c7e['query']);_0x223bdb['attributes']=_[_0x0a99('0x30')](_0x379c7e[_0x0a99('0x2a')],qs[_0x0a99('0x31')](_0x47bc34['query'][_0x0a99('0x31')]));_0x223bdb[_0x0a99('0x32')]=_0x223bdb[_0x0a99('0x32')][_0x0a99('0x33')]?_0x223bdb[_0x0a99('0x32')]:_0x379c7e[_0x0a99('0x2a')];if(_0x47bc34[_0x0a99('0x2e')]['includeAll']){_0x223bdb[_0x0a99('0x34')]=[{'all':!![]}];}_0x223bdb=_[_0x0a99('0x35')]({},_0x223bdb,_0x47bc34[_0x0a99('0x36')]);return db[_0x0a99('0x2c')][_0x0a99('0x37')](_0x223bdb)['then'](handleEntityNotFound(_0x4e597b,null))[_0x0a99('0x24')](respondWithResult(_0x4e597b,null))['catch'](handleError(_0x4e597b,null));};exports['create']=function(_0x5f20d0,_0x51b4ec){return db[_0x0a99('0x2c')]['create'](_0x5f20d0[_0x0a99('0x38')],{})[_0x0a99('0x24')](respondWithResult(_0x51b4ec,0xc9))[_0x0a99('0x39')](handleError(_0x51b4ec,null));};exports[_0x0a99('0x23')]=function(_0x414a0f,_0x43614d){if(_0x414a0f[_0x0a99('0x38')]['id']){delete _0x414a0f[_0x0a99('0x38')]['id'];}return db[_0x0a99('0x2c')][_0x0a99('0x37')]({'where':{'id':_0x414a0f[_0x0a99('0x29')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x43614d,null))[_0x0a99('0x24')](saveUpdates(_0x414a0f['body'],null))[_0x0a99('0x24')](respondWithResult(_0x43614d,null))[_0x0a99('0x39')](handleError(_0x43614d,null));};exports['destroy']=function(_0x3f0a9,_0x549bb9){return db[_0x0a99('0x2c')]['find']({'where':{'id':_0x3f0a9[_0x0a99('0x29')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x549bb9,null))[_0x0a99('0x24')](removeEntity(_0x549bb9,null))[_0x0a99('0x39')](handleError(_0x549bb9,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 520839f..3f93431 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 _0xc358=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','util','moment','bluebird','request-promise','path'];(function(_0x37af6d,_0x46340d){var _0x18c7e7=function(_0x5d7984){while(--_0x5d7984){_0x37af6d['push'](_0x37af6d['shift']());}};_0x18c7e7(++_0x46340d);}(_0xc358,0x181));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8c35('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8c35('0x1'));var BPromise=require(_0x8c35('0x2'));var rp=require(_0x8c35('0x3'));var fs=require('fs');var path=require(_0x8c35('0x4'));var rimraf=require('rimraf');var config=require(_0x8c35('0x5'));var attributes=require(_0x8c35('0x6'));module[_0x8c35('0x7')]=function(_0x347cc3,_0x3b54ef){return _0x347cc3[_0x8c35('0x8')](_0x8c35('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e95=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util'];(function(_0x1d3470,_0x35887b){var _0x11805f=function(_0x3e2bbc){while(--_0x3e2bbc){_0x1d3470['push'](_0x1d3470['shift']());}};_0x11805f(++_0x35887b);}(_0x1e95,0x82));var _0x51e9=function(_0x2ec5b2,_0x556ab2){_0x2ec5b2=_0x2ec5b2-0x0;var _0x384e32=_0x1e95[_0x2ec5b2];return _0x384e32;};'use strict';var _=require(_0x51e9('0x0'));var util=require(_0x51e9('0x1'));var logger=require(_0x51e9('0x2'))('api');var moment=require(_0x51e9('0x3'));var BPromise=require('bluebird');var rp=require(_0x51e9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51e9('0x5'));var config=require(_0x51e9('0x6'));var attributes=require(_0x51e9('0x7'));module[_0x51e9('0x8')]=function(_0x25ba5f,_0x52bc6d){return _0x25ba5f[_0x51e9('0x9')](_0x51e9('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index bb260e9..c79c514 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 _0x1064=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x17b5fc,_0x40f5c7){var _0x200cd6=function(_0x4260df){while(--_0x4260df){_0x17b5fc['push'](_0x17b5fc['shift']());}};_0x200cd6(++_0x40f5c7);}(_0x1064,0x1b4));var _0x4106=function(_0x2189b2,_0x22cb9b){_0x2189b2=_0x2189b2-0x0;var _0x405c93=_0x1064[_0x2189b2];return _0x405c93;};'use strict';var _=require('lodash');var util=require(_0x4106('0x0'));var moment=require(_0x4106('0x1'));var BPromise=require('bluebird');var rs=require(_0x4106('0x2'));var fs=require('fs');var Redis=require(_0x4106('0x3'));var db=require(_0x4106('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4106('0x5'))('rpc');var config=require(_0x4106('0x6'));var jayson=require(_0x4106('0x7'));var client=jayson[_0x4106('0x8')][_0x4106('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x421770,_0x1401d4,_0x316b5f){return new BPromise(function(_0x439b2a,_0x15ee9c){return client[_0x4106('0xa')](_0x421770,_0x316b5f)[_0x4106('0xb')](function(_0x536857){logger[_0x4106('0xc')](_0x4106('0xd'),_0x1401d4,_0x4106('0xe'));logger[_0x4106('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1401d4,_0x4106('0xe'),JSON[_0x4106('0x10')](_0x536857));if(_0x536857['error']){if(_0x536857[_0x4106('0x11')][_0x4106('0x12')]===0x1f4){logger[_0x4106('0x11')](_0x4106('0xd'),_0x1401d4,_0x536857[_0x4106('0x11')][_0x4106('0x13')]);return _0x15ee9c(_0x536857[_0x4106('0x11')][_0x4106('0x13')]);}logger[_0x4106('0x11')](_0x4106('0xd'),_0x1401d4,_0x536857[_0x4106('0x11')][_0x4106('0x13')]);return _0x439b2a(_0x536857['error'][_0x4106('0x13')]);}else{logger[_0x4106('0xc')](_0x4106('0xd'),_0x1401d4,_0x4106('0xe'));_0x439b2a(_0x536857[_0x4106('0x14')][_0x4106('0x13')]);}})[_0x4106('0x15')](function(_0x33a31c){logger[_0x4106('0x11')](_0x4106('0xd'),_0x1401d4,_0x33a31c);_0x15ee9c(_0x33a31c);});});} \ No newline at end of file +var _0x2b63=['../../config/environment','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','rpc'];(function(_0x44c121,_0x33575f){var _0xd56571=function(_0xdb3f72){while(--_0xdb3f72){_0x44c121['push'](_0x44c121['shift']());}};_0xd56571(++_0x33575f);}(_0x2b63,0x9a));var _0x32b6=function(_0x200281,_0x1718a6){_0x200281=_0x200281-0x0;var _0x5bd5aa=_0x2b63[_0x200281];return _0x5bd5aa;};'use strict';var _=require(_0x32b6('0x0'));var util=require(_0x32b6('0x1'));var moment=require('moment');var BPromise=require(_0x32b6('0x2'));var rs=require(_0x32b6('0x3'));var fs=require('fs');var Redis=require(_0x32b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x32b6('0x5'));var config=require(_0x32b6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x32b6('0x7')][_0x32b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x968a5,_0x47e18f,_0x3fe795){return new BPromise(function(_0x45ca73,_0xd41ab8){return client[_0x32b6('0x9')](_0x968a5,_0x3fe795)['then'](function(_0x40e230){logger[_0x32b6('0xa')](_0x32b6('0xb'),_0x47e18f,_0x32b6('0xc'));logger[_0x32b6('0xd')](_0x32b6('0xe'),_0x47e18f,_0x32b6('0xc'),JSON[_0x32b6('0xf')](_0x40e230));if(_0x40e230[_0x32b6('0x10')]){if(_0x40e230[_0x32b6('0x10')][_0x32b6('0x11')]===0x1f4){logger[_0x32b6('0x10')](_0x32b6('0xb'),_0x47e18f,_0x40e230[_0x32b6('0x10')]['message']);return _0xd41ab8(_0x40e230['error'][_0x32b6('0x12')]);}logger[_0x32b6('0x10')](_0x32b6('0xb'),_0x47e18f,_0x40e230[_0x32b6('0x10')][_0x32b6('0x12')]);return _0x45ca73(_0x40e230['error']['message']);}else{logger[_0x32b6('0xa')](_0x32b6('0xb'),_0x47e18f,_0x32b6('0xc'));_0x45ca73(_0x40e230[_0x32b6('0x13')][_0x32b6('0x12')]);}})['catch'](function(_0x1f4af6){logger[_0x32b6('0x10')](_0x32b6('0xb'),_0x47e18f,_0x1f4af6);_0xd41ab8(_0x1f4af6);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 14a6cf6..321c4fa 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 _0x53ec=['create','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','/:id','show','post'];(function(_0x4eb983,_0x413e72){var _0xab8c80=function(_0x3b571b){while(--_0x3b571b){_0x4eb983['push'](_0x4eb983['shift']());}};_0xab8c80(++_0x413e72);}(_0x53ec,0x192));var _0xc53e=function(_0x58952f,_0xeed25f){_0x58952f=_0x58952f-0x0;var _0x3217ca=_0x53ec[_0x58952f];return _0x3217ca;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get'](_0xc53e('0x9'),auth['isAuthenticated'](),controller[_0xc53e('0xa')]);router[_0xc53e('0xb')]('/',auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xd')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0x11')]);module['exports']=router; \ No newline at end of file +var _0xed1f=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x11a289,_0x54b41c){var _0x224679=function(_0x4c972c){while(--_0x4c972c){_0x11a289['push'](_0x11a289['shift']());}};_0x224679(++_0x54b41c);}(_0xed1f,0x6a));var _0xfed1=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xed1f[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xf')]('/',auth[_0xfed1('0xd')](),controller[_0xfed1('0x10')]);router['put'](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller['update']);router[_0xfed1('0x11')](_0xfed1('0xc'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 1c89eb9..75d0eef 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 _0x86a7=['STRING','INTEGER','ENUM','rrmemory','sequelize','exports','name'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x86a7,0x17e));var _0x786a=function(_0x379f38,_0x32be37){_0x379f38=_0x379f38-0x0;var _0x2656c7=_0x86a7[_0x379f38];return _0x2656c7;};'use strict';var Sequelize=require(_0x786a('0x0'));module[_0x786a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x786a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x786a('0x3')]},'timeout':{'type':Sequelize[_0x786a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x786a('0x5')](_0x786a('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x928b=['sequelize','exports','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x10e447,_0xdfafd3){var _0x538d79=function(_0x3e8d6b){while(--_0x3e8d6b){_0x10e447['push'](_0x10e447['shift']());}};_0x538d79(++_0xdfafd3);}(_0x928b,0x11f));var _0xb928=function(_0x173c6f,_0x31fbfb){_0x173c6f=_0x173c6f-0x0;var _0x39fd7f=_0x928b[_0x173c6f];return _0x39fd7f;};'use strict';var Sequelize=require(_0xb928('0x0'));module[_0xb928('0x1')]={'name':{'type':Sequelize[_0xb928('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb928('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb928('0x3')](_0xb928('0x4'),_0xb928('0x5'),_0xb928('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 03153c0..fc38faf 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 _0x2abb=['bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','sendStatus','error','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','include','query','findAll','rows','show','params','model','keys','attributes','fields','length','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','filters','intersection','hasOwnProperty','nolimit','order','where','pick','filter','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','sort','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents'];(function(_0x5a5898,_0x439570){var _0x216a8f=function(_0x506677){while(--_0x506677){_0x5a5898['push'](_0x5a5898['shift']());}};_0x216a8f(++_0x439570);}(_0x2abb,0x177));var _0xb2ab=function(_0x31352c,_0x277486){_0x31352c=_0x31352c-0x0;var _0x456046=_0x2abb[_0x31352c];return _0x456046;};'use strict';var BPromise=require(_0xb2ab('0x0'));var util=require('util');var _=require(_0xb2ab('0x1'));var squel=require(_0xb2ab('0x2'));var Redis=require(_0xb2ab('0x3'));var qs=require(_0xb2ab('0x4'));var logger=require(_0xb2ab('0x5'))(_0xb2ab('0x6'));var config=require(_0xb2ab('0x7'));var db=require(_0xb2ab('0x8'))['db'];config[_0xb2ab('0x9')]=_[_0xb2ab('0xa')](config[_0xb2ab('0x9')],{'host':_0xb2ab('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb2ab('0x9')]));require(_0xb2ab('0xc'))[_0xb2ab('0xd')](socket);function respondWithStatusCode(_0x1751a5,_0x24764a){_0x24764a=_0x24764a||0xcc;return function(_0x47bcdd){if(_0x47bcdd){return _0x1751a5['sendStatus'](_0x24764a);}return _0x1751a5['status'](_0x24764a)[_0xb2ab('0xe')]();};}function respondWithResult(_0x1f1abe,_0x5cff2e){_0x5cff2e=_0x5cff2e||0xc8;return function(_0x467ca9){if(_0x467ca9){return _0x1f1abe[_0xb2ab('0xf')](_0x5cff2e)[_0xb2ab('0x10')](_0x467ca9);}};}function respondWithFilteredResult(_0x3633fc,_0x22febe){return function(_0x385971){if(_0x385971){var _0x7340f8=typeof _0x22febe[_0xb2ab('0x11')]===_0xb2ab('0x12')&&typeof _0x22febe[_0xb2ab('0x13')]==='undefined';var _0x42233b=_0x385971[_0xb2ab('0x14')];var _0x4aa755=_0x7340f8?0x0:_0x22febe['offset'];var _0x4f8e86=_0x7340f8?_0x385971['count']:_0x22febe['offset']+_0x22febe[_0xb2ab('0x13')];var _0x38814a;if(_0x4f8e86>=_0x42233b){_0x4f8e86=_0x42233b;_0x38814a=0xc8;}else{_0x38814a=0xce;}_0x3633fc[_0xb2ab('0xf')](_0x38814a);return _0x3633fc[_0xb2ab('0x15')](_0xb2ab('0x16'),_0x4aa755+'-'+_0x4f8e86+'/'+_0x42233b)[_0xb2ab('0x10')](_0x385971);}return null;};}function saveUpdates(_0x208c44){return function(_0x5efbbe){if(_0x5efbbe){return _0x5efbbe[_0xb2ab('0x17')](_0x208c44)[_0xb2ab('0x18')](function(_0x1ae153){return _0x1ae153;});}return null;};}function removeEntity(_0x1c4767){return function(_0x285ad2){if(_0x285ad2){return _0x285ad2[_0xb2ab('0x19')]()[_0xb2ab('0x18')](function(){var _0x133fd1=_0x285ad2[_0xb2ab('0x1a')]({'plain':!![]});var _0x48e22b=_0xb2ab('0x1b');return db[_0xb2ab('0x1c')][_0xb2ab('0x19')]({'where':{'type':_0x48e22b,'resourceId':_0x133fd1['id']}})[_0xb2ab('0x18')](function(){return _0x285ad2;});})[_0xb2ab('0x18')](function(){_0x1c4767['status'](0xcc)[_0xb2ab('0xe')]();});}};}function handleEntityNotFound(_0x2d2f6b){return function(_0x1d575e){if(!_0x1d575e){_0x2d2f6b[_0xb2ab('0x1d')](0x194);}return _0x1d575e;};}function handleError(_0xcb83c5,_0x160f3e){_0x160f3e=_0x160f3e||0x1f4;return function(_0x4e3d32){logger[_0xb2ab('0x1e')](_0x4e3d32['stack']);if(_0x4e3d32[_0xb2ab('0x1f')]){delete _0x4e3d32[_0xb2ab('0x1f')];}_0xcb83c5[_0xb2ab('0xf')](_0x160f3e)[_0xb2ab('0x20')](_0x4e3d32);};}exports['index']=function(_0x364842,_0x520c71){var _0x5dcdc3={};var _0x499686={'count':0x0,'rows':[]};var _0x24f9f5=_[_0xb2ab('0x21')](db[_0xb2ab('0x22')][_0xb2ab('0x23')],function(_0x46feaa){return{'name':_0x46feaa[_0xb2ab('0x24')],'type':_0x46feaa[_0xb2ab('0x25')][_0xb2ab('0x26')]};});_0x5dcdc3=qs['getOptions'](_0x24f9f5,_0x364842);var _0x16c16c={'where':_0x5dcdc3['where']};return db[_0xb2ab('0x22')][_0xb2ab('0x14')](_0x16c16c)[_0xb2ab('0x18')](function(_0x2c5f8c){_0x499686['count']=_0x2c5f8c;_0x5dcdc3[_0xb2ab('0x27')]=qs[_0xb2ab('0x27')](_0x364842[_0xb2ab('0x28')]);return db[_0xb2ab('0x22')][_0xb2ab('0x29')](_0x5dcdc3);})[_0xb2ab('0x18')](function(_0x36fb16){_0x499686[_0xb2ab('0x2a')]=_0x36fb16;return _0x499686;})[_0xb2ab('0x18')](respondWithFilteredResult(_0x520c71,_0x5dcdc3))['catch'](handleError(_0x520c71,null));};exports[_0xb2ab('0x2b')]=function(_0xfefcdc,_0x5f0661){var _0x373115={'raw':!![],'where':{'id':_0xfefcdc[_0xb2ab('0x2c')]['id']}},_0x183359={};_0x183359[_0xb2ab('0x2d')]=_[_0xb2ab('0x2e')](db[_0xb2ab('0x22')]['rawAttributes']);_0x183359[_0xb2ab('0x28')]=_[_0xb2ab('0x2e')](_0xfefcdc['query']);_0x183359['filters']=_['intersection'](_0x183359[_0xb2ab('0x2d')],_0x183359[_0xb2ab('0x28')]);_0x373115[_0xb2ab('0x2f')]=_['intersection'](_0x183359[_0xb2ab('0x2d')],qs[_0xb2ab('0x30')](_0xfefcdc[_0xb2ab('0x28')]['fields']));_0x373115[_0xb2ab('0x2f')]=_0x373115[_0xb2ab('0x2f')][_0xb2ab('0x31')]?_0x373115[_0xb2ab('0x2f')]:_0x183359[_0xb2ab('0x2d')];if(_0xfefcdc[_0xb2ab('0x28')]['includeAll']){_0x373115['include']=[{'all':!![]}];}_0x373115=_[_0xb2ab('0x32')]({},_0x373115,_0xfefcdc[_0xb2ab('0x33')]);return db[_0xb2ab('0x22')][_0xb2ab('0x34')](_0x373115)['then'](handleEntityNotFound(_0x5f0661,null))[_0xb2ab('0x18')](respondWithResult(_0x5f0661,null))[_0xb2ab('0x35')](handleError(_0x5f0661,null));};exports[_0xb2ab('0x36')]=function(_0x363e5d,_0x569bf3){return db[_0xb2ab('0x22')]['create'](_0x363e5d[_0xb2ab('0x37')],{})[_0xb2ab('0x18')](function(_0x50fe03){var _0x3c6414=_0x363e5d['user'][_0xb2ab('0x1a')]({'plain':!![]});if(!_0x3c6414)throw new Error(_0xb2ab('0x38'));if(_0x3c6414[_0xb2ab('0x39')]===_0xb2ab('0x3a')){var _0x5f1b84=_0x50fe03[_0xb2ab('0x1a')]({'plain':!![]});var _0x3b879c=_0xb2ab('0x1b');return db[_0xb2ab('0x3b')][_0xb2ab('0x34')]({'where':{'name':_0x3b879c,'userProfileId':_0x3c6414[_0xb2ab('0x3c')]},'raw':!![]})['then'](function(_0x57c599){if(_0x57c599&&_0x57c599['autoAssociation']===0x0){return db['UserProfileResource'][_0xb2ab('0x36')]({'name':_0x5f1b84['name'],'resourceId':_0x5f1b84['id'],'type':_0x57c599[_0xb2ab('0x1f')],'sectionId':_0x57c599['id']},{})['then'](function(){return _0x50fe03;});}else{return _0x50fe03;}})[_0xb2ab('0x35')](function(_0x5c3fbe){logger[_0xb2ab('0x1e')](_0xb2ab('0x3d'),_0x5c3fbe);throw _0x5c3fbe;});}return _0x50fe03;})[_0xb2ab('0x18')](respondWithResult(_0x569bf3,0xc9))[_0xb2ab('0x35')](handleError(_0x569bf3,null));};exports['update']=function(_0x5bacf0,_0x59305c){if(_0x5bacf0[_0xb2ab('0x37')]['id']){delete _0x5bacf0[_0xb2ab('0x37')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x5bacf0[_0xb2ab('0x2c')]['id']}})[_0xb2ab('0x18')](handleEntityNotFound(_0x59305c,null))[_0xb2ab('0x18')](saveUpdates(_0x5bacf0['body'],null))[_0xb2ab('0x18')](respondWithResult(_0x59305c,null))[_0xb2ab('0x35')](handleError(_0x59305c,null));};exports[_0xb2ab('0x19')]=function(_0x356bde,_0x89b6dc){return db[_0xb2ab('0x22')]['find']({'where':{'id':_0x356bde[_0xb2ab('0x2c')]['id']}})[_0xb2ab('0x18')](handleEntityNotFound(_0x89b6dc,null))[_0xb2ab('0x18')](removeEntity(_0x89b6dc,null))[_0xb2ab('0x35')](handleError(_0x89b6dc,null));};exports[_0xb2ab('0x3e')]=function(_0x36528e,_0x540d97){return db[_0xb2ab('0x22')]['describe']()[_0xb2ab('0x18')](respondWithResult(_0x540d97,null))[_0xb2ab('0x35')](handleError(_0x540d97,null));};exports[_0xb2ab('0x3f')]=function(_0x208914,_0x268924){var _0x3eaea2={'raw':!![],'where':{}},_0x3e1aed={},_0x3f854f;return db['ChatQueue'][_0xb2ab('0x40')]({'where':{'id':_0x208914[_0xb2ab('0x2c')]['id']}})['then'](handleEntityNotFound(_0x268924,null))['then'](function(_0x1cf50f){if(_0x1cf50f){_0x3f854f=_0x1cf50f[_0xb2ab('0x1a')]({'plain':!![]});_0x3e1aed[_0xb2ab('0x2d')]=_[_0xb2ab('0x2e')](db['UserChatQueue']['rawAttributes']);_0x3e1aed['query']=_[_0xb2ab('0x2e')](_0x208914['query']);_0x3e1aed[_0xb2ab('0x41')]=_[_0xb2ab('0x42')](_0x3e1aed['model'],_0x3e1aed['query']);_0x3eaea2['attributes']=_[_0xb2ab('0x42')](_0x3e1aed[_0xb2ab('0x2d')],qs[_0xb2ab('0x30')](_0x208914[_0xb2ab('0x28')][_0xb2ab('0x30')]));_0x3eaea2[_0xb2ab('0x2f')]=_0x3eaea2[_0xb2ab('0x2f')][_0xb2ab('0x31')]?_0x3eaea2[_0xb2ab('0x2f')]:_0x3e1aed[_0xb2ab('0x2d')];if(!_0x208914[_0xb2ab('0x28')][_0xb2ab('0x43')](_0xb2ab('0x44'))){_0x3eaea2[_0xb2ab('0x13')]=qs[_0xb2ab('0x13')](_0x208914[_0xb2ab('0x28')][_0xb2ab('0x13')]);_0x3eaea2[_0xb2ab('0x11')]=qs['offset'](_0x208914[_0xb2ab('0x28')][_0xb2ab('0x11')]);}_0x3eaea2[_0xb2ab('0x45')]=qs['sort'](_0x208914[_0xb2ab('0x28')]['sort']);_0x3eaea2[_0xb2ab('0x46')]=qs['filters'](_[_0xb2ab('0x47')](_0x208914['query'],_0x3e1aed[_0xb2ab('0x41')]));_0x3eaea2[_0xb2ab('0x46')]['ChatQueueId']=_0x1cf50f['id'];if(_0x208914[_0xb2ab('0x28')][_0xb2ab('0x48')]){_0x3eaea2[_0xb2ab('0x46')]=_['merge'](_0x3eaea2[_0xb2ab('0x46')],{'$or':_[_0xb2ab('0x21')](_0x3eaea2[_0xb2ab('0x2f')],function(_0x3a88d2){var _0x42da66={};_0x42da66[_0x3a88d2]={'$like':'%'+_0x208914['query'][_0xb2ab('0x48')]+'%'};return _0x42da66;})});}_0x3eaea2=_[_0xb2ab('0x32')]({},_0x3eaea2,_0x208914[_0xb2ab('0x33')]);return db[_0xb2ab('0x49')]['findAll'](_0x3eaea2);}})[_0xb2ab('0x18')](function(_0x4ec8d9){if(_0x4ec8d9){return db[_0xb2ab('0x4a')][_0xb2ab('0x4b')]({'where':{'id':_['map'](_0x4ec8d9,_0xb2ab('0x4c')),'role':_0xb2ab('0x4d')},'attributes':['id',_0xb2ab('0x1f'),_0xb2ab('0x4e'),_0xb2ab('0x4f'),_0xb2ab('0x50')]});}})[_0xb2ab('0x18')](function(_0x540ae8){if(_0x540ae8){return{'count':_0x540ae8[_0xb2ab('0x14')],'rows':_[_0xb2ab('0x21')](_0x540ae8[_0xb2ab('0x2a')],function(_0x380ece){return{'membername':_0x380ece['name'],'UserId':_0x380ece['id'],'queue_name':_0x3f854f['name'],'ChatQueueId':_0x3f854f['id'],'interface':util['format'](_0xb2ab('0x51'),_0xb2ab('0x52'),_0x380ece[_0xb2ab('0x1f')]),'penalty':0x0,'paused':_0x380ece[_0xb2ab('0x4e')],'createdAt':_0x380ece[_0xb2ab('0x50')],'updatedAt':_0x380ece[_0xb2ab('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb2ab('0x18')](respondWithFilteredResult(_0x268924,_0x3eaea2))[_0xb2ab('0x35')](handleError(_0x268924,null));};exports[_0xb2ab('0x53')]=function(_0x4f09dc,_0x9af016){var _0x43b983={};var _0x1e822d={};var _0x4d8bd5;var _0x1cf9f7;return db[_0xb2ab('0x22')][_0xb2ab('0x40')]({'where':{'id':_0x4f09dc['params']['id']}})[_0xb2ab('0x18')](handleEntityNotFound(_0x9af016,null))['then'](function(_0x3af08d){if(_0x3af08d){_0x4d8bd5=_0x3af08d;_0x1e822d[_0xb2ab('0x2d')]=_[_0xb2ab('0x2e')](db[_0xb2ab('0x54')][_0xb2ab('0x23')]);_0x1e822d[_0xb2ab('0x28')]=_[_0xb2ab('0x2e')](_0x4f09dc['query']);_0x1e822d['filters']=_[_0xb2ab('0x42')](_0x1e822d[_0xb2ab('0x2d')],_0x1e822d[_0xb2ab('0x28')]);_0x43b983[_0xb2ab('0x2f')]=_[_0xb2ab('0x42')](_0x1e822d['model'],qs['fields'](_0x4f09dc[_0xb2ab('0x28')][_0xb2ab('0x30')]));_0x43b983[_0xb2ab('0x2f')]=_0x43b983[_0xb2ab('0x2f')][_0xb2ab('0x31')]?_0x43b983['attributes']:_0x1e822d['model'];_0x43b983[_0xb2ab('0x45')]=qs[_0xb2ab('0x55')](_0x4f09dc[_0xb2ab('0x28')][_0xb2ab('0x55')]);_0x43b983[_0xb2ab('0x46')]=qs['filters'](_[_0xb2ab('0x47')](_0x4f09dc[_0xb2ab('0x28')],_0x1e822d[_0xb2ab('0x41')]));if(_0x4f09dc[_0xb2ab('0x28')][_0xb2ab('0x48')]){_0x43b983[_0xb2ab('0x46')]=_['merge'](_0x43b983[_0xb2ab('0x46')],{'$or':_[_0xb2ab('0x21')](_0x43b983['attributes'],function(_0x527937){var _0x9557ec={};_0x9557ec[_0x527937]={'$like':'%'+_0x4f09dc[_0xb2ab('0x28')]['filter']+'%'};return _0x9557ec;})});}_0x43b983=_[_0xb2ab('0x32')]({},_0x43b983,_0x4f09dc['options']);return _0x4d8bd5['getTeams'](_0x43b983);}})[_0xb2ab('0x18')](function(_0x2e0404){if(_0x2e0404){_0x1cf9f7=_0x2e0404['length'];if(!_0x4f09dc['query'][_0xb2ab('0x43')](_0xb2ab('0x44'))){_0x43b983[_0xb2ab('0x13')]=qs[_0xb2ab('0x13')](_0x4f09dc[_0xb2ab('0x28')][_0xb2ab('0x13')]);_0x43b983[_0xb2ab('0x11')]=qs[_0xb2ab('0x11')](_0x4f09dc[_0xb2ab('0x28')][_0xb2ab('0x11')]);}return _0x4d8bd5[_0xb2ab('0x53')](_0x43b983);}})[_0xb2ab('0x18')](function(_0x218c61){if(_0x218c61){return _0x218c61?{'count':_0x1cf9f7,'rows':_0x218c61}:null;}})[_0xb2ab('0x18')](respondWithResult(_0x9af016,null))[_0xb2ab('0x35')](handleError(_0x9af016,null));};exports[_0xb2ab('0x56')]=function(_0x341729,_0x2b1684){var _0x5d8235=_0x341729[_0xb2ab('0x37')][_0xb2ab('0x57')];return db[_0xb2ab('0x54')][_0xb2ab('0x29')]({'where':{'id':_0x5d8235},'attributes':['id'],'include':[{'model':db[_0xb2ab('0x4a')],'as':'Agents','attributes':['id',_0xb2ab('0x1f'),_0xb2ab('0x58'),_0xb2ab('0x59'),_0xb2ab('0x5a')],'raw':!![]}]})[_0xb2ab('0x18')](function(_0x99781c){if(_0x99781c){var _0x242166=_[_0xb2ab('0x5b')](_0x99781c,function(_0x4679cb){var _0x52dd06=_0x4679cb[_0xb2ab('0x1a')]({'plain':!![]});return _0x52dd06[_0xb2ab('0x5c')];});return db[_0xb2ab('0x22')][_0xb2ab('0x34')]({'where':{'id':_0x341729[_0xb2ab('0x2c')]['id']}})[_0xb2ab('0x18')](function(_0x530e66){return db[_0xb2ab('0x5d')][_0xb2ab('0x5e')](function(_0x19335e){return _0x530e66[_0xb2ab('0x56')](_0x5d8235,{'transaction':_0x19335e})[_0xb2ab('0x18')](function(){return BPromise[_0xb2ab('0x5f')](_0x242166,function(_0x35ae98){return db[_0xb2ab('0x49')]['findOrCreate']({'where':{'UserId':_0x35ae98['id'],'ChatQueueId':_0x341729[_0xb2ab('0x2c')]['id']},'transaction':_0x19335e});});})[_0xb2ab('0x18')](function(){_0x242166[_0xb2ab('0x60')](function(_0x10d0ec){socket[_0xb2ab('0x61')](_0xb2ab('0x62'),{'UserId':_0x10d0ec['id'],'ChatQueueId':_0x530e66['id']});});});});});}})[_0xb2ab('0x18')](respondWithStatusCode(_0x2b1684,null))[_0xb2ab('0x35')](handleError(_0x2b1684,null));};exports[_0xb2ab('0x63')]=function(_0x549435,_0x416c73){return db[_0xb2ab('0x54')][_0xb2ab('0x29')]({'where':{'id':_0x549435['query'][_0xb2ab('0x57')]},'attributes':['id'],'include':[{'model':db[_0xb2ab('0x4a')],'as':_0xb2ab('0x5c'),'attributes':['id'],'raw':!![]}]})[_0xb2ab('0x18')](handleEntityNotFound(_0x416c73,null))[_0xb2ab('0x18')](function(_0x4f31b2){var _0x2a1645=_[_0xb2ab('0x21')](_0x4f31b2,'id');var _0x2ae929=[];var _0x232645=[];var _0xd6e56a=squel[_0xb2ab('0x64')]();_0xd6e56a[_0xb2ab('0x65')](_0xb2ab('0x66'))[_0xb2ab('0x67')](_0xb2ab('0x68'),'tq')[_0xb2ab('0x69')](_0xb2ab('0x6a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb2ab('0x46')](_0xb2ab('0x6b'),_0x549435[_0xb2ab('0x2c')]['id']);for(var _0xa7526c=0x0;_0xa7526c<_0x4f31b2['length'];_0xa7526c+=0x1){let _0x59bdae=_0x4f31b2[_0xa7526c];for(var _0x111582=0x0;_0x111582<_0x59bdae[_0xb2ab('0x5c')]['length'];_0x111582+=0x1){let _0x9a8faf=_0x59bdae[_0xb2ab('0x5c')][_0x111582];var _0x485fd7=_0xd6e56a[_0xb2ab('0x6c')]();_0x485fd7[_0xb2ab('0x46')](_0xb2ab('0x6d'),_0x9a8faf['id']);_0x232645[_0xb2ab('0x6e')](db[_0xb2ab('0x5d')][_0xb2ab('0x28')](_0x485fd7[_0xb2ab('0x6f')](),{'type':db[_0xb2ab('0x5d')][_0xb2ab('0x70')]['SELECT']})['then'](function(_0x50c56e){if(_0x50c56e[_0xb2ab('0x31')]===0x1){return _0x9a8faf['id'];}else{var _0x1d850e=_['every'](_['map'](_0x50c56e,_0xb2ab('0x71')),function(_0x534899){return _[_0xb2ab('0x72')](_0x2a1645,_0x534899);});if(_0x1d850e){return _0x9a8faf['id'];}}}));}}return BPromise['all'](_0x232645)[_0xb2ab('0x18')](function(_0x4e33c8){_0x2ae929=_(_0x2ae929)[_0xb2ab('0x73')](_0x4e33c8)[_0xb2ab('0x74')]()['value']();return db[_0xb2ab('0x22')][_0xb2ab('0x34')]({'where':{'id':_0x549435[_0xb2ab('0x2c')]['id']}})[_0xb2ab('0x18')](function(_0x4b2f40){return db[_0xb2ab('0x5d')][_0xb2ab('0x5e')](function(_0x4c00da){return _0x4b2f40['removeTeams'](_0x549435['query']['ids'],{'transaction':_0x4c00da})['then'](function(){if(!_[_0xb2ab('0x75')](_0x2ae929)){return _0x4b2f40[_0xb2ab('0x76')](_0x2ae929,{'transaction':_0x4c00da});}})[_0xb2ab('0x18')](function(){_0x2ae929['forEach'](function(_0x4d3b38){socket[_0xb2ab('0x61')](_0xb2ab('0x77'),{'UserId':_0x4d3b38,'ChatQueueId':_0x4b2f40['id']});});});});});});})[_0xb2ab('0x18')](respondWithStatusCode(_0x416c73,null))[_0xb2ab('0x35')](handleError(_0x416c73,null));};exports[_0xb2ab('0x78')]=function(_0x3bc7ae,_0x550196){return db['ChatQueue'][_0xb2ab('0x34')]({'where':{'id':_0x3bc7ae['params']['id']}})[_0xb2ab('0x18')](handleEntityNotFound(_0x550196,null))['then'](function(_0x58f036){if(_0x58f036){return _0x58f036[_0xb2ab('0x78')](_0x3bc7ae[_0xb2ab('0x37')][_0xb2ab('0x57')],_[_0xb2ab('0x79')](_0x3bc7ae[_0xb2ab('0x37')],[_0xb2ab('0x57'),'id'])||{})[_0xb2ab('0x7a')](function(_0x33be8b){for(var _0x2e4aef=0x0;_0x2e4aef<_0x3bc7ae[_0xb2ab('0x37')][_0xb2ab('0x57')][_0xb2ab('0x31')];_0x2e4aef+=0x1){socket[_0xb2ab('0x61')](_0xb2ab('0x62'),{'UserId':Number(_0x3bc7ae[_0xb2ab('0x37')][_0xb2ab('0x57')][_0x2e4aef]),'ChatQueueId':Number(_0x3bc7ae[_0xb2ab('0x2c')]['id'])});}return _0x33be8b;});}})['then'](respondWithResult(_0x550196,null))[_0xb2ab('0x35')](handleError(_0x550196,null));};exports[_0xb2ab('0x76')]=function(_0x175b74,_0x22092c){return db['ChatQueue'][_0xb2ab('0x34')]({'where':{'id':_0x175b74[_0xb2ab('0x2c')]['id']}})[_0xb2ab('0x18')](handleEntityNotFound(_0x22092c,null))[_0xb2ab('0x18')](function(_0x24cca5){if(_0x24cca5){return _0x24cca5[_0xb2ab('0x76')](_0x175b74[_0xb2ab('0x28')][_0xb2ab('0x57')])[_0xb2ab('0x18')](function(){if(_[_0xb2ab('0x7b')](_0x175b74[_0xb2ab('0x28')][_0xb2ab('0x57')])){for(var _0x120b31=0x0;_0x120b31<_0x175b74['query'][_0xb2ab('0x57')]['length'];_0x120b31+=0x1){socket['emit'](_0xb2ab('0x77'),{'UserId':Number(_0x175b74[_0xb2ab('0x28')]['ids'][_0x120b31]),'ChatQueueId':Number(_0x175b74[_0xb2ab('0x2c')]['id'])});}}else{socket['emit'](_0xb2ab('0x77'),{'UserId':Number(_0x175b74[_0xb2ab('0x28')][_0xb2ab('0x57')]),'ChatQueueId':Number(_0x175b74[_0xb2ab('0x2c')]['id'])});}});}})[_0xb2ab('0x18')](respondWithStatusCode(_0x22092c,null))[_0xb2ab('0x35')](handleError(_0x22092c,null));};exports['getAgents']=function(_0x97cfb7,_0x4ced3d){var _0x5a00e8={};var _0x3336c6={};var _0x25724e;var _0x2dc079;return db[_0xb2ab('0x22')]['findOne']({'where':{'id':_0x97cfb7[_0xb2ab('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4ced3d,null))[_0xb2ab('0x18')](function(_0x29f2bd){if(_0x29f2bd){_0x25724e=_0x29f2bd;_0x3336c6[_0xb2ab('0x2d')]=_[_0xb2ab('0x2e')](db[_0xb2ab('0x4a')][_0xb2ab('0x23')]);_0x3336c6['query']=_['keys'](_0x97cfb7['query']);_0x3336c6[_0xb2ab('0x41')]=_[_0xb2ab('0x42')](_0x3336c6[_0xb2ab('0x2d')],_0x3336c6[_0xb2ab('0x28')]);_0x5a00e8[_0xb2ab('0x2f')]=_[_0xb2ab('0x42')](_0x3336c6[_0xb2ab('0x2d')],qs[_0xb2ab('0x30')](_0x97cfb7[_0xb2ab('0x28')][_0xb2ab('0x30')]));_0x5a00e8[_0xb2ab('0x2f')]=_0x5a00e8['attributes'][_0xb2ab('0x31')]?_0x5a00e8[_0xb2ab('0x2f')]:_0x3336c6[_0xb2ab('0x2d')];_0x5a00e8[_0xb2ab('0x45')]=qs['sort'](_0x97cfb7[_0xb2ab('0x28')][_0xb2ab('0x55')]);_0x5a00e8['where']=qs[_0xb2ab('0x41')](_[_0xb2ab('0x47')](_0x97cfb7['query'],_0x3336c6['filters']));if(_0x97cfb7[_0xb2ab('0x28')]['filter']){_0x5a00e8['where']=_[_0xb2ab('0x32')](_0x5a00e8['where'],{'$or':_[_0xb2ab('0x21')](_0x5a00e8[_0xb2ab('0x2f')],function(_0x1854ec){var _0x38796d={};_0x38796d[_0x1854ec]={'$like':'%'+_0x97cfb7[_0xb2ab('0x28')][_0xb2ab('0x48')]+'%'};return _0x38796d;})});}_0x5a00e8=_['merge']({},_0x5a00e8,_0x97cfb7[_0xb2ab('0x33')]);return _0x25724e[_0xb2ab('0x7c')](_0x5a00e8);}})[_0xb2ab('0x18')](function(_0x2eefb8){if(_0x2eefb8){_0x2dc079=_0x2eefb8['length'];if(!_0x97cfb7[_0xb2ab('0x28')][_0xb2ab('0x43')](_0xb2ab('0x44'))){_0x5a00e8[_0xb2ab('0x13')]=qs[_0xb2ab('0x13')](_0x97cfb7[_0xb2ab('0x28')]['limit']);_0x5a00e8['offset']=qs['offset'](_0x97cfb7[_0xb2ab('0x28')]['offset']);}return _0x25724e[_0xb2ab('0x7c')](_0x5a00e8);}})['then'](function(_0x3dde54){if(_0x3dde54){return _0x3dde54?{'count':_0x2dc079,'rows':_0x3dde54}:null;}})[_0xb2ab('0x18')](respondWithResult(_0x4ced3d,null))[_0xb2ab('0x35')](handleError(_0x4ced3d,null));}; \ No newline at end of file +var _0x1325=['getTeams','addTeams','ids','Agents','online','voicePause','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','lodash','squel','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','offset','undefined','count','limit','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','index','map','ChatQueue','type','key','where','include','query','findAll','rows','show','keys','filters','intersection','model','attributes','fields','includeAll','merge','options','find','catch','create','role','user','UserProfileSection','autoAssociation','name','error','body','params','describe','UserChatQueue','rawAttributes','length','hasOwnProperty','nolimit','order','sort','ChatQueueId','filter','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','SIP','findOne','Team','pick'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1325,0x1e0));var _0x5132=function(_0x1f6855,_0x40c43b){_0x1f6855=_0x1f6855-0x0;var _0x57d14b=_0x1325[_0x1f6855];return _0x57d14b;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x5132('0x0'));var squel=require(_0x5132('0x1'));var Redis=require(_0x5132('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x5132('0x3'))('api');var config=require(_0x5132('0x4'));var db=require(_0x5132('0x5'))['db'];config[_0x5132('0x6')]=_[_0x5132('0x7')](config[_0x5132('0x6')],{'host':_0x5132('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5132('0x6')]));require('./chatQueue.socket')['register'](socket);function respondWithStatusCode(_0x1da3a4,_0xd35c38){_0xd35c38=_0xd35c38||0xcc;return function(_0x2773c9){if(_0x2773c9){return _0x1da3a4[_0x5132('0x9')](_0xd35c38);}return _0x1da3a4[_0x5132('0xa')](_0xd35c38)[_0x5132('0xb')]();};}function respondWithResult(_0xed000a,_0x6dd8b4){_0x6dd8b4=_0x6dd8b4||0xc8;return function(_0x57b69e){if(_0x57b69e){return _0xed000a['status'](_0x6dd8b4)['json'](_0x57b69e);}};}function respondWithFilteredResult(_0x26519c,_0x2e586f){return function(_0x2a2ff2){if(_0x2a2ff2){var _0x3200db=typeof _0x2e586f[_0x5132('0xc')]===_0x5132('0xd')&&typeof _0x2e586f['limit']===_0x5132('0xd');var _0x460103=_0x2a2ff2[_0x5132('0xe')];var _0x33147c=_0x3200db?0x0:_0x2e586f[_0x5132('0xc')];var _0x27f3de=_0x3200db?_0x2a2ff2[_0x5132('0xe')]:_0x2e586f[_0x5132('0xc')]+_0x2e586f[_0x5132('0xf')];var _0xee947d;if(_0x27f3de>=_0x460103){_0x27f3de=_0x460103;_0xee947d=0xc8;}else{_0xee947d=0xce;}_0x26519c[_0x5132('0xa')](_0xee947d);return _0x26519c['set'](_0x5132('0x10'),_0x33147c+'-'+_0x27f3de+'/'+_0x460103)['json'](_0x2a2ff2);}return null;};}function saveUpdates(_0x7a3e7b){return function(_0x438580){if(_0x438580){return _0x438580[_0x5132('0x11')](_0x7a3e7b)[_0x5132('0x12')](function(_0x428d16){return _0x428d16;});}return null;};}function removeEntity(_0x136567){return function(_0x2a9197){if(_0x2a9197){return _0x2a9197[_0x5132('0x13')]()[_0x5132('0x12')](function(){var _0x3c152f=_0x2a9197[_0x5132('0x14')]({'plain':!![]});var _0xb2439a=_0x5132('0x15');return db[_0x5132('0x16')][_0x5132('0x13')]({'where':{'type':_0xb2439a,'resourceId':_0x3c152f['id']}})[_0x5132('0x12')](function(){return _0x2a9197;});})[_0x5132('0x12')](function(){_0x136567[_0x5132('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56f61b){return function(_0x5544b9){if(!_0x5544b9){_0x56f61b['sendStatus'](0x194);}return _0x5544b9;};}function handleError(_0x4d3e98,_0x53672f){_0x53672f=_0x53672f||0x1f4;return function(_0x5c5d63){logger['error'](_0x5c5d63['stack']);if(_0x5c5d63['name']){delete _0x5c5d63['name'];}_0x4d3e98[_0x5132('0xa')](_0x53672f)['send'](_0x5c5d63);};}exports[_0x5132('0x17')]=function(_0x1bd6dc,_0x498e1e){var _0x2a31bd={};var _0x58ae2e={'count':0x0,'rows':[]};var _0x470bbd=_[_0x5132('0x18')](db[_0x5132('0x19')]['rawAttributes'],function(_0x373c33){return{'name':_0x373c33['fieldName'],'type':_0x373c33[_0x5132('0x1a')][_0x5132('0x1b')]};});_0x2a31bd=qs['getOptions'](_0x470bbd,_0x1bd6dc);var _0x5c787b={'where':_0x2a31bd[_0x5132('0x1c')]};return db[_0x5132('0x19')][_0x5132('0xe')](_0x5c787b)[_0x5132('0x12')](function(_0x12932d){_0x58ae2e['count']=_0x12932d;_0x2a31bd[_0x5132('0x1d')]=qs['include'](_0x1bd6dc[_0x5132('0x1e')]);return db[_0x5132('0x19')][_0x5132('0x1f')](_0x2a31bd);})[_0x5132('0x12')](function(_0x255420){_0x58ae2e[_0x5132('0x20')]=_0x255420;return _0x58ae2e;})[_0x5132('0x12')](respondWithFilteredResult(_0x498e1e,_0x2a31bd))['catch'](handleError(_0x498e1e,null));};exports[_0x5132('0x21')]=function(_0x6641d9,_0x483f86){var _0x5bc85f={'raw':!![],'where':{'id':_0x6641d9['params']['id']}},_0x392e28={};_0x392e28['model']=_['keys'](db[_0x5132('0x19')]['rawAttributes']);_0x392e28[_0x5132('0x1e')]=_[_0x5132('0x22')](_0x6641d9[_0x5132('0x1e')]);_0x392e28[_0x5132('0x23')]=_[_0x5132('0x24')](_0x392e28[_0x5132('0x25')],_0x392e28[_0x5132('0x1e')]);_0x5bc85f[_0x5132('0x26')]=_['intersection'](_0x392e28[_0x5132('0x25')],qs[_0x5132('0x27')](_0x6641d9['query'][_0x5132('0x27')]));_0x5bc85f['attributes']=_0x5bc85f[_0x5132('0x26')]['length']?_0x5bc85f['attributes']:_0x392e28[_0x5132('0x25')];if(_0x6641d9['query'][_0x5132('0x28')]){_0x5bc85f[_0x5132('0x1d')]=[{'all':!![]}];}_0x5bc85f=_[_0x5132('0x29')]({},_0x5bc85f,_0x6641d9[_0x5132('0x2a')]);return db['ChatQueue'][_0x5132('0x2b')](_0x5bc85f)[_0x5132('0x12')](handleEntityNotFound(_0x483f86,null))[_0x5132('0x12')](respondWithResult(_0x483f86,null))[_0x5132('0x2c')](handleError(_0x483f86,null));};exports[_0x5132('0x2d')]=function(_0x1cdd71,_0x2bd666){return db['ChatQueue'][_0x5132('0x2d')](_0x1cdd71['body'],{})['then'](function(_0x451e80){var _0x2c4835=_0x1cdd71['user'][_0x5132('0x14')]({'plain':!![]});if(!_0x2c4835)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c4835[_0x5132('0x2e')]===_0x5132('0x2f')){var _0x7eb82d=_0x451e80['get']({'plain':!![]});var _0x3c9dd7=_0x5132('0x15');return db[_0x5132('0x30')]['find']({'where':{'name':_0x3c9dd7,'userProfileId':_0x2c4835['userProfileId']},'raw':!![]})[_0x5132('0x12')](function(_0x2cc50f){if(_0x2cc50f&&_0x2cc50f[_0x5132('0x31')]===0x0){return db[_0x5132('0x16')]['create']({'name':_0x7eb82d[_0x5132('0x32')],'resourceId':_0x7eb82d['id'],'type':_0x2cc50f[_0x5132('0x32')],'sectionId':_0x2cc50f['id']},{})[_0x5132('0x12')](function(){return _0x451e80;});}else{return _0x451e80;}})[_0x5132('0x2c')](function(_0x136de3){logger[_0x5132('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x136de3);throw _0x136de3;});}return _0x451e80;})[_0x5132('0x12')](respondWithResult(_0x2bd666,0xc9))[_0x5132('0x2c')](handleError(_0x2bd666,null));};exports['update']=function(_0x55ebc1,_0x23a946){if(_0x55ebc1[_0x5132('0x34')]['id']){delete _0x55ebc1[_0x5132('0x34')]['id'];}return db[_0x5132('0x19')][_0x5132('0x2b')]({'where':{'id':_0x55ebc1[_0x5132('0x35')]['id']}})[_0x5132('0x12')](handleEntityNotFound(_0x23a946,null))['then'](saveUpdates(_0x55ebc1[_0x5132('0x34')],null))[_0x5132('0x12')](respondWithResult(_0x23a946,null))[_0x5132('0x2c')](handleError(_0x23a946,null));};exports['destroy']=function(_0x4dc208,_0x11f86d){return db[_0x5132('0x19')][_0x5132('0x2b')]({'where':{'id':_0x4dc208['params']['id']}})[_0x5132('0x12')](handleEntityNotFound(_0x11f86d,null))[_0x5132('0x12')](removeEntity(_0x11f86d,null))[_0x5132('0x2c')](handleError(_0x11f86d,null));};exports[_0x5132('0x36')]=function(_0x5b32e8,_0xdd44ae){return db[_0x5132('0x19')]['describe']()[_0x5132('0x12')](respondWithResult(_0xdd44ae,null))[_0x5132('0x2c')](handleError(_0xdd44ae,null));};exports['getMembers']=function(_0x312164,_0x27e89f){var _0x1887a3={'raw':!![],'where':{}},_0x140917={},_0x4b2686;return db[_0x5132('0x19')]['findOne']({'where':{'id':_0x312164[_0x5132('0x35')]['id']}})[_0x5132('0x12')](handleEntityNotFound(_0x27e89f,null))[_0x5132('0x12')](function(_0x227506){if(_0x227506){_0x4b2686=_0x227506[_0x5132('0x14')]({'plain':!![]});_0x140917[_0x5132('0x25')]=_['keys'](db[_0x5132('0x37')][_0x5132('0x38')]);_0x140917[_0x5132('0x1e')]=_[_0x5132('0x22')](_0x312164[_0x5132('0x1e')]);_0x140917[_0x5132('0x23')]=_[_0x5132('0x24')](_0x140917[_0x5132('0x25')],_0x140917[_0x5132('0x1e')]);_0x1887a3[_0x5132('0x26')]=_[_0x5132('0x24')](_0x140917['model'],qs[_0x5132('0x27')](_0x312164[_0x5132('0x1e')][_0x5132('0x27')]));_0x1887a3[_0x5132('0x26')]=_0x1887a3['attributes'][_0x5132('0x39')]?_0x1887a3[_0x5132('0x26')]:_0x140917[_0x5132('0x25')];if(!_0x312164['query'][_0x5132('0x3a')](_0x5132('0x3b'))){_0x1887a3[_0x5132('0xf')]=qs['limit'](_0x312164[_0x5132('0x1e')][_0x5132('0xf')]);_0x1887a3[_0x5132('0xc')]=qs[_0x5132('0xc')](_0x312164[_0x5132('0x1e')][_0x5132('0xc')]);}_0x1887a3[_0x5132('0x3c')]=qs[_0x5132('0x3d')](_0x312164['query'][_0x5132('0x3d')]);_0x1887a3[_0x5132('0x1c')]=qs['filters'](_['pick'](_0x312164['query'],_0x140917[_0x5132('0x23')]));_0x1887a3[_0x5132('0x1c')][_0x5132('0x3e')]=_0x227506['id'];if(_0x312164[_0x5132('0x1e')]['filter']){_0x1887a3[_0x5132('0x1c')]=_['merge'](_0x1887a3[_0x5132('0x1c')],{'$or':_[_0x5132('0x18')](_0x1887a3[_0x5132('0x26')],function(_0x239b81){var _0x16c3c6={};_0x16c3c6[_0x239b81]={'$like':'%'+_0x312164[_0x5132('0x1e')][_0x5132('0x3f')]+'%'};return _0x16c3c6;})});}_0x1887a3=_['merge']({},_0x1887a3,_0x312164['options']);return db[_0x5132('0x37')][_0x5132('0x1f')](_0x1887a3);}})[_0x5132('0x12')](function(_0x3108ba){if(_0x3108ba){return db[_0x5132('0x40')][_0x5132('0x41')]({'where':{'id':_[_0x5132('0x18')](_0x3108ba,'UserId'),'role':_0x5132('0x42')},'attributes':['id',_0x5132('0x32'),_0x5132('0x43'),_0x5132('0x44'),_0x5132('0x45')]});}})[_0x5132('0x12')](function(_0x381cf3){if(_0x381cf3){return{'count':_0x381cf3[_0x5132('0xe')],'rows':_[_0x5132('0x18')](_0x381cf3[_0x5132('0x20')],function(_0x486a1b){return{'membername':_0x486a1b[_0x5132('0x32')],'UserId':_0x486a1b['id'],'queue_name':_0x4b2686['name'],'ChatQueueId':_0x4b2686['id'],'interface':util[_0x5132('0x46')]('%s/%s',_0x5132('0x47'),_0x486a1b[_0x5132('0x32')]),'penalty':0x0,'paused':_0x486a1b[_0x5132('0x43')],'createdAt':_0x486a1b[_0x5132('0x45')],'updatedAt':_0x486a1b[_0x5132('0x44')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x27e89f,_0x1887a3))[_0x5132('0x2c')](handleError(_0x27e89f,null));};exports['getTeams']=function(_0x467450,_0x2b2deb){var _0x2b19c7={};var _0x1d2b1f={};var _0x5f2347;var _0x55c0e5;return db['ChatQueue'][_0x5132('0x48')]({'where':{'id':_0x467450[_0x5132('0x35')]['id']}})[_0x5132('0x12')](handleEntityNotFound(_0x2b2deb,null))['then'](function(_0x4b42db){if(_0x4b42db){_0x5f2347=_0x4b42db;_0x1d2b1f[_0x5132('0x25')]=_[_0x5132('0x22')](db[_0x5132('0x49')][_0x5132('0x38')]);_0x1d2b1f[_0x5132('0x1e')]=_[_0x5132('0x22')](_0x467450[_0x5132('0x1e')]);_0x1d2b1f[_0x5132('0x23')]=_['intersection'](_0x1d2b1f[_0x5132('0x25')],_0x1d2b1f[_0x5132('0x1e')]);_0x2b19c7[_0x5132('0x26')]=_[_0x5132('0x24')](_0x1d2b1f[_0x5132('0x25')],qs[_0x5132('0x27')](_0x467450[_0x5132('0x1e')][_0x5132('0x27')]));_0x2b19c7[_0x5132('0x26')]=_0x2b19c7[_0x5132('0x26')]['length']?_0x2b19c7[_0x5132('0x26')]:_0x1d2b1f[_0x5132('0x25')];_0x2b19c7[_0x5132('0x3c')]=qs[_0x5132('0x3d')](_0x467450[_0x5132('0x1e')][_0x5132('0x3d')]);_0x2b19c7[_0x5132('0x1c')]=qs[_0x5132('0x23')](_[_0x5132('0x4a')](_0x467450[_0x5132('0x1e')],_0x1d2b1f['filters']));if(_0x467450[_0x5132('0x1e')][_0x5132('0x3f')]){_0x2b19c7[_0x5132('0x1c')]=_[_0x5132('0x29')](_0x2b19c7['where'],{'$or':_[_0x5132('0x18')](_0x2b19c7['attributes'],function(_0x427695){var _0x7f9bd3={};_0x7f9bd3[_0x427695]={'$like':'%'+_0x467450[_0x5132('0x1e')][_0x5132('0x3f')]+'%'};return _0x7f9bd3;})});}_0x2b19c7=_[_0x5132('0x29')]({},_0x2b19c7,_0x467450[_0x5132('0x2a')]);return _0x5f2347['getTeams'](_0x2b19c7);}})[_0x5132('0x12')](function(_0x4ea6a8){if(_0x4ea6a8){_0x55c0e5=_0x4ea6a8[_0x5132('0x39')];if(!_0x467450[_0x5132('0x1e')][_0x5132('0x3a')](_0x5132('0x3b'))){_0x2b19c7[_0x5132('0xf')]=qs[_0x5132('0xf')](_0x467450[_0x5132('0x1e')]['limit']);_0x2b19c7['offset']=qs[_0x5132('0xc')](_0x467450[_0x5132('0x1e')][_0x5132('0xc')]);}return _0x5f2347[_0x5132('0x4b')](_0x2b19c7);}})['then'](function(_0x3e7153){if(_0x3e7153){return _0x3e7153?{'count':_0x55c0e5,'rows':_0x3e7153}:null;}})[_0x5132('0x12')](respondWithResult(_0x2b2deb,null))[_0x5132('0x2c')](handleError(_0x2b2deb,null));};exports[_0x5132('0x4c')]=function(_0x471fa1,_0x4d1a6a){var _0x2ebc97=_0x471fa1[_0x5132('0x34')][_0x5132('0x4d')];return db['Team'][_0x5132('0x1f')]({'where':{'id':_0x2ebc97},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5132('0x4e'),'attributes':['id','name',_0x5132('0x4f'),_0x5132('0x50'),'interface'],'raw':!![]}]})[_0x5132('0x12')](function(_0x4d4767){if(_0x4d4767){var _0x544171=_['flatMap'](_0x4d4767,function(_0xabe53b){var _0x82e9a5=_0xabe53b[_0x5132('0x14')]({'plain':!![]});return _0x82e9a5[_0x5132('0x4e')];});return db['ChatQueue'][_0x5132('0x2b')]({'where':{'id':_0x471fa1[_0x5132('0x35')]['id']}})[_0x5132('0x12')](function(_0x200e32){return db[_0x5132('0x51')][_0x5132('0x52')](function(_0x2616df){return _0x200e32[_0x5132('0x4c')](_0x2ebc97,{'transaction':_0x2616df})[_0x5132('0x12')](function(){return BPromise['each'](_0x544171,function(_0x1819ca){return db[_0x5132('0x37')][_0x5132('0x53')]({'where':{'UserId':_0x1819ca['id'],'ChatQueueId':_0x471fa1['params']['id']},'transaction':_0x2616df});});})[_0x5132('0x12')](function(){_0x544171[_0x5132('0x54')](function(_0x134be0){socket[_0x5132('0x55')](_0x5132('0x56'),{'UserId':_0x134be0['id'],'ChatQueueId':_0x200e32['id']});});});});});}})[_0x5132('0x12')](respondWithStatusCode(_0x4d1a6a,null))[_0x5132('0x2c')](handleError(_0x4d1a6a,null));};exports[_0x5132('0x57')]=function(_0x5273ee,_0x25da03){return db[_0x5132('0x49')]['findAll']({'where':{'id':_0x5273ee['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x5132('0x40')],'as':_0x5132('0x4e'),'attributes':['id'],'raw':!![]}]})[_0x5132('0x12')](handleEntityNotFound(_0x25da03,null))[_0x5132('0x12')](function(_0x51a686){var _0x249959=_[_0x5132('0x18')](_0x51a686,'id');var _0x1c9038=[];var _0x149a2f=[];var _0x1acc9=squel[_0x5132('0x58')]();_0x1acc9[_0x5132('0x59')]('tq.TeamId')['from'](_0x5132('0x5a'),'tq')[_0x5132('0x5b')](_0x5132('0x5c'),'ut',_0x5132('0x5d'))['where'](_0x5132('0x5e'),_0x5273ee[_0x5132('0x35')]['id']);for(var _0x3f3fd1=0x0;_0x3f3fd1<_0x51a686[_0x5132('0x39')];_0x3f3fd1+=0x1){let _0x4c2c3e=_0x51a686[_0x3f3fd1];for(var _0x10188b=0x0;_0x10188b<_0x4c2c3e['Agents']['length'];_0x10188b+=0x1){let _0x1682e0=_0x4c2c3e[_0x5132('0x4e')][_0x10188b];var _0x2b4030=_0x1acc9['clone']();_0x2b4030['where'](_0x5132('0x5f'),_0x1682e0['id']);_0x149a2f[_0x5132('0x60')](db['sequelize'][_0x5132('0x1e')](_0x2b4030[_0x5132('0x61')](),{'type':db[_0x5132('0x51')]['QueryTypes'][_0x5132('0x62')]})[_0x5132('0x12')](function(_0xeab138){if(_0xeab138[_0x5132('0x39')]===0x1){return _0x1682e0['id'];}else{var _0x2b3a8b=_[_0x5132('0x63')](_[_0x5132('0x18')](_0xeab138,_0x5132('0x64')),function(_0x2d092f){return _[_0x5132('0x65')](_0x249959,_0x2d092f);});if(_0x2b3a8b){return _0x1682e0['id'];}}}));}}return BPromise['all'](_0x149a2f)[_0x5132('0x12')](function(_0x22850f){_0x1c9038=_(_0x1c9038)[_0x5132('0x66')](_0x22850f)[_0x5132('0x67')]()['value']();return db[_0x5132('0x19')][_0x5132('0x2b')]({'where':{'id':_0x5273ee[_0x5132('0x35')]['id']}})[_0x5132('0x12')](function(_0x25bd5d){return db[_0x5132('0x51')][_0x5132('0x52')](function(_0x24e258){return _0x25bd5d[_0x5132('0x57')](_0x5273ee[_0x5132('0x1e')][_0x5132('0x4d')],{'transaction':_0x24e258})['then'](function(){if(!_['isEmpty'](_0x1c9038)){return _0x25bd5d[_0x5132('0x68')](_0x1c9038,{'transaction':_0x24e258});}})[_0x5132('0x12')](function(){_0x1c9038['forEach'](function(_0x5dbc81){socket[_0x5132('0x55')](_0x5132('0x69'),{'UserId':_0x5dbc81,'ChatQueueId':_0x25bd5d['id']});});});});});});})[_0x5132('0x12')](respondWithStatusCode(_0x25da03,null))[_0x5132('0x2c')](handleError(_0x25da03,null));};exports[_0x5132('0x6a')]=function(_0x58ef9c,_0x1ba57d){return db[_0x5132('0x19')][_0x5132('0x2b')]({'where':{'id':_0x58ef9c[_0x5132('0x35')]['id']}})['then'](handleEntityNotFound(_0x1ba57d,null))[_0x5132('0x12')](function(_0x2c5800){if(_0x2c5800){return _0x2c5800['addAgents'](_0x58ef9c[_0x5132('0x34')]['ids'],_[_0x5132('0x6b')](_0x58ef9c[_0x5132('0x34')],[_0x5132('0x4d'),'id'])||{})[_0x5132('0x6c')](function(_0x20d053){for(var _0x59b45b=0x0;_0x59b45b<_0x58ef9c[_0x5132('0x34')][_0x5132('0x4d')][_0x5132('0x39')];_0x59b45b+=0x1){socket[_0x5132('0x55')](_0x5132('0x56'),{'UserId':Number(_0x58ef9c[_0x5132('0x34')][_0x5132('0x4d')][_0x59b45b]),'ChatQueueId':Number(_0x58ef9c[_0x5132('0x35')]['id'])});}return _0x20d053;});}})[_0x5132('0x12')](respondWithResult(_0x1ba57d,null))[_0x5132('0x2c')](handleError(_0x1ba57d,null));};exports[_0x5132('0x68')]=function(_0x11884b,_0x2e3d5a){return db[_0x5132('0x19')]['find']({'where':{'id':_0x11884b[_0x5132('0x35')]['id']}})[_0x5132('0x12')](handleEntityNotFound(_0x2e3d5a,null))[_0x5132('0x12')](function(_0x5ae018){if(_0x5ae018){return _0x5ae018[_0x5132('0x68')](_0x11884b[_0x5132('0x1e')][_0x5132('0x4d')])[_0x5132('0x12')](function(){if(_[_0x5132('0x6d')](_0x11884b[_0x5132('0x1e')]['ids'])){for(var _0x109aff=0x0;_0x109aff<_0x11884b[_0x5132('0x1e')]['ids']['length'];_0x109aff+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x11884b[_0x5132('0x1e')]['ids'][_0x109aff]),'ChatQueueId':Number(_0x11884b[_0x5132('0x35')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x11884b['query'][_0x5132('0x4d')]),'ChatQueueId':Number(_0x11884b['params']['id'])});}});}})[_0x5132('0x12')](respondWithStatusCode(_0x2e3d5a,null))[_0x5132('0x2c')](handleError(_0x2e3d5a,null));};exports[_0x5132('0x6e')]=function(_0x485fff,_0x8f8925){var _0x410c9f={};var _0xacb43e={};var _0x5b5a11;var _0x5d125f;return db[_0x5132('0x19')][_0x5132('0x48')]({'where':{'id':_0x485fff[_0x5132('0x35')]['id']}})[_0x5132('0x12')](handleEntityNotFound(_0x8f8925,null))[_0x5132('0x12')](function(_0x39eb45){if(_0x39eb45){_0x5b5a11=_0x39eb45;_0xacb43e[_0x5132('0x25')]=_[_0x5132('0x22')](db['User'][_0x5132('0x38')]);_0xacb43e[_0x5132('0x1e')]=_[_0x5132('0x22')](_0x485fff[_0x5132('0x1e')]);_0xacb43e[_0x5132('0x23')]=_['intersection'](_0xacb43e[_0x5132('0x25')],_0xacb43e[_0x5132('0x1e')]);_0x410c9f[_0x5132('0x26')]=_[_0x5132('0x24')](_0xacb43e[_0x5132('0x25')],qs[_0x5132('0x27')](_0x485fff[_0x5132('0x1e')][_0x5132('0x27')]));_0x410c9f[_0x5132('0x26')]=_0x410c9f[_0x5132('0x26')][_0x5132('0x39')]?_0x410c9f[_0x5132('0x26')]:_0xacb43e[_0x5132('0x25')];_0x410c9f['order']=qs[_0x5132('0x3d')](_0x485fff[_0x5132('0x1e')]['sort']);_0x410c9f[_0x5132('0x1c')]=qs['filters'](_[_0x5132('0x4a')](_0x485fff[_0x5132('0x1e')],_0xacb43e[_0x5132('0x23')]));if(_0x485fff[_0x5132('0x1e')][_0x5132('0x3f')]){_0x410c9f['where']=_[_0x5132('0x29')](_0x410c9f[_0x5132('0x1c')],{'$or':_[_0x5132('0x18')](_0x410c9f['attributes'],function(_0xa5c3c3){var _0x827b60={};_0x827b60[_0xa5c3c3]={'$like':'%'+_0x485fff['query'][_0x5132('0x3f')]+'%'};return _0x827b60;})});}_0x410c9f=_[_0x5132('0x29')]({},_0x410c9f,_0x485fff[_0x5132('0x2a')]);return _0x5b5a11[_0x5132('0x6e')](_0x410c9f);}})['then'](function(_0x5d1678){if(_0x5d1678){_0x5d125f=_0x5d1678['length'];if(!_0x485fff[_0x5132('0x1e')][_0x5132('0x3a')](_0x5132('0x3b'))){_0x410c9f['limit']=qs['limit'](_0x485fff[_0x5132('0x1e')][_0x5132('0xf')]);_0x410c9f['offset']=qs['offset'](_0x485fff[_0x5132('0x1e')][_0x5132('0xc')]);}return _0x5b5a11[_0x5132('0x6e')](_0x410c9f);}})[_0x5132('0x12')](function(_0x22c74f){if(_0x22c74f){return _0x22c74f?{'count':_0x5d125f,'rows':_0x22c74f}:null;}})[_0x5132('0x12')](respondWithResult(_0x8f8925,null))[_0x5132('0x2c')](handleError(_0x8f8925,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index ecf44dd..a0a2e8c 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 _0x3ff8=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','update','remove','emit'];(function(_0xe10653,_0x24cb3e){var _0xe525d3=function(_0x306940){while(--_0x306940){_0xe10653['push'](_0xe10653['shift']());}};_0xe525d3(++_0x24cb3e);}(_0x3ff8,0x1f2));var _0x83ff=function(_0xb91507,_0x1a4296){_0xb91507=_0xb91507-0x0;var _0x1f1136=_0x3ff8[_0xb91507];return _0x1f1136;};'use strict';var EventEmitter=require(_0x83ff('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x83ff('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x83ff('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x83ff('0x3'),'afterDestroy':_0x83ff('0x4')};function emitEvent(_0x11ada1){return function(_0x50c84e,_0x22abb4,_0x2c0059){ChatQueueEvents[_0x83ff('0x5')](_0x11ada1+':'+_0x50c84e['id'],_0x50c84e);ChatQueueEvents[_0x83ff('0x5')](_0x11ada1,_0x50c84e);_0x2c0059(null);};}for(var e in events){if(events[_0x83ff('0x6')](e)){var event=events[e];ChatQueue[_0x83ff('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x0b9f=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','update','emit'];(function(_0x2020ba,_0xcd1e14){var _0x877c22=function(_0xa635be){while(--_0xa635be){_0x2020ba['push'](_0x2020ba['shift']());}};_0x877c22(++_0xcd1e14);}(_0x0b9f,0xdb));var _0xf0b9=function(_0x4e8712,_0x46f28c){_0x4e8712=_0x4e8712-0x0;var _0x131241=_0x0b9f[_0x4e8712];return _0x131241;};'use strict';var EventEmitter=require(_0xf0b9('0x0'));var ChatQueue=require(_0xf0b9('0x1'))['db'][_0xf0b9('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf0b9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x233e64){return function(_0x555132,_0x82e6b2,_0x12cc0a){ChatQueueEvents[_0xf0b9('0x4')](_0x233e64+':'+_0x555132['id'],_0x555132);ChatQueueEvents[_0xf0b9('0x4')](_0x233e64,_0x555132);_0x12cc0a(null);};}for(var e in events){if(events[_0xf0b9('0x5')](e)){var event=events[e];ChatQueue[_0xf0b9('0x6')](e,emitEvent(event));}}module[_0xf0b9('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 3974965..cb040f7 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 _0x9580=['path','../../config/environment','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43f283,_0x28c1f1){var _0x5cecf6=function(_0x398d79){while(--_0x398d79){_0x43f283['push'](_0x43f283['shift']());}};_0x5cecf6(++_0x28c1f1);}(_0x9580,0xcb));var _0x0958=function(_0x48794c,_0xeb757){_0x48794c=_0x48794c-0x0;var _0xd0012c=_0x9580[_0x48794c];return _0xd0012c;};'use strict';var _=require(_0x0958('0x0'));var util=require(_0x0958('0x1'));var logger=require(_0x0958('0x2'))(_0x0958('0x3'));var moment=require(_0x0958('0x4'));var BPromise=require(_0x0958('0x5'));var rp=require(_0x0958('0x6'));var fs=require('fs');var path=require(_0x0958('0x7'));var rimraf=require('rimraf');var config=require(_0x0958('0x8'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x4031ed,_0x585b31){return _0x4031ed[_0x0958('0x9')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x062c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','chat_queues'];(function(_0x322dd5,_0x5de512){var _0x20f870=function(_0x5b5840){while(--_0x5b5840){_0x322dd5['push'](_0x322dd5['shift']());}};_0x20f870(++_0x5de512);}(_0x062c,0x1e1));var _0xc062=function(_0x32b663,_0x47c2f2){_0x32b663=_0x32b663-0x0;var _0x794c2=_0x062c[_0x32b663];return _0x794c2;};'use strict';var _=require(_0xc062('0x0'));var util=require(_0xc062('0x1'));var logger=require(_0xc062('0x2'))(_0xc062('0x3'));var moment=require(_0xc062('0x4'));var BPromise=require(_0xc062('0x5'));var rp=require(_0xc062('0x6'));var fs=require('fs');var path=require(_0xc062('0x7'));var rimraf=require(_0xc062('0x8'));var config=require(_0xc062('0x9'));var attributes=require(_0xc062('0xa'));module[_0xc062('0xb')]=function(_0x38aacf,_0x3d4fe1){return _0x38aacf['define']('ChatQueue',attributes,{'tableName':_0xc062('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 3aec8b3..1a6ef77 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 _0xbb59=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','map','include','model','then','ShowChatQueue','raw','debug','lodash','moment'];(function(_0x3018eb,_0x570c63){var _0x23131f=function(_0x33656f){while(--_0x33656f){_0x3018eb['push'](_0x3018eb['shift']());}};_0x23131f(++_0x570c63);}(_0xbb59,0x1d2));var _0x9bb5=function(_0x3e2865,_0x3c9455){_0x3e2865=_0x3e2865-0x0;var _0x4cd380=_0xbb59[_0x3e2865];return _0x4cd380;};'use strict';var _=require(_0x9bb5('0x0'));var util=require('util');var moment=require(_0x9bb5('0x1'));var BPromise=require(_0x9bb5('0x2'));var rs=require(_0x9bb5('0x3'));var fs=require('fs');var Redis=require(_0x9bb5('0x4'));var db=require(_0x9bb5('0x5'))['db'];var utils=require(_0x9bb5('0x6'));var logger=require(_0x9bb5('0x7'))(_0x9bb5('0x8'));var config=require(_0x9bb5('0x9'));var jayson=require(_0x9bb5('0xa'));var client=jayson[_0x9bb5('0xb')]['http']({'port':0x232a});config['redis']=_[_0x9bb5('0xc')](config[_0x9bb5('0xd')],{'host':_0x9bb5('0xe'),'port':0x18eb});var socket=require(_0x9bb5('0xf'))(new Redis(config['redis']));require(_0x9bb5('0x10'))[_0x9bb5('0x11')](socket);function respondWithRpcPromise(_0x293122,_0x21f1ea,_0x1c02cf){return new BPromise(function(_0x23a981,_0x15df87){return client['request'](_0x293122,_0x1c02cf)['then'](function(_0x422588){logger['info'](_0x9bb5('0x12'),_0x21f1ea,_0x9bb5('0x13'));logger['debug'](_0x9bb5('0x14'),_0x21f1ea,'request\x20sent',JSON[_0x9bb5('0x15')](_0x422588));if(_0x422588[_0x9bb5('0x16')]){if(_0x422588['error']['code']===0x1f4){logger[_0x9bb5('0x16')]('ChatQueue,\x20%s,\x20%s',_0x21f1ea,_0x422588[_0x9bb5('0x16')][_0x9bb5('0x17')]);return _0x15df87(_0x422588[_0x9bb5('0x16')]['message']);}logger[_0x9bb5('0x16')]('ChatQueue,\x20%s,\x20%s',_0x21f1ea,_0x422588[_0x9bb5('0x16')]['message']);return _0x23a981(_0x422588[_0x9bb5('0x16')]['message']);}else{logger[_0x9bb5('0x18')]('ChatQueue,\x20%s,\x20%s',_0x21f1ea,_0x9bb5('0x13'));_0x23a981(_0x422588['result'][_0x9bb5('0x17')]);}})[_0x9bb5('0x19')](function(_0x124093){logger[_0x9bb5('0x16')](_0x9bb5('0x12'),_0x21f1ea,_0x124093);_0x15df87(_0x124093);});});}exports[_0x9bb5('0x1a')]=function(_0x6b3ae6){var _0x56333b=this;return new Promise(function(_0x4eb384,_0x330925){return db[_0x9bb5('0x1b')][_0x9bb5('0x1c')]({'raw':_0x6b3ae6[_0x9bb5('0x1d')]?_0x6b3ae6[_0x9bb5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x6b3ae6[_0x9bb5('0x1d')]?_0x6b3ae6[_0x9bb5('0x1d')][_0x9bb5('0x1e')]||null:null,'attributes':_0x6b3ae6[_0x9bb5('0x1d')]?_0x6b3ae6[_0x9bb5('0x1d')][_0x9bb5('0x1f')]||null:null,'limit':_0x6b3ae6[_0x9bb5('0x1d')]?_0x6b3ae6[_0x9bb5('0x1d')]['limit']||null:null,'include':_0x6b3ae6[_0x9bb5('0x1d')]?_0x6b3ae6[_0x9bb5('0x1d')]['include']?_[_0x9bb5('0x20')](_0x6b3ae6[_0x9bb5('0x1d')][_0x9bb5('0x21')],function(_0x4e6fb7){return{'model':db[_0x4e6fb7[_0x9bb5('0x22')]],'as':_0x4e6fb7['as'],'attributes':_0x4e6fb7[_0x9bb5('0x1f')],'include':_0x4e6fb7[_0x9bb5('0x21')]?_['map'](_0x4e6fb7[_0x9bb5('0x21')],function(_0x4223b2){return{'model':db[_0x4223b2[_0x9bb5('0x22')]],'as':_0x4223b2['as'],'attributes':_0x4223b2['attributes'],'include':_0x4223b2[_0x9bb5('0x21')]?_['map'](_0x4223b2[_0x9bb5('0x21')],function(_0x1255fa){return{'model':db[_0x1255fa[_0x9bb5('0x22')]],'as':_0x1255fa['as'],'attributes':_0x1255fa[_0x9bb5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9bb5('0x23')](function(_0x308217){logger[_0x9bb5('0x18')]('GetChatQueue',_0x6b3ae6);logger['debug'](_0x9bb5('0x1a'),_0x6b3ae6,JSON[_0x9bb5('0x15')](_0x308217));_0x4eb384(_0x308217);})[_0x9bb5('0x19')](function(_0xdf3b00){logger[_0x9bb5('0x16')](_0x9bb5('0x1a'),_0xdf3b00[_0x9bb5('0x17')],_0x6b3ae6);_0x330925(_0x56333b['error'](0x1f4,_0xdf3b00[_0x9bb5('0x17')]));});});};exports[_0x9bb5('0x24')]=function(_0x1167c9){var _0x36ed1d=this;return new Promise(function(_0x21fe77,_0xc7a6fb){return db[_0x9bb5('0x1b')]['find']({'raw':_0x1167c9[_0x9bb5('0x1d')]?_0x1167c9['options'][_0x9bb5('0x25')]===undefined?!![]:![]:!![],'where':_0x1167c9['options']?_0x1167c9['options']['where']||null:null,'attributes':_0x1167c9[_0x9bb5('0x1d')]?_0x1167c9[_0x9bb5('0x1d')][_0x9bb5('0x1f')]||null:null,'include':_0x1167c9[_0x9bb5('0x1d')]?_0x1167c9[_0x9bb5('0x1d')][_0x9bb5('0x21')]?_[_0x9bb5('0x20')](_0x1167c9[_0x9bb5('0x1d')]['include'],function(_0x395fa9){return{'model':db[_0x395fa9[_0x9bb5('0x22')]],'as':_0x395fa9['as'],'attributes':_0x395fa9[_0x9bb5('0x1f')],'include':_0x395fa9[_0x9bb5('0x21')]?_['map'](_0x395fa9[_0x9bb5('0x21')],function(_0x21af37){return{'model':db[_0x21af37['model']],'as':_0x21af37['as'],'attributes':_0x21af37[_0x9bb5('0x1f')],'include':_0x21af37[_0x9bb5('0x21')]?_[_0x9bb5('0x20')](_0x21af37['include'],function(_0x1edd10){return{'model':db[_0x1edd10[_0x9bb5('0x22')]],'as':_0x1edd10['as'],'attributes':_0x1edd10[_0x9bb5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9bb5('0x23')](function(_0x1a2cb0){logger[_0x9bb5('0x18')](_0x9bb5('0x24'),_0x1167c9);logger[_0x9bb5('0x26')](_0x9bb5('0x24'),_0x1167c9,JSON[_0x9bb5('0x15')](_0x1a2cb0));_0x21fe77(_0x1a2cb0);})['catch'](function(_0x5254fa){logger[_0x9bb5('0x16')]('ShowChatQueue',_0x5254fa[_0x9bb5('0x17')],_0x1167c9);_0xc7a6fb(_0x36ed1d[_0x9bb5('0x16')](0x1f4,_0x5254fa[_0x9bb5('0x17')]));});});}; \ No newline at end of file +var _0x3946=['request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','map','include','model','attributes','stringify','catch','ShowChatQueue','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x349769,_0x287040){var _0x56bc41=function(_0xb23bdf){while(--_0xb23bdf){_0x349769['push'](_0x349769['shift']());}};_0x56bc41(++_0x287040);}(_0x3946,0x1d0));var _0x6394=function(_0x5e3665,_0x369ac8){_0x5e3665=_0x5e3665-0x0;var _0x187299=_0x3946[_0x5e3665];return _0x187299;};'use strict';var _=require('lodash');var util=require(_0x6394('0x0'));var moment=require(_0x6394('0x1'));var BPromise=require(_0x6394('0x2'));var rs=require(_0x6394('0x3'));var fs=require('fs');var Redis=require(_0x6394('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6394('0x5'));var logger=require(_0x6394('0x6'))(_0x6394('0x7'));var config=require(_0x6394('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6394('0x9')][_0x6394('0xa')]({'port':0x232a});config[_0x6394('0xb')]=_[_0x6394('0xc')](config[_0x6394('0xb')],{'host':_0x6394('0xd'),'port':0x18eb});var socket=require(_0x6394('0xe'))(new Redis(config[_0x6394('0xb')]));require('./chatQueue.socket')[_0x6394('0xf')](socket);function respondWithRpcPromise(_0x32b05b,_0x16e4ac,_0x42b2a4){return new BPromise(function(_0x2491cb,_0x5c03b5){return client[_0x6394('0x10')](_0x32b05b,_0x42b2a4)[_0x6394('0x11')](function(_0x1042b9){logger['info'](_0x6394('0x12'),_0x16e4ac,'request\x20sent');logger[_0x6394('0x13')](_0x6394('0x14'),_0x16e4ac,'request\x20sent',JSON['stringify'](_0x1042b9));if(_0x1042b9[_0x6394('0x15')]){if(_0x1042b9[_0x6394('0x15')]['code']===0x1f4){logger['error'](_0x6394('0x12'),_0x16e4ac,_0x1042b9[_0x6394('0x15')][_0x6394('0x16')]);return _0x5c03b5(_0x1042b9['error'][_0x6394('0x16')]);}logger[_0x6394('0x15')](_0x6394('0x12'),_0x16e4ac,_0x1042b9['error'][_0x6394('0x16')]);return _0x2491cb(_0x1042b9[_0x6394('0x15')][_0x6394('0x16')]);}else{logger[_0x6394('0x17')](_0x6394('0x12'),_0x16e4ac,_0x6394('0x18'));_0x2491cb(_0x1042b9[_0x6394('0x19')][_0x6394('0x16')]);}})['catch'](function(_0x889317){logger[_0x6394('0x15')](_0x6394('0x12'),_0x16e4ac,_0x889317);_0x5c03b5(_0x889317);});});}exports[_0x6394('0x1a')]=function(_0x48f309){var _0x34ed18=this;return new Promise(function(_0x53102d,_0x27f172){return db[_0x6394('0x1b')][_0x6394('0x1c')]({'raw':_0x48f309[_0x6394('0x1d')]?_0x48f309['options'][_0x6394('0x1e')]===undefined?!![]:![]:!![],'where':_0x48f309[_0x6394('0x1d')]?_0x48f309['options'][_0x6394('0x1f')]||null:null,'attributes':_0x48f309[_0x6394('0x1d')]?_0x48f309[_0x6394('0x1d')]['attributes']||null:null,'limit':_0x48f309[_0x6394('0x1d')]?_0x48f309[_0x6394('0x1d')][_0x6394('0x20')]||null:null,'include':_0x48f309['options']?_0x48f309[_0x6394('0x1d')]['include']?_[_0x6394('0x21')](_0x48f309['options'][_0x6394('0x22')],function(_0xbb37da){return{'model':db[_0xbb37da[_0x6394('0x23')]],'as':_0xbb37da['as'],'attributes':_0xbb37da[_0x6394('0x24')],'include':_0xbb37da[_0x6394('0x22')]?_[_0x6394('0x21')](_0xbb37da[_0x6394('0x22')],function(_0x439145){return{'model':db[_0x439145['model']],'as':_0x439145['as'],'attributes':_0x439145[_0x6394('0x24')],'include':_0x439145[_0x6394('0x22')]?_['map'](_0x439145[_0x6394('0x22')],function(_0x1cc266){return{'model':db[_0x1cc266[_0x6394('0x23')]],'as':_0x1cc266['as'],'attributes':_0x1cc266['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x788938){logger[_0x6394('0x17')](_0x6394('0x1a'),_0x48f309);logger[_0x6394('0x13')](_0x6394('0x1a'),_0x48f309,JSON[_0x6394('0x25')](_0x788938));_0x53102d(_0x788938);})[_0x6394('0x26')](function(_0x5d4a84){logger[_0x6394('0x15')]('GetChatQueue',_0x5d4a84[_0x6394('0x16')],_0x48f309);_0x27f172(_0x34ed18[_0x6394('0x15')](0x1f4,_0x5d4a84['message']));});});};exports[_0x6394('0x27')]=function(_0x24fd98){var _0x574fee=this;return new Promise(function(_0x17f4cf,_0x16e3bc){return db[_0x6394('0x1b')]['find']({'raw':_0x24fd98['options']?_0x24fd98[_0x6394('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x24fd98[_0x6394('0x1d')]?_0x24fd98[_0x6394('0x1d')][_0x6394('0x1f')]||null:null,'attributes':_0x24fd98['options']?_0x24fd98[_0x6394('0x1d')]['attributes']||null:null,'include':_0x24fd98[_0x6394('0x1d')]?_0x24fd98[_0x6394('0x1d')]['include']?_['map'](_0x24fd98['options'][_0x6394('0x22')],function(_0x3f48f6){return{'model':db[_0x3f48f6[_0x6394('0x23')]],'as':_0x3f48f6['as'],'attributes':_0x3f48f6[_0x6394('0x24')],'include':_0x3f48f6['include']?_[_0x6394('0x21')](_0x3f48f6['include'],function(_0x5d3677){return{'model':db[_0x5d3677[_0x6394('0x23')]],'as':_0x5d3677['as'],'attributes':_0x5d3677[_0x6394('0x24')],'include':_0x5d3677[_0x6394('0x22')]?_[_0x6394('0x21')](_0x5d3677[_0x6394('0x22')],function(_0x14291f){return{'model':db[_0x14291f[_0x6394('0x23')]],'as':_0x14291f['as'],'attributes':_0x14291f[_0x6394('0x24')]};}):[]};}):[]};}):[]:[]})[_0x6394('0x11')](function(_0x285368){logger['info'](_0x6394('0x27'),_0x24fd98);logger[_0x6394('0x13')](_0x6394('0x27'),_0x24fd98,JSON[_0x6394('0x25')](_0x285368));_0x17f4cf(_0x285368);})['catch'](function(_0x313fd4){logger['error'](_0x6394('0x27'),_0x313fd4[_0x6394('0x16')],_0x24fd98);_0x16e3bc(_0x574fee[_0x6394('0x15')](0x1f4,_0x313fd4[_0x6394('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index aeb0738..af58fdf 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 _0x8ce3=['emit','removeListener','length','./chatQueue.events','save','update'];(function(_0x3e5fd7,_0x5e5033){var _0x5b05b2=function(_0x367498){while(--_0x367498){_0x3e5fd7['push'](_0x3e5fd7['shift']());}};_0x5b05b2(++_0x5e5033);}(_0x8ce3,0xc3));var _0x38ce=function(_0xcf4260,_0xe48af6){_0xcf4260=_0xcf4260-0x0;var _0x5ad781=_0x8ce3[_0xcf4260];return _0x5ad781;};'use strict';var ChatQueueEvents=require(_0x38ce('0x0'));var events=[_0x38ce('0x1'),'remove',_0x38ce('0x2')];function createListener(_0x2b99b0,_0xee1d0e){return function(_0x26ec48){_0xee1d0e[_0x38ce('0x3')](_0x2b99b0,_0x26ec48);};}function removeListener(_0x17b96d,_0x1efae3){return function(){ChatQueueEvents[_0x38ce('0x4')](_0x17b96d,_0x1efae3);};}exports['register']=function(_0x372f86){for(var _0xb24f4c=0x0,_0x58074c=events[_0x38ce('0x5')];_0xb24f4c<_0x58074c;_0xb24f4c++){var _0xbe7332=events[_0xb24f4c];var _0x3f8011=createListener('chatQueue:'+_0xbe7332,_0x372f86);ChatQueueEvents['on'](_0xbe7332,_0x3f8011);}}; \ No newline at end of file +var _0x702d=['remove','update','emit','register','length','./chatQueue.events','save'];(function(_0x371410,_0x50762a){var _0x4689c0=function(_0x2a05d0){while(--_0x2a05d0){_0x371410['push'](_0x371410['shift']());}};_0x4689c0(++_0x50762a);}(_0x702d,0x147));var _0xd702=function(_0xc68c6c,_0x132aa2){_0xc68c6c=_0xc68c6c-0x0;var _0x5f0419=_0x702d[_0xc68c6c];return _0x5f0419;};'use strict';var ChatQueueEvents=require(_0xd702('0x0'));var events=[_0xd702('0x1'),_0xd702('0x2'),_0xd702('0x3')];function createListener(_0x37ed5c,_0x5c2b9e){return function(_0x20c11a){_0x5c2b9e[_0xd702('0x4')](_0x37ed5c,_0x20c11a);};}function removeListener(_0x27b260,_0x1c5a32){return function(){ChatQueueEvents['removeListener'](_0x27b260,_0x1c5a32);};}exports[_0xd702('0x5')]=function(_0x544e94){for(var _0x1aecfc=0x0,_0x3a2c03=events[_0xd702('0x6')];_0x1aecfc<_0x3a2c03;_0x1aecfc++){var _0x5af246=events[_0x1aecfc];var _0x12bb75=createListener('chatQueue:'+_0x5af246,_0x544e94);ChatQueueEvents['on'](_0x5af246,_0x12bb75);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 007b75e..4894967 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x375f12,_0x34e235){_0x375f12=_0x375f12-0x0;var _0x5b5d54=_0x3e74[_0x375f12];return _0x5b5d54;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0xf9c94e,_0x16437b){_0xf9c94e=_0xf9c94e-0x0;var _0x5b0312=_0x3e74[_0xf9c94e];return _0x5b0312;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 471e43c..04e8e93 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 _0x6e6f=['STRING','DATE','sequelize','exports'];(function(_0x3ca85d,_0x5b4bc9){var _0xd2b97c=function(_0x413b9e){while(--_0x413b9e){_0x3ca85d['push'](_0x3ca85d['shift']());}};_0xd2b97c(++_0x5b4bc9);}(_0x6e6f,0x76));var _0xf6e6=function(_0x38576d,_0x527dc7){_0x38576d=_0x38576d-0x0;var _0x32534a=_0x6e6f[_0x38576d];return _0x32534a;};'use strict';var moment=require('moment');var Sequelize=require(_0xf6e6('0x0'));module[_0xf6e6('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf6e6('0x2')]},'joinAt':{'type':Sequelize[_0xf6e6('0x3')]},'leaveAt':{'type':Sequelize[_0xf6e6('0x3')]},'acceptAt':{'type':Sequelize[_0xf6e6('0x3')]},'exitAt':{'type':Sequelize[_0xf6e6('0x3')]},'reason':{'type':Sequelize[_0xf6e6('0x2')]}}; \ No newline at end of file +var _0x400a=['exports','STRING','DATE','moment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x400a,0x18b));var _0xa400=function(_0x42509b,_0x5e36e5){_0x42509b=_0x42509b-0x0;var _0x549670=_0x400a[_0x42509b];return _0x549670;};'use strict';var moment=require(_0xa400('0x0'));var Sequelize=require('sequelize');module[_0xa400('0x1')]={'uniqueid':{'type':Sequelize[_0xa400('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa400('0x2')]},'joinAt':{'type':Sequelize[_0xa400('0x3')]},'leaveAt':{'type':Sequelize[_0xa400('0x3')]},'acceptAt':{'type':Sequelize[_0xa400('0x3')]},'exitAt':{'type':Sequelize[_0xa400('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c2730ef..de28e62 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 _0x9bd9=['ChatQueueReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','error','name','index'];(function(_0x3df320,_0x546375){var _0x2b464b=function(_0x474edb){while(--_0x474edb){_0x3df320['push'](_0x3df320['shift']());}};_0x2b464b(++_0x546375);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x4f3e5a,_0x1ee150){_0x4f3e5a=_0x4f3e5a-0x0;var _0x452880=_0x9bd9[_0x4f3e5a];return _0x452880;};'use strict';var emlformat=require(_0x99bd('0x0'));var rimraf=require(_0x99bd('0x1'));var zipdir=require(_0x99bd('0x2'));var jsonpatch=require(_0x99bd('0x3'));var rp=require(_0x99bd('0x4'));var moment=require(_0x99bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x99bd('0x6'));var util=require('util');var path=require(_0x99bd('0x7'));var sox=require(_0x99bd('0x8'));var csv=require('to-csv');var ejs=require(_0x99bd('0x9'));var fs=require('fs');var fs_extra=require(_0x99bd('0xa'));var _=require(_0x99bd('0xb'));var squel=require(_0x99bd('0xc'));var crypto=require(_0x99bd('0xd'));var jsforce=require(_0x99bd('0xe'));var deskjs=require(_0x99bd('0xf'));var toCsv=require(_0x99bd('0x10'));var querystring=require(_0x99bd('0x11'));var Papa=require(_0x99bd('0x12'));var Redis=require(_0x99bd('0x13'));var authService=require(_0x99bd('0x14'));var qs=require(_0x99bd('0x15'));var as=require(_0x99bd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99bd('0x17'))('api');var utils=require(_0x99bd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x99bd('0x19'));var db=require(_0x99bd('0x1a'))['db'];function respondWithStatusCode(_0x4a8bd9,_0x22237c){_0x22237c=_0x22237c||0xcc;return function(_0x500cd2){if(_0x500cd2){return _0x4a8bd9[_0x99bd('0x1b')](_0x22237c);}return _0x4a8bd9['status'](_0x22237c)[_0x99bd('0x1c')]();};}function respondWithResult(_0x401299,_0x141159){_0x141159=_0x141159||0xc8;return function(_0x4a9770){if(_0x4a9770){return _0x401299[_0x99bd('0x1d')](_0x141159)[_0x99bd('0x1e')](_0x4a9770);}};}function respondWithFilteredResult(_0x2d918a,_0x42b619){return function(_0x65a2e5){if(_0x65a2e5){var _0x491d9=typeof _0x42b619[_0x99bd('0x1f')]===_0x99bd('0x20')&&typeof _0x42b619[_0x99bd('0x21')]==='undefined';var _0x378079=_0x65a2e5[_0x99bd('0x22')];var _0x2fe078=_0x491d9?0x0:_0x42b619['offset'];var _0x4b98fc=_0x491d9?_0x65a2e5[_0x99bd('0x22')]:_0x42b619[_0x99bd('0x1f')]+_0x42b619[_0x99bd('0x21')];var _0xfa6227;if(_0x4b98fc>=_0x378079){_0x4b98fc=_0x378079;_0xfa6227=0xc8;}else{_0xfa6227=0xce;}_0x2d918a[_0x99bd('0x1d')](_0xfa6227);return _0x2d918a['set'](_0x99bd('0x23'),_0x2fe078+'-'+_0x4b98fc+'/'+_0x378079)['json'](_0x65a2e5);}return null;};}function patchUpdates(_0x10f2fb){return function(_0x3085df){try{jsonpatch[_0x99bd('0x24')](_0x3085df,_0x10f2fb,!![]);}catch(_0x1d937b){return BPromise[_0x99bd('0x25')](_0x1d937b);}return _0x3085df['save']();};}function saveUpdates(_0x27c551,_0x229322){return function(_0x3e339c){if(_0x3e339c){return _0x3e339c['update'](_0x27c551)[_0x99bd('0x26')](function(_0x5e6081){return _0x5e6081;});}return null;};}function removeEntity(_0x4d3ebb,_0x1c5b82){return function(_0xfdc455){if(_0xfdc455){return _0xfdc455['destroy']()[_0x99bd('0x26')](function(){_0x4d3ebb[_0x99bd('0x1d')](0xcc)[_0x99bd('0x1c')]();});}};}function handleEntityNotFound(_0x3f7bf4,_0x51ff34){return function(_0x12daac){if(!_0x12daac){_0x3f7bf4['sendStatus'](0x194);}return _0x12daac;};}function handleError(_0x550b7f,_0x10d5cd){_0x10d5cd=_0x10d5cd||0x1f4;return function(_0x5ebeeb){logger[_0x99bd('0x27')](_0x5ebeeb['stack']);if(_0x5ebeeb[_0x99bd('0x28')]){delete _0x5ebeeb[_0x99bd('0x28')];}_0x550b7f['status'](_0x10d5cd)['send'](_0x5ebeeb);};}exports[_0x99bd('0x29')]=function(_0x1af1e6,_0x1eabb9){var _0x5903aa={},_0x957d48={},_0x1d0642={'count':0x0,'rows':[]};var _0x2250d8=_['map'](db[_0x99bd('0x2a')][_0x99bd('0x2b')],function(_0x4c5493){return{'name':_0x4c5493[_0x99bd('0x2c')],'type':_0x4c5493[_0x99bd('0x2d')][_0x99bd('0x2e')]};});_0x957d48[_0x99bd('0x2f')]=_['map'](_0x2250d8,_0x99bd('0x28'));_0x957d48[_0x99bd('0x30')]=_['keys'](_0x1af1e6[_0x99bd('0x30')]);_0x957d48['filters']=_['intersection'](_0x957d48['model'],_0x957d48[_0x99bd('0x30')]);_0x5903aa[_0x99bd('0x31')]=_[_0x99bd('0x32')](_0x957d48[_0x99bd('0x2f')],qs[_0x99bd('0x33')](_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x33')]));_0x5903aa[_0x99bd('0x31')]=_0x5903aa[_0x99bd('0x31')][_0x99bd('0x34')]?_0x5903aa['attributes']:_0x957d48[_0x99bd('0x2f')];if(!_0x1af1e6['query'][_0x99bd('0x35')]('nolimit')){_0x5903aa['limit']=qs['limit'](_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x21')]);_0x5903aa[_0x99bd('0x1f')]=qs[_0x99bd('0x1f')](_0x1af1e6['query'][_0x99bd('0x1f')]);}_0x5903aa[_0x99bd('0x36')]=qs[_0x99bd('0x37')](_0x1af1e6[_0x99bd('0x30')]['sort']);_0x5903aa[_0x99bd('0x38')]=qs[_0x99bd('0x39')](_[_0x99bd('0x3a')](_0x1af1e6[_0x99bd('0x30')],_0x957d48['filters']),_0x2250d8);if(_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x3b')]){_0x5903aa[_0x99bd('0x38')]=_[_0x99bd('0x3c')](_0x5903aa['where'],{'$or':_[_0x99bd('0x3d')](_0x2250d8,function(_0x3d2b0f){if(_0x3d2b0f[_0x99bd('0x2d')]!==_0x99bd('0x3e')){var _0x7e29ec={};_0x7e29ec[_0x3d2b0f[_0x99bd('0x28')]]={'$like':'%'+_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x3b')]+'%'};return _0x7e29ec;}})});}_0x5903aa=_[_0x99bd('0x3c')]({},_0x5903aa,_0x1af1e6[_0x99bd('0x3f')]);var _0x2fcf71={'where':_0x5903aa[_0x99bd('0x38')]};return db[_0x99bd('0x2a')]['count'](_0x2fcf71)[_0x99bd('0x26')](function(_0x1ecdd6){_0x1d0642[_0x99bd('0x22')]=_0x1ecdd6;if(_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x40')]){_0x5903aa[_0x99bd('0x41')]=[{'all':!![]}];}return db[_0x99bd('0x2a')][_0x99bd('0x42')](_0x5903aa);})[_0x99bd('0x26')](function(_0x7e84b1){_0x1d0642[_0x99bd('0x43')]=_0x7e84b1;return _0x1d0642;})[_0x99bd('0x26')](respondWithFilteredResult(_0x1eabb9,_0x5903aa))[_0x99bd('0x44')](handleError(_0x1eabb9,null));};exports[_0x99bd('0x45')]=function(_0xb0ffe5,_0x2d91be){var _0x369fb5={'raw':!![],'where':{'id':_0xb0ffe5[_0x99bd('0x46')]['id']}},_0x5a4a96={};_0x5a4a96[_0x99bd('0x2f')]=_[_0x99bd('0x47')](db[_0x99bd('0x2a')][_0x99bd('0x2b')]);_0x5a4a96[_0x99bd('0x30')]=_[_0x99bd('0x47')](_0xb0ffe5[_0x99bd('0x30')]);_0x5a4a96['filters']=_[_0x99bd('0x32')](_0x5a4a96[_0x99bd('0x2f')],_0x5a4a96[_0x99bd('0x30')]);_0x369fb5['attributes']=_[_0x99bd('0x32')](_0x5a4a96[_0x99bd('0x2f')],qs[_0x99bd('0x33')](_0xb0ffe5['query'][_0x99bd('0x33')]));_0x369fb5['attributes']=_0x369fb5['attributes']['length']?_0x369fb5[_0x99bd('0x31')]:_0x5a4a96[_0x99bd('0x2f')];if(_0xb0ffe5[_0x99bd('0x30')]['includeAll']){_0x369fb5[_0x99bd('0x41')]=[{'all':!![]}];}_0x369fb5=_[_0x99bd('0x3c')]({},_0x369fb5,_0xb0ffe5[_0x99bd('0x3f')]);return db['ChatQueueReport'][_0x99bd('0x48')](_0x369fb5)[_0x99bd('0x26')](handleEntityNotFound(_0x2d91be,null))['then'](respondWithResult(_0x2d91be,null))['catch'](handleError(_0x2d91be,null));};exports[_0x99bd('0x49')]=function(_0x1d7ec0,_0x3487c6){return db['ChatQueueReport']['create'](_0x1d7ec0[_0x99bd('0x4a')],{})[_0x99bd('0x26')](respondWithResult(_0x3487c6,0xc9))[_0x99bd('0x44')](handleError(_0x3487c6,null));};exports['update']=function(_0x3fa8e1,_0x4e71b3){if(_0x3fa8e1[_0x99bd('0x4a')]['id']){delete _0x3fa8e1[_0x99bd('0x4a')]['id'];}return db[_0x99bd('0x2a')][_0x99bd('0x48')]({'where':{'id':_0x3fa8e1[_0x99bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e71b3,null))[_0x99bd('0x26')](saveUpdates(_0x3fa8e1['body'],null))[_0x99bd('0x26')](respondWithResult(_0x4e71b3,null))[_0x99bd('0x44')](handleError(_0x4e71b3,null));};exports[_0x99bd('0x4b')]=function(_0x1912ac,_0x2100c7){return db[_0x99bd('0x2a')][_0x99bd('0x48')]({'where':{'id':_0x1912ac['params']['id']}})['then'](handleEntityNotFound(_0x2100c7,null))[_0x99bd('0x26')](removeEntity(_0x2100c7,null))[_0x99bd('0x44')](handleError(_0x2100c7,null));};exports[_0x99bd('0x4c')]=function(_0x2f0fb7,_0x25c67d){return db[_0x99bd('0x2a')][_0x99bd('0x4c')]()['then'](respondWithResult(_0x25c67d,null))['catch'](handleError(_0x25c67d,null));}; \ No newline at end of file +var _0x6333=['include','catch','params','create','body','find','describe','fast-json-patch','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll'];(function(_0x4de812,_0x4b5f82){var _0x20b022=function(_0x35d063){while(--_0x35d063){_0x4de812['push'](_0x4de812['shift']());}};_0x20b022(++_0x4b5f82);}(_0x6333,0x83));var _0x3633=function(_0x411f8a,_0x4d533c){_0x411f8a=_0x411f8a-0x0;var _0x434695=_0x6333[_0x411f8a];return _0x434695;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3633('0x0'));var rp=require('request-promise');var moment=require(_0x3633('0x1'));var BPromise=require(_0x3633('0x2'));var Mustache=require('mustache');var util=require(_0x3633('0x3'));var path=require('path');var sox=require(_0x3633('0x4'));var csv=require(_0x3633('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3633('0x6'));var squel=require(_0x3633('0x7'));var crypto=require(_0x3633('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3633('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3633('0x9'));var authService=require(_0x3633('0xa'));var qs=require(_0x3633('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3633('0xc'));var logger=require(_0x3633('0xd'))('api');var utils=require('../../config/utils');var config=require(_0x3633('0xe'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x337f72,_0xf1346){_0xf1346=_0xf1346||0xcc;return function(_0x51a78a){if(_0x51a78a){return _0x337f72[_0x3633('0xf')](_0xf1346);}return _0x337f72[_0x3633('0x10')](_0xf1346)['end']();};}function respondWithResult(_0x3231f9,_0x28f08e){_0x28f08e=_0x28f08e||0xc8;return function(_0x5bf51b){if(_0x5bf51b){return _0x3231f9[_0x3633('0x10')](_0x28f08e)['json'](_0x5bf51b);}};}function respondWithFilteredResult(_0x4c71ea,_0x1b5728){return function(_0x377f19){if(_0x377f19){var _0x2f5eab=typeof _0x1b5728[_0x3633('0x11')]===_0x3633('0x12')&&typeof _0x1b5728[_0x3633('0x13')]==='undefined';var _0x2d123e=_0x377f19[_0x3633('0x14')];var _0x578e08=_0x2f5eab?0x0:_0x1b5728['offset'];var _0x38a7bc=_0x2f5eab?_0x377f19['count']:_0x1b5728['offset']+_0x1b5728[_0x3633('0x13')];var _0x13f7af;if(_0x38a7bc>=_0x2d123e){_0x38a7bc=_0x2d123e;_0x13f7af=0xc8;}else{_0x13f7af=0xce;}_0x4c71ea[_0x3633('0x10')](_0x13f7af);return _0x4c71ea['set'](_0x3633('0x15'),_0x578e08+'-'+_0x38a7bc+'/'+_0x2d123e)[_0x3633('0x16')](_0x377f19);}return null;};}function patchUpdates(_0x107b5a){return function(_0x47d57b){try{jsonpatch[_0x3633('0x17')](_0x47d57b,_0x107b5a,!![]);}catch(_0x2b7f86){return BPromise[_0x3633('0x18')](_0x2b7f86);}return _0x47d57b['save']();};}function saveUpdates(_0x55686f,_0x17a013){return function(_0x4ed8e3){if(_0x4ed8e3){return _0x4ed8e3[_0x3633('0x19')](_0x55686f)[_0x3633('0x1a')](function(_0x1d5270){return _0x1d5270;});}return null;};}function removeEntity(_0x1115dd,_0x4306ef){return function(_0x27511a){if(_0x27511a){return _0x27511a[_0x3633('0x1b')]()[_0x3633('0x1a')](function(){_0x1115dd[_0x3633('0x10')](0xcc)[_0x3633('0x1c')]();});}};}function handleEntityNotFound(_0x2c781f,_0x3844d5){return function(_0x4b0ad7){if(!_0x4b0ad7){_0x2c781f[_0x3633('0xf')](0x194);}return _0x4b0ad7;};}function handleError(_0x145e3c,_0x493e14){_0x493e14=_0x493e14||0x1f4;return function(_0x19c36c){logger[_0x3633('0x1d')](_0x19c36c[_0x3633('0x1e')]);if(_0x19c36c[_0x3633('0x1f')]){delete _0x19c36c[_0x3633('0x1f')];}_0x145e3c[_0x3633('0x10')](_0x493e14)[_0x3633('0x20')](_0x19c36c);};}exports['index']=function(_0x9fa0fd,_0x55d70a){var _0x1ea384={},_0xbf7c64={},_0x2306e4={'count':0x0,'rows':[]};var _0x142c48=_[_0x3633('0x21')](db[_0x3633('0x22')][_0x3633('0x23')],function(_0x2ceabb){return{'name':_0x2ceabb['fieldName'],'type':_0x2ceabb[_0x3633('0x24')][_0x3633('0x25')]};});_0xbf7c64[_0x3633('0x26')]=_[_0x3633('0x21')](_0x142c48,_0x3633('0x1f'));_0xbf7c64[_0x3633('0x27')]=_[_0x3633('0x28')](_0x9fa0fd['query']);_0xbf7c64[_0x3633('0x29')]=_[_0x3633('0x2a')](_0xbf7c64['model'],_0xbf7c64[_0x3633('0x27')]);_0x1ea384[_0x3633('0x2b')]=_[_0x3633('0x2a')](_0xbf7c64[_0x3633('0x26')],qs[_0x3633('0x2c')](_0x9fa0fd['query'][_0x3633('0x2c')]));_0x1ea384['attributes']=_0x1ea384['attributes'][_0x3633('0x2d')]?_0x1ea384['attributes']:_0xbf7c64[_0x3633('0x26')];if(!_0x9fa0fd[_0x3633('0x27')]['hasOwnProperty'](_0x3633('0x2e'))){_0x1ea384[_0x3633('0x13')]=qs['limit'](_0x9fa0fd['query'][_0x3633('0x13')]);_0x1ea384[_0x3633('0x11')]=qs[_0x3633('0x11')](_0x9fa0fd[_0x3633('0x27')]['offset']);}_0x1ea384[_0x3633('0x2f')]=qs[_0x3633('0x30')](_0x9fa0fd[_0x3633('0x27')]['sort']);_0x1ea384[_0x3633('0x31')]=qs['filters'](_[_0x3633('0x32')](_0x9fa0fd[_0x3633('0x27')],_0xbf7c64[_0x3633('0x29')]),_0x142c48);if(_0x9fa0fd[_0x3633('0x27')]['filter']){_0x1ea384[_0x3633('0x31')]=_[_0x3633('0x33')](_0x1ea384['where'],{'$or':_[_0x3633('0x21')](_0x142c48,function(_0x4c4647){if(_0x4c4647[_0x3633('0x24')]!==_0x3633('0x34')){var _0x1b1302={};_0x1b1302[_0x4c4647['name']]={'$like':'%'+_0x9fa0fd[_0x3633('0x27')]['filter']+'%'};return _0x1b1302;}})});}_0x1ea384=_[_0x3633('0x33')]({},_0x1ea384,_0x9fa0fd[_0x3633('0x35')]);var _0x10bbfd={'where':_0x1ea384[_0x3633('0x31')]};return db['ChatQueueReport'][_0x3633('0x14')](_0x10bbfd)[_0x3633('0x1a')](function(_0x1dfdcb){_0x2306e4[_0x3633('0x14')]=_0x1dfdcb;if(_0x9fa0fd[_0x3633('0x27')][_0x3633('0x36')]){_0x1ea384[_0x3633('0x37')]=[{'all':!![]}];}return db[_0x3633('0x22')]['findAll'](_0x1ea384);})['then'](function(_0x2cdeee){_0x2306e4['rows']=_0x2cdeee;return _0x2306e4;})[_0x3633('0x1a')](respondWithFilteredResult(_0x55d70a,_0x1ea384))[_0x3633('0x38')](handleError(_0x55d70a,null));};exports['show']=function(_0x192561,_0x3cf8d9){var _0x1edb4b={'raw':!![],'where':{'id':_0x192561[_0x3633('0x39')]['id']}},_0x399a80={};_0x399a80['model']=_['keys'](db[_0x3633('0x22')][_0x3633('0x23')]);_0x399a80[_0x3633('0x27')]=_[_0x3633('0x28')](_0x192561[_0x3633('0x27')]);_0x399a80[_0x3633('0x29')]=_[_0x3633('0x2a')](_0x399a80['model'],_0x399a80[_0x3633('0x27')]);_0x1edb4b[_0x3633('0x2b')]=_[_0x3633('0x2a')](_0x399a80['model'],qs['fields'](_0x192561[_0x3633('0x27')]['fields']));_0x1edb4b[_0x3633('0x2b')]=_0x1edb4b['attributes'][_0x3633('0x2d')]?_0x1edb4b[_0x3633('0x2b')]:_0x399a80[_0x3633('0x26')];if(_0x192561[_0x3633('0x27')][_0x3633('0x36')]){_0x1edb4b[_0x3633('0x37')]=[{'all':!![]}];}_0x1edb4b=_[_0x3633('0x33')]({},_0x1edb4b,_0x192561[_0x3633('0x35')]);return db['ChatQueueReport']['find'](_0x1edb4b)[_0x3633('0x1a')](handleEntityNotFound(_0x3cf8d9,null))[_0x3633('0x1a')](respondWithResult(_0x3cf8d9,null))['catch'](handleError(_0x3cf8d9,null));};exports[_0x3633('0x3a')]=function(_0x352260,_0x2f14e5){return db['ChatQueueReport']['create'](_0x352260[_0x3633('0x3b')],{})[_0x3633('0x1a')](respondWithResult(_0x2f14e5,0xc9))[_0x3633('0x38')](handleError(_0x2f14e5,null));};exports[_0x3633('0x19')]=function(_0xb39d18,_0x2ae7bd){if(_0xb39d18['body']['id']){delete _0xb39d18[_0x3633('0x3b')]['id'];}return db[_0x3633('0x22')][_0x3633('0x3c')]({'where':{'id':_0xb39d18[_0x3633('0x39')]['id']}})[_0x3633('0x1a')](handleEntityNotFound(_0x2ae7bd,null))[_0x3633('0x1a')](saveUpdates(_0xb39d18[_0x3633('0x3b')],null))['then'](respondWithResult(_0x2ae7bd,null))[_0x3633('0x38')](handleError(_0x2ae7bd,null));};exports['destroy']=function(_0x321429,_0x31a072){return db['ChatQueueReport'][_0x3633('0x3c')]({'where':{'id':_0x321429['params']['id']}})[_0x3633('0x1a')](handleEntityNotFound(_0x31a072,null))[_0x3633('0x1a')](removeEntity(_0x31a072,null))[_0x3633('0x38')](handleError(_0x31a072,null));};exports[_0x3633('0x3d')]=function(_0x264e08,_0x57f2f6){return db[_0x3633('0x22')][_0x3633('0x3d')]()[_0x3633('0x1a')](respondWithResult(_0x57f2f6,null))['catch'](handleError(_0x57f2f6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f1a1dbf..8f7e49e 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4fba08,_0x5e8b7c){var _0x7f9578=function(_0xaacee4){while(--_0xaacee4){_0x4fba08['push'](_0x4fba08['shift']());}};_0x7f9578(++_0x5e8b7c);}(_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 +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x582a7b,_0x17db27){var _0x24be2d=function(_0x1781a7){while(--_0x1781a7){_0x582a7b['push'](_0x582a7b['shift']());}};_0x24be2d(++_0x17db27);}(_0x757a,0xde));var _0xa757=function(_0x26562f,_0x5a1192){_0x26562f=_0x26562f-0x0;var _0x446717=_0x757a[_0x26562f];return _0x446717;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 08ccb8c..9fdb989 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 _0xb14f=['body','options','raw','debug','stringify','UpdateChatQueueReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb14f,0x152));var _0xfb14=function(_0x22c187,_0x458c95){_0x22c187=_0x22c187-0x0;var _0x172b6f=_0xb14f[_0x22c187];return _0x172b6f;};'use strict';var _=require(_0xfb14('0x0'));var util=require(_0xfb14('0x1'));var moment=require(_0xfb14('0x2'));var BPromise=require(_0xfb14('0x3'));var rs=require(_0xfb14('0x4'));var fs=require('fs');var Redis=require(_0xfb14('0x5'));var db=require(_0xfb14('0x6'))['db'];var utils=require(_0xfb14('0x7'));var logger=require(_0xfb14('0x8'))('rpc');var config=require(_0xfb14('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfb14('0xa')][_0xfb14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x492dbc,_0x4f4d9a,_0x1bd6e2){return new BPromise(function(_0x31dc36,_0x16ed71){return client[_0xfb14('0xc')](_0x492dbc,_0x1bd6e2)[_0xfb14('0xd')](function(_0x5da1d2){logger[_0xfb14('0xe')](_0xfb14('0xf'),_0x4f4d9a,_0xfb14('0x10'));logger['debug'](_0xfb14('0x11'),_0x4f4d9a,_0xfb14('0x10'),JSON['stringify'](_0x5da1d2));if(_0x5da1d2[_0xfb14('0x12')]){if(_0x5da1d2[_0xfb14('0x12')]['code']===0x1f4){logger[_0xfb14('0x12')](_0xfb14('0xf'),_0x4f4d9a,_0x5da1d2[_0xfb14('0x12')][_0xfb14('0x13')]);return _0x16ed71(_0x5da1d2[_0xfb14('0x12')][_0xfb14('0x13')]);}logger[_0xfb14('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x4f4d9a,_0x5da1d2['error'][_0xfb14('0x13')]);return _0x31dc36(_0x5da1d2['error']['message']);}else{logger[_0xfb14('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x4f4d9a,'request\x20sent');_0x31dc36(_0x5da1d2[_0xfb14('0x14')][_0xfb14('0x13')]);}})[_0xfb14('0x15')](function(_0x5ece28){logger[_0xfb14('0x12')](_0xfb14('0xf'),_0x4f4d9a,_0x5ece28);_0x16ed71(_0x5ece28);});});}exports[_0xfb14('0x16')]=function(_0x4b3563){var _0x4b77d5=this;return new Promise(function(_0x278911,_0x5dd3d3){return db[_0xfb14('0x17')][_0xfb14('0x18')](_0x4b3563[_0xfb14('0x19')],{'raw':_0x4b3563['options']?_0x4b3563[_0xfb14('0x1a')][_0xfb14('0x1b')]===undefined?!![]:![]:!![]})[_0xfb14('0xd')](function(_0x4e2849){logger[_0xfb14('0xe')](_0xfb14('0x16'),_0x4b3563);logger[_0xfb14('0x1c')]('CreateChatQueueReport',_0x4b3563,JSON[_0xfb14('0x1d')](_0x4e2849));_0x278911(_0x4e2849);})[_0xfb14('0x15')](function(_0x2199fc){logger['error'](_0xfb14('0x16'),_0x2199fc[_0xfb14('0x13')],_0x4b3563);_0x5dd3d3(_0x4b77d5[_0xfb14('0x12')](0x1f4,_0x2199fc[_0xfb14('0x13')]));});});};exports[_0xfb14('0x1e')]=function(_0x22ad07){var _0x504feb=this;return new Promise(function(_0x39be40,_0x34cece){return db[_0xfb14('0x17')][_0xfb14('0x1f')](_0x22ad07['body'],{'raw':_0x22ad07['options']?_0x22ad07[_0xfb14('0x1a')][_0xfb14('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22ad07[_0xfb14('0x1a')]?_0x22ad07[_0xfb14('0x1a')][_0xfb14('0x20')]||null:null,'attributes':_0x22ad07[_0xfb14('0x1a')]?_0x22ad07[_0xfb14('0x1a')]['attributes']||null:null,'limit':_0x22ad07[_0xfb14('0x1a')]?_0x22ad07[_0xfb14('0x1a')]['limit']||null:null})[_0xfb14('0xd')](function(_0x31bdd9){logger[_0xfb14('0xe')]('UpdateChatQueueReport',_0x22ad07);logger['debug'](_0xfb14('0x1e'),_0x22ad07,JSON[_0xfb14('0x1d')](_0x31bdd9));_0x39be40(_0x31bdd9);})[_0xfb14('0x15')](function(_0x5a35c0){logger[_0xfb14('0x12')](_0xfb14('0x1e'),_0x5a35c0[_0xfb14('0x13')],_0x22ad07);_0x34cece(_0x504feb[_0xfb14('0x12')](0x1f4,_0x5a35c0[_0xfb14('0x13')]));});});}; \ No newline at end of file +var _0x7292=['../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x43d025,_0x14c205){var _0x165dd7=function(_0x28f90b){while(--_0x28f90b){_0x43d025['push'](_0x43d025['shift']());}};_0x165dd7(++_0x14c205);}(_0x7292,0x107));var _0x2729=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7292[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var moment=require(_0x2729('0x2'));var BPromise=require(_0x2729('0x3'));var rs=require(_0x2729('0x4'));var fs=require('fs');var Redis=require(_0x2729('0x5'));var db=require(_0x2729('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2729('0x7'))(_0x2729('0x8'));var config=require(_0x2729('0x9'));var jayson=require(_0x2729('0xa'));var client=jayson[_0x2729('0xb')][_0x2729('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3562b9,_0xc89855,_0x1081fd){return new BPromise(function(_0x4c0952,_0x5f4f01){return client[_0x2729('0xd')](_0x3562b9,_0x1081fd)[_0x2729('0xe')](function(_0x47be81){logger[_0x2729('0xf')](_0x2729('0x10'),_0xc89855,_0x2729('0x11'));logger[_0x2729('0x12')](_0x2729('0x13'),_0xc89855,_0x2729('0x11'),JSON[_0x2729('0x14')](_0x47be81));if(_0x47be81[_0x2729('0x15')]){if(_0x47be81[_0x2729('0x15')]['code']===0x1f4){logger[_0x2729('0x15')](_0x2729('0x10'),_0xc89855,_0x47be81[_0x2729('0x15')]['message']);return _0x5f4f01(_0x47be81[_0x2729('0x15')][_0x2729('0x16')]);}logger[_0x2729('0x15')](_0x2729('0x10'),_0xc89855,_0x47be81[_0x2729('0x15')][_0x2729('0x16')]);return _0x4c0952(_0x47be81[_0x2729('0x15')][_0x2729('0x16')]);}else{logger['info'](_0x2729('0x10'),_0xc89855,_0x2729('0x11'));_0x4c0952(_0x47be81[_0x2729('0x17')]['message']);}})[_0x2729('0x18')](function(_0x5c3e88){logger['error'](_0x2729('0x10'),_0xc89855,_0x5c3e88);_0x5f4f01(_0x5c3e88);});});}exports['CreateChatQueueReport']=function(_0x41623f){var _0x5dafac=this;return new Promise(function(_0x190c7e,_0x47c96b){return db['ChatQueueReport'][_0x2729('0x19')](_0x41623f[_0x2729('0x1a')],{'raw':_0x41623f[_0x2729('0x1b')]?_0x41623f[_0x2729('0x1b')][_0x2729('0x1c')]===undefined?!![]:![]:!![]})[_0x2729('0xe')](function(_0x2c473c){logger[_0x2729('0xf')]('CreateChatQueueReport',_0x41623f);logger[_0x2729('0x12')](_0x2729('0x1d'),_0x41623f,JSON[_0x2729('0x14')](_0x2c473c));_0x190c7e(_0x2c473c);})[_0x2729('0x18')](function(_0x492753){logger[_0x2729('0x15')](_0x2729('0x1d'),_0x492753[_0x2729('0x16')],_0x41623f);_0x47c96b(_0x5dafac['error'](0x1f4,_0x492753['message']));});});};exports[_0x2729('0x1e')]=function(_0x18bd4f){var _0x598770=this;return new Promise(function(_0x20e906,_0x72bdd2){return db[_0x2729('0x1f')][_0x2729('0x20')](_0x18bd4f[_0x2729('0x1a')],{'raw':_0x18bd4f[_0x2729('0x1b')]?_0x18bd4f[_0x2729('0x1b')][_0x2729('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18bd4f['options']?_0x18bd4f[_0x2729('0x1b')][_0x2729('0x21')]||null:null,'attributes':_0x18bd4f['options']?_0x18bd4f[_0x2729('0x1b')]['attributes']||null:null,'limit':_0x18bd4f['options']?_0x18bd4f['options']['limit']||null:null})['then'](function(_0x888b66){logger[_0x2729('0xf')]('UpdateChatQueueReport',_0x18bd4f);logger[_0x2729('0x12')](_0x2729('0x1e'),_0x18bd4f,JSON[_0x2729('0x14')](_0x888b66));_0x20e906(_0x888b66);})[_0x2729('0x18')](function(_0x578a94){logger[_0x2729('0x15')](_0x2729('0x1e'),_0x578a94[_0x2729('0x16')],_0x18bd4f);_0x72bdd2(_0x598770['error'](0x1f4,_0x578a94['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 155c3a5..bfe06ba 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 _0x23b4=['path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','exports','multer','util'];(function(_0x547587,_0x48cbd9){var _0x3d7777=function(_0x3e5075){while(--_0x3e5075){_0x547587['push'](_0x547587['shift']());}};_0x3d7777(++_0x48cbd9);}(_0x23b4,0x1c0));var _0x423b=function(_0x54b749,_0x45913f){_0x54b749=_0x54b749-0x0;var _0x5a1b77=_0x23b4[_0x54b749];return _0x5a1b77;};'use strict';var multer=require(_0x423b('0x0'));var util=require(_0x423b('0x1'));var path=require(_0x423b('0x2'));var timeout=require(_0x423b('0x3'));var express=require(_0x423b('0x4'));var router=express[_0x423b('0x5')]();var fs_extra=require(_0x423b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x423b('0x7')]('/',auth[_0x423b('0x8')](),controller[_0x423b('0x9')]);router[_0x423b('0x7')](_0x423b('0xa'),auth['isAuthenticated'](),controller[_0x423b('0xb')]);router['get'](_0x423b('0xc'),auth[_0x423b('0x8')](),controller[_0x423b('0xd')]);router[_0x423b('0xe')]('/',auth['isAuthenticated'](),controller[_0x423b('0xf')]);router['put']('/:id',auth[_0x423b('0x8')](),controller[_0x423b('0x10')]);router['delete'](_0x423b('0xc'),auth[_0x423b('0x8')](),controller['destroy']);module[_0x423b('0x11')]=router; \ No newline at end of file +var _0xd75f=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete'];(function(_0x2715e2,_0x2df562){var _0x39b018=function(_0x383cdb){while(--_0x383cdb){_0x2715e2['push'](_0x2715e2['shift']());}};_0x39b018(++_0x2df562);}(_0xd75f,0x16a));var _0xfd75=function(_0x191372,_0xa55f6c){_0x191372=_0x191372-0x0;var _0x1f3352=_0xd75f[_0x191372];return _0x1f3352;};'use strict';var multer=require(_0xfd75('0x0'));var util=require(_0xfd75('0x1'));var path=require(_0xfd75('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfd75('0x3')]();var fs_extra=require(_0xfd75('0x4'));var auth=require(_0xfd75('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfd75('0x6'));router['get']('/',auth[_0xfd75('0x7')](),controller[_0xfd75('0x8')]);router[_0xfd75('0x9')](_0xfd75('0xa'),auth[_0xfd75('0x7')](),controller[_0xfd75('0xb')]);router[_0xfd75('0x9')](_0xfd75('0xc'),auth[_0xfd75('0x7')](),controller[_0xfd75('0xd')]);router['post']('/',auth[_0xfd75('0x7')](),controller[_0xfd75('0xe')]);router[_0xfd75('0xf')](_0xfd75('0xc'),auth[_0xfd75('0x7')](),controller[_0xfd75('0x10')]);router[_0xfd75('0x11')](_0xfd75('0xc'),auth[_0xfd75('0x7')](),controller[_0xfd75('0x12')]);module[_0xfd75('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 c540d75..ae4fd8a 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x104b47,_0x491eff){var _0x34a3f1=function(_0x467a15){while(--_0x467a15){_0x104b47['push'](_0x104b47['shift']());}};_0x34a3f1(++_0x491eff);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x84ed8,_0x5e562a){var _0x5ed46a=function(_0x3fbf11){while(--_0x3fbf11){_0x84ed8['push'](_0x84ed8['shift']());}};_0x5ed46a(++_0x5e562a);}(_0xaa88,0x137));var _0x8aa8=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xaa88[_0x5037ab];return _0x512adb;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index f598506..5f983e2 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 _0xc817=['request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','ChatTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','options','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x105afe,_0x47a9cc){var _0x52f4fa=function(_0xb4af8b){while(--_0xb4af8b){_0x105afe['push'](_0x105afe['shift']());}};_0x52f4fa(++_0x47a9cc);}(_0xc817,0x1be));var _0x7c81=function(_0x57709b,_0x19d0f1){_0x57709b=_0x57709b-0x0;var _0x488e6d=_0xc817[_0x57709b];return _0x488e6d;};'use strict';var emlformat=require(_0x7c81('0x0'));var rimraf=require(_0x7c81('0x1'));var zipdir=require(_0x7c81('0x2'));var jsonpatch=require(_0x7c81('0x3'));var rp=require(_0x7c81('0x4'));var moment=require(_0x7c81('0x5'));var BPromise=require(_0x7c81('0x6'));var Mustache=require('mustache');var util=require(_0x7c81('0x7'));var path=require('path');var sox=require(_0x7c81('0x8'));var csv=require('to-csv');var ejs=require(_0x7c81('0x9'));var fs=require('fs');var fs_extra=require(_0x7c81('0xa'));var _=require('lodash');var squel=require(_0x7c81('0xb'));var crypto=require(_0x7c81('0xc'));var jsforce=require(_0x7c81('0xd'));var deskjs=require(_0x7c81('0xe'));var toCsv=require(_0x7c81('0xf'));var querystring=require(_0x7c81('0x10'));var Papa=require(_0x7c81('0x11'));var Redis=require('ioredis');var authService=require(_0x7c81('0x12'));var qs=require(_0x7c81('0x13'));var as=require(_0x7c81('0x14'));var hardwareService=require(_0x7c81('0x15'));var logger=require('../../config/logger')(_0x7c81('0x16'));var utils=require(_0x7c81('0x17'));var config=require(_0x7c81('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c58c9,_0x5eb550){_0x5eb550=_0x5eb550||0xcc;return function(_0x23b7bd){if(_0x23b7bd){return _0x2c58c9[_0x7c81('0x19')](_0x5eb550);}return _0x2c58c9[_0x7c81('0x1a')](_0x5eb550)[_0x7c81('0x1b')]();};}function respondWithResult(_0x331964,_0x10143d){_0x10143d=_0x10143d||0xc8;return function(_0xe114c0){if(_0xe114c0){return _0x331964['status'](_0x10143d)[_0x7c81('0x1c')](_0xe114c0);}};}function respondWithFilteredResult(_0x16c4c4,_0x10791b){return function(_0x40eba0){if(_0x40eba0){var _0x42a298=typeof _0x10791b['offset']==='undefined'&&typeof _0x10791b[_0x7c81('0x1d')]===_0x7c81('0x1e');var _0x421c80=_0x40eba0['count'];var _0x474e34=_0x42a298?0x0:_0x10791b[_0x7c81('0x1f')];var _0x1eee90=_0x42a298?_0x40eba0[_0x7c81('0x20')]:_0x10791b[_0x7c81('0x1f')]+_0x10791b[_0x7c81('0x1d')];var _0x6677b0;if(_0x1eee90>=_0x421c80){_0x1eee90=_0x421c80;_0x6677b0=0xc8;}else{_0x6677b0=0xce;}_0x16c4c4[_0x7c81('0x1a')](_0x6677b0);return _0x16c4c4[_0x7c81('0x21')](_0x7c81('0x22'),_0x474e34+'-'+_0x1eee90+'/'+_0x421c80)[_0x7c81('0x1c')](_0x40eba0);}return null;};}function patchUpdates(_0x25e107){return function(_0x2508b7){try{jsonpatch[_0x7c81('0x23')](_0x2508b7,_0x25e107,!![]);}catch(_0x1c8d27){return BPromise[_0x7c81('0x24')](_0x1c8d27);}return _0x2508b7['save']();};}function saveUpdates(_0x59e719,_0x5a3e6c){return function(_0x1304fd){if(_0x1304fd){return _0x1304fd[_0x7c81('0x25')](_0x59e719)[_0x7c81('0x26')](function(_0x2ffb85){return _0x2ffb85;});}return null;};}function removeEntity(_0x2aa73c,_0x3fd05d){return function(_0x133b0a){if(_0x133b0a){return _0x133b0a['destroy']()[_0x7c81('0x26')](function(){_0x2aa73c[_0x7c81('0x1a')](0xcc)[_0x7c81('0x1b')]();});}};}function handleEntityNotFound(_0x534780,_0x265d2e){return function(_0x3ce5c8){if(!_0x3ce5c8){_0x534780[_0x7c81('0x19')](0x194);}return _0x3ce5c8;};}function handleError(_0x424255,_0x165a10){_0x165a10=_0x165a10||0x1f4;return function(_0x1e097e){logger[_0x7c81('0x27')](_0x1e097e[_0x7c81('0x28')]);if(_0x1e097e['name']){delete _0x1e097e[_0x7c81('0x29')];}_0x424255[_0x7c81('0x1a')](_0x165a10)[_0x7c81('0x2a')](_0x1e097e);};}exports[_0x7c81('0x2b')]=function(_0x22e49c,_0x194ea3){var _0x239993={},_0x4578cc={},_0x4cf52e={'count':0x0,'rows':[]};var _0x462107=_['map'](db[_0x7c81('0x2c')][_0x7c81('0x2d')],function(_0x15a557){return{'name':_0x15a557['fieldName'],'type':_0x15a557[_0x7c81('0x2e')][_0x7c81('0x2f')]};});_0x4578cc['model']=_['map'](_0x462107,_0x7c81('0x29'));_0x4578cc[_0x7c81('0x30')]=_[_0x7c81('0x31')](_0x22e49c[_0x7c81('0x30')]);_0x4578cc[_0x7c81('0x32')]=_[_0x7c81('0x33')](_0x4578cc[_0x7c81('0x34')],_0x4578cc[_0x7c81('0x30')]);_0x239993[_0x7c81('0x35')]=_['intersection'](_0x4578cc[_0x7c81('0x34')],qs[_0x7c81('0x36')](_0x22e49c[_0x7c81('0x30')][_0x7c81('0x36')]));_0x239993[_0x7c81('0x35')]=_0x239993[_0x7c81('0x35')][_0x7c81('0x37')]?_0x239993['attributes']:_0x4578cc['model'];if(!_0x22e49c['query']['hasOwnProperty'](_0x7c81('0x38'))){_0x239993[_0x7c81('0x1d')]=qs[_0x7c81('0x1d')](_0x22e49c[_0x7c81('0x30')][_0x7c81('0x1d')]);_0x239993[_0x7c81('0x1f')]=qs[_0x7c81('0x1f')](_0x22e49c[_0x7c81('0x30')][_0x7c81('0x1f')]);}_0x239993[_0x7c81('0x39')]=qs['sort'](_0x22e49c['query'][_0x7c81('0x3a')]);_0x239993[_0x7c81('0x3b')]=qs['filters'](_[_0x7c81('0x3c')](_0x22e49c[_0x7c81('0x30')],_0x4578cc['filters']),_0x462107);if(_0x22e49c['query'][_0x7c81('0x3d')]){_0x239993[_0x7c81('0x3b')]=_[_0x7c81('0x3e')](_0x239993[_0x7c81('0x3b')],{'$or':_['map'](_0x462107,function(_0x1c1e3d){if(_0x1c1e3d['type']!==_0x7c81('0x3f')){var _0x2e1cfb={};_0x2e1cfb[_0x1c1e3d[_0x7c81('0x29')]]={'$like':'%'+_0x22e49c[_0x7c81('0x30')][_0x7c81('0x3d')]+'%'};return _0x2e1cfb;}})});}_0x239993=_[_0x7c81('0x3e')]({},_0x239993,_0x22e49c['options']);var _0x208f7a={'where':_0x239993[_0x7c81('0x3b')]};return db[_0x7c81('0x2c')][_0x7c81('0x20')](_0x208f7a)[_0x7c81('0x26')](function(_0x4dde32){_0x4cf52e['count']=_0x4dde32;if(_0x22e49c[_0x7c81('0x30')]['includeAll']){_0x239993[_0x7c81('0x40')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x7c81('0x41')](_0x239993);})[_0x7c81('0x26')](function(_0x4da4d4){_0x4cf52e['rows']=_0x4da4d4;return _0x4cf52e;})[_0x7c81('0x26')](respondWithFilteredResult(_0x194ea3,_0x239993))[_0x7c81('0x42')](handleError(_0x194ea3,null));};exports[_0x7c81('0x43')]=function(_0x545a46,_0x4615ab){var _0x46820d={'raw':!![],'where':{'id':_0x545a46[_0x7c81('0x44')]['id']}},_0x4200d3={};_0x4200d3[_0x7c81('0x34')]=_[_0x7c81('0x31')](db[_0x7c81('0x2c')][_0x7c81('0x2d')]);_0x4200d3['query']=_[_0x7c81('0x31')](_0x545a46[_0x7c81('0x30')]);_0x4200d3[_0x7c81('0x32')]=_[_0x7c81('0x33')](_0x4200d3[_0x7c81('0x34')],_0x4200d3[_0x7c81('0x30')]);_0x46820d[_0x7c81('0x35')]=_['intersection'](_0x4200d3['model'],qs[_0x7c81('0x36')](_0x545a46[_0x7c81('0x30')][_0x7c81('0x36')]));_0x46820d[_0x7c81('0x35')]=_0x46820d[_0x7c81('0x35')][_0x7c81('0x37')]?_0x46820d[_0x7c81('0x35')]:_0x4200d3[_0x7c81('0x34')];if(_0x545a46['query']['includeAll']){_0x46820d[_0x7c81('0x40')]=[{'all':!![]}];}_0x46820d=_[_0x7c81('0x3e')]({},_0x46820d,_0x545a46[_0x7c81('0x45')]);return db[_0x7c81('0x2c')]['find'](_0x46820d)[_0x7c81('0x26')](handleEntityNotFound(_0x4615ab,null))['then'](respondWithResult(_0x4615ab,null))[_0x7c81('0x42')](handleError(_0x4615ab,null));};exports['create']=function(_0x48e2c2,_0x5f2121){return db[_0x7c81('0x2c')][_0x7c81('0x46')](_0x48e2c2[_0x7c81('0x47')],{})[_0x7c81('0x26')](respondWithResult(_0x5f2121,0xc9))[_0x7c81('0x42')](handleError(_0x5f2121,null));};exports['update']=function(_0x761442,_0x585479){if(_0x761442[_0x7c81('0x47')]['id']){delete _0x761442[_0x7c81('0x47')]['id'];}return db['ChatTransferReport'][_0x7c81('0x48')]({'where':{'id':_0x761442['params']['id']}})[_0x7c81('0x26')](handleEntityNotFound(_0x585479,null))[_0x7c81('0x26')](saveUpdates(_0x761442['body'],null))[_0x7c81('0x26')](respondWithResult(_0x585479,null))[_0x7c81('0x42')](handleError(_0x585479,null));};exports[_0x7c81('0x49')]=function(_0x47ac8c,_0x37412a){return db['ChatTransferReport']['find']({'where':{'id':_0x47ac8c[_0x7c81('0x44')]['id']}})[_0x7c81('0x26')](handleEntityNotFound(_0x37412a,null))[_0x7c81('0x26')](removeEntity(_0x37412a,null))['catch'](handleError(_0x37412a,null));};exports[_0x7c81('0x4a')]=function(_0x3d2e96,_0x66ba86){return db[_0x7c81('0x2c')][_0x7c81('0x4a')]()[_0x7c81('0x26')](respondWithResult(_0x66ba86,null))[_0x7c81('0x42')](handleError(_0x66ba86,null));}; \ No newline at end of file +var _0x4ca5=['rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll'];(function(_0xdbe7d0,_0xed8d24){var _0x3e0b06=function(_0x157d2d){while(--_0x157d2d){_0xdbe7d0['push'](_0xdbe7d0['shift']());}};_0x3e0b06(++_0xed8d24);}(_0x4ca5,0x12d));var _0x54ca=function(_0x385d18,_0x45af5e){_0x385d18=_0x385d18-0x0;var _0x1cbae0=_0x4ca5[_0x385d18];return _0x1cbae0;};'use strict';var emlformat=require(_0x54ca('0x0'));var rimraf=require(_0x54ca('0x1'));var zipdir=require(_0x54ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x54ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x54ca('0x4'));var util=require(_0x54ca('0x5'));var path=require(_0x54ca('0x6'));var sox=require(_0x54ca('0x7'));var csv=require(_0x54ca('0x8'));var ejs=require(_0x54ca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x54ca('0xa'));var crypto=require(_0x54ca('0xb'));var jsforce=require(_0x54ca('0xc'));var deskjs=require(_0x54ca('0xd'));var toCsv=require(_0x54ca('0x8'));var querystring=require(_0x54ca('0xe'));var Papa=require(_0x54ca('0xf'));var Redis=require(_0x54ca('0x10'));var authService=require(_0x54ca('0x11'));var qs=require(_0x54ca('0x12'));var as=require(_0x54ca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54ca('0x14'))(_0x54ca('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x54ca('0x16'))['db'];function respondWithStatusCode(_0x3a5333,_0x45c2c1){_0x45c2c1=_0x45c2c1||0xcc;return function(_0x230ef3){if(_0x230ef3){return _0x3a5333[_0x54ca('0x17')](_0x45c2c1);}return _0x3a5333[_0x54ca('0x18')](_0x45c2c1)['end']();};}function respondWithResult(_0x2d8da1,_0x4db23f){_0x4db23f=_0x4db23f||0xc8;return function(_0x487c20){if(_0x487c20){return _0x2d8da1['status'](_0x4db23f)[_0x54ca('0x19')](_0x487c20);}};}function respondWithFilteredResult(_0x5ac66b,_0x3ae333){return function(_0xa392eb){if(_0xa392eb){var _0x257697=typeof _0x3ae333[_0x54ca('0x1a')]===_0x54ca('0x1b')&&typeof _0x3ae333[_0x54ca('0x1c')]===_0x54ca('0x1b');var _0x17c51e=_0xa392eb[_0x54ca('0x1d')];var _0x53af8a=_0x257697?0x0:_0x3ae333[_0x54ca('0x1a')];var _0x1bb6db=_0x257697?_0xa392eb[_0x54ca('0x1d')]:_0x3ae333[_0x54ca('0x1a')]+_0x3ae333['limit'];var _0x2f1532;if(_0x1bb6db>=_0x17c51e){_0x1bb6db=_0x17c51e;_0x2f1532=0xc8;}else{_0x2f1532=0xce;}_0x5ac66b[_0x54ca('0x18')](_0x2f1532);return _0x5ac66b['set'](_0x54ca('0x1e'),_0x53af8a+'-'+_0x1bb6db+'/'+_0x17c51e)[_0x54ca('0x19')](_0xa392eb);}return null;};}function patchUpdates(_0x2dec11){return function(_0x6e438c){try{jsonpatch['apply'](_0x6e438c,_0x2dec11,!![]);}catch(_0x5b4df5){return BPromise[_0x54ca('0x1f')](_0x5b4df5);}return _0x6e438c['save']();};}function saveUpdates(_0x1cd707,_0x49f575){return function(_0x33a80a){if(_0x33a80a){return _0x33a80a[_0x54ca('0x20')](_0x1cd707)[_0x54ca('0x21')](function(_0x344a86){return _0x344a86;});}return null;};}function removeEntity(_0x23843b,_0x44a477){return function(_0x2469e8){if(_0x2469e8){return _0x2469e8[_0x54ca('0x22')]()['then'](function(){_0x23843b[_0x54ca('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b5c11,_0x3df4f8){return function(_0x3a08e2){if(!_0x3a08e2){_0x4b5c11['sendStatus'](0x194);}return _0x3a08e2;};}function handleError(_0x3e014c,_0x52b21a){_0x52b21a=_0x52b21a||0x1f4;return function(_0x5a98e3){logger[_0x54ca('0x23')](_0x5a98e3[_0x54ca('0x24')]);if(_0x5a98e3[_0x54ca('0x25')]){delete _0x5a98e3[_0x54ca('0x25')];}_0x3e014c[_0x54ca('0x18')](_0x52b21a)[_0x54ca('0x26')](_0x5a98e3);};}exports[_0x54ca('0x27')]=function(_0x31cd15,_0xae3b57){var _0x5b85ac={},_0x76571f={},_0x5db1e6={'count':0x0,'rows':[]};var _0x366249=_[_0x54ca('0x28')](db[_0x54ca('0x29')]['rawAttributes'],function(_0x28d7cf){return{'name':_0x28d7cf[_0x54ca('0x2a')],'type':_0x28d7cf[_0x54ca('0x2b')][_0x54ca('0x2c')]};});_0x76571f[_0x54ca('0x2d')]=_[_0x54ca('0x28')](_0x366249,'name');_0x76571f[_0x54ca('0x2e')]=_[_0x54ca('0x2f')](_0x31cd15[_0x54ca('0x2e')]);_0x76571f[_0x54ca('0x30')]=_[_0x54ca('0x31')](_0x76571f[_0x54ca('0x2d')],_0x76571f[_0x54ca('0x2e')]);_0x5b85ac[_0x54ca('0x32')]=_[_0x54ca('0x31')](_0x76571f[_0x54ca('0x2d')],qs[_0x54ca('0x33')](_0x31cd15['query'][_0x54ca('0x33')]));_0x5b85ac[_0x54ca('0x32')]=_0x5b85ac['attributes'][_0x54ca('0x34')]?_0x5b85ac['attributes']:_0x76571f[_0x54ca('0x2d')];if(!_0x31cd15['query'][_0x54ca('0x35')](_0x54ca('0x36'))){_0x5b85ac[_0x54ca('0x1c')]=qs[_0x54ca('0x1c')](_0x31cd15['query'][_0x54ca('0x1c')]);_0x5b85ac[_0x54ca('0x1a')]=qs[_0x54ca('0x1a')](_0x31cd15[_0x54ca('0x2e')][_0x54ca('0x1a')]);}_0x5b85ac['order']=qs['sort'](_0x31cd15[_0x54ca('0x2e')][_0x54ca('0x37')]);_0x5b85ac['where']=qs[_0x54ca('0x30')](_[_0x54ca('0x38')](_0x31cd15[_0x54ca('0x2e')],_0x76571f[_0x54ca('0x30')]),_0x366249);if(_0x31cd15[_0x54ca('0x2e')][_0x54ca('0x39')]){_0x5b85ac[_0x54ca('0x3a')]=_[_0x54ca('0x3b')](_0x5b85ac['where'],{'$or':_[_0x54ca('0x28')](_0x366249,function(_0x28e733){if(_0x28e733[_0x54ca('0x2b')]!==_0x54ca('0x3c')){var _0x418d46={};_0x418d46[_0x28e733[_0x54ca('0x25')]]={'$like':'%'+_0x31cd15[_0x54ca('0x2e')][_0x54ca('0x39')]+'%'};return _0x418d46;}})});}_0x5b85ac=_[_0x54ca('0x3b')]({},_0x5b85ac,_0x31cd15[_0x54ca('0x3d')]);var _0x3b8c8c={'where':_0x5b85ac[_0x54ca('0x3a')]};return db[_0x54ca('0x29')][_0x54ca('0x1d')](_0x3b8c8c)[_0x54ca('0x21')](function(_0x15772b){_0x5db1e6[_0x54ca('0x1d')]=_0x15772b;if(_0x31cd15[_0x54ca('0x2e')][_0x54ca('0x3e')]){_0x5b85ac['include']=[{'all':!![]}];}return db[_0x54ca('0x29')][_0x54ca('0x3f')](_0x5b85ac);})['then'](function(_0x29708f){_0x5db1e6[_0x54ca('0x40')]=_0x29708f;return _0x5db1e6;})[_0x54ca('0x21')](respondWithFilteredResult(_0xae3b57,_0x5b85ac))[_0x54ca('0x41')](handleError(_0xae3b57,null));};exports[_0x54ca('0x42')]=function(_0x94c54c,_0x84f36f){var _0x19091d={'raw':!![],'where':{'id':_0x94c54c[_0x54ca('0x43')]['id']}},_0x5ba6dd={};_0x5ba6dd[_0x54ca('0x2d')]=_[_0x54ca('0x2f')](db[_0x54ca('0x29')]['rawAttributes']);_0x5ba6dd['query']=_[_0x54ca('0x2f')](_0x94c54c['query']);_0x5ba6dd[_0x54ca('0x30')]=_[_0x54ca('0x31')](_0x5ba6dd['model'],_0x5ba6dd['query']);_0x19091d['attributes']=_[_0x54ca('0x31')](_0x5ba6dd['model'],qs[_0x54ca('0x33')](_0x94c54c[_0x54ca('0x2e')][_0x54ca('0x33')]));_0x19091d[_0x54ca('0x32')]=_0x19091d[_0x54ca('0x32')]['length']?_0x19091d['attributes']:_0x5ba6dd[_0x54ca('0x2d')];if(_0x94c54c[_0x54ca('0x2e')][_0x54ca('0x3e')]){_0x19091d[_0x54ca('0x44')]=[{'all':!![]}];}_0x19091d=_[_0x54ca('0x3b')]({},_0x19091d,_0x94c54c[_0x54ca('0x3d')]);return db[_0x54ca('0x29')][_0x54ca('0x45')](_0x19091d)['then'](handleEntityNotFound(_0x84f36f,null))[_0x54ca('0x21')](respondWithResult(_0x84f36f,null))[_0x54ca('0x41')](handleError(_0x84f36f,null));};exports[_0x54ca('0x46')]=function(_0x276429,_0x882070){return db['ChatTransferReport'][_0x54ca('0x46')](_0x276429[_0x54ca('0x47')],{})[_0x54ca('0x21')](respondWithResult(_0x882070,0xc9))[_0x54ca('0x41')](handleError(_0x882070,null));};exports['update']=function(_0x57c639,_0x49bcbf){if(_0x57c639['body']['id']){delete _0x57c639[_0x54ca('0x47')]['id'];}return db[_0x54ca('0x29')][_0x54ca('0x45')]({'where':{'id':_0x57c639['params']['id']}})[_0x54ca('0x21')](handleEntityNotFound(_0x49bcbf,null))[_0x54ca('0x21')](saveUpdates(_0x57c639['body'],null))[_0x54ca('0x21')](respondWithResult(_0x49bcbf,null))['catch'](handleError(_0x49bcbf,null));};exports[_0x54ca('0x22')]=function(_0x262c42,_0x3beb90){return db[_0x54ca('0x29')][_0x54ca('0x45')]({'where':{'id':_0x262c42[_0x54ca('0x43')]['id']}})[_0x54ca('0x21')](handleEntityNotFound(_0x3beb90,null))[_0x54ca('0x21')](removeEntity(_0x3beb90,null))[_0x54ca('0x41')](handleError(_0x3beb90,null));};exports[_0x54ca('0x48')]=function(_0x4429e0,_0x3151e4){return db[_0x54ca('0x29')]['describe']()[_0x54ca('0x21')](respondWithResult(_0x3151e4,null))[_0x54ca('0x41')](handleError(_0x3151e4,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8ae89c0..668a4de 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 _0xb7f3=['../../config/environment','./chatTransferReport.attributes','exports','define','uniqueid','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb7f3,0x102));var _0x3b7f=function(_0x240c61,_0x2f86e6){_0x240c61=_0x240c61-0x0;var _0x45cde1=_0xb7f3[_0x240c61];return _0x45cde1;};'use strict';var _=require(_0x3b7f('0x0'));var util=require(_0x3b7f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3b7f('0x2'));var BPromise=require(_0x3b7f('0x3'));var rp=require(_0x3b7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b7f('0x5'));var config=require(_0x3b7f('0x6'));var attributes=require(_0x3b7f('0x7'));module[_0x3b7f('0x8')]=function(_0x319019,_0x34c737){return _0x319019[_0x3b7f('0x9')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x3b7f('0xa'),'fields':[_0x3b7f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x10cb=['../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3e9e22,_0x290216){var _0x3e6f37=function(_0x36cb6){while(--_0x36cb6){_0x3e9e22['push'](_0x3e9e22['shift']());}};_0x3e6f37(++_0x290216);}(_0x10cb,0xf4));var _0xb10c=function(_0x1d1967,_0x52b368){_0x1d1967=_0x1d1967-0x0;var _0x5d6ce0=_0x10cb[_0x1d1967];return _0x5d6ce0;};'use strict';var _=require(_0xb10c('0x0'));var util=require(_0xb10c('0x1'));var logger=require(_0xb10c('0x2'))(_0xb10c('0x3'));var moment=require(_0xb10c('0x4'));var BPromise=require(_0xb10c('0x5'));var rp=require(_0xb10c('0x6'));var fs=require('fs');var path=require(_0xb10c('0x7'));var rimraf=require('rimraf');var config=require(_0xb10c('0x8'));var attributes=require(_0xb10c('0x9'));module[_0xb10c('0xa')]=function(_0x27f890,_0x56bea8){return _0x27f890['define'](_0xb10c('0xb'),attributes,{'tableName':_0xb10c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb10c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ee1dc8d..ff2cffc 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 _0xd8a1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xd8a1,0x151));var _0x1d8a=function(_0xd93014,_0x25d70a){_0xd93014=_0xd93014-0x0;var _0x46e791=_0xd8a1[_0xd93014];return _0x46e791;};'use strict';var _=require(_0x1d8a('0x0'));var util=require('util');var moment=require(_0x1d8a('0x1'));var BPromise=require('bluebird');var rs=require(_0x1d8a('0x2'));var fs=require('fs');var Redis=require(_0x1d8a('0x3'));var db=require(_0x1d8a('0x4'))['db'];var utils=require(_0x1d8a('0x5'));var logger=require(_0x1d8a('0x6'))(_0x1d8a('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d8a('0x8'));var client=jayson['client'][_0x1d8a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1318fb,_0x210dc4,_0xb51929){return new BPromise(function(_0x3c6730,_0x2bb7e7){return client[_0x1d8a('0xa')](_0x1318fb,_0xb51929)['then'](function(_0x439229){logger[_0x1d8a('0xb')](_0x1d8a('0xc'),_0x210dc4,'request\x20sent');logger['debug'](_0x1d8a('0xd'),_0x210dc4,_0x1d8a('0xe'),JSON[_0x1d8a('0xf')](_0x439229));if(_0x439229[_0x1d8a('0x10')]){if(_0x439229[_0x1d8a('0x10')]['code']===0x1f4){logger[_0x1d8a('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x210dc4,_0x439229[_0x1d8a('0x10')]['message']);return _0x2bb7e7(_0x439229[_0x1d8a('0x10')][_0x1d8a('0x11')]);}logger[_0x1d8a('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x210dc4,_0x439229[_0x1d8a('0x10')][_0x1d8a('0x11')]);return _0x3c6730(_0x439229[_0x1d8a('0x10')][_0x1d8a('0x11')]);}else{logger[_0x1d8a('0xb')](_0x1d8a('0xc'),_0x210dc4,_0x1d8a('0xe'));_0x3c6730(_0x439229[_0x1d8a('0x12')][_0x1d8a('0x11')]);}})[_0x1d8a('0x13')](function(_0x2a2600){logger['error'](_0x1d8a('0xc'),_0x210dc4,_0x2a2600);_0x2bb7e7(_0x2a2600);});});} \ No newline at end of file +var _0xf4bf=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x3c533a,_0x2ae4ce){var _0x53315e=function(_0x23d7dd){while(--_0x23d7dd){_0x3c533a['push'](_0x3c533a['shift']());}};_0x53315e(++_0x2ae4ce);}(_0xf4bf,0x6f));var _0xff4b=function(_0x3bceea,_0x58af75){_0x3bceea=_0x3bceea-0x0;var _0x30a8d3=_0xf4bf[_0x3bceea];return _0x30a8d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xff4b('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff4b('0x1'));var db=require(_0xff4b('0x2'))['db'];var utils=require(_0xff4b('0x3'));var logger=require(_0xff4b('0x4'))(_0xff4b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xff4b('0x6')][_0xff4b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53c1e9,_0x578433,_0x237ac4){return new BPromise(function(_0x23f5f0,_0x43533e){return client[_0xff4b('0x8')](_0x53c1e9,_0x237ac4)['then'](function(_0x43887d){logger[_0xff4b('0x9')](_0xff4b('0xa'),_0x578433,_0xff4b('0xb'));logger[_0xff4b('0xc')](_0xff4b('0xd'),_0x578433,_0xff4b('0xb'),JSON[_0xff4b('0xe')](_0x43887d));if(_0x43887d[_0xff4b('0xf')]){if(_0x43887d[_0xff4b('0xf')][_0xff4b('0x10')]===0x1f4){logger[_0xff4b('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x578433,_0x43887d[_0xff4b('0xf')][_0xff4b('0x11')]);return _0x43533e(_0x43887d[_0xff4b('0xf')][_0xff4b('0x11')]);}logger[_0xff4b('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x578433,_0x43887d[_0xff4b('0xf')][_0xff4b('0x11')]);return _0x23f5f0(_0x43887d[_0xff4b('0xf')][_0xff4b('0x11')]);}else{logger[_0xff4b('0x9')]('ChatTransferReport,\x20%s,\x20%s',_0x578433,'request\x20sent');_0x23f5f0(_0x43887d[_0xff4b('0x12')]['message']);}})[_0xff4b('0x13')](function(_0x3137e6){logger['error'](_0xff4b('0xa'),_0x578433,_0x3137e6);_0x43533e(_0x3137e6);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2e7d1a1..f96f36e 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 _0xae60=['post','create','put','delete','/:id','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe','describe'];(function(_0x2df2d0,_0x1d6ea8){var _0x3c4438=function(_0x456da2){while(--_0x456da2){_0x2df2d0['push'](_0x2df2d0['shift']());}};_0x3c4438(++_0x1d6ea8);}(_0xae60,0x116));var _0x0ae6=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xae60[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require(_0x0ae6('0x0'));var path=require(_0x0ae6('0x1'));var timeout=require(_0x0ae6('0x2'));var express=require(_0x0ae6('0x3'));var router=express['Router']();var fs_extra=require(_0x0ae6('0x4'));var auth=require(_0x0ae6('0x5'));var interaction=require(_0x0ae6('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x0ae6('0x7')](),controller['index']);router[_0x0ae6('0x8')](_0x0ae6('0x9'),auth['isAuthenticated'](),controller[_0x0ae6('0xa')]);router['get']('/:id',auth[_0x0ae6('0x7')](),controller['show']);router[_0x0ae6('0xb')]('/',auth[_0x0ae6('0x7')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0ae6('0xe')](_0x0ae6('0xf'),auth['isAuthenticated'](),controller[_0x0ae6('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe30b=['index','get','/describe','describe','/:id','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatTransferReport.controller','isAuthenticated'];(function(_0x6024b5,_0x470636){var _0x2122da=function(_0x37ce80){while(--_0x37ce80){_0x6024b5['push'](_0x6024b5['shift']());}};_0x2122da(++_0x470636);}(_0xe30b,0x122));var _0xbe30=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0xe30b[_0x22e9fe];return _0x47cd19;};'use strict';var multer=require(_0xbe30('0x0'));var util=require(_0xbe30('0x1'));var path=require(_0xbe30('0x2'));var timeout=require(_0xbe30('0x3'));var express=require(_0xbe30('0x4'));var router=express[_0xbe30('0x5')]();var fs_extra=require(_0xbe30('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe30('0x7'));var controller=require(_0xbe30('0x8'));router['get']('/',auth[_0xbe30('0x9')](),controller[_0xbe30('0xa')]);router[_0xbe30('0xb')](_0xbe30('0xc'),auth[_0xbe30('0x9')](),controller[_0xbe30('0xd')]);router[_0xbe30('0xb')](_0xbe30('0xe'),auth[_0xbe30('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe30('0xf')]);router[_0xbe30('0x10')](_0xbe30('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xbe30('0x11')](_0xbe30('0xe'),auth[_0xbe30('0x9')](),controller[_0xbe30('0x12')]);module[_0xbe30('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 9f66ab9..3fefec3 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 _0x49c6=['squared','rounded','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','name','text','input','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x49c6,0x158));var _0x649c=function(_0x278679,_0x1eb219){_0x278679=_0x278679-0x0;var _0x4874aa=_0x49c6[_0x278679];return _0x4874aa;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x649c('0x0'));module['exports']={'name':{'type':Sequelize[_0x649c('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x2')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x649c('0x2')},'key':{'type':Sequelize[_0x649c('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x649c('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x649c('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x649c('0x1')],'allowNull':![],'defaultValue':_0x649c('0x3'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x649c('0x1')],'allowNull':![],'defaultValue':_0x649c('0x4'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x649c('0x5')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x649c('0x1')]},'animation':{'type':Sequelize[_0x649c('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x649c('0x7')]('rounded',_0x649c('0x8')),'defaultValue':_0x649c('0x9')},'header_online':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x649c('0xc')},'download_transcript':{'type':Sequelize[_0x649c('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x649c('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x649c('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x649c('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x11')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x12')},'closingMessageButton':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0xb')},'skipMessageButton':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x13')},'conditionAgreement':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x14')},'ratingType':{'type':Sequelize[_0x649c('0x7')]('star','thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x649c('0x5')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x649c('0x15'),'type':_0x649c('0x16'),'required':!![]},'props':{'title':_0x649c('0x15'),'helpText':''}},{'type':_0x649c('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x649c('0x2'),'type':_0x649c('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x649c('0x18')](_0x649c('0x19'))?JSON[_0x649c('0x1a')](this[_0x649c('0x18')](_0x649c('0x19'))):{};},'set':function(_0x3799fd){return this[_0x649c('0x1b')](_0x649c('0x19'),JSON[_0x649c('0x1c')](_0x3799fd));}},'offlineForm':{'type':Sequelize[_0x649c('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x649c('0x17'),'props':{'title':_0x649c('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x649c('0x2'),'type':_0x649c('0x2')},'variable':null},{'type':_0x649c('0x1d'),'config':{'placeholder':_0x649c('0x1e')},'props':{'title':_0x649c('0x1e'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON['parse'](this[_0x649c('0x18')](_0x649c('0x1f'))):{};},'set':function(_0x39d63b){return this[_0x649c('0x1b')](_0x649c('0x1f'),JSON[_0x649c('0x1c')](_0x39d63b));}},'token':{'type':Sequelize[_0x649c('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x649c('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x649c('0x1')]},'forwardOffline':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x20')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x21')},'offlineMessageBody':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x22')},'enableUnmanagedNote':{'type':Sequelize[_0x649c('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x13')},'sendUnmanaged':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x649c('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x649c('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x649c('0x23');}},'notificationSound':{'type':Sequelize[_0x649c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x649c('0x24')},'waitForTheAssignedAgent':{'type':Sequelize[_0x649c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x649c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x25')},'verticalAlignment':{'type':Sequelize[_0x649c('0x5')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x26')},'messagesAlignment':{'type':Sequelize[_0x649c('0x1')],'defaultValue':_0x649c('0x27')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x649c('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x649c('0x1')],'allowNull':![],'defaultValue':_0x649c('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x649c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x649c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x649c('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x649c('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x649c('0x5')],'comment':_0x649c('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x6f415b){if(!_0x6f415b)this[_0x649c('0x1b')](_0x649c('0x2a'),null);this[_0x649c('0x1b')]('mandatoryDisposition',_0x6f415b);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x649c('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x649c('0x1')],'defaultValue':function(){return _0x649c('0x2b');}},'vidaooMetadata':{'type':Sequelize[_0x649c('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x649c('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x649c('0xe')]}}; \ No newline at end of file +var _0xf02a=['star','thumb','stringify','input','name','text','email','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','address','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','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'];(function(_0x3bbe35,_0x44945c){var _0x5021de=function(_0x46cdfc){while(--_0x46cdfc){_0x3bbe35['push'](_0x3bbe35['shift']());}};_0x5021de(++_0x44945c);}(_0xf02a,0x168));var _0xaf02=function(_0x14405c,_0x12b9b9){_0x14405c=_0x14405c-0x0;var _0x5d54ba=_0xf02a[_0x14405c];return _0x5d54ba;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xaf02('0x0'));module[_0xaf02('0x1')]={'name':{'type':Sequelize[_0xaf02('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xaf02('0x2')],'allowNull':![],'unique':_0xaf02('0x3')},'description':{'type':Sequelize[_0xaf02('0x2')]},'mapKey':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xaf02('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x4')},'customerAlias':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xaf02('0x2')],'allowNull':![],'defaultValue':_0xaf02('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaf02('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaf02('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xaf02('0x2')],'allowNull':![],'defaultValue':_0xaf02('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xaf02('0x2')]},'animation':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xaf02('0x8')](_0xaf02('0x9'),_0xaf02('0xa')),'defaultValue':_0xaf02('0x9')},'header_online':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0xb')},'start_chat_button':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xaf02('0xd')},'download_transcript':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xaf02('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xaf02('0x10')]},'closingQuestion':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xaf02('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xaf02('0x14')},'placeholderMessage':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x15')},'closingMessage':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x16')},'closingMessageButton':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0xc')},'skipMessageButton':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x17')},'conditionAgreement':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x18')},'ratingType':{'type':Sequelize['ENUM'](_0xaf02('0x19'),_0xaf02('0x1a')),'defaultValue':_0xaf02('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xaf02('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xaf02('0x10')],'defaultValue':function(){return JSON[_0xaf02('0x1b')]({'items':[{'type':_0xaf02('0x1c'),'variable':null,'config':{'placeholder':_0xaf02('0x1d'),'type':_0xaf02('0x1e'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0xaf02('0x1f'),'helpText':''},'config':{'required':!![],'placeholder':_0xaf02('0x1f'),'type':_0xaf02('0x1f')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xaf02('0x20')](_0xaf02('0x21'))?JSON[_0xaf02('0x22')](this[_0xaf02('0x20')](_0xaf02('0x21'))):{};},'set':function(_0x5a7614){return this[_0xaf02('0x23')](_0xaf02('0x21'),JSON['stringify'](_0x5a7614));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xaf02('0x1b')]({'items':[{'type':_0xaf02('0x1c'),'props':{'title':_0xaf02('0x1f'),'helpText':''},'config':{'required':!![],'placeholder':_0xaf02('0x1f'),'type':_0xaf02('0x1f')},'variable':null},{'type':_0xaf02('0x24'),'config':{'placeholder':_0xaf02('0x25')},'props':{'title':_0xaf02('0x25'),'helpText':_0xaf02('0x26')}}],'fromKey':0x0});},'get':function(){return this[_0xaf02('0x20')](_0xaf02('0x27'))?JSON[_0xaf02('0x22')](this[_0xaf02('0x20')]('offlineForm')):{};},'set':function(_0x392de6){return this['setDataValue']('offlineForm',JSON[_0xaf02('0x1b')](_0x392de6));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xaf02('0x28')]();}},'autoclose':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xaf02('0x2')]},'forwardOffline':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x29')},'waitingMessage':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x2a')},'offlineMessageSubject':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xaf02('0x2b')},'skipUnmanaged':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x17')},'sendUnmanaged':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xaf02('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xaf02('0x10')],'defaultValue':function(){return _0xaf02('0x2c');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0xaf02('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xaf02('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x2e')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x2f')},'messagesAlignment':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x30')},'defaultTitle':{'type':Sequelize[_0xaf02('0x2')]},'customerAvatar':{'type':Sequelize[_0xaf02('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xaf02('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaf02('0x31'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaf02('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':_0xaf02('0x32')},'systemAvatar':{'type':Sequelize[_0xaf02('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xaf02('0x33')},'mandatoryDisposition':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![],'comment':_0xaf02('0x34'),'set':function(_0x41f6a4){if(!_0x41f6a4)this['setDataValue'](_0xaf02('0x35'),null);this[_0xaf02('0x23')](_0xaf02('0x36'),_0x41f6a4);}},'vidaooEscalation':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xaf02('0x2')]},'vidaooTopic':{'type':Sequelize[_0xaf02('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xaf02('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xaf02('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xaf02('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 203dcc6..25b3149 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 _0xb750=['addApplications','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','priority','finally','json','getApplications','addProactiveActions','ChatProactiveAction','online','false','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','APIConflictError','URL','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','end','status','offset','undefined','count','limit','Content-Range','update','destroy','get','ChatWebsites','stack','name','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','model','vendor','type','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','body','address','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','sort','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','sitepic','filename','addAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','existsSync','join','server/files/images/logos/','getAvatar','agentAvatar','isNil','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','resolve','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','MapKey\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','ListId','mapKey','List','Contacts','DESC','ChatApplication','Interval','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','Applications','asc','list','defaults','contact','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','Start','startRouting','EventManager','offline','Sequelize','ValidationError','no\x20available\x20attributes','difference','CompanyId','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','mimetype','files','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','getSnippet','Intervals','getProactiveActions','virtual','custom','License','increment','server/files/chat/iframe.ejs','3.12.2','headers','origin','testWebsiteWithWildcard','remote','connection','replace','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId'];(function(_0x130218,_0x206ca0){var _0x2fe2e8=function(_0x1387fa){while(--_0x1387fa){_0x130218['push'](_0x130218['shift']());}};_0x2fe2e8(++_0x206ca0);}(_0xb750,0x154));var _0x0b75=function(_0x276c13,_0x5159ba){_0x276c13=_0x276c13-0x0;var _0x423928=_0xb750[_0x276c13];return _0x423928;};'use strict';var Mustache=require(_0x0b75('0x0'));var util=require(_0x0b75('0x1'));var path=require(_0x0b75('0x2'));var ejs=require(_0x0b75('0x3'));var fs=require('fs');var fs_extra=require(_0x0b75('0x4'));var _=require(_0x0b75('0x5'));var querystring=require(_0x0b75('0x6'));var htmlToText=require(_0x0b75('0x7'));var Redis=require(_0x0b75('0x8'));var jayson=require('jayson/promise');var qs=require(_0x0b75('0x9'));var logger=require(_0x0b75('0xa'))(_0x0b75('0xb'));var config=require('../../config/environment');var APIBadRequestError=require(_0x0b75('0xc'))[_0x0b75('0xd')];var APINotFoundError=require(_0x0b75('0xc'))[_0x0b75('0xe')];var APIOutOfIntervalError=require(_0x0b75('0xc'))[_0x0b75('0xf')];var APIHandleError=require(_0x0b75('0xc'))['handleError'];var APIConflictError=require(_0x0b75('0xc'))[_0x0b75('0x10')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require('url')[_0x0b75('0x11')];var db=require(_0x0b75('0x12'))['db'];config[_0x0b75('0x13')]=_['defaults'](config[_0x0b75('0x13')],{'host':_0x0b75('0x14'),'port':0x18eb});var socket=require(_0x0b75('0x15'))(new Redis(config[_0x0b75('0x13')]));require(_0x0b75('0x16'))['register'](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x0b75('0x17')][_0x0b75('0x18')]({'port':0x232a});var client9003=jayson[_0x0b75('0x17')]['http']({'port':0x232b});var client9001=jayson[_0x0b75('0x17')][_0x0b75('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x5e976e,_0x224d85,_0xe83dd6,_0x16d8a7){return new Promise(function(_0x3f2393,_0x216ea7){var _0x46cb1a=_0x16d8a7||client;return _0x46cb1a[_0x0b75('0x19')](_0x5e976e,_0xe83dd6)[_0x0b75('0x1a')](function(_0x3cf1ca){logger[_0x0b75('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x224d85,_0x0b75('0x1c'));logger[_0x0b75('0x1d')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x224d85,_0x0b75('0x1c'),JSON[_0x0b75('0x1e')](_0x3cf1ca));if(_0x3cf1ca[_0x0b75('0x1f')]){if(_0x3cf1ca[_0x0b75('0x1f')][_0x0b75('0x20')]===0x1f4){logger['error'](_0x0b75('0x21'),_0x224d85,_0x3cf1ca[_0x0b75('0x1f')][_0x0b75('0x22')]);return _0x216ea7(_0x3cf1ca[_0x0b75('0x1f')][_0x0b75('0x22')]);}logger[_0x0b75('0x1f')](_0x0b75('0x21'),_0x224d85,_0x3cf1ca[_0x0b75('0x1f')][_0x0b75('0x22')]);return _0x3f2393(_0x3cf1ca[_0x0b75('0x1f')]['message']);}else{logger['info'](_0x0b75('0x21'),_0x224d85,_0x0b75('0x1c'));_0x3f2393(_0x3cf1ca[_0x0b75('0x23')]['message']);}})['catch'](function(_0x6a8cac){logger['error'](_0x0b75('0x21'),_0x224d85,_0x6a8cac);_0x216ea7(_0x6a8cac);});});}function respondWithStatusCode(_0x10a363,_0x4465a3){_0x4465a3=_0x4465a3||0xcc;return function(_0x166576){if(_0x166576){return _0x10a363[_0x0b75('0x24')](_0x4465a3);}return _0x10a363['status'](_0x4465a3)[_0x0b75('0x25')]();};}function respondWithResult(_0x318a3d,_0x124f36){_0x124f36=_0x124f36||0xc8;return function(_0x3da010){if(_0x3da010){return _0x318a3d[_0x0b75('0x26')](_0x124f36)['json'](_0x3da010);}};}function respondWithFilteredResult(_0x4f7c71,_0x38cf85){return function(_0x3050af){if(_0x3050af){var _0x297acc=typeof _0x38cf85[_0x0b75('0x27')]==='undefined'&&typeof _0x38cf85['limit']===_0x0b75('0x28');var _0x4da35b=_0x3050af[_0x0b75('0x29')];var _0x43b5c7=_0x297acc?0x0:_0x38cf85[_0x0b75('0x27')];var _0x179f92=_0x297acc?_0x3050af[_0x0b75('0x29')]:_0x38cf85[_0x0b75('0x27')]+_0x38cf85[_0x0b75('0x2a')];var _0x949eed;if(_0x179f92>=_0x4da35b){_0x179f92=_0x4da35b;_0x949eed=0xc8;}else{_0x949eed=0xce;}_0x4f7c71[_0x0b75('0x26')](_0x949eed);return _0x4f7c71['set'](_0x0b75('0x2b'),_0x43b5c7+'-'+_0x179f92+'/'+_0x4da35b)['json'](_0x3050af);}return null;};}function saveUpdates(_0x3b2663){return function(_0x14f32c){if(_0x14f32c){return _0x14f32c[_0x0b75('0x2c')](_0x3b2663)[_0x0b75('0x1a')](function(_0x30ecec){return _0x30ecec;});}return null;};}function removeEntity(_0x47b420){return function(_0x47366b){if(_0x47366b){return _0x47366b[_0x0b75('0x2d')]()[_0x0b75('0x1a')](function(){var _0x13294b=_0x47366b[_0x0b75('0x2e')]({'plain':!![]});var _0x3bfd6f=_0x0b75('0x2f');return db['UserProfileResource'][_0x0b75('0x2d')]({'where':{'type':_0x3bfd6f,'resourceId':_0x13294b['id']}})[_0x0b75('0x1a')](function(){return _0x47366b;});})[_0x0b75('0x1a')](function(){_0x47b420['status'](0xcc)[_0x0b75('0x25')]();});}};}function handleEntityNotFound(_0xde2fdd){return function(_0x4f1017){if(!_0x4f1017){_0xde2fdd[_0x0b75('0x24')](0x194);}return _0x4f1017;};}function handleError(_0x1852d5,_0x3bac8b){_0x3bac8b=_0x3bac8b||0x1f4;return function(_0x2cb4ba){logger[_0x0b75('0x1f')](_0x2cb4ba[_0x0b75('0x30')]);if(_0x2cb4ba[_0x0b75('0x31')]){delete _0x2cb4ba[_0x0b75('0x31')];}_0x1852d5[_0x0b75('0x26')](_0x3bac8b)['send'](_0x2cb4ba);};}function createInteractionObject(_0x137772,_0x574a46,_0x4e5134,_0xaac3c7){var _0x3e5751=require('user-agent-parser');var _0x592d36=new _0x3e5751();var _0x257c2d=_0x592d36[_0x0b75('0x32')](_0x4e5134[_0x0b75('0x33')])[_0x0b75('0x34')]();var _0x4855aa=_0x574a46[_0x0b75('0x35')];if(_0x4e5134[_0x0b75('0x36')]){_0x4855aa=_0x4e5134[_0x0b75('0x36')];}else if(_0x4e5134[_0x0b75('0x37')]){_0x4855aa=_[_0x0b75('0x38')](_0x4e5134[_0x0b75('0x37')][_0x0b75('0x39')](','));}return{'ContactId':_0xaac3c7['id'],'ChatWebsiteId':_0x137772,'from':(_0xaac3c7[_0x0b75('0x3a')]||'')+'\x20'+(_0xaac3c7[_0x0b75('0x3b')]||''),'customerIp':_0x4855aa,'customerPort':_0x4e5134[_0x0b75('0x3c')]?_0x4e5134[_0x0b75('0x3c')]:null,'referer':_0x574a46[_0x0b75('0x3d')],'browserName':_0x257c2d[_0x0b75('0x3e')]['name']&&_0x257c2d[_0x0b75('0x3e')][_0x0b75('0x3f')]?util['format'](_0x0b75('0x40'),_0x257c2d[_0x0b75('0x3e')][_0x0b75('0x31')],_0x257c2d[_0x0b75('0x3e')]['version']):_0x0b75('0x41'),'browserVersion':_0x257c2d[_0x0b75('0x3e')][_0x0b75('0x3f')]||_0x0b75('0x41'),'osName':util[_0x0b75('0x42')](_0x0b75('0x40'),_0x257c2d['os']['name'],_0x257c2d['os'][_0x0b75('0x3f')]),'osVersion':_0x257c2d['os'][_0x0b75('0x3f')],'deviceModel':_0x257c2d[_0x0b75('0x43')][_0x0b75('0x44')]&&_0x257c2d[_0x0b75('0x43')][_0x0b75('0x45')]?util['format']('%s\x20%s\x20%s',_0x257c2d[_0x0b75('0x43')]['model'],_0x257c2d['device'][_0x0b75('0x45')],_0x257c2d[_0x0b75('0x43')][_0x0b75('0x46')]):null,'deviceVendor':_0x257c2d[_0x0b75('0x43')]['vendor'],'deviceType':_0x257c2d[_0x0b75('0x43')][_0x0b75('0x46')],'formData':JSON[_0x0b75('0x1e')](_0x574a46)};}exports['index']=function(_0x4f5641,_0x202417){var _0x354d71={'include':[{'model':db[_0x0b75('0x47')],'as':_0x0b75('0x48')}]},_0x261566={},_0x11ae3d={'count':0x0,'rows':[]};var _0x26ff3d=_[_0x0b75('0x49')](db[_0x0b75('0x4a')][_0x0b75('0x4b')],function(_0x5c54c4){return{'name':_0x5c54c4[_0x0b75('0x4c')],'type':_0x5c54c4['type']['key']};});_0x261566[_0x0b75('0x44')]=_[_0x0b75('0x49')](_0x26ff3d,'name');_0x261566['query']=_[_0x0b75('0x4d')](_0x4f5641[_0x0b75('0x4e')]);_0x261566['filters']=_['intersection'](_0x261566[_0x0b75('0x44')],_0x261566[_0x0b75('0x4e')]);_0x354d71[_0x0b75('0x4f')]=_[_0x0b75('0x50')](_0x261566[_0x0b75('0x44')],qs[_0x0b75('0x51')](_0x4f5641[_0x0b75('0x4e')][_0x0b75('0x51')]));_0x354d71['attributes']=_0x354d71[_0x0b75('0x4f')][_0x0b75('0x52')]?_0x354d71[_0x0b75('0x4f')]:_0x261566[_0x0b75('0x44')];if(!_0x4f5641[_0x0b75('0x4e')][_0x0b75('0x53')](_0x0b75('0x54'))){_0x354d71[_0x0b75('0x2a')]=qs['limit'](_0x4f5641['query']['limit']);_0x354d71[_0x0b75('0x27')]=qs['offset'](_0x4f5641[_0x0b75('0x4e')][_0x0b75('0x27')]);}_0x354d71[_0x0b75('0x55')]=qs['sort'](_0x4f5641[_0x0b75('0x4e')]['sort']);_0x354d71[_0x0b75('0x56')]=qs[_0x0b75('0x57')](_[_0x0b75('0x58')](_0x4f5641['query'],_0x261566[_0x0b75('0x57')]),_0x26ff3d);if(_0x4f5641[_0x0b75('0x4e')][_0x0b75('0x59')]){_0x354d71[_0x0b75('0x56')]=_[_0x0b75('0x5a')](_0x354d71['where'],{'$or':_['map'](_0x26ff3d,function(_0x112fd6){if(_0x112fd6[_0x0b75('0x46')]!==_0x0b75('0x5b')){var _0x1e5899={};_0x1e5899[_0x112fd6[_0x0b75('0x31')]]={'$like':'%'+_0x4f5641[_0x0b75('0x4e')]['filter']+'%'};return _0x1e5899;}})});}_0x354d71=_[_0x0b75('0x5a')]({},_0x354d71,_0x4f5641['options']);var _0x54c6af={'where':_0x354d71['where']};return db['ChatWebsite']['count'](_0x54c6af)['then'](function(_0x5dd02f){_0x11ae3d[_0x0b75('0x29')]=_0x5dd02f;if(_0x4f5641[_0x0b75('0x4e')][_0x0b75('0x5c')]){_0x354d71[_0x0b75('0x5d')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x354d71);})[_0x0b75('0x1a')](function(_0x1f5f0a){_0x11ae3d[_0x0b75('0x5e')]=_0x1f5f0a;return _0x11ae3d;})[_0x0b75('0x1a')](respondWithFilteredResult(_0x202417,_0x354d71))[_0x0b75('0x5f')](handleError(_0x202417,null));};exports[_0x0b75('0x60')]=function(_0x6cbdcb,_0x546ebd){var _0x2de273={'raw':![],'where':{'id':_0x6cbdcb[_0x0b75('0x61')]['id']},'include':[{'model':db[_0x0b75('0x47')],'as':'mandatoryDispositionPause'}]},_0x2ffd22={};_0x2ffd22[_0x0b75('0x44')]=_[_0x0b75('0x4d')](db['ChatWebsite'][_0x0b75('0x4b')]);_0x2ffd22[_0x0b75('0x4e')]=_[_0x0b75('0x4d')](_0x6cbdcb['query']);_0x2ffd22['filters']=_[_0x0b75('0x50')](_0x2ffd22['model'],_0x2ffd22[_0x0b75('0x4e')]);_0x2de273[_0x0b75('0x4f')]=_[_0x0b75('0x50')](_0x2ffd22[_0x0b75('0x44')],qs[_0x0b75('0x51')](_0x6cbdcb[_0x0b75('0x4e')][_0x0b75('0x51')]));_0x2de273['attributes']=_0x2de273[_0x0b75('0x4f')][_0x0b75('0x52')]?_0x2de273[_0x0b75('0x4f')]:_0x2ffd22['model'];if(_0x6cbdcb['query'][_0x0b75('0x5c')]){_0x2de273[_0x0b75('0x5d')]=[{'all':!![]}];}_0x2de273=_[_0x0b75('0x5a')]({},_0x2de273,_0x6cbdcb[_0x0b75('0x62')]);return db[_0x0b75('0x4a')][_0x0b75('0x63')](_0x2de273)[_0x0b75('0x1a')](handleEntityNotFound(_0x546ebd,null))[_0x0b75('0x1a')](respondWithResult(_0x546ebd,null))[_0x0b75('0x5f')](handleError(_0x546ebd,null));};exports['create']=function(_0xe56588,_0x39fde3){var _0x281125=null;_0xe56588[_0x0b75('0x64')][_0x0b75('0x65')][_0x0b75('0x39')](',')['forEach'](_0xba01cb=>{if(_0xba01cb[_0x0b75('0x66')]()!==''&&!wildcardUtils[_0x0b75('0x67')](_0xba01cb[_0x0b75('0x66')]())){_0x281125=new APIBadRequestError('\x22'+_0xba01cb[_0x0b75('0x66')]()+_0x0b75('0x68'));}});if(_0x281125){return handleError(_0x39fde3,null)(_0x281125);}return db[_0x0b75('0x4a')]['create'](_0xe56588[_0x0b75('0x64')],{})['then'](function(_0x386a50){var _0x4389fa=_0xe56588[_0x0b75('0x69')]['get']({'plain':!![]});if(!_0x4389fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4389fa[_0x0b75('0x6a')]===_0x0b75('0x69')){var _0x8e096c=_0x386a50['get']({'plain':!![]});var _0x1de3ab=_0x0b75('0x2f');return db[_0x0b75('0x6b')][_0x0b75('0x63')]({'where':{'name':_0x1de3ab,'userProfileId':_0x4389fa[_0x0b75('0x6c')]},'raw':!![]})[_0x0b75('0x1a')](function(_0x508084){if(_0x508084&&_0x508084[_0x0b75('0x6d')]===0x0){return db[_0x0b75('0x6e')][_0x0b75('0x6f')]({'name':_0x8e096c[_0x0b75('0x31')],'resourceId':_0x8e096c['id'],'type':_0x508084['name'],'sectionId':_0x508084['id']},{})['then'](function(){return _0x386a50;});}else{return _0x386a50;}})[_0x0b75('0x5f')](function(_0xa56e91){logger[_0x0b75('0x1f')](_0x0b75('0x70'),_0xa56e91);throw _0xa56e91;});}return _0x386a50;})[_0x0b75('0x1a')](respondWithResult(_0x39fde3,0xc9))[_0x0b75('0x5f')](handleError(_0x39fde3,null));};exports[_0x0b75('0x2c')]=function(_0x3547be,_0x4ebb9e){var _0x4a2bdc=null;_0x3547be[_0x0b75('0x64')][_0x0b75('0x65')][_0x0b75('0x39')](',')['forEach'](_0x50a70b=>{if(_0x50a70b[_0x0b75('0x66')]()!==''&&!wildcardUtils[_0x0b75('0x67')](_0x50a70b[_0x0b75('0x66')]())){_0x4a2bdc=new APIBadRequestError('\x22'+_0x50a70b[_0x0b75('0x66')]()+_0x0b75('0x68'));}});if(_0x4a2bdc){return handleError(_0x4ebb9e,null)(_0x4a2bdc);}if(_0x3547be[_0x0b75('0x64')]['id']){delete _0x3547be['body']['id'];}return db['ChatWebsite'][_0x0b75('0x63')]({'where':{'id':_0x3547be[_0x0b75('0x61')]['id']},'include':[{'model':db[_0x0b75('0x47')],'as':_0x0b75('0x48')}]})[_0x0b75('0x1a')](handleEntityNotFound(_0x4ebb9e,null))[_0x0b75('0x1a')](saveUpdates(_0x3547be['body'],null))['then'](respondWithResult(_0x4ebb9e,null))[_0x0b75('0x5f')](handleError(_0x4ebb9e,null));};exports[_0x0b75('0x2d')]=function(_0x5bf321,_0x300237){return db[_0x0b75('0x4a')][_0x0b75('0x63')]({'where':{'id':_0x5bf321[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x300237,null))[_0x0b75('0x1a')](removeEntity(_0x300237,null))[_0x0b75('0x5f')](handleError(_0x300237,null));};exports[_0x0b75('0x71')]=function(_0x26e907,_0x69daae){return db[_0x0b75('0x4a')][_0x0b75('0x71')]()[_0x0b75('0x1a')](respondWithResult(_0x69daae,null))['catch'](handleError(_0x69daae,null));};exports[_0x0b75('0x72')]=function(_0x5bee0d,_0x393c15){if(_0x5bee0d[_0x0b75('0x64')]['id']){delete _0x5bee0d[_0x0b75('0x64')]['id'];}return db[_0x0b75('0x4a')]['find']({'where':{'id':_0x5bee0d[_0x0b75('0x61')]['id']}})['then'](handleEntityNotFound(_0x393c15,null))[_0x0b75('0x1a')](function(_0x5c060f){if(_0x5c060f){_0x5bee0d[_0x0b75('0x64')][_0x0b75('0x73')]=_0x5c060f['id'];return db[_0x0b75('0x74')][_0x0b75('0x6f')](_0x5bee0d[_0x0b75('0x64')]);}})[_0x0b75('0x1a')](respondWithResult(_0x393c15,null))[_0x0b75('0x5f')](handleError(_0x393c15,null));};exports[_0x0b75('0x75')]=function(_0x2c9f28,_0x54f656){var _0xddf714={'raw':![],'where':{}};var _0x682c64={};var _0x15fed6={'count':0x0,'rows':[]};return db[_0x0b75('0x4a')][_0x0b75('0x76')]({'where':{'id':_0x2c9f28['params']['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x54f656,null))[_0x0b75('0x1a')](function(_0x2e179b){if(_0x2e179b){_0x682c64[_0x0b75('0x44')]=_[_0x0b75('0x4d')](db[_0x0b75('0x74')][_0x0b75('0x4b')]);_0x682c64[_0x0b75('0x4e')]=_['keys'](_0x2c9f28[_0x0b75('0x4e')]);_0x682c64[_0x0b75('0x57')]=_[_0x0b75('0x50')](_0x682c64[_0x0b75('0x44')],_0x682c64['query']);_0xddf714[_0x0b75('0x4f')]=_['intersection'](_0x682c64[_0x0b75('0x44')],qs['fields'](_0x2c9f28['query'][_0x0b75('0x51')]));_0xddf714[_0x0b75('0x4f')]=_0xddf714[_0x0b75('0x4f')][_0x0b75('0x52')]?_0xddf714[_0x0b75('0x4f')]:_0x682c64['model'];if(!_0x2c9f28['query']['hasOwnProperty'](_0x0b75('0x54'))){_0xddf714[_0x0b75('0x2a')]=qs[_0x0b75('0x2a')](_0x2c9f28['query']['limit']);_0xddf714[_0x0b75('0x27')]=qs[_0x0b75('0x27')](_0x2c9f28['query'][_0x0b75('0x27')]);}_0xddf714[_0x0b75('0x55')]=qs['sort'](_0x2c9f28[_0x0b75('0x4e')][_0x0b75('0x77')]);_0xddf714['where']=qs['filters'](_[_0x0b75('0x58')](_0x2c9f28[_0x0b75('0x4e')],_0x682c64[_0x0b75('0x57')]));_0xddf714[_0x0b75('0x56')][_0x0b75('0x73')]=_0x2e179b['id'];if(_0x2c9f28['query']['filter']){_0xddf714[_0x0b75('0x56')]=_[_0x0b75('0x5a')](_0xddf714[_0x0b75('0x56')],{'$or':_[_0x0b75('0x49')](_0xddf714[_0x0b75('0x4f')],function(_0x579226){var _0x5c114b={};_0x5c114b[_0x579226]={'$like':'%'+_0x2c9f28['query'][_0x0b75('0x59')]+'%'};return _0x5c114b;})});}_0xddf714=_[_0x0b75('0x5a')]({},_0xddf714,_0x2c9f28[_0x0b75('0x62')]);return db[_0x0b75('0x74')][_0x0b75('0x29')]({'where':_0xddf714[_0x0b75('0x56')]})[_0x0b75('0x1a')](function(_0x345794){_0x15fed6[_0x0b75('0x29')]=_0x345794;if(_0x2c9f28[_0x0b75('0x4e')][_0x0b75('0x5c')]){_0xddf714[_0x0b75('0x5d')]=[{'all':!![]}];}return db[_0x0b75('0x74')][_0x0b75('0x78')](_0xddf714);})[_0x0b75('0x1a')](function(_0x193e7b){_0x15fed6['rows']=_0x193e7b;return _0x15fed6;});}})['then'](respondWithFilteredResult(_0x54f656,_0xddf714))['catch'](handleError(_0x54f656,null));};exports['removeDispositions']=function(_0x18dcf3,_0x3bb5eb){return db['ChatWebsite'][_0x0b75('0x63')]({'where':{'id':_0x18dcf3[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x3bb5eb,null))['then'](function(_0x1dff4d){if(_0x1dff4d){return _0x1dff4d[_0x0b75('0x79')](_0x18dcf3[_0x0b75('0x4e')][_0x0b75('0x7a')]);}})[_0x0b75('0x1a')](respondWithStatusCode(_0x3bb5eb,null))[_0x0b75('0x5f')](handleError(_0x3bb5eb,null));};exports['addAnswer']=function(_0x4ae03c,_0x5b63b0){if(_0x4ae03c[_0x0b75('0x64')]['id']){delete _0x4ae03c['body']['id'];}return db[_0x0b75('0x4a')]['find']({'where':{'id':_0x4ae03c[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x5b63b0,null))[_0x0b75('0x1a')](function(_0x25f75a){if(_0x25f75a){_0x4ae03c[_0x0b75('0x64')]['ChatWebsiteId']=_0x25f75a['id'];return db[_0x0b75('0x7b')][_0x0b75('0x6f')](_0x4ae03c['body']);}})[_0x0b75('0x1a')](respondWithResult(_0x5b63b0,null))[_0x0b75('0x5f')](handleError(_0x5b63b0,null));};exports[_0x0b75('0x7c')]=function(_0x2a8a36,_0x3581da){var _0x5db68d={'raw':![],'where':{}};var _0xcecd5c={};var _0xd30868={'count':0x0,'rows':[]};return db[_0x0b75('0x4a')][_0x0b75('0x76')]({'where':{'id':_0x2a8a36[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x3581da,null))['then'](function(_0x550035){if(_0x550035){_0xcecd5c[_0x0b75('0x44')]=_[_0x0b75('0x4d')](db[_0x0b75('0x7b')][_0x0b75('0x4b')]);_0xcecd5c[_0x0b75('0x4e')]=_[_0x0b75('0x4d')](_0x2a8a36['query']);_0xcecd5c['filters']=_['intersection'](_0xcecd5c['model'],_0xcecd5c[_0x0b75('0x4e')]);_0x5db68d[_0x0b75('0x4f')]=_['intersection'](_0xcecd5c[_0x0b75('0x44')],qs['fields'](_0x2a8a36[_0x0b75('0x4e')][_0x0b75('0x51')]));_0x5db68d[_0x0b75('0x4f')]=_0x5db68d['attributes'][_0x0b75('0x52')]?_0x5db68d['attributes']:_0xcecd5c[_0x0b75('0x44')];if(!_0x2a8a36[_0x0b75('0x4e')][_0x0b75('0x53')](_0x0b75('0x54'))){_0x5db68d[_0x0b75('0x2a')]=qs['limit'](_0x2a8a36[_0x0b75('0x4e')][_0x0b75('0x2a')]);_0x5db68d['offset']=qs[_0x0b75('0x27')](_0x2a8a36[_0x0b75('0x4e')][_0x0b75('0x27')]);}_0x5db68d[_0x0b75('0x55')]=qs[_0x0b75('0x77')](_0x2a8a36['query'][_0x0b75('0x77')]);_0x5db68d[_0x0b75('0x56')]=qs[_0x0b75('0x57')](_['pick'](_0x2a8a36['query'],_0xcecd5c[_0x0b75('0x57')]));_0x5db68d[_0x0b75('0x56')][_0x0b75('0x73')]=_0x550035['id'];if(_0x2a8a36[_0x0b75('0x4e')][_0x0b75('0x59')]){_0x5db68d['where']=_[_0x0b75('0x5a')](_0x5db68d['where'],{'$or':_[_0x0b75('0x49')](_0x5db68d[_0x0b75('0x4f')],function(_0x4b0cc5){var _0x28581c={};_0x28581c[_0x4b0cc5]={'$like':'%'+_0x2a8a36[_0x0b75('0x4e')][_0x0b75('0x59')]+'%'};return _0x28581c;})});}_0x5db68d=_[_0x0b75('0x5a')]({},_0x5db68d,_0x2a8a36[_0x0b75('0x62')]);return db[_0x0b75('0x7b')][_0x0b75('0x29')]({'where':_0x5db68d['where']})[_0x0b75('0x1a')](function(_0x28bf10){_0xd30868['count']=_0x28bf10;if(_0x2a8a36[_0x0b75('0x4e')][_0x0b75('0x5c')]){_0x5db68d[_0x0b75('0x5d')]=[{'all':!![]}];}return db[_0x0b75('0x7b')]['findAll'](_0x5db68d);})[_0x0b75('0x1a')](function(_0x3c8350){_0xd30868[_0x0b75('0x5e')]=_0x3c8350;return _0xd30868;});}})[_0x0b75('0x1a')](respondWithFilteredResult(_0x3581da,_0x5db68d))[_0x0b75('0x5f')](handleError(_0x3581da,null));};exports[_0x0b75('0x7d')]=function(_0x18b375,_0x4d33da){return db[_0x0b75('0x4a')][_0x0b75('0x63')]({'where':{'id':_0x18b375[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x4d33da,null))['then'](function(_0x40b6fc){if(_0x40b6fc){return _0x40b6fc[_0x0b75('0x7d')](_0x18b375['query'][_0x0b75('0x7a')]);}})[_0x0b75('0x1a')](respondWithStatusCode(_0x4d33da,null))[_0x0b75('0x5f')](handleError(_0x4d33da,null));};exports['addLogo']=function(_0x44cd10,_0x36f05e){_0x44cd10[_0x0b75('0x64')][_0x0b75('0x7e')]=_0x44cd10['file'][_0x0b75('0x7f')];return db[_0x0b75('0x4a')]['find']({'where':{'id':_0x44cd10['params']['id']}})['then'](handleEntityNotFound(_0x36f05e,null))['then'](saveUpdates(_0x44cd10[_0x0b75('0x64')],null))[_0x0b75('0x1a')](respondWithResult(_0x36f05e,null))[_0x0b75('0x5f')](handleError(_0x36f05e,null));};exports[_0x0b75('0x80')]=function(_0x20eb09,_0x14f18b){_0x20eb09[_0x0b75('0x64')]['agentAvatar']=_0x20eb09[_0x0b75('0x81')][_0x0b75('0x7f')];return db[_0x0b75('0x4a')]['find']({'where':{'id':_0x20eb09[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x14f18b,null))[_0x0b75('0x1a')](saveUpdates(_0x20eb09[_0x0b75('0x64')],null))[_0x0b75('0x1a')](respondWithResult(_0x14f18b,null))[_0x0b75('0x5f')](handleError(_0x14f18b,null));};exports[_0x0b75('0x82')]=function(_0xebd617,_0x58a3cd){_0xebd617[_0x0b75('0x64')][_0x0b75('0x83')]=_0xebd617['file'][_0x0b75('0x7f')];return db[_0x0b75('0x4a')][_0x0b75('0x63')]({'where':{'id':_0xebd617[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x58a3cd,null))['then'](saveUpdates(_0xebd617[_0x0b75('0x64')],null))[_0x0b75('0x1a')](respondWithResult(_0x58a3cd,null))[_0x0b75('0x5f')](handleError(_0x58a3cd,null));};exports[_0x0b75('0x84')]=function(_0x35c2d1,_0x38abf1){_0x35c2d1[_0x0b75('0x64')][_0x0b75('0x85')]=_0x35c2d1['file'][_0x0b75('0x7f')];return db[_0x0b75('0x4a')]['find']({'where':{'id':_0x35c2d1[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x38abf1,null))[_0x0b75('0x1a')](saveUpdates(_0x35c2d1[_0x0b75('0x64')],null))[_0x0b75('0x1a')](respondWithResult(_0x38abf1,null))['catch'](handleError(_0x38abf1,null));};exports[_0x0b75('0x86')]=function(_0x6b1390,_0x1f223b){var _0x442def=path['join'](config[_0x0b75('0x87')],_0x0b75('0x88'));var _0x3e1d7f={'where':{'id':_0x6b1390[_0x0b75('0x61')]['id']},'attributes':['id',_0x0b75('0x7e')],'raw':!![]};var _0xb0bb54=![];return require(_0x0b75('0x89'))[_0x0b75('0x8a')]()['then'](function(_0x34c0c4){if(_0x34c0c4){_0xb0bb54=_0x34c0c4['custom'];}})[_0x0b75('0x1a')](function(){return db[_0x0b75('0x4a')][_0x0b75('0x63')](_0x3e1d7f);})['then'](handleEntityNotFound(_0x1f223b,null))[_0x0b75('0x1a')](function(_0x1482b6){if(_0x1482b6){if(!_['isNil'](_0x1482b6['sitepic'])){if(fs[_0x0b75('0x8b')](path[_0x0b75('0x8c')](config[_0x0b75('0x87')],_0x0b75('0x8d'),_0x1482b6[_0x0b75('0x7e')]))&&_0xb0bb54){_0x442def=path[_0x0b75('0x8c')](config['root'],_0x0b75('0x8d'),_0x1482b6[_0x0b75('0x7e')]);}}return _0x1f223b['download'](_0x442def);}})['catch'](handleError(_0x1f223b,null));};exports[_0x0b75('0x8e')]=function(_0x2bb069,_0x1b4a46){var _0x59c4fb=path[_0x0b75('0x8c')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x249339={'where':{'id':_0x2bb069['params']['id']},'attributes':['id',_0x0b75('0x8f')],'raw':!![]};return db['ChatWebsite'][_0x0b75('0x63')](_0x249339)[_0x0b75('0x1a')](handleEntityNotFound(_0x1b4a46,null))[_0x0b75('0x1a')](function(_0x21b82b){if(_0x21b82b){if(!_[_0x0b75('0x90')](_0x21b82b[_0x0b75('0x8f')])){if(fs[_0x0b75('0x8b')](path[_0x0b75('0x8c')](config[_0x0b75('0x87')],_0x0b75('0x91'),_0x21b82b[_0x0b75('0x8f')]))){_0x59c4fb=path[_0x0b75('0x8c')](config['root'],_0x0b75('0x91'),_0x21b82b[_0x0b75('0x8f')]);}}return _0x1b4a46[_0x0b75('0x92')](_0x59c4fb);}})[_0x0b75('0x5f')](handleError(_0x1b4a46,null));};exports[_0x0b75('0x93')]=function(_0x17bf11,_0x1624e6){var _0x3e7322=path[_0x0b75('0x8c')](config[_0x0b75('0x87')],'server/files/images/avatars/customer_avatar.png');var _0x439a86={'where':{'id':_0x17bf11['params']['id']},'attributes':['id','customerAvatar',_0x0b75('0x94')],'raw':!![]};return db[_0x0b75('0x4a')]['find'](_0x439a86)[_0x0b75('0x1a')](handleEntityNotFound(_0x1624e6,null))[_0x0b75('0x1a')](function(_0x1558b9){if(_0x1558b9){if(!_[_0x0b75('0x90')](_0x1558b9[_0x0b75('0x83')])){if(fs['existsSync'](path['join'](config[_0x0b75('0x87')],_0x0b75('0x91'),_0x1558b9[_0x0b75('0x83')]))&&_0x1558b9[_0x0b75('0x94')]){_0x3e7322=path['join'](config[_0x0b75('0x87')],_0x0b75('0x91'),_0x1558b9[_0x0b75('0x83')]);}}return _0x1624e6[_0x0b75('0x92')](_0x3e7322);}})[_0x0b75('0x5f')](handleError(_0x1624e6,null));};exports[_0x0b75('0x95')]=function(_0x279313,_0x147470){var _0x501781=path[_0x0b75('0x8c')](config[_0x0b75('0x87')],_0x0b75('0x96'));var _0x2102a5={'where':{'id':_0x279313[_0x0b75('0x61')]['id']},'attributes':['id',_0x0b75('0x85')],'raw':!![]};return db['ChatWebsite']['find'](_0x2102a5)['then'](handleEntityNotFound(_0x147470,null))['then'](function(_0x408abb){if(_0x408abb){if(!_[_0x0b75('0x90')](_0x408abb[_0x0b75('0x85')])){if(fs[_0x0b75('0x8b')](path[_0x0b75('0x8c')](config[_0x0b75('0x87')],_0x0b75('0x91'),_0x408abb[_0x0b75('0x85')]))){_0x501781=path[_0x0b75('0x8c')](config[_0x0b75('0x87')],_0x0b75('0x91'),_0x408abb[_0x0b75('0x85')]);}}return _0x147470[_0x0b75('0x92')](_0x501781);}})[_0x0b75('0x5f')](handleError(_0x147470,null));};function checkWebsiteInterval(_0x134072){var _0x4cc66e=_0x134072['Interval'];if(!_0x4cc66e){return Promise[_0x0b75('0x97')](_0x134072);}var _0x144c85=_0x134072[_0x0b75('0x98')]||undefined;return _0x4cc66e[_0x0b75('0x99')](_0x144c85)[_0x0b75('0x1a')](function(_0x5801fa){if(!_0x5801fa){throw new APIOutOfIntervalError();}return _0x134072;});}exports[_0x0b75('0x9a')]=function(_0x35c90a,_0x4d34ed){var _0x56d4eb={'body':_0x35c90a[_0x0b75('0x64')],'channel':_0x0b75('0x9b')};var _0x28405d=[];var _0xd85bc2=[];var _0x2f7699={};var _0x3bddb4=![];if(_0x35c90a['body']['id']){delete _0x35c90a[_0x0b75('0x64')]['id'];}if(_['isNil'](_0x35c90a[_0x0b75('0x64')][_0x0b75('0x9c')])){throw new APIBadRequestError(_0x0b75('0x9d'));}if(_['isNil'](_0x35c90a[_0x0b75('0x64')]['mapKey'])){throw new APIBadRequestError(_0x0b75('0x9e'));}if(_[_0x0b75('0x9f')](_0x35c90a[_0x0b75('0x64')][_0x0b75('0x64')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0xc679a0=_0x35c90a[_0x0b75('0x64')][_0x0b75('0x35')]&&_0x35c90a[_0x0b75('0x64')][_0x0b75('0x3d')];return db[_0x0b75('0xa0')]['describe']()[_0x0b75('0x1a')](function(_0x1d7d4b){if(!_0x1d7d4b){throw new Error(_0x0b75('0xa1'));}_0x28405d=Object[_0x0b75('0x4d')](_0x1d7d4b)[_0x0b75('0x59')](function(_0x4322d0){return![_0x0b75('0xa2'),_0x0b75('0xa3')][_0x0b75('0xa4')](_0x4322d0);});_0xd85bc2=Object[_0x0b75('0x4d')](_0x1d7d4b)[_0x0b75('0x59')](function(_0x244e10){return!['createdAt',_0x0b75('0xa3'),'CompanyId',_0x0b75('0xa5')]['includes'](_0x244e10);});if(!_[_0x0b75('0xa4')](_0xd85bc2,_0x35c90a[_0x0b75('0x64')][_0x0b75('0xa6')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0xd85bc2[_0x0b75('0x8c')](',\x20'));}_0x2f7699[_0x35c90a['body']['mapKey']]=_0x35c90a[_0x0b75('0x64')][_0x0b75('0x9c')];})[_0x0b75('0x1a')](function(){return db[_0x0b75('0x4a')]['find']({'where':{'id':_0x35c90a['params']['id']},'include':[{'model':db['CmList'],'as':_0x0b75('0xa7'),'include':[{'model':db['CmContact'],'as':_0x0b75('0xa8'),'where':_0x2f7699,'limit':0x1,'order':[[_0x0b75('0xa3'),_0x0b75('0xa9')]]}]},{'model':db[_0x0b75('0xaa')],'as':'Applications'},{'model':db[_0x0b75('0xab')],'as':_0x0b75('0xab'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x0b75('0xac')],'raw':!![]}]}]});})['then'](function(_0x22f401){if(!_0x22f401){throw new APINotFoundError(util['format'](_0x0b75('0xad'),_0x35c90a[_0x0b75('0x61')]['id']));}if(_0xc679a0){return checkWebsiteInterval(_0x22f401);}return _0x22f401;})[_0x0b75('0x1a')](function(_0x303b3b){_0x56d4eb[_0x0b75('0xae')]=_0x303b3b;_0x56d4eb[_0x0b75('0xaf')]=_[_0x0b75('0xb0')](_0x303b3b[_0x0b75('0xb1')],['priority'],[_0x0b75('0xb2')]);if(_0x56d4eb[_0x0b75('0xae')][_0x0b75('0xb1')]){delete _0x56d4eb[_0x0b75('0xae')]['Applications'];}_0x56d4eb[_0x0b75('0xb3')]=_0x303b3b['List']||{'id':_0x303b3b[_0x0b75('0xa5')]};if(_0x56d4eb[_0x0b75('0xb3')]&&_0x56d4eb['list']['Contacts']['length']){return _0x56d4eb[_0x0b75('0xb3')][_0x0b75('0xa8')][0x0];}var _0xd1c41c=_[_0x0b75('0xb4')](_0x35c90a['body'],{'firstName':_0x35c90a[_0x0b75('0x64')][_0x0b75('0x9c')],'ListId':_0x303b3b[_0x0b75('0xa5')]});_0xd1c41c[_0x35c90a[_0x0b75('0x64')][_0x0b75('0xa6')]]=_0x35c90a[_0x0b75('0x64')][_0x0b75('0x9c')];return db['CmContact'][_0x0b75('0x6f')](_0xd1c41c,{'fields':_0x28405d,'raw':!![]});})[_0x0b75('0x1a')](function(_0x278bb0){_0x56d4eb[_0x0b75('0xb5')]=_0x278bb0;var _0x3f912=createInteractionObject(_0x35c90a['params']['id'],_0x35c90a[_0x0b75('0x64')],_0x35c90a['headers'],_0x278bb0);var _0x45ce29={'ChatWebsiteId':_0x35c90a[_0x0b75('0x61')]['id']};if(_0x35c90a[_0x0b75('0x64')][_0x0b75('0xb6')]){_0x45ce29['threadId']=_0x35c90a[_0x0b75('0x64')]['threadId'];_0x45ce29[_0x0b75('0xb7')]=![];return db[_0x0b75('0xb8')][_0x0b75('0x63')]({'where':_0x45ce29})['then'](function(_0x387569){var _0x592f97=_0x35c90a[_0x0b75('0x64')][_0x0b75('0x35')]&&_0x35c90a[_0x0b75('0x64')][_0x0b75('0x3d')];if(_0x387569){_0x3bddb4=!![];return _0x387569;}else if(!_0x592f97&&_0x387569&&_0x387569['closed']){throw new APIConflictError(_0x0b75('0xb9'));}_0x3f912['threadId']=_0x35c90a['body'][_0x0b75('0xb6')];_0x3f912[_0x0b75('0xba')]=_0x35c90a[_0x0b75('0x64')][_0x0b75('0xba')];return db[_0x0b75('0xb8')][_0x0b75('0x6f')](_0x3f912);});}_0x45ce29[_0x0b75('0xbb')]=_0x278bb0['id'];if(_0x35c90a['body']['interaction']&&_0x35c90a[_0x0b75('0x64')][_0x0b75('0xbc')]['id']){_0x45ce29['id']=_0x35c90a[_0x0b75('0x64')][_0x0b75('0xbc')]['id'];return db[_0x0b75('0xb8')][_0x0b75('0x63')]({'where':_0x45ce29})[_0x0b75('0x1a')](function(_0x232d53){var _0x14a6ed=_0x35c90a[_0x0b75('0x64')][_0x0b75('0x35')]&&_0x35c90a[_0x0b75('0x64')][_0x0b75('0x3d')];if(!_0x14a6ed&&_0x232d53&&_0x232d53[_0x0b75('0xb7')]){throw new APIConflictError(_0x0b75('0xb9'));}else if(_0x232d53){_0x3bddb4=!![];return _0x232d53;}else{return db[_0x0b75('0xb8')][_0x0b75('0x6f')](_0x3f912);}});}return db[_0x0b75('0xb8')][_0x0b75('0x6f')](_0x3f912);})[_0x0b75('0x1a')](function(_0x9e6de5){if(!_0x3bddb4){return _0x9e6de5;}var _0xca43b7={'from':(_0x56d4eb[_0x0b75('0xb5')][_0x0b75('0x3a')]||'')+'\x20'+(_0x56d4eb[_0x0b75('0xb5')][_0x0b75('0x3b')]||'')};if(_0x35c90a[_0x0b75('0x64')][_0x0b75('0xb6')]&&_0x35c90a[_0x0b75('0x64')][_0x0b75('0xbd')]&&_0x35c90a[_0x0b75('0x64')]['threadId']!=_0x35c90a[_0x0b75('0x64')][_0x0b75('0xbd')]){_0xca43b7[_0x0b75('0xb6')]=_0x35c90a[_0x0b75('0x64')][_0x0b75('0xbd')];}return _0x9e6de5[_0x0b75('0x2c')](_0xca43b7);})[_0x0b75('0x1a')](function(_0x134c94){_0x56d4eb[_0x0b75('0xbc')]=_0x134c94['get']({'plain':!![]});_0x56d4eb[_0x0b75('0xbc')][_0x0b75('0xbe')]=!_0x3bddb4;if(_0x56d4eb[_0x0b75('0xbc')][_0x0b75('0xbe')]){if(_0x56d4eb[_0x0b75('0xae')][_0x0b75('0xbf')]){_0x56d4eb[_0x0b75('0xaf')][_0x0b75('0xc0')]({'id':0x0,'priority':_0x56d4eb[_0x0b75('0xaf')][_0x0b75('0x52')]+0x1,'app':'close','appdata':_0x0b75('0xc1'),'interval':_0x0b75('0xc2')});}}return db[_0x0b75('0xc3')][_0x0b75('0x6f')]({'body':_0x35c90a[_0x0b75('0x64')][_0x0b75('0x64')],'ChatWebsiteId':_0x35c90a['params']['id'],'ChatInteractionId':_0x134c94['id'],'direction':'in','ContactId':_0x56d4eb[_0x0b75('0xb5')]['id'],'AttachmentId':_0x35c90a[_0x0b75('0x64')][_0x0b75('0xc4')]});})[_0x0b75('0x1a')](function(_0x512614){_0x56d4eb[_0x0b75('0x22')]=_0x512614;if(!_0x56d4eb[_0x0b75('0xbc')]['UserId']){return;}return db['User'][_0x0b75('0x63')]({'attributes':['id',_0x0b75('0x31')],'where':{'id':_0x56d4eb[_0x0b75('0xbc')][_0x0b75('0xc5')]}});})['then'](function(_0x3c953f){if(_0x3c953f){_0x56d4eb[_0x0b75('0xaf')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0b75('0xc6'),'appdata':_0x3c953f['name']+','+(_0x56d4eb[_0x0b75('0xae')][_0x0b75('0xc7')]||0xa),'interval':_0x0b75('0xc2')});_0x56d4eb[_0x0b75('0xc8')]=!![];}if(!_0x56d4eb[_0x0b75('0xbc')][_0x0b75('0xc9')]){return;}return db[_0x0b75('0xca')][_0x0b75('0x63')]({'attributes':['id','name'],'where':{'id':_0x56d4eb[_0x0b75('0xbc')][_0x0b75('0xc9')]}});})['then'](function(_0x13fc34){if(_0x13fc34){_0x56d4eb[_0x0b75('0xaf')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x13fc34[_0x0b75('0x31')]+','+(_0x56d4eb[_0x0b75('0xae')]['waitForTheAssignedQueue']||0x12c),'interval':_0x0b75('0xc2')});}return respondWithRpcPromise(_0x0b75('0xcb'),_0x0b75('0xcc'),_0x56d4eb);})['then'](function(_0x532c6c){respondWithRpcPromise('EventManager',_0x0b75('0xcd'),{'event':_0x0b75('0x9a'),'message':_0x532c6c},client9002);return _0x532c6c;})[_0x0b75('0x1a')](respondWithResult(_0x4d34ed,null))[_0x0b75('0x5f')](APIHandleError(_0x4d34ed));};exports[_0x0b75('0xce')]=function(_0x3a5c13,_0xefeae2){var _0x13c8bb,_0x59f638,_0x4be8e9;var _0x6b46e1=[];var _0x4ddb62={};var _0x424cd2=_0x3a5c13['files']||[];var _0x4b60ae=[];var _0x41b4d2;return db['CmContact']['describe']()[_0x0b75('0x1a')](function(_0x539b66){if(!_0x539b66){throw new db[(_0x0b75('0xcf'))][(_0x0b75('0xd0'))](_0x0b75('0xd1'));}_0x6b46e1=_[_0x0b75('0xd2')](_[_0x0b75('0x4d')](_0x539b66),[_0x0b75('0xa2'),_0x0b75('0xa3'),_0x0b75('0xd3'),_0x0b75('0xa5')]);if(_0x3a5c13[_0x0b75('0x64')]['id']){delete _0x3a5c13[_0x0b75('0x64')]['id'];}if(_[_0x0b75('0x90')](_0x3a5c13[_0x0b75('0x64')][_0x0b75('0x9c')])){throw _0xefeae2['status'](0x1f4)[_0x0b75('0xd4')](new db['Sequelize'][(_0x0b75('0xd0'))](_0x0b75('0xd5')));}if(_[_0x0b75('0x90')](_0x3a5c13[_0x0b75('0x64')][_0x0b75('0x64')])||_0x3a5c13['body']['body']===''){throw _0xefeae2[_0x0b75('0x26')](0x1f4)[_0x0b75('0xd4')](new db[(_0x0b75('0xcf'))]['ValidationError'](_0x0b75('0xd6')));}if(_[_0x0b75('0x90')](_0x3a5c13['body'][_0x0b75('0xd7')])){throw _0xefeae2[_0x0b75('0x26')](0x1f4)[_0x0b75('0xd4')](new db['Sequelize'][(_0x0b75('0xd0'))](_0x0b75('0xd8')+_0x6b46e1));}if(!_[_0x0b75('0xa4')](_0x6b46e1,_0x3a5c13[_0x0b75('0x64')][_0x0b75('0xd7')])){throw _0xefeae2['status'](0x1f4)[_0x0b75('0xd4')](new db[(_0x0b75('0xcf'))][(_0x0b75('0xd0'))](_0x0b75('0xd9')+_0x6b46e1));}_0x4ddb62[_0x3a5c13[_0x0b75('0x64')]['mapKeyOffline']]=_0x3a5c13[_0x0b75('0x64')][_0x0b75('0x9c')];})[_0x0b75('0x1a')](function(){return db[_0x0b75('0x4a')][_0x0b75('0x63')]({'where':{'id':_0x3a5c13['params']['id']},'include':[{'model':db[_0x0b75('0xda')],'as':_0x0b75('0xa7')},{'model':db[_0x0b75('0xdb')],'as':_0x0b75('0xdb')}]});})[_0x0b75('0x1a')](handleEntityNotFound(_0xefeae2,null))['then'](function(_0x3f8f8a){if(_0x3f8f8a&&_0x3f8f8a['List']){_0x59f638=_0x3f8f8a;var _0x15f1a0=_[_0x0b75('0xb4')](_0x3a5c13[_0x0b75('0x64')],{'firstName':_0x3a5c13['body'][_0x0b75('0x9c')],'phone':_0x3a5c13[_0x0b75('0x64')][_0x0b75('0x9c')],'ListId':_0x3f8f8a[_0x0b75('0xa5')]});_0x15f1a0[_0x3a5c13[_0x0b75('0x64')][_0x0b75('0xd7')]]=_0x3a5c13[_0x0b75('0x64')][_0x0b75('0x9c')];return db[_0x0b75('0xa0')][_0x0b75('0xdc')]({'where':_0x4ddb62,'defaults':_0x15f1a0});}})[_0x0b75('0xdd')](function(_0x4edeb7){if(_0x4edeb7){_0x4be8e9=_0x4edeb7;var _0x5a4616=fs['readFileSync'](path[_0x0b75('0x8c')](config[_0x0b75('0x87')],_0x0b75('0xde')),_0x0b75('0xdf'));var _0x35f8a0=ejs[_0x0b75('0xe0')](_0x5a4616,{'body':_[_0x0b75('0xe1')](_0x3a5c13[_0x0b75('0x64')][_0x0b75('0x64')]),'bodyTitle':_0x59f638[_0x0b75('0xe2')]});return db['ChatOfflineMessage'][_0x0b75('0x6f')]({'body':_0x35f8a0,'plainBody':htmlToText['fromString'](_0x35f8a0),'ContactId':_0x4edeb7['id'],'ChatWebsiteId':_0x59f638['id']});}})[_0x0b75('0x1a')](function(_0x55bf77){_0x41b4d2=_0x55bf77;if(_0x424cd2[_0x0b75('0x52')]){var _0x31310e=_0x424cd2[_0x0b75('0x49')](function(_0x33a31a){return{'name':_0x33a31a['originalname'],'basename':_0x33a31a['filename'],'type':_0x33a31a[_0x0b75('0xe3')],'ChatOfflineMessageId':_0x55bf77['id']};});_0x4b60ae=_0x31310e[_0x0b75('0x49')](_0x4ee0fb=>{var _0x228d07={'filename':_0x4ee0fb[_0x0b75('0x31')],'path':path[_0x0b75('0x8c')](config[_0x0b75('0x87')],'server',_0x0b75('0xe4'),_0x0b75('0xe5'),_0x0b75('0xe6'),_0x4ee0fb[_0x0b75('0xe7')])};return _0x228d07;});if(!_0x59f638[_0x0b75('0xe8')]){return db['sequelize'][_0x0b75('0xe9')](function(_0x38613a){return db[_0x0b75('0xea')]['bulkCreate'](_0x31310e,{'transaction':_0x38613a});});}}})['then'](function(){if(_0x41b4d2){_0x13c8bb=_0x41b4d2;return db[_0x0b75('0xdb')][_0x0b75('0x76')]({'where':{'service':!![]},'include':[{'model':db[_0x0b75('0xeb')],'as':_0x0b75('0xec'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0b75('0xed'),'raw':!![]}]}]});}})[_0x0b75('0x1a')](function(_0x3719d9){if(_0x3719d9&&_0x3719d9['Smtp']&&_0x59f638[_0x0b75('0xee')]&&_0x59f638[_0x0b75('0xef')]){var _0x1ac169=_0x3719d9[_0x0b75('0xf0')]();return respondWithRpcPromise(_0x0b75('0xf1'),_0x0b75('0xf2'),{'account':_0x1ac169,'message':{'from':util[_0x0b75('0x42')](_0x0b75('0xf3'),_0x3719d9[_0x0b75('0x31')],_0x3719d9['email']||_0x3719d9[_0x0b75('0xec')][_0x0b75('0x69')]),'to':_0x59f638[_0x0b75('0xef')],'subject':_0x59f638['offlineMessageSubject'],'html':_0x13c8bb['body'],'attachments':_0x4b60ae}},client9003)[_0x0b75('0x1a')](function(){return _0x13c8bb;})['catch'](function(_0x3029bd){logger['error'](_0x3029bd);});}})[_0x0b75('0x1a')](function(){if(_0x59f638&&_0x59f638['openNewInteraction']&&_0x59f638['MailAccountId']){var _0x35650c=[];if(_0x424cd2[_0x0b75('0x52')]){_0x35650c=_0x424cd2[_0x0b75('0x49')](function(_0x112c3b){return{'name':_0x112c3b['originalname'],'basename':_0x112c3b[_0x0b75('0x7f')],'type':_0x112c3b[_0x0b75('0xe3')],'ChatOfflineMessageId':_0x41b4d2['id']};});}var _0x2ba9bd;if(!_[_0x0b75('0x90')](_0x59f638[_0x0b75('0xf4')])){var _0x416ac3=_[_0x0b75('0x49')](_0x3a5c13[_0x0b75('0x64')],function(_0x2fdb76){return _0x2fdb76;});var _0x58126b=_[_0x0b75('0xf5')](_0x416ac3)[0x0];var _0x19d4fc=_[_0x0b75('0xf6')](_0x58126b,function(_0x542787){return _0x542787;});_0x2ba9bd=_0x19d4fc[0x1][_0x59f638['subjectOffline']];}var _0x148dfd={'from':_0x4be8e9[_0x0b75('0xf7')],'firstName':_0x4be8e9[_0x0b75('0x3a')],'lastName':_0x4be8e9[_0x0b75('0x3b')],'mapKey':_0x0b75('0xf7'),'message':{'from':_0x4be8e9[_0x0b75('0xf7')],'to':_0x59f638['MailAccount'][_0x0b75('0xf7')],'cc':'','subject':_[_0x0b75('0x90')](_0x2ba9bd)?_0x59f638[_0x0b75('0xf8')]:_0x2ba9bd,'messageId':'','sentAt':new Date(),'attach':_0x35650c['length'],'attachments':_0x35650c,'originChannel':_0x0b75('0xf9'),'ChatWebsiteId':_0x59f638['id'],'ChatOfflineMessageId':_0x13c8bb['id'],'originTo':_0x59f638[_0x0b75('0xdb')][_0x0b75('0xf7')]},'body':_0x13c8bb['body']};var _0xac5cda={'account':{'id':_0x59f638['MailAccountId']},'body':_0x148dfd,'log':_0x0b75('0xfa')};return respondWithRpcPromise(_0x0b75('0xfa'),'notifyMail',_0xac5cda,client9001)[_0x0b75('0x1a')](function(){return _0x13c8bb;})[_0x0b75('0x5f')](function(_0x1e0e8c){logger[_0x0b75('0x1f')](_0x1e0e8c);});}return;})[_0x0b75('0x1a')](function(){if(_0x13c8bb){return _0x13c8bb;}})[_0x0b75('0x1a')](respondWithResult(_0xefeae2,null))[_0x0b75('0x5f')](function(){for(var _0x12bcbd of _0x424cd2){var _0x4afa1b=path[_0x0b75('0x8c')](config['root'],_0x0b75('0xfb'),'files','attachments','offline-chat',_0x12bcbd[_0x0b75('0x7f')]);fs_extra[_0x0b75('0xfc')](_0x4afa1b)[_0x0b75('0x5f')](function(_0x22e6dd){logger[_0x0b75('0x1f')](_0x0b75('0xfd'),_0x4afa1b,_0x22e6dd);});}});};exports[_0x0b75('0xfe')]=function(_0x28b621,_0xe81e53){return db['ChatInteraction'][_0x0b75('0x63')]({'where':{'id':_0x28b621[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0xe81e53,null))[_0x0b75('0x1a')](function(_0x391170){if(_0x391170){return _0x391170[_0x0b75('0xfe')](_0x28b621['body']['ids'],_[_0x0b75('0xff')](_0x28b621[_0x0b75('0x64')],[_0x0b75('0x7a'),'id'])||{});}})[_0x0b75('0x1a')](respondWithResult(_0xe81e53,null))[_0x0b75('0x5f')](handleError(_0xe81e53,null));};exports[_0x0b75('0x100')]=function(_0x38bcea,_0x41e745){var _0x1f4503={'raw':![],'where':{}};var _0xb35ea0={};var _0xa0fe23={'count':0x0,'rows':[]};return db[_0x0b75('0x4a')][_0x0b75('0x76')]({'where':{'id':_0x38bcea[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x41e745,null))[_0x0b75('0x1a')](function(_0x5aa053){if(_0x5aa053){_0xb35ea0[_0x0b75('0x44')]=_['keys'](db[_0x0b75('0xb8')]['rawAttributes']);_0xb35ea0[_0x0b75('0x4e')]=_[_0x0b75('0x4d')](_0x38bcea[_0x0b75('0x4e')]);_0xb35ea0[_0x0b75('0x57')]=_[_0x0b75('0x50')](_0xb35ea0[_0x0b75('0x44')],_0xb35ea0['query']);_0x1f4503[_0x0b75('0x4f')]=_[_0x0b75('0x50')](_0xb35ea0[_0x0b75('0x44')],qs[_0x0b75('0x51')](_0x38bcea[_0x0b75('0x4e')][_0x0b75('0x51')]));_0x1f4503[_0x0b75('0x4f')]=_0x1f4503['attributes'][_0x0b75('0x52')]?_0x1f4503['attributes']:_0xb35ea0[_0x0b75('0x44')];if(!_0x38bcea['query']['hasOwnProperty']('nolimit')){_0x1f4503[_0x0b75('0x2a')]=qs[_0x0b75('0x2a')](_0x38bcea[_0x0b75('0x4e')][_0x0b75('0x2a')]);_0x1f4503[_0x0b75('0x27')]=qs[_0x0b75('0x27')](_0x38bcea[_0x0b75('0x4e')][_0x0b75('0x27')]);}_0x1f4503[_0x0b75('0x55')]=qs[_0x0b75('0x77')](_0x38bcea[_0x0b75('0x4e')][_0x0b75('0x77')]);_0x1f4503[_0x0b75('0x56')]=qs[_0x0b75('0x57')](_[_0x0b75('0x58')](_0x38bcea[_0x0b75('0x4e')],_0xb35ea0[_0x0b75('0x57')]));_0x1f4503[_0x0b75('0x56')][_0x0b75('0x73')]=_0x5aa053['id'];if(_0x38bcea['query'][_0x0b75('0x59')]){_0x1f4503[_0x0b75('0x56')]=_[_0x0b75('0x5a')](_0x1f4503[_0x0b75('0x56')],{'$or':_[_0x0b75('0x49')](_0x1f4503[_0x0b75('0x4f')],function(_0x2f820a){var _0x28cb23={};_0x28cb23[_0x2f820a]={'$like':'%'+_0x38bcea[_0x0b75('0x4e')]['filter']+'%'};return _0x28cb23;})});}_0x1f4503=_[_0x0b75('0x5a')]({},_0x1f4503,_0x38bcea['options']);return db[_0x0b75('0xb8')][_0x0b75('0x29')]({'where':_0x1f4503[_0x0b75('0x56')]})[_0x0b75('0x1a')](function(_0x53ed80){_0xa0fe23[_0x0b75('0x29')]=_0x53ed80;if(_0x38bcea[_0x0b75('0x4e')]['includeAll']){_0x1f4503[_0x0b75('0x5d')]=[{'model':db[_0x0b75('0xa0')],'as':_0x0b75('0x101'),'required':![]},{'model':db['User'],'as':_0x0b75('0x102'),'attributes':['name',_0x0b75('0x103'),_0x0b75('0x104')],'required':![]},{'model':db[_0x0b75('0x105')],'as':_0x0b75('0x106'),'attributes':['id',_0x0b75('0x31'),'color'],'where':_0x38bcea[_0x0b75('0x4e')][_0x0b75('0x107')]?{'id':_0x38bcea[_0x0b75('0x4e')][_0x0b75('0x107')]}:undefined,'required':_0x38bcea['query']['tag']?!![]:![]}];}return db[_0x0b75('0xb8')][_0x0b75('0x78')](_0x1f4503);})[_0x0b75('0x1a')](function(_0x2d399e){_0xa0fe23[_0x0b75('0x5e')]=_0x2d399e;return _0xa0fe23;});}})['then'](respondWithFilteredResult(_0x41e745,_0x1f4503))[_0x0b75('0x5f')](handleError(_0x41e745,null));};exports[_0x0b75('0x108')]=function(_0x1a8510,_0x4c059a){var _0x23e756=0x0;var _0x59861f=0x0;var _0x302fc0=![];var _0x3543f7;var _0x4f4dc2;return db[_0x0b75('0x4a')][_0x0b75('0x63')]({'where':{'id':_0x1a8510[_0x0b75('0x61')]['id']},'include':[{'model':db[_0x0b75('0xab')],'as':_0x0b75('0xab'),'include':[{'model':db[_0x0b75('0xab')],'as':_0x0b75('0x109'),'attributes':['id',_0x0b75('0xac')]}]}]})[_0x0b75('0x1a')](handleEntityNotFound(_0x4c059a,null))[_0x0b75('0x1a')](function(_0x21a25b){if(_0x21a25b){_0x3543f7=_0x21a25b;return _0x21a25b[_0x0b75('0x10a')]({'raw':!![]});}})['then'](function(_0x2ed6a9){if(_0x3543f7){if(_0x2ed6a9){_0x4f4dc2=_0x2ed6a9;}}return require(_0x0b75('0x89'))['getLicense']();})[_0x0b75('0x1a')](function(_0x1ad07c){if(_0x1ad07c){_0x59861f=_0x1ad07c[_0x0b75('0x10b')];_0x302fc0=_0x1ad07c[_0x0b75('0x10c')];}})[_0x0b75('0x1a')](function(){return db[_0x0b75('0xb8')]['count']({'where':{'closed':![]}});})[_0x0b75('0x1a')](function(_0x3a935b){_0x23e756=_0x3a935b;if(_0x59861f&&_0x3a935b>_0x59861f){return db[_0x0b75('0x10d')][_0x0b75('0x76')]({'where':{'id':0x1}})['then'](function(_0x419210){if(_0x419210){_0x419210[_0x0b75('0x10e')]('chatLicenseExceeded');}});}})['then'](function(){var _0x1845e9=_0x3543f7[_0x0b75('0xab')];var _0x63128f=_0x3543f7[_0x0b75('0x98')]||undefined;return _0x1845e9?_0x1845e9[_0x0b75('0x99')](_0x63128f):!![];})[_0x0b75('0x1a')](function(_0x37cfd5){var _0x13b563=fs['readFileSync'](path[_0x0b75('0x8c')](config[_0x0b75('0x87')],_0x0b75('0x10f')),_0x0b75('0xdf'));var _0x3bcd9e=_0x0b75('0x110');var _0x263f78=![];var _0x41bf90,_0x5dd023;if(_0x1a8510[_0x0b75('0x111')]['referer']){_0x41bf90=new URL(_0x1a8510['headers']['referer'])[_0x0b75('0x112')];}else if(_0x1a8510[_0x0b75('0x111')][_0x0b75('0x112')]){_0x41bf90=new URL(_0x1a8510[_0x0b75('0x111')][_0x0b75('0x112')])[_0x0b75('0x112')];}else{_0x41bf90='http://localhost:9000';}_0x5dd023=typeof _0x3543f7['address'][_0x0b75('0x39')](',')[_0x0b75('0x63')](function(_0x8f9448){return wildcardUtils[_0x0b75('0x113')](_0x8f9448,_0x41bf90);})!==_0x0b75('0x28');var _0x10a97e={'chatVersion':_0x3bcd9e,'chatWebsiteAddressOrigin':_0x5dd023?_0x41bf90:_0x3543f7[_0x0b75('0x65')],'remote':_0x3543f7[_0x0b75('0x114')],'query':querystring[_0x0b75('0x1e')](_[_0x0b75('0x5a')](_0x3543f7[_0x0b75('0x2e')]({'plain':!![]}),{'customerIp':_0x1a8510[_0x0b75('0x111')]['x-forwarded-for']||_0x1a8510[_0x0b75('0x111')]['x-real-ip']||_0x1a8510[_0x0b75('0x115')]['remoteAddress']||_0x1a8510['ip'],'referer':_0x1a8510['headers'][_0x0b75('0x3d')],'openedInteractions':_0x23e756,'maxInteractions':_0x59861f,'virtual':_0x302fc0[_0x0b75('0x10b')],'online':_0x37cfd5,'custom':_0x302fc0,'address':_0x5dd023?_0x41bf90:null}))[_0x0b75('0x116')](/'/g,'\x5c\x27')};_0x4c059a[_0x0b75('0xd4')](ejs[_0x0b75('0xe0')](Mustache[_0x0b75('0xe0')](_0x13b563,_0x10a97e),{'proactiveActions':_0x4f4dc2,'alignment':_0x3543f7['alignment'],'verticalAlignment':_0x3543f7[_0x0b75('0x117')],'div_color':_0x3543f7[_0x0b75('0x118')],'labelText':_0x3543f7[_0x0b75('0x119')],'text_color':_0x3543f7[_0x0b75('0x11a')],'text_button_color':_0x3543f7[_0x0b75('0x11b')],'button_color':_0x3543f7[_0x0b75('0x11c')],'background_color':_0x3543f7[_0x0b75('0x11d')],'hideWhenOffline':_0x3543f7[_0x0b75('0x11e')],'intervalId':_0x3543f7[_0x0b75('0x11f')],'isDevelopment':_0x263f78,'chatVersion':_0x3bcd9e}));})['catch'](handleError(_0x4c059a,null));};exports[_0x0b75('0x120')]=function(_0x44d0b8,_0x216ac4){var _0x3ecb31=_0x44d0b8['params']['id'];var _0x1f4e2d=_0x44d0b8[_0x0b75('0x64')];var _0x5b59f9=0xc8;var _0xb07512=null;return db['sequelize'][_0x0b75('0xe9')]({'isolationLevel':db[_0x0b75('0x121')][_0x0b75('0x122')][_0x0b75('0x123')]['READ_COMMITTED']},function(_0x5cf263){return db[_0x0b75('0x4a')][_0x0b75('0x76')]({'where':{'id':_0x3ecb31},'transaction':_0x5cf263})[_0x0b75('0x1a')](function(_0x39c096){if(_0x39c096){return db[_0x0b75('0xaa')][_0x0b75('0x2d')]({'where':{'ChatWebsiteId':_0x3ecb31},'transaction':_0x5cf263})[_0x0b75('0x1a')](function(){var _0x35a755=_['map'](_0x1f4e2d,function(_0x155ff4){_0x155ff4[_0x0b75('0x73')]=_0x3ecb31;return _0x155ff4;});return db[_0x0b75('0xaa')]['bulkCreate'](_0x35a755,{'transaction':_0x5cf263});});}else{_0x5b59f9=0x194;_0xb07512=[];}});})[_0x0b75('0x1a')](function(){if(_0x5b59f9!==0x194){return db[_0x0b75('0xaa')][_0x0b75('0x124')]({'where':{'ChatWebsiteId':_0x3ecb31},'order':_0x0b75('0x125')})[_0x0b75('0x1a')](function(_0x1d33fa){_0xb07512=_0x1d33fa;});}})[_0x0b75('0x5f')](function(_0x9de23f){_0x5b59f9=0x1f4;logger[_0x0b75('0x1f')](_0x9de23f['stack']);if(_0x9de23f['name']){delete _0x9de23f[_0x0b75('0x31')];}_0xb07512=_0x9de23f;})[_0x0b75('0x126')](function(){if(_0xb07512===null){_0x216ac4[_0x0b75('0x24')](_0x5b59f9);}else{if(_0x5b59f9===0x1f4){_0x216ac4[_0x0b75('0x26')](_0x5b59f9)[_0x0b75('0xd4')](_0xb07512);}else{_0x216ac4['status'](_0x5b59f9)[_0x0b75('0x127')](_0xb07512);}}});};exports['getApplications']=function(_0x23f16d,_0x13bff9){var _0x1d9ecc={};var _0x4b8d4a={};var _0x2e8dd5;var _0x5a972e;return db[_0x0b75('0x4a')][_0x0b75('0x76')]({'where':{'id':_0x23f16d[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x13bff9,null))[_0x0b75('0x1a')](function(_0x5f148d){if(_0x5f148d){_0x2e8dd5=_0x5f148d;_0x4b8d4a[_0x0b75('0x44')]=_['keys'](db[_0x0b75('0xaa')]['rawAttributes']);_0x4b8d4a[_0x0b75('0x4e')]=_[_0x0b75('0x4d')](_0x23f16d[_0x0b75('0x4e')]);_0x4b8d4a[_0x0b75('0x57')]=_[_0x0b75('0x50')](_0x4b8d4a[_0x0b75('0x44')],_0x4b8d4a[_0x0b75('0x4e')]);_0x1d9ecc[_0x0b75('0x4f')]=_[_0x0b75('0x50')](_0x4b8d4a[_0x0b75('0x44')],qs['fields'](_0x23f16d['query']['fields']));_0x1d9ecc[_0x0b75('0x4f')]=_0x1d9ecc[_0x0b75('0x4f')]['length']?_0x1d9ecc[_0x0b75('0x4f')]:_0x4b8d4a[_0x0b75('0x44')];_0x1d9ecc[_0x0b75('0x55')]=qs['sort'](_0x23f16d['query']['sort']);_0x1d9ecc['where']=qs['filters'](_[_0x0b75('0x58')](_0x23f16d[_0x0b75('0x4e')],_0x4b8d4a['filters']));if(_0x23f16d[_0x0b75('0x4e')][_0x0b75('0x59')]){_0x1d9ecc[_0x0b75('0x56')]=_[_0x0b75('0x5a')](_0x1d9ecc['where'],{'$or':_['map'](_0x1d9ecc[_0x0b75('0x4f')],function(_0xe638ad){var _0x4a5f26={};_0x4a5f26[_0xe638ad]={'$like':'%'+_0x23f16d[_0x0b75('0x4e')][_0x0b75('0x59')]+'%'};return _0x4a5f26;})});}_0x1d9ecc=_[_0x0b75('0x5a')]({},_0x1d9ecc,_0x23f16d['options']);return _0x2e8dd5[_0x0b75('0x128')](_0x1d9ecc);}})[_0x0b75('0x1a')](function(_0x5da011){if(_0x5da011){_0x5a972e=_0x5da011[_0x0b75('0x52')];if(!_0x23f16d[_0x0b75('0x4e')][_0x0b75('0x53')](_0x0b75('0x54'))){_0x1d9ecc[_0x0b75('0x2a')]=qs[_0x0b75('0x2a')](_0x23f16d[_0x0b75('0x4e')][_0x0b75('0x2a')]);_0x1d9ecc[_0x0b75('0x27')]=qs[_0x0b75('0x27')](_0x23f16d[_0x0b75('0x4e')][_0x0b75('0x27')]);}return _0x2e8dd5[_0x0b75('0x128')](_0x1d9ecc);}})[_0x0b75('0x1a')](function(_0x286881){if(_0x286881){return _0x286881?{'count':_0x5a972e,'rows':_0x286881}:null;}})[_0x0b75('0x1a')](respondWithResult(_0x13bff9,null))['catch'](handleError(_0x13bff9,null));};exports[_0x0b75('0x129')]=function(_0x1615b8,_0x11498c){return db['chatProactiveAction'][_0x0b75('0x63')]({'where':{'id':_0x1615b8[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x11498c,null))[_0x0b75('0x1a')](function(_0x3c0d64){if(_0x3c0d64){return _0x3c0d64[_0x0b75('0x129')](_0x1615b8[_0x0b75('0x64')][_0x0b75('0x7a')],_['omit'](_0x1615b8['body'],[_0x0b75('0x7a'),'id'])||{});}})[_0x0b75('0x1a')](respondWithResult(_0x11498c,null))[_0x0b75('0x5f')](handleError(_0x11498c,null));};exports[_0x0b75('0x10a')]=function(_0x457c71,_0x2724c6){var _0x52cebd={};var _0x47109c={};var _0xdd6362;var _0x200158;return db[_0x0b75('0x4a')]['findOne']({'where':{'id':_0x457c71[_0x0b75('0x61')]['id']}})['then'](handleEntityNotFound(_0x2724c6,null))[_0x0b75('0x1a')](function(_0x346742){if(_0x346742){_0xdd6362=_0x346742;_0x47109c[_0x0b75('0x44')]=_[_0x0b75('0x4d')](db[_0x0b75('0x12a')]['rawAttributes']);_0x47109c[_0x0b75('0x4e')]=_[_0x0b75('0x4d')](_0x457c71[_0x0b75('0x4e')]);_0x47109c['filters']=_[_0x0b75('0x50')](_0x47109c['model'],_0x47109c[_0x0b75('0x4e')]);_0x52cebd['attributes']=_[_0x0b75('0x50')](_0x47109c['model'],qs['fields'](_0x457c71[_0x0b75('0x4e')]['fields']));_0x52cebd['attributes']=_0x52cebd[_0x0b75('0x4f')]['length']?_0x52cebd[_0x0b75('0x4f')]:_0x47109c[_0x0b75('0x44')];_0x52cebd[_0x0b75('0x55')]=qs['sort'](_0x457c71[_0x0b75('0x4e')][_0x0b75('0x77')]);_0x52cebd[_0x0b75('0x56')]=qs[_0x0b75('0x57')](_[_0x0b75('0x58')](_0x457c71['query'],_0x47109c['filters']));if(_0x457c71[_0x0b75('0x4e')]['filter']){_0x52cebd[_0x0b75('0x56')]=_[_0x0b75('0x5a')](_0x52cebd[_0x0b75('0x56')],{'$or':_[_0x0b75('0x49')](_0x52cebd[_0x0b75('0x4f')],function(_0x34b0e6){var _0x1b95cc={};_0x1b95cc[_0x34b0e6]={'$like':'%'+_0x457c71['query'][_0x0b75('0x59')]+'%'};return _0x1b95cc;})});}_0x52cebd=_['merge']({},_0x52cebd,_0x457c71[_0x0b75('0x62')]);return _0xdd6362[_0x0b75('0x10a')](_0x52cebd);}})['then'](function(_0x4544ab){if(_0x4544ab){_0x200158=_0x4544ab[_0x0b75('0x52')];if(!_0x457c71['query'][_0x0b75('0x53')](_0x0b75('0x54'))){_0x52cebd[_0x0b75('0x2a')]=qs[_0x0b75('0x2a')](_0x457c71[_0x0b75('0x4e')][_0x0b75('0x2a')]);_0x52cebd[_0x0b75('0x27')]=qs[_0x0b75('0x27')](_0x457c71[_0x0b75('0x4e')][_0x0b75('0x27')]);}return _0xdd6362[_0x0b75('0x10a')](_0x52cebd);}})[_0x0b75('0x1a')](function(_0x5b2aa9){if(_0x5b2aa9){return _0x5b2aa9?{'count':_0x200158,'rows':_0x5b2aa9}:null;}})[_0x0b75('0x1a')](respondWithResult(_0x2724c6,null))[_0x0b75('0x5f')](handleError(_0x2724c6,null));};exports['getFields']=function(_0x166af3,_0x3ac31e){var _0x215cac=_0x166af3[_0x0b75('0x4e')][_0x0b75('0x12b')]===_0x0b75('0x12c')?'offlineForm':_0x0b75('0x12d');return db[_0x0b75('0x4a')][_0x0b75('0x63')]({'attributes':['id',_0x215cac],'where':{'id':_0x166af3[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x3ac31e,null))['then'](function(_0x415253){if(_0x415253){var _0x53623c=_0x415253[_0x215cac];var _0x1c6f01=_0x53623c&&_0x53623c[_0x0b75('0x12e')]?_0x53623c[_0x0b75('0x12e')]:[];_0x3ac31e[_0x0b75('0xd4')]({'fromKey':_[_0x0b75('0x90')](_0x53623c['fromKey'])?undefined:_0x53623c[_0x0b75('0x12f')],'count':_0x1c6f01[_0x0b75('0x52')],'rows':_0x1c6f01});}})[_0x0b75('0x5f')](handleError(_0x3ac31e,null));};exports[_0x0b75('0x130')]=function(_0x2f1287,_0x180cdd){var _0x179bd1={'raw':![],'where':{}};var _0x1c6311={};var _0x2a5aed={'count':0x0,'rows':[]};return db[_0x0b75('0x4a')][_0x0b75('0x76')]({'where':{'id':_0x2f1287[_0x0b75('0x61')]['id']}})['then'](handleEntityNotFound(_0x180cdd,null))['then'](function(_0x4453ac){if(_0x4453ac){_0x1c6311[_0x0b75('0x44')]=_[_0x0b75('0x4d')](db[_0x0b75('0x131')]['rawAttributes']);_0x1c6311[_0x0b75('0x4e')]=_[_0x0b75('0x4d')](_0x2f1287['query']);_0x1c6311[_0x0b75('0x57')]=_[_0x0b75('0x50')](_0x1c6311['model'],_0x1c6311[_0x0b75('0x4e')]);_0x179bd1['attributes']=_[_0x0b75('0x50')](_0x1c6311['model'],qs[_0x0b75('0x51')](_0x2f1287['query'][_0x0b75('0x51')]));_0x179bd1[_0x0b75('0x4f')]=_0x179bd1[_0x0b75('0x4f')][_0x0b75('0x52')]?_0x179bd1[_0x0b75('0x4f')]:_0x1c6311[_0x0b75('0x44')];if(!_0x2f1287[_0x0b75('0x4e')][_0x0b75('0x53')](_0x0b75('0x54'))){_0x179bd1['limit']=qs['limit'](_0x2f1287[_0x0b75('0x4e')][_0x0b75('0x2a')]);_0x179bd1[_0x0b75('0x27')]=qs[_0x0b75('0x27')](_0x2f1287['query']['offset']);}_0x179bd1[_0x0b75('0x55')]=qs[_0x0b75('0x77')](_0x2f1287[_0x0b75('0x4e')][_0x0b75('0x77')]);_0x179bd1['where']=qs[_0x0b75('0x57')](_[_0x0b75('0x58')](_0x2f1287[_0x0b75('0x4e')],_0x1c6311[_0x0b75('0x57')]));_0x179bd1[_0x0b75('0x56')][_0x0b75('0x73')]=_0x4453ac['id'];if(_0x2f1287[_0x0b75('0x4e')][_0x0b75('0x59')]){_0x179bd1[_0x0b75('0x56')]=_['merge'](_0x179bd1[_0x0b75('0x56')],{'$or':_[_0x0b75('0x49')](_0x179bd1[_0x0b75('0x4f')],function(_0x29b0d3){var _0x33db24={};_0x33db24[_0x29b0d3]={'$like':'%'+_0x2f1287[_0x0b75('0x4e')][_0x0b75('0x59')]+'%'};return _0x33db24;})});}_0x179bd1=_[_0x0b75('0x5a')]({},_0x179bd1,_0x2f1287[_0x0b75('0x62')]);return db[_0x0b75('0x131')][_0x0b75('0x29')]({'where':_0x179bd1['where']})[_0x0b75('0x1a')](function(_0x1aaff5){_0x2a5aed[_0x0b75('0x29')]=_0x1aaff5;if(_0x2f1287[_0x0b75('0x4e')][_0x0b75('0x5c')]){_0x179bd1['include']=[{'all':!![]}];}else{_0x179bd1[_0x0b75('0x5d')]=[{'model':db[_0x0b75('0xa0')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0x0b75('0x132'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x179bd1);})[_0x0b75('0x1a')](function(_0x1d53f0){_0x2a5aed[_0x0b75('0x5e')]=_0x1d53f0;return _0x2a5aed;});}})['then'](respondWithFilteredResult(_0x180cdd,_0x179bd1))[_0x0b75('0x5f')](handleError(_0x180cdd,null));};exports['addAgents']=function(_0xfa5d25,_0x2ca127){return db[_0x0b75('0x4a')]['find']({'where':{'id':_0xfa5d25[_0x0b75('0x61')]['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x2ca127,null))[_0x0b75('0x1a')](function(_0x17aa0d){if(_0x17aa0d){return _0x17aa0d[_0x0b75('0x133')](_0xfa5d25[_0x0b75('0x64')][_0x0b75('0x7a')],_[_0x0b75('0xff')](_0xfa5d25['body'],[_0x0b75('0x7a'),'id'])||{})['spread'](function(_0x380ce7){for(var _0x4f3ac9=0x0;_0x4f3ac9<_0xfa5d25[_0x0b75('0x64')][_0x0b75('0x7a')][_0x0b75('0x52')];_0x4f3ac9+=0x1){socket[_0x0b75('0x134')](_0x0b75('0x135'),{'UserId':Number(_0xfa5d25[_0x0b75('0x64')][_0x0b75('0x7a')][_0x4f3ac9]),'ChatWebsiteId':Number(_0xfa5d25['params']['id'])});}return _0x380ce7;});}})[_0x0b75('0x1a')](respondWithResult(_0x2ca127,null))[_0x0b75('0x5f')](handleError(_0x2ca127,null));};exports[_0x0b75('0x136')]=function(_0x366ad2,_0x4c99df){return db[_0x0b75('0x4a')]['find']({'where':{'id':_0x366ad2['params']['id']}})[_0x0b75('0x1a')](handleEntityNotFound(_0x4c99df,null))[_0x0b75('0x1a')](function(_0x5029fc){if(_0x5029fc){return _0x5029fc[_0x0b75('0x136')](_0x366ad2[_0x0b75('0x4e')][_0x0b75('0x7a')])[_0x0b75('0x1a')](function(){if(_[_0x0b75('0x137')](_0x366ad2['query'][_0x0b75('0x7a')])){for(var _0x20ccd0=0x0;_0x20ccd0<_0x366ad2[_0x0b75('0x4e')][_0x0b75('0x7a')][_0x0b75('0x52')];_0x20ccd0+=0x1){socket['emit'](_0x0b75('0x138'),{'UserId':Number(_0x366ad2[_0x0b75('0x4e')][_0x0b75('0x7a')][_0x20ccd0]),'ChatWebsiteId':Number(_0x366ad2[_0x0b75('0x61')]['id'])});}}else{socket[_0x0b75('0x134')](_0x0b75('0x138'),{'UserId':Number(_0x366ad2[_0x0b75('0x4e')][_0x0b75('0x7a')]),'ChatWebsiteId':Number(_0x366ad2[_0x0b75('0x61')]['id'])});}});}})[_0x0b75('0x1a')](respondWithStatusCode(_0x4c99df,null))[_0x0b75('0x5f')](handleError(_0x4c99df,null));};exports['getAgents']=function(_0x4bf9a4,_0x5d7fe7){var _0x2cb19e={};var _0x5daf65={};var _0x168cf7;var _0x4e6a18;return db['ChatWebsite'][_0x0b75('0x76')]({'where':{'id':_0x4bf9a4['params']['id']}})['then'](handleEntityNotFound(_0x5d7fe7,null))[_0x0b75('0x1a')](function(_0xfacc28){if(_0xfacc28){_0x168cf7=_0xfacc28;_0x5daf65[_0x0b75('0x44')]=_[_0x0b75('0x4d')](db['User']['rawAttributes']);_0x5daf65[_0x0b75('0x4e')]=_[_0x0b75('0x4d')](_0x4bf9a4[_0x0b75('0x4e')]);_0x5daf65['filters']=_[_0x0b75('0x50')](_0x5daf65[_0x0b75('0x44')],_0x5daf65[_0x0b75('0x4e')]);_0x2cb19e[_0x0b75('0x4f')]=_['intersection'](_0x5daf65['model'],qs[_0x0b75('0x51')](_0x4bf9a4[_0x0b75('0x4e')]['fields']));_0x2cb19e[_0x0b75('0x4f')]=_0x2cb19e[_0x0b75('0x4f')][_0x0b75('0x52')]?_0x2cb19e[_0x0b75('0x4f')]:_0x5daf65[_0x0b75('0x44')];_0x2cb19e[_0x0b75('0x55')]=qs['sort'](_0x4bf9a4[_0x0b75('0x4e')][_0x0b75('0x77')]);_0x2cb19e[_0x0b75('0x56')]=qs[_0x0b75('0x57')](_['pick'](_0x4bf9a4[_0x0b75('0x4e')],_0x5daf65[_0x0b75('0x57')]));if(_0x4bf9a4['query'][_0x0b75('0x59')]){_0x2cb19e[_0x0b75('0x56')]=_[_0x0b75('0x5a')](_0x2cb19e[_0x0b75('0x56')],{'$or':_[_0x0b75('0x49')](_0x2cb19e[_0x0b75('0x4f')],function(_0x15fc60){var _0x34ccf9={};_0x34ccf9[_0x15fc60]={'$like':'%'+_0x4bf9a4[_0x0b75('0x4e')][_0x0b75('0x59')]+'%'};return _0x34ccf9;})});}_0x2cb19e=_[_0x0b75('0x5a')]({},_0x2cb19e,_0x4bf9a4[_0x0b75('0x62')]);return _0x168cf7['getAgents'](_0x2cb19e);}})[_0x0b75('0x1a')](function(_0x276044){if(_0x276044){_0x4e6a18=_0x276044[_0x0b75('0x52')];if(!_0x4bf9a4[_0x0b75('0x4e')][_0x0b75('0x53')]('nolimit')){_0x2cb19e[_0x0b75('0x2a')]=qs[_0x0b75('0x2a')](_0x4bf9a4[_0x0b75('0x4e')][_0x0b75('0x2a')]);_0x2cb19e[_0x0b75('0x27')]=qs[_0x0b75('0x27')](_0x4bf9a4[_0x0b75('0x4e')][_0x0b75('0x27')]);}return _0x168cf7[_0x0b75('0x139')](_0x2cb19e);}})[_0x0b75('0x1a')](function(_0x5c7868){if(_0x5c7868){return _0x5c7868?{'count':_0x4e6a18,'rows':_0x5c7868}:null;}})[_0x0b75('0x1a')](respondWithResult(_0x5d7fe7,null))[_0x0b75('0x5f')](handleError(_0x5d7fe7,null));}; \ No newline at end of file +var _0xac90=['Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','List','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','*,*,*,*','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','Sequelize','ValidationError','difference','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','fromString','originalname','mimetype','server','attachments','offline-chat','basename','sequelize','transaction','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','toPairsIn','mapValues','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','internal','Tag','color','tag','getSnippet','Intervals','virtual','License','increment','chatLicenseExceeded','3.12.2','origin','testWebsiteWithWildcard','x-forwarded-for','x-real-ip','remoteAddress','replace','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','ChatApplication','findAndCountAll','stack','finally','getApplications','chatProactiveAction','ChatProactiveAction','getProactiveActions','online','false','offlineForm','onlineForm','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','../../mysqldb','redis','defaults','localhost','register','client','http','request','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','update','destroy','then','get','ChatWebsites','UserProfileResource','name','send','setUA','user-agent','getResult','customerIp','cf-connecting-ip','first','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','stringify','map','ChatWebsite','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','find','create','body','address','split','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','sitepic','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','isNil','showCustomerAvatar','Interval','resolve','timezone','ifTime','notify','from','mapKey','MapKey\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','Contacts','DESC','Applications','interval'];(function(_0x45236b,_0x9b3190){var _0x1be3f8=function(_0x1e8305){while(--_0x1e8305){_0x45236b['push'](_0x45236b['shift']());}};_0x1be3f8(++_0x9b3190);}(_0xac90,0x1be));var _0x0ac9=function(_0xfa3815,_0x108d12){_0xfa3815=_0xfa3815-0x0;var _0x28b7e1=_0xac90[_0xfa3815];return _0x28b7e1;};'use strict';var Mustache=require(_0x0ac9('0x0'));var util=require(_0x0ac9('0x1'));var path=require(_0x0ac9('0x2'));var ejs=require(_0x0ac9('0x3'));var fs=require('fs');var fs_extra=require(_0x0ac9('0x4'));var _=require(_0x0ac9('0x5'));var querystring=require('querystring');var htmlToText=require(_0x0ac9('0x6'));var Redis=require(_0x0ac9('0x7'));var jayson=require('jayson/promise');var qs=require(_0x0ac9('0x8'));var logger=require(_0x0ac9('0x9'))(_0x0ac9('0xa'));var config=require(_0x0ac9('0xb'));var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APINotFoundError=require(_0x0ac9('0xc'))[_0x0ac9('0xd')];var APIOutOfIntervalError=require(_0x0ac9('0xc'))[_0x0ac9('0xe')];var APIHandleError=require(_0x0ac9('0xc'))[_0x0ac9('0xf')];var APIConflictError=require(_0x0ac9('0xc'))[_0x0ac9('0x10')];var wildcardUtils=require(_0x0ac9('0x11'));var URL=require(_0x0ac9('0x12'))['URL'];var db=require(_0x0ac9('0x13'))['db'];config[_0x0ac9('0x14')]=_[_0x0ac9('0x15')](config[_0x0ac9('0x14')],{'host':_0x0ac9('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ac9('0x14')]));require('./chatWebsite.socket')[_0x0ac9('0x17')](socket);var client=jayson[_0x0ac9('0x18')][_0x0ac9('0x19')]({'port':0x232c});var client9002=jayson[_0x0ac9('0x18')][_0x0ac9('0x19')]({'port':0x232a});var client9003=jayson[_0x0ac9('0x18')][_0x0ac9('0x19')]({'port':0x232b});var client9001=jayson[_0x0ac9('0x18')][_0x0ac9('0x19')]({'port':0x2329});function respondWithRpcPromise(_0xddcfc9,_0x304a36,_0x2568c8,_0xcc2bdc){return new Promise(function(_0x507c61,_0x3e4bbf){var _0x3b7b25=_0xcc2bdc||client;return _0x3b7b25[_0x0ac9('0x1a')](_0xddcfc9,_0x2568c8)['then'](function(_0x5c0ec4){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x304a36,_0x0ac9('0x1b'));logger[_0x0ac9('0x1c')](_0x0ac9('0x1d'),_0x304a36,_0x0ac9('0x1b'),JSON['stringify'](_0x5c0ec4));if(_0x5c0ec4[_0x0ac9('0x1e')]){if(_0x5c0ec4[_0x0ac9('0x1e')][_0x0ac9('0x1f')]===0x1f4){logger[_0x0ac9('0x1e')](_0x0ac9('0x20'),_0x304a36,_0x5c0ec4[_0x0ac9('0x1e')][_0x0ac9('0x21')]);return _0x3e4bbf(_0x5c0ec4[_0x0ac9('0x1e')][_0x0ac9('0x21')]);}logger[_0x0ac9('0x1e')](_0x0ac9('0x20'),_0x304a36,_0x5c0ec4[_0x0ac9('0x1e')][_0x0ac9('0x21')]);return _0x507c61(_0x5c0ec4[_0x0ac9('0x1e')][_0x0ac9('0x21')]);}else{logger['info'](_0x0ac9('0x20'),_0x304a36,_0x0ac9('0x1b'));_0x507c61(_0x5c0ec4['result'][_0x0ac9('0x21')]);}})[_0x0ac9('0x22')](function(_0x3c51d4){logger[_0x0ac9('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0x304a36,_0x3c51d4);_0x3e4bbf(_0x3c51d4);});});}function respondWithStatusCode(_0x3fe707,_0x442cf6){_0x442cf6=_0x442cf6||0xcc;return function(_0x5637f6){if(_0x5637f6){return _0x3fe707[_0x0ac9('0x23')](_0x442cf6);}return _0x3fe707['status'](_0x442cf6)[_0x0ac9('0x24')]();};}function respondWithResult(_0x511c26,_0x1b3261){_0x1b3261=_0x1b3261||0xc8;return function(_0x299fad){if(_0x299fad){return _0x511c26[_0x0ac9('0x25')](_0x1b3261)['json'](_0x299fad);}};}function respondWithFilteredResult(_0x4bbd9c,_0xfca99a){return function(_0x4f56b1){if(_0x4f56b1){var _0x1b6337=typeof _0xfca99a['offset']===_0x0ac9('0x26')&&typeof _0xfca99a[_0x0ac9('0x27')]===_0x0ac9('0x26');var _0x233b2f=_0x4f56b1['count'];var _0x56f05b=_0x1b6337?0x0:_0xfca99a['offset'];var _0x15d8f3=_0x1b6337?_0x4f56b1[_0x0ac9('0x28')]:_0xfca99a[_0x0ac9('0x29')]+_0xfca99a[_0x0ac9('0x27')];var _0x480c2a;if(_0x15d8f3>=_0x233b2f){_0x15d8f3=_0x233b2f;_0x480c2a=0xc8;}else{_0x480c2a=0xce;}_0x4bbd9c[_0x0ac9('0x25')](_0x480c2a);return _0x4bbd9c[_0x0ac9('0x2a')](_0x0ac9('0x2b'),_0x56f05b+'-'+_0x15d8f3+'/'+_0x233b2f)[_0x0ac9('0x2c')](_0x4f56b1);}return null;};}function saveUpdates(_0x171ec5){return function(_0x39e85e){if(_0x39e85e){return _0x39e85e[_0x0ac9('0x2d')](_0x171ec5)['then'](function(_0x26a65b){return _0x26a65b;});}return null;};}function removeEntity(_0x3e65ac){return function(_0x1a7ef5){if(_0x1a7ef5){return _0x1a7ef5[_0x0ac9('0x2e')]()[_0x0ac9('0x2f')](function(){var _0x23cc75=_0x1a7ef5[_0x0ac9('0x30')]({'plain':!![]});var _0x5e5be9=_0x0ac9('0x31');return db[_0x0ac9('0x32')][_0x0ac9('0x2e')]({'where':{'type':_0x5e5be9,'resourceId':_0x23cc75['id']}})[_0x0ac9('0x2f')](function(){return _0x1a7ef5;});})[_0x0ac9('0x2f')](function(){_0x3e65ac[_0x0ac9('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d8ae5){return function(_0xc3a8be){if(!_0xc3a8be){_0x3d8ae5[_0x0ac9('0x23')](0x194);}return _0xc3a8be;};}function handleError(_0x48224d,_0x3c9802){_0x3c9802=_0x3c9802||0x1f4;return function(_0x241bc3){logger[_0x0ac9('0x1e')](_0x241bc3['stack']);if(_0x241bc3[_0x0ac9('0x33')]){delete _0x241bc3[_0x0ac9('0x33')];}_0x48224d[_0x0ac9('0x25')](_0x3c9802)[_0x0ac9('0x34')](_0x241bc3);};}function createInteractionObject(_0x48a712,_0xb203ea,_0x4aa74a,_0x2272fe){var _0x2c46dd=require('user-agent-parser');var _0x1fd6f0=new _0x2c46dd();var _0x49dddf=_0x1fd6f0[_0x0ac9('0x35')](_0x4aa74a[_0x0ac9('0x36')])[_0x0ac9('0x37')]();var _0x286d88=_0xb203ea[_0x0ac9('0x38')];if(_0x4aa74a[_0x0ac9('0x39')]){_0x286d88=_0x4aa74a[_0x0ac9('0x39')];}else if(_0x4aa74a['x-forwarded-for']){_0x286d88=_[_0x0ac9('0x3a')](_0x4aa74a['x-forwarded-for']['split'](','));}return{'ContactId':_0x2272fe['id'],'ChatWebsiteId':_0x48a712,'from':(_0x2272fe[_0x0ac9('0x3b')]||'')+'\x20'+(_0x2272fe['lastName']||''),'customerIp':_0x286d88,'customerPort':_0x4aa74a['x-real-port']?_0x4aa74a[_0x0ac9('0x3c')]:null,'referer':_0xb203ea[_0x0ac9('0x3d')],'browserName':_0x49dddf[_0x0ac9('0x3e')][_0x0ac9('0x33')]&&_0x49dddf['browser'][_0x0ac9('0x3f')]?util[_0x0ac9('0x40')](_0x0ac9('0x41'),_0x49dddf[_0x0ac9('0x3e')]['name'],_0x49dddf['browser'][_0x0ac9('0x3f')]):_0x0ac9('0x42'),'browserVersion':_0x49dddf[_0x0ac9('0x3e')][_0x0ac9('0x3f')]||_0x0ac9('0x42'),'osName':util[_0x0ac9('0x40')](_0x0ac9('0x41'),_0x49dddf['os'][_0x0ac9('0x33')],_0x49dddf['os'][_0x0ac9('0x3f')]),'osVersion':_0x49dddf['os']['version'],'deviceModel':_0x49dddf[_0x0ac9('0x43')][_0x0ac9('0x44')]&&_0x49dddf['device'][_0x0ac9('0x45')]?util[_0x0ac9('0x40')](_0x0ac9('0x46'),_0x49dddf[_0x0ac9('0x43')][_0x0ac9('0x44')],_0x49dddf[_0x0ac9('0x43')][_0x0ac9('0x45')],_0x49dddf[_0x0ac9('0x43')][_0x0ac9('0x47')]):null,'deviceVendor':_0x49dddf[_0x0ac9('0x43')][_0x0ac9('0x45')],'deviceType':_0x49dddf[_0x0ac9('0x43')]['type'],'formData':JSON[_0x0ac9('0x48')](_0xb203ea)};}exports['index']=function(_0x5644ae,_0x199f0a){var _0x52fec9={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x353fa4={},_0xa218c4={'count':0x0,'rows':[]};var _0x197af5=_[_0x0ac9('0x49')](db[_0x0ac9('0x4a')]['rawAttributes'],function(_0x2eeefc){return{'name':_0x2eeefc['fieldName'],'type':_0x2eeefc[_0x0ac9('0x47')]['key']};});_0x353fa4[_0x0ac9('0x44')]=_['map'](_0x197af5,_0x0ac9('0x33'));_0x353fa4['query']=_[_0x0ac9('0x4b')](_0x5644ae[_0x0ac9('0x4c')]);_0x353fa4[_0x0ac9('0x4d')]=_['intersection'](_0x353fa4[_0x0ac9('0x44')],_0x353fa4['query']);_0x52fec9[_0x0ac9('0x4e')]=_[_0x0ac9('0x4f')](_0x353fa4[_0x0ac9('0x44')],qs[_0x0ac9('0x50')](_0x5644ae['query'][_0x0ac9('0x50')]));_0x52fec9[_0x0ac9('0x4e')]=_0x52fec9[_0x0ac9('0x4e')][_0x0ac9('0x51')]?_0x52fec9['attributes']:_0x353fa4['model'];if(!_0x5644ae[_0x0ac9('0x4c')][_0x0ac9('0x52')](_0x0ac9('0x53'))){_0x52fec9[_0x0ac9('0x27')]=qs[_0x0ac9('0x27')](_0x5644ae[_0x0ac9('0x4c')][_0x0ac9('0x27')]);_0x52fec9[_0x0ac9('0x29')]=qs['offset'](_0x5644ae[_0x0ac9('0x4c')][_0x0ac9('0x29')]);}_0x52fec9[_0x0ac9('0x54')]=qs[_0x0ac9('0x55')](_0x5644ae['query']['sort']);_0x52fec9[_0x0ac9('0x56')]=qs[_0x0ac9('0x4d')](_['pick'](_0x5644ae[_0x0ac9('0x4c')],_0x353fa4[_0x0ac9('0x4d')]),_0x197af5);if(_0x5644ae['query'][_0x0ac9('0x57')]){_0x52fec9[_0x0ac9('0x56')]=_[_0x0ac9('0x58')](_0x52fec9[_0x0ac9('0x56')],{'$or':_[_0x0ac9('0x49')](_0x197af5,function(_0x4f854e){if(_0x4f854e['type']!==_0x0ac9('0x59')){var _0x2f5fa0={};_0x2f5fa0[_0x4f854e[_0x0ac9('0x33')]]={'$like':'%'+_0x5644ae['query'][_0x0ac9('0x57')]+'%'};return _0x2f5fa0;}})});}_0x52fec9=_[_0x0ac9('0x58')]({},_0x52fec9,_0x5644ae[_0x0ac9('0x5a')]);var _0xeae0a4={'where':_0x52fec9['where']};return db[_0x0ac9('0x4a')][_0x0ac9('0x28')](_0xeae0a4)[_0x0ac9('0x2f')](function(_0x24b457){_0xa218c4[_0x0ac9('0x28')]=_0x24b457;if(_0x5644ae[_0x0ac9('0x4c')][_0x0ac9('0x5b')]){_0x52fec9[_0x0ac9('0x5c')]=[{'all':!![]}];}return db['ChatWebsite'][_0x0ac9('0x5d')](_0x52fec9);})['then'](function(_0x2f2792){_0xa218c4[_0x0ac9('0x5e')]=_0x2f2792;return _0xa218c4;})[_0x0ac9('0x2f')](respondWithFilteredResult(_0x199f0a,_0x52fec9))[_0x0ac9('0x22')](handleError(_0x199f0a,null));};exports[_0x0ac9('0x5f')]=function(_0x2d02db,_0x49c06a){var _0x42d1b0={'raw':![],'where':{'id':_0x2d02db[_0x0ac9('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0x0ac9('0x61')}]},_0xf92f8c={};_0xf92f8c[_0x0ac9('0x44')]=_['keys'](db[_0x0ac9('0x4a')][_0x0ac9('0x62')]);_0xf92f8c['query']=_[_0x0ac9('0x4b')](_0x2d02db[_0x0ac9('0x4c')]);_0xf92f8c[_0x0ac9('0x4d')]=_['intersection'](_0xf92f8c[_0x0ac9('0x44')],_0xf92f8c[_0x0ac9('0x4c')]);_0x42d1b0['attributes']=_[_0x0ac9('0x4f')](_0xf92f8c['model'],qs[_0x0ac9('0x50')](_0x2d02db['query'][_0x0ac9('0x50')]));_0x42d1b0['attributes']=_0x42d1b0[_0x0ac9('0x4e')][_0x0ac9('0x51')]?_0x42d1b0[_0x0ac9('0x4e')]:_0xf92f8c['model'];if(_0x2d02db['query'][_0x0ac9('0x5b')]){_0x42d1b0[_0x0ac9('0x5c')]=[{'all':!![]}];}_0x42d1b0=_[_0x0ac9('0x58')]({},_0x42d1b0,_0x2d02db[_0x0ac9('0x5a')]);return db[_0x0ac9('0x4a')][_0x0ac9('0x63')](_0x42d1b0)[_0x0ac9('0x2f')](handleEntityNotFound(_0x49c06a,null))['then'](respondWithResult(_0x49c06a,null))['catch'](handleError(_0x49c06a,null));};exports[_0x0ac9('0x64')]=function(_0x2667e7,_0x1c273d){var _0xb7e948=null;_0x2667e7[_0x0ac9('0x65')][_0x0ac9('0x66')][_0x0ac9('0x67')](',')['forEach'](_0x10aa6f=>{if(_0x10aa6f[_0x0ac9('0x68')]()!==''&&!wildcardUtils[_0x0ac9('0x69')](_0x10aa6f[_0x0ac9('0x68')]())){_0xb7e948=new APIBadRequestError('\x22'+_0x10aa6f[_0x0ac9('0x68')]()+_0x0ac9('0x6a'));}});if(_0xb7e948){return handleError(_0x1c273d,null)(_0xb7e948);}return db[_0x0ac9('0x4a')]['create'](_0x2667e7[_0x0ac9('0x65')],{})[_0x0ac9('0x2f')](function(_0x4d5440){var _0xbcbc64=_0x2667e7[_0x0ac9('0x6b')][_0x0ac9('0x30')]({'plain':!![]});if(!_0xbcbc64)throw new Error(_0x0ac9('0x6c'));if(_0xbcbc64[_0x0ac9('0x6d')]===_0x0ac9('0x6b')){var _0x565418=_0x4d5440[_0x0ac9('0x30')]({'plain':!![]});var _0x23c4ac='ChatWebsites';return db[_0x0ac9('0x6e')][_0x0ac9('0x63')]({'where':{'name':_0x23c4ac,'userProfileId':_0xbcbc64[_0x0ac9('0x6f')]},'raw':!![]})[_0x0ac9('0x2f')](function(_0x725b79){if(_0x725b79&&_0x725b79['autoAssociation']===0x0){return db[_0x0ac9('0x32')][_0x0ac9('0x64')]({'name':_0x565418[_0x0ac9('0x33')],'resourceId':_0x565418['id'],'type':_0x725b79[_0x0ac9('0x33')],'sectionId':_0x725b79['id']},{})['then'](function(){return _0x4d5440;});}else{return _0x4d5440;}})[_0x0ac9('0x22')](function(_0x2ec639){logger[_0x0ac9('0x1e')](_0x0ac9('0x70'),_0x2ec639);throw _0x2ec639;});}return _0x4d5440;})[_0x0ac9('0x2f')](respondWithResult(_0x1c273d,0xc9))[_0x0ac9('0x22')](handleError(_0x1c273d,null));};exports[_0x0ac9('0x2d')]=function(_0x4f7b89,_0x445d06){var _0x71876c=null;_0x4f7b89[_0x0ac9('0x65')][_0x0ac9('0x66')]['split'](',')[_0x0ac9('0x71')](_0x122f5e=>{if(_0x122f5e['trim']()!==''&&!wildcardUtils[_0x0ac9('0x69')](_0x122f5e[_0x0ac9('0x68')]())){_0x71876c=new APIBadRequestError('\x22'+_0x122f5e[_0x0ac9('0x68')]()+_0x0ac9('0x6a'));}});if(_0x71876c){return handleError(_0x445d06,null)(_0x71876c);}if(_0x4f7b89['body']['id']){delete _0x4f7b89['body']['id'];}return db[_0x0ac9('0x4a')][_0x0ac9('0x63')]({'where':{'id':_0x4f7b89[_0x0ac9('0x60')]['id']},'include':[{'model':db[_0x0ac9('0x72')],'as':_0x0ac9('0x61')}]})['then'](handleEntityNotFound(_0x445d06,null))['then'](saveUpdates(_0x4f7b89[_0x0ac9('0x65')],null))['then'](respondWithResult(_0x445d06,null))[_0x0ac9('0x22')](handleError(_0x445d06,null));};exports[_0x0ac9('0x2e')]=function(_0x55b356,_0x59303d){return db[_0x0ac9('0x4a')]['find']({'where':{'id':_0x55b356[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x59303d,null))['then'](removeEntity(_0x59303d,null))[_0x0ac9('0x22')](handleError(_0x59303d,null));};exports['describe']=function(_0x28fb30,_0x212719){return db[_0x0ac9('0x4a')][_0x0ac9('0x73')]()[_0x0ac9('0x2f')](respondWithResult(_0x212719,null))[_0x0ac9('0x22')](handleError(_0x212719,null));};exports[_0x0ac9('0x74')]=function(_0xe5b19c,_0x3df98d){if(_0xe5b19c[_0x0ac9('0x65')]['id']){delete _0xe5b19c[_0x0ac9('0x65')]['id'];}return db['ChatWebsite'][_0x0ac9('0x63')]({'where':{'id':_0xe5b19c[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x3df98d,null))[_0x0ac9('0x2f')](function(_0x70540f){if(_0x70540f){_0xe5b19c[_0x0ac9('0x65')][_0x0ac9('0x75')]=_0x70540f['id'];return db[_0x0ac9('0x76')][_0x0ac9('0x64')](_0xe5b19c[_0x0ac9('0x65')]);}})['then'](respondWithResult(_0x3df98d,null))[_0x0ac9('0x22')](handleError(_0x3df98d,null));};exports[_0x0ac9('0x77')]=function(_0x5659d2,_0x4f497d){var _0x2323af={'raw':![],'where':{}};var _0x350de4={};var _0x387f04={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0ac9('0x78')]({'where':{'id':_0x5659d2[_0x0ac9('0x60')]['id']}})['then'](handleEntityNotFound(_0x4f497d,null))['then'](function(_0x11ac1a){if(_0x11ac1a){_0x350de4[_0x0ac9('0x44')]=_[_0x0ac9('0x4b')](db[_0x0ac9('0x76')][_0x0ac9('0x62')]);_0x350de4['query']=_[_0x0ac9('0x4b')](_0x5659d2[_0x0ac9('0x4c')]);_0x350de4['filters']=_[_0x0ac9('0x4f')](_0x350de4['model'],_0x350de4[_0x0ac9('0x4c')]);_0x2323af['attributes']=_['intersection'](_0x350de4[_0x0ac9('0x44')],qs['fields'](_0x5659d2[_0x0ac9('0x4c')][_0x0ac9('0x50')]));_0x2323af[_0x0ac9('0x4e')]=_0x2323af[_0x0ac9('0x4e')][_0x0ac9('0x51')]?_0x2323af['attributes']:_0x350de4[_0x0ac9('0x44')];if(!_0x5659d2['query'][_0x0ac9('0x52')]('nolimit')){_0x2323af[_0x0ac9('0x27')]=qs[_0x0ac9('0x27')](_0x5659d2['query'][_0x0ac9('0x27')]);_0x2323af[_0x0ac9('0x29')]=qs[_0x0ac9('0x29')](_0x5659d2[_0x0ac9('0x4c')][_0x0ac9('0x29')]);}_0x2323af['order']=qs['sort'](_0x5659d2['query']['sort']);_0x2323af[_0x0ac9('0x56')]=qs[_0x0ac9('0x4d')](_['pick'](_0x5659d2[_0x0ac9('0x4c')],_0x350de4[_0x0ac9('0x4d')]));_0x2323af[_0x0ac9('0x56')][_0x0ac9('0x75')]=_0x11ac1a['id'];if(_0x5659d2['query']['filter']){_0x2323af['where']=_[_0x0ac9('0x58')](_0x2323af[_0x0ac9('0x56')],{'$or':_[_0x0ac9('0x49')](_0x2323af['attributes'],function(_0x5b1d3d){var _0x516cc8={};_0x516cc8[_0x5b1d3d]={'$like':'%'+_0x5659d2[_0x0ac9('0x4c')]['filter']+'%'};return _0x516cc8;})});}_0x2323af=_['merge']({},_0x2323af,_0x5659d2['options']);return db['Disposition'][_0x0ac9('0x28')]({'where':_0x2323af[_0x0ac9('0x56')]})[_0x0ac9('0x2f')](function(_0x5cdfdd){_0x387f04[_0x0ac9('0x28')]=_0x5cdfdd;if(_0x5659d2['query']['includeAll']){_0x2323af[_0x0ac9('0x5c')]=[{'all':!![]}];}return db[_0x0ac9('0x76')]['findAll'](_0x2323af);})['then'](function(_0x22fd1c){_0x387f04[_0x0ac9('0x5e')]=_0x22fd1c;return _0x387f04;});}})['then'](respondWithFilteredResult(_0x4f497d,_0x2323af))['catch'](handleError(_0x4f497d,null));};exports[_0x0ac9('0x79')]=function(_0x4aebc4,_0x1454bf){return db[_0x0ac9('0x4a')]['find']({'where':{'id':_0x4aebc4[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x1454bf,null))[_0x0ac9('0x2f')](function(_0x137a05){if(_0x137a05){return _0x137a05[_0x0ac9('0x79')](_0x4aebc4['query'][_0x0ac9('0x7a')]);}})[_0x0ac9('0x2f')](respondWithStatusCode(_0x1454bf,null))['catch'](handleError(_0x1454bf,null));};exports[_0x0ac9('0x7b')]=function(_0x13230f,_0x40aee7){if(_0x13230f[_0x0ac9('0x65')]['id']){delete _0x13230f[_0x0ac9('0x65')]['id'];}return db[_0x0ac9('0x4a')][_0x0ac9('0x63')]({'where':{'id':_0x13230f['params']['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x40aee7,null))[_0x0ac9('0x2f')](function(_0x293205){if(_0x293205){_0x13230f[_0x0ac9('0x65')][_0x0ac9('0x75')]=_0x293205['id'];return db[_0x0ac9('0x7c')][_0x0ac9('0x64')](_0x13230f[_0x0ac9('0x65')]);}})[_0x0ac9('0x2f')](respondWithResult(_0x40aee7,null))[_0x0ac9('0x22')](handleError(_0x40aee7,null));};exports[_0x0ac9('0x7d')]=function(_0x1d01a9,_0x3382e8){var _0x15b11b={'raw':![],'where':{}};var _0x64ade4={};var _0x4d5d55={'count':0x0,'rows':[]};return db[_0x0ac9('0x4a')]['findOne']({'where':{'id':_0x1d01a9[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x3382e8,null))[_0x0ac9('0x2f')](function(_0x1294c1){if(_0x1294c1){_0x64ade4[_0x0ac9('0x44')]=_[_0x0ac9('0x4b')](db['CannedAnswer'][_0x0ac9('0x62')]);_0x64ade4[_0x0ac9('0x4c')]=_[_0x0ac9('0x4b')](_0x1d01a9[_0x0ac9('0x4c')]);_0x64ade4[_0x0ac9('0x4d')]=_[_0x0ac9('0x4f')](_0x64ade4['model'],_0x64ade4[_0x0ac9('0x4c')]);_0x15b11b[_0x0ac9('0x4e')]=_[_0x0ac9('0x4f')](_0x64ade4[_0x0ac9('0x44')],qs[_0x0ac9('0x50')](_0x1d01a9[_0x0ac9('0x4c')][_0x0ac9('0x50')]));_0x15b11b['attributes']=_0x15b11b[_0x0ac9('0x4e')]['length']?_0x15b11b[_0x0ac9('0x4e')]:_0x64ade4[_0x0ac9('0x44')];if(!_0x1d01a9[_0x0ac9('0x4c')][_0x0ac9('0x52')]('nolimit')){_0x15b11b[_0x0ac9('0x27')]=qs[_0x0ac9('0x27')](_0x1d01a9['query']['limit']);_0x15b11b[_0x0ac9('0x29')]=qs['offset'](_0x1d01a9[_0x0ac9('0x4c')][_0x0ac9('0x29')]);}_0x15b11b[_0x0ac9('0x54')]=qs[_0x0ac9('0x55')](_0x1d01a9[_0x0ac9('0x4c')][_0x0ac9('0x55')]);_0x15b11b[_0x0ac9('0x56')]=qs[_0x0ac9('0x4d')](_[_0x0ac9('0x7e')](_0x1d01a9[_0x0ac9('0x4c')],_0x64ade4['filters']));_0x15b11b[_0x0ac9('0x56')][_0x0ac9('0x75')]=_0x1294c1['id'];if(_0x1d01a9[_0x0ac9('0x4c')]['filter']){_0x15b11b[_0x0ac9('0x56')]=_['merge'](_0x15b11b['where'],{'$or':_[_0x0ac9('0x49')](_0x15b11b[_0x0ac9('0x4e')],function(_0x41e68f){var _0x52404b={};_0x52404b[_0x41e68f]={'$like':'%'+_0x1d01a9[_0x0ac9('0x4c')][_0x0ac9('0x57')]+'%'};return _0x52404b;})});}_0x15b11b=_[_0x0ac9('0x58')]({},_0x15b11b,_0x1d01a9[_0x0ac9('0x5a')]);return db['CannedAnswer'][_0x0ac9('0x28')]({'where':_0x15b11b[_0x0ac9('0x56')]})['then'](function(_0x3dfcf9){_0x4d5d55['count']=_0x3dfcf9;if(_0x1d01a9[_0x0ac9('0x4c')]['includeAll']){_0x15b11b[_0x0ac9('0x5c')]=[{'all':!![]}];}return db[_0x0ac9('0x7c')][_0x0ac9('0x5d')](_0x15b11b);})[_0x0ac9('0x2f')](function(_0x4872f9){_0x4d5d55[_0x0ac9('0x5e')]=_0x4872f9;return _0x4d5d55;});}})[_0x0ac9('0x2f')](respondWithFilteredResult(_0x3382e8,_0x15b11b))['catch'](handleError(_0x3382e8,null));};exports[_0x0ac9('0x7f')]=function(_0x5e5b6b,_0x5bc01e){return db[_0x0ac9('0x4a')][_0x0ac9('0x63')]({'where':{'id':_0x5e5b6b[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x5bc01e,null))['then'](function(_0x5aa162){if(_0x5aa162){return _0x5aa162[_0x0ac9('0x7f')](_0x5e5b6b[_0x0ac9('0x4c')][_0x0ac9('0x7a')]);}})[_0x0ac9('0x2f')](respondWithStatusCode(_0x5bc01e,null))[_0x0ac9('0x22')](handleError(_0x5bc01e,null));};exports[_0x0ac9('0x80')]=function(_0x43cee3,_0x357810){_0x43cee3[_0x0ac9('0x65')]['sitepic']=_0x43cee3[_0x0ac9('0x81')][_0x0ac9('0x82')];return db[_0x0ac9('0x4a')]['find']({'where':{'id':_0x43cee3['params']['id']}})['then'](handleEntityNotFound(_0x357810,null))[_0x0ac9('0x2f')](saveUpdates(_0x43cee3['body'],null))[_0x0ac9('0x2f')](respondWithResult(_0x357810,null))[_0x0ac9('0x22')](handleError(_0x357810,null));};exports[_0x0ac9('0x83')]=function(_0x26fc04,_0x29e198){_0x26fc04[_0x0ac9('0x65')][_0x0ac9('0x84')]=_0x26fc04[_0x0ac9('0x81')]['filename'];return db[_0x0ac9('0x4a')][_0x0ac9('0x63')]({'where':{'id':_0x26fc04[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x29e198,null))['then'](saveUpdates(_0x26fc04['body'],null))[_0x0ac9('0x2f')](respondWithResult(_0x29e198,null))[_0x0ac9('0x22')](handleError(_0x29e198,null));};exports[_0x0ac9('0x85')]=function(_0x2cedfd,_0x4b7a6e){_0x2cedfd['body'][_0x0ac9('0x86')]=_0x2cedfd[_0x0ac9('0x81')]['filename'];return db[_0x0ac9('0x4a')][_0x0ac9('0x63')]({'where':{'id':_0x2cedfd[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x4b7a6e,null))['then'](saveUpdates(_0x2cedfd['body'],null))['then'](respondWithResult(_0x4b7a6e,null))[_0x0ac9('0x22')](handleError(_0x4b7a6e,null));};exports[_0x0ac9('0x87')]=function(_0x57a73c,_0x4665c3){_0x57a73c[_0x0ac9('0x65')][_0x0ac9('0x88')]=_0x57a73c[_0x0ac9('0x81')][_0x0ac9('0x82')];return db[_0x0ac9('0x4a')][_0x0ac9('0x63')]({'where':{'id':_0x57a73c[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x4665c3,null))[_0x0ac9('0x2f')](saveUpdates(_0x57a73c[_0x0ac9('0x65')],null))[_0x0ac9('0x2f')](respondWithResult(_0x4665c3,null))[_0x0ac9('0x22')](handleError(_0x4665c3,null));};exports[_0x0ac9('0x89')]=function(_0x84b61,_0x5da18f){var _0x1a819a=path[_0x0ac9('0x8a')](config[_0x0ac9('0x8b')],_0x0ac9('0x8c'));var _0x434c85={'where':{'id':_0x84b61[_0x0ac9('0x60')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x46c97f=![];return require(_0x0ac9('0x8d'))[_0x0ac9('0x8e')]()['then'](function(_0x3d1d25){if(_0x3d1d25){_0x46c97f=_0x3d1d25[_0x0ac9('0x8f')];}})['then'](function(){return db[_0x0ac9('0x4a')]['find'](_0x434c85);})[_0x0ac9('0x2f')](handleEntityNotFound(_0x5da18f,null))[_0x0ac9('0x2f')](function(_0x379b47){if(_0x379b47){if(!_['isNil'](_0x379b47[_0x0ac9('0x90')])){if(fs[_0x0ac9('0x91')](path['join'](config[_0x0ac9('0x8b')],_0x0ac9('0x92'),_0x379b47[_0x0ac9('0x90')]))&&_0x46c97f){_0x1a819a=path[_0x0ac9('0x8a')](config[_0x0ac9('0x8b')],_0x0ac9('0x92'),_0x379b47[_0x0ac9('0x90')]);}}return _0x5da18f[_0x0ac9('0x93')](_0x1a819a);}})[_0x0ac9('0x22')](handleError(_0x5da18f,null));};exports['getAvatar']=function(_0x37d045,_0x549882){var _0x4a39ed=path[_0x0ac9('0x8a')](config[_0x0ac9('0x8b')],_0x0ac9('0x94'));var _0x7775e9={'where':{'id':_0x37d045[_0x0ac9('0x60')]['id']},'attributes':['id',_0x0ac9('0x84')],'raw':!![]};return db[_0x0ac9('0x4a')][_0x0ac9('0x63')](_0x7775e9)['then'](handleEntityNotFound(_0x549882,null))[_0x0ac9('0x2f')](function(_0x30411c){if(_0x30411c){if(!_['isNil'](_0x30411c[_0x0ac9('0x84')])){if(fs[_0x0ac9('0x91')](path[_0x0ac9('0x8a')](config['root'],'server/files/images/avatars/',_0x30411c[_0x0ac9('0x84')]))){_0x4a39ed=path['join'](config[_0x0ac9('0x8b')],_0x0ac9('0x95'),_0x30411c[_0x0ac9('0x84')]);}}return _0x549882[_0x0ac9('0x93')](_0x4a39ed);}})[_0x0ac9('0x22')](handleError(_0x549882,null));};exports[_0x0ac9('0x96')]=function(_0x1bef79,_0x2e0e27){var _0x5827c5=path[_0x0ac9('0x8a')](config[_0x0ac9('0x8b')],_0x0ac9('0x97'));var _0x1b8f4e={'where':{'id':_0x1bef79[_0x0ac9('0x60')]['id']},'attributes':['id',_0x0ac9('0x86'),'showCustomerAvatar'],'raw':!![]};return db[_0x0ac9('0x4a')][_0x0ac9('0x63')](_0x1b8f4e)[_0x0ac9('0x2f')](handleEntityNotFound(_0x2e0e27,null))[_0x0ac9('0x2f')](function(_0x4e2c29){if(_0x4e2c29){if(!_[_0x0ac9('0x98')](_0x4e2c29['customerAvatar'])){if(fs['existsSync'](path['join'](config['root'],_0x0ac9('0x95'),_0x4e2c29['customerAvatar']))&&_0x4e2c29[_0x0ac9('0x99')]){_0x5827c5=path['join'](config[_0x0ac9('0x8b')],_0x0ac9('0x95'),_0x4e2c29[_0x0ac9('0x86')]);}}return _0x2e0e27[_0x0ac9('0x93')](_0x5827c5);}})[_0x0ac9('0x22')](handleError(_0x2e0e27,null));};exports['getSystemAvatar']=function(_0x38e76,_0x109152){var _0x6e2cd4=path['join'](config['root'],'server/files/images/avatars/system_avatar.png');var _0xca0da={'where':{'id':_0x38e76[_0x0ac9('0x60')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x0ac9('0x4a')]['find'](_0xca0da)[_0x0ac9('0x2f')](handleEntityNotFound(_0x109152,null))[_0x0ac9('0x2f')](function(_0x4026d3){if(_0x4026d3){if(!_['isNil'](_0x4026d3[_0x0ac9('0x88')])){if(fs['existsSync'](path[_0x0ac9('0x8a')](config[_0x0ac9('0x8b')],'server/files/images/avatars/',_0x4026d3[_0x0ac9('0x88')]))){_0x6e2cd4=path['join'](config[_0x0ac9('0x8b')],_0x0ac9('0x95'),_0x4026d3[_0x0ac9('0x88')]);}}return _0x109152[_0x0ac9('0x93')](_0x6e2cd4);}})[_0x0ac9('0x22')](handleError(_0x109152,null));};function checkWebsiteInterval(_0x3d54c1){var _0x291cd7=_0x3d54c1[_0x0ac9('0x9a')];if(!_0x291cd7){return Promise[_0x0ac9('0x9b')](_0x3d54c1);}var _0x45b232=_0x3d54c1[_0x0ac9('0x9c')]||undefined;return _0x291cd7[_0x0ac9('0x9d')](_0x45b232)[_0x0ac9('0x2f')](function(_0x274c07){if(!_0x274c07){throw new APIOutOfIntervalError();}return _0x3d54c1;});}exports[_0x0ac9('0x9e')]=function(_0x5033f0,_0x53c1a9){var _0x2048c0={'body':_0x5033f0['body'],'channel':'chat'};var _0x14270f=[];var _0xd48691=[];var _0x33459d={};var _0x1b2292=![];if(_0x5033f0['body']['id']){delete _0x5033f0[_0x0ac9('0x65')]['id'];}if(_[_0x0ac9('0x98')](_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0x9f')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x0ac9('0x98')](_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xa0')])){throw new APIBadRequestError(_0x0ac9('0xa1'));}if(_[_0x0ac9('0xa2')](_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0x65')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x44b69c=_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0x38')]&&_0x5033f0[_0x0ac9('0x65')]['referer'];return db[_0x0ac9('0xa3')][_0x0ac9('0x73')]()[_0x0ac9('0x2f')](function(_0x516b24){if(!_0x516b24){throw new Error(_0x0ac9('0xa4'));}_0x14270f=Object[_0x0ac9('0x4b')](_0x516b24)['filter'](function(_0x28eb72){return![_0x0ac9('0xa5'),_0x0ac9('0xa6')][_0x0ac9('0xa7')](_0x28eb72);});_0xd48691=Object[_0x0ac9('0x4b')](_0x516b24)[_0x0ac9('0x57')](function(_0x4b280b){return!['createdAt',_0x0ac9('0xa6'),_0x0ac9('0xa8'),_0x0ac9('0xa9')]['includes'](_0x4b280b);});if(!_['includes'](_0xd48691,_0x5033f0[_0x0ac9('0x65')]['mapKey'])){throw new APIBadRequestError(_0x0ac9('0xaa')+_0xd48691[_0x0ac9('0x8a')](',\x20'));}_0x33459d[_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xa0')]]=_0x5033f0['body'][_0x0ac9('0x9f')];})[_0x0ac9('0x2f')](function(){return db[_0x0ac9('0x4a')][_0x0ac9('0x63')]({'where':{'id':_0x5033f0[_0x0ac9('0x60')]['id']},'include':[{'model':db[_0x0ac9('0xab')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0ac9('0xac'),'where':_0x33459d,'limit':0x1,'order':[[_0x0ac9('0xa6'),_0x0ac9('0xad')]]}]},{'model':db['ChatApplication'],'as':_0x0ac9('0xae')},{'model':db[_0x0ac9('0x9a')],'as':_0x0ac9('0x9a'),'include':[{'model':db[_0x0ac9('0x9a')],'as':'Intervals','attributes':['id',_0x0ac9('0xaf')],'raw':!![]}]}]});})[_0x0ac9('0x2f')](function(_0x5d07ac){if(!_0x5d07ac){throw new APINotFoundError(util[_0x0ac9('0x40')](_0x0ac9('0xb0'),_0x5033f0[_0x0ac9('0x60')]['id']));}if(_0x44b69c){return checkWebsiteInterval(_0x5d07ac);}return _0x5d07ac;})[_0x0ac9('0x2f')](function(_0x2f956c){_0x2048c0[_0x0ac9('0xb1')]=_0x2f956c;_0x2048c0[_0x0ac9('0xb2')]=_[_0x0ac9('0xb3')](_0x2f956c[_0x0ac9('0xae')],[_0x0ac9('0xb4')],[_0x0ac9('0xb5')]);if(_0x2048c0[_0x0ac9('0xb1')][_0x0ac9('0xae')]){delete _0x2048c0[_0x0ac9('0xb1')]['Applications'];}_0x2048c0['list']=_0x2f956c[_0x0ac9('0xb6')]||{'id':_0x2f956c['ListId']};if(_0x2048c0[_0x0ac9('0xb7')]&&_0x2048c0[_0x0ac9('0xb7')][_0x0ac9('0xac')][_0x0ac9('0x51')]){return _0x2048c0[_0x0ac9('0xb7')]['Contacts'][0x0];}var _0x30e848=_[_0x0ac9('0x15')](_0x5033f0[_0x0ac9('0x65')],{'firstName':_0x5033f0[_0x0ac9('0x65')]['from'],'ListId':_0x2f956c[_0x0ac9('0xa9')]});_0x30e848[_0x5033f0['body'][_0x0ac9('0xa0')]]=_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0x9f')];return db[_0x0ac9('0xa3')][_0x0ac9('0x64')](_0x30e848,{'fields':_0x14270f,'raw':!![]});})[_0x0ac9('0x2f')](function(_0x3545e0){_0x2048c0[_0x0ac9('0xb8')]=_0x3545e0;var _0x31b1df=createInteractionObject(_0x5033f0['params']['id'],_0x5033f0[_0x0ac9('0x65')],_0x5033f0[_0x0ac9('0xb9')],_0x3545e0);var _0x509bb3={'ChatWebsiteId':_0x5033f0[_0x0ac9('0x60')]['id']};if(_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xba')]){_0x509bb3['threadId']=_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xba')];_0x509bb3[_0x0ac9('0xbb')]=![];return db[_0x0ac9('0xbc')][_0x0ac9('0x63')]({'where':_0x509bb3})['then'](function(_0x1cbb69){var _0x2f6e5b=_0x5033f0[_0x0ac9('0x65')]['customerIp']&&_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0x3d')];if(_0x1cbb69){_0x1b2292=!![];return _0x1cbb69;}else if(!_0x2f6e5b&&_0x1cbb69&&_0x1cbb69['closed']){throw new APIConflictError(_0x0ac9('0xbd'));}_0x31b1df[_0x0ac9('0xba')]=_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xba')];_0x31b1df[_0x0ac9('0xbe')]=_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xbe')];return db[_0x0ac9('0xbc')][_0x0ac9('0x64')](_0x31b1df);});}_0x509bb3[_0x0ac9('0xbf')]=_0x3545e0['id'];if(_0x5033f0['body'][_0x0ac9('0xc0')]&&_0x5033f0['body'][_0x0ac9('0xc0')]['id']){_0x509bb3['id']=_0x5033f0[_0x0ac9('0x65')]['interaction']['id'];return db['ChatInteraction']['find']({'where':_0x509bb3})[_0x0ac9('0x2f')](function(_0x4ddc67){var _0x21665c=_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0x38')]&&_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0x3d')];if(!_0x21665c&&_0x4ddc67&&_0x4ddc67['closed']){throw new APIConflictError(_0x0ac9('0xbd'));}else if(_0x4ddc67){_0x1b2292=!![];return _0x4ddc67;}else{return db[_0x0ac9('0xbc')][_0x0ac9('0x64')](_0x31b1df);}});}return db[_0x0ac9('0xbc')][_0x0ac9('0x64')](_0x31b1df);})['then'](function(_0x30fb87){if(!_0x1b2292){return _0x30fb87;}var _0x484825={'from':(_0x2048c0[_0x0ac9('0xb8')][_0x0ac9('0x3b')]||'')+'\x20'+(_0x2048c0[_0x0ac9('0xb8')]['lastName']||'')};if(_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xba')]&&_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xc1')]&&_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xba')]!=_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xc1')]){_0x484825[_0x0ac9('0xba')]=_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xc1')];}return _0x30fb87[_0x0ac9('0x2d')](_0x484825);})[_0x0ac9('0x2f')](function(_0x5d1104){_0x2048c0[_0x0ac9('0xc0')]=_0x5d1104[_0x0ac9('0x30')]({'plain':!![]});_0x2048c0[_0x0ac9('0xc0')][_0x0ac9('0xc2')]=!_0x1b2292;if(_0x2048c0[_0x0ac9('0xc0')]['created']){if(_0x2048c0[_0x0ac9('0xb1')][_0x0ac9('0xc3')]){_0x2048c0['applications']['push']({'id':0x0,'priority':_0x2048c0[_0x0ac9('0xb2')][_0x0ac9('0x51')]+0x1,'app':_0x0ac9('0xc4'),'appdata':_0x0ac9('0xc5'),'interval':'*,*,*,*'});}}return db[_0x0ac9('0xc6')][_0x0ac9('0x64')]({'body':_0x5033f0[_0x0ac9('0x65')]['body'],'ChatWebsiteId':_0x5033f0[_0x0ac9('0x60')]['id'],'ChatInteractionId':_0x5d1104['id'],'direction':'in','ContactId':_0x2048c0[_0x0ac9('0xb8')]['id'],'AttachmentId':_0x5033f0[_0x0ac9('0x65')][_0x0ac9('0xc7')]});})[_0x0ac9('0x2f')](function(_0x428142){_0x2048c0[_0x0ac9('0x21')]=_0x428142;if(!_0x2048c0[_0x0ac9('0xc0')][_0x0ac9('0xc8')]){return;}return db[_0x0ac9('0xc9')][_0x0ac9('0x63')]({'attributes':['id',_0x0ac9('0x33')],'where':{'id':_0x2048c0['interaction'][_0x0ac9('0xc8')]}});})[_0x0ac9('0x2f')](function(_0x422f65){if(_0x422f65){_0x2048c0[_0x0ac9('0xb2')][_0x0ac9('0xca')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x422f65[_0x0ac9('0x33')]+','+(_0x2048c0[_0x0ac9('0xb1')]['waitForTheAssignedAgent']||0xa),'interval':_0x0ac9('0xcb')});_0x2048c0[_0x0ac9('0xcc')]=!![];}if(!_0x2048c0[_0x0ac9('0xc0')][_0x0ac9('0xcd')]){return;}return db[_0x0ac9('0xce')][_0x0ac9('0x63')]({'attributes':['id',_0x0ac9('0x33')],'where':{'id':_0x2048c0['interaction'][_0x0ac9('0xcd')]}});})[_0x0ac9('0x2f')](function(_0x3deca6){if(_0x3deca6){_0x2048c0[_0x0ac9('0xb2')]['unshift']({'id':0x0,'priority':0x1,'app':_0x0ac9('0xcf'),'appdata':_0x3deca6[_0x0ac9('0x33')]+','+(_0x2048c0[_0x0ac9('0xb1')][_0x0ac9('0xd0')]||0x12c),'interval':_0x0ac9('0xcb')});}return respondWithRpcPromise(_0x0ac9('0xd1'),_0x0ac9('0xd2'),_0x2048c0);})['then'](function(_0x4cf301){respondWithRpcPromise(_0x0ac9('0xd3'),_0x0ac9('0xd3'),{'event':_0x0ac9('0x9e'),'message':_0x4cf301},client9002);return _0x4cf301;})[_0x0ac9('0x2f')](respondWithResult(_0x53c1a9,null))['catch'](APIHandleError(_0x53c1a9));};exports[_0x0ac9('0xd4')]=function(_0x467756,_0x2b4bb0){var _0x40a9c7,_0x35cfe3,_0x5a9fb6;var _0x1ddd2a=[];var _0x55629a={};var _0x4fc9e2=_0x467756[_0x0ac9('0xd5')]||[];var _0x318195=[];var _0x3eb2df;return db[_0x0ac9('0xa3')]['describe']()['then'](function(_0x554b36){if(!_0x554b36){throw new db[(_0x0ac9('0xd6'))][(_0x0ac9('0xd7'))]('no\x20available\x20attributes');}_0x1ddd2a=_[_0x0ac9('0xd8')](_[_0x0ac9('0x4b')](_0x554b36),[_0x0ac9('0xa5'),_0x0ac9('0xa6'),'CompanyId',_0x0ac9('0xa9')]);if(_0x467756[_0x0ac9('0x65')]['id']){delete _0x467756[_0x0ac9('0x65')]['id'];}if(_[_0x0ac9('0x98')](_0x467756['body']['from'])){throw _0x2b4bb0[_0x0ac9('0x25')](0x1f4)['send'](new db['Sequelize'][(_0x0ac9('0xd7'))](_0x0ac9('0xd9')));}if(_['isNil'](_0x467756['body'][_0x0ac9('0x65')])||_0x467756[_0x0ac9('0x65')][_0x0ac9('0x65')]===''){throw _0x2b4bb0[_0x0ac9('0x25')](0x1f4)[_0x0ac9('0x34')](new db[(_0x0ac9('0xd6'))][(_0x0ac9('0xd7'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x467756[_0x0ac9('0x65')][_0x0ac9('0xda')])){throw _0x2b4bb0[_0x0ac9('0x25')](0x1f4)['send'](new db[(_0x0ac9('0xd6'))][(_0x0ac9('0xd7'))](_0x0ac9('0xdb')+_0x1ddd2a));}if(!_['includes'](_0x1ddd2a,_0x467756[_0x0ac9('0x65')][_0x0ac9('0xda')])){throw _0x2b4bb0[_0x0ac9('0x25')](0x1f4)[_0x0ac9('0x34')](new db['Sequelize'][(_0x0ac9('0xd7'))](_0x0ac9('0xdc')+_0x1ddd2a));}_0x55629a[_0x467756[_0x0ac9('0x65')][_0x0ac9('0xda')]]=_0x467756[_0x0ac9('0x65')][_0x0ac9('0x9f')];})[_0x0ac9('0x2f')](function(){return db[_0x0ac9('0x4a')][_0x0ac9('0x63')]({'where':{'id':_0x467756['params']['id']},'include':[{'model':db[_0x0ac9('0xab')],'as':_0x0ac9('0xb6')},{'model':db['MailAccount'],'as':_0x0ac9('0xdd')}]});})[_0x0ac9('0x2f')](handleEntityNotFound(_0x2b4bb0,null))[_0x0ac9('0x2f')](function(_0x406c30){if(_0x406c30&&_0x406c30['List']){_0x35cfe3=_0x406c30;var _0x35a5b3=_[_0x0ac9('0x15')](_0x467756['body'],{'firstName':_0x467756['body'][_0x0ac9('0x9f')],'phone':_0x467756[_0x0ac9('0x65')][_0x0ac9('0x9f')],'ListId':_0x406c30['ListId']});_0x35a5b3[_0x467756['body'][_0x0ac9('0xda')]]=_0x467756[_0x0ac9('0x65')][_0x0ac9('0x9f')];return db[_0x0ac9('0xa3')][_0x0ac9('0xde')]({'where':_0x55629a,'defaults':_0x35a5b3});}})[_0x0ac9('0xdf')](function(_0x3bd3db){if(_0x3bd3db){_0x5a9fb6=_0x3bd3db;var _0x1d9821=fs[_0x0ac9('0xe0')](path[_0x0ac9('0x8a')](config[_0x0ac9('0x8b')],_0x0ac9('0xe1')),_0x0ac9('0xe2'));var _0x243055=ejs[_0x0ac9('0xe3')](_0x1d9821,{'body':_[_0x0ac9('0xe4')](_0x467756[_0x0ac9('0x65')]['body']),'bodyTitle':_0x35cfe3['offlineMessageBody']});return db['ChatOfflineMessage'][_0x0ac9('0x64')]({'body':_0x243055,'plainBody':htmlToText[_0x0ac9('0xe5')](_0x243055),'ContactId':_0x3bd3db['id'],'ChatWebsiteId':_0x35cfe3['id']});}})[_0x0ac9('0x2f')](function(_0x52fbd7){_0x3eb2df=_0x52fbd7;if(_0x4fc9e2[_0x0ac9('0x51')]){var _0x4fd1c9=_0x4fc9e2[_0x0ac9('0x49')](function(_0x2cac02){return{'name':_0x2cac02[_0x0ac9('0xe6')],'basename':_0x2cac02['filename'],'type':_0x2cac02[_0x0ac9('0xe7')],'ChatOfflineMessageId':_0x52fbd7['id']};});_0x318195=_0x4fd1c9['map'](_0x37be6a=>{var _0x49ebd5={'filename':_0x37be6a[_0x0ac9('0x33')],'path':path[_0x0ac9('0x8a')](config[_0x0ac9('0x8b')],_0x0ac9('0xe8'),'files',_0x0ac9('0xe9'),_0x0ac9('0xea'),_0x37be6a[_0x0ac9('0xeb')])};return _0x49ebd5;});if(!_0x35cfe3['openNewInteraction']){return db[_0x0ac9('0xec')][_0x0ac9('0xed')](function(_0x48ca73){return db['Attachment'][_0x0ac9('0xee')](_0x4fd1c9,{'transaction':_0x48ca73});});}}})['then'](function(){if(_0x3eb2df){_0x40a9c7=_0x3eb2df;return db[_0x0ac9('0xdd')][_0x0ac9('0x78')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x0ac9('0xef'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0ac9('0xf0'),'raw':!![]}]}]});}})[_0x0ac9('0x2f')](function(_0x1460d2){if(_0x1460d2&&_0x1460d2[_0x0ac9('0xef')]&&_0x35cfe3[_0x0ac9('0xf1')]&&_0x35cfe3[_0x0ac9('0xf2')]){var _0xdb91e8=_0x1460d2[_0x0ac9('0xf3')]();return respondWithRpcPromise(_0x0ac9('0xf4'),_0x0ac9('0xf5'),{'account':_0xdb91e8,'message':{'from':util['format'](_0x0ac9('0xf6'),_0x1460d2[_0x0ac9('0x33')],_0x1460d2[_0x0ac9('0xf7')]||_0x1460d2[_0x0ac9('0xef')][_0x0ac9('0x6b')]),'to':_0x35cfe3[_0x0ac9('0xf2')],'subject':_0x35cfe3['offlineMessageSubject'],'html':_0x40a9c7['body'],'attachments':_0x318195}},client9003)[_0x0ac9('0x2f')](function(){return _0x40a9c7;})['catch'](function(_0x889308){logger[_0x0ac9('0x1e')](_0x889308);});}})['then'](function(){if(_0x35cfe3&&_0x35cfe3[_0x0ac9('0xf8')]&&_0x35cfe3['MailAccountId']){var _0x2939e6=[];if(_0x4fc9e2[_0x0ac9('0x51')]){_0x2939e6=_0x4fc9e2[_0x0ac9('0x49')](function(_0x120d0d){return{'name':_0x120d0d[_0x0ac9('0xe6')],'basename':_0x120d0d[_0x0ac9('0x82')],'type':_0x120d0d['mimetype'],'ChatOfflineMessageId':_0x3eb2df['id']};});}var _0x24dd1c;if(!_[_0x0ac9('0x98')](_0x35cfe3['subjectOffline'])){var _0x2eece0=_[_0x0ac9('0x49')](_0x467756[_0x0ac9('0x65')],function(_0x3690d0){return _0x3690d0;});var _0x46baf3=_[_0x0ac9('0xf9')](_0x2eece0)[0x0];var _0x4a1975=_[_0x0ac9('0xfa')](_0x46baf3,function(_0x3ce4e7){return _0x3ce4e7;});_0x24dd1c=_0x4a1975[0x1][_0x35cfe3['subjectOffline']];}var _0x4769a5={'from':_0x5a9fb6['email'],'firstName':_0x5a9fb6[_0x0ac9('0x3b')],'lastName':_0x5a9fb6['lastName'],'mapKey':_0x0ac9('0xf7'),'message':{'from':_0x5a9fb6[_0x0ac9('0xf7')],'to':_0x35cfe3['MailAccount'][_0x0ac9('0xf7')],'cc':'','subject':_[_0x0ac9('0x98')](_0x24dd1c)?_0x35cfe3[_0x0ac9('0xfb')]:_0x24dd1c,'messageId':'','sentAt':new Date(),'attach':_0x2939e6[_0x0ac9('0x51')],'attachments':_0x2939e6,'originChannel':_0x0ac9('0xfc'),'ChatWebsiteId':_0x35cfe3['id'],'ChatOfflineMessageId':_0x40a9c7['id'],'originTo':_0x35cfe3[_0x0ac9('0xdd')][_0x0ac9('0xf7')]},'body':_0x40a9c7['body']};var _0x43e1fd={'account':{'id':_0x35cfe3[_0x0ac9('0xfd')]},'body':_0x4769a5,'log':_0x0ac9('0xfe')};return respondWithRpcPromise(_0x0ac9('0xfe'),_0x0ac9('0xff'),_0x43e1fd,client9001)[_0x0ac9('0x2f')](function(){return _0x40a9c7;})[_0x0ac9('0x22')](function(_0x174aec){logger[_0x0ac9('0x1e')](_0x174aec);});}return;})[_0x0ac9('0x2f')](function(){if(_0x40a9c7){return _0x40a9c7;}})[_0x0ac9('0x2f')](respondWithResult(_0x2b4bb0,null))[_0x0ac9('0x22')](function(){for(var _0x70ff24 of _0x4fc9e2){var _0x12f851=path[_0x0ac9('0x8a')](config[_0x0ac9('0x8b')],'server','files',_0x0ac9('0xe9'),_0x0ac9('0xea'),_0x70ff24[_0x0ac9('0x82')]);fs_extra[_0x0ac9('0x100')](_0x12f851)[_0x0ac9('0x22')](function(_0x17c4ae){logger['error'](_0x0ac9('0x101'),_0x12f851,_0x17c4ae);});}});};exports[_0x0ac9('0x102')]=function(_0x1d1467,_0x569d56){return db[_0x0ac9('0xbc')]['find']({'where':{'id':_0x1d1467['params']['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x569d56,null))['then'](function(_0x4f08b3){if(_0x4f08b3){return _0x4f08b3[_0x0ac9('0x102')](_0x1d1467['body'][_0x0ac9('0x7a')],_[_0x0ac9('0x103')](_0x1d1467[_0x0ac9('0x65')],[_0x0ac9('0x7a'),'id'])||{});}})[_0x0ac9('0x2f')](respondWithResult(_0x569d56,null))[_0x0ac9('0x22')](handleError(_0x569d56,null));};exports['getInteractions']=function(_0x4c7b2c,_0x375cb6){var _0x152b81={'raw':![],'where':{}};var _0x1d4d73={};var _0x4584ac={'count':0x0,'rows':[]};return db[_0x0ac9('0x4a')]['findOne']({'where':{'id':_0x4c7b2c[_0x0ac9('0x60')]['id']}})['then'](handleEntityNotFound(_0x375cb6,null))[_0x0ac9('0x2f')](function(_0x21117a){if(_0x21117a){_0x1d4d73['model']=_[_0x0ac9('0x4b')](db[_0x0ac9('0xbc')][_0x0ac9('0x62')]);_0x1d4d73[_0x0ac9('0x4c')]=_[_0x0ac9('0x4b')](_0x4c7b2c[_0x0ac9('0x4c')]);_0x1d4d73['filters']=_['intersection'](_0x1d4d73[_0x0ac9('0x44')],_0x1d4d73['query']);_0x152b81[_0x0ac9('0x4e')]=_[_0x0ac9('0x4f')](_0x1d4d73['model'],qs['fields'](_0x4c7b2c[_0x0ac9('0x4c')][_0x0ac9('0x50')]));_0x152b81[_0x0ac9('0x4e')]=_0x152b81[_0x0ac9('0x4e')][_0x0ac9('0x51')]?_0x152b81[_0x0ac9('0x4e')]:_0x1d4d73[_0x0ac9('0x44')];if(!_0x4c7b2c[_0x0ac9('0x4c')]['hasOwnProperty'](_0x0ac9('0x53'))){_0x152b81[_0x0ac9('0x27')]=qs[_0x0ac9('0x27')](_0x4c7b2c[_0x0ac9('0x4c')][_0x0ac9('0x27')]);_0x152b81[_0x0ac9('0x29')]=qs['offset'](_0x4c7b2c[_0x0ac9('0x4c')][_0x0ac9('0x29')]);}_0x152b81['order']=qs[_0x0ac9('0x55')](_0x4c7b2c[_0x0ac9('0x4c')]['sort']);_0x152b81[_0x0ac9('0x56')]=qs[_0x0ac9('0x4d')](_[_0x0ac9('0x7e')](_0x4c7b2c[_0x0ac9('0x4c')],_0x1d4d73['filters']));_0x152b81[_0x0ac9('0x56')][_0x0ac9('0x75')]=_0x21117a['id'];if(_0x4c7b2c[_0x0ac9('0x4c')][_0x0ac9('0x57')]){_0x152b81['where']=_['merge'](_0x152b81[_0x0ac9('0x56')],{'$or':_['map'](_0x152b81[_0x0ac9('0x4e')],function(_0x2f0331){var _0x3ca18f={};_0x3ca18f[_0x2f0331]={'$like':'%'+_0x4c7b2c[_0x0ac9('0x4c')]['filter']+'%'};return _0x3ca18f;})});}_0x152b81=_[_0x0ac9('0x58')]({},_0x152b81,_0x4c7b2c[_0x0ac9('0x5a')]);return db[_0x0ac9('0xbc')][_0x0ac9('0x28')]({'where':_0x152b81['where']})[_0x0ac9('0x2f')](function(_0x242e05){_0x4584ac[_0x0ac9('0x28')]=_0x242e05;if(_0x4c7b2c['query'][_0x0ac9('0x5b')]){_0x152b81[_0x0ac9('0x5c')]=[{'model':db[_0x0ac9('0xa3')],'as':_0x0ac9('0x104'),'required':![]},{'model':db[_0x0ac9('0xc9')],'as':'Owner','attributes':[_0x0ac9('0x33'),'fullname',_0x0ac9('0x105')],'required':![]},{'model':db[_0x0ac9('0x106')],'as':'Tags','attributes':['id','name',_0x0ac9('0x107')],'where':_0x4c7b2c['query'][_0x0ac9('0x108')]?{'id':_0x4c7b2c[_0x0ac9('0x4c')]['tag']}:undefined,'required':_0x4c7b2c['query'][_0x0ac9('0x108')]?!![]:![]}];}return db[_0x0ac9('0xbc')][_0x0ac9('0x5d')](_0x152b81);})[_0x0ac9('0x2f')](function(_0x36f59e){_0x4584ac['rows']=_0x36f59e;return _0x4584ac;});}})[_0x0ac9('0x2f')](respondWithFilteredResult(_0x375cb6,_0x152b81))[_0x0ac9('0x22')](handleError(_0x375cb6,null));};exports[_0x0ac9('0x109')]=function(_0xf86778,_0x30d887){var _0xe25bdf=0x0;var _0x5c3b18=0x0;var _0x158e08=![];var _0x2f53b4;var _0x4c03db;return db[_0x0ac9('0x4a')][_0x0ac9('0x63')]({'where':{'id':_0xf86778[_0x0ac9('0x60')]['id']},'include':[{'model':db['Interval'],'as':_0x0ac9('0x9a'),'include':[{'model':db[_0x0ac9('0x9a')],'as':_0x0ac9('0x10a'),'attributes':['id',_0x0ac9('0xaf')]}]}]})['then'](handleEntityNotFound(_0x30d887,null))[_0x0ac9('0x2f')](function(_0x1979a7){if(_0x1979a7){_0x2f53b4=_0x1979a7;return _0x1979a7['getProactiveActions']({'raw':!![]});}})[_0x0ac9('0x2f')](function(_0x534f33){if(_0x2f53b4){if(_0x534f33){_0x4c03db=_0x534f33;}}return require(_0x0ac9('0x8d'))[_0x0ac9('0x8e')]();})[_0x0ac9('0x2f')](function(_0x2a11f6){if(_0x2a11f6){_0x5c3b18=_0x2a11f6[_0x0ac9('0x10b')];_0x158e08=_0x2a11f6[_0x0ac9('0x8f')];}})[_0x0ac9('0x2f')](function(){return db[_0x0ac9('0xbc')]['count']({'where':{'closed':![]}});})['then'](function(_0x3cd03d){_0xe25bdf=_0x3cd03d;if(_0x5c3b18&&_0x3cd03d>_0x5c3b18){return db[_0x0ac9('0x10c')]['findOne']({'where':{'id':0x1}})['then'](function(_0x12c735){if(_0x12c735){_0x12c735[_0x0ac9('0x10d')](_0x0ac9('0x10e'));}});}})[_0x0ac9('0x2f')](function(){var _0x10f6f3=_0x2f53b4[_0x0ac9('0x9a')];var _0x3f3d75=_0x2f53b4[_0x0ac9('0x9c')]||undefined;return _0x10f6f3?_0x10f6f3['ifTime'](_0x3f3d75):!![];})[_0x0ac9('0x2f')](function(_0x3f9457){var _0x62b49b=fs['readFileSync'](path[_0x0ac9('0x8a')](config['root'],'server/files/chat/iframe.ejs'),_0x0ac9('0xe2'));var _0x366afa=_0x0ac9('0x10f');var _0x4bd4d2=![];var _0x8faf1a,_0x1d8f33;if(_0xf86778[_0x0ac9('0xb9')][_0x0ac9('0x3d')]){_0x8faf1a=new URL(_0xf86778[_0x0ac9('0xb9')]['referer'])[_0x0ac9('0x110')];}else if(_0xf86778['headers']['origin']){_0x8faf1a=new URL(_0xf86778[_0x0ac9('0xb9')][_0x0ac9('0x110')])[_0x0ac9('0x110')];}else{_0x8faf1a='http://localhost:9000';}_0x1d8f33=typeof _0x2f53b4[_0x0ac9('0x66')][_0x0ac9('0x67')](',')[_0x0ac9('0x63')](function(_0x5efe8e){return wildcardUtils[_0x0ac9('0x111')](_0x5efe8e,_0x8faf1a);})!==_0x0ac9('0x26');var _0x221496={'chatVersion':_0x366afa,'chatWebsiteAddressOrigin':_0x1d8f33?_0x8faf1a:_0x2f53b4[_0x0ac9('0x66')],'remote':_0x2f53b4['remote'],'query':querystring[_0x0ac9('0x48')](_[_0x0ac9('0x58')](_0x2f53b4[_0x0ac9('0x30')]({'plain':!![]}),{'customerIp':_0xf86778[_0x0ac9('0xb9')][_0x0ac9('0x112')]||_0xf86778[_0x0ac9('0xb9')][_0x0ac9('0x113')]||_0xf86778['connection'][_0x0ac9('0x114')]||_0xf86778['ip'],'referer':_0xf86778['headers'][_0x0ac9('0x3d')],'openedInteractions':_0xe25bdf,'maxInteractions':_0x5c3b18,'virtual':_0x158e08[_0x0ac9('0x10b')],'online':_0x3f9457,'custom':_0x158e08,'address':_0x1d8f33?_0x8faf1a:null}))[_0x0ac9('0x115')](/'/g,'\x5c\x27')};_0x30d887[_0x0ac9('0x34')](ejs['render'](Mustache['render'](_0x62b49b,_0x221496),{'proactiveActions':_0x4c03db,'alignment':_0x2f53b4['alignment'],'verticalAlignment':_0x2f53b4[_0x0ac9('0x116')],'div_color':_0x2f53b4[_0x0ac9('0x107')],'labelText':_0x2f53b4['labelText'],'text_color':_0x2f53b4[_0x0ac9('0x117')],'text_button_color':_0x2f53b4[_0x0ac9('0x118')],'button_color':_0x2f53b4[_0x0ac9('0x119')],'background_color':_0x2f53b4[_0x0ac9('0x11a')],'hideWhenOffline':_0x2f53b4[_0x0ac9('0x11b')],'intervalId':_0x2f53b4[_0x0ac9('0x11c')],'isDevelopment':_0x4bd4d2,'chatVersion':_0x366afa}));})[_0x0ac9('0x22')](handleError(_0x30d887,null));};exports['addApplications']=function(_0x26bf3e,_0xa7ddf7){var _0xfcddc8=_0x26bf3e[_0x0ac9('0x60')]['id'];var _0x365580=_0x26bf3e[_0x0ac9('0x65')];var _0x426436=0xc8;var _0x116047=null;return db[_0x0ac9('0xec')]['transaction']({'isolationLevel':db[_0x0ac9('0xec')][_0x0ac9('0x11d')][_0x0ac9('0x11e')]['READ_COMMITTED']},function(_0x49a71f){return db[_0x0ac9('0x4a')]['findOne']({'where':{'id':_0xfcddc8},'transaction':_0x49a71f})['then'](function(_0x57e830){if(_0x57e830){return db['ChatApplication'][_0x0ac9('0x2e')]({'where':{'ChatWebsiteId':_0xfcddc8},'transaction':_0x49a71f})['then'](function(){var _0x5dab96=_[_0x0ac9('0x49')](_0x365580,function(_0xa666cc){_0xa666cc['ChatWebsiteId']=_0xfcddc8;return _0xa666cc;});return db[_0x0ac9('0x11f')]['bulkCreate'](_0x5dab96,{'transaction':_0x49a71f});});}else{_0x426436=0x194;_0x116047=[];}});})[_0x0ac9('0x2f')](function(){if(_0x426436!==0x194){return db['ChatApplication'][_0x0ac9('0x120')]({'where':{'ChatWebsiteId':_0xfcddc8},'order':_0x0ac9('0xb4')})[_0x0ac9('0x2f')](function(_0x2a1a53){_0x116047=_0x2a1a53;});}})[_0x0ac9('0x22')](function(_0x21e351){_0x426436=0x1f4;logger['error'](_0x21e351[_0x0ac9('0x121')]);if(_0x21e351[_0x0ac9('0x33')]){delete _0x21e351[_0x0ac9('0x33')];}_0x116047=_0x21e351;})[_0x0ac9('0x122')](function(){if(_0x116047===null){_0xa7ddf7[_0x0ac9('0x23')](_0x426436);}else{if(_0x426436===0x1f4){_0xa7ddf7[_0x0ac9('0x25')](_0x426436)[_0x0ac9('0x34')](_0x116047);}else{_0xa7ddf7[_0x0ac9('0x25')](_0x426436)[_0x0ac9('0x2c')](_0x116047);}}});};exports[_0x0ac9('0x123')]=function(_0x4dcf2b,_0x87fd43){var _0x15ec79={};var _0x18c471={};var _0x552472;var _0x55d835;return db[_0x0ac9('0x4a')][_0x0ac9('0x78')]({'where':{'id':_0x4dcf2b[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x87fd43,null))['then'](function(_0x2de32e){if(_0x2de32e){_0x552472=_0x2de32e;_0x18c471[_0x0ac9('0x44')]=_[_0x0ac9('0x4b')](db['ChatApplication'][_0x0ac9('0x62')]);_0x18c471[_0x0ac9('0x4c')]=_[_0x0ac9('0x4b')](_0x4dcf2b[_0x0ac9('0x4c')]);_0x18c471[_0x0ac9('0x4d')]=_[_0x0ac9('0x4f')](_0x18c471[_0x0ac9('0x44')],_0x18c471[_0x0ac9('0x4c')]);_0x15ec79[_0x0ac9('0x4e')]=_[_0x0ac9('0x4f')](_0x18c471[_0x0ac9('0x44')],qs[_0x0ac9('0x50')](_0x4dcf2b[_0x0ac9('0x4c')][_0x0ac9('0x50')]));_0x15ec79[_0x0ac9('0x4e')]=_0x15ec79['attributes'][_0x0ac9('0x51')]?_0x15ec79[_0x0ac9('0x4e')]:_0x18c471[_0x0ac9('0x44')];_0x15ec79[_0x0ac9('0x54')]=qs[_0x0ac9('0x55')](_0x4dcf2b[_0x0ac9('0x4c')][_0x0ac9('0x55')]);_0x15ec79[_0x0ac9('0x56')]=qs[_0x0ac9('0x4d')](_['pick'](_0x4dcf2b[_0x0ac9('0x4c')],_0x18c471[_0x0ac9('0x4d')]));if(_0x4dcf2b[_0x0ac9('0x4c')][_0x0ac9('0x57')]){_0x15ec79[_0x0ac9('0x56')]=_[_0x0ac9('0x58')](_0x15ec79[_0x0ac9('0x56')],{'$or':_[_0x0ac9('0x49')](_0x15ec79['attributes'],function(_0x18dd5a){var _0x525151={};_0x525151[_0x18dd5a]={'$like':'%'+_0x4dcf2b[_0x0ac9('0x4c')][_0x0ac9('0x57')]+'%'};return _0x525151;})});}_0x15ec79=_['merge']({},_0x15ec79,_0x4dcf2b[_0x0ac9('0x5a')]);return _0x552472[_0x0ac9('0x123')](_0x15ec79);}})[_0x0ac9('0x2f')](function(_0x54549b){if(_0x54549b){_0x55d835=_0x54549b['length'];if(!_0x4dcf2b['query']['hasOwnProperty']('nolimit')){_0x15ec79[_0x0ac9('0x27')]=qs['limit'](_0x4dcf2b[_0x0ac9('0x4c')]['limit']);_0x15ec79[_0x0ac9('0x29')]=qs[_0x0ac9('0x29')](_0x4dcf2b[_0x0ac9('0x4c')][_0x0ac9('0x29')]);}return _0x552472[_0x0ac9('0x123')](_0x15ec79);}})[_0x0ac9('0x2f')](function(_0xbc07a5){if(_0xbc07a5){return _0xbc07a5?{'count':_0x55d835,'rows':_0xbc07a5}:null;}})[_0x0ac9('0x2f')](respondWithResult(_0x87fd43,null))[_0x0ac9('0x22')](handleError(_0x87fd43,null));};exports['addProactiveActions']=function(_0xa2f0b8,_0x3a5a4a){return db[_0x0ac9('0x124')][_0x0ac9('0x63')]({'where':{'id':_0xa2f0b8['params']['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x3a5a4a,null))[_0x0ac9('0x2f')](function(_0x1db77e){if(_0x1db77e){return _0x1db77e['addProactiveActions'](_0xa2f0b8[_0x0ac9('0x65')][_0x0ac9('0x7a')],_['omit'](_0xa2f0b8[_0x0ac9('0x65')],[_0x0ac9('0x7a'),'id'])||{});}})[_0x0ac9('0x2f')](respondWithResult(_0x3a5a4a,null))[_0x0ac9('0x22')](handleError(_0x3a5a4a,null));};exports['getProactiveActions']=function(_0x407a74,_0x36e00a){var _0x12d7c3={};var _0x5da82b={};var _0x4ea41b;var _0xa0e36d;return db[_0x0ac9('0x4a')][_0x0ac9('0x78')]({'where':{'id':_0x407a74[_0x0ac9('0x60')]['id']}})['then'](handleEntityNotFound(_0x36e00a,null))[_0x0ac9('0x2f')](function(_0x21daa4){if(_0x21daa4){_0x4ea41b=_0x21daa4;_0x5da82b[_0x0ac9('0x44')]=_[_0x0ac9('0x4b')](db[_0x0ac9('0x125')][_0x0ac9('0x62')]);_0x5da82b[_0x0ac9('0x4c')]=_[_0x0ac9('0x4b')](_0x407a74[_0x0ac9('0x4c')]);_0x5da82b[_0x0ac9('0x4d')]=_[_0x0ac9('0x4f')](_0x5da82b[_0x0ac9('0x44')],_0x5da82b[_0x0ac9('0x4c')]);_0x12d7c3[_0x0ac9('0x4e')]=_['intersection'](_0x5da82b['model'],qs[_0x0ac9('0x50')](_0x407a74[_0x0ac9('0x4c')][_0x0ac9('0x50')]));_0x12d7c3[_0x0ac9('0x4e')]=_0x12d7c3['attributes'][_0x0ac9('0x51')]?_0x12d7c3['attributes']:_0x5da82b[_0x0ac9('0x44')];_0x12d7c3[_0x0ac9('0x54')]=qs[_0x0ac9('0x55')](_0x407a74[_0x0ac9('0x4c')][_0x0ac9('0x55')]);_0x12d7c3[_0x0ac9('0x56')]=qs[_0x0ac9('0x4d')](_['pick'](_0x407a74[_0x0ac9('0x4c')],_0x5da82b['filters']));if(_0x407a74[_0x0ac9('0x4c')][_0x0ac9('0x57')]){_0x12d7c3[_0x0ac9('0x56')]=_[_0x0ac9('0x58')](_0x12d7c3[_0x0ac9('0x56')],{'$or':_[_0x0ac9('0x49')](_0x12d7c3[_0x0ac9('0x4e')],function(_0x259f99){var _0x274680={};_0x274680[_0x259f99]={'$like':'%'+_0x407a74[_0x0ac9('0x4c')][_0x0ac9('0x57')]+'%'};return _0x274680;})});}_0x12d7c3=_[_0x0ac9('0x58')]({},_0x12d7c3,_0x407a74[_0x0ac9('0x5a')]);return _0x4ea41b[_0x0ac9('0x126')](_0x12d7c3);}})['then'](function(_0x48439c){if(_0x48439c){_0xa0e36d=_0x48439c[_0x0ac9('0x51')];if(!_0x407a74[_0x0ac9('0x4c')]['hasOwnProperty']('nolimit')){_0x12d7c3[_0x0ac9('0x27')]=qs['limit'](_0x407a74['query']['limit']);_0x12d7c3[_0x0ac9('0x29')]=qs[_0x0ac9('0x29')](_0x407a74[_0x0ac9('0x4c')]['offset']);}return _0x4ea41b[_0x0ac9('0x126')](_0x12d7c3);}})[_0x0ac9('0x2f')](function(_0x31f278){if(_0x31f278){return _0x31f278?{'count':_0xa0e36d,'rows':_0x31f278}:null;}})[_0x0ac9('0x2f')](respondWithResult(_0x36e00a,null))[_0x0ac9('0x22')](handleError(_0x36e00a,null));};exports['getFields']=function(_0x74d1c1,_0x2a60ec){var _0x39ca3a=_0x74d1c1[_0x0ac9('0x4c')][_0x0ac9('0x127')]===_0x0ac9('0x128')?_0x0ac9('0x129'):_0x0ac9('0x12a');return db[_0x0ac9('0x4a')]['find']({'attributes':['id',_0x39ca3a],'where':{'id':_0x74d1c1[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x2a60ec,null))[_0x0ac9('0x2f')](function(_0xf37382){if(_0xf37382){var _0x177f88=_0xf37382[_0x39ca3a];var _0x26a334=_0x177f88&&_0x177f88['items']?_0x177f88['items']:[];_0x2a60ec[_0x0ac9('0x34')]({'fromKey':_[_0x0ac9('0x98')](_0x177f88[_0x0ac9('0x12b')])?undefined:_0x177f88[_0x0ac9('0x12b')],'count':_0x26a334[_0x0ac9('0x51')],'rows':_0x26a334});}})[_0x0ac9('0x22')](handleError(_0x2a60ec,null));};exports[_0x0ac9('0x12c')]=function(_0x35f7de,_0x4196e3){var _0x2d0acb={'raw':![],'where':{}};var _0x5b13a5={};var _0x2aabde={'count':0x0,'rows':[]};return db[_0x0ac9('0x4a')][_0x0ac9('0x78')]({'where':{'id':_0x35f7de[_0x0ac9('0x60')]['id']}})['then'](handleEntityNotFound(_0x4196e3,null))['then'](function(_0x35aa18){if(_0x35aa18){_0x5b13a5['model']=_[_0x0ac9('0x4b')](db[_0x0ac9('0x12d')][_0x0ac9('0x62')]);_0x5b13a5[_0x0ac9('0x4c')]=_['keys'](_0x35f7de[_0x0ac9('0x4c')]);_0x5b13a5[_0x0ac9('0x4d')]=_['intersection'](_0x5b13a5['model'],_0x5b13a5[_0x0ac9('0x4c')]);_0x2d0acb[_0x0ac9('0x4e')]=_[_0x0ac9('0x4f')](_0x5b13a5[_0x0ac9('0x44')],qs[_0x0ac9('0x50')](_0x35f7de[_0x0ac9('0x4c')][_0x0ac9('0x50')]));_0x2d0acb[_0x0ac9('0x4e')]=_0x2d0acb[_0x0ac9('0x4e')][_0x0ac9('0x51')]?_0x2d0acb['attributes']:_0x5b13a5[_0x0ac9('0x44')];if(!_0x35f7de[_0x0ac9('0x4c')][_0x0ac9('0x52')](_0x0ac9('0x53'))){_0x2d0acb['limit']=qs[_0x0ac9('0x27')](_0x35f7de['query']['limit']);_0x2d0acb[_0x0ac9('0x29')]=qs[_0x0ac9('0x29')](_0x35f7de['query'][_0x0ac9('0x29')]);}_0x2d0acb[_0x0ac9('0x54')]=qs[_0x0ac9('0x55')](_0x35f7de['query'][_0x0ac9('0x55')]);_0x2d0acb[_0x0ac9('0x56')]=qs['filters'](_[_0x0ac9('0x7e')](_0x35f7de['query'],_0x5b13a5[_0x0ac9('0x4d')]));_0x2d0acb['where']['ChatWebsiteId']=_0x35aa18['id'];if(_0x35f7de[_0x0ac9('0x4c')][_0x0ac9('0x57')]){_0x2d0acb[_0x0ac9('0x56')]=_[_0x0ac9('0x58')](_0x2d0acb[_0x0ac9('0x56')],{'$or':_[_0x0ac9('0x49')](_0x2d0acb['attributes'],function(_0x4ec0af){var _0x3933ac={};_0x3933ac[_0x4ec0af]={'$like':'%'+_0x35f7de[_0x0ac9('0x4c')][_0x0ac9('0x57')]+'%'};return _0x3933ac;})});}_0x2d0acb=_['merge']({},_0x2d0acb,_0x35f7de[_0x0ac9('0x5a')]);return db[_0x0ac9('0x12d')][_0x0ac9('0x28')]({'where':_0x2d0acb[_0x0ac9('0x56')]})[_0x0ac9('0x2f')](function(_0x3c33bd){_0x2aabde[_0x0ac9('0x28')]=_0x3c33bd;if(_0x35f7de[_0x0ac9('0x4c')]['includeAll']){_0x2d0acb[_0x0ac9('0x5c')]=[{'all':!![]}];}else{_0x2d0acb['include']=[{'model':db[_0x0ac9('0xa3')],'as':_0x0ac9('0x104'),'required':![]},{'model':db[_0x0ac9('0x12e')],'as':_0x0ac9('0x12f'),'required':![]}];}return db[_0x0ac9('0x12d')][_0x0ac9('0x5d')](_0x2d0acb);})[_0x0ac9('0x2f')](function(_0x2c6e4a){_0x2aabde['rows']=_0x2c6e4a;return _0x2aabde;});}})['then'](respondWithFilteredResult(_0x4196e3,_0x2d0acb))[_0x0ac9('0x22')](handleError(_0x4196e3,null));};exports[_0x0ac9('0x130')]=function(_0x246ba2,_0x2d7a65){return db['ChatWebsite'][_0x0ac9('0x63')]({'where':{'id':_0x246ba2[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x2d7a65,null))['then'](function(_0x30654c){if(_0x30654c){return _0x30654c[_0x0ac9('0x130')](_0x246ba2['body'][_0x0ac9('0x7a')],_[_0x0ac9('0x103')](_0x246ba2[_0x0ac9('0x65')],['ids','id'])||{})[_0x0ac9('0xdf')](function(_0x1c057f){for(var _0x6e33ab=0x0;_0x6e33ab<_0x246ba2[_0x0ac9('0x65')][_0x0ac9('0x7a')][_0x0ac9('0x51')];_0x6e33ab+=0x1){socket[_0x0ac9('0x131')](_0x0ac9('0x132'),{'UserId':Number(_0x246ba2['body'][_0x0ac9('0x7a')][_0x6e33ab]),'ChatWebsiteId':Number(_0x246ba2['params']['id'])});}return _0x1c057f;});}})[_0x0ac9('0x2f')](respondWithResult(_0x2d7a65,null))[_0x0ac9('0x22')](handleError(_0x2d7a65,null));};exports['removeAgents']=function(_0x1cdb9c,_0x420f97){return db[_0x0ac9('0x4a')][_0x0ac9('0x63')]({'where':{'id':_0x1cdb9c[_0x0ac9('0x60')]['id']}})[_0x0ac9('0x2f')](handleEntityNotFound(_0x420f97,null))[_0x0ac9('0x2f')](function(_0x4f4f77){if(_0x4f4f77){return _0x4f4f77[_0x0ac9('0x133')](_0x1cdb9c[_0x0ac9('0x4c')][_0x0ac9('0x7a')])['then'](function(){if(_[_0x0ac9('0x134')](_0x1cdb9c['query'][_0x0ac9('0x7a')])){for(var _0x4d3c2a=0x0;_0x4d3c2a<_0x1cdb9c[_0x0ac9('0x4c')][_0x0ac9('0x7a')][_0x0ac9('0x51')];_0x4d3c2a+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x1cdb9c[_0x0ac9('0x4c')][_0x0ac9('0x7a')][_0x4d3c2a]),'ChatWebsiteId':Number(_0x1cdb9c[_0x0ac9('0x60')]['id'])});}}else{socket[_0x0ac9('0x131')](_0x0ac9('0x135'),{'UserId':Number(_0x1cdb9c[_0x0ac9('0x4c')][_0x0ac9('0x7a')]),'ChatWebsiteId':Number(_0x1cdb9c[_0x0ac9('0x60')]['id'])});}});}})[_0x0ac9('0x2f')](respondWithStatusCode(_0x420f97,null))[_0x0ac9('0x22')](handleError(_0x420f97,null));};exports[_0x0ac9('0x136')]=function(_0x51636a,_0x36c64f){var _0x4b125b={};var _0x117534={};var _0x1e60d9;var _0x43b922;return db[_0x0ac9('0x4a')][_0x0ac9('0x78')]({'where':{'id':_0x51636a[_0x0ac9('0x60')]['id']}})['then'](handleEntityNotFound(_0x36c64f,null))[_0x0ac9('0x2f')](function(_0x19ea0e){if(_0x19ea0e){_0x1e60d9=_0x19ea0e;_0x117534[_0x0ac9('0x44')]=_[_0x0ac9('0x4b')](db['User'][_0x0ac9('0x62')]);_0x117534['query']=_[_0x0ac9('0x4b')](_0x51636a[_0x0ac9('0x4c')]);_0x117534[_0x0ac9('0x4d')]=_[_0x0ac9('0x4f')](_0x117534[_0x0ac9('0x44')],_0x117534[_0x0ac9('0x4c')]);_0x4b125b[_0x0ac9('0x4e')]=_[_0x0ac9('0x4f')](_0x117534[_0x0ac9('0x44')],qs[_0x0ac9('0x50')](_0x51636a[_0x0ac9('0x4c')][_0x0ac9('0x50')]));_0x4b125b[_0x0ac9('0x4e')]=_0x4b125b[_0x0ac9('0x4e')][_0x0ac9('0x51')]?_0x4b125b[_0x0ac9('0x4e')]:_0x117534[_0x0ac9('0x44')];_0x4b125b[_0x0ac9('0x54')]=qs['sort'](_0x51636a[_0x0ac9('0x4c')][_0x0ac9('0x55')]);_0x4b125b['where']=qs[_0x0ac9('0x4d')](_[_0x0ac9('0x7e')](_0x51636a['query'],_0x117534[_0x0ac9('0x4d')]));if(_0x51636a[_0x0ac9('0x4c')][_0x0ac9('0x57')]){_0x4b125b[_0x0ac9('0x56')]=_[_0x0ac9('0x58')](_0x4b125b[_0x0ac9('0x56')],{'$or':_[_0x0ac9('0x49')](_0x4b125b[_0x0ac9('0x4e')],function(_0x28fcba){var _0x5cea4e={};_0x5cea4e[_0x28fcba]={'$like':'%'+_0x51636a['query'][_0x0ac9('0x57')]+'%'};return _0x5cea4e;})});}_0x4b125b=_[_0x0ac9('0x58')]({},_0x4b125b,_0x51636a[_0x0ac9('0x5a')]);return _0x1e60d9['getAgents'](_0x4b125b);}})[_0x0ac9('0x2f')](function(_0x5a968b){if(_0x5a968b){_0x43b922=_0x5a968b[_0x0ac9('0x51')];if(!_0x51636a[_0x0ac9('0x4c')][_0x0ac9('0x52')](_0x0ac9('0x53'))){_0x4b125b['limit']=qs[_0x0ac9('0x27')](_0x51636a[_0x0ac9('0x4c')][_0x0ac9('0x27')]);_0x4b125b[_0x0ac9('0x29')]=qs[_0x0ac9('0x29')](_0x51636a['query']['offset']);}return _0x1e60d9[_0x0ac9('0x136')](_0x4b125b);}})[_0x0ac9('0x2f')](function(_0x287fe2){if(_0x287fe2){return _0x287fe2?{'count':_0x43b922,'rows':_0x287fe2}:null;}})['then'](respondWithResult(_0x36c64f,null))[_0x0ac9('0x22')](handleError(_0x36c64f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index faebb2a..efb7cbf 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 _0x1ef3=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3f49d3,_0x8714a3){var _0x33df17=function(_0x9e3a4){while(--_0x9e3a4){_0x3f49d3['push'](_0x3f49d3['shift']());}};_0x33df17(++_0x8714a3);}(_0x1ef3,0x69));var _0x31ef=function(_0x3e156a,_0x23de02){_0x3e156a=_0x3e156a-0x0;var _0x1e301c=_0x1ef3[_0x3e156a];return _0x1e301c;};'use strict';var EventEmitter=require(_0x31ef('0x0'));var ChatWebsite=require(_0x31ef('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x31ef('0x2')](0x0);var events={'afterCreate':_0x31ef('0x3'),'afterUpdate':_0x31ef('0x4'),'afterDestroy':'remove'};function emitEvent(_0x311a32){return function(_0x58388a,_0x49ce87,_0x1a8d7f){ChatWebsiteEvents[_0x31ef('0x5')](_0x311a32+':'+_0x58388a['id'],_0x58388a);ChatWebsiteEvents[_0x31ef('0x5')](_0x311a32,_0x58388a);_0x1a8d7f(null);};}for(var e in events){if(events[_0x31ef('0x6')](e)){var event=events[e];ChatWebsite[_0x31ef('0x7')](e,emitEvent(event));}}module[_0x31ef('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xd84b=['remove','emit','hasOwnProperty','hook','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x3b4ed1,_0x2fb098){var _0x3edba0=function(_0x371c5c){while(--_0x371c5c){_0x3b4ed1['push'](_0x3b4ed1['shift']());}};_0x3edba0(++_0x2fb098);}(_0xd84b,0x177));var _0xbd84=function(_0x3b5688,_0x238faf){_0x3b5688=_0x3b5688-0x0;var _0x235955=_0xd84b[_0x3b5688];return _0x235955;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xbd84('0x0'))['db'][_0xbd84('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbd84('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbd84('0x3')};function emitEvent(_0xbd7482){return function(_0x2f0d5e,_0x7f1712,_0x49b0bf){ChatWebsiteEvents['emit'](_0xbd7482+':'+_0x2f0d5e['id'],_0x2f0d5e);ChatWebsiteEvents[_0xbd84('0x4')](_0xbd7482,_0x2f0d5e);_0x49b0bf(null);};}for(var e in events){if(events[_0xbd84('0x5')](e)){var event=events[e];ChatWebsite[_0xbd84('0x6')](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 52e1ee0..8f4d144 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 _0xe6ff=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe6ff,0x10f));var _0xfe6f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6ff[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfe6f('0x0'));var util=require(_0xfe6f('0x1'));var logger=require(_0xfe6f('0x2'))(_0xfe6f('0x3'));var moment=require(_0xfe6f('0x4'));var BPromise=require(_0xfe6f('0x5'));var rp=require(_0xfe6f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfe6f('0x7'));var attributes=require(_0xfe6f('0x8'));module[_0xfe6f('0x9')]=function(_0x59afec,_0xf4885d){return _0x59afec[_0xfe6f('0xa')](_0xfe6f('0xb'),attributes,{'tableName':_0xfe6f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cac=['./chatWebsite.attributes','ChatWebsite','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x19e460,_0x5c7522){var _0x3999f6=function(_0xdcd0f6){while(--_0xdcd0f6){_0x19e460['push'](_0x19e460['shift']());}};_0x3999f6(++_0x5c7522);}(_0x5cac,0x156));var _0xc5ca=function(_0x52ca28,_0x5ca27d){_0x52ca28=_0x52ca28-0x0;var _0x14681f=_0x5cac[_0x52ca28];return _0x14681f;};'use strict';var _=require(_0xc5ca('0x0'));var util=require(_0xc5ca('0x1'));var logger=require('../../config/logger')(_0xc5ca('0x2'));var moment=require(_0xc5ca('0x3'));var BPromise=require(_0xc5ca('0x4'));var rp=require(_0xc5ca('0x5'));var fs=require('fs');var path=require(_0xc5ca('0x6'));var rimraf=require('rimraf');var config=require(_0xc5ca('0x7'));var attributes=require(_0xc5ca('0x8'));module['exports']=function(_0x41ceca,_0x2167f9){return _0x41ceca['define'](_0xc5ca('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index ffcb195..e25656f 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 _0x655b=['redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4070fe,_0x4f253b){var _0x430c8b=function(_0x408c31){while(--_0x408c31){_0x4070fe['push'](_0x4070fe['shift']());}};_0x430c8b(++_0x4f253b);}(_0x655b,0x1a4));var _0xb655=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x655b[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xb655('0x0'));var util=require('util');var moment=require(_0xb655('0x1'));var BPromise=require(_0xb655('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb655('0x3'));var db=require(_0xb655('0x4'))['db'];var utils=require(_0xb655('0x5'));var logger=require(_0xb655('0x6'))(_0xb655('0x7'));var config=require(_0xb655('0x8'));var jayson=require(_0xb655('0x9'));var client=jayson[_0xb655('0xa')][_0xb655('0xb')]({'port':0x232a});config[_0xb655('0xc')]=_[_0xb655('0xd')](config['redis'],{'host':_0xb655('0xe'),'port':0x18eb});var socket=require(_0xb655('0xf'))(new Redis(config[_0xb655('0xc')]));require(_0xb655('0x10'))[_0xb655('0x11')](socket);function respondWithRpcPromise(_0x1219e7,_0x2dacc6,_0x8ee2d8){return new BPromise(function(_0x194a01,_0x51b06d){return client[_0xb655('0x12')](_0x1219e7,_0x8ee2d8)['then'](function(_0x55089b){logger[_0xb655('0x13')](_0xb655('0x14'),_0x2dacc6,_0xb655('0x15'));logger[_0xb655('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2dacc6,_0xb655('0x15'),JSON['stringify'](_0x55089b));if(_0x55089b[_0xb655('0x17')]){if(_0x55089b[_0xb655('0x17')][_0xb655('0x18')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x2dacc6,_0x55089b['error'][_0xb655('0x19')]);return _0x51b06d(_0x55089b[_0xb655('0x17')][_0xb655('0x19')]);}logger[_0xb655('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2dacc6,_0x55089b[_0xb655('0x17')]['message']);return _0x194a01(_0x55089b[_0xb655('0x17')]['message']);}else{logger[_0xb655('0x13')](_0xb655('0x14'),_0x2dacc6,'request\x20sent');_0x194a01(_0x55089b[_0xb655('0x1a')][_0xb655('0x19')]);}})['catch'](function(_0x1f3643){logger[_0xb655('0x17')](_0xb655('0x14'),_0x2dacc6,_0x1f3643);_0x51b06d(_0x1f3643);});});} \ No newline at end of file +var _0xc668=['ChatWebsite,\x20%s,\x20%s','message','info','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent','debug','error','code'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xc668,0x123));var _0x8c66=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc668[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8c66('0x0'));var util=require(_0x8c66('0x1'));var moment=require(_0x8c66('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c66('0x3'));var db=require(_0x8c66('0x4'))['db'];var utils=require(_0x8c66('0x5'));var logger=require(_0x8c66('0x6'))(_0x8c66('0x7'));var config=require(_0x8c66('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8c66('0x9')][_0x8c66('0xa')]({'port':0x232a});config[_0x8c66('0xb')]=_[_0x8c66('0xc')](config[_0x8c66('0xb')],{'host':_0x8c66('0xd'),'port':0x18eb});var socket=require(_0x8c66('0xe'))(new Redis(config[_0x8c66('0xb')]));require('./chatWebsite.socket')[_0x8c66('0xf')](socket);function respondWithRpcPromise(_0xca04b2,_0xee86a3,_0x349035){return new BPromise(function(_0x9a2f47,_0x1a71d){return client[_0x8c66('0x10')](_0xca04b2,_0x349035)['then'](function(_0x506470){logger['info']('ChatWebsite,\x20%s,\x20%s',_0xee86a3,_0x8c66('0x11'));logger[_0x8c66('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xee86a3,'request\x20sent',JSON['stringify'](_0x506470));if(_0x506470[_0x8c66('0x13')]){if(_0x506470[_0x8c66('0x13')][_0x8c66('0x14')]===0x1f4){logger[_0x8c66('0x13')](_0x8c66('0x15'),_0xee86a3,_0x506470[_0x8c66('0x13')][_0x8c66('0x16')]);return _0x1a71d(_0x506470[_0x8c66('0x13')][_0x8c66('0x16')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0xee86a3,_0x506470['error'][_0x8c66('0x16')]);return _0x9a2f47(_0x506470[_0x8c66('0x13')][_0x8c66('0x16')]);}else{logger[_0x8c66('0x17')](_0x8c66('0x15'),_0xee86a3,_0x8c66('0x11'));_0x9a2f47(_0x506470['result']['message']);}})['catch'](function(_0x5f28ee){logger['error'](_0x8c66('0x15'),_0xee86a3,_0x5f28ee);_0x1a71d(_0x5f28ee);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index dec6311..7bd8d25 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 _0x5071=['remove','update','emit','removeListener','register','length','chatWebsite:','save'];(function(_0x1ccb2d,_0x5d5c94){var _0x420124=function(_0x52f02c){while(--_0x52f02c){_0x1ccb2d['push'](_0x1ccb2d['shift']());}};_0x420124(++_0x5d5c94);}(_0x5071,0x1af));var _0x1507=function(_0x1d5f43,_0x56277f){_0x1d5f43=_0x1d5f43-0x0;var _0xea8d41=_0x5071[_0x1d5f43];return _0xea8d41;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x1507('0x0'),_0x1507('0x1'),_0x1507('0x2')];function createListener(_0x211c2b,_0x4fe13f){return function(_0x16e8c2){_0x4fe13f[_0x1507('0x3')](_0x211c2b,_0x16e8c2);};}function removeListener(_0x11afb7,_0x43847a){return function(){ChatWebsiteEvents[_0x1507('0x4')](_0x11afb7,_0x43847a);};}exports[_0x1507('0x5')]=function(_0x1657ce){for(var _0x17e2e4=0x0,_0x13e62d=events[_0x1507('0x6')];_0x17e2e4<_0x13e62d;_0x17e2e4++){var _0x24cc95=events[_0x17e2e4];var _0x4db515=createListener(_0x1507('0x7')+_0x24cc95,_0x1657ce);ChatWebsiteEvents['on'](_0x24cc95,_0x4db515);}}; \ No newline at end of file +var _0xbc3b=['removeListener','register','length','./chatWebsite.events','save'];(function(_0x2b7fd3,_0x17556d){var _0x1bd260=function(_0x5d82dd){while(--_0x5d82dd){_0x2b7fd3['push'](_0x2b7fd3['shift']());}};_0x1bd260(++_0x17556d);}(_0xbc3b,0x1ca));var _0xbbc3=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0xbc3b[_0x5c8827];return _0x50ffd5;};'use strict';var ChatWebsiteEvents=require(_0xbbc3('0x0'));var events=[_0xbbc3('0x1'),'remove','update'];function createListener(_0x7b3387,_0x5b97cd){return function(_0x44c0df){_0x5b97cd['emit'](_0x7b3387,_0x44c0df);};}function removeListener(_0x56c0ee,_0x47e8f5){return function(){ChatWebsiteEvents[_0xbbc3('0x2')](_0x56c0ee,_0x47e8f5);};}exports[_0xbbc3('0x3')]=function(_0x2818e1){for(var _0x123d2f=0x0,_0x4529e2=events[_0xbbc3('0x4')];_0x123d2f<_0x4529e2;_0x123d2f++){var _0x42da4a=events[_0x123d2f];var _0x4618a1=createListener('chatWebsite:'+_0x42da4a,_0x2818e1);ChatWebsiteEvents['on'](_0x42da4a,_0x4618a1);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index bbc618c..10db288 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8e8=['test','exports','../../../utils/misc','escapeRegExp','replace','([\x5cw]+)','localhost'];(function(_0x2ab2b0,_0x464306){var _0x5ebe6d=function(_0x2bbdff){while(--_0x2bbdff){_0x2ab2b0['push'](_0x2ab2b0['shift']());}};_0x5ebe6d(++_0x464306);}(_0xe8e8,0xc6));var _0x8e8e=function(_0xf28428,_0xe6c75c){_0xf28428=_0xf28428-0x0;var _0x181b90=_0xe8e8[_0xf28428];return _0x181b90;};var escapeRegExp=require(_0x8e8e('0x0'))[_0x8e8e('0x1')];var URL=require('url')['URL'];function testWildcardValidity(_0xe4828b){var _0x122292=!![];try{new URL(_0xe4828b['replace']('*','localhost'));}catch(_0x27dc01){_0x122292=![];}return _0x122292&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0xe4828b);}function testWebsiteWithWildcard(_0x2e498a,_0x3e5977){var _0x355de7;var _0x294176=escapeRegExp(_0x2e498a['trim']()[_0x8e8e('0x2')](/\/$/,''))['replace']('\x5c*',_0x8e8e('0x3'));try{new URL(_0x2e498a[_0x8e8e('0x2')]('\x5c*',_0x8e8e('0x4')));_0x355de7=new RegExp(_0x294176)[_0x8e8e('0x5')](_0x3e5977);}catch(_0x40be2d){_0x355de7=![];}return _0x355de7;}module[_0x8e8e('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x955f=['test','localhost','exports','../../../utils/misc','escapeRegExp','url','URL','replace'];(function(_0x1cd939,_0x151936){var _0x1396fb=function(_0x4406a3){while(--_0x4406a3){_0x1cd939['push'](_0x1cd939['shift']());}};_0x1396fb(++_0x151936);}(_0x955f,0x1eb));var _0xf955=function(_0x45380b,_0x1b9f3a){_0x45380b=_0x45380b-0x0;var _0x7dc107=_0x955f[_0x45380b];return _0x7dc107;};var escapeRegExp=require(_0xf955('0x0'))[_0xf955('0x1')];var URL=require(_0xf955('0x2'))[_0xf955('0x3')];function testWildcardValidity(_0x2834f7){var _0x585f6e=!![];try{new URL(_0x2834f7[_0xf955('0x4')]('*','localhost'));}catch(_0x5d0c95){_0x585f6e=![];}return _0x585f6e&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xf955('0x5')](_0x2834f7);}function testWebsiteWithWildcard(_0x5a20bc,_0x13b796){var _0x2caff2;var _0x3fdac2=escapeRegExp(_0x5a20bc['trim']()[_0xf955('0x4')](/\/$/,''))[_0xf955('0x4')]('\x5c*','([\x5cw]+)');try{new URL(_0x5a20bc[_0xf955('0x4')]('\x5c*',_0xf955('0x6')));_0x2caff2=new RegExp(_0x3fdac2)[_0xf955('0x5')](_0x13b796);}catch(_0x38b190){_0x2caff2=![];}return _0x2caff2;}module[_0xf955('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index fd16b8d..6131908 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 _0x89b9=['ensureDir','replace','extname','/:id/offline','any','/:id/interactions','addInteraction','addApplications','addAgents','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','join','format','now','single','file','diskStorage','root','server/files/images/avatars/','originalname','addAvatar','%s-%s','/:id/customer_avatar','addCustomerAvatar','notify','attachments'];(function(_0x5861a3,_0x85e319){var _0x2d013d=function(_0x551227){while(--_0x551227){_0x5861a3['push'](_0x5861a3['shift']());}};_0x2d013d(++_0x85e319);}(_0x89b9,0x1a8));var _0x989b=function(_0x4223d8,_0x2f87b6){_0x4223d8=_0x4223d8-0x0;var _0x3721db=_0x89b9[_0x4223d8];return _0x3721db;};'use strict';var multer=require(_0x989b('0x0'));var util=require('util');var path=require(_0x989b('0x1'));var timeout=require(_0x989b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x989b('0x3'));var config=require(_0x989b('0x4'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x989b('0x5')](),controller[_0x989b('0x6')]);router[_0x989b('0x7')](_0x989b('0x8'),auth['isAuthenticated'](),controller[_0x989b('0x9')]);router[_0x989b('0x7')](_0x989b('0xa'),auth[_0x989b('0x5')](),controller[_0x989b('0xb')]);router[_0x989b('0x7')](_0x989b('0xc'),auth[_0x989b('0x5')](),controller[_0x989b('0xd')]);router['get'](_0x989b('0xe'),auth[_0x989b('0x5')](),controller[_0x989b('0xf')]);router[_0x989b('0x7')](_0x989b('0x10'),controller[_0x989b('0x11')]);router['get'](_0x989b('0x12'),controller['getAvatar']);router[_0x989b('0x7')]('/:id/customer_avatar',controller[_0x989b('0x13')]);router[_0x989b('0x7')](_0x989b('0x14'),controller[_0x989b('0x15')]);router[_0x989b('0x7')]('/:id/interactions',auth[_0x989b('0x5')](),controller['getInteractions']);router[_0x989b('0x7')](_0x989b('0x16'),controller[_0x989b('0x17')]);router[_0x989b('0x7')](_0x989b('0x18'),auth[_0x989b('0x5')](),controller[_0x989b('0x19')]);router[_0x989b('0x7')](_0x989b('0x1a'),auth['isAuthenticated'](),controller[_0x989b('0x1b')]);router[_0x989b('0x7')](_0x989b('0x1c'),controller[_0x989b('0x1d')]);router[_0x989b('0x7')](_0x989b('0x1e'),auth[_0x989b('0x5')](),controller[_0x989b('0x1f')]);router[_0x989b('0x7')](_0x989b('0x20'),auth[_0x989b('0x5')](),controller[_0x989b('0x21')]);router[_0x989b('0x22')]('/',auth['isAuthenticated'](),controller[_0x989b('0x23')]);router[_0x989b('0x22')](_0x989b('0xc'),auth[_0x989b('0x5')](),controller['addDisposition']);router[_0x989b('0x22')]('/:id/canned_answers',auth[_0x989b('0x5')](),controller[_0x989b('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x274550,_0x395f7b,_0x29662f){_0x29662f(null,path[_0x989b('0x25')](config['root'],'server/files/images/logos/'));},'filename':function(_0x26c832,_0xb88801,_0x1fd1a2){_0x1fd1a2(null,util[_0x989b('0x26')]('%s-%s',Date[_0x989b('0x27')](),_0xb88801['originalname']));}})});router[_0x989b('0x22')]('/:id/logo',upload[_0x989b('0x28')](_0x989b('0x29')),controller['addLogo']);var upload=multer({'storage':multer[_0x989b('0x2a')]({'destination':function(_0x1256ca,_0x1a5d89,_0xfdf956){_0xfdf956(null,path[_0x989b('0x25')](config[_0x989b('0x2b')],_0x989b('0x2c')));},'filename':function(_0x388865,_0x49ea83,_0x3299a6){_0x3299a6(null,util['format']('%s-%s',Date['now'](),_0x49ea83[_0x989b('0x2d')]));}})});router[_0x989b('0x22')](_0x989b('0x12'),upload[_0x989b('0x28')](_0x989b('0x29')),controller[_0x989b('0x2e')]);var upload=multer({'storage':multer[_0x989b('0x2a')]({'destination':function(_0x3890c2,_0xde1237,_0x3c2e2f){_0x3c2e2f(null,path[_0x989b('0x25')](config[_0x989b('0x2b')],_0x989b('0x2c')));},'filename':function(_0x147af6,_0x342665,_0x1dcc3a){_0x1dcc3a(null,util[_0x989b('0x26')](_0x989b('0x2f'),Date[_0x989b('0x27')](),_0x342665[_0x989b('0x2d')]));}})});router[_0x989b('0x22')](_0x989b('0x30'),upload[_0x989b('0x28')](_0x989b('0x29')),controller[_0x989b('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12973e,_0x59c929,_0x4dfb2a){_0x4dfb2a(null,path[_0x989b('0x25')](config[_0x989b('0x2b')],_0x989b('0x2c')));},'filename':function(_0x14795f,_0x58d263,_0x5dcdec){_0x5dcdec(null,util[_0x989b('0x26')](_0x989b('0x2f'),Date['now'](),_0x58d263['originalname']));}})});router[_0x989b('0x22')](_0x989b('0x14'),upload[_0x989b('0x28')]('file'),controller['addSystemAvatar']);router[_0x989b('0x22')]('/:id/notify',controller[_0x989b('0x32')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x42d251,_0x213a54,_0xce1633){const _0x357b0c=path['join'](config[_0x989b('0x2b')],'server/files',_0x989b('0x33'),'offline-chat');fs_extra[_0x989b('0x34')](_0x357b0c,function(){_0xce1633(null,_0x357b0c);});},'filename':function(_0x337e5c,_0x4e891a,_0x382d5a){const _0x17ba2c=_0x4e891a['originalname'][_0x989b('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1d0bbc=path[_0x989b('0x36')](_0x17ba2c);const _0x850a36=Date[_0x989b('0x27')]()+'-'+_0x17ba2c['replace'](_0x1d0bbc,'')+_0x1d0bbc;_0x382d5a(null,_0x850a36);}})});router[_0x989b('0x22')](_0x989b('0x37'),offlineUploadMulter[_0x989b('0x38')](),controller['offline']);router[_0x989b('0x22')](_0x989b('0x39'),auth['isAuthenticated'](),controller[_0x989b('0x3a')]);router[_0x989b('0x22')](_0x989b('0x18'),auth[_0x989b('0x5')](),controller[_0x989b('0x3b')]);router['post'](_0x989b('0x1a'),auth[_0x989b('0x5')](),controller['addProactiveActions']);router[_0x989b('0x22')](_0x989b('0x20'),auth['isAuthenticated'](),controller[_0x989b('0x3c')]);router['put'](_0x989b('0xa'),auth[_0x989b('0x5')](),controller[_0x989b('0x3d')]);router['delete'](_0x989b('0xa'),auth[_0x989b('0x5')](),controller[_0x989b('0x3e')]);router['delete'](_0x989b('0xc'),auth[_0x989b('0x5')](),controller[_0x989b('0x3f')]);router[_0x989b('0x40')](_0x989b('0xe'),auth[_0x989b('0x5')](),controller[_0x989b('0x41')]);router[_0x989b('0x40')]('/:id/users',auth[_0x989b('0x5')](),controller[_0x989b('0x42')]);module[_0x989b('0x43')]=router; \ No newline at end of file +var _0xf91f=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','format','now','originalname','single','file','addLogo','server/files/images/avatars/','%s-%s','addAvatar','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeAnswers','removeAgents','exports'];(function(_0x1a8207,_0x576621){var _0x4bc774=function(_0x228d2e){while(--_0x228d2e){_0x1a8207['push'](_0x1a8207['shift']());}};_0x4bc774(++_0x576621);}(_0xf91f,0x96));var _0xff91=function(_0x297e21,_0x33a186){_0x297e21=_0x297e21-0x0;var _0x3593fe=_0xf91f[_0x297e21];return _0x3593fe;};'use strict';var multer=require(_0xff91('0x0'));var util=require(_0xff91('0x1'));var path=require(_0xff91('0x2'));var timeout=require(_0xff91('0x3'));var express=require(_0xff91('0x4'));var router=express[_0xff91('0x5')]();var fs_extra=require(_0xff91('0x6'));var auth=require(_0xff91('0x7'));var interaction=require(_0xff91('0x8'));var config=require('../../config/environment');var controller=require(_0xff91('0x9'));router[_0xff91('0xa')]('/',auth['isAuthenticated'](),controller[_0xff91('0xb')]);router[_0xff91('0xa')](_0xff91('0xc'),auth[_0xff91('0xd')](),controller[_0xff91('0xe')]);router[_0xff91('0xa')](_0xff91('0xf'),auth[_0xff91('0xd')](),controller['show']);router[_0xff91('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xff91('0x10')]);router[_0xff91('0xa')]('/:id/canned_answers',auth[_0xff91('0xd')](),controller['getAnswers']);router['get'](_0xff91('0x11'),controller[_0xff91('0x12')]);router['get'](_0xff91('0x13'),controller[_0xff91('0x14')]);router['get'](_0xff91('0x15'),controller['getCustomerAvatar']);router[_0xff91('0xa')](_0xff91('0x16'),controller['getSystemAvatar']);router[_0xff91('0xa')](_0xff91('0x17'),auth[_0xff91('0xd')](),controller[_0xff91('0x18')]);router[_0xff91('0xa')]('/:id/snippet',controller[_0xff91('0x19')]);router['get'](_0xff91('0x1a'),auth[_0xff91('0xd')](),controller[_0xff91('0x1b')]);router['get'](_0xff91('0x1c'),auth['isAuthenticated'](),controller[_0xff91('0x1d')]);router[_0xff91('0xa')](_0xff91('0x1e'),controller[_0xff91('0x1f')]);router['get'](_0xff91('0x20'),auth[_0xff91('0xd')](),controller['getOfflineMessages']);router[_0xff91('0xa')](_0xff91('0x21'),auth[_0xff91('0xd')](),controller[_0xff91('0x22')]);router[_0xff91('0x23')]('/',auth[_0xff91('0xd')](),controller[_0xff91('0x24')]);router['post'](_0xff91('0x25'),auth[_0xff91('0xd')](),controller[_0xff91('0x26')]);router['post'](_0xff91('0x27'),auth[_0xff91('0xd')](),controller[_0xff91('0x28')]);var upload=multer({'storage':multer[_0xff91('0x29')]({'destination':function(_0x294702,_0x331ddd,_0x284f3c){_0x284f3c(null,path[_0xff91('0x2a')](config[_0xff91('0x2b')],'server/files/images/logos/'));},'filename':function(_0x4f14bf,_0x2755bb,_0x11ef0d){_0x11ef0d(null,util[_0xff91('0x2c')]('%s-%s',Date[_0xff91('0x2d')](),_0x2755bb[_0xff91('0x2e')]));}})});router[_0xff91('0x23')](_0xff91('0x11'),upload[_0xff91('0x2f')](_0xff91('0x30')),controller[_0xff91('0x31')]);var upload=multer({'storage':multer[_0xff91('0x29')]({'destination':function(_0x99e078,_0x43b287,_0x587be4){_0x587be4(null,path[_0xff91('0x2a')](config[_0xff91('0x2b')],_0xff91('0x32')));},'filename':function(_0x5bd3f4,_0xbf555c,_0x14a2c4){_0x14a2c4(null,util[_0xff91('0x2c')](_0xff91('0x33'),Date['now'](),_0xbf555c['originalname']));}})});router[_0xff91('0x23')](_0xff91('0x13'),upload[_0xff91('0x2f')](_0xff91('0x30')),controller[_0xff91('0x34')]);var upload=multer({'storage':multer[_0xff91('0x29')]({'destination':function(_0x3c7548,_0x1a4ade,_0x365672){_0x365672(null,path[_0xff91('0x2a')](config['root'],_0xff91('0x32')));},'filename':function(_0x40d015,_0x3471ce,_0x3a7881){_0x3a7881(null,util[_0xff91('0x2c')]('%s-%s',Date[_0xff91('0x2d')](),_0x3471ce['originalname']));}})});router['post'](_0xff91('0x15'),upload[_0xff91('0x2f')]('file'),controller[_0xff91('0x35')]);var upload=multer({'storage':multer[_0xff91('0x29')]({'destination':function(_0x36ecd4,_0x283b21,_0x182cd8){_0x182cd8(null,path['join'](config[_0xff91('0x2b')],_0xff91('0x32')));},'filename':function(_0x391bcd,_0x3697b2,_0x8ad23e){_0x8ad23e(null,util['format']('%s-%s',Date[_0xff91('0x2d')](),_0x3697b2[_0xff91('0x2e')]));}})});router[_0xff91('0x23')](_0xff91('0x16'),upload[_0xff91('0x2f')](_0xff91('0x30')),controller['addSystemAvatar']);router[_0xff91('0x23')](_0xff91('0x36'),controller[_0xff91('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x152ba8,_0x1fc252,_0x20e719){const _0x1fe321=path[_0xff91('0x2a')](config[_0xff91('0x2b')],_0xff91('0x38'),_0xff91('0x39'),_0xff91('0x3a'));fs_extra[_0xff91('0x3b')](_0x1fe321,function(){_0x20e719(null,_0x1fe321);});},'filename':function(_0x5e305a,_0x41dfaf,_0x47e772){const _0x3b10f1=_0x41dfaf[_0xff91('0x2e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1b3db9=path[_0xff91('0x3c')](_0x3b10f1);const _0x568b14=Date[_0xff91('0x2d')]()+'-'+_0x3b10f1[_0xff91('0x3d')](_0x1b3db9,'')+_0x1b3db9;_0x47e772(null,_0x568b14);}})});router[_0xff91('0x23')](_0xff91('0x3e'),offlineUploadMulter[_0xff91('0x3f')](),controller[_0xff91('0x40')]);router[_0xff91('0x23')]('/:id/interactions',auth[_0xff91('0xd')](),controller[_0xff91('0x41')]);router['post'](_0xff91('0x1a'),auth[_0xff91('0xd')](),controller[_0xff91('0x42')]);router['post'](_0xff91('0x1c'),auth['isAuthenticated'](),controller[_0xff91('0x43')]);router[_0xff91('0x23')](_0xff91('0x21'),auth[_0xff91('0xd')](),controller[_0xff91('0x44')]);router['put'](_0xff91('0xf'),auth['isAuthenticated'](),controller[_0xff91('0x45')]);router[_0xff91('0x46')](_0xff91('0xf'),auth[_0xff91('0xd')](),controller[_0xff91('0x47')]);router['delete'](_0xff91('0x25'),auth[_0xff91('0xd')](),controller['removeDispositions']);router[_0xff91('0x46')](_0xff91('0x27'),auth[_0xff91('0xd')](),controller[_0xff91('0x48')]);router[_0xff91('0x46')](_0xff91('0x21'),auth['isAuthenticated'](),controller[_0xff91('0x49')]);module[_0xff91('0x4a')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index a7c162f..f2d44a9 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 _0x3bf9=['expressEndpoint','isAuthenticated','exports','beaver-logger/server','../config/environment','Router','app','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x4a6f5a,_0xefdce3){var _0x305a88=function(_0x21fe9){while(--_0x21fe9){_0x4a6f5a['push'](_0x4a6f5a['shift']());}};_0x305a88(++_0xefdce3);}(_0x3bf9,0xdb));var _0x93bf=function(_0x335a61,_0x21b879){_0x335a61=_0x335a61-0x0;var _0x48a02b=_0x3bf9[_0x335a61];return _0x48a02b;};var beaverLogger=require(_0x93bf('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x93bf('0x1'));var router=express[_0x93bf('0x2')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x322be0,_0x102cee,_0x37c850){var _0x35a942=_0x322be0[_0x93bf('0x3')]['get'](_0x93bf('0x4'));if(!_0x35a942){throw new Error(_0x93bf('0x5'));}return beaverLogger[_0x93bf('0x6')]({'uri':'/client-logs','logger':_0x35a942,'enableCors':!isProduction})(_0x322be0,_0x102cee,_0x37c850);}router['use'](auth[_0x93bf('0x7')](),clientSideLogs);module[_0x93bf('0x8')]=router; \ No newline at end of file +var _0xa370=['beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','exports'];(function(_0x80d25e,_0x847670){var _0x51d35c=function(_0x327602){while(--_0x327602){_0x80d25e['push'](_0x80d25e['shift']());}};_0x51d35c(++_0x847670);}(_0xa370,0x75));var _0x0a37=function(_0x2eb298,_0x223aa0){_0x2eb298=_0x2eb298-0x0;var _0x4927ad=_0xa370[_0x2eb298];return _0x4927ad;};var beaverLogger=require(_0x0a37('0x0'));var express=require(_0x0a37('0x1'));var auth=require(_0x0a37('0x2'));var config=require(_0x0a37('0x3'));var router=express[_0x0a37('0x4')]();var isProduction=config[_0x0a37('0x5')]===_0x0a37('0x6')||![];function clientSideLogs(_0x2cc531,_0x2bb636,_0x3691e0){var _0x3408db=_0x2cc531['app'][_0x0a37('0x7')](_0x0a37('0x8'));if(!_0x3408db){throw new Error(_0x0a37('0x9'));}return beaverLogger[_0x0a37('0xa')]({'uri':'/client-logs','logger':_0x3408db,'enableCors':!isProduction})(_0x2cc531,_0x2bb636,_0x3691e0);}router[_0x0a37('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0x0a37('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c84181b..4b502c0 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 _0x6ad3=['sequelize','exports','STRING','Google','MicrosoftAzure','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x33d081,_0x3d90c1){var _0x2457c9=function(_0x85a718){while(--_0x85a718){_0x33d081['push'](_0x33d081['shift']());}};_0x2457c9(++_0x3d90c1);}(_0x6ad3,0xd2));var _0x36ad=function(_0x111494,_0x1d73da){_0x111494=_0x111494-0x0;var _0x1d0d8b=_0x6ad3[_0x111494];return _0x1d0d8b;};'use strict';var Sequelize=require(_0x36ad('0x0'));module[_0x36ad('0x1')]={'name':{'type':Sequelize[_0x36ad('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x36ad('0x3'),_0x36ad('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x36ad('0x5')](_0x36ad('0x6'),_0x36ad('0x7'))},'data1':{'type':Sequelize[_0x36ad('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x36ad('0x2')],'comment':_0x36ad('0x8')},'data4':{'type':Sequelize[_0x36ad('0x2')],'comment':_0x36ad('0x9')},'data5':{'type':Sequelize[_0x36ad('0xa')],'comment':_0x36ad('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0x36ad('0xc')},'data7':{'type':Sequelize['TEXT'],'comment':_0x36ad('0xd')}}; \ No newline at end of file +var _0xe585=['MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google'];(function(_0x4d08d1,_0x347782){var _0x588583=function(_0x438f23){while(--_0x438f23){_0x4d08d1['push'](_0x4d08d1['shift']());}};_0x588583(++_0x347782);}(_0xe585,0xb1));var _0x5e58=function(_0x3fd26b,_0x57d710){_0x3fd26b=_0x3fd26b-0x0;var _0x188200=_0xe585[_0x3fd26b];return _0x188200;};'use strict';var Sequelize=require(_0x5e58('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e58('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5e58('0x2')](_0x5e58('0x3'),_0x5e58('0x4'),_0x5e58('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5e58('0x2')](_0x5e58('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0x5e58('0x1')],'comment':_0x5e58('0x7')},'data2':{'type':Sequelize[_0x5e58('0x1')],'comment':_0x5e58('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0x5e58('0x9')},'data4':{'type':Sequelize[_0x5e58('0x1')],'comment':_0x5e58('0xa')},'data5':{'type':Sequelize[_0x5e58('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x5e58('0xb')],'comment':_0x5e58('0xc')},'data7':{'type':Sequelize[_0x5e58('0xb')],'comment':_0x5e58('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 8ac582d..eb31b75 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 _0x2f9d=['rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','find','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','sendStatus','error','name','padEnd','slice','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','CloudProvider','findAll'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x2f9d,0x1a5));var _0xd2f9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2f9d[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xd2f9('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xd2f9('0x1'));var config=require(_0xd2f9('0x2'));var logger=require('../../config/logger')(_0xd2f9('0x3'));var db=require(_0xd2f9('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xd2f9('0x5')]=_['defaults'](config[_0xd2f9('0x5')],{'host':_0xd2f9('0x6'),'port':0x18eb});var socket=require(_0xd2f9('0x7'))(new Redis(config[_0xd2f9('0x5')]));var redis=new Redis(config[_0xd2f9('0x5')]);function respondWithStatusCode(_0x5c414f,_0x479c08){_0x479c08=_0x479c08||0xcc;return function(_0x2bc80d){if(_0x2bc80d){return _0x5c414f['sendStatus'](_0x479c08);}return _0x5c414f[_0xd2f9('0x8')](_0x479c08)['end']();};}function respondWithResult(_0xb353e8,_0x4f1b74){_0x4f1b74=_0x4f1b74||0xc8;return function(_0x32bbe7){if(_0x32bbe7){return _0xb353e8[_0xd2f9('0x8')](_0x4f1b74)[_0xd2f9('0x9')](_0x32bbe7);}};}function respondWithFilteredResult(_0x5d4683,_0xeda6ba){return function(_0x4f1fb8){if(_0x4f1fb8){var _0x179fce=typeof _0xeda6ba[_0xd2f9('0xa')]===_0xd2f9('0xb')&&typeof _0xeda6ba[_0xd2f9('0xc')]===_0xd2f9('0xb');var _0x3c639f=_0x4f1fb8[_0xd2f9('0xd')];var _0xd5550b=_0x179fce?0x0:_0xeda6ba[_0xd2f9('0xa')];var _0x26270a=_0x179fce?_0x4f1fb8['count']:_0xeda6ba[_0xd2f9('0xa')]+_0xeda6ba[_0xd2f9('0xc')];var _0x512002;if(_0x26270a>=_0x3c639f){_0x26270a=_0x3c639f;_0x512002=0xc8;}else{_0x512002=0xce;}_0x5d4683[_0xd2f9('0x8')](_0x512002);return _0x5d4683['set'](_0xd2f9('0xe'),_0xd5550b+'-'+_0x26270a+'/'+_0x3c639f)[_0xd2f9('0x9')](_0x4f1fb8);}return null;};}function saveUpdates(_0x2b74e6){return function(_0x4b84d9){if(_0x4b84d9){return _0x4b84d9[_0xd2f9('0xf')](_0x2b74e6)[_0xd2f9('0x10')](function(_0xccb738){return _0xccb738;});}return null;};}function removeEntity(_0x3c2191){return function(_0x5db6ef){if(_0x5db6ef){return _0x5db6ef[_0xd2f9('0x11')]()[_0xd2f9('0x10')](function(){_0x3c2191[_0xd2f9('0x8')](0xcc)[_0xd2f9('0x12')]();});}};}function handleEntityNotFound(_0x3f15ca){return function(_0x780721){if(!_0x780721){_0x3f15ca[_0xd2f9('0x13')](0x194);}return _0x780721;};}function handleError(_0x1440ae,_0x89ad48){_0x89ad48=_0x89ad48||0x1f4;return function(_0xa54b99){logger[_0xd2f9('0x14')](_0xa54b99['stack']);if(_0xa54b99[_0xd2f9('0x15')]){delete _0xa54b99[_0xd2f9('0x15')];}_0x1440ae[_0xd2f9('0x8')](_0x89ad48)['send'](_0xa54b99);};}function maskClientSecret(_0x439bf1){return _[_0xd2f9('0x16')](_0x439bf1[_0xd2f9('0x17')](0x0,0x3),0x14,'*');}exports[_0xd2f9('0x18')]=function(_0x4981a7,_0x40522c){var _0x455404={},_0x30adb6={},_0x4d245c={'count':0x0,'rows':[]};var _0x219563=_[_0xd2f9('0x19')](db['CloudProvider'][_0xd2f9('0x1a')],function(_0x316e63){return{'name':_0x316e63[_0xd2f9('0x1b')],'type':_0x316e63[_0xd2f9('0x1c')][_0xd2f9('0x1d')]};});_0x30adb6[_0xd2f9('0x1e')]=_[_0xd2f9('0x19')](_0x219563,_0xd2f9('0x15'));_0x30adb6[_0xd2f9('0x1f')]=_[_0xd2f9('0x20')](_0x4981a7[_0xd2f9('0x1f')]);_0x30adb6[_0xd2f9('0x21')]=_[_0xd2f9('0x22')](_0x30adb6[_0xd2f9('0x1e')],_0x30adb6[_0xd2f9('0x1f')]);_0x455404[_0xd2f9('0x23')]=_[_0xd2f9('0x22')](_0x30adb6['model'],qs[_0xd2f9('0x24')](_0x4981a7['query'][_0xd2f9('0x24')]));_0x455404[_0xd2f9('0x23')]=_0x455404[_0xd2f9('0x23')][_0xd2f9('0x25')]?_0x455404[_0xd2f9('0x23')]:_0x30adb6[_0xd2f9('0x1e')];if(!_0x4981a7[_0xd2f9('0x1f')][_0xd2f9('0x26')](_0xd2f9('0x27'))){_0x455404[_0xd2f9('0xc')]=qs['limit'](_0x4981a7[_0xd2f9('0x1f')][_0xd2f9('0xc')]);_0x455404[_0xd2f9('0xa')]=qs['offset'](_0x4981a7[_0xd2f9('0x1f')][_0xd2f9('0xa')]);}_0x455404[_0xd2f9('0x28')]=qs[_0xd2f9('0x29')](_0x4981a7[_0xd2f9('0x1f')][_0xd2f9('0x29')]);_0x455404[_0xd2f9('0x2a')]=qs[_0xd2f9('0x21')](_[_0xd2f9('0x2b')](_0x4981a7[_0xd2f9('0x1f')],_0x30adb6['filters']),_0x219563);if(_0x4981a7[_0xd2f9('0x1f')]['filter']){_0x455404['where']=_[_0xd2f9('0x2c')](_0x455404[_0xd2f9('0x2a')],{'$or':_[_0xd2f9('0x19')](_0x219563,function(_0x102cfa){if(_0x102cfa[_0xd2f9('0x1c')]!=='VIRTUAL'){var _0x583c47={};_0x583c47[_0x102cfa[_0xd2f9('0x15')]]={'$like':'%'+_0x4981a7[_0xd2f9('0x1f')]['filter']+'%'};return _0x583c47;}})});}_0x455404=_[_0xd2f9('0x2c')]({},_0x455404,_0x4981a7[_0xd2f9('0x2d')]);var _0xa58733={'where':_0x455404['where']};return db['CloudProvider']['count'](_0xa58733)[_0xd2f9('0x10')](function(_0xcbd1d7){_0x4d245c['count']=_0xcbd1d7;if(_0x4981a7['query'][_0xd2f9('0x2e')]){_0x455404['include']=[{'all':!![]}];}return db[_0xd2f9('0x2f')][_0xd2f9('0x30')](_0x455404);})[_0xd2f9('0x10')](function(_0x32b188){_0x4d245c[_0xd2f9('0x31')]=_['map'](_0x32b188,function(_0xa0d0e7){if(_0xa0d0e7[_0xd2f9('0x32')]===_0xd2f9('0x33')){var _0xd03981=encryptor[_0xd2f9('0x34')](_0xa0d0e7[_0xd2f9('0x35')]);_0xa0d0e7[_0xd2f9('0x35')]=maskClientSecret(_0xd03981);}return _0xa0d0e7;});return _0x4d245c;})[_0xd2f9('0x10')](respondWithFilteredResult(_0x40522c,_0x455404))[_0xd2f9('0x36')](handleError(_0x40522c,null));};exports[_0xd2f9('0x37')]=function(_0x53608c,_0x48b7d2){var _0x45dc56={'raw':!![],'where':{'id':_0x53608c[_0xd2f9('0x38')]['id']}},_0x59e1aa={};_0x59e1aa[_0xd2f9('0x1e')]=_['keys'](db[_0xd2f9('0x2f')]['rawAttributes']);_0x59e1aa[_0xd2f9('0x1f')]=_[_0xd2f9('0x20')](_0x53608c[_0xd2f9('0x1f')]);_0x59e1aa[_0xd2f9('0x21')]=_['intersection'](_0x59e1aa['model'],_0x59e1aa[_0xd2f9('0x1f')]);_0x45dc56['attributes']=_['intersection'](_0x59e1aa[_0xd2f9('0x1e')],qs[_0xd2f9('0x24')](_0x53608c[_0xd2f9('0x1f')][_0xd2f9('0x24')]));_0x45dc56[_0xd2f9('0x23')]=_0x45dc56[_0xd2f9('0x23')][_0xd2f9('0x25')]?_0x45dc56[_0xd2f9('0x23')]:_0x59e1aa['model'];if(_0x53608c['query'][_0xd2f9('0x2e')]){_0x45dc56['include']=[{'all':!![]}];}_0x45dc56=_[_0xd2f9('0x2c')]({},_0x45dc56,_0x53608c['options']);return db[_0xd2f9('0x2f')][_0xd2f9('0x39')](_0x45dc56)[_0xd2f9('0x10')](handleEntityNotFound(_0x48b7d2,null))[_0xd2f9('0x10')](function(_0x3c567a){if(_0x3c567a[_0xd2f9('0x32')]===_0xd2f9('0x33')){var _0xd01769=encryptor[_0xd2f9('0x34')](_0x3c567a['data3']);_0x3c567a['data3']=maskClientSecret(_0xd01769);}return _0x3c567a;})['then'](respondWithResult(_0x48b7d2,null))[_0xd2f9('0x36')](handleError(_0x48b7d2,null));};exports[_0xd2f9('0x3a')]=function(_0x3c62e7,_0x33038f){if(!_0x3c62e7['body'][_0xd2f9('0x15')])throw new Error(_0xd2f9('0x3b'));if(!_0x3c62e7[_0xd2f9('0x3c')][_0xd2f9('0x32')])throw new Error(_0xd2f9('0x3d'));var _0x3f090f=db['CloudProvider'][_0xd2f9('0x1a')]['service']['values'];if(!_0x3f090f['includes'](_0x3c62e7['body'][_0xd2f9('0x32')]))throw new Error(_0xd2f9('0x3e')+_0x3f090f[_0xd2f9('0x3f')](',\x20'));if(_0x3c62e7[_0xd2f9('0x3c')][_0xd2f9('0x32')]===_0xd2f9('0x33')&&_0x3c62e7[_0xd2f9('0x3c')][_0xd2f9('0x35')]){_0x3c62e7[_0xd2f9('0x3c')][_0xd2f9('0x35')]=encryptor['encryptString'](_0x3c62e7['body'][_0xd2f9('0x35')]);}return db['CloudProvider'][_0xd2f9('0x3a')](_0x3c62e7[_0xd2f9('0x3c')],{})[_0xd2f9('0x10')](respondWithResult(_0x33038f,0xc9))[_0xd2f9('0x36')](handleError(_0x33038f,null));};exports[_0xd2f9('0xf')]=function(_0x5e192a,_0x1ce2d2){if(_0x5e192a['body']['id']){delete _0x5e192a[_0xd2f9('0x3c')]['id'];}return db[_0xd2f9('0x2f')][_0xd2f9('0x39')]({'where':{'id':_0x5e192a[_0xd2f9('0x38')]['id']}})[_0xd2f9('0x10')](handleEntityNotFound(_0x1ce2d2,null))[_0xd2f9('0x10')](function(_0x1455b5){if(_0x1455b5[_0xd2f9('0x32')]===_0xd2f9('0x33')&&_0x5e192a[_0xd2f9('0x3c')][_0xd2f9('0x35')]){_0x5e192a[_0xd2f9('0x3c')][_0xd2f9('0x35')]=encryptor[_0xd2f9('0x40')](_0x5e192a[_0xd2f9('0x3c')][_0xd2f9('0x35')]);}return _0x1455b5;})['then'](saveUpdates(_0x5e192a[_0xd2f9('0x3c')],null))['then'](respondWithResult(_0x1ce2d2,null))[_0xd2f9('0x36')](handleError(_0x1ce2d2,null));};exports[_0xd2f9('0x11')]=function(_0x294e0f,_0x4db732){return db[_0xd2f9('0x2f')][_0xd2f9('0x39')]({'where':{'id':_0x294e0f[_0xd2f9('0x38')]['id']}})['then'](handleEntityNotFound(_0x4db732,null))[_0xd2f9('0x10')](removeEntity(_0x4db732,null))[_0xd2f9('0x36')](handleError(_0x4db732,null));};exports[_0xd2f9('0x41')]=function(_0x453b5b,_0x542f5d){return db['CloudProvider'][_0xd2f9('0x42')]({'where':{'id':_0x453b5b['params']['id']},'raw':!![]})[_0xd2f9('0x10')](function(_0x3e7aab){if(!_0x3e7aab)return _0x542f5d[_0xd2f9('0x13')](0x194);return{'url':oauth[_0xd2f9('0x43')](_0x3e7aab,_0x453b5b[_0xd2f9('0x44')]['id'])};})[_0xd2f9('0x10')](respondWithResult(_0x542f5d,null))[_0xd2f9('0x36')](handleError(_0x542f5d,null));};exports[_0xd2f9('0x45')]=function(_0x31188b,_0x3b2d3b){var _0x4c2497=_0x31188b['body'];var _0xfc7150;var _0x5c17f1;if(_0x4c2497[_0xd2f9('0x14')])throw _0x4c2497;redis[_0xd2f9('0x46')](_0x4c2497[_0xd2f9('0x47')])[_0xd2f9('0x10')](function(_0x1ac1b0){if(!_0x1ac1b0)throw new Error(_0xd2f9('0x48'));_0xfc7150=JSON[_0xd2f9('0x49')](_0x1ac1b0);var _0x5ef9e9=Buffer[_0xd2f9('0x4a')](_0x4c2497['state'],'base64')[_0xd2f9('0x4b')](_0xd2f9('0x4c'));_0x5c17f1=JSON[_0xd2f9('0x49')](_0x5ef9e9);if(!oauth[_0xd2f9('0x4d')](_0x4c2497['id_token'],_0xfc7150[_0xd2f9('0x4e')]))throw new Error(_0xd2f9('0x4f'));redis[_0xd2f9('0x50')](_0x4c2497[_0xd2f9('0x47')]);return oauth[_0xd2f9('0x51')](_0x4c2497[_0xd2f9('0x52')],_0xfc7150);})[_0xd2f9('0x10')](function(_0x290ff8){_0xfc7150['data5']=_0x290ff8[_0xd2f9('0x53')];_0xfc7150[_0xd2f9('0x54')]=_0x290ff8[_0xd2f9('0x55')];return db[_0xd2f9('0x2f')]['update']({'data5':_0xfc7150['data5'],'data6':_0xfc7150[_0xd2f9('0x54')]},{'where':{'id':_0xfc7150['id']}});})[_0xd2f9('0x10')](function(){oauth[_0xd2f9('0x56')](_0xfc7150);socket[_0xd2f9('0x57')](_0xd2f9('0x58'),{'id':_0x5c17f1['id']});return;})[_0xd2f9('0x10')](respondWithStatusCode(_0x3b2d3b,null))[_0xd2f9('0x36')](function(_0x18ff94){if(_0x5c17f1){socket[_0xd2f9('0x57')](_0xd2f9('0x59'),{'id':_0x5c17f1['id']});}if(!_0xfc7150){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x18ff94);return _0x3b2d3b[_0xd2f9('0x8')](0x1f4)[_0xd2f9('0x5a')](_0x18ff94[_0xd2f9('0x5b')]);}logger['error'](_0xd2f9('0x5c'),_0xfc7150['id'],JSON[_0xd2f9('0x5d')](_0x18ff94));});}; \ No newline at end of file +var _0x0bff=['where','merge','type','VIRTUAL','options','include','findAll','rows','decryptString','data3','catch','show','params','intersection','length','includeAll','find','service','MicrosoftAzure','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','from','state','base64','ascii','parse','isValidIdToken','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','access_token','refresh_token','data5','data6','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','update','then','error','name','send','padEnd','slice','map','CloudProvider','rawAttributes','fieldName','key','model','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x432ab9,_0x145871){var _0x4abda9=function(_0x285a29){while(--_0x285a29){_0x432ab9['push'](_0x432ab9['shift']());}};_0x4abda9(++_0x145871);}(_0x0bff,0x92));var _0xf0bf=function(_0xe6b592,_0x93269b){_0xe6b592=_0xe6b592-0x0;var _0x240431=_0x0bff[_0xe6b592];return _0x240431;};'use strict';var _=require(_0xf0bf('0x0'));var Redis=require('ioredis');var qs=require(_0xf0bf('0x1'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0xf0bf('0x2'))(_0xf0bf('0x3'));var db=require(_0xf0bf('0x4'))['db'];var oauth=require(_0xf0bf('0x5'));config[_0xf0bf('0x6')]=_['defaults'](config[_0xf0bf('0x6')],{'host':_0xf0bf('0x7'),'port':0x18eb});var socket=require(_0xf0bf('0x8'))(new Redis(config[_0xf0bf('0x6')]));var redis=new Redis(config[_0xf0bf('0x6')]);function respondWithStatusCode(_0x651810,_0x10c0e2){_0x10c0e2=_0x10c0e2||0xcc;return function(_0xd8631e){if(_0xd8631e){return _0x651810[_0xf0bf('0x9')](_0x10c0e2);}return _0x651810[_0xf0bf('0xa')](_0x10c0e2)[_0xf0bf('0xb')]();};}function respondWithResult(_0x419901,_0xfc556a){_0xfc556a=_0xfc556a||0xc8;return function(_0x4c2350){if(_0x4c2350){return _0x419901[_0xf0bf('0xa')](_0xfc556a)[_0xf0bf('0xc')](_0x4c2350);}};}function respondWithFilteredResult(_0x27eb89,_0x2e8731){return function(_0x4f9c49){if(_0x4f9c49){var _0x2a21ed=typeof _0x2e8731[_0xf0bf('0xd')]==='undefined'&&typeof _0x2e8731[_0xf0bf('0xe')]===_0xf0bf('0xf');var _0x5b315d=_0x4f9c49[_0xf0bf('0x10')];var _0x2c118e=_0x2a21ed?0x0:_0x2e8731[_0xf0bf('0xd')];var _0x16cc89=_0x2a21ed?_0x4f9c49[_0xf0bf('0x10')]:_0x2e8731[_0xf0bf('0xd')]+_0x2e8731[_0xf0bf('0xe')];var _0xe1f8cd;if(_0x16cc89>=_0x5b315d){_0x16cc89=_0x5b315d;_0xe1f8cd=0xc8;}else{_0xe1f8cd=0xce;}_0x27eb89['status'](_0xe1f8cd);return _0x27eb89[_0xf0bf('0x11')]('Content-Range',_0x2c118e+'-'+_0x16cc89+'/'+_0x5b315d)[_0xf0bf('0xc')](_0x4f9c49);}return null;};}function saveUpdates(_0x139ca5){return function(_0x17fad0){if(_0x17fad0){return _0x17fad0[_0xf0bf('0x12')](_0x139ca5)[_0xf0bf('0x13')](function(_0x255d16){return _0x255d16;});}return null;};}function removeEntity(_0xaa63a7){return function(_0x862e1e){if(_0x862e1e){return _0x862e1e['destroy']()[_0xf0bf('0x13')](function(){_0xaa63a7[_0xf0bf('0xa')](0xcc)[_0xf0bf('0xb')]();});}};}function handleEntityNotFound(_0x48da41){return function(_0xaaa040){if(!_0xaaa040){_0x48da41['sendStatus'](0x194);}return _0xaaa040;};}function handleError(_0x23e6b1,_0x50d5d4){_0x50d5d4=_0x50d5d4||0x1f4;return function(_0x202888){logger[_0xf0bf('0x14')](_0x202888['stack']);if(_0x202888[_0xf0bf('0x15')]){delete _0x202888[_0xf0bf('0x15')];}_0x23e6b1['status'](_0x50d5d4)[_0xf0bf('0x16')](_0x202888);};}function maskClientSecret(_0x126343){return _[_0xf0bf('0x17')](_0x126343[_0xf0bf('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0xbc596e,_0x230a25){var _0x3c5492={},_0x51c434={},_0x53b12d={'count':0x0,'rows':[]};var _0x4fc61d=_[_0xf0bf('0x19')](db[_0xf0bf('0x1a')][_0xf0bf('0x1b')],function(_0x2098ba){return{'name':_0x2098ba[_0xf0bf('0x1c')],'type':_0x2098ba['type'][_0xf0bf('0x1d')]};});_0x51c434[_0xf0bf('0x1e')]=_[_0xf0bf('0x19')](_0x4fc61d,'name');_0x51c434[_0xf0bf('0x1f')]=_['keys'](_0xbc596e[_0xf0bf('0x1f')]);_0x51c434[_0xf0bf('0x20')]=_['intersection'](_0x51c434[_0xf0bf('0x1e')],_0x51c434[_0xf0bf('0x1f')]);_0x3c5492['attributes']=_['intersection'](_0x51c434[_0xf0bf('0x1e')],qs[_0xf0bf('0x21')](_0xbc596e['query']['fields']));_0x3c5492[_0xf0bf('0x22')]=_0x3c5492[_0xf0bf('0x22')]['length']?_0x3c5492[_0xf0bf('0x22')]:_0x51c434['model'];if(!_0xbc596e['query'][_0xf0bf('0x23')](_0xf0bf('0x24'))){_0x3c5492[_0xf0bf('0xe')]=qs['limit'](_0xbc596e[_0xf0bf('0x1f')]['limit']);_0x3c5492[_0xf0bf('0xd')]=qs[_0xf0bf('0xd')](_0xbc596e[_0xf0bf('0x1f')][_0xf0bf('0xd')]);}_0x3c5492[_0xf0bf('0x25')]=qs[_0xf0bf('0x26')](_0xbc596e[_0xf0bf('0x1f')][_0xf0bf('0x26')]);_0x3c5492['where']=qs['filters'](_['pick'](_0xbc596e[_0xf0bf('0x1f')],_0x51c434[_0xf0bf('0x20')]),_0x4fc61d);if(_0xbc596e[_0xf0bf('0x1f')][_0xf0bf('0x27')]){_0x3c5492[_0xf0bf('0x28')]=_[_0xf0bf('0x29')](_0x3c5492[_0xf0bf('0x28')],{'$or':_[_0xf0bf('0x19')](_0x4fc61d,function(_0x2b925e){if(_0x2b925e[_0xf0bf('0x2a')]!==_0xf0bf('0x2b')){var _0x656f59={};_0x656f59[_0x2b925e[_0xf0bf('0x15')]]={'$like':'%'+_0xbc596e['query']['filter']+'%'};return _0x656f59;}})});}_0x3c5492=_[_0xf0bf('0x29')]({},_0x3c5492,_0xbc596e[_0xf0bf('0x2c')]);var _0x36ade8={'where':_0x3c5492[_0xf0bf('0x28')]};return db[_0xf0bf('0x1a')][_0xf0bf('0x10')](_0x36ade8)[_0xf0bf('0x13')](function(_0x1b9ecc){_0x53b12d[_0xf0bf('0x10')]=_0x1b9ecc;if(_0xbc596e['query']['includeAll']){_0x3c5492[_0xf0bf('0x2d')]=[{'all':!![]}];}return db[_0xf0bf('0x1a')][_0xf0bf('0x2e')](_0x3c5492);})[_0xf0bf('0x13')](function(_0x1864f5){_0x53b12d[_0xf0bf('0x2f')]=_['map'](_0x1864f5,function(_0x59f807){if(_0x59f807['service']==='MicrosoftAzure'){var _0x1f39b5=encryptor[_0xf0bf('0x30')](_0x59f807['data3']);_0x59f807[_0xf0bf('0x31')]=maskClientSecret(_0x1f39b5);}return _0x59f807;});return _0x53b12d;})['then'](respondWithFilteredResult(_0x230a25,_0x3c5492))[_0xf0bf('0x32')](handleError(_0x230a25,null));};exports[_0xf0bf('0x33')]=function(_0x18024,_0x3416e8){var _0x2b9706={'raw':!![],'where':{'id':_0x18024[_0xf0bf('0x34')]['id']}},_0x2bc9e9={};_0x2bc9e9[_0xf0bf('0x1e')]=_['keys'](db[_0xf0bf('0x1a')][_0xf0bf('0x1b')]);_0x2bc9e9[_0xf0bf('0x1f')]=_['keys'](_0x18024[_0xf0bf('0x1f')]);_0x2bc9e9[_0xf0bf('0x20')]=_[_0xf0bf('0x35')](_0x2bc9e9[_0xf0bf('0x1e')],_0x2bc9e9[_0xf0bf('0x1f')]);_0x2b9706[_0xf0bf('0x22')]=_['intersection'](_0x2bc9e9[_0xf0bf('0x1e')],qs['fields'](_0x18024[_0xf0bf('0x1f')][_0xf0bf('0x21')]));_0x2b9706['attributes']=_0x2b9706[_0xf0bf('0x22')][_0xf0bf('0x36')]?_0x2b9706[_0xf0bf('0x22')]:_0x2bc9e9['model'];if(_0x18024['query'][_0xf0bf('0x37')]){_0x2b9706['include']=[{'all':!![]}];}_0x2b9706=_[_0xf0bf('0x29')]({},_0x2b9706,_0x18024['options']);return db[_0xf0bf('0x1a')][_0xf0bf('0x38')](_0x2b9706)[_0xf0bf('0x13')](handleEntityNotFound(_0x3416e8,null))[_0xf0bf('0x13')](function(_0x520f56){if(_0x520f56[_0xf0bf('0x39')]===_0xf0bf('0x3a')){var _0x3f5c7c=encryptor[_0xf0bf('0x30')](_0x520f56[_0xf0bf('0x31')]);_0x520f56['data3']=maskClientSecret(_0x3f5c7c);}return _0x520f56;})[_0xf0bf('0x13')](respondWithResult(_0x3416e8,null))[_0xf0bf('0x32')](handleError(_0x3416e8,null));};exports[_0xf0bf('0x3b')]=function(_0x5c6615,_0x212790){if(!_0x5c6615[_0xf0bf('0x3c')]['name'])throw new Error(_0xf0bf('0x3d'));if(!_0x5c6615[_0xf0bf('0x3c')][_0xf0bf('0x39')])throw new Error(_0xf0bf('0x3e'));var _0x3fa72a=db[_0xf0bf('0x1a')][_0xf0bf('0x1b')]['service']['values'];if(!_0x3fa72a[_0xf0bf('0x3f')](_0x5c6615[_0xf0bf('0x3c')][_0xf0bf('0x39')]))throw new Error(_0xf0bf('0x40')+_0x3fa72a[_0xf0bf('0x41')](',\x20'));if(_0x5c6615['body']['service']===_0xf0bf('0x3a')&&_0x5c6615['body'][_0xf0bf('0x31')]){_0x5c6615['body']['data3']=encryptor[_0xf0bf('0x42')](_0x5c6615[_0xf0bf('0x3c')][_0xf0bf('0x31')]);}return db['CloudProvider'][_0xf0bf('0x3b')](_0x5c6615[_0xf0bf('0x3c')],{})[_0xf0bf('0x13')](respondWithResult(_0x212790,0xc9))[_0xf0bf('0x32')](handleError(_0x212790,null));};exports[_0xf0bf('0x12')]=function(_0x52421f,_0x11fd7e){if(_0x52421f[_0xf0bf('0x3c')]['id']){delete _0x52421f[_0xf0bf('0x3c')]['id'];}return db[_0xf0bf('0x1a')]['find']({'where':{'id':_0x52421f['params']['id']}})[_0xf0bf('0x13')](handleEntityNotFound(_0x11fd7e,null))['then'](function(_0x448a66){if(_0x448a66[_0xf0bf('0x39')]==='MicrosoftAzure'&&_0x52421f['body'][_0xf0bf('0x31')]){_0x52421f['body'][_0xf0bf('0x31')]=encryptor['encryptString'](_0x52421f[_0xf0bf('0x3c')][_0xf0bf('0x31')]);}return _0x448a66;})[_0xf0bf('0x13')](saveUpdates(_0x52421f[_0xf0bf('0x3c')],null))[_0xf0bf('0x13')](respondWithResult(_0x11fd7e,null))['catch'](handleError(_0x11fd7e,null));};exports[_0xf0bf('0x43')]=function(_0x4ce49d,_0x468611){return db[_0xf0bf('0x1a')][_0xf0bf('0x38')]({'where':{'id':_0x4ce49d['params']['id']}})['then'](handleEntityNotFound(_0x468611,null))[_0xf0bf('0x13')](removeEntity(_0x468611,null))[_0xf0bf('0x32')](handleError(_0x468611,null));};exports['oauth2MicrosoftAuthorize']=function(_0x5e8446,_0x23780e){return db[_0xf0bf('0x1a')][_0xf0bf('0x44')]({'where':{'id':_0x5e8446[_0xf0bf('0x34')]['id']},'raw':!![]})[_0xf0bf('0x13')](function(_0x57305a){if(!_0x57305a)return _0x23780e[_0xf0bf('0x9')](0x194);return{'url':oauth[_0xf0bf('0x45')](_0x57305a,_0x5e8446['user']['id'])};})['then'](respondWithResult(_0x23780e,null))[_0xf0bf('0x32')](handleError(_0x23780e,null));};exports[_0xf0bf('0x46')]=function(_0x33aaf5,_0x3fdbd9){var _0x597053=_0x33aaf5[_0xf0bf('0x3c')];var _0x4043e8;var _0x3bfb46;if(_0x597053['error'])throw _0x597053;redis[_0xf0bf('0x47')](_0x597053['state'])['then'](function(_0x3897f7){if(!_0x3897f7)throw new Error(_0xf0bf('0x48'));_0x4043e8=JSON['parse'](_0x3897f7);var _0x4570e6=Buffer[_0xf0bf('0x49')](_0x597053[_0xf0bf('0x4a')],_0xf0bf('0x4b'))['toString'](_0xf0bf('0x4c'));_0x3bfb46=JSON[_0xf0bf('0x4d')](_0x4570e6);if(!oauth[_0xf0bf('0x4e')](_0x597053['id_token'],_0x4043e8['oauth2Claims']))throw new Error(_0xf0bf('0x4f'));redis['del'](_0x597053[_0xf0bf('0x4a')]);return oauth[_0xf0bf('0x50')](_0x597053[_0xf0bf('0x51')],_0x4043e8);})[_0xf0bf('0x13')](function(_0x2594a1){_0x4043e8['data5']=_0x2594a1[_0xf0bf('0x52')];_0x4043e8['data6']=_0x2594a1[_0xf0bf('0x53')];return db[_0xf0bf('0x1a')][_0xf0bf('0x12')]({'data5':_0x4043e8[_0xf0bf('0x54')],'data6':_0x4043e8[_0xf0bf('0x55')]},{'where':{'id':_0x4043e8['id']}});})['then'](function(){oauth[_0xf0bf('0x56')](_0x4043e8);socket['emit'](_0xf0bf('0x57'),{'id':_0x3bfb46['id']});return;})[_0xf0bf('0x13')](respondWithStatusCode(_0x3fdbd9,null))[_0xf0bf('0x32')](function(_0x3b2627){if(_0x3bfb46){socket[_0xf0bf('0x58')](_0xf0bf('0x59'),{'id':_0x3bfb46['id']});}if(!_0x4043e8){logger[_0xf0bf('0x14')](_0xf0bf('0x5a'),_0x3b2627);return _0x3fdbd9['status'](0x1f4)[_0xf0bf('0x16')](_0x3b2627[_0xf0bf('0x5b')]);}logger['error'](_0xf0bf('0x5c'),_0x4043e8['id'],JSON['stringify'](_0x3b2627));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 44e8b2b..d783022 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 _0x2f38=['cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x2f38,0x83));var _0x82f3=function(_0x2185c5,_0x572974){_0x2185c5=_0x2185c5-0x0;var _0x1c52ba=_0x2f38[_0x2185c5];return _0x1c52ba;};'use strict';var _=require(_0x82f3('0x0'));var util=require(_0x82f3('0x1'));var logger=require(_0x82f3('0x2'))('api');var moment=require(_0x82f3('0x3'));var BPromise=require(_0x82f3('0x4'));var rp=require(_0x82f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82f3('0x6'));var config=require(_0x82f3('0x7'));var attributes=require(_0x82f3('0x8'));module[_0x82f3('0x9')]=function(_0x7293a,_0x4d223b){return _0x7293a[_0x82f3('0xa')](_0x82f3('0xb'),attributes,{'tableName':_0x82f3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2820=['./cloudProvider.attributes','exports','define','cloud_providers','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x6bcbe4,_0x2427af){var _0x103058=function(_0x5875b2){while(--_0x5875b2){_0x6bcbe4['push'](_0x6bcbe4['shift']());}};_0x103058(++_0x2427af);}(_0x2820,0x190));var _0x0282=function(_0xc44e93,_0x4134bc){_0xc44e93=_0xc44e93-0x0;var _0x105557=_0x2820[_0xc44e93];return _0x105557;};'use strict';var _=require('lodash');var util=require(_0x0282('0x0'));var logger=require(_0x0282('0x1'))(_0x0282('0x2'));var moment=require(_0x0282('0x3'));var BPromise=require(_0x0282('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0282('0x5'));var rimraf=require('rimraf');var config=require(_0x0282('0x6'));var attributes=require(_0x0282('0x7'));module[_0x0282('0x8')]=function(_0x1d1f2b,_0x584d2b){return _0x1d1f2b[_0x0282('0x9')]('CloudProvider',attributes,{'tableName':_0x0282('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 9916ab7..230b35a 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 _0x79b0=['crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','openid','profile','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','id_token','from','stringify','toString','randomBytes','hex','client_id','data1','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','map','key','value','oauth2Claims','oauth2/','set','payload','issuer','aud','isAfter','unix','resolve','then','CloudProvider','refresh_token','data6','decryptString','data3','POST','data2','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash'];(function(_0x397519,_0x5008b8){var _0x162754=function(_0xb59877){while(--_0xb59877){_0x397519['push'](_0x397519['shift']());}};_0x162754(++_0x5008b8);}(_0x79b0,0x1df));var _0x079b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x79b0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x079b('0x0'));var crypto=require(_0x079b('0x1'));var jwt=require(_0x079b('0x2'));var moment=require(_0x079b('0x3'));var Redis=require(_0x079b('0x4'));var rp=require(_0x079b('0x5'));var util=require('util');var encryptor=require(_0x079b('0x6'));var config=require(_0x079b('0x7'));var logger=require(_0x079b('0x8'))('api');var schedule=require(_0x079b('0x9'));var db=require(_0x079b('0xa'))['db'];config[_0x079b('0xb')]=_[_0x079b('0xc')](config['redis'],{'host':_0x079b('0xd'),'port':0x18eb});var redis=new Redis(config[_0x079b('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x079b('0xe'),_0x079b('0xf'),'email',_0x079b('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x079b('0x11'),_0x079b('0x12')],'Dynamics365':[_0x079b('0xe'),_0x079b('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x079b('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x079b('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4d0305){var _0x428432=_['map'](AZURE_AUTH_SCOPES[_0x4d0305['type']]);if(_0x4d0305[_0x079b('0x15')]===_0x079b('0x16'))_0x428432[_0x079b('0x17')](_0x4d0305[_0x079b('0x18')]+_0x079b('0x19'));return _0x428432[_0x079b('0x1a')]('\x20');}function getAccessTokenScope(_0x1968f8){if(_0x1968f8['type']===_0x079b('0x1b'))return _0x079b('0x1c');if(_0x1968f8[_0x079b('0x15')]===_0x079b('0x16'))return _0x1968f8[_0x079b('0x18')]+_0x079b('0x19');}function generateMicrosoftAuthorizationUrl(_0xf77b02,_0x4862df){var _0x44af2d=MICROSOFT_AUTH_URL[_0x079b('0x1d')](_0x079b('0x1e'),_0xf77b02['data2']);var _0x2c439c=['code',_0x079b('0x1f')];var _0x1fdd9d=Buffer[_0x079b('0x20')](JSON[_0x079b('0x21')]({'id':_0x4862df}))[_0x079b('0x22')]('base64');var _0x1055b1=crypto[_0x079b('0x23')](0x10)[_0x079b('0x22')](_0x079b('0x24'));var _0x15c584=getAuthorizationScopes(_0xf77b02);var _0x59d89c=[{'key':_0x079b('0x25'),'value':_0xf77b02[_0x079b('0x26')]},{'key':'response_type','value':encodeURIComponent(_0x2c439c[_0x079b('0x1a')]('\x20'))},{'key':_0x079b('0x27'),'value':_0xf77b02[_0x079b('0x28')]},{'key':_0x079b('0x29'),'value':_0x079b('0x2a')},{'key':'scope','value':encodeURIComponent(_0x15c584)},{'key':_0x079b('0x2b'),'value':_0x1fdd9d},{'key':_0x079b('0x2c'),'value':_0x1055b1},{'key':_0x079b('0x2d'),'value':_0x079b('0x2e')}];var _0x33e8cc=_0x44af2d+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x079b('0x2f')](_0x59d89c,function(_0x5ac4cb){return _0x5ac4cb[_0x079b('0x30')]+'='+_0x5ac4cb[_0x079b('0x31')];})[_0x079b('0x1a')]('&');_0xf77b02[_0x079b('0x32')]={'issuer':_0x44af2d[_0x079b('0x1d')](_0x079b('0x33'),''),'audience':_0xf77b02[_0x079b('0x26')],'state':_0x1fdd9d,'nonce':_0x1055b1};redis[_0x079b('0x34')](_0x1fdd9d,JSON[_0x079b('0x21')](_0xf77b02));return _0x33e8cc;}function isValidIdToken(_0xe63bc3,_0x29e0f0){try{var _0x19a150=jwt['decode'](_0xe63bc3,{'complete':!![]});var _0x314785=_0x19a150[_0x079b('0x35')];if(_0x314785['iss']!==_0x29e0f0[_0x079b('0x36')])return![];if(_0x314785[_0x079b('0x37')]!==_0x29e0f0['audience'])return![];if(_0x314785[_0x079b('0x2c')]!==_0x29e0f0[_0x079b('0x2c')])return![];if(moment()[_0x079b('0x38')](moment[_0x079b('0x39')](_0x314785['exp'])))return![];return!![];}catch(_0x392c60){throw _0x392c60;}}function refreshOauth2MicrosoftAccessToken(_0xb69cf5){return Promise[_0x079b('0x3a')]()[_0x079b('0x3b')](function(){if(_0xb69cf5['data3'])return _0xb69cf5;return db[_0x079b('0x3c')]['findOne']({'where':{'id':_0xb69cf5['id']},'raw':!![]});})[_0x079b('0x3b')](function(_0x4a6ba9){var _0x28d167={'grant_type':_0x079b('0x3d'),'refresh_token':_0x4a6ba9[_0x079b('0x3e')],'scope':getAccessTokenScope(_0x4a6ba9),'redirect_uri':_0x4a6ba9['data4'],'client_id':_0x4a6ba9['data1'],'client_secret':encryptor[_0x079b('0x3f')](_0x4a6ba9[_0x079b('0x40')])};var _0x343c5a={'method':_0x079b('0x41'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x4a6ba9[_0x079b('0x42')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x28d167,'json':!![]};return rp(_0x343c5a);})[_0x079b('0x3b')](function(_0x15bae6){_0xb69cf5[_0x079b('0x43')]=_0x15bae6[_0x079b('0x44')];_0xb69cf5[_0x079b('0x3e')]=_0x15bae6[_0x079b('0x3d')];return db[_0x079b('0x3c')][_0x079b('0x45')]({'data5':_0xb69cf5[_0x079b('0x43')],'data6':_0xb69cf5[_0x079b('0x3e')]},{'where':{'id':_0xb69cf5['id']}});})[_0x079b('0x3b')](function(){return _0xb69cf5;})[_0x079b('0x46')](function(_0x55f106){logger[_0x079b('0x47')](_0x079b('0x48'),_0xb69cf5['id'],_0x55f106);});}function getOauth2MicrosoftAccessToken(_0x511eb0,_0x4fb2b7){var _0x28914f={'grant_type':_0x079b('0x49'),'code':_0x511eb0,'scope':getAccessTokenScope(_0x4fb2b7),'redirect_uri':_0x4fb2b7[_0x079b('0x28')],'client_id':_0x4fb2b7[_0x079b('0x26')],'client_secret':encryptor['decryptString'](_0x4fb2b7[_0x079b('0x40')])};var _0x556eb6={'method':_0x079b('0x41'),'uri':MICROSOFT_AUTH_URL[_0x079b('0x1d')](_0x079b('0x1e'),_0x4fb2b7[_0x079b('0x42')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x28914f,'json':!![]};return rp(_0x556eb6);}function startRefreshInterval(_0x5e82b0){var _0x2feea7=schedule[_0x079b('0x4a')];if(_0x2feea7[_0x5e82b0['id']])clearInterval(_0x2feea7[_0x5e82b0['id']]);_0x2feea7[_0x5e82b0['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x079b('0x4b')](this,{'id':_0x5e82b0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x079b('0x4a')]=_0x2feea7;}function startAllRefreshIntervals(){return db[_0x079b('0x3c')][_0x079b('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x079b('0x3b')](function(_0x34aa51){var _0x1297d5=_0x34aa51[_0x079b('0x2f')](function(_0x11b6d0){return refreshOauth2MicrosoftAccessToken(_0x11b6d0)['then'](function(_0x1f354e){startRefreshInterval(_0x1f354e);});});return Promise[_0x079b('0x4d')](_0x1297d5);})['catch'](function(_0x12eed6){var _0x486fab=_0x12eed6?util[_0x079b('0x4e')](_0x12eed6,{'showHidden':![],'depth':null}):'';logger[_0x079b('0x47')](_0x079b('0x4f'),_0x486fab);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x0fb7=['unix','exp','resolve','CloudProvider','findOne','then','refresh_token','decryptString','data3','POST','{TENANT_ID}','data5','access_token','data6','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','data7','/.default','replace','data2','id_token','from','toString','base64','hex','client_id','redirect_uri','data4','response_mode','state','nonce','prompt','login','key','join','oauth2Claims','oauth2/','data1','set','stringify','decode','iss','aud'];(function(_0x52da1e,_0x57bfd9){var _0x589959=function(_0x52fe4d){while(--_0x52fe4d){_0x52da1e['push'](_0x52da1e['shift']());}};_0x589959(++_0x57bfd9);}(_0x0fb7,0x65));var _0x70fb=function(_0xb83182,_0x421e15){_0xb83182=_0xb83182-0x0;var _0x4ef445=_0x0fb7[_0xb83182];return _0x4ef445;};'use strict';var _=require(_0x70fb('0x0'));var crypto=require(_0x70fb('0x1'));var jwt=require(_0x70fb('0x2'));var moment=require(_0x70fb('0x3'));var Redis=require(_0x70fb('0x4'));var rp=require(_0x70fb('0x5'));var util=require('util');var encryptor=require(_0x70fb('0x6'));var config=require('../../config/environment');var logger=require(_0x70fb('0x7'))(_0x70fb('0x8'));var schedule=require(_0x70fb('0x9'));var db=require(_0x70fb('0xa'))['db'];config[_0x70fb('0xb')]=_[_0x70fb('0xc')](config[_0x70fb('0xb')],{'host':_0x70fb('0xd'),'port':0x18eb});var redis=new Redis(config[_0x70fb('0xb')]);var MICROSOFT_AUTH_URL=_0x70fb('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x70fb('0xf'),_0x70fb('0x10'),_0x70fb('0x11'),_0x70fb('0x12'),_0x70fb('0x13'),'https://outlook.office.com/POP.AccessAsUser.All',_0x70fb('0x14')],'Dynamics365':['openid',_0x70fb('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x70fb('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0x70fb('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4b76db){var _0x1be2ff=_[_0x70fb('0x17')](AZURE_AUTH_SCOPES[_0x4b76db[_0x70fb('0x18')]]);if(_0x4b76db['type']===_0x70fb('0x19'))_0x1be2ff['push'](_0x4b76db[_0x70fb('0x1a')]+_0x70fb('0x1b'));return _0x1be2ff['join']('\x20');}function getAccessTokenScope(_0x4d9598){if(_0x4d9598[_0x70fb('0x18')]==='Outlook365')return _0x70fb('0x13');if(_0x4d9598['type']===_0x70fb('0x19'))return _0x4d9598['data7']+_0x70fb('0x1b');}function generateMicrosoftAuthorizationUrl(_0x87747d,_0x546904){var _0x3c0fb2=MICROSOFT_AUTH_URL[_0x70fb('0x1c')]('{TENANT_ID}',_0x87747d[_0x70fb('0x1d')]);var _0x28ecfa=['code',_0x70fb('0x1e')];var _0x24d107=Buffer[_0x70fb('0x1f')](JSON['stringify']({'id':_0x546904}))[_0x70fb('0x20')](_0x70fb('0x21'));var _0xa641f5=crypto['randomBytes'](0x10)[_0x70fb('0x20')](_0x70fb('0x22'));var _0x29a282=getAuthorizationScopes(_0x87747d);var _0x48cf41=[{'key':_0x70fb('0x23'),'value':_0x87747d['data1']},{'key':'response_type','value':encodeURIComponent(_0x28ecfa['join']('\x20'))},{'key':_0x70fb('0x24'),'value':_0x87747d[_0x70fb('0x25')]},{'key':_0x70fb('0x26'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x29a282)},{'key':_0x70fb('0x27'),'value':_0x24d107},{'key':_0x70fb('0x28'),'value':_0xa641f5},{'key':_0x70fb('0x29'),'value':_0x70fb('0x2a')}];var _0x25f176=_0x3c0fb2+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x70fb('0x17')](_0x48cf41,function(_0x419fa0){return _0x419fa0[_0x70fb('0x2b')]+'='+_0x419fa0['value'];})[_0x70fb('0x2c')]('&');_0x87747d[_0x70fb('0x2d')]={'issuer':_0x3c0fb2[_0x70fb('0x1c')](_0x70fb('0x2e'),''),'audience':_0x87747d[_0x70fb('0x2f')],'state':_0x24d107,'nonce':_0xa641f5};redis[_0x70fb('0x30')](_0x24d107,JSON[_0x70fb('0x31')](_0x87747d));return _0x25f176;}function isValidIdToken(_0x1add02,_0x4818d4){try{var _0x253068=jwt[_0x70fb('0x32')](_0x1add02,{'complete':!![]});var _0x3809ae=_0x253068['payload'];if(_0x3809ae[_0x70fb('0x33')]!==_0x4818d4['issuer'])return![];if(_0x3809ae[_0x70fb('0x34')]!==_0x4818d4['audience'])return![];if(_0x3809ae[_0x70fb('0x28')]!==_0x4818d4[_0x70fb('0x28')])return![];if(moment()['isAfter'](moment[_0x70fb('0x35')](_0x3809ae[_0x70fb('0x36')])))return![];return!![];}catch(_0x5cc5a2){throw _0x5cc5a2;}}function refreshOauth2MicrosoftAccessToken(_0xa285d4){return Promise[_0x70fb('0x37')]()['then'](function(){if(_0xa285d4['data3'])return _0xa285d4;return db[_0x70fb('0x38')][_0x70fb('0x39')]({'where':{'id':_0xa285d4['id']},'raw':!![]});})[_0x70fb('0x3a')](function(_0x443b44){var _0x2e9a1b={'grant_type':_0x70fb('0x3b'),'refresh_token':_0x443b44['data6'],'scope':getAccessTokenScope(_0x443b44),'redirect_uri':_0x443b44[_0x70fb('0x25')],'client_id':_0x443b44['data1'],'client_secret':encryptor[_0x70fb('0x3c')](_0x443b44[_0x70fb('0x3d')])};var _0x91149c={'method':_0x70fb('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x70fb('0x1c')](_0x70fb('0x3f'),_0x443b44[_0x70fb('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2e9a1b,'json':!![]};return rp(_0x91149c);})[_0x70fb('0x3a')](function(_0xfb7a1c){_0xa285d4[_0x70fb('0x40')]=_0xfb7a1c[_0x70fb('0x41')];_0xa285d4[_0x70fb('0x42')]=_0xfb7a1c['refresh_token'];return db[_0x70fb('0x38')][_0x70fb('0x43')]({'data5':_0xa285d4[_0x70fb('0x40')],'data6':_0xa285d4[_0x70fb('0x42')]},{'where':{'id':_0xa285d4['id']}});})[_0x70fb('0x3a')](function(){return _0xa285d4;})[_0x70fb('0x44')](function(_0xb7c0a5){logger[_0x70fb('0x45')](_0x70fb('0x46'),_0xa285d4['id'],_0xb7c0a5);});}function getOauth2MicrosoftAccessToken(_0x189172,_0x5ed3a5){var _0x5e783b={'grant_type':_0x70fb('0x47'),'code':_0x189172,'scope':getAccessTokenScope(_0x5ed3a5),'redirect_uri':_0x5ed3a5['data4'],'client_id':_0x5ed3a5[_0x70fb('0x2f')],'client_secret':encryptor[_0x70fb('0x3c')](_0x5ed3a5[_0x70fb('0x3d')])};var _0x4a57ef={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x70fb('0x1c')](_0x70fb('0x3f'),_0x5ed3a5[_0x70fb('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5e783b,'json':!![]};return rp(_0x4a57ef);}function startRefreshInterval(_0x49716f){var _0x4e0ed4=schedule[_0x70fb('0x48')];if(_0x4e0ed4[_0x49716f['id']])clearInterval(_0x4e0ed4[_0x49716f['id']]);_0x4e0ed4[_0x49716f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x70fb('0x49')](this,{'id':_0x49716f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4e0ed4;}function startAllRefreshIntervals(){return db[_0x70fb('0x38')][_0x70fb('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x70fb('0x3a')](function(_0x5da280){var _0x260b35=_0x5da280[_0x70fb('0x17')](function(_0x2762d8){return refreshOauth2MicrosoftAccessToken(_0x2762d8)[_0x70fb('0x3a')](function(_0x145f3c){startRefreshInterval(_0x145f3c);});});return Promise[_0x70fb('0x4b')](_0x260b35);})['catch'](function(_0x4385b7){var _0x5c5402=_0x4385b7?util['inspect'](_0x4385b7,{'showHidden':![],'depth':null}):'';logger[_0x70fb('0x45')](_0x70fb('0x4c'),_0x5c5402);});}module['exports']={'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 e11ce4b..7d3f5b7 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 _0xe5fc=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xff3357,_0x3b4152){var _0x16d529=function(_0x38d7f7){while(--_0x38d7f7){_0xff3357['push'](_0xff3357['shift']());}};_0x16d529(++_0x3b4152);}(_0xe5fc,0x109));var _0xce5f=function(_0x54b31c,_0x328a74){_0x54b31c=_0x54b31c-0x0;var _0x3f1995=_0xe5fc[_0x54b31c];return _0x3f1995;};'use strict';var _=require(_0xce5f('0x0'));var util=require('util');var moment=require(_0xce5f('0x1'));var BPromise=require(_0xce5f('0x2'));var rs=require(_0xce5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce5f('0x4'))('rpc');var config=require(_0xce5f('0x5'));var jayson=require(_0xce5f('0x6'));var client=jayson[_0xce5f('0x7')][_0xce5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b77ef,_0x30a150,_0x2b64dc){return new BPromise(function(_0x3451af,_0x4fa651){return client[_0xce5f('0x9')](_0x3b77ef,_0x2b64dc)[_0xce5f('0xa')](function(_0x29a7bf){logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));logger[_0xce5f('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x30a150,_0xce5f('0xd'),JSON[_0xce5f('0xf')](_0x29a7bf));if(_0x29a7bf[_0xce5f('0x10')]){if(_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x11')]===0x1f4){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x4fa651(_0x29a7bf['error']['message']);}logger['error'](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x3451af(_0x29a7bf[_0xce5f('0x10')]['message']);}else{logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));_0x3451af(_0x29a7bf[_0xce5f('0x13')][_0xce5f('0x12')]);}})[_0xce5f('0x14')](function(_0x1544ba){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x1544ba);_0x4fa651(_0x1544ba);});});} \ No newline at end of file +var _0x91b6=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x6e7446,_0x120a01){var _0x167b36=function(_0x909f1a){while(--_0x909f1a){_0x6e7446['push'](_0x6e7446['shift']());}};_0x167b36(++_0x120a01);}(_0x91b6,0x18b));var _0x691b=function(_0x374bbb,_0x1a2762){_0x374bbb=_0x374bbb-0x0;var _0x15a2a7=_0x91b6[_0x374bbb];return _0x15a2a7;};'use strict';var _=require(_0x691b('0x0'));var util=require(_0x691b('0x1'));var moment=require('moment');var BPromise=require(_0x691b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x691b('0x3'))['db'];var utils=require(_0x691b('0x4'));var logger=require(_0x691b('0x5'))(_0x691b('0x6'));var config=require(_0x691b('0x7'));var jayson=require(_0x691b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x448027,_0x1ebd9c,_0x4ff18c){return new BPromise(function(_0x223632,_0xceca6a){return client[_0x691b('0x9')](_0x448027,_0x4ff18c)[_0x691b('0xa')](function(_0xbd8767){logger[_0x691b('0xb')](_0x691b('0xc'),_0x1ebd9c,_0x691b('0xd'));logger['debug'](_0x691b('0xe'),_0x1ebd9c,_0x691b('0xd'),JSON[_0x691b('0xf')](_0xbd8767));if(_0xbd8767[_0x691b('0x10')]){if(_0xbd8767[_0x691b('0x10')][_0x691b('0x11')]===0x1f4){logger['error'](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0xceca6a(_0xbd8767[_0x691b('0x10')]['message']);}logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0x223632(_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);}else{logger[_0x691b('0xb')]('CloudProvider,\x20%s,\x20%s',_0x1ebd9c,_0x691b('0xd'));_0x223632(_0xbd8767['result'][_0x691b('0x12')]);}})[_0x691b('0x13')](function(_0x2e4f84){logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0x2e4f84);_0xceca6a(_0x2e4f84);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 109b761..a30695b 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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x38df21,_0x542dce){var _0x30be8c=function(_0x7da38b){while(--_0x7da38b){_0x38df21['push'](_0x38df21['shift']());}};_0x30be8c(++_0x542dce);}(_0xdb28,0x106));var _0x8db2=function(_0x2a2f3a,_0x569fc9){_0x2a2f3a=_0x2a2f3a-0x0;var _0x8cdc74=_0xdb28[_0x2a2f3a];return _0x8cdc74;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x2df18b,_0xbce323){var _0x9f8372=function(_0x3437d7){while(--_0x3437d7){_0x2df18b['push'](_0x2df18b['shift']());}};_0x9f8372(++_0xbce323);}(_0xdb28,0x106));var _0x8db2=function(_0xff872e,_0x59c558){_0xff872e=_0xff872e-0x0;var _0x43dd22=_0xdb28[_0xff872e];return _0x43dd22;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 13b4198..ba797f1 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 _0x5670=['name','sequelize','exports','STRING'];(function(_0xa6b7ad,_0x2fbc64){var _0x26945b=function(_0x17936d){while(--_0x17936d){_0xa6b7ad['push'](_0xa6b7ad['shift']());}};_0x26945b(++_0x2fbc64);}(_0x5670,0x1d1));var _0x0567=function(_0x5d6240,_0x4d1a5b){_0x5d6240=_0x5d6240-0x0;var _0x28fda3=_0x5670[_0x5d6240];return _0x28fda3;};'use strict';var Sequelize=require(_0x0567('0x0'));module[_0x0567('0x1')]={'name':{'type':Sequelize[_0x0567('0x2')],'unique':_0x0567('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0567('0x2')]},'companyId':{'type':Sequelize[_0x0567('0x2')]},'website':{'type':Sequelize[_0x0567('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x0567('0x2')]},'type':{'type':Sequelize[_0x0567('0x2')]},'street':{'type':Sequelize[_0x0567('0x2')]},'postalCode':{'type':Sequelize[_0x0567('0x2')]},'city':{'type':Sequelize[_0x0567('0x2')]},'country':{'type':Sequelize[_0x0567('0x2')]},'email':{'type':Sequelize[_0x0567('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x0567('0x2')]},'sCity':{'type':Sequelize[_0x0567('0x2')]},'sCountry':{'type':Sequelize[_0x0567('0x2')]},'description':{'type':Sequelize[_0x0567('0x2')]}}; \ No newline at end of file +var _0x943a=['sequelize','name','STRING'];(function(_0x489fc7,_0x4a05ad){var _0x1efd80=function(_0x5e7502){while(--_0x5e7502){_0x489fc7['push'](_0x489fc7['shift']());}};_0x1efd80(++_0x4a05ad);}(_0x943a,0xfc));var _0xa943=function(_0x58dc43,_0x5315b1){_0x58dc43=_0x58dc43-0x0;var _0x2f9326=_0x943a[_0x58dc43];return _0x2f9326;};'use strict';var Sequelize=require(_0xa943('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa943('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa943('0x2')]},'companyId':{'type':Sequelize[_0xa943('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa943('0x2')]},'type':{'type':Sequelize[_0xa943('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa943('0x2')]},'city':{'type':Sequelize[_0xa943('0x2')]},'country':{'type':Sequelize[_0xa943('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xa943('0x2')]},'sPostalCode':{'type':Sequelize[_0xa943('0x2')]},'sCity':{'type':Sequelize[_0xa943('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa943('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 239a0f1..2a4d3a1 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 _0xa914=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','Companies','UserProfileResource','end','sendStatus','error','stack','send','CmCompany','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','map','merge','options','includeAll','include','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','omit','ids','findOne','rawAttributes','order','pick','getContacts','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','jsforce','desk.js'];(function(_0x23c093,_0x134cdd){var _0x1c35c7=function(_0x71a64b){while(--_0x71a64b){_0x23c093['push'](_0x23c093['shift']());}};_0x1c35c7(++_0x134cdd);}(_0xa914,0x192));var _0x4a91=function(_0xb2d091,_0x44cff2){_0xb2d091=_0xb2d091-0x0;var _0x39d1a9=_0xa914[_0xb2d091];return _0x39d1a9;};'use strict';var emlformat=require(_0x4a91('0x0'));var rimraf=require(_0x4a91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a91('0x2'));var rp=require(_0x4a91('0x3'));var moment=require(_0x4a91('0x4'));var BPromise=require(_0x4a91('0x5'));var Mustache=require(_0x4a91('0x6'));var util=require('util');var path=require(_0x4a91('0x7'));var sox=require(_0x4a91('0x8'));var csv=require(_0x4a91('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a91('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4a91('0xb'));var deskjs=require(_0x4a91('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4a91('0xd'));var Papa=require(_0x4a91('0xe'));var Redis=require(_0x4a91('0xf'));var authService=require(_0x4a91('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a91('0x11'));var logger=require('../../config/logger')(_0x4a91('0x12'));var utils=require(_0x4a91('0x13'));var config=require(_0x4a91('0x14'));var licenseUtil=require(_0x4a91('0x15'));var db=require(_0x4a91('0x16'))['db'];function respondWithStatusCode(_0x4171fb,_0x4e81b3){_0x4e81b3=_0x4e81b3||0xcc;return function(_0x422f7e){if(_0x422f7e){return _0x4171fb['sendStatus'](_0x4e81b3);}return _0x4171fb[_0x4a91('0x17')](_0x4e81b3)['end']();};}function respondWithResult(_0x37a0e1,_0x116531){_0x116531=_0x116531||0xc8;return function(_0x143bdb){if(_0x143bdb){return _0x37a0e1[_0x4a91('0x17')](_0x116531)['json'](_0x143bdb);}};}function respondWithFilteredResult(_0x208271,_0x331545){return function(_0x28d546){if(_0x28d546){var _0x3fda95=typeof _0x331545[_0x4a91('0x18')]===_0x4a91('0x19')&&typeof _0x331545[_0x4a91('0x1a')]==='undefined';var _0x4df387=_0x28d546['count'];var _0x246cae=_0x3fda95?0x0:_0x331545[_0x4a91('0x18')];var _0x2b0eb3=_0x3fda95?_0x28d546[_0x4a91('0x1b')]:_0x331545['offset']+_0x331545[_0x4a91('0x1a')];var _0x25821f;if(_0x2b0eb3>=_0x4df387){_0x2b0eb3=_0x4df387;_0x25821f=0xc8;}else{_0x25821f=0xce;}_0x208271[_0x4a91('0x17')](_0x25821f);return _0x208271['set'](_0x4a91('0x1c'),_0x246cae+'-'+_0x2b0eb3+'/'+_0x4df387)['json'](_0x28d546);}return null;};}function patchUpdates(_0x458c9f){return function(_0xb38745){try{jsonpatch['apply'](_0xb38745,_0x458c9f,!![]);}catch(_0x5162cc){return BPromise['reject'](_0x5162cc);}return _0xb38745[_0x4a91('0x1d')]();};}function saveUpdates(_0x1b2f58,_0x415e02){return function(_0x3d59ad){if(_0x3d59ad){return _0x3d59ad[_0x4a91('0x1e')](_0x1b2f58)[_0x4a91('0x1f')](function(_0x56b794){return _0x56b794;});}return null;};}function removeEntity(_0x40cb17,_0x3fbec9){return function(_0x54aa33){if(_0x54aa33){return _0x54aa33[_0x4a91('0x20')]()['then'](function(){var _0x38f12f=_0x54aa33[_0x4a91('0x21')]({'plain':!![]});var _0x489fd7=_0x4a91('0x22');return db[_0x4a91('0x23')][_0x4a91('0x20')]({'where':{'type':_0x489fd7,'resourceId':_0x38f12f['id']}})[_0x4a91('0x1f')](function(){return _0x54aa33;});})[_0x4a91('0x1f')](function(){_0x40cb17['status'](0xcc)[_0x4a91('0x24')]();});}};}function handleEntityNotFound(_0x492178,_0x126552){return function(_0x490ba8){if(!_0x490ba8){_0x492178[_0x4a91('0x25')](0x194);}return _0x490ba8;};}function handleError(_0x3c6011,_0x2ff8c4){_0x2ff8c4=_0x2ff8c4||0x1f4;return function(_0xb0accb){logger[_0x4a91('0x26')](_0xb0accb[_0x4a91('0x27')]);if(_0xb0accb['name']){delete _0xb0accb['name'];}_0x3c6011[_0x4a91('0x17')](_0x2ff8c4)[_0x4a91('0x28')](_0xb0accb);};}exports['index']=function(_0x384a7c,_0x14ad36){var _0x3357c9={},_0x34dc50={},_0x59f8e9={'count':0x0,'rows':[]};return db[_0x4a91('0x29')]['describe']()[_0x4a91('0x1f')](function(_0x2c967a){_0x34dc50[_0x4a91('0x2a')]=_[_0x4a91('0x2b')](_0x2c967a);_0x34dc50[_0x4a91('0x2c')]=_[_0x4a91('0x2b')](_0x384a7c['query']);_0x34dc50[_0x4a91('0x2d')]=_[_0x4a91('0x2e')](_0x34dc50[_0x4a91('0x2a')],_0x34dc50[_0x4a91('0x2c')]);_0x3357c9['attributes']=_[_0x4a91('0x2e')](_0x34dc50['model'],qs[_0x4a91('0x2f')](_0x384a7c['query'][_0x4a91('0x2f')]));_0x3357c9[_0x4a91('0x30')]=_0x3357c9[_0x4a91('0x30')][_0x4a91('0x31')]?_0x3357c9[_0x4a91('0x30')]:_0x34dc50[_0x4a91('0x2a')];if(!_0x384a7c['query'][_0x4a91('0x32')]('nolimit')){_0x3357c9[_0x4a91('0x1a')]=qs[_0x4a91('0x1a')](_0x384a7c[_0x4a91('0x2c')]['limit']);_0x3357c9[_0x4a91('0x18')]=qs[_0x4a91('0x18')](_0x384a7c[_0x4a91('0x2c')][_0x4a91('0x18')]);}_0x3357c9['order']=qs[_0x4a91('0x33')](_0x384a7c[_0x4a91('0x2c')][_0x4a91('0x33')]);_0x3357c9[_0x4a91('0x34')]=qs['filters'](_['pick'](_0x384a7c[_0x4a91('0x2c')],_0x34dc50[_0x4a91('0x2d')]),_0x2c967a);if(_0x384a7c[_0x4a91('0x2c')][_0x4a91('0x35')]){_0x3357c9['where']=_['merge'](_0x3357c9[_0x4a91('0x34')],{'$or':_[_0x4a91('0x36')](_0x3357c9['attributes'],function(_0x2e6848){var _0x514b40={};_0x514b40[_0x2e6848]={'$like':'%'+_0x384a7c[_0x4a91('0x2c')][_0x4a91('0x35')]+'%'};return _0x514b40;})});}_0x3357c9=_[_0x4a91('0x37')]({},_0x3357c9,_0x384a7c[_0x4a91('0x38')]);var _0x59cab6={'where':_0x3357c9[_0x4a91('0x34')]};return db[_0x4a91('0x29')][_0x4a91('0x1b')](_0x59cab6)['then'](function(_0x301f93){_0x59f8e9[_0x4a91('0x1b')]=_0x301f93;if(_0x384a7c[_0x4a91('0x2c')][_0x4a91('0x39')]){_0x3357c9[_0x4a91('0x3a')]=[{'all':!![]}];}return db[_0x4a91('0x29')]['findAll'](_0x3357c9);})[_0x4a91('0x1f')](function(_0x13440b){_0x59f8e9['rows']=_0x13440b;return _0x59f8e9;})[_0x4a91('0x1f')](respondWithFilteredResult(_0x14ad36,_0x3357c9))['catch'](handleError(_0x14ad36,null));})[_0x4a91('0x3b')](handleError(_0x14ad36,null));};exports[_0x4a91('0x3c')]=function(_0x234785,_0x37ef53){var _0x400849={'raw':![],'where':{'id':_0x234785['params']['id']}},_0x1d59e2={};_0x1d59e2['model']=_['keys'](db['CmCompany']['rawAttributes']);_0x1d59e2[_0x4a91('0x2c')]=_[_0x4a91('0x2b')](_0x234785[_0x4a91('0x2c')]);_0x1d59e2['filters']=_[_0x4a91('0x2e')](_0x1d59e2[_0x4a91('0x2a')],_0x1d59e2[_0x4a91('0x2c')]);_0x400849[_0x4a91('0x30')]=_[_0x4a91('0x2e')](_0x1d59e2[_0x4a91('0x2a')],qs['fields'](_0x234785[_0x4a91('0x2c')][_0x4a91('0x2f')]));_0x400849[_0x4a91('0x30')]=_0x400849[_0x4a91('0x30')]['length']?_0x400849['attributes']:_0x1d59e2[_0x4a91('0x2a')];if(_0x234785[_0x4a91('0x2c')][_0x4a91('0x39')]){_0x400849[_0x4a91('0x3a')]=[{'all':!![]}];}_0x400849=_['merge']({},_0x400849,_0x234785[_0x4a91('0x38')]);return db['CmCompany'][_0x4a91('0x3d')](_0x400849)[_0x4a91('0x1f')](handleEntityNotFound(_0x37ef53,null))[_0x4a91('0x1f')](respondWithResult(_0x37ef53,null))[_0x4a91('0x3b')](handleError(_0x37ef53,null));};exports[_0x4a91('0x3e')]=function(_0x56be96,_0x394de2){return db[_0x4a91('0x29')][_0x4a91('0x3e')](_0x56be96[_0x4a91('0x3f')],{})[_0x4a91('0x1f')](function(_0x39c855){var _0x38d803=_0x56be96['user'][_0x4a91('0x21')]({'plain':!![]});if(!_0x38d803)throw new Error(_0x4a91('0x40'));if(_0x38d803[_0x4a91('0x41')]===_0x4a91('0x42')){var _0x4d584f=_0x39c855[_0x4a91('0x21')]({'plain':!![]});var _0x2a6e8c=_0x4a91('0x22');return db['UserProfileSection'][_0x4a91('0x3d')]({'where':{'name':_0x2a6e8c,'userProfileId':_0x38d803[_0x4a91('0x43')]},'raw':!![]})[_0x4a91('0x1f')](function(_0x496962){if(_0x496962&&_0x496962[_0x4a91('0x44')]===0x0){return db[_0x4a91('0x23')]['create']({'name':_0x4d584f['name'],'resourceId':_0x4d584f['id'],'type':_0x496962[_0x4a91('0x45')],'sectionId':_0x496962['id']},{})[_0x4a91('0x1f')](function(){return _0x39c855;});}else{return _0x39c855;}})[_0x4a91('0x3b')](function(_0x519ae3){logger['error'](_0x4a91('0x46'),_0x519ae3);throw _0x519ae3;});}return _0x39c855;})[_0x4a91('0x1f')](respondWithResult(_0x394de2,0xc9))[_0x4a91('0x3b')](handleError(_0x394de2,null));};exports[_0x4a91('0x1e')]=function(_0x56f2d8,_0xed9715){if(_0x56f2d8[_0x4a91('0x3f')]['id']){delete _0x56f2d8[_0x4a91('0x3f')]['id'];}return db[_0x4a91('0x29')][_0x4a91('0x3d')]({'where':{'id':_0x56f2d8[_0x4a91('0x47')]['id']}})[_0x4a91('0x1f')](handleEntityNotFound(_0xed9715,null))[_0x4a91('0x1f')](saveUpdates(_0x56f2d8[_0x4a91('0x3f')],null))[_0x4a91('0x1f')](respondWithResult(_0xed9715,null))[_0x4a91('0x3b')](handleError(_0xed9715,null));};exports[_0x4a91('0x20')]=function(_0x3ca030,_0x49753f){return db[_0x4a91('0x29')][_0x4a91('0x3d')]({'where':{'id':_0x3ca030[_0x4a91('0x47')]['id']}})[_0x4a91('0x1f')](handleEntityNotFound(_0x49753f,null))[_0x4a91('0x1f')](removeEntity(_0x49753f,null))[_0x4a91('0x3b')](handleError(_0x49753f,null));};exports[_0x4a91('0x48')]=function(_0x35265b,_0x2ce744){return db['CmCompany'][_0x4a91('0x48')]()['then'](respondWithResult(_0x2ce744,null))['catch'](handleError(_0x2ce744,null));};exports[_0x4a91('0x49')]=function(_0x412bff,_0x43cccf,_0x10f151){return db[_0x4a91('0x4a')][_0x4a91('0x3d')]({'where':{'id':_0x412bff[_0x4a91('0x47')]['id']}})[_0x4a91('0x1f')](handleEntityNotFound(_0x43cccf,null))[_0x4a91('0x1f')](function(_0xef2f43){if(_0xef2f43){return _0xef2f43['addContacts'](_0x412bff[_0x4a91('0x3f')]['ids'],_[_0x4a91('0x4b')](_0x412bff[_0x4a91('0x3f')],[_0x4a91('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x43cccf,null))[_0x4a91('0x3b')](handleError(_0x43cccf,null));};exports['getContacts']=function(_0x48ecd4,_0x209afa,_0x504de){var _0x2df863={};var _0x33ebfc={};var _0x2fe6ed;var _0x5b115f;return db['CmCompany'][_0x4a91('0x4d')]({'where':{'id':_0x48ecd4[_0x4a91('0x47')]['id']}})[_0x4a91('0x1f')](handleEntityNotFound(_0x209afa,null))['then'](function(_0x2e16b1){if(_0x2e16b1){_0x2fe6ed=_0x2e16b1;_0x33ebfc[_0x4a91('0x2a')]=_[_0x4a91('0x2b')](db[_0x4a91('0x4a')][_0x4a91('0x4e')]);_0x33ebfc[_0x4a91('0x2c')]=_[_0x4a91('0x2b')](_0x48ecd4['query']);_0x33ebfc[_0x4a91('0x2d')]=_[_0x4a91('0x2e')](_0x33ebfc[_0x4a91('0x2a')],_0x33ebfc['query']);_0x2df863['attributes']=_['intersection'](_0x33ebfc['model'],qs[_0x4a91('0x2f')](_0x48ecd4['query'][_0x4a91('0x2f')]));_0x2df863[_0x4a91('0x30')]=_0x2df863[_0x4a91('0x30')]['length']?_0x2df863[_0x4a91('0x30')]:_0x33ebfc[_0x4a91('0x2a')];_0x2df863[_0x4a91('0x4f')]=qs[_0x4a91('0x33')](_0x48ecd4[_0x4a91('0x2c')][_0x4a91('0x33')]);_0x2df863[_0x4a91('0x34')]=qs['filters'](_[_0x4a91('0x50')](_0x48ecd4[_0x4a91('0x2c')],_0x33ebfc[_0x4a91('0x2d')]));if(_0x48ecd4[_0x4a91('0x2c')][_0x4a91('0x35')]){_0x2df863['where']=_[_0x4a91('0x37')](_0x2df863[_0x4a91('0x34')],{'$or':_[_0x4a91('0x36')](_0x2df863[_0x4a91('0x30')],function(_0x2da64a){var _0x463522={};_0x463522[_0x2da64a]={'$like':'%'+_0x48ecd4[_0x4a91('0x2c')][_0x4a91('0x35')]+'%'};return _0x463522;})});}_0x2df863=_['merge']({},_0x2df863,_0x48ecd4[_0x4a91('0x38')]);return _0x2fe6ed[_0x4a91('0x51')](_0x2df863);}})[_0x4a91('0x1f')](function(_0x351820){if(_0x351820){_0x5b115f=_0x351820[_0x4a91('0x31')];if(!_0x48ecd4[_0x4a91('0x2c')][_0x4a91('0x32')](_0x4a91('0x52'))){_0x2df863[_0x4a91('0x1a')]=qs['limit'](_0x48ecd4['query'][_0x4a91('0x1a')]);_0x2df863[_0x4a91('0x18')]=qs[_0x4a91('0x18')](_0x48ecd4['query'][_0x4a91('0x18')]);}return _0x2fe6ed[_0x4a91('0x51')](_0x2df863);}})[_0x4a91('0x1f')](function(_0xd6c090){if(_0xd6c090){return _0xd6c090?{'count':_0x5b115f,'rows':_0xd6c090}:null;}})[_0x4a91('0x1f')](respondWithResult(_0x209afa,null))[_0x4a91('0x3b')](handleError(_0x209afa,null));}; \ No newline at end of file +var _0x11e0=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','Companies','UserProfileResource','destroy','error','stack','name','send','index','describe','keys','query','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','merge','options','CmCompany','rows','catch','show','params','rawAttributes','length','includeAll','find','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','CmContact','getContacts','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x41cef9,_0x33c7dd){var _0x396eff=function(_0x29859f){while(--_0x29859f){_0x41cef9['push'](_0x41cef9['shift']());}};_0x396eff(++_0x33c7dd);}(_0x11e0,0x190));var _0x011e=function(_0x1e839c,_0x397a17){_0x1e839c=_0x1e839c-0x0;var _0x3f6b8c=_0x11e0[_0x1e839c];return _0x3f6b8c;};'use strict';var emlformat=require(_0x011e('0x0'));var rimraf=require(_0x011e('0x1'));var zipdir=require(_0x011e('0x2'));var jsonpatch=require(_0x011e('0x3'));var rp=require(_0x011e('0x4'));var moment=require(_0x011e('0x5'));var BPromise=require(_0x011e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x011e('0x7'));var sox=require(_0x011e('0x8'));var csv=require(_0x011e('0x9'));var ejs=require(_0x011e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x011e('0xb'));var crypto=require(_0x011e('0xc'));var jsforce=require(_0x011e('0xd'));var deskjs=require(_0x011e('0xe'));var toCsv=require(_0x011e('0x9'));var querystring=require(_0x011e('0xf'));var Papa=require(_0x011e('0x10'));var Redis=require(_0x011e('0x11'));var authService=require(_0x011e('0x12'));var qs=require(_0x011e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x011e('0x14'))(_0x011e('0x15'));var utils=require('../../config/utils');var config=require(_0x011e('0x16'));var licenseUtil=require(_0x011e('0x17'));var db=require(_0x011e('0x18'))['db'];function respondWithStatusCode(_0xcc714a,_0x1f0a75){_0x1f0a75=_0x1f0a75||0xcc;return function(_0x4b01fb){if(_0x4b01fb){return _0xcc714a[_0x011e('0x19')](_0x1f0a75);}return _0xcc714a[_0x011e('0x1a')](_0x1f0a75)[_0x011e('0x1b')]();};}function respondWithResult(_0x54181c,_0x5bcadb){_0x5bcadb=_0x5bcadb||0xc8;return function(_0x3ee237){if(_0x3ee237){return _0x54181c['status'](_0x5bcadb)['json'](_0x3ee237);}};}function respondWithFilteredResult(_0x948561,_0x17eb91){return function(_0x483a28){if(_0x483a28){var _0x203ad1=typeof _0x17eb91[_0x011e('0x1c')]===_0x011e('0x1d')&&typeof _0x17eb91[_0x011e('0x1e')]===_0x011e('0x1d');var _0x288634=_0x483a28[_0x011e('0x1f')];var _0x462a3d=_0x203ad1?0x0:_0x17eb91[_0x011e('0x1c')];var _0x1f1a4a=_0x203ad1?_0x483a28['count']:_0x17eb91['offset']+_0x17eb91[_0x011e('0x1e')];var _0x18e6c6;if(_0x1f1a4a>=_0x288634){_0x1f1a4a=_0x288634;_0x18e6c6=0xc8;}else{_0x18e6c6=0xce;}_0x948561[_0x011e('0x1a')](_0x18e6c6);return _0x948561[_0x011e('0x20')](_0x011e('0x21'),_0x462a3d+'-'+_0x1f1a4a+'/'+_0x288634)[_0x011e('0x22')](_0x483a28);}return null;};}function patchUpdates(_0x2fe8f0){return function(_0x215709){try{jsonpatch[_0x011e('0x23')](_0x215709,_0x2fe8f0,!![]);}catch(_0x4dd76a){return BPromise[_0x011e('0x24')](_0x4dd76a);}return _0x215709[_0x011e('0x25')]();};}function saveUpdates(_0x4cef22,_0x2891a3){return function(_0x1087e0){if(_0x1087e0){return _0x1087e0[_0x011e('0x26')](_0x4cef22)['then'](function(_0x5b7366){return _0x5b7366;});}return null;};}function removeEntity(_0x3e57fc,_0x2c85e9){return function(_0x412d65){if(_0x412d65){return _0x412d65['destroy']()[_0x011e('0x27')](function(){var _0x2f3b13=_0x412d65['get']({'plain':!![]});var _0x2e231d=_0x011e('0x28');return db[_0x011e('0x29')][_0x011e('0x2a')]({'where':{'type':_0x2e231d,'resourceId':_0x2f3b13['id']}})[_0x011e('0x27')](function(){return _0x412d65;});})['then'](function(){_0x3e57fc['status'](0xcc)[_0x011e('0x1b')]();});}};}function handleEntityNotFound(_0x175753,_0x287da1){return function(_0x276a5d){if(!_0x276a5d){_0x175753[_0x011e('0x19')](0x194);}return _0x276a5d;};}function handleError(_0x352e70,_0x571898){_0x571898=_0x571898||0x1f4;return function(_0x224538){logger[_0x011e('0x2b')](_0x224538[_0x011e('0x2c')]);if(_0x224538[_0x011e('0x2d')]){delete _0x224538[_0x011e('0x2d')];}_0x352e70[_0x011e('0x1a')](_0x571898)[_0x011e('0x2e')](_0x224538);};}exports[_0x011e('0x2f')]=function(_0xa4ce74,_0xe6df5b){var _0x30ff23={},_0x4282ef={},_0x4638b6={'count':0x0,'rows':[]};return db['CmCompany'][_0x011e('0x30')]()['then'](function(_0x416dc2){_0x4282ef['model']=_[_0x011e('0x31')](_0x416dc2);_0x4282ef[_0x011e('0x32')]=_[_0x011e('0x31')](_0xa4ce74[_0x011e('0x32')]);_0x4282ef[_0x011e('0x33')]=_[_0x011e('0x34')](_0x4282ef[_0x011e('0x35')],_0x4282ef['query']);_0x30ff23[_0x011e('0x36')]=_[_0x011e('0x34')](_0x4282ef['model'],qs[_0x011e('0x37')](_0xa4ce74[_0x011e('0x32')][_0x011e('0x37')]));_0x30ff23[_0x011e('0x36')]=_0x30ff23[_0x011e('0x36')]['length']?_0x30ff23[_0x011e('0x36')]:_0x4282ef['model'];if(!_0xa4ce74[_0x011e('0x32')]['hasOwnProperty'](_0x011e('0x38'))){_0x30ff23[_0x011e('0x1e')]=qs['limit'](_0xa4ce74[_0x011e('0x32')][_0x011e('0x1e')]);_0x30ff23['offset']=qs[_0x011e('0x1c')](_0xa4ce74['query'][_0x011e('0x1c')]);}_0x30ff23['order']=qs[_0x011e('0x39')](_0xa4ce74['query']['sort']);_0x30ff23[_0x011e('0x3a')]=qs[_0x011e('0x33')](_[_0x011e('0x3b')](_0xa4ce74[_0x011e('0x32')],_0x4282ef['filters']),_0x416dc2);if(_0xa4ce74[_0x011e('0x32')][_0x011e('0x3c')]){_0x30ff23[_0x011e('0x3a')]=_[_0x011e('0x3d')](_0x30ff23[_0x011e('0x3a')],{'$or':_['map'](_0x30ff23['attributes'],function(_0x3ed7d9){var _0x3f2ff6={};_0x3f2ff6[_0x3ed7d9]={'$like':'%'+_0xa4ce74[_0x011e('0x32')][_0x011e('0x3c')]+'%'};return _0x3f2ff6;})});}_0x30ff23=_[_0x011e('0x3d')]({},_0x30ff23,_0xa4ce74[_0x011e('0x3e')]);var _0x1b5bba={'where':_0x30ff23[_0x011e('0x3a')]};return db[_0x011e('0x3f')][_0x011e('0x1f')](_0x1b5bba)['then'](function(_0x431818){_0x4638b6[_0x011e('0x1f')]=_0x431818;if(_0xa4ce74[_0x011e('0x32')]['includeAll']){_0x30ff23['include']=[{'all':!![]}];}return db[_0x011e('0x3f')]['findAll'](_0x30ff23);})[_0x011e('0x27')](function(_0x22af52){_0x4638b6[_0x011e('0x40')]=_0x22af52;return _0x4638b6;})[_0x011e('0x27')](respondWithFilteredResult(_0xe6df5b,_0x30ff23))[_0x011e('0x41')](handleError(_0xe6df5b,null));})[_0x011e('0x41')](handleError(_0xe6df5b,null));};exports[_0x011e('0x42')]=function(_0x549245,_0x583388){var _0x427639={'raw':![],'where':{'id':_0x549245[_0x011e('0x43')]['id']}},_0x26536c={};_0x26536c[_0x011e('0x35')]=_[_0x011e('0x31')](db[_0x011e('0x3f')][_0x011e('0x44')]);_0x26536c[_0x011e('0x32')]=_['keys'](_0x549245[_0x011e('0x32')]);_0x26536c[_0x011e('0x33')]=_['intersection'](_0x26536c[_0x011e('0x35')],_0x26536c[_0x011e('0x32')]);_0x427639['attributes']=_['intersection'](_0x26536c[_0x011e('0x35')],qs[_0x011e('0x37')](_0x549245[_0x011e('0x32')][_0x011e('0x37')]));_0x427639['attributes']=_0x427639['attributes'][_0x011e('0x45')]?_0x427639[_0x011e('0x36')]:_0x26536c[_0x011e('0x35')];if(_0x549245[_0x011e('0x32')][_0x011e('0x46')]){_0x427639['include']=[{'all':!![]}];}_0x427639=_[_0x011e('0x3d')]({},_0x427639,_0x549245[_0x011e('0x3e')]);return db[_0x011e('0x3f')][_0x011e('0x47')](_0x427639)[_0x011e('0x27')](handleEntityNotFound(_0x583388,null))['then'](respondWithResult(_0x583388,null))[_0x011e('0x41')](handleError(_0x583388,null));};exports[_0x011e('0x48')]=function(_0x35dfd1,_0x4278da){return db['CmCompany']['create'](_0x35dfd1[_0x011e('0x49')],{})['then'](function(_0x424b85){var _0x567d90=_0x35dfd1['user'][_0x011e('0x4a')]({'plain':!![]});if(!_0x567d90)throw new Error(_0x011e('0x4b'));if(_0x567d90[_0x011e('0x4c')]===_0x011e('0x4d')){var _0x3aedb6=_0x424b85['get']({'plain':!![]});var _0x38a23d='Companies';return db[_0x011e('0x4e')][_0x011e('0x47')]({'where':{'name':_0x38a23d,'userProfileId':_0x567d90[_0x011e('0x4f')]},'raw':!![]})[_0x011e('0x27')](function(_0x2c5259){if(_0x2c5259&&_0x2c5259[_0x011e('0x50')]===0x0){return db[_0x011e('0x29')]['create']({'name':_0x3aedb6[_0x011e('0x2d')],'resourceId':_0x3aedb6['id'],'type':_0x2c5259[_0x011e('0x2d')],'sectionId':_0x2c5259['id']},{})[_0x011e('0x27')](function(){return _0x424b85;});}else{return _0x424b85;}})[_0x011e('0x41')](function(_0x47f52b){logger[_0x011e('0x2b')](_0x011e('0x51'),_0x47f52b);throw _0x47f52b;});}return _0x424b85;})['then'](respondWithResult(_0x4278da,0xc9))[_0x011e('0x41')](handleError(_0x4278da,null));};exports[_0x011e('0x26')]=function(_0x47ba3d,_0x112c18){if(_0x47ba3d[_0x011e('0x49')]['id']){delete _0x47ba3d['body']['id'];}return db[_0x011e('0x3f')][_0x011e('0x47')]({'where':{'id':_0x47ba3d[_0x011e('0x43')]['id']}})[_0x011e('0x27')](handleEntityNotFound(_0x112c18,null))['then'](saveUpdates(_0x47ba3d[_0x011e('0x49')],null))[_0x011e('0x27')](respondWithResult(_0x112c18,null))[_0x011e('0x41')](handleError(_0x112c18,null));};exports[_0x011e('0x2a')]=function(_0x8bcc9b,_0x6bfd8){return db[_0x011e('0x3f')][_0x011e('0x47')]({'where':{'id':_0x8bcc9b[_0x011e('0x43')]['id']}})[_0x011e('0x27')](handleEntityNotFound(_0x6bfd8,null))[_0x011e('0x27')](removeEntity(_0x6bfd8,null))[_0x011e('0x41')](handleError(_0x6bfd8,null));};exports['describe']=function(_0x263baf,_0x27b00d){return db['CmCompany'][_0x011e('0x30')]()['then'](respondWithResult(_0x27b00d,null))['catch'](handleError(_0x27b00d,null));};exports['addContacts']=function(_0x4d85d5,_0x5dd18c,_0x2171c5){return db[_0x011e('0x52')]['find']({'where':{'id':_0x4d85d5[_0x011e('0x43')]['id']}})[_0x011e('0x27')](handleEntityNotFound(_0x5dd18c,null))[_0x011e('0x27')](function(_0xaa5ed7){if(_0xaa5ed7){return _0xaa5ed7['addContacts'](_0x4d85d5[_0x011e('0x49')]['ids'],_['omit'](_0x4d85d5[_0x011e('0x49')],['ids','id'])||{});}})['then'](respondWithResult(_0x5dd18c,null))[_0x011e('0x41')](handleError(_0x5dd18c,null));};exports[_0x011e('0x53')]=function(_0x42ec3e,_0x4da7b6,_0xce67d9){var _0x1fdb0d={};var _0x47b2a3={};var _0x2c36a6;var _0x45fd32;return db[_0x011e('0x3f')]['findOne']({'where':{'id':_0x42ec3e[_0x011e('0x43')]['id']}})[_0x011e('0x27')](handleEntityNotFound(_0x4da7b6,null))['then'](function(_0x3b1511){if(_0x3b1511){_0x2c36a6=_0x3b1511;_0x47b2a3[_0x011e('0x35')]=_[_0x011e('0x31')](db[_0x011e('0x52')][_0x011e('0x44')]);_0x47b2a3['query']=_[_0x011e('0x31')](_0x42ec3e['query']);_0x47b2a3[_0x011e('0x33')]=_['intersection'](_0x47b2a3[_0x011e('0x35')],_0x47b2a3[_0x011e('0x32')]);_0x1fdb0d[_0x011e('0x36')]=_[_0x011e('0x34')](_0x47b2a3[_0x011e('0x35')],qs[_0x011e('0x37')](_0x42ec3e[_0x011e('0x32')]['fields']));_0x1fdb0d[_0x011e('0x36')]=_0x1fdb0d['attributes'][_0x011e('0x45')]?_0x1fdb0d[_0x011e('0x36')]:_0x47b2a3[_0x011e('0x35')];_0x1fdb0d['order']=qs[_0x011e('0x39')](_0x42ec3e[_0x011e('0x32')]['sort']);_0x1fdb0d['where']=qs[_0x011e('0x33')](_['pick'](_0x42ec3e[_0x011e('0x32')],_0x47b2a3[_0x011e('0x33')]));if(_0x42ec3e[_0x011e('0x32')][_0x011e('0x3c')]){_0x1fdb0d['where']=_[_0x011e('0x3d')](_0x1fdb0d[_0x011e('0x3a')],{'$or':_['map'](_0x1fdb0d['attributes'],function(_0x3db23f){var _0x97e89={};_0x97e89[_0x3db23f]={'$like':'%'+_0x42ec3e[_0x011e('0x32')]['filter']+'%'};return _0x97e89;})});}_0x1fdb0d=_[_0x011e('0x3d')]({},_0x1fdb0d,_0x42ec3e[_0x011e('0x3e')]);return _0x2c36a6['getContacts'](_0x1fdb0d);}})['then'](function(_0x4704a2){if(_0x4704a2){_0x45fd32=_0x4704a2[_0x011e('0x45')];if(!_0x42ec3e[_0x011e('0x32')][_0x011e('0x54')](_0x011e('0x38'))){_0x1fdb0d['limit']=qs['limit'](_0x42ec3e['query'][_0x011e('0x1e')]);_0x1fdb0d[_0x011e('0x1c')]=qs[_0x011e('0x1c')](_0x42ec3e[_0x011e('0x32')][_0x011e('0x1c')]);}return _0x2c36a6['getContacts'](_0x1fdb0d);}})[_0x011e('0x27')](function(_0x573ba5){if(_0x573ba5){return _0x573ba5?{'count':_0x45fd32,'rows':_0x573ba5}:null;}})['then'](respondWithResult(_0x4da7b6,null))[_0x011e('0x41')](handleError(_0x4da7b6,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 02caebb..fec6018 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 _0x4e9b=['bluebird','request-promise','path','rimraf','../../config/environment','CmCompany','lodash','util','moment'];(function(_0x34f515,_0x3f92dd){var _0x1ae9bb=function(_0xda4c4c){while(--_0xda4c4c){_0x34f515['push'](_0x34f515['shift']());}};_0x1ae9bb(++_0x3f92dd);}(_0x4e9b,0x1bf));var _0xb4e9=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x4e9b[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xb4e9('0x0'));var util=require(_0xb4e9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb4e9('0x2'));var BPromise=require(_0xb4e9('0x3'));var rp=require(_0xb4e9('0x4'));var fs=require('fs');var path=require(_0xb4e9('0x5'));var rimraf=require(_0xb4e9('0x6'));var config=require(_0xb4e9('0x7'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x11b987,_0xa2950a){return _0x11b987['define'](_0xb4e9('0x8'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ffe=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','lodash'];(function(_0x5912f6,_0x3c1ed5){var _0x206eac=function(_0x46c337){while(--_0x46c337){_0x5912f6['push'](_0x5912f6['shift']());}};_0x206eac(++_0x3c1ed5);}(_0x6ffe,0x144));var _0xe6ff=function(_0x43f4c8,_0x22a037){_0x43f4c8=_0x43f4c8-0x0;var _0x3a2e0c=_0x6ffe[_0x43f4c8];return _0x3a2e0c;};'use strict';var _=require(_0xe6ff('0x0'));var util=require(_0xe6ff('0x1'));var logger=require(_0xe6ff('0x2'))(_0xe6ff('0x3'));var moment=require('moment');var BPromise=require(_0xe6ff('0x4'));var rp=require(_0xe6ff('0x5'));var fs=require('fs');var path=require(_0xe6ff('0x6'));var rimraf=require(_0xe6ff('0x7'));var config=require(_0xe6ff('0x8'));var attributes=require('./cmCompany.attributes');module[_0xe6ff('0x9')]=function(_0x392c82,_0x1628c7){return _0x392c82[_0xe6ff('0xa')](_0xe6ff('0xb'),attributes,{'tableName':_0xe6ff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 2e8e024..15aa59f 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 _0x1a2f=['CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x496296,_0x2127b0){var _0x3f6ea7=function(_0x2cd8b3){while(--_0x2cd8b3){_0x496296['push'](_0x496296['shift']());}};_0x3f6ea7(++_0x2127b0);}(_0x1a2f,0xf6));var _0xf1a2=function(_0x53fe4c,_0x4a521c){_0x53fe4c=_0x53fe4c-0x0;var _0x2b3c5b=_0x1a2f[_0x53fe4c];return _0x2b3c5b;};'use strict';var _=require(_0xf1a2('0x0'));var util=require(_0xf1a2('0x1'));var moment=require(_0xf1a2('0x2'));var BPromise=require(_0xf1a2('0x3'));var rs=require(_0xf1a2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1a2('0x5'))['db'];var utils=require(_0xf1a2('0x6'));var logger=require(_0xf1a2('0x7'))('rpc');var config=require(_0xf1a2('0x8'));var jayson=require(_0xf1a2('0x9'));var client=jayson[_0xf1a2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59558c,_0x35cb4f,_0x13e912){return new BPromise(function(_0x33e1e1,_0x2d601c){return client[_0xf1a2('0xb')](_0x59558c,_0x13e912)[_0xf1a2('0xc')](function(_0x599bd4){logger[_0xf1a2('0xd')]('CmCompany,\x20%s,\x20%s',_0x35cb4f,'request\x20sent');logger[_0xf1a2('0xe')](_0xf1a2('0xf'),_0x35cb4f,_0xf1a2('0x10'),JSON['stringify'](_0x599bd4));if(_0x599bd4[_0xf1a2('0x11')]){if(_0x599bd4[_0xf1a2('0x11')]['code']===0x1f4){logger['error'](_0xf1a2('0x12'),_0x35cb4f,_0x599bd4['error'][_0xf1a2('0x13')]);return _0x2d601c(_0x599bd4[_0xf1a2('0x11')][_0xf1a2('0x13')]);}logger[_0xf1a2('0x11')](_0xf1a2('0x12'),_0x35cb4f,_0x599bd4[_0xf1a2('0x11')][_0xf1a2('0x13')]);return _0x33e1e1(_0x599bd4['error'][_0xf1a2('0x13')]);}else{logger['info'](_0xf1a2('0x12'),_0x35cb4f,_0xf1a2('0x10'));_0x33e1e1(_0x599bd4[_0xf1a2('0x14')]['message']);}})[_0xf1a2('0x15')](function(_0x45c902){logger[_0xf1a2('0x11')](_0xf1a2('0x12'),_0x35cb4f,_0x45c902);_0x2d601c(_0x45c902);});});} \ No newline at end of file +var _0xbbf7=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x52e101,_0x308802){var _0x5ac202=function(_0x2948b2){while(--_0x2948b2){_0x52e101['push'](_0x52e101['shift']());}};_0x5ac202(++_0x308802);}(_0xbbf7,0x94));var _0x7bbf=function(_0x5a3787,_0x438e87){_0x5a3787=_0x5a3787-0x0;var _0x13b2ed=_0xbbf7[_0x5a3787];return _0x13b2ed;};'use strict';var _=require(_0x7bbf('0x0'));var util=require(_0x7bbf('0x1'));var moment=require(_0x7bbf('0x2'));var BPromise=require(_0x7bbf('0x3'));var rs=require(_0x7bbf('0x4'));var fs=require('fs');var Redis=require(_0x7bbf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bbf('0x6'));var logger=require('../../config/logger')(_0x7bbf('0x7'));var config=require(_0x7bbf('0x8'));var jayson=require(_0x7bbf('0x9'));var client=jayson['client'][_0x7bbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x281834,_0x37778e,_0x379278){return new BPromise(function(_0x463a26,_0xbbb355){return client[_0x7bbf('0xb')](_0x281834,_0x379278)[_0x7bbf('0xc')](function(_0x84d209){logger[_0x7bbf('0xd')](_0x7bbf('0xe'),_0x37778e,_0x7bbf('0xf'));logger['debug'](_0x7bbf('0x10'),_0x37778e,'request\x20sent',JSON['stringify'](_0x84d209));if(_0x84d209[_0x7bbf('0x11')]){if(_0x84d209[_0x7bbf('0x11')][_0x7bbf('0x12')]===0x1f4){logger[_0x7bbf('0x11')](_0x7bbf('0xe'),_0x37778e,_0x84d209[_0x7bbf('0x11')][_0x7bbf('0x13')]);return _0xbbb355(_0x84d209[_0x7bbf('0x11')][_0x7bbf('0x13')]);}logger[_0x7bbf('0x11')](_0x7bbf('0xe'),_0x37778e,_0x84d209[_0x7bbf('0x11')][_0x7bbf('0x13')]);return _0x463a26(_0x84d209['error']['message']);}else{logger[_0x7bbf('0xd')](_0x7bbf('0xe'),_0x37778e,_0x7bbf('0xf'));_0x463a26(_0x84d209['result'][_0x7bbf('0x13')]);}})[_0x7bbf('0x14')](function(_0x3b21fe){logger[_0x7bbf('0x11')](_0x7bbf('0xe'),_0x37778e,_0x3b21fe);_0xbbb355(_0x3b21fe);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 456096f..58f53ab 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 _0x9f1a=['/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','describe'];(function(_0x257856,_0x59c2ef){var _0x1eef62=function(_0x378d9c){while(--_0x378d9c){_0x257856['push'](_0x257856['shift']());}};_0x1eef62(++_0x59c2ef);}(_0x9f1a,0x18b));var _0xa9f1=function(_0x197bfc,_0x57351b){_0x197bfc=_0x197bfc-0x0;var _0x14ca92=_0x9f1a[_0x197bfc];return _0x14ca92;};'use strict';var multer=require(_0xa9f1('0x0'));var util=require(_0xa9f1('0x1'));var path=require('path');var timeout=require(_0xa9f1('0x2'));var express=require(_0xa9f1('0x3'));var router=express[_0xa9f1('0x4')]();var fs_extra=require(_0xa9f1('0x5'));var auth=require(_0xa9f1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa9f1('0x7'));var controller=require(_0xa9f1('0x8'));router['get']('/',auth[_0xa9f1('0x9')](),controller[_0xa9f1('0xa')]);router[_0xa9f1('0xb')]('/describe',auth[_0xa9f1('0x9')](),controller[_0xa9f1('0xc')]);router[_0xa9f1('0xb')](_0xa9f1('0xd'),auth[_0xa9f1('0x9')](),controller[_0xa9f1('0xe')]);router[_0xa9f1('0xb')](_0xa9f1('0xf'),auth[_0xa9f1('0x9')](),controller[_0xa9f1('0x10')]);router[_0xa9f1('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/contacts',auth[_0xa9f1('0x9')](),controller[_0xa9f1('0x12')]);router[_0xa9f1('0x13')](_0xa9f1('0xd'),auth['isAuthenticated'](),controller[_0xa9f1('0x14')]);router[_0xa9f1('0x15')]('/:id',auth[_0xa9f1('0x9')](),controller[_0xa9f1('0x16')]);module[_0xa9f1('0x17')]=router; \ No newline at end of file +var _0x7d8a=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','update'];(function(_0x34c937,_0xa42f53){var _0x196ef4=function(_0x54b2fd){while(--_0x54b2fd){_0x34c937['push'](_0x34c937['shift']());}};_0x196ef4(++_0xa42f53);}(_0x7d8a,0x1cb));var _0xa7d8=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0x7d8a[_0x597484];return _0x218e64;};'use strict';var multer=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var path=require('path');var timeout=require(_0xa7d8('0x2'));var express=require(_0xa7d8('0x3'));var router=express[_0xa7d8('0x4')]();var fs_extra=require(_0xa7d8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa7d8('0x6'));var config=require('../../config/environment');var controller=require(_0xa7d8('0x7'));router[_0xa7d8('0x8')]('/',auth['isAuthenticated'](),controller[_0xa7d8('0x9')]);router[_0xa7d8('0x8')](_0xa7d8('0xa'),auth[_0xa7d8('0xb')](),controller[_0xa7d8('0xc')]);router[_0xa7d8('0x8')](_0xa7d8('0xd'),auth[_0xa7d8('0xb')](),controller[_0xa7d8('0xe')]);router[_0xa7d8('0x8')](_0xa7d8('0xf'),auth[_0xa7d8('0xb')](),controller[_0xa7d8('0x10')]);router[_0xa7d8('0x11')]('/',auth['isAuthenticated'](),controller[_0xa7d8('0x12')]);router[_0xa7d8('0x11')](_0xa7d8('0xf'),auth[_0xa7d8('0xb')](),controller[_0xa7d8('0x13')]);router['put'](_0xa7d8('0xd'),auth[_0xa7d8('0xb')](),controller[_0xa7d8('0x14')]);router[_0xa7d8('0x15')](_0xa7d8('0xd'),auth[_0xa7d8('0xb')](),controller[_0xa7d8('0x16')]);module[_0xa7d8('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3b5746e..f834ff6 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 _0x1f90=['sequelize','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x1f90,0xc7));var _0x01f9=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0x1f90[_0x233716];return _0x302298;};'use strict';var _=require(_0x01f9('0x0'));var Sequelize=require(_0x01f9('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x01f9('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x01f9('0x2')]},'street':{'type':Sequelize[_0x01f9('0x2')]},'postalCode':{'type':Sequelize[_0x01f9('0x2')]},'city':{'type':Sequelize[_0x01f9('0x2')]},'country':{'type':Sequelize[_0x01f9('0x2')]},'dateOfBirth':{'type':Sequelize[_0x01f9('0x2')]},'description':{'type':Sequelize[_0x01f9('0x3')]},'phone':{'type':Sequelize[_0x01f9('0x2')]},'mobile':{'type':Sequelize[_0x01f9('0x2')]},'fax':{'type':Sequelize[_0x01f9('0x2')]},'email':{'type':Sequelize[_0x01f9('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x01f9('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x01f9('0x2')]},'skype':{'type':Sequelize[_0x01f9('0x2')]},'teams':{'type':Sequelize[_0x01f9('0x2')]},'viber':{'type':Sequelize[_0x01f9('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x01f9('0x2')]},'telegram':{'type':Sequelize[_0x01f9('0x2')]},'UserId':{'type':Sequelize[_0x01f9('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x01f9('0x4')](0x2)[_0x01f9('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x01f9('0x6')],'defaultValue':Sequelize[_0x01f9('0x7')]},'dialTimezone':{'type':Sequelize[_0x01f9('0x2')]},'utcOffset':{'type':Sequelize[_0x01f9('0x4')]}}; \ No newline at end of file +var _0x8370=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x565f25,_0x1363a5){var _0x41161e=function(_0x206ea8){while(--_0x206ea8){_0x565f25['push'](_0x565f25['shift']());}};_0x41161e(++_0x1363a5);}(_0x8370,0xbc));var _0x0837=function(_0x5cdac3,_0x405f84){_0x5cdac3=_0x5cdac3-0x0;var _0x171a81=_0x8370[_0x5cdac3];return _0x171a81;};'use strict';var _=require(_0x0837('0x0'));var Sequelize=require(_0x0837('0x1'));module[_0x0837('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x0837('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x0837('0x3')]},'country':{'type':Sequelize[_0x0837('0x3')]},'dateOfBirth':{'type':Sequelize[_0x0837('0x3')]},'description':{'type':Sequelize[_0x0837('0x4')]},'phone':{'type':Sequelize[_0x0837('0x3')]},'mobile':{'type':Sequelize[_0x0837('0x3')]},'fax':{'type':Sequelize[_0x0837('0x3')]},'email':{'type':Sequelize[_0x0837('0x3')]},'url':{'type':Sequelize[_0x0837('0x3')]},'facebook':{'type':Sequelize[_0x0837('0x3')]},'fb_data':{'type':Sequelize[_0x0837('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x0837('0x3')]},'viber':{'type':Sequelize[_0x0837('0x3')]},'line':{'type':Sequelize[_0x0837('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x0837('0x3')]},'UserId':{'type':Sequelize[_0x0837('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x0837('0x3')]},'priority':{'type':Sequelize[_0x0837('0x5')](0x2)[_0x0837('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0837('0x7')],'defaultValue':Sequelize[_0x0837('0x8')]},'dialTimezone':{'type':Sequelize[_0x0837('0x3')]},'utcOffset':{'type':Sequelize[_0x0837('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index bf74aba..7c8d728 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 _0x5b25=['from','get','mergeWith','isArray','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','isNil','dialTimezone','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','spread','hasOwnProperty','all','show','params','Tag','Tags','color','tag','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize','literal','$and','omit','map','format','cf_%d','timezones','isEmpty','table','phone','getTags','findOne','rawAttributes','intersection','model','fields','attributes','order','sort','filters','pick','filter','merge','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','getHoppers','ContactId','count','includeAll','include','rows','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','child_process','fork','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','mail','chat','openchannel','fax','whatsapp','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','callerid','endtime','createdAt','userDisposition','userSecondDisposition','UserId','fullname','alias','DESC','startCase','Website','Account','closed','note','disposition','thirdDisposition','key','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','flatten','sortBy','reverse','value','slice','moment','util','path','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','json','offset','undefined','limit','status','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','findAll','query','user','find','catch','CmContact','describe','tags','keys','startsWith','cf_','columnName','analytics','CmCustomField','length','displayName','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','body'];(function(_0x539277,_0x2ea1dc){var _0x2ac9c7=function(_0x191bac){while(--_0x191bac){_0x539277['push'](_0x539277['shift']());}};_0x2ac9c7(++_0x2ea1dc);}(_0x5b25,0xc9));var _0x55b2=function(_0x2a0421,_0x2530ae){_0x2a0421=_0x2a0421-0x0;var _0x2fd8de=_0x5b25[_0x2a0421];return _0x2fd8de;};'use strict';var moment=require(_0x55b2('0x0'));var BPromise=require('bluebird');var util=require(_0x55b2('0x1'));var path=require(_0x55b2('0x2'));var fs=require('fs');var _=require(_0x55b2('0x3'));var squel=require(_0x55b2('0x4'));var Papa=require('papaparse');var Redis=require(_0x55b2('0x5'));var contacts=require(_0x55b2('0x6'));var qs=require(_0x55b2('0x7'));var logger=require(_0x55b2('0x8'))(_0x55b2('0x9'));var config=require('../../config/environment');var shared=require(_0x55b2('0xa'));var db=require(_0x55b2('0xb'))['db'];config[_0x55b2('0xc')]=_[_0x55b2('0xd')](config[_0x55b2('0xc')],{'host':_0x55b2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55b2('0xc')]));require(_0x55b2('0xf'))[_0x55b2('0x10')](socket);function respondWithResult(_0x3b51f4,_0x1ad0b2){_0x1ad0b2=_0x1ad0b2||0xc8;return function(_0x103ece){if(_0x103ece){return _0x3b51f4['status'](_0x1ad0b2)[_0x55b2('0x11')](_0x103ece);}};}function respondWithFilteredResult(_0x330c00,_0x16c00c){return function(_0x2d1488){if(_0x2d1488){var _0x483ef=typeof _0x16c00c[_0x55b2('0x12')]===_0x55b2('0x13')&&typeof _0x16c00c[_0x55b2('0x14')]===_0x55b2('0x13');var _0x28664a=_0x2d1488['count'];var _0x27d3d4=_0x483ef?0x0:_0x16c00c[_0x55b2('0x12')];var _0xbbd47d=_0x483ef?_0x2d1488['count']:_0x16c00c['offset']+_0x16c00c['limit'];var _0x2dd24d;if(_0xbbd47d>=_0x28664a){_0xbbd47d=_0x28664a;_0x2dd24d=0xc8;}else{_0x2dd24d=0xce;}_0x330c00[_0x55b2('0x15')](_0x2dd24d);return _0x330c00[_0x55b2('0x16')](_0x55b2('0x17'),_0x27d3d4+'-'+_0xbbd47d+'/'+_0x28664a)[_0x55b2('0x11')](_0x2d1488);}return null;};}function saveUpdates(_0x1fa58f){return function(_0x87920){if(_0x87920){return _0x87920[_0x55b2('0x18')](_0x1fa58f)[_0x55b2('0x19')](function(_0x503f54){return _0x503f54;});}return null;};}function removeEntity(_0xb4c097){return function(_0x645aff){if(_0x645aff){return _0x645aff[_0x55b2('0x1a')]()['then'](function(){_0xb4c097[_0x55b2('0x15')](0xcc)[_0x55b2('0x1b')]();});}};}function handleEntityNotFound(_0x14e5e9){return function(_0x53e25e){if(!_0x53e25e){_0x14e5e9['sendStatus'](0x194);}return _0x53e25e;};}function handleError(_0x1b13fa,_0x444245){_0x444245=_0x444245||0x1f4;return function(_0x48f7c4){logger[_0x55b2('0x1c')](_0x48f7c4[_0x55b2('0x1d')]);if(_0x48f7c4[_0x55b2('0x1e')]){delete _0x48f7c4['name'];}_0x1b13fa['status'](_0x444245)[_0x55b2('0x1f')](_0x48f7c4);};}exports[_0x55b2('0x20')]=function(_0x4ad2ea,_0x39807f){var _0x13fbb0={};return contacts['describe']()[_0x55b2('0x19')](function(_0xa1f013){_0x13fbb0=qs['getOptions'](_0xa1f013,_0x4ad2ea);return contacts[_0x55b2('0x21')](_0x4ad2ea[_0x55b2('0x22')],_0x4ad2ea[_0x55b2('0x23')],_0x13fbb0,_0xa1f013);})[_0x55b2('0x19')](respondWithFilteredResult(_0x39807f,_0x13fbb0))['catch'](handleError(_0x39807f,null));};exports['destroy']=function(_0x37af3b,_0x12a375){return db['CmContact'][_0x55b2('0x24')]({'where':{'id':_0x37af3b['params']['id']}})[_0x55b2('0x19')](handleEntityNotFound(_0x12a375,null))[_0x55b2('0x19')](removeEntity(_0x12a375,null))[_0x55b2('0x25')](handleError(_0x12a375,null));};exports['describe']=function(_0x1a1d99,_0x4594c8){return db[_0x55b2('0x26')][_0x55b2('0x27')]()[_0x55b2('0x19')](function(_0x2d229e){delete _0x2d229e[_0x55b2('0x28')];for(var _0x1ea3d4=0x0;_0x1ea3d40x0){return new Promise(function(_0x7029f1){var _0x249b29=[];for(var _0x1bfa0c=0x0;_0x1bfa0c<_0x44fe2c[_0x55b2('0x2f')];_0x1bfa0c++){_0x249b29['push'](insertAdditionalPhones(_0x44fe2c[_0x1bfa0c]['contact'],_0x44fe2c[_0x1bfa0c]['additionalPhones']));}Promise[_0x55b2('0x62')](_0x249b29)['then'](function(){_0x7029f1(0x1);});})[_0x55b2('0x19')](function(){return{'success':_0x3ae698,'failure':_0x4d8771,'duplicates':_0x37b2f7};});}else{return{'success':_0x3ae698,'failure':_0x4d8771,'duplicates':_0x37b2f7};}}})['then'](respondWithResult(_0x182fd6,0xc9))['catch'](handleError(_0x182fd6,null));};exports[_0x55b2('0x63')]=function(_0x3714f3,_0x448e72){var _0x4c6c9e;return db[_0x55b2('0x26')]['describe']()[_0x55b2('0x19')](function(_0x7dd127){return db[_0x55b2('0x26')]['find']({'where':{'id':_0x3714f3[_0x55b2('0x64')]['id']},'include':[{'model':db[_0x55b2('0x65')],'as':_0x55b2('0x66'),'attributes':['id','name',_0x55b2('0x67')],'required':_0x3714f3[_0x55b2('0x22')][_0x55b2('0x68')]?!![]:![]},{'model':db[_0x55b2('0x69')],'as':_0x55b2('0x6a'),'where':{'CmContactId':_0x3714f3[_0x55b2('0x64')]['id']},'required':![],'include':[{'model':db[_0x55b2('0x6b')],'as':_0x55b2('0x6c')}]}],'order':[db[_0x55b2('0x6d')][_0x55b2('0x6e')]('Phones.OrderBy')],'attributes':_[_0x55b2('0x29')](_0x7dd127)});})[_0x55b2('0x19')](function(_0x4a6213){if(!_[_0x55b2('0x55')](_0x4a6213)){_0x4c6c9e=_0x4a6213[_0x55b2('0x37')]({'plain':!![]});var _0x571397={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4a6213&&_0x4a6213['ListId']){if(_0x4a6213[_0x55b2('0x5f')]){_0x571397[_0x55b2('0x5e')][_0x55b2('0x6f')][_0x55b2('0x5d')]({'ListId':{'$ne':_0x4a6213[_0x55b2('0x5f')]}});}}return db[_0x55b2('0x2e')][_0x55b2('0x21')](_0x571397);}})[_0x55b2('0x19')](function(_0x4c10db){if(!_[_0x55b2('0x55')](_0x4c10db)){return _[_0x55b2('0x70')](_0x4c6c9e,_[_0x55b2('0x71')](_0x4c10db,function(_0x16cc5b){return util[_0x55b2('0x72')](_0x55b2('0x73'),_0x16cc5b['id']);}));}})[_0x55b2('0x19')](handleEntityNotFound(_0x448e72,null))[_0x55b2('0x19')](respondWithResult(_0x448e72,null))[_0x55b2('0x25')](handleError(_0x448e72,null));};exports['update']=function(_0x14ef7b,_0x23593d){var _0x10542e;if(_0x14ef7b[_0x55b2('0x35')]['id']){delete _0x14ef7b['body']['id'];}if(!_[_0x55b2('0x55')](_0x14ef7b[_0x55b2('0x35')][_0x55b2('0x56')])){var _0x5aa0b6=_0x14ef7b[_0x55b2('0x35')][_0x55b2('0x56')];if(!_[_0x55b2('0x55')](shared[_0x55b2('0x74')][_0x5aa0b6]))_0x14ef7b[_0x55b2('0x35')][_0x55b2('0x57')]=shared[_0x55b2('0x74')][_0x5aa0b6][_0x55b2('0x57')];}return db[_0x55b2('0x26')]['find']({'where':{'id':_0x14ef7b['params']['id']}})['then'](handleEntityNotFound(_0x23593d,null))[_0x55b2('0x19')](saveUpdates(_0x14ef7b['body'],null))[_0x55b2('0x19')](function(_0x1189f){_0x10542e=_0x1189f;var _0x577fea={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1189f&&_0x1189f[_0x55b2('0x5f')]){if(_0x1189f[_0x55b2('0x5f')]){_0x577fea[_0x55b2('0x5e')]['$and'][_0x55b2('0x5d')]({'ListId':{'$ne':_0x1189f[_0x55b2('0x5f')]}});}}return db[_0x55b2('0x2e')][_0x55b2('0x21')](_0x577fea);})['then'](function(_0x3638a3){if(_0x3638a3){return _['omit'](_['pickBy'](_0x14ef7b[_0x55b2('0x35')],function(_0x38dc34,_0x48f935){return _['startsWith'](_0x48f935,_0x55b2('0x2b'));}),_[_0x55b2('0x71')](_0x3638a3,function(_0x35f54e){return util[_0x55b2('0x72')](_0x55b2('0x73'),_0x35f54e['id']);}));}})[_0x55b2('0x19')](function(_0x2d64a4){if(_0x2d64a4&&!_[_0x55b2('0x75')](_0x2d64a4)){var _0x529097=squel[_0x55b2('0x18')]()[_0x55b2('0x76')]('cm_contacts')['setFields'](_0x2d64a4)[_0x55b2('0x5e')]('id\x20=\x20?',_0x14ef7b[_0x55b2('0x64')]['id'])['toParam']();return db[_0x55b2('0x6d')]['query'](_0x529097['text'],{'replacements':_0x529097['values']});}})[_0x55b2('0x19')](function(){if(_0x14ef7b[_0x55b2('0x35')][_0x55b2('0x77')]&&_0x10542e){return db[_0x55b2('0x3b')][_0x55b2('0x18')]({'phone':_0x14ef7b[_0x55b2('0x35')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x10542e['id']}});}})[_0x55b2('0x19')](function(){return _0x10542e;})['then'](respondWithResult(_0x23593d,null))[_0x55b2('0x25')](handleError(_0x23593d,null));};exports[_0x55b2('0x78')]=function(_0x15bb04,_0x5adb97){var _0x997ef9={};var _0x16b14f={};var _0x4f8f75;var _0x544659;return db[_0x55b2('0x26')][_0x55b2('0x79')]({'where':{'id':_0x15bb04[_0x55b2('0x64')]['id']}})['then'](handleEntityNotFound(_0x5adb97,null))[_0x55b2('0x19')](function(_0x4608a4){if(_0x4608a4){_0x4f8f75=_0x4608a4;_0x16b14f['model']=_['keys'](db[_0x55b2('0x65')][_0x55b2('0x7a')]);_0x16b14f[_0x55b2('0x22')]=_[_0x55b2('0x29')](_0x15bb04[_0x55b2('0x22')]);_0x16b14f['filters']=_[_0x55b2('0x7b')](_0x16b14f[_0x55b2('0x7c')],_0x16b14f[_0x55b2('0x22')]);_0x997ef9['attributes']=_[_0x55b2('0x7b')](_0x16b14f['model'],qs[_0x55b2('0x7d')](_0x15bb04[_0x55b2('0x22')][_0x55b2('0x7d')]));_0x997ef9[_0x55b2('0x7e')]=_0x997ef9[_0x55b2('0x7e')][_0x55b2('0x2f')]?_0x997ef9[_0x55b2('0x7e')]:_0x16b14f[_0x55b2('0x7c')];_0x997ef9[_0x55b2('0x7f')]=qs[_0x55b2('0x80')](_0x15bb04[_0x55b2('0x22')][_0x55b2('0x80')]);_0x997ef9[_0x55b2('0x5e')]=qs[_0x55b2('0x81')](_[_0x55b2('0x82')](_0x15bb04[_0x55b2('0x22')],_0x16b14f['filters']));if(_0x15bb04['query'][_0x55b2('0x83')]){_0x997ef9[_0x55b2('0x5e')]=_[_0x55b2('0x84')](_0x997ef9[_0x55b2('0x5e')],{'$or':_[_0x55b2('0x71')](_0x997ef9[_0x55b2('0x7e')],function(_0x2f3133){var _0x2c502d={};_0x2c502d[_0x2f3133]={'$like':'%'+_0x15bb04[_0x55b2('0x22')]['filter']+'%'};return _0x2c502d;})});}_0x997ef9=_[_0x55b2('0x84')]({},_0x997ef9,_0x15bb04[_0x55b2('0x85')]);return _0x4f8f75[_0x55b2('0x78')](_0x997ef9);}})[_0x55b2('0x19')](function(_0x29067a){if(_0x29067a){_0x544659=_0x29067a[_0x55b2('0x2f')];if(!_0x15bb04[_0x55b2('0x22')][_0x55b2('0x61')](_0x55b2('0x86'))){_0x997ef9[_0x55b2('0x14')]=qs[_0x55b2('0x14')](_0x15bb04[_0x55b2('0x22')]['limit']);_0x997ef9['offset']=qs[_0x55b2('0x12')](_0x15bb04['query']['offset']);}return _0x4f8f75[_0x55b2('0x78')](_0x997ef9);}})[_0x55b2('0x19')](function(_0x1cedd1){if(_0x1cedd1){return _0x1cedd1?{'count':_0x544659,'rows':_0x1cedd1}:null;}})[_0x55b2('0x19')](respondWithResult(_0x5adb97,null))[_0x55b2('0x25')](handleError(_0x5adb97,null));};exports[_0x55b2('0x87')]=function(_0x19b7d4,_0x18912c){if(_0x19b7d4[_0x55b2('0x35')]['id']){delete _0x19b7d4['body']['id'];}return db[_0x55b2('0x26')]['findOne']({'where':{'id':_0x19b7d4[_0x55b2('0x64')]['id']}})['then'](handleEntityNotFound(_0x18912c,null))[_0x55b2('0x19')](function(_0x48dabd){if(_0x48dabd){return _0x48dabd['setTags'](_0x19b7d4[_0x55b2('0x35')][_0x55b2('0x88')]||[]);}return null;})['then'](respondWithResult(_0x18912c,null))[_0x55b2('0x25')](handleError(_0x18912c,null));};exports[_0x55b2('0x89')]=function(_0x492e4b,_0x571317){var _0x59ac9a=[];_0x59ac9a[_0x55b2('0x5d')](addAdditionalPhones(_0x492e4b[_0x55b2('0x35')]));Promise[_0x55b2('0x62')](_0x59ac9a)[_0x55b2('0x19')](function(){_0x59ac9a=[];_0x59ac9a[_0x55b2('0x5d')](deleteCmHopperPhones(_0x492e4b[_0x55b2('0x35')]['id']));_0x59ac9a['push'](addCmHopperPhones(_0x492e4b['body']['id']));Promise[_0x55b2('0x62')](_0x59ac9a)[_0x55b2('0x19')](function(){return[0x1];})[_0x55b2('0x19')](respondWithResult(_0x571317,null));});};function addAdditionalPhones(_0x31dba7){var _0x5e20b1;return new Promise(function(_0x5f2e83){return db[_0x55b2('0x69')]['destroy']({'where':{'CmContactId':_0x31dba7['id']}})[_0x55b2('0x19')](function(){db[_0x55b2('0x6b')][_0x55b2('0x21')]({'raw':!![],'attributes':['id',_0x55b2('0x8a')]})[_0x55b2('0x19')](function(_0x26e98b){var _0x1702b8=[];for(var _0x5edb8e=0x0;_0x5edb8e<_0x31dba7['items'][_0x55b2('0x2f')];_0x5edb8e++){var _0x56bd9e=_0x31dba7[_0x55b2('0x8b')]?_[_0x55b2('0x55')](_0x31dba7[_0x55b2('0x8b')][_0x5edb8e])?'':_0x31dba7['item_types'][_0x5edb8e]:_0x31dba7[_0x55b2('0x8c')][_0x5edb8e][_0x55b2('0x8d')]?_0x31dba7[_0x55b2('0x8c')][_0x5edb8e][_0x55b2('0x8d')]:'';var _0x53feeb=_[_0x55b2('0x55')](_0x31dba7['items'][_0x5edb8e]['description'])?'':_0x31dba7[_0x55b2('0x8c')][_0x5edb8e][_0x55b2('0x8e')];var _0x1386a9=_0x56bd9e+':'+_0x31dba7[_0x55b2('0x8c')][_0x5edb8e][_0x55b2('0x77')]+'§'+_0x53feeb;if(_['isNil'](_0x5e20b1))_0x5e20b1=_0x1386a9;else _0x5e20b1+=';'+_0x1386a9;var _0x1870f2=null;var _0x2df00f=null;if(_0x31dba7[_0x55b2('0x8b')]){if(!_[_0x55b2('0x55')](_0x31dba7[_0x55b2('0x8b')][_0x5edb8e])){_0x2df00f=_[_0x55b2('0x24')](_0x26e98b,function(_0x2667ab){return _0x2667ab['id']===_0x31dba7[_0x55b2('0x8b')][_0x5edb8e];});if(!_[_0x55b2('0x55')](_0x2df00f)){_0x1870f2=_0x2df00f[_0x55b2('0x8a')];}}}else{if(!_['isNil'](_0x31dba7[_0x55b2('0x8c')][_0x5edb8e])){_0x2df00f=_['find'](_0x26e98b,function(_0x268d59){return _0x268d59['id']===_0x31dba7['items'][_0x5edb8e][_0x55b2('0x8d')];});if(!_['isNil'](_0x2df00f)){_0x1870f2=_0x5edb8e;}}}if(_[_0x55b2('0x55')](_0x1870f2)){_0x1870f2=0x64;}_0x1702b8[_0x55b2('0x5d')](addAdditionalPhone(_0x31dba7['id'],_0x31dba7[_0x55b2('0x8c')][_0x5edb8e][_0x55b2('0x77')],_0x31dba7[_0x55b2('0x8b')]?_[_0x55b2('0x55')](_0x31dba7['item_types'][_0x5edb8e])?null:_0x31dba7[_0x55b2('0x8b')][_0x5edb8e]:_0x31dba7[_0x55b2('0x8c')][_0x5edb8e][_0x55b2('0x8d')]?_0x31dba7['items'][_0x5edb8e][_0x55b2('0x8d')]:null,_0x1870f2,_0x53feeb));}Promise[_0x55b2('0x62')](_0x1702b8)['then'](function(){db[_0x55b2('0x26')][_0x55b2('0x18')]({'AdditionalPhones':_0x5e20b1},{'where':{'id':_0x31dba7['id']}})[_0x55b2('0x19')](function(){_0x5f2e83(0x1);});});});});});}function addAdditionalPhone(_0x19d803,_0xf5b703,_0x5d58aa,_0x38066b,_0x1d8324){return db['CmContactHasItem'][_0x55b2('0x24')]({'where':{'CmContactId':_0x19d803,'item':_0xf5b703}})['then'](function(_0x5943f9){if(_0x5943f9)logger['info'](_0x55b2('0x8f'),_0x5943f9);else{db[_0x55b2('0x69')]['create']({'CmContactId':_0x19d803,'item':_0xf5b703,'ItemTypeId':_0x5d58aa,'OrderBy':_0x38066b,'ItemClass':_0x55b2('0x90'),'description':_0x1d8324});}});}function deleteCmHopperPhones(_0x5ad46e){return new Promise(function(_0xe6ded4){return db['CmHopper'][_0x55b2('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5ad46e}})[_0x55b2('0x19')](function(_0x385634){db[_0x55b2('0x91')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x55b2('0x71')](_0x385634,'id')}}});})[_0x55b2('0x19')](function(){_0xe6ded4(0x1);});});}function addCmHopperPhones(_0x103a1c){return new Promise(function(_0x1903d2){return db['CmHopper'][_0x55b2('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x103a1c}})[_0x55b2('0x19')](function(_0x595eb2){var _0x3dc589=[];_[_0x55b2('0x71')](_0x595eb2,function(_0x4be71c){_0x3dc589[_0x55b2('0x5d')](createCmHopperPhone(_0x103a1c,_0x4be71c['id']));});Promise[_0x55b2('0x62')](_0x3dc589)['then'](function(){_0x1903d2(0x1);});});});}function createCmHopperPhone(_0x32ff46,_0x18fdaf){return new Promise(function(_0x4b0ac5){db[_0x55b2('0x69')][_0x55b2('0x21')]({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0x32ff46,'ItemClass':_0x55b2('0x90')},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':_0x55b2('0x6c')}],'order':[_0x55b2('0x8a'),db['sequelize'][_0x55b2('0x6e')](_0x55b2('0x92'))]})[_0x55b2('0x19')](function(_0x5d4592){var _0x5dd0b3=0x1;var _0x167bfe=_[_0x55b2('0x71')](_0x5d4592,function(_0x5b80fe){_0x5b80fe[_0x55b2('0x93')]=_0x18fdaf;_0x5b80fe[_0x55b2('0x77')]=_0x5b80fe['item'];_0x5b80fe[_0x55b2('0x8a')]=_0x5dd0b3;delete _0x5b80fe['ItemType.OrderBy'];_0x5dd0b3=_0x5dd0b3+0x1;return _0x5b80fe;});return db[_0x55b2('0x91')][_0x55b2('0x59')](_0x167bfe,{});})[_0x55b2('0x19')](function(){_0x4b0ac5(0x1);});});}function insertAdditionalPhones(_0x4c1a4c,_0x7d3f0c){return new Promise(function(_0xa8433d){var _0x4b78cd=[];for(var _0x39dcd6=0x0;_0x39dcd6<_0x7d3f0c['length'];_0x39dcd6++){var _0x431155=_0x7d3f0c[_0x39dcd6];_0x4b78cd['push'](parseContactItemType(_0x431155));}Promise[_0x55b2('0x62')](_0x4b78cd)['then'](function(){var _0x5d858a={'id':_0x4c1a4c['id'],'items':_0x7d3f0c};return addAdditionalPhones(_0x5d858a)[_0x55b2('0x19')](function(){return addCmHopperPhones(_0x4c1a4c['id']);});})[_0x55b2('0x19')](function(){_0xa8433d(_0x4c1a4c);});});}function parseContactItemType(_0x436e75){return new Promise(function(_0x127954){if(_0x436e75[_0x55b2('0x61')]('ItemTypeId')){_0x127954(_0x436e75);}else{return db['ContactItemType'][_0x55b2('0x24')]({'where':{'name':_0x436e75[_0x55b2('0x6c')]}})['then'](function(_0x4441c4){if(_['isNil'](_0x4441c4))_0x436e75[_0x55b2('0x8d')]=null;else _0x436e75[_0x55b2('0x8d')]=_0x4441c4['id'];_0x127954(_0x436e75);});}});}exports[_0x55b2('0x94')]=function(_0x4131a7,_0x5adaa2){return db['CmContactHasItem'][_0x55b2('0x21')]({'raw':!![],'where':{'CmContactId':_0x4131a7[_0x55b2('0x64')]['id'],'ItemClass':_0x55b2('0x90')},'include':[{'model':db[_0x55b2('0x6b')],'as':_0x55b2('0x6c')}],'order':[[_0x55b2('0x8a')],[db['sequelize'][_0x55b2('0x6e')](_0x55b2('0x92'))]]})[_0x55b2('0x19')](function(_0x216dd2){return _0x216dd2;})[_0x55b2('0x19')](respondWithResult(_0x5adaa2,null))[_0x55b2('0x25')](handleError(_0x5adaa2,null));};exports[_0x55b2('0x95')]=function(_0x27fe47,_0x1212e9){return db[_0x55b2('0x69')][_0x55b2('0x21')]({'raw':!![],'where':{'CmContactId':_0x27fe47['body'][_0x55b2('0x96')]}})[_0x55b2('0x19')](function(_0x45638c){var _0x4e125a=_[_0x55b2('0x71')](_0x45638c,function(_0x1d0d88){_0x1d0d88[_0x55b2('0x97')]=_0x27fe47[_0x55b2('0x35')]['toContactId'];return _0x1d0d88;});return db[_0x55b2('0x69')][_0x55b2('0x59')](_0x4e125a,{});})[_0x55b2('0x19')](function(){return addCmHopperPhones(_0x27fe47[_0x55b2('0x35')][_0x55b2('0x98')]);})[_0x55b2('0x19')](function(){return['ok'];})[_0x55b2('0x19')](respondWithResult(_0x1212e9,null))[_0x55b2('0x25')](handleError(_0x1212e9,null));};exports['rescheduleAdditionalPhones']=function(_0x30afd1,_0x5b3f3b){var _0x545679=[];_0x545679['push'](createCmHopperPhone(_0x30afd1[_0x55b2('0x35')]['id'],_0x30afd1['body']['hopperId']));Promise[_0x55b2('0x62')](_0x545679)['then'](function(){return[0x1];})[_0x55b2('0x19')](respondWithResult(_0x5b3f3b,null));};exports[_0x55b2('0x99')]=function(_0x27944a,_0x5253d3){var _0x52376f={'raw':![],'where':{}};var _0x190da1={};var _0x566cef={'count':0x0,'rows':[]};return db[_0x55b2('0x26')][_0x55b2('0x79')]({'where':{'id':_0x27944a[_0x55b2('0x64')]['id']}})[_0x55b2('0x19')](handleEntityNotFound(_0x5253d3,null))[_0x55b2('0x19')](function(_0x1ea232){if(_0x1ea232){_0x190da1[_0x55b2('0x7c')]=_[_0x55b2('0x29')](db[_0x55b2('0x3b')][_0x55b2('0x7a')]);_0x190da1[_0x55b2('0x22')]=_[_0x55b2('0x29')](_0x27944a[_0x55b2('0x22')]);_0x190da1[_0x55b2('0x81')]=_['intersection'](_0x190da1[_0x55b2('0x7c')],_0x190da1['query']);_0x52376f[_0x55b2('0x7e')]=_[_0x55b2('0x7b')](_0x190da1[_0x55b2('0x7c')],qs[_0x55b2('0x7d')](_0x27944a[_0x55b2('0x22')][_0x55b2('0x7d')]));_0x52376f[_0x55b2('0x7e')]=_0x52376f[_0x55b2('0x7e')][_0x55b2('0x2f')]?_0x52376f[_0x55b2('0x7e')]:_0x190da1['model'];if(!_0x27944a[_0x55b2('0x22')][_0x55b2('0x61')](_0x55b2('0x86'))){_0x52376f[_0x55b2('0x14')]=qs['limit'](_0x27944a['query'][_0x55b2('0x14')]);_0x52376f['offset']=qs[_0x55b2('0x12')](_0x27944a[_0x55b2('0x22')]['offset']);}_0x52376f[_0x55b2('0x7f')]=qs['sort'](_0x27944a['query'][_0x55b2('0x80')]);_0x52376f[_0x55b2('0x5e')]=qs['filters'](_[_0x55b2('0x82')](_0x27944a[_0x55b2('0x22')],_0x190da1[_0x55b2('0x81')]));_0x52376f[_0x55b2('0x5e')][_0x55b2('0x9a')]=_0x1ea232['id'];if(_0x27944a[_0x55b2('0x22')][_0x55b2('0x83')]){_0x52376f[_0x55b2('0x5e')]=_[_0x55b2('0x84')](_0x52376f[_0x55b2('0x5e')],{'$or':_[_0x55b2('0x71')](_0x52376f[_0x55b2('0x7e')],function(_0x572e70){var _0x34438b={};_0x34438b[_0x572e70]={'$like':'%'+_0x27944a['query'][_0x55b2('0x83')]+'%'};return _0x34438b;})});}_0x52376f=_['merge']({},_0x52376f,_0x27944a['options']);return db['CmHopper']['count']({'where':_0x52376f[_0x55b2('0x5e')]})[_0x55b2('0x19')](function(_0x17a571){_0x566cef[_0x55b2('0x9b')]=_0x17a571;if(_0x27944a[_0x55b2('0x22')][_0x55b2('0x9c')]){_0x52376f[_0x55b2('0x9d')]=[{'all':!![]}];}return db[_0x55b2('0x3b')][_0x55b2('0x21')](_0x52376f);})[_0x55b2('0x19')](function(_0x26af80){_0x566cef[_0x55b2('0x9e')]=_0x26af80;return _0x566cef;});}})[_0x55b2('0x19')](respondWithFilteredResult(_0x5253d3,_0x52376f))[_0x55b2('0x25')](handleError(_0x5253d3,null));};exports['getHopperHistories']=function(_0x10004b,_0x5c41e1){var _0x494f36={'raw':!![],'where':{}};var _0x59920a={};var _0x20bbb2={'count':0x0,'rows':[]};return db[_0x55b2('0x26')][_0x55b2('0x79')]({'where':{'id':_0x10004b['params']['id']}})[_0x55b2('0x19')](handleEntityNotFound(_0x5c41e1,null))['then'](function(_0x5de4b3){if(_0x5de4b3){_0x59920a[_0x55b2('0x7c')]=_[_0x55b2('0x29')](db[_0x55b2('0x4b')][_0x55b2('0x7a')]);_0x59920a[_0x55b2('0x22')]=_['keys'](_0x10004b[_0x55b2('0x22')]);_0x59920a[_0x55b2('0x81')]=_[_0x55b2('0x7b')](_0x59920a[_0x55b2('0x7c')],_0x59920a[_0x55b2('0x22')]);_0x494f36['attributes']=_[_0x55b2('0x7b')](_0x59920a[_0x55b2('0x7c')],qs['fields'](_0x10004b[_0x55b2('0x22')][_0x55b2('0x7d')]));_0x494f36[_0x55b2('0x7e')]=_0x494f36[_0x55b2('0x7e')]['length']?_0x494f36['attributes']:_0x59920a['model'];if(!_0x10004b['query'][_0x55b2('0x61')]('nolimit')){_0x494f36[_0x55b2('0x14')]=qs['limit'](_0x10004b[_0x55b2('0x22')][_0x55b2('0x14')]);_0x494f36[_0x55b2('0x12')]=qs[_0x55b2('0x12')](_0x10004b[_0x55b2('0x22')][_0x55b2('0x12')]);}_0x494f36[_0x55b2('0x7f')]=qs['sort'](_0x10004b['query'][_0x55b2('0x80')]);_0x494f36[_0x55b2('0x5e')]=qs[_0x55b2('0x81')](_['pick'](_0x10004b['query'],_0x59920a[_0x55b2('0x81')]));_0x494f36[_0x55b2('0x5e')][_0x55b2('0x9a')]=_0x5de4b3['id'];if(_0x10004b[_0x55b2('0x22')][_0x55b2('0x83')]){_0x494f36[_0x55b2('0x5e')]=_[_0x55b2('0x84')](_0x494f36[_0x55b2('0x5e')],{'$or':_['map'](_0x494f36[_0x55b2('0x7e')],function(_0x52a49b){var _0x206f35={};_0x206f35[_0x52a49b]={'$like':'%'+_0x10004b[_0x55b2('0x22')][_0x55b2('0x83')]+'%'};return _0x206f35;})});}_0x494f36=_['merge']({},_0x494f36,_0x10004b[_0x55b2('0x85')]);return db[_0x55b2('0x4b')][_0x55b2('0x9b')]({'where':_0x494f36[_0x55b2('0x5e')]})[_0x55b2('0x19')](function(_0x20afcb){_0x20bbb2[_0x55b2('0x9b')]=_0x20afcb;if(_0x10004b[_0x55b2('0x22')]['includeAll']){_0x494f36[_0x55b2('0x9d')]=[{'all':!![]}];}return db[_0x55b2('0x4b')][_0x55b2('0x21')](_0x494f36);})[_0x55b2('0x19')](function(_0x5cf836){_0x20bbb2[_0x55b2('0x9e')]=_0x5cf836;return _0x20bbb2;});}})[_0x55b2('0x19')](respondWithFilteredResult(_0x5c41e1,_0x494f36))[_0x55b2('0x25')](handleError(_0x5c41e1,null));};exports[_0x55b2('0x9f')]=function(_0x280794,_0x3da3cd){var _0x57146a={'raw':!![],'where':{}};var _0x626507={};var _0x3e9b28={'count':0x0,'rows':[]};return db['CmContact'][_0x55b2('0x79')]({'where':{'id':_0x280794[_0x55b2('0x64')]['id']}})[_0x55b2('0x19')](handleEntityNotFound(_0x3da3cd,null))[_0x55b2('0x19')](function(_0x523272){if(_0x523272){_0x626507[_0x55b2('0x7c')]=_['keys'](db[_0x55b2('0x4a')][_0x55b2('0x7a')]);_0x626507[_0x55b2('0x22')]=_[_0x55b2('0x29')](_0x280794['query']);_0x626507[_0x55b2('0x81')]=_[_0x55b2('0x7b')](_0x626507['model'],_0x626507['query']);_0x57146a[_0x55b2('0x7e')]=_[_0x55b2('0x7b')](_0x626507[_0x55b2('0x7c')],qs[_0x55b2('0x7d')](_0x280794[_0x55b2('0x22')]['fields']));_0x57146a[_0x55b2('0x7e')]=_0x57146a[_0x55b2('0x7e')][_0x55b2('0x2f')]?_0x57146a[_0x55b2('0x7e')]:_0x626507[_0x55b2('0x7c')];if(!_0x280794[_0x55b2('0x22')][_0x55b2('0x61')]('nolimit')){_0x57146a[_0x55b2('0x14')]=qs[_0x55b2('0x14')](_0x280794['query'][_0x55b2('0x14')]);_0x57146a[_0x55b2('0x12')]=qs[_0x55b2('0x12')](_0x280794[_0x55b2('0x22')][_0x55b2('0x12')]);}_0x57146a['order']=qs[_0x55b2('0x80')](_0x280794['query'][_0x55b2('0x80')]);_0x57146a[_0x55b2('0x5e')]=qs[_0x55b2('0x81')](_[_0x55b2('0x82')](_0x280794['query'],_0x626507[_0x55b2('0x81')]));_0x57146a[_0x55b2('0x5e')]['ContactId']=_0x523272['id'];if(_0x280794[_0x55b2('0x22')][_0x55b2('0x83')]){_0x57146a[_0x55b2('0x5e')]=_[_0x55b2('0x84')](_0x57146a[_0x55b2('0x5e')],{'$or':_['map'](_0x57146a['attributes'],function(_0x2db03b){var _0x12915f={};_0x12915f[_0x2db03b]={'$like':'%'+_0x280794['query']['filter']+'%'};return _0x12915f;})});}_0x57146a=_[_0x55b2('0x84')]({},_0x57146a,_0x280794['options']);return db['CmHopperFinal']['count']({'where':_0x57146a[_0x55b2('0x5e')]})[_0x55b2('0x19')](function(_0xbcf0ca){_0x3e9b28['count']=_0xbcf0ca;if(_0x280794[_0x55b2('0x22')]['includeAll']){_0x57146a[_0x55b2('0x9d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x55b2('0x21')](_0x57146a);})[_0x55b2('0x19')](function(_0x2bd65c){_0x3e9b28[_0x55b2('0x9e')]=_0x2bd65c;return _0x3e9b28;});}})['then'](respondWithFilteredResult(_0x3da3cd,_0x57146a))[_0x55b2('0x25')](handleError(_0x3da3cd,null));};exports[_0x55b2('0xa0')]=function(_0x2186e1,_0x9815d1){var _0x478c00={'raw':!![],'where':{}};var _0x153ab4={};var _0x3a840a={'count':0x0,'rows':[]};return db[_0x55b2('0x26')][_0x55b2('0x79')]({'where':{'id':_0x2186e1[_0x55b2('0x64')]['id']}})['then'](handleEntityNotFound(_0x9815d1,null))[_0x55b2('0x19')](function(_0x2671f7){if(_0x2671f7){_0x153ab4[_0x55b2('0x7c')]=_[_0x55b2('0x29')](db[_0x55b2('0x51')][_0x55b2('0x7a')]);_0x153ab4[_0x55b2('0x22')]=_[_0x55b2('0x29')](_0x2186e1[_0x55b2('0x22')]);_0x153ab4['filters']=_[_0x55b2('0x7b')](_0x153ab4[_0x55b2('0x7c')],_0x153ab4[_0x55b2('0x22')]);_0x478c00['attributes']=_['intersection'](_0x153ab4[_0x55b2('0x7c')],qs['fields'](_0x2186e1[_0x55b2('0x22')][_0x55b2('0x7d')]));_0x478c00[_0x55b2('0x7e')]=_0x478c00[_0x55b2('0x7e')][_0x55b2('0x2f')]?_0x478c00[_0x55b2('0x7e')]:_0x153ab4[_0x55b2('0x7c')];if(!_0x2186e1['query']['hasOwnProperty'](_0x55b2('0x86'))){_0x478c00[_0x55b2('0x14')]=qs[_0x55b2('0x14')](_0x2186e1['query']['limit']);_0x478c00[_0x55b2('0x12')]=qs[_0x55b2('0x12')](_0x2186e1[_0x55b2('0x22')][_0x55b2('0x12')]);}_0x478c00[_0x55b2('0x7f')]=qs[_0x55b2('0x80')](_0x2186e1[_0x55b2('0x22')][_0x55b2('0x80')]);_0x478c00['where']=qs['filters'](_[_0x55b2('0x82')](_0x2186e1[_0x55b2('0x22')],_0x153ab4[_0x55b2('0x81')]));_0x478c00[_0x55b2('0x5e')]['ContactId']=_0x2671f7['id'];if(_0x2186e1['query']['filter']){_0x478c00[_0x55b2('0x5e')]=_[_0x55b2('0x84')](_0x478c00[_0x55b2('0x5e')],{'$or':_['map'](_0x478c00['attributes'],function(_0x373bbf){var _0x57f57c={};_0x57f57c[_0x373bbf]={'$like':'%'+_0x2186e1[_0x55b2('0x22')][_0x55b2('0x83')]+'%'};return _0x57f57c;})});}_0x478c00=_[_0x55b2('0x84')]({},_0x478c00,_0x2186e1[_0x55b2('0x85')]);return db[_0x55b2('0x51')][_0x55b2('0x9b')]({'where':_0x478c00[_0x55b2('0x5e')]})['then'](function(_0x1f4b31){_0x3a840a[_0x55b2('0x9b')]=_0x1f4b31;if(_0x2186e1[_0x55b2('0x22')][_0x55b2('0x9c')]){_0x478c00['include']=[{'all':!![]}];}return db[_0x55b2('0x51')]['findAll'](_0x478c00);})['then'](function(_0x57c342){_0x3a840a[_0x55b2('0x9e')]=_0x57c342;return _0x3a840a;});}})['then'](respondWithFilteredResult(_0x9815d1,_0x478c00))[_0x55b2('0x25')](handleError(_0x9815d1,null));};exports[_0x55b2('0xa1')]=function(_0x26c0f7,_0x122d67){try{if(!_0x26c0f7[_0x55b2('0x35')]['ListId']){throw new Error(_0x55b2('0xa2'));}if(!_0x26c0f7[_0x55b2('0x35')][_0x55b2('0xa3')]){throw new Error(_0x55b2('0xa4'));}if(!_0x26c0f7[_0x55b2('0x35')][_0x55b2('0xa5')]){throw new Error(_0x55b2('0xa6'));}if(!_0x26c0f7[_0x55b2('0x35')]['socket_timestamp']){throw new Error(_0x55b2('0xa7'));}var _0x23809f=_0x26c0f7['body'][_0x55b2('0xa3')][_0x55b2('0xa8')](',');var _0x4c1ed5=_0x26c0f7[_0x55b2('0x35')]['binding_values'][_0x55b2('0xa8')](',');if(!_0x23809f[_0x55b2('0x2f')]||!_0x4c1ed5[_0x55b2('0x2f')]||_0x23809f[_0x55b2('0x2f')]!==_0x4c1ed5['length']){throw new Error(_0x55b2('0xa9'));}_0x26c0f7[_0x55b2('0x35')]['fields']=_[_0x55b2('0xaa')](_0x23809f,_0x4c1ed5);if(!_0x26c0f7[_0x55b2('0x35')]['fields']['phone']){throw new Error(_0x55b2('0xab'));}if(!_0x26c0f7[_0x55b2('0x35')][_0x55b2('0x7d')][_0x55b2('0xac')]){throw new Error(_0x55b2('0xad'));}var _0x4ad2fe=path[_0x55b2('0x3a')](config[_0x55b2('0xae')],_0x55b2('0xaf'),_0x26c0f7['file'][_0x55b2('0xb0')]);fs[_0x55b2('0xb1')](_0x4ad2fe,parseInt('0777',0x8));var _0x35be90=require(_0x55b2('0xb2'))[_0x55b2('0xb3')](path['join'](__dirname,'../../components/import/cm/csv'),[_0x4ad2fe,_0x26c0f7['body'][_0x55b2('0xa3')],_0x26c0f7[_0x55b2('0x35')][_0x55b2('0xa5')],_0x26c0f7[_0x55b2('0x35')]['ListId'],_0x26c0f7[_0x55b2('0x35')]['CompanyId'],_0x26c0f7[_0x55b2('0x35')][_0x55b2('0x5b')],_0x26c0f7['body'][_0x55b2('0xb4')]]);return _0x122d67[_0x55b2('0x15')](0xc8)[_0x55b2('0x11')]({'message':_0x55b2('0xb5'),'pid':_0x35be90[_0x55b2('0xb6')]});}catch(_0x388792){return _0x122d67[_0x55b2('0x15')](0x1f4)[_0x55b2('0x1f')](_0x388792);}};exports[_0x55b2('0xb7')]=function(_0x71c291,_0x3af8cc){var _0x22f413=fs[_0x55b2('0xb8')](_0x71c291[_0x55b2('0xb9')]['path']);Papa[_0x55b2('0xba')](_0x22f413,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x536c70){return _0x3af8cc[_0x55b2('0x15')](0xc8)[_0x55b2('0x11')]({'file':_0x71c291[_0x55b2('0xb9')],'fields':_0x536c70['meta'][_0x55b2('0x7d')]});}});};exports[_0x55b2('0xbb')]=function(_0x48c052,_0x3d89f8){return db[_0x55b2('0xbc')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x55b2('0xbd')}})[_0x55b2('0x19')](function(_0x4a7130){var _0x385549=![];if(!_0x48c052[_0x55b2('0x35')][_0x55b2('0x5f')]){throw new Error(_0x55b2('0xa2'));}if(!_0x48c052[_0x55b2('0x35')][_0x55b2('0xbe')][_0x55b2('0x77')]){throw new Error(_0x55b2('0xab'));}if(!_0x48c052[_0x55b2('0x35')]['binding'][_0x55b2('0xac')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x48c052[_0x55b2('0x35')][_0x55b2('0xb4')]){throw new Error(_0x55b2('0xa7'));}var _0x321e71=require('child_process')[_0x55b2('0xb3')](path['join'](__dirname,_0x55b2('0xbf')),[_0x48c052[_0x55b2('0x64')]['id'],JSON['stringify'](_0x48c052['body']),JSON[_0x55b2('0xc0')](_0x4a7130)]);_0x321e71['on'](_0x55b2('0xc1'),function(){_0x385549=!![];return _0x3d89f8['status'](0xc8)[_0x55b2('0x11')]({'message':_0x55b2('0xc2'),'pid':_0x321e71[_0x55b2('0xb6')]});});_0x321e71['on'](_0x55b2('0xc3'),function(_0x5907cf){if(_0x5907cf&&!_0x385549){return _0x3d89f8['status'](0x1f4)['json']({'message':_0x55b2('0xc4'),'pid':_0x321e71[_0x55b2('0xb6')]});}});})['catch'](handleError(_0x3d89f8,null));};exports[_0x55b2('0xc5')]=function(_0x5be095,_0x27a0d7){return db['User'][_0x55b2('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x55b2('0xbd')}})['then'](function(_0x13930f){var _0x1163ec=![];if(!_0x5be095[_0x55b2('0x35')][_0x55b2('0x5f')]){throw new Error(_0x55b2('0xa2'));}if(!_0x5be095[_0x55b2('0x35')][_0x55b2('0xbe')][_0x55b2('0x77')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5be095[_0x55b2('0x35')][_0x55b2('0xbe')][_0x55b2('0xac')]){throw new Error(_0x55b2('0xad'));}if(!_0x5be095[_0x55b2('0x35')][_0x55b2('0xb4')]){throw new Error(_0x55b2('0xa7'));}var _0x22e4fb=require('child_process')[_0x55b2('0xb3')](path['join'](__dirname,_0x55b2('0xc6')),[_0x5be095['params']['id'],JSON['stringify'](_0x5be095[_0x55b2('0x35')]),JSON['stringify'](_0x13930f)]);_0x22e4fb['on'](_0x55b2('0xc1'),function(){_0x1163ec=!![];return _0x27a0d7[_0x55b2('0x15')](0xc8)['json']({'message':_0x55b2('0xc2'),'pid':_0x22e4fb[_0x55b2('0xb6')]});});_0x22e4fb['on']('exit',function(_0xf8df41){if(_0xf8df41&&!_0x1163ec){return _0x27a0d7[_0x55b2('0x15')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x22e4fb[_0x55b2('0xb6')]});}});})['catch'](handleError(_0x27a0d7,null));};exports['getJourney']=function(_0x2a98da,_0x5e5171){var _0x2b871b=[_0x55b2('0xc7'),_0x55b2('0xc8'),'sms',_0x55b2('0xc9'),_0x55b2('0xca'),_0x55b2('0xcb'),'voice'];var _0x3dbd2b={'offset':0x0,'order':qs[_0x55b2('0x80')](_0x55b2('0xcc'))},_0x33234e={'count':0x0,'rows':[]};Promise[_0x55b2('0xcd')]()['then'](function(){if(_0x2a98da['query']['channel']){if(!_['includes'](_0x2b871b,_0x2a98da['query'][_0x55b2('0xce')][_0x55b2('0xcf')]())){throw new Error(_0x55b2('0xd0'));}_0x2b871b=[_0x2a98da[_0x55b2('0x22')]['channel'][_0x55b2('0xcf')]()];}if(_0x2a98da[_0x55b2('0x22')]['range']){try{var _0x5a7d7b=JSON[_0x55b2('0xba')](_0x2a98da['query'][_0x55b2('0xd1')]);if(!moment(_0x5a7d7b[_0x55b2('0x36')])[_0x55b2('0xd2')]()){throw new Error(_0x55b2('0xd3'));}if(!moment(_0x5a7d7b['to'])[_0x55b2('0xd2')]()){throw new Error(_0x55b2('0xd4'));}}catch(_0x55a37c){throw new Error(_0x55b2('0xd5'));}}if(!_0x2a98da[_0x55b2('0x22')][_0x55b2('0x61')](_0x55b2('0x86'))){_0x3dbd2b[_0x55b2('0x14')]=qs['limit'](_0x2a98da[_0x55b2('0x22')][_0x55b2('0x14')]||0xa);_0x3dbd2b['offset']=qs[_0x55b2('0x12')](_0x2a98da[_0x55b2('0x22')][_0x55b2('0x12')]);}var _0x4fcb58=_0x2b871b['map'](function(_0x20e980){if(_0x20e980===_0x55b2('0xd6')){var _0xd7a674={'attributes':['id',_0x55b2('0xd7'),'type',_0x55b2('0xd8'),_0x55b2('0xd9'),_0x55b2('0xda'),'starttime',_0x55b2('0xdb'),'duration','note',_0x55b2('0xdc'),_0x55b2('0xdd'),_0x55b2('0xde'),'userThirdDisposition',_0x55b2('0xdf')],'where':{'ContactId':_0x2a98da[_0x55b2('0x64')]['id']},'include':[{'model':db[_0x55b2('0xbc')],'as':_0x55b2('0xbc'),'attributes':['id',_0x55b2('0x1e'),_0x55b2('0xe0'),_0x55b2('0xe1')]}],'order':[[_0x55b2('0xdc'),_0x55b2('0xe2')]]};if(_0x2a98da['query']['range']){_0xd7a674['where']['createdAt']={'$gte':_0x5a7d7b['from'],'$lte':_0x5a7d7b['to']};}return db[_0x55b2('0x4c')]['findAndCountAll'](_0xd7a674)[_0x55b2('0x19')](function(_0x8d3d08){_0x33234e[_0x55b2('0x9b')]+=_0x8d3d08['count'];return _[_0x55b2('0x71')](_0x8d3d08[_0x55b2('0x9e')],function(_0xbd48b9){var _0x2b9bc5=_0xbd48b9[_0x55b2('0x37')]({'plain':!![]});_0x2b9bc5['channel']=_0x20e980;if(_0x2b9bc5[_0x55b2('0xbc')]){_0x2b9bc5[_0x55b2('0xbc')]={'id':_0x2b9bc5[_0x55b2('0xbc')]['id'],'name':_0x2b9bc5[_0x55b2('0xbc')][_0x55b2('0x1e')],'fullname':_0x2b9bc5[_0x55b2('0xbc')][_0x55b2('0xe0')],'alias':_0x2b9bc5[_0x55b2('0xbc')]['alias']};}return _0x2b9bc5;});});}else{var _0x1bbcac=_[_0x55b2('0xe3')](_0x20e980)+(_0x20e980==='chat'?_0x55b2('0xe4'):_0x55b2('0xe5'));var _0xa31448={'attributes':['id',_0x55b2('0xe6'),'closedAt',_0x55b2('0xdc'),_0x55b2('0xe7'),_0x55b2('0xe8'),'secondDisposition',_0x55b2('0xe9'),'UserId',_0x1bbcac+'Id'],'where':{'ContactId':_0x2a98da['params']['id']},'include':[{'model':db[_0x1bbcac],'as':_0x55b2('0xe5'),'attributes':['id',_0x55b2('0x1e'),_0x55b2('0xea')]},{'model':db[_0x55b2('0xbc')],'as':'Owner','attributes':['id',_0x55b2('0x1e'),_0x55b2('0xe0')]},{'model':db[_0x55b2('0x65')],'as':_0x55b2('0x66'),'attributes':['id',_0x55b2('0x1e'),_0x55b2('0x67')],'through':{'attributes':[]}}],'order':[['createdAt',_0x55b2('0xe2')]]};if(_0x2a98da[_0x55b2('0x22')]['range']){_0xa31448[_0x55b2('0x5e')][_0x55b2('0xdc')]={'$gte':_0x5a7d7b[_0x55b2('0x36')],'$lte':_0x5a7d7b['to']};}switch(_0x20e980){case _0x55b2('0xc8'):_0xa31448[_0x55b2('0x7e')]['push'](_0x55b2('0xeb'),_0x55b2('0xec'),_0x55b2('0xed'),_0x55b2('0xee'),_0x55b2('0xef'),_0x55b2('0xf0'),_0x55b2('0xf1'),_0x55b2('0xf2'),_0x55b2('0xf3'));break;case _0x55b2('0xc7'):_0xa31448['attributes'][_0x55b2('0x5d')](_0x55b2('0xf4'),_0x55b2('0xf5'));break;case _0x55b2('0xc9'):_0xa31448['attributes']['push'](_0x55b2('0xf6'),_0x55b2('0xf7'));break;}return db[_['startCase'](_0x20e980)+_0x55b2('0xf8')]['findAndCountAll'](_0xa31448)[_0x55b2('0x19')](function(_0x2982b4){_0x33234e['count']+=_0x2982b4[_0x55b2('0x9b')];return _['map'](_0x2982b4[_0x55b2('0x9e')],function(_0x219b2c){var _0x590b36=_0x219b2c[_0x55b2('0x37')]({'plain':!![]});_0x590b36[_0x55b2('0xce')]=_0x20e980;if(_0x590b36['Owner']){_0x590b36['Owner']={'id':_0x590b36[_0x55b2('0xf9')]['id'],'name':_0x590b36['Owner'][_0x55b2('0x1e')],'fullname':_0x590b36[_0x55b2('0xf9')][_0x55b2('0xe0')]};}return _0x590b36;});});}});return Promise['all'](_0x4fcb58);})['then'](function(_0xa3d32a){return _(_0xa3d32a)[_0x55b2('0xfa')]()[_0x55b2('0xfb')](_0x55b2('0xdc'))[_0x55b2('0xfc')]()[_0x55b2('0xfd')]();})['then'](function(_0x4883b1){_0x33234e[_0x55b2('0x9e')]=_0x3dbd2b[_0x55b2('0x14')]?_0x4883b1[_0x55b2('0xfe')](_0x3dbd2b[_0x55b2('0x12')],_0x3dbd2b[_0x55b2('0x12')]+_0x3dbd2b[_0x55b2('0x14')]):_0x4883b1;return _0x33234e;})[_0x55b2('0x19')](respondWithFilteredResult(_0x5e5171,_0x3dbd2b))[_0x55b2('0x25')](handleError(_0x5e5171,null));}; \ No newline at end of file +var _0xeedb=['keys','length','startsWith','cf_','columnName','displayName','CmCustomField','alias','custom','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatOfflineMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','describe','dialTimezone','timezones','utcOffset','additionalPhones','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','Tag','Tags','color','tag','Phones','ContactItemType','literal','Phones.OrderBy','isNil','omit','format','$and','pickBy','map','cf_%d','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','sequelize','text','phone','CmHopper','getTags','findOne','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','parse','meta','import','User','agent','binding','No\x20phone\x20column\x20specified','firstName','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','No\x20firstName\x20column\x20specified','message','getJourney','sms','openchannel','fax','whatsapp','voice','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','startCase','Website','Account','closed','thirdDisposition','Owner','chat','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','substatus','externalUrl','threadId','Interaction','findAndCountAll','flatten','reverse','slice','moment','bluebird','util','lodash','squel','papaparse','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','socket.io-emitter','redis','./cmContact.socket','register','undefined','limit','count','offset','status','set','Content-Range','json','then','end','sendStatus','stack','name','send','getOptions','findAll','query','catch','destroy','find','params','CmContact'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xeedb,0xdc));var _0xbeed=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xeedb[_0x24237f];return _0x48298e;};'use strict';var moment=require(_0xbeed('0x0'));var BPromise=require(_0xbeed('0x1'));var util=require(_0xbeed('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xbeed('0x3'));var squel=require(_0xbeed('0x4'));var Papa=require(_0xbeed('0x5'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0xbeed('0x6'))(_0xbeed('0x7'));var config=require(_0xbeed('0x8'));var shared=require(_0xbeed('0x9'));var db=require(_0xbeed('0xa'))['db'];config['redis']=_[_0xbeed('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbeed('0xc'))(new Redis(config[_0xbeed('0xd')]));require(_0xbeed('0xe'))[_0xbeed('0xf')](socket);function respondWithResult(_0x20d0d5,_0x463549){_0x463549=_0x463549||0xc8;return function(_0x52ec96){if(_0x52ec96){return _0x20d0d5['status'](_0x463549)['json'](_0x52ec96);}};}function respondWithFilteredResult(_0xb20a12,_0x200d08){return function(_0x46daef){if(_0x46daef){var _0x1ae630=typeof _0x200d08['offset']===_0xbeed('0x10')&&typeof _0x200d08[_0xbeed('0x11')]===_0xbeed('0x10');var _0x54bad5=_0x46daef[_0xbeed('0x12')];var _0x4c525f=_0x1ae630?0x0:_0x200d08[_0xbeed('0x13')];var _0xfc5f94=_0x1ae630?_0x46daef['count']:_0x200d08[_0xbeed('0x13')]+_0x200d08[_0xbeed('0x11')];var _0x52975e;if(_0xfc5f94>=_0x54bad5){_0xfc5f94=_0x54bad5;_0x52975e=0xc8;}else{_0x52975e=0xce;}_0xb20a12[_0xbeed('0x14')](_0x52975e);return _0xb20a12[_0xbeed('0x15')](_0xbeed('0x16'),_0x4c525f+'-'+_0xfc5f94+'/'+_0x54bad5)[_0xbeed('0x17')](_0x46daef);}return null;};}function saveUpdates(_0x1c2759){return function(_0xc33c58){if(_0xc33c58){return _0xc33c58['update'](_0x1c2759)[_0xbeed('0x18')](function(_0x2bbf94){return _0x2bbf94;});}return null;};}function removeEntity(_0x49d15a){return function(_0x25b396){if(_0x25b396){return _0x25b396['destroy']()[_0xbeed('0x18')](function(){_0x49d15a[_0xbeed('0x14')](0xcc)[_0xbeed('0x19')]();});}};}function handleEntityNotFound(_0x31d30b){return function(_0xe99fc0){if(!_0xe99fc0){_0x31d30b[_0xbeed('0x1a')](0x194);}return _0xe99fc0;};}function handleError(_0x190c2a,_0x1b7230){_0x1b7230=_0x1b7230||0x1f4;return function(_0x548284){logger['error'](_0x548284[_0xbeed('0x1b')]);if(_0x548284[_0xbeed('0x1c')]){delete _0x548284[_0xbeed('0x1c')];}_0x190c2a[_0xbeed('0x14')](_0x1b7230)[_0xbeed('0x1d')](_0x548284);};}exports['index']=function(_0x598693,_0x3b2da5){var _0x3e5431={};return contacts['describe']()[_0xbeed('0x18')](function(_0x47a195){_0x3e5431=qs[_0xbeed('0x1e')](_0x47a195,_0x598693);return contacts[_0xbeed('0x1f')](_0x598693[_0xbeed('0x20')],_0x598693['user'],_0x3e5431,_0x47a195);})[_0xbeed('0x18')](respondWithFilteredResult(_0x3b2da5,_0x3e5431))[_0xbeed('0x21')](handleError(_0x3b2da5,null));};exports[_0xbeed('0x22')]=function(_0xcaeef5,_0x5db5d7){return db['CmContact'][_0xbeed('0x23')]({'where':{'id':_0xcaeef5[_0xbeed('0x24')]['id']}})[_0xbeed('0x18')](handleEntityNotFound(_0x5db5d7,null))[_0xbeed('0x18')](removeEntity(_0x5db5d7,null))['catch'](handleError(_0x5db5d7,null));};exports['describe']=function(_0x4f4908,_0x37fcbf){return db[_0xbeed('0x25')]['describe']()[_0xbeed('0x18')](function(_0xa901df){delete _0xa901df['tags'];for(var _0x2d613c=0x0;_0x2d613c0x0){return new Promise(function(_0x124fb7){var _0x501b91=[];for(var _0x353242=0x0;_0x353242<_0x1a7204[_0xbeed('0x27')];_0x353242++){_0x501b91[_0xbeed('0x5c')](insertAdditionalPhones(_0x1a7204[_0x353242][_0xbeed('0x60')],_0x1a7204[_0x353242][_0xbeed('0x57')]));}Promise[_0xbeed('0x61')](_0x501b91)[_0xbeed('0x18')](function(){_0x124fb7(0x1);});})[_0xbeed('0x18')](function(){return{'success':_0x578ac6,'failure':_0x2968f2,'duplicates':_0xb9f448};});}else{return{'success':_0x578ac6,'failure':_0x2968f2,'duplicates':_0xb9f448};}}})[_0xbeed('0x18')](respondWithResult(_0x34600d,0xc9))[_0xbeed('0x21')](handleError(_0x34600d,null));};exports['show']=function(_0x52017e,_0x40cce7){var _0x4af432;return db[_0xbeed('0x25')]['describe']()[_0xbeed('0x18')](function(_0x61f9a7){return db[_0xbeed('0x25')][_0xbeed('0x23')]({'where':{'id':_0x52017e[_0xbeed('0x24')]['id']},'include':[{'model':db[_0xbeed('0x62')],'as':_0xbeed('0x63'),'attributes':['id',_0xbeed('0x1c'),_0xbeed('0x64')],'required':_0x52017e['query'][_0xbeed('0x65')]?!![]:![]},{'model':db[_0xbeed('0x48')],'as':_0xbeed('0x66'),'where':{'CmContactId':_0x52017e[_0xbeed('0x24')]['id']},'required':![],'include':[{'model':db[_0xbeed('0x67')],'as':'ItemType'}]}],'order':[db['sequelize'][_0xbeed('0x68')](_0xbeed('0x69'))],'attributes':_['keys'](_0x61f9a7)});})['then'](function(_0x1197e6){if(!_[_0xbeed('0x6a')](_0x1197e6)){_0x4af432=_0x1197e6[_0xbeed('0x37')]({'plain':!![]});var _0x1bb670={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1197e6&&_0x1197e6[_0xbeed('0x5d')]){if(_0x1197e6[_0xbeed('0x5d')]){_0x1bb670['where']['$and'][_0xbeed('0x5c')]({'ListId':{'$ne':_0x1197e6[_0xbeed('0x5d')]}});}}return db[_0xbeed('0x2c')][_0xbeed('0x1f')](_0x1bb670);}})[_0xbeed('0x18')](function(_0x5c334f){if(!_[_0xbeed('0x6a')](_0x5c334f)){return _[_0xbeed('0x6b')](_0x4af432,_['map'](_0x5c334f,function(_0x2ef238){return util[_0xbeed('0x6c')]('cf_%d',_0x2ef238['id']);}));}})['then'](handleEntityNotFound(_0x40cce7,null))[_0xbeed('0x18')](respondWithResult(_0x40cce7,null))[_0xbeed('0x21')](handleError(_0x40cce7,null));};exports[_0xbeed('0x40')]=function(_0x26871c,_0x4f7237){var _0x1e3f4d;if(_0x26871c[_0xbeed('0x35')]['id']){delete _0x26871c['body']['id'];}if(!_[_0xbeed('0x6a')](_0x26871c[_0xbeed('0x35')][_0xbeed('0x54')])){var _0x30fe3d=_0x26871c['body'][_0xbeed('0x54')];if(!_[_0xbeed('0x6a')](shared['timezones'][_0x30fe3d]))_0x26871c[_0xbeed('0x35')][_0xbeed('0x56')]=shared[_0xbeed('0x55')][_0x30fe3d][_0xbeed('0x56')];}return db[_0xbeed('0x25')]['find']({'where':{'id':_0x26871c['params']['id']}})[_0xbeed('0x18')](handleEntityNotFound(_0x4f7237,null))['then'](saveUpdates(_0x26871c[_0xbeed('0x35')],null))[_0xbeed('0x18')](function(_0x11fe95){_0x1e3f4d=_0x11fe95;var _0x10c2ef={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x11fe95&&_0x11fe95[_0xbeed('0x5d')]){if(_0x11fe95[_0xbeed('0x5d')]){_0x10c2ef[_0xbeed('0x5a')][_0xbeed('0x6d')]['push']({'ListId':{'$ne':_0x11fe95[_0xbeed('0x5d')]}});}}return db[_0xbeed('0x2c')]['findAll'](_0x10c2ef);})['then'](function(_0x551990){if(_0x551990){return _[_0xbeed('0x6b')](_[_0xbeed('0x6e')](_0x26871c[_0xbeed('0x35')],function(_0x303d4d,_0x2ab586){return _[_0xbeed('0x28')](_0x2ab586,_0xbeed('0x29'));}),_[_0xbeed('0x6f')](_0x551990,function(_0x35378d){return util[_0xbeed('0x6c')](_0xbeed('0x70'),_0x35378d['id']);}));}})['then'](function(_0xcdd3b8){if(_0xcdd3b8&&!_[_0xbeed('0x71')](_0xcdd3b8)){var _0x175163=squel[_0xbeed('0x40')]()[_0xbeed('0x72')](_0xbeed('0x73'))['setFields'](_0xcdd3b8)[_0xbeed('0x5a')](_0xbeed('0x74'),_0x26871c[_0xbeed('0x24')]['id'])[_0xbeed('0x75')]();return db[_0xbeed('0x76')]['query'](_0x175163[_0xbeed('0x77')],{'replacements':_0x175163[_0xbeed('0x2f')]});}})['then'](function(){if(_0x26871c[_0xbeed('0x35')][_0xbeed('0x78')]&&_0x1e3f4d){return db[_0xbeed('0x79')]['update']({'phone':_0x26871c[_0xbeed('0x35')][_0xbeed('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x1e3f4d['id']}});}})[_0xbeed('0x18')](function(){return _0x1e3f4d;})[_0xbeed('0x18')](respondWithResult(_0x4f7237,null))[_0xbeed('0x21')](handleError(_0x4f7237,null));};exports[_0xbeed('0x7a')]=function(_0x273611,_0x53e993){var _0x5a2154={};var _0x223758={};var _0x482e17;var _0x17a928;return db[_0xbeed('0x25')][_0xbeed('0x7b')]({'where':{'id':_0x273611[_0xbeed('0x24')]['id']}})['then'](handleEntityNotFound(_0x53e993,null))[_0xbeed('0x18')](function(_0xb8ddd2){if(_0xb8ddd2){_0x482e17=_0xb8ddd2;_0x223758['model']=_[_0xbeed('0x26')](db[_0xbeed('0x62')][_0xbeed('0x7c')]);_0x223758[_0xbeed('0x20')]=_[_0xbeed('0x26')](_0x273611[_0xbeed('0x20')]);_0x223758[_0xbeed('0x7d')]=_[_0xbeed('0x7e')](_0x223758[_0xbeed('0x7f')],_0x223758[_0xbeed('0x20')]);_0x5a2154[_0xbeed('0x80')]=_[_0xbeed('0x7e')](_0x223758['model'],qs[_0xbeed('0x81')](_0x273611['query']['fields']));_0x5a2154[_0xbeed('0x80')]=_0x5a2154[_0xbeed('0x80')][_0xbeed('0x27')]?_0x5a2154[_0xbeed('0x80')]:_0x223758[_0xbeed('0x7f')];_0x5a2154[_0xbeed('0x82')]=qs['sort'](_0x273611[_0xbeed('0x20')][_0xbeed('0x83')]);_0x5a2154[_0xbeed('0x5a')]=qs[_0xbeed('0x7d')](_[_0xbeed('0x84')](_0x273611['query'],_0x223758[_0xbeed('0x7d')]));if(_0x273611[_0xbeed('0x20')][_0xbeed('0x85')]){_0x5a2154[_0xbeed('0x5a')]=_[_0xbeed('0x34')](_0x5a2154['where'],{'$or':_[_0xbeed('0x6f')](_0x5a2154[_0xbeed('0x80')],function(_0x2eeb43){var _0x1effb1={};_0x1effb1[_0x2eeb43]={'$like':'%'+_0x273611[_0xbeed('0x20')][_0xbeed('0x85')]+'%'};return _0x1effb1;})});}_0x5a2154=_[_0xbeed('0x34')]({},_0x5a2154,_0x273611[_0xbeed('0x86')]);return _0x482e17[_0xbeed('0x7a')](_0x5a2154);}})['then'](function(_0x5e2ebe){if(_0x5e2ebe){_0x17a928=_0x5e2ebe[_0xbeed('0x27')];if(!_0x273611['query'][_0xbeed('0x33')](_0xbeed('0x87'))){_0x5a2154[_0xbeed('0x11')]=qs['limit'](_0x273611['query']['limit']);_0x5a2154[_0xbeed('0x13')]=qs[_0xbeed('0x13')](_0x273611[_0xbeed('0x20')][_0xbeed('0x13')]);}return _0x482e17['getTags'](_0x5a2154);}})[_0xbeed('0x18')](function(_0x210731){if(_0x210731){return _0x210731?{'count':_0x17a928,'rows':_0x210731}:null;}})[_0xbeed('0x18')](respondWithResult(_0x53e993,null))['catch'](handleError(_0x53e993,null));};exports[_0xbeed('0x88')]=function(_0x5d0f77,_0x48a223){if(_0x5d0f77[_0xbeed('0x35')]['id']){delete _0x5d0f77['body']['id'];}return db[_0xbeed('0x25')][_0xbeed('0x7b')]({'where':{'id':_0x5d0f77['params']['id']}})[_0xbeed('0x18')](handleEntityNotFound(_0x48a223,null))[_0xbeed('0x18')](function(_0x134065){if(_0x134065){return _0x134065['setTags'](_0x5d0f77['body'][_0xbeed('0x89')]||[]);}return null;})['then'](respondWithResult(_0x48a223,null))['catch'](handleError(_0x48a223,null));};exports[_0xbeed('0x8a')]=function(_0x5cb948,_0x25cbeb){var _0x54b5b8=[];_0x54b5b8[_0xbeed('0x5c')](addAdditionalPhones(_0x5cb948[_0xbeed('0x35')]));Promise[_0xbeed('0x61')](_0x54b5b8)[_0xbeed('0x18')](function(){_0x54b5b8=[];_0x54b5b8[_0xbeed('0x5c')](deleteCmHopperPhones(_0x5cb948['body']['id']));_0x54b5b8['push'](addCmHopperPhones(_0x5cb948['body']['id']));Promise[_0xbeed('0x61')](_0x54b5b8)[_0xbeed('0x18')](function(){return[0x1];})[_0xbeed('0x18')](respondWithResult(_0x25cbeb,null));});};function addAdditionalPhones(_0x17c043){var _0x60a694;return new Promise(function(_0x5b9f53){return db['CmContactHasItem'][_0xbeed('0x22')]({'where':{'CmContactId':_0x17c043['id']}})[_0xbeed('0x18')](function(){db[_0xbeed('0x67')]['findAll']({'raw':!![],'attributes':['id',_0xbeed('0x8b')]})[_0xbeed('0x18')](function(_0xac63c9){var _0x371738=[];for(var _0x114083=0x0;_0x114083<_0x17c043[_0xbeed('0x8c')][_0xbeed('0x27')];_0x114083++){var _0x55064d=_0x17c043[_0xbeed('0x8d')]?_[_0xbeed('0x6a')](_0x17c043[_0xbeed('0x8d')][_0x114083])?'':_0x17c043[_0xbeed('0x8d')][_0x114083]:_0x17c043[_0xbeed('0x8c')][_0x114083][_0xbeed('0x8e')]?_0x17c043[_0xbeed('0x8c')][_0x114083]['ItemTypeId']:'';var _0xaef794=_[_0xbeed('0x6a')](_0x17c043[_0xbeed('0x8c')][_0x114083][_0xbeed('0x8f')])?'':_0x17c043[_0xbeed('0x8c')][_0x114083][_0xbeed('0x8f')];var _0x52e768=_0x55064d+':'+_0x17c043[_0xbeed('0x8c')][_0x114083][_0xbeed('0x78')]+'§'+_0xaef794;if(_[_0xbeed('0x6a')](_0x60a694))_0x60a694=_0x52e768;else _0x60a694+=';'+_0x52e768;var _0x64c922=null;var _0x1a8cd5=null;if(_0x17c043[_0xbeed('0x8d')]){if(!_[_0xbeed('0x6a')](_0x17c043[_0xbeed('0x8d')][_0x114083])){_0x1a8cd5=_[_0xbeed('0x23')](_0xac63c9,function(_0x2c6514){return _0x2c6514['id']===_0x17c043[_0xbeed('0x8d')][_0x114083];});if(!_[_0xbeed('0x6a')](_0x1a8cd5)){_0x64c922=_0x1a8cd5['OrderBy'];}}}else{if(!_[_0xbeed('0x6a')](_0x17c043[_0xbeed('0x8c')][_0x114083])){_0x1a8cd5=_[_0xbeed('0x23')](_0xac63c9,function(_0x240466){return _0x240466['id']===_0x17c043[_0xbeed('0x8c')][_0x114083][_0xbeed('0x8e')];});if(!_[_0xbeed('0x6a')](_0x1a8cd5)){_0x64c922=_0x114083;}}}if(_['isNil'](_0x64c922)){_0x64c922=0x64;}_0x371738[_0xbeed('0x5c')](addAdditionalPhone(_0x17c043['id'],_0x17c043[_0xbeed('0x8c')][_0x114083]['phone'],_0x17c043[_0xbeed('0x8d')]?_[_0xbeed('0x6a')](_0x17c043['item_types'][_0x114083])?null:_0x17c043[_0xbeed('0x8d')][_0x114083]:_0x17c043[_0xbeed('0x8c')][_0x114083][_0xbeed('0x8e')]?_0x17c043[_0xbeed('0x8c')][_0x114083][_0xbeed('0x8e')]:null,_0x64c922,_0xaef794));}Promise[_0xbeed('0x61')](_0x371738)[_0xbeed('0x18')](function(){db[_0xbeed('0x25')][_0xbeed('0x40')]({'AdditionalPhones':_0x60a694},{'where':{'id':_0x17c043['id']}})[_0xbeed('0x18')](function(){_0x5b9f53(0x1);});});});});});}function addAdditionalPhone(_0x1f68cc,_0x53ee77,_0x30b7e5,_0x454d02,_0x29a2a6){return db['CmContactHasItem'][_0xbeed('0x23')]({'where':{'CmContactId':_0x1f68cc,'item':_0x53ee77}})[_0xbeed('0x18')](function(_0x5e51af){if(_0x5e51af)logger[_0xbeed('0x30')](_0xbeed('0x90'),_0x5e51af);else{db[_0xbeed('0x48')][_0xbeed('0x3e')]({'CmContactId':_0x1f68cc,'item':_0x53ee77,'ItemTypeId':_0x30b7e5,'OrderBy':_0x454d02,'ItemClass':_0xbeed('0x91'),'description':_0x29a2a6});}});}function deleteCmHopperPhones(_0x43b40a){return new Promise(function(_0x33c4eb){return db[_0xbeed('0x79')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x43b40a}})[_0xbeed('0x18')](function(_0x153d07){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x153d07,'id')}}});})[_0xbeed('0x18')](function(){_0x33c4eb(0x1);});});}function addCmHopperPhones(_0x1b084f){return new Promise(function(_0x45530b){return db[_0xbeed('0x79')][_0xbeed('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1b084f}})['then'](function(_0x499eb6){var _0x350131=[];_[_0xbeed('0x6f')](_0x499eb6,function(_0x41de28){_0x350131[_0xbeed('0x5c')](createCmHopperPhone(_0x1b084f,_0x41de28['id']));});Promise[_0xbeed('0x61')](_0x350131)[_0xbeed('0x18')](function(){_0x45530b(0x1);});});});}function createCmHopperPhone(_0x46b14c,_0x341520){return new Promise(function(_0x4b04f0){db[_0xbeed('0x48')][_0xbeed('0x1f')]({'raw':!![],'attributes':[_0xbeed('0x92'),'OrderBy'],'where':{'CmContactId':_0x46b14c,'ItemClass':_0xbeed('0x91')},'include':[{'model':db[_0xbeed('0x67')],'attributes':['OrderBy'],'as':_0xbeed('0x93')}],'order':['OrderBy',db['sequelize']['literal'](_0xbeed('0x94'))]})[_0xbeed('0x18')](function(_0x1088c1){var _0x45b835=0x1;var _0x4caa7a=_['map'](_0x1088c1,function(_0x17ce16){_0x17ce16[_0xbeed('0x95')]=_0x341520;_0x17ce16[_0xbeed('0x78')]=_0x17ce16['item'];_0x17ce16[_0xbeed('0x8b')]=_0x45b835;delete _0x17ce16[_0xbeed('0x96')];_0x45b835=_0x45b835+0x1;return _0x17ce16;});return db[_0xbeed('0x97')][_0xbeed('0x98')](_0x4caa7a,{});})[_0xbeed('0x18')](function(){_0x4b04f0(0x1);});});}function insertAdditionalPhones(_0x46ccd0,_0xa9862){return new Promise(function(_0x37c179){var _0x1a4f90=[];for(var _0x2f047d=0x0;_0x2f047d<_0xa9862[_0xbeed('0x27')];_0x2f047d++){var _0x301d9e=_0xa9862[_0x2f047d];_0x1a4f90[_0xbeed('0x5c')](parseContactItemType(_0x301d9e));}Promise['all'](_0x1a4f90)[_0xbeed('0x18')](function(){var _0x1ae41f={'id':_0x46ccd0['id'],'items':_0xa9862};return addAdditionalPhones(_0x1ae41f)[_0xbeed('0x18')](function(){return addCmHopperPhones(_0x46ccd0['id']);});})[_0xbeed('0x18')](function(){_0x37c179(_0x46ccd0);});});}function parseContactItemType(_0x28b4d2){return new Promise(function(_0xf21711){if(_0x28b4d2[_0xbeed('0x33')](_0xbeed('0x8e'))){_0xf21711(_0x28b4d2);}else{return db['ContactItemType'][_0xbeed('0x23')]({'where':{'name':_0x28b4d2[_0xbeed('0x93')]}})[_0xbeed('0x18')](function(_0x136063){if(_['isNil'](_0x136063))_0x28b4d2[_0xbeed('0x8e')]=null;else _0x28b4d2['ItemTypeId']=_0x136063['id'];_0xf21711(_0x28b4d2);});}});}exports[_0xbeed('0x99')]=function(_0x25cb9a,_0x8f3dde){return db[_0xbeed('0x48')][_0xbeed('0x1f')]({'raw':!![],'where':{'CmContactId':_0x25cb9a[_0xbeed('0x24')]['id'],'ItemClass':_0xbeed('0x91')},'include':[{'model':db['ContactItemType'],'as':_0xbeed('0x93')}],'order':[[_0xbeed('0x8b')],[db['sequelize']['literal'](_0xbeed('0x94'))]]})['then'](function(_0x47ae0f){return _0x47ae0f;})[_0xbeed('0x18')](respondWithResult(_0x8f3dde,null))['catch'](handleError(_0x8f3dde,null));};exports[_0xbeed('0x9a')]=function(_0x36cd70,_0x43af56){return db[_0xbeed('0x48')][_0xbeed('0x1f')]({'raw':!![],'where':{'CmContactId':_0x36cd70[_0xbeed('0x35')][_0xbeed('0x9b')]}})[_0xbeed('0x18')](function(_0xa98e7b){var _0x3b921a=_['map'](_0xa98e7b,function(_0x28f25f){_0x28f25f[_0xbeed('0x9c')]=_0x36cd70[_0xbeed('0x35')][_0xbeed('0x9d')];return _0x28f25f;});return db['CmContactHasItem']['bulkCreate'](_0x3b921a,{});})[_0xbeed('0x18')](function(){return addCmHopperPhones(_0x36cd70[_0xbeed('0x35')][_0xbeed('0x9d')]);})[_0xbeed('0x18')](function(){return['ok'];})['then'](respondWithResult(_0x43af56,null))[_0xbeed('0x21')](handleError(_0x43af56,null));};exports[_0xbeed('0x9e')]=function(_0x4e3c75,_0x53b15e){var _0x5443f6=[];_0x5443f6[_0xbeed('0x5c')](createCmHopperPhone(_0x4e3c75[_0xbeed('0x35')]['id'],_0x4e3c75[_0xbeed('0x35')][_0xbeed('0x9f')]));Promise[_0xbeed('0x61')](_0x5443f6)[_0xbeed('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x53b15e,null));};exports[_0xbeed('0xa0')]=function(_0x58885f,_0x2fe8c1){var _0x4b7752={'raw':![],'where':{}};var _0x22be5c={};var _0x1ecc2e={'count':0x0,'rows':[]};return db['CmContact'][_0xbeed('0x7b')]({'where':{'id':_0x58885f[_0xbeed('0x24')]['id']}})[_0xbeed('0x18')](handleEntityNotFound(_0x2fe8c1,null))['then'](function(_0x19cf42){if(_0x19cf42){_0x22be5c[_0xbeed('0x7f')]=_['keys'](db['CmHopper']['rawAttributes']);_0x22be5c[_0xbeed('0x20')]=_[_0xbeed('0x26')](_0x58885f[_0xbeed('0x20')]);_0x22be5c[_0xbeed('0x7d')]=_[_0xbeed('0x7e')](_0x22be5c['model'],_0x22be5c[_0xbeed('0x20')]);_0x4b7752[_0xbeed('0x80')]=_[_0xbeed('0x7e')](_0x22be5c[_0xbeed('0x7f')],qs[_0xbeed('0x81')](_0x58885f[_0xbeed('0x20')]['fields']));_0x4b7752[_0xbeed('0x80')]=_0x4b7752[_0xbeed('0x80')]['length']?_0x4b7752[_0xbeed('0x80')]:_0x22be5c[_0xbeed('0x7f')];if(!_0x58885f[_0xbeed('0x20')][_0xbeed('0x33')](_0xbeed('0x87'))){_0x4b7752[_0xbeed('0x11')]=qs[_0xbeed('0x11')](_0x58885f[_0xbeed('0x20')][_0xbeed('0x11')]);_0x4b7752[_0xbeed('0x13')]=qs[_0xbeed('0x13')](_0x58885f['query'][_0xbeed('0x13')]);}_0x4b7752[_0xbeed('0x82')]=qs[_0xbeed('0x83')](_0x58885f[_0xbeed('0x20')][_0xbeed('0x83')]);_0x4b7752[_0xbeed('0x5a')]=qs[_0xbeed('0x7d')](_[_0xbeed('0x84')](_0x58885f[_0xbeed('0x20')],_0x22be5c[_0xbeed('0x7d')]));_0x4b7752[_0xbeed('0x5a')][_0xbeed('0xa1')]=_0x19cf42['id'];if(_0x58885f['query']['filter']){_0x4b7752['where']=_[_0xbeed('0x34')](_0x4b7752[_0xbeed('0x5a')],{'$or':_['map'](_0x4b7752['attributes'],function(_0x135d55){var _0x19a36a={};_0x19a36a[_0x135d55]={'$like':'%'+_0x58885f[_0xbeed('0x20')][_0xbeed('0x85')]+'%'};return _0x19a36a;})});}_0x4b7752=_[_0xbeed('0x34')]({},_0x4b7752,_0x58885f['options']);return db[_0xbeed('0x79')][_0xbeed('0x12')]({'where':_0x4b7752[_0xbeed('0x5a')]})[_0xbeed('0x18')](function(_0x2bb06f){_0x1ecc2e[_0xbeed('0x12')]=_0x2bb06f;if(_0x58885f[_0xbeed('0x20')][_0xbeed('0xa2')]){_0x4b7752[_0xbeed('0xa3')]=[{'all':!![]}];}return db[_0xbeed('0x79')]['findAll'](_0x4b7752);})[_0xbeed('0x18')](function(_0x4bc1f4){_0x1ecc2e[_0xbeed('0xa4')]=_0x4bc1f4;return _0x1ecc2e;});}})[_0xbeed('0x18')](respondWithFilteredResult(_0x2fe8c1,_0x4b7752))[_0xbeed('0x21')](handleError(_0x2fe8c1,null));};exports[_0xbeed('0xa5')]=function(_0x42b03a,_0x1efd66){var _0x46ca60={'raw':!![],'where':{}};var _0x13cdd1={};var _0x203690={'count':0x0,'rows':[]};return db[_0xbeed('0x25')][_0xbeed('0x7b')]({'where':{'id':_0x42b03a['params']['id']}})['then'](handleEntityNotFound(_0x1efd66,null))[_0xbeed('0x18')](function(_0x47f96d){if(_0x47f96d){_0x13cdd1[_0xbeed('0x7f')]=_['keys'](db[_0xbeed('0x49')][_0xbeed('0x7c')]);_0x13cdd1[_0xbeed('0x20')]=_[_0xbeed('0x26')](_0x42b03a[_0xbeed('0x20')]);_0x13cdd1[_0xbeed('0x7d')]=_[_0xbeed('0x7e')](_0x13cdd1['model'],_0x13cdd1['query']);_0x46ca60['attributes']=_[_0xbeed('0x7e')](_0x13cdd1[_0xbeed('0x7f')],qs['fields'](_0x42b03a[_0xbeed('0x20')][_0xbeed('0x81')]));_0x46ca60[_0xbeed('0x80')]=_0x46ca60['attributes'][_0xbeed('0x27')]?_0x46ca60[_0xbeed('0x80')]:_0x13cdd1['model'];if(!_0x42b03a[_0xbeed('0x20')][_0xbeed('0x33')](_0xbeed('0x87'))){_0x46ca60[_0xbeed('0x11')]=qs['limit'](_0x42b03a[_0xbeed('0x20')][_0xbeed('0x11')]);_0x46ca60[_0xbeed('0x13')]=qs[_0xbeed('0x13')](_0x42b03a[_0xbeed('0x20')][_0xbeed('0x13')]);}_0x46ca60['order']=qs['sort'](_0x42b03a[_0xbeed('0x20')][_0xbeed('0x83')]);_0x46ca60['where']=qs[_0xbeed('0x7d')](_[_0xbeed('0x84')](_0x42b03a[_0xbeed('0x20')],_0x13cdd1[_0xbeed('0x7d')]));_0x46ca60['where']['ContactId']=_0x47f96d['id'];if(_0x42b03a[_0xbeed('0x20')][_0xbeed('0x85')]){_0x46ca60[_0xbeed('0x5a')]=_['merge'](_0x46ca60[_0xbeed('0x5a')],{'$or':_[_0xbeed('0x6f')](_0x46ca60[_0xbeed('0x80')],function(_0x4e7c2e){var _0xe586db={};_0xe586db[_0x4e7c2e]={'$like':'%'+_0x42b03a[_0xbeed('0x20')][_0xbeed('0x85')]+'%'};return _0xe586db;})});}_0x46ca60=_['merge']({},_0x46ca60,_0x42b03a[_0xbeed('0x86')]);return db['CmHopperHistory'][_0xbeed('0x12')]({'where':_0x46ca60[_0xbeed('0x5a')]})['then'](function(_0x2001c1){_0x203690[_0xbeed('0x12')]=_0x2001c1;if(_0x42b03a[_0xbeed('0x20')][_0xbeed('0xa2')]){_0x46ca60['include']=[{'all':!![]}];}return db[_0xbeed('0x49')][_0xbeed('0x1f')](_0x46ca60);})['then'](function(_0x59ea60){_0x203690[_0xbeed('0xa4')]=_0x59ea60;return _0x203690;});}})['then'](respondWithFilteredResult(_0x1efd66,_0x46ca60))[_0xbeed('0x21')](handleError(_0x1efd66,null));};exports[_0xbeed('0xa6')]=function(_0x5ebc73,_0x325243){var _0x4f4d38={'raw':!![],'where':{}};var _0x179f44={};var _0x5536b5={'count':0x0,'rows':[]};return db[_0xbeed('0x25')][_0xbeed('0x7b')]({'where':{'id':_0x5ebc73[_0xbeed('0x24')]['id']}})[_0xbeed('0x18')](handleEntityNotFound(_0x325243,null))[_0xbeed('0x18')](function(_0x3622de){if(_0x3622de){_0x179f44[_0xbeed('0x7f')]=_[_0xbeed('0x26')](db[_0xbeed('0xa7')]['rawAttributes']);_0x179f44[_0xbeed('0x20')]=_[_0xbeed('0x26')](_0x5ebc73[_0xbeed('0x20')]);_0x179f44[_0xbeed('0x7d')]=_['intersection'](_0x179f44[_0xbeed('0x7f')],_0x179f44['query']);_0x4f4d38[_0xbeed('0x80')]=_[_0xbeed('0x7e')](_0x179f44[_0xbeed('0x7f')],qs['fields'](_0x5ebc73[_0xbeed('0x20')][_0xbeed('0x81')]));_0x4f4d38['attributes']=_0x4f4d38[_0xbeed('0x80')][_0xbeed('0x27')]?_0x4f4d38['attributes']:_0x179f44[_0xbeed('0x7f')];if(!_0x5ebc73[_0xbeed('0x20')][_0xbeed('0x33')](_0xbeed('0x87'))){_0x4f4d38['limit']=qs['limit'](_0x5ebc73[_0xbeed('0x20')][_0xbeed('0x11')]);_0x4f4d38[_0xbeed('0x13')]=qs[_0xbeed('0x13')](_0x5ebc73['query'][_0xbeed('0x13')]);}_0x4f4d38['order']=qs['sort'](_0x5ebc73[_0xbeed('0x20')]['sort']);_0x4f4d38[_0xbeed('0x5a')]=qs['filters'](_[_0xbeed('0x84')](_0x5ebc73['query'],_0x179f44[_0xbeed('0x7d')]));_0x4f4d38[_0xbeed('0x5a')][_0xbeed('0xa1')]=_0x3622de['id'];if(_0x5ebc73[_0xbeed('0x20')][_0xbeed('0x85')]){_0x4f4d38[_0xbeed('0x5a')]=_[_0xbeed('0x34')](_0x4f4d38[_0xbeed('0x5a')],{'$or':_[_0xbeed('0x6f')](_0x4f4d38[_0xbeed('0x80')],function(_0x486dad){var _0x5826b0={};_0x5826b0[_0x486dad]={'$like':'%'+_0x5ebc73[_0xbeed('0x20')][_0xbeed('0x85')]+'%'};return _0x5826b0;})});}_0x4f4d38=_[_0xbeed('0x34')]({},_0x4f4d38,_0x5ebc73[_0xbeed('0x86')]);return db[_0xbeed('0xa7')]['count']({'where':_0x4f4d38['where']})[_0xbeed('0x18')](function(_0x3933dd){_0x5536b5['count']=_0x3933dd;if(_0x5ebc73['query'][_0xbeed('0xa2')]){_0x4f4d38[_0xbeed('0xa3')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x4f4d38);})[_0xbeed('0x18')](function(_0x4f1828){_0x5536b5[_0xbeed('0xa4')]=_0x4f1828;return _0x5536b5;});}})[_0xbeed('0x18')](respondWithFilteredResult(_0x325243,_0x4f4d38))[_0xbeed('0x21')](handleError(_0x325243,null));};exports[_0xbeed('0xa8')]=function(_0x5da5fb,_0x315ba3){var _0x19874f={'raw':!![],'where':{}};var _0x5920a9={};var _0x54e972={'count':0x0,'rows':[]};return db[_0xbeed('0x25')]['findOne']({'where':{'id':_0x5da5fb[_0xbeed('0x24')]['id']}})[_0xbeed('0x18')](handleEntityNotFound(_0x315ba3,null))[_0xbeed('0x18')](function(_0x8fc476){if(_0x8fc476){_0x5920a9[_0xbeed('0x7f')]=_[_0xbeed('0x26')](db[_0xbeed('0x50')][_0xbeed('0x7c')]);_0x5920a9['query']=_[_0xbeed('0x26')](_0x5da5fb[_0xbeed('0x20')]);_0x5920a9[_0xbeed('0x7d')]=_[_0xbeed('0x7e')](_0x5920a9[_0xbeed('0x7f')],_0x5920a9[_0xbeed('0x20')]);_0x19874f[_0xbeed('0x80')]=_[_0xbeed('0x7e')](_0x5920a9[_0xbeed('0x7f')],qs['fields'](_0x5da5fb[_0xbeed('0x20')]['fields']));_0x19874f[_0xbeed('0x80')]=_0x19874f[_0xbeed('0x80')]['length']?_0x19874f[_0xbeed('0x80')]:_0x5920a9[_0xbeed('0x7f')];if(!_0x5da5fb[_0xbeed('0x20')][_0xbeed('0x33')]('nolimit')){_0x19874f[_0xbeed('0x11')]=qs[_0xbeed('0x11')](_0x5da5fb['query']['limit']);_0x19874f[_0xbeed('0x13')]=qs['offset'](_0x5da5fb['query'][_0xbeed('0x13')]);}_0x19874f[_0xbeed('0x82')]=qs[_0xbeed('0x83')](_0x5da5fb[_0xbeed('0x20')][_0xbeed('0x83')]);_0x19874f[_0xbeed('0x5a')]=qs['filters'](_[_0xbeed('0x84')](_0x5da5fb[_0xbeed('0x20')],_0x5920a9['filters']));_0x19874f[_0xbeed('0x5a')][_0xbeed('0xa1')]=_0x8fc476['id'];if(_0x5da5fb[_0xbeed('0x20')][_0xbeed('0x85')]){_0x19874f['where']=_['merge'](_0x19874f[_0xbeed('0x5a')],{'$or':_[_0xbeed('0x6f')](_0x19874f[_0xbeed('0x80')],function(_0x5610ec){var _0x530c71={};_0x530c71[_0x5610ec]={'$like':'%'+_0x5da5fb[_0xbeed('0x20')][_0xbeed('0x85')]+'%'};return _0x530c71;})});}_0x19874f=_[_0xbeed('0x34')]({},_0x19874f,_0x5da5fb[_0xbeed('0x86')]);return db[_0xbeed('0x50')][_0xbeed('0x12')]({'where':_0x19874f['where']})['then'](function(_0x1b829e){_0x54e972[_0xbeed('0x12')]=_0x1b829e;if(_0x5da5fb[_0xbeed('0x20')][_0xbeed('0xa2')]){_0x19874f[_0xbeed('0xa3')]=[{'all':!![]}];}return db[_0xbeed('0x50')][_0xbeed('0x1f')](_0x19874f);})[_0xbeed('0x18')](function(_0x37612f){_0x54e972[_0xbeed('0xa4')]=_0x37612f;return _0x54e972;});}})[_0xbeed('0x18')](respondWithFilteredResult(_0x315ba3,_0x19874f))['catch'](handleError(_0x315ba3,null));};exports['uploadCsv']=function(_0x2446af,_0x403a74){try{if(!_0x2446af[_0xbeed('0x35')][_0xbeed('0x5d')]){throw new Error(_0xbeed('0xa9'));}if(!_0x2446af[_0xbeed('0x35')][_0xbeed('0xaa')]){throw new Error(_0xbeed('0xab'));}if(!_0x2446af[_0xbeed('0x35')][_0xbeed('0xac')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x2446af['body'][_0xbeed('0xad')]){throw new Error(_0xbeed('0xae'));}var _0x5253b6=_0x2446af[_0xbeed('0x35')]['binding_keys'][_0xbeed('0xaf')](',');var _0x470d72=_0x2446af[_0xbeed('0x35')]['binding_values'][_0xbeed('0xaf')](',');if(!_0x5253b6[_0xbeed('0x27')]||!_0x470d72[_0xbeed('0x27')]||_0x5253b6['length']!==_0x470d72[_0xbeed('0x27')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x2446af[_0xbeed('0x35')]['fields']=_[_0xbeed('0xb0')](_0x5253b6,_0x470d72);if(!_0x2446af[_0xbeed('0x35')][_0xbeed('0x81')][_0xbeed('0x78')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2446af['body'][_0xbeed('0x81')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x230b27=path[_0xbeed('0x3b')](config[_0xbeed('0xb1')],_0xbeed('0xb2'),_0x2446af[_0xbeed('0xb3')][_0xbeed('0xb4')]);fs[_0xbeed('0xb5')](_0x230b27,parseInt(_0xbeed('0xb6'),0x8));var _0x12bc69=require(_0xbeed('0xb7'))[_0xbeed('0xb8')](path[_0xbeed('0x3b')](__dirname,_0xbeed('0xb9')),[_0x230b27,_0x2446af[_0xbeed('0x35')][_0xbeed('0xaa')],_0x2446af[_0xbeed('0x35')]['binding_values'],_0x2446af[_0xbeed('0x35')][_0xbeed('0x5d')],_0x2446af['body'][_0xbeed('0xba')],_0x2446af[_0xbeed('0x35')][_0xbeed('0x59')],_0x2446af[_0xbeed('0x35')][_0xbeed('0xad')]]);return _0x403a74['status'](0xc8)[_0xbeed('0x17')]({'message':_0xbeed('0xbb'),'pid':_0x12bc69[_0xbeed('0xbc')]});}catch(_0x1f0561){return _0x403a74[_0xbeed('0x14')](0x1f4)[_0xbeed('0x1d')](_0x1f0561);}};exports[_0xbeed('0xbd')]=function(_0x101e4f,_0x153f5a){var _0x401de1=fs[_0xbeed('0xbe')](_0x101e4f[_0xbeed('0xb3')][_0xbeed('0xbf')]);Papa[_0xbeed('0xc0')](_0x401de1,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2aa79){return _0x153f5a[_0xbeed('0x14')](0xc8)[_0xbeed('0x17')]({'file':_0x101e4f['file'],'fields':_0x2aa79[_0xbeed('0xc1')]['fields']});}});};exports[_0xbeed('0xc2')]=function(_0x32feec,_0x346619){return db[_0xbeed('0xc3')][_0xbeed('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbeed('0xc4')}})[_0xbeed('0x18')](function(_0x5c68e4){var _0x16feda=![];if(!_0x32feec[_0xbeed('0x35')][_0xbeed('0x5d')]){throw new Error(_0xbeed('0xa9'));}if(!_0x32feec[_0xbeed('0x35')][_0xbeed('0xc5')][_0xbeed('0x78')]){throw new Error(_0xbeed('0xc6'));}if(!_0x32feec[_0xbeed('0x35')][_0xbeed('0xc5')][_0xbeed('0xc7')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x32feec[_0xbeed('0x35')][_0xbeed('0xad')]){throw new Error(_0xbeed('0xae'));}var _0xb169a4=require(_0xbeed('0xb7'))['fork'](path[_0xbeed('0x3b')](__dirname,_0xbeed('0xc8')),[_0x32feec[_0xbeed('0x24')]['id'],JSON['stringify'](_0x32feec['body']),JSON[_0xbeed('0xc9')](_0x5c68e4)]);_0xb169a4['on']('message',function(){_0x16feda=!![];return _0x346619[_0xbeed('0x14')](0xc8)[_0xbeed('0x17')]({'message':_0xbeed('0xca'),'pid':_0xb169a4['pid']});});_0xb169a4['on'](_0xbeed('0xcb'),function(_0x15a750){if(_0x15a750&&!_0x16feda){return _0x346619['status'](0x1f4)['json']({'message':_0xbeed('0xcc'),'pid':_0xb169a4[_0xbeed('0xbc')]});}});})[_0xbeed('0x21')](handleError(_0x346619,null));};exports[_0xbeed('0xcd')]=function(_0x38b0a2,_0x1f50b2){return db[_0xbeed('0xc3')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xbeed('0xc4')}})[_0xbeed('0x18')](function(_0x3ef2b5){var _0xde4c63=![];if(!_0x38b0a2[_0xbeed('0x35')][_0xbeed('0x5d')]){throw new Error(_0xbeed('0xa9'));}if(!_0x38b0a2[_0xbeed('0x35')][_0xbeed('0xc5')][_0xbeed('0x78')]){throw new Error(_0xbeed('0xc6'));}if(!_0x38b0a2[_0xbeed('0x35')][_0xbeed('0xc5')]['firstName']){throw new Error(_0xbeed('0xce'));}if(!_0x38b0a2[_0xbeed('0x35')][_0xbeed('0xad')]){throw new Error(_0xbeed('0xae'));}var _0x474ce3=require('child_process')[_0xbeed('0xb8')](path[_0xbeed('0x3b')](__dirname,'../../components/import/cm/csvUpdates'),[_0x38b0a2[_0xbeed('0x24')]['id'],JSON[_0xbeed('0xc9')](_0x38b0a2[_0xbeed('0x35')]),JSON[_0xbeed('0xc9')](_0x3ef2b5)]);_0x474ce3['on'](_0xbeed('0xcf'),function(){_0xde4c63=!![];return _0x1f50b2[_0xbeed('0x14')](0xc8)[_0xbeed('0x17')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x474ce3[_0xbeed('0xbc')]});});_0x474ce3['on'](_0xbeed('0xcb'),function(_0x2c359a){if(_0x2c359a&&!_0xde4c63){return _0x1f50b2[_0xbeed('0x14')](0x1f4)[_0xbeed('0x17')]({'message':_0xbeed('0xcc'),'pid':_0x474ce3[_0xbeed('0xbc')]});}});})[_0xbeed('0x21')](handleError(_0x1f50b2,null));};exports[_0xbeed('0xd0')]=function(_0x36bfb8,_0x18ba56){var _0x438909=['mail','chat',_0xbeed('0xd1'),_0xbeed('0xd2'),_0xbeed('0xd3'),_0xbeed('0xd4'),_0xbeed('0xd5')];var _0xa24b46={'offset':0x0,'order':qs[_0xbeed('0x83')]('-createdAt')},_0x2e5092={'count':0x0,'rows':[]};Promise[_0xbeed('0xd6')]()[_0xbeed('0x18')](function(){if(_0x36bfb8[_0xbeed('0x20')][_0xbeed('0xd7')]){if(!_[_0xbeed('0xd8')](_0x438909,_0x36bfb8[_0xbeed('0x20')][_0xbeed('0xd7')][_0xbeed('0xd9')]())){throw new Error('Invalid\x20channel');}_0x438909=[_0x36bfb8['query'][_0xbeed('0xd7')][_0xbeed('0xd9')]()];}if(_0x36bfb8['query'][_0xbeed('0xda')]){try{var _0x160e31=JSON['parse'](_0x36bfb8[_0xbeed('0x20')][_0xbeed('0xda')]);if(!moment(_0x160e31[_0xbeed('0x36')])[_0xbeed('0xdb')]()){throw new Error(_0xbeed('0xdc'));}if(!moment(_0x160e31['to'])[_0xbeed('0xdb')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x430632){throw new Error(_0xbeed('0xdd'));}}if(!_0x36bfb8[_0xbeed('0x20')][_0xbeed('0x33')]('nolimit')){_0xa24b46[_0xbeed('0x11')]=qs[_0xbeed('0x11')](_0x36bfb8[_0xbeed('0x20')][_0xbeed('0x11')]||0xa);_0xa24b46[_0xbeed('0x13')]=qs['offset'](_0x36bfb8['query']['offset']);}var _0x43b4a8=_0x438909['map'](function(_0x467613){if(_0x467613===_0xbeed('0xd5')){var _0x3ecc97={'attributes':['id',_0xbeed('0xde'),_0xbeed('0xdf'),'source',_0xbeed('0xe0'),'callerid','starttime',_0xbeed('0xe1'),_0xbeed('0xe2'),_0xbeed('0xe3'),_0xbeed('0xe4'),_0xbeed('0xe5'),_0xbeed('0xe6'),_0xbeed('0xe7'),_0xbeed('0xe8')],'where':{'ContactId':_0x36bfb8[_0xbeed('0x24')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0xbeed('0x1c'),_0xbeed('0xe9'),'alias']}],'order':[[_0xbeed('0xe4'),_0xbeed('0xea')]]};if(_0x36bfb8[_0xbeed('0x20')][_0xbeed('0xda')]){_0x3ecc97[_0xbeed('0x5a')][_0xbeed('0xe4')]={'$gte':_0x160e31[_0xbeed('0x36')],'$lte':_0x160e31['to']};}return db[_0xbeed('0xeb')]['findAndCountAll'](_0x3ecc97)[_0xbeed('0x18')](function(_0x51830d){_0x2e5092['count']+=_0x51830d[_0xbeed('0x12')];return _[_0xbeed('0x6f')](_0x51830d['rows'],function(_0x24b580){var _0x45fff7=_0x24b580[_0xbeed('0x37')]({'plain':!![]});_0x45fff7[_0xbeed('0xd7')]=_0x467613;if(_0x45fff7['User']){_0x45fff7[_0xbeed('0xc3')]={'id':_0x45fff7[_0xbeed('0xc3')]['id'],'name':_0x45fff7[_0xbeed('0xc3')][_0xbeed('0x1c')],'fullname':_0x45fff7['User'][_0xbeed('0xe9')],'alias':_0x45fff7[_0xbeed('0xc3')][_0xbeed('0x2d')]};}return _0x45fff7;});});}else{var _0x1a3bda=_[_0xbeed('0xec')](_0x467613)+(_0x467613==='chat'?_0xbeed('0xed'):_0xbeed('0xee'));var _0x1d781d={'attributes':['id',_0xbeed('0xef'),'closedAt',_0xbeed('0xe4'),'note','disposition','secondDisposition',_0xbeed('0xf0'),'UserId',_0x1a3bda+'Id'],'where':{'ContactId':_0x36bfb8[_0xbeed('0x24')]['id']},'include':[{'model':db[_0x1a3bda],'as':_0xbeed('0xee'),'attributes':['id',_0xbeed('0x1c'),'key']},{'model':db['User'],'as':_0xbeed('0xf1'),'attributes':['id',_0xbeed('0x1c'),_0xbeed('0xe9')]},{'model':db[_0xbeed('0x62')],'as':'Tags','attributes':['id',_0xbeed('0x1c'),_0xbeed('0x64')],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x36bfb8[_0xbeed('0x20')]['range']){_0x1d781d[_0xbeed('0x5a')]['createdAt']={'$gte':_0x160e31['from'],'$lte':_0x160e31['to']};}switch(_0x467613){case _0xbeed('0xf2'):_0x1d781d['attributes']['push']('browserName',_0xbeed('0xf3'),_0xbeed('0xf4'),_0xbeed('0xf5'),_0xbeed('0xf6'),_0xbeed('0xf7'),'ratingType',_0xbeed('0xf8'),_0xbeed('0xf9'));break;case'mail':_0x1d781d[_0xbeed('0x80')]['push']('subject',_0xbeed('0xfa'));break;case _0xbeed('0xd2'):_0x1d781d[_0xbeed('0x80')][_0xbeed('0x5c')](_0xbeed('0xfb'),_0xbeed('0xfc'));break;}return db[_[_0xbeed('0xec')](_0x467613)+_0xbeed('0xfd')][_0xbeed('0xfe')](_0x1d781d)['then'](function(_0x570d61){_0x2e5092['count']+=_0x570d61[_0xbeed('0x12')];return _[_0xbeed('0x6f')](_0x570d61[_0xbeed('0xa4')],function(_0x113149){var _0x303a98=_0x113149[_0xbeed('0x37')]({'plain':!![]});_0x303a98[_0xbeed('0xd7')]=_0x467613;if(_0x303a98[_0xbeed('0xf1')]){_0x303a98['Owner']={'id':_0x303a98[_0xbeed('0xf1')]['id'],'name':_0x303a98['Owner'][_0xbeed('0x1c')],'fullname':_0x303a98['Owner'][_0xbeed('0xe9')]};}return _0x303a98;});});}});return Promise[_0xbeed('0x61')](_0x43b4a8);})[_0xbeed('0x18')](function(_0x3e9154){return _(_0x3e9154)[_0xbeed('0xff')]()['sortBy'](_0xbeed('0xe4'))[_0xbeed('0x100')]()['value']();})[_0xbeed('0x18')](function(_0x1673cd){_0x2e5092[_0xbeed('0xa4')]=_0xa24b46[_0xbeed('0x11')]?_0x1673cd[_0xbeed('0x101')](_0xa24b46['offset'],_0xa24b46['offset']+_0xa24b46['limit']):_0x1673cd;return _0x2e5092;})['then'](respondWithFilteredResult(_0x18ba56,_0xa24b46))['catch'](handleError(_0x18ba56,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 6c85d4d..c84443f 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 _0x8216=['CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4b6c5d,_0x3cbbdf){var _0x4e4d47=function(_0x311028){while(--_0x311028){_0x4b6c5d['push'](_0x4b6c5d['shift']());}};_0x4e4d47(++_0x3cbbdf);}(_0x8216,0x169));var _0x6821=function(_0x2b5df5,_0x3de0d2){_0x2b5df5=_0x2b5df5-0x0;var _0x928576=_0x8216[_0x2b5df5];return _0x928576;};'use strict';var EventEmitter=require(_0x6821('0x0'));var CmContact=require(_0x6821('0x1'))['db'][_0x6821('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x6821('0x3')](0x0);var events={'afterCreate':_0x6821('0x4'),'afterUpdate':_0x6821('0x5'),'afterDestroy':_0x6821('0x6')};function emitEvent(_0x54dbd1){return function(_0x3f189f,_0x1cb71b,_0x520a9d){CmContactEvents[_0x6821('0x7')](_0x54dbd1+':'+_0x3f189f['id'],_0x3f189f);CmContactEvents[_0x6821('0x7')](_0x54dbd1,_0x3f189f);_0x520a9d(null);};}for(var e in events){if(events[_0x6821('0x8')](e)){var event=events[e];CmContact[_0x6821('0x9')](e,emitEvent(event));}}module[_0x6821('0xa')]=CmContactEvents; \ No newline at end of file +var _0x3284=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update'];(function(_0x6b6d09,_0xc0dc47){var _0x320edb=function(_0x244527){while(--_0x244527){_0x6b6d09['push'](_0x6b6d09['shift']());}};_0x320edb(++_0xc0dc47);}(_0x3284,0x1a1));var _0x4328=function(_0x42de04,_0xa4c5c4){_0x42de04=_0x42de04-0x0;var _0x559ec3=_0x3284[_0x42de04];return _0x559ec3;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x4328('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x4328('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4328('0x2'),'afterDestroy':'remove'};function emitEvent(_0x561c65){return function(_0x25c77f,_0x15f4f3,_0xfc3898){CmContactEvents[_0x4328('0x3')](_0x561c65+':'+_0x25c77f['id'],_0x25c77f);CmContactEvents[_0x4328('0x3')](_0x561c65,_0x25c77f);_0xfc3898(null);};}for(var e in events){if(events[_0x4328('0x4')](e)){var event=events[e];CmContact[_0x4328('0x5')](e,emitEvent(event));}}module[_0x4328('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index c5b4199..7f7cffb 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 _0xb5fd=['onlyIfOpen','findAll','outbound','CmList','Lists','map','all','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','firstName','mobile','fax','email','utf8mb4','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','[cmContact][afterCreate]','isEmpty','destroy','ContactId','push','info','inspect','[CmContact][afterDestroy][Error]','lodash','util','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','minutes','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','dialCheckDuplicateType'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xb5fd,0x9e));var _0xdb5f=function(_0x11df7,_0x3be5aa){_0x11df7=_0x11df7-0x0;var _0x15db12=_0xb5fd[_0x11df7];return _0x15db12;};'use strict';var _=require(_0xdb5f('0x0'));var util=require(_0xdb5f('0x1'));var logger=require('../../config/logger')(_0xdb5f('0x2'));var moment=require(_0xdb5f('0x3'));var shared=require(_0xdb5f('0x4'));var attributes=require(_0xdb5f('0x5'));function getTimezoneCallbackAt(_0x14e664,_0x4c85af,_0x57fa70,_0xedfd69){var _0x4e153f=_0xedfd69?_0xdb5f('0x6'):_0xdb5f('0x7');var _0x20cd22=_0x57fa70[_0xdb5f('0x8')]?_0x57fa70[_0xdb5f('0x8')]:moment()[_0xdb5f('0x9')](_0xdb5f('0xa'));if(_[_0xdb5f('0xb')](_0x57fa70[_0xdb5f('0xc')])){return Promise[_0xdb5f('0xd')](_0x20cd22);}return _0x14e664[_0x4e153f][_0xdb5f('0xe')]({'where':{'id':_0x4c85af}})[_0xdb5f('0xf')](function(_0x1cd6e7){if(_[_0xdb5f('0xb')](_0x1cd6e7)||_[_0xdb5f('0xb')](_0x1cd6e7[_0xdb5f('0xc')])){return Promise[_0xdb5f('0xd')](_0x20cd22);}var _0x5ce45b=shared[_0xdb5f('0x10')];var _0x3ce7a0=_0x5ce45b[_0x1cd6e7[_0xdb5f('0xc')]];var _0x55b1f=_0x5ce45b[_0x57fa70[_0xdb5f('0xc')]];if(_[_0xdb5f('0xb')](_0x3ce7a0)&&_['isNil'](_0x55b1f)){return Promise[_0xdb5f('0xd')](_0x20cd22);}var _0x1b0015=_0x3ce7a0[_0xdb5f('0x11')]-_0x55b1f['utcOffset'];var _0x3fa9ab=_0x57fa70['scheduledat']?_0x57fa70['scheduledat']:moment();_0x20cd22=moment(_0x3fa9ab)['add'](_0x1b0015,_0xdb5f('0x12'))[_0xdb5f('0x9')](_0xdb5f('0xa'));return Promise[_0xdb5f('0xd')](_0x20cd22);});}function getNewHopperPayload(_0x516a2a){return{'phone':_0x516a2a[_0xdb5f('0x13')],'ContactId':_0x516a2a['id'],'ListId':_0x516a2a[_0xdb5f('0x14')],'scheduledat':_0x516a2a[_0xdb5f('0x8')]?_0x516a2a[_0xdb5f('0x8')]:moment()['format'](_0xdb5f('0xa')),'priority':_0x516a2a['priority']?_0x516a2a[_0xdb5f('0x15')]:0x2,'callback':_0x516a2a[_0xdb5f('0x16')]?!![]:![],'callbackuniqueid':_0x516a2a[_0xdb5f('0x16')]?_0x516a2a['callbackUniqueid']:undefined,'callbackat':_0x516a2a['callbackUniqueid']?moment()['format'](_0xdb5f('0xa')):undefined};}function handleAlwaysCheckDuplicate(_0x5a8d72,_0x85b7d2,_0x36f947,_0x2e0f20){var _0x4f6030={'phone':_0x36f947[_0xdb5f('0x13')]};var _0x196fdf={'calleridnum':_0x36f947[_0xdb5f('0x13')]};if(_0x2e0f20){Object[_0xdb5f('0x17')](_0x4f6030,{'CampaignId':_0x85b7d2['id']});Object[_0xdb5f('0x17')](_0x196fdf,{'CampaignId':_0x85b7d2['id']});}else{Object[_0xdb5f('0x17')](_0x4f6030,{'VoiceQueueId':_0x85b7d2['id']});Object[_0xdb5f('0x17')](_0x196fdf,{'VoiceQueueId':_0x85b7d2['id']});}return _0x5a8d72[_0xdb5f('0x18')][_0xdb5f('0xe')]({'where':_0x4f6030})[_0xdb5f('0xf')](function(_0x160cb){if(_0x160cb){throw new Error(_0xdb5f('0x19')+_0x36f947[_0xdb5f('0x13')]+_0xdb5f('0x1a')+_0x85b7d2['id']);}return _0x5a8d72[_0xdb5f('0x1b')][_0xdb5f('0xe')]({'where':_0x196fdf});})['then'](function(_0x1a5f14){if(_0x1a5f14){throw new Error(_0xdb5f('0x1c')+_0x36f947[_0xdb5f('0x13')]+_0xdb5f('0x1a')+_0x85b7d2['id']);}var _0x1a0d98=getNewHopperPayload(_0x36f947);if(_0x2e0f20){_0x1a0d98[_0xdb5f('0x1d')]=_0x85b7d2['id'];}else{_0x1a0d98[_0xdb5f('0x1e')]=_0x85b7d2['id'];}return _0x5a8d72[_0xdb5f('0x18')]['create'](_0x1a0d98);});}function handleOnlyIfOpenCheckDuplicate(_0xc5436c,_0x36b21e,_0x49bb1f,_0x2c839b){var _0x4bc923={'phone':_0x49bb1f[_0xdb5f('0x13')]};if(_0x2c839b){Object[_0xdb5f('0x17')](_0x4bc923,{'CampaignId':_0x36b21e['id']});}else{Object[_0xdb5f('0x17')](_0x4bc923,{'VoiceQueueId':_0x36b21e['id']});}return _0xc5436c[_0xdb5f('0x18')][_0xdb5f('0xe')]({'where':_0x4bc923})['then'](function(_0xa5e127){if(_0xa5e127){throw new Error(_0xdb5f('0x1f')+_0x49bb1f['phone']+_0xdb5f('0x1a')+_0x36b21e['id']);}var _0x3c2396=getNewHopperPayload(_0x49bb1f);if(_0x2c839b){_0x3c2396[_0xdb5f('0x1d')]=_0x36b21e['id'];}else{_0x3c2396['VoiceQueueId']=_0x36b21e['id'];}return _0xc5436c[_0xdb5f('0x18')][_0xdb5f('0x20')](_0x3c2396);});}function handleNeverCheckDuplicate(_0x4cac57,_0x2d3ed1,_0x565641){var _0xcc1178=getNewHopperPayload(_0x565641);_0xcc1178[_0xdb5f('0x1e')]=_0x2d3ed1['id'];return _0x4cac57[_0xdb5f('0x18')][_0xdb5f('0x20')](_0xcc1178);}function handleCheckDuplicate(_0x2ba123,_0x40a40a,_0xc71f3a,_0x28470a){return getTimezoneCallbackAt(_0x2ba123,_0x40a40a,_0xc71f3a,_0x28470a)[_0xdb5f('0xf')](function(_0x4fb7e7){_0xc71f3a[_0xdb5f('0x8')]=_0x4fb7e7;switch(_0x40a40a[_0xdb5f('0x21')]){case'always':return handleAlwaysCheckDuplicate(_0x2ba123,_0x40a40a,_0xc71f3a,_0x28470a);case _0xdb5f('0x22'):return handleOnlyIfOpenCheckDuplicate(_0x2ba123,_0x40a40a,_0xc71f3a,_0x28470a);default:return handleNeverCheckDuplicate(_0x2ba123,_0x40a40a,_0xc71f3a);}});}function createHopperForVoiceQueues(_0x556cee,_0x18bef8){return _0x556cee[_0xdb5f('0x7')][_0xdb5f('0x23')]({'where':{'type':_0xdb5f('0x24')},'attributes':['id',_0xdb5f('0x21'),_0xdb5f('0xc')],'include':[{'model':_0x556cee[_0xdb5f('0x25')],'as':_0xdb5f('0x26'),'where':{'id':_0x18bef8[_0xdb5f('0x14')]}}],'raw':!![]})[_0xdb5f('0xf')](function(_0x5df482){var _0x30babc=_0x5df482[_0xdb5f('0x27')](function(_0x58fd11){return handleCheckDuplicate(_0x556cee,_0x58fd11,_0x18bef8,![]);});return Promise['all'](_0x30babc);});}function createHopperForCampaigns(_0x43b99d,_0x385386){return _0x43b99d['Campaign'][_0xdb5f('0x23')]({'attributes':['id',_0xdb5f('0x21'),_0xdb5f('0xc')],'include':[{'model':_0x43b99d['CmList'],'as':_0xdb5f('0x26'),'where':{'id':_0x385386[_0xdb5f('0x14')]}}],'raw':!![]})[_0xdb5f('0xf')](function(_0x35eb45){var _0x226a22=_0x35eb45[_0xdb5f('0x27')](function(_0x38de7d){return handleCheckDuplicate(_0x43b99d,_0x38de7d,_0x385386,!![]);});return Promise[_0xdb5f('0x28')](_0x226a22);});}function createHopperBlackForVoiceQueues(_0x1660c3,_0x2dc8e4){return _0x1660c3[_0xdb5f('0x7')]['findAll']({'where':{'type':_0xdb5f('0x24')},'attributes':['id'],'include':[{'model':_0x1660c3[_0xdb5f('0x25')],'as':_0xdb5f('0x29'),'where':{'id':_0x2dc8e4[_0xdb5f('0x14')]}}],'raw':!![]})['then'](function(_0x592287){var _0x520efb=_0x592287[_0xdb5f('0x27')](function(_0x3fc70f){return _0x1660c3[_0xdb5f('0x2a')]['create']({'phone':_0x2dc8e4[_0xdb5f('0x13')],'ContactId':_0x2dc8e4['id'],'ListId':_0x2dc8e4[_0xdb5f('0x14')],'VoiceQueueId':_0x3fc70f['id']});});return Promise[_0xdb5f('0x28')](_0x520efb);});}function createHopperBlackForCampaigns(_0x44d23a,_0x11de3c){return _0x44d23a['Campaign'][_0xdb5f('0x23')]({'attributes':['id'],'include':[{'model':_0x44d23a['CmList'],'as':_0xdb5f('0x29'),'where':{'id':_0x11de3c['ListId']}}],'raw':!![]})[_0xdb5f('0xf')](function(_0x4eca28){var _0x230814=_0x4eca28[_0xdb5f('0x27')](function(_0x5932fa){return _0x44d23a[_0xdb5f('0x2a')][_0xdb5f('0x20')]({'phone':_0x11de3c[_0xdb5f('0x13')],'ContactId':_0x11de3c['id'],'ListId':_0x11de3c['ListId'],'CampaignId':_0x5932fa['id']});});return Promise[_0xdb5f('0x28')](_0x230814);});}module[_0xdb5f('0x2b')]=function(_0x114c19){return _0x114c19[_0xdb5f('0x2c')](_0xdb5f('0x2d'),attributes,{'tableName':_0xdb5f('0x2e'),'paranoid':!![],'indexes':[{'name':_0xdb5f('0x13'),'fields':[_0xdb5f('0x13')]},{'name':'fti_cm_contacts','fields':[_0xdb5f('0x2f'),'lastName',_0xdb5f('0x13'),_0xdb5f('0x30'),_0xdb5f('0x31'),_0xdb5f('0x32')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xdb5f('0x33'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x4c9959,_0x5b6812,_0x4d2755){var _0x3d0799=_0x114c19[_0xdb5f('0x34')];var _0x36f9d8=_0x4c9959[_0xdb5f('0x35')]({'plain':!![]});if(!_0x36f9d8['ListId']){logger[_0xdb5f('0x36')](_0xdb5f('0x37')+_0x36f9d8['id']);return _0x4d2755();}if(!_0x36f9d8[_0xdb5f('0x13')]){return _0x4d2755();}return createHopperForVoiceQueues(_0x3d0799,_0x36f9d8)[_0xdb5f('0xf')](function(){return createHopperBlackForVoiceQueues(_0x3d0799,_0x36f9d8);})[_0xdb5f('0xf')](function(){return createHopperForCampaigns(_0x3d0799,_0x36f9d8);})[_0xdb5f('0xf')](function(){return createHopperBlackForCampaigns(_0x3d0799,_0x36f9d8);})[_0xdb5f('0xf')](function(){return _0x4d2755();})['catch'](function(_0xb46f11){logger[_0xdb5f('0x36')](_0xdb5f('0x38'),_0xb46f11['message']);_0x4d2755();});},'afterDestroy':function(_0x2c97b5,_0x2fcfd6,_0x137937){var _0xab450e=_0x114c19[_0xdb5f('0x34')];var _0x17e51c=_0x2c97b5['get']({'plain':!![]});return _0xab450e[_0xdb5f('0x18')][_0xdb5f('0x23')]({'raw':!![],'where':{'ListId':_0x17e51c[_0xdb5f('0x14')],'ContactId':_0x17e51c['id']}})[_0xdb5f('0xf')](function(_0x28d8fa){if(!_[_0xdb5f('0x39')](_0x28d8fa)){var _0x2fa4b2=[];for(var _0x459c24=0x0;_0x459c24<_0x28d8fa['length'];_0x459c24+=0x1){var _0x14ef40=_0xab450e[_0xdb5f('0x18')][_0xdb5f('0x3a')]({'where':{'ListId':_0x28d8fa[_0x459c24][_0xdb5f('0x14')],'ContactId':_0x28d8fa[_0x459c24][_0xdb5f('0x3b')],'VoiceQueueId':_0x28d8fa[_0x459c24][_0xdb5f('0x1e')],'CampaignId':_0x28d8fa[_0x459c24][_0xdb5f('0x1d')]}});_0x2fa4b2[_0xdb5f('0x3c')](_0x14ef40);}return Promise['all'](_0x2fa4b2);}})['then'](function(_0x41cd53){logger[_0xdb5f('0x3d')]('[CmContact][afterDestroy][Succesfull]',util[_0xdb5f('0x3e')](_0x41cd53,{'showHidden':![],'depth':null}));_0x137937();})['catch'](function(_0x351402){logger[_0xdb5f('0x36')](_0xdb5f('0x3f'),util[_0xdb5f('0x3e')](_0x351402,{'showHidden':![],'depth':null}));_0x137937(_0x351402);});}}});}; \ No newline at end of file +var _0x2c68=['CmHopper','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','dialCheckDuplicateType','onlyIfOpen','findAll','Lists','map','VoiceQueue','outbound','CmList','BlackLists','CmHopperBlack','all','exports','define','firstName','mobile','fax','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','isEmpty','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','util','../../config/logger','moment','../../config/environment/shared','Campaign','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','then','resolve','timezones','utcOffset','add','minutes','phone','ListId','format','priority','callbackUniqueid','assign','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CmHopperFinal','VoiceQueueId','create'];(function(_0x57460e,_0x4dec17){var _0x3d2ae5=function(_0x4a1f18){while(--_0x4a1f18){_0x57460e['push'](_0x57460e['shift']());}};_0x3d2ae5(++_0x4dec17);}(_0x2c68,0xde));var _0x82c6=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x2c68[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var util=require(_0x82c6('0x0'));var logger=require(_0x82c6('0x1'))('api');var moment=require(_0x82c6('0x2'));var shared=require(_0x82c6('0x3'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x4f0701,_0x302372,_0x5a8a71,_0x238f77){var _0x32578e=_0x238f77?_0x82c6('0x4'):'VoiceQueue';var _0x32da90=_0x5a8a71[_0x82c6('0x5')]?_0x5a8a71[_0x82c6('0x5')]:moment()['format'](_0x82c6('0x6'));if(_[_0x82c6('0x7')](_0x5a8a71[_0x82c6('0x8')])){return Promise['resolve'](_0x32da90);}return _0x4f0701[_0x32578e][_0x82c6('0x9')]({'where':{'id':_0x302372}})[_0x82c6('0xa')](function(_0x42357a){if(_[_0x82c6('0x7')](_0x42357a)||_[_0x82c6('0x7')](_0x42357a[_0x82c6('0x8')])){return Promise[_0x82c6('0xb')](_0x32da90);}var _0x44bddb=shared[_0x82c6('0xc')];var _0x4a676b=_0x44bddb[_0x42357a[_0x82c6('0x8')]];var _0xbd29fc=_0x44bddb[_0x5a8a71[_0x82c6('0x8')]];if(_[_0x82c6('0x7')](_0x4a676b)&&_['isNil'](_0xbd29fc)){return Promise[_0x82c6('0xb')](_0x32da90);}var _0x435c76=_0x4a676b['utcOffset']-_0xbd29fc[_0x82c6('0xd')];var _0x425883=_0x5a8a71[_0x82c6('0x5')]?_0x5a8a71[_0x82c6('0x5')]:moment();_0x32da90=moment(_0x425883)[_0x82c6('0xe')](_0x435c76,_0x82c6('0xf'))['format'](_0x82c6('0x6'));return Promise[_0x82c6('0xb')](_0x32da90);});}function getNewHopperPayload(_0x3780f0){return{'phone':_0x3780f0[_0x82c6('0x10')],'ContactId':_0x3780f0['id'],'ListId':_0x3780f0[_0x82c6('0x11')],'scheduledat':_0x3780f0[_0x82c6('0x5')]?_0x3780f0[_0x82c6('0x5')]:moment()[_0x82c6('0x12')](_0x82c6('0x6')),'priority':_0x3780f0['priority']?_0x3780f0[_0x82c6('0x13')]:0x2,'callback':_0x3780f0[_0x82c6('0x14')]?!![]:![],'callbackuniqueid':_0x3780f0[_0x82c6('0x14')]?_0x3780f0['callbackUniqueid']:undefined,'callbackat':_0x3780f0['callbackUniqueid']?moment()[_0x82c6('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x5ac66e,_0x5c0cf7,_0x405455,_0x35f0d9){var _0x30a1fc={'phone':_0x405455[_0x82c6('0x10')]};var _0x48991={'calleridnum':_0x405455[_0x82c6('0x10')]};if(_0x35f0d9){Object[_0x82c6('0x15')](_0x30a1fc,{'CampaignId':_0x5c0cf7['id']});Object['assign'](_0x48991,{'CampaignId':_0x5c0cf7['id']});}else{Object['assign'](_0x30a1fc,{'VoiceQueueId':_0x5c0cf7['id']});Object[_0x82c6('0x15')](_0x48991,{'VoiceQueueId':_0x5c0cf7['id']});}return _0x5ac66e['CmHopper'][_0x82c6('0x9')]({'where':_0x30a1fc})['then'](function(_0x2991a5){if(_0x2991a5){throw new Error(_0x82c6('0x16')+_0x405455[_0x82c6('0x10')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x5c0cf7['id']);}return _0x5ac66e[_0x82c6('0x17')][_0x82c6('0x9')]({'where':_0x48991});})[_0x82c6('0xa')](function(_0x5c5d29){if(_0x5c5d29){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x405455[_0x82c6('0x10')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x5c0cf7['id']);}var _0x18c3b4=getNewHopperPayload(_0x405455);if(_0x35f0d9){_0x18c3b4['CampaignId']=_0x5c0cf7['id'];}else{_0x18c3b4[_0x82c6('0x18')]=_0x5c0cf7['id'];}return _0x5ac66e['CmHopper'][_0x82c6('0x19')](_0x18c3b4);});}function handleOnlyIfOpenCheckDuplicate(_0x3c2905,_0x3932c7,_0x52f44e,_0x3260d4){var _0xd63d86={'phone':_0x52f44e[_0x82c6('0x10')]};if(_0x3260d4){Object['assign'](_0xd63d86,{'CampaignId':_0x3932c7['id']});}else{Object[_0x82c6('0x15')](_0xd63d86,{'VoiceQueueId':_0x3932c7['id']});}return _0x3c2905[_0x82c6('0x1a')][_0x82c6('0x9')]({'where':_0xd63d86})['then'](function(_0x4bdc21){if(_0x4bdc21){throw new Error(_0x82c6('0x1b')+_0x52f44e[_0x82c6('0x10')]+_0x82c6('0x1c')+_0x3932c7['id']);}var _0x3c6127=getNewHopperPayload(_0x52f44e);if(_0x3260d4){_0x3c6127[_0x82c6('0x1d')]=_0x3932c7['id'];}else{_0x3c6127['VoiceQueueId']=_0x3932c7['id'];}return _0x3c2905[_0x82c6('0x1a')][_0x82c6('0x19')](_0x3c6127);});}function handleNeverCheckDuplicate(_0x3ae98b,_0x11b0de,_0x54366f){var _0x32b66d=getNewHopperPayload(_0x54366f);_0x32b66d[_0x82c6('0x18')]=_0x11b0de['id'];return _0x3ae98b[_0x82c6('0x1a')][_0x82c6('0x19')](_0x32b66d);}function handleCheckDuplicate(_0x4ab5d5,_0x13d26d,_0x42fff1,_0x52e564){return getTimezoneCallbackAt(_0x4ab5d5,_0x13d26d,_0x42fff1,_0x52e564)[_0x82c6('0xa')](function(_0xad818e){_0x42fff1[_0x82c6('0x5')]=_0xad818e;switch(_0x13d26d[_0x82c6('0x1e')]){case'always':return handleAlwaysCheckDuplicate(_0x4ab5d5,_0x13d26d,_0x42fff1,_0x52e564);case _0x82c6('0x1f'):return handleOnlyIfOpenCheckDuplicate(_0x4ab5d5,_0x13d26d,_0x42fff1,_0x52e564);default:return handleNeverCheckDuplicate(_0x4ab5d5,_0x13d26d,_0x42fff1);}});}function createHopperForVoiceQueues(_0x34e748,_0x2dea97){return _0x34e748['VoiceQueue'][_0x82c6('0x20')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0x82c6('0x8')],'include':[{'model':_0x34e748['CmList'],'as':_0x82c6('0x21'),'where':{'id':_0x2dea97[_0x82c6('0x11')]}}],'raw':!![]})[_0x82c6('0xa')](function(_0x1ca704){var _0x14d9e3=_0x1ca704['map'](function(_0x4defea){return handleCheckDuplicate(_0x34e748,_0x4defea,_0x2dea97,![]);});return Promise['all'](_0x14d9e3);});}function createHopperForCampaigns(_0x18b70f,_0x5d0c74){return _0x18b70f[_0x82c6('0x4')][_0x82c6('0x20')]({'attributes':['id','dialCheckDuplicateType',_0x82c6('0x8')],'include':[{'model':_0x18b70f['CmList'],'as':'Lists','where':{'id':_0x5d0c74['ListId']}}],'raw':!![]})[_0x82c6('0xa')](function(_0x2b3ca5){var _0x3205a3=_0x2b3ca5[_0x82c6('0x22')](function(_0x2f5b83){return handleCheckDuplicate(_0x18b70f,_0x2f5b83,_0x5d0c74,!![]);});return Promise['all'](_0x3205a3);});}function createHopperBlackForVoiceQueues(_0xf93549,_0x1cfd10){return _0xf93549[_0x82c6('0x23')][_0x82c6('0x20')]({'where':{'type':_0x82c6('0x24')},'attributes':['id'],'include':[{'model':_0xf93549[_0x82c6('0x25')],'as':_0x82c6('0x26'),'where':{'id':_0x1cfd10['ListId']}}],'raw':!![]})['then'](function(_0x4a1600){var _0x41ad3f=_0x4a1600[_0x82c6('0x22')](function(_0x11f1d3){return _0xf93549[_0x82c6('0x27')]['create']({'phone':_0x1cfd10[_0x82c6('0x10')],'ContactId':_0x1cfd10['id'],'ListId':_0x1cfd10['ListId'],'VoiceQueueId':_0x11f1d3['id']});});return Promise[_0x82c6('0x28')](_0x41ad3f);});}function createHopperBlackForCampaigns(_0x1aeb37,_0x16358){return _0x1aeb37['Campaign'][_0x82c6('0x20')]({'attributes':['id'],'include':[{'model':_0x1aeb37[_0x82c6('0x25')],'as':_0x82c6('0x26'),'where':{'id':_0x16358[_0x82c6('0x11')]}}],'raw':!![]})[_0x82c6('0xa')](function(_0x47672c){var _0x5f27a2=_0x47672c['map'](function(_0x1c2af2){return _0x1aeb37[_0x82c6('0x27')][_0x82c6('0x19')]({'phone':_0x16358[_0x82c6('0x10')],'ContactId':_0x16358['id'],'ListId':_0x16358[_0x82c6('0x11')],'CampaignId':_0x1c2af2['id']});});return Promise['all'](_0x5f27a2);});}module[_0x82c6('0x29')]=function(_0x352247){return _0x352247[_0x82c6('0x2a')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x82c6('0x10'),'fields':['phone']},{'name':'fti_cm_contacts','fields':[_0x82c6('0x2b'),'lastName',_0x82c6('0x10'),_0x82c6('0x2c'),_0x82c6('0x2d'),'email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x82c6('0x2e'),'collate':_0x82c6('0x2f'),'hooks':{'afterCreate':function(_0x3967ac,_0x21cfe3,_0x37a702){var _0x7839a8=_0x352247[_0x82c6('0x30')];var _0x47747c=_0x3967ac[_0x82c6('0x31')]({'plain':!![]});if(!_0x47747c['ListId']){logger[_0x82c6('0x32')](_0x82c6('0x33')+_0x47747c['id']);return _0x37a702();}if(!_0x47747c[_0x82c6('0x10')]){return _0x37a702();}return createHopperForVoiceQueues(_0x7839a8,_0x47747c)[_0x82c6('0xa')](function(){return createHopperBlackForVoiceQueues(_0x7839a8,_0x47747c);})['then'](function(){return createHopperForCampaigns(_0x7839a8,_0x47747c);})[_0x82c6('0xa')](function(){return createHopperBlackForCampaigns(_0x7839a8,_0x47747c);})[_0x82c6('0xa')](function(){return _0x37a702();})[_0x82c6('0x34')](function(_0x4bcd9e){logger[_0x82c6('0x32')](_0x82c6('0x35'),_0x4bcd9e['message']);_0x37a702();});},'afterDestroy':function(_0x232648,_0x5ca8db,_0x39197a){var _0xa25e70=_0x352247['models'];var _0x16cb5b=_0x232648[_0x82c6('0x31')]({'plain':!![]});return _0xa25e70[_0x82c6('0x1a')][_0x82c6('0x20')]({'raw':!![],'where':{'ListId':_0x16cb5b['ListId'],'ContactId':_0x16cb5b['id']}})[_0x82c6('0xa')](function(_0x4bff34){if(!_[_0x82c6('0x36')](_0x4bff34)){var _0x20db63=[];for(var _0x18e0ee=0x0;_0x18e0ee<_0x4bff34['length'];_0x18e0ee+=0x1){var _0x3eec7e=_0xa25e70[_0x82c6('0x1a')][_0x82c6('0x37')]({'where':{'ListId':_0x4bff34[_0x18e0ee][_0x82c6('0x11')],'ContactId':_0x4bff34[_0x18e0ee][_0x82c6('0x38')],'VoiceQueueId':_0x4bff34[_0x18e0ee][_0x82c6('0x18')],'CampaignId':_0x4bff34[_0x18e0ee][_0x82c6('0x1d')]}});_0x20db63[_0x82c6('0x39')](_0x3eec7e);}return Promise['all'](_0x20db63);}})[_0x82c6('0xa')](function(_0x1074cc){logger[_0x82c6('0x3a')](_0x82c6('0x3b'),util['inspect'](_0x1074cc,{'showHidden':![],'depth':null}));_0x39197a();})[_0x82c6('0x34')](function(_0x5eaaae){logger['error'](_0x82c6('0x3c'),util[_0x82c6('0x3d')](_0x5eaaae,{'showHidden':![],'depth':null}));_0x39197a(_0x5eaaae);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index a2c82a7..e705b6e 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(_0x5db5db,_0x4a5e2b){var _0x54f26a=function(_0x34297a){while(--_0x34297a){_0x5db5db['push'](_0x5db5db['shift']());}};_0x54f26a(++_0x4a5e2b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0x14ca85,_0x67df64){var _0x12b075=function(_0x24a80d){while(--_0x24a80d){_0x14ca85['push'](_0x14ca85['shift']());}};_0x12b075(++_0x67df64);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('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 9143cd6..e0cc46c 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 _0xde64=['sequelize','exports','INTEGER','STRING'];(function(_0x3b9161,_0x2849b6){var _0x28efdf=function(_0x3bf76b){while(--_0x3bf76b){_0x3b9161['push'](_0x3b9161['shift']());}};_0x28efdf(++_0x2849b6);}(_0xde64,0x17c));var _0x4de6=function(_0x1d1cea,_0x17e776){_0x1d1cea=_0x1d1cea-0x0;var _0x5c4ba7=_0xde64[_0x1d1cea];return _0x5c4ba7;};'use strict';var Sequelize=require(_0x4de6('0x0'));module[_0x4de6('0x1')]={'CmContactId':{'type':Sequelize[_0x4de6('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x4de6('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4de6('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4de6('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x4de6('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x4de6('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x32c0=['exports','STRING','INTEGER','PHONE','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x32c0,0x1f3));var _0x032c=function(_0x3a82d0,_0x170c63){_0x3a82d0=_0x3a82d0-0x0;var _0x1e4b49=_0x32c0[_0x3a82d0];return _0x1e4b49;};'use strict';var Sequelize=require(_0x032c('0x0'));module[_0x032c('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x032c('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x032c('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x032c('0x4')},'OrderBy':{'type':Sequelize[_0x032c('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x032c('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index ec87d7c..8d8a110 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 _0x6603=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','CmContactHasItem','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','CmContactHasItems','error','name','index','fieldName','type','model','map','query','keys','filters','attributes'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x6603,0x15e));var _0x3660=function(_0x154f4a,_0x3384b2){_0x154f4a=_0x154f4a-0x0;var _0x116de7=_0x6603[_0x154f4a];return _0x116de7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3660('0x0'));var zipdir=require(_0x3660('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3660('0x2'));var Mustache=require(_0x3660('0x3'));var util=require('util');var path=require(_0x3660('0x4'));var sox=require('sox');var csv=require(_0x3660('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3660('0x6'));var _=require('lodash');var squel=require(_0x3660('0x7'));var crypto=require(_0x3660('0x8'));var jsforce=require(_0x3660('0x9'));var deskjs=require(_0x3660('0xa'));var toCsv=require(_0x3660('0x5'));var querystring=require(_0x3660('0xb'));var Papa=require(_0x3660('0xc'));var Redis=require(_0x3660('0xd'));var authService=require(_0x3660('0xe'));var qs=require(_0x3660('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3660('0x10'));var logger=require('../../config/logger')(_0x3660('0x11'));var utils=require(_0x3660('0x12'));var config=require(_0x3660('0x13'));var licenseUtil=require(_0x3660('0x14'));var db=require(_0x3660('0x15'))['db'];function respondWithStatusCode(_0x15bef5,_0x3a9514){_0x3a9514=_0x3a9514||0xcc;return function(_0x2ad5d1){if(_0x2ad5d1){return _0x15bef5[_0x3660('0x16')](_0x3a9514);}return _0x15bef5['status'](_0x3a9514)[_0x3660('0x17')]();};}function respondWithResult(_0x5f456d,_0x3b0121){_0x3b0121=_0x3b0121||0xc8;return function(_0x177758){if(_0x177758){return _0x5f456d[_0x3660('0x18')](_0x3b0121)[_0x3660('0x19')](_0x177758);}};}function respondWithFilteredResult(_0x33272e,_0x43418f){return function(_0x395410){if(_0x395410){var _0x2737b0=typeof _0x43418f[_0x3660('0x1a')]===_0x3660('0x1b')&&typeof _0x43418f[_0x3660('0x1c')]===_0x3660('0x1b');var _0x5cd0a6=_0x395410[_0x3660('0x1d')];var _0x3d2a01=_0x2737b0?0x0:_0x43418f[_0x3660('0x1a')];var _0x2350ce=_0x2737b0?_0x395410[_0x3660('0x1d')]:_0x43418f[_0x3660('0x1a')]+_0x43418f[_0x3660('0x1c')];var _0x2ddd94;if(_0x2350ce>=_0x5cd0a6){_0x2350ce=_0x5cd0a6;_0x2ddd94=0xc8;}else{_0x2ddd94=0xce;}_0x33272e[_0x3660('0x18')](_0x2ddd94);return _0x33272e[_0x3660('0x1e')](_0x3660('0x1f'),_0x3d2a01+'-'+_0x2350ce+'/'+_0x5cd0a6)[_0x3660('0x19')](_0x395410);}return null;};}function patchUpdates(_0x57b2df){return function(_0x4e8c18){try{jsonpatch[_0x3660('0x20')](_0x4e8c18,_0x57b2df,!![]);}catch(_0x5019b2){return BPromise[_0x3660('0x21')](_0x5019b2);}return _0x4e8c18['save']();};}function saveUpdates(_0x5b7604,_0x3a82cd){return function(_0x4e1586){if(_0x4e1586){return _0x4e1586[_0x3660('0x22')](_0x5b7604)['then'](function(_0x5eace8){return _0x5eace8;});}return null;};}function removeEntity(_0x5002af,_0x3b2688){return function(_0x4ad2dd){if(_0x4ad2dd){return _0x4ad2dd[_0x3660('0x23')]()[_0x3660('0x24')](function(){var _0x551ecf=_0x4ad2dd[_0x3660('0x25')]({'plain':!![]});var _0x58a170=_0x3660('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x58a170,'resourceId':_0x551ecf['id']}})[_0x3660('0x24')](function(){return _0x4ad2dd;});})[_0x3660('0x24')](function(){_0x5002af[_0x3660('0x18')](0xcc)[_0x3660('0x17')]();});}};}function handleEntityNotFound(_0x28d43e,_0x36a8b8){return function(_0x1c3339){if(!_0x1c3339){_0x28d43e[_0x3660('0x16')](0x194);}return _0x1c3339;};}function handleError(_0x3c2a04,_0x2fca6d){_0x2fca6d=_0x2fca6d||0x1f4;return function(_0x3257f7){logger[_0x3660('0x27')](_0x3257f7['stack']);if(_0x3257f7[_0x3660('0x28')]){delete _0x3257f7['name'];}_0x3c2a04[_0x3660('0x18')](_0x2fca6d)['send'](_0x3257f7);};}exports[_0x3660('0x29')]=function(_0x33eff2,_0x120d8b){var _0x57e79a={},_0x5ef155={},_0x80afe5={'count':0x0,'rows':[]};var _0x4bdc68=_['map'](db['CmContactHasItem']['rawAttributes'],function(_0x6bad0a){return{'name':_0x6bad0a[_0x3660('0x2a')],'type':_0x6bad0a[_0x3660('0x2b')]['key']};});_0x5ef155[_0x3660('0x2c')]=_[_0x3660('0x2d')](_0x4bdc68,'name');_0x5ef155[_0x3660('0x2e')]=_[_0x3660('0x2f')](_0x33eff2[_0x3660('0x2e')]);_0x5ef155[_0x3660('0x30')]=_['intersection'](_0x5ef155[_0x3660('0x2c')],_0x5ef155[_0x3660('0x2e')]);_0x57e79a[_0x3660('0x31')]=_[_0x3660('0x32')](_0x5ef155[_0x3660('0x2c')],qs[_0x3660('0x33')](_0x33eff2['query'][_0x3660('0x33')]));_0x57e79a['attributes']=_0x57e79a[_0x3660('0x31')][_0x3660('0x34')]?_0x57e79a[_0x3660('0x31')]:_0x5ef155[_0x3660('0x2c')];if(!_0x33eff2['query'][_0x3660('0x35')](_0x3660('0x36'))){_0x57e79a[_0x3660('0x1c')]=qs['limit'](_0x33eff2[_0x3660('0x2e')]['limit']);_0x57e79a[_0x3660('0x1a')]=qs[_0x3660('0x1a')](_0x33eff2[_0x3660('0x2e')][_0x3660('0x1a')]);}_0x57e79a[_0x3660('0x37')]=qs['sort'](_0x33eff2[_0x3660('0x2e')][_0x3660('0x38')]);_0x57e79a[_0x3660('0x39')]=qs[_0x3660('0x30')](_['pick'](_0x33eff2[_0x3660('0x2e')],_0x5ef155[_0x3660('0x30')]),_0x4bdc68);if(_0x33eff2[_0x3660('0x2e')][_0x3660('0x3a')]){_0x57e79a[_0x3660('0x39')]=_[_0x3660('0x3b')](_0x57e79a[_0x3660('0x39')],{'$or':_[_0x3660('0x2d')](_0x4bdc68,function(_0x5ce53a){if(_0x5ce53a[_0x3660('0x2b')]!=='VIRTUAL'){var _0x26fe7b={};_0x26fe7b[_0x5ce53a['name']]={'$like':'%'+_0x33eff2[_0x3660('0x2e')][_0x3660('0x3a')]+'%'};return _0x26fe7b;}})});}_0x57e79a=_[_0x3660('0x3b')]({},_0x57e79a,_0x33eff2[_0x3660('0x3c')]);var _0x36aff1={'where':_0x57e79a[_0x3660('0x39')]};return db['CmContactHasItem'][_0x3660('0x1d')](_0x36aff1)['then'](function(_0x38938d){_0x80afe5[_0x3660('0x1d')]=_0x38938d;if(_0x33eff2[_0x3660('0x2e')]['includeAll']){_0x57e79a[_0x3660('0x3d')]=[{'all':!![]}];}return db[_0x3660('0x3e')][_0x3660('0x3f')](_0x57e79a);})['then'](function(_0x553a2f){_0x80afe5[_0x3660('0x40')]=_0x553a2f;return _0x80afe5;})[_0x3660('0x24')](respondWithFilteredResult(_0x120d8b,_0x57e79a))['catch'](handleError(_0x120d8b,null));};exports[_0x3660('0x41')]=function(_0x377754,_0x6570ed){var _0x49f717={'raw':!![],'where':{'id':_0x377754[_0x3660('0x42')]['id']}},_0x156995={};_0x156995[_0x3660('0x2c')]=_[_0x3660('0x2f')](db[_0x3660('0x3e')][_0x3660('0x43')]);_0x156995[_0x3660('0x2e')]=_['keys'](_0x377754[_0x3660('0x2e')]);_0x156995[_0x3660('0x30')]=_[_0x3660('0x32')](_0x156995[_0x3660('0x2c')],_0x156995[_0x3660('0x2e')]);_0x49f717[_0x3660('0x31')]=_[_0x3660('0x32')](_0x156995[_0x3660('0x2c')],qs[_0x3660('0x33')](_0x377754[_0x3660('0x2e')][_0x3660('0x33')]));_0x49f717[_0x3660('0x31')]=_0x49f717[_0x3660('0x31')]['length']?_0x49f717[_0x3660('0x31')]:_0x156995['model'];if(_0x377754['query'][_0x3660('0x44')]){_0x49f717[_0x3660('0x3d')]=[{'all':!![]}];}_0x49f717=_[_0x3660('0x3b')]({},_0x49f717,_0x377754[_0x3660('0x3c')]);return db[_0x3660('0x3e')][_0x3660('0x45')](_0x49f717)[_0x3660('0x24')](handleEntityNotFound(_0x6570ed,null))[_0x3660('0x24')](respondWithResult(_0x6570ed,null))[_0x3660('0x46')](handleError(_0x6570ed,null));};exports['create']=function(_0x555b9f,_0x5506d5){return db['CmContactHasItem'][_0x3660('0x47')](_0x555b9f['body'],{})['then'](function(_0x350da0){var _0x32e430=_0x555b9f[_0x3660('0x48')][_0x3660('0x25')]({'plain':!![]});if(!_0x32e430)throw new Error(_0x3660('0x49'));if(_0x32e430['role']===_0x3660('0x48')){var _0x2cbb74=_0x350da0[_0x3660('0x25')]({'plain':!![]});var _0x119e76=_0x3660('0x26');return db[_0x3660('0x4a')][_0x3660('0x45')]({'where':{'name':_0x119e76,'userProfileId':_0x32e430[_0x3660('0x4b')]},'raw':!![]})[_0x3660('0x24')](function(_0xdc9edd){if(_0xdc9edd&&_0xdc9edd[_0x3660('0x4c')]===0x0){return db[_0x3660('0x4d')][_0x3660('0x47')]({'name':_0x2cbb74[_0x3660('0x28')],'resourceId':_0x2cbb74['id'],'type':_0xdc9edd['name'],'sectionId':_0xdc9edd['id']},{})[_0x3660('0x24')](function(){return _0x350da0;});}else{return _0x350da0;}})[_0x3660('0x46')](function(_0x3c8f51){logger['error'](_0x3660('0x4e'),_0x3c8f51);throw _0x3c8f51;});}return _0x350da0;})[_0x3660('0x24')](respondWithResult(_0x5506d5,0xc9))['catch'](handleError(_0x5506d5,null));};exports[_0x3660('0x22')]=function(_0x573c0b,_0x54baa1){if(_0x573c0b[_0x3660('0x4f')]['id']){delete _0x573c0b[_0x3660('0x4f')]['id'];}return db[_0x3660('0x3e')][_0x3660('0x45')]({'where':{'id':_0x573c0b[_0x3660('0x42')]['id']}})[_0x3660('0x24')](handleEntityNotFound(_0x54baa1,null))['then'](saveUpdates(_0x573c0b['body'],null))[_0x3660('0x24')](respondWithResult(_0x54baa1,null))[_0x3660('0x46')](handleError(_0x54baa1,null));};exports[_0x3660('0x23')]=function(_0x3fd281,_0x3b1cff){return db[_0x3660('0x3e')][_0x3660('0x45')]({'where':{'id':_0x3fd281['params']['id']}})[_0x3660('0x24')](handleEntityNotFound(_0x3b1cff,null))[_0x3660('0x24')](removeEntity(_0x3b1cff,null))[_0x3660('0x46')](handleError(_0x3b1cff,null));}; \ No newline at end of file +var _0x7530=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','end','error','stack','name','send','map','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','CmContactHasItem','includeAll','findAll','rows','params','rawAttributes','intersection','include','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','rimraf'];(function(_0x2b870f,_0x2801de){var _0xdf5760=function(_0x480f9c){while(--_0x480f9c){_0x2b870f['push'](_0x2b870f['shift']());}};_0xdf5760(++_0x2801de);}(_0x7530,0x1de));var _0x0753=function(_0x5349ee,_0x3e8ed9){_0x5349ee=_0x5349ee-0x0;var _0x26dd71=_0x7530[_0x5349ee];return _0x26dd71;};'use strict';var emlformat=require(_0x0753('0x0'));var rimraf=require(_0x0753('0x1'));var zipdir=require(_0x0753('0x2'));var jsonpatch=require(_0x0753('0x3'));var rp=require(_0x0753('0x4'));var moment=require(_0x0753('0x5'));var BPromise=require(_0x0753('0x6'));var Mustache=require(_0x0753('0x7'));var util=require(_0x0753('0x8'));var path=require('path');var sox=require(_0x0753('0x9'));var csv=require(_0x0753('0xa'));var ejs=require(_0x0753('0xb'));var fs=require('fs');var fs_extra=require(_0x0753('0xc'));var _=require(_0x0753('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0753('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0753('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0753('0x10'));var hardwareService=require(_0x0753('0x11'));var logger=require(_0x0753('0x12'))('api');var utils=require(_0x0753('0x13'));var config=require(_0x0753('0x14'));var licenseUtil=require(_0x0753('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29fdfa,_0x5ad1cd){_0x5ad1cd=_0x5ad1cd||0xcc;return function(_0x5dff89){if(_0x5dff89){return _0x29fdfa[_0x0753('0x16')](_0x5ad1cd);}return _0x29fdfa[_0x0753('0x17')](_0x5ad1cd)['end']();};}function respondWithResult(_0x4e76fd,_0x55360a){_0x55360a=_0x55360a||0xc8;return function(_0x4fd603){if(_0x4fd603){return _0x4e76fd['status'](_0x55360a)[_0x0753('0x18')](_0x4fd603);}};}function respondWithFilteredResult(_0x3c8f2c,_0x36c637){return function(_0x1288b3){if(_0x1288b3){var _0x445082=typeof _0x36c637[_0x0753('0x19')]===_0x0753('0x1a')&&typeof _0x36c637['limit']==='undefined';var _0x1cedef=_0x1288b3[_0x0753('0x1b')];var _0x1f4cf7=_0x445082?0x0:_0x36c637[_0x0753('0x19')];var _0x550162=_0x445082?_0x1288b3['count']:_0x36c637[_0x0753('0x19')]+_0x36c637['limit'];var _0x4a8f1d;if(_0x550162>=_0x1cedef){_0x550162=_0x1cedef;_0x4a8f1d=0xc8;}else{_0x4a8f1d=0xce;}_0x3c8f2c[_0x0753('0x17')](_0x4a8f1d);return _0x3c8f2c[_0x0753('0x1c')](_0x0753('0x1d'),_0x1f4cf7+'-'+_0x550162+'/'+_0x1cedef)[_0x0753('0x18')](_0x1288b3);}return null;};}function patchUpdates(_0x3fbee7){return function(_0x1fc209){try{jsonpatch[_0x0753('0x1e')](_0x1fc209,_0x3fbee7,!![]);}catch(_0x5a9082){return BPromise[_0x0753('0x1f')](_0x5a9082);}return _0x1fc209[_0x0753('0x20')]();};}function saveUpdates(_0x2f14ce,_0x45af2a){return function(_0x3eb55a){if(_0x3eb55a){return _0x3eb55a['update'](_0x2f14ce)[_0x0753('0x21')](function(_0x25ef2a){return _0x25ef2a;});}return null;};}function removeEntity(_0x4a8375,_0x32f1ae){return function(_0x3898b1){if(_0x3898b1){return _0x3898b1[_0x0753('0x22')]()[_0x0753('0x21')](function(){var _0x4a1013=_0x3898b1[_0x0753('0x23')]({'plain':!![]});var _0x10d7f8=_0x0753('0x24');return db[_0x0753('0x25')][_0x0753('0x22')]({'where':{'type':_0x10d7f8,'resourceId':_0x4a1013['id']}})['then'](function(){return _0x3898b1;});})[_0x0753('0x21')](function(){_0x4a8375[_0x0753('0x17')](0xcc)[_0x0753('0x26')]();});}};}function handleEntityNotFound(_0xe32c45,_0x1e4324){return function(_0x11c130){if(!_0x11c130){_0xe32c45[_0x0753('0x16')](0x194);}return _0x11c130;};}function handleError(_0x53b5ca,_0x57c760){_0x57c760=_0x57c760||0x1f4;return function(_0x813b31){logger[_0x0753('0x27')](_0x813b31[_0x0753('0x28')]);if(_0x813b31[_0x0753('0x29')]){delete _0x813b31[_0x0753('0x29')];}_0x53b5ca[_0x0753('0x17')](_0x57c760)[_0x0753('0x2a')](_0x813b31);};}exports['index']=function(_0x46be02,_0x360b64){var _0x238631={},_0x3e0f1d={},_0x113308={'count':0x0,'rows':[]};var _0x3d5791=_[_0x0753('0x2b')](db['CmContactHasItem']['rawAttributes'],function(_0xadca06){return{'name':_0xadca06['fieldName'],'type':_0xadca06['type'][_0x0753('0x2c')]};});_0x3e0f1d[_0x0753('0x2d')]=_[_0x0753('0x2b')](_0x3d5791,_0x0753('0x29'));_0x3e0f1d['query']=_[_0x0753('0x2e')](_0x46be02[_0x0753('0x2f')]);_0x3e0f1d[_0x0753('0x30')]=_['intersection'](_0x3e0f1d['model'],_0x3e0f1d[_0x0753('0x2f')]);_0x238631['attributes']=_['intersection'](_0x3e0f1d[_0x0753('0x2d')],qs[_0x0753('0x31')](_0x46be02['query'][_0x0753('0x31')]));_0x238631[_0x0753('0x32')]=_0x238631['attributes'][_0x0753('0x33')]?_0x238631[_0x0753('0x32')]:_0x3e0f1d[_0x0753('0x2d')];if(!_0x46be02[_0x0753('0x2f')][_0x0753('0x34')](_0x0753('0x35'))){_0x238631['limit']=qs[_0x0753('0x36')](_0x46be02['query'][_0x0753('0x36')]);_0x238631[_0x0753('0x19')]=qs[_0x0753('0x19')](_0x46be02[_0x0753('0x2f')][_0x0753('0x19')]);}_0x238631['order']=qs['sort'](_0x46be02[_0x0753('0x2f')][_0x0753('0x37')]);_0x238631[_0x0753('0x38')]=qs['filters'](_[_0x0753('0x39')](_0x46be02[_0x0753('0x2f')],_0x3e0f1d[_0x0753('0x30')]),_0x3d5791);if(_0x46be02[_0x0753('0x2f')][_0x0753('0x3a')]){_0x238631[_0x0753('0x38')]=_[_0x0753('0x3b')](_0x238631[_0x0753('0x38')],{'$or':_[_0x0753('0x2b')](_0x3d5791,function(_0x233d38){if(_0x233d38[_0x0753('0x3c')]!==_0x0753('0x3d')){var _0x2dfd0a={};_0x2dfd0a[_0x233d38[_0x0753('0x29')]]={'$like':'%'+_0x46be02[_0x0753('0x2f')][_0x0753('0x3a')]+'%'};return _0x2dfd0a;}})});}_0x238631=_['merge']({},_0x238631,_0x46be02[_0x0753('0x3e')]);var _0x3ab6a4={'where':_0x238631['where']};return db[_0x0753('0x3f')][_0x0753('0x1b')](_0x3ab6a4)[_0x0753('0x21')](function(_0x53dddd){_0x113308['count']=_0x53dddd;if(_0x46be02[_0x0753('0x2f')][_0x0753('0x40')]){_0x238631['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x0753('0x41')](_0x238631);})[_0x0753('0x21')](function(_0x498091){_0x113308[_0x0753('0x42')]=_0x498091;return _0x113308;})['then'](respondWithFilteredResult(_0x360b64,_0x238631))['catch'](handleError(_0x360b64,null));};exports['show']=function(_0xdebce2,_0x508e0d){var _0x4ac9b5={'raw':!![],'where':{'id':_0xdebce2[_0x0753('0x43')]['id']}},_0x15ffd8={};_0x15ffd8[_0x0753('0x2d')]=_[_0x0753('0x2e')](db['CmContactHasItem'][_0x0753('0x44')]);_0x15ffd8[_0x0753('0x2f')]=_[_0x0753('0x2e')](_0xdebce2[_0x0753('0x2f')]);_0x15ffd8['filters']=_['intersection'](_0x15ffd8[_0x0753('0x2d')],_0x15ffd8[_0x0753('0x2f')]);_0x4ac9b5['attributes']=_[_0x0753('0x45')](_0x15ffd8['model'],qs[_0x0753('0x31')](_0xdebce2[_0x0753('0x2f')][_0x0753('0x31')]));_0x4ac9b5[_0x0753('0x32')]=_0x4ac9b5[_0x0753('0x32')]['length']?_0x4ac9b5['attributes']:_0x15ffd8['model'];if(_0xdebce2[_0x0753('0x2f')][_0x0753('0x40')]){_0x4ac9b5[_0x0753('0x46')]=[{'all':!![]}];}_0x4ac9b5=_[_0x0753('0x3b')]({},_0x4ac9b5,_0xdebce2['options']);return db['CmContactHasItem'][_0x0753('0x47')](_0x4ac9b5)[_0x0753('0x21')](handleEntityNotFound(_0x508e0d,null))['then'](respondWithResult(_0x508e0d,null))['catch'](handleError(_0x508e0d,null));};exports[_0x0753('0x48')]=function(_0x1cd239,_0x4e6e4f){return db['CmContactHasItem']['create'](_0x1cd239[_0x0753('0x49')],{})['then'](function(_0x57f918){var _0x3d920f=_0x1cd239[_0x0753('0x4a')][_0x0753('0x23')]({'plain':!![]});if(!_0x3d920f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d920f[_0x0753('0x4b')]===_0x0753('0x4a')){var _0x289cb6=_0x57f918[_0x0753('0x23')]({'plain':!![]});var _0x2b6c83=_0x0753('0x24');return db[_0x0753('0x4c')][_0x0753('0x47')]({'where':{'name':_0x2b6c83,'userProfileId':_0x3d920f['userProfileId']},'raw':!![]})[_0x0753('0x21')](function(_0x4bb653){if(_0x4bb653&&_0x4bb653[_0x0753('0x4d')]===0x0){return db['UserProfileResource'][_0x0753('0x48')]({'name':_0x289cb6[_0x0753('0x29')],'resourceId':_0x289cb6['id'],'type':_0x4bb653[_0x0753('0x29')],'sectionId':_0x4bb653['id']},{})[_0x0753('0x21')](function(){return _0x57f918;});}else{return _0x57f918;}})['catch'](function(_0x3b91f9){logger['error'](_0x0753('0x4e'),_0x3b91f9);throw _0x3b91f9;});}return _0x57f918;})['then'](respondWithResult(_0x4e6e4f,0xc9))[_0x0753('0x4f')](handleError(_0x4e6e4f,null));};exports['update']=function(_0x9ca1ce,_0x11210d){if(_0x9ca1ce['body']['id']){delete _0x9ca1ce[_0x0753('0x49')]['id'];}return db[_0x0753('0x3f')][_0x0753('0x47')]({'where':{'id':_0x9ca1ce[_0x0753('0x43')]['id']}})[_0x0753('0x21')](handleEntityNotFound(_0x11210d,null))['then'](saveUpdates(_0x9ca1ce['body'],null))['then'](respondWithResult(_0x11210d,null))[_0x0753('0x4f')](handleError(_0x11210d,null));};exports['destroy']=function(_0x1c2adf,_0x431727){return db[_0x0753('0x3f')]['find']({'where':{'id':_0x1c2adf[_0x0753('0x43')]['id']}})[_0x0753('0x21')](handleEntityNotFound(_0x431727,null))['then'](removeEntity(_0x431727,null))[_0x0753('0x4f')](handleError(_0x431727,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 4211cd3..6b72f3d 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 _0x881a=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items'];(function(_0x3d77b8,_0x20b137){var _0x2c756b=function(_0x20c0ce){while(--_0x20c0ce){_0x3d77b8['push'](_0x3d77b8['shift']());}};_0x2c756b(++_0x20b137);}(_0x881a,0x1e0));var _0xa881=function(_0x5e87a3,_0x58c1d1){_0x5e87a3=_0x5e87a3-0x0;var _0x69c6ab=_0x881a[_0x5e87a3];return _0x69c6ab;};'use strict';var _=require(_0xa881('0x0'));var util=require(_0xa881('0x1'));var logger=require(_0xa881('0x2'))(_0xa881('0x3'));var moment=require('moment');var BPromise=require(_0xa881('0x4'));var rp=require(_0xa881('0x5'));var fs=require('fs');var path=require(_0xa881('0x6'));var rimraf=require('rimraf');var config=require(_0xa881('0x7'));var attributes=require(_0xa881('0x8'));module[_0xa881('0x9')]=function(_0x4ec258,_0x440877){return _0x4ec258['define'](_0xa881('0xa'),attributes,{'tableName':_0xa881('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x691a=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','CmContactHasItem','cm_contact_has_items','lodash','util'];(function(_0x324661,_0x3fb798){var _0x135bed=function(_0x15aed6){while(--_0x15aed6){_0x324661['push'](_0x324661['shift']());}};_0x135bed(++_0x3fb798);}(_0x691a,0xfb));var _0xa691=function(_0x240f33,_0x440416){_0x240f33=_0x240f33-0x0;var _0x4ceb61=_0x691a[_0x240f33];return _0x4ceb61;};'use strict';var _=require(_0xa691('0x0'));var util=require(_0xa691('0x1'));var logger=require(_0xa691('0x2'))(_0xa691('0x3'));var moment=require(_0xa691('0x4'));var BPromise=require('bluebird');var rp=require(_0xa691('0x5'));var fs=require('fs');var path=require(_0xa691('0x6'));var rimraf=require('rimraf');var config=require(_0xa691('0x7'));var attributes=require('./cmContactHasItem.attributes');module[_0xa691('0x8')]=function(_0x262caf,_0x1ead77){return _0x262caf['define'](_0xa691('0x9'),attributes,{'tableName':_0xa691('0xa'),'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 ef08d56..2f32c96 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 _0x011e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x011e,0x1a1));var _0xe011=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x011e[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xe011('0x0'));var util=require(_0xe011('0x1'));var moment=require(_0xe011('0x2'));var BPromise=require(_0xe011('0x3'));var rs=require(_0xe011('0x4'));var fs=require('fs');var Redis=require(_0xe011('0x5'));var db=require(_0xe011('0x6'))['db'];var utils=require(_0xe011('0x7'));var logger=require(_0xe011('0x8'))(_0xe011('0x9'));var config=require(_0xe011('0xa'));var jayson=require(_0xe011('0xb'));var client=jayson[_0xe011('0xc')][_0xe011('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c2f83,_0x3eee5e,_0x5a2205){return new BPromise(function(_0x2f5eb5,_0x36d7a7){return client['request'](_0x4c2f83,_0x5a2205)[_0xe011('0xe')](function(_0x14354a){logger[_0xe011('0xf')](_0xe011('0x10'),_0x3eee5e,_0xe011('0x11'));logger[_0xe011('0x12')](_0xe011('0x13'),_0x3eee5e,_0xe011('0x11'),JSON[_0xe011('0x14')](_0x14354a));if(_0x14354a['error']){if(_0x14354a[_0xe011('0x15')][_0xe011('0x16')]===0x1f4){logger['error'](_0xe011('0x10'),_0x3eee5e,_0x14354a[_0xe011('0x15')][_0xe011('0x17')]);return _0x36d7a7(_0x14354a[_0xe011('0x15')][_0xe011('0x17')]);}logger[_0xe011('0x15')](_0xe011('0x10'),_0x3eee5e,_0x14354a[_0xe011('0x15')][_0xe011('0x17')]);return _0x2f5eb5(_0x14354a[_0xe011('0x15')][_0xe011('0x17')]);}else{logger[_0xe011('0xf')](_0xe011('0x10'),_0x3eee5e,_0xe011('0x11'));_0x2f5eb5(_0x14354a['result'][_0xe011('0x17')]);}})[_0xe011('0x18')](function(_0x1f042a){logger[_0xe011('0x15')](_0xe011('0x10'),_0x3eee5e,_0x1f042a);_0x36d7a7(_0x1f042a);});});} \ No newline at end of file +var _0x37f8=['CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14bd57,_0x41b9a9){var _0x2b5f93=function(_0x47b962){while(--_0x47b962){_0x14bd57['push'](_0x14bd57['shift']());}};_0x2b5f93(++_0x41b9a9);}(_0x37f8,0xa7));var _0x837f=function(_0x407cf0,_0x4e766f){_0x407cf0=_0x407cf0-0x0;var _0x461479=_0x37f8[_0x407cf0];return _0x461479;};'use strict';var _=require(_0x837f('0x0'));var util=require(_0x837f('0x1'));var moment=require(_0x837f('0x2'));var BPromise=require(_0x837f('0x3'));var rs=require(_0x837f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x837f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x837f('0x6'))(_0x837f('0x7'));var config=require(_0x837f('0x8'));var jayson=require(_0x837f('0x9'));var client=jayson['client'][_0x837f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5823ee,_0x27d40d,_0x92cae9){return new BPromise(function(_0x1572b0,_0x32339f){return client[_0x837f('0xb')](_0x5823ee,_0x92cae9)[_0x837f('0xc')](function(_0x4ac0a7){logger[_0x837f('0xd')](_0x837f('0xe'),_0x27d40d,_0x837f('0xf'));logger[_0x837f('0x10')](_0x837f('0x11'),_0x27d40d,_0x837f('0xf'),JSON[_0x837f('0x12')](_0x4ac0a7));if(_0x4ac0a7[_0x837f('0x13')]){if(_0x4ac0a7['error']['code']===0x1f4){logger[_0x837f('0x13')](_0x837f('0xe'),_0x27d40d,_0x4ac0a7[_0x837f('0x13')]['message']);return _0x32339f(_0x4ac0a7[_0x837f('0x13')]['message']);}logger[_0x837f('0x13')](_0x837f('0xe'),_0x27d40d,_0x4ac0a7[_0x837f('0x13')][_0x837f('0x14')]);return _0x1572b0(_0x4ac0a7['error'][_0x837f('0x14')]);}else{logger[_0x837f('0xd')](_0x837f('0xe'),_0x27d40d,'request\x20sent');_0x1572b0(_0x4ac0a7[_0x837f('0x15')][_0x837f('0x14')]);}})[_0x837f('0x16')](function(_0x10c0a0){logger[_0x837f('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x27d40d,_0x10c0a0);_0x32339f(_0x10c0a0);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index dc85807..52405df 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 _0x51ab=['put','update','delete','exports','path','Router','fs-extra','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51ab,0x103));var _0xb51a=function(_0x4bb17e,_0x1be1a6){_0x4bb17e=_0x4bb17e-0x0;var _0x1f0355=_0x51ab[_0x4bb17e];return _0x1f0355;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb51a('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb51a('0x1')]();var fs_extra=require(_0xb51a('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb51a('0x3'));router[_0xb51a('0x4')]('/',auth['isAuthenticated'](),controller[_0xb51a('0x5')]);router[_0xb51a('0x4')](_0xb51a('0x6'),auth[_0xb51a('0x7')](),controller[_0xb51a('0x8')]);router[_0xb51a('0x9')]('/',auth['isAuthenticated'](),controller[_0xb51a('0xa')]);router[_0xb51a('0xb')]('/:id',auth[_0xb51a('0x7')](),controller[_0xb51a('0xc')]);router[_0xb51a('0xd')](_0xb51a('0x6'),auth[_0xb51a('0x7')](),controller['destroy']);module[_0xb51a('0xe')]=router; \ No newline at end of file +var _0xa167=['get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','./cmContactHasItem.controller'];(function(_0x2eb333,_0x511476){var _0x3a9ce2=function(_0x21eb15){while(--_0x21eb15){_0x2eb333['push'](_0x2eb333['shift']());}};_0x3a9ce2(++_0x511476);}(_0xa167,0x81));var _0x7a16=function(_0x1dfc79,_0x477bef){_0x1dfc79=_0x1dfc79-0x0;var _0xaa8c48=_0xa167[_0x1dfc79];return _0xaa8c48;};'use strict';var multer=require(_0x7a16('0x0'));var util=require(_0x7a16('0x1'));var path=require(_0x7a16('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a16('0x3'));var router=express[_0x7a16('0x4')]();var fs_extra=require(_0x7a16('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7a16('0x6'));router[_0x7a16('0x7')]('/',auth[_0x7a16('0x8')](),controller[_0x7a16('0x9')]);router[_0x7a16('0x7')](_0x7a16('0xa'),auth['isAuthenticated'](),controller[_0x7a16('0xb')]);router[_0x7a16('0xc')]('/',auth['isAuthenticated'](),controller[_0x7a16('0xd')]);router['put'](_0x7a16('0xa'),auth[_0x7a16('0x8')](),controller[_0x7a16('0xe')]);router['delete'](_0x7a16('0xa'),auth['isAuthenticated'](),controller[_0x7a16('0xf')]);module[_0x7a16('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 861f481..bec8f69 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 _0x9ada=['select','parse','values','isArray','stringify','BOOLEAN','voice','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','long'];(function(_0x468d86,_0x7b6415){var _0x29e64b=function(_0x19d923){while(--_0x19d923){_0x468d86['push'](_0x468d86['shift']());}};_0x29e64b(++_0x7b6415);}(_0x9ada,0x1ab));var _0xa9ad=function(_0x252388,_0x55ae3e){_0x252388=_0x252388-0x0;var _0x1fde97=_0x9ada[_0x252388];return _0x1fde97;};'use strict';var Sequelize=require(_0xa9ad('0x0'));var _=require('lodash');module[_0xa9ad('0x1')]={'name':{'type':Sequelize[_0xa9ad('0x2')],'get':function(_0x3e8d3f){return this[_0xa9ad('0x3')](_0xa9ad('0x4'));}},'alias':{'type':Sequelize[_0xa9ad('0x5')],'allowNull':![],'set':function(_0x552f8e){this[_0xa9ad('0x6')](_0xa9ad('0x4'),_0x552f8e?_0x552f8e:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xa9ad('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xa9ad('0x7')),'get':function(){if(this[_0xa9ad('0x3')]('type')===_0xa9ad('0x8')){return JSON[_0xa9ad('0x9')](this[_0xa9ad('0x3')]('values'));}else{return this[_0xa9ad('0x3')](_0xa9ad('0xa'));}},'set':function(_0x5d153a){if(Array[_0xa9ad('0xb')](_0x5d153a)){this[_0xa9ad('0x6')](_0xa9ad('0xa'),JSON[_0xa9ad('0xc')](_0x5d153a));}else{this[_0xa9ad('0x6')](_0xa9ad('0xa'),_0x5d153a);}}},'required':{'type':Sequelize[_0xa9ad('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xa9ad('0xe'))}}; \ No newline at end of file +var _0x19c5=['values','isArray','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','STRING','setDataValue','alias','getDataValue','name','TEXT','long','type','select'];(function(_0xdaded2,_0x2b3260){var _0x868cc6=function(_0x2207ac){while(--_0x2207ac){_0xdaded2['push'](_0xdaded2['shift']());}};_0x868cc6(++_0x2b3260);}(_0x19c5,0x71));var _0x519c=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x19c5[_0x1e4a8e];return _0x5408f9;};'use strict';var Sequelize=require(_0x519c('0x0'));var _=require(_0x519c('0x1'));module[_0x519c('0x2')]={'name':{'type':Sequelize[_0x519c('0x3')],'get':function(_0x30f297){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x519c('0x4')],'allowNull':![],'set':function(_0x1b16e7){this[_0x519c('0x5')](_0x519c('0x6'),_0x1b16e7?_0x1b16e7:this[_0x519c('0x7')](_0x519c('0x8')));}},'type':{'type':Sequelize[_0x519c('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x519c('0x9')](_0x519c('0xa')),'get':function(){if(this[_0x519c('0x7')](_0x519c('0xb'))===_0x519c('0xc')){return JSON['parse'](this[_0x519c('0x7')](_0x519c('0xd')));}else{return this[_0x519c('0x7')](_0x519c('0xd'));}},'set':function(_0x1a97fd){if(Array[_0x519c('0xe')](_0x1a97fd)){this[_0x519c('0x5')](_0x519c('0xd'),JSON['stringify'](_0x1a97fd));}else{this[_0x519c('0x5')]('values',_0x1a97fd);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x519c('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x519c('0x10')](_0x519c('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index bb578a2..785d2a2 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 _0xcbd4=['includeAll','include','findAll','rows','catch','show','params','length','options','find','update','body','create','sequelize','transaction','Sequelize','TEXT','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count'];(function(_0x55e8bb,_0x152b6a){var _0x3a0f61=function(_0x51bc2a){while(--_0x51bc2a){_0x55e8bb['push'](_0x55e8bb['shift']());}};_0x3a0f61(++_0x152b6a);}(_0xcbd4,0x12d));var _0x4cbd=function(_0x427e89,_0xa50ad1){_0x427e89=_0x427e89-0x0;var _0x53191e=_0xcbd4[_0x427e89];return _0x53191e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4cbd('0x0'));var jsonpatch=require(_0x4cbd('0x1'));var rp=require(_0x4cbd('0x2'));var moment=require(_0x4cbd('0x3'));var BPromise=require(_0x4cbd('0x4'));var Mustache=require(_0x4cbd('0x5'));var util=require(_0x4cbd('0x6'));var path=require(_0x4cbd('0x7'));var sox=require(_0x4cbd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4cbd('0x9'));var _=require(_0x4cbd('0xa'));var squel=require(_0x4cbd('0xb'));var crypto=require(_0x4cbd('0xc'));var jsforce=require(_0x4cbd('0xd'));var deskjs=require(_0x4cbd('0xe'));var toCsv=require(_0x4cbd('0xf'));var querystring=require(_0x4cbd('0x10'));var Papa=require(_0x4cbd('0x11'));var Redis=require(_0x4cbd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4cbd('0x13'));var as=require(_0x4cbd('0x14'));var hardwareService=require(_0x4cbd('0x15'));var logger=require('../../config/logger')(_0x4cbd('0x16'));var utils=require(_0x4cbd('0x17'));var config=require(_0x4cbd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4cbd('0x19'))['db'];function respondWithStatusCode(_0x1664b3,_0x3be3f8){_0x3be3f8=_0x3be3f8||0xcc;return function(_0x3f7dea){if(_0x3f7dea){return _0x1664b3[_0x4cbd('0x1a')](_0x3be3f8);}return _0x1664b3[_0x4cbd('0x1b')](_0x3be3f8)[_0x4cbd('0x1c')]();};}function respondWithResult(_0x2824f0,_0x51023c){_0x51023c=_0x51023c||0xc8;return function(_0x56a126){if(_0x56a126){return _0x2824f0['status'](_0x51023c)[_0x4cbd('0x1d')](_0x56a126);}};}function respondWithFilteredResult(_0x5dcb01,_0x4f589c){return function(_0x2da0f9){if(_0x2da0f9){var _0x54406b=typeof _0x4f589c[_0x4cbd('0x1e')]===_0x4cbd('0x1f')&&typeof _0x4f589c[_0x4cbd('0x20')]===_0x4cbd('0x1f');var _0x54c312=_0x2da0f9['count'];var _0x1a7717=_0x54406b?0x0:_0x4f589c['offset'];var _0x20764d=_0x54406b?_0x2da0f9['count']:_0x4f589c['offset']+_0x4f589c[_0x4cbd('0x20')];var _0x21e4e1;if(_0x20764d>=_0x54c312){_0x20764d=_0x54c312;_0x21e4e1=0xc8;}else{_0x21e4e1=0xce;}_0x5dcb01[_0x4cbd('0x1b')](_0x21e4e1);return _0x5dcb01[_0x4cbd('0x21')](_0x4cbd('0x22'),_0x1a7717+'-'+_0x20764d+'/'+_0x54c312)[_0x4cbd('0x1d')](_0x2da0f9);}return null;};}function patchUpdates(_0x50421d){return function(_0x5d7886){try{jsonpatch[_0x4cbd('0x23')](_0x5d7886,_0x50421d,!![]);}catch(_0x55bfd6){return BPromise['reject'](_0x55bfd6);}return _0x5d7886[_0x4cbd('0x24')]();};}function saveUpdates(_0x2e18cd,_0x4c111b){return function(_0x2acc99){if(_0x2acc99){return _0x2acc99['update'](_0x2e18cd)['then'](function(_0x1ab590){return _0x1ab590;});}return null;};}function removeEntity(_0x461d4d,_0x1be9ff){return function(_0x3a6f24){if(_0x3a6f24){return _0x3a6f24[_0x4cbd('0x25')]()[_0x4cbd('0x26')](function(){_0x461d4d[_0x4cbd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26b836,_0x4e0d8f){return function(_0x33be88){if(!_0x33be88){_0x26b836[_0x4cbd('0x1a')](0x194);}return _0x33be88;};}function handleError(_0x5e86a0,_0x5eed28){_0x5eed28=_0x5eed28||0x1f4;return function(_0xbbdb94){logger[_0x4cbd('0x27')](_0xbbdb94[_0x4cbd('0x28')]);if(_0xbbdb94['name']){delete _0xbbdb94[_0x4cbd('0x29')];}_0x5e86a0[_0x4cbd('0x1b')](_0x5eed28)['send'](_0xbbdb94);};}exports[_0x4cbd('0x2a')]=function(_0x7cdf55,_0x481f5d){var _0xa0f869={},_0x396c66={},_0x4186fe={'count':0x0,'rows':[]};var _0x266387=_[_0x4cbd('0x2b')](db[_0x4cbd('0x2c')][_0x4cbd('0x2d')],function(_0x37ce3e){return{'name':_0x37ce3e[_0x4cbd('0x2e')],'type':_0x37ce3e[_0x4cbd('0x2f')][_0x4cbd('0x30')]};});_0x396c66[_0x4cbd('0x31')]=_[_0x4cbd('0x32')](_[_0x4cbd('0x2b')](_0x266387,_0x4cbd('0x29')),[_0x4cbd('0x29')]);_0x396c66[_0x4cbd('0x33')]=_[_0x4cbd('0x34')](_0x7cdf55['query']);_0x396c66[_0x4cbd('0x35')]=_[_0x4cbd('0x36')](_0x396c66['model'],_0x396c66[_0x4cbd('0x33')]);_0xa0f869[_0x4cbd('0x37')]=_['intersection'](_0x396c66[_0x4cbd('0x31')],qs[_0x4cbd('0x38')](_0x7cdf55[_0x4cbd('0x33')][_0x4cbd('0x38')]));_0xa0f869[_0x4cbd('0x37')]=_0xa0f869[_0x4cbd('0x37')]['length']?_0xa0f869[_0x4cbd('0x37')]:_0x396c66[_0x4cbd('0x31')];if(!_0x7cdf55[_0x4cbd('0x33')][_0x4cbd('0x39')](_0x4cbd('0x3a'))){_0xa0f869[_0x4cbd('0x20')]=qs['limit'](_0x7cdf55[_0x4cbd('0x33')][_0x4cbd('0x20')]);_0xa0f869[_0x4cbd('0x1e')]=qs[_0x4cbd('0x1e')](_0x7cdf55['query'][_0x4cbd('0x1e')]);}_0xa0f869[_0x4cbd('0x3b')]=qs[_0x4cbd('0x3c')](_0x7cdf55[_0x4cbd('0x33')][_0x4cbd('0x3c')]);_0xa0f869[_0x4cbd('0x3d')]=qs[_0x4cbd('0x35')](_[_0x4cbd('0x3e')](_0x7cdf55['query'],_0x396c66[_0x4cbd('0x35')]),_0x266387);if(_0x7cdf55[_0x4cbd('0x33')]['filter']){_0xa0f869['where']=_[_0x4cbd('0x3f')](_0xa0f869[_0x4cbd('0x3d')],{'$or':_[_0x4cbd('0x2b')](_0x266387,function(_0x3303c8){if(_0x3303c8[_0x4cbd('0x2f')]!==_0x4cbd('0x40')){var _0xa095a3={};_0xa095a3[_0x3303c8['name']]={'$like':'%'+_0x7cdf55[_0x4cbd('0x33')][_0x4cbd('0x41')]+'%'};return _0xa095a3;}})});}_0xa0f869=_[_0x4cbd('0x3f')]({},_0xa0f869,_0x7cdf55['options']);var _0x41b396={'where':_0xa0f869[_0x4cbd('0x3d')]};return db[_0x4cbd('0x2c')][_0x4cbd('0x42')](_0x41b396)[_0x4cbd('0x26')](function(_0x2b5082){_0x4186fe[_0x4cbd('0x42')]=_0x2b5082;if(_0x7cdf55['query'][_0x4cbd('0x43')]){_0xa0f869[_0x4cbd('0x44')]=[{'all':!![]}];}return db['CmCustomField'][_0x4cbd('0x45')](_0xa0f869);})[_0x4cbd('0x26')](function(_0x3e8ca4){_0x4186fe[_0x4cbd('0x46')]=_0x3e8ca4;return _0x4186fe;})[_0x4cbd('0x26')](respondWithFilteredResult(_0x481f5d,_0xa0f869))[_0x4cbd('0x47')](handleError(_0x481f5d,null));};exports[_0x4cbd('0x48')]=function(_0x5f0260,_0x2bd9b7){var _0x52c66f={'raw':!![],'where':{'id':_0x5f0260[_0x4cbd('0x49')]['id']}},_0x1b2e8d={};_0x1b2e8d[_0x4cbd('0x31')]=_[_0x4cbd('0x34')](db[_0x4cbd('0x2c')][_0x4cbd('0x2d')]);_0x1b2e8d[_0x4cbd('0x33')]=_[_0x4cbd('0x34')](_0x5f0260[_0x4cbd('0x33')]);_0x1b2e8d[_0x4cbd('0x35')]=_['intersection'](_0x1b2e8d[_0x4cbd('0x31')],_0x1b2e8d[_0x4cbd('0x33')]);_0x52c66f[_0x4cbd('0x37')]=_[_0x4cbd('0x36')](_0x1b2e8d['model'],qs[_0x4cbd('0x38')](_0x5f0260[_0x4cbd('0x33')][_0x4cbd('0x38')]));_0x52c66f[_0x4cbd('0x37')]=_0x52c66f[_0x4cbd('0x37')][_0x4cbd('0x4a')]?_0x52c66f['attributes']:_0x1b2e8d[_0x4cbd('0x31')];if(_0x5f0260[_0x4cbd('0x33')]['includeAll']){_0x52c66f[_0x4cbd('0x44')]=[{'all':!![]}];}_0x52c66f=_[_0x4cbd('0x3f')]({},_0x52c66f,_0x5f0260[_0x4cbd('0x4b')]);return db[_0x4cbd('0x2c')][_0x4cbd('0x4c')](_0x52c66f)['then'](handleEntityNotFound(_0x2bd9b7,null))[_0x4cbd('0x26')](respondWithResult(_0x2bd9b7,null))[_0x4cbd('0x47')](handleError(_0x2bd9b7,null));};exports[_0x4cbd('0x4d')]=function(_0xfaaab4,_0x5446e6){if(_0xfaaab4[_0x4cbd('0x4e')]['id']){delete _0xfaaab4[_0x4cbd('0x4e')]['id'];}return db['CmCustomField'][_0x4cbd('0x4c')]({'where':{'id':_0xfaaab4['params']['id']}})[_0x4cbd('0x26')](handleEntityNotFound(_0x5446e6,null))[_0x4cbd('0x26')](saveUpdates(_0xfaaab4[_0x4cbd('0x4e')],null))[_0x4cbd('0x26')](respondWithResult(_0x5446e6,null))[_0x4cbd('0x47')](handleError(_0x5446e6,null));};exports[_0x4cbd('0x25')]=function(_0x3faf75,_0x2b5d1b){return db[_0x4cbd('0x2c')][_0x4cbd('0x4c')]({'where':{'id':_0x3faf75[_0x4cbd('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b5d1b,null))[_0x4cbd('0x26')](removeEntity(_0x2b5d1b,null))[_0x4cbd('0x47')](handleError(_0x2b5d1b,null));};exports[_0x4cbd('0x4f')]=function(_0x90c143,_0x4beaeb){var _0x2a33ad;return db[_0x4cbd('0x50')][_0x4cbd('0x51')](function(_0x11fec7){return db['CmCustomField'][_0x4cbd('0x4f')](_0x90c143['body'],{'transaction':_0x11fec7})[_0x4cbd('0x26')](function(_0x114886){_0x2a33ad=_0x114886;var _0x4f8f02={'type':db[_0x4cbd('0x52')][_0x4cbd('0x53')],'transaction':_0x11fec7};switch(_0x90c143['body']['type']){case'text':_0x4f8f02[_0x4cbd('0x2f')]=db[_0x4cbd('0x52')]['TEXT'];break;case'number':_0x4f8f02[_0x4cbd('0x2f')]=db[_0x4cbd('0x52')][_0x4cbd('0x54')];break;case _0x4cbd('0x55'):_0x4f8f02[_0x4cbd('0x2f')]=db['Sequelize']['BOOLEAN'];_0x4f8f02[_0x4cbd('0x56')]=![];break;default:}return db['sequelize'][_0x4cbd('0x57')][_0x4cbd('0x58')](_0x4cbd('0x59'),util[_0x4cbd('0x5a')](_0x4cbd('0x5b'),_0x2a33ad['id']),_0x4f8f02);})['then'](function(){return _0x2a33ad;});})['then'](respondWithResult(_0x4beaeb,0xc9))['catch'](handleError(_0x4beaeb,null));}; \ No newline at end of file +var _0x78ab=['name','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','includeAll','rows','show','params','fields','include','find','catch','update','body','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','send','index','map','CmCustomField','rawAttributes','fieldName','key','differenceBy'];(function(_0x5bb7d8,_0x2224ce){var _0x50d24f=function(_0x406925){while(--_0x406925){_0x5bb7d8['push'](_0x5bb7d8['shift']());}};_0x50d24f(++_0x2224ce);}(_0x78ab,0x81));var _0xb78a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x78ab[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0xb78a('0x0'));var rimraf=require(_0xb78a('0x1'));var zipdir=require(_0xb78a('0x2'));var jsonpatch=require(_0xb78a('0x3'));var rp=require(_0xb78a('0x4'));var moment=require(_0xb78a('0x5'));var BPromise=require(_0xb78a('0x6'));var Mustache=require(_0xb78a('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb78a('0x8'));var csv=require(_0xb78a('0x9'));var ejs=require(_0xb78a('0xa'));var fs=require('fs');var fs_extra=require(_0xb78a('0xb'));var _=require(_0xb78a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb78a('0xd'));var deskjs=require(_0xb78a('0xe'));var toCsv=require(_0xb78a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb78a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb78a('0x10'));var as=require(_0xb78a('0x11'));var hardwareService=require(_0xb78a('0x12'));var logger=require(_0xb78a('0x13'))('api');var utils=require(_0xb78a('0x14'));var config=require(_0xb78a('0x15'));var licenseUtil=require(_0xb78a('0x16'));var db=require(_0xb78a('0x17'))['db'];function respondWithStatusCode(_0x5a761e,_0x2b8549){_0x2b8549=_0x2b8549||0xcc;return function(_0x19b71c){if(_0x19b71c){return _0x5a761e[_0xb78a('0x18')](_0x2b8549);}return _0x5a761e['status'](_0x2b8549)['end']();};}function respondWithResult(_0x3c2bf2,_0x296054){_0x296054=_0x296054||0xc8;return function(_0x5194fb){if(_0x5194fb){return _0x3c2bf2['status'](_0x296054)[_0xb78a('0x19')](_0x5194fb);}};}function respondWithFilteredResult(_0x5b9b0d,_0x2598f9){return function(_0x3cccf9){if(_0x3cccf9){var _0xe9ff81=typeof _0x2598f9['offset']===_0xb78a('0x1a')&&typeof _0x2598f9[_0xb78a('0x1b')]===_0xb78a('0x1a');var _0x1e0dc4=_0x3cccf9[_0xb78a('0x1c')];var _0x2fc7d8=_0xe9ff81?0x0:_0x2598f9[_0xb78a('0x1d')];var _0x4b3531=_0xe9ff81?_0x3cccf9[_0xb78a('0x1c')]:_0x2598f9[_0xb78a('0x1d')]+_0x2598f9[_0xb78a('0x1b')];var _0x593045;if(_0x4b3531>=_0x1e0dc4){_0x4b3531=_0x1e0dc4;_0x593045=0xc8;}else{_0x593045=0xce;}_0x5b9b0d[_0xb78a('0x1e')](_0x593045);return _0x5b9b0d[_0xb78a('0x1f')](_0xb78a('0x20'),_0x2fc7d8+'-'+_0x4b3531+'/'+_0x1e0dc4)[_0xb78a('0x19')](_0x3cccf9);}return null;};}function patchUpdates(_0x17cc12){return function(_0x4c3715){try{jsonpatch[_0xb78a('0x21')](_0x4c3715,_0x17cc12,!![]);}catch(_0x579b94){return BPromise[_0xb78a('0x22')](_0x579b94);}return _0x4c3715[_0xb78a('0x23')]();};}function saveUpdates(_0x116715,_0x3f5153){return function(_0x5a7f07){if(_0x5a7f07){return _0x5a7f07['update'](_0x116715)[_0xb78a('0x24')](function(_0x112ded){return _0x112ded;});}return null;};}function removeEntity(_0x1e8b6d,_0x596d03){return function(_0x4ac259){if(_0x4ac259){return _0x4ac259[_0xb78a('0x25')]()[_0xb78a('0x24')](function(){_0x1e8b6d[_0xb78a('0x1e')](0xcc)[_0xb78a('0x26')]();});}};}function handleEntityNotFound(_0x15778c,_0x9dc517){return function(_0x53ad54){if(!_0x53ad54){_0x15778c[_0xb78a('0x18')](0x194);}return _0x53ad54;};}function handleError(_0x21b9b5,_0x420187){_0x420187=_0x420187||0x1f4;return function(_0x5a7385){logger[_0xb78a('0x27')](_0x5a7385[_0xb78a('0x28')]);if(_0x5a7385['name']){delete _0x5a7385['name'];}_0x21b9b5[_0xb78a('0x1e')](_0x420187)[_0xb78a('0x29')](_0x5a7385);};}exports[_0xb78a('0x2a')]=function(_0x16c1bc,_0x5dfe65){var _0x157963={},_0xfef5bd={},_0xb93ad6={'count':0x0,'rows':[]};var _0x2c08b4=_[_0xb78a('0x2b')](db[_0xb78a('0x2c')][_0xb78a('0x2d')],function(_0x263c5f){return{'name':_0x263c5f[_0xb78a('0x2e')],'type':_0x263c5f['type'][_0xb78a('0x2f')]};});_0xfef5bd['model']=_[_0xb78a('0x30')](_[_0xb78a('0x2b')](_0x2c08b4,_0xb78a('0x31')),['name']);_0xfef5bd[_0xb78a('0x32')]=_[_0xb78a('0x33')](_0x16c1bc[_0xb78a('0x32')]);_0xfef5bd[_0xb78a('0x34')]=_[_0xb78a('0x35')](_0xfef5bd[_0xb78a('0x36')],_0xfef5bd['query']);_0x157963[_0xb78a('0x37')]=_['intersection'](_0xfef5bd['model'],qs['fields'](_0x16c1bc['query']['fields']));_0x157963[_0xb78a('0x37')]=_0x157963['attributes'][_0xb78a('0x38')]?_0x157963[_0xb78a('0x37')]:_0xfef5bd['model'];if(!_0x16c1bc[_0xb78a('0x32')][_0xb78a('0x39')]('nolimit')){_0x157963['limit']=qs['limit'](_0x16c1bc[_0xb78a('0x32')][_0xb78a('0x1b')]);_0x157963[_0xb78a('0x1d')]=qs[_0xb78a('0x1d')](_0x16c1bc[_0xb78a('0x32')][_0xb78a('0x1d')]);}_0x157963[_0xb78a('0x3a')]=qs['sort'](_0x16c1bc[_0xb78a('0x32')][_0xb78a('0x3b')]);_0x157963[_0xb78a('0x3c')]=qs['filters'](_['pick'](_0x16c1bc['query'],_0xfef5bd[_0xb78a('0x34')]),_0x2c08b4);if(_0x16c1bc['query']['filter']){_0x157963[_0xb78a('0x3c')]=_[_0xb78a('0x3d')](_0x157963[_0xb78a('0x3c')],{'$or':_[_0xb78a('0x2b')](_0x2c08b4,function(_0x4655a3){if(_0x4655a3[_0xb78a('0x3e')]!==_0xb78a('0x3f')){var _0x28a778={};_0x28a778[_0x4655a3[_0xb78a('0x31')]]={'$like':'%'+_0x16c1bc['query']['filter']+'%'};return _0x28a778;}})});}_0x157963=_['merge']({},_0x157963,_0x16c1bc['options']);var _0x3257a9={'where':_0x157963[_0xb78a('0x3c')]};return db[_0xb78a('0x2c')][_0xb78a('0x1c')](_0x3257a9)['then'](function(_0xfea287){_0xb93ad6[_0xb78a('0x1c')]=_0xfea287;if(_0x16c1bc[_0xb78a('0x32')][_0xb78a('0x40')]){_0x157963['include']=[{'all':!![]}];}return db[_0xb78a('0x2c')]['findAll'](_0x157963);})[_0xb78a('0x24')](function(_0x368d33){_0xb93ad6[_0xb78a('0x41')]=_0x368d33;return _0xb93ad6;})[_0xb78a('0x24')](respondWithFilteredResult(_0x5dfe65,_0x157963))['catch'](handleError(_0x5dfe65,null));};exports[_0xb78a('0x42')]=function(_0x398d1b,_0x5bfd28){var _0x25084b={'raw':!![],'where':{'id':_0x398d1b[_0xb78a('0x43')]['id']}},_0x97ddf={};_0x97ddf[_0xb78a('0x36')]=_['keys'](db[_0xb78a('0x2c')][_0xb78a('0x2d')]);_0x97ddf[_0xb78a('0x32')]=_['keys'](_0x398d1b[_0xb78a('0x32')]);_0x97ddf['filters']=_[_0xb78a('0x35')](_0x97ddf[_0xb78a('0x36')],_0x97ddf[_0xb78a('0x32')]);_0x25084b[_0xb78a('0x37')]=_[_0xb78a('0x35')](_0x97ddf[_0xb78a('0x36')],qs[_0xb78a('0x44')](_0x398d1b['query']['fields']));_0x25084b['attributes']=_0x25084b[_0xb78a('0x37')]['length']?_0x25084b[_0xb78a('0x37')]:_0x97ddf[_0xb78a('0x36')];if(_0x398d1b[_0xb78a('0x32')][_0xb78a('0x40')]){_0x25084b[_0xb78a('0x45')]=[{'all':!![]}];}_0x25084b=_[_0xb78a('0x3d')]({},_0x25084b,_0x398d1b['options']);return db[_0xb78a('0x2c')][_0xb78a('0x46')](_0x25084b)['then'](handleEntityNotFound(_0x5bfd28,null))['then'](respondWithResult(_0x5bfd28,null))[_0xb78a('0x47')](handleError(_0x5bfd28,null));};exports[_0xb78a('0x48')]=function(_0x228a3a,_0x5817e6){if(_0x228a3a['body']['id']){delete _0x228a3a[_0xb78a('0x49')]['id'];}return db[_0xb78a('0x2c')][_0xb78a('0x46')]({'where':{'id':_0x228a3a['params']['id']}})['then'](handleEntityNotFound(_0x5817e6,null))['then'](saveUpdates(_0x228a3a[_0xb78a('0x49')],null))[_0xb78a('0x24')](respondWithResult(_0x5817e6,null))[_0xb78a('0x47')](handleError(_0x5817e6,null));};exports['destroy']=function(_0x4a11a1,_0x3f6a08){return db['CmCustomField'][_0xb78a('0x46')]({'where':{'id':_0x4a11a1[_0xb78a('0x43')]['id']}})[_0xb78a('0x24')](handleEntityNotFound(_0x3f6a08,null))[_0xb78a('0x24')](removeEntity(_0x3f6a08,null))['catch'](handleError(_0x3f6a08,null));};exports[_0xb78a('0x4a')]=function(_0xec981d,_0x3ef263){var _0x5711ec;return db[_0xb78a('0x4b')][_0xb78a('0x4c')](function(_0x24b8b9){return db['CmCustomField'][_0xb78a('0x4a')](_0xec981d['body'],{'transaction':_0x24b8b9})[_0xb78a('0x24')](function(_0x4c739c){_0x5711ec=_0x4c739c;var _0x43a1f0={'type':db[_0xb78a('0x4d')]['TEXT'],'transaction':_0x24b8b9};switch(_0xec981d[_0xb78a('0x49')][_0xb78a('0x3e')]){case _0xb78a('0x4e'):_0x43a1f0[_0xb78a('0x3e')]=db['Sequelize'][_0xb78a('0x4f')];break;case _0xb78a('0x50'):_0x43a1f0[_0xb78a('0x3e')]=db[_0xb78a('0x4d')][_0xb78a('0x51')];break;case _0xb78a('0x52'):_0x43a1f0[_0xb78a('0x3e')]=db[_0xb78a('0x4d')][_0xb78a('0x53')];_0x43a1f0[_0xb78a('0x54')]=![];break;default:}return db['sequelize']['queryInterface'][_0xb78a('0x55')](_0xb78a('0x56'),util[_0xb78a('0x57')](_0xb78a('0x58'),_0x5711ec['id']),_0x43a1f0);})['then'](function(){return _0x5711ec;});})['then'](respondWithResult(_0x3ef263,0xc9))['catch'](handleError(_0x3ef263,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 68ff3e8..0430a9a 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 _0x195b=['moment','request-promise','rimraf','../../config/environment','exports','define','CmCustomField','lodash','util','../../config/logger','api'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x195b,0x125));var _0xb195=function(_0x3d39d3,_0x28bcf5){_0x3d39d3=_0x3d39d3-0x0;var _0x16cb5d=_0x195b[_0x3d39d3];return _0x16cb5d;};'use strict';var _=require(_0xb195('0x0'));var util=require(_0xb195('0x1'));var logger=require(_0xb195('0x2'))(_0xb195('0x3'));var moment=require(_0xb195('0x4'));var BPromise=require('bluebird');var rp=require(_0xb195('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb195('0x6'));var config=require(_0xb195('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xb195('0x8')]=function(_0x2af406,_0x252327){return _0x2af406[_0xb195('0x9')](_0xb195('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ba=['define','CmCustomField','cm_custom_fields','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5c8ce0,_0x196521){var _0x131beb=function(_0x11dda6){while(--_0x11dda6){_0x5c8ce0['push'](_0x5c8ce0['shift']());}};_0x131beb(++_0x196521);}(_0x54ba,0x184));var _0xa54b=function(_0x106e24,_0x35092a){_0x106e24=_0x106e24-0x0;var _0x211645=_0x54ba[_0x106e24];return _0x211645;};'use strict';var _=require('lodash');var util=require(_0xa54b('0x0'));var logger=require(_0xa54b('0x1'))(_0xa54b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa54b('0x3'));var fs=require('fs');var path=require(_0xa54b('0x4'));var rimraf=require(_0xa54b('0x5'));var config=require(_0xa54b('0x6'));var attributes=require('./cmCustomField.attributes');module[_0xa54b('0x7')]=function(_0x4d3255,_0x18f17d){return _0x4d3255[_0xa54b('0x8')](_0xa54b('0x9'),attributes,{'tableName':_0xa54b('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 13dc70e..465c89b 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 _0x7c74=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xf9cb79,_0x57cb52){var _0x4358e5=function(_0x383c57){while(--_0x383c57){_0xf9cb79['push'](_0xf9cb79['shift']());}};_0x4358e5(++_0x57cb52);}(_0x7c74,0x1c7));var _0x47c7=function(_0x25280c,_0x2edec1){_0x25280c=_0x25280c-0x0;var _0x3a58c3=_0x7c74[_0x25280c];return _0x3a58c3;};'use strict';var _=require(_0x47c7('0x0'));var util=require(_0x47c7('0x1'));var moment=require(_0x47c7('0x2'));var BPromise=require(_0x47c7('0x3'));var rs=require(_0x47c7('0x4'));var fs=require('fs');var Redis=require(_0x47c7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x47c7('0x6'));var logger=require(_0x47c7('0x7'))(_0x47c7('0x8'));var config=require(_0x47c7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x47c7('0xa')][_0x47c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d810d,_0x5573ae,_0x33f108){return new BPromise(function(_0x1a8cb0,_0x290eee){return client[_0x47c7('0xc')](_0x1d810d,_0x33f108)['then'](function(_0x499bac){logger[_0x47c7('0xd')](_0x47c7('0xe'),_0x5573ae,_0x47c7('0xf'));logger['debug'](_0x47c7('0x10'),_0x5573ae,_0x47c7('0xf'),JSON[_0x47c7('0x11')](_0x499bac));if(_0x499bac[_0x47c7('0x12')]){if(_0x499bac[_0x47c7('0x12')][_0x47c7('0x13')]===0x1f4){logger[_0x47c7('0x12')]('CmCustomField,\x20%s,\x20%s',_0x5573ae,_0x499bac[_0x47c7('0x12')][_0x47c7('0x14')]);return _0x290eee(_0x499bac['error'][_0x47c7('0x14')]);}logger[_0x47c7('0x12')](_0x47c7('0xe'),_0x5573ae,_0x499bac[_0x47c7('0x12')][_0x47c7('0x14')]);return _0x1a8cb0(_0x499bac[_0x47c7('0x12')][_0x47c7('0x14')]);}else{logger[_0x47c7('0xd')]('CmCustomField,\x20%s,\x20%s',_0x5573ae,'request\x20sent');_0x1a8cb0(_0x499bac[_0x47c7('0x15')][_0x47c7('0x14')]);}})[_0x47c7('0x16')](function(_0x3071f2){logger[_0x47c7('0x12')]('CmCustomField,\x20%s,\x20%s',_0x5573ae,_0x3071f2);_0x290eee(_0x3071f2);});});} \ No newline at end of file +var _0x06ce=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s'];(function(_0x5ce5b3,_0x46a1a0){var _0x130fbe=function(_0x506d20){while(--_0x506d20){_0x5ce5b3['push'](_0x5ce5b3['shift']());}};_0x130fbe(++_0x46a1a0);}(_0x06ce,0x1a1));var _0xe06c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x06ce[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xe06c('0x0'));var moment=require(_0xe06c('0x1'));var BPromise=require('bluebird');var rs=require(_0xe06c('0x2'));var fs=require('fs');var Redis=require(_0xe06c('0x3'));var db=require(_0xe06c('0x4'))['db'];var utils=require(_0xe06c('0x5'));var logger=require(_0xe06c('0x6'))(_0xe06c('0x7'));var config=require(_0xe06c('0x8'));var jayson=require(_0xe06c('0x9'));var client=jayson['client'][_0xe06c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50ffe9,_0xca27fe,_0xd0de90){return new BPromise(function(_0x33c3cf,_0x36c7ef){return client[_0xe06c('0xb')](_0x50ffe9,_0xd0de90)[_0xe06c('0xc')](function(_0x5ba8e0){logger[_0xe06c('0xd')](_0xe06c('0xe'),_0xca27fe,_0xe06c('0xf'));logger[_0xe06c('0x10')](_0xe06c('0x11'),_0xca27fe,_0xe06c('0xf'),JSON[_0xe06c('0x12')](_0x5ba8e0));if(_0x5ba8e0[_0xe06c('0x13')]){if(_0x5ba8e0['error'][_0xe06c('0x14')]===0x1f4){logger[_0xe06c('0x13')]('CmCustomField,\x20%s,\x20%s',_0xca27fe,_0x5ba8e0[_0xe06c('0x13')][_0xe06c('0x15')]);return _0x36c7ef(_0x5ba8e0[_0xe06c('0x13')][_0xe06c('0x15')]);}logger[_0xe06c('0x13')](_0xe06c('0xe'),_0xca27fe,_0x5ba8e0[_0xe06c('0x13')][_0xe06c('0x15')]);return _0x33c3cf(_0x5ba8e0['error']['message']);}else{logger[_0xe06c('0xd')](_0xe06c('0xe'),_0xca27fe,_0xe06c('0xf'));_0x33c3cf(_0x5ba8e0[_0xe06c('0x16')][_0xe06c('0x15')]);}})[_0xe06c('0x17')](function(_0x45bbe0){logger['error'](_0xe06c('0xe'),_0xca27fe,_0x45bbe0);_0x36c7ef(_0x45bbe0);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2cb68b8..5f59157 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 _0x7ece=['../../config/environment','isAuthenticated','get','/:id','show','post','put','update','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x7ece,0xc9));var _0xe7ec=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x7ece[_0x342baa];return _0x1208f3;};'use strict';var multer=require('multer');var util=require(_0xe7ec('0x0'));var path=require(_0xe7ec('0x1'));var timeout=require('connect-timeout');var express=require(_0xe7ec('0x2'));var router=express[_0xe7ec('0x3')]();var fs_extra=require(_0xe7ec('0x4'));var auth=require(_0xe7ec('0x5'));var interaction=require(_0xe7ec('0x6'));var config=require(_0xe7ec('0x7'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0xe7ec('0x8')](),controller['index']);router[_0xe7ec('0x9')](_0xe7ec('0xa'),auth[_0xe7ec('0x8')](),controller[_0xe7ec('0xb')]);router[_0xe7ec('0xc')]('/',auth[_0xe7ec('0x8')](),controller['create']);router[_0xe7ec('0xd')]('/:id',auth[_0xe7ec('0x8')](),controller[_0xe7ec('0xe')]);router['delete'](_0xe7ec('0xa'),auth[_0xe7ec('0x8')](),controller['destroy']);module[_0xe7ec('0xf')]=router; \ No newline at end of file +var _0x6e6f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','util','path'];(function(_0x15e9d4,_0x39f34a){var _0x2ec5e7=function(_0xf3cb7e){while(--_0xf3cb7e){_0x15e9d4['push'](_0x15e9d4['shift']());}};_0x2ec5e7(++_0x39f34a);}(_0x6e6f,0x76));var _0xf6e6=function(_0x3439bc,_0xc03879){_0x3439bc=_0x3439bc-0x0;var _0x484801=_0x6e6f[_0x3439bc];return _0x484801;};'use strict';var multer=require('multer');var util=require(_0xf6e6('0x0'));var path=require(_0xf6e6('0x1'));var timeout=require('connect-timeout');var express=require(_0xf6e6('0x2'));var router=express[_0xf6e6('0x3')]();var fs_extra=require(_0xf6e6('0x4'));var auth=require(_0xf6e6('0x5'));var interaction=require(_0xf6e6('0x6'));var config=require(_0xf6e6('0x7'));var controller=require(_0xf6e6('0x8'));router['get']('/',auth[_0xf6e6('0x9')](),controller[_0xf6e6('0xa')]);router[_0xf6e6('0xb')](_0xf6e6('0xc'),auth[_0xf6e6('0x9')](),controller[_0xf6e6('0xd')]);router[_0xf6e6('0xe')]('/',auth[_0xf6e6('0x9')](),controller['create']);router[_0xf6e6('0xf')](_0xf6e6('0xc'),auth['isAuthenticated'](),controller[_0xf6e6('0x10')]);router[_0xf6e6('0x11')](_0xf6e6('0xc'),auth[_0xf6e6('0x9')](),controller[_0xf6e6('0x12')]);module[_0xf6e6('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 48e1dda..75fbbd1 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 _0x8170=['contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x38d6e8,_0x21c3b9){var _0x37e27f=function(_0x2e9a3e){while(--_0x2e9a3e){_0x38d6e8['push'](_0x38d6e8['shift']());}};_0x37e27f(++_0x21c3b9);}(_0x8170,0x133));var _0x0817=function(_0x25696b,_0x3a9c3e){_0x25696b=_0x25696b-0x0;var _0x26bde9=_0x8170[_0x25696b];return _0x26bde9;};'use strict';var moment=require('moment');var Sequelize=require(_0x0817('0x0'));module[_0x0817('0x1')]={'phone':{'type':Sequelize[_0x0817('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x0817('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x0817('0x4')],'defaultValue':moment()[_0x0817('0x5')](_0x0817('0x6'))},'countbusyretry':{'type':Sequelize[_0x0817('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0817('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0817('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0817('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0817('0x4')]},'priority':{'type':Sequelize[_0x0817('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x0817('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x0817('0x7')],'unique':_0x0817('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x0817('0x8')},'UserId':{'type':Sequelize[_0x0817('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x0817('0x7')],'unique':_0x0817('0x8')},'CampaignId':{'type':Sequelize[_0x0817('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x0817('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0817('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0817('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0817('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0817('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x0817('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0817('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x0817('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x3d62=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment','sequelize','BOOLEAN','DATE'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3d62,0x140));var _0x23d6=function(_0x1fa65e,_0x316f7b){_0x1fa65e=_0x1fa65e-0x0;var _0x1a9bdb=_0x3d62[_0x1fa65e];return _0x1a9bdb;};'use strict';var moment=require(_0x23d6('0x0'));var Sequelize=require(_0x23d6('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x23d6('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x23d6('0x3')],'defaultValue':moment()['format'](_0x23d6('0x4'))},'countbusyretry':{'type':Sequelize[_0x23d6('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x23d6('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x23d6('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x23d6('0x3')]},'priority':{'type':Sequelize[_0x23d6('0x5')](0x2)[_0x23d6('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x23d6('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x23d6('0x5')],'unique':_0x23d6('0x8')},'ListId':{'type':Sequelize[_0x23d6('0x5')],'unique':_0x23d6('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x23d6('0x5')],'unique':_0x23d6('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x23d6('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x23d6('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x23d6('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x23d6('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x23d6('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x23d6('0x6')]},'recallmeNotifiedDate':{'type':Sequelize[_0x23d6('0x3')],'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 9fc9050..b213089 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 _0x25fa=['undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','concat','$and','$or','$gt','$gte','$lte','$ne','$not','$notBetween','$notIn','$like','$iLike','$notILike','$overlap','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','CmHopper','rows','catch','show','params','merge','options','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','statedesc','membername','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','getTimezone','moment','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','offset'];(function(_0x4c0795,_0x461c17){var _0x597e79=function(_0x315272){while(--_0x315272){_0x4c0795['push'](_0x4c0795['shift']());}};_0x597e79(++_0x461c17);}(_0x25fa,0x109));var _0xa25f=function(_0xf1e9fb,_0x3acf43){_0xf1e9fb=_0xf1e9fb-0x0;var _0x2c1ded=_0x25fa[_0xf1e9fb];return _0x2c1ded;};'use strict';var moment=require(_0xa25f('0x0'));var _=require('lodash');var qs=require(_0xa25f('0x1'));var logger=require(_0xa25f('0x2'))('api');var shared=require(_0xa25f('0x3'));var db=require(_0xa25f('0x4'))['db'];function respondWithResult(_0x256155,_0x4d0b34){_0x4d0b34=_0x4d0b34||0xc8;return function(_0x4e444d){if(_0x4e444d){return _0x256155[_0xa25f('0x5')](_0x4d0b34)['json'](_0x4e444d);}};}function respondWithFilteredResult(_0x2ea9ea,_0x3ab530){return function(_0x29666d){if(_0x29666d){var _0x455225=typeof _0x3ab530[_0xa25f('0x6')]===_0xa25f('0x7')&&typeof _0x3ab530[_0xa25f('0x8')]===_0xa25f('0x7');var _0xa27a42=_0x29666d['count'];var _0x1bca18=_0x455225?0x0:_0x3ab530[_0xa25f('0x6')];var _0x507a36=_0x455225?_0x29666d[_0xa25f('0x9')]:_0x3ab530[_0xa25f('0x6')]+_0x3ab530[_0xa25f('0x8')];var _0x22df56;if(_0x507a36>=_0xa27a42){_0x507a36=_0xa27a42;_0x22df56=0xc8;}else{_0x22df56=0xce;}_0x2ea9ea['status'](_0x22df56);return _0x2ea9ea[_0xa25f('0xa')](_0xa25f('0xb'),_0x1bca18+'-'+_0x507a36+'/'+_0xa27a42)['json'](_0x29666d);}return null;};}function saveUpdates(_0x3e970c,_0x465e41){return function(_0x50bb78){if(_0x50bb78){return _0x50bb78[_0xa25f('0xc')](_0x3e970c)[_0xa25f('0xd')](function(_0x1c6052){return _0x1c6052;});}return null;};}function handleEntityNotFound(_0x4b3792,_0x199e18){return function(_0x2a627f){if(!_0x2a627f){_0x4b3792[_0xa25f('0xe')](0x194);}return _0x2a627f;};}function handleError(_0x363668,_0x465809){_0x465809=_0x465809||0x1f4;return function(_0x2d2417){logger[_0xa25f('0xf')](_0x2d2417[_0xa25f('0x10')]);if(_0x2d2417['name']){delete _0x2d2417[_0xa25f('0x11')];}_0x363668[_0xa25f('0x5')](_0x465809)[_0xa25f('0x12')](_0x2d2417);};}exports[_0xa25f('0x13')]=function(_0x18705c,_0x427105){var _0x4a4805={},_0x292171={},_0x5a2d5c={'count':0x0,'rows':[]};var _0x32b868=_['map'](db['CmHopper'][_0xa25f('0x14')],function(_0x489c83){return{'name':_0x489c83[_0xa25f('0x15')],'type':_0x489c83[_0xa25f('0x16')][_0xa25f('0x17')]};});_0x292171[_0xa25f('0x18')]=_[_0xa25f('0x19')](_0x32b868,'name');_0x292171[_0xa25f('0x1a')]=_[_0xa25f('0x1b')](_0x18705c[_0xa25f('0x1a')]);_0x292171[_0xa25f('0x1c')]=_['intersection'](_0x292171[_0xa25f('0x18')],_0x292171[_0xa25f('0x1a')]);_0x292171[_0xa25f('0x1c')]=_[_0xa25f('0x1d')](_0x292171['filters'],[_0xa25f('0x1e'),_0xa25f('0x1f'),_0xa25f('0x20'),_0xa25f('0x21'),'$lt',_0xa25f('0x22'),_0xa25f('0x23'),'$eq',_0xa25f('0x24'),'$between',_0xa25f('0x25'),'$in',_0xa25f('0x26'),_0xa25f('0x27'),'$notLike',_0xa25f('0x28'),_0xa25f('0x29'),'$like',_0xa25f('0x2a'),'$contains',_0xa25f('0x2b'),_0xa25f('0x2c')]);_0x4a4805[_0xa25f('0x2d')]=_[_0xa25f('0x2e')](_0x292171[_0xa25f('0x18')],qs['fields'](_0x18705c[_0xa25f('0x1a')][_0xa25f('0x2f')]));_0x4a4805[_0xa25f('0x2d')]=_0x4a4805[_0xa25f('0x2d')][_0xa25f('0x30')]?_0x4a4805['attributes']:_0x292171[_0xa25f('0x18')];if(!_0x18705c[_0xa25f('0x1a')][_0xa25f('0x31')](_0xa25f('0x32'))){_0x4a4805[_0xa25f('0x8')]=qs[_0xa25f('0x8')](_0x18705c[_0xa25f('0x1a')][_0xa25f('0x8')]);_0x4a4805[_0xa25f('0x6')]=qs['offset'](_0x18705c['query']['offset']);}_0x4a4805[_0xa25f('0x33')]=qs[_0xa25f('0x34')](_0x18705c[_0xa25f('0x1a')][_0xa25f('0x34')]);_0x4a4805[_0xa25f('0x35')]=qs[_0xa25f('0x1c')](_[_0xa25f('0x36')](_0x18705c[_0xa25f('0x1a')],_0x292171[_0xa25f('0x1c')]),_0x32b868);if(_0x18705c[_0xa25f('0x1a')][_0xa25f('0x37')]){_0x4a4805['where']=_['merge'](_0x4a4805[_0xa25f('0x35')],{'$or':_[_0xa25f('0x19')](_0x32b868,function(_0x3d11b7){if(_0x3d11b7['type']!=='VIRTUAL'){var _0x4aadc1={};_0x4aadc1[_0x3d11b7[_0xa25f('0x11')]]={'$like':'%'+_0x18705c[_0xa25f('0x1a')][_0xa25f('0x37')]+'%'};return _0x4aadc1;}})});}_0x4a4805=_['merge']({},_0x4a4805,_0x18705c['options']);var _0x3ced19={'where':_0x4a4805[_0xa25f('0x35')]};return db['CmHopper']['count'](_0x3ced19)[_0xa25f('0xd')](function(_0x33ad7a){_0x5a2d5c[_0xa25f('0x9')]=_0x33ad7a;if(_0x18705c['query'][_0xa25f('0x38')]){_0x4a4805[_0xa25f('0x39')]=[{'all':!![]}];}return db[_0xa25f('0x3a')]['findAll'](_0x4a4805);})['then'](function(_0x3108bb){_0x5a2d5c[_0xa25f('0x3b')]=_0x3108bb;return _0x5a2d5c;})[_0xa25f('0xd')](respondWithFilteredResult(_0x427105,_0x4a4805))[_0xa25f('0x3c')](handleError(_0x427105,null));};exports[_0xa25f('0x3d')]=function(_0x1ae57f,_0x276fa6){var _0x3382f4={'raw':!![],'where':{'id':_0x1ae57f[_0xa25f('0x3e')]['id']}},_0x4af661={};_0x4af661[_0xa25f('0x18')]=_[_0xa25f('0x1b')](db[_0xa25f('0x3a')][_0xa25f('0x14')]);_0x4af661[_0xa25f('0x1a')]=_[_0xa25f('0x1b')](_0x1ae57f[_0xa25f('0x1a')]);_0x4af661[_0xa25f('0x1c')]=_[_0xa25f('0x2e')](_0x4af661[_0xa25f('0x18')],_0x4af661[_0xa25f('0x1a')]);_0x3382f4[_0xa25f('0x2d')]=_['intersection'](_0x4af661[_0xa25f('0x18')],qs['fields'](_0x1ae57f[_0xa25f('0x1a')][_0xa25f('0x2f')]));_0x3382f4[_0xa25f('0x2d')]=_0x3382f4['attributes'][_0xa25f('0x30')]?_0x3382f4[_0xa25f('0x2d')]:_0x4af661[_0xa25f('0x18')];if(_0x1ae57f[_0xa25f('0x1a')]['includeAll']){_0x3382f4[_0xa25f('0x39')]=[{'all':!![]}];}_0x3382f4=_[_0xa25f('0x3f')]({},_0x3382f4,_0x1ae57f[_0xa25f('0x40')]);return db[_0xa25f('0x3a')][_0xa25f('0x41')](_0x3382f4)[_0xa25f('0xd')](handleEntityNotFound(_0x276fa6,null))['then'](respondWithResult(_0x276fa6,null))[_0xa25f('0x3c')](handleError(_0x276fa6,null));};exports[_0xa25f('0x42')]=function(_0x4c77c3,_0x2a91c7){return db[_0xa25f('0x3a')][_0xa25f('0x42')](_0x4c77c3[_0xa25f('0x43')],{})[_0xa25f('0xd')](respondWithResult(_0x2a91c7,0xc9))[_0xa25f('0x3c')](handleError(_0x2a91c7,null));};exports[_0xa25f('0xc')]=function(_0x1eae26,_0x1c355f){if(_0x1eae26[_0xa25f('0x43')]['id']){delete _0x1eae26[_0xa25f('0x43')]['id'];}return db[_0xa25f('0x3a')][_0xa25f('0x41')]({'where':{'id':_0x1eae26['params']['id']}})[_0xa25f('0xd')](handleEntityNotFound(_0x1c355f,null))[_0xa25f('0xd')](saveUpdates(_0x1eae26[_0xa25f('0x43')],null))[_0xa25f('0xd')](respondWithResult(_0x1c355f,null))['catch'](handleError(_0x1c355f,null));};exports[_0xa25f('0x44')]=function(_0x43888b,_0x93cee1){return db['CmHopper'][_0xa25f('0x44')]()[_0xa25f('0xd')](respondWithResult(_0x93cee1,null))[_0xa25f('0x3c')](handleError(_0x93cee1,null));};exports[_0xa25f('0x45')]=function(_0x18c9f2,_0x3b6d34){var _0x31a553;var _0x2a5848=_0x18c9f2['params']['id'];return db[_0xa25f('0x3a')][_0xa25f('0x41')]({'where':{'id':_0x18c9f2[_0xa25f('0x3e')]['id']}})[_0xa25f('0xd')](handleEntityNotFound(_0x3b6d34,null))[_0xa25f('0xd')](function(_0x37ebf2){if(_0x37ebf2){return _0x37ebf2[_0xa25f('0x45')]()[_0xa25f('0xd')](function(_0x26a096){return _0x26a096;});}})[_0xa25f('0xd')](function(_0x2cd16c){_0x31a553=_0x2cd16c;if(_0x2cd16c){if(_0x2cd16c[_0xa25f('0x46')]||_0x2cd16c[_0xa25f('0x47')]){return db[_0x2cd16c[_0xa25f('0x46')]?_0xa25f('0x48'):_0xa25f('0x49')][_0xa25f('0x41')]({'where':{'id':_0x2cd16c[_0xa25f('0x46')]?_0x2cd16c[_0xa25f('0x46')]:_0x2cd16c[_0xa25f('0x47')]},'attributes':['id',_0xa25f('0x11')],'raw':!![]});}}})[_0xa25f('0xd')](function(_0x52671e){var _0x1de4c4={};if(_0x52671e){_[_0xa25f('0x3f')](_0x1de4c4,_[_0xa25f('0x4a')](_0x31a553[_0xa25f('0x4b')],['createdAt',_0xa25f('0x4c'),'id']));_0x1de4c4['state']=0x15;_0x1de4c4[_0xa25f('0x4d')]='deleted';_0x1de4c4['campaign']=_0x52671e[_0xa25f('0x11')];_0x1de4c4[_0xa25f('0x4e')]=_0x18c9f2[_0xa25f('0x4f')][_0xa25f('0x11')];_0x1de4c4[_0xa25f('0x50')]=_0x18c9f2[_0xa25f('0x4f')]['id'];_0x1de4c4[_0xa25f('0x51')]=!![];_0x1de4c4[_0xa25f('0x52')]=moment()[_0xa25f('0x53')](_0xa25f('0x54'));_0x1de4c4[_0xa25f('0x55')]=_0x31a553[_0xa25f('0x56')];_0x1de4c4['campaigntype']=_0x31a553[_0xa25f('0x46')]?_0xa25f('0x57'):_0xa25f('0x58');return db[_0xa25f('0x59')]['find']({'where':{'id':_0x1de4c4[_0xa25f('0x5a')]},'attributes':['firstName',_0xa25f('0x5b')]})[_0xa25f('0xd')](function(_0x36d202){if(!_[_0xa25f('0x5c')](_0x3b6d34)&&!_['isNil'](_0x36d202[_0xa25f('0x5d')])){_0x1de4c4[_0xa25f('0x5e')]=_0x36d202[_0xa25f('0x5d')];if(!_['isNil'](_0x36d202[_0xa25f('0x5b')])){_0x1de4c4['calleridname']+='\x20'+_0x36d202[_0xa25f('0x5b')];}}})['finally'](function(){return db[_0xa25f('0x5f')][_0xa25f('0x42')](_0x1de4c4);});}})[_0xa25f('0xd')](function(_0x37aae1){return db[_0xa25f('0x60')][_0xa25f('0x45')]({'where':{'CmHopperId':_0x2a5848}});})['then'](function(){return _0x3b6d34[_0xa25f('0x5')](0xcc)[_0xa25f('0x61')]();})[_0xa25f('0x3c')](handleError(_0x3b6d34,null));};exports[_0xa25f('0x62')]=function(_0x229f26,_0x2cb2e2){var _0x449bdd=[];return db['CmContact']['describe']()['then'](function(_0xa312d0){_0x449bdd=_[_0xa25f('0x1b')](_0xa312d0);return _0x229f26[_0xa25f('0x4f')][_0xa25f('0x63')]({'where':{'type':_0xa25f('0x64'),'dialActive':!![],'dialMethod':_0xa25f('0x65')},'attributes':['id',_0xa25f('0x66'),_0xa25f('0x67')],'raw':!![]});})[_0xa25f('0xd')](function(_0xb81111){if(_0xb81111&&_0xb81111[_0xa25f('0x30')]){return db['sequelize'][_0xa25f('0x68')](function(_0xeef605){var _0x322db7={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa25f('0x53')](_0xa25f('0x54'))},'VoiceQueueId':{'$in':_['map'](_0xb81111,'id')},'$or':[{'UserId':null},{'UserId':_0x229f26[_0xa25f('0x4f')]['id']}]};var _0x45a8a2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xb81111)['filter']([_0xa25f('0x67'),0x0])[_0xa25f('0x19')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x229f26[_0xa25f('0x4f')]['id']}]};var _0xdca81a={'$or':[_0x322db7,_0x45a8a2]};var _0xe0d429=[];if(_0x229f26[_0xa25f('0x43')][_0xa25f('0x69')]&&_0x229f26['body'][_0xa25f('0x69')]===_0xa25f('0x6a')){if(!_[_0xa25f('0x6b')](_0x229f26['body'][_0xa25f('0x6c')])){_0xdca81a['id']={'$in':_0x229f26[_0xa25f('0x43')][_0xa25f('0x6c')]};}_0xe0d429=[['priority',_0xa25f('0x6d')],[_0xa25f('0x6e'),_0xb81111[0x0][_0xa25f('0x66')]===_0xa25f('0x6d')?'DESC':'ASC'],db[_0xa25f('0x6f')][_0xa25f('0x70')](_0xa25f('0x71')),['id',_0xa25f('0x72')]];}else{if(!_[_0xa25f('0x6b')](_0x229f26[_0xa25f('0x43')][_0xa25f('0x6c')])){_0xdca81a['id']={'$notIn':_0x229f26['body']['hopperIds']};}_0xe0d429=[[_0xa25f('0x73'),'DESC'],[_0xa25f('0x6e'),_0xb81111[0x0][_0xa25f('0x66')]],db[_0xa25f('0x6f')][_0xa25f('0x70')](_0xa25f('0x74')),['id',_0xa25f('0x6d')]];}return db[_0xa25f('0x3a')]['findOne']({'attributes':['id',_0xa25f('0x75'),'phone',_0xa25f('0x76')],'where':_0xdca81a,'order':_0xe0d429,'transaction':_0xeef605,'lock':_0xeef605[_0xa25f('0x77')][_0xa25f('0x78')],'include':[{'model':db[_0xa25f('0x59')],'as':_0xa25f('0x79'),'attributes':_0x449bdd,'include':[{'model':db[_0xa25f('0x7a')],'as':_0xa25f('0x7b'),'attributes':['id',_0xa25f('0x11')]}]},{'model':db[_0xa25f('0x7c')],'as':_0xa25f('0x7d'),'attributes':['id',_0xa25f('0x11')]},{'model':db[_0xa25f('0x48')],'as':_0xa25f('0x7e'),'attributes':['id',_0xa25f('0x11'),_0xa25f('0x7f')]}]})[_0xa25f('0xd')](function(_0x4066f9){if(_0x4066f9){return _0x4066f9[_0xa25f('0xc')]({'UserId':_0x229f26[_0xa25f('0x4f')]['id']},{'transaction':_0xeef605});}});});}})[_0xa25f('0xd')](handleEntityNotFound(_0x2cb2e2,null))['then'](respondWithResult(_0x2cb2e2,null))[_0xa25f('0x3c')](handleError(_0x2cb2e2,null));};exports['getPreviewRecall']=function(_0x25a924,_0x46ab86,_0x5cb5f0){var _0x2e3f12=[];var _0x325b94=_0x25a924[_0xa25f('0x3e')]['id'];var _0x985656=_0x25a924['user']['id'];return db[_0xa25f('0x59')][_0xa25f('0x44')]()[_0xa25f('0xd')](function(_0x1007f5){_0x2e3f12=_[_0xa25f('0x1b')](_0x1007f5);return db[_0xa25f('0x6f')][_0xa25f('0x68')](function(_0x2f3d8c){const _0x1ceffa={'id':_0x325b94};return db[_0xa25f('0x3a')]['findOne']({'attributes':['id',_0xa25f('0x75'),_0xa25f('0x76')],'where':_0x1ceffa,'transaction':_0x2f3d8c,'lock':_0x2f3d8c[_0xa25f('0x77')][_0xa25f('0x78')],'include':[{'model':db['CmContact'],'as':_0xa25f('0x79'),'attributes':_0x2e3f12,'include':[{'model':db[_0xa25f('0x7a')],'as':_0xa25f('0x7b'),'attributes':['id',_0xa25f('0x11')]}]},{'model':db[_0xa25f('0x7c')],'as':_0xa25f('0x7d'),'attributes':['id',_0xa25f('0x11')]},{'model':db[_0xa25f('0x48')],'as':'Queue','attributes':['id',_0xa25f('0x11'),_0xa25f('0x7f')]}]})[_0xa25f('0xd')](function(_0x4c6798){if(_0x4c6798){return _0x4c6798[_0xa25f('0xc')]({'UserId':_0x985656},{'transaction':_0x2f3d8c});}});});})[_0xa25f('0xd')](handleEntityNotFound(_0x46ab86,null))[_0xa25f('0xd')](respondWithResult(_0x46ab86,null))[_0xa25f('0x3c')](handleError(_0x46ab86,null));};exports['getOpenContacts']=function(_0x4d8625,_0x46186e){return _0x4d8625[_0xa25f('0x4f')][_0xa25f('0x63')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa25f('0x65')},'attributes':['id'],'raw':!![]})[_0xa25f('0xd')](function(_0x48e423){if(_0x48e423&&_0x48e423[_0xa25f('0x30')]){return db[_0xa25f('0x3a')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa25f('0x53')](_0xa25f('0x54'))},'VoiceQueueId':{'$in':_[_0xa25f('0x19')](_0x48e423,'id')},'$or':[{'UserId':null},{'UserId':_0x4d8625['user']['id']}]}});}return 0x0;})[_0xa25f('0xd')](function(_0x750430){if(!_['isNil'](_0x750430)&&_[_0xa25f('0x80')](_0x750430)){return _0x46186e[_0xa25f('0x5')](0xc8)[_0xa25f('0x81')]({'contacts':_0x750430});}else{logger[_0xa25f('0xf')](_0xa25f('0x82'),_0xa25f('0x83'),0x194,_0xa25f('0x84'));_0x46186e['sendStatus'](0x194);}})['catch'](handleError(_0x46186e,null));};exports[_0xa25f('0x85')]=function(_0x3734da,_0x1527b7){var _0x37fe95=shared[_0xa25f('0x86')];var _0x4a1864=[];_[_0xa25f('0x19')](_0x37fe95,function(_0x24d32b){_0x4a1864['push']({'id':_0x24d32b['name'],'name':_0x24d32b['name'],'utcOffset':_0x24d32b['utcOffset']});});return _0x1527b7[_0xa25f('0x5')](0xc8)['json']({'tz':_0x4a1864});};exports[_0xa25f('0x87')]=function(_0x3cf45e,_0x570b2a){var _0x534dc4=shared[_0xa25f('0x86')];var _0x9d5ba4={};if(!_[_0xa25f('0x5c')](_0x534dc4[_0x3cf45e['body']['id']]))_0x9d5ba4=_0x534dc4[_0x3cf45e[_0xa25f('0x43')]['id']];return _0x570b2a[_0xa25f('0x5')](0xc8)[_0xa25f('0x81')](_0x9d5ba4);}; \ No newline at end of file +var _0x4b19=['limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$and','$gt','$lt','$lte','$ne','$eq','$notBetween','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','merge','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','direction','hopperIds','priority','ASC','scheduledAt','literal','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','CmCompany','CmList','List','dialActive','getPreviewRecall','Contact','Company','Queue','outbound','isNumber','getOpenContacts','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','undefined'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x4b19,0x195));var _0x94b1=function(_0xf06163,_0x80c74b){_0xf06163=_0xf06163-0x0;var _0x29df4d=_0x4b19[_0xf06163];return _0x29df4d;};'use strict';var moment=require(_0x94b1('0x0'));var _=require('lodash');var qs=require(_0x94b1('0x1'));var logger=require(_0x94b1('0x2'))(_0x94b1('0x3'));var shared=require('../../config/environment');var db=require(_0x94b1('0x4'))['db'];function respondWithResult(_0x3648ad,_0x2240b9){_0x2240b9=_0x2240b9||0xc8;return function(_0x4f607f){if(_0x4f607f){return _0x3648ad[_0x94b1('0x5')](_0x2240b9)[_0x94b1('0x6')](_0x4f607f);}};}function respondWithFilteredResult(_0x52d6c1,_0x24df76){return function(_0x110a52){if(_0x110a52){var _0x4ea1f9=typeof _0x24df76[_0x94b1('0x7')]===_0x94b1('0x8')&&typeof _0x24df76[_0x94b1('0x9')]==='undefined';var _0x15c0a9=_0x110a52['count'];var _0x4aafcc=_0x4ea1f9?0x0:_0x24df76[_0x94b1('0x7')];var _0x126424=_0x4ea1f9?_0x110a52[_0x94b1('0xa')]:_0x24df76[_0x94b1('0x7')]+_0x24df76[_0x94b1('0x9')];var _0x3aeb91;if(_0x126424>=_0x15c0a9){_0x126424=_0x15c0a9;_0x3aeb91=0xc8;}else{_0x3aeb91=0xce;}_0x52d6c1['status'](_0x3aeb91);return _0x52d6c1[_0x94b1('0xb')](_0x94b1('0xc'),_0x4aafcc+'-'+_0x126424+'/'+_0x15c0a9)[_0x94b1('0x6')](_0x110a52);}return null;};}function saveUpdates(_0x2b378c,_0x5cbf96){return function(_0x4a4fe6){if(_0x4a4fe6){return _0x4a4fe6[_0x94b1('0xd')](_0x2b378c)[_0x94b1('0xe')](function(_0x57de2f){return _0x57de2f;});}return null;};}function handleEntityNotFound(_0x5059d8,_0x9329c9){return function(_0xb9924c){if(!_0xb9924c){_0x5059d8['sendStatus'](0x194);}return _0xb9924c;};}function handleError(_0x3f3eab,_0x58fab3){_0x58fab3=_0x58fab3||0x1f4;return function(_0x4ea6a4){logger[_0x94b1('0xf')](_0x4ea6a4[_0x94b1('0x10')]);if(_0x4ea6a4[_0x94b1('0x11')]){delete _0x4ea6a4[_0x94b1('0x11')];}_0x3f3eab['status'](_0x58fab3)[_0x94b1('0x12')](_0x4ea6a4);};}exports[_0x94b1('0x13')]=function(_0xa29b90,_0x224099){var _0x3a6ae0={},_0x1abb7f={},_0x2d33dc={'count':0x0,'rows':[]};var _0x59d7cf=_[_0x94b1('0x14')](db[_0x94b1('0x15')][_0x94b1('0x16')],function(_0x5deb20){return{'name':_0x5deb20[_0x94b1('0x17')],'type':_0x5deb20[_0x94b1('0x18')]['key']};});_0x1abb7f[_0x94b1('0x19')]=_[_0x94b1('0x14')](_0x59d7cf,_0x94b1('0x11'));_0x1abb7f[_0x94b1('0x1a')]=_[_0x94b1('0x1b')](_0xa29b90[_0x94b1('0x1a')]);_0x1abb7f[_0x94b1('0x1c')]=_[_0x94b1('0x1d')](_0x1abb7f[_0x94b1('0x19')],_0x1abb7f[_0x94b1('0x1a')]);_0x1abb7f['filters']=_[_0x94b1('0x1e')](_0x1abb7f[_0x94b1('0x1c')],[_0x94b1('0x1f'),'$or',_0x94b1('0x20'),'$gte',_0x94b1('0x21'),_0x94b1('0x22'),_0x94b1('0x23'),_0x94b1('0x24'),'$not','$between',_0x94b1('0x25'),'$in',_0x94b1('0x26'),'$like',_0x94b1('0x27'),_0x94b1('0x28'),_0x94b1('0x29'),'$like',_0x94b1('0x2a'),_0x94b1('0x2b'),_0x94b1('0x2c'),_0x94b1('0x2d')]);_0x3a6ae0[_0x94b1('0x2e')]=_[_0x94b1('0x1d')](_0x1abb7f[_0x94b1('0x19')],qs[_0x94b1('0x2f')](_0xa29b90[_0x94b1('0x1a')]['fields']));_0x3a6ae0[_0x94b1('0x2e')]=_0x3a6ae0[_0x94b1('0x2e')]['length']?_0x3a6ae0[_0x94b1('0x2e')]:_0x1abb7f[_0x94b1('0x19')];if(!_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x30')](_0x94b1('0x31'))){_0x3a6ae0[_0x94b1('0x9')]=qs['limit'](_0xa29b90[_0x94b1('0x1a')]['limit']);_0x3a6ae0[_0x94b1('0x7')]=qs['offset'](_0xa29b90['query'][_0x94b1('0x7')]);}_0x3a6ae0[_0x94b1('0x32')]=qs[_0x94b1('0x33')](_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x33')]);_0x3a6ae0[_0x94b1('0x34')]=qs[_0x94b1('0x1c')](_[_0x94b1('0x35')](_0xa29b90[_0x94b1('0x1a')],_0x1abb7f[_0x94b1('0x1c')]),_0x59d7cf);if(_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x36')]){_0x3a6ae0['where']=_['merge'](_0x3a6ae0[_0x94b1('0x34')],{'$or':_[_0x94b1('0x14')](_0x59d7cf,function(_0x298bc2){if(_0x298bc2[_0x94b1('0x18')]!==_0x94b1('0x37')){var _0x2ba486={};_0x2ba486[_0x298bc2[_0x94b1('0x11')]]={'$like':'%'+_0xa29b90[_0x94b1('0x1a')][_0x94b1('0x36')]+'%'};return _0x2ba486;}})});}_0x3a6ae0=_['merge']({},_0x3a6ae0,_0xa29b90[_0x94b1('0x38')]);var _0x4d18e8={'where':_0x3a6ae0[_0x94b1('0x34')]};return db[_0x94b1('0x15')][_0x94b1('0xa')](_0x4d18e8)['then'](function(_0x357798){_0x2d33dc[_0x94b1('0xa')]=_0x357798;if(_0xa29b90[_0x94b1('0x1a')]['includeAll']){_0x3a6ae0[_0x94b1('0x39')]=[{'all':!![]}];}return db[_0x94b1('0x15')][_0x94b1('0x3a')](_0x3a6ae0);})[_0x94b1('0xe')](function(_0x3e5b02){_0x2d33dc[_0x94b1('0x3b')]=_0x3e5b02;return _0x2d33dc;})[_0x94b1('0xe')](respondWithFilteredResult(_0x224099,_0x3a6ae0))[_0x94b1('0x3c')](handleError(_0x224099,null));};exports[_0x94b1('0x3d')]=function(_0x2d6f38,_0x32d009){var _0xfb5e55={'raw':!![],'where':{'id':_0x2d6f38['params']['id']}},_0x235a44={};_0x235a44[_0x94b1('0x19')]=_[_0x94b1('0x1b')](db[_0x94b1('0x15')][_0x94b1('0x16')]);_0x235a44[_0x94b1('0x1a')]=_['keys'](_0x2d6f38[_0x94b1('0x1a')]);_0x235a44[_0x94b1('0x1c')]=_[_0x94b1('0x1d')](_0x235a44[_0x94b1('0x19')],_0x235a44[_0x94b1('0x1a')]);_0xfb5e55[_0x94b1('0x2e')]=_['intersection'](_0x235a44[_0x94b1('0x19')],qs[_0x94b1('0x2f')](_0x2d6f38['query'][_0x94b1('0x2f')]));_0xfb5e55[_0x94b1('0x2e')]=_0xfb5e55['attributes'][_0x94b1('0x3e')]?_0xfb5e55[_0x94b1('0x2e')]:_0x235a44[_0x94b1('0x19')];if(_0x2d6f38['query'][_0x94b1('0x3f')]){_0xfb5e55[_0x94b1('0x39')]=[{'all':!![]}];}_0xfb5e55=_[_0x94b1('0x40')]({},_0xfb5e55,_0x2d6f38[_0x94b1('0x38')]);return db[_0x94b1('0x15')][_0x94b1('0x41')](_0xfb5e55)[_0x94b1('0xe')](handleEntityNotFound(_0x32d009,null))['then'](respondWithResult(_0x32d009,null))[_0x94b1('0x3c')](handleError(_0x32d009,null));};exports[_0x94b1('0x42')]=function(_0x163b8e,_0x4f023d){return db[_0x94b1('0x15')][_0x94b1('0x42')](_0x163b8e['body'],{})[_0x94b1('0xe')](respondWithResult(_0x4f023d,0xc9))[_0x94b1('0x3c')](handleError(_0x4f023d,null));};exports[_0x94b1('0xd')]=function(_0x4755c5,_0x13ec08){if(_0x4755c5[_0x94b1('0x43')]['id']){delete _0x4755c5[_0x94b1('0x43')]['id'];}return db[_0x94b1('0x15')][_0x94b1('0x41')]({'where':{'id':_0x4755c5[_0x94b1('0x44')]['id']}})[_0x94b1('0xe')](handleEntityNotFound(_0x13ec08,null))[_0x94b1('0xe')](saveUpdates(_0x4755c5[_0x94b1('0x43')],null))[_0x94b1('0xe')](respondWithResult(_0x13ec08,null))[_0x94b1('0x3c')](handleError(_0x13ec08,null));};exports[_0x94b1('0x45')]=function(_0xfe1c8f,_0x2b22ee){return db[_0x94b1('0x15')]['describe']()[_0x94b1('0xe')](respondWithResult(_0x2b22ee,null))['catch'](handleError(_0x2b22ee,null));};exports[_0x94b1('0x46')]=function(_0x3fc0fc,_0x1d8e57){var _0x54fc33;var _0x4dacb2=_0x3fc0fc['params']['id'];return db[_0x94b1('0x15')][_0x94b1('0x41')]({'where':{'id':_0x3fc0fc[_0x94b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d8e57,null))['then'](function(_0x4d2af3){if(_0x4d2af3){return _0x4d2af3[_0x94b1('0x46')]()[_0x94b1('0xe')](function(_0xbfd51b){return _0xbfd51b;});}})[_0x94b1('0xe')](function(_0x4109ca){_0x54fc33=_0x4109ca;if(_0x4109ca){if(_0x4109ca[_0x94b1('0x47')]||_0x4109ca[_0x94b1('0x48')]){return db[_0x4109ca['VoiceQueueId']?_0x94b1('0x49'):_0x94b1('0x4a')][_0x94b1('0x41')]({'where':{'id':_0x4109ca[_0x94b1('0x47')]?_0x4109ca[_0x94b1('0x47')]:_0x4109ca[_0x94b1('0x48')]},'attributes':['id',_0x94b1('0x11')],'raw':!![]});}}})[_0x94b1('0xe')](function(_0x37aa72){var _0x252a63={};if(_0x37aa72){_[_0x94b1('0x40')](_0x252a63,_[_0x94b1('0x4b')](_0x54fc33[_0x94b1('0x4c')],[_0x94b1('0x4d'),'updatedAt','id']));_0x252a63[_0x94b1('0x4e')]=0x15;_0x252a63[_0x94b1('0x4f')]=_0x94b1('0x50');_0x252a63[_0x94b1('0x51')]=_0x37aa72[_0x94b1('0x11')];_0x252a63[_0x94b1('0x52')]=_0x3fc0fc[_0x94b1('0x53')][_0x94b1('0x11')];_0x252a63[_0x94b1('0x54')]=_0x3fc0fc['user']['id'];_0x252a63[_0x94b1('0x50')]=!![];_0x252a63[_0x94b1('0x55')]=moment()[_0x94b1('0x56')](_0x94b1('0x57'));_0x252a63[_0x94b1('0x58')]=_0x54fc33[_0x94b1('0x59')];_0x252a63['campaigntype']=_0x54fc33[_0x94b1('0x47')]?_0x94b1('0x5a'):_0x94b1('0x5b');return db[_0x94b1('0x5c')][_0x94b1('0x41')]({'where':{'id':_0x252a63[_0x94b1('0x5d')]},'attributes':[_0x94b1('0x5e'),_0x94b1('0x5f')]})[_0x94b1('0xe')](function(_0x502d2c){if(!_['isNil'](_0x1d8e57)&&!_[_0x94b1('0x60')](_0x502d2c[_0x94b1('0x5e')])){_0x252a63[_0x94b1('0x61')]=_0x502d2c[_0x94b1('0x5e')];if(!_[_0x94b1('0x60')](_0x502d2c[_0x94b1('0x5f')])){_0x252a63[_0x94b1('0x61')]+='\x20'+_0x502d2c[_0x94b1('0x5f')];}}})[_0x94b1('0x62')](function(){return db[_0x94b1('0x63')][_0x94b1('0x42')](_0x252a63);});}})[_0x94b1('0xe')](function(_0x4d22ac){return db['CmHopperAdditionalPhone'][_0x94b1('0x46')]({'where':{'CmHopperId':_0x4dacb2}});})[_0x94b1('0xe')](function(){return _0x1d8e57[_0x94b1('0x5')](0xcc)[_0x94b1('0x64')]();})[_0x94b1('0x3c')](handleError(_0x1d8e57,null));};exports['getPreview']=function(_0x249c48,_0x478117){var _0x37e951=[];return db[_0x94b1('0x5c')][_0x94b1('0x45')]()['then'](function(_0x576a6d){_0x37e951=_[_0x94b1('0x1b')](_0x576a6d);return _0x249c48[_0x94b1('0x53')][_0x94b1('0x65')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x94b1('0x66')},'attributes':['id',_0x94b1('0x67'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0xca90cf){if(_0xca90cf&&_0xca90cf[_0x94b1('0x3e')]){return db[_0x94b1('0x68')][_0x94b1('0x69')](function(_0x282081){var _0x1c0013={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x94b1('0x56')](_0x94b1('0x57'))},'VoiceQueueId':{'$in':_['map'](_0xca90cf,'id')},'$or':[{'UserId':null},{'UserId':_0x249c48[_0x94b1('0x53')]['id']}]};var _0x4a26cc={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xca90cf)[_0x94b1('0x36')]([_0x94b1('0x6a'),0x0])[_0x94b1('0x14')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x249c48[_0x94b1('0x53')]['id']}]};var _0x5b1340={'$or':[_0x1c0013,_0x4a26cc]};var _0x5615c8=[];if(_0x249c48[_0x94b1('0x43')][_0x94b1('0x6b')]&&_0x249c48[_0x94b1('0x43')][_0x94b1('0x6b')]==='prev'){if(!_['isEmpty'](_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')])){_0x5b1340['id']={'$in':_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')]};}_0x5615c8=[[_0x94b1('0x6d'),_0x94b1('0x6e')],[_0x94b1('0x6f'),_0xca90cf[0x0][_0x94b1('0x67')]==='ASC'?'DESC':_0x94b1('0x6e')],db['sequelize'][_0x94b1('0x70')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x94b1('0x71')]];}else{if(!_[_0x94b1('0x72')](_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')])){_0x5b1340['id']={'$notIn':_0x249c48[_0x94b1('0x43')][_0x94b1('0x6c')]};}_0x5615c8=[['priority',_0x94b1('0x71')],[_0x94b1('0x6f'),_0xca90cf[0x0][_0x94b1('0x67')]],db[_0x94b1('0x68')][_0x94b1('0x70')](_0x94b1('0x73')),['id',_0x94b1('0x6e')]];}return db['CmHopper'][_0x94b1('0x74')]({'attributes':['id',_0x94b1('0x75'),_0x94b1('0x59'),_0x94b1('0x76')],'where':_0x5b1340,'order':_0x5615c8,'transaction':_0x282081,'lock':_0x282081[_0x94b1('0x77')][_0x94b1('0x78')],'include':[{'model':db[_0x94b1('0x5c')],'as':'Contact','attributes':_0x37e951,'include':[{'model':db[_0x94b1('0x79')],'as':'Company','attributes':['id',_0x94b1('0x11')]}]},{'model':db[_0x94b1('0x7a')],'as':_0x94b1('0x7b'),'attributes':['id',_0x94b1('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x94b1('0x11'),_0x94b1('0x7c')]}]})['then'](function(_0xe48788){if(_0xe48788){return _0xe48788[_0x94b1('0xd')]({'UserId':_0x249c48[_0x94b1('0x53')]['id']},{'transaction':_0x282081});}});});}})['then'](handleEntityNotFound(_0x478117,null))[_0x94b1('0xe')](respondWithResult(_0x478117,null))[_0x94b1('0x3c')](handleError(_0x478117,null));};exports[_0x94b1('0x7d')]=function(_0x219939,_0x48472c,_0x46893d){var _0x486841=[];var _0x53faf9=_0x219939['params']['id'];var _0x2f05d5=_0x219939[_0x94b1('0x53')]['id'];return db[_0x94b1('0x5c')]['describe']()['then'](function(_0x587099){_0x486841=_[_0x94b1('0x1b')](_0x587099);return db[_0x94b1('0x68')]['transaction'](function(_0x5edb29){const _0x4c2a00={'id':_0x53faf9};return db[_0x94b1('0x15')][_0x94b1('0x74')]({'attributes':['id',_0x94b1('0x75'),_0x94b1('0x76')],'where':_0x4c2a00,'transaction':_0x5edb29,'lock':_0x5edb29['LOCK']['UPDATE'],'include':[{'model':db[_0x94b1('0x5c')],'as':_0x94b1('0x7e'),'attributes':_0x486841,'include':[{'model':db[_0x94b1('0x79')],'as':_0x94b1('0x7f'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x94b1('0x11')]},{'model':db[_0x94b1('0x49')],'as':_0x94b1('0x80'),'attributes':['id',_0x94b1('0x11'),_0x94b1('0x7c')]}]})['then'](function(_0xc2894f){if(_0xc2894f){return _0xc2894f[_0x94b1('0xd')]({'UserId':_0x2f05d5},{'transaction':_0x5edb29});}});});})['then'](handleEntityNotFound(_0x48472c,null))[_0x94b1('0xe')](respondWithResult(_0x48472c,null))['catch'](handleError(_0x48472c,null));};exports['getOpenContacts']=function(_0x416055,_0x5edac4){return _0x416055[_0x94b1('0x53')][_0x94b1('0x65')]({'where':{'type':_0x94b1('0x81'),'dialActive':!![],'dialMethod':_0x94b1('0x66')},'attributes':['id'],'raw':!![]})[_0x94b1('0xe')](function(_0x4f182c){if(_0x4f182c&&_0x4f182c[_0x94b1('0x3e')]){return db['CmHopper'][_0x94b1('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x94b1('0x56')](_0x94b1('0x57'))},'VoiceQueueId':{'$in':_['map'](_0x4f182c,'id')},'$or':[{'UserId':null},{'UserId':_0x416055[_0x94b1('0x53')]['id']}]}});}return 0x0;})[_0x94b1('0xe')](function(_0x59f77a){if(!_['isNil'](_0x59f77a)&&_[_0x94b1('0x82')](_0x59f77a)){return _0x5edac4[_0x94b1('0x5')](0xc8)[_0x94b1('0x6')]({'contacts':_0x59f77a});}else{logger[_0x94b1('0xf')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x94b1('0x83'),0x194,'entity\x20not\x20found');_0x5edac4[_0x94b1('0x84')](0x194);}})['catch'](handleError(_0x5edac4,null));};exports[_0x94b1('0x85')]=function(_0x4ba865,_0x497c2f){var _0x3f0958=shared[_0x94b1('0x86')];var _0x594bbd=[];_[_0x94b1('0x14')](_0x3f0958,function(_0x1b9a5d){_0x594bbd[_0x94b1('0x87')]({'id':_0x1b9a5d['name'],'name':_0x1b9a5d[_0x94b1('0x11')],'utcOffset':_0x1b9a5d[_0x94b1('0x88')]});});return _0x497c2f[_0x94b1('0x5')](0xc8)['json']({'tz':_0x594bbd});};exports[_0x94b1('0x89')]=function(_0x4d6c7e,_0x595ae3){var _0x238963=shared['timezones'];var _0x3ca231={};if(!_['isNil'](_0x238963[_0x4d6c7e[_0x94b1('0x43')]['id']]))_0x3ca231=_0x238963[_0x4d6c7e['body']['id']];return _0x595ae3[_0x94b1('0x5')](0xc8)['json'](_0x3ca231);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f96fe52..14be372 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 _0x9536=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x9536,0x179));var _0x6953=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0x9536[_0x4a82ac];return _0x58ee97;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['scheduledat']},{'name':_0x6953('0xe'),'fields':[_0x6953('0xe')]},{'name':_0x6953('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['util','../../config/logger','api','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','phone'];(function(_0x41dc94,_0x23a113){var _0x511001=function(_0x3ec848){while(--_0x3ec848){_0x41dc94['push'](_0x41dc94['shift']());}};_0x511001(++_0x23a113);}(_0x038b,0x114));var _0xb038=function(_0x497061,_0x155956){_0x497061=_0x497061-0x0;var _0x3fe996=_0x038b[_0x497061];return _0x3fe996;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xb038('0xb'),'fields':[_0xb038('0xb')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 3af1985..c6c495b 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 _0x55ea=['stringify','catch','error','message','ShowCmHopper','find','raw','then','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','all','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','CmList','List','NOW()','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','where','limit','include','model','map','attributes','info','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55ea,0xe2));var _0xa55e=function(_0x37e5dc,_0x192876){_0x37e5dc=_0x37e5dc-0x0;var _0x58a75b=_0x55ea[_0x37e5dc];return _0x58a75b;};'use strict';var _=require('lodash');var util=require(_0xa55e('0x0'));var moment=require(_0xa55e('0x1'));var BPromise=require(_0xa55e('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xa55e('0x3'))(_0xa55e('0x4'));exports[_0xa55e('0x5')]=function(_0x4457be){var _0x19692d=this;return new Promise(function(_0x251008,_0x98857c){return db[_0xa55e('0x6')][_0xa55e('0x7')]({'raw':_0x4457be[_0xa55e('0x8')]?_0x4457be['options']['raw']===undefined?!![]:![]:!![],'where':_0x4457be[_0xa55e('0x8')]?_0x4457be[_0xa55e('0x8')][_0xa55e('0x9')]||null:null,'attributes':_0x4457be[_0xa55e('0x8')]?_0x4457be['options']['attributes']||null:null,'limit':_0x4457be[_0xa55e('0x8')]?_0x4457be['options'][_0xa55e('0xa')]||null:null,'include':_0x4457be['options']?_0x4457be[_0xa55e('0x8')]['include']?_['map'](_0x4457be['options'][_0xa55e('0xb')],function(_0x49c5b7){return{'model':db[_0x49c5b7[_0xa55e('0xc')]],'as':_0x49c5b7['as'],'attributes':_0x49c5b7['attributes'],'include':_0x49c5b7[_0xa55e('0xb')]?_['map'](_0x49c5b7[_0xa55e('0xb')],function(_0x2c26d5){return{'model':db[_0x2c26d5[_0xa55e('0xc')]],'as':_0x2c26d5['as'],'attributes':_0x2c26d5['attributes'],'include':_0x2c26d5[_0xa55e('0xb')]?_[_0xa55e('0xd')](_0x2c26d5[_0xa55e('0xb')],function(_0x312032){return{'model':db[_0x312032[_0xa55e('0xc')]],'as':_0x312032['as'],'attributes':_0x312032[_0xa55e('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x325287){logger[_0xa55e('0xf')](_0xa55e('0x5'),_0x4457be);logger[_0xa55e('0x10')](_0xa55e('0x5'),_0x4457be,JSON[_0xa55e('0x11')](_0x325287));_0x251008(_0x325287);})[_0xa55e('0x12')](function(_0x2c42e0){logger[_0xa55e('0x13')](_0xa55e('0x5'),_0x2c42e0['message'],_0x4457be);_0x98857c(_0x19692d['error'](0x1f4,_0x2c42e0[_0xa55e('0x14')]));});});};exports[_0xa55e('0x15')]=function(_0x3dfec5){var _0x4ded05=this;return new Promise(function(_0x1a7d66,_0x3d821c){return db[_0xa55e('0x6')][_0xa55e('0x16')]({'raw':_0x3dfec5[_0xa55e('0x8')]?_0x3dfec5['options'][_0xa55e('0x17')]===undefined?!![]:![]:!![],'where':_0x3dfec5[_0xa55e('0x8')]?_0x3dfec5[_0xa55e('0x8')]['where']||null:null,'attributes':_0x3dfec5[_0xa55e('0x8')]?_0x3dfec5[_0xa55e('0x8')]['attributes']||null:null,'include':_0x3dfec5[_0xa55e('0x8')]?_0x3dfec5[_0xa55e('0x8')]['include']?_[_0xa55e('0xd')](_0x3dfec5[_0xa55e('0x8')][_0xa55e('0xb')],function(_0x36dc48){return{'model':db[_0x36dc48[_0xa55e('0xc')]],'as':_0x36dc48['as'],'attributes':_0x36dc48[_0xa55e('0xe')],'include':_0x36dc48[_0xa55e('0xb')]?_[_0xa55e('0xd')](_0x36dc48['include'],function(_0x5be330){return{'model':db[_0x5be330['model']],'as':_0x5be330['as'],'attributes':_0x5be330[_0xa55e('0xe')],'include':_0x5be330[_0xa55e('0xb')]?_[_0xa55e('0xd')](_0x5be330['include'],function(_0x1efe69){return{'model':db[_0x1efe69[_0xa55e('0xc')]],'as':_0x1efe69['as'],'attributes':_0x1efe69[_0xa55e('0xe')]};}):[]};}):[]};}):[]:[]})[_0xa55e('0x18')](function(_0x2dc325){logger[_0xa55e('0xf')](_0xa55e('0x15'),_0x3dfec5);logger[_0xa55e('0x10')](_0xa55e('0x15'),_0x3dfec5,JSON[_0xa55e('0x11')](_0x2dc325));_0x1a7d66(_0x2dc325);})[_0xa55e('0x12')](function(_0x4b82d1){logger[_0xa55e('0x13')](_0xa55e('0x15'),_0x4b82d1[_0xa55e('0x14')],_0x3dfec5);_0x3d821c(_0x4ded05[_0xa55e('0x13')](0x1f4,_0x4b82d1[_0xa55e('0x14')]));});});};exports[_0xa55e('0x19')]=function(_0x5e70f6){var _0x1e3c65=this;return new Promise(function(_0x30692b,_0x3049b5){return db[_0xa55e('0x6')][_0xa55e('0x1a')](_0x5e70f6['body'],{'raw':_0x5e70f6['options']?_0x5e70f6['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x58bed9){logger['info']('CreateCmHopper',_0x5e70f6);logger['debug']('CreateCmHopper',_0x5e70f6,JSON[_0xa55e('0x11')](_0x58bed9));_0x30692b(_0x58bed9);})['catch'](function(_0x371de0){logger['error'](_0xa55e('0x19'),_0x371de0[_0xa55e('0x14')],_0x5e70f6);_0x3049b5(_0x1e3c65[_0xa55e('0x13')](0x1f4,_0x371de0[_0xa55e('0x14')]));});});};exports[_0xa55e('0x1b')]=function(_0x1f48a8){var _0x3f5809=this;return new Promise(function(_0x121dba,_0x54e20a){return db[_0xa55e('0x6')][_0xa55e('0x1c')](_0x1f48a8[_0xa55e('0x1d')],{'raw':_0x1f48a8[_0xa55e('0x8')]?_0x1f48a8['options'][_0xa55e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f48a8['options']?_0x1f48a8[_0xa55e('0x8')][_0xa55e('0x9')]||null:null,'attributes':_0x1f48a8[_0xa55e('0x8')]?_0x1f48a8[_0xa55e('0x8')][_0xa55e('0xe')]||null:null,'limit':_0x1f48a8['options']?_0x1f48a8[_0xa55e('0x8')]['limit']||null:null})[_0xa55e('0x18')](function(_0x52abec){logger[_0xa55e('0xf')](_0xa55e('0x1b'),_0x1f48a8);logger['info'](_0xa55e('0x1e'),JSON[_0xa55e('0x11')](_0x1f48a8[_0xa55e('0x8')][_0xa55e('0x9')]),_0x1f48a8[_0xa55e('0x1d')][_0xa55e('0x1f')]);logger[_0xa55e('0x10')](_0xa55e('0x1b'),_0x1f48a8,JSON['stringify'](_0x52abec));_0x121dba(_0x52abec);})[_0xa55e('0x12')](function(_0x49e2ac){logger[_0xa55e('0x13')](_0xa55e('0x1b'),_0x49e2ac['message'],_0x1f48a8);_0x54e20a(_0x3f5809[_0xa55e('0x13')](0x1f4,_0x49e2ac[_0xa55e('0x14')]));});});};exports['DestroyCmHopper']=function(_0x39f132){var _0x5169dc=this;return new Promise(function(_0x6d1711,_0x3f9a23){return db[_0xa55e('0x6')]['destroy']({'where':_0x39f132[_0xa55e('0x8')]?_0x39f132[_0xa55e('0x8')][_0xa55e('0x9')]||null:null})[_0xa55e('0x18')](function(_0x2e1eaa){logger[_0xa55e('0xf')](_0xa55e('0x20'),_0x39f132);logger[_0xa55e('0x10')](_0xa55e('0x20'),_0x39f132,JSON[_0xa55e('0x11')](_0x2e1eaa));_0x6d1711(_0x2e1eaa);})['catch'](function(_0x76847a){logger[_0xa55e('0x13')](_0xa55e('0x20'),_0x76847a['message'],_0x39f132);_0x3f9a23(_0x5169dc['error'](0x1f4,_0x76847a[_0xa55e('0x14')]));});});};exports[_0xa55e('0x21')]=function(_0x59d75f){var _0x19e63f=this;return new Promise(function(_0x274149,_0xd66d6d){return db[_0xa55e('0x22')][_0xa55e('0x23')]()['then'](function(_0x121168){return db[_0xa55e('0x24')][_0xa55e('0x25')](function(_0x37a623){return db[_0xa55e('0x6')]['findAll']({'where':_0x59d75f[_0xa55e('0x8')]?_0x59d75f['options'][_0xa55e('0x9')]||null:null,'attributes':_0x59d75f[_0xa55e('0x8')]?_0x59d75f[_0xa55e('0x8')][_0xa55e('0xe')]||null:null,'limit':_0x59d75f[_0xa55e('0x8')]?_0x59d75f[_0xa55e('0x8')][_0xa55e('0xa')]||null:null,'order':_0x59d75f[_0xa55e('0x8')]?_0x59d75f[_0xa55e('0x8')][_0xa55e('0x26')]||null:null,'transaction':_0x37a623,'lock':_0x37a623[_0xa55e('0x27')][_0xa55e('0x28')],'include':[{'model':db[_0xa55e('0x22')],'as':_0xa55e('0x29'),'attributes':_[_0xa55e('0x2a')](_0x121168)},{'model':db[_0xa55e('0x2b')],'as':_0xa55e('0x2c'),'attributes':['id',_0xa55e('0x2d'),_0xa55e('0x2e')]}]})[_0xa55e('0x18')](function(_0x82c8a3){var _0xad0d35=[];var _0x137300=[];for(var _0x314054=0x0;_0x314054<_0x82c8a3[_0xa55e('0x2f')];_0x314054+=0x1){var _0x1a50d7=_0x82c8a3[_0x314054][_0xa55e('0x30')];if(_0x1a50d7===null){_0xad0d35[_0xa55e('0x31')](_0x82c8a3[_0x314054][_0xa55e('0x1c')](_0x59d75f['body'],{'transaction':_0x37a623}));}else if(!_0x137300[_0xa55e('0x32')](_0x1a50d7)){_0x137300[_0xa55e('0x31')](_0x1a50d7);_0xad0d35[_0xa55e('0x31')](_0x82c8a3[_0x314054][_0xa55e('0x1c')](_0x59d75f[_0xa55e('0x1d')],{'transaction':_0x37a623}));}}return BPromise['all'](_0xad0d35);});})[_0xa55e('0x18')](function(_0x3d8a76){logger[_0xa55e('0xf')](_0xa55e('0x21'),_0x59d75f);if(_0x3d8a76[_0xa55e('0x2f')]>0x0){logger[_0xa55e('0xf')](_0xa55e('0x33'),_0x3d8a76[0x0][_0xa55e('0x34')]['id'],_0x3d8a76[0x0]['dataValues'][_0xa55e('0x35')],_0x3d8a76[0x0][_0xa55e('0x34')][_0xa55e('0x1f')]);}logger[_0xa55e('0x10')](_0xa55e('0x21'),_0x59d75f,JSON['stringify'](_0x3d8a76));_0x274149(_0x3d8a76);})[_0xa55e('0x12')](function(_0x359726){logger['error']('GetContactDialer',_0x359726['message'],_0x59d75f);_0xd66d6d(_0x19e63f[_0xa55e('0x13')](0x1f4,_0x359726[_0xa55e('0x14')]));});});});};exports[_0xa55e('0x36')]=function(_0x11c336){var _0x296a12=this;return new Promise(function(_0x157fb0,_0x472f15){return db[_0xa55e('0x24')][_0xa55e('0x25')](function(_0x3ebe58){return db[_0xa55e('0x37')][_0xa55e('0x1a')](_0x11c336[_0xa55e('0x1d')],{'raw':_0x11c336[_0xa55e('0x8')]?_0x11c336['options'][_0xa55e('0x17')]===undefined?!![]:![]:!![],'transaction':_0x3ebe58})['then'](function(){logger[_0xa55e('0xf')](_0xa55e('0x38'),JSON[_0xa55e('0x11')](_0x11c336[_0xa55e('0x8')][_0xa55e('0x9')]),_0x11c336[_0xa55e('0x8')]['where'][_0xa55e('0x1f')]);return db[_0xa55e('0x6')][_0xa55e('0x39')]({'where':_0x11c336['options']?_0x11c336['options']['where']||null:null,'transaction':_0x3ebe58});});})[_0xa55e('0x18')](function(_0x2eafc0){logger[_0xa55e('0xf')](_0xa55e('0x36'),_0x11c336);logger[_0xa55e('0x10')]('MoveContactManagedDialer',_0x11c336,JSON[_0xa55e('0x11')](_0x2eafc0));_0x157fb0(_0x2eafc0);})[_0xa55e('0x12')](function(_0x581375){logger[_0xa55e('0x13')](_0xa55e('0x36'),_0x581375[_0xa55e('0x14')],_0x11c336);_0x472f15(_0x296a12[_0xa55e('0x13')](0x1f4,_0x581375[_0xa55e('0x14')]));});});};exports[_0xa55e('0x3a')]=function(_0x40429e){var _0x1b640a=this;return new Promise(function(_0x108342,_0x4fdfd2){return db[_0xa55e('0x6')][_0xa55e('0x7')]({'raw':_0x40429e[_0xa55e('0x8')]?_0x40429e['options'][_0xa55e('0x17')]===undefined?!![]:![]:!![],'where':_0x40429e['options']?_0x40429e[_0xa55e('0x8')]['where']||null:null,'attributes':[[db[_0xa55e('0x24')]['fn'](_0xa55e('0x3b'),db['sequelize']['fn']('IF',db['sequelize'][_0xa55e('0x3c')]('`scheduledat`\x20>=\x20'+util['format']('\x22%s\x22',moment()[_0xa55e('0x3d')](_0xa55e('0x3e')))+_0xa55e('0x3f')))),'contactsRescheduled']]})[_0xa55e('0x18')](function(_0x4b9735){logger[_0xa55e('0xf')](_0xa55e('0x3a'),_0x40429e);logger[_0xa55e('0x10')](_0xa55e('0x3a'),_0x40429e,JSON[_0xa55e('0x11')](_0x4b9735));_0x108342(_0x4b9735);})[_0xa55e('0x12')](function(_0x4905eb){logger[_0xa55e('0x13')](_0xa55e('0x3a'),_0x4905eb[_0xa55e('0x14')],_0x40429e);_0x4fdfd2(_0x1b640a[_0xa55e('0x13')](0x1f4,_0x4905eb['message']));});});};exports['GetContactRecallMe']=function(_0x5013ab){var _0x5c47d9=this;return new Promise(function(_0x33f87d,_0x69806b){return db[_0xa55e('0x22')][_0xa55e('0x23')]()[_0xa55e('0x18')](function(){return db[_0xa55e('0x24')][_0xa55e('0x25')](function(_0x140882){return db[_0xa55e('0x6')][_0xa55e('0x7')]({'where':_0x5013ab['options']?_0x5013ab[_0xa55e('0x8')][_0xa55e('0x9')]||null:null,'attributes':_0x5013ab['options']?_0x5013ab['options']['attributes']||null:null,'limit':0x1,'order':_0x5013ab[_0xa55e('0x8')]?_0x5013ab[_0xa55e('0x8')][_0xa55e('0x26')]||null:null,'group':db[_0xa55e('0x6')]['UserId'],'transaction':_0x140882,'lock':_0x140882[_0xa55e('0x27')][_0xa55e('0x28')],'include':_0x5013ab[_0xa55e('0x8')]?_0x5013ab[_0xa55e('0x8')][_0xa55e('0xb')]?_[_0xa55e('0xd')](_0x5013ab[_0xa55e('0x8')]['include'],function(_0x9c9e61){return{'model':db[_0x9c9e61[_0xa55e('0xc')]],'as':_0x9c9e61['as'],'attributes':_0x9c9e61[_0xa55e('0xe')],'include':_0x9c9e61[_0xa55e('0xb')]?_[_0xa55e('0xd')](_0x9c9e61[_0xa55e('0xb')],function(_0x2859ad){return{'model':db[_0x2859ad[_0xa55e('0xc')]],'as':_0x2859ad['as'],'attributes':_0x2859ad[_0xa55e('0xe')],'include':_0x2859ad[_0xa55e('0xb')]?_[_0xa55e('0xd')](_0x2859ad['include'],function(_0x1dd648){return{'model':db[_0x1dd648[_0xa55e('0xc')]],'as':_0x1dd648['as'],'attributes':_0x1dd648[_0xa55e('0xe')]};}):[]};}):[]};}):[]:[]})[_0xa55e('0x18')](function(_0x204aa1){var _0x4cbb8d=[];for(var _0x24872b=0x0;_0x24872b<_0x204aa1['length'];_0x24872b+=0x1){_0x4cbb8d[_0xa55e('0x31')](_0x204aa1[_0x24872b]['update'](_0x5013ab['body'],{'transaction':_0x140882}));}return BPromise[_0xa55e('0x40')](_0x4cbb8d);});})[_0xa55e('0x18')](function(_0x353027){logger[_0xa55e('0xf')](_0xa55e('0x41'),_0x5013ab);logger[_0xa55e('0x10')](_0xa55e('0x41'),_0x5013ab,JSON[_0xa55e('0x11')](_0x353027));_0x33f87d(_0x353027);})[_0xa55e('0x12')](function(_0x5f3403){logger['error'](_0xa55e('0x41'),_0x5f3403[_0xa55e('0x14')],_0x5013ab);_0x69806b(_0x5c47d9[_0xa55e('0x13')](0x1f4,_0x5f3403[_0xa55e('0x14')]));});});});};exports[_0xa55e('0x42')]=function(_0xe5cd7f){var _0x4f3236=this;return new Promise(function(_0xd4a2d4,_0x101b0d){db['CmContact']['describe']()[_0xa55e('0x18')](function(_0x18352b){return db['CmHopper'][_0xa55e('0x7')]({'raw':_0xe5cd7f['options']?_0xe5cd7f[_0xa55e('0x8')][_0xa55e('0x17')]===undefined?!![]:![]:!![],'where':_0xe5cd7f[_0xa55e('0x8')]?_0xe5cd7f['options'][_0xa55e('0x9')]||null:null,'attributes':_0xe5cd7f['options']?_0xe5cd7f['options'][_0xa55e('0xe')]||null:null,'limit':_0xe5cd7f[_0xa55e('0x8')]?_0xe5cd7f[_0xa55e('0x8')]['limit']||null:null,'include':_0xe5cd7f['options']?_0xe5cd7f[_0xa55e('0x8')]['include']?_[_0xa55e('0xd')](_0xe5cd7f[_0xa55e('0x8')][_0xa55e('0xb')],function(_0x44422b){return{'model':db[_0x44422b[_0xa55e('0xc')]],'as':_0x44422b['as'],'attributes':_0x44422b['as']===_0xa55e('0x29')?_[_0xa55e('0x2a')](_0x18352b):_0x44422b[_0xa55e('0xe')],'include':_0x44422b['include']?_[_0xa55e('0xd')](_0x44422b['include'],function(_0x3e2e29){return{'model':db[_0x3e2e29[_0xa55e('0xc')]],'as':_0x3e2e29['as'],'attributes':_0x3e2e29['attributes'],'include':_0x3e2e29[_0xa55e('0xb')]?_['map'](_0x3e2e29[_0xa55e('0xb')],function(_0x185d76){return{'model':db[_0x185d76[_0xa55e('0xc')]],'as':_0x185d76['as'],'attributes':_0x185d76[_0xa55e('0xe')]};}):[]};}):[]};}):[]:[]})[_0xa55e('0x18')](function(_0x4ad6e7){logger[_0xa55e('0xf')](_0xa55e('0x5'),_0xe5cd7f);logger[_0xa55e('0x10')](_0xa55e('0x5'),_0xe5cd7f,JSON[_0xa55e('0x11')](_0x4ad6e7));_0xd4a2d4(_0x4ad6e7);})['catch'](function(_0x5f55ce){logger[_0xa55e('0x13')](_0xa55e('0x5'),_0x5f55ce[_0xa55e('0x14')],_0xe5cd7f);_0x101b0d(_0x4f3236[_0xa55e('0x13')](0x1f4,_0x5f55ce['message']));});});});};exports[_0xa55e('0x43')]=function(_0x10ee14){var _0x231ea8=this;return new Promise(function(_0x5383f5,_0x196c33){return db[_0xa55e('0x22')]['findOne']({'raw':!![],'where':{'phone':_0x10ee14['options']['where'][_0xa55e('0x44')]},'attributes':['id',_0xa55e('0x45')],'order':[['id',_0xa55e('0x46')]]})[_0xa55e('0x18')](function(_0x3d9892){logger['info'](_0xa55e('0x47'),_0x10ee14);logger[_0xa55e('0x10')](_0xa55e('0x47'),_0x10ee14,JSON['stringify'](_0x3d9892));_0x5383f5(_0x3d9892);})[_0xa55e('0x12')](function(_0x217a29){logger[_0xa55e('0x13')]('getContactByPhone',_0x217a29['message'],_0x10ee14);_0x196c33(_0x231ea8[_0xa55e('0x13')](0x1f4,_0x217a29[_0xa55e('0x14')]));});});};exports['ResetActiveCalls']=function(_0x1bb653){var _0x247ccb=this;return new Promise(function(_0x43b155,_0x90ffa2){return db[_0xa55e('0x24')][_0xa55e('0x25')](function(_0x193426){var _0x634b47=_0x1bb653[_0xa55e('0x8')]&&_0x1bb653[_0xa55e('0x8')][_0xa55e('0x9')]?_0x1bb653[_0xa55e('0x8')][_0xa55e('0x9')]:{};return db['CmHopper']['update'](_0x1bb653[_0xa55e('0x1d')],{'where':_0x634b47,'transaction':_0x193426})[_0xa55e('0x18')](function(_0x21c746){logger['info']('ResetActiveCalls',_0x1bb653);logger['debug'](_0xa55e('0x48'),_0x1bb653,JSON[_0xa55e('0x11')](_0x21c746));_0x43b155(_0x21c746);})[_0xa55e('0x12')](function(_0x50d6b7){logger['error'](_0xa55e('0x48'),_0x50d6b7[_0xa55e('0x14')],_0x1bb653);_0x90ffa2(_0x247ccb[_0xa55e('0x13')](0x1f4,_0x50d6b7[_0xa55e('0x14')]));});});});};exports[_0xa55e('0x49')]=function(_0x11de8f){var _0x17cbe7=this;var _0x5b8d33=_0x11de8f[_0xa55e('0x1d')][_0xa55e('0x9')][_0xa55e('0x4a')];var _0xecc1ac=_0x11de8f[_0xa55e('0x1d')][_0xa55e('0x9')][_0xa55e('0x4b')];var _0xcbacfa=_0x11de8f['body']['where'][_0xa55e('0x4c')];return new Promise(function(_0xf51512,_0xc317c0){return db[_0xa55e('0x6')][_0xa55e('0x7')]({'where':{'voiceQueueId':{'$in':_0x5b8d33},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xa55e('0x24')][_0xa55e('0x3c')](_0xa55e('0x4d')+_0xecc1ac+'\x20MINUTE'),'$gt':db[_0xa55e('0x24')][_0xa55e('0x3c')]('NOW()')}},'UserId':{'$in':_0xcbacfa}},'include':[{'model':db[_0xa55e('0x22')],'as':'Contact'},{'model':db[_0xa55e('0x2b')],'as':_0xa55e('0x2c'),'attributes':['id','name',_0xa55e('0x2e')]},{'model':db[_0xa55e('0x4e')],'as':_0xa55e('0x4f')}]})['then'](function(_0x1bb887){if(_0x1bb887[_0xa55e('0x2f')]>0x0){return db[_0xa55e('0x24')][_0xa55e('0x25')](function(_0x28caf4){return db[_0xa55e('0x6')]['update']({'recallmeNotifiedDate':db[_0xa55e('0x24')]['literal'](_0xa55e('0x50'))},{'where':{'id':{'$in':_['map'](_0x1bb887,'id')}},'transaction':_0x28caf4})[_0xa55e('0x18')](function(){_0xf51512(_0x1bb887);})[_0xa55e('0x12')](function(_0x2ed654){logger[_0xa55e('0x13')](_0xa55e('0x49'),_0x2ed654[_0xa55e('0x14')],_0x11de8f);_0xc317c0(_0x17cbe7[_0xa55e('0x13')](0x1f4,_0x2ed654[_0xa55e('0x14')]));});})['catch'](function(_0x7035ff){logger[_0xa55e('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x7035ff[_0xa55e('0x14')],_0x11de8f);_0xc317c0(_0x17cbe7[_0xa55e('0x13')](0x1f4,_0x7035ff[_0xa55e('0x14')]));});}else{_0xf51512(_0x1bb887);}});});}; \ No newline at end of file +var _0xbc6f=['CmHopperFinal','create','CountReScheduled','findAll','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','length','GetCmHopperPreview','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()','List','lodash','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','model','map','then','debug','stringify','catch','error','message','ShowCmHopper','find','info','CreateCmHopper','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','Contact','keys','User','Agent','name','UserId','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer'];(function(_0x27762b,_0x2d0c8e){var _0x2d81eb=function(_0x56aec5){while(--_0x56aec5){_0x27762b['push'](_0x27762b['shift']());}};_0x2d81eb(++_0x2d0c8e);}(_0xbc6f,0xf7));var _0xfbc6=function(_0x22a90a,_0x461cdd){_0x22a90a=_0x22a90a-0x0;var _0x511604=_0xbc6f[_0x22a90a];return _0x511604;};'use strict';var _=require(_0xfbc6('0x0'));var util=require(_0xfbc6('0x1'));var moment=require(_0xfbc6('0x2'));var BPromise=require(_0xfbc6('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xfbc6('0x4'))(_0xfbc6('0x5'));exports[_0xfbc6('0x6')]=function(_0x3822ec){var _0x2f51ef=this;return new Promise(function(_0x5047a6,_0x204fa7){return db[_0xfbc6('0x7')]['findAll']({'raw':_0x3822ec['options']?_0x3822ec[_0xfbc6('0x8')][_0xfbc6('0x9')]===undefined?!![]:![]:!![],'where':_0x3822ec[_0xfbc6('0x8')]?_0x3822ec[_0xfbc6('0x8')][_0xfbc6('0xa')]||null:null,'attributes':_0x3822ec[_0xfbc6('0x8')]?_0x3822ec['options'][_0xfbc6('0xb')]||null:null,'limit':_0x3822ec[_0xfbc6('0x8')]?_0x3822ec[_0xfbc6('0x8')][_0xfbc6('0xc')]||null:null,'include':_0x3822ec[_0xfbc6('0x8')]?_0x3822ec['options'][_0xfbc6('0xd')]?_['map'](_0x3822ec['options'][_0xfbc6('0xd')],function(_0x19168f){return{'model':db[_0x19168f['model']],'as':_0x19168f['as'],'attributes':_0x19168f[_0xfbc6('0xb')],'include':_0x19168f[_0xfbc6('0xd')]?_['map'](_0x19168f['include'],function(_0x107ee3){return{'model':db[_0x107ee3[_0xfbc6('0xe')]],'as':_0x107ee3['as'],'attributes':_0x107ee3[_0xfbc6('0xb')],'include':_0x107ee3[_0xfbc6('0xd')]?_[_0xfbc6('0xf')](_0x107ee3[_0xfbc6('0xd')],function(_0x1587c5){return{'model':db[_0x1587c5[_0xfbc6('0xe')]],'as':_0x1587c5['as'],'attributes':_0x1587c5[_0xfbc6('0xb')]};}):[]};}):[]};}):[]:[]})[_0xfbc6('0x10')](function(_0x228ce2){logger['info'](_0xfbc6('0x6'),_0x3822ec);logger[_0xfbc6('0x11')](_0xfbc6('0x6'),_0x3822ec,JSON[_0xfbc6('0x12')](_0x228ce2));_0x5047a6(_0x228ce2);})[_0xfbc6('0x13')](function(_0x5acf40){logger[_0xfbc6('0x14')]('GetCmHopper',_0x5acf40[_0xfbc6('0x15')],_0x3822ec);_0x204fa7(_0x2f51ef[_0xfbc6('0x14')](0x1f4,_0x5acf40[_0xfbc6('0x15')]));});});};exports[_0xfbc6('0x16')]=function(_0x254c18){var _0x355cc0=this;return new Promise(function(_0x51a938,_0x109782){return db['CmHopper'][_0xfbc6('0x17')]({'raw':_0x254c18[_0xfbc6('0x8')]?_0x254c18[_0xfbc6('0x8')][_0xfbc6('0x9')]===undefined?!![]:![]:!![],'where':_0x254c18[_0xfbc6('0x8')]?_0x254c18['options'][_0xfbc6('0xa')]||null:null,'attributes':_0x254c18[_0xfbc6('0x8')]?_0x254c18[_0xfbc6('0x8')][_0xfbc6('0xb')]||null:null,'include':_0x254c18['options']?_0x254c18[_0xfbc6('0x8')]['include']?_['map'](_0x254c18[_0xfbc6('0x8')][_0xfbc6('0xd')],function(_0x189321){return{'model':db[_0x189321[_0xfbc6('0xe')]],'as':_0x189321['as'],'attributes':_0x189321[_0xfbc6('0xb')],'include':_0x189321[_0xfbc6('0xd')]?_[_0xfbc6('0xf')](_0x189321[_0xfbc6('0xd')],function(_0x4d0365){return{'model':db[_0x4d0365[_0xfbc6('0xe')]],'as':_0x4d0365['as'],'attributes':_0x4d0365[_0xfbc6('0xb')],'include':_0x4d0365[_0xfbc6('0xd')]?_[_0xfbc6('0xf')](_0x4d0365[_0xfbc6('0xd')],function(_0xf32c9e){return{'model':db[_0xf32c9e[_0xfbc6('0xe')]],'as':_0xf32c9e['as'],'attributes':_0xf32c9e[_0xfbc6('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3013b6){logger[_0xfbc6('0x18')](_0xfbc6('0x16'),_0x254c18);logger[_0xfbc6('0x11')](_0xfbc6('0x16'),_0x254c18,JSON[_0xfbc6('0x12')](_0x3013b6));_0x51a938(_0x3013b6);})['catch'](function(_0x3961ba){logger[_0xfbc6('0x14')](_0xfbc6('0x16'),_0x3961ba['message'],_0x254c18);_0x109782(_0x355cc0[_0xfbc6('0x14')](0x1f4,_0x3961ba[_0xfbc6('0x15')]));});});};exports[_0xfbc6('0x19')]=function(_0x3120ce){var _0x45feb1=this;return new Promise(function(_0x4856dc,_0x17f842){return db[_0xfbc6('0x7')]['create'](_0x3120ce[_0xfbc6('0x1a')],{'raw':_0x3120ce[_0xfbc6('0x8')]?_0x3120ce[_0xfbc6('0x8')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x41f9ff){logger[_0xfbc6('0x18')](_0xfbc6('0x19'),_0x3120ce);logger[_0xfbc6('0x11')](_0xfbc6('0x19'),_0x3120ce,JSON[_0xfbc6('0x12')](_0x41f9ff));_0x4856dc(_0x41f9ff);})[_0xfbc6('0x13')](function(_0x3d2a3f){logger['error']('CreateCmHopper',_0x3d2a3f[_0xfbc6('0x15')],_0x3120ce);_0x17f842(_0x45feb1[_0xfbc6('0x14')](0x1f4,_0x3d2a3f[_0xfbc6('0x15')]));});});};exports[_0xfbc6('0x1b')]=function(_0x300939){var _0x465c43=this;return new Promise(function(_0x4f9aea,_0x3c85fc){return db['CmHopper']['update'](_0x300939[_0xfbc6('0x1a')],{'raw':_0x300939['options']?_0x300939[_0xfbc6('0x8')][_0xfbc6('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x300939[_0xfbc6('0x8')]?_0x300939[_0xfbc6('0x8')][_0xfbc6('0xa')]||null:null,'attributes':_0x300939[_0xfbc6('0x8')]?_0x300939[_0xfbc6('0x8')]['attributes']||null:null,'limit':_0x300939[_0xfbc6('0x8')]?_0x300939[_0xfbc6('0x8')][_0xfbc6('0xc')]||null:null})[_0xfbc6('0x10')](function(_0x1559df){logger[_0xfbc6('0x18')](_0xfbc6('0x1b'),_0x300939);logger[_0xfbc6('0x18')](_0xfbc6('0x1c'),JSON[_0xfbc6('0x12')](_0x300939[_0xfbc6('0x8')]['where']),_0x300939[_0xfbc6('0x1a')]['active']);logger['debug']('UpdateCmHopper',_0x300939,JSON['stringify'](_0x1559df));_0x4f9aea(_0x1559df);})[_0xfbc6('0x13')](function(_0x347177){logger[_0xfbc6('0x14')](_0xfbc6('0x1b'),_0x347177['message'],_0x300939);_0x3c85fc(_0x465c43[_0xfbc6('0x14')](0x1f4,_0x347177[_0xfbc6('0x15')]));});});};exports[_0xfbc6('0x1d')]=function(_0x1c051e){var _0x36c400=this;return new Promise(function(_0x12e028,_0xa82acc){return db[_0xfbc6('0x7')][_0xfbc6('0x1e')]({'where':_0x1c051e[_0xfbc6('0x8')]?_0x1c051e['options'][_0xfbc6('0xa')]||null:null})[_0xfbc6('0x10')](function(_0x4318c7){logger[_0xfbc6('0x18')]('DestroyCmHopper',_0x1c051e);logger[_0xfbc6('0x11')](_0xfbc6('0x1d'),_0x1c051e,JSON[_0xfbc6('0x12')](_0x4318c7));_0x12e028(_0x4318c7);})[_0xfbc6('0x13')](function(_0x46d73a){logger[_0xfbc6('0x14')](_0xfbc6('0x1d'),_0x46d73a[_0xfbc6('0x15')],_0x1c051e);_0xa82acc(_0x36c400[_0xfbc6('0x14')](0x1f4,_0x46d73a[_0xfbc6('0x15')]));});});};exports[_0xfbc6('0x1f')]=function(_0x15a994){var _0x5583b7=this;return new Promise(function(_0x3b687c,_0x1670a2){return db[_0xfbc6('0x20')][_0xfbc6('0x21')]()[_0xfbc6('0x10')](function(_0x137536){return db[_0xfbc6('0x22')][_0xfbc6('0x23')](function(_0x3690be){return db[_0xfbc6('0x7')]['findAll']({'where':_0x15a994[_0xfbc6('0x8')]?_0x15a994[_0xfbc6('0x8')][_0xfbc6('0xa')]||null:null,'attributes':_0x15a994[_0xfbc6('0x8')]?_0x15a994[_0xfbc6('0x8')][_0xfbc6('0xb')]||null:null,'limit':_0x15a994[_0xfbc6('0x8')]?_0x15a994[_0xfbc6('0x8')][_0xfbc6('0xc')]||null:null,'order':_0x15a994[_0xfbc6('0x8')]?_0x15a994[_0xfbc6('0x8')][_0xfbc6('0x24')]||null:null,'transaction':_0x3690be,'lock':_0x3690be[_0xfbc6('0x25')]['UPDATE'],'include':[{'model':db[_0xfbc6('0x20')],'as':_0xfbc6('0x26'),'attributes':_[_0xfbc6('0x27')](_0x137536)},{'model':db[_0xfbc6('0x28')],'as':_0xfbc6('0x29'),'attributes':['id',_0xfbc6('0x2a'),'voicePause']}]})[_0xfbc6('0x10')](function(_0x398f50){var _0x37d722=[];var _0x4ec9ea=[];for(var _0x2a8eaa=0x0;_0x2a8eaa<_0x398f50['length'];_0x2a8eaa+=0x1){var _0x209cf0=_0x398f50[_0x2a8eaa][_0xfbc6('0x2b')];if(_0x209cf0===null){_0x37d722[_0xfbc6('0x2c')](_0x398f50[_0x2a8eaa][_0xfbc6('0x2d')](_0x15a994['body'],{'transaction':_0x3690be}));}else if(!_0x4ec9ea[_0xfbc6('0x2e')](_0x209cf0)){_0x4ec9ea['push'](_0x209cf0);_0x37d722[_0xfbc6('0x2c')](_0x398f50[_0x2a8eaa][_0xfbc6('0x2d')](_0x15a994[_0xfbc6('0x1a')],{'transaction':_0x3690be}));}}return BPromise[_0xfbc6('0x2f')](_0x37d722);});})['then'](function(_0x3740d8){logger[_0xfbc6('0x18')](_0xfbc6('0x1f'),_0x15a994);if(_0x3740d8['length']>0x0){logger[_0xfbc6('0x18')](_0xfbc6('0x30'),_0x3740d8[0x0][_0xfbc6('0x31')]['id'],_0x3740d8[0x0][_0xfbc6('0x31')][_0xfbc6('0x32')],_0x3740d8[0x0][_0xfbc6('0x31')][_0xfbc6('0x33')]);}logger[_0xfbc6('0x11')]('GetContactDialer',_0x15a994,JSON[_0xfbc6('0x12')](_0x3740d8));_0x3b687c(_0x3740d8);})[_0xfbc6('0x13')](function(_0xcb74a9){logger[_0xfbc6('0x14')](_0xfbc6('0x1f'),_0xcb74a9[_0xfbc6('0x15')],_0x15a994);_0x1670a2(_0x5583b7[_0xfbc6('0x14')](0x1f4,_0xcb74a9[_0xfbc6('0x15')]));});});});};exports[_0xfbc6('0x34')]=function(_0x2c6f54){var _0xb3a9ad=this;return new Promise(function(_0x453ad9,_0x4947b3){return db[_0xfbc6('0x22')][_0xfbc6('0x23')](function(_0x48577c){return db[_0xfbc6('0x35')][_0xfbc6('0x36')](_0x2c6f54[_0xfbc6('0x1a')],{'raw':_0x2c6f54[_0xfbc6('0x8')]?_0x2c6f54['options'][_0xfbc6('0x9')]===undefined?!![]:![]:!![],'transaction':_0x48577c})[_0xfbc6('0x10')](function(){logger[_0xfbc6('0x18')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xfbc6('0x12')](_0x2c6f54[_0xfbc6('0x8')]['where']),_0x2c6f54['options'][_0xfbc6('0xa')][_0xfbc6('0x33')]);return db['CmHopper']['destroy']({'where':_0x2c6f54[_0xfbc6('0x8')]?_0x2c6f54[_0xfbc6('0x8')]['where']||null:null,'transaction':_0x48577c});});})[_0xfbc6('0x10')](function(_0x1bb343){logger[_0xfbc6('0x18')](_0xfbc6('0x34'),_0x2c6f54);logger['debug'](_0xfbc6('0x34'),_0x2c6f54,JSON[_0xfbc6('0x12')](_0x1bb343));_0x453ad9(_0x1bb343);})[_0xfbc6('0x13')](function(_0x1072e5){logger[_0xfbc6('0x14')](_0xfbc6('0x34'),_0x1072e5[_0xfbc6('0x15')],_0x2c6f54);_0x4947b3(_0xb3a9ad[_0xfbc6('0x14')](0x1f4,_0x1072e5[_0xfbc6('0x15')]));});});};exports[_0xfbc6('0x37')]=function(_0x54c1bd){var _0x205cc2=this;return new Promise(function(_0x27ebaf,_0x504660){return db[_0xfbc6('0x7')][_0xfbc6('0x38')]({'raw':_0x54c1bd[_0xfbc6('0x8')]?_0x54c1bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x54c1bd[_0xfbc6('0x8')]?_0x54c1bd[_0xfbc6('0x8')][_0xfbc6('0xa')]||null:null,'attributes':[[db[_0xfbc6('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfbc6('0x22')]['literal']('`scheduledat`\x20>=\x20'+util[_0xfbc6('0x39')]('\x22%s\x22',moment()[_0xfbc6('0x39')](_0xfbc6('0x3a')))+_0xfbc6('0x3b')))),_0xfbc6('0x3c')]]})[_0xfbc6('0x10')](function(_0x546be8){logger[_0xfbc6('0x18')](_0xfbc6('0x37'),_0x54c1bd);logger[_0xfbc6('0x11')](_0xfbc6('0x37'),_0x54c1bd,JSON[_0xfbc6('0x12')](_0x546be8));_0x27ebaf(_0x546be8);})['catch'](function(_0x5d9a97){logger[_0xfbc6('0x14')](_0xfbc6('0x37'),_0x5d9a97[_0xfbc6('0x15')],_0x54c1bd);_0x504660(_0x205cc2['error'](0x1f4,_0x5d9a97[_0xfbc6('0x15')]));});});};exports[_0xfbc6('0x3d')]=function(_0x9a05e6){var _0x46a60b=this;return new Promise(function(_0x31fc8b,_0x50c6b3){return db[_0xfbc6('0x20')][_0xfbc6('0x21')]()[_0xfbc6('0x10')](function(){return db[_0xfbc6('0x22')][_0xfbc6('0x23')](function(_0x754014){return db[_0xfbc6('0x7')][_0xfbc6('0x38')]({'where':_0x9a05e6['options']?_0x9a05e6['options']['where']||null:null,'attributes':_0x9a05e6[_0xfbc6('0x8')]?_0x9a05e6[_0xfbc6('0x8')][_0xfbc6('0xb')]||null:null,'limit':0x1,'order':_0x9a05e6[_0xfbc6('0x8')]?_0x9a05e6['options'][_0xfbc6('0x24')]||null:null,'group':db[_0xfbc6('0x7')]['UserId'],'transaction':_0x754014,'lock':_0x754014[_0xfbc6('0x25')]['UPDATE'],'include':_0x9a05e6[_0xfbc6('0x8')]?_0x9a05e6[_0xfbc6('0x8')][_0xfbc6('0xd')]?_[_0xfbc6('0xf')](_0x9a05e6[_0xfbc6('0x8')][_0xfbc6('0xd')],function(_0x3f98ae){return{'model':db[_0x3f98ae['model']],'as':_0x3f98ae['as'],'attributes':_0x3f98ae[_0xfbc6('0xb')],'include':_0x3f98ae[_0xfbc6('0xd')]?_[_0xfbc6('0xf')](_0x3f98ae['include'],function(_0x1a8d00){return{'model':db[_0x1a8d00['model']],'as':_0x1a8d00['as'],'attributes':_0x1a8d00[_0xfbc6('0xb')],'include':_0x1a8d00['include']?_[_0xfbc6('0xf')](_0x1a8d00['include'],function(_0x61ebe8){return{'model':db[_0x61ebe8[_0xfbc6('0xe')]],'as':_0x61ebe8['as'],'attributes':_0x61ebe8[_0xfbc6('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56f05f){var _0x30b4d5=[];for(var _0x17c475=0x0;_0x17c475<_0x56f05f[_0xfbc6('0x3e')];_0x17c475+=0x1){_0x30b4d5[_0xfbc6('0x2c')](_0x56f05f[_0x17c475][_0xfbc6('0x2d')](_0x9a05e6[_0xfbc6('0x1a')],{'transaction':_0x754014}));}return BPromise[_0xfbc6('0x2f')](_0x30b4d5);});})[_0xfbc6('0x10')](function(_0x383b8b){logger[_0xfbc6('0x18')](_0xfbc6('0x3d'),_0x9a05e6);logger[_0xfbc6('0x11')](_0xfbc6('0x3d'),_0x9a05e6,JSON['stringify'](_0x383b8b));_0x31fc8b(_0x383b8b);})[_0xfbc6('0x13')](function(_0x59cdb3){logger[_0xfbc6('0x14')]('GetContactRecallMe',_0x59cdb3[_0xfbc6('0x15')],_0x9a05e6);_0x50c6b3(_0x46a60b[_0xfbc6('0x14')](0x1f4,_0x59cdb3['message']));});});});};exports[_0xfbc6('0x3f')]=function(_0x42b1f2){var _0x33066a=this;return new Promise(function(_0x182fd7,_0x257f31){db[_0xfbc6('0x20')][_0xfbc6('0x21')]()[_0xfbc6('0x10')](function(_0x464a7a){return db[_0xfbc6('0x7')][_0xfbc6('0x38')]({'raw':_0x42b1f2['options']?_0x42b1f2[_0xfbc6('0x8')][_0xfbc6('0x9')]===undefined?!![]:![]:!![],'where':_0x42b1f2[_0xfbc6('0x8')]?_0x42b1f2[_0xfbc6('0x8')][_0xfbc6('0xa')]||null:null,'attributes':_0x42b1f2[_0xfbc6('0x8')]?_0x42b1f2[_0xfbc6('0x8')]['attributes']||null:null,'limit':_0x42b1f2[_0xfbc6('0x8')]?_0x42b1f2[_0xfbc6('0x8')][_0xfbc6('0xc')]||null:null,'include':_0x42b1f2[_0xfbc6('0x8')]?_0x42b1f2[_0xfbc6('0x8')]['include']?_[_0xfbc6('0xf')](_0x42b1f2[_0xfbc6('0x8')][_0xfbc6('0xd')],function(_0x2e132c){return{'model':db[_0x2e132c[_0xfbc6('0xe')]],'as':_0x2e132c['as'],'attributes':_0x2e132c['as']==='Contact'?_[_0xfbc6('0x27')](_0x464a7a):_0x2e132c[_0xfbc6('0xb')],'include':_0x2e132c['include']?_[_0xfbc6('0xf')](_0x2e132c[_0xfbc6('0xd')],function(_0x56d5dc){return{'model':db[_0x56d5dc['model']],'as':_0x56d5dc['as'],'attributes':_0x56d5dc[_0xfbc6('0xb')],'include':_0x56d5dc[_0xfbc6('0xd')]?_[_0xfbc6('0xf')](_0x56d5dc[_0xfbc6('0xd')],function(_0x5a8eb){return{'model':db[_0x5a8eb[_0xfbc6('0xe')]],'as':_0x5a8eb['as'],'attributes':_0x5a8eb[_0xfbc6('0xb')]};}):[]};}):[]};}):[]:[]})[_0xfbc6('0x10')](function(_0x2fbe88){logger['info'](_0xfbc6('0x6'),_0x42b1f2);logger['debug']('GetCmHopper',_0x42b1f2,JSON[_0xfbc6('0x12')](_0x2fbe88));_0x182fd7(_0x2fbe88);})[_0xfbc6('0x13')](function(_0x18d577){logger[_0xfbc6('0x14')]('GetCmHopper',_0x18d577[_0xfbc6('0x15')],_0x42b1f2);_0x257f31(_0x33066a[_0xfbc6('0x14')](0x1f4,_0x18d577['message']));});});});};exports['GetContactByPhone']=function(_0xf700a5){var _0x14e319=this;return new Promise(function(_0x10da70,_0x3d8ca0){return db[_0xfbc6('0x20')]['findOne']({'raw':!![],'where':{'phone':_0xf700a5[_0xfbc6('0x8')][_0xfbc6('0xa')][_0xfbc6('0x40')]},'attributes':['id','dialTimezone'],'order':[['id',_0xfbc6('0x41')]]})[_0xfbc6('0x10')](function(_0x16555d){logger[_0xfbc6('0x18')]('getContactByPhone',_0xf700a5);logger[_0xfbc6('0x11')](_0xfbc6('0x42'),_0xf700a5,JSON['stringify'](_0x16555d));_0x10da70(_0x16555d);})[_0xfbc6('0x13')](function(_0x89656){logger[_0xfbc6('0x14')](_0xfbc6('0x42'),_0x89656[_0xfbc6('0x15')],_0xf700a5);_0x3d8ca0(_0x14e319['error'](0x1f4,_0x89656['message']));});});};exports[_0xfbc6('0x43')]=function(_0x4c575d){var _0x41afa5=this;return new Promise(function(_0x916651,_0x372662){return db[_0xfbc6('0x22')][_0xfbc6('0x23')](function(_0x4ae769){var _0x2fad1e=_0x4c575d['options']&&_0x4c575d[_0xfbc6('0x8')][_0xfbc6('0xa')]?_0x4c575d['options']['where']:{};return db[_0xfbc6('0x7')][_0xfbc6('0x2d')](_0x4c575d[_0xfbc6('0x1a')],{'where':_0x2fad1e,'transaction':_0x4ae769})[_0xfbc6('0x10')](function(_0x392df9){logger[_0xfbc6('0x18')](_0xfbc6('0x43'),_0x4c575d);logger[_0xfbc6('0x11')](_0xfbc6('0x43'),_0x4c575d,JSON[_0xfbc6('0x12')](_0x392df9));_0x916651(_0x392df9);})[_0xfbc6('0x13')](function(_0x376412){logger[_0xfbc6('0x14')](_0xfbc6('0x43'),_0x376412[_0xfbc6('0x15')],_0x4c575d);_0x372662(_0x41afa5[_0xfbc6('0x14')](0x1f4,_0x376412['message']));});});});};exports[_0xfbc6('0x44')]=function(_0x5e2fb1){var _0xd81559=this;var _0x2048a0=_0x5e2fb1[_0xfbc6('0x1a')][_0xfbc6('0xa')][_0xfbc6('0x45')];var _0x131666=_0x5e2fb1['body'][_0xfbc6('0xa')][_0xfbc6('0x46')];var _0x15f89d=_0x5e2fb1[_0xfbc6('0x1a')][_0xfbc6('0xa')][_0xfbc6('0x47')];return new Promise(function(_0x4c10e2,_0x36020f){return db[_0xfbc6('0x7')][_0xfbc6('0x38')]({'where':{'voiceQueueId':{'$in':_0x2048a0},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xfbc6('0x22')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x131666+'\x20MINUTE'),'$gt':db[_0xfbc6('0x22')][_0xfbc6('0x48')](_0xfbc6('0x49'))}},'UserId':{'$in':_0x15f89d}},'include':[{'model':db[_0xfbc6('0x20')],'as':_0xfbc6('0x26')},{'model':db[_0xfbc6('0x28')],'as':_0xfbc6('0x29'),'attributes':['id',_0xfbc6('0x2a'),'voicePause']},{'model':db['CmList'],'as':_0xfbc6('0x4a')}]})[_0xfbc6('0x10')](function(_0x3320ac){if(_0x3320ac[_0xfbc6('0x3e')]>0x0){return db[_0xfbc6('0x22')][_0xfbc6('0x23')](function(_0x434f39){return db[_0xfbc6('0x7')][_0xfbc6('0x2d')]({'recallmeNotifiedDate':db[_0xfbc6('0x22')][_0xfbc6('0x48')](_0xfbc6('0x49'))},{'where':{'id':{'$in':_[_0xfbc6('0xf')](_0x3320ac,'id')}},'transaction':_0x434f39})['then'](function(){_0x4c10e2(_0x3320ac);})[_0xfbc6('0x13')](function(_0x4ab270){logger[_0xfbc6('0x14')](_0xfbc6('0x44'),_0x4ab270[_0xfbc6('0x15')],_0x5e2fb1);_0x36020f(_0xd81559[_0xfbc6('0x14')](0x1f4,_0x4ab270['message']));});})[_0xfbc6('0x13')](function(_0x1fe6e1){logger[_0xfbc6('0x14')](_0xfbc6('0x44'),_0x1fe6e1[_0xfbc6('0x15')],_0x5e2fb1);_0x36020f(_0xd81559[_0xfbc6('0x14')](0x1f4,_0x1fe6e1[_0xfbc6('0x15')]));});}else{_0x4c10e2(_0x3320ac);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 89777ae..1ecb9ba 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 _0x41d4=['get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/timezones','/:id','show','/:id/previewrecall','create','/preview','post','/timezone','getTimezone','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller'];(function(_0x16f521,_0x528892){var _0x647a97=function(_0x3a0061){while(--_0x3a0061){_0x16f521['push'](_0x16f521['shift']());}};_0x647a97(++_0x528892);}(_0x41d4,0x1c8));var _0x441d=function(_0x32e8f2,_0x33cff3){_0x32e8f2=_0x32e8f2-0x0;var _0xefd2e6=_0x41d4[_0x32e8f2];return _0xefd2e6;};'use strict';var express=require(_0x441d('0x0'));var router=express[_0x441d('0x1')]();var auth=require(_0x441d('0x2'));var controller=require(_0x441d('0x3'));router[_0x441d('0x4')]('/',auth[_0x441d('0x5')](),controller['index']);router[_0x441d('0x4')](_0x441d('0x6'),auth[_0x441d('0x5')](),controller[_0x441d('0x7')]);router['get'](_0x441d('0x8'),auth['isAuthenticated'](),controller[_0x441d('0x9')]);router[_0x441d('0x4')](_0x441d('0xa'),auth[_0x441d('0x5')](),controller['getTimezones']);router['get'](_0x441d('0xb'),auth['isAuthenticated'](),controller[_0x441d('0xc')]);router[_0x441d('0x4')](_0x441d('0xd'),auth[_0x441d('0x5')](),controller['getPreviewRecall']);router['post']('/',auth[_0x441d('0x5')](),controller[_0x441d('0xe')]);router['post'](_0x441d('0xf'),auth[_0x441d('0x5')](),controller['getPreview']);router[_0x441d('0x10')](_0x441d('0x11'),auth['isAuthenticated'](),controller[_0x441d('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x441d('0x13')]);router[_0x441d('0x14')]('/:id',auth[_0x441d('0x5')](),controller[_0x441d('0x15')]);module[_0x441d('0x16')]=router; \ No newline at end of file +var _0x9f79=['exports','../../components/auth/service','./cmHopper.controller','index','get','/describe','isAuthenticated','describe','getOpenContacts','/timezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','put','update','delete','destroy'];(function(_0x55c948,_0x3d6c24){var _0x56afdc=function(_0x52de37){while(--_0x52de37){_0x55c948['push'](_0x55c948['shift']());}};_0x56afdc(++_0x3d6c24);}(_0x9f79,0x1a3));var _0x99f7=function(_0x36e0aa,_0x4c7e84){_0x36e0aa=_0x36e0aa-0x0;var _0x7d4bb1=_0x9f79[_0x36e0aa];return _0x7d4bb1;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x99f7('0x0'));var controller=require(_0x99f7('0x1'));router['get']('/',auth['isAuthenticated'](),controller[_0x99f7('0x2')]);router[_0x99f7('0x3')](_0x99f7('0x4'),auth[_0x99f7('0x5')](),controller[_0x99f7('0x6')]);router[_0x99f7('0x3')]('/opencontacts',auth[_0x99f7('0x5')](),controller[_0x99f7('0x7')]);router[_0x99f7('0x3')](_0x99f7('0x8'),auth[_0x99f7('0x5')](),controller['getTimezones']);router[_0x99f7('0x3')](_0x99f7('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x99f7('0xa'),auth[_0x99f7('0x5')](),controller[_0x99f7('0xb')]);router[_0x99f7('0xc')]('/',auth['isAuthenticated'](),controller[_0x99f7('0xd')]);router[_0x99f7('0xc')](_0x99f7('0xe'),auth['isAuthenticated'](),controller[_0x99f7('0xf')]);router['post'](_0x99f7('0x10'),auth['isAuthenticated'](),controller['getTimezone']);router[_0x99f7('0x11')](_0x99f7('0x9'),auth[_0x99f7('0x5')](),controller[_0x99f7('0x12')]);router[_0x99f7('0x13')](_0x99f7('0x9'),auth[_0x99f7('0x5')](),controller[_0x99f7('0x14')]);module[_0x99f7('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 655d6da..4eac600 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 _0x8e04=['sequelize','exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x5897cd,_0x3b0d06){var _0x1b1ab2=function(_0xc950f2){while(--_0xc950f2){_0x5897cd['push'](_0x5897cd['shift']());}};_0x1b1ab2(++_0x3b0d06);}(_0x8e04,0xd7));var _0x48e0=function(_0x3c6125,_0x3b2a9c){_0x3c6125=_0x3c6125-0x0;var _0x2f47b8=_0x8e04[_0x3c6125];return _0x2f47b8;};'use strict';var moment=require(_0x48e0('0x0'));var Sequelize=require(_0x48e0('0x1'));module[_0x48e0('0x2')]={'CmHopperId':{'type':Sequelize[_0x48e0('0x3')]},'phone':{'type':Sequelize[_0x48e0('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x48e0('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x48e0('0x5')],'defaultValue':moment()[_0x48e0('0x6')](_0x48e0('0x7'))},'countbusyretry':{'type':Sequelize[_0x48e0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x48e0('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x48e0('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x48e0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x48e0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x48e0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x48e0('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x48e0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbfb3=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x3b53b8,_0xd1ddc5){var _0x320b07=function(_0x3f9c69){while(--_0x3f9c69){_0x3b53b8['push'](_0x3b53b8['shift']());}};_0x320b07(++_0xd1ddc5);}(_0xbfb3,0x127));var _0x3bfb=function(_0x3a817e,_0x303ed1){_0x3a817e=_0x3a817e-0x0;var _0x33cddf=_0xbfb3[_0x3a817e];return _0x33cddf;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3bfb('0x0')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3bfb('0x1')],'defaultValue':moment()[_0x3bfb('0x2')](_0x3bfb('0x3'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3bfb('0x0')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3bfb('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3bfb('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3bfb('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3bfb('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 89b9ff9..619f8a1 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 _0xa912=['catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','set','reject','then','destroy','get','CmHopperAdditionalPhones','error','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','count','includeAll','findAll'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xa912,0xaf));var _0x2a91=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xa912[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require(_0x2a91('0x0'));var rimraf=require(_0x2a91('0x1'));var zipdir=require(_0x2a91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a91('0x3'));var moment=require('moment');var BPromise=require(_0x2a91('0x4'));var Mustache=require(_0x2a91('0x5'));var util=require(_0x2a91('0x6'));var path=require('path');var sox=require(_0x2a91('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a91('0x8'));var _=require(_0x2a91('0x9'));var squel=require(_0x2a91('0xa'));var crypto=require(_0x2a91('0xb'));var jsforce=require(_0x2a91('0xc'));var deskjs=require(_0x2a91('0xd'));var toCsv=require(_0x2a91('0xe'));var querystring=require(_0x2a91('0xf'));var Papa=require(_0x2a91('0x10'));var Redis=require(_0x2a91('0x11'));var authService=require(_0x2a91('0x12'));var qs=require(_0x2a91('0x13'));var as=require(_0x2a91('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a91('0x15'))('api');var utils=require(_0x2a91('0x16'));var config=require(_0x2a91('0x17'));var licenseUtil=require(_0x2a91('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x70950c,_0x297065){_0x297065=_0x297065||0xcc;return function(_0x314ce4){if(_0x314ce4){return _0x70950c['sendStatus'](_0x297065);}return _0x70950c['status'](_0x297065)['end']();};}function respondWithResult(_0x41b5ad,_0xf5f12f){_0xf5f12f=_0xf5f12f||0xc8;return function(_0x195f81){if(_0x195f81){return _0x41b5ad[_0x2a91('0x19')](_0xf5f12f)[_0x2a91('0x1a')](_0x195f81);}};}function respondWithFilteredResult(_0x2e9b6e,_0x4e76ae){return function(_0x561aab){if(_0x561aab){var _0x3fbfcf=typeof _0x4e76ae[_0x2a91('0x1b')]===_0x2a91('0x1c')&&typeof _0x4e76ae['limit']==='undefined';var _0x4ec8ed=_0x561aab['count'];var _0x223bc4=_0x3fbfcf?0x0:_0x4e76ae[_0x2a91('0x1b')];var _0x253eea=_0x3fbfcf?_0x561aab['count']:_0x4e76ae['offset']+_0x4e76ae[_0x2a91('0x1d')];var _0x51b6e1;if(_0x253eea>=_0x4ec8ed){_0x253eea=_0x4ec8ed;_0x51b6e1=0xc8;}else{_0x51b6e1=0xce;}_0x2e9b6e[_0x2a91('0x19')](_0x51b6e1);return _0x2e9b6e[_0x2a91('0x1e')]('Content-Range',_0x223bc4+'-'+_0x253eea+'/'+_0x4ec8ed)[_0x2a91('0x1a')](_0x561aab);}return null;};}function patchUpdates(_0x1189d2){return function(_0x36a009){try{jsonpatch['apply'](_0x36a009,_0x1189d2,!![]);}catch(_0x262881){return BPromise[_0x2a91('0x1f')](_0x262881);}return _0x36a009['save']();};}function saveUpdates(_0x46ae14,_0x47e3c3){return function(_0x6aa266){if(_0x6aa266){return _0x6aa266['update'](_0x46ae14)[_0x2a91('0x20')](function(_0xf6654a){return _0xf6654a;});}return null;};}function removeEntity(_0x33ae60,_0x38001f){return function(_0xb65e2a){if(_0xb65e2a){return _0xb65e2a[_0x2a91('0x21')]()['then'](function(){var _0x4c29df=_0xb65e2a[_0x2a91('0x22')]({'plain':!![]});var _0xb13292=_0x2a91('0x23');return db['UserProfileResource'][_0x2a91('0x21')]({'where':{'type':_0xb13292,'resourceId':_0x4c29df['id']}})[_0x2a91('0x20')](function(){return _0xb65e2a;});})['then'](function(){_0x33ae60[_0x2a91('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32e45b,_0x5c2769){return function(_0x5989a4){if(!_0x5989a4){_0x32e45b['sendStatus'](0x194);}return _0x5989a4;};}function handleError(_0x2650a8,_0x330b5f){_0x330b5f=_0x330b5f||0x1f4;return function(_0x58fe97){logger[_0x2a91('0x24')](_0x58fe97['stack']);if(_0x58fe97[_0x2a91('0x25')]){delete _0x58fe97[_0x2a91('0x25')];}_0x2650a8['status'](_0x330b5f)[_0x2a91('0x26')](_0x58fe97);};}exports[_0x2a91('0x27')]=function(_0x12e748,_0x3d2efb){var _0x476ec5={},_0x188abd={},_0x4c8107={'count':0x0,'rows':[]};var _0x2442e5=_[_0x2a91('0x28')](db[_0x2a91('0x29')][_0x2a91('0x2a')],function(_0x4e3dc3){return{'name':_0x4e3dc3[_0x2a91('0x2b')],'type':_0x4e3dc3[_0x2a91('0x2c')][_0x2a91('0x2d')]};});_0x188abd[_0x2a91('0x2e')]=_['map'](_0x2442e5,'name');_0x188abd['query']=_[_0x2a91('0x2f')](_0x12e748['query']);_0x188abd[_0x2a91('0x30')]=_[_0x2a91('0x31')](_0x188abd[_0x2a91('0x2e')],_0x188abd[_0x2a91('0x32')]);_0x476ec5[_0x2a91('0x33')]=_[_0x2a91('0x31')](_0x188abd[_0x2a91('0x2e')],qs['fields'](_0x12e748[_0x2a91('0x32')][_0x2a91('0x34')]));_0x476ec5[_0x2a91('0x33')]=_0x476ec5['attributes']['length']?_0x476ec5['attributes']:_0x188abd[_0x2a91('0x2e')];if(!_0x12e748['query'][_0x2a91('0x35')](_0x2a91('0x36'))){_0x476ec5[_0x2a91('0x1d')]=qs[_0x2a91('0x1d')](_0x12e748['query'][_0x2a91('0x1d')]);_0x476ec5['offset']=qs[_0x2a91('0x1b')](_0x12e748[_0x2a91('0x32')]['offset']);}_0x476ec5[_0x2a91('0x37')]=qs[_0x2a91('0x38')](_0x12e748[_0x2a91('0x32')][_0x2a91('0x38')]);_0x476ec5['where']=qs['filters'](_[_0x2a91('0x39')](_0x12e748['query'],_0x188abd['filters']),_0x2442e5);if(_0x12e748['query'][_0x2a91('0x3a')]){_0x476ec5['where']=_[_0x2a91('0x3b')](_0x476ec5[_0x2a91('0x3c')],{'$or':_['map'](_0x2442e5,function(_0x43f39c){if(_0x43f39c[_0x2a91('0x2c')]!=='VIRTUAL'){var _0x40ab9a={};_0x40ab9a[_0x43f39c['name']]={'$like':'%'+_0x12e748[_0x2a91('0x32')][_0x2a91('0x3a')]+'%'};return _0x40ab9a;}})});}_0x476ec5=_['merge']({},_0x476ec5,_0x12e748[_0x2a91('0x3d')]);var _0x3140b6={'where':_0x476ec5['where']};return db['CmHopperAdditionalPhone'][_0x2a91('0x3e')](_0x3140b6)[_0x2a91('0x20')](function(_0x4f4455){_0x4c8107[_0x2a91('0x3e')]=_0x4f4455;if(_0x12e748[_0x2a91('0x32')][_0x2a91('0x3f')]){_0x476ec5['include']=[{'all':!![]}];}return db[_0x2a91('0x29')][_0x2a91('0x40')](_0x476ec5);})[_0x2a91('0x20')](function(_0x3a0ce9){_0x4c8107['rows']=_0x3a0ce9;return _0x4c8107;})['then'](respondWithFilteredResult(_0x3d2efb,_0x476ec5))[_0x2a91('0x41')](handleError(_0x3d2efb,null));};exports[_0x2a91('0x42')]=function(_0x3a68eb,_0x5510b7){var _0x21a2f7={'raw':!![],'where':{'id':_0x3a68eb[_0x2a91('0x43')]['id']}},_0x19cd98={};_0x19cd98[_0x2a91('0x2e')]=_[_0x2a91('0x2f')](db[_0x2a91('0x29')][_0x2a91('0x2a')]);_0x19cd98[_0x2a91('0x32')]=_[_0x2a91('0x2f')](_0x3a68eb['query']);_0x19cd98['filters']=_[_0x2a91('0x31')](_0x19cd98[_0x2a91('0x2e')],_0x19cd98[_0x2a91('0x32')]);_0x21a2f7[_0x2a91('0x33')]=_[_0x2a91('0x31')](_0x19cd98['model'],qs[_0x2a91('0x34')](_0x3a68eb['query'][_0x2a91('0x34')]));_0x21a2f7[_0x2a91('0x33')]=_0x21a2f7[_0x2a91('0x33')][_0x2a91('0x44')]?_0x21a2f7['attributes']:_0x19cd98[_0x2a91('0x2e')];if(_0x3a68eb[_0x2a91('0x32')][_0x2a91('0x3f')]){_0x21a2f7['include']=[{'all':!![]}];}_0x21a2f7=_[_0x2a91('0x3b')]({},_0x21a2f7,_0x3a68eb[_0x2a91('0x3d')]);return db[_0x2a91('0x29')]['find'](_0x21a2f7)['then'](handleEntityNotFound(_0x5510b7,null))[_0x2a91('0x20')](respondWithResult(_0x5510b7,null))[_0x2a91('0x41')](handleError(_0x5510b7,null));};exports[_0x2a91('0x45')]=function(_0x11837e,_0x5d9dd4){return db[_0x2a91('0x29')][_0x2a91('0x45')](_0x11837e[_0x2a91('0x46')],{})[_0x2a91('0x20')](function(_0x114251){var _0x33dfe8=_0x11837e['user']['get']({'plain':!![]});if(!_0x33dfe8)throw new Error(_0x2a91('0x47'));if(_0x33dfe8[_0x2a91('0x48')]===_0x2a91('0x49')){var _0x35e842=_0x114251[_0x2a91('0x22')]({'plain':!![]});var _0xf6b2b9=_0x2a91('0x23');return db[_0x2a91('0x4a')][_0x2a91('0x4b')]({'where':{'name':_0xf6b2b9,'userProfileId':_0x33dfe8[_0x2a91('0x4c')]},'raw':!![]})[_0x2a91('0x20')](function(_0x18ec06){if(_0x18ec06&&_0x18ec06[_0x2a91('0x4d')]===0x0){return db[_0x2a91('0x4e')][_0x2a91('0x45')]({'name':_0x35e842[_0x2a91('0x25')],'resourceId':_0x35e842['id'],'type':_0x18ec06[_0x2a91('0x25')],'sectionId':_0x18ec06['id']},{})['then'](function(){return _0x114251;});}else{return _0x114251;}})[_0x2a91('0x41')](function(_0x4f0af7){logger[_0x2a91('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f0af7);throw _0x4f0af7;});}return _0x114251;})[_0x2a91('0x20')](respondWithResult(_0x5d9dd4,0xc9))[_0x2a91('0x41')](handleError(_0x5d9dd4,null));};exports[_0x2a91('0x4f')]=function(_0x123031,_0x34e52f){if(_0x123031[_0x2a91('0x46')]['id']){delete _0x123031['body']['id'];}return db[_0x2a91('0x29')][_0x2a91('0x4b')]({'where':{'id':_0x123031[_0x2a91('0x43')]['id']}})[_0x2a91('0x20')](handleEntityNotFound(_0x34e52f,null))[_0x2a91('0x20')](saveUpdates(_0x123031[_0x2a91('0x46')],null))[_0x2a91('0x20')](respondWithResult(_0x34e52f,null))[_0x2a91('0x41')](handleError(_0x34e52f,null));};exports[_0x2a91('0x21')]=function(_0xc2572b,_0x2b91a6){return db[_0x2a91('0x29')][_0x2a91('0x4b')]({'where':{'id':_0xc2572b[_0x2a91('0x43')]['id']}})[_0x2a91('0x20')](handleEntityNotFound(_0x2b91a6,null))[_0x2a91('0x20')](removeEntity(_0x2b91a6,null))[_0x2a91('0x41')](handleError(_0x2b91a6,null));}; \ No newline at end of file +var _0x27b4=['offset','undefined','limit','count','set','Content-Range','json','apply','update','then','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','CmHopperAdditionalPhone','include','findAll','catch','params','includeAll','find','create','body','user','get','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','desk.js','to-csv','querystring','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'];(function(_0x5651b9,_0x3eb38a){var _0x2d0cc4=function(_0x267e65){while(--_0x267e65){_0x5651b9['push'](_0x5651b9['shift']());}};_0x2d0cc4(++_0x3eb38a);}(_0x27b4,0x17a));var _0x427b=function(_0x479d9e,_0x57492a){_0x479d9e=_0x479d9e-0x0;var _0x238441=_0x27b4[_0x479d9e];return _0x238441;};'use strict';var emlformat=require(_0x427b('0x0'));var rimraf=require(_0x427b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x427b('0x2'));var rp=require(_0x427b('0x3'));var moment=require(_0x427b('0x4'));var BPromise=require(_0x427b('0x5'));var Mustache=require(_0x427b('0x6'));var util=require(_0x427b('0x7'));var path=require(_0x427b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x427b('0x9'));var _=require(_0x427b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x427b('0xb'));var toCsv=require(_0x427b('0xc'));var querystring=require(_0x427b('0xd'));var Papa=require('papaparse');var Redis=require(_0x427b('0xe'));var authService=require(_0x427b('0xf'));var qs=require(_0x427b('0x10'));var as=require(_0x427b('0x11'));var hardwareService=require(_0x427b('0x12'));var logger=require('../../config/logger')(_0x427b('0x13'));var utils=require(_0x427b('0x14'));var config=require(_0x427b('0x15'));var licenseUtil=require(_0x427b('0x16'));var db=require(_0x427b('0x17'))['db'];function respondWithStatusCode(_0x1bd0b7,_0x8239a2){_0x8239a2=_0x8239a2||0xcc;return function(_0x4243bc){if(_0x4243bc){return _0x1bd0b7[_0x427b('0x18')](_0x8239a2);}return _0x1bd0b7[_0x427b('0x19')](_0x8239a2)[_0x427b('0x1a')]();};}function respondWithResult(_0x154d78,_0xd18066){_0xd18066=_0xd18066||0xc8;return function(_0x4fc3a1){if(_0x4fc3a1){return _0x154d78[_0x427b('0x19')](_0xd18066)['json'](_0x4fc3a1);}};}function respondWithFilteredResult(_0x393395,_0x464ff8){return function(_0x126a8c){if(_0x126a8c){var _0x35726e=typeof _0x464ff8[_0x427b('0x1b')]===_0x427b('0x1c')&&typeof _0x464ff8[_0x427b('0x1d')]===_0x427b('0x1c');var _0xd824b3=_0x126a8c[_0x427b('0x1e')];var _0x15197e=_0x35726e?0x0:_0x464ff8[_0x427b('0x1b')];var _0x310e5c=_0x35726e?_0x126a8c[_0x427b('0x1e')]:_0x464ff8[_0x427b('0x1b')]+_0x464ff8[_0x427b('0x1d')];var _0x599145;if(_0x310e5c>=_0xd824b3){_0x310e5c=_0xd824b3;_0x599145=0xc8;}else{_0x599145=0xce;}_0x393395[_0x427b('0x19')](_0x599145);return _0x393395[_0x427b('0x1f')](_0x427b('0x20'),_0x15197e+'-'+_0x310e5c+'/'+_0xd824b3)[_0x427b('0x21')](_0x126a8c);}return null;};}function patchUpdates(_0x4df613){return function(_0x4f8f47){try{jsonpatch[_0x427b('0x22')](_0x4f8f47,_0x4df613,!![]);}catch(_0x2a2ea9){return BPromise['reject'](_0x2a2ea9);}return _0x4f8f47['save']();};}function saveUpdates(_0x199f57,_0xaaa0b2){return function(_0x2f13a9){if(_0x2f13a9){return _0x2f13a9[_0x427b('0x23')](_0x199f57)[_0x427b('0x24')](function(_0x52f7b4){return _0x52f7b4;});}return null;};}function removeEntity(_0x427acc,_0x2f42ef){return function(_0xc11c6){if(_0xc11c6){return _0xc11c6['destroy']()['then'](function(){var _0x4f0c5f=_0xc11c6['get']({'plain':!![]});var _0x5aaf19='CmHopperAdditionalPhones';return db[_0x427b('0x25')][_0x427b('0x26')]({'where':{'type':_0x5aaf19,'resourceId':_0x4f0c5f['id']}})[_0x427b('0x24')](function(){return _0xc11c6;});})[_0x427b('0x24')](function(){_0x427acc[_0x427b('0x19')](0xcc)[_0x427b('0x1a')]();});}};}function handleEntityNotFound(_0x1479d9,_0x11bc10){return function(_0x441ee1){if(!_0x441ee1){_0x1479d9['sendStatus'](0x194);}return _0x441ee1;};}function handleError(_0x4595b6,_0x1eec6e){_0x1eec6e=_0x1eec6e||0x1f4;return function(_0x4407c7){logger[_0x427b('0x27')](_0x4407c7[_0x427b('0x28')]);if(_0x4407c7[_0x427b('0x29')]){delete _0x4407c7[_0x427b('0x29')];}_0x4595b6['status'](_0x1eec6e)[_0x427b('0x2a')](_0x4407c7);};}exports['index']=function(_0x38ac25,_0x42f162){var _0x5b6f92={},_0x2bd9a4={},_0x268243={'count':0x0,'rows':[]};var _0x4d1fcc=_['map'](db['CmHopperAdditionalPhone'][_0x427b('0x2b')],function(_0x2111e8){return{'name':_0x2111e8[_0x427b('0x2c')],'type':_0x2111e8[_0x427b('0x2d')][_0x427b('0x2e')]};});_0x2bd9a4[_0x427b('0x2f')]=_[_0x427b('0x30')](_0x4d1fcc,_0x427b('0x29'));_0x2bd9a4[_0x427b('0x31')]=_[_0x427b('0x32')](_0x38ac25[_0x427b('0x31')]);_0x2bd9a4[_0x427b('0x33')]=_[_0x427b('0x34')](_0x2bd9a4[_0x427b('0x2f')],_0x2bd9a4[_0x427b('0x31')]);_0x5b6f92[_0x427b('0x35')]=_[_0x427b('0x34')](_0x2bd9a4[_0x427b('0x2f')],qs['fields'](_0x38ac25[_0x427b('0x31')][_0x427b('0x36')]));_0x5b6f92[_0x427b('0x35')]=_0x5b6f92['attributes'][_0x427b('0x37')]?_0x5b6f92[_0x427b('0x35')]:_0x2bd9a4['model'];if(!_0x38ac25[_0x427b('0x31')][_0x427b('0x38')](_0x427b('0x39'))){_0x5b6f92[_0x427b('0x1d')]=qs[_0x427b('0x1d')](_0x38ac25[_0x427b('0x31')][_0x427b('0x1d')]);_0x5b6f92[_0x427b('0x1b')]=qs['offset'](_0x38ac25[_0x427b('0x31')][_0x427b('0x1b')]);}_0x5b6f92['order']=qs[_0x427b('0x3a')](_0x38ac25['query'][_0x427b('0x3a')]);_0x5b6f92[_0x427b('0x3b')]=qs[_0x427b('0x33')](_[_0x427b('0x3c')](_0x38ac25[_0x427b('0x31')],_0x2bd9a4[_0x427b('0x33')]),_0x4d1fcc);if(_0x38ac25['query'][_0x427b('0x3d')]){_0x5b6f92[_0x427b('0x3b')]=_['merge'](_0x5b6f92[_0x427b('0x3b')],{'$or':_[_0x427b('0x30')](_0x4d1fcc,function(_0x41ef4e){if(_0x41ef4e['type']!==_0x427b('0x3e')){var _0x1b7ad6={};_0x1b7ad6[_0x41ef4e[_0x427b('0x29')]]={'$like':'%'+_0x38ac25[_0x427b('0x31')][_0x427b('0x3d')]+'%'};return _0x1b7ad6;}})});}_0x5b6f92=_[_0x427b('0x3f')]({},_0x5b6f92,_0x38ac25[_0x427b('0x40')]);var _0x465895={'where':_0x5b6f92[_0x427b('0x3b')]};return db[_0x427b('0x41')][_0x427b('0x1e')](_0x465895)['then'](function(_0x47bfcc){_0x268243[_0x427b('0x1e')]=_0x47bfcc;if(_0x38ac25[_0x427b('0x31')]['includeAll']){_0x5b6f92[_0x427b('0x42')]=[{'all':!![]}];}return db[_0x427b('0x41')][_0x427b('0x43')](_0x5b6f92);})[_0x427b('0x24')](function(_0x244047){_0x268243['rows']=_0x244047;return _0x268243;})['then'](respondWithFilteredResult(_0x42f162,_0x5b6f92))[_0x427b('0x44')](handleError(_0x42f162,null));};exports['show']=function(_0x157f1c,_0x3b008f){var _0x1b0291={'raw':!![],'where':{'id':_0x157f1c[_0x427b('0x45')]['id']}},_0x21a7ce={};_0x21a7ce[_0x427b('0x2f')]=_[_0x427b('0x32')](db[_0x427b('0x41')][_0x427b('0x2b')]);_0x21a7ce['query']=_['keys'](_0x157f1c[_0x427b('0x31')]);_0x21a7ce['filters']=_[_0x427b('0x34')](_0x21a7ce[_0x427b('0x2f')],_0x21a7ce[_0x427b('0x31')]);_0x1b0291['attributes']=_[_0x427b('0x34')](_0x21a7ce[_0x427b('0x2f')],qs[_0x427b('0x36')](_0x157f1c[_0x427b('0x31')][_0x427b('0x36')]));_0x1b0291[_0x427b('0x35')]=_0x1b0291['attributes']['length']?_0x1b0291[_0x427b('0x35')]:_0x21a7ce[_0x427b('0x2f')];if(_0x157f1c[_0x427b('0x31')][_0x427b('0x46')]){_0x1b0291['include']=[{'all':!![]}];}_0x1b0291=_[_0x427b('0x3f')]({},_0x1b0291,_0x157f1c[_0x427b('0x40')]);return db[_0x427b('0x41')][_0x427b('0x47')](_0x1b0291)['then'](handleEntityNotFound(_0x3b008f,null))['then'](respondWithResult(_0x3b008f,null))[_0x427b('0x44')](handleError(_0x3b008f,null));};exports[_0x427b('0x48')]=function(_0x275b90,_0x57f2b9){return db[_0x427b('0x41')][_0x427b('0x48')](_0x275b90[_0x427b('0x49')],{})['then'](function(_0x2426a0){var _0x183afe=_0x275b90[_0x427b('0x4a')][_0x427b('0x4b')]({'plain':!![]});if(!_0x183afe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x183afe[_0x427b('0x4c')]==='user'){var _0x165708=_0x2426a0[_0x427b('0x4b')]({'plain':!![]});var _0x420cda=_0x427b('0x4d');return db[_0x427b('0x4e')][_0x427b('0x47')]({'where':{'name':_0x420cda,'userProfileId':_0x183afe[_0x427b('0x4f')]},'raw':!![]})['then'](function(_0x480b8f){if(_0x480b8f&&_0x480b8f['autoAssociation']===0x0){return db[_0x427b('0x25')][_0x427b('0x48')]({'name':_0x165708['name'],'resourceId':_0x165708['id'],'type':_0x480b8f[_0x427b('0x29')],'sectionId':_0x480b8f['id']},{})['then'](function(){return _0x2426a0;});}else{return _0x2426a0;}})[_0x427b('0x44')](function(_0x13fc6b){logger['error'](_0x427b('0x50'),_0x13fc6b);throw _0x13fc6b;});}return _0x2426a0;})[_0x427b('0x24')](respondWithResult(_0x57f2b9,0xc9))[_0x427b('0x44')](handleError(_0x57f2b9,null));};exports['update']=function(_0x11475b,_0x30d3d8){if(_0x11475b[_0x427b('0x49')]['id']){delete _0x11475b[_0x427b('0x49')]['id'];}return db['CmHopperAdditionalPhone'][_0x427b('0x47')]({'where':{'id':_0x11475b['params']['id']}})['then'](handleEntityNotFound(_0x30d3d8,null))['then'](saveUpdates(_0x11475b[_0x427b('0x49')],null))[_0x427b('0x24')](respondWithResult(_0x30d3d8,null))[_0x427b('0x44')](handleError(_0x30d3d8,null));};exports[_0x427b('0x26')]=function(_0x5cc126,_0x1b6157){return db[_0x427b('0x41')][_0x427b('0x47')]({'where':{'id':_0x5cc126[_0x427b('0x45')]['id']}})[_0x427b('0x24')](handleEntityNotFound(_0x1b6157,null))[_0x427b('0x24')](removeEntity(_0x1b6157,null))[_0x427b('0x44')](handleError(_0x1b6157,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 78b9ef2..8b16d04 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 _0x517c=['exports','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x400766,_0x368660){var _0x3ae58b=function(_0x4c6a6e){while(--_0x4c6a6e){_0x400766['push'](_0x400766['shift']());}};_0x3ae58b(++_0x368660);}(_0x517c,0x92));var _0xc517=function(_0xdd5ae3,_0xa12034){_0xdd5ae3=_0xdd5ae3-0x0;var _0xb6dc3d=_0x517c[_0xdd5ae3];return _0xb6dc3d;};'use strict';var _=require(_0xc517('0x0'));var util=require(_0xc517('0x1'));var logger=require(_0xc517('0x2'))('api');var moment=require(_0xc517('0x3'));var BPromise=require(_0xc517('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc517('0x5'));var config=require(_0xc517('0x6'));var attributes=require(_0xc517('0x7'));module[_0xc517('0x8')]=function(_0x50af6d,_0x1c77bd){return _0x50af6d[_0xc517('0x9')](_0xc517('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7148=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7148,0x119));var _0x8714=function(_0x59fbca,_0x3e7e5b){_0x59fbca=_0x59fbca-0x0;var _0x227c0f=_0x7148[_0x59fbca];return _0x227c0f;};'use strict';var _=require('lodash');var util=require(_0x8714('0x0'));var logger=require(_0x8714('0x1'))(_0x8714('0x2'));var moment=require(_0x8714('0x3'));var BPromise=require('bluebird');var rp=require(_0x8714('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8714('0x5'));var config=require(_0x8714('0x6'));var attributes=require(_0x8714('0x7'));module[_0x8714('0x8')]=function(_0x1eaef9,_0x43afec){return _0x1eaef9[_0x8714('0x9')](_0x8714('0xa'),attributes,{'tableName':_0x8714('0xb'),'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 e997774..737b89d 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 _0x2c26=['OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','catch','duration','waitTime','isNil','scheduledat','minutes','add','countnoanswerretry','createdAt','updatedAt','phone','sequelize','transaction','update','IncrementPreviewCounters','field','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','CmHopperAdditionalPhone,\x20%s,\x20%s','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c26,0x172));var _0x62c2=function(_0x40c9ba,_0x1030cd){_0x40c9ba=_0x40c9ba-0x0;var _0x4dd1d6=_0x2c26[_0x40c9ba];return _0x4dd1d6;};'use strict';var _=require('lodash');var util=require(_0x62c2('0x0'));var moment=require(_0x62c2('0x1'));var BPromise=require(_0x62c2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62c2('0x3'));var db=require(_0x62c2('0x4'))['db'];var utils=require(_0x62c2('0x5'));var logger=require(_0x62c2('0x6'))(_0x62c2('0x7'));var config=require(_0x62c2('0x8'));var jayson=require(_0x62c2('0x9'));var client=jayson[_0x62c2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cd115,_0x202d93,_0x3009d8){return new BPromise(function(_0x36bfcf,_0x13ed41){return client[_0x62c2('0xb')](_0x1cd115,_0x3009d8)[_0x62c2('0xc')](function(_0x29e447){logger[_0x62c2('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x202d93,_0x62c2('0xe'));logger[_0x62c2('0xf')](_0x62c2('0x10'),_0x202d93,'request\x20sent',JSON['stringify'](_0x29e447));if(_0x29e447['error']){if(_0x29e447['error']['code']===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x202d93,_0x29e447[_0x62c2('0x11')][_0x62c2('0x12')]);return _0x13ed41(_0x29e447[_0x62c2('0x11')]['message']);}logger[_0x62c2('0x11')](_0x62c2('0x13'),_0x202d93,_0x29e447['error'][_0x62c2('0x12')]);return _0x36bfcf(_0x29e447[_0x62c2('0x11')][_0x62c2('0x12')]);}else{logger[_0x62c2('0xd')](_0x62c2('0x13'),_0x202d93,_0x62c2('0xe'));_0x36bfcf(_0x29e447[_0x62c2('0x14')][_0x62c2('0x12')]);}})['catch'](function(_0xda92c4){logger[_0x62c2('0x11')](_0x62c2('0x13'),_0x202d93,_0xda92c4);_0x13ed41(_0xda92c4);});});}exports[_0x62c2('0x15')]=function(_0x2e1170){var _0x2da2cd=this;return new Promise(function(_0x6ac35b,_0x25bb39){return db[_0x62c2('0x16')][_0x62c2('0x17')]({'raw':!![],'where':{'ContactId':_0x2e1170[_0x62c2('0x18')][_0x62c2('0x19')],'ListId':_0x2e1170[_0x62c2('0x18')][_0x62c2('0x1a')],'VoiceQueueId':_0x2e1170[_0x62c2('0x18')][_0x62c2('0x1b')]===undefined?null:_0x2e1170['body'][_0x62c2('0x1b')],'CampaignId':_0x2e1170['body'][_0x62c2('0x1c')]===undefined?null:_0x2e1170['body'][_0x62c2('0x1c')]}})['then'](function(_0x358e71){if(_0x358e71!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x358e71['id'],'OrderBy':{'$gt':_0x358e71[_0x62c2('0x1d')]}},'order':[['OrderBy',_0x62c2('0x1e')]]})[_0x62c2('0xc')](function(_0x1291a8){var _0x3e7de0=0x0;if(_0x1291a8){if(_0x1291a8[_0x62c2('0x1f')]+_0x1291a8[_0x62c2('0x20')]+_0x1291a8['countnoanswerretry']+_0x1291a8[_0x62c2('0x21')]+_0x1291a8[_0x62c2('0x22')]+_0x1291a8[_0x62c2('0x23')]+_0x1291a8[_0x62c2('0x24')]+_0x1291a8[_0x62c2('0x25')]<_0x2e1170[_0x62c2('0x26')][_0x62c2('0x27')])_0x3e7de0=0x1;_0x6ac35b({'additional':_0x3e7de0});}else{return db[_0x62c2('0x28')][_0x62c2('0x17')]({'raw':!![],'where':{'CmHopperId':_0x358e71['id']},'order':[['OrderBy',_0x62c2('0x1e')]]})['then'](function(_0x4af9a9){var _0x3f85b9=0x0;if(_0x4af9a9){if(_0x4af9a9[_0x62c2('0x1f')]+_0x4af9a9[_0x62c2('0x20')]+_0x4af9a9['countnoanswerretry']+_0x4af9a9['countnosuchnumberretry']+_0x4af9a9[_0x62c2('0x22')]+_0x4af9a9[_0x62c2('0x23')]+_0x4af9a9[_0x62c2('0x24')]+_0x4af9a9[_0x62c2('0x25')]<_0x2e1170['entity'][_0x62c2('0x27')])_0x3f85b9=0x1;_0x6ac35b({'additional':_0x3f85b9});}else{_0x6ac35b({'additional':0x0});}})[_0x62c2('0x29')](function(_0x220ada){logger['error'](_0x62c2('0x15'),_0x220ada[_0x62c2('0x12')]);_0x25bb39(_0x2da2cd[_0x62c2('0x11')](0x1f4,_0x220ada[_0x62c2('0x12')]));});}})[_0x62c2('0x29')](function(_0x20eee6){logger[_0x62c2('0x11')](_0x62c2('0x15'),_0x20eee6[_0x62c2('0x12')]);_0x25bb39(_0x2da2cd[_0x62c2('0x11')](0x1f4,_0x20eee6[_0x62c2('0x12')]));});}else _0x6ac35b({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x4b31ce){var _0x5b5ae0=this;return new Promise(function(_0x4379d6,_0x1ec0f4){return db[_0x62c2('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x4b31ce['body']['ContactId'],'ListId':_0x4b31ce['body'][_0x62c2('0x1a')],'VoiceQueueId':_0x4b31ce[_0x62c2('0x18')][_0x62c2('0x1b')]===undefined?null:_0x4b31ce['body'][_0x62c2('0x1b')],'CampaignId':_0x4b31ce[_0x62c2('0x18')][_0x62c2('0x1c')]===undefined?null:_0x4b31ce[_0x62c2('0x18')][_0x62c2('0x1c')]}})[_0x62c2('0xc')](function(_0x46dd69){if(_0x46dd69!=null){return db[_0x62c2('0x28')][_0x62c2('0x17')]({'raw':!![],'where':{'CmHopperId':_0x46dd69['id'],'OrderBy':{'$gte':_0x46dd69[_0x62c2('0x1d')]}},'order':[[_0x62c2('0x1d'),'ASC']]})[_0x62c2('0xc')](function(_0x599255){if(_0x599255)return activateAdditionalPhone(_0x46dd69,_0x4b31ce['body'],_0x599255,_0x4b31ce[_0x62c2('0x2a')],_0x4b31ce['waitTime'])['then'](function(_0x47fad5){_0x4379d6(_0x47fad5);});else{return db['CmHopperAdditionalPhone'][_0x62c2('0x17')]({'raw':!![],'where':{'CmHopperId':_0x46dd69['id']},'order':[[_0x62c2('0x1d'),_0x62c2('0x1e')]]})[_0x62c2('0xc')](function(_0x1de49b){if(_0x1de49b)return activateAdditionalPhone(_0x46dd69,_0x4b31ce[_0x62c2('0x18')],_0x1de49b,_0x4b31ce[_0x62c2('0x2a')],_0x4b31ce[_0x62c2('0x2b')])[_0x62c2('0xc')](function(_0x207ac8){_0x4379d6(_0x207ac8);});else{_0x4379d6({'id':_0x46dd69['id'],'phone':''});}})['catch'](function(_0x2c9d61){logger['error'](_0x62c2('0x15'),_0x2c9d61[_0x62c2('0x12')]);_0x1ec0f4(_0x5b5ae0[_0x62c2('0x11')](0x1f4,_0x2c9d61[_0x62c2('0x12')]));});}})[_0x62c2('0x29')](function(_0x48904f){logger[_0x62c2('0x11')]('VerifyAdditionalPhones',_0x48904f[_0x62c2('0x12')]);_0x1ec0f4(_0x5b5ae0[_0x62c2('0x11')](0x1f4,_0x48904f[_0x62c2('0x12')]));});}else _0x4379d6(0x1);});});};function activateAdditionalPhone(_0x490584,_0x5dd6ec,_0x515f27,_0x1e529c,_0x259f11){return new Promise(function(_0x35cc2d,_0x3e3d8b){var _0xea3568;if(_[_0x62c2('0x2c')](_0x515f27[_0x62c2('0x2d')])){_0x515f27[_0x62c2('0x2d')]=moment();}if(moment()>moment(_0x515f27[_0x62c2('0x2d')])){_0xea3568=moment()['add'](_0x259f11||0x3,_0x62c2('0x2e'));}else{if(_0x515f27[_0x62c2('0x1d')]==0x0){_0xea3568=moment(_0x515f27[_0x62c2('0x2d')]);}else{_0xea3568=moment()[_0x62c2('0x2f')](_0x259f11||0x3,_0x62c2('0x2e'));}}if(_[_0x62c2('0x2c')](_0xea3568)){_0xea3568=moment()['add'](_0x259f11||0x3,'minutes');}var _0x2cd88c={'phone':_0x490584['phone'],'active':0x0,'OrderBy':_[_0x62c2('0x2c')](_0x490584['OrderBy'])?0x0:_0x490584['OrderBy'],'scheduledat':moment()['add'](_0x1e529c||0x1,_0x62c2('0x2e')),'countbusyretry':_0x5dd6ec['countbusyretry'],'countcongestionretry':_0x5dd6ec[_0x62c2('0x20')],'countnoanswerretry':_0x5dd6ec[_0x62c2('0x30')],'countnosuchnumberretry':_0x5dd6ec[_0x62c2('0x21')],'countdropretry':_0x5dd6ec['countdropretry'],'countabandonedretry':_0x5dd6ec[_0x62c2('0x23')],'countmachineretry':_0x5dd6ec[_0x62c2('0x24')],'countagentrejectretry':_0x5dd6ec[_0x62c2('0x25')],'createdAt':_0x5dd6ec[_0x62c2('0x31')],'updatedAt':_0x5dd6ec[_0x62c2('0x32')]};var _0x45ec40={'CmHopperId':_0x490584['id'],'phone':_0x515f27[_0x62c2('0x33')],'active':0x0,'OrderBy':_[_0x62c2('0x2c')](_0x515f27[_0x62c2('0x1d')])?0x0:_0x515f27[_0x62c2('0x1d')],'scheduledat':_0xea3568,'countbusyretry':_0x515f27[_0x62c2('0x1f')],'countcongestionretry':_0x515f27[_0x62c2('0x20')],'countnoanswerretry':_0x515f27['countnoanswerretry'],'countnosuchnumberretry':_0x515f27['countnosuchnumberretry'],'countdropretry':_0x515f27['countdropretry'],'countabandonedretry':_0x515f27['countabandonedretry'],'countmachineretry':_0x515f27[_0x62c2('0x24')],'countagentrejectretry':_0x515f27['countagentrejectretry'],'createdAt':_0x515f27[_0x62c2('0x31')],'updatedAt':_0x515f27[_0x62c2('0x32')]};return db[_0x62c2('0x34')][_0x62c2('0x35')](function(_0x59c472){return db['CmHopperAdditionalPhone']['update'](_0x2cd88c,{'where':{'id':_0x515f27['id']}},{'transaction':_0x59c472})[_0x62c2('0xc')](function(){return db[_0x62c2('0x16')][_0x62c2('0x36')](_0x45ec40,{'where':{'id':_0x490584['id']}},{'transaction':_0x59c472});});})[_0x62c2('0xc')](function(_0x1b22c8){_0x35cc2d({'id':_0x490584['id'],'phone':_0x515f27[_0x62c2('0x33')]});})['catch'](function(_0x32ebb1){logger[_0x62c2('0x11')]('activateAdditionalPhone',_0x32ebb1[_0x62c2('0x12')]);_0x3e3d8b({'error':_0x32ebb1['message']});});});}exports[_0x62c2('0x37')]=function(_0x14dbb5){var _0x5939c5=this;return new Promise(function(_0x4f620e,_0x3a4640){return db[_0x62c2('0x16')][_0x62c2('0x36')](_0x14dbb5[_0x62c2('0x18')][_0x62c2('0x38')],{'where':{'id':_0x14dbb5[_0x62c2('0x18')]['id']}})[_0x62c2('0xc')](function(_0x1bb295){_0x4f620e(_0x1bb295);})['catch'](function(_0x55390a){logger['error']('IncrementPreviewCounters',_0x55390a[_0x62c2('0x12')]);_0x3a4640(_0x5939c5[_0x62c2('0x11')](0x1f4,_0x55390a[_0x62c2('0x12')]));});});}; \ No newline at end of file +var _0x94eb=['scheduledat','add','minutes','phone','updatedAt','countbusyretry','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','result','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','entity','VerifyAdditionalPhones','duration','waitTime','isNil'];(function(_0x338936,_0x4de991){var _0x4134a0=function(_0x3230fd){while(--_0x3230fd){_0x338936['push'](_0x338936['shift']());}};_0x4134a0(++_0x4de991);}(_0x94eb,0xb5));var _0xb94e=function(_0x549796,_0x1d50d0){_0x549796=_0x549796-0x0;var _0x4550f9=_0x94eb[_0x549796];return _0x4550f9;};'use strict';var _=require(_0xb94e('0x0'));var util=require(_0xb94e('0x1'));var moment=require(_0xb94e('0x2'));var BPromise=require(_0xb94e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb94e('0x4'))['db'];var utils=require(_0xb94e('0x5'));var logger=require(_0xb94e('0x6'))(_0xb94e('0x7'));var config=require(_0xb94e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb94e('0x9')][_0xb94e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50c440,_0x6f6b64,_0x58a166){return new BPromise(function(_0x189335,_0xa6810a){return client[_0xb94e('0xb')](_0x50c440,_0x58a166)[_0xb94e('0xc')](function(_0x1e3c8a){logger[_0xb94e('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x6f6b64,_0xb94e('0xe'));logger[_0xb94e('0xf')](_0xb94e('0x10'),_0x6f6b64,_0xb94e('0xe'),JSON[_0xb94e('0x11')](_0x1e3c8a));if(_0x1e3c8a[_0xb94e('0x12')]){if(_0x1e3c8a[_0xb94e('0x12')][_0xb94e('0x13')]===0x1f4){logger[_0xb94e('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x6f6b64,_0x1e3c8a[_0xb94e('0x12')][_0xb94e('0x14')]);return _0xa6810a(_0x1e3c8a[_0xb94e('0x12')][_0xb94e('0x14')]);}logger['error'](_0xb94e('0x15'),_0x6f6b64,_0x1e3c8a[_0xb94e('0x12')][_0xb94e('0x14')]);return _0x189335(_0x1e3c8a[_0xb94e('0x12')][_0xb94e('0x14')]);}else{logger[_0xb94e('0xd')](_0xb94e('0x15'),_0x6f6b64,'request\x20sent');_0x189335(_0x1e3c8a[_0xb94e('0x16')][_0xb94e('0x14')]);}})[_0xb94e('0x17')](function(_0x5d099d){logger[_0xb94e('0x12')](_0xb94e('0x15'),_0x6f6b64,_0x5d099d);_0xa6810a(_0x5d099d);});});}exports['VerifyAdditionalPhones']=function(_0x39f69e){var _0x6e1a98=this;return new Promise(function(_0x16170e,_0x368748){return db[_0xb94e('0x18')][_0xb94e('0x19')]({'raw':!![],'where':{'ContactId':_0x39f69e[_0xb94e('0x1a')][_0xb94e('0x1b')],'ListId':_0x39f69e['body'][_0xb94e('0x1c')],'VoiceQueueId':_0x39f69e[_0xb94e('0x1a')][_0xb94e('0x1d')]===undefined?null:_0x39f69e[_0xb94e('0x1a')][_0xb94e('0x1d')],'CampaignId':_0x39f69e[_0xb94e('0x1a')]['CampaignId']===undefined?null:_0x39f69e[_0xb94e('0x1a')][_0xb94e('0x1e')]}})[_0xb94e('0xc')](function(_0x14cb14){if(_0x14cb14!=null){return db[_0xb94e('0x1f')][_0xb94e('0x19')]({'raw':!![],'where':{'CmHopperId':_0x14cb14['id'],'OrderBy':{'$gt':_0x14cb14[_0xb94e('0x20')]}},'order':[['OrderBy',_0xb94e('0x21')]]})[_0xb94e('0xc')](function(_0x320a38){var _0x4e62a8=0x0;if(_0x320a38){if(_0x320a38['countbusyretry']+_0x320a38[_0xb94e('0x22')]+_0x320a38[_0xb94e('0x23')]+_0x320a38[_0xb94e('0x24')]+_0x320a38[_0xb94e('0x25')]+_0x320a38[_0xb94e('0x26')]+_0x320a38[_0xb94e('0x27')]+_0x320a38[_0xb94e('0x28')]<_0x39f69e['entity'][_0xb94e('0x29')])_0x4e62a8=0x1;_0x16170e({'additional':_0x4e62a8});}else{return db['CmHopperAdditionalPhone'][_0xb94e('0x19')]({'raw':!![],'where':{'CmHopperId':_0x14cb14['id']},'order':[[_0xb94e('0x20'),_0xb94e('0x21')]]})[_0xb94e('0xc')](function(_0x556e3b){var _0x11cf37=0x0;if(_0x556e3b){if(_0x556e3b['countbusyretry']+_0x556e3b[_0xb94e('0x22')]+_0x556e3b[_0xb94e('0x23')]+_0x556e3b[_0xb94e('0x24')]+_0x556e3b[_0xb94e('0x25')]+_0x556e3b['countabandonedretry']+_0x556e3b['countmachineretry']+_0x556e3b[_0xb94e('0x28')]<_0x39f69e[_0xb94e('0x2a')][_0xb94e('0x29')])_0x11cf37=0x1;_0x16170e({'additional':_0x11cf37});}else{_0x16170e({'additional':0x0});}})['catch'](function(_0x3f8f2b){logger['error'](_0xb94e('0x2b'),_0x3f8f2b[_0xb94e('0x14')]);_0x368748(_0x6e1a98[_0xb94e('0x12')](0x1f4,_0x3f8f2b[_0xb94e('0x14')]));});}})[_0xb94e('0x17')](function(_0x4343f1){logger[_0xb94e('0x12')](_0xb94e('0x2b'),_0x4343f1[_0xb94e('0x14')]);_0x368748(_0x6e1a98[_0xb94e('0x12')](0x1f4,_0x4343f1[_0xb94e('0x14')]));});}else _0x16170e({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x1b8107){var _0x29dbd3=this;return new Promise(function(_0x2f1dd7,_0x3ce3d7){return db[_0xb94e('0x18')][_0xb94e('0x19')]({'raw':!![],'where':{'ContactId':_0x1b8107[_0xb94e('0x1a')][_0xb94e('0x1b')],'ListId':_0x1b8107['body'][_0xb94e('0x1c')],'VoiceQueueId':_0x1b8107[_0xb94e('0x1a')][_0xb94e('0x1d')]===undefined?null:_0x1b8107[_0xb94e('0x1a')][_0xb94e('0x1d')],'CampaignId':_0x1b8107['body'][_0xb94e('0x1e')]===undefined?null:_0x1b8107[_0xb94e('0x1a')][_0xb94e('0x1e')]}})[_0xb94e('0xc')](function(_0x1ef7c9){if(_0x1ef7c9!=null){return db[_0xb94e('0x1f')][_0xb94e('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1ef7c9['id'],'OrderBy':{'$gte':_0x1ef7c9[_0xb94e('0x20')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x41cd52){if(_0x41cd52)return activateAdditionalPhone(_0x1ef7c9,_0x1b8107[_0xb94e('0x1a')],_0x41cd52,_0x1b8107[_0xb94e('0x2c')],_0x1b8107[_0xb94e('0x2d')])['then'](function(_0x322142){_0x2f1dd7(_0x322142);});else{return db[_0xb94e('0x1f')][_0xb94e('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1ef7c9['id']},'order':[[_0xb94e('0x20'),_0xb94e('0x21')]]})[_0xb94e('0xc')](function(_0x5c47cc){if(_0x5c47cc)return activateAdditionalPhone(_0x1ef7c9,_0x1b8107[_0xb94e('0x1a')],_0x5c47cc,_0x1b8107[_0xb94e('0x2c')],_0x1b8107[_0xb94e('0x2d')])[_0xb94e('0xc')](function(_0x317a82){_0x2f1dd7(_0x317a82);});else{_0x2f1dd7({'id':_0x1ef7c9['id'],'phone':''});}})[_0xb94e('0x17')](function(_0x42edd5){logger[_0xb94e('0x12')](_0xb94e('0x2b'),_0x42edd5[_0xb94e('0x14')]);_0x3ce3d7(_0x29dbd3['error'](0x1f4,_0x42edd5[_0xb94e('0x14')]));});}})[_0xb94e('0x17')](function(_0x23b031){logger[_0xb94e('0x12')](_0xb94e('0x2b'),_0x23b031[_0xb94e('0x14')]);_0x3ce3d7(_0x29dbd3[_0xb94e('0x12')](0x1f4,_0x23b031['message']));});}else _0x2f1dd7(0x1);});});};function activateAdditionalPhone(_0x528681,_0x22d9a4,_0x431d27,_0x1f6271,_0x456132){return new Promise(function(_0x178f55,_0x4109ca){var _0x5280ed;if(_[_0xb94e('0x2e')](_0x431d27[_0xb94e('0x2f')])){_0x431d27['scheduledat']=moment();}if(moment()>moment(_0x431d27['scheduledat'])){_0x5280ed=moment()[_0xb94e('0x30')](_0x456132||0x3,_0xb94e('0x31'));}else{if(_0x431d27[_0xb94e('0x20')]==0x0){_0x5280ed=moment(_0x431d27['scheduledat']);}else{_0x5280ed=moment()[_0xb94e('0x30')](_0x456132||0x3,_0xb94e('0x31'));}}if(_[_0xb94e('0x2e')](_0x5280ed)){_0x5280ed=moment()['add'](_0x456132||0x3,'minutes');}var _0x3067be={'phone':_0x528681[_0xb94e('0x32')],'active':0x0,'OrderBy':_[_0xb94e('0x2e')](_0x528681['OrderBy'])?0x0:_0x528681[_0xb94e('0x20')],'scheduledat':moment()[_0xb94e('0x30')](_0x1f6271||0x1,_0xb94e('0x31')),'countbusyretry':_0x22d9a4['countbusyretry'],'countcongestionretry':_0x22d9a4['countcongestionretry'],'countnoanswerretry':_0x22d9a4['countnoanswerretry'],'countnosuchnumberretry':_0x22d9a4[_0xb94e('0x24')],'countdropretry':_0x22d9a4[_0xb94e('0x25')],'countabandonedretry':_0x22d9a4[_0xb94e('0x26')],'countmachineretry':_0x22d9a4[_0xb94e('0x27')],'countagentrejectretry':_0x22d9a4[_0xb94e('0x28')],'createdAt':_0x22d9a4['createdAt'],'updatedAt':_0x22d9a4[_0xb94e('0x33')]};var _0x5e7f87={'CmHopperId':_0x528681['id'],'phone':_0x431d27['phone'],'active':0x0,'OrderBy':_[_0xb94e('0x2e')](_0x431d27['OrderBy'])?0x0:_0x431d27[_0xb94e('0x20')],'scheduledat':_0x5280ed,'countbusyretry':_0x431d27[_0xb94e('0x34')],'countcongestionretry':_0x431d27['countcongestionretry'],'countnoanswerretry':_0x431d27[_0xb94e('0x23')],'countnosuchnumberretry':_0x431d27['countnosuchnumberretry'],'countdropretry':_0x431d27['countdropretry'],'countabandonedretry':_0x431d27[_0xb94e('0x26')],'countmachineretry':_0x431d27[_0xb94e('0x27')],'countagentrejectretry':_0x431d27[_0xb94e('0x28')],'createdAt':_0x431d27['createdAt'],'updatedAt':_0x431d27['updatedAt']};return db['sequelize'][_0xb94e('0x35')](function(_0x1e3b67){return db[_0xb94e('0x1f')][_0xb94e('0x36')](_0x3067be,{'where':{'id':_0x431d27['id']}},{'transaction':_0x1e3b67})[_0xb94e('0xc')](function(){return db['CmHopper'][_0xb94e('0x36')](_0x5e7f87,{'where':{'id':_0x528681['id']}},{'transaction':_0x1e3b67});});})['then'](function(_0x2c8475){_0x178f55({'id':_0x528681['id'],'phone':_0x431d27[_0xb94e('0x32')]});})[_0xb94e('0x17')](function(_0x13f444){logger[_0xb94e('0x12')](_0xb94e('0x37'),_0x13f444[_0xb94e('0x14')]);_0x4109ca({'error':_0x13f444[_0xb94e('0x14')]});});});}exports[_0xb94e('0x38')]=function(_0x523e2a){var _0x53fd9a=this;return new Promise(function(_0x124388,_0x356fd1){return db['CmHopper'][_0xb94e('0x36')](_0x523e2a[_0xb94e('0x1a')]['field'],{'where':{'id':_0x523e2a[_0xb94e('0x1a')]['id']}})[_0xb94e('0xc')](function(_0x1f9645){_0x124388(_0x1f9645);})[_0xb94e('0x17')](function(_0x2875cf){logger['error'](_0xb94e('0x38'),_0x2875cf[_0xb94e('0x14')]);_0x356fd1(_0x53fd9a[_0xb94e('0x12')](0x1f4,_0x2875cf[_0xb94e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 327c887..4243117 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 _0xc28e=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','put','update','delete','destroy','exports','multer'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xc28e,0x1af));var _0xec28=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc28e[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xec28('0x0'));var util=require(_0xec28('0x1'));var path=require(_0xec28('0x2'));var timeout=require(_0xec28('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xec28('0x4'));var auth=require(_0xec28('0x5'));var interaction=require(_0xec28('0x6'));var config=require(_0xec28('0x7'));var controller=require(_0xec28('0x8'));router[_0xec28('0x9')]('/',auth[_0xec28('0xa')](),controller['index']);router[_0xec28('0x9')](_0xec28('0xb'),auth['isAuthenticated'](),controller[_0xec28('0xc')]);router['post']('/',auth[_0xec28('0xa')](),controller['create']);router[_0xec28('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xec28('0xe')]);router[_0xec28('0xf')](_0xec28('0xb'),auth[_0xec28('0xa')](),controller[_0xec28('0x10')]);module[_0xec28('0x11')]=router; \ No newline at end of file +var _0x9215=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','put','destroy','multer','util','path','connect-timeout'];(function(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0x9215,0x13f));var _0x5921=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x9215[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x5921('0x0'));var util=require(_0x5921('0x1'));var path=require(_0x5921('0x2'));var timeout=require(_0x5921('0x3'));var express=require(_0x5921('0x4'));var router=express[_0x5921('0x5')]();var fs_extra=require(_0x5921('0x6'));var auth=require(_0x5921('0x7'));var interaction=require(_0x5921('0x8'));var config=require('../../config/environment');var controller=require(_0x5921('0x9'));router[_0x5921('0xa')]('/',auth[_0x5921('0xb')](),controller[_0x5921('0xc')]);router[_0x5921('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5921('0xd')]);router[_0x5921('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5921('0xf')]('/:id',auth[_0x5921('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5921('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 5c5d2ad..824ab8f 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 _0xa498=['INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x3160f4,_0x26a0b9){var _0x214221=function(_0x2f7c57){while(--_0x2f7c57){_0x3160f4['push'](_0x3160f4['shift']());}};_0x214221(++_0x26a0b9);}(_0xa498,0x179));var _0x8a49=function(_0x1bf8cc,_0x118778){_0x1bf8cc=_0x1bf8cc-0x0;var _0x322d20=_0xa498[_0x1bf8cc];return _0x322d20;};'use strict';var moment=require(_0x8a49('0x0'));var Sequelize=require(_0x8a49('0x1'));module[_0x8a49('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8a49('0x3')],'unique':_0x8a49('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x8a49('0x4')},'VoiceQueueId':{'type':Sequelize[_0x8a49('0x3')],'unique':_0x8a49('0x4')}}; \ No newline at end of file +var _0x3f1c=['moment','STRING','INTEGER','contactListQueue'];(function(_0x12843f,_0x26abea){var _0x5277cf=function(_0x15597f){while(--_0x15597f){_0x12843f['push'](_0x12843f['shift']());}};_0x5277cf(++_0x26abea);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x4bbfb2,_0x4b1518){_0x4bbfb2=_0x4bbfb2-0x0;var _0x9fa82c=_0x3f1c[_0x4bbfb2];return _0x9fa82c;};'use strict';var moment=require(_0xc3f1('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xc3f1('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xc3f1('0x2')],'unique':_0xc3f1('0x3')},'VoiceQueueId':{'type':Sequelize[_0xc3f1('0x2')],'unique':_0xc3f1('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7867edf..1cf8c13 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 _0x6237=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','order','pick','where','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','options','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x547543,_0x5534ca){var _0xf4234=function(_0x2b43bc){while(--_0x2b43bc){_0x547543['push'](_0x547543['shift']());}};_0xf4234(++_0x5534ca);}(_0x6237,0xc4));var _0x7623=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x6237[_0x1f6f84];return _0x177f40;};'use strict';var emlformat=require(_0x7623('0x0'));var rimraf=require(_0x7623('0x1'));var zipdir=require(_0x7623('0x2'));var jsonpatch=require(_0x7623('0x3'));var rp=require(_0x7623('0x4'));var moment=require(_0x7623('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7623('0x6'));var util=require(_0x7623('0x7'));var path=require(_0x7623('0x8'));var sox=require('sox');var csv=require(_0x7623('0x9'));var ejs=require(_0x7623('0xa'));var fs=require('fs');var fs_extra=require(_0x7623('0xb'));var _=require(_0x7623('0xc'));var squel=require('squel');var crypto=require(_0x7623('0xd'));var jsforce=require(_0x7623('0xe'));var deskjs=require(_0x7623('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7623('0x10'));var Papa=require(_0x7623('0x11'));var Redis=require(_0x7623('0x12'));var authService=require(_0x7623('0x13'));var qs=require(_0x7623('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7623('0x15'));var logger=require('../../config/logger')(_0x7623('0x16'));var utils=require(_0x7623('0x17'));var config=require(_0x7623('0x18'));var licenseUtil=require(_0x7623('0x19'));var db=require(_0x7623('0x1a'))['db'];function respondWithStatusCode(_0xc4c6ee,_0x545b45){_0x545b45=_0x545b45||0xcc;return function(_0x44b3ad){if(_0x44b3ad){return _0xc4c6ee[_0x7623('0x1b')](_0x545b45);}return _0xc4c6ee['status'](_0x545b45)['end']();};}function respondWithResult(_0xc1a820,_0x4ef92a){_0x4ef92a=_0x4ef92a||0xc8;return function(_0x5994ee){if(_0x5994ee){return _0xc1a820[_0x7623('0x1c')](_0x4ef92a)[_0x7623('0x1d')](_0x5994ee);}};}function respondWithFilteredResult(_0x14520f,_0x57d2a9){return function(_0x542cd8){if(_0x542cd8){var _0x26e536=typeof _0x57d2a9[_0x7623('0x1e')]===_0x7623('0x1f')&&typeof _0x57d2a9[_0x7623('0x20')]===_0x7623('0x1f');var _0x410986=_0x542cd8['count'];var _0x5173a5=_0x26e536?0x0:_0x57d2a9[_0x7623('0x1e')];var _0x28ce30=_0x26e536?_0x542cd8[_0x7623('0x21')]:_0x57d2a9[_0x7623('0x1e')]+_0x57d2a9[_0x7623('0x20')];var _0x4afdf6;if(_0x28ce30>=_0x410986){_0x28ce30=_0x410986;_0x4afdf6=0xc8;}else{_0x4afdf6=0xce;}_0x14520f[_0x7623('0x1c')](_0x4afdf6);return _0x14520f[_0x7623('0x22')](_0x7623('0x23'),_0x5173a5+'-'+_0x28ce30+'/'+_0x410986)[_0x7623('0x1d')](_0x542cd8);}return null;};}function patchUpdates(_0x4fe221){return function(_0x2d9bce){try{jsonpatch['apply'](_0x2d9bce,_0x4fe221,!![]);}catch(_0x11e971){return BPromise[_0x7623('0x24')](_0x11e971);}return _0x2d9bce[_0x7623('0x25')]();};}function saveUpdates(_0x2e306d,_0x2cb2d8){return function(_0x401cb3){if(_0x401cb3){return _0x401cb3[_0x7623('0x26')](_0x2e306d)[_0x7623('0x27')](function(_0x468d9e){return _0x468d9e;});}return null;};}function removeEntity(_0x3916cf,_0x3cac7c){return function(_0x34cdd2){if(_0x34cdd2){return _0x34cdd2[_0x7623('0x28')]()[_0x7623('0x27')](function(){_0x3916cf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x393962,_0x2b888d){return function(_0x20df41){if(!_0x20df41){_0x393962[_0x7623('0x1b')](0x194);}return _0x20df41;};}function handleError(_0x4fd17e,_0x3e9ce5){_0x3e9ce5=_0x3e9ce5||0x1f4;return function(_0x53de85){logger['error'](_0x53de85[_0x7623('0x29')]);if(_0x53de85[_0x7623('0x2a')]){delete _0x53de85[_0x7623('0x2a')];}_0x4fd17e[_0x7623('0x1c')](_0x3e9ce5)[_0x7623('0x2b')](_0x53de85);};}exports[_0x7623('0x2c')]=function(_0x5ac5db,_0x384ad1){var _0xf6b458={},_0xa7d4b0={},_0x3eb838={'count':0x0,'rows':[]};var _0x2f71ad=_[_0x7623('0x2d')](db[_0x7623('0x2e')][_0x7623('0x2f')],function(_0x4ca14c){return{'name':_0x4ca14c['fieldName'],'type':_0x4ca14c[_0x7623('0x30')]['key']};});_0xa7d4b0['model']=_[_0x7623('0x2d')](_0x2f71ad,_0x7623('0x2a'));_0xa7d4b0[_0x7623('0x31')]=_[_0x7623('0x32')](_0x5ac5db[_0x7623('0x31')]);_0xa7d4b0[_0x7623('0x33')]=_[_0x7623('0x34')](_0xa7d4b0['model'],_0xa7d4b0[_0x7623('0x31')]);_0xf6b458[_0x7623('0x35')]=_['intersection'](_0xa7d4b0[_0x7623('0x36')],qs['fields'](_0x5ac5db[_0x7623('0x31')][_0x7623('0x37')]));_0xf6b458[_0x7623('0x35')]=_0xf6b458['attributes'][_0x7623('0x38')]?_0xf6b458[_0x7623('0x35')]:_0xa7d4b0[_0x7623('0x36')];if(!_0x5ac5db[_0x7623('0x31')]['hasOwnProperty']('nolimit')){_0xf6b458[_0x7623('0x20')]=qs[_0x7623('0x20')](_0x5ac5db[_0x7623('0x31')][_0x7623('0x20')]);_0xf6b458['offset']=qs[_0x7623('0x1e')](_0x5ac5db[_0x7623('0x31')][_0x7623('0x1e')]);}_0xf6b458[_0x7623('0x39')]=qs['sort'](_0x5ac5db[_0x7623('0x31')]['sort']);_0xf6b458['where']=qs[_0x7623('0x33')](_[_0x7623('0x3a')](_0x5ac5db[_0x7623('0x31')],_0xa7d4b0['filters']),_0x2f71ad);if(_0x5ac5db['query']['filter']){_0xf6b458['where']=_['merge'](_0xf6b458[_0x7623('0x3b')],{'$or':_[_0x7623('0x2d')](_0x2f71ad,function(_0x16fb96){if(_0x16fb96[_0x7623('0x30')]!==_0x7623('0x3c')){var _0x531a08={};_0x531a08[_0x16fb96[_0x7623('0x2a')]]={'$like':'%'+_0x5ac5db[_0x7623('0x31')][_0x7623('0x3d')]+'%'};return _0x531a08;}})});}_0xf6b458=_[_0x7623('0x3e')]({},_0xf6b458,_0x5ac5db['options']);var _0x531fba={'where':_0xf6b458['where']};return db[_0x7623('0x2e')]['count'](_0x531fba)[_0x7623('0x27')](function(_0x4bd395){_0x3eb838[_0x7623('0x21')]=_0x4bd395;if(_0x5ac5db[_0x7623('0x31')][_0x7623('0x3f')]){_0xf6b458[_0x7623('0x40')]=[{'all':!![]}];}return db[_0x7623('0x2e')][_0x7623('0x41')](_0xf6b458);})[_0x7623('0x27')](function(_0x2d42df){_0x3eb838['rows']=_0x2d42df;return _0x3eb838;})[_0x7623('0x27')](respondWithFilteredResult(_0x384ad1,_0xf6b458))[_0x7623('0x42')](handleError(_0x384ad1,null));};exports[_0x7623('0x43')]=function(_0x4b0835,_0x3930d6){var _0x18f24a={'raw':!![],'where':{'id':_0x4b0835['params']['id']}},_0x595b8c={};_0x595b8c[_0x7623('0x36')]=_[_0x7623('0x32')](db[_0x7623('0x2e')][_0x7623('0x2f')]);_0x595b8c[_0x7623('0x31')]=_['keys'](_0x4b0835[_0x7623('0x31')]);_0x595b8c[_0x7623('0x33')]=_[_0x7623('0x34')](_0x595b8c[_0x7623('0x36')],_0x595b8c[_0x7623('0x31')]);_0x18f24a[_0x7623('0x35')]=_[_0x7623('0x34')](_0x595b8c[_0x7623('0x36')],qs['fields'](_0x4b0835[_0x7623('0x31')][_0x7623('0x37')]));_0x18f24a[_0x7623('0x35')]=_0x18f24a['attributes'][_0x7623('0x38')]?_0x18f24a['attributes']:_0x595b8c['model'];if(_0x4b0835[_0x7623('0x31')][_0x7623('0x3f')]){_0x18f24a[_0x7623('0x40')]=[{'all':!![]}];}_0x18f24a=_['merge']({},_0x18f24a,_0x4b0835[_0x7623('0x44')]);return db[_0x7623('0x2e')][_0x7623('0x45')](_0x18f24a)[_0x7623('0x27')](handleEntityNotFound(_0x3930d6,null))['then'](respondWithResult(_0x3930d6,null))[_0x7623('0x42')](handleError(_0x3930d6,null));};exports[_0x7623('0x26')]=function(_0xa1fc45,_0x537dbe){if(_0xa1fc45['body']['id']){delete _0xa1fc45[_0x7623('0x46')]['id'];}return db[_0x7623('0x2e')]['find']({'where':{'id':_0xa1fc45['params']['id']}})[_0x7623('0x27')](handleEntityNotFound(_0x537dbe,null))[_0x7623('0x27')](saveUpdates(_0xa1fc45[_0x7623('0x46')],null))[_0x7623('0x27')](respondWithResult(_0x537dbe,null))[_0x7623('0x42')](handleError(_0x537dbe,null));};exports[_0x7623('0x28')]=function(_0x527a94,_0x277319){return db['CmHopperBlack'][_0x7623('0x45')]({'where':{'id':_0x527a94[_0x7623('0x47')]['id']}})[_0x7623('0x27')](handleEntityNotFound(_0x277319,null))[_0x7623('0x27')](removeEntity(_0x277319,null))[_0x7623('0x42')](handleError(_0x277319,null));};exports[_0x7623('0x48')]=function(_0x59ea62,_0x3ed8f0){return db[_0x7623('0x2e')][_0x7623('0x48')]()['then'](respondWithResult(_0x3ed8f0,null))[_0x7623('0x42')](handleError(_0x3ed8f0,null));}; \ No newline at end of file +var _0x6073=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','stack','name','send','map','fieldName','query','keys','filters','model','attributes','intersection','fields','sort','where','pick','merge','type','VIRTUAL','filter','then','includeAll','include','rows','catch','show','params','CmHopperBlack','rawAttributes','options','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6073,0x7d));var _0x3607=function(_0x3f9b56,_0xdda9a0){_0x3f9b56=_0x3f9b56-0x0;var _0x2594d4=_0x6073[_0x3f9b56];return _0x2594d4;};'use strict';var emlformat=require(_0x3607('0x0'));var rimraf=require(_0x3607('0x1'));var zipdir=require(_0x3607('0x2'));var jsonpatch=require(_0x3607('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3607('0x4'));var util=require(_0x3607('0x5'));var path=require(_0x3607('0x6'));var sox=require(_0x3607('0x7'));var csv=require(_0x3607('0x8'));var ejs=require(_0x3607('0x9'));var fs=require('fs');var fs_extra=require(_0x3607('0xa'));var _=require(_0x3607('0xb'));var squel=require(_0x3607('0xc'));var crypto=require(_0x3607('0xd'));var jsforce=require(_0x3607('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3607('0xf'));var Redis=require(_0x3607('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3607('0x11'));var as=require(_0x3607('0x12'));var hardwareService=require(_0x3607('0x13'));var logger=require(_0x3607('0x14'))('api');var utils=require(_0x3607('0x15'));var config=require(_0x3607('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3607('0x17'))['db'];function respondWithStatusCode(_0x4ba57f,_0xee3cd2){_0xee3cd2=_0xee3cd2||0xcc;return function(_0x2f8c0d){if(_0x2f8c0d){return _0x4ba57f[_0x3607('0x18')](_0xee3cd2);}return _0x4ba57f[_0x3607('0x19')](_0xee3cd2)[_0x3607('0x1a')]();};}function respondWithResult(_0x1cdd71,_0x63621c){_0x63621c=_0x63621c||0xc8;return function(_0x1c9128){if(_0x1c9128){return _0x1cdd71[_0x3607('0x19')](_0x63621c)[_0x3607('0x1b')](_0x1c9128);}};}function respondWithFilteredResult(_0x30b852,_0x51d4eb){return function(_0x834e82){if(_0x834e82){var _0xc62459=typeof _0x51d4eb[_0x3607('0x1c')]===_0x3607('0x1d')&&typeof _0x51d4eb['limit']===_0x3607('0x1d');var _0x4aa816=_0x834e82[_0x3607('0x1e')];var _0x3aa638=_0xc62459?0x0:_0x51d4eb[_0x3607('0x1c')];var _0x102b3e=_0xc62459?_0x834e82['count']:_0x51d4eb[_0x3607('0x1c')]+_0x51d4eb[_0x3607('0x1f')];var _0x39b1b6;if(_0x102b3e>=_0x4aa816){_0x102b3e=_0x4aa816;_0x39b1b6=0xc8;}else{_0x39b1b6=0xce;}_0x30b852[_0x3607('0x19')](_0x39b1b6);return _0x30b852[_0x3607('0x20')](_0x3607('0x21'),_0x3aa638+'-'+_0x102b3e+'/'+_0x4aa816)[_0x3607('0x1b')](_0x834e82);}return null;};}function patchUpdates(_0x59bc7b){return function(_0x3353f1){try{jsonpatch[_0x3607('0x22')](_0x3353f1,_0x59bc7b,!![]);}catch(_0xd454e0){return BPromise['reject'](_0xd454e0);}return _0x3353f1[_0x3607('0x23')]();};}function saveUpdates(_0x34b7b2,_0x248b17){return function(_0x5afb08){if(_0x5afb08){return _0x5afb08[_0x3607('0x24')](_0x34b7b2)['then'](function(_0x35d402){return _0x35d402;});}return null;};}function removeEntity(_0x12da13,_0x41ea53){return function(_0x5eeea6){if(_0x5eeea6){return _0x5eeea6['destroy']()['then'](function(){_0x12da13[_0x3607('0x19')](0xcc)[_0x3607('0x1a')]();});}};}function handleEntityNotFound(_0x4de6fa,_0x33bb07){return function(_0x49b6a4){if(!_0x49b6a4){_0x4de6fa['sendStatus'](0x194);}return _0x49b6a4;};}function handleError(_0x58ebbb,_0x338950){_0x338950=_0x338950||0x1f4;return function(_0x401868){logger['error'](_0x401868[_0x3607('0x25')]);if(_0x401868[_0x3607('0x26')]){delete _0x401868[_0x3607('0x26')];}_0x58ebbb[_0x3607('0x19')](_0x338950)[_0x3607('0x27')](_0x401868);};}exports['index']=function(_0x5a157f,_0x1b07d9){var _0x1a3d07={},_0x30abf1={},_0x296746={'count':0x0,'rows':[]};var _0x164d32=_[_0x3607('0x28')](db['CmHopperBlack']['rawAttributes'],function(_0x183049){return{'name':_0x183049[_0x3607('0x29')],'type':_0x183049['type']['key']};});_0x30abf1['model']=_[_0x3607('0x28')](_0x164d32,_0x3607('0x26'));_0x30abf1[_0x3607('0x2a')]=_[_0x3607('0x2b')](_0x5a157f[_0x3607('0x2a')]);_0x30abf1[_0x3607('0x2c')]=_['intersection'](_0x30abf1[_0x3607('0x2d')],_0x30abf1[_0x3607('0x2a')]);_0x1a3d07[_0x3607('0x2e')]=_[_0x3607('0x2f')](_0x30abf1[_0x3607('0x2d')],qs[_0x3607('0x30')](_0x5a157f['query'][_0x3607('0x30')]));_0x1a3d07[_0x3607('0x2e')]=_0x1a3d07[_0x3607('0x2e')]['length']?_0x1a3d07[_0x3607('0x2e')]:_0x30abf1['model'];if(!_0x5a157f[_0x3607('0x2a')]['hasOwnProperty']('nolimit')){_0x1a3d07[_0x3607('0x1f')]=qs[_0x3607('0x1f')](_0x5a157f[_0x3607('0x2a')][_0x3607('0x1f')]);_0x1a3d07[_0x3607('0x1c')]=qs[_0x3607('0x1c')](_0x5a157f[_0x3607('0x2a')][_0x3607('0x1c')]);}_0x1a3d07['order']=qs[_0x3607('0x31')](_0x5a157f[_0x3607('0x2a')][_0x3607('0x31')]);_0x1a3d07[_0x3607('0x32')]=qs[_0x3607('0x2c')](_[_0x3607('0x33')](_0x5a157f[_0x3607('0x2a')],_0x30abf1[_0x3607('0x2c')]),_0x164d32);if(_0x5a157f[_0x3607('0x2a')]['filter']){_0x1a3d07['where']=_[_0x3607('0x34')](_0x1a3d07[_0x3607('0x32')],{'$or':_[_0x3607('0x28')](_0x164d32,function(_0x4ee259){if(_0x4ee259[_0x3607('0x35')]!==_0x3607('0x36')){var _0x15142e={};_0x15142e[_0x4ee259[_0x3607('0x26')]]={'$like':'%'+_0x5a157f[_0x3607('0x2a')][_0x3607('0x37')]+'%'};return _0x15142e;}})});}_0x1a3d07=_['merge']({},_0x1a3d07,_0x5a157f['options']);var _0x415703={'where':_0x1a3d07['where']};return db['CmHopperBlack'][_0x3607('0x1e')](_0x415703)[_0x3607('0x38')](function(_0x48f33e){_0x296746[_0x3607('0x1e')]=_0x48f33e;if(_0x5a157f['query'][_0x3607('0x39')]){_0x1a3d07[_0x3607('0x3a')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x1a3d07);})[_0x3607('0x38')](function(_0x397290){_0x296746[_0x3607('0x3b')]=_0x397290;return _0x296746;})[_0x3607('0x38')](respondWithFilteredResult(_0x1b07d9,_0x1a3d07))[_0x3607('0x3c')](handleError(_0x1b07d9,null));};exports[_0x3607('0x3d')]=function(_0x387e39,_0x5a8c27){var _0x444483={'raw':!![],'where':{'id':_0x387e39[_0x3607('0x3e')]['id']}},_0x481281={};_0x481281[_0x3607('0x2d')]=_[_0x3607('0x2b')](db[_0x3607('0x3f')][_0x3607('0x40')]);_0x481281['query']=_['keys'](_0x387e39[_0x3607('0x2a')]);_0x481281[_0x3607('0x2c')]=_['intersection'](_0x481281[_0x3607('0x2d')],_0x481281[_0x3607('0x2a')]);_0x444483['attributes']=_[_0x3607('0x2f')](_0x481281[_0x3607('0x2d')],qs[_0x3607('0x30')](_0x387e39[_0x3607('0x2a')]['fields']));_0x444483['attributes']=_0x444483[_0x3607('0x2e')]['length']?_0x444483['attributes']:_0x481281[_0x3607('0x2d')];if(_0x387e39[_0x3607('0x2a')]['includeAll']){_0x444483[_0x3607('0x3a')]=[{'all':!![]}];}_0x444483=_[_0x3607('0x34')]({},_0x444483,_0x387e39[_0x3607('0x41')]);return db[_0x3607('0x3f')][_0x3607('0x42')](_0x444483)['then'](handleEntityNotFound(_0x5a8c27,null))['then'](respondWithResult(_0x5a8c27,null))['catch'](handleError(_0x5a8c27,null));};exports['update']=function(_0x4231ce,_0x4a81e6){if(_0x4231ce[_0x3607('0x43')]['id']){delete _0x4231ce[_0x3607('0x43')]['id'];}return db[_0x3607('0x3f')][_0x3607('0x42')]({'where':{'id':_0x4231ce[_0x3607('0x3e')]['id']}})[_0x3607('0x38')](handleEntityNotFound(_0x4a81e6,null))[_0x3607('0x38')](saveUpdates(_0x4231ce[_0x3607('0x43')],null))[_0x3607('0x38')](respondWithResult(_0x4a81e6,null))[_0x3607('0x3c')](handleError(_0x4a81e6,null));};exports[_0x3607('0x44')]=function(_0x307737,_0xb924a1){return db[_0x3607('0x3f')][_0x3607('0x42')]({'where':{'id':_0x307737[_0x3607('0x3e')]['id']}})[_0x3607('0x38')](handleEntityNotFound(_0xb924a1,null))[_0x3607('0x38')](removeEntity(_0xb924a1,null))[_0x3607('0x3c')](handleError(_0xb924a1,null));};exports[_0x3607('0x45')]=function(_0x3f0345,_0x5af441){return db['CmHopperBlack']['describe']()['then'](respondWithResult(_0x5af441,null))[_0x3607('0x3c')](handleError(_0x5af441,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3daf05d..c9ffdb3 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 _0x1f2f=['define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','bluebird','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x15f78f,_0x311da2){var _0xa2b34b=function(_0x366abe){while(--_0x366abe){_0x15f78f['push'](_0x15f78f['shift']());}};_0xa2b34b(++_0x311da2);}(_0x1f2f,0x1f2));var _0xf1f2=function(_0x237836,_0x5c9545){_0x237836=_0x237836-0x0;var _0x57806b=_0x1f2f[_0x237836];return _0x57806b;};'use strict';var _=require(_0xf1f2('0x0'));var util=require(_0xf1f2('0x1'));var logger=require(_0xf1f2('0x2'))(_0xf1f2('0x3'));var moment=require('moment');var BPromise=require(_0xf1f2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf1f2('0x5'));var attributes=require(_0xf1f2('0x6'));module[_0xf1f2('0x7')]=function(_0xfe537e,_0x7b4575){return _0xfe537e[_0xf1f2('0x8')](_0xf1f2('0x9'),attributes,{'tableName':_0xf1f2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb53d=['util','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','define','CmHopperBlack'];(function(_0x246412,_0x2f9b17){var _0x41aaf5=function(_0x16bc71){while(--_0x16bc71){_0x246412['push'](_0x246412['shift']());}};_0x41aaf5(++_0x2f9b17);}(_0xb53d,0x1f4));var _0xdb53=function(_0x1a63a6,_0x2e4e0a){_0x1a63a6=_0x1a63a6-0x0;var _0x2f3ec4=_0xb53d[_0x1a63a6];return _0x2f3ec4;};'use strict';var _=require('lodash');var util=require(_0xdb53('0x0'));var logger=require('../../config/logger')(_0xdb53('0x1'));var moment=require(_0xdb53('0x2'));var BPromise=require(_0xdb53('0x3'));var rp=require(_0xdb53('0x4'));var fs=require('fs');var path=require(_0xdb53('0x5'));var rimraf=require(_0xdb53('0x6'));var config=require('../../config/environment');var attributes=require(_0xdb53('0x7'));module['exports']=function(_0x5713ef,_0xfb18de){return _0x5713ef[_0xdb53('0x8')](_0xdb53('0x9'),attributes,{'tableName':'cm_hopper_black','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 380f012..3eaae66 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 _0x81ce=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperBlack','findAll','options','raw','where','limit','include','map','model','attributes','GetCmHopperBlack','UpdateCmHopperBlack','update','body','catch','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5d0fcf,_0xa23aa1){var _0x40c760=function(_0x4f5c91){while(--_0x4f5c91){_0x5d0fcf['push'](_0x5d0fcf['shift']());}};_0x40c760(++_0xa23aa1);}(_0x81ce,0x8f));var _0xe81c=function(_0x2376c1,_0x347d27){_0x2376c1=_0x2376c1-0x0;var _0x5af76b=_0x81ce[_0x2376c1];return _0x5af76b;};'use strict';var _=require(_0xe81c('0x0'));var util=require(_0xe81c('0x1'));var moment=require('moment');var BPromise=require(_0xe81c('0x2'));var rs=require(_0xe81c('0x3'));var fs=require('fs');var Redis=require(_0xe81c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe81c('0x5'));var logger=require('../../config/logger')(_0xe81c('0x6'));var config=require(_0xe81c('0x7'));var jayson=require(_0xe81c('0x8'));var client=jayson[_0xe81c('0x9')][_0xe81c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x355075,_0x2b1d2f,_0x50eef2){return new BPromise(function(_0x5107a9,_0x490a38){return client[_0xe81c('0xb')](_0x355075,_0x50eef2)[_0xe81c('0xc')](function(_0x12f8b2){logger[_0xe81c('0xd')](_0xe81c('0xe'),_0x2b1d2f,_0xe81c('0xf'));logger[_0xe81c('0x10')](_0xe81c('0x11'),_0x2b1d2f,_0xe81c('0xf'),JSON[_0xe81c('0x12')](_0x12f8b2));if(_0x12f8b2[_0xe81c('0x13')]){if(_0x12f8b2[_0xe81c('0x13')][_0xe81c('0x14')]===0x1f4){logger['error'](_0xe81c('0xe'),_0x2b1d2f,_0x12f8b2[_0xe81c('0x13')][_0xe81c('0x15')]);return _0x490a38(_0x12f8b2[_0xe81c('0x13')][_0xe81c('0x15')]);}logger[_0xe81c('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x2b1d2f,_0x12f8b2[_0xe81c('0x13')][_0xe81c('0x15')]);return _0x5107a9(_0x12f8b2['error'][_0xe81c('0x15')]);}else{logger[_0xe81c('0xd')](_0xe81c('0xe'),_0x2b1d2f,_0xe81c('0xf'));_0x5107a9(_0x12f8b2[_0xe81c('0x16')][_0xe81c('0x15')]);}})['catch'](function(_0xdacea4){logger[_0xe81c('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x2b1d2f,_0xdacea4);_0x490a38(_0xdacea4);});});}exports['GetCmHopperBlack']=function(_0x22d9ad){var _0x320bd1=this;return new Promise(function(_0x583570,_0x3a092e){return db[_0xe81c('0x17')][_0xe81c('0x18')]({'raw':_0x22d9ad[_0xe81c('0x19')]?_0x22d9ad[_0xe81c('0x19')][_0xe81c('0x1a')]===undefined?!![]:![]:!![],'where':_0x22d9ad['options']?_0x22d9ad[_0xe81c('0x19')][_0xe81c('0x1b')]||null:null,'attributes':_0x22d9ad[_0xe81c('0x19')]?_0x22d9ad[_0xe81c('0x19')]['attributes']||null:null,'limit':_0x22d9ad['options']?_0x22d9ad[_0xe81c('0x19')][_0xe81c('0x1c')]||null:null,'include':_0x22d9ad[_0xe81c('0x19')]?_0x22d9ad[_0xe81c('0x19')][_0xe81c('0x1d')]?_[_0xe81c('0x1e')](_0x22d9ad['options'][_0xe81c('0x1d')],function(_0x298669){return{'model':db[_0x298669[_0xe81c('0x1f')]],'as':_0x298669['as'],'attributes':_0x298669[_0xe81c('0x20')],'include':_0x298669[_0xe81c('0x1d')]?_[_0xe81c('0x1e')](_0x298669[_0xe81c('0x1d')],function(_0x2b5eef){return{'model':db[_0x2b5eef[_0xe81c('0x1f')]],'as':_0x2b5eef['as'],'attributes':_0x2b5eef['attributes'],'include':_0x2b5eef['include']?_[_0xe81c('0x1e')](_0x2b5eef[_0xe81c('0x1d')],function(_0x43f715){return{'model':db[_0x43f715['model']],'as':_0x43f715['as'],'attributes':_0x43f715[_0xe81c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe81c('0xc')](function(_0x551371){logger[_0xe81c('0xd')](_0xe81c('0x21'),_0x22d9ad);logger[_0xe81c('0x10')]('GetCmHopperBlack',_0x22d9ad,JSON[_0xe81c('0x12')](_0x551371));_0x583570(_0x551371);})['catch'](function(_0x2da5de){logger[_0xe81c('0x13')](_0xe81c('0x21'),_0x2da5de[_0xe81c('0x15')],_0x22d9ad);_0x3a092e(_0x320bd1['error'](0x1f4,_0x2da5de[_0xe81c('0x15')]));});});};exports[_0xe81c('0x22')]=function(_0x4a828d){var _0x39de2d=this;return new Promise(function(_0x394c3a,_0x7ded7d){return db[_0xe81c('0x17')][_0xe81c('0x23')](_0x4a828d[_0xe81c('0x24')],{'raw':_0x4a828d[_0xe81c('0x19')]?_0x4a828d[_0xe81c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a828d[_0xe81c('0x19')]?_0x4a828d[_0xe81c('0x19')][_0xe81c('0x1b')]||null:null,'attributes':_0x4a828d[_0xe81c('0x19')]?_0x4a828d['options']['attributes']||null:null,'limit':_0x4a828d[_0xe81c('0x19')]?_0x4a828d[_0xe81c('0x19')]['limit']||null:null})[_0xe81c('0xc')](function(_0x1bfe66){logger[_0xe81c('0xd')]('UpdateCmHopperBlack',_0x4a828d);logger[_0xe81c('0x10')]('UpdateCmHopperBlack',_0x4a828d,JSON[_0xe81c('0x12')](_0x1bfe66));_0x394c3a(_0x1bfe66);})[_0xe81c('0x25')](function(_0x49ad52){logger[_0xe81c('0x13')](_0xe81c('0x22'),_0x49ad52[_0xe81c('0x15')],_0x4a828d);_0x7ded7d(_0x39de2d[_0xe81c('0x13')](0x1f4,_0x49ad52[_0xe81c('0x15')]));});});};exports['DestroyCmHopperBlack']=function(_0x2911e6){var _0x3371b9=this;return new Promise(function(_0x55d26e,_0x144b71){return db[_0xe81c('0x17')]['destroy']({'where':_0x2911e6[_0xe81c('0x19')]?_0x2911e6[_0xe81c('0x19')][_0xe81c('0x1b')]||null:null})[_0xe81c('0xc')](function(_0x16b5ee){logger['info'](_0xe81c('0x26'),_0x2911e6);logger['debug'](_0xe81c('0x26'),_0x2911e6,JSON['stringify'](_0x16b5ee));_0x55d26e(_0x16b5ee);})[_0xe81c('0x25')](function(_0x1fea58){logger[_0xe81c('0x13')]('DestroyCmHopperBlack',_0x1fea58[_0xe81c('0x15')],_0x2911e6);_0x144b71(_0x3371b9[_0xe81c('0x13')](0x1f4,_0x1fea58[_0xe81c('0x15')]));});});}; \ No newline at end of file +var _0x8f97=['error','code','message','info','result','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','include','map','model','debug','stringify','UpdateCmHopperBlack','update','catch','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent'];(function(_0x2ea680,_0x99a563){var _0x317396=function(_0x40c50d){while(--_0x40c50d){_0x2ea680['push'](_0x2ea680['shift']());}};_0x317396(++_0x99a563);}(_0x8f97,0xa9));var _0x78f9=function(_0x1ed555,_0x163bb2){_0x1ed555=_0x1ed555-0x0;var _0x2ade3d=_0x8f97[_0x1ed555];return _0x2ade3d;};'use strict';var _=require(_0x78f9('0x0'));var util=require(_0x78f9('0x1'));var moment=require(_0x78f9('0x2'));var BPromise=require(_0x78f9('0x3'));var rs=require(_0x78f9('0x4'));var fs=require('fs');var Redis=require(_0x78f9('0x5'));var db=require(_0x78f9('0x6'))['db'];var utils=require(_0x78f9('0x7'));var logger=require(_0x78f9('0x8'))(_0x78f9('0x9'));var config=require('../../config/environment');var jayson=require(_0x78f9('0xa'));var client=jayson[_0x78f9('0xb')][_0x78f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x392b73,_0x18bc53,_0x4d39f0){return new BPromise(function(_0x3957e4,_0xaabd41){return client['request'](_0x392b73,_0x4d39f0)[_0x78f9('0xd')](function(_0x1c6978){logger['info'](_0x78f9('0xe'),_0x18bc53,_0x78f9('0xf'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x18bc53,_0x78f9('0xf'),JSON['stringify'](_0x1c6978));if(_0x1c6978[_0x78f9('0x10')]){if(_0x1c6978[_0x78f9('0x10')][_0x78f9('0x11')]===0x1f4){logger[_0x78f9('0x10')](_0x78f9('0xe'),_0x18bc53,_0x1c6978['error'][_0x78f9('0x12')]);return _0xaabd41(_0x1c6978['error'][_0x78f9('0x12')]);}logger[_0x78f9('0x10')](_0x78f9('0xe'),_0x18bc53,_0x1c6978[_0x78f9('0x10')]['message']);return _0x3957e4(_0x1c6978[_0x78f9('0x10')][_0x78f9('0x12')]);}else{logger[_0x78f9('0x13')](_0x78f9('0xe'),_0x18bc53,'request\x20sent');_0x3957e4(_0x1c6978[_0x78f9('0x14')][_0x78f9('0x12')]);}})['catch'](function(_0x195291){logger['error'](_0x78f9('0xe'),_0x18bc53,_0x195291);_0xaabd41(_0x195291);});});}exports[_0x78f9('0x15')]=function(_0x3009fa){var _0x4e0fbb=this;return new Promise(function(_0x4c2319,_0x2fffed){return db[_0x78f9('0x16')]['findAll']({'raw':_0x3009fa[_0x78f9('0x17')]?_0x3009fa[_0x78f9('0x17')][_0x78f9('0x18')]===undefined?!![]:![]:!![],'where':_0x3009fa['options']?_0x3009fa[_0x78f9('0x17')][_0x78f9('0x19')]||null:null,'attributes':_0x3009fa[_0x78f9('0x17')]?_0x3009fa['options'][_0x78f9('0x1a')]||null:null,'limit':_0x3009fa['options']?_0x3009fa['options']['limit']||null:null,'include':_0x3009fa[_0x78f9('0x17')]?_0x3009fa[_0x78f9('0x17')][_0x78f9('0x1b')]?_[_0x78f9('0x1c')](_0x3009fa[_0x78f9('0x17')][_0x78f9('0x1b')],function(_0x4bfa86){return{'model':db[_0x4bfa86[_0x78f9('0x1d')]],'as':_0x4bfa86['as'],'attributes':_0x4bfa86[_0x78f9('0x1a')],'include':_0x4bfa86['include']?_[_0x78f9('0x1c')](_0x4bfa86[_0x78f9('0x1b')],function(_0x7cb81){return{'model':db[_0x7cb81[_0x78f9('0x1d')]],'as':_0x7cb81['as'],'attributes':_0x7cb81[_0x78f9('0x1a')],'include':_0x7cb81['include']?_[_0x78f9('0x1c')](_0x7cb81[_0x78f9('0x1b')],function(_0x532d13){return{'model':db[_0x532d13['model']],'as':_0x532d13['as'],'attributes':_0x532d13[_0x78f9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x78f9('0xd')](function(_0x485a7e){logger[_0x78f9('0x13')](_0x78f9('0x15'),_0x3009fa);logger[_0x78f9('0x1e')](_0x78f9('0x15'),_0x3009fa,JSON[_0x78f9('0x1f')](_0x485a7e));_0x4c2319(_0x485a7e);})['catch'](function(_0x4ab960){logger[_0x78f9('0x10')]('GetCmHopperBlack',_0x4ab960[_0x78f9('0x12')],_0x3009fa);_0x2fffed(_0x4e0fbb[_0x78f9('0x10')](0x1f4,_0x4ab960[_0x78f9('0x12')]));});});};exports[_0x78f9('0x20')]=function(_0x47bd20){var _0x25d207=this;return new Promise(function(_0x4ae7cc,_0x201253){return db[_0x78f9('0x16')][_0x78f9('0x21')](_0x47bd20['body'],{'raw':_0x47bd20[_0x78f9('0x17')]?_0x47bd20[_0x78f9('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47bd20[_0x78f9('0x17')]?_0x47bd20[_0x78f9('0x17')]['where']||null:null,'attributes':_0x47bd20[_0x78f9('0x17')]?_0x47bd20[_0x78f9('0x17')][_0x78f9('0x1a')]||null:null,'limit':_0x47bd20[_0x78f9('0x17')]?_0x47bd20['options']['limit']||null:null})[_0x78f9('0xd')](function(_0x514bb7){logger[_0x78f9('0x13')](_0x78f9('0x20'),_0x47bd20);logger[_0x78f9('0x1e')](_0x78f9('0x20'),_0x47bd20,JSON[_0x78f9('0x1f')](_0x514bb7));_0x4ae7cc(_0x514bb7);})[_0x78f9('0x22')](function(_0x56eb85){logger['error']('UpdateCmHopperBlack',_0x56eb85[_0x78f9('0x12')],_0x47bd20);_0x201253(_0x25d207[_0x78f9('0x10')](0x1f4,_0x56eb85[_0x78f9('0x12')]));});});};exports[_0x78f9('0x23')]=function(_0x2263ab){var _0x4ebc95=this;return new Promise(function(_0x894436,_0x1924f2){return db['CmHopperBlack'][_0x78f9('0x24')]({'where':_0x2263ab['options']?_0x2263ab[_0x78f9('0x17')][_0x78f9('0x19')]||null:null})['then'](function(_0x23e72b){logger[_0x78f9('0x13')](_0x78f9('0x23'),_0x2263ab);logger[_0x78f9('0x1e')]('DestroyCmHopperBlack',_0x2263ab,JSON[_0x78f9('0x1f')](_0x23e72b));_0x894436(_0x23e72b);})[_0x78f9('0x22')](function(_0x52df47){logger[_0x78f9('0x10')](_0x78f9('0x23'),_0x52df47[_0x78f9('0x12')],_0x2263ab);_0x1924f2(_0x4ebc95['error'](0x1f4,_0x52df47[_0x78f9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 68f1289..d271374 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 _0x6455=['index','/describe','/:id','show','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x6455,0x97));var _0x5645=function(_0x277e93,_0x5ec069){_0x277e93=_0x277e93-0x0;var _0x2b06e9=_0x6455[_0x277e93];return _0x2b06e9;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['describe']);router['get'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0xe')]);router[_0x5645('0xf')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller['update']);router[_0x5645('0x10')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbd51=['/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','put'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0xbd51,0x1a8));var _0x1bd5=function(_0xbd2dc4,_0x2612c8){_0xbd2dc4=_0xbd2dc4-0x0;var _0x766fc8=_0xbd51[_0xbd2dc4];return _0x766fc8;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('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(_0x1bd5('0x5'));router[_0x1bd5('0x6')]('/',auth[_0x1bd5('0x7')](),controller['index']);router[_0x1bd5('0x6')](_0x1bd5('0x8'),auth[_0x1bd5('0x7')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0x6')]('/:id',auth[_0x1bd5('0x7')](),controller['show']);router[_0x1bd5('0xa')](_0x1bd5('0xb'),auth[_0x1bd5('0x7')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0xb'),auth['isAuthenticated'](),controller[_0x1bd5('0xe')]);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 1d83ce1..e8a596c 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 _0x01e9=['moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN'];(function(_0x1fb543,_0x25b8a5){var _0x5ab0e7=function(_0x5a9680){while(--_0x5a9680){_0x1fb543['push'](_0x1fb543['shift']());}};_0x5ab0e7(++_0x25b8a5);}(_0x01e9,0x1ad));var _0x901e=function(_0x108e5c,_0x31754f){_0x108e5c=_0x108e5c-0x0;var _0xba37d5=_0x01e9[_0x108e5c];return _0xba37d5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x901e('0x0'));module[_0x901e('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x901e('0x2')]},'scheduledat':{'type':Sequelize[_0x901e('0x3')]},'countbusyretry':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x901e('0x2')]},'originatecalleridname':{'type':Sequelize[_0x901e('0x2')]},'calleridnum':{'type':Sequelize[_0x901e('0x2')]},'calleridname':{'type':Sequelize[_0x901e('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x901e('0x3')]},'droptime':{'type':Sequelize[_0x901e('0x3')]},'endtime':{'type':Sequelize[_0x901e('0x3')]},'ringtime':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x901e('0x2')]},'campaign':{'type':Sequelize[_0x901e('0x2')]},'campaigntype':{'type':Sequelize[_0x901e('0x2')]},'membername':{'type':Sequelize[_0x901e('0x2')]},'reason':{'type':Sequelize[_0x901e('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x901e('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x901e('0x3')],'set':function(_0xfb6cc9){var _0x4ba22f=this[_0x901e('0x5')](_0x901e('0x6'));if(_0x4ba22f&&_0xfb6cc9){this[_0x901e('0x7')]('followuptime',moment(_0xfb6cc9)[_0x901e('0x8')](moment(_0x4ba22f),_0x901e('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x901e('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x901e('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x901e('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x901e('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x901e('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x901e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8813=['setDataValue','diff','seconds','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x1c7e62,_0x5c857c){var _0x5d5762=function(_0x28f93e){while(--_0x28f93e){_0x1c7e62['push'](_0x1c7e62['shift']());}};_0x5d5762(++_0x5c857c);}(_0x8813,0x9a));var _0x3881=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8813[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3881('0x0'));module[_0x3881('0x1')]={'state':{'type':Sequelize[_0x3881('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3881('0x3')]},'scheduledat':{'type':Sequelize[_0x3881('0x4')]},'countbusyretry':{'type':Sequelize[_0x3881('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3881('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3881('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3881('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3881('0x3')]},'originatecalleridname':{'type':Sequelize[_0x3881('0x3')]},'calleridnum':{'type':Sequelize[_0x3881('0x3')]},'calleridname':{'type':Sequelize[_0x3881('0x3')]},'starttime':{'type':Sequelize[_0x3881('0x4')]},'responsetime':{'type':Sequelize[_0x3881('0x4')]},'answertime':{'type':Sequelize[_0x3881('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3881('0x4')]},'ringtime':{'type':Sequelize[_0x3881('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3881('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3881('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3881('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3881('0x3')]},'membername':{'type':Sequelize[_0x3881('0x3')]},'reason':{'type':Sequelize[_0x3881('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3881('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3881('0x3')]},'dispositionat':{'type':Sequelize[_0x3881('0x4')],'set':function(_0x3279fa){var _0x59638b=this[_0x3881('0x5')]('endtime');if(_0x59638b&&_0x3279fa){this[_0x3881('0x6')]('followuptime',moment(_0x3279fa)[_0x3881('0x7')](moment(_0x59638b),_0x3881('0x8')));}}},'amd':{'type':Sequelize[_0x3881('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3881('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3881('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3881('0x4')]},'callback':{'type':Sequelize[_0x3881('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3881('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3881('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3881('0x4')]},'recallme':{'type':Sequelize[_0x3881('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3881('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3881('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3881('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3881('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 633dda7..3a694e1 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 _0x5d58=['calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','CmHopperFinal','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','describe','catch','body','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)'];(function(_0xb1c5d5,_0x3a2038){var _0x3766dc=function(_0x12344b){while(--_0x12344b){_0xb1c5d5['push'](_0xb1c5d5['shift']());}};_0x3766dc(++_0x3a2038);}(_0x5d58,0x187));var _0x85d5=function(_0x1021ae,_0x4729b3){_0x1021ae=_0x1021ae-0x0;var _0x51519a=_0x5d58[_0x1021ae];return _0x51519a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['CmHopperFinal']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['CmHopperFinal'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')]()['then'](respondWithResult(_0x12a03,null))[_0x85d5('0x40')](handleError(_0x12a03,null));};exports['update']=function(_0x1f2ef9,_0xd8db57){if(_0x1f2ef9[_0x85d5('0x41')]['uniqueid']){delete _0x1f2ef9['body']['uniqueid'];}return db[_0x85d5('0x34')][_0x85d5('0x42')]({'where':{'uniqueid':_0x1f2ef9[_0x85d5('0x39')]['id']}})['then'](handleEntityNotFound(_0xd8db57,null))['then'](saveUpdates(_0x1f2ef9[_0x85d5('0x41')],null))[_0x85d5('0x1c')](respondWithResult(_0xd8db57,null))[_0x85d5('0x40')](handleError(_0xd8db57,null));};exports[_0x85d5('0x43')]=function(_0x4b2dce,_0x3f69ea,_0x29442a){return db[_0x85d5('0x34')][_0x85d5('0x36')]({'raw':![],'where':{'VoiceQueueId':_0x4b2dce[_0x85d5('0x39')]['id']},'attributes':[[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),_0x85d5('0x48')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x85d5('0x4e')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4f')))),_0x85d5('0x50')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x2022,\x201,\x20null'))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x52')))),_0x85d5('0x53')]]})['then'](handleEntityNotFound(_0x3f69ea,null))[_0x85d5('0x1c')](respondWithResult(_0x3f69ea,null))[_0x85d5('0x40')](handleError(_0x3f69ea,null));};exports[_0x85d5('0x54')]=function(_0x561bde,_0x34aa42,_0x1c3e2c){return db['CmHopperFinal'][_0x85d5('0x36')]({'raw':![],'where':{'CampaignId':_0x561bde['params']['id']},'attributes':[[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),'noSuchContacts'],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85d5('0x44')]['literal'](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal'](_0x85d5('0x55')))),'dropContacts'],[db['sequelize']['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x85d5('0x50')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db['sequelize']['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x56')))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x85d5('0x53')]]})[_0x85d5('0x1c')](handleEntityNotFound(_0x34aa42,null))[_0x85d5('0x1c')](respondWithResult(_0x34aa42,null))['catch'](handleError(_0x34aa42,null));};exports[_0x85d5('0x57')]=function(_0x1fdefb,_0x496586,_0x2dbd18){return db[_0x85d5('0x58')][_0x85d5('0x42')]({'where':{'id':_0x1fdefb[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x496586,null))['then'](function(_0x35ba15){var _0x1b96eb;if(_0x35ba15){_0x1b96eb=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')](_0x85d5('0x5b'))['fromQuery']([_0x85d5('0x5c'),_0x85d5('0x5d'),_0x85d5('0x5e'),_0x85d5('0x5f'),_0x85d5('0x60'),_0x85d5('0x61'),_0x85d5('0x62')],squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x65'),'phone')[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x5d'))[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))['field'](_0x85d5('0x68'),'ListId')['field'](_0x85d5('0x69'),_0x85d5('0x60'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x61'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x62'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x1fdefb[_0x85d5('0x41')][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6f'))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('phone')['from'](_0x85d5('0x5b'))['where'](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x71'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb['params']['id'][_0x85d5('0x6c')]())['where'](_0x85d5('0x72')))[_0x85d5('0x73')](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db['sequelize'][_0x85d5('0x27')](_0x1b96eb);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x496586,null))['catch'](handleError(_0x496586,null));};exports[_0x85d5('0x74')]=function(_0x14e4e8,_0x57f26b,_0x45b1e2){return db[_0x85d5('0x75')][_0x85d5('0x42')]({'where':{'id':_0x14e4e8['params']['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x57f26b,null))[_0x85d5('0x1c')](function(_0x2dacf7){var _0x387a3b;if(_0x2dacf7){_0x387a3b=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')]('cm_hopper')[_0x85d5('0x76')]([_0x85d5('0x5c'),'scheduledAt',_0x85d5('0x5e'),'ListId',_0x85d5('0x77'),_0x85d5('0x61'),_0x85d5('0x62')],squel['select']()[_0x85d5('0x64')](_0x85d5('0x65'),_0x85d5('0x5c'))[_0x85d5('0x64')](_0x85d5('0x66'),'scheduledAt')[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))[_0x85d5('0x64')]('ANY_VALUE(ListId)',_0x85d5('0x5f'))[_0x85d5('0x64')](_0x85d5('0x78'),'CampaignId')[_0x85d5('0x64')]('NOW()',_0x85d5('0x61'))[_0x85d5('0x64')]('NOW()','updatedAt')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x14e4e8['body'][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x85d5('0x30')](_0x85d5('0x70'),squel['select']()[_0x85d5('0x64')](_0x85d5('0x5c'))[_0x85d5('0x6a')](_0x85d5('0x5b'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('calleridnum')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']())['where'](_0x85d5('0x72')))['group'](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db[_0x85d5('0x44')][_0x85d5('0x27')](_0x387a3b);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x57f26b,null))[_0x85d5('0x40')](handleError(_0x57f26b,null));};exports[_0x85d5('0x7b')]=function(_0x48553d,_0xedb32d,_0x5366bc){return db[_0x85d5('0x7c')][_0x85d5('0x7d')]({'where':{'VoiceQueueId':_0x48553d[_0x85d5('0x41')]['VoiceQueueId'],'CampaignId':_0x48553d[_0x85d5('0x41')][_0x85d5('0x77')],'ContactId':_0x48553d[_0x85d5('0x41')]['ContactId']}})['then'](handleEntityNotFound(_0xedb32d,null))[_0x85d5('0x1c')](function(_0x428fd4){if(_0x428fd4){return _0x428fd4;}return null;})['then'](respondWithResult(_0xedb32d,null))[_0x85d5('0x40')](handleError(_0xedb32d,null));}; \ No newline at end of file +var _0xba34=['insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','state\x20=\x20?','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0xba34,0x119));var _0x4ba3=function(_0x1b0f82,_0x38f46c){_0x1b0f82=_0x1b0f82-0x0;var _0x206c59=_0xba34[_0x1b0f82];return _0x206c59;};'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'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':!![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['describe']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['describe']()[_0x4ba3('0x26')](respondWithResult(_0x1fe115,null))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports[_0x4ba3('0x25')]=function(_0x58648d,_0x47f588){if(_0x58648d[_0x4ba3('0x49')]['uniqueid']){delete _0x58648d[_0x4ba3('0x49')][_0x4ba3('0x4a')];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'uniqueid':_0x58648d[_0x4ba3('0x4b')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x47f588,null))['then'](saveUpdates(_0x58648d[_0x4ba3('0x49')],null))[_0x4ba3('0x26')](respondWithResult(_0x47f588,null))['catch'](handleError(_0x47f588,null));};exports[_0x4ba3('0x4c')]=function(_0x12ae6f,_0x156c2d,_0x19d6a3){return db[_0x4ba3('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x12ae6f[_0x4ba3('0x4b')]['id']},'attributes':[[db[_0x4ba3('0x4d')]['fn']('COUNT',db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x4f')))),_0x4ba3('0x50')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x52')))),_0x4ba3('0x53')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x4ba3('0x54')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')]['literal'](_0x4ba3('0x55')))),_0x4ba3('0x56')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x57')))),_0x4ba3('0x58')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4ba3('0x59')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5a')))),_0x4ba3('0x5b')],[db['sequelize']['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')]['literal'](_0x4ba3('0x5c')))),'answeringMachine']]})[_0x4ba3('0x26')](handleEntityNotFound(_0x156c2d,null))[_0x4ba3('0x26')](respondWithResult(_0x156c2d,null))[_0x4ba3('0x46')](handleError(_0x156c2d,null));};exports[_0x4ba3('0x5d')]=function(_0xf0fd32,_0x4b5289,_0x3d9a7e){return db[_0x4ba3('0x2d')][_0x4ba3('0x44')]({'raw':![],'where':{'CampaignId':_0xf0fd32[_0x4ba3('0x4b')]['id']},'attributes':[[db[_0x4ba3('0x4d')]['fn']('COUNT',db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x4f')))),_0x4ba3('0x50')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x52')))),'noAnswerContacts'],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x5e')))),'busyContacts'],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x55')))),_0x4ba3('0x56')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db['sequelize'][_0x4ba3('0x4e')](_0x4ba3('0x57')))),_0x4ba3('0x58')],[db['sequelize']['fn'](_0x4ba3('0x51'),db[_0x4ba3('0x4d')]['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5f')))),_0x4ba3('0x59')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ba3('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4ba3('0x5b')],[db[_0x4ba3('0x4d')]['fn'](_0x4ba3('0x51'),db['sequelize']['fn']('IF',db[_0x4ba3('0x4d')][_0x4ba3('0x4e')](_0x4ba3('0x5c')))),'answeringMachine']]})[_0x4ba3('0x26')](handleEntityNotFound(_0x4b5289,null))['then'](respondWithResult(_0x4b5289,null))[_0x4ba3('0x46')](handleError(_0x4b5289,null));};exports[_0x4ba3('0x60')]=function(_0x5dce8f,_0x37fedb,_0x2ed729){return db[_0x4ba3('0x61')][_0x4ba3('0x48')]({'where':{'id':_0x5dce8f[_0x4ba3('0x4b')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x37fedb,null))[_0x4ba3('0x26')](function(_0x329874){var _0x360127;if(_0x329874){_0x360127=squel['insert']()[_0x4ba3('0x62')](_0x4ba3('0x63'))[_0x4ba3('0x64')]([_0x4ba3('0x65'),_0x4ba3('0x66'),_0x4ba3('0x67'),_0x4ba3('0x68'),_0x4ba3('0x69'),_0x4ba3('0x6a'),_0x4ba3('0x6b')],squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')]('ANY_VALUE(calleridnum)',_0x4ba3('0x65'))[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x66'))[_0x4ba3('0x6d')]('ANY_VALUE(ContactId)','ContactId')[_0x4ba3('0x6d')](_0x4ba3('0x6e'),_0x4ba3('0x68'))[_0x4ba3('0x6d')](_0x4ba3('0x6f'),_0x4ba3('0x69'))[_0x4ba3('0x6d')](_0x4ba3('0x70'),'createdAt')[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x6b'))[_0x4ba3('0x71')](_0x4ba3('0x72'))[_0x4ba3('0x3d')](_0x4ba3('0x73'),_0x5dce8f[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')]('state\x20=\x20?',_0x5dce8f[_0x4ba3('0x49')][_0x4ba3('0x75')][_0x4ba3('0x74')]())['where'](_0x4ba3('0x76'))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x65'))[_0x4ba3('0x71')]('cm_hopper')['where'](_0x4ba3('0x73'),_0x5dce8f['params']['id'][_0x4ba3('0x74')]()))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()['field']('calleridnum')[_0x4ba3('0x71')](_0x4ba3('0x72'))['where'](_0x4ba3('0x73'),_0x5dce8f[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x78')))[_0x4ba3('0x79')](_0x4ba3('0x67')))['toString']();return db[_0x4ba3('0x4d')][_0x4ba3('0x32')](_0x360127);}return[];})[_0x4ba3('0x26')](respondWithResult(_0x37fedb,null))['catch'](handleError(_0x37fedb,null));};exports[_0x4ba3('0x7a')]=function(_0x13dbc4,_0x4e334c,_0x39d1d3){return db[_0x4ba3('0x7b')]['find']({'where':{'id':_0x13dbc4['params']['id']}})['then'](handleEntityNotFound(_0x4e334c,null))['then'](function(_0x206e93){var _0x2d57a7;if(_0x206e93){_0x2d57a7=squel[_0x4ba3('0x7c')]()[_0x4ba3('0x62')](_0x4ba3('0x63'))[_0x4ba3('0x64')]([_0x4ba3('0x65'),'scheduledAt',_0x4ba3('0x67'),'ListId',_0x4ba3('0x7d'),'createdAt',_0x4ba3('0x6b')],squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x7e'),_0x4ba3('0x65'))['field']('NOW()',_0x4ba3('0x66'))[_0x4ba3('0x6d')](_0x4ba3('0x7f'),_0x4ba3('0x67'))[_0x4ba3('0x6d')](_0x4ba3('0x6e'),_0x4ba3('0x68'))[_0x4ba3('0x6d')](_0x4ba3('0x80'),_0x4ba3('0x7d'))[_0x4ba3('0x6d')](_0x4ba3('0x70'),'createdAt')[_0x4ba3('0x6d')]('NOW()',_0x4ba3('0x6b'))[_0x4ba3('0x71')](_0x4ba3('0x72'))[_0x4ba3('0x3d')]('CampaignId\x20=\x20?',_0x13dbc4[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x81'),_0x13dbc4['body']['state'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x76'))['where'](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()[_0x4ba3('0x6d')](_0x4ba3('0x65'))[_0x4ba3('0x71')](_0x4ba3('0x63'))['where'](_0x4ba3('0x82'),_0x13dbc4['params']['id'][_0x4ba3('0x74')]()))[_0x4ba3('0x3d')](_0x4ba3('0x77'),squel[_0x4ba3('0x6c')]()['field'](_0x4ba3('0x83'))[_0x4ba3('0x71')]('cm_hopper_final')[_0x4ba3('0x3d')]('CampaignId\x20=\x20?',_0x13dbc4[_0x4ba3('0x4b')]['id'][_0x4ba3('0x74')]())[_0x4ba3('0x3d')](_0x4ba3('0x78')))[_0x4ba3('0x79')]('ContactId'))['toString']();return db[_0x4ba3('0x4d')][_0x4ba3('0x32')](_0x2d57a7);}return[];})[_0x4ba3('0x26')](respondWithResult(_0x4e334c,null))['catch'](handleError(_0x4e334c,null));};exports[_0x4ba3('0x84')]=function(_0x38a7a8,_0x5553eb,_0x402ab1){return db[_0x4ba3('0x85')][_0x4ba3('0x86')]({'where':{'VoiceQueueId':_0x38a7a8[_0x4ba3('0x49')][_0x4ba3('0x69')],'CampaignId':_0x38a7a8[_0x4ba3('0x49')][_0x4ba3('0x7d')],'ContactId':_0x38a7a8[_0x4ba3('0x49')]['ContactId']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5553eb,null))[_0x4ba3('0x26')](function(_0xfb16a6){if(_0xfb16a6){return _0xfb16a6;}return null;})[_0x4ba3('0x26')](respondWithResult(_0x5553eb,null))[_0x4ba3('0x46')](handleError(_0x5553eb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index b01b965..b4e9a50 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 _0x1cae=['calleridnum','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final'];(function(_0x30014b,_0x1a29d2){var _0x180392=function(_0x11d5ac){while(--_0x11d5ac){_0x30014b['push'](_0x30014b['shift']());}};_0x180392(++_0x1a29d2);}(_0x1cae,0x14c));var _0xe1ca=function(_0x2d5656,_0x2a51c0){_0x2d5656=_0x2d5656-0x0;var _0x5df6c9=_0x1cae[_0x2d5656];return _0x5df6c9;};'use strict';var _=require(_0xe1ca('0x0'));var util=require(_0xe1ca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe1ca('0x2'));var BPromise=require(_0xe1ca('0x3'));var rp=require(_0xe1ca('0x4'));var fs=require('fs');var path=require(_0xe1ca('0x5'));var rimraf=require(_0xe1ca('0x6'));var config=require(_0xe1ca('0x7'));var attributes=require(_0xe1ca('0x8'));module[_0xe1ca('0x9')]=function(_0x56e9a6,_0x5bccda){return _0x56e9a6[_0xe1ca('0xa')](_0xe1ca('0xb'),attributes,{'tableName':_0xe1ca('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xe1ca('0xd')]},{'name':'uniqueid','fields':[_0xe1ca('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa837=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal','calleridnum','lodash'];(function(_0x1dbacb,_0x1fb344){var _0x25a03c=function(_0x156d3f){while(--_0x156d3f){_0x1dbacb['push'](_0x1dbacb['shift']());}};_0x25a03c(++_0x1fb344);}(_0xa837,0x1af));var _0x7a83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa837[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7a83('0x0'));var util=require(_0x7a83('0x1'));var logger=require(_0x7a83('0x2'))(_0x7a83('0x3'));var moment=require('moment');var BPromise=require(_0x7a83('0x4'));var rp=require(_0x7a83('0x5'));var fs=require('fs');var path=require(_0x7a83('0x6'));var rimraf=require(_0x7a83('0x7'));var config=require(_0x7a83('0x8'));var attributes=require(_0x7a83('0x9'));module['exports']=function(_0x2802b6,_0x508836){return _0x2802b6['define'](_0x7a83('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x7a83('0xb'),'fields':[_0x7a83('0xb')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index d39d30a..c9038bd 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(_0xefe23a,_0x40a6e6){var _0x4174bc=function(_0x2ab6c8){while(--_0x2ab6c8){_0xefe23a['push'](_0xefe23a['shift']());}};_0x4174bc(++_0x40a6e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xb10b[_0x231dda];return _0x3f88cb;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x207bdb,_0x3a61dc){var _0x3e1d62=function(_0x43540a){while(--_0x43540a){_0x207bdb['push'](_0x207bdb['shift']());}};_0x3e1d62(++_0x3a61dc);}(_0x7a54,0x106));var _0x47a5=function(_0x308cd2,_0x1e1571){_0x308cd2=_0x308cd2-0x0;var _0x172864=_0x7a54[_0x308cd2];return _0x172864;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 2e8befd..bf10332 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 _0xfefc=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show'];(function(_0x51eb91,_0x4799d5){var _0x1c4fc4=function(_0x1fd807){while(--_0x1fd807){_0x51eb91['push'](_0x51eb91['shift']());}};_0x1c4fc4(++_0x4799d5);}(_0xfefc,0xfa));var _0xcfef=function(_0x55e848,_0x21a895){_0x55e848=_0x55e848-0x0;var _0x39ccfb=_0xfefc[_0x55e848];return _0x39ccfb;};'use strict';var multer=require(_0xcfef('0x0'));var util=require(_0xcfef('0x1'));var path=require(_0xcfef('0x2'));var timeout=require(_0xcfef('0x3'));var express=require(_0xcfef('0x4'));var router=express['Router']();var fs_extra=require(_0xcfef('0x5'));var auth=require(_0xcfef('0x6'));var interaction=require(_0xcfef('0x7'));var config=require(_0xcfef('0x8'));var controller=require('./cmHopperFinal.controller');router[_0xcfef('0x9')]('/',auth['isAuthenticated'](),controller[_0xcfef('0xa')]);router[_0xcfef('0x9')]('/describe',auth[_0xcfef('0xb')](),controller['describe']);router['get'](_0xcfef('0xc'),auth[_0xcfef('0xb')](),controller[_0xcfef('0xd')]);router[_0xcfef('0x9')](_0xcfef('0xe'),auth[_0xcfef('0xb')](),controller[_0xcfef('0xf')]);router['get']('/campaign/countAttributes/:id',auth[_0xcfef('0xb')](),controller[_0xcfef('0x10')]);router[_0xcfef('0x11')](_0xcfef('0x12'),auth[_0xcfef('0xb')](),controller[_0xcfef('0x13')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xcfef('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xcfef('0x14'),auth['isAuthenticated'](),controller[_0xcfef('0x15')]);router[_0xcfef('0x16')](_0xcfef('0xc'),auth[_0xcfef('0xb')](),controller[_0xcfef('0x17')]);module['exports']=router; \ No newline at end of file +var _0xcb62=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','put','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id'];(function(_0x2dd09c,_0x4a1c26){var _0x235e52=function(_0x4c6a70){while(--_0x4c6a70){_0x2dd09c['push'](_0x2dd09c['shift']());}};_0x235e52(++_0x4a1c26);}(_0xcb62,0xf7));var _0x2cb6=function(_0x3c46d4,_0x2524f0){_0x3c46d4=_0x3c46d4-0x0;var _0x1ea654=_0xcb62[_0x3c46d4];return _0x1ea654;};'use strict';var multer=require(_0x2cb6('0x0'));var util=require(_0x2cb6('0x1'));var path=require(_0x2cb6('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cb6('0x3'));var router=express['Router']();var fs_extra=require(_0x2cb6('0x4'));var auth=require(_0x2cb6('0x5'));var interaction=require(_0x2cb6('0x6'));var config=require('../../config/environment');var controller=require(_0x2cb6('0x7'));router['get']('/',auth[_0x2cb6('0x8')](),controller[_0x2cb6('0x9')]);router[_0x2cb6('0xa')](_0x2cb6('0xb'),auth[_0x2cb6('0x8')](),controller[_0x2cb6('0xc')]);router[_0x2cb6('0xa')](_0x2cb6('0xd'),auth[_0x2cb6('0x8')](),controller['show']);router[_0x2cb6('0xa')]('/voice/queue/countAttributes/:id',auth[_0x2cb6('0x8')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x2cb6('0xe'),auth[_0x2cb6('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x2cb6('0xf')](_0x2cb6('0x10'),auth['isAuthenticated'](),controller[_0x2cb6('0x11')]);router[_0x2cb6('0xf')](_0x2cb6('0x12'),auth[_0x2cb6('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x2cb6('0xf')]('/checkContactHopper',auth[_0x2cb6('0x8')](),controller[_0x2cb6('0x13')]);router[_0x2cb6('0x14')](_0x2cb6('0xd'),auth[_0x2cb6('0x8')](),controller['update']);module[_0x2cb6('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b0571a0..f4038b2 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 _0xb235=['BOOLEAN','STRING','DATE','INTEGER'];(function(_0x24d9d2,_0x1f1cbb){var _0x59d49c=function(_0x55102b){while(--_0x55102b){_0x24d9d2['push'](_0x24d9d2['shift']());}};_0x59d49c(++_0x1f1cbb);}(_0xb235,0x10d));var _0x5b23=function(_0x223b0c,_0x371c5a){_0x223b0c=_0x223b0c-0x0;var _0x4ce5ed=_0xb235[_0x223b0c];return _0x4ce5ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5b23('0x0')]},'scheduledat':{'type':Sequelize[_0x5b23('0x1')]},'countbusyretry':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5b23('0x0')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x5b23('0x0')]},'calleridnum':{'type':Sequelize[_0x5b23('0x0')]},'calleridname':{'type':Sequelize[_0x5b23('0x0')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x5b23('0x1')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5b23('0x1')]},'ringtime':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5b23('0x0')]},'campaign':{'type':Sequelize[_0x5b23('0x0')]},'campaigntype':{'type':Sequelize[_0x5b23('0x0')]},'membername':{'type':Sequelize[_0x5b23('0x0')]},'reason':{'type':Sequelize[_0x5b23('0x0')]},'amd':{'type':Sequelize[_0x5b23('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5b23('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5b23('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5b23('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5b23('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5b23('0x1')]},'edited':{'type':Sequelize[_0x5b23('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5b23('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5b23('0x0')]}}; \ No newline at end of file +var _0xe930=['DATE','INTEGER','STRING','BOOLEAN','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe930,0x1de));var _0x0e93=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0xe930[_0xa79977];return _0x109f10;};'use strict';var Sequelize=require(_0x0e93('0x0'));module[_0x0e93('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0e93('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0e93('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x0e93('0x4')]},'originatecalleridname':{'type':Sequelize[_0x0e93('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0e93('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0e93('0x2')]},'answertime':{'type':Sequelize[_0x0e93('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0e93('0x2')]},'ringtime':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0e93('0x4')]},'campaign':{'type':Sequelize[_0x0e93('0x4')]},'campaigntype':{'type':Sequelize[_0x0e93('0x4')]},'membername':{'type':Sequelize[_0x0e93('0x4')]},'reason':{'type':Sequelize[_0x0e93('0x4')]},'amd':{'type':Sequelize[_0x0e93('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x0e93('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0e93('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0e93('0x2')]},'recallme':{'type':Sequelize[_0x0e93('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0e93('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0e93('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x0e93('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index eea82bd..f35f621 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 _0xcf67=['pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','update','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','CmHopperHistory','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where'];(function(_0x1b09c1,_0x3c1a59){var _0x3aaba6=function(_0x1a9d74){while(--_0x1a9d74){_0x1b09c1['push'](_0x1b09c1['shift']());}};_0x3aaba6(++_0x3c1a59);}(_0xcf67,0x1d6));var _0x7cf6=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0xcf67[_0x162780];return _0x1ea2dc;};'use strict';var emlformat=require(_0x7cf6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7cf6('0x1'));var jsonpatch=require(_0x7cf6('0x2'));var rp=require(_0x7cf6('0x3'));var moment=require(_0x7cf6('0x4'));var BPromise=require(_0x7cf6('0x5'));var Mustache=require(_0x7cf6('0x6'));var util=require(_0x7cf6('0x7'));var path=require(_0x7cf6('0x8'));var sox=require(_0x7cf6('0x9'));var csv=require('to-csv');var ejs=require(_0x7cf6('0xa'));var fs=require('fs');var fs_extra=require(_0x7cf6('0xb'));var _=require(_0x7cf6('0xc'));var squel=require(_0x7cf6('0xd'));var crypto=require(_0x7cf6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7cf6('0xf'));var toCsv=require(_0x7cf6('0x10'));var querystring=require(_0x7cf6('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7cf6('0x12'));var qs=require(_0x7cf6('0x13'));var as=require(_0x7cf6('0x14'));var hardwareService=require(_0x7cf6('0x15'));var logger=require(_0x7cf6('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7cf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7cf6('0x18'))['db'];function respondWithStatusCode(_0x4ec98a,_0x542dda){_0x542dda=_0x542dda||0xcc;return function(_0xa62797){if(_0xa62797){return _0x4ec98a[_0x7cf6('0x19')](_0x542dda);}return _0x4ec98a[_0x7cf6('0x1a')](_0x542dda)['end']();};}function respondWithResult(_0x5bced2,_0x449c8b){_0x449c8b=_0x449c8b||0xc8;return function(_0x382522){if(_0x382522){return _0x5bced2['status'](_0x449c8b)[_0x7cf6('0x1b')](_0x382522);}};}function respondWithFilteredResult(_0x29d166,_0x49467d){return function(_0x5a80da){if(_0x5a80da){var _0x3f79d8=typeof _0x49467d[_0x7cf6('0x1c')]===_0x7cf6('0x1d')&&typeof _0x49467d['limit']===_0x7cf6('0x1d');var _0x103a79=_0x5a80da[_0x7cf6('0x1e')];var _0x45f6ec=_0x3f79d8?0x0:_0x49467d[_0x7cf6('0x1c')];var _0xae5bd7=_0x3f79d8?_0x5a80da[_0x7cf6('0x1e')]:_0x49467d[_0x7cf6('0x1c')]+_0x49467d[_0x7cf6('0x1f')];var _0xbd20a6;if(_0xae5bd7>=_0x103a79){_0xae5bd7=_0x103a79;_0xbd20a6=0xc8;}else{_0xbd20a6=0xce;}_0x29d166[_0x7cf6('0x1a')](_0xbd20a6);return _0x29d166['set'](_0x7cf6('0x20'),_0x45f6ec+'-'+_0xae5bd7+'/'+_0x103a79)[_0x7cf6('0x1b')](_0x5a80da);}return null;};}function patchUpdates(_0x172117){return function(_0x59e269){try{jsonpatch[_0x7cf6('0x21')](_0x59e269,_0x172117,!![]);}catch(_0xe6cef5){return BPromise[_0x7cf6('0x22')](_0xe6cef5);}return _0x59e269[_0x7cf6('0x23')]();};}function saveUpdates(_0xe2dd52,_0x50f278){return function(_0x2b13e2){if(_0x2b13e2){return _0x2b13e2['update'](_0xe2dd52)[_0x7cf6('0x24')](function(_0x6632d0){return _0x6632d0;});}return null;};}function removeEntity(_0x463dbc,_0x5a8098){return function(_0x45f7e5){if(_0x45f7e5){return _0x45f7e5[_0x7cf6('0x25')]()['then'](function(){_0x463dbc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x105fde,_0x5f6d61){return function(_0xe76484){if(!_0xe76484){_0x105fde[_0x7cf6('0x19')](0x194);}return _0xe76484;};}function handleError(_0x36bc8d,_0x2dde94){_0x2dde94=_0x2dde94||0x1f4;return function(_0x1c0773){logger['error'](_0x1c0773[_0x7cf6('0x26')]);if(_0x1c0773[_0x7cf6('0x27')]){delete _0x1c0773[_0x7cf6('0x27')];}_0x36bc8d[_0x7cf6('0x1a')](_0x2dde94)[_0x7cf6('0x28')](_0x1c0773);};}exports['index']=function(_0x49d944,_0x4eadcf){var _0x575d99={},_0x1644ab={},_0x5c8244={'count':0x0,'rows':[]};var _0x2ec0de=_['map'](db[_0x7cf6('0x29')]['rawAttributes'],function(_0x1ef838){return{'name':_0x1ef838['fieldName'],'type':_0x1ef838[_0x7cf6('0x2a')][_0x7cf6('0x2b')]};});_0x1644ab[_0x7cf6('0x2c')]=_[_0x7cf6('0x2d')](_0x2ec0de,_0x7cf6('0x27'));_0x1644ab[_0x7cf6('0x2e')]=_[_0x7cf6('0x2f')](_0x49d944[_0x7cf6('0x2e')]);_0x1644ab['filters']=_[_0x7cf6('0x30')](_0x1644ab[_0x7cf6('0x2c')],_0x1644ab[_0x7cf6('0x2e')]);_0x575d99[_0x7cf6('0x31')]=_[_0x7cf6('0x30')](_0x1644ab[_0x7cf6('0x2c')],qs[_0x7cf6('0x32')](_0x49d944[_0x7cf6('0x2e')][_0x7cf6('0x32')]));_0x575d99['attributes']=_0x575d99['attributes'][_0x7cf6('0x33')]?_0x575d99[_0x7cf6('0x31')]:_0x1644ab[_0x7cf6('0x2c')];if(!_0x49d944[_0x7cf6('0x2e')]['hasOwnProperty'](_0x7cf6('0x34'))){_0x575d99[_0x7cf6('0x1f')]=qs[_0x7cf6('0x1f')](_0x49d944[_0x7cf6('0x2e')][_0x7cf6('0x1f')]);_0x575d99[_0x7cf6('0x1c')]=qs[_0x7cf6('0x1c')](_0x49d944['query'][_0x7cf6('0x1c')]);}_0x575d99['order']=qs[_0x7cf6('0x35')](_0x49d944[_0x7cf6('0x2e')][_0x7cf6('0x35')]);_0x575d99[_0x7cf6('0x36')]=qs['filters'](_[_0x7cf6('0x37')](_0x49d944[_0x7cf6('0x2e')],_0x1644ab[_0x7cf6('0x38')]),_0x2ec0de);if(_0x49d944[_0x7cf6('0x2e')]['filter']){_0x575d99[_0x7cf6('0x36')]=_[_0x7cf6('0x39')](_0x575d99['where'],{'$or':_['map'](_0x2ec0de,function(_0x302be0){if(_0x302be0[_0x7cf6('0x2a')]!==_0x7cf6('0x3a')){var _0x26ee03={};_0x26ee03[_0x302be0['name']]={'$like':'%'+_0x49d944[_0x7cf6('0x2e')][_0x7cf6('0x3b')]+'%'};return _0x26ee03;}})});}_0x575d99=_[_0x7cf6('0x39')]({},_0x575d99,_0x49d944[_0x7cf6('0x3c')]);var _0x830fc4={'where':_0x575d99['where']};return db[_0x7cf6('0x29')][_0x7cf6('0x1e')](_0x830fc4)[_0x7cf6('0x24')](function(_0x43075f){_0x5c8244['count']=_0x43075f;if(_0x49d944[_0x7cf6('0x2e')][_0x7cf6('0x3d')]){_0x575d99[_0x7cf6('0x3e')]=[{'all':!![]}];}return db[_0x7cf6('0x29')][_0x7cf6('0x3f')](_0x575d99);})[_0x7cf6('0x24')](function(_0x4a4d2a){_0x5c8244[_0x7cf6('0x40')]=_0x4a4d2a;return _0x5c8244;})['then'](respondWithFilteredResult(_0x4eadcf,_0x575d99))[_0x7cf6('0x41')](handleError(_0x4eadcf,null));};exports[_0x7cf6('0x42')]=function(_0x316625,_0x1ba120){var _0x2aa2d7={'raw':!![],'where':{'id':_0x316625[_0x7cf6('0x43')]['id']}},_0x104f84={};_0x104f84[_0x7cf6('0x2c')]=_['keys'](db[_0x7cf6('0x29')][_0x7cf6('0x44')]);_0x104f84[_0x7cf6('0x2e')]=_[_0x7cf6('0x2f')](_0x316625[_0x7cf6('0x2e')]);_0x104f84['filters']=_[_0x7cf6('0x30')](_0x104f84[_0x7cf6('0x2c')],_0x104f84['query']);_0x2aa2d7[_0x7cf6('0x31')]=_['intersection'](_0x104f84[_0x7cf6('0x2c')],qs['fields'](_0x316625[_0x7cf6('0x2e')][_0x7cf6('0x32')]));_0x2aa2d7[_0x7cf6('0x31')]=_0x2aa2d7[_0x7cf6('0x31')][_0x7cf6('0x33')]?_0x2aa2d7[_0x7cf6('0x31')]:_0x104f84[_0x7cf6('0x2c')];if(_0x316625['query'][_0x7cf6('0x3d')]){_0x2aa2d7[_0x7cf6('0x3e')]=[{'all':!![]}];}_0x2aa2d7=_[_0x7cf6('0x39')]({},_0x2aa2d7,_0x316625['options']);return db[_0x7cf6('0x29')][_0x7cf6('0x45')](_0x2aa2d7)[_0x7cf6('0x24')](handleEntityNotFound(_0x1ba120,null))[_0x7cf6('0x24')](respondWithResult(_0x1ba120,null))[_0x7cf6('0x41')](handleError(_0x1ba120,null));};exports[_0x7cf6('0x46')]=function(_0x59cfe9,_0xde6aa0){return db[_0x7cf6('0x29')][_0x7cf6('0x46')](_0x59cfe9[_0x7cf6('0x47')],{})[_0x7cf6('0x24')](respondWithResult(_0xde6aa0,0xc9))[_0x7cf6('0x41')](handleError(_0xde6aa0,null));};exports['describe']=function(_0x374f03,_0x245548){return db[_0x7cf6('0x29')][_0x7cf6('0x48')]()[_0x7cf6('0x24')](respondWithResult(_0x245548,null))[_0x7cf6('0x41')](handleError(_0x245548,null));};exports[_0x7cf6('0x49')]=function(_0xe6e595,_0x52da8b){if(_0xe6e595[_0x7cf6('0x47')][_0x7cf6('0x4a')]){delete _0xe6e595[_0x7cf6('0x47')][_0x7cf6('0x4a')];}return db[_0x7cf6('0x29')]['find']({'where':{'uniqueid':_0xe6e595[_0x7cf6('0x43')]['id']}})[_0x7cf6('0x24')](handleEntityNotFound(_0x52da8b,null))[_0x7cf6('0x24')](saveUpdates(_0xe6e595[_0x7cf6('0x47')],null))[_0x7cf6('0x24')](respondWithResult(_0x52da8b,null))[_0x7cf6('0x41')](handleError(_0x52da8b,null));}; \ No newline at end of file +var _0x2944=['sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','describe','body','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','apply','reject','update','then','destroy','error','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x2e0c0e,_0x3245a9){var _0xa598a9=function(_0x224df6){while(--_0x224df6){_0x2e0c0e['push'](_0x2e0c0e['shift']());}};_0xa598a9(++_0x3245a9);}(_0x2944,0x147));var _0x4294=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2944[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x4294('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4294('0x1'));var jsonpatch=require(_0x4294('0x2'));var rp=require(_0x4294('0x3'));var moment=require(_0x4294('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4294('0x5'));var util=require(_0x4294('0x6'));var path=require(_0x4294('0x7'));var sox=require(_0x4294('0x8'));var csv=require(_0x4294('0x9'));var ejs=require(_0x4294('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4294('0xb'));var squel=require(_0x4294('0xc'));var crypto=require(_0x4294('0xd'));var jsforce=require(_0x4294('0xe'));var deskjs=require(_0x4294('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4294('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4294('0x11'));var as=require(_0x4294('0x12'));var hardwareService=require(_0x4294('0x13'));var logger=require(_0x4294('0x14'))(_0x4294('0x15'));var utils=require(_0x4294('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4294('0x17'));var db=require(_0x4294('0x18'))['db'];function respondWithStatusCode(_0x181ef7,_0x51a225){_0x51a225=_0x51a225||0xcc;return function(_0x291570){if(_0x291570){return _0x181ef7[_0x4294('0x19')](_0x51a225);}return _0x181ef7['status'](_0x51a225)[_0x4294('0x1a')]();};}function respondWithResult(_0x1e9d38,_0x59ce9d){_0x59ce9d=_0x59ce9d||0xc8;return function(_0x566aba){if(_0x566aba){return _0x1e9d38['status'](_0x59ce9d)[_0x4294('0x1b')](_0x566aba);}};}function respondWithFilteredResult(_0x2ae1cc,_0x408549){return function(_0x452dd5){if(_0x452dd5){var _0x171b4c=typeof _0x408549['offset']==='undefined'&&typeof _0x408549[_0x4294('0x1c')]===_0x4294('0x1d');var _0x534a16=_0x452dd5[_0x4294('0x1e')];var _0x451294=_0x171b4c?0x0:_0x408549[_0x4294('0x1f')];var _0xb86573=_0x171b4c?_0x452dd5[_0x4294('0x1e')]:_0x408549[_0x4294('0x1f')]+_0x408549['limit'];var _0x457a9c;if(_0xb86573>=_0x534a16){_0xb86573=_0x534a16;_0x457a9c=0xc8;}else{_0x457a9c=0xce;}_0x2ae1cc[_0x4294('0x20')](_0x457a9c);return _0x2ae1cc['set'](_0x4294('0x21'),_0x451294+'-'+_0xb86573+'/'+_0x534a16)[_0x4294('0x1b')](_0x452dd5);}return null;};}function patchUpdates(_0x3c84ca){return function(_0x52f52a){try{jsonpatch[_0x4294('0x22')](_0x52f52a,_0x3c84ca,!![]);}catch(_0x1d81de){return BPromise[_0x4294('0x23')](_0x1d81de);}return _0x52f52a['save']();};}function saveUpdates(_0x915e51,_0x36d4f7){return function(_0x490e00){if(_0x490e00){return _0x490e00[_0x4294('0x24')](_0x915e51)[_0x4294('0x25')](function(_0x19bc07){return _0x19bc07;});}return null;};}function removeEntity(_0xb77c9c,_0x13610f){return function(_0x3c8167){if(_0x3c8167){return _0x3c8167[_0x4294('0x26')]()['then'](function(){_0xb77c9c[_0x4294('0x20')](0xcc)[_0x4294('0x1a')]();});}};}function handleEntityNotFound(_0xc2984f,_0x175476){return function(_0x36a729){if(!_0x36a729){_0xc2984f[_0x4294('0x19')](0x194);}return _0x36a729;};}function handleError(_0x198ab4,_0x41002b){_0x41002b=_0x41002b||0x1f4;return function(_0x594a7b){logger[_0x4294('0x27')](_0x594a7b['stack']);if(_0x594a7b[_0x4294('0x28')]){delete _0x594a7b[_0x4294('0x28')];}_0x198ab4[_0x4294('0x20')](_0x41002b)['send'](_0x594a7b);};}exports[_0x4294('0x29')]=function(_0x16a653,_0x4524d1){var _0x331103={},_0x5252f2={},_0x4b2080={'count':0x0,'rows':[]};var _0x243fef=_[_0x4294('0x2a')](db[_0x4294('0x2b')][_0x4294('0x2c')],function(_0x440dba){return{'name':_0x440dba[_0x4294('0x2d')],'type':_0x440dba[_0x4294('0x2e')]['key']};});_0x5252f2['model']=_[_0x4294('0x2a')](_0x243fef,_0x4294('0x28'));_0x5252f2[_0x4294('0x2f')]=_[_0x4294('0x30')](_0x16a653[_0x4294('0x2f')]);_0x5252f2[_0x4294('0x31')]=_[_0x4294('0x32')](_0x5252f2[_0x4294('0x33')],_0x5252f2['query']);_0x331103['attributes']=_[_0x4294('0x32')](_0x5252f2[_0x4294('0x33')],qs[_0x4294('0x34')](_0x16a653[_0x4294('0x2f')]['fields']));_0x331103['attributes']=_0x331103[_0x4294('0x35')][_0x4294('0x36')]?_0x331103['attributes']:_0x5252f2['model'];if(!_0x16a653[_0x4294('0x2f')][_0x4294('0x37')](_0x4294('0x38'))){_0x331103[_0x4294('0x1c')]=qs[_0x4294('0x1c')](_0x16a653[_0x4294('0x2f')]['limit']);_0x331103[_0x4294('0x1f')]=qs['offset'](_0x16a653[_0x4294('0x2f')]['offset']);}_0x331103[_0x4294('0x39')]=qs[_0x4294('0x3a')](_0x16a653[_0x4294('0x2f')][_0x4294('0x3a')]);_0x331103[_0x4294('0x3b')]=qs[_0x4294('0x31')](_[_0x4294('0x3c')](_0x16a653[_0x4294('0x2f')],_0x5252f2[_0x4294('0x31')]),_0x243fef);if(_0x16a653['query']['filter']){_0x331103[_0x4294('0x3b')]=_[_0x4294('0x3d')](_0x331103[_0x4294('0x3b')],{'$or':_[_0x4294('0x2a')](_0x243fef,function(_0x37dc41){if(_0x37dc41[_0x4294('0x2e')]!==_0x4294('0x3e')){var _0x4f3634={};_0x4f3634[_0x37dc41[_0x4294('0x28')]]={'$like':'%'+_0x16a653[_0x4294('0x2f')][_0x4294('0x3f')]+'%'};return _0x4f3634;}})});}_0x331103=_[_0x4294('0x3d')]({},_0x331103,_0x16a653[_0x4294('0x40')]);var _0x61bff1={'where':_0x331103[_0x4294('0x3b')]};return db[_0x4294('0x2b')][_0x4294('0x1e')](_0x61bff1)[_0x4294('0x25')](function(_0x2cb7a5){_0x4b2080[_0x4294('0x1e')]=_0x2cb7a5;if(_0x16a653[_0x4294('0x2f')][_0x4294('0x41')]){_0x331103['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x4294('0x42')](_0x331103);})[_0x4294('0x25')](function(_0x1a43cd){_0x4b2080[_0x4294('0x43')]=_0x1a43cd;return _0x4b2080;})['then'](respondWithFilteredResult(_0x4524d1,_0x331103))[_0x4294('0x44')](handleError(_0x4524d1,null));};exports[_0x4294('0x45')]=function(_0x2b5767,_0x26ac72){var _0x4f9fa7={'raw':!![],'where':{'id':_0x2b5767[_0x4294('0x46')]['id']}},_0x3e2cb9={};_0x3e2cb9[_0x4294('0x33')]=_[_0x4294('0x30')](db[_0x4294('0x2b')][_0x4294('0x2c')]);_0x3e2cb9[_0x4294('0x2f')]=_[_0x4294('0x30')](_0x2b5767[_0x4294('0x2f')]);_0x3e2cb9['filters']=_[_0x4294('0x32')](_0x3e2cb9[_0x4294('0x33')],_0x3e2cb9[_0x4294('0x2f')]);_0x4f9fa7['attributes']=_[_0x4294('0x32')](_0x3e2cb9['model'],qs['fields'](_0x2b5767[_0x4294('0x2f')][_0x4294('0x34')]));_0x4f9fa7[_0x4294('0x35')]=_0x4f9fa7[_0x4294('0x35')][_0x4294('0x36')]?_0x4f9fa7[_0x4294('0x35')]:_0x3e2cb9[_0x4294('0x33')];if(_0x2b5767[_0x4294('0x2f')][_0x4294('0x41')]){_0x4f9fa7[_0x4294('0x47')]=[{'all':!![]}];}_0x4f9fa7=_[_0x4294('0x3d')]({},_0x4f9fa7,_0x2b5767[_0x4294('0x40')]);return db['CmHopperHistory'][_0x4294('0x48')](_0x4f9fa7)[_0x4294('0x25')](handleEntityNotFound(_0x26ac72,null))['then'](respondWithResult(_0x26ac72,null))[_0x4294('0x44')](handleError(_0x26ac72,null));};exports[_0x4294('0x49')]=function(_0x57b24f,_0x1718a3){return db[_0x4294('0x2b')][_0x4294('0x49')](_0x57b24f['body'],{})[_0x4294('0x25')](respondWithResult(_0x1718a3,0xc9))[_0x4294('0x44')](handleError(_0x1718a3,null));};exports[_0x4294('0x4a')]=function(_0xfe95e4,_0x1bebeb){return db[_0x4294('0x2b')]['describe']()['then'](respondWithResult(_0x1bebeb,null))[_0x4294('0x44')](handleError(_0x1bebeb,null));};exports[_0x4294('0x24')]=function(_0x377887,_0x46b25a){if(_0x377887[_0x4294('0x4b')][_0x4294('0x4c')]){delete _0x377887[_0x4294('0x4b')][_0x4294('0x4c')];}return db[_0x4294('0x2b')]['find']({'where':{'uniqueid':_0x377887['params']['id']}})[_0x4294('0x25')](handleEntityNotFound(_0x46b25a,null))[_0x4294('0x25')](saveUpdates(_0x377887['body'],null))[_0x4294('0x25')](respondWithResult(_0x46b25a,null))[_0x4294('0x44')](handleError(_0x46b25a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b0425b5..d059b61 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 _0x7fea=['exports','define','CmHopperHistory','cm_hopper_history','endtime','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x359e07,_0x1876f4){var _0x2976aa=function(_0x3f4a74){while(--_0x3f4a74){_0x359e07['push'](_0x359e07['shift']());}};_0x2976aa(++_0x1876f4);}(_0x7fea,0x149));var _0xa7fe=function(_0x372621,_0x2e5a02){_0x372621=_0x372621-0x0;var _0x3812eb=_0x7fea[_0x372621];return _0x3812eb;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa7fe('0x1'));var BPromise=require(_0xa7fe('0x2'));var rp=require(_0xa7fe('0x3'));var fs=require('fs');var path=require(_0xa7fe('0x4'));var rimraf=require(_0xa7fe('0x5'));var config=require(_0xa7fe('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0xa7fe('0x7')]=function(_0x2bcfad,_0x1fbc99){return _0x2bcfad[_0xa7fe('0x8')](_0xa7fe('0x9'),attributes,{'tableName':_0xa7fe('0xa'),'paranoid':![],'indexes':[{'name':_0xa7fe('0xb'),'fields':[_0xa7fe('0xb')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b84=['exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x3a5b74,_0x4960ee){var _0x366746=function(_0x20d8e5){while(--_0x20d8e5){_0x3a5b74['push'](_0x3a5b74['shift']());}};_0x366746(++_0x4960ee);}(_0x7b84,0x17c));var _0x47b8=function(_0xa50280,_0x211e46){_0xa50280=_0xa50280-0x0;var _0x1148b5=_0x7b84[_0xa50280];return _0x1148b5;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var logger=require(_0x47b8('0x2'))(_0x47b8('0x3'));var moment=require(_0x47b8('0x4'));var BPromise=require(_0x47b8('0x5'));var rp=require(_0x47b8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var attributes=require(_0x47b8('0x9'));module[_0x47b8('0xa')]=function(_0x2e6853,_0xafe88a){return _0x2e6853['define'](_0x47b8('0xb'),attributes,{'tableName':_0x47b8('0xc'),'paranoid':![],'indexes':[{'name':_0x47b8('0xd'),'fields':[_0x47b8('0xd')]},{'name':_0x47b8('0xe'),'fields':[_0x47b8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index e6fcb40..fede405 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 _0x6916=['`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','catch','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x6916,0x1ed));var _0x6691=function(_0x1340e6,_0x292ab0){_0x1340e6=_0x1340e6-0x0;var _0x39f395=_0x6916[_0x1340e6];return _0x39f395;};'use strict';var _=require('lodash');var util=require(_0x6691('0x0'));var moment=require(_0x6691('0x1'));var BPromise=require(_0x6691('0x2'));var rs=require(_0x6691('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6691('0x4'))['db'];var utils=require(_0x6691('0x5'));var logger=require(_0x6691('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6691('0x7'));var client=jayson[_0x6691('0x8')][_0x6691('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf8ef8b,_0x37a4cf,_0x31335a){return new BPromise(function(_0xc39817,_0x2979ec){return client[_0x6691('0xa')](_0xf8ef8b,_0x31335a)['then'](function(_0x19cbd2){logger['info'](_0x6691('0xb'),_0x37a4cf,_0x6691('0xc'));logger[_0x6691('0xd')](_0x6691('0xe'),_0x37a4cf,'request\x20sent',JSON[_0x6691('0xf')](_0x19cbd2));if(_0x19cbd2[_0x6691('0x10')]){if(_0x19cbd2[_0x6691('0x10')][_0x6691('0x11')]===0x1f4){logger[_0x6691('0x10')](_0x6691('0xb'),_0x37a4cf,_0x19cbd2[_0x6691('0x10')]['message']);return _0x2979ec(_0x19cbd2[_0x6691('0x10')][_0x6691('0x12')]);}logger[_0x6691('0x10')](_0x6691('0xb'),_0x37a4cf,_0x19cbd2[_0x6691('0x10')][_0x6691('0x12')]);return _0xc39817(_0x19cbd2['error']['message']);}else{logger[_0x6691('0x13')](_0x6691('0xb'),_0x37a4cf,_0x6691('0xc'));_0xc39817(_0x19cbd2[_0x6691('0x14')][_0x6691('0x12')]);}})['catch'](function(_0x301c09){logger[_0x6691('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x37a4cf,_0x301c09);_0x2979ec(_0x301c09);});});}exports[_0x6691('0x15')]=function(_0x2d0bcb){var _0x56483c=this;return new Promise(function(_0x5f5651,_0x154c58){return db[_0x6691('0x16')][_0x6691('0x17')](_0x2d0bcb[_0x6691('0x18')],{'raw':_0x2d0bcb[_0x6691('0x19')]?_0x2d0bcb['options'][_0x6691('0x1a')]===undefined?!![]:![]:!![]})[_0x6691('0x1b')](function(_0x57620b){logger[_0x6691('0x13')](_0x6691('0x15'),_0x2d0bcb);logger[_0x6691('0xd')](_0x6691('0x15'),_0x2d0bcb,JSON[_0x6691('0xf')](_0x57620b));_0x5f5651(_0x57620b);})['catch'](function(_0x8080e4){logger[_0x6691('0x10')](_0x6691('0x15'),_0x8080e4[_0x6691('0x12')],_0x2d0bcb);_0x154c58(_0x56483c[_0x6691('0x10')](0x1f4,_0x8080e4[_0x6691('0x12')]));});});};exports[_0x6691('0x1c')]=function(_0x193b76){var _0x16d8f8=this;return new Promise(function(_0x54a4c3,_0x53120a){return db[_0x6691('0x16')]['findAll']({'raw':_0x193b76['options']?_0x193b76[_0x6691('0x19')][_0x6691('0x1a')]===undefined?!![]:![]:!![],'where':_0x193b76['options']?_0x193b76[_0x6691('0x19')][_0x6691('0x1d')]||null:null,'attributes':[[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db[_0x6691('0x1e')][_0x6691('0x20')]('id')),_0x6691('0x21')],[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db['sequelize']['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x23')))),_0x6691('0x24')],[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x6691('0x1e')]['fn'](_0x6691('0x26'),db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x27')))),_0x6691('0x28')],[db[_0x6691('0x1e')]['fn'](_0x6691('0x26'),db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x29')))),_0x6691('0x2a')]]})[_0x6691('0x1b')](function(_0x528282){logger[_0x6691('0x13')](_0x6691('0x1c'),_0x193b76);logger['debug']('AvgHandleTime',_0x193b76,JSON[_0x6691('0xf')](_0x528282));_0x54a4c3(_0x528282);})[_0x6691('0x2b')](function(_0x385c37){logger[_0x6691('0x10')](_0x6691('0x1c'),_0x385c37['message'],_0x193b76);_0x53120a(_0x16d8f8[_0x6691('0x10')](0x1f4,_0x385c37['message']));});});};exports[_0x6691('0x2c')]=function(_0x454641){var _0x57c0a7=this;return new Promise(function(_0x4d0b69,_0x5257e0){return db[_0x6691('0x16')][_0x6691('0x2d')]({'raw':_0x454641['options']?_0x454641[_0x6691('0x19')][_0x6691('0x1a')]===undefined?!![]:![]:!![],'where':_0x454641[_0x6691('0x19')]?_0x454641[_0x6691('0x19')]['where']||null:null,'attributes':[[_0x6691('0x2e'),'name'],[db['sequelize']['fn'](_0x6691('0x1f'),db['sequelize']['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x2f')))),_0x6691('0x30')],[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db[_0x6691('0x1e')]['fn']('IF',db['sequelize'][_0x6691('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x6691('0x31')],[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db['sequelize']['fn']('IF',db[_0x6691('0x1e')]['literal'](_0x6691('0x23')))),_0x6691('0x32')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x33')))),'outboundBusyCallsDay'],[db[_0x6691('0x1e')]['fn']('COUNT',db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')]['literal'](_0x6691('0x34')))),'outboundCongestionCallsDay'],[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db['sequelize']['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x6691('0x35')],[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6691('0x36')],[db['sequelize']['fn'](_0x6691('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x6691('0x22')](_0x6691('0x37')))),'outboundUnknownCallsDay'],[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x6691('0x22')](_0x6691('0x38')))),_0x6691('0x39')],[db['sequelize']['fn'](_0x6691('0x1f'),db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),_0x6691('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x3b')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x6691('0x1f'),db['sequelize']['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x3c')))),_0x6691('0x3d')],[db[_0x6691('0x1e')]['fn']('COUNT',db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x3e')))),_0x6691('0x3f')],[db['sequelize']['fn']('COUNT',db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x40')))),'outboundReCallsDay']],'group':[_0x6691('0x2e')]})[_0x6691('0x1b')](function(_0x148c16){logger[_0x6691('0x13')]('GetVoiceQueueHopperHistory',_0x454641);logger[_0x6691('0xd')](_0x6691('0x2c'),_0x454641,JSON[_0x6691('0xf')](_0x148c16));_0x4d0b69(_0x148c16);})['catch'](function(_0x168d86){logger[_0x6691('0x10')]('GetVoiceQueueHopperHistory',_0x168d86[_0x6691('0x12')],_0x454641);_0x5257e0(_0x57c0a7['error'](0x1f4,_0x168d86['message']));});});};exports[_0x6691('0x41')]=function(_0x2c7bb9){var _0x5d3069=this;return new Promise(function(_0x173658,_0x1c0b5a){return db['CmHopperHistory']['findAll']({'raw':_0x2c7bb9[_0x6691('0x19')]?_0x2c7bb9[_0x6691('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2c7bb9[_0x6691('0x19')]?_0x2c7bb9[_0x6691('0x19')]['where']||null:null,'attributes':[[_0x6691('0x2e'),_0x6691('0x42')],[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db[_0x6691('0x1e')]['col']('id')),_0x6691('0x43')],[db[_0x6691('0x1e')]['fn'](_0x6691('0x1f'),db[_0x6691('0x1e')]['fn']('IF',db[_0x6691('0x1e')][_0x6691('0x22')](_0x6691('0x23')))),_0x6691('0x44')]],'group':[_0x6691('0x2e')]})[_0x6691('0x1b')](function(_0x2f2342){logger['info'](_0x6691('0x41'),_0x2c7bb9);logger[_0x6691('0xd')](_0x6691('0x41'),_0x2c7bb9,JSON[_0x6691('0xf')](_0x2f2342));_0x173658(_0x2f2342);})['catch'](function(_0x55c5f1){logger['error']('GetCampaignHopperHistory',_0x55c5f1[_0x6691('0x12')],_0x2c7bb9);_0x1c0b5a(_0x5d3069[_0x6691('0x10')](0x1f4,_0x55c5f1[_0x6691('0x12')]));});});}; \ No newline at end of file +var _0x25a3=['`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperHistory','create','body','options','raw','then','CreateCmHopperHistory','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','where','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'];(function(_0x4e1ae6,_0x5362cd){var _0x5277f3=function(_0x266e7b){while(--_0x266e7b){_0x4e1ae6['push'](_0x4e1ae6['shift']());}};_0x5277f3(++_0x5362cd);}(_0x25a3,0x121));var _0x325a=function(_0x2117bb,_0x385489){_0x2117bb=_0x2117bb-0x0;var _0x2bb163=_0x25a3[_0x2117bb];return _0x2bb163;};'use strict';var _=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var moment=require(_0x325a('0x2'));var BPromise=require('bluebird');var rs=require(_0x325a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x325a('0x4'))['db'];var utils=require(_0x325a('0x5'));var logger=require(_0x325a('0x6'))('rpc');var config=require(_0x325a('0x7'));var jayson=require(_0x325a('0x8'));var client=jayson[_0x325a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533867,_0x3bb82f,_0x209f5e){return new BPromise(function(_0x43bd79,_0x33f09a){return client['request'](_0x533867,_0x209f5e)['then'](function(_0x37e954){logger[_0x325a('0xa')](_0x325a('0xb'),_0x3bb82f,_0x325a('0xc'));logger[_0x325a('0xd')](_0x325a('0xe'),_0x3bb82f,'request\x20sent',JSON[_0x325a('0xf')](_0x37e954));if(_0x37e954[_0x325a('0x10')]){if(_0x37e954['error'][_0x325a('0x11')]===0x1f4){logger[_0x325a('0x10')](_0x325a('0xb'),_0x3bb82f,_0x37e954[_0x325a('0x10')]['message']);return _0x33f09a(_0x37e954['error'][_0x325a('0x12')]);}logger['error'](_0x325a('0xb'),_0x3bb82f,_0x37e954[_0x325a('0x10')][_0x325a('0x12')]);return _0x43bd79(_0x37e954[_0x325a('0x10')][_0x325a('0x12')]);}else{logger[_0x325a('0xa')](_0x325a('0xb'),_0x3bb82f,_0x325a('0xc'));_0x43bd79(_0x37e954[_0x325a('0x13')][_0x325a('0x12')]);}})[_0x325a('0x14')](function(_0x21315f){logger[_0x325a('0x10')](_0x325a('0xb'),_0x3bb82f,_0x21315f);_0x33f09a(_0x21315f);});});}exports['CreateCmHopperHistory']=function(_0x4cba7){var _0x4fbd50=this;return new Promise(function(_0x4a1f9f,_0x34c4c8){return db[_0x325a('0x15')][_0x325a('0x16')](_0x4cba7[_0x325a('0x17')],{'raw':_0x4cba7[_0x325a('0x18')]?_0x4cba7[_0x325a('0x18')][_0x325a('0x19')]===undefined?!![]:![]:!![]})[_0x325a('0x1a')](function(_0x347f2d){logger[_0x325a('0xa')](_0x325a('0x1b'),_0x4cba7);logger[_0x325a('0xd')]('CreateCmHopperHistory',_0x4cba7,JSON[_0x325a('0xf')](_0x347f2d));_0x4a1f9f(_0x347f2d);})[_0x325a('0x14')](function(_0x18e29f){logger[_0x325a('0x10')](_0x325a('0x1b'),_0x18e29f[_0x325a('0x12')],_0x4cba7);_0x34c4c8(_0x4fbd50['error'](0x1f4,_0x18e29f[_0x325a('0x12')]));});});};exports['AvgHandleTime']=function(_0x15b5a6){var _0x3e6934=this;return new Promise(function(_0x309c06,_0x22c4a6){return db[_0x325a('0x15')]['findAll']({'raw':_0x15b5a6[_0x325a('0x18')]?_0x15b5a6['options'][_0x325a('0x19')]===undefined?!![]:![]:!![],'where':_0x15b5a6[_0x325a('0x18')]?_0x15b5a6[_0x325a('0x18')]['where']||null:null,'attributes':[[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')][_0x325a('0x1e')]('id')),_0x325a('0x1f')],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')]['literal'](_0x325a('0x20')))),_0x325a('0x21')],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')]['fn']('IF',db['sequelize'][_0x325a('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0x325a('0x23')],[db[_0x325a('0x1c')]['fn']('COUNT',db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')][_0x325a('0x22')](_0x325a('0x24')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x325a('0x1c')]['fn'](_0x325a('0x25'),db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')]['literal'](_0x325a('0x26')))),_0x325a('0x27')],[db[_0x325a('0x1c')]['fn'](_0x325a('0x25'),db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')]['literal'](_0x325a('0x28')))),_0x325a('0x29')]]})['then'](function(_0x3a283f){logger[_0x325a('0xa')]('AvgHandleTime',_0x15b5a6);logger[_0x325a('0xd')]('AvgHandleTime',_0x15b5a6,JSON[_0x325a('0xf')](_0x3a283f));_0x309c06(_0x3a283f);})[_0x325a('0x14')](function(_0x245aed){logger[_0x325a('0x10')]('AvgHandleTime',_0x245aed[_0x325a('0x12')],_0x15b5a6);_0x22c4a6(_0x3e6934['error'](0x1f4,_0x245aed[_0x325a('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x55aeb1){var _0x46dde5=this;return new Promise(function(_0x266df9,_0x37f206){return db['CmHopperHistory'][_0x325a('0x2a')]({'raw':_0x55aeb1['options']?_0x55aeb1[_0x325a('0x18')][_0x325a('0x19')]===undefined?!![]:![]:!![],'where':_0x55aeb1[_0x325a('0x18')]?_0x55aeb1[_0x325a('0x18')][_0x325a('0x2b')]||null:null,'attributes':[[_0x325a('0x2c'),_0x325a('0x2d')],[db[_0x325a('0x1c')]['fn']('COUNT',db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')][_0x325a('0x22')](_0x325a('0x2e')))),_0x325a('0x2f')],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')]['literal'](_0x325a('0x30')))),_0x325a('0x31')],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')][_0x325a('0x22')](_0x325a('0x20')))),_0x325a('0x32')],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db['sequelize']['fn']('IF',db[_0x325a('0x1c')][_0x325a('0x22')](_0x325a('0x33')))),_0x325a('0x34')],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db['sequelize']['fn']('IF',db[_0x325a('0x1c')][_0x325a('0x22')](_0x325a('0x35')))),_0x325a('0x36')],[db[_0x325a('0x1c')]['fn']('COUNT',db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')][_0x325a('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x325a('0x37')],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x325a('0x22')](_0x325a('0x38')))),_0x325a('0x39')],[db[_0x325a('0x1c')]['fn']('COUNT',db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')]['literal'](_0x325a('0x3a')))),_0x325a('0x3b')],[db['sequelize']['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')]['fn']('IF',db['sequelize'][_0x325a('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')]['fn']('IF',db['sequelize'][_0x325a('0x22')](_0x325a('0x3c')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')]['fn']('IF',db['sequelize'][_0x325a('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')]['fn']('IF',db['sequelize'][_0x325a('0x22')](_0x325a('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')][_0x325a('0x22')](_0x325a('0x3e')))),'outboundRejectCallsDay'],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db['sequelize']['fn']('IF',db[_0x325a('0x1c')]['literal'](_0x325a('0x3f')))),_0x325a('0x40')]],'group':[_0x325a('0x2c')]})[_0x325a('0x1a')](function(_0x2854e6){logger[_0x325a('0xa')](_0x325a('0x41'),_0x55aeb1);logger[_0x325a('0xd')](_0x325a('0x41'),_0x55aeb1,JSON[_0x325a('0xf')](_0x2854e6));_0x266df9(_0x2854e6);})['catch'](function(_0x112dd4){logger[_0x325a('0x10')]('GetVoiceQueueHopperHistory',_0x112dd4[_0x325a('0x12')],_0x55aeb1);_0x37f206(_0x46dde5[_0x325a('0x10')](0x1f4,_0x112dd4[_0x325a('0x12')]));});});};exports[_0x325a('0x42')]=function(_0x3425a8){var _0x85bfcd=this;return new Promise(function(_0x141878,_0x2855d3){return db[_0x325a('0x15')][_0x325a('0x2a')]({'raw':_0x3425a8[_0x325a('0x18')]?_0x3425a8[_0x325a('0x18')][_0x325a('0x19')]===undefined?!![]:![]:!![],'where':_0x3425a8[_0x325a('0x18')]?_0x3425a8['options'][_0x325a('0x2b')]||null:null,'attributes':[[_0x325a('0x2c'),_0x325a('0x2d')],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')][_0x325a('0x1e')]('id')),_0x325a('0x43')],[db[_0x325a('0x1c')]['fn'](_0x325a('0x1d'),db[_0x325a('0x1c')]['fn']('IF',db[_0x325a('0x1c')]['literal'](_0x325a('0x20')))),_0x325a('0x44')]],'group':['campaign']})[_0x325a('0x1a')](function(_0x229d96){logger[_0x325a('0xa')]('GetCampaignHopperHistory',_0x3425a8);logger[_0x325a('0xd')](_0x325a('0x42'),_0x3425a8,JSON[_0x325a('0xf')](_0x229d96));_0x141878(_0x229d96);})[_0x325a('0x14')](function(_0x3d0f93){logger[_0x325a('0x10')](_0x325a('0x42'),_0x3d0f93[_0x325a('0x12')],_0x3425a8);_0x2855d3(_0x85bfcd[_0x325a('0x10')](0x1f4,_0x3d0f93['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 7702170..54b7f02 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 _0x8e63=['index','/describe','describe','/:id','post','put','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x1c7bbd,_0x5cb5d1){var _0x2e78ff=function(_0x21e9f0){while(--_0x21e9f0){_0x1c7bbd['push'](_0x1c7bbd['shift']());}};_0x2e78ff(++_0x5cb5d1);}(_0x8e63,0x85));var _0x38e6=function(_0x1b06b9,_0x21bb4e){_0x1b06b9=_0x1b06b9-0x0;var _0xabb954=_0x8e63[_0x1b06b9];return _0xabb954;};'use strict';var multer=require(_0x38e6('0x0'));var util=require(_0x38e6('0x1'));var path=require(_0x38e6('0x2'));var timeout=require(_0x38e6('0x3'));var express=require(_0x38e6('0x4'));var router=express[_0x38e6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x38e6('0x6'));var config=require(_0x38e6('0x7'));var controller=require(_0x38e6('0x8'));router[_0x38e6('0x9')]('/',auth[_0x38e6('0xa')](),controller[_0x38e6('0xb')]);router[_0x38e6('0x9')](_0x38e6('0xc'),auth['isAuthenticated'](),controller[_0x38e6('0xd')]);router[_0x38e6('0x9')](_0x38e6('0xe'),auth[_0x38e6('0xa')](),controller['show']);router[_0x38e6('0xf')]('/',auth[_0x38e6('0xa')](),controller['create']);router[_0x38e6('0x10')](_0x38e6('0xe'),auth['isAuthenticated'](),controller['update']);module[_0x38e6('0x11')]=router; \ No newline at end of file +var _0x2014=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x14d250,_0x4b2e12){var _0xb991d8=function(_0x4ea76d){while(--_0x4ea76d){_0x14d250['push'](_0x14d250['shift']());}};_0xb991d8(++_0x4b2e12);}(_0x2014,0xea));var _0x4201=function(_0x38299a,_0x2205f8){_0x38299a=_0x38299a-0x0;var _0x17b5fb=_0x2014[_0x38299a];return _0x17b5fb;};'use strict';var multer=require(_0x4201('0x0'));var util=require(_0x4201('0x1'));var path=require(_0x4201('0x2'));var timeout=require(_0x4201('0x3'));var express=require(_0x4201('0x4'));var router=express['Router']();var fs_extra=require(_0x4201('0x5'));var auth=require(_0x4201('0x6'));var interaction=require(_0x4201('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x4201('0x8')](),controller[_0x4201('0x9')]);router[_0x4201('0xa')](_0x4201('0xb'),auth[_0x4201('0x8')](),controller[_0x4201('0xc')]);router[_0x4201('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4201('0xd')]);router[_0x4201('0xe')]('/',auth[_0x4201('0x8')](),controller[_0x4201('0xf')]);router[_0x4201('0x10')](_0x4201('0x11'),auth[_0x4201('0x8')](),controller[_0x4201('0x12')]);module[_0x4201('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 98b44e8..a28e711 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 _0xcb81=['name','sequelize','exports'];(function(_0x39f5b,_0x224393){var _0x29c795=function(_0x16284b){while(--_0x16284b){_0x39f5b['push'](_0x39f5b['shift']());}};_0x29c795(++_0x224393);}(_0xcb81,0x154));var _0x1cb8=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xcb81[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x1cb8('0x0'));module[_0x1cb8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1cb8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x68f5=['sequelize','exports','STRING'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x68f5,0x11a));var _0x568f=function(_0x2be9e0,_0xad273c){_0x2be9e0=_0x2be9e0-0x0;var _0x46c119=_0x68f5[_0x2be9e0];return _0x46c119;};'use strict';var Sequelize=require(_0x568f('0x0'));module[_0x568f('0x1')]={'name':{'type':Sequelize[_0x568f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x568f('0x2')]},'dialPrefix':{'type':Sequelize[_0x568f('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 45bf8de..4ed50f6 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 _0xb0c6=['message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','order','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','distinct','c.cf_','field','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','TEXT','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','intersection','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','getDispositions','findOne','Disposition','hasOwnProperty','include','removeDispositions','ids','CmContact','tags','isArray','push','each','success','dataValues','errors'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0xb0c6,0x186));var _0x6b0c=function(_0x565d36,_0x25e782){_0x565d36=_0x565d36-0x0;var _0x22025b=_0xb0c6[_0x565d36];return _0x22025b;};'use strict';var emlformat=require(_0x6b0c('0x0'));var rimraf=require(_0x6b0c('0x1'));var zipdir=require(_0x6b0c('0x2'));var jsonpatch=require(_0x6b0c('0x3'));var rp=require(_0x6b0c('0x4'));var moment=require('moment');var BPromise=require(_0x6b0c('0x5'));var Mustache=require('mustache');var util=require(_0x6b0c('0x6'));var path=require(_0x6b0c('0x7'));var sox=require(_0x6b0c('0x8'));var csv=require('to-csv');var ejs=require(_0x6b0c('0x9'));var fs=require('fs');var fs_extra=require(_0x6b0c('0xa'));var _=require(_0x6b0c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b0c('0xc'));var deskjs=require(_0x6b0c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6b0c('0xe'));var Papa=require('papaparse');var Redis=require(_0x6b0c('0xf'));var authService=require(_0x6b0c('0x10'));var qs=require(_0x6b0c('0x11'));var as=require(_0x6b0c('0x12'));var hardwareService=require(_0x6b0c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6b0c('0x14'));var config=require(_0x6b0c('0x15'));var licenseUtil=require(_0x6b0c('0x16'));var db=require(_0x6b0c('0x17'))['db'];var csv_results;config[_0x6b0c('0x18')]=_['defaults'](config['redis'],{'host':_0x6b0c('0x19'),'port':0x18eb});var socket=require(_0x6b0c('0x1a'))(new Redis(config[_0x6b0c('0x18')]));require(_0x6b0c('0x1b'))['register'](socket);function respondWithStatusCode(_0x2b5422,_0x2fd08a){_0x2fd08a=_0x2fd08a||0xcc;return function(_0x38b065){if(_0x38b065){return _0x2b5422[_0x6b0c('0x1c')](_0x2fd08a);}return _0x2b5422[_0x6b0c('0x1d')](_0x2fd08a)[_0x6b0c('0x1e')]();};}function respondWithResult(_0x5ab2b3,_0x299b64){_0x299b64=_0x299b64||0xc8;return function(_0x120af2){if(_0x120af2){return _0x5ab2b3[_0x6b0c('0x1d')](_0x299b64)['json'](_0x120af2);}};}function respondWithFilteredResult(_0x39d790,_0x47c5b3){return function(_0x4916a4){if(_0x4916a4){var _0x3b975c=typeof _0x47c5b3[_0x6b0c('0x1f')]===_0x6b0c('0x20')&&typeof _0x47c5b3['limit']==='undefined';var _0x5730dd=_0x4916a4[_0x6b0c('0x21')];var _0x89b2fd=_0x3b975c?0x0:_0x47c5b3[_0x6b0c('0x1f')];var _0x1b3795=_0x3b975c?_0x4916a4['count']:_0x47c5b3[_0x6b0c('0x1f')]+_0x47c5b3['limit'];var _0x596e6e;if(_0x1b3795>=_0x5730dd){_0x1b3795=_0x5730dd;_0x596e6e=0xc8;}else{_0x596e6e=0xce;}_0x39d790[_0x6b0c('0x1d')](_0x596e6e);return _0x39d790[_0x6b0c('0x22')](_0x6b0c('0x23'),_0x89b2fd+'-'+_0x1b3795+'/'+_0x5730dd)[_0x6b0c('0x24')](_0x4916a4);}return null;};}function patchUpdates(_0x1719a1){return function(_0x3340ff){try{jsonpatch[_0x6b0c('0x25')](_0x3340ff,_0x1719a1,!![]);}catch(_0x591817){return BPromise['reject'](_0x591817);}return _0x3340ff[_0x6b0c('0x26')]();};}function saveUpdates(_0x5812db,_0x10617a){return function(_0x31f880){if(_0x31f880){return _0x31f880[_0x6b0c('0x27')](_0x5812db)[_0x6b0c('0x28')](function(_0x576d14){return _0x576d14;});}return null;};}function removeEntity(_0x302c5c,_0x582ba6){return function(_0x58f33b){if(_0x58f33b){return _0x58f33b[_0x6b0c('0x29')]()[_0x6b0c('0x28')](function(){var _0x197a53=_0x58f33b[_0x6b0c('0x2a')]({'plain':!![]});var _0x1791ce=_0x6b0c('0x2b');return db[_0x6b0c('0x2c')][_0x6b0c('0x29')]({'where':{'type':_0x1791ce,'resourceId':_0x197a53['id']}})[_0x6b0c('0x28')](function(){return _0x58f33b;});})[_0x6b0c('0x28')](function(){_0x302c5c['status'](0xcc)[_0x6b0c('0x1e')]();});}};}function handleEntityNotFound(_0x415eee,_0x1f90f9){return function(_0x283a82){if(!_0x283a82){_0x415eee[_0x6b0c('0x1c')](0x194);}return _0x283a82;};}function handleError(_0x437fac,_0x4eab63){_0x4eab63=_0x4eab63||0x1f4;return function(_0x5184a5){logger[_0x6b0c('0x2d')](_0x5184a5[_0x6b0c('0x2e')]);if(_0x5184a5['name']){delete _0x5184a5[_0x6b0c('0x2f')];}_0x437fac[_0x6b0c('0x1d')](_0x4eab63)[_0x6b0c('0x30')](_0x5184a5);};}exports[_0x6b0c('0x31')]=function(_0x3022a2,_0x5198b5){var _0xd49c2e={},_0xfea3ff={},_0x3bec1c={'count':0x0,'rows':[]};var _0x60cf19=_[_0x6b0c('0x32')](db[_0x6b0c('0x33')][_0x6b0c('0x34')],function(_0x4c4747){return{'name':_0x4c4747['fieldName'],'type':_0x4c4747[_0x6b0c('0x35')][_0x6b0c('0x36')]};});_0xfea3ff[_0x6b0c('0x37')]=_[_0x6b0c('0x32')](_0x60cf19,_0x6b0c('0x2f'));_0xfea3ff[_0x6b0c('0x38')]=_[_0x6b0c('0x39')](_0x3022a2[_0x6b0c('0x38')]);_0xfea3ff[_0x6b0c('0x3a')]=_['intersection'](_0xfea3ff[_0x6b0c('0x37')],_0xfea3ff[_0x6b0c('0x38')]);_0xd49c2e[_0x6b0c('0x3b')]=_['intersection'](_0xfea3ff[_0x6b0c('0x37')],qs[_0x6b0c('0x3c')](_0x3022a2[_0x6b0c('0x38')]['fields']));_0xd49c2e[_0x6b0c('0x3b')]=_0xd49c2e[_0x6b0c('0x3b')][_0x6b0c('0x3d')]?_0xd49c2e[_0x6b0c('0x3b')]:_0xfea3ff[_0x6b0c('0x37')];if(!_0x3022a2[_0x6b0c('0x38')]['hasOwnProperty'](_0x6b0c('0x3e'))){_0xd49c2e[_0x6b0c('0x3f')]=qs[_0x6b0c('0x3f')](_0x3022a2[_0x6b0c('0x38')][_0x6b0c('0x3f')]);_0xd49c2e[_0x6b0c('0x1f')]=qs['offset'](_0x3022a2[_0x6b0c('0x38')][_0x6b0c('0x1f')]);}_0xd49c2e['order']=qs[_0x6b0c('0x40')](_0x3022a2['query']['sort']);_0xd49c2e[_0x6b0c('0x41')]=qs[_0x6b0c('0x3a')](_[_0x6b0c('0x42')](_0x3022a2[_0x6b0c('0x38')],_0xfea3ff[_0x6b0c('0x3a')]),_0x60cf19);if(_0x3022a2[_0x6b0c('0x38')][_0x6b0c('0x43')]){_0xd49c2e['where']=_[_0x6b0c('0x44')](_0xd49c2e[_0x6b0c('0x41')],{'$or':_[_0x6b0c('0x32')](_0x60cf19,function(_0x5355f5){if(_0x5355f5['type']!==_0x6b0c('0x45')){var _0x4a55a4={};_0x4a55a4[_0x5355f5['name']]={'$like':'%'+_0x3022a2[_0x6b0c('0x38')][_0x6b0c('0x43')]+'%'};return _0x4a55a4;}})});}_0xd49c2e=_[_0x6b0c('0x44')]({},_0xd49c2e,_0x3022a2[_0x6b0c('0x46')]);var _0x221cd4={'where':_0xd49c2e[_0x6b0c('0x41')]};return db['CmList'][_0x6b0c('0x21')](_0x221cd4)[_0x6b0c('0x28')](function(_0x1c22f4){_0x3bec1c[_0x6b0c('0x21')]=_0x1c22f4;if(_0x3022a2[_0x6b0c('0x38')][_0x6b0c('0x47')]){_0xd49c2e['include']=[{'all':!![]}];}return db[_0x6b0c('0x33')][_0x6b0c('0x48')](_0xd49c2e);})[_0x6b0c('0x28')](function(_0x50a44a){_0x3bec1c[_0x6b0c('0x49')]=_0x50a44a;return _0x3bec1c;})[_0x6b0c('0x28')](respondWithFilteredResult(_0x5198b5,_0xd49c2e))['catch'](handleError(_0x5198b5,null));};exports[_0x6b0c('0x4a')]=function(_0xe65851,_0xdeb38d){var _0x5eb8ae={'raw':![],'where':{'id':_0xe65851[_0x6b0c('0x4b')]['id']}},_0x25851a={};_0x25851a['model']=_[_0x6b0c('0x39')](db['CmList'][_0x6b0c('0x34')]);_0x25851a[_0x6b0c('0x38')]=_[_0x6b0c('0x39')](_0xe65851['query']);_0x25851a['filters']=_[_0x6b0c('0x4c')](_0x25851a[_0x6b0c('0x37')],_0x25851a[_0x6b0c('0x38')]);_0x5eb8ae[_0x6b0c('0x3b')]=_[_0x6b0c('0x4c')](_0x25851a[_0x6b0c('0x37')],qs[_0x6b0c('0x3c')](_0xe65851['query'][_0x6b0c('0x3c')]));_0x5eb8ae[_0x6b0c('0x3b')]=_0x5eb8ae[_0x6b0c('0x3b')][_0x6b0c('0x3d')]?_0x5eb8ae[_0x6b0c('0x3b')]:_0x25851a[_0x6b0c('0x37')];if(_0xe65851[_0x6b0c('0x38')]['includeAll']){_0x5eb8ae['include']=[{'all':!![]}];}_0x5eb8ae=_[_0x6b0c('0x44')]({},_0x5eb8ae,_0xe65851['options']);return db[_0x6b0c('0x33')][_0x6b0c('0x4d')](_0x5eb8ae)[_0x6b0c('0x28')](handleEntityNotFound(_0xdeb38d,null))['then'](respondWithResult(_0xdeb38d,null))[_0x6b0c('0x4e')](handleError(_0xdeb38d,null));};exports[_0x6b0c('0x4f')]=function(_0x3ad63b,_0x50c459){return db[_0x6b0c('0x33')][_0x6b0c('0x4f')](_0x3ad63b['body'],{})['then'](function(_0x4040b1){var _0x27ca1f=_0x3ad63b['user'][_0x6b0c('0x2a')]({'plain':!![]});if(!_0x27ca1f)throw new Error(_0x6b0c('0x50'));if(_0x27ca1f[_0x6b0c('0x51')]===_0x6b0c('0x52')){var _0x45af3a=_0x4040b1['get']({'plain':!![]});var _0x24b9b5=_0x6b0c('0x2b');return db[_0x6b0c('0x53')][_0x6b0c('0x4d')]({'where':{'name':_0x24b9b5,'userProfileId':_0x27ca1f['userProfileId']},'raw':!![]})['then'](function(_0x9e3695){if(_0x9e3695&&_0x9e3695[_0x6b0c('0x54')]===0x0){return db[_0x6b0c('0x2c')][_0x6b0c('0x4f')]({'name':_0x45af3a[_0x6b0c('0x2f')],'resourceId':_0x45af3a['id'],'type':_0x9e3695[_0x6b0c('0x2f')],'sectionId':_0x9e3695['id']},{})[_0x6b0c('0x28')](function(){return _0x4040b1;});}else{return _0x4040b1;}})['catch'](function(_0x5e4eb9){logger[_0x6b0c('0x2d')](_0x6b0c('0x55'),_0x5e4eb9);throw _0x5e4eb9;});}return _0x4040b1;})[_0x6b0c('0x28')](respondWithResult(_0x50c459,0xc9))[_0x6b0c('0x4e')](handleError(_0x50c459,null));};exports['update']=function(_0x28411c,_0x36e658){if(_0x28411c['body']['id']){delete _0x28411c[_0x6b0c('0x56')]['id'];}return db['CmList']['find']({'where':{'id':_0x28411c[_0x6b0c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36e658,null))[_0x6b0c('0x28')](saveUpdates(_0x28411c[_0x6b0c('0x56')],null))['then'](respondWithResult(_0x36e658,null))[_0x6b0c('0x4e')](handleError(_0x36e658,null));};exports[_0x6b0c('0x29')]=function(_0x1a91b9,_0xd179fb){return db[_0x6b0c('0x33')][_0x6b0c('0x4d')]({'where':{'id':_0x1a91b9[_0x6b0c('0x4b')]['id']}})[_0x6b0c('0x28')](handleEntityNotFound(_0xd179fb,null))[_0x6b0c('0x28')](removeEntity(_0xd179fb,null))[_0x6b0c('0x4e')](handleError(_0xd179fb,null));};exports[_0x6b0c('0x57')]=function(_0x4b8be5,_0x1617c6){return db[_0x6b0c('0x33')]['describe']()[_0x6b0c('0x28')](respondWithResult(_0x1617c6,null))['catch'](handleError(_0x1617c6,null));};exports[_0x6b0c('0x58')]=function(_0x4891f9,_0x5c2735,_0x5124e0){if(_0x4891f9[_0x6b0c('0x56')]['id']){delete _0x4891f9[_0x6b0c('0x56')]['id'];}return db[_0x6b0c('0x33')][_0x6b0c('0x4d')]({'where':{'id':_0x4891f9[_0x6b0c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5c2735,null))[_0x6b0c('0x28')](function(_0x5a4a32){if(_0x5a4a32){_0x4891f9[_0x6b0c('0x56')][_0x6b0c('0x59')]=_0x5a4a32['id'];return db['Disposition'][_0x6b0c('0x4f')](_0x4891f9[_0x6b0c('0x56')]);}})[_0x6b0c('0x28')](respondWithResult(_0x5c2735,null))[_0x6b0c('0x4e')](handleError(_0x5c2735,null));};exports[_0x6b0c('0x5a')]=function(_0x30c243,_0xd97f96,_0x40491b){var _0x52d4a4={'raw':![],'where':{}};var _0x4a585a={};var _0x56fffc={'count':0x0,'rows':[]};return db[_0x6b0c('0x33')][_0x6b0c('0x5b')]({'where':{'id':_0x30c243[_0x6b0c('0x4b')]['id']}})[_0x6b0c('0x28')](handleEntityNotFound(_0xd97f96,null))['then'](function(_0x267187){if(_0x267187){_0x4a585a['model']=_[_0x6b0c('0x39')](db[_0x6b0c('0x5c')][_0x6b0c('0x34')]);_0x4a585a[_0x6b0c('0x38')]=_['keys'](_0x30c243['query']);_0x4a585a[_0x6b0c('0x3a')]=_[_0x6b0c('0x4c')](_0x4a585a[_0x6b0c('0x37')],_0x4a585a[_0x6b0c('0x38')]);_0x52d4a4[_0x6b0c('0x3b')]=_[_0x6b0c('0x4c')](_0x4a585a[_0x6b0c('0x37')],qs[_0x6b0c('0x3c')](_0x30c243[_0x6b0c('0x38')]['fields']));_0x52d4a4[_0x6b0c('0x3b')]=_0x52d4a4[_0x6b0c('0x3b')][_0x6b0c('0x3d')]?_0x52d4a4[_0x6b0c('0x3b')]:_0x4a585a[_0x6b0c('0x37')];if(!_0x30c243[_0x6b0c('0x38')][_0x6b0c('0x5d')](_0x6b0c('0x3e'))){_0x52d4a4['limit']=qs[_0x6b0c('0x3f')](_0x30c243[_0x6b0c('0x38')][_0x6b0c('0x3f')]);_0x52d4a4[_0x6b0c('0x1f')]=qs['offset'](_0x30c243[_0x6b0c('0x38')][_0x6b0c('0x1f')]);}_0x52d4a4['order']=qs['sort'](_0x30c243['query'][_0x6b0c('0x40')]);_0x52d4a4['where']=qs['filters'](_[_0x6b0c('0x42')](_0x30c243[_0x6b0c('0x38')],_0x4a585a['filters']));_0x52d4a4[_0x6b0c('0x41')][_0x6b0c('0x59')]=_0x267187['id'];if(_0x30c243['query'][_0x6b0c('0x43')]){_0x52d4a4[_0x6b0c('0x41')]=_['merge'](_0x52d4a4[_0x6b0c('0x41')],{'$or':_[_0x6b0c('0x32')](_0x52d4a4[_0x6b0c('0x3b')],function(_0x17a975){var _0x2444d2={};_0x2444d2[_0x17a975]={'$like':'%'+_0x30c243[_0x6b0c('0x38')]['filter']+'%'};return _0x2444d2;})});}_0x52d4a4=_['merge']({},_0x52d4a4,_0x30c243['options']);return db['Disposition'][_0x6b0c('0x21')]({'where':_0x52d4a4[_0x6b0c('0x41')]})['then'](function(_0x4e7997){_0x56fffc[_0x6b0c('0x21')]=_0x4e7997;if(_0x30c243['query'][_0x6b0c('0x47')]){_0x52d4a4[_0x6b0c('0x5e')]=[{'all':!![]}];}return db[_0x6b0c('0x5c')][_0x6b0c('0x48')](_0x52d4a4);})[_0x6b0c('0x28')](function(_0x13aa92){_0x56fffc['rows']=_0x13aa92;return _0x56fffc;});}})[_0x6b0c('0x28')](respondWithFilteredResult(_0xd97f96,_0x52d4a4))[_0x6b0c('0x4e')](handleError(_0xd97f96,null));};exports[_0x6b0c('0x5f')]=function(_0x50b08a,_0x59e063,_0x24b509){return db[_0x6b0c('0x33')][_0x6b0c('0x4d')]({'where':{'id':_0x50b08a[_0x6b0c('0x4b')]['id']}})[_0x6b0c('0x28')](handleEntityNotFound(_0x59e063,null))[_0x6b0c('0x28')](function(_0x39b342){if(_0x39b342){return _0x39b342[_0x6b0c('0x5f')](_0x50b08a[_0x6b0c('0x38')][_0x6b0c('0x60')]);}})[_0x6b0c('0x28')](respondWithStatusCode(_0x59e063,null))['catch'](handleError(_0x59e063,null));};exports['addContacts']=function(_0x4a9146,_0x1e4643,_0x401aba){return db[_0x6b0c('0x33')][_0x6b0c('0x4d')]({'where':{'id':_0x4a9146[_0x6b0c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e4643,null))['then'](function(_0x5032e9){if(_0x5032e9){var _0x19b301=[];var _0x348382={'success':[],'errors':[]};return db[_0x6b0c('0x61')]['describe']()[_0x6b0c('0x28')](function(_0x53b318){if(_0x4a9146[_0x6b0c('0x56')][_0x6b0c('0x62')]&&_['isArray'](_0x4a9146[_0x6b0c('0x56')][_0x6b0c('0x62')])){if(_0x4a9146[_0x6b0c('0x56')]['tags'][_0x6b0c('0x3d')]){_0x4a9146['body'][_0x6b0c('0x62')]=_0x4a9146[_0x6b0c('0x56')][_0x6b0c('0x62')]['join'](';')+';';}else{_0x4a9146['body'][_0x6b0c('0x62')]=null;}}else{_0x4a9146[_0x6b0c('0x56')]['tags']=null;}if(_0x4a9146['body']&&_[_0x6b0c('0x63')](_0x4a9146['body'])){for(var _0x4f3ef5=0x0;_0x4f3ef5<_0x4a9146[_0x6b0c('0x56')]['length'];_0x4f3ef5+=0x1){_0x4a9146['body'][_0x4f3ef5][_0x6b0c('0x59')]=_0x4a9146[_0x6b0c('0x4b')]['id'];_0x19b301[_0x6b0c('0x64')](_0x4a9146[_0x6b0c('0x56')][_0x4f3ef5]);}return BPromise[_0x6b0c('0x65')](_0x19b301,function(_0x218644){return db[_0x6b0c('0x61')]['create'](_['omit'](_0x218644,['ids','id'])||{},{'fields':_[_0x6b0c('0x39')](_0x53b318),'raw':!![]})[_0x6b0c('0x28')](function(_0x336c81){_0x348382[_0x6b0c('0x66')][_0x6b0c('0x64')](_0x336c81[_0x6b0c('0x67')]);})[_0x6b0c('0x4e')](function(_0x3d70ff){_0x348382[_0x6b0c('0x68')][_0x6b0c('0x64')]({'data':_0x218644,'error':_0x3d70ff[_0x6b0c('0x69')]});});})[_0x6b0c('0x28')](function(_0xfc9ed7){return _0x348382;})[_0x6b0c('0x4e')](function(_0x234eb9){return _0x234eb9;});}else{_0x1e4643['status'](0x190)['json']({'message':_0x6b0c('0x6a')});}});}})[_0x6b0c('0x28')](respondWithResult(_0x1e4643,null))[_0x6b0c('0x4e')](handleError(_0x1e4643,null));};exports[_0x6b0c('0x6b')]=function(_0x3a90ee,_0x28e9ff,_0x5cf1ec){var _0x1e409b;return db['CmList']['find']({'where':{'id':_0x3a90ee[_0x6b0c('0x4b')]['id']},'include':[{'model':db[_0x6b0c('0x6c')],'as':'CustomFields'}]})[_0x6b0c('0x28')](handleEntityNotFound(_0x28e9ff,null))[_0x6b0c('0x28')](function(_0xf1d4c6){if(_0xf1d4c6){_0x1e409b=_0xf1d4c6;return db[_0x6b0c('0x61')][_0x6b0c('0x34')];}})[_0x6b0c('0x28')](function(_0x28b926){if(_0x28b926){var _0x2f4910={};var _0x37f61e={};_0x37f61e['model']=_['concat'](_[_0x6b0c('0x39')](_0x28b926),_[_0x6b0c('0x32')](_0x1e409b[_0x6b0c('0x6d')],function(_0x557a94){return util[_0x6b0c('0x6e')](_0x6b0c('0x6f'),_0x557a94['id']);}));_0x37f61e[_0x6b0c('0x38')]=_[_0x6b0c('0x39')](_0x3a90ee[_0x6b0c('0x38')]);_0x37f61e[_0x6b0c('0x3a')]=_['intersection'](_0x37f61e[_0x6b0c('0x37')],_0x37f61e['query']);_0x2f4910[_0x6b0c('0x3b')]=_['intersection'](_0x37f61e[_0x6b0c('0x37')],qs['fields'](_0x3a90ee['query'][_0x6b0c('0x3c')]));_0x2f4910['attributes']=_0x2f4910[_0x6b0c('0x3b')]['length']?_0x2f4910[_0x6b0c('0x3b')]:_0x37f61e[_0x6b0c('0x37')];if(!_0x3a90ee[_0x6b0c('0x38')][_0x6b0c('0x5d')](_0x6b0c('0x3e'))){_0x2f4910[_0x6b0c('0x3f')]=qs['limit'](_0x3a90ee[_0x6b0c('0x38')][_0x6b0c('0x3f')]);_0x2f4910[_0x6b0c('0x1f')]=qs[_0x6b0c('0x1f')](_0x3a90ee['query']['offset']);}_0x2f4910[_0x6b0c('0x70')]=qs['sort'](_0x3a90ee['query'][_0x6b0c('0x40')]);_0x2f4910['where']=qs['filters'](_[_0x6b0c('0x42')](_0x3a90ee[_0x6b0c('0x38')],_0x37f61e[_0x6b0c('0x3a')]));_0x2f4910[_0x6b0c('0x71')]=!![];if(_0x3a90ee[_0x6b0c('0x38')]['filter']){_0x2f4910[_0x6b0c('0x41')]=_[_0x6b0c('0x44')](_0x2f4910[_0x6b0c('0x41')],{'$or':_[_0x6b0c('0x32')](_0x2f4910[_0x6b0c('0x3b')],function(_0x20ab97){var _0x31402c={};_0x31402c[_0x20ab97]={'$like':'%'+_0x3a90ee[_0x6b0c('0x38')][_0x6b0c('0x43')]+'%'};return _0x31402c;})});}_0x2f4910=_[_0x6b0c('0x44')]({},_0x2f4910,_0x3a90ee['options']);return _0x1e409b[_0x6b0c('0x6b')](_0x2f4910);}})[_0x6b0c('0x28')](respondWithResult(_0x28e9ff,null))[_0x6b0c('0x4e')](handleError(_0x28e9ff,null));};exports[_0x6b0c('0x72')]=function(_0xe82cf5,_0x11e718,_0x368360){var _0xe07e51;var _0x160624;var _0x375b3a;var _0x18fd22=_0xe82cf5[_0x6b0c('0x4b')]['id'];csv_results=[];return db[_0x6b0c('0x73')][_0x6b0c('0x48')]({'attributes':['id',_0x6b0c('0x2f')],'raw':!![],'order':[_0x6b0c('0x74')]})[_0x6b0c('0x28')](function(_0x264945){_0xe07e51=_0x264945;var _0x1ba5e6=_['keys'](db[_0x6b0c('0x61')][_0x6b0c('0x34')]);return db[_0x6b0c('0x6c')][_0x6b0c('0x48')]({'raw':!![],'attributes':['id',_0x6b0c('0x75')]})[_0x6b0c('0x28')](function(_0x411104){_0x160624=_0x411104;var _0x538106=squel[_0x6b0c('0x76')]()['fields'](_0x1ba5e6)[_0x6b0c('0x77')]('cm_contacts','c')['where'](_0x6b0c('0x78'),_0x18fd22)[_0x6b0c('0x41')]('c.deletedAt\x20is\x20null')[_0x6b0c('0x79')]();for(var _0x4fafba=0x0;_0x4fafba<_0x160624[_0x6b0c('0x3d')];_0x4fafba++){_0x538106['field'](_0x6b0c('0x7a')+_0x160624[_0x4fafba]['id'],'customField_'+_0x160624[_0x4fafba][_0x6b0c('0x75')]);}for(var _0x4fafba=0x0;_0x4fafba<_0xe07e51[_0x6b0c('0x3d')];_0x4fafba++){_0x538106[_0x6b0c('0x7b')](squel[_0x6b0c('0x76')]()['field'](_0x6b0c('0x7c'))['from']('cm_contact_has_items')[_0x6b0c('0x41')](_0x6b0c('0x7d'),_0xe07e51[_0x4fafba]['id'])[_0x6b0c('0x41')](_0x6b0c('0x7e')),_0x6b0c('0x7f')+_0xe07e51[_0x4fafba]['name']);_0x538106[_0x6b0c('0x7b')](squel[_0x6b0c('0x76')]()['field'](_0x6b0c('0x80'))[_0x6b0c('0x77')](_0x6b0c('0x81'))[_0x6b0c('0x41')](_0x6b0c('0x7d'),_0xe07e51[_0x4fafba]['id'])['where'](_0x6b0c('0x7e')),_0x6b0c('0x82')+_0xe07e51[_0x4fafba][_0x6b0c('0x2f')]);}var _0x4db344=[];_0x4db344[_0x6b0c('0x64')](_0x538106[_0x6b0c('0x83')]());BPromise[_0x6b0c('0x65')](_0x4db344,handleQuery)[_0x6b0c('0x28')](function(_0x5c75f1){handleQuery(_0x538106[_0x6b0c('0x83')]());var _0x2e1e2e=csv_results[0x0];if(!_[_0x6b0c('0x84')](_0x2e1e2e)){var _0x53ec0a=toCsv(_0x2e1e2e);var _0x5e3115=Date['now']();fs[_0x6b0c('0x85')](util[_0x6b0c('0x6e')]('/tmp/list_%d_%s.csv',_0x18fd22,_0x5e3115),_0x53ec0a);_0x11e718[_0x6b0c('0x86')](_0x6b0c('0x87'),_0x6b0c('0x88')+util[_0x6b0c('0x6e')](_0x6b0c('0x89'),_0x18fd22,_0x5e3115));_0x11e718['setHeader'](_0x6b0c('0x8a'),_0x6b0c('0x8b'));return _0x11e718[_0x6b0c('0x8c')](util['format'](_0x6b0c('0x8d'),_0x18fd22,_0x5e3115));}else{return _0x11e718[_0x6b0c('0x1c')](0xcc);}});});});};exports[_0x6b0c('0x8e')]=function(_0x363b97,_0x46635a,_0xdeca65){var _0x8c972f;delete _0x363b97[_0x6b0c('0x56')]['id'];return db['CmList'][_0x6b0c('0x5b')]({'where':{'id':_0x363b97['params']['id']}})[_0x6b0c('0x28')](handleEntityNotFound(_0x46635a,null))['then'](function(_0x1f9b89){if(_0x1f9b89){return db[_0x6b0c('0x8f')][_0x6b0c('0x90')](function(_0x1070cc){return db[_0x6b0c('0x6c')]['create'](_0x363b97['body'],{'transaction':_0x1070cc})[_0x6b0c('0x28')](function(_0x334cb1){_0x8c972f=_0x334cb1;return _0x1f9b89['addCustomFields'](_0x334cb1,{'transaction':_0x1070cc});})[_0x6b0c('0x28')](function(){var _0xeb3ee8={'type':db['Sequelize']['TEXT'],'transaction':_0x1070cc};switch(_0x363b97[_0x6b0c('0x56')][_0x6b0c('0x35')]){case'text':_0xeb3ee8[_0x6b0c('0x35')]=db[_0x6b0c('0x91')][_0x6b0c('0x92')];break;case'number':_0xeb3ee8[_0x6b0c('0x35')]=db[_0x6b0c('0x91')][_0x6b0c('0x93')];break;case _0x6b0c('0x94'):_0xeb3ee8[_0x6b0c('0x35')]=db[_0x6b0c('0x91')]['BOOLEAN'];_0xeb3ee8[_0x6b0c('0x95')]=![];break;default:}return db[_0x6b0c('0x8f')][_0x6b0c('0x96')][_0x6b0c('0x97')](_0x6b0c('0x98'),util[_0x6b0c('0x6e')]('cf_%s',_0x8c972f['id']),_0xeb3ee8);})[_0x6b0c('0x28')](function(){return _0x8c972f;});});}})[_0x6b0c('0x28')](respondWithResult(_0x46635a,null))['catch'](handleError(_0x46635a,null));};exports[_0x6b0c('0x99')]=function(_0x36f4b1,_0x44e5eb,_0xff52d9){var _0x34a24c={};var _0x19399e={};var _0x632ee5;var _0x30de7b;return db[_0x6b0c('0x33')][_0x6b0c('0x5b')]({'where':{'id':_0x36f4b1[_0x6b0c('0x4b')]['id']}})[_0x6b0c('0x28')](handleEntityNotFound(_0x44e5eb,null))[_0x6b0c('0x28')](function(_0x30e1c0){if(_0x30e1c0){_0x632ee5=_0x30e1c0;_0x19399e['model']=_[_0x6b0c('0x39')](db['CmCustomField'][_0x6b0c('0x34')]);_0x19399e[_0x6b0c('0x38')]=_['keys'](_0x36f4b1['query']);_0x19399e[_0x6b0c('0x3a')]=_[_0x6b0c('0x4c')](_0x19399e[_0x6b0c('0x37')],_0x19399e[_0x6b0c('0x38')]);_0x34a24c[_0x6b0c('0x3b')]=_[_0x6b0c('0x4c')](_0x19399e[_0x6b0c('0x37')],qs[_0x6b0c('0x3c')](_0x36f4b1[_0x6b0c('0x38')]['fields']));_0x34a24c['attributes']=_0x34a24c['attributes'][_0x6b0c('0x3d')]?_0x34a24c['attributes']:_0x19399e[_0x6b0c('0x37')];_0x34a24c[_0x6b0c('0x70')]=qs['sort'](_0x36f4b1[_0x6b0c('0x38')]['sort']);_0x34a24c[_0x6b0c('0x41')]=qs[_0x6b0c('0x3a')](_[_0x6b0c('0x42')](_0x36f4b1[_0x6b0c('0x38')],_0x19399e[_0x6b0c('0x3a')]));_0x34a24c['where']=_[_0x6b0c('0x44')](_0x34a24c[_0x6b0c('0x41')],{'$or':[{'ListId':_0x30e1c0['id']},{'ListId':null}]});if(_0x36f4b1[_0x6b0c('0x38')][_0x6b0c('0x43')]){_0x34a24c[_0x6b0c('0x41')]=_[_0x6b0c('0x44')](_0x34a24c[_0x6b0c('0x41')],{'$or':_[_0x6b0c('0x32')](_0x34a24c[_0x6b0c('0x3b')],function(_0x500f98){var _0x57c6c1={};_0x57c6c1[_0x500f98]={'$like':'%'+_0x36f4b1[_0x6b0c('0x38')][_0x6b0c('0x43')]+'%'};return _0x57c6c1;})});}_0x34a24c=_[_0x6b0c('0x44')]({},_0x34a24c,_0x36f4b1[_0x6b0c('0x46')]);return db[_0x6b0c('0x6c')][_0x6b0c('0x9a')](_0x34a24c);}})['then'](respondWithResult(_0x44e5eb,null))[_0x6b0c('0x4e')](handleError(_0x44e5eb,null));};exports[_0x6b0c('0x9b')]=function(_0x3c7831,_0x1b19b2){return db[_0x6b0c('0x6c')][_0x6b0c('0x9a')]({'where':{'ListId':null}})[_0x6b0c('0x28')](handleEntityNotFound(_0x1b19b2,null))[_0x6b0c('0x28')](function(_0x3349f8){return _0x3349f8;})['then'](respondWithResult(_0x1b19b2,null))[_0x6b0c('0x4e')](handleError(_0x1b19b2,null));};exports[_0x6b0c('0x9c')]=function(_0x179cc7,_0x576c5d,_0x2f629b){return db[_0x6b0c('0x33')][_0x6b0c('0x4d')]({'where':{'id':_0x179cc7[_0x6b0c('0x4b')]['id']}})[_0x6b0c('0x28')](handleEntityNotFound(_0x576c5d,null))['then'](function(_0x27a61d){if(_0x27a61d){return _0x27a61d[_0x6b0c('0x9c')](_0x179cc7[_0x6b0c('0x56')][_0x6b0c('0x60')],_[_0x6b0c('0x9d')](_0x179cc7['body'],[_0x6b0c('0x60'),'id'])||{})[_0x6b0c('0x9e')](function(_0x2d3424){for(var _0x5ea758=0x0;_0x5ea758<_0x179cc7[_0x6b0c('0x56')][_0x6b0c('0x60')][_0x6b0c('0x3d')];_0x5ea758+=0x1){socket['emit'](_0x6b0c('0x9f'),{'UserId':Number(_0x179cc7[_0x6b0c('0x56')][_0x6b0c('0x60')][_0x5ea758]),'CmListId':Number(_0x179cc7[_0x6b0c('0x4b')]['id'])});}return _0x2d3424;});}})[_0x6b0c('0x28')](respondWithResult(_0x576c5d,null))[_0x6b0c('0x4e')](handleError(_0x576c5d,null));};exports[_0x6b0c('0xa0')]=function(_0x26b3e5,_0x2bb613,_0xd3dea){return db[_0x6b0c('0x33')][_0x6b0c('0x4d')]({'where':{'id':_0x26b3e5[_0x6b0c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2bb613,null))[_0x6b0c('0x28')](function(_0x16475e){if(_0x16475e){return _0x16475e[_0x6b0c('0xa0')](_0x26b3e5['query'][_0x6b0c('0x60')])[_0x6b0c('0x28')](function(){if(_[_0x6b0c('0x63')](_0x26b3e5['query']['ids'])){for(var _0x62bc08=0x0;_0x62bc08<_0x26b3e5[_0x6b0c('0x38')]['ids'][_0x6b0c('0x3d')];_0x62bc08+=0x1){socket[_0x6b0c('0xa1')](_0x6b0c('0xa2'),{'UserId':Number(_0x26b3e5['query'][_0x6b0c('0x60')][_0x62bc08]),'CmListId':Number(_0x26b3e5['params']['id'])});}}else{socket['emit'](_0x6b0c('0xa2'),{'UserId':Number(_0x26b3e5['query'][_0x6b0c('0x60')]),'CmListId':Number(_0x26b3e5['params']['id'])});}});}})[_0x6b0c('0x28')](respondWithStatusCode(_0x2bb613,null))[_0x6b0c('0x4e')](handleError(_0x2bb613,null));};exports[_0x6b0c('0xa3')]=function(_0x16d0d2,_0x2fb5c7,_0x5a1db0){var _0x12ca38={};var _0x259cc2={};var _0x5c77ce;var _0x1780a1;return db[_0x6b0c('0x33')][_0x6b0c('0x5b')]({'where':{'id':_0x16d0d2['params']['id']}})[_0x6b0c('0x28')](handleEntityNotFound(_0x2fb5c7,null))[_0x6b0c('0x28')](function(_0x4be4b8){if(_0x4be4b8){_0x5c77ce=_0x4be4b8;_0x259cc2['model']=_[_0x6b0c('0x39')](db['User']['rawAttributes']);_0x259cc2[_0x6b0c('0x38')]=_['keys'](_0x16d0d2['query']);_0x259cc2[_0x6b0c('0x3a')]=_[_0x6b0c('0x4c')](_0x259cc2['model'],_0x259cc2[_0x6b0c('0x38')]);_0x12ca38[_0x6b0c('0x3b')]=_[_0x6b0c('0x4c')](_0x259cc2[_0x6b0c('0x37')],qs['fields'](_0x16d0d2['query'][_0x6b0c('0x3c')]));_0x12ca38[_0x6b0c('0x3b')]=_0x12ca38[_0x6b0c('0x3b')]['length']?_0x12ca38['attributes']:_0x259cc2[_0x6b0c('0x37')];_0x12ca38[_0x6b0c('0x70')]=qs[_0x6b0c('0x40')](_0x16d0d2['query']['sort']);_0x12ca38[_0x6b0c('0x41')]=qs[_0x6b0c('0x3a')](_[_0x6b0c('0x42')](_0x16d0d2['query'],_0x259cc2[_0x6b0c('0x3a')]));if(_0x16d0d2['query'][_0x6b0c('0x43')]){_0x12ca38[_0x6b0c('0x41')]=_[_0x6b0c('0x44')](_0x12ca38[_0x6b0c('0x41')],{'$or':_[_0x6b0c('0x32')](_0x12ca38[_0x6b0c('0x3b')],function(_0x1bca7c){var _0x276631={};_0x276631[_0x1bca7c]={'$like':'%'+_0x16d0d2[_0x6b0c('0x38')][_0x6b0c('0x43')]+'%'};return _0x276631;})});}_0x12ca38=_[_0x6b0c('0x44')]({},_0x12ca38,_0x16d0d2[_0x6b0c('0x46')]);return _0x5c77ce[_0x6b0c('0xa3')](_0x12ca38);}})[_0x6b0c('0x28')](function(_0xc6d56){if(_0xc6d56){_0x1780a1=_0xc6d56[_0x6b0c('0x3d')];if(!_0x16d0d2[_0x6b0c('0x38')][_0x6b0c('0x5d')](_0x6b0c('0x3e'))){_0x12ca38[_0x6b0c('0x3f')]=qs[_0x6b0c('0x3f')](_0x16d0d2[_0x6b0c('0x38')][_0x6b0c('0x3f')]);_0x12ca38[_0x6b0c('0x1f')]=qs[_0x6b0c('0x1f')](_0x16d0d2[_0x6b0c('0x38')]['offset']);}return _0x5c77ce[_0x6b0c('0xa3')](_0x12ca38);}})[_0x6b0c('0x28')](function(_0x2fe2ce){if(_0x2fe2ce){return _0x2fe2ce?{'count':_0x1780a1,'rows':_0x2fe2ce}:null;}})[_0x6b0c('0x28')](respondWithResult(_0x2fb5c7,null))[_0x6b0c('0x4e')](handleError(_0x2fb5c7,null));};function handleQuery(_0x6971db){logger[_0x6b0c('0xa4')](_0x6971db);return db[_0x6b0c('0x8f')]['query'](_0x6971db)[_0x6b0c('0x9e')](function(_0x257977){csv_results['push'](_0x257977);})[_0x6b0c('0x4e')](function(_0xd517b9){logger[_0x6b0c('0x2d')](_0xd517b9[_0x6b0c('0x69')]);});} \ No newline at end of file +var _0xe137=['OrderBy','select','cm_contacts','c.deletedAt\x20is\x20null','field','c.cf_','customField_','alias','item','from','cm_contact_has_items','additionalPhone_','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','findOne','User','info','error','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','get','Lists','UserProfileResource','then','sendStatus','stack','name','send','index','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','success','dataValues','errors','message','CmCustomField','CustomFields','concat','format','cf_%d','getContacts','ContactItemType'];(function(_0x1a5817,_0x33e608){var _0x3874fc=function(_0x4d0e2b){while(--_0x4d0e2b){_0x1a5817['push'](_0x1a5817['shift']());}};_0x3874fc(++_0x33e608);}(_0xe137,0x176));var _0x7e13=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0xe137[_0x2ce6d5];return _0x32d272;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7e13('0x0'));var jsonpatch=require(_0x7e13('0x1'));var rp=require(_0x7e13('0x2'));var moment=require(_0x7e13('0x3'));var BPromise=require(_0x7e13('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7e13('0x5'));var sox=require('sox');var csv=require(_0x7e13('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e13('0x7'));var _=require('lodash');var squel=require(_0x7e13('0x8'));var crypto=require(_0x7e13('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7e13('0xa'));var Redis=require('ioredis');var authService=require(_0x7e13('0xb'));var qs=require(_0x7e13('0xc'));var as=require(_0x7e13('0xd'));var hardwareService=require(_0x7e13('0xe'));var logger=require(_0x7e13('0xf'))(_0x7e13('0x10'));var utils=require(_0x7e13('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x7e13('0x12'));var db=require(_0x7e13('0x13'))['db'];var csv_results;config['redis']=_['defaults'](config[_0x7e13('0x14')],{'host':_0x7e13('0x15'),'port':0x18eb});var socket=require(_0x7e13('0x16'))(new Redis(config[_0x7e13('0x14')]));require(_0x7e13('0x17'))['register'](socket);function respondWithStatusCode(_0x78542e,_0x433b90){_0x433b90=_0x433b90||0xcc;return function(_0x5ce144){if(_0x5ce144){return _0x78542e['sendStatus'](_0x433b90);}return _0x78542e[_0x7e13('0x18')](_0x433b90)[_0x7e13('0x19')]();};}function respondWithResult(_0x355e58,_0x15dc83){_0x15dc83=_0x15dc83||0xc8;return function(_0x8a9ee6){if(_0x8a9ee6){return _0x355e58[_0x7e13('0x18')](_0x15dc83)[_0x7e13('0x1a')](_0x8a9ee6);}};}function respondWithFilteredResult(_0x241cbc,_0x42a00f){return function(_0x27ec4c){if(_0x27ec4c){var _0xdfa7c2=typeof _0x42a00f[_0x7e13('0x1b')]===_0x7e13('0x1c')&&typeof _0x42a00f[_0x7e13('0x1d')]===_0x7e13('0x1c');var _0x53dd5f=_0x27ec4c[_0x7e13('0x1e')];var _0xd31fcf=_0xdfa7c2?0x0:_0x42a00f['offset'];var _0x539cf6=_0xdfa7c2?_0x27ec4c[_0x7e13('0x1e')]:_0x42a00f[_0x7e13('0x1b')]+_0x42a00f['limit'];var _0x105289;if(_0x539cf6>=_0x53dd5f){_0x539cf6=_0x53dd5f;_0x105289=0xc8;}else{_0x105289=0xce;}_0x241cbc[_0x7e13('0x18')](_0x105289);return _0x241cbc[_0x7e13('0x1f')](_0x7e13('0x20'),_0xd31fcf+'-'+_0x539cf6+'/'+_0x53dd5f)[_0x7e13('0x1a')](_0x27ec4c);}return null;};}function patchUpdates(_0x20492a){return function(_0x56eae1){try{jsonpatch['apply'](_0x56eae1,_0x20492a,!![]);}catch(_0x16466d){return BPromise['reject'](_0x16466d);}return _0x56eae1[_0x7e13('0x21')]();};}function saveUpdates(_0x3cc6f9,_0x2b1d17){return function(_0x3d6156){if(_0x3d6156){return _0x3d6156[_0x7e13('0x22')](_0x3cc6f9)['then'](function(_0x856cbe){return _0x856cbe;});}return null;};}function removeEntity(_0x59f8d1,_0x28e8b7){return function(_0x17415e){if(_0x17415e){return _0x17415e[_0x7e13('0x23')]()['then'](function(){var _0x101923=_0x17415e[_0x7e13('0x24')]({'plain':!![]});var _0x51943e=_0x7e13('0x25');return db[_0x7e13('0x26')][_0x7e13('0x23')]({'where':{'type':_0x51943e,'resourceId':_0x101923['id']}})[_0x7e13('0x27')](function(){return _0x17415e;});})[_0x7e13('0x27')](function(){_0x59f8d1['status'](0xcc)[_0x7e13('0x19')]();});}};}function handleEntityNotFound(_0x44c174,_0x40bb03){return function(_0x4bf6f3){if(!_0x4bf6f3){_0x44c174[_0x7e13('0x28')](0x194);}return _0x4bf6f3;};}function handleError(_0x51cf32,_0x5cd3e3){_0x5cd3e3=_0x5cd3e3||0x1f4;return function(_0x212fdb){logger['error'](_0x212fdb[_0x7e13('0x29')]);if(_0x212fdb['name']){delete _0x212fdb[_0x7e13('0x2a')];}_0x51cf32[_0x7e13('0x18')](_0x5cd3e3)[_0x7e13('0x2b')](_0x212fdb);};}exports[_0x7e13('0x2c')]=function(_0x5b6231,_0xf43c91){var _0x15556f={},_0x33af78={},_0x174849={'count':0x0,'rows':[]};var _0x3b16fd=_[_0x7e13('0x2d')](db[_0x7e13('0x2e')]['rawAttributes'],function(_0x3a9744){return{'name':_0x3a9744[_0x7e13('0x2f')],'type':_0x3a9744[_0x7e13('0x30')][_0x7e13('0x31')]};});_0x33af78[_0x7e13('0x32')]=_['map'](_0x3b16fd,_0x7e13('0x2a'));_0x33af78[_0x7e13('0x33')]=_[_0x7e13('0x34')](_0x5b6231[_0x7e13('0x33')]);_0x33af78[_0x7e13('0x35')]=_[_0x7e13('0x36')](_0x33af78[_0x7e13('0x32')],_0x33af78[_0x7e13('0x33')]);_0x15556f['attributes']=_['intersection'](_0x33af78[_0x7e13('0x32')],qs['fields'](_0x5b6231[_0x7e13('0x33')][_0x7e13('0x37')]));_0x15556f[_0x7e13('0x38')]=_0x15556f[_0x7e13('0x38')][_0x7e13('0x39')]?_0x15556f['attributes']:_0x33af78[_0x7e13('0x32')];if(!_0x5b6231[_0x7e13('0x33')][_0x7e13('0x3a')](_0x7e13('0x3b'))){_0x15556f[_0x7e13('0x1d')]=qs[_0x7e13('0x1d')](_0x5b6231[_0x7e13('0x33')][_0x7e13('0x1d')]);_0x15556f[_0x7e13('0x1b')]=qs[_0x7e13('0x1b')](_0x5b6231[_0x7e13('0x33')][_0x7e13('0x1b')]);}_0x15556f[_0x7e13('0x3c')]=qs[_0x7e13('0x3d')](_0x5b6231[_0x7e13('0x33')][_0x7e13('0x3d')]);_0x15556f[_0x7e13('0x3e')]=qs['filters'](_[_0x7e13('0x3f')](_0x5b6231[_0x7e13('0x33')],_0x33af78[_0x7e13('0x35')]),_0x3b16fd);if(_0x5b6231[_0x7e13('0x33')][_0x7e13('0x40')]){_0x15556f[_0x7e13('0x3e')]=_[_0x7e13('0x41')](_0x15556f[_0x7e13('0x3e')],{'$or':_[_0x7e13('0x2d')](_0x3b16fd,function(_0xe2a299){if(_0xe2a299[_0x7e13('0x30')]!==_0x7e13('0x42')){var _0x47096b={};_0x47096b[_0xe2a299['name']]={'$like':'%'+_0x5b6231[_0x7e13('0x33')][_0x7e13('0x40')]+'%'};return _0x47096b;}})});}_0x15556f=_[_0x7e13('0x41')]({},_0x15556f,_0x5b6231[_0x7e13('0x43')]);var _0x588eef={'where':_0x15556f[_0x7e13('0x3e')]};return db[_0x7e13('0x2e')][_0x7e13('0x1e')](_0x588eef)[_0x7e13('0x27')](function(_0x402e57){_0x174849['count']=_0x402e57;if(_0x5b6231[_0x7e13('0x33')][_0x7e13('0x44')]){_0x15556f['include']=[{'all':!![]}];}return db[_0x7e13('0x2e')][_0x7e13('0x45')](_0x15556f);})[_0x7e13('0x27')](function(_0x153f4a){_0x174849[_0x7e13('0x46')]=_0x153f4a;return _0x174849;})[_0x7e13('0x27')](respondWithFilteredResult(_0xf43c91,_0x15556f))[_0x7e13('0x47')](handleError(_0xf43c91,null));};exports[_0x7e13('0x48')]=function(_0x3f16cc,_0x5b5d0f){var _0x25b34d={'raw':![],'where':{'id':_0x3f16cc[_0x7e13('0x49')]['id']}},_0xa5b6b6={};_0xa5b6b6[_0x7e13('0x32')]=_[_0x7e13('0x34')](db[_0x7e13('0x2e')][_0x7e13('0x4a')]);_0xa5b6b6[_0x7e13('0x33')]=_[_0x7e13('0x34')](_0x3f16cc[_0x7e13('0x33')]);_0xa5b6b6[_0x7e13('0x35')]=_['intersection'](_0xa5b6b6[_0x7e13('0x32')],_0xa5b6b6[_0x7e13('0x33')]);_0x25b34d[_0x7e13('0x38')]=_['intersection'](_0xa5b6b6[_0x7e13('0x32')],qs[_0x7e13('0x37')](_0x3f16cc[_0x7e13('0x33')]['fields']));_0x25b34d[_0x7e13('0x38')]=_0x25b34d['attributes'][_0x7e13('0x39')]?_0x25b34d[_0x7e13('0x38')]:_0xa5b6b6[_0x7e13('0x32')];if(_0x3f16cc[_0x7e13('0x33')][_0x7e13('0x44')]){_0x25b34d[_0x7e13('0x4b')]=[{'all':!![]}];}_0x25b34d=_[_0x7e13('0x41')]({},_0x25b34d,_0x3f16cc[_0x7e13('0x43')]);return db[_0x7e13('0x2e')]['find'](_0x25b34d)[_0x7e13('0x27')](handleEntityNotFound(_0x5b5d0f,null))[_0x7e13('0x27')](respondWithResult(_0x5b5d0f,null))[_0x7e13('0x47')](handleError(_0x5b5d0f,null));};exports[_0x7e13('0x4c')]=function(_0x216053,_0x12bb7b){return db[_0x7e13('0x2e')][_0x7e13('0x4c')](_0x216053['body'],{})[_0x7e13('0x27')](function(_0xd998bd){var _0x869e18=_0x216053[_0x7e13('0x4d')][_0x7e13('0x24')]({'plain':!![]});if(!_0x869e18)throw new Error(_0x7e13('0x4e'));if(_0x869e18[_0x7e13('0x4f')]===_0x7e13('0x4d')){var _0x5297b7=_0xd998bd[_0x7e13('0x24')]({'plain':!![]});var _0xb29f87='Lists';return db[_0x7e13('0x50')][_0x7e13('0x51')]({'where':{'name':_0xb29f87,'userProfileId':_0x869e18[_0x7e13('0x52')]},'raw':!![]})['then'](function(_0x125aba){if(_0x125aba&&_0x125aba['autoAssociation']===0x0){return db[_0x7e13('0x26')][_0x7e13('0x4c')]({'name':_0x5297b7['name'],'resourceId':_0x5297b7['id'],'type':_0x125aba[_0x7e13('0x2a')],'sectionId':_0x125aba['id']},{})['then'](function(){return _0xd998bd;});}else{return _0xd998bd;}})[_0x7e13('0x47')](function(_0x332e3c){logger['error'](_0x7e13('0x53'),_0x332e3c);throw _0x332e3c;});}return _0xd998bd;})['then'](respondWithResult(_0x12bb7b,0xc9))[_0x7e13('0x47')](handleError(_0x12bb7b,null));};exports[_0x7e13('0x22')]=function(_0x1a9fb7,_0x57742a){if(_0x1a9fb7[_0x7e13('0x54')]['id']){delete _0x1a9fb7[_0x7e13('0x54')]['id'];}return db[_0x7e13('0x2e')]['find']({'where':{'id':_0x1a9fb7[_0x7e13('0x49')]['id']}})[_0x7e13('0x27')](handleEntityNotFound(_0x57742a,null))[_0x7e13('0x27')](saveUpdates(_0x1a9fb7[_0x7e13('0x54')],null))[_0x7e13('0x27')](respondWithResult(_0x57742a,null))[_0x7e13('0x47')](handleError(_0x57742a,null));};exports[_0x7e13('0x23')]=function(_0x30afe2,_0x2b6421){return db[_0x7e13('0x2e')]['find']({'where':{'id':_0x30afe2[_0x7e13('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b6421,null))[_0x7e13('0x27')](removeEntity(_0x2b6421,null))[_0x7e13('0x47')](handleError(_0x2b6421,null));};exports[_0x7e13('0x55')]=function(_0x293532,_0x36ca6e){return db[_0x7e13('0x2e')][_0x7e13('0x55')]()[_0x7e13('0x27')](respondWithResult(_0x36ca6e,null))[_0x7e13('0x47')](handleError(_0x36ca6e,null));};exports[_0x7e13('0x56')]=function(_0x4ffa0a,_0x80d2d4,_0x4891b5){if(_0x4ffa0a[_0x7e13('0x54')]['id']){delete _0x4ffa0a['body']['id'];}return db['CmList']['find']({'where':{'id':_0x4ffa0a[_0x7e13('0x49')]['id']}})['then'](handleEntityNotFound(_0x80d2d4,null))['then'](function(_0x71cac1){if(_0x71cac1){_0x4ffa0a[_0x7e13('0x54')]['ListId']=_0x71cac1['id'];return db[_0x7e13('0x57')]['create'](_0x4ffa0a[_0x7e13('0x54')]);}})['then'](respondWithResult(_0x80d2d4,null))[_0x7e13('0x47')](handleError(_0x80d2d4,null));};exports['getDispositions']=function(_0xbd82b6,_0x591ba3,_0x5e9693){var _0x2b011e={'raw':![],'where':{}};var _0x370a1e={};var _0x2ef10f={'count':0x0,'rows':[]};return db[_0x7e13('0x2e')]['findOne']({'where':{'id':_0xbd82b6['params']['id']}})['then'](handleEntityNotFound(_0x591ba3,null))[_0x7e13('0x27')](function(_0x36663f){if(_0x36663f){_0x370a1e['model']=_[_0x7e13('0x34')](db['Disposition'][_0x7e13('0x4a')]);_0x370a1e[_0x7e13('0x33')]=_[_0x7e13('0x34')](_0xbd82b6[_0x7e13('0x33')]);_0x370a1e[_0x7e13('0x35')]=_[_0x7e13('0x36')](_0x370a1e[_0x7e13('0x32')],_0x370a1e[_0x7e13('0x33')]);_0x2b011e[_0x7e13('0x38')]=_[_0x7e13('0x36')](_0x370a1e['model'],qs[_0x7e13('0x37')](_0xbd82b6[_0x7e13('0x33')][_0x7e13('0x37')]));_0x2b011e[_0x7e13('0x38')]=_0x2b011e[_0x7e13('0x38')][_0x7e13('0x39')]?_0x2b011e[_0x7e13('0x38')]:_0x370a1e[_0x7e13('0x32')];if(!_0xbd82b6[_0x7e13('0x33')][_0x7e13('0x3a')](_0x7e13('0x3b'))){_0x2b011e[_0x7e13('0x1d')]=qs[_0x7e13('0x1d')](_0xbd82b6[_0x7e13('0x33')][_0x7e13('0x1d')]);_0x2b011e[_0x7e13('0x1b')]=qs[_0x7e13('0x1b')](_0xbd82b6[_0x7e13('0x33')]['offset']);}_0x2b011e[_0x7e13('0x3c')]=qs['sort'](_0xbd82b6[_0x7e13('0x33')][_0x7e13('0x3d')]);_0x2b011e[_0x7e13('0x3e')]=qs[_0x7e13('0x35')](_[_0x7e13('0x3f')](_0xbd82b6[_0x7e13('0x33')],_0x370a1e[_0x7e13('0x35')]));_0x2b011e[_0x7e13('0x3e')][_0x7e13('0x58')]=_0x36663f['id'];if(_0xbd82b6['query'][_0x7e13('0x40')]){_0x2b011e['where']=_[_0x7e13('0x41')](_0x2b011e[_0x7e13('0x3e')],{'$or':_[_0x7e13('0x2d')](_0x2b011e[_0x7e13('0x38')],function(_0x28856d){var _0x49ae1a={};_0x49ae1a[_0x28856d]={'$like':'%'+_0xbd82b6['query'][_0x7e13('0x40')]+'%'};return _0x49ae1a;})});}_0x2b011e=_[_0x7e13('0x41')]({},_0x2b011e,_0xbd82b6['options']);return db['Disposition'][_0x7e13('0x1e')]({'where':_0x2b011e[_0x7e13('0x3e')]})['then'](function(_0x3ee939){_0x2ef10f[_0x7e13('0x1e')]=_0x3ee939;if(_0xbd82b6[_0x7e13('0x33')]['includeAll']){_0x2b011e[_0x7e13('0x4b')]=[{'all':!![]}];}return db[_0x7e13('0x57')]['findAll'](_0x2b011e);})[_0x7e13('0x27')](function(_0x45569e){_0x2ef10f['rows']=_0x45569e;return _0x2ef10f;});}})['then'](respondWithFilteredResult(_0x591ba3,_0x2b011e))[_0x7e13('0x47')](handleError(_0x591ba3,null));};exports['removeDispositions']=function(_0x147a71,_0x4bee01,_0x5ca2a5){return db[_0x7e13('0x2e')][_0x7e13('0x51')]({'where':{'id':_0x147a71['params']['id']}})['then'](handleEntityNotFound(_0x4bee01,null))['then'](function(_0x7b627c){if(_0x7b627c){return _0x7b627c[_0x7e13('0x59')](_0x147a71[_0x7e13('0x33')][_0x7e13('0x5a')]);}})[_0x7e13('0x27')](respondWithStatusCode(_0x4bee01,null))['catch'](handleError(_0x4bee01,null));};exports[_0x7e13('0x5b')]=function(_0x11a6a2,_0x3515f2,_0x248452){return db[_0x7e13('0x2e')]['find']({'where':{'id':_0x11a6a2['params']['id']}})[_0x7e13('0x27')](handleEntityNotFound(_0x3515f2,null))['then'](function(_0x494e9e){if(_0x494e9e){var _0x1e0d11=[];var _0x192de7={'success':[],'errors':[]};return db[_0x7e13('0x5c')]['describe']()['then'](function(_0x10b670){if(_0x11a6a2[_0x7e13('0x54')][_0x7e13('0x5d')]&&_[_0x7e13('0x5e')](_0x11a6a2['body'][_0x7e13('0x5d')])){if(_0x11a6a2[_0x7e13('0x54')]['tags'][_0x7e13('0x39')]){_0x11a6a2[_0x7e13('0x54')][_0x7e13('0x5d')]=_0x11a6a2[_0x7e13('0x54')]['tags'][_0x7e13('0x5f')](';')+';';}else{_0x11a6a2[_0x7e13('0x54')][_0x7e13('0x5d')]=null;}}else{_0x11a6a2[_0x7e13('0x54')][_0x7e13('0x5d')]=null;}if(_0x11a6a2['body']&&_[_0x7e13('0x5e')](_0x11a6a2[_0x7e13('0x54')])){for(var _0x1661a7=0x0;_0x1661a7<_0x11a6a2[_0x7e13('0x54')]['length'];_0x1661a7+=0x1){_0x11a6a2['body'][_0x1661a7]['ListId']=_0x11a6a2['params']['id'];_0x1e0d11[_0x7e13('0x60')](_0x11a6a2[_0x7e13('0x54')][_0x1661a7]);}return BPromise[_0x7e13('0x61')](_0x1e0d11,function(_0x1d90d9){return db[_0x7e13('0x5c')][_0x7e13('0x4c')](_['omit'](_0x1d90d9,[_0x7e13('0x5a'),'id'])||{},{'fields':_[_0x7e13('0x34')](_0x10b670),'raw':!![]})[_0x7e13('0x27')](function(_0x54abf5){_0x192de7[_0x7e13('0x62')][_0x7e13('0x60')](_0x54abf5[_0x7e13('0x63')]);})[_0x7e13('0x47')](function(_0x40adbf){_0x192de7[_0x7e13('0x64')][_0x7e13('0x60')]({'data':_0x1d90d9,'error':_0x40adbf[_0x7e13('0x65')]});});})[_0x7e13('0x27')](function(_0x1b79c7){return _0x192de7;})[_0x7e13('0x47')](function(_0x19bfba){return _0x19bfba;});}else{_0x3515f2[_0x7e13('0x18')](0x190)[_0x7e13('0x1a')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x7e13('0x27')](respondWithResult(_0x3515f2,null))['catch'](handleError(_0x3515f2,null));};exports['getContacts']=function(_0x273d73,_0x957740,_0x2acb5a){var _0x9f53d7;return db[_0x7e13('0x2e')][_0x7e13('0x51')]({'where':{'id':_0x273d73[_0x7e13('0x49')]['id']},'include':[{'model':db[_0x7e13('0x66')],'as':_0x7e13('0x67')}]})['then'](handleEntityNotFound(_0x957740,null))[_0x7e13('0x27')](function(_0x3c0b30){if(_0x3c0b30){_0x9f53d7=_0x3c0b30;return db[_0x7e13('0x5c')][_0x7e13('0x4a')];}})[_0x7e13('0x27')](function(_0x36bc11){if(_0x36bc11){var _0x40e870={};var _0x412001={};_0x412001[_0x7e13('0x32')]=_[_0x7e13('0x68')](_[_0x7e13('0x34')](_0x36bc11),_[_0x7e13('0x2d')](_0x9f53d7[_0x7e13('0x67')],function(_0x58619a){return util[_0x7e13('0x69')](_0x7e13('0x6a'),_0x58619a['id']);}));_0x412001[_0x7e13('0x33')]=_['keys'](_0x273d73[_0x7e13('0x33')]);_0x412001[_0x7e13('0x35')]=_[_0x7e13('0x36')](_0x412001[_0x7e13('0x32')],_0x412001[_0x7e13('0x33')]);_0x40e870['attributes']=_[_0x7e13('0x36')](_0x412001[_0x7e13('0x32')],qs[_0x7e13('0x37')](_0x273d73[_0x7e13('0x33')][_0x7e13('0x37')]));_0x40e870[_0x7e13('0x38')]=_0x40e870[_0x7e13('0x38')][_0x7e13('0x39')]?_0x40e870['attributes']:_0x412001[_0x7e13('0x32')];if(!_0x273d73[_0x7e13('0x33')][_0x7e13('0x3a')]('nolimit')){_0x40e870[_0x7e13('0x1d')]=qs[_0x7e13('0x1d')](_0x273d73[_0x7e13('0x33')][_0x7e13('0x1d')]);_0x40e870[_0x7e13('0x1b')]=qs['offset'](_0x273d73[_0x7e13('0x33')][_0x7e13('0x1b')]);}_0x40e870[_0x7e13('0x3c')]=qs[_0x7e13('0x3d')](_0x273d73[_0x7e13('0x33')]['sort']);_0x40e870[_0x7e13('0x3e')]=qs[_0x7e13('0x35')](_['pick'](_0x273d73['query'],_0x412001['filters']));_0x40e870['raw']=!![];if(_0x273d73[_0x7e13('0x33')][_0x7e13('0x40')]){_0x40e870[_0x7e13('0x3e')]=_[_0x7e13('0x41')](_0x40e870[_0x7e13('0x3e')],{'$or':_[_0x7e13('0x2d')](_0x40e870['attributes'],function(_0x27370c){var _0x46bf8b={};_0x46bf8b[_0x27370c]={'$like':'%'+_0x273d73[_0x7e13('0x33')][_0x7e13('0x40')]+'%'};return _0x46bf8b;})});}_0x40e870=_[_0x7e13('0x41')]({},_0x40e870,_0x273d73[_0x7e13('0x43')]);return _0x9f53d7[_0x7e13('0x6b')](_0x40e870);}})[_0x7e13('0x27')](respondWithResult(_0x957740,null))['catch'](handleError(_0x957740,null));};exports['getContactsCsv']=function(_0x4df2bd,_0x210da7,_0x26d915){var _0x6b75c7;var _0x3de534;var _0x27843f;var _0x2a1b7e=_0x4df2bd[_0x7e13('0x49')]['id'];csv_results=[];return db[_0x7e13('0x6c')]['findAll']({'attributes':['id',_0x7e13('0x2a')],'raw':!![],'order':[_0x7e13('0x6d')]})['then'](function(_0x831451){_0x6b75c7=_0x831451;var _0x3e5848=_[_0x7e13('0x34')](db['CmContact'][_0x7e13('0x4a')]);return db[_0x7e13('0x66')][_0x7e13('0x45')]({'raw':!![],'attributes':['id','alias']})[_0x7e13('0x27')](function(_0x86d7ab){_0x3de534=_0x86d7ab;var _0x152b08=squel[_0x7e13('0x6e')]()[_0x7e13('0x37')](_0x3e5848)['from'](_0x7e13('0x6f'),'c')['where']('c.ListId\x20=\x20?',_0x2a1b7e)[_0x7e13('0x3e')](_0x7e13('0x70'))['distinct']();for(var _0x3ac14b=0x0;_0x3ac14b<_0x3de534[_0x7e13('0x39')];_0x3ac14b++){_0x152b08[_0x7e13('0x71')](_0x7e13('0x72')+_0x3de534[_0x3ac14b]['id'],_0x7e13('0x73')+_0x3de534[_0x3ac14b][_0x7e13('0x74')]);}for(var _0x3ac14b=0x0;_0x3ac14b<_0x6b75c7[_0x7e13('0x39')];_0x3ac14b++){_0x152b08['field'](squel[_0x7e13('0x6e')]()[_0x7e13('0x71')](_0x7e13('0x75'))[_0x7e13('0x76')](_0x7e13('0x77'))[_0x7e13('0x3e')]('ItemTypeId\x20=\x20?',_0x6b75c7[_0x3ac14b]['id'])[_0x7e13('0x3e')]('CmContactId\x20=\x20c.id'),_0x7e13('0x78')+_0x6b75c7[_0x3ac14b][_0x7e13('0x2a')]);_0x152b08[_0x7e13('0x71')](squel[_0x7e13('0x6e')]()['field']('description')[_0x7e13('0x76')]('cm_contact_has_items')[_0x7e13('0x3e')](_0x7e13('0x79'),_0x6b75c7[_0x3ac14b]['id'])[_0x7e13('0x3e')]('CmContactId\x20=\x20c.id'),_0x7e13('0x7a')+_0x6b75c7[_0x3ac14b]['name']);}var _0x12265a=[];_0x12265a[_0x7e13('0x60')](_0x152b08['toString']());BPromise[_0x7e13('0x61')](_0x12265a,handleQuery)[_0x7e13('0x27')](function(_0x2e72fe){handleQuery(_0x152b08[_0x7e13('0x7b')]());var _0x299a19=csv_results[0x0];if(!_[_0x7e13('0x7c')](_0x299a19)){var _0x57d11b=toCsv(_0x299a19);var _0x6410f4=Date[_0x7e13('0x7d')]();fs[_0x7e13('0x7e')](util[_0x7e13('0x69')](_0x7e13('0x7f'),_0x2a1b7e,_0x6410f4),_0x57d11b);_0x210da7[_0x7e13('0x80')](_0x7e13('0x81'),_0x7e13('0x82')+util[_0x7e13('0x69')](_0x7e13('0x83'),_0x2a1b7e,_0x6410f4));_0x210da7[_0x7e13('0x80')](_0x7e13('0x84'),'text/csv');return _0x210da7[_0x7e13('0x85')](util[_0x7e13('0x69')]('/tmp/list_%d_%s.csv',_0x2a1b7e,_0x6410f4));}else{return _0x210da7[_0x7e13('0x28')](0xcc);}});});});};exports[_0x7e13('0x86')]=function(_0x3ae4bb,_0x3e8c6e,_0x1fc5c9){var _0x45fdc1;delete _0x3ae4bb[_0x7e13('0x54')]['id'];return db['CmList']['findOne']({'where':{'id':_0x3ae4bb[_0x7e13('0x49')]['id']}})[_0x7e13('0x27')](handleEntityNotFound(_0x3e8c6e,null))['then'](function(_0xb9f6eb){if(_0xb9f6eb){return db['sequelize'][_0x7e13('0x87')](function(_0x5e58a9){return db[_0x7e13('0x66')][_0x7e13('0x4c')](_0x3ae4bb['body'],{'transaction':_0x5e58a9})[_0x7e13('0x27')](function(_0x219538){_0x45fdc1=_0x219538;return _0xb9f6eb[_0x7e13('0x88')](_0x219538,{'transaction':_0x5e58a9});})[_0x7e13('0x27')](function(){var _0x2d56b5={'type':db[_0x7e13('0x89')][_0x7e13('0x8a')],'transaction':_0x5e58a9};switch(_0x3ae4bb[_0x7e13('0x54')][_0x7e13('0x30')]){case _0x7e13('0x8b'):_0x2d56b5[_0x7e13('0x30')]=db[_0x7e13('0x89')]['TEXT'];break;case'number':_0x2d56b5[_0x7e13('0x30')]=db['Sequelize'][_0x7e13('0x8c')];break;case _0x7e13('0x8d'):_0x2d56b5[_0x7e13('0x30')]=db['Sequelize'][_0x7e13('0x8e')];_0x2d56b5[_0x7e13('0x8f')]=![];break;default:}return db[_0x7e13('0x90')][_0x7e13('0x91')]['addColumn']('cm_contacts',util[_0x7e13('0x69')](_0x7e13('0x92'),_0x45fdc1['id']),_0x2d56b5);})[_0x7e13('0x27')](function(){return _0x45fdc1;});});}})[_0x7e13('0x27')](respondWithResult(_0x3e8c6e,null))[_0x7e13('0x47')](handleError(_0x3e8c6e,null));};exports[_0x7e13('0x93')]=function(_0x332639,_0x2a50dd,_0x54a2b0){var _0xbaa8dd={};var _0x258f29={};var _0x5d2d3a;var _0xbbd9ef;return db[_0x7e13('0x2e')]['findOne']({'where':{'id':_0x332639['params']['id']}})['then'](handleEntityNotFound(_0x2a50dd,null))[_0x7e13('0x27')](function(_0x28b1a1){if(_0x28b1a1){_0x5d2d3a=_0x28b1a1;_0x258f29[_0x7e13('0x32')]=_['keys'](db[_0x7e13('0x66')]['rawAttributes']);_0x258f29[_0x7e13('0x33')]=_[_0x7e13('0x34')](_0x332639['query']);_0x258f29[_0x7e13('0x35')]=_[_0x7e13('0x36')](_0x258f29['model'],_0x258f29[_0x7e13('0x33')]);_0xbaa8dd[_0x7e13('0x38')]=_[_0x7e13('0x36')](_0x258f29[_0x7e13('0x32')],qs[_0x7e13('0x37')](_0x332639[_0x7e13('0x33')][_0x7e13('0x37')]));_0xbaa8dd[_0x7e13('0x38')]=_0xbaa8dd[_0x7e13('0x38')][_0x7e13('0x39')]?_0xbaa8dd['attributes']:_0x258f29['model'];_0xbaa8dd[_0x7e13('0x3c')]=qs[_0x7e13('0x3d')](_0x332639[_0x7e13('0x33')][_0x7e13('0x3d')]);_0xbaa8dd[_0x7e13('0x3e')]=qs[_0x7e13('0x35')](_[_0x7e13('0x3f')](_0x332639[_0x7e13('0x33')],_0x258f29['filters']));_0xbaa8dd[_0x7e13('0x3e')]=_[_0x7e13('0x41')](_0xbaa8dd[_0x7e13('0x3e')],{'$or':[{'ListId':_0x28b1a1['id']},{'ListId':null}]});if(_0x332639['query'][_0x7e13('0x40')]){_0xbaa8dd['where']=_[_0x7e13('0x41')](_0xbaa8dd['where'],{'$or':_[_0x7e13('0x2d')](_0xbaa8dd[_0x7e13('0x38')],function(_0x2d737c){var _0x4f867b={};_0x4f867b[_0x2d737c]={'$like':'%'+_0x332639[_0x7e13('0x33')]['filter']+'%'};return _0x4f867b;})});}_0xbaa8dd=_[_0x7e13('0x41')]({},_0xbaa8dd,_0x332639['options']);return db[_0x7e13('0x66')][_0x7e13('0x94')](_0xbaa8dd);}})[_0x7e13('0x27')](respondWithResult(_0x2a50dd,null))[_0x7e13('0x47')](handleError(_0x2a50dd,null));};exports['getGlobalCustomFields']=function(_0x26cb1b,_0xc75c10){return db[_0x7e13('0x66')]['findAndCountAll']({'where':{'ListId':null}})[_0x7e13('0x27')](handleEntityNotFound(_0xc75c10,null))[_0x7e13('0x27')](function(_0x14a29b){return _0x14a29b;})[_0x7e13('0x27')](respondWithResult(_0xc75c10,null))[_0x7e13('0x47')](handleError(_0xc75c10,null));};exports[_0x7e13('0x95')]=function(_0x350473,_0x2e31e1,_0x334697){return db[_0x7e13('0x2e')]['find']({'where':{'id':_0x350473['params']['id']}})['then'](handleEntityNotFound(_0x2e31e1,null))[_0x7e13('0x27')](function(_0x203110){if(_0x203110){return _0x203110['addAgents'](_0x350473[_0x7e13('0x54')][_0x7e13('0x5a')],_[_0x7e13('0x96')](_0x350473['body'],[_0x7e13('0x5a'),'id'])||{})[_0x7e13('0x97')](function(_0xda7530){for(var _0x4c805a=0x0;_0x4c805a<_0x350473[_0x7e13('0x54')][_0x7e13('0x5a')][_0x7e13('0x39')];_0x4c805a+=0x1){socket[_0x7e13('0x98')](_0x7e13('0x99'),{'UserId':Number(_0x350473[_0x7e13('0x54')][_0x7e13('0x5a')][_0x4c805a]),'CmListId':Number(_0x350473['params']['id'])});}return _0xda7530;});}})[_0x7e13('0x27')](respondWithResult(_0x2e31e1,null))[_0x7e13('0x47')](handleError(_0x2e31e1,null));};exports['removeAgents']=function(_0x33ffb4,_0x22aa7b,_0xe69ba){return db[_0x7e13('0x2e')]['find']({'where':{'id':_0x33ffb4[_0x7e13('0x49')]['id']}})['then'](handleEntityNotFound(_0x22aa7b,null))[_0x7e13('0x27')](function(_0x172a73){if(_0x172a73){return _0x172a73[_0x7e13('0x9a')](_0x33ffb4[_0x7e13('0x33')]['ids'])['then'](function(){if(_[_0x7e13('0x5e')](_0x33ffb4['query'][_0x7e13('0x5a')])){for(var _0x2f4a28=0x0;_0x2f4a28<_0x33ffb4[_0x7e13('0x33')][_0x7e13('0x5a')][_0x7e13('0x39')];_0x2f4a28+=0x1){socket[_0x7e13('0x98')]('userCmList:remove',{'UserId':Number(_0x33ffb4[_0x7e13('0x33')][_0x7e13('0x5a')][_0x2f4a28]),'CmListId':Number(_0x33ffb4[_0x7e13('0x49')]['id'])});}}else{socket[_0x7e13('0x98')](_0x7e13('0x9b'),{'UserId':Number(_0x33ffb4[_0x7e13('0x33')][_0x7e13('0x5a')]),'CmListId':Number(_0x33ffb4[_0x7e13('0x49')]['id'])});}});}})[_0x7e13('0x27')](respondWithStatusCode(_0x22aa7b,null))[_0x7e13('0x47')](handleError(_0x22aa7b,null));};exports[_0x7e13('0x9c')]=function(_0x4431a1,_0x530cb4,_0x1d5d7a){var _0x27568f={};var _0x847180={};var _0x3cc207;var _0x1adbc9;return db[_0x7e13('0x2e')][_0x7e13('0x9d')]({'where':{'id':_0x4431a1[_0x7e13('0x49')]['id']}})[_0x7e13('0x27')](handleEntityNotFound(_0x530cb4,null))[_0x7e13('0x27')](function(_0x47612d){if(_0x47612d){_0x3cc207=_0x47612d;_0x847180[_0x7e13('0x32')]=_[_0x7e13('0x34')](db[_0x7e13('0x9e')][_0x7e13('0x4a')]);_0x847180[_0x7e13('0x33')]=_['keys'](_0x4431a1[_0x7e13('0x33')]);_0x847180[_0x7e13('0x35')]=_[_0x7e13('0x36')](_0x847180[_0x7e13('0x32')],_0x847180[_0x7e13('0x33')]);_0x27568f[_0x7e13('0x38')]=_[_0x7e13('0x36')](_0x847180[_0x7e13('0x32')],qs[_0x7e13('0x37')](_0x4431a1[_0x7e13('0x33')][_0x7e13('0x37')]));_0x27568f[_0x7e13('0x38')]=_0x27568f[_0x7e13('0x38')]['length']?_0x27568f[_0x7e13('0x38')]:_0x847180[_0x7e13('0x32')];_0x27568f[_0x7e13('0x3c')]=qs[_0x7e13('0x3d')](_0x4431a1['query'][_0x7e13('0x3d')]);_0x27568f['where']=qs[_0x7e13('0x35')](_[_0x7e13('0x3f')](_0x4431a1[_0x7e13('0x33')],_0x847180[_0x7e13('0x35')]));if(_0x4431a1[_0x7e13('0x33')][_0x7e13('0x40')]){_0x27568f[_0x7e13('0x3e')]=_[_0x7e13('0x41')](_0x27568f['where'],{'$or':_[_0x7e13('0x2d')](_0x27568f[_0x7e13('0x38')],function(_0x2315f5){var _0x5dfe84={};_0x5dfe84[_0x2315f5]={'$like':'%'+_0x4431a1['query']['filter']+'%'};return _0x5dfe84;})});}_0x27568f=_[_0x7e13('0x41')]({},_0x27568f,_0x4431a1['options']);return _0x3cc207[_0x7e13('0x9c')](_0x27568f);}})[_0x7e13('0x27')](function(_0x5649d8){if(_0x5649d8){_0x1adbc9=_0x5649d8[_0x7e13('0x39')];if(!_0x4431a1['query'][_0x7e13('0x3a')](_0x7e13('0x3b'))){_0x27568f[_0x7e13('0x1d')]=qs[_0x7e13('0x1d')](_0x4431a1[_0x7e13('0x33')][_0x7e13('0x1d')]);_0x27568f['offset']=qs[_0x7e13('0x1b')](_0x4431a1[_0x7e13('0x33')]['offset']);}return _0x3cc207[_0x7e13('0x9c')](_0x27568f);}})[_0x7e13('0x27')](function(_0x5f16dc){if(_0x5f16dc){return _0x5f16dc?{'count':_0x1adbc9,'rows':_0x5f16dc}:null;}})['then'](respondWithResult(_0x530cb4,null))[_0x7e13('0x47')](handleError(_0x530cb4,null));};function handleQuery(_0x381e47){logger[_0x7e13('0x9f')](_0x381e47);return db[_0x7e13('0x90')][_0x7e13('0x33')](_0x381e47)[_0x7e13('0x97')](function(_0x4d7dca){csv_results[_0x7e13('0x60')](_0x4d7dca);})['catch'](function(_0xec567d){logger[_0x7e13('0xa0')](_0xec567d[_0x7e13('0x65')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0f76cc7..e3788f1 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x4d3002,_0x4e3e76){var _0x2a56c3=function(_0x36fd0f){while(--_0x36fd0f){_0x4d3002['push'](_0x4d3002['shift']());}};_0x2a56c3(++_0x4e3e76);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x55ca,0x126));var _0xa55c=function(_0x116482,_0x35ddae){_0x116482=_0x116482-0x0;var _0x56db37=_0x55ca[_0x116482];return _0x56db37;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 3022571..2b5572d 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(_0x25658e,_0x49bc07){var _0x2e9c14=function(_0x45a2e7){while(--_0x45a2e7){_0x25658e['push'](_0x25658e['shift']());}};_0x2e9c14(++_0x49bc07);}(_0x2dae,0xc3));var _0xe2da=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0x2dae[_0x318410];return _0x2898a3;};'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 _0xda55=['util','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList','cm_lists','lodash'];(function(_0x1e1fd8,_0x13acfb){var _0x3f8712=function(_0x2cf680){while(--_0x2cf680){_0x1e1fd8['push'](_0x1e1fd8['shift']());}};_0x3f8712(++_0x13acfb);}(_0xda55,0x6d));var _0x5da5=function(_0x52a659,_0x5e3c37){_0x52a659=_0x52a659-0x0;var _0xd10977=_0xda55[_0x52a659];return _0xd10977;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var rp=require(_0x5da5('0x4'));var fs=require('fs');var path=require(_0x5da5('0x5'));var rimraf=require(_0x5da5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5da5('0x7'));module['exports']=function(_0x356a37,_0x58e7b3){return _0x356a37[_0x5da5('0x8')](_0x5da5('0x9'),attributes,{'tableName':_0x5da5('0xa'),'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 fa30cc4..c2a7eb5 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 _0xfb2f=['http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x35d649,_0x37210f){var _0x541bc4=function(_0x4743bb){while(--_0x4743bb){_0x35d649['push'](_0x35d649['shift']());}};_0x541bc4(++_0x37210f);}(_0xfb2f,0x1dc));var _0xffb2=function(_0x30ebbd,_0x3f51d8){_0x30ebbd=_0x30ebbd-0x0;var _0xc3b968=_0xfb2f[_0x30ebbd];return _0xc3b968;};'use strict';var _=require(_0xffb2('0x0'));var util=require(_0xffb2('0x1'));var moment=require('moment');var BPromise=require(_0xffb2('0x2'));var rs=require(_0xffb2('0x3'));var fs=require('fs');var Redis=require(_0xffb2('0x4'));var db=require(_0xffb2('0x5'))['db'];var utils=require(_0xffb2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xffb2('0x7'));var jayson=require(_0xffb2('0x8'));var client=jayson[_0xffb2('0x9')][_0xffb2('0xa')]({'port':0x232a});config[_0xffb2('0xb')]=_[_0xffb2('0xc')](config['redis'],{'host':_0xffb2('0xd'),'port':0x18eb});var socket=require(_0xffb2('0xe'))(new Redis(config[_0xffb2('0xb')]));require(_0xffb2('0xf'))[_0xffb2('0x10')](socket);function respondWithRpcPromise(_0x492e14,_0x46b715,_0x197693){return new BPromise(function(_0x575339,_0x24e97f){return client['request'](_0x492e14,_0x197693)[_0xffb2('0x11')](function(_0x58538b){logger[_0xffb2('0x12')](_0xffb2('0x13'),_0x46b715,_0xffb2('0x14'));logger[_0xffb2('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x46b715,_0xffb2('0x14'),JSON['stringify'](_0x58538b));if(_0x58538b['error']){if(_0x58538b['error'][_0xffb2('0x16')]===0x1f4){logger[_0xffb2('0x17')](_0xffb2('0x13'),_0x46b715,_0x58538b[_0xffb2('0x17')]['message']);return _0x24e97f(_0x58538b[_0xffb2('0x17')][_0xffb2('0x18')]);}logger[_0xffb2('0x17')](_0xffb2('0x13'),_0x46b715,_0x58538b[_0xffb2('0x17')][_0xffb2('0x18')]);return _0x575339(_0x58538b['error'][_0xffb2('0x18')]);}else{logger[_0xffb2('0x12')]('CmList,\x20%s,\x20%s',_0x46b715,'request\x20sent');_0x575339(_0x58538b[_0xffb2('0x19')][_0xffb2('0x18')]);}})[_0xffb2('0x1a')](function(_0x3576bd){logger[_0xffb2('0x17')](_0xffb2('0x13'),_0x46b715,_0x3576bd);_0x24e97f(_0x3576bd);});});} \ No newline at end of file +var _0xb6a6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x47e982,_0x8b568a){var _0x4327a6=function(_0x18d145){while(--_0x18d145){_0x47e982['push'](_0x47e982['shift']());}};_0x4327a6(++_0x8b568a);}(_0xb6a6,0x1c8));var _0x6b6a=function(_0x16698a,_0x11561d){_0x16698a=_0x16698a-0x0;var _0x1ca126=_0xb6a6[_0x16698a];return _0x1ca126;};'use strict';var _=require(_0x6b6a('0x0'));var util=require(_0x6b6a('0x1'));var moment=require(_0x6b6a('0x2'));var BPromise=require(_0x6b6a('0x3'));var rs=require(_0x6b6a('0x4'));var fs=require('fs');var Redis=require(_0x6b6a('0x5'));var db=require(_0x6b6a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b6a('0x7'))(_0x6b6a('0x8'));var config=require(_0x6b6a('0x9'));var jayson=require(_0x6b6a('0xa'));var client=jayson[_0x6b6a('0xb')][_0x6b6a('0xc')]({'port':0x232a});config[_0x6b6a('0xd')]=_['defaults'](config[_0x6b6a('0xd')],{'host':_0x6b6a('0xe'),'port':0x18eb});var socket=require(_0x6b6a('0xf'))(new Redis(config[_0x6b6a('0xd')]));require(_0x6b6a('0x10'))[_0x6b6a('0x11')](socket);function respondWithRpcPromise(_0x5c520d,_0x5d1d1e,_0x22c304){return new BPromise(function(_0x4dc35d,_0x58e55d){return client[_0x6b6a('0x12')](_0x5c520d,_0x22c304)['then'](function(_0x1cf041){logger['info'](_0x6b6a('0x13'),_0x5d1d1e,_0x6b6a('0x14'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x5d1d1e,'request\x20sent',JSON[_0x6b6a('0x15')](_0x1cf041));if(_0x1cf041[_0x6b6a('0x16')]){if(_0x1cf041[_0x6b6a('0x16')][_0x6b6a('0x17')]===0x1f4){logger[_0x6b6a('0x16')]('CmList,\x20%s,\x20%s',_0x5d1d1e,_0x1cf041[_0x6b6a('0x16')][_0x6b6a('0x18')]);return _0x58e55d(_0x1cf041[_0x6b6a('0x16')][_0x6b6a('0x18')]);}logger[_0x6b6a('0x16')](_0x6b6a('0x13'),_0x5d1d1e,_0x1cf041[_0x6b6a('0x16')]['message']);return _0x4dc35d(_0x1cf041[_0x6b6a('0x16')]['message']);}else{logger[_0x6b6a('0x19')](_0x6b6a('0x13'),_0x5d1d1e,'request\x20sent');_0x4dc35d(_0x1cf041['result'][_0x6b6a('0x18')]);}})[_0x6b6a('0x1a')](function(_0x36a561){logger[_0x6b6a('0x16')](_0x6b6a('0x13'),_0x5d1d1e,_0x36a561);_0x58e55d(_0x36a561);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 1699d84..76e62eb 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 _0x19af=['./cmList.events','save','update','register','cmList:'];(function(_0x5ccab6,_0x267782){var _0x43553d=function(_0x462a0f){while(--_0x462a0f){_0x5ccab6['push'](_0x5ccab6['shift']());}};_0x43553d(++_0x267782);}(_0x19af,0xe6));var _0xf19a=function(_0x2f59ad,_0x1fa328){_0x2f59ad=_0x2f59ad-0x0;var _0x33f490=_0x19af[_0x2f59ad];return _0x33f490;};'use strict';var CmListEvents=require(_0xf19a('0x0'));var events=[_0xf19a('0x1'),'remove',_0xf19a('0x2')];function createListener(_0x841b7f,_0x2f7fac){return function(_0x499b27){_0x2f7fac['emit'](_0x841b7f,_0x499b27);};}function removeListener(_0x29cd06,_0x548fab){return function(){CmListEvents['removeListener'](_0x29cd06,_0x548fab);};}exports[_0xf19a('0x3')]=function(_0x348453){for(var _0x5bad0c=0x0,_0x5511ae=events['length'];_0x5bad0c<_0x5511ae;_0x5bad0c++){var _0x1767e6=events[_0x5bad0c];var _0x16ed02=createListener(_0xf19a('0x4')+_0x1767e6,_0x348453);CmListEvents['on'](_0x1767e6,_0x16ed02);}}; \ No newline at end of file +var _0xee0c=['cmList:','remove','removeListener','register','length'];(function(_0xe7c36a,_0x641105){var _0x8b1186=function(_0x29dea0){while(--_0x29dea0){_0xe7c36a['push'](_0xe7c36a['shift']());}};_0x8b1186(++_0x641105);}(_0xee0c,0x1dc));var _0xcee0=function(_0x593bf2,_0x5928ac){_0x593bf2=_0x593bf2-0x0;var _0x3c1361=_0xee0c[_0x593bf2];return _0x3c1361;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xcee0('0x0'),'update'];function createListener(_0xfeddbc,_0x2fcbb3){return function(_0x3937a5){_0x2fcbb3['emit'](_0xfeddbc,_0x3937a5);};}function removeListener(_0x4f0eab,_0x4995cc){return function(){CmListEvents[_0xcee0('0x1')](_0x4f0eab,_0x4995cc);};}exports[_0xcee0('0x2')]=function(_0x3120f1){for(var _0xee8260=0x0,_0x4812c7=events[_0xcee0('0x3')];_0xee8260<_0x4812c7;_0xee8260++){var _0xa9c1ed=events[_0xee8260];var _0x11be05=createListener(_0xcee0('0x4')+_0xa9c1ed,_0x3120f1);CmListEvents['on'](_0xa9c1ed,_0x11be05);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 81cd20d..7ea9b9c 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 _0x0e46=['addCustomField','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','addDisposition','/:id/contacts'];(function(_0x30a761,_0x2e6e9c){var _0x9971e4=function(_0x3e4b27){while(--_0x3e4b27){_0x30a761['push'](_0x30a761['shift']());}};_0x9971e4(++_0x2e6e9c);}(_0x0e46,0x120));var _0x60e4=function(_0x50b6ff,_0xb9324f){_0x50b6ff=_0x50b6ff-0x0;var _0x57cb31=_0x0e46[_0x50b6ff];return _0x57cb31;};'use strict';var multer=require(_0x60e4('0x0'));var util=require('util');var path=require(_0x60e4('0x1'));var timeout=require('connect-timeout');var express=require(_0x60e4('0x2'));var router=express['Router']();var fs_extra=require(_0x60e4('0x3'));var auth=require(_0x60e4('0x4'));var interaction=require(_0x60e4('0x5'));var config=require(_0x60e4('0x6'));var controller=require(_0x60e4('0x7'));router[_0x60e4('0x8')]('/',auth[_0x60e4('0x9')](),controller[_0x60e4('0xa')]);router[_0x60e4('0x8')](_0x60e4('0xb'),auth[_0x60e4('0x9')](),controller[_0x60e4('0xc')]);router[_0x60e4('0x8')](_0x60e4('0xd'),auth['isAuthenticated'](),controller[_0x60e4('0xe')]);router[_0x60e4('0x8')](_0x60e4('0xf'),auth[_0x60e4('0x9')](),controller[_0x60e4('0x10')]);router[_0x60e4('0x8')](_0x60e4('0x11'),auth[_0x60e4('0x9')](),controller[_0x60e4('0x12')]);router['get']('/:id/contacts',auth[_0x60e4('0x9')](),controller['getContacts']);router[_0x60e4('0x8')](_0x60e4('0x13'),auth['isAuthenticated'](),controller[_0x60e4('0x14')]);router['get'](_0x60e4('0x15'),auth[_0x60e4('0x9')](),controller['getCustomFields']);router[_0x60e4('0x8')](_0x60e4('0x16'),auth[_0x60e4('0x9')](),controller[_0x60e4('0x17')]);router['post']('/',auth[_0x60e4('0x9')](),controller['create']);router[_0x60e4('0x18')](_0x60e4('0x11'),auth[_0x60e4('0x9')](),controller[_0x60e4('0x19')]);router[_0x60e4('0x18')](_0x60e4('0x1a'),auth[_0x60e4('0x9')](),controller['addContacts']);router[_0x60e4('0x18')](_0x60e4('0x15'),auth[_0x60e4('0x9')](),controller[_0x60e4('0x1b')]);router[_0x60e4('0x18')](_0x60e4('0x16'),auth['isAuthenticated'](),controller[_0x60e4('0x1c')]);router[_0x60e4('0x1d')](_0x60e4('0xf'),auth['isAuthenticated'](),controller[_0x60e4('0x1e')]);router[_0x60e4('0x1f')]('/:id',auth[_0x60e4('0x9')](),controller[_0x60e4('0x20')]);router[_0x60e4('0x1f')](_0x60e4('0x11'),auth[_0x60e4('0x9')](),controller[_0x60e4('0x21')]);router[_0x60e4('0x1f')](_0x60e4('0x16'),auth[_0x60e4('0x9')](),controller['removeAgents']);module[_0x60e4('0x22')]=router; \ No newline at end of file +var _0x69d5=['getAgents','post','/:id/contacts','addContacts','addAgents','update','delete','removeAgents','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users'];(function(_0x7e5392,_0x3b64fe){var _0x48ff2f=function(_0x104376){while(--_0x104376){_0x7e5392['push'](_0x7e5392['shift']());}};_0x48ff2f(++_0x3b64fe);}(_0x69d5,0x18e));var _0x569d=function(_0x2894a4,_0xd6ba9b){_0x2894a4=_0x2894a4-0x0;var _0x57220e=_0x69d5[_0x2894a4];return _0x57220e;};'use strict';var multer=require(_0x569d('0x0'));var util=require(_0x569d('0x1'));var path=require('path');var timeout=require(_0x569d('0x2'));var express=require(_0x569d('0x3'));var router=express['Router']();var fs_extra=require(_0x569d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x569d('0x5'));var config=require(_0x569d('0x6'));var controller=require(_0x569d('0x7'));router[_0x569d('0x8')]('/',auth[_0x569d('0x9')](),controller[_0x569d('0xa')]);router['get']('/describe',auth[_0x569d('0x9')](),controller[_0x569d('0xb')]);router['get']('/global_fields',auth[_0x569d('0x9')](),controller[_0x569d('0xc')]);router[_0x569d('0x8')](_0x569d('0xd'),auth[_0x569d('0x9')](),controller[_0x569d('0xe')]);router['get'](_0x569d('0xf'),auth[_0x569d('0x9')](),controller[_0x569d('0x10')]);router[_0x569d('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x569d('0x11')]);router[_0x569d('0x8')](_0x569d('0x12'),auth[_0x569d('0x9')](),controller[_0x569d('0x13')]);router[_0x569d('0x8')](_0x569d('0x14'),auth[_0x569d('0x9')](),controller['getCustomFields']);router[_0x569d('0x8')](_0x569d('0x15'),auth[_0x569d('0x9')](),controller[_0x569d('0x16')]);router[_0x569d('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x569d('0x17')](_0x569d('0xf'),auth[_0x569d('0x9')](),controller['addDisposition']);router[_0x569d('0x17')](_0x569d('0x18'),auth['isAuthenticated'](),controller[_0x569d('0x19')]);router[_0x569d('0x17')]('/:id/fields',auth[_0x569d('0x9')](),controller['addCustomField']);router[_0x569d('0x17')](_0x569d('0x15'),auth[_0x569d('0x9')](),controller[_0x569d('0x1a')]);router['put'](_0x569d('0xd'),auth[_0x569d('0x9')](),controller[_0x569d('0x1b')]);router[_0x569d('0x1c')](_0x569d('0xd'),auth[_0x569d('0x9')](),controller['destroy']);router[_0x569d('0x1c')]('/:id/dispositions',auth[_0x569d('0x9')](),controller['removeDispositions']);router['delete'](_0x569d('0x15'),auth[_0x569d('0x9')](),controller[_0x569d('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 519fe29..a0ff33d 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 _0x42e6=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x42e6,0x9d));var _0x642e=function(_0x5ca9c9,_0x1b234c){_0x5ca9c9=_0x5ca9c9-0x0;var _0x28d3f7=_0x42e6[_0x5ca9c9];return _0x28d3f7;};'use strict';var Sequelize=require(_0x642e('0x0'));module[_0x642e('0x1')]={'name':{'type':Sequelize[_0x642e('0x2')],'get':function(_0x18c894){return this['getDataValue'](_0x642e('0x3'));}},'field':{'type':Sequelize[_0x642e('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x642e('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9837=['VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x15a41d,_0x28c5a){var _0x5866bc=function(_0xd210af){while(--_0xd210af){_0x15a41d['push'](_0x15a41d['shift']());}};_0x5866bc(++_0x28c5a);}(_0x9837,0xf9));var _0x7983=function(_0x39fe6c,_0x21b9eb){_0x39fe6c=_0x39fe6c-0x0;var _0x387583=_0x9837[_0x39fe6c];return _0x387583;};'use strict';var Sequelize=require(_0x7983('0x0'));module['exports']={'name':{'type':Sequelize[_0x7983('0x1')],'get':function(_0x333ee2){return this[_0x7983('0x2')](_0x7983('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7983('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 976fad6..000563e 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(_0x4fccae,_0x51b72d){var _0x50c532=function(_0x2adca8){while(--_0x2adca8){_0x4fccae['push'](_0x4fccae['shift']());}};_0x50c532(++_0x51b72d);}(_0x7a54,0x106));var _0x47a5=function(_0x352e47,_0x507ed8){_0x352e47=_0x352e47-0x0;var _0x17bdfc=_0x7a54[_0x352e47];return _0x17bdfc;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x34ba3c,_0x3f131b){var _0x20c521=function(_0x379564){while(--_0x379564){_0x34ba3c['push'](_0x34ba3c['shift']());}};_0x20c521(++_0x3f131b);}(_0x7a54,0x106));var _0x47a5=function(_0xa7dac4,_0x3d5bcf){_0xa7dac4=_0xa7dac4-0x0;var _0x1f0499=_0x7a54[_0xa7dac4];return _0x1f0499;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index e59afee..8666c87 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 _0xfc61=['api','moment','bluebird','path','../../config/environment','./condition.attributes','exports','define','Condition','util','../../config/logger'];(function(_0x20fa6b,_0xf36c43){var _0x18aca8=function(_0x50dc44){while(--_0x50dc44){_0x20fa6b['push'](_0x20fa6b['shift']());}};_0x18aca8(++_0xf36c43);}(_0xfc61,0x169));var _0x1fc6=function(_0x16033a,_0x244a3e){_0x16033a=_0x16033a-0x0;var _0x43a163=_0xfc61[_0x16033a];return _0x43a163;};'use strict';var _=require('lodash');var util=require(_0x1fc6('0x0'));var logger=require(_0x1fc6('0x1'))(_0x1fc6('0x2'));var moment=require(_0x1fc6('0x3'));var BPromise=require(_0x1fc6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fc6('0x5'));var rimraf=require('rimraf');var config=require(_0x1fc6('0x6'));var attributes=require(_0x1fc6('0x7'));module[_0x1fc6('0x8')]=function(_0x175ba0,_0x48c678){return _0x175ba0[_0x1fc6('0x9')](_0x1fc6('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x656e=['exports','define','lodash','util','api','moment','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x110924,_0x1374bb){var _0x12905b=function(_0x47d32c){while(--_0x47d32c){_0x110924['push'](_0x110924['shift']());}};_0x12905b(++_0x1374bb);}(_0x656e,0x174));var _0xe656=function(_0x83e917,_0x1791a1){_0x83e917=_0x83e917-0x0;var _0x40af5a=_0x656e[_0x83e917];return _0x40af5a;};'use strict';var _=require(_0xe656('0x0'));var util=require(_0xe656('0x1'));var logger=require('../../config/logger')(_0xe656('0x2'));var moment=require(_0xe656('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe656('0x4'));var rimraf=require(_0xe656('0x5'));var config=require(_0xe656('0x6'));var attributes=require(_0xe656('0x7'));module[_0xe656('0x8')]=function(_0x444fc3,_0x1635c7){return _0x444fc3[_0xe656('0x9')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 01cf83f..fce525e 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 _0xc174=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x22c48a,_0x30a479){var _0x557e89=function(_0x27aae7){while(--_0x27aae7){_0x22c48a['push'](_0x22c48a['shift']());}};_0x557e89(++_0x30a479);}(_0xc174,0x1a1));var _0x4c17=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0xc174[_0x54a2e4];return _0x4742d0;};'use strict';var _=require('lodash');var util=require(_0x4c17('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4c17('0x1'));var fs=require('fs');var Redis=require(_0x4c17('0x2'));var db=require(_0x4c17('0x3'))['db'];var utils=require(_0x4c17('0x4'));var logger=require(_0x4c17('0x5'))(_0x4c17('0x6'));var config=require(_0x4c17('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4c17('0x8')][_0x4c17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x341cee,_0x579863,_0x15fb03){return new BPromise(function(_0x3c59cf,_0x5661f9){return client[_0x4c17('0xa')](_0x341cee,_0x15fb03)['then'](function(_0x44a890){logger[_0x4c17('0xb')](_0x4c17('0xc'),_0x579863,_0x4c17('0xd'));logger[_0x4c17('0xe')](_0x4c17('0xf'),_0x579863,'request\x20sent',JSON[_0x4c17('0x10')](_0x44a890));if(_0x44a890[_0x4c17('0x11')]){if(_0x44a890[_0x4c17('0x11')][_0x4c17('0x12')]===0x1f4){logger[_0x4c17('0x11')](_0x4c17('0xc'),_0x579863,_0x44a890['error'][_0x4c17('0x13')]);return _0x5661f9(_0x44a890['error'][_0x4c17('0x13')]);}logger['error'](_0x4c17('0xc'),_0x579863,_0x44a890[_0x4c17('0x11')][_0x4c17('0x13')]);return _0x3c59cf(_0x44a890[_0x4c17('0x11')][_0x4c17('0x13')]);}else{logger[_0x4c17('0xb')]('Condition,\x20%s,\x20%s',_0x579863,_0x4c17('0xd'));_0x3c59cf(_0x44a890[_0x4c17('0x14')][_0x4c17('0x13')]);}})[_0x4c17('0x15')](function(_0x3b1adf){logger[_0x4c17('0x11')](_0x4c17('0xc'),_0x579863,_0x3b1adf);_0x5661f9(_0x3b1adf);});});} \ No newline at end of file +var _0x3fef=['then','Condition,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0x3fef,0xaa));var _0xf3fe=function(_0x2051b5,_0x88e25f){_0x2051b5=_0x2051b5-0x0;var _0x3b1354=_0x3fef[_0x2051b5];return _0x3b1354;};'use strict';var _=require('lodash');var util=require(_0xf3fe('0x0'));var moment=require(_0xf3fe('0x1'));var BPromise=require(_0xf3fe('0x2'));var rs=require(_0xf3fe('0x3'));var fs=require('fs');var Redis=require(_0xf3fe('0x4'));var db=require(_0xf3fe('0x5'))['db'];var utils=require(_0xf3fe('0x6'));var logger=require('../../config/logger')(_0xf3fe('0x7'));var config=require('../../config/environment');var jayson=require(_0xf3fe('0x8'));var client=jayson[_0xf3fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x549e09,_0x15cda8,_0x431372){return new BPromise(function(_0xc1a8f4,_0x71e18c){return client['request'](_0x549e09,_0x431372)[_0xf3fe('0xa')](function(_0x3897bd){logger['info'](_0xf3fe('0xb'),_0x15cda8,'request\x20sent');logger[_0xf3fe('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0x15cda8,_0xf3fe('0xd'),JSON['stringify'](_0x3897bd));if(_0x3897bd[_0xf3fe('0xe')]){if(_0x3897bd['error'][_0xf3fe('0xf')]===0x1f4){logger[_0xf3fe('0xe')](_0xf3fe('0xb'),_0x15cda8,_0x3897bd[_0xf3fe('0xe')][_0xf3fe('0x10')]);return _0x71e18c(_0x3897bd['error'][_0xf3fe('0x10')]);}logger[_0xf3fe('0xe')](_0xf3fe('0xb'),_0x15cda8,_0x3897bd['error'][_0xf3fe('0x10')]);return _0xc1a8f4(_0x3897bd[_0xf3fe('0xe')][_0xf3fe('0x10')]);}else{logger['info'](_0xf3fe('0xb'),_0x15cda8,_0xf3fe('0xd'));_0xc1a8f4(_0x3897bd['result']['message']);}})[_0xf3fe('0x11')](function(_0x44c35b){logger[_0xf3fe('0xe')](_0xf3fe('0xb'),_0x15cda8,_0x44c35b);_0x71e18c(_0x44c35b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 05fa81e..9eadd73 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 _0x3570=['/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x2e53c5,_0x8c3b8){var _0x2d6888=function(_0xc2c2d2){while(--_0xc2c2d2){_0x2e53c5['push'](_0x2e53c5['shift']());}};_0x2d6888(++_0x8c3b8);}(_0x3570,0x1da));var _0x0357=function(_0x2d4049,_0x11be39){_0x2d4049=_0x2d4049-0x0;var _0x552897=_0x3570[_0x2d4049];return _0x552897;};'use strict';var multer=require(_0x0357('0x0'));var util=require('util');var path=require(_0x0357('0x1'));var timeout=require(_0x0357('0x2'));var express=require(_0x0357('0x3'));var router=express[_0x0357('0x4')]();var fs_extra=require(_0x0357('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0357('0x6'));var controller=require('./condition.controller');router['put'](_0x0357('0x7'),auth[_0x0357('0x8')](),controller[_0x0357('0x9')]);router[_0x0357('0xa')](_0x0357('0x7'),auth[_0x0357('0x8')](),controller[_0x0357('0xb')]);module[_0x0357('0xc')]=router; \ No newline at end of file +var _0xed66=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','update','delete'];(function(_0x45f4ba,_0x5498c8){var _0x44db14=function(_0x381dec){while(--_0x381dec){_0x45f4ba['push'](_0x45f4ba['shift']());}};_0x44db14(++_0x5498c8);}(_0xed66,0x1b5));var _0x6ed6=function(_0x1f1837,_0x4b304e){_0x1f1837=_0x1f1837-0x0;var _0x25ab57=_0xed66[_0x1f1837];return _0x25ab57;};'use strict';var multer=require(_0x6ed6('0x0'));var util=require('util');var path=require(_0x6ed6('0x1'));var timeout=require(_0x6ed6('0x2'));var express=require(_0x6ed6('0x3'));var router=express[_0x6ed6('0x4')]();var fs_extra=require(_0x6ed6('0x5'));var auth=require(_0x6ed6('0x6'));var interaction=require(_0x6ed6('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x6ed6('0x8')](_0x6ed6('0x9'),auth[_0x6ed6('0xa')](),controller[_0x6ed6('0xb')]);router[_0x6ed6('0xc')](_0x6ed6('0x9'),auth[_0x6ed6('0xa')](),controller[_0x6ed6('0xd')]);module[_0x6ed6('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 04f7bed..a58a460 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 _0xb3cf=['name','INTEGER','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb3cf,0xe0));var _0xfb3c=function(_0x516d9f,_0xdb4a2e){_0x516d9f=_0x516d9f-0x0;var _0xb3ac3a=_0xb3cf[_0x516d9f];return _0xb3ac3a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfb3c('0x0')],'allowNull':![],'unique':_0xfb3c('0x1')},'OrderBy':{'type':Sequelize[_0xfb3c('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xfb3c('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x17ae=['sequelize','exports','STRING','name'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x17ae,0x8c));var _0xe17a=function(_0x5f3bdd,_0x47fe4c){_0x5f3bdd=_0x5f3bdd-0x0;var _0x45b83a=_0x17ae[_0x5f3bdd];return _0x45b83a;};'use strict';var Sequelize=require(_0xe17a('0x0'));module[_0xe17a('0x1')]={'name':{'type':Sequelize[_0xe17a('0x2')],'allowNull':![],'unique':_0xe17a('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xe17a('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1aa224b..0abb2f8 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 _0xd4a2=['stack','name','send','index','map','ContactItemType','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get'];(function(_0x28d80b,_0x151137){var _0x4b9c92=function(_0x3f3261){while(--_0x3f3261){_0x28d80b['push'](_0x28d80b['shift']());}};_0x4b9c92(++_0x151137);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2a7977,_0x58c2fc){_0x2a7977=_0x2a7977-0x0;var _0x389366=_0xd4a2[_0x2a7977];return _0x389366;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];function respondWithStatusCode(_0x45b9fb,_0x5ac803){_0x5ac803=_0x5ac803||0xcc;return function(_0x2f785f){if(_0x2f785f){return _0x45b9fb[_0x2d4a('0x17')](_0x5ac803);}return _0x45b9fb[_0x2d4a('0x18')](_0x5ac803)[_0x2d4a('0x19')]();};}function respondWithResult(_0x544622,_0x4be8b4){_0x4be8b4=_0x4be8b4||0xc8;return function(_0x2a1d0f){if(_0x2a1d0f){return _0x544622['status'](_0x4be8b4)[_0x2d4a('0x1a')](_0x2a1d0f);}};}function respondWithFilteredResult(_0x175bda,_0x11896d){return function(_0x3a3156){if(_0x3a3156){var _0x4c5287=typeof _0x11896d[_0x2d4a('0x1b')]==='undefined'&&typeof _0x11896d[_0x2d4a('0x1c')]==='undefined';var _0x435687=_0x3a3156[_0x2d4a('0x1d')];var _0x2188b2=_0x4c5287?0x0:_0x11896d[_0x2d4a('0x1b')];var _0x498956=_0x4c5287?_0x3a3156['count']:_0x11896d['offset']+_0x11896d[_0x2d4a('0x1c')];var _0x1966d1;if(_0x498956>=_0x435687){_0x498956=_0x435687;_0x1966d1=0xc8;}else{_0x1966d1=0xce;}_0x175bda[_0x2d4a('0x18')](_0x1966d1);return _0x175bda[_0x2d4a('0x1e')](_0x2d4a('0x1f'),_0x2188b2+'-'+_0x498956+'/'+_0x435687)[_0x2d4a('0x1a')](_0x3a3156);}return null;};}function patchUpdates(_0x56445a){return function(_0x49f378){try{jsonpatch[_0x2d4a('0x20')](_0x49f378,_0x56445a,!![]);}catch(_0x1f3e17){return BPromise[_0x2d4a('0x21')](_0x1f3e17);}return _0x49f378[_0x2d4a('0x22')]();};}function saveUpdates(_0x1a2d20,_0x2e7736){return function(_0x22dd0b){if(_0x22dd0b){return _0x22dd0b[_0x2d4a('0x23')](_0x1a2d20)['then'](function(_0x26e7b8){return _0x26e7b8;});}return null;};}function removeEntity(_0x3240a2,_0x2c3799){return function(_0x42d813){if(_0x42d813){return _0x42d813[_0x2d4a('0x24')]()[_0x2d4a('0x25')](function(){var _0x456d38=_0x42d813[_0x2d4a('0x26')]({'plain':!![]});var _0x54c910='ContactItemTypes';return db['UserProfileResource'][_0x2d4a('0x24')]({'where':{'type':_0x54c910,'resourceId':_0x456d38['id']}})['then'](function(){return _0x42d813;});})[_0x2d4a('0x25')](function(){_0x3240a2[_0x2d4a('0x18')](0xcc)[_0x2d4a('0x19')]();});}};}function handleEntityNotFound(_0x1d2fa6,_0x13e769){return function(_0x326c38){if(!_0x326c38){_0x1d2fa6[_0x2d4a('0x17')](0x194);}return _0x326c38;};}function handleError(_0x27b358,_0x4f1fc8){_0x4f1fc8=_0x4f1fc8||0x1f4;return function(_0x436f53){logger['error'](_0x436f53[_0x2d4a('0x27')]);if(_0x436f53[_0x2d4a('0x28')]){delete _0x436f53[_0x2d4a('0x28')];}_0x27b358[_0x2d4a('0x18')](_0x4f1fc8)[_0x2d4a('0x29')](_0x436f53);};}exports[_0x2d4a('0x2a')]=function(_0x25ac5c,_0x2e8063){var _0x51b447={},_0x45a4fa={},_0x3d94b7={'count':0x0,'rows':[]};var _0xda1ef2=_[_0x2d4a('0x2b')](db[_0x2d4a('0x2c')]['rawAttributes'],function(_0x217653){return{'name':_0x217653[_0x2d4a('0x2d')],'type':_0x217653[_0x2d4a('0x2e')][_0x2d4a('0x2f')]};});_0x45a4fa[_0x2d4a('0x30')]=_['map'](_0xda1ef2,_0x2d4a('0x28'));_0x45a4fa[_0x2d4a('0x31')]=_[_0x2d4a('0x32')](_0x25ac5c[_0x2d4a('0x31')]);_0x45a4fa[_0x2d4a('0x33')]=_[_0x2d4a('0x34')](_0x45a4fa['model'],_0x45a4fa[_0x2d4a('0x31')]);_0x51b447[_0x2d4a('0x35')]=_[_0x2d4a('0x34')](_0x45a4fa[_0x2d4a('0x30')],qs[_0x2d4a('0x36')](_0x25ac5c['query'][_0x2d4a('0x36')]));_0x51b447[_0x2d4a('0x35')]=_0x51b447['attributes'][_0x2d4a('0x37')]?_0x51b447[_0x2d4a('0x35')]:_0x45a4fa[_0x2d4a('0x30')];if(!_0x25ac5c[_0x2d4a('0x31')][_0x2d4a('0x38')](_0x2d4a('0x39'))){_0x51b447['limit']=qs[_0x2d4a('0x1c')](_0x25ac5c[_0x2d4a('0x31')][_0x2d4a('0x1c')]);_0x51b447[_0x2d4a('0x1b')]=qs[_0x2d4a('0x1b')](_0x25ac5c[_0x2d4a('0x31')]['offset']);}_0x51b447['order']=qs[_0x2d4a('0x3a')](_0x25ac5c['query'][_0x2d4a('0x3a')]);_0x51b447[_0x2d4a('0x3b')]=qs['filters'](_[_0x2d4a('0x3c')](_0x25ac5c[_0x2d4a('0x31')],_0x45a4fa[_0x2d4a('0x33')]),_0xda1ef2);if(_0x25ac5c[_0x2d4a('0x31')][_0x2d4a('0x3d')]){_0x51b447[_0x2d4a('0x3b')]=_[_0x2d4a('0x3e')](_0x51b447[_0x2d4a('0x3b')],{'$or':_[_0x2d4a('0x2b')](_0xda1ef2,function(_0x2d64b0){if(_0x2d64b0[_0x2d4a('0x2e')]!=='VIRTUAL'){var _0x8bc995={};_0x8bc995[_0x2d64b0[_0x2d4a('0x28')]]={'$like':'%'+_0x25ac5c[_0x2d4a('0x31')][_0x2d4a('0x3d')]+'%'};return _0x8bc995;}})});}_0x51b447=_[_0x2d4a('0x3e')]({},_0x51b447,_0x25ac5c['options']);var _0x50dbc3={'where':_0x51b447['where']};return db['ContactItemType'][_0x2d4a('0x1d')](_0x50dbc3)[_0x2d4a('0x25')](function(_0xf39020){_0x3d94b7[_0x2d4a('0x1d')]=_0xf39020;if(_0x25ac5c['query'][_0x2d4a('0x3f')]){_0x51b447[_0x2d4a('0x40')]=[{'all':!![]}];}return db['ContactItemType'][_0x2d4a('0x41')](_0x51b447);})[_0x2d4a('0x25')](function(_0x8a9375){_0x3d94b7[_0x2d4a('0x42')]=_0x8a9375;return _0x3d94b7;})[_0x2d4a('0x25')](respondWithFilteredResult(_0x2e8063,_0x51b447))[_0x2d4a('0x43')](handleError(_0x2e8063,null));};exports['show']=function(_0x236fbf,_0x2d6eca){var _0x12c899={'raw':!![],'where':{'id':_0x236fbf[_0x2d4a('0x44')]['id']}},_0x365399={};_0x365399[_0x2d4a('0x30')]=_['keys'](db[_0x2d4a('0x2c')][_0x2d4a('0x45')]);_0x365399[_0x2d4a('0x31')]=_['keys'](_0x236fbf[_0x2d4a('0x31')]);_0x365399['filters']=_[_0x2d4a('0x34')](_0x365399[_0x2d4a('0x30')],_0x365399[_0x2d4a('0x31')]);_0x12c899[_0x2d4a('0x35')]=_[_0x2d4a('0x34')](_0x365399['model'],qs['fields'](_0x236fbf[_0x2d4a('0x31')][_0x2d4a('0x36')]));_0x12c899['attributes']=_0x12c899[_0x2d4a('0x35')]['length']?_0x12c899[_0x2d4a('0x35')]:_0x365399[_0x2d4a('0x30')];if(_0x236fbf[_0x2d4a('0x31')]['includeAll']){_0x12c899[_0x2d4a('0x40')]=[{'all':!![]}];}_0x12c899=_['merge']({},_0x12c899,_0x236fbf[_0x2d4a('0x46')]);return db[_0x2d4a('0x2c')][_0x2d4a('0x47')](_0x12c899)[_0x2d4a('0x25')](handleEntityNotFound(_0x2d6eca,null))[_0x2d4a('0x25')](respondWithResult(_0x2d6eca,null))[_0x2d4a('0x43')](handleError(_0x2d6eca,null));};exports[_0x2d4a('0x48')]=function(_0x2b2f4b,_0x1ffb96){return db[_0x2d4a('0x2c')][_0x2d4a('0x48')](_0x2b2f4b['body'],{})[_0x2d4a('0x25')](function(_0x26a070){var _0x3336b2=_0x2b2f4b[_0x2d4a('0x49')][_0x2d4a('0x26')]({'plain':!![]});if(!_0x3336b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3336b2[_0x2d4a('0x4a')]===_0x2d4a('0x49')){var _0x2123e8=_0x26a070[_0x2d4a('0x26')]({'plain':!![]});var _0x2f038a='ContactItemTypes';return db['UserProfileSection'][_0x2d4a('0x47')]({'where':{'name':_0x2f038a,'userProfileId':_0x3336b2[_0x2d4a('0x4b')]},'raw':!![]})['then'](function(_0x15e204){if(_0x15e204&&_0x15e204[_0x2d4a('0x4c')]===0x0){return db[_0x2d4a('0x4d')][_0x2d4a('0x48')]({'name':_0x2123e8['name'],'resourceId':_0x2123e8['id'],'type':_0x15e204[_0x2d4a('0x28')],'sectionId':_0x15e204['id']},{})['then'](function(){return _0x26a070;});}else{return _0x26a070;}})[_0x2d4a('0x43')](function(_0x3fe91b){logger[_0x2d4a('0x4e')](_0x2d4a('0x4f'),_0x3fe91b);throw _0x3fe91b;});}return _0x26a070;})[_0x2d4a('0x25')](respondWithResult(_0x1ffb96,0xc9))[_0x2d4a('0x43')](handleError(_0x1ffb96,null));};exports[_0x2d4a('0x23')]=function(_0x1b088c,_0x5d086a){if(_0x1b088c[_0x2d4a('0x50')]['id']){delete _0x1b088c[_0x2d4a('0x50')]['id'];}return db[_0x2d4a('0x2c')][_0x2d4a('0x47')]({'where':{'id':_0x1b088c[_0x2d4a('0x44')]['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x5d086a,null))[_0x2d4a('0x25')](saveUpdates(_0x1b088c[_0x2d4a('0x50')],null))[_0x2d4a('0x25')](respondWithResult(_0x5d086a,null))[_0x2d4a('0x43')](handleError(_0x5d086a,null));};exports[_0x2d4a('0x24')]=function(_0x113bc4,_0x1b4ae7){return db[_0x2d4a('0x2c')][_0x2d4a('0x47')]({'where':{'id':_0x113bc4[_0x2d4a('0x44')]['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x1b4ae7,null))['then'](db[_0x2d4a('0x51')][_0x2d4a('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x113bc4['params']['id']}}))[_0x2d4a('0x25')](removeEntity(_0x1b4ae7,null))[_0x2d4a('0x43')](handleError(_0x1b4ae7,null));}; \ No newline at end of file +var _0xcf2f=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','destroy','end','sendStatus','stack','name','send','map','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','ContactItemType','includeAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x27bdc8,_0x1ef7d6){var _0x42b65a=function(_0x2a29df){while(--_0x2a29df){_0x27bdc8['push'](_0x27bdc8['shift']());}};_0x42b65a(++_0x1ef7d6);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x32d129,_0x2c93fe){_0x32d129=_0x32d129-0x0;var _0x3e9bc4=_0xcf2f[_0x32d129];return _0x3e9bc4;};'use strict';var emlformat=require(_0xfcf2('0x0'));var rimraf=require(_0xfcf2('0x1'));var zipdir=require(_0xfcf2('0x2'));var jsonpatch=require(_0xfcf2('0x3'));var rp=require(_0xfcf2('0x4'));var moment=require('moment');var BPromise=require(_0xfcf2('0x5'));var Mustache=require(_0xfcf2('0x6'));var util=require(_0xfcf2('0x7'));var path=require(_0xfcf2('0x8'));var sox=require(_0xfcf2('0x9'));var csv=require(_0xfcf2('0xa'));var ejs=require(_0xfcf2('0xb'));var fs=require('fs');var fs_extra=require(_0xfcf2('0xc'));var _=require(_0xfcf2('0xd'));var squel=require(_0xfcf2('0xe'));var crypto=require(_0xfcf2('0xf'));var jsforce=require(_0xfcf2('0x10'));var deskjs=require(_0xfcf2('0x11'));var toCsv=require(_0xfcf2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcf2('0x12'));var qs=require(_0xfcf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf2('0x14'));var logger=require(_0xfcf2('0x15'))(_0xfcf2('0x16'));var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcf2('0x18'))['db'];function respondWithStatusCode(_0x1ba610,_0x175ac9){_0x175ac9=_0x175ac9||0xcc;return function(_0x1be8cc){if(_0x1be8cc){return _0x1ba610['sendStatus'](_0x175ac9);}return _0x1ba610[_0xfcf2('0x19')](_0x175ac9)['end']();};}function respondWithResult(_0x5b414a,_0x5dc04b){_0x5dc04b=_0x5dc04b||0xc8;return function(_0xc87ff4){if(_0xc87ff4){return _0x5b414a['status'](_0x5dc04b)[_0xfcf2('0x1a')](_0xc87ff4);}};}function respondWithFilteredResult(_0x1febf8,_0x245f9a){return function(_0x21f7d1){if(_0x21f7d1){var _0x315b2f=typeof _0x245f9a[_0xfcf2('0x1b')]===_0xfcf2('0x1c')&&typeof _0x245f9a['limit']===_0xfcf2('0x1c');var _0x213125=_0x21f7d1[_0xfcf2('0x1d')];var _0x581d78=_0x315b2f?0x0:_0x245f9a[_0xfcf2('0x1b')];var _0x1b3c89=_0x315b2f?_0x21f7d1[_0xfcf2('0x1d')]:_0x245f9a[_0xfcf2('0x1b')]+_0x245f9a[_0xfcf2('0x1e')];var _0x53c406;if(_0x1b3c89>=_0x213125){_0x1b3c89=_0x213125;_0x53c406=0xc8;}else{_0x53c406=0xce;}_0x1febf8[_0xfcf2('0x19')](_0x53c406);return _0x1febf8[_0xfcf2('0x1f')]('Content-Range',_0x581d78+'-'+_0x1b3c89+'/'+_0x213125)[_0xfcf2('0x1a')](_0x21f7d1);}return null;};}function patchUpdates(_0x23c079){return function(_0x206738){try{jsonpatch[_0xfcf2('0x20')](_0x206738,_0x23c079,!![]);}catch(_0x51e0b7){return BPromise[_0xfcf2('0x21')](_0x51e0b7);}return _0x206738[_0xfcf2('0x22')]();};}function saveUpdates(_0x422c5a,_0x1eeebd){return function(_0x5afab5){if(_0x5afab5){return _0x5afab5[_0xfcf2('0x23')](_0x422c5a)[_0xfcf2('0x24')](function(_0x232f6f){return _0x232f6f;});}return null;};}function removeEntity(_0x584e76,_0x26641a){return function(_0x151aa8){if(_0x151aa8){return _0x151aa8['destroy']()[_0xfcf2('0x24')](function(){var _0xbc8722=_0x151aa8['get']({'plain':!![]});var _0x1e6f14=_0xfcf2('0x25');return db[_0xfcf2('0x26')][_0xfcf2('0x27')]({'where':{'type':_0x1e6f14,'resourceId':_0xbc8722['id']}})['then'](function(){return _0x151aa8;});})[_0xfcf2('0x24')](function(){_0x584e76[_0xfcf2('0x19')](0xcc)[_0xfcf2('0x28')]();});}};}function handleEntityNotFound(_0x3779ee,_0x17c994){return function(_0x2b1d60){if(!_0x2b1d60){_0x3779ee[_0xfcf2('0x29')](0x194);}return _0x2b1d60;};}function handleError(_0x1c8f38,_0x23c09c){_0x23c09c=_0x23c09c||0x1f4;return function(_0x56f839){logger['error'](_0x56f839[_0xfcf2('0x2a')]);if(_0x56f839[_0xfcf2('0x2b')]){delete _0x56f839[_0xfcf2('0x2b')];}_0x1c8f38['status'](_0x23c09c)[_0xfcf2('0x2c')](_0x56f839);};}exports['index']=function(_0x3ce9f8,_0x26651e){var _0x40c1ae={},_0x1a4485={},_0x313884={'count':0x0,'rows':[]};var _0x3760ad=_[_0xfcf2('0x2d')](db['ContactItemType']['rawAttributes'],function(_0xfc3b86){return{'name':_0xfc3b86[_0xfcf2('0x2e')],'type':_0xfc3b86[_0xfcf2('0x2f')][_0xfcf2('0x30')]};});_0x1a4485['model']=_['map'](_0x3760ad,_0xfcf2('0x2b'));_0x1a4485['query']=_[_0xfcf2('0x31')](_0x3ce9f8[_0xfcf2('0x32')]);_0x1a4485['filters']=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],_0x1a4485[_0xfcf2('0x32')]);_0x40c1ae[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x3ce9f8['query'][_0xfcf2('0x36')]));_0x40c1ae[_0xfcf2('0x35')]=_0x40c1ae['attributes'][_0xfcf2('0x37')]?_0x40c1ae[_0xfcf2('0x35')]:_0x1a4485['model'];if(!_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x38')]('nolimit')){_0x40c1ae[_0xfcf2('0x1e')]=qs[_0xfcf2('0x1e')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1e')]);_0x40c1ae['offset']=qs[_0xfcf2('0x1b')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1b')]);}_0x40c1ae[_0xfcf2('0x39')]=qs[_0xfcf2('0x3a')](_0x3ce9f8['query'][_0xfcf2('0x3a')]);_0x40c1ae[_0xfcf2('0x3b')]=qs[_0xfcf2('0x3c')](_[_0xfcf2('0x3d')](_0x3ce9f8[_0xfcf2('0x32')],_0x1a4485['filters']),_0x3760ad);if(_0x3ce9f8[_0xfcf2('0x32')]['filter']){_0x40c1ae[_0xfcf2('0x3b')]=_[_0xfcf2('0x3e')](_0x40c1ae[_0xfcf2('0x3b')],{'$or':_[_0xfcf2('0x2d')](_0x3760ad,function(_0x2fd2ef){if(_0x2fd2ef['type']!==_0xfcf2('0x3f')){var _0x341505={};_0x341505[_0x2fd2ef[_0xfcf2('0x2b')]]={'$like':'%'+_0x3ce9f8['query'][_0xfcf2('0x40')]+'%'};return _0x341505;}})});}_0x40c1ae=_[_0xfcf2('0x3e')]({},_0x40c1ae,_0x3ce9f8[_0xfcf2('0x41')]);var _0x320c19={'where':_0x40c1ae[_0xfcf2('0x3b')]};return db[_0xfcf2('0x42')]['count'](_0x320c19)['then'](function(_0x526c42){_0x313884[_0xfcf2('0x1d')]=_0x526c42;if(_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x43')]){_0x40c1ae['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x40c1ae);})[_0xfcf2('0x24')](function(_0xab0747){_0x313884[_0xfcf2('0x44')]=_0xab0747;return _0x313884;})[_0xfcf2('0x24')](respondWithFilteredResult(_0x26651e,_0x40c1ae))[_0xfcf2('0x45')](handleError(_0x26651e,null));};exports[_0xfcf2('0x46')]=function(_0x2c8ba2,_0x16cc21){var _0x2b790b={'raw':!![],'where':{'id':_0x2c8ba2[_0xfcf2('0x47')]['id']}},_0x467ecd={};_0x467ecd['model']=_['keys'](db[_0xfcf2('0x42')][_0xfcf2('0x48')]);_0x467ecd[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](_0x2c8ba2[_0xfcf2('0x32')]);_0x467ecd[_0xfcf2('0x3c')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],_0x467ecd[_0xfcf2('0x32')]);_0x2b790b[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x2c8ba2[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x2b790b[_0xfcf2('0x35')]=_0x2b790b[_0xfcf2('0x35')]['length']?_0x2b790b[_0xfcf2('0x35')]:_0x467ecd[_0xfcf2('0x34')];if(_0x2c8ba2['query'][_0xfcf2('0x43')]){_0x2b790b['include']=[{'all':!![]}];}_0x2b790b=_[_0xfcf2('0x3e')]({},_0x2b790b,_0x2c8ba2[_0xfcf2('0x41')]);return db[_0xfcf2('0x42')][_0xfcf2('0x49')](_0x2b790b)['then'](handleEntityNotFound(_0x16cc21,null))['then'](respondWithResult(_0x16cc21,null))['catch'](handleError(_0x16cc21,null));};exports[_0xfcf2('0x4a')]=function(_0x37d4bb,_0x20fcab){return db[_0xfcf2('0x42')]['create'](_0x37d4bb[_0xfcf2('0x4b')],{})[_0xfcf2('0x24')](function(_0x3b981c){var _0x548c6c=_0x37d4bb[_0xfcf2('0x4c')][_0xfcf2('0x4d')]({'plain':!![]});if(!_0x548c6c)throw new Error(_0xfcf2('0x4e'));if(_0x548c6c[_0xfcf2('0x4f')]===_0xfcf2('0x4c')){var _0x4af270=_0x3b981c[_0xfcf2('0x4d')]({'plain':!![]});var _0x1260a4=_0xfcf2('0x25');return db[_0xfcf2('0x50')][_0xfcf2('0x49')]({'where':{'name':_0x1260a4,'userProfileId':_0x548c6c[_0xfcf2('0x51')]},'raw':!![]})['then'](function(_0x5d162d){if(_0x5d162d&&_0x5d162d['autoAssociation']===0x0){return db[_0xfcf2('0x26')][_0xfcf2('0x4a')]({'name':_0x4af270['name'],'resourceId':_0x4af270['id'],'type':_0x5d162d['name'],'sectionId':_0x5d162d['id']},{})[_0xfcf2('0x24')](function(){return _0x3b981c;});}else{return _0x3b981c;}})[_0xfcf2('0x45')](function(_0x137a47){logger['error'](_0xfcf2('0x52'),_0x137a47);throw _0x137a47;});}return _0x3b981c;})[_0xfcf2('0x24')](respondWithResult(_0x20fcab,0xc9))['catch'](handleError(_0x20fcab,null));};exports['update']=function(_0xfc4b7b,_0x51f636){if(_0xfc4b7b[_0xfcf2('0x4b')]['id']){delete _0xfc4b7b[_0xfcf2('0x4b')]['id'];}return db['ContactItemType'][_0xfcf2('0x49')]({'where':{'id':_0xfc4b7b['params']['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x51f636,null))['then'](saveUpdates(_0xfc4b7b[_0xfcf2('0x4b')],null))[_0xfcf2('0x24')](respondWithResult(_0x51f636,null))[_0xfcf2('0x45')](handleError(_0x51f636,null));};exports['destroy']=function(_0x235b06,_0x27bae5){return db[_0xfcf2('0x42')][_0xfcf2('0x49')]({'where':{'id':_0x235b06[_0xfcf2('0x47')]['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x27bae5,null))[_0xfcf2('0x24')](db['CmContactHasItem'][_0xfcf2('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x235b06[_0xfcf2('0x47')]['id']}}))['then'](removeEntity(_0x27bae5,null))[_0xfcf2('0x45')](handleError(_0x27bae5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index d554da3..8b8e9d7 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 _0x2c2a=['./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x4f940b,_0x4c9bf7){var _0x4cae04=function(_0x2a0651){while(--_0x2a0651){_0x4f940b['push'](_0x4f940b['shift']());}};_0x4cae04(++_0x4c9bf7);}(_0x2c2a,0xd6));var _0xa2c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c2a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa2c2('0x0'));var util=require(_0xa2c2('0x1'));var logger=require(_0xa2c2('0x2'))(_0xa2c2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa2c2('0x4'));var fs=require('fs');var path=require(_0xa2c2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa2c2('0x6'));module[_0xa2c2('0x7')]=function(_0x577e96,_0x5069f2){return _0x577e96['define'](_0xa2c2('0x8'),attributes,{'tableName':_0xa2c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe618=['rimraf','../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types','lodash','api','bluebird','request-promise','path'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0xe618,0x74));var _0x8e61=function(_0x39a7b3,_0x9c5210){_0x39a7b3=_0x39a7b3-0x0;var _0x1e25e2=_0xe618[_0x39a7b3];return _0x1e25e2;};'use strict';var _=require(_0x8e61('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8e61('0x1'));var moment=require('moment');var BPromise=require(_0x8e61('0x2'));var rp=require(_0x8e61('0x3'));var fs=require('fs');var path=require(_0x8e61('0x4'));var rimraf=require(_0x8e61('0x5'));var config=require(_0x8e61('0x6'));var attributes=require(_0x8e61('0x7'));module[_0x8e61('0x8')]=function(_0x242365,_0x36e58d){return _0x242365[_0x8e61('0x9')]('ContactItemType',attributes,{'tableName':_0x8e61('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 4f97f0c..8649361 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 _0xa8ac=['catch','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0xff46f6,_0x354320){var _0x1f8791=function(_0x146f21){while(--_0x146f21){_0xff46f6['push'](_0xff46f6['shift']());}};_0x1f8791(++_0x354320);}(_0xa8ac,0xd9));var _0xca8a=function(_0x1bf781,_0x2d2862){_0x1bf781=_0x1bf781-0x0;var _0x23886c=_0xa8ac[_0x1bf781];return _0x23886c;};'use strict';var _=require('lodash');var util=require(_0xca8a('0x0'));var moment=require(_0xca8a('0x1'));var BPromise=require('bluebird');var rs=require(_0xca8a('0x2'));var fs=require('fs');var Redis=require(_0xca8a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xca8a('0x4'))('rpc');var config=require(_0xca8a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xca8a('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c494b,_0x5073d9,_0x44e1fe){return new BPromise(function(_0x93b7ed,_0x42f227){return client[_0xca8a('0x7')](_0x3c494b,_0x44e1fe)[_0xca8a('0x8')](function(_0x476420){logger[_0xca8a('0x9')](_0xca8a('0xa'),_0x5073d9,_0xca8a('0xb'));logger[_0xca8a('0xc')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x5073d9,_0xca8a('0xb'),JSON['stringify'](_0x476420));if(_0x476420[_0xca8a('0xd')]){if(_0x476420[_0xca8a('0xd')][_0xca8a('0xe')]===0x1f4){logger[_0xca8a('0xd')](_0xca8a('0xa'),_0x5073d9,_0x476420[_0xca8a('0xd')][_0xca8a('0xf')]);return _0x42f227(_0x476420[_0xca8a('0xd')][_0xca8a('0xf')]);}logger['error'](_0xca8a('0xa'),_0x5073d9,_0x476420[_0xca8a('0xd')][_0xca8a('0xf')]);return _0x93b7ed(_0x476420['error'][_0xca8a('0xf')]);}else{logger[_0xca8a('0x9')]('ContactItemType,\x20%s,\x20%s',_0x5073d9,'request\x20sent');_0x93b7ed(_0x476420[_0xca8a('0x10')][_0xca8a('0xf')]);}})[_0xca8a('0x11')](function(_0x32732b){logger[_0xca8a('0xd')](_0xca8a('0xa'),_0x5073d9,_0x32732b);_0x42f227(_0x32732b);});});} \ No newline at end of file +var _0xe85b=['message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0xe85b,0x18a));var _0xbe85=function(_0x3bbb66,_0x280aa2){_0x3bbb66=_0x3bbb66-0x0;var _0x872225=_0xe85b[_0x3bbb66];return _0x872225;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbe85('0x0'));var BPromise=require('bluebird');var rs=require(_0xbe85('0x1'));var fs=require('fs');var Redis=require(_0xbe85('0x2'));var db=require(_0xbe85('0x3'))['db'];var utils=require(_0xbe85('0x4'));var logger=require(_0xbe85('0x5'))(_0xbe85('0x6'));var config=require(_0xbe85('0x7'));var jayson=require(_0xbe85('0x8'));var client=jayson[_0xbe85('0x9')][_0xbe85('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x408faf,_0x449bbd,_0x377d06){return new BPromise(function(_0x5a511a,_0x4e9b7d){return client[_0xbe85('0xb')](_0x408faf,_0x377d06)[_0xbe85('0xc')](function(_0x33d770){logger[_0xbe85('0xd')](_0xbe85('0xe'),_0x449bbd,_0xbe85('0xf'));logger[_0xbe85('0x10')](_0xbe85('0x11'),_0x449bbd,_0xbe85('0xf'),JSON['stringify'](_0x33d770));if(_0x33d770[_0xbe85('0x12')]){if(_0x33d770[_0xbe85('0x12')][_0xbe85('0x13')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x449bbd,_0x33d770[_0xbe85('0x12')][_0xbe85('0x14')]);return _0x4e9b7d(_0x33d770['error'][_0xbe85('0x14')]);}logger[_0xbe85('0x12')](_0xbe85('0xe'),_0x449bbd,_0x33d770[_0xbe85('0x12')][_0xbe85('0x14')]);return _0x5a511a(_0x33d770[_0xbe85('0x12')][_0xbe85('0x14')]);}else{logger[_0xbe85('0xd')]('ContactItemType,\x20%s,\x20%s',_0x449bbd,_0xbe85('0xf'));_0x5a511a(_0x33d770[_0xbe85('0x15')][_0xbe85('0x14')]);}})[_0xbe85('0x16')](function(_0x57be30){logger[_0xbe85('0x12')](_0xbe85('0xe'),_0x449bbd,_0x57be30);_0x4e9b7d(_0x57be30);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 2ef7e3e..1ecf601 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 _0x0e03=['exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','show','post','put','/:id','delete','destroy'];(function(_0x39a04c,_0x2b4002){var _0x580cb0=function(_0x138902){while(--_0x138902){_0x39a04c['push'](_0x39a04c['shift']());}};_0x580cb0(++_0x2b4002);}(_0x0e03,0xeb));var _0x30e0=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x0e03[_0x2afbb0];return _0x411ff2;};'use strict';var multer=require('multer');var util=require(_0x30e0('0x0'));var path=require(_0x30e0('0x1'));var timeout=require(_0x30e0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x30e0('0x3'));var auth=require(_0x30e0('0x4'));var interaction=require(_0x30e0('0x5'));var config=require(_0x30e0('0x6'));var controller=require(_0x30e0('0x7'));router[_0x30e0('0x8')]('/',auth[_0x30e0('0x9')](),controller[_0x30e0('0xa')]);router[_0x30e0('0x8')]('/:id',auth[_0x30e0('0x9')](),controller[_0x30e0('0xb')]);router[_0x30e0('0xc')]('/',auth[_0x30e0('0x9')](),controller['create']);router[_0x30e0('0xd')](_0x30e0('0xe'),auth[_0x30e0('0x9')](),controller['update']);router[_0x30e0('0xf')](_0x30e0('0xe'),auth[_0x30e0('0x9')](),controller[_0x30e0('0x10')]);module[_0x30e0('0x11')]=router; \ No newline at end of file +var _0x6f0d=['delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put'];(function(_0x3a19cc,_0x8690b){var _0x36c4c8=function(_0xf5bf26){while(--_0xf5bf26){_0x3a19cc['push'](_0x3a19cc['shift']());}};_0x36c4c8(++_0x8690b);}(_0x6f0d,0x68));var _0xd6f0=function(_0x47245e,_0x482752){_0x47245e=_0x47245e-0x0;var _0x5f3075=_0x6f0d[_0x47245e];return _0x5f3075;};'use strict';var multer=require(_0xd6f0('0x0'));var util=require(_0xd6f0('0x1'));var path=require('path');var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express[_0xd6f0('0x4')]();var fs_extra=require(_0xd6f0('0x5'));var auth=require(_0xd6f0('0x6'));var interaction=require(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var controller=require('./contactItemType.controller');router[_0xd6f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd6f0('0x9')](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0xd')]('/',auth[_0xd6f0('0xb')](),controller['create']);router[_0xd6f0('0xe')](_0xd6f0('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xd6f0('0xf')](_0xd6f0('0xa'),auth[_0xd6f0('0xb')](),controller['destroy']);module[_0xd6f0('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 903b3c0..692d896 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x4186f7,_0x411f7d){var _0x2ebaaf=function(_0x399d6a){while(--_0x399d6a){_0x4186f7['push'](_0x4186f7['shift']());}};_0x2ebaaf(++_0x411f7d);}(_0x757a,0xde));var _0xa757=function(_0x2f5cce,_0x48ea34){_0x2f5cce=_0x2f5cce-0x0;var _0x282463=_0x757a[_0x2f5cce];return _0x282463;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x39e0d1,_0x3f1aeb){var _0x28c159=function(_0x1a0018){while(--_0x1a0018){_0x39e0d1['push'](_0x39e0d1['shift']());}};_0x28c159(++_0x3f1aeb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 5befbd8..a39d0aa 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 _0xef3c=['CustomDashboards','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','include','createdAt','updatedAt','omit','UserProfileSection','autoAssociation','attrUrl','attrs','value','https://','custom','clock','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x58f3e8,_0x361d54){var _0x5657c1=function(_0x5598bd){while(--_0x5598bd){_0x58f3e8['push'](_0x58f3e8['shift']());}};_0x5657c1(++_0x361d54);}(_0xef3c,0x129));var _0xcef3=function(_0x4c07be,_0x35ac9e){_0x4c07be=_0x4c07be-0x0;var _0x50c460=_0xef3c[_0x4c07be];return _0x50c460;};'use strict';var emlformat=require(_0xcef3('0x0'));var rimraf=require(_0xcef3('0x1'));var zipdir=require(_0xcef3('0x2'));var jsonpatch=require(_0xcef3('0x3'));var rp=require(_0xcef3('0x4'));var moment=require(_0xcef3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcef3('0x6'));var util=require(_0xcef3('0x7'));var path=require(_0xcef3('0x8'));var sox=require(_0xcef3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcef3('0xa'));var _=require(_0xcef3('0xb'));var squel=require(_0xcef3('0xc'));var crypto=require(_0xcef3('0xd'));var jsforce=require(_0xcef3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcef3('0xf'));var querystring=require('querystring');var Papa=require(_0xcef3('0x10'));var Redis=require(_0xcef3('0x11'));var authService=require(_0xcef3('0x12'));var qs=require(_0xcef3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcef3('0x14'));var logger=require('../../config/logger')(_0xcef3('0x15'));var utils=require(_0xcef3('0x16'));var config=require(_0xcef3('0x17'));var licenseUtil=require(_0xcef3('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xcef3('0x19')](config[_0xcef3('0x1a')],{'host':_0xcef3('0x1b'),'port':0x18eb});var socket=require(_0xcef3('0x1c'))(new Redis(config[_0xcef3('0x1a')]));require(_0xcef3('0x1d'))['register'](socket);function respondWithStatusCode(_0x292eab,_0x1847b3){_0x1847b3=_0x1847b3||0xcc;return function(_0x4d5979){if(_0x4d5979){return _0x292eab['sendStatus'](_0x1847b3);}return _0x292eab[_0xcef3('0x1e')](_0x1847b3)[_0xcef3('0x1f')]();};}function respondWithResult(_0x232aa7,_0x39619e){_0x39619e=_0x39619e||0xc8;return function(_0x376196){if(_0x376196){return _0x232aa7[_0xcef3('0x1e')](_0x39619e)[_0xcef3('0x20')](_0x376196);}};}function respondWithFilteredResult(_0x51b902,_0x392bd4){return function(_0x7262d3){if(_0x7262d3){var _0x193db3=typeof _0x392bd4[_0xcef3('0x21')]==='undefined'&&typeof _0x392bd4['limit']==='undefined';var _0x4b3624=_0x7262d3[_0xcef3('0x22')];var _0x10f414=_0x193db3?0x0:_0x392bd4['offset'];var _0x3d8784=_0x193db3?_0x7262d3[_0xcef3('0x22')]:_0x392bd4[_0xcef3('0x21')]+_0x392bd4[_0xcef3('0x23')];var _0x11b7e8;if(_0x3d8784>=_0x4b3624){_0x3d8784=_0x4b3624;_0x11b7e8=0xc8;}else{_0x11b7e8=0xce;}_0x51b902[_0xcef3('0x1e')](_0x11b7e8);return _0x51b902[_0xcef3('0x24')](_0xcef3('0x25'),_0x10f414+'-'+_0x3d8784+'/'+_0x4b3624)['json'](_0x7262d3);}return null;};}function patchUpdates(_0x265453){return function(_0x396fda){try{jsonpatch[_0xcef3('0x26')](_0x396fda,_0x265453,!![]);}catch(_0xcb9206){return BPromise[_0xcef3('0x27')](_0xcb9206);}return _0x396fda['save']();};}function saveUpdates(_0x2fe346,_0x37f020){return function(_0x2071b7){if(_0x2071b7){return _0x2071b7[_0xcef3('0x28')](_0x2fe346)['then'](function(_0x5210f9){return _0x5210f9;});}return null;};}function removeEntity(_0x222891,_0x298e66){return function(_0x3a2c44){if(_0x3a2c44){return _0x3a2c44[_0xcef3('0x29')]()[_0xcef3('0x2a')](function(){var _0x3349d6=_0x3a2c44['get']({'plain':!![]});var _0x35cf62='CustomDashboards';return db[_0xcef3('0x2b')][_0xcef3('0x29')]({'where':{'type':_0x35cf62,'resourceId':_0x3349d6['id']}})[_0xcef3('0x2a')](function(){return _0x3a2c44;});})['then'](function(){_0x222891[_0xcef3('0x1e')](0xcc)[_0xcef3('0x1f')]();});}};}function handleEntityNotFound(_0x33039b,_0x20b572){return function(_0x535e65){if(!_0x535e65){_0x33039b['sendStatus'](0x194);}return _0x535e65;};}function handleError(_0x5b4927,_0x582d69){_0x582d69=_0x582d69||0x1f4;return function(_0xedc091){logger[_0xcef3('0x2c')](_0xedc091[_0xcef3('0x2d')]);if(_0xedc091[_0xcef3('0x2e')]){delete _0xedc091[_0xcef3('0x2e')];}_0x5b4927[_0xcef3('0x1e')](_0x582d69)[_0xcef3('0x2f')](_0xedc091);};}exports[_0xcef3('0x30')]=function(_0x2dce81,_0x1748a9){var _0x5b2f66={},_0x2c5ad3={},_0x5f310c={'count':0x0,'rows':[]};var _0x4fa166=_[_0xcef3('0x31')](db[_0xcef3('0x32')][_0xcef3('0x33')],function(_0x49f21d){return{'name':_0x49f21d[_0xcef3('0x34')],'type':_0x49f21d[_0xcef3('0x35')][_0xcef3('0x36')]};});_0x2c5ad3['model']=_['map'](_0x4fa166,'name');_0x2c5ad3[_0xcef3('0x37')]=_[_0xcef3('0x38')](_0x2dce81[_0xcef3('0x37')]);_0x2c5ad3[_0xcef3('0x39')]=_[_0xcef3('0x3a')](_0x2c5ad3['model'],_0x2c5ad3[_0xcef3('0x37')]);_0x5b2f66['attributes']=_[_0xcef3('0x3a')](_0x2c5ad3[_0xcef3('0x3b')],qs['fields'](_0x2dce81[_0xcef3('0x37')][_0xcef3('0x3c')]));_0x5b2f66[_0xcef3('0x3d')]=_0x5b2f66['attributes'][_0xcef3('0x3e')]?_0x5b2f66[_0xcef3('0x3d')]:_0x2c5ad3[_0xcef3('0x3b')];if(!_0x2dce81['query'][_0xcef3('0x3f')](_0xcef3('0x40'))){_0x5b2f66['limit']=qs['limit'](_0x2dce81[_0xcef3('0x37')]['limit']);_0x5b2f66[_0xcef3('0x21')]=qs[_0xcef3('0x21')](_0x2dce81['query'][_0xcef3('0x21')]);}_0x5b2f66[_0xcef3('0x41')]=qs[_0xcef3('0x42')](_0x2dce81[_0xcef3('0x37')][_0xcef3('0x42')]);_0x5b2f66[_0xcef3('0x43')]=qs[_0xcef3('0x39')](_[_0xcef3('0x44')](_0x2dce81[_0xcef3('0x37')],_0x2c5ad3[_0xcef3('0x39')]),_0x4fa166);if(_0x2dce81[_0xcef3('0x37')]['filter']){_0x5b2f66[_0xcef3('0x43')]=_[_0xcef3('0x45')](_0x5b2f66[_0xcef3('0x43')],{'$or':_[_0xcef3('0x31')](_0x4fa166,function(_0x2609e7){if(_0x2609e7['type']!==_0xcef3('0x46')){var _0x27aa5e={};_0x27aa5e[_0x2609e7[_0xcef3('0x2e')]]={'$like':'%'+_0x2dce81[_0xcef3('0x37')]['filter']+'%'};return _0x27aa5e;}})});}_0x5b2f66=_[_0xcef3('0x45')]({},_0x5b2f66,_0x2dce81[_0xcef3('0x47')]);var _0x1baf78={'where':_0x5b2f66[_0xcef3('0x43')]};return db[_0xcef3('0x32')]['count'](_0x1baf78)[_0xcef3('0x2a')](function(_0x1f2bad){_0x5f310c[_0xcef3('0x22')]=_0x1f2bad;if(_0x2dce81[_0xcef3('0x37')][_0xcef3('0x48')]){_0x5b2f66['include']=[{'all':!![]}];}return db[_0xcef3('0x32')][_0xcef3('0x49')](_0x5b2f66);})[_0xcef3('0x2a')](function(_0x327fde){_0x5f310c[_0xcef3('0x4a')]=_0x327fde;return _0x5f310c;})[_0xcef3('0x2a')](respondWithFilteredResult(_0x1748a9,_0x5b2f66))[_0xcef3('0x4b')](handleError(_0x1748a9,null));};exports[_0xcef3('0x4c')]=function(_0x14a411,_0x571757){var _0x5544f1={'raw':![],'where':{'id':_0x14a411['params']['id']}},_0x21f0b3={};_0x21f0b3['model']=_[_0xcef3('0x38')](db['Dashboard'][_0xcef3('0x33')]);_0x21f0b3['query']=_[_0xcef3('0x38')](_0x14a411[_0xcef3('0x37')]);_0x21f0b3[_0xcef3('0x39')]=_['intersection'](_0x21f0b3['model'],_0x21f0b3[_0xcef3('0x37')]);_0x5544f1[_0xcef3('0x3d')]=_[_0xcef3('0x3a')](_0x21f0b3[_0xcef3('0x3b')],qs[_0xcef3('0x3c')](_0x14a411[_0xcef3('0x37')][_0xcef3('0x3c')]));_0x5544f1[_0xcef3('0x3d')]=_0x5544f1[_0xcef3('0x3d')][_0xcef3('0x3e')]?_0x5544f1[_0xcef3('0x3d')]:_0x21f0b3[_0xcef3('0x3b')];if(_0x14a411['query']['includeAll']){_0x5544f1['include']=[{'all':!![]}];}_0x5544f1=_[_0xcef3('0x45')]({},_0x5544f1,_0x14a411[_0xcef3('0x47')]);return db[_0xcef3('0x32')][_0xcef3('0x4d')](_0x5544f1)[_0xcef3('0x2a')](handleEntityNotFound(_0x571757,null))[_0xcef3('0x2a')](respondWithResult(_0x571757,null))[_0xcef3('0x4b')](handleError(_0x571757,null));};exports['create']=function(_0x4901fc,_0x10c915){return db[_0xcef3('0x32')][_0xcef3('0x4e')](_0x4901fc[_0xcef3('0x4f')],{})[_0xcef3('0x2a')](function(_0x39390f){var _0x4cde71=_0x4901fc[_0xcef3('0x50')][_0xcef3('0x51')]({'plain':!![]});if(!_0x4cde71)throw new Error(_0xcef3('0x52'));if(_0x4cde71[_0xcef3('0x53')]===_0xcef3('0x50')){var _0x1c2980=_0x39390f[_0xcef3('0x51')]({'plain':!![]});var _0x460b7e=_0xcef3('0x54');return db['UserProfileSection'][_0xcef3('0x4d')]({'where':{'name':_0x460b7e,'userProfileId':_0x4cde71[_0xcef3('0x55')]},'raw':!![]})[_0xcef3('0x2a')](function(_0x249fd5){if(_0x249fd5&&_0x249fd5['autoAssociation']===0x0){return db[_0xcef3('0x2b')]['create']({'name':_0x1c2980[_0xcef3('0x2e')],'resourceId':_0x1c2980['id'],'type':_0x249fd5[_0xcef3('0x2e')],'sectionId':_0x249fd5['id']},{})[_0xcef3('0x2a')](function(){return _0x39390f;});}else{return _0x39390f;}})[_0xcef3('0x4b')](function(_0x4b8099){logger[_0xcef3('0x2c')](_0xcef3('0x56'),_0x4b8099);throw _0x4b8099;});}return _0x39390f;})['then'](respondWithResult(_0x10c915,0xc9))[_0xcef3('0x4b')](handleError(_0x10c915,null));};exports[_0xcef3('0x57')]=function(_0x4fecae,_0x19fec2){var _0x2971f6={'where':{'id':_0x4fecae[_0xcef3('0x58')]['id']}},_0x34986e={};_0x34986e[_0xcef3('0x3b')]=_[_0xcef3('0x38')](db['Dashboard'][_0xcef3('0x33')]);_0x2971f6[_0xcef3('0x3d')]=_['intersection'](_0x34986e['model'],qs[_0xcef3('0x3c')](_0x4fecae[_0xcef3('0x37')][_0xcef3('0x3c')]));_0x2971f6['attributes']=_0x2971f6[_0xcef3('0x3d')]['length']?_0x2971f6[_0xcef3('0x3d')]:_0x34986e[_0xcef3('0x3b')];if(_0x4fecae[_0xcef3('0x37')][_0xcef3('0x48')]){_0x2971f6[_0xcef3('0x59')]=[{'all':!![]}];}_0x2971f6=_[_0xcef3('0x45')]({},_0x2971f6,_0x4fecae[_0xcef3('0x47')]);return db[_0xcef3('0x32')][_0xcef3('0x4d')](_0x2971f6)[_0xcef3('0x2a')](handleEntityNotFound(_0x19fec2,null))[_0xcef3('0x2a')](function(_0x5dcade){if(_0x5dcade){var _0x2e3ea9=_0x5dcade[_0xcef3('0x51')]({'plain':!![]});_0x2e3ea9=qs['omit'](_0x2e3ea9,['id',_0xcef3('0x5a'),_0xcef3('0x5b')]);_0x4fecae[_0xcef3('0x4f')]=_[_0xcef3('0x5c')](_0x4fecae[_0xcef3('0x4f')],['id',_0xcef3('0x5a'),'updatedAt']);return db[_0xcef3('0x32')][_0xcef3('0x4e')](_[_0xcef3('0x45')](_0x2e3ea9,_0x4fecae[_0xcef3('0x4f')]),{'include':_0x4fecae[_0xcef3('0x37')][_0xcef3('0x48')]?[{'all':!![]}]:undefined})[_0xcef3('0x2a')](function(_0x2fab0d){var _0x21b137=_0x4fecae[_0xcef3('0x50')][_0xcef3('0x51')]({'plain':!![]});if(!_0x21b137)throw new Error(_0xcef3('0x52'));if(_0x21b137[_0xcef3('0x53')]===_0xcef3('0x50')){var _0x4699ea=_0x2fab0d[_0xcef3('0x51')]({'plain':!![]});var _0x290fa0=_0xcef3('0x54');return db[_0xcef3('0x5d')][_0xcef3('0x4d')]({'where':{'name':_0x290fa0,'userProfileId':_0x21b137[_0xcef3('0x55')]},'raw':!![]})[_0xcef3('0x2a')](function(_0x440806){if(_0x440806&&_0x440806[_0xcef3('0x5e')]===0x0){return db[_0xcef3('0x2b')][_0xcef3('0x4e')]({'name':_0x4699ea[_0xcef3('0x2e')],'resourceId':_0x4699ea['id'],'type':_0x440806[_0xcef3('0x2e')],'sectionId':_0x440806['id']},{})[_0xcef3('0x2a')](function(){return _0x2fab0d;});}else{return _0x2fab0d;}})['catch'](function(_0x2b3603){logger[_0xcef3('0x2c')](_0xcef3('0x56'),_0x2b3603);throw _0x2b3603;});}return _0x2fab0d;});}})['then'](respondWithResult(_0x19fec2,0xc9))[_0xcef3('0x4b')](handleError(_0x19fec2,null));};exports['update']=function(_0x597868,_0x3fbef1){if(_0x597868[_0xcef3('0x4f')]['id']){delete _0x597868[_0xcef3('0x4f')]['id'];}return db[_0xcef3('0x32')][_0xcef3('0x4d')]({'where':{'id':_0x597868[_0xcef3('0x58')]['id']}})[_0xcef3('0x2a')](handleEntityNotFound(_0x3fbef1,null))[_0xcef3('0x2a')](saveUpdates(_0x597868[_0xcef3('0x4f')],null))[_0xcef3('0x2a')](respondWithResult(_0x3fbef1,null))[_0xcef3('0x4b')](handleError(_0x3fbef1,null));};exports['destroy']=function(_0x2fb371,_0x23c75f){return db['Dashboard'][_0xcef3('0x4d')]({'where':{'id':_0x2fb371[_0xcef3('0x58')]['id']}})[_0xcef3('0x2a')](handleEntityNotFound(_0x23c75f,null))[_0xcef3('0x2a')](removeEntity(_0x23c75f,null))[_0xcef3('0x4b')](handleError(_0x23c75f,null));};function widgetAttributes(_0x139c23){try{switch(_0x139c23[_0xcef3('0x35')]){case'iframe':return[{'name':_0xcef3('0x5f'),'value':_0x139c23[_0xcef3('0x5f')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x0]?_0x139c23[_0xcef3('0x60')][0x0][_0xcef3('0x61')]:undefined)||_0xcef3('0x62')}];case _0xcef3('0x63'):return[{'name':'attrPath','value':_0x139c23['attrPath']||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x0]?_0x139c23[_0xcef3('0x60')][0x0][_0xcef3('0x61')]:undefined)||''}];case _0xcef3('0x64'):return[{'name':'attrHourFormat','value':_0x139c23['attrHourFormat']||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x0]?_0x139c23[_0xcef3('0x60')][0x0][_0xcef3('0x61')]:undefined)||_0xcef3('0x65')},{'name':_0xcef3('0x66'),'value':_0x139c23[_0xcef3('0x66')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x1]?_0x139c23[_0xcef3('0x60')][0x1][_0xcef3('0x61')]:undefined)||'0.00'},{'name':_0xcef3('0x67'),'value':_0x139c23[_0xcef3('0x67')]||(_0x139c23['attrs']&&_0x139c23['attrs'][0x2]?_0x139c23[_0xcef3('0x60')][0x2][_0xcef3('0x61')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x139c23[_0xcef3('0x68')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x0]?_0x139c23['attrs'][0x0]['value']:undefined)||_0xcef3('0x69')},{'name':_0xcef3('0x6a'),'value':_0x139c23[_0xcef3('0x6a')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x1]?_0x139c23['attrs'][0x1][_0xcef3('0x61')]:undefined)||[]},{'name':_0xcef3('0x67'),'value':_0x139c23[_0xcef3('0x67')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x2]?_0x139c23['attrs'][0x2][_0xcef3('0x61')]:undefined)||0x14},{'name':_0xcef3('0x6b'),'value':_0x139c23[_0xcef3('0x6b')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x3]?_0x139c23[_0xcef3('0x60')][0x3][_0xcef3('0x61')]:undefined)||_0xcef3('0x6c')},{'name':'attrEmailAccounts','value':_0x139c23[_0xcef3('0x6d')]||(_0x139c23['attrs']&&_0x139c23['attrs'][0x4]?_0x139c23[_0xcef3('0x60')][0x4][_0xcef3('0x61')]:undefined)||''},{'name':_0xcef3('0x6e'),'value':_0x139c23[_0xcef3('0x6e')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x5]?_0x139c23[_0xcef3('0x60')][0x5][_0xcef3('0x61')]:undefined)||''},{'name':_0xcef3('0x6f'),'value':_0x139c23[_0xcef3('0x6f')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23['attrs'][0x6]?_0x139c23[_0xcef3('0x60')][0x6][_0xcef3('0x61')]:undefined)||''},{'name':_0xcef3('0x70'),'value':_0x139c23[_0xcef3('0x70')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x7]?_0x139c23['attrs'][0x7][_0xcef3('0x61')]:undefined)||''},{'name':_0xcef3('0x71'),'value':_0x139c23['attrWhatsappAccounts']||(_0x139c23['attrs']&&_0x139c23[_0xcef3('0x60')][0x8]?_0x139c23[_0xcef3('0x60')][0x8][_0xcef3('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x139c23[_0xcef3('0x72')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23['attrs'][0x9]?_0x139c23[_0xcef3('0x60')][0x9][_0xcef3('0x61')]:undefined)||''}];case'multibar-chart':case _0xcef3('0x73'):return[{'name':'attrSerie1','value':_0x139c23[_0xcef3('0x74')]||(_0x139c23['attrs']&&_0x139c23['attrs'][0x0]?_0x139c23[_0xcef3('0x60')][0x0][_0xcef3('0x61')]:undefined)||_0xcef3('0x69')},{'name':_0xcef3('0x75'),'value':_0x139c23[_0xcef3('0x75')]||(_0x139c23['attrs']&&_0x139c23[_0xcef3('0x60')][0x1]?_0x139c23[_0xcef3('0x60')][0x1][_0xcef3('0x61')]:undefined)||null},{'name':'attrSerie3','value':_0x139c23[_0xcef3('0x76')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23['attrs'][0x2]?_0x139c23[_0xcef3('0x60')][0x2][_0xcef3('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x139c23[_0xcef3('0x6a')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23['attrs'][0x3]?_0x139c23[_0xcef3('0x60')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x139c23[_0xcef3('0x6b')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x4]?_0x139c23['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0xcef3('0x6d'),'value':_0x139c23['attrEmailAccounts']||(_0x139c23['attrs']&&_0x139c23[_0xcef3('0x60')][0x5]?_0x139c23['attrs'][0x5][_0xcef3('0x61')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x139c23[_0xcef3('0x6e')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23['attrs'][0x6]?_0x139c23[_0xcef3('0x60')][0x6][_0xcef3('0x61')]:undefined)||''},{'name':_0xcef3('0x6f'),'value':_0x139c23['attrSmsAccounts']||(_0x139c23['attrs']&&_0x139c23[_0xcef3('0x60')][0x7]?_0x139c23[_0xcef3('0x60')][0x7]['value']:undefined)||''},{'name':_0xcef3('0x70'),'value':_0x139c23[_0xcef3('0x70')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x8]?_0x139c23[_0xcef3('0x60')][0x8][_0xcef3('0x61')]:undefined)||''},{'name':_0xcef3('0x71'),'value':_0x139c23['attrWhatsappAccounts']||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x9]?_0x139c23[_0xcef3('0x60')][0x9][_0xcef3('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x139c23[_0xcef3('0x72')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0xa]?_0x139c23[_0xcef3('0x60')][0xa][_0xcef3('0x61')]:undefined)||''}];case'web-report':return[{'name':_0xcef3('0x77'),'type':_0x139c23['reportType']||(_0x139c23['attrs']&&_0x139c23['attrs'][0x0]?_0x139c23['attrs'][0x0]['type']:undefined)||null,'value':_0x139c23['attrReport']||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x0]?_0x139c23['attrs'][0x0][_0xcef3('0x61')]:undefined)||null},{'name':_0xcef3('0x78'),'value':_0x139c23[_0xcef3('0x78')]||(_0x139c23[_0xcef3('0x60')]&&_0x139c23[_0xcef3('0x60')][0x1]?_0x139c23[_0xcef3('0x60')][0x1][_0xcef3('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x5971d1){logger['error'](_0xcef3('0x79'),JSON[_0xcef3('0x7a')](_0x5971d1));return[];}}exports[_0xcef3('0x7b')]=function(_0x42cb65,_0x5a1baa,_0x4671e6){if(_0x42cb65['body']['id']){delete _0x42cb65[_0xcef3('0x4f')]['id'];}return db[_0xcef3('0x32')][_0xcef3('0x4d')]({'where':{'id':_0x42cb65[_0xcef3('0x58')]['id']}})[_0xcef3('0x2a')](handleEntityNotFound(_0x5a1baa,null))[_0xcef3('0x2a')](function(_0x588da9){if(_0x588da9){_0x42cb65[_0xcef3('0x4f')]['DashboardId']=_0x588da9['id'];_0x42cb65[_0xcef3('0x4f')][_0xcef3('0x60')]=widgetAttributes(_0x42cb65[_0xcef3('0x4f')]);return db[_0xcef3('0x7c')]['create'](_0x42cb65[_0xcef3('0x4f')]);}})[_0xcef3('0x2a')](respondWithResult(_0x5a1baa,null))[_0xcef3('0x4b')](handleError(_0x5a1baa,null));};exports[_0xcef3('0x7d')]=function(_0x1a89f6,_0x36be86,_0x36795c){var _0x4d6b16={};var _0x59b0e5={};var _0x449fd6;var _0x30067e;return db[_0xcef3('0x32')]['findOne']({'where':{'id':_0x1a89f6[_0xcef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x36be86,null))[_0xcef3('0x2a')](function(_0x193b7e){if(_0x193b7e){_0x449fd6=_0x193b7e;_0x59b0e5[_0xcef3('0x3b')]=_[_0xcef3('0x38')](db[_0xcef3('0x7c')]['rawAttributes']);_0x59b0e5[_0xcef3('0x37')]=_[_0xcef3('0x38')](_0x1a89f6[_0xcef3('0x37')]);_0x59b0e5[_0xcef3('0x39')]=_[_0xcef3('0x3a')](_0x59b0e5[_0xcef3('0x3b')],_0x59b0e5['query']);_0x4d6b16['attributes']=_[_0xcef3('0x3a')](_0x59b0e5[_0xcef3('0x3b')],qs[_0xcef3('0x3c')](_0x1a89f6['query'][_0xcef3('0x3c')]));_0x4d6b16['attributes']=_0x4d6b16[_0xcef3('0x3d')]['length']?_0x4d6b16[_0xcef3('0x3d')]:_0x59b0e5['model'];_0x4d6b16['order']=qs[_0xcef3('0x42')](_0x1a89f6[_0xcef3('0x37')]['sort']);_0x4d6b16[_0xcef3('0x43')]=qs['filters'](_['pick'](_0x1a89f6[_0xcef3('0x37')],_0x59b0e5['filters']));if(_0x1a89f6[_0xcef3('0x37')][_0xcef3('0x7e')]){_0x4d6b16[_0xcef3('0x43')]=_['merge'](_0x4d6b16[_0xcef3('0x43')],{'$or':_[_0xcef3('0x31')](_0x4d6b16[_0xcef3('0x3d')],function(_0x153f12){var _0xb9b38={};_0xb9b38[_0x153f12]={'$like':'%'+_0x1a89f6[_0xcef3('0x37')]['filter']+'%'};return _0xb9b38;})});}_0x4d6b16=_[_0xcef3('0x45')]({},_0x4d6b16,_0x1a89f6[_0xcef3('0x47')]);return _0x449fd6[_0xcef3('0x7d')](_0x4d6b16);}})['then'](function(_0x52e134){if(_0x52e134){_0x30067e=_0x52e134[_0xcef3('0x3e')];if(!_0x1a89f6[_0xcef3('0x37')][_0xcef3('0x3f')](_0xcef3('0x40'))){_0x4d6b16[_0xcef3('0x23')]=qs[_0xcef3('0x23')](_0x1a89f6[_0xcef3('0x37')][_0xcef3('0x23')]);_0x4d6b16['offset']=qs['offset'](_0x1a89f6[_0xcef3('0x37')]['offset']);}return _0x449fd6[_0xcef3('0x7d')](_0x4d6b16);}})[_0xcef3('0x2a')](function(_0x57857a){if(_0x57857a){return _0x57857a?{'count':_0x30067e,'rows':_0x57857a}:null;}})[_0xcef3('0x2a')](respondWithResult(_0x36be86,null))[_0xcef3('0x4b')](handleError(_0x36be86,null));}; \ No newline at end of file +var _0xe6d5=['UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards'];(function(_0x3e56fc,_0x336119){var _0x1e866b=function(_0x3dc12a){while(--_0x3dc12a){_0x3e56fc['push'](_0x3e56fc['shift']());}};_0x1e866b(++_0x336119);}(_0xe6d5,0x163));var _0x5e6d=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0xe6d5[_0x59145a];return _0xf04d7;};'use strict';var emlformat=require(_0x5e6d('0x0'));var rimraf=require(_0x5e6d('0x1'));var zipdir=require(_0x5e6d('0x2'));var jsonpatch=require(_0x5e6d('0x3'));var rp=require(_0x5e6d('0x4'));var moment=require(_0x5e6d('0x5'));var BPromise=require(_0x5e6d('0x6'));var Mustache=require(_0x5e6d('0x7'));var util=require('util');var path=require(_0x5e6d('0x8'));var sox=require(_0x5e6d('0x9'));var csv=require(_0x5e6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5e6d('0xb'));var _=require('lodash');var squel=require(_0x5e6d('0xc'));var crypto=require(_0x5e6d('0xd'));var jsforce=require(_0x5e6d('0xe'));var deskjs=require(_0x5e6d('0xf'));var toCsv=require(_0x5e6d('0xa'));var querystring=require(_0x5e6d('0x10'));var Papa=require(_0x5e6d('0x11'));var Redis=require(_0x5e6d('0x12'));var authService=require(_0x5e6d('0x13'));var qs=require(_0x5e6d('0x14'));var as=require(_0x5e6d('0x15'));var hardwareService=require(_0x5e6d('0x16'));var logger=require(_0x5e6d('0x17'))(_0x5e6d('0x18'));var utils=require(_0x5e6d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5e6d('0x1a'));var db=require(_0x5e6d('0x1b'))['db'];config[_0x5e6d('0x1c')]=_['defaults'](config[_0x5e6d('0x1c')],{'host':_0x5e6d('0x1d'),'port':0x18eb});var socket=require(_0x5e6d('0x1e'))(new Redis(config[_0x5e6d('0x1c')]));require(_0x5e6d('0x1f'))[_0x5e6d('0x20')](socket);function respondWithStatusCode(_0x1f653c,_0x4ed514){_0x4ed514=_0x4ed514||0xcc;return function(_0x341b19){if(_0x341b19){return _0x1f653c[_0x5e6d('0x21')](_0x4ed514);}return _0x1f653c[_0x5e6d('0x22')](_0x4ed514)[_0x5e6d('0x23')]();};}function respondWithResult(_0x377fa5,_0x24f3dd){_0x24f3dd=_0x24f3dd||0xc8;return function(_0x3d919a){if(_0x3d919a){return _0x377fa5[_0x5e6d('0x22')](_0x24f3dd)[_0x5e6d('0x24')](_0x3d919a);}};}function respondWithFilteredResult(_0xc41b3d,_0x2869bf){return function(_0x34d2d8){if(_0x34d2d8){var _0x2ed1a7=typeof _0x2869bf['offset']===_0x5e6d('0x25')&&typeof _0x2869bf[_0x5e6d('0x26')]===_0x5e6d('0x25');var _0x5bee40=_0x34d2d8[_0x5e6d('0x27')];var _0x18c314=_0x2ed1a7?0x0:_0x2869bf[_0x5e6d('0x28')];var _0x219ae9=_0x2ed1a7?_0x34d2d8['count']:_0x2869bf[_0x5e6d('0x28')]+_0x2869bf[_0x5e6d('0x26')];var _0x2f2c0a;if(_0x219ae9>=_0x5bee40){_0x219ae9=_0x5bee40;_0x2f2c0a=0xc8;}else{_0x2f2c0a=0xce;}_0xc41b3d['status'](_0x2f2c0a);return _0xc41b3d[_0x5e6d('0x29')](_0x5e6d('0x2a'),_0x18c314+'-'+_0x219ae9+'/'+_0x5bee40)[_0x5e6d('0x24')](_0x34d2d8);}return null;};}function patchUpdates(_0x43808d){return function(_0x160951){try{jsonpatch[_0x5e6d('0x2b')](_0x160951,_0x43808d,!![]);}catch(_0x5816f4){return BPromise[_0x5e6d('0x2c')](_0x5816f4);}return _0x160951[_0x5e6d('0x2d')]();};}function saveUpdates(_0x58d0c0,_0x1c5c6e){return function(_0x21df12){if(_0x21df12){return _0x21df12[_0x5e6d('0x2e')](_0x58d0c0)[_0x5e6d('0x2f')](function(_0x451cb8){return _0x451cb8;});}return null;};}function removeEntity(_0x314eb9,_0x56f411){return function(_0x21d098){if(_0x21d098){return _0x21d098['destroy']()['then'](function(){var _0x458c21=_0x21d098[_0x5e6d('0x30')]({'plain':!![]});var _0x128b1b=_0x5e6d('0x31');return db[_0x5e6d('0x32')]['destroy']({'where':{'type':_0x128b1b,'resourceId':_0x458c21['id']}})['then'](function(){return _0x21d098;});})['then'](function(){_0x314eb9[_0x5e6d('0x22')](0xcc)[_0x5e6d('0x23')]();});}};}function handleEntityNotFound(_0x1f8c52,_0xe17aa){return function(_0x13d915){if(!_0x13d915){_0x1f8c52['sendStatus'](0x194);}return _0x13d915;};}function handleError(_0x399405,_0x362ffb){_0x362ffb=_0x362ffb||0x1f4;return function(_0x33f48f){logger[_0x5e6d('0x33')](_0x33f48f[_0x5e6d('0x34')]);if(_0x33f48f[_0x5e6d('0x35')]){delete _0x33f48f[_0x5e6d('0x35')];}_0x399405[_0x5e6d('0x22')](_0x362ffb)[_0x5e6d('0x36')](_0x33f48f);};}exports[_0x5e6d('0x37')]=function(_0x522d21,_0x547534){var _0x1f73f1={},_0x107472={},_0x20eeab={'count':0x0,'rows':[]};var _0x4d4867=_[_0x5e6d('0x38')](db[_0x5e6d('0x39')][_0x5e6d('0x3a')],function(_0x1bef4c){return{'name':_0x1bef4c['fieldName'],'type':_0x1bef4c[_0x5e6d('0x3b')][_0x5e6d('0x3c')]};});_0x107472[_0x5e6d('0x3d')]=_[_0x5e6d('0x38')](_0x4d4867,_0x5e6d('0x35'));_0x107472[_0x5e6d('0x3e')]=_[_0x5e6d('0x3f')](_0x522d21[_0x5e6d('0x3e')]);_0x107472[_0x5e6d('0x40')]=_[_0x5e6d('0x41')](_0x107472[_0x5e6d('0x3d')],_0x107472[_0x5e6d('0x3e')]);_0x1f73f1['attributes']=_['intersection'](_0x107472['model'],qs[_0x5e6d('0x42')](_0x522d21['query'][_0x5e6d('0x42')]));_0x1f73f1[_0x5e6d('0x43')]=_0x1f73f1[_0x5e6d('0x43')][_0x5e6d('0x44')]?_0x1f73f1[_0x5e6d('0x43')]:_0x107472[_0x5e6d('0x3d')];if(!_0x522d21[_0x5e6d('0x3e')][_0x5e6d('0x45')]('nolimit')){_0x1f73f1[_0x5e6d('0x26')]=qs[_0x5e6d('0x26')](_0x522d21[_0x5e6d('0x3e')][_0x5e6d('0x26')]);_0x1f73f1['offset']=qs[_0x5e6d('0x28')](_0x522d21[_0x5e6d('0x3e')]['offset']);}_0x1f73f1[_0x5e6d('0x46')]=qs['sort'](_0x522d21[_0x5e6d('0x3e')][_0x5e6d('0x47')]);_0x1f73f1['where']=qs[_0x5e6d('0x40')](_[_0x5e6d('0x48')](_0x522d21[_0x5e6d('0x3e')],_0x107472['filters']),_0x4d4867);if(_0x522d21['query']['filter']){_0x1f73f1[_0x5e6d('0x49')]=_[_0x5e6d('0x4a')](_0x1f73f1[_0x5e6d('0x49')],{'$or':_[_0x5e6d('0x38')](_0x4d4867,function(_0x2bc033){if(_0x2bc033['type']!=='VIRTUAL'){var _0x13d8fc={};_0x13d8fc[_0x2bc033[_0x5e6d('0x35')]]={'$like':'%'+_0x522d21[_0x5e6d('0x3e')][_0x5e6d('0x4b')]+'%'};return _0x13d8fc;}})});}_0x1f73f1=_[_0x5e6d('0x4a')]({},_0x1f73f1,_0x522d21[_0x5e6d('0x4c')]);var _0x13a08d={'where':_0x1f73f1[_0x5e6d('0x49')]};return db[_0x5e6d('0x39')]['count'](_0x13a08d)[_0x5e6d('0x2f')](function(_0x1ff357){_0x20eeab['count']=_0x1ff357;if(_0x522d21[_0x5e6d('0x3e')][_0x5e6d('0x4d')]){_0x1f73f1[_0x5e6d('0x4e')]=[{'all':!![]}];}return db[_0x5e6d('0x39')][_0x5e6d('0x4f')](_0x1f73f1);})['then'](function(_0x2ffd0e){_0x20eeab['rows']=_0x2ffd0e;return _0x20eeab;})[_0x5e6d('0x2f')](respondWithFilteredResult(_0x547534,_0x1f73f1))[_0x5e6d('0x50')](handleError(_0x547534,null));};exports[_0x5e6d('0x51')]=function(_0x35e2c9,_0x83926d){var _0x53835b={'raw':![],'where':{'id':_0x35e2c9[_0x5e6d('0x52')]['id']}},_0x5cccef={};_0x5cccef[_0x5e6d('0x3d')]=_['keys'](db[_0x5e6d('0x39')]['rawAttributes']);_0x5cccef[_0x5e6d('0x3e')]=_[_0x5e6d('0x3f')](_0x35e2c9['query']);_0x5cccef[_0x5e6d('0x40')]=_[_0x5e6d('0x41')](_0x5cccef['model'],_0x5cccef[_0x5e6d('0x3e')]);_0x53835b[_0x5e6d('0x43')]=_[_0x5e6d('0x41')](_0x5cccef[_0x5e6d('0x3d')],qs[_0x5e6d('0x42')](_0x35e2c9[_0x5e6d('0x3e')]['fields']));_0x53835b[_0x5e6d('0x43')]=_0x53835b[_0x5e6d('0x43')][_0x5e6d('0x44')]?_0x53835b[_0x5e6d('0x43')]:_0x5cccef[_0x5e6d('0x3d')];if(_0x35e2c9[_0x5e6d('0x3e')]['includeAll']){_0x53835b[_0x5e6d('0x4e')]=[{'all':!![]}];}_0x53835b=_[_0x5e6d('0x4a')]({},_0x53835b,_0x35e2c9[_0x5e6d('0x4c')]);return db[_0x5e6d('0x39')][_0x5e6d('0x53')](_0x53835b)[_0x5e6d('0x2f')](handleEntityNotFound(_0x83926d,null))[_0x5e6d('0x2f')](respondWithResult(_0x83926d,null))[_0x5e6d('0x50')](handleError(_0x83926d,null));};exports[_0x5e6d('0x54')]=function(_0x4f958f,_0x21e2bf){return db['Dashboard'][_0x5e6d('0x54')](_0x4f958f[_0x5e6d('0x55')],{})['then'](function(_0xff727){var _0x2c0c35=_0x4f958f[_0x5e6d('0x56')][_0x5e6d('0x30')]({'plain':!![]});if(!_0x2c0c35)throw new Error(_0x5e6d('0x57'));if(_0x2c0c35[_0x5e6d('0x58')]===_0x5e6d('0x56')){var _0x1038f9=_0xff727[_0x5e6d('0x30')]({'plain':!![]});var _0x197838='CustomDashboards';return db[_0x5e6d('0x59')]['find']({'where':{'name':_0x197838,'userProfileId':_0x2c0c35[_0x5e6d('0x5a')]},'raw':!![]})['then'](function(_0x2cbbed){if(_0x2cbbed&&_0x2cbbed[_0x5e6d('0x5b')]===0x0){return db[_0x5e6d('0x32')]['create']({'name':_0x1038f9['name'],'resourceId':_0x1038f9['id'],'type':_0x2cbbed[_0x5e6d('0x35')],'sectionId':_0x2cbbed['id']},{})['then'](function(){return _0xff727;});}else{return _0xff727;}})['catch'](function(_0x21bcdb){logger[_0x5e6d('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21bcdb);throw _0x21bcdb;});}return _0xff727;})[_0x5e6d('0x2f')](respondWithResult(_0x21e2bf,0xc9))['catch'](handleError(_0x21e2bf,null));};exports[_0x5e6d('0x5c')]=function(_0x3ac66f,_0x5a6077){var _0x46efa8={'where':{'id':_0x3ac66f['params']['id']}},_0x44bf69={};_0x44bf69[_0x5e6d('0x3d')]=_['keys'](db[_0x5e6d('0x39')][_0x5e6d('0x3a')]);_0x46efa8['attributes']=_['intersection'](_0x44bf69[_0x5e6d('0x3d')],qs[_0x5e6d('0x42')](_0x3ac66f[_0x5e6d('0x3e')]['fields']));_0x46efa8[_0x5e6d('0x43')]=_0x46efa8['attributes'][_0x5e6d('0x44')]?_0x46efa8[_0x5e6d('0x43')]:_0x44bf69[_0x5e6d('0x3d')];if(_0x3ac66f[_0x5e6d('0x3e')]['includeAll']){_0x46efa8[_0x5e6d('0x4e')]=[{'all':!![]}];}_0x46efa8=_[_0x5e6d('0x4a')]({},_0x46efa8,_0x3ac66f[_0x5e6d('0x4c')]);return db[_0x5e6d('0x39')]['find'](_0x46efa8)[_0x5e6d('0x2f')](handleEntityNotFound(_0x5a6077,null))[_0x5e6d('0x2f')](function(_0x400ebb){if(_0x400ebb){var _0x55d5ef=_0x400ebb[_0x5e6d('0x30')]({'plain':!![]});_0x55d5ef=qs[_0x5e6d('0x5d')](_0x55d5ef,['id',_0x5e6d('0x5e'),_0x5e6d('0x5f')]);_0x3ac66f['body']=_['omit'](_0x3ac66f['body'],['id','createdAt','updatedAt']);return db[_0x5e6d('0x39')]['create'](_['merge'](_0x55d5ef,_0x3ac66f[_0x5e6d('0x55')]),{'include':_0x3ac66f[_0x5e6d('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0x5e6d('0x2f')](function(_0x326ba1){var _0x576e45=_0x3ac66f[_0x5e6d('0x56')][_0x5e6d('0x30')]({'plain':!![]});if(!_0x576e45)throw new Error(_0x5e6d('0x57'));if(_0x576e45['role']===_0x5e6d('0x56')){var _0x151cc9=_0x326ba1[_0x5e6d('0x30')]({'plain':!![]});var _0x5600eb=_0x5e6d('0x31');return db['UserProfileSection'][_0x5e6d('0x53')]({'where':{'name':_0x5600eb,'userProfileId':_0x576e45['userProfileId']},'raw':!![]})[_0x5e6d('0x2f')](function(_0x2af660){if(_0x2af660&&_0x2af660[_0x5e6d('0x5b')]===0x0){return db[_0x5e6d('0x32')][_0x5e6d('0x54')]({'name':_0x151cc9['name'],'resourceId':_0x151cc9['id'],'type':_0x2af660[_0x5e6d('0x35')],'sectionId':_0x2af660['id']},{})['then'](function(){return _0x326ba1;});}else{return _0x326ba1;}})[_0x5e6d('0x50')](function(_0x1f099b){logger[_0x5e6d('0x33')](_0x5e6d('0x60'),_0x1f099b);throw _0x1f099b;});}return _0x326ba1;});}})[_0x5e6d('0x2f')](respondWithResult(_0x5a6077,0xc9))['catch'](handleError(_0x5a6077,null));};exports[_0x5e6d('0x2e')]=function(_0xcd45a2,_0x1b2334){if(_0xcd45a2[_0x5e6d('0x55')]['id']){delete _0xcd45a2['body']['id'];}return db[_0x5e6d('0x39')][_0x5e6d('0x53')]({'where':{'id':_0xcd45a2[_0x5e6d('0x52')]['id']}})['then'](handleEntityNotFound(_0x1b2334,null))['then'](saveUpdates(_0xcd45a2[_0x5e6d('0x55')],null))[_0x5e6d('0x2f')](respondWithResult(_0x1b2334,null))[_0x5e6d('0x50')](handleError(_0x1b2334,null));};exports[_0x5e6d('0x61')]=function(_0x4bf4ac,_0x49a2bd){return db[_0x5e6d('0x39')][_0x5e6d('0x53')]({'where':{'id':_0x4bf4ac[_0x5e6d('0x52')]['id']}})[_0x5e6d('0x2f')](handleEntityNotFound(_0x49a2bd,null))[_0x5e6d('0x2f')](removeEntity(_0x49a2bd,null))[_0x5e6d('0x50')](handleError(_0x49a2bd,null));};function widgetAttributes(_0xa5e15c){try{switch(_0xa5e15c[_0x5e6d('0x3b')]){case'iframe':return[{'name':_0x5e6d('0x62'),'value':_0xa5e15c[_0x5e6d('0x62')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x0]?_0xa5e15c[_0x5e6d('0x63')][0x0][_0x5e6d('0x64')]:undefined)||_0x5e6d('0x65')}];case _0x5e6d('0x66'):return[{'name':_0x5e6d('0x67'),'value':_0xa5e15c[_0x5e6d('0x67')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c['attrs'][0x0]?_0xa5e15c[_0x5e6d('0x63')][0x0][_0x5e6d('0x64')]:undefined)||''}];case'clock':return[{'name':_0x5e6d('0x68'),'value':_0xa5e15c['attrHourFormat']||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x0]?_0xa5e15c[_0x5e6d('0x63')][0x0][_0x5e6d('0x64')]:undefined)||_0x5e6d('0x69')},{'name':_0x5e6d('0x6a'),'value':_0xa5e15c[_0x5e6d('0x6a')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x1]?_0xa5e15c[_0x5e6d('0x63')][0x1][_0x5e6d('0x64')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0xa5e15c[_0x5e6d('0x6b')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x2]?_0xa5e15c['attrs'][0x2]['value']:undefined)||0xc}];case _0x5e6d('0x6c'):return[{'name':'attrMetric','value':_0xa5e15c[_0x5e6d('0x6d')]||(_0xa5e15c['attrs']&&_0xa5e15c['attrs'][0x0]?_0xa5e15c[_0x5e6d('0x63')][0x0]['value']:undefined)||_0x5e6d('0x6e')},{'name':'attrVoiceQueues','value':_0xa5e15c[_0x5e6d('0x6f')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c['attrs'][0x1]?_0xa5e15c[_0x5e6d('0x63')][0x1][_0x5e6d('0x64')]:undefined)||[]},{'name':_0x5e6d('0x6b'),'value':_0xa5e15c[_0x5e6d('0x6b')]||(_0xa5e15c['attrs']&&_0xa5e15c[_0x5e6d('0x63')][0x2]?_0xa5e15c['attrs'][0x2][_0x5e6d('0x64')]:undefined)||0x14},{'name':_0x5e6d('0x70'),'value':_0xa5e15c['attrChannel']||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x3]?_0xa5e15c[_0x5e6d('0x63')][0x3][_0x5e6d('0x64')]:undefined)||_0x5e6d('0x71')},{'name':_0x5e6d('0x72'),'value':_0xa5e15c[_0x5e6d('0x72')]||(_0xa5e15c['attrs']&&_0xa5e15c[_0x5e6d('0x63')][0x4]?_0xa5e15c[_0x5e6d('0x63')][0x4][_0x5e6d('0x64')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xa5e15c[_0x5e6d('0x73')]||(_0xa5e15c['attrs']&&_0xa5e15c[_0x5e6d('0x63')][0x5]?_0xa5e15c['attrs'][0x5]['value']:undefined)||''},{'name':_0x5e6d('0x74'),'value':_0xa5e15c[_0x5e6d('0x74')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x6]?_0xa5e15c[_0x5e6d('0x63')][0x6][_0x5e6d('0x64')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xa5e15c[_0x5e6d('0x75')]||(_0xa5e15c['attrs']&&_0xa5e15c[_0x5e6d('0x63')][0x7]?_0xa5e15c['attrs'][0x7][_0x5e6d('0x64')]:undefined)||''},{'name':_0x5e6d('0x76'),'value':_0xa5e15c[_0x5e6d('0x76')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c['attrs'][0x8]?_0xa5e15c[_0x5e6d('0x63')][0x8]['value']:undefined)||''},{'name':_0x5e6d('0x77'),'value':_0xa5e15c[_0x5e6d('0x77')]||(_0xa5e15c['attrs']&&_0xa5e15c[_0x5e6d('0x63')][0x9]?_0xa5e15c['attrs'][0x9][_0x5e6d('0x64')]:undefined)||''}];case'multibar-chart':case _0x5e6d('0x78'):return[{'name':_0x5e6d('0x79'),'value':_0xa5e15c[_0x5e6d('0x79')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x0]?_0xa5e15c[_0x5e6d('0x63')][0x0]['value']:undefined)||_0x5e6d('0x6e')},{'name':_0x5e6d('0x7a'),'value':_0xa5e15c['attrSerie2']||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x1]?_0xa5e15c['attrs'][0x1][_0x5e6d('0x64')]:undefined)||null},{'name':_0x5e6d('0x7b'),'value':_0xa5e15c[_0x5e6d('0x7b')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x2]?_0xa5e15c[_0x5e6d('0x63')][0x2][_0x5e6d('0x64')]:undefined)||null},{'name':_0x5e6d('0x6f'),'value':_0xa5e15c[_0x5e6d('0x6f')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x3]?_0xa5e15c[_0x5e6d('0x63')][0x3][_0x5e6d('0x64')]:undefined)||[]},{'name':_0x5e6d('0x70'),'value':_0xa5e15c['attrChannel']||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x4]?_0xa5e15c[_0x5e6d('0x63')][0x4]['value']:undefined)||_0x5e6d('0x71')},{'name':_0x5e6d('0x72'),'value':_0xa5e15c[_0x5e6d('0x72')]||(_0xa5e15c['attrs']&&_0xa5e15c[_0x5e6d('0x63')][0x5]?_0xa5e15c[_0x5e6d('0x63')][0x5]['value']:undefined)||''},{'name':_0x5e6d('0x73'),'value':_0xa5e15c[_0x5e6d('0x73')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x6]?_0xa5e15c[_0x5e6d('0x63')][0x6][_0x5e6d('0x64')]:undefined)||''},{'name':_0x5e6d('0x74'),'value':_0xa5e15c[_0x5e6d('0x74')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x7]?_0xa5e15c[_0x5e6d('0x63')][0x7][_0x5e6d('0x64')]:undefined)||''},{'name':_0x5e6d('0x75'),'value':_0xa5e15c[_0x5e6d('0x75')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c['attrs'][0x8]?_0xa5e15c[_0x5e6d('0x63')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xa5e15c[_0x5e6d('0x76')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x9]?_0xa5e15c[_0x5e6d('0x63')][0x9][_0x5e6d('0x64')]:undefined)||''},{'name':_0x5e6d('0x77'),'value':_0xa5e15c[_0x5e6d('0x77')]||(_0xa5e15c['attrs']&&_0xa5e15c[_0x5e6d('0x63')][0xa]?_0xa5e15c[_0x5e6d('0x63')][0xa][_0x5e6d('0x64')]:undefined)||''}];case'web-report':return[{'name':_0x5e6d('0x7c'),'type':_0xa5e15c[_0x5e6d('0x7d')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c[_0x5e6d('0x63')][0x0]?_0xa5e15c[_0x5e6d('0x63')][0x0][_0x5e6d('0x3b')]:undefined)||null,'value':_0xa5e15c[_0x5e6d('0x7c')]||(_0xa5e15c['attrs']&&_0xa5e15c[_0x5e6d('0x63')][0x0]?_0xa5e15c['attrs'][0x0][_0x5e6d('0x64')]:undefined)||null},{'name':_0x5e6d('0x7e'),'value':_0xa5e15c[_0x5e6d('0x7e')]||(_0xa5e15c[_0x5e6d('0x63')]&&_0xa5e15c['attrs'][0x1]?_0xa5e15c['attrs'][0x1][_0x5e6d('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x361676){logger['error'](_0x5e6d('0x7f'),JSON[_0x5e6d('0x80')](_0x361676));return[];}}exports[_0x5e6d('0x81')]=function(_0x597135,_0x4941ea,_0x2c9007){if(_0x597135[_0x5e6d('0x55')]['id']){delete _0x597135['body']['id'];}return db[_0x5e6d('0x39')]['find']({'where':{'id':_0x597135['params']['id']}})['then'](handleEntityNotFound(_0x4941ea,null))[_0x5e6d('0x2f')](function(_0x85c8bd){if(_0x85c8bd){_0x597135[_0x5e6d('0x55')][_0x5e6d('0x82')]=_0x85c8bd['id'];_0x597135['body'][_0x5e6d('0x63')]=widgetAttributes(_0x597135['body']);return db['DashboardItem'][_0x5e6d('0x54')](_0x597135[_0x5e6d('0x55')]);}})[_0x5e6d('0x2f')](respondWithResult(_0x4941ea,null))[_0x5e6d('0x50')](handleError(_0x4941ea,null));};exports[_0x5e6d('0x83')]=function(_0x670db6,_0x4ffc28,_0x351d89){var _0x279ac8={};var _0x1d4d2d={};var _0x2f4d82;var _0x78098;return db[_0x5e6d('0x39')][_0x5e6d('0x84')]({'where':{'id':_0x670db6[_0x5e6d('0x52')]['id']}})[_0x5e6d('0x2f')](handleEntityNotFound(_0x4ffc28,null))[_0x5e6d('0x2f')](function(_0x5cb638){if(_0x5cb638){_0x2f4d82=_0x5cb638;_0x1d4d2d[_0x5e6d('0x3d')]=_[_0x5e6d('0x3f')](db[_0x5e6d('0x85')][_0x5e6d('0x3a')]);_0x1d4d2d[_0x5e6d('0x3e')]=_['keys'](_0x670db6[_0x5e6d('0x3e')]);_0x1d4d2d['filters']=_[_0x5e6d('0x41')](_0x1d4d2d[_0x5e6d('0x3d')],_0x1d4d2d[_0x5e6d('0x3e')]);_0x279ac8[_0x5e6d('0x43')]=_[_0x5e6d('0x41')](_0x1d4d2d[_0x5e6d('0x3d')],qs[_0x5e6d('0x42')](_0x670db6[_0x5e6d('0x3e')]['fields']));_0x279ac8[_0x5e6d('0x43')]=_0x279ac8[_0x5e6d('0x43')][_0x5e6d('0x44')]?_0x279ac8['attributes']:_0x1d4d2d[_0x5e6d('0x3d')];_0x279ac8[_0x5e6d('0x46')]=qs['sort'](_0x670db6['query'][_0x5e6d('0x47')]);_0x279ac8[_0x5e6d('0x49')]=qs[_0x5e6d('0x40')](_[_0x5e6d('0x48')](_0x670db6[_0x5e6d('0x3e')],_0x1d4d2d['filters']));if(_0x670db6[_0x5e6d('0x3e')][_0x5e6d('0x4b')]){_0x279ac8[_0x5e6d('0x49')]=_[_0x5e6d('0x4a')](_0x279ac8[_0x5e6d('0x49')],{'$or':_['map'](_0x279ac8[_0x5e6d('0x43')],function(_0x2e93af){var _0x2a42ae={};_0x2a42ae[_0x2e93af]={'$like':'%'+_0x670db6[_0x5e6d('0x3e')][_0x5e6d('0x4b')]+'%'};return _0x2a42ae;})});}_0x279ac8=_['merge']({},_0x279ac8,_0x670db6['options']);return _0x2f4d82['getItems'](_0x279ac8);}})[_0x5e6d('0x2f')](function(_0x5f91d8){if(_0x5f91d8){_0x78098=_0x5f91d8[_0x5e6d('0x44')];if(!_0x670db6[_0x5e6d('0x3e')][_0x5e6d('0x45')](_0x5e6d('0x86'))){_0x279ac8['limit']=qs[_0x5e6d('0x26')](_0x670db6[_0x5e6d('0x3e')][_0x5e6d('0x26')]);_0x279ac8[_0x5e6d('0x28')]=qs[_0x5e6d('0x28')](_0x670db6[_0x5e6d('0x3e')][_0x5e6d('0x28')]);}return _0x2f4d82[_0x5e6d('0x83')](_0x279ac8);}})[_0x5e6d('0x2f')](function(_0x2b2168){if(_0x2b2168){return _0x2b2168?{'count':_0x78098,'rows':_0x2b2168}:null;}})[_0x5e6d('0x2f')](respondWithResult(_0x4ffc28,null))[_0x5e6d('0x50')](handleError(_0x4ffc28,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 35825a7..e514e0b 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 _0x0880=['Dashboard','save','hook','exports','events'];(function(_0x49fcb0,_0x5d7864){var _0x159782=function(_0x2212ba){while(--_0x2212ba){_0x49fcb0['push'](_0x49fcb0['shift']());}};_0x159782(++_0x5d7864);}(_0x0880,0x7c));var _0x0088=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x0880[_0x38622b];return _0x2c1a7a;};'use strict';var EventEmitter=require(_0x0088('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x0088('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0088('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cd1c5){return function(_0xac6cf3,_0x549a77,_0x516173){DashboardEvents['emit'](_0x4cd1c5+':'+_0xac6cf3['id'],_0xac6cf3);DashboardEvents['emit'](_0x4cd1c5,_0xac6cf3);_0x516173(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x0088('0x3')](e,emitEvent(event));}}module[_0x0088('0x4')]=DashboardEvents; \ No newline at end of file +var _0xda42=['update','remove','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x1130d7,_0x168a57){var _0x509305=function(_0x321bb4){while(--_0x321bb4){_0x1130d7['push'](_0x1130d7['shift']());}};_0x509305(++_0x168a57);}(_0xda42,0x1bd));var _0x2da4=function(_0x3840d7,_0x172db4){_0x3840d7=_0x3840d7-0x0;var _0x4888d5=_0xda42[_0x3840d7];return _0x4888d5;};'use strict';var EventEmitter=require(_0x2da4('0x0'));var Dashboard=require(_0x2da4('0x1'))['db'][_0x2da4('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2da4('0x3')](0x0);var events={'afterCreate':_0x2da4('0x4'),'afterUpdate':_0x2da4('0x5'),'afterDestroy':_0x2da4('0x6')};function emitEvent(_0x4d5ac9){return function(_0x412778,_0x518e05,_0x17f798){DashboardEvents['emit'](_0x4d5ac9+':'+_0x412778['id'],_0x412778);DashboardEvents['emit'](_0x4d5ac9,_0x412778);_0x17f798(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x2da4('0x7')](e,emitEvent(event));}}module[_0x2da4('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a918c12..ddd4f81 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 _0x3cde=['dashboards','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x3a465a,_0x3e8001){var _0x1ed244=function(_0x1349e9){while(--_0x1349e9){_0x3a465a['push'](_0x3a465a['shift']());}};_0x1ed244(++_0x3e8001);}(_0x3cde,0x1d5));var _0xe3cd=function(_0x5322a7,_0x8b1ae9){_0x5322a7=_0x5322a7-0x0;var _0x4f08c4=_0x3cde[_0x5322a7];return _0x4f08c4;};'use strict';var _=require(_0xe3cd('0x0'));var util=require(_0xe3cd('0x1'));var logger=require(_0xe3cd('0x2'))(_0xe3cd('0x3'));var moment=require('moment');var BPromise=require(_0xe3cd('0x4'));var rp=require(_0xe3cd('0x5'));var fs=require('fs');var path=require(_0xe3cd('0x6'));var rimraf=require(_0xe3cd('0x7'));var config=require(_0xe3cd('0x8'));var attributes=require(_0xe3cd('0x9'));module['exports']=function(_0x5c0bad,_0x2e47ad){return _0x5c0bad[_0xe3cd('0xa')](_0xe3cd('0xb'),attributes,{'tableName':_0xe3cd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefa1=['moment','bluebird','../../config/environment','./dashboard.attributes','Dashboard','dashboards','lodash','util','../../config/logger','api'];(function(_0x4a5019,_0x1a35cd){var _0x18c2fa=function(_0xb68beb){while(--_0xb68beb){_0x4a5019['push'](_0x4a5019['shift']());}};_0x18c2fa(++_0x1a35cd);}(_0xefa1,0xce));var _0x1efa=function(_0x191e58,_0x341e2c){_0x191e58=_0x191e58-0x0;var _0x90c7a1=_0xefa1[_0x191e58];return _0x90c7a1;};'use strict';var _=require(_0x1efa('0x0'));var util=require(_0x1efa('0x1'));var logger=require(_0x1efa('0x2'))(_0x1efa('0x3'));var moment=require(_0x1efa('0x4'));var BPromise=require(_0x1efa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1efa('0x6'));var attributes=require(_0x1efa('0x7'));module['exports']=function(_0xd6d673,_0x1d2a1a){return _0xd6d673['define'](_0x1efa('0x8'),attributes,{'tableName':_0x1efa('0x9'),'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 bc66f14..2ab0bde 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 _0xd810=['info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then'];(function(_0x3978e9,_0x202fbf){var _0x4c6581=function(_0x5016d1){while(--_0x5016d1){_0x3978e9['push'](_0x3978e9['shift']());}};_0x4c6581(++_0x202fbf);}(_0xd810,0x13d));var _0x0d81=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xd810[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x0d81('0x0'));var util=require(_0x0d81('0x1'));var moment=require(_0x0d81('0x2'));var BPromise=require(_0x0d81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d81('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d81('0x5'))(_0x0d81('0x6'));var config=require(_0x0d81('0x7'));var jayson=require(_0x0d81('0x8'));var client=jayson[_0x0d81('0x9')][_0x0d81('0xa')]({'port':0x232a});config[_0x0d81('0xb')]=_[_0x0d81('0xc')](config[_0x0d81('0xb')],{'host':_0x0d81('0xd'),'port':0x18eb});var socket=require(_0x0d81('0xe'))(new Redis(config['redis']));require(_0x0d81('0xf'))[_0x0d81('0x10')](socket);function respondWithRpcPromise(_0x12e228,_0x49dfa7,_0x15abb0){return new BPromise(function(_0x3dad2b,_0x2deb0c){return client[_0x0d81('0x11')](_0x12e228,_0x15abb0)[_0x0d81('0x12')](function(_0x4c2f9b){logger[_0x0d81('0x13')](_0x0d81('0x14'),_0x49dfa7,_0x0d81('0x15'));logger['debug'](_0x0d81('0x16'),_0x49dfa7,_0x0d81('0x15'),JSON[_0x0d81('0x17')](_0x4c2f9b));if(_0x4c2f9b['error']){if(_0x4c2f9b[_0x0d81('0x18')]['code']===0x1f4){logger[_0x0d81('0x18')]('Dashboard,\x20%s,\x20%s',_0x49dfa7,_0x4c2f9b[_0x0d81('0x18')][_0x0d81('0x19')]);return _0x2deb0c(_0x4c2f9b['error'][_0x0d81('0x19')]);}logger['error'](_0x0d81('0x14'),_0x49dfa7,_0x4c2f9b['error'][_0x0d81('0x19')]);return _0x3dad2b(_0x4c2f9b[_0x0d81('0x18')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x49dfa7,'request\x20sent');_0x3dad2b(_0x4c2f9b[_0x0d81('0x1a')][_0x0d81('0x19')]);}})[_0x0d81('0x1b')](function(_0x43f1ba){logger[_0x0d81('0x18')](_0x0d81('0x14'),_0x49dfa7,_0x43f1ba);_0x2deb0c(_0x43f1ba);});});} \ No newline at end of file +var _0x6039=['rpc','../../config/environment','jayson/promise','client','defaults','redis','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3959b8,_0x6ac695){var _0x1bc7cb=function(_0x997052){while(--_0x997052){_0x3959b8['push'](_0x3959b8['shift']());}};_0x1bc7cb(++_0x6ac695);}(_0x6039,0x10c));var _0x9603=function(_0x42b0f2,_0x48c609){_0x42b0f2=_0x42b0f2-0x0;var _0x46afd7=_0x6039[_0x42b0f2];return _0x46afd7;};'use strict';var _=require(_0x9603('0x0'));var util=require(_0x9603('0x1'));var moment=require(_0x9603('0x2'));var BPromise=require('bluebird');var rs=require(_0x9603('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9603('0x4'))['db'];var utils=require(_0x9603('0x5'));var logger=require(_0x9603('0x6'))(_0x9603('0x7'));var config=require(_0x9603('0x8'));var jayson=require(_0x9603('0x9'));var client=jayson[_0x9603('0xa')]['http']({'port':0x232a});config['redis']=_[_0x9603('0xb')](config[_0x9603('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9603('0xc')]));require('./dashboard.socket')[_0x9603('0xd')](socket);function respondWithRpcPromise(_0x19128c,_0x5592f0,_0x4a82be){return new BPromise(function(_0x5b7f6c,_0x4c4918){return client[_0x9603('0xe')](_0x19128c,_0x4a82be)[_0x9603('0xf')](function(_0x16b821){logger['info'](_0x9603('0x10'),_0x5592f0,_0x9603('0x11'));logger[_0x9603('0x12')](_0x9603('0x13'),_0x5592f0,'request\x20sent',JSON[_0x9603('0x14')](_0x16b821));if(_0x16b821[_0x9603('0x15')]){if(_0x16b821[_0x9603('0x15')]['code']===0x1f4){logger[_0x9603('0x15')](_0x9603('0x10'),_0x5592f0,_0x16b821[_0x9603('0x15')][_0x9603('0x16')]);return _0x4c4918(_0x16b821[_0x9603('0x15')]['message']);}logger[_0x9603('0x15')](_0x9603('0x10'),_0x5592f0,_0x16b821[_0x9603('0x15')][_0x9603('0x16')]);return _0x5b7f6c(_0x16b821[_0x9603('0x15')][_0x9603('0x16')]);}else{logger['info'](_0x9603('0x10'),_0x5592f0,_0x9603('0x11'));_0x5b7f6c(_0x16b821[_0x9603('0x17')][_0x9603('0x16')]);}})[_0x9603('0x18')](function(_0x2e28bf){logger[_0x9603('0x15')](_0x9603('0x10'),_0x5592f0,_0x2e28bf);_0x4c4918(_0x2e28bf);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 3015530..d63692f 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 _0x867b=['emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x4733f4,_0xc599be){var _0x4c6a68=function(_0x1e056a){while(--_0x1e056a){_0x4733f4['push'](_0x4733f4['shift']());}};_0x4c6a68(++_0xc599be);}(_0x867b,0x1e2));var _0xb867=function(_0xa94fc2,_0x37f0d0){_0xa94fc2=_0xa94fc2-0x0;var _0x50e0e1=_0x867b[_0xa94fc2];return _0x50e0e1;};'use strict';var DashboardEvents=require(_0xb867('0x0'));var events=[_0xb867('0x1'),_0xb867('0x2'),_0xb867('0x3')];function createListener(_0x4f47a3,_0x392698){return function(_0x3a73b5){_0x392698[_0xb867('0x4')](_0x4f47a3,_0x3a73b5);};}function removeListener(_0x3581fe,_0x2e864c){return function(){DashboardEvents[_0xb867('0x5')](_0x3581fe,_0x2e864c);};}exports[_0xb867('0x6')]=function(_0x25f049){for(var _0x11dc91=0x0,_0x5c5695=events[_0xb867('0x7')];_0x11dc91<_0x5c5695;_0x11dc91++){var _0xd39849=events[_0x11dc91];var _0x1cfecb=createListener(_0xb867('0x8')+_0xd39849,_0x25f049);DashboardEvents['on'](_0xd39849,_0x1cfecb);}}; \ No newline at end of file +var _0xac11=['save','update','emit','removeListener','length','dashboard:','./dashboard.events'];(function(_0x6622a2,_0x401a17){var _0x52252e=function(_0x339759){while(--_0x339759){_0x6622a2['push'](_0x6622a2['shift']());}};_0x52252e(++_0x401a17);}(_0xac11,0x164));var _0x1ac1=function(_0x37e684,_0x438a80){_0x37e684=_0x37e684-0x0;var _0x2a47cf=_0xac11[_0x37e684];return _0x2a47cf;};'use strict';var DashboardEvents=require(_0x1ac1('0x0'));var events=[_0x1ac1('0x1'),'remove',_0x1ac1('0x2')];function createListener(_0x457544,_0x13d44c){return function(_0x4a1bc7){_0x13d44c[_0x1ac1('0x3')](_0x457544,_0x4a1bc7);};}function removeListener(_0x1df14e,_0x3ab33b){return function(){DashboardEvents[_0x1ac1('0x4')](_0x1df14e,_0x3ab33b);};}exports['register']=function(_0x1b47ed){for(var _0x5d069a=0x0,_0x6be82=events[_0x1ac1('0x5')];_0x5d069a<_0x6be82;_0x5d069a++){var _0x502845=events[_0x5d069a];var _0xfc0c04=createListener(_0x1ac1('0x6')+_0x502845,_0x1b47ed);DashboardEvents['on'](_0x502845,_0xfc0c04);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2ec0f84..c98a15e 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 _0x19a7=['show','/:id/items','getItems','create','post','/:id/clone','clone','isAuthenticated','addItem','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x224f46,_0x339940){var _0x38ac33=function(_0x5a9b61){while(--_0x5a9b61){_0x224f46['push'](_0x224f46['shift']());}};_0x38ac33(++_0x339940);}(_0x19a7,0x193));var _0x719a=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x19a7[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x719a('0x0'));var util=require(_0x719a('0x1'));var path=require(_0x719a('0x2'));var timeout=require(_0x719a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x719a('0x4'));var auth=require(_0x719a('0x5'));var interaction=require(_0x719a('0x6'));var config=require(_0x719a('0x7'));var controller=require('./dashboard.controller');router[_0x719a('0x8')]('/',auth['isAuthenticated'](),controller[_0x719a('0x9')]);router[_0x719a('0x8')](_0x719a('0xa'),auth['isAuthenticated'](),controller[_0x719a('0xb')]);router[_0x719a('0x8')](_0x719a('0xc'),auth['isAuthenticated'](),controller[_0x719a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x719a('0xe')]);router[_0x719a('0xf')](_0x719a('0x10'),auth['isAuthenticated'](),controller[_0x719a('0x11')]);router[_0x719a('0xf')](_0x719a('0xc'),auth[_0x719a('0x12')](),controller[_0x719a('0x13')]);router['put'](_0x719a('0xa'),auth[_0x719a('0x12')](),controller['update']);router[_0x719a('0x14')](_0x719a('0xa'),auth[_0x719a('0x12')](),controller[_0x719a('0x15')]);module[_0x719a('0x16')]=router; \ No newline at end of file +var _0xaf01=['show','/:id/items','getItems','post','create','addItem','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x19b7f6,_0x3573ba){var _0x23661d=function(_0x187771){while(--_0x187771){_0x19b7f6['push'](_0x19b7f6['shift']());}};_0x23661d(++_0x3573ba);}(_0xaf01,0x159));var _0x1af0=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xaf01[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1af0('0x0'));var timeout=require(_0x1af0('0x1'));var express=require(_0x1af0('0x2'));var router=express[_0x1af0('0x3')]();var fs_extra=require(_0x1af0('0x4'));var auth=require(_0x1af0('0x5'));var interaction=require(_0x1af0('0x6'));var config=require(_0x1af0('0x7'));var controller=require('./dashboard.controller');router[_0x1af0('0x8')]('/',auth[_0x1af0('0x9')](),controller[_0x1af0('0xa')]);router[_0x1af0('0x8')](_0x1af0('0xb'),auth[_0x1af0('0x9')](),controller[_0x1af0('0xc')]);router['get'](_0x1af0('0xd'),auth[_0x1af0('0x9')](),controller[_0x1af0('0xe')]);router[_0x1af0('0xf')]('/',auth[_0x1af0('0x9')](),controller[_0x1af0('0x10')]);router['post']('/:id/clone',auth[_0x1af0('0x9')](),controller['clone']);router[_0x1af0('0xf')](_0x1af0('0xd'),auth[_0x1af0('0x9')](),controller[_0x1af0('0x11')]);router['put'](_0x1af0('0xb'),auth['isAuthenticated'](),controller[_0x1af0('0x12')]);router['delete'](_0x1af0('0xb'),auth[_0x1af0('0x9')](),controller[_0x1af0('0x13')]);module[_0x1af0('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index ae53efa..8e9eb60 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 _0x7a54=['lodash','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7a54,0x106));var _0x47a5=function(_0x569f89,_0xca4bc0){_0x569f89=_0x569f89-0x0;var _0x425366=_0x7a54[_0x569f89];return _0x425366;};'use strict';var Sequelize=require(_0x47a5('0x0'));var squel=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));module['exports']={'title':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x47a5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x47a5('0x4')),'get':function(){try{return JSON[_0x47a5('0x5')](this[_0x47a5('0x6')](_0x47a5('0x7')));}catch(_0xfdf934){return[];}},'set':function(_0x545a97){try{this[_0x47a5('0x8')]('attrs',JSON[_0x47a5('0x9')](_0x545a97));}catch(_0x30e405){this['setDataValue'](_0x47a5('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x47a5('0xa')]},'col':{'type':Sequelize[_0x47a5('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x47a5('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x47a5('0x3')]},'titleFontSize':{'type':Sequelize[_0x47a5('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x4e9074,_0x54f880){var _0x8c591=function(_0x560ddd){while(--_0x560ddd){_0x4e9074['push'](_0x4e9074['shift']());}};_0x8c591(++_0x54f880);}(_0x6f47,0xc7));var _0x76f4=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x6f47[_0x1ae5ab];return _0x1ce001;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'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 6bdd342..6449ca1 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 _0x13c5=['catch','find','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','stringify','create','body','eml-format','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status','limit','undefined','count','offset','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name','params','keys','DashboardItem','rawAttributes','query','filters','model','intersection','fields','length','includeAll','include','merge','options'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x13c5,0x7a));var _0x513c=function(_0x4f20db,_0x2611e0){_0x4f20db=_0x4f20db-0x0;var _0x10a308=_0x13c5[_0x4f20db];return _0x10a308;};'use strict';var emlformat=require(_0x513c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x513c('0x1'));var util=require('util');var path=require('path');var sox=require(_0x513c('0x2'));var csv=require(_0x513c('0x3'));var ejs=require(_0x513c('0x4'));var fs=require('fs');var fs_extra=require(_0x513c('0x5'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x513c('0x6'));var jsforce=require(_0x513c('0x7'));var deskjs=require(_0x513c('0x8'));var toCsv=require(_0x513c('0x3'));var querystring=require(_0x513c('0x9'));var Papa=require(_0x513c('0xa'));var Redis=require(_0x513c('0xb'));var authService=require(_0x513c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x513c('0xd'));var hardwareService=require(_0x513c('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x513c('0xf'));var config=require(_0x513c('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x513c('0x11')](config['redis'],{'host':_0x513c('0x12'),'port':0x18eb});var socket=require(_0x513c('0x13'))(new Redis(config['redis']));require(_0x513c('0x14'))[_0x513c('0x15')](socket);function respondWithStatusCode(_0x29fa69,_0x402067){_0x402067=_0x402067||0xcc;return function(_0x31e044){if(_0x31e044){return _0x29fa69['sendStatus'](_0x402067);}return _0x29fa69[_0x513c('0x16')](_0x402067)['end']();};}function respondWithResult(_0x242311,_0x380a0a){_0x380a0a=_0x380a0a||0xc8;return function(_0x3d0a3f){if(_0x3d0a3f){return _0x242311[_0x513c('0x16')](_0x380a0a)['json'](_0x3d0a3f);}};}function respondWithFilteredResult(_0x48abf0,_0x4c2247){return function(_0x100bc7){if(_0x100bc7){var _0x341b20=typeof _0x4c2247['offset']==='undefined'&&typeof _0x4c2247[_0x513c('0x17')]===_0x513c('0x18');var _0x3c4ab=_0x100bc7[_0x513c('0x19')];var _0x4e5a78=_0x341b20?0x0:_0x4c2247[_0x513c('0x1a')];var _0xddf5d9=_0x341b20?_0x100bc7[_0x513c('0x19')]:_0x4c2247[_0x513c('0x1a')]+_0x4c2247[_0x513c('0x17')];var _0x52287b;if(_0xddf5d9>=_0x3c4ab){_0xddf5d9=_0x3c4ab;_0x52287b=0xc8;}else{_0x52287b=0xce;}_0x48abf0[_0x513c('0x16')](_0x52287b);return _0x48abf0['set'](_0x513c('0x1b'),_0x4e5a78+'-'+_0xddf5d9+'/'+_0x3c4ab)[_0x513c('0x1c')](_0x100bc7);}return null;};}function patchUpdates(_0x9dc7ba){return function(_0xcd8a3b){try{jsonpatch[_0x513c('0x1d')](_0xcd8a3b,_0x9dc7ba,!![]);}catch(_0x5ac3be){return BPromise['reject'](_0x5ac3be);}return _0xcd8a3b[_0x513c('0x1e')]();};}function saveUpdates(_0x390f1e,_0x58dea0){return function(_0x435b57){if(_0x435b57){return _0x435b57[_0x513c('0x1f')](_0x390f1e)['then'](function(_0x206e5b){return _0x206e5b;});}return null;};}function removeEntity(_0x465522,_0x437ed8){return function(_0x24cfa7){if(_0x24cfa7){return _0x24cfa7[_0x513c('0x20')]()[_0x513c('0x21')](function(){_0x465522[_0x513c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x398b01,_0x100181){return function(_0x2c7eec){if(!_0x2c7eec){_0x398b01[_0x513c('0x22')](0x194);}return _0x2c7eec;};}function handleError(_0xf324ee,_0x4a2f3d){_0x4a2f3d=_0x4a2f3d||0x1f4;return function(_0xe8acaa){logger[_0x513c('0x23')](_0xe8acaa[_0x513c('0x24')]);if(_0xe8acaa[_0x513c('0x25')]){delete _0xe8acaa[_0x513c('0x25')];}_0xf324ee[_0x513c('0x16')](_0x4a2f3d)['send'](_0xe8acaa);};}exports['show']=function(_0x3e642b,_0x5d74ea){var _0x2ee6aa={'raw':![],'where':{'id':_0x3e642b[_0x513c('0x26')]['id']}},_0x2bd36b={};_0x2bd36b['model']=_[_0x513c('0x27')](db[_0x513c('0x28')][_0x513c('0x29')]);_0x2bd36b[_0x513c('0x2a')]=_['keys'](_0x3e642b[_0x513c('0x2a')]);_0x2bd36b[_0x513c('0x2b')]=_['intersection'](_0x2bd36b[_0x513c('0x2c')],_0x2bd36b[_0x513c('0x2a')]);_0x2ee6aa['attributes']=_[_0x513c('0x2d')](_0x2bd36b[_0x513c('0x2c')],qs[_0x513c('0x2e')](_0x3e642b[_0x513c('0x2a')][_0x513c('0x2e')]));_0x2ee6aa['attributes']=_0x2ee6aa['attributes'][_0x513c('0x2f')]?_0x2ee6aa['attributes']:_0x2bd36b[_0x513c('0x2c')];if(_0x3e642b[_0x513c('0x2a')][_0x513c('0x30')]){_0x2ee6aa[_0x513c('0x31')]=[{'all':!![]}];}_0x2ee6aa=_[_0x513c('0x32')]({},_0x2ee6aa,_0x3e642b[_0x513c('0x33')]);return db[_0x513c('0x28')]['find'](_0x2ee6aa)[_0x513c('0x21')](handleEntityNotFound(_0x5d74ea,null))[_0x513c('0x21')](respondWithResult(_0x5d74ea,null))[_0x513c('0x34')](handleError(_0x5d74ea,null));};exports[_0x513c('0x20')]=function(_0x4fd1af,_0x474234){return db['DashboardItem'][_0x513c('0x35')]({'where':{'id':_0x4fd1af[_0x513c('0x26')]['id']}})['then'](handleEntityNotFound(_0x474234,null))['then'](removeEntity(_0x474234,null))[_0x513c('0x34')](handleError(_0x474234,null));};function widgetAttributes(_0x534fa4){try{switch(_0x534fa4['type']){case _0x513c('0x36'):return[{'name':'attrUrl','value':_0x534fa4[_0x513c('0x37')]||(_0x534fa4['attrs']&&_0x534fa4['attrs'][0x0]?_0x534fa4[_0x513c('0x38')][0x0][_0x513c('0x39')]:undefined)||_0x513c('0x3a')}];case'custom':return[{'name':_0x513c('0x3b'),'value':_0x534fa4['attrPath']||(_0x534fa4['attrs']&&_0x534fa4[_0x513c('0x38')][0x0]?_0x534fa4[_0x513c('0x38')][0x0]['value']:undefined)||''}];case _0x513c('0x3c'):return[{'name':_0x513c('0x3d'),'value':_0x534fa4[_0x513c('0x3d')]||(_0x534fa4['attrs']&&_0x534fa4[_0x513c('0x38')][0x0]?_0x534fa4[_0x513c('0x38')][0x0][_0x513c('0x39')]:undefined)||_0x513c('0x3e')},{'name':_0x513c('0x3f'),'value':_0x534fa4[_0x513c('0x3f')]||(_0x534fa4['attrs']&&_0x534fa4[_0x513c('0x38')][0x1]?_0x534fa4[_0x513c('0x38')][0x1][_0x513c('0x39')]:undefined)||'0.00'},{'name':_0x513c('0x40'),'value':_0x534fa4[_0x513c('0x40')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x2]?_0x534fa4[_0x513c('0x38')][0x2][_0x513c('0x39')]:undefined)||0xc}];case'counter':return[{'name':_0x513c('0x41'),'value':_0x534fa4[_0x513c('0x41')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4['attrs'][0x0]?_0x534fa4[_0x513c('0x38')][0x0][_0x513c('0x39')]:undefined)||_0x513c('0x42')},{'name':_0x513c('0x43'),'value':_0x534fa4[_0x513c('0x43')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4['attrs'][0x1]?_0x534fa4[_0x513c('0x38')][0x1][_0x513c('0x39')]:undefined)||[]},{'name':_0x513c('0x40'),'value':_0x534fa4[_0x513c('0x40')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x2]?_0x534fa4[_0x513c('0x38')][0x2][_0x513c('0x39')]:undefined)||0x14},{'name':_0x513c('0x44'),'value':_0x534fa4['attrChannel']||(_0x534fa4['attrs']&&_0x534fa4['attrs'][0x3]?_0x534fa4[_0x513c('0x38')][0x3][_0x513c('0x39')]:undefined)||_0x513c('0x45')},{'name':'attrEmailAccounts','value':_0x534fa4[_0x513c('0x46')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x4]?_0x534fa4[_0x513c('0x38')][0x4][_0x513c('0x39')]:undefined)||''},{'name':_0x513c('0x47'),'value':_0x534fa4[_0x513c('0x47')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4['attrs'][0x5]?_0x534fa4[_0x513c('0x38')][0x5][_0x513c('0x39')]:undefined)||''},{'name':_0x513c('0x48'),'value':_0x534fa4[_0x513c('0x48')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x6]?_0x534fa4[_0x513c('0x38')][0x6]['value']:undefined)||''},{'name':_0x513c('0x49'),'value':_0x534fa4[_0x513c('0x49')]||(_0x534fa4['attrs']&&_0x534fa4['attrs'][0x7]?_0x534fa4[_0x513c('0x38')][0x7][_0x513c('0x39')]:undefined)||''},{'name':_0x513c('0x4a'),'value':_0x534fa4[_0x513c('0x4a')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x8]?_0x534fa4[_0x513c('0x38')][0x8][_0x513c('0x39')]:undefined)||''},{'name':_0x513c('0x4b'),'value':_0x534fa4[_0x513c('0x4b')]||(_0x534fa4['attrs']&&_0x534fa4[_0x513c('0x38')][0x9]?_0x534fa4[_0x513c('0x38')][0x9][_0x513c('0x39')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x513c('0x4c'),'value':_0x534fa4[_0x513c('0x4c')]||(_0x534fa4['attrs']&&_0x534fa4[_0x513c('0x38')][0x0]?_0x534fa4['attrs'][0x0][_0x513c('0x39')]:undefined)||_0x513c('0x42')},{'name':_0x513c('0x4d'),'value':_0x534fa4['attrSerie2']||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x1]?_0x534fa4[_0x513c('0x38')][0x1][_0x513c('0x39')]:undefined)||null},{'name':'attrSerie3','value':_0x534fa4[_0x513c('0x4e')]||(_0x534fa4['attrs']&&_0x534fa4[_0x513c('0x38')][0x2]?_0x534fa4[_0x513c('0x38')][0x2]['value']:undefined)||null},{'name':_0x513c('0x43'),'value':_0x534fa4[_0x513c('0x43')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x3]?_0x534fa4[_0x513c('0x38')][0x3][_0x513c('0x39')]:undefined)||[]},{'name':_0x513c('0x44'),'value':_0x534fa4[_0x513c('0x44')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x4]?_0x534fa4[_0x513c('0x38')][0x4][_0x513c('0x39')]:undefined)||'voice'},{'name':_0x513c('0x46'),'value':_0x534fa4[_0x513c('0x46')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x5]?_0x534fa4[_0x513c('0x38')][0x5][_0x513c('0x39')]:undefined)||''},{'name':_0x513c('0x47'),'value':_0x534fa4[_0x513c('0x47')]||(_0x534fa4['attrs']&&_0x534fa4[_0x513c('0x38')][0x6]?_0x534fa4['attrs'][0x6][_0x513c('0x39')]:undefined)||''},{'name':_0x513c('0x48'),'value':_0x534fa4['attrSmsAccounts']||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4['attrs'][0x7]?_0x534fa4[_0x513c('0x38')][0x7][_0x513c('0x39')]:undefined)||''},{'name':_0x513c('0x49'),'value':_0x534fa4['attrOpenchannelAccounts']||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x8]?_0x534fa4['attrs'][0x8][_0x513c('0x39')]:undefined)||''},{'name':_0x513c('0x4a'),'value':_0x534fa4[_0x513c('0x4a')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4['attrs'][0x9]?_0x534fa4[_0x513c('0x38')][0x9][_0x513c('0x39')]:undefined)||''},{'name':_0x513c('0x4b'),'value':_0x534fa4['attrChatWebsites']||(_0x534fa4['attrs']&&_0x534fa4[_0x513c('0x38')][0xa]?_0x534fa4[_0x513c('0x38')][0xa]['value']:undefined)||''}];case _0x513c('0x4f'):return[{'name':_0x513c('0x50'),'type':_0x534fa4[_0x513c('0x51')]||(_0x534fa4['attrs']&&_0x534fa4[_0x513c('0x38')][0x0]?_0x534fa4[_0x513c('0x38')][0x0][_0x513c('0x52')]:undefined)||null,'value':_0x534fa4[_0x513c('0x50')]||(_0x534fa4[_0x513c('0x38')]&&_0x534fa4[_0x513c('0x38')][0x0]?_0x534fa4['attrs'][0x0][_0x513c('0x39')]:undefined)||null},{'name':_0x513c('0x53'),'value':_0x534fa4[_0x513c('0x53')]||(_0x534fa4['attrs']&&_0x534fa4[_0x513c('0x38')][0x1]?_0x534fa4[_0x513c('0x38')][0x1][_0x513c('0x39')]:undefined)||0x0}];default:return[];}}catch(_0x29e44a){logger['error']('widgetAttributes:\x20%s',JSON[_0x513c('0x54')](_0x29e44a));return[];}}exports[_0x513c('0x55')]=function(_0x6de78d,_0x562cc9){if(_0x6de78d[_0x513c('0x56')]){_0x6de78d[_0x513c('0x56')][_0x513c('0x38')]=widgetAttributes(_0x6de78d[_0x513c('0x56')]);}return db['DashboardItem'][_0x513c('0x55')](_0x6de78d[_0x513c('0x56')],{})[_0x513c('0x21')](respondWithResult(_0x562cc9,0xc9))[_0x513c('0x34')](handleError(_0x562cc9,null));};exports[_0x513c('0x1f')]=function(_0x58f44d,_0x36544e){if(_0x58f44d[_0x513c('0x56')]['id']){delete _0x58f44d[_0x513c('0x56')]['id'];}_0x58f44d[_0x513c('0x56')][_0x513c('0x38')]=widgetAttributes(_0x58f44d[_0x513c('0x56')]);return db[_0x513c('0x28')][_0x513c('0x35')]({'where':{'id':_0x58f44d['params']['id']}})[_0x513c('0x21')](handleEntityNotFound(_0x36544e,null))['then'](saveUpdates(_0x58f44d['body'],null))[_0x513c('0x21')](respondWithResult(_0x36544e,null))[_0x513c('0x34')](handleError(_0x36544e,null));}; \ No newline at end of file +var _0x1c75=['attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrFaxAccounts','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','DashboardItem','find','catch','type','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x3aaa3a,_0x408c39){var _0x1816a4=function(_0x1bd4d1){while(--_0x1bd4d1){_0x3aaa3a['push'](_0x3aaa3a['shift']());}};_0x1816a4(++_0x408c39);}(_0x1c75,0xce));var _0x51c7=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x1c75[_0xcfeda9];return _0x4826c7;};'use strict';var emlformat=require(_0x51c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51c7('0x1'));var moment=require(_0x51c7('0x2'));var BPromise=require(_0x51c7('0x3'));var Mustache=require(_0x51c7('0x4'));var util=require(_0x51c7('0x5'));var path=require(_0x51c7('0x6'));var sox=require(_0x51c7('0x7'));var csv=require(_0x51c7('0x8'));var ejs=require(_0x51c7('0x9'));var fs=require('fs');var fs_extra=require(_0x51c7('0xa'));var _=require(_0x51c7('0xb'));var squel=require('squel');var crypto=require(_0x51c7('0xc'));var jsforce=require(_0x51c7('0xd'));var deskjs=require(_0x51c7('0xe'));var toCsv=require(_0x51c7('0x8'));var querystring=require('querystring');var Papa=require(_0x51c7('0xf'));var Redis=require('ioredis');var authService=require(_0x51c7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x51c7('0x11'));var hardwareService=require(_0x51c7('0x12'));var logger=require('../../config/logger')(_0x51c7('0x13'));var utils=require(_0x51c7('0x14'));var config=require(_0x51c7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x51c7('0x16')](config[_0x51c7('0x17')],{'host':_0x51c7('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51c7('0x17')]));require('./dashboardItem.socket')[_0x51c7('0x19')](socket);function respondWithStatusCode(_0x5a5ea9,_0x2e54af){_0x2e54af=_0x2e54af||0xcc;return function(_0x48f08a){if(_0x48f08a){return _0x5a5ea9[_0x51c7('0x1a')](_0x2e54af);}return _0x5a5ea9[_0x51c7('0x1b')](_0x2e54af)[_0x51c7('0x1c')]();};}function respondWithResult(_0x39da99,_0x521d8a){_0x521d8a=_0x521d8a||0xc8;return function(_0x177e14){if(_0x177e14){return _0x39da99[_0x51c7('0x1b')](_0x521d8a)[_0x51c7('0x1d')](_0x177e14);}};}function respondWithFilteredResult(_0x3079b7,_0x209ab3){return function(_0x36b29a){if(_0x36b29a){var _0x4a64e4=typeof _0x209ab3[_0x51c7('0x1e')]===_0x51c7('0x1f')&&typeof _0x209ab3[_0x51c7('0x20')]==='undefined';var _0x3c1f43=_0x36b29a[_0x51c7('0x21')];var _0x51f751=_0x4a64e4?0x0:_0x209ab3['offset'];var _0x1fa9d5=_0x4a64e4?_0x36b29a[_0x51c7('0x21')]:_0x209ab3[_0x51c7('0x1e')]+_0x209ab3[_0x51c7('0x20')];var _0x4072b9;if(_0x1fa9d5>=_0x3c1f43){_0x1fa9d5=_0x3c1f43;_0x4072b9=0xc8;}else{_0x4072b9=0xce;}_0x3079b7[_0x51c7('0x1b')](_0x4072b9);return _0x3079b7[_0x51c7('0x22')]('Content-Range',_0x51f751+'-'+_0x1fa9d5+'/'+_0x3c1f43)[_0x51c7('0x1d')](_0x36b29a);}return null;};}function patchUpdates(_0x11c83d){return function(_0x4e0108){try{jsonpatch[_0x51c7('0x23')](_0x4e0108,_0x11c83d,!![]);}catch(_0x48b259){return BPromise[_0x51c7('0x24')](_0x48b259);}return _0x4e0108[_0x51c7('0x25')]();};}function saveUpdates(_0x414de0,_0x48e6e6){return function(_0x11f01f){if(_0x11f01f){return _0x11f01f[_0x51c7('0x26')](_0x414de0)[_0x51c7('0x27')](function(_0x13a3ad){return _0x13a3ad;});}return null;};}function removeEntity(_0x44de99,_0x1c3935){return function(_0x57fe70){if(_0x57fe70){return _0x57fe70[_0x51c7('0x28')]()['then'](function(){_0x44de99[_0x51c7('0x1b')](0xcc)[_0x51c7('0x1c')]();});}};}function handleEntityNotFound(_0x331ad9,_0x1c29fb){return function(_0x375a70){if(!_0x375a70){_0x331ad9[_0x51c7('0x1a')](0x194);}return _0x375a70;};}function handleError(_0x32ac6e,_0x198465){_0x198465=_0x198465||0x1f4;return function(_0x42745b){logger[_0x51c7('0x29')](_0x42745b[_0x51c7('0x2a')]);if(_0x42745b[_0x51c7('0x2b')]){delete _0x42745b['name'];}_0x32ac6e[_0x51c7('0x1b')](_0x198465)[_0x51c7('0x2c')](_0x42745b);};}exports[_0x51c7('0x2d')]=function(_0x2eebb4,_0x588fbb){var _0x21ff27={'raw':![],'where':{'id':_0x2eebb4[_0x51c7('0x2e')]['id']}},_0x5e90bc={};_0x5e90bc[_0x51c7('0x2f')]=_[_0x51c7('0x30')](db['DashboardItem'][_0x51c7('0x31')]);_0x5e90bc['query']=_[_0x51c7('0x30')](_0x2eebb4[_0x51c7('0x32')]);_0x5e90bc[_0x51c7('0x33')]=_[_0x51c7('0x34')](_0x5e90bc[_0x51c7('0x2f')],_0x5e90bc[_0x51c7('0x32')]);_0x21ff27[_0x51c7('0x35')]=_[_0x51c7('0x34')](_0x5e90bc[_0x51c7('0x2f')],qs[_0x51c7('0x36')](_0x2eebb4['query'][_0x51c7('0x36')]));_0x21ff27['attributes']=_0x21ff27[_0x51c7('0x35')][_0x51c7('0x37')]?_0x21ff27['attributes']:_0x5e90bc[_0x51c7('0x2f')];if(_0x2eebb4[_0x51c7('0x32')][_0x51c7('0x38')]){_0x21ff27[_0x51c7('0x39')]=[{'all':!![]}];}_0x21ff27=_['merge']({},_0x21ff27,_0x2eebb4[_0x51c7('0x3a')]);return db[_0x51c7('0x3b')][_0x51c7('0x3c')](_0x21ff27)[_0x51c7('0x27')](handleEntityNotFound(_0x588fbb,null))['then'](respondWithResult(_0x588fbb,null))[_0x51c7('0x3d')](handleError(_0x588fbb,null));};exports[_0x51c7('0x28')]=function(_0x13fa10,_0x39ba1e){return db[_0x51c7('0x3b')]['find']({'where':{'id':_0x13fa10[_0x51c7('0x2e')]['id']}})['then'](handleEntityNotFound(_0x39ba1e,null))[_0x51c7('0x27')](removeEntity(_0x39ba1e,null))['catch'](handleError(_0x39ba1e,null));};function widgetAttributes(_0x12f54c){try{switch(_0x12f54c[_0x51c7('0x3e')]){case'iframe':return[{'name':_0x51c7('0x3f'),'value':_0x12f54c[_0x51c7('0x3f')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c['attrs'][0x0]['value']:undefined)||_0x51c7('0x41')}];case _0x51c7('0x42'):return[{'name':_0x51c7('0x43'),'value':_0x12f54c[_0x51c7('0x43')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c['attrs'][0x0][_0x51c7('0x44')]:undefined)||''}];case _0x51c7('0x45'):return[{'name':_0x51c7('0x46'),'value':_0x12f54c[_0x51c7('0x46')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x44')]:undefined)||_0x51c7('0x47')},{'name':_0x51c7('0x48'),'value':_0x12f54c[_0x51c7('0x48')]||(_0x12f54c['attrs']&&_0x12f54c['attrs'][0x1]?_0x12f54c[_0x51c7('0x40')][0x1][_0x51c7('0x44')]:undefined)||'0.00'},{'name':_0x51c7('0x49'),'value':_0x12f54c[_0x51c7('0x49')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x2]?_0x12f54c[_0x51c7('0x40')][0x2][_0x51c7('0x44')]:undefined)||0xc}];case _0x51c7('0x4a'):return[{'name':_0x51c7('0x4b'),'value':_0x12f54c[_0x51c7('0x4b')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x0]?_0x12f54c['attrs'][0x0][_0x51c7('0x44')]:undefined)||_0x51c7('0x4c')},{'name':_0x51c7('0x4d'),'value':_0x12f54c[_0x51c7('0x4d')]||(_0x12f54c['attrs']&&_0x12f54c['attrs'][0x1]?_0x12f54c[_0x51c7('0x40')][0x1][_0x51c7('0x44')]:undefined)||[]},{'name':_0x51c7('0x49'),'value':_0x12f54c['attrFontSize']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x2]?_0x12f54c[_0x51c7('0x40')][0x2][_0x51c7('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x12f54c[_0x51c7('0x4e')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x3]?_0x12f54c[_0x51c7('0x40')][0x3][_0x51c7('0x44')]:undefined)||_0x51c7('0x4f')},{'name':'attrEmailAccounts','value':_0x12f54c['attrEmailAccounts']||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x4]?_0x12f54c[_0x51c7('0x40')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x12f54c['attrFaxAccounts']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x5]?_0x12f54c[_0x51c7('0x40')][0x5][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x50'),'value':_0x12f54c[_0x51c7('0x50')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x6]?_0x12f54c[_0x51c7('0x40')][0x6][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x51'),'value':_0x12f54c[_0x51c7('0x51')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x7]?_0x12f54c[_0x51c7('0x40')][0x7]['value']:undefined)||''},{'name':_0x51c7('0x52'),'value':_0x12f54c[_0x51c7('0x52')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x8]?_0x12f54c[_0x51c7('0x40')][0x8]['value']:undefined)||''},{'name':_0x51c7('0x53'),'value':_0x12f54c[_0x51c7('0x53')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x9]?_0x12f54c[_0x51c7('0x40')][0x9][_0x51c7('0x44')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x51c7('0x54'),'value':_0x12f54c[_0x51c7('0x54')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x44')]:undefined)||_0x51c7('0x4c')},{'name':_0x51c7('0x55'),'value':_0x12f54c[_0x51c7('0x55')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x1]?_0x12f54c[_0x51c7('0x40')][0x1][_0x51c7('0x44')]:undefined)||null},{'name':_0x51c7('0x56'),'value':_0x12f54c[_0x51c7('0x56')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x2]?_0x12f54c[_0x51c7('0x40')][0x2][_0x51c7('0x44')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x12f54c['attrVoiceQueues']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x3]?_0x12f54c[_0x51c7('0x40')][0x3][_0x51c7('0x44')]:undefined)||[]},{'name':'attrChannel','value':_0x12f54c[_0x51c7('0x4e')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x4]?_0x12f54c[_0x51c7('0x40')][0x4][_0x51c7('0x44')]:undefined)||'voice'},{'name':_0x51c7('0x57'),'value':_0x12f54c[_0x51c7('0x57')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x5]?_0x12f54c['attrs'][0x5]['value']:undefined)||''},{'name':_0x51c7('0x58'),'value':_0x12f54c[_0x51c7('0x58')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x6]?_0x12f54c[_0x51c7('0x40')][0x6][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x50'),'value':_0x12f54c[_0x51c7('0x50')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x7]?_0x12f54c['attrs'][0x7]['value']:undefined)||''},{'name':_0x51c7('0x51'),'value':_0x12f54c['attrOpenchannelAccounts']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x8]?_0x12f54c[_0x51c7('0x40')][0x8][_0x51c7('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x12f54c[_0x51c7('0x52')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x9]?_0x12f54c['attrs'][0x9][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x53'),'value':_0x12f54c['attrChatWebsites']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0xa]?_0x12f54c[_0x51c7('0x40')][0xa]['value']:undefined)||''}];case _0x51c7('0x59'):return[{'name':_0x51c7('0x5a'),'type':_0x12f54c[_0x51c7('0x5b')]||(_0x12f54c['attrs']&&_0x12f54c['attrs'][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x3e')]:undefined)||null,'value':_0x12f54c[_0x51c7('0x5a')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x44')]:undefined)||null},{'name':_0x51c7('0x5c'),'value':_0x12f54c[_0x51c7('0x5c')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x1]?_0x12f54c['attrs'][0x1][_0x51c7('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x3dabf1){logger[_0x51c7('0x29')]('widgetAttributes:\x20%s',JSON[_0x51c7('0x5d')](_0x3dabf1));return[];}}exports[_0x51c7('0x5e')]=function(_0x354a96,_0x5470b7){if(_0x354a96[_0x51c7('0x5f')]){_0x354a96['body'][_0x51c7('0x40')]=widgetAttributes(_0x354a96[_0x51c7('0x5f')]);}return db['DashboardItem']['create'](_0x354a96['body'],{})[_0x51c7('0x27')](respondWithResult(_0x5470b7,0xc9))[_0x51c7('0x3d')](handleError(_0x5470b7,null));};exports[_0x51c7('0x26')]=function(_0x175bd1,_0x438e7f){if(_0x175bd1[_0x51c7('0x5f')]['id']){delete _0x175bd1[_0x51c7('0x5f')]['id'];}_0x175bd1[_0x51c7('0x5f')][_0x51c7('0x40')]=widgetAttributes(_0x175bd1['body']);return db[_0x51c7('0x3b')][_0x51c7('0x3c')]({'where':{'id':_0x175bd1['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x438e7f,null))[_0x51c7('0x27')](saveUpdates(_0x175bd1[_0x51c7('0x5f')],null))['then'](respondWithResult(_0x438e7f,null))[_0x51c7('0x3d')](handleError(_0x438e7f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 8786f20..57aa994 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 _0x8411=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','hasOwnProperty','exports'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x8411,0x168));var _0x1841=function(_0x1f377b,_0x2b0e84){_0x1f377b=_0x1f377b-0x0;var _0x4c3ffc=_0x8411[_0x1f377b];return _0x4c3ffc;};'use strict';var EventEmitter=require(_0x1841('0x0'));var DashboardItem=require(_0x1841('0x1'))['db'][_0x1841('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1841('0x3')](0x0);var events={'afterCreate':_0x1841('0x4'),'afterUpdate':_0x1841('0x5'),'afterDestroy':_0x1841('0x6')};function emitEvent(_0x212e36){return function(_0x2481a8,_0x42ad09,_0x35c607){DashboardItemEvents['emit'](_0x212e36+':'+_0x2481a8['id'],_0x2481a8);DashboardItemEvents['emit'](_0x212e36,_0x2481a8);_0x35c607(null);};}for(var e in events){if(events[_0x1841('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x1841('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x3e6e=['emit','hasOwnProperty','DashboardItem','update','remove'];(function(_0x4099e9,_0xb636a5){var _0x541517=function(_0x57313f){while(--_0x57313f){_0x4099e9['push'](_0x4099e9['shift']());}};_0x541517(++_0xb636a5);}(_0x3e6e,0x6b));var _0xe3e6=function(_0x58b93a,_0x5c60e1){_0x58b93a=_0x58b93a-0x0;var _0x37c352=_0x3e6e[_0x58b93a];return _0x37c352;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xe3e6('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe3e6('0x1'),'afterDestroy':_0xe3e6('0x2')};function emitEvent(_0x218ebb){return function(_0x4e574c,_0x45034a,_0x1d3303){DashboardItemEvents[_0xe3e6('0x3')](_0x218ebb+':'+_0x4e574c['id'],_0x4e574c);DashboardItemEvents[_0xe3e6('0x3')](_0x218ebb,_0x4e574c);_0x1d3303(null);};}for(var e in events){if(events[_0xe3e6('0x4')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index cb64c10..c4b9913 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 _0xd99d=['dashboard_items','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd99d,0x1ae));var _0xdd99=function(_0x2b4b43,_0x36018b){_0x2b4b43=_0x2b4b43-0x0;var _0x593d72=_0xd99d[_0x2b4b43];return _0x593d72;};'use strict';var _=require(_0xdd99('0x0'));var util=require('util');var logger=require(_0xdd99('0x1'))(_0xdd99('0x2'));var moment=require('moment');var BPromise=require(_0xdd99('0x3'));var rp=require(_0xdd99('0x4'));var fs=require('fs');var path=require(_0xdd99('0x5'));var rimraf=require(_0xdd99('0x6'));var config=require(_0xdd99('0x7'));var attributes=require(_0xdd99('0x8'));module[_0xdd99('0x9')]=function(_0x2537e5,_0x30b828){return _0x2537e5[_0xdd99('0xa')](_0xdd99('0xb'),attributes,{'tableName':_0xdd99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab5c=['DashboardItem','dashboard_items','util','../../config/logger','api','bluebird','../../config/environment','exports','define'];(function(_0x37c781,_0x40aa65){var _0x4d7931=function(_0x595f0c){while(--_0x595f0c){_0x37c781['push'](_0x37c781['shift']());}};_0x4d7931(++_0x40aa65);}(_0xab5c,0x134));var _0xcab5=function(_0x5a5340,_0x53559a){_0x5a5340=_0x5a5340-0x0;var _0x303c08=_0xab5c[_0x5a5340];return _0x303c08;};'use strict';var _=require('lodash');var util=require(_0xcab5('0x0'));var logger=require(_0xcab5('0x1'))(_0xcab5('0x2'));var moment=require('moment');var BPromise=require(_0xcab5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcab5('0x4'));var attributes=require('./dashboardItem.attributes');module[_0xcab5('0x5')]=function(_0x2a91ac,_0x2870e0){return _0x2a91ac[_0xcab5('0x6')](_0xcab5('0x7'),attributes,{'tableName':_0xcab5('0x8'),'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 9bee225..a9ab37f 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 _0xb7c5=['redis','./dashboardItem.socket','request','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults'];(function(_0x52dc02,_0x34deee){var _0x453ddc=function(_0x38ee66){while(--_0x38ee66){_0x52dc02['push'](_0x52dc02['shift']());}};_0x453ddc(++_0x34deee);}(_0xb7c5,0x1a3));var _0x5b7c=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0xb7c5[_0x1bb812];return _0x372adb;};'use strict';var _=require(_0x5b7c('0x0'));var util=require(_0x5b7c('0x1'));var moment=require(_0x5b7c('0x2'));var BPromise=require(_0x5b7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b7c('0x4'));var db=require(_0x5b7c('0x5'))['db'];var utils=require(_0x5b7c('0x6'));var logger=require(_0x5b7c('0x7'))(_0x5b7c('0x8'));var config=require(_0x5b7c('0x9'));var jayson=require(_0x5b7c('0xa'));var client=jayson['client'][_0x5b7c('0xb')]({'port':0x232a});config['redis']=_[_0x5b7c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b7c('0xd')]));require(_0x5b7c('0xe'))['register'](socket);function respondWithRpcPromise(_0x585487,_0x404aff,_0x2ffaa3){return new BPromise(function(_0x5e007c,_0x4095d1){return client[_0x5b7c('0xf')](_0x585487,_0x2ffaa3)['then'](function(_0x4da072){logger[_0x5b7c('0x10')]('DashboardItem,\x20%s,\x20%s',_0x404aff,_0x5b7c('0x11'));logger[_0x5b7c('0x12')](_0x5b7c('0x13'),_0x404aff,_0x5b7c('0x11'),JSON[_0x5b7c('0x14')](_0x4da072));if(_0x4da072[_0x5b7c('0x15')]){if(_0x4da072[_0x5b7c('0x15')][_0x5b7c('0x16')]===0x1f4){logger[_0x5b7c('0x15')]('DashboardItem,\x20%s,\x20%s',_0x404aff,_0x4da072[_0x5b7c('0x15')]['message']);return _0x4095d1(_0x4da072[_0x5b7c('0x15')][_0x5b7c('0x17')]);}logger[_0x5b7c('0x15')]('DashboardItem,\x20%s,\x20%s',_0x404aff,_0x4da072[_0x5b7c('0x15')][_0x5b7c('0x17')]);return _0x5e007c(_0x4da072[_0x5b7c('0x15')]['message']);}else{logger['info'](_0x5b7c('0x18'),_0x404aff,_0x5b7c('0x11'));_0x5e007c(_0x4da072[_0x5b7c('0x19')][_0x5b7c('0x17')]);}})[_0x5b7c('0x1a')](function(_0x2200d9){logger[_0x5b7c('0x15')](_0x5b7c('0x18'),_0x404aff,_0x2200d9);_0x4095d1(_0x2200d9);});});} \ No newline at end of file +var _0x4782=['./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x2b733f,_0x1559bb){var _0x2ecebe=function(_0x4f6b2a){while(--_0x4f6b2a){_0x2b733f['push'](_0x2b733f['shift']());}};_0x2ecebe(++_0x1559bb);}(_0x4782,0xaf));var _0x2478=function(_0x5820df,_0x24240a){_0x5820df=_0x5820df-0x0;var _0x7a47f1=_0x4782[_0x5820df];return _0x7a47f1;};'use strict';var _=require(_0x2478('0x0'));var util=require('util');var moment=require(_0x2478('0x1'));var BPromise=require(_0x2478('0x2'));var rs=require(_0x2478('0x3'));var fs=require('fs');var Redis=require(_0x2478('0x4'));var db=require(_0x2478('0x5'))['db'];var utils=require(_0x2478('0x6'));var logger=require(_0x2478('0x7'))(_0x2478('0x8'));var config=require('../../config/environment');var jayson=require(_0x2478('0x9'));var client=jayson['client'][_0x2478('0xa')]({'port':0x232a});config[_0x2478('0xb')]=_[_0x2478('0xc')](config[_0x2478('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2478('0xd'))(new Redis(config['redis']));require(_0x2478('0xe'))[_0x2478('0xf')](socket);function respondWithRpcPromise(_0x180216,_0x421fdc,_0x1879a7){return new BPromise(function(_0x4c0555,_0x212584){return client[_0x2478('0x10')](_0x180216,_0x1879a7)[_0x2478('0x11')](function(_0x22c11c){logger[_0x2478('0x12')](_0x2478('0x13'),_0x421fdc,'request\x20sent');logger[_0x2478('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x421fdc,'request\x20sent',JSON[_0x2478('0x15')](_0x22c11c));if(_0x22c11c[_0x2478('0x16')]){if(_0x22c11c['error']['code']===0x1f4){logger[_0x2478('0x16')](_0x2478('0x13'),_0x421fdc,_0x22c11c['error']['message']);return _0x212584(_0x22c11c[_0x2478('0x16')][_0x2478('0x17')]);}logger[_0x2478('0x16')](_0x2478('0x13'),_0x421fdc,_0x22c11c[_0x2478('0x16')][_0x2478('0x17')]);return _0x4c0555(_0x22c11c[_0x2478('0x16')][_0x2478('0x17')]);}else{logger[_0x2478('0x12')](_0x2478('0x13'),_0x421fdc,_0x2478('0x18'));_0x4c0555(_0x22c11c[_0x2478('0x19')][_0x2478('0x17')]);}})[_0x2478('0x1a')](function(_0x42a5b9){logger[_0x2478('0x16')](_0x2478('0x13'),_0x421fdc,_0x42a5b9);_0x212584(_0x42a5b9);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 687f8b0..ffee2e2 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 _0xffa9=['emit','removeListener','register','length','./dashboardItem.events'];(function(_0x3a43fc,_0x5f0afa){var _0x178013=function(_0x1cb14e){while(--_0x1cb14e){_0x3a43fc['push'](_0x3a43fc['shift']());}};_0x178013(++_0x5f0afa);}(_0xffa9,0x77));var _0x9ffa=function(_0x2059df,_0x367401){_0x2059df=_0x2059df-0x0;var _0xdd848b=_0xffa9[_0x2059df];return _0xdd848b;};'use strict';var DashboardItemEvents=require(_0x9ffa('0x0'));var events=['save','remove','update'];function createListener(_0x3930b5,_0x10a494){return function(_0x5e5dfb){_0x10a494[_0x9ffa('0x1')](_0x3930b5,_0x5e5dfb);};}function removeListener(_0x1c7e33,_0x14c696){return function(){DashboardItemEvents[_0x9ffa('0x2')](_0x1c7e33,_0x14c696);};}exports[_0x9ffa('0x3')]=function(_0xe66aff){for(var _0x37d9bd=0x0,_0xac26db=events[_0x9ffa('0x4')];_0x37d9bd<_0xac26db;_0x37d9bd++){var _0x55cc26=events[_0x37d9bd];var _0x33dd96=createListener('dashboardItem:'+_0x55cc26,_0xe66aff);DashboardItemEvents['on'](_0x55cc26,_0x33dd96);}}; \ No newline at end of file +var _0x2461=['removeListener','register','length','dashboardItem:','./dashboardItem.events','save','emit'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x2461,0x138));var _0x1246=function(_0x4706eb,_0xb16a6c){_0x4706eb=_0x4706eb-0x0;var _0x2ed658=_0x2461[_0x4706eb];return _0x2ed658;};'use strict';var DashboardItemEvents=require(_0x1246('0x0'));var events=[_0x1246('0x1'),'remove','update'];function createListener(_0x3a11ad,_0x253b9d){return function(_0x36a3e8){_0x253b9d[_0x1246('0x2')](_0x3a11ad,_0x36a3e8);};}function removeListener(_0x58e95b,_0x45f272){return function(){DashboardItemEvents[_0x1246('0x3')](_0x58e95b,_0x45f272);};}exports[_0x1246('0x4')]=function(_0x13deef){for(var _0x2e287b=0x0,_0x11e87e=events[_0x1246('0x5')];_0x2e287b<_0x11e87e;_0x2e287b++){var _0xabb27e=events[_0x2e287b];var _0x10f2a5=createListener(_0x1246('0x6')+_0xabb27e,_0x13deef);DashboardItemEvents['on'](_0xabb27e,_0x10f2a5);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ce858a1..baa0dba 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 _0xf6f7=['create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post'];(function(_0x4d275e,_0x2e9f9d){var _0x327727=function(_0x20d38d){while(--_0x20d38d){_0x4d275e['push'](_0x4d275e['shift']());}};_0x327727(++_0x2e9f9d);}(_0xf6f7,0x123));var _0x7f6f=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0xf6f7[_0x154983];return _0x3d1243;};'use strict';var multer=require(_0x7f6f('0x0'));var util=require(_0x7f6f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7f6f('0x2'));var router=express[_0x7f6f('0x3')]();var fs_extra=require(_0x7f6f('0x4'));var auth=require(_0x7f6f('0x5'));var interaction=require(_0x7f6f('0x6'));var config=require(_0x7f6f('0x7'));var controller=require(_0x7f6f('0x8'));router['get'](_0x7f6f('0x9'),auth[_0x7f6f('0xa')](),controller[_0x7f6f('0xb')]);router[_0x7f6f('0xc')]('/',auth[_0x7f6f('0xa')](),controller[_0x7f6f('0xd')]);router[_0x7f6f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7f6f('0xf')]);router[_0x7f6f('0x10')]('/:id',auth[_0x7f6f('0xa')](),controller[_0x7f6f('0x11')]);module[_0x7f6f('0x12')]=router; \ No newline at end of file +var _0xaa75=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x528761,_0x567136){var _0x5f37fe=function(_0x3dd9db){while(--_0x3dd9db){_0x528761['push'](_0x528761['shift']());}};_0x5f37fe(++_0x567136);}(_0xaa75,0x77));var _0x5aa7=function(_0x22d3ba,_0x3f3818){_0x22d3ba=_0x22d3ba-0x0;var _0x37e9b2=_0xaa75[_0x22d3ba];return _0x37e9b2;};'use strict';var multer=require(_0x5aa7('0x0'));var util=require(_0x5aa7('0x1'));var path=require(_0x5aa7('0x2'));var timeout=require(_0x5aa7('0x3'));var express=require('express');var router=express[_0x5aa7('0x4')]();var fs_extra=require(_0x5aa7('0x5'));var auth=require(_0x5aa7('0x6'));var interaction=require(_0x5aa7('0x7'));var config=require(_0x5aa7('0x8'));var controller=require(_0x5aa7('0x9'));router[_0x5aa7('0xa')](_0x5aa7('0xb'),auth[_0x5aa7('0xc')](),controller[_0x5aa7('0xd')]);router[_0x5aa7('0xe')]('/',auth[_0x5aa7('0xc')](),controller[_0x5aa7('0xf')]);router[_0x5aa7('0x10')]('/:id',auth[_0x5aa7('0xc')](),controller[_0x5aa7('0x11')]);router[_0x5aa7('0x12')](_0x5aa7('0xb'),auth[_0x5aa7('0xc')](),controller[_0x5aa7('0x13')]);module[_0x5aa7('0x14')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index c883c79..8b015ea 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 _0xfcef=['third','STRING','sequelize','first','second'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xfcef,0x151));var _0xffce=function(_0x2070e9,_0x28eb72){_0x2070e9=_0x2070e9-0x0;var _0xbe191f=_0xfcef[_0x2070e9];return _0xbe191f;};'use strict';var Sequelize=require(_0xffce('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xffce('0x1'),_0xffce('0x2'),_0xffce('0x3')),'allowNull':![],'defaultValue':_0xffce('0x1')},'description':{'type':Sequelize[_0xffce('0x4')]}}; \ No newline at end of file +var _0x0ee0=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0ee0,0xb7));var _0x00ee=function(_0x3097ab,_0x84abfa){_0x3097ab=_0x3097ab-0x0;var _0x4a7358=_0x0ee0[_0x3097ab];return _0x4a7358;};'use strict';var Sequelize=require(_0x00ee('0x0'));module[_0x00ee('0x1')]={'name':{'type':Sequelize[_0x00ee('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x00ee('0x3')](_0x00ee('0x4'),_0x00ee('0x5'),_0x00ee('0x6')),'allowNull':![],'defaultValue':_0x00ee('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 336bd4f..f6c09fa 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 _0x59cf=['rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','Disposition','findAll','rows','keys','includeAll','include','options','catch','create','role','user','UserProfileSection','userProfileId','autoAssociation','body','find','params','eml-format','rimraf','zip-dir','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x59cf,0x158));var _0xf59c=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0x59cf[_0x16aaef];return _0x1c82ef;};'use strict';var emlformat=require(_0xf59c('0x0'));var rimraf=require(_0xf59c('0x1'));var zipdir=require(_0xf59c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf59c('0x3'));var util=require(_0xf59c('0x4'));var path=require(_0xf59c('0x5'));var sox=require('sox');var csv=require(_0xf59c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf59c('0x7'));var _=require(_0xf59c('0x8'));var squel=require('squel');var crypto=require(_0xf59c('0x9'));var jsforce=require(_0xf59c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf59c('0x6'));var querystring=require(_0xf59c('0xb'));var Papa=require(_0xf59c('0xc'));var Redis=require(_0xf59c('0xd'));var authService=require(_0xf59c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf59c('0xf'));var hardwareService=require(_0xf59c('0x10'));var logger=require(_0xf59c('0x11'))(_0xf59c('0x12'));var utils=require('../../config/utils');var config=require(_0xf59c('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xab4c72,_0x3125d7){_0x3125d7=_0x3125d7||0xcc;return function(_0x2f9189){if(_0x2f9189){return _0xab4c72[_0xf59c('0x14')](_0x3125d7);}return _0xab4c72[_0xf59c('0x15')](_0x3125d7)[_0xf59c('0x16')]();};}function respondWithResult(_0x23e363,_0x16620e){_0x16620e=_0x16620e||0xc8;return function(_0x3322f2){if(_0x3322f2){return _0x23e363[_0xf59c('0x15')](_0x16620e)[_0xf59c('0x17')](_0x3322f2);}};}function respondWithFilteredResult(_0x5b9f03,_0x3d98b9){return function(_0x32d81d){if(_0x32d81d){var _0x2592bb=typeof _0x3d98b9['offset']===_0xf59c('0x18')&&typeof _0x3d98b9[_0xf59c('0x19')]===_0xf59c('0x18');var _0x59af47=_0x32d81d[_0xf59c('0x1a')];var _0x2c1d97=_0x2592bb?0x0:_0x3d98b9[_0xf59c('0x1b')];var _0x4ca790=_0x2592bb?_0x32d81d[_0xf59c('0x1a')]:_0x3d98b9[_0xf59c('0x1b')]+_0x3d98b9[_0xf59c('0x19')];var _0x156fd5;if(_0x4ca790>=_0x59af47){_0x4ca790=_0x59af47;_0x156fd5=0xc8;}else{_0x156fd5=0xce;}_0x5b9f03[_0xf59c('0x15')](_0x156fd5);return _0x5b9f03[_0xf59c('0x1c')]('Content-Range',_0x2c1d97+'-'+_0x4ca790+'/'+_0x59af47)['json'](_0x32d81d);}return null;};}function patchUpdates(_0x58ced1){return function(_0xe3464b){try{jsonpatch['apply'](_0xe3464b,_0x58ced1,!![]);}catch(_0x2dfd0f){return BPromise['reject'](_0x2dfd0f);}return _0xe3464b[_0xf59c('0x1d')]();};}function saveUpdates(_0x5a91c7,_0x355eef){return function(_0x37965d){if(_0x37965d){return _0x37965d[_0xf59c('0x1e')](_0x5a91c7)[_0xf59c('0x1f')](function(_0x3237ca){return _0x3237ca;});}return null;};}function removeEntity(_0x403837,_0x4a4981){return function(_0x2c8a87){if(_0x2c8a87){return _0x2c8a87[_0xf59c('0x20')]()[_0xf59c('0x1f')](function(){var _0x344c06=_0x2c8a87[_0xf59c('0x21')]({'plain':!![]});var _0x1db0ba=_0xf59c('0x22');return db[_0xf59c('0x23')][_0xf59c('0x20')]({'where':{'type':_0x1db0ba,'resourceId':_0x344c06['id']}})[_0xf59c('0x1f')](function(){return _0x2c8a87;});})[_0xf59c('0x1f')](function(){_0x403837[_0xf59c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x145232,_0x1958fe){return function(_0x1660b7){if(!_0x1660b7){_0x145232[_0xf59c('0x14')](0x194);}return _0x1660b7;};}function handleError(_0x43ba18,_0x4fd741){_0x4fd741=_0x4fd741||0x1f4;return function(_0x1112d7){logger[_0xf59c('0x24')](_0x1112d7[_0xf59c('0x25')]);if(_0x1112d7[_0xf59c('0x26')]){delete _0x1112d7['name'];}_0x43ba18['status'](_0x4fd741)[_0xf59c('0x27')](_0x1112d7);};}exports[_0xf59c('0x28')]=function(_0xdb64a2,_0xad8f82){var _0xa3645a={},_0x3136c4={},_0x3152de={'count':0x0,'rows':[]};var _0xa30be8=_['map'](db['Disposition'][_0xf59c('0x29')],function(_0x539c51){return{'name':_0x539c51['fieldName'],'type':_0x539c51[_0xf59c('0x2a')][_0xf59c('0x2b')]};});_0x3136c4[_0xf59c('0x2c')]=_['map'](_0xa30be8,_0xf59c('0x26'));_0x3136c4[_0xf59c('0x2d')]=_['keys'](_0xdb64a2['query']);_0x3136c4[_0xf59c('0x2e')]=_[_0xf59c('0x2f')](_0x3136c4['model'],_0x3136c4[_0xf59c('0x2d')]);_0xa3645a[_0xf59c('0x30')]=_['intersection'](_0x3136c4[_0xf59c('0x2c')],qs[_0xf59c('0x31')](_0xdb64a2[_0xf59c('0x2d')][_0xf59c('0x31')]));_0xa3645a[_0xf59c('0x30')]=_0xa3645a[_0xf59c('0x30')][_0xf59c('0x32')]?_0xa3645a[_0xf59c('0x30')]:_0x3136c4[_0xf59c('0x2c')];if(!_0xdb64a2[_0xf59c('0x2d')][_0xf59c('0x33')]('nolimit')){_0xa3645a[_0xf59c('0x19')]=qs[_0xf59c('0x19')](_0xdb64a2[_0xf59c('0x2d')]['limit']);_0xa3645a['offset']=qs[_0xf59c('0x1b')](_0xdb64a2[_0xf59c('0x2d')][_0xf59c('0x1b')]);}_0xa3645a[_0xf59c('0x34')]=qs[_0xf59c('0x35')](_0xdb64a2[_0xf59c('0x2d')][_0xf59c('0x35')]);_0xa3645a[_0xf59c('0x36')]=qs[_0xf59c('0x2e')](_[_0xf59c('0x37')](_0xdb64a2[_0xf59c('0x2d')],_0x3136c4[_0xf59c('0x2e')]),_0xa30be8);if(_0xdb64a2[_0xf59c('0x2d')]['filter']){_0xa3645a['where']=_[_0xf59c('0x38')](_0xa3645a[_0xf59c('0x36')],{'$or':_[_0xf59c('0x39')](_0xa30be8,function(_0x5c6911){if(_0x5c6911['type']!==_0xf59c('0x3a')){var _0x284575={};_0x284575[_0x5c6911[_0xf59c('0x26')]]={'$like':'%'+_0xdb64a2[_0xf59c('0x2d')][_0xf59c('0x3b')]+'%'};return _0x284575;}})});}_0xa3645a=_[_0xf59c('0x38')]({},_0xa3645a,_0xdb64a2['options']);var _0xb6d1c7={'where':_0xa3645a[_0xf59c('0x36')]};return db[_0xf59c('0x3c')]['count'](_0xb6d1c7)[_0xf59c('0x1f')](function(_0x244e0b){_0x3152de['count']=_0x244e0b;if(_0xdb64a2['query']['includeAll']){_0xa3645a['include']=[{'all':!![]}];}return db[_0xf59c('0x3c')][_0xf59c('0x3d')](_0xa3645a);})['then'](function(_0x4265d4){_0x3152de[_0xf59c('0x3e')]=_0x4265d4;return _0x3152de;})[_0xf59c('0x1f')](respondWithFilteredResult(_0xad8f82,_0xa3645a))['catch'](handleError(_0xad8f82,null));};exports['show']=function(_0x22ef0e,_0x5b29fa){var _0x223271={'raw':!![],'where':{'id':_0x22ef0e['params']['id']}},_0x5c020f={};_0x5c020f[_0xf59c('0x2c')]=_[_0xf59c('0x3f')](db['Disposition']['rawAttributes']);_0x5c020f['query']=_[_0xf59c('0x3f')](_0x22ef0e[_0xf59c('0x2d')]);_0x5c020f[_0xf59c('0x2e')]=_['intersection'](_0x5c020f[_0xf59c('0x2c')],_0x5c020f[_0xf59c('0x2d')]);_0x223271[_0xf59c('0x30')]=_[_0xf59c('0x2f')](_0x5c020f[_0xf59c('0x2c')],qs[_0xf59c('0x31')](_0x22ef0e[_0xf59c('0x2d')]['fields']));_0x223271[_0xf59c('0x30')]=_0x223271[_0xf59c('0x30')]['length']?_0x223271[_0xf59c('0x30')]:_0x5c020f[_0xf59c('0x2c')];if(_0x22ef0e[_0xf59c('0x2d')][_0xf59c('0x40')]){_0x223271[_0xf59c('0x41')]=[{'all':!![]}];}_0x223271=_[_0xf59c('0x38')]({},_0x223271,_0x22ef0e[_0xf59c('0x42')]);return db[_0xf59c('0x3c')]['find'](_0x223271)[_0xf59c('0x1f')](handleEntityNotFound(_0x5b29fa,null))['then'](respondWithResult(_0x5b29fa,null))[_0xf59c('0x43')](handleError(_0x5b29fa,null));};exports[_0xf59c('0x44')]=function(_0xe6d54f,_0x13e515){return db['Disposition']['create'](_0xe6d54f['body'],{})[_0xf59c('0x1f')](function(_0x3b1595){var _0x38b937=_0xe6d54f['user'][_0xf59c('0x21')]({'plain':!![]});if(!_0x38b937)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38b937[_0xf59c('0x45')]===_0xf59c('0x46')){var _0x51bf3a=_0x3b1595['get']({'plain':!![]});var _0x1489d2=_0xf59c('0x22');return db[_0xf59c('0x47')]['find']({'where':{'name':_0x1489d2,'userProfileId':_0x38b937[_0xf59c('0x48')]},'raw':!![]})[_0xf59c('0x1f')](function(_0x2d8b5a){if(_0x2d8b5a&&_0x2d8b5a[_0xf59c('0x49')]===0x0){return db[_0xf59c('0x23')]['create']({'name':_0x51bf3a['name'],'resourceId':_0x51bf3a['id'],'type':_0x2d8b5a[_0xf59c('0x26')],'sectionId':_0x2d8b5a['id']},{})[_0xf59c('0x1f')](function(){return _0x3b1595;});}else{return _0x3b1595;}})[_0xf59c('0x43')](function(_0x5b32d8){logger[_0xf59c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b32d8);throw _0x5b32d8;});}return _0x3b1595;})['then'](respondWithResult(_0x13e515,0xc9))[_0xf59c('0x43')](handleError(_0x13e515,null));};exports[_0xf59c('0x1e')]=function(_0x23920f,_0x4436cf){if(_0x23920f[_0xf59c('0x4a')]['id']){delete _0x23920f[_0xf59c('0x4a')]['id'];}return db[_0xf59c('0x3c')][_0xf59c('0x4b')]({'where':{'id':_0x23920f[_0xf59c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4436cf,null))[_0xf59c('0x1f')](saveUpdates(_0x23920f[_0xf59c('0x4a')],null))[_0xf59c('0x1f')](respondWithResult(_0x4436cf,null))['catch'](handleError(_0x4436cf,null));};exports[_0xf59c('0x20')]=function(_0x4d769,_0x298d9c){return db[_0xf59c('0x3c')][_0xf59c('0x4b')]({'where':{'id':_0x4d769[_0xf59c('0x4c')]['id']}})[_0xf59c('0x1f')](handleEntityNotFound(_0x298d9c,null))[_0xf59c('0x1f')](removeEntity(_0x298d9c,null))[_0xf59c('0x43')](handleError(_0x298d9c,null));}; \ No newline at end of file +var _0x741a=['map','Disposition','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','length','include','create','body','user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','Dispositions','UserProfileResource','destroy','stack','name','send','index'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x741a,0x7b));var _0xa741=function(_0x1f1283,_0x1bea3b){_0x1f1283=_0x1f1283-0x0;var _0x205041=_0x741a[_0x1f1283];return _0x205041;};'use strict';var emlformat=require(_0xa741('0x0'));var rimraf=require(_0xa741('0x1'));var zipdir=require(_0xa741('0x2'));var jsonpatch=require(_0xa741('0x3'));var rp=require('request-promise');var moment=require(_0xa741('0x4'));var BPromise=require(_0xa741('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa741('0x6'));var csv=require(_0xa741('0x7'));var ejs=require(_0xa741('0x8'));var fs=require('fs');var fs_extra=require(_0xa741('0x9'));var _=require(_0xa741('0xa'));var squel=require(_0xa741('0xb'));var crypto=require(_0xa741('0xc'));var jsforce=require(_0xa741('0xd'));var deskjs=require(_0xa741('0xe'));var toCsv=require(_0xa741('0x7'));var querystring=require(_0xa741('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa741('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa741('0x11'));var hardwareService=require(_0xa741('0x12'));var logger=require(_0xa741('0x13'))(_0xa741('0x14'));var utils=require(_0xa741('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa741('0x16'));var db=require(_0xa741('0x17'))['db'];function respondWithStatusCode(_0x4c4fea,_0x5b6b73){_0x5b6b73=_0x5b6b73||0xcc;return function(_0x352fac){if(_0x352fac){return _0x4c4fea[_0xa741('0x18')](_0x5b6b73);}return _0x4c4fea['status'](_0x5b6b73)[_0xa741('0x19')]();};}function respondWithResult(_0x521687,_0x1fdfdb){_0x1fdfdb=_0x1fdfdb||0xc8;return function(_0x8c30b2){if(_0x8c30b2){return _0x521687[_0xa741('0x1a')](_0x1fdfdb)[_0xa741('0x1b')](_0x8c30b2);}};}function respondWithFilteredResult(_0xc2802d,_0x4ca719){return function(_0x1aba66){if(_0x1aba66){var _0x4cc6fe=typeof _0x4ca719[_0xa741('0x1c')]===_0xa741('0x1d')&&typeof _0x4ca719[_0xa741('0x1e')]===_0xa741('0x1d');var _0x4c5379=_0x1aba66[_0xa741('0x1f')];var _0x53e035=_0x4cc6fe?0x0:_0x4ca719['offset'];var _0x46ae68=_0x4cc6fe?_0x1aba66[_0xa741('0x1f')]:_0x4ca719[_0xa741('0x1c')]+_0x4ca719['limit'];var _0x160456;if(_0x46ae68>=_0x4c5379){_0x46ae68=_0x4c5379;_0x160456=0xc8;}else{_0x160456=0xce;}_0xc2802d[_0xa741('0x1a')](_0x160456);return _0xc2802d[_0xa741('0x20')](_0xa741('0x21'),_0x53e035+'-'+_0x46ae68+'/'+_0x4c5379)[_0xa741('0x1b')](_0x1aba66);}return null;};}function patchUpdates(_0x57a7d5){return function(_0x36439d){try{jsonpatch['apply'](_0x36439d,_0x57a7d5,!![]);}catch(_0x3224da){return BPromise[_0xa741('0x22')](_0x3224da);}return _0x36439d['save']();};}function saveUpdates(_0x1f9b33,_0x2710ba){return function(_0x1d8315){if(_0x1d8315){return _0x1d8315[_0xa741('0x23')](_0x1f9b33)[_0xa741('0x24')](function(_0x185f65){return _0x185f65;});}return null;};}function removeEntity(_0xc755d,_0x1b7b55){return function(_0x2c90cc){if(_0x2c90cc){return _0x2c90cc['destroy']()[_0xa741('0x24')](function(){var _0xf1f20b=_0x2c90cc[_0xa741('0x25')]({'plain':!![]});var _0x123ef0=_0xa741('0x26');return db[_0xa741('0x27')][_0xa741('0x28')]({'where':{'type':_0x123ef0,'resourceId':_0xf1f20b['id']}})[_0xa741('0x24')](function(){return _0x2c90cc;});})[_0xa741('0x24')](function(){_0xc755d[_0xa741('0x1a')](0xcc)[_0xa741('0x19')]();});}};}function handleEntityNotFound(_0x42a65c,_0x930efd){return function(_0x15829b){if(!_0x15829b){_0x42a65c[_0xa741('0x18')](0x194);}return _0x15829b;};}function handleError(_0x14ee3d,_0x1b59df){_0x1b59df=_0x1b59df||0x1f4;return function(_0x5f0184){logger['error'](_0x5f0184[_0xa741('0x29')]);if(_0x5f0184['name']){delete _0x5f0184[_0xa741('0x2a')];}_0x14ee3d[_0xa741('0x1a')](_0x1b59df)[_0xa741('0x2b')](_0x5f0184);};}exports[_0xa741('0x2c')]=function(_0x18f436,_0xf3a1a9){var _0x3cb3d7={},_0x139460={},_0x421d35={'count':0x0,'rows':[]};var _0x27721e=_[_0xa741('0x2d')](db[_0xa741('0x2e')]['rawAttributes'],function(_0x41d3a4){return{'name':_0x41d3a4[_0xa741('0x2f')],'type':_0x41d3a4[_0xa741('0x30')][_0xa741('0x31')]};});_0x139460[_0xa741('0x32')]=_[_0xa741('0x2d')](_0x27721e,_0xa741('0x2a'));_0x139460['query']=_[_0xa741('0x33')](_0x18f436[_0xa741('0x34')]);_0x139460[_0xa741('0x35')]=_[_0xa741('0x36')](_0x139460[_0xa741('0x32')],_0x139460[_0xa741('0x34')]);_0x3cb3d7[_0xa741('0x37')]=_['intersection'](_0x139460[_0xa741('0x32')],qs[_0xa741('0x38')](_0x18f436['query'][_0xa741('0x38')]));_0x3cb3d7[_0xa741('0x37')]=_0x3cb3d7[_0xa741('0x37')]['length']?_0x3cb3d7[_0xa741('0x37')]:_0x139460['model'];if(!_0x18f436[_0xa741('0x34')][_0xa741('0x39')](_0xa741('0x3a'))){_0x3cb3d7[_0xa741('0x1e')]=qs[_0xa741('0x1e')](_0x18f436[_0xa741('0x34')]['limit']);_0x3cb3d7['offset']=qs[_0xa741('0x1c')](_0x18f436[_0xa741('0x34')][_0xa741('0x1c')]);}_0x3cb3d7[_0xa741('0x3b')]=qs['sort'](_0x18f436[_0xa741('0x34')][_0xa741('0x3c')]);_0x3cb3d7[_0xa741('0x3d')]=qs[_0xa741('0x35')](_[_0xa741('0x3e')](_0x18f436['query'],_0x139460[_0xa741('0x35')]),_0x27721e);if(_0x18f436['query'][_0xa741('0x3f')]){_0x3cb3d7[_0xa741('0x3d')]=_[_0xa741('0x40')](_0x3cb3d7[_0xa741('0x3d')],{'$or':_[_0xa741('0x2d')](_0x27721e,function(_0xbd93da){if(_0xbd93da['type']!==_0xa741('0x41')){var _0x5307dc={};_0x5307dc[_0xbd93da[_0xa741('0x2a')]]={'$like':'%'+_0x18f436[_0xa741('0x34')][_0xa741('0x3f')]+'%'};return _0x5307dc;}})});}_0x3cb3d7=_[_0xa741('0x40')]({},_0x3cb3d7,_0x18f436[_0xa741('0x42')]);var _0x4b2527={'where':_0x3cb3d7[_0xa741('0x3d')]};return db[_0xa741('0x2e')][_0xa741('0x1f')](_0x4b2527)[_0xa741('0x24')](function(_0x3f2393){_0x421d35[_0xa741('0x1f')]=_0x3f2393;if(_0x18f436[_0xa741('0x34')][_0xa741('0x43')]){_0x3cb3d7['include']=[{'all':!![]}];}return db[_0xa741('0x2e')]['findAll'](_0x3cb3d7);})[_0xa741('0x24')](function(_0x3c4b17){_0x421d35[_0xa741('0x44')]=_0x3c4b17;return _0x421d35;})[_0xa741('0x24')](respondWithFilteredResult(_0xf3a1a9,_0x3cb3d7))[_0xa741('0x45')](handleError(_0xf3a1a9,null));};exports[_0xa741('0x46')]=function(_0x3be627,_0x2d6fad){var _0x14fe95={'raw':!![],'where':{'id':_0x3be627[_0xa741('0x47')]['id']}},_0xc38236={};_0xc38236[_0xa741('0x32')]=_[_0xa741('0x33')](db[_0xa741('0x2e')][_0xa741('0x48')]);_0xc38236[_0xa741('0x34')]=_[_0xa741('0x33')](_0x3be627['query']);_0xc38236['filters']=_[_0xa741('0x36')](_0xc38236[_0xa741('0x32')],_0xc38236[_0xa741('0x34')]);_0x14fe95[_0xa741('0x37')]=_[_0xa741('0x36')](_0xc38236[_0xa741('0x32')],qs[_0xa741('0x38')](_0x3be627[_0xa741('0x34')]['fields']));_0x14fe95['attributes']=_0x14fe95['attributes'][_0xa741('0x49')]?_0x14fe95[_0xa741('0x37')]:_0xc38236['model'];if(_0x3be627[_0xa741('0x34')][_0xa741('0x43')]){_0x14fe95[_0xa741('0x4a')]=[{'all':!![]}];}_0x14fe95=_[_0xa741('0x40')]({},_0x14fe95,_0x3be627[_0xa741('0x42')]);return db[_0xa741('0x2e')]['find'](_0x14fe95)[_0xa741('0x24')](handleEntityNotFound(_0x2d6fad,null))[_0xa741('0x24')](respondWithResult(_0x2d6fad,null))[_0xa741('0x45')](handleError(_0x2d6fad,null));};exports[_0xa741('0x4b')]=function(_0x36545d,_0x29741f){return db[_0xa741('0x2e')][_0xa741('0x4b')](_0x36545d[_0xa741('0x4c')],{})[_0xa741('0x24')](function(_0xbe14df){var _0x27d95a=_0x36545d[_0xa741('0x4d')][_0xa741('0x25')]({'plain':!![]});if(!_0x27d95a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27d95a[_0xa741('0x4e')]==='user'){var _0x4ca868=_0xbe14df['get']({'plain':!![]});var _0x3649b5=_0xa741('0x26');return db['UserProfileSection'][_0xa741('0x4f')]({'where':{'name':_0x3649b5,'userProfileId':_0x27d95a[_0xa741('0x50')]},'raw':!![]})['then'](function(_0x4db7bf){if(_0x4db7bf&&_0x4db7bf[_0xa741('0x51')]===0x0){return db[_0xa741('0x27')][_0xa741('0x4b')]({'name':_0x4ca868[_0xa741('0x2a')],'resourceId':_0x4ca868['id'],'type':_0x4db7bf[_0xa741('0x2a')],'sectionId':_0x4db7bf['id']},{})[_0xa741('0x24')](function(){return _0xbe14df;});}else{return _0xbe14df;}})[_0xa741('0x45')](function(_0x2e7bb2){logger[_0xa741('0x52')](_0xa741('0x53'),_0x2e7bb2);throw _0x2e7bb2;});}return _0xbe14df;})[_0xa741('0x24')](respondWithResult(_0x29741f,0xc9))[_0xa741('0x45')](handleError(_0x29741f,null));};exports[_0xa741('0x23')]=function(_0x507075,_0x191319){if(_0x507075[_0xa741('0x4c')]['id']){delete _0x507075[_0xa741('0x4c')]['id'];}return db['Disposition'][_0xa741('0x4f')]({'where':{'id':_0x507075[_0xa741('0x47')]['id']}})[_0xa741('0x24')](handleEntityNotFound(_0x191319,null))[_0xa741('0x24')](saveUpdates(_0x507075[_0xa741('0x4c')],null))['then'](respondWithResult(_0x191319,null))['catch'](handleError(_0x191319,null));};exports[_0xa741('0x28')]=function(_0x407da1,_0x4277ad){return db[_0xa741('0x2e')]['find']({'where':{'id':_0x407da1['params']['id']}})[_0xa741('0x24')](handleEntityNotFound(_0x4277ad,null))[_0xa741('0x24')](removeEntity(_0x4277ad,null))[_0xa741('0x45')](handleError(_0x4277ad,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 980d3ac..2270b24 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 _0x4859=['./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c9edf,_0x31f452){var _0x438c8a=function(_0x31ddf9){while(--_0x31ddf9){_0x2c9edf['push'](_0x2c9edf['shift']());}};_0x438c8a(++_0x31f452);}(_0x4859,0x93));var _0x9485=function(_0x23a3a5,_0x36900){_0x23a3a5=_0x23a3a5-0x0;var _0x5d1ca=_0x4859[_0x23a3a5];return _0x5d1ca;};'use strict';var _=require('lodash');var util=require(_0x9485('0x0'));var logger=require(_0x9485('0x1'))(_0x9485('0x2'));var moment=require(_0x9485('0x3'));var BPromise=require(_0x9485('0x4'));var rp=require(_0x9485('0x5'));var fs=require('fs');var path=require(_0x9485('0x6'));var rimraf=require(_0x9485('0x7'));var config=require(_0x9485('0x8'));var attributes=require(_0x9485('0x9'));module['exports']=function(_0x3967f0,_0x76ae85){return _0x3967f0[_0x9485('0xa')](_0x9485('0xb'),attributes,{'tableName':_0x9485('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9485('0xd'),'fields':['name','ListId']},{'unique':!![],'name':_0x9485('0xe'),'fields':[_0x9485('0xf'),_0x9485('0x10')]},{'unique':!![],'name':_0x9485('0x11'),'fields':[_0x9485('0xf'),_0x9485('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0x9485('0xf'),_0x9485('0x13')]},{'unique':!![],'name':_0x9485('0x14'),'fields':[_0x9485('0xf'),_0x9485('0x15')]},{'unique':!![],'name':_0x9485('0x16'),'fields':[_0x9485('0xf'),_0x9485('0x17')]},{'unique':!![],'name':_0x9485('0x18'),'fields':[_0x9485('0xf'),_0x9485('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2728=['WhatsappAccountId','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_whatsapp'];(function(_0xc0f637,_0x333f47){var _0x3fce0a=function(_0x2a35e7){while(--_0x2a35e7){_0xc0f637['push'](_0xc0f637['shift']());}};_0x3fce0a(++_0x333f47);}(_0x2728,0x85));var _0x8272=function(_0xf2c733,_0x58645d){_0xf2c733=_0xf2c733-0x0;var _0x1614ef=_0x2728[_0xf2c733];return _0x1614ef;};'use strict';var _=require('lodash');var util=require(_0x8272('0x0'));var logger=require(_0x8272('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8272('0x2'));var rp=require(_0x8272('0x3'));var fs=require('fs');var path=require(_0x8272('0x4'));var rimraf=require(_0x8272('0x5'));var config=require(_0x8272('0x6'));var attributes=require(_0x8272('0x7'));module['exports']=function(_0x478c3e,_0xb0ec2c){return _0x478c3e[_0x8272('0x8')](_0x8272('0x9'),attributes,{'tableName':_0x8272('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x8272('0xb'),'ListId']},{'unique':!![],'name':_0x8272('0xc'),'fields':['name',_0x8272('0xd')]},{'unique':!![],'name':_0x8272('0xe'),'fields':[_0x8272('0xb'),_0x8272('0xf')]},{'unique':!![],'name':_0x8272('0x10'),'fields':[_0x8272('0xb'),_0x8272('0x11')]},{'unique':!![],'name':_0x8272('0x12'),'fields':[_0x8272('0xb'),_0x8272('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0x8272('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0x8272('0x14'),'fields':[_0x8272('0xb'),_0x8272('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 8c410d5..af67c16 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(_0x5c65e2,_0x49ac13){var _0x6eedec=function(_0x2fcc55){while(--_0x2fcc55){_0x5c65e2['push'](_0x5c65e2['shift']());}};_0x6eedec(++_0x49ac13);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x23a708,_0x3df914){var _0x3c7056=function(_0x3da106){while(--_0x3da106){_0x23a708['push'](_0x23a708['shift']());}};_0x3c7056(++_0x3df914);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 2c08da3..3926509 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 _0xd33b=['index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated'];(function(_0x37f230,_0x2e7c64){var _0x14041f=function(_0x42bfd9){while(--_0x42bfd9){_0x37f230['push'](_0x37f230['shift']());}};_0x14041f(++_0x2e7c64);}(_0xd33b,0x6d));var _0xbd33=function(_0x5bb908,_0x4806c7){_0x5bb908=_0x5bb908-0x0;var _0x218113=_0xd33b[_0x5bb908];return _0x218113;};'use strict';var multer=require(_0xbd33('0x0'));var util=require(_0xbd33('0x1'));var path=require(_0xbd33('0x2'));var timeout=require(_0xbd33('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd33('0x4'));var auth=require(_0xbd33('0x5'));var interaction=require(_0xbd33('0x6'));var config=require(_0xbd33('0x7'));var controller=require(_0xbd33('0x8'));router[_0xbd33('0x9')]('/',auth[_0xbd33('0xa')](),controller[_0xbd33('0xb')]);router['get'](_0xbd33('0xc'),auth[_0xbd33('0xa')](),controller[_0xbd33('0xd')]);router[_0xbd33('0xe')]('/',auth[_0xbd33('0xa')](),controller[_0xbd33('0xf')]);router[_0xbd33('0x10')]('/:id',auth[_0xbd33('0xa')](),controller[_0xbd33('0x11')]);router[_0xbd33('0x12')](_0xbd33('0xc'),auth['isAuthenticated'](),controller[_0xbd33('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2ab2=['Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post','put','update','delete','exports','util','path','connect-timeout'];(function(_0x4e44af,_0x40bd4b){var _0x11bc6f=function(_0x1cd720){while(--_0x1cd720){_0x4e44af['push'](_0x4e44af['shift']());}};_0x11bc6f(++_0x40bd4b);}(_0x2ab2,0x12f));var _0x22ab=function(_0xd81fe9,_0x5ab4a2){_0xd81fe9=_0xd81fe9-0x0;var _0x5cfff7=_0x2ab2[_0xd81fe9];return _0x5cfff7;};'use strict';var multer=require('multer');var util=require(_0x22ab('0x0'));var path=require(_0x22ab('0x1'));var timeout=require(_0x22ab('0x2'));var express=require('express');var router=express[_0x22ab('0x3')]();var fs_extra=require(_0x22ab('0x4'));var auth=require(_0x22ab('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22ab('0x6'));var controller=require(_0x22ab('0x7'));router[_0x22ab('0x8')]('/',auth[_0x22ab('0x9')](),controller['index']);router[_0x22ab('0x8')](_0x22ab('0xa'),auth[_0x22ab('0x9')](),controller[_0x22ab('0xb')]);router[_0x22ab('0xc')]('/',auth[_0x22ab('0x9')](),controller['create']);router[_0x22ab('0xd')]('/:id',auth[_0x22ab('0x9')](),controller[_0x22ab('0xe')]);router[_0x22ab('0xf')](_0x22ab('0xa'),auth[_0x22ab('0x9')](),controller['destroy']);module[_0x22ab('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index af29af4..3747f6a 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 _0xce68=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','12000','14400','7200','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x535a03,_0x214ace){var _0x2e315e=function(_0x106b42){while(--_0x106b42){_0x535a03['push'](_0x535a03['shift']());}};_0x2e315e(++_0x214ace);}(_0xce68,0x10c));var _0x8ce6=function(_0x34e47c,_0x2b0659){_0x34e47c=_0x34e47c-0x0;var _0x272ca9=_0xce68[_0x34e47c];return _0x272ca9;};'use strict';var Sequelize=require(_0x8ce6('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ce6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8ce6('0x1')]},'ecm':{'type':Sequelize[_0x8ce6('0x2')](_0x8ce6('0x3'),'no'),'defaultValue':_0x8ce6('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x8ce6('0x4')},'localstationid':{'type':Sequelize[_0x8ce6('0x1')],'unique':_0x8ce6('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x8ce6('0x6'),_0x8ce6('0x7'),'7200','9600',_0x8ce6('0x8'),_0x8ce6('0x9')),'defaultValue':_0x8ce6('0x7')},'maxrate':{'type':Sequelize[_0x8ce6('0x2')]('2400',_0x8ce6('0x7'),_0x8ce6('0xa'),_0x8ce6('0xb'),_0x8ce6('0x8'),_0x8ce6('0x9')),'defaultValue':_0x8ce6('0x9')},'modem':{'type':Sequelize[_0x8ce6('0x1')],'defaultValue':_0x8ce6('0xc')},'gateway':{'type':Sequelize[_0x8ce6('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8ce6('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8ce6('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8ce6('0x2')](_0x8ce6('0xe'),_0x8ce6('0xf'),_0x8ce6('0x10'),_0x8ce6('0x11')),'defaultValue':_0x8ce6('0xe')},'key':{'type':Sequelize[_0x8ce6('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8ce6('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8ce6('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8ce6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8ce6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8ce6('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8ce6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8ce6('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8ce6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8ce6('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x8ce6('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x8ce6('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4474d0){if(!_0x4474d0)this['setDataValue'](_0x8ce6('0x15'),null);this[_0x8ce6('0x16')](_0x8ce6('0x17'),_0x4474d0);}}}; \ No newline at end of file +var _0x446c=['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','2400','4800','12000','14400','ENUM','7200','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT'];(function(_0x252667,_0x89cead){var _0x311cfd=function(_0x5d0115){while(--_0x5d0115){_0x252667['push'](_0x252667['shift']());}};_0x311cfd(++_0x89cead);}(_0x446c,0x156));var _0xc446=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x446c[_0x49a57c];return _0x4e0316;};'use strict';var Sequelize=require(_0xc446('0x0'));module[_0xc446('0x1')]={'name':{'type':Sequelize[_0xc446('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc446('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xc446('0x3'),'no'),'defaultValue':_0xc446('0x3')},'headerinfo':{'type':Sequelize[_0xc446('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xc446('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xc446('0x4'),_0xc446('0x5'),'7200','9600',_0xc446('0x6'),_0xc446('0x7')),'defaultValue':_0xc446('0x5')},'maxrate':{'type':Sequelize[_0xc446('0x8')](_0xc446('0x4'),'4800',_0xc446('0x9'),_0xc446('0xa'),_0xc446('0x6'),_0xc446('0x7')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xc446('0x2')],'defaultValue':_0xc446('0xb')},'gateway':{'type':Sequelize[_0xc446('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc446('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc446('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xc446('0x8')](_0xc446('0xd'),_0xc446('0xe'),_0xc446('0xf'),_0xc446('0x10')),'defaultValue':_0xc446('0xd')},'key':{'type':Sequelize[_0xc446('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc446('0x11')],'defaultValue':function(){return _0xc446('0x12');}},'notificationSound':{'type':Sequelize[_0xc446('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc446('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc446('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc446('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc446('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc446('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc446('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc446('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xc446('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xc446('0x13')],'defaultValue':![],'comment':_0xc446('0x15'),'set':function(_0x146be5){if(!_0x146be5)this[_0xc446('0x16')](_0xc446('0x17'),null);this[_0xc446('0x16')]('mandatoryDisposition',_0x146be5);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index b820eb9..e892eeb 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 _0x4449=['transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','priority','appdata','push','CDR(type)=inbound-fax','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','ReceiveFax','VoiceExtension','updateAccountApplications','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','attachments','join','root','basename','CheckAfterSend','isNil','from','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','show','params','keys','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','Tag','color','tag','addApplications','sequelize'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x4449,0x1c0));var _0x9444=function(_0xc04eff,_0x156ba8){_0xc04eff=_0xc04eff-0x0;var _0x75614f=_0x4449[_0xc04eff];return _0x75614f;};'use strict';var emlformat=require(_0x9444('0x0'));var rimraf=require(_0x9444('0x1'));var zipdir=require(_0x9444('0x2'));var jsonpatch=require(_0x9444('0x3'));var rp=require(_0x9444('0x4'));var moment=require(_0x9444('0x5'));var BPromise=require(_0x9444('0x6'));var Mustache=require(_0x9444('0x7'));var util=require(_0x9444('0x8'));var path=require(_0x9444('0x9'));var sox=require(_0x9444('0xa'));var csv=require('to-csv');var ejs=require(_0x9444('0xb'));var fs=require('fs');var fs_extra=require(_0x9444('0xc'));var _=require(_0x9444('0xd'));var squel=require('squel');var crypto=require(_0x9444('0xe'));var jsforce=require(_0x9444('0xf'));var deskjs=require(_0x9444('0x10'));var toCsv=require(_0x9444('0x11'));var querystring=require(_0x9444('0x12'));var Papa=require(_0x9444('0x13'));var Redis=require(_0x9444('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9444('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9444('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9444('0x17'));var db=require(_0x9444('0x18'))['db'];config[_0x9444('0x19')]=_[_0x9444('0x1a')](config[_0x9444('0x19')],{'host':_0x9444('0x1b'),'port':0x18eb});var socket=require(_0x9444('0x1c'))(new Redis(config[_0x9444('0x19')]));require(_0x9444('0x1d'))[_0x9444('0x1e')](socket);var jayson=require(_0x9444('0x1f'));var client=jayson[_0x9444('0x20')][_0x9444('0x21')]({'port':0x232c});var client9002=jayson[_0x9444('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a37fe,_0x394140,_0x44303f,_0x36b77b){return new BPromise(function(_0x3408b0,_0x31ec61){var _0x4777aa=_0x36b77b||client;return _0x4777aa['request'](_0x1a37fe,_0x44303f)['then'](function(_0x2a1fe9){logger[_0x9444('0x22')](_0x9444('0x23'),_0x394140,'request\x20sent');logger[_0x9444('0x24')](_0x9444('0x25'),_0x394140,_0x9444('0x26'),JSON['stringify'](_0x2a1fe9));if(_0x2a1fe9[_0x9444('0x27')]){if(_0x2a1fe9[_0x9444('0x27')][_0x9444('0x28')]===0x1f4){logger[_0x9444('0x27')](_0x9444('0x23'),_0x394140,_0x2a1fe9[_0x9444('0x27')][_0x9444('0x29')]);return _0x31ec61(_0x2a1fe9[_0x9444('0x27')][_0x9444('0x29')]);}logger['error'](_0x9444('0x23'),_0x394140,_0x2a1fe9[_0x9444('0x27')][_0x9444('0x29')]);return _0x3408b0(_0x2a1fe9[_0x9444('0x27')][_0x9444('0x29')]);}else{logger[_0x9444('0x22')](_0x9444('0x23'),_0x394140,_0x9444('0x26'));_0x3408b0(_0x2a1fe9[_0x9444('0x2a')][_0x9444('0x29')]);}})[_0x9444('0x2b')](function(_0x42ec1f){logger[_0x9444('0x27')](_0x9444('0x23'),_0x394140,_0x42ec1f);_0x31ec61(_0x42ec1f);});});}function respondWithStatusCode(_0x26a4a7,_0x228a57){_0x228a57=_0x228a57||0xcc;return function(_0x4472e4){if(_0x4472e4){return _0x26a4a7[_0x9444('0x2c')](_0x228a57);}return _0x26a4a7[_0x9444('0x2d')](_0x228a57)[_0x9444('0x2e')]();};}function respondWithResult(_0x2dc91a,_0x269329){_0x269329=_0x269329||0xc8;return function(_0x4ae8f2){if(_0x4ae8f2){return _0x2dc91a[_0x9444('0x2d')](_0x269329)[_0x9444('0x2f')](_0x4ae8f2);}};}function respondWithFilteredResult(_0x323989,_0x5d2a58){return function(_0x5a1978){if(_0x5a1978){var _0x6710c8=typeof _0x5d2a58['offset']===_0x9444('0x30')&&typeof _0x5d2a58['limit']===_0x9444('0x30');var _0x48a0bc=_0x5a1978[_0x9444('0x31')];var _0x31ac5c=_0x6710c8?0x0:_0x5d2a58['offset'];var _0x1dffb0=_0x6710c8?_0x5a1978[_0x9444('0x31')]:_0x5d2a58['offset']+_0x5d2a58['limit'];var _0x5bc5e8;if(_0x1dffb0>=_0x48a0bc){_0x1dffb0=_0x48a0bc;_0x5bc5e8=0xc8;}else{_0x5bc5e8=0xce;}_0x323989['status'](_0x5bc5e8);return _0x323989[_0x9444('0x32')](_0x9444('0x33'),_0x31ac5c+'-'+_0x1dffb0+'/'+_0x48a0bc)[_0x9444('0x2f')](_0x5a1978);}return null;};}function patchUpdates(_0x52cb39){return function(_0x29ab9b){try{jsonpatch[_0x9444('0x34')](_0x29ab9b,_0x52cb39,!![]);}catch(_0x37a227){return BPromise[_0x9444('0x35')](_0x37a227);}return _0x29ab9b[_0x9444('0x36')]();};}function saveUpdates(_0x4d7c8b,_0x3c0d68){return function(_0x1d2084){if(_0x1d2084){return _0x1d2084['update'](_0x4d7c8b)[_0x9444('0x37')](function(_0x21f173){return _0x21f173;});}return null;};}function removeEntity(_0x47f14b,_0x1f87c1){return function(_0x5f5a65){if(_0x5f5a65){return _0x5f5a65[_0x9444('0x38')]()[_0x9444('0x37')](function(){var _0x59825e=_0x5f5a65[_0x9444('0x39')]({'plain':!![]});var _0x5a2883='FaxAccounts';return db[_0x9444('0x3a')]['destroy']({'where':{'type':_0x5a2883,'resourceId':_0x59825e['id']}})[_0x9444('0x37')](function(){return _0x5f5a65;});})['then'](function(){_0x47f14b['status'](0xcc)[_0x9444('0x2e')]();});}};}function handleEntityNotFound(_0x1f67a1,_0x3e6be1){return function(_0x26d8f6){if(!_0x26d8f6){_0x1f67a1['sendStatus'](0x194);}return _0x26d8f6;};}function handleError(_0x284064,_0x272215){_0x272215=_0x272215||0x1f4;return function(_0x592394){logger[_0x9444('0x27')](_0x592394[_0x9444('0x3b')]);if(_0x592394[_0x9444('0x3c')]){delete _0x592394['name'];}_0x284064[_0x9444('0x2d')](_0x272215)[_0x9444('0x3d')](_0x592394);};}exports[_0x9444('0x3e')]=function(_0x240f09,_0x56af51){var _0x39da8a={'include':[{'model':db[_0x9444('0x3f')],'as':_0x9444('0x40')}]},_0x471e2a={},_0x16ae28={'count':0x0,'rows':[]};var _0x259ee1=_[_0x9444('0x41')](db[_0x9444('0x42')][_0x9444('0x43')],function(_0x1a485c){return{'name':_0x1a485c['fieldName'],'type':_0x1a485c['type'][_0x9444('0x44')]};});_0x471e2a[_0x9444('0x45')]=_[_0x9444('0x41')](_0x259ee1,_0x9444('0x3c'));_0x471e2a[_0x9444('0x46')]=_['keys'](_0x240f09[_0x9444('0x46')]);_0x471e2a[_0x9444('0x47')]=_[_0x9444('0x48')](_0x471e2a[_0x9444('0x45')],_0x471e2a['query']);_0x39da8a[_0x9444('0x49')]=_[_0x9444('0x48')](_0x471e2a['model'],qs[_0x9444('0x4a')](_0x240f09[_0x9444('0x46')][_0x9444('0x4a')]));_0x39da8a[_0x9444('0x49')]=_0x39da8a[_0x9444('0x49')]['length']?_0x39da8a[_0x9444('0x49')]:_0x471e2a[_0x9444('0x45')];if(!_0x240f09[_0x9444('0x46')][_0x9444('0x4b')]('nolimit')){_0x39da8a[_0x9444('0x4c')]=qs[_0x9444('0x4c')](_0x240f09[_0x9444('0x46')]['limit']);_0x39da8a[_0x9444('0x4d')]=qs[_0x9444('0x4d')](_0x240f09['query'][_0x9444('0x4d')]);}_0x39da8a[_0x9444('0x4e')]=qs['sort'](_0x240f09['query'][_0x9444('0x4f')]);_0x39da8a[_0x9444('0x50')]=qs[_0x9444('0x47')](_[_0x9444('0x51')](_0x240f09['query'],_0x471e2a['filters']),_0x259ee1);if(_0x240f09[_0x9444('0x46')][_0x9444('0x52')]){_0x39da8a[_0x9444('0x50')]=_['merge'](_0x39da8a[_0x9444('0x50')],{'$or':_[_0x9444('0x41')](_0x259ee1,function(_0x3f28ec){if(_0x3f28ec['type']!==_0x9444('0x53')){var _0x2b7cb8={};_0x2b7cb8[_0x3f28ec['name']]={'$like':'%'+_0x240f09[_0x9444('0x46')][_0x9444('0x52')]+'%'};return _0x2b7cb8;}})});}_0x39da8a=_['merge']({},_0x39da8a,_0x240f09[_0x9444('0x54')]);var _0x37a313={'where':_0x39da8a['where']};return db[_0x9444('0x42')][_0x9444('0x31')](_0x37a313)[_0x9444('0x37')](function(_0x4493da){_0x16ae28[_0x9444('0x31')]=_0x4493da;if(_0x240f09[_0x9444('0x46')]['includeAll']){_0x39da8a[_0x9444('0x55')]=[{'all':!![]}];}return db[_0x9444('0x42')][_0x9444('0x56')](_0x39da8a);})[_0x9444('0x37')](function(_0x2dc282){_0x16ae28['rows']=_0x2dc282;return _0x16ae28;})['then'](respondWithFilteredResult(_0x56af51,_0x39da8a))[_0x9444('0x2b')](handleError(_0x56af51,null));};exports[_0x9444('0x57')]=function(_0xab728c,_0x80651){var _0x15d296={'raw':![],'where':{'id':_0xab728c[_0x9444('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x9444('0x40')}]},_0x2485ef={};_0x2485ef[_0x9444('0x45')]=_['keys'](db[_0x9444('0x42')][_0x9444('0x43')]);_0x2485ef['query']=_[_0x9444('0x59')](_0xab728c[_0x9444('0x46')]);_0x2485ef['filters']=_['intersection'](_0x2485ef[_0x9444('0x45')],_0x2485ef[_0x9444('0x46')]);_0x15d296[_0x9444('0x49')]=_[_0x9444('0x48')](_0x2485ef[_0x9444('0x45')],qs['fields'](_0xab728c[_0x9444('0x46')]['fields']));_0x15d296[_0x9444('0x49')]=_0x15d296[_0x9444('0x49')][_0x9444('0x5a')]?_0x15d296[_0x9444('0x49')]:_0x2485ef[_0x9444('0x45')];if(_0xab728c[_0x9444('0x46')][_0x9444('0x5b')]){_0x15d296['include']=[{'all':!![]}];}_0x15d296=_[_0x9444('0x5c')]({},_0x15d296,_0xab728c[_0x9444('0x54')]);return db[_0x9444('0x42')][_0x9444('0x5d')](_0x15d296)[_0x9444('0x37')](handleEntityNotFound(_0x80651,null))['then'](respondWithResult(_0x80651,null))[_0x9444('0x2b')](handleError(_0x80651,null));};exports[_0x9444('0x5e')]=function(_0x93bab7,_0x1f1621){return db[_0x9444('0x42')][_0x9444('0x5e')](_0x93bab7[_0x9444('0x5f')],{})[_0x9444('0x37')](function(_0x4199da){var _0x2d6577=_0x93bab7[_0x9444('0x60')][_0x9444('0x39')]({'plain':!![]});if(!_0x2d6577)throw new Error(_0x9444('0x61'));if(_0x2d6577[_0x9444('0x62')]===_0x9444('0x60')){var _0x58763c=_0x4199da[_0x9444('0x39')]({'plain':!![]});var _0x520936=_0x9444('0x63');return db[_0x9444('0x64')][_0x9444('0x5d')]({'where':{'name':_0x520936,'userProfileId':_0x2d6577['userProfileId']},'raw':!![]})[_0x9444('0x37')](function(_0x3b229e){if(_0x3b229e&&_0x3b229e[_0x9444('0x65')]===0x0){return db[_0x9444('0x3a')][_0x9444('0x5e')]({'name':_0x58763c[_0x9444('0x3c')],'resourceId':_0x58763c['id'],'type':_0x3b229e['name'],'sectionId':_0x3b229e['id']},{})[_0x9444('0x37')](function(){return _0x4199da;});}else{return _0x4199da;}})[_0x9444('0x2b')](function(_0x200f14){logger[_0x9444('0x27')](_0x9444('0x66'),_0x200f14);throw _0x200f14;});}return _0x4199da;})[_0x9444('0x37')](respondWithResult(_0x1f1621,0xc9))['catch'](handleError(_0x1f1621,null));};exports[_0x9444('0x67')]=function(_0x2aa194,_0x510e44){if(_0x2aa194[_0x9444('0x5f')]['id']){delete _0x2aa194['body']['id'];}return db[_0x9444('0x42')][_0x9444('0x5d')]({'where':{'id':_0x2aa194[_0x9444('0x58')]['id']},'include':[{'model':db[_0x9444('0x3f')],'as':_0x9444('0x40')}]})[_0x9444('0x37')](handleEntityNotFound(_0x510e44,null))[_0x9444('0x37')](saveUpdates(_0x2aa194['body'],null))[_0x9444('0x37')](respondWithResult(_0x510e44,null))[_0x9444('0x2b')](handleError(_0x510e44,null));};exports['destroy']=function(_0x12f367,_0x1a7512){return db[_0x9444('0x42')]['find']({'where':{'id':_0x12f367[_0x9444('0x58')]['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x1a7512,null))['then'](removeEntity(_0x1a7512,null))[_0x9444('0x2b')](handleError(_0x1a7512,null));};exports['describe']=function(_0x39a4c3,_0x2624a8){return db[_0x9444('0x42')]['describe']()[_0x9444('0x37')](respondWithResult(_0x2624a8,null))[_0x9444('0x2b')](handleError(_0x2624a8,null));};exports[_0x9444('0x68')]=function(_0x42d69c,_0x4b9073,_0x4dd07b){if(_0x42d69c[_0x9444('0x5f')]['id']){delete _0x42d69c[_0x9444('0x5f')]['id'];}return db[_0x9444('0x42')][_0x9444('0x5d')]({'where':{'id':_0x42d69c[_0x9444('0x58')]['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x4b9073,null))[_0x9444('0x37')](function(_0x3ec4b6){if(_0x3ec4b6){_0x42d69c['body'][_0x9444('0x69')]=_0x3ec4b6['id'];return db[_0x9444('0x6a')]['create'](_0x42d69c[_0x9444('0x5f')]);}})[_0x9444('0x37')](respondWithResult(_0x4b9073,null))[_0x9444('0x2b')](handleError(_0x4b9073,null));};exports[_0x9444('0x6b')]=function(_0x25f3f2,_0x35ee8d,_0x17d8c7){var _0x42ee32={'raw':![],'where':{}};var _0x58477d={};var _0x57aa84={'count':0x0,'rows':[]};return db[_0x9444('0x42')][_0x9444('0x6c')]({'where':{'id':_0x25f3f2['params']['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x35ee8d,null))[_0x9444('0x37')](function(_0x4ded02){if(_0x4ded02){_0x58477d['model']=_[_0x9444('0x59')](db[_0x9444('0x6a')][_0x9444('0x43')]);_0x58477d['query']=_[_0x9444('0x59')](_0x25f3f2[_0x9444('0x46')]);_0x58477d[_0x9444('0x47')]=_[_0x9444('0x48')](_0x58477d['model'],_0x58477d[_0x9444('0x46')]);_0x42ee32[_0x9444('0x49')]=_[_0x9444('0x48')](_0x58477d[_0x9444('0x45')],qs[_0x9444('0x4a')](_0x25f3f2[_0x9444('0x46')][_0x9444('0x4a')]));_0x42ee32[_0x9444('0x49')]=_0x42ee32[_0x9444('0x49')][_0x9444('0x5a')]?_0x42ee32[_0x9444('0x49')]:_0x58477d[_0x9444('0x45')];if(!_0x25f3f2[_0x9444('0x46')][_0x9444('0x4b')](_0x9444('0x6d'))){_0x42ee32[_0x9444('0x4c')]=qs['limit'](_0x25f3f2[_0x9444('0x46')]['limit']);_0x42ee32[_0x9444('0x4d')]=qs['offset'](_0x25f3f2['query'][_0x9444('0x4d')]);}_0x42ee32['order']=qs[_0x9444('0x4f')](_0x25f3f2[_0x9444('0x46')][_0x9444('0x4f')]);_0x42ee32[_0x9444('0x50')]=qs[_0x9444('0x47')](_[_0x9444('0x51')](_0x25f3f2['query'],_0x58477d[_0x9444('0x47')]));_0x42ee32[_0x9444('0x50')][_0x9444('0x69')]=_0x4ded02['id'];if(_0x25f3f2['query'][_0x9444('0x52')]){_0x42ee32[_0x9444('0x50')]=_[_0x9444('0x5c')](_0x42ee32['where'],{'$or':_[_0x9444('0x41')](_0x42ee32[_0x9444('0x49')],function(_0x13f7bc){var _0x295b31={};_0x295b31[_0x13f7bc]={'$like':'%'+_0x25f3f2[_0x9444('0x46')][_0x9444('0x52')]+'%'};return _0x295b31;})});}_0x42ee32=_[_0x9444('0x5c')]({},_0x42ee32,_0x25f3f2['options']);return db[_0x9444('0x6a')][_0x9444('0x31')]({'where':_0x42ee32['where']})['then'](function(_0x5cdda3){_0x57aa84[_0x9444('0x31')]=_0x5cdda3;if(_0x25f3f2[_0x9444('0x46')]['includeAll']){_0x42ee32['include']=[{'all':!![]}];}return db[_0x9444('0x6a')][_0x9444('0x56')](_0x42ee32);})[_0x9444('0x37')](function(_0x43be24){_0x57aa84[_0x9444('0x6e')]=_0x43be24;return _0x57aa84;});}})[_0x9444('0x37')](respondWithFilteredResult(_0x35ee8d,_0x42ee32))[_0x9444('0x2b')](handleError(_0x35ee8d,null));};exports[_0x9444('0x6f')]=function(_0x4981b5,_0x2edfd3,_0x1d0e43){return db['FaxAccount'][_0x9444('0x5d')]({'where':{'id':_0x4981b5['params']['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x2edfd3,null))[_0x9444('0x37')](function(_0x45f320){if(_0x45f320){return _0x45f320['removeDispositions'](_0x4981b5[_0x9444('0x46')][_0x9444('0x70')]);}})[_0x9444('0x37')](respondWithStatusCode(_0x2edfd3,null))[_0x9444('0x2b')](handleError(_0x2edfd3,null));};exports['addAnswer']=function(_0x5c0510,_0x428234,_0x2336c0){if(_0x5c0510['body']['id']){delete _0x5c0510['body']['id'];}return db[_0x9444('0x42')][_0x9444('0x5d')]({'where':{'id':_0x5c0510[_0x9444('0x58')]['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x428234,null))[_0x9444('0x37')](function(_0xc97318){if(_0xc97318){_0x5c0510[_0x9444('0x5f')][_0x9444('0x69')]=_0xc97318['id'];return db[_0x9444('0x71')][_0x9444('0x5e')](_0x5c0510[_0x9444('0x5f')]);}})[_0x9444('0x37')](respondWithResult(_0x428234,null))[_0x9444('0x2b')](handleError(_0x428234,null));};exports[_0x9444('0x72')]=function(_0x313cde,_0x4fa574,_0x1ea5b8){var _0x472f27={'raw':![],'where':{}};var _0x3d3b49={};var _0x36e9d6={'count':0x0,'rows':[]};return db[_0x9444('0x42')][_0x9444('0x6c')]({'where':{'id':_0x313cde['params']['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x4fa574,null))[_0x9444('0x37')](function(_0x5d4550){if(_0x5d4550){_0x3d3b49['model']=_[_0x9444('0x59')](db[_0x9444('0x71')][_0x9444('0x43')]);_0x3d3b49[_0x9444('0x46')]=_[_0x9444('0x59')](_0x313cde[_0x9444('0x46')]);_0x3d3b49[_0x9444('0x47')]=_[_0x9444('0x48')](_0x3d3b49[_0x9444('0x45')],_0x3d3b49['query']);_0x472f27[_0x9444('0x49')]=_[_0x9444('0x48')](_0x3d3b49[_0x9444('0x45')],qs[_0x9444('0x4a')](_0x313cde[_0x9444('0x46')][_0x9444('0x4a')]));_0x472f27[_0x9444('0x49')]=_0x472f27[_0x9444('0x49')][_0x9444('0x5a')]?_0x472f27['attributes']:_0x3d3b49[_0x9444('0x45')];if(!_0x313cde[_0x9444('0x46')][_0x9444('0x4b')](_0x9444('0x6d'))){_0x472f27[_0x9444('0x4c')]=qs['limit'](_0x313cde[_0x9444('0x46')][_0x9444('0x4c')]);_0x472f27[_0x9444('0x4d')]=qs[_0x9444('0x4d')](_0x313cde[_0x9444('0x46')][_0x9444('0x4d')]);}_0x472f27[_0x9444('0x4e')]=qs[_0x9444('0x4f')](_0x313cde['query']['sort']);_0x472f27[_0x9444('0x50')]=qs[_0x9444('0x47')](_[_0x9444('0x51')](_0x313cde[_0x9444('0x46')],_0x3d3b49[_0x9444('0x47')]));_0x472f27[_0x9444('0x50')][_0x9444('0x69')]=_0x5d4550['id'];if(_0x313cde[_0x9444('0x46')][_0x9444('0x52')]){_0x472f27['where']=_['merge'](_0x472f27['where'],{'$or':_['map'](_0x472f27[_0x9444('0x49')],function(_0x201e46){var _0x2b6e00={};_0x2b6e00[_0x201e46]={'$like':'%'+_0x313cde[_0x9444('0x46')][_0x9444('0x52')]+'%'};return _0x2b6e00;})});}_0x472f27=_[_0x9444('0x5c')]({},_0x472f27,_0x313cde[_0x9444('0x54')]);return db[_0x9444('0x71')][_0x9444('0x31')]({'where':_0x472f27[_0x9444('0x50')]})[_0x9444('0x37')](function(_0x60aff2){_0x36e9d6[_0x9444('0x31')]=_0x60aff2;if(_0x313cde[_0x9444('0x46')][_0x9444('0x5b')]){_0x472f27['include']=[{'all':!![]}];}return db[_0x9444('0x71')][_0x9444('0x56')](_0x472f27);})['then'](function(_0xf4b396){_0x36e9d6['rows']=_0xf4b396;return _0x36e9d6;});}})['then'](respondWithFilteredResult(_0x4fa574,_0x472f27))['catch'](handleError(_0x4fa574,null));};exports['removeAnswers']=function(_0x43e5db,_0x39dda3,_0x458766){return db[_0x9444('0x42')][_0x9444('0x5d')]({'where':{'id':_0x43e5db[_0x9444('0x58')]['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x39dda3,null))[_0x9444('0x37')](function(_0x22eb59){if(_0x22eb59){return _0x22eb59[_0x9444('0x73')](_0x43e5db[_0x9444('0x46')][_0x9444('0x70')]);}})[_0x9444('0x37')](respondWithStatusCode(_0x39dda3,null))['catch'](handleError(_0x39dda3,null));};exports[_0x9444('0x74')]=function(_0x1f6235,_0x438d26,_0x5ce147){return db[_0x9444('0x75')][_0x9444('0x5d')]({'where':{'id':_0x1f6235[_0x9444('0x58')]['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x438d26,null))[_0x9444('0x37')](function(_0x2c1ec5){if(_0x2c1ec5){return _0x2c1ec5[_0x9444('0x74')](_0x1f6235[_0x9444('0x5f')]['ids'],_[_0x9444('0x76')](_0x1f6235[_0x9444('0x5f')],[_0x9444('0x70'),'id'])||{});}})[_0x9444('0x37')](respondWithResult(_0x438d26,null))[_0x9444('0x2b')](handleError(_0x438d26,null));};exports[_0x9444('0x77')]=function(_0x2a5b84,_0x24ce6a,_0x7ea15e){var _0x134289={'raw':![],'where':{}};var _0x3ba424={};var _0x220874={'count':0x0,'rows':[]};return db[_0x9444('0x42')][_0x9444('0x6c')]({'where':{'id':_0x2a5b84[_0x9444('0x58')]['id']}})['then'](handleEntityNotFound(_0x24ce6a,null))['then'](function(_0x298805){if(_0x298805){_0x3ba424[_0x9444('0x45')]=_[_0x9444('0x59')](db[_0x9444('0x75')][_0x9444('0x43')]);_0x3ba424[_0x9444('0x46')]=_[_0x9444('0x59')](_0x2a5b84[_0x9444('0x46')]);_0x3ba424[_0x9444('0x47')]=_[_0x9444('0x48')](_0x3ba424[_0x9444('0x45')],_0x3ba424[_0x9444('0x46')]);_0x134289[_0x9444('0x49')]=_['intersection'](_0x3ba424[_0x9444('0x45')],qs[_0x9444('0x4a')](_0x2a5b84[_0x9444('0x46')][_0x9444('0x4a')]));_0x134289['attributes']=_0x134289[_0x9444('0x49')][_0x9444('0x5a')]?_0x134289[_0x9444('0x49')]:_0x3ba424[_0x9444('0x45')];if(!_0x2a5b84['query']['hasOwnProperty']('nolimit')){_0x134289[_0x9444('0x4c')]=qs[_0x9444('0x4c')](_0x2a5b84[_0x9444('0x46')]['limit']);_0x134289[_0x9444('0x4d')]=qs[_0x9444('0x4d')](_0x2a5b84[_0x9444('0x46')][_0x9444('0x4d')]);}_0x134289[_0x9444('0x4e')]=qs['sort'](_0x2a5b84[_0x9444('0x46')][_0x9444('0x4f')]);_0x134289['where']=qs[_0x9444('0x47')](_[_0x9444('0x51')](_0x2a5b84['query'],_0x3ba424[_0x9444('0x47')]));_0x134289[_0x9444('0x50')][_0x9444('0x69')]=_0x298805['id'];if(_0x2a5b84['query'][_0x9444('0x52')]){_0x134289['where']=_[_0x9444('0x5c')](_0x134289[_0x9444('0x50')],{'$or':_['map'](_0x134289[_0x9444('0x49')],function(_0x34582b){var _0x4bc45e={};_0x4bc45e[_0x34582b]={'$like':'%'+_0x2a5b84[_0x9444('0x46')]['filter']+'%'};return _0x4bc45e;})});}_0x134289=_['merge']({},_0x134289,_0x2a5b84[_0x9444('0x54')]);return db['FaxInteraction'][_0x9444('0x31')]({'where':_0x134289['where']})['then'](function(_0x55f9b9){_0x220874[_0x9444('0x31')]=_0x55f9b9;if(_0x2a5b84[_0x9444('0x46')][_0x9444('0x5b')]){_0x134289[_0x9444('0x55')]=[{'model':db[_0x9444('0x78')],'as':'Contact','required':![]},{'model':db[_0x9444('0x79')],'as':_0x9444('0x7a'),'attributes':[_0x9444('0x3c'),'fullname','internal'],'required':![]},{'model':db[_0x9444('0x7b')],'as':'Tags','attributes':['id',_0x9444('0x3c'),_0x9444('0x7c')],'where':_0x2a5b84[_0x9444('0x46')][_0x9444('0x7d')]?{'id':_0x2a5b84[_0x9444('0x46')][_0x9444('0x7d')]}:undefined,'required':_0x2a5b84[_0x9444('0x46')]['tag']?!![]:![]}];}return db[_0x9444('0x75')][_0x9444('0x56')](_0x134289);})[_0x9444('0x37')](function(_0x3fcbeb){_0x220874['rows']=_0x3fcbeb;return _0x220874;});}})[_0x9444('0x37')](respondWithFilteredResult(_0x24ce6a,_0x134289))['catch'](handleError(_0x24ce6a,null));};exports[_0x9444('0x7e')]=function(_0x5237ec,_0x58a991){var _0xa0bf50=_0x5237ec[_0x9444('0x58')]['id'];var _0xd28b6c=_0x5237ec['body'];var _0x5ca334=0xc8;var _0x24f864=null;return db[_0x9444('0x7f')][_0x9444('0x80')]({'isolationLevel':db[_0x9444('0x7f')][_0x9444('0x81')][_0x9444('0x82')]['READ_COMMITTED']},function(_0x5bc654){return db[_0x9444('0x42')]['findOne']({'where':{'id':_0xa0bf50},'transaction':_0x5bc654})['then'](function(_0x3bfc4d){if(_0x3bfc4d){return db[_0x9444('0x83')][_0x9444('0x38')]({'where':{'FaxAccountId':_0xa0bf50},'transaction':_0x5bc654})[_0x9444('0x37')](function(){var _0x41e675=_[_0x9444('0x41')](_0xd28b6c,function(_0x132e7f){_0x132e7f[_0x9444('0x69')]=_0xa0bf50;return _0x132e7f;});return db[_0x9444('0x83')][_0x9444('0x84')](_0x41e675,{'transaction':_0x5bc654});});}else{_0x5ca334=0x194;_0x24f864=[];}});})[_0x9444('0x37')](function(){if(_0x5ca334!==0x194){return db[_0x9444('0x83')][_0x9444('0x85')]({'where':{'FaxAccountId':_0xa0bf50},'order':'priority'})[_0x9444('0x37')](function(_0x1169a0){_0x24f864=_0x1169a0;});}})[_0x9444('0x2b')](function(_0x2ec345){_0x5ca334=0x1f4;logger['error'](_0x2ec345['stack']);if(_0x2ec345[_0x9444('0x3c')]){delete _0x2ec345[_0x9444('0x3c')];}_0x24f864=_0x2ec345;})['finally'](function(){if(_0x24f864===null){_0x58a991[_0x9444('0x2c')](_0x5ca334);}else{if(_0x5ca334===0x1f4){_0x58a991['status'](_0x5ca334)[_0x9444('0x3d')](_0x24f864);}else{_0x58a991[_0x9444('0x2d')](_0x5ca334)[_0x9444('0x2f')](_0x24f864);}}});};exports[_0x9444('0x86')]=function(_0x577752,_0x1de676,_0x56079d){var _0x4b15cf={};var _0x27a91b={};var _0x3e3722;var _0xfec588;return db[_0x9444('0x42')]['findOne']({'where':{'id':_0x577752['params']['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x1de676,null))[_0x9444('0x37')](function(_0x4f82c3){if(_0x4f82c3){_0x3e3722=_0x4f82c3;_0x27a91b[_0x9444('0x45')]=_[_0x9444('0x59')](db[_0x9444('0x83')]['rawAttributes']);_0x27a91b[_0x9444('0x46')]=_[_0x9444('0x59')](_0x577752[_0x9444('0x46')]);_0x27a91b[_0x9444('0x47')]=_[_0x9444('0x48')](_0x27a91b['model'],_0x27a91b[_0x9444('0x46')]);_0x4b15cf[_0x9444('0x49')]=_['intersection'](_0x27a91b[_0x9444('0x45')],qs[_0x9444('0x4a')](_0x577752[_0x9444('0x46')][_0x9444('0x4a')]));_0x4b15cf[_0x9444('0x49')]=_0x4b15cf['attributes']['length']?_0x4b15cf['attributes']:_0x27a91b[_0x9444('0x45')];_0x4b15cf[_0x9444('0x4e')]=qs[_0x9444('0x4f')](_0x577752[_0x9444('0x46')][_0x9444('0x4f')]);_0x4b15cf['where']=qs['filters'](_[_0x9444('0x51')](_0x577752[_0x9444('0x46')],_0x27a91b['filters']));if(_0x577752['query'][_0x9444('0x52')]){_0x4b15cf['where']=_[_0x9444('0x5c')](_0x4b15cf[_0x9444('0x50')],{'$or':_[_0x9444('0x41')](_0x4b15cf['attributes'],function(_0xc5e715){var _0x5ccf91={};_0x5ccf91[_0xc5e715]={'$like':'%'+_0x577752[_0x9444('0x46')][_0x9444('0x52')]+'%'};return _0x5ccf91;})});}_0x4b15cf=_[_0x9444('0x5c')]({},_0x4b15cf,_0x577752['options']);return _0x3e3722[_0x9444('0x86')](_0x4b15cf);}})[_0x9444('0x37')](function(_0x5f2365){if(_0x5f2365){_0xfec588=_0x5f2365[_0x9444('0x5a')];if(!_0x577752[_0x9444('0x46')][_0x9444('0x4b')](_0x9444('0x6d'))){_0x4b15cf[_0x9444('0x4c')]=qs[_0x9444('0x4c')](_0x577752[_0x9444('0x46')]['limit']);_0x4b15cf['offset']=qs[_0x9444('0x4d')](_0x577752[_0x9444('0x46')][_0x9444('0x4d')]);}return _0x3e3722[_0x9444('0x86')](_0x4b15cf);}})[_0x9444('0x37')](function(_0x295f3a){if(_0x295f3a){return _0x295f3a?{'count':_0xfec588,'rows':_0x295f3a}:null;}})[_0x9444('0x37')](respondWithResult(_0x1de676,null))[_0x9444('0x2b')](handleError(_0x1de676,null));};function Extension(_0x4a8554,_0x86887,_0x358b84,_0x25cf1b){this[_0x9444('0x87')]=_0x9444('0x88');this[_0x9444('0x89')]=_0x4a8554[_0x9444('0x8a')];this['app']=_0x25cf1b;this['type']=_0x9444('0x8b');this[_0x9444('0x8c')]=_0x9444('0x8d');this['FaxAccountId']=_0x4a8554['id'];this[_0x9444('0x8e')]=_0x86887;this[_0x9444('0x8f')]=_0x358b84;}function createExtensionsReciveFax(_0x2385d0){var _0x472f7b=0x1;var _0x118ffd=[];_0x118ffd[_0x9444('0x90')](new Extension(_0x2385d0,_0x472f7b,'','Answer'));_0x472f7b+=0x1;_0x118ffd[_0x9444('0x90')](new Extension(_0x2385d0,_0x472f7b,_0x9444('0x91'),'Set'));_0x472f7b+=0x1;for(var _0x1833f3 in _0x2385d0){if(_0x2385d0[_0x9444('0x4b')](_0x1833f3)&&(_0x1833f3==='ecm'||_0x1833f3==='localstationid'||_0x1833f3==='gateway'||_0x1833f3===_0x9444('0x92')||_0x1833f3==='headerinfo'||_0x1833f3===_0x9444('0x93')||_0x1833f3===_0x9444('0x94')||_0x1833f3===_0x9444('0x95')||_0x1833f3===_0x9444('0x96'))){_0x118ffd[_0x9444('0x90')](new Extension(_0x2385d0,_0x472f7b,_0x9444('0x97')+_0x1833f3+')='+_0x2385d0[_0x1833f3],_0x9444('0x98')));_0x472f7b+=0x1;}}_0x118ffd['push'](new Extension(_0x2385d0,_0x472f7b,'6','Wait'));_0x472f7b+=0x1;_0x118ffd[_0x9444('0x90')](new Extension(_0x2385d0,_0x472f7b,'/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',_0x9444('0x99')));_0x472f7b=0x0;return _0x118ffd;}exports['addAccountApplications']=function(_0x521d71,_0x26805c,_0x48ca2f){var _0x5cc93c;return db[_0x9444('0x7f')][_0x9444('0x80')](function(_0x32c3b8){return db[_0x9444('0x42')][_0x9444('0x5e')](_0x521d71[_0x9444('0x5f')],{'transaction':_0x32c3b8})[_0x9444('0x37')](function(_0x45d57d){_0x5cc93c=_0x45d57d[_0x9444('0x39')]({'plain':!![]});return db[_0x9444('0x9a')][_0x9444('0x84')](createExtensionsReciveFax(_0x5cc93c),{'transaction':_0x32c3b8});});})[_0x9444('0x37')](function(){return _0x5cc93c;})[_0x9444('0x37')](respondWithResult(_0x26805c,null))['catch'](handleError(_0x26805c,null));};exports[_0x9444('0x9b')]=function(_0x32e2a3,_0x411f96,_0x49efa4){var _0x28db7f;return db[_0x9444('0x7f')][_0x9444('0x80')](function(_0xa153ce){return db['FaxAccount'][_0x9444('0x67')](_0x32e2a3[_0x9444('0x5f')],{'where':{'id':_0x32e2a3[_0x9444('0x5f')]['id']},'transaction':_0xa153ce})['then'](function(_0x2f90b1){return db[_0x9444('0x9a')]['destroy']({'where':{'FaxAccountId':_0x32e2a3['body']['id']},'transaction':_0xa153ce})[_0x9444('0x37')](function(_0x143097){return db[_0x9444('0x9a')][_0x9444('0x84')](createExtensionsReciveFax(_[_0x9444('0x76')](_0x32e2a3[_0x9444('0x5f')],['tech','key','createdAt',_0x9444('0x9c'),_0x9444('0x9d'),_0x9444('0x9e')])),{'transaction':_0xa153ce});});});})['then'](function(){return db[_0x9444('0x42')][_0x9444('0x9f')](_0x32e2a3[_0x9444('0x5f')]['id']);})[_0x9444('0x37')](respondWithResult(_0x411f96,null))[_0x9444('0x2b')](handleError(_0x411f96,null));};exports['getMessages']=function(_0x1d0009,_0x2667c6,_0xb60ece){var _0x42f07d={'raw':!![],'where':{}};var _0x1b0e8d={};var _0xf2bbce={'count':0x0,'rows':[]};return db[_0x9444('0x42')][_0x9444('0x6c')]({'where':{'id':_0x1d0009['params']['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x2667c6,null))[_0x9444('0x37')](function(_0x43dc0c){if(_0x43dc0c){_0x1b0e8d[_0x9444('0x45')]=_['keys'](db[_0x9444('0xa0')][_0x9444('0x43')]);_0x1b0e8d[_0x9444('0x46')]=_[_0x9444('0x59')](_0x1d0009[_0x9444('0x46')]);_0x1b0e8d[_0x9444('0x47')]=_['intersection'](_0x1b0e8d['model'],_0x1b0e8d[_0x9444('0x46')]);_0x42f07d['attributes']=_[_0x9444('0x48')](_0x1b0e8d[_0x9444('0x45')],qs[_0x9444('0x4a')](_0x1d0009[_0x9444('0x46')][_0x9444('0x4a')]));_0x42f07d['attributes']=_0x42f07d[_0x9444('0x49')][_0x9444('0x5a')]?_0x42f07d[_0x9444('0x49')]:_0x1b0e8d[_0x9444('0x45')];if(!_0x1d0009[_0x9444('0x46')][_0x9444('0x4b')](_0x9444('0x6d'))){_0x42f07d['limit']=qs[_0x9444('0x4c')](_0x1d0009[_0x9444('0x46')][_0x9444('0x4c')]);_0x42f07d[_0x9444('0x4d')]=qs['offset'](_0x1d0009[_0x9444('0x46')][_0x9444('0x4d')]);}_0x42f07d['order']=qs[_0x9444('0x4f')](_0x1d0009['query']['sort']);_0x42f07d['where']=qs['filters'](_[_0x9444('0x51')](_0x1d0009[_0x9444('0x46')],_0x1b0e8d[_0x9444('0x47')]));_0x42f07d['where'][_0x9444('0x69')]=_0x43dc0c['id'];if(_0x1d0009[_0x9444('0x46')][_0x9444('0x52')]){_0x42f07d[_0x9444('0x50')]=_[_0x9444('0x5c')](_0x42f07d[_0x9444('0x50')],{'$or':_[_0x9444('0x41')](_0x42f07d[_0x9444('0x49')],function(_0x2b340e){var _0x194017={};_0x194017[_0x2b340e]={'$like':'%'+_0x1d0009[_0x9444('0x46')][_0x9444('0x52')]+'%'};return _0x194017;})});}if(_0x1d0009[_0x9444('0x46')][_0x9444('0xa1')]){var _0x5cab8b=_0x1d0009[_0x9444('0x46')][_0x9444('0xa1')][_0x9444('0xa2')](',');var _0xbe9337={};_0xbe9337[_0x5cab8b[0x0]]={'$gte':moment(_0x5cab8b[0x1])[_0x9444('0xa3')](_0x9444('0xa4'))};_0x42f07d[_0x9444('0x50')]=_[_0x9444('0x5c')](_0x42f07d[_0x9444('0x50')],_0xbe9337);}_0x42f07d=_[_0x9444('0x5c')]({},_0x42f07d,_0x1d0009[_0x9444('0x54')]);return db[_0x9444('0xa0')]['count']({'where':_0x42f07d[_0x9444('0x50')]})[_0x9444('0x37')](function(_0x41b050){_0xf2bbce[_0x9444('0x31')]=_0x41b050;if(_0x1d0009['query'][_0x9444('0x5b')]){_0x42f07d[_0x9444('0x55')]=[{'all':!![]}];}return db[_0x9444('0xa0')][_0x9444('0x56')](_0x42f07d);})[_0x9444('0x37')](function(_0x2d11f3){_0xf2bbce[_0x9444('0x6e')]=_0x2d11f3;return _0xf2bbce;});}})[_0x9444('0x37')](respondWithFilteredResult(_0x2667c6,_0x42f07d))['catch'](handleError(_0x2667c6,null));};exports['send']=function(_0x4ae0a6,_0x209843,_0x7352e7){var _0xb76b54,_0x226406={},_0x47bf0c;if(_0x4ae0a6[_0x9444('0x5f')]['to']){_0x47bf0c=_0x4ae0a6['body']['to'][0x0];}return db[_0x9444('0x42')][_0x9444('0x5d')]({'where':{'id':_0x4ae0a6[_0x9444('0x58')]['id']},'include':[{'model':db[_0x9444('0xa5')],'as':'List','include':[{'model':db[_0x9444('0x78')],'as':_0x9444('0xa6'),'where':{'fax':_0x47bf0c},'limit':0x1,'order':[[_0x9444('0x9c'),'DESC']]}]}]})[_0x9444('0x37')](handleEntityNotFound(_0x209843,null))[_0x9444('0x37')](function(_0xfe9402){_0xb76b54=_0xfe9402;if(_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')]&&_0x4ae0a6[_0x9444('0x5f')]['attachments'][_0x9444('0x5a')]){for(var _0x2b186c=0x0;_0x2b186c<_0x4ae0a6['body'][_0x9444('0xa7')][_0x9444('0x5a')];_0x2b186c+=0x1){_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')][_0x2b186c]={'filename':_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')][_0x2b186c][_0x9444('0x3c')],'id':_0x4ae0a6['body'][_0x9444('0xa7')][_0x2b186c]['id'],'path':path[_0x9444('0xa8')](config[_0x9444('0xa9')],'server/files/attachments',_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')][_0x2b186c][_0x9444('0xaa')])};}}return respondWithRpcPromise('CheckAfterSend',_0x9444('0xab'),{'FaxAccountId':_['isNil'](_0x4ae0a6[_0x9444('0x58')]['id'])?undefined:_0x4ae0a6[_0x9444('0x58')]['id'],'path':_[_0x9444('0xac')](_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')][0x0][_0x9444('0x9')])?undefined:_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')][0x0]['path'],'fax':_['isNil'](_0x4ae0a6[_0x9444('0x5f')]['to'][0x0])?undefined:_0x4ae0a6['body']['to'][0x0]},client9002);})[_0x9444('0x37')](function(){if(_0xb76b54){if(_[_0x9444('0xac')](_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xad')])){_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xad')]=util[_0x9444('0xa3')]('\x22%s\x22\x20<%s>',_0xb76b54[_0x9444('0x3c')],_0xb76b54[_0x9444('0xae')]);}if(_0xb76b54[_0x9444('0xaf')]){if(_0xb76b54['List']['Contacts'][_0x9444('0x5a')]){return _0xb76b54[_0x9444('0xaf')]['Contacts'][0x0];}else{return db[_0x9444('0x78')][_0x9444('0x5e')](_['defaults'](_0x4ae0a6[_0x9444('0x5f')],{'firstName':_0x4ae0a6['body']['to'][0x0],'phone':_0x4ae0a6[_0x9444('0x5f')]['to'][0x0],'fax':_0x4ae0a6['body']['to'][0x0],'ListId':_0xb76b54[_0x9444('0x9e')]}));}}else{throw new Error(_0x9444('0xb0'));}}else{throw new Error(_0x9444('0xb1'));}})[_0x9444('0x37')](function(_0x255321){if(_0x255321){return db['FaxInteraction'][_0x9444('0x5d')]({'where':{'ContactId':_0x255321['id'],'closed':![],'FaxAccountId':_0xb76b54['id']}})[_0x9444('0x37')](function(_0x1103e5){if(_0x1103e5){return[_0x1103e5,![]];}return db[_0x9444('0x75')][_0x9444('0x5e')]({'UserId':_0x4ae0a6['user']['id'],'ContactId':_0x255321['id'],'FaxAccountId':_0xb76b54['id'],'fax':_0x4ae0a6[_0x9444('0x5f')]['to'][0x0],'firstMsgDirection':_0x9444('0xb2'),'Messages':[_[_0x9444('0x5c')](_0x4ae0a6[_0x9444('0x5f')],{'read':![],'body':_0x4ae0a6['body'][_0x9444('0xa7')][0x0][_0x9444('0xb3')],'FaxAccountId':_0xb76b54['id'],'UserId':_0x4ae0a6['user']['id'],'ContactId':_0x255321['id'],'AttachmentId':_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x9444('0xa0')],'as':_0x9444('0xb4')}]})[_0x9444('0x37')](function(_0x30f9e5){return[_0x30f9e5,!![]];});});}else{throw new Error(_0x9444('0xb5'));}})['spread'](function(_0x500353,_0x511c78){if(_0x511c78){return _0x500353;}return db[_0x9444('0xa0')][_0x9444('0x5e')]({'direction':'out','read':![],'body':_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')][0x0]['filename'],'FaxAccountId':_0xb76b54['id'],'FaxInteractionId':_0x500353['id'],'UserId':_0x4ae0a6[_0x9444('0x60')]['id'],'ContactId':_0x500353[_0x9444('0xb6')],'AttachmentId':_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')][0x0]['id']})[_0x9444('0x37')](function(_0x429125){_0x500353[_0x9444('0xb7')][_0x9444('0xb4')]=[];_0x500353[_0x9444('0xb7')][_0x9444('0xb4')]['push'](_0x429125[_0x9444('0xb7')]);return _0x500353;});})[_0x9444('0x37')](function(_0x521bc9){respondWithRpcPromise('SendFax',_0x9444('0xb8'),{'FaxAccountId':_[_0x9444('0xac')](_0x4ae0a6[_0x9444('0x58')]['id'])?undefined:_0x4ae0a6[_0x9444('0x58')]['id'],'path':_[_0x9444('0xac')](_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')][0x0][_0x9444('0x9')])?undefined:_0x4ae0a6['body'][_0x9444('0xa7')][0x0][_0x9444('0x9')],'fax':_['isNil'](_0x4ae0a6[_0x9444('0x5f')]['to'][0x0])?undefined:_0x4ae0a6[_0x9444('0x5f')]['to'][0x0],'AttachmentId':_0x4ae0a6[_0x9444('0x5f')][_0x9444('0xa7')][0x0]['id']},client9002)['then'](function(_0x5d205c){logger[_0x9444('0x22')]('SendFaxRpc,\x20%s',_0x5d205c);})[_0x9444('0x2b')](function(_0x45fe87){logger[_0x9444('0x22')](_0x9444('0xb9'),_0x45fe87);});return _0x521bc9;})['then'](respondWithResult(_0x209843,null))[_0x9444('0x2b')](handleError(_0x209843,null));};exports[_0x9444('0xba')]=function(_0x488dfc,_0x11d34a,_0xcce95a){return db[_0x9444('0x42')][_0x9444('0x5d')]({'where':{'id':_0x488dfc[_0x9444('0x58')]['id']}})[_0x9444('0x37')](handleEntityNotFound(_0x11d34a,null))[_0x9444('0x37')](function(_0x9814e5){if(_0x9814e5){return _0x9814e5[_0x9444('0xba')](_0x488dfc[_0x9444('0x5f')][_0x9444('0x70')],_['omit'](_0x488dfc['body'],['ids','id'])||{})['spread'](function(_0x2cf873){for(var _0x41e382=0x0;_0x41e382<_0x488dfc[_0x9444('0x5f')][_0x9444('0x70')][_0x9444('0x5a')];_0x41e382+=0x1){socket[_0x9444('0xbb')](_0x9444('0xbc'),{'UserId':Number(_0x488dfc[_0x9444('0x5f')][_0x9444('0x70')][_0x41e382]),'FaxAccountId':Number(_0x488dfc['params']['id'])});}return _0x2cf873;});}})['then'](respondWithResult(_0x11d34a,null))['catch'](handleError(_0x11d34a,null));};exports['removeAgents']=function(_0x205f34,_0xece264,_0x6f50f6){return db[_0x9444('0x42')]['find']({'where':{'id':_0x205f34['params']['id']}})[_0x9444('0x37')](handleEntityNotFound(_0xece264,null))[_0x9444('0x37')](function(_0x1855dd){if(_0x1855dd){return _0x1855dd[_0x9444('0xbd')](_0x205f34[_0x9444('0x46')][_0x9444('0x70')])[_0x9444('0x37')](function(){if(_['isArray'](_0x205f34[_0x9444('0x46')][_0x9444('0x70')])){for(var _0x3f9172=0x0;_0x3f9172<_0x205f34[_0x9444('0x46')][_0x9444('0x70')][_0x9444('0x5a')];_0x3f9172+=0x1){socket['emit'](_0x9444('0xbe'),{'UserId':Number(_0x205f34['query']['ids'][_0x3f9172]),'FaxAccountId':Number(_0x205f34[_0x9444('0x58')]['id'])});}}else{socket[_0x9444('0xbb')](_0x9444('0xbe'),{'UserId':Number(_0x205f34[_0x9444('0x46')][_0x9444('0x70')]),'FaxAccountId':Number(_0x205f34[_0x9444('0x58')]['id'])});}});}})[_0x9444('0x37')](respondWithStatusCode(_0xece264,null))[_0x9444('0x2b')](handleError(_0xece264,null));};exports[_0x9444('0xbf')]=function(_0x59aac7,_0xfc2c9d,_0x233321){var _0x1fbcf5={};var _0x386726={};var _0x1210ec;var _0x3b4e2e;return db[_0x9444('0x42')]['findOne']({'where':{'id':_0x59aac7[_0x9444('0x58')]['id']}})['then'](handleEntityNotFound(_0xfc2c9d,null))[_0x9444('0x37')](function(_0x74384f){if(_0x74384f){_0x1210ec=_0x74384f;_0x386726[_0x9444('0x45')]=_['keys'](db[_0x9444('0x79')][_0x9444('0x43')]);_0x386726[_0x9444('0x46')]=_[_0x9444('0x59')](_0x59aac7[_0x9444('0x46')]);_0x386726[_0x9444('0x47')]=_['intersection'](_0x386726[_0x9444('0x45')],_0x386726[_0x9444('0x46')]);_0x1fbcf5[_0x9444('0x49')]=_[_0x9444('0x48')](_0x386726[_0x9444('0x45')],qs[_0x9444('0x4a')](_0x59aac7[_0x9444('0x46')][_0x9444('0x4a')]));_0x1fbcf5[_0x9444('0x49')]=_0x1fbcf5[_0x9444('0x49')][_0x9444('0x5a')]?_0x1fbcf5[_0x9444('0x49')]:_0x386726[_0x9444('0x45')];_0x1fbcf5['order']=qs[_0x9444('0x4f')](_0x59aac7[_0x9444('0x46')]['sort']);_0x1fbcf5[_0x9444('0x50')]=qs[_0x9444('0x47')](_[_0x9444('0x51')](_0x59aac7['query'],_0x386726['filters']));if(_0x59aac7['query'][_0x9444('0x52')]){_0x1fbcf5['where']=_[_0x9444('0x5c')](_0x1fbcf5[_0x9444('0x50')],{'$or':_[_0x9444('0x41')](_0x1fbcf5['attributes'],function(_0x5a98d7){var _0x3b77f8={};_0x3b77f8[_0x5a98d7]={'$like':'%'+_0x59aac7[_0x9444('0x46')][_0x9444('0x52')]+'%'};return _0x3b77f8;})});}_0x1fbcf5=_[_0x9444('0x5c')]({},_0x1fbcf5,_0x59aac7[_0x9444('0x54')]);return _0x1210ec[_0x9444('0xbf')](_0x1fbcf5);}})['then'](function(_0x479913){if(_0x479913){_0x3b4e2e=_0x479913[_0x9444('0x5a')];if(!_0x59aac7[_0x9444('0x46')][_0x9444('0x4b')](_0x9444('0x6d'))){_0x1fbcf5['limit']=qs[_0x9444('0x4c')](_0x59aac7[_0x9444('0x46')][_0x9444('0x4c')]);_0x1fbcf5['offset']=qs[_0x9444('0x4d')](_0x59aac7[_0x9444('0x46')][_0x9444('0x4d')]);}return _0x1210ec[_0x9444('0xbf')](_0x1fbcf5);}})[_0x9444('0x37')](function(_0x7dde56){if(_0x7dde56){return _0x7dde56?{'count':_0x3b4e2e,'rows':_0x7dde56}:null;}})['then'](respondWithResult(_0xfc2c9d,null))['catch'](handleError(_0xfc2c9d,null));}; \ No newline at end of file +var _0xb910=['rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','get','FaxAccounts','destroy','end','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addInteraction','omit','getInteractions','FaxInteraction','Contact','User','Owner','fullname','Tags','tag','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','appdata','Answer','push','ecm','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','Contacts','updatedAt','DESC','attachments','join','root','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','List','CmContact','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format'];(function(_0x22b9a2,_0x14d4a2){var _0x2e9765=function(_0xeda663){while(--_0xeda663){_0x22b9a2['push'](_0x22b9a2['shift']());}};_0x2e9765(++_0x14d4a2);}(_0xb910,0x189));var _0x0b91=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xb910[_0x39d544];return _0x5a5ff2;};'use strict';var emlformat=require(_0x0b91('0x0'));var rimraf=require(_0x0b91('0x1'));var zipdir=require(_0x0b91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0b91('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0b91('0x4'));var util=require(_0x0b91('0x5'));var path=require('path');var sox=require(_0x0b91('0x6'));var csv=require(_0x0b91('0x7'));var ejs=require(_0x0b91('0x8'));var fs=require('fs');var fs_extra=require(_0x0b91('0x9'));var _=require(_0x0b91('0xa'));var squel=require(_0x0b91('0xb'));var crypto=require(_0x0b91('0xc'));var jsforce=require(_0x0b91('0xd'));var deskjs=require(_0x0b91('0xe'));var toCsv=require(_0x0b91('0x7'));var querystring=require(_0x0b91('0xf'));var Papa=require(_0x0b91('0x10'));var Redis=require(_0x0b91('0x11'));var authService=require(_0x0b91('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0b91('0x13'));var hardwareService=require(_0x0b91('0x14'));var logger=require(_0x0b91('0x15'))(_0x0b91('0x16'));var utils=require(_0x0b91('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0b91('0x18'));var db=require(_0x0b91('0x19'))['db'];config[_0x0b91('0x1a')]=_[_0x0b91('0x1b')](config[_0x0b91('0x1a')],{'host':_0x0b91('0x1c'),'port':0x18eb});var socket=require(_0x0b91('0x1d'))(new Redis(config[_0x0b91('0x1a')]));require(_0x0b91('0x1e'))[_0x0b91('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0b91('0x20')][_0x0b91('0x21')]({'port':0x232c});var client9002=jayson[_0x0b91('0x20')][_0x0b91('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x288208,_0x5622d1,_0x28bfa9,_0x3444bf){return new BPromise(function(_0x226adf,_0x33a616){var _0xd59540=_0x3444bf||client;return _0xd59540[_0x0b91('0x22')](_0x288208,_0x28bfa9)[_0x0b91('0x23')](function(_0x3823a8){logger[_0x0b91('0x24')](_0x0b91('0x25'),_0x5622d1,'request\x20sent');logger['debug'](_0x0b91('0x26'),_0x5622d1,_0x0b91('0x27'),JSON[_0x0b91('0x28')](_0x3823a8));if(_0x3823a8[_0x0b91('0x29')]){if(_0x3823a8[_0x0b91('0x29')][_0x0b91('0x2a')]===0x1f4){logger[_0x0b91('0x29')](_0x0b91('0x25'),_0x5622d1,_0x3823a8[_0x0b91('0x29')][_0x0b91('0x2b')]);return _0x33a616(_0x3823a8[_0x0b91('0x29')]['message']);}logger[_0x0b91('0x29')]('FaxAccount,\x20%s,\x20%s',_0x5622d1,_0x3823a8['error'][_0x0b91('0x2b')]);return _0x226adf(_0x3823a8[_0x0b91('0x29')][_0x0b91('0x2b')]);}else{logger[_0x0b91('0x24')](_0x0b91('0x25'),_0x5622d1,_0x0b91('0x27'));_0x226adf(_0x3823a8['result'][_0x0b91('0x2b')]);}})[_0x0b91('0x2c')](function(_0x41ce98){logger[_0x0b91('0x29')](_0x0b91('0x25'),_0x5622d1,_0x41ce98);_0x33a616(_0x41ce98);});});}function respondWithStatusCode(_0x72c950,_0x51af7a){_0x51af7a=_0x51af7a||0xcc;return function(_0x2070c0){if(_0x2070c0){return _0x72c950[_0x0b91('0x2d')](_0x51af7a);}return _0x72c950['status'](_0x51af7a)['end']();};}function respondWithResult(_0x317a41,_0x44faf0){_0x44faf0=_0x44faf0||0xc8;return function(_0x4325cc){if(_0x4325cc){return _0x317a41[_0x0b91('0x2e')](_0x44faf0)['json'](_0x4325cc);}};}function respondWithFilteredResult(_0x2d6cb1,_0x43264a){return function(_0x5d303d){if(_0x5d303d){var _0x342343=typeof _0x43264a[_0x0b91('0x2f')]===_0x0b91('0x30')&&typeof _0x43264a[_0x0b91('0x31')]===_0x0b91('0x30');var _0x561c91=_0x5d303d[_0x0b91('0x32')];var _0x89f97f=_0x342343?0x0:_0x43264a[_0x0b91('0x2f')];var _0x3c1ab7=_0x342343?_0x5d303d[_0x0b91('0x32')]:_0x43264a['offset']+_0x43264a[_0x0b91('0x31')];var _0x3e7494;if(_0x3c1ab7>=_0x561c91){_0x3c1ab7=_0x561c91;_0x3e7494=0xc8;}else{_0x3e7494=0xce;}_0x2d6cb1[_0x0b91('0x2e')](_0x3e7494);return _0x2d6cb1['set'](_0x0b91('0x33'),_0x89f97f+'-'+_0x3c1ab7+'/'+_0x561c91)[_0x0b91('0x34')](_0x5d303d);}return null;};}function patchUpdates(_0x5f0dbd){return function(_0x585292){try{jsonpatch[_0x0b91('0x35')](_0x585292,_0x5f0dbd,!![]);}catch(_0x5482d9){return BPromise['reject'](_0x5482d9);}return _0x585292[_0x0b91('0x36')]();};}function saveUpdates(_0x26e845,_0x58aa2a){return function(_0x4f99e3){if(_0x4f99e3){return _0x4f99e3[_0x0b91('0x37')](_0x26e845)[_0x0b91('0x23')](function(_0x2c7555){return _0x2c7555;});}return null;};}function removeEntity(_0x3fdf60,_0x178345){return function(_0x13929a){if(_0x13929a){return _0x13929a['destroy']()[_0x0b91('0x23')](function(){var _0x5e0054=_0x13929a[_0x0b91('0x38')]({'plain':!![]});var _0x17093a=_0x0b91('0x39');return db['UserProfileResource'][_0x0b91('0x3a')]({'where':{'type':_0x17093a,'resourceId':_0x5e0054['id']}})[_0x0b91('0x23')](function(){return _0x13929a;});})['then'](function(){_0x3fdf60[_0x0b91('0x2e')](0xcc)[_0x0b91('0x3b')]();});}};}function handleEntityNotFound(_0x38afa6,_0x3082e0){return function(_0x318138){if(!_0x318138){_0x38afa6[_0x0b91('0x2d')](0x194);}return _0x318138;};}function handleError(_0x1577b0,_0x3d1c7a){_0x3d1c7a=_0x3d1c7a||0x1f4;return function(_0x1b7b02){logger[_0x0b91('0x29')](_0x1b7b02['stack']);if(_0x1b7b02['name']){delete _0x1b7b02[_0x0b91('0x3c')];}_0x1577b0[_0x0b91('0x2e')](_0x3d1c7a)[_0x0b91('0x3d')](_0x1b7b02);};}exports[_0x0b91('0x3e')]=function(_0x303186,_0x4b7c2c){var _0x464a33={'include':[{'model':db[_0x0b91('0x3f')],'as':_0x0b91('0x40')}]},_0x3137be={},_0x19dac5={'count':0x0,'rows':[]};var _0x1b56bc=_[_0x0b91('0x41')](db[_0x0b91('0x42')][_0x0b91('0x43')],function(_0x487924){return{'name':_0x487924['fieldName'],'type':_0x487924[_0x0b91('0x44')][_0x0b91('0x45')]};});_0x3137be['model']=_['map'](_0x1b56bc,_0x0b91('0x3c'));_0x3137be[_0x0b91('0x46')]=_[_0x0b91('0x47')](_0x303186[_0x0b91('0x46')]);_0x3137be[_0x0b91('0x48')]=_[_0x0b91('0x49')](_0x3137be[_0x0b91('0x4a')],_0x3137be[_0x0b91('0x46')]);_0x464a33[_0x0b91('0x4b')]=_[_0x0b91('0x49')](_0x3137be[_0x0b91('0x4a')],qs[_0x0b91('0x4c')](_0x303186[_0x0b91('0x46')][_0x0b91('0x4c')]));_0x464a33[_0x0b91('0x4b')]=_0x464a33['attributes'][_0x0b91('0x4d')]?_0x464a33['attributes']:_0x3137be['model'];if(!_0x303186[_0x0b91('0x46')]['hasOwnProperty'](_0x0b91('0x4e'))){_0x464a33[_0x0b91('0x31')]=qs[_0x0b91('0x31')](_0x303186['query']['limit']);_0x464a33[_0x0b91('0x2f')]=qs[_0x0b91('0x2f')](_0x303186[_0x0b91('0x46')][_0x0b91('0x2f')]);}_0x464a33['order']=qs[_0x0b91('0x4f')](_0x303186[_0x0b91('0x46')][_0x0b91('0x4f')]);_0x464a33[_0x0b91('0x50')]=qs[_0x0b91('0x48')](_[_0x0b91('0x51')](_0x303186[_0x0b91('0x46')],_0x3137be['filters']),_0x1b56bc);if(_0x303186[_0x0b91('0x46')][_0x0b91('0x52')]){_0x464a33[_0x0b91('0x50')]=_['merge'](_0x464a33[_0x0b91('0x50')],{'$or':_[_0x0b91('0x41')](_0x1b56bc,function(_0x258c01){if(_0x258c01[_0x0b91('0x44')]!==_0x0b91('0x53')){var _0x4a2944={};_0x4a2944[_0x258c01['name']]={'$like':'%'+_0x303186[_0x0b91('0x46')]['filter']+'%'};return _0x4a2944;}})});}_0x464a33=_[_0x0b91('0x54')]({},_0x464a33,_0x303186['options']);var _0xe0eefe={'where':_0x464a33[_0x0b91('0x50')]};return db[_0x0b91('0x42')][_0x0b91('0x32')](_0xe0eefe)['then'](function(_0x14bc8f){_0x19dac5['count']=_0x14bc8f;if(_0x303186['query'][_0x0b91('0x55')]){_0x464a33['include']=[{'all':!![]}];}return db['FaxAccount'][_0x0b91('0x56')](_0x464a33);})[_0x0b91('0x23')](function(_0x3fdc74){_0x19dac5[_0x0b91('0x57')]=_0x3fdc74;return _0x19dac5;})[_0x0b91('0x23')](respondWithFilteredResult(_0x4b7c2c,_0x464a33))[_0x0b91('0x2c')](handleError(_0x4b7c2c,null));};exports[_0x0b91('0x58')]=function(_0x43338f,_0x1d2b0f){var _0x56b2d1={'raw':![],'where':{'id':_0x43338f[_0x0b91('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3091fc={};_0x3091fc[_0x0b91('0x4a')]=_[_0x0b91('0x47')](db[_0x0b91('0x42')][_0x0b91('0x43')]);_0x3091fc[_0x0b91('0x46')]=_[_0x0b91('0x47')](_0x43338f[_0x0b91('0x46')]);_0x3091fc[_0x0b91('0x48')]=_['intersection'](_0x3091fc[_0x0b91('0x4a')],_0x3091fc[_0x0b91('0x46')]);_0x56b2d1[_0x0b91('0x4b')]=_[_0x0b91('0x49')](_0x3091fc[_0x0b91('0x4a')],qs[_0x0b91('0x4c')](_0x43338f[_0x0b91('0x46')][_0x0b91('0x4c')]));_0x56b2d1[_0x0b91('0x4b')]=_0x56b2d1[_0x0b91('0x4b')][_0x0b91('0x4d')]?_0x56b2d1[_0x0b91('0x4b')]:_0x3091fc[_0x0b91('0x4a')];if(_0x43338f['query'][_0x0b91('0x55')]){_0x56b2d1[_0x0b91('0x5a')]=[{'all':!![]}];}_0x56b2d1=_[_0x0b91('0x54')]({},_0x56b2d1,_0x43338f[_0x0b91('0x5b')]);return db['FaxAccount']['find'](_0x56b2d1)['then'](handleEntityNotFound(_0x1d2b0f,null))[_0x0b91('0x23')](respondWithResult(_0x1d2b0f,null))['catch'](handleError(_0x1d2b0f,null));};exports[_0x0b91('0x5c')]=function(_0x569bff,_0x5bacbf){return db[_0x0b91('0x42')]['create'](_0x569bff[_0x0b91('0x5d')],{})[_0x0b91('0x23')](function(_0x3c2456){var _0x23c02d=_0x569bff[_0x0b91('0x5e')][_0x0b91('0x38')]({'plain':!![]});if(!_0x23c02d)throw new Error(_0x0b91('0x5f'));if(_0x23c02d[_0x0b91('0x60')]===_0x0b91('0x5e')){var _0x3d0772=_0x3c2456[_0x0b91('0x38')]({'plain':!![]});var _0x589632='FaxAccounts';return db[_0x0b91('0x61')][_0x0b91('0x62')]({'where':{'name':_0x589632,'userProfileId':_0x23c02d[_0x0b91('0x63')]},'raw':!![]})[_0x0b91('0x23')](function(_0xfd2d7b){if(_0xfd2d7b&&_0xfd2d7b[_0x0b91('0x64')]===0x0){return db[_0x0b91('0x65')]['create']({'name':_0x3d0772[_0x0b91('0x3c')],'resourceId':_0x3d0772['id'],'type':_0xfd2d7b[_0x0b91('0x3c')],'sectionId':_0xfd2d7b['id']},{})[_0x0b91('0x23')](function(){return _0x3c2456;});}else{return _0x3c2456;}})[_0x0b91('0x2c')](function(_0x49ed9e){logger['error'](_0x0b91('0x66'),_0x49ed9e);throw _0x49ed9e;});}return _0x3c2456;})[_0x0b91('0x23')](respondWithResult(_0x5bacbf,0xc9))['catch'](handleError(_0x5bacbf,null));};exports[_0x0b91('0x37')]=function(_0x16e13b,_0x536114){if(_0x16e13b[_0x0b91('0x5d')]['id']){delete _0x16e13b[_0x0b91('0x5d')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x16e13b[_0x0b91('0x59')]['id']},'include':[{'model':db[_0x0b91('0x3f')],'as':_0x0b91('0x40')}]})[_0x0b91('0x23')](handleEntityNotFound(_0x536114,null))[_0x0b91('0x23')](saveUpdates(_0x16e13b[_0x0b91('0x5d')],null))[_0x0b91('0x23')](respondWithResult(_0x536114,null))[_0x0b91('0x2c')](handleError(_0x536114,null));};exports['destroy']=function(_0x54caa5,_0x33dcb8){return db[_0x0b91('0x42')][_0x0b91('0x62')]({'where':{'id':_0x54caa5[_0x0b91('0x59')]['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0x33dcb8,null))['then'](removeEntity(_0x33dcb8,null))['catch'](handleError(_0x33dcb8,null));};exports['describe']=function(_0x13d82e,_0x21b8e6){return db[_0x0b91('0x42')]['describe']()[_0x0b91('0x23')](respondWithResult(_0x21b8e6,null))[_0x0b91('0x2c')](handleError(_0x21b8e6,null));};exports[_0x0b91('0x67')]=function(_0x1112ef,_0x4f9d6e,_0x1a9f11){if(_0x1112ef[_0x0b91('0x5d')]['id']){delete _0x1112ef[_0x0b91('0x5d')]['id'];}return db[_0x0b91('0x42')][_0x0b91('0x62')]({'where':{'id':_0x1112ef[_0x0b91('0x59')]['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0x4f9d6e,null))[_0x0b91('0x23')](function(_0x2b9ed0){if(_0x2b9ed0){_0x1112ef[_0x0b91('0x5d')][_0x0b91('0x68')]=_0x2b9ed0['id'];return db[_0x0b91('0x69')][_0x0b91('0x5c')](_0x1112ef[_0x0b91('0x5d')]);}})[_0x0b91('0x23')](respondWithResult(_0x4f9d6e,null))[_0x0b91('0x2c')](handleError(_0x4f9d6e,null));};exports[_0x0b91('0x6a')]=function(_0x16582e,_0x3fce85,_0x3250ad){var _0x442c8a={'raw':![],'where':{}};var _0x4a14c8={};var _0x4286fe={'count':0x0,'rows':[]};return db[_0x0b91('0x42')][_0x0b91('0x6b')]({'where':{'id':_0x16582e[_0x0b91('0x59')]['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0x3fce85,null))[_0x0b91('0x23')](function(_0x1b7815){if(_0x1b7815){_0x4a14c8[_0x0b91('0x4a')]=_[_0x0b91('0x47')](db[_0x0b91('0x69')][_0x0b91('0x43')]);_0x4a14c8[_0x0b91('0x46')]=_['keys'](_0x16582e['query']);_0x4a14c8[_0x0b91('0x48')]=_[_0x0b91('0x49')](_0x4a14c8[_0x0b91('0x4a')],_0x4a14c8[_0x0b91('0x46')]);_0x442c8a[_0x0b91('0x4b')]=_['intersection'](_0x4a14c8[_0x0b91('0x4a')],qs[_0x0b91('0x4c')](_0x16582e[_0x0b91('0x46')][_0x0b91('0x4c')]));_0x442c8a['attributes']=_0x442c8a[_0x0b91('0x4b')]['length']?_0x442c8a[_0x0b91('0x4b')]:_0x4a14c8[_0x0b91('0x4a')];if(!_0x16582e[_0x0b91('0x46')][_0x0b91('0x6c')](_0x0b91('0x4e'))){_0x442c8a['limit']=qs['limit'](_0x16582e[_0x0b91('0x46')][_0x0b91('0x31')]);_0x442c8a[_0x0b91('0x2f')]=qs['offset'](_0x16582e[_0x0b91('0x46')][_0x0b91('0x2f')]);}_0x442c8a[_0x0b91('0x6d')]=qs[_0x0b91('0x4f')](_0x16582e['query'][_0x0b91('0x4f')]);_0x442c8a[_0x0b91('0x50')]=qs['filters'](_['pick'](_0x16582e[_0x0b91('0x46')],_0x4a14c8[_0x0b91('0x48')]));_0x442c8a['where'][_0x0b91('0x68')]=_0x1b7815['id'];if(_0x16582e[_0x0b91('0x46')]['filter']){_0x442c8a[_0x0b91('0x50')]=_[_0x0b91('0x54')](_0x442c8a[_0x0b91('0x50')],{'$or':_[_0x0b91('0x41')](_0x442c8a[_0x0b91('0x4b')],function(_0x27391e){var _0x3407dd={};_0x3407dd[_0x27391e]={'$like':'%'+_0x16582e[_0x0b91('0x46')][_0x0b91('0x52')]+'%'};return _0x3407dd;})});}_0x442c8a=_[_0x0b91('0x54')]({},_0x442c8a,_0x16582e[_0x0b91('0x5b')]);return db[_0x0b91('0x69')][_0x0b91('0x32')]({'where':_0x442c8a[_0x0b91('0x50')]})[_0x0b91('0x23')](function(_0x3c7205){_0x4286fe[_0x0b91('0x32')]=_0x3c7205;if(_0x16582e[_0x0b91('0x46')][_0x0b91('0x55')]){_0x442c8a['include']=[{'all':!![]}];}return db[_0x0b91('0x69')][_0x0b91('0x56')](_0x442c8a);})[_0x0b91('0x23')](function(_0x225c14){_0x4286fe[_0x0b91('0x57')]=_0x225c14;return _0x4286fe;});}})[_0x0b91('0x23')](respondWithFilteredResult(_0x3fce85,_0x442c8a))[_0x0b91('0x2c')](handleError(_0x3fce85,null));};exports[_0x0b91('0x6e')]=function(_0x8a7f19,_0x423bc3,_0x48c8ad){return db[_0x0b91('0x42')]['find']({'where':{'id':_0x8a7f19[_0x0b91('0x59')]['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0x423bc3,null))[_0x0b91('0x23')](function(_0x48ccd4){if(_0x48ccd4){return _0x48ccd4[_0x0b91('0x6e')](_0x8a7f19[_0x0b91('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x423bc3,null))[_0x0b91('0x2c')](handleError(_0x423bc3,null));};exports[_0x0b91('0x6f')]=function(_0x1da0de,_0x3146fd,_0x2c4124){if(_0x1da0de[_0x0b91('0x5d')]['id']){delete _0x1da0de['body']['id'];}return db['FaxAccount'][_0x0b91('0x62')]({'where':{'id':_0x1da0de[_0x0b91('0x59')]['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0x3146fd,null))[_0x0b91('0x23')](function(_0x324c70){if(_0x324c70){_0x1da0de[_0x0b91('0x5d')][_0x0b91('0x68')]=_0x324c70['id'];return db[_0x0b91('0x70')][_0x0b91('0x5c')](_0x1da0de['body']);}})[_0x0b91('0x23')](respondWithResult(_0x3146fd,null))[_0x0b91('0x2c')](handleError(_0x3146fd,null));};exports['getAnswers']=function(_0x22579a,_0x50fbd0,_0x22af60){var _0x4cc9ac={'raw':![],'where':{}};var _0x4d0019={};var _0x352e6f={'count':0x0,'rows':[]};return db[_0x0b91('0x42')]['findOne']({'where':{'id':_0x22579a[_0x0b91('0x59')]['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0x50fbd0,null))[_0x0b91('0x23')](function(_0x2cfcf5){if(_0x2cfcf5){_0x4d0019[_0x0b91('0x4a')]=_['keys'](db['CannedAnswer'][_0x0b91('0x43')]);_0x4d0019['query']=_[_0x0b91('0x47')](_0x22579a[_0x0b91('0x46')]);_0x4d0019['filters']=_[_0x0b91('0x49')](_0x4d0019[_0x0b91('0x4a')],_0x4d0019['query']);_0x4cc9ac[_0x0b91('0x4b')]=_['intersection'](_0x4d0019[_0x0b91('0x4a')],qs[_0x0b91('0x4c')](_0x22579a['query'][_0x0b91('0x4c')]));_0x4cc9ac['attributes']=_0x4cc9ac[_0x0b91('0x4b')][_0x0b91('0x4d')]?_0x4cc9ac['attributes']:_0x4d0019[_0x0b91('0x4a')];if(!_0x22579a[_0x0b91('0x46')][_0x0b91('0x6c')](_0x0b91('0x4e'))){_0x4cc9ac['limit']=qs['limit'](_0x22579a[_0x0b91('0x46')][_0x0b91('0x31')]);_0x4cc9ac[_0x0b91('0x2f')]=qs['offset'](_0x22579a[_0x0b91('0x46')][_0x0b91('0x2f')]);}_0x4cc9ac[_0x0b91('0x6d')]=qs[_0x0b91('0x4f')](_0x22579a['query'][_0x0b91('0x4f')]);_0x4cc9ac['where']=qs[_0x0b91('0x48')](_[_0x0b91('0x51')](_0x22579a[_0x0b91('0x46')],_0x4d0019[_0x0b91('0x48')]));_0x4cc9ac[_0x0b91('0x50')][_0x0b91('0x68')]=_0x2cfcf5['id'];if(_0x22579a[_0x0b91('0x46')][_0x0b91('0x52')]){_0x4cc9ac[_0x0b91('0x50')]=_[_0x0b91('0x54')](_0x4cc9ac[_0x0b91('0x50')],{'$or':_[_0x0b91('0x41')](_0x4cc9ac[_0x0b91('0x4b')],function(_0x5c05ed){var _0x151af8={};_0x151af8[_0x5c05ed]={'$like':'%'+_0x22579a[_0x0b91('0x46')][_0x0b91('0x52')]+'%'};return _0x151af8;})});}_0x4cc9ac=_[_0x0b91('0x54')]({},_0x4cc9ac,_0x22579a[_0x0b91('0x5b')]);return db[_0x0b91('0x70')][_0x0b91('0x32')]({'where':_0x4cc9ac[_0x0b91('0x50')]})[_0x0b91('0x23')](function(_0x46e0f8){_0x352e6f['count']=_0x46e0f8;if(_0x22579a[_0x0b91('0x46')]['includeAll']){_0x4cc9ac[_0x0b91('0x5a')]=[{'all':!![]}];}return db[_0x0b91('0x70')][_0x0b91('0x56')](_0x4cc9ac);})[_0x0b91('0x23')](function(_0xd22ddd){_0x352e6f[_0x0b91('0x57')]=_0xd22ddd;return _0x352e6f;});}})[_0x0b91('0x23')](respondWithFilteredResult(_0x50fbd0,_0x4cc9ac))[_0x0b91('0x2c')](handleError(_0x50fbd0,null));};exports[_0x0b91('0x71')]=function(_0x36c892,_0x522e6f,_0xb10e51){return db[_0x0b91('0x42')][_0x0b91('0x62')]({'where':{'id':_0x36c892['params']['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0x522e6f,null))[_0x0b91('0x23')](function(_0x3c6064){if(_0x3c6064){return _0x3c6064[_0x0b91('0x71')](_0x36c892[_0x0b91('0x46')][_0x0b91('0x72')]);}})[_0x0b91('0x23')](respondWithStatusCode(_0x522e6f,null))[_0x0b91('0x2c')](handleError(_0x522e6f,null));};exports[_0x0b91('0x73')]=function(_0x53ea3d,_0x233189,_0x1b307a){return db['FaxInteraction'][_0x0b91('0x62')]({'where':{'id':_0x53ea3d[_0x0b91('0x59')]['id']}})['then'](handleEntityNotFound(_0x233189,null))[_0x0b91('0x23')](function(_0x4f4774){if(_0x4f4774){return _0x4f4774[_0x0b91('0x73')](_0x53ea3d[_0x0b91('0x5d')][_0x0b91('0x72')],_[_0x0b91('0x74')](_0x53ea3d[_0x0b91('0x5d')],['ids','id'])||{});}})['then'](respondWithResult(_0x233189,null))[_0x0b91('0x2c')](handleError(_0x233189,null));};exports[_0x0b91('0x75')]=function(_0x21403e,_0xb57ef9,_0x4d5be3){var _0x5d2a5e={'raw':![],'where':{}};var _0x3f9d14={};var _0x34224c={'count':0x0,'rows':[]};return db[_0x0b91('0x42')][_0x0b91('0x6b')]({'where':{'id':_0x21403e['params']['id']}})['then'](handleEntityNotFound(_0xb57ef9,null))['then'](function(_0x60ce23){if(_0x60ce23){_0x3f9d14[_0x0b91('0x4a')]=_[_0x0b91('0x47')](db['FaxInteraction'][_0x0b91('0x43')]);_0x3f9d14[_0x0b91('0x46')]=_['keys'](_0x21403e['query']);_0x3f9d14['filters']=_[_0x0b91('0x49')](_0x3f9d14[_0x0b91('0x4a')],_0x3f9d14[_0x0b91('0x46')]);_0x5d2a5e[_0x0b91('0x4b')]=_[_0x0b91('0x49')](_0x3f9d14[_0x0b91('0x4a')],qs[_0x0b91('0x4c')](_0x21403e[_0x0b91('0x46')]['fields']));_0x5d2a5e[_0x0b91('0x4b')]=_0x5d2a5e[_0x0b91('0x4b')]['length']?_0x5d2a5e[_0x0b91('0x4b')]:_0x3f9d14[_0x0b91('0x4a')];if(!_0x21403e['query'][_0x0b91('0x6c')](_0x0b91('0x4e'))){_0x5d2a5e[_0x0b91('0x31')]=qs[_0x0b91('0x31')](_0x21403e[_0x0b91('0x46')][_0x0b91('0x31')]);_0x5d2a5e[_0x0b91('0x2f')]=qs['offset'](_0x21403e[_0x0b91('0x46')][_0x0b91('0x2f')]);}_0x5d2a5e[_0x0b91('0x6d')]=qs['sort'](_0x21403e[_0x0b91('0x46')]['sort']);_0x5d2a5e[_0x0b91('0x50')]=qs[_0x0b91('0x48')](_['pick'](_0x21403e[_0x0b91('0x46')],_0x3f9d14[_0x0b91('0x48')]));_0x5d2a5e[_0x0b91('0x50')][_0x0b91('0x68')]=_0x60ce23['id'];if(_0x21403e[_0x0b91('0x46')][_0x0b91('0x52')]){_0x5d2a5e[_0x0b91('0x50')]=_[_0x0b91('0x54')](_0x5d2a5e[_0x0b91('0x50')],{'$or':_[_0x0b91('0x41')](_0x5d2a5e[_0x0b91('0x4b')],function(_0x3c41a1){var _0x1ab4f1={};_0x1ab4f1[_0x3c41a1]={'$like':'%'+_0x21403e['query'][_0x0b91('0x52')]+'%'};return _0x1ab4f1;})});}_0x5d2a5e=_['merge']({},_0x5d2a5e,_0x21403e[_0x0b91('0x5b')]);return db[_0x0b91('0x76')][_0x0b91('0x32')]({'where':_0x5d2a5e[_0x0b91('0x50')]})['then'](function(_0x1f1876){_0x34224c['count']=_0x1f1876;if(_0x21403e['query'][_0x0b91('0x55')]){_0x5d2a5e[_0x0b91('0x5a')]=[{'model':db['CmContact'],'as':_0x0b91('0x77'),'required':![]},{'model':db[_0x0b91('0x78')],'as':_0x0b91('0x79'),'attributes':[_0x0b91('0x3c'),_0x0b91('0x7a'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x0b91('0x7b'),'attributes':['id','name','color'],'where':_0x21403e['query'][_0x0b91('0x7c')]?{'id':_0x21403e[_0x0b91('0x46')][_0x0b91('0x7c')]}:undefined,'required':_0x21403e[_0x0b91('0x46')]['tag']?!![]:![]}];}return db[_0x0b91('0x76')]['findAll'](_0x5d2a5e);})['then'](function(_0xb0f64f){_0x34224c[_0x0b91('0x57')]=_0xb0f64f;return _0x34224c;});}})[_0x0b91('0x23')](respondWithFilteredResult(_0xb57ef9,_0x5d2a5e))[_0x0b91('0x2c')](handleError(_0xb57ef9,null));};exports['addApplications']=function(_0x3e3dca,_0x2fc0d9){var _0x575fc3=_0x3e3dca[_0x0b91('0x59')]['id'];var _0x1f4161=_0x3e3dca[_0x0b91('0x5d')];var _0x4dcb65=0xc8;var _0x3a0c25=null;return db['sequelize'][_0x0b91('0x7d')]({'isolationLevel':db[_0x0b91('0x7e')]['Transaction'][_0x0b91('0x7f')][_0x0b91('0x80')]},function(_0x590df1){return db[_0x0b91('0x42')][_0x0b91('0x6b')]({'where':{'id':_0x575fc3},'transaction':_0x590df1})[_0x0b91('0x23')](function(_0x33c3cb){if(_0x33c3cb){return db[_0x0b91('0x81')][_0x0b91('0x3a')]({'where':{'FaxAccountId':_0x575fc3},'transaction':_0x590df1})[_0x0b91('0x23')](function(){var _0x1f359f=_['map'](_0x1f4161,function(_0x6e4ed2){_0x6e4ed2[_0x0b91('0x68')]=_0x575fc3;return _0x6e4ed2;});return db['FaxApplication'][_0x0b91('0x82')](_0x1f359f,{'transaction':_0x590df1});});}else{_0x4dcb65=0x194;_0x3a0c25=[];}});})[_0x0b91('0x23')](function(){if(_0x4dcb65!==0x194){return db['FaxApplication'][_0x0b91('0x83')]({'where':{'FaxAccountId':_0x575fc3},'order':_0x0b91('0x84')})[_0x0b91('0x23')](function(_0xc132d3){_0x3a0c25=_0xc132d3;});}})[_0x0b91('0x2c')](function(_0x5d59a6){_0x4dcb65=0x1f4;logger['error'](_0x5d59a6[_0x0b91('0x85')]);if(_0x5d59a6[_0x0b91('0x3c')]){delete _0x5d59a6['name'];}_0x3a0c25=_0x5d59a6;})['finally'](function(){if(_0x3a0c25===null){_0x2fc0d9[_0x0b91('0x2d')](_0x4dcb65);}else{if(_0x4dcb65===0x1f4){_0x2fc0d9['status'](_0x4dcb65)[_0x0b91('0x3d')](_0x3a0c25);}else{_0x2fc0d9[_0x0b91('0x2e')](_0x4dcb65)[_0x0b91('0x34')](_0x3a0c25);}}});};exports[_0x0b91('0x86')]=function(_0xfc89b,_0x47f67a,_0x571833){var _0x116ee2={};var _0x195262={};var _0x3f7f19;var _0x19b358;return db['FaxAccount']['findOne']({'where':{'id':_0xfc89b[_0x0b91('0x59')]['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0x47f67a,null))[_0x0b91('0x23')](function(_0x16ffde){if(_0x16ffde){_0x3f7f19=_0x16ffde;_0x195262[_0x0b91('0x4a')]=_[_0x0b91('0x47')](db[_0x0b91('0x81')][_0x0b91('0x43')]);_0x195262['query']=_[_0x0b91('0x47')](_0xfc89b[_0x0b91('0x46')]);_0x195262[_0x0b91('0x48')]=_[_0x0b91('0x49')](_0x195262[_0x0b91('0x4a')],_0x195262[_0x0b91('0x46')]);_0x116ee2[_0x0b91('0x4b')]=_[_0x0b91('0x49')](_0x195262[_0x0b91('0x4a')],qs[_0x0b91('0x4c')](_0xfc89b[_0x0b91('0x46')][_0x0b91('0x4c')]));_0x116ee2['attributes']=_0x116ee2['attributes']['length']?_0x116ee2['attributes']:_0x195262[_0x0b91('0x4a')];_0x116ee2[_0x0b91('0x6d')]=qs['sort'](_0xfc89b[_0x0b91('0x46')]['sort']);_0x116ee2[_0x0b91('0x50')]=qs['filters'](_[_0x0b91('0x51')](_0xfc89b[_0x0b91('0x46')],_0x195262['filters']));if(_0xfc89b['query'][_0x0b91('0x52')]){_0x116ee2[_0x0b91('0x50')]=_['merge'](_0x116ee2[_0x0b91('0x50')],{'$or':_[_0x0b91('0x41')](_0x116ee2[_0x0b91('0x4b')],function(_0x4334f0){var _0x11322b={};_0x11322b[_0x4334f0]={'$like':'%'+_0xfc89b[_0x0b91('0x46')][_0x0b91('0x52')]+'%'};return _0x11322b;})});}_0x116ee2=_[_0x0b91('0x54')]({},_0x116ee2,_0xfc89b[_0x0b91('0x5b')]);return _0x3f7f19[_0x0b91('0x86')](_0x116ee2);}})[_0x0b91('0x23')](function(_0x52ccc7){if(_0x52ccc7){_0x19b358=_0x52ccc7[_0x0b91('0x4d')];if(!_0xfc89b['query'][_0x0b91('0x6c')](_0x0b91('0x4e'))){_0x116ee2['limit']=qs['limit'](_0xfc89b['query'][_0x0b91('0x31')]);_0x116ee2[_0x0b91('0x2f')]=qs[_0x0b91('0x2f')](_0xfc89b[_0x0b91('0x46')][_0x0b91('0x2f')]);}return _0x3f7f19['getApplications'](_0x116ee2);}})[_0x0b91('0x23')](function(_0x2aa8ea){if(_0x2aa8ea){return _0x2aa8ea?{'count':_0x19b358,'rows':_0x2aa8ea}:null;}})[_0x0b91('0x23')](respondWithResult(_0x47f67a,null))[_0x0b91('0x2c')](handleError(_0x47f67a,null));};function Extension(_0x246a4d,_0x4e237d,_0x3da58f,_0x5475cd){this[_0x0b91('0x87')]=_0x0b91('0x88');this[_0x0b91('0x89')]=_0x246a4d[_0x0b91('0x8a')];this[_0x0b91('0x8b')]=_0x5475cd;this[_0x0b91('0x44')]=_0x0b91('0x8c');this[_0x0b91('0x8d')]='Fax\x20Extension';this[_0x0b91('0x68')]=_0x246a4d['id'];this['priority']=_0x4e237d;this[_0x0b91('0x8e')]=_0x3da58f;}function createExtensionsReciveFax(_0x1eb8d7){var _0x58ddce=0x1;var _0x4001b0=[];_0x4001b0['push'](new Extension(_0x1eb8d7,_0x58ddce,'',_0x0b91('0x8f')));_0x58ddce+=0x1;_0x4001b0[_0x0b91('0x90')](new Extension(_0x1eb8d7,_0x58ddce,'CDR(type)=inbound-fax','Set'));_0x58ddce+=0x1;for(var _0x58939c in _0x1eb8d7){if(_0x1eb8d7['hasOwnProperty'](_0x58939c)&&(_0x58939c===_0x0b91('0x91')||_0x58939c==='localstationid'||_0x58939c===_0x0b91('0x92')||_0x58939c===_0x0b91('0x93')||_0x58939c===_0x0b91('0x94')||_0x58939c===_0x0b91('0x95')||_0x58939c==='minrate'||_0x58939c===_0x0b91('0x96')||_0x58939c===_0x0b91('0x97'))){_0x4001b0[_0x0b91('0x90')](new Extension(_0x1eb8d7,_0x58ddce,_0x0b91('0x98')+_0x58939c+')='+_0x1eb8d7[_0x58939c],'Set'));_0x58ddce+=0x1;}}_0x4001b0[_0x0b91('0x90')](new Extension(_0x1eb8d7,_0x58ddce,'6','Wait'));_0x58ddce+=0x1;_0x4001b0[_0x0b91('0x90')](new Extension(_0x1eb8d7,_0x58ddce,'/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',_0x0b91('0x99')));_0x58ddce=0x0;return _0x4001b0;}exports[_0x0b91('0x9a')]=function(_0x30d3c9,_0x26dc3d,_0x5edaf0){var _0x5605ef;return db[_0x0b91('0x7e')][_0x0b91('0x7d')](function(_0x560138){return db['FaxAccount'][_0x0b91('0x5c')](_0x30d3c9[_0x0b91('0x5d')],{'transaction':_0x560138})[_0x0b91('0x23')](function(_0x1de869){_0x5605ef=_0x1de869[_0x0b91('0x38')]({'plain':!![]});return db[_0x0b91('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x5605ef),{'transaction':_0x560138});});})['then'](function(){return _0x5605ef;})[_0x0b91('0x23')](respondWithResult(_0x26dc3d,null))[_0x0b91('0x2c')](handleError(_0x26dc3d,null));};exports[_0x0b91('0x9c')]=function(_0x5bd524,_0x2ec7b6,_0x509ca4){var _0x1b9286;return db['sequelize'][_0x0b91('0x7d')](function(_0x4f468e){return db[_0x0b91('0x42')]['update'](_0x5bd524[_0x0b91('0x5d')],{'where':{'id':_0x5bd524[_0x0b91('0x5d')]['id']},'transaction':_0x4f468e})[_0x0b91('0x23')](function(_0x14cfc5){return db[_0x0b91('0x9b')]['destroy']({'where':{'FaxAccountId':_0x5bd524['body']['id']},'transaction':_0x4f468e})['then'](function(_0x14f5a2){return db[_0x0b91('0x9b')][_0x0b91('0x82')](createExtensionsReciveFax(_[_0x0b91('0x74')](_0x5bd524[_0x0b91('0x5d')],[_0x0b91('0x9d'),'key',_0x0b91('0x9e'),'updatedAt','TrunkId',_0x0b91('0x9f')])),{'transaction':_0x4f468e});});});})[_0x0b91('0x23')](function(){return db['FaxAccount'][_0x0b91('0xa0')](_0x5bd524['body']['id']);})[_0x0b91('0x23')](respondWithResult(_0x2ec7b6,null))[_0x0b91('0x2c')](handleError(_0x2ec7b6,null));};exports[_0x0b91('0xa1')]=function(_0x1a14d3,_0x371e79,_0x47c0fa){var _0x36c724={'raw':!![],'where':{}};var _0x49e51c={};var _0xd6e1a2={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x1a14d3['params']['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0x371e79,null))['then'](function(_0x1cca0f){if(_0x1cca0f){_0x49e51c[_0x0b91('0x4a')]=_[_0x0b91('0x47')](db['FaxMessage']['rawAttributes']);_0x49e51c[_0x0b91('0x46')]=_[_0x0b91('0x47')](_0x1a14d3[_0x0b91('0x46')]);_0x49e51c[_0x0b91('0x48')]=_[_0x0b91('0x49')](_0x49e51c['model'],_0x49e51c[_0x0b91('0x46')]);_0x36c724['attributes']=_['intersection'](_0x49e51c[_0x0b91('0x4a')],qs[_0x0b91('0x4c')](_0x1a14d3[_0x0b91('0x46')][_0x0b91('0x4c')]));_0x36c724[_0x0b91('0x4b')]=_0x36c724[_0x0b91('0x4b')][_0x0b91('0x4d')]?_0x36c724[_0x0b91('0x4b')]:_0x49e51c[_0x0b91('0x4a')];if(!_0x1a14d3[_0x0b91('0x46')]['hasOwnProperty'](_0x0b91('0x4e'))){_0x36c724[_0x0b91('0x31')]=qs[_0x0b91('0x31')](_0x1a14d3[_0x0b91('0x46')][_0x0b91('0x31')]);_0x36c724['offset']=qs['offset'](_0x1a14d3[_0x0b91('0x46')][_0x0b91('0x2f')]);}_0x36c724[_0x0b91('0x6d')]=qs[_0x0b91('0x4f')](_0x1a14d3['query']['sort']);_0x36c724[_0x0b91('0x50')]=qs[_0x0b91('0x48')](_[_0x0b91('0x51')](_0x1a14d3[_0x0b91('0x46')],_0x49e51c['filters']));_0x36c724['where'][_0x0b91('0x68')]=_0x1cca0f['id'];if(_0x1a14d3[_0x0b91('0x46')][_0x0b91('0x52')]){_0x36c724[_0x0b91('0x50')]=_[_0x0b91('0x54')](_0x36c724[_0x0b91('0x50')],{'$or':_[_0x0b91('0x41')](_0x36c724[_0x0b91('0x4b')],function(_0x5e6d30){var _0x2eecb5={};_0x2eecb5[_0x5e6d30]={'$like':'%'+_0x1a14d3[_0x0b91('0x46')][_0x0b91('0x52')]+'%'};return _0x2eecb5;})});}if(_0x1a14d3[_0x0b91('0x46')][_0x0b91('0xa2')]){var _0x2a893f=_0x1a14d3[_0x0b91('0x46')][_0x0b91('0xa2')][_0x0b91('0xa3')](',');var _0x4a4134={};_0x4a4134[_0x2a893f[0x0]]={'$gte':moment(_0x2a893f[0x1])[_0x0b91('0xa4')](_0x0b91('0xa5'))};_0x36c724[_0x0b91('0x50')]=_[_0x0b91('0x54')](_0x36c724[_0x0b91('0x50')],_0x4a4134);}_0x36c724=_['merge']({},_0x36c724,_0x1a14d3[_0x0b91('0x5b')]);return db[_0x0b91('0xa6')][_0x0b91('0x32')]({'where':_0x36c724[_0x0b91('0x50')]})[_0x0b91('0x23')](function(_0x4ac153){_0xd6e1a2[_0x0b91('0x32')]=_0x4ac153;if(_0x1a14d3[_0x0b91('0x46')][_0x0b91('0x55')]){_0x36c724['include']=[{'all':!![]}];}return db[_0x0b91('0xa6')]['findAll'](_0x36c724);})['then'](function(_0x3cb323){_0xd6e1a2[_0x0b91('0x57')]=_0x3cb323;return _0xd6e1a2;});}})[_0x0b91('0x23')](respondWithFilteredResult(_0x371e79,_0x36c724))[_0x0b91('0x2c')](handleError(_0x371e79,null));};exports['send']=function(_0x2a63ad,_0x4ad245,_0x292f01){var _0x497f72,_0x5c94f3={},_0x3156df;if(_0x2a63ad[_0x0b91('0x5d')]['to']){_0x3156df=_0x2a63ad[_0x0b91('0x5d')]['to'][0x0];}return db[_0x0b91('0x42')][_0x0b91('0x62')]({'where':{'id':_0x2a63ad['params']['id']},'include':[{'model':db[_0x0b91('0xa7')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0b91('0xa8'),'where':{'fax':_0x3156df},'limit':0x1,'order':[[_0x0b91('0xa9'),_0x0b91('0xaa')]]}]}]})[_0x0b91('0x23')](handleEntityNotFound(_0x4ad245,null))[_0x0b91('0x23')](function(_0x1349c5){_0x497f72=_0x1349c5;if(_0x2a63ad['body']['attachments']&&_0x2a63ad[_0x0b91('0x5d')][_0x0b91('0xab')][_0x0b91('0x4d')]){for(var _0x48c7e9=0x0;_0x48c7e9<_0x2a63ad[_0x0b91('0x5d')][_0x0b91('0xab')][_0x0b91('0x4d')];_0x48c7e9+=0x1){_0x2a63ad['body'][_0x0b91('0xab')][_0x48c7e9]={'filename':_0x2a63ad[_0x0b91('0x5d')]['attachments'][_0x48c7e9][_0x0b91('0x3c')],'id':_0x2a63ad[_0x0b91('0x5d')][_0x0b91('0xab')][_0x48c7e9]['id'],'path':path[_0x0b91('0xac')](config[_0x0b91('0xad')],'server/files/attachments',_0x2a63ad[_0x0b91('0x5d')][_0x0b91('0xab')][_0x48c7e9][_0x0b91('0xae')])};}}return respondWithRpcPromise(_0x0b91('0xaf'),_0x0b91('0xaf'),{'FaxAccountId':_['isNil'](_0x2a63ad[_0x0b91('0x59')]['id'])?undefined:_0x2a63ad[_0x0b91('0x59')]['id'],'path':_[_0x0b91('0xb0')](_0x2a63ad[_0x0b91('0x5d')][_0x0b91('0xab')][0x0][_0x0b91('0xb1')])?undefined:_0x2a63ad[_0x0b91('0x5d')][_0x0b91('0xab')][0x0][_0x0b91('0xb1')],'fax':_[_0x0b91('0xb0')](_0x2a63ad[_0x0b91('0x5d')]['to'][0x0])?undefined:_0x2a63ad[_0x0b91('0x5d')]['to'][0x0]},client9002);})[_0x0b91('0x23')](function(){if(_0x497f72){if(_['isNil'](_0x2a63ad['body'][_0x0b91('0xb2')])){_0x2a63ad[_0x0b91('0x5d')]['from']=util[_0x0b91('0xa4')](_0x0b91('0xb3'),_0x497f72[_0x0b91('0x3c')],_0x497f72['fax']);}if(_0x497f72[_0x0b91('0xb4')]){if(_0x497f72['List'][_0x0b91('0xa8')][_0x0b91('0x4d')]){return _0x497f72['List']['Contacts'][0x0];}else{return db[_0x0b91('0xb5')][_0x0b91('0x5c')](_[_0x0b91('0x1b')](_0x2a63ad[_0x0b91('0x5d')],{'firstName':_0x2a63ad[_0x0b91('0x5d')]['to'][0x0],'phone':_0x2a63ad[_0x0b91('0x5d')]['to'][0x0],'fax':_0x2a63ad[_0x0b91('0x5d')]['to'][0x0],'ListId':_0x497f72[_0x0b91('0x9f')]}));}}else{throw new Error(_0x0b91('0xb6'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x0b91('0x23')](function(_0x480365){if(_0x480365){return db['FaxInteraction'][_0x0b91('0x62')]({'where':{'ContactId':_0x480365['id'],'closed':![],'FaxAccountId':_0x497f72['id']}})['then'](function(_0x3d4567){if(_0x3d4567){return[_0x3d4567,![]];}return db[_0x0b91('0x76')][_0x0b91('0x5c')]({'UserId':_0x2a63ad[_0x0b91('0x5e')]['id'],'ContactId':_0x480365['id'],'FaxAccountId':_0x497f72['id'],'fax':_0x2a63ad['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x0b91('0x54')](_0x2a63ad[_0x0b91('0x5d')],{'read':![],'body':_0x2a63ad['body'][_0x0b91('0xab')][0x0][_0x0b91('0xb7')],'FaxAccountId':_0x497f72['id'],'UserId':_0x2a63ad[_0x0b91('0x5e')]['id'],'ContactId':_0x480365['id'],'AttachmentId':_0x2a63ad['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x0b91('0xa6')],'as':_0x0b91('0xb8')}]})[_0x0b91('0x23')](function(_0x2983e2){return[_0x2983e2,!![]];});});}else{throw new Error(_0x0b91('0xb9'));}})[_0x0b91('0xba')](function(_0x379794,_0x4d332e){if(_0x4d332e){return _0x379794;}return db[_0x0b91('0xa6')][_0x0b91('0x5c')]({'direction':'out','read':![],'body':_0x2a63ad['body'][_0x0b91('0xab')][0x0]['filename'],'FaxAccountId':_0x497f72['id'],'FaxInteractionId':_0x379794['id'],'UserId':_0x2a63ad['user']['id'],'ContactId':_0x379794['ContactId'],'AttachmentId':_0x2a63ad[_0x0b91('0x5d')][_0x0b91('0xab')][0x0]['id']})[_0x0b91('0x23')](function(_0x32ac99){_0x379794[_0x0b91('0xbb')][_0x0b91('0xb8')]=[];_0x379794[_0x0b91('0xbb')]['Messages'][_0x0b91('0x90')](_0x32ac99['dataValues']);return _0x379794;});})[_0x0b91('0x23')](function(_0x28c6fa){respondWithRpcPromise('SendFax',_0x0b91('0xbc'),{'FaxAccountId':_['isNil'](_0x2a63ad[_0x0b91('0x59')]['id'])?undefined:_0x2a63ad[_0x0b91('0x59')]['id'],'path':_[_0x0b91('0xb0')](_0x2a63ad[_0x0b91('0x5d')][_0x0b91('0xab')][0x0][_0x0b91('0xb1')])?undefined:_0x2a63ad[_0x0b91('0x5d')]['attachments'][0x0][_0x0b91('0xb1')],'fax':_[_0x0b91('0xb0')](_0x2a63ad[_0x0b91('0x5d')]['to'][0x0])?undefined:_0x2a63ad['body']['to'][0x0],'AttachmentId':_0x2a63ad['body'][_0x0b91('0xab')][0x0]['id']},client9002)[_0x0b91('0x23')](function(_0x28bab2){logger[_0x0b91('0x24')](_0x0b91('0xbd'),_0x28bab2);})[_0x0b91('0x2c')](function(_0x2fe127){logger[_0x0b91('0x24')](_0x0b91('0xbd'),_0x2fe127);});return _0x28c6fa;})['then'](respondWithResult(_0x4ad245,null))[_0x0b91('0x2c')](handleError(_0x4ad245,null));};exports[_0x0b91('0xbe')]=function(_0x30d605,_0xc22c2e,_0x23c44b){return db[_0x0b91('0x42')][_0x0b91('0x62')]({'where':{'id':_0x30d605[_0x0b91('0x59')]['id']}})['then'](handleEntityNotFound(_0xc22c2e,null))['then'](function(_0x1f8065){if(_0x1f8065){return _0x1f8065[_0x0b91('0xbe')](_0x30d605[_0x0b91('0x5d')][_0x0b91('0x72')],_[_0x0b91('0x74')](_0x30d605[_0x0b91('0x5d')],[_0x0b91('0x72'),'id'])||{})[_0x0b91('0xba')](function(_0x119b45){for(var _0x500dce=0x0;_0x500dce<_0x30d605[_0x0b91('0x5d')][_0x0b91('0x72')]['length'];_0x500dce+=0x1){socket[_0x0b91('0xbf')](_0x0b91('0xc0'),{'UserId':Number(_0x30d605['body'][_0x0b91('0x72')][_0x500dce]),'FaxAccountId':Number(_0x30d605['params']['id'])});}return _0x119b45;});}})[_0x0b91('0x23')](respondWithResult(_0xc22c2e,null))[_0x0b91('0x2c')](handleError(_0xc22c2e,null));};exports['removeAgents']=function(_0x24155c,_0x34ca09,_0x1e7f73){return db[_0x0b91('0x42')][_0x0b91('0x62')]({'where':{'id':_0x24155c[_0x0b91('0x59')]['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0x34ca09,null))[_0x0b91('0x23')](function(_0x1e1330){if(_0x1e1330){return _0x1e1330[_0x0b91('0xc1')](_0x24155c[_0x0b91('0x46')]['ids'])[_0x0b91('0x23')](function(){if(_[_0x0b91('0xc2')](_0x24155c[_0x0b91('0x46')][_0x0b91('0x72')])){for(var _0x5c4cd7=0x0;_0x5c4cd7<_0x24155c[_0x0b91('0x46')]['ids'][_0x0b91('0x4d')];_0x5c4cd7+=0x1){socket[_0x0b91('0xbf')](_0x0b91('0xc3'),{'UserId':Number(_0x24155c[_0x0b91('0x46')][_0x0b91('0x72')][_0x5c4cd7]),'FaxAccountId':Number(_0x24155c['params']['id'])});}}else{socket[_0x0b91('0xbf')](_0x0b91('0xc3'),{'UserId':Number(_0x24155c[_0x0b91('0x46')][_0x0b91('0x72')]),'FaxAccountId':Number(_0x24155c[_0x0b91('0x59')]['id'])});}});}})[_0x0b91('0x23')](respondWithStatusCode(_0x34ca09,null))['catch'](handleError(_0x34ca09,null));};exports[_0x0b91('0xc4')]=function(_0x54abed,_0xac7b81,_0x3eb0bd){var _0x5cbcdf={};var _0x18d4a1={};var _0x1cc588;var _0x3910a0;return db[_0x0b91('0x42')]['findOne']({'where':{'id':_0x54abed[_0x0b91('0x59')]['id']}})[_0x0b91('0x23')](handleEntityNotFound(_0xac7b81,null))[_0x0b91('0x23')](function(_0x4a4bd4){if(_0x4a4bd4){_0x1cc588=_0x4a4bd4;_0x18d4a1[_0x0b91('0x4a')]=_['keys'](db[_0x0b91('0x78')][_0x0b91('0x43')]);_0x18d4a1[_0x0b91('0x46')]=_[_0x0b91('0x47')](_0x54abed[_0x0b91('0x46')]);_0x18d4a1[_0x0b91('0x48')]=_[_0x0b91('0x49')](_0x18d4a1[_0x0b91('0x4a')],_0x18d4a1['query']);_0x5cbcdf[_0x0b91('0x4b')]=_[_0x0b91('0x49')](_0x18d4a1[_0x0b91('0x4a')],qs[_0x0b91('0x4c')](_0x54abed[_0x0b91('0x46')][_0x0b91('0x4c')]));_0x5cbcdf[_0x0b91('0x4b')]=_0x5cbcdf[_0x0b91('0x4b')]['length']?_0x5cbcdf[_0x0b91('0x4b')]:_0x18d4a1[_0x0b91('0x4a')];_0x5cbcdf[_0x0b91('0x6d')]=qs[_0x0b91('0x4f')](_0x54abed[_0x0b91('0x46')][_0x0b91('0x4f')]);_0x5cbcdf[_0x0b91('0x50')]=qs[_0x0b91('0x48')](_[_0x0b91('0x51')](_0x54abed[_0x0b91('0x46')],_0x18d4a1[_0x0b91('0x48')]));if(_0x54abed[_0x0b91('0x46')]['filter']){_0x5cbcdf[_0x0b91('0x50')]=_[_0x0b91('0x54')](_0x5cbcdf[_0x0b91('0x50')],{'$or':_[_0x0b91('0x41')](_0x5cbcdf[_0x0b91('0x4b')],function(_0x1f2b60){var _0x1eeaa4={};_0x1eeaa4[_0x1f2b60]={'$like':'%'+_0x54abed[_0x0b91('0x46')]['filter']+'%'};return _0x1eeaa4;})});}_0x5cbcdf=_[_0x0b91('0x54')]({},_0x5cbcdf,_0x54abed[_0x0b91('0x5b')]);return _0x1cc588['getAgents'](_0x5cbcdf);}})[_0x0b91('0x23')](function(_0x2df195){if(_0x2df195){_0x3910a0=_0x2df195[_0x0b91('0x4d')];if(!_0x54abed[_0x0b91('0x46')][_0x0b91('0x6c')](_0x0b91('0x4e'))){_0x5cbcdf['limit']=qs[_0x0b91('0x31')](_0x54abed[_0x0b91('0x46')][_0x0b91('0x31')]);_0x5cbcdf[_0x0b91('0x2f')]=qs[_0x0b91('0x2f')](_0x54abed['query'][_0x0b91('0x2f')]);}return _0x1cc588[_0x0b91('0xc4')](_0x5cbcdf);}})[_0x0b91('0x23')](function(_0x134129){if(_0x134129){return _0x134129?{'count':_0x3910a0,'rows':_0x134129}:null;}})[_0x0b91('0x23')](respondWithResult(_0xac7b81,null))['catch'](handleError(_0xac7b81,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 95c535a..3404cf5 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 _0x0360=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount'];(function(_0x17251d,_0xff5024){var _0x5d4948=function(_0x1648e1){while(--_0x1648e1){_0x17251d['push'](_0x17251d['shift']());}};_0x5d4948(++_0xff5024);}(_0x0360,0x11e));var _0x0036=function(_0x154cbb,_0x43c57f){_0x154cbb=_0x154cbb-0x0;var _0x494584=_0x0360[_0x154cbb];return _0x494584;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x0036('0x0'))['db'][_0x0036('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0036('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0036('0x3')};function emitEvent(_0x4b569f){return function(_0x469d9a,_0xcd0f22,_0x549338){FaxAccountEvents['emit'](_0x4b569f+':'+_0x469d9a['id'],_0x469d9a);FaxAccountEvents[_0x0036('0x4')](_0x4b569f,_0x469d9a);_0x549338(null);};}for(var e in events){if(events[_0x0036('0x5')](e)){var event=events[e];FaxAccount[_0x0036('0x6')](e,emitEvent(event));}}module[_0x0036('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x50d1=['../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x9b4c47,_0x3f17a5){var _0x2d964f=function(_0x386829){while(--_0x386829){_0x9b4c47['push'](_0x9b4c47['shift']());}};_0x2d964f(++_0x3f17a5);}(_0x50d1,0xf3));var _0x150d=function(_0x3b637e,_0x33ef3d){_0x3b637e=_0x3b637e-0x0;var _0x2b3068=_0x50d1[_0x3b637e];return _0x2b3068;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x150d('0x0'))['db'][_0x150d('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x150d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x150d('0x3'),'afterDestroy':_0x150d('0x4')};function emitEvent(_0x2ee397){return function(_0x46f6ce,_0x192f54,_0x52b46c){FaxAccountEvents['emit'](_0x2ee397+':'+_0x46f6ce['id'],_0x46f6ce);FaxAccountEvents[_0x150d('0x5')](_0x2ee397,_0x46f6ce);_0x52b46c(null);};}for(var e in events){if(events[_0x150d('0x6')](e)){var event=events[e];FaxAccount[_0x150d('0x7')](e,emitEvent(event));}}module[_0x150d('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index fe770d6..020e073 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 _0xaebe=['path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc2d34a,_0x4110a2){var _0x54d8a3=function(_0x2184da){while(--_0x2184da){_0xc2d34a['push'](_0xc2d34a['shift']());}};_0x54d8a3(++_0x4110a2);}(_0xaebe,0x1e3));var _0xeaeb=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xaebe[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xeaeb('0x0'));var util=require(_0xeaeb('0x1'));var logger=require(_0xeaeb('0x2'))(_0xeaeb('0x3'));var moment=require(_0xeaeb('0x4'));var BPromise=require(_0xeaeb('0x5'));var rp=require(_0xeaeb('0x6'));var fs=require('fs');var path=require(_0xeaeb('0x7'));var rimraf=require(_0xeaeb('0x8'));var config=require(_0xeaeb('0x9'));var attributes=require(_0xeaeb('0xa'));module[_0xeaeb('0xb')]=function(_0x4bfbe8,_0x64ba7d){return _0x4bfbe8[_0xeaeb('0xc')]('FaxAccount',attributes,{'tableName':_0xeaeb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd180=['util','../../config/logger','api','request-promise','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x512d4b,_0x3b1f72){var _0x2c913f=function(_0x140c77){while(--_0x140c77){_0x512d4b['push'](_0x512d4b['shift']());}};_0x2c913f(++_0x3b1f72);}(_0xd180,0xc5));var _0x0d18=function(_0x2d489a,_0x25ce3c){_0x2d489a=_0x2d489a-0x0;var _0x11b301=_0xd180[_0x2d489a];return _0x11b301;};'use strict';var _=require(_0x0d18('0x0'));var util=require(_0x0d18('0x1'));var logger=require(_0x0d18('0x2'))(_0x0d18('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0d18('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0d18('0x5'));var attributes=require(_0x0d18('0x6'));module[_0x0d18('0x7')]=function(_0x54f9c3,_0x5323da){return _0x54f9c3[_0x0d18('0x8')](_0x0d18('0x9'),attributes,{'tableName':_0x0d18('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 3e2b46d..efe8f45 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 _0x9dfb=['redis','socket.io-emitter','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','include','map','model','catch','body','fax','CmContact','Sequelize','ValidationError','keys','createdAt','updatedAt','difference','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','Contacts','DESC','FaxApplication','Applications','account','applications','List','priority','asc','length','create','contact','FaxInteraction','get','autoclose','push','close','*,*,*,*','created','interaction','AttachmentId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','queueId','FaxQueue','queue','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','defaults'];(function(_0xae9c8d,_0x3dfa6f){var _0x290688=function(_0x15513b){while(--_0x15513b){_0xae9c8d['push'](_0xae9c8d['shift']());}};_0x290688(++_0x3dfa6f);}(_0x9dfb,0x13e));var _0xb9df=function(_0x16dc91,_0x221cae){_0x16dc91=_0x16dc91-0x0;var _0x522ee8=_0x9dfb[_0x16dc91];return _0x522ee8;};'use strict';var _=require(_0xb9df('0x0'));var util=require(_0xb9df('0x1'));var moment=require(_0xb9df('0x2'));var BPromise=require(_0xb9df('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9df('0x4'));var db=require(_0xb9df('0x5'))['db'];var utils=require(_0xb9df('0x6'));var logger=require(_0xb9df('0x7'))('rpc');var config=require(_0xb9df('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});config['redis']=_[_0xb9df('0x9')](config[_0xb9df('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9df('0xb'))(new Redis(config[_0xb9df('0xa')]));require('./faxAccount.socket')[_0xb9df('0xc')](socket);function respondWithRpcPromise(_0x265689,_0x2ad195,_0x57a8ed){return new BPromise(function(_0x40625a,_0x320611){return client['request'](_0x265689,_0x57a8ed)[_0xb9df('0xd')](function(_0x22ceef){logger[_0xb9df('0xe')](_0xb9df('0xf'),_0x2ad195,_0xb9df('0x10'));logger[_0xb9df('0x11')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2ad195,_0xb9df('0x10'),JSON[_0xb9df('0x12')](_0x22ceef));if(_0x22ceef[_0xb9df('0x13')]){if(_0x22ceef['error'][_0xb9df('0x14')]===0x1f4){logger[_0xb9df('0x13')](_0xb9df('0xf'),_0x2ad195,_0x22ceef[_0xb9df('0x13')][_0xb9df('0x15')]);return _0x320611(_0x22ceef[_0xb9df('0x13')][_0xb9df('0x15')]);}logger[_0xb9df('0x13')](_0xb9df('0xf'),_0x2ad195,_0x22ceef[_0xb9df('0x13')][_0xb9df('0x15')]);return _0x40625a(_0x22ceef[_0xb9df('0x13')][_0xb9df('0x15')]);}else{logger[_0xb9df('0xe')](_0xb9df('0xf'),_0x2ad195,_0xb9df('0x10'));_0x40625a(_0x22ceef[_0xb9df('0x16')]['message']);}})['catch'](function(_0x2b1b0c){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2ad195,_0x2b1b0c);_0x320611(_0x2b1b0c);});});}exports[_0xb9df('0x17')]=function(_0x3f35fe){var _0x2ef762=this;return new Promise(function(_0x3392dd,_0x506ba0){return db[_0xb9df('0x18')][_0xb9df('0x19')]({'raw':_0x3f35fe[_0xb9df('0x1a')]?_0x3f35fe[_0xb9df('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3f35fe[_0xb9df('0x1a')]?_0x3f35fe[_0xb9df('0x1a')]['where']||null:null,'attributes':_0x3f35fe[_0xb9df('0x1a')]?_0x3f35fe[_0xb9df('0x1a')][_0xb9df('0x1b')]||null:null,'limit':_0x3f35fe[_0xb9df('0x1a')]?_0x3f35fe['options'][_0xb9df('0x1c')]||null:null,'include':_0x3f35fe[_0xb9df('0x1a')]?_0x3f35fe['options'][_0xb9df('0x1d')]?_[_0xb9df('0x1e')](_0x3f35fe[_0xb9df('0x1a')][_0xb9df('0x1d')],function(_0x1b1d92){return{'model':db[_0x1b1d92[_0xb9df('0x1f')]],'as':_0x1b1d92['as'],'attributes':_0x1b1d92[_0xb9df('0x1b')],'include':_0x1b1d92[_0xb9df('0x1d')]?_['map'](_0x1b1d92[_0xb9df('0x1d')],function(_0xe24c0f){return{'model':db[_0xe24c0f[_0xb9df('0x1f')]],'as':_0xe24c0f['as'],'attributes':_0xe24c0f[_0xb9df('0x1b')],'include':_0xe24c0f['include']?_[_0xb9df('0x1e')](_0xe24c0f['include'],function(_0x47a115){return{'model':db[_0x47a115['model']],'as':_0x47a115['as'],'attributes':_0x47a115['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4785b5){logger[_0xb9df('0xe')](_0xb9df('0x17'),_0x3f35fe);logger['debug']('GetFaxAccount',_0x3f35fe,JSON[_0xb9df('0x12')](_0x4785b5));_0x3392dd(_0x4785b5);})[_0xb9df('0x20')](function(_0x4f8a5c){logger['error'](_0xb9df('0x17'),_0x4f8a5c['message'],_0x3f35fe);_0x506ba0(_0x2ef762[_0xb9df('0x13')](0x1f4,_0x4f8a5c[_0xb9df('0x15')]));});});};exports['NotifyFaxAccount']=function(_0xf3dd91,_0x43ca5e,_0x286021){var _0xba5600=this;return new Promise(function(_0x220a36,_0x3cfa97){var _0x3ed8d7={'body':_0xf3dd91[_0xb9df('0x21')],'channel':_0xb9df('0x22')};var _0x5553de=[];var _0x6be722=[];var _0x4f999e={};return db[_0xb9df('0x23')]['describe']()[_0xb9df('0xd')](function(_0x39d3de){if(!_0x39d3de){throw new db[(_0xb9df('0x24'))][(_0xb9df('0x25'))]('no\x20available\x20attributes');}_0x5553de=_['difference'](_[_0xb9df('0x26')](_0x39d3de),[_0xb9df('0x27'),_0xb9df('0x28')]);_0x6be722=_[_0xb9df('0x29')](_[_0xb9df('0x26')](_0x39d3de),['createdAt',_0xb9df('0x28'),'CompanyId',_0xb9df('0x2a')]);if(_0xf3dd91[_0xb9df('0x21')]['id']){delete _0xf3dd91['body']['id'];}if(_[_0xb9df('0x2b')](_0xf3dd91[_0xb9df('0x21')][_0xb9df('0x2c')])){throw new db[(_0xb9df('0x24'))]['ValidationError'](_0xb9df('0x2d'));}if(_[_0xb9df('0x2b')](_0xf3dd91[_0xb9df('0x21')][_0xb9df('0x21')])||_0xf3dd91[_0xb9df('0x21')][_0xb9df('0x21')]===''){throw new db[(_0xb9df('0x24'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xf3dd91[_0xb9df('0x21')][_0xb9df('0x2e')])){throw new db[(_0xb9df('0x24'))]['ValidationError'](_0xb9df('0x2f')+_0x6be722);}if(!_['includes'](_0x6be722,_0xf3dd91[_0xb9df('0x21')][_0xb9df('0x2e')])){throw new db[(_0xb9df('0x24'))][(_0xb9df('0x25'))](_0xb9df('0x30')+_0x6be722);}_0x4f999e[_0xf3dd91[_0xb9df('0x21')][_0xb9df('0x2e')]]=_0xf3dd91[_0xb9df('0x21')][_0xb9df('0x2c')];})[_0xb9df('0xd')](function(){return db[_0xb9df('0x18')][_0xb9df('0x31')]({'where':{'id':_0xf3dd91['account']['id']},'include':[{'model':db[_0xb9df('0x32')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb9df('0x33'),'where':_0x4f999e,'limit':0x1,'order':[[_0xb9df('0x28'),_0xb9df('0x34')]]}]},{'model':db[_0xb9df('0x35')],'as':_0xb9df('0x36')}]});})[_0xb9df('0xd')](function(_0x1c14e8){if(_0x1c14e8&&_0x1c14e8['List']){var _0x5823cc=_0x1c14e8['get']({'plain':!![]});_0x3ed8d7[_0xb9df('0x37')]=_0x5823cc;_0x3ed8d7[_0xb9df('0x38')]=_0x5823cc[_0xb9df('0x36')];_0x3ed8d7['list']=_0x5823cc[_0xb9df('0x39')];_0x3ed8d7[_0xb9df('0x38')]=_['orderBy'](_0x3ed8d7[_0xb9df('0x38')],[_0xb9df('0x3a')],[_0xb9df('0x3b')]);if(_0x3ed8d7[_0xb9df('0x37')][_0xb9df('0x36')]){delete _0x3ed8d7[_0xb9df('0x37')][_0xb9df('0x36')];}if(_0x3ed8d7[_0xb9df('0x37')][_0xb9df('0x39')]&&_0x3ed8d7['account'][_0xb9df('0x39')][_0xb9df('0x33')][_0xb9df('0x3c')]){return _0x3ed8d7[_0xb9df('0x37')]['List'][_0xb9df('0x33')][0x0];}var _0x614474=_[_0xb9df('0x9')](_0xf3dd91['body'],{'firstName':_0xf3dd91[_0xb9df('0x21')][_0xb9df('0x2c')],'ListId':_0x5823cc[_0xb9df('0x2a')]});_0x614474[_0xf3dd91[_0xb9df('0x21')]['mapKey']]=_0xf3dd91[_0xb9df('0x21')][_0xb9df('0x2c')];return db['CmContact'][_0xb9df('0x3d')](_0x614474,{'fields':_0x5553de,'raw':!![]});}})[_0xb9df('0xd')](function(_0x54b812){_0x3ed8d7[_0xb9df('0x3e')]=_0x54b812;if(_0x54b812){var _0x4e2518={'ContactId':_0x54b812['id'],'FaxAccountId':_0xf3dd91['account']['id'],'fax':_0x54b812[_0xb9df('0x22')]};return db[_0xb9df('0x3f')][_0xb9df('0x31')]({'where':{'ContactId':_0x54b812['id'],'closed':![],'FaxAccountId':_0xf3dd91['account']['id']}})[_0xb9df('0xd')](function(_0x348cd8){if(_0x348cd8){return[_0x348cd8,![]];}return db[_0xb9df('0x3f')][_0xb9df('0x3d')](_0x4e2518)[_0xb9df('0xd')](function(_0x2b5be7){return[_0x2b5be7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x4a47fa,_0x3cf483){var _0xeb238e=_0x4a47fa[_0xb9df('0x40')]({'plain':!![]});if(_0x3cf483){if(_0x3ed8d7[_0xb9df('0x37')][_0xb9df('0x41')]){_0x3ed8d7['applications'][_0xb9df('0x42')]({'id':0x0,'priority':_0x3ed8d7[_0xb9df('0x38')][_0xb9df('0x3c')]+0x1,'app':_0xb9df('0x43'),'appdata':'unmanaged','interval':_0xb9df('0x44')});}_0xeb238e[_0xb9df('0x45')]=!![];}else{_0xeb238e[_0xb9df('0x45')]=![];}_0x3ed8d7[_0xb9df('0x46')]=_0xeb238e;return db['FaxMessage']['create']({'body':_0xf3dd91[_0xb9df('0x21')]['body'],'FaxAccountId':_0xf3dd91[_0xb9df('0x37')]['id'],'FaxInteractionId':_0x4a47fa['id'],'direction':'in','ContactId':_0x4a47fa['ContactId'],'AttachmentId':_0xf3dd91[_0xb9df('0x21')][_0xb9df('0x47')]});})[_0xb9df('0xd')](function(_0x24e5e0){_0x3ed8d7[_0xb9df('0x15')]=_0x24e5e0;if(!_0x3ed8d7['interaction'][_0xb9df('0x48')])return;return db[_0xb9df('0x49')][_0xb9df('0x31')]({'attributes':['id','name'],'where':{'id':_0x3ed8d7[_0xb9df('0x46')]['UserId']}});})[_0xb9df('0xd')](function(_0x142686){if(_0x142686){_0x3ed8d7[_0xb9df('0x38')][_0xb9df('0x4a')]({'id':0x0,'priority':0x0,'app':_0xb9df('0x4b'),'appdata':_0x142686[_0xb9df('0x4c')]+','+(_0x3ed8d7[_0xb9df('0x37')][_0xb9df('0x4d')]||0xa),'interval':_0xb9df('0x44')});}if(!_0x3ed8d7['interaction'][_0xb9df('0x4e')])return;return db[_0xb9df('0x4f')][_0xb9df('0x31')]({'attributes':['id',_0xb9df('0x4c')],'where':{'id':_0x3ed8d7[_0xb9df('0x46')][_0xb9df('0x4e')]}});})[_0xb9df('0xd')](function(_0x1963f7){if(_0x1963f7){_0x3ed8d7['applications'][_0xb9df('0x4a')]({'id':0x0,'priority':0x1,'app':_0xb9df('0x50'),'appdata':_0x1963f7['name']+','+(_0x3ed8d7[_0xb9df('0x37')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb9df('0x51'),'startRouting',_0x3ed8d7);})[_0xb9df('0xd')](function(_0x230d59){_0x220a36(_0x230d59);})[_0xb9df('0x20')](function(_0x5b7bfc){_0x3cfa97(_0xba5600[_0xb9df('0x13')](0x1f4,_0x5b7bfc[_0xb9df('0x15')]));});});}; \ No newline at end of file +var _0xa719=['isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','from','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','length','close','unmanaged','created','interaction','ContactId','UserId','User','name','agent','*,*,*,*','FaxQueue','unshift','queue','waitForTheAssignedQueue','startRouting','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','findAll','options','raw','where','limit','include','map','model','attributes','GetFaxAccount','catch','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','ListId','body'];(function(_0x6ace36,_0x2baad7){var _0x170e54=function(_0x5ba594){while(--_0x5ba594){_0x6ace36['push'](_0x6ace36['shift']());}};_0x170e54(++_0x2baad7);}(_0xa719,0x8a));var _0x9a71=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xa719[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x9a71('0x0'));var util=require('util');var moment=require(_0x9a71('0x1'));var BPromise=require(_0x9a71('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a71('0x3'))['db'];var utils=require(_0x9a71('0x4'));var logger=require(_0x9a71('0x5'))(_0x9a71('0x6'));var config=require(_0x9a71('0x7'));var jayson=require(_0x9a71('0x8'));var client=jayson[_0x9a71('0x9')][_0x9a71('0xa')]({'port':0x232c});config[_0x9a71('0xb')]=_[_0x9a71('0xc')](config[_0x9a71('0xb')],{'host':_0x9a71('0xd'),'port':0x18eb});var socket=require(_0x9a71('0xe'))(new Redis(config[_0x9a71('0xb')]));require(_0x9a71('0xf'))[_0x9a71('0x10')](socket);function respondWithRpcPromise(_0x4443cb,_0x2945ec,_0x173012){return new BPromise(function(_0x280a85,_0x205c36){return client[_0x9a71('0x11')](_0x4443cb,_0x173012)[_0x9a71('0x12')](function(_0x19e80d){logger[_0x9a71('0x13')](_0x9a71('0x14'),_0x2945ec,_0x9a71('0x15'));logger[_0x9a71('0x16')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2945ec,_0x9a71('0x15'),JSON['stringify'](_0x19e80d));if(_0x19e80d['error']){if(_0x19e80d[_0x9a71('0x17')][_0x9a71('0x18')]===0x1f4){logger[_0x9a71('0x17')](_0x9a71('0x14'),_0x2945ec,_0x19e80d[_0x9a71('0x17')][_0x9a71('0x19')]);return _0x205c36(_0x19e80d[_0x9a71('0x17')][_0x9a71('0x19')]);}logger['error'](_0x9a71('0x14'),_0x2945ec,_0x19e80d['error'][_0x9a71('0x19')]);return _0x280a85(_0x19e80d[_0x9a71('0x17')]['message']);}else{logger[_0x9a71('0x13')](_0x9a71('0x14'),_0x2945ec,_0x9a71('0x15'));_0x280a85(_0x19e80d['result']['message']);}})['catch'](function(_0x934ac0){logger[_0x9a71('0x17')]('FaxAccount,\x20%s,\x20%s',_0x2945ec,_0x934ac0);_0x205c36(_0x934ac0);});});}exports['GetFaxAccount']=function(_0x9bcd88){var _0x5de499=this;return new Promise(function(_0x2f665f,_0x3e609c){return db['FaxAccount'][_0x9a71('0x1a')]({'raw':_0x9bcd88[_0x9a71('0x1b')]?_0x9bcd88[_0x9a71('0x1b')][_0x9a71('0x1c')]===undefined?!![]:![]:!![],'where':_0x9bcd88[_0x9a71('0x1b')]?_0x9bcd88[_0x9a71('0x1b')][_0x9a71('0x1d')]||null:null,'attributes':_0x9bcd88[_0x9a71('0x1b')]?_0x9bcd88[_0x9a71('0x1b')]['attributes']||null:null,'limit':_0x9bcd88[_0x9a71('0x1b')]?_0x9bcd88[_0x9a71('0x1b')][_0x9a71('0x1e')]||null:null,'include':_0x9bcd88[_0x9a71('0x1b')]?_0x9bcd88[_0x9a71('0x1b')][_0x9a71('0x1f')]?_[_0x9a71('0x20')](_0x9bcd88['options']['include'],function(_0x1bb4a8){return{'model':db[_0x1bb4a8[_0x9a71('0x21')]],'as':_0x1bb4a8['as'],'attributes':_0x1bb4a8[_0x9a71('0x22')],'include':_0x1bb4a8['include']?_[_0x9a71('0x20')](_0x1bb4a8['include'],function(_0x5ebdbe){return{'model':db[_0x5ebdbe[_0x9a71('0x21')]],'as':_0x5ebdbe['as'],'attributes':_0x5ebdbe[_0x9a71('0x22')],'include':_0x5ebdbe[_0x9a71('0x1f')]?_[_0x9a71('0x20')](_0x5ebdbe[_0x9a71('0x1f')],function(_0x218e08){return{'model':db[_0x218e08[_0x9a71('0x21')]],'as':_0x218e08['as'],'attributes':_0x218e08['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a71('0x12')](function(_0x10dff0){logger[_0x9a71('0x13')](_0x9a71('0x23'),_0x9bcd88);logger[_0x9a71('0x16')](_0x9a71('0x23'),_0x9bcd88,JSON['stringify'](_0x10dff0));_0x2f665f(_0x10dff0);})[_0x9a71('0x24')](function(_0x182799){logger[_0x9a71('0x17')]('GetFaxAccount',_0x182799[_0x9a71('0x19')],_0x9bcd88);_0x3e609c(_0x5de499['error'](0x1f4,_0x182799[_0x9a71('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x5861b0,_0x584870,_0x3f9e7b){var _0x24de3b=this;return new Promise(function(_0x19c25a,_0x94dc5d){var _0x45e551={'body':_0x5861b0['body'],'channel':_0x9a71('0x25')};var _0x50e45d=[];var _0x4975d2=[];var _0x26e7c0={};return db[_0x9a71('0x26')][_0x9a71('0x27')]()['then'](function(_0x3a0766){if(!_0x3a0766){throw new db['Sequelize'][(_0x9a71('0x28'))](_0x9a71('0x29'));}_0x50e45d=_[_0x9a71('0x2a')](_['keys'](_0x3a0766),[_0x9a71('0x2b'),_0x9a71('0x2c')]);_0x4975d2=_[_0x9a71('0x2a')](_[_0x9a71('0x2d')](_0x3a0766),[_0x9a71('0x2b'),_0x9a71('0x2c'),'CompanyId',_0x9a71('0x2e')]);if(_0x5861b0[_0x9a71('0x2f')]['id']){delete _0x5861b0[_0x9a71('0x2f')]['id'];}if(_[_0x9a71('0x30')](_0x5861b0[_0x9a71('0x2f')]['from'])){throw new db[(_0x9a71('0x31'))][(_0x9a71('0x28'))](_0x9a71('0x32'));}if(_['isNil'](_0x5861b0[_0x9a71('0x2f')]['body'])||_0x5861b0['body'][_0x9a71('0x2f')]===''){throw new db[(_0x9a71('0x31'))]['ValidationError'](_0x9a71('0x33'));}if(_[_0x9a71('0x30')](_0x5861b0['body'][_0x9a71('0x34')])){throw new db[(_0x9a71('0x31'))][(_0x9a71('0x28'))](_0x9a71('0x35')+_0x4975d2);}if(!_[_0x9a71('0x36')](_0x4975d2,_0x5861b0[_0x9a71('0x2f')][_0x9a71('0x34')])){throw new db[(_0x9a71('0x31'))][(_0x9a71('0x28'))](_0x9a71('0x37')+_0x4975d2);}_0x26e7c0[_0x5861b0[_0x9a71('0x2f')]['mapKey']]=_0x5861b0[_0x9a71('0x2f')]['from'];})[_0x9a71('0x12')](function(){return db[_0x9a71('0x38')][_0x9a71('0x39')]({'where':{'id':_0x5861b0[_0x9a71('0x3a')]['id']},'include':[{'model':db[_0x9a71('0x3b')],'as':_0x9a71('0x3c'),'include':[{'model':db['CmContact'],'as':_0x9a71('0x3d'),'where':_0x26e7c0,'limit':0x1,'order':[['updatedAt',_0x9a71('0x3e')]]}]},{'model':db[_0x9a71('0x3f')],'as':_0x9a71('0x40')}]});})[_0x9a71('0x12')](function(_0x4408ac){if(_0x4408ac&&_0x4408ac[_0x9a71('0x3c')]){var _0x43552b=_0x4408ac[_0x9a71('0x41')]({'plain':!![]});_0x45e551[_0x9a71('0x3a')]=_0x43552b;_0x45e551[_0x9a71('0x42')]=_0x43552b[_0x9a71('0x40')];_0x45e551[_0x9a71('0x43')]=_0x43552b[_0x9a71('0x3c')];_0x45e551['applications']=_[_0x9a71('0x44')](_0x45e551['applications'],[_0x9a71('0x45')],[_0x9a71('0x46')]);if(_0x45e551[_0x9a71('0x3a')][_0x9a71('0x40')]){delete _0x45e551['account'][_0x9a71('0x40')];}if(_0x45e551[_0x9a71('0x3a')][_0x9a71('0x3c')]&&_0x45e551[_0x9a71('0x3a')][_0x9a71('0x3c')][_0x9a71('0x3d')]['length']){return _0x45e551[_0x9a71('0x3a')][_0x9a71('0x3c')][_0x9a71('0x3d')][0x0];}var _0x2f0736=_[_0x9a71('0xc')](_0x5861b0['body'],{'firstName':_0x5861b0[_0x9a71('0x2f')][_0x9a71('0x47')],'ListId':_0x43552b[_0x9a71('0x2e')]});_0x2f0736[_0x5861b0[_0x9a71('0x2f')][_0x9a71('0x34')]]=_0x5861b0[_0x9a71('0x2f')][_0x9a71('0x47')];return db[_0x9a71('0x26')][_0x9a71('0x48')](_0x2f0736,{'fields':_0x50e45d,'raw':!![]});}})[_0x9a71('0x12')](function(_0x28322a){_0x45e551[_0x9a71('0x49')]=_0x28322a;if(_0x28322a){var _0x33556f={'ContactId':_0x28322a['id'],'FaxAccountId':_0x5861b0[_0x9a71('0x3a')]['id'],'fax':_0x28322a['fax']};return db[_0x9a71('0x4a')][_0x9a71('0x39')]({'where':{'ContactId':_0x28322a['id'],'closed':![],'FaxAccountId':_0x5861b0[_0x9a71('0x3a')]['id']}})['then'](function(_0x2d592f){if(_0x2d592f){return[_0x2d592f,![]];}return db[_0x9a71('0x4a')]['create'](_0x33556f)[_0x9a71('0x12')](function(_0x4b2e5e){return[_0x4b2e5e,!![]];});});}else{throw new Error(_0x9a71('0x4b'));}})['spread'](function(_0x1b511d,_0x1a135f){var _0x1b567f=_0x1b511d[_0x9a71('0x41')]({'plain':!![]});if(_0x1a135f){if(_0x45e551[_0x9a71('0x3a')][_0x9a71('0x4c')]){_0x45e551[_0x9a71('0x42')]['push']({'id':0x0,'priority':_0x45e551[_0x9a71('0x42')][_0x9a71('0x4d')]+0x1,'app':_0x9a71('0x4e'),'appdata':_0x9a71('0x4f'),'interval':'*,*,*,*'});}_0x1b567f[_0x9a71('0x50')]=!![];}else{_0x1b567f[_0x9a71('0x50')]=![];}_0x45e551[_0x9a71('0x51')]=_0x1b567f;return db['FaxMessage'][_0x9a71('0x48')]({'body':_0x5861b0['body']['body'],'FaxAccountId':_0x5861b0[_0x9a71('0x3a')]['id'],'FaxInteractionId':_0x1b511d['id'],'direction':'in','ContactId':_0x1b511d[_0x9a71('0x52')],'AttachmentId':_0x5861b0[_0x9a71('0x2f')]['AttachmentId']});})[_0x9a71('0x12')](function(_0xbfd3b9){_0x45e551[_0x9a71('0x19')]=_0xbfd3b9;if(!_0x45e551[_0x9a71('0x51')][_0x9a71('0x53')])return;return db[_0x9a71('0x54')]['find']({'attributes':['id',_0x9a71('0x55')],'where':{'id':_0x45e551[_0x9a71('0x51')][_0x9a71('0x53')]}});})[_0x9a71('0x12')](function(_0x473cbd){if(_0x473cbd){_0x45e551['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x9a71('0x56'),'appdata':_0x473cbd['name']+','+(_0x45e551[_0x9a71('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0x9a71('0x57')});}if(!_0x45e551['interaction']['queueId'])return;return db[_0x9a71('0x58')][_0x9a71('0x39')]({'attributes':['id','name'],'where':{'id':_0x45e551[_0x9a71('0x51')]['queueId']}});})[_0x9a71('0x12')](function(_0x10cd95){if(_0x10cd95){_0x45e551[_0x9a71('0x42')][_0x9a71('0x59')]({'id':0x0,'priority':0x1,'app':_0x9a71('0x5a'),'appdata':_0x10cd95[_0x9a71('0x55')]+','+(_0x45e551['account'][_0x9a71('0x5b')]||0x12c),'interval':_0x9a71('0x57')});}return respondWithRpcPromise('Start',_0x9a71('0x5c'),_0x45e551);})[_0x9a71('0x12')](function(_0x2a265b){_0x19c25a(_0x2a265b);})['catch'](function(_0x18e13c){_0x94dc5d(_0x24de3b[_0x9a71('0x17')](0x1f4,_0x18e13c[_0x9a71('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 68c87d1..d20b70c 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 _0xfb42=['save','update','emit','removeListener','register'];(function(_0x225399,_0x1494bc){var _0x2da5a2=function(_0x48d028){while(--_0x48d028){_0x225399['push'](_0x225399['shift']());}};_0x2da5a2(++_0x1494bc);}(_0xfb42,0xeb));var _0x2fb4=function(_0x1696bb,_0x53d1b8){_0x1696bb=_0x1696bb-0x0;var _0x5acaec=_0xfb42[_0x1696bb];return _0x5acaec;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x2fb4('0x0'),'remove',_0x2fb4('0x1')];function createListener(_0xd06bde,_0x39f203){return function(_0x5b39f8){_0x39f203[_0x2fb4('0x2')](_0xd06bde,_0x5b39f8);};}function removeListener(_0x527918,_0x20fc61){return function(){FaxAccountEvents[_0x2fb4('0x3')](_0x527918,_0x20fc61);};}exports[_0x2fb4('0x4')]=function(_0x55f6e1){for(var _0x3d5839=0x0,_0x2961c4=events['length'];_0x3d5839<_0x2961c4;_0x3d5839++){var _0x3c3c93=events[_0x3d5839];var _0x3ed403=createListener('faxAccount:'+_0x3c3c93,_0x55f6e1);FaxAccountEvents['on'](_0x3c3c93,_0x3ed403);}}; \ No newline at end of file +var _0x293b=['removeListener','register','length','faxAccount:','save','remove','update','emit'];(function(_0x26aa0d,_0x21a4de){var _0xd62135=function(_0x17e95d){while(--_0x17e95d){_0x26aa0d['push'](_0x26aa0d['shift']());}};_0xd62135(++_0x21a4de);}(_0x293b,0x1ec));var _0xb293=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x293b[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xb293('0x0'),_0xb293('0x1'),_0xb293('0x2')];function createListener(_0x14d271,_0x3da128){return function(_0x3e9e37){_0x3da128[_0xb293('0x3')](_0x14d271,_0x3e9e37);};}function removeListener(_0x5ec963,_0x47f2bc){return function(){FaxAccountEvents[_0xb293('0x4')](_0x5ec963,_0x47f2bc);};}exports[_0xb293('0x5')]=function(_0x3e62c2){for(var _0x261897=0x0,_0x540a10=events[_0xb293('0x6')];_0x261897<_0x540a10;_0x261897++){var _0x38d86b=events[_0x261897];var _0x5255b6=createListener(_0xb293('0x7')+_0x38d86b,_0x3e62c2);FaxAccountEvents['on'](_0x38d86b,_0x5255b6);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index d0ecc53..ac97b7a 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 _0xbd05=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','addDisposition','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents'];(function(_0x147698,_0x201b01){var _0x28c55a=function(_0x4def32){while(--_0x4def32){_0x147698['push'](_0x147698['shift']());}};_0x28c55a(++_0x201b01);}(_0xbd05,0x169));var _0x5bd0=function(_0x221a6f,_0x1674c8){_0x221a6f=_0x221a6f-0x0;var _0x3db53d=_0xbd05[_0x221a6f];return _0x3db53d;};'use strict';var multer=require(_0x5bd0('0x0'));var util=require(_0x5bd0('0x1'));var path=require('path');var timeout=require(_0x5bd0('0x2'));var express=require('express');var router=express[_0x5bd0('0x3')]();var fs_extra=require(_0x5bd0('0x4'));var auth=require(_0x5bd0('0x5'));var interaction=require(_0x5bd0('0x6'));var config=require(_0x5bd0('0x7'));var controller=require(_0x5bd0('0x8'));router[_0x5bd0('0x9')]('/',auth[_0x5bd0('0xa')](),controller[_0x5bd0('0xb')]);router[_0x5bd0('0x9')](_0x5bd0('0xc'),auth[_0x5bd0('0xa')](),controller[_0x5bd0('0xd')]);router[_0x5bd0('0x9')](_0x5bd0('0xe'),auth[_0x5bd0('0xa')](),controller['show']);router[_0x5bd0('0x9')](_0x5bd0('0xf'),auth['isAuthenticated'](),controller[_0x5bd0('0x10')]);router[_0x5bd0('0x9')](_0x5bd0('0x11'),auth['isAuthenticated'](),controller[_0x5bd0('0x12')]);router[_0x5bd0('0x9')](_0x5bd0('0x13'),auth[_0x5bd0('0xa')](),controller[_0x5bd0('0x14')]);router[_0x5bd0('0x9')](_0x5bd0('0x15'),auth[_0x5bd0('0xa')](),controller[_0x5bd0('0x16')]);router['get'](_0x5bd0('0x17'),auth['isAuthenticated'](),controller['getMessages']);router[_0x5bd0('0x9')](_0x5bd0('0x18'),auth[_0x5bd0('0xa')](),controller[_0x5bd0('0x19')]);router[_0x5bd0('0x1a')]('/',auth['isAuthenticated'](),controller[_0x5bd0('0x1b')]);router[_0x5bd0('0x1a')]('/:id/dispositions',auth[_0x5bd0('0xa')](),controller[_0x5bd0('0x1c')]);router[_0x5bd0('0x1a')](_0x5bd0('0x11'),auth[_0x5bd0('0xa')](),controller['addAnswer']);router[_0x5bd0('0x1a')](_0x5bd0('0x13'),auth[_0x5bd0('0xa')](),controller[_0x5bd0('0x1d')]);router[_0x5bd0('0x1a')](_0x5bd0('0x15'),auth[_0x5bd0('0xa')](),controller[_0x5bd0('0x1e')]);router[_0x5bd0('0x1a')](_0x5bd0('0x1f'),auth['isAuthenticated'](),controller[_0x5bd0('0x20')]);router[_0x5bd0('0x1a')](_0x5bd0('0x21'),auth['isAuthenticated'](),controller[_0x5bd0('0x22')]);router[_0x5bd0('0x1a')](_0x5bd0('0x23'),auth[_0x5bd0('0xa')](),controller[_0x5bd0('0x24')]);router[_0x5bd0('0x1a')](_0x5bd0('0x18'),auth['isAuthenticated'](),controller[_0x5bd0('0x25')]);router[_0x5bd0('0x26')]('/:id',auth['isAuthenticated'](),controller[_0x5bd0('0x27')]);router[_0x5bd0('0x28')](_0x5bd0('0xe'),auth[_0x5bd0('0xa')](),controller['destroy']);router[_0x5bd0('0x28')](_0x5bd0('0xf'),auth[_0x5bd0('0xa')](),controller[_0x5bd0('0x29')]);router['delete'](_0x5bd0('0x11'),auth[_0x5bd0('0xa')](),controller[_0x5bd0('0x2a')]);router['delete'](_0x5bd0('0x18'),auth['isAuthenticated'](),controller[_0x5bd0('0x2b')]);module[_0x5bd0('0x2c')]=router; \ No newline at end of file +var _0xf31b=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getApplications','/:id/messages','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','show'];(function(_0x41edab,_0x255da0){var _0x48df17=function(_0x1bdd17){while(--_0x1bdd17){_0x41edab['push'](_0x41edab['shift']());}};_0x48df17(++_0x255da0);}(_0xf31b,0x1a0));var _0xbf31=function(_0x301625,_0x56a1e0){_0x301625=_0x301625-0x0;var _0x516a33=_0xf31b[_0x301625];return _0x516a33;};'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('./faxAccount.controller');router['get']('/',auth[_0xbf31('0x9')](),controller['index']);router[_0xbf31('0xa')](_0xbf31('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xbf31('0xa')]('/:id',auth[_0xbf31('0x9')](),controller[_0xbf31('0xc')]);router[_0xbf31('0xa')](_0xbf31('0xd'),auth[_0xbf31('0x9')](),controller[_0xbf31('0xe')]);router[_0xbf31('0xa')](_0xbf31('0xf'),auth[_0xbf31('0x9')](),controller[_0xbf31('0x10')]);router[_0xbf31('0xa')](_0xbf31('0x11'),auth[_0xbf31('0x9')](),controller['getInteractions']);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xbf31('0x12')]);router[_0xbf31('0xa')](_0xbf31('0x13'),auth[_0xbf31('0x9')](),controller['getMessages']);router['get'](_0xbf31('0x14'),auth[_0xbf31('0x9')](),controller[_0xbf31('0x15')]);router[_0xbf31('0x16')]('/',auth[_0xbf31('0x9')](),controller['create']);router[_0xbf31('0x16')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xbf31('0x17')]);router[_0xbf31('0x16')](_0xbf31('0xf'),auth[_0xbf31('0x9')](),controller[_0xbf31('0x18')]);router['post']('/:id/interactions',auth[_0xbf31('0x9')](),controller[_0xbf31('0x19')]);router[_0xbf31('0x16')]('/:id/applications',auth[_0xbf31('0x9')](),controller[_0xbf31('0x1a')]);router[_0xbf31('0x16')](_0xbf31('0x1b'),auth[_0xbf31('0x9')](),controller['addAccountApplications']);router[_0xbf31('0x16')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0xbf31('0x1c')]);router[_0xbf31('0x16')](_0xbf31('0x1d'),auth[_0xbf31('0x9')](),controller[_0xbf31('0x1e')]);router[_0xbf31('0x16')]('/:id/users',auth[_0xbf31('0x9')](),controller[_0xbf31('0x1f')]);router[_0xbf31('0x20')](_0xbf31('0x21'),auth[_0xbf31('0x9')](),controller[_0xbf31('0x22')]);router['delete'](_0xbf31('0x21'),auth[_0xbf31('0x9')](),controller[_0xbf31('0x23')]);router[_0xbf31('0x24')](_0xbf31('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xbf31('0x24')](_0xbf31('0xf'),auth[_0xbf31('0x9')](),controller[_0xbf31('0x25')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xbf31('0x26')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 4e0b3d2..d7fc6c6 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 _0xa4d6=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3478ce,_0x8611aa){var _0x27125d=function(_0x1074a4){while(--_0x1074a4){_0x3478ce['push'](_0x3478ce['shift']());}};_0x27125d(++_0x8611aa);}(_0xa4d6,0x128));var _0x6a4d=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xa4d6[_0x382e89];return _0x3a1318;};'use strict';var Sequelize=require(_0x6a4d('0x0'));module[_0x6a4d('0x1')]={'priority':{'type':Sequelize[_0x6a4d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6a4d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6a4d('0x4')]()},'description':{'type':Sequelize[_0x6a4d('0x3')]},'interval':{'type':Sequelize[_0x6a4d('0x3')],'defaultValue':_0x6a4d('0x5')}}; \ No newline at end of file +var _0x7a96=['sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x274797,_0x56be87){var _0x5671b3=function(_0x5638fe){while(--_0x5638fe){_0x274797['push'](_0x274797['shift']());}};_0x5671b3(++_0x56be87);}(_0x7a96,0x6c));var _0x67a9=function(_0x57e14f,_0x17f93c){_0x57e14f=_0x57e14f-0x0;var _0x39fce2=_0x7a96[_0x57e14f];return _0x39fce2;};'use strict';var Sequelize=require(_0x67a9('0x0'));module[_0x67a9('0x1')]={'priority':{'type':Sequelize[_0x67a9('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x67a9('0x3')},'appdata':{'type':Sequelize[_0x67a9('0x4')]()},'description':{'type':Sequelize[_0x67a9('0x5')]},'interval':{'type':Sequelize[_0x67a9('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 23156b4..afae749 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 _0x043f=['query','keys','filters','intersection','attributes','model','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','FaxApplication','rawAttributes','type','key'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x043f,0xf9));var _0xf043=function(_0x4cf77b,_0x2b7491){_0x4cf77b=_0x4cf77b-0x0;var _0x1d1bee=_0x043f[_0x4cf77b];return _0x1d1bee;};'use strict';var emlformat=require(_0xf043('0x0'));var rimraf=require(_0xf043('0x1'));var zipdir=require(_0xf043('0x2'));var jsonpatch=require(_0xf043('0x3'));var rp=require(_0xf043('0x4'));var moment=require('moment');var BPromise=require(_0xf043('0x5'));var Mustache=require(_0xf043('0x6'));var util=require(_0xf043('0x7'));var path=require(_0xf043('0x8'));var sox=require(_0xf043('0x9'));var csv=require(_0xf043('0xa'));var ejs=require(_0xf043('0xb'));var fs=require('fs');var fs_extra=require(_0xf043('0xc'));var _=require('lodash');var squel=require(_0xf043('0xd'));var crypto=require(_0xf043('0xe'));var jsforce=require(_0xf043('0xf'));var deskjs=require(_0xf043('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf043('0x11'));var Papa=require(_0xf043('0x12'));var Redis=require(_0xf043('0x13'));var authService=require(_0xf043('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf043('0x15'));var hardwareService=require(_0xf043('0x16'));var logger=require(_0xf043('0x17'))(_0xf043('0x18'));var utils=require(_0xf043('0x19'));var config=require(_0xf043('0x1a'));var licenseUtil=require(_0xf043('0x1b'));var db=require(_0xf043('0x1c'))['db'];function respondWithStatusCode(_0x12e001,_0x504306){_0x504306=_0x504306||0xcc;return function(_0x5ad736){if(_0x5ad736){return _0x12e001[_0xf043('0x1d')](_0x504306);}return _0x12e001['status'](_0x504306)[_0xf043('0x1e')]();};}function respondWithResult(_0x5806df,_0x40fbd8){_0x40fbd8=_0x40fbd8||0xc8;return function(_0x523219){if(_0x523219){return _0x5806df[_0xf043('0x1f')](_0x40fbd8)[_0xf043('0x20')](_0x523219);}};}function respondWithFilteredResult(_0x1f6af7,_0xb48cce){return function(_0x469be6){if(_0x469be6){var _0x3abbd1=typeof _0xb48cce['offset']==='undefined'&&typeof _0xb48cce[_0xf043('0x21')]==='undefined';var _0x4d5809=_0x469be6[_0xf043('0x22')];var _0x414432=_0x3abbd1?0x0:_0xb48cce['offset'];var _0x1f43cb=_0x3abbd1?_0x469be6[_0xf043('0x22')]:_0xb48cce[_0xf043('0x23')]+_0xb48cce[_0xf043('0x21')];var _0x1ed186;if(_0x1f43cb>=_0x4d5809){_0x1f43cb=_0x4d5809;_0x1ed186=0xc8;}else{_0x1ed186=0xce;}_0x1f6af7[_0xf043('0x1f')](_0x1ed186);return _0x1f6af7['set'](_0xf043('0x24'),_0x414432+'-'+_0x1f43cb+'/'+_0x4d5809)[_0xf043('0x20')](_0x469be6);}return null;};}function patchUpdates(_0x1b8b4f){return function(_0x9284e3){try{jsonpatch[_0xf043('0x25')](_0x9284e3,_0x1b8b4f,!![]);}catch(_0x10d3f8){return BPromise[_0xf043('0x26')](_0x10d3f8);}return _0x9284e3[_0xf043('0x27')]();};}function saveUpdates(_0x48a6a1,_0x25e761){return function(_0x4018d1){if(_0x4018d1){return _0x4018d1[_0xf043('0x28')](_0x48a6a1)[_0xf043('0x29')](function(_0x1aaf04){return _0x1aaf04;});}return null;};}function removeEntity(_0x371500,_0x12dccd){return function(_0x6dd046){if(_0x6dd046){return _0x6dd046[_0xf043('0x2a')]()[_0xf043('0x29')](function(){_0x371500[_0xf043('0x1f')](0xcc)[_0xf043('0x1e')]();});}};}function handleEntityNotFound(_0x42d8c1,_0x36bd3c){return function(_0x9e54d8){if(!_0x9e54d8){_0x42d8c1[_0xf043('0x1d')](0x194);}return _0x9e54d8;};}function handleError(_0x213470,_0x29829c){_0x29829c=_0x29829c||0x1f4;return function(_0x2acee5){logger[_0xf043('0x2b')](_0x2acee5[_0xf043('0x2c')]);if(_0x2acee5['name']){delete _0x2acee5[_0xf043('0x2d')];}_0x213470[_0xf043('0x1f')](_0x29829c)['send'](_0x2acee5);};}exports['index']=function(_0x386f71,_0xcdb954){var _0x2368e1={},_0x42b499={},_0x2da85d={'count':0x0,'rows':[]};var _0xa344b4=_[_0xf043('0x2e')](db[_0xf043('0x2f')][_0xf043('0x30')],function(_0x323df8){return{'name':_0x323df8['fieldName'],'type':_0x323df8[_0xf043('0x31')][_0xf043('0x32')]};});_0x42b499['model']=_[_0xf043('0x2e')](_0xa344b4,_0xf043('0x2d'));_0x42b499[_0xf043('0x33')]=_[_0xf043('0x34')](_0x386f71[_0xf043('0x33')]);_0x42b499[_0xf043('0x35')]=_[_0xf043('0x36')](_0x42b499['model'],_0x42b499[_0xf043('0x33')]);_0x2368e1[_0xf043('0x37')]=_[_0xf043('0x36')](_0x42b499[_0xf043('0x38')],qs[_0xf043('0x39')](_0x386f71[_0xf043('0x33')][_0xf043('0x39')]));_0x2368e1[_0xf043('0x37')]=_0x2368e1['attributes']['length']?_0x2368e1['attributes']:_0x42b499['model'];if(!_0x386f71['query']['hasOwnProperty'](_0xf043('0x3a'))){_0x2368e1[_0xf043('0x21')]=qs[_0xf043('0x21')](_0x386f71[_0xf043('0x33')]['limit']);_0x2368e1[_0xf043('0x23')]=qs[_0xf043('0x23')](_0x386f71[_0xf043('0x33')][_0xf043('0x23')]);}_0x2368e1['order']=qs['sort'](_0x386f71[_0xf043('0x33')][_0xf043('0x3b')]);_0x2368e1['where']=qs['filters'](_[_0xf043('0x3c')](_0x386f71['query'],_0x42b499[_0xf043('0x35')]),_0xa344b4);if(_0x386f71['query'][_0xf043('0x3d')]){_0x2368e1[_0xf043('0x3e')]=_[_0xf043('0x3f')](_0x2368e1['where'],{'$or':_['map'](_0xa344b4,function(_0x24ec50){if(_0x24ec50[_0xf043('0x31')]!==_0xf043('0x40')){var _0x4eaba7={};_0x4eaba7[_0x24ec50[_0xf043('0x2d')]]={'$like':'%'+_0x386f71[_0xf043('0x33')][_0xf043('0x3d')]+'%'};return _0x4eaba7;}})});}_0x2368e1=_[_0xf043('0x3f')]({},_0x2368e1,_0x386f71[_0xf043('0x41')]);var _0x36f8ba={'where':_0x2368e1[_0xf043('0x3e')]};return db[_0xf043('0x2f')][_0xf043('0x22')](_0x36f8ba)[_0xf043('0x29')](function(_0xb20b7e){_0x2da85d['count']=_0xb20b7e;if(_0x386f71['query'][_0xf043('0x42')]){_0x2368e1[_0xf043('0x43')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x2368e1);})[_0xf043('0x29')](function(_0x3a2ce2){_0x2da85d[_0xf043('0x44')]=_0x3a2ce2;return _0x2da85d;})['then'](respondWithFilteredResult(_0xcdb954,_0x2368e1))[_0xf043('0x45')](handleError(_0xcdb954,null));};exports[_0xf043('0x46')]=function(_0x2cd09f,_0x436cb7){var _0x26a358={'raw':!![],'where':{'id':_0x2cd09f[_0xf043('0x47')]['id']}},_0x2fa7cf={};_0x2fa7cf[_0xf043('0x38')]=_['keys'](db[_0xf043('0x2f')][_0xf043('0x30')]);_0x2fa7cf['query']=_[_0xf043('0x34')](_0x2cd09f[_0xf043('0x33')]);_0x2fa7cf[_0xf043('0x35')]=_[_0xf043('0x36')](_0x2fa7cf[_0xf043('0x38')],_0x2fa7cf[_0xf043('0x33')]);_0x26a358[_0xf043('0x37')]=_[_0xf043('0x36')](_0x2fa7cf[_0xf043('0x38')],qs[_0xf043('0x39')](_0x2cd09f['query'][_0xf043('0x39')]));_0x26a358[_0xf043('0x37')]=_0x26a358[_0xf043('0x37')]['length']?_0x26a358[_0xf043('0x37')]:_0x2fa7cf[_0xf043('0x38')];if(_0x2cd09f['query'][_0xf043('0x42')]){_0x26a358[_0xf043('0x43')]=[{'all':!![]}];}_0x26a358=_[_0xf043('0x3f')]({},_0x26a358,_0x2cd09f[_0xf043('0x41')]);return db[_0xf043('0x2f')][_0xf043('0x48')](_0x26a358)[_0xf043('0x29')](handleEntityNotFound(_0x436cb7,null))[_0xf043('0x29')](respondWithResult(_0x436cb7,null))[_0xf043('0x45')](handleError(_0x436cb7,null));};exports['create']=function(_0x212a64,_0x591bbf){return db[_0xf043('0x2f')][_0xf043('0x49')](_0x212a64[_0xf043('0x4a')],{})['then'](respondWithResult(_0x591bbf,0xc9))[_0xf043('0x45')](handleError(_0x591bbf,null));};exports[_0xf043('0x28')]=function(_0x29cd5a,_0x11129a){if(_0x29cd5a[_0xf043('0x4a')]['id']){delete _0x29cd5a[_0xf043('0x4a')]['id'];}return db[_0xf043('0x2f')]['find']({'where':{'id':_0x29cd5a[_0xf043('0x47')]['id']}})['then'](handleEntityNotFound(_0x11129a,null))[_0xf043('0x29')](saveUpdates(_0x29cd5a[_0xf043('0x4a')],null))['then'](respondWithResult(_0x11129a,null))['catch'](handleError(_0x11129a,null));};exports['destroy']=function(_0x50f062,_0x3c9032){return db[_0xf043('0x2f')]['find']({'where':{'id':_0x50f062['params']['id']}})['then'](handleEntityNotFound(_0x3c9032,null))[_0xf043('0x29')](removeEntity(_0x3c9032,null))[_0xf043('0x45')](handleError(_0x3c9032,null));}; \ No newline at end of file +var _0x1ca4=['params','keys','rawAttributes','create','body','catch','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','VIRTUAL','merge','options','FaxApplication','includeAll','include','rows'];(function(_0x1c143e,_0x53f10c){var _0x5599de=function(_0x5a0956){while(--_0x5a0956){_0x1c143e['push'](_0x1c143e['shift']());}};_0x5599de(++_0x53f10c);}(_0x1ca4,0x1a5));var _0x41ca=function(_0x2df5c6,_0x259b3c){_0x2df5c6=_0x2df5c6-0x0;var _0x2fdcd2=_0x1ca4[_0x2df5c6];return _0x2fdcd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x41ca('0x0'));var zipdir=require(_0x41ca('0x1'));var jsonpatch=require(_0x41ca('0x2'));var rp=require('request-promise');var moment=require(_0x41ca('0x3'));var BPromise=require(_0x41ca('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x41ca('0x5'));var sox=require(_0x41ca('0x6'));var csv=require(_0x41ca('0x7'));var ejs=require(_0x41ca('0x8'));var fs=require('fs');var fs_extra=require(_0x41ca('0x9'));var _=require(_0x41ca('0xa'));var squel=require(_0x41ca('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x41ca('0xc'));var toCsv=require(_0x41ca('0x7'));var querystring=require(_0x41ca('0xd'));var Papa=require(_0x41ca('0xe'));var Redis=require('ioredis');var authService=require(_0x41ca('0xf'));var qs=require(_0x41ca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x41ca('0x11'))(_0x41ca('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x41ca('0x13'));var db=require(_0x41ca('0x14'))['db'];function respondWithStatusCode(_0x15ae1f,_0x566b27){_0x566b27=_0x566b27||0xcc;return function(_0x453740){if(_0x453740){return _0x15ae1f[_0x41ca('0x15')](_0x566b27);}return _0x15ae1f[_0x41ca('0x16')](_0x566b27)['end']();};}function respondWithResult(_0x3b031f,_0x4a5acc){_0x4a5acc=_0x4a5acc||0xc8;return function(_0x49d72c){if(_0x49d72c){return _0x3b031f[_0x41ca('0x16')](_0x4a5acc)[_0x41ca('0x17')](_0x49d72c);}};}function respondWithFilteredResult(_0x5938f0,_0x2a2057){return function(_0x34c052){if(_0x34c052){var _0x5cf3be=typeof _0x2a2057[_0x41ca('0x18')]==='undefined'&&typeof _0x2a2057[_0x41ca('0x19')]===_0x41ca('0x1a');var _0x311e99=_0x34c052[_0x41ca('0x1b')];var _0x5b3739=_0x5cf3be?0x0:_0x2a2057[_0x41ca('0x18')];var _0xfe8205=_0x5cf3be?_0x34c052[_0x41ca('0x1b')]:_0x2a2057[_0x41ca('0x18')]+_0x2a2057['limit'];var _0x31e34d;if(_0xfe8205>=_0x311e99){_0xfe8205=_0x311e99;_0x31e34d=0xc8;}else{_0x31e34d=0xce;}_0x5938f0['status'](_0x31e34d);return _0x5938f0[_0x41ca('0x1c')](_0x41ca('0x1d'),_0x5b3739+'-'+_0xfe8205+'/'+_0x311e99)[_0x41ca('0x17')](_0x34c052);}return null;};}function patchUpdates(_0x74b6b2){return function(_0x243264){try{jsonpatch[_0x41ca('0x1e')](_0x243264,_0x74b6b2,!![]);}catch(_0x3e87c6){return BPromise[_0x41ca('0x1f')](_0x3e87c6);}return _0x243264['save']();};}function saveUpdates(_0x101569,_0x1114fc){return function(_0x7adcb7){if(_0x7adcb7){return _0x7adcb7[_0x41ca('0x20')](_0x101569)[_0x41ca('0x21')](function(_0x415112){return _0x415112;});}return null;};}function removeEntity(_0xab6e09,_0xc8035b){return function(_0x567cda){if(_0x567cda){return _0x567cda[_0x41ca('0x22')]()['then'](function(){_0xab6e09[_0x41ca('0x16')](0xcc)[_0x41ca('0x23')]();});}};}function handleEntityNotFound(_0x57003d,_0x33b98d){return function(_0x34afe9){if(!_0x34afe9){_0x57003d[_0x41ca('0x15')](0x194);}return _0x34afe9;};}function handleError(_0x59aa7f,_0x2d720e){_0x2d720e=_0x2d720e||0x1f4;return function(_0x1b8379){logger[_0x41ca('0x24')](_0x1b8379['stack']);if(_0x1b8379[_0x41ca('0x25')]){delete _0x1b8379[_0x41ca('0x25')];}_0x59aa7f[_0x41ca('0x16')](_0x2d720e)[_0x41ca('0x26')](_0x1b8379);};}exports[_0x41ca('0x27')]=function(_0x55039d,_0x21a599){var _0x52da09={},_0x2d5841={},_0x42b733={'count':0x0,'rows':[]};var _0x329aad=_[_0x41ca('0x28')](db['FaxApplication']['rawAttributes'],function(_0x39bcff){return{'name':_0x39bcff[_0x41ca('0x29')],'type':_0x39bcff[_0x41ca('0x2a')][_0x41ca('0x2b')]};});_0x2d5841[_0x41ca('0x2c')]=_['map'](_0x329aad,_0x41ca('0x25'));_0x2d5841[_0x41ca('0x2d')]=_['keys'](_0x55039d[_0x41ca('0x2d')]);_0x2d5841[_0x41ca('0x2e')]=_[_0x41ca('0x2f')](_0x2d5841[_0x41ca('0x2c')],_0x2d5841[_0x41ca('0x2d')]);_0x52da09[_0x41ca('0x30')]=_['intersection'](_0x2d5841[_0x41ca('0x2c')],qs[_0x41ca('0x31')](_0x55039d[_0x41ca('0x2d')]['fields']));_0x52da09[_0x41ca('0x30')]=_0x52da09['attributes'][_0x41ca('0x32')]?_0x52da09[_0x41ca('0x30')]:_0x2d5841[_0x41ca('0x2c')];if(!_0x55039d[_0x41ca('0x2d')]['hasOwnProperty'](_0x41ca('0x33'))){_0x52da09[_0x41ca('0x19')]=qs[_0x41ca('0x19')](_0x55039d['query'][_0x41ca('0x19')]);_0x52da09[_0x41ca('0x18')]=qs[_0x41ca('0x18')](_0x55039d[_0x41ca('0x2d')]['offset']);}_0x52da09['order']=qs[_0x41ca('0x34')](_0x55039d[_0x41ca('0x2d')][_0x41ca('0x34')]);_0x52da09['where']=qs[_0x41ca('0x2e')](_['pick'](_0x55039d[_0x41ca('0x2d')],_0x2d5841['filters']),_0x329aad);if(_0x55039d['query'][_0x41ca('0x35')]){_0x52da09[_0x41ca('0x36')]=_['merge'](_0x52da09[_0x41ca('0x36')],{'$or':_[_0x41ca('0x28')](_0x329aad,function(_0x13b101){if(_0x13b101[_0x41ca('0x2a')]!==_0x41ca('0x37')){var _0x2aabdb={};_0x2aabdb[_0x13b101[_0x41ca('0x25')]]={'$like':'%'+_0x55039d['query'][_0x41ca('0x35')]+'%'};return _0x2aabdb;}})});}_0x52da09=_[_0x41ca('0x38')]({},_0x52da09,_0x55039d[_0x41ca('0x39')]);var _0x184832={'where':_0x52da09[_0x41ca('0x36')]};return db[_0x41ca('0x3a')]['count'](_0x184832)[_0x41ca('0x21')](function(_0x504236){_0x42b733['count']=_0x504236;if(_0x55039d[_0x41ca('0x2d')][_0x41ca('0x3b')]){_0x52da09[_0x41ca('0x3c')]=[{'all':!![]}];}return db[_0x41ca('0x3a')]['findAll'](_0x52da09);})['then'](function(_0x3e74ea){_0x42b733[_0x41ca('0x3d')]=_0x3e74ea;return _0x42b733;})['then'](respondWithFilteredResult(_0x21a599,_0x52da09))['catch'](handleError(_0x21a599,null));};exports['show']=function(_0x3b7d9b,_0x29d310){var _0x4e587f={'raw':!![],'where':{'id':_0x3b7d9b[_0x41ca('0x3e')]['id']}},_0x306e17={};_0x306e17[_0x41ca('0x2c')]=_[_0x41ca('0x3f')](db[_0x41ca('0x3a')][_0x41ca('0x40')]);_0x306e17[_0x41ca('0x2d')]=_[_0x41ca('0x3f')](_0x3b7d9b[_0x41ca('0x2d')]);_0x306e17[_0x41ca('0x2e')]=_[_0x41ca('0x2f')](_0x306e17[_0x41ca('0x2c')],_0x306e17[_0x41ca('0x2d')]);_0x4e587f['attributes']=_['intersection'](_0x306e17['model'],qs[_0x41ca('0x31')](_0x3b7d9b[_0x41ca('0x2d')][_0x41ca('0x31')]));_0x4e587f[_0x41ca('0x30')]=_0x4e587f[_0x41ca('0x30')]['length']?_0x4e587f[_0x41ca('0x30')]:_0x306e17[_0x41ca('0x2c')];if(_0x3b7d9b['query'][_0x41ca('0x3b')]){_0x4e587f['include']=[{'all':!![]}];}_0x4e587f=_['merge']({},_0x4e587f,_0x3b7d9b[_0x41ca('0x39')]);return db[_0x41ca('0x3a')]['find'](_0x4e587f)[_0x41ca('0x21')](handleEntityNotFound(_0x29d310,null))[_0x41ca('0x21')](respondWithResult(_0x29d310,null))['catch'](handleError(_0x29d310,null));};exports['create']=function(_0x20cd9c,_0x4f5e89){return db['FaxApplication'][_0x41ca('0x41')](_0x20cd9c[_0x41ca('0x42')],{})[_0x41ca('0x21')](respondWithResult(_0x4f5e89,0xc9))[_0x41ca('0x43')](handleError(_0x4f5e89,null));};exports['update']=function(_0x4684ff,_0x599d87){if(_0x4684ff['body']['id']){delete _0x4684ff[_0x41ca('0x42')]['id'];}return db['FaxApplication'][_0x41ca('0x44')]({'where':{'id':_0x4684ff[_0x41ca('0x3e')]['id']}})[_0x41ca('0x21')](handleEntityNotFound(_0x599d87,null))[_0x41ca('0x21')](saveUpdates(_0x4684ff[_0x41ca('0x42')],null))[_0x41ca('0x21')](respondWithResult(_0x599d87,null))[_0x41ca('0x43')](handleError(_0x599d87,null));};exports['destroy']=function(_0x22076a,_0x5b22ba){return db[_0x41ca('0x3a')]['find']({'where':{'id':_0x22076a[_0x41ca('0x3e')]['id']}})[_0x41ca('0x21')](handleEntityNotFound(_0x5b22ba,null))[_0x41ca('0x21')](removeEntity(_0x5b22ba,null))['catch'](handleError(_0x5b22ba,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 9244678..99fe059 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 _0xcd73=['fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0xb70155,_0x2440b2){var _0x3b1958=function(_0xdf0f59){while(--_0xdf0f59){_0xb70155['push'](_0xb70155['shift']());}};_0x3b1958(++_0x2440b2);}(_0xcd73,0xdf));var _0x3cd7=function(_0x279169,_0x510fd3){_0x279169=_0x279169-0x0;var _0x125359=_0xcd73[_0x279169];return _0x125359;};'use strict';var _=require(_0x3cd7('0x0'));var util=require(_0x3cd7('0x1'));var logger=require(_0x3cd7('0x2'))(_0x3cd7('0x3'));var moment=require('moment');var BPromise=require(_0x3cd7('0x4'));var rp=require(_0x3cd7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3cd7('0x6'));var attributes=require(_0x3cd7('0x7'));module[_0x3cd7('0x8')]=function(_0x1fdb29,_0x36b5a4){return _0x1fdb29[_0x3cd7('0x9')](_0x3cd7('0xa'),attributes,{'tableName':_0x3cd7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3cd7('0xc')});}; \ No newline at end of file +var _0x591c=['request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','lodash','api'];(function(_0x3dbf61,_0xcb1d78){var _0x5541dc=function(_0x35d451){while(--_0x35d451){_0x3dbf61['push'](_0x3dbf61['shift']());}};_0x5541dc(++_0xcb1d78);}(_0x591c,0x1c1));var _0xc591=function(_0x3473f7,_0x3db174){_0x3473f7=_0x3473f7-0x0;var _0x2f3d4a=_0x591c[_0x3473f7];return _0x2f3d4a;};'use strict';var _=require(_0xc591('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc591('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc591('0x2'));var fs=require('fs');var path=require(_0xc591('0x3'));var rimraf=require(_0xc591('0x4'));var config=require(_0xc591('0x5'));var attributes=require(_0xc591('0x6'));module[_0xc591('0x7')]=function(_0x90243e,_0x5b907b){return _0x90243e[_0xc591('0x8')]('FaxApplication',attributes,{'tableName':_0xc591('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc591('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5887563..206c6b6 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 _0x98a1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','update','body','options','raw','attributes','debug','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x98a1,0x10d));var _0x198a=function(_0x1004cb,_0x58d645){_0x1004cb=_0x1004cb-0x0;var _0x52254f=_0x98a1[_0x1004cb];return _0x52254f;};'use strict';var _=require(_0x198a('0x0'));var util=require(_0x198a('0x1'));var moment=require(_0x198a('0x2'));var BPromise=require(_0x198a('0x3'));var rs=require(_0x198a('0x4'));var fs=require('fs');var Redis=require(_0x198a('0x5'));var db=require(_0x198a('0x6'))['db'];var utils=require(_0x198a('0x7'));var logger=require(_0x198a('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x198a('0x9'));var client=jayson[_0x198a('0xa')][_0x198a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdc06cf,_0x256247,_0x17a263){return new BPromise(function(_0x4c7c9b,_0x2bb8c4){return client[_0x198a('0xc')](_0xdc06cf,_0x17a263)[_0x198a('0xd')](function(_0x1e912a){logger[_0x198a('0xe')](_0x198a('0xf'),_0x256247,_0x198a('0x10'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x256247,_0x198a('0x10'),JSON[_0x198a('0x11')](_0x1e912a));if(_0x1e912a[_0x198a('0x12')]){if(_0x1e912a['error'][_0x198a('0x13')]===0x1f4){logger['error'](_0x198a('0xf'),_0x256247,_0x1e912a[_0x198a('0x12')][_0x198a('0x14')]);return _0x2bb8c4(_0x1e912a[_0x198a('0x12')][_0x198a('0x14')]);}logger['error'](_0x198a('0xf'),_0x256247,_0x1e912a[_0x198a('0x12')][_0x198a('0x14')]);return _0x4c7c9b(_0x1e912a[_0x198a('0x12')]['message']);}else{logger[_0x198a('0xe')](_0x198a('0xf'),_0x256247,_0x198a('0x10'));_0x4c7c9b(_0x1e912a[_0x198a('0x15')]['message']);}})[_0x198a('0x16')](function(_0x4c1ee7){logger[_0x198a('0x12')](_0x198a('0xf'),_0x256247,_0x4c1ee7);_0x2bb8c4(_0x4c1ee7);});});}exports[_0x198a('0x17')]=function(_0x59c8f9){var _0x4a60a7=this;return new Promise(function(_0xff1733,_0x56cfcf){return db['FaxApplication'][_0x198a('0x18')](_0x59c8f9[_0x198a('0x19')],{'raw':_0x59c8f9[_0x198a('0x1a')]?_0x59c8f9[_0x198a('0x1a')][_0x198a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59c8f9[_0x198a('0x1a')]?_0x59c8f9['options']['where']||null:null,'attributes':_0x59c8f9[_0x198a('0x1a')]?_0x59c8f9[_0x198a('0x1a')][_0x198a('0x1c')]||null:null,'limit':_0x59c8f9[_0x198a('0x1a')]?_0x59c8f9[_0x198a('0x1a')]['limit']||null:null})[_0x198a('0xd')](function(_0x201be5){logger['info'](_0x198a('0x17'),_0x59c8f9);logger[_0x198a('0x1d')](_0x198a('0x17'),_0x59c8f9,JSON[_0x198a('0x11')](_0x201be5));_0xff1733(_0x201be5);})[_0x198a('0x16')](function(_0x2d392d){logger[_0x198a('0x12')](_0x198a('0x17'),_0x2d392d[_0x198a('0x14')],_0x59c8f9);_0x56cfcf(_0x4a60a7[_0x198a('0x12')](0x1f4,_0x2d392d[_0x198a('0x14')]));});});}; \ No newline at end of file +var _0xcd97=['limit','stringify','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxApplication','FaxApplication','update','options','raw','attributes'];(function(_0x49102e,_0x2efb3a){var _0x409c63=function(_0x105839){while(--_0x105839){_0x49102e['push'](_0x49102e['shift']());}};_0x409c63(++_0x2efb3a);}(_0xcd97,0x189));var _0x7cd9=function(_0x316904,_0x1e8b77){_0x316904=_0x316904-0x0;var _0xfa9a21=_0xcd97[_0x316904];return _0xfa9a21;};'use strict';var _=require(_0x7cd9('0x0'));var util=require('util');var moment=require(_0x7cd9('0x1'));var BPromise=require('bluebird');var rs=require(_0x7cd9('0x2'));var fs=require('fs');var Redis=require(_0x7cd9('0x3'));var db=require(_0x7cd9('0x4'))['db'];var utils=require(_0x7cd9('0x5'));var logger=require(_0x7cd9('0x6'))(_0x7cd9('0x7'));var config=require(_0x7cd9('0x8'));var jayson=require(_0x7cd9('0x9'));var client=jayson[_0x7cd9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5cad,_0x4de560,_0x27032a){return new BPromise(function(_0x5d63ee,_0x594fdc){return client['request'](_0x1e5cad,_0x27032a)[_0x7cd9('0xb')](function(_0x5ecdcb){logger[_0x7cd9('0xc')](_0x7cd9('0xd'),_0x4de560,_0x7cd9('0xe'));logger[_0x7cd9('0xf')](_0x7cd9('0x10'),_0x4de560,_0x7cd9('0xe'),JSON['stringify'](_0x5ecdcb));if(_0x5ecdcb[_0x7cd9('0x11')]){if(_0x5ecdcb['error'][_0x7cd9('0x12')]===0x1f4){logger[_0x7cd9('0x11')](_0x7cd9('0xd'),_0x4de560,_0x5ecdcb[_0x7cd9('0x11')]['message']);return _0x594fdc(_0x5ecdcb[_0x7cd9('0x11')][_0x7cd9('0x13')]);}logger[_0x7cd9('0x11')]('FaxApplication,\x20%s,\x20%s',_0x4de560,_0x5ecdcb[_0x7cd9('0x11')][_0x7cd9('0x13')]);return _0x5d63ee(_0x5ecdcb[_0x7cd9('0x11')][_0x7cd9('0x13')]);}else{logger[_0x7cd9('0xc')](_0x7cd9('0xd'),_0x4de560,'request\x20sent');_0x5d63ee(_0x5ecdcb[_0x7cd9('0x14')]['message']);}})['catch'](function(_0x1a9ec2){logger['error'](_0x7cd9('0xd'),_0x4de560,_0x1a9ec2);_0x594fdc(_0x1a9ec2);});});}exports[_0x7cd9('0x15')]=function(_0x49a565){var _0x3396d2=this;return new Promise(function(_0x44bb7e,_0x33dcf8){return db[_0x7cd9('0x16')][_0x7cd9('0x17')](_0x49a565['body'],{'raw':_0x49a565[_0x7cd9('0x18')]?_0x49a565[_0x7cd9('0x18')][_0x7cd9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49a565[_0x7cd9('0x18')]?_0x49a565[_0x7cd9('0x18')]['where']||null:null,'attributes':_0x49a565[_0x7cd9('0x18')]?_0x49a565[_0x7cd9('0x18')][_0x7cd9('0x1a')]||null:null,'limit':_0x49a565[_0x7cd9('0x18')]?_0x49a565[_0x7cd9('0x18')][_0x7cd9('0x1b')]||null:null})[_0x7cd9('0xb')](function(_0x1e859d){logger['info']('UpdateFaxApplication',_0x49a565);logger['debug'](_0x7cd9('0x15'),_0x49a565,JSON[_0x7cd9('0x1c')](_0x1e859d));_0x44bb7e(_0x1e859d);})[_0x7cd9('0x1d')](function(_0x1d3ef0){logger['error'](_0x7cd9('0x15'),_0x1d3ef0[_0x7cd9('0x13')],_0x49a565);_0x33dcf8(_0x3396d2[_0x7cd9('0x11')](0x1f4,_0x1d3ef0[_0x7cd9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 6e2ab6e..75c5a08 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x46280d,_0x15dbb1){var _0x14b474=function(_0x13bc8f){while(--_0x13bc8f){_0x46280d['push'](_0x46280d['shift']());}};_0x14b474(++_0x15dbb1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x4cf8=['show','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0x4cf8[_0xa8b370];return _0x643e37;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var fs_extra=require(_0x84cf('0x6'));var auth=require(_0x84cf('0x7'));var interaction=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var controller=require(_0x84cf('0xa'));router[_0x84cf('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84cf('0xb')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0xd')]);router['post']('/',auth[_0x84cf('0xc')](),controller[_0x84cf('0xe')]);router['put'](_0x84cf('0xf'),auth[_0x84cf('0xc')](),controller[_0x84cf('0x10')]);router[_0x84cf('0x11')]('/:id',auth[_0x84cf('0xc')](),controller[_0x84cf('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index d0108b0..1546a4d 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 _0x7b84=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7b84,0x17c));var _0x47b8=function(_0x159659,_0x25397e){_0x159659=_0x159659-0x0;var _0x44eea4=_0x7b84[_0x159659];return _0x44eea4;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'closed':{'type':Sequelize[_0x47b8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x47b8('0x3')]},'disposition':{'type':Sequelize[_0x47b8('0x4')]},'secondDisposition':{'type':Sequelize[_0x47b8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x47b8('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x47b8('0x3')]},'fax':{'type':Sequelize[_0x47b8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in',_0x47b8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x47b8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x47b8('0x7')]}}; \ No newline at end of file +var _0x958a=['ENUM','INTEGER','sequelize','exports','DATE','STRING','out'];(function(_0x456904,_0x4cb25c){var _0x4b0063=function(_0x2cb59f){while(--_0x2cb59f){_0x456904['push'](_0x456904['shift']());}};_0x4b0063(++_0x4cb25c);}(_0x958a,0x128));var _0xa958=function(_0x16b896,_0x15e7c3){_0x16b896=_0x16b896-0x0;var _0x30f9b1=_0x958a[_0x16b896];return _0x30f9b1;};'use strict';var Sequelize=require(_0xa958('0x0'));module[_0xa958('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa958('0x2')]},'disposition':{'type':Sequelize[_0xa958('0x3')]},'secondDisposition':{'type':Sequelize[_0xa958('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa958('0x3')]},'note':{'type':Sequelize[_0xa958('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xa958('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa958('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa958('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa958('0x5')]('in',_0xa958('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xa958('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 9078da6..429b737 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 _0xe7b0=['Attachment','Messages','mkdirSync','length','basename','createReadStream','pipe','resolve','unlinkSync','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./faxInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','map','FaxInteraction','rawAttributes','fieldName','type','getOptions','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','create','body','find','describe','FaxMessage','addMessage','omit','ids','getMessages','nolimit','order','sort','where','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','download','unix','toString','join','root','files','server','attachments','format','transcript-%d-%s.zip','push'];(function(_0x167ae5,_0x2c76ed){var _0x3ce35b=function(_0x537db8){while(--_0x537db8){_0x167ae5['push'](_0x167ae5['shift']());}};_0x3ce35b(++_0x2c76ed);}(_0xe7b0,0xc3));var _0x0e7b=function(_0x3f3f40,_0x4e745f){_0x3f3f40=_0x3f3f40-0x0;var _0x32c366=_0xe7b0[_0x3f3f40];return _0x32c366;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0e7b('0x0'));var moment=require(_0x0e7b('0x1'));var BPromise=require('bluebird');var util=require(_0x0e7b('0x2'));var path=require(_0x0e7b('0x3'));var fs=require('fs');var _=require(_0x0e7b('0x4'));var Redis=require(_0x0e7b('0x5'));var interaction=require(_0x0e7b('0x6'));var qs=require(_0x0e7b('0x7'));var logger=require(_0x0e7b('0x8'))(_0x0e7b('0x9'));var config=require(_0x0e7b('0xa'));var db=require(_0x0e7b('0xb'))['db'];config[_0x0e7b('0xc')]=_['defaults'](config[_0x0e7b('0xc')],{'host':_0x0e7b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0e7b('0xe'))['register'](socket);function respondWithStatusCode(_0x4e3434,_0x4236c7){_0x4236c7=_0x4236c7||0xcc;return function(_0x2daee0){if(_0x2daee0){return _0x4e3434[_0x0e7b('0xf')](_0x4236c7);}return _0x4e3434[_0x0e7b('0x10')](_0x4236c7)['end']();};}function respondWithResult(_0x36e483,_0x9504c8){_0x9504c8=_0x9504c8||0xc8;return function(_0x3489e2){if(_0x3489e2){return _0x36e483[_0x0e7b('0x10')](_0x9504c8)[_0x0e7b('0x11')](_0x3489e2);}};}function respondWithFilteredResult(_0xd8e653,_0x3c4e65){return function(_0x290d73){if(_0x290d73){var _0x43dfd7=typeof _0x3c4e65[_0x0e7b('0x12')]===_0x0e7b('0x13')&&typeof _0x3c4e65[_0x0e7b('0x14')]==='undefined';var _0x1c3ffe=_0x290d73['count'];var _0x2115a6=_0x43dfd7?0x0:_0x3c4e65[_0x0e7b('0x12')];var _0xe8f8cd=_0x43dfd7?_0x290d73[_0x0e7b('0x15')]:_0x3c4e65['offset']+_0x3c4e65[_0x0e7b('0x14')];var _0x479913;if(_0xe8f8cd>=_0x1c3ffe){_0xe8f8cd=_0x1c3ffe;_0x479913=0xc8;}else{_0x479913=0xce;}_0xd8e653[_0x0e7b('0x10')](_0x479913);return _0xd8e653['set'](_0x0e7b('0x16'),_0x2115a6+'-'+_0xe8f8cd+'/'+_0x1c3ffe)[_0x0e7b('0x11')](_0x290d73);}return null;};}function saveUpdates(_0x577513){return function(_0x4877a9){if(_0x4877a9){return _0x4877a9[_0x0e7b('0x17')](_0x577513)[_0x0e7b('0x18')](function(_0x550d02){return _0x550d02;});}return null;};}function removeEntity(_0x1617e8){return function(_0x5f0603){if(_0x5f0603){return _0x5f0603[_0x0e7b('0x19')]()[_0x0e7b('0x18')](function(){_0x1617e8[_0x0e7b('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f4281){return function(_0x232ac7){if(!_0x232ac7){_0x4f4281[_0x0e7b('0xf')](0x194);}return _0x232ac7;};}function handleError(_0xc2b88a,_0x39fa06){_0x39fa06=_0x39fa06||0x1f4;return function(_0x412d30){logger[_0x0e7b('0x1a')](_0x412d30[_0x0e7b('0x1b')]);if(_0x412d30[_0x0e7b('0x1c')]){delete _0x412d30['name'];}_0xc2b88a[_0x0e7b('0x10')](_0x39fa06)['send'](_0x412d30);};}exports['index']=function(_0x43f8e5,_0x40a551){var _0x3f009b={};var _0x34166=_[_0x0e7b('0x1d')](db[_0x0e7b('0x1e')][_0x0e7b('0x1f')],function(_0xb7c26e){return{'name':_0xb7c26e[_0x0e7b('0x20')],'type':_0xb7c26e[_0x0e7b('0x21')]['key']};});_0x3f009b=qs[_0x0e7b('0x22')](_0x34166,_0x43f8e5);return interaction['findAll']('fax',_0x43f8e5[_0x0e7b('0x23')],_0x43f8e5[_0x0e7b('0x24')],_0x3f009b,_0x34166)[_0x0e7b('0x18')](respondWithFilteredResult(_0x40a551,_0x3f009b))[_0x0e7b('0x25')](handleError(_0x40a551,null));};exports[_0x0e7b('0x26')]=function(_0x3a229d,_0x2f6ef0){var _0x18492d={'raw':![],'where':{'id':_0x3a229d[_0x0e7b('0x27')]['id']}},_0x38c324={};_0x38c324[_0x0e7b('0x28')]=_[_0x0e7b('0x29')](db[_0x0e7b('0x1e')][_0x0e7b('0x1f')]);_0x38c324[_0x0e7b('0x23')]=_['keys'](_0x3a229d[_0x0e7b('0x23')]);_0x38c324[_0x0e7b('0x2a')]=_[_0x0e7b('0x2b')](_0x38c324[_0x0e7b('0x28')],_0x38c324[_0x0e7b('0x23')]);_0x18492d[_0x0e7b('0x2c')]=_['intersection'](_0x38c324['model'],qs[_0x0e7b('0x2d')](_0x3a229d['query'][_0x0e7b('0x2d')]));_0x18492d[_0x0e7b('0x2c')]=_0x18492d[_0x0e7b('0x2c')]['length']?_0x18492d[_0x0e7b('0x2c')]:_0x38c324[_0x0e7b('0x28')];if(_0x3a229d[_0x0e7b('0x23')][_0x0e7b('0x2e')]){_0x18492d[_0x0e7b('0x2f')]=[{'all':!![]}];}_0x18492d=_[_0x0e7b('0x30')]({},_0x18492d,_0x3a229d[_0x0e7b('0x31')]);return db['FaxInteraction']['find'](_0x18492d)[_0x0e7b('0x18')](handleEntityNotFound(_0x2f6ef0,null))['then'](respondWithResult(_0x2f6ef0,null))[_0x0e7b('0x25')](handleError(_0x2f6ef0,null));};exports[_0x0e7b('0x32')]=function(_0xa3780d,_0x5c0371){return db[_0x0e7b('0x1e')][_0x0e7b('0x32')](_0xa3780d['body'],{})[_0x0e7b('0x18')](respondWithResult(_0x5c0371,0xc9))[_0x0e7b('0x25')](handleError(_0x5c0371,null));};exports[_0x0e7b('0x17')]=function(_0x419444,_0x15540c){if(_0x419444[_0x0e7b('0x33')]['id']){delete _0x419444[_0x0e7b('0x33')]['id'];}return db[_0x0e7b('0x1e')]['find']({'where':{'id':_0x419444['params']['id']}})[_0x0e7b('0x18')](handleEntityNotFound(_0x15540c,null))[_0x0e7b('0x18')](saveUpdates(_0x419444[_0x0e7b('0x33')],null))['then'](respondWithResult(_0x15540c,null))[_0x0e7b('0x25')](handleError(_0x15540c,null));};exports[_0x0e7b('0x19')]=function(_0x235f59,_0xda81ae){return db[_0x0e7b('0x1e')][_0x0e7b('0x34')]({'where':{'id':_0x235f59[_0x0e7b('0x27')]['id']}})[_0x0e7b('0x18')](handleEntityNotFound(_0xda81ae,null))['then'](removeEntity(_0xda81ae,null))[_0x0e7b('0x25')](handleError(_0xda81ae,null));};exports[_0x0e7b('0x35')]=function(_0x231015,_0x215fd6){return db[_0x0e7b('0x1e')][_0x0e7b('0x35')]()[_0x0e7b('0x18')](respondWithResult(_0x215fd6,null))[_0x0e7b('0x25')](handleError(_0x215fd6,null));};exports['addMessage']=function(_0x3d23d5,_0x17fdbc){return db[_0x0e7b('0x36')]['find']({'where':{'id':_0x3d23d5[_0x0e7b('0x27')]['id']}})['then'](handleEntityNotFound(_0x17fdbc,null))[_0x0e7b('0x18')](function(_0x2c49bc){if(_0x2c49bc){return _0x2c49bc[_0x0e7b('0x37')](_0x3d23d5['body']['ids'],_[_0x0e7b('0x38')](_0x3d23d5['body'],[_0x0e7b('0x39'),'id'])||{});}})[_0x0e7b('0x18')](respondWithResult(_0x17fdbc,null))[_0x0e7b('0x25')](handleError(_0x17fdbc,null));};exports[_0x0e7b('0x3a')]=function(_0x5f4a7e,_0x27d602){var _0x30fefa={'raw':![],'where':{}};var _0x562ff0={};var _0x4709d6={'count':0x0,'rows':[]};return db[_0x0e7b('0x1e')]['findOne']({'where':{'id':_0x5f4a7e[_0x0e7b('0x27')]['id']}})[_0x0e7b('0x18')](handleEntityNotFound(_0x27d602,null))[_0x0e7b('0x18')](function(_0x2b84a9){if(_0x2b84a9){_0x562ff0[_0x0e7b('0x28')]=_[_0x0e7b('0x29')](db['FaxMessage'][_0x0e7b('0x1f')]);_0x562ff0[_0x0e7b('0x23')]=_[_0x0e7b('0x29')](_0x5f4a7e['query']);_0x562ff0[_0x0e7b('0x2a')]=_[_0x0e7b('0x2b')](_0x562ff0[_0x0e7b('0x28')],_0x562ff0[_0x0e7b('0x23')]);_0x30fefa[_0x0e7b('0x2c')]=_[_0x0e7b('0x2b')](_0x562ff0['model'],qs[_0x0e7b('0x2d')](_0x5f4a7e[_0x0e7b('0x23')][_0x0e7b('0x2d')]));_0x30fefa[_0x0e7b('0x2c')]=_0x30fefa[_0x0e7b('0x2c')]['length']?_0x30fefa[_0x0e7b('0x2c')]:_0x562ff0['model'];if(!_0x5f4a7e['query']['hasOwnProperty'](_0x0e7b('0x3b'))){_0x30fefa[_0x0e7b('0x14')]=qs['limit'](_0x5f4a7e[_0x0e7b('0x23')][_0x0e7b('0x14')]);_0x30fefa['offset']=qs[_0x0e7b('0x12')](_0x5f4a7e['query'][_0x0e7b('0x12')]);}_0x30fefa[_0x0e7b('0x3c')]=qs['sort'](_0x5f4a7e['query'][_0x0e7b('0x3d')]);_0x30fefa[_0x0e7b('0x3e')]=qs['filters'](_['pick'](_0x5f4a7e[_0x0e7b('0x23')],_0x562ff0[_0x0e7b('0x2a')]));_0x30fefa[_0x0e7b('0x3e')]['FaxInteractionId']=_0x2b84a9['id'];if(_0x5f4a7e[_0x0e7b('0x23')][_0x0e7b('0x3f')]){_0x30fefa[_0x0e7b('0x3e')]=_[_0x0e7b('0x30')](_0x30fefa[_0x0e7b('0x3e')],{'$or':_[_0x0e7b('0x1d')](_0x30fefa[_0x0e7b('0x2c')],function(_0x2bcaa6){var _0x43c3d6={};_0x43c3d6[_0x2bcaa6]={'$like':'%'+_0x5f4a7e[_0x0e7b('0x23')]['filter']+'%'};return _0x43c3d6;})});}if(_0x5f4a7e[_0x0e7b('0x23')]['$gte']){var _0x4fca2a=_0x5f4a7e[_0x0e7b('0x23')][_0x0e7b('0x40')]['split'](',');var _0x2a9cfa={};_0x2a9cfa[_0x4fca2a[0x0]]={'$gte':moment(_0x4fca2a[0x1])['format'](_0x0e7b('0x41'))};_0x30fefa[_0x0e7b('0x3e')]=_['merge'](_0x30fefa[_0x0e7b('0x3e')],_0x2a9cfa);}_0x30fefa=_[_0x0e7b('0x30')]({},_0x30fefa,_0x5f4a7e[_0x0e7b('0x31')]);return db['FaxMessage'][_0x0e7b('0x15')]({'where':_0x30fefa['where']})[_0x0e7b('0x18')](function(_0x1c9102){_0x4709d6['count']=_0x1c9102;if(_0x5f4a7e[_0x0e7b('0x23')]['includeAll']){_0x30fefa[_0x0e7b('0x2f')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x30fefa);})[_0x0e7b('0x18')](function(_0x49b5f2){_0x4709d6['rows']=_0x49b5f2;return _0x4709d6;});}})[_0x0e7b('0x18')](respondWithFilteredResult(_0x27d602,_0x30fefa))[_0x0e7b('0x25')](handleError(_0x27d602,null));};exports[_0x0e7b('0x42')]=function(_0x47043e,_0x51fa9b){return db['FaxInteraction'][_0x0e7b('0x34')]({'where':{'id':_0x47043e[_0x0e7b('0x27')]['id']}})[_0x0e7b('0x18')](handleEntityNotFound(_0x51fa9b,null))[_0x0e7b('0x18')](function(_0x4c3277){if(_0x4c3277){return _0x4c3277[_0x0e7b('0x43')](_0x47043e['body']['ids'],_[_0x0e7b('0x38')](_0x47043e[_0x0e7b('0x33')],[_0x0e7b('0x39'),'id'])||{})[_0x0e7b('0x44')](function(){return db[_0x0e7b('0x45')]['findAll']({'attributes':['id',_0x0e7b('0x1c'),_0x0e7b('0x46')],'where':{'id':_0x47043e[_0x0e7b('0x33')][_0x0e7b('0x39')]}});})[_0x0e7b('0x18')](function(_0x2791f5){socket[_0x0e7b('0x47')](_0x0e7b('0x48'),{'id':Number(_0x47043e['params']['id']),'tags':_0x2791f5||[]});return{'id':Number(_0x47043e[_0x0e7b('0x27')]['id']),'tags':_0x2791f5||[]};});}})[_0x0e7b('0x18')](respondWithResult(_0x51fa9b,null))[_0x0e7b('0x25')](handleError(_0x51fa9b,null));};exports['removeTags']=function(_0x14e181,_0x267942){return db[_0x0e7b('0x1e')][_0x0e7b('0x34')]({'where':{'id':_0x14e181[_0x0e7b('0x27')]['id']}})[_0x0e7b('0x18')](handleEntityNotFound(_0x267942,null))['then'](function(_0x387473){if(_0x387473){return _0x387473['removeTags'](_0x14e181[_0x0e7b('0x23')][_0x0e7b('0x39')]);}})['then'](respondWithStatusCode(_0x267942,null))[_0x0e7b('0x25')](handleError(_0x267942,null));};exports[_0x0e7b('0x49')]=function(_0x4b2475,_0x536bc9){var _0x54c847=moment()[_0x0e7b('0x4a')]()[_0x0e7b('0x4b')]();var _0x3a8d0e=path[_0x0e7b('0x4c')](config[_0x0e7b('0x4d')],'server',_0x0e7b('0x4e'),'tmp');var _0x4fc8be=path[_0x0e7b('0x4c')](config[_0x0e7b('0x4d')],_0x0e7b('0x4f'),'files',_0x0e7b('0x50'));var _0x3cb8de=path['join'](_0x3a8d0e,_0x54c847);var _0x1576d1=util[_0x0e7b('0x51')](_0x0e7b('0x52'),_0x4b2475[_0x0e7b('0x27')]['id'],_0x54c847);var _0x1aa0a2=path[_0x0e7b('0x4c')](_0x3a8d0e,_0x1576d1);var _0x2ceeb5=[];_0x2ceeb5[_0x0e7b('0x53')]({'model':db[_0x0e7b('0x54')],'as':'Attachment','raw':!![]});var _0x1f0522=[{'model':db[_0x0e7b('0x36')],'as':_0x0e7b('0x55'),'attributes':['id',_0x0e7b('0x33'),'createdAt'],'include':_0x2ceeb5}];return db[_0x0e7b('0x1e')]['find']({'where':{'id':_0x4b2475['params']['id']},'include':_0x1f0522})[_0x0e7b('0x18')](handleEntityNotFound(_0x536bc9,null))[_0x0e7b('0x18')](function(_0x57d026){if(_0x57d026&&_0x57d026[_0x0e7b('0x55')]){var _0x1262f4=_0x57d026['get']({'plain':!![]});fs[_0x0e7b('0x56')](_0x3cb8de);for(var _0x26a2e5=0x0;_0x26a2e5<_0x1262f4[_0x0e7b('0x55')][_0x0e7b('0x57')];_0x26a2e5++){var _0x40a603=_0x1262f4[_0x0e7b('0x55')][_0x26a2e5]['Attachment'];if(_0x40a603){var _0x1f987c=path[_0x0e7b('0x4c')](_0x4fc8be,_0x40a603[_0x0e7b('0x58')]);if(fs['existsSync'](_0x1f987c)){fs[_0x0e7b('0x59')](_0x1f987c)[_0x0e7b('0x5a')](fs['createWriteStream'](path['join'](_0x3cb8de,_0x40a603[_0x0e7b('0x58')])));}}}return BPromise[_0x0e7b('0x5b')]()[_0x0e7b('0x18')](function(){return new BPromise(function(_0x1e37d6,_0x46d0b6){zipdir(_0x3cb8de,{'saveTo':_0x1aa0a2},function(_0x13c494,_0x3c92ba){if(_0x13c494)return _0x46d0b6(_0x13c494);return _0x1e37d6(_0x3c92ba);});})[_0x0e7b('0x18')](function(){return new BPromise(function(_0x4e93fd,_0x41e8e9){rimraf(_0x3cb8de,function(_0x41da41){if(_0x41da41)_0x41e8e9(_0x41da41);return _0x4e93fd();});});})[_0x0e7b('0x18')](function(){return _0x536bc9[_0x0e7b('0x49')](_0x1aa0a2,_0x1576d1,function(_0x240b5c){if(_0x240b5c){console['log']('err',_0x240b5c);}else{fs[_0x0e7b('0x5c')](_0x1aa0a2);}});});});}else{return _0x536bc9[_0x0e7b('0xf')](0xc8);}})[_0x0e7b('0x25')](handleError(_0x536bc9,null));}; \ No newline at end of file +var _0x319f=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','findAll','fax','user','show','params','keys','intersection','model','query','attributes','fields','length','include','merge','options','find','catch','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','filters','nolimit','order','sort','pick','FaxInteractionId','filter','where','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','setTags','spread','Tag','color','removeTags','unix','toString','join','root','server','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','resolve','download','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x380ca7,_0x224e7d){var _0xa9ec98=function(_0x385a12){while(--_0x385a12){_0x380ca7['push'](_0x380ca7['shift']());}};_0xa9ec98(++_0x224e7d);}(_0x319f,0x135));var _0xf319=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x319f[_0x14add3];return _0x4a174f;};'use strict';var rimraf=require(_0xf319('0x0'));var zipdir=require(_0xf319('0x1'));var moment=require(_0xf319('0x2'));var BPromise=require(_0xf319('0x3'));var util=require(_0xf319('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xf319('0x5'));var Redis=require(_0xf319('0x6'));var interaction=require(_0xf319('0x7'));var qs=require(_0xf319('0x8'));var logger=require(_0xf319('0x9'))(_0xf319('0xa'));var config=require(_0xf319('0xb'));var db=require(_0xf319('0xc'))['db'];config[_0xf319('0xd')]=_[_0xf319('0xe')](config[_0xf319('0xd')],{'host':_0xf319('0xf'),'port':0x18eb});var socket=require(_0xf319('0x10'))(new Redis(config[_0xf319('0xd')]));require(_0xf319('0x11'))[_0xf319('0x12')](socket);function respondWithStatusCode(_0x3df8be,_0x10ace1){_0x10ace1=_0x10ace1||0xcc;return function(_0x23bb34){if(_0x23bb34){return _0x3df8be[_0xf319('0x13')](_0x10ace1);}return _0x3df8be[_0xf319('0x14')](_0x10ace1)[_0xf319('0x15')]();};}function respondWithResult(_0x18fd22,_0x33b1f0){_0x33b1f0=_0x33b1f0||0xc8;return function(_0x3aec57){if(_0x3aec57){return _0x18fd22[_0xf319('0x14')](_0x33b1f0)[_0xf319('0x16')](_0x3aec57);}};}function respondWithFilteredResult(_0x33e8e1,_0x3ae722){return function(_0x26e49a){if(_0x26e49a){var _0x25f976=typeof _0x3ae722[_0xf319('0x17')]==='undefined'&&typeof _0x3ae722[_0xf319('0x18')]===_0xf319('0x19');var _0x2c76f4=_0x26e49a['count'];var _0x48bbdf=_0x25f976?0x0:_0x3ae722[_0xf319('0x17')];var _0x4e20e8=_0x25f976?_0x26e49a[_0xf319('0x1a')]:_0x3ae722[_0xf319('0x17')]+_0x3ae722[_0xf319('0x18')];var _0x9066c1;if(_0x4e20e8>=_0x2c76f4){_0x4e20e8=_0x2c76f4;_0x9066c1=0xc8;}else{_0x9066c1=0xce;}_0x33e8e1[_0xf319('0x14')](_0x9066c1);return _0x33e8e1[_0xf319('0x1b')](_0xf319('0x1c'),_0x48bbdf+'-'+_0x4e20e8+'/'+_0x2c76f4)[_0xf319('0x16')](_0x26e49a);}return null;};}function saveUpdates(_0x374015){return function(_0x399a5c){if(_0x399a5c){return _0x399a5c[_0xf319('0x1d')](_0x374015)[_0xf319('0x1e')](function(_0x48b8e1){return _0x48b8e1;});}return null;};}function removeEntity(_0x112e36){return function(_0x3e34fe){if(_0x3e34fe){return _0x3e34fe[_0xf319('0x1f')]()['then'](function(){_0x112e36[_0xf319('0x14')](0xcc)[_0xf319('0x15')]();});}};}function handleEntityNotFound(_0x2e7625){return function(_0x59d809){if(!_0x59d809){_0x2e7625[_0xf319('0x13')](0x194);}return _0x59d809;};}function handleError(_0x576157,_0xc08ac9){_0xc08ac9=_0xc08ac9||0x1f4;return function(_0x417573){logger[_0xf319('0x20')](_0x417573[_0xf319('0x21')]);if(_0x417573[_0xf319('0x22')]){delete _0x417573['name'];}_0x576157['status'](_0xc08ac9)[_0xf319('0x23')](_0x417573);};}exports[_0xf319('0x24')]=function(_0x3b9ff2,_0x5e7584){var _0x57ae69={};var _0x3f9cde=_[_0xf319('0x25')](db[_0xf319('0x26')][_0xf319('0x27')],function(_0x4eee9d){return{'name':_0x4eee9d[_0xf319('0x28')],'type':_0x4eee9d[_0xf319('0x29')][_0xf319('0x2a')]};});_0x57ae69=qs['getOptions'](_0x3f9cde,_0x3b9ff2);return interaction[_0xf319('0x2b')](_0xf319('0x2c'),_0x3b9ff2['query'],_0x3b9ff2[_0xf319('0x2d')],_0x57ae69,_0x3f9cde)[_0xf319('0x1e')](respondWithFilteredResult(_0x5e7584,_0x57ae69))['catch'](handleError(_0x5e7584,null));};exports[_0xf319('0x2e')]=function(_0x560619,_0x46bb95){var _0x4cc4c7={'raw':![],'where':{'id':_0x560619[_0xf319('0x2f')]['id']}},_0x547b80={};_0x547b80['model']=_[_0xf319('0x30')](db['FaxInteraction']['rawAttributes']);_0x547b80['query']=_[_0xf319('0x30')](_0x560619['query']);_0x547b80['filters']=_[_0xf319('0x31')](_0x547b80[_0xf319('0x32')],_0x547b80[_0xf319('0x33')]);_0x4cc4c7[_0xf319('0x34')]=_[_0xf319('0x31')](_0x547b80[_0xf319('0x32')],qs[_0xf319('0x35')](_0x560619[_0xf319('0x33')]['fields']));_0x4cc4c7[_0xf319('0x34')]=_0x4cc4c7['attributes'][_0xf319('0x36')]?_0x4cc4c7[_0xf319('0x34')]:_0x547b80['model'];if(_0x560619[_0xf319('0x33')]['includeAll']){_0x4cc4c7[_0xf319('0x37')]=[{'all':!![]}];}_0x4cc4c7=_[_0xf319('0x38')]({},_0x4cc4c7,_0x560619[_0xf319('0x39')]);return db[_0xf319('0x26')][_0xf319('0x3a')](_0x4cc4c7)[_0xf319('0x1e')](handleEntityNotFound(_0x46bb95,null))[_0xf319('0x1e')](respondWithResult(_0x46bb95,null))[_0xf319('0x3b')](handleError(_0x46bb95,null));};exports[_0xf319('0x3c')]=function(_0x31ac3b,_0x5874a8){return db['FaxInteraction'][_0xf319('0x3c')](_0x31ac3b[_0xf319('0x3d')],{})[_0xf319('0x1e')](respondWithResult(_0x5874a8,0xc9))[_0xf319('0x3b')](handleError(_0x5874a8,null));};exports['update']=function(_0x3451bf,_0xe0b7b6){if(_0x3451bf[_0xf319('0x3d')]['id']){delete _0x3451bf[_0xf319('0x3d')]['id'];}return db[_0xf319('0x26')][_0xf319('0x3a')]({'where':{'id':_0x3451bf[_0xf319('0x2f')]['id']}})[_0xf319('0x1e')](handleEntityNotFound(_0xe0b7b6,null))[_0xf319('0x1e')](saveUpdates(_0x3451bf['body'],null))[_0xf319('0x1e')](respondWithResult(_0xe0b7b6,null))['catch'](handleError(_0xe0b7b6,null));};exports[_0xf319('0x1f')]=function(_0x342169,_0x10a431){return db['FaxInteraction'][_0xf319('0x3a')]({'where':{'id':_0x342169[_0xf319('0x2f')]['id']}})['then'](handleEntityNotFound(_0x10a431,null))[_0xf319('0x1e')](removeEntity(_0x10a431,null))[_0xf319('0x3b')](handleError(_0x10a431,null));};exports[_0xf319('0x3e')]=function(_0x4d1e58,_0x42c9d1){return db[_0xf319('0x26')][_0xf319('0x3e')]()['then'](respondWithResult(_0x42c9d1,null))[_0xf319('0x3b')](handleError(_0x42c9d1,null));};exports[_0xf319('0x3f')]=function(_0x2d9da0,_0x37d6c5){return db[_0xf319('0x40')]['find']({'where':{'id':_0x2d9da0[_0xf319('0x2f')]['id']}})['then'](handleEntityNotFound(_0x37d6c5,null))[_0xf319('0x1e')](function(_0x3a5fa1){if(_0x3a5fa1){return _0x3a5fa1[_0xf319('0x3f')](_0x2d9da0[_0xf319('0x3d')][_0xf319('0x41')],_[_0xf319('0x42')](_0x2d9da0[_0xf319('0x3d')],['ids','id'])||{});}})['then'](respondWithResult(_0x37d6c5,null))[_0xf319('0x3b')](handleError(_0x37d6c5,null));};exports[_0xf319('0x43')]=function(_0x369982,_0x2b15b9){var _0x4a5ac9={'raw':![],'where':{}};var _0x1e46ad={};var _0x2c12f8={'count':0x0,'rows':[]};return db[_0xf319('0x26')][_0xf319('0x44')]({'where':{'id':_0x369982[_0xf319('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2b15b9,null))[_0xf319('0x1e')](function(_0x35a4d4){if(_0x35a4d4){_0x1e46ad['model']=_[_0xf319('0x30')](db[_0xf319('0x40')][_0xf319('0x27')]);_0x1e46ad[_0xf319('0x33')]=_['keys'](_0x369982[_0xf319('0x33')]);_0x1e46ad[_0xf319('0x45')]=_[_0xf319('0x31')](_0x1e46ad[_0xf319('0x32')],_0x1e46ad[_0xf319('0x33')]);_0x4a5ac9[_0xf319('0x34')]=_[_0xf319('0x31')](_0x1e46ad['model'],qs[_0xf319('0x35')](_0x369982[_0xf319('0x33')][_0xf319('0x35')]));_0x4a5ac9[_0xf319('0x34')]=_0x4a5ac9['attributes'][_0xf319('0x36')]?_0x4a5ac9[_0xf319('0x34')]:_0x1e46ad[_0xf319('0x32')];if(!_0x369982['query']['hasOwnProperty'](_0xf319('0x46'))){_0x4a5ac9['limit']=qs['limit'](_0x369982[_0xf319('0x33')][_0xf319('0x18')]);_0x4a5ac9[_0xf319('0x17')]=qs[_0xf319('0x17')](_0x369982[_0xf319('0x33')]['offset']);}_0x4a5ac9[_0xf319('0x47')]=qs[_0xf319('0x48')](_0x369982[_0xf319('0x33')][_0xf319('0x48')]);_0x4a5ac9['where']=qs['filters'](_[_0xf319('0x49')](_0x369982[_0xf319('0x33')],_0x1e46ad[_0xf319('0x45')]));_0x4a5ac9['where'][_0xf319('0x4a')]=_0x35a4d4['id'];if(_0x369982['query'][_0xf319('0x4b')]){_0x4a5ac9[_0xf319('0x4c')]=_[_0xf319('0x38')](_0x4a5ac9[_0xf319('0x4c')],{'$or':_[_0xf319('0x25')](_0x4a5ac9[_0xf319('0x34')],function(_0x5d21de){var _0x18b6ee={};_0x18b6ee[_0x5d21de]={'$like':'%'+_0x369982['query'][_0xf319('0x4b')]+'%'};return _0x18b6ee;})});}if(_0x369982[_0xf319('0x33')][_0xf319('0x4d')]){var _0x492e67=_0x369982[_0xf319('0x33')]['$gte']['split'](',');var _0x18b758={};_0x18b758[_0x492e67[0x0]]={'$gte':moment(_0x492e67[0x1])[_0xf319('0x4e')](_0xf319('0x4f'))};_0x4a5ac9[_0xf319('0x4c')]=_[_0xf319('0x38')](_0x4a5ac9[_0xf319('0x4c')],_0x18b758);}_0x4a5ac9=_[_0xf319('0x38')]({},_0x4a5ac9,_0x369982[_0xf319('0x39')]);return db[_0xf319('0x40')][_0xf319('0x1a')]({'where':_0x4a5ac9['where']})[_0xf319('0x1e')](function(_0x2470b7){_0x2c12f8[_0xf319('0x1a')]=_0x2470b7;if(_0x369982[_0xf319('0x33')][_0xf319('0x50')]){_0x4a5ac9[_0xf319('0x37')]=[{'all':!![]}];}return db[_0xf319('0x40')]['findAll'](_0x4a5ac9);})[_0xf319('0x1e')](function(_0x268d2d){_0x2c12f8[_0xf319('0x51')]=_0x268d2d;return _0x2c12f8;});}})[_0xf319('0x1e')](respondWithFilteredResult(_0x2b15b9,_0x4a5ac9))[_0xf319('0x3b')](handleError(_0x2b15b9,null));};exports['addTags']=function(_0x53793f,_0x4b69ca){return db[_0xf319('0x26')][_0xf319('0x3a')]({'where':{'id':_0x53793f[_0xf319('0x2f')]['id']}})[_0xf319('0x1e')](handleEntityNotFound(_0x4b69ca,null))[_0xf319('0x1e')](function(_0x59331e){if(_0x59331e){return _0x59331e[_0xf319('0x52')](_0x53793f[_0xf319('0x3d')][_0xf319('0x41')],_[_0xf319('0x42')](_0x53793f[_0xf319('0x3d')],['ids','id'])||{})[_0xf319('0x53')](function(){return db[_0xf319('0x54')][_0xf319('0x2b')]({'attributes':['id',_0xf319('0x22'),_0xf319('0x55')],'where':{'id':_0x53793f[_0xf319('0x3d')][_0xf319('0x41')]}});})[_0xf319('0x1e')](function(_0x2a551b){socket['emit']('faxInteractionTags:save',{'id':Number(_0x53793f[_0xf319('0x2f')]['id']),'tags':_0x2a551b||[]});return{'id':Number(_0x53793f[_0xf319('0x2f')]['id']),'tags':_0x2a551b||[]};});}})[_0xf319('0x1e')](respondWithResult(_0x4b69ca,null))[_0xf319('0x3b')](handleError(_0x4b69ca,null));};exports[_0xf319('0x56')]=function(_0x103550,_0x56fffa){return db[_0xf319('0x26')][_0xf319('0x3a')]({'where':{'id':_0x103550['params']['id']}})[_0xf319('0x1e')](handleEntityNotFound(_0x56fffa,null))['then'](function(_0x583f0a){if(_0x583f0a){return _0x583f0a['removeTags'](_0x103550[_0xf319('0x33')]['ids']);}})[_0xf319('0x1e')](respondWithStatusCode(_0x56fffa,null))[_0xf319('0x3b')](handleError(_0x56fffa,null));};exports['download']=function(_0x56366e,_0x5595df){var _0x761607=moment()[_0xf319('0x57')]()[_0xf319('0x58')]();var _0xec578a=path[_0xf319('0x59')](config[_0xf319('0x5a')],_0xf319('0x5b'),'files','tmp');var _0x348c2d=path[_0xf319('0x59')](config[_0xf319('0x5a')],_0xf319('0x5b'),'files','attachments');var _0x568fdb=path[_0xf319('0x59')](_0xec578a,_0x761607);var _0x5ea5b4=util[_0xf319('0x4e')](_0xf319('0x5c'),_0x56366e[_0xf319('0x2f')]['id'],_0x761607);var _0x4b37b8=path[_0xf319('0x59')](_0xec578a,_0x5ea5b4);var _0x47cafb=[];_0x47cafb[_0xf319('0x5d')]({'model':db[_0xf319('0x5e')],'as':_0xf319('0x5e'),'raw':!![]});var _0x1324ba=[{'model':db[_0xf319('0x40')],'as':_0xf319('0x5f'),'attributes':['id',_0xf319('0x3d'),_0xf319('0x60')],'include':_0x47cafb}];return db[_0xf319('0x26')][_0xf319('0x3a')]({'where':{'id':_0x56366e[_0xf319('0x2f')]['id']},'include':_0x1324ba})[_0xf319('0x1e')](handleEntityNotFound(_0x5595df,null))[_0xf319('0x1e')](function(_0x585750){if(_0x585750&&_0x585750[_0xf319('0x5f')]){var _0xb85f19=_0x585750[_0xf319('0x61')]({'plain':!![]});fs[_0xf319('0x62')](_0x568fdb);for(var _0x29f934=0x0;_0x29f934<_0xb85f19[_0xf319('0x5f')][_0xf319('0x36')];_0x29f934++){var _0x4328ef=_0xb85f19[_0xf319('0x5f')][_0x29f934][_0xf319('0x5e')];if(_0x4328ef){var _0xe860c2=path[_0xf319('0x59')](_0x348c2d,_0x4328ef[_0xf319('0x63')]);if(fs[_0xf319('0x64')](_0xe860c2)){fs[_0xf319('0x65')](_0xe860c2)[_0xf319('0x66')](fs['createWriteStream'](path[_0xf319('0x59')](_0x568fdb,_0x4328ef[_0xf319('0x63')])));}}}return BPromise[_0xf319('0x67')]()[_0xf319('0x1e')](function(){return new BPromise(function(_0x13a4e8,_0x496d2a){zipdir(_0x568fdb,{'saveTo':_0x4b37b8},function(_0x1cb58c,_0x4a7b96){if(_0x1cb58c)return _0x496d2a(_0x1cb58c);return _0x13a4e8(_0x4a7b96);});})['then'](function(){return new BPromise(function(_0x1f25ab,_0x1aedd4){rimraf(_0x568fdb,function(_0x21f4b9){if(_0x21f4b9)_0x1aedd4(_0x21f4b9);return _0x1f25ab();});});})[_0xf319('0x1e')](function(){return _0x5595df[_0xf319('0x68')](_0x4b37b8,_0x5ea5b4,function(_0x424c22){if(_0x424c22){console['log'](_0xf319('0x69'),_0x424c22);}else{fs[_0xf319('0x6a')](_0x4b37b8);}});});});}else{return _0x5595df['sendStatus'](0xc8);}})[_0xf319('0x3b')](handleError(_0x5595df,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 4ee00b4..e7453ca 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 _0x7dca=['FaxMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x7dca,0x12d));var _0xa7dc=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x7dca[_0x382a62];return _0x490a25;};'use strict';var EventEmitter=require(_0xa7dc('0x0'));var FaxInteraction=require(_0xa7dc('0x1'))['db'][_0xa7dc('0x2')];var FaxMessage=require(_0xa7dc('0x1'))['db'][_0xa7dc('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xa7dc('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa7dc('0x5'),'afterDestroy':_0xa7dc('0x6')};function emitEvent(_0x302fd3){return function(_0x37752e,_0x1711b0,_0x38342b){_0x37752e[_0xa7dc('0x7')]({'attributes':['id'],'raw':!![]})[_0xa7dc('0x8')](function(_0x103d7c){_0x37752e[_0xa7dc('0x9')](_0xa7dc('0xa'),_0x103d7c[_0xa7dc('0xb')](function(_0x3659da){return{'id':_0x3659da['id']};}));return FaxMessage[_0xa7dc('0xc')]({'where':{'FaxInteractionId':_0x37752e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5f2896){_0x37752e[_0xa7dc('0x9')](_0xa7dc('0xd'),_0x5f2896[_0xa7dc('0xe')]);FaxInteractionEvents[_0xa7dc('0xf')](_0x302fd3+':'+_0x37752e['id'],_0x37752e);FaxInteractionEvents[_0xa7dc('0xf')](_0x302fd3,_0x37752e);_0x38342b(null);})['catch'](_0x38342b(null));};}for(var e in events){if(events[_0xa7dc('0x10')](e)){var event=events[e];FaxInteraction[_0xa7dc('0x11')](e,emitEvent(event));}}module[_0xa7dc('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0x30f7=['FaxInteraction','FaxMessage','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3bf1e8,_0x4c0fdf){var _0x5e3c29=function(_0x5d56cf){while(--_0x5d56cf){_0x3bf1e8['push'](_0x3bf1e8['shift']());}};_0x5e3c29(++_0x4c0fdf);}(_0x30f7,0xba));var _0x730f=function(_0x4526b8,_0x16d4fc){_0x4526b8=_0x4526b8-0x0;var _0x5d1257=_0x30f7[_0x4526b8];return _0x5d1257;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x730f('0x0'))['db'][_0x730f('0x1')];var FaxMessage=require(_0x730f('0x0'))['db'][_0x730f('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x730f('0x3'),'afterDestroy':_0x730f('0x4')};function emitEvent(_0x30633f){return function(_0x1fd6cd,_0x3c1faa,_0x2eccb9){_0x1fd6cd[_0x730f('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x127669){_0x1fd6cd[_0x730f('0x6')](_0x730f('0x7'),_0x127669[_0x730f('0x8')](function(_0x372c44){return{'id':_0x372c44['id']};}));return FaxMessage[_0x730f('0x9')]({'where':{'FaxInteractionId':_0x1fd6cd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x730f('0xa')](function(_0x549207){_0x1fd6cd[_0x730f('0x6')](_0x730f('0xb'),_0x549207[_0x730f('0xc')]);FaxInteractionEvents[_0x730f('0xd')](_0x30633f+':'+_0x1fd6cd['id'],_0x1fd6cd);FaxInteractionEvents[_0x730f('0xd')](_0x30633f,_0x1fd6cd);_0x2eccb9(null);})['catch'](_0x2eccb9(null));};}for(var e in events){if(events[_0x730f('0xe')](e)){var event=events[e];FaxInteraction[_0x730f('0xf')](e,emitEvent(event));}}module[_0x730f('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 15eb00e..16a7cef 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 _0xdbdf=['format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','fax_interactions','changed','closed','closedAt'];(function(_0x2dd2d3,_0x6befa3){var _0x4d0727=function(_0x1e0451){while(--_0x1e0451){_0x2dd2d3['push'](_0x2dd2d3['shift']());}};_0x4d0727(++_0x6befa3);}(_0xdbdf,0xf1));var _0xfdbd=function(_0x5cf8ff,_0x5e8627){_0x5cf8ff=_0x5cf8ff-0x0;var _0x2c37e6=_0xdbdf[_0x5cf8ff];return _0x2c37e6;};'use strict';var _=require(_0xfdbd('0x0'));var util=require(_0xfdbd('0x1'));var logger=require('../../config/logger')(_0xfdbd('0x2'));var moment=require(_0xfdbd('0x3'));var BPromise=require(_0xfdbd('0x4'));var rp=require(_0xfdbd('0x5'));var fs=require('fs');var path=require(_0xfdbd('0x6'));var rimraf=require(_0xfdbd('0x7'));var config=require(_0xfdbd('0x8'));var attributes=require(_0xfdbd('0x9'));module['exports']=function(_0x39abb2,_0x3759c0){return _0x39abb2[_0xfdbd('0xa')]('FaxInteraction',attributes,{'tableName':_0xfdbd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a45de,_0x39ec3b,_0x31f3ec){if(_0x1a45de[_0xfdbd('0xc')](_0xfdbd('0xd'))){_0x1a45de[_0xfdbd('0xe')]=moment()[_0xfdbd('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x31f3ec(null,_0x1a45de);}}});}; \ No newline at end of file +var _0x9a0a=['moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','format','lodash','util','../../config/logger','api'];(function(_0x50feaf,_0x261249){var _0x3c2c7f=function(_0xdfd2fe){while(--_0xdfd2fe){_0x50feaf['push'](_0x50feaf['shift']());}};_0x3c2c7f(++_0x261249);}(_0x9a0a,0x7c));var _0xa9a0=function(_0x1e998a,_0x3ac3a){_0x1e998a=_0x1e998a-0x0;var _0x8b604f=_0x9a0a[_0x1e998a];return _0x8b604f;};'use strict';var _=require(_0xa9a0('0x0'));var util=require(_0xa9a0('0x1'));var logger=require(_0xa9a0('0x2'))(_0xa9a0('0x3'));var moment=require(_0xa9a0('0x4'));var BPromise=require(_0xa9a0('0x5'));var rp=require(_0xa9a0('0x6'));var fs=require('fs');var path=require(_0xa9a0('0x7'));var rimraf=require(_0xa9a0('0x8'));var config=require('../../config/environment');var attributes=require(_0xa9a0('0x9'));module[_0xa9a0('0xa')]=function(_0x181695,_0x208d5c){return _0x181695[_0xa9a0('0xb')](_0xa9a0('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13b1c0,_0xbd243b,_0x1dc063){if(_0x13b1c0[_0xa9a0('0xd')](_0xa9a0('0xe'))){_0x13b1c0['closedAt']=moment()[_0xa9a0('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1dc063(null,_0x13b1c0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 63c0bbe..2dd2e01 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 _0xcaac=['ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','AddTags','catch','lodash','util','moment','randomstring'];(function(_0x1ee0c3,_0x5ea02d){var _0x5dc292=function(_0x5c7bf0){while(--_0x5c7bf0){_0x1ee0c3['push'](_0x1ee0c3['shift']());}};_0x5dc292(++_0x5ea02d);}(_0xcaac,0x196));var _0xccaa=function(_0x533eaf,_0x3f4ec1){_0x533eaf=_0x533eaf-0x0;var _0x409631=_0xcaac[_0x533eaf];return _0x409631;};'use strict';var _=require(_0xccaa('0x0'));var util=require(_0xccaa('0x1'));var moment=require(_0xccaa('0x2'));var BPromise=require('bluebird');var rs=require(_0xccaa('0x3'));var fs=require('fs');var Redis=require(_0xccaa('0x4'));var db=require(_0xccaa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xccaa('0x6'))('rpc');var config=require(_0xccaa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xccaa('0x8')][_0xccaa('0x9')]({'port':0x232a});config['redis']=_[_0xccaa('0xa')](config['redis'],{'host':_0xccaa('0xb'),'port':0x18eb});var socket=require(_0xccaa('0xc'))(new Redis(config[_0xccaa('0xd')]));require(_0xccaa('0xe'))[_0xccaa('0xf')](socket);function respondWithRpcPromise(_0x398e5f,_0x4610c0,_0xc023b6){return new BPromise(function(_0x33985b,_0x11148a){return client[_0xccaa('0x10')](_0x398e5f,_0xc023b6)[_0xccaa('0x11')](function(_0x190ce1){logger[_0xccaa('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x4610c0,_0xccaa('0x13'));logger[_0xccaa('0x14')](_0xccaa('0x15'),_0x4610c0,_0xccaa('0x13'),JSON[_0xccaa('0x16')](_0x190ce1));if(_0x190ce1[_0xccaa('0x17')]){if(_0x190ce1[_0xccaa('0x17')][_0xccaa('0x18')]===0x1f4){logger[_0xccaa('0x17')](_0xccaa('0x19'),_0x4610c0,_0x190ce1['error'][_0xccaa('0x1a')]);return _0x11148a(_0x190ce1[_0xccaa('0x17')][_0xccaa('0x1a')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4610c0,_0x190ce1[_0xccaa('0x17')][_0xccaa('0x1a')]);return _0x33985b(_0x190ce1[_0xccaa('0x17')][_0xccaa('0x1a')]);}else{logger[_0xccaa('0x12')](_0xccaa('0x19'),_0x4610c0,_0xccaa('0x13'));_0x33985b(_0x190ce1['result'][_0xccaa('0x1a')]);}})['catch'](function(_0x4dc707){logger['error'](_0xccaa('0x19'),_0x4610c0,_0x4dc707);_0x11148a(_0x4dc707);});});}exports[_0xccaa('0x1b')]=function(_0x3d433b){var _0x650ba6=this;return new Promise(function(_0x4541c6,_0x175a1b){return db[_0xccaa('0x1c')][_0xccaa('0x1d')](_0x3d433b[_0xccaa('0x1e')],{'raw':_0x3d433b['options']?_0x3d433b[_0xccaa('0x1f')][_0xccaa('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d433b[_0xccaa('0x1f')]?_0x3d433b[_0xccaa('0x1f')][_0xccaa('0x21')]||null:null,'attributes':_0x3d433b[_0xccaa('0x1f')]?_0x3d433b[_0xccaa('0x1f')][_0xccaa('0x22')]||null:null,'limit':_0x3d433b['options']?_0x3d433b['options'][_0xccaa('0x23')]||null:null})[_0xccaa('0x11')](function(_0x5939cb){logger[_0xccaa('0x12')]('UpdateFaxInteraction',_0x3d433b);logger['debug'](_0xccaa('0x1b'),_0x3d433b,JSON['stringify'](_0x5939cb));_0x4541c6(_0x5939cb);})['catch'](function(_0x5d5084){logger[_0xccaa('0x17')]('UpdateFaxInteraction',_0x5d5084['message'],_0x3d433b);_0x175a1b(_0x650ba6['error'](0x1f4,_0x5d5084[_0xccaa('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0xc71604){return new Promise(function(_0x1cbceb,_0x3ea43e){return db[_0xccaa('0x1c')][_0xccaa('0x24')]({'where':_0xc71604['options']?_0xc71604[_0xccaa('0x1f')][_0xccaa('0x21')]||null:null})[_0xccaa('0x11')](function(_0xeb655c){if(_0xeb655c){return _0xeb655c[_0xccaa('0x25')](_0xc71604['body'][_0xccaa('0x26')],_['omit'](_0xc71604[_0xccaa('0x1e')],[_0xccaa('0x26'),'id'])||{});}})['spread'](function(_0x2a6f84){logger[_0xccaa('0x12')](_0xccaa('0x27'),_0xc71604);logger[_0xccaa('0x14')]('AddTags',_0xc71604,JSON[_0xccaa('0x16')](_0x2a6f84));_0x1cbceb(_0x2a6f84);})[_0xccaa('0x28')](function(_0x268a2f){logger[_0xccaa('0x17')](_0xccaa('0x27'),_0x268a2f['message'],_0xc71604);_0x3ea43e(_this[_0xccaa('0x17')](0x1f4,_0x268a2f[_0xccaa('0x1a')]));});});}; \ No newline at end of file +var _0xc29a=['AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','FaxInteraction','body','options','where','attributes','then','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','find','ids'];(function(_0x39b55a,_0x342d1c){var _0x384124=function(_0x5f2506){while(--_0x5f2506){_0x39b55a['push'](_0x39b55a['shift']());}};_0x384124(++_0x342d1c);}(_0xc29a,0xce));var _0xac29=function(_0x16021d,_0x207219){_0x16021d=_0x16021d-0x0;var _0x56e4dd=_0xc29a[_0x16021d];return _0x56e4dd;};'use strict';var _=require(_0xac29('0x0'));var util=require(_0xac29('0x1'));var moment=require(_0xac29('0x2'));var BPromise=require(_0xac29('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac29('0x4'));var db=require(_0xac29('0x5'))['db'];var utils=require(_0xac29('0x6'));var logger=require(_0xac29('0x7'))('rpc');var config=require(_0xac29('0x8'));var jayson=require(_0xac29('0x9'));var client=jayson[_0xac29('0xa')][_0xac29('0xb')]({'port':0x232a});config[_0xac29('0xc')]=_[_0xac29('0xd')](config[_0xac29('0xc')],{'host':_0xac29('0xe'),'port':0x18eb});var socket=require(_0xac29('0xf'))(new Redis(config[_0xac29('0xc')]));require(_0xac29('0x10'))[_0xac29('0x11')](socket);function respondWithRpcPromise(_0x344c50,_0x111804,_0x200bbb){return new BPromise(function(_0xf4e62b,_0x3e0d1e){return client[_0xac29('0x12')](_0x344c50,_0x200bbb)['then'](function(_0x31d745){logger[_0xac29('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x111804,'request\x20sent');logger[_0xac29('0x14')](_0xac29('0x15'),_0x111804,_0xac29('0x16'),JSON[_0xac29('0x17')](_0x31d745));if(_0x31d745[_0xac29('0x18')]){if(_0x31d745[_0xac29('0x18')][_0xac29('0x19')]===0x1f4){logger[_0xac29('0x18')](_0xac29('0x1a'),_0x111804,_0x31d745['error'][_0xac29('0x1b')]);return _0x3e0d1e(_0x31d745['error'][_0xac29('0x1b')]);}logger[_0xac29('0x18')](_0xac29('0x1a'),_0x111804,_0x31d745['error']['message']);return _0xf4e62b(_0x31d745['error']['message']);}else{logger[_0xac29('0x13')](_0xac29('0x1a'),_0x111804,_0xac29('0x16'));_0xf4e62b(_0x31d745[_0xac29('0x1c')]['message']);}})['catch'](function(_0x4597c4){logger[_0xac29('0x18')](_0xac29('0x1a'),_0x111804,_0x4597c4);_0x3e0d1e(_0x4597c4);});});}exports['UpdateFaxInteraction']=function(_0xaffccf){var _0x541744=this;return new Promise(function(_0x55e687,_0x20d21d){return db[_0xac29('0x1d')]['update'](_0xaffccf[_0xac29('0x1e')],{'raw':_0xaffccf[_0xac29('0x1f')]?_0xaffccf['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaffccf[_0xac29('0x1f')]?_0xaffccf[_0xac29('0x1f')][_0xac29('0x20')]||null:null,'attributes':_0xaffccf['options']?_0xaffccf[_0xac29('0x1f')][_0xac29('0x21')]||null:null,'limit':_0xaffccf[_0xac29('0x1f')]?_0xaffccf[_0xac29('0x1f')]['limit']||null:null})[_0xac29('0x22')](function(_0x131486){logger[_0xac29('0x13')](_0xac29('0x23'),_0xaffccf);logger[_0xac29('0x14')](_0xac29('0x23'),_0xaffccf,JSON['stringify'](_0x131486));_0x55e687(_0x131486);})[_0xac29('0x24')](function(_0x49bb4b){logger['error'](_0xac29('0x23'),_0x49bb4b[_0xac29('0x1b')],_0xaffccf);_0x20d21d(_0x541744[_0xac29('0x18')](0x1f4,_0x49bb4b[_0xac29('0x1b')]));});});};exports[_0xac29('0x25')]=function(_0x2be875){return new Promise(function(_0x2bcd86,_0x3063d3){return db['FaxInteraction'][_0xac29('0x26')]({'where':_0x2be875[_0xac29('0x1f')]?_0x2be875[_0xac29('0x1f')]['where']||null:null})[_0xac29('0x22')](function(_0x13e803){if(_0x13e803){return _0x13e803['addTags'](_0x2be875[_0xac29('0x1e')][_0xac29('0x27')],_['omit'](_0x2be875[_0xac29('0x1e')],[_0xac29('0x27'),'id'])||{});}})['spread'](function(_0x393714){logger[_0xac29('0x13')](_0xac29('0x28'),_0x2be875);logger[_0xac29('0x14')](_0xac29('0x28'),_0x2be875,JSON[_0xac29('0x17')](_0x393714));_0x2bcd86(_0x393714);})[_0xac29('0x24')](function(_0x4079d2){logger[_0xac29('0x18')](_0xac29('0x28'),_0x4079d2[_0xac29('0x1b')],_0x2be875);_0x3063d3(_this[_0xac29('0x18')](0x1f4,_0x4079d2['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 21e6a4e..f2b880b 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 _0x244c=['update','removeListener','register','faxInteraction:','save','remove'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x244c,0x7c));var _0xc244=function(_0x2c59f8,_0x248093){_0x2c59f8=_0x2c59f8-0x0;var _0x4c58b5=_0x244c[_0x2c59f8];return _0x4c58b5;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xc244('0x0'),_0xc244('0x1'),_0xc244('0x2')];function createListener(_0x3cf4d1,_0x12d78a){return function(_0x59518c){_0x12d78a['emit'](_0x3cf4d1,_0x59518c);};}function removeListener(_0x568210,_0x42e7dd){return function(){FaxInteractionEvents[_0xc244('0x3')](_0x568210,_0x42e7dd);};}exports[_0xc244('0x4')]=function(_0xeb20d4){for(var _0xa958c1=0x0,_0x278109=events['length'];_0xa958c1<_0x278109;_0xa958c1++){var _0x2b512d=events[_0xa958c1];var _0x430bcf=createListener(_0xc244('0x5')+_0x2b512d,_0xeb20d4);FaxInteractionEvents['on'](_0x2b512d,_0x430bcf);}}; \ No newline at end of file +var _0x006a=['save','remove','update','emit','removeListener','length'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x006a,0xfc));var _0xa006=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x006a[_0x210603];return _0x1bcb7d;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xa006('0x0'),_0xa006('0x1'),_0xa006('0x2')];function createListener(_0x1b0ebf,_0x1d797d){return function(_0x5a80d6){_0x1d797d[_0xa006('0x3')](_0x1b0ebf,_0x5a80d6);};}function removeListener(_0x257691,_0x4df144){return function(){FaxInteractionEvents[_0xa006('0x4')](_0x257691,_0x4df144);};}exports['register']=function(_0x18056b){for(var _0x51d35b=0x0,_0x2e2984=events[_0xa006('0x5')];_0x51d35b<_0x2e2984;_0x51d35b++){var _0x5419ea=events[_0x51d35b];var _0x35214f=createListener('faxInteraction:'+_0x5419ea,_0x18056b);FaxInteractionEvents['on'](_0x5419ea,_0x35214f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 607f48c..34676bd 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 _0x13a6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express'];(function(_0x17f7a3,_0x43bcd7){var _0x53700d=function(_0x4d763b){while(--_0x4d763b){_0x17f7a3['push'](_0x17f7a3['shift']());}};_0x53700d(++_0x43bcd7);}(_0x13a6,0x9c));var _0x613a=function(_0x5332b2,_0x5467e2){_0x5332b2=_0x5332b2-0x0;var _0xfbb04a=_0x13a6[_0x5332b2];return _0xfbb04a;};'use strict';var multer=require(_0x613a('0x0'));var util=require('util');var path=require(_0x613a('0x1'));var timeout=require(_0x613a('0x2'));var express=require(_0x613a('0x3'));var router=express[_0x613a('0x4')]();var fs_extra=require(_0x613a('0x5'));var auth=require(_0x613a('0x6'));var interaction=require(_0x613a('0x7'));var config=require(_0x613a('0x8'));var controller=require(_0x613a('0x9'));router[_0x613a('0xa')]('/',auth[_0x613a('0xb')](),controller[_0x613a('0xc')]);router[_0x613a('0xa')](_0x613a('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x613a('0xa')](_0x613a('0xe'),auth[_0x613a('0xb')](),controller[_0x613a('0xf')]);router['get'](_0x613a('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0x613a('0xa')](_0x613a('0x11'),auth['isAuthenticated'](),controller[_0x613a('0x12')]);router[_0x613a('0x13')]('/',auth['isAuthenticated'](),controller[_0x613a('0x14')]);router[_0x613a('0x13')]('/:id/messages',auth[_0x613a('0xb')](),controller['addMessage']);router['post'](_0x613a('0x15'),auth[_0x613a('0xb')](),interaction[_0x613a('0x16')](_0x613a('0x17'),_0x613a('0x18')),controller[_0x613a('0x19')]);router['put'](_0x613a('0xe'),auth[_0x613a('0xb')](),interaction[_0x613a('0x16')](_0x613a('0x17'),'faxinteraction:update'),controller[_0x613a('0x1a')]);router[_0x613a('0x1b')](_0x613a('0xe'),auth['isAuthenticated'](),interaction[_0x613a('0x16')](_0x613a('0x17'),_0x613a('0x1c')),controller[_0x613a('0x1d')]);router[_0x613a('0x1b')](_0x613a('0x15'),auth['isAuthenticated'](),controller[_0x613a('0x1e')]);module[_0x613a('0x1f')]=router; \ No newline at end of file +var _0x2159=['tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags'];(function(_0x5b642f,_0x2ac67d){var _0x1abe05=function(_0x4f946f){while(--_0x4f946f){_0x5b642f['push'](_0x5b642f['shift']());}};_0x1abe05(++_0x2ac67d);}(_0x2159,0x17f));var _0x9215=function(_0x5e48b4,_0x2e63f5){_0x5e48b4=_0x5e48b4-0x0;var _0x1c2cec=_0x2159[_0x5e48b4];return _0x1c2cec;};'use strict';var multer=require(_0x9215('0x0'));var util=require(_0x9215('0x1'));var path=require(_0x9215('0x2'));var timeout=require(_0x9215('0x3'));var express=require('express');var router=express[_0x9215('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9215('0x5'));var interaction=require(_0x9215('0x6'));var config=require(_0x9215('0x7'));var controller=require(_0x9215('0x8'));router[_0x9215('0x9')]('/',auth[_0x9215('0xa')](),controller[_0x9215('0xb')]);router[_0x9215('0x9')]('/describe',auth[_0x9215('0xa')](),controller[_0x9215('0xc')]);router[_0x9215('0x9')](_0x9215('0xd'),auth[_0x9215('0xa')](),controller['show']);router[_0x9215('0x9')](_0x9215('0xe'),auth[_0x9215('0xa')](),controller[_0x9215('0xf')]);router['get'](_0x9215('0x10'),auth[_0x9215('0xa')](),controller['download']);router[_0x9215('0x11')]('/',auth[_0x9215('0xa')](),controller['create']);router[_0x9215('0x11')](_0x9215('0xe'),auth['isAuthenticated'](),controller[_0x9215('0x12')]);router['post'](_0x9215('0x13'),auth['isAuthenticated'](),interaction[_0x9215('0x14')](_0x9215('0x15'),_0x9215('0x16')),controller[_0x9215('0x17')]);router['put'](_0x9215('0xd'),auth[_0x9215('0xa')](),interaction['tracked'](_0x9215('0x15'),_0x9215('0x18')),controller[_0x9215('0x19')]);router[_0x9215('0x1a')](_0x9215('0xd'),auth[_0x9215('0xa')](),interaction[_0x9215('0x14')]('fax',_0x9215('0x1b')),controller[_0x9215('0x1c')]);router[_0x9215('0x1a')](_0x9215('0x13'),auth[_0x9215('0xa')](),controller[_0x9215('0x1d')]);module[_0x9215('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 e790a0a..57b3e48 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 _0xe43c=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x51e3d9,_0x369a3b){var _0x39f88a=function(_0x3192cb){while(--_0x3192cb){_0x51e3d9['push'](_0x51e3d9['shift']());}};_0x39f88a(++_0x369a3b);}(_0xe43c,0x180));var _0xce43=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xe43c[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0xce43('0x0'));module[_0xce43('0x1')]={'body':{'type':Sequelize[_0xce43('0x2')](_0xce43('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xce43('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xce43('0x5')]('in','out'),'defaultValue':_0xce43('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xce43('0x7')]}}; \ No newline at end of file +var _0x55e0=['TEXT','medium','out','DATE','sequelize','exports'];(function(_0x3c7bce,_0x33d678){var _0x3a7386=function(_0x11e209){while(--_0x11e209){_0x3c7bce['push'](_0x3c7bce['shift']());}};_0x3a7386(++_0x33d678);}(_0x55e0,0xdc));var _0x055e=function(_0x12a89,_0x59fe53){_0x12a89=_0x12a89-0x0;var _0x2eb391=_0x55e0[_0x12a89];return _0x2eb391;};'use strict';var Sequelize=require(_0x055e('0x0'));module[_0x055e('0x1')]={'body':{'type':Sequelize[_0x055e('0x2')](_0x055e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x055e('0x4')),'defaultValue':_0x055e('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x055e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x055e('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 267f876..890b5c3 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 _0x89d7=['rejectmessage','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','format','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','util','path','../../components/interaction/service','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','client','http','fax-interactions','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','length','body','find','describe','acceptMessage','accept','fax','reject','UserId','user','agent','get','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','EventManager'];(function(_0x5b7524,_0x2d4c5e){var _0x2b8b3c=function(_0x144976){while(--_0x144976){_0x5b7524['push'](_0x5b7524['shift']());}};_0x2b8b3c(++_0x2d4c5e);}(_0x89d7,0xf2));var _0x789d=function(_0x3650ad,_0x3386bf){_0x3650ad=_0x3650ad-0x0;var _0x3e4d7b=_0x89d7[_0x3650ad];return _0x3e4d7b;};'use strict';var util=require(_0x789d('0x0'));var path=require(_0x789d('0x1'));var _=require('lodash');var Redis=require('ioredis');var interactionService=require(_0x789d('0x2'));var qs=require(_0x789d('0x3'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x789d('0x4'))['db'];config[_0x789d('0x5')]=_[_0x789d('0x6')](config['redis'],{'host':_0x789d('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x789d('0x5')]));require(_0x789d('0x8'))[_0x789d('0x9')](socket);var jayson=require('jayson/promise');var client=jayson[_0x789d('0xa')][_0x789d('0xb')]({'port':0x232c});var client9002=jayson[_0x789d('0xa')][_0x789d('0xb')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x789d('0xc'));function respondWithRpcPromise(_0x166681,_0x3f5677,_0x29ea35,_0x137958){return new Promise(function(_0x4aaaa8,_0x2a6dae){var _0xa499c4=_0x137958||client;return _0xa499c4[_0x789d('0xd')](_0x166681,_0x29ea35)[_0x789d('0xe')](function(_0x4b1281){logger['info'](_0x789d('0xf'),_0x3f5677,_0x789d('0x10'));logger[_0x789d('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3f5677,_0x789d('0x10'),JSON[_0x789d('0x12')](_0x4b1281));if(_0x4b1281[_0x789d('0x13')]){if(_0x4b1281['error'][_0x789d('0x14')]===0x1f4){logger[_0x789d('0x13')](_0x789d('0xf'),_0x3f5677,_0x4b1281[_0x789d('0x13')][_0x789d('0x15')]);return _0x2a6dae(_0x4b1281[_0x789d('0x13')][_0x789d('0x15')]);}logger[_0x789d('0x13')](_0x789d('0xf'),_0x3f5677,_0x4b1281[_0x789d('0x13')][_0x789d('0x15')]);return _0x4aaaa8(_0x4b1281[_0x789d('0x13')]['message']);}else{logger[_0x789d('0x16')](_0x789d('0xf'),_0x3f5677,_0x789d('0x10'));_0x4aaaa8(_0x4b1281['result'][_0x789d('0x15')]);}})['catch'](function(_0x50c4c3){logger[_0x789d('0x13')](_0x789d('0xf'),_0x3f5677,_0x50c4c3);_0x2a6dae(_0x50c4c3);});});}function respondWithResult(_0x482b7c,_0x57ff3c){_0x57ff3c=_0x57ff3c||0xc8;return function(_0x196d9a){if(_0x196d9a){return _0x482b7c[_0x789d('0x17')](_0x57ff3c)[_0x789d('0x18')](_0x196d9a);}};}function respondWithFilteredResult(_0x1bef7b,_0x589e64){return function(_0x574834){if(_0x574834){var _0x1c8910=typeof _0x589e64[_0x789d('0x19')]===_0x789d('0x1a')&&typeof _0x589e64[_0x789d('0x1b')]==='undefined';var _0x5968c4=_0x574834[_0x789d('0x1c')];var _0x4e6e10=_0x1c8910?0x0:_0x589e64[_0x789d('0x19')];var _0xaf8181=_0x1c8910?_0x574834[_0x789d('0x1c')]:_0x589e64['offset']+_0x589e64[_0x789d('0x1b')];var _0x16e131;if(_0xaf8181>=_0x5968c4){_0xaf8181=_0x5968c4;_0x16e131=0xc8;}else{_0x16e131=0xce;}_0x1bef7b['status'](_0x16e131);return _0x1bef7b['set'](_0x789d('0x1d'),_0x4e6e10+'-'+_0xaf8181+'/'+_0x5968c4)[_0x789d('0x18')](_0x574834);}return null;};}function saveUpdates(_0x4236ac){return function(_0x470a4e){if(_0x470a4e){return _0x470a4e[_0x789d('0x1e')](_0x4236ac)[_0x789d('0xe')](function(_0x3a308d){return _0x3a308d;});}return null;};}function removeEntity(_0x4626b7){return function(_0x32f171){if(_0x32f171){return _0x32f171[_0x789d('0x1f')]()[_0x789d('0xe')](function(){_0x4626b7[_0x789d('0x17')](0xcc)[_0x789d('0x20')]();});}};}function handleEntityNotFound(_0x2405a5){return function(_0x1b950a){if(!_0x1b950a){_0x2405a5['sendStatus'](0x194);}return _0x1b950a;};}function handleError(_0x3f90cc,_0x515655){_0x515655=_0x515655||0x1f4;return function(_0x2810c2){logger[_0x789d('0x13')](_0x2810c2['stack']);if(_0x2810c2['name']){delete _0x2810c2[_0x789d('0x21')];}_0x3f90cc[_0x789d('0x17')](_0x515655)[_0x789d('0x22')](_0x2810c2);};}exports[_0x789d('0x23')]=function(_0x459da8,_0x213e9d){var _0x533d53={},_0x3db97c={},_0x384e90={'count':0x0,'rows':[]};var _0x105f8e=_[_0x789d('0x24')](db[_0x789d('0x25')][_0x789d('0x26')],function(_0x504632){return{'name':_0x504632[_0x789d('0x27')],'type':_0x504632[_0x789d('0x28')][_0x789d('0x29')]};});_0x3db97c[_0x789d('0x2a')]=_[_0x789d('0x24')](_0x105f8e,_0x789d('0x21'));_0x3db97c[_0x789d('0x2b')]=_['keys'](_0x459da8[_0x789d('0x2b')]);_0x3db97c['filters']=_[_0x789d('0x2c')](_0x3db97c[_0x789d('0x2a')],_0x3db97c['query']);_0x533d53[_0x789d('0x2d')]=_[_0x789d('0x2c')](_0x3db97c[_0x789d('0x2a')],qs[_0x789d('0x2e')](_0x459da8[_0x789d('0x2b')][_0x789d('0x2e')]));_0x533d53['attributes']=_0x533d53[_0x789d('0x2d')]['length']?_0x533d53[_0x789d('0x2d')]:_0x3db97c['model'];if(!_0x459da8[_0x789d('0x2b')][_0x789d('0x2f')](_0x789d('0x30'))){_0x533d53['limit']=qs[_0x789d('0x1b')](_0x459da8[_0x789d('0x2b')][_0x789d('0x1b')]);_0x533d53[_0x789d('0x19')]=qs[_0x789d('0x19')](_0x459da8[_0x789d('0x2b')]['offset']);}_0x533d53[_0x789d('0x31')]=qs[_0x789d('0x32')](_0x459da8[_0x789d('0x2b')][_0x789d('0x32')]);_0x533d53[_0x789d('0x33')]=qs[_0x789d('0x34')](_[_0x789d('0x35')](_0x459da8[_0x789d('0x2b')],_0x3db97c[_0x789d('0x34')]),_0x105f8e);if(_0x459da8[_0x789d('0x2b')][_0x789d('0x36')]){_0x533d53[_0x789d('0x33')]=_[_0x789d('0x37')](_0x533d53[_0x789d('0x33')],{'$or':_[_0x789d('0x24')](_0x105f8e,function(_0x54c567){if(_0x54c567['type']!=='VIRTUAL'){var _0x22bf66={};_0x22bf66[_0x54c567['name']]={'$like':'%'+_0x459da8[_0x789d('0x2b')][_0x789d('0x36')]+'%'};return _0x22bf66;}})});}_0x533d53=_['merge']({},_0x533d53,_0x459da8[_0x789d('0x38')]);var _0x2f1b55={'where':_0x533d53['where']};return db[_0x789d('0x25')]['count'](_0x2f1b55)['then'](function(_0x4dcaba){_0x384e90[_0x789d('0x1c')]=_0x4dcaba;if(_0x459da8[_0x789d('0x2b')][_0x789d('0x39')]){_0x533d53[_0x789d('0x3a')]=[{'all':!![]}];}return db[_0x789d('0x25')][_0x789d('0x3b')](_0x533d53);})[_0x789d('0xe')](function(_0x3f0612){_0x384e90['rows']=_0x3f0612;return _0x384e90;})[_0x789d('0xe')](respondWithFilteredResult(_0x213e9d,_0x533d53))[_0x789d('0x3c')](handleError(_0x213e9d,null));};exports[_0x789d('0x3d')]=function(_0x191a56,_0x72a246){var _0x4e3aea={'raw':!![],'where':{'id':_0x191a56[_0x789d('0x3e')]['id']}},_0x364cc2={};_0x364cc2[_0x789d('0x2a')]=_[_0x789d('0x3f')](db['FaxMessage'][_0x789d('0x26')]);_0x364cc2['query']=_[_0x789d('0x3f')](_0x191a56['query']);_0x364cc2[_0x789d('0x34')]=_[_0x789d('0x2c')](_0x364cc2[_0x789d('0x2a')],_0x364cc2[_0x789d('0x2b')]);_0x4e3aea['attributes']=_[_0x789d('0x2c')](_0x364cc2[_0x789d('0x2a')],qs[_0x789d('0x2e')](_0x191a56[_0x789d('0x2b')][_0x789d('0x2e')]));_0x4e3aea[_0x789d('0x2d')]=_0x4e3aea[_0x789d('0x2d')][_0x789d('0x40')]?_0x4e3aea[_0x789d('0x2d')]:_0x364cc2[_0x789d('0x2a')];if(_0x191a56[_0x789d('0x2b')][_0x789d('0x39')]){_0x4e3aea[_0x789d('0x3a')]=[{'all':!![]}];}_0x4e3aea=_[_0x789d('0x37')]({},_0x4e3aea,_0x191a56[_0x789d('0x38')]);return db['FaxMessage']['find'](_0x4e3aea)['then'](handleEntityNotFound(_0x72a246,null))[_0x789d('0xe')](respondWithResult(_0x72a246,null))['catch'](handleError(_0x72a246,null));};exports[_0x789d('0x1e')]=function(_0x13d954,_0xfd0c95){if(_0x13d954[_0x789d('0x41')]['id']){delete _0x13d954[_0x789d('0x41')]['id'];}return db[_0x789d('0x25')][_0x789d('0x42')]({'where':{'id':_0x13d954[_0x789d('0x3e')]['id']}})[_0x789d('0xe')](handleEntityNotFound(_0xfd0c95,null))[_0x789d('0xe')](saveUpdates(_0x13d954[_0x789d('0x41')],null))[_0x789d('0xe')](respondWithResult(_0xfd0c95,null))[_0x789d('0x3c')](handleError(_0xfd0c95,null));};exports[_0x789d('0x1f')]=function(_0x203eb6,_0x47e5ed){return db['FaxMessage'][_0x789d('0x42')]({'where':{'id':_0x203eb6['params']['id']}})[_0x789d('0xe')](handleEntityNotFound(_0x47e5ed,null))['then'](removeEntity(_0x47e5ed,null))[_0x789d('0x3c')](handleError(_0x47e5ed,null));};exports[_0x789d('0x43')]=function(_0x2b8835,_0x3e3e3d){return db['FaxMessage']['describe']()[_0x789d('0xe')](respondWithResult(_0x3e3e3d,null))[_0x789d('0x3c')](handleError(_0x3e3e3d,null));};exports['accept']=function(_0x68a2e7,_0x6da20f){var _0x2c9287='sms';return interactionService[_0x789d('0x44')](_0x68a2e7,_0x2c9287)[_0x789d('0xe')](respondWithResult(_0x6da20f,null))['catch'](handleError(_0x6da20f,null));};exports[_0x789d('0x45')]=function(_0x47c45d,_0xbd9d52){var _0x11a4ad=_0x789d('0x46');return interactionService[_0x789d('0x44')](_0x47c45d,_0x11a4ad)[_0x789d('0xe')](respondWithResult(_0xbd9d52,null))[_0x789d('0x3c')](handleError(_0xbd9d52,null));};exports[_0x789d('0x47')]=function(_0x546371,_0x1afe42){var _0x375071={'agent':{},'channel':'fax'};if(_0x546371[_0x789d('0x41')]['id']){delete _0x546371[_0x789d('0x41')]['id'];}_0x546371['body'][_0x789d('0x48')]=_0x546371[_0x789d('0x41')]['UserId']||_0x546371[_0x789d('0x49')]['id'];_0x375071[_0x789d('0x4a')]['id']=_0x546371[_0x789d('0x41')][_0x789d('0x48')];return db[_0x789d('0x25')][_0x789d('0x42')]({'where':{'id':_0x546371['params']['id'],'UserId':null}})[_0x789d('0xe')](handleEntityNotFound(_0x1afe42,null))[_0x789d('0xe')](function(_0x2e046b){if(_0x2e046b){_0x375071[_0x789d('0x15')]=_0x2e046b[_0x789d('0x4b')]({'plain':!![]});return db['FaxInteraction'][_0x789d('0x42')]({'where':{'id':_0x2e046b[_0x789d('0x4c')]}});}return null;})[_0x789d('0xe')](handleEntityNotFound(_0x1afe42,null))[_0x789d('0xe')](function(_0x238132){if(_0x238132){_0x375071[_0x789d('0x4d')]=_0x238132[_0x789d('0x4b')]({'plain':!![]});interaction_log['info'](_0x789d('0x4e'),_0x546371['user']['id'],_0x546371[_0x789d('0x49')][_0x789d('0x21')],_0x546371['user']['role'],_0x375071[_0x789d('0x4d')]['id'],_0x546371[_0x789d('0x41')]?JSON['stringify'](_0x546371[_0x789d('0x41')]):_0x789d('0x4f'));return respondWithRpcPromise(_0x789d('0x50'),_0x789d('0x51'),_0x375071);}return null;})[_0x789d('0xe')](function(_0x32c7ef){var _0x5d3af=_0x789d('0x52')+_0x32c7ef['message'][_0x789d('0x53')];return db[_0x789d('0x54')][_0x789d('0x2b')](_0x5d3af,{'type':db[_0x789d('0x55')][_0x789d('0x56')][_0x789d('0x57')],'raw':!![]})[_0x789d('0xe')](function(_0x49834c){return _0x49834c;});})['then'](function(_0x2996c4){if(_0x2996c4){_0x375071[_0x789d('0x15')][_0x789d('0x58')]=_0x2996c4[0x0];if(!_0x546371[_0x789d('0x41')][_0x789d('0x48')])return;return db[_0x789d('0x59')]['find']({'where':{'id':_0x546371[_0x789d('0x41')][_0x789d('0x48')],'role':'agent'},'attributes':['id',_0x789d('0x21'),_0x789d('0x5a'),_0x789d('0x5b'),_0x789d('0x5c')],'raw':!![]});}return null;})[_0x789d('0xe')](function(_0xb38f56){if(!_0xb38f56)return null;_0x375071[_0x789d('0x15')]['agent']=_0xb38f56;return _0x375071;})[_0x789d('0xe')](function(_0xdef87c){if(_0xdef87c){_0xdef87c['message']['interface']=util['format'](_0x789d('0x5d'),_0x546371[_0x789d('0x49')]['name']);_0xdef87c[_0x789d('0x15')]['channel']=_0x375071[_0x789d('0x5e')];_0xdef87c[_0x789d('0x15')][_0x789d('0x5f')]=_0x375071['channel'];_0xdef87c[_0x789d('0x15')]['event']=_0x789d('0x47');respondWithRpcPromise(_0x789d('0x60'),'EventManager',{'event':_0x789d('0x61'),'message':_0xdef87c[_0x789d('0x15')]},client9002);return _0x375071;}return null;})['then'](respondWithResult(_0x1afe42,null))[_0x789d('0x3c')](handleError(_0x1afe42,null));};exports['create']=function(_0x31be79,_0x58da79){var _0x5d42de;return db[_0x789d('0x25')]['create'](_0x31be79[_0x789d('0x41')],{})[_0x789d('0xe')](function(_0x327ff3){_0x5d42de=_0x327ff3;return db[_0x789d('0x62')][_0x789d('0x63')]({'where':{'id':_0x5d42de[_0x789d('0x53')]}});})[_0x789d('0xe')](function(_0x3e724e){if(_[_0x789d('0x64')](_0x3e724e)){return;}else{_0x5d42de[_0x789d('0x46')]=_0x3e724e[_0x789d('0x46')];return db[_0x789d('0x65')]['findOne']({'where':{'id':_0x5d42de[_0x789d('0x66')]}});}})[_0x789d('0xe')](function(_0x1c0e46){return respondWithRpcPromise(_0x789d('0x67'),_0x789d('0x67'),{'FaxAccountId':_[_0x789d('0x64')](_0x31be79[_0x789d('0x41')])?undefined:_0x31be79[_0x789d('0x41')][_0x789d('0x68')],'path':_[_0x789d('0x64')](_0x1c0e46)?undefined:util[_0x789d('0x69')](_0x789d('0x6a'),_0x1c0e46['basename']),'fax':_[_0x789d('0x64')](_0x5d42de[_0x789d('0x46')])?undefined:_0x5d42de[_0x789d('0x46')],'AttachmentId':_0x5d42de['AttachmentId']},client9002);})['then'](respondWithResult(_0x58da79,0xc9))['catch'](handleError(_0x58da79,null));};exports[_0x789d('0x6b')]=function(_0x243bf9,_0x5687ad){var _0x17d062=path[_0x789d('0x6c')](config[_0x789d('0x6d')],_0x789d('0x6e'),_0x789d('0x6f'),_0x789d('0x70'));return db[_0x789d('0x25')][_0x789d('0x42')]({'where':{'id':_0x243bf9[_0x789d('0x3e')]['id']},'include':[{'model':db[_0x789d('0x65')],'as':_0x789d('0x65')}]})[_0x789d('0xe')](handleEntityNotFound(_0x5687ad,null))['then'](function(_0x11a72d){if(_0x11a72d){return _0x5687ad[_0x789d('0x6b')](path[_0x789d('0x6c')](_0x17d062,_0x11a72d['Attachment']['basename']));}})['catch'](handleError(_0x5687ad,null));}; \ No newline at end of file +var _0x53fe=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','fields','body','find','describe','sms','accept','fax','reject','UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','create','findOne','isNil','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','join','files','Attachment','basename','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','fax-interactions','request','then','info','request\x20sent','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','stack','name','send','map','FaxMessage','rawAttributes','fieldName','model','query','filters','intersection','attributes','length'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x53fe,0x125));var _0xe53f=function(_0x65c001,_0x4e0fa8){_0x65c001=_0x65c001-0x0;var _0x15c38d=_0x53fe[_0x65c001];return _0x15c38d;};'use strict';var util=require(_0xe53f('0x0'));var path=require(_0xe53f('0x1'));var _=require(_0xe53f('0x2'));var Redis=require(_0xe53f('0x3'));var interactionService=require(_0xe53f('0x4'));var qs=require(_0xe53f('0x5'));var logger=require(_0xe53f('0x6'))(_0xe53f('0x7'));var config=require('../../config/environment');var db=require(_0xe53f('0x8'))['db'];config[_0xe53f('0x9')]=_[_0xe53f('0xa')](config[_0xe53f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe53f('0xb'))(new Redis(config[_0xe53f('0x9')]));require(_0xe53f('0xc'))[_0xe53f('0xd')](socket);var jayson=require(_0xe53f('0xe'));var client=jayson[_0xe53f('0xf')][_0xe53f('0x10')]({'port':0x232c});var client9002=jayson['client'][_0xe53f('0x10')]({'port':0x232a});var interaction_log=require(_0xe53f('0x6'))(_0xe53f('0x11'));function respondWithRpcPromise(_0x497d79,_0x5f11b3,_0x14a0ee,_0xa58a4f){return new Promise(function(_0x334881,_0x5f3c79){var _0x33bec9=_0xa58a4f||client;return _0x33bec9[_0xe53f('0x12')](_0x497d79,_0x14a0ee)[_0xe53f('0x13')](function(_0x4aa6e2){logger[_0xe53f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x5f11b3,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5f11b3,_0xe53f('0x15'),JSON['stringify'](_0x4aa6e2));if(_0x4aa6e2[_0xe53f('0x16')]){if(_0x4aa6e2[_0xe53f('0x16')][_0xe53f('0x17')]===0x1f4){logger[_0xe53f('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5f11b3,_0x4aa6e2[_0xe53f('0x16')][_0xe53f('0x18')]);return _0x5f3c79(_0x4aa6e2[_0xe53f('0x16')][_0xe53f('0x18')]);}logger[_0xe53f('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5f11b3,_0x4aa6e2[_0xe53f('0x16')][_0xe53f('0x18')]);return _0x334881(_0x4aa6e2[_0xe53f('0x16')][_0xe53f('0x18')]);}else{logger['info'](_0xe53f('0x19'),_0x5f11b3,_0xe53f('0x15'));_0x334881(_0x4aa6e2[_0xe53f('0x1a')]['message']);}})[_0xe53f('0x1b')](function(_0x5374ea){logger[_0xe53f('0x16')](_0xe53f('0x19'),_0x5f11b3,_0x5374ea);_0x5f3c79(_0x5374ea);});});}function respondWithResult(_0x369080,_0x54783f){_0x54783f=_0x54783f||0xc8;return function(_0x4af9cf){if(_0x4af9cf){return _0x369080['status'](_0x54783f)[_0xe53f('0x1c')](_0x4af9cf);}};}function respondWithFilteredResult(_0x2b33ef,_0x15e8ad){return function(_0xfc1931){if(_0xfc1931){var _0x823821=typeof _0x15e8ad[_0xe53f('0x1d')]===_0xe53f('0x1e')&&typeof _0x15e8ad[_0xe53f('0x1f')]===_0xe53f('0x1e');var _0x393ff8=_0xfc1931[_0xe53f('0x20')];var _0x2ca5bb=_0x823821?0x0:_0x15e8ad[_0xe53f('0x1d')];var _0x4d8f10=_0x823821?_0xfc1931[_0xe53f('0x20')]:_0x15e8ad[_0xe53f('0x1d')]+_0x15e8ad[_0xe53f('0x1f')];var _0x54a8e;if(_0x4d8f10>=_0x393ff8){_0x4d8f10=_0x393ff8;_0x54a8e=0xc8;}else{_0x54a8e=0xce;}_0x2b33ef[_0xe53f('0x21')](_0x54a8e);return _0x2b33ef[_0xe53f('0x22')](_0xe53f('0x23'),_0x2ca5bb+'-'+_0x4d8f10+'/'+_0x393ff8)['json'](_0xfc1931);}return null;};}function saveUpdates(_0x229829){return function(_0x5bdcd1){if(_0x5bdcd1){return _0x5bdcd1[_0xe53f('0x24')](_0x229829)[_0xe53f('0x13')](function(_0x4b00fd){return _0x4b00fd;});}return null;};}function removeEntity(_0xe4def8){return function(_0xfd9214){if(_0xfd9214){return _0xfd9214[_0xe53f('0x25')]()[_0xe53f('0x13')](function(){_0xe4def8[_0xe53f('0x21')](0xcc)[_0xe53f('0x26')]();});}};}function handleEntityNotFound(_0x5ae718){return function(_0x3d8528){if(!_0x3d8528){_0x5ae718['sendStatus'](0x194);}return _0x3d8528;};}function handleError(_0x3cff7c,_0x2cf240){_0x2cf240=_0x2cf240||0x1f4;return function(_0x3382ea){logger['error'](_0x3382ea[_0xe53f('0x27')]);if(_0x3382ea[_0xe53f('0x28')]){delete _0x3382ea[_0xe53f('0x28')];}_0x3cff7c['status'](_0x2cf240)[_0xe53f('0x29')](_0x3382ea);};}exports['index']=function(_0x26d8a3,_0x5e0356){var _0x31295d={},_0x29952c={},_0x3b5d01={'count':0x0,'rows':[]};var _0x9c48f3=_[_0xe53f('0x2a')](db[_0xe53f('0x2b')][_0xe53f('0x2c')],function(_0xd3049a){return{'name':_0xd3049a[_0xe53f('0x2d')],'type':_0xd3049a['type']['key']};});_0x29952c[_0xe53f('0x2e')]=_['map'](_0x9c48f3,_0xe53f('0x28'));_0x29952c[_0xe53f('0x2f')]=_['keys'](_0x26d8a3[_0xe53f('0x2f')]);_0x29952c[_0xe53f('0x30')]=_[_0xe53f('0x31')](_0x29952c[_0xe53f('0x2e')],_0x29952c[_0xe53f('0x2f')]);_0x31295d[_0xe53f('0x32')]=_[_0xe53f('0x31')](_0x29952c[_0xe53f('0x2e')],qs['fields'](_0x26d8a3[_0xe53f('0x2f')]['fields']));_0x31295d[_0xe53f('0x32')]=_0x31295d[_0xe53f('0x32')][_0xe53f('0x33')]?_0x31295d[_0xe53f('0x32')]:_0x29952c[_0xe53f('0x2e')];if(!_0x26d8a3[_0xe53f('0x2f')][_0xe53f('0x34')](_0xe53f('0x35'))){_0x31295d[_0xe53f('0x1f')]=qs['limit'](_0x26d8a3['query']['limit']);_0x31295d[_0xe53f('0x1d')]=qs[_0xe53f('0x1d')](_0x26d8a3[_0xe53f('0x2f')][_0xe53f('0x1d')]);}_0x31295d[_0xe53f('0x36')]=qs[_0xe53f('0x37')](_0x26d8a3[_0xe53f('0x2f')][_0xe53f('0x37')]);_0x31295d[_0xe53f('0x38')]=qs['filters'](_[_0xe53f('0x39')](_0x26d8a3[_0xe53f('0x2f')],_0x29952c[_0xe53f('0x30')]),_0x9c48f3);if(_0x26d8a3[_0xe53f('0x2f')][_0xe53f('0x3a')]){_0x31295d[_0xe53f('0x38')]=_[_0xe53f('0x3b')](_0x31295d[_0xe53f('0x38')],{'$or':_[_0xe53f('0x2a')](_0x9c48f3,function(_0x2b6822){if(_0x2b6822[_0xe53f('0x3c')]!==_0xe53f('0x3d')){var _0x659ce2={};_0x659ce2[_0x2b6822[_0xe53f('0x28')]]={'$like':'%'+_0x26d8a3['query'][_0xe53f('0x3a')]+'%'};return _0x659ce2;}})});}_0x31295d=_[_0xe53f('0x3b')]({},_0x31295d,_0x26d8a3[_0xe53f('0x3e')]);var _0x14bf21={'where':_0x31295d[_0xe53f('0x38')]};return db['FaxMessage'][_0xe53f('0x20')](_0x14bf21)['then'](function(_0x159c6f){_0x3b5d01[_0xe53f('0x20')]=_0x159c6f;if(_0x26d8a3['query'][_0xe53f('0x3f')]){_0x31295d[_0xe53f('0x40')]=[{'all':!![]}];}return db[_0xe53f('0x2b')]['findAll'](_0x31295d);})['then'](function(_0x15843d){_0x3b5d01[_0xe53f('0x41')]=_0x15843d;return _0x3b5d01;})[_0xe53f('0x13')](respondWithFilteredResult(_0x5e0356,_0x31295d))[_0xe53f('0x1b')](handleError(_0x5e0356,null));};exports[_0xe53f('0x42')]=function(_0x496286,_0x1d1b89){var _0x537b83={'raw':!![],'where':{'id':_0x496286[_0xe53f('0x43')]['id']}},_0x46b82a={};_0x46b82a[_0xe53f('0x2e')]=_[_0xe53f('0x44')](db[_0xe53f('0x2b')]['rawAttributes']);_0x46b82a[_0xe53f('0x2f')]=_['keys'](_0x496286[_0xe53f('0x2f')]);_0x46b82a[_0xe53f('0x30')]=_[_0xe53f('0x31')](_0x46b82a[_0xe53f('0x2e')],_0x46b82a['query']);_0x537b83[_0xe53f('0x32')]=_[_0xe53f('0x31')](_0x46b82a['model'],qs[_0xe53f('0x45')](_0x496286[_0xe53f('0x2f')][_0xe53f('0x45')]));_0x537b83[_0xe53f('0x32')]=_0x537b83[_0xe53f('0x32')][_0xe53f('0x33')]?_0x537b83[_0xe53f('0x32')]:_0x46b82a[_0xe53f('0x2e')];if(_0x496286[_0xe53f('0x2f')]['includeAll']){_0x537b83[_0xe53f('0x40')]=[{'all':!![]}];}_0x537b83=_[_0xe53f('0x3b')]({},_0x537b83,_0x496286[_0xe53f('0x3e')]);return db[_0xe53f('0x2b')]['find'](_0x537b83)[_0xe53f('0x13')](handleEntityNotFound(_0x1d1b89,null))[_0xe53f('0x13')](respondWithResult(_0x1d1b89,null))[_0xe53f('0x1b')](handleError(_0x1d1b89,null));};exports['update']=function(_0xf59432,_0x3f425d){if(_0xf59432[_0xe53f('0x46')]['id']){delete _0xf59432[_0xe53f('0x46')]['id'];}return db[_0xe53f('0x2b')][_0xe53f('0x47')]({'where':{'id':_0xf59432[_0xe53f('0x43')]['id']}})[_0xe53f('0x13')](handleEntityNotFound(_0x3f425d,null))[_0xe53f('0x13')](saveUpdates(_0xf59432[_0xe53f('0x46')],null))[_0xe53f('0x13')](respondWithResult(_0x3f425d,null))[_0xe53f('0x1b')](handleError(_0x3f425d,null));};exports[_0xe53f('0x25')]=function(_0x1a489c,_0x17b371){return db[_0xe53f('0x2b')]['find']({'where':{'id':_0x1a489c[_0xe53f('0x43')]['id']}})[_0xe53f('0x13')](handleEntityNotFound(_0x17b371,null))[_0xe53f('0x13')](removeEntity(_0x17b371,null))['catch'](handleError(_0x17b371,null));};exports[_0xe53f('0x48')]=function(_0x505458,_0x57b232){return db[_0xe53f('0x2b')][_0xe53f('0x48')]()[_0xe53f('0x13')](respondWithResult(_0x57b232,null))[_0xe53f('0x1b')](handleError(_0x57b232,null));};exports['accept']=function(_0x2fc57d,_0x5a18be){var _0x1aafb9=_0xe53f('0x49');return interactionService['acceptMessage'](_0x2fc57d,_0x1aafb9)[_0xe53f('0x13')](respondWithResult(_0x5a18be,null))[_0xe53f('0x1b')](handleError(_0x5a18be,null));};exports[_0xe53f('0x4a')]=function(_0x3781a2,_0x1f802c){var _0x452033=_0xe53f('0x4b');return interactionService['acceptMessage'](_0x3781a2,_0x452033)['then'](respondWithResult(_0x1f802c,null))[_0xe53f('0x1b')](handleError(_0x1f802c,null));};exports[_0xe53f('0x4c')]=function(_0x2e3aeb,_0x529a18){var _0x5d16f0={'agent':{},'channel':'fax'};if(_0x2e3aeb[_0xe53f('0x46')]['id']){delete _0x2e3aeb['body']['id'];}_0x2e3aeb[_0xe53f('0x46')][_0xe53f('0x4d')]=_0x2e3aeb[_0xe53f('0x46')][_0xe53f('0x4d')]||_0x2e3aeb[_0xe53f('0x4e')]['id'];_0x5d16f0[_0xe53f('0x4f')]['id']=_0x2e3aeb[_0xe53f('0x46')][_0xe53f('0x4d')];return db['FaxMessage'][_0xe53f('0x47')]({'where':{'id':_0x2e3aeb[_0xe53f('0x43')]['id'],'UserId':null}})[_0xe53f('0x13')](handleEntityNotFound(_0x529a18,null))[_0xe53f('0x13')](function(_0x5e2953){if(_0x5e2953){_0x5d16f0[_0xe53f('0x18')]=_0x5e2953['get']({'plain':!![]});return db[_0xe53f('0x50')]['find']({'where':{'id':_0x5e2953[_0xe53f('0x51')]}});}return null;})[_0xe53f('0x13')](handleEntityNotFound(_0x529a18,null))[_0xe53f('0x13')](function(_0x5f2c9c){if(_0x5f2c9c){_0x5d16f0[_0xe53f('0x52')]=_0x5f2c9c[_0xe53f('0x53')]({'plain':!![]});interaction_log[_0xe53f('0x14')](_0xe53f('0x54'),_0x2e3aeb[_0xe53f('0x4e')]['id'],_0x2e3aeb[_0xe53f('0x4e')][_0xe53f('0x28')],_0x2e3aeb[_0xe53f('0x4e')][_0xe53f('0x55')],_0x5d16f0[_0xe53f('0x52')]['id'],_0x2e3aeb[_0xe53f('0x46')]?JSON[_0xe53f('0x56')](_0x2e3aeb[_0xe53f('0x46')]):'null');return respondWithRpcPromise('RejectMessage',_0xe53f('0x57'),_0x5d16f0);}return null;})[_0xe53f('0x13')](function(_0x28efe9){var _0x59aaa7=_0xe53f('0x58')+_0x28efe9['message'][_0xe53f('0x59')];return db[_0xe53f('0x5a')]['query'](_0x59aaa7,{'type':db[_0xe53f('0x5b')]['QueryTypes'][_0xe53f('0x5c')],'raw':!![]})[_0xe53f('0x13')](function(_0x29228c){return _0x29228c;});})['then'](function(_0x3aec98){if(_0x3aec98){_0x5d16f0[_0xe53f('0x18')][_0xe53f('0x5d')]=_0x3aec98[0x0];if(!_0x2e3aeb[_0xe53f('0x46')]['UserId'])return;return db[_0xe53f('0x5e')][_0xe53f('0x47')]({'where':{'id':_0x2e3aeb[_0xe53f('0x46')][_0xe53f('0x4d')],'role':'agent'},'attributes':['id',_0xe53f('0x28'),_0xe53f('0x5f'),_0xe53f('0x60'),_0xe53f('0x61')],'raw':!![]});}return null;})[_0xe53f('0x13')](function(_0x540a0a){if(!_0x540a0a)return null;_0x5d16f0[_0xe53f('0x18')][_0xe53f('0x4f')]=_0x540a0a;return _0x5d16f0;})['then'](function(_0x48b80d){if(_0x48b80d){_0x48b80d['message']['interface']=util[_0xe53f('0x62')](_0xe53f('0x63'),_0x2e3aeb['user'][_0xe53f('0x28')]);_0x48b80d['message'][_0xe53f('0x64')]=_0x5d16f0['channel'];_0x48b80d[_0xe53f('0x18')][_0xe53f('0x65')]=_0x5d16f0['channel'];_0x48b80d[_0xe53f('0x18')]['event']=_0xe53f('0x4c');respondWithRpcPromise(_0xe53f('0x66'),_0xe53f('0x66'),{'event':_0xe53f('0x67'),'message':_0x48b80d[_0xe53f('0x18')]},client9002);return _0x5d16f0;}return null;})[_0xe53f('0x13')](respondWithResult(_0x529a18,null))['catch'](handleError(_0x529a18,null));};exports[_0xe53f('0x68')]=function(_0x490302,_0x2d77a8){var _0x17ed2c;return db[_0xe53f('0x2b')][_0xe53f('0x68')](_0x490302[_0xe53f('0x46')],{})['then'](function(_0x56d11b){_0x17ed2c=_0x56d11b;return db['CmContact'][_0xe53f('0x69')]({'where':{'id':_0x17ed2c[_0xe53f('0x59')]}});})[_0xe53f('0x13')](function(_0xc4ded4){if(_[_0xe53f('0x6a')](_0xc4ded4)){return;}else{_0x17ed2c[_0xe53f('0x4b')]=_0xc4ded4[_0xe53f('0x4b')];return db['Attachment']['findOne']({'where':{'id':_0x17ed2c['AttachmentId']}});}})[_0xe53f('0x13')](function(_0x48cf45){return respondWithRpcPromise('SendFax',_0xe53f('0x6b'),{'FaxAccountId':_[_0xe53f('0x6a')](_0x490302['body'])?undefined:_0x490302[_0xe53f('0x46')][_0xe53f('0x6c')],'path':_[_0xe53f('0x6a')](_0x48cf45)?undefined:util[_0xe53f('0x62')](_0xe53f('0x6d'),_0x48cf45['basename']),'fax':_[_0xe53f('0x6a')](_0x17ed2c[_0xe53f('0x4b')])?undefined:_0x17ed2c['fax'],'AttachmentId':_0x17ed2c[_0xe53f('0x6e')]},client9002);})['then'](respondWithResult(_0x2d77a8,0xc9))[_0xe53f('0x1b')](handleError(_0x2d77a8,null));};exports['download']=function(_0x1aa55c,_0x143ff6){var _0x22d276=path[_0xe53f('0x6f')](config['root'],'server',_0xe53f('0x70'),'attachments');return db['FaxMessage']['find']({'where':{'id':_0x1aa55c[_0xe53f('0x43')]['id']},'include':[{'model':db[_0xe53f('0x71')],'as':_0xe53f('0x71')}]})['then'](handleEntityNotFound(_0x143ff6,null))[_0xe53f('0x13')](function(_0x4dffd7){if(_0x4dffd7){return _0x143ff6['download'](path[_0xe53f('0x6f')](_0x22d276,_0x4dffd7[_0xe53f('0x71')][_0xe53f('0x72')]));}})[_0xe53f('0x1b')](handleError(_0x143ff6,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ee1946e..36361c2 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 _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x559d35,_0x267080){var _0x51bbc3=function(_0x51bac2){while(--_0x51bac2){_0x559d35['push'](_0x559d35['shift']());}};_0x51bbc3(++_0x267080);}(_0x4888,0x198));var _0x8488=function(_0x248bf0,_0x29a685){_0x248bf0=_0x248bf0-0x0;var _0x455c00=_0x4888[_0x248bf0];return _0x455c00;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){FaxMessageEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);FaxMessageEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];FaxMessage[_0x8488('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x9f02=['save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4bfff5,_0xbd2a67){var _0x2383bc=function(_0x2d3f77){while(--_0x2d3f77){_0x4bfff5['push'](_0x4bfff5['shift']());}};_0x2383bc(++_0xbd2a67);}(_0x9f02,0x68));var _0x29f0=function(_0x4b312c,_0x933385){_0x4b312c=_0x4b312c-0x0;var _0xcb3bd6=_0x9f02[_0x4b312c];return _0xcb3bd6;};'use strict';var EventEmitter=require(_0x29f0('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x29f0('0x1'),'afterUpdate':_0x29f0('0x2'),'afterDestroy':_0x29f0('0x3')};function emitEvent(_0x24792b){return function(_0x1a49c1,_0x47e569,_0x204fc4){FaxMessageEvents['emit'](_0x24792b+':'+_0x1a49c1['id'],_0x1a49c1);FaxMessageEvents[_0x29f0('0x4')](_0x24792b,_0x1a49c1);_0x204fc4(null);};}for(var e in events){if(events[_0x29f0('0x5')](e)){var event=events[e];FaxMessage[_0x29f0('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index cbd4daa..ba215c6 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 _0xe80d=['rimraf','../../config/environment','define','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','secret','isNil','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x21d6e8,_0x1289c8){var _0x27ee55=function(_0x20dbd5){while(--_0x20dbd5){_0x21d6e8['push'](_0x21d6e8['shift']());}};_0x27ee55(++_0x1289c8);}(_0xe80d,0xca));var _0xde80=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0xe80d[_0x4327fe];return _0x138651;};'use strict';var _=require('lodash');var util=require(_0xde80('0x0'));var logger=require(_0xde80('0x1'))(_0xde80('0x2'));var moment=require(_0xde80('0x3'));var BPromise=require(_0xde80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde80('0x5'));var rimraf=require(_0xde80('0x6'));var config=require(_0xde80('0x7'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x447be2,_0x3b0117){return _0x447be2[_0xde80('0x8')]('FaxMessage',attributes,{'tableName':_0xde80('0x9'),'paranoid':![],'indexes':[{'name':_0xde80('0xa'),'fields':[_0xde80('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bc381,_0x4fb7be,_0x47a98e){var _0x22e21e=_0x447be2[_0xde80('0xc')];var _0x20d79e=_0x5bc381[_0xde80('0xd')]({'plain':!![]});if(_0x20d79e[_0xde80('0xe')][_0xde80('0xf')]()==='in'||_0x20d79e[_0xde80('0xe')][_0xde80('0xf')]()==='out'&&!_0x20d79e[_0xde80('0x10')]&&!_[_0xde80('0x11')](_0x20d79e['UserId'])){_0x22e21e['FaxInteraction'][_0xde80('0x12')]({'where':{'id':_0x20d79e['FaxInteractionId']}})[_0xde80('0x13')](function(_0x44f522){if(_0x44f522){_0x44f522[_0xde80('0x14')]({'lastMsgAt':_0x20d79e[_0xde80('0x15')],'lastMsgDirection':_0x20d79e[_0xde80('0xe')][_0xde80('0xf')]()});}})[_0xde80('0x16')](function(_0x47c1e3){console[_0xde80('0x17')](_0x47c1e3);});}_0x47a98e();}},'charset':_0xde80('0x18'),'collate':_0xde80('0x19')});}; \ No newline at end of file +var _0xdeeb=['fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','secret','findOne','FaxInteractionId','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage'];(function(_0x1d94d1,_0x347bb8){var _0x23c397=function(_0x489441){while(--_0x489441){_0x1d94d1['push'](_0x1d94d1['shift']());}};_0x23c397(++_0x347bb8);}(_0xdeeb,0x121));var _0xbdee=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xdeeb[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xbdee('0x0'));var util=require(_0xbdee('0x1'));var logger=require(_0xbdee('0x2'))(_0xbdee('0x3'));var moment=require('moment');var BPromise=require(_0xbdee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbdee('0x5'));var config=require(_0xbdee('0x6'));var attributes=require(_0xbdee('0x7'));module['exports']=function(_0x274826,_0x167a64){return _0x274826[_0xbdee('0x8')](_0xbdee('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xbdee('0xa'),'fields':[_0xbdee('0xb')],'type':_0xbdee('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b3911,_0x2a795e,_0x5e4ae4){var _0x223266=_0x274826['models'];var _0x3e4bf2=_0x1b3911[_0xbdee('0xd')]({'plain':!![]});if(_0x3e4bf2[_0xbdee('0xe')][_0xbdee('0xf')]()==='in'||_0x3e4bf2[_0xbdee('0xe')][_0xbdee('0xf')]()==='out'&&!_0x3e4bf2[_0xbdee('0x10')]&&!_['isNil'](_0x3e4bf2['UserId'])){_0x223266['FaxInteraction'][_0xbdee('0x11')]({'where':{'id':_0x3e4bf2[_0xbdee('0x12')]}})['then'](function(_0x3b7833){if(_0x3b7833){_0x3b7833[_0xbdee('0x13')]({'lastMsgAt':_0x3e4bf2[_0xbdee('0x14')],'lastMsgDirection':_0x3e4bf2['direction'][_0xbdee('0xf')]()});}})['catch'](function(_0x942f48){console['error'](_0x942f48);});}_0x5e4ae4();}},'charset':_0xbdee('0x15'),'collate':_0xbdee('0x16')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e55f490..0324064 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 _0xb903=['options','raw','then','stringify','UpdateFaxMessage','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body'];(function(_0x25f1c3,_0x29caae){var _0x5f4618=function(_0x1d98d3){while(--_0x1d98d3){_0x25f1c3['push'](_0x25f1c3['shift']());}};_0x5f4618(++_0x29caae);}(_0xb903,0x185));var _0x3b90=function(_0x29b3c7,_0x4f7982){_0x29b3c7=_0x29b3c7-0x0;var _0x4423ef=_0xb903[_0x29b3c7];return _0x4423ef;};'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});config['redis']=_['defaults'](config[_0x3b90('0xc')],{'host':_0x3b90('0xd'),'port':0x18eb});var socket=require(_0x3b90('0xe'))(new Redis(config[_0x3b90('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x52401e,_0x51f916,_0x56261b){return new BPromise(function(_0x55db3f,_0x336913){return client[_0x3b90('0xf')](_0x52401e,_0x56261b)['then'](function(_0x30c49c){logger[_0x3b90('0x10')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));logger[_0x3b90('0x12')](_0x3b90('0x13'),_0x51f916,'request\x20sent',JSON['stringify'](_0x30c49c));if(_0x30c49c[_0x3b90('0x14')]){if(_0x30c49c['error']['code']===0x1f4){logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c['error']['message']);return _0x336913(_0x30c49c[_0x3b90('0x14')][_0x3b90('0x16')]);}logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c[_0x3b90('0x14')]['message']);return _0x55db3f(_0x30c49c['error'][_0x3b90('0x16')]);}else{logger[_0x3b90('0x10')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));_0x55db3f(_0x30c49c[_0x3b90('0x17')][_0x3b90('0x16')]);}})[_0x3b90('0x18')](function(_0x4f388b){logger[_0x3b90('0x14')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x4f388b);_0x336913(_0x4f388b);});});}exports[_0x3b90('0x19')]=function(_0x231690){var _0x535894=this;return new Promise(function(_0x39ae7c,_0x12e1cf){return db[_0x3b90('0x1a')][_0x3b90('0x1b')](_0x231690[_0x3b90('0x1c')],{'raw':_0x231690[_0x3b90('0x1d')]?_0x231690[_0x3b90('0x1d')][_0x3b90('0x1e')]===undefined?!![]:![]:!![]})[_0x3b90('0x1f')](function(_0x3e5bb8){logger['info'](_0x3b90('0x19'),_0x231690);logger[_0x3b90('0x12')](_0x3b90('0x19'),_0x231690,JSON[_0x3b90('0x20')](_0x3e5bb8));_0x39ae7c(_0x3e5bb8);})[_0x3b90('0x18')](function(_0x93b8e7){logger['error']('CreateFaxMessage',_0x93b8e7[_0x3b90('0x16')],_0x231690);_0x12e1cf(_0x535894[_0x3b90('0x14')](0x1f4,_0x93b8e7[_0x3b90('0x16')]));});});};exports[_0x3b90('0x21')]=function(_0x583523){var _0x414462=this;return new Promise(function(_0x2936d7,_0x1787d1){return db['FaxMessage'][_0x3b90('0x22')](_0x583523[_0x3b90('0x1c')],{'raw':_0x583523[_0x3b90('0x1d')]?_0x583523[_0x3b90('0x1d')][_0x3b90('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x583523[_0x3b90('0x1d')]?_0x583523['options'][_0x3b90('0x23')]||null:null,'attributes':_0x583523['options']?_0x583523[_0x3b90('0x1d')][_0x3b90('0x24')]||null:null,'limit':_0x583523[_0x3b90('0x1d')]?_0x583523[_0x3b90('0x1d')][_0x3b90('0x25')]||null:null})[_0x3b90('0x1f')](function(_0x290283){logger[_0x3b90('0x10')]('UpdateFaxMessage',_0x583523);logger['debug'](_0x3b90('0x21'),_0x583523,JSON[_0x3b90('0x20')](_0x290283));_0x2936d7(_0x290283);})[_0x3b90('0x18')](function(_0x1c2e84){logger['error']('UpdateFaxMessage',_0x1c2e84[_0x3b90('0x16')],_0x583523);_0x1787d1(_0x414462[_0x3b90('0x14')](0x1f4,_0x1c2e84[_0x3b90('0x16')]));});});}; \ No newline at end of file +var _0xf3cd=['redis','defaults','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','body','options','raw','UpdateFaxMessage','FaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x4f89fd,_0x47073f){var _0x38e02c=function(_0xecaa27){while(--_0xecaa27){_0x4f89fd['push'](_0x4f89fd['shift']());}};_0x38e02c(++_0x47073f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xf3cd[_0x2f2360];return _0x1cc8d3;};'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});config[_0xdf3c('0xc')]=_[_0xdf3c('0xd')](config[_0xdf3c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf3c('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xdf3c('0xf')](socket);function respondWithRpcPromise(_0x981616,_0x5ef936,_0x1dba4c){return new BPromise(function(_0x205f33,_0x2d420c){return client[_0xdf3c('0x10')](_0x981616,_0x1dba4c)[_0xdf3c('0x11')](function(_0x1c456b){logger[_0xdf3c('0x12')](_0xdf3c('0x13'),_0x5ef936,'request\x20sent');logger[_0xdf3c('0x14')](_0xdf3c('0x15'),_0x5ef936,_0xdf3c('0x16'),JSON[_0xdf3c('0x17')](_0x1c456b));if(_0x1c456b['error']){if(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x19')]===0x1f4){logger[_0xdf3c('0x18')]('FaxMessage,\x20%s,\x20%s',_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x2d420c(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x205f33(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}else{logger['info'](_0xdf3c('0x13'),_0x5ef936,_0xdf3c('0x16'));_0x205f33(_0x1c456b[_0xdf3c('0x1b')][_0xdf3c('0x1a')]);}})[_0xdf3c('0x1c')](function(_0x113b56){logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x113b56);_0x2d420c(_0x113b56);});});}exports[_0xdf3c('0x1d')]=function(_0x18fb5f){var _0x267488=this;return new Promise(function(_0x3d14cc,_0x25487c){return db['FaxMessage']['create'](_0x18fb5f[_0xdf3c('0x1e')],{'raw':_0x18fb5f['options']?_0x18fb5f[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![]})[_0xdf3c('0x11')](function(_0x38b319){logger[_0xdf3c('0x12')](_0xdf3c('0x1d'),_0x18fb5f);logger['debug'](_0xdf3c('0x1d'),_0x18fb5f,JSON[_0xdf3c('0x17')](_0x38b319));_0x3d14cc(_0x38b319);})[_0xdf3c('0x1c')](function(_0x24754a){logger[_0xdf3c('0x18')](_0xdf3c('0x1d'),_0x24754a[_0xdf3c('0x1a')],_0x18fb5f);_0x25487c(_0x267488[_0xdf3c('0x18')](0x1f4,_0x24754a[_0xdf3c('0x1a')]));});});};exports[_0xdf3c('0x21')]=function(_0x4c076c){var _0xd284d7=this;return new Promise(function(_0x153daa,_0x4b57a4){return db[_0xdf3c('0x22')]['update'](_0x4c076c['body'],{'raw':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c076c['options']?_0x4c076c['options'][_0xdf3c('0x23')]||null:null,'attributes':_0x4c076c[_0xdf3c('0x1f')]?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x24')]||null:null,'limit':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x25')]||null:null})['then'](function(_0x51e0a4){logger[_0xdf3c('0x12')](_0xdf3c('0x21'),_0x4c076c);logger[_0xdf3c('0x14')]('UpdateFaxMessage',_0x4c076c,JSON[_0xdf3c('0x17')](_0x51e0a4));_0x153daa(_0x51e0a4);})[_0xdf3c('0x1c')](function(_0x21e7b8){logger[_0xdf3c('0x18')]('UpdateFaxMessage',_0x21e7b8[_0xdf3c('0x1a')],_0x4c076c);_0x4b57a4(_0xd284d7[_0xdf3c('0x18')](0x1f4,_0x21e7b8['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index e8d1916..ba30801 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 _0xc607=['length','save','remove','update','emit','register'];(function(_0x266ef8,_0x6d8432){var _0x219cfe=function(_0x3e304a){while(--_0x3e304a){_0x266ef8['push'](_0x266ef8['shift']());}};_0x219cfe(++_0x6d8432);}(_0xc607,0x181));var _0x7c60=function(_0x25e336,_0x3ce8e2){_0x25e336=_0x25e336-0x0;var _0x6dbf68=_0xc607[_0x25e336];return _0x6dbf68;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x7c60('0x0'),_0x7c60('0x1'),_0x7c60('0x2')];function createListener(_0x1e65d2,_0x4c5e2c){return function(_0x151c28){_0x4c5e2c[_0x7c60('0x3')](_0x1e65d2,_0x151c28);};}function removeListener(_0x5da8b0,_0x378dfa){return function(){FaxMessageEvents['removeListener'](_0x5da8b0,_0x378dfa);};}exports[_0x7c60('0x4')]=function(_0x26b0c9){for(var _0x4f024f=0x0,_0x2630fa=events[_0x7c60('0x5')];_0x4f024f<_0x2630fa;_0x4f024f++){var _0x2af765=events[_0x4f024f];var _0x5dba75=createListener('faxMessage:'+_0x2af765,_0x26b0c9);FaxMessageEvents['on'](_0x2af765,_0x5dba75);}}; \ No newline at end of file +var _0x4e3a=['register','length','./faxMessage.events','save','remove','update'];(function(_0x1d274a,_0x327447){var _0x206307=function(_0x482525){while(--_0x482525){_0x1d274a['push'](_0x1d274a['shift']());}};_0x206307(++_0x327447);}(_0x4e3a,0x1d6));var _0xa4e3=function(_0x592307,_0x2b8719){_0x592307=_0x592307-0x0;var _0x244eb8=_0x4e3a[_0x592307];return _0x244eb8;};'use strict';var FaxMessageEvents=require(_0xa4e3('0x0'));var events=[_0xa4e3('0x1'),_0xa4e3('0x2'),_0xa4e3('0x3')];function createListener(_0x3c59c5,_0x58982d){return function(_0x48c314){_0x58982d['emit'](_0x3c59c5,_0x48c314);};}function removeListener(_0x61fd9c,_0x388f99){return function(){FaxMessageEvents['removeListener'](_0x61fd9c,_0x388f99);};}exports[_0xa4e3('0x4')]=function(_0x40aa94){for(var _0x40ec64=0x0,_0x8d552a=events[_0xa4e3('0x5')];_0x40ec64<_0x8d552a;_0x40ec64++){var _0x32c580=events[_0x40ec64];var _0x57e7e2=createListener('faxMessage:'+_0x32c580,_0x40aa94);FaxMessageEvents['on'](_0x32c580,_0x57e7e2);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ff4b5ff..da83d03 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 _0xc368=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','download','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports','util','connect-timeout'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xc368,0x7b));var _0x8c36=function(_0x306e0f,_0x22c1d7){_0x306e0f=_0x306e0f-0x0;var _0x5da9f9=_0xc368[_0x306e0f];return _0x5da9f9;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller['show']);router['get']('/:id/download',auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['post']('/',auth[_0x8c36('0x9')](),interaction[_0x8c36('0xe')](_0x8c36('0xf'),_0x8c36('0x10')),controller[_0x8c36('0x11')]);router[_0x8c36('0x12')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x13')]);router[_0x8c36('0x12')](_0x8c36('0x14'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x15')]);router[_0x8c36('0x12')]('/:id/reject',auth[_0x8c36('0x9')](),controller['reject']);router[_0x8c36('0x16')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x17')]);module[_0x8c36('0x18')]=router; \ No newline at end of file +var _0x1d2d=['/:id','show','/:id/download','download','post','tracked','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe'];(function(_0x24bbc9,_0x49c2c2){var _0x176a0b=function(_0x3ea511){while(--_0x3ea511){_0x24bbc9['push'](_0x24bbc9['shift']());}};_0x176a0b(++_0x49c2c2);}(_0x1d2d,0xf0));var _0xd1d2=function(_0xcb4694,_0x30a11b){_0xcb4694=_0xcb4694-0x0;var _0x3fbb81=_0x1d2d[_0xcb4694];return _0x3fbb81;};'use strict';var multer=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var path=require(_0xd1d2('0x2'));var timeout=require(_0xd1d2('0x3'));var express=require(_0xd1d2('0x4'));var router=express['Router']();var fs_extra=require(_0xd1d2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1d2('0x6'));var controller=require(_0xd1d2('0x7'));router[_0xd1d2('0x8')]('/',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xa')]);router[_0xd1d2('0x8')]('/describe',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xb')]);router[_0xd1d2('0x8')](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xd')]);router[_0xd1d2('0x8')](_0xd1d2('0xe'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xf')]);router[_0xd1d2('0x10')]('/',auth[_0xd1d2('0x9')](),interaction[_0xd1d2('0x11')]('fax',_0xd1d2('0x12')),controller[_0xd1d2('0x13')]);router[_0xd1d2('0x14')](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x15')]);router[_0xd1d2('0x14')](_0xd1d2('0x16'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x17')]);router['put'](_0xd1d2('0x18'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x19')]);router['delete'](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x1a')]);module[_0xd1d2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 5323ec6..1e53bbd 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 _0xeca9=['beepall','roundrobin','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xeca9,0x1da));var _0x9eca=function(_0x2e94aa,_0xf5d232){_0x2e94aa=_0x2e94aa-0x0;var _0x2b5f1a=_0xeca9[_0x2e94aa];return _0x2b5f1a;};'use strict';var Sequelize=require('sequelize');module[_0x9eca('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9eca('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9eca('0x2')]},'timeout':{'type':Sequelize[_0x9eca('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9eca('0x4')](_0x9eca('0x5'),_0x9eca('0x6'),_0x9eca('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9eca('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8590=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x571a8a,_0x33573d){var _0x26852a=function(_0x128bf0){while(--_0x128bf0){_0x571a8a['push'](_0x571a8a['shift']());}};_0x26852a(++_0x33573d);}(_0x8590,0x105));var _0x0859=function(_0x13bba9,_0x57d8a3){_0x13bba9=_0x13bba9-0x0;var _0x3e9306=_0x8590[_0x13bba9];return _0x3e9306;};'use strict';var Sequelize=require(_0x0859('0x0'));module[_0x0859('0x1')]={'name':{'type':Sequelize[_0x0859('0x2')],'unique':_0x0859('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0859('0x2')]},'timeout':{'type':Sequelize[_0x0859('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0859('0x5')](_0x0859('0x6'),_0x0859('0x7'),_0x0859('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index ab38565..47a056a 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 _0x75dd=['intersection','attributes','fields','length','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','filters','hasOwnProperty','order','sort','FaxQueueId','filter','options','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','nolimit','addTeams','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','compact','transaction','removeTeams','ids','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','get','FaxQueues','UserProfileResource','stack','name','map','FaxQueue','rawAttributes','fieldName','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x75dd,0x1c9));var _0xd75d=function(_0x53522e,_0x20c798){_0x53522e=_0x53522e-0x0;var _0x52b0f6=_0x75dd[_0x53522e];return _0x52b0f6;};'use strict';var BPromise=require(_0xd75d('0x0'));var util=require(_0xd75d('0x1'));var _=require(_0xd75d('0x2'));var squel=require(_0xd75d('0x3'));var Redis=require(_0xd75d('0x4'));var qs=require(_0xd75d('0x5'));var logger=require('../../config/logger')(_0xd75d('0x6'));var config=require(_0xd75d('0x7'));var db=require(_0xd75d('0x8'))['db'];config[_0xd75d('0x9')]=_[_0xd75d('0xa')](config[_0xd75d('0x9')],{'host':_0xd75d('0xb'),'port':0x18eb});var socket=require(_0xd75d('0xc'))(new Redis(config['redis']));require(_0xd75d('0xd'))[_0xd75d('0xe')](socket);function respondWithStatusCode(_0x22b9f1,_0xd24f6b){_0xd24f6b=_0xd24f6b||0xcc;return function(_0x51ff92){if(_0x51ff92){return _0x22b9f1[_0xd75d('0xf')](_0xd24f6b);}return _0x22b9f1[_0xd75d('0x10')](_0xd24f6b)[_0xd75d('0x11')]();};}function respondWithResult(_0x216f91,_0x79e229){_0x79e229=_0x79e229||0xc8;return function(_0x34db4e){if(_0x34db4e){return _0x216f91[_0xd75d('0x10')](_0x79e229)[_0xd75d('0x12')](_0x34db4e);}};}function respondWithFilteredResult(_0x4d5ec1,_0x6104ef){return function(_0x1b325e){if(_0x1b325e){var _0x5e1fbf=typeof _0x6104ef[_0xd75d('0x13')]===_0xd75d('0x14')&&typeof _0x6104ef['limit']===_0xd75d('0x14');var _0x44164=_0x1b325e['count'];var _0x5d9e8c=_0x5e1fbf?0x0:_0x6104ef[_0xd75d('0x13')];var _0x3082bc=_0x5e1fbf?_0x1b325e[_0xd75d('0x15')]:_0x6104ef['offset']+_0x6104ef[_0xd75d('0x16')];var _0x5e0658;if(_0x3082bc>=_0x44164){_0x3082bc=_0x44164;_0x5e0658=0xc8;}else{_0x5e0658=0xce;}_0x4d5ec1['status'](_0x5e0658);return _0x4d5ec1['set'](_0xd75d('0x17'),_0x5d9e8c+'-'+_0x3082bc+'/'+_0x44164)[_0xd75d('0x12')](_0x1b325e);}return null;};}function saveUpdates(_0x5b1c56){return function(_0x5941c2){if(_0x5941c2){return _0x5941c2[_0xd75d('0x18')](_0x5b1c56)[_0xd75d('0x19')](function(_0xb86bbf){return _0xb86bbf;});}return null;};}function removeEntity(_0x53d05b){return function(_0x114b03){if(_0x114b03){return _0x114b03['destroy']()[_0xd75d('0x19')](function(){var _0x3c6ee2=_0x114b03[_0xd75d('0x1a')]({'plain':!![]});var _0x27b536=_0xd75d('0x1b');return db[_0xd75d('0x1c')]['destroy']({'where':{'type':_0x27b536,'resourceId':_0x3c6ee2['id']}})[_0xd75d('0x19')](function(){return _0x114b03;});})[_0xd75d('0x19')](function(){_0x53d05b[_0xd75d('0x10')](0xcc)[_0xd75d('0x11')]();});}};}function handleEntityNotFound(_0x2cc214){return function(_0x13ec15){if(!_0x13ec15){_0x2cc214[_0xd75d('0xf')](0x194);}return _0x13ec15;};}function handleError(_0x5e1e36,_0x67f1b5){_0x67f1b5=_0x67f1b5||0x1f4;return function(_0x3cef5e){logger['error'](_0x3cef5e[_0xd75d('0x1d')]);if(_0x3cef5e[_0xd75d('0x1e')]){delete _0x3cef5e[_0xd75d('0x1e')];}_0x5e1e36[_0xd75d('0x10')](_0x67f1b5)['send'](_0x3cef5e);};}exports['index']=function(_0x475ae4,_0xbc4bd4){var _0x3db450={};var _0x5c0f97={'count':0x0,'rows':[]};var _0x165acb=_[_0xd75d('0x1f')](db[_0xd75d('0x20')][_0xd75d('0x21')],function(_0x1945b5){return{'name':_0x1945b5[_0xd75d('0x22')],'type':_0x1945b5[_0xd75d('0x23')]['key']};});_0x3db450=qs[_0xd75d('0x24')](_0x165acb,_0x475ae4);var _0x544caf={'where':_0x3db450[_0xd75d('0x25')]};return db['FaxQueue']['count'](_0x544caf)[_0xd75d('0x19')](function(_0x4baa60){_0x5c0f97['count']=_0x4baa60;_0x3db450[_0xd75d('0x26')]=qs[_0xd75d('0x26')](_0x475ae4[_0xd75d('0x27')]);return db['FaxQueue'][_0xd75d('0x28')](_0x3db450);})[_0xd75d('0x19')](function(_0x39d434){_0x5c0f97[_0xd75d('0x29')]=_0x39d434;return _0x5c0f97;})['then'](respondWithFilteredResult(_0xbc4bd4,_0x3db450))[_0xd75d('0x2a')](handleError(_0xbc4bd4,null));};exports[_0xd75d('0x2b')]=function(_0x20b352,_0x54a074){var _0x42bbec={'raw':!![],'where':{'id':_0x20b352[_0xd75d('0x2c')]['id']}},_0x5bf955={};_0x5bf955[_0xd75d('0x2d')]=_[_0xd75d('0x2e')](db[_0xd75d('0x20')][_0xd75d('0x21')]);_0x5bf955[_0xd75d('0x27')]=_[_0xd75d('0x2e')](_0x20b352[_0xd75d('0x27')]);_0x5bf955['filters']=_[_0xd75d('0x2f')](_0x5bf955[_0xd75d('0x2d')],_0x5bf955[_0xd75d('0x27')]);_0x42bbec[_0xd75d('0x30')]=_[_0xd75d('0x2f')](_0x5bf955['model'],qs[_0xd75d('0x31')](_0x20b352[_0xd75d('0x27')][_0xd75d('0x31')]));_0x42bbec[_0xd75d('0x30')]=_0x42bbec['attributes'][_0xd75d('0x32')]?_0x42bbec[_0xd75d('0x30')]:_0x5bf955[_0xd75d('0x2d')];if(_0x20b352[_0xd75d('0x27')]['includeAll']){_0x42bbec[_0xd75d('0x26')]=[{'all':!![]}];}_0x42bbec=_[_0xd75d('0x33')]({},_0x42bbec,_0x20b352['options']);return db['FaxQueue'][_0xd75d('0x34')](_0x42bbec)['then'](handleEntityNotFound(_0x54a074,null))[_0xd75d('0x19')](respondWithResult(_0x54a074,null))[_0xd75d('0x2a')](handleError(_0x54a074,null));};exports[_0xd75d('0x35')]=function(_0x3b99be,_0x95ee5b){return db[_0xd75d('0x20')][_0xd75d('0x35')](_0x3b99be[_0xd75d('0x36')],{})['then'](function(_0x90e78f){var _0x2fa136=_0x3b99be['user'][_0xd75d('0x1a')]({'plain':!![]});if(!_0x2fa136)throw new Error(_0xd75d('0x37'));if(_0x2fa136[_0xd75d('0x38')]===_0xd75d('0x39')){var _0x486597=_0x90e78f[_0xd75d('0x1a')]({'plain':!![]});var _0x2a5cbe=_0xd75d('0x1b');return db[_0xd75d('0x3a')][_0xd75d('0x34')]({'where':{'name':_0x2a5cbe,'userProfileId':_0x2fa136[_0xd75d('0x3b')]},'raw':!![]})['then'](function(_0x4a3ac6){if(_0x4a3ac6&&_0x4a3ac6['autoAssociation']===0x0){return db[_0xd75d('0x1c')][_0xd75d('0x35')]({'name':_0x486597['name'],'resourceId':_0x486597['id'],'type':_0x4a3ac6[_0xd75d('0x1e')],'sectionId':_0x4a3ac6['id']},{})[_0xd75d('0x19')](function(){return _0x90e78f;});}else{return _0x90e78f;}})[_0xd75d('0x2a')](function(_0x5d9b57){logger[_0xd75d('0x3c')](_0xd75d('0x3d'),_0x5d9b57);throw _0x5d9b57;});}return _0x90e78f;})[_0xd75d('0x19')](respondWithResult(_0x95ee5b,0xc9))[_0xd75d('0x2a')](handleError(_0x95ee5b,null));};exports[_0xd75d('0x18')]=function(_0x1b53f4,_0x4f14bd){if(_0x1b53f4[_0xd75d('0x36')]['id']){delete _0x1b53f4[_0xd75d('0x36')]['id'];}return db[_0xd75d('0x20')]['find']({'where':{'id':_0x1b53f4[_0xd75d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4f14bd,null))[_0xd75d('0x19')](saveUpdates(_0x1b53f4[_0xd75d('0x36')],null))['then'](respondWithResult(_0x4f14bd,null))[_0xd75d('0x2a')](handleError(_0x4f14bd,null));};exports[_0xd75d('0x3e')]=function(_0x1ab30b,_0x5f0b54){return db[_0xd75d('0x20')][_0xd75d('0x34')]({'where':{'id':_0x1ab30b[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x5f0b54,null))['then'](removeEntity(_0x5f0b54,null))[_0xd75d('0x2a')](handleError(_0x5f0b54,null));};exports['describe']=function(_0x48ef4f,_0x460294){return db[_0xd75d('0x20')][_0xd75d('0x3f')]()['then'](respondWithResult(_0x460294,null))['catch'](handleError(_0x460294,null));};exports[_0xd75d('0x40')]=function(_0x2c5026,_0x2928bd){var _0x4e9e01={'raw':!![],'where':{}},_0x532c23={},_0x1364bd;return db[_0xd75d('0x20')][_0xd75d('0x41')]({'where':{'id':_0x2c5026[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x2928bd,null))[_0xd75d('0x19')](function(_0x26e565){if(_0x26e565){_0x1364bd=_0x26e565[_0xd75d('0x1a')]({'plain':!![]});_0x532c23[_0xd75d('0x2d')]=_[_0xd75d('0x2e')](db['UserFaxQueue'][_0xd75d('0x21')]);_0x532c23[_0xd75d('0x27')]=_[_0xd75d('0x2e')](_0x2c5026['query']);_0x532c23[_0xd75d('0x42')]=_[_0xd75d('0x2f')](_0x532c23['model'],_0x532c23[_0xd75d('0x27')]);_0x4e9e01[_0xd75d('0x30')]=_[_0xd75d('0x2f')](_0x532c23['model'],qs[_0xd75d('0x31')](_0x2c5026[_0xd75d('0x27')][_0xd75d('0x31')]));_0x4e9e01[_0xd75d('0x30')]=_0x4e9e01[_0xd75d('0x30')][_0xd75d('0x32')]?_0x4e9e01[_0xd75d('0x30')]:_0x532c23[_0xd75d('0x2d')];if(!_0x2c5026[_0xd75d('0x27')][_0xd75d('0x43')]('nolimit')){_0x4e9e01[_0xd75d('0x16')]=qs[_0xd75d('0x16')](_0x2c5026[_0xd75d('0x27')][_0xd75d('0x16')]);_0x4e9e01[_0xd75d('0x13')]=qs[_0xd75d('0x13')](_0x2c5026[_0xd75d('0x27')][_0xd75d('0x13')]);}_0x4e9e01[_0xd75d('0x44')]=qs['sort'](_0x2c5026[_0xd75d('0x27')][_0xd75d('0x45')]);_0x4e9e01[_0xd75d('0x25')]=qs[_0xd75d('0x42')](_['pick'](_0x2c5026['query'],_0x532c23['filters']));_0x4e9e01[_0xd75d('0x25')][_0xd75d('0x46')]=_0x26e565['id'];if(_0x2c5026[_0xd75d('0x27')][_0xd75d('0x47')]){_0x4e9e01[_0xd75d('0x25')]=_[_0xd75d('0x33')](_0x4e9e01['where'],{'$or':_[_0xd75d('0x1f')](_0x4e9e01[_0xd75d('0x30')],function(_0x1e653f){var _0x24656d={};_0x24656d[_0x1e653f]={'$like':'%'+_0x2c5026[_0xd75d('0x27')]['filter']+'%'};return _0x24656d;})});}_0x4e9e01=_['merge']({},_0x4e9e01,_0x2c5026[_0xd75d('0x48')]);return db[_0xd75d('0x49')][_0xd75d('0x28')](_0x4e9e01);}})['then'](function(_0x4ccc35){if(_0x4ccc35){return db[_0xd75d('0x4a')][_0xd75d('0x4b')]({'where':{'id':_[_0xd75d('0x1f')](_0x4ccc35,_0xd75d('0x4c')),'role':_0xd75d('0x4d')},'attributes':['id',_0xd75d('0x1e'),_0xd75d('0x4e'),_0xd75d('0x4f'),'createdAt']});}})[_0xd75d('0x19')](function(_0x36f7df){if(_0x36f7df){return{'count':_0x36f7df[_0xd75d('0x15')],'rows':_[_0xd75d('0x1f')](_0x36f7df['rows'],function(_0x1bc506){return{'membername':_0x1bc506[_0xd75d('0x1e')],'UserId':_0x1bc506['id'],'queue_name':_0x1364bd[_0xd75d('0x1e')],'FaxQueueId':_0x1364bd['id'],'interface':util[_0xd75d('0x50')](_0xd75d('0x51'),_0xd75d('0x52'),_0x1bc506['name']),'penalty':0x0,'paused':_0x1bc506[_0xd75d('0x4e')],'createdAt':_0x1bc506[_0xd75d('0x53')],'updatedAt':_0x1bc506[_0xd75d('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2928bd,_0x4e9e01))[_0xd75d('0x2a')](handleError(_0x2928bd,null));};exports[_0xd75d('0x54')]=function(_0x13b450,_0x110a3d){var _0x1f2ab4={};var _0x1c71c1={};var _0xe7c0b1;var _0x290c97;return db[_0xd75d('0x20')][_0xd75d('0x41')]({'where':{'id':_0x13b450[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x110a3d,null))[_0xd75d('0x19')](function(_0x3817cb){if(_0x3817cb){_0xe7c0b1=_0x3817cb;_0x1c71c1[_0xd75d('0x2d')]=_[_0xd75d('0x2e')](db[_0xd75d('0x55')][_0xd75d('0x21')]);_0x1c71c1['query']=_[_0xd75d('0x2e')](_0x13b450[_0xd75d('0x27')]);_0x1c71c1['filters']=_[_0xd75d('0x2f')](_0x1c71c1[_0xd75d('0x2d')],_0x1c71c1['query']);_0x1f2ab4[_0xd75d('0x30')]=_['intersection'](_0x1c71c1['model'],qs[_0xd75d('0x31')](_0x13b450['query'][_0xd75d('0x31')]));_0x1f2ab4['attributes']=_0x1f2ab4[_0xd75d('0x30')][_0xd75d('0x32')]?_0x1f2ab4[_0xd75d('0x30')]:_0x1c71c1[_0xd75d('0x2d')];_0x1f2ab4[_0xd75d('0x44')]=qs[_0xd75d('0x45')](_0x13b450['query'][_0xd75d('0x45')]);_0x1f2ab4[_0xd75d('0x25')]=qs[_0xd75d('0x42')](_['pick'](_0x13b450[_0xd75d('0x27')],_0x1c71c1['filters']));if(_0x13b450[_0xd75d('0x27')][_0xd75d('0x47')]){_0x1f2ab4[_0xd75d('0x25')]=_['merge'](_0x1f2ab4['where'],{'$or':_[_0xd75d('0x1f')](_0x1f2ab4[_0xd75d('0x30')],function(_0x322785){var _0x5db064={};_0x5db064[_0x322785]={'$like':'%'+_0x13b450[_0xd75d('0x27')]['filter']+'%'};return _0x5db064;})});}_0x1f2ab4=_['merge']({},_0x1f2ab4,_0x13b450['options']);return _0xe7c0b1[_0xd75d('0x54')](_0x1f2ab4);}})[_0xd75d('0x19')](function(_0xbd400d){if(_0xbd400d){_0x290c97=_0xbd400d[_0xd75d('0x32')];if(!_0x13b450[_0xd75d('0x27')][_0xd75d('0x43')](_0xd75d('0x56'))){_0x1f2ab4[_0xd75d('0x16')]=qs[_0xd75d('0x16')](_0x13b450['query'][_0xd75d('0x16')]);_0x1f2ab4[_0xd75d('0x13')]=qs['offset'](_0x13b450[_0xd75d('0x27')][_0xd75d('0x13')]);}return _0xe7c0b1[_0xd75d('0x54')](_0x1f2ab4);}})[_0xd75d('0x19')](function(_0x2f3c87){if(_0x2f3c87){return _0x2f3c87?{'count':_0x290c97,'rows':_0x2f3c87}:null;}})['then'](respondWithResult(_0x110a3d,null))[_0xd75d('0x2a')](handleError(_0x110a3d,null));};exports[_0xd75d('0x57')]=function(_0x588f0a,_0x118979){var _0x4a5938=_0x588f0a[_0xd75d('0x36')]['ids'];return db[_0xd75d('0x55')][_0xd75d('0x28')]({'where':{'id':_0x4a5938},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xd75d('0x1e'),'online',_0xd75d('0x58'),_0xd75d('0x59')],'raw':!![]}]})['then'](function(_0x5b8db8){if(_0x5b8db8){var _0x4cae32=_[_0xd75d('0x5a')](_0x5b8db8,function(_0x2ff75d){var _0x1ba11f=_0x2ff75d[_0xd75d('0x1a')]({'plain':!![]});return _0x1ba11f[_0xd75d('0x5b')];});return db[_0xd75d('0x20')][_0xd75d('0x34')]({'where':{'id':_0x588f0a[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](function(_0x1cc2c1){return db[_0xd75d('0x5c')]['transaction'](function(_0x3e0abd){return _0x1cc2c1['addTeams'](_0x4a5938,{'transaction':_0x3e0abd})[_0xd75d('0x19')](function(){return BPromise[_0xd75d('0x5d')](_0x4cae32,function(_0x76480d){return db[_0xd75d('0x49')][_0xd75d('0x5e')]({'where':{'UserId':_0x76480d['id'],'FaxQueueId':_0x588f0a[_0xd75d('0x2c')]['id']},'transaction':_0x3e0abd});});})[_0xd75d('0x19')](function(){_0x4cae32[_0xd75d('0x5f')](function(_0x5b6d74){socket[_0xd75d('0x60')](_0xd75d('0x61'),{'UserId':_0x5b6d74['id'],'FaxQueueId':_0x1cc2c1['id']});});});});});}})[_0xd75d('0x19')](respondWithStatusCode(_0x118979,null))[_0xd75d('0x2a')](handleError(_0x118979,null));};exports['removeTeams']=function(_0x59cda6,_0x1d43ab){return db[_0xd75d('0x55')][_0xd75d('0x28')]({'where':{'id':_0x59cda6[_0xd75d('0x27')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd75d('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xd75d('0x19')](handleEntityNotFound(_0x1d43ab,null))[_0xd75d('0x19')](function(_0x1ca1c6){var _0x637ca1=_[_0xd75d('0x1f')](_0x1ca1c6,'id');var _0x3ae246=[];var _0x2abb7e=[];var _0xa48a21=squel['select']();_0xa48a21[_0xd75d('0x62')](_0xd75d('0x63'))[_0xd75d('0x64')](_0xd75d('0x65'),'tq')[_0xd75d('0x66')](_0xd75d('0x67'),'ut',_0xd75d('0x68'))['where'](_0xd75d('0x69'),_0x59cda6[_0xd75d('0x2c')]['id']);for(var _0x365697=0x0;_0x365697<_0x1ca1c6[_0xd75d('0x32')];_0x365697+=0x1){let _0x41c6ad=_0x1ca1c6[_0x365697];for(var _0x4781af=0x0;_0x4781af<_0x41c6ad['Agents']['length'];_0x4781af+=0x1){let _0x6713b7=_0x41c6ad[_0xd75d('0x5b')][_0x4781af];var _0x535a54=_0xa48a21[_0xd75d('0x6a')]();_0x535a54[_0xd75d('0x25')](_0xd75d('0x6b'),_0x6713b7['id']);_0x2abb7e['push'](db[_0xd75d('0x5c')][_0xd75d('0x27')](_0x535a54[_0xd75d('0x6c')](),{'type':db[_0xd75d('0x5c')][_0xd75d('0x6d')][_0xd75d('0x6e')]})[_0xd75d('0x19')](function(_0x1b60c0){if(_0x1b60c0['length']===0x1){return _0x6713b7['id'];}else{var _0x254523=_[_0xd75d('0x6f')](_[_0xd75d('0x1f')](_0x1b60c0,_0xd75d('0x70')),function(_0x45bdab){return _[_0xd75d('0x71')](_0x637ca1,_0x45bdab);});if(_0x254523){return _0x6713b7['id'];}}}));}}return BPromise['all'](_0x2abb7e)[_0xd75d('0x19')](function(_0x32f2c1){_0x3ae246=_(_0x3ae246)['union'](_0x32f2c1)[_0xd75d('0x72')]()['value']();return db[_0xd75d('0x20')]['find']({'where':{'id':_0x59cda6[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](function(_0x2dd03e){return db[_0xd75d('0x5c')][_0xd75d('0x73')](function(_0x3f20b8){return _0x2dd03e[_0xd75d('0x74')](_0x59cda6[_0xd75d('0x27')][_0xd75d('0x75')],{'transaction':_0x3f20b8})[_0xd75d('0x19')](function(){if(!_[_0xd75d('0x76')](_0x3ae246)){return _0x2dd03e[_0xd75d('0x77')](_0x3ae246,{'transaction':_0x3f20b8});}})[_0xd75d('0x19')](function(){_0x3ae246[_0xd75d('0x5f')](function(_0x4d4c3d){socket[_0xd75d('0x60')](_0xd75d('0x78'),{'UserId':_0x4d4c3d,'FaxQueueId':_0x2dd03e['id']});});});});});});})[_0xd75d('0x19')](respondWithStatusCode(_0x1d43ab,null))['catch'](handleError(_0x1d43ab,null));};exports[_0xd75d('0x79')]=function(_0x184f12,_0x48b6bb){return db['FaxQueue'][_0xd75d('0x34')]({'where':{'id':_0x184f12[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x48b6bb,null))[_0xd75d('0x19')](function(_0x15a53d){if(_0x15a53d){return _0x15a53d[_0xd75d('0x79')](_0x184f12[_0xd75d('0x36')][_0xd75d('0x75')],_[_0xd75d('0x7a')](_0x184f12['body'],[_0xd75d('0x75'),'id'])||{})[_0xd75d('0x7b')](function(_0x5c3222){for(var _0x5e90ed=0x0;_0x5e90ed<_0x184f12[_0xd75d('0x36')][_0xd75d('0x75')][_0xd75d('0x32')];_0x5e90ed+=0x1){socket[_0xd75d('0x60')](_0xd75d('0x61'),{'UserId':Number(_0x184f12['body']['ids'][_0x5e90ed]),'FaxQueueId':Number(_0x184f12[_0xd75d('0x2c')]['id'])});}return _0x5c3222;});}})['then'](respondWithResult(_0x48b6bb,null))[_0xd75d('0x2a')](handleError(_0x48b6bb,null));};exports[_0xd75d('0x77')]=function(_0x4aab07,_0x50884c){return db['FaxQueue'][_0xd75d('0x34')]({'where':{'id':_0x4aab07['params']['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x50884c,null))['then'](function(_0x5d3bca){if(_0x5d3bca){return _0x5d3bca[_0xd75d('0x77')](_0x4aab07[_0xd75d('0x27')][_0xd75d('0x75')])[_0xd75d('0x19')](function(){if(_[_0xd75d('0x7c')](_0x4aab07[_0xd75d('0x27')]['ids'])){for(var _0x2b5d30=0x0;_0x2b5d30<_0x4aab07[_0xd75d('0x27')][_0xd75d('0x75')][_0xd75d('0x32')];_0x2b5d30+=0x1){socket[_0xd75d('0x60')](_0xd75d('0x78'),{'UserId':Number(_0x4aab07[_0xd75d('0x27')]['ids'][_0x2b5d30]),'FaxQueueId':Number(_0x4aab07[_0xd75d('0x2c')]['id'])});}}else{socket[_0xd75d('0x60')](_0xd75d('0x78'),{'UserId':Number(_0x4aab07[_0xd75d('0x27')][_0xd75d('0x75')]),'FaxQueueId':Number(_0x4aab07['params']['id'])});}});}})[_0xd75d('0x19')](respondWithStatusCode(_0x50884c,null))[_0xd75d('0x2a')](handleError(_0x50884c,null));};exports[_0xd75d('0x7d')]=function(_0xdcda94,_0x383641){var _0x4a107a={};var _0xe524be={};var _0x1b92d2;var _0x1bfee7;return db['FaxQueue']['findOne']({'where':{'id':_0xdcda94['params']['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x383641,null))['then'](function(_0x43a01a){if(_0x43a01a){_0x1b92d2=_0x43a01a;_0xe524be['model']=_[_0xd75d('0x2e')](db[_0xd75d('0x4a')][_0xd75d('0x21')]);_0xe524be[_0xd75d('0x27')]=_[_0xd75d('0x2e')](_0xdcda94[_0xd75d('0x27')]);_0xe524be['filters']=_[_0xd75d('0x2f')](_0xe524be['model'],_0xe524be[_0xd75d('0x27')]);_0x4a107a[_0xd75d('0x30')]=_[_0xd75d('0x2f')](_0xe524be[_0xd75d('0x2d')],qs['fields'](_0xdcda94['query'][_0xd75d('0x31')]));_0x4a107a[_0xd75d('0x30')]=_0x4a107a[_0xd75d('0x30')][_0xd75d('0x32')]?_0x4a107a['attributes']:_0xe524be[_0xd75d('0x2d')];_0x4a107a[_0xd75d('0x44')]=qs[_0xd75d('0x45')](_0xdcda94[_0xd75d('0x27')][_0xd75d('0x45')]);_0x4a107a[_0xd75d('0x25')]=qs[_0xd75d('0x42')](_['pick'](_0xdcda94[_0xd75d('0x27')],_0xe524be[_0xd75d('0x42')]));if(_0xdcda94['query'][_0xd75d('0x47')]){_0x4a107a[_0xd75d('0x25')]=_[_0xd75d('0x33')](_0x4a107a[_0xd75d('0x25')],{'$or':_[_0xd75d('0x1f')](_0x4a107a['attributes'],function(_0x8d8ac9){var _0x3d0c84={};_0x3d0c84[_0x8d8ac9]={'$like':'%'+_0xdcda94['query']['filter']+'%'};return _0x3d0c84;})});}_0x4a107a=_[_0xd75d('0x33')]({},_0x4a107a,_0xdcda94['options']);return _0x1b92d2[_0xd75d('0x7d')](_0x4a107a);}})['then'](function(_0x2cea42){if(_0x2cea42){_0x1bfee7=_0x2cea42[_0xd75d('0x32')];if(!_0xdcda94[_0xd75d('0x27')]['hasOwnProperty'](_0xd75d('0x56'))){_0x4a107a['limit']=qs[_0xd75d('0x16')](_0xdcda94[_0xd75d('0x27')]['limit']);_0x4a107a['offset']=qs[_0xd75d('0x13')](_0xdcda94[_0xd75d('0x27')][_0xd75d('0x13')]);}return _0x1b92d2['getAgents'](_0x4a107a);}})[_0xd75d('0x19')](function(_0x82762b){if(_0x82762b){return _0x82762b?{'count':_0x1bfee7,'rows':_0x82762b}:null;}})[_0xd75d('0x19')](respondWithResult(_0x383641,null))[_0xd75d('0x2a')](handleError(_0x383641,null));}; \ No newline at end of file +var _0x7bd0=['select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','addAgents','omit','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','update','destroy','then','get','FaxQueues','UserProfileResource','stack','send','index','map','FaxQueue','rawAttributes','fieldName','where','include','query','findAll','rows','catch','show','params','model','filters','intersection','fields','attributes','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','keys','UserFaxQueue','hasOwnProperty','nolimit','sort','pick','FaxQueueId','filter','options','User','findAndCountAll','UserId','faxPause','updatedAt','format','SIP','createdAt','getTeams','order','addTeams','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','userFaxQueue:save','removeTeams','ids'];(function(_0x416c31,_0x17ff2c){var _0x33e1e6=function(_0x4b2437){while(--_0x4b2437){_0x416c31['push'](_0x416c31['shift']());}};_0x33e1e6(++_0x17ff2c);}(_0x7bd0,0x111));var _0x07bd=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x7bd0[_0x52ea08];return _0x28d546;};'use strict';var BPromise=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var _=require(_0x07bd('0x2'));var squel=require(_0x07bd('0x3'));var Redis=require(_0x07bd('0x4'));var qs=require(_0x07bd('0x5'));var logger=require(_0x07bd('0x6'))(_0x07bd('0x7'));var config=require('../../config/environment');var db=require(_0x07bd('0x8'))['db'];config[_0x07bd('0x9')]=_[_0x07bd('0xa')](config[_0x07bd('0x9')],{'host':_0x07bd('0xb'),'port':0x18eb});var socket=require(_0x07bd('0xc'))(new Redis(config[_0x07bd('0x9')]));require('./faxQueue.socket')[_0x07bd('0xd')](socket);function respondWithStatusCode(_0x5cd446,_0x8032dc){_0x8032dc=_0x8032dc||0xcc;return function(_0xb10241){if(_0xb10241){return _0x5cd446[_0x07bd('0xe')](_0x8032dc);}return _0x5cd446['status'](_0x8032dc)[_0x07bd('0xf')]();};}function respondWithResult(_0x141e8b,_0x324a46){_0x324a46=_0x324a46||0xc8;return function(_0x169b07){if(_0x169b07){return _0x141e8b['status'](_0x324a46)[_0x07bd('0x10')](_0x169b07);}};}function respondWithFilteredResult(_0x313ca5,_0x1b067a){return function(_0x222efa){if(_0x222efa){var _0x456ecd=typeof _0x1b067a[_0x07bd('0x11')]===_0x07bd('0x12')&&typeof _0x1b067a[_0x07bd('0x13')]==='undefined';var _0x51eb2a=_0x222efa[_0x07bd('0x14')];var _0x3fe523=_0x456ecd?0x0:_0x1b067a[_0x07bd('0x11')];var _0x247f3f=_0x456ecd?_0x222efa[_0x07bd('0x14')]:_0x1b067a[_0x07bd('0x11')]+_0x1b067a[_0x07bd('0x13')];var _0x49d962;if(_0x247f3f>=_0x51eb2a){_0x247f3f=_0x51eb2a;_0x49d962=0xc8;}else{_0x49d962=0xce;}_0x313ca5[_0x07bd('0x15')](_0x49d962);return _0x313ca5['set'](_0x07bd('0x16'),_0x3fe523+'-'+_0x247f3f+'/'+_0x51eb2a)[_0x07bd('0x10')](_0x222efa);}return null;};}function saveUpdates(_0x31655a){return function(_0x1713ca){if(_0x1713ca){return _0x1713ca[_0x07bd('0x17')](_0x31655a)['then'](function(_0x3f9f0b){return _0x3f9f0b;});}return null;};}function removeEntity(_0xc4cf4c){return function(_0x4948f4){if(_0x4948f4){return _0x4948f4[_0x07bd('0x18')]()[_0x07bd('0x19')](function(){var _0x758fd5=_0x4948f4[_0x07bd('0x1a')]({'plain':!![]});var _0x36ccec=_0x07bd('0x1b');return db[_0x07bd('0x1c')][_0x07bd('0x18')]({'where':{'type':_0x36ccec,'resourceId':_0x758fd5['id']}})[_0x07bd('0x19')](function(){return _0x4948f4;});})['then'](function(){_0xc4cf4c[_0x07bd('0x15')](0xcc)[_0x07bd('0xf')]();});}};}function handleEntityNotFound(_0xcb8b23){return function(_0x11684d){if(!_0x11684d){_0xcb8b23[_0x07bd('0xe')](0x194);}return _0x11684d;};}function handleError(_0x47bd50,_0x4c673a){_0x4c673a=_0x4c673a||0x1f4;return function(_0xbb7117){logger['error'](_0xbb7117[_0x07bd('0x1d')]);if(_0xbb7117['name']){delete _0xbb7117['name'];}_0x47bd50[_0x07bd('0x15')](_0x4c673a)[_0x07bd('0x1e')](_0xbb7117);};}exports[_0x07bd('0x1f')]=function(_0xdb47ba,_0x28bd91){var _0x43cbc8={};var _0x557042={'count':0x0,'rows':[]};var _0x180b43=_[_0x07bd('0x20')](db[_0x07bd('0x21')][_0x07bd('0x22')],function(_0x12ce26){return{'name':_0x12ce26[_0x07bd('0x23')],'type':_0x12ce26['type']['key']};});_0x43cbc8=qs['getOptions'](_0x180b43,_0xdb47ba);var _0x335d61={'where':_0x43cbc8[_0x07bd('0x24')]};return db[_0x07bd('0x21')]['count'](_0x335d61)[_0x07bd('0x19')](function(_0x400cc0){_0x557042[_0x07bd('0x14')]=_0x400cc0;_0x43cbc8[_0x07bd('0x25')]=qs[_0x07bd('0x25')](_0xdb47ba[_0x07bd('0x26')]);return db['FaxQueue'][_0x07bd('0x27')](_0x43cbc8);})[_0x07bd('0x19')](function(_0x4182b9){_0x557042[_0x07bd('0x28')]=_0x4182b9;return _0x557042;})[_0x07bd('0x19')](respondWithFilteredResult(_0x28bd91,_0x43cbc8))[_0x07bd('0x29')](handleError(_0x28bd91,null));};exports[_0x07bd('0x2a')]=function(_0x456004,_0x4ff162){var _0x594967={'raw':!![],'where':{'id':_0x456004[_0x07bd('0x2b')]['id']}},_0x3fe506={};_0x3fe506[_0x07bd('0x2c')]=_['keys'](db[_0x07bd('0x21')][_0x07bd('0x22')]);_0x3fe506[_0x07bd('0x26')]=_['keys'](_0x456004['query']);_0x3fe506[_0x07bd('0x2d')]=_[_0x07bd('0x2e')](_0x3fe506[_0x07bd('0x2c')],_0x3fe506[_0x07bd('0x26')]);_0x594967['attributes']=_[_0x07bd('0x2e')](_0x3fe506[_0x07bd('0x2c')],qs[_0x07bd('0x2f')](_0x456004['query'][_0x07bd('0x2f')]));_0x594967[_0x07bd('0x30')]=_0x594967['attributes'][_0x07bd('0x31')]?_0x594967[_0x07bd('0x30')]:_0x3fe506[_0x07bd('0x2c')];if(_0x456004[_0x07bd('0x26')]['includeAll']){_0x594967['include']=[{'all':!![]}];}_0x594967=_[_0x07bd('0x32')]({},_0x594967,_0x456004['options']);return db[_0x07bd('0x21')][_0x07bd('0x33')](_0x594967)[_0x07bd('0x19')](handleEntityNotFound(_0x4ff162,null))[_0x07bd('0x19')](respondWithResult(_0x4ff162,null))[_0x07bd('0x29')](handleError(_0x4ff162,null));};exports[_0x07bd('0x34')]=function(_0x3e63b3,_0x333ac2){return db[_0x07bd('0x21')][_0x07bd('0x34')](_0x3e63b3[_0x07bd('0x35')],{})[_0x07bd('0x19')](function(_0x33067c){var _0x51e8e2=_0x3e63b3[_0x07bd('0x36')][_0x07bd('0x1a')]({'plain':!![]});if(!_0x51e8e2)throw new Error(_0x07bd('0x37'));if(_0x51e8e2[_0x07bd('0x38')]==='user'){var _0x2d2b71=_0x33067c[_0x07bd('0x1a')]({'plain':!![]});var _0x456948=_0x07bd('0x1b');return db[_0x07bd('0x39')]['find']({'where':{'name':_0x456948,'userProfileId':_0x51e8e2['userProfileId']},'raw':!![]})[_0x07bd('0x19')](function(_0x88e174){if(_0x88e174&&_0x88e174[_0x07bd('0x3a')]===0x0){return db[_0x07bd('0x1c')]['create']({'name':_0x2d2b71[_0x07bd('0x3b')],'resourceId':_0x2d2b71['id'],'type':_0x88e174[_0x07bd('0x3b')],'sectionId':_0x88e174['id']},{})[_0x07bd('0x19')](function(){return _0x33067c;});}else{return _0x33067c;}})[_0x07bd('0x29')](function(_0x318b7c){logger[_0x07bd('0x3c')](_0x07bd('0x3d'),_0x318b7c);throw _0x318b7c;});}return _0x33067c;})['then'](respondWithResult(_0x333ac2,0xc9))[_0x07bd('0x29')](handleError(_0x333ac2,null));};exports[_0x07bd('0x17')]=function(_0x33389b,_0x3a5827){if(_0x33389b[_0x07bd('0x35')]['id']){delete _0x33389b['body']['id'];}return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x33389b[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x3a5827,null))[_0x07bd('0x19')](saveUpdates(_0x33389b['body'],null))[_0x07bd('0x19')](respondWithResult(_0x3a5827,null))[_0x07bd('0x29')](handleError(_0x3a5827,null));};exports[_0x07bd('0x18')]=function(_0x3954a7,_0x5acb1d){return db['FaxQueue'][_0x07bd('0x33')]({'where':{'id':_0x3954a7[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x5acb1d,null))[_0x07bd('0x19')](removeEntity(_0x5acb1d,null))[_0x07bd('0x29')](handleError(_0x5acb1d,null));};exports[_0x07bd('0x3e')]=function(_0x2d929b,_0x3cc593){return db[_0x07bd('0x21')]['describe']()['then'](respondWithResult(_0x3cc593,null))[_0x07bd('0x29')](handleError(_0x3cc593,null));};exports[_0x07bd('0x3f')]=function(_0x171db8,_0xaa85c5){var _0x44274b={'raw':!![],'where':{}},_0xe534c0={},_0x4f5183;return db[_0x07bd('0x21')][_0x07bd('0x40')]({'where':{'id':_0x171db8[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0xaa85c5,null))[_0x07bd('0x19')](function(_0x4155df){if(_0x4155df){_0x4f5183=_0x4155df['get']({'plain':!![]});_0xe534c0[_0x07bd('0x2c')]=_[_0x07bd('0x41')](db[_0x07bd('0x42')][_0x07bd('0x22')]);_0xe534c0[_0x07bd('0x26')]=_[_0x07bd('0x41')](_0x171db8[_0x07bd('0x26')]);_0xe534c0[_0x07bd('0x2d')]=_[_0x07bd('0x2e')](_0xe534c0[_0x07bd('0x2c')],_0xe534c0[_0x07bd('0x26')]);_0x44274b[_0x07bd('0x30')]=_['intersection'](_0xe534c0[_0x07bd('0x2c')],qs[_0x07bd('0x2f')](_0x171db8[_0x07bd('0x26')]['fields']));_0x44274b['attributes']=_0x44274b[_0x07bd('0x30')]['length']?_0x44274b[_0x07bd('0x30')]:_0xe534c0[_0x07bd('0x2c')];if(!_0x171db8[_0x07bd('0x26')][_0x07bd('0x43')](_0x07bd('0x44'))){_0x44274b[_0x07bd('0x13')]=qs[_0x07bd('0x13')](_0x171db8[_0x07bd('0x26')]['limit']);_0x44274b[_0x07bd('0x11')]=qs[_0x07bd('0x11')](_0x171db8[_0x07bd('0x26')]['offset']);}_0x44274b['order']=qs['sort'](_0x171db8[_0x07bd('0x26')][_0x07bd('0x45')]);_0x44274b[_0x07bd('0x24')]=qs['filters'](_[_0x07bd('0x46')](_0x171db8[_0x07bd('0x26')],_0xe534c0[_0x07bd('0x2d')]));_0x44274b[_0x07bd('0x24')][_0x07bd('0x47')]=_0x4155df['id'];if(_0x171db8[_0x07bd('0x26')]['filter']){_0x44274b['where']=_[_0x07bd('0x32')](_0x44274b['where'],{'$or':_['map'](_0x44274b[_0x07bd('0x30')],function(_0x2d6eae){var _0xf12249={};_0xf12249[_0x2d6eae]={'$like':'%'+_0x171db8['query'][_0x07bd('0x48')]+'%'};return _0xf12249;})});}_0x44274b=_[_0x07bd('0x32')]({},_0x44274b,_0x171db8[_0x07bd('0x49')]);return db[_0x07bd('0x42')][_0x07bd('0x27')](_0x44274b);}})[_0x07bd('0x19')](function(_0x1982be){if(_0x1982be){return db[_0x07bd('0x4a')][_0x07bd('0x4b')]({'where':{'id':_['map'](_0x1982be,_0x07bd('0x4c')),'role':'agent'},'attributes':['id',_0x07bd('0x3b'),_0x07bd('0x4d'),_0x07bd('0x4e'),'createdAt']});}})[_0x07bd('0x19')](function(_0x5cb398){if(_0x5cb398){return{'count':_0x5cb398[_0x07bd('0x14')],'rows':_[_0x07bd('0x20')](_0x5cb398[_0x07bd('0x28')],function(_0xdde48d){return{'membername':_0xdde48d['name'],'UserId':_0xdde48d['id'],'queue_name':_0x4f5183['name'],'FaxQueueId':_0x4f5183['id'],'interface':util[_0x07bd('0x4f')]('%s/%s',_0x07bd('0x50'),_0xdde48d[_0x07bd('0x3b')]),'penalty':0x0,'paused':_0xdde48d[_0x07bd('0x4d')],'createdAt':_0xdde48d[_0x07bd('0x51')],'updatedAt':_0xdde48d[_0x07bd('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x07bd('0x19')](respondWithFilteredResult(_0xaa85c5,_0x44274b))['catch'](handleError(_0xaa85c5,null));};exports[_0x07bd('0x52')]=function(_0x23103c,_0x3d154d){var _0x15573d={};var _0xe086={};var _0x493175;var _0x2837ab;return db[_0x07bd('0x21')][_0x07bd('0x40')]({'where':{'id':_0x23103c['params']['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x3d154d,null))['then'](function(_0x230053){if(_0x230053){_0x493175=_0x230053;_0xe086[_0x07bd('0x2c')]=_['keys'](db['Team'][_0x07bd('0x22')]);_0xe086[_0x07bd('0x26')]=_[_0x07bd('0x41')](_0x23103c[_0x07bd('0x26')]);_0xe086[_0x07bd('0x2d')]=_['intersection'](_0xe086[_0x07bd('0x2c')],_0xe086['query']);_0x15573d[_0x07bd('0x30')]=_['intersection'](_0xe086[_0x07bd('0x2c')],qs['fields'](_0x23103c['query'][_0x07bd('0x2f')]));_0x15573d[_0x07bd('0x30')]=_0x15573d[_0x07bd('0x30')][_0x07bd('0x31')]?_0x15573d[_0x07bd('0x30')]:_0xe086[_0x07bd('0x2c')];_0x15573d[_0x07bd('0x53')]=qs[_0x07bd('0x45')](_0x23103c[_0x07bd('0x26')][_0x07bd('0x45')]);_0x15573d['where']=qs[_0x07bd('0x2d')](_['pick'](_0x23103c[_0x07bd('0x26')],_0xe086[_0x07bd('0x2d')]));if(_0x23103c[_0x07bd('0x26')]['filter']){_0x15573d[_0x07bd('0x24')]=_[_0x07bd('0x32')](_0x15573d[_0x07bd('0x24')],{'$or':_[_0x07bd('0x20')](_0x15573d[_0x07bd('0x30')],function(_0x28ec9e){var _0x307cf7={};_0x307cf7[_0x28ec9e]={'$like':'%'+_0x23103c['query'][_0x07bd('0x48')]+'%'};return _0x307cf7;})});}_0x15573d=_[_0x07bd('0x32')]({},_0x15573d,_0x23103c[_0x07bd('0x49')]);return _0x493175['getTeams'](_0x15573d);}})[_0x07bd('0x19')](function(_0xa83eb9){if(_0xa83eb9){_0x2837ab=_0xa83eb9[_0x07bd('0x31')];if(!_0x23103c[_0x07bd('0x26')]['hasOwnProperty'](_0x07bd('0x44'))){_0x15573d[_0x07bd('0x13')]=qs[_0x07bd('0x13')](_0x23103c[_0x07bd('0x26')]['limit']);_0x15573d[_0x07bd('0x11')]=qs['offset'](_0x23103c[_0x07bd('0x26')][_0x07bd('0x11')]);}return _0x493175[_0x07bd('0x52')](_0x15573d);}})[_0x07bd('0x19')](function(_0x5be4ef){if(_0x5be4ef){return _0x5be4ef?{'count':_0x2837ab,'rows':_0x5be4ef}:null;}})[_0x07bd('0x19')](respondWithResult(_0x3d154d,null))[_0x07bd('0x29')](handleError(_0x3d154d,null));};exports[_0x07bd('0x54')]=function(_0xb83fd2,_0x388962){var _0x40a6b9=_0xb83fd2[_0x07bd('0x35')]['ids'];return db[_0x07bd('0x55')][_0x07bd('0x27')]({'where':{'id':_0x40a6b9},'attributes':['id'],'include':[{'model':db[_0x07bd('0x4a')],'as':_0x07bd('0x56'),'attributes':['id',_0x07bd('0x3b'),'online',_0x07bd('0x57'),_0x07bd('0x58')],'raw':!![]}]})[_0x07bd('0x19')](function(_0x50aad3){if(_0x50aad3){var _0xadb15b=_[_0x07bd('0x59')](_0x50aad3,function(_0x6a958e){var _0x2deb53=_0x6a958e[_0x07bd('0x1a')]({'plain':!![]});return _0x2deb53['Agents'];});return db['FaxQueue'][_0x07bd('0x33')]({'where':{'id':_0xb83fd2[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](function(_0x2582ec){return db[_0x07bd('0x5a')][_0x07bd('0x5b')](function(_0x2e79a8){return _0x2582ec[_0x07bd('0x54')](_0x40a6b9,{'transaction':_0x2e79a8})[_0x07bd('0x19')](function(){return BPromise['each'](_0xadb15b,function(_0x16f902){return db[_0x07bd('0x42')][_0x07bd('0x5c')]({'where':{'UserId':_0x16f902['id'],'FaxQueueId':_0xb83fd2[_0x07bd('0x2b')]['id']},'transaction':_0x2e79a8});});})[_0x07bd('0x19')](function(){_0xadb15b['forEach'](function(_0x38f316){socket['emit'](_0x07bd('0x5d'),{'UserId':_0x38f316['id'],'FaxQueueId':_0x2582ec['id']});});});});});}})[_0x07bd('0x19')](respondWithStatusCode(_0x388962,null))['catch'](handleError(_0x388962,null));};exports[_0x07bd('0x5e')]=function(_0x51c697,_0x4a79c6){return db[_0x07bd('0x55')][_0x07bd('0x27')]({'where':{'id':_0x51c697[_0x07bd('0x26')][_0x07bd('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x07bd('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x07bd('0x19')](handleEntityNotFound(_0x4a79c6,null))[_0x07bd('0x19')](function(_0x193c87){var _0x591fc3=_[_0x07bd('0x20')](_0x193c87,'id');var _0x3d9964=[];var _0x5a9ef5=[];var _0x1f892d=squel[_0x07bd('0x60')]();_0x1f892d['field'](_0x07bd('0x61'))[_0x07bd('0x62')](_0x07bd('0x63'),'tq')[_0x07bd('0x64')](_0x07bd('0x65'),'ut',_0x07bd('0x66'))[_0x07bd('0x24')](_0x07bd('0x67'),_0x51c697['params']['id']);for(var _0x780517=0x0;_0x780517<_0x193c87[_0x07bd('0x31')];_0x780517+=0x1){let _0x4e331d=_0x193c87[_0x780517];for(var _0x31a9ac=0x0;_0x31a9ac<_0x4e331d[_0x07bd('0x56')][_0x07bd('0x31')];_0x31a9ac+=0x1){let _0x7d85c2=_0x4e331d['Agents'][_0x31a9ac];var _0x3307dc=_0x1f892d[_0x07bd('0x68')]();_0x3307dc[_0x07bd('0x24')](_0x07bd('0x69'),_0x7d85c2['id']);_0x5a9ef5['push'](db[_0x07bd('0x5a')][_0x07bd('0x26')](_0x3307dc[_0x07bd('0x6a')](),{'type':db[_0x07bd('0x5a')][_0x07bd('0x6b')][_0x07bd('0x6c')]})[_0x07bd('0x19')](function(_0x27fa8b){if(_0x27fa8b[_0x07bd('0x31')]===0x1){return _0x7d85c2['id'];}else{var _0x179e1d=_[_0x07bd('0x6d')](_[_0x07bd('0x20')](_0x27fa8b,_0x07bd('0x6e')),function(_0x3cd40c){return _[_0x07bd('0x6f')](_0x591fc3,_0x3cd40c);});if(_0x179e1d){return _0x7d85c2['id'];}}}));}}return BPromise[_0x07bd('0x70')](_0x5a9ef5)[_0x07bd('0x19')](function(_0xd02a4e){_0x3d9964=_(_0x3d9964)['union'](_0xd02a4e)[_0x07bd('0x71')]()[_0x07bd('0x72')]();return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x51c697[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](function(_0x13c81f){return db[_0x07bd('0x5a')][_0x07bd('0x5b')](function(_0xdc66d1){return _0x13c81f['removeTeams'](_0x51c697[_0x07bd('0x26')][_0x07bd('0x5f')],{'transaction':_0xdc66d1})[_0x07bd('0x19')](function(){if(!_[_0x07bd('0x73')](_0x3d9964)){return _0x13c81f[_0x07bd('0x74')](_0x3d9964,{'transaction':_0xdc66d1});}})[_0x07bd('0x19')](function(){_0x3d9964[_0x07bd('0x75')](function(_0x3a39df){socket[_0x07bd('0x76')](_0x07bd('0x77'),{'UserId':_0x3a39df,'FaxQueueId':_0x13c81f['id']});});});});});});})[_0x07bd('0x19')](respondWithStatusCode(_0x4a79c6,null))[_0x07bd('0x29')](handleError(_0x4a79c6,null));};exports[_0x07bd('0x78')]=function(_0x2af323,_0x3d1c9b){return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x2af323[_0x07bd('0x2b')]['id']}})[_0x07bd('0x19')](handleEntityNotFound(_0x3d1c9b,null))[_0x07bd('0x19')](function(_0x4546da){if(_0x4546da){return _0x4546da[_0x07bd('0x78')](_0x2af323['body'][_0x07bd('0x5f')],_[_0x07bd('0x79')](_0x2af323['body'],[_0x07bd('0x5f'),'id'])||{})['spread'](function(_0x335398){for(var _0x5adf01=0x0;_0x5adf01<_0x2af323[_0x07bd('0x35')][_0x07bd('0x5f')]['length'];_0x5adf01+=0x1){socket[_0x07bd('0x76')](_0x07bd('0x5d'),{'UserId':Number(_0x2af323['body'][_0x07bd('0x5f')][_0x5adf01]),'FaxQueueId':Number(_0x2af323['params']['id'])});}return _0x335398;});}})[_0x07bd('0x19')](respondWithResult(_0x3d1c9b,null))[_0x07bd('0x29')](handleError(_0x3d1c9b,null));};exports[_0x07bd('0x74')]=function(_0x349e55,_0xaac9a4){return db[_0x07bd('0x21')][_0x07bd('0x33')]({'where':{'id':_0x349e55['params']['id']}})['then'](handleEntityNotFound(_0xaac9a4,null))[_0x07bd('0x19')](function(_0x663616){if(_0x663616){return _0x663616[_0x07bd('0x74')](_0x349e55[_0x07bd('0x26')][_0x07bd('0x5f')])[_0x07bd('0x19')](function(){if(_['isArray'](_0x349e55[_0x07bd('0x26')]['ids'])){for(var _0x3af55a=0x0;_0x3af55a<_0x349e55['query'][_0x07bd('0x5f')][_0x07bd('0x31')];_0x3af55a+=0x1){socket[_0x07bd('0x76')](_0x07bd('0x77'),{'UserId':Number(_0x349e55[_0x07bd('0x26')]['ids'][_0x3af55a]),'FaxQueueId':Number(_0x349e55[_0x07bd('0x2b')]['id'])});}}else{socket[_0x07bd('0x76')](_0x07bd('0x77'),{'UserId':Number(_0x349e55[_0x07bd('0x26')][_0x07bd('0x5f')]),'FaxQueueId':Number(_0x349e55[_0x07bd('0x2b')]['id'])});}});}})[_0x07bd('0x19')](respondWithStatusCode(_0xaac9a4,null))[_0x07bd('0x29')](handleError(_0xaac9a4,null));};exports[_0x07bd('0x7a')]=function(_0x59b954,_0x95eeb8){var _0x3ca8ed={};var _0x1d8d26={};var _0x576e89;var _0x234fb4;return db[_0x07bd('0x21')][_0x07bd('0x40')]({'where':{'id':_0x59b954[_0x07bd('0x2b')]['id']}})['then'](handleEntityNotFound(_0x95eeb8,null))[_0x07bd('0x19')](function(_0x337d52){if(_0x337d52){_0x576e89=_0x337d52;_0x1d8d26[_0x07bd('0x2c')]=_[_0x07bd('0x41')](db['User'][_0x07bd('0x22')]);_0x1d8d26[_0x07bd('0x26')]=_[_0x07bd('0x41')](_0x59b954['query']);_0x1d8d26[_0x07bd('0x2d')]=_[_0x07bd('0x2e')](_0x1d8d26[_0x07bd('0x2c')],_0x1d8d26[_0x07bd('0x26')]);_0x3ca8ed['attributes']=_['intersection'](_0x1d8d26[_0x07bd('0x2c')],qs[_0x07bd('0x2f')](_0x59b954[_0x07bd('0x26')][_0x07bd('0x2f')]));_0x3ca8ed[_0x07bd('0x30')]=_0x3ca8ed[_0x07bd('0x30')][_0x07bd('0x31')]?_0x3ca8ed['attributes']:_0x1d8d26['model'];_0x3ca8ed[_0x07bd('0x53')]=qs['sort'](_0x59b954[_0x07bd('0x26')][_0x07bd('0x45')]);_0x3ca8ed['where']=qs[_0x07bd('0x2d')](_[_0x07bd('0x46')](_0x59b954[_0x07bd('0x26')],_0x1d8d26[_0x07bd('0x2d')]));if(_0x59b954['query']['filter']){_0x3ca8ed[_0x07bd('0x24')]=_[_0x07bd('0x32')](_0x3ca8ed[_0x07bd('0x24')],{'$or':_[_0x07bd('0x20')](_0x3ca8ed[_0x07bd('0x30')],function(_0x4505d6){var _0xc0e79f={};_0xc0e79f[_0x4505d6]={'$like':'%'+_0x59b954[_0x07bd('0x26')]['filter']+'%'};return _0xc0e79f;})});}_0x3ca8ed=_[_0x07bd('0x32')]({},_0x3ca8ed,_0x59b954['options']);return _0x576e89[_0x07bd('0x7a')](_0x3ca8ed);}})['then'](function(_0x2c5b0e){if(_0x2c5b0e){_0x234fb4=_0x2c5b0e[_0x07bd('0x31')];if(!_0x59b954[_0x07bd('0x26')]['hasOwnProperty'](_0x07bd('0x44'))){_0x3ca8ed[_0x07bd('0x13')]=qs['limit'](_0x59b954[_0x07bd('0x26')][_0x07bd('0x13')]);_0x3ca8ed[_0x07bd('0x11')]=qs[_0x07bd('0x11')](_0x59b954['query'][_0x07bd('0x11')]);}return _0x576e89[_0x07bd('0x7a')](_0x3ca8ed);}})[_0x07bd('0x19')](function(_0x40b94a){if(_0x40b94a){return _0x40b94a?{'count':_0x234fb4,'rows':_0x40b94a}:null;}})[_0x07bd('0x19')](respondWithResult(_0x95eeb8,null))['catch'](handleError(_0x95eeb8,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ce42304..1c16a05 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 _0x5b8f=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','emit'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x5b8f,0xb7));var _0xf5b8=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x5b8f[_0xd050c6];return _0x7278a;};'use strict';var EventEmitter=require(_0xf5b8('0x0'));var FaxQueue=require(_0xf5b8('0x1'))['db'][_0xf5b8('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf5b8('0x3')](0x0);var events={'afterCreate':_0xf5b8('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x58d8a7){return function(_0x521968,_0x48f8a4,_0x8c3416){FaxQueueEvents[_0xf5b8('0x5')](_0x58d8a7+':'+_0x521968['id'],_0x521968);FaxQueueEvents[_0xf5b8('0x5')](_0x58d8a7,_0x521968);_0x8c3416(null);};}for(var e in events){if(events[_0xf5b8('0x6')](e)){var event=events[e];FaxQueue[_0xf5b8('0x7')](e,emitEvent(event));}}module[_0xf5b8('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x9ac0=['FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x98417d,_0x2d249c){var _0x51ee3c=function(_0x270644){while(--_0x270644){_0x98417d['push'](_0x98417d['shift']());}};_0x51ee3c(++_0x2d249c);}(_0x9ac0,0x1b7));var _0x09ac=function(_0x24bdf6,_0x3ccdf6){_0x24bdf6=_0x24bdf6-0x0;var _0x4bba55=_0x9ac0[_0x24bdf6];return _0x4bba55;};'use strict';var EventEmitter=require(_0x09ac('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x09ac('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x09ac('0x2')](0x0);var events={'afterCreate':_0x09ac('0x3'),'afterUpdate':_0x09ac('0x4'),'afterDestroy':_0x09ac('0x5')};function emitEvent(_0x4d8eb3){return function(_0x34410d,_0x2eb842,_0x5536cc){FaxQueueEvents['emit'](_0x4d8eb3+':'+_0x34410d['id'],_0x34410d);FaxQueueEvents[_0x09ac('0x6')](_0x4d8eb3,_0x34410d);_0x5536cc(null);};}for(var e in events){if(events[_0x09ac('0x7')](e)){var event=events[e];FaxQueue[_0x09ac('0x8')](e,emitEvent(event));}}module[_0x09ac('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 4613ff7..0830863 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 _0x444a=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x79dc55,_0x2c067f){var _0x5cc296=function(_0x4c0f46){while(--_0x4c0f46){_0x79dc55['push'](_0x79dc55['shift']());}};_0x5cc296(++_0x2c067f);}(_0x444a,0x161));var _0xa444=function(_0x8d695e,_0x394999){_0x8d695e=_0x8d695e-0x0;var _0x3d156e=_0x444a[_0x8d695e];return _0x3d156e;};'use strict';var _=require(_0xa444('0x0'));var util=require(_0xa444('0x1'));var logger=require(_0xa444('0x2'))(_0xa444('0x3'));var moment=require(_0xa444('0x4'));var BPromise=require(_0xa444('0x5'));var rp=require(_0xa444('0x6'));var fs=require('fs');var path=require(_0xa444('0x7'));var rimraf=require(_0xa444('0x8'));var config=require(_0xa444('0x9'));var attributes=require('./faxQueue.attributes');module[_0xa444('0xa')]=function(_0x56901f,_0x51cea6){return _0x56901f[_0xa444('0xb')](_0xa444('0xc'),attributes,{'tableName':_0xa444('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3de=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','define','fax_queues','lodash','util'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0xc3de,0x1a2));var _0xec3d=function(_0x17ed29,_0x58d95c){_0x17ed29=_0x17ed29-0x0;var _0x37f4e2=_0xc3de[_0x17ed29];return _0x37f4e2;};'use strict';var _=require(_0xec3d('0x0'));var util=require(_0xec3d('0x1'));var logger=require(_0xec3d('0x2'))(_0xec3d('0x3'));var moment=require('moment');var BPromise=require(_0xec3d('0x4'));var rp=require(_0xec3d('0x5'));var fs=require('fs');var path=require(_0xec3d('0x6'));var rimraf=require(_0xec3d('0x7'));var config=require(_0xec3d('0x8'));var attributes=require(_0xec3d('0x9'));module['exports']=function(_0x2810dc,_0x401699){return _0x2810dc[_0xec3d('0xa')]('FaxQueue',attributes,{'tableName':_0xec3d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index d7af072..5920c70 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 _0x157f=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','stringify','ShowFaxQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x157f,0x8b));var _0xf157=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x157f[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xf157('0x0'));var util=require('util');var moment=require(_0xf157('0x1'));var BPromise=require(_0xf157('0x2'));var rs=require(_0xf157('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf157('0x4'))['db'];var utils=require(_0xf157('0x5'));var logger=require(_0xf157('0x6'))(_0xf157('0x7'));var config=require(_0xf157('0x8'));var jayson=require(_0xf157('0x9'));var client=jayson[_0xf157('0xa')]['http']({'port':0x232a});config[_0xf157('0xb')]=_[_0xf157('0xc')](config[_0xf157('0xb')],{'host':_0xf157('0xd'),'port':0x18eb});var socket=require(_0xf157('0xe'))(new Redis(config[_0xf157('0xb')]));require('./faxQueue.socket')[_0xf157('0xf')](socket);function respondWithRpcPromise(_0xb40557,_0x556e57,_0x4d80e9){return new BPromise(function(_0xaafc00,_0x3e3c10){return client[_0xf157('0x10')](_0xb40557,_0x4d80e9)[_0xf157('0x11')](function(_0x4b9104){logger[_0xf157('0x12')](_0xf157('0x13'),_0x556e57,_0xf157('0x14'));logger[_0xf157('0x15')](_0xf157('0x16'),_0x556e57,'request\x20sent',JSON['stringify'](_0x4b9104));if(_0x4b9104['error']){if(_0x4b9104[_0xf157('0x17')]['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x556e57,_0x4b9104['error'][_0xf157('0x18')]);return _0x3e3c10(_0x4b9104[_0xf157('0x17')][_0xf157('0x18')]);}logger[_0xf157('0x17')](_0xf157('0x13'),_0x556e57,_0x4b9104[_0xf157('0x17')][_0xf157('0x18')]);return _0xaafc00(_0x4b9104[_0xf157('0x17')][_0xf157('0x18')]);}else{logger[_0xf157('0x12')](_0xf157('0x13'),_0x556e57,'request\x20sent');_0xaafc00(_0x4b9104['result'][_0xf157('0x18')]);}})[_0xf157('0x19')](function(_0x17a32){logger[_0xf157('0x17')](_0xf157('0x13'),_0x556e57,_0x17a32);_0x3e3c10(_0x17a32);});});}exports['GetFaxQueue']=function(_0x2bfec9){var _0x5e8de7=this;return new Promise(function(_0x4b47cc,_0x291cca){return db[_0xf157('0x1a')][_0xf157('0x1b')]({'raw':_0x2bfec9['options']?_0x2bfec9[_0xf157('0x1c')][_0xf157('0x1d')]===undefined?!![]:![]:!![],'where':_0x2bfec9['options']?_0x2bfec9[_0xf157('0x1c')][_0xf157('0x1e')]||null:null,'attributes':_0x2bfec9['options']?_0x2bfec9['options'][_0xf157('0x1f')]||null:null,'limit':_0x2bfec9[_0xf157('0x1c')]?_0x2bfec9[_0xf157('0x1c')][_0xf157('0x20')]||null:null,'include':_0x2bfec9[_0xf157('0x1c')]?_0x2bfec9['options'][_0xf157('0x21')]?_[_0xf157('0x22')](_0x2bfec9[_0xf157('0x1c')]['include'],function(_0x13955f){return{'model':db[_0x13955f[_0xf157('0x23')]],'as':_0x13955f['as'],'attributes':_0x13955f['attributes'],'include':_0x13955f[_0xf157('0x21')]?_[_0xf157('0x22')](_0x13955f[_0xf157('0x21')],function(_0x34ea8f){return{'model':db[_0x34ea8f[_0xf157('0x23')]],'as':_0x34ea8f['as'],'attributes':_0x34ea8f[_0xf157('0x1f')],'include':_0x34ea8f[_0xf157('0x21')]?_[_0xf157('0x22')](_0x34ea8f[_0xf157('0x21')],function(_0x24915b){return{'model':db[_0x24915b[_0xf157('0x23')]],'as':_0x24915b['as'],'attributes':_0x24915b['attributes']};}):[]};}):[]};}):[]:[]})[_0xf157('0x11')](function(_0x362b05){logger[_0xf157('0x12')]('GetFaxQueue',_0x2bfec9);logger[_0xf157('0x15')](_0xf157('0x24'),_0x2bfec9,JSON[_0xf157('0x25')](_0x362b05));_0x4b47cc(_0x362b05);})[_0xf157('0x19')](function(_0x1cf3ec){logger[_0xf157('0x17')](_0xf157('0x24'),_0x1cf3ec[_0xf157('0x18')],_0x2bfec9);_0x291cca(_0x5e8de7['error'](0x1f4,_0x1cf3ec[_0xf157('0x18')]));});});};exports['ShowFaxQueue']=function(_0x51bd19){var _0x35c369=this;return new Promise(function(_0x4ef688,_0x5f370e){return db[_0xf157('0x1a')]['find']({'raw':_0x51bd19[_0xf157('0x1c')]?_0x51bd19[_0xf157('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x51bd19[_0xf157('0x1c')]?_0x51bd19[_0xf157('0x1c')][_0xf157('0x1e')]||null:null,'attributes':_0x51bd19[_0xf157('0x1c')]?_0x51bd19[_0xf157('0x1c')]['attributes']||null:null,'include':_0x51bd19['options']?_0x51bd19[_0xf157('0x1c')][_0xf157('0x21')]?_[_0xf157('0x22')](_0x51bd19[_0xf157('0x1c')][_0xf157('0x21')],function(_0x5dca3c){return{'model':db[_0x5dca3c[_0xf157('0x23')]],'as':_0x5dca3c['as'],'attributes':_0x5dca3c[_0xf157('0x1f')],'include':_0x5dca3c[_0xf157('0x21')]?_[_0xf157('0x22')](_0x5dca3c['include'],function(_0x324960){return{'model':db[_0x324960[_0xf157('0x23')]],'as':_0x324960['as'],'attributes':_0x324960[_0xf157('0x1f')],'include':_0x324960[_0xf157('0x21')]?_[_0xf157('0x22')](_0x324960[_0xf157('0x21')],function(_0x263284){return{'model':db[_0x263284['model']],'as':_0x263284['as'],'attributes':_0x263284[_0xf157('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf157('0x11')](function(_0x28e8de){logger[_0xf157('0x12')](_0xf157('0x26'),_0x51bd19);logger['debug'](_0xf157('0x26'),_0x51bd19,JSON[_0xf157('0x25')](_0x28e8de));_0x4ef688(_0x28e8de);})['catch'](function(_0x3bd70d){logger[_0xf157('0x17')]('ShowFaxQueue',_0x3bd70d[_0xf157('0x18')],_0x51bd19);_0x5f370e(_0x35c369['error'](0x1f4,_0x3bd70d[_0xf157('0x18')]));});});}; \ No newline at end of file +var _0x28e2=['then','debug','find','ShowFaxQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map','model'];(function(_0xbebeb9,_0x3a8031){var _0x459925=function(_0x52a700){while(--_0x52a700){_0xbebeb9['push'](_0xbebeb9['shift']());}};_0x459925(++_0x3a8031);}(_0x28e2,0x194));var _0x228e=function(_0x17322d,_0xf7a393){_0x17322d=_0x17322d-0x0;var _0x42d32a=_0x28e2[_0x17322d];return _0x42d32a;};'use strict';var _=require('lodash');var util=require(_0x228e('0x0'));var moment=require(_0x228e('0x1'));var BPromise=require(_0x228e('0x2'));var rs=require(_0x228e('0x3'));var fs=require('fs');var Redis=require(_0x228e('0x4'));var db=require(_0x228e('0x5'))['db'];var utils=require(_0x228e('0x6'));var logger=require(_0x228e('0x7'))(_0x228e('0x8'));var config=require('../../config/environment');var jayson=require(_0x228e('0x9'));var client=jayson['client'][_0x228e('0xa')]({'port':0x232a});config[_0x228e('0xb')]=_[_0x228e('0xc')](config[_0x228e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x228e('0xd'))(new Redis(config[_0x228e('0xb')]));require(_0x228e('0xe'))[_0x228e('0xf')](socket);function respondWithRpcPromise(_0x5eb566,_0x456229,_0x2d84af){return new BPromise(function(_0x193e9c,_0x9d0ba9){return client['request'](_0x5eb566,_0x2d84af)['then'](function(_0x3d6eb2){logger[_0x228e('0x10')]('FaxQueue,\x20%s,\x20%s',_0x456229,_0x228e('0x11'));logger['debug'](_0x228e('0x12'),_0x456229,_0x228e('0x11'),JSON[_0x228e('0x13')](_0x3d6eb2));if(_0x3d6eb2['error']){if(_0x3d6eb2[_0x228e('0x14')][_0x228e('0x15')]===0x1f4){logger[_0x228e('0x14')](_0x228e('0x16'),_0x456229,_0x3d6eb2['error'][_0x228e('0x17')]);return _0x9d0ba9(_0x3d6eb2[_0x228e('0x14')][_0x228e('0x17')]);}logger[_0x228e('0x14')]('FaxQueue,\x20%s,\x20%s',_0x456229,_0x3d6eb2[_0x228e('0x14')][_0x228e('0x17')]);return _0x193e9c(_0x3d6eb2[_0x228e('0x14')][_0x228e('0x17')]);}else{logger[_0x228e('0x10')](_0x228e('0x16'),_0x456229,_0x228e('0x11'));_0x193e9c(_0x3d6eb2[_0x228e('0x18')][_0x228e('0x17')]);}})[_0x228e('0x19')](function(_0x2500ac){logger['error'](_0x228e('0x16'),_0x456229,_0x2500ac);_0x9d0ba9(_0x2500ac);});});}exports[_0x228e('0x1a')]=function(_0x23472e){var _0x4903f1=this;return new Promise(function(_0x4acd27,_0x5260d9){return db[_0x228e('0x1b')][_0x228e('0x1c')]({'raw':_0x23472e[_0x228e('0x1d')]?_0x23472e['options'][_0x228e('0x1e')]===undefined?!![]:![]:!![],'where':_0x23472e['options']?_0x23472e[_0x228e('0x1d')]['where']||null:null,'attributes':_0x23472e[_0x228e('0x1d')]?_0x23472e['options'][_0x228e('0x1f')]||null:null,'limit':_0x23472e['options']?_0x23472e[_0x228e('0x1d')][_0x228e('0x20')]||null:null,'include':_0x23472e[_0x228e('0x1d')]?_0x23472e['options'][_0x228e('0x21')]?_[_0x228e('0x22')](_0x23472e[_0x228e('0x1d')][_0x228e('0x21')],function(_0x67d22a){return{'model':db[_0x67d22a[_0x228e('0x23')]],'as':_0x67d22a['as'],'attributes':_0x67d22a['attributes'],'include':_0x67d22a[_0x228e('0x21')]?_[_0x228e('0x22')](_0x67d22a[_0x228e('0x21')],function(_0x4d1a6f){return{'model':db[_0x4d1a6f[_0x228e('0x23')]],'as':_0x4d1a6f['as'],'attributes':_0x4d1a6f[_0x228e('0x1f')],'include':_0x4d1a6f[_0x228e('0x21')]?_['map'](_0x4d1a6f[_0x228e('0x21')],function(_0x14be79){return{'model':db[_0x14be79[_0x228e('0x23')]],'as':_0x14be79['as'],'attributes':_0x14be79[_0x228e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x228e('0x24')](function(_0x5d52a8){logger[_0x228e('0x10')](_0x228e('0x1a'),_0x23472e);logger[_0x228e('0x25')](_0x228e('0x1a'),_0x23472e,JSON[_0x228e('0x13')](_0x5d52a8));_0x4acd27(_0x5d52a8);})[_0x228e('0x19')](function(_0x4f0f8c){logger[_0x228e('0x14')]('GetFaxQueue',_0x4f0f8c['message'],_0x23472e);_0x5260d9(_0x4903f1['error'](0x1f4,_0x4f0f8c[_0x228e('0x17')]));});});};exports['ShowFaxQueue']=function(_0x457c6a){var _0x30f92a=this;return new Promise(function(_0x31224b,_0x25bb32){return db[_0x228e('0x1b')][_0x228e('0x26')]({'raw':_0x457c6a[_0x228e('0x1d')]?_0x457c6a[_0x228e('0x1d')][_0x228e('0x1e')]===undefined?!![]:![]:!![],'where':_0x457c6a[_0x228e('0x1d')]?_0x457c6a[_0x228e('0x1d')]['where']||null:null,'attributes':_0x457c6a[_0x228e('0x1d')]?_0x457c6a[_0x228e('0x1d')]['attributes']||null:null,'include':_0x457c6a[_0x228e('0x1d')]?_0x457c6a['options'][_0x228e('0x21')]?_[_0x228e('0x22')](_0x457c6a[_0x228e('0x1d')]['include'],function(_0x53caae){return{'model':db[_0x53caae['model']],'as':_0x53caae['as'],'attributes':_0x53caae[_0x228e('0x1f')],'include':_0x53caae[_0x228e('0x21')]?_[_0x228e('0x22')](_0x53caae['include'],function(_0x43455e){return{'model':db[_0x43455e[_0x228e('0x23')]],'as':_0x43455e['as'],'attributes':_0x43455e[_0x228e('0x1f')],'include':_0x43455e[_0x228e('0x21')]?_[_0x228e('0x22')](_0x43455e[_0x228e('0x21')],function(_0x267373){return{'model':db[_0x267373[_0x228e('0x23')]],'as':_0x267373['as'],'attributes':_0x267373['attributes']};}):[]};}):[]};}):[]:[]})[_0x228e('0x24')](function(_0x5d67c5){logger[_0x228e('0x10')](_0x228e('0x27'),_0x457c6a);logger[_0x228e('0x25')](_0x228e('0x27'),_0x457c6a,JSON[_0x228e('0x13')](_0x5d67c5));_0x31224b(_0x5d67c5);})[_0x228e('0x19')](function(_0x509cc2){logger['error'](_0x228e('0x27'),_0x509cc2[_0x228e('0x17')],_0x457c6a);_0x25bb32(_0x30f92a[_0x228e('0x14')](0x1f4,_0x509cc2[_0x228e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e5f3149..22e645e 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 _0xf66d=['length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x194494,_0x57c76e){var _0x45acaf=function(_0x37e62f){while(--_0x37e62f){_0x194494['push'](_0x194494['shift']());}};_0x45acaf(++_0x57c76e);}(_0xf66d,0x152));var _0xdf66=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xf66d[_0x110c3d];return _0x226d67;};'use strict';var FaxQueueEvents=require(_0xdf66('0x0'));var events=[_0xdf66('0x1'),_0xdf66('0x2'),_0xdf66('0x3')];function createListener(_0x3cf97b,_0x3b89db){return function(_0x3da7ef){_0x3b89db[_0xdf66('0x4')](_0x3cf97b,_0x3da7ef);};}function removeListener(_0x3b6543,_0xf6623){return function(){FaxQueueEvents[_0xdf66('0x5')](_0x3b6543,_0xf6623);};}exports['register']=function(_0x15a79f){for(var _0x3e186f=0x0,_0x310cc2=events[_0xdf66('0x6')];_0x3e186f<_0x310cc2;_0x3e186f++){var _0xa2db19=events[_0x3e186f];var _0x46b345=createListener(_0xdf66('0x7')+_0xa2db19,_0x15a79f);FaxQueueEvents['on'](_0xa2db19,_0x46b345);}}; \ No newline at end of file +var _0xd3cd=['save','remove','update','emit','removeListener','register','length','faxQueue:'];(function(_0x513cbe,_0x65c08b){var _0x146ecd=function(_0xdce2f7){while(--_0xdce2f7){_0x513cbe['push'](_0x513cbe['shift']());}};_0x146ecd(++_0x65c08b);}(_0xd3cd,0x188));var _0xdd3c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3cd[_0x122ef9];return _0x42fba0;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xdd3c('0x0'),_0xdd3c('0x1'),_0xdd3c('0x2')];function createListener(_0x34ccfb,_0x3c3b73){return function(_0x363d9e){_0x3c3b73[_0xdd3c('0x3')](_0x34ccfb,_0x363d9e);};}function removeListener(_0x1ae1bf,_0x297668){return function(){FaxQueueEvents[_0xdd3c('0x4')](_0x1ae1bf,_0x297668);};}exports[_0xdd3c('0x5')]=function(_0x210132){for(var _0x5d0d01=0x0,_0x48bae6=events[_0xdd3c('0x6')];_0x5d0d01<_0x48bae6;_0x5d0d01++){var _0x488c55=events[_0x5d0d01];var _0x340f55=createListener(_0xdd3c('0x7')+_0x488c55,_0x210132);FaxQueueEvents['on'](_0x488c55,_0x340f55);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ddc7ec5..6e98ff2 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 _0x3a6d=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','update','delete','removeTeams','exports','multer'];(function(_0x38da08,_0x3455ad){var _0x29463f=function(_0x48eb9d){while(--_0x48eb9d){_0x38da08['push'](_0x38da08['shift']());}};_0x29463f(++_0x3455ad);}(_0x3a6d,0x143));var _0xd3a6=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x3a6d[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var fs_extra=require(_0xd3a6('0x5'));var auth=require(_0xd3a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd3a6('0x7'));var controller=require(_0xd3a6('0x8'));router[_0xd3a6('0x9')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xb')]);router[_0xd3a6('0x9')]('/describe',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0x9')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0x9')](_0xd3a6('0xf'),auth[_0xd3a6('0xa')](),controller['getMembers']);router[_0xd3a6('0x9')](_0xd3a6('0x10'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x11')]);router[_0xd3a6('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xd3a6('0x12')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x13')]);router[_0xd3a6('0x12')](_0xd3a6('0x10'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x14')]);router['post'](_0xd3a6('0x15'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x16')]);router['put'](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x17')]);router['delete'](_0xd3a6('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xd3a6('0x18')](_0xd3a6('0x10'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x19')]);router[_0xd3a6('0x18')](_0xd3a6('0x15'),auth[_0xd3a6('0xa')](),controller['removeAgents']);module[_0xd3a6('0x1a')]=router; \ No newline at end of file +var _0x0a6b=['update','destroy','delete','removeTeams','removeAgents','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','index','/describe','describe','show','get','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x1090f4,_0xbb0d5f){_0x1090f4=_0x1090f4-0x0;var _0x141d87=_0x0a6b[_0x1090f4];return _0x141d87;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var fs_extra=require(_0xb0a6('0x2'));var auth=require(_0xb0a6('0x3'));var interaction=require(_0xb0a6('0x4'));var config=require('../../config/environment');var controller=require(_0xb0a6('0x5'));router['get']('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x7')]);router['get'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')](_0xb0a6('0xc'),auth[_0xb0a6('0x6')](),controller['getMembers']);router[_0xb0a6('0xb')](_0xb0a6('0xd'),auth['isAuthenticated'](),controller[_0xb0a6('0xe')]);router[_0xb0a6('0xb')](_0xb0a6('0xf'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x10')]);router[_0xb0a6('0x11')]('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x12')]);router[_0xb0a6('0x11')](_0xb0a6('0xd'),auth['isAuthenticated'](),controller[_0xb0a6('0x13')]);router['post'](_0xb0a6('0xf'),auth['isAuthenticated'](),controller[_0xb0a6('0x14')]);router['put'](_0xb0a6('0x15'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x16')]);router['delete']('/:id',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x17')]);router[_0xb0a6('0x18')](_0xb0a6('0xd'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x19')]);router['delete'](_0xb0a6('0xf'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x1a')]);module[_0xb0a6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 31408c7..7500f60 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 _0xb2af=['STRING','DATE','sequelize'];(function(_0x47623f,_0x148f3a){var _0x282ce8=function(_0x35bca1){while(--_0x35bca1){_0x47623f['push'](_0x47623f['shift']());}};_0x282ce8(++_0x148f3a);}(_0xb2af,0x137));var _0xfb2a=function(_0x9713f5,_0x492284){_0x9713f5=_0x9713f5-0x0;var _0x456454=_0xb2af[_0x9713f5];return _0x456454;};'use strict';var moment=require('moment');var Sequelize=require(_0xfb2a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xfb2a('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xfb2a('0x1')]},'joinAt':{'type':Sequelize[_0xfb2a('0x2')]},'leaveAt':{'type':Sequelize[_0xfb2a('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfb2a('0x2')]},'reason':{'type':Sequelize[_0xfb2a('0x1')]}}; \ No newline at end of file +var _0xe35d=['exports','STRING','DATE','sequelize'];(function(_0x2e5aa6,_0x46b664){var _0x1fff25=function(_0x35e937){while(--_0x35e937){_0x2e5aa6['push'](_0x2e5aa6['shift']());}};_0x1fff25(++_0x46b664);}(_0xe35d,0xe3));var _0xde35=function(_0xebf5,_0x3754f3){_0xebf5=_0xebf5-0x0;var _0x4c52bf=_0xe35d[_0xebf5];return _0x4c52bf;};'use strict';var moment=require('moment');var Sequelize=require(_0xde35('0x0'));module[_0xde35('0x1')]={'uniqueid':{'type':Sequelize[_0xde35('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xde35('0x2')]},'joinAt':{'type':Sequelize[_0xde35('0x3')]},'leaveAt':{'type':Sequelize[_0xde35('0x3')]},'acceptAt':{'type':Sequelize[_0xde35('0x3')]},'exitAt':{'type':Sequelize[_0xde35('0x3')]},'reason':{'type':Sequelize[_0xde35('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 9d0ea37..51b7449 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 _0x12c9=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','save','then','destroy','error','stack','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x12c9,0x1c9));var _0x912c=function(_0xa9a8b2,_0x34e0a3){_0xa9a8b2=_0xa9a8b2-0x0;var _0x55d350=_0x12c9[_0xa9a8b2];return _0x55d350;};'use strict';var emlformat=require(_0x912c('0x0'));var rimraf=require(_0x912c('0x1'));var zipdir=require(_0x912c('0x2'));var jsonpatch=require(_0x912c('0x3'));var rp=require(_0x912c('0x4'));var moment=require('moment');var BPromise=require(_0x912c('0x5'));var Mustache=require(_0x912c('0x6'));var util=require(_0x912c('0x7'));var path=require(_0x912c('0x8'));var sox=require(_0x912c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x912c('0xa'));var _=require(_0x912c('0xb'));var squel=require(_0x912c('0xc'));var crypto=require(_0x912c('0xd'));var jsforce=require(_0x912c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x912c('0xf'));var querystring=require('querystring');var Papa=require(_0x912c('0x10'));var Redis=require('ioredis');var authService=require(_0x912c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x912c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x912c('0x13'))(_0x912c('0x14'));var utils=require('../../config/utils');var config=require(_0x912c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x912c('0x16'))['db'];function respondWithStatusCode(_0x401501,_0x16481f){_0x16481f=_0x16481f||0xcc;return function(_0x25abd8){if(_0x25abd8){return _0x401501[_0x912c('0x17')](_0x16481f);}return _0x401501['status'](_0x16481f)[_0x912c('0x18')]();};}function respondWithResult(_0x5cc804,_0x28cdb4){_0x28cdb4=_0x28cdb4||0xc8;return function(_0x3682cf){if(_0x3682cf){return _0x5cc804['status'](_0x28cdb4)[_0x912c('0x19')](_0x3682cf);}};}function respondWithFilteredResult(_0xc48e52,_0x2ddbf6){return function(_0x2a67db){if(_0x2a67db){var _0xf102be=typeof _0x2ddbf6[_0x912c('0x1a')]===_0x912c('0x1b')&&typeof _0x2ddbf6[_0x912c('0x1c')]===_0x912c('0x1b');var _0x26cb90=_0x2a67db['count'];var _0x280e59=_0xf102be?0x0:_0x2ddbf6[_0x912c('0x1a')];var _0x2a7693=_0xf102be?_0x2a67db[_0x912c('0x1d')]:_0x2ddbf6[_0x912c('0x1a')]+_0x2ddbf6[_0x912c('0x1c')];var _0x2a22d3;if(_0x2a7693>=_0x26cb90){_0x2a7693=_0x26cb90;_0x2a22d3=0xc8;}else{_0x2a22d3=0xce;}_0xc48e52[_0x912c('0x1e')](_0x2a22d3);return _0xc48e52[_0x912c('0x1f')]('Content-Range',_0x280e59+'-'+_0x2a7693+'/'+_0x26cb90)['json'](_0x2a67db);}return null;};}function patchUpdates(_0x3eb81d){return function(_0xbb397d){try{jsonpatch['apply'](_0xbb397d,_0x3eb81d,!![]);}catch(_0x49cb1e){return BPromise['reject'](_0x49cb1e);}return _0xbb397d[_0x912c('0x20')]();};}function saveUpdates(_0x900651,_0x5adca9){return function(_0x5afd32){if(_0x5afd32){return _0x5afd32['update'](_0x900651)[_0x912c('0x21')](function(_0xefe762){return _0xefe762;});}return null;};}function removeEntity(_0x4293f2,_0x1ec8a8){return function(_0x2c964a){if(_0x2c964a){return _0x2c964a[_0x912c('0x22')]()[_0x912c('0x21')](function(){_0x4293f2['status'](0xcc)[_0x912c('0x18')]();});}};}function handleEntityNotFound(_0x5c539d,_0xde247c){return function(_0x44284d){if(!_0x44284d){_0x5c539d[_0x912c('0x17')](0x194);}return _0x44284d;};}function handleError(_0x121865,_0x32b8c5){_0x32b8c5=_0x32b8c5||0x1f4;return function(_0x3a9fc0){logger[_0x912c('0x23')](_0x3a9fc0[_0x912c('0x24')]);if(_0x3a9fc0['name']){delete _0x3a9fc0['name'];}_0x121865[_0x912c('0x1e')](_0x32b8c5)['send'](_0x3a9fc0);};}exports[_0x912c('0x25')]=function(_0x24c2f2,_0x58ed35){var _0xefc100={},_0x46e8aa={},_0x2dbf14={'count':0x0,'rows':[]};var _0x188790=_['map'](db['FaxQueueReport'][_0x912c('0x26')],function(_0x4e1c38){return{'name':_0x4e1c38[_0x912c('0x27')],'type':_0x4e1c38[_0x912c('0x28')][_0x912c('0x29')]};});_0x46e8aa[_0x912c('0x2a')]=_[_0x912c('0x2b')](_0x188790,'name');_0x46e8aa[_0x912c('0x2c')]=_[_0x912c('0x2d')](_0x24c2f2[_0x912c('0x2c')]);_0x46e8aa['filters']=_[_0x912c('0x2e')](_0x46e8aa['model'],_0x46e8aa['query']);_0xefc100['attributes']=_[_0x912c('0x2e')](_0x46e8aa['model'],qs[_0x912c('0x2f')](_0x24c2f2[_0x912c('0x2c')]['fields']));_0xefc100[_0x912c('0x30')]=_0xefc100['attributes'][_0x912c('0x31')]?_0xefc100[_0x912c('0x30')]:_0x46e8aa[_0x912c('0x2a')];if(!_0x24c2f2[_0x912c('0x2c')][_0x912c('0x32')](_0x912c('0x33'))){_0xefc100['limit']=qs[_0x912c('0x1c')](_0x24c2f2[_0x912c('0x2c')][_0x912c('0x1c')]);_0xefc100['offset']=qs['offset'](_0x24c2f2[_0x912c('0x2c')][_0x912c('0x1a')]);}_0xefc100[_0x912c('0x34')]=qs[_0x912c('0x35')](_0x24c2f2[_0x912c('0x2c')][_0x912c('0x35')]);_0xefc100[_0x912c('0x36')]=qs['filters'](_['pick'](_0x24c2f2['query'],_0x46e8aa[_0x912c('0x37')]),_0x188790);if(_0x24c2f2[_0x912c('0x2c')][_0x912c('0x38')]){_0xefc100[_0x912c('0x36')]=_[_0x912c('0x39')](_0xefc100[_0x912c('0x36')],{'$or':_[_0x912c('0x2b')](_0x188790,function(_0x5c2554){if(_0x5c2554[_0x912c('0x28')]!==_0x912c('0x3a')){var _0x42c851={};_0x42c851[_0x5c2554['name']]={'$like':'%'+_0x24c2f2['query'][_0x912c('0x38')]+'%'};return _0x42c851;}})});}_0xefc100=_[_0x912c('0x39')]({},_0xefc100,_0x24c2f2[_0x912c('0x3b')]);var _0x3cf875={'where':_0xefc100[_0x912c('0x36')]};return db[_0x912c('0x3c')][_0x912c('0x1d')](_0x3cf875)['then'](function(_0x4e488c){_0x2dbf14['count']=_0x4e488c;if(_0x24c2f2[_0x912c('0x2c')][_0x912c('0x3d')]){_0xefc100[_0x912c('0x3e')]=[{'all':!![]}];}return db[_0x912c('0x3c')][_0x912c('0x3f')](_0xefc100);})[_0x912c('0x21')](function(_0xd1f9f9){_0x2dbf14[_0x912c('0x40')]=_0xd1f9f9;return _0x2dbf14;})[_0x912c('0x21')](respondWithFilteredResult(_0x58ed35,_0xefc100))[_0x912c('0x41')](handleError(_0x58ed35,null));};exports[_0x912c('0x42')]=function(_0x21b192,_0x1b83c4){var _0x2d3ae5={'raw':!![],'where':{'id':_0x21b192[_0x912c('0x43')]['id']}},_0x47babc={};_0x47babc[_0x912c('0x2a')]=_[_0x912c('0x2d')](db[_0x912c('0x3c')][_0x912c('0x26')]);_0x47babc[_0x912c('0x2c')]=_[_0x912c('0x2d')](_0x21b192['query']);_0x47babc['filters']=_[_0x912c('0x2e')](_0x47babc['model'],_0x47babc[_0x912c('0x2c')]);_0x2d3ae5[_0x912c('0x30')]=_[_0x912c('0x2e')](_0x47babc[_0x912c('0x2a')],qs[_0x912c('0x2f')](_0x21b192[_0x912c('0x2c')][_0x912c('0x2f')]));_0x2d3ae5[_0x912c('0x30')]=_0x2d3ae5['attributes']['length']?_0x2d3ae5[_0x912c('0x30')]:_0x47babc[_0x912c('0x2a')];if(_0x21b192[_0x912c('0x2c')][_0x912c('0x3d')]){_0x2d3ae5[_0x912c('0x3e')]=[{'all':!![]}];}_0x2d3ae5=_[_0x912c('0x39')]({},_0x2d3ae5,_0x21b192[_0x912c('0x3b')]);return db['FaxQueueReport'][_0x912c('0x44')](_0x2d3ae5)[_0x912c('0x21')](handleEntityNotFound(_0x1b83c4,null))[_0x912c('0x21')](respondWithResult(_0x1b83c4,null))['catch'](handleError(_0x1b83c4,null));};exports['create']=function(_0x255909,_0x13c317){return db[_0x912c('0x3c')][_0x912c('0x45')](_0x255909[_0x912c('0x46')],{})[_0x912c('0x21')](respondWithResult(_0x13c317,0xc9))[_0x912c('0x41')](handleError(_0x13c317,null));};exports['update']=function(_0x3e7a8a,_0x121c09){if(_0x3e7a8a[_0x912c('0x46')]['id']){delete _0x3e7a8a[_0x912c('0x46')]['id'];}return db['FaxQueueReport'][_0x912c('0x44')]({'where':{'id':_0x3e7a8a['params']['id']}})[_0x912c('0x21')](handleEntityNotFound(_0x121c09,null))['then'](saveUpdates(_0x3e7a8a['body'],null))[_0x912c('0x21')](respondWithResult(_0x121c09,null))[_0x912c('0x41')](handleError(_0x121c09,null));};exports['destroy']=function(_0x2b90a1,_0xdf8253){return db['FaxQueueReport']['find']({'where':{'id':_0x2b90a1[_0x912c('0x43')]['id']}})[_0x912c('0x21')](handleEntityNotFound(_0xdf8253,null))[_0x912c('0x21')](removeEntity(_0xdf8253,null))['catch'](handleError(_0xdf8253,null));};exports[_0x912c('0x47')]=function(_0x2b14af,_0x461f51){return db[_0x912c('0x3c')][_0x912c('0x47')]()['then'](respondWithResult(_0x461f51,null))[_0x912c('0x41')](handleError(_0x461f51,null));}; \ No newline at end of file +var _0x6597=['keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','index','map','FaxQueueReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x6597,0x16e));var _0x7659=function(_0x48c4a5,_0x524266){_0x48c4a5=_0x48c4a5-0x0;var _0x54bbad=_0x6597[_0x48c4a5];return _0x54bbad;};'use strict';var emlformat=require(_0x7659('0x0'));var rimraf=require(_0x7659('0x1'));var zipdir=require(_0x7659('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7659('0x3'));var moment=require('moment');var BPromise=require(_0x7659('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7659('0x5'));var csv=require(_0x7659('0x6'));var ejs=require(_0x7659('0x7'));var fs=require('fs');var fs_extra=require(_0x7659('0x8'));var _=require(_0x7659('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7659('0xa'));var deskjs=require(_0x7659('0xb'));var toCsv=require(_0x7659('0x6'));var querystring=require(_0x7659('0xc'));var Papa=require('papaparse');var Redis=require(_0x7659('0xd'));var authService=require(_0x7659('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7659('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7659('0x10'))('api');var utils=require(_0x7659('0x11'));var config=require(_0x7659('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x7659('0x13'))['db'];function respondWithStatusCode(_0x33271e,_0x5967d7){_0x5967d7=_0x5967d7||0xcc;return function(_0x56c2a0){if(_0x56c2a0){return _0x33271e['sendStatus'](_0x5967d7);}return _0x33271e['status'](_0x5967d7)[_0x7659('0x14')]();};}function respondWithResult(_0x271294,_0x3e4429){_0x3e4429=_0x3e4429||0xc8;return function(_0x8ebee){if(_0x8ebee){return _0x271294[_0x7659('0x15')](_0x3e4429)['json'](_0x8ebee);}};}function respondWithFilteredResult(_0x5a1101,_0x454cdd){return function(_0x2bea71){if(_0x2bea71){var _0x70a8e4=typeof _0x454cdd[_0x7659('0x16')]===_0x7659('0x17')&&typeof _0x454cdd[_0x7659('0x18')]==='undefined';var _0x15b084=_0x2bea71[_0x7659('0x19')];var _0x471b17=_0x70a8e4?0x0:_0x454cdd[_0x7659('0x16')];var _0x100953=_0x70a8e4?_0x2bea71[_0x7659('0x19')]:_0x454cdd[_0x7659('0x16')]+_0x454cdd[_0x7659('0x18')];var _0x32edfb;if(_0x100953>=_0x15b084){_0x100953=_0x15b084;_0x32edfb=0xc8;}else{_0x32edfb=0xce;}_0x5a1101[_0x7659('0x15')](_0x32edfb);return _0x5a1101[_0x7659('0x1a')](_0x7659('0x1b'),_0x471b17+'-'+_0x100953+'/'+_0x15b084)[_0x7659('0x1c')](_0x2bea71);}return null;};}function patchUpdates(_0x25704c){return function(_0x363104){try{jsonpatch['apply'](_0x363104,_0x25704c,!![]);}catch(_0x468253){return BPromise[_0x7659('0x1d')](_0x468253);}return _0x363104[_0x7659('0x1e')]();};}function saveUpdates(_0x1692f9,_0x5a491d){return function(_0x5410c7){if(_0x5410c7){return _0x5410c7[_0x7659('0x1f')](_0x1692f9)[_0x7659('0x20')](function(_0x2fa4c0){return _0x2fa4c0;});}return null;};}function removeEntity(_0x57c9e4,_0x45058f){return function(_0x2362ba){if(_0x2362ba){return _0x2362ba[_0x7659('0x21')]()['then'](function(){_0x57c9e4[_0x7659('0x15')](0xcc)[_0x7659('0x14')]();});}};}function handleEntityNotFound(_0x185fb1,_0x1de9bd){return function(_0x2769e6){if(!_0x2769e6){_0x185fb1[_0x7659('0x22')](0x194);}return _0x2769e6;};}function handleError(_0x143410,_0x5b441a){_0x5b441a=_0x5b441a||0x1f4;return function(_0x24967b){logger['error'](_0x24967b[_0x7659('0x23')]);if(_0x24967b[_0x7659('0x24')]){delete _0x24967b['name'];}_0x143410[_0x7659('0x15')](_0x5b441a)['send'](_0x24967b);};}exports[_0x7659('0x25')]=function(_0x325a49,_0x28311e){var _0x5ac899={},_0x99da88={},_0x23da16={'count':0x0,'rows':[]};var _0x19cb02=_[_0x7659('0x26')](db[_0x7659('0x27')][_0x7659('0x28')],function(_0x380093){return{'name':_0x380093['fieldName'],'type':_0x380093['type'][_0x7659('0x29')]};});_0x99da88[_0x7659('0x2a')]=_['map'](_0x19cb02,_0x7659('0x24'));_0x99da88[_0x7659('0x2b')]=_['keys'](_0x325a49[_0x7659('0x2b')]);_0x99da88[_0x7659('0x2c')]=_[_0x7659('0x2d')](_0x99da88['model'],_0x99da88['query']);_0x5ac899[_0x7659('0x2e')]=_[_0x7659('0x2d')](_0x99da88[_0x7659('0x2a')],qs[_0x7659('0x2f')](_0x325a49[_0x7659('0x2b')][_0x7659('0x2f')]));_0x5ac899['attributes']=_0x5ac899['attributes'][_0x7659('0x30')]?_0x5ac899[_0x7659('0x2e')]:_0x99da88[_0x7659('0x2a')];if(!_0x325a49[_0x7659('0x2b')][_0x7659('0x31')](_0x7659('0x32'))){_0x5ac899[_0x7659('0x18')]=qs['limit'](_0x325a49[_0x7659('0x2b')][_0x7659('0x18')]);_0x5ac899[_0x7659('0x16')]=qs[_0x7659('0x16')](_0x325a49[_0x7659('0x2b')][_0x7659('0x16')]);}_0x5ac899[_0x7659('0x33')]=qs[_0x7659('0x34')](_0x325a49['query'][_0x7659('0x34')]);_0x5ac899['where']=qs[_0x7659('0x2c')](_[_0x7659('0x35')](_0x325a49[_0x7659('0x2b')],_0x99da88[_0x7659('0x2c')]),_0x19cb02);if(_0x325a49[_0x7659('0x2b')][_0x7659('0x36')]){_0x5ac899[_0x7659('0x37')]=_['merge'](_0x5ac899[_0x7659('0x37')],{'$or':_[_0x7659('0x26')](_0x19cb02,function(_0x564005){if(_0x564005[_0x7659('0x38')]!==_0x7659('0x39')){var _0x26088a={};_0x26088a[_0x564005[_0x7659('0x24')]]={'$like':'%'+_0x325a49[_0x7659('0x2b')][_0x7659('0x36')]+'%'};return _0x26088a;}})});}_0x5ac899=_[_0x7659('0x3a')]({},_0x5ac899,_0x325a49[_0x7659('0x3b')]);var _0x260e5d={'where':_0x5ac899[_0x7659('0x37')]};return db[_0x7659('0x27')][_0x7659('0x19')](_0x260e5d)['then'](function(_0x5eabf7){_0x23da16[_0x7659('0x19')]=_0x5eabf7;if(_0x325a49[_0x7659('0x2b')][_0x7659('0x3c')]){_0x5ac899['include']=[{'all':!![]}];}return db[_0x7659('0x27')][_0x7659('0x3d')](_0x5ac899);})['then'](function(_0xf342bb){_0x23da16[_0x7659('0x3e')]=_0xf342bb;return _0x23da16;})[_0x7659('0x20')](respondWithFilteredResult(_0x28311e,_0x5ac899))[_0x7659('0x3f')](handleError(_0x28311e,null));};exports[_0x7659('0x40')]=function(_0x3b9a8d,_0x112bf2){var _0x32f277={'raw':!![],'where':{'id':_0x3b9a8d[_0x7659('0x41')]['id']}},_0x19dfc8={};_0x19dfc8[_0x7659('0x2a')]=_[_0x7659('0x42')](db[_0x7659('0x27')][_0x7659('0x28')]);_0x19dfc8[_0x7659('0x2b')]=_[_0x7659('0x42')](_0x3b9a8d[_0x7659('0x2b')]);_0x19dfc8[_0x7659('0x2c')]=_[_0x7659('0x2d')](_0x19dfc8['model'],_0x19dfc8[_0x7659('0x2b')]);_0x32f277[_0x7659('0x2e')]=_[_0x7659('0x2d')](_0x19dfc8['model'],qs[_0x7659('0x2f')](_0x3b9a8d[_0x7659('0x2b')][_0x7659('0x2f')]));_0x32f277[_0x7659('0x2e')]=_0x32f277[_0x7659('0x2e')][_0x7659('0x30')]?_0x32f277[_0x7659('0x2e')]:_0x19dfc8[_0x7659('0x2a')];if(_0x3b9a8d['query'][_0x7659('0x3c')]){_0x32f277[_0x7659('0x43')]=[{'all':!![]}];}_0x32f277=_['merge']({},_0x32f277,_0x3b9a8d[_0x7659('0x3b')]);return db['FaxQueueReport'][_0x7659('0x44')](_0x32f277)[_0x7659('0x20')](handleEntityNotFound(_0x112bf2,null))[_0x7659('0x20')](respondWithResult(_0x112bf2,null))['catch'](handleError(_0x112bf2,null));};exports[_0x7659('0x45')]=function(_0x127c17,_0x2f54bd){return db['FaxQueueReport'][_0x7659('0x45')](_0x127c17[_0x7659('0x46')],{})[_0x7659('0x20')](respondWithResult(_0x2f54bd,0xc9))[_0x7659('0x3f')](handleError(_0x2f54bd,null));};exports['update']=function(_0x44bcc8,_0x4849d9){if(_0x44bcc8[_0x7659('0x46')]['id']){delete _0x44bcc8['body']['id'];}return db[_0x7659('0x27')][_0x7659('0x44')]({'where':{'id':_0x44bcc8[_0x7659('0x41')]['id']}})[_0x7659('0x20')](handleEntityNotFound(_0x4849d9,null))[_0x7659('0x20')](saveUpdates(_0x44bcc8[_0x7659('0x46')],null))[_0x7659('0x20')](respondWithResult(_0x4849d9,null))['catch'](handleError(_0x4849d9,null));};exports[_0x7659('0x21')]=function(_0x2939dd,_0x308a50){return db[_0x7659('0x27')][_0x7659('0x44')]({'where':{'id':_0x2939dd[_0x7659('0x41')]['id']}})[_0x7659('0x20')](handleEntityNotFound(_0x308a50,null))['then'](removeEntity(_0x308a50,null))['catch'](handleError(_0x308a50,null));};exports[_0x7659('0x47')]=function(_0x5da810,_0x14eefe){return db[_0x7659('0x27')][_0x7659('0x47')]()[_0x7659('0x20')](respondWithResult(_0x14eefe,null))[_0x7659('0x3f')](handleError(_0x14eefe,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 16bd201..a5c2817 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4a0753,_0x75bbc9){_0x4a0753=_0x4a0753-0x0;var _0x2160f5=_0x1cb9[_0x4a0753];return _0x2160f5;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x39b2b9,_0x4e76f6){var _0x4215a4=function(_0x5b0cd7){while(--_0x5b0cd7){_0x39b2b9['push'](_0x39b2b9['shift']());}};_0x4215a4(++_0x4e76f6);}(_0xabce,0x103));var _0xeabc=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xabce[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 6222a13..3bf759f 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 _0xe761=['raw','update','where','limit','UpdateFaxQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options'];(function(_0x2bc0c5,_0x3cfc33){var _0x6d26e8=function(_0x20abfa){while(--_0x20abfa){_0x2bc0c5['push'](_0x2bc0c5['shift']());}};_0x6d26e8(++_0x3cfc33);}(_0xe761,0x1e5));var _0x1e76=function(_0x2211ed,_0x1bca0b){_0x2211ed=_0x2211ed-0x0;var _0x4d78cc=_0xe761[_0x2211ed];return _0x4d78cc;};'use strict';var _=require('lodash');var util=require(_0x1e76('0x0'));var moment=require(_0x1e76('0x1'));var BPromise=require(_0x1e76('0x2'));var rs=require(_0x1e76('0x3'));var fs=require('fs');var Redis=require(_0x1e76('0x4'));var db=require(_0x1e76('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e76('0x6'))(_0x1e76('0x7'));var config=require(_0x1e76('0x8'));var jayson=require(_0x1e76('0x9'));var client=jayson['client'][_0x1e76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d3165,_0x4bd049,_0x19560c){return new BPromise(function(_0x870a0e,_0x4a237f){return client[_0x1e76('0xb')](_0x5d3165,_0x19560c)[_0x1e76('0xc')](function(_0x4441fd){logger[_0x1e76('0xd')](_0x1e76('0xe'),_0x4bd049,_0x1e76('0xf'));logger['debug'](_0x1e76('0x10'),_0x4bd049,_0x1e76('0xf'),JSON[_0x1e76('0x11')](_0x4441fd));if(_0x4441fd['error']){if(_0x4441fd[_0x1e76('0x12')][_0x1e76('0x13')]===0x1f4){logger[_0x1e76('0x12')](_0x1e76('0xe'),_0x4bd049,_0x4441fd['error'][_0x1e76('0x14')]);return _0x4a237f(_0x4441fd[_0x1e76('0x12')][_0x1e76('0x14')]);}logger[_0x1e76('0x12')](_0x1e76('0xe'),_0x4bd049,_0x4441fd[_0x1e76('0x12')][_0x1e76('0x14')]);return _0x870a0e(_0x4441fd['error']['message']);}else{logger[_0x1e76('0xd')](_0x1e76('0xe'),_0x4bd049,'request\x20sent');_0x870a0e(_0x4441fd[_0x1e76('0x15')][_0x1e76('0x14')]);}})[_0x1e76('0x16')](function(_0x4be64e){logger[_0x1e76('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x4bd049,_0x4be64e);_0x4a237f(_0x4be64e);});});}exports[_0x1e76('0x17')]=function(_0x30a8d1){var _0x384d77=this;return new Promise(function(_0x42fddd,_0x403834){return db[_0x1e76('0x18')]['create'](_0x30a8d1[_0x1e76('0x19')],{'raw':_0x30a8d1[_0x1e76('0x1a')]?_0x30a8d1[_0x1e76('0x1a')][_0x1e76('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xf2319c){logger[_0x1e76('0xd')](_0x1e76('0x17'),_0x30a8d1);logger['debug'](_0x1e76('0x17'),_0x30a8d1,JSON[_0x1e76('0x11')](_0xf2319c));_0x42fddd(_0xf2319c);})[_0x1e76('0x16')](function(_0x45df83){logger[_0x1e76('0x12')](_0x1e76('0x17'),_0x45df83['message'],_0x30a8d1);_0x403834(_0x384d77[_0x1e76('0x12')](0x1f4,_0x45df83[_0x1e76('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x3fcf33){var _0x2c219=this;return new Promise(function(_0x569aac,_0x39660d){return db[_0x1e76('0x18')][_0x1e76('0x1c')](_0x3fcf33['body'],{'raw':_0x3fcf33[_0x1e76('0x1a')]?_0x3fcf33['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fcf33[_0x1e76('0x1a')]?_0x3fcf33[_0x1e76('0x1a')][_0x1e76('0x1d')]||null:null,'attributes':_0x3fcf33['options']?_0x3fcf33[_0x1e76('0x1a')]['attributes']||null:null,'limit':_0x3fcf33['options']?_0x3fcf33[_0x1e76('0x1a')][_0x1e76('0x1e')]||null:null})['then'](function(_0x17aeb2){logger[_0x1e76('0xd')](_0x1e76('0x1f'),_0x3fcf33);logger['debug'](_0x1e76('0x1f'),_0x3fcf33,JSON[_0x1e76('0x11')](_0x17aeb2));_0x569aac(_0x17aeb2);})['catch'](function(_0x2c261f){logger[_0x1e76('0x12')](_0x1e76('0x1f'),_0x2c261f[_0x1e76('0x14')],_0x3fcf33);_0x39660d(_0x2c219[_0x1e76('0x12')](0x1f4,_0x2c261f[_0x1e76('0x14')]));});});}; \ No newline at end of file +var _0xb119=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateFaxQueueReport','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','body','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x25384c,_0x54e362){var _0x16298a=function(_0x57df38){while(--_0x57df38){_0x25384c['push'](_0x25384c['shift']());}};_0x16298a(++_0x54e362);}(_0xb119,0x1db));var _0x9b11=function(_0xc4cc56,_0x8e32b1){_0xc4cc56=_0xc4cc56-0x0;var _0x2956ed=_0xb119[_0xc4cc56];return _0x2956ed;};'use strict';var _=require('lodash');var util=require(_0x9b11('0x0'));var moment=require(_0x9b11('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b11('0x2'));var fs=require('fs');var Redis=require(_0x9b11('0x3'));var db=require(_0x9b11('0x4'))['db'];var utils=require(_0x9b11('0x5'));var logger=require(_0x9b11('0x6'))('rpc');var config=require(_0x9b11('0x7'));var jayson=require(_0x9b11('0x8'));var client=jayson[_0x9b11('0x9')][_0x9b11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39d189,_0x267f88,_0x257b37){return new BPromise(function(_0x4972f8,_0x37e525){return client[_0x9b11('0xb')](_0x39d189,_0x257b37)[_0x9b11('0xc')](function(_0x25c3e2){logger[_0x9b11('0xd')](_0x9b11('0xe'),_0x267f88,_0x9b11('0xf'));logger[_0x9b11('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x267f88,_0x9b11('0xf'),JSON[_0x9b11('0x11')](_0x25c3e2));if(_0x25c3e2['error']){if(_0x25c3e2[_0x9b11('0x12')][_0x9b11('0x13')]===0x1f4){logger['error'](_0x9b11('0xe'),_0x267f88,_0x25c3e2[_0x9b11('0x12')][_0x9b11('0x14')]);return _0x37e525(_0x25c3e2['error'][_0x9b11('0x14')]);}logger[_0x9b11('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x267f88,_0x25c3e2[_0x9b11('0x12')][_0x9b11('0x14')]);return _0x4972f8(_0x25c3e2[_0x9b11('0x12')]['message']);}else{logger['info'](_0x9b11('0xe'),_0x267f88,'request\x20sent');_0x4972f8(_0x25c3e2['result'][_0x9b11('0x14')]);}})[_0x9b11('0x15')](function(_0x435a98){logger['error'](_0x9b11('0xe'),_0x267f88,_0x435a98);_0x37e525(_0x435a98);});});}exports[_0x9b11('0x16')]=function(_0x88211c){var _0x3a2eb2=this;return new Promise(function(_0x2d724e,_0x515a27){return db['FaxQueueReport']['create'](_0x88211c['body'],{'raw':_0x88211c[_0x9b11('0x17')]?_0x88211c[_0x9b11('0x17')][_0x9b11('0x18')]===undefined?!![]:![]:!![]})[_0x9b11('0xc')](function(_0x39dcfe){logger[_0x9b11('0xd')](_0x9b11('0x16'),_0x88211c);logger[_0x9b11('0x10')]('CreateFaxQueueReport',_0x88211c,JSON[_0x9b11('0x11')](_0x39dcfe));_0x2d724e(_0x39dcfe);})[_0x9b11('0x15')](function(_0x268601){logger[_0x9b11('0x12')](_0x9b11('0x16'),_0x268601[_0x9b11('0x14')],_0x88211c);_0x515a27(_0x3a2eb2[_0x9b11('0x12')](0x1f4,_0x268601[_0x9b11('0x14')]));});});};exports[_0x9b11('0x19')]=function(_0x41ef45){var _0x3d5c5a=this;return new Promise(function(_0x42f3a4,_0xfbb352){return db[_0x9b11('0x1a')][_0x9b11('0x1b')](_0x41ef45[_0x9b11('0x1c')],{'raw':_0x41ef45[_0x9b11('0x17')]?_0x41ef45[_0x9b11('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41ef45[_0x9b11('0x17')]?_0x41ef45[_0x9b11('0x17')][_0x9b11('0x1d')]||null:null,'attributes':_0x41ef45[_0x9b11('0x17')]?_0x41ef45[_0x9b11('0x17')][_0x9b11('0x1e')]||null:null,'limit':_0x41ef45[_0x9b11('0x17')]?_0x41ef45['options'][_0x9b11('0x1f')]||null:null})[_0x9b11('0xc')](function(_0x3a5cbc){logger[_0x9b11('0xd')](_0x9b11('0x19'),_0x41ef45);logger[_0x9b11('0x10')](_0x9b11('0x19'),_0x41ef45,JSON[_0x9b11('0x11')](_0x3a5cbc));_0x42f3a4(_0x3a5cbc);})['catch'](function(_0x37c3fe){logger[_0x9b11('0x12')]('UpdateFaxQueueReport',_0x37c3fe[_0x9b11('0x14')],_0x41ef45);_0xfbb352(_0x3d5c5a[_0x9b11('0x12')](0x1f4,_0x37c3fe[_0x9b11('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 47edcff..4d4b793 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 _0x599b=['isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x12ec19,_0x4e120a){var _0x513efc=function(_0x50c7f6){while(--_0x50c7f6){_0x12ec19['push'](_0x12ec19['shift']());}};_0x513efc(++_0x4e120a);}(_0x599b,0x1ef));var _0xb599=function(_0x5171fb,_0x99f138){_0x5171fb=_0x5171fb-0x0;var _0x655db9=_0x599b[_0x5171fb];return _0x655db9;};'use strict';var multer=require('multer');var util=require(_0xb599('0x0'));var path=require(_0xb599('0x1'));var timeout=require(_0xb599('0x2'));var express=require(_0xb599('0x3'));var router=express[_0xb599('0x4')]();var fs_extra=require(_0xb599('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb599('0x6'));var config=require(_0xb599('0x7'));var controller=require('./faxQueueReport.controller');router[_0xb599('0x8')]('/',auth[_0xb599('0x9')](),controller[_0xb599('0xa')]);router[_0xb599('0x8')](_0xb599('0xb'),auth[_0xb599('0x9')](),controller['describe']);router[_0xb599('0x8')](_0xb599('0xc'),auth['isAuthenticated'](),controller[_0xb599('0xd')]);router['post']('/',auth[_0xb599('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb599('0xe')]);router[_0xb599('0xf')](_0xb599('0xc'),auth[_0xb599('0x9')](),controller[_0xb599('0x10')]);module[_0xb599('0x11')]=router; \ No newline at end of file +var _0xfe5f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5919ef,_0x28cde9){var _0xd2f76=function(_0x25ff8b){while(--_0x25ff8b){_0x5919ef['push'](_0x5919ef['shift']());}};_0xd2f76(++_0x28cde9);}(_0xfe5f,0x1ca));var _0xffe5=function(_0xbe165e,_0x3a37e6){_0xbe165e=_0xbe165e-0x0;var _0x1c19e1=_0xfe5f[_0xbe165e];return _0x1c19e1;};'use strict';var multer=require(_0xffe5('0x0'));var util=require(_0xffe5('0x1'));var path=require(_0xffe5('0x2'));var timeout=require(_0xffe5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xffe5('0x4'));var auth=require(_0xffe5('0x5'));var interaction=require(_0xffe5('0x6'));var config=require(_0xffe5('0x7'));var controller=require(_0xffe5('0x8'));router[_0xffe5('0x9')]('/',auth[_0xffe5('0xa')](),controller[_0xffe5('0xb')]);router['get'](_0xffe5('0xc'),auth[_0xffe5('0xa')](),controller['describe']);router[_0xffe5('0x9')](_0xffe5('0xd'),auth[_0xffe5('0xa')](),controller[_0xffe5('0xe')]);router[_0xffe5('0xf')]('/',auth[_0xffe5('0xa')](),controller[_0xffe5('0x10')]);router[_0xffe5('0x11')]('/:id',auth[_0xffe5('0xa')](),controller[_0xffe5('0x12')]);router[_0xffe5('0x13')](_0xffe5('0xd'),auth[_0xffe5('0xa')](),controller[_0xffe5('0x14')]);module[_0xffe5('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 8837171..21129cf 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(_0x459ce0,_0x9c5f73){var _0x568da9=function(_0x4cd6ed){while(--_0x4cd6ed){_0x459ce0['push'](_0x459ce0['shift']());}};_0x568da9(++_0x9c5f73);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1f6691,_0x3a3d46){_0x1f6691=_0x1f6691-0x0;var _0xf786b6=_0xf3cd[_0x1f6691];return _0xf786b6;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x555c17,_0x2e6c2a){var _0x15a073=function(_0x411a4f){while(--_0x411a4f){_0x555c17['push'](_0x555c17['shift']());}};_0x15a073(++_0x2e6c2a);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e1b0c8a..b578f45 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 _0xad6b=['nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x28b339,_0x3544c8){var _0x3d45ee=function(_0x4effa0){while(--_0x4effa0){_0x28b339['push'](_0x28b339['shift']());}};_0x3d45ee(++_0x3544c8);}(_0xad6b,0xee));var _0xbad6=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xad6b[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0xbad6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbad6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbad6('0x2'));var moment=require(_0xbad6('0x3'));var BPromise=require(_0xbad6('0x4'));var Mustache=require(_0xbad6('0x5'));var util=require('util');var path=require(_0xbad6('0x6'));var sox=require(_0xbad6('0x7'));var csv=require(_0xbad6('0x8'));var ejs=require(_0xbad6('0x9'));var fs=require('fs');var fs_extra=require(_0xbad6('0xa'));var _=require(_0xbad6('0xb'));var squel=require(_0xbad6('0xc'));var crypto=require(_0xbad6('0xd'));var jsforce=require(_0xbad6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbad6('0x8'));var querystring=require(_0xbad6('0xf'));var Papa=require('papaparse');var Redis=require(_0xbad6('0x10'));var authService=require(_0xbad6('0x11'));var qs=require(_0xbad6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbad6('0x13'));var logger=require('../../config/logger')(_0xbad6('0x14'));var utils=require(_0xbad6('0x15'));var config=require(_0xbad6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbad6('0x17'))['db'];function respondWithStatusCode(_0x4326e5,_0x5066e0){_0x5066e0=_0x5066e0||0xcc;return function(_0x2f1736){if(_0x2f1736){return _0x4326e5[_0xbad6('0x18')](_0x5066e0);}return _0x4326e5[_0xbad6('0x19')](_0x5066e0)[_0xbad6('0x1a')]();};}function respondWithResult(_0x21f48f,_0x18b31e){_0x18b31e=_0x18b31e||0xc8;return function(_0x4b5e28){if(_0x4b5e28){return _0x21f48f['status'](_0x18b31e)['json'](_0x4b5e28);}};}function respondWithFilteredResult(_0x51f3a6,_0x34600d){return function(_0xdaafc){if(_0xdaafc){var _0x5111ff=typeof _0x34600d['offset']===_0xbad6('0x1b')&&typeof _0x34600d[_0xbad6('0x1c')]===_0xbad6('0x1b');var _0x16d3e7=_0xdaafc[_0xbad6('0x1d')];var _0x5c84c=_0x5111ff?0x0:_0x34600d[_0xbad6('0x1e')];var _0x12c14c=_0x5111ff?_0xdaafc['count']:_0x34600d[_0xbad6('0x1e')]+_0x34600d[_0xbad6('0x1c')];var _0x440e22;if(_0x12c14c>=_0x16d3e7){_0x12c14c=_0x16d3e7;_0x440e22=0xc8;}else{_0x440e22=0xce;}_0x51f3a6[_0xbad6('0x19')](_0x440e22);return _0x51f3a6[_0xbad6('0x1f')](_0xbad6('0x20'),_0x5c84c+'-'+_0x12c14c+'/'+_0x16d3e7)[_0xbad6('0x21')](_0xdaafc);}return null;};}function patchUpdates(_0x3ef165){return function(_0x2e7915){try{jsonpatch['apply'](_0x2e7915,_0x3ef165,!![]);}catch(_0x2578ef){return BPromise[_0xbad6('0x22')](_0x2578ef);}return _0x2e7915[_0xbad6('0x23')]();};}function saveUpdates(_0x575624,_0x5b349a){return function(_0x120b00){if(_0x120b00){return _0x120b00[_0xbad6('0x24')](_0x575624)[_0xbad6('0x25')](function(_0x2262d3){return _0x2262d3;});}return null;};}function removeEntity(_0x112a25,_0x4b7d0a){return function(_0x5e9387){if(_0x5e9387){return _0x5e9387[_0xbad6('0x26')]()['then'](function(){_0x112a25[_0xbad6('0x19')](0xcc)[_0xbad6('0x1a')]();});}};}function handleEntityNotFound(_0x3b11fa,_0x4bf202){return function(_0x3e7856){if(!_0x3e7856){_0x3b11fa[_0xbad6('0x18')](0x194);}return _0x3e7856;};}function handleError(_0x4bb4f9,_0x2a9a3a){_0x2a9a3a=_0x2a9a3a||0x1f4;return function(_0xa88aec){logger['error'](_0xa88aec['stack']);if(_0xa88aec[_0xbad6('0x27')]){delete _0xa88aec['name'];}_0x4bb4f9['status'](_0x2a9a3a)[_0xbad6('0x28')](_0xa88aec);};}exports[_0xbad6('0x29')]=function(_0x392d1c,_0x36ff99){var _0x2647bd={},_0x35df94={},_0x5f085f={'count':0x0,'rows':[]};var _0xce3a75=_['map'](db[_0xbad6('0x2a')][_0xbad6('0x2b')],function(_0x422a36){return{'name':_0x422a36[_0xbad6('0x2c')],'type':_0x422a36[_0xbad6('0x2d')]['key']};});_0x35df94[_0xbad6('0x2e')]=_[_0xbad6('0x2f')](_0xce3a75,'name');_0x35df94['query']=_['keys'](_0x392d1c[_0xbad6('0x30')]);_0x35df94[_0xbad6('0x31')]=_[_0xbad6('0x32')](_0x35df94[_0xbad6('0x2e')],_0x35df94[_0xbad6('0x30')]);_0x2647bd[_0xbad6('0x33')]=_['intersection'](_0x35df94['model'],qs['fields'](_0x392d1c['query'][_0xbad6('0x34')]));_0x2647bd[_0xbad6('0x33')]=_0x2647bd[_0xbad6('0x33')]['length']?_0x2647bd[_0xbad6('0x33')]:_0x35df94[_0xbad6('0x2e')];if(!_0x392d1c['query'][_0xbad6('0x35')](_0xbad6('0x36'))){_0x2647bd[_0xbad6('0x1c')]=qs[_0xbad6('0x1c')](_0x392d1c[_0xbad6('0x30')][_0xbad6('0x1c')]);_0x2647bd[_0xbad6('0x1e')]=qs['offset'](_0x392d1c[_0xbad6('0x30')][_0xbad6('0x1e')]);}_0x2647bd[_0xbad6('0x37')]=qs['sort'](_0x392d1c['query']['sort']);_0x2647bd[_0xbad6('0x38')]=qs[_0xbad6('0x31')](_[_0xbad6('0x39')](_0x392d1c[_0xbad6('0x30')],_0x35df94['filters']),_0xce3a75);if(_0x392d1c[_0xbad6('0x30')]['filter']){_0x2647bd['where']=_[_0xbad6('0x3a')](_0x2647bd[_0xbad6('0x38')],{'$or':_[_0xbad6('0x2f')](_0xce3a75,function(_0x2ff3a1){if(_0x2ff3a1[_0xbad6('0x2d')]!==_0xbad6('0x3b')){var _0x3a1a0e={};_0x3a1a0e[_0x2ff3a1[_0xbad6('0x27')]]={'$like':'%'+_0x392d1c[_0xbad6('0x30')]['filter']+'%'};return _0x3a1a0e;}})});}_0x2647bd=_[_0xbad6('0x3a')]({},_0x2647bd,_0x392d1c[_0xbad6('0x3c')]);var _0x27e12f={'where':_0x2647bd[_0xbad6('0x38')]};return db[_0xbad6('0x2a')][_0xbad6('0x1d')](_0x27e12f)[_0xbad6('0x25')](function(_0x507a83){_0x5f085f[_0xbad6('0x1d')]=_0x507a83;if(_0x392d1c[_0xbad6('0x30')][_0xbad6('0x3d')]){_0x2647bd[_0xbad6('0x3e')]=[{'all':!![]}];}return db[_0xbad6('0x2a')][_0xbad6('0x3f')](_0x2647bd);})[_0xbad6('0x25')](function(_0x5d975b){_0x5f085f[_0xbad6('0x40')]=_0x5d975b;return _0x5f085f;})['then'](respondWithFilteredResult(_0x36ff99,_0x2647bd))['catch'](handleError(_0x36ff99,null));};exports[_0xbad6('0x41')]=function(_0x4d988b,_0x5dbcaa){var _0x42ac75={'raw':!![],'where':{'id':_0x4d988b[_0xbad6('0x42')]['id']}},_0x499a0b={};_0x499a0b[_0xbad6('0x2e')]=_[_0xbad6('0x43')](db[_0xbad6('0x2a')]['rawAttributes']);_0x499a0b[_0xbad6('0x30')]=_[_0xbad6('0x43')](_0x4d988b[_0xbad6('0x30')]);_0x499a0b[_0xbad6('0x31')]=_[_0xbad6('0x32')](_0x499a0b['model'],_0x499a0b[_0xbad6('0x30')]);_0x42ac75[_0xbad6('0x33')]=_[_0xbad6('0x32')](_0x499a0b[_0xbad6('0x2e')],qs['fields'](_0x4d988b[_0xbad6('0x30')]['fields']));_0x42ac75[_0xbad6('0x33')]=_0x42ac75['attributes']['length']?_0x42ac75[_0xbad6('0x33')]:_0x499a0b[_0xbad6('0x2e')];if(_0x4d988b['query'][_0xbad6('0x3d')]){_0x42ac75['include']=[{'all':!![]}];}_0x42ac75=_[_0xbad6('0x3a')]({},_0x42ac75,_0x4d988b[_0xbad6('0x3c')]);return db[_0xbad6('0x2a')][_0xbad6('0x44')](_0x42ac75)[_0xbad6('0x25')](handleEntityNotFound(_0x5dbcaa,null))[_0xbad6('0x25')](respondWithResult(_0x5dbcaa,null))[_0xbad6('0x45')](handleError(_0x5dbcaa,null));};exports[_0xbad6('0x46')]=function(_0x52e2de,_0x3563d2){return db[_0xbad6('0x2a')][_0xbad6('0x46')](_0x52e2de[_0xbad6('0x47')],{})[_0xbad6('0x25')](respondWithResult(_0x3563d2,0xc9))['catch'](handleError(_0x3563d2,null));};exports['update']=function(_0x1369e7,_0x4da682){if(_0x1369e7[_0xbad6('0x47')]['id']){delete _0x1369e7[_0xbad6('0x47')]['id'];}return db[_0xbad6('0x2a')][_0xbad6('0x44')]({'where':{'id':_0x1369e7[_0xbad6('0x42')]['id']}})[_0xbad6('0x25')](handleEntityNotFound(_0x4da682,null))[_0xbad6('0x25')](saveUpdates(_0x1369e7['body'],null))[_0xbad6('0x25')](respondWithResult(_0x4da682,null))['catch'](handleError(_0x4da682,null));};exports[_0xbad6('0x26')]=function(_0x513574,_0x39c974){return db[_0xbad6('0x2a')]['find']({'where':{'id':_0x513574['params']['id']}})[_0xbad6('0x25')](handleEntityNotFound(_0x39c974,null))[_0xbad6('0x25')](removeEntity(_0x39c974,null))[_0xbad6('0x45')](handleError(_0x39c974,null));};exports['describe']=function(_0x313e44,_0x46965c){return db[_0xbad6('0x2a')][_0xbad6('0x48')]()[_0xbad6('0x25')](respondWithResult(_0x46965c,null))[_0xbad6('0x45')](handleError(_0x46965c,null));}; \ No newline at end of file +var _0x2b1b=['merge','where','VIRTUAL','filter','includeAll','findAll','rows','catch','show','keys','intersection','include','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','FaxTransferReport','rawAttributes','type','key','model','map','query','filters','fields','attributes','length','order','sort','pick'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2b1b,0xf9));var _0xb2b1=function(_0x58b41d,_0x172c8c){_0x58b41d=_0x58b41d-0x0;var _0x49a46f=_0x2b1b[_0x58b41d];return _0x49a46f;};'use strict';var emlformat=require(_0xb2b1('0x0'));var rimraf=require(_0xb2b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2b1('0x2'));var rp=require(_0xb2b1('0x3'));var moment=require(_0xb2b1('0x4'));var BPromise=require(_0xb2b1('0x5'));var Mustache=require(_0xb2b1('0x6'));var util=require(_0xb2b1('0x7'));var path=require(_0xb2b1('0x8'));var sox=require('sox');var csv=require(_0xb2b1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb2b1('0xa'));var _=require(_0xb2b1('0xb'));var squel=require(_0xb2b1('0xc'));var crypto=require(_0xb2b1('0xd'));var jsforce=require(_0xb2b1('0xe'));var deskjs=require(_0xb2b1('0xf'));var toCsv=require(_0xb2b1('0x9'));var querystring=require(_0xb2b1('0x10'));var Papa=require(_0xb2b1('0x11'));var Redis=require(_0xb2b1('0x12'));var authService=require(_0xb2b1('0x13'));var qs=require(_0xb2b1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2b1('0x15'));var logger=require(_0xb2b1('0x16'))('api');var utils=require(_0xb2b1('0x17'));var config=require(_0xb2b1('0x18'));var licenseUtil=require(_0xb2b1('0x19'));var db=require(_0xb2b1('0x1a'))['db'];function respondWithStatusCode(_0x49f319,_0xf34009){_0xf34009=_0xf34009||0xcc;return function(_0x50f956){if(_0x50f956){return _0x49f319[_0xb2b1('0x1b')](_0xf34009);}return _0x49f319[_0xb2b1('0x1c')](_0xf34009)[_0xb2b1('0x1d')]();};}function respondWithResult(_0x3deab3,_0xcefa1a){_0xcefa1a=_0xcefa1a||0xc8;return function(_0x405d2f){if(_0x405d2f){return _0x3deab3['status'](_0xcefa1a)[_0xb2b1('0x1e')](_0x405d2f);}};}function respondWithFilteredResult(_0x564e30,_0x41d7e9){return function(_0x508b7e){if(_0x508b7e){var _0x36b637=typeof _0x41d7e9[_0xb2b1('0x1f')]===_0xb2b1('0x20')&&typeof _0x41d7e9['limit']==='undefined';var _0x1213bb=_0x508b7e[_0xb2b1('0x21')];var _0x27cdc1=_0x36b637?0x0:_0x41d7e9[_0xb2b1('0x1f')];var _0x41a976=_0x36b637?_0x508b7e['count']:_0x41d7e9[_0xb2b1('0x1f')]+_0x41d7e9[_0xb2b1('0x22')];var _0xf70fa9;if(_0x41a976>=_0x1213bb){_0x41a976=_0x1213bb;_0xf70fa9=0xc8;}else{_0xf70fa9=0xce;}_0x564e30['status'](_0xf70fa9);return _0x564e30[_0xb2b1('0x23')](_0xb2b1('0x24'),_0x27cdc1+'-'+_0x41a976+'/'+_0x1213bb)['json'](_0x508b7e);}return null;};}function patchUpdates(_0x55baac){return function(_0x3f3f11){try{jsonpatch[_0xb2b1('0x25')](_0x3f3f11,_0x55baac,!![]);}catch(_0x5f032d){return BPromise[_0xb2b1('0x26')](_0x5f032d);}return _0x3f3f11['save']();};}function saveUpdates(_0xe30a8d,_0x48e571){return function(_0x5d7be8){if(_0x5d7be8){return _0x5d7be8[_0xb2b1('0x27')](_0xe30a8d)[_0xb2b1('0x28')](function(_0x590a25){return _0x590a25;});}return null;};}function removeEntity(_0x23081a,_0x11f0ca){return function(_0x2f706f){if(_0x2f706f){return _0x2f706f['destroy']()['then'](function(){_0x23081a[_0xb2b1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c1fdb,_0x57cb7b){return function(_0x4c647a){if(!_0x4c647a){_0x2c1fdb[_0xb2b1('0x1b')](0x194);}return _0x4c647a;};}function handleError(_0x345d46,_0xbbff7e){_0xbbff7e=_0xbbff7e||0x1f4;return function(_0x1115f4){logger['error'](_0x1115f4[_0xb2b1('0x29')]);if(_0x1115f4[_0xb2b1('0x2a')]){delete _0x1115f4['name'];}_0x345d46[_0xb2b1('0x1c')](_0xbbff7e)[_0xb2b1('0x2b')](_0x1115f4);};}exports[_0xb2b1('0x2c')]=function(_0x35a807,_0x27949b){var _0x7f3637={},_0x7cd0f6={},_0x2b4a3c={'count':0x0,'rows':[]};var _0x316d64=_['map'](db[_0xb2b1('0x2d')][_0xb2b1('0x2e')],function(_0x3d6f20){return{'name':_0x3d6f20['fieldName'],'type':_0x3d6f20[_0xb2b1('0x2f')][_0xb2b1('0x30')]};});_0x7cd0f6[_0xb2b1('0x31')]=_[_0xb2b1('0x32')](_0x316d64,_0xb2b1('0x2a'));_0x7cd0f6['query']=_['keys'](_0x35a807[_0xb2b1('0x33')]);_0x7cd0f6[_0xb2b1('0x34')]=_['intersection'](_0x7cd0f6[_0xb2b1('0x31')],_0x7cd0f6['query']);_0x7f3637['attributes']=_['intersection'](_0x7cd0f6[_0xb2b1('0x31')],qs[_0xb2b1('0x35')](_0x35a807[_0xb2b1('0x33')]['fields']));_0x7f3637[_0xb2b1('0x36')]=_0x7f3637[_0xb2b1('0x36')][_0xb2b1('0x37')]?_0x7f3637['attributes']:_0x7cd0f6[_0xb2b1('0x31')];if(!_0x35a807[_0xb2b1('0x33')]['hasOwnProperty']('nolimit')){_0x7f3637[_0xb2b1('0x22')]=qs[_0xb2b1('0x22')](_0x35a807[_0xb2b1('0x33')]['limit']);_0x7f3637[_0xb2b1('0x1f')]=qs[_0xb2b1('0x1f')](_0x35a807[_0xb2b1('0x33')][_0xb2b1('0x1f')]);}_0x7f3637[_0xb2b1('0x38')]=qs['sort'](_0x35a807['query'][_0xb2b1('0x39')]);_0x7f3637['where']=qs[_0xb2b1('0x34')](_[_0xb2b1('0x3a')](_0x35a807[_0xb2b1('0x33')],_0x7cd0f6[_0xb2b1('0x34')]),_0x316d64);if(_0x35a807[_0xb2b1('0x33')]['filter']){_0x7f3637['where']=_[_0xb2b1('0x3b')](_0x7f3637[_0xb2b1('0x3c')],{'$or':_[_0xb2b1('0x32')](_0x316d64,function(_0x5ec873){if(_0x5ec873[_0xb2b1('0x2f')]!==_0xb2b1('0x3d')){var _0x3e19b1={};_0x3e19b1[_0x5ec873[_0xb2b1('0x2a')]]={'$like':'%'+_0x35a807[_0xb2b1('0x33')][_0xb2b1('0x3e')]+'%'};return _0x3e19b1;}})});}_0x7f3637=_[_0xb2b1('0x3b')]({},_0x7f3637,_0x35a807['options']);var _0x1923db={'where':_0x7f3637[_0xb2b1('0x3c')]};return db[_0xb2b1('0x2d')][_0xb2b1('0x21')](_0x1923db)['then'](function(_0x5e9651){_0x2b4a3c['count']=_0x5e9651;if(_0x35a807[_0xb2b1('0x33')][_0xb2b1('0x3f')]){_0x7f3637['include']=[{'all':!![]}];}return db[_0xb2b1('0x2d')][_0xb2b1('0x40')](_0x7f3637);})[_0xb2b1('0x28')](function(_0x3909b9){_0x2b4a3c[_0xb2b1('0x41')]=_0x3909b9;return _0x2b4a3c;})[_0xb2b1('0x28')](respondWithFilteredResult(_0x27949b,_0x7f3637))[_0xb2b1('0x42')](handleError(_0x27949b,null));};exports[_0xb2b1('0x43')]=function(_0x1213f1,_0x25b6e7){var _0x3a3694={'raw':!![],'where':{'id':_0x1213f1['params']['id']}},_0x4f4db2={};_0x4f4db2[_0xb2b1('0x31')]=_['keys'](db[_0xb2b1('0x2d')][_0xb2b1('0x2e')]);_0x4f4db2['query']=_[_0xb2b1('0x44')](_0x1213f1['query']);_0x4f4db2[_0xb2b1('0x34')]=_['intersection'](_0x4f4db2['model'],_0x4f4db2[_0xb2b1('0x33')]);_0x3a3694[_0xb2b1('0x36')]=_[_0xb2b1('0x45')](_0x4f4db2[_0xb2b1('0x31')],qs[_0xb2b1('0x35')](_0x1213f1[_0xb2b1('0x33')][_0xb2b1('0x35')]));_0x3a3694[_0xb2b1('0x36')]=_0x3a3694[_0xb2b1('0x36')][_0xb2b1('0x37')]?_0x3a3694[_0xb2b1('0x36')]:_0x4f4db2['model'];if(_0x1213f1[_0xb2b1('0x33')][_0xb2b1('0x3f')]){_0x3a3694[_0xb2b1('0x46')]=[{'all':!![]}];}_0x3a3694=_[_0xb2b1('0x3b')]({},_0x3a3694,_0x1213f1[_0xb2b1('0x47')]);return db[_0xb2b1('0x2d')]['find'](_0x3a3694)[_0xb2b1('0x28')](handleEntityNotFound(_0x25b6e7,null))[_0xb2b1('0x28')](respondWithResult(_0x25b6e7,null))['catch'](handleError(_0x25b6e7,null));};exports[_0xb2b1('0x48')]=function(_0x4a3c59,_0x512ae9){return db[_0xb2b1('0x2d')][_0xb2b1('0x48')](_0x4a3c59[_0xb2b1('0x49')],{})[_0xb2b1('0x28')](respondWithResult(_0x512ae9,0xc9))[_0xb2b1('0x42')](handleError(_0x512ae9,null));};exports[_0xb2b1('0x27')]=function(_0x1ac085,_0x3f835b){if(_0x1ac085['body']['id']){delete _0x1ac085[_0xb2b1('0x49')]['id'];}return db[_0xb2b1('0x2d')][_0xb2b1('0x4a')]({'where':{'id':_0x1ac085[_0xb2b1('0x4b')]['id']}})[_0xb2b1('0x28')](handleEntityNotFound(_0x3f835b,null))[_0xb2b1('0x28')](saveUpdates(_0x1ac085[_0xb2b1('0x49')],null))[_0xb2b1('0x28')](respondWithResult(_0x3f835b,null))[_0xb2b1('0x42')](handleError(_0x3f835b,null));};exports['destroy']=function(_0x318345,_0x459550){return db[_0xb2b1('0x2d')][_0xb2b1('0x4a')]({'where':{'id':_0x318345['params']['id']}})[_0xb2b1('0x28')](handleEntityNotFound(_0x459550,null))[_0xb2b1('0x28')](removeEntity(_0x459550,null))[_0xb2b1('0x42')](handleError(_0x459550,null));};exports[_0xb2b1('0x4c')]=function(_0x171a91,_0xd0defd){return db['FaxTransferReport'][_0xb2b1('0x4c')]()['then'](respondWithResult(_0xd0defd,null))[_0xb2b1('0x42')](handleError(_0xd0defd,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 9176812..cc5ff81 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 _0x6c1c=['../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','lodash','util','api','request-promise','path'];(function(_0x47beda,_0xf71fef){var _0x3a744f=function(_0x461e63){while(--_0x461e63){_0x47beda['push'](_0x47beda['shift']());}};_0x3a744f(++_0xf71fef);}(_0x6c1c,0x124));var _0xc6c1=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0x6c1c[_0x421e36];return _0x20b3e3;};'use strict';var _=require(_0xc6c1('0x0'));var util=require(_0xc6c1('0x1'));var logger=require('../../config/logger')(_0xc6c1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc6c1('0x3'));var fs=require('fs');var path=require(_0xc6c1('0x4'));var rimraf=require('rimraf');var config=require(_0xc6c1('0x5'));var attributes=require(_0xc6c1('0x6'));module['exports']=function(_0x5b53f8,_0x5d4b1f){return _0x5b53f8[_0xc6c1('0x7')](_0xc6c1('0x8'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x53aa=['uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer'];(function(_0x20dd32,_0x22cb9e){var _0x3ada6d=function(_0x1233c4){while(--_0x1233c4){_0x20dd32['push'](_0x20dd32['shift']());}};_0x3ada6d(++_0x22cb9e);}(_0x53aa,0x6d));var _0xa53a=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x53aa[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa53a('0x0'))(_0xa53a('0x1'));var moment=require('moment');var BPromise=require(_0xa53a('0x2'));var rp=require(_0xa53a('0x3'));var fs=require('fs');var path=require(_0xa53a('0x4'));var rimraf=require(_0xa53a('0x5'));var config=require(_0xa53a('0x6'));var attributes=require(_0xa53a('0x7'));module[_0xa53a('0x8')]=function(_0x1c00a3,_0x6f3fe){return _0x1c00a3[_0xa53a('0x9')]('FaxTransferReport',attributes,{'tableName':_0xa53a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa53a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 99b24e7..ea1924b 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 _0xce72=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring'];(function(_0x68c4e3,_0x5b18b0){var _0xaca048=function(_0x485160){while(--_0x485160){_0x68c4e3['push'](_0x68c4e3['shift']());}};_0xaca048(++_0x5b18b0);}(_0xce72,0x17c));var _0x2ce7=function(_0x4b58d6,_0x5c1a74){_0x4b58d6=_0x4b58d6-0x0;var _0x472a5d=_0xce72[_0x4b58d6];return _0x472a5d;};'use strict';var _=require(_0x2ce7('0x0'));var util=require(_0x2ce7('0x1'));var moment=require('moment');var BPromise=require(_0x2ce7('0x2'));var rs=require(_0x2ce7('0x3'));var fs=require('fs');var Redis=require(_0x2ce7('0x4'));var db=require(_0x2ce7('0x5'))['db'];var utils=require(_0x2ce7('0x6'));var logger=require(_0x2ce7('0x7'))(_0x2ce7('0x8'));var config=require(_0x2ce7('0x9'));var jayson=require(_0x2ce7('0xa'));var client=jayson[_0x2ce7('0xb')][_0x2ce7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5211bc,_0x36599e,_0x2e994b){return new BPromise(function(_0x2f841f,_0x21e34a){return client['request'](_0x5211bc,_0x2e994b)[_0x2ce7('0xd')](function(_0xd8f678){logger['info'](_0x2ce7('0xe'),_0x36599e,_0x2ce7('0xf'));logger[_0x2ce7('0x10')](_0x2ce7('0x11'),_0x36599e,_0x2ce7('0xf'),JSON[_0x2ce7('0x12')](_0xd8f678));if(_0xd8f678['error']){if(_0xd8f678[_0x2ce7('0x13')][_0x2ce7('0x14')]===0x1f4){logger[_0x2ce7('0x13')](_0x2ce7('0xe'),_0x36599e,_0xd8f678[_0x2ce7('0x13')][_0x2ce7('0x15')]);return _0x21e34a(_0xd8f678['error'][_0x2ce7('0x15')]);}logger[_0x2ce7('0x13')](_0x2ce7('0xe'),_0x36599e,_0xd8f678[_0x2ce7('0x13')][_0x2ce7('0x15')]);return _0x2f841f(_0xd8f678[_0x2ce7('0x13')]['message']);}else{logger[_0x2ce7('0x16')](_0x2ce7('0xe'),_0x36599e,_0x2ce7('0xf'));_0x2f841f(_0xd8f678['result']['message']);}})[_0x2ce7('0x17')](function(_0x544afb){logger[_0x2ce7('0x13')](_0x2ce7('0xe'),_0x36599e,_0x544afb);_0x21e34a(_0x544afb);});});} \ No newline at end of file +var _0xe441=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x2d6fca,_0x19c278){var _0x292e35=function(_0x3aebb9){while(--_0x3aebb9){_0x2d6fca['push'](_0x2d6fca['shift']());}};_0x292e35(++_0x19c278);}(_0xe441,0x11e));var _0x1e44=function(_0x45ad06,_0x454cad){_0x45ad06=_0x45ad06-0x0;var _0x2eaa4e=_0xe441[_0x45ad06];return _0x2eaa4e;};'use strict';var _=require(_0x1e44('0x0'));var util=require(_0x1e44('0x1'));var moment=require(_0x1e44('0x2'));var BPromise=require(_0x1e44('0x3'));var rs=require(_0x1e44('0x4'));var fs=require('fs');var Redis=require(_0x1e44('0x5'));var db=require(_0x1e44('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e44('0x7'))(_0x1e44('0x8'));var config=require('../../config/environment');var jayson=require(_0x1e44('0x9'));var client=jayson[_0x1e44('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b1286,_0x40e4ea,_0x7e9198){return new BPromise(function(_0x4fb5df,_0x1707a9){return client[_0x1e44('0xb')](_0x2b1286,_0x7e9198)[_0x1e44('0xc')](function(_0x185414){logger[_0x1e44('0xd')](_0x1e44('0xe'),_0x40e4ea,_0x1e44('0xf'));logger[_0x1e44('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x40e4ea,_0x1e44('0xf'),JSON[_0x1e44('0x11')](_0x185414));if(_0x185414[_0x1e44('0x12')]){if(_0x185414['error']['code']===0x1f4){logger['error'](_0x1e44('0xe'),_0x40e4ea,_0x185414[_0x1e44('0x12')][_0x1e44('0x13')]);return _0x1707a9(_0x185414['error']['message']);}logger['error'](_0x1e44('0xe'),_0x40e4ea,_0x185414[_0x1e44('0x12')][_0x1e44('0x13')]);return _0x4fb5df(_0x185414[_0x1e44('0x12')][_0x1e44('0x13')]);}else{logger[_0x1e44('0xd')](_0x1e44('0xe'),_0x40e4ea,'request\x20sent');_0x4fb5df(_0x185414[_0x1e44('0x14')][_0x1e44('0x13')]);}})[_0x1e44('0x15')](function(_0x39d4b6){logger[_0x1e44('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x40e4ea,_0x39d4b6);_0x1707a9(_0x39d4b6);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index dfbcaf6..5a3713d 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 _0x1314=['Router','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x38b9c9,_0x4b305c){var _0x5c2e2b=function(_0x3d02d4){while(--_0x3d02d4){_0x38b9c9['push'](_0x38b9c9['shift']());}};_0x5c2e2b(++_0x4b305c);}(_0x1314,0x188));var _0x4131=function(_0x2b85d5,_0x3115b7){_0x2b85d5=_0x2b85d5-0x0;var _0xe8c96f=_0x1314[_0x2b85d5];return _0xe8c96f;};'use strict';var multer=require(_0x4131('0x0'));var util=require(_0x4131('0x1'));var path=require(_0x4131('0x2'));var timeout=require(_0x4131('0x3'));var express=require('express');var router=express[_0x4131('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4131('0x5'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x4131('0x6')]('/',auth['isAuthenticated'](),controller[_0x4131('0x7')]);router[_0x4131('0x6')](_0x4131('0x8'),auth[_0x4131('0x9')](),controller[_0x4131('0xa')]);router[_0x4131('0x6')](_0x4131('0xb'),auth[_0x4131('0x9')](),controller['show']);router[_0x4131('0xc')]('/',auth[_0x4131('0x9')](),controller[_0x4131('0xd')]);router[_0x4131('0xe')]('/:id',auth[_0x4131('0x9')](),controller[_0x4131('0xf')]);router[_0x4131('0x10')](_0x4131('0xb'),auth['isAuthenticated'](),controller[_0x4131('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfff7=['/describe','describe','show','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','index'];(function(_0x30e8ee,_0x225cd){var _0x2469cc=function(_0x1ede39){while(--_0x1ede39){_0x30e8ee['push'](_0x30e8ee['shift']());}};_0x2469cc(++_0x225cd);}(_0xfff7,0x7a));var _0x7fff=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfff7[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x7fff('0x0'));var path=require(_0x7fff('0x1'));var timeout=require(_0x7fff('0x2'));var express=require(_0x7fff('0x3'));var router=express[_0x7fff('0x4')]();var fs_extra=require(_0x7fff('0x5'));var auth=require(_0x7fff('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7fff('0x7'));router[_0x7fff('0x8')]('/',auth[_0x7fff('0x9')](),controller[_0x7fff('0xa')]);router['get'](_0x7fff('0xb'),auth[_0x7fff('0x9')](),controller[_0x7fff('0xc')]);router['get']('/:id',auth[_0x7fff('0x9')](),controller[_0x7fff('0xd')]);router['post']('/',auth[_0x7fff('0x9')](),controller[_0x7fff('0xe')]);router['put'](_0x7fff('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x7fff('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x7fff('0x11')]);module[_0x7fff('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 27c76b1..20eb346 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 _0xa1b3=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','multer'];(function(_0x49e3b0,_0x2e3953){var _0xe7d73b=function(_0x3d17de){while(--_0x3d17de){_0x49e3b0['push'](_0x49e3b0['shift']());}};_0xe7d73b(++_0x2e3953);}(_0xa1b3,0xce));var _0x3a1b=function(_0x3d6926,_0x1f6b2a){_0x3d6926=_0x3d6926-0x0;var _0x4d0a96=_0xa1b3[_0x3d6926];return _0x4d0a96;};'use strict';var multer=require(_0x3a1b('0x0'));var util=require('util');var path=require(_0x3a1b('0x1'));var timeout=require(_0x3a1b('0x2'));var express=require(_0x3a1b('0x3'));var router=express[_0x3a1b('0x4')]();var fs_extra=require(_0x3a1b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3a1b('0x6'));var config=require(_0x3a1b('0x7'));var controller=require(_0x3a1b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3a1b('0x9')]);router['get'](_0x3a1b('0xa'),auth[_0x3a1b('0xb')](),controller[_0x3a1b('0xc')]);router['get']('/:id/configurations',auth[_0x3a1b('0xb')](),controller[_0x3a1b('0xd')]);router['get'](_0x3a1b('0xe'),auth[_0x3a1b('0xb')](),controller[_0x3a1b('0xf')]);router[_0x3a1b('0x10')]('/',auth[_0x3a1b('0xb')](),controller[_0x3a1b('0x11')]);router[_0x3a1b('0x10')](_0x3a1b('0x12'),auth['isAuthenticated'](),controller[_0x3a1b('0x13')]);router[_0x3a1b('0x14')](_0x3a1b('0xa'),auth[_0x3a1b('0xb')](),controller['update']);router['delete'](_0x3a1b('0xa'),auth[_0x3a1b('0xb')](),controller[_0x3a1b('0x15')]);module[_0x3a1b('0x16')]=router; \ No newline at end of file +var _0xa91d=['exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy'];(function(_0x14cd49,_0x50601e){var _0x4fc6fb=function(_0x4f2b2d){while(--_0x4f2b2d){_0x14cd49['push'](_0x14cd49['shift']());}};_0x4fc6fb(++_0x50601e);}(_0xa91d,0xa2));var _0xda91=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa91d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xda91('0x0'));var path=require('path');var timeout=require(_0xda91('0x1'));var express=require(_0xda91('0x2'));var router=express['Router']();var fs_extra=require(_0xda91('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xda91('0x4'));var config=require(_0xda91('0x5'));var controller=require(_0xda91('0x6'));router[_0xda91('0x7')]('/',auth[_0xda91('0x8')](),controller[_0xda91('0x9')]);router['get'](_0xda91('0xa'),auth[_0xda91('0x8')](),controller[_0xda91('0xb')]);router[_0xda91('0x7')](_0xda91('0xc'),auth[_0xda91('0x8')](),controller[_0xda91('0xd')]);router[_0xda91('0x7')](_0xda91('0xe'),auth['isAuthenticated'](),controller[_0xda91('0xf')]);router[_0xda91('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xda91('0x10')](_0xda91('0xc'),auth[_0xda91('0x8')](),controller[_0xda91('0x11')]);router[_0xda91('0x12')](_0xda91('0xa'),auth[_0xda91('0x8')](),controller[_0xda91('0x13')]);router[_0xda91('0x14')](_0xda91('0xa'),auth[_0xda91('0x8')](),controller[_0xda91('0x15')]);module[_0xda91('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 098d33a..47ba66b 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 _0x87ca=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x5ddd8e,_0x487661){var _0x145f2a=function(_0x384bde){while(--_0x384bde){_0x5ddd8e['push'](_0x5ddd8e['shift']());}};_0x145f2a(++_0x487661);}(_0x87ca,0x1f1));var _0xa87c=function(_0x24f67d,_0x3d3826){_0x24f67d=_0x24f67d-0x0;var _0x55a92d=_0x87ca[_0x24f67d];return _0x55a92d;};'use strict';var Sequelize=require(_0xa87c('0x0'));module[_0xa87c('0x1')]={'name':{'type':Sequelize[_0xa87c('0x2')]},'description':{'type':Sequelize[_0xa87c('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa87c('0x2')]},'authType':{'type':Sequelize[_0xa87c('0x3')](_0xa87c('0x4')),'defaultValue':_0xa87c('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xa87c('0x2')]},'consumerSecret':{'type':Sequelize[_0xa87c('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xa87c('0x2')]},'serverUrl':{'type':Sequelize[_0xa87c('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa87c('0x5'),'newTab'),'defaultValue':_0xa87c('0x5')}}; \ No newline at end of file +var _0x6a45=['integrationTab','newTab','sequelize','STRING','ENUM','basic'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a45,0x122));var _0x56a4=function(_0x511f37,_0x354e17){_0x511f37=_0x511f37-0x0;var _0x2a1fd6=_0x6a45[_0x511f37];return _0x2a1fd6;};'use strict';var Sequelize=require(_0x56a4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x56a4('0x1')]},'username':{'type':Sequelize[_0x56a4('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x56a4('0x2')](_0x56a4('0x3')),'defaultValue':_0x56a4('0x3')},'password':{'type':Sequelize[_0x56a4('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x56a4('0x1')]},'token':{'type':Sequelize[_0x56a4('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x56a4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x56a4('0x2')](_0x56a4('0x4'),_0x56a4('0x5')),'defaultValue':_0x56a4('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1d14094..4d788f3 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 _0x4ec6=['statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','DeskAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','fields','includeAll','find','create','body','destroy','findOne','order','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','DeskField','Subjects','priority','consumerSecret','token','tokenSecret','remoteUri','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','username','toString','base64','_embedded','entries','active','label','test','getFields','Wrong\x20credentials'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x4ec6,0x77));var _0x64ec=function(_0x3f12d5,_0x48e08d){_0x3f12d5=_0x3f12d5-0x0;var _0x26492a=_0x4ec6[_0x3f12d5];return _0x26492a;};'use strict';var emlformat=require(_0x64ec('0x0'));var rimraf=require(_0x64ec('0x1'));var zipdir=require(_0x64ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x64ec('0x3'));var moment=require('moment');var BPromise=require(_0x64ec('0x4'));var Mustache=require(_0x64ec('0x5'));var util=require(_0x64ec('0x6'));var path=require('path');var sox=require(_0x64ec('0x7'));var csv=require(_0x64ec('0x8'));var ejs=require(_0x64ec('0x9'));var fs=require('fs');var fs_extra=require(_0x64ec('0xa'));var _=require(_0x64ec('0xb'));var squel=require(_0x64ec('0xc'));var crypto=require(_0x64ec('0xd'));var jsforce=require(_0x64ec('0xe'));var deskjs=require(_0x64ec('0xf'));var toCsv=require(_0x64ec('0x8'));var querystring=require(_0x64ec('0x10'));var Papa=require(_0x64ec('0x11'));var Redis=require(_0x64ec('0x12'));var authService=require(_0x64ec('0x13'));var qs=require(_0x64ec('0x14'));var as=require(_0x64ec('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64ec('0x16'))(_0x64ec('0x17'));var utils=require(_0x64ec('0x18'));var config=require(_0x64ec('0x19'));var licenseUtil=require(_0x64ec('0x1a'));var db=require(_0x64ec('0x1b'))['db'];var integrations=require(_0x64ec('0x1c'));function respondWithStatusCode(_0x50283d,_0x5d7650){_0x5d7650=_0x5d7650||0xcc;return function(_0x201f2a){if(_0x201f2a){return _0x50283d[_0x64ec('0x1d')](_0x5d7650);}return _0x50283d[_0x64ec('0x1e')](_0x5d7650)[_0x64ec('0x1f')]();};}function respondWithResult(_0x563db1,_0x2f73be){_0x2f73be=_0x2f73be||0xc8;return function(_0x565036){if(_0x565036){return _0x563db1[_0x64ec('0x1e')](_0x2f73be)['json'](_0x565036);}};}function respondWithFilteredResult(_0x3a7a8e,_0x5b0193){return function(_0x3a189b){if(_0x3a189b){var _0x3ee8bd=typeof _0x5b0193[_0x64ec('0x20')]===_0x64ec('0x21')&&typeof _0x5b0193[_0x64ec('0x22')]===_0x64ec('0x21');var _0x58eceb=_0x3a189b[_0x64ec('0x23')];var _0x5ec4aa=_0x3ee8bd?0x0:_0x5b0193['offset'];var _0x1a76a3=_0x3ee8bd?_0x3a189b[_0x64ec('0x23')]:_0x5b0193['offset']+_0x5b0193[_0x64ec('0x22')];var _0x2cc369;if(_0x1a76a3>=_0x58eceb){_0x1a76a3=_0x58eceb;_0x2cc369=0xc8;}else{_0x2cc369=0xce;}_0x3a7a8e[_0x64ec('0x1e')](_0x2cc369);return _0x3a7a8e[_0x64ec('0x24')](_0x64ec('0x25'),_0x5ec4aa+'-'+_0x1a76a3+'/'+_0x58eceb)[_0x64ec('0x26')](_0x3a189b);}return null;};}function patchUpdates(_0x26519){return function(_0x13766d){try{jsonpatch[_0x64ec('0x27')](_0x13766d,_0x26519,!![]);}catch(_0x5a3313){return BPromise[_0x64ec('0x28')](_0x5a3313);}return _0x13766d[_0x64ec('0x29')]();};}function saveUpdates(_0x547ed6,_0x4b1755){return function(_0xa23288){if(_0xa23288){return _0xa23288[_0x64ec('0x2a')](_0x547ed6)[_0x64ec('0x2b')](function(_0x88427e){return _0x88427e;});}return null;};}function removeEntity(_0x4e3be8,_0x416184){return function(_0x2d975e){if(_0x2d975e){return _0x2d975e['destroy']()[_0x64ec('0x2b')](function(){_0x4e3be8[_0x64ec('0x1e')](0xcc)[_0x64ec('0x1f')]();});}};}function handleEntityNotFound(_0x492899,_0x21ef7a){return function(_0x2c1ab2){if(!_0x2c1ab2){_0x492899['sendStatus'](0x194);}return _0x2c1ab2;};}function handleError(_0x2f2dfb,_0xeb7542){_0xeb7542=_0xeb7542||0x1f4;return function(_0x5bbea8){logger[_0x64ec('0x2c')](_0x5bbea8[_0x64ec('0x2d')]);if(_0x5bbea8[_0x64ec('0x2e')]){delete _0x5bbea8[_0x64ec('0x2e')];}_0x2f2dfb[_0x64ec('0x1e')](_0xeb7542)[_0x64ec('0x2f')](_0x5bbea8);};}exports['index']=function(_0x138d15,_0x592d0b){var _0x42e3e6={},_0xac4e44={},_0x565296={'count':0x0,'rows':[]};var _0x34156a=_[_0x64ec('0x30')](db[_0x64ec('0x31')][_0x64ec('0x32')],function(_0x356a7b){return{'name':_0x356a7b['fieldName'],'type':_0x356a7b[_0x64ec('0x33')][_0x64ec('0x34')]};});_0xac4e44['model']=_['map'](_0x34156a,_0x64ec('0x2e'));_0xac4e44[_0x64ec('0x35')]=_[_0x64ec('0x36')](_0x138d15[_0x64ec('0x35')]);_0xac4e44[_0x64ec('0x37')]=_[_0x64ec('0x38')](_0xac4e44[_0x64ec('0x39')],_0xac4e44['query']);_0x42e3e6[_0x64ec('0x3a')]=_[_0x64ec('0x38')](_0xac4e44[_0x64ec('0x39')],qs['fields'](_0x138d15['query']['fields']));_0x42e3e6[_0x64ec('0x3a')]=_0x42e3e6['attributes'][_0x64ec('0x3b')]?_0x42e3e6[_0x64ec('0x3a')]:_0xac4e44[_0x64ec('0x39')];if(!_0x138d15[_0x64ec('0x35')][_0x64ec('0x3c')](_0x64ec('0x3d'))){_0x42e3e6[_0x64ec('0x22')]=qs[_0x64ec('0x22')](_0x138d15[_0x64ec('0x35')]['limit']);_0x42e3e6['offset']=qs[_0x64ec('0x20')](_0x138d15['query'][_0x64ec('0x20')]);}_0x42e3e6['order']=qs[_0x64ec('0x3e')](_0x138d15['query'][_0x64ec('0x3e')]);_0x42e3e6['where']=qs['filters'](_[_0x64ec('0x3f')](_0x138d15['query'],_0xac4e44['filters']),_0x34156a);if(_0x138d15[_0x64ec('0x35')]['filter']){_0x42e3e6[_0x64ec('0x40')]=_[_0x64ec('0x41')](_0x42e3e6[_0x64ec('0x40')],{'$or':_[_0x64ec('0x30')](_0x34156a,function(_0x5bb152){if(_0x5bb152[_0x64ec('0x33')]!==_0x64ec('0x42')){var _0x30a6f3={};_0x30a6f3[_0x5bb152['name']]={'$like':'%'+_0x138d15['query'][_0x64ec('0x43')]+'%'};return _0x30a6f3;}})});}_0x42e3e6=_[_0x64ec('0x41')]({},_0x42e3e6,_0x138d15[_0x64ec('0x44')]);var _0x39444e={'where':_0x42e3e6['where']};return db[_0x64ec('0x31')][_0x64ec('0x23')](_0x39444e)[_0x64ec('0x2b')](function(_0x15e175){_0x565296[_0x64ec('0x23')]=_0x15e175;if(_0x138d15[_0x64ec('0x35')]['includeAll']){_0x42e3e6[_0x64ec('0x45')]=[{'all':!![]}];}return db[_0x64ec('0x31')][_0x64ec('0x46')](_0x42e3e6);})['then'](function(_0x5f59fe){_0x565296[_0x64ec('0x47')]=_0x5f59fe;return _0x565296;})['then'](respondWithFilteredResult(_0x592d0b,_0x42e3e6))[_0x64ec('0x48')](handleError(_0x592d0b,null));};exports[_0x64ec('0x49')]=function(_0xd50d5,_0x42d68d){var _0x5cc1c1={'raw':![],'where':{'id':_0xd50d5[_0x64ec('0x4a')]['id']}},_0x4e629f={};_0x4e629f['model']=_[_0x64ec('0x36')](db['DeskAccount']['rawAttributes']);_0x4e629f['query']=_[_0x64ec('0x36')](_0xd50d5[_0x64ec('0x35')]);_0x4e629f['filters']=_['intersection'](_0x4e629f[_0x64ec('0x39')],_0x4e629f['query']);_0x5cc1c1[_0x64ec('0x3a')]=_[_0x64ec('0x38')](_0x4e629f['model'],qs['fields'](_0xd50d5[_0x64ec('0x35')][_0x64ec('0x4b')]));_0x5cc1c1['attributes']=_0x5cc1c1[_0x64ec('0x3a')][_0x64ec('0x3b')]?_0x5cc1c1[_0x64ec('0x3a')]:_0x4e629f[_0x64ec('0x39')];if(_0xd50d5[_0x64ec('0x35')][_0x64ec('0x4c')]){_0x5cc1c1[_0x64ec('0x45')]=[{'all':!![]}];}_0x5cc1c1=_['merge']({},_0x5cc1c1,_0xd50d5['options']);return db[_0x64ec('0x31')][_0x64ec('0x4d')](_0x5cc1c1)['then'](handleEntityNotFound(_0x42d68d,null))[_0x64ec('0x2b')](respondWithResult(_0x42d68d,null))[_0x64ec('0x48')](handleError(_0x42d68d,null));};exports[_0x64ec('0x4e')]=function(_0x47604d,_0x1b88e0){return db[_0x64ec('0x31')][_0x64ec('0x4e')](_0x47604d[_0x64ec('0x4f')],{})[_0x64ec('0x2b')](respondWithResult(_0x1b88e0,0xc9))[_0x64ec('0x48')](handleError(_0x1b88e0,null));};exports[_0x64ec('0x2a')]=function(_0x307e5b,_0x59f959){if(_0x307e5b[_0x64ec('0x4f')]['id']){delete _0x307e5b[_0x64ec('0x4f')]['id'];}return db[_0x64ec('0x31')][_0x64ec('0x4d')]({'where':{'id':_0x307e5b['params']['id']}})[_0x64ec('0x2b')](handleEntityNotFound(_0x59f959,null))[_0x64ec('0x2b')](saveUpdates(_0x307e5b[_0x64ec('0x4f')],null))[_0x64ec('0x2b')](respondWithResult(_0x59f959,null))[_0x64ec('0x48')](handleError(_0x59f959,null));};exports[_0x64ec('0x50')]=function(_0x59ee20,_0x152dd0){return db[_0x64ec('0x31')][_0x64ec('0x4d')]({'where':{'id':_0x59ee20[_0x64ec('0x4a')]['id']}})[_0x64ec('0x2b')](handleEntityNotFound(_0x152dd0,null))[_0x64ec('0x2b')](removeEntity(_0x152dd0,null))['catch'](handleError(_0x152dd0,null));};exports['getConfigurations']=function(_0x28cd6d,_0x1f2f21,_0x38c258){var _0x3cd7fb={};var _0x2b49bc={};var _0x16b2df;var _0x2441d3;return db[_0x64ec('0x31')][_0x64ec('0x51')]({'where':{'id':_0x28cd6d[_0x64ec('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f2f21,null))['then'](function(_0x5c8af4){if(_0x5c8af4){_0x16b2df=_0x5c8af4;_0x2b49bc[_0x64ec('0x39')]=_['keys'](db['DeskConfiguration'][_0x64ec('0x32')]);_0x2b49bc[_0x64ec('0x35')]=_[_0x64ec('0x36')](_0x28cd6d[_0x64ec('0x35')]);_0x2b49bc[_0x64ec('0x37')]=_['intersection'](_0x2b49bc['model'],_0x2b49bc[_0x64ec('0x35')]);_0x3cd7fb[_0x64ec('0x3a')]=_[_0x64ec('0x38')](_0x2b49bc[_0x64ec('0x39')],qs[_0x64ec('0x4b')](_0x28cd6d[_0x64ec('0x35')][_0x64ec('0x4b')]));_0x3cd7fb[_0x64ec('0x3a')]=_0x3cd7fb[_0x64ec('0x3a')]['length']?_0x3cd7fb[_0x64ec('0x3a')]:_0x2b49bc['model'];_0x3cd7fb[_0x64ec('0x52')]=qs[_0x64ec('0x3e')](_0x28cd6d[_0x64ec('0x35')][_0x64ec('0x3e')]);_0x3cd7fb[_0x64ec('0x40')]=qs['filters'](_[_0x64ec('0x3f')](_0x28cd6d[_0x64ec('0x35')],_0x2b49bc[_0x64ec('0x37')]));if(_0x28cd6d[_0x64ec('0x35')][_0x64ec('0x43')]){_0x3cd7fb['where']=_[_0x64ec('0x41')](_0x3cd7fb[_0x64ec('0x40')],{'$or':_[_0x64ec('0x30')](_0x3cd7fb[_0x64ec('0x3a')],function(_0x4ab265){var _0x288ed2={};_0x288ed2[_0x4ab265]={'$like':'%'+_0x28cd6d['query'][_0x64ec('0x43')]+'%'};return _0x288ed2;})});}_0x3cd7fb=_[_0x64ec('0x41')]({},_0x3cd7fb,_0x28cd6d[_0x64ec('0x44')]);return _0x16b2df[_0x64ec('0x53')](_0x3cd7fb);}})['then'](function(_0x1c0f04){if(_0x1c0f04){_0x2441d3=_0x1c0f04['length'];if(!_0x28cd6d[_0x64ec('0x35')][_0x64ec('0x3c')]('nolimit')){_0x3cd7fb[_0x64ec('0x22')]=qs[_0x64ec('0x22')](_0x28cd6d[_0x64ec('0x35')]['limit']);_0x3cd7fb['offset']=qs[_0x64ec('0x20')](_0x28cd6d['query'][_0x64ec('0x20')]);}return _0x16b2df[_0x64ec('0x53')](_0x3cd7fb);}})[_0x64ec('0x2b')](function(_0x25d1b7){if(_0x25d1b7){return _0x25d1b7?{'count':_0x2441d3,'rows':_0x25d1b7}:null;}})['then'](respondWithResult(_0x1f2f21,null))[_0x64ec('0x48')](handleError(_0x1f2f21,null));};exports[_0x64ec('0x54')]=function(_0x2096fb,_0x17dc99,_0x5af365){if(_0x2096fb[_0x64ec('0x4f')]['id']){delete _0x2096fb[_0x64ec('0x4f')]['id'];}return db[_0x64ec('0x31')][_0x64ec('0x51')]({'where':{'id':_0x2096fb['params']['id']}})[_0x64ec('0x2b')](handleEntityNotFound(_0x17dc99,null))[_0x64ec('0x2b')](function(_0x3a0dc9){if(_0x3a0dc9){_0x2096fb[_0x64ec('0x4f')]['AccountId']=_0x3a0dc9['id'];_0x2096fb[_0x64ec('0x4f')]['Subjects']=integrations[_0x64ec('0x55')](_0x2096fb[_0x64ec('0x4f')][_0x64ec('0x56')],_0x2096fb['body'][_0x64ec('0x33')]);_0x2096fb[_0x64ec('0x4f')][_0x64ec('0x57')]=integrations['getDescriptions'](_0x2096fb[_0x64ec('0x4f')]['channel'],_0x2096fb[_0x64ec('0x4f')][_0x64ec('0x33')]);return db['DeskConfiguration'][_0x64ec('0x4e')](_0x2096fb[_0x64ec('0x4f')],{'include':[{'model':db[_0x64ec('0x58')],'as':_0x64ec('0x59')},{'model':db[_0x64ec('0x58')],'as':_0x64ec('0x57')}]});}return null;})[_0x64ec('0x2b')](respondWithResult(_0x17dc99,null))[_0x64ec('0x48')](handleError(_0x17dc99,null));};exports['getFields']=function(_0x29e95e,_0x1ee6cf,_0x34a81d){var _0x49d9a7=[{'name':_0x64ec('0x5a'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2208c1='';return db[_0x64ec('0x31')]['findOne']({'where':{'id':_0x29e95e[_0x64ec('0x4a')]['id']},'attributes':['id','remoteUri','authType','username','password','consumerKey',_0x64ec('0x5b'),_0x64ec('0x5c'),_0x64ec('0x5d')]})['then'](handleEntityNotFound(_0x1ee6cf,null))['then'](function(_0x1f0168){if(_0x1f0168){_0x2208c1=_0x1f0168[_0x64ec('0x5e')];var _0x13aa1d=_0x2208c1[_0x64ec('0x5f')](-0x1);if(_0x13aa1d==='/'){_0x2208c1=_0x2208c1['substring'](0x0,_0x2208c1[_0x64ec('0x60')](_0x13aa1d));}var _0x4e9bd3={'method':_0x64ec('0x61'),'uri':util[_0x64ec('0x62')](_0x64ec('0x63'),_0x2208c1),'headers':{'Content-Type':_0x64ec('0x64'),'Accept':_0x64ec('0x64')},'json':!![]};if(_0x1f0168[_0x64ec('0x65')]===_0x64ec('0x66')){_0x4e9bd3[_0x64ec('0x67')][_0x64ec('0x68')]=util[_0x64ec('0x62')](_0x64ec('0x69'),new Buffer(util[_0x64ec('0x62')](_0x64ec('0x6a'),_0x1f0168[_0x64ec('0x6b')],_0x1f0168['password']))[_0x64ec('0x6c')](_0x64ec('0x6d')));}return rp(_0x4e9bd3)['then'](function(_0x4d216c){return _0x49d9a7['concat'](_['map'](_0x4d216c[_0x64ec('0x6e')][_0x64ec('0x6f')],function(_0x3c6916){return{'id':_0x3c6916[_0x64ec('0x2e')],'name':_0x3c6916['name'],'type':_0x3c6916[_0x64ec('0x33')],'active':_0x3c6916[_0x64ec('0x70')],'label':_0x3c6916[_0x64ec('0x71')],'custom':!![]};}));});}})[_0x64ec('0x2b')](function(_0x1fcd0f){return{'count':_0x1fcd0f[_0x64ec('0x3b')],'rows':_0x1fcd0f};})[_0x64ec('0x2b')](respondWithResult(_0x1ee6cf,null))[_0x64ec('0x48')](function(_0x15729b){var _0x5c4b6a=_0x29e95e['query'][_0x64ec('0x72')]?0x1f4:_0x15729b['statusCode']||0x1f4;logger[_0x64ec('0x2c')]('getFields,\x20%s,\x20%s,\x20%s',_0x64ec('0x73'),_0x5c4b6a,JSON['stringify'](_0x15729b));delete _0x15729b[_0x64ec('0x2e')];if(_0x5c4b6a===0x191){_0x5c4b6a=0x190;}_0x1ee6cf['status'](_0x5c4b6a)[_0x64ec('0x2f')](_0x29e95e['query']['test']?{'message':_0x64ec('0x74'),'statusCode':_0x15729b[_0x64ec('0x75')]}:_0x15729b);});}; \ No newline at end of file +var _0xffc6=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','findAll','rows','catch','create','update','body','find','params','getConfigurations','DeskConfiguration','addConfiguration','findOne','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','%s:%s','toString','base64','concat','_embedded','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','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','../../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','then','destroy','error','stack','name','send','index','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x100770,_0x2a6617){var _0x26c777=function(_0x58174d){while(--_0x58174d){_0x100770['push'](_0x100770['shift']());}};_0x26c777(++_0x2a6617);}(_0xffc6,0x127));var _0x6ffc=function(_0x320a2f,_0x3767d8){_0x320a2f=_0x320a2f-0x0;var _0x1d14ab=_0xffc6[_0x320a2f];return _0x1d14ab;};'use strict';var emlformat=require(_0x6ffc('0x0'));var rimraf=require(_0x6ffc('0x1'));var zipdir=require(_0x6ffc('0x2'));var jsonpatch=require(_0x6ffc('0x3'));var rp=require(_0x6ffc('0x4'));var moment=require(_0x6ffc('0x5'));var BPromise=require(_0x6ffc('0x6'));var Mustache=require(_0x6ffc('0x7'));var util=require(_0x6ffc('0x8'));var path=require(_0x6ffc('0x9'));var sox=require(_0x6ffc('0xa'));var csv=require(_0x6ffc('0xb'));var ejs=require(_0x6ffc('0xc'));var fs=require('fs');var fs_extra=require(_0x6ffc('0xd'));var _=require(_0x6ffc('0xe'));var squel=require(_0x6ffc('0xf'));var crypto=require('crypto');var jsforce=require(_0x6ffc('0x10'));var deskjs=require(_0x6ffc('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6ffc('0x12'));var Redis=require(_0x6ffc('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ffc('0x14'));var logger=require(_0x6ffc('0x15'))(_0x6ffc('0x16'));var utils=require(_0x6ffc('0x17'));var config=require(_0x6ffc('0x18'));var licenseUtil=require(_0x6ffc('0x19'));var db=require(_0x6ffc('0x1a'))['db'];var integrations=require(_0x6ffc('0x1b'));function respondWithStatusCode(_0x573cc3,_0xdf3b56){_0xdf3b56=_0xdf3b56||0xcc;return function(_0x161077){if(_0x161077){return _0x573cc3[_0x6ffc('0x1c')](_0xdf3b56);}return _0x573cc3[_0x6ffc('0x1d')](_0xdf3b56)[_0x6ffc('0x1e')]();};}function respondWithResult(_0x179a87,_0x35ff5d){_0x35ff5d=_0x35ff5d||0xc8;return function(_0x265ff0){if(_0x265ff0){return _0x179a87[_0x6ffc('0x1d')](_0x35ff5d)[_0x6ffc('0x1f')](_0x265ff0);}};}function respondWithFilteredResult(_0x411e9b,_0x32698e){return function(_0x3ccefc){if(_0x3ccefc){var _0x3322a8=typeof _0x32698e[_0x6ffc('0x20')]===_0x6ffc('0x21')&&typeof _0x32698e[_0x6ffc('0x22')]==='undefined';var _0x22ed0e=_0x3ccefc[_0x6ffc('0x23')];var _0x48cf45=_0x3322a8?0x0:_0x32698e[_0x6ffc('0x20')];var _0xf980a1=_0x3322a8?_0x3ccefc['count']:_0x32698e['offset']+_0x32698e[_0x6ffc('0x22')];var _0x535964;if(_0xf980a1>=_0x22ed0e){_0xf980a1=_0x22ed0e;_0x535964=0xc8;}else{_0x535964=0xce;}_0x411e9b['status'](_0x535964);return _0x411e9b[_0x6ffc('0x24')](_0x6ffc('0x25'),_0x48cf45+'-'+_0xf980a1+'/'+_0x22ed0e)['json'](_0x3ccefc);}return null;};}function patchUpdates(_0x2b0e5a){return function(_0x301f61){try{jsonpatch[_0x6ffc('0x26')](_0x301f61,_0x2b0e5a,!![]);}catch(_0x52bfaa){return BPromise[_0x6ffc('0x27')](_0x52bfaa);}return _0x301f61[_0x6ffc('0x28')]();};}function saveUpdates(_0x49e8e7,_0x331ee7){return function(_0x4d373e){if(_0x4d373e){return _0x4d373e['update'](_0x49e8e7)[_0x6ffc('0x29')](function(_0x1375f3){return _0x1375f3;});}return null;};}function removeEntity(_0x4866c1,_0x1149bf){return function(_0x2323cc){if(_0x2323cc){return _0x2323cc[_0x6ffc('0x2a')]()['then'](function(){_0x4866c1[_0x6ffc('0x1d')](0xcc)[_0x6ffc('0x1e')]();});}};}function handleEntityNotFound(_0x5b29f1,_0x117fed){return function(_0x1954c8){if(!_0x1954c8){_0x5b29f1[_0x6ffc('0x1c')](0x194);}return _0x1954c8;};}function handleError(_0x1b4085,_0x1b9823){_0x1b9823=_0x1b9823||0x1f4;return function(_0xf3405e){logger[_0x6ffc('0x2b')](_0xf3405e[_0x6ffc('0x2c')]);if(_0xf3405e['name']){delete _0xf3405e[_0x6ffc('0x2d')];}_0x1b4085[_0x6ffc('0x1d')](_0x1b9823)[_0x6ffc('0x2e')](_0xf3405e);};}exports[_0x6ffc('0x2f')]=function(_0x4e611d,_0x51580c){var _0x22c218={},_0x4a4cbb={},_0x12e7b1={'count':0x0,'rows':[]};var _0x364c61=_['map'](db['DeskAccount'][_0x6ffc('0x30')],function(_0x41c8b5){return{'name':_0x41c8b5['fieldName'],'type':_0x41c8b5['type']['key']};});_0x4a4cbb[_0x6ffc('0x31')]=_[_0x6ffc('0x32')](_0x364c61,'name');_0x4a4cbb[_0x6ffc('0x33')]=_[_0x6ffc('0x34')](_0x4e611d[_0x6ffc('0x33')]);_0x4a4cbb[_0x6ffc('0x35')]=_[_0x6ffc('0x36')](_0x4a4cbb[_0x6ffc('0x31')],_0x4a4cbb[_0x6ffc('0x33')]);_0x22c218[_0x6ffc('0x37')]=_['intersection'](_0x4a4cbb[_0x6ffc('0x31')],qs[_0x6ffc('0x38')](_0x4e611d[_0x6ffc('0x33')]['fields']));_0x22c218[_0x6ffc('0x37')]=_0x22c218['attributes'][_0x6ffc('0x39')]?_0x22c218['attributes']:_0x4a4cbb[_0x6ffc('0x31')];if(!_0x4e611d[_0x6ffc('0x33')][_0x6ffc('0x3a')](_0x6ffc('0x3b'))){_0x22c218[_0x6ffc('0x22')]=qs['limit'](_0x4e611d[_0x6ffc('0x33')][_0x6ffc('0x22')]);_0x22c218[_0x6ffc('0x20')]=qs[_0x6ffc('0x20')](_0x4e611d['query'][_0x6ffc('0x20')]);}_0x22c218[_0x6ffc('0x3c')]=qs[_0x6ffc('0x3d')](_0x4e611d[_0x6ffc('0x33')][_0x6ffc('0x3d')]);_0x22c218[_0x6ffc('0x3e')]=qs[_0x6ffc('0x35')](_[_0x6ffc('0x3f')](_0x4e611d[_0x6ffc('0x33')],_0x4a4cbb['filters']),_0x364c61);if(_0x4e611d[_0x6ffc('0x33')][_0x6ffc('0x40')]){_0x22c218[_0x6ffc('0x3e')]=_[_0x6ffc('0x41')](_0x22c218[_0x6ffc('0x3e')],{'$or':_[_0x6ffc('0x32')](_0x364c61,function(_0x39a427){if(_0x39a427['type']!==_0x6ffc('0x42')){var _0x481f14={};_0x481f14[_0x39a427[_0x6ffc('0x2d')]]={'$like':'%'+_0x4e611d[_0x6ffc('0x33')][_0x6ffc('0x40')]+'%'};return _0x481f14;}})});}_0x22c218=_[_0x6ffc('0x41')]({},_0x22c218,_0x4e611d[_0x6ffc('0x43')]);var _0x250980={'where':_0x22c218['where']};return db[_0x6ffc('0x44')][_0x6ffc('0x23')](_0x250980)['then'](function(_0x53f2f3){_0x12e7b1[_0x6ffc('0x23')]=_0x53f2f3;if(_0x4e611d[_0x6ffc('0x33')][_0x6ffc('0x45')]){_0x22c218[_0x6ffc('0x46')]=[{'all':!![]}];}return db['DeskAccount'][_0x6ffc('0x47')](_0x22c218);})[_0x6ffc('0x29')](function(_0x5a90c1){_0x12e7b1[_0x6ffc('0x48')]=_0x5a90c1;return _0x12e7b1;})[_0x6ffc('0x29')](respondWithFilteredResult(_0x51580c,_0x22c218))[_0x6ffc('0x49')](handleError(_0x51580c,null));};exports['show']=function(_0x220e54,_0x484ae4){var _0x2aff53={'raw':![],'where':{'id':_0x220e54['params']['id']}},_0x3558e3={};_0x3558e3['model']=_[_0x6ffc('0x34')](db[_0x6ffc('0x44')][_0x6ffc('0x30')]);_0x3558e3['query']=_[_0x6ffc('0x34')](_0x220e54[_0x6ffc('0x33')]);_0x3558e3[_0x6ffc('0x35')]=_['intersection'](_0x3558e3['model'],_0x3558e3[_0x6ffc('0x33')]);_0x2aff53[_0x6ffc('0x37')]=_[_0x6ffc('0x36')](_0x3558e3[_0x6ffc('0x31')],qs[_0x6ffc('0x38')](_0x220e54['query'][_0x6ffc('0x38')]));_0x2aff53['attributes']=_0x2aff53[_0x6ffc('0x37')][_0x6ffc('0x39')]?_0x2aff53['attributes']:_0x3558e3[_0x6ffc('0x31')];if(_0x220e54[_0x6ffc('0x33')][_0x6ffc('0x45')]){_0x2aff53[_0x6ffc('0x46')]=[{'all':!![]}];}_0x2aff53=_[_0x6ffc('0x41')]({},_0x2aff53,_0x220e54['options']);return db[_0x6ffc('0x44')]['find'](_0x2aff53)[_0x6ffc('0x29')](handleEntityNotFound(_0x484ae4,null))[_0x6ffc('0x29')](respondWithResult(_0x484ae4,null))['catch'](handleError(_0x484ae4,null));};exports[_0x6ffc('0x4a')]=function(_0x40e63c,_0x27f681){return db[_0x6ffc('0x44')][_0x6ffc('0x4a')](_0x40e63c['body'],{})['then'](respondWithResult(_0x27f681,0xc9))[_0x6ffc('0x49')](handleError(_0x27f681,null));};exports[_0x6ffc('0x4b')]=function(_0x52ea0f,_0x3582d4){if(_0x52ea0f[_0x6ffc('0x4c')]['id']){delete _0x52ea0f['body']['id'];}return db[_0x6ffc('0x44')][_0x6ffc('0x4d')]({'where':{'id':_0x52ea0f[_0x6ffc('0x4e')]['id']}})[_0x6ffc('0x29')](handleEntityNotFound(_0x3582d4,null))['then'](saveUpdates(_0x52ea0f[_0x6ffc('0x4c')],null))['then'](respondWithResult(_0x3582d4,null))[_0x6ffc('0x49')](handleError(_0x3582d4,null));};exports['destroy']=function(_0x33cc7d,_0x394a67){return db['DeskAccount']['find']({'where':{'id':_0x33cc7d[_0x6ffc('0x4e')]['id']}})[_0x6ffc('0x29')](handleEntityNotFound(_0x394a67,null))[_0x6ffc('0x29')](removeEntity(_0x394a67,null))[_0x6ffc('0x49')](handleError(_0x394a67,null));};exports[_0x6ffc('0x4f')]=function(_0x203f2d,_0x20abf3,_0x2f7479){var _0x4227fe={};var _0x7f94db={};var _0xe208b;var _0x4b7bc4;return db[_0x6ffc('0x44')]['findOne']({'where':{'id':_0x203f2d[_0x6ffc('0x4e')]['id']}})[_0x6ffc('0x29')](handleEntityNotFound(_0x20abf3,null))[_0x6ffc('0x29')](function(_0x43882d){if(_0x43882d){_0xe208b=_0x43882d;_0x7f94db['model']=_[_0x6ffc('0x34')](db[_0x6ffc('0x50')]['rawAttributes']);_0x7f94db['query']=_['keys'](_0x203f2d['query']);_0x7f94db['filters']=_[_0x6ffc('0x36')](_0x7f94db[_0x6ffc('0x31')],_0x7f94db['query']);_0x4227fe['attributes']=_[_0x6ffc('0x36')](_0x7f94db[_0x6ffc('0x31')],qs[_0x6ffc('0x38')](_0x203f2d['query'][_0x6ffc('0x38')]));_0x4227fe['attributes']=_0x4227fe[_0x6ffc('0x37')][_0x6ffc('0x39')]?_0x4227fe[_0x6ffc('0x37')]:_0x7f94db[_0x6ffc('0x31')];_0x4227fe[_0x6ffc('0x3c')]=qs[_0x6ffc('0x3d')](_0x203f2d['query']['sort']);_0x4227fe['where']=qs[_0x6ffc('0x35')](_[_0x6ffc('0x3f')](_0x203f2d[_0x6ffc('0x33')],_0x7f94db['filters']));if(_0x203f2d[_0x6ffc('0x33')][_0x6ffc('0x40')]){_0x4227fe[_0x6ffc('0x3e')]=_[_0x6ffc('0x41')](_0x4227fe[_0x6ffc('0x3e')],{'$or':_[_0x6ffc('0x32')](_0x4227fe['attributes'],function(_0xd83d67){var _0x5b0688={};_0x5b0688[_0xd83d67]={'$like':'%'+_0x203f2d[_0x6ffc('0x33')][_0x6ffc('0x40')]+'%'};return _0x5b0688;})});}_0x4227fe=_[_0x6ffc('0x41')]({},_0x4227fe,_0x203f2d[_0x6ffc('0x43')]);return _0xe208b[_0x6ffc('0x4f')](_0x4227fe);}})[_0x6ffc('0x29')](function(_0x57b26e){if(_0x57b26e){_0x4b7bc4=_0x57b26e[_0x6ffc('0x39')];if(!_0x203f2d[_0x6ffc('0x33')][_0x6ffc('0x3a')]('nolimit')){_0x4227fe[_0x6ffc('0x22')]=qs[_0x6ffc('0x22')](_0x203f2d[_0x6ffc('0x33')][_0x6ffc('0x22')]);_0x4227fe['offset']=qs[_0x6ffc('0x20')](_0x203f2d[_0x6ffc('0x33')][_0x6ffc('0x20')]);}return _0xe208b[_0x6ffc('0x4f')](_0x4227fe);}})[_0x6ffc('0x29')](function(_0x579b24){if(_0x579b24){return _0x579b24?{'count':_0x4b7bc4,'rows':_0x579b24}:null;}})[_0x6ffc('0x29')](respondWithResult(_0x20abf3,null))['catch'](handleError(_0x20abf3,null));};exports[_0x6ffc('0x51')]=function(_0x319b92,_0x4563f0,_0x18f727){if(_0x319b92['body']['id']){delete _0x319b92['body']['id'];}return db[_0x6ffc('0x44')][_0x6ffc('0x52')]({'where':{'id':_0x319b92['params']['id']}})[_0x6ffc('0x29')](handleEntityNotFound(_0x4563f0,null))[_0x6ffc('0x29')](function(_0x405822){if(_0x405822){_0x319b92[_0x6ffc('0x4c')]['AccountId']=_0x405822['id'];_0x319b92['body'][_0x6ffc('0x53')]=integrations[_0x6ffc('0x54')](_0x319b92[_0x6ffc('0x4c')]['channel'],_0x319b92[_0x6ffc('0x4c')][_0x6ffc('0x55')]);_0x319b92[_0x6ffc('0x4c')][_0x6ffc('0x56')]=integrations[_0x6ffc('0x57')](_0x319b92[_0x6ffc('0x4c')][_0x6ffc('0x58')],_0x319b92[_0x6ffc('0x4c')][_0x6ffc('0x55')]);return db[_0x6ffc('0x50')][_0x6ffc('0x4a')](_0x319b92[_0x6ffc('0x4c')],{'include':[{'model':db[_0x6ffc('0x59')],'as':_0x6ffc('0x53')},{'model':db[_0x6ffc('0x59')],'as':_0x6ffc('0x56')}]});}return null;})['then'](respondWithResult(_0x4563f0,null))['catch'](handleError(_0x4563f0,null));};exports[_0x6ffc('0x5a')]=function(_0x19c892,_0xb4199e,_0x53f7ef){var _0x4318bd=[{'name':_0x6ffc('0x5b'),'label':_0x6ffc('0x5b'),'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 _0x488e05='';return db[_0x6ffc('0x44')][_0x6ffc('0x52')]({'where':{'id':_0x19c892['params']['id']},'attributes':['id','remoteUri',_0x6ffc('0x5c'),_0x6ffc('0x5d'),_0x6ffc('0x5e'),_0x6ffc('0x5f'),_0x6ffc('0x60'),_0x6ffc('0x61'),_0x6ffc('0x62')]})[_0x6ffc('0x29')](handleEntityNotFound(_0xb4199e,null))[_0x6ffc('0x29')](function(_0x25f4ec){if(_0x25f4ec){_0x488e05=_0x25f4ec[_0x6ffc('0x63')];var _0x9236c=_0x488e05[_0x6ffc('0x64')](-0x1);if(_0x9236c==='/'){_0x488e05=_0x488e05[_0x6ffc('0x65')](0x0,_0x488e05['lastIndexOf'](_0x9236c));}var _0x3adada={'method':_0x6ffc('0x66'),'uri':util[_0x6ffc('0x67')](_0x6ffc('0x68'),_0x488e05),'headers':{'Content-Type':_0x6ffc('0x69'),'Accept':_0x6ffc('0x69')},'json':!![]};if(_0x25f4ec[_0x6ffc('0x5c')]===_0x6ffc('0x6a')){_0x3adada[_0x6ffc('0x6b')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util['format'](_0x6ffc('0x6c'),_0x25f4ec['username'],_0x25f4ec[_0x6ffc('0x5e')]))[_0x6ffc('0x6d')](_0x6ffc('0x6e')));}return rp(_0x3adada)['then'](function(_0x5e9185){return _0x4318bd[_0x6ffc('0x6f')](_[_0x6ffc('0x32')](_0x5e9185[_0x6ffc('0x70')]['entries'],function(_0x55e1d3){return{'id':_0x55e1d3[_0x6ffc('0x2d')],'name':_0x55e1d3[_0x6ffc('0x2d')],'type':_0x55e1d3[_0x6ffc('0x55')],'active':_0x55e1d3[_0x6ffc('0x71')],'label':_0x55e1d3['label'],'custom':!![]};}));});}})[_0x6ffc('0x29')](function(_0x1f7c7b){return{'count':_0x1f7c7b[_0x6ffc('0x39')],'rows':_0x1f7c7b};})[_0x6ffc('0x29')](respondWithResult(_0xb4199e,null))[_0x6ffc('0x49')](function(_0x32f77b){var _0x25b45d=_0x19c892[_0x6ffc('0x33')]['test']?0x1f4:_0x32f77b[_0x6ffc('0x72')]||0x1f4;logger['error'](_0x6ffc('0x73'),_0x6ffc('0x5a'),_0x25b45d,JSON[_0x6ffc('0x74')](_0x32f77b));delete _0x32f77b['name'];if(_0x25b45d===0x191){_0x25b45d=0x190;}_0xb4199e[_0x6ffc('0x1d')](_0x25b45d)[_0x6ffc('0x2e')](_0x19c892[_0x6ffc('0x33')][_0x6ffc('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x32f77b[_0x6ffc('0x72')]}:_0x32f77b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ac8744d..d8f3e46 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 _0x38b1=['moment','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','define','lodash','util'];(function(_0x43f136,_0x365817){var _0x531928=function(_0x5a59e9){while(--_0x5a59e9){_0x43f136['push'](_0x43f136['shift']());}};_0x531928(++_0x365817);}(_0x38b1,0xfe));var _0x138b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x38b1[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x138b('0x0'));var util=require(_0x138b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x138b('0x2'));var BPromise=require('bluebird');var rp=require(_0x138b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x138b('0x4'));var config=require(_0x138b('0x5'));var attributes=require(_0x138b('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1b2ef1,_0x1b5cd9){return _0x1b2ef1[_0x138b('0x7')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9637=['bluebird','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','../../config/logger','moment'];(function(_0x5430a9,_0x320e99){var _0x110c79=function(_0x41360c){while(--_0x41360c){_0x5430a9['push'](_0x5430a9['shift']());}};_0x110c79(++_0x320e99);}(_0x9637,0x194));var _0x7963=function(_0x4e7ca2,_0x21c458){_0x4e7ca2=_0x4e7ca2-0x0;var _0x3f8cc2=_0x9637[_0x4e7ca2];return _0x3f8cc2;};'use strict';var _=require(_0x7963('0x0'));var util=require('util');var logger=require(_0x7963('0x1'))('api');var moment=require(_0x7963('0x2'));var BPromise=require(_0x7963('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7963('0x4'));var rimraf=require('rimraf');var config=require(_0x7963('0x5'));var attributes=require(_0x7963('0x6'));var integrations=require(_0x7963('0x7'));module[_0x7963('0x8')]=function(_0xe1af2,_0x21292e){return _0xe1af2[_0x7963('0x9')]('DeskAccount',attributes,{'tableName':_0x7963('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 147ccf7..279cb23 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 _0x6b6b=['map','model','ShowDeskAccount','find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include'];(function(_0x1c868b,_0x113799){var _0x51fa95=function(_0x65b141){while(--_0x65b141){_0x1c868b['push'](_0x1c868b['shift']());}};_0x51fa95(++_0x113799);}(_0x6b6b,0xfa));var _0xb6b6=function(_0x428eee,_0x28723a){_0x428eee=_0x428eee-0x0;var _0x5b3b05=_0x6b6b[_0x428eee];return _0x5b3b05;};'use strict';var _=require(_0xb6b6('0x0'));var util=require(_0xb6b6('0x1'));var moment=require('moment');var BPromise=require(_0xb6b6('0x2'));var rs=require(_0xb6b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6b6('0x4'))['db'];var utils=require(_0xb6b6('0x5'));var logger=require(_0xb6b6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb6b6('0x7'));var client=jayson['client'][_0xb6b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x583eea,_0x423c93,_0x7f6104){return new BPromise(function(_0x232b84,_0x4d6865){return client[_0xb6b6('0x9')](_0x583eea,_0x7f6104)[_0xb6b6('0xa')](function(_0x488ac1){logger[_0xb6b6('0xb')](_0xb6b6('0xc'),_0x423c93,_0xb6b6('0xd'));logger[_0xb6b6('0xe')](_0xb6b6('0xf'),_0x423c93,'request\x20sent',JSON[_0xb6b6('0x10')](_0x488ac1));if(_0x488ac1[_0xb6b6('0x11')]){if(_0x488ac1[_0xb6b6('0x11')][_0xb6b6('0x12')]===0x1f4){logger['error'](_0xb6b6('0xc'),_0x423c93,_0x488ac1[_0xb6b6('0x11')][_0xb6b6('0x13')]);return _0x4d6865(_0x488ac1[_0xb6b6('0x11')]['message']);}logger[_0xb6b6('0x11')](_0xb6b6('0xc'),_0x423c93,_0x488ac1['error'][_0xb6b6('0x13')]);return _0x232b84(_0x488ac1['error'][_0xb6b6('0x13')]);}else{logger['info'](_0xb6b6('0xc'),_0x423c93,_0xb6b6('0xd'));_0x232b84(_0x488ac1[_0xb6b6('0x14')][_0xb6b6('0x13')]);}})[_0xb6b6('0x15')](function(_0x5003c7){logger['error']('DeskAccount,\x20%s,\x20%s',_0x423c93,_0x5003c7);_0x4d6865(_0x5003c7);});});}exports[_0xb6b6('0x16')]=function(_0x36bc1d){var _0x4f523c=this;return new Promise(function(_0x533b72,_0x23b5b3){return db[_0xb6b6('0x17')][_0xb6b6('0x18')]({'raw':_0x36bc1d[_0xb6b6('0x19')]?_0x36bc1d['options'][_0xb6b6('0x1a')]===undefined?!![]:![]:!![],'where':_0x36bc1d[_0xb6b6('0x19')]?_0x36bc1d[_0xb6b6('0x19')]['where']||null:null,'attributes':_0x36bc1d[_0xb6b6('0x19')]?_0x36bc1d[_0xb6b6('0x19')][_0xb6b6('0x1b')]||null:null,'limit':_0x36bc1d[_0xb6b6('0x19')]?_0x36bc1d['options'][_0xb6b6('0x1c')]||null:null,'include':_0x36bc1d[_0xb6b6('0x19')]?_0x36bc1d['options'][_0xb6b6('0x1d')]?_[_0xb6b6('0x1e')](_0x36bc1d[_0xb6b6('0x19')]['include'],function(_0xadf021){return{'model':db[_0xadf021[_0xb6b6('0x1f')]],'as':_0xadf021['as'],'attributes':_0xadf021[_0xb6b6('0x1b')],'include':_0xadf021[_0xb6b6('0x1d')]?_['map'](_0xadf021[_0xb6b6('0x1d')],function(_0x17d0a3){return{'model':db[_0x17d0a3[_0xb6b6('0x1f')]],'as':_0x17d0a3['as'],'attributes':_0x17d0a3['attributes'],'include':_0x17d0a3[_0xb6b6('0x1d')]?_[_0xb6b6('0x1e')](_0x17d0a3[_0xb6b6('0x1d')],function(_0x384249){return{'model':db[_0x384249[_0xb6b6('0x1f')]],'as':_0x384249['as'],'attributes':_0x384249[_0xb6b6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb6b6('0xa')](function(_0x1d91f0){logger[_0xb6b6('0xb')](_0xb6b6('0x16'),_0x36bc1d);logger[_0xb6b6('0xe')](_0xb6b6('0x16'),_0x36bc1d,JSON[_0xb6b6('0x10')](_0x1d91f0));_0x533b72(_0x1d91f0);})['catch'](function(_0x4852d5){logger[_0xb6b6('0x11')](_0xb6b6('0x16'),_0x4852d5[_0xb6b6('0x13')],_0x36bc1d);_0x23b5b3(_0x4f523c['error'](0x1f4,_0x4852d5[_0xb6b6('0x13')]));});});};exports[_0xb6b6('0x20')]=function(_0xd37b8f){var _0x2fda8b=this;return new Promise(function(_0x143887,_0x4728f2){return db['DeskAccount'][_0xb6b6('0x21')]({'raw':_0xd37b8f[_0xb6b6('0x19')]?_0xd37b8f[_0xb6b6('0x19')][_0xb6b6('0x1a')]===undefined?!![]:![]:!![],'where':_0xd37b8f[_0xb6b6('0x19')]?_0xd37b8f[_0xb6b6('0x19')][_0xb6b6('0x22')]||null:null,'attributes':_0xd37b8f[_0xb6b6('0x19')]?_0xd37b8f[_0xb6b6('0x19')][_0xb6b6('0x1b')]||null:null,'include':_0xd37b8f[_0xb6b6('0x19')]?_0xd37b8f['options'][_0xb6b6('0x1d')]?_[_0xb6b6('0x1e')](_0xd37b8f[_0xb6b6('0x19')][_0xb6b6('0x1d')],function(_0x136546){return{'model':db[_0x136546[_0xb6b6('0x1f')]],'as':_0x136546['as'],'attributes':_0x136546['attributes'],'include':_0x136546[_0xb6b6('0x1d')]?_['map'](_0x136546[_0xb6b6('0x1d')],function(_0x55b0bf){return{'model':db[_0x55b0bf[_0xb6b6('0x1f')]],'as':_0x55b0bf['as'],'attributes':_0x55b0bf[_0xb6b6('0x1b')],'include':_0x55b0bf[_0xb6b6('0x1d')]?_[_0xb6b6('0x1e')](_0x55b0bf[_0xb6b6('0x1d')],function(_0xef2cfe){return{'model':db[_0xef2cfe[_0xb6b6('0x1f')]],'as':_0xef2cfe['as'],'attributes':_0xef2cfe[_0xb6b6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb6b6('0xa')](function(_0x9cb83e){logger['info'](_0xb6b6('0x20'),_0xd37b8f);logger[_0xb6b6('0xe')](_0xb6b6('0x20'),_0xd37b8f,JSON[_0xb6b6('0x10')](_0x9cb83e));_0x143887(_0x9cb83e);})[_0xb6b6('0x15')](function(_0xa57961){logger[_0xb6b6('0x11')](_0xb6b6('0x20'),_0xa57961[_0xb6b6('0x13')],_0xd37b8f);_0x4728f2(_0x2fda8b['error'](0x1f4,_0xa57961[_0xb6b6('0x13')]));});});}; \ No newline at end of file +var _0x2791=['find','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','map','stringify','ShowDeskAccount'];(function(_0x2d9c81,_0xc8aa59){var _0x2b1c86=function(_0x5cd7ee){while(--_0x5cd7ee){_0x2d9c81['push'](_0x2d9c81['shift']());}};_0x2b1c86(++_0xc8aa59);}(_0x2791,0x16d));var _0x1279=function(_0x6d0678,_0x48dcae){_0x6d0678=_0x6d0678-0x0;var _0x4fe510=_0x2791[_0x6d0678];return _0x4fe510;};'use strict';var _=require(_0x1279('0x0'));var util=require(_0x1279('0x1'));var moment=require(_0x1279('0x2'));var BPromise=require(_0x1279('0x3'));var rs=require(_0x1279('0x4'));var fs=require('fs');var Redis=require(_0x1279('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1279('0x6'))(_0x1279('0x7'));var config=require(_0x1279('0x8'));var jayson=require(_0x1279('0x9'));var client=jayson[_0x1279('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5425e3,_0x623905,_0x63a619){return new BPromise(function(_0x2d092a,_0x3914b4){return client[_0x1279('0xb')](_0x5425e3,_0x63a619)[_0x1279('0xc')](function(_0x1bc583){logger[_0x1279('0xd')](_0x1279('0xe'),_0x623905,_0x1279('0xf'));logger[_0x1279('0x10')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x623905,_0x1279('0xf'),JSON['stringify'](_0x1bc583));if(_0x1bc583[_0x1279('0x11')]){if(_0x1bc583['error']['code']===0x1f4){logger[_0x1279('0x11')]('DeskAccount,\x20%s,\x20%s',_0x623905,_0x1bc583[_0x1279('0x11')][_0x1279('0x12')]);return _0x3914b4(_0x1bc583['error']['message']);}logger[_0x1279('0x11')](_0x1279('0xe'),_0x623905,_0x1bc583[_0x1279('0x11')]['message']);return _0x2d092a(_0x1bc583[_0x1279('0x11')][_0x1279('0x12')]);}else{logger['info'](_0x1279('0xe'),_0x623905,'request\x20sent');_0x2d092a(_0x1bc583['result']['message']);}})[_0x1279('0x13')](function(_0xb3c5c1){logger[_0x1279('0x11')](_0x1279('0xe'),_0x623905,_0xb3c5c1);_0x3914b4(_0xb3c5c1);});});}exports[_0x1279('0x14')]=function(_0x32507b){var _0x41036d=this;return new Promise(function(_0x5cd05a,_0x510e53){return db[_0x1279('0x15')][_0x1279('0x16')]({'raw':_0x32507b[_0x1279('0x17')]?_0x32507b[_0x1279('0x17')][_0x1279('0x18')]===undefined?!![]:![]:!![],'where':_0x32507b[_0x1279('0x17')]?_0x32507b['options'][_0x1279('0x19')]||null:null,'attributes':_0x32507b[_0x1279('0x17')]?_0x32507b['options'][_0x1279('0x1a')]||null:null,'limit':_0x32507b[_0x1279('0x17')]?_0x32507b[_0x1279('0x17')]['limit']||null:null,'include':_0x32507b[_0x1279('0x17')]?_0x32507b[_0x1279('0x17')][_0x1279('0x1b')]?_[_0x1279('0x1c')](_0x32507b[_0x1279('0x17')][_0x1279('0x1b')],function(_0x4e245e){return{'model':db[_0x4e245e['model']],'as':_0x4e245e['as'],'attributes':_0x4e245e[_0x1279('0x1a')],'include':_0x4e245e[_0x1279('0x1b')]?_[_0x1279('0x1c')](_0x4e245e['include'],function(_0x2d734e){return{'model':db[_0x2d734e['model']],'as':_0x2d734e['as'],'attributes':_0x2d734e[_0x1279('0x1a')],'include':_0x2d734e[_0x1279('0x1b')]?_[_0x1279('0x1c')](_0x2d734e[_0x1279('0x1b')],function(_0x13dfa3){return{'model':db[_0x13dfa3['model']],'as':_0x13dfa3['as'],'attributes':_0x13dfa3['attributes']};}):[]};}):[]};}):[]:[]})[_0x1279('0xc')](function(_0x57a06b){logger[_0x1279('0xd')](_0x1279('0x14'),_0x32507b);logger[_0x1279('0x10')](_0x1279('0x14'),_0x32507b,JSON[_0x1279('0x1d')](_0x57a06b));_0x5cd05a(_0x57a06b);})[_0x1279('0x13')](function(_0x29e6f5){logger[_0x1279('0x11')]('GetDeskAccount',_0x29e6f5[_0x1279('0x12')],_0x32507b);_0x510e53(_0x41036d[_0x1279('0x11')](0x1f4,_0x29e6f5[_0x1279('0x12')]));});});};exports[_0x1279('0x1e')]=function(_0x49be87){var _0x4a5ba5=this;return new Promise(function(_0xe699a4,_0x194cd2){return db[_0x1279('0x15')][_0x1279('0x1f')]({'raw':_0x49be87['options']?_0x49be87[_0x1279('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x49be87[_0x1279('0x17')]?_0x49be87[_0x1279('0x17')][_0x1279('0x19')]||null:null,'attributes':_0x49be87[_0x1279('0x17')]?_0x49be87[_0x1279('0x17')][_0x1279('0x1a')]||null:null,'include':_0x49be87[_0x1279('0x17')]?_0x49be87[_0x1279('0x17')][_0x1279('0x1b')]?_[_0x1279('0x1c')](_0x49be87[_0x1279('0x17')][_0x1279('0x1b')],function(_0xce925e){return{'model':db[_0xce925e[_0x1279('0x20')]],'as':_0xce925e['as'],'attributes':_0xce925e[_0x1279('0x1a')],'include':_0xce925e['include']?_[_0x1279('0x1c')](_0xce925e[_0x1279('0x1b')],function(_0x1025ab){return{'model':db[_0x1025ab[_0x1279('0x20')]],'as':_0x1025ab['as'],'attributes':_0x1025ab['attributes'],'include':_0x1025ab[_0x1279('0x1b')]?_[_0x1279('0x1c')](_0x1025ab[_0x1279('0x1b')],function(_0x2cc373){return{'model':db[_0x2cc373[_0x1279('0x20')]],'as':_0x2cc373['as'],'attributes':_0x2cc373[_0x1279('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1279('0xc')](function(_0x414732){logger[_0x1279('0xd')](_0x1279('0x1e'),_0x49be87);logger['debug'](_0x1279('0x1e'),_0x49be87,JSON['stringify'](_0x414732));_0xe699a4(_0x414732);})['catch'](function(_0x43db81){logger[_0x1279('0x11')](_0x1279('0x1e'),_0x43db81[_0x1279('0x12')],_0x49be87);_0x194cd2(_0x4a5ba5[_0x1279('0x11')](0x1f4,_0x43db81[_0x1279('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 59f3467..a6dfeb8 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xcf00e3,_0x9b132f){var _0x54bfc8=function(_0x583ff3){while(--_0x583ff3){_0xcf00e3['push'](_0xcf00e3['shift']());}};_0x54bfc8(++_0x9b132f);}(_0x008c,0x188));var _0xc008=function(_0xa46b86,_0x5c1465){_0xa46b86=_0xa46b86-0x0;var _0x417360=_0x008c[_0xa46b86];return _0x417360;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x472966,_0x222ea7){var _0x3d83b7=function(_0x37dc57){while(--_0x37dc57){_0x472966['push'](_0x472966['shift']());}};_0x3d83b7(++_0x222ea7);}(_0x008c,0x188));var _0xc008=function(_0x557886,_0x525a5e){_0x557886=_0x557886-0x0;var _0x3026ba=_0x008c[_0x557886];return _0x3026ba;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f225a68..f8abc5b 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 _0xc822=['exports','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc822,0xd9));var _0x2c82=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0xc822[_0x1aba25];return _0x47d997;};'use strict';var Sequelize=require(_0x2c82('0x0'));module[_0x2c82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7078=['sequelize','exports','STRING'];(function(_0x13ce0f,_0x354d4c){var _0x1beae8=function(_0x25a40b){while(--_0x25a40b){_0x13ce0f['push'](_0x13ce0f['shift']());}};_0x1beae8(++_0x354d4c);}(_0x7078,0x1ef));var _0x8707=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7078[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x8707('0x0'));module[_0x8707('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8707('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ad9569e..6f04c85 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 _0x782e=['nolimit','order','sort','where','pick','merge','includeAll','findAll','rows','show','params','keys','options','body','catch','find','getFields','findOne','filter','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','destroy','then','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0xa58a3e,_0x115109){var _0x4f6cd2=function(_0x487d99){while(--_0x487d99){_0xa58a3e['push'](_0xa58a3e['shift']());}};_0x4f6cd2(++_0x115109);}(_0x782e,0x1ae));var _0xe782=function(_0x315ffc,_0x281f1c){_0x315ffc=_0x315ffc-0x0;var _0x5b6d27=_0x782e[_0x315ffc];return _0x5b6d27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe782('0x0'));var zipdir=require(_0xe782('0x1'));var jsonpatch=require(_0xe782('0x2'));var rp=require(_0xe782('0x3'));var moment=require(_0xe782('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe782('0x5'));var util=require(_0xe782('0x6'));var path=require(_0xe782('0x7'));var sox=require(_0xe782('0x8'));var csv=require(_0xe782('0x9'));var ejs=require(_0xe782('0xa'));var fs=require('fs');var fs_extra=require(_0xe782('0xb'));var _=require(_0xe782('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe782('0xd'));var toCsv=require(_0xe782('0x9'));var querystring=require(_0xe782('0xe'));var Papa=require('papaparse');var Redis=require(_0xe782('0xf'));var authService=require(_0xe782('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe782('0x11'));var hardwareService=require(_0xe782('0x12'));var logger=require(_0xe782('0x13'))(_0xe782('0x14'));var utils=require(_0xe782('0x15'));var config=require(_0xe782('0x16'));var licenseUtil=require(_0xe782('0x17'));var db=require(_0xe782('0x18'))['db'];function respondWithStatusCode(_0x424820,_0x52fd7a){_0x52fd7a=_0x52fd7a||0xcc;return function(_0x15bde0){if(_0x15bde0){return _0x424820[_0xe782('0x19')](_0x52fd7a);}return _0x424820[_0xe782('0x1a')](_0x52fd7a)[_0xe782('0x1b')]();};}function respondWithResult(_0x15757f,_0x5b7479){_0x5b7479=_0x5b7479||0xc8;return function(_0x5bb1e5){if(_0x5bb1e5){return _0x15757f[_0xe782('0x1a')](_0x5b7479)[_0xe782('0x1c')](_0x5bb1e5);}};}function respondWithFilteredResult(_0x5c42ef,_0xecde2c){return function(_0x14987a){if(_0x14987a){var _0xef1bda=typeof _0xecde2c['offset']===_0xe782('0x1d')&&typeof _0xecde2c[_0xe782('0x1e')]==='undefined';var _0x4fa2fe=_0x14987a[_0xe782('0x1f')];var _0x152330=_0xef1bda?0x0:_0xecde2c[_0xe782('0x20')];var _0x12033b=_0xef1bda?_0x14987a[_0xe782('0x1f')]:_0xecde2c[_0xe782('0x20')]+_0xecde2c['limit'];var _0x4f3306;if(_0x12033b>=_0x4fa2fe){_0x12033b=_0x4fa2fe;_0x4f3306=0xc8;}else{_0x4f3306=0xce;}_0x5c42ef[_0xe782('0x1a')](_0x4f3306);return _0x5c42ef[_0xe782('0x21')]('Content-Range',_0x152330+'-'+_0x12033b+'/'+_0x4fa2fe)[_0xe782('0x1c')](_0x14987a);}return null;};}function patchUpdates(_0x22796f){return function(_0x1f9e35){try{jsonpatch[_0xe782('0x22')](_0x1f9e35,_0x22796f,!![]);}catch(_0x2be7f7){return BPromise['reject'](_0x2be7f7);}return _0x1f9e35[_0xe782('0x23')]();};}function saveUpdates(_0x1ef524,_0x4ef506){return function(_0x45b210){if(_0x45b210){return _0x45b210[_0xe782('0x24')](_0x1ef524)['then'](function(_0xbf0596){return _0xbf0596;});}return null;};}function removeEntity(_0x57192d,_0x3e0303){return function(_0x559c2c){if(_0x559c2c){return _0x559c2c[_0xe782('0x25')]()[_0xe782('0x26')](function(){_0x57192d[_0xe782('0x1a')](0xcc)[_0xe782('0x1b')]();});}};}function handleEntityNotFound(_0x147861,_0x2c71c1){return function(_0x2b3ce9){if(!_0x2b3ce9){_0x147861[_0xe782('0x19')](0x194);}return _0x2b3ce9;};}function handleError(_0x55bae4,_0x5296e5){_0x5296e5=_0x5296e5||0x1f4;return function(_0x3bdacf){logger['error'](_0x3bdacf['stack']);if(_0x3bdacf[_0xe782('0x27')]){delete _0x3bdacf[_0xe782('0x27')];}_0x55bae4[_0xe782('0x1a')](_0x5296e5)[_0xe782('0x28')](_0x3bdacf);};}exports[_0xe782('0x29')]=function(_0x56002a,_0x2a322d){var _0x3c12d2={},_0x27217e={},_0x5ecbe9={'count':0x0,'rows':[]};var _0x331a16=_[_0xe782('0x2a')](db[_0xe782('0x2b')][_0xe782('0x2c')],function(_0x1d886f){return{'name':_0x1d886f[_0xe782('0x2d')],'type':_0x1d886f[_0xe782('0x2e')][_0xe782('0x2f')]};});_0x27217e[_0xe782('0x30')]=_[_0xe782('0x2a')](_0x331a16,_0xe782('0x27'));_0x27217e[_0xe782('0x31')]=_['keys'](_0x56002a[_0xe782('0x31')]);_0x27217e[_0xe782('0x32')]=_['intersection'](_0x27217e[_0xe782('0x30')],_0x27217e[_0xe782('0x31')]);_0x3c12d2[_0xe782('0x33')]=_[_0xe782('0x34')](_0x27217e['model'],qs['fields'](_0x56002a['query'][_0xe782('0x35')]));_0x3c12d2[_0xe782('0x33')]=_0x3c12d2['attributes'][_0xe782('0x36')]?_0x3c12d2[_0xe782('0x33')]:_0x27217e[_0xe782('0x30')];if(!_0x56002a[_0xe782('0x31')][_0xe782('0x37')](_0xe782('0x38'))){_0x3c12d2[_0xe782('0x1e')]=qs[_0xe782('0x1e')](_0x56002a[_0xe782('0x31')][_0xe782('0x1e')]);_0x3c12d2[_0xe782('0x20')]=qs[_0xe782('0x20')](_0x56002a[_0xe782('0x31')][_0xe782('0x20')]);}_0x3c12d2[_0xe782('0x39')]=qs[_0xe782('0x3a')](_0x56002a[_0xe782('0x31')][_0xe782('0x3a')]);_0x3c12d2[_0xe782('0x3b')]=qs[_0xe782('0x32')](_[_0xe782('0x3c')](_0x56002a['query'],_0x27217e[_0xe782('0x32')]),_0x331a16);if(_0x56002a[_0xe782('0x31')]['filter']){_0x3c12d2[_0xe782('0x3b')]=_[_0xe782('0x3d')](_0x3c12d2[_0xe782('0x3b')],{'$or':_[_0xe782('0x2a')](_0x331a16,function(_0x13f8c5){if(_0x13f8c5[_0xe782('0x2e')]!=='VIRTUAL'){var _0x339f7c={};_0x339f7c[_0x13f8c5[_0xe782('0x27')]]={'$like':'%'+_0x56002a[_0xe782('0x31')]['filter']+'%'};return _0x339f7c;}})});}_0x3c12d2=_[_0xe782('0x3d')]({},_0x3c12d2,_0x56002a['options']);var _0x302c92={'where':_0x3c12d2['where']};return db[_0xe782('0x2b')][_0xe782('0x1f')](_0x302c92)[_0xe782('0x26')](function(_0x4187a3){_0x5ecbe9['count']=_0x4187a3;if(_0x56002a[_0xe782('0x31')][_0xe782('0x3e')]){_0x3c12d2['include']=[{'all':!![]}];}return db[_0xe782('0x2b')][_0xe782('0x3f')](_0x3c12d2);})[_0xe782('0x26')](function(_0x479931){_0x5ecbe9[_0xe782('0x40')]=_0x479931;return _0x5ecbe9;})['then'](respondWithFilteredResult(_0x2a322d,_0x3c12d2))['catch'](handleError(_0x2a322d,null));};exports[_0xe782('0x41')]=function(_0x263a4c,_0x2a5a8c){var _0x2cac7c={'raw':![],'where':{'id':_0x263a4c[_0xe782('0x42')]['id']}},_0x5774e0={};_0x5774e0[_0xe782('0x30')]=_[_0xe782('0x43')](db['DeskConfiguration'][_0xe782('0x2c')]);_0x5774e0[_0xe782('0x31')]=_[_0xe782('0x43')](_0x263a4c[_0xe782('0x31')]);_0x5774e0[_0xe782('0x32')]=_[_0xe782('0x34')](_0x5774e0['model'],_0x5774e0[_0xe782('0x31')]);_0x2cac7c[_0xe782('0x33')]=_[_0xe782('0x34')](_0x5774e0[_0xe782('0x30')],qs[_0xe782('0x35')](_0x263a4c[_0xe782('0x31')][_0xe782('0x35')]));_0x2cac7c[_0xe782('0x33')]=_0x2cac7c[_0xe782('0x33')][_0xe782('0x36')]?_0x2cac7c[_0xe782('0x33')]:_0x5774e0[_0xe782('0x30')];if(_0x263a4c[_0xe782('0x31')]['includeAll']){_0x2cac7c['include']=[{'all':!![]}];}_0x2cac7c=_[_0xe782('0x3d')]({},_0x2cac7c,_0x263a4c[_0xe782('0x44')]);return db['DeskConfiguration']['find'](_0x2cac7c)[_0xe782('0x26')](handleEntityNotFound(_0x2a5a8c,null))[_0xe782('0x26')](respondWithResult(_0x2a5a8c,null))['catch'](handleError(_0x2a5a8c,null));};exports['create']=function(_0x2f66ce,_0xebfa27){return db['DeskConfiguration']['create'](_0x2f66ce[_0xe782('0x45')],{})[_0xe782('0x26')](respondWithResult(_0xebfa27,0xc9))[_0xe782('0x46')](handleError(_0xebfa27,null));};exports[_0xe782('0x24')]=function(_0x40c28e,_0x2ef2bd){if(_0x40c28e['body']['id']){delete _0x40c28e[_0xe782('0x45')]['id'];}return db[_0xe782('0x2b')][_0xe782('0x47')]({'where':{'id':_0x40c28e['params']['id']}})[_0xe782('0x26')](handleEntityNotFound(_0x2ef2bd,null))['then'](saveUpdates(_0x40c28e['body'],null))['then'](respondWithResult(_0x2ef2bd,null))[_0xe782('0x46')](handleError(_0x2ef2bd,null));};exports[_0xe782('0x25')]=function(_0x2fde36,_0x4f55a3){return db[_0xe782('0x2b')][_0xe782('0x47')]({'where':{'id':_0x2fde36[_0xe782('0x42')]['id']}})[_0xe782('0x26')](handleEntityNotFound(_0x4f55a3,null))[_0xe782('0x26')](removeEntity(_0x4f55a3,null))[_0xe782('0x46')](handleError(_0x4f55a3,null));};exports[_0xe782('0x48')]=function(_0x2e03b3,_0xb47829,_0x2d3db2){var _0x5d4aad={};var _0x2315c9={};var _0x1ead25;var _0x1840c8;return db[_0xe782('0x2b')][_0xe782('0x49')]({'where':{'id':_0x2e03b3[_0xe782('0x42')]['id']}})[_0xe782('0x26')](handleEntityNotFound(_0xb47829,null))[_0xe782('0x26')](function(_0x5e1c0a){if(_0x5e1c0a){_0x1ead25=_0x5e1c0a;_0x2315c9['model']=_[_0xe782('0x43')](db['DeskField'][_0xe782('0x2c')]);_0x2315c9[_0xe782('0x31')]=_[_0xe782('0x43')](_0x2e03b3['query']);_0x2315c9['filters']=_['intersection'](_0x2315c9[_0xe782('0x30')],_0x2315c9[_0xe782('0x31')]);_0x5d4aad[_0xe782('0x33')]=_[_0xe782('0x34')](_0x2315c9[_0xe782('0x30')],qs[_0xe782('0x35')](_0x2e03b3[_0xe782('0x31')][_0xe782('0x35')]));_0x5d4aad[_0xe782('0x33')]=_0x5d4aad[_0xe782('0x33')][_0xe782('0x36')]?_0x5d4aad[_0xe782('0x33')]:_0x2315c9['model'];_0x5d4aad['order']=qs[_0xe782('0x3a')](_0x2e03b3[_0xe782('0x31')][_0xe782('0x3a')]);_0x5d4aad[_0xe782('0x3b')]=qs[_0xe782('0x32')](_[_0xe782('0x3c')](_0x2e03b3[_0xe782('0x31')],_0x2315c9[_0xe782('0x32')]));if(_0x2e03b3['query'][_0xe782('0x4a')]){_0x5d4aad[_0xe782('0x3b')]=_['merge'](_0x5d4aad[_0xe782('0x3b')],{'$or':_['map'](_0x5d4aad[_0xe782('0x33')],function(_0x20ee3d){var _0x4deb79={};_0x4deb79[_0x20ee3d]={'$like':'%'+_0x2e03b3['query'][_0xe782('0x4a')]+'%'};return _0x4deb79;})});}_0x5d4aad=_[_0xe782('0x3d')]({},_0x5d4aad,_0x2e03b3['options']);return _0x1ead25[_0xe782('0x48')](_0x5d4aad);}})[_0xe782('0x26')](function(_0x28433e){if(_0x28433e){_0x1840c8=_0x28433e['length'];if(!_0x2e03b3[_0xe782('0x31')][_0xe782('0x37')]('nolimit')){_0x5d4aad[_0xe782('0x1e')]=qs[_0xe782('0x1e')](_0x2e03b3[_0xe782('0x31')][_0xe782('0x1e')]);_0x5d4aad[_0xe782('0x20')]=qs[_0xe782('0x20')](_0x2e03b3[_0xe782('0x31')][_0xe782('0x20')]);}return _0x1ead25['getFields'](_0x5d4aad);}})['then'](function(_0x1d1428){if(_0x1d1428){return _0x1d1428?{'count':_0x1840c8,'rows':_0x1d1428}:null;}})[_0xe782('0x26')](respondWithResult(_0xb47829,null))['catch'](handleError(_0xb47829,null));};exports[_0xe782('0x4b')]=function(_0x460804,_0x2a4e95,_0x21e8e6){var _0x57c926={};var _0x5241bd={};var _0x2f657a;var _0x430b4b;return db[_0xe782('0x2b')][_0xe782('0x49')]({'where':{'id':_0x460804['params']['id']}})['then'](handleEntityNotFound(_0x2a4e95,null))[_0xe782('0x26')](function(_0x4897ba){if(_0x4897ba){_0x2f657a=_0x4897ba;_0x5241bd['model']=_[_0xe782('0x43')](db[_0xe782('0x4c')][_0xe782('0x2c')]);_0x5241bd[_0xe782('0x31')]=_['keys'](_0x460804['query']);_0x5241bd[_0xe782('0x32')]=_[_0xe782('0x34')](_0x5241bd[_0xe782('0x30')],_0x5241bd[_0xe782('0x31')]);_0x57c926[_0xe782('0x33')]=_[_0xe782('0x34')](_0x5241bd[_0xe782('0x30')],qs[_0xe782('0x35')](_0x460804[_0xe782('0x31')][_0xe782('0x35')]));_0x57c926[_0xe782('0x33')]=_0x57c926[_0xe782('0x33')]['length']?_0x57c926['attributes']:_0x5241bd[_0xe782('0x30')];_0x57c926[_0xe782('0x39')]=qs[_0xe782('0x3a')](_0x460804[_0xe782('0x31')][_0xe782('0x3a')]);_0x57c926[_0xe782('0x3b')]=qs[_0xe782('0x32')](_[_0xe782('0x3c')](_0x460804[_0xe782('0x31')],_0x5241bd[_0xe782('0x32')]));if(_0x460804['query'][_0xe782('0x4a')]){_0x57c926[_0xe782('0x3b')]=_[_0xe782('0x3d')](_0x57c926[_0xe782('0x3b')],{'$or':_[_0xe782('0x2a')](_0x57c926[_0xe782('0x33')],function(_0x4e9362){var _0x7caaee={};_0x7caaee[_0x4e9362]={'$like':'%'+_0x460804[_0xe782('0x31')][_0xe782('0x4a')]+'%'};return _0x7caaee;})});}_0x57c926=_[_0xe782('0x3d')]({},_0x57c926,_0x460804[_0xe782('0x44')]);return _0x2f657a[_0xe782('0x4b')](_0x57c926);}})['then'](function(_0x56f53c){if(_0x56f53c){_0x430b4b=_0x56f53c['length'];if(!_0x460804['query'][_0xe782('0x37')]('nolimit')){_0x57c926[_0xe782('0x1e')]=qs[_0xe782('0x1e')](_0x460804[_0xe782('0x31')][_0xe782('0x1e')]);_0x57c926[_0xe782('0x20')]=qs[_0xe782('0x20')](_0x460804[_0xe782('0x31')][_0xe782('0x20')]);}return _0x2f657a[_0xe782('0x4b')](_0x57c926);}})[_0xe782('0x26')](function(_0x10cc91){if(_0x10cc91){return _0x10cc91?{'count':_0x430b4b,'rows':_0x10cc91}:null;}})[_0xe782('0x26')](respondWithResult(_0x2a4e95,null))['catch'](handleError(_0x2a4e95,null));};exports[_0xe782('0x4d')]=function(_0x24217e,_0x4f243d,_0x2f64f0){var _0x333d96={};var _0x2a6f3d={};var _0x341d2b;var _0x558215;return db['DeskConfiguration'][_0xe782('0x49')]({'where':{'id':_0x24217e[_0xe782('0x42')]['id']}})[_0xe782('0x26')](handleEntityNotFound(_0x4f243d,null))['then'](function(_0x225004){if(_0x225004){_0x341d2b=_0x225004;_0x2a6f3d['model']=_[_0xe782('0x43')](db['DeskField']['rawAttributes']);_0x2a6f3d['query']=_[_0xe782('0x43')](_0x24217e[_0xe782('0x31')]);_0x2a6f3d[_0xe782('0x32')]=_['intersection'](_0x2a6f3d[_0xe782('0x30')],_0x2a6f3d[_0xe782('0x31')]);_0x333d96[_0xe782('0x33')]=_[_0xe782('0x34')](_0x2a6f3d[_0xe782('0x30')],qs[_0xe782('0x35')](_0x24217e['query'][_0xe782('0x35')]));_0x333d96[_0xe782('0x33')]=_0x333d96[_0xe782('0x33')][_0xe782('0x36')]?_0x333d96[_0xe782('0x33')]:_0x2a6f3d[_0xe782('0x30')];_0x333d96[_0xe782('0x39')]=qs[_0xe782('0x3a')](_0x24217e[_0xe782('0x31')][_0xe782('0x3a')]);_0x333d96[_0xe782('0x3b')]=qs['filters'](_[_0xe782('0x3c')](_0x24217e[_0xe782('0x31')],_0x2a6f3d[_0xe782('0x32')]));if(_0x24217e[_0xe782('0x31')][_0xe782('0x4a')]){_0x333d96[_0xe782('0x3b')]=_[_0xe782('0x3d')](_0x333d96['where'],{'$or':_[_0xe782('0x2a')](_0x333d96[_0xe782('0x33')],function(_0xdad83c){var _0x5147e8={};_0x5147e8[_0xdad83c]={'$like':'%'+_0x24217e['query'][_0xe782('0x4a')]+'%'};return _0x5147e8;})});}_0x333d96=_[_0xe782('0x3d')]({},_0x333d96,_0x24217e[_0xe782('0x44')]);return _0x341d2b['getDescriptions'](_0x333d96);}})[_0xe782('0x26')](function(_0x3cd1ef){if(_0x3cd1ef){_0x558215=_0x3cd1ef[_0xe782('0x36')];if(!_0x24217e['query']['hasOwnProperty'](_0xe782('0x38'))){_0x333d96[_0xe782('0x1e')]=qs[_0xe782('0x1e')](_0x24217e[_0xe782('0x31')][_0xe782('0x1e')]);_0x333d96[_0xe782('0x20')]=qs[_0xe782('0x20')](_0x24217e[_0xe782('0x31')][_0xe782('0x20')]);}return _0x341d2b[_0xe782('0x4d')](_0x333d96);}})[_0xe782('0x26')](function(_0x310d9a){if(_0x310d9a){return _0x310d9a?{'count':_0x558215,'rows':_0x310d9a}:null;}})[_0xe782('0x26')](respondWithResult(_0x4f243d,null))[_0xe782('0x46')](handleError(_0x4f243d,null));};exports[_0xe782('0x4e')]=function(_0x228d62,_0x716fdb,_0x4044b1){var _0xd1e6e8={};var _0x30ecdc={};var _0x37dcc5;var _0x2dd472;return db['DeskConfiguration']['findOne']({'where':{'id':_0x228d62['params']['id']}})[_0xe782('0x26')](handleEntityNotFound(_0x716fdb,null))[_0xe782('0x26')](function(_0x518de6){if(_0x518de6){_0x37dcc5=_0x518de6;_0x30ecdc[_0xe782('0x30')]=_[_0xe782('0x43')](db[_0xe782('0x4f')][_0xe782('0x2c')]);_0x30ecdc['query']=_[_0xe782('0x43')](_0x228d62['query']);_0x30ecdc[_0xe782('0x32')]=_[_0xe782('0x34')](_0x30ecdc['model'],_0x30ecdc['query']);_0xd1e6e8[_0xe782('0x33')]=_[_0xe782('0x34')](_0x30ecdc[_0xe782('0x30')],qs[_0xe782('0x35')](_0x228d62['query'][_0xe782('0x35')]));_0xd1e6e8[_0xe782('0x33')]=_0xd1e6e8['attributes'][_0xe782('0x36')]?_0xd1e6e8['attributes']:_0x30ecdc[_0xe782('0x30')];_0xd1e6e8[_0xe782('0x39')]=qs[_0xe782('0x3a')](_0x228d62[_0xe782('0x31')][_0xe782('0x3a')]);_0xd1e6e8[_0xe782('0x3b')]=qs['filters'](_['pick'](_0x228d62[_0xe782('0x31')],_0x30ecdc[_0xe782('0x32')]));if(_0x228d62[_0xe782('0x31')][_0xe782('0x4a')]){_0xd1e6e8[_0xe782('0x3b')]=_[_0xe782('0x3d')](_0xd1e6e8[_0xe782('0x3b')],{'$or':_['map'](_0xd1e6e8[_0xe782('0x33')],function(_0x5c6617){var _0x9362be={};_0x9362be[_0x5c6617]={'$like':'%'+_0x228d62['query']['filter']+'%'};return _0x9362be;})});}_0xd1e6e8=_[_0xe782('0x3d')]({},_0xd1e6e8,_0x228d62[_0xe782('0x44')]);return _0x37dcc5[_0xe782('0x4e')](_0xd1e6e8);}})[_0xe782('0x26')](function(_0x4512ea){if(_0x4512ea){_0x2dd472=_0x4512ea[_0xe782('0x36')];if(!_0x228d62[_0xe782('0x31')][_0xe782('0x37')](_0xe782('0x38'))){_0xd1e6e8[_0xe782('0x1e')]=qs[_0xe782('0x1e')](_0x228d62[_0xe782('0x31')]['limit']);_0xd1e6e8[_0xe782('0x20')]=qs['offset'](_0x228d62[_0xe782('0x31')][_0xe782('0x20')]);}return _0x37dcc5[_0xe782('0x4e')](_0xd1e6e8);}})['then'](function(_0x42afc4){if(_0x42afc4){return _0x42afc4?{'count':_0x2dd472,'rows':_0x42afc4}:null;}})[_0xe782('0x26')](respondWithResult(_0x716fdb,null))[_0xe782('0x46')](handleError(_0x716fdb,null));};exports[_0xe782('0x50')]=function(_0x3069cf,_0x1eb831,_0x5113d6){if(_0x3069cf[_0xe782('0x45')]['id']){delete _0x3069cf['body']['id'];}return db[_0xe782('0x2b')][_0xe782('0x49')]({'where':{'id':_0x3069cf[_0xe782('0x42')]['id']}})['then'](handleEntityNotFound(_0x1eb831,null))[_0xe782('0x26')](function(_0x39c391){if(_0x39c391){return _0x39c391[_0xe782('0x50')](_0x3069cf[_0xe782('0x45')]['ids']||[]);}return null;})[_0xe782('0x26')](respondWithResult(_0x1eb831,null))[_0xe782('0x46')](handleError(_0x1eb831,null));}; \ No newline at end of file +var _0xa8c3=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','apply','reject','save','update','then','end','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','find','create','body','destroy','getFields','findOne','DeskField','getSubjects','keys','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa8c3,0x1a0));var _0x3a8c=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xa8c3[_0x37b3e5];return _0x207f20;};'use strict';var emlformat=require(_0x3a8c('0x0'));var rimraf=require(_0x3a8c('0x1'));var zipdir=require(_0x3a8c('0x2'));var jsonpatch=require(_0x3a8c('0x3'));var rp=require(_0x3a8c('0x4'));var moment=require(_0x3a8c('0x5'));var BPromise=require(_0x3a8c('0x6'));var Mustache=require(_0x3a8c('0x7'));var util=require(_0x3a8c('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3a8c('0x9'));var fs=require('fs');var fs_extra=require(_0x3a8c('0xa'));var _=require(_0x3a8c('0xb'));var squel=require('squel');var crypto=require(_0x3a8c('0xc'));var jsforce=require(_0x3a8c('0xd'));var deskjs=require(_0x3a8c('0xe'));var toCsv=require(_0x3a8c('0xf'));var querystring=require(_0x3a8c('0x10'));var Papa=require(_0x3a8c('0x11'));var Redis=require(_0x3a8c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a8c('0x13'));var hardwareService=require(_0x3a8c('0x14'));var logger=require(_0x3a8c('0x15'))(_0x3a8c('0x16'));var utils=require('../../config/utils');var config=require(_0x3a8c('0x17'));var licenseUtil=require(_0x3a8c('0x18'));var db=require(_0x3a8c('0x19'))['db'];function respondWithStatusCode(_0x5e9d8a,_0x1d9c41){_0x1d9c41=_0x1d9c41||0xcc;return function(_0x16e6dc){if(_0x16e6dc){return _0x5e9d8a[_0x3a8c('0x1a')](_0x1d9c41);}return _0x5e9d8a[_0x3a8c('0x1b')](_0x1d9c41)['end']();};}function respondWithResult(_0x14ac4e,_0x274622){_0x274622=_0x274622||0xc8;return function(_0x21727a){if(_0x21727a){return _0x14ac4e['status'](_0x274622)[_0x3a8c('0x1c')](_0x21727a);}};}function respondWithFilteredResult(_0x5ab42c,_0x8f4fb6){return function(_0x504470){if(_0x504470){var _0x1aa4dd=typeof _0x8f4fb6['offset']===_0x3a8c('0x1d')&&typeof _0x8f4fb6[_0x3a8c('0x1e')]===_0x3a8c('0x1d');var _0x552394=_0x504470[_0x3a8c('0x1f')];var _0x5bab8a=_0x1aa4dd?0x0:_0x8f4fb6['offset'];var _0x21bdae=_0x1aa4dd?_0x504470[_0x3a8c('0x1f')]:_0x8f4fb6['offset']+_0x8f4fb6[_0x3a8c('0x1e')];var _0x549900;if(_0x21bdae>=_0x552394){_0x21bdae=_0x552394;_0x549900=0xc8;}else{_0x549900=0xce;}_0x5ab42c[_0x3a8c('0x1b')](_0x549900);return _0x5ab42c['set']('Content-Range',_0x5bab8a+'-'+_0x21bdae+'/'+_0x552394)['json'](_0x504470);}return null;};}function patchUpdates(_0x871355){return function(_0x304b0d){try{jsonpatch[_0x3a8c('0x20')](_0x304b0d,_0x871355,!![]);}catch(_0x279597){return BPromise[_0x3a8c('0x21')](_0x279597);}return _0x304b0d[_0x3a8c('0x22')]();};}function saveUpdates(_0x54cde1,_0x3ffe36){return function(_0x2e6c8d){if(_0x2e6c8d){return _0x2e6c8d[_0x3a8c('0x23')](_0x54cde1)[_0x3a8c('0x24')](function(_0x181ddb){return _0x181ddb;});}return null;};}function removeEntity(_0x26584e,_0x2a6779){return function(_0x3a585a){if(_0x3a585a){return _0x3a585a['destroy']()[_0x3a8c('0x24')](function(){_0x26584e['status'](0xcc)[_0x3a8c('0x25')]();});}};}function handleEntityNotFound(_0x3f5429,_0x254dc3){return function(_0x444365){if(!_0x444365){_0x3f5429[_0x3a8c('0x1a')](0x194);}return _0x444365;};}function handleError(_0x31dff7,_0x22bd07){_0x22bd07=_0x22bd07||0x1f4;return function(_0x344596){logger[_0x3a8c('0x26')](_0x344596[_0x3a8c('0x27')]);if(_0x344596[_0x3a8c('0x28')]){delete _0x344596['name'];}_0x31dff7[_0x3a8c('0x1b')](_0x22bd07)[_0x3a8c('0x29')](_0x344596);};}exports[_0x3a8c('0x2a')]=function(_0xa85e63,_0x1d33db){var _0x417964={},_0x42c7b5={},_0x4c5374={'count':0x0,'rows':[]};var _0x460127=_['map'](db[_0x3a8c('0x2b')][_0x3a8c('0x2c')],function(_0x4b2875){return{'name':_0x4b2875[_0x3a8c('0x2d')],'type':_0x4b2875[_0x3a8c('0x2e')][_0x3a8c('0x2f')]};});_0x42c7b5[_0x3a8c('0x30')]=_[_0x3a8c('0x31')](_0x460127,_0x3a8c('0x28'));_0x42c7b5[_0x3a8c('0x32')]=_['keys'](_0xa85e63[_0x3a8c('0x32')]);_0x42c7b5[_0x3a8c('0x33')]=_[_0x3a8c('0x34')](_0x42c7b5[_0x3a8c('0x30')],_0x42c7b5[_0x3a8c('0x32')]);_0x417964['attributes']=_[_0x3a8c('0x34')](_0x42c7b5['model'],qs[_0x3a8c('0x35')](_0xa85e63['query'][_0x3a8c('0x35')]));_0x417964[_0x3a8c('0x36')]=_0x417964[_0x3a8c('0x36')][_0x3a8c('0x37')]?_0x417964['attributes']:_0x42c7b5[_0x3a8c('0x30')];if(!_0xa85e63[_0x3a8c('0x32')][_0x3a8c('0x38')](_0x3a8c('0x39'))){_0x417964['limit']=qs[_0x3a8c('0x1e')](_0xa85e63[_0x3a8c('0x32')][_0x3a8c('0x1e')]);_0x417964[_0x3a8c('0x3a')]=qs[_0x3a8c('0x3a')](_0xa85e63[_0x3a8c('0x32')][_0x3a8c('0x3a')]);}_0x417964[_0x3a8c('0x3b')]=qs[_0x3a8c('0x3c')](_0xa85e63[_0x3a8c('0x32')][_0x3a8c('0x3c')]);_0x417964[_0x3a8c('0x3d')]=qs[_0x3a8c('0x33')](_[_0x3a8c('0x3e')](_0xa85e63[_0x3a8c('0x32')],_0x42c7b5[_0x3a8c('0x33')]),_0x460127);if(_0xa85e63['query'][_0x3a8c('0x3f')]){_0x417964['where']=_[_0x3a8c('0x40')](_0x417964[_0x3a8c('0x3d')],{'$or':_['map'](_0x460127,function(_0x3c3bb0){if(_0x3c3bb0[_0x3a8c('0x2e')]!==_0x3a8c('0x41')){var _0x4c913b={};_0x4c913b[_0x3c3bb0['name']]={'$like':'%'+_0xa85e63[_0x3a8c('0x32')][_0x3a8c('0x3f')]+'%'};return _0x4c913b;}})});}_0x417964=_[_0x3a8c('0x40')]({},_0x417964,_0xa85e63['options']);var _0x160b7f={'where':_0x417964['where']};return db[_0x3a8c('0x2b')][_0x3a8c('0x1f')](_0x160b7f)['then'](function(_0x45a6d8){_0x4c5374[_0x3a8c('0x1f')]=_0x45a6d8;if(_0xa85e63[_0x3a8c('0x32')][_0x3a8c('0x42')]){_0x417964['include']=[{'all':!![]}];}return db[_0x3a8c('0x2b')][_0x3a8c('0x43')](_0x417964);})[_0x3a8c('0x24')](function(_0x30c090){_0x4c5374[_0x3a8c('0x44')]=_0x30c090;return _0x4c5374;})['then'](respondWithFilteredResult(_0x1d33db,_0x417964))[_0x3a8c('0x45')](handleError(_0x1d33db,null));};exports[_0x3a8c('0x46')]=function(_0x272131,_0x4c505f){var _0x5316e5={'raw':![],'where':{'id':_0x272131[_0x3a8c('0x47')]['id']}},_0x23e90f={};_0x23e90f[_0x3a8c('0x30')]=_['keys'](db[_0x3a8c('0x2b')][_0x3a8c('0x2c')]);_0x23e90f[_0x3a8c('0x32')]=_['keys'](_0x272131[_0x3a8c('0x32')]);_0x23e90f[_0x3a8c('0x33')]=_['intersection'](_0x23e90f[_0x3a8c('0x30')],_0x23e90f[_0x3a8c('0x32')]);_0x5316e5['attributes']=_['intersection'](_0x23e90f[_0x3a8c('0x30')],qs[_0x3a8c('0x35')](_0x272131['query'][_0x3a8c('0x35')]));_0x5316e5[_0x3a8c('0x36')]=_0x5316e5[_0x3a8c('0x36')][_0x3a8c('0x37')]?_0x5316e5[_0x3a8c('0x36')]:_0x23e90f[_0x3a8c('0x30')];if(_0x272131[_0x3a8c('0x32')][_0x3a8c('0x42')]){_0x5316e5['include']=[{'all':!![]}];}_0x5316e5=_['merge']({},_0x5316e5,_0x272131[_0x3a8c('0x48')]);return db[_0x3a8c('0x2b')][_0x3a8c('0x49')](_0x5316e5)[_0x3a8c('0x24')](handleEntityNotFound(_0x4c505f,null))['then'](respondWithResult(_0x4c505f,null))[_0x3a8c('0x45')](handleError(_0x4c505f,null));};exports[_0x3a8c('0x4a')]=function(_0x2cea80,_0x4b73f8){return db[_0x3a8c('0x2b')][_0x3a8c('0x4a')](_0x2cea80[_0x3a8c('0x4b')],{})[_0x3a8c('0x24')](respondWithResult(_0x4b73f8,0xc9))['catch'](handleError(_0x4b73f8,null));};exports[_0x3a8c('0x23')]=function(_0x55b5cd,_0x53d9b4){if(_0x55b5cd[_0x3a8c('0x4b')]['id']){delete _0x55b5cd[_0x3a8c('0x4b')]['id'];}return db[_0x3a8c('0x2b')]['find']({'where':{'id':_0x55b5cd['params']['id']}})[_0x3a8c('0x24')](handleEntityNotFound(_0x53d9b4,null))[_0x3a8c('0x24')](saveUpdates(_0x55b5cd[_0x3a8c('0x4b')],null))[_0x3a8c('0x24')](respondWithResult(_0x53d9b4,null))['catch'](handleError(_0x53d9b4,null));};exports[_0x3a8c('0x4c')]=function(_0x2533f8,_0x248c37){return db[_0x3a8c('0x2b')][_0x3a8c('0x49')]({'where':{'id':_0x2533f8[_0x3a8c('0x47')]['id']}})[_0x3a8c('0x24')](handleEntityNotFound(_0x248c37,null))[_0x3a8c('0x24')](removeEntity(_0x248c37,null))[_0x3a8c('0x45')](handleError(_0x248c37,null));};exports[_0x3a8c('0x4d')]=function(_0xab24e2,_0x359eb3,_0xfdda1a){var _0x2a906e={};var _0x1bdb29={};var _0x26bf1b;var _0x42b163;return db['DeskConfiguration'][_0x3a8c('0x4e')]({'where':{'id':_0xab24e2[_0x3a8c('0x47')]['id']}})[_0x3a8c('0x24')](handleEntityNotFound(_0x359eb3,null))[_0x3a8c('0x24')](function(_0x1c873b){if(_0x1c873b){_0x26bf1b=_0x1c873b;_0x1bdb29[_0x3a8c('0x30')]=_['keys'](db[_0x3a8c('0x4f')]['rawAttributes']);_0x1bdb29[_0x3a8c('0x32')]=_['keys'](_0xab24e2[_0x3a8c('0x32')]);_0x1bdb29[_0x3a8c('0x33')]=_['intersection'](_0x1bdb29['model'],_0x1bdb29[_0x3a8c('0x32')]);_0x2a906e[_0x3a8c('0x36')]=_[_0x3a8c('0x34')](_0x1bdb29[_0x3a8c('0x30')],qs['fields'](_0xab24e2['query'][_0x3a8c('0x35')]));_0x2a906e[_0x3a8c('0x36')]=_0x2a906e[_0x3a8c('0x36')][_0x3a8c('0x37')]?_0x2a906e[_0x3a8c('0x36')]:_0x1bdb29[_0x3a8c('0x30')];_0x2a906e[_0x3a8c('0x3b')]=qs['sort'](_0xab24e2[_0x3a8c('0x32')]['sort']);_0x2a906e['where']=qs[_0x3a8c('0x33')](_[_0x3a8c('0x3e')](_0xab24e2[_0x3a8c('0x32')],_0x1bdb29[_0x3a8c('0x33')]));if(_0xab24e2[_0x3a8c('0x32')][_0x3a8c('0x3f')]){_0x2a906e[_0x3a8c('0x3d')]=_[_0x3a8c('0x40')](_0x2a906e[_0x3a8c('0x3d')],{'$or':_['map'](_0x2a906e[_0x3a8c('0x36')],function(_0xe8ee2c){var _0x4663b8={};_0x4663b8[_0xe8ee2c]={'$like':'%'+_0xab24e2[_0x3a8c('0x32')][_0x3a8c('0x3f')]+'%'};return _0x4663b8;})});}_0x2a906e=_[_0x3a8c('0x40')]({},_0x2a906e,_0xab24e2[_0x3a8c('0x48')]);return _0x26bf1b[_0x3a8c('0x4d')](_0x2a906e);}})[_0x3a8c('0x24')](function(_0x53f641){if(_0x53f641){_0x42b163=_0x53f641[_0x3a8c('0x37')];if(!_0xab24e2[_0x3a8c('0x32')][_0x3a8c('0x38')](_0x3a8c('0x39'))){_0x2a906e[_0x3a8c('0x1e')]=qs[_0x3a8c('0x1e')](_0xab24e2[_0x3a8c('0x32')][_0x3a8c('0x1e')]);_0x2a906e[_0x3a8c('0x3a')]=qs[_0x3a8c('0x3a')](_0xab24e2[_0x3a8c('0x32')][_0x3a8c('0x3a')]);}return _0x26bf1b[_0x3a8c('0x4d')](_0x2a906e);}})[_0x3a8c('0x24')](function(_0x325f0a){if(_0x325f0a){return _0x325f0a?{'count':_0x42b163,'rows':_0x325f0a}:null;}})[_0x3a8c('0x24')](respondWithResult(_0x359eb3,null))[_0x3a8c('0x45')](handleError(_0x359eb3,null));};exports[_0x3a8c('0x50')]=function(_0x1f927e,_0x4ed093,_0x2909ce){var _0x2ba79d={};var _0x34d79c={};var _0x508722;var _0x1cb6d2;return db['DeskConfiguration'][_0x3a8c('0x4e')]({'where':{'id':_0x1f927e['params']['id']}})['then'](handleEntityNotFound(_0x4ed093,null))['then'](function(_0x44824f){if(_0x44824f){_0x508722=_0x44824f;_0x34d79c['model']=_['keys'](db[_0x3a8c('0x4f')][_0x3a8c('0x2c')]);_0x34d79c[_0x3a8c('0x32')]=_[_0x3a8c('0x51')](_0x1f927e[_0x3a8c('0x32')]);_0x34d79c['filters']=_[_0x3a8c('0x34')](_0x34d79c[_0x3a8c('0x30')],_0x34d79c['query']);_0x2ba79d[_0x3a8c('0x36')]=_[_0x3a8c('0x34')](_0x34d79c[_0x3a8c('0x30')],qs[_0x3a8c('0x35')](_0x1f927e[_0x3a8c('0x32')][_0x3a8c('0x35')]));_0x2ba79d['attributes']=_0x2ba79d[_0x3a8c('0x36')]['length']?_0x2ba79d['attributes']:_0x34d79c[_0x3a8c('0x30')];_0x2ba79d[_0x3a8c('0x3b')]=qs[_0x3a8c('0x3c')](_0x1f927e[_0x3a8c('0x32')]['sort']);_0x2ba79d['where']=qs['filters'](_[_0x3a8c('0x3e')](_0x1f927e[_0x3a8c('0x32')],_0x34d79c['filters']));if(_0x1f927e['query'][_0x3a8c('0x3f')]){_0x2ba79d['where']=_[_0x3a8c('0x40')](_0x2ba79d[_0x3a8c('0x3d')],{'$or':_[_0x3a8c('0x31')](_0x2ba79d['attributes'],function(_0x23bbfd){var _0x8d41ad={};_0x8d41ad[_0x23bbfd]={'$like':'%'+_0x1f927e[_0x3a8c('0x32')][_0x3a8c('0x3f')]+'%'};return _0x8d41ad;})});}_0x2ba79d=_[_0x3a8c('0x40')]({},_0x2ba79d,_0x1f927e[_0x3a8c('0x48')]);return _0x508722['getSubjects'](_0x2ba79d);}})[_0x3a8c('0x24')](function(_0x1ecd11){if(_0x1ecd11){_0x1cb6d2=_0x1ecd11[_0x3a8c('0x37')];if(!_0x1f927e[_0x3a8c('0x32')]['hasOwnProperty'](_0x3a8c('0x39'))){_0x2ba79d[_0x3a8c('0x1e')]=qs[_0x3a8c('0x1e')](_0x1f927e['query'][_0x3a8c('0x1e')]);_0x2ba79d[_0x3a8c('0x3a')]=qs[_0x3a8c('0x3a')](_0x1f927e[_0x3a8c('0x32')][_0x3a8c('0x3a')]);}return _0x508722['getSubjects'](_0x2ba79d);}})['then'](function(_0x3bb6e2){if(_0x3bb6e2){return _0x3bb6e2?{'count':_0x1cb6d2,'rows':_0x3bb6e2}:null;}})[_0x3a8c('0x24')](respondWithResult(_0x4ed093,null))[_0x3a8c('0x45')](handleError(_0x4ed093,null));};exports[_0x3a8c('0x52')]=function(_0x1ae7a0,_0x4b5e53,_0xd5d47){var _0x487387={};var _0x4f8194={};var _0x3aaff2;var _0x101b18;return db[_0x3a8c('0x2b')][_0x3a8c('0x4e')]({'where':{'id':_0x1ae7a0[_0x3a8c('0x47')]['id']}})[_0x3a8c('0x24')](handleEntityNotFound(_0x4b5e53,null))[_0x3a8c('0x24')](function(_0xc83608){if(_0xc83608){_0x3aaff2=_0xc83608;_0x4f8194[_0x3a8c('0x30')]=_[_0x3a8c('0x51')](db[_0x3a8c('0x4f')][_0x3a8c('0x2c')]);_0x4f8194[_0x3a8c('0x32')]=_[_0x3a8c('0x51')](_0x1ae7a0[_0x3a8c('0x32')]);_0x4f8194['filters']=_['intersection'](_0x4f8194['model'],_0x4f8194[_0x3a8c('0x32')]);_0x487387[_0x3a8c('0x36')]=_[_0x3a8c('0x34')](_0x4f8194[_0x3a8c('0x30')],qs['fields'](_0x1ae7a0[_0x3a8c('0x32')][_0x3a8c('0x35')]));_0x487387[_0x3a8c('0x36')]=_0x487387[_0x3a8c('0x36')]['length']?_0x487387['attributes']:_0x4f8194[_0x3a8c('0x30')];_0x487387[_0x3a8c('0x3b')]=qs[_0x3a8c('0x3c')](_0x1ae7a0[_0x3a8c('0x32')][_0x3a8c('0x3c')]);_0x487387[_0x3a8c('0x3d')]=qs['filters'](_[_0x3a8c('0x3e')](_0x1ae7a0[_0x3a8c('0x32')],_0x4f8194['filters']));if(_0x1ae7a0['query'][_0x3a8c('0x3f')]){_0x487387['where']=_[_0x3a8c('0x40')](_0x487387['where'],{'$or':_[_0x3a8c('0x31')](_0x487387[_0x3a8c('0x36')],function(_0x6d1439){var _0x566263={};_0x566263[_0x6d1439]={'$like':'%'+_0x1ae7a0[_0x3a8c('0x32')][_0x3a8c('0x3f')]+'%'};return _0x566263;})});}_0x487387=_[_0x3a8c('0x40')]({},_0x487387,_0x1ae7a0[_0x3a8c('0x48')]);return _0x3aaff2[_0x3a8c('0x52')](_0x487387);}})[_0x3a8c('0x24')](function(_0x1ce1ce){if(_0x1ce1ce){_0x101b18=_0x1ce1ce[_0x3a8c('0x37')];if(!_0x1ae7a0['query'][_0x3a8c('0x38')](_0x3a8c('0x39'))){_0x487387[_0x3a8c('0x1e')]=qs[_0x3a8c('0x1e')](_0x1ae7a0[_0x3a8c('0x32')]['limit']);_0x487387['offset']=qs['offset'](_0x1ae7a0[_0x3a8c('0x32')][_0x3a8c('0x3a')]);}return _0x3aaff2[_0x3a8c('0x52')](_0x487387);}})[_0x3a8c('0x24')](function(_0x14b3d0){if(_0x14b3d0){return _0x14b3d0?{'count':_0x101b18,'rows':_0x14b3d0}:null;}})[_0x3a8c('0x24')](respondWithResult(_0x4b5e53,null))[_0x3a8c('0x45')](handleError(_0x4b5e53,null));};exports[_0x3a8c('0x53')]=function(_0x5e1d8b,_0x3b32cb,_0x13fde5){var _0x25dd98={};var _0x50d5b7={};var _0x1796ff;var _0x4759b4;return db[_0x3a8c('0x2b')][_0x3a8c('0x4e')]({'where':{'id':_0x5e1d8b[_0x3a8c('0x47')]['id']}})[_0x3a8c('0x24')](handleEntityNotFound(_0x3b32cb,null))[_0x3a8c('0x24')](function(_0x4410de){if(_0x4410de){_0x1796ff=_0x4410de;_0x50d5b7[_0x3a8c('0x30')]=_[_0x3a8c('0x51')](db['Tag'][_0x3a8c('0x2c')]);_0x50d5b7[_0x3a8c('0x32')]=_[_0x3a8c('0x51')](_0x5e1d8b[_0x3a8c('0x32')]);_0x50d5b7[_0x3a8c('0x33')]=_['intersection'](_0x50d5b7[_0x3a8c('0x30')],_0x50d5b7['query']);_0x25dd98[_0x3a8c('0x36')]=_[_0x3a8c('0x34')](_0x50d5b7[_0x3a8c('0x30')],qs[_0x3a8c('0x35')](_0x5e1d8b[_0x3a8c('0x32')][_0x3a8c('0x35')]));_0x25dd98[_0x3a8c('0x36')]=_0x25dd98[_0x3a8c('0x36')][_0x3a8c('0x37')]?_0x25dd98[_0x3a8c('0x36')]:_0x50d5b7[_0x3a8c('0x30')];_0x25dd98['order']=qs[_0x3a8c('0x3c')](_0x5e1d8b[_0x3a8c('0x32')][_0x3a8c('0x3c')]);_0x25dd98[_0x3a8c('0x3d')]=qs[_0x3a8c('0x33')](_['pick'](_0x5e1d8b[_0x3a8c('0x32')],_0x50d5b7[_0x3a8c('0x33')]));if(_0x5e1d8b[_0x3a8c('0x32')][_0x3a8c('0x3f')]){_0x25dd98[_0x3a8c('0x3d')]=_['merge'](_0x25dd98[_0x3a8c('0x3d')],{'$or':_[_0x3a8c('0x31')](_0x25dd98[_0x3a8c('0x36')],function(_0x22a7b5){var _0x1c41f3={};_0x1c41f3[_0x22a7b5]={'$like':'%'+_0x5e1d8b[_0x3a8c('0x32')][_0x3a8c('0x3f')]+'%'};return _0x1c41f3;})});}_0x25dd98=_[_0x3a8c('0x40')]({},_0x25dd98,_0x5e1d8b[_0x3a8c('0x48')]);return _0x1796ff[_0x3a8c('0x53')](_0x25dd98);}})[_0x3a8c('0x24')](function(_0x6b4ade){if(_0x6b4ade){_0x4759b4=_0x6b4ade[_0x3a8c('0x37')];if(!_0x5e1d8b['query'][_0x3a8c('0x38')](_0x3a8c('0x39'))){_0x25dd98[_0x3a8c('0x1e')]=qs['limit'](_0x5e1d8b[_0x3a8c('0x32')][_0x3a8c('0x1e')]);_0x25dd98[_0x3a8c('0x3a')]=qs[_0x3a8c('0x3a')](_0x5e1d8b[_0x3a8c('0x32')][_0x3a8c('0x3a')]);}return _0x1796ff[_0x3a8c('0x53')](_0x25dd98);}})[_0x3a8c('0x24')](function(_0x5b3abb){if(_0x5b3abb){return _0x5b3abb?{'count':_0x4759b4,'rows':_0x5b3abb}:null;}})[_0x3a8c('0x24')](respondWithResult(_0x3b32cb,null))['catch'](handleError(_0x3b32cb,null));};exports[_0x3a8c('0x54')]=function(_0x4a9b2c,_0x5ceb88,_0x17a0ab){if(_0x4a9b2c[_0x3a8c('0x4b')]['id']){delete _0x4a9b2c[_0x3a8c('0x4b')]['id'];}return db[_0x3a8c('0x2b')]['findOne']({'where':{'id':_0x4a9b2c['params']['id']}})[_0x3a8c('0x24')](handleEntityNotFound(_0x5ceb88,null))[_0x3a8c('0x24')](function(_0x227b4e){if(_0x227b4e){return _0x227b4e[_0x3a8c('0x54')](_0x4a9b2c['body'][_0x3a8c('0x55')]||[]);}return null;})[_0x3a8c('0x24')](respondWithResult(_0x5ceb88,null))[_0x3a8c('0x45')](handleError(_0x5ceb88,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3f8441a..ce2114e 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 _0x2560=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','DeskConfiguration','lodash'];(function(_0x244343,_0x24711a){var _0x1e2766=function(_0x534e95){while(--_0x534e95){_0x244343['push'](_0x244343['shift']());}};_0x1e2766(++_0x24711a);}(_0x2560,0x103));var _0x0256=function(_0x224918,_0x1cebe8){_0x224918=_0x224918-0x0;var _0xd92227=_0x2560[_0x224918];return _0xd92227;};'use strict';var _=require(_0x0256('0x0'));var util=require('util');var logger=require(_0x0256('0x1'))('api');var moment=require(_0x0256('0x2'));var BPromise=require(_0x0256('0x3'));var rp=require(_0x0256('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0256('0x5'));var config=require(_0x0256('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x0256('0x7')]=function(_0x1430de,_0x3b0348){return _0x1430de[_0x0256('0x8')](_0x0256('0x9'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87fa=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x413701,_0x505387){var _0x9fee1=function(_0x112e16){while(--_0x112e16){_0x413701['push'](_0x413701['shift']());}};_0x9fee1(++_0x505387);}(_0x87fa,0x108));var _0xa87f=function(_0x27b8c3,_0x44c90e){_0x27b8c3=_0x27b8c3-0x0;var _0x1a7c20=_0x87fa[_0x27b8c3];return _0x1a7c20;};'use strict';var _=require(_0xa87f('0x0'));var util=require(_0xa87f('0x1'));var logger=require(_0xa87f('0x2'))(_0xa87f('0x3'));var moment=require(_0xa87f('0x4'));var BPromise=require(_0xa87f('0x5'));var rp=require(_0xa87f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa87f('0x7'));var config=require(_0xa87f('0x8'));var attributes=require(_0xa87f('0x9'));module[_0xa87f('0xa')]=function(_0x3dff52,_0x599a94){return _0x3dff52[_0xa87f('0xb')](_0xa87f('0xc'),attributes,{'tableName':_0xa87f('0xd'),'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 37d72f7..78182db 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 _0x3c6a=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x74a021,_0x239528){var _0x3fed5d=function(_0x2e2ad2){while(--_0x2e2ad2){_0x74a021['push'](_0x74a021['shift']());}};_0x3fed5d(++_0x239528);}(_0x3c6a,0xd1));var _0xa3c6=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0x3c6a[_0x4bdf64];return _0x9a1a19;};'use strict';var _=require('lodash');var util=require(_0xa3c6('0x0'));var moment=require(_0xa3c6('0x1'));var BPromise=require(_0xa3c6('0x2'));var rs=require(_0xa3c6('0x3'));var fs=require('fs');var Redis=require(_0xa3c6('0x4'));var db=require(_0xa3c6('0x5'))['db'];var utils=require(_0xa3c6('0x6'));var logger=require(_0xa3c6('0x7'))(_0xa3c6('0x8'));var config=require(_0xa3c6('0x9'));var jayson=require(_0xa3c6('0xa'));var client=jayson['client'][_0xa3c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cae92,_0x1ce825,_0x1b814b){return new BPromise(function(_0x43c5c0,_0xa4d22){return client[_0xa3c6('0xc')](_0x1cae92,_0x1b814b)[_0xa3c6('0xd')](function(_0x24c520){logger[_0xa3c6('0xe')](_0xa3c6('0xf'),_0x1ce825,'request\x20sent');logger[_0xa3c6('0x10')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1ce825,_0xa3c6('0x11'),JSON[_0xa3c6('0x12')](_0x24c520));if(_0x24c520[_0xa3c6('0x13')]){if(_0x24c520['error']['code']===0x1f4){logger['error'](_0xa3c6('0xf'),_0x1ce825,_0x24c520['error'][_0xa3c6('0x14')]);return _0xa4d22(_0x24c520[_0xa3c6('0x13')][_0xa3c6('0x14')]);}logger[_0xa3c6('0x13')](_0xa3c6('0xf'),_0x1ce825,_0x24c520[_0xa3c6('0x13')][_0xa3c6('0x14')]);return _0x43c5c0(_0x24c520['error'][_0xa3c6('0x14')]);}else{logger[_0xa3c6('0xe')](_0xa3c6('0xf'),_0x1ce825,'request\x20sent');_0x43c5c0(_0x24c520[_0xa3c6('0x15')]['message']);}})[_0xa3c6('0x16')](function(_0x4ad5dc){logger[_0xa3c6('0x13')](_0xa3c6('0xf'),_0x1ce825,_0x4ad5dc);_0xa4d22(_0x4ad5dc);});});} \ No newline at end of file +var _0x3024=['rpc','../../config/environment','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x3024,0x64));var _0x4302=function(_0x48629a,_0x1264c7){_0x48629a=_0x48629a-0x0;var _0x528007=_0x3024[_0x48629a];return _0x528007;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var moment=require('moment');var BPromise=require(_0x4302('0x2'));var rs=require(_0x4302('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4302('0x4'));var logger=require('../../config/logger')(_0x4302('0x5'));var config=require(_0x4302('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4302('0x7')][_0x4302('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c3983,_0xced9fc,_0x2aecd7){return new BPromise(function(_0x3c007b,_0x285613){return client[_0x4302('0x9')](_0x4c3983,_0x2aecd7)[_0x4302('0xa')](function(_0x41580c){logger['info'](_0x4302('0xb'),_0xced9fc,_0x4302('0xc'));logger[_0x4302('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0xced9fc,_0x4302('0xc'),JSON[_0x4302('0xe')](_0x41580c));if(_0x41580c['error']){if(_0x41580c[_0x4302('0xf')][_0x4302('0x10')]===0x1f4){logger[_0x4302('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0xced9fc,_0x41580c[_0x4302('0xf')][_0x4302('0x11')]);return _0x285613(_0x41580c['error'][_0x4302('0x11')]);}logger[_0x4302('0xf')](_0x4302('0xb'),_0xced9fc,_0x41580c['error'][_0x4302('0x11')]);return _0x3c007b(_0x41580c[_0x4302('0xf')]['message']);}else{logger[_0x4302('0x12')](_0x4302('0xb'),_0xced9fc,'request\x20sent');_0x3c007b(_0x41580c[_0x4302('0x13')][_0x4302('0x11')]);}})[_0x4302('0x14')](function(_0x32178f){logger[_0x4302('0xf')](_0x4302('0xb'),_0xced9fc,_0x32178f);_0x285613(_0x32178f);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index b38f8b9..eaa8557 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 _0xc188=['Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','show','post','put','/:id','update','destroy','multer','util','path','express'];(function(_0x57c822,_0x8c74de){var _0x5409fb=function(_0x188063){while(--_0x188063){_0x57c822['push'](_0x57c822['shift']());}};_0x5409fb(++_0x8c74de);}(_0xc188,0x14c));var _0x8c18=function(_0x2152a5,_0x507007){_0x2152a5=_0x2152a5-0x0;var _0x266683=_0xc188[_0x2152a5];return _0x266683;};'use strict';var multer=require(_0x8c18('0x0'));var util=require(_0x8c18('0x1'));var path=require(_0x8c18('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c18('0x3'));var router=express[_0x8c18('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8c18('0x5'));var interaction=require(_0x8c18('0x6'));var config=require('../../config/environment');var controller=require(_0x8c18('0x7'));router[_0x8c18('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8c18('0x8')]('/:id',auth[_0x8c18('0x9')](),controller[_0x8c18('0xa')]);router[_0x8c18('0xb')]('/',auth[_0x8c18('0x9')](),controller['create']);router[_0x8c18('0xc')](_0x8c18('0xd'),auth['isAuthenticated'](),controller[_0x8c18('0xe')]);router['delete'](_0x8c18('0xd'),auth['isAuthenticated'](),controller[_0x8c18('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe1d1=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x346b5b,_0x4f839f){var _0x5287df=function(_0x15fca7){while(--_0x15fca7){_0x346b5b['push'](_0x346b5b['shift']());}};_0x5287df(++_0x4f839f);}(_0xe1d1,0x131));var _0x1e1d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe1d1[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x1e1d('0x0'));var util=require(_0x1e1d('0x1'));var path=require('path');var timeout=require(_0x1e1d('0x2'));var express=require(_0x1e1d('0x3'));var router=express[_0x1e1d('0x4')]();var fs_extra=require(_0x1e1d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1e1d('0x6'));var config=require(_0x1e1d('0x7'));var controller=require(_0x1e1d('0x8'));router[_0x1e1d('0x9')]('/',auth[_0x1e1d('0xa')](),controller[_0x1e1d('0xb')]);router['get'](_0x1e1d('0xc'),auth[_0x1e1d('0xa')](),controller[_0x1e1d('0xd')]);router[_0x1e1d('0xe')]('/',auth[_0x1e1d('0xa')](),controller[_0x1e1d('0xf')]);router['put'](_0x1e1d('0xc'),auth[_0x1e1d('0xa')](),controller[_0x1e1d('0x10')]);router[_0x1e1d('0x11')](_0x1e1d('0xc'),auth[_0x1e1d('0xa')](),controller[_0x1e1d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index b690432..92e5b89 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 _0xe209=['customVariable','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xe209,0x103));var _0x9e20=function(_0x4f73be,_0x340f9e){_0x4f73be=_0x4f73be-0x0;var _0x3fb1ed=_0xe209[_0x4f73be];return _0x3fb1ed;};'use strict';var Sequelize=require(_0x9e20('0x0'));module[_0x9e20('0x1')]={'type':{'type':Sequelize[_0x9e20('0x2')](_0x9e20('0x3'),_0x9e20('0x4'),_0x9e20('0x5'),'keyValue',_0x9e20('0x6')),'defaultValue':_0x9e20('0x3')},'content':{'type':Sequelize[_0x9e20('0x7')]},'key':{'type':Sequelize[_0x9e20('0x7')]},'keyType':{'type':Sequelize[_0x9e20('0x2')](_0x9e20('0x3'),'variable',_0x9e20('0x5'))},'keyContent':{'type':Sequelize[_0x9e20('0x7')]},'idField':{'type':Sequelize[_0x9e20('0x7')]},'nameField':{'type':Sequelize[_0x9e20('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e20('0x7')]}}; \ No newline at end of file +var _0x04fa=['variable','customVariable','picklist','STRING','sequelize','exports','string'];(function(_0x31f217,_0x4ed5fb){var _0x3bd6ea=function(_0x3166ea){while(--_0x3166ea){_0x31f217['push'](_0x31f217['shift']());}};_0x3bd6ea(++_0x4ed5fb);}(_0x04fa,0x1bd));var _0xa04f=function(_0x5b9037,_0x3a9af1){_0x5b9037=_0x5b9037-0x0;var _0x31056e=_0x04fa[_0x5b9037];return _0x31056e;};'use strict';var Sequelize=require(_0xa04f('0x0'));module[_0xa04f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa04f('0x2'),_0xa04f('0x3'),_0xa04f('0x4'),'keyValue',_0xa04f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa04f('0x6')]},'key':{'type':Sequelize[_0xa04f('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xa04f('0x2'),_0xa04f('0x3'),_0xa04f('0x4'))},'keyContent':{'type':Sequelize[_0xa04f('0x6')]},'idField':{'type':Sequelize[_0xa04f('0x6')]},'nameField':{'type':Sequelize[_0xa04f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa04f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 2cc9212..eca8602 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 _0x22ca=['then','sendStatus','error','stack','send','map','DeskField','fieldName','type','key','model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show','keys','intersection','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy'];(function(_0x3ffadf,_0x47c3b1){var _0x46223d=function(_0x1a3ddd){while(--_0x1a3ddd){_0x3ffadf['push'](_0x3ffadf['shift']());}};_0x46223d(++_0x47c3b1);}(_0x22ca,0x1d9));var _0xa22c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x22ca[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xa22c('0x0'));var rimraf=require(_0xa22c('0x1'));var zipdir=require(_0xa22c('0x2'));var jsonpatch=require(_0xa22c('0x3'));var rp=require(_0xa22c('0x4'));var moment=require(_0xa22c('0x5'));var BPromise=require(_0xa22c('0x6'));var Mustache=require(_0xa22c('0x7'));var util=require(_0xa22c('0x8'));var path=require(_0xa22c('0x9'));var sox=require(_0xa22c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa22c('0xb'));var _=require(_0xa22c('0xc'));var squel=require(_0xa22c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa22c('0xe'));var querystring=require(_0xa22c('0xf'));var Papa=require(_0xa22c('0x10'));var Redis=require(_0xa22c('0x11'));var authService=require(_0xa22c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa22c('0x13'));var hardwareService=require(_0xa22c('0x14'));var logger=require('../../config/logger')(_0xa22c('0x15'));var utils=require(_0xa22c('0x16'));var config=require(_0xa22c('0x17'));var licenseUtil=require(_0xa22c('0x18'));var db=require(_0xa22c('0x19'))['db'];function respondWithStatusCode(_0x3178f1,_0x379b40){_0x379b40=_0x379b40||0xcc;return function(_0x129b90){if(_0x129b90){return _0x3178f1['sendStatus'](_0x379b40);}return _0x3178f1[_0xa22c('0x1a')](_0x379b40)[_0xa22c('0x1b')]();};}function respondWithResult(_0x5c696c,_0x1af368){_0x1af368=_0x1af368||0xc8;return function(_0x405ac9){if(_0x405ac9){return _0x5c696c['status'](_0x1af368)[_0xa22c('0x1c')](_0x405ac9);}};}function respondWithFilteredResult(_0x474e61,_0x46c29b){return function(_0x40c950){if(_0x40c950){var _0x63f306=typeof _0x46c29b[_0xa22c('0x1d')]===_0xa22c('0x1e')&&typeof _0x46c29b[_0xa22c('0x1f')]==='undefined';var _0x46181d=_0x40c950[_0xa22c('0x20')];var _0x2f7538=_0x63f306?0x0:_0x46c29b[_0xa22c('0x1d')];var _0x5cf9ce=_0x63f306?_0x40c950['count']:_0x46c29b['offset']+_0x46c29b[_0xa22c('0x1f')];var _0x33c145;if(_0x5cf9ce>=_0x46181d){_0x5cf9ce=_0x46181d;_0x33c145=0xc8;}else{_0x33c145=0xce;}_0x474e61[_0xa22c('0x1a')](_0x33c145);return _0x474e61[_0xa22c('0x21')](_0xa22c('0x22'),_0x2f7538+'-'+_0x5cf9ce+'/'+_0x46181d)[_0xa22c('0x1c')](_0x40c950);}return null;};}function patchUpdates(_0xfa835d){return function(_0x501dd4){try{jsonpatch['apply'](_0x501dd4,_0xfa835d,!![]);}catch(_0x524833){return BPromise[_0xa22c('0x23')](_0x524833);}return _0x501dd4['save']();};}function saveUpdates(_0x4a301d,_0x2dc23a){return function(_0x1d8393){if(_0x1d8393){return _0x1d8393[_0xa22c('0x24')](_0x4a301d)['then'](function(_0x28c3d9){return _0x28c3d9;});}return null;};}function removeEntity(_0x1d0eb6,_0x3e6b02){return function(_0x498ee8){if(_0x498ee8){return _0x498ee8[_0xa22c('0x25')]()[_0xa22c('0x26')](function(){_0x1d0eb6['status'](0xcc)[_0xa22c('0x1b')]();});}};}function handleEntityNotFound(_0x13f4e1,_0x1d70a4){return function(_0x532534){if(!_0x532534){_0x13f4e1[_0xa22c('0x27')](0x194);}return _0x532534;};}function handleError(_0x2a063c,_0x384347){_0x384347=_0x384347||0x1f4;return function(_0x776491){logger[_0xa22c('0x28')](_0x776491[_0xa22c('0x29')]);if(_0x776491['name']){delete _0x776491['name'];}_0x2a063c[_0xa22c('0x1a')](_0x384347)[_0xa22c('0x2a')](_0x776491);};}exports['index']=function(_0x2c789f,_0x3ee4e4){var _0x1660a8={},_0x391e37={},_0x3737e1={'count':0x0,'rows':[]};var _0x4cf323=_[_0xa22c('0x2b')](db[_0xa22c('0x2c')]['rawAttributes'],function(_0x27c9c8){return{'name':_0x27c9c8[_0xa22c('0x2d')],'type':_0x27c9c8[_0xa22c('0x2e')][_0xa22c('0x2f')]};});_0x391e37[_0xa22c('0x30')]=_[_0xa22c('0x2b')](_0x4cf323,_0xa22c('0x31'));_0x391e37[_0xa22c('0x32')]=_['keys'](_0x2c789f[_0xa22c('0x32')]);_0x391e37[_0xa22c('0x33')]=_['intersection'](_0x391e37['model'],_0x391e37[_0xa22c('0x32')]);_0x1660a8[_0xa22c('0x34')]=_['intersection'](_0x391e37[_0xa22c('0x30')],qs[_0xa22c('0x35')](_0x2c789f[_0xa22c('0x32')]['fields']));_0x1660a8[_0xa22c('0x34')]=_0x1660a8[_0xa22c('0x34')][_0xa22c('0x36')]?_0x1660a8['attributes']:_0x391e37['model'];if(!_0x2c789f[_0xa22c('0x32')][_0xa22c('0x37')](_0xa22c('0x38'))){_0x1660a8['limit']=qs[_0xa22c('0x1f')](_0x2c789f[_0xa22c('0x32')][_0xa22c('0x1f')]);_0x1660a8['offset']=qs[_0xa22c('0x1d')](_0x2c789f['query'][_0xa22c('0x1d')]);}_0x1660a8[_0xa22c('0x39')]=qs['sort'](_0x2c789f[_0xa22c('0x32')]['sort']);_0x1660a8[_0xa22c('0x3a')]=qs[_0xa22c('0x33')](_['pick'](_0x2c789f[_0xa22c('0x32')],_0x391e37[_0xa22c('0x33')]),_0x4cf323);if(_0x2c789f[_0xa22c('0x32')]['filter']){_0x1660a8[_0xa22c('0x3a')]=_[_0xa22c('0x3b')](_0x1660a8['where'],{'$or':_[_0xa22c('0x2b')](_0x4cf323,function(_0x4ff4d9){if(_0x4ff4d9[_0xa22c('0x2e')]!==_0xa22c('0x3c')){var _0x1501c5={};_0x1501c5[_0x4ff4d9[_0xa22c('0x31')]]={'$like':'%'+_0x2c789f[_0xa22c('0x32')][_0xa22c('0x3d')]+'%'};return _0x1501c5;}})});}_0x1660a8=_[_0xa22c('0x3b')]({},_0x1660a8,_0x2c789f[_0xa22c('0x3e')]);var _0x2e02ee={'where':_0x1660a8[_0xa22c('0x3a')]};return db[_0xa22c('0x2c')][_0xa22c('0x20')](_0x2e02ee)[_0xa22c('0x26')](function(_0x589a13){_0x3737e1[_0xa22c('0x20')]=_0x589a13;if(_0x2c789f[_0xa22c('0x32')][_0xa22c('0x3f')]){_0x1660a8[_0xa22c('0x40')]=[{'all':!![]}];}return db[_0xa22c('0x2c')]['findAll'](_0x1660a8);})[_0xa22c('0x26')](function(_0x323dc6){_0x3737e1['rows']=_0x323dc6;return _0x3737e1;})[_0xa22c('0x26')](respondWithFilteredResult(_0x3ee4e4,_0x1660a8))[_0xa22c('0x41')](handleError(_0x3ee4e4,null));};exports[_0xa22c('0x42')]=function(_0x28d8af,_0x34fae5){var _0x5d5804={'raw':!![],'where':{'id':_0x28d8af['params']['id']}},_0x563063={};_0x563063[_0xa22c('0x30')]=_[_0xa22c('0x43')](db['DeskField']['rawAttributes']);_0x563063[_0xa22c('0x32')]=_[_0xa22c('0x43')](_0x28d8af[_0xa22c('0x32')]);_0x563063[_0xa22c('0x33')]=_[_0xa22c('0x44')](_0x563063[_0xa22c('0x30')],_0x563063[_0xa22c('0x32')]);_0x5d5804[_0xa22c('0x34')]=_[_0xa22c('0x44')](_0x563063[_0xa22c('0x30')],qs[_0xa22c('0x35')](_0x28d8af[_0xa22c('0x32')]['fields']));_0x5d5804[_0xa22c('0x34')]=_0x5d5804['attributes']['length']?_0x5d5804['attributes']:_0x563063[_0xa22c('0x30')];if(_0x28d8af[_0xa22c('0x32')]['includeAll']){_0x5d5804['include']=[{'all':!![]}];}_0x5d5804=_['merge']({},_0x5d5804,_0x28d8af[_0xa22c('0x3e')]);return db[_0xa22c('0x2c')]['find'](_0x5d5804)[_0xa22c('0x26')](handleEntityNotFound(_0x34fae5,null))['then'](respondWithResult(_0x34fae5,null))[_0xa22c('0x41')](handleError(_0x34fae5,null));};exports[_0xa22c('0x45')]=function(_0x345728,_0x25c3e2){return db[_0xa22c('0x2c')][_0xa22c('0x45')](_0x345728[_0xa22c('0x46')],{})['then'](respondWithResult(_0x25c3e2,0xc9))[_0xa22c('0x41')](handleError(_0x25c3e2,null));};exports['update']=function(_0x3d063e,_0x438a6e){if(_0x3d063e['body']['id']){delete _0x3d063e[_0xa22c('0x46')]['id'];}return db[_0xa22c('0x2c')][_0xa22c('0x47')]({'where':{'id':_0x3d063e[_0xa22c('0x48')]['id']}})[_0xa22c('0x26')](handleEntityNotFound(_0x438a6e,null))['then'](saveUpdates(_0x3d063e[_0xa22c('0x46')],null))['then'](respondWithResult(_0x438a6e,null))[_0xa22c('0x41')](handleError(_0x438a6e,null));};exports[_0xa22c('0x25')]=function(_0x6c26ad,_0x37a34c){return db['DeskField']['find']({'where':{'id':_0x6c26ad[_0xa22c('0x48')]['id']}})[_0xa22c('0x26')](handleEntityNotFound(_0x37a34c,null))[_0xa22c('0x26')](removeEntity(_0x37a34c,null))['catch'](handleError(_0x37a34c,null));}; \ No newline at end of file +var _0xa87e=['fields','attributes','length','nolimit','sort','where','filter','merge','options','includeAll','include','show','params','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','../../config/license/util','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','type','key','query','keys','filters','intersection','model'];(function(_0x226f0e,_0x389f2b){var _0x12402d=function(_0x4c12d4){while(--_0x4c12d4){_0x226f0e['push'](_0x226f0e['shift']());}};_0x12402d(++_0x389f2b);}(_0xa87e,0x1c2));var _0xea87=function(_0x155527,_0x2c3366){_0x155527=_0x155527-0x0;var _0x45aee8=_0xa87e[_0x155527];return _0x45aee8;};'use strict';var emlformat=require(_0xea87('0x0'));var rimraf=require(_0xea87('0x1'));var zipdir=require(_0xea87('0x2'));var jsonpatch=require(_0xea87('0x3'));var rp=require('request-promise');var moment=require(_0xea87('0x4'));var BPromise=require(_0xea87('0x5'));var Mustache=require(_0xea87('0x6'));var util=require('util');var path=require(_0xea87('0x7'));var sox=require(_0xea87('0x8'));var csv=require(_0xea87('0x9'));var ejs=require(_0xea87('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea87('0xb'));var squel=require(_0xea87('0xc'));var crypto=require(_0xea87('0xd'));var jsforce=require(_0xea87('0xe'));var deskjs=require(_0xea87('0xf'));var toCsv=require(_0xea87('0x9'));var querystring=require(_0xea87('0x10'));var Papa=require(_0xea87('0x11'));var Redis=require(_0xea87('0x12'));var authService=require(_0xea87('0x13'));var qs=require(_0xea87('0x14'));var as=require(_0xea87('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea87('0x16'))(_0xea87('0x17'));var utils=require(_0xea87('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xea87('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcfefe4,_0x34eab0){_0x34eab0=_0x34eab0||0xcc;return function(_0x15c163){if(_0x15c163){return _0xcfefe4['sendStatus'](_0x34eab0);}return _0xcfefe4[_0xea87('0x1a')](_0x34eab0)[_0xea87('0x1b')]();};}function respondWithResult(_0xe33198,_0x2d1d7c){_0x2d1d7c=_0x2d1d7c||0xc8;return function(_0x2c7787){if(_0x2c7787){return _0xe33198[_0xea87('0x1a')](_0x2d1d7c)[_0xea87('0x1c')](_0x2c7787);}};}function respondWithFilteredResult(_0x488658,_0x2f170f){return function(_0x4f3b7d){if(_0x4f3b7d){var _0x58622e=typeof _0x2f170f['offset']==='undefined'&&typeof _0x2f170f[_0xea87('0x1d')]===_0xea87('0x1e');var _0x25af8f=_0x4f3b7d['count'];var _0x540d7d=_0x58622e?0x0:_0x2f170f['offset'];var _0x1ef58e=_0x58622e?_0x4f3b7d[_0xea87('0x1f')]:_0x2f170f[_0xea87('0x20')]+_0x2f170f[_0xea87('0x1d')];var _0x4b42a1;if(_0x1ef58e>=_0x25af8f){_0x1ef58e=_0x25af8f;_0x4b42a1=0xc8;}else{_0x4b42a1=0xce;}_0x488658[_0xea87('0x1a')](_0x4b42a1);return _0x488658[_0xea87('0x21')](_0xea87('0x22'),_0x540d7d+'-'+_0x1ef58e+'/'+_0x25af8f)['json'](_0x4f3b7d);}return null;};}function patchUpdates(_0x57ee13){return function(_0x1a4096){try{jsonpatch[_0xea87('0x23')](_0x1a4096,_0x57ee13,!![]);}catch(_0x1f449f){return BPromise[_0xea87('0x24')](_0x1f449f);}return _0x1a4096[_0xea87('0x25')]();};}function saveUpdates(_0x41cf0c,_0x2280f8){return function(_0x1f553f){if(_0x1f553f){return _0x1f553f['update'](_0x41cf0c)[_0xea87('0x26')](function(_0x275a7a){return _0x275a7a;});}return null;};}function removeEntity(_0x5a0ea1,_0x233058){return function(_0x452425){if(_0x452425){return _0x452425[_0xea87('0x27')]()[_0xea87('0x26')](function(){_0x5a0ea1['status'](0xcc)[_0xea87('0x1b')]();});}};}function handleEntityNotFound(_0x2d0f03,_0x510a2c){return function(_0xb65c63){if(!_0xb65c63){_0x2d0f03['sendStatus'](0x194);}return _0xb65c63;};}function handleError(_0x4452aa,_0x37f58c){_0x37f58c=_0x37f58c||0x1f4;return function(_0x417847){logger[_0xea87('0x28')](_0x417847[_0xea87('0x29')]);if(_0x417847[_0xea87('0x2a')]){delete _0x417847[_0xea87('0x2a')];}_0x4452aa[_0xea87('0x1a')](_0x37f58c)[_0xea87('0x2b')](_0x417847);};}exports['index']=function(_0x5d2b86,_0x475734){var _0x453bc3={},_0x97db5c={},_0x155ee1={'count':0x0,'rows':[]};var _0xcc5fc5=_[_0xea87('0x2c')](db[_0xea87('0x2d')][_0xea87('0x2e')],function(_0x4ea5f5){return{'name':_0x4ea5f5['fieldName'],'type':_0x4ea5f5[_0xea87('0x2f')][_0xea87('0x30')]};});_0x97db5c['model']=_[_0xea87('0x2c')](_0xcc5fc5,_0xea87('0x2a'));_0x97db5c[_0xea87('0x31')]=_[_0xea87('0x32')](_0x5d2b86['query']);_0x97db5c[_0xea87('0x33')]=_[_0xea87('0x34')](_0x97db5c[_0xea87('0x35')],_0x97db5c['query']);_0x453bc3['attributes']=_[_0xea87('0x34')](_0x97db5c[_0xea87('0x35')],qs[_0xea87('0x36')](_0x5d2b86['query'][_0xea87('0x36')]));_0x453bc3[_0xea87('0x37')]=_0x453bc3[_0xea87('0x37')][_0xea87('0x38')]?_0x453bc3[_0xea87('0x37')]:_0x97db5c[_0xea87('0x35')];if(!_0x5d2b86[_0xea87('0x31')]['hasOwnProperty'](_0xea87('0x39'))){_0x453bc3[_0xea87('0x1d')]=qs[_0xea87('0x1d')](_0x5d2b86[_0xea87('0x31')][_0xea87('0x1d')]);_0x453bc3[_0xea87('0x20')]=qs[_0xea87('0x20')](_0x5d2b86[_0xea87('0x31')][_0xea87('0x20')]);}_0x453bc3['order']=qs[_0xea87('0x3a')](_0x5d2b86['query'][_0xea87('0x3a')]);_0x453bc3[_0xea87('0x3b')]=qs['filters'](_['pick'](_0x5d2b86[_0xea87('0x31')],_0x97db5c[_0xea87('0x33')]),_0xcc5fc5);if(_0x5d2b86[_0xea87('0x31')][_0xea87('0x3c')]){_0x453bc3[_0xea87('0x3b')]=_[_0xea87('0x3d')](_0x453bc3['where'],{'$or':_['map'](_0xcc5fc5,function(_0x533869){if(_0x533869['type']!=='VIRTUAL'){var _0x514a99={};_0x514a99[_0x533869['name']]={'$like':'%'+_0x5d2b86[_0xea87('0x31')]['filter']+'%'};return _0x514a99;}})});}_0x453bc3=_[_0xea87('0x3d')]({},_0x453bc3,_0x5d2b86[_0xea87('0x3e')]);var _0x4071dd={'where':_0x453bc3[_0xea87('0x3b')]};return db['DeskField'][_0xea87('0x1f')](_0x4071dd)[_0xea87('0x26')](function(_0x54ce57){_0x155ee1['count']=_0x54ce57;if(_0x5d2b86['query'][_0xea87('0x3f')]){_0x453bc3[_0xea87('0x40')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x453bc3);})['then'](function(_0x144868){_0x155ee1['rows']=_0x144868;return _0x155ee1;})[_0xea87('0x26')](respondWithFilteredResult(_0x475734,_0x453bc3))['catch'](handleError(_0x475734,null));};exports[_0xea87('0x41')]=function(_0x22f83a,_0x2469bc){var _0x40549c={'raw':!![],'where':{'id':_0x22f83a[_0xea87('0x42')]['id']}},_0x1806d1={};_0x1806d1[_0xea87('0x35')]=_[_0xea87('0x32')](db[_0xea87('0x2d')][_0xea87('0x2e')]);_0x1806d1[_0xea87('0x31')]=_[_0xea87('0x32')](_0x22f83a[_0xea87('0x31')]);_0x1806d1[_0xea87('0x33')]=_[_0xea87('0x34')](_0x1806d1[_0xea87('0x35')],_0x1806d1[_0xea87('0x31')]);_0x40549c[_0xea87('0x37')]=_[_0xea87('0x34')](_0x1806d1['model'],qs[_0xea87('0x36')](_0x22f83a[_0xea87('0x31')][_0xea87('0x36')]));_0x40549c[_0xea87('0x37')]=_0x40549c['attributes'][_0xea87('0x38')]?_0x40549c[_0xea87('0x37')]:_0x1806d1[_0xea87('0x35')];if(_0x22f83a[_0xea87('0x31')][_0xea87('0x3f')]){_0x40549c[_0xea87('0x40')]=[{'all':!![]}];}_0x40549c=_[_0xea87('0x3d')]({},_0x40549c,_0x22f83a[_0xea87('0x3e')]);return db[_0xea87('0x2d')][_0xea87('0x43')](_0x40549c)[_0xea87('0x26')](handleEntityNotFound(_0x2469bc,null))[_0xea87('0x26')](respondWithResult(_0x2469bc,null))[_0xea87('0x44')](handleError(_0x2469bc,null));};exports[_0xea87('0x45')]=function(_0x6928c1,_0x5506af){return db[_0xea87('0x2d')][_0xea87('0x45')](_0x6928c1[_0xea87('0x46')],{})[_0xea87('0x26')](respondWithResult(_0x5506af,0xc9))[_0xea87('0x44')](handleError(_0x5506af,null));};exports[_0xea87('0x47')]=function(_0x790e2,_0x5df2c4){if(_0x790e2[_0xea87('0x46')]['id']){delete _0x790e2[_0xea87('0x46')]['id'];}return db[_0xea87('0x2d')]['find']({'where':{'id':_0x790e2[_0xea87('0x42')]['id']}})[_0xea87('0x26')](handleEntityNotFound(_0x5df2c4,null))[_0xea87('0x26')](saveUpdates(_0x790e2[_0xea87('0x46')],null))['then'](respondWithResult(_0x5df2c4,null))['catch'](handleError(_0x5df2c4,null));};exports[_0xea87('0x27')]=function(_0x31315d,_0x4f73f3){return db[_0xea87('0x2d')][_0xea87('0x43')]({'where':{'id':_0x31315d[_0xea87('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f73f3,null))['then'](removeEntity(_0x4f73f3,null))[_0xea87('0x44')](handleError(_0x4f73f3,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d90c198..5052800 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 _0xed2e=['exports','define','int_desk_fields','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xed2e,0x1f2));var _0xeed2=function(_0x1790f7,_0x2fd5a6){_0x1790f7=_0x1790f7-0x0;var _0x5ec53d=_0xed2e[_0x1790f7];return _0x5ec53d;};'use strict';var _=require(_0xeed2('0x0'));var util=require(_0xeed2('0x1'));var logger=require(_0xeed2('0x2'))('api');var moment=require(_0xeed2('0x3'));var BPromise=require(_0xeed2('0x4'));var rp=require(_0xeed2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeed2('0x6'));var config=require(_0xeed2('0x7'));var attributes=require(_0xeed2('0x8'));module[_0xeed2('0x9')]=function(_0x1e9a57,_0x5c191c){return _0x1e9a57[_0xeed2('0xa')]('DeskField',attributes,{'tableName':_0xeed2('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xeed2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee69=['define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4e198a,_0x5a6bad){var _0xb84bfe=function(_0x58d2b2){while(--_0x58d2b2){_0x4e198a['push'](_0x4e198a['shift']());}};_0xb84bfe(++_0x5a6bad);}(_0xee69,0x117));var _0x9ee6=function(_0xb849f4,_0x52a4b6){_0xb849f4=_0xb849f4-0x0;var _0x3595a4=_0xee69[_0xb849f4];return _0x3595a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9ee6('0x0'))(_0x9ee6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9ee6('0x2'));var fs=require('fs');var path=require(_0x9ee6('0x3'));var rimraf=require(_0x9ee6('0x4'));var config=require(_0x9ee6('0x5'));var attributes=require('./intDeskField.attributes');module[_0x9ee6('0x6')]=function(_0x26d190,_0xdcb9de){return _0x26d190[_0x9ee6('0x7')](_0x9ee6('0x8'),attributes,{'tableName':_0x9ee6('0x9'),'paranoid':![],'indexes':[{'name':_0x9ee6('0xa'),'fields':[_0x9ee6('0xb'),_0x9ee6('0xc')],'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 425bc1e..3154902 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 _0x9400=['request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x330a05,_0xdc71a8){var _0x41c0ff=function(_0x344e38){while(--_0x344e38){_0x330a05['push'](_0x330a05['shift']());}};_0x41c0ff(++_0xdc71a8);}(_0x9400,0x1bf));var _0x0940=function(_0x465534,_0x1185a4){_0x465534=_0x465534-0x0;var _0x5514d4=_0x9400[_0x465534];return _0x5514d4;};'use strict';var _=require(_0x0940('0x0'));var util=require(_0x0940('0x1'));var moment=require(_0x0940('0x2'));var BPromise=require(_0x0940('0x3'));var rs=require(_0x0940('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0940('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0940('0x6'))('rpc');var config=require(_0x0940('0x7'));var jayson=require(_0x0940('0x8'));var client=jayson['client'][_0x0940('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59c485,_0x5eff5c,_0x54bc32){return new BPromise(function(_0xfec5d2,_0x1fdd36){return client[_0x0940('0xa')](_0x59c485,_0x54bc32)[_0x0940('0xb')](function(_0x8ce0fd){logger['info'](_0x0940('0xc'),_0x5eff5c,'request\x20sent');logger[_0x0940('0xd')](_0x0940('0xe'),_0x5eff5c,_0x0940('0xf'),JSON['stringify'](_0x8ce0fd));if(_0x8ce0fd[_0x0940('0x10')]){if(_0x8ce0fd['error'][_0x0940('0x11')]===0x1f4){logger[_0x0940('0x10')](_0x0940('0xc'),_0x5eff5c,_0x8ce0fd[_0x0940('0x10')]['message']);return _0x1fdd36(_0x8ce0fd[_0x0940('0x10')]['message']);}logger[_0x0940('0x10')]('DeskField,\x20%s,\x20%s',_0x5eff5c,_0x8ce0fd['error'][_0x0940('0x12')]);return _0xfec5d2(_0x8ce0fd[_0x0940('0x10')]['message']);}else{logger[_0x0940('0x13')](_0x0940('0xc'),_0x5eff5c,_0x0940('0xf'));_0xfec5d2(_0x8ce0fd[_0x0940('0x14')]['message']);}})[_0x0940('0x15')](function(_0x358282){logger['error'](_0x0940('0xc'),_0x5eff5c,_0x358282);_0x1fdd36(_0x358282);});});} \ No newline at end of file +var _0xf16d=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xf16d,0xad));var _0xdf16=function(_0x3ded1d,_0x33e4e9){_0x3ded1d=_0x3ded1d-0x0;var _0x14cb81=_0xf16d[_0x3ded1d];return _0x14cb81;};'use strict';var _=require(_0xdf16('0x0'));var util=require(_0xdf16('0x1'));var moment=require(_0xdf16('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf16('0x3'));var fs=require('fs');var Redis=require(_0xdf16('0x4'));var db=require(_0xdf16('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf16('0x6'))(_0xdf16('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf16('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11dfe4,_0x9ebbc7,_0x29a38c){return new BPromise(function(_0x3134cc,_0x1b6670){return client[_0xdf16('0x9')](_0x11dfe4,_0x29a38c)[_0xdf16('0xa')](function(_0x250ccb){logger[_0xdf16('0xb')](_0xdf16('0xc'),_0x9ebbc7,_0xdf16('0xd'));logger[_0xdf16('0xe')](_0xdf16('0xf'),_0x9ebbc7,_0xdf16('0xd'),JSON[_0xdf16('0x10')](_0x250ccb));if(_0x250ccb[_0xdf16('0x11')]){if(_0x250ccb[_0xdf16('0x11')]['code']===0x1f4){logger['error'](_0xdf16('0xc'),_0x9ebbc7,_0x250ccb[_0xdf16('0x11')]['message']);return _0x1b6670(_0x250ccb['error'][_0xdf16('0x12')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x9ebbc7,_0x250ccb[_0xdf16('0x11')][_0xdf16('0x12')]);return _0x3134cc(_0x250ccb[_0xdf16('0x11')][_0xdf16('0x12')]);}else{logger['info'](_0xdf16('0xc'),_0x9ebbc7,'request\x20sent');_0x3134cc(_0x250ccb[_0xdf16('0x13')][_0xdf16('0x12')]);}})[_0xdf16('0x14')](function(_0x3c2054){logger['error'](_0xdf16('0xc'),_0x9ebbc7,_0x3c2054);_0x1b6670(_0x3c2054);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 5c07c5c..9f5a8ec 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 _0x6be8=['./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x363bde,_0x1a1d1a){var _0x26b13f=function(_0x2ca810){while(--_0x2ca810){_0x363bde['push'](_0x363bde['shift']());}};_0x26b13f(++_0x1a1d1a);}(_0x6be8,0x8c));var _0x86be=function(_0x35eaac,_0x470cdd){_0x35eaac=_0x35eaac-0x0;var _0x44ff21=_0x6be8[_0x35eaac];return _0x44ff21;};'use strict';var multer=require(_0x86be('0x0'));var util=require(_0x86be('0x1'));var path=require(_0x86be('0x2'));var timeout=require('connect-timeout');var express=require(_0x86be('0x3'));var router=express[_0x86be('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86be('0x5'));var config=require(_0x86be('0x6'));var controller=require(_0x86be('0x7'));router[_0x86be('0x8')]('/',auth[_0x86be('0x9')](),controller[_0x86be('0xa')]);router[_0x86be('0x8')](_0x86be('0xb'),auth[_0x86be('0x9')](),controller[_0x86be('0xc')]);router[_0x86be('0x8')](_0x86be('0xd'),auth[_0x86be('0x9')](),controller[_0x86be('0xe')]);router[_0x86be('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x86be('0xf')]);router[_0x86be('0x10')]('/',auth[_0x86be('0x9')](),controller[_0x86be('0x11')]);router[_0x86be('0x10')](_0x86be('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x86be('0xb'),auth[_0x86be('0x9')](),controller[_0x86be('0x12')]);router[_0x86be('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x86be('0x14')]=router; \ No newline at end of file +var _0xcbaa=['getConfigurations','/:id/fields','post','create','addConfiguration','/:id','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id/configurations'];(function(_0x313454,_0x2f5187){var _0x338c4c=function(_0x9b71d9){while(--_0x9b71d9){_0x313454['push'](_0x313454['shift']());}};_0x338c4c(++_0x2f5187);}(_0xcbaa,0x143));var _0xacba=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0xcbaa[_0x1c5950];return _0x2b720a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xacba('0x0'));var timeout=require(_0xacba('0x1'));var express=require(_0xacba('0x2'));var router=express[_0xacba('0x3')]();var fs_extra=require(_0xacba('0x4'));var auth=require(_0xacba('0x5'));var interaction=require(_0xacba('0x6'));var config=require(_0xacba('0x7'));var controller=require(_0xacba('0x8'));router[_0xacba('0x9')]('/',auth[_0xacba('0xa')](),controller[_0xacba('0xb')]);router[_0xacba('0x9')]('/:id',auth[_0xacba('0xa')](),controller['show']);router[_0xacba('0x9')](_0xacba('0xc'),auth['isAuthenticated'](),controller[_0xacba('0xd')]);router[_0xacba('0x9')](_0xacba('0xe'),auth[_0xacba('0xa')](),controller['getFields']);router[_0xacba('0xf')]('/',auth[_0xacba('0xa')](),controller[_0xacba('0x10')]);router[_0xacba('0xf')](_0xacba('0xc'),auth[_0xacba('0xa')](),controller[_0xacba('0x11')]);router['put'](_0xacba('0x12'),auth[_0xacba('0xa')](),controller['update']);router[_0xacba('0x13')](_0xacba('0x12'),auth['isAuthenticated'](),controller[_0xacba('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index ad12e74..f0779dd 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 _0x8781=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1315fd,_0xe83423){var _0x274915=function(_0x4968f8){while(--_0x4968f8){_0x1315fd['push'](_0x1315fd['shift']());}};_0x274915(++_0xe83423);}(_0x8781,0x1c8));var _0x1878=function(_0x18413b,_0x2a5ca9){_0x18413b=_0x18413b-0x0;var _0x2fc590=_0x8781[_0x18413b];return _0x2fc590;};'use strict';var Sequelize=require(_0x1878('0x0'));module[_0x1878('0x1')]={'name':{'type':Sequelize[_0x1878('0x2')]},'username':{'type':Sequelize[_0x1878('0x2')]},'password':{'type':Sequelize[_0x1878('0x2')]},'remoteUri':{'type':Sequelize[_0x1878('0x2')]},'tenantId':{'type':Sequelize[_0x1878('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1878('0x2')]},'serverUrl':{'type':Sequelize[_0x1878('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1878('0x2')]},'modernAuthentication':{'type':Sequelize[_0x1878('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4cc7=['STRING','BOOLEAN','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x4271f1,_0xdbdc80){_0x4271f1=_0x4271f1-0x0;var _0x1bc9c9=_0x4cc7[_0x4271f1];return _0x1bc9c9;};'use strict';var Sequelize=require(_0x74cc('0x0'));module[_0x74cc('0x1')]={'name':{'type':Sequelize[_0x74cc('0x2')]},'username':{'type':Sequelize[_0x74cc('0x2')]},'password':{'type':Sequelize[_0x74cc('0x2')]},'remoteUri':{'type':Sequelize[_0x74cc('0x2')]},'tenantId':{'type':Sequelize[_0x74cc('0x2')]},'clientId':{'type':Sequelize[_0x74cc('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x74cc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x74cc('0x2')]},'modernAuthentication':{'type':Sequelize[_0x74cc('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1cd0f8f..5426832 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 _0x8779=['influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','owneridname','owneridtype','owneridyominame','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','username','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','@odata.type','substring','PicklistAttributeMetadata','forEach','isNil','BooleanAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','send',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','api','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','then','destroy','sendStatus','error','stack','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','VIRTUAL','name','merge','Dynamics365Account','includeAll','include','findAll','catch','show','options','create','body','update','params','find','getConfigurations','findOne','order','hasOwnProperty','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','lastIndexOf','%s/api/data/v9.0/','incident','Incident','PhoneCall','title','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname'];(function(_0x10f4d0,_0x3c0d6d){var _0x387305=function(_0x511b89){while(--_0x511b89){_0x10f4d0['push'](_0x10f4d0['shift']());}};_0x387305(++_0x3c0d6d);}(_0x8779,0x1c3));var _0x9877=function(_0x346f16,_0x1808b3){_0x346f16=_0x346f16-0x0;var _0x3abe4f=_0x8779[_0x346f16];return _0x3abe4f;};'use strict';var rp=require(_0x9877('0x0'));var util=require('util');var _=require(_0x9877('0x1'));var qs=require(_0x9877('0x2'));var logger=require('../../config/logger')(_0x9877('0x3'));var db=require(_0x9877('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x4a4be9,_0x47f83f){_0x47f83f=_0x47f83f||0xc8;return function(_0x33536b){if(_0x33536b){return _0x4a4be9[_0x9877('0x5')](_0x47f83f)[_0x9877('0x6')](_0x33536b);}};}function respondWithFilteredResult(_0x42fbc1,_0x2aee60){return function(_0x54cb4d){if(_0x54cb4d){var _0x99d4d=typeof _0x2aee60['offset']===_0x9877('0x7')&&typeof _0x2aee60[_0x9877('0x8')]===_0x9877('0x7');var _0x5ec89a=_0x54cb4d[_0x9877('0x9')];var _0x3b9103=_0x99d4d?0x0:_0x2aee60[_0x9877('0xa')];var _0x13472c=_0x99d4d?_0x54cb4d[_0x9877('0x9')]:_0x2aee60[_0x9877('0xa')]+_0x2aee60[_0x9877('0x8')];var _0x208568;if(_0x13472c>=_0x5ec89a){_0x13472c=_0x5ec89a;_0x208568=0xc8;}else{_0x208568=0xce;}_0x42fbc1[_0x9877('0x5')](_0x208568);return _0x42fbc1['set'](_0x9877('0xb'),_0x3b9103+'-'+_0x13472c+'/'+_0x5ec89a)[_0x9877('0x6')](_0x54cb4d);}return null;};}function saveUpdates(_0x2a2156){return function(_0x955014){if(_0x955014){return _0x955014['update'](_0x2a2156)[_0x9877('0xc')](function(_0x4f05b5){return _0x4f05b5;});}return null;};}function removeEntity(_0x14953d){return function(_0x57d895){if(_0x57d895){return _0x57d895[_0x9877('0xd')]()[_0x9877('0xc')](function(){_0x14953d[_0x9877('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56f1e4){return function(_0x3e41fc){if(!_0x3e41fc){_0x56f1e4[_0x9877('0xe')](0x194);}return _0x3e41fc;};}function handleError(_0x31aa93,_0x1c92cc){_0x1c92cc=_0x1c92cc||0x1f4;return function(_0x286d96){logger[_0x9877('0xf')](_0x286d96[_0x9877('0x10')]);if(_0x286d96['name']){delete _0x286d96['name'];}_0x31aa93[_0x9877('0x5')](_0x1c92cc)['send'](_0x286d96);};}exports[_0x9877('0x11')]=function(_0x35943a,_0x185988){var _0x1c66d9={},_0x259f06={},_0x132a0a={'count':0x0,'rows':[]};var _0x5750ab=_[_0x9877('0x12')](db['Dynamics365Account'][_0x9877('0x13')],function(_0x53e267){return{'name':_0x53e267[_0x9877('0x14')],'type':_0x53e267[_0x9877('0x15')][_0x9877('0x16')]};});_0x259f06[_0x9877('0x17')]=_[_0x9877('0x12')](_0x5750ab,'name');_0x259f06[_0x9877('0x18')]=_[_0x9877('0x19')](_0x35943a[_0x9877('0x18')]);_0x259f06[_0x9877('0x1a')]=_[_0x9877('0x1b')](_0x259f06['model'],_0x259f06['query']);_0x1c66d9[_0x9877('0x1c')]=_[_0x9877('0x1b')](_0x259f06[_0x9877('0x17')],qs[_0x9877('0x1d')](_0x35943a[_0x9877('0x18')]['fields']));_0x1c66d9[_0x9877('0x1c')]=_0x1c66d9[_0x9877('0x1c')][_0x9877('0x1e')]?_0x1c66d9[_0x9877('0x1c')]:_0x259f06['model'];if(!_0x35943a[_0x9877('0x18')]['hasOwnProperty']('nolimit')){_0x1c66d9[_0x9877('0x8')]=qs['limit'](_0x35943a['query']['limit']);_0x1c66d9['offset']=qs['offset'](_0x35943a['query']['offset']);}_0x1c66d9['order']=qs[_0x9877('0x1f')](_0x35943a[_0x9877('0x18')][_0x9877('0x1f')]);_0x1c66d9[_0x9877('0x20')]=qs[_0x9877('0x1a')](_['pick'](_0x35943a['query'],_0x259f06[_0x9877('0x1a')]),_0x5750ab);if(_0x35943a['query'][_0x9877('0x21')]){_0x1c66d9[_0x9877('0x20')]=_['merge'](_0x1c66d9[_0x9877('0x20')],{'$or':_[_0x9877('0x12')](_0x5750ab,function(_0x20e533){if(_0x20e533['type']!==_0x9877('0x22')){var _0x2f475c={};_0x2f475c[_0x20e533[_0x9877('0x23')]]={'$like':'%'+_0x35943a['query'][_0x9877('0x21')]+'%'};return _0x2f475c;}})});}_0x1c66d9=_[_0x9877('0x24')]({},_0x1c66d9,_0x35943a['options']);var _0x6f9672={'where':_0x1c66d9['where']};return db[_0x9877('0x25')]['count'](_0x6f9672)[_0x9877('0xc')](function(_0x32c7dc){_0x132a0a['count']=_0x32c7dc;if(_0x35943a['query'][_0x9877('0x26')]){_0x1c66d9[_0x9877('0x27')]=[{'all':!![]}];}return db[_0x9877('0x25')][_0x9877('0x28')](_0x1c66d9);})[_0x9877('0xc')](function(_0xe08cfc){_0x132a0a['rows']=_0xe08cfc;return _0x132a0a;})[_0x9877('0xc')](respondWithFilteredResult(_0x185988,_0x1c66d9))[_0x9877('0x29')](handleError(_0x185988,null));};exports[_0x9877('0x2a')]=function(_0x109390,_0x48163e){var _0x30e1b2={'raw':![],'where':{'id':_0x109390['params']['id']}},_0x59ed80={};_0x59ed80[_0x9877('0x17')]=_[_0x9877('0x19')](db['Dynamics365Account']['rawAttributes']);_0x59ed80[_0x9877('0x18')]=_[_0x9877('0x19')](_0x109390[_0x9877('0x18')]);_0x59ed80['filters']=_['intersection'](_0x59ed80[_0x9877('0x17')],_0x59ed80[_0x9877('0x18')]);_0x30e1b2[_0x9877('0x1c')]=_['intersection'](_0x59ed80[_0x9877('0x17')],qs[_0x9877('0x1d')](_0x109390['query'][_0x9877('0x1d')]));_0x30e1b2['attributes']=_0x30e1b2[_0x9877('0x1c')][_0x9877('0x1e')]?_0x30e1b2[_0x9877('0x1c')]:_0x59ed80['model'];if(_0x109390[_0x9877('0x18')][_0x9877('0x26')]){_0x30e1b2[_0x9877('0x27')]=[{'all':!![]}];}_0x30e1b2=_[_0x9877('0x24')]({},_0x30e1b2,_0x109390[_0x9877('0x2b')]);return db[_0x9877('0x25')]['find'](_0x30e1b2)['then'](handleEntityNotFound(_0x48163e,null))[_0x9877('0xc')](respondWithResult(_0x48163e,null))[_0x9877('0x29')](handleError(_0x48163e,null));};exports['create']=function(_0x37c999,_0x91a9c5){return db['Dynamics365Account'][_0x9877('0x2c')](_0x37c999[_0x9877('0x2d')],{})[_0x9877('0xc')](respondWithResult(_0x91a9c5,0xc9))['catch'](handleError(_0x91a9c5,null));};exports[_0x9877('0x2e')]=function(_0x6276b0,_0x180722){if(_0x6276b0['body']['id']){delete _0x6276b0['body']['id'];}return db[_0x9877('0x25')]['find']({'where':{'id':_0x6276b0[_0x9877('0x2f')]['id']}})[_0x9877('0xc')](handleEntityNotFound(_0x180722,null))['then'](saveUpdates(_0x6276b0['body'],null))[_0x9877('0xc')](respondWithResult(_0x180722,null))[_0x9877('0x29')](handleError(_0x180722,null));};exports[_0x9877('0xd')]=function(_0xe0b6a0,_0x4b39a4){return db['Dynamics365Account'][_0x9877('0x30')]({'where':{'id':_0xe0b6a0[_0x9877('0x2f')]['id']}})[_0x9877('0xc')](handleEntityNotFound(_0x4b39a4,null))[_0x9877('0xc')](removeEntity(_0x4b39a4,null))['catch'](handleError(_0x4b39a4,null));};exports[_0x9877('0x31')]=function(_0x1ca86f,_0x22bcbf){var _0x14f6de={};var _0x59bb64={};var _0x11baa8;var _0x10bc69;return db[_0x9877('0x25')][_0x9877('0x32')]({'where':{'id':_0x1ca86f[_0x9877('0x2f')]['id']}})[_0x9877('0xc')](handleEntityNotFound(_0x22bcbf,null))[_0x9877('0xc')](function(_0x15c4a3){if(_0x15c4a3){_0x11baa8=_0x15c4a3;_0x59bb64[_0x9877('0x17')]=_[_0x9877('0x19')](db['Dynamics365Configuration'][_0x9877('0x13')]);_0x59bb64[_0x9877('0x18')]=_[_0x9877('0x19')](_0x1ca86f[_0x9877('0x18')]);_0x59bb64[_0x9877('0x1a')]=_[_0x9877('0x1b')](_0x59bb64[_0x9877('0x17')],_0x59bb64[_0x9877('0x18')]);_0x14f6de[_0x9877('0x1c')]=_[_0x9877('0x1b')](_0x59bb64[_0x9877('0x17')],qs[_0x9877('0x1d')](_0x1ca86f['query']['fields']));_0x14f6de[_0x9877('0x1c')]=_0x14f6de[_0x9877('0x1c')][_0x9877('0x1e')]?_0x14f6de[_0x9877('0x1c')]:_0x59bb64[_0x9877('0x17')];_0x14f6de[_0x9877('0x33')]=qs['sort'](_0x1ca86f['query']['sort']);_0x14f6de['where']=qs[_0x9877('0x1a')](_['pick'](_0x1ca86f[_0x9877('0x18')],_0x59bb64[_0x9877('0x1a')]));if(_0x1ca86f['query'][_0x9877('0x21')]){_0x14f6de['where']=_[_0x9877('0x24')](_0x14f6de[_0x9877('0x20')],{'$or':_[_0x9877('0x12')](_0x14f6de[_0x9877('0x1c')],function(_0x4938fc){var _0x20b07c={};_0x20b07c[_0x4938fc]={'$like':'%'+_0x1ca86f[_0x9877('0x18')]['filter']+'%'};return _0x20b07c;})});}_0x14f6de=_['merge']({},_0x14f6de,_0x1ca86f[_0x9877('0x2b')]);return _0x11baa8['getConfigurations'](_0x14f6de);}})['then'](function(_0x3c468a){if(_0x3c468a){_0x10bc69=_0x3c468a[_0x9877('0x1e')];if(!_0x1ca86f[_0x9877('0x18')][_0x9877('0x34')](_0x9877('0x35'))){_0x14f6de[_0x9877('0x8')]=qs[_0x9877('0x8')](_0x1ca86f[_0x9877('0x18')]['limit']);_0x14f6de[_0x9877('0xa')]=qs[_0x9877('0xa')](_0x1ca86f[_0x9877('0x18')][_0x9877('0xa')]);}return _0x11baa8[_0x9877('0x31')](_0x14f6de);}})[_0x9877('0xc')](function(_0x3dee5f){if(_0x3dee5f){return _0x3dee5f?{'count':_0x10bc69,'rows':_0x3dee5f}:null;}})[_0x9877('0xc')](respondWithResult(_0x22bcbf,null))[_0x9877('0x29')](handleError(_0x22bcbf,null));};exports[_0x9877('0x36')]=function(_0x87290,_0x56b082){if(_0x87290[_0x9877('0x2d')]['id']){delete _0x87290[_0x9877('0x2d')]['id'];}return db[_0x9877('0x25')][_0x9877('0x32')]({'where':{'id':_0x87290[_0x9877('0x2f')]['id']}})[_0x9877('0xc')](handleEntityNotFound(_0x56b082,null))[_0x9877('0xc')](function(_0x4c2506){if(_0x4c2506){_0x87290['body']['AccountId']=_0x4c2506['id'];_0x87290[_0x9877('0x2d')][_0x9877('0x37')]=integrations['getSubjects'](_0x87290[_0x9877('0x2d')][_0x9877('0x38')],_0x87290[_0x9877('0x2d')][_0x9877('0x15')]);_0x87290[_0x9877('0x2d')][_0x9877('0x39')]=integrations[_0x9877('0x3a')](_0x87290['body'][_0x9877('0x38')],_0x87290[_0x9877('0x2d')][_0x9877('0x15')]);return db['Dynamics365Configuration'][_0x9877('0x2c')](_0x87290[_0x9877('0x2d')],{'include':[{'model':db[_0x9877('0x3b')],'as':_0x9877('0x37')},{'model':db[_0x9877('0x3b')],'as':_0x9877('0x39')}]});}return null;})[_0x9877('0xc')](respondWithResult(_0x56b082,null))[_0x9877('0x29')](handleError(_0x56b082,null));};function sanitizeRemoteUri(_0x1b3e80){var _0x588063=_0x1b3e80['slice'](-0x1);if(_0x588063==='/')return _0x1b3e80['substring'](0x0,_0x1b3e80[_0x9877('0x3c')](_0x588063));return _0x1b3e80;}function getWebApiUrl(_0x47c0d0){return util['format'](_0x9877('0x3d'),_0x47c0d0);}exports['getFields']=function(_0x70015c,_0x429e96){var _0xab2dc5=_0x70015c[_0x9877('0x18')]['ticketType'];var _0x8be696=_0xab2dc5===_0x9877('0x3e')?_0x9877('0x3f'):_0x9877('0x40');var _0x70a40e='';var _0x356083='';var _0x321245='';var _0x5f0a8a='';var _0x39c19a='';var _0x2e3e22='';var _0x236d55='';var _0x2808e2='';var _0x44fe16=[_0x9877('0x41'),'description','customerid',_0x9877('0x42'),_0x9877('0x43'),_0x9877('0x44'),_0x9877('0x45'),_0x9877('0x46'),_0x9877('0x47'),_0x9877('0x48')];var _0x311c88=[_0x9877('0x49'),_0x9877('0x4a'),'actualserviceunits',_0x9877('0x4b'),_0x9877('0x4c'),_0x9877('0x4d'),_0x9877('0x4e'),_0x9877('0x4f'),_0x9877('0x50'),_0x9877('0x51'),_0x9877('0x52'),'createdbyyominame',_0x9877('0x53'),_0x9877('0x54'),_0x9877('0x55'),_0x9877('0x56'),_0x9877('0x57'),_0x9877('0x58'),_0x9877('0x59'),_0x9877('0x5a'),'entityimage_timestamp',_0x9877('0x5b'),_0x9877('0x5c'),_0x9877('0x5d'),_0x9877('0x5e'),'followupby','importsequencenumber',_0x9877('0x5f'),_0x9877('0x60'),_0x9877('0x61'),_0x9877('0x62'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname',_0x9877('0x63'),'modifiedon',_0x9877('0x64'),'modifiedonbehalfbyyominame',_0x9877('0x65'),_0x9877('0x66'),_0x9877('0x67'),'onholdtime','overriddencreatedon',_0x9877('0x68'),_0x9877('0x69'),_0x9877('0x6a'),'parentcaseidname',_0x9877('0x6b'),'primarycontactidyominame','prioritycodename',_0x9877('0x6c'),_0x9877('0x6d'),_0x9877('0x6e'),_0x9877('0x6f'),_0x9877('0x70'),_0x9877('0x71'),_0x9877('0x72'),_0x9877('0x73'),'slainvokedidname','slaname',_0x9877('0x74'),_0x9877('0x75'),_0x9877('0x76'),'subjectidname',_0x9877('0x77'),_0x9877('0x78'),_0x9877('0x79'),'traversedpath',_0x9877('0x7a'),_0x9877('0x7b')];var _0x2da029=_0x44fe16['concat'](_0x311c88);return db['Dynamics365Account'][_0x9877('0x32')]({'where':{'id':_0x70015c[_0x9877('0x2f')]['id']},'attributes':['id','username',_0x9877('0x7c'),_0x9877('0x7d'),_0x9877('0x7e'),_0x9877('0x7f'),'clientSecret',_0x9877('0x80')],'include':[{'model':db[_0x9877('0x81')],'as':_0x9877('0x81'),'attributes':['id',_0x9877('0x82'),_0x9877('0x83')]}]})[_0x9877('0xc')](handleEntityNotFound(_0x429e96,null))[_0x9877('0xc')](function(_0x55a9d3){if(_0x55a9d3){if(_0x55a9d3['modernAuthentication']){_0x55a9d3['access_token']=_0x55a9d3[_0x9877('0x81')][_0x9877('0x82')];_0x2808e2=sanitizeRemoteUri(_0x55a9d3[_0x9877('0x81')][_0x9877('0x83')]);_0x236d55=getWebApiUrl(_0x2808e2);return _0x55a9d3;}_0x2808e2=sanitizeRemoteUri(_0x55a9d3[_0x9877('0x7d')]);_0x236d55=getWebApiUrl(_0x2808e2);var _0x2fc5fc={'method':_0x9877('0x84'),'uri':_0x9877('0x85')+_0x55a9d3[_0x9877('0x7e')]+'/oauth2/token','form':{'client_id':_0x55a9d3[_0x9877('0x7f')],'resource':_0x2808e2,'username':_0x55a9d3[_0x9877('0x86')],'password':_0x55a9d3['password'],'grant_type':_0x9877('0x7c'),'client_secret':_0x55a9d3[_0x9877('0x87')]},'json':!![]};return rp(_0x2fc5fc);}})[_0x9877('0xc')](function(_0x4e04fa){_0x2e3e22=_0x4e04fa[_0x9877('0x88')];var _0x46a70d={'method':_0x9877('0x89'),'uri':encodeURI(_0x236d55+_0x9877('0x8a')+_0x8be696+'\x27'),'headers':{'Authorization':_0x9877('0x8b')+_0x2e3e22,'If-None-Match':null,'OData-Version':_0x9877('0x8c')},'json':!![]};return rp(_0x46a70d);})['then'](function(_0x2f7c5d){var _0x5ab871=_0x2f7c5d[_0x9877('0x8d')][0x0];var _0x553d9c=_0x5ab871[_0x9877('0x8e')];var _0x51345a={'method':'GET','uri':_0x236d55+_0x9877('0x8f')+_0x553d9c+_0x9877('0x90'),'headers':{'Authorization':_0x9877('0x8b')+_0x2e3e22,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x51345a);})[_0x9877('0xc')](function(_0x270006){_0x70a40e=_0x270006;_0x356083=_0x70a40e[_0x9877('0x91')];_0x356083=_['remove'](_0x356083,function(_0x453979){return!_0x2da029['includes'](_0x453979['LogicalName']);});var _0x162946=[];var _0x307dfd=[];_0x356083['forEach'](function(_0x50af8f){if(_0x50af8f['@odata.type']){var _0x21fe00=_0x50af8f[_0x9877('0x92')][_0x9877('0x93')](_0x50af8f[_0x9877('0x92')]['lastIndexOf']('.')+0x1);if(_0x21fe00===_0x9877('0x94')){_0x162946['push'](getSelectList(_0x236d55,_0xab2dc5,_0x307dfd,_0x70a40e[_0x9877('0x8e')],_0x50af8f[_0x9877('0x8e')],_0x2e3e22));}}});return Promise['all'](_0x162946);})[_0x9877('0xc')](function(_0x45178b){_0x321245=_0x45178b[0x0];var _0x35cfe6=[];var _0xcc7c3f=[];_0x356083[_0x9877('0x95')](function(_0x33cc46){if(!_[_0x9877('0x96')](_0x33cc46[_0x9877('0x92')])){var _0x2ac838=_0x33cc46[_0x9877('0x92')]['substring'](_0x33cc46[_0x9877('0x92')][_0x9877('0x3c')]('.')+0x1);if(_0x2ac838===_0x9877('0x97')){_0x35cfe6[_0x9877('0x98')](getBooleanList(_0x236d55,_0xab2dc5,_0xcc7c3f,_0x70a40e['MetadataId'],_0x33cc46[_0x9877('0x8e')],_0x2e3e22));}}});return Promise[_0x9877('0x99')](_0x35cfe6);})[_0x9877('0xc')](function(_0x176e8d){_0x5f0a8a=_0x176e8d[0x0];var _0x5f5adb=[];var _0x220b51=[];_0x356083[_0x9877('0x95')](function(_0x12c362){if(_0x12c362[_0x9877('0x92')]){var _0x3124bb=_0x12c362[_0x9877('0x92')][_0x9877('0x93')](_0x12c362['@odata.type'][_0x9877('0x3c')]('.')+0x1);if(_0x3124bb===_0x9877('0x9a')||_0x3124bb===_0x9877('0x9b')||_0x3124bb===_0x9877('0x9c')||_0x3124bb===_0x9877('0x9d')||_0x3124bb===_0x9877('0x9e')||_0x3124bb===_0x9877('0x9f')||_0x3124bb===_0x9877('0xa0')||_0x3124bb==='EntityNameAttributeMetadata'||_0x3124bb===_0x9877('0xa1')||_0x3124bb===_0x9877('0xa2')){_0x5f5adb[_0x9877('0x98')](getInputList(_0x236d55,_0xab2dc5,_0x3124bb,_0x220b51,_0x70a40e[_0x9877('0x8e')],_0x12c362[_0x9877('0x8e')],_0x2e3e22));}}});return Promise[_0x9877('0x99')](_0x5f5adb);})[_0x9877('0xc')](function(_0x24e57d){_0x39c19a=_0x24e57d[0x0];var _0x5f0723=_0x321245[_0x9877('0xa3')](_0x5f0a8a)[_0x9877('0xa3')](_0x39c19a);var _0x5ee709={'count':_0x5f0723['length'],'rows':_0x5f0723};return _0x5ee709;})[_0x9877('0xc')](respondWithResult(_0x429e96,null))[_0x9877('0x29')](function(_0x212ca0){var _0x5c8d51=_0x70015c['query'][_0x9877('0xa4')]?0x1f4:_0x212ca0[_0x9877('0xa5')]||0x1f4;logger[_0x9877('0xf')](_0x212ca0[_0x9877('0x10')]);delete _0x212ca0['name'];if(_0x5c8d51===0x191){_0x5c8d51=0x190;}_0x429e96['status'](_0x5c8d51)[_0x9877('0xa6')](_0x70015c[_0x9877('0x18')][_0x9877('0xa4')]?{'message':'Wrong\x20credentials','statusCode':_0x212ca0[_0x9877('0xa5')]}:_0x212ca0);});};function getSelectList(_0x147522,_0x1dd5b1,_0x29fcfb,_0x5df04b,_0x397178,_0x27a0d1){var _0x2944e5={'method':_0x9877('0x89'),'uri':_0x147522+_0x9877('0x8f')+_0x5df04b+_0x9877('0xa7')+_0x397178+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x9877('0xa8'),'headers':{'Authorization':_0x9877('0x8b')+_0x27a0d1,'If-None-Match':null,'OData-Version':_0x9877('0x8c')},'json':!![]};return rp(_0x2944e5)[_0x9877('0xc')](function(_0x3ca1b1){var _0x1c4e02=[];var _0x3fab78=_0x3ca1b1[_0x9877('0xa9')][_0x9877('0xaa')];_0x3fab78['forEach'](function(_0x20c880){_0x1c4e02['push']({'name':_0x20c880[_0x9877('0xab')][_0x9877('0xac')][_0x9877('0xab')],'value':String(_0x20c880[_0x9877('0xad')])});});var _0x521b08={'id':_0x1dd5b1+'_'+_0x3ca1b1[_0x9877('0xae')],'name':_0x3ca1b1[_0x9877('0xaf')][_0x9877('0xac')][_0x9877('0xab')],'custom':![],'options':_0x1c4e02};_0x29fcfb[_0x9877('0x98')](_0x521b08);return _0x29fcfb;});}function getBooleanList(_0x43f43a,_0x19cecc,_0x21edfa,_0x19291c,_0x321e0f,_0x453d36){var _0x556b43={'method':_0x9877('0x89'),'uri':_0x43f43a+'EntityDefinitions('+_0x19291c+_0x9877('0xa7')+_0x321e0f+_0x9877('0xb0'),'headers':{'Authorization':_0x9877('0x8b')+_0x453d36,'If-None-Match':null,'OData-Version':_0x9877('0x8c')},'json':!![]};return rp(_0x556b43)[_0x9877('0xc')](function(_0x3f7360){var _0x502a82=[];_0x502a82[_0x9877('0x98')]({'name':_0x3f7360[_0x9877('0xa9')][_0x9877('0xb1')][_0x9877('0xab')][_0x9877('0xac')][_0x9877('0xab')],'value':'true'},{'name':_0x3f7360[_0x9877('0xa9')][_0x9877('0xb2')]['Label']['UserLocalizedLabel']['Label'],'value':_0x9877('0xb3')});var _0x436c2e={'id':_0x19cecc+'_'+_0x3f7360[_0x9877('0xae')],'name':_0x3f7360[_0x9877('0xaf')][_0x9877('0xac')]['Label'],'custom':![],'options':_0x502a82};_0x21edfa[_0x9877('0x98')](_0x436c2e);return _0x21edfa;});}function getInputList(_0x2848e2,_0x5af24e,_0x292b5c,_0x281eec,_0xa92cbe,_0x48b7a0,_0x3544e0){var _0xbb0859={'method':_0x9877('0x89'),'uri':_0x2848e2+_0x9877('0x8f')+_0xa92cbe+_0x9877('0xa7')+_0x48b7a0+_0x9877('0xb4')+_0x292b5c+_0x9877('0xb5'),'headers':{'Authorization':_0x9877('0x8b')+_0x3544e0,'If-None-Match':null,'OData-Version':_0x9877('0x8c')},'json':!![]};return rp(_0xbb0859)[_0x9877('0xc')](function(_0x2b9cab){var _0xe7d98={'id':_0x5af24e+'_'+_0x2b9cab[_0x9877('0xae')],'name':_0x2b9cab['DisplayName'][_0x9877('0xac')]?_0x2b9cab[_0x9877('0xaf')]['UserLocalizedLabel'][_0x9877('0xab')]:_0x2b9cab['LogicalName'],'custom':![],'options':[]};_0x281eec['push'](_0xe7d98);return _0x281eec;});} \ No newline at end of file +var _0x0cc8=['end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dynamics365Account','count','then','include','findAll','rows','params','keys','fields','includeAll','find','catch','create','update','body','destroy','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','exchangerate','followupby','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','offset','set','Content-Range'];(function(_0x49e563,_0x49431d){var _0x493946=function(_0x1dd017){while(--_0x1dd017){_0x49e563['push'](_0x49e563['shift']());}};_0x493946(++_0x49431d);}(_0x0cc8,0xb4));var _0x80cc=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x0cc8[_0x22cc16];return _0x399b70;};'use strict';var rp=require('request-promise');var util=require(_0x80cc('0x0'));var _=require(_0x80cc('0x1'));var qs=require(_0x80cc('0x2'));var logger=require(_0x80cc('0x3'))('api');var db=require(_0x80cc('0x4'))['db'];var integrations=require(_0x80cc('0x5'));function respondWithResult(_0x566e73,_0x326d74){_0x326d74=_0x326d74||0xc8;return function(_0x281078){if(_0x281078){return _0x566e73[_0x80cc('0x6')](_0x326d74)[_0x80cc('0x7')](_0x281078);}};}function respondWithFilteredResult(_0x68351b,_0x4c7657){return function(_0x5bbe39){if(_0x5bbe39){var _0x1743d2=typeof _0x4c7657['offset']===_0x80cc('0x8')&&typeof _0x4c7657[_0x80cc('0x9')]==='undefined';var _0x25f521=_0x5bbe39['count'];var _0x1ab702=_0x1743d2?0x0:_0x4c7657[_0x80cc('0xa')];var _0x183084=_0x1743d2?_0x5bbe39['count']:_0x4c7657[_0x80cc('0xa')]+_0x4c7657[_0x80cc('0x9')];var _0x474285;if(_0x183084>=_0x25f521){_0x183084=_0x25f521;_0x474285=0xc8;}else{_0x474285=0xce;}_0x68351b[_0x80cc('0x6')](_0x474285);return _0x68351b[_0x80cc('0xb')](_0x80cc('0xc'),_0x1ab702+'-'+_0x183084+'/'+_0x25f521)[_0x80cc('0x7')](_0x5bbe39);}return null;};}function saveUpdates(_0x1c033f){return function(_0x42b074){if(_0x42b074){return _0x42b074['update'](_0x1c033f)['then'](function(_0x36bb2d){return _0x36bb2d;});}return null;};}function removeEntity(_0x5abbc4){return function(_0x34fe53){if(_0x34fe53){return _0x34fe53['destroy']()['then'](function(){_0x5abbc4[_0x80cc('0x6')](0xcc)[_0x80cc('0xd')]();});}};}function handleEntityNotFound(_0x2a3854){return function(_0x274cb2){if(!_0x274cb2){_0x2a3854[_0x80cc('0xe')](0x194);}return _0x274cb2;};}function handleError(_0x48622c,_0x3b7091){_0x3b7091=_0x3b7091||0x1f4;return function(_0x4f24b8){logger[_0x80cc('0xf')](_0x4f24b8[_0x80cc('0x10')]);if(_0x4f24b8[_0x80cc('0x11')]){delete _0x4f24b8['name'];}_0x48622c[_0x80cc('0x6')](_0x3b7091)['send'](_0x4f24b8);};}exports[_0x80cc('0x12')]=function(_0x43460f,_0x1cebe1){var _0x31181b={},_0x1c4092={},_0x565074={'count':0x0,'rows':[]};var _0x335351=_[_0x80cc('0x13')](db['Dynamics365Account'][_0x80cc('0x14')],function(_0x256320){return{'name':_0x256320[_0x80cc('0x15')],'type':_0x256320[_0x80cc('0x16')][_0x80cc('0x17')]};});_0x1c4092[_0x80cc('0x18')]=_[_0x80cc('0x13')](_0x335351,_0x80cc('0x11'));_0x1c4092[_0x80cc('0x19')]=_['keys'](_0x43460f[_0x80cc('0x19')]);_0x1c4092['filters']=_[_0x80cc('0x1a')](_0x1c4092['model'],_0x1c4092['query']);_0x31181b['attributes']=_[_0x80cc('0x1a')](_0x1c4092[_0x80cc('0x18')],qs['fields'](_0x43460f[_0x80cc('0x19')]['fields']));_0x31181b[_0x80cc('0x1b')]=_0x31181b[_0x80cc('0x1b')][_0x80cc('0x1c')]?_0x31181b[_0x80cc('0x1b')]:_0x1c4092[_0x80cc('0x18')];if(!_0x43460f[_0x80cc('0x19')][_0x80cc('0x1d')](_0x80cc('0x1e'))){_0x31181b['limit']=qs[_0x80cc('0x9')](_0x43460f[_0x80cc('0x19')][_0x80cc('0x9')]);_0x31181b[_0x80cc('0xa')]=qs[_0x80cc('0xa')](_0x43460f[_0x80cc('0x19')][_0x80cc('0xa')]);}_0x31181b[_0x80cc('0x1f')]=qs[_0x80cc('0x20')](_0x43460f['query'][_0x80cc('0x20')]);_0x31181b[_0x80cc('0x21')]=qs[_0x80cc('0x22')](_[_0x80cc('0x23')](_0x43460f[_0x80cc('0x19')],_0x1c4092[_0x80cc('0x22')]),_0x335351);if(_0x43460f[_0x80cc('0x19')][_0x80cc('0x24')]){_0x31181b[_0x80cc('0x21')]=_[_0x80cc('0x25')](_0x31181b[_0x80cc('0x21')],{'$or':_[_0x80cc('0x13')](_0x335351,function(_0x592fa4){if(_0x592fa4['type']!==_0x80cc('0x26')){var _0x3923c3={};_0x3923c3[_0x592fa4[_0x80cc('0x11')]]={'$like':'%'+_0x43460f[_0x80cc('0x19')][_0x80cc('0x24')]+'%'};return _0x3923c3;}})});}_0x31181b=_[_0x80cc('0x25')]({},_0x31181b,_0x43460f[_0x80cc('0x27')]);var _0x58ea1a={'where':_0x31181b[_0x80cc('0x21')]};return db[_0x80cc('0x28')][_0x80cc('0x29')](_0x58ea1a)[_0x80cc('0x2a')](function(_0x382ea7){_0x565074[_0x80cc('0x29')]=_0x382ea7;if(_0x43460f['query']['includeAll']){_0x31181b[_0x80cc('0x2b')]=[{'all':!![]}];}return db[_0x80cc('0x28')][_0x80cc('0x2c')](_0x31181b);})[_0x80cc('0x2a')](function(_0x350dc2){_0x565074[_0x80cc('0x2d')]=_0x350dc2;return _0x565074;})[_0x80cc('0x2a')](respondWithFilteredResult(_0x1cebe1,_0x31181b))['catch'](handleError(_0x1cebe1,null));};exports['show']=function(_0x28f248,_0x212663){var _0x57bc00={'raw':![],'where':{'id':_0x28f248[_0x80cc('0x2e')]['id']}},_0x11273e={};_0x11273e[_0x80cc('0x18')]=_[_0x80cc('0x2f')](db[_0x80cc('0x28')][_0x80cc('0x14')]);_0x11273e[_0x80cc('0x19')]=_[_0x80cc('0x2f')](_0x28f248[_0x80cc('0x19')]);_0x11273e[_0x80cc('0x22')]=_['intersection'](_0x11273e[_0x80cc('0x18')],_0x11273e['query']);_0x57bc00[_0x80cc('0x1b')]=_[_0x80cc('0x1a')](_0x11273e[_0x80cc('0x18')],qs[_0x80cc('0x30')](_0x28f248[_0x80cc('0x19')]['fields']));_0x57bc00[_0x80cc('0x1b')]=_0x57bc00[_0x80cc('0x1b')][_0x80cc('0x1c')]?_0x57bc00['attributes']:_0x11273e[_0x80cc('0x18')];if(_0x28f248[_0x80cc('0x19')][_0x80cc('0x31')]){_0x57bc00[_0x80cc('0x2b')]=[{'all':!![]}];}_0x57bc00=_[_0x80cc('0x25')]({},_0x57bc00,_0x28f248['options']);return db['Dynamics365Account'][_0x80cc('0x32')](_0x57bc00)[_0x80cc('0x2a')](handleEntityNotFound(_0x212663,null))[_0x80cc('0x2a')](respondWithResult(_0x212663,null))[_0x80cc('0x33')](handleError(_0x212663,null));};exports[_0x80cc('0x34')]=function(_0x189f95,_0x135c13){return db[_0x80cc('0x28')][_0x80cc('0x34')](_0x189f95['body'],{})['then'](respondWithResult(_0x135c13,0xc9))['catch'](handleError(_0x135c13,null));};exports[_0x80cc('0x35')]=function(_0x25bd91,_0x2e81b8){if(_0x25bd91[_0x80cc('0x36')]['id']){delete _0x25bd91['body']['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x25bd91[_0x80cc('0x2e')]['id']}})[_0x80cc('0x2a')](handleEntityNotFound(_0x2e81b8,null))['then'](saveUpdates(_0x25bd91['body'],null))['then'](respondWithResult(_0x2e81b8,null))['catch'](handleError(_0x2e81b8,null));};exports[_0x80cc('0x37')]=function(_0x500e43,_0x420a41){return db[_0x80cc('0x28')][_0x80cc('0x32')]({'where':{'id':_0x500e43[_0x80cc('0x2e')]['id']}})[_0x80cc('0x2a')](handleEntityNotFound(_0x420a41,null))[_0x80cc('0x2a')](removeEntity(_0x420a41,null))[_0x80cc('0x33')](handleError(_0x420a41,null));};exports['getConfigurations']=function(_0x4a7d72,_0x9bee31){var _0xd3f8d={};var _0x502f0e={};var _0x41dc2e;var _0x29b580;return db[_0x80cc('0x28')]['findOne']({'where':{'id':_0x4a7d72[_0x80cc('0x2e')]['id']}})['then'](handleEntityNotFound(_0x9bee31,null))['then'](function(_0x36eb51){if(_0x36eb51){_0x41dc2e=_0x36eb51;_0x502f0e[_0x80cc('0x18')]=_[_0x80cc('0x2f')](db['Dynamics365Configuration'][_0x80cc('0x14')]);_0x502f0e[_0x80cc('0x19')]=_[_0x80cc('0x2f')](_0x4a7d72['query']);_0x502f0e[_0x80cc('0x22')]=_[_0x80cc('0x1a')](_0x502f0e[_0x80cc('0x18')],_0x502f0e[_0x80cc('0x19')]);_0xd3f8d['attributes']=_[_0x80cc('0x1a')](_0x502f0e[_0x80cc('0x18')],qs['fields'](_0x4a7d72[_0x80cc('0x19')][_0x80cc('0x30')]));_0xd3f8d[_0x80cc('0x1b')]=_0xd3f8d[_0x80cc('0x1b')][_0x80cc('0x1c')]?_0xd3f8d[_0x80cc('0x1b')]:_0x502f0e['model'];_0xd3f8d['order']=qs[_0x80cc('0x20')](_0x4a7d72['query']['sort']);_0xd3f8d[_0x80cc('0x21')]=qs[_0x80cc('0x22')](_['pick'](_0x4a7d72[_0x80cc('0x19')],_0x502f0e[_0x80cc('0x22')]));if(_0x4a7d72['query'][_0x80cc('0x24')]){_0xd3f8d[_0x80cc('0x21')]=_[_0x80cc('0x25')](_0xd3f8d[_0x80cc('0x21')],{'$or':_['map'](_0xd3f8d[_0x80cc('0x1b')],function(_0x25f9a2){var _0x93e4cc={};_0x93e4cc[_0x25f9a2]={'$like':'%'+_0x4a7d72[_0x80cc('0x19')][_0x80cc('0x24')]+'%'};return _0x93e4cc;})});}_0xd3f8d=_['merge']({},_0xd3f8d,_0x4a7d72[_0x80cc('0x27')]);return _0x41dc2e['getConfigurations'](_0xd3f8d);}})['then'](function(_0x5cb605){if(_0x5cb605){_0x29b580=_0x5cb605[_0x80cc('0x1c')];if(!_0x4a7d72['query'][_0x80cc('0x1d')](_0x80cc('0x1e'))){_0xd3f8d['limit']=qs[_0x80cc('0x9')](_0x4a7d72[_0x80cc('0x19')][_0x80cc('0x9')]);_0xd3f8d[_0x80cc('0xa')]=qs[_0x80cc('0xa')](_0x4a7d72[_0x80cc('0x19')]['offset']);}return _0x41dc2e['getConfigurations'](_0xd3f8d);}})[_0x80cc('0x2a')](function(_0xf5eb3d){if(_0xf5eb3d){return _0xf5eb3d?{'count':_0x29b580,'rows':_0xf5eb3d}:null;}})['then'](respondWithResult(_0x9bee31,null))[_0x80cc('0x33')](handleError(_0x9bee31,null));};exports[_0x80cc('0x38')]=function(_0x318c36,_0x4474b6){if(_0x318c36[_0x80cc('0x36')]['id']){delete _0x318c36[_0x80cc('0x36')]['id'];}return db['Dynamics365Account'][_0x80cc('0x39')]({'where':{'id':_0x318c36[_0x80cc('0x2e')]['id']}})['then'](handleEntityNotFound(_0x4474b6,null))[_0x80cc('0x2a')](function(_0x49a08c){if(_0x49a08c){_0x318c36['body'][_0x80cc('0x3a')]=_0x49a08c['id'];_0x318c36[_0x80cc('0x36')][_0x80cc('0x3b')]=integrations['getSubjects'](_0x318c36['body'][_0x80cc('0x3c')],_0x318c36[_0x80cc('0x36')][_0x80cc('0x16')]);_0x318c36[_0x80cc('0x36')][_0x80cc('0x3d')]=integrations['getDescriptions'](_0x318c36[_0x80cc('0x36')][_0x80cc('0x3c')],_0x318c36[_0x80cc('0x36')][_0x80cc('0x16')]);return db[_0x80cc('0x3e')][_0x80cc('0x34')](_0x318c36[_0x80cc('0x36')],{'include':[{'model':db[_0x80cc('0x3f')],'as':_0x80cc('0x3b')},{'model':db['Dynamics365Field'],'as':_0x80cc('0x3d')}]});}return null;})[_0x80cc('0x2a')](respondWithResult(_0x4474b6,null))[_0x80cc('0x33')](handleError(_0x4474b6,null));};function sanitizeRemoteUri(_0x25bc9a){var _0x2d16d9=_0x25bc9a['slice'](-0x1);if(_0x2d16d9==='/')return _0x25bc9a['substring'](0x0,_0x25bc9a[_0x80cc('0x40')](_0x2d16d9));return _0x25bc9a;}function getWebApiUrl(_0x454885){return util['format'](_0x80cc('0x41'),_0x454885);}exports[_0x80cc('0x42')]=function(_0x237e40,_0x32c348){var _0x599554=_0x237e40['query'][_0x80cc('0x43')];var _0x3eb646=_0x599554===_0x80cc('0x44')?_0x80cc('0x45'):_0x80cc('0x46');var _0x4f8409='';var _0xce25d1='';var _0x11d0e8='';var _0x5543f3='';var _0x47bd86='';var _0x21a4fe='';var _0x14261e='';var _0x12d877='';var _0x4c139a=[_0x80cc('0x47'),_0x80cc('0x48'),_0x80cc('0x49'),_0x80cc('0x4a'),'caseorigincode',_0x80cc('0x4b'),'phonenumber',_0x80cc('0x4c'),_0x80cc('0x4d'),_0x80cc('0x4e')];var _0x35896e=[_0x80cc('0x4f'),_0x80cc('0x50'),_0x80cc('0x51'),_0x80cc('0x52'),_0x80cc('0x53'),_0x80cc('0x54'),_0x80cc('0x55'),_0x80cc('0x56'),_0x80cc('0x57'),_0x80cc('0x58'),_0x80cc('0x59'),_0x80cc('0x5a'),'createdon','createdonbehalfbyname',_0x80cc('0x5b'),_0x80cc('0x5c'),_0x80cc('0x5d'),_0x80cc('0x5e'),_0x80cc('0x5f'),_0x80cc('0x60'),_0x80cc('0x61'),'entityimage_url','escalatedon',_0x80cc('0x62'),'firstresponsebykpiidname',_0x80cc('0x63'),'importsequencenumber','influencescore','kbarticleidname',_0x80cc('0x64'),_0x80cc('0x65'),'modifiedbyexternalpartyname',_0x80cc('0x66'),_0x80cc('0x67'),_0x80cc('0x68'),'modifiedon','modifiedonbehalfbyname',_0x80cc('0x69'),_0x80cc('0x6a'),_0x80cc('0x6b'),_0x80cc('0x6c'),_0x80cc('0x6d'),_0x80cc('0x6e'),_0x80cc('0x6f'),'owneridtype',_0x80cc('0x70'),_0x80cc('0x71'),_0x80cc('0x72'),_0x80cc('0x73'),_0x80cc('0x74'),_0x80cc('0x75'),_0x80cc('0x76'),_0x80cc('0x77'),_0x80cc('0x78'),'responseby',_0x80cc('0x79'),_0x80cc('0x7a'),_0x80cc('0x7b'),_0x80cc('0x7c'),'slaname',_0x80cc('0x7d'),_0x80cc('0x7e'),_0x80cc('0x7f'),'subjectidname',_0x80cc('0x80'),'timezoneruleversionnumber',_0x80cc('0x81'),_0x80cc('0x82'),_0x80cc('0x83'),_0x80cc('0x84')];var _0x205693=_0x4c139a['concat'](_0x35896e);return db['Dynamics365Account'][_0x80cc('0x39')]({'where':{'id':_0x237e40[_0x80cc('0x2e')]['id']},'attributes':['id',_0x80cc('0x85'),_0x80cc('0x86'),_0x80cc('0x87'),'tenantId',_0x80cc('0x88'),_0x80cc('0x89'),_0x80cc('0x8a')],'include':[{'model':db[_0x80cc('0x8b')],'as':_0x80cc('0x8b'),'attributes':['id','data5',_0x80cc('0x8c')]}]})[_0x80cc('0x2a')](handleEntityNotFound(_0x32c348,null))[_0x80cc('0x2a')](function(_0x28320b){if(_0x28320b){if(_0x28320b[_0x80cc('0x8a')]){_0x28320b[_0x80cc('0x8d')]=_0x28320b[_0x80cc('0x8b')][_0x80cc('0x8e')];_0x12d877=sanitizeRemoteUri(_0x28320b[_0x80cc('0x8b')][_0x80cc('0x8c')]);_0x14261e=getWebApiUrl(_0x12d877);return _0x28320b;}_0x12d877=sanitizeRemoteUri(_0x28320b[_0x80cc('0x87')]);_0x14261e=getWebApiUrl(_0x12d877);var _0x40e882={'method':_0x80cc('0x8f'),'uri':_0x80cc('0x90')+_0x28320b[_0x80cc('0x91')]+_0x80cc('0x92'),'form':{'client_id':_0x28320b['clientId'],'resource':_0x12d877,'username':_0x28320b['username'],'password':_0x28320b[_0x80cc('0x86')],'grant_type':_0x80cc('0x86'),'client_secret':_0x28320b[_0x80cc('0x89')]},'json':!![]};return rp(_0x40e882);}})[_0x80cc('0x2a')](function(_0x88290c){_0x21a4fe=_0x88290c[_0x80cc('0x8d')];var _0x3f58e8={'method':_0x80cc('0x93'),'uri':encodeURI(_0x14261e+_0x80cc('0x94')+_0x3eb646+'\x27'),'headers':{'Authorization':_0x80cc('0x95')+_0x21a4fe,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3f58e8);})[_0x80cc('0x2a')](function(_0xbb816c){var _0x1ae5d2=_0xbb816c[_0x80cc('0x96')][0x0];var _0x43892e=_0x1ae5d2[_0x80cc('0x97')];var _0x124fe5={'method':_0x80cc('0x93'),'uri':_0x14261e+_0x80cc('0x98')+_0x43892e+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x21a4fe,'If-None-Match':null,'OData-Version':_0x80cc('0x99')},'json':!![]};return rp(_0x124fe5);})[_0x80cc('0x2a')](function(_0x17e9f9){_0x4f8409=_0x17e9f9;_0xce25d1=_0x4f8409[_0x80cc('0x9a')];_0xce25d1=_[_0x80cc('0x9b')](_0xce25d1,function(_0x553365){return!_0x205693[_0x80cc('0x9c')](_0x553365[_0x80cc('0x9d')]);});var _0x527120=[];var _0x3d24c4=[];_0xce25d1[_0x80cc('0x9e')](function(_0x4f8a44){if(_0x4f8a44[_0x80cc('0x9f')]){var _0x46fc49=_0x4f8a44['@odata.type'][_0x80cc('0xa0')](_0x4f8a44['@odata.type'][_0x80cc('0x40')]('.')+0x1);if(_0x46fc49===_0x80cc('0xa1')){_0x527120[_0x80cc('0xa2')](getSelectList(_0x14261e,_0x599554,_0x3d24c4,_0x4f8409[_0x80cc('0x97')],_0x4f8a44[_0x80cc('0x97')],_0x21a4fe));}}});return Promise[_0x80cc('0xa3')](_0x527120);})[_0x80cc('0x2a')](function(_0x4c9bdd){_0x11d0e8=_0x4c9bdd[0x0];var _0x423b6c=[];var _0x59c936=[];_0xce25d1[_0x80cc('0x9e')](function(_0xa5ae18){if(!_[_0x80cc('0xa4')](_0xa5ae18['@odata.type'])){var _0xc1c0e=_0xa5ae18[_0x80cc('0x9f')][_0x80cc('0xa0')](_0xa5ae18[_0x80cc('0x9f')]['lastIndexOf']('.')+0x1);if(_0xc1c0e===_0x80cc('0xa5')){_0x423b6c[_0x80cc('0xa2')](getBooleanList(_0x14261e,_0x599554,_0x59c936,_0x4f8409['MetadataId'],_0xa5ae18[_0x80cc('0x97')],_0x21a4fe));}}});return Promise[_0x80cc('0xa3')](_0x423b6c);})[_0x80cc('0x2a')](function(_0x309f89){_0x5543f3=_0x309f89[0x0];var _0xe0b812=[];var _0x4fae08=[];_0xce25d1[_0x80cc('0x9e')](function(_0x6710eb){if(_0x6710eb['@odata.type']){var _0x346232=_0x6710eb[_0x80cc('0x9f')][_0x80cc('0xa0')](_0x6710eb[_0x80cc('0x9f')]['lastIndexOf']('.')+0x1);if(_0x346232===_0x80cc('0xa6')||_0x346232===_0x80cc('0xa7')||_0x346232===_0x80cc('0xa8')||_0x346232==='IntegerAttributeMetadata'||_0x346232===_0x80cc('0xa9')||_0x346232===_0x80cc('0xaa')||_0x346232===_0x80cc('0xab')||_0x346232===_0x80cc('0xac')||_0x346232===_0x80cc('0xad')||_0x346232===_0x80cc('0xae')){_0xe0b812[_0x80cc('0xa2')](getInputList(_0x14261e,_0x599554,_0x346232,_0x4fae08,_0x4f8409[_0x80cc('0x97')],_0x6710eb[_0x80cc('0x97')],_0x21a4fe));}}});return Promise[_0x80cc('0xa3')](_0xe0b812);})['then'](function(_0x260a33){_0x47bd86=_0x260a33[0x0];var _0x32d6c0=_0x11d0e8[_0x80cc('0xaf')](_0x5543f3)[_0x80cc('0xaf')](_0x47bd86);var _0x1e6134={'count':_0x32d6c0[_0x80cc('0x1c')],'rows':_0x32d6c0};return _0x1e6134;})[_0x80cc('0x2a')](respondWithResult(_0x32c348,null))[_0x80cc('0x33')](function(_0x4749c0){var _0x12ea92=_0x237e40['query'][_0x80cc('0xb0')]?0x1f4:_0x4749c0[_0x80cc('0xb1')]||0x1f4;logger[_0x80cc('0xf')](_0x4749c0[_0x80cc('0x10')]);delete _0x4749c0[_0x80cc('0x11')];if(_0x12ea92===0x191){_0x12ea92=0x190;}_0x32c348[_0x80cc('0x6')](_0x12ea92)[_0x80cc('0xb2')](_0x237e40[_0x80cc('0x19')][_0x80cc('0xb0')]?{'message':_0x80cc('0xb3'),'statusCode':_0x4749c0[_0x80cc('0xb1')]}:_0x4749c0);});};function getSelectList(_0x274e20,_0x175724,_0x3cda95,_0x29923b,_0x25c6fc,_0x1bbd84){var _0x3905ce={'method':_0x80cc('0x93'),'uri':_0x274e20+_0x80cc('0x98')+_0x29923b+_0x80cc('0xb4')+_0x25c6fc+_0x80cc('0xb5')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x80cc('0x95')+_0x1bbd84,'If-None-Match':null,'OData-Version':_0x80cc('0x99')},'json':!![]};return rp(_0x3905ce)['then'](function(_0x52e90a){var _0x4d4282=[];var _0xc22589=_0x52e90a[_0x80cc('0xb6')]['Options'];_0xc22589['forEach'](function(_0x3c0960){_0x4d4282[_0x80cc('0xa2')]({'name':_0x3c0960[_0x80cc('0xb7')][_0x80cc('0xb8')][_0x80cc('0xb7')],'value':String(_0x3c0960['Value'])});});var _0x282c56={'id':_0x175724+'_'+_0x52e90a[_0x80cc('0x9d')],'name':_0x52e90a['DisplayName'][_0x80cc('0xb8')][_0x80cc('0xb7')],'custom':![],'options':_0x4d4282};_0x3cda95[_0x80cc('0xa2')](_0x282c56);return _0x3cda95;});}function getBooleanList(_0x1af9c9,_0x29b7d7,_0x30bce6,_0x4dafba,_0x4285d6,_0x23f33b){var _0x27a910={'method':_0x80cc('0x93'),'uri':_0x1af9c9+'EntityDefinitions('+_0x4dafba+_0x80cc('0xb4')+_0x4285d6+_0x80cc('0xb9'),'headers':{'Authorization':'Bearer\x20'+_0x23f33b,'If-None-Match':null,'OData-Version':_0x80cc('0x99')},'json':!![]};return rp(_0x27a910)[_0x80cc('0x2a')](function(_0x1307e4){var _0x3a4c57=[];_0x3a4c57[_0x80cc('0xa2')]({'name':_0x1307e4[_0x80cc('0xb6')][_0x80cc('0xba')]['Label'][_0x80cc('0xb8')][_0x80cc('0xb7')],'value':_0x80cc('0xbb')},{'name':_0x1307e4['OptionSet'][_0x80cc('0xbc')][_0x80cc('0xb7')][_0x80cc('0xb8')][_0x80cc('0xb7')],'value':_0x80cc('0xbd')});var _0x48c8c9={'id':_0x29b7d7+'_'+_0x1307e4[_0x80cc('0x9d')],'name':_0x1307e4['DisplayName'][_0x80cc('0xb8')][_0x80cc('0xb7')],'custom':![],'options':_0x3a4c57};_0x30bce6['push'](_0x48c8c9);return _0x30bce6;});}function getInputList(_0x493ab0,_0x57f90c,_0x17884b,_0x26cdc4,_0x5887b9,_0x3db1c9,_0x4b9fb2){var _0x4ec6cc={'method':_0x80cc('0x93'),'uri':_0x493ab0+_0x80cc('0x98')+_0x5887b9+_0x80cc('0xb4')+_0x3db1c9+_0x80cc('0xbe')+_0x17884b+_0x80cc('0xbf'),'headers':{'Authorization':_0x80cc('0x95')+_0x4b9fb2,'If-None-Match':null,'OData-Version':_0x80cc('0x99')},'json':!![]};return rp(_0x4ec6cc)[_0x80cc('0x2a')](function(_0x536069){var _0x3181a6={'id':_0x57f90c+'_'+_0x536069[_0x80cc('0x9d')],'name':_0x536069['DisplayName'][_0x80cc('0xb8')]?_0x536069[_0x80cc('0xc0')][_0x80cc('0xb8')][_0x80cc('0xb7')]:_0x536069['LogicalName'],'custom':![],'options':[]};_0x26cdc4['push'](_0x3181a6);return _0x26cdc4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 8090aff..5950bf2 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e3ebc,_0x19a1c9){var _0x2f6d1c=function(_0x3c385d){while(--_0x3c385d){_0x5e3ebc['push'](_0x5e3ebc['shift']());}};_0x2f6d1c(++_0x19a1c9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x5a2955,_0x546b5b){var _0x198416=function(_0x20c1bb){while(--_0x20c1bb){_0x5a2955['push'](_0x5a2955['shift']());}};_0x198416(++_0x546b5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index bf651d0..c44dcd8 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 _0x5be4=['../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','findAll','options','where','attributes','limit','include','model','map','ShowDynamics365Account','Dynamics365Account','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5d7aea,_0xf498b9){var _0x3f61c8=function(_0x937752){while(--_0x937752){_0x5d7aea['push'](_0x5d7aea['shift']());}};_0x3f61c8(++_0xf498b9);}(_0x5be4,0x89));var _0x45be=function(_0x4698ba,_0x670575){_0x4698ba=_0x4698ba-0x0;var _0x8e42f6=_0x5be4[_0x4698ba];return _0x8e42f6;};'use strict';var _=require(_0x45be('0x0'));var util=require(_0x45be('0x1'));var moment=require(_0x45be('0x2'));var BPromise=require(_0x45be('0x3'));var rs=require(_0x45be('0x4'));var fs=require('fs');var Redis=require(_0x45be('0x5'));var db=require(_0x45be('0x6'))['db'];var utils=require(_0x45be('0x7'));var logger=require('../../config/logger')(_0x45be('0x8'));var config=require(_0x45be('0x9'));var jayson=require(_0x45be('0xa'));var client=jayson[_0x45be('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36e34e,_0x39e0dd,_0x230858){return new BPromise(function(_0x821cc3,_0x2b8ab4){return client['request'](_0x36e34e,_0x230858)[_0x45be('0xc')](function(_0x22c6f9){logger[_0x45be('0xd')](_0x45be('0xe'),_0x39e0dd,_0x45be('0xf'));logger[_0x45be('0x10')](_0x45be('0x11'),_0x39e0dd,_0x45be('0xf'),JSON[_0x45be('0x12')](_0x22c6f9));if(_0x22c6f9[_0x45be('0x13')]){if(_0x22c6f9['error'][_0x45be('0x14')]===0x1f4){logger[_0x45be('0x13')](_0x45be('0xe'),_0x39e0dd,_0x22c6f9['error'][_0x45be('0x15')]);return _0x2b8ab4(_0x22c6f9['error'][_0x45be('0x15')]);}logger[_0x45be('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x39e0dd,_0x22c6f9[_0x45be('0x13')][_0x45be('0x15')]);return _0x821cc3(_0x22c6f9['error'][_0x45be('0x15')]);}else{logger[_0x45be('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x39e0dd,_0x45be('0xf'));_0x821cc3(_0x22c6f9[_0x45be('0x16')][_0x45be('0x15')]);}})[_0x45be('0x17')](function(_0x37cc90){logger[_0x45be('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x39e0dd,_0x37cc90);_0x2b8ab4(_0x37cc90);});});}exports[_0x45be('0x18')]=function(_0xe3b527){var _0x579dfd=this;return new Promise(function(_0x274128,_0x478166){return db['Dynamics365Account'][_0x45be('0x19')]({'raw':_0xe3b527[_0x45be('0x1a')]?_0xe3b527[_0x45be('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xe3b527[_0x45be('0x1a')]?_0xe3b527[_0x45be('0x1a')][_0x45be('0x1b')]||null:null,'attributes':_0xe3b527[_0x45be('0x1a')]?_0xe3b527[_0x45be('0x1a')][_0x45be('0x1c')]||null:null,'limit':_0xe3b527[_0x45be('0x1a')]?_0xe3b527[_0x45be('0x1a')][_0x45be('0x1d')]||null:null,'include':_0xe3b527[_0x45be('0x1a')]?_0xe3b527[_0x45be('0x1a')][_0x45be('0x1e')]?_['map'](_0xe3b527[_0x45be('0x1a')][_0x45be('0x1e')],function(_0x2e1634){return{'model':db[_0x2e1634[_0x45be('0x1f')]],'as':_0x2e1634['as'],'attributes':_0x2e1634[_0x45be('0x1c')],'include':_0x2e1634['include']?_[_0x45be('0x20')](_0x2e1634[_0x45be('0x1e')],function(_0x473e03){return{'model':db[_0x473e03[_0x45be('0x1f')]],'as':_0x473e03['as'],'attributes':_0x473e03[_0x45be('0x1c')],'include':_0x473e03['include']?_['map'](_0x473e03[_0x45be('0x1e')],function(_0x20a704){return{'model':db[_0x20a704[_0x45be('0x1f')]],'as':_0x20a704['as'],'attributes':_0x20a704[_0x45be('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e6738){logger[_0x45be('0xd')](_0x45be('0x18'),_0xe3b527);logger[_0x45be('0x10')](_0x45be('0x18'),_0xe3b527,JSON['stringify'](_0x1e6738));_0x274128(_0x1e6738);})[_0x45be('0x17')](function(_0x145d86){logger[_0x45be('0x13')]('GetDynamics365Account',_0x145d86[_0x45be('0x15')],_0xe3b527);_0x478166(_0x579dfd['error'](0x1f4,_0x145d86[_0x45be('0x15')]));});});};exports[_0x45be('0x21')]=function(_0x58d1db){var _0x3e2edf=this;return new Promise(function(_0xd16873,_0x3aadf6){return db[_0x45be('0x22')]['find']({'raw':_0x58d1db[_0x45be('0x1a')]?_0x58d1db['options'][_0x45be('0x23')]===undefined?!![]:![]:!![],'where':_0x58d1db[_0x45be('0x1a')]?_0x58d1db[_0x45be('0x1a')][_0x45be('0x1b')]||null:null,'attributes':_0x58d1db[_0x45be('0x1a')]?_0x58d1db[_0x45be('0x1a')][_0x45be('0x1c')]||null:null,'include':_0x58d1db[_0x45be('0x1a')]?_0x58d1db['options'][_0x45be('0x1e')]?_[_0x45be('0x20')](_0x58d1db['options'][_0x45be('0x1e')],function(_0x44a106){return{'model':db[_0x44a106[_0x45be('0x1f')]],'as':_0x44a106['as'],'attributes':_0x44a106['attributes'],'include':_0x44a106['include']?_[_0x45be('0x20')](_0x44a106[_0x45be('0x1e')],function(_0x95188c){return{'model':db[_0x95188c[_0x45be('0x1f')]],'as':_0x95188c['as'],'attributes':_0x95188c[_0x45be('0x1c')],'include':_0x95188c[_0x45be('0x1e')]?_[_0x45be('0x20')](_0x95188c['include'],function(_0x29460b){return{'model':db[_0x29460b[_0x45be('0x1f')]],'as':_0x29460b['as'],'attributes':_0x29460b[_0x45be('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x45be('0xc')](function(_0x569284){logger['info']('ShowDynamics365Account',_0x58d1db);logger['debug'](_0x45be('0x21'),_0x58d1db,JSON['stringify'](_0x569284));_0xd16873(_0x569284);})[_0x45be('0x17')](function(_0x5e88ac){logger[_0x45be('0x13')](_0x45be('0x21'),_0x5e88ac[_0x45be('0x15')],_0x58d1db);_0x3aadf6(_0x3e2edf[_0x45be('0x13')](0x1f4,_0x5e88ac[_0x45be('0x15')]));});});}; \ No newline at end of file +var _0x79b5=['info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Dynamics365Account','options','raw','where','limit','include','map','model','attributes','GetDynamics365Account','catch','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x79b5,0x9f));var _0x579b=function(_0x110321,_0x32c3cc){_0x110321=_0x110321-0x0;var _0x33afe5=_0x79b5[_0x110321];return _0x33afe5;};'use strict';var _=require(_0x579b('0x0'));var util=require(_0x579b('0x1'));var moment=require(_0x579b('0x2'));var BPromise=require(_0x579b('0x3'));var rs=require(_0x579b('0x4'));var fs=require('fs');var Redis=require(_0x579b('0x5'));var db=require(_0x579b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x579b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x579b('0x8'));var client=jayson[_0x579b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32fe62,_0x224299,_0xe57094){return new BPromise(function(_0x135afe,_0x10b020){return client[_0x579b('0xa')](_0x32fe62,_0xe57094)['then'](function(_0x1a0e50){logger[_0x579b('0xb')](_0x579b('0xc'),_0x224299,_0x579b('0xd'));logger[_0x579b('0xe')](_0x579b('0xf'),_0x224299,_0x579b('0xd'),JSON[_0x579b('0x10')](_0x1a0e50));if(_0x1a0e50['error']){if(_0x1a0e50[_0x579b('0x11')][_0x579b('0x12')]===0x1f4){logger[_0x579b('0x11')](_0x579b('0xc'),_0x224299,_0x1a0e50[_0x579b('0x11')]['message']);return _0x10b020(_0x1a0e50[_0x579b('0x11')][_0x579b('0x13')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x224299,_0x1a0e50[_0x579b('0x11')][_0x579b('0x13')]);return _0x135afe(_0x1a0e50[_0x579b('0x11')][_0x579b('0x13')]);}else{logger['info'](_0x579b('0xc'),_0x224299,_0x579b('0xd'));_0x135afe(_0x1a0e50[_0x579b('0x14')][_0x579b('0x13')]);}})['catch'](function(_0x4696e8){logger[_0x579b('0x11')](_0x579b('0xc'),_0x224299,_0x4696e8);_0x10b020(_0x4696e8);});});}exports['GetDynamics365Account']=function(_0x3adb24){var _0x30eea8=this;return new Promise(function(_0x13b1a5,_0x3cea75){return db[_0x579b('0x15')]['findAll']({'raw':_0x3adb24[_0x579b('0x16')]?_0x3adb24[_0x579b('0x16')][_0x579b('0x17')]===undefined?!![]:![]:!![],'where':_0x3adb24[_0x579b('0x16')]?_0x3adb24[_0x579b('0x16')][_0x579b('0x18')]||null:null,'attributes':_0x3adb24[_0x579b('0x16')]?_0x3adb24['options']['attributes']||null:null,'limit':_0x3adb24[_0x579b('0x16')]?_0x3adb24[_0x579b('0x16')][_0x579b('0x19')]||null:null,'include':_0x3adb24[_0x579b('0x16')]?_0x3adb24[_0x579b('0x16')][_0x579b('0x1a')]?_[_0x579b('0x1b')](_0x3adb24['options']['include'],function(_0x448eea){return{'model':db[_0x448eea[_0x579b('0x1c')]],'as':_0x448eea['as'],'attributes':_0x448eea[_0x579b('0x1d')],'include':_0x448eea[_0x579b('0x1a')]?_[_0x579b('0x1b')](_0x448eea[_0x579b('0x1a')],function(_0x526de3){return{'model':db[_0x526de3[_0x579b('0x1c')]],'as':_0x526de3['as'],'attributes':_0x526de3[_0x579b('0x1d')],'include':_0x526de3[_0x579b('0x1a')]?_[_0x579b('0x1b')](_0x526de3[_0x579b('0x1a')],function(_0x308104){return{'model':db[_0x308104[_0x579b('0x1c')]],'as':_0x308104['as'],'attributes':_0x308104[_0x579b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xae2112){logger[_0x579b('0xb')](_0x579b('0x1e'),_0x3adb24);logger[_0x579b('0xe')](_0x579b('0x1e'),_0x3adb24,JSON['stringify'](_0xae2112));_0x13b1a5(_0xae2112);})[_0x579b('0x1f')](function(_0xcf10e){logger[_0x579b('0x11')](_0x579b('0x1e'),_0xcf10e['message'],_0x3adb24);_0x3cea75(_0x30eea8[_0x579b('0x11')](0x1f4,_0xcf10e[_0x579b('0x13')]));});});};exports[_0x579b('0x20')]=function(_0x95cd31){var _0x1e79b4=this;return new Promise(function(_0x422c88,_0x1931b9){return db[_0x579b('0x15')][_0x579b('0x21')]({'raw':_0x95cd31['options']?_0x95cd31['options']['raw']===undefined?!![]:![]:!![],'where':_0x95cd31['options']?_0x95cd31[_0x579b('0x16')]['where']||null:null,'attributes':_0x95cd31[_0x579b('0x16')]?_0x95cd31[_0x579b('0x16')][_0x579b('0x1d')]||null:null,'include':_0x95cd31[_0x579b('0x16')]?_0x95cd31[_0x579b('0x16')][_0x579b('0x1a')]?_[_0x579b('0x1b')](_0x95cd31['options'][_0x579b('0x1a')],function(_0x4fdc9e){return{'model':db[_0x4fdc9e[_0x579b('0x1c')]],'as':_0x4fdc9e['as'],'attributes':_0x4fdc9e['attributes'],'include':_0x4fdc9e['include']?_[_0x579b('0x1b')](_0x4fdc9e['include'],function(_0x18267b){return{'model':db[_0x18267b[_0x579b('0x1c')]],'as':_0x18267b['as'],'attributes':_0x18267b[_0x579b('0x1d')],'include':_0x18267b['include']?_[_0x579b('0x1b')](_0x18267b[_0x579b('0x1a')],function(_0x1a8ce0){return{'model':db[_0x1a8ce0['model']],'as':_0x1a8ce0['as'],'attributes':_0x1a8ce0[_0x579b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x184902){logger[_0x579b('0xb')]('ShowDynamics365Account',_0x95cd31);logger['debug'](_0x579b('0x20'),_0x95cd31,JSON[_0x579b('0x10')](_0x184902));_0x422c88(_0x184902);})[_0x579b('0x1f')](function(_0x3f8ec2){logger[_0x579b('0x11')]('ShowDynamics365Account',_0x3f8ec2[_0x579b('0x13')],_0x95cd31);_0x1931b9(_0x1e79b4[_0x579b('0x11')](0x1f4,_0x3f8ec2[_0x579b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index fb52e30..541fdea 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 _0x95c3=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id'];(function(_0x49fb86,_0xe7dcd9){var _0x535b41=function(_0x574546){while(--_0x574546){_0x49fb86['push'](_0x49fb86['shift']());}};_0x535b41(++_0xe7dcd9);}(_0x95c3,0x6d));var _0x395c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x95c3[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x395c('0x0'));var timeout=require(_0x395c('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x395c('0x2'));var auth=require(_0x395c('0x3'));var interaction=require(_0x395c('0x4'));var config=require(_0x395c('0x5'));var controller=require(_0x395c('0x6'));router['get']('/',auth[_0x395c('0x7')](),controller[_0x395c('0x8')]);router[_0x395c('0x9')](_0x395c('0xa'),auth[_0x395c('0x7')](),controller[_0x395c('0xb')]);router[_0x395c('0x9')](_0x395c('0xc'),auth[_0x395c('0x7')](),controller[_0x395c('0xd')]);router[_0x395c('0x9')](_0x395c('0xe'),auth['isAuthenticated'](),controller[_0x395c('0xf')]);router[_0x395c('0x9')](_0x395c('0x10'),auth[_0x395c('0x7')](),controller['getDescriptions']);router[_0x395c('0x11')]('/',auth[_0x395c('0x7')](),controller['create']);router[_0x395c('0x12')](_0x395c('0xa'),auth[_0x395c('0x7')](),controller[_0x395c('0x13')]);router['delete'](_0x395c('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb98d=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1a7621,_0x46e4eb){var _0xff507a=function(_0x3dfc4c){while(--_0x3dfc4c){_0x1a7621['push'](_0x1a7621['shift']());}};_0xff507a(++_0x46e4eb);}(_0xb98d,0x19d));var _0xdb98=function(_0x262378,_0x5a55c7){_0x262378=_0x262378-0x0;var _0x46a67d=_0xb98d[_0x262378];return _0x46a67d;};'use strict';var multer=require(_0xdb98('0x0'));var util=require(_0xdb98('0x1'));var path=require(_0xdb98('0x2'));var timeout=require(_0xdb98('0x3'));var express=require(_0xdb98('0x4'));var router=express[_0xdb98('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdb98('0x6'));var config=require(_0xdb98('0x7'));var controller=require(_0xdb98('0x8'));router[_0xdb98('0x9')]('/',auth['isAuthenticated'](),controller[_0xdb98('0xa')]);router['get'](_0xdb98('0xb'),auth['isAuthenticated'](),controller[_0xdb98('0xc')]);router[_0xdb98('0x9')](_0xdb98('0xd'),auth[_0xdb98('0xe')](),controller[_0xdb98('0xf')]);router[_0xdb98('0x9')](_0xdb98('0x10'),auth[_0xdb98('0xe')](),controller['getSubjects']);router[_0xdb98('0x9')](_0xdb98('0x11'),auth['isAuthenticated'](),controller[_0xdb98('0x12')]);router[_0xdb98('0x13')]('/',auth[_0xdb98('0xe')](),controller[_0xdb98('0x14')]);router[_0xdb98('0x15')](_0xdb98('0xb'),auth[_0xdb98('0xe')](),controller[_0xdb98('0x16')]);router[_0xdb98('0x17')](_0xdb98('0xb'),auth[_0xdb98('0xe')](),controller[_0xdb98('0x18')]);module[_0xdb98('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index c4fae4c..354d66b 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 _0x20ac=['BOOLEAN','sequelize','STRING','ENUM','incident','phonecall','contact'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x20ac,0x1d6));var _0xc20a=function(_0x473463,_0x21da73){_0x473463=_0x473463-0x0;var _0x42f406=_0x20ac[_0x473463];return _0x42f406;};'use strict';var Sequelize=require(_0xc20a('0x0'));module['exports']={'name':{'type':Sequelize[_0xc20a('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xc20a('0x2')](_0xc20a('0x3'),_0xc20a('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xc20a('0x2')](_0xc20a('0x5'),'nothing'),'defaultValue':_0xc20a('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xc20a('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xc20a('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0cf3=['ENUM','nothing','contact','exports','STRING','phonecall','incident'];(function(_0x44fd3b,_0x114ec3){var _0x303ff7=function(_0x2bdca8){while(--_0x2bdca8){_0x44fd3b['push'](_0x44fd3b['shift']());}};_0x303ff7(++_0x114ec3);}(_0x0cf3,0xb2));var _0x30cf=function(_0x1b3b4d,_0x584bcc){_0x1b3b4d=_0x1b3b4d-0x0;var _0x598945=_0x0cf3[_0x1b3b4d];return _0x598945;};'use strict';var Sequelize=require('sequelize');module[_0x30cf('0x0')]={'name':{'type':Sequelize[_0x30cf('0x1')]},'description':{'type':Sequelize[_0x30cf('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x30cf('0x2')),'defaultValue':_0x30cf('0x3')},'moduleCreate':{'type':Sequelize[_0x30cf('0x4')]('contact',_0x30cf('0x5')),'defaultValue':_0x30cf('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x30cf('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 301ee61..f1a4100 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 _0x5d10=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','getFields','getSubjects','findOne','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x56d29f,_0x5edfbc){var _0x30aff8=function(_0xdea053){while(--_0xdea053){_0x56d29f['push'](_0x56d29f['shift']());}};_0x30aff8(++_0x5edfbc);}(_0x5d10,0x99));var _0x05d1=function(_0x2343b2,_0x375387){_0x2343b2=_0x2343b2-0x0;var _0x4d843d=_0x5d10[_0x2343b2];return _0x4d843d;};'use strict';var emlformat=require(_0x05d1('0x0'));var rimraf=require(_0x05d1('0x1'));var zipdir=require(_0x05d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05d1('0x3'));var moment=require('moment');var BPromise=require(_0x05d1('0x4'));var Mustache=require(_0x05d1('0x5'));var util=require(_0x05d1('0x6'));var path=require(_0x05d1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x05d1('0x8'));var fs=require('fs');var fs_extra=require(_0x05d1('0x9'));var _=require(_0x05d1('0xa'));var squel=require(_0x05d1('0xb'));var crypto=require(_0x05d1('0xc'));var jsforce=require(_0x05d1('0xd'));var deskjs=require(_0x05d1('0xe'));var toCsv=require(_0x05d1('0xf'));var querystring=require(_0x05d1('0x10'));var Papa=require(_0x05d1('0x11'));var Redis=require(_0x05d1('0x12'));var authService=require(_0x05d1('0x13'));var qs=require(_0x05d1('0x14'));var as=require(_0x05d1('0x15'));var hardwareService=require(_0x05d1('0x16'));var logger=require(_0x05d1('0x17'))(_0x05d1('0x18'));var utils=require(_0x05d1('0x19'));var config=require(_0x05d1('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x05d1('0x1b'))['db'];function respondWithStatusCode(_0x5942c8,_0xeb0ca5){_0xeb0ca5=_0xeb0ca5||0xcc;return function(_0x1ac25c){if(_0x1ac25c){return _0x5942c8[_0x05d1('0x1c')](_0xeb0ca5);}return _0x5942c8['status'](_0xeb0ca5)[_0x05d1('0x1d')]();};}function respondWithResult(_0x372525,_0x175d31){_0x175d31=_0x175d31||0xc8;return function(_0x2bb324){if(_0x2bb324){return _0x372525[_0x05d1('0x1e')](_0x175d31)[_0x05d1('0x1f')](_0x2bb324);}};}function respondWithFilteredResult(_0x404f8b,_0x8ebff6){return function(_0x103217){if(_0x103217){var _0x1286a4=typeof _0x8ebff6[_0x05d1('0x20')]===_0x05d1('0x21')&&typeof _0x8ebff6[_0x05d1('0x22')]===_0x05d1('0x21');var _0x3a3e8b=_0x103217[_0x05d1('0x23')];var _0x22a1a1=_0x1286a4?0x0:_0x8ebff6[_0x05d1('0x20')];var _0x4e8e08=_0x1286a4?_0x103217[_0x05d1('0x23')]:_0x8ebff6[_0x05d1('0x20')]+_0x8ebff6[_0x05d1('0x22')];var _0x5423f6;if(_0x4e8e08>=_0x3a3e8b){_0x4e8e08=_0x3a3e8b;_0x5423f6=0xc8;}else{_0x5423f6=0xce;}_0x404f8b[_0x05d1('0x1e')](_0x5423f6);return _0x404f8b['set']('Content-Range',_0x22a1a1+'-'+_0x4e8e08+'/'+_0x3a3e8b)[_0x05d1('0x1f')](_0x103217);}return null;};}function patchUpdates(_0x3fb6cf){return function(_0x18696f){try{jsonpatch[_0x05d1('0x24')](_0x18696f,_0x3fb6cf,!![]);}catch(_0x27e75f){return BPromise[_0x05d1('0x25')](_0x27e75f);}return _0x18696f[_0x05d1('0x26')]();};}function saveUpdates(_0x44623b,_0x21dcff){return function(_0x4f9f7e){if(_0x4f9f7e){return _0x4f9f7e[_0x05d1('0x27')](_0x44623b)[_0x05d1('0x28')](function(_0x56f274){return _0x56f274;});}return null;};}function removeEntity(_0xdd6702,_0x2fbf94){return function(_0x245507){if(_0x245507){return _0x245507[_0x05d1('0x29')]()[_0x05d1('0x28')](function(){_0xdd6702[_0x05d1('0x1e')](0xcc)[_0x05d1('0x1d')]();});}};}function handleEntityNotFound(_0x13a3c7,_0x3f96d6){return function(_0x55a413){if(!_0x55a413){_0x13a3c7[_0x05d1('0x1c')](0x194);}return _0x55a413;};}function handleError(_0x4a4698,_0x5b4203){_0x5b4203=_0x5b4203||0x1f4;return function(_0x637aea){logger[_0x05d1('0x2a')](_0x637aea[_0x05d1('0x2b')]);if(_0x637aea[_0x05d1('0x2c')]){delete _0x637aea[_0x05d1('0x2c')];}_0x4a4698['status'](_0x5b4203)[_0x05d1('0x2d')](_0x637aea);};}exports[_0x05d1('0x2e')]=function(_0x1c4f77,_0x44a942){var _0x5157a6={},_0xbc7b78={},_0x5c1ed1={'count':0x0,'rows':[]};var _0x4ba3ad=_[_0x05d1('0x2f')](db['Dynamics365Configuration']['rawAttributes'],function(_0x232d65){return{'name':_0x232d65[_0x05d1('0x30')],'type':_0x232d65[_0x05d1('0x31')]['key']};});_0xbc7b78[_0x05d1('0x32')]=_[_0x05d1('0x2f')](_0x4ba3ad,'name');_0xbc7b78[_0x05d1('0x33')]=_[_0x05d1('0x34')](_0x1c4f77[_0x05d1('0x33')]);_0xbc7b78[_0x05d1('0x35')]=_[_0x05d1('0x36')](_0xbc7b78['model'],_0xbc7b78['query']);_0x5157a6[_0x05d1('0x37')]=_[_0x05d1('0x36')](_0xbc7b78['model'],qs['fields'](_0x1c4f77[_0x05d1('0x33')][_0x05d1('0x38')]));_0x5157a6[_0x05d1('0x37')]=_0x5157a6[_0x05d1('0x37')]['length']?_0x5157a6[_0x05d1('0x37')]:_0xbc7b78[_0x05d1('0x32')];if(!_0x1c4f77[_0x05d1('0x33')][_0x05d1('0x39')](_0x05d1('0x3a'))){_0x5157a6[_0x05d1('0x22')]=qs[_0x05d1('0x22')](_0x1c4f77[_0x05d1('0x33')][_0x05d1('0x22')]);_0x5157a6[_0x05d1('0x20')]=qs[_0x05d1('0x20')](_0x1c4f77[_0x05d1('0x33')][_0x05d1('0x20')]);}_0x5157a6[_0x05d1('0x3b')]=qs['sort'](_0x1c4f77[_0x05d1('0x33')][_0x05d1('0x3c')]);_0x5157a6[_0x05d1('0x3d')]=qs[_0x05d1('0x35')](_[_0x05d1('0x3e')](_0x1c4f77[_0x05d1('0x33')],_0xbc7b78['filters']),_0x4ba3ad);if(_0x1c4f77['query'][_0x05d1('0x3f')]){_0x5157a6['where']=_[_0x05d1('0x40')](_0x5157a6[_0x05d1('0x3d')],{'$or':_[_0x05d1('0x2f')](_0x4ba3ad,function(_0x339360){if(_0x339360[_0x05d1('0x31')]!==_0x05d1('0x41')){var _0x4e549d={};_0x4e549d[_0x339360[_0x05d1('0x2c')]]={'$like':'%'+_0x1c4f77[_0x05d1('0x33')][_0x05d1('0x3f')]+'%'};return _0x4e549d;}})});}_0x5157a6=_[_0x05d1('0x40')]({},_0x5157a6,_0x1c4f77[_0x05d1('0x42')]);var _0x255db3={'where':_0x5157a6[_0x05d1('0x3d')]};return db[_0x05d1('0x43')][_0x05d1('0x23')](_0x255db3)[_0x05d1('0x28')](function(_0x1e94d8){_0x5c1ed1[_0x05d1('0x23')]=_0x1e94d8;if(_0x1c4f77[_0x05d1('0x33')][_0x05d1('0x44')]){_0x5157a6[_0x05d1('0x45')]=[{'all':!![]}];}return db[_0x05d1('0x43')]['findAll'](_0x5157a6);})[_0x05d1('0x28')](function(_0x27f98f){_0x5c1ed1[_0x05d1('0x46')]=_0x27f98f;return _0x5c1ed1;})[_0x05d1('0x28')](respondWithFilteredResult(_0x44a942,_0x5157a6))[_0x05d1('0x47')](handleError(_0x44a942,null));};exports[_0x05d1('0x48')]=function(_0x2d2a01,_0x2bad82){var _0xf5404a={'raw':![],'where':{'id':_0x2d2a01[_0x05d1('0x49')]['id']}},_0x5b220f={};_0x5b220f[_0x05d1('0x32')]=_['keys'](db[_0x05d1('0x43')][_0x05d1('0x4a')]);_0x5b220f[_0x05d1('0x33')]=_[_0x05d1('0x34')](_0x2d2a01[_0x05d1('0x33')]);_0x5b220f[_0x05d1('0x35')]=_[_0x05d1('0x36')](_0x5b220f['model'],_0x5b220f[_0x05d1('0x33')]);_0xf5404a[_0x05d1('0x37')]=_[_0x05d1('0x36')](_0x5b220f['model'],qs['fields'](_0x2d2a01[_0x05d1('0x33')][_0x05d1('0x38')]));_0xf5404a[_0x05d1('0x37')]=_0xf5404a[_0x05d1('0x37')][_0x05d1('0x4b')]?_0xf5404a[_0x05d1('0x37')]:_0x5b220f['model'];if(_0x2d2a01['query'][_0x05d1('0x44')]){_0xf5404a[_0x05d1('0x45')]=[{'all':!![]}];}_0xf5404a=_[_0x05d1('0x40')]({},_0xf5404a,_0x2d2a01[_0x05d1('0x42')]);return db[_0x05d1('0x43')][_0x05d1('0x4c')](_0xf5404a)[_0x05d1('0x28')](handleEntityNotFound(_0x2bad82,null))[_0x05d1('0x28')](respondWithResult(_0x2bad82,null))['catch'](handleError(_0x2bad82,null));};exports[_0x05d1('0x4d')]=function(_0x29a0d4,_0x40d593){return db[_0x05d1('0x43')]['create'](_0x29a0d4[_0x05d1('0x4e')],{})['then'](respondWithResult(_0x40d593,0xc9))['catch'](handleError(_0x40d593,null));};exports[_0x05d1('0x27')]=function(_0x43882a,_0x551bd7){if(_0x43882a['body']['id']){delete _0x43882a['body']['id'];}return db[_0x05d1('0x43')]['find']({'where':{'id':_0x43882a['params']['id']}})[_0x05d1('0x28')](handleEntityNotFound(_0x551bd7,null))[_0x05d1('0x28')](saveUpdates(_0x43882a[_0x05d1('0x4e')],null))[_0x05d1('0x28')](respondWithResult(_0x551bd7,null))[_0x05d1('0x47')](handleError(_0x551bd7,null));};exports[_0x05d1('0x29')]=function(_0x4a4f01,_0x38af8b){return db[_0x05d1('0x43')][_0x05d1('0x4c')]({'where':{'id':_0x4a4f01[_0x05d1('0x49')]['id']}})[_0x05d1('0x28')](handleEntityNotFound(_0x38af8b,null))[_0x05d1('0x28')](removeEntity(_0x38af8b,null))[_0x05d1('0x47')](handleError(_0x38af8b,null));};exports[_0x05d1('0x4f')]=function(_0x2334ab,_0x259143,_0x7c4a54){var _0x5613ab={};var _0x215d93={};var _0x5d1696;var _0xa8f493;return db[_0x05d1('0x43')]['findOne']({'where':{'id':_0x2334ab[_0x05d1('0x49')]['id']}})[_0x05d1('0x28')](handleEntityNotFound(_0x259143,null))['then'](function(_0x280b7c){if(_0x280b7c){_0x5d1696=_0x280b7c;_0x215d93[_0x05d1('0x32')]=_[_0x05d1('0x34')](db['Dynamics365Field'][_0x05d1('0x4a')]);_0x215d93[_0x05d1('0x33')]=_['keys'](_0x2334ab[_0x05d1('0x33')]);_0x215d93['filters']=_['intersection'](_0x215d93[_0x05d1('0x32')],_0x215d93['query']);_0x5613ab[_0x05d1('0x37')]=_[_0x05d1('0x36')](_0x215d93[_0x05d1('0x32')],qs['fields'](_0x2334ab[_0x05d1('0x33')][_0x05d1('0x38')]));_0x5613ab[_0x05d1('0x37')]=_0x5613ab['attributes'][_0x05d1('0x4b')]?_0x5613ab[_0x05d1('0x37')]:_0x215d93[_0x05d1('0x32')];_0x5613ab[_0x05d1('0x3b')]=qs[_0x05d1('0x3c')](_0x2334ab[_0x05d1('0x33')][_0x05d1('0x3c')]);_0x5613ab['where']=qs['filters'](_[_0x05d1('0x3e')](_0x2334ab[_0x05d1('0x33')],_0x215d93[_0x05d1('0x35')]));if(_0x2334ab[_0x05d1('0x33')]['filter']){_0x5613ab[_0x05d1('0x3d')]=_['merge'](_0x5613ab[_0x05d1('0x3d')],{'$or':_['map'](_0x5613ab[_0x05d1('0x37')],function(_0x5174b6){var _0x1431c9={};_0x1431c9[_0x5174b6]={'$like':'%'+_0x2334ab[_0x05d1('0x33')][_0x05d1('0x3f')]+'%'};return _0x1431c9;})});}_0x5613ab=_[_0x05d1('0x40')]({},_0x5613ab,_0x2334ab[_0x05d1('0x42')]);return _0x5d1696[_0x05d1('0x4f')](_0x5613ab);}})[_0x05d1('0x28')](function(_0x297a73){if(_0x297a73){_0xa8f493=_0x297a73[_0x05d1('0x4b')];if(!_0x2334ab['query'][_0x05d1('0x39')](_0x05d1('0x3a'))){_0x5613ab[_0x05d1('0x22')]=qs[_0x05d1('0x22')](_0x2334ab['query']['limit']);_0x5613ab[_0x05d1('0x20')]=qs[_0x05d1('0x20')](_0x2334ab['query'][_0x05d1('0x20')]);}return _0x5d1696[_0x05d1('0x4f')](_0x5613ab);}})[_0x05d1('0x28')](function(_0x23e206){if(_0x23e206){return _0x23e206?{'count':_0xa8f493,'rows':_0x23e206}:null;}})[_0x05d1('0x28')](respondWithResult(_0x259143,null))[_0x05d1('0x47')](handleError(_0x259143,null));};exports[_0x05d1('0x50')]=function(_0x366e80,_0x220fed,_0x290c15){var _0x34d7f8={};var _0x3cd2df={};var _0x23c699;var _0x147961;return db['Dynamics365Configuration'][_0x05d1('0x51')]({'where':{'id':_0x366e80[_0x05d1('0x49')]['id']}})[_0x05d1('0x28')](handleEntityNotFound(_0x220fed,null))['then'](function(_0x2e7703){if(_0x2e7703){_0x23c699=_0x2e7703;_0x3cd2df[_0x05d1('0x32')]=_['keys'](db[_0x05d1('0x52')][_0x05d1('0x4a')]);_0x3cd2df[_0x05d1('0x33')]=_['keys'](_0x366e80[_0x05d1('0x33')]);_0x3cd2df['filters']=_['intersection'](_0x3cd2df[_0x05d1('0x32')],_0x3cd2df[_0x05d1('0x33')]);_0x34d7f8[_0x05d1('0x37')]=_[_0x05d1('0x36')](_0x3cd2df['model'],qs[_0x05d1('0x38')](_0x366e80['query'][_0x05d1('0x38')]));_0x34d7f8[_0x05d1('0x37')]=_0x34d7f8[_0x05d1('0x37')][_0x05d1('0x4b')]?_0x34d7f8[_0x05d1('0x37')]:_0x3cd2df[_0x05d1('0x32')];_0x34d7f8[_0x05d1('0x3b')]=qs['sort'](_0x366e80['query']['sort']);_0x34d7f8['where']=qs['filters'](_[_0x05d1('0x3e')](_0x366e80[_0x05d1('0x33')],_0x3cd2df[_0x05d1('0x35')]));if(_0x366e80[_0x05d1('0x33')][_0x05d1('0x3f')]){_0x34d7f8['where']=_[_0x05d1('0x40')](_0x34d7f8['where'],{'$or':_[_0x05d1('0x2f')](_0x34d7f8[_0x05d1('0x37')],function(_0x4513ac){var _0x26177f={};_0x26177f[_0x4513ac]={'$like':'%'+_0x366e80[_0x05d1('0x33')][_0x05d1('0x3f')]+'%'};return _0x26177f;})});}_0x34d7f8=_['merge']({},_0x34d7f8,_0x366e80[_0x05d1('0x42')]);return _0x23c699[_0x05d1('0x50')](_0x34d7f8);}})[_0x05d1('0x28')](function(_0x43da44){if(_0x43da44){_0x147961=_0x43da44[_0x05d1('0x4b')];if(!_0x366e80[_0x05d1('0x33')][_0x05d1('0x39')](_0x05d1('0x3a'))){_0x34d7f8[_0x05d1('0x22')]=qs[_0x05d1('0x22')](_0x366e80[_0x05d1('0x33')][_0x05d1('0x22')]);_0x34d7f8[_0x05d1('0x20')]=qs[_0x05d1('0x20')](_0x366e80[_0x05d1('0x33')][_0x05d1('0x20')]);}return _0x23c699[_0x05d1('0x50')](_0x34d7f8);}})[_0x05d1('0x28')](function(_0xdf96d5){if(_0xdf96d5){return _0xdf96d5?{'count':_0x147961,'rows':_0xdf96d5}:null;}})[_0x05d1('0x28')](respondWithResult(_0x220fed,null))[_0x05d1('0x47')](handleError(_0x220fed,null));};exports['getDescriptions']=function(_0x36a7d5,_0x51c266,_0x27cb17){var _0x1f04e7={};var _0x3c16b0={};var _0x260fd4;var _0x129d04;return db[_0x05d1('0x43')]['findOne']({'where':{'id':_0x36a7d5[_0x05d1('0x49')]['id']}})[_0x05d1('0x28')](handleEntityNotFound(_0x51c266,null))[_0x05d1('0x28')](function(_0x22bd2d){if(_0x22bd2d){_0x260fd4=_0x22bd2d;_0x3c16b0[_0x05d1('0x32')]=_[_0x05d1('0x34')](db['Dynamics365Field'][_0x05d1('0x4a')]);_0x3c16b0[_0x05d1('0x33')]=_[_0x05d1('0x34')](_0x36a7d5[_0x05d1('0x33')]);_0x3c16b0[_0x05d1('0x35')]=_[_0x05d1('0x36')](_0x3c16b0[_0x05d1('0x32')],_0x3c16b0[_0x05d1('0x33')]);_0x1f04e7[_0x05d1('0x37')]=_['intersection'](_0x3c16b0['model'],qs[_0x05d1('0x38')](_0x36a7d5[_0x05d1('0x33')][_0x05d1('0x38')]));_0x1f04e7['attributes']=_0x1f04e7[_0x05d1('0x37')][_0x05d1('0x4b')]?_0x1f04e7['attributes']:_0x3c16b0[_0x05d1('0x32')];_0x1f04e7[_0x05d1('0x3b')]=qs[_0x05d1('0x3c')](_0x36a7d5[_0x05d1('0x33')]['sort']);_0x1f04e7[_0x05d1('0x3d')]=qs['filters'](_[_0x05d1('0x3e')](_0x36a7d5[_0x05d1('0x33')],_0x3c16b0['filters']));if(_0x36a7d5['query']['filter']){_0x1f04e7[_0x05d1('0x3d')]=_[_0x05d1('0x40')](_0x1f04e7['where'],{'$or':_[_0x05d1('0x2f')](_0x1f04e7[_0x05d1('0x37')],function(_0x1fb27b){var _0x84ea94={};_0x84ea94[_0x1fb27b]={'$like':'%'+_0x36a7d5[_0x05d1('0x33')][_0x05d1('0x3f')]+'%'};return _0x84ea94;})});}_0x1f04e7=_[_0x05d1('0x40')]({},_0x1f04e7,_0x36a7d5['options']);return _0x260fd4[_0x05d1('0x53')](_0x1f04e7);}})[_0x05d1('0x28')](function(_0x2721d6){if(_0x2721d6){_0x129d04=_0x2721d6[_0x05d1('0x4b')];if(!_0x36a7d5['query']['hasOwnProperty'](_0x05d1('0x3a'))){_0x1f04e7['limit']=qs[_0x05d1('0x22')](_0x36a7d5[_0x05d1('0x33')]['limit']);_0x1f04e7['offset']=qs[_0x05d1('0x20')](_0x36a7d5[_0x05d1('0x33')]['offset']);}return _0x260fd4[_0x05d1('0x53')](_0x1f04e7);}})[_0x05d1('0x28')](function(_0xa85d3d){if(_0xa85d3d){return _0xa85d3d?{'count':_0x129d04,'rows':_0xa85d3d}:null;}})[_0x05d1('0x28')](respondWithResult(_0x51c266,null))[_0x05d1('0x47')](handleError(_0x51c266,null));}; \ No newline at end of file +var _0x2e47=['order','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','map','Dynamics365Configuration','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','getFields','Dynamics365Field'];(function(_0x46c6e1,_0x3e103d){var _0x23f5dd=function(_0xcc1bd5){while(--_0xcc1bd5){_0x46c6e1['push'](_0x46c6e1['shift']());}};_0x23f5dd(++_0x3e103d);}(_0x2e47,0x1ea));var _0x72e4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2e47[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x72e4('0x0'));var zipdir=require(_0x72e4('0x1'));var jsonpatch=require(_0x72e4('0x2'));var rp=require(_0x72e4('0x3'));var moment=require(_0x72e4('0x4'));var BPromise=require(_0x72e4('0x5'));var Mustache=require(_0x72e4('0x6'));var util=require('util');var path=require(_0x72e4('0x7'));var sox=require(_0x72e4('0x8'));var csv=require(_0x72e4('0x9'));var ejs=require(_0x72e4('0xa'));var fs=require('fs');var fs_extra=require(_0x72e4('0xb'));var _=require(_0x72e4('0xc'));var squel=require(_0x72e4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x72e4('0xe'));var toCsv=require(_0x72e4('0x9'));var querystring=require(_0x72e4('0xf'));var Papa=require(_0x72e4('0x10'));var Redis=require(_0x72e4('0x11'));var authService=require(_0x72e4('0x12'));var qs=require(_0x72e4('0x13'));var as=require(_0x72e4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x72e4('0x15'));var config=require(_0x72e4('0x16'));var licenseUtil=require(_0x72e4('0x17'));var db=require(_0x72e4('0x18'))['db'];function respondWithStatusCode(_0x5b3d5e,_0x3307e5){_0x3307e5=_0x3307e5||0xcc;return function(_0x168746){if(_0x168746){return _0x5b3d5e['sendStatus'](_0x3307e5);}return _0x5b3d5e[_0x72e4('0x19')](_0x3307e5)[_0x72e4('0x1a')]();};}function respondWithResult(_0x1e72ba,_0x360443){_0x360443=_0x360443||0xc8;return function(_0x1d0fa5){if(_0x1d0fa5){return _0x1e72ba[_0x72e4('0x19')](_0x360443)[_0x72e4('0x1b')](_0x1d0fa5);}};}function respondWithFilteredResult(_0x3caa44,_0x546a22){return function(_0x584898){if(_0x584898){var _0x335fc6=typeof _0x546a22[_0x72e4('0x1c')]===_0x72e4('0x1d')&&typeof _0x546a22['limit']===_0x72e4('0x1d');var _0x964890=_0x584898['count'];var _0x5783cb=_0x335fc6?0x0:_0x546a22[_0x72e4('0x1c')];var _0x2dcf82=_0x335fc6?_0x584898[_0x72e4('0x1e')]:_0x546a22[_0x72e4('0x1c')]+_0x546a22[_0x72e4('0x1f')];var _0x6b107e;if(_0x2dcf82>=_0x964890){_0x2dcf82=_0x964890;_0x6b107e=0xc8;}else{_0x6b107e=0xce;}_0x3caa44['status'](_0x6b107e);return _0x3caa44[_0x72e4('0x20')](_0x72e4('0x21'),_0x5783cb+'-'+_0x2dcf82+'/'+_0x964890)['json'](_0x584898);}return null;};}function patchUpdates(_0x4b2f3d){return function(_0x32bbdd){try{jsonpatch[_0x72e4('0x22')](_0x32bbdd,_0x4b2f3d,!![]);}catch(_0xf9e53e){return BPromise[_0x72e4('0x23')](_0xf9e53e);}return _0x32bbdd[_0x72e4('0x24')]();};}function saveUpdates(_0x543806,_0x4ca0a1){return function(_0x574cde){if(_0x574cde){return _0x574cde[_0x72e4('0x25')](_0x543806)['then'](function(_0x31ae1b){return _0x31ae1b;});}return null;};}function removeEntity(_0x2f950c,_0x370ce3){return function(_0x17920d){if(_0x17920d){return _0x17920d[_0x72e4('0x26')]()['then'](function(){_0x2f950c[_0x72e4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58960d,_0x598df9){return function(_0x3d39cc){if(!_0x3d39cc){_0x58960d[_0x72e4('0x27')](0x194);}return _0x3d39cc;};}function handleError(_0x8cdf03,_0x4ad57c){_0x4ad57c=_0x4ad57c||0x1f4;return function(_0x129902){logger[_0x72e4('0x28')](_0x129902[_0x72e4('0x29')]);if(_0x129902[_0x72e4('0x2a')]){delete _0x129902[_0x72e4('0x2a')];}_0x8cdf03[_0x72e4('0x19')](_0x4ad57c)[_0x72e4('0x2b')](_0x129902);};}exports['index']=function(_0x485e9f,_0x57259f){var _0x274b44={},_0x3737f8={},_0x58f94a={'count':0x0,'rows':[]};var _0x3a3709=_[_0x72e4('0x2c')](db[_0x72e4('0x2d')]['rawAttributes'],function(_0x5cb023){return{'name':_0x5cb023[_0x72e4('0x2e')],'type':_0x5cb023[_0x72e4('0x2f')]['key']};});_0x3737f8['model']=_[_0x72e4('0x2c')](_0x3a3709,_0x72e4('0x2a'));_0x3737f8[_0x72e4('0x30')]=_[_0x72e4('0x31')](_0x485e9f[_0x72e4('0x30')]);_0x3737f8['filters']=_[_0x72e4('0x32')](_0x3737f8[_0x72e4('0x33')],_0x3737f8[_0x72e4('0x30')]);_0x274b44[_0x72e4('0x34')]=_['intersection'](_0x3737f8[_0x72e4('0x33')],qs['fields'](_0x485e9f['query'][_0x72e4('0x35')]));_0x274b44[_0x72e4('0x34')]=_0x274b44[_0x72e4('0x34')][_0x72e4('0x36')]?_0x274b44[_0x72e4('0x34')]:_0x3737f8[_0x72e4('0x33')];if(!_0x485e9f['query']['hasOwnProperty'](_0x72e4('0x37'))){_0x274b44['limit']=qs[_0x72e4('0x1f')](_0x485e9f[_0x72e4('0x30')][_0x72e4('0x1f')]);_0x274b44['offset']=qs[_0x72e4('0x1c')](_0x485e9f[_0x72e4('0x30')]['offset']);}_0x274b44['order']=qs[_0x72e4('0x38')](_0x485e9f['query']['sort']);_0x274b44[_0x72e4('0x39')]=qs['filters'](_[_0x72e4('0x3a')](_0x485e9f[_0x72e4('0x30')],_0x3737f8[_0x72e4('0x3b')]),_0x3a3709);if(_0x485e9f[_0x72e4('0x30')][_0x72e4('0x3c')]){_0x274b44[_0x72e4('0x39')]=_[_0x72e4('0x3d')](_0x274b44[_0x72e4('0x39')],{'$or':_[_0x72e4('0x2c')](_0x3a3709,function(_0x4c6ca6){if(_0x4c6ca6[_0x72e4('0x2f')]!==_0x72e4('0x3e')){var _0x184786={};_0x184786[_0x4c6ca6[_0x72e4('0x2a')]]={'$like':'%'+_0x485e9f[_0x72e4('0x30')]['filter']+'%'};return _0x184786;}})});}_0x274b44=_['merge']({},_0x274b44,_0x485e9f[_0x72e4('0x3f')]);var _0x9c3023={'where':_0x274b44[_0x72e4('0x39')]};return db[_0x72e4('0x2d')][_0x72e4('0x1e')](_0x9c3023)[_0x72e4('0x40')](function(_0x46e8d6){_0x58f94a['count']=_0x46e8d6;if(_0x485e9f[_0x72e4('0x30')][_0x72e4('0x41')]){_0x274b44['include']=[{'all':!![]}];}return db[_0x72e4('0x2d')][_0x72e4('0x42')](_0x274b44);})[_0x72e4('0x40')](function(_0x142d4c){_0x58f94a[_0x72e4('0x43')]=_0x142d4c;return _0x58f94a;})[_0x72e4('0x40')](respondWithFilteredResult(_0x57259f,_0x274b44))[_0x72e4('0x44')](handleError(_0x57259f,null));};exports[_0x72e4('0x45')]=function(_0x3734f3,_0x5f4e7b){var _0x41e402={'raw':![],'where':{'id':_0x3734f3[_0x72e4('0x46')]['id']}},_0x33eb08={};_0x33eb08[_0x72e4('0x33')]=_[_0x72e4('0x31')](db[_0x72e4('0x2d')][_0x72e4('0x47')]);_0x33eb08[_0x72e4('0x30')]=_['keys'](_0x3734f3[_0x72e4('0x30')]);_0x33eb08[_0x72e4('0x3b')]=_[_0x72e4('0x32')](_0x33eb08[_0x72e4('0x33')],_0x33eb08[_0x72e4('0x30')]);_0x41e402[_0x72e4('0x34')]=_[_0x72e4('0x32')](_0x33eb08[_0x72e4('0x33')],qs['fields'](_0x3734f3[_0x72e4('0x30')]['fields']));_0x41e402[_0x72e4('0x34')]=_0x41e402[_0x72e4('0x34')][_0x72e4('0x36')]?_0x41e402[_0x72e4('0x34')]:_0x33eb08['model'];if(_0x3734f3[_0x72e4('0x30')][_0x72e4('0x41')]){_0x41e402[_0x72e4('0x48')]=[{'all':!![]}];}_0x41e402=_[_0x72e4('0x3d')]({},_0x41e402,_0x3734f3['options']);return db[_0x72e4('0x2d')][_0x72e4('0x49')](_0x41e402)[_0x72e4('0x40')](handleEntityNotFound(_0x5f4e7b,null))[_0x72e4('0x40')](respondWithResult(_0x5f4e7b,null))['catch'](handleError(_0x5f4e7b,null));};exports['create']=function(_0x5a1dd0,_0xa724ce){return db[_0x72e4('0x2d')]['create'](_0x5a1dd0[_0x72e4('0x4a')],{})[_0x72e4('0x40')](respondWithResult(_0xa724ce,0xc9))[_0x72e4('0x44')](handleError(_0xa724ce,null));};exports['update']=function(_0x18ade1,_0xe166ee){if(_0x18ade1[_0x72e4('0x4a')]['id']){delete _0x18ade1[_0x72e4('0x4a')]['id'];}return db['Dynamics365Configuration'][_0x72e4('0x49')]({'where':{'id':_0x18ade1[_0x72e4('0x46')]['id']}})[_0x72e4('0x40')](handleEntityNotFound(_0xe166ee,null))[_0x72e4('0x40')](saveUpdates(_0x18ade1[_0x72e4('0x4a')],null))['then'](respondWithResult(_0xe166ee,null))[_0x72e4('0x44')](handleError(_0xe166ee,null));};exports['destroy']=function(_0x4e5cb0,_0x33511c){return db[_0x72e4('0x2d')][_0x72e4('0x49')]({'where':{'id':_0x4e5cb0[_0x72e4('0x46')]['id']}})[_0x72e4('0x40')](handleEntityNotFound(_0x33511c,null))[_0x72e4('0x40')](removeEntity(_0x33511c,null))[_0x72e4('0x44')](handleError(_0x33511c,null));};exports[_0x72e4('0x4b')]=function(_0x1c1546,_0x45505f,_0x212e96){var _0x1b0c92={};var _0xe422a7={};var _0xd6b66d;var _0x298870;return db[_0x72e4('0x2d')]['findOne']({'where':{'id':_0x1c1546['params']['id']}})['then'](handleEntityNotFound(_0x45505f,null))[_0x72e4('0x40')](function(_0x5d7d57){if(_0x5d7d57){_0xd6b66d=_0x5d7d57;_0xe422a7[_0x72e4('0x33')]=_[_0x72e4('0x31')](db[_0x72e4('0x4c')]['rawAttributes']);_0xe422a7[_0x72e4('0x30')]=_['keys'](_0x1c1546['query']);_0xe422a7[_0x72e4('0x3b')]=_[_0x72e4('0x32')](_0xe422a7['model'],_0xe422a7['query']);_0x1b0c92[_0x72e4('0x34')]=_[_0x72e4('0x32')](_0xe422a7[_0x72e4('0x33')],qs['fields'](_0x1c1546[_0x72e4('0x30')]['fields']));_0x1b0c92[_0x72e4('0x34')]=_0x1b0c92['attributes'][_0x72e4('0x36')]?_0x1b0c92[_0x72e4('0x34')]:_0xe422a7[_0x72e4('0x33')];_0x1b0c92[_0x72e4('0x4d')]=qs[_0x72e4('0x38')](_0x1c1546[_0x72e4('0x30')][_0x72e4('0x38')]);_0x1b0c92['where']=qs['filters'](_[_0x72e4('0x3a')](_0x1c1546[_0x72e4('0x30')],_0xe422a7[_0x72e4('0x3b')]));if(_0x1c1546[_0x72e4('0x30')][_0x72e4('0x3c')]){_0x1b0c92[_0x72e4('0x39')]=_['merge'](_0x1b0c92[_0x72e4('0x39')],{'$or':_[_0x72e4('0x2c')](_0x1b0c92[_0x72e4('0x34')],function(_0xd5e18d){var _0x1fe55d={};_0x1fe55d[_0xd5e18d]={'$like':'%'+_0x1c1546['query'][_0x72e4('0x3c')]+'%'};return _0x1fe55d;})});}_0x1b0c92=_[_0x72e4('0x3d')]({},_0x1b0c92,_0x1c1546[_0x72e4('0x3f')]);return _0xd6b66d[_0x72e4('0x4b')](_0x1b0c92);}})[_0x72e4('0x40')](function(_0x513c6b){if(_0x513c6b){_0x298870=_0x513c6b[_0x72e4('0x36')];if(!_0x1c1546[_0x72e4('0x30')][_0x72e4('0x4e')](_0x72e4('0x37'))){_0x1b0c92[_0x72e4('0x1f')]=qs['limit'](_0x1c1546[_0x72e4('0x30')][_0x72e4('0x1f')]);_0x1b0c92[_0x72e4('0x1c')]=qs[_0x72e4('0x1c')](_0x1c1546[_0x72e4('0x30')][_0x72e4('0x1c')]);}return _0xd6b66d['getFields'](_0x1b0c92);}})[_0x72e4('0x40')](function(_0x33afcf){if(_0x33afcf){return _0x33afcf?{'count':_0x298870,'rows':_0x33afcf}:null;}})['then'](respondWithResult(_0x45505f,null))['catch'](handleError(_0x45505f,null));};exports[_0x72e4('0x4f')]=function(_0x274203,_0x28d022,_0x34d193){var _0x2b5eec={};var _0x44488b={};var _0x57990d;var _0x10857f;return db[_0x72e4('0x2d')]['findOne']({'where':{'id':_0x274203[_0x72e4('0x46')]['id']}})[_0x72e4('0x40')](handleEntityNotFound(_0x28d022,null))[_0x72e4('0x40')](function(_0x111cd4){if(_0x111cd4){_0x57990d=_0x111cd4;_0x44488b['model']=_['keys'](db[_0x72e4('0x4c')][_0x72e4('0x47')]);_0x44488b['query']=_[_0x72e4('0x31')](_0x274203[_0x72e4('0x30')]);_0x44488b['filters']=_[_0x72e4('0x32')](_0x44488b[_0x72e4('0x33')],_0x44488b[_0x72e4('0x30')]);_0x2b5eec[_0x72e4('0x34')]=_['intersection'](_0x44488b[_0x72e4('0x33')],qs[_0x72e4('0x35')](_0x274203[_0x72e4('0x30')]['fields']));_0x2b5eec[_0x72e4('0x34')]=_0x2b5eec['attributes'][_0x72e4('0x36')]?_0x2b5eec[_0x72e4('0x34')]:_0x44488b[_0x72e4('0x33')];_0x2b5eec[_0x72e4('0x4d')]=qs[_0x72e4('0x38')](_0x274203['query'][_0x72e4('0x38')]);_0x2b5eec[_0x72e4('0x39')]=qs['filters'](_[_0x72e4('0x3a')](_0x274203[_0x72e4('0x30')],_0x44488b[_0x72e4('0x3b')]));if(_0x274203[_0x72e4('0x30')][_0x72e4('0x3c')]){_0x2b5eec[_0x72e4('0x39')]=_[_0x72e4('0x3d')](_0x2b5eec[_0x72e4('0x39')],{'$or':_['map'](_0x2b5eec[_0x72e4('0x34')],function(_0x230dbe){var _0x50d2f1={};_0x50d2f1[_0x230dbe]={'$like':'%'+_0x274203[_0x72e4('0x30')][_0x72e4('0x3c')]+'%'};return _0x50d2f1;})});}_0x2b5eec=_[_0x72e4('0x3d')]({},_0x2b5eec,_0x274203['options']);return _0x57990d[_0x72e4('0x4f')](_0x2b5eec);}})[_0x72e4('0x40')](function(_0x5c8ecb){if(_0x5c8ecb){_0x10857f=_0x5c8ecb['length'];if(!_0x274203['query'][_0x72e4('0x4e')](_0x72e4('0x37'))){_0x2b5eec[_0x72e4('0x1f')]=qs['limit'](_0x274203['query'][_0x72e4('0x1f')]);_0x2b5eec[_0x72e4('0x1c')]=qs[_0x72e4('0x1c')](_0x274203[_0x72e4('0x30')][_0x72e4('0x1c')]);}return _0x57990d[_0x72e4('0x4f')](_0x2b5eec);}})[_0x72e4('0x40')](function(_0x4b54e8){if(_0x4b54e8){return _0x4b54e8?{'count':_0x10857f,'rows':_0x4b54e8}:null;}})[_0x72e4('0x40')](respondWithResult(_0x28d022,null))['catch'](handleError(_0x28d022,null));};exports[_0x72e4('0x50')]=function(_0x54b70f,_0x8f62b0,_0x53884d){var _0xba5639={};var _0x11c1f1={};var _0xf81b5a;var _0x14f64c;return db[_0x72e4('0x2d')]['findOne']({'where':{'id':_0x54b70f[_0x72e4('0x46')]['id']}})['then'](handleEntityNotFound(_0x8f62b0,null))[_0x72e4('0x40')](function(_0x158357){if(_0x158357){_0xf81b5a=_0x158357;_0x11c1f1[_0x72e4('0x33')]=_[_0x72e4('0x31')](db['Dynamics365Field'][_0x72e4('0x47')]);_0x11c1f1[_0x72e4('0x30')]=_['keys'](_0x54b70f[_0x72e4('0x30')]);_0x11c1f1[_0x72e4('0x3b')]=_[_0x72e4('0x32')](_0x11c1f1[_0x72e4('0x33')],_0x11c1f1[_0x72e4('0x30')]);_0xba5639[_0x72e4('0x34')]=_[_0x72e4('0x32')](_0x11c1f1[_0x72e4('0x33')],qs[_0x72e4('0x35')](_0x54b70f[_0x72e4('0x30')][_0x72e4('0x35')]));_0xba5639[_0x72e4('0x34')]=_0xba5639[_0x72e4('0x34')][_0x72e4('0x36')]?_0xba5639[_0x72e4('0x34')]:_0x11c1f1[_0x72e4('0x33')];_0xba5639[_0x72e4('0x4d')]=qs[_0x72e4('0x38')](_0x54b70f[_0x72e4('0x30')][_0x72e4('0x38')]);_0xba5639[_0x72e4('0x39')]=qs[_0x72e4('0x3b')](_['pick'](_0x54b70f[_0x72e4('0x30')],_0x11c1f1['filters']));if(_0x54b70f[_0x72e4('0x30')][_0x72e4('0x3c')]){_0xba5639[_0x72e4('0x39')]=_[_0x72e4('0x3d')](_0xba5639[_0x72e4('0x39')],{'$or':_[_0x72e4('0x2c')](_0xba5639['attributes'],function(_0x21aec8){var _0x327270={};_0x327270[_0x21aec8]={'$like':'%'+_0x54b70f[_0x72e4('0x30')][_0x72e4('0x3c')]+'%'};return _0x327270;})});}_0xba5639=_[_0x72e4('0x3d')]({},_0xba5639,_0x54b70f[_0x72e4('0x3f')]);return _0xf81b5a[_0x72e4('0x50')](_0xba5639);}})['then'](function(_0x3ef3c7){if(_0x3ef3c7){_0x14f64c=_0x3ef3c7[_0x72e4('0x36')];if(!_0x54b70f[_0x72e4('0x30')][_0x72e4('0x4e')]('nolimit')){_0xba5639[_0x72e4('0x1f')]=qs[_0x72e4('0x1f')](_0x54b70f[_0x72e4('0x30')][_0x72e4('0x1f')]);_0xba5639[_0x72e4('0x1c')]=qs[_0x72e4('0x1c')](_0x54b70f[_0x72e4('0x30')][_0x72e4('0x1c')]);}return _0xf81b5a['getDescriptions'](_0xba5639);}})[_0x72e4('0x40')](function(_0x2cd65d){if(_0x2cd65d){return _0x2cd65d?{'count':_0x14f64c,'rows':_0x2cd65d}:null;}})[_0x72e4('0x40')](respondWithResult(_0x8f62b0,null))['catch'](handleError(_0x8f62b0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index eba7d4e..0cdaa8e 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x1707fe,_0xef9258){var _0x569a92=function(_0xee1e76){while(--_0xee1e76){_0x1707fe['push'](_0x1707fe['shift']());}};_0x569a92(++_0xef9258);}(_0x9bde,0xe1));var _0xe9bd=function(_0x411338,_0x267c3f){_0x411338=_0x411338-0x0;var _0x3f9b91=_0x9bde[_0x411338];return _0x3f9b91;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5b1e66,_0x23a051){var _0x4d2e75=function(_0x28a4ce){while(--_0x28a4ce){_0x5b1e66['push'](_0x5b1e66['shift']());}};_0x4d2e75(++_0x23a051);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5a3a1c,_0x4e0f31){_0x5a3a1c=_0x5a3a1c-0x0;var _0x230b24=_0xd6d6[_0x5a3a1c];return _0x230b24;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'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 4b10585..6ba041e 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 _0xef93=['code','Dynamics365Configuration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1af12c,_0xd47e9a){var _0x3f1895=function(_0x3144ee){while(--_0x3144ee){_0x1af12c['push'](_0x1af12c['shift']());}};_0x3f1895(++_0xd47e9a);}(_0xef93,0x101));var _0x3ef9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xef93[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3ef9('0x0'));var util=require(_0x3ef9('0x1'));var moment=require(_0x3ef9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ef9('0x3'));var db=require(_0x3ef9('0x4'))['db'];var utils=require(_0x3ef9('0x5'));var logger=require(_0x3ef9('0x6'))('rpc');var config=require(_0x3ef9('0x7'));var jayson=require(_0x3ef9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2953c0,_0x2c95df,_0x32c2d3){return new BPromise(function(_0x1ea427,_0x260564){return client[_0x3ef9('0x9')](_0x2953c0,_0x32c2d3)[_0x3ef9('0xa')](function(_0x377a7e){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x2c95df,_0x3ef9('0xb'));logger[_0x3ef9('0xc')](_0x3ef9('0xd'),_0x2c95df,'request\x20sent',JSON[_0x3ef9('0xe')](_0x377a7e));if(_0x377a7e[_0x3ef9('0xf')]){if(_0x377a7e[_0x3ef9('0xf')][_0x3ef9('0x10')]===0x1f4){logger[_0x3ef9('0xf')](_0x3ef9('0x11'),_0x2c95df,_0x377a7e[_0x3ef9('0xf')][_0x3ef9('0x12')]);return _0x260564(_0x377a7e[_0x3ef9('0xf')][_0x3ef9('0x12')]);}logger[_0x3ef9('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2c95df,_0x377a7e[_0x3ef9('0xf')][_0x3ef9('0x12')]);return _0x1ea427(_0x377a7e[_0x3ef9('0xf')][_0x3ef9('0x12')]);}else{logger[_0x3ef9('0x13')](_0x3ef9('0x11'),_0x2c95df,_0x3ef9('0xb'));_0x1ea427(_0x377a7e['result'][_0x3ef9('0x12')]);}})[_0x3ef9('0x14')](function(_0x4479d8){logger['error'](_0x3ef9('0x11'),_0x2c95df,_0x4479d8);_0x260564(_0x4479d8);});});} \ No newline at end of file +var _0x21bf=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0x21bf,0x15d));var _0xf21b=function(_0x2ac0b0,_0x115490){_0x2ac0b0=_0x2ac0b0-0x0;var _0x352688=_0x21bf[_0x2ac0b0];return _0x352688;};'use strict';var _=require(_0xf21b('0x0'));var util=require(_0xf21b('0x1'));var moment=require(_0xf21b('0x2'));var BPromise=require(_0xf21b('0x3'));var rs=require(_0xf21b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf21b('0x5'));var logger=require(_0xf21b('0x6'))(_0xf21b('0x7'));var config=require(_0xf21b('0x8'));var jayson=require(_0xf21b('0x9'));var client=jayson[_0xf21b('0xa')][_0xf21b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11f7ac,_0x4c8068,_0xc210b4){return new BPromise(function(_0x289f41,_0x5ebea7){return client[_0xf21b('0xc')](_0x11f7ac,_0xc210b4)[_0xf21b('0xd')](function(_0x29834d){logger[_0xf21b('0xe')](_0xf21b('0xf'),_0x4c8068,_0xf21b('0x10'));logger[_0xf21b('0x11')](_0xf21b('0x12'),_0x4c8068,_0xf21b('0x10'),JSON[_0xf21b('0x13')](_0x29834d));if(_0x29834d[_0xf21b('0x14')]){if(_0x29834d['error'][_0xf21b('0x15')]===0x1f4){logger['error'](_0xf21b('0xf'),_0x4c8068,_0x29834d['error'][_0xf21b('0x16')]);return _0x5ebea7(_0x29834d[_0xf21b('0x14')][_0xf21b('0x16')]);}logger[_0xf21b('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4c8068,_0x29834d['error']['message']);return _0x289f41(_0x29834d['error'][_0xf21b('0x16')]);}else{logger['info'](_0xf21b('0xf'),_0x4c8068,_0xf21b('0x10'));_0x289f41(_0x29834d[_0xf21b('0x17')][_0xf21b('0x16')]);}})[_0xf21b('0x18')](function(_0xa7693){logger['error'](_0xf21b('0xf'),_0x4c8068,_0xa7693);_0x5ebea7(_0xa7693);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index fd0679a..4b75197 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 _0xdd92=['exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy'];(function(_0x12a689,_0x3aa8fb){var _0x57fc58=function(_0x293127){while(--_0x293127){_0x12a689['push'](_0x12a689['shift']());}};_0x57fc58(++_0x3aa8fb);}(_0xdd92,0x1c1));var _0x2dd9=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xdd92[_0x2261ce];return _0x524640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2dd9('0x0'));var timeout=require(_0x2dd9('0x1'));var express=require(_0x2dd9('0x2'));var router=express['Router']();var fs_extra=require(_0x2dd9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2dd9('0x4'));var config=require('../../config/environment');var controller=require(_0x2dd9('0x5'));router[_0x2dd9('0x6')]('/',auth[_0x2dd9('0x7')](),controller[_0x2dd9('0x8')]);router[_0x2dd9('0x6')](_0x2dd9('0x9'),auth[_0x2dd9('0x7')](),controller[_0x2dd9('0xa')]);router[_0x2dd9('0xb')]('/',auth[_0x2dd9('0x7')](),controller[_0x2dd9('0xc')]);router['put'](_0x2dd9('0x9'),auth['isAuthenticated'](),controller[_0x2dd9('0xd')]);router['delete'](_0x2dd9('0x9'),auth[_0x2dd9('0x7')](),controller[_0x2dd9('0xe')]);module[_0x2dd9('0xf')]=router; \ No newline at end of file +var _0x3aac=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','put','update'];(function(_0x1a61cd,_0x3c4db7){var _0x35fa72=function(_0x4d517c){while(--_0x4d517c){_0x1a61cd['push'](_0x1a61cd['shift']());}};_0x35fa72(++_0x3c4db7);}(_0x3aac,0xda));var _0xc3aa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3aac[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc3aa('0x0'));var util=require(_0xc3aa('0x1'));var path=require(_0xc3aa('0x2'));var timeout=require(_0xc3aa('0x3'));var express=require(_0xc3aa('0x4'));var router=express['Router']();var fs_extra=require(_0xc3aa('0x5'));var auth=require(_0xc3aa('0x6'));var interaction=require(_0xc3aa('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xc3aa('0x8')](),controller[_0xc3aa('0x9')]);router[_0xc3aa('0xa')](_0xc3aa('0xb'),auth[_0xc3aa('0x8')](),controller[_0xc3aa('0xc')]);router[_0xc3aa('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc3aa('0xe')](_0xc3aa('0xb'),auth[_0xc3aa('0x8')](),controller[_0xc3aa('0xf')]);router[_0xc3aa('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc3aa('0x11')]);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 21a62d4..8856b1d 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 _0xc168=['BOOLEAN','exports','string','customVariable','keyValue','picklist','STRING'];(function(_0x140931,_0x2ffeba){var _0x4718ab=function(_0x1f08f7){while(--_0x1f08f7){_0x140931['push'](_0x140931['shift']());}};_0x4718ab(++_0x2ffeba);}(_0xc168,0xbe));var _0x8c16=function(_0x3001ab,_0x5b5662){_0x3001ab=_0x3001ab-0x0;var _0x21af5d=_0xc168[_0x3001ab];return _0x21af5d;};'use strict';var Sequelize=require('sequelize');module[_0x8c16('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8c16('0x1'),'variable',_0x8c16('0x2'),_0x8c16('0x3'),_0x8c16('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8c16('0x5')]},'key':{'type':Sequelize[_0x8c16('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x8c16('0x1'),'variable',_0x8c16('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8c16('0x5')]},'nameField':{'type':Sequelize[_0x8c16('0x5')]},'customField':{'type':Sequelize[_0x8c16('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8c16('0x5')]}}; \ No newline at end of file +var _0x06b3=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x1d83db,_0x89d115){var _0x2dc1d1=function(_0x13fdc3){while(--_0x13fdc3){_0x1d83db['push'](_0x1d83db['shift']());}};_0x2dc1d1(++_0x89d115);}(_0x06b3,0x97));var _0x306b=function(_0x478de9,_0x4ff2d4){_0x478de9=_0x478de9-0x0;var _0x26bd9b=_0x06b3[_0x478de9];return _0x26bd9b;};'use strict';var Sequelize=require(_0x306b('0x0'));module[_0x306b('0x1')]={'type':{'type':Sequelize[_0x306b('0x2')](_0x306b('0x3'),_0x306b('0x4'),_0x306b('0x5'),_0x306b('0x6'),_0x306b('0x7')),'defaultValue':_0x306b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x306b('0x8')]},'keyType':{'type':Sequelize[_0x306b('0x2')](_0x306b('0x3'),_0x306b('0x4'),_0x306b('0x5'))},'keyContent':{'type':Sequelize[_0x306b('0x8')]},'idField':{'type':Sequelize[_0x306b('0x8')]},'nameField':{'type':Sequelize[_0x306b('0x8')]},'customField':{'type':Sequelize[_0x306b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x306b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 40e1bdb..44a3a0b 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 _0x75f7=['update','then','destroy','sendStatus','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0x5987bb,_0x285810){var _0x5869f4=function(_0x30c336){while(--_0x30c336){_0x5987bb['push'](_0x5987bb['shift']());}};_0x5869f4(++_0x285810);}(_0x75f7,0x148));var _0x775f=function(_0x506a9b,_0x4964af){_0x506a9b=_0x506a9b-0x0;var _0x6e296b=_0x75f7[_0x506a9b];return _0x6e296b;};'use strict';var emlformat=require(_0x775f('0x0'));var rimraf=require(_0x775f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x775f('0x2'));var rp=require(_0x775f('0x3'));var moment=require('moment');var BPromise=require(_0x775f('0x4'));var Mustache=require('mustache');var util=require(_0x775f('0x5'));var path=require('path');var sox=require(_0x775f('0x6'));var csv=require(_0x775f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x775f('0x8'));var _=require(_0x775f('0x9'));var squel=require(_0x775f('0xa'));var crypto=require(_0x775f('0xb'));var jsforce=require(_0x775f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x775f('0xd'));var Redis=require(_0x775f('0xe'));var authService=require(_0x775f('0xf'));var qs=require(_0x775f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x775f('0x11'));var logger=require('../../config/logger')(_0x775f('0x12'));var utils=require(_0x775f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x775f('0x14'));var db=require(_0x775f('0x15'))['db'];function respondWithStatusCode(_0x4f8788,_0x2b9a41){_0x2b9a41=_0x2b9a41||0xcc;return function(_0x4328e6){if(_0x4328e6){return _0x4f8788['sendStatus'](_0x2b9a41);}return _0x4f8788[_0x775f('0x16')](_0x2b9a41)['end']();};}function respondWithResult(_0x26316c,_0x5ed6be){_0x5ed6be=_0x5ed6be||0xc8;return function(_0x589bc5){if(_0x589bc5){return _0x26316c['status'](_0x5ed6be)['json'](_0x589bc5);}};}function respondWithFilteredResult(_0x2eaef5,_0x27b56f){return function(_0x3118e4){if(_0x3118e4){var _0x2cdebd=typeof _0x27b56f[_0x775f('0x17')]===_0x775f('0x18')&&typeof _0x27b56f[_0x775f('0x19')]===_0x775f('0x18');var _0x2ec3ec=_0x3118e4['count'];var _0x415313=_0x2cdebd?0x0:_0x27b56f['offset'];var _0x4f6df2=_0x2cdebd?_0x3118e4[_0x775f('0x1a')]:_0x27b56f['offset']+_0x27b56f[_0x775f('0x19')];var _0x36c406;if(_0x4f6df2>=_0x2ec3ec){_0x4f6df2=_0x2ec3ec;_0x36c406=0xc8;}else{_0x36c406=0xce;}_0x2eaef5[_0x775f('0x16')](_0x36c406);return _0x2eaef5[_0x775f('0x1b')](_0x775f('0x1c'),_0x415313+'-'+_0x4f6df2+'/'+_0x2ec3ec)[_0x775f('0x1d')](_0x3118e4);}return null;};}function patchUpdates(_0x4ac500){return function(_0x3f8f72){try{jsonpatch[_0x775f('0x1e')](_0x3f8f72,_0x4ac500,!![]);}catch(_0x19e988){return BPromise[_0x775f('0x1f')](_0x19e988);}return _0x3f8f72['save']();};}function saveUpdates(_0x342140,_0x68cd05){return function(_0x226c97){if(_0x226c97){return _0x226c97[_0x775f('0x20')](_0x342140)[_0x775f('0x21')](function(_0x441abc){return _0x441abc;});}return null;};}function removeEntity(_0x225a66,_0x5f25e6){return function(_0x482330){if(_0x482330){return _0x482330[_0x775f('0x22')]()[_0x775f('0x21')](function(){_0x225a66[_0x775f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c0706,_0x36d2fc){return function(_0x3e17c2){if(!_0x3e17c2){_0x1c0706[_0x775f('0x23')](0x194);}return _0x3e17c2;};}function handleError(_0x1d46ad,_0x537ec8){_0x537ec8=_0x537ec8||0x1f4;return function(_0x835327){logger[_0x775f('0x24')](_0x835327[_0x775f('0x25')]);if(_0x835327['name']){delete _0x835327[_0x775f('0x26')];}_0x1d46ad[_0x775f('0x16')](_0x537ec8)['send'](_0x835327);};}exports[_0x775f('0x27')]=function(_0x300e28,_0x1147f1){var _0x1f03bb={},_0x1009e7={},_0x126c90={'count':0x0,'rows':[]};var _0x56475f=_[_0x775f('0x28')](db[_0x775f('0x29')][_0x775f('0x2a')],function(_0x50bf4c){return{'name':_0x50bf4c[_0x775f('0x2b')],'type':_0x50bf4c[_0x775f('0x2c')]['key']};});_0x1009e7[_0x775f('0x2d')]=_[_0x775f('0x28')](_0x56475f,_0x775f('0x26'));_0x1009e7[_0x775f('0x2e')]=_[_0x775f('0x2f')](_0x300e28[_0x775f('0x2e')]);_0x1009e7[_0x775f('0x30')]=_['intersection'](_0x1009e7[_0x775f('0x2d')],_0x1009e7[_0x775f('0x2e')]);_0x1f03bb[_0x775f('0x31')]=_[_0x775f('0x32')](_0x1009e7[_0x775f('0x2d')],qs[_0x775f('0x33')](_0x300e28['query'][_0x775f('0x33')]));_0x1f03bb[_0x775f('0x31')]=_0x1f03bb['attributes'][_0x775f('0x34')]?_0x1f03bb[_0x775f('0x31')]:_0x1009e7[_0x775f('0x2d')];if(!_0x300e28[_0x775f('0x2e')][_0x775f('0x35')](_0x775f('0x36'))){_0x1f03bb[_0x775f('0x19')]=qs[_0x775f('0x19')](_0x300e28[_0x775f('0x2e')][_0x775f('0x19')]);_0x1f03bb[_0x775f('0x17')]=qs[_0x775f('0x17')](_0x300e28['query'][_0x775f('0x17')]);}_0x1f03bb['order']=qs[_0x775f('0x37')](_0x300e28[_0x775f('0x2e')]['sort']);_0x1f03bb['where']=qs[_0x775f('0x30')](_[_0x775f('0x38')](_0x300e28[_0x775f('0x2e')],_0x1009e7[_0x775f('0x30')]),_0x56475f);if(_0x300e28[_0x775f('0x2e')][_0x775f('0x39')]){_0x1f03bb[_0x775f('0x3a')]=_[_0x775f('0x3b')](_0x1f03bb[_0x775f('0x3a')],{'$or':_[_0x775f('0x28')](_0x56475f,function(_0x245187){if(_0x245187[_0x775f('0x2c')]!==_0x775f('0x3c')){var _0x474b17={};_0x474b17[_0x245187[_0x775f('0x26')]]={'$like':'%'+_0x300e28['query']['filter']+'%'};return _0x474b17;}})});}_0x1f03bb=_[_0x775f('0x3b')]({},_0x1f03bb,_0x300e28['options']);var _0x5e7da4={'where':_0x1f03bb['where']};return db['Dynamics365Field'][_0x775f('0x1a')](_0x5e7da4)['then'](function(_0x419de6){_0x126c90['count']=_0x419de6;if(_0x300e28[_0x775f('0x2e')][_0x775f('0x3d')]){_0x1f03bb[_0x775f('0x3e')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x775f('0x3f')](_0x1f03bb);})['then'](function(_0xeeb228){_0x126c90[_0x775f('0x40')]=_0xeeb228;return _0x126c90;})[_0x775f('0x21')](respondWithFilteredResult(_0x1147f1,_0x1f03bb))[_0x775f('0x41')](handleError(_0x1147f1,null));};exports[_0x775f('0x42')]=function(_0x5b12ea,_0x7e93f6){var _0x3d3714={'raw':!![],'where':{'id':_0x5b12ea[_0x775f('0x43')]['id']}},_0x7e21c2={};_0x7e21c2['model']=_['keys'](db[_0x775f('0x29')]['rawAttributes']);_0x7e21c2[_0x775f('0x2e')]=_[_0x775f('0x2f')](_0x5b12ea[_0x775f('0x2e')]);_0x7e21c2[_0x775f('0x30')]=_[_0x775f('0x32')](_0x7e21c2[_0x775f('0x2d')],_0x7e21c2[_0x775f('0x2e')]);_0x3d3714[_0x775f('0x31')]=_[_0x775f('0x32')](_0x7e21c2[_0x775f('0x2d')],qs['fields'](_0x5b12ea['query']['fields']));_0x3d3714[_0x775f('0x31')]=_0x3d3714['attributes']['length']?_0x3d3714[_0x775f('0x31')]:_0x7e21c2[_0x775f('0x2d')];if(_0x5b12ea[_0x775f('0x2e')]['includeAll']){_0x3d3714[_0x775f('0x3e')]=[{'all':!![]}];}_0x3d3714=_[_0x775f('0x3b')]({},_0x3d3714,_0x5b12ea[_0x775f('0x44')]);return db[_0x775f('0x29')][_0x775f('0x45')](_0x3d3714)[_0x775f('0x21')](handleEntityNotFound(_0x7e93f6,null))[_0x775f('0x21')](respondWithResult(_0x7e93f6,null))[_0x775f('0x41')](handleError(_0x7e93f6,null));};exports[_0x775f('0x46')]=function(_0x24e731,_0x3a2792){return db['Dynamics365Field'][_0x775f('0x46')](_0x24e731[_0x775f('0x47')],{})[_0x775f('0x21')](respondWithResult(_0x3a2792,0xc9))[_0x775f('0x41')](handleError(_0x3a2792,null));};exports[_0x775f('0x20')]=function(_0xdfda4f,_0x59cca4){if(_0xdfda4f[_0x775f('0x47')]['id']){delete _0xdfda4f[_0x775f('0x47')]['id'];}return db['Dynamics365Field'][_0x775f('0x45')]({'where':{'id':_0xdfda4f[_0x775f('0x43')]['id']}})[_0x775f('0x21')](handleEntityNotFound(_0x59cca4,null))[_0x775f('0x21')](saveUpdates(_0xdfda4f[_0x775f('0x47')],null))[_0x775f('0x21')](respondWithResult(_0x59cca4,null))[_0x775f('0x41')](handleError(_0x59cca4,null));};exports[_0x775f('0x22')]=function(_0x4c638e,_0x50454c){return db[_0x775f('0x29')][_0x775f('0x45')]({'where':{'id':_0x4c638e[_0x775f('0x43')]['id']}})['then'](handleEntityNotFound(_0x50454c,null))['then'](removeEntity(_0x50454c,null))[_0x775f('0x41')](handleError(_0x50454c,null));}; \ No newline at end of file +var _0x296e=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','Dynamics365Field','includeAll','findAll','rows','catch','params','fields','include','options','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','length'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x296e,0x9e));var _0xe296=function(_0x489bda,_0x2cfd97){_0x489bda=_0x489bda-0x0;var _0x4add9d=_0x296e[_0x489bda];return _0x4add9d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe296('0x0'));var jsonpatch=require(_0xe296('0x1'));var rp=require(_0xe296('0x2'));var moment=require(_0xe296('0x3'));var BPromise=require(_0xe296('0x4'));var Mustache=require(_0xe296('0x5'));var util=require('util');var path=require(_0xe296('0x6'));var sox=require(_0xe296('0x7'));var csv=require(_0xe296('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe296('0x9'));var _=require(_0xe296('0xa'));var squel=require(_0xe296('0xb'));var crypto=require('crypto');var jsforce=require(_0xe296('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe296('0x8'));var querystring=require('querystring');var Papa=require(_0xe296('0xd'));var Redis=require(_0xe296('0xe'));var authService=require(_0xe296('0xf'));var qs=require(_0xe296('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe296('0x11'));var logger=require(_0xe296('0x12'))(_0xe296('0x13'));var utils=require(_0xe296('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe296('0x15'))['db'];function respondWithStatusCode(_0x346e4d,_0x4a9c61){_0x4a9c61=_0x4a9c61||0xcc;return function(_0x1be474){if(_0x1be474){return _0x346e4d[_0xe296('0x16')](_0x4a9c61);}return _0x346e4d[_0xe296('0x17')](_0x4a9c61)[_0xe296('0x18')]();};}function respondWithResult(_0x54c971,_0x4cda9a){_0x4cda9a=_0x4cda9a||0xc8;return function(_0x508ea0){if(_0x508ea0){return _0x54c971[_0xe296('0x17')](_0x4cda9a)[_0xe296('0x19')](_0x508ea0);}};}function respondWithFilteredResult(_0x1c1a6d,_0xbf0475){return function(_0x1e2526){if(_0x1e2526){var _0x32aa34=typeof _0xbf0475[_0xe296('0x1a')]==='undefined'&&typeof _0xbf0475[_0xe296('0x1b')]==='undefined';var _0x1c4ae9=_0x1e2526[_0xe296('0x1c')];var _0x4a955c=_0x32aa34?0x0:_0xbf0475[_0xe296('0x1a')];var _0x21fae1=_0x32aa34?_0x1e2526[_0xe296('0x1c')]:_0xbf0475[_0xe296('0x1a')]+_0xbf0475[_0xe296('0x1b')];var _0x262929;if(_0x21fae1>=_0x1c4ae9){_0x21fae1=_0x1c4ae9;_0x262929=0xc8;}else{_0x262929=0xce;}_0x1c1a6d[_0xe296('0x17')](_0x262929);return _0x1c1a6d[_0xe296('0x1d')](_0xe296('0x1e'),_0x4a955c+'-'+_0x21fae1+'/'+_0x1c4ae9)['json'](_0x1e2526);}return null;};}function patchUpdates(_0x3e5b8a){return function(_0xafdd0e){try{jsonpatch[_0xe296('0x1f')](_0xafdd0e,_0x3e5b8a,!![]);}catch(_0x4d196d){return BPromise[_0xe296('0x20')](_0x4d196d);}return _0xafdd0e[_0xe296('0x21')]();};}function saveUpdates(_0x459612,_0x3bccf1){return function(_0xbad0a2){if(_0xbad0a2){return _0xbad0a2['update'](_0x459612)[_0xe296('0x22')](function(_0x40d6f1){return _0x40d6f1;});}return null;};}function removeEntity(_0x318b3c,_0x4a199f){return function(_0x562a82){if(_0x562a82){return _0x562a82[_0xe296('0x23')]()['then'](function(){_0x318b3c[_0xe296('0x17')](0xcc)[_0xe296('0x18')]();});}};}function handleEntityNotFound(_0x5e36a9,_0x56a63b){return function(_0x3f8d55){if(!_0x3f8d55){_0x5e36a9['sendStatus'](0x194);}return _0x3f8d55;};}function handleError(_0x317791,_0x38f597){_0x38f597=_0x38f597||0x1f4;return function(_0x3650da){logger[_0xe296('0x24')](_0x3650da['stack']);if(_0x3650da[_0xe296('0x25')]){delete _0x3650da[_0xe296('0x25')];}_0x317791[_0xe296('0x17')](_0x38f597)['send'](_0x3650da);};}exports[_0xe296('0x26')]=function(_0xeb7335,_0x16047c){var _0x3fd19a={},_0x3872b6={},_0x1e0687={'count':0x0,'rows':[]};var _0x41b1c3=_[_0xe296('0x27')](db['Dynamics365Field']['rawAttributes'],function(_0x43b8a5){return{'name':_0x43b8a5[_0xe296('0x28')],'type':_0x43b8a5[_0xe296('0x29')]['key']};});_0x3872b6[_0xe296('0x2a')]=_[_0xe296('0x27')](_0x41b1c3,_0xe296('0x25'));_0x3872b6[_0xe296('0x2b')]=_[_0xe296('0x2c')](_0xeb7335[_0xe296('0x2b')]);_0x3872b6[_0xe296('0x2d')]=_[_0xe296('0x2e')](_0x3872b6[_0xe296('0x2a')],_0x3872b6['query']);_0x3fd19a[_0xe296('0x2f')]=_[_0xe296('0x2e')](_0x3872b6[_0xe296('0x2a')],qs['fields'](_0xeb7335['query']['fields']));_0x3fd19a['attributes']=_0x3fd19a['attributes'][_0xe296('0x30')]?_0x3fd19a[_0xe296('0x2f')]:_0x3872b6['model'];if(!_0xeb7335[_0xe296('0x2b')][_0xe296('0x31')](_0xe296('0x32'))){_0x3fd19a[_0xe296('0x1b')]=qs[_0xe296('0x1b')](_0xeb7335[_0xe296('0x2b')][_0xe296('0x1b')]);_0x3fd19a[_0xe296('0x1a')]=qs[_0xe296('0x1a')](_0xeb7335[_0xe296('0x2b')][_0xe296('0x1a')]);}_0x3fd19a[_0xe296('0x33')]=qs[_0xe296('0x34')](_0xeb7335[_0xe296('0x2b')]['sort']);_0x3fd19a[_0xe296('0x35')]=qs[_0xe296('0x2d')](_['pick'](_0xeb7335['query'],_0x3872b6[_0xe296('0x2d')]),_0x41b1c3);if(_0xeb7335[_0xe296('0x2b')][_0xe296('0x36')]){_0x3fd19a[_0xe296('0x35')]=_[_0xe296('0x37')](_0x3fd19a[_0xe296('0x35')],{'$or':_['map'](_0x41b1c3,function(_0x456c6f){if(_0x456c6f[_0xe296('0x29')]!==_0xe296('0x38')){var _0x59a437={};_0x59a437[_0x456c6f[_0xe296('0x25')]]={'$like':'%'+_0xeb7335['query']['filter']+'%'};return _0x59a437;}})});}_0x3fd19a=_['merge']({},_0x3fd19a,_0xeb7335['options']);var _0x560249={'where':_0x3fd19a[_0xe296('0x35')]};return db[_0xe296('0x39')][_0xe296('0x1c')](_0x560249)['then'](function(_0x10cc11){_0x1e0687['count']=_0x10cc11;if(_0xeb7335[_0xe296('0x2b')][_0xe296('0x3a')]){_0x3fd19a['include']=[{'all':!![]}];}return db[_0xe296('0x39')][_0xe296('0x3b')](_0x3fd19a);})[_0xe296('0x22')](function(_0x42ab59){_0x1e0687[_0xe296('0x3c')]=_0x42ab59;return _0x1e0687;})[_0xe296('0x22')](respondWithFilteredResult(_0x16047c,_0x3fd19a))[_0xe296('0x3d')](handleError(_0x16047c,null));};exports['show']=function(_0x5d2563,_0x231b68){var _0x59e103={'raw':!![],'where':{'id':_0x5d2563[_0xe296('0x3e')]['id']}},_0x3b1384={};_0x3b1384[_0xe296('0x2a')]=_[_0xe296('0x2c')](db[_0xe296('0x39')]['rawAttributes']);_0x3b1384[_0xe296('0x2b')]=_[_0xe296('0x2c')](_0x5d2563[_0xe296('0x2b')]);_0x3b1384['filters']=_[_0xe296('0x2e')](_0x3b1384['model'],_0x3b1384[_0xe296('0x2b')]);_0x59e103[_0xe296('0x2f')]=_[_0xe296('0x2e')](_0x3b1384[_0xe296('0x2a')],qs['fields'](_0x5d2563[_0xe296('0x2b')][_0xe296('0x3f')]));_0x59e103['attributes']=_0x59e103[_0xe296('0x2f')][_0xe296('0x30')]?_0x59e103[_0xe296('0x2f')]:_0x3b1384[_0xe296('0x2a')];if(_0x5d2563[_0xe296('0x2b')][_0xe296('0x3a')]){_0x59e103[_0xe296('0x40')]=[{'all':!![]}];}_0x59e103=_[_0xe296('0x37')]({},_0x59e103,_0x5d2563[_0xe296('0x41')]);return db['Dynamics365Field']['find'](_0x59e103)[_0xe296('0x22')](handleEntityNotFound(_0x231b68,null))[_0xe296('0x22')](respondWithResult(_0x231b68,null))['catch'](handleError(_0x231b68,null));};exports['create']=function(_0x426f08,_0x1da0a2){return db[_0xe296('0x39')][_0xe296('0x42')](_0x426f08[_0xe296('0x43')],{})[_0xe296('0x22')](respondWithResult(_0x1da0a2,0xc9))[_0xe296('0x3d')](handleError(_0x1da0a2,null));};exports['update']=function(_0xc0820b,_0x48e107){if(_0xc0820b[_0xe296('0x43')]['id']){delete _0xc0820b[_0xe296('0x43')]['id'];}return db[_0xe296('0x39')]['find']({'where':{'id':_0xc0820b['params']['id']}})[_0xe296('0x22')](handleEntityNotFound(_0x48e107,null))[_0xe296('0x22')](saveUpdates(_0xc0820b[_0xe296('0x43')],null))[_0xe296('0x22')](respondWithResult(_0x48e107,null))['catch'](handleError(_0x48e107,null));};exports['destroy']=function(_0x1dfe2b,_0x2c6c4e){return db[_0xe296('0x39')][_0xe296('0x44')]({'where':{'id':_0x1dfe2b['params']['id']}})[_0xe296('0x22')](handleEntityNotFound(_0x2c6c4e,null))[_0xe296('0x22')](removeEntity(_0x2c6c4e,null))[_0xe296('0x3d')](handleError(_0x2c6c4e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index e167314..62f1637 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 _0x4a5d=['bluebird','request-promise','path','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x48e3a5,_0x21b738){var _0x17bf64=function(_0x57a8b7){while(--_0x57a8b7){_0x48e3a5['push'](_0x48e3a5['shift']());}};_0x17bf64(++_0x21b738);}(_0x4a5d,0x1bd));var _0xd4a5=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0x4a5d[_0xa30766];return _0x24e780;};'use strict';var _=require(_0xd4a5('0x0'));var util=require(_0xd4a5('0x1'));var logger=require(_0xd4a5('0x2'))(_0xd4a5('0x3'));var moment=require(_0xd4a5('0x4'));var BPromise=require(_0xd4a5('0x5'));var rp=require(_0xd4a5('0x6'));var fs=require('fs');var path=require(_0xd4a5('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd4a5('0x8'));module['exports']=function(_0x336b5c,_0x5bec79){return _0x336b5c[_0xd4a5('0x9')](_0xd4a5('0xa'),attributes,{'tableName':_0xd4a5('0xb'),'paranoid':![],'indexes':[{'name':_0xd4a5('0xc'),'fields':[_0xd4a5('0xd'),_0xd4a5('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd296=['rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','api','moment','bluebird','request-promise','path'];(function(_0x17eba5,_0x434f32){var _0x1aa6f1=function(_0x163713){while(--_0x163713){_0x17eba5['push'](_0x17eba5['shift']());}};_0x1aa6f1(++_0x434f32);}(_0xd296,0x1ad));var _0x6d29=function(_0x5ccf32,_0x3a0f63){_0x5ccf32=_0x5ccf32-0x0;var _0x17015=_0xd296[_0x5ccf32];return _0x17015;};'use strict';var _=require('lodash');var util=require(_0x6d29('0x0'));var logger=require('../../config/logger')(_0x6d29('0x1'));var moment=require(_0x6d29('0x2'));var BPromise=require(_0x6d29('0x3'));var rp=require(_0x6d29('0x4'));var fs=require('fs');var path=require(_0x6d29('0x5'));var rimraf=require(_0x6d29('0x6'));var config=require('../../config/environment');var attributes=require(_0x6d29('0x7'));module[_0x6d29('0x8')]=function(_0x4a166c,_0x4fc3ae){return _0x4a166c[_0x6d29('0x9')](_0x6d29('0xa'),attributes,{'tableName':_0x6d29('0xb'),'paranoid':![],'indexes':[{'name':_0x6d29('0xc'),'fields':[_0x6d29('0xd'),_0x6d29('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 80785d7..459a118 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 _0x5fae=['request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x5fae,0x1d5));var _0xe5fa=function(_0x3e2f39,_0xe9075b){_0x3e2f39=_0x3e2f39-0x0;var _0x189006=_0x5fae[_0x3e2f39];return _0x189006;};'use strict';var _=require(_0xe5fa('0x0'));var util=require('util');var moment=require(_0xe5fa('0x1'));var BPromise=require(_0xe5fa('0x2'));var rs=require(_0xe5fa('0x3'));var fs=require('fs');var Redis=require(_0xe5fa('0x4'));var db=require(_0xe5fa('0x5'))['db'];var utils=require(_0xe5fa('0x6'));var logger=require(_0xe5fa('0x7'))('rpc');var config=require(_0xe5fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe5fa('0x9')][_0xe5fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d4c7d,_0x22e857,_0x26b862){return new BPromise(function(_0x4f5122,_0x3d9a20){return client['request'](_0x1d4c7d,_0x26b862)[_0xe5fa('0xb')](function(_0x546b9e){logger[_0xe5fa('0xc')](_0xe5fa('0xd'),_0x22e857,_0xe5fa('0xe'));logger[_0xe5fa('0xf')](_0xe5fa('0x10'),_0x22e857,_0xe5fa('0xe'),JSON[_0xe5fa('0x11')](_0x546b9e));if(_0x546b9e['error']){if(_0x546b9e[_0xe5fa('0x12')][_0xe5fa('0x13')]===0x1f4){logger[_0xe5fa('0x12')](_0xe5fa('0xd'),_0x22e857,_0x546b9e[_0xe5fa('0x12')][_0xe5fa('0x14')]);return _0x3d9a20(_0x546b9e[_0xe5fa('0x12')]['message']);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x22e857,_0x546b9e['error'][_0xe5fa('0x14')]);return _0x4f5122(_0x546b9e[_0xe5fa('0x12')][_0xe5fa('0x14')]);}else{logger[_0xe5fa('0xc')](_0xe5fa('0xd'),_0x22e857,_0xe5fa('0xe'));_0x4f5122(_0x546b9e[_0xe5fa('0x15')][_0xe5fa('0x14')]);}})[_0xe5fa('0x16')](function(_0x29e2b5){logger['error'](_0xe5fa('0xd'),_0x22e857,_0x29e2b5);_0x3d9a20(_0x29e2b5);});});} \ No newline at end of file +var _0xd0eb=['Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xff5dcb,_0x46bbf3){var _0x946df1=function(_0x22ee02){while(--_0x22ee02){_0xff5dcb['push'](_0xff5dcb['shift']());}};_0x946df1(++_0x46bbf3);}(_0xd0eb,0xcd));var _0xbd0e=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0xd0eb[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0xbd0e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbd0e('0x1'));var rs=require(_0xbd0e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0e('0x3'))['db'];var utils=require(_0xbd0e('0x4'));var logger=require(_0xbd0e('0x5'))(_0xbd0e('0x6'));var config=require(_0xbd0e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbd0e('0x8')][_0xbd0e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x166e94,_0x1945b9,_0x472852){return new BPromise(function(_0x38f71b,_0x475c2f){return client[_0xbd0e('0xa')](_0x166e94,_0x472852)[_0xbd0e('0xb')](function(_0x97350d){logger['info'](_0xbd0e('0xc'),_0x1945b9,_0xbd0e('0xd'));logger[_0xbd0e('0xe')](_0xbd0e('0xf'),_0x1945b9,'request\x20sent',JSON[_0xbd0e('0x10')](_0x97350d));if(_0x97350d[_0xbd0e('0x11')]){if(_0x97350d[_0xbd0e('0x11')][_0xbd0e('0x12')]===0x1f4){logger['error'](_0xbd0e('0xc'),_0x1945b9,_0x97350d[_0xbd0e('0x11')][_0xbd0e('0x13')]);return _0x475c2f(_0x97350d[_0xbd0e('0x11')][_0xbd0e('0x13')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1945b9,_0x97350d['error'][_0xbd0e('0x13')]);return _0x38f71b(_0x97350d['error']['message']);}else{logger['info'](_0xbd0e('0xc'),_0x1945b9,_0xbd0e('0xd'));_0x38f71b(_0x97350d[_0xbd0e('0x14')][_0xbd0e('0x13')]);}})[_0xbd0e('0x15')](function(_0xaf703c){logger[_0xbd0e('0x11')](_0xbd0e('0xc'),_0x1945b9,_0xaf703c);_0x475c2f(_0xaf703c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b0d6478..1b83305 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 _0x05f7=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x05f7,0xd2));var _0x705f=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0x05f7[_0x290fa6];return _0x47f1f3;};'use strict';var multer=require(_0x705f('0x0'));var util=require(_0x705f('0x1'));var path=require('path');var timeout=require(_0x705f('0x2'));var express=require(_0x705f('0x3'));var router=express[_0x705f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x705f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x705f('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0x705f('0x7')]('/',auth[_0x705f('0x8')](),controller[_0x705f('0x9')]);router[_0x705f('0x7')]('/:id',auth[_0x705f('0x8')](),controller[_0x705f('0xa')]);router['get'](_0x705f('0xb'),auth['isAuthenticated'](),controller[_0x705f('0xc')]);router[_0x705f('0x7')](_0x705f('0xd'),auth[_0x705f('0x8')](),controller[_0x705f('0xe')]);router['post']('/',auth[_0x705f('0x8')](),controller[_0x705f('0xf')]);router[_0x705f('0x10')](_0x705f('0xb'),auth['isAuthenticated'](),controller[_0x705f('0x11')]);router[_0x705f('0x12')](_0x705f('0x13'),auth[_0x705f('0x8')](),controller['update']);router[_0x705f('0x14')]('/:id',auth[_0x705f('0x8')](),controller['destroy']);module[_0x705f('0x15')]=router; \ No newline at end of file +var _0x4eeb=['isAuthenticated','index','/:id','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get'];(function(_0x4e4104,_0x24ac41){var _0x3787b9=function(_0x2a8171){while(--_0x2a8171){_0x4e4104['push'](_0x4e4104['shift']());}};_0x3787b9(++_0x24ac41);}(_0x4eeb,0x6e));var _0xb4ee=function(_0x42670c,_0x477805){_0x42670c=_0x42670c-0x0;var _0x3c7b38=_0x4eeb[_0x42670c];return _0x3c7b38;};'use strict';var multer=require('multer');var util=require(_0xb4ee('0x0'));var path=require(_0xb4ee('0x1'));var timeout=require(_0xb4ee('0x2'));var express=require(_0xb4ee('0x3'));var router=express['Router']();var fs_extra=require(_0xb4ee('0x4'));var auth=require(_0xb4ee('0x5'));var interaction=require(_0xb4ee('0x6'));var config=require(_0xb4ee('0x7'));var controller=require(_0xb4ee('0x8'));router[_0xb4ee('0x9')]('/',auth[_0xb4ee('0xa')](),controller[_0xb4ee('0xb')]);router[_0xb4ee('0x9')](_0xb4ee('0xc'),auth['isAuthenticated'](),controller[_0xb4ee('0xd')]);router[_0xb4ee('0x9')]('/:id/configurations',auth[_0xb4ee('0xa')](),controller['getConfigurations']);router[_0xb4ee('0x9')](_0xb4ee('0xe'),auth[_0xb4ee('0xa')](),controller[_0xb4ee('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb4ee('0x10')]);router[_0xb4ee('0x11')](_0xb4ee('0x12'),auth['isAuthenticated'](),controller[_0xb4ee('0x13')]);router[_0xb4ee('0x14')]('/:id',auth[_0xb4ee('0xa')](),controller[_0xb4ee('0x15')]);router[_0xb4ee('0x16')]('/:id',auth[_0xb4ee('0xa')](),controller[_0xb4ee('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 3879e09..5652881 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 _0x4137=['STRING','username','remoteUri','sequelize','exports'];(function(_0x15f4d3,_0x49ce9c){var _0x4366d7=function(_0x3faa60){while(--_0x3faa60){_0x15f4d3['push'](_0x15f4d3['shift']());}};_0x4366d7(++_0x49ce9c);}(_0x4137,0xf8));var _0x7413=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4137[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x7413('0x0'));module[_0x7413('0x1')]={'name':{'type':Sequelize[_0x7413('0x2')]},'description':{'type':Sequelize[_0x7413('0x2')]},'username':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x3')},'apiKey':{'type':Sequelize[_0x7413('0x2')]},'remoteUri':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x4')},'serverUrl':{'type':Sequelize[_0x7413('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1b9aa1,_0x3454cf){var _0x149c8f=function(_0x3a9400){while(--_0x3a9400){_0x1b9aa1['push'](_0x1b9aa1['shift']());}};_0x149c8f(++_0x3454cf);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x226245,_0x51c511){_0x226245=_0x226245-0x0;var _0x5af879=_0xd7d1[_0x226245];return _0x5af879;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('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 8b9f677..6700e06 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 _0x6e6c=['Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','FreshdeskConfiguration','sort','addConfiguration','AccountId','channel','Descriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set'];(function(_0x445574,_0x5e1eb5){var _0x1b9f39=function(_0x522cf4){while(--_0x522cf4){_0x445574['push'](_0x445574['shift']());}};_0x1b9f39(++_0x5e1eb5);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3a30ce,_0x314d0f){_0x314d0f=_0x314d0f||0xcc;return function(_0x33aea0){if(_0x33aea0){return _0x3a30ce[_0xc6e6('0x17')](_0x314d0f);}return _0x3a30ce['status'](_0x314d0f)[_0xc6e6('0x18')]();};}function respondWithResult(_0x2bfe7d,_0x13be73){_0x13be73=_0x13be73||0xc8;return function(_0x1b6ca9){if(_0x1b6ca9){return _0x2bfe7d[_0xc6e6('0x19')](_0x13be73)['json'](_0x1b6ca9);}};}function respondWithFilteredResult(_0x413cf8,_0x178b34){return function(_0x569474){if(_0x569474){var _0x2f11b0=typeof _0x178b34[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x178b34['limit']==='undefined';var _0x5867bf=_0x569474[_0xc6e6('0x1c')];var _0x554262=_0x2f11b0?0x0:_0x178b34[_0xc6e6('0x1a')];var _0x2069e4=_0x2f11b0?_0x569474[_0xc6e6('0x1c')]:_0x178b34[_0xc6e6('0x1a')]+_0x178b34[_0xc6e6('0x1d')];var _0x3a0d83;if(_0x2069e4>=_0x5867bf){_0x2069e4=_0x5867bf;_0x3a0d83=0xc8;}else{_0x3a0d83=0xce;}_0x413cf8[_0xc6e6('0x19')](_0x3a0d83);return _0x413cf8[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x554262+'-'+_0x2069e4+'/'+_0x5867bf)[_0xc6e6('0x20')](_0x569474);}return null;};}function patchUpdates(_0x4a36b6){return function(_0x428401){try{jsonpatch['apply'](_0x428401,_0x4a36b6,!![]);}catch(_0x1c34cc){return BPromise[_0xc6e6('0x21')](_0x1c34cc);}return _0x428401[_0xc6e6('0x22')]();};}function saveUpdates(_0x2f69f1,_0x4f1d68){return function(_0x35253d){if(_0x35253d){return _0x35253d[_0xc6e6('0x23')](_0x2f69f1)[_0xc6e6('0x24')](function(_0x36ebfa){return _0x36ebfa;});}return null;};}function removeEntity(_0x107561,_0x4c35ae){return function(_0x41fe96){if(_0x41fe96){return _0x41fe96['destroy']()[_0xc6e6('0x24')](function(){_0x107561[_0xc6e6('0x19')](0xcc)[_0xc6e6('0x18')]();});}};}function handleEntityNotFound(_0x64e1dc,_0x53a1bf){return function(_0x3ff8a4){if(!_0x3ff8a4){_0x64e1dc['sendStatus'](0x194);}return _0x3ff8a4;};}function handleError(_0x28577b,_0x534745){_0x534745=_0x534745||0x1f4;return function(_0x267c6a){logger[_0xc6e6('0x25')](_0x267c6a[_0xc6e6('0x26')]);if(_0x267c6a[_0xc6e6('0x27')]){delete _0x267c6a[_0xc6e6('0x27')];}_0x28577b['status'](_0x534745)[_0xc6e6('0x28')](_0x267c6a);};}exports[_0xc6e6('0x29')]=function(_0x166313,_0x1af05c){var _0x4d1284={},_0x34ae96={},_0x50b735={'count':0x0,'rows':[]};var _0x29411c=_[_0xc6e6('0x2a')](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')],function(_0xd3b63){return{'name':_0xd3b63[_0xc6e6('0x2d')],'type':_0xd3b63[_0xc6e6('0x2e')][_0xc6e6('0x2f')]};});_0x34ae96[_0xc6e6('0x30')]=_[_0xc6e6('0x2a')](_0x29411c,_0xc6e6('0x27'));_0x34ae96[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x166313[_0xc6e6('0x31')]);_0x34ae96[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x34ae96[_0xc6e6('0x30')],_0x34ae96['query']);_0x4d1284[_0xc6e6('0x35')]=_[_0xc6e6('0x34')](_0x34ae96['model'],qs['fields'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x4d1284[_0xc6e6('0x35')]=_0x4d1284[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x4d1284[_0xc6e6('0x35')]:_0x34ae96['model'];if(!_0x166313[_0xc6e6('0x31')][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x4d1284['limit']=qs['limit'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x1d')]);_0x4d1284[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x166313['query']['offset']);}_0x4d1284[_0xc6e6('0x3a')]=qs['sort'](_0x166313[_0xc6e6('0x31')]['sort']);_0x4d1284[_0xc6e6('0x3b')]=qs[_0xc6e6('0x33')](_[_0xc6e6('0x3c')](_0x166313[_0xc6e6('0x31')],_0x34ae96['filters']),_0x29411c);if(_0x166313['query'][_0xc6e6('0x3d')]){_0x4d1284[_0xc6e6('0x3b')]=_[_0xc6e6('0x3e')](_0x4d1284[_0xc6e6('0x3b')],{'$or':_['map'](_0x29411c,function(_0x4cbdcf){if(_0x4cbdcf[_0xc6e6('0x2e')]!==_0xc6e6('0x3f')){var _0x3a9104={};_0x3a9104[_0x4cbdcf[_0xc6e6('0x27')]]={'$like':'%'+_0x166313['query'][_0xc6e6('0x3d')]+'%'};return _0x3a9104;}})});}_0x4d1284=_[_0xc6e6('0x3e')]({},_0x4d1284,_0x166313['options']);var _0x500b7e={'where':_0x4d1284[_0xc6e6('0x3b')]};return db['FreshdeskAccount'][_0xc6e6('0x1c')](_0x500b7e)[_0xc6e6('0x24')](function(_0x53d313){_0x50b735[_0xc6e6('0x1c')]=_0x53d313;if(_0x166313['query'][_0xc6e6('0x40')]){_0x4d1284['include']=[{'all':!![]}];}return db[_0xc6e6('0x2b')][_0xc6e6('0x41')](_0x4d1284);})[_0xc6e6('0x24')](function(_0x2f7af9){_0x50b735[_0xc6e6('0x42')]=_0x2f7af9;return _0x50b735;})[_0xc6e6('0x24')](respondWithFilteredResult(_0x1af05c,_0x4d1284))[_0xc6e6('0x43')](handleError(_0x1af05c,null));};exports[_0xc6e6('0x44')]=function(_0x5ecf6c,_0x5722db){var _0x3e3da6={'raw':![],'where':{'id':_0x5ecf6c[_0xc6e6('0x45')]['id']}},_0x2b494f={};_0x2b494f[_0xc6e6('0x30')]=_['keys'](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')]);_0x2b494f[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x5ecf6c['query']);_0x2b494f[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x2b494f[_0xc6e6('0x30')],_0x2b494f[_0xc6e6('0x31')]);_0x3e3da6[_0xc6e6('0x35')]=_['intersection'](_0x2b494f[_0xc6e6('0x30')],qs['fields'](_0x5ecf6c[_0xc6e6('0x31')]['fields']));_0x3e3da6[_0xc6e6('0x35')]=_0x3e3da6[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x3e3da6[_0xc6e6('0x35')]:_0x2b494f[_0xc6e6('0x30')];if(_0x5ecf6c[_0xc6e6('0x31')][_0xc6e6('0x40')]){_0x3e3da6[_0xc6e6('0x46')]=[{'all':!![]}];}_0x3e3da6=_['merge']({},_0x3e3da6,_0x5ecf6c[_0xc6e6('0x47')]);return db[_0xc6e6('0x2b')][_0xc6e6('0x48')](_0x3e3da6)['then'](handleEntityNotFound(_0x5722db,null))[_0xc6e6('0x24')](respondWithResult(_0x5722db,null))[_0xc6e6('0x43')](handleError(_0x5722db,null));};exports[_0xc6e6('0x49')]=function(_0x42ed90,_0x7ba471){return db[_0xc6e6('0x2b')][_0xc6e6('0x49')](_0x42ed90[_0xc6e6('0x4a')],{})[_0xc6e6('0x24')](respondWithResult(_0x7ba471,0xc9))[_0xc6e6('0x43')](handleError(_0x7ba471,null));};exports[_0xc6e6('0x23')]=function(_0x470167,_0x3e0117){if(_0x470167[_0xc6e6('0x4a')]['id']){delete _0x470167['body']['id'];}return db[_0xc6e6('0x2b')]['find']({'where':{'id':_0x470167[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3e0117,null))['then'](saveUpdates(_0x470167['body'],null))['then'](respondWithResult(_0x3e0117,null))['catch'](handleError(_0x3e0117,null));};exports['destroy']=function(_0x3edc16,_0x40bbe9){return db[_0xc6e6('0x2b')][_0xc6e6('0x48')]({'where':{'id':_0x3edc16[_0xc6e6('0x45')]['id']}})['then'](handleEntityNotFound(_0x40bbe9,null))['then'](removeEntity(_0x40bbe9,null))[_0xc6e6('0x43')](handleError(_0x40bbe9,null));};exports[_0xc6e6('0x4b')]=function(_0x1aa872,_0x48ba2e,_0x577840){var _0x120a00={};var _0x467e9b={};var _0x286dc1;var _0x286dcf;return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x1aa872[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x48ba2e,null))[_0xc6e6('0x24')](function(_0x5113e3){if(_0x5113e3){_0x286dc1=_0x5113e3;_0x467e9b[_0xc6e6('0x30')]=_[_0xc6e6('0x32')](db[_0xc6e6('0x4c')][_0xc6e6('0x2c')]);_0x467e9b[_0xc6e6('0x31')]=_['keys'](_0x1aa872[_0xc6e6('0x31')]);_0x467e9b[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x467e9b[_0xc6e6('0x30')],_0x467e9b[_0xc6e6('0x31')]);_0x120a00['attributes']=_['intersection'](_0x467e9b['model'],qs[_0xc6e6('0x36')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x120a00[_0xc6e6('0x35')]=_0x120a00[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x120a00['attributes']:_0x467e9b[_0xc6e6('0x30')];_0x120a00['order']=qs[_0xc6e6('0x4d')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x4d')]);_0x120a00['where']=qs[_0xc6e6('0x33')](_['pick'](_0x1aa872[_0xc6e6('0x31')],_0x467e9b['filters']));if(_0x1aa872['query'][_0xc6e6('0x3d')]){_0x120a00['where']=_['merge'](_0x120a00[_0xc6e6('0x3b')],{'$or':_[_0xc6e6('0x2a')](_0x120a00[_0xc6e6('0x35')],function(_0x20c4cf){var _0x414bc4={};_0x414bc4[_0x20c4cf]={'$like':'%'+_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x3d')]+'%'};return _0x414bc4;})});}_0x120a00=_[_0xc6e6('0x3e')]({},_0x120a00,_0x1aa872['options']);return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x35b43f){if(_0x35b43f){_0x286dcf=_0x35b43f[_0xc6e6('0x37')];if(!_0x1aa872['query'][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x120a00[_0xc6e6('0x1d')]=qs['limit'](_0x1aa872['query'][_0xc6e6('0x1d')]);_0x120a00['offset']=qs['offset'](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x1a')]);}return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x269f63){if(_0x269f63){return _0x269f63?{'count':_0x286dcf,'rows':_0x269f63}:null;}})[_0xc6e6('0x24')](respondWithResult(_0x48ba2e,null))[_0xc6e6('0x43')](handleError(_0x48ba2e,null));};exports[_0xc6e6('0x4e')]=function(_0x8bfc70,_0x1956be,_0x15404a){if(_0x8bfc70['body']['id']){delete _0x8bfc70['body']['id'];}return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x8bfc70['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x1956be,null))[_0xc6e6('0x24')](function(_0x27c5f0){if(_0x27c5f0){_0x8bfc70['body'][_0xc6e6('0x4f')]=_0x27c5f0['id'];_0x8bfc70[_0xc6e6('0x4a')]['Subjects']=integrations['getSubjects'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x51')]=integrations['getDescriptions'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);return db[_0xc6e6('0x4c')]['create'](_0x8bfc70[_0xc6e6('0x4a')],{'include':[{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x53')},{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x51')}]});}return null;})[_0xc6e6('0x24')](respondWithResult(_0x1956be,null))['catch'](handleError(_0x1956be,null));};exports[_0xc6e6('0x54')]=function(_0x4c4985,_0x46c3df,_0x5c2cfc){var _0x55cec5='';return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x4c4985[_0xc6e6('0x45')]['id']},'attributes':['id',_0xc6e6('0x55'),_0xc6e6('0x56')]})[_0xc6e6('0x24')](handleEntityNotFound(_0x46c3df,null))[_0xc6e6('0x24')](function(_0x5a9ba5){if(_0x5a9ba5){_0x55cec5=_0x5a9ba5[_0xc6e6('0x55')];var _0x5c09b0=_0x55cec5['slice'](-0x1);if(_0x5c09b0==='/'){_0x55cec5=_0x55cec5[_0xc6e6('0x57')](0x0,_0x55cec5[_0xc6e6('0x58')](_0x5c09b0));}return rp({'method':_0xc6e6('0x59'),'uri':util['format'](_0xc6e6('0x5a'),_0x55cec5,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0xc6e6('0x5b'),new Buffer(util['format'](_0xc6e6('0x5c'),_0x5a9ba5[_0xc6e6('0x56')]))[_0xc6e6('0x5d')](_0xc6e6('0x5e')))},'json':!![]});}})['then'](function(_0x2d0d4d){if(_0x2d0d4d){var _0x9306c=[_0xc6e6('0x5f'),_0xc6e6('0x60'),_0xc6e6('0x61'),'description',_0xc6e6('0x19'),_0xc6e6('0x62'),_0xc6e6('0x63'),_0xc6e6('0x64'),'ticket_type','group',_0xc6e6('0x65')];_[_0xc6e6('0x66')](_0x2d0d4d,function(_0x42159c){return _0x9306c[_0xc6e6('0x67')](_0x42159c[_0xc6e6('0x27')])||!_0x42159c[_0xc6e6('0x68')]&&_0x42159c[_0xc6e6('0x2e')]!==_0xc6e6('0x69')&&_0x42159c[_0xc6e6('0x2e')]!=='custom_dropdown';});return{'count':_0x2d0d4d['length'],'rows':_[_0xc6e6('0x2a')](_0x2d0d4d,function(_0x5c9b92){return{'id':_0x5c9b92[_0xc6e6('0x27')],'name':_0x5c9b92[_0xc6e6('0x6a')],'custom':!_0x5c9b92[_0xc6e6('0x68')],'options':_0x5c9b92['choices']?_['map'](_0x5c9b92[_0xc6e6('0x6b')],function(_0x58b236){return{'name':_[_0xc6e6('0x6c')](_0x58b236),'value':_0x58b236};}):[]};})};}})['then'](respondWithResult(_0x46c3df,null))[_0xc6e6('0x43')](function(_0x3403b7){var _0x5d867e=_0x4c4985[_0xc6e6('0x31')][_0xc6e6('0x6d')]?0x1f4:_0x3403b7[_0xc6e6('0x6e')]||0x1f4;logger['error'](_0xc6e6('0x6f'),_0xc6e6('0x54'),_0x5d867e,JSON[_0xc6e6('0x70')](_0x3403b7));delete _0x3403b7['name'];if(_0x5d867e===0x191){_0x5d867e=0x190;}_0x46c3df[_0xc6e6('0x19')](_0x5d867e)[_0xc6e6('0x28')](_0x4c4985['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x3403b7[_0xc6e6('0x6e')]}:_0x3403b7);});}; \ No newline at end of file +var _0x9c00=['include','findAll','catch','show','find','create','body','update','params','destroy','findOne','filter','options','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshdeskConfiguration','FreshdeskField','Subjects','remoteUri','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','source','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll'];(function(_0x5784d4,_0x5f5805){var _0x146851=function(_0xde22a2){while(--_0xde22a2){_0x5784d4['push'](_0x5784d4['shift']());}};_0x146851(++_0x5f5805);}(_0x9c00,0x1a0));var _0x09c0=function(_0x185369,_0x46be46){_0x185369=_0x185369-0x0;var _0x4b98ba=_0x9c00[_0x185369];return _0x4b98ba;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];var integrations=require(_0x09c0('0x1b'));function respondWithStatusCode(_0x3b95cc,_0x331905){_0x331905=_0x331905||0xcc;return function(_0x6149a8){if(_0x6149a8){return _0x3b95cc[_0x09c0('0x1c')](_0x331905);}return _0x3b95cc[_0x09c0('0x1d')](_0x331905)[_0x09c0('0x1e')]();};}function respondWithResult(_0x16e490,_0x254598){_0x254598=_0x254598||0xc8;return function(_0x152140){if(_0x152140){return _0x16e490[_0x09c0('0x1d')](_0x254598)[_0x09c0('0x1f')](_0x152140);}};}function respondWithFilteredResult(_0x2fdf11,_0x4ff6b7){return function(_0x590129){if(_0x590129){var _0x558b4f=typeof _0x4ff6b7[_0x09c0('0x20')]===_0x09c0('0x21')&&typeof _0x4ff6b7[_0x09c0('0x22')]===_0x09c0('0x21');var _0x5dcab7=_0x590129[_0x09c0('0x23')];var _0x4aa8a5=_0x558b4f?0x0:_0x4ff6b7['offset'];var _0x2c12da=_0x558b4f?_0x590129['count']:_0x4ff6b7[_0x09c0('0x20')]+_0x4ff6b7[_0x09c0('0x22')];var _0x2da257;if(_0x2c12da>=_0x5dcab7){_0x2c12da=_0x5dcab7;_0x2da257=0xc8;}else{_0x2da257=0xce;}_0x2fdf11['status'](_0x2da257);return _0x2fdf11[_0x09c0('0x24')](_0x09c0('0x25'),_0x4aa8a5+'-'+_0x2c12da+'/'+_0x5dcab7)[_0x09c0('0x1f')](_0x590129);}return null;};}function patchUpdates(_0x3447c5){return function(_0x12bba7){try{jsonpatch[_0x09c0('0x26')](_0x12bba7,_0x3447c5,!![]);}catch(_0x8c6b9a){return BPromise['reject'](_0x8c6b9a);}return _0x12bba7[_0x09c0('0x27')]();};}function saveUpdates(_0x46f171,_0x473fbd){return function(_0x1d18e9){if(_0x1d18e9){return _0x1d18e9['update'](_0x46f171)['then'](function(_0x321bcc){return _0x321bcc;});}return null;};}function removeEntity(_0x25fdb5,_0x1e8a1c){return function(_0x3a5370){if(_0x3a5370){return _0x3a5370['destroy']()[_0x09c0('0x28')](function(){_0x25fdb5[_0x09c0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c7202,_0x163a59){return function(_0x2e3d4d){if(!_0x2e3d4d){_0x2c7202[_0x09c0('0x1c')](0x194);}return _0x2e3d4d;};}function handleError(_0x1f8131,_0x1d2d9d){_0x1d2d9d=_0x1d2d9d||0x1f4;return function(_0x45cc64){logger[_0x09c0('0x29')](_0x45cc64[_0x09c0('0x2a')]);if(_0x45cc64[_0x09c0('0x2b')]){delete _0x45cc64[_0x09c0('0x2b')];}_0x1f8131['status'](_0x1d2d9d)[_0x09c0('0x2c')](_0x45cc64);};}exports[_0x09c0('0x2d')]=function(_0x53a7b8,_0x1d09e0){var _0x5aa0b9={},_0x3f5b10={},_0x4d6bdc={'count':0x0,'rows':[]};var _0x3ac8e4=_[_0x09c0('0x2e')](db[_0x09c0('0x2f')][_0x09c0('0x30')],function(_0x4e999a){return{'name':_0x4e999a['fieldName'],'type':_0x4e999a[_0x09c0('0x31')][_0x09c0('0x32')]};});_0x3f5b10[_0x09c0('0x33')]=_['map'](_0x3ac8e4,_0x09c0('0x2b'));_0x3f5b10['query']=_[_0x09c0('0x34')](_0x53a7b8[_0x09c0('0x35')]);_0x3f5b10[_0x09c0('0x36')]=_['intersection'](_0x3f5b10[_0x09c0('0x33')],_0x3f5b10[_0x09c0('0x35')]);_0x5aa0b9[_0x09c0('0x37')]=_[_0x09c0('0x38')](_0x3f5b10[_0x09c0('0x33')],qs[_0x09c0('0x39')](_0x53a7b8[_0x09c0('0x35')]['fields']));_0x5aa0b9[_0x09c0('0x37')]=_0x5aa0b9[_0x09c0('0x37')][_0x09c0('0x3a')]?_0x5aa0b9[_0x09c0('0x37')]:_0x3f5b10[_0x09c0('0x33')];if(!_0x53a7b8['query'][_0x09c0('0x3b')](_0x09c0('0x3c'))){_0x5aa0b9[_0x09c0('0x22')]=qs[_0x09c0('0x22')](_0x53a7b8[_0x09c0('0x35')]['limit']);_0x5aa0b9[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x53a7b8[_0x09c0('0x35')][_0x09c0('0x20')]);}_0x5aa0b9[_0x09c0('0x3d')]=qs[_0x09c0('0x3e')](_0x53a7b8[_0x09c0('0x35')]['sort']);_0x5aa0b9[_0x09c0('0x3f')]=qs[_0x09c0('0x36')](_[_0x09c0('0x40')](_0x53a7b8[_0x09c0('0x35')],_0x3f5b10[_0x09c0('0x36')]),_0x3ac8e4);if(_0x53a7b8['query']['filter']){_0x5aa0b9['where']=_['merge'](_0x5aa0b9[_0x09c0('0x3f')],{'$or':_[_0x09c0('0x2e')](_0x3ac8e4,function(_0xfd295b){if(_0xfd295b[_0x09c0('0x31')]!==_0x09c0('0x41')){var _0x4bd637={};_0x4bd637[_0xfd295b[_0x09c0('0x2b')]]={'$like':'%'+_0x53a7b8[_0x09c0('0x35')]['filter']+'%'};return _0x4bd637;}})});}_0x5aa0b9=_[_0x09c0('0x42')]({},_0x5aa0b9,_0x53a7b8['options']);var _0x3ee063={'where':_0x5aa0b9['where']};return db[_0x09c0('0x2f')][_0x09c0('0x23')](_0x3ee063)['then'](function(_0x26a21c){_0x4d6bdc[_0x09c0('0x23')]=_0x26a21c;if(_0x53a7b8['query'][_0x09c0('0x43')]){_0x5aa0b9[_0x09c0('0x44')]=[{'all':!![]}];}return db[_0x09c0('0x2f')][_0x09c0('0x45')](_0x5aa0b9);})[_0x09c0('0x28')](function(_0x34326c){_0x4d6bdc['rows']=_0x34326c;return _0x4d6bdc;})[_0x09c0('0x28')](respondWithFilteredResult(_0x1d09e0,_0x5aa0b9))[_0x09c0('0x46')](handleError(_0x1d09e0,null));};exports[_0x09c0('0x47')]=function(_0x57835c,_0x193ed2){var _0x30c0c5={'raw':![],'where':{'id':_0x57835c['params']['id']}},_0x447224={};_0x447224[_0x09c0('0x33')]=_[_0x09c0('0x34')](db['FreshdeskAccount']['rawAttributes']);_0x447224[_0x09c0('0x35')]=_[_0x09c0('0x34')](_0x57835c['query']);_0x447224[_0x09c0('0x36')]=_[_0x09c0('0x38')](_0x447224['model'],_0x447224[_0x09c0('0x35')]);_0x30c0c5[_0x09c0('0x37')]=_[_0x09c0('0x38')](_0x447224[_0x09c0('0x33')],qs[_0x09c0('0x39')](_0x57835c['query'][_0x09c0('0x39')]));_0x30c0c5['attributes']=_0x30c0c5['attributes'][_0x09c0('0x3a')]?_0x30c0c5[_0x09c0('0x37')]:_0x447224[_0x09c0('0x33')];if(_0x57835c[_0x09c0('0x35')][_0x09c0('0x43')]){_0x30c0c5[_0x09c0('0x44')]=[{'all':!![]}];}_0x30c0c5=_['merge']({},_0x30c0c5,_0x57835c['options']);return db['FreshdeskAccount'][_0x09c0('0x48')](_0x30c0c5)[_0x09c0('0x28')](handleEntityNotFound(_0x193ed2,null))[_0x09c0('0x28')](respondWithResult(_0x193ed2,null))['catch'](handleError(_0x193ed2,null));};exports[_0x09c0('0x49')]=function(_0xff9650,_0x2016f1){return db[_0x09c0('0x2f')][_0x09c0('0x49')](_0xff9650[_0x09c0('0x4a')],{})[_0x09c0('0x28')](respondWithResult(_0x2016f1,0xc9))[_0x09c0('0x46')](handleError(_0x2016f1,null));};exports[_0x09c0('0x4b')]=function(_0x38085c,_0x1b0198){if(_0x38085c[_0x09c0('0x4a')]['id']){delete _0x38085c[_0x09c0('0x4a')]['id'];}return db[_0x09c0('0x2f')][_0x09c0('0x48')]({'where':{'id':_0x38085c[_0x09c0('0x4c')]['id']}})[_0x09c0('0x28')](handleEntityNotFound(_0x1b0198,null))[_0x09c0('0x28')](saveUpdates(_0x38085c[_0x09c0('0x4a')],null))[_0x09c0('0x28')](respondWithResult(_0x1b0198,null))['catch'](handleError(_0x1b0198,null));};exports[_0x09c0('0x4d')]=function(_0x44befb,_0x15b0a2){return db[_0x09c0('0x2f')][_0x09c0('0x48')]({'where':{'id':_0x44befb['params']['id']}})[_0x09c0('0x28')](handleEntityNotFound(_0x15b0a2,null))[_0x09c0('0x28')](removeEntity(_0x15b0a2,null))[_0x09c0('0x46')](handleError(_0x15b0a2,null));};exports['getConfigurations']=function(_0xe0b82a,_0x18c728,_0x14b701){var _0x25a36a={};var _0x55b0f0={};var _0xebfd6d;var _0x45ecd0;return db['FreshdeskAccount'][_0x09c0('0x4e')]({'where':{'id':_0xe0b82a[_0x09c0('0x4c')]['id']}})[_0x09c0('0x28')](handleEntityNotFound(_0x18c728,null))[_0x09c0('0x28')](function(_0x21fe00){if(_0x21fe00){_0xebfd6d=_0x21fe00;_0x55b0f0[_0x09c0('0x33')]=_[_0x09c0('0x34')](db['FreshdeskConfiguration']['rawAttributes']);_0x55b0f0[_0x09c0('0x35')]=_[_0x09c0('0x34')](_0xe0b82a[_0x09c0('0x35')]);_0x55b0f0['filters']=_[_0x09c0('0x38')](_0x55b0f0['model'],_0x55b0f0[_0x09c0('0x35')]);_0x25a36a[_0x09c0('0x37')]=_[_0x09c0('0x38')](_0x55b0f0[_0x09c0('0x33')],qs[_0x09c0('0x39')](_0xe0b82a[_0x09c0('0x35')][_0x09c0('0x39')]));_0x25a36a['attributes']=_0x25a36a[_0x09c0('0x37')][_0x09c0('0x3a')]?_0x25a36a[_0x09c0('0x37')]:_0x55b0f0[_0x09c0('0x33')];_0x25a36a[_0x09c0('0x3d')]=qs[_0x09c0('0x3e')](_0xe0b82a[_0x09c0('0x35')][_0x09c0('0x3e')]);_0x25a36a[_0x09c0('0x3f')]=qs[_0x09c0('0x36')](_[_0x09c0('0x40')](_0xe0b82a['query'],_0x55b0f0[_0x09c0('0x36')]));if(_0xe0b82a[_0x09c0('0x35')][_0x09c0('0x4f')]){_0x25a36a[_0x09c0('0x3f')]=_['merge'](_0x25a36a[_0x09c0('0x3f')],{'$or':_['map'](_0x25a36a[_0x09c0('0x37')],function(_0x9a4f4){var _0x1cfdb3={};_0x1cfdb3[_0x9a4f4]={'$like':'%'+_0xe0b82a['query']['filter']+'%'};return _0x1cfdb3;})});}_0x25a36a=_[_0x09c0('0x42')]({},_0x25a36a,_0xe0b82a[_0x09c0('0x50')]);return _0xebfd6d[_0x09c0('0x51')](_0x25a36a);}})[_0x09c0('0x28')](function(_0x4b65c7){if(_0x4b65c7){_0x45ecd0=_0x4b65c7[_0x09c0('0x3a')];if(!_0xe0b82a[_0x09c0('0x35')]['hasOwnProperty'](_0x09c0('0x3c'))){_0x25a36a[_0x09c0('0x22')]=qs[_0x09c0('0x22')](_0xe0b82a[_0x09c0('0x35')]['limit']);_0x25a36a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0xe0b82a[_0x09c0('0x35')][_0x09c0('0x20')]);}return _0xebfd6d[_0x09c0('0x51')](_0x25a36a);}})[_0x09c0('0x28')](function(_0x30d976){if(_0x30d976){return _0x30d976?{'count':_0x45ecd0,'rows':_0x30d976}:null;}})[_0x09c0('0x28')](respondWithResult(_0x18c728,null))[_0x09c0('0x46')](handleError(_0x18c728,null));};exports[_0x09c0('0x52')]=function(_0x85adc7,_0x2906cb,_0x2d67e8){if(_0x85adc7['body']['id']){delete _0x85adc7[_0x09c0('0x4a')]['id'];}return db[_0x09c0('0x2f')][_0x09c0('0x4e')]({'where':{'id':_0x85adc7[_0x09c0('0x4c')]['id']}})[_0x09c0('0x28')](handleEntityNotFound(_0x2906cb,null))['then'](function(_0x1205da){if(_0x1205da){_0x85adc7[_0x09c0('0x4a')][_0x09c0('0x53')]=_0x1205da['id'];_0x85adc7[_0x09c0('0x4a')]['Subjects']=integrations[_0x09c0('0x54')](_0x85adc7[_0x09c0('0x4a')]['channel'],_0x85adc7[_0x09c0('0x4a')][_0x09c0('0x31')]);_0x85adc7[_0x09c0('0x4a')][_0x09c0('0x55')]=integrations[_0x09c0('0x56')](_0x85adc7['body'][_0x09c0('0x57')],_0x85adc7[_0x09c0('0x4a')][_0x09c0('0x31')]);return db[_0x09c0('0x58')][_0x09c0('0x49')](_0x85adc7['body'],{'include':[{'model':db[_0x09c0('0x59')],'as':_0x09c0('0x5a')},{'model':db[_0x09c0('0x59')],'as':_0x09c0('0x55')}]});}return null;})[_0x09c0('0x28')](respondWithResult(_0x2906cb,null))[_0x09c0('0x46')](handleError(_0x2906cb,null));};exports['getFields']=function(_0x51fc84,_0x583c0d,_0x52fe65){var _0x7c1cb8='';return db[_0x09c0('0x2f')][_0x09c0('0x4e')]({'where':{'id':_0x51fc84['params']['id']},'attributes':['id',_0x09c0('0x5b'),'apiKey']})[_0x09c0('0x28')](handleEntityNotFound(_0x583c0d,null))[_0x09c0('0x28')](function(_0x5732ae){if(_0x5732ae){_0x7c1cb8=_0x5732ae[_0x09c0('0x5b')];var _0x48d41f=_0x7c1cb8['slice'](-0x1);if(_0x48d41f==='/'){_0x7c1cb8=_0x7c1cb8[_0x09c0('0x5c')](0x0,_0x7c1cb8[_0x09c0('0x5d')](_0x48d41f));}return rp({'method':_0x09c0('0x5e'),'uri':util[_0x09c0('0x5f')](_0x09c0('0x60'),_0x7c1cb8,_0x09c0('0x61')),'headers':{'Authorization':util[_0x09c0('0x5f')](_0x09c0('0x62'),new Buffer(util[_0x09c0('0x5f')](_0x09c0('0x63'),_0x5732ae['apiKey']))[_0x09c0('0x64')](_0x09c0('0x65')))},'json':!![]});}})['then'](function(_0x4e1d42){if(_0x4e1d42){var _0xb66871=[_0x09c0('0x66'),_0x09c0('0x67'),_0x09c0('0x68'),_0x09c0('0x69'),_0x09c0('0x1d'),_0x09c0('0x6a'),'group',_0x09c0('0x6b'),'ticket_type',_0x09c0('0x6c'),_0x09c0('0x6d')];_[_0x09c0('0x6e')](_0x4e1d42,function(_0x1a81b1){return _0xb66871[_0x09c0('0x6f')](_0x1a81b1['name'])||!_0x1a81b1[_0x09c0('0x70')]&&_0x1a81b1['type']!==_0x09c0('0x71')&&_0x1a81b1['type']!==_0x09c0('0x72');});return{'count':_0x4e1d42[_0x09c0('0x3a')],'rows':_[_0x09c0('0x2e')](_0x4e1d42,function(_0x3efd93){return{'id':_0x3efd93[_0x09c0('0x2b')],'name':_0x3efd93[_0x09c0('0x73')],'custom':!_0x3efd93[_0x09c0('0x70')],'options':_0x3efd93['choices']?_['map'](_0x3efd93[_0x09c0('0x74')],function(_0x430a78){return{'name':_[_0x09c0('0x75')](_0x430a78),'value':_0x430a78};}):[]};})};}})[_0x09c0('0x28')](respondWithResult(_0x583c0d,null))[_0x09c0('0x46')](function(_0x1041d9){var _0x4060bb=_0x51fc84[_0x09c0('0x35')][_0x09c0('0x76')]?0x1f4:_0x1041d9[_0x09c0('0x77')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4060bb,JSON[_0x09c0('0x78')](_0x1041d9));delete _0x1041d9[_0x09c0('0x2b')];if(_0x4060bb===0x191){_0x4060bb=0x190;}_0x583c0d[_0x09c0('0x1d')](_0x4060bb)['send'](_0x51fc84['query'][_0x09c0('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x1041d9[_0x09c0('0x77')]}:_0x1041d9);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e82a0af..420fddb 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 _0x53a4=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','rimraf'];(function(_0x287cb4,_0x4156fb){var _0x4c2643=function(_0x4bc5c6){while(--_0x4bc5c6){_0x287cb4['push'](_0x287cb4['shift']());}};_0x4c2643(++_0x4156fb);}(_0x53a4,0x11b));var _0x453a=function(_0x1e8312,_0x205031){_0x1e8312=_0x1e8312-0x0;var _0xd40c29=_0x53a4[_0x1e8312];return _0xd40c29;};'use strict';var _=require(_0x453a('0x0'));var util=require('util');var logger=require(_0x453a('0x1'))(_0x453a('0x2'));var moment=require(_0x453a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x453a('0x4'));var config=require(_0x453a('0x5'));var attributes=require(_0x453a('0x6'));var integrations=require(_0x453a('0x7'));module[_0x453a('0x8')]=function(_0x155d12,_0x366ffc){return _0x155d12[_0x453a('0x9')](_0x453a('0xa'),attributes,{'tableName':_0x453a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ec9=['../../config/logger','api','bluebird','request-promise','path','rimraf','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x4dc547,_0x218ebf){var _0x2e76a6=function(_0x5abee6){while(--_0x5abee6){_0x4dc547['push'](_0x4dc547['shift']());}};_0x2e76a6(++_0x218ebf);}(_0x9ec9,0xda));var _0x99ec=function(_0x52de48,_0x5bc748){_0x52de48=_0x52de48-0x0;var _0x18f4c0=_0x9ec9[_0x52de48];return _0x18f4c0;};'use strict';var _=require(_0x99ec('0x0'));var util=require(_0x99ec('0x1'));var logger=require(_0x99ec('0x2'))(_0x99ec('0x3'));var moment=require('moment');var BPromise=require(_0x99ec('0x4'));var rp=require(_0x99ec('0x5'));var fs=require('fs');var path=require(_0x99ec('0x6'));var rimraf=require(_0x99ec('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x57702f,_0x4bc25e){return _0x57702f[_0x99ec('0x8')](_0x99ec('0x9'),attributes,{'tableName':_0x99ec('0xa'),'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 d494e25..10f9462 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 _0xb82a=['../../config/logger','rpc','jayson/promise','client','http','info','debug','request\x20sent','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','findAll','raw','options','where','attributes','limit','map','include','model','then','stringify','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xb82a,0x82));var _0xab82=function(_0x20acc6,_0x731a64){_0x20acc6=_0x20acc6-0x0;var _0xd8ab66=_0xb82a[_0x20acc6];return _0xd8ab66;};'use strict';var _=require(_0xab82('0x0'));var util=require(_0xab82('0x1'));var moment=require(_0xab82('0x2'));var BPromise=require(_0xab82('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab82('0x4'))['db'];var utils=require(_0xab82('0x5'));var logger=require(_0xab82('0x6'))(_0xab82('0x7'));var config=require('../../config/environment');var jayson=require(_0xab82('0x8'));var client=jayson[_0xab82('0x9')][_0xab82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaf6f52,_0x371fbb,_0xdba845){return new BPromise(function(_0x59add3,_0x64f133){return client['request'](_0xaf6f52,_0xdba845)['then'](function(_0xf9df7d){logger[_0xab82('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x371fbb,'request\x20sent');logger[_0xab82('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x371fbb,_0xab82('0xd'),JSON['stringify'](_0xf9df7d));if(_0xf9df7d[_0xab82('0xe')]){if(_0xf9df7d[_0xab82('0xe')][_0xab82('0xf')]===0x1f4){logger[_0xab82('0xe')](_0xab82('0x10'),_0x371fbb,_0xf9df7d[_0xab82('0xe')][_0xab82('0x11')]);return _0x64f133(_0xf9df7d[_0xab82('0xe')][_0xab82('0x11')]);}logger[_0xab82('0xe')](_0xab82('0x10'),_0x371fbb,_0xf9df7d[_0xab82('0xe')]['message']);return _0x59add3(_0xf9df7d[_0xab82('0xe')][_0xab82('0x11')]);}else{logger['info'](_0xab82('0x10'),_0x371fbb,_0xab82('0xd'));_0x59add3(_0xf9df7d[_0xab82('0x12')]['message']);}})[_0xab82('0x13')](function(_0x16a49a){logger[_0xab82('0xe')](_0xab82('0x10'),_0x371fbb,_0x16a49a);_0x64f133(_0x16a49a);});});}exports[_0xab82('0x14')]=function(_0x123f6c){var _0x5b2b10=this;return new Promise(function(_0x568089,_0x126092){return db['FreshdeskAccount'][_0xab82('0x15')]({'raw':_0x123f6c['options']?_0x123f6c['options'][_0xab82('0x16')]===undefined?!![]:![]:!![],'where':_0x123f6c[_0xab82('0x17')]?_0x123f6c[_0xab82('0x17')][_0xab82('0x18')]||null:null,'attributes':_0x123f6c['options']?_0x123f6c[_0xab82('0x17')][_0xab82('0x19')]||null:null,'limit':_0x123f6c['options']?_0x123f6c[_0xab82('0x17')][_0xab82('0x1a')]||null:null,'include':_0x123f6c[_0xab82('0x17')]?_0x123f6c['options']['include']?_[_0xab82('0x1b')](_0x123f6c[_0xab82('0x17')][_0xab82('0x1c')],function(_0x3724ae){return{'model':db[_0x3724ae[_0xab82('0x1d')]],'as':_0x3724ae['as'],'attributes':_0x3724ae[_0xab82('0x19')],'include':_0x3724ae['include']?_[_0xab82('0x1b')](_0x3724ae[_0xab82('0x1c')],function(_0x925d38){return{'model':db[_0x925d38[_0xab82('0x1d')]],'as':_0x925d38['as'],'attributes':_0x925d38['attributes'],'include':_0x925d38[_0xab82('0x1c')]?_['map'](_0x925d38[_0xab82('0x1c')],function(_0x520d4a){return{'model':db[_0x520d4a[_0xab82('0x1d')]],'as':_0x520d4a['as'],'attributes':_0x520d4a[_0xab82('0x19')]};}):[]};}):[]};}):[]:[]})[_0xab82('0x1e')](function(_0x5918da){logger[_0xab82('0xb')](_0xab82('0x14'),_0x123f6c);logger[_0xab82('0xc')](_0xab82('0x14'),_0x123f6c,JSON[_0xab82('0x1f')](_0x5918da));_0x568089(_0x5918da);})[_0xab82('0x13')](function(_0x369577){logger['error'](_0xab82('0x14'),_0x369577['message'],_0x123f6c);_0x126092(_0x5b2b10['error'](0x1f4,_0x369577[_0xab82('0x11')]));});});};exports[_0xab82('0x20')]=function(_0x17d001){var _0x33727d=this;return new Promise(function(_0x16daff,_0x27b521){return db['FreshdeskAccount'][_0xab82('0x21')]({'raw':_0x17d001[_0xab82('0x17')]?_0x17d001[_0xab82('0x17')][_0xab82('0x16')]===undefined?!![]:![]:!![],'where':_0x17d001[_0xab82('0x17')]?_0x17d001[_0xab82('0x17')][_0xab82('0x18')]||null:null,'attributes':_0x17d001['options']?_0x17d001[_0xab82('0x17')][_0xab82('0x19')]||null:null,'include':_0x17d001[_0xab82('0x17')]?_0x17d001[_0xab82('0x17')][_0xab82('0x1c')]?_['map'](_0x17d001['options'][_0xab82('0x1c')],function(_0x42c801){return{'model':db[_0x42c801[_0xab82('0x1d')]],'as':_0x42c801['as'],'attributes':_0x42c801['attributes'],'include':_0x42c801['include']?_[_0xab82('0x1b')](_0x42c801[_0xab82('0x1c')],function(_0x453456){return{'model':db[_0x453456['model']],'as':_0x453456['as'],'attributes':_0x453456[_0xab82('0x19')],'include':_0x453456[_0xab82('0x1c')]?_['map'](_0x453456['include'],function(_0x59b4f1){return{'model':db[_0x59b4f1[_0xab82('0x1d')]],'as':_0x59b4f1['as'],'attributes':_0x59b4f1[_0xab82('0x19')]};}):[]};}):[]};}):[]:[]})[_0xab82('0x1e')](function(_0x491f8c){logger[_0xab82('0xb')](_0xab82('0x20'),_0x17d001);logger['debug']('ShowFreshdeskAccount',_0x17d001,JSON['stringify'](_0x491f8c));_0x16daff(_0x491f8c);})['catch'](function(_0x1af6c4){logger[_0xab82('0xe')](_0xab82('0x20'),_0x1af6c4['message'],_0x17d001);_0x27b521(_0x33727d[_0xab82('0xe')](0x1f4,_0x1af6c4[_0xab82('0x11')]));});});}; \ No newline at end of file +var _0x827e=['find','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x827e,0x155));var _0xe827=function(_0x2f7c37,_0x4f1d3b){_0x2f7c37=_0x2f7c37-0x0;var _0x42b947=_0x827e[_0x2f7c37];return _0x42b947;};'use strict';var _=require('lodash');var util=require(_0xe827('0x0'));var moment=require(_0xe827('0x1'));var BPromise=require('bluebird');var rs=require(_0xe827('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe827('0x3'))['db'];var utils=require(_0xe827('0x4'));var logger=require(_0xe827('0x5'))('rpc');var config=require(_0xe827('0x6'));var jayson=require(_0xe827('0x7'));var client=jayson[_0xe827('0x8')][_0xe827('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3676b9,_0x1b7aba,_0xc60e0d){return new BPromise(function(_0x263c56,_0x5c8a7c){return client[_0xe827('0xa')](_0x3676b9,_0xc60e0d)[_0xe827('0xb')](function(_0x3e2f4c){logger[_0xe827('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x1b7aba,_0xe827('0xd'));logger[_0xe827('0xe')](_0xe827('0xf'),_0x1b7aba,'request\x20sent',JSON[_0xe827('0x10')](_0x3e2f4c));if(_0x3e2f4c[_0xe827('0x11')]){if(_0x3e2f4c[_0xe827('0x11')]['code']===0x1f4){logger['error'](_0xe827('0x12'),_0x1b7aba,_0x3e2f4c[_0xe827('0x11')][_0xe827('0x13')]);return _0x5c8a7c(_0x3e2f4c[_0xe827('0x11')][_0xe827('0x13')]);}logger[_0xe827('0x11')](_0xe827('0x12'),_0x1b7aba,_0x3e2f4c['error'][_0xe827('0x13')]);return _0x263c56(_0x3e2f4c['error']['message']);}else{logger['info'](_0xe827('0x12'),_0x1b7aba,_0xe827('0xd'));_0x263c56(_0x3e2f4c[_0xe827('0x14')][_0xe827('0x13')]);}})[_0xe827('0x15')](function(_0x4bb77f){logger[_0xe827('0x11')](_0xe827('0x12'),_0x1b7aba,_0x4bb77f);_0x5c8a7c(_0x4bb77f);});});}exports['GetFreshdeskAccount']=function(_0x2bfad3){var _0x280056=this;return new Promise(function(_0x308f8b,_0x5e972e){return db[_0xe827('0x16')][_0xe827('0x17')]({'raw':_0x2bfad3[_0xe827('0x18')]?_0x2bfad3[_0xe827('0x18')][_0xe827('0x19')]===undefined?!![]:![]:!![],'where':_0x2bfad3[_0xe827('0x18')]?_0x2bfad3[_0xe827('0x18')][_0xe827('0x1a')]||null:null,'attributes':_0x2bfad3[_0xe827('0x18')]?_0x2bfad3[_0xe827('0x18')][_0xe827('0x1b')]||null:null,'limit':_0x2bfad3[_0xe827('0x18')]?_0x2bfad3[_0xe827('0x18')]['limit']||null:null,'include':_0x2bfad3['options']?_0x2bfad3['options'][_0xe827('0x1c')]?_[_0xe827('0x1d')](_0x2bfad3['options']['include'],function(_0x56a2f5){return{'model':db[_0x56a2f5[_0xe827('0x1e')]],'as':_0x56a2f5['as'],'attributes':_0x56a2f5['attributes'],'include':_0x56a2f5[_0xe827('0x1c')]?_[_0xe827('0x1d')](_0x56a2f5['include'],function(_0x4ddb08){return{'model':db[_0x4ddb08[_0xe827('0x1e')]],'as':_0x4ddb08['as'],'attributes':_0x4ddb08[_0xe827('0x1b')],'include':_0x4ddb08['include']?_[_0xe827('0x1d')](_0x4ddb08['include'],function(_0x83e833){return{'model':db[_0x83e833['model']],'as':_0x83e833['as'],'attributes':_0x83e833[_0xe827('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe827('0xb')](function(_0x350da4){logger[_0xe827('0xc')]('GetFreshdeskAccount',_0x2bfad3);logger[_0xe827('0xe')](_0xe827('0x1f'),_0x2bfad3,JSON[_0xe827('0x10')](_0x350da4));_0x308f8b(_0x350da4);})[_0xe827('0x15')](function(_0x28d809){logger['error']('GetFreshdeskAccount',_0x28d809[_0xe827('0x13')],_0x2bfad3);_0x5e972e(_0x280056[_0xe827('0x11')](0x1f4,_0x28d809['message']));});});};exports[_0xe827('0x20')]=function(_0x541edf){var _0x5c5ecb=this;return new Promise(function(_0x2db2a8,_0x4278fc){return db[_0xe827('0x16')][_0xe827('0x21')]({'raw':_0x541edf['options']?_0x541edf['options'][_0xe827('0x19')]===undefined?!![]:![]:!![],'where':_0x541edf['options']?_0x541edf[_0xe827('0x18')][_0xe827('0x1a')]||null:null,'attributes':_0x541edf[_0xe827('0x18')]?_0x541edf[_0xe827('0x18')][_0xe827('0x1b')]||null:null,'include':_0x541edf['options']?_0x541edf[_0xe827('0x18')]['include']?_[_0xe827('0x1d')](_0x541edf[_0xe827('0x18')][_0xe827('0x1c')],function(_0x1a6f4b){return{'model':db[_0x1a6f4b[_0xe827('0x1e')]],'as':_0x1a6f4b['as'],'attributes':_0x1a6f4b['attributes'],'include':_0x1a6f4b[_0xe827('0x1c')]?_[_0xe827('0x1d')](_0x1a6f4b['include'],function(_0x317ef0){return{'model':db[_0x317ef0[_0xe827('0x1e')]],'as':_0x317ef0['as'],'attributes':_0x317ef0[_0xe827('0x1b')],'include':_0x317ef0[_0xe827('0x1c')]?_[_0xe827('0x1d')](_0x317ef0[_0xe827('0x1c')],function(_0x458a0f){return{'model':db[_0x458a0f[_0xe827('0x1e')]],'as':_0x458a0f['as'],'attributes':_0x458a0f[_0xe827('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe827('0xb')](function(_0x1a1032){logger['info'](_0xe827('0x20'),_0x541edf);logger[_0xe827('0xe')](_0xe827('0x20'),_0x541edf,JSON['stringify'](_0x1a1032));_0x2db2a8(_0x1a1032);})['catch'](function(_0x171c93){logger[_0xe827('0x11')]('ShowFreshdeskAccount',_0x171c93['message'],_0x541edf);_0x4278fc(_0x5c5ecb['error'](0x1f4,_0x171c93['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 08ad7c3..85ff008 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 _0x6866=['express','Router','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getDescriptions','/:id/tags','post','update','delete','util','path','connect-timeout'];(function(_0x34f3c7,_0x393441){var _0x258767=function(_0x1528d1){while(--_0x1528d1){_0x34f3c7['push'](_0x34f3c7['shift']());}};_0x258767(++_0x393441);}(_0x6866,0x166));var _0x6686=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6866[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x6686('0x0'));var path=require(_0x6686('0x1'));var timeout=require(_0x6686('0x2'));var express=require(_0x6686('0x3'));var router=express[_0x6686('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6686('0x5'));var config=require('../../config/environment');var controller=require(_0x6686('0x6'));router[_0x6686('0x7')]('/',auth[_0x6686('0x8')](),controller[_0x6686('0x9')]);router[_0x6686('0x7')](_0x6686('0xa'),auth['isAuthenticated'](),controller[_0x6686('0xb')]);router[_0x6686('0x7')]('/:id/fields',auth[_0x6686('0x8')](),controller[_0x6686('0xc')]);router[_0x6686('0x7')](_0x6686('0xd'),auth[_0x6686('0x8')](),controller['getSubjects']);router[_0x6686('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x6686('0xe')]);router['get'](_0x6686('0xf'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0x6686('0x8')](),controller['create']);router[_0x6686('0x10')](_0x6686('0xf'),auth[_0x6686('0x8')](),controller['setTags']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6686('0x11')]);router[_0x6686('0x12')]('/:id',auth[_0x6686('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0879=['../../config/environment','index','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2fc301,_0x40cce5){var _0x1ce5e7=function(_0x339d29){while(--_0x339d29){_0x2fc301['push'](_0x2fc301['shift']());}};_0x1ce5e7(++_0x40cce5);}(_0x0879,0xdf));var _0x9087=function(_0x5dceb7,_0x4fed9d){_0x5dceb7=_0x5dceb7-0x0;var _0x3268bc=_0x0879[_0x5dceb7];return _0x3268bc;};'use strict';var multer=require(_0x9087('0x0'));var util=require(_0x9087('0x1'));var path=require(_0x9087('0x2'));var timeout=require(_0x9087('0x3'));var express=require(_0x9087('0x4'));var router=express[_0x9087('0x5')]();var fs_extra=require(_0x9087('0x6'));var auth=require(_0x9087('0x7'));var interaction=require(_0x9087('0x8'));var config=require(_0x9087('0x9'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9087('0xa')]);router[_0x9087('0xb')]('/:id',auth[_0x9087('0xc')](),controller[_0x9087('0xd')]);router['get'](_0x9087('0xe'),auth['isAuthenticated'](),controller[_0x9087('0xf')]);router[_0x9087('0xb')](_0x9087('0x10'),auth[_0x9087('0xc')](),controller[_0x9087('0x11')]);router[_0x9087('0xb')](_0x9087('0x12'),auth[_0x9087('0xc')](),controller[_0x9087('0x13')]);router[_0x9087('0xb')](_0x9087('0x14'),auth[_0x9087('0xc')](),controller[_0x9087('0x15')]);router[_0x9087('0x16')]('/',auth[_0x9087('0xc')](),controller[_0x9087('0x17')]);router[_0x9087('0x16')](_0x9087('0x14'),auth[_0x9087('0xc')](),controller[_0x9087('0x18')]);router['put']('/:id',auth[_0x9087('0xc')](),controller['update']);router[_0x9087('0x19')](_0x9087('0x1a'),auth[_0x9087('0xc')](),controller[_0x9087('0x1b')]);module[_0x9087('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 7ba4b73..43d01d8 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 _0x3205=['sequelize','exports','STRING'];(function(_0x2d6d88,_0x2ea070){var _0x1991b0=function(_0x13b3fe){while(--_0x13b3fe){_0x2d6d88['push'](_0x2d6d88['shift']());}};_0x1991b0(++_0x2ea070);}(_0x3205,0xb7));var _0x5320=function(_0x25c445,_0x52739){_0x25c445=_0x25c445-0x0;var _0x24dc7c=_0x3205[_0x25c445];return _0x24dc7c;};'use strict';var Sequelize=require(_0x5320('0x0'));module[_0x5320('0x1')]={'name':{'type':Sequelize[_0x5320('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7fff=['sequelize'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7fff,0xbc));var _0xf7ff=function(_0x6d45b3,_0x2b175c){_0x6d45b3=_0x6d45b3-0x0;var _0x110b74=_0x7fff[_0x6d45b3];return _0x110b74;};'use strict';var Sequelize=require(_0xf7ff('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 82106ad..5606d02 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 _0xc125=['merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','intersection','find','catch','create','body','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','save','update','then','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where'];(function(_0x2d6f3e,_0x93ab62){var _0x5638cd=function(_0x29cdc4){while(--_0x29cdc4){_0x2d6f3e['push'](_0x2d6f3e['shift']());}};_0x5638cd(++_0x93ab62);}(_0xc125,0x1b2));var _0x5c12=function(_0x4ba7d7,_0x43781a){_0x4ba7d7=_0x4ba7d7-0x0;var _0x50b3a3=_0xc125[_0x4ba7d7];return _0x50b3a3;};'use strict';var emlformat=require(_0x5c12('0x0'));var rimraf=require(_0x5c12('0x1'));var zipdir=require(_0x5c12('0x2'));var jsonpatch=require(_0x5c12('0x3'));var rp=require(_0x5c12('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5c12('0x5'));var util=require(_0x5c12('0x6'));var path=require('path');var sox=require(_0x5c12('0x7'));var csv=require(_0x5c12('0x8'));var ejs=require(_0x5c12('0x9'));var fs=require('fs');var fs_extra=require(_0x5c12('0xa'));var _=require(_0x5c12('0xb'));var squel=require(_0x5c12('0xc'));var crypto=require(_0x5c12('0xd'));var jsforce=require(_0x5c12('0xe'));var deskjs=require(_0x5c12('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5c12('0x10'));var Papa=require(_0x5c12('0x11'));var Redis=require(_0x5c12('0x12'));var authService=require(_0x5c12('0x13'));var qs=require(_0x5c12('0x14'));var as=require(_0x5c12('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5c12('0x16'));var utils=require(_0x5c12('0x17'));var config=require(_0x5c12('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c12('0x19'))['db'];function respondWithStatusCode(_0x421d58,_0x12afd7){_0x12afd7=_0x12afd7||0xcc;return function(_0x2fc57b){if(_0x2fc57b){return _0x421d58[_0x5c12('0x1a')](_0x12afd7);}return _0x421d58[_0x5c12('0x1b')](_0x12afd7)[_0x5c12('0x1c')]();};}function respondWithResult(_0x40c122,_0x389498){_0x389498=_0x389498||0xc8;return function(_0x52375c){if(_0x52375c){return _0x40c122[_0x5c12('0x1b')](_0x389498)[_0x5c12('0x1d')](_0x52375c);}};}function respondWithFilteredResult(_0x4d66c6,_0x4affb2){return function(_0x4e82ea){if(_0x4e82ea){var _0x1653f0=typeof _0x4affb2['offset']===_0x5c12('0x1e')&&typeof _0x4affb2[_0x5c12('0x1f')]==='undefined';var _0x1340df=_0x4e82ea[_0x5c12('0x20')];var _0x3d8a1a=_0x1653f0?0x0:_0x4affb2[_0x5c12('0x21')];var _0x942d2a=_0x1653f0?_0x4e82ea[_0x5c12('0x20')]:_0x4affb2[_0x5c12('0x21')]+_0x4affb2[_0x5c12('0x1f')];var _0x53e776;if(_0x942d2a>=_0x1340df){_0x942d2a=_0x1340df;_0x53e776=0xc8;}else{_0x53e776=0xce;}_0x4d66c6[_0x5c12('0x1b')](_0x53e776);return _0x4d66c6['set']('Content-Range',_0x3d8a1a+'-'+_0x942d2a+'/'+_0x1340df)[_0x5c12('0x1d')](_0x4e82ea);}return null;};}function patchUpdates(_0x32d3e8){return function(_0x3b2a5f){try{jsonpatch['apply'](_0x3b2a5f,_0x32d3e8,!![]);}catch(_0x404e11){return BPromise['reject'](_0x404e11);}return _0x3b2a5f[_0x5c12('0x22')]();};}function saveUpdates(_0x1ee4fd,_0x3baebe){return function(_0x493521){if(_0x493521){return _0x493521[_0x5c12('0x23')](_0x1ee4fd)[_0x5c12('0x24')](function(_0x4eb611){return _0x4eb611;});}return null;};}function removeEntity(_0xc98a09,_0x4ea997){return function(_0x1d9b3c){if(_0x1d9b3c){return _0x1d9b3c['destroy']()[_0x5c12('0x24')](function(){_0xc98a09['status'](0xcc)[_0x5c12('0x1c')]();});}};}function handleEntityNotFound(_0x55de12,_0x209df2){return function(_0x1e0364){if(!_0x1e0364){_0x55de12[_0x5c12('0x1a')](0x194);}return _0x1e0364;};}function handleError(_0x3b4b1e,_0x7dbe7f){_0x7dbe7f=_0x7dbe7f||0x1f4;return function(_0x557974){logger[_0x5c12('0x25')](_0x557974['stack']);if(_0x557974[_0x5c12('0x26')]){delete _0x557974['name'];}_0x3b4b1e[_0x5c12('0x1b')](_0x7dbe7f)[_0x5c12('0x27')](_0x557974);};}exports[_0x5c12('0x28')]=function(_0x2e8f28,_0x19651a){var _0x196b45={},_0xd51836={},_0x3f6a30={'count':0x0,'rows':[]};var _0x2f5afe=_[_0x5c12('0x29')](db[_0x5c12('0x2a')][_0x5c12('0x2b')],function(_0x3972de){return{'name':_0x3972de[_0x5c12('0x2c')],'type':_0x3972de[_0x5c12('0x2d')]['key']};});_0xd51836['model']=_['map'](_0x2f5afe,_0x5c12('0x26'));_0xd51836[_0x5c12('0x2e')]=_['keys'](_0x2e8f28[_0x5c12('0x2e')]);_0xd51836[_0x5c12('0x2f')]=_['intersection'](_0xd51836[_0x5c12('0x30')],_0xd51836[_0x5c12('0x2e')]);_0x196b45['attributes']=_['intersection'](_0xd51836[_0x5c12('0x30')],qs[_0x5c12('0x31')](_0x2e8f28[_0x5c12('0x2e')][_0x5c12('0x31')]));_0x196b45[_0x5c12('0x32')]=_0x196b45[_0x5c12('0x32')][_0x5c12('0x33')]?_0x196b45[_0x5c12('0x32')]:_0xd51836[_0x5c12('0x30')];if(!_0x2e8f28[_0x5c12('0x2e')][_0x5c12('0x34')](_0x5c12('0x35'))){_0x196b45[_0x5c12('0x1f')]=qs[_0x5c12('0x1f')](_0x2e8f28[_0x5c12('0x2e')]['limit']);_0x196b45[_0x5c12('0x21')]=qs[_0x5c12('0x21')](_0x2e8f28[_0x5c12('0x2e')][_0x5c12('0x21')]);}_0x196b45[_0x5c12('0x36')]=qs[_0x5c12('0x37')](_0x2e8f28[_0x5c12('0x2e')]['sort']);_0x196b45['where']=qs[_0x5c12('0x2f')](_[_0x5c12('0x38')](_0x2e8f28[_0x5c12('0x2e')],_0xd51836[_0x5c12('0x2f')]),_0x2f5afe);if(_0x2e8f28[_0x5c12('0x2e')]['filter']){_0x196b45[_0x5c12('0x39')]=_[_0x5c12('0x3a')](_0x196b45['where'],{'$or':_[_0x5c12('0x29')](_0x2f5afe,function(_0x2f2333){if(_0x2f2333[_0x5c12('0x2d')]!==_0x5c12('0x3b')){var _0x1fdde0={};_0x1fdde0[_0x2f2333[_0x5c12('0x26')]]={'$like':'%'+_0x2e8f28[_0x5c12('0x2e')][_0x5c12('0x3c')]+'%'};return _0x1fdde0;}})});}_0x196b45=_[_0x5c12('0x3a')]({},_0x196b45,_0x2e8f28[_0x5c12('0x3d')]);var _0x3e9621={'where':_0x196b45[_0x5c12('0x39')]};return db[_0x5c12('0x2a')]['count'](_0x3e9621)[_0x5c12('0x24')](function(_0x44bc7f){_0x3f6a30[_0x5c12('0x20')]=_0x44bc7f;if(_0x2e8f28[_0x5c12('0x2e')][_0x5c12('0x3e')]){_0x196b45[_0x5c12('0x3f')]=[{'all':!![]}];}return db[_0x5c12('0x2a')][_0x5c12('0x40')](_0x196b45);})[_0x5c12('0x24')](function(_0x44c409){_0x3f6a30['rows']=_0x44c409;return _0x3f6a30;})['then'](respondWithFilteredResult(_0x19651a,_0x196b45))['catch'](handleError(_0x19651a,null));};exports[_0x5c12('0x41')]=function(_0x41d17f,_0x1020f1){var _0x4f17e2={'raw':![],'where':{'id':_0x41d17f[_0x5c12('0x42')]['id']}},_0x2f70a7={};_0x2f70a7[_0x5c12('0x30')]=_['keys'](db[_0x5c12('0x2a')]['rawAttributes']);_0x2f70a7[_0x5c12('0x2e')]=_[_0x5c12('0x43')](_0x41d17f[_0x5c12('0x2e')]);_0x2f70a7[_0x5c12('0x2f')]=_[_0x5c12('0x44')](_0x2f70a7[_0x5c12('0x30')],_0x2f70a7[_0x5c12('0x2e')]);_0x4f17e2['attributes']=_[_0x5c12('0x44')](_0x2f70a7[_0x5c12('0x30')],qs['fields'](_0x41d17f[_0x5c12('0x2e')]['fields']));_0x4f17e2[_0x5c12('0x32')]=_0x4f17e2[_0x5c12('0x32')][_0x5c12('0x33')]?_0x4f17e2[_0x5c12('0x32')]:_0x2f70a7[_0x5c12('0x30')];if(_0x41d17f[_0x5c12('0x2e')][_0x5c12('0x3e')]){_0x4f17e2[_0x5c12('0x3f')]=[{'all':!![]}];}_0x4f17e2=_[_0x5c12('0x3a')]({},_0x4f17e2,_0x41d17f[_0x5c12('0x3d')]);return db[_0x5c12('0x2a')][_0x5c12('0x45')](_0x4f17e2)[_0x5c12('0x24')](handleEntityNotFound(_0x1020f1,null))[_0x5c12('0x24')](respondWithResult(_0x1020f1,null))[_0x5c12('0x46')](handleError(_0x1020f1,null));};exports[_0x5c12('0x47')]=function(_0x2a8d1b,_0x2890d5){return db['FreshdeskConfiguration'][_0x5c12('0x47')](_0x2a8d1b[_0x5c12('0x48')],{})[_0x5c12('0x24')](respondWithResult(_0x2890d5,0xc9))[_0x5c12('0x46')](handleError(_0x2890d5,null));};exports[_0x5c12('0x23')]=function(_0x4fe08e,_0x4cbd48){if(_0x4fe08e[_0x5c12('0x48')]['id']){delete _0x4fe08e['body']['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x4fe08e[_0x5c12('0x42')]['id']}})[_0x5c12('0x24')](handleEntityNotFound(_0x4cbd48,null))[_0x5c12('0x24')](saveUpdates(_0x4fe08e['body'],null))['then'](respondWithResult(_0x4cbd48,null))[_0x5c12('0x46')](handleError(_0x4cbd48,null));};exports[_0x5c12('0x49')]=function(_0x320b75,_0x4f84bd){return db[_0x5c12('0x2a')][_0x5c12('0x45')]({'where':{'id':_0x320b75[_0x5c12('0x42')]['id']}})[_0x5c12('0x24')](handleEntityNotFound(_0x4f84bd,null))[_0x5c12('0x24')](removeEntity(_0x4f84bd,null))[_0x5c12('0x46')](handleError(_0x4f84bd,null));};exports[_0x5c12('0x4a')]=function(_0x3ef4f9,_0xc8fffb,_0x41f380){var _0x42cf00={};var _0x1685b6={};var _0x616cfc;var _0xa11435;return db[_0x5c12('0x2a')][_0x5c12('0x4b')]({'where':{'id':_0x3ef4f9[_0x5c12('0x42')]['id']}})[_0x5c12('0x24')](handleEntityNotFound(_0xc8fffb,null))['then'](function(_0x456dd5){if(_0x456dd5){_0x616cfc=_0x456dd5;_0x1685b6[_0x5c12('0x30')]=_[_0x5c12('0x43')](db[_0x5c12('0x4c')][_0x5c12('0x2b')]);_0x1685b6['query']=_[_0x5c12('0x43')](_0x3ef4f9[_0x5c12('0x2e')]);_0x1685b6['filters']=_[_0x5c12('0x44')](_0x1685b6[_0x5c12('0x30')],_0x1685b6[_0x5c12('0x2e')]);_0x42cf00[_0x5c12('0x32')]=_[_0x5c12('0x44')](_0x1685b6['model'],qs[_0x5c12('0x31')](_0x3ef4f9[_0x5c12('0x2e')]['fields']));_0x42cf00['attributes']=_0x42cf00[_0x5c12('0x32')][_0x5c12('0x33')]?_0x42cf00[_0x5c12('0x32')]:_0x1685b6[_0x5c12('0x30')];_0x42cf00['order']=qs[_0x5c12('0x37')](_0x3ef4f9[_0x5c12('0x2e')][_0x5c12('0x37')]);_0x42cf00[_0x5c12('0x39')]=qs[_0x5c12('0x2f')](_['pick'](_0x3ef4f9[_0x5c12('0x2e')],_0x1685b6['filters']));if(_0x3ef4f9[_0x5c12('0x2e')][_0x5c12('0x3c')]){_0x42cf00['where']=_[_0x5c12('0x3a')](_0x42cf00[_0x5c12('0x39')],{'$or':_[_0x5c12('0x29')](_0x42cf00[_0x5c12('0x32')],function(_0x26e9e4){var _0x148f06={};_0x148f06[_0x26e9e4]={'$like':'%'+_0x3ef4f9[_0x5c12('0x2e')][_0x5c12('0x3c')]+'%'};return _0x148f06;})});}_0x42cf00=_[_0x5c12('0x3a')]({},_0x42cf00,_0x3ef4f9[_0x5c12('0x3d')]);return _0x616cfc[_0x5c12('0x4a')](_0x42cf00);}})[_0x5c12('0x24')](function(_0x5f3fb5){if(_0x5f3fb5){_0xa11435=_0x5f3fb5[_0x5c12('0x33')];if(!_0x3ef4f9['query'][_0x5c12('0x34')](_0x5c12('0x35'))){_0x42cf00['limit']=qs[_0x5c12('0x1f')](_0x3ef4f9[_0x5c12('0x2e')]['limit']);_0x42cf00[_0x5c12('0x21')]=qs[_0x5c12('0x21')](_0x3ef4f9['query'][_0x5c12('0x21')]);}return _0x616cfc[_0x5c12('0x4a')](_0x42cf00);}})[_0x5c12('0x24')](function(_0x231b4e){if(_0x231b4e){return _0x231b4e?{'count':_0xa11435,'rows':_0x231b4e}:null;}})['then'](respondWithResult(_0xc8fffb,null))[_0x5c12('0x46')](handleError(_0xc8fffb,null));};exports[_0x5c12('0x4d')]=function(_0x4fdcda,_0x770768,_0x212fcc){var _0x101cb4={};var _0x206aab={};var _0x4a3880;var _0x30e638;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4fdcda[_0x5c12('0x42')]['id']}})[_0x5c12('0x24')](handleEntityNotFound(_0x770768,null))[_0x5c12('0x24')](function(_0x31f3ee){if(_0x31f3ee){_0x4a3880=_0x31f3ee;_0x206aab[_0x5c12('0x30')]=_[_0x5c12('0x43')](db[_0x5c12('0x4c')][_0x5c12('0x2b')]);_0x206aab['query']=_[_0x5c12('0x43')](_0x4fdcda['query']);_0x206aab[_0x5c12('0x2f')]=_[_0x5c12('0x44')](_0x206aab[_0x5c12('0x30')],_0x206aab[_0x5c12('0x2e')]);_0x101cb4[_0x5c12('0x32')]=_[_0x5c12('0x44')](_0x206aab['model'],qs[_0x5c12('0x31')](_0x4fdcda['query']['fields']));_0x101cb4['attributes']=_0x101cb4[_0x5c12('0x32')][_0x5c12('0x33')]?_0x101cb4[_0x5c12('0x32')]:_0x206aab['model'];_0x101cb4[_0x5c12('0x36')]=qs[_0x5c12('0x37')](_0x4fdcda[_0x5c12('0x2e')][_0x5c12('0x37')]);_0x101cb4['where']=qs['filters'](_['pick'](_0x4fdcda['query'],_0x206aab['filters']));if(_0x4fdcda[_0x5c12('0x2e')][_0x5c12('0x3c')]){_0x101cb4['where']=_[_0x5c12('0x3a')](_0x101cb4[_0x5c12('0x39')],{'$or':_[_0x5c12('0x29')](_0x101cb4[_0x5c12('0x32')],function(_0x2a148f){var _0x26cd7c={};_0x26cd7c[_0x2a148f]={'$like':'%'+_0x4fdcda[_0x5c12('0x2e')][_0x5c12('0x3c')]+'%'};return _0x26cd7c;})});}_0x101cb4=_['merge']({},_0x101cb4,_0x4fdcda[_0x5c12('0x3d')]);return _0x4a3880[_0x5c12('0x4d')](_0x101cb4);}})[_0x5c12('0x24')](function(_0x264312){if(_0x264312){_0x30e638=_0x264312[_0x5c12('0x33')];if(!_0x4fdcda[_0x5c12('0x2e')][_0x5c12('0x34')](_0x5c12('0x35'))){_0x101cb4[_0x5c12('0x1f')]=qs[_0x5c12('0x1f')](_0x4fdcda[_0x5c12('0x2e')]['limit']);_0x101cb4[_0x5c12('0x21')]=qs[_0x5c12('0x21')](_0x4fdcda[_0x5c12('0x2e')][_0x5c12('0x21')]);}return _0x4a3880[_0x5c12('0x4d')](_0x101cb4);}})['then'](function(_0x4501e9){if(_0x4501e9){return _0x4501e9?{'count':_0x30e638,'rows':_0x4501e9}:null;}})[_0x5c12('0x24')](respondWithResult(_0x770768,null))[_0x5c12('0x46')](handleError(_0x770768,null));};exports[_0x5c12('0x4e')]=function(_0x51ced8,_0x3af0df,_0x58f17f){var _0x5d9051={};var _0x327714={};var _0x38ee14;var _0x53f24e;return db[_0x5c12('0x2a')][_0x5c12('0x4b')]({'where':{'id':_0x51ced8[_0x5c12('0x42')]['id']}})[_0x5c12('0x24')](handleEntityNotFound(_0x3af0df,null))['then'](function(_0x52e2cd){if(_0x52e2cd){_0x38ee14=_0x52e2cd;_0x327714[_0x5c12('0x30')]=_['keys'](db[_0x5c12('0x4c')][_0x5c12('0x2b')]);_0x327714[_0x5c12('0x2e')]=_['keys'](_0x51ced8['query']);_0x327714['filters']=_[_0x5c12('0x44')](_0x327714[_0x5c12('0x30')],_0x327714[_0x5c12('0x2e')]);_0x5d9051[_0x5c12('0x32')]=_['intersection'](_0x327714[_0x5c12('0x30')],qs[_0x5c12('0x31')](_0x51ced8[_0x5c12('0x2e')][_0x5c12('0x31')]));_0x5d9051['attributes']=_0x5d9051[_0x5c12('0x32')][_0x5c12('0x33')]?_0x5d9051['attributes']:_0x327714[_0x5c12('0x30')];_0x5d9051['order']=qs['sort'](_0x51ced8['query']['sort']);_0x5d9051['where']=qs[_0x5c12('0x2f')](_[_0x5c12('0x38')](_0x51ced8[_0x5c12('0x2e')],_0x327714['filters']));if(_0x51ced8['query'][_0x5c12('0x3c')]){_0x5d9051[_0x5c12('0x39')]=_['merge'](_0x5d9051[_0x5c12('0x39')],{'$or':_[_0x5c12('0x29')](_0x5d9051[_0x5c12('0x32')],function(_0x179353){var _0x48218c={};_0x48218c[_0x179353]={'$like':'%'+_0x51ced8[_0x5c12('0x2e')][_0x5c12('0x3c')]+'%'};return _0x48218c;})});}_0x5d9051=_[_0x5c12('0x3a')]({},_0x5d9051,_0x51ced8[_0x5c12('0x3d')]);return _0x38ee14[_0x5c12('0x4e')](_0x5d9051);}})[_0x5c12('0x24')](function(_0x31d097){if(_0x31d097){_0x53f24e=_0x31d097[_0x5c12('0x33')];if(!_0x51ced8['query'][_0x5c12('0x34')](_0x5c12('0x35'))){_0x5d9051['limit']=qs[_0x5c12('0x1f')](_0x51ced8[_0x5c12('0x2e')][_0x5c12('0x1f')]);_0x5d9051['offset']=qs['offset'](_0x51ced8[_0x5c12('0x2e')][_0x5c12('0x21')]);}return _0x38ee14[_0x5c12('0x4e')](_0x5d9051);}})[_0x5c12('0x24')](function(_0x1247ea){if(_0x1247ea){return _0x1247ea?{'count':_0x53f24e,'rows':_0x1247ea}:null;}})[_0x5c12('0x24')](respondWithResult(_0x3af0df,null))['catch'](handleError(_0x3af0df,null));};exports[_0x5c12('0x4f')]=function(_0x3658cd,_0x541783,_0x34823d){var _0x19f3f4={};var _0x1ff1b6={};var _0x494af4;var _0x37dbd4;return db[_0x5c12('0x2a')][_0x5c12('0x4b')]({'where':{'id':_0x3658cd[_0x5c12('0x42')]['id']}})[_0x5c12('0x24')](handleEntityNotFound(_0x541783,null))[_0x5c12('0x24')](function(_0xb6673a){if(_0xb6673a){_0x494af4=_0xb6673a;_0x1ff1b6['model']=_[_0x5c12('0x43')](db['Tag'][_0x5c12('0x2b')]);_0x1ff1b6[_0x5c12('0x2e')]=_[_0x5c12('0x43')](_0x3658cd[_0x5c12('0x2e')]);_0x1ff1b6[_0x5c12('0x2f')]=_[_0x5c12('0x44')](_0x1ff1b6[_0x5c12('0x30')],_0x1ff1b6[_0x5c12('0x2e')]);_0x19f3f4['attributes']=_[_0x5c12('0x44')](_0x1ff1b6[_0x5c12('0x30')],qs['fields'](_0x3658cd['query'][_0x5c12('0x31')]));_0x19f3f4[_0x5c12('0x32')]=_0x19f3f4[_0x5c12('0x32')][_0x5c12('0x33')]?_0x19f3f4[_0x5c12('0x32')]:_0x1ff1b6[_0x5c12('0x30')];_0x19f3f4['order']=qs[_0x5c12('0x37')](_0x3658cd[_0x5c12('0x2e')]['sort']);_0x19f3f4['where']=qs[_0x5c12('0x2f')](_['pick'](_0x3658cd['query'],_0x1ff1b6[_0x5c12('0x2f')]));if(_0x3658cd['query']['filter']){_0x19f3f4[_0x5c12('0x39')]=_[_0x5c12('0x3a')](_0x19f3f4[_0x5c12('0x39')],{'$or':_[_0x5c12('0x29')](_0x19f3f4['attributes'],function(_0x5e13ce){var _0x43d6cd={};_0x43d6cd[_0x5e13ce]={'$like':'%'+_0x3658cd[_0x5c12('0x2e')]['filter']+'%'};return _0x43d6cd;})});}_0x19f3f4=_[_0x5c12('0x3a')]({},_0x19f3f4,_0x3658cd[_0x5c12('0x3d')]);return _0x494af4[_0x5c12('0x4f')](_0x19f3f4);}})[_0x5c12('0x24')](function(_0x3a787f){if(_0x3a787f){_0x37dbd4=_0x3a787f['length'];if(!_0x3658cd[_0x5c12('0x2e')][_0x5c12('0x34')](_0x5c12('0x35'))){_0x19f3f4[_0x5c12('0x1f')]=qs[_0x5c12('0x1f')](_0x3658cd[_0x5c12('0x2e')]['limit']);_0x19f3f4[_0x5c12('0x21')]=qs[_0x5c12('0x21')](_0x3658cd[_0x5c12('0x2e')]['offset']);}return _0x494af4['getTags'](_0x19f3f4);}})['then'](function(_0x33ed32){if(_0x33ed32){return _0x33ed32?{'count':_0x37dbd4,'rows':_0x33ed32}:null;}})[_0x5c12('0x24')](respondWithResult(_0x541783,null))[_0x5c12('0x46')](handleError(_0x541783,null));};exports[_0x5c12('0x50')]=function(_0x372718,_0x58222e,_0x166bd7){if(_0x372718[_0x5c12('0x48')]['id']){delete _0x372718['body']['id'];}return db[_0x5c12('0x2a')][_0x5c12('0x4b')]({'where':{'id':_0x372718[_0x5c12('0x42')]['id']}})[_0x5c12('0x24')](handleEntityNotFound(_0x58222e,null))[_0x5c12('0x24')](function(_0x1ea9b5){if(_0x1ea9b5){return _0x1ea9b5[_0x5c12('0x50')](_0x372718[_0x5c12('0x48')][_0x5c12('0x51')]||[]);}return null;})[_0x5c12('0x24')](respondWithResult(_0x58222e,null))[_0x5c12('0x46')](handleError(_0x58222e,null));}; \ No newline at end of file +var _0x3d60=['query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','includeAll','include','catch','show','keys','find','create','body','params','getFields','findOne','getSubjects','FreshdeskField','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model'];(function(_0x13f2af,_0x39cb71){var _0xd864c0=function(_0x4afc23){while(--_0x4afc23){_0x13f2af['push'](_0x13f2af['shift']());}};_0xd864c0(++_0x39cb71);}(_0x3d60,0xd1));var _0x03d6=function(_0x173791,_0x3652b0){_0x173791=_0x173791-0x0;var _0x12e085=_0x3d60[_0x173791];return _0x12e085;};'use strict';var emlformat=require(_0x03d6('0x0'));var rimraf=require(_0x03d6('0x1'));var zipdir=require(_0x03d6('0x2'));var jsonpatch=require(_0x03d6('0x3'));var rp=require(_0x03d6('0x4'));var moment=require(_0x03d6('0x5'));var BPromise=require(_0x03d6('0x6'));var Mustache=require(_0x03d6('0x7'));var util=require(_0x03d6('0x8'));var path=require(_0x03d6('0x9'));var sox=require(_0x03d6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x03d6('0xb'));var squel=require(_0x03d6('0xc'));var crypto=require(_0x03d6('0xd'));var jsforce=require(_0x03d6('0xe'));var deskjs=require(_0x03d6('0xf'));var toCsv=require(_0x03d6('0x10'));var querystring=require(_0x03d6('0x11'));var Papa=require('papaparse');var Redis=require(_0x03d6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x03d6('0x13'));var as=require(_0x03d6('0x14'));var hardwareService=require(_0x03d6('0x15'));var logger=require(_0x03d6('0x16'))(_0x03d6('0x17'));var utils=require(_0x03d6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x03d6('0x19'));var db=require(_0x03d6('0x1a'))['db'];function respondWithStatusCode(_0x429cea,_0x32e796){_0x32e796=_0x32e796||0xcc;return function(_0x47a602){if(_0x47a602){return _0x429cea[_0x03d6('0x1b')](_0x32e796);}return _0x429cea[_0x03d6('0x1c')](_0x32e796)[_0x03d6('0x1d')]();};}function respondWithResult(_0x1df2b4,_0x28fcdc){_0x28fcdc=_0x28fcdc||0xc8;return function(_0x221416){if(_0x221416){return _0x1df2b4['status'](_0x28fcdc)[_0x03d6('0x1e')](_0x221416);}};}function respondWithFilteredResult(_0x5f5bcd,_0x1ea495){return function(_0x2a0e73){if(_0x2a0e73){var _0x4cbf66=typeof _0x1ea495[_0x03d6('0x1f')]===_0x03d6('0x20')&&typeof _0x1ea495[_0x03d6('0x21')]==='undefined';var _0x3371f2=_0x2a0e73['count'];var _0x37dc17=_0x4cbf66?0x0:_0x1ea495[_0x03d6('0x1f')];var _0x17f444=_0x4cbf66?_0x2a0e73[_0x03d6('0x22')]:_0x1ea495[_0x03d6('0x1f')]+_0x1ea495[_0x03d6('0x21')];var _0x3e2411;if(_0x17f444>=_0x3371f2){_0x17f444=_0x3371f2;_0x3e2411=0xc8;}else{_0x3e2411=0xce;}_0x5f5bcd[_0x03d6('0x1c')](_0x3e2411);return _0x5f5bcd['set'](_0x03d6('0x23'),_0x37dc17+'-'+_0x17f444+'/'+_0x3371f2)[_0x03d6('0x1e')](_0x2a0e73);}return null;};}function patchUpdates(_0x133976){return function(_0x48e915){try{jsonpatch[_0x03d6('0x24')](_0x48e915,_0x133976,!![]);}catch(_0x4fa9c7){return BPromise[_0x03d6('0x25')](_0x4fa9c7);}return _0x48e915[_0x03d6('0x26')]();};}function saveUpdates(_0x41c348,_0x124f8f){return function(_0x460d05){if(_0x460d05){return _0x460d05[_0x03d6('0x27')](_0x41c348)['then'](function(_0x184d60){return _0x184d60;});}return null;};}function removeEntity(_0xd9d636,_0x1d0eaa){return function(_0x4391b2){if(_0x4391b2){return _0x4391b2[_0x03d6('0x28')]()[_0x03d6('0x29')](function(){_0xd9d636['status'](0xcc)[_0x03d6('0x1d')]();});}};}function handleEntityNotFound(_0x49ab47,_0x3b65a3){return function(_0x197497){if(!_0x197497){_0x49ab47[_0x03d6('0x1b')](0x194);}return _0x197497;};}function handleError(_0x2493e9,_0x49a140){_0x49a140=_0x49a140||0x1f4;return function(_0x2992a7){logger[_0x03d6('0x2a')](_0x2992a7['stack']);if(_0x2992a7[_0x03d6('0x2b')]){delete _0x2992a7[_0x03d6('0x2b')];}_0x2493e9[_0x03d6('0x1c')](_0x49a140)[_0x03d6('0x2c')](_0x2992a7);};}exports[_0x03d6('0x2d')]=function(_0x3e873c,_0x35e78c){var _0x3a0f08={},_0x12928d={},_0x3e1e1b={'count':0x0,'rows':[]};var _0x4ba29e=_['map'](db[_0x03d6('0x2e')][_0x03d6('0x2f')],function(_0x180b42){return{'name':_0x180b42[_0x03d6('0x30')],'type':_0x180b42[_0x03d6('0x31')][_0x03d6('0x32')]};});_0x12928d[_0x03d6('0x33')]=_['map'](_0x4ba29e,'name');_0x12928d['query']=_['keys'](_0x3e873c[_0x03d6('0x34')]);_0x12928d['filters']=_[_0x03d6('0x35')](_0x12928d[_0x03d6('0x33')],_0x12928d[_0x03d6('0x34')]);_0x3a0f08['attributes']=_['intersection'](_0x12928d[_0x03d6('0x33')],qs['fields'](_0x3e873c['query'][_0x03d6('0x36')]));_0x3a0f08[_0x03d6('0x37')]=_0x3a0f08['attributes'][_0x03d6('0x38')]?_0x3a0f08[_0x03d6('0x37')]:_0x12928d['model'];if(!_0x3e873c[_0x03d6('0x34')][_0x03d6('0x39')]('nolimit')){_0x3a0f08[_0x03d6('0x21')]=qs[_0x03d6('0x21')](_0x3e873c[_0x03d6('0x34')]['limit']);_0x3a0f08['offset']=qs[_0x03d6('0x1f')](_0x3e873c[_0x03d6('0x34')]['offset']);}_0x3a0f08[_0x03d6('0x3a')]=qs[_0x03d6('0x3b')](_0x3e873c['query'][_0x03d6('0x3b')]);_0x3a0f08[_0x03d6('0x3c')]=qs[_0x03d6('0x3d')](_[_0x03d6('0x3e')](_0x3e873c[_0x03d6('0x34')],_0x12928d['filters']),_0x4ba29e);if(_0x3e873c['query']['filter']){_0x3a0f08[_0x03d6('0x3c')]=_[_0x03d6('0x3f')](_0x3a0f08[_0x03d6('0x3c')],{'$or':_[_0x03d6('0x40')](_0x4ba29e,function(_0x2c9983){if(_0x2c9983['type']!==_0x03d6('0x41')){var _0x25fce4={};_0x25fce4[_0x2c9983[_0x03d6('0x2b')]]={'$like':'%'+_0x3e873c[_0x03d6('0x34')][_0x03d6('0x42')]+'%'};return _0x25fce4;}})});}_0x3a0f08=_[_0x03d6('0x3f')]({},_0x3a0f08,_0x3e873c[_0x03d6('0x43')]);var _0x58351f={'where':_0x3a0f08['where']};return db[_0x03d6('0x2e')][_0x03d6('0x22')](_0x58351f)['then'](function(_0x16715c){_0x3e1e1b['count']=_0x16715c;if(_0x3e873c[_0x03d6('0x34')][_0x03d6('0x44')]){_0x3a0f08[_0x03d6('0x45')]=[{'all':!![]}];}return db[_0x03d6('0x2e')]['findAll'](_0x3a0f08);})[_0x03d6('0x29')](function(_0x2bda3){_0x3e1e1b['rows']=_0x2bda3;return _0x3e1e1b;})[_0x03d6('0x29')](respondWithFilteredResult(_0x35e78c,_0x3a0f08))[_0x03d6('0x46')](handleError(_0x35e78c,null));};exports[_0x03d6('0x47')]=function(_0x364443,_0x4a2367){var _0x2c9562={'raw':![],'where':{'id':_0x364443['params']['id']}},_0x4eee1d={};_0x4eee1d[_0x03d6('0x33')]=_[_0x03d6('0x48')](db[_0x03d6('0x2e')][_0x03d6('0x2f')]);_0x4eee1d[_0x03d6('0x34')]=_[_0x03d6('0x48')](_0x364443[_0x03d6('0x34')]);_0x4eee1d[_0x03d6('0x3d')]=_['intersection'](_0x4eee1d[_0x03d6('0x33')],_0x4eee1d['query']);_0x2c9562[_0x03d6('0x37')]=_[_0x03d6('0x35')](_0x4eee1d[_0x03d6('0x33')],qs[_0x03d6('0x36')](_0x364443['query'][_0x03d6('0x36')]));_0x2c9562[_0x03d6('0x37')]=_0x2c9562['attributes'][_0x03d6('0x38')]?_0x2c9562['attributes']:_0x4eee1d['model'];if(_0x364443[_0x03d6('0x34')]['includeAll']){_0x2c9562[_0x03d6('0x45')]=[{'all':!![]}];}_0x2c9562=_[_0x03d6('0x3f')]({},_0x2c9562,_0x364443['options']);return db[_0x03d6('0x2e')][_0x03d6('0x49')](_0x2c9562)[_0x03d6('0x29')](handleEntityNotFound(_0x4a2367,null))[_0x03d6('0x29')](respondWithResult(_0x4a2367,null))['catch'](handleError(_0x4a2367,null));};exports[_0x03d6('0x4a')]=function(_0x24af74,_0x2d32e0){return db[_0x03d6('0x2e')]['create'](_0x24af74[_0x03d6('0x4b')],{})[_0x03d6('0x29')](respondWithResult(_0x2d32e0,0xc9))[_0x03d6('0x46')](handleError(_0x2d32e0,null));};exports[_0x03d6('0x27')]=function(_0x1d4177,_0xa168e9){if(_0x1d4177[_0x03d6('0x4b')]['id']){delete _0x1d4177[_0x03d6('0x4b')]['id'];}return db[_0x03d6('0x2e')][_0x03d6('0x49')]({'where':{'id':_0x1d4177[_0x03d6('0x4c')]['id']}})['then'](handleEntityNotFound(_0xa168e9,null))['then'](saveUpdates(_0x1d4177[_0x03d6('0x4b')],null))['then'](respondWithResult(_0xa168e9,null))[_0x03d6('0x46')](handleError(_0xa168e9,null));};exports['destroy']=function(_0x267343,_0x344954){return db[_0x03d6('0x2e')][_0x03d6('0x49')]({'where':{'id':_0x267343[_0x03d6('0x4c')]['id']}})[_0x03d6('0x29')](handleEntityNotFound(_0x344954,null))[_0x03d6('0x29')](removeEntity(_0x344954,null))[_0x03d6('0x46')](handleError(_0x344954,null));};exports[_0x03d6('0x4d')]=function(_0x3c91a7,_0x3a72aa,_0x5ba97f){var _0x5d246c={};var _0x162fc5={};var _0x4ed704;var _0x4b7ab6;return db['FreshdeskConfiguration'][_0x03d6('0x4e')]({'where':{'id':_0x3c91a7['params']['id']}})[_0x03d6('0x29')](handleEntityNotFound(_0x3a72aa,null))[_0x03d6('0x29')](function(_0x34bc77){if(_0x34bc77){_0x4ed704=_0x34bc77;_0x162fc5['model']=_[_0x03d6('0x48')](db['FreshdeskField'][_0x03d6('0x2f')]);_0x162fc5['query']=_[_0x03d6('0x48')](_0x3c91a7[_0x03d6('0x34')]);_0x162fc5[_0x03d6('0x3d')]=_['intersection'](_0x162fc5[_0x03d6('0x33')],_0x162fc5[_0x03d6('0x34')]);_0x5d246c['attributes']=_[_0x03d6('0x35')](_0x162fc5['model'],qs[_0x03d6('0x36')](_0x3c91a7[_0x03d6('0x34')][_0x03d6('0x36')]));_0x5d246c[_0x03d6('0x37')]=_0x5d246c['attributes'][_0x03d6('0x38')]?_0x5d246c[_0x03d6('0x37')]:_0x162fc5[_0x03d6('0x33')];_0x5d246c[_0x03d6('0x3a')]=qs['sort'](_0x3c91a7[_0x03d6('0x34')][_0x03d6('0x3b')]);_0x5d246c[_0x03d6('0x3c')]=qs[_0x03d6('0x3d')](_['pick'](_0x3c91a7[_0x03d6('0x34')],_0x162fc5[_0x03d6('0x3d')]));if(_0x3c91a7[_0x03d6('0x34')]['filter']){_0x5d246c[_0x03d6('0x3c')]=_[_0x03d6('0x3f')](_0x5d246c[_0x03d6('0x3c')],{'$or':_[_0x03d6('0x40')](_0x5d246c[_0x03d6('0x37')],function(_0x14e100){var _0x32dbb6={};_0x32dbb6[_0x14e100]={'$like':'%'+_0x3c91a7[_0x03d6('0x34')][_0x03d6('0x42')]+'%'};return _0x32dbb6;})});}_0x5d246c=_[_0x03d6('0x3f')]({},_0x5d246c,_0x3c91a7[_0x03d6('0x43')]);return _0x4ed704['getFields'](_0x5d246c);}})['then'](function(_0x46a45c){if(_0x46a45c){_0x4b7ab6=_0x46a45c[_0x03d6('0x38')];if(!_0x3c91a7[_0x03d6('0x34')][_0x03d6('0x39')]('nolimit')){_0x5d246c[_0x03d6('0x21')]=qs['limit'](_0x3c91a7[_0x03d6('0x34')][_0x03d6('0x21')]);_0x5d246c[_0x03d6('0x1f')]=qs['offset'](_0x3c91a7[_0x03d6('0x34')][_0x03d6('0x1f')]);}return _0x4ed704[_0x03d6('0x4d')](_0x5d246c);}})[_0x03d6('0x29')](function(_0x1d21f8){if(_0x1d21f8){return _0x1d21f8?{'count':_0x4b7ab6,'rows':_0x1d21f8}:null;}})['then'](respondWithResult(_0x3a72aa,null))['catch'](handleError(_0x3a72aa,null));};exports[_0x03d6('0x4f')]=function(_0x157229,_0x14a996,_0x3823cb){var _0x4d1801={};var _0x4f2c0a={};var _0x2246fa;var _0x48facd;return db['FreshdeskConfiguration'][_0x03d6('0x4e')]({'where':{'id':_0x157229[_0x03d6('0x4c')]['id']}})[_0x03d6('0x29')](handleEntityNotFound(_0x14a996,null))[_0x03d6('0x29')](function(_0x1de676){if(_0x1de676){_0x2246fa=_0x1de676;_0x4f2c0a[_0x03d6('0x33')]=_[_0x03d6('0x48')](db[_0x03d6('0x50')][_0x03d6('0x2f')]);_0x4f2c0a[_0x03d6('0x34')]=_['keys'](_0x157229['query']);_0x4f2c0a[_0x03d6('0x3d')]=_[_0x03d6('0x35')](_0x4f2c0a[_0x03d6('0x33')],_0x4f2c0a[_0x03d6('0x34')]);_0x4d1801['attributes']=_[_0x03d6('0x35')](_0x4f2c0a['model'],qs['fields'](_0x157229[_0x03d6('0x34')]['fields']));_0x4d1801[_0x03d6('0x37')]=_0x4d1801['attributes']['length']?_0x4d1801[_0x03d6('0x37')]:_0x4f2c0a['model'];_0x4d1801[_0x03d6('0x3a')]=qs['sort'](_0x157229[_0x03d6('0x34')][_0x03d6('0x3b')]);_0x4d1801['where']=qs[_0x03d6('0x3d')](_[_0x03d6('0x3e')](_0x157229[_0x03d6('0x34')],_0x4f2c0a[_0x03d6('0x3d')]));if(_0x157229[_0x03d6('0x34')][_0x03d6('0x42')]){_0x4d1801[_0x03d6('0x3c')]=_[_0x03d6('0x3f')](_0x4d1801[_0x03d6('0x3c')],{'$or':_[_0x03d6('0x40')](_0x4d1801['attributes'],function(_0x13c108){var _0x4d958e={};_0x4d958e[_0x13c108]={'$like':'%'+_0x157229[_0x03d6('0x34')][_0x03d6('0x42')]+'%'};return _0x4d958e;})});}_0x4d1801=_[_0x03d6('0x3f')]({},_0x4d1801,_0x157229['options']);return _0x2246fa['getSubjects'](_0x4d1801);}})[_0x03d6('0x29')](function(_0x48e0f6){if(_0x48e0f6){_0x48facd=_0x48e0f6[_0x03d6('0x38')];if(!_0x157229[_0x03d6('0x34')][_0x03d6('0x39')](_0x03d6('0x51'))){_0x4d1801[_0x03d6('0x21')]=qs[_0x03d6('0x21')](_0x157229[_0x03d6('0x34')]['limit']);_0x4d1801[_0x03d6('0x1f')]=qs['offset'](_0x157229[_0x03d6('0x34')][_0x03d6('0x1f')]);}return _0x2246fa['getSubjects'](_0x4d1801);}})[_0x03d6('0x29')](function(_0x268940){if(_0x268940){return _0x268940?{'count':_0x48facd,'rows':_0x268940}:null;}})[_0x03d6('0x29')](respondWithResult(_0x14a996,null))[_0x03d6('0x46')](handleError(_0x14a996,null));};exports[_0x03d6('0x52')]=function(_0x279bbd,_0x261dd2,_0x4c6943){var _0x53ac5f={};var _0x358538={};var _0x218c2c;var _0x5c7aa8;return db[_0x03d6('0x2e')][_0x03d6('0x4e')]({'where':{'id':_0x279bbd['params']['id']}})[_0x03d6('0x29')](handleEntityNotFound(_0x261dd2,null))[_0x03d6('0x29')](function(_0x2135e1){if(_0x2135e1){_0x218c2c=_0x2135e1;_0x358538[_0x03d6('0x33')]=_[_0x03d6('0x48')](db[_0x03d6('0x50')][_0x03d6('0x2f')]);_0x358538['query']=_[_0x03d6('0x48')](_0x279bbd[_0x03d6('0x34')]);_0x358538[_0x03d6('0x3d')]=_[_0x03d6('0x35')](_0x358538['model'],_0x358538['query']);_0x53ac5f[_0x03d6('0x37')]=_['intersection'](_0x358538[_0x03d6('0x33')],qs[_0x03d6('0x36')](_0x279bbd[_0x03d6('0x34')]['fields']));_0x53ac5f[_0x03d6('0x37')]=_0x53ac5f[_0x03d6('0x37')][_0x03d6('0x38')]?_0x53ac5f[_0x03d6('0x37')]:_0x358538[_0x03d6('0x33')];_0x53ac5f[_0x03d6('0x3a')]=qs[_0x03d6('0x3b')](_0x279bbd[_0x03d6('0x34')][_0x03d6('0x3b')]);_0x53ac5f[_0x03d6('0x3c')]=qs[_0x03d6('0x3d')](_[_0x03d6('0x3e')](_0x279bbd[_0x03d6('0x34')],_0x358538[_0x03d6('0x3d')]));if(_0x279bbd[_0x03d6('0x34')]['filter']){_0x53ac5f[_0x03d6('0x3c')]=_['merge'](_0x53ac5f[_0x03d6('0x3c')],{'$or':_['map'](_0x53ac5f['attributes'],function(_0x356722){var _0x49c1ff={};_0x49c1ff[_0x356722]={'$like':'%'+_0x279bbd['query'][_0x03d6('0x42')]+'%'};return _0x49c1ff;})});}_0x53ac5f=_[_0x03d6('0x3f')]({},_0x53ac5f,_0x279bbd[_0x03d6('0x43')]);return _0x218c2c[_0x03d6('0x52')](_0x53ac5f);}})[_0x03d6('0x29')](function(_0x10cb26){if(_0x10cb26){_0x5c7aa8=_0x10cb26[_0x03d6('0x38')];if(!_0x279bbd['query'][_0x03d6('0x39')]('nolimit')){_0x53ac5f[_0x03d6('0x21')]=qs[_0x03d6('0x21')](_0x279bbd['query'][_0x03d6('0x21')]);_0x53ac5f[_0x03d6('0x1f')]=qs[_0x03d6('0x1f')](_0x279bbd['query']['offset']);}return _0x218c2c[_0x03d6('0x52')](_0x53ac5f);}})[_0x03d6('0x29')](function(_0x478d9d){if(_0x478d9d){return _0x478d9d?{'count':_0x5c7aa8,'rows':_0x478d9d}:null;}})[_0x03d6('0x29')](respondWithResult(_0x261dd2,null))[_0x03d6('0x46')](handleError(_0x261dd2,null));};exports[_0x03d6('0x53')]=function(_0x35f495,_0x57015a,_0x346660){var _0x312e13={};var _0x10680e={};var _0x59c87e;var _0x3e3f8c;return db[_0x03d6('0x2e')][_0x03d6('0x4e')]({'where':{'id':_0x35f495[_0x03d6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57015a,null))['then'](function(_0x35cc4d){if(_0x35cc4d){_0x59c87e=_0x35cc4d;_0x10680e['model']=_[_0x03d6('0x48')](db[_0x03d6('0x54')]['rawAttributes']);_0x10680e[_0x03d6('0x34')]=_[_0x03d6('0x48')](_0x35f495[_0x03d6('0x34')]);_0x10680e['filters']=_[_0x03d6('0x35')](_0x10680e['model'],_0x10680e[_0x03d6('0x34')]);_0x312e13[_0x03d6('0x37')]=_[_0x03d6('0x35')](_0x10680e[_0x03d6('0x33')],qs[_0x03d6('0x36')](_0x35f495[_0x03d6('0x34')]['fields']));_0x312e13[_0x03d6('0x37')]=_0x312e13['attributes']['length']?_0x312e13[_0x03d6('0x37')]:_0x10680e[_0x03d6('0x33')];_0x312e13[_0x03d6('0x3a')]=qs['sort'](_0x35f495[_0x03d6('0x34')]['sort']);_0x312e13[_0x03d6('0x3c')]=qs[_0x03d6('0x3d')](_[_0x03d6('0x3e')](_0x35f495[_0x03d6('0x34')],_0x10680e['filters']));if(_0x35f495[_0x03d6('0x34')]['filter']){_0x312e13[_0x03d6('0x3c')]=_['merge'](_0x312e13['where'],{'$or':_['map'](_0x312e13[_0x03d6('0x37')],function(_0x411bab){var _0x43e17c={};_0x43e17c[_0x411bab]={'$like':'%'+_0x35f495[_0x03d6('0x34')][_0x03d6('0x42')]+'%'};return _0x43e17c;})});}_0x312e13=_['merge']({},_0x312e13,_0x35f495[_0x03d6('0x43')]);return _0x59c87e[_0x03d6('0x53')](_0x312e13);}})[_0x03d6('0x29')](function(_0x33fe0d){if(_0x33fe0d){_0x3e3f8c=_0x33fe0d[_0x03d6('0x38')];if(!_0x35f495[_0x03d6('0x34')][_0x03d6('0x39')](_0x03d6('0x51'))){_0x312e13[_0x03d6('0x21')]=qs[_0x03d6('0x21')](_0x35f495[_0x03d6('0x34')][_0x03d6('0x21')]);_0x312e13[_0x03d6('0x1f')]=qs[_0x03d6('0x1f')](_0x35f495[_0x03d6('0x34')][_0x03d6('0x1f')]);}return _0x59c87e[_0x03d6('0x53')](_0x312e13);}})[_0x03d6('0x29')](function(_0x20d1c7){if(_0x20d1c7){return _0x20d1c7?{'count':_0x3e3f8c,'rows':_0x20d1c7}:null;}})[_0x03d6('0x29')](respondWithResult(_0x57015a,null))[_0x03d6('0x46')](handleError(_0x57015a,null));};exports[_0x03d6('0x55')]=function(_0x44a5e6,_0x2bbbbd,_0x552602){if(_0x44a5e6['body']['id']){delete _0x44a5e6[_0x03d6('0x4b')]['id'];}return db[_0x03d6('0x2e')][_0x03d6('0x4e')]({'where':{'id':_0x44a5e6[_0x03d6('0x4c')]['id']}})[_0x03d6('0x29')](handleEntityNotFound(_0x2bbbbd,null))[_0x03d6('0x29')](function(_0x1e224f){if(_0x1e224f){return _0x1e224f[_0x03d6('0x55')](_0x44a5e6['body'][_0x03d6('0x56')]||[]);}return null;})['then'](respondWithResult(_0x2bbbbd,null))[_0x03d6('0x46')](handleError(_0x2bbbbd,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a516452..69616ba 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 _0x2013=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4162e5,_0x54698d){var _0x5c2c61=function(_0x4ac639){while(--_0x4ac639){_0x4162e5['push'](_0x4162e5['shift']());}};_0x5c2c61(++_0x54698d);}(_0x2013,0x66));var _0x3201=function(_0x3e1f49,_0x498fe6){_0x3e1f49=_0x3e1f49-0x0;var _0xc5dcdd=_0x2013[_0x3e1f49];return _0xc5dcdd;};'use strict';var _=require(_0x3201('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3201('0x1'));var BPromise=require('bluebird');var rp=require(_0x3201('0x2'));var fs=require('fs');var path=require(_0x3201('0x3'));var rimraf=require(_0x3201('0x4'));var config=require(_0x3201('0x5'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x3201('0x6')]=function(_0xc476e7,_0x554b70){return _0xc476e7[_0x3201('0x7')](_0x3201('0x8'),attributes,{'tableName':_0x3201('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ef0=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x4ef0,0x1d1));var _0x04ef=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x4ef0[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0x04ef('0x0'));var util=require(_0x04ef('0x1'));var logger=require(_0x04ef('0x2'))(_0x04ef('0x3'));var moment=require(_0x04ef('0x4'));var BPromise=require(_0x04ef('0x5'));var rp=require(_0x04ef('0x6'));var fs=require('fs');var path=require(_0x04ef('0x7'));var rimraf=require(_0x04ef('0x8'));var config=require('../../config/environment');var attributes=require(_0x04ef('0x9'));module[_0x04ef('0xa')]=function(_0x1bb62a,_0x1c7578){return _0x1bb62a[_0x04ef('0xb')](_0x04ef('0xc'),attributes,{'tableName':_0x04ef('0xd'),'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 7b289af..ceb6fb6 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 _0x4a04=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x52d37b,_0x5e4f47){var _0x3ac7ff=function(_0x549fa3){while(--_0x549fa3){_0x52d37b['push'](_0x52d37b['shift']());}};_0x3ac7ff(++_0x5e4f47);}(_0x4a04,0x142));var _0x44a0=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0x4a04[_0x3cba93];return _0x4a2991;};'use strict';var _=require(_0x44a0('0x0'));var util=require(_0x44a0('0x1'));var moment=require(_0x44a0('0x2'));var BPromise=require(_0x44a0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44a0('0x4'));var db=require(_0x44a0('0x5'))['db'];var utils=require(_0x44a0('0x6'));var logger=require('../../config/logger')(_0x44a0('0x7'));var config=require(_0x44a0('0x8'));var jayson=require(_0x44a0('0x9'));var client=jayson[_0x44a0('0xa')][_0x44a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x596bac,_0x132404,_0x4d3c63){return new BPromise(function(_0x4b5759,_0x2fffe0){return client[_0x44a0('0xc')](_0x596bac,_0x4d3c63)[_0x44a0('0xd')](function(_0x2aa833){logger[_0x44a0('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x132404,_0x44a0('0xf'));logger['debug'](_0x44a0('0x10'),_0x132404,_0x44a0('0xf'),JSON['stringify'](_0x2aa833));if(_0x2aa833[_0x44a0('0x11')]){if(_0x2aa833['error'][_0x44a0('0x12')]===0x1f4){logger[_0x44a0('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x132404,_0x2aa833[_0x44a0('0x11')][_0x44a0('0x13')]);return _0x2fffe0(_0x2aa833[_0x44a0('0x11')][_0x44a0('0x13')]);}logger[_0x44a0('0x11')](_0x44a0('0x14'),_0x132404,_0x2aa833['error'][_0x44a0('0x13')]);return _0x4b5759(_0x2aa833[_0x44a0('0x11')]['message']);}else{logger[_0x44a0('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x132404,_0x44a0('0xf'));_0x4b5759(_0x2aa833['result'][_0x44a0('0x13')]);}})[_0x44a0('0x15')](function(_0x1886b0){logger[_0x44a0('0x11')](_0x44a0('0x14'),_0x132404,_0x1886b0);_0x2fffe0(_0x1886b0);});});} \ No newline at end of file +var _0x6949=['jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2e9c7d,_0x2393af){var _0x3fad0e=function(_0x1cfc3e){while(--_0x1cfc3e){_0x2e9c7d['push'](_0x2e9c7d['shift']());}};_0x3fad0e(++_0x2393af);}(_0x6949,0x1f2));var _0x9694=function(_0x4df85c,_0x248dfb){_0x4df85c=_0x4df85c-0x0;var _0x4e2a61=_0x6949[_0x4df85c];return _0x4e2a61;};'use strict';var _=require(_0x9694('0x0'));var util=require('util');var moment=require(_0x9694('0x1'));var BPromise=require(_0x9694('0x2'));var rs=require(_0x9694('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9694('0x4'))['db'];var utils=require(_0x9694('0x5'));var logger=require(_0x9694('0x6'))(_0x9694('0x7'));var config=require('../../config/environment');var jayson=require(_0x9694('0x8'));var client=jayson['client'][_0x9694('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10102a,_0x16ae75,_0x4722f8){return new BPromise(function(_0x76339f,_0x55a4e8){return client[_0x9694('0xa')](_0x10102a,_0x4722f8)[_0x9694('0xb')](function(_0x57ef2d){logger[_0x9694('0xc')](_0x9694('0xd'),_0x16ae75,_0x9694('0xe'));logger[_0x9694('0xf')](_0x9694('0x10'),_0x16ae75,_0x9694('0xe'),JSON[_0x9694('0x11')](_0x57ef2d));if(_0x57ef2d['error']){if(_0x57ef2d[_0x9694('0x12')][_0x9694('0x13')]===0x1f4){logger[_0x9694('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x16ae75,_0x57ef2d[_0x9694('0x12')][_0x9694('0x14')]);return _0x55a4e8(_0x57ef2d[_0x9694('0x12')][_0x9694('0x14')]);}logger[_0x9694('0x12')](_0x9694('0xd'),_0x16ae75,_0x57ef2d[_0x9694('0x12')][_0x9694('0x14')]);return _0x76339f(_0x57ef2d['error'][_0x9694('0x14')]);}else{logger[_0x9694('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x16ae75,_0x9694('0xe'));_0x76339f(_0x57ef2d[_0x9694('0x15')][_0x9694('0x14')]);}})['catch'](function(_0x56f9aa){logger['error'](_0x9694('0xd'),_0x16ae75,_0x56f9aa);_0x55a4e8(_0x56f9aa);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index feee1f8..2c56cd3 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 _0xad94=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','index','get','/:id','show','post','isAuthenticated','create','put','multer','util'];(function(_0x521a4f,_0x35d045){var _0x58b4df=function(_0xc15bee){while(--_0xc15bee){_0x521a4f['push'](_0x521a4f['shift']());}};_0x58b4df(++_0x35d045);}(_0xad94,0x157));var _0x4ad9=function(_0x139abc,_0x460ebf){_0x139abc=_0x139abc-0x0;var _0x34f4c5=_0xad94[_0x139abc];return _0x34f4c5;};'use strict';var multer=require(_0x4ad9('0x0'));var util=require(_0x4ad9('0x1'));var path=require(_0x4ad9('0x2'));var timeout=require(_0x4ad9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4ad9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4ad9('0x5'));var config=require(_0x4ad9('0x6'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4ad9('0x7')]);router[_0x4ad9('0x8')](_0x4ad9('0x9'),auth['isAuthenticated'](),controller[_0x4ad9('0xa')]);router[_0x4ad9('0xb')]('/',auth[_0x4ad9('0xc')](),controller[_0x4ad9('0xd')]);router[_0x4ad9('0xe')](_0x4ad9('0x9'),auth[_0x4ad9('0xc')](),controller['update']);router['delete'](_0x4ad9('0x9'),auth[_0x4ad9('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9132=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x2e2768,_0x5d6ccd){var _0x483254=function(_0x4aba0b){while(--_0x4aba0b){_0x2e2768['push'](_0x2e2768['shift']());}};_0x483254(++_0x5d6ccd);}(_0x9132,0xb6));var _0x2913=function(_0x3ad826,_0x780857){_0x3ad826=_0x3ad826-0x0;var _0xb56fac=_0x9132[_0x3ad826];return _0xb56fac;};'use strict';var multer=require(_0x2913('0x0'));var util=require(_0x2913('0x1'));var path=require(_0x2913('0x2'));var timeout=require(_0x2913('0x3'));var express=require(_0x2913('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2913('0x5'));var interaction=require(_0x2913('0x6'));var config=require('../../config/environment');var controller=require(_0x2913('0x7'));router[_0x2913('0x8')]('/',auth[_0x2913('0x9')](),controller['index']);router[_0x2913('0x8')]('/:id',auth[_0x2913('0x9')](),controller[_0x2913('0xa')]);router[_0x2913('0xb')]('/',auth[_0x2913('0x9')](),controller[_0x2913('0xc')]);router[_0x2913('0xd')](_0x2913('0xe'),auth[_0x2913('0x9')](),controller[_0x2913('0xf')]);router['delete'](_0x2913('0xe'),auth[_0x2913('0x9')](),controller[_0x2913('0x10')]);module[_0x2913('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 0f20530..12959b8 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 _0x5254=['exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x2b20a1,_0x155034){var _0x299c03=function(_0x59abd2){while(--_0x59abd2){_0x2b20a1['push'](_0x2b20a1['shift']());}};_0x299c03(++_0x155034);}(_0x5254,0x1a8));var _0x4525=function(_0x179cd4,_0x382cb1){_0x179cd4=_0x179cd4-0x0;var _0x1bbe11=_0x5254[_0x179cd4];return _0x1bbe11;};'use strict';var Sequelize=require('sequelize');module[_0x4525('0x0')]={'type':{'type':Sequelize['ENUM'](_0x4525('0x1'),_0x4525('0x2'),_0x4525('0x3'),_0x4525('0x4'),'picklist'),'defaultValue':_0x4525('0x1')},'content':{'type':Sequelize[_0x4525('0x5')]},'key':{'type':Sequelize[_0x4525('0x5')]},'keyType':{'type':Sequelize[_0x4525('0x6')](_0x4525('0x1'),_0x4525('0x2'),_0x4525('0x3'))},'keyContent':{'type':Sequelize[_0x4525('0x5')]},'idField':{'type':Sequelize[_0x4525('0x5')]},'nameField':{'type':Sequelize[_0x4525('0x5')]},'customField':{'type':Sequelize[_0x4525('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4525('0x5')]}}; \ No newline at end of file +var _0x9cd1=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x3b12d3,_0x4dcab2){var _0xf32064=function(_0x597b4b){while(--_0x597b4b){_0x3b12d3['push'](_0x3b12d3['shift']());}};_0xf32064(++_0x4dcab2);}(_0x9cd1,0x16e));var _0x19cd=function(_0x1e5bae,_0x45f1b0){_0x1e5bae=_0x1e5bae-0x0;var _0x22f71b=_0x9cd1[_0x1e5bae];return _0x22f71b;};'use strict';var Sequelize=require(_0x19cd('0x0'));module[_0x19cd('0x1')]={'type':{'type':Sequelize[_0x19cd('0x2')](_0x19cd('0x3'),_0x19cd('0x4'),_0x19cd('0x5'),_0x19cd('0x6'),_0x19cd('0x7')),'defaultValue':_0x19cd('0x3')},'content':{'type':Sequelize[_0x19cd('0x8')]},'key':{'type':Sequelize[_0x19cd('0x8')]},'keyType':{'type':Sequelize[_0x19cd('0x2')](_0x19cd('0x3'),_0x19cd('0x4'),_0x19cd('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x19cd('0x8')]},'nameField':{'type':Sequelize[_0x19cd('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 11cb2f1..129fda8 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 _0x9d9b=['reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply'];(function(_0x2740ac,_0x5a6bdf){var _0x2b2b0d=function(_0x42d6f4){while(--_0x42d6f4){_0x2740ac['push'](_0x2740ac['shift']());}};_0x2b2b0d(++_0x5a6bdf);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0xfbf5c2,_0x53f398){_0xfbf5c2=_0xfbf5c2-0x0;var _0x56ad4e=_0x9d9b[_0xfbf5c2];return _0x56ad4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9d9('0x0'));var zipdir=require(_0xb9d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9d9('0x2'));var moment=require('moment');var BPromise=require(_0xb9d9('0x3'));var Mustache=require(_0xb9d9('0x4'));var util=require(_0xb9d9('0x5'));var path=require('path');var sox=require(_0xb9d9('0x6'));var csv=require('to-csv');var ejs=require(_0xb9d9('0x7'));var fs=require('fs');var fs_extra=require(_0xb9d9('0x8'));var _=require('lodash');var squel=require(_0xb9d9('0x9'));var crypto=require(_0xb9d9('0xa'));var jsforce=require(_0xb9d9('0xb'));var deskjs=require(_0xb9d9('0xc'));var toCsv=require(_0xb9d9('0xd'));var querystring=require(_0xb9d9('0xe'));var Papa=require(_0xb9d9('0xf'));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(_0xb9d9('0x10'));var logger=require(_0xb9d9('0x11'))(_0xb9d9('0x12'));var utils=require('../../config/utils');var config=require(_0xb9d9('0x13'));var licenseUtil=require(_0xb9d9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc03d,_0x5e3782){_0x5e3782=_0x5e3782||0xcc;return function(_0x1245e0){if(_0x1245e0){return _0x3cc03d[_0xb9d9('0x15')](_0x5e3782);}return _0x3cc03d[_0xb9d9('0x16')](_0x5e3782)[_0xb9d9('0x17')]();};}function respondWithResult(_0x26ef71,_0x1d26cf){_0x1d26cf=_0x1d26cf||0xc8;return function(_0x4f0c77){if(_0x4f0c77){return _0x26ef71[_0xb9d9('0x16')](_0x1d26cf)['json'](_0x4f0c77);}};}function respondWithFilteredResult(_0x4c8864,_0x3db648){return function(_0x2c9039){if(_0x2c9039){var _0x3909ab=typeof _0x3db648[_0xb9d9('0x18')]==='undefined'&&typeof _0x3db648['limit']===_0xb9d9('0x19');var _0x5617f1=_0x2c9039['count'];var _0x2b5e26=_0x3909ab?0x0:_0x3db648[_0xb9d9('0x18')];var _0x1e775d=_0x3909ab?_0x2c9039['count']:_0x3db648[_0xb9d9('0x18')]+_0x3db648[_0xb9d9('0x1a')];var _0x493552;if(_0x1e775d>=_0x5617f1){_0x1e775d=_0x5617f1;_0x493552=0xc8;}else{_0x493552=0xce;}_0x4c8864[_0xb9d9('0x16')](_0x493552);return _0x4c8864[_0xb9d9('0x1b')]('Content-Range',_0x2b5e26+'-'+_0x1e775d+'/'+_0x5617f1)[_0xb9d9('0x1c')](_0x2c9039);}return null;};}function patchUpdates(_0x36d55e){return function(_0x50f0ec){try{jsonpatch[_0xb9d9('0x1d')](_0x50f0ec,_0x36d55e,!![]);}catch(_0x42ca87){return BPromise[_0xb9d9('0x1e')](_0x42ca87);}return _0x50f0ec[_0xb9d9('0x1f')]();};}function saveUpdates(_0x288ccd,_0x362104){return function(_0x4c4230){if(_0x4c4230){return _0x4c4230[_0xb9d9('0x20')](_0x288ccd)[_0xb9d9('0x21')](function(_0x53c82a){return _0x53c82a;});}return null;};}function removeEntity(_0x45520b,_0x3d61bf){return function(_0x43bcab){if(_0x43bcab){return _0x43bcab[_0xb9d9('0x22')]()['then'](function(){_0x45520b[_0xb9d9('0x16')](0xcc)[_0xb9d9('0x17')]();});}};}function handleEntityNotFound(_0x6fa6af,_0x436cb7){return function(_0x2650f7){if(!_0x2650f7){_0x6fa6af[_0xb9d9('0x15')](0x194);}return _0x2650f7;};}function handleError(_0x56b394,_0x321937){_0x321937=_0x321937||0x1f4;return function(_0x42181d){logger[_0xb9d9('0x23')](_0x42181d['stack']);if(_0x42181d[_0xb9d9('0x24')]){delete _0x42181d[_0xb9d9('0x24')];}_0x56b394[_0xb9d9('0x16')](_0x321937)[_0xb9d9('0x25')](_0x42181d);};}exports[_0xb9d9('0x26')]=function(_0x402968,_0x89f901){var _0x5c74eb={},_0x39f006={},_0x3e79ef={'count':0x0,'rows':[]};var _0xdf519a=_[_0xb9d9('0x27')](db[_0xb9d9('0x28')][_0xb9d9('0x29')],function(_0x5dbb27){return{'name':_0x5dbb27[_0xb9d9('0x2a')],'type':_0x5dbb27[_0xb9d9('0x2b')][_0xb9d9('0x2c')]};});_0x39f006[_0xb9d9('0x2d')]=_['map'](_0xdf519a,_0xb9d9('0x24'));_0x39f006[_0xb9d9('0x2e')]=_[_0xb9d9('0x2f')](_0x402968[_0xb9d9('0x2e')]);_0x39f006[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](_0x39f006['model'],_0x39f006['query']);_0x5c74eb[_0xb9d9('0x32')]=_['intersection'](_0x39f006[_0xb9d9('0x2d')],qs[_0xb9d9('0x33')](_0x402968[_0xb9d9('0x2e')]['fields']));_0x5c74eb[_0xb9d9('0x32')]=_0x5c74eb[_0xb9d9('0x32')][_0xb9d9('0x34')]?_0x5c74eb[_0xb9d9('0x32')]:_0x39f006[_0xb9d9('0x2d')];if(!_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x35')](_0xb9d9('0x36'))){_0x5c74eb[_0xb9d9('0x1a')]=qs['limit'](_0x402968['query']['limit']);_0x5c74eb[_0xb9d9('0x18')]=qs[_0xb9d9('0x18')](_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x18')]);}_0x5c74eb[_0xb9d9('0x37')]=qs[_0xb9d9('0x38')](_0x402968['query']['sort']);_0x5c74eb['where']=qs[_0xb9d9('0x30')](_[_0xb9d9('0x39')](_0x402968[_0xb9d9('0x2e')],_0x39f006[_0xb9d9('0x30')]),_0xdf519a);if(_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x3a')]){_0x5c74eb[_0xb9d9('0x3b')]=_[_0xb9d9('0x3c')](_0x5c74eb[_0xb9d9('0x3b')],{'$or':_[_0xb9d9('0x27')](_0xdf519a,function(_0xd8b9a2){if(_0xd8b9a2[_0xb9d9('0x2b')]!==_0xb9d9('0x3d')){var _0x46d9a7={};_0x46d9a7[_0xd8b9a2[_0xb9d9('0x24')]]={'$like':'%'+_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x3a')]+'%'};return _0x46d9a7;}})});}_0x5c74eb=_[_0xb9d9('0x3c')]({},_0x5c74eb,_0x402968[_0xb9d9('0x3e')]);var _0x4d3cea={'where':_0x5c74eb[_0xb9d9('0x3b')]};return db[_0xb9d9('0x28')]['count'](_0x4d3cea)['then'](function(_0x41cf93){_0x3e79ef['count']=_0x41cf93;if(_0x402968[_0xb9d9('0x2e')]['includeAll']){_0x5c74eb['include']=[{'all':!![]}];}return db[_0xb9d9('0x28')][_0xb9d9('0x3f')](_0x5c74eb);})[_0xb9d9('0x21')](function(_0x2acfe8){_0x3e79ef[_0xb9d9('0x40')]=_0x2acfe8;return _0x3e79ef;})[_0xb9d9('0x21')](respondWithFilteredResult(_0x89f901,_0x5c74eb))[_0xb9d9('0x41')](handleError(_0x89f901,null));};exports[_0xb9d9('0x42')]=function(_0x596cd8,_0x55007a){var _0x3f4b76={'raw':!![],'where':{'id':_0x596cd8[_0xb9d9('0x43')]['id']}},_0xb7c4ec={};_0xb7c4ec['model']=_[_0xb9d9('0x2f')](db[_0xb9d9('0x28')][_0xb9d9('0x29')]);_0xb7c4ec[_0xb9d9('0x2e')]=_[_0xb9d9('0x2f')](_0x596cd8[_0xb9d9('0x2e')]);_0xb7c4ec[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](_0xb7c4ec['model'],_0xb7c4ec[_0xb9d9('0x2e')]);_0x3f4b76[_0xb9d9('0x32')]=_[_0xb9d9('0x31')](_0xb7c4ec[_0xb9d9('0x2d')],qs[_0xb9d9('0x33')](_0x596cd8[_0xb9d9('0x2e')][_0xb9d9('0x33')]));_0x3f4b76[_0xb9d9('0x32')]=_0x3f4b76[_0xb9d9('0x32')][_0xb9d9('0x34')]?_0x3f4b76[_0xb9d9('0x32')]:_0xb7c4ec[_0xb9d9('0x2d')];if(_0x596cd8[_0xb9d9('0x2e')][_0xb9d9('0x44')]){_0x3f4b76[_0xb9d9('0x45')]=[{'all':!![]}];}_0x3f4b76=_[_0xb9d9('0x3c')]({},_0x3f4b76,_0x596cd8[_0xb9d9('0x3e')]);return db['FreshdeskField'][_0xb9d9('0x46')](_0x3f4b76)[_0xb9d9('0x21')](handleEntityNotFound(_0x55007a,null))['then'](respondWithResult(_0x55007a,null))[_0xb9d9('0x41')](handleError(_0x55007a,null));};exports[_0xb9d9('0x47')]=function(_0x1a4922,_0xa6ce10){return db[_0xb9d9('0x28')][_0xb9d9('0x47')](_0x1a4922['body'],{})[_0xb9d9('0x21')](respondWithResult(_0xa6ce10,0xc9))[_0xb9d9('0x41')](handleError(_0xa6ce10,null));};exports[_0xb9d9('0x20')]=function(_0x30e3b1,_0x53f7cb){if(_0x30e3b1[_0xb9d9('0x48')]['id']){delete _0x30e3b1[_0xb9d9('0x48')]['id'];}return db[_0xb9d9('0x28')]['find']({'where':{'id':_0x30e3b1[_0xb9d9('0x43')]['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x53f7cb,null))[_0xb9d9('0x21')](saveUpdates(_0x30e3b1[_0xb9d9('0x48')],null))[_0xb9d9('0x21')](respondWithResult(_0x53f7cb,null))[_0xb9d9('0x41')](handleError(_0x53f7cb,null));};exports['destroy']=function(_0xd417b9,_0x5cf9a0){return db[_0xb9d9('0x28')][_0xb9d9('0x46')]({'where':{'id':_0xd417b9['params']['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x5cf9a0,null))['then'](removeEntity(_0x5cf9a0,null))['catch'](handleError(_0x5cf9a0,null));}; \ No newline at end of file +var _0x96cc=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3d1684,_0x10c117){var _0x31ac9f=function(_0x35cb54){while(--_0x35cb54){_0x3d1684['push'](_0x3d1684['shift']());}};_0x31ac9f(++_0x10c117);}(_0x96cc,0x16c));var _0xc96c=function(_0x2e30d8,_0x344b2c){_0x2e30d8=_0x2e30d8-0x0;var _0x347234=_0x96cc[_0x2e30d8];return _0x347234;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc96c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc96c('0x2'));var moment=require(_0xc96c('0x3'));var BPromise=require(_0xc96c('0x4'));var Mustache=require(_0xc96c('0x5'));var util=require(_0xc96c('0x6'));var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require(_0xc96c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc96c('0xb'));var squel=require(_0xc96c('0xc'));var crypto=require(_0xc96c('0xd'));var jsforce=require(_0xc96c('0xe'));var deskjs=require(_0xc96c('0xf'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require(_0xc96c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc96c('0x14'));var logger=require('../../config/logger')(_0xc96c('0x15'));var utils=require('../../config/utils');var config=require(_0xc96c('0x16'));var licenseUtil=require(_0xc96c('0x17'));var db=require(_0xc96c('0x18'))['db'];function respondWithStatusCode(_0x246a95,_0x5f27f3){_0x5f27f3=_0x5f27f3||0xcc;return function(_0x3fe3d5){if(_0x3fe3d5){return _0x246a95[_0xc96c('0x19')](_0x5f27f3);}return _0x246a95[_0xc96c('0x1a')](_0x5f27f3)[_0xc96c('0x1b')]();};}function respondWithResult(_0x48de8d,_0x35da94){_0x35da94=_0x35da94||0xc8;return function(_0xbed0c9){if(_0xbed0c9){return _0x48de8d[_0xc96c('0x1a')](_0x35da94)[_0xc96c('0x1c')](_0xbed0c9);}};}function respondWithFilteredResult(_0x377dbc,_0x46455a){return function(_0x1765d9){if(_0x1765d9){var _0x23e357=typeof _0x46455a[_0xc96c('0x1d')]===_0xc96c('0x1e')&&typeof _0x46455a[_0xc96c('0x1f')]==='undefined';var _0x509376=_0x1765d9[_0xc96c('0x20')];var _0x99c402=_0x23e357?0x0:_0x46455a[_0xc96c('0x1d')];var _0x2ae19a=_0x23e357?_0x1765d9['count']:_0x46455a[_0xc96c('0x1d')]+_0x46455a[_0xc96c('0x1f')];var _0x2a361c;if(_0x2ae19a>=_0x509376){_0x2ae19a=_0x509376;_0x2a361c=0xc8;}else{_0x2a361c=0xce;}_0x377dbc[_0xc96c('0x1a')](_0x2a361c);return _0x377dbc[_0xc96c('0x21')](_0xc96c('0x22'),_0x99c402+'-'+_0x2ae19a+'/'+_0x509376)[_0xc96c('0x1c')](_0x1765d9);}return null;};}function patchUpdates(_0x41daba){return function(_0x28d762){try{jsonpatch[_0xc96c('0x23')](_0x28d762,_0x41daba,!![]);}catch(_0x2bb397){return BPromise[_0xc96c('0x24')](_0x2bb397);}return _0x28d762[_0xc96c('0x25')]();};}function saveUpdates(_0x45edee,_0x325c54){return function(_0x3b5c6c){if(_0x3b5c6c){return _0x3b5c6c[_0xc96c('0x26')](_0x45edee)['then'](function(_0xd63951){return _0xd63951;});}return null;};}function removeEntity(_0x4be783,_0x4456bf){return function(_0x10ae21){if(_0x10ae21){return _0x10ae21[_0xc96c('0x27')]()[_0xc96c('0x28')](function(){_0x4be783[_0xc96c('0x1a')](0xcc)[_0xc96c('0x1b')]();});}};}function handleEntityNotFound(_0x1a77df,_0x14f171){return function(_0x50fc07){if(!_0x50fc07){_0x1a77df[_0xc96c('0x19')](0x194);}return _0x50fc07;};}function handleError(_0x117f17,_0x3f87cc){_0x3f87cc=_0x3f87cc||0x1f4;return function(_0x294fee){logger['error'](_0x294fee['stack']);if(_0x294fee[_0xc96c('0x29')]){delete _0x294fee[_0xc96c('0x29')];}_0x117f17[_0xc96c('0x1a')](_0x3f87cc)[_0xc96c('0x2a')](_0x294fee);};}exports[_0xc96c('0x2b')]=function(_0x5e1727,_0x427cb2){var _0x1c911b={},_0xa0efbc={},_0x27925f={'count':0x0,'rows':[]};var _0x325cda=_[_0xc96c('0x2c')](db[_0xc96c('0x2d')][_0xc96c('0x2e')],function(_0x556108){return{'name':_0x556108[_0xc96c('0x2f')],'type':_0x556108['type'][_0xc96c('0x30')]};});_0xa0efbc[_0xc96c('0x31')]=_[_0xc96c('0x2c')](_0x325cda,'name');_0xa0efbc[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x5e1727[_0xc96c('0x32')]);_0xa0efbc[_0xc96c('0x34')]=_['intersection'](_0xa0efbc['model'],_0xa0efbc[_0xc96c('0x32')]);_0x1c911b[_0xc96c('0x35')]=_[_0xc96c('0x36')](_0xa0efbc['model'],qs[_0xc96c('0x37')](_0x5e1727[_0xc96c('0x32')][_0xc96c('0x37')]));_0x1c911b[_0xc96c('0x35')]=_0x1c911b['attributes'][_0xc96c('0x38')]?_0x1c911b[_0xc96c('0x35')]:_0xa0efbc['model'];if(!_0x5e1727[_0xc96c('0x32')][_0xc96c('0x39')](_0xc96c('0x3a'))){_0x1c911b[_0xc96c('0x1f')]=qs[_0xc96c('0x1f')](_0x5e1727[_0xc96c('0x32')]['limit']);_0x1c911b[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x5e1727[_0xc96c('0x32')][_0xc96c('0x1d')]);}_0x1c911b[_0xc96c('0x3b')]=qs[_0xc96c('0x3c')](_0x5e1727['query']['sort']);_0x1c911b[_0xc96c('0x3d')]=qs[_0xc96c('0x34')](_['pick'](_0x5e1727['query'],_0xa0efbc[_0xc96c('0x34')]),_0x325cda);if(_0x5e1727[_0xc96c('0x32')][_0xc96c('0x3e')]){_0x1c911b[_0xc96c('0x3d')]=_[_0xc96c('0x3f')](_0x1c911b[_0xc96c('0x3d')],{'$or':_[_0xc96c('0x2c')](_0x325cda,function(_0x257750){if(_0x257750[_0xc96c('0x40')]!==_0xc96c('0x41')){var _0x1b68e6={};_0x1b68e6[_0x257750['name']]={'$like':'%'+_0x5e1727[_0xc96c('0x32')][_0xc96c('0x3e')]+'%'};return _0x1b68e6;}})});}_0x1c911b=_[_0xc96c('0x3f')]({},_0x1c911b,_0x5e1727[_0xc96c('0x42')]);var _0x4eb180={'where':_0x1c911b[_0xc96c('0x3d')]};return db[_0xc96c('0x2d')][_0xc96c('0x20')](_0x4eb180)['then'](function(_0x510252){_0x27925f[_0xc96c('0x20')]=_0x510252;if(_0x5e1727[_0xc96c('0x32')][_0xc96c('0x43')]){_0x1c911b['include']=[{'all':!![]}];}return db[_0xc96c('0x2d')][_0xc96c('0x44')](_0x1c911b);})[_0xc96c('0x28')](function(_0x2a8ea7){_0x27925f[_0xc96c('0x45')]=_0x2a8ea7;return _0x27925f;})[_0xc96c('0x28')](respondWithFilteredResult(_0x427cb2,_0x1c911b))[_0xc96c('0x46')](handleError(_0x427cb2,null));};exports[_0xc96c('0x47')]=function(_0x25df41,_0x4d5a1b){var _0x4c3088={'raw':!![],'where':{'id':_0x25df41[_0xc96c('0x48')]['id']}},_0x30b3ac={};_0x30b3ac[_0xc96c('0x31')]=_[_0xc96c('0x33')](db['FreshdeskField']['rawAttributes']);_0x30b3ac[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x25df41[_0xc96c('0x32')]);_0x30b3ac[_0xc96c('0x34')]=_[_0xc96c('0x36')](_0x30b3ac[_0xc96c('0x31')],_0x30b3ac[_0xc96c('0x32')]);_0x4c3088['attributes']=_[_0xc96c('0x36')](_0x30b3ac[_0xc96c('0x31')],qs[_0xc96c('0x37')](_0x25df41[_0xc96c('0x32')]['fields']));_0x4c3088['attributes']=_0x4c3088[_0xc96c('0x35')][_0xc96c('0x38')]?_0x4c3088[_0xc96c('0x35')]:_0x30b3ac[_0xc96c('0x31')];if(_0x25df41[_0xc96c('0x32')][_0xc96c('0x43')]){_0x4c3088[_0xc96c('0x49')]=[{'all':!![]}];}_0x4c3088=_[_0xc96c('0x3f')]({},_0x4c3088,_0x25df41[_0xc96c('0x42')]);return db[_0xc96c('0x2d')][_0xc96c('0x4a')](_0x4c3088)[_0xc96c('0x28')](handleEntityNotFound(_0x4d5a1b,null))[_0xc96c('0x28')](respondWithResult(_0x4d5a1b,null))['catch'](handleError(_0x4d5a1b,null));};exports[_0xc96c('0x4b')]=function(_0x2e5045,_0x307d58){return db[_0xc96c('0x2d')]['create'](_0x2e5045[_0xc96c('0x4c')],{})['then'](respondWithResult(_0x307d58,0xc9))[_0xc96c('0x46')](handleError(_0x307d58,null));};exports[_0xc96c('0x26')]=function(_0x565812,_0x2581ae){if(_0x565812[_0xc96c('0x4c')]['id']){delete _0x565812[_0xc96c('0x4c')]['id'];}return db[_0xc96c('0x2d')][_0xc96c('0x4a')]({'where':{'id':_0x565812[_0xc96c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2581ae,null))['then'](saveUpdates(_0x565812['body'],null))[_0xc96c('0x28')](respondWithResult(_0x2581ae,null))['catch'](handleError(_0x2581ae,null));};exports[_0xc96c('0x27')]=function(_0x22b2e3,_0x65a0a7){return db[_0xc96c('0x2d')][_0xc96c('0x4a')]({'where':{'id':_0x22b2e3[_0xc96c('0x48')]['id']}})[_0xc96c('0x28')](handleEntityNotFound(_0x65a0a7,null))[_0xc96c('0x28')](removeEntity(_0x65a0a7,null))[_0xc96c('0x46')](handleError(_0x65a0a7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 1d39a9e..531f9d7 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 _0xfa8a=['idField','lodash','util','api','moment','bluebird','path','rimraf','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa8a,0xc4));var _0xafa8=function(_0xd3a823,_0x4ad32e){_0xd3a823=_0xd3a823-0x0;var _0x54b98a=_0xfa8a[_0xd3a823];return _0x54b98a;};'use strict';var _=require(_0xafa8('0x0'));var util=require(_0xafa8('0x1'));var logger=require('../../config/logger')(_0xafa8('0x2'));var moment=require(_0xafa8('0x3'));var BPromise=require(_0xafa8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafa8('0x5'));var rimraf=require(_0xafa8('0x6'));var config=require('../../config/environment');var attributes=require(_0xafa8('0x7'));module['exports']=function(_0x4542e6,_0x16bd5e){return _0x4542e6[_0xafa8('0x8')](_0xafa8('0x9'),attributes,{'tableName':_0xafa8('0xa'),'paranoid':![],'indexes':[{'name':_0xafa8('0xb'),'fields':[_0xafa8('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1753=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','../../config/logger','api','moment','path','../../config/environment','./intFreshdeskField.attributes','exports','define'];(function(_0x2313e8,_0x332e97){var _0x482a35=function(_0xe736a0){while(--_0xe736a0){_0x2313e8['push'](_0x2313e8['shift']());}};_0x482a35(++_0x332e97);}(_0x1753,0x86));var _0x3175=function(_0x482a12,_0x3474db){_0x482a12=_0x482a12-0x0;var _0x402806=_0x1753[_0x482a12];return _0x402806;};'use strict';var _=require(_0x3175('0x0'));var util=require('util');var logger=require(_0x3175('0x1'))(_0x3175('0x2'));var moment=require(_0x3175('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3175('0x4'));var rimraf=require('rimraf');var config=require(_0x3175('0x5'));var attributes=require(_0x3175('0x6'));module[_0x3175('0x7')]=function(_0x30edb0,_0x1ffac7){return _0x30edb0[_0x3175('0x8')](_0x3175('0x9'),attributes,{'tableName':_0x3175('0xa'),'paranoid':![],'indexes':[{'name':_0x3175('0xb'),'fields':['idField',_0x3175('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index b1e405b..b119357 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 _0xc466=['http','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0xc466,0xbf));var _0x6c46=function(_0x4d9a4f,_0x4a0304){_0x4d9a4f=_0x4d9a4f-0x0;var _0x4cbd27=_0xc466[_0x4d9a4f];return _0x4cbd27;};'use strict';var _=require('lodash');var util=require(_0x6c46('0x0'));var moment=require(_0x6c46('0x1'));var BPromise=require(_0x6c46('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c46('0x3'));var db=require(_0x6c46('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c46('0x5'))(_0x6c46('0x6'));var config=require(_0x6c46('0x7'));var jayson=require(_0x6c46('0x8'));var client=jayson['client'][_0x6c46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cf330,_0x445265,_0x39db99){return new BPromise(function(_0x2bc830,_0x18ec9a){return client['request'](_0x4cf330,_0x39db99)['then'](function(_0x59719d){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x445265,_0x6c46('0xa'));logger[_0x6c46('0xb')](_0x6c46('0xc'),_0x445265,_0x6c46('0xa'),JSON[_0x6c46('0xd')](_0x59719d));if(_0x59719d[_0x6c46('0xe')]){if(_0x59719d[_0x6c46('0xe')][_0x6c46('0xf')]===0x1f4){logger[_0x6c46('0xe')](_0x6c46('0x10'),_0x445265,_0x59719d[_0x6c46('0xe')]['message']);return _0x18ec9a(_0x59719d[_0x6c46('0xe')][_0x6c46('0x11')]);}logger[_0x6c46('0xe')](_0x6c46('0x10'),_0x445265,_0x59719d[_0x6c46('0xe')][_0x6c46('0x11')]);return _0x2bc830(_0x59719d[_0x6c46('0xe')][_0x6c46('0x11')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x445265,_0x6c46('0xa'));_0x2bc830(_0x59719d[_0x6c46('0x12')][_0x6c46('0x11')]);}})[_0x6c46('0x13')](function(_0x3111c3){logger[_0x6c46('0xe')](_0x6c46('0x10'),_0x445265,_0x3111c3);_0x18ec9a(_0x3111c3);});});} \ No newline at end of file +var _0x85d2=['FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','../../config/logger','rpc','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85d2,0xd8));var _0x285d=function(_0x1a9209,_0x527d67){_0x1a9209=_0x1a9209-0x0;var _0x52fdbe=_0x85d2[_0x1a9209];return _0x52fdbe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x285d('0x0'));var BPromise=require(_0x285d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x285d('0x2'))(_0x285d('0x3'));var config=require('../../config/environment');var jayson=require(_0x285d('0x4'));var client=jayson['client'][_0x285d('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x605a42,_0x43690d,_0x4cdb86){return new BPromise(function(_0x3154ce,_0x37efb7){return client[_0x285d('0x6')](_0x605a42,_0x4cdb86)[_0x285d('0x7')](function(_0x758a48){logger[_0x285d('0x8')](_0x285d('0x9'),_0x43690d,_0x285d('0xa'));logger[_0x285d('0xb')](_0x285d('0xc'),_0x43690d,_0x285d('0xa'),JSON[_0x285d('0xd')](_0x758a48));if(_0x758a48['error']){if(_0x758a48[_0x285d('0xe')][_0x285d('0xf')]===0x1f4){logger[_0x285d('0xe')](_0x285d('0x9'),_0x43690d,_0x758a48[_0x285d('0xe')]['message']);return _0x37efb7(_0x758a48[_0x285d('0xe')][_0x285d('0x10')]);}logger[_0x285d('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x43690d,_0x758a48[_0x285d('0xe')][_0x285d('0x10')]);return _0x3154ce(_0x758a48[_0x285d('0xe')]['message']);}else{logger[_0x285d('0x8')](_0x285d('0x9'),_0x43690d,'request\x20sent');_0x3154ce(_0x758a48[_0x285d('0x11')][_0x285d('0x10')]);}})[_0x285d('0x12')](function(_0x160a01){logger[_0x285d('0xe')](_0x285d('0x9'),_0x43690d,_0x160a01);_0x37efb7(_0x160a01);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 55a7f76..7e5973c 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 _0x2e54=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x54d017,_0x225fe8){var _0x24478e=function(_0x424e3e){while(--_0x424e3e){_0x54d017['push'](_0x54d017['shift']());}};_0x24478e(++_0x225fe8);}(_0x2e54,0x1dd));var _0x42e5=function(_0x20aed8,_0x14835b){_0x20aed8=_0x20aed8-0x0;var _0x4fb588=_0x2e54[_0x20aed8];return _0x4fb588;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),controller['create']);router[_0x42e5('0x11')](_0x42e5('0xd'),auth['isAuthenticated'](),controller[_0x42e5('0x12')]);router[_0x42e5('0x13')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x14')]);router[_0x42e5('0x15')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x16')]);module[_0x42e5('0x17')]=router; \ No newline at end of file +var _0x4fc2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path'];(function(_0x295824,_0x335c1a){var _0x3a6602=function(_0x38fdfe){while(--_0x38fdfe){_0x295824['push'](_0x295824['shift']());}};_0x3a6602(++_0x335c1a);}(_0x4fc2,0x111));var _0x24fc=function(_0x393bf5,_0x225cac){_0x393bf5=_0x393bf5-0x0;var _0xcb023=_0x4fc2[_0x393bf5];return _0xcb023;};'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['getConfigurations']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0x11')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router[_0x24fc('0x11')]('/:id/configurations',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller['destroy']);module[_0x24fc('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 cf310e5..477ba3f 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 _0xed3c=['STRING','username','sequelize','exports'];(function(_0x44a9d2,_0x4f99cc){var _0x16b097=function(_0x2cce63){while(--_0x2cce63){_0x44a9d2['push'](_0x44a9d2['shift']());}};_0x16b097(++_0x4f99cc);}(_0xed3c,0x1a6));var _0xced3=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0xed3c[_0x1d39f6];return _0x3dbd7a;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'name':{'type':Sequelize[_0xced3('0x2')]},'description':{'type':Sequelize[_0xced3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xced3('0x3')},'apiKey':{'type':Sequelize[_0xced3('0x2')]},'remoteUri':{'type':Sequelize[_0xced3('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x57ade9,_0x3c9db1){var _0x22ad36=function(_0x2b938f){while(--_0x2b938f){_0x57ade9['push'](_0x57ade9['shift']());}};_0x22ad36(++_0x3c9db1);}(_0x7916,0x128));var _0x6791=function(_0x351a91,_0x1b45f6){_0x351a91=_0x351a91-0x0;var _0x430dd3=_0x7916[_0x351a91];return _0x430dd3;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 29ae420..11628ca 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 _0x5a24=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','end','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','include','then','rows','catch','params','intersection','includeAll','options','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email'];(function(_0x40b8f3,_0x26294b){var _0x2705a2=function(_0x408da7){while(--_0x408da7){_0x40b8f3['push'](_0x40b8f3['shift']());}};_0x2705a2(++_0x26294b);}(_0x5a24,0x18d));var _0x45a2=function(_0x1b0a6b,_0x4b0a0d){_0x1b0a6b=_0x1b0a6b-0x0;var _0x3b4965=_0x5a24[_0x1b0a6b];return _0x3b4965;};'use strict';var emlformat=require(_0x45a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x45a2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45a2('0x2'));var moment=require(_0x45a2('0x3'));var BPromise=require(_0x45a2('0x4'));var Mustache=require(_0x45a2('0x5'));var util=require('util');var path=require(_0x45a2('0x6'));var sox=require('sox');var csv=require(_0x45a2('0x7'));var ejs=require(_0x45a2('0x8'));var fs=require('fs');var fs_extra=require(_0x45a2('0x9'));var _=require(_0x45a2('0xa'));var squel=require('squel');var crypto=require(_0x45a2('0xb'));var jsforce=require(_0x45a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x45a2('0x7'));var querystring=require(_0x45a2('0xd'));var Papa=require('papaparse');var Redis=require(_0x45a2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x45a2('0xf'));var hardwareService=require(_0x45a2('0x10'));var logger=require('../../config/logger')(_0x45a2('0x11'));var utils=require('../../config/utils');var config=require(_0x45a2('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x45a2('0x13'));function respondWithStatusCode(_0x51b925,_0x1a6dbd){_0x1a6dbd=_0x1a6dbd||0xcc;return function(_0x6a5586){if(_0x6a5586){return _0x51b925[_0x45a2('0x14')](_0x1a6dbd);}return _0x51b925[_0x45a2('0x15')](_0x1a6dbd)['end']();};}function respondWithResult(_0x39ce36,_0x563ef0){_0x563ef0=_0x563ef0||0xc8;return function(_0x55df29){if(_0x55df29){return _0x39ce36['status'](_0x563ef0)['json'](_0x55df29);}};}function respondWithFilteredResult(_0x3faa49,_0x5c83bb){return function(_0x411bb5){if(_0x411bb5){var _0x457d4f=typeof _0x5c83bb[_0x45a2('0x16')]===_0x45a2('0x17')&&typeof _0x5c83bb[_0x45a2('0x18')]===_0x45a2('0x17');var _0x3cb4eb=_0x411bb5['count'];var _0x39bf63=_0x457d4f?0x0:_0x5c83bb[_0x45a2('0x16')];var _0x36516f=_0x457d4f?_0x411bb5[_0x45a2('0x19')]:_0x5c83bb[_0x45a2('0x16')]+_0x5c83bb['limit'];var _0x5aa4eb;if(_0x36516f>=_0x3cb4eb){_0x36516f=_0x3cb4eb;_0x5aa4eb=0xc8;}else{_0x5aa4eb=0xce;}_0x3faa49[_0x45a2('0x15')](_0x5aa4eb);return _0x3faa49[_0x45a2('0x1a')]('Content-Range',_0x39bf63+'-'+_0x36516f+'/'+_0x3cb4eb)['json'](_0x411bb5);}return null;};}function patchUpdates(_0x35e810){return function(_0x430aff){try{jsonpatch[_0x45a2('0x1b')](_0x430aff,_0x35e810,!![]);}catch(_0x6ee11d){return BPromise[_0x45a2('0x1c')](_0x6ee11d);}return _0x430aff[_0x45a2('0x1d')]();};}function saveUpdates(_0x1007f8,_0x79763b){return function(_0x356638){if(_0x356638){return _0x356638[_0x45a2('0x1e')](_0x1007f8)['then'](function(_0x94d239){return _0x94d239;});}return null;};}function removeEntity(_0x21d22b,_0x5935af){return function(_0x22b074){if(_0x22b074){return _0x22b074['destroy']()['then'](function(){_0x21d22b[_0x45a2('0x15')](0xcc)[_0x45a2('0x1f')]();});}};}function handleEntityNotFound(_0x38b744,_0xd68f0f){return function(_0x40b2fd){if(!_0x40b2fd){_0x38b744['sendStatus'](0x194);}return _0x40b2fd;};}function handleError(_0x11d21c,_0x3cd144){_0x3cd144=_0x3cd144||0x1f4;return function(_0x3c9b0c){logger[_0x45a2('0x20')](_0x3c9b0c[_0x45a2('0x21')]);if(_0x3c9b0c['name']){delete _0x3c9b0c[_0x45a2('0x22')];}_0x11d21c[_0x45a2('0x15')](_0x3cd144)[_0x45a2('0x23')](_0x3c9b0c);};}exports[_0x45a2('0x24')]=function(_0x1e1c9b,_0x47e638){var _0x10ff5c={},_0x17c902={},_0x4bf18d={'count':0x0,'rows':[]};var _0x1e5f9d=_['map'](db[_0x45a2('0x25')][_0x45a2('0x26')],function(_0x185488){return{'name':_0x185488[_0x45a2('0x27')],'type':_0x185488[_0x45a2('0x28')]['key']};});_0x17c902[_0x45a2('0x29')]=_[_0x45a2('0x2a')](_0x1e5f9d,_0x45a2('0x22'));_0x17c902[_0x45a2('0x2b')]=_[_0x45a2('0x2c')](_0x1e1c9b['query']);_0x17c902[_0x45a2('0x2d')]=_['intersection'](_0x17c902[_0x45a2('0x29')],_0x17c902['query']);_0x10ff5c[_0x45a2('0x2e')]=_['intersection'](_0x17c902[_0x45a2('0x29')],qs[_0x45a2('0x2f')](_0x1e1c9b[_0x45a2('0x2b')][_0x45a2('0x2f')]));_0x10ff5c['attributes']=_0x10ff5c[_0x45a2('0x2e')][_0x45a2('0x30')]?_0x10ff5c[_0x45a2('0x2e')]:_0x17c902[_0x45a2('0x29')];if(!_0x1e1c9b[_0x45a2('0x2b')][_0x45a2('0x31')](_0x45a2('0x32'))){_0x10ff5c[_0x45a2('0x18')]=qs[_0x45a2('0x18')](_0x1e1c9b[_0x45a2('0x2b')][_0x45a2('0x18')]);_0x10ff5c['offset']=qs[_0x45a2('0x16')](_0x1e1c9b['query'][_0x45a2('0x16')]);}_0x10ff5c[_0x45a2('0x33')]=qs[_0x45a2('0x34')](_0x1e1c9b[_0x45a2('0x2b')][_0x45a2('0x34')]);_0x10ff5c[_0x45a2('0x35')]=qs[_0x45a2('0x2d')](_['pick'](_0x1e1c9b[_0x45a2('0x2b')],_0x17c902[_0x45a2('0x2d')]),_0x1e5f9d);if(_0x1e1c9b[_0x45a2('0x2b')]['filter']){_0x10ff5c['where']=_[_0x45a2('0x36')](_0x10ff5c[_0x45a2('0x35')],{'$or':_[_0x45a2('0x2a')](_0x1e5f9d,function(_0x513354){if(_0x513354[_0x45a2('0x28')]!==_0x45a2('0x37')){var _0x47d581={};_0x47d581[_0x513354[_0x45a2('0x22')]]={'$like':'%'+_0x1e1c9b['query'][_0x45a2('0x38')]+'%'};return _0x47d581;}})});}_0x10ff5c=_[_0x45a2('0x36')]({},_0x10ff5c,_0x1e1c9b['options']);var _0x12aab5={'where':_0x10ff5c[_0x45a2('0x35')]};return db[_0x45a2('0x25')][_0x45a2('0x19')](_0x12aab5)['then'](function(_0x5987dc){_0x4bf18d['count']=_0x5987dc;if(_0x1e1c9b[_0x45a2('0x2b')]['includeAll']){_0x10ff5c[_0x45a2('0x39')]=[{'all':!![]}];}return db[_0x45a2('0x25')]['findAll'](_0x10ff5c);})[_0x45a2('0x3a')](function(_0x74ab80){_0x4bf18d[_0x45a2('0x3b')]=_0x74ab80;return _0x4bf18d;})[_0x45a2('0x3a')](respondWithFilteredResult(_0x47e638,_0x10ff5c))[_0x45a2('0x3c')](handleError(_0x47e638,null));};exports['show']=function(_0x23ae8e,_0x41d1cb){var _0x346971={'raw':![],'where':{'id':_0x23ae8e[_0x45a2('0x3d')]['id']}},_0x2114a6={};_0x2114a6[_0x45a2('0x29')]=_['keys'](db[_0x45a2('0x25')][_0x45a2('0x26')]);_0x2114a6['query']=_[_0x45a2('0x2c')](_0x23ae8e[_0x45a2('0x2b')]);_0x2114a6['filters']=_[_0x45a2('0x3e')](_0x2114a6[_0x45a2('0x29')],_0x2114a6['query']);_0x346971[_0x45a2('0x2e')]=_[_0x45a2('0x3e')](_0x2114a6[_0x45a2('0x29')],qs[_0x45a2('0x2f')](_0x23ae8e[_0x45a2('0x2b')]['fields']));_0x346971['attributes']=_0x346971[_0x45a2('0x2e')][_0x45a2('0x30')]?_0x346971[_0x45a2('0x2e')]:_0x2114a6[_0x45a2('0x29')];if(_0x23ae8e[_0x45a2('0x2b')][_0x45a2('0x3f')]){_0x346971[_0x45a2('0x39')]=[{'all':!![]}];}_0x346971=_[_0x45a2('0x36')]({},_0x346971,_0x23ae8e[_0x45a2('0x40')]);return db[_0x45a2('0x25')][_0x45a2('0x41')](_0x346971)[_0x45a2('0x3a')](handleEntityNotFound(_0x41d1cb,null))['then'](respondWithResult(_0x41d1cb,null))[_0x45a2('0x3c')](handleError(_0x41d1cb,null));};exports['create']=function(_0x18a832,_0x1582e4){return db['FreshsalesAccount'][_0x45a2('0x42')](_0x18a832[_0x45a2('0x43')],{})['then'](respondWithResult(_0x1582e4,0xc9))[_0x45a2('0x3c')](handleError(_0x1582e4,null));};exports[_0x45a2('0x1e')]=function(_0x46ac44,_0xab24e9){if(_0x46ac44[_0x45a2('0x43')]['id']){delete _0x46ac44['body']['id'];}return db[_0x45a2('0x25')][_0x45a2('0x41')]({'where':{'id':_0x46ac44[_0x45a2('0x3d')]['id']}})['then'](handleEntityNotFound(_0xab24e9,null))['then'](saveUpdates(_0x46ac44['body'],null))[_0x45a2('0x3a')](respondWithResult(_0xab24e9,null))['catch'](handleError(_0xab24e9,null));};exports[_0x45a2('0x44')]=function(_0x3b2290,_0x3e5a35){return db['FreshsalesAccount']['find']({'where':{'id':_0x3b2290[_0x45a2('0x3d')]['id']}})[_0x45a2('0x3a')](handleEntityNotFound(_0x3e5a35,null))[_0x45a2('0x3a')](removeEntity(_0x3e5a35,null))['catch'](handleError(_0x3e5a35,null));};exports[_0x45a2('0x45')]=function(_0x270353,_0x9af4e8,_0x532b32){var _0x593fcb={};var _0xfcc369={};var _0x52f5df;var _0x286f25;return db[_0x45a2('0x25')][_0x45a2('0x46')]({'where':{'id':_0x270353[_0x45a2('0x3d')]['id']}})[_0x45a2('0x3a')](handleEntityNotFound(_0x9af4e8,null))['then'](function(_0x1ed2e4){if(_0x1ed2e4){_0x52f5df=_0x1ed2e4;_0xfcc369['model']=_[_0x45a2('0x2c')](db['FreshsalesConfiguration']['rawAttributes']);_0xfcc369[_0x45a2('0x2b')]=_[_0x45a2('0x2c')](_0x270353['query']);_0xfcc369[_0x45a2('0x2d')]=_[_0x45a2('0x3e')](_0xfcc369[_0x45a2('0x29')],_0xfcc369[_0x45a2('0x2b')]);_0x593fcb['attributes']=_[_0x45a2('0x3e')](_0xfcc369['model'],qs[_0x45a2('0x2f')](_0x270353[_0x45a2('0x2b')][_0x45a2('0x2f')]));_0x593fcb[_0x45a2('0x2e')]=_0x593fcb['attributes'][_0x45a2('0x30')]?_0x593fcb[_0x45a2('0x2e')]:_0xfcc369['model'];_0x593fcb['order']=qs[_0x45a2('0x34')](_0x270353['query']['sort']);_0x593fcb[_0x45a2('0x35')]=qs[_0x45a2('0x2d')](_['pick'](_0x270353['query'],_0xfcc369['filters']));if(_0x270353[_0x45a2('0x2b')][_0x45a2('0x38')]){_0x593fcb[_0x45a2('0x35')]=_[_0x45a2('0x36')](_0x593fcb[_0x45a2('0x35')],{'$or':_['map'](_0x593fcb[_0x45a2('0x2e')],function(_0x41c6d4){var _0x51658b={};_0x51658b[_0x41c6d4]={'$like':'%'+_0x270353['query'][_0x45a2('0x38')]+'%'};return _0x51658b;})});}_0x593fcb=_[_0x45a2('0x36')]({},_0x593fcb,_0x270353[_0x45a2('0x40')]);return _0x52f5df[_0x45a2('0x45')](_0x593fcb);}})[_0x45a2('0x3a')](function(_0x20f4cf){if(_0x20f4cf){_0x286f25=_0x20f4cf['length'];if(!_0x270353[_0x45a2('0x2b')]['hasOwnProperty'](_0x45a2('0x32'))){_0x593fcb[_0x45a2('0x18')]=qs[_0x45a2('0x18')](_0x270353[_0x45a2('0x2b')][_0x45a2('0x18')]);_0x593fcb[_0x45a2('0x16')]=qs[_0x45a2('0x16')](_0x270353['query'][_0x45a2('0x16')]);}return _0x52f5df['getConfigurations'](_0x593fcb);}})['then'](function(_0x5820ac){if(_0x5820ac){return _0x5820ac?{'count':_0x286f25,'rows':_0x5820ac}:null;}})['then'](respondWithResult(_0x9af4e8,null))[_0x45a2('0x3c')](handleError(_0x9af4e8,null));};exports[_0x45a2('0x47')]=function(_0x5063c2,_0x38b85f,_0x3e811f){if(_0x5063c2[_0x45a2('0x43')]['id']){delete _0x5063c2[_0x45a2('0x43')]['id'];}return db[_0x45a2('0x25')]['findOne']({'where':{'id':_0x5063c2[_0x45a2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x38b85f,null))[_0x45a2('0x3a')](function(_0x5b23de){if(_0x5b23de){_0x5063c2[_0x45a2('0x43')][_0x45a2('0x48')]=_0x5b23de['id'];_0x5063c2['body'][_0x45a2('0x49')]=integrations[_0x45a2('0x4a')](_0x5063c2[_0x45a2('0x43')][_0x45a2('0x4b')],_0x5063c2['body'][_0x45a2('0x28')]);_0x5063c2[_0x45a2('0x43')][_0x45a2('0x4c')]=integrations['getDescriptions'](_0x5063c2['body'][_0x45a2('0x4b')],_0x5063c2['body'][_0x45a2('0x28')]);return db[_0x45a2('0x4d')]['create'](_0x5063c2[_0x45a2('0x43')],{'include':[{'model':db[_0x45a2('0x4e')],'as':'Subjects'},{'model':db[_0x45a2('0x4e')],'as':_0x45a2('0x4c')}]});}return null;})[_0x45a2('0x3a')](respondWithResult(_0x38b85f,null))[_0x45a2('0x3c')](handleError(_0x38b85f,null));};exports[_0x45a2('0x4f')]=function(_0x44b0c1,_0x1a159c,_0x5187fc){var _0x5e6882='';var _0x319494='';return db[_0x45a2('0x25')][_0x45a2('0x46')]({'where':{'id':_0x44b0c1[_0x45a2('0x3d')]['id']},'attributes':['id',_0x45a2('0x50'),_0x45a2('0x51'),_0x45a2('0x52')]})[_0x45a2('0x3a')](handleEntityNotFound(_0x1a159c,null))['then'](function(_0xe69442){if(_0xe69442){_0x319494=_0xe69442[_0x45a2('0x50')];_0x5e6882=_0xe69442[_0x45a2('0x51')];var _0x5a05a3=_0xe69442[_0x45a2('0x51')][_0x45a2('0x53')](-0x1);if(_0x5a05a3==='/'){_0x5e6882=_0x5e6882[_0x45a2('0x54')](0x0,_0x5e6882[_0x45a2('0x55')](_0x5a05a3));}return rp({'method':_0x45a2('0x56'),'uri':util[_0x45a2('0x57')](_0x45a2('0x58'),_0x5e6882,_0x45a2('0x59')),'headers':{'Authorization':_0x45a2('0x5a')+_0xe69442['apiKey']},'json':!![]});}})[_0x45a2('0x3a')](function(_0x58d8b7){if(_0x58d8b7){var _0x229bd6=_0x58d8b7[_0x45a2('0x5b')];var _0x4b838a=![];var _0x1d2ba1=null;for(_0x1d2ba1=0x0;_0x1d2ba1<_0x229bd6[_0x45a2('0x30')];_0x1d2ba1++){if(_0x229bd6[_0x1d2ba1][_0x45a2('0x5c')]===_0x319494){_0x4b838a=!![];}}if(_0x4b838a){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x1a159c,null))['catch'](function(_0x189c42){var _0x482f0d=_0x44b0c1[_0x45a2('0x2b')][_0x45a2('0x5d')]?0x1f4:_0x189c42[_0x45a2('0x5e')]||0x1f4;logger[_0x45a2('0x20')](_0x45a2('0x5f'),_0x45a2('0x4f'),_0x482f0d,JSON[_0x45a2('0x60')](_0x189c42));delete _0x189c42[_0x45a2('0x22')];if(_0x482f0d===0x191){_0x482f0d=0x190;}_0x1a159c['status'](_0x482f0d)[_0x45a2('0x23')](_0x44b0c1[_0x45a2('0x2b')][_0x45a2('0x5d')]?{'message':_0x45a2('0x61'),'statusCode':_0x189c42[_0x45a2('0x5e')]}:_0x189c42);});}; \ No newline at end of file +var _0x1cd6=['GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','VIRTUAL','filter','includeAll','findAll','rows','show','params','options','find','catch','create','body','order','merge','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','remoteUri','username','slice','substring'];(function(_0x5c6aeb,_0x1a3eda){var _0x518281=function(_0x5bcb78){while(--_0x5bcb78){_0x5c6aeb['push'](_0x5c6aeb['shift']());}};_0x518281(++_0x1a3eda);}(_0x1cd6,0x72));var _0x61cd=function(_0x3360d0,_0x356311){_0x3360d0=_0x3360d0-0x0;var _0x25cbf3=_0x1cd6[_0x3360d0];return _0x25cbf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x61cd('0x0'));var zipdir=require(_0x61cd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x61cd('0x2'));var Mustache=require(_0x61cd('0x3'));var util=require(_0x61cd('0x4'));var path=require('path');var sox=require(_0x61cd('0x5'));var csv=require('to-csv');var ejs=require(_0x61cd('0x6'));var fs=require('fs');var fs_extra=require(_0x61cd('0x7'));var _=require(_0x61cd('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x61cd('0x9'));var deskjs=require(_0x61cd('0xa'));var toCsv=require(_0x61cd('0xb'));var querystring=require(_0x61cd('0xc'));var Papa=require(_0x61cd('0xd'));var Redis=require('ioredis');var authService=require(_0x61cd('0xe'));var qs=require(_0x61cd('0xf'));var as=require(_0x61cd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61cd('0x11'))(_0x61cd('0x12'));var utils=require(_0x61cd('0x13'));var config=require(_0x61cd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x61cd('0x15'))['db'];var integrations=require(_0x61cd('0x16'));function respondWithStatusCode(_0x4696fa,_0x2b9627){_0x2b9627=_0x2b9627||0xcc;return function(_0x21a3f2){if(_0x21a3f2){return _0x4696fa[_0x61cd('0x17')](_0x2b9627);}return _0x4696fa['status'](_0x2b9627)[_0x61cd('0x18')]();};}function respondWithResult(_0x12da21,_0x38e049){_0x38e049=_0x38e049||0xc8;return function(_0x5750b0){if(_0x5750b0){return _0x12da21[_0x61cd('0x19')](_0x38e049)['json'](_0x5750b0);}};}function respondWithFilteredResult(_0x4f5f44,_0x490824){return function(_0x3bb30f){if(_0x3bb30f){var _0x4553af=typeof _0x490824[_0x61cd('0x1a')]===_0x61cd('0x1b')&&typeof _0x490824[_0x61cd('0x1c')]===_0x61cd('0x1b');var _0x2e8647=_0x3bb30f[_0x61cd('0x1d')];var _0x44a3c8=_0x4553af?0x0:_0x490824['offset'];var _0x573154=_0x4553af?_0x3bb30f[_0x61cd('0x1d')]:_0x490824[_0x61cd('0x1a')]+_0x490824[_0x61cd('0x1c')];var _0xc28419;if(_0x573154>=_0x2e8647){_0x573154=_0x2e8647;_0xc28419=0xc8;}else{_0xc28419=0xce;}_0x4f5f44['status'](_0xc28419);return _0x4f5f44[_0x61cd('0x1e')](_0x61cd('0x1f'),_0x44a3c8+'-'+_0x573154+'/'+_0x2e8647)['json'](_0x3bb30f);}return null;};}function patchUpdates(_0x1196a5){return function(_0x4a41a0){try{jsonpatch['apply'](_0x4a41a0,_0x1196a5,!![]);}catch(_0x12815b){return BPromise[_0x61cd('0x20')](_0x12815b);}return _0x4a41a0[_0x61cd('0x21')]();};}function saveUpdates(_0x2a4e1b,_0x521d38){return function(_0x5e7fe1){if(_0x5e7fe1){return _0x5e7fe1[_0x61cd('0x22')](_0x2a4e1b)[_0x61cd('0x23')](function(_0x183bb3){return _0x183bb3;});}return null;};}function removeEntity(_0xfcc784,_0x11ba75){return function(_0x1b24f9){if(_0x1b24f9){return _0x1b24f9[_0x61cd('0x24')]()[_0x61cd('0x23')](function(){_0xfcc784[_0x61cd('0x19')](0xcc)[_0x61cd('0x18')]();});}};}function handleEntityNotFound(_0x14dd58,_0x34e028){return function(_0x5566e2){if(!_0x5566e2){_0x14dd58[_0x61cd('0x17')](0x194);}return _0x5566e2;};}function handleError(_0x4bdfc4,_0x324ce0){_0x324ce0=_0x324ce0||0x1f4;return function(_0xf27ea9){logger[_0x61cd('0x25')](_0xf27ea9[_0x61cd('0x26')]);if(_0xf27ea9[_0x61cd('0x27')]){delete _0xf27ea9[_0x61cd('0x27')];}_0x4bdfc4[_0x61cd('0x19')](_0x324ce0)[_0x61cd('0x28')](_0xf27ea9);};}exports[_0x61cd('0x29')]=function(_0x5c39bc,_0x378b4a){var _0x1a894e={},_0x2876ec={},_0x50bf6c={'count':0x0,'rows':[]};var _0x35a735=_['map'](db[_0x61cd('0x2a')][_0x61cd('0x2b')],function(_0x41fe14){return{'name':_0x41fe14[_0x61cd('0x2c')],'type':_0x41fe14[_0x61cd('0x2d')][_0x61cd('0x2e')]};});_0x2876ec[_0x61cd('0x2f')]=_[_0x61cd('0x30')](_0x35a735,'name');_0x2876ec[_0x61cd('0x31')]=_[_0x61cd('0x32')](_0x5c39bc[_0x61cd('0x31')]);_0x2876ec[_0x61cd('0x33')]=_[_0x61cd('0x34')](_0x2876ec[_0x61cd('0x2f')],_0x2876ec[_0x61cd('0x31')]);_0x1a894e[_0x61cd('0x35')]=_['intersection'](_0x2876ec[_0x61cd('0x2f')],qs[_0x61cd('0x36')](_0x5c39bc[_0x61cd('0x31')][_0x61cd('0x36')]));_0x1a894e[_0x61cd('0x35')]=_0x1a894e[_0x61cd('0x35')][_0x61cd('0x37')]?_0x1a894e[_0x61cd('0x35')]:_0x2876ec[_0x61cd('0x2f')];if(!_0x5c39bc[_0x61cd('0x31')]['hasOwnProperty'](_0x61cd('0x38'))){_0x1a894e['limit']=qs['limit'](_0x5c39bc[_0x61cd('0x31')][_0x61cd('0x1c')]);_0x1a894e[_0x61cd('0x1a')]=qs[_0x61cd('0x1a')](_0x5c39bc[_0x61cd('0x31')][_0x61cd('0x1a')]);}_0x1a894e['order']=qs[_0x61cd('0x39')](_0x5c39bc['query'][_0x61cd('0x39')]);_0x1a894e['where']=qs[_0x61cd('0x33')](_[_0x61cd('0x3a')](_0x5c39bc[_0x61cd('0x31')],_0x2876ec[_0x61cd('0x33')]),_0x35a735);if(_0x5c39bc['query']['filter']){_0x1a894e['where']=_['merge'](_0x1a894e[_0x61cd('0x3b')],{'$or':_['map'](_0x35a735,function(_0x38a963){if(_0x38a963[_0x61cd('0x2d')]!==_0x61cd('0x3c')){var _0x3806a5={};_0x3806a5[_0x38a963['name']]={'$like':'%'+_0x5c39bc[_0x61cd('0x31')][_0x61cd('0x3d')]+'%'};return _0x3806a5;}})});}_0x1a894e=_['merge']({},_0x1a894e,_0x5c39bc['options']);var _0x142d5a={'where':_0x1a894e[_0x61cd('0x3b')]};return db['FreshsalesAccount'][_0x61cd('0x1d')](_0x142d5a)[_0x61cd('0x23')](function(_0x2c4910){_0x50bf6c[_0x61cd('0x1d')]=_0x2c4910;if(_0x5c39bc[_0x61cd('0x31')][_0x61cd('0x3e')]){_0x1a894e['include']=[{'all':!![]}];}return db[_0x61cd('0x2a')][_0x61cd('0x3f')](_0x1a894e);})[_0x61cd('0x23')](function(_0x485a06){_0x50bf6c[_0x61cd('0x40')]=_0x485a06;return _0x50bf6c;})['then'](respondWithFilteredResult(_0x378b4a,_0x1a894e))['catch'](handleError(_0x378b4a,null));};exports[_0x61cd('0x41')]=function(_0xa37480,_0x2cf6e1){var _0x74b8ab={'raw':![],'where':{'id':_0xa37480[_0x61cd('0x42')]['id']}},_0x49de21={};_0x49de21['model']=_[_0x61cd('0x32')](db[_0x61cd('0x2a')][_0x61cd('0x2b')]);_0x49de21[_0x61cd('0x31')]=_[_0x61cd('0x32')](_0xa37480[_0x61cd('0x31')]);_0x49de21['filters']=_[_0x61cd('0x34')](_0x49de21[_0x61cd('0x2f')],_0x49de21[_0x61cd('0x31')]);_0x74b8ab[_0x61cd('0x35')]=_[_0x61cd('0x34')](_0x49de21[_0x61cd('0x2f')],qs[_0x61cd('0x36')](_0xa37480[_0x61cd('0x31')][_0x61cd('0x36')]));_0x74b8ab[_0x61cd('0x35')]=_0x74b8ab[_0x61cd('0x35')][_0x61cd('0x37')]?_0x74b8ab[_0x61cd('0x35')]:_0x49de21[_0x61cd('0x2f')];if(_0xa37480[_0x61cd('0x31')][_0x61cd('0x3e')]){_0x74b8ab['include']=[{'all':!![]}];}_0x74b8ab=_['merge']({},_0x74b8ab,_0xa37480[_0x61cd('0x43')]);return db['FreshsalesAccount'][_0x61cd('0x44')](_0x74b8ab)[_0x61cd('0x23')](handleEntityNotFound(_0x2cf6e1,null))[_0x61cd('0x23')](respondWithResult(_0x2cf6e1,null))[_0x61cd('0x45')](handleError(_0x2cf6e1,null));};exports[_0x61cd('0x46')]=function(_0x1b6321,_0xadd186){return db[_0x61cd('0x2a')][_0x61cd('0x46')](_0x1b6321['body'],{})[_0x61cd('0x23')](respondWithResult(_0xadd186,0xc9))['catch'](handleError(_0xadd186,null));};exports[_0x61cd('0x22')]=function(_0x4d9669,_0x5ddae4){if(_0x4d9669[_0x61cd('0x47')]['id']){delete _0x4d9669[_0x61cd('0x47')]['id'];}return db[_0x61cd('0x2a')][_0x61cd('0x44')]({'where':{'id':_0x4d9669[_0x61cd('0x42')]['id']}})[_0x61cd('0x23')](handleEntityNotFound(_0x5ddae4,null))['then'](saveUpdates(_0x4d9669[_0x61cd('0x47')],null))['then'](respondWithResult(_0x5ddae4,null))[_0x61cd('0x45')](handleError(_0x5ddae4,null));};exports[_0x61cd('0x24')]=function(_0x10d851,_0x5dee0f){return db[_0x61cd('0x2a')][_0x61cd('0x44')]({'where':{'id':_0x10d851[_0x61cd('0x42')]['id']}})[_0x61cd('0x23')](handleEntityNotFound(_0x5dee0f,null))[_0x61cd('0x23')](removeEntity(_0x5dee0f,null))[_0x61cd('0x45')](handleError(_0x5dee0f,null));};exports['getConfigurations']=function(_0x269735,_0x3eaf41,_0x59e381){var _0x1630f8={};var _0x5753a7={};var _0x5c82d1;var _0xf06d9d;return db[_0x61cd('0x2a')]['findOne']({'where':{'id':_0x269735[_0x61cd('0x42')]['id']}})[_0x61cd('0x23')](handleEntityNotFound(_0x3eaf41,null))[_0x61cd('0x23')](function(_0x2c0bda){if(_0x2c0bda){_0x5c82d1=_0x2c0bda;_0x5753a7[_0x61cd('0x2f')]=_[_0x61cd('0x32')](db['FreshsalesConfiguration']['rawAttributes']);_0x5753a7[_0x61cd('0x31')]=_['keys'](_0x269735[_0x61cd('0x31')]);_0x5753a7[_0x61cd('0x33')]=_[_0x61cd('0x34')](_0x5753a7[_0x61cd('0x2f')],_0x5753a7['query']);_0x1630f8[_0x61cd('0x35')]=_[_0x61cd('0x34')](_0x5753a7[_0x61cd('0x2f')],qs[_0x61cd('0x36')](_0x269735[_0x61cd('0x31')][_0x61cd('0x36')]));_0x1630f8['attributes']=_0x1630f8['attributes'][_0x61cd('0x37')]?_0x1630f8[_0x61cd('0x35')]:_0x5753a7[_0x61cd('0x2f')];_0x1630f8[_0x61cd('0x48')]=qs[_0x61cd('0x39')](_0x269735[_0x61cd('0x31')]['sort']);_0x1630f8[_0x61cd('0x3b')]=qs[_0x61cd('0x33')](_[_0x61cd('0x3a')](_0x269735['query'],_0x5753a7['filters']));if(_0x269735[_0x61cd('0x31')]['filter']){_0x1630f8[_0x61cd('0x3b')]=_[_0x61cd('0x49')](_0x1630f8[_0x61cd('0x3b')],{'$or':_[_0x61cd('0x30')](_0x1630f8[_0x61cd('0x35')],function(_0x12a6ca){var _0x3d3656={};_0x3d3656[_0x12a6ca]={'$like':'%'+_0x269735[_0x61cd('0x31')][_0x61cd('0x3d')]+'%'};return _0x3d3656;})});}_0x1630f8=_[_0x61cd('0x49')]({},_0x1630f8,_0x269735[_0x61cd('0x43')]);return _0x5c82d1[_0x61cd('0x4a')](_0x1630f8);}})[_0x61cd('0x23')](function(_0x466651){if(_0x466651){_0xf06d9d=_0x466651['length'];if(!_0x269735[_0x61cd('0x31')][_0x61cd('0x4b')](_0x61cd('0x38'))){_0x1630f8[_0x61cd('0x1c')]=qs[_0x61cd('0x1c')](_0x269735['query'][_0x61cd('0x1c')]);_0x1630f8[_0x61cd('0x1a')]=qs['offset'](_0x269735['query'][_0x61cd('0x1a')]);}return _0x5c82d1[_0x61cd('0x4a')](_0x1630f8);}})[_0x61cd('0x23')](function(_0x487507){if(_0x487507){return _0x487507?{'count':_0xf06d9d,'rows':_0x487507}:null;}})['then'](respondWithResult(_0x3eaf41,null))[_0x61cd('0x45')](handleError(_0x3eaf41,null));};exports[_0x61cd('0x4c')]=function(_0x2360fb,_0x45bdaa,_0x530e69){if(_0x2360fb[_0x61cd('0x47')]['id']){delete _0x2360fb['body']['id'];}return db[_0x61cd('0x2a')][_0x61cd('0x4d')]({'where':{'id':_0x2360fb[_0x61cd('0x42')]['id']}})[_0x61cd('0x23')](handleEntityNotFound(_0x45bdaa,null))[_0x61cd('0x23')](function(_0xd8470b){if(_0xd8470b){_0x2360fb[_0x61cd('0x47')][_0x61cd('0x4e')]=_0xd8470b['id'];_0x2360fb[_0x61cd('0x47')][_0x61cd('0x4f')]=integrations['getSubjects'](_0x2360fb['body'][_0x61cd('0x50')],_0x2360fb[_0x61cd('0x47')][_0x61cd('0x2d')]);_0x2360fb['body'][_0x61cd('0x51')]=integrations[_0x61cd('0x52')](_0x2360fb[_0x61cd('0x47')][_0x61cd('0x50')],_0x2360fb[_0x61cd('0x47')][_0x61cd('0x2d')]);return db[_0x61cd('0x53')][_0x61cd('0x46')](_0x2360fb[_0x61cd('0x47')],{'include':[{'model':db[_0x61cd('0x54')],'as':'Subjects'},{'model':db[_0x61cd('0x54')],'as':_0x61cd('0x51')}]});}return null;})[_0x61cd('0x23')](respondWithResult(_0x45bdaa,null))[_0x61cd('0x45')](handleError(_0x45bdaa,null));};exports[_0x61cd('0x55')]=function(_0x5918fe,_0x1a18d5,_0x1521c3){var _0x1b23d5='';var _0x48574e='';return db[_0x61cd('0x2a')]['findOne']({'where':{'id':_0x5918fe['params']['id']},'attributes':['id','username',_0x61cd('0x56'),'apiKey']})[_0x61cd('0x23')](handleEntityNotFound(_0x1a18d5,null))[_0x61cd('0x23')](function(_0x22d164){if(_0x22d164){_0x48574e=_0x22d164[_0x61cd('0x57')];_0x1b23d5=_0x22d164[_0x61cd('0x56')];var _0x1b75d6=_0x22d164[_0x61cd('0x56')][_0x61cd('0x58')](-0x1);if(_0x1b75d6==='/'){_0x1b23d5=_0x1b23d5[_0x61cd('0x59')](0x0,_0x1b23d5['lastIndexOf'](_0x1b75d6));}return rp({'method':_0x61cd('0x5a'),'uri':util[_0x61cd('0x5b')](_0x61cd('0x5c'),_0x1b23d5,_0x61cd('0x5d')),'headers':{'Authorization':_0x61cd('0x5e')+_0x22d164[_0x61cd('0x5f')]},'json':!![]});}})[_0x61cd('0x23')](function(_0x862cb5){if(_0x862cb5){var _0x220b4e=_0x862cb5[_0x61cd('0x60')];var _0x2a1ed0=![];var _0x272c18=null;for(_0x272c18=0x0;_0x272c18<_0x220b4e[_0x61cd('0x37')];_0x272c18++){if(_0x220b4e[_0x272c18][_0x61cd('0x61')]===_0x48574e){_0x2a1ed0=!![];}}if(_0x2a1ed0){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x61cd('0x23')](respondWithResult(_0x1a18d5,null))[_0x61cd('0x45')](function(_0x14a66f){var _0xfc55ac=_0x5918fe[_0x61cd('0x31')][_0x61cd('0x62')]?0x1f4:_0x14a66f[_0x61cd('0x63')]||0x1f4;logger[_0x61cd('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x61cd('0x55'),_0xfc55ac,JSON[_0x61cd('0x64')](_0x14a66f));delete _0x14a66f[_0x61cd('0x27')];if(_0xfc55ac===0x191){_0xfc55ac=0x190;}_0x1a18d5[_0x61cd('0x19')](_0xfc55ac)['send'](_0x5918fe[_0x61cd('0x31')][_0x61cd('0x62')]?{'message':_0x61cd('0x65'),'statusCode':_0x14a66f[_0x61cd('0x63')]}:_0x14a66f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 0307e30..5520d0e 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 _0xcaf2=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x90e575,_0x48c2ec){var _0x1aae60=function(_0x4e40cf){while(--_0x4e40cf){_0x90e575['push'](_0x90e575['shift']());}};_0x1aae60(++_0x48c2ec);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2b41cd,_0x2b4d13){_0x2b41cd=_0x2b41cd-0x0;var _0x4d021b=_0xcaf2[_0x2b41cd];return _0x4d021b;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var logger=require(_0x2caf('0x1'))(_0x2caf('0x2'));var moment=require('moment');var BPromise=require(_0x2caf('0x3'));var rp=require(_0x2caf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2caf('0x5'));var config=require('../../config/environment');var attributes=require(_0x2caf('0x6'));var integrations=require(_0x2caf('0x7'));module[_0x2caf('0x8')]=function(_0x599ce7,_0xc44e4e){return _0x599ce7[_0x2caf('0x9')](_0x2caf('0xa'),attributes,{'tableName':_0x2caf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32f4=['define','FreshsalesAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2a1f61,_0x8d440e){var _0x396a2e=function(_0x52f6a5){while(--_0x52f6a5){_0x2a1f61['push'](_0x2a1f61['shift']());}};_0x396a2e(++_0x8d440e);}(_0x32f4,0x154));var _0x432f=function(_0x48b0e5,_0x2adebe){_0x48b0e5=_0x48b0e5-0x0;var _0x3649b5=_0x32f4[_0x48b0e5];return _0x3649b5;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));var integrations=require(_0x432f('0x9'));module[_0x432f('0xa')]=function(_0x5d8cc0,_0x5b5f08){return _0x5d8cc0[_0x432f('0xb')](_0x432f('0xc'),attributes,{'tableName':'int_freshsales_accounts','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 bfdaaef..36fcb03 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 _0x6d38=['moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','include','model','debug','catch','ShowFreshsalesAccount','find','map','util'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x6d38,0x1ef));var _0x86d3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6d38[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});}exports[_0x86d3('0x12')]=function(_0x46feec){var _0x120ef3=this;return new Promise(function(_0x33e459,_0x32dee7){return db[_0x86d3('0x13')]['findAll']({'raw':_0x46feec[_0x86d3('0x14')]?_0x46feec['options'][_0x86d3('0x15')]===undefined?!![]:![]:!![],'where':_0x46feec['options']?_0x46feec['options'][_0x86d3('0x16')]||null:null,'attributes':_0x46feec[_0x86d3('0x14')]?_0x46feec[_0x86d3('0x14')][_0x86d3('0x17')]||null:null,'limit':_0x46feec['options']?_0x46feec[_0x86d3('0x14')]['limit']||null:null,'include':_0x46feec[_0x86d3('0x14')]?_0x46feec[_0x86d3('0x14')][_0x86d3('0x18')]?_['map'](_0x46feec[_0x86d3('0x14')][_0x86d3('0x18')],function(_0x1fa4ac){return{'model':db[_0x1fa4ac['model']],'as':_0x1fa4ac['as'],'attributes':_0x1fa4ac['attributes'],'include':_0x1fa4ac[_0x86d3('0x18')]?_['map'](_0x1fa4ac[_0x86d3('0x18')],function(_0x1bea5e){return{'model':db[_0x1bea5e[_0x86d3('0x19')]],'as':_0x1bea5e['as'],'attributes':_0x1bea5e[_0x86d3('0x17')],'include':_0x1bea5e['include']?_['map'](_0x1bea5e[_0x86d3('0x18')],function(_0x611764){return{'model':db[_0x611764['model']],'as':_0x611764['as'],'attributes':_0x611764[_0x86d3('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42413c){logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x46feec);logger[_0x86d3('0x1a')](_0x86d3('0x12'),_0x46feec,JSON[_0x86d3('0xd')](_0x42413c));_0x33e459(_0x42413c);})[_0x86d3('0x1b')](function(_0x35d708){logger[_0x86d3('0xe')](_0x86d3('0x12'),_0x35d708[_0x86d3('0xf')],_0x46feec);_0x32dee7(_0x120ef3[_0x86d3('0xe')](0x1f4,_0x35d708[_0x86d3('0xf')]));});});};exports[_0x86d3('0x1c')]=function(_0x5b09f6){var _0x120a0c=this;return new Promise(function(_0x403be3,_0x2bda35){return db[_0x86d3('0x13')][_0x86d3('0x1d')]({'raw':_0x5b09f6[_0x86d3('0x14')]?_0x5b09f6['options'][_0x86d3('0x15')]===undefined?!![]:![]:!![],'where':_0x5b09f6['options']?_0x5b09f6['options'][_0x86d3('0x16')]||null:null,'attributes':_0x5b09f6[_0x86d3('0x14')]?_0x5b09f6[_0x86d3('0x14')]['attributes']||null:null,'include':_0x5b09f6[_0x86d3('0x14')]?_0x5b09f6[_0x86d3('0x14')]['include']?_[_0x86d3('0x1e')](_0x5b09f6[_0x86d3('0x14')][_0x86d3('0x18')],function(_0x476eb3){return{'model':db[_0x476eb3[_0x86d3('0x19')]],'as':_0x476eb3['as'],'attributes':_0x476eb3[_0x86d3('0x17')],'include':_0x476eb3[_0x86d3('0x18')]?_[_0x86d3('0x1e')](_0x476eb3['include'],function(_0x4cdf45){return{'model':db[_0x4cdf45['model']],'as':_0x4cdf45['as'],'attributes':_0x4cdf45[_0x86d3('0x17')],'include':_0x4cdf45['include']?_[_0x86d3('0x1e')](_0x4cdf45['include'],function(_0x366943){return{'model':db[_0x366943[_0x86d3('0x19')]],'as':_0x366943['as'],'attributes':_0x366943[_0x86d3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x86d3('0xa')](function(_0x1e22c2){logger[_0x86d3('0x10')](_0x86d3('0x1c'),_0x5b09f6);logger['debug'](_0x86d3('0x1c'),_0x5b09f6,JSON[_0x86d3('0xd')](_0x1e22c2));_0x403be3(_0x1e22c2);})['catch'](function(_0x178fc6){logger[_0x86d3('0xe')](_0x86d3('0x1c'),_0x178fc6[_0x86d3('0xf')],_0x5b09f6);_0x2bda35(_0x120a0c['error'](0x1f4,_0x178fc6[_0x86d3('0xf')]));});});}; \ No newline at end of file +var _0x7096=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','map','model','find','ShowFreshsalesAccount','util','bluebird','ioredis','../../mysqldb'];(function(_0x181e2d,_0x4ccf91){var _0x231d54=function(_0x27c41a){while(--_0x27c41a){_0x181e2d['push'](_0x181e2d['shift']());}};_0x231d54(++_0x4ccf91);}(_0x7096,0x10c));var _0x6709=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7096[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});}exports[_0x6709('0x16')]=function(_0x235a54){var _0x4a732e=this;return new Promise(function(_0x9c1fd8,_0x166c97){return db[_0x6709('0x17')]['findAll']({'raw':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x19')]===undefined?!![]:![]:!![],'where':_0x235a54[_0x6709('0x18')]?_0x235a54['options'][_0x6709('0x1a')]||null:null,'attributes':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x1b')]||null:null,'limit':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x1c')]||null:null,'include':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x235a54[_0x6709('0x18')]['include'],function(_0x29f25f){return{'model':db[_0x29f25f[_0x6709('0x1f')]],'as':_0x29f25f['as'],'attributes':_0x29f25f[_0x6709('0x1b')],'include':_0x29f25f['include']?_[_0x6709('0x1e')](_0x29f25f[_0x6709('0x1d')],function(_0x20a347){return{'model':db[_0x20a347[_0x6709('0x1f')]],'as':_0x20a347['as'],'attributes':_0x20a347['attributes'],'include':_0x20a347[_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x20a347['include'],function(_0x585073){return{'model':db[_0x585073[_0x6709('0x1f')]],'as':_0x585073['as'],'attributes':_0x585073['attributes']};}):[]};}):[]};}):[]:[]})[_0x6709('0xb')](function(_0x2499a2){logger['info'](_0x6709('0x16'),_0x235a54);logger['debug'](_0x6709('0x16'),_0x235a54,JSON[_0x6709('0x10')](_0x2499a2));_0x9c1fd8(_0x2499a2);})['catch'](function(_0x137137){logger['error'](_0x6709('0x16'),_0x137137[_0x6709('0x13')],_0x235a54);_0x166c97(_0x4a732e['error'](0x1f4,_0x137137[_0x6709('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x138318){var _0x135f46=this;return new Promise(function(_0x4b93b2,_0x564dcb){return db[_0x6709('0x17')][_0x6709('0x20')]({'raw':_0x138318[_0x6709('0x18')]?_0x138318[_0x6709('0x18')][_0x6709('0x19')]===undefined?!![]:![]:!![],'where':_0x138318[_0x6709('0x18')]?_0x138318[_0x6709('0x18')][_0x6709('0x1a')]||null:null,'attributes':_0x138318[_0x6709('0x18')]?_0x138318['options'][_0x6709('0x1b')]||null:null,'include':_0x138318[_0x6709('0x18')]?_0x138318[_0x6709('0x18')][_0x6709('0x1d')]?_['map'](_0x138318[_0x6709('0x18')][_0x6709('0x1d')],function(_0x124e01){return{'model':db[_0x124e01[_0x6709('0x1f')]],'as':_0x124e01['as'],'attributes':_0x124e01['attributes'],'include':_0x124e01[_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x124e01['include'],function(_0x8952f1){return{'model':db[_0x8952f1[_0x6709('0x1f')]],'as':_0x8952f1['as'],'attributes':_0x8952f1['attributes'],'include':_0x8952f1[_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x8952f1[_0x6709('0x1d')],function(_0xf30c4c){return{'model':db[_0xf30c4c[_0x6709('0x1f')]],'as':_0xf30c4c['as'],'attributes':_0xf30c4c[_0x6709('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6709('0xb')](function(_0x4bfed4){logger[_0x6709('0xc')](_0x6709('0x21'),_0x138318);logger['debug'](_0x6709('0x21'),_0x138318,JSON[_0x6709('0x10')](_0x4bfed4));_0x4b93b2(_0x4bfed4);})[_0x6709('0x15')](function(_0x2bb89c){logger[_0x6709('0x11')](_0x6709('0x21'),_0x2bb89c['message'],_0x138318);_0x564dcb(_0x135f46[_0x6709('0x11')](0x1f4,_0x2bb89c['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8593ca3..639353b 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 _0xd0ba=['../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','/:id','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0ba,0x1aa));var _0xad0b=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0xd0ba[_0x240261];return _0x45c332;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xad0b('0x0'));var timeout=require(_0xad0b('0x1'));var express=require(_0xad0b('0x2'));var router=express[_0xad0b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xad0b('0x4'));var interaction=require(_0xad0b('0x5'));var config=require(_0xad0b('0x6'));var controller=require(_0xad0b('0x7'));router[_0xad0b('0x8')]('/',auth[_0xad0b('0x9')](),controller[_0xad0b('0xa')]);router['get']('/:id',auth[_0xad0b('0x9')](),controller[_0xad0b('0xb')]);router[_0xad0b('0x8')](_0xad0b('0xc'),auth['isAuthenticated'](),controller[_0xad0b('0xd')]);router[_0xad0b('0x8')](_0xad0b('0xe'),auth[_0xad0b('0x9')](),controller[_0xad0b('0xf')]);router['get'](_0xad0b('0x10'),auth[_0xad0b('0x9')](),controller[_0xad0b('0x11')]);router[_0xad0b('0x12')]('/',auth[_0xad0b('0x9')](),controller[_0xad0b('0x13')]);router[_0xad0b('0x14')](_0xad0b('0x15'),auth[_0xad0b('0x9')](),controller['update']);router[_0xad0b('0x16')]('/:id',auth[_0xad0b('0x9')](),controller['destroy']);module[_0xad0b('0x17')]=router; \ No newline at end of file +var _0x23b5=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','getDescriptions','/:id/fields','post','update','delete','destroy','exports','multer'];(function(_0x9f5255,_0x5396a7){var _0x565d79=function(_0x421b03){while(--_0x421b03){_0x9f5255['push'](_0x9f5255['shift']());}};_0x565d79(++_0x5396a7);}(_0x23b5,0x19d));var _0x523b=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0x23b5[_0x1c510a];return _0x23cedd;};'use strict';var multer=require(_0x523b('0x0'));var util=require(_0x523b('0x1'));var path=require(_0x523b('0x2'));var timeout=require(_0x523b('0x3'));var express=require(_0x523b('0x4'));var router=express[_0x523b('0x5')]();var fs_extra=require(_0x523b('0x6'));var auth=require(_0x523b('0x7'));var interaction=require(_0x523b('0x8'));var config=require(_0x523b('0x9'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x523b('0xa')]('/',auth[_0x523b('0xb')](),controller[_0x523b('0xc')]);router[_0x523b('0xa')](_0x523b('0xd'),auth[_0x523b('0xb')](),controller['show']);router[_0x523b('0xa')](_0x523b('0xe'),auth[_0x523b('0xb')](),controller[_0x523b('0xf')]);router[_0x523b('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x523b('0x10')]);router[_0x523b('0xa')](_0x523b('0x11'),auth[_0x523b('0xb')](),controller['getFields']);router[_0x523b('0x12')]('/',auth[_0x523b('0xb')](),controller['create']);router['put'](_0x523b('0xd'),auth['isAuthenticated'](),controller[_0x523b('0x13')]);router[_0x523b('0x14')](_0x523b('0xd'),auth[_0x523b('0xb')](),controller[_0x523b('0x15')]);module[_0x523b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 4ba1508..6c255a7 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 _0xcc50=['STRING','sequelize'];(function(_0x139432,_0x1da7ca){var _0x160e57=function(_0x19a8cf){while(--_0x19a8cf){_0x139432['push'](_0x139432['shift']());}};_0x160e57(++_0x1da7ca);}(_0xcc50,0x14f));var _0x0cc5=function(_0x4a177c,_0x2bd612){_0x4a177c=_0x4a177c-0x0;var _0x54dd37=_0xcc50[_0x4a177c];return _0x54dd37;};'use strict';var Sequelize=require(_0x0cc5('0x0'));module['exports']={'name':{'type':Sequelize[_0x0cc5('0x1')]},'description':{'type':Sequelize[_0x0cc5('0x1')]}}; \ No newline at end of file +var _0x839f=['STRING','exports'];(function(_0x1d05c8,_0x1b5747){var _0x440877=function(_0x21321e){while(--_0x21321e){_0x1d05c8['push'](_0x1d05c8['shift']());}};_0x440877(++_0x1b5747);}(_0x839f,0x1df));var _0xf839=function(_0x2f9807,_0x59adc2){_0x2f9807=_0x2f9807-0x0;var _0xe459e9=_0x839f[_0x2f9807];return _0xe459e9;};'use strict';var Sequelize=require('sequelize');module[_0xf839('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf839('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 2392d1b..df9d461 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 _0xe207=['key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','rows','catch','params','keys','options','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','lodash','squel','jsforce','to-csv','querystring','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','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe207,0x19f));var _0x7e20=function(_0x55934f,_0x39e981){_0x55934f=_0x55934f-0x0;var _0x3d941d=_0xe207[_0x55934f];return _0x3d941d;};'use strict';var emlformat=require(_0x7e20('0x0'));var rimraf=require(_0x7e20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e20('0x2'));var rp=require('request-promise');var moment=require(_0x7e20('0x3'));var BPromise=require(_0x7e20('0x4'));var Mustache=require(_0x7e20('0x5'));var util=require('util');var path=require(_0x7e20('0x6'));var sox=require(_0x7e20('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e20('0x8'));var squel=require(_0x7e20('0x9'));var crypto=require('crypto');var jsforce=require(_0x7e20('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7e20('0xb'));var querystring=require(_0x7e20('0xc'));var Papa=require(_0x7e20('0xd'));var Redis=require(_0x7e20('0xe'));var authService=require(_0x7e20('0xf'));var qs=require(_0x7e20('0x10'));var as=require(_0x7e20('0x11'));var hardwareService=require(_0x7e20('0x12'));var logger=require(_0x7e20('0x13'))('api');var utils=require(_0x7e20('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7e20('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40756b,_0x3f2dad){_0x3f2dad=_0x3f2dad||0xcc;return function(_0x47bb3d){if(_0x47bb3d){return _0x40756b[_0x7e20('0x16')](_0x3f2dad);}return _0x40756b[_0x7e20('0x17')](_0x3f2dad)[_0x7e20('0x18')]();};}function respondWithResult(_0x350612,_0x44035f){_0x44035f=_0x44035f||0xc8;return function(_0x403952){if(_0x403952){return _0x350612[_0x7e20('0x17')](_0x44035f)[_0x7e20('0x19')](_0x403952);}};}function respondWithFilteredResult(_0x4ff406,_0x20b762){return function(_0x577984){if(_0x577984){var _0x3734cc=typeof _0x20b762[_0x7e20('0x1a')]===_0x7e20('0x1b')&&typeof _0x20b762[_0x7e20('0x1c')]===_0x7e20('0x1b');var _0x2d812a=_0x577984[_0x7e20('0x1d')];var _0x31c617=_0x3734cc?0x0:_0x20b762[_0x7e20('0x1a')];var _0x232ed3=_0x3734cc?_0x577984[_0x7e20('0x1d')]:_0x20b762['offset']+_0x20b762[_0x7e20('0x1c')];var _0x1524aa;if(_0x232ed3>=_0x2d812a){_0x232ed3=_0x2d812a;_0x1524aa=0xc8;}else{_0x1524aa=0xce;}_0x4ff406[_0x7e20('0x17')](_0x1524aa);return _0x4ff406[_0x7e20('0x1e')]('Content-Range',_0x31c617+'-'+_0x232ed3+'/'+_0x2d812a)[_0x7e20('0x19')](_0x577984);}return null;};}function patchUpdates(_0x40588a){return function(_0xe61989){try{jsonpatch[_0x7e20('0x1f')](_0xe61989,_0x40588a,!![]);}catch(_0x31bae5){return BPromise[_0x7e20('0x20')](_0x31bae5);}return _0xe61989[_0x7e20('0x21')]();};}function saveUpdates(_0xa689c5,_0x40f26c){return function(_0x82533b){if(_0x82533b){return _0x82533b[_0x7e20('0x22')](_0xa689c5)[_0x7e20('0x23')](function(_0x1362db){return _0x1362db;});}return null;};}function removeEntity(_0x4e2dee,_0x4151a4){return function(_0x12b7d5){if(_0x12b7d5){return _0x12b7d5[_0x7e20('0x24')]()[_0x7e20('0x23')](function(){_0x4e2dee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf28b4,_0x2c06b6){return function(_0xab0df2){if(!_0xab0df2){_0xf28b4[_0x7e20('0x16')](0x194);}return _0xab0df2;};}function handleError(_0x13c15e,_0x30a165){_0x30a165=_0x30a165||0x1f4;return function(_0x21d451){logger[_0x7e20('0x25')](_0x21d451[_0x7e20('0x26')]);if(_0x21d451[_0x7e20('0x27')]){delete _0x21d451[_0x7e20('0x27')];}_0x13c15e['status'](_0x30a165)[_0x7e20('0x28')](_0x21d451);};}exports[_0x7e20('0x29')]=function(_0x50e941,_0x2bfd02){var _0x89323d={},_0xfcaca3={},_0xebf6e5={'count':0x0,'rows':[]};var _0x5e3022=_[_0x7e20('0x2a')](db[_0x7e20('0x2b')][_0x7e20('0x2c')],function(_0x28e247){return{'name':_0x28e247[_0x7e20('0x2d')],'type':_0x28e247[_0x7e20('0x2e')][_0x7e20('0x2f')]};});_0xfcaca3[_0x7e20('0x30')]=_[_0x7e20('0x2a')](_0x5e3022,_0x7e20('0x27'));_0xfcaca3[_0x7e20('0x31')]=_['keys'](_0x50e941[_0x7e20('0x31')]);_0xfcaca3[_0x7e20('0x32')]=_[_0x7e20('0x33')](_0xfcaca3[_0x7e20('0x30')],_0xfcaca3[_0x7e20('0x31')]);_0x89323d[_0x7e20('0x34')]=_[_0x7e20('0x33')](_0xfcaca3[_0x7e20('0x30')],qs[_0x7e20('0x35')](_0x50e941[_0x7e20('0x31')][_0x7e20('0x35')]));_0x89323d[_0x7e20('0x34')]=_0x89323d[_0x7e20('0x34')][_0x7e20('0x36')]?_0x89323d[_0x7e20('0x34')]:_0xfcaca3[_0x7e20('0x30')];if(!_0x50e941[_0x7e20('0x31')]['hasOwnProperty'](_0x7e20('0x37'))){_0x89323d['limit']=qs['limit'](_0x50e941[_0x7e20('0x31')][_0x7e20('0x1c')]);_0x89323d['offset']=qs[_0x7e20('0x1a')](_0x50e941[_0x7e20('0x31')][_0x7e20('0x1a')]);}_0x89323d[_0x7e20('0x38')]=qs[_0x7e20('0x39')](_0x50e941[_0x7e20('0x31')]['sort']);_0x89323d[_0x7e20('0x3a')]=qs[_0x7e20('0x32')](_[_0x7e20('0x3b')](_0x50e941[_0x7e20('0x31')],_0xfcaca3[_0x7e20('0x32')]),_0x5e3022);if(_0x50e941['query'][_0x7e20('0x3c')]){_0x89323d[_0x7e20('0x3a')]=_[_0x7e20('0x3d')](_0x89323d[_0x7e20('0x3a')],{'$or':_['map'](_0x5e3022,function(_0x4f4fa7){if(_0x4f4fa7['type']!=='VIRTUAL'){var _0x3384aa={};_0x3384aa[_0x4f4fa7['name']]={'$like':'%'+_0x50e941[_0x7e20('0x31')]['filter']+'%'};return _0x3384aa;}})});}_0x89323d=_[_0x7e20('0x3d')]({},_0x89323d,_0x50e941['options']);var _0x49be07={'where':_0x89323d[_0x7e20('0x3a')]};return db[_0x7e20('0x2b')][_0x7e20('0x1d')](_0x49be07)[_0x7e20('0x23')](function(_0xc05402){_0xebf6e5[_0x7e20('0x1d')]=_0xc05402;if(_0x50e941[_0x7e20('0x31')][_0x7e20('0x3e')]){_0x89323d['include']=[{'all':!![]}];}return db[_0x7e20('0x2b')]['findAll'](_0x89323d);})[_0x7e20('0x23')](function(_0x48aaca){_0xebf6e5[_0x7e20('0x3f')]=_0x48aaca;return _0xebf6e5;})[_0x7e20('0x23')](respondWithFilteredResult(_0x2bfd02,_0x89323d))[_0x7e20('0x40')](handleError(_0x2bfd02,null));};exports['show']=function(_0x2dfd20,_0x25fa22){var _0x3a75bf={'raw':![],'where':{'id':_0x2dfd20[_0x7e20('0x41')]['id']}},_0x1370a5={};_0x1370a5['model']=_['keys'](db[_0x7e20('0x2b')][_0x7e20('0x2c')]);_0x1370a5['query']=_[_0x7e20('0x42')](_0x2dfd20[_0x7e20('0x31')]);_0x1370a5[_0x7e20('0x32')]=_['intersection'](_0x1370a5[_0x7e20('0x30')],_0x1370a5[_0x7e20('0x31')]);_0x3a75bf['attributes']=_['intersection'](_0x1370a5[_0x7e20('0x30')],qs[_0x7e20('0x35')](_0x2dfd20[_0x7e20('0x31')][_0x7e20('0x35')]));_0x3a75bf[_0x7e20('0x34')]=_0x3a75bf['attributes'][_0x7e20('0x36')]?_0x3a75bf[_0x7e20('0x34')]:_0x1370a5['model'];if(_0x2dfd20[_0x7e20('0x31')][_0x7e20('0x3e')]){_0x3a75bf['include']=[{'all':!![]}];}_0x3a75bf=_[_0x7e20('0x3d')]({},_0x3a75bf,_0x2dfd20[_0x7e20('0x43')]);return db[_0x7e20('0x2b')][_0x7e20('0x44')](_0x3a75bf)[_0x7e20('0x23')](handleEntityNotFound(_0x25fa22,null))[_0x7e20('0x23')](respondWithResult(_0x25fa22,null))[_0x7e20('0x40')](handleError(_0x25fa22,null));};exports['create']=function(_0x3330f4,_0x5a056c){return db[_0x7e20('0x2b')][_0x7e20('0x45')](_0x3330f4[_0x7e20('0x46')],{})['then'](respondWithResult(_0x5a056c,0xc9))[_0x7e20('0x40')](handleError(_0x5a056c,null));};exports[_0x7e20('0x22')]=function(_0x411efe,_0x1a2da3){if(_0x411efe[_0x7e20('0x46')]['id']){delete _0x411efe[_0x7e20('0x46')]['id'];}return db[_0x7e20('0x2b')][_0x7e20('0x44')]({'where':{'id':_0x411efe[_0x7e20('0x41')]['id']}})[_0x7e20('0x23')](handleEntityNotFound(_0x1a2da3,null))[_0x7e20('0x23')](saveUpdates(_0x411efe[_0x7e20('0x46')],null))['then'](respondWithResult(_0x1a2da3,null))[_0x7e20('0x40')](handleError(_0x1a2da3,null));};exports[_0x7e20('0x24')]=function(_0x54ea3f,_0x8e1070){return db[_0x7e20('0x2b')][_0x7e20('0x44')]({'where':{'id':_0x54ea3f[_0x7e20('0x41')]['id']}})[_0x7e20('0x23')](handleEntityNotFound(_0x8e1070,null))['then'](removeEntity(_0x8e1070,null))[_0x7e20('0x40')](handleError(_0x8e1070,null));};exports[_0x7e20('0x47')]=function(_0x3739db,_0x3f96ed,_0x128950){var _0x46c61c={};var _0x1b686e={};var _0x1efb2f;var _0x287dac;return db[_0x7e20('0x2b')][_0x7e20('0x48')]({'where':{'id':_0x3739db[_0x7e20('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f96ed,null))[_0x7e20('0x23')](function(_0x53102a){if(_0x53102a){_0x1efb2f=_0x53102a;_0x1b686e[_0x7e20('0x30')]=_[_0x7e20('0x42')](db[_0x7e20('0x49')][_0x7e20('0x2c')]);_0x1b686e[_0x7e20('0x31')]=_[_0x7e20('0x42')](_0x3739db[_0x7e20('0x31')]);_0x1b686e[_0x7e20('0x32')]=_['intersection'](_0x1b686e[_0x7e20('0x30')],_0x1b686e[_0x7e20('0x31')]);_0x46c61c[_0x7e20('0x34')]=_[_0x7e20('0x33')](_0x1b686e['model'],qs[_0x7e20('0x35')](_0x3739db[_0x7e20('0x31')][_0x7e20('0x35')]));_0x46c61c['attributes']=_0x46c61c[_0x7e20('0x34')]['length']?_0x46c61c[_0x7e20('0x34')]:_0x1b686e[_0x7e20('0x30')];_0x46c61c[_0x7e20('0x38')]=qs[_0x7e20('0x39')](_0x3739db[_0x7e20('0x31')][_0x7e20('0x39')]);_0x46c61c[_0x7e20('0x3a')]=qs['filters'](_[_0x7e20('0x3b')](_0x3739db['query'],_0x1b686e[_0x7e20('0x32')]));if(_0x3739db[_0x7e20('0x31')][_0x7e20('0x3c')]){_0x46c61c[_0x7e20('0x3a')]=_[_0x7e20('0x3d')](_0x46c61c[_0x7e20('0x3a')],{'$or':_[_0x7e20('0x2a')](_0x46c61c['attributes'],function(_0x5c4d95){var _0x54495c={};_0x54495c[_0x5c4d95]={'$like':'%'+_0x3739db[_0x7e20('0x31')]['filter']+'%'};return _0x54495c;})});}_0x46c61c=_[_0x7e20('0x3d')]({},_0x46c61c,_0x3739db[_0x7e20('0x43')]);return _0x1efb2f['getSubjects'](_0x46c61c);}})[_0x7e20('0x23')](function(_0x1d4829){if(_0x1d4829){_0x287dac=_0x1d4829[_0x7e20('0x36')];if(!_0x3739db[_0x7e20('0x31')][_0x7e20('0x4a')](_0x7e20('0x37'))){_0x46c61c[_0x7e20('0x1c')]=qs['limit'](_0x3739db[_0x7e20('0x31')][_0x7e20('0x1c')]);_0x46c61c[_0x7e20('0x1a')]=qs['offset'](_0x3739db[_0x7e20('0x31')]['offset']);}return _0x1efb2f[_0x7e20('0x47')](_0x46c61c);}})[_0x7e20('0x23')](function(_0x5e07ad){if(_0x5e07ad){return _0x5e07ad?{'count':_0x287dac,'rows':_0x5e07ad}:null;}})[_0x7e20('0x23')](respondWithResult(_0x3f96ed,null))[_0x7e20('0x40')](handleError(_0x3f96ed,null));};exports[_0x7e20('0x4b')]=function(_0x2f27f6,_0x24ed75,_0x26522a){var _0x40cd9f={};var _0x2beae7={};var _0x1729ec;var _0x527a71;return db['FreshsalesConfiguration'][_0x7e20('0x48')]({'where':{'id':_0x2f27f6[_0x7e20('0x41')]['id']}})[_0x7e20('0x23')](handleEntityNotFound(_0x24ed75,null))[_0x7e20('0x23')](function(_0x297ce7){if(_0x297ce7){_0x1729ec=_0x297ce7;_0x2beae7[_0x7e20('0x30')]=_[_0x7e20('0x42')](db['FreshsalesField'][_0x7e20('0x2c')]);_0x2beae7[_0x7e20('0x31')]=_[_0x7e20('0x42')](_0x2f27f6[_0x7e20('0x31')]);_0x2beae7[_0x7e20('0x32')]=_[_0x7e20('0x33')](_0x2beae7['model'],_0x2beae7[_0x7e20('0x31')]);_0x40cd9f[_0x7e20('0x34')]=_[_0x7e20('0x33')](_0x2beae7[_0x7e20('0x30')],qs['fields'](_0x2f27f6[_0x7e20('0x31')]['fields']));_0x40cd9f[_0x7e20('0x34')]=_0x40cd9f[_0x7e20('0x34')][_0x7e20('0x36')]?_0x40cd9f[_0x7e20('0x34')]:_0x2beae7[_0x7e20('0x30')];_0x40cd9f[_0x7e20('0x38')]=qs[_0x7e20('0x39')](_0x2f27f6[_0x7e20('0x31')][_0x7e20('0x39')]);_0x40cd9f[_0x7e20('0x3a')]=qs[_0x7e20('0x32')](_[_0x7e20('0x3b')](_0x2f27f6['query'],_0x2beae7['filters']));if(_0x2f27f6[_0x7e20('0x31')][_0x7e20('0x3c')]){_0x40cd9f[_0x7e20('0x3a')]=_['merge'](_0x40cd9f['where'],{'$or':_[_0x7e20('0x2a')](_0x40cd9f[_0x7e20('0x34')],function(_0x11b06a){var _0x31714c={};_0x31714c[_0x11b06a]={'$like':'%'+_0x2f27f6[_0x7e20('0x31')][_0x7e20('0x3c')]+'%'};return _0x31714c;})});}_0x40cd9f=_[_0x7e20('0x3d')]({},_0x40cd9f,_0x2f27f6[_0x7e20('0x43')]);return _0x1729ec[_0x7e20('0x4b')](_0x40cd9f);}})[_0x7e20('0x23')](function(_0x147b51){if(_0x147b51){_0x527a71=_0x147b51[_0x7e20('0x36')];if(!_0x2f27f6[_0x7e20('0x31')][_0x7e20('0x4a')]('nolimit')){_0x40cd9f[_0x7e20('0x1c')]=qs['limit'](_0x2f27f6[_0x7e20('0x31')][_0x7e20('0x1c')]);_0x40cd9f['offset']=qs['offset'](_0x2f27f6[_0x7e20('0x31')]['offset']);}return _0x1729ec['getDescriptions'](_0x40cd9f);}})[_0x7e20('0x23')](function(_0x368eaa){if(_0x368eaa){return _0x368eaa?{'count':_0x527a71,'rows':_0x368eaa}:null;}})[_0x7e20('0x23')](respondWithResult(_0x24ed75,null))[_0x7e20('0x40')](handleError(_0x24ed75,null));};exports[_0x7e20('0x4c')]=function(_0xd7bc4,_0x416670,_0x4a9e93){var _0x398562={};var _0x205b46={};var _0x2696aa;var _0x57bcf3;return db[_0x7e20('0x2b')][_0x7e20('0x48')]({'where':{'id':_0xd7bc4[_0x7e20('0x41')]['id']}})['then'](handleEntityNotFound(_0x416670,null))[_0x7e20('0x23')](function(_0x158236){if(_0x158236){_0x2696aa=_0x158236;_0x205b46['model']=_[_0x7e20('0x42')](db[_0x7e20('0x49')][_0x7e20('0x2c')]);_0x205b46[_0x7e20('0x31')]=_[_0x7e20('0x42')](_0xd7bc4['query']);_0x205b46[_0x7e20('0x32')]=_[_0x7e20('0x33')](_0x205b46[_0x7e20('0x30')],_0x205b46[_0x7e20('0x31')]);_0x398562['attributes']=_['intersection'](_0x205b46[_0x7e20('0x30')],qs[_0x7e20('0x35')](_0xd7bc4['query'][_0x7e20('0x35')]));_0x398562[_0x7e20('0x34')]=_0x398562[_0x7e20('0x34')][_0x7e20('0x36')]?_0x398562[_0x7e20('0x34')]:_0x205b46[_0x7e20('0x30')];_0x398562[_0x7e20('0x38')]=qs[_0x7e20('0x39')](_0xd7bc4[_0x7e20('0x31')][_0x7e20('0x39')]);_0x398562[_0x7e20('0x3a')]=qs[_0x7e20('0x32')](_[_0x7e20('0x3b')](_0xd7bc4[_0x7e20('0x31')],_0x205b46[_0x7e20('0x32')]));if(_0xd7bc4[_0x7e20('0x31')]['filter']){_0x398562[_0x7e20('0x3a')]=_[_0x7e20('0x3d')](_0x398562['where'],{'$or':_[_0x7e20('0x2a')](_0x398562[_0x7e20('0x34')],function(_0x5afc1c){var _0x50b91c={};_0x50b91c[_0x5afc1c]={'$like':'%'+_0xd7bc4[_0x7e20('0x31')][_0x7e20('0x3c')]+'%'};return _0x50b91c;})});}_0x398562=_[_0x7e20('0x3d')]({},_0x398562,_0xd7bc4[_0x7e20('0x43')]);return _0x2696aa[_0x7e20('0x4c')](_0x398562);}})[_0x7e20('0x23')](function(_0x20d764){if(_0x20d764){_0x57bcf3=_0x20d764['length'];if(!_0xd7bc4['query'][_0x7e20('0x4a')](_0x7e20('0x37'))){_0x398562[_0x7e20('0x1c')]=qs[_0x7e20('0x1c')](_0xd7bc4[_0x7e20('0x31')][_0x7e20('0x1c')]);_0x398562[_0x7e20('0x1a')]=qs[_0x7e20('0x1a')](_0xd7bc4['query']['offset']);}return _0x2696aa[_0x7e20('0x4c')](_0x398562);}})[_0x7e20('0x23')](function(_0x336407){if(_0x336407){return _0x336407?{'count':_0x57bcf3,'rows':_0x336407}:null;}})[_0x7e20('0x23')](respondWithResult(_0x416670,null))['catch'](handleError(_0x416670,null));}; \ No newline at end of file +var _0xf5af=['attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','findOne','keys','FreshsalesField','where','getSubjects','getDescriptions','getFields','eml-format','rimraf','zip-dir','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','apply','save','update','then','destroy','error','name','send','index','FreshsalesConfiguration','fieldName','type','key','model','map','query','filters','intersection','fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf5af,0x6c));var _0xff5a=function(_0x24eb68,_0x58abbd){_0x24eb68=_0x24eb68-0x0;var _0x537583=_0xf5af[_0x24eb68];return _0x537583;};'use strict';var emlformat=require(_0xff5a('0x0'));var rimraf=require(_0xff5a('0x1'));var zipdir=require(_0xff5a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xff5a('0x3'));var util=require('util');var path=require(_0xff5a('0x4'));var sox=require('sox');var csv=require(_0xff5a('0x5'));var ejs=require(_0xff5a('0x6'));var fs=require('fs');var fs_extra=require(_0xff5a('0x7'));var _=require(_0xff5a('0x8'));var squel=require(_0xff5a('0x9'));var crypto=require('crypto');var jsforce=require(_0xff5a('0xa'));var deskjs=require(_0xff5a('0xb'));var toCsv=require(_0xff5a('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xff5a('0xc'));var authService=require(_0xff5a('0xd'));var qs=require(_0xff5a('0xe'));var as=require(_0xff5a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff5a('0x10'))('api');var utils=require(_0xff5a('0x11'));var config=require(_0xff5a('0x12'));var licenseUtil=require(_0xff5a('0x13'));var db=require(_0xff5a('0x14'))['db'];function respondWithStatusCode(_0x11b738,_0x591c62){_0x591c62=_0x591c62||0xcc;return function(_0x352e2e){if(_0x352e2e){return _0x11b738[_0xff5a('0x15')](_0x591c62);}return _0x11b738['status'](_0x591c62)[_0xff5a('0x16')]();};}function respondWithResult(_0x1d287f,_0x32d64a){_0x32d64a=_0x32d64a||0xc8;return function(_0x3b6e6e){if(_0x3b6e6e){return _0x1d287f[_0xff5a('0x17')](_0x32d64a)[_0xff5a('0x18')](_0x3b6e6e);}};}function respondWithFilteredResult(_0x29c117,_0x56fd5c){return function(_0xe5b9bc){if(_0xe5b9bc){var _0x53a86d=typeof _0x56fd5c[_0xff5a('0x19')]===_0xff5a('0x1a')&&typeof _0x56fd5c[_0xff5a('0x1b')]===_0xff5a('0x1a');var _0x4cdccb=_0xe5b9bc['count'];var _0x590fb5=_0x53a86d?0x0:_0x56fd5c['offset'];var _0x2a3fa8=_0x53a86d?_0xe5b9bc['count']:_0x56fd5c[_0xff5a('0x19')]+_0x56fd5c[_0xff5a('0x1b')];var _0x43871e;if(_0x2a3fa8>=_0x4cdccb){_0x2a3fa8=_0x4cdccb;_0x43871e=0xc8;}else{_0x43871e=0xce;}_0x29c117[_0xff5a('0x17')](_0x43871e);return _0x29c117[_0xff5a('0x1c')]('Content-Range',_0x590fb5+'-'+_0x2a3fa8+'/'+_0x4cdccb)[_0xff5a('0x18')](_0xe5b9bc);}return null;};}function patchUpdates(_0x263299){return function(_0x52ed0e){try{jsonpatch[_0xff5a('0x1d')](_0x52ed0e,_0x263299,!![]);}catch(_0x4898f5){return BPromise['reject'](_0x4898f5);}return _0x52ed0e[_0xff5a('0x1e')]();};}function saveUpdates(_0x55101,_0x101e4e){return function(_0x4ebcb0){if(_0x4ebcb0){return _0x4ebcb0[_0xff5a('0x1f')](_0x55101)[_0xff5a('0x20')](function(_0x3a7481){return _0x3a7481;});}return null;};}function removeEntity(_0x1253da,_0x535220){return function(_0x6ef519){if(_0x6ef519){return _0x6ef519[_0xff5a('0x21')]()[_0xff5a('0x20')](function(){_0x1253da[_0xff5a('0x17')](0xcc)[_0xff5a('0x16')]();});}};}function handleEntityNotFound(_0x5a2155,_0x5a1a9f){return function(_0x431562){if(!_0x431562){_0x5a2155['sendStatus'](0x194);}return _0x431562;};}function handleError(_0x4a6ce2,_0x2b3b6e){_0x2b3b6e=_0x2b3b6e||0x1f4;return function(_0x52f674){logger[_0xff5a('0x22')](_0x52f674['stack']);if(_0x52f674[_0xff5a('0x23')]){delete _0x52f674[_0xff5a('0x23')];}_0x4a6ce2['status'](_0x2b3b6e)[_0xff5a('0x24')](_0x52f674);};}exports[_0xff5a('0x25')]=function(_0x9e3a7e,_0x52166b){var _0x241be8={},_0x2c7869={},_0x1b12d7={'count':0x0,'rows':[]};var _0x532337=_['map'](db[_0xff5a('0x26')]['rawAttributes'],function(_0x25561f){return{'name':_0x25561f[_0xff5a('0x27')],'type':_0x25561f[_0xff5a('0x28')][_0xff5a('0x29')]};});_0x2c7869[_0xff5a('0x2a')]=_[_0xff5a('0x2b')](_0x532337,_0xff5a('0x23'));_0x2c7869[_0xff5a('0x2c')]=_['keys'](_0x9e3a7e[_0xff5a('0x2c')]);_0x2c7869[_0xff5a('0x2d')]=_[_0xff5a('0x2e')](_0x2c7869['model'],_0x2c7869[_0xff5a('0x2c')]);_0x241be8['attributes']=_['intersection'](_0x2c7869[_0xff5a('0x2a')],qs[_0xff5a('0x2f')](_0x9e3a7e['query']['fields']));_0x241be8[_0xff5a('0x30')]=_0x241be8['attributes']['length']?_0x241be8['attributes']:_0x2c7869[_0xff5a('0x2a')];if(!_0x9e3a7e['query'][_0xff5a('0x31')](_0xff5a('0x32'))){_0x241be8[_0xff5a('0x1b')]=qs[_0xff5a('0x1b')](_0x9e3a7e[_0xff5a('0x2c')]['limit']);_0x241be8[_0xff5a('0x19')]=qs[_0xff5a('0x19')](_0x9e3a7e[_0xff5a('0x2c')][_0xff5a('0x19')]);}_0x241be8[_0xff5a('0x33')]=qs[_0xff5a('0x34')](_0x9e3a7e['query'][_0xff5a('0x34')]);_0x241be8['where']=qs['filters'](_[_0xff5a('0x35')](_0x9e3a7e['query'],_0x2c7869[_0xff5a('0x2d')]),_0x532337);if(_0x9e3a7e[_0xff5a('0x2c')][_0xff5a('0x36')]){_0x241be8['where']=_[_0xff5a('0x37')](_0x241be8['where'],{'$or':_[_0xff5a('0x2b')](_0x532337,function(_0x9d5d90){if(_0x9d5d90['type']!==_0xff5a('0x38')){var _0x20a51e={};_0x20a51e[_0x9d5d90[_0xff5a('0x23')]]={'$like':'%'+_0x9e3a7e[_0xff5a('0x2c')][_0xff5a('0x36')]+'%'};return _0x20a51e;}})});}_0x241be8=_[_0xff5a('0x37')]({},_0x241be8,_0x9e3a7e[_0xff5a('0x39')]);var _0xd7616f={'where':_0x241be8['where']};return db[_0xff5a('0x26')]['count'](_0xd7616f)[_0xff5a('0x20')](function(_0x22b7c1){_0x1b12d7[_0xff5a('0x3a')]=_0x22b7c1;if(_0x9e3a7e['query'][_0xff5a('0x3b')]){_0x241be8['include']=[{'all':!![]}];}return db[_0xff5a('0x26')][_0xff5a('0x3c')](_0x241be8);})['then'](function(_0x34cdcb){_0x1b12d7[_0xff5a('0x3d')]=_0x34cdcb;return _0x1b12d7;})[_0xff5a('0x20')](respondWithFilteredResult(_0x52166b,_0x241be8))[_0xff5a('0x3e')](handleError(_0x52166b,null));};exports[_0xff5a('0x3f')]=function(_0x5792bd,_0x136894){var _0x50c05b={'raw':![],'where':{'id':_0x5792bd[_0xff5a('0x40')]['id']}},_0x45f439={};_0x45f439['model']=_['keys'](db[_0xff5a('0x26')][_0xff5a('0x41')]);_0x45f439[_0xff5a('0x2c')]=_['keys'](_0x5792bd[_0xff5a('0x2c')]);_0x45f439[_0xff5a('0x2d')]=_[_0xff5a('0x2e')](_0x45f439[_0xff5a('0x2a')],_0x45f439[_0xff5a('0x2c')]);_0x50c05b[_0xff5a('0x30')]=_['intersection'](_0x45f439[_0xff5a('0x2a')],qs[_0xff5a('0x2f')](_0x5792bd[_0xff5a('0x2c')][_0xff5a('0x2f')]));_0x50c05b[_0xff5a('0x30')]=_0x50c05b[_0xff5a('0x30')][_0xff5a('0x42')]?_0x50c05b[_0xff5a('0x30')]:_0x45f439[_0xff5a('0x2a')];if(_0x5792bd[_0xff5a('0x2c')]['includeAll']){_0x50c05b[_0xff5a('0x43')]=[{'all':!![]}];}_0x50c05b=_[_0xff5a('0x37')]({},_0x50c05b,_0x5792bd[_0xff5a('0x39')]);return db[_0xff5a('0x26')][_0xff5a('0x44')](_0x50c05b)['then'](handleEntityNotFound(_0x136894,null))[_0xff5a('0x20')](respondWithResult(_0x136894,null))[_0xff5a('0x3e')](handleError(_0x136894,null));};exports[_0xff5a('0x45')]=function(_0x27a8db,_0x2e38f7){return db[_0xff5a('0x26')][_0xff5a('0x45')](_0x27a8db[_0xff5a('0x46')],{})['then'](respondWithResult(_0x2e38f7,0xc9))['catch'](handleError(_0x2e38f7,null));};exports[_0xff5a('0x1f')]=function(_0x181b94,_0x23b330){if(_0x181b94[_0xff5a('0x46')]['id']){delete _0x181b94[_0xff5a('0x46')]['id'];}return db[_0xff5a('0x26')][_0xff5a('0x44')]({'where':{'id':_0x181b94['params']['id']}})['then'](handleEntityNotFound(_0x23b330,null))['then'](saveUpdates(_0x181b94[_0xff5a('0x46')],null))[_0xff5a('0x20')](respondWithResult(_0x23b330,null))['catch'](handleError(_0x23b330,null));};exports[_0xff5a('0x21')]=function(_0xf83dbe,_0x3e2553){return db[_0xff5a('0x26')][_0xff5a('0x44')]({'where':{'id':_0xf83dbe[_0xff5a('0x40')]['id']}})[_0xff5a('0x20')](handleEntityNotFound(_0x3e2553,null))['then'](removeEntity(_0x3e2553,null))[_0xff5a('0x3e')](handleError(_0x3e2553,null));};exports['getSubjects']=function(_0xe88a15,_0x4ef03c,_0x2c6bff){var _0x6cce4e={};var _0x3f7f8b={};var _0x139628;var _0x494866;return db[_0xff5a('0x26')][_0xff5a('0x47')]({'where':{'id':_0xe88a15[_0xff5a('0x40')]['id']}})[_0xff5a('0x20')](handleEntityNotFound(_0x4ef03c,null))['then'](function(_0x5dc678){if(_0x5dc678){_0x139628=_0x5dc678;_0x3f7f8b[_0xff5a('0x2a')]=_[_0xff5a('0x48')](db[_0xff5a('0x49')][_0xff5a('0x41')]);_0x3f7f8b[_0xff5a('0x2c')]=_[_0xff5a('0x48')](_0xe88a15[_0xff5a('0x2c')]);_0x3f7f8b[_0xff5a('0x2d')]=_['intersection'](_0x3f7f8b[_0xff5a('0x2a')],_0x3f7f8b[_0xff5a('0x2c')]);_0x6cce4e[_0xff5a('0x30')]=_[_0xff5a('0x2e')](_0x3f7f8b[_0xff5a('0x2a')],qs[_0xff5a('0x2f')](_0xe88a15[_0xff5a('0x2c')][_0xff5a('0x2f')]));_0x6cce4e[_0xff5a('0x30')]=_0x6cce4e[_0xff5a('0x30')][_0xff5a('0x42')]?_0x6cce4e[_0xff5a('0x30')]:_0x3f7f8b[_0xff5a('0x2a')];_0x6cce4e['order']=qs[_0xff5a('0x34')](_0xe88a15['query'][_0xff5a('0x34')]);_0x6cce4e[_0xff5a('0x4a')]=qs[_0xff5a('0x2d')](_['pick'](_0xe88a15['query'],_0x3f7f8b[_0xff5a('0x2d')]));if(_0xe88a15['query'][_0xff5a('0x36')]){_0x6cce4e[_0xff5a('0x4a')]=_['merge'](_0x6cce4e[_0xff5a('0x4a')],{'$or':_[_0xff5a('0x2b')](_0x6cce4e[_0xff5a('0x30')],function(_0x6172c0){var _0xb31536={};_0xb31536[_0x6172c0]={'$like':'%'+_0xe88a15[_0xff5a('0x2c')][_0xff5a('0x36')]+'%'};return _0xb31536;})});}_0x6cce4e=_[_0xff5a('0x37')]({},_0x6cce4e,_0xe88a15['options']);return _0x139628[_0xff5a('0x4b')](_0x6cce4e);}})[_0xff5a('0x20')](function(_0x401539){if(_0x401539){_0x494866=_0x401539[_0xff5a('0x42')];if(!_0xe88a15[_0xff5a('0x2c')][_0xff5a('0x31')](_0xff5a('0x32'))){_0x6cce4e[_0xff5a('0x1b')]=qs[_0xff5a('0x1b')](_0xe88a15[_0xff5a('0x2c')][_0xff5a('0x1b')]);_0x6cce4e[_0xff5a('0x19')]=qs[_0xff5a('0x19')](_0xe88a15[_0xff5a('0x2c')][_0xff5a('0x19')]);}return _0x139628['getSubjects'](_0x6cce4e);}})['then'](function(_0x159c7d){if(_0x159c7d){return _0x159c7d?{'count':_0x494866,'rows':_0x159c7d}:null;}})[_0xff5a('0x20')](respondWithResult(_0x4ef03c,null))[_0xff5a('0x3e')](handleError(_0x4ef03c,null));};exports['getDescriptions']=function(_0x1878af,_0x479dc6,_0x6325ed){var _0x4e7cef={};var _0x27318f={};var _0x1c34fe;var _0x3b0c0f;return db['FreshsalesConfiguration'][_0xff5a('0x47')]({'where':{'id':_0x1878af[_0xff5a('0x40')]['id']}})[_0xff5a('0x20')](handleEntityNotFound(_0x479dc6,null))['then'](function(_0x1d6fa6){if(_0x1d6fa6){_0x1c34fe=_0x1d6fa6;_0x27318f[_0xff5a('0x2a')]=_[_0xff5a('0x48')](db[_0xff5a('0x49')][_0xff5a('0x41')]);_0x27318f[_0xff5a('0x2c')]=_['keys'](_0x1878af['query']);_0x27318f[_0xff5a('0x2d')]=_['intersection'](_0x27318f[_0xff5a('0x2a')],_0x27318f[_0xff5a('0x2c')]);_0x4e7cef[_0xff5a('0x30')]=_[_0xff5a('0x2e')](_0x27318f[_0xff5a('0x2a')],qs[_0xff5a('0x2f')](_0x1878af['query']['fields']));_0x4e7cef[_0xff5a('0x30')]=_0x4e7cef[_0xff5a('0x30')][_0xff5a('0x42')]?_0x4e7cef['attributes']:_0x27318f[_0xff5a('0x2a')];_0x4e7cef[_0xff5a('0x33')]=qs[_0xff5a('0x34')](_0x1878af[_0xff5a('0x2c')][_0xff5a('0x34')]);_0x4e7cef[_0xff5a('0x4a')]=qs['filters'](_['pick'](_0x1878af[_0xff5a('0x2c')],_0x27318f[_0xff5a('0x2d')]));if(_0x1878af[_0xff5a('0x2c')][_0xff5a('0x36')]){_0x4e7cef[_0xff5a('0x4a')]=_[_0xff5a('0x37')](_0x4e7cef['where'],{'$or':_[_0xff5a('0x2b')](_0x4e7cef[_0xff5a('0x30')],function(_0x189f69){var _0x49b02f={};_0x49b02f[_0x189f69]={'$like':'%'+_0x1878af[_0xff5a('0x2c')][_0xff5a('0x36')]+'%'};return _0x49b02f;})});}_0x4e7cef=_[_0xff5a('0x37')]({},_0x4e7cef,_0x1878af[_0xff5a('0x39')]);return _0x1c34fe[_0xff5a('0x4c')](_0x4e7cef);}})[_0xff5a('0x20')](function(_0xcd2996){if(_0xcd2996){_0x3b0c0f=_0xcd2996[_0xff5a('0x42')];if(!_0x1878af[_0xff5a('0x2c')]['hasOwnProperty'](_0xff5a('0x32'))){_0x4e7cef[_0xff5a('0x1b')]=qs[_0xff5a('0x1b')](_0x1878af[_0xff5a('0x2c')]['limit']);_0x4e7cef['offset']=qs[_0xff5a('0x19')](_0x1878af[_0xff5a('0x2c')][_0xff5a('0x19')]);}return _0x1c34fe['getDescriptions'](_0x4e7cef);}})[_0xff5a('0x20')](function(_0x4aab21){if(_0x4aab21){return _0x4aab21?{'count':_0x3b0c0f,'rows':_0x4aab21}:null;}})['then'](respondWithResult(_0x479dc6,null))[_0xff5a('0x3e')](handleError(_0x479dc6,null));};exports[_0xff5a('0x4d')]=function(_0x28ec35,_0x2c36ff,_0x30d39c){var _0xec2eaf={};var _0x39f501={};var _0x37e1f2;var _0x27d8ae;return db[_0xff5a('0x26')][_0xff5a('0x47')]({'where':{'id':_0x28ec35['params']['id']}})[_0xff5a('0x20')](handleEntityNotFound(_0x2c36ff,null))[_0xff5a('0x20')](function(_0x595dff){if(_0x595dff){_0x37e1f2=_0x595dff;_0x39f501[_0xff5a('0x2a')]=_['keys'](db[_0xff5a('0x49')][_0xff5a('0x41')]);_0x39f501[_0xff5a('0x2c')]=_[_0xff5a('0x48')](_0x28ec35[_0xff5a('0x2c')]);_0x39f501[_0xff5a('0x2d')]=_[_0xff5a('0x2e')](_0x39f501['model'],_0x39f501[_0xff5a('0x2c')]);_0xec2eaf[_0xff5a('0x30')]=_[_0xff5a('0x2e')](_0x39f501[_0xff5a('0x2a')],qs[_0xff5a('0x2f')](_0x28ec35[_0xff5a('0x2c')][_0xff5a('0x2f')]));_0xec2eaf['attributes']=_0xec2eaf[_0xff5a('0x30')][_0xff5a('0x42')]?_0xec2eaf[_0xff5a('0x30')]:_0x39f501[_0xff5a('0x2a')];_0xec2eaf[_0xff5a('0x33')]=qs[_0xff5a('0x34')](_0x28ec35[_0xff5a('0x2c')][_0xff5a('0x34')]);_0xec2eaf[_0xff5a('0x4a')]=qs[_0xff5a('0x2d')](_[_0xff5a('0x35')](_0x28ec35['query'],_0x39f501[_0xff5a('0x2d')]));if(_0x28ec35[_0xff5a('0x2c')]['filter']){_0xec2eaf['where']=_[_0xff5a('0x37')](_0xec2eaf[_0xff5a('0x4a')],{'$or':_[_0xff5a('0x2b')](_0xec2eaf['attributes'],function(_0x3f12ee){var _0x47d41f={};_0x47d41f[_0x3f12ee]={'$like':'%'+_0x28ec35['query']['filter']+'%'};return _0x47d41f;})});}_0xec2eaf=_[_0xff5a('0x37')]({},_0xec2eaf,_0x28ec35[_0xff5a('0x39')]);return _0x37e1f2[_0xff5a('0x4d')](_0xec2eaf);}})[_0xff5a('0x20')](function(_0x53a914){if(_0x53a914){_0x27d8ae=_0x53a914['length'];if(!_0x28ec35[_0xff5a('0x2c')][_0xff5a('0x31')](_0xff5a('0x32'))){_0xec2eaf[_0xff5a('0x1b')]=qs['limit'](_0x28ec35['query'][_0xff5a('0x1b')]);_0xec2eaf[_0xff5a('0x19')]=qs['offset'](_0x28ec35[_0xff5a('0x2c')][_0xff5a('0x19')]);}return _0x37e1f2[_0xff5a('0x4d')](_0xec2eaf);}})[_0xff5a('0x20')](function(_0x11015d){if(_0x11015d){return _0x11015d?{'count':_0x27d8ae,'rows':_0x11015d}:null;}})['then'](respondWithResult(_0x2c36ff,null))[_0xff5a('0x3e')](handleError(_0x2c36ff,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index a392d1d..7ba5f06 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 _0x327a=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x3d7de8,_0x2a2ec4){var _0x5e9a0c=function(_0x5b0499){while(--_0x5b0499){_0x3d7de8['push'](_0x3d7de8['shift']());}};_0x5e9a0c(++_0x2a2ec4);}(_0x327a,0x198));var _0xa327=function(_0x26c5e2,_0x21c1cd){_0x26c5e2=_0x26c5e2-0x0;var _0x2ae2ac=_0x327a[_0x26c5e2];return _0x2ae2ac;};'use strict';var _=require(_0xa327('0x0'));var util=require(_0xa327('0x1'));var logger=require(_0xa327('0x2'))(_0xa327('0x3'));var moment=require('moment');var BPromise=require(_0xa327('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa327('0x5'));var rimraf=require(_0xa327('0x6'));var config=require(_0xa327('0x7'));var attributes=require(_0xa327('0x8'));module['exports']=function(_0x3e9d6f,_0x509eb7){return _0x3e9d6f[_0xa327('0x9')](_0xa327('0xa'),attributes,{'tableName':_0xa327('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29a9=['../../config/environment','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0x29a9,0x7c));var _0x929a=function(_0x1a27f3,_0x1c082d){_0x1a27f3=_0x1a27f3-0x0;var _0x3ce222=_0x29a9[_0x1a27f3];return _0x3ce222;};'use strict';var _=require('lodash');var util=require(_0x929a('0x0'));var logger=require(_0x929a('0x1'))('api');var moment=require(_0x929a('0x2'));var BPromise=require(_0x929a('0x3'));var rp=require(_0x929a('0x4'));var fs=require('fs');var path=require(_0x929a('0x5'));var rimraf=require('rimraf');var config=require(_0x929a('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x136418,_0x133a52){return _0x136418[_0x929a('0x7')](_0x929a('0x8'),attributes,{'tableName':_0x929a('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 31570cf..b100a2b 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 _0x3dbb=['jayson/promise','client','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x7cf202,_0x175323){var _0x28f4cd=function(_0x5daa83){while(--_0x5daa83){_0x7cf202['push'](_0x7cf202['shift']());}};_0x28f4cd(++_0x175323);}(_0x3dbb,0x183));var _0xb3db=function(_0x3b970b,_0x2ff4aa){_0x3b970b=_0x3b970b-0x0;var _0x202d50=_0x3dbb[_0x3b970b];return _0x202d50;};'use strict';var _=require(_0xb3db('0x0'));var util=require(_0xb3db('0x1'));var moment=require(_0xb3db('0x2'));var BPromise=require(_0xb3db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3db('0x4'));var db=require(_0xb3db('0x5'))['db'];var utils=require(_0xb3db('0x6'));var logger=require('../../config/logger')(_0xb3db('0x7'));var config=require(_0xb3db('0x8'));var jayson=require(_0xb3db('0x9'));var client=jayson[_0xb3db('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x373f18,_0xd08d43,_0x109a18){return new BPromise(function(_0x22d306,_0x178b45){return client['request'](_0x373f18,_0x109a18)[_0xb3db('0xb')](function(_0x18fd77){logger[_0xb3db('0xc')](_0xb3db('0xd'),_0xd08d43,_0xb3db('0xe'));logger[_0xb3db('0xf')](_0xb3db('0x10'),_0xd08d43,_0xb3db('0xe'),JSON[_0xb3db('0x11')](_0x18fd77));if(_0x18fd77[_0xb3db('0x12')]){if(_0x18fd77[_0xb3db('0x12')][_0xb3db('0x13')]===0x1f4){logger[_0xb3db('0x12')](_0xb3db('0xd'),_0xd08d43,_0x18fd77[_0xb3db('0x12')][_0xb3db('0x14')]);return _0x178b45(_0x18fd77[_0xb3db('0x12')]['message']);}logger[_0xb3db('0x12')](_0xb3db('0xd'),_0xd08d43,_0x18fd77[_0xb3db('0x12')]['message']);return _0x22d306(_0x18fd77[_0xb3db('0x12')]['message']);}else{logger[_0xb3db('0xc')](_0xb3db('0xd'),_0xd08d43,_0xb3db('0xe'));_0x22d306(_0x18fd77[_0xb3db('0x15')][_0xb3db('0x14')]);}})['catch'](function(_0x1aadf5){logger[_0xb3db('0x12')](_0xb3db('0xd'),_0xd08d43,_0x1aadf5);_0x178b45(_0x1aadf5);});});} \ No newline at end of file +var _0x91ea=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x1b65b3,_0x206605){var _0x53fbab=function(_0x207400){while(--_0x207400){_0x1b65b3['push'](_0x1b65b3['shift']());}};_0x53fbab(++_0x206605);}(_0x91ea,0xf8));var _0xa91e=function(_0x460497,_0x502a75){_0x460497=_0x460497-0x0;var _0x5a86c6=_0x91ea[_0x460497];return _0x5a86c6;};'use strict';var _=require(_0xa91e('0x0'));var util=require(_0xa91e('0x1'));var moment=require('moment');var BPromise=require(_0xa91e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa91e('0x3'));var db=require(_0xa91e('0x4'))['db'];var utils=require(_0xa91e('0x5'));var logger=require(_0xa91e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa91e('0x7'));var client=jayson[_0xa91e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53a0dc,_0x5af567,_0x3c1fe4){return new BPromise(function(_0x233ba5,_0x2cb30f){return client[_0xa91e('0x9')](_0x53a0dc,_0x3c1fe4)[_0xa91e('0xa')](function(_0x34dfde){logger[_0xa91e('0xb')](_0xa91e('0xc'),_0x5af567,_0xa91e('0xd'));logger[_0xa91e('0xe')](_0xa91e('0xf'),_0x5af567,'request\x20sent',JSON['stringify'](_0x34dfde));if(_0x34dfde['error']){if(_0x34dfde[_0xa91e('0x10')][_0xa91e('0x11')]===0x1f4){logger[_0xa91e('0x10')](_0xa91e('0xc'),_0x5af567,_0x34dfde['error'][_0xa91e('0x12')]);return _0x2cb30f(_0x34dfde[_0xa91e('0x10')][_0xa91e('0x12')]);}logger['error'](_0xa91e('0xc'),_0x5af567,_0x34dfde[_0xa91e('0x10')][_0xa91e('0x12')]);return _0x233ba5(_0x34dfde[_0xa91e('0x10')][_0xa91e('0x12')]);}else{logger[_0xa91e('0xb')](_0xa91e('0xc'),_0x5af567,_0xa91e('0xd'));_0x233ba5(_0x34dfde[_0xa91e('0x13')][_0xa91e('0x12')]);}})[_0xa91e('0x14')](function(_0x44451c){logger[_0xa91e('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5af567,_0x44451c);_0x2cb30f(_0x44451c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 76d5965..6f34ce8 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 _0x01d3=['index','get','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x01d3,0xdb));var _0x301d=function(_0x2197bb,_0x2d7033){_0x2197bb=_0x2197bb-0x0;var _0x255158=_0x01d3[_0x2197bb];return _0x255158;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x301d('0x0'));var timeout=require(_0x301d('0x1'));var express=require(_0x301d('0x2'));var router=express['Router']();var fs_extra=require(_0x301d('0x3'));var auth=require(_0x301d('0x4'));var interaction=require(_0x301d('0x5'));var config=require(_0x301d('0x6'));var controller=require(_0x301d('0x7'));router['get']('/',auth[_0x301d('0x8')](),controller[_0x301d('0x9')]);router[_0x301d('0xa')](_0x301d('0xb'),auth[_0x301d('0x8')](),controller['show']);router[_0x301d('0xc')]('/',auth[_0x301d('0x8')](),controller[_0x301d('0xd')]);router[_0x301d('0xe')](_0x301d('0xb'),auth[_0x301d('0x8')](),controller[_0x301d('0xf')]);router[_0x301d('0x10')](_0x301d('0xb'),auth['isAuthenticated'](),controller[_0x301d('0x11')]);module[_0x301d('0x12')]=router; \ No newline at end of file +var _0x84ab=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','/:id','show','post','create','isAuthenticated','update','destroy','exports','multer','util','path'];(function(_0xcb5363,_0x1436b5){var _0x4912ad=function(_0x1c30c0){while(--_0x1c30c0){_0xcb5363['push'](_0xcb5363['shift']());}};_0x4912ad(++_0x1436b5);}(_0x84ab,0x12f));var _0xb84a=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x84ab[_0x22b39b];return _0x280e1d;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0xc')]('/',auth['isAuthenticated'](),controller[_0xb84a('0xd')]);router['put'](_0xb84a('0xa'),auth[_0xb84a('0xe')](),controller[_0xb84a('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0x10')]);module[_0xb84a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 238e2f3..5c9d073 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 _0xa13d=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0xa13d,0xbd));var _0xda13=function(_0xf3a6fd,_0x1e771f){_0xf3a6fd=_0xf3a6fd-0x0;var _0x2eb032=_0xa13d[_0xf3a6fd];return _0x2eb032;};'use strict';var Sequelize=require(_0xda13('0x0'));module[_0xda13('0x1')]={'type':{'type':Sequelize[_0xda13('0x2')](_0xda13('0x3'),_0xda13('0x4'),_0xda13('0x5'),_0xda13('0x6'),'picklist'),'defaultValue':_0xda13('0x3')},'content':{'type':Sequelize[_0xda13('0x7')]},'key':{'type':Sequelize[_0xda13('0x7')]},'keyType':{'type':Sequelize[_0xda13('0x2')](_0xda13('0x3'),'variable',_0xda13('0x5'))},'keyContent':{'type':Sequelize[_0xda13('0x7')]},'idField':{'type':Sequelize[_0xda13('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xda13('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xda13('0x7')]}}; \ No newline at end of file +var _0x422d=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x1a367d,_0x2fa8af){var _0x50ff92=function(_0x597970){while(--_0x597970){_0x1a367d['push'](_0x1a367d['shift']());}};_0x50ff92(++_0x2fa8af);}(_0x422d,0x86));var _0xd422=function(_0x3636eb,_0x230311){_0x3636eb=_0x3636eb-0x0;var _0x3c18e6=_0x422d[_0x3636eb];return _0x3c18e6;};'use strict';var Sequelize=require(_0xd422('0x0'));module[_0xd422('0x1')]={'type':{'type':Sequelize[_0xd422('0x2')](_0xd422('0x3'),_0xd422('0x4'),'customVariable',_0xd422('0x5'),_0xd422('0x6')),'defaultValue':_0xd422('0x3')},'content':{'type':Sequelize[_0xd422('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd422('0x2')](_0xd422('0x3'),_0xd422('0x4'),_0xd422('0x8'))},'keyContent':{'type':Sequelize[_0xd422('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd422('0x7')]},'customField':{'type':Sequelize[_0xd422('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd422('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 45a7263..7953c0e 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 _0x2b76=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','map','FreshsalesField','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','options','rows','catch','show','params','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end'];(function(_0x242b4d,_0x22bba5){var _0x565e7a=function(_0x4f7fbc){while(--_0x4f7fbc){_0x242b4d['push'](_0x242b4d['shift']());}};_0x565e7a(++_0x22bba5);}(_0x2b76,0xea));var _0x62b7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2b76[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62b7('0x0'));var zipdir=require(_0x62b7('0x1'));var jsonpatch=require(_0x62b7('0x2'));var rp=require(_0x62b7('0x3'));var moment=require(_0x62b7('0x4'));var BPromise=require(_0x62b7('0x5'));var Mustache=require(_0x62b7('0x6'));var util=require(_0x62b7('0x7'));var path=require(_0x62b7('0x8'));var sox=require(_0x62b7('0x9'));var csv=require(_0x62b7('0xa'));var ejs=require(_0x62b7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62b7('0xc'));var squel=require(_0x62b7('0xd'));var crypto=require(_0x62b7('0xe'));var jsforce=require(_0x62b7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x62b7('0xa'));var querystring=require('querystring');var Papa=require(_0x62b7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x62b7('0x11'));var as=require(_0x62b7('0x12'));var hardwareService=require(_0x62b7('0x13'));var logger=require('../../config/logger')(_0x62b7('0x14'));var utils=require(_0x62b7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x62b7('0x16'));var db=require(_0x62b7('0x17'))['db'];function respondWithStatusCode(_0x2fae2a,_0x441de4){_0x441de4=_0x441de4||0xcc;return function(_0x54d44a){if(_0x54d44a){return _0x2fae2a['sendStatus'](_0x441de4);}return _0x2fae2a[_0x62b7('0x18')](_0x441de4)[_0x62b7('0x19')]();};}function respondWithResult(_0x1d6162,_0x3ffe42){_0x3ffe42=_0x3ffe42||0xc8;return function(_0x596046){if(_0x596046){return _0x1d6162[_0x62b7('0x18')](_0x3ffe42)[_0x62b7('0x1a')](_0x596046);}};}function respondWithFilteredResult(_0x50f158,_0x3faab2){return function(_0x2e6c07){if(_0x2e6c07){var _0x3d57ec=typeof _0x3faab2[_0x62b7('0x1b')]===_0x62b7('0x1c')&&typeof _0x3faab2[_0x62b7('0x1d')]===_0x62b7('0x1c');var _0x202c7a=_0x2e6c07[_0x62b7('0x1e')];var _0x14fce0=_0x3d57ec?0x0:_0x3faab2[_0x62b7('0x1b')];var _0x562c22=_0x3d57ec?_0x2e6c07[_0x62b7('0x1e')]:_0x3faab2[_0x62b7('0x1b')]+_0x3faab2[_0x62b7('0x1d')];var _0x3c07f5;if(_0x562c22>=_0x202c7a){_0x562c22=_0x202c7a;_0x3c07f5=0xc8;}else{_0x3c07f5=0xce;}_0x50f158[_0x62b7('0x18')](_0x3c07f5);return _0x50f158[_0x62b7('0x1f')](_0x62b7('0x20'),_0x14fce0+'-'+_0x562c22+'/'+_0x202c7a)[_0x62b7('0x1a')](_0x2e6c07);}return null;};}function patchUpdates(_0x313d0b){return function(_0x1c06fb){try{jsonpatch[_0x62b7('0x21')](_0x1c06fb,_0x313d0b,!![]);}catch(_0x197b69){return BPromise['reject'](_0x197b69);}return _0x1c06fb[_0x62b7('0x22')]();};}function saveUpdates(_0xfc927e,_0x40afa0){return function(_0x20d7ef){if(_0x20d7ef){return _0x20d7ef[_0x62b7('0x23')](_0xfc927e)[_0x62b7('0x24')](function(_0x3e3e34){return _0x3e3e34;});}return null;};}function removeEntity(_0x3acf80,_0x4501fa){return function(_0x14950c){if(_0x14950c){return _0x14950c['destroy']()[_0x62b7('0x24')](function(){_0x3acf80[_0x62b7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b673d,_0x584353){return function(_0x4de542){if(!_0x4de542){_0x5b673d['sendStatus'](0x194);}return _0x4de542;};}function handleError(_0x17be42,_0x5749e2){_0x5749e2=_0x5749e2||0x1f4;return function(_0x1aa681){logger[_0x62b7('0x25')](_0x1aa681[_0x62b7('0x26')]);if(_0x1aa681[_0x62b7('0x27')]){delete _0x1aa681['name'];}_0x17be42['status'](_0x5749e2)['send'](_0x1aa681);};}exports['index']=function(_0x184a3b,_0x31b132){var _0x46051b={},_0x5bd3d5={},_0x1f80ee={'count':0x0,'rows':[]};var _0x5b3656=_[_0x62b7('0x28')](db[_0x62b7('0x29')][_0x62b7('0x2a')],function(_0x5f2884){return{'name':_0x5f2884[_0x62b7('0x2b')],'type':_0x5f2884[_0x62b7('0x2c')]['key']};});_0x5bd3d5['model']=_[_0x62b7('0x28')](_0x5b3656,_0x62b7('0x27'));_0x5bd3d5['query']=_[_0x62b7('0x2d')](_0x184a3b[_0x62b7('0x2e')]);_0x5bd3d5[_0x62b7('0x2f')]=_[_0x62b7('0x30')](_0x5bd3d5[_0x62b7('0x31')],_0x5bd3d5['query']);_0x46051b[_0x62b7('0x32')]=_[_0x62b7('0x30')](_0x5bd3d5[_0x62b7('0x31')],qs['fields'](_0x184a3b[_0x62b7('0x2e')][_0x62b7('0x33')]));_0x46051b[_0x62b7('0x32')]=_0x46051b[_0x62b7('0x32')][_0x62b7('0x34')]?_0x46051b[_0x62b7('0x32')]:_0x5bd3d5[_0x62b7('0x31')];if(!_0x184a3b[_0x62b7('0x2e')]['hasOwnProperty']('nolimit')){_0x46051b['limit']=qs['limit'](_0x184a3b[_0x62b7('0x2e')]['limit']);_0x46051b[_0x62b7('0x1b')]=qs['offset'](_0x184a3b[_0x62b7('0x2e')][_0x62b7('0x1b')]);}_0x46051b['order']=qs[_0x62b7('0x35')](_0x184a3b[_0x62b7('0x2e')][_0x62b7('0x35')]);_0x46051b[_0x62b7('0x36')]=qs[_0x62b7('0x2f')](_['pick'](_0x184a3b[_0x62b7('0x2e')],_0x5bd3d5[_0x62b7('0x2f')]),_0x5b3656);if(_0x184a3b['query'][_0x62b7('0x37')]){_0x46051b['where']=_[_0x62b7('0x38')](_0x46051b[_0x62b7('0x36')],{'$or':_[_0x62b7('0x28')](_0x5b3656,function(_0xb7ce75){if(_0xb7ce75[_0x62b7('0x2c')]!=='VIRTUAL'){var _0x495648={};_0x495648[_0xb7ce75[_0x62b7('0x27')]]={'$like':'%'+_0x184a3b[_0x62b7('0x2e')][_0x62b7('0x37')]+'%'};return _0x495648;}})});}_0x46051b=_['merge']({},_0x46051b,_0x184a3b[_0x62b7('0x39')]);var _0x3fe8aa={'where':_0x46051b['where']};return db['FreshsalesField']['count'](_0x3fe8aa)[_0x62b7('0x24')](function(_0x183cbd){_0x1f80ee['count']=_0x183cbd;if(_0x184a3b[_0x62b7('0x2e')]['includeAll']){_0x46051b['include']=[{'all':!![]}];}return db[_0x62b7('0x29')]['findAll'](_0x46051b);})[_0x62b7('0x24')](function(_0x37de8c){_0x1f80ee[_0x62b7('0x3a')]=_0x37de8c;return _0x1f80ee;})['then'](respondWithFilteredResult(_0x31b132,_0x46051b))[_0x62b7('0x3b')](handleError(_0x31b132,null));};exports[_0x62b7('0x3c')]=function(_0x3d294a,_0x252983){var _0x43f286={'raw':!![],'where':{'id':_0x3d294a[_0x62b7('0x3d')]['id']}},_0x21e97e={};_0x21e97e[_0x62b7('0x31')]=_[_0x62b7('0x2d')](db[_0x62b7('0x29')][_0x62b7('0x2a')]);_0x21e97e[_0x62b7('0x2e')]=_[_0x62b7('0x2d')](_0x3d294a[_0x62b7('0x2e')]);_0x21e97e[_0x62b7('0x2f')]=_[_0x62b7('0x30')](_0x21e97e[_0x62b7('0x31')],_0x21e97e[_0x62b7('0x2e')]);_0x43f286[_0x62b7('0x32')]=_[_0x62b7('0x30')](_0x21e97e[_0x62b7('0x31')],qs[_0x62b7('0x33')](_0x3d294a[_0x62b7('0x2e')][_0x62b7('0x33')]));_0x43f286['attributes']=_0x43f286[_0x62b7('0x32')][_0x62b7('0x34')]?_0x43f286['attributes']:_0x21e97e[_0x62b7('0x31')];if(_0x3d294a[_0x62b7('0x2e')]['includeAll']){_0x43f286['include']=[{'all':!![]}];}_0x43f286=_[_0x62b7('0x38')]({},_0x43f286,_0x3d294a['options']);return db[_0x62b7('0x29')]['find'](_0x43f286)[_0x62b7('0x24')](handleEntityNotFound(_0x252983,null))[_0x62b7('0x24')](respondWithResult(_0x252983,null))['catch'](handleError(_0x252983,null));};exports['create']=function(_0x3fe6f0,_0x5e2001){return db['FreshsalesField'][_0x62b7('0x3e')](_0x3fe6f0[_0x62b7('0x3f')],{})[_0x62b7('0x24')](respondWithResult(_0x5e2001,0xc9))['catch'](handleError(_0x5e2001,null));};exports[_0x62b7('0x23')]=function(_0x82e8af,_0x388c60){if(_0x82e8af[_0x62b7('0x3f')]['id']){delete _0x82e8af[_0x62b7('0x3f')]['id'];}return db[_0x62b7('0x29')][_0x62b7('0x40')]({'where':{'id':_0x82e8af[_0x62b7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x388c60,null))[_0x62b7('0x24')](saveUpdates(_0x82e8af[_0x62b7('0x3f')],null))[_0x62b7('0x24')](respondWithResult(_0x388c60,null))[_0x62b7('0x3b')](handleError(_0x388c60,null));};exports['destroy']=function(_0x16ecd9,_0x45a9ba){return db[_0x62b7('0x29')][_0x62b7('0x40')]({'where':{'id':_0x16ecd9[_0x62b7('0x3d')]['id']}})[_0x62b7('0x24')](handleEntityNotFound(_0x45a9ba,null))['then'](removeEntity(_0x45a9ba,null))['catch'](handleError(_0x45a9ba,null));}; \ No newline at end of file +var _0xb5e3=['FreshsalesField','findAll','rows','catch','show','params','includeAll','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x1b0d29,_0x1d7b39){var _0x3fb4d1=function(_0x2a9750){while(--_0x2a9750){_0x1b0d29['push'](_0x1b0d29['shift']());}};_0x3fb4d1(++_0x1d7b39);}(_0xb5e3,0xee));var _0x3b5e=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0xb5e3[_0x5f25b3];return _0x4ab9bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b5e('0x0'));var zipdir=require(_0x3b5e('0x1'));var jsonpatch=require(_0x3b5e('0x2'));var rp=require(_0x3b5e('0x3'));var moment=require('moment');var BPromise=require(_0x3b5e('0x4'));var Mustache=require(_0x3b5e('0x5'));var util=require(_0x3b5e('0x6'));var path=require('path');var sox=require(_0x3b5e('0x7'));var csv=require(_0x3b5e('0x8'));var ejs=require(_0x3b5e('0x9'));var fs=require('fs');var fs_extra=require(_0x3b5e('0xa'));var _=require(_0x3b5e('0xb'));var squel=require(_0x3b5e('0xc'));var crypto=require(_0x3b5e('0xd'));var jsforce=require(_0x3b5e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3b5e('0x8'));var querystring=require('querystring');var Papa=require(_0x3b5e('0xf'));var Redis=require(_0x3b5e('0x10'));var authService=require(_0x3b5e('0x11'));var qs=require(_0x3b5e('0x12'));var as=require(_0x3b5e('0x13'));var hardwareService=require(_0x3b5e('0x14'));var logger=require(_0x3b5e('0x15'))(_0x3b5e('0x16'));var utils=require(_0x3b5e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3b5e('0x18'))['db'];function respondWithStatusCode(_0x508e76,_0x1327d5){_0x1327d5=_0x1327d5||0xcc;return function(_0x26f904){if(_0x26f904){return _0x508e76[_0x3b5e('0x19')](_0x1327d5);}return _0x508e76[_0x3b5e('0x1a')](_0x1327d5)[_0x3b5e('0x1b')]();};}function respondWithResult(_0x4551c5,_0x3f0288){_0x3f0288=_0x3f0288||0xc8;return function(_0x5ddcee){if(_0x5ddcee){return _0x4551c5[_0x3b5e('0x1a')](_0x3f0288)[_0x3b5e('0x1c')](_0x5ddcee);}};}function respondWithFilteredResult(_0x45699a,_0x54d82d){return function(_0x486585){if(_0x486585){var _0x3b6f24=typeof _0x54d82d[_0x3b5e('0x1d')]===_0x3b5e('0x1e')&&typeof _0x54d82d[_0x3b5e('0x1f')]===_0x3b5e('0x1e');var _0x5f1f95=_0x486585['count'];var _0x95d710=_0x3b6f24?0x0:_0x54d82d[_0x3b5e('0x1d')];var _0x7334d3=_0x3b6f24?_0x486585[_0x3b5e('0x20')]:_0x54d82d[_0x3b5e('0x1d')]+_0x54d82d['limit'];var _0x3f653a;if(_0x7334d3>=_0x5f1f95){_0x7334d3=_0x5f1f95;_0x3f653a=0xc8;}else{_0x3f653a=0xce;}_0x45699a[_0x3b5e('0x1a')](_0x3f653a);return _0x45699a['set'](_0x3b5e('0x21'),_0x95d710+'-'+_0x7334d3+'/'+_0x5f1f95)[_0x3b5e('0x1c')](_0x486585);}return null;};}function patchUpdates(_0x8064b4){return function(_0x1f493d){try{jsonpatch['apply'](_0x1f493d,_0x8064b4,!![]);}catch(_0x4dc382){return BPromise[_0x3b5e('0x22')](_0x4dc382);}return _0x1f493d[_0x3b5e('0x23')]();};}function saveUpdates(_0x3cc033,_0x3e22f8){return function(_0x2df493){if(_0x2df493){return _0x2df493[_0x3b5e('0x24')](_0x3cc033)[_0x3b5e('0x25')](function(_0x43e071){return _0x43e071;});}return null;};}function removeEntity(_0x107c7a,_0x1006b2){return function(_0x447f38){if(_0x447f38){return _0x447f38[_0x3b5e('0x26')]()[_0x3b5e('0x25')](function(){_0x107c7a[_0x3b5e('0x1a')](0xcc)[_0x3b5e('0x1b')]();});}};}function handleEntityNotFound(_0x31ce23,_0x2d76bc){return function(_0xcfe10b){if(!_0xcfe10b){_0x31ce23['sendStatus'](0x194);}return _0xcfe10b;};}function handleError(_0x1cbb43,_0x20dc9b){_0x20dc9b=_0x20dc9b||0x1f4;return function(_0x3fb6f6){logger[_0x3b5e('0x27')](_0x3fb6f6[_0x3b5e('0x28')]);if(_0x3fb6f6['name']){delete _0x3fb6f6[_0x3b5e('0x29')];}_0x1cbb43[_0x3b5e('0x1a')](_0x20dc9b)[_0x3b5e('0x2a')](_0x3fb6f6);};}exports[_0x3b5e('0x2b')]=function(_0x21be71,_0x2e5ad8){var _0x13c2fc={},_0xd5f568={},_0xd0ab77={'count':0x0,'rows':[]};var _0x17e717=_[_0x3b5e('0x2c')](db['FreshsalesField'][_0x3b5e('0x2d')],function(_0x262ac0){return{'name':_0x262ac0[_0x3b5e('0x2e')],'type':_0x262ac0['type']['key']};});_0xd5f568[_0x3b5e('0x2f')]=_[_0x3b5e('0x2c')](_0x17e717,_0x3b5e('0x29'));_0xd5f568[_0x3b5e('0x30')]=_[_0x3b5e('0x31')](_0x21be71[_0x3b5e('0x30')]);_0xd5f568[_0x3b5e('0x32')]=_[_0x3b5e('0x33')](_0xd5f568[_0x3b5e('0x2f')],_0xd5f568[_0x3b5e('0x30')]);_0x13c2fc[_0x3b5e('0x34')]=_[_0x3b5e('0x33')](_0xd5f568[_0x3b5e('0x2f')],qs[_0x3b5e('0x35')](_0x21be71[_0x3b5e('0x30')][_0x3b5e('0x35')]));_0x13c2fc['attributes']=_0x13c2fc['attributes'][_0x3b5e('0x36')]?_0x13c2fc[_0x3b5e('0x34')]:_0xd5f568['model'];if(!_0x21be71['query'][_0x3b5e('0x37')](_0x3b5e('0x38'))){_0x13c2fc[_0x3b5e('0x1f')]=qs[_0x3b5e('0x1f')](_0x21be71[_0x3b5e('0x30')][_0x3b5e('0x1f')]);_0x13c2fc[_0x3b5e('0x1d')]=qs[_0x3b5e('0x1d')](_0x21be71[_0x3b5e('0x30')][_0x3b5e('0x1d')]);}_0x13c2fc[_0x3b5e('0x39')]=qs[_0x3b5e('0x3a')](_0x21be71[_0x3b5e('0x30')]['sort']);_0x13c2fc[_0x3b5e('0x3b')]=qs['filters'](_[_0x3b5e('0x3c')](_0x21be71['query'],_0xd5f568['filters']),_0x17e717);if(_0x21be71[_0x3b5e('0x30')][_0x3b5e('0x3d')]){_0x13c2fc[_0x3b5e('0x3b')]=_[_0x3b5e('0x3e')](_0x13c2fc[_0x3b5e('0x3b')],{'$or':_[_0x3b5e('0x2c')](_0x17e717,function(_0x2a9e03){if(_0x2a9e03[_0x3b5e('0x3f')]!==_0x3b5e('0x40')){var _0x30fd64={};_0x30fd64[_0x2a9e03['name']]={'$like':'%'+_0x21be71['query']['filter']+'%'};return _0x30fd64;}})});}_0x13c2fc=_[_0x3b5e('0x3e')]({},_0x13c2fc,_0x21be71[_0x3b5e('0x41')]);var _0x222989={'where':_0x13c2fc[_0x3b5e('0x3b')]};return db['FreshsalesField'][_0x3b5e('0x20')](_0x222989)[_0x3b5e('0x25')](function(_0xe20a3a){_0xd0ab77[_0x3b5e('0x20')]=_0xe20a3a;if(_0x21be71['query']['includeAll']){_0x13c2fc['include']=[{'all':!![]}];}return db[_0x3b5e('0x42')][_0x3b5e('0x43')](_0x13c2fc);})['then'](function(_0x3df7d4){_0xd0ab77[_0x3b5e('0x44')]=_0x3df7d4;return _0xd0ab77;})[_0x3b5e('0x25')](respondWithFilteredResult(_0x2e5ad8,_0x13c2fc))[_0x3b5e('0x45')](handleError(_0x2e5ad8,null));};exports[_0x3b5e('0x46')]=function(_0x2a5804,_0x404a89){var _0x3757ec={'raw':!![],'where':{'id':_0x2a5804[_0x3b5e('0x47')]['id']}},_0x1d5ad8={};_0x1d5ad8['model']=_[_0x3b5e('0x31')](db[_0x3b5e('0x42')][_0x3b5e('0x2d')]);_0x1d5ad8[_0x3b5e('0x30')]=_[_0x3b5e('0x31')](_0x2a5804['query']);_0x1d5ad8[_0x3b5e('0x32')]=_['intersection'](_0x1d5ad8['model'],_0x1d5ad8[_0x3b5e('0x30')]);_0x3757ec['attributes']=_[_0x3b5e('0x33')](_0x1d5ad8['model'],qs[_0x3b5e('0x35')](_0x2a5804[_0x3b5e('0x30')][_0x3b5e('0x35')]));_0x3757ec[_0x3b5e('0x34')]=_0x3757ec['attributes'][_0x3b5e('0x36')]?_0x3757ec[_0x3b5e('0x34')]:_0x1d5ad8[_0x3b5e('0x2f')];if(_0x2a5804[_0x3b5e('0x30')][_0x3b5e('0x48')]){_0x3757ec['include']=[{'all':!![]}];}_0x3757ec=_[_0x3b5e('0x3e')]({},_0x3757ec,_0x2a5804[_0x3b5e('0x41')]);return db['FreshsalesField']['find'](_0x3757ec)[_0x3b5e('0x25')](handleEntityNotFound(_0x404a89,null))[_0x3b5e('0x25')](respondWithResult(_0x404a89,null))[_0x3b5e('0x45')](handleError(_0x404a89,null));};exports['create']=function(_0x130e66,_0x4418a3){return db[_0x3b5e('0x42')][_0x3b5e('0x49')](_0x130e66[_0x3b5e('0x4a')],{})[_0x3b5e('0x25')](respondWithResult(_0x4418a3,0xc9))['catch'](handleError(_0x4418a3,null));};exports[_0x3b5e('0x24')]=function(_0x591642,_0x18ff31){if(_0x591642[_0x3b5e('0x4a')]['id']){delete _0x591642[_0x3b5e('0x4a')]['id'];}return db[_0x3b5e('0x42')][_0x3b5e('0x4b')]({'where':{'id':_0x591642['params']['id']}})[_0x3b5e('0x25')](handleEntityNotFound(_0x18ff31,null))[_0x3b5e('0x25')](saveUpdates(_0x591642[_0x3b5e('0x4a')],null))[_0x3b5e('0x25')](respondWithResult(_0x18ff31,null))[_0x3b5e('0x45')](handleError(_0x18ff31,null));};exports[_0x3b5e('0x26')]=function(_0x2fe993,_0xe3d4bb){return db['FreshsalesField'][_0x3b5e('0x4b')]({'where':{'id':_0x2fe993[_0x3b5e('0x47')]['id']}})[_0x3b5e('0x25')](handleEntityNotFound(_0xe3d4bb,null))[_0x3b5e('0x25')](removeEntity(_0xe3d4bb,null))[_0x3b5e('0x45')](handleError(_0xe3d4bb,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 410537c..572188f 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 _0xa0a3=['define','FreshsalesField','int_freshsales_fields','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x32d7fc,_0xe19094){_0x32d7fc=_0x32d7fc-0x0;var _0x525a42=_0xa0a3[_0x32d7fc];return _0x525a42;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var logger=require(_0x3a0a('0x1'))('api');var moment=require(_0x3a0a('0x2'));var BPromise=require(_0x3a0a('0x3'));var rp=require(_0x3a0a('0x4'));var fs=require('fs');var path=require(_0x3a0a('0x5'));var rimraf=require(_0x3a0a('0x6'));var config=require(_0x3a0a('0x7'));var attributes=require(_0x3a0a('0x8'));module[_0x3a0a('0x9')]=function(_0xa047cf,_0x3d7dc7){return _0xa047cf[_0x3a0a('0xa')](_0x3a0a('0xb'),attributes,{'tableName':_0x3a0a('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x3a0a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8276=['moment','bluebird','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util'];(function(_0x35e28d,_0x28f31a){var _0x1641b1=function(_0x29ef5c){while(--_0x29ef5c){_0x35e28d['push'](_0x35e28d['shift']());}};_0x1641b1(++_0x28f31a);}(_0x8276,0xa7));var _0x6827=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8276[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6827('0x0'));var util=require(_0x6827('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6827('0x2'));var BPromise=require(_0x6827('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6827('0x4'));var rimraf=require(_0x6827('0x5'));var config=require('../../config/environment');var attributes=require(_0x6827('0x6'));module[_0x6827('0x7')]=function(_0xc96297,_0x1c7983){return _0xc96297[_0x6827('0x8')](_0x6827('0x9'),attributes,{'tableName':_0x6827('0xa'),'paranoid':![],'indexes':[{'name':_0x6827('0xb'),'fields':[_0x6827('0xc'),'FieldId'],'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 9f4b9aa..127aced 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 _0xafc4=['error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x307fde,_0xcd0ab){var _0x25678c=function(_0x528b2d){while(--_0x528b2d){_0x307fde['push'](_0x307fde['shift']());}};_0x25678c(++_0xcd0ab);}(_0xafc4,0x69));var _0x4afc=function(_0x311610,_0x10c116){_0x311610=_0x311610-0x0;var _0x598de6=_0xafc4[_0x311610];return _0x598de6;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x53ec,0x192));var _0xc53e=function(_0x444716,_0x1fd1ef){_0x444716=_0x444716-0x0;var _0x9e6df5=_0x53ec[_0x444716];return _0x9e6df5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0ea995a..f4a8bf3 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x220a73,_0x365108){var _0x1f3ac1=function(_0x280e60){while(--_0x280e60){_0x220a73['push'](_0x220a73['shift']());}};_0x1f3ac1(++_0x365108);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x428997,_0x3fe519){var _0x58b331=function(_0x12da15){while(--_0x12da15){_0x428997['push'](_0x428997['shift']());}};_0x58b331(++_0x3fe519);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 02d83de..6bc78fc 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 _0xacc6=['integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x3220bb,_0x342a03){var _0x23415c=function(_0x56cc05){while(--_0x56cc05){_0x3220bb['push'](_0x3220bb['shift']());}};_0x23415c(++_0x342a03);}(_0xacc6,0x150));var _0x6acc=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xacc6[_0x44216d];return _0xeca523;};'use strict';var Sequelize=require(_0x6acc('0x0'));module[_0x6acc('0x1')]={'name':{'type':Sequelize[_0x6acc('0x2')]},'description':{'type':Sequelize[_0x6acc('0x2')]},'username':{'type':Sequelize[_0x6acc('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x6acc('0x2')]},'password':{'type':Sequelize[_0x6acc('0x2')]},'clientId':{'type':Sequelize[_0x6acc('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x6acc('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6acc('0x3')](_0x6acc('0x4'),'newTab'),'defaultValue':_0x6acc('0x4')}}; \ No newline at end of file +var _0xaf97=['STRING','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x18d9a0,_0x1ab937){var _0x44ae51=function(_0x4f9473){while(--_0x4f9473){_0x18d9a0['push'](_0x18d9a0['shift']());}};_0x44ae51(++_0x1ab937);}(_0xaf97,0x15a));var _0x7af9=function(_0x17fedb,_0x14dad8){_0x17fedb=_0x17fedb-0x0;var _0x2fe623=_0xaf97[_0x17fedb];return _0x2fe623;};'use strict';var Sequelize=require(_0x7af9('0x0'));module[_0x7af9('0x1')]={'name':{'type':Sequelize[_0x7af9('0x2')]},'description':{'type':Sequelize[_0x7af9('0x2')]},'username':{'type':Sequelize[_0x7af9('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x7af9('0x2')]},'password':{'type':Sequelize[_0x7af9('0x2')]},'clientId':{'type':Sequelize[_0x7af9('0x2')]},'clientSecret':{'type':Sequelize[_0x7af9('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7af9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7af9('0x3')](_0x7af9('0x4'),_0x7af9('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 11a3679..317dbe5 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 _0xb360=['Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','Task','remoteUri','clientId','username','securityToken','slice','substring','lastIndexOf','clientSecret','concat','isNil','ticketType','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','email','textarea','phone','includes','label','custom','picklistValues','value','boolean','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','reject','save','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceAccount','includeAll','findAll','catch','show','params','keys','include','find','update','body','destroy','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration'];(function(_0xd47873,_0x3c84c3){var _0x31b714=function(_0x514284){while(--_0x514284){_0xd47873['push'](_0xd47873['shift']());}};_0x31b714(++_0x3c84c3);}(_0xb360,0x1a6));var _0x0b36=function(_0x51ea72,_0x2f10c3){_0x51ea72=_0x51ea72-0x0;var _0x16f15d=_0xb360[_0x51ea72];return _0x16f15d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b36('0x0'));var zipdir=require(_0x0b36('0x1'));var jsonpatch=require(_0x0b36('0x2'));var rp=require(_0x0b36('0x3'));var moment=require(_0x0b36('0x4'));var BPromise=require(_0x0b36('0x5'));var Mustache=require(_0x0b36('0x6'));var util=require(_0x0b36('0x7'));var path=require(_0x0b36('0x8'));var sox=require(_0x0b36('0x9'));var csv=require(_0x0b36('0xa'));var ejs=require(_0x0b36('0xb'));var fs=require('fs');var fs_extra=require(_0x0b36('0xc'));var _=require('lodash');var squel=require(_0x0b36('0xd'));var crypto=require(_0x0b36('0xe'));var jsforce=require(_0x0b36('0xf'));var deskjs=require(_0x0b36('0x10'));var toCsv=require(_0x0b36('0xa'));var querystring=require('querystring');var Papa=require(_0x0b36('0x11'));var Redis=require(_0x0b36('0x12'));var authService=require(_0x0b36('0x13'));var qs=require(_0x0b36('0x14'));var as=require(_0x0b36('0x15'));var hardwareService=require(_0x0b36('0x16'));var logger=require(_0x0b36('0x17'))(_0x0b36('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0b36('0x19'));var db=require(_0x0b36('0x1a'))['db'];var integrations=require(_0x0b36('0x1b'));function respondWithStatusCode(_0xa7a87a,_0x5b3ec7){_0x5b3ec7=_0x5b3ec7||0xcc;return function(_0x5538f6){if(_0x5538f6){return _0xa7a87a['sendStatus'](_0x5b3ec7);}return _0xa7a87a[_0x0b36('0x1c')](_0x5b3ec7)[_0x0b36('0x1d')]();};}function respondWithResult(_0x1541df,_0x2f28ad){_0x2f28ad=_0x2f28ad||0xc8;return function(_0x227e6e){if(_0x227e6e){return _0x1541df[_0x0b36('0x1c')](_0x2f28ad)[_0x0b36('0x1e')](_0x227e6e);}};}function respondWithFilteredResult(_0xbd16ca,_0x54e9f9){return function(_0x17821c){if(_0x17821c){var _0x2d063a=typeof _0x54e9f9[_0x0b36('0x1f')]===_0x0b36('0x20')&&typeof _0x54e9f9[_0x0b36('0x21')]===_0x0b36('0x20');var _0x3e554f=_0x17821c['count'];var _0x4a266e=_0x2d063a?0x0:_0x54e9f9[_0x0b36('0x1f')];var _0x3312d9=_0x2d063a?_0x17821c[_0x0b36('0x22')]:_0x54e9f9[_0x0b36('0x1f')]+_0x54e9f9[_0x0b36('0x21')];var _0x38f590;if(_0x3312d9>=_0x3e554f){_0x3312d9=_0x3e554f;_0x38f590=0xc8;}else{_0x38f590=0xce;}_0xbd16ca[_0x0b36('0x1c')](_0x38f590);return _0xbd16ca[_0x0b36('0x23')]('Content-Range',_0x4a266e+'-'+_0x3312d9+'/'+_0x3e554f)[_0x0b36('0x1e')](_0x17821c);}return null;};}function patchUpdates(_0x500808){return function(_0x2337d9){try{jsonpatch['apply'](_0x2337d9,_0x500808,!![]);}catch(_0x5b086c){return BPromise[_0x0b36('0x24')](_0x5b086c);}return _0x2337d9[_0x0b36('0x25')]();};}function saveUpdates(_0x56f783,_0x2e7004){return function(_0x5d7b92){if(_0x5d7b92){return _0x5d7b92['update'](_0x56f783)[_0x0b36('0x26')](function(_0xa44be0){return _0xa44be0;});}return null;};}function removeEntity(_0x4dc8d1,_0x93e722){return function(_0x2d77c2){if(_0x2d77c2){return _0x2d77c2['destroy']()[_0x0b36('0x26')](function(){_0x4dc8d1['status'](0xcc)[_0x0b36('0x1d')]();});}};}function handleEntityNotFound(_0x2de2ab,_0xfb35e9){return function(_0x426389){if(!_0x426389){_0x2de2ab[_0x0b36('0x27')](0x194);}return _0x426389;};}function handleError(_0x3df978,_0x22a445){_0x22a445=_0x22a445||0x1f4;return function(_0x5a89d9){logger[_0x0b36('0x28')](_0x5a89d9[_0x0b36('0x29')]);if(_0x5a89d9[_0x0b36('0x2a')]){delete _0x5a89d9[_0x0b36('0x2a')];}_0x3df978['status'](_0x22a445)[_0x0b36('0x2b')](_0x5a89d9);};}exports['index']=function(_0x485267,_0x463348){var _0x8ea581={},_0x2644e6={},_0x2ce968={'count':0x0,'rows':[]};var _0x31a4b4=_[_0x0b36('0x2c')](db['SalesforceAccount'][_0x0b36('0x2d')],function(_0xf6d373){return{'name':_0xf6d373[_0x0b36('0x2e')],'type':_0xf6d373[_0x0b36('0x2f')][_0x0b36('0x30')]};});_0x2644e6[_0x0b36('0x31')]=_[_0x0b36('0x2c')](_0x31a4b4,'name');_0x2644e6[_0x0b36('0x32')]=_['keys'](_0x485267[_0x0b36('0x32')]);_0x2644e6[_0x0b36('0x33')]=_[_0x0b36('0x34')](_0x2644e6[_0x0b36('0x31')],_0x2644e6[_0x0b36('0x32')]);_0x8ea581[_0x0b36('0x35')]=_[_0x0b36('0x34')](_0x2644e6[_0x0b36('0x31')],qs[_0x0b36('0x36')](_0x485267[_0x0b36('0x32')][_0x0b36('0x36')]));_0x8ea581['attributes']=_0x8ea581[_0x0b36('0x35')][_0x0b36('0x37')]?_0x8ea581[_0x0b36('0x35')]:_0x2644e6[_0x0b36('0x31')];if(!_0x485267[_0x0b36('0x32')]['hasOwnProperty'](_0x0b36('0x38'))){_0x8ea581[_0x0b36('0x21')]=qs[_0x0b36('0x21')](_0x485267['query'][_0x0b36('0x21')]);_0x8ea581['offset']=qs[_0x0b36('0x1f')](_0x485267[_0x0b36('0x32')][_0x0b36('0x1f')]);}_0x8ea581[_0x0b36('0x39')]=qs['sort'](_0x485267['query'][_0x0b36('0x3a')]);_0x8ea581[_0x0b36('0x3b')]=qs[_0x0b36('0x33')](_[_0x0b36('0x3c')](_0x485267['query'],_0x2644e6[_0x0b36('0x33')]),_0x31a4b4);if(_0x485267[_0x0b36('0x32')][_0x0b36('0x3d')]){_0x8ea581[_0x0b36('0x3b')]=_[_0x0b36('0x3e')](_0x8ea581['where'],{'$or':_[_0x0b36('0x2c')](_0x31a4b4,function(_0x1441f0){if(_0x1441f0[_0x0b36('0x2f')]!==_0x0b36('0x3f')){var _0x460949={};_0x460949[_0x1441f0[_0x0b36('0x2a')]]={'$like':'%'+_0x485267[_0x0b36('0x32')][_0x0b36('0x3d')]+'%'};return _0x460949;}})});}_0x8ea581=_['merge']({},_0x8ea581,_0x485267[_0x0b36('0x40')]);var _0x567f6e={'where':_0x8ea581[_0x0b36('0x3b')]};return db[_0x0b36('0x41')][_0x0b36('0x22')](_0x567f6e)['then'](function(_0x480601){_0x2ce968[_0x0b36('0x22')]=_0x480601;if(_0x485267[_0x0b36('0x32')][_0x0b36('0x42')]){_0x8ea581['include']=[{'all':!![]}];}return db[_0x0b36('0x41')][_0x0b36('0x43')](_0x8ea581);})['then'](function(_0x1f3965){_0x2ce968['rows']=_0x1f3965;return _0x2ce968;})[_0x0b36('0x26')](respondWithFilteredResult(_0x463348,_0x8ea581))[_0x0b36('0x44')](handleError(_0x463348,null));};exports[_0x0b36('0x45')]=function(_0x41e2db,_0x4bcd8e){var _0x13ad86={'raw':![],'where':{'id':_0x41e2db[_0x0b36('0x46')]['id']}},_0xdbdb4d={};_0xdbdb4d[_0x0b36('0x31')]=_[_0x0b36('0x47')](db['SalesforceAccount']['rawAttributes']);_0xdbdb4d[_0x0b36('0x32')]=_['keys'](_0x41e2db['query']);_0xdbdb4d[_0x0b36('0x33')]=_[_0x0b36('0x34')](_0xdbdb4d['model'],_0xdbdb4d[_0x0b36('0x32')]);_0x13ad86['attributes']=_[_0x0b36('0x34')](_0xdbdb4d[_0x0b36('0x31')],qs['fields'](_0x41e2db[_0x0b36('0x32')][_0x0b36('0x36')]));_0x13ad86[_0x0b36('0x35')]=_0x13ad86[_0x0b36('0x35')][_0x0b36('0x37')]?_0x13ad86[_0x0b36('0x35')]:_0xdbdb4d[_0x0b36('0x31')];if(_0x41e2db[_0x0b36('0x32')][_0x0b36('0x42')]){_0x13ad86[_0x0b36('0x48')]=[{'all':!![]}];}_0x13ad86=_[_0x0b36('0x3e')]({},_0x13ad86,_0x41e2db['options']);return db['SalesforceAccount'][_0x0b36('0x49')](_0x13ad86)['then'](handleEntityNotFound(_0x4bcd8e,null))[_0x0b36('0x26')](respondWithResult(_0x4bcd8e,null))['catch'](handleError(_0x4bcd8e,null));};exports['create']=function(_0x295ccd,_0x3f1fb4){return db[_0x0b36('0x41')]['create'](_0x295ccd['body'],{})[_0x0b36('0x26')](respondWithResult(_0x3f1fb4,0xc9))[_0x0b36('0x44')](handleError(_0x3f1fb4,null));};exports[_0x0b36('0x4a')]=function(_0x5c000e,_0x32aaa6){if(_0x5c000e[_0x0b36('0x4b')]['id']){delete _0x5c000e[_0x0b36('0x4b')]['id'];}return db[_0x0b36('0x41')]['find']({'where':{'id':_0x5c000e[_0x0b36('0x46')]['id']}})[_0x0b36('0x26')](handleEntityNotFound(_0x32aaa6,null))['then'](saveUpdates(_0x5c000e['body'],null))[_0x0b36('0x26')](respondWithResult(_0x32aaa6,null))['catch'](handleError(_0x32aaa6,null));};exports[_0x0b36('0x4c')]=function(_0x235be9,_0x1b058f){return db['SalesforceAccount'][_0x0b36('0x49')]({'where':{'id':_0x235be9[_0x0b36('0x46')]['id']}})[_0x0b36('0x26')](handleEntityNotFound(_0x1b058f,null))[_0x0b36('0x26')](removeEntity(_0x1b058f,null))[_0x0b36('0x44')](handleError(_0x1b058f,null));};exports[_0x0b36('0x4d')]=function(_0x2690b1,_0x28c1ff,_0x26a5fb){var _0x517c81={};var _0x57eb42={};var _0x327039;var _0x50783e;return db['SalesforceAccount'][_0x0b36('0x4e')]({'where':{'id':_0x2690b1[_0x0b36('0x46')]['id']}})[_0x0b36('0x26')](handleEntityNotFound(_0x28c1ff,null))['then'](function(_0xd9703a){if(_0xd9703a){_0x327039=_0xd9703a;_0x57eb42[_0x0b36('0x31')]=_[_0x0b36('0x47')](db[_0x0b36('0x4f')][_0x0b36('0x2d')]);_0x57eb42[_0x0b36('0x32')]=_[_0x0b36('0x47')](_0x2690b1[_0x0b36('0x32')]);_0x57eb42[_0x0b36('0x33')]=_[_0x0b36('0x34')](_0x57eb42['model'],_0x57eb42[_0x0b36('0x32')]);_0x517c81[_0x0b36('0x35')]=_[_0x0b36('0x34')](_0x57eb42['model'],qs[_0x0b36('0x36')](_0x2690b1[_0x0b36('0x32')]['fields']));_0x517c81['attributes']=_0x517c81[_0x0b36('0x35')][_0x0b36('0x37')]?_0x517c81[_0x0b36('0x35')]:_0x57eb42['model'];_0x517c81['order']=qs[_0x0b36('0x3a')](_0x2690b1[_0x0b36('0x32')][_0x0b36('0x3a')]);_0x517c81[_0x0b36('0x3b')]=qs[_0x0b36('0x33')](_[_0x0b36('0x3c')](_0x2690b1[_0x0b36('0x32')],_0x57eb42['filters']));if(_0x2690b1[_0x0b36('0x32')][_0x0b36('0x3d')]){_0x517c81[_0x0b36('0x3b')]=_[_0x0b36('0x3e')](_0x517c81[_0x0b36('0x3b')],{'$or':_['map'](_0x517c81['attributes'],function(_0x2ddc2d){var _0x12c453={};_0x12c453[_0x2ddc2d]={'$like':'%'+_0x2690b1[_0x0b36('0x32')][_0x0b36('0x3d')]+'%'};return _0x12c453;})});}_0x517c81=_[_0x0b36('0x3e')]({},_0x517c81,_0x2690b1[_0x0b36('0x40')]);return _0x327039[_0x0b36('0x4d')](_0x517c81);}})[_0x0b36('0x26')](function(_0x58efb6){if(_0x58efb6){_0x50783e=_0x58efb6[_0x0b36('0x37')];if(!_0x2690b1[_0x0b36('0x32')][_0x0b36('0x50')](_0x0b36('0x38'))){_0x517c81[_0x0b36('0x21')]=qs[_0x0b36('0x21')](_0x2690b1[_0x0b36('0x32')][_0x0b36('0x21')]);_0x517c81[_0x0b36('0x1f')]=qs[_0x0b36('0x1f')](_0x2690b1[_0x0b36('0x32')][_0x0b36('0x1f')]);}return _0x327039['getConfigurations'](_0x517c81);}})['then'](function(_0x355b6f){if(_0x355b6f){return _0x355b6f?{'count':_0x50783e,'rows':_0x355b6f}:null;}})['then'](respondWithResult(_0x28c1ff,null))[_0x0b36('0x44')](handleError(_0x28c1ff,null));};exports[_0x0b36('0x51')]=function(_0x33fc65,_0x5e19af,_0x31c4f6){if(_0x33fc65[_0x0b36('0x4b')]['id']){delete _0x33fc65[_0x0b36('0x4b')]['id'];}return db[_0x0b36('0x41')][_0x0b36('0x4e')]({'where':{'id':_0x33fc65[_0x0b36('0x46')]['id']}})[_0x0b36('0x26')](handleEntityNotFound(_0x5e19af,null))['then'](function(_0x5aa801){if(_0x5aa801){_0x33fc65[_0x0b36('0x4b')]['AccountId']=_0x5aa801['id'];_0x33fc65[_0x0b36('0x4b')][_0x0b36('0x52')]=integrations[_0x0b36('0x53')](_0x33fc65[_0x0b36('0x4b')][_0x0b36('0x54')],_0x33fc65[_0x0b36('0x4b')][_0x0b36('0x2f')]);_0x33fc65[_0x0b36('0x4b')]['Descriptions']=integrations[_0x0b36('0x55')](_0x33fc65[_0x0b36('0x4b')][_0x0b36('0x54')],_0x33fc65[_0x0b36('0x4b')][_0x0b36('0x2f')]);return db[_0x0b36('0x4f')]['create'](_0x33fc65[_0x0b36('0x4b')],{'include':[{'model':db['SalesforceField'],'as':_0x0b36('0x52')},{'model':db['SalesforceField'],'as':_0x0b36('0x56')}]});}return null;})[_0x0b36('0x26')](respondWithResult(_0x5e19af,null))[_0x0b36('0x44')](handleError(_0x5e19af,null));};exports[_0x0b36('0x57')]=function(_0xb72724,_0x36497d,_0x26ad6c){var _0x37cd14;var _0x41cb18='';var _0x1589e2=_0x0b36('0x58');return db[_0x0b36('0x41')]['findOne']({'where':{'id':_0xb72724[_0x0b36('0x46')]['id']},'attributes':['id',_0x0b36('0x59'),_0x0b36('0x5a'),'clientSecret',_0x0b36('0x5b'),'password',_0x0b36('0x5c')]})[_0x0b36('0x26')](handleEntityNotFound(_0x36497d,null))[_0x0b36('0x26')](function(_0x5b2166){if(_0x5b2166){_0x41cb18=_0x5b2166[_0x0b36('0x59')];var _0xfdebfb=_0x41cb18[_0x0b36('0x5d')](-0x1);if(_0xfdebfb==='/'){_0x41cb18=_0x41cb18[_0x0b36('0x5e')](0x0,_0x41cb18[_0x0b36('0x5f')](_0xfdebfb));}_0x37cd14=new jsforce['Connection']({'oauth2':{'loginUrl':_0x41cb18,'clientId':_0x5b2166[_0x0b36('0x5a')],'clientSecret':_0x5b2166[_0x0b36('0x60')]}});return _0x37cd14['login'](_0x5b2166[_0x0b36('0x5b')],_0x5b2166['password'][_0x0b36('0x61')](_0x5b2166[_0x0b36('0x5c')]));}})['then'](function(_0x3faae7){if(_0x3faae7){if(!_[_0x0b36('0x62')](_0xb72724['query'][_0x0b36('0x63')])){_0x1589e2=_0xb72724[_0x0b36('0x32')][_0x0b36('0x63')];}return _0x37cd14['sobject'](_0x1589e2)['describe']();}})[_0x0b36('0x26')](function(_0x3add11){var _0x20eada=[_0x0b36('0x64'),_0x0b36('0x65'),_0x0b36('0x66'),_0x0b36('0x67'),_0x0b36('0x68'),_0x0b36('0x69')];var _0x28020c=[_0x0b36('0x6a'),_0x0b36('0x6b'),'picklist','boolean',_0x0b36('0x6c'),_0x0b36('0x6d'),_0x0b36('0x6e')];if(_0x3add11){_['remove'](_0x3add11[_0x0b36('0x36')],function(_0x204c82){return _0x20eada[_0x0b36('0x6f')](_0x204c82[_0x0b36('0x2a')])||!_0x28020c[_0x0b36('0x6f')](_0x204c82['type']);});return{'count':_0x3add11['fields'][_0x0b36('0x37')],'rows':_[_0x0b36('0x2c')](_0x3add11[_0x0b36('0x36')],function(_0x4e85c2){return{'id':_0x4e85c2['name'],'name':_0x4e85c2[_0x0b36('0x70')],'custom':_0x4e85c2[_0x0b36('0x71')],'options':_0x4e85c2[_0x0b36('0x72')]['length']>0x0?_[_0x0b36('0x2c')](_0x4e85c2['picklistValues'],function(_0x482774){return{'name':_0x482774[_0x0b36('0x70')],'value':_0x482774[_0x0b36('0x73')]};}):_0x4e85c2[_0x0b36('0x2f')]==_0x0b36('0x74')?[{'name':_0x0b36('0x75'),'value':_0x0b36('0x76')},{'name':_0x0b36('0x77'),'value':_0x0b36('0x78')}]:[]};})};}})[_0x0b36('0x26')](respondWithResult(_0x36497d,null))[_0x0b36('0x44')](function(_0xa29d92){var _0x404d45=_0xb72724[_0x0b36('0x32')][_0x0b36('0x79')]?0x1f4:_0xa29d92[_0x0b36('0x7a')]||0x1f4;logger[_0x0b36('0x28')](_0x0b36('0x7b'),'getFields',_0x404d45,JSON[_0x0b36('0x7c')](_0xa29d92));delete _0xa29d92[_0x0b36('0x2a')];if(_0x404d45===0x191){_0x404d45=0x190;}_0x36497d[_0x0b36('0x1c')](_0x404d45)[_0x0b36('0x2b')](_0xb72724['query'][_0x0b36('0x79')]?{'message':_0x0b36('0x7d'),'statusCode':_0xa29d92['statusCode']}:_0xa29d92);});}; \ No newline at end of file +var _0x9584=['find','create','body','findOne','params','SalesforceConfiguration','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','remoteUri','clientSecret','password','slice','substring','login','username','securityToken','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean','email','textarea','phone','includes','custom','picklistValues','label','value','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','mustache','util','to-csv','ejs','fs-extra','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','error','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','keys','options'];(function(_0x207ad2,_0x57511f){var _0xcc6bc3=function(_0x4db8fa){while(--_0x4db8fa){_0x207ad2['push'](_0x207ad2['shift']());}};_0xcc6bc3(++_0x57511f);}(_0x9584,0x111));var _0x4958=function(_0x305b7b,_0x39ef39){_0x305b7b=_0x305b7b-0x0;var _0x143bdf=_0x9584[_0x305b7b];return _0x143bdf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4958('0x0'));var zipdir=require(_0x4958('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4958('0x2'));var util=require(_0x4958('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x4958('0x4'));var ejs=require(_0x4958('0x5'));var fs=require('fs');var fs_extra=require(_0x4958('0x6'));var _=require('lodash');var squel=require(_0x4958('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4958('0x8'));var Papa=require('papaparse');var Redis=require(_0x4958('0x9'));var authService=require('../../components/auth/service');var qs=require(_0x4958('0xa'));var as=require(_0x4958('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4958('0xc'))(_0x4958('0xd'));var utils=require(_0x4958('0xe'));var config=require(_0x4958('0xf'));var licenseUtil=require(_0x4958('0x10'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4958('0x11'));function respondWithStatusCode(_0x148ce0,_0x220706){_0x220706=_0x220706||0xcc;return function(_0x37996b){if(_0x37996b){return _0x148ce0[_0x4958('0x12')](_0x220706);}return _0x148ce0['status'](_0x220706)[_0x4958('0x13')]();};}function respondWithResult(_0x4ed11a,_0x46a38e){_0x46a38e=_0x46a38e||0xc8;return function(_0x141031){if(_0x141031){return _0x4ed11a['status'](_0x46a38e)[_0x4958('0x14')](_0x141031);}};}function respondWithFilteredResult(_0x5da13a,_0x5e982a){return function(_0x498069){if(_0x498069){var _0x5befa5=typeof _0x5e982a[_0x4958('0x15')]===_0x4958('0x16')&&typeof _0x5e982a[_0x4958('0x17')]===_0x4958('0x16');var _0x23d13e=_0x498069[_0x4958('0x18')];var _0x5ac978=_0x5befa5?0x0:_0x5e982a[_0x4958('0x15')];var _0x2e69cb=_0x5befa5?_0x498069[_0x4958('0x18')]:_0x5e982a[_0x4958('0x15')]+_0x5e982a[_0x4958('0x17')];var _0x411c1a;if(_0x2e69cb>=_0x23d13e){_0x2e69cb=_0x23d13e;_0x411c1a=0xc8;}else{_0x411c1a=0xce;}_0x5da13a[_0x4958('0x19')](_0x411c1a);return _0x5da13a[_0x4958('0x1a')]('Content-Range',_0x5ac978+'-'+_0x2e69cb+'/'+_0x23d13e)['json'](_0x498069);}return null;};}function patchUpdates(_0x14e95b){return function(_0x307a84){try{jsonpatch[_0x4958('0x1b')](_0x307a84,_0x14e95b,!![]);}catch(_0x4c0cac){return BPromise[_0x4958('0x1c')](_0x4c0cac);}return _0x307a84[_0x4958('0x1d')]();};}function saveUpdates(_0x3a38bd,_0x24c987){return function(_0x3cb4ce){if(_0x3cb4ce){return _0x3cb4ce[_0x4958('0x1e')](_0x3a38bd)[_0x4958('0x1f')](function(_0x50e986){return _0x50e986;});}return null;};}function removeEntity(_0x5d3637,_0x42d40c){return function(_0x5a95c6){if(_0x5a95c6){return _0x5a95c6[_0x4958('0x20')]()['then'](function(){_0x5d3637['status'](0xcc)[_0x4958('0x13')]();});}};}function handleEntityNotFound(_0x2af33c,_0x25e62d){return function(_0x3fd155){if(!_0x3fd155){_0x2af33c['sendStatus'](0x194);}return _0x3fd155;};}function handleError(_0x3f55af,_0x1839c){_0x1839c=_0x1839c||0x1f4;return function(_0x228daf){logger[_0x4958('0x21')](_0x228daf['stack']);if(_0x228daf[_0x4958('0x22')]){delete _0x228daf['name'];}_0x3f55af[_0x4958('0x19')](_0x1839c)[_0x4958('0x23')](_0x228daf);};}exports['index']=function(_0x5802b5,_0x1aea78){var _0x78a583={},_0x2a589c={},_0x150e6b={'count':0x0,'rows':[]};var _0x2a2e9e=_[_0x4958('0x24')](db[_0x4958('0x25')][_0x4958('0x26')],function(_0x25feeb){return{'name':_0x25feeb[_0x4958('0x27')],'type':_0x25feeb[_0x4958('0x28')][_0x4958('0x29')]};});_0x2a589c[_0x4958('0x2a')]=_[_0x4958('0x24')](_0x2a2e9e,_0x4958('0x22'));_0x2a589c[_0x4958('0x2b')]=_['keys'](_0x5802b5[_0x4958('0x2b')]);_0x2a589c['filters']=_['intersection'](_0x2a589c[_0x4958('0x2a')],_0x2a589c['query']);_0x78a583[_0x4958('0x2c')]=_[_0x4958('0x2d')](_0x2a589c['model'],qs[_0x4958('0x2e')](_0x5802b5[_0x4958('0x2b')]['fields']));_0x78a583[_0x4958('0x2c')]=_0x78a583[_0x4958('0x2c')][_0x4958('0x2f')]?_0x78a583[_0x4958('0x2c')]:_0x2a589c[_0x4958('0x2a')];if(!_0x5802b5['query'][_0x4958('0x30')](_0x4958('0x31'))){_0x78a583['limit']=qs[_0x4958('0x17')](_0x5802b5[_0x4958('0x2b')][_0x4958('0x17')]);_0x78a583['offset']=qs[_0x4958('0x15')](_0x5802b5[_0x4958('0x2b')][_0x4958('0x15')]);}_0x78a583['order']=qs[_0x4958('0x32')](_0x5802b5['query'][_0x4958('0x32')]);_0x78a583[_0x4958('0x33')]=qs[_0x4958('0x34')](_[_0x4958('0x35')](_0x5802b5[_0x4958('0x2b')],_0x2a589c[_0x4958('0x34')]),_0x2a2e9e);if(_0x5802b5['query'][_0x4958('0x36')]){_0x78a583[_0x4958('0x33')]=_[_0x4958('0x37')](_0x78a583[_0x4958('0x33')],{'$or':_[_0x4958('0x24')](_0x2a2e9e,function(_0x4960ef){if(_0x4960ef[_0x4958('0x28')]!==_0x4958('0x38')){var _0x3df5c7={};_0x3df5c7[_0x4960ef[_0x4958('0x22')]]={'$like':'%'+_0x5802b5['query'][_0x4958('0x36')]+'%'};return _0x3df5c7;}})});}_0x78a583=_['merge']({},_0x78a583,_0x5802b5['options']);var _0x5a1347={'where':_0x78a583['where']};return db[_0x4958('0x25')]['count'](_0x5a1347)[_0x4958('0x1f')](function(_0x567607){_0x150e6b[_0x4958('0x18')]=_0x567607;if(_0x5802b5[_0x4958('0x2b')][_0x4958('0x39')]){_0x78a583['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0x4958('0x3a')](_0x78a583);})[_0x4958('0x1f')](function(_0xd823b4){_0x150e6b['rows']=_0xd823b4;return _0x150e6b;})[_0x4958('0x1f')](respondWithFilteredResult(_0x1aea78,_0x78a583))[_0x4958('0x3b')](handleError(_0x1aea78,null));};exports[_0x4958('0x3c')]=function(_0x4728af,_0x17ea38){var _0x9c4a9b={'raw':![],'where':{'id':_0x4728af['params']['id']}},_0x450841={};_0x450841[_0x4958('0x2a')]=_['keys'](db[_0x4958('0x25')]['rawAttributes']);_0x450841[_0x4958('0x2b')]=_[_0x4958('0x3d')](_0x4728af['query']);_0x450841[_0x4958('0x34')]=_['intersection'](_0x450841[_0x4958('0x2a')],_0x450841[_0x4958('0x2b')]);_0x9c4a9b['attributes']=_[_0x4958('0x2d')](_0x450841[_0x4958('0x2a')],qs['fields'](_0x4728af[_0x4958('0x2b')][_0x4958('0x2e')]));_0x9c4a9b[_0x4958('0x2c')]=_0x9c4a9b[_0x4958('0x2c')][_0x4958('0x2f')]?_0x9c4a9b[_0x4958('0x2c')]:_0x450841[_0x4958('0x2a')];if(_0x4728af[_0x4958('0x2b')][_0x4958('0x39')]){_0x9c4a9b['include']=[{'all':!![]}];}_0x9c4a9b=_[_0x4958('0x37')]({},_0x9c4a9b,_0x4728af[_0x4958('0x3e')]);return db[_0x4958('0x25')][_0x4958('0x3f')](_0x9c4a9b)[_0x4958('0x1f')](handleEntityNotFound(_0x17ea38,null))[_0x4958('0x1f')](respondWithResult(_0x17ea38,null))[_0x4958('0x3b')](handleError(_0x17ea38,null));};exports[_0x4958('0x40')]=function(_0x38f9bb,_0x10613e){return db['SalesforceAccount']['create'](_0x38f9bb[_0x4958('0x41')],{})['then'](respondWithResult(_0x10613e,0xc9))[_0x4958('0x3b')](handleError(_0x10613e,null));};exports[_0x4958('0x1e')]=function(_0x470c7b,_0x1b366d){if(_0x470c7b[_0x4958('0x41')]['id']){delete _0x470c7b['body']['id'];}return db[_0x4958('0x25')][_0x4958('0x3f')]({'where':{'id':_0x470c7b['params']['id']}})[_0x4958('0x1f')](handleEntityNotFound(_0x1b366d,null))['then'](saveUpdates(_0x470c7b['body'],null))[_0x4958('0x1f')](respondWithResult(_0x1b366d,null))[_0x4958('0x3b')](handleError(_0x1b366d,null));};exports[_0x4958('0x20')]=function(_0x268819,_0x5e958b){return db[_0x4958('0x25')][_0x4958('0x3f')]({'where':{'id':_0x268819['params']['id']}})[_0x4958('0x1f')](handleEntityNotFound(_0x5e958b,null))[_0x4958('0x1f')](removeEntity(_0x5e958b,null))[_0x4958('0x3b')](handleError(_0x5e958b,null));};exports['getConfigurations']=function(_0x272f4f,_0x1c3841,_0x197e7d){var _0x4b821e={};var _0x3705c2={};var _0x5af6be;var _0x2f9aed;return db[_0x4958('0x25')][_0x4958('0x42')]({'where':{'id':_0x272f4f[_0x4958('0x43')]['id']}})[_0x4958('0x1f')](handleEntityNotFound(_0x1c3841,null))['then'](function(_0xa2ef4){if(_0xa2ef4){_0x5af6be=_0xa2ef4;_0x3705c2['model']=_[_0x4958('0x3d')](db[_0x4958('0x44')][_0x4958('0x26')]);_0x3705c2[_0x4958('0x2b')]=_[_0x4958('0x3d')](_0x272f4f[_0x4958('0x2b')]);_0x3705c2['filters']=_[_0x4958('0x2d')](_0x3705c2[_0x4958('0x2a')],_0x3705c2[_0x4958('0x2b')]);_0x4b821e[_0x4958('0x2c')]=_[_0x4958('0x2d')](_0x3705c2[_0x4958('0x2a')],qs[_0x4958('0x2e')](_0x272f4f[_0x4958('0x2b')][_0x4958('0x2e')]));_0x4b821e[_0x4958('0x2c')]=_0x4b821e[_0x4958('0x2c')]['length']?_0x4b821e[_0x4958('0x2c')]:_0x3705c2[_0x4958('0x2a')];_0x4b821e['order']=qs[_0x4958('0x32')](_0x272f4f[_0x4958('0x2b')][_0x4958('0x32')]);_0x4b821e[_0x4958('0x33')]=qs[_0x4958('0x34')](_[_0x4958('0x35')](_0x272f4f[_0x4958('0x2b')],_0x3705c2['filters']));if(_0x272f4f['query'][_0x4958('0x36')]){_0x4b821e[_0x4958('0x33')]=_[_0x4958('0x37')](_0x4b821e[_0x4958('0x33')],{'$or':_[_0x4958('0x24')](_0x4b821e[_0x4958('0x2c')],function(_0x2ccfcd){var _0x471a76={};_0x471a76[_0x2ccfcd]={'$like':'%'+_0x272f4f[_0x4958('0x2b')]['filter']+'%'};return _0x471a76;})});}_0x4b821e=_['merge']({},_0x4b821e,_0x272f4f[_0x4958('0x3e')]);return _0x5af6be[_0x4958('0x45')](_0x4b821e);}})[_0x4958('0x1f')](function(_0x45c51c){if(_0x45c51c){_0x2f9aed=_0x45c51c[_0x4958('0x2f')];if(!_0x272f4f[_0x4958('0x2b')][_0x4958('0x30')](_0x4958('0x31'))){_0x4b821e[_0x4958('0x17')]=qs[_0x4958('0x17')](_0x272f4f[_0x4958('0x2b')][_0x4958('0x17')]);_0x4b821e[_0x4958('0x15')]=qs[_0x4958('0x15')](_0x272f4f[_0x4958('0x2b')][_0x4958('0x15')]);}return _0x5af6be[_0x4958('0x45')](_0x4b821e);}})[_0x4958('0x1f')](function(_0x1ae1db){if(_0x1ae1db){return _0x1ae1db?{'count':_0x2f9aed,'rows':_0x1ae1db}:null;}})[_0x4958('0x1f')](respondWithResult(_0x1c3841,null))[_0x4958('0x3b')](handleError(_0x1c3841,null));};exports['addConfiguration']=function(_0x2e6b74,_0x567734,_0x54bfcb){if(_0x2e6b74[_0x4958('0x41')]['id']){delete _0x2e6b74[_0x4958('0x41')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x2e6b74[_0x4958('0x43')]['id']}})[_0x4958('0x1f')](handleEntityNotFound(_0x567734,null))['then'](function(_0x382843){if(_0x382843){_0x2e6b74[_0x4958('0x41')][_0x4958('0x46')]=_0x382843['id'];_0x2e6b74[_0x4958('0x41')][_0x4958('0x47')]=integrations['getSubjects'](_0x2e6b74[_0x4958('0x41')][_0x4958('0x48')],_0x2e6b74[_0x4958('0x41')][_0x4958('0x28')]);_0x2e6b74[_0x4958('0x41')][_0x4958('0x49')]=integrations[_0x4958('0x4a')](_0x2e6b74[_0x4958('0x41')]['channel'],_0x2e6b74['body'][_0x4958('0x28')]);return db[_0x4958('0x44')][_0x4958('0x40')](_0x2e6b74[_0x4958('0x41')],{'include':[{'model':db[_0x4958('0x4b')],'as':_0x4958('0x47')},{'model':db[_0x4958('0x4b')],'as':_0x4958('0x49')}]});}return null;})[_0x4958('0x1f')](respondWithResult(_0x567734,null))[_0x4958('0x3b')](handleError(_0x567734,null));};exports['getFields']=function(_0x538f8a,_0x1dbea2,_0x27325a){var _0xf2a05;var _0x19119b='';var _0x5b0900='Task';return db[_0x4958('0x25')]['findOne']({'where':{'id':_0x538f8a['params']['id']},'attributes':['id',_0x4958('0x4c'),'clientId',_0x4958('0x4d'),'username',_0x4958('0x4e'),'securityToken']})['then'](handleEntityNotFound(_0x1dbea2,null))[_0x4958('0x1f')](function(_0x579b9f){if(_0x579b9f){_0x19119b=_0x579b9f[_0x4958('0x4c')];var _0x516c4f=_0x19119b[_0x4958('0x4f')](-0x1);if(_0x516c4f==='/'){_0x19119b=_0x19119b[_0x4958('0x50')](0x0,_0x19119b['lastIndexOf'](_0x516c4f));}_0xf2a05=new jsforce['Connection']({'oauth2':{'loginUrl':_0x19119b,'clientId':_0x579b9f['clientId'],'clientSecret':_0x579b9f[_0x4958('0x4d')]}});return _0xf2a05[_0x4958('0x51')](_0x579b9f[_0x4958('0x52')],_0x579b9f[_0x4958('0x4e')]['concat'](_0x579b9f[_0x4958('0x53')]));}})[_0x4958('0x1f')](function(_0x2d51d1){if(_0x2d51d1){if(!_['isNil'](_0x538f8a[_0x4958('0x2b')][_0x4958('0x54')])){_0x5b0900=_0x538f8a['query']['ticketType'];}return _0xf2a05[_0x4958('0x55')](_0x5b0900)[_0x4958('0x56')]();}})[_0x4958('0x1f')](function(_0x61e399){var _0x3b5d77=['OwnerId',_0x4958('0x57'),_0x4958('0x58'),_0x4958('0x59'),_0x4958('0x5a'),'Description'];var _0x5bf9fa=[_0x4958('0x5b'),_0x4958('0x5c'),_0x4958('0x5d'),_0x4958('0x5e'),_0x4958('0x5f'),_0x4958('0x60'),_0x4958('0x61')];if(_0x61e399){_['remove'](_0x61e399['fields'],function(_0x413eda){return _0x3b5d77[_0x4958('0x62')](_0x413eda['name'])||!_0x5bf9fa[_0x4958('0x62')](_0x413eda[_0x4958('0x28')]);});return{'count':_0x61e399[_0x4958('0x2e')][_0x4958('0x2f')],'rows':_[_0x4958('0x24')](_0x61e399['fields'],function(_0x3bdccc){return{'id':_0x3bdccc[_0x4958('0x22')],'name':_0x3bdccc['label'],'custom':_0x3bdccc[_0x4958('0x63')],'options':_0x3bdccc['picklistValues'][_0x4958('0x2f')]>0x0?_[_0x4958('0x24')](_0x3bdccc[_0x4958('0x64')],function(_0x43ef8f){return{'name':_0x43ef8f[_0x4958('0x65')],'value':_0x43ef8f[_0x4958('0x66')]};}):_0x3bdccc['type']=='boolean'?[{'name':_0x4958('0x67'),'value':_0x4958('0x68')},{'name':_0x4958('0x69'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x1dbea2,null))[_0x4958('0x3b')](function(_0x54250a){var _0x16ae2f=_0x538f8a[_0x4958('0x2b')][_0x4958('0x6a')]?0x1f4:_0x54250a[_0x4958('0x6b')]||0x1f4;logger[_0x4958('0x21')](_0x4958('0x6c'),_0x4958('0x6d'),_0x16ae2f,JSON[_0x4958('0x6e')](_0x54250a));delete _0x54250a[_0x4958('0x22')];if(_0x16ae2f===0x191){_0x16ae2f=0x190;}_0x1dbea2[_0x4958('0x19')](_0x16ae2f)['send'](_0x538f8a[_0x4958('0x2b')][_0x4958('0x6a')]?{'message':_0x4958('0x6f'),'statusCode':_0x54250a['statusCode']}:_0x54250a);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4ad24df..363ffd9 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 _0x5f89=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','lodash','../../config/logger','request-promise'];(function(_0x559ae3,_0x259e00){var _0x3edef1=function(_0x260214){while(--_0x260214){_0x559ae3['push'](_0x559ae3['shift']());}};_0x3edef1(++_0x259e00);}(_0x5f89,0xc5));var _0x95f8=function(_0x424c25,_0x247426){_0x424c25=_0x424c25-0x0;var _0x3860db=_0x5f89[_0x424c25];return _0x3860db;};'use strict';var _=require(_0x95f8('0x0'));var util=require('util');var logger=require(_0x95f8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x95f8('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95f8('0x3'));var config=require(_0x95f8('0x4'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x95f8('0x5'));module[_0x95f8('0x6')]=function(_0x48d222,_0x4cdc49){return _0x48d222[_0x95f8('0x7')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9ad=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts'];(function(_0x55f90d,_0x526fbd){var _0x5082c9=function(_0x124a16){while(--_0x124a16){_0x55f90d['push'](_0x55f90d['shift']());}};_0x5082c9(++_0x526fbd);}(_0xe9ad,0x82));var _0xde9a=function(_0x1e11c2,_0x1bcbca){_0x1e11c2=_0x1e11c2-0x0;var _0x4faa44=_0xe9ad[_0x1e11c2];return _0x4faa44;};'use strict';var _=require(_0xde9a('0x0'));var util=require(_0xde9a('0x1'));var logger=require(_0xde9a('0x2'))(_0xde9a('0x3'));var moment=require(_0xde9a('0x4'));var BPromise=require(_0xde9a('0x5'));var rp=require(_0xde9a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde9a('0x7'));var config=require(_0xde9a('0x8'));var attributes=require(_0xde9a('0x9'));var integrations=require(_0xde9a('0xa'));module['exports']=function(_0x27b380,_0x2bb666){return _0x27b380[_0xde9a('0xb')]('SalesforceAccount',attributes,{'tableName':_0xde9a('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 246b175..a2f8760 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 _0xc398=['SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model','catch','ShowSalesforceAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x749cda,_0x2fa732){var _0x1a9c7d=function(_0x487c75){while(--_0x487c75){_0x749cda['push'](_0x749cda['shift']());}};_0x1a9c7d(++_0x2fa732);}(_0xc398,0x98));var _0x8c39=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0xc398[_0x16dbfd];return _0x382254;};'use strict';var _=require('lodash');var util=require(_0x8c39('0x0'));var moment=require(_0x8c39('0x1'));var BPromise=require(_0x8c39('0x2'));var rs=require(_0x8c39('0x3'));var fs=require('fs');var Redis=require(_0x8c39('0x4'));var db=require(_0x8c39('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c39('0x6'))(_0x8c39('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c39('0x8'));var client=jayson['client'][_0x8c39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39bbc0,_0x2564ff,_0x33f3c3){return new BPromise(function(_0x5a9d6d,_0x20af3c){return client[_0x8c39('0xa')](_0x39bbc0,_0x33f3c3)[_0x8c39('0xb')](function(_0x3a2b23){logger[_0x8c39('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x2564ff,_0x8c39('0xd'));logger[_0x8c39('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2564ff,_0x8c39('0xd'),JSON[_0x8c39('0xf')](_0x3a2b23));if(_0x3a2b23[_0x8c39('0x10')]){if(_0x3a2b23[_0x8c39('0x10')][_0x8c39('0x11')]===0x1f4){logger[_0x8c39('0x10')](_0x8c39('0x12'),_0x2564ff,_0x3a2b23[_0x8c39('0x10')]['message']);return _0x20af3c(_0x3a2b23[_0x8c39('0x10')][_0x8c39('0x13')]);}logger[_0x8c39('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x2564ff,_0x3a2b23['error'][_0x8c39('0x13')]);return _0x5a9d6d(_0x3a2b23['error'][_0x8c39('0x13')]);}else{logger[_0x8c39('0xc')](_0x8c39('0x12'),_0x2564ff,'request\x20sent');_0x5a9d6d(_0x3a2b23[_0x8c39('0x14')][_0x8c39('0x13')]);}})['catch'](function(_0x14e1df){logger[_0x8c39('0x10')](_0x8c39('0x12'),_0x2564ff,_0x14e1df);_0x20af3c(_0x14e1df);});});}exports[_0x8c39('0x15')]=function(_0x350b96){var _0x25568f=this;return new Promise(function(_0x533c66,_0xc6c073){return db[_0x8c39('0x16')]['findAll']({'raw':_0x350b96[_0x8c39('0x17')]?_0x350b96[_0x8c39('0x17')][_0x8c39('0x18')]===undefined?!![]:![]:!![],'where':_0x350b96[_0x8c39('0x17')]?_0x350b96[_0x8c39('0x17')]['where']||null:null,'attributes':_0x350b96[_0x8c39('0x17')]?_0x350b96[_0x8c39('0x17')][_0x8c39('0x19')]||null:null,'limit':_0x350b96['options']?_0x350b96[_0x8c39('0x17')][_0x8c39('0x1a')]||null:null,'include':_0x350b96['options']?_0x350b96[_0x8c39('0x17')][_0x8c39('0x1b')]?_[_0x8c39('0x1c')](_0x350b96['options'][_0x8c39('0x1b')],function(_0x51108b){return{'model':db[_0x51108b[_0x8c39('0x1d')]],'as':_0x51108b['as'],'attributes':_0x51108b[_0x8c39('0x19')],'include':_0x51108b['include']?_['map'](_0x51108b[_0x8c39('0x1b')],function(_0x472f12){return{'model':db[_0x472f12[_0x8c39('0x1d')]],'as':_0x472f12['as'],'attributes':_0x472f12[_0x8c39('0x19')],'include':_0x472f12[_0x8c39('0x1b')]?_[_0x8c39('0x1c')](_0x472f12[_0x8c39('0x1b')],function(_0x26e610){return{'model':db[_0x26e610['model']],'as':_0x26e610['as'],'attributes':_0x26e610[_0x8c39('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8c39('0xb')](function(_0x36910c){logger['info'](_0x8c39('0x15'),_0x350b96);logger[_0x8c39('0xe')](_0x8c39('0x15'),_0x350b96,JSON['stringify'](_0x36910c));_0x533c66(_0x36910c);})[_0x8c39('0x1e')](function(_0x3aacd0){logger['error']('GetSalesforceAccount',_0x3aacd0[_0x8c39('0x13')],_0x350b96);_0xc6c073(_0x25568f[_0x8c39('0x10')](0x1f4,_0x3aacd0[_0x8c39('0x13')]));});});};exports[_0x8c39('0x1f')]=function(_0x4880cc){var _0x492278=this;return new Promise(function(_0x276b67,_0x3de218){return db['SalesforceAccount'][_0x8c39('0x20')]({'raw':_0x4880cc[_0x8c39('0x17')]?_0x4880cc['options'][_0x8c39('0x18')]===undefined?!![]:![]:!![],'where':_0x4880cc[_0x8c39('0x17')]?_0x4880cc[_0x8c39('0x17')][_0x8c39('0x21')]||null:null,'attributes':_0x4880cc['options']?_0x4880cc[_0x8c39('0x17')][_0x8c39('0x19')]||null:null,'include':_0x4880cc[_0x8c39('0x17')]?_0x4880cc['options']['include']?_['map'](_0x4880cc[_0x8c39('0x17')]['include'],function(_0xd37428){return{'model':db[_0xd37428[_0x8c39('0x1d')]],'as':_0xd37428['as'],'attributes':_0xd37428[_0x8c39('0x19')],'include':_0xd37428[_0x8c39('0x1b')]?_[_0x8c39('0x1c')](_0xd37428['include'],function(_0x2be4d8){return{'model':db[_0x2be4d8[_0x8c39('0x1d')]],'as':_0x2be4d8['as'],'attributes':_0x2be4d8[_0x8c39('0x19')],'include':_0x2be4d8['include']?_[_0x8c39('0x1c')](_0x2be4d8[_0x8c39('0x1b')],function(_0x140db7){return{'model':db[_0x140db7[_0x8c39('0x1d')]],'as':_0x140db7['as'],'attributes':_0x140db7[_0x8c39('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8c39('0xb')](function(_0x7c808f){logger[_0x8c39('0xc')]('ShowSalesforceAccount',_0x4880cc);logger[_0x8c39('0xe')]('ShowSalesforceAccount',_0x4880cc,JSON['stringify'](_0x7c808f));_0x276b67(_0x7c808f);})[_0x8c39('0x1e')](function(_0x1f164c){logger[_0x8c39('0x10')](_0x8c39('0x1f'),_0x1f164c[_0x8c39('0x13')],_0x4880cc);_0x3de218(_0x492278[_0x8c39('0x10')](0x1f4,_0x1f164c[_0x8c39('0x13')]));});});}; \ No newline at end of file +var _0xcb97=['model','ShowSalesforceAccount','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','include','map'];(function(_0x368a12,_0x501ede){var _0x16dfc8=function(_0x34f0d3){while(--_0x34f0d3){_0x368a12['push'](_0x368a12['shift']());}};_0x16dfc8(++_0x501ede);}(_0xcb97,0x157));var _0x7cb9=function(_0x4a4509,_0x53449d){_0x4a4509=_0x4a4509-0x0;var _0x10c0b3=_0xcb97[_0x4a4509];return _0x10c0b3;};'use strict';var _=require(_0x7cb9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7cb9('0x1'));var rs=require(_0x7cb9('0x2'));var fs=require('fs');var Redis=require(_0x7cb9('0x3'));var db=require(_0x7cb9('0x4'))['db'];var utils=require(_0x7cb9('0x5'));var logger=require(_0x7cb9('0x6'))(_0x7cb9('0x7'));var config=require(_0x7cb9('0x8'));var jayson=require(_0x7cb9('0x9'));var client=jayson[_0x7cb9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x565641,_0x4e8fb2,_0x4ff3f7){return new BPromise(function(_0xb6755f,_0x1d575a){return client[_0x7cb9('0xb')](_0x565641,_0x4ff3f7)[_0x7cb9('0xc')](function(_0x3f9898){logger['info'](_0x7cb9('0xd'),_0x4e8fb2,'request\x20sent');logger[_0x7cb9('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4e8fb2,'request\x20sent',JSON[_0x7cb9('0xf')](_0x3f9898));if(_0x3f9898[_0x7cb9('0x10')]){if(_0x3f9898['error'][_0x7cb9('0x11')]===0x1f4){logger[_0x7cb9('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4e8fb2,_0x3f9898[_0x7cb9('0x10')][_0x7cb9('0x12')]);return _0x1d575a(_0x3f9898[_0x7cb9('0x10')][_0x7cb9('0x12')]);}logger[_0x7cb9('0x10')](_0x7cb9('0xd'),_0x4e8fb2,_0x3f9898['error'][_0x7cb9('0x12')]);return _0xb6755f(_0x3f9898[_0x7cb9('0x10')][_0x7cb9('0x12')]);}else{logger[_0x7cb9('0x13')](_0x7cb9('0xd'),_0x4e8fb2,_0x7cb9('0x14'));_0xb6755f(_0x3f9898[_0x7cb9('0x15')][_0x7cb9('0x12')]);}})['catch'](function(_0x76fdd1){logger['error'](_0x7cb9('0xd'),_0x4e8fb2,_0x76fdd1);_0x1d575a(_0x76fdd1);});});}exports[_0x7cb9('0x16')]=function(_0x40cb52){var _0x4537ff=this;return new Promise(function(_0x309152,_0x71687b){return db[_0x7cb9('0x17')][_0x7cb9('0x18')]({'raw':_0x40cb52[_0x7cb9('0x19')]?_0x40cb52[_0x7cb9('0x19')][_0x7cb9('0x1a')]===undefined?!![]:![]:!![],'where':_0x40cb52[_0x7cb9('0x19')]?_0x40cb52['options'][_0x7cb9('0x1b')]||null:null,'attributes':_0x40cb52[_0x7cb9('0x19')]?_0x40cb52[_0x7cb9('0x19')][_0x7cb9('0x1c')]||null:null,'limit':_0x40cb52[_0x7cb9('0x19')]?_0x40cb52['options']['limit']||null:null,'include':_0x40cb52[_0x7cb9('0x19')]?_0x40cb52[_0x7cb9('0x19')][_0x7cb9('0x1d')]?_[_0x7cb9('0x1e')](_0x40cb52[_0x7cb9('0x19')]['include'],function(_0x40059a){return{'model':db[_0x40059a[_0x7cb9('0x1f')]],'as':_0x40059a['as'],'attributes':_0x40059a[_0x7cb9('0x1c')],'include':_0x40059a[_0x7cb9('0x1d')]?_[_0x7cb9('0x1e')](_0x40059a['include'],function(_0x4c78e0){return{'model':db[_0x4c78e0['model']],'as':_0x4c78e0['as'],'attributes':_0x4c78e0[_0x7cb9('0x1c')],'include':_0x4c78e0[_0x7cb9('0x1d')]?_[_0x7cb9('0x1e')](_0x4c78e0['include'],function(_0x5d4924){return{'model':db[_0x5d4924[_0x7cb9('0x1f')]],'as':_0x5d4924['as'],'attributes':_0x5d4924[_0x7cb9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7cb9('0xc')](function(_0x2f5d3f){logger[_0x7cb9('0x13')](_0x7cb9('0x16'),_0x40cb52);logger[_0x7cb9('0xe')](_0x7cb9('0x16'),_0x40cb52,JSON[_0x7cb9('0xf')](_0x2f5d3f));_0x309152(_0x2f5d3f);})['catch'](function(_0x542ac6){logger[_0x7cb9('0x10')]('GetSalesforceAccount',_0x542ac6[_0x7cb9('0x12')],_0x40cb52);_0x71687b(_0x4537ff[_0x7cb9('0x10')](0x1f4,_0x542ac6['message']));});});};exports[_0x7cb9('0x20')]=function(_0x485f52){var _0x5e241f=this;return new Promise(function(_0x168e15,_0x520766){return db[_0x7cb9('0x17')]['find']({'raw':_0x485f52['options']?_0x485f52[_0x7cb9('0x19')][_0x7cb9('0x1a')]===undefined?!![]:![]:!![],'where':_0x485f52[_0x7cb9('0x19')]?_0x485f52[_0x7cb9('0x19')][_0x7cb9('0x1b')]||null:null,'attributes':_0x485f52[_0x7cb9('0x19')]?_0x485f52[_0x7cb9('0x19')][_0x7cb9('0x1c')]||null:null,'include':_0x485f52[_0x7cb9('0x19')]?_0x485f52[_0x7cb9('0x19')]['include']?_[_0x7cb9('0x1e')](_0x485f52[_0x7cb9('0x19')][_0x7cb9('0x1d')],function(_0x31ea09){return{'model':db[_0x31ea09[_0x7cb9('0x1f')]],'as':_0x31ea09['as'],'attributes':_0x31ea09['attributes'],'include':_0x31ea09[_0x7cb9('0x1d')]?_['map'](_0x31ea09['include'],function(_0x263460){return{'model':db[_0x263460[_0x7cb9('0x1f')]],'as':_0x263460['as'],'attributes':_0x263460[_0x7cb9('0x1c')],'include':_0x263460[_0x7cb9('0x1d')]?_['map'](_0x263460[_0x7cb9('0x1d')],function(_0x5eba21){return{'model':db[_0x5eba21['model']],'as':_0x5eba21['as'],'attributes':_0x5eba21['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3115f9){logger[_0x7cb9('0x13')](_0x7cb9('0x20'),_0x485f52);logger[_0x7cb9('0xe')](_0x7cb9('0x20'),_0x485f52,JSON[_0x7cb9('0xf')](_0x3115f9));_0x168e15(_0x3115f9);})[_0x7cb9('0x21')](function(_0x154c26){logger[_0x7cb9('0x10')]('ShowSalesforceAccount',_0x154c26[_0x7cb9('0x12')],_0x485f52);_0x520766(_0x5e241f[_0x7cb9('0x10')](0x1f4,_0x154c26[_0x7cb9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ee6fb1c..68f141e 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(_0x374fbb,_0x18e2c8){var _0x583daf=function(_0x134630){while(--_0x134630){_0x374fbb['push'](_0x374fbb['shift']());}};_0x583daf(++_0x18e2c8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x27c9ba,_0x303994){_0x27c9ba=_0x27c9ba-0x0;var _0x472b32=_0x5f2f[_0x27c9ba];return _0x472b32;};'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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x23b5bb,_0x4644eb){var _0x2d2420=function(_0x36c15f){while(--_0x36c15f){_0x23b5bb['push'](_0x23b5bb['shift']());}};_0x2d2420(++_0x4644eb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 3af4981..6bc0cc4 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 _0xdb1f=['STRING','ENUM','Task','contact_lead','lead','account_contact_lead','account','nothing','contact','exports'];(function(_0x22d86c,_0x33d0e9){var _0x341f89=function(_0x5333c0){while(--_0x5333c0){_0x22d86c['push'](_0x22d86c['shift']());}};_0x341f89(++_0x33d0e9);}(_0xdb1f,0x81));var _0xfdb1=function(_0x5bb459,_0x415140){_0x5bb459=_0x5bb459-0x0;var _0xeb5628=_0xdb1f[_0x5bb459];return _0xeb5628;};'use strict';var Sequelize=require('sequelize');module[_0xfdb1('0x0')]={'name':{'type':Sequelize[_0xfdb1('0x1')]},'description':{'type':Sequelize[_0xfdb1('0x1')]},'ticketType':{'type':Sequelize[_0xfdb1('0x2')](_0xfdb1('0x3'),'Case'),'defaultValue':_0xfdb1('0x3')},'moduleSearch':{'type':Sequelize[_0xfdb1('0x2')](_0xfdb1('0x4'),'contact',_0xfdb1('0x5'),_0xfdb1('0x6'),_0xfdb1('0x7')),'defaultValue':_0xfdb1('0x4')},'moduleCreate':{'type':Sequelize[_0xfdb1('0x2')](_0xfdb1('0x8'),_0xfdb1('0x9'),_0xfdb1('0x5'),_0xfdb1('0x7')),'defaultValue':_0xfdb1('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xfdb1('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xfdb1('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf41f=['account','exports','STRING','ENUM','contact_lead','contact','lead','account_contact_lead'];(function(_0x28d9c8,_0x3ba265){var _0x4d251f=function(_0x599d90){while(--_0x599d90){_0x28d9c8['push'](_0x28d9c8['shift']());}};_0x4d251f(++_0x3ba265);}(_0xf41f,0x79));var _0xff41=function(_0x422345,_0x4e4c07){_0x422345=_0x422345-0x0;var _0x1f8f59=_0xf41f[_0x422345];return _0x1f8f59;};'use strict';var Sequelize=require('sequelize');module[_0xff41('0x0')]={'name':{'type':Sequelize[_0xff41('0x1')]},'description':{'type':Sequelize[_0xff41('0x1')]},'ticketType':{'type':Sequelize[_0xff41('0x2')]('Task','Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xff41('0x2')](_0xff41('0x3'),_0xff41('0x4'),_0xff41('0x5'),_0xff41('0x6'),_0xff41('0x7')),'defaultValue':_0xff41('0x3')},'moduleCreate':{'type':Sequelize[_0xff41('0x2')]('nothing',_0xff41('0x4'),_0xff41('0x5'),_0xff41('0x7')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xff41('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xff41('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4a66c44..f4b7d90 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 _0xfa57=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','create','body','find','params','findOne','keys','getFields','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4e198a,_0x5a6bad){var _0xb84bfe=function(_0x58d2b2){while(--_0x58d2b2){_0x4e198a['push'](_0x4e198a['shift']());}};_0xb84bfe(++_0x5a6bad);}(_0xfa57,0xe6));var _0x7fa5=function(_0x1bfc1b,_0x33597b){_0x1bfc1b=_0x1bfc1b-0x0;var _0xe113f3=_0xfa57[_0x1bfc1b];return _0xe113f3;};'use strict';var emlformat=require(_0x7fa5('0x0'));var rimraf=require(_0x7fa5('0x1'));var zipdir=require(_0x7fa5('0x2'));var jsonpatch=require(_0x7fa5('0x3'));var rp=require(_0x7fa5('0x4'));var moment=require(_0x7fa5('0x5'));var BPromise=require(_0x7fa5('0x6'));var Mustache=require('mustache');var util=require(_0x7fa5('0x7'));var path=require(_0x7fa5('0x8'));var sox=require(_0x7fa5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fa5('0xa'));var squel=require(_0x7fa5('0xb'));var crypto=require(_0x7fa5('0xc'));var jsforce=require(_0x7fa5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7fa5('0xe'));var querystring=require(_0x7fa5('0xf'));var Papa=require(_0x7fa5('0x10'));var Redis=require(_0x7fa5('0x11'));var authService=require(_0x7fa5('0x12'));var qs=require(_0x7fa5('0x13'));var as=require(_0x7fa5('0x14'));var hardwareService=require(_0x7fa5('0x15'));var logger=require(_0x7fa5('0x16'))(_0x7fa5('0x17'));var utils=require(_0x7fa5('0x18'));var config=require(_0x7fa5('0x19'));var licenseUtil=require(_0x7fa5('0x1a'));var db=require(_0x7fa5('0x1b'))['db'];function respondWithStatusCode(_0x1a5a38,_0x5473b6){_0x5473b6=_0x5473b6||0xcc;return function(_0x23cb6d){if(_0x23cb6d){return _0x1a5a38['sendStatus'](_0x5473b6);}return _0x1a5a38[_0x7fa5('0x1c')](_0x5473b6)[_0x7fa5('0x1d')]();};}function respondWithResult(_0x319eef,_0x591a74){_0x591a74=_0x591a74||0xc8;return function(_0x376547){if(_0x376547){return _0x319eef[_0x7fa5('0x1c')](_0x591a74)[_0x7fa5('0x1e')](_0x376547);}};}function respondWithFilteredResult(_0x422a2f,_0x194a65){return function(_0x20c49f){if(_0x20c49f){var _0x4e6713=typeof _0x194a65[_0x7fa5('0x1f')]===_0x7fa5('0x20')&&typeof _0x194a65[_0x7fa5('0x21')]==='undefined';var _0x226214=_0x20c49f[_0x7fa5('0x22')];var _0x3f2b34=_0x4e6713?0x0:_0x194a65['offset'];var _0x287aa4=_0x4e6713?_0x20c49f[_0x7fa5('0x22')]:_0x194a65[_0x7fa5('0x1f')]+_0x194a65[_0x7fa5('0x21')];var _0x29a519;if(_0x287aa4>=_0x226214){_0x287aa4=_0x226214;_0x29a519=0xc8;}else{_0x29a519=0xce;}_0x422a2f[_0x7fa5('0x1c')](_0x29a519);return _0x422a2f[_0x7fa5('0x23')](_0x7fa5('0x24'),_0x3f2b34+'-'+_0x287aa4+'/'+_0x226214)[_0x7fa5('0x1e')](_0x20c49f);}return null;};}function patchUpdates(_0x49400c){return function(_0x12c41a){try{jsonpatch[_0x7fa5('0x25')](_0x12c41a,_0x49400c,!![]);}catch(_0x2a681c){return BPromise[_0x7fa5('0x26')](_0x2a681c);}return _0x12c41a[_0x7fa5('0x27')]();};}function saveUpdates(_0x10e343,_0x276820){return function(_0x219037){if(_0x219037){return _0x219037[_0x7fa5('0x28')](_0x10e343)[_0x7fa5('0x29')](function(_0x8ba218){return _0x8ba218;});}return null;};}function removeEntity(_0x31366f,_0x1d988f){return function(_0x32c3d2){if(_0x32c3d2){return _0x32c3d2[_0x7fa5('0x2a')]()[_0x7fa5('0x29')](function(){_0x31366f[_0x7fa5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e1df1,_0x1e0efb){return function(_0x6fde3c){if(!_0x6fde3c){_0x3e1df1[_0x7fa5('0x2b')](0x194);}return _0x6fde3c;};}function handleError(_0x12541c,_0x496bf3){_0x496bf3=_0x496bf3||0x1f4;return function(_0x42a554){logger['error'](_0x42a554[_0x7fa5('0x2c')]);if(_0x42a554[_0x7fa5('0x2d')]){delete _0x42a554[_0x7fa5('0x2d')];}_0x12541c[_0x7fa5('0x1c')](_0x496bf3)['send'](_0x42a554);};}exports[_0x7fa5('0x2e')]=function(_0x126e92,_0x427b6a){var _0x3f9a88={},_0x4956f5={},_0x3e3560={'count':0x0,'rows':[]};var _0x520d10=_[_0x7fa5('0x2f')](db[_0x7fa5('0x30')][_0x7fa5('0x31')],function(_0x561b70){return{'name':_0x561b70[_0x7fa5('0x32')],'type':_0x561b70[_0x7fa5('0x33')][_0x7fa5('0x34')]};});_0x4956f5['model']=_[_0x7fa5('0x2f')](_0x520d10,'name');_0x4956f5[_0x7fa5('0x35')]=_['keys'](_0x126e92[_0x7fa5('0x35')]);_0x4956f5[_0x7fa5('0x36')]=_[_0x7fa5('0x37')](_0x4956f5[_0x7fa5('0x38')],_0x4956f5[_0x7fa5('0x35')]);_0x3f9a88[_0x7fa5('0x39')]=_['intersection'](_0x4956f5[_0x7fa5('0x38')],qs[_0x7fa5('0x3a')](_0x126e92['query'][_0x7fa5('0x3a')]));_0x3f9a88[_0x7fa5('0x39')]=_0x3f9a88[_0x7fa5('0x39')][_0x7fa5('0x3b')]?_0x3f9a88['attributes']:_0x4956f5[_0x7fa5('0x38')];if(!_0x126e92['query'][_0x7fa5('0x3c')](_0x7fa5('0x3d'))){_0x3f9a88['limit']=qs[_0x7fa5('0x21')](_0x126e92['query']['limit']);_0x3f9a88[_0x7fa5('0x1f')]=qs[_0x7fa5('0x1f')](_0x126e92[_0x7fa5('0x35')]['offset']);}_0x3f9a88[_0x7fa5('0x3e')]=qs[_0x7fa5('0x3f')](_0x126e92['query'][_0x7fa5('0x3f')]);_0x3f9a88[_0x7fa5('0x40')]=qs['filters'](_[_0x7fa5('0x41')](_0x126e92[_0x7fa5('0x35')],_0x4956f5['filters']),_0x520d10);if(_0x126e92[_0x7fa5('0x35')][_0x7fa5('0x42')]){_0x3f9a88[_0x7fa5('0x40')]=_[_0x7fa5('0x43')](_0x3f9a88[_0x7fa5('0x40')],{'$or':_[_0x7fa5('0x2f')](_0x520d10,function(_0x3ece2f){if(_0x3ece2f[_0x7fa5('0x33')]!=='VIRTUAL'){var _0x8794ac={};_0x8794ac[_0x3ece2f[_0x7fa5('0x2d')]]={'$like':'%'+_0x126e92[_0x7fa5('0x35')][_0x7fa5('0x42')]+'%'};return _0x8794ac;}})});}_0x3f9a88=_[_0x7fa5('0x43')]({},_0x3f9a88,_0x126e92[_0x7fa5('0x44')]);var _0x508308={'where':_0x3f9a88[_0x7fa5('0x40')]};return db[_0x7fa5('0x30')][_0x7fa5('0x22')](_0x508308)['then'](function(_0x39835d){_0x3e3560[_0x7fa5('0x22')]=_0x39835d;if(_0x126e92['query'][_0x7fa5('0x45')]){_0x3f9a88[_0x7fa5('0x46')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x7fa5('0x47')](_0x3f9a88);})[_0x7fa5('0x29')](function(_0x14df19){_0x3e3560[_0x7fa5('0x48')]=_0x14df19;return _0x3e3560;})[_0x7fa5('0x29')](respondWithFilteredResult(_0x427b6a,_0x3f9a88))[_0x7fa5('0x49')](handleError(_0x427b6a,null));};exports['show']=function(_0x3fab2c,_0x2b036e){var _0x367c28={'raw':![],'where':{'id':_0x3fab2c['params']['id']}},_0x5f40f9={};_0x5f40f9['model']=_['keys'](db[_0x7fa5('0x30')][_0x7fa5('0x31')]);_0x5f40f9['query']=_['keys'](_0x3fab2c[_0x7fa5('0x35')]);_0x5f40f9[_0x7fa5('0x36')]=_['intersection'](_0x5f40f9['model'],_0x5f40f9[_0x7fa5('0x35')]);_0x367c28[_0x7fa5('0x39')]=_[_0x7fa5('0x37')](_0x5f40f9[_0x7fa5('0x38')],qs[_0x7fa5('0x3a')](_0x3fab2c[_0x7fa5('0x35')][_0x7fa5('0x3a')]));_0x367c28[_0x7fa5('0x39')]=_0x367c28[_0x7fa5('0x39')][_0x7fa5('0x3b')]?_0x367c28[_0x7fa5('0x39')]:_0x5f40f9['model'];if(_0x3fab2c[_0x7fa5('0x35')][_0x7fa5('0x45')]){_0x367c28['include']=[{'all':!![]}];}_0x367c28=_['merge']({},_0x367c28,_0x3fab2c[_0x7fa5('0x44')]);return db['SalesforceConfiguration']['find'](_0x367c28)['then'](handleEntityNotFound(_0x2b036e,null))['then'](respondWithResult(_0x2b036e,null))[_0x7fa5('0x49')](handleError(_0x2b036e,null));};exports[_0x7fa5('0x4a')]=function(_0x850aa9,_0x10299c){return db[_0x7fa5('0x30')][_0x7fa5('0x4a')](_0x850aa9[_0x7fa5('0x4b')],{})[_0x7fa5('0x29')](respondWithResult(_0x10299c,0xc9))['catch'](handleError(_0x10299c,null));};exports['update']=function(_0x40273d,_0x57948f){if(_0x40273d[_0x7fa5('0x4b')]['id']){delete _0x40273d['body']['id'];}return db[_0x7fa5('0x30')][_0x7fa5('0x4c')]({'where':{'id':_0x40273d[_0x7fa5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x57948f,null))['then'](saveUpdates(_0x40273d[_0x7fa5('0x4b')],null))[_0x7fa5('0x29')](respondWithResult(_0x57948f,null))[_0x7fa5('0x49')](handleError(_0x57948f,null));};exports[_0x7fa5('0x2a')]=function(_0x1e1a9f,_0x3bbf45){return db[_0x7fa5('0x30')][_0x7fa5('0x4c')]({'where':{'id':_0x1e1a9f[_0x7fa5('0x4d')]['id']}})[_0x7fa5('0x29')](handleEntityNotFound(_0x3bbf45,null))[_0x7fa5('0x29')](removeEntity(_0x3bbf45,null))[_0x7fa5('0x49')](handleError(_0x3bbf45,null));};exports['getFields']=function(_0x21ec6d,_0x2b6d7c,_0x3e9768){var _0x155a6d={};var _0x45babf={};var _0x5cf083;var _0x117ac7;return db[_0x7fa5('0x30')][_0x7fa5('0x4e')]({'where':{'id':_0x21ec6d[_0x7fa5('0x4d')]['id']}})[_0x7fa5('0x29')](handleEntityNotFound(_0x2b6d7c,null))[_0x7fa5('0x29')](function(_0x4a9381){if(_0x4a9381){_0x5cf083=_0x4a9381;_0x45babf[_0x7fa5('0x38')]=_[_0x7fa5('0x4f')](db['SalesforceField'][_0x7fa5('0x31')]);_0x45babf[_0x7fa5('0x35')]=_['keys'](_0x21ec6d[_0x7fa5('0x35')]);_0x45babf[_0x7fa5('0x36')]=_['intersection'](_0x45babf[_0x7fa5('0x38')],_0x45babf['query']);_0x155a6d[_0x7fa5('0x39')]=_['intersection'](_0x45babf[_0x7fa5('0x38')],qs[_0x7fa5('0x3a')](_0x21ec6d[_0x7fa5('0x35')][_0x7fa5('0x3a')]));_0x155a6d['attributes']=_0x155a6d[_0x7fa5('0x39')]['length']?_0x155a6d['attributes']:_0x45babf[_0x7fa5('0x38')];_0x155a6d[_0x7fa5('0x3e')]=qs[_0x7fa5('0x3f')](_0x21ec6d[_0x7fa5('0x35')][_0x7fa5('0x3f')]);_0x155a6d['where']=qs[_0x7fa5('0x36')](_[_0x7fa5('0x41')](_0x21ec6d[_0x7fa5('0x35')],_0x45babf[_0x7fa5('0x36')]));if(_0x21ec6d[_0x7fa5('0x35')]['filter']){_0x155a6d['where']=_['merge'](_0x155a6d['where'],{'$or':_[_0x7fa5('0x2f')](_0x155a6d[_0x7fa5('0x39')],function(_0x16c320){var _0xc98bc7={};_0xc98bc7[_0x16c320]={'$like':'%'+_0x21ec6d[_0x7fa5('0x35')][_0x7fa5('0x42')]+'%'};return _0xc98bc7;})});}_0x155a6d=_[_0x7fa5('0x43')]({},_0x155a6d,_0x21ec6d['options']);return _0x5cf083['getFields'](_0x155a6d);}})['then'](function(_0x293b16){if(_0x293b16){_0x117ac7=_0x293b16[_0x7fa5('0x3b')];if(!_0x21ec6d[_0x7fa5('0x35')][_0x7fa5('0x3c')](_0x7fa5('0x3d'))){_0x155a6d[_0x7fa5('0x21')]=qs[_0x7fa5('0x21')](_0x21ec6d[_0x7fa5('0x35')][_0x7fa5('0x21')]);_0x155a6d[_0x7fa5('0x1f')]=qs[_0x7fa5('0x1f')](_0x21ec6d[_0x7fa5('0x35')][_0x7fa5('0x1f')]);}return _0x5cf083[_0x7fa5('0x50')](_0x155a6d);}})[_0x7fa5('0x29')](function(_0x5b4d12){if(_0x5b4d12){return _0x5b4d12?{'count':_0x117ac7,'rows':_0x5b4d12}:null;}})[_0x7fa5('0x29')](respondWithResult(_0x2b6d7c,null))['catch'](handleError(_0x2b6d7c,null));};exports[_0x7fa5('0x51')]=function(_0xed09e3,_0x2412ef,_0x4a576f){var _0x2834e0={};var _0x2ab723={};var _0x29b2a0;var _0x34ee75;return db[_0x7fa5('0x30')][_0x7fa5('0x4e')]({'where':{'id':_0xed09e3[_0x7fa5('0x4d')]['id']}})[_0x7fa5('0x29')](handleEntityNotFound(_0x2412ef,null))[_0x7fa5('0x29')](function(_0x5948c0){if(_0x5948c0){_0x29b2a0=_0x5948c0;_0x2ab723[_0x7fa5('0x38')]=_['keys'](db[_0x7fa5('0x52')][_0x7fa5('0x31')]);_0x2ab723[_0x7fa5('0x35')]=_[_0x7fa5('0x4f')](_0xed09e3['query']);_0x2ab723['filters']=_[_0x7fa5('0x37')](_0x2ab723['model'],_0x2ab723[_0x7fa5('0x35')]);_0x2834e0[_0x7fa5('0x39')]=_[_0x7fa5('0x37')](_0x2ab723[_0x7fa5('0x38')],qs[_0x7fa5('0x3a')](_0xed09e3[_0x7fa5('0x35')][_0x7fa5('0x3a')]));_0x2834e0[_0x7fa5('0x39')]=_0x2834e0[_0x7fa5('0x39')]['length']?_0x2834e0['attributes']:_0x2ab723[_0x7fa5('0x38')];_0x2834e0[_0x7fa5('0x3e')]=qs[_0x7fa5('0x3f')](_0xed09e3[_0x7fa5('0x35')][_0x7fa5('0x3f')]);_0x2834e0['where']=qs[_0x7fa5('0x36')](_[_0x7fa5('0x41')](_0xed09e3['query'],_0x2ab723['filters']));if(_0xed09e3[_0x7fa5('0x35')][_0x7fa5('0x42')]){_0x2834e0['where']=_[_0x7fa5('0x43')](_0x2834e0[_0x7fa5('0x40')],{'$or':_[_0x7fa5('0x2f')](_0x2834e0[_0x7fa5('0x39')],function(_0x5e76c2){var _0x5e32da={};_0x5e32da[_0x5e76c2]={'$like':'%'+_0xed09e3[_0x7fa5('0x35')][_0x7fa5('0x42')]+'%'};return _0x5e32da;})});}_0x2834e0=_[_0x7fa5('0x43')]({},_0x2834e0,_0xed09e3[_0x7fa5('0x44')]);return _0x29b2a0['getSubjects'](_0x2834e0);}})[_0x7fa5('0x29')](function(_0x5990c6){if(_0x5990c6){_0x34ee75=_0x5990c6['length'];if(!_0xed09e3['query'][_0x7fa5('0x3c')](_0x7fa5('0x3d'))){_0x2834e0[_0x7fa5('0x21')]=qs['limit'](_0xed09e3['query'][_0x7fa5('0x21')]);_0x2834e0[_0x7fa5('0x1f')]=qs[_0x7fa5('0x1f')](_0xed09e3[_0x7fa5('0x35')][_0x7fa5('0x1f')]);}return _0x29b2a0[_0x7fa5('0x51')](_0x2834e0);}})[_0x7fa5('0x29')](function(_0x2f9de9){if(_0x2f9de9){return _0x2f9de9?{'count':_0x34ee75,'rows':_0x2f9de9}:null;}})[_0x7fa5('0x29')](respondWithResult(_0x2412ef,null))[_0x7fa5('0x49')](handleError(_0x2412ef,null));};exports[_0x7fa5('0x53')]=function(_0x1155e5,_0xba9004,_0xa32157){var _0x5e2899={};var _0x4eca2f={};var _0x732f6a;var _0x5b6f1f;return db[_0x7fa5('0x30')][_0x7fa5('0x4e')]({'where':{'id':_0x1155e5[_0x7fa5('0x4d')]['id']}})[_0x7fa5('0x29')](handleEntityNotFound(_0xba9004,null))['then'](function(_0x407c83){if(_0x407c83){_0x732f6a=_0x407c83;_0x4eca2f[_0x7fa5('0x38')]=_[_0x7fa5('0x4f')](db['SalesforceField'][_0x7fa5('0x31')]);_0x4eca2f[_0x7fa5('0x35')]=_[_0x7fa5('0x4f')](_0x1155e5[_0x7fa5('0x35')]);_0x4eca2f[_0x7fa5('0x36')]=_[_0x7fa5('0x37')](_0x4eca2f['model'],_0x4eca2f['query']);_0x5e2899[_0x7fa5('0x39')]=_[_0x7fa5('0x37')](_0x4eca2f[_0x7fa5('0x38')],qs[_0x7fa5('0x3a')](_0x1155e5[_0x7fa5('0x35')][_0x7fa5('0x3a')]));_0x5e2899[_0x7fa5('0x39')]=_0x5e2899['attributes'][_0x7fa5('0x3b')]?_0x5e2899[_0x7fa5('0x39')]:_0x4eca2f[_0x7fa5('0x38')];_0x5e2899[_0x7fa5('0x3e')]=qs[_0x7fa5('0x3f')](_0x1155e5[_0x7fa5('0x35')][_0x7fa5('0x3f')]);_0x5e2899[_0x7fa5('0x40')]=qs['filters'](_['pick'](_0x1155e5[_0x7fa5('0x35')],_0x4eca2f[_0x7fa5('0x36')]));if(_0x1155e5[_0x7fa5('0x35')][_0x7fa5('0x42')]){_0x5e2899[_0x7fa5('0x40')]=_[_0x7fa5('0x43')](_0x5e2899[_0x7fa5('0x40')],{'$or':_[_0x7fa5('0x2f')](_0x5e2899['attributes'],function(_0x8905b0){var _0x77684f={};_0x77684f[_0x8905b0]={'$like':'%'+_0x1155e5[_0x7fa5('0x35')]['filter']+'%'};return _0x77684f;})});}_0x5e2899=_['merge']({},_0x5e2899,_0x1155e5[_0x7fa5('0x44')]);return _0x732f6a['getDescriptions'](_0x5e2899);}})[_0x7fa5('0x29')](function(_0x1785ef){if(_0x1785ef){_0x5b6f1f=_0x1785ef[_0x7fa5('0x3b')];if(!_0x1155e5[_0x7fa5('0x35')]['hasOwnProperty'](_0x7fa5('0x3d'))){_0x5e2899[_0x7fa5('0x21')]=qs[_0x7fa5('0x21')](_0x1155e5[_0x7fa5('0x35')][_0x7fa5('0x21')]);_0x5e2899[_0x7fa5('0x1f')]=qs[_0x7fa5('0x1f')](_0x1155e5['query'][_0x7fa5('0x1f')]);}return _0x732f6a['getDescriptions'](_0x5e2899);}})['then'](function(_0x3b9696){if(_0x3b9696){return _0x3b9696?{'count':_0x5b6f1f,'rows':_0x3b9696}:null;}})[_0x7fa5('0x29')](respondWithResult(_0xba9004,null))[_0x7fa5('0x49')](handleError(_0xba9004,null));}; \ No newline at end of file +var _0x309d=['filter','type','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','create','body','find','findOne','getFields','nolimit','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','SalesforceConfiguration','rawAttributes','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick'];(function(_0x20cdf0,_0x552b46){var _0x56d4b2=function(_0x38e2a6){while(--_0x38e2a6){_0x20cdf0['push'](_0x20cdf0['shift']());}};_0x56d4b2(++_0x552b46);}(_0x309d,0x1dd));var _0xd309=function(_0x34ee1f,_0x40027a){_0x34ee1f=_0x34ee1f-0x0;var _0x3d7288=_0x309d[_0x34ee1f];return _0x3d7288;};'use strict';var emlformat=require(_0xd309('0x0'));var rimraf=require(_0xd309('0x1'));var zipdir=require(_0xd309('0x2'));var jsonpatch=require(_0xd309('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd309('0x4'));var path=require('path');var sox=require(_0xd309('0x5'));var csv=require(_0xd309('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd309('0x7'));var _=require(_0xd309('0x8'));var squel=require(_0xd309('0x9'));var crypto=require(_0xd309('0xa'));var jsforce=require(_0xd309('0xb'));var deskjs=require(_0xd309('0xc'));var toCsv=require(_0xd309('0x6'));var querystring=require(_0xd309('0xd'));var Papa=require(_0xd309('0xe'));var Redis=require(_0xd309('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd309('0x10'));var hardwareService=require(_0xd309('0x11'));var logger=require(_0xd309('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd309('0x13'));var licenseUtil=require(_0xd309('0x14'));var db=require(_0xd309('0x15'))['db'];function respondWithStatusCode(_0x2faa9a,_0x58c88c){_0x58c88c=_0x58c88c||0xcc;return function(_0x3c18be){if(_0x3c18be){return _0x2faa9a['sendStatus'](_0x58c88c);}return _0x2faa9a[_0xd309('0x16')](_0x58c88c)[_0xd309('0x17')]();};}function respondWithResult(_0x15453e,_0x4734bd){_0x4734bd=_0x4734bd||0xc8;return function(_0x299ee9){if(_0x299ee9){return _0x15453e['status'](_0x4734bd)[_0xd309('0x18')](_0x299ee9);}};}function respondWithFilteredResult(_0x169de6,_0x2a73ad){return function(_0x2a289b){if(_0x2a289b){var _0xe0ea2=typeof _0x2a73ad[_0xd309('0x19')]===_0xd309('0x1a')&&typeof _0x2a73ad[_0xd309('0x1b')]===_0xd309('0x1a');var _0x1f1e0e=_0x2a289b[_0xd309('0x1c')];var _0x2d0358=_0xe0ea2?0x0:_0x2a73ad[_0xd309('0x19')];var _0x224002=_0xe0ea2?_0x2a289b[_0xd309('0x1c')]:_0x2a73ad[_0xd309('0x19')]+_0x2a73ad['limit'];var _0x44bbf3;if(_0x224002>=_0x1f1e0e){_0x224002=_0x1f1e0e;_0x44bbf3=0xc8;}else{_0x44bbf3=0xce;}_0x169de6[_0xd309('0x16')](_0x44bbf3);return _0x169de6[_0xd309('0x1d')](_0xd309('0x1e'),_0x2d0358+'-'+_0x224002+'/'+_0x1f1e0e)[_0xd309('0x18')](_0x2a289b);}return null;};}function patchUpdates(_0x44b95c){return function(_0x261288){try{jsonpatch[_0xd309('0x1f')](_0x261288,_0x44b95c,!![]);}catch(_0x248077){return BPromise['reject'](_0x248077);}return _0x261288[_0xd309('0x20')]();};}function saveUpdates(_0x34e255,_0x47427b){return function(_0x3ce6ad){if(_0x3ce6ad){return _0x3ce6ad[_0xd309('0x21')](_0x34e255)[_0xd309('0x22')](function(_0x1f34c6){return _0x1f34c6;});}return null;};}function removeEntity(_0x5926c6,_0x5d7b07){return function(_0x13773f){if(_0x13773f){return _0x13773f[_0xd309('0x23')]()[_0xd309('0x22')](function(){_0x5926c6['status'](0xcc)[_0xd309('0x17')]();});}};}function handleEntityNotFound(_0x251d43,_0x629bc4){return function(_0x222dbb){if(!_0x222dbb){_0x251d43['sendStatus'](0x194);}return _0x222dbb;};}function handleError(_0x3c376c,_0x38d7a6){_0x38d7a6=_0x38d7a6||0x1f4;return function(_0x5bd05d){logger[_0xd309('0x24')](_0x5bd05d['stack']);if(_0x5bd05d[_0xd309('0x25')]){delete _0x5bd05d[_0xd309('0x25')];}_0x3c376c[_0xd309('0x16')](_0x38d7a6)[_0xd309('0x26')](_0x5bd05d);};}exports[_0xd309('0x27')]=function(_0x4c7032,_0x54cde4){var _0x2cb362={},_0x3652c5={},_0x423036={'count':0x0,'rows':[]};var _0x53f2c2=_[_0xd309('0x28')](db[_0xd309('0x29')][_0xd309('0x2a')],function(_0x6c370f){return{'name':_0x6c370f['fieldName'],'type':_0x6c370f['type'][_0xd309('0x2b')]};});_0x3652c5['model']=_[_0xd309('0x28')](_0x53f2c2,_0xd309('0x25'));_0x3652c5[_0xd309('0x2c')]=_['keys'](_0x4c7032[_0xd309('0x2c')]);_0x3652c5[_0xd309('0x2d')]=_[_0xd309('0x2e')](_0x3652c5[_0xd309('0x2f')],_0x3652c5[_0xd309('0x2c')]);_0x2cb362[_0xd309('0x30')]=_['intersection'](_0x3652c5[_0xd309('0x2f')],qs[_0xd309('0x31')](_0x4c7032[_0xd309('0x2c')][_0xd309('0x31')]));_0x2cb362['attributes']=_0x2cb362['attributes']['length']?_0x2cb362[_0xd309('0x30')]:_0x3652c5['model'];if(!_0x4c7032[_0xd309('0x2c')][_0xd309('0x32')]('nolimit')){_0x2cb362['limit']=qs[_0xd309('0x1b')](_0x4c7032[_0xd309('0x2c')][_0xd309('0x1b')]);_0x2cb362['offset']=qs[_0xd309('0x19')](_0x4c7032['query'][_0xd309('0x19')]);}_0x2cb362[_0xd309('0x33')]=qs[_0xd309('0x34')](_0x4c7032[_0xd309('0x2c')]['sort']);_0x2cb362[_0xd309('0x35')]=qs[_0xd309('0x2d')](_[_0xd309('0x36')](_0x4c7032[_0xd309('0x2c')],_0x3652c5[_0xd309('0x2d')]),_0x53f2c2);if(_0x4c7032[_0xd309('0x2c')][_0xd309('0x37')]){_0x2cb362[_0xd309('0x35')]=_['merge'](_0x2cb362['where'],{'$or':_[_0xd309('0x28')](_0x53f2c2,function(_0x53ab98){if(_0x53ab98[_0xd309('0x38')]!=='VIRTUAL'){var _0x47eb5a={};_0x47eb5a[_0x53ab98[_0xd309('0x25')]]={'$like':'%'+_0x4c7032[_0xd309('0x2c')]['filter']+'%'};return _0x47eb5a;}})});}_0x2cb362=_[_0xd309('0x39')]({},_0x2cb362,_0x4c7032['options']);var _0x32e43b={'where':_0x2cb362['where']};return db[_0xd309('0x29')][_0xd309('0x1c')](_0x32e43b)[_0xd309('0x22')](function(_0x59715a){_0x423036[_0xd309('0x1c')]=_0x59715a;if(_0x4c7032[_0xd309('0x2c')][_0xd309('0x3a')]){_0x2cb362[_0xd309('0x3b')]=[{'all':!![]}];}return db[_0xd309('0x29')][_0xd309('0x3c')](_0x2cb362);})[_0xd309('0x22')](function(_0xf5597a){_0x423036[_0xd309('0x3d')]=_0xf5597a;return _0x423036;})[_0xd309('0x22')](respondWithFilteredResult(_0x54cde4,_0x2cb362))[_0xd309('0x3e')](handleError(_0x54cde4,null));};exports[_0xd309('0x3f')]=function(_0x428b49,_0x1d1920){var _0x576183={'raw':![],'where':{'id':_0x428b49[_0xd309('0x40')]['id']}},_0x4ee032={};_0x4ee032[_0xd309('0x2f')]=_[_0xd309('0x41')](db[_0xd309('0x29')]['rawAttributes']);_0x4ee032[_0xd309('0x2c')]=_[_0xd309('0x41')](_0x428b49[_0xd309('0x2c')]);_0x4ee032[_0xd309('0x2d')]=_['intersection'](_0x4ee032['model'],_0x4ee032[_0xd309('0x2c')]);_0x576183[_0xd309('0x30')]=_[_0xd309('0x2e')](_0x4ee032['model'],qs[_0xd309('0x31')](_0x428b49[_0xd309('0x2c')][_0xd309('0x31')]));_0x576183[_0xd309('0x30')]=_0x576183[_0xd309('0x30')][_0xd309('0x42')]?_0x576183['attributes']:_0x4ee032[_0xd309('0x2f')];if(_0x428b49[_0xd309('0x2c')][_0xd309('0x3a')]){_0x576183[_0xd309('0x3b')]=[{'all':!![]}];}_0x576183=_[_0xd309('0x39')]({},_0x576183,_0x428b49[_0xd309('0x43')]);return db[_0xd309('0x29')]['find'](_0x576183)[_0xd309('0x22')](handleEntityNotFound(_0x1d1920,null))[_0xd309('0x22')](respondWithResult(_0x1d1920,null))[_0xd309('0x3e')](handleError(_0x1d1920,null));};exports[_0xd309('0x44')]=function(_0x53b378,_0x190101){return db[_0xd309('0x29')][_0xd309('0x44')](_0x53b378[_0xd309('0x45')],{})[_0xd309('0x22')](respondWithResult(_0x190101,0xc9))[_0xd309('0x3e')](handleError(_0x190101,null));};exports['update']=function(_0x3c26b6,_0x29894b){if(_0x3c26b6[_0xd309('0x45')]['id']){delete _0x3c26b6[_0xd309('0x45')]['id'];}return db[_0xd309('0x29')][_0xd309('0x46')]({'where':{'id':_0x3c26b6[_0xd309('0x40')]['id']}})[_0xd309('0x22')](handleEntityNotFound(_0x29894b,null))[_0xd309('0x22')](saveUpdates(_0x3c26b6[_0xd309('0x45')],null))['then'](respondWithResult(_0x29894b,null))[_0xd309('0x3e')](handleError(_0x29894b,null));};exports[_0xd309('0x23')]=function(_0x47fb93,_0x36a43d){return db[_0xd309('0x29')][_0xd309('0x46')]({'where':{'id':_0x47fb93['params']['id']}})['then'](handleEntityNotFound(_0x36a43d,null))[_0xd309('0x22')](removeEntity(_0x36a43d,null))[_0xd309('0x3e')](handleError(_0x36a43d,null));};exports['getFields']=function(_0x54c91c,_0x5a521e,_0x5ba8eb){var _0x3e4b91={};var _0x3d3b91={};var _0x3d2dc8;var _0x57a2f3;return db[_0xd309('0x29')][_0xd309('0x47')]({'where':{'id':_0x54c91c[_0xd309('0x40')]['id']}})[_0xd309('0x22')](handleEntityNotFound(_0x5a521e,null))[_0xd309('0x22')](function(_0x2a23b8){if(_0x2a23b8){_0x3d2dc8=_0x2a23b8;_0x3d3b91[_0xd309('0x2f')]=_[_0xd309('0x41')](db['SalesforceField'][_0xd309('0x2a')]);_0x3d3b91['query']=_[_0xd309('0x41')](_0x54c91c[_0xd309('0x2c')]);_0x3d3b91[_0xd309('0x2d')]=_[_0xd309('0x2e')](_0x3d3b91[_0xd309('0x2f')],_0x3d3b91[_0xd309('0x2c')]);_0x3e4b91[_0xd309('0x30')]=_[_0xd309('0x2e')](_0x3d3b91[_0xd309('0x2f')],qs[_0xd309('0x31')](_0x54c91c[_0xd309('0x2c')][_0xd309('0x31')]));_0x3e4b91[_0xd309('0x30')]=_0x3e4b91[_0xd309('0x30')][_0xd309('0x42')]?_0x3e4b91[_0xd309('0x30')]:_0x3d3b91['model'];_0x3e4b91[_0xd309('0x33')]=qs[_0xd309('0x34')](_0x54c91c['query'][_0xd309('0x34')]);_0x3e4b91[_0xd309('0x35')]=qs[_0xd309('0x2d')](_[_0xd309('0x36')](_0x54c91c[_0xd309('0x2c')],_0x3d3b91[_0xd309('0x2d')]));if(_0x54c91c[_0xd309('0x2c')][_0xd309('0x37')]){_0x3e4b91[_0xd309('0x35')]=_[_0xd309('0x39')](_0x3e4b91['where'],{'$or':_['map'](_0x3e4b91['attributes'],function(_0x45d078){var _0x26c425={};_0x26c425[_0x45d078]={'$like':'%'+_0x54c91c['query'][_0xd309('0x37')]+'%'};return _0x26c425;})});}_0x3e4b91=_[_0xd309('0x39')]({},_0x3e4b91,_0x54c91c[_0xd309('0x43')]);return _0x3d2dc8[_0xd309('0x48')](_0x3e4b91);}})['then'](function(_0x1fc3eb){if(_0x1fc3eb){_0x57a2f3=_0x1fc3eb['length'];if(!_0x54c91c[_0xd309('0x2c')][_0xd309('0x32')](_0xd309('0x49'))){_0x3e4b91[_0xd309('0x1b')]=qs[_0xd309('0x1b')](_0x54c91c[_0xd309('0x2c')][_0xd309('0x1b')]);_0x3e4b91['offset']=qs['offset'](_0x54c91c['query'][_0xd309('0x19')]);}return _0x3d2dc8[_0xd309('0x48')](_0x3e4b91);}})['then'](function(_0x60236){if(_0x60236){return _0x60236?{'count':_0x57a2f3,'rows':_0x60236}:null;}})[_0xd309('0x22')](respondWithResult(_0x5a521e,null))[_0xd309('0x3e')](handleError(_0x5a521e,null));};exports['getSubjects']=function(_0x15350e,_0x9e6e2e,_0x200905){var _0x267379={};var _0x419be3={};var _0x461a3a;var _0x38d233;return db[_0xd309('0x29')][_0xd309('0x47')]({'where':{'id':_0x15350e['params']['id']}})[_0xd309('0x22')](handleEntityNotFound(_0x9e6e2e,null))[_0xd309('0x22')](function(_0x496f1b){if(_0x496f1b){_0x461a3a=_0x496f1b;_0x419be3['model']=_[_0xd309('0x41')](db[_0xd309('0x4a')][_0xd309('0x2a')]);_0x419be3['query']=_[_0xd309('0x41')](_0x15350e['query']);_0x419be3['filters']=_[_0xd309('0x2e')](_0x419be3[_0xd309('0x2f')],_0x419be3['query']);_0x267379[_0xd309('0x30')]=_[_0xd309('0x2e')](_0x419be3['model'],qs[_0xd309('0x31')](_0x15350e['query'][_0xd309('0x31')]));_0x267379['attributes']=_0x267379['attributes'][_0xd309('0x42')]?_0x267379[_0xd309('0x30')]:_0x419be3[_0xd309('0x2f')];_0x267379[_0xd309('0x33')]=qs[_0xd309('0x34')](_0x15350e[_0xd309('0x2c')][_0xd309('0x34')]);_0x267379[_0xd309('0x35')]=qs['filters'](_[_0xd309('0x36')](_0x15350e['query'],_0x419be3['filters']));if(_0x15350e[_0xd309('0x2c')][_0xd309('0x37')]){_0x267379[_0xd309('0x35')]=_['merge'](_0x267379[_0xd309('0x35')],{'$or':_[_0xd309('0x28')](_0x267379[_0xd309('0x30')],function(_0x1f1599){var _0x14da94={};_0x14da94[_0x1f1599]={'$like':'%'+_0x15350e[_0xd309('0x2c')][_0xd309('0x37')]+'%'};return _0x14da94;})});}_0x267379=_[_0xd309('0x39')]({},_0x267379,_0x15350e[_0xd309('0x43')]);return _0x461a3a['getSubjects'](_0x267379);}})[_0xd309('0x22')](function(_0x395866){if(_0x395866){_0x38d233=_0x395866[_0xd309('0x42')];if(!_0x15350e['query'][_0xd309('0x32')](_0xd309('0x49'))){_0x267379['limit']=qs[_0xd309('0x1b')](_0x15350e[_0xd309('0x2c')][_0xd309('0x1b')]);_0x267379[_0xd309('0x19')]=qs[_0xd309('0x19')](_0x15350e[_0xd309('0x2c')][_0xd309('0x19')]);}return _0x461a3a['getSubjects'](_0x267379);}})[_0xd309('0x22')](function(_0x18f6de){if(_0x18f6de){return _0x18f6de?{'count':_0x38d233,'rows':_0x18f6de}:null;}})[_0xd309('0x22')](respondWithResult(_0x9e6e2e,null))['catch'](handleError(_0x9e6e2e,null));};exports['getDescriptions']=function(_0x58dbe1,_0x368c1f,_0x46b9da){var _0x5958ad={};var _0x204148={};var _0x5b08c9;var _0x227d95;return db[_0xd309('0x29')][_0xd309('0x47')]({'where':{'id':_0x58dbe1[_0xd309('0x40')]['id']}})[_0xd309('0x22')](handleEntityNotFound(_0x368c1f,null))['then'](function(_0x48285f){if(_0x48285f){_0x5b08c9=_0x48285f;_0x204148[_0xd309('0x2f')]=_[_0xd309('0x41')](db[_0xd309('0x4a')][_0xd309('0x2a')]);_0x204148[_0xd309('0x2c')]=_['keys'](_0x58dbe1[_0xd309('0x2c')]);_0x204148['filters']=_['intersection'](_0x204148['model'],_0x204148[_0xd309('0x2c')]);_0x5958ad['attributes']=_[_0xd309('0x2e')](_0x204148[_0xd309('0x2f')],qs[_0xd309('0x31')](_0x58dbe1[_0xd309('0x2c')][_0xd309('0x31')]));_0x5958ad[_0xd309('0x30')]=_0x5958ad['attributes'][_0xd309('0x42')]?_0x5958ad['attributes']:_0x204148[_0xd309('0x2f')];_0x5958ad[_0xd309('0x33')]=qs[_0xd309('0x34')](_0x58dbe1[_0xd309('0x2c')]['sort']);_0x5958ad[_0xd309('0x35')]=qs['filters'](_['pick'](_0x58dbe1[_0xd309('0x2c')],_0x204148[_0xd309('0x2d')]));if(_0x58dbe1['query'][_0xd309('0x37')]){_0x5958ad[_0xd309('0x35')]=_[_0xd309('0x39')](_0x5958ad[_0xd309('0x35')],{'$or':_[_0xd309('0x28')](_0x5958ad[_0xd309('0x30')],function(_0x21d0ee){var _0x3dbe0b={};_0x3dbe0b[_0x21d0ee]={'$like':'%'+_0x58dbe1[_0xd309('0x2c')]['filter']+'%'};return _0x3dbe0b;})});}_0x5958ad=_[_0xd309('0x39')]({},_0x5958ad,_0x58dbe1[_0xd309('0x43')]);return _0x5b08c9[_0xd309('0x4b')](_0x5958ad);}})[_0xd309('0x22')](function(_0x135714){if(_0x135714){_0x227d95=_0x135714[_0xd309('0x42')];if(!_0x58dbe1[_0xd309('0x2c')]['hasOwnProperty']('nolimit')){_0x5958ad[_0xd309('0x1b')]=qs[_0xd309('0x1b')](_0x58dbe1[_0xd309('0x2c')]['limit']);_0x5958ad[_0xd309('0x19')]=qs[_0xd309('0x19')](_0x58dbe1[_0xd309('0x2c')][_0xd309('0x19')]);}return _0x5b08c9[_0xd309('0x4b')](_0x5958ad);}})[_0xd309('0x22')](function(_0x450bff){if(_0x450bff){return _0x450bff?{'count':_0x227d95,'rows':_0x450bff}:null;}})[_0xd309('0x22')](respondWithResult(_0x368c1f,null))[_0xd309('0x3e')](handleError(_0x368c1f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4dc0efb..f735369 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 _0x10c3=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x296b3c,_0x203828){var _0x53adfa=function(_0x50b597){while(--_0x50b597){_0x296b3c['push'](_0x296b3c['shift']());}};_0x53adfa(++_0x203828);}(_0x10c3,0xa2));var _0x310c=function(_0x263447,_0x28aa12){_0x263447=_0x263447-0x0;var _0x2a9ca3=_0x10c3[_0x263447];return _0x2a9ca3;};'use strict';var _=require(_0x310c('0x0'));var util=require(_0x310c('0x1'));var logger=require(_0x310c('0x2'))(_0x310c('0x3'));var moment=require('moment');var BPromise=require(_0x310c('0x4'));var rp=require(_0x310c('0x5'));var fs=require('fs');var path=require(_0x310c('0x6'));var rimraf=require(_0x310c('0x7'));var config=require(_0x310c('0x8'));var attributes=require(_0x310c('0x9'));module[_0x310c('0xa')]=function(_0x330210,_0x852b6){return _0x330210[_0x310c('0xb')](_0x310c('0xc'),attributes,{'tableName':_0x310c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07f1=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x07f1,0x199));var _0x107f=function(_0x93c179,_0x112c81){_0x93c179=_0x93c179-0x0;var _0x15ddc3=_0x07f1[_0x93c179];return _0x15ddc3;};'use strict';var _=require(_0x107f('0x0'));var util=require(_0x107f('0x1'));var logger=require(_0x107f('0x2'))('api');var moment=require(_0x107f('0x3'));var BPromise=require(_0x107f('0x4'));var rp=require(_0x107f('0x5'));var fs=require('fs');var path=require(_0x107f('0x6'));var rimraf=require('rimraf');var config=require(_0x107f('0x7'));var attributes=require(_0x107f('0x8'));module[_0x107f('0x9')]=function(_0x348f57,_0x2b4e7d){return _0x348f57[_0x107f('0xa')](_0x107f('0xb'),attributes,{'tableName':_0x107f('0xc'),'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 3a45223..c18edc3 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 _0xb8d0=['request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x1ce892,_0x273849){var _0x4f54d1=function(_0x5660ab){while(--_0x5660ab){_0x1ce892['push'](_0x1ce892['shift']());}};_0x4f54d1(++_0x273849);}(_0xb8d0,0x1ec));var _0x0b8d=function(_0x2dafc8,_0xdf2d62){_0x2dafc8=_0x2dafc8-0x0;var _0x29f39c=_0xb8d0[_0x2dafc8];return _0x29f39c;};'use strict';var _=require('lodash');var util=require(_0x0b8d('0x0'));var moment=require(_0x0b8d('0x1'));var BPromise=require(_0x0b8d('0x2'));var rs=require(_0x0b8d('0x3'));var fs=require('fs');var Redis=require(_0x0b8d('0x4'));var db=require(_0x0b8d('0x5'))['db'];var utils=require(_0x0b8d('0x6'));var logger=require(_0x0b8d('0x7'))(_0x0b8d('0x8'));var config=require(_0x0b8d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0b8d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a9c75,_0x232390,_0xf778d7){return new BPromise(function(_0x5a4918,_0x11a848){return client[_0x0b8d('0xb')](_0x4a9c75,_0xf778d7)[_0x0b8d('0xc')](function(_0x1b1c76){logger['info'](_0x0b8d('0xd'),_0x232390,_0x0b8d('0xe'));logger['debug'](_0x0b8d('0xf'),_0x232390,'request\x20sent',JSON[_0x0b8d('0x10')](_0x1b1c76));if(_0x1b1c76['error']){if(_0x1b1c76['error'][_0x0b8d('0x11')]===0x1f4){logger[_0x0b8d('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x232390,_0x1b1c76['error'][_0x0b8d('0x13')]);return _0x11a848(_0x1b1c76[_0x0b8d('0x12')][_0x0b8d('0x13')]);}logger['error'](_0x0b8d('0xd'),_0x232390,_0x1b1c76[_0x0b8d('0x12')][_0x0b8d('0x13')]);return _0x5a4918(_0x1b1c76[_0x0b8d('0x12')][_0x0b8d('0x13')]);}else{logger[_0x0b8d('0x14')](_0x0b8d('0xd'),_0x232390,'request\x20sent');_0x5a4918(_0x1b1c76['result'][_0x0b8d('0x13')]);}})[_0x0b8d('0x15')](function(_0x1c73ce){logger[_0x0b8d('0x12')](_0x0b8d('0xd'),_0x232390,_0x1c73ce);_0x11a848(_0x1c73ce);});});} \ No newline at end of file +var _0xf123=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0xf123,0x134));var _0x3f12=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0xf123[_0x1304c6];return _0x2e6654;};'use strict';var _=require('lodash');var util=require(_0x3f12('0x0'));var moment=require('moment');var BPromise=require(_0x3f12('0x1'));var rs=require(_0x3f12('0x2'));var fs=require('fs');var Redis=require(_0x3f12('0x3'));var db=require(_0x3f12('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f12('0x5'))(_0x3f12('0x6'));var config=require('../../config/environment');var jayson=require(_0x3f12('0x7'));var client=jayson[_0x3f12('0x8')][_0x3f12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x589443,_0x102c59,_0x4952b3){return new BPromise(function(_0x405186,_0x456ea3){return client[_0x3f12('0xa')](_0x589443,_0x4952b3)[_0x3f12('0xb')](function(_0xacff21){logger[_0x3f12('0xc')](_0x3f12('0xd'),_0x102c59,_0x3f12('0xe'));logger[_0x3f12('0xf')](_0x3f12('0x10'),_0x102c59,'request\x20sent',JSON[_0x3f12('0x11')](_0xacff21));if(_0xacff21[_0x3f12('0x12')]){if(_0xacff21['error'][_0x3f12('0x13')]===0x1f4){logger[_0x3f12('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x102c59,_0xacff21[_0x3f12('0x12')][_0x3f12('0x14')]);return _0x456ea3(_0xacff21['error']['message']);}logger[_0x3f12('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x102c59,_0xacff21['error'][_0x3f12('0x14')]);return _0x405186(_0xacff21[_0x3f12('0x12')]['message']);}else{logger[_0x3f12('0xc')](_0x3f12('0xd'),_0x102c59,'request\x20sent');_0x405186(_0xacff21['result'][_0x3f12('0x14')]);}})[_0x3f12('0x15')](function(_0x185f4b){logger[_0x3f12('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x102c59,_0x185f4b);_0x456ea3(_0x185f4b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 88519ee..b8ba0c2 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 _0xf300=['/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x44bf69,_0x3f6912){var _0x1dfb8b=function(_0xd8b225){while(--_0xd8b225){_0x44bf69['push'](_0x44bf69['shift']());}};_0x1dfb8b(++_0x3f6912);}(_0xf300,0xe4));var _0x0f30=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0xf300[_0x57da0a];return _0x3145d5;};'use strict';var multer=require('multer');var util=require(_0x0f30('0x0'));var path=require('path');var timeout=require(_0x0f30('0x1'));var express=require(_0x0f30('0x2'));var router=express[_0x0f30('0x3')]();var fs_extra=require(_0x0f30('0x4'));var auth=require(_0x0f30('0x5'));var interaction=require(_0x0f30('0x6'));var config=require(_0x0f30('0x7'));var controller=require(_0x0f30('0x8'));router[_0x0f30('0x9')]('/',auth[_0x0f30('0xa')](),controller[_0x0f30('0xb')]);router[_0x0f30('0x9')](_0x0f30('0xc'),auth['isAuthenticated'](),controller[_0x0f30('0xd')]);router[_0x0f30('0xe')]('/',auth['isAuthenticated'](),controller[_0x0f30('0xf')]);router[_0x0f30('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0f30('0x11')](_0x0f30('0xc'),auth[_0x0f30('0xa')](),controller[_0x0f30('0x12')]);module[_0x0f30('0x13')]=router; \ No newline at end of file +var _0x5cbe=['show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','./intSalesforceField.controller','get','index','/:id','isAuthenticated'];(function(_0x754984,_0x3f95cd){var _0x1f20b1=function(_0x1ba0b0){while(--_0x1ba0b0){_0x754984['push'](_0x754984['shift']());}};_0x1f20b1(++_0x3f95cd);}(_0x5cbe,0x117));var _0xe5cb=function(_0xd78bd5,_0x448873){_0xd78bd5=_0xd78bd5-0x0;var _0x37f84e=_0x5cbe[_0xd78bd5];return _0x37f84e;};'use strict';var multer=require('multer');var util=require(_0xe5cb('0x0'));var path=require(_0xe5cb('0x1'));var timeout=require(_0xe5cb('0x2'));var express=require(_0xe5cb('0x3'));var router=express['Router']();var fs_extra=require(_0xe5cb('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe5cb('0x5'));router[_0xe5cb('0x6')]('/',auth['isAuthenticated'](),controller[_0xe5cb('0x7')]);router[_0xe5cb('0x6')](_0xe5cb('0x8'),auth[_0xe5cb('0x9')](),controller[_0xe5cb('0xa')]);router[_0xe5cb('0xb')]('/',auth['isAuthenticated'](),controller[_0xe5cb('0xc')]);router[_0xe5cb('0xd')](_0xe5cb('0x8'),auth[_0xe5cb('0x9')](),controller['update']);router[_0xe5cb('0xe')]('/:id',auth[_0xe5cb('0x9')](),controller[_0xe5cb('0xf')]);module[_0xe5cb('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 96df7ae..7baea86 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 _0x9794=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x239fa1,_0x9e847a){var _0x5d3603=function(_0x2cdd34){while(--_0x2cdd34){_0x239fa1['push'](_0x239fa1['shift']());}};_0x5d3603(++_0x9e847a);}(_0x9794,0xe8));var _0x4979=function(_0x3250cf,_0x2ba700){_0x3250cf=_0x3250cf-0x0;var _0x26d619=_0x9794[_0x3250cf];return _0x26d619;};'use strict';var Sequelize=require('sequelize');module[_0x4979('0x0')]={'type':{'type':Sequelize[_0x4979('0x1')](_0x4979('0x2'),'variable',_0x4979('0x3'),_0x4979('0x4'),_0x4979('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4979('0x6')]},'key':{'type':Sequelize[_0x4979('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x4979('0x7'),_0x4979('0x3'))},'keyContent':{'type':Sequelize[_0x4979('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x4979('0x6')]}}; \ No newline at end of file +var _0x6163=['ENUM','string','customVariable','keyValue','STRING','variable','sequelize','exports'];(function(_0xfc243,_0x540ea3){var _0x110cbf=function(_0x55c168){while(--_0x55c168){_0xfc243['push'](_0xfc243['shift']());}};_0x110cbf(++_0x540ea3);}(_0x6163,0xde));var _0x3616=function(_0x4f045c,_0x383164){_0x4f045c=_0x4f045c-0x0;var _0x430ec4=_0x6163[_0x4f045c];return _0x430ec4;};'use strict';var Sequelize=require(_0x3616('0x0'));module[_0x3616('0x1')]={'type':{'type':Sequelize[_0x3616('0x2')](_0x3616('0x3'),'variable',_0x3616('0x4'),_0x3616('0x5'),'picklist'),'defaultValue':_0x3616('0x3')},'content':{'type':Sequelize[_0x3616('0x6')]},'key':{'type':Sequelize[_0x3616('0x6')]},'keyType':{'type':Sequelize[_0x3616('0x2')](_0x3616('0x3'),_0x3616('0x7'),_0x3616('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3616('0x6')]},'variableName':{'type':Sequelize[_0x3616('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 12c7963..ca7dee3 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 _0xeff4=['filter','merge','VIRTUAL','options','SalesforceField','includeAll','findAll','rows','include','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeff4,0xf2));var _0x4eff=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0xeff4[_0x22ffbf];return _0x360c17;};'use strict';var emlformat=require(_0x4eff('0x0'));var rimraf=require(_0x4eff('0x1'));var zipdir=require(_0x4eff('0x2'));var jsonpatch=require(_0x4eff('0x3'));var rp=require(_0x4eff('0x4'));var moment=require(_0x4eff('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4eff('0x6'));var path=require(_0x4eff('0x7'));var sox=require('sox');var csv=require(_0x4eff('0x8'));var ejs=require(_0x4eff('0x9'));var fs=require('fs');var fs_extra=require(_0x4eff('0xa'));var _=require(_0x4eff('0xb'));var squel=require(_0x4eff('0xc'));var crypto=require(_0x4eff('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4eff('0xe'));var toCsv=require(_0x4eff('0x8'));var querystring=require(_0x4eff('0xf'));var Papa=require('papaparse');var Redis=require(_0x4eff('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4eff('0x11'));var as=require(_0x4eff('0x12'));var hardwareService=require(_0x4eff('0x13'));var logger=require(_0x4eff('0x14'))(_0x4eff('0x15'));var utils=require(_0x4eff('0x16'));var config=require(_0x4eff('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4eff('0x18'))['db'];function respondWithStatusCode(_0x3b19d1,_0x46486e){_0x46486e=_0x46486e||0xcc;return function(_0x579988){if(_0x579988){return _0x3b19d1[_0x4eff('0x19')](_0x46486e);}return _0x3b19d1[_0x4eff('0x1a')](_0x46486e)[_0x4eff('0x1b')]();};}function respondWithResult(_0x11afaf,_0x14589b){_0x14589b=_0x14589b||0xc8;return function(_0x28e32f){if(_0x28e32f){return _0x11afaf['status'](_0x14589b)[_0x4eff('0x1c')](_0x28e32f);}};}function respondWithFilteredResult(_0x5f4082,_0x57ff23){return function(_0x367564){if(_0x367564){var _0x4ca388=typeof _0x57ff23['offset']===_0x4eff('0x1d')&&typeof _0x57ff23[_0x4eff('0x1e')]===_0x4eff('0x1d');var _0x858e79=_0x367564[_0x4eff('0x1f')];var _0x39795b=_0x4ca388?0x0:_0x57ff23['offset'];var _0x33a3ec=_0x4ca388?_0x367564['count']:_0x57ff23[_0x4eff('0x20')]+_0x57ff23['limit'];var _0x424cae;if(_0x33a3ec>=_0x858e79){_0x33a3ec=_0x858e79;_0x424cae=0xc8;}else{_0x424cae=0xce;}_0x5f4082['status'](_0x424cae);return _0x5f4082[_0x4eff('0x21')](_0x4eff('0x22'),_0x39795b+'-'+_0x33a3ec+'/'+_0x858e79)[_0x4eff('0x1c')](_0x367564);}return null;};}function patchUpdates(_0x445f3c){return function(_0x41ea4f){try{jsonpatch[_0x4eff('0x23')](_0x41ea4f,_0x445f3c,!![]);}catch(_0x4bfee5){return BPromise[_0x4eff('0x24')](_0x4bfee5);}return _0x41ea4f[_0x4eff('0x25')]();};}function saveUpdates(_0x72e492,_0x3d837b){return function(_0x4aa4a1){if(_0x4aa4a1){return _0x4aa4a1[_0x4eff('0x26')](_0x72e492)[_0x4eff('0x27')](function(_0x2a7f4b){return _0x2a7f4b;});}return null;};}function removeEntity(_0x84602b,_0x1f0d17){return function(_0xde228){if(_0xde228){return _0xde228[_0x4eff('0x28')]()['then'](function(){_0x84602b[_0x4eff('0x1a')](0xcc)[_0x4eff('0x1b')]();});}};}function handleEntityNotFound(_0x246fef,_0x4928ae){return function(_0xaca5a7){if(!_0xaca5a7){_0x246fef[_0x4eff('0x19')](0x194);}return _0xaca5a7;};}function handleError(_0xd68988,_0x47ebba){_0x47ebba=_0x47ebba||0x1f4;return function(_0x36cb0c){logger['error'](_0x36cb0c[_0x4eff('0x29')]);if(_0x36cb0c[_0x4eff('0x2a')]){delete _0x36cb0c[_0x4eff('0x2a')];}_0xd68988[_0x4eff('0x1a')](_0x47ebba)[_0x4eff('0x2b')](_0x36cb0c);};}exports[_0x4eff('0x2c')]=function(_0x550100,_0x310da5){var _0x4aa7b0={},_0x15278d={},_0xc8abab={'count':0x0,'rows':[]};var _0x29ae0f=_[_0x4eff('0x2d')](db['SalesforceField'][_0x4eff('0x2e')],function(_0x34b0e1){return{'name':_0x34b0e1[_0x4eff('0x2f')],'type':_0x34b0e1[_0x4eff('0x30')][_0x4eff('0x31')]};});_0x15278d[_0x4eff('0x32')]=_[_0x4eff('0x2d')](_0x29ae0f,_0x4eff('0x2a'));_0x15278d['query']=_[_0x4eff('0x33')](_0x550100['query']);_0x15278d[_0x4eff('0x34')]=_['intersection'](_0x15278d[_0x4eff('0x32')],_0x15278d[_0x4eff('0x35')]);_0x4aa7b0[_0x4eff('0x36')]=_[_0x4eff('0x37')](_0x15278d['model'],qs[_0x4eff('0x38')](_0x550100['query'][_0x4eff('0x38')]));_0x4aa7b0[_0x4eff('0x36')]=_0x4aa7b0[_0x4eff('0x36')][_0x4eff('0x39')]?_0x4aa7b0[_0x4eff('0x36')]:_0x15278d['model'];if(!_0x550100[_0x4eff('0x35')][_0x4eff('0x3a')](_0x4eff('0x3b'))){_0x4aa7b0[_0x4eff('0x1e')]=qs[_0x4eff('0x1e')](_0x550100[_0x4eff('0x35')]['limit']);_0x4aa7b0[_0x4eff('0x20')]=qs[_0x4eff('0x20')](_0x550100[_0x4eff('0x35')]['offset']);}_0x4aa7b0['order']=qs[_0x4eff('0x3c')](_0x550100[_0x4eff('0x35')][_0x4eff('0x3c')]);_0x4aa7b0[_0x4eff('0x3d')]=qs[_0x4eff('0x34')](_['pick'](_0x550100[_0x4eff('0x35')],_0x15278d['filters']),_0x29ae0f);if(_0x550100['query'][_0x4eff('0x3e')]){_0x4aa7b0[_0x4eff('0x3d')]=_[_0x4eff('0x3f')](_0x4aa7b0[_0x4eff('0x3d')],{'$or':_[_0x4eff('0x2d')](_0x29ae0f,function(_0xbc15eb){if(_0xbc15eb[_0x4eff('0x30')]!==_0x4eff('0x40')){var _0x5a27bf={};_0x5a27bf[_0xbc15eb[_0x4eff('0x2a')]]={'$like':'%'+_0x550100[_0x4eff('0x35')]['filter']+'%'};return _0x5a27bf;}})});}_0x4aa7b0=_[_0x4eff('0x3f')]({},_0x4aa7b0,_0x550100[_0x4eff('0x41')]);var _0x541772={'where':_0x4aa7b0['where']};return db[_0x4eff('0x42')]['count'](_0x541772)['then'](function(_0x4a5d09){_0xc8abab[_0x4eff('0x1f')]=_0x4a5d09;if(_0x550100[_0x4eff('0x35')][_0x4eff('0x43')]){_0x4aa7b0['include']=[{'all':!![]}];}return db[_0x4eff('0x42')][_0x4eff('0x44')](_0x4aa7b0);})[_0x4eff('0x27')](function(_0x40921a){_0xc8abab[_0x4eff('0x45')]=_0x40921a;return _0xc8abab;})[_0x4eff('0x27')](respondWithFilteredResult(_0x310da5,_0x4aa7b0))['catch'](handleError(_0x310da5,null));};exports['show']=function(_0x4d67c3,_0x4f6263){var _0x12f9ad={'raw':!![],'where':{'id':_0x4d67c3['params']['id']}},_0x2e3e6c={};_0x2e3e6c[_0x4eff('0x32')]=_[_0x4eff('0x33')](db[_0x4eff('0x42')][_0x4eff('0x2e')]);_0x2e3e6c[_0x4eff('0x35')]=_[_0x4eff('0x33')](_0x4d67c3['query']);_0x2e3e6c[_0x4eff('0x34')]=_[_0x4eff('0x37')](_0x2e3e6c[_0x4eff('0x32')],_0x2e3e6c[_0x4eff('0x35')]);_0x12f9ad[_0x4eff('0x36')]=_[_0x4eff('0x37')](_0x2e3e6c['model'],qs[_0x4eff('0x38')](_0x4d67c3[_0x4eff('0x35')][_0x4eff('0x38')]));_0x12f9ad[_0x4eff('0x36')]=_0x12f9ad[_0x4eff('0x36')][_0x4eff('0x39')]?_0x12f9ad[_0x4eff('0x36')]:_0x2e3e6c[_0x4eff('0x32')];if(_0x4d67c3[_0x4eff('0x35')]['includeAll']){_0x12f9ad[_0x4eff('0x46')]=[{'all':!![]}];}_0x12f9ad=_['merge']({},_0x12f9ad,_0x4d67c3[_0x4eff('0x41')]);return db[_0x4eff('0x42')][_0x4eff('0x47')](_0x12f9ad)[_0x4eff('0x27')](handleEntityNotFound(_0x4f6263,null))[_0x4eff('0x27')](respondWithResult(_0x4f6263,null))[_0x4eff('0x48')](handleError(_0x4f6263,null));};exports['create']=function(_0xdfab10,_0x120b31){return db[_0x4eff('0x42')][_0x4eff('0x49')](_0xdfab10[_0x4eff('0x4a')],{})[_0x4eff('0x27')](respondWithResult(_0x120b31,0xc9))[_0x4eff('0x48')](handleError(_0x120b31,null));};exports['update']=function(_0x5759b9,_0x36d1a8){if(_0x5759b9[_0x4eff('0x4a')]['id']){delete _0x5759b9[_0x4eff('0x4a')]['id'];}return db['SalesforceField'][_0x4eff('0x47')]({'where':{'id':_0x5759b9[_0x4eff('0x4b')]['id']}})[_0x4eff('0x27')](handleEntityNotFound(_0x36d1a8,null))['then'](saveUpdates(_0x5759b9[_0x4eff('0x4a')],null))[_0x4eff('0x27')](respondWithResult(_0x36d1a8,null))[_0x4eff('0x48')](handleError(_0x36d1a8,null));};exports[_0x4eff('0x28')]=function(_0x4f4c5e,_0x355baa){return db[_0x4eff('0x42')]['find']({'where':{'id':_0x4f4c5e[_0x4eff('0x4b')]['id']}})['then'](handleEntityNotFound(_0x355baa,null))[_0x4eff('0x27')](removeEntity(_0x355baa,null))[_0x4eff('0x48')](handleError(_0x355baa,null));}; \ No newline at end of file +var _0x49c5=['apply','reject','save','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','then','rows','catch','show','params','keys','includeAll','find','create','body','update','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','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','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49c5,0x76));var _0x549c=function(_0x6ed220,_0x37b346){_0x6ed220=_0x6ed220-0x0;var _0x4fe6f1=_0x49c5[_0x6ed220];return _0x4fe6f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x549c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x549c('0x1'));var rp=require(_0x549c('0x2'));var moment=require(_0x549c('0x3'));var BPromise=require(_0x549c('0x4'));var Mustache=require(_0x549c('0x5'));var util=require(_0x549c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x549c('0x7'));var ejs=require(_0x549c('0x8'));var fs=require('fs');var fs_extra=require(_0x549c('0x9'));var _=require(_0x549c('0xa'));var squel=require('squel');var crypto=require(_0x549c('0xb'));var jsforce=require(_0x549c('0xc'));var deskjs=require(_0x549c('0xd'));var toCsv=require(_0x549c('0x7'));var querystring=require(_0x549c('0xe'));var Papa=require('papaparse');var Redis=require(_0x549c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x549c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x549c('0x11'));var logger=require(_0x549c('0x12'))(_0x549c('0x13'));var utils=require(_0x549c('0x14'));var config=require(_0x549c('0x15'));var licenseUtil=require(_0x549c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b80ed,_0x32e638){_0x32e638=_0x32e638||0xcc;return function(_0x2f683a){if(_0x2f683a){return _0x3b80ed[_0x549c('0x17')](_0x32e638);}return _0x3b80ed['status'](_0x32e638)[_0x549c('0x18')]();};}function respondWithResult(_0x11a854,_0x148fd0){_0x148fd0=_0x148fd0||0xc8;return function(_0x591a82){if(_0x591a82){return _0x11a854[_0x549c('0x19')](_0x148fd0)['json'](_0x591a82);}};}function respondWithFilteredResult(_0x17420b,_0x157dd9){return function(_0x47eb97){if(_0x47eb97){var _0x3fd840=typeof _0x157dd9[_0x549c('0x1a')]==='undefined'&&typeof _0x157dd9['limit']===_0x549c('0x1b');var _0x2914dc=_0x47eb97[_0x549c('0x1c')];var _0x6ce6f1=_0x3fd840?0x0:_0x157dd9[_0x549c('0x1a')];var _0x326ac9=_0x3fd840?_0x47eb97['count']:_0x157dd9[_0x549c('0x1a')]+_0x157dd9[_0x549c('0x1d')];var _0x3d4dce;if(_0x326ac9>=_0x2914dc){_0x326ac9=_0x2914dc;_0x3d4dce=0xc8;}else{_0x3d4dce=0xce;}_0x17420b['status'](_0x3d4dce);return _0x17420b[_0x549c('0x1e')](_0x549c('0x1f'),_0x6ce6f1+'-'+_0x326ac9+'/'+_0x2914dc)['json'](_0x47eb97);}return null;};}function patchUpdates(_0x967efc){return function(_0xcb6186){try{jsonpatch[_0x549c('0x20')](_0xcb6186,_0x967efc,!![]);}catch(_0x4126af){return BPromise[_0x549c('0x21')](_0x4126af);}return _0xcb6186[_0x549c('0x22')]();};}function saveUpdates(_0x53849e,_0x3ffdb3){return function(_0x570c50){if(_0x570c50){return _0x570c50['update'](_0x53849e)['then'](function(_0x45cd26){return _0x45cd26;});}return null;};}function removeEntity(_0x65c77d,_0x5e26f8){return function(_0x429f42){if(_0x429f42){return _0x429f42[_0x549c('0x23')]()['then'](function(){_0x65c77d['status'](0xcc)[_0x549c('0x18')]();});}};}function handleEntityNotFound(_0x38e301,_0x4d656c){return function(_0xc5b8eb){if(!_0xc5b8eb){_0x38e301['sendStatus'](0x194);}return _0xc5b8eb;};}function handleError(_0x590f70,_0x20f62f){_0x20f62f=_0x20f62f||0x1f4;return function(_0x9243fb){logger[_0x549c('0x24')](_0x9243fb[_0x549c('0x25')]);if(_0x9243fb[_0x549c('0x26')]){delete _0x9243fb[_0x549c('0x26')];}_0x590f70[_0x549c('0x19')](_0x20f62f)[_0x549c('0x27')](_0x9243fb);};}exports[_0x549c('0x28')]=function(_0x37fb70,_0x54fa77){var _0x594d3f={},_0x13df1b={},_0x40a5db={'count':0x0,'rows':[]};var _0x28d028=_[_0x549c('0x29')](db[_0x549c('0x2a')][_0x549c('0x2b')],function(_0x1f70d0){return{'name':_0x1f70d0[_0x549c('0x2c')],'type':_0x1f70d0[_0x549c('0x2d')][_0x549c('0x2e')]};});_0x13df1b['model']=_[_0x549c('0x29')](_0x28d028,_0x549c('0x26'));_0x13df1b[_0x549c('0x2f')]=_['keys'](_0x37fb70[_0x549c('0x2f')]);_0x13df1b[_0x549c('0x30')]=_[_0x549c('0x31')](_0x13df1b['model'],_0x13df1b[_0x549c('0x2f')]);_0x594d3f['attributes']=_[_0x549c('0x31')](_0x13df1b[_0x549c('0x32')],qs[_0x549c('0x33')](_0x37fb70['query'][_0x549c('0x33')]));_0x594d3f['attributes']=_0x594d3f[_0x549c('0x34')][_0x549c('0x35')]?_0x594d3f[_0x549c('0x34')]:_0x13df1b['model'];if(!_0x37fb70[_0x549c('0x2f')]['hasOwnProperty'](_0x549c('0x36'))){_0x594d3f['limit']=qs[_0x549c('0x1d')](_0x37fb70[_0x549c('0x2f')][_0x549c('0x1d')]);_0x594d3f['offset']=qs[_0x549c('0x1a')](_0x37fb70[_0x549c('0x2f')][_0x549c('0x1a')]);}_0x594d3f[_0x549c('0x37')]=qs[_0x549c('0x38')](_0x37fb70['query']['sort']);_0x594d3f[_0x549c('0x39')]=qs[_0x549c('0x30')](_[_0x549c('0x3a')](_0x37fb70['query'],_0x13df1b['filters']),_0x28d028);if(_0x37fb70['query']['filter']){_0x594d3f[_0x549c('0x39')]=_[_0x549c('0x3b')](_0x594d3f[_0x549c('0x39')],{'$or':_[_0x549c('0x29')](_0x28d028,function(_0x253d32){if(_0x253d32[_0x549c('0x2d')]!==_0x549c('0x3c')){var _0x2cd436={};_0x2cd436[_0x253d32[_0x549c('0x26')]]={'$like':'%'+_0x37fb70[_0x549c('0x2f')][_0x549c('0x3d')]+'%'};return _0x2cd436;}})});}_0x594d3f=_['merge']({},_0x594d3f,_0x37fb70[_0x549c('0x3e')]);var _0x4c3615={'where':_0x594d3f[_0x549c('0x39')]};return db[_0x549c('0x2a')][_0x549c('0x1c')](_0x4c3615)['then'](function(_0x322de4){_0x40a5db[_0x549c('0x1c')]=_0x322de4;if(_0x37fb70[_0x549c('0x2f')]['includeAll']){_0x594d3f[_0x549c('0x3f')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x594d3f);})[_0x549c('0x40')](function(_0x4898ec){_0x40a5db[_0x549c('0x41')]=_0x4898ec;return _0x40a5db;})['then'](respondWithFilteredResult(_0x54fa77,_0x594d3f))[_0x549c('0x42')](handleError(_0x54fa77,null));};exports[_0x549c('0x43')]=function(_0x8ceda7,_0x4cd4b9){var _0x1d68fe={'raw':!![],'where':{'id':_0x8ceda7[_0x549c('0x44')]['id']}},_0x5b4f82={};_0x5b4f82[_0x549c('0x32')]=_[_0x549c('0x45')](db[_0x549c('0x2a')][_0x549c('0x2b')]);_0x5b4f82['query']=_['keys'](_0x8ceda7[_0x549c('0x2f')]);_0x5b4f82[_0x549c('0x30')]=_[_0x549c('0x31')](_0x5b4f82[_0x549c('0x32')],_0x5b4f82['query']);_0x1d68fe[_0x549c('0x34')]=_[_0x549c('0x31')](_0x5b4f82[_0x549c('0x32')],qs[_0x549c('0x33')](_0x8ceda7['query'][_0x549c('0x33')]));_0x1d68fe[_0x549c('0x34')]=_0x1d68fe['attributes'][_0x549c('0x35')]?_0x1d68fe[_0x549c('0x34')]:_0x5b4f82[_0x549c('0x32')];if(_0x8ceda7[_0x549c('0x2f')][_0x549c('0x46')]){_0x1d68fe[_0x549c('0x3f')]=[{'all':!![]}];}_0x1d68fe=_[_0x549c('0x3b')]({},_0x1d68fe,_0x8ceda7['options']);return db[_0x549c('0x2a')][_0x549c('0x47')](_0x1d68fe)[_0x549c('0x40')](handleEntityNotFound(_0x4cd4b9,null))[_0x549c('0x40')](respondWithResult(_0x4cd4b9,null))['catch'](handleError(_0x4cd4b9,null));};exports['create']=function(_0x19a25a,_0x3aff7f){return db[_0x549c('0x2a')][_0x549c('0x48')](_0x19a25a[_0x549c('0x49')],{})['then'](respondWithResult(_0x3aff7f,0xc9))[_0x549c('0x42')](handleError(_0x3aff7f,null));};exports[_0x549c('0x4a')]=function(_0x410eb5,_0x36cca5){if(_0x410eb5[_0x549c('0x49')]['id']){delete _0x410eb5[_0x549c('0x49')]['id'];}return db[_0x549c('0x2a')][_0x549c('0x47')]({'where':{'id':_0x410eb5['params']['id']}})[_0x549c('0x40')](handleEntityNotFound(_0x36cca5,null))['then'](saveUpdates(_0x410eb5[_0x549c('0x49')],null))[_0x549c('0x40')](respondWithResult(_0x36cca5,null))[_0x549c('0x42')](handleError(_0x36cca5,null));};exports[_0x549c('0x23')]=function(_0x1623db,_0x586bc4){return db[_0x549c('0x2a')][_0x549c('0x47')]({'where':{'id':_0x1623db['params']['id']}})[_0x549c('0x40')](handleEntityNotFound(_0x586bc4,null))[_0x549c('0x40')](removeEntity(_0x586bc4,null))['catch'](handleError(_0x586bc4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ff48429..c16e95f 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 _0xf683=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports'];(function(_0x33b2d2,_0x481a84){var _0x340674=function(_0x26142e){while(--_0x26142e){_0x33b2d2['push'](_0x33b2d2['shift']());}};_0x340674(++_0x481a84);}(_0xf683,0xd8));var _0x3f68=function(_0x392f83,_0x514944){_0x392f83=_0x392f83-0x0;var _0x45f9d7=_0xf683[_0x392f83];return _0x45f9d7;};'use strict';var _=require('lodash');var util=require(_0x3f68('0x0'));var logger=require(_0x3f68('0x1'))('api');var moment=require(_0x3f68('0x2'));var BPromise=require(_0x3f68('0x3'));var rp=require(_0x3f68('0x4'));var fs=require('fs');var path=require(_0x3f68('0x5'));var rimraf=require(_0x3f68('0x6'));var config=require('../../config/environment');var attributes=require(_0x3f68('0x7'));module[_0x3f68('0x8')]=function(_0x53cedd,_0x492e00){return _0x53cedd[_0x3f68('0x9')](_0x3f68('0xa'),attributes,{'tableName':_0x3f68('0xb'),'paranoid':![],'indexes':[{'name':_0x3f68('0xc'),'fields':[_0x3f68('0xd'),_0x3f68('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ae2=['exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x4ae2,0xab));var _0x24ae=function(_0x414a33,_0x5bf179){_0x414a33=_0x414a33-0x0;var _0x1922bd=_0x4ae2[_0x414a33];return _0x1922bd;};'use strict';var _=require('lodash');var util=require(_0x24ae('0x0'));var logger=require('../../config/logger')(_0x24ae('0x1'));var moment=require(_0x24ae('0x2'));var BPromise=require(_0x24ae('0x3'));var rp=require(_0x24ae('0x4'));var fs=require('fs');var path=require(_0x24ae('0x5'));var rimraf=require(_0x24ae('0x6'));var config=require(_0x24ae('0x7'));var attributes=require(_0x24ae('0x8'));module[_0x24ae('0x9')]=function(_0x590f44,_0x1d9ee8){return _0x590f44[_0x24ae('0xa')]('SalesforceField',attributes,{'tableName':_0x24ae('0xb'),'paranoid':![],'indexes':[{'name':_0x24ae('0xc'),'fields':[_0x24ae('0xd'),_0x24ae('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 6eae65a..f6eba4f 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 _0x67ff=['rpc','../../config/environment','client','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5d6280,_0x3f72ab){var _0x77b738=function(_0x1b8208){while(--_0x1b8208){_0x5d6280['push'](_0x5d6280['shift']());}};_0x77b738(++_0x3f72ab);}(_0x67ff,0x12b));var _0xf67f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x67ff[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf67f('0x0'));var util=require(_0xf67f('0x1'));var moment=require(_0xf67f('0x2'));var BPromise=require(_0xf67f('0x3'));var rs=require(_0xf67f('0x4'));var fs=require('fs');var Redis=require(_0xf67f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf67f('0x6'));var logger=require('../../config/logger')(_0xf67f('0x7'));var config=require(_0xf67f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf67f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8156,_0x3dc353,_0x443d4b){return new BPromise(function(_0xd7b8cd,_0x3c0da7){return client[_0xf67f('0xa')](_0x2a8156,_0x443d4b)['then'](function(_0x451cd1){logger[_0xf67f('0xb')](_0xf67f('0xc'),_0x3dc353,_0xf67f('0xd'));logger['debug'](_0xf67f('0xe'),_0x3dc353,'request\x20sent',JSON['stringify'](_0x451cd1));if(_0x451cd1[_0xf67f('0xf')]){if(_0x451cd1[_0xf67f('0xf')]['code']===0x1f4){logger[_0xf67f('0xf')]('SalesforceField,\x20%s,\x20%s',_0x3dc353,_0x451cd1[_0xf67f('0xf')][_0xf67f('0x10')]);return _0x3c0da7(_0x451cd1[_0xf67f('0xf')][_0xf67f('0x10')]);}logger['error'](_0xf67f('0xc'),_0x3dc353,_0x451cd1['error'][_0xf67f('0x10')]);return _0xd7b8cd(_0x451cd1['error'][_0xf67f('0x10')]);}else{logger[_0xf67f('0xb')](_0xf67f('0xc'),_0x3dc353,_0xf67f('0xd'));_0xd7b8cd(_0x451cd1[_0xf67f('0x11')]['message']);}})['catch'](function(_0xd9c27d){logger[_0xf67f('0xf')]('SalesforceField,\x20%s,\x20%s',_0x3dc353,_0xd9c27d);_0x3c0da7(_0xd9c27d);});});} \ No newline at end of file +var _0x93e4=['debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','SalesforceField,\x20%s,\x20%s'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x93e4,0x124));var _0x493e=function(_0xc26950,_0x2d7860){_0xc26950=_0xc26950-0x0;var _0x1f2293=_0x93e4[_0xc26950];return _0x1f2293;};'use strict';var _=require('lodash');var util=require(_0x493e('0x0'));var moment=require(_0x493e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x493e('0x2'));var db=require(_0x493e('0x3'))['db'];var utils=require(_0x493e('0x4'));var logger=require('../../config/logger')(_0x493e('0x5'));var config=require(_0x493e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x493e('0x7')][_0x493e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x481005,_0x14c887,_0x425142){return new BPromise(function(_0x3f973d,_0x113d26){return client[_0x493e('0x9')](_0x481005,_0x425142)['then'](function(_0x1d453a){logger[_0x493e('0xa')](_0x493e('0xb'),_0x14c887,'request\x20sent');logger[_0x493e('0xc')](_0x493e('0xd'),_0x14c887,'request\x20sent',JSON[_0x493e('0xe')](_0x1d453a));if(_0x1d453a[_0x493e('0xf')]){if(_0x1d453a[_0x493e('0xf')]['code']===0x1f4){logger[_0x493e('0xf')](_0x493e('0xb'),_0x14c887,_0x1d453a[_0x493e('0xf')][_0x493e('0x10')]);return _0x113d26(_0x1d453a['error'][_0x493e('0x10')]);}logger[_0x493e('0xf')](_0x493e('0xb'),_0x14c887,_0x1d453a[_0x493e('0xf')]['message']);return _0x3f973d(_0x1d453a[_0x493e('0xf')][_0x493e('0x10')]);}else{logger[_0x493e('0xa')](_0x493e('0xb'),_0x14c887,_0x493e('0x11'));_0x3f973d(_0x1d453a[_0x493e('0x12')][_0x493e('0x10')]);}})['catch'](function(_0x310c87){logger['error'](_0x493e('0xb'),_0x14c887,_0x310c87);_0x113d26(_0x310c87);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ab0a075..022bc8f 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 _0x2333=['../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0x2333,0x11a));var _0x3233=function(_0x31b3aa,_0x3bbbd6){_0x31b3aa=_0x31b3aa-0x0;var _0x2c1c3c=_0x2333[_0x31b3aa];return _0x2c1c3c;};'use strict';var multer=require(_0x3233('0x0'));var util=require(_0x3233('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3233('0x2'));var router=express[_0x3233('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3233('0x4'));var interaction=require(_0x3233('0x5'));var config=require(_0x3233('0x6'));var controller=require(_0x3233('0x7'));router[_0x3233('0x8')]('/',auth[_0x3233('0x9')](),controller[_0x3233('0xa')]);router[_0x3233('0x8')](_0x3233('0xb'),auth[_0x3233('0x9')](),controller[_0x3233('0xc')]);router[_0x3233('0x8')](_0x3233('0xd'),auth[_0x3233('0x9')](),controller[_0x3233('0xe')]);router[_0x3233('0x8')](_0x3233('0xf'),auth[_0x3233('0x9')](),controller[_0x3233('0x10')]);router[_0x3233('0x11')]('/',auth[_0x3233('0x9')](),controller['create']);router[_0x3233('0x11')](_0x3233('0xd'),auth[_0x3233('0x9')](),controller[_0x3233('0x12')]);router[_0x3233('0x13')](_0x3233('0xb'),auth[_0x3233('0x9')](),controller[_0x3233('0x14')]);router[_0x3233('0x15')](_0x3233('0xb'),auth[_0x3233('0x9')](),controller[_0x3233('0x16')]);module[_0x3233('0x17')]=router; \ No newline at end of file +var _0x41fc=['../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x221ded,_0x8db221){var _0x306cba=function(_0x1eb990){while(--_0x1eb990){_0x221ded['push'](_0x221ded['shift']());}};_0x306cba(++_0x8db221);}(_0x41fc,0x1c6));var _0xc41f=function(_0x3ae0a4,_0x4716a5){_0x3ae0a4=_0x3ae0a4-0x0;var _0x475f7a=_0x41fc[_0x3ae0a4];return _0x475f7a;};'use strict';var multer=require(_0xc41f('0x0'));var util=require(_0xc41f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc41f('0x2'));var router=express[_0xc41f('0x3')]();var fs_extra=require(_0xc41f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc41f('0x5'));var config=require(_0xc41f('0x6'));var controller=require(_0xc41f('0x7'));router['get']('/',auth[_0xc41f('0x8')](),controller[_0xc41f('0x9')]);router[_0xc41f('0xa')](_0xc41f('0xb'),auth[_0xc41f('0x8')](),controller[_0xc41f('0xc')]);router[_0xc41f('0xa')](_0xc41f('0xd'),auth['isAuthenticated'](),controller[_0xc41f('0xe')]);router[_0xc41f('0xa')](_0xc41f('0xf'),auth[_0xc41f('0x8')](),controller[_0xc41f('0x10')]);router[_0xc41f('0x11')]('/',auth['isAuthenticated'](),controller[_0xc41f('0x12')]);router[_0xc41f('0x11')](_0xc41f('0xd'),auth[_0xc41f('0x8')](),controller[_0xc41f('0x13')]);router['put'](_0xc41f('0xb'),auth[_0xc41f('0x8')](),controller[_0xc41f('0x14')]);router[_0xc41f('0x15')](_0xc41f('0xb'),auth[_0xc41f('0x8')](),controller[_0xc41f('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 97f86da..20b2ed1 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 _0xca96=['remoteUri','sequelize','exports','STRING','username'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xca96,0x1d7));var _0x6ca9=function(_0x5deba6,_0xd6c3fc){_0x5deba6=_0x5deba6-0x0;var _0xa47c5b=_0xca96[_0x5deba6];return _0xa47c5b;};'use strict';var Sequelize=require(_0x6ca9('0x0'));module[_0x6ca9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6ca9('0x2')],'unique':_0x6ca9('0x3')},'password':{'type':Sequelize[_0x6ca9('0x2')]},'email':{'type':Sequelize[_0x6ca9('0x2')]},'remoteUri':{'type':Sequelize[_0x6ca9('0x2')],'unique':_0x6ca9('0x4')},'serverUrl':{'type':Sequelize[_0x6ca9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xabba=['exports','STRING','username','sequelize'];(function(_0x3a3fcc,_0x38afb3){var _0xe16438=function(_0x2280b4){while(--_0x2280b4){_0x3a3fcc['push'](_0x3a3fcc['shift']());}};_0xe16438(++_0x38afb3);}(_0xabba,0x1cf));var _0xaabb=function(_0x3b774c,_0x417044){_0x3b774c=_0x3b774c-0x0;var _0x19c36a=_0xabba[_0x3b774c];return _0x19c36a;};'use strict';var Sequelize=require(_0xaabb('0x0'));module[_0xaabb('0x1')]={'name':{'type':Sequelize[_0xaabb('0x2')]},'description':{'type':Sequelize[_0xaabb('0x2')]},'username':{'type':Sequelize[_0xaabb('0x2')],'unique':_0xaabb('0x3')},'password':{'type':Sequelize[_0xaabb('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xaabb('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index f73924e..3c8d2b0 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 _0xdba9=['incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','assign','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','boolean','true','False','false','inactive','value','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','attributes','length','model','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','ServicenowAccount','includeAll','rows','show','params','fields','include','find','catch','create','body','findOne','ServicenowConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','getDescriptions','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','watch_list','sys_updated_on','approval_history','number','sys_updated_by','opened_by','user_input','state','sys_created_by','order','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','business_duration','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','assignment_group','calendar_duration','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result'];(function(_0x3f5f02,_0x522703){var _0x36cbc7=function(_0x2f77c3){while(--_0x2f77c3){_0x3f5f02['push'](_0x3f5f02['shift']());}};_0x36cbc7(++_0x522703);}(_0xdba9,0x17d));var _0x9dba=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xdba9[_0x25248b];return _0x509939;};'use strict';var emlformat=require(_0x9dba('0x0'));var rimraf=require(_0x9dba('0x1'));var zipdir=require(_0x9dba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9dba('0x3'));var BPromise=require(_0x9dba('0x4'));var Mustache=require(_0x9dba('0x5'));var util=require(_0x9dba('0x6'));var path=require(_0x9dba('0x7'));var sox=require(_0x9dba('0x8'));var csv=require(_0x9dba('0x9'));var ejs=require(_0x9dba('0xa'));var fs=require('fs');var fs_extra=require(_0x9dba('0xb'));var _=require(_0x9dba('0xc'));var squel=require(_0x9dba('0xd'));var crypto=require(_0x9dba('0xe'));var jsforce=require(_0x9dba('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9dba('0x10'));var Papa=require(_0x9dba('0x11'));var Redis=require(_0x9dba('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9dba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9dba('0x14'))('api');var utils=require(_0x9dba('0x15'));var config=require(_0x9dba('0x16'));var licenseUtil=require(_0x9dba('0x17'));var db=require(_0x9dba('0x18'))['db'];var integrations=require(_0x9dba('0x19'));function respondWithStatusCode(_0x4992c3,_0x348623){_0x348623=_0x348623||0xcc;return function(_0x285242){if(_0x285242){return _0x4992c3['sendStatus'](_0x348623);}return _0x4992c3[_0x9dba('0x1a')](_0x348623)[_0x9dba('0x1b')]();};}function respondWithResult(_0x37dbd0,_0x3e8100){_0x3e8100=_0x3e8100||0xc8;return function(_0x42bc8d){if(_0x42bc8d){return _0x37dbd0[_0x9dba('0x1a')](_0x3e8100)[_0x9dba('0x1c')](_0x42bc8d);}};}function respondWithFilteredResult(_0x4ee638,_0xae2bc9){return function(_0x42ad68){if(_0x42ad68){var _0x4347ab=typeof _0xae2bc9[_0x9dba('0x1d')]==='undefined'&&typeof _0xae2bc9[_0x9dba('0x1e')]==='undefined';var _0x1473ed=_0x42ad68[_0x9dba('0x1f')];var _0x5c9ebc=_0x4347ab?0x0:_0xae2bc9[_0x9dba('0x1d')];var _0x32e6ed=_0x4347ab?_0x42ad68[_0x9dba('0x1f')]:_0xae2bc9[_0x9dba('0x1d')]+_0xae2bc9['limit'];var _0x6a5736;if(_0x32e6ed>=_0x1473ed){_0x32e6ed=_0x1473ed;_0x6a5736=0xc8;}else{_0x6a5736=0xce;}_0x4ee638[_0x9dba('0x1a')](_0x6a5736);return _0x4ee638[_0x9dba('0x20')](_0x9dba('0x21'),_0x5c9ebc+'-'+_0x32e6ed+'/'+_0x1473ed)['json'](_0x42ad68);}return null;};}function patchUpdates(_0x468742){return function(_0x1e492e){try{jsonpatch[_0x9dba('0x22')](_0x1e492e,_0x468742,!![]);}catch(_0x18f18e){return BPromise[_0x9dba('0x23')](_0x18f18e);}return _0x1e492e['save']();};}function saveUpdates(_0x46d135,_0x529137){return function(_0x13ee74){if(_0x13ee74){return _0x13ee74[_0x9dba('0x24')](_0x46d135)['then'](function(_0x112154){return _0x112154;});}return null;};}function removeEntity(_0x4f0ca1,_0x56944d){return function(_0xc5abaa){if(_0xc5abaa){return _0xc5abaa[_0x9dba('0x25')]()[_0x9dba('0x26')](function(){_0x4f0ca1['status'](0xcc)[_0x9dba('0x1b')]();});}};}function handleEntityNotFound(_0x31fe69,_0x2e08d9){return function(_0x12fb29){if(!_0x12fb29){_0x31fe69[_0x9dba('0x27')](0x194);}return _0x12fb29;};}function handleError(_0x4d6258,_0x429c89){_0x429c89=_0x429c89||0x1f4;return function(_0x280ab8){logger[_0x9dba('0x28')](_0x280ab8[_0x9dba('0x29')]);if(_0x280ab8['name']){delete _0x280ab8[_0x9dba('0x2a')];}_0x4d6258[_0x9dba('0x1a')](_0x429c89)[_0x9dba('0x2b')](_0x280ab8);};}exports[_0x9dba('0x2c')]=function(_0x4a9a0e,_0x336f5e){var _0x28012f={},_0x370d54={},_0x1f7882={'count':0x0,'rows':[]};var _0x43aac8=_[_0x9dba('0x2d')](db['ServicenowAccount'][_0x9dba('0x2e')],function(_0x38bd1b){return{'name':_0x38bd1b[_0x9dba('0x2f')],'type':_0x38bd1b['type'][_0x9dba('0x30')]};});_0x370d54['model']=_['map'](_0x43aac8,_0x9dba('0x2a'));_0x370d54[_0x9dba('0x31')]=_[_0x9dba('0x32')](_0x4a9a0e['query']);_0x370d54['filters']=_[_0x9dba('0x33')](_0x370d54['model'],_0x370d54[_0x9dba('0x31')]);_0x28012f[_0x9dba('0x34')]=_[_0x9dba('0x33')](_0x370d54['model'],qs['fields'](_0x4a9a0e[_0x9dba('0x31')]['fields']));_0x28012f[_0x9dba('0x34')]=_0x28012f[_0x9dba('0x34')][_0x9dba('0x35')]?_0x28012f[_0x9dba('0x34')]:_0x370d54[_0x9dba('0x36')];if(!_0x4a9a0e[_0x9dba('0x31')][_0x9dba('0x37')](_0x9dba('0x38'))){_0x28012f[_0x9dba('0x1e')]=qs[_0x9dba('0x1e')](_0x4a9a0e['query'][_0x9dba('0x1e')]);_0x28012f['offset']=qs[_0x9dba('0x1d')](_0x4a9a0e['query'][_0x9dba('0x1d')]);}_0x28012f['order']=qs[_0x9dba('0x39')](_0x4a9a0e['query'][_0x9dba('0x39')]);_0x28012f['where']=qs[_0x9dba('0x3a')](_['pick'](_0x4a9a0e[_0x9dba('0x31')],_0x370d54[_0x9dba('0x3a')]),_0x43aac8);if(_0x4a9a0e[_0x9dba('0x31')][_0x9dba('0x3b')]){_0x28012f[_0x9dba('0x3c')]=_[_0x9dba('0x3d')](_0x28012f['where'],{'$or':_[_0x9dba('0x2d')](_0x43aac8,function(_0xc5f04f){if(_0xc5f04f['type']!==_0x9dba('0x3e')){var _0x37f9b7={};_0x37f9b7[_0xc5f04f[_0x9dba('0x2a')]]={'$like':'%'+_0x4a9a0e['query']['filter']+'%'};return _0x37f9b7;}})});}_0x28012f=_[_0x9dba('0x3d')]({},_0x28012f,_0x4a9a0e[_0x9dba('0x3f')]);var _0x7512f4={'where':_0x28012f[_0x9dba('0x3c')]};return db[_0x9dba('0x40')][_0x9dba('0x1f')](_0x7512f4)[_0x9dba('0x26')](function(_0x187813){_0x1f7882['count']=_0x187813;if(_0x4a9a0e['query'][_0x9dba('0x41')]){_0x28012f['include']=[{'all':!![]}];}return db[_0x9dba('0x40')]['findAll'](_0x28012f);})[_0x9dba('0x26')](function(_0x5bdd24){_0x1f7882[_0x9dba('0x42')]=_0x5bdd24;return _0x1f7882;})[_0x9dba('0x26')](respondWithFilteredResult(_0x336f5e,_0x28012f))['catch'](handleError(_0x336f5e,null));};exports[_0x9dba('0x43')]=function(_0x4d46e9,_0x302140){var _0x155d92={'raw':![],'where':{'id':_0x4d46e9[_0x9dba('0x44')]['id']}},_0x288da4={};_0x288da4[_0x9dba('0x36')]=_['keys'](db[_0x9dba('0x40')][_0x9dba('0x2e')]);_0x288da4[_0x9dba('0x31')]=_[_0x9dba('0x32')](_0x4d46e9[_0x9dba('0x31')]);_0x288da4[_0x9dba('0x3a')]=_[_0x9dba('0x33')](_0x288da4['model'],_0x288da4[_0x9dba('0x31')]);_0x155d92[_0x9dba('0x34')]=_[_0x9dba('0x33')](_0x288da4[_0x9dba('0x36')],qs[_0x9dba('0x45')](_0x4d46e9[_0x9dba('0x31')][_0x9dba('0x45')]));_0x155d92[_0x9dba('0x34')]=_0x155d92[_0x9dba('0x34')][_0x9dba('0x35')]?_0x155d92[_0x9dba('0x34')]:_0x288da4[_0x9dba('0x36')];if(_0x4d46e9[_0x9dba('0x31')][_0x9dba('0x41')]){_0x155d92[_0x9dba('0x46')]=[{'all':!![]}];}_0x155d92=_[_0x9dba('0x3d')]({},_0x155d92,_0x4d46e9[_0x9dba('0x3f')]);return db['ServicenowAccount'][_0x9dba('0x47')](_0x155d92)[_0x9dba('0x26')](handleEntityNotFound(_0x302140,null))['then'](respondWithResult(_0x302140,null))[_0x9dba('0x48')](handleError(_0x302140,null));};exports[_0x9dba('0x49')]=function(_0x574877,_0x3a41d1){return db[_0x9dba('0x40')][_0x9dba('0x49')](_0x574877[_0x9dba('0x4a')],{})['then'](respondWithResult(_0x3a41d1,0xc9))['catch'](handleError(_0x3a41d1,null));};exports[_0x9dba('0x24')]=function(_0x5ae914,_0x54ab2c){if(_0x5ae914[_0x9dba('0x4a')]['id']){delete _0x5ae914[_0x9dba('0x4a')]['id'];}return db[_0x9dba('0x40')]['find']({'where':{'id':_0x5ae914['params']['id']}})['then'](handleEntityNotFound(_0x54ab2c,null))['then'](saveUpdates(_0x5ae914[_0x9dba('0x4a')],null))[_0x9dba('0x26')](respondWithResult(_0x54ab2c,null))[_0x9dba('0x48')](handleError(_0x54ab2c,null));};exports[_0x9dba('0x25')]=function(_0x4b47d6,_0x422220){return db['ServicenowAccount'][_0x9dba('0x47')]({'where':{'id':_0x4b47d6[_0x9dba('0x44')]['id']}})[_0x9dba('0x26')](handleEntityNotFound(_0x422220,null))[_0x9dba('0x26')](removeEntity(_0x422220,null))[_0x9dba('0x48')](handleError(_0x422220,null));};exports['getConfigurations']=function(_0x57120d,_0xf6af83,_0x53c3ea){var _0xc2a01c={};var _0x515549={};var _0x3310d4;var _0x24b069;return db[_0x9dba('0x40')][_0x9dba('0x4b')]({'where':{'id':_0x57120d[_0x9dba('0x44')]['id']}})[_0x9dba('0x26')](handleEntityNotFound(_0xf6af83,null))['then'](function(_0x4336f2){if(_0x4336f2){_0x3310d4=_0x4336f2;_0x515549[_0x9dba('0x36')]=_[_0x9dba('0x32')](db[_0x9dba('0x4c')][_0x9dba('0x2e')]);_0x515549['query']=_[_0x9dba('0x32')](_0x57120d[_0x9dba('0x31')]);_0x515549[_0x9dba('0x3a')]=_['intersection'](_0x515549[_0x9dba('0x36')],_0x515549[_0x9dba('0x31')]);_0xc2a01c[_0x9dba('0x34')]=_[_0x9dba('0x33')](_0x515549[_0x9dba('0x36')],qs[_0x9dba('0x45')](_0x57120d[_0x9dba('0x31')]['fields']));_0xc2a01c[_0x9dba('0x34')]=_0xc2a01c[_0x9dba('0x34')][_0x9dba('0x35')]?_0xc2a01c[_0x9dba('0x34')]:_0x515549[_0x9dba('0x36')];_0xc2a01c['order']=qs[_0x9dba('0x39')](_0x57120d[_0x9dba('0x31')][_0x9dba('0x39')]);_0xc2a01c[_0x9dba('0x3c')]=qs[_0x9dba('0x3a')](_[_0x9dba('0x4d')](_0x57120d[_0x9dba('0x31')],_0x515549['filters']));if(_0x57120d['query'][_0x9dba('0x3b')]){_0xc2a01c[_0x9dba('0x3c')]=_['merge'](_0xc2a01c['where'],{'$or':_[_0x9dba('0x2d')](_0xc2a01c[_0x9dba('0x34')],function(_0x4fafda){var _0x482a34={};_0x482a34[_0x4fafda]={'$like':'%'+_0x57120d['query'][_0x9dba('0x3b')]+'%'};return _0x482a34;})});}_0xc2a01c=_[_0x9dba('0x3d')]({},_0xc2a01c,_0x57120d[_0x9dba('0x3f')]);return _0x3310d4[_0x9dba('0x4e')](_0xc2a01c);}})[_0x9dba('0x26')](function(_0x2a9ecd){if(_0x2a9ecd){_0x24b069=_0x2a9ecd[_0x9dba('0x35')];if(!_0x57120d['query']['hasOwnProperty'](_0x9dba('0x38'))){_0xc2a01c[_0x9dba('0x1e')]=qs['limit'](_0x57120d[_0x9dba('0x31')]['limit']);_0xc2a01c['offset']=qs['offset'](_0x57120d[_0x9dba('0x31')]['offset']);}return _0x3310d4[_0x9dba('0x4e')](_0xc2a01c);}})[_0x9dba('0x26')](function(_0x1cb789){if(_0x1cb789){return _0x1cb789?{'count':_0x24b069,'rows':_0x1cb789}:null;}})[_0x9dba('0x26')](respondWithResult(_0xf6af83,null))[_0x9dba('0x48')](handleError(_0xf6af83,null));};exports[_0x9dba('0x4f')]=function(_0x34dacd,_0x1c6c72,_0xe47103){if(_0x34dacd[_0x9dba('0x4a')]['id']){delete _0x34dacd[_0x9dba('0x4a')]['id'];}return db[_0x9dba('0x40')]['findOne']({'where':{'id':_0x34dacd['params']['id']}})['then'](handleEntityNotFound(_0x1c6c72,null))['then'](function(_0x41d802){if(_0x41d802){_0x34dacd[_0x9dba('0x4a')][_0x9dba('0x50')]=_0x41d802['id'];_0x34dacd[_0x9dba('0x4a')][_0x9dba('0x51')]=integrations[_0x9dba('0x52')](_0x34dacd[_0x9dba('0x4a')][_0x9dba('0x53')],_0x34dacd['body'][_0x9dba('0x54')]);_0x34dacd[_0x9dba('0x4a')]['Descriptions']=integrations[_0x9dba('0x55')](_0x34dacd[_0x9dba('0x4a')]['channel'],_0x34dacd[_0x9dba('0x4a')][_0x9dba('0x54')]);return db[_0x9dba('0x4c')][_0x9dba('0x49')](_0x34dacd['body'],{'include':[{'model':db[_0x9dba('0x56')],'as':_0x9dba('0x51')},{'model':db['ServicenowField'],'as':_0x9dba('0x57')}]});}return null;})[_0x9dba('0x26')](respondWithResult(_0x1c6c72,null))['catch'](handleError(_0x1c6c72,null));};exports['getFields']=function(_0x2a17ee,_0x417a57,_0x3d02af){var _0x876450=[_0x9dba('0x58'),_0x9dba('0x59'),_0x9dba('0x5a'),_0x9dba('0x5b'),_0x9dba('0x5c'),_0x9dba('0x5d'),_0x9dba('0x5e'),_0x9dba('0x5f'),_0x9dba('0x60')];var _0x1efa40=[_0x9dba('0x61'),_0x9dba('0x58'),'caused_by',_0x9dba('0x62'),'upon_reject',_0x9dba('0x63'),'child_incidents',_0x9dba('0x59'),_0x9dba('0x64'),_0x9dba('0x65'),'resolved_by',_0x9dba('0x66'),_0x9dba('0x67'),_0x9dba('0x68'),'sys_created_on','sys_domain',_0x9dba('0x69'),_0x9dba('0x6a'),_0x9dba('0x5a'),_0x9dba('0x6b'),_0x9dba('0x6c'),_0x9dba('0x6d'),_0x9dba('0x6e'),_0x9dba('0x6f'),'impact',_0x9dba('0x70'),_0x9dba('0x71'),_0x9dba('0x72'),_0x9dba('0x73'),_0x9dba('0x74'),'rfc',_0x9dba('0x75'),_0x9dba('0x76'),'opened_at',_0x9dba('0x77'),'group_list',_0x9dba('0x78'),_0x9dba('0x79'),_0x9dba('0x7a'),_0x9dba('0x7b'),'approval_set','subcategory',_0x9dba('0x7c'),_0x9dba('0x7d'),_0x9dba('0x5c'),_0x9dba('0x7e'),'delivery_task','work_start',_0x9dba('0x7f'),'business_stc','additional_assignee_list','description',_0x9dba('0x80'),_0x9dba('0x5d'),'sys_class_name','close_notes',_0x9dba('0x81'),_0x9dba('0x82'),_0x9dba('0x83'),_0x9dba('0x84'),_0x9dba('0x85'),_0x9dba('0x86'),_0x9dba('0x5e'),_0x9dba('0x87'),_0x9dba('0x88'),'company',_0x9dba('0x89'),'activity_due',_0x9dba('0x8a'),_0x9dba('0x5f'),_0x9dba('0x8b'),'sla_due','approval',_0x9dba('0x8c'),_0x9dba('0x8d'),_0x9dba('0x8e'),_0x9dba('0x8f'),_0x9dba('0x90'),_0x9dba('0x91'),_0x9dba('0x92'),_0x9dba('0x93'),_0x9dba('0x94'),'category'];var _0x3ab56b='';var _0x5a6815='';var _0x4e4b8a=[];var _0xe2aa6b='';var _0x4ced9c='';var _0x44d9a0=[];var _0x6ff391='';var _0x3d6829='';var _0x9e801f={};var _0x2fa4c2='';return db[_0x9dba('0x40')]['findOne']({'where':{'id':_0x2a17ee['params']['id']},'attributes':['id',_0x9dba('0x95'),_0x9dba('0x96'),'email',_0x9dba('0x97'),_0x9dba('0x98')]})[_0x9dba('0x26')](handleEntityNotFound(_0x417a57,null))[_0x9dba('0x26')](function(_0x1bf7a4){if(_0x1bf7a4){_0x2fa4c2=_0x1bf7a4[_0x9dba('0x97')];var _0x410be8=_0x2fa4c2[_0x9dba('0x99')](-0x1);if(_0x410be8==='/'){_0x2fa4c2=_0x2fa4c2[_0x9dba('0x9a')](0x0,_0x2fa4c2[_0x9dba('0x9b')](_0x410be8));}_0x3d6829=util['format'](_0x9dba('0x9c'),_0x2fa4c2);_0x6ff391=util[_0x9dba('0x9d')](_0x9dba('0x9e'),_0x2fa4c2);_0x9e801f={'user':_0x1bf7a4['username'],'pass':_0x1bf7a4[_0x9dba('0x96')]};var _0x5ab339={'method':_0x9dba('0x9f'),'uri':_0x3d6829+_0x9dba('0xa0'),'auth':_0x9e801f,'json':!![]};return rp(_0x5ab339);}})[_0x9dba('0x26')](function(_0x431d36){if(_0x431d36[_0x9dba('0xa1')]['length']>0x0){_0x3ab56b=_0x431d36[_0x9dba('0xa1')];}console['log'](_0x9dba('0xa2'),_0x3ab56b);_0x44d9a0=[];_0x5a6815=Object['assign']([],_0x3ab56b);_[_0x9dba('0xa3')](_0x5a6815,function(_0x41ecfa){return!_0x876450[_0x9dba('0xa4')](_0x41ecfa[_0x9dba('0x2a')]);});_0x5a6815[_0x9dba('0xa5')](function(_0x1838e4){var _0x2ac7c8=createFieldObject(_0x6ff391,_0x9e801f,_0x1838e4[_0x9dba('0xa6')],_0x1838e4[_0x9dba('0x2a')],_0x1838e4[_0x9dba('0xa7')],![]);_0x44d9a0[_0x9dba('0xa8')](_0x2ac7c8);});return Promise[_0x9dba('0xa9')](_0x44d9a0);})['then'](function(_0x17454a){_0x4e4b8a=_0x17454a;_0xe2aa6b=Object[_0x9dba('0xaa')]([],_0x3ab56b);console[_0x9dba('0xab')]('TCL:\x20_object',_0x3ab56b);_['remove'](_0xe2aa6b,function(_0x40728e){return _0x1efa40['includes'](_0x40728e[_0x9dba('0x2a')]);});console[_0x9dba('0xab')](_0x9dba('0xac'),_0xe2aa6b);_0x44d9a0=[];_0xe2aa6b[_0x9dba('0xa5')](function(_0x2b8837){var _0x34ea72=createFieldObject(_0x6ff391,_0x9e801f,_0x2b8837['internalType'],_0x2b8837[_0x9dba('0x2a')],_0x2b8837[_0x9dba('0xa7')],!![]);_0x44d9a0[_0x9dba('0xa8')](_0x34ea72);});return Promise['all'](_0x44d9a0);})[_0x9dba('0x26')](function(_0x410a6d){_0x4ced9c=_0x410a6d;var _0x4bf6cf=_0x4e4b8a['concat'](_0x4ced9c);return{'count':_0x4bf6cf[_0x9dba('0x35')],'rows':_0x4bf6cf};})[_0x9dba('0x26')](respondWithResult(_0x417a57,null))[_0x9dba('0x48')](function(_0x413a23){console[_0x9dba('0xab')](_0x9dba('0xad')+_0x413a23);var _0x1930d9=_0x2a17ee[_0x9dba('0x31')]['test']?0x1f4:_0x413a23['statusCode']||0x1f4;logger[_0x9dba('0x28')](_0x413a23['stack']);delete _0x413a23['name'];if(_0x1930d9===0x191){_0x1930d9=0x190;}_0x417a57[_0x9dba('0x1a')](_0x1930d9)['send'](_0x2a17ee[_0x9dba('0x31')][_0x9dba('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0x413a23['statusCode']}:_0x413a23);});};function createFieldObject(_0x5d30fc,_0x6debd9,_0x21f80b,_0x23abcf,_0x21c2c8,_0x28c704){return new Promise(function(_0x59293d,_0x3eecc1){var _0x1f1f6f={'id':_0x23abcf,'name':_0x21c2c8,'custom':_0x28c704};if(_0x21f80b===_0x9dba('0xaf')){_0x1f1f6f[_0x9dba('0x3f')]=[{'name':'True','value':_0x9dba('0xb0')},{'name':_0x9dba('0xb1'),'value':_0x9dba('0xb2')}];_0x59293d(_0x1f1f6f);}else{var _0x588d00={'method':_0x9dba('0x9f'),'uri':_0x5d30fc+'sys_choice?sysparm_query=name=incident^element='+_0x23abcf,'auth':_0x6debd9,'json':!![]};return rp(_0x588d00)[_0x9dba('0x26')](function(_0x23e2a1){var _0x43b404=[];if(_0x23e2a1[_0x9dba('0xa1')][_0x9dba('0x35')]>0x0){_0x23e2a1[_0x9dba('0xa1')][_0x9dba('0xa5')](function(_0x57c65e){if(_0x57c65e[_0x9dba('0xb3')]===_0x9dba('0xb2')){var _0x2184d4={'name':_0x57c65e['label'],'value':_0x57c65e[_0x9dba('0xb4')]};_0x43b404[_0x9dba('0xa8')](_0x2184d4);}});}_0x1f1f6f['options']=_0x43b404;if(_0x1f1f6f['options'][_0x9dba('0x35')]>0x0){_0x59293d(_0x1f1f6f);}else{if(_0x28c704==![]){_0x59293d();}else{_0x59293d(_0x1f1f6f);}}});}});} \ No newline at end of file +var _0xb4ec=['correlation_id','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','TCL:\x20_object','includes','all','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','true','false','sys_choice?sysparm_query=name=incident^element=','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','params','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','watch_list','upon_reject','sys_updated_on','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','approval','sys_mod_count','sys_tags','escalation'];(function(_0x223208,_0x2584c3){var _0x516e5c=function(_0x1d8b6e){while(--_0x1d8b6e){_0x223208['push'](_0x223208['shift']());}};_0x516e5c(++_0x2584c3);}(_0xb4ec,0x182));var _0xcb4e=function(_0x2e5ade,_0x8e6199){_0x2e5ade=_0x2e5ade-0x0;var _0x284b10=_0xb4ec[_0x2e5ade];return _0x284b10;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb4e('0x0'));var zipdir=require(_0xcb4e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb4e('0x2'));var moment=require(_0xcb4e('0x3'));var BPromise=require(_0xcb4e('0x4'));var Mustache=require('mustache');var util=require(_0xcb4e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xcb4e('0x6'));var ejs=require(_0xcb4e('0x7'));var fs=require('fs');var fs_extra=require(_0xcb4e('0x8'));var _=require(_0xcb4e('0x9'));var squel=require(_0xcb4e('0xa'));var crypto=require(_0xcb4e('0xb'));var jsforce=require(_0xcb4e('0xc'));var deskjs=require(_0xcb4e('0xd'));var toCsv=require(_0xcb4e('0x6'));var querystring=require(_0xcb4e('0xe'));var Papa=require(_0xcb4e('0xf'));var Redis=require(_0xcb4e('0x10'));var authService=require(_0xcb4e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcb4e('0x12'));var hardwareService=require(_0xcb4e('0x13'));var logger=require(_0xcb4e('0x14'))(_0xcb4e('0x15'));var utils=require(_0xcb4e('0x16'));var config=require(_0xcb4e('0x17'));var licenseUtil=require(_0xcb4e('0x18'));var db=require(_0xcb4e('0x19'))['db'];var integrations=require(_0xcb4e('0x1a'));function respondWithStatusCode(_0x4b23b7,_0x1f58f4){_0x1f58f4=_0x1f58f4||0xcc;return function(_0x2dd1f3){if(_0x2dd1f3){return _0x4b23b7[_0xcb4e('0x1b')](_0x1f58f4);}return _0x4b23b7[_0xcb4e('0x1c')](_0x1f58f4)['end']();};}function respondWithResult(_0x1d16fb,_0xfdcfdd){_0xfdcfdd=_0xfdcfdd||0xc8;return function(_0x2dd8e4){if(_0x2dd8e4){return _0x1d16fb['status'](_0xfdcfdd)['json'](_0x2dd8e4);}};}function respondWithFilteredResult(_0x30f47b,_0x2cf2dc){return function(_0x25ab04){if(_0x25ab04){var _0x5b05dd=typeof _0x2cf2dc[_0xcb4e('0x1d')]===_0xcb4e('0x1e')&&typeof _0x2cf2dc[_0xcb4e('0x1f')]===_0xcb4e('0x1e');var _0x36ef21=_0x25ab04[_0xcb4e('0x20')];var _0x572ecf=_0x5b05dd?0x0:_0x2cf2dc[_0xcb4e('0x1d')];var _0x442782=_0x5b05dd?_0x25ab04[_0xcb4e('0x20')]:_0x2cf2dc[_0xcb4e('0x1d')]+_0x2cf2dc[_0xcb4e('0x1f')];var _0xa6a7a8;if(_0x442782>=_0x36ef21){_0x442782=_0x36ef21;_0xa6a7a8=0xc8;}else{_0xa6a7a8=0xce;}_0x30f47b['status'](_0xa6a7a8);return _0x30f47b[_0xcb4e('0x21')](_0xcb4e('0x22'),_0x572ecf+'-'+_0x442782+'/'+_0x36ef21)[_0xcb4e('0x23')](_0x25ab04);}return null;};}function patchUpdates(_0x1070c2){return function(_0x35ffef){try{jsonpatch['apply'](_0x35ffef,_0x1070c2,!![]);}catch(_0x2cbfc2){return BPromise[_0xcb4e('0x24')](_0x2cbfc2);}return _0x35ffef[_0xcb4e('0x25')]();};}function saveUpdates(_0x2b50fa,_0x2689f4){return function(_0x2099b2){if(_0x2099b2){return _0x2099b2[_0xcb4e('0x26')](_0x2b50fa)[_0xcb4e('0x27')](function(_0x3f710e){return _0x3f710e;});}return null;};}function removeEntity(_0x2d96d8,_0x201b29){return function(_0x1c6598){if(_0x1c6598){return _0x1c6598[_0xcb4e('0x28')]()[_0xcb4e('0x27')](function(){_0x2d96d8[_0xcb4e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a229e,_0x46bdd6){return function(_0x4581ed){if(!_0x4581ed){_0x2a229e['sendStatus'](0x194);}return _0x4581ed;};}function handleError(_0x52ed08,_0x206170){_0x206170=_0x206170||0x1f4;return function(_0x30ef4c){logger['error'](_0x30ef4c[_0xcb4e('0x29')]);if(_0x30ef4c[_0xcb4e('0x2a')]){delete _0x30ef4c[_0xcb4e('0x2a')];}_0x52ed08[_0xcb4e('0x1c')](_0x206170)[_0xcb4e('0x2b')](_0x30ef4c);};}exports[_0xcb4e('0x2c')]=function(_0x41b0cb,_0x276a63){var _0x451e47={},_0x15a173={},_0x56be89={'count':0x0,'rows':[]};var _0x954f5b=_[_0xcb4e('0x2d')](db[_0xcb4e('0x2e')][_0xcb4e('0x2f')],function(_0x1d3dad){return{'name':_0x1d3dad[_0xcb4e('0x30')],'type':_0x1d3dad[_0xcb4e('0x31')][_0xcb4e('0x32')]};});_0x15a173[_0xcb4e('0x33')]=_[_0xcb4e('0x2d')](_0x954f5b,_0xcb4e('0x2a'));_0x15a173['query']=_['keys'](_0x41b0cb[_0xcb4e('0x34')]);_0x15a173[_0xcb4e('0x35')]=_[_0xcb4e('0x36')](_0x15a173[_0xcb4e('0x33')],_0x15a173[_0xcb4e('0x34')]);_0x451e47[_0xcb4e('0x37')]=_[_0xcb4e('0x36')](_0x15a173[_0xcb4e('0x33')],qs[_0xcb4e('0x38')](_0x41b0cb[_0xcb4e('0x34')][_0xcb4e('0x38')]));_0x451e47[_0xcb4e('0x37')]=_0x451e47[_0xcb4e('0x37')][_0xcb4e('0x39')]?_0x451e47[_0xcb4e('0x37')]:_0x15a173['model'];if(!_0x41b0cb[_0xcb4e('0x34')][_0xcb4e('0x3a')](_0xcb4e('0x3b'))){_0x451e47[_0xcb4e('0x1f')]=qs[_0xcb4e('0x1f')](_0x41b0cb[_0xcb4e('0x34')]['limit']);_0x451e47[_0xcb4e('0x1d')]=qs[_0xcb4e('0x1d')](_0x41b0cb[_0xcb4e('0x34')][_0xcb4e('0x1d')]);}_0x451e47[_0xcb4e('0x3c')]=qs[_0xcb4e('0x3d')](_0x41b0cb[_0xcb4e('0x34')][_0xcb4e('0x3d')]);_0x451e47[_0xcb4e('0x3e')]=qs[_0xcb4e('0x35')](_[_0xcb4e('0x3f')](_0x41b0cb['query'],_0x15a173[_0xcb4e('0x35')]),_0x954f5b);if(_0x41b0cb['query'][_0xcb4e('0x40')]){_0x451e47['where']=_[_0xcb4e('0x41')](_0x451e47[_0xcb4e('0x3e')],{'$or':_[_0xcb4e('0x2d')](_0x954f5b,function(_0x2e74ca){if(_0x2e74ca[_0xcb4e('0x31')]!==_0xcb4e('0x42')){var _0x4479b6={};_0x4479b6[_0x2e74ca[_0xcb4e('0x2a')]]={'$like':'%'+_0x41b0cb[_0xcb4e('0x34')][_0xcb4e('0x40')]+'%'};return _0x4479b6;}})});}_0x451e47=_[_0xcb4e('0x41')]({},_0x451e47,_0x41b0cb['options']);var _0x115bbc={'where':_0x451e47[_0xcb4e('0x3e')]};return db[_0xcb4e('0x2e')]['count'](_0x115bbc)[_0xcb4e('0x27')](function(_0x549975){_0x56be89[_0xcb4e('0x20')]=_0x549975;if(_0x41b0cb[_0xcb4e('0x34')][_0xcb4e('0x43')]){_0x451e47['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0xcb4e('0x44')](_0x451e47);})[_0xcb4e('0x27')](function(_0x547733){_0x56be89[_0xcb4e('0x45')]=_0x547733;return _0x56be89;})['then'](respondWithFilteredResult(_0x276a63,_0x451e47))[_0xcb4e('0x46')](handleError(_0x276a63,null));};exports[_0xcb4e('0x47')]=function(_0x1179ca,_0x4bd0be){var _0x3171ca={'raw':![],'where':{'id':_0x1179ca['params']['id']}},_0x333099={};_0x333099[_0xcb4e('0x33')]=_['keys'](db[_0xcb4e('0x2e')][_0xcb4e('0x2f')]);_0x333099[_0xcb4e('0x34')]=_[_0xcb4e('0x48')](_0x1179ca[_0xcb4e('0x34')]);_0x333099[_0xcb4e('0x35')]=_['intersection'](_0x333099['model'],_0x333099[_0xcb4e('0x34')]);_0x3171ca['attributes']=_[_0xcb4e('0x36')](_0x333099[_0xcb4e('0x33')],qs[_0xcb4e('0x38')](_0x1179ca[_0xcb4e('0x34')][_0xcb4e('0x38')]));_0x3171ca[_0xcb4e('0x37')]=_0x3171ca[_0xcb4e('0x37')]['length']?_0x3171ca[_0xcb4e('0x37')]:_0x333099[_0xcb4e('0x33')];if(_0x1179ca[_0xcb4e('0x34')][_0xcb4e('0x43')]){_0x3171ca[_0xcb4e('0x49')]=[{'all':!![]}];}_0x3171ca=_[_0xcb4e('0x41')]({},_0x3171ca,_0x1179ca[_0xcb4e('0x4a')]);return db['ServicenowAccount'][_0xcb4e('0x4b')](_0x3171ca)['then'](handleEntityNotFound(_0x4bd0be,null))['then'](respondWithResult(_0x4bd0be,null))['catch'](handleError(_0x4bd0be,null));};exports[_0xcb4e('0x4c')]=function(_0x29ae0d,_0x196507){return db[_0xcb4e('0x2e')][_0xcb4e('0x4c')](_0x29ae0d[_0xcb4e('0x4d')],{})[_0xcb4e('0x27')](respondWithResult(_0x196507,0xc9))[_0xcb4e('0x46')](handleError(_0x196507,null));};exports[_0xcb4e('0x26')]=function(_0x557438,_0x4851a7){if(_0x557438['body']['id']){delete _0x557438[_0xcb4e('0x4d')]['id'];}return db[_0xcb4e('0x2e')][_0xcb4e('0x4b')]({'where':{'id':_0x557438[_0xcb4e('0x4e')]['id']}})[_0xcb4e('0x27')](handleEntityNotFound(_0x4851a7,null))[_0xcb4e('0x27')](saveUpdates(_0x557438[_0xcb4e('0x4d')],null))[_0xcb4e('0x27')](respondWithResult(_0x4851a7,null))[_0xcb4e('0x46')](handleError(_0x4851a7,null));};exports['destroy']=function(_0x4247d3,_0x309380){return db[_0xcb4e('0x2e')][_0xcb4e('0x4b')]({'where':{'id':_0x4247d3[_0xcb4e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x309380,null))[_0xcb4e('0x27')](removeEntity(_0x309380,null))['catch'](handleError(_0x309380,null));};exports[_0xcb4e('0x4f')]=function(_0x30e4ab,_0x12cfc1,_0x5f2bd4){var _0x16b42b={};var _0x20212e={};var _0x21730d;var _0xade944;return db['ServicenowAccount'][_0xcb4e('0x50')]({'where':{'id':_0x30e4ab[_0xcb4e('0x4e')]['id']}})[_0xcb4e('0x27')](handleEntityNotFound(_0x12cfc1,null))[_0xcb4e('0x27')](function(_0x5ccb82){if(_0x5ccb82){_0x21730d=_0x5ccb82;_0x20212e['model']=_[_0xcb4e('0x48')](db['ServicenowConfiguration'][_0xcb4e('0x2f')]);_0x20212e[_0xcb4e('0x34')]=_[_0xcb4e('0x48')](_0x30e4ab['query']);_0x20212e['filters']=_['intersection'](_0x20212e['model'],_0x20212e[_0xcb4e('0x34')]);_0x16b42b['attributes']=_[_0xcb4e('0x36')](_0x20212e[_0xcb4e('0x33')],qs[_0xcb4e('0x38')](_0x30e4ab['query'][_0xcb4e('0x38')]));_0x16b42b['attributes']=_0x16b42b[_0xcb4e('0x37')][_0xcb4e('0x39')]?_0x16b42b[_0xcb4e('0x37')]:_0x20212e[_0xcb4e('0x33')];_0x16b42b[_0xcb4e('0x3c')]=qs['sort'](_0x30e4ab['query']['sort']);_0x16b42b[_0xcb4e('0x3e')]=qs['filters'](_[_0xcb4e('0x3f')](_0x30e4ab[_0xcb4e('0x34')],_0x20212e[_0xcb4e('0x35')]));if(_0x30e4ab[_0xcb4e('0x34')]['filter']){_0x16b42b[_0xcb4e('0x3e')]=_[_0xcb4e('0x41')](_0x16b42b[_0xcb4e('0x3e')],{'$or':_[_0xcb4e('0x2d')](_0x16b42b['attributes'],function(_0x9b1c4b){var _0x2ac328={};_0x2ac328[_0x9b1c4b]={'$like':'%'+_0x30e4ab[_0xcb4e('0x34')]['filter']+'%'};return _0x2ac328;})});}_0x16b42b=_[_0xcb4e('0x41')]({},_0x16b42b,_0x30e4ab[_0xcb4e('0x4a')]);return _0x21730d[_0xcb4e('0x4f')](_0x16b42b);}})[_0xcb4e('0x27')](function(_0x4741d2){if(_0x4741d2){_0xade944=_0x4741d2[_0xcb4e('0x39')];if(!_0x30e4ab[_0xcb4e('0x34')][_0xcb4e('0x3a')](_0xcb4e('0x3b'))){_0x16b42b[_0xcb4e('0x1f')]=qs['limit'](_0x30e4ab[_0xcb4e('0x34')]['limit']);_0x16b42b[_0xcb4e('0x1d')]=qs[_0xcb4e('0x1d')](_0x30e4ab[_0xcb4e('0x34')]['offset']);}return _0x21730d['getConfigurations'](_0x16b42b);}})[_0xcb4e('0x27')](function(_0x24e8f4){if(_0x24e8f4){return _0x24e8f4?{'count':_0xade944,'rows':_0x24e8f4}:null;}})[_0xcb4e('0x27')](respondWithResult(_0x12cfc1,null))[_0xcb4e('0x46')](handleError(_0x12cfc1,null));};exports['addConfiguration']=function(_0x567994,_0x18622d,_0x13b0d4){if(_0x567994[_0xcb4e('0x4d')]['id']){delete _0x567994[_0xcb4e('0x4d')]['id'];}return db[_0xcb4e('0x2e')][_0xcb4e('0x50')]({'where':{'id':_0x567994[_0xcb4e('0x4e')]['id']}})[_0xcb4e('0x27')](handleEntityNotFound(_0x18622d,null))['then'](function(_0x277c47){if(_0x277c47){_0x567994[_0xcb4e('0x4d')][_0xcb4e('0x51')]=_0x277c47['id'];_0x567994[_0xcb4e('0x4d')]['Subjects']=integrations[_0xcb4e('0x52')](_0x567994['body'][_0xcb4e('0x53')],_0x567994['body']['type']);_0x567994['body'][_0xcb4e('0x54')]=integrations[_0xcb4e('0x55')](_0x567994[_0xcb4e('0x4d')][_0xcb4e('0x53')],_0x567994['body']['type']);return db['ServicenowConfiguration'][_0xcb4e('0x4c')](_0x567994[_0xcb4e('0x4d')],{'include':[{'model':db[_0xcb4e('0x56')],'as':'Subjects'},{'model':db[_0xcb4e('0x56')],'as':_0xcb4e('0x54')}]});}return null;})[_0xcb4e('0x27')](respondWithResult(_0x18622d,null))[_0xcb4e('0x46')](handleError(_0x18622d,null));};exports['getFields']=function(_0x40a260,_0x251a77,_0x256001){var _0x2e9ae6=[_0xcb4e('0x57'),_0xcb4e('0x58'),_0xcb4e('0x59'),_0xcb4e('0x5a'),_0xcb4e('0x5b'),_0xcb4e('0x5c'),_0xcb4e('0x5d'),_0xcb4e('0x5e'),_0xcb4e('0x5f')];var _0x4d7a12=['parent',_0xcb4e('0x57'),'caused_by',_0xcb4e('0x60'),_0xcb4e('0x61'),_0xcb4e('0x62'),'child_incidents',_0xcb4e('0x58'),_0xcb4e('0x63'),'number',_0xcb4e('0x64'),_0xcb4e('0x65'),_0xcb4e('0x66'),_0xcb4e('0x67'),'sys_created_on',_0xcb4e('0x68'),_0xcb4e('0x69'),_0xcb4e('0x6a'),_0xcb4e('0x59'),'order',_0xcb4e('0x6b'),_0xcb4e('0x6c'),_0xcb4e('0x6d'),'delivery_plan',_0xcb4e('0x6e'),_0xcb4e('0x6f'),'work_notes_list',_0xcb4e('0x70'),_0xcb4e('0x71'),_0xcb4e('0x72'),_0xcb4e('0x73'),_0xcb4e('0x74'),_0xcb4e('0x75'),'opened_at','business_duration','group_list',_0xcb4e('0x76'),_0xcb4e('0x77'),_0xcb4e('0x78'),_0xcb4e('0x79'),_0xcb4e('0x7a'),_0xcb4e('0x5a'),_0xcb4e('0x7b'),_0xcb4e('0x7c'),_0xcb4e('0x5b'),'correlation_display','delivery_task',_0xcb4e('0x7d'),_0xcb4e('0x7e'),_0xcb4e('0x7f'),'additional_assignee_list','description',_0xcb4e('0x80'),'notify',_0xcb4e('0x81'),_0xcb4e('0x82'),'closed_by',_0xcb4e('0x83'),_0xcb4e('0x84'),_0xcb4e('0x85'),_0xcb4e('0x86'),_0xcb4e('0x87'),_0xcb4e('0x5d'),_0xcb4e('0x88'),'problem_id',_0xcb4e('0x89'),_0xcb4e('0x8a'),_0xcb4e('0x8b'),_0xcb4e('0x8c'),_0xcb4e('0x5e'),'comments','sla_due',_0xcb4e('0x8d'),'comments_and_work_notes','due_date',_0xcb4e('0x8e'),'reopen_count',_0xcb4e('0x8f'),_0xcb4e('0x90'),'upon_approval',_0xcb4e('0x91'),'location',_0xcb4e('0x5f')];var _0x3fce92='';var _0x73218='';var _0xac1d1c=[];var _0x104b5a='';var _0x37ffc6='';var _0x3acfe0=[];var _0x2b24cf='';var _0x9c6407='';var _0x232d82={};var _0x2af642='';return db[_0xcb4e('0x2e')][_0xcb4e('0x50')]({'where':{'id':_0x40a260[_0xcb4e('0x4e')]['id']},'attributes':['id',_0xcb4e('0x92'),_0xcb4e('0x93'),'email',_0xcb4e('0x94'),_0xcb4e('0x95')]})[_0xcb4e('0x27')](handleEntityNotFound(_0x251a77,null))[_0xcb4e('0x27')](function(_0x262df6){if(_0x262df6){_0x2af642=_0x262df6[_0xcb4e('0x94')];var _0x25c575=_0x2af642[_0xcb4e('0x96')](-0x1);if(_0x25c575==='/'){_0x2af642=_0x2af642[_0xcb4e('0x97')](0x0,_0x2af642[_0xcb4e('0x98')](_0x25c575));}_0x9c6407=util['format'](_0xcb4e('0x99'),_0x2af642);_0x2b24cf=util['format']('%s/api/now/table/',_0x2af642);_0x232d82={'user':_0x262df6[_0xcb4e('0x92')],'pass':_0x262df6['password']};var _0x2fa069={'method':_0xcb4e('0x9a'),'uri':_0x9c6407+_0xcb4e('0x9b'),'auth':_0x232d82,'json':!![]};return rp(_0x2fa069);}})[_0xcb4e('0x27')](function(_0x373ded){if(_0x373ded[_0xcb4e('0x9c')][_0xcb4e('0x39')]>0x0){_0x3fce92=_0x373ded['result'];}console[_0xcb4e('0x9d')](_0xcb4e('0x9e'),_0x3fce92);_0x3acfe0=[];_0x73218=Object[_0xcb4e('0x9f')]([],_0x3fce92);_[_0xcb4e('0xa0')](_0x73218,function(_0x507d02){return!_0x2e9ae6['includes'](_0x507d02[_0xcb4e('0x2a')]);});_0x73218[_0xcb4e('0xa1')](function(_0x2cdcea){var _0x262cb3=createFieldObject(_0x2b24cf,_0x232d82,_0x2cdcea[_0xcb4e('0xa2')],_0x2cdcea[_0xcb4e('0x2a')],_0x2cdcea[_0xcb4e('0xa3')],![]);_0x3acfe0[_0xcb4e('0xa4')](_0x262cb3);});return Promise['all'](_0x3acfe0);})[_0xcb4e('0x27')](function(_0x272d80){_0xac1d1c=_0x272d80;_0x104b5a=Object[_0xcb4e('0x9f')]([],_0x3fce92);console[_0xcb4e('0x9d')](_0xcb4e('0xa5'),_0x3fce92);_[_0xcb4e('0xa0')](_0x104b5a,function(_0x5d9ee1){return _0x4d7a12[_0xcb4e('0xa6')](_0x5d9ee1[_0xcb4e('0x2a')]);});console[_0xcb4e('0x9d')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x104b5a);_0x3acfe0=[];_0x104b5a[_0xcb4e('0xa1')](function(_0x37e935){var _0xa3c73b=createFieldObject(_0x2b24cf,_0x232d82,_0x37e935[_0xcb4e('0xa2')],_0x37e935[_0xcb4e('0x2a')],_0x37e935['label'],!![]);_0x3acfe0[_0xcb4e('0xa4')](_0xa3c73b);});return Promise[_0xcb4e('0xa7')](_0x3acfe0);})[_0xcb4e('0x27')](function(_0xb90884){_0x37ffc6=_0xb90884;var _0x515f86=_0xac1d1c[_0xcb4e('0xa8')](_0x37ffc6);return{'count':_0x515f86[_0xcb4e('0x39')],'rows':_0x515f86};})['then'](respondWithResult(_0x251a77,null))[_0xcb4e('0x46')](function(_0x52170b){console['log'](_0xcb4e('0xa9')+_0x52170b);var _0xfef1d1=_0x40a260[_0xcb4e('0x34')][_0xcb4e('0xaa')]?0x1f4:_0x52170b[_0xcb4e('0xab')]||0x1f4;logger[_0xcb4e('0xac')](_0x52170b[_0xcb4e('0x29')]);delete _0x52170b[_0xcb4e('0x2a')];if(_0xfef1d1===0x191){_0xfef1d1=0x190;}_0x251a77['status'](_0xfef1d1)[_0xcb4e('0x2b')](_0x40a260[_0xcb4e('0x34')][_0xcb4e('0xaa')]?{'message':_0xcb4e('0xad'),'statusCode':_0x52170b[_0xcb4e('0xab')]}:_0x52170b);});};function createFieldObject(_0x5f579a,_0x5d3666,_0x714ee7,_0x4e7f13,_0x356445,_0x466f9c){return new Promise(function(_0x11ed6d,_0x20b5d0){var _0xc3f0ef={'id':_0x4e7f13,'name':_0x356445,'custom':_0x466f9c};if(_0x714ee7==='boolean'){_0xc3f0ef[_0xcb4e('0x4a')]=[{'name':'True','value':_0xcb4e('0xae')},{'name':'False','value':_0xcb4e('0xaf')}];_0x11ed6d(_0xc3f0ef);}else{var _0xca2563={'method':_0xcb4e('0x9a'),'uri':_0x5f579a+_0xcb4e('0xb0')+_0x4e7f13,'auth':_0x5d3666,'json':!![]};return rp(_0xca2563)[_0xcb4e('0x27')](function(_0x13c8c3){var _0xa650eb=[];if(_0x13c8c3['result']['length']>0x0){_0x13c8c3[_0xcb4e('0x9c')][_0xcb4e('0xa1')](function(_0x5d2305){if(_0x5d2305['inactive']===_0xcb4e('0xaf')){var _0x51cf7c={'name':_0x5d2305[_0xcb4e('0xa3')],'value':_0x5d2305['value']};_0xa650eb['push'](_0x51cf7c);}});}_0xc3f0ef[_0xcb4e('0x4a')]=_0xa650eb;if(_0xc3f0ef[_0xcb4e('0x4a')][_0xcb4e('0x39')]>0x0){_0x11ed6d(_0xc3f0ef);}else{if(_0x466f9c==![]){_0x11ed6d();}else{_0x11ed6d(_0xc3f0ef);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index db53a00..efd3408 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 _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0x5575f2,_0x5a840d){var _0x447659=function(_0x2a724d){while(--_0x2a724d){_0x5575f2['push'](_0x5575f2['shift']());}};_0x447659(++_0x5a840d);}(_0xdc97,0x13b));var _0x7dc9=function(_0x322a45,_0x55a4f4){_0x322a45=_0x322a45-0x0;var _0x895425=_0xdc97[_0x322a45];return _0x895425;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd51=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2e3b2c,_0x4e5874){var _0x315b57=function(_0x3ea368){while(--_0x3ea368){_0x2e3b2c['push'](_0x2e3b2c['shift']());}};_0x315b57(++_0x4e5874);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x519b57,_0x47153f){_0x519b57=_0x519b57-0x0;var _0x5402b9=_0xbd51[_0x519b57];return _0x5402b9;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bd5('0x5'));var integrations=require(_0x1bd5('0x6'));module[_0x1bd5('0x7')]=function(_0x59ddfb,_0x29abea){return _0x59ddfb[_0x1bd5('0x8')](_0x1bd5('0x9'),attributes,{'tableName':_0x1bd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index bcfced2..20d4bd1 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 _0x8498=['catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','include','map','model','find','where','ShowServicenowAccount','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x126fa4,_0x31ec51){var _0x5164db=function(_0x4e2211){while(--_0x4e2211){_0x126fa4['push'](_0x126fa4['shift']());}};_0x5164db(++_0x31ec51);}(_0x8498,0x70));var _0x8849=function(_0x430437,_0x57f929){_0x430437=_0x430437-0x0;var _0x53aed8=_0x8498[_0x430437];return _0x53aed8;};'use strict';var _=require(_0x8849('0x0'));var util=require('util');var moment=require(_0x8849('0x1'));var BPromise=require('bluebird');var rs=require(_0x8849('0x2'));var fs=require('fs');var Redis=require(_0x8849('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8849('0x4'))(_0x8849('0x5'));var config=require(_0x8849('0x6'));var jayson=require(_0x8849('0x7'));var client=jayson[_0x8849('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e3ba5,_0x48adb8,_0x59a0c4){return new BPromise(function(_0x5a5ab9,_0x424824){return client[_0x8849('0x9')](_0x2e3ba5,_0x59a0c4)[_0x8849('0xa')](function(_0x56bde7){logger[_0x8849('0xb')](_0x8849('0xc'),_0x48adb8,_0x8849('0xd'));logger[_0x8849('0xe')](_0x8849('0xf'),_0x48adb8,'request\x20sent',JSON[_0x8849('0x10')](_0x56bde7));if(_0x56bde7[_0x8849('0x11')]){if(_0x56bde7['error']['code']===0x1f4){logger[_0x8849('0x11')](_0x8849('0xc'),_0x48adb8,_0x56bde7[_0x8849('0x11')]['message']);return _0x424824(_0x56bde7['error'][_0x8849('0x12')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x48adb8,_0x56bde7['error'][_0x8849('0x12')]);return _0x5a5ab9(_0x56bde7[_0x8849('0x11')][_0x8849('0x12')]);}else{logger[_0x8849('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x48adb8,'request\x20sent');_0x5a5ab9(_0x56bde7[_0x8849('0x13')]['message']);}})[_0x8849('0x14')](function(_0x2ec0a6){logger[_0x8849('0x11')](_0x8849('0xc'),_0x48adb8,_0x2ec0a6);_0x424824(_0x2ec0a6);});});}exports[_0x8849('0x15')]=function(_0x43125a){var _0x420bc3=this;return new Promise(function(_0x2b140a,_0x2d38b9){return db[_0x8849('0x16')][_0x8849('0x17')]({'raw':_0x43125a[_0x8849('0x18')]?_0x43125a[_0x8849('0x18')][_0x8849('0x19')]===undefined?!![]:![]:!![],'where':_0x43125a[_0x8849('0x18')]?_0x43125a[_0x8849('0x18')]['where']||null:null,'attributes':_0x43125a['options']?_0x43125a[_0x8849('0x18')][_0x8849('0x1a')]||null:null,'limit':_0x43125a[_0x8849('0x18')]?_0x43125a[_0x8849('0x18')]['limit']||null:null,'include':_0x43125a[_0x8849('0x18')]?_0x43125a[_0x8849('0x18')][_0x8849('0x1b')]?_[_0x8849('0x1c')](_0x43125a[_0x8849('0x18')][_0x8849('0x1b')],function(_0x440b2b){return{'model':db[_0x440b2b['model']],'as':_0x440b2b['as'],'attributes':_0x440b2b[_0x8849('0x1a')],'include':_0x440b2b[_0x8849('0x1b')]?_['map'](_0x440b2b['include'],function(_0x10e135){return{'model':db[_0x10e135[_0x8849('0x1d')]],'as':_0x10e135['as'],'attributes':_0x10e135[_0x8849('0x1a')],'include':_0x10e135[_0x8849('0x1b')]?_[_0x8849('0x1c')](_0x10e135['include'],function(_0x529fdc){return{'model':db[_0x529fdc[_0x8849('0x1d')]],'as':_0x529fdc['as'],'attributes':_0x529fdc[_0x8849('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8849('0xa')](function(_0x3b622b){logger[_0x8849('0xb')](_0x8849('0x15'),_0x43125a);logger[_0x8849('0xe')](_0x8849('0x15'),_0x43125a,JSON['stringify'](_0x3b622b));_0x2b140a(_0x3b622b);})[_0x8849('0x14')](function(_0x109fc8){logger[_0x8849('0x11')](_0x8849('0x15'),_0x109fc8['message'],_0x43125a);_0x2d38b9(_0x420bc3['error'](0x1f4,_0x109fc8['message']));});});};exports['ShowServicenowAccount']=function(_0x535a56){var _0x3a8fa7=this;return new Promise(function(_0x4cde1b,_0x292213){return db[_0x8849('0x16')][_0x8849('0x1e')]({'raw':_0x535a56['options']?_0x535a56['options'][_0x8849('0x19')]===undefined?!![]:![]:!![],'where':_0x535a56[_0x8849('0x18')]?_0x535a56[_0x8849('0x18')][_0x8849('0x1f')]||null:null,'attributes':_0x535a56[_0x8849('0x18')]?_0x535a56[_0x8849('0x18')][_0x8849('0x1a')]||null:null,'include':_0x535a56[_0x8849('0x18')]?_0x535a56['options']['include']?_[_0x8849('0x1c')](_0x535a56[_0x8849('0x18')]['include'],function(_0x412c49){return{'model':db[_0x412c49[_0x8849('0x1d')]],'as':_0x412c49['as'],'attributes':_0x412c49[_0x8849('0x1a')],'include':_0x412c49[_0x8849('0x1b')]?_[_0x8849('0x1c')](_0x412c49[_0x8849('0x1b')],function(_0x2a9326){return{'model':db[_0x2a9326[_0x8849('0x1d')]],'as':_0x2a9326['as'],'attributes':_0x2a9326['attributes'],'include':_0x2a9326['include']?_[_0x8849('0x1c')](_0x2a9326[_0x8849('0x1b')],function(_0x27af7c){return{'model':db[_0x27af7c['model']],'as':_0x27af7c['as'],'attributes':_0x27af7c[_0x8849('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8849('0xa')](function(_0x2df877){logger[_0x8849('0xb')](_0x8849('0x20'),_0x535a56);logger[_0x8849('0xe')](_0x8849('0x20'),_0x535a56,JSON[_0x8849('0x10')](_0x2df877));_0x4cde1b(_0x2df877);})[_0x8849('0x14')](function(_0x5d14f6){logger[_0x8849('0x11')]('ShowServicenowAccount',_0x5d14f6[_0x8849('0x12')],_0x535a56);_0x292213(_0x3a8fa7[_0x8849('0x11')](0x1f4,_0x5d14f6[_0x8849('0x12')]));});});}; \ No newline at end of file +var _0x563c=['model','ShowServicenowAccount','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','include','map'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x563c,0xf1));var _0xc563=function(_0x32b278,_0x115a39){_0x32b278=_0x32b278-0x0;var _0x25529e=_0x563c[_0x32b278];return _0x25529e;};'use strict';var _=require(_0xc563('0x0'));var util=require(_0xc563('0x1'));var moment=require(_0xc563('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc563('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc563('0x4'));var logger=require(_0xc563('0x5'))(_0xc563('0x6'));var config=require(_0xc563('0x7'));var jayson=require(_0xc563('0x8'));var client=jayson[_0xc563('0x9')][_0xc563('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26cc60,_0x41f1ee,_0x5a67f4){return new BPromise(function(_0x226b48,_0x31b608){return client[_0xc563('0xb')](_0x26cc60,_0x5a67f4)[_0xc563('0xc')](function(_0xd6fcac){logger[_0xc563('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x41f1ee,_0xc563('0xe'));logger[_0xc563('0xf')](_0xc563('0x10'),_0x41f1ee,_0xc563('0xe'),JSON[_0xc563('0x11')](_0xd6fcac));if(_0xd6fcac[_0xc563('0x12')]){if(_0xd6fcac[_0xc563('0x12')]['code']===0x1f4){logger['error'](_0xc563('0x13'),_0x41f1ee,_0xd6fcac['error'][_0xc563('0x14')]);return _0x31b608(_0xd6fcac[_0xc563('0x12')][_0xc563('0x14')]);}logger[_0xc563('0x12')](_0xc563('0x13'),_0x41f1ee,_0xd6fcac[_0xc563('0x12')][_0xc563('0x14')]);return _0x226b48(_0xd6fcac[_0xc563('0x12')]['message']);}else{logger[_0xc563('0xd')](_0xc563('0x13'),_0x41f1ee,_0xc563('0xe'));_0x226b48(_0xd6fcac[_0xc563('0x15')][_0xc563('0x14')]);}})['catch'](function(_0x504425){logger[_0xc563('0x12')](_0xc563('0x13'),_0x41f1ee,_0x504425);_0x31b608(_0x504425);});});}exports[_0xc563('0x16')]=function(_0x5ed5c2){var _0x435450=this;return new Promise(function(_0x135b95,_0x590ae5){return db[_0xc563('0x17')][_0xc563('0x18')]({'raw':_0x5ed5c2[_0xc563('0x19')]?_0x5ed5c2[_0xc563('0x19')][_0xc563('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ed5c2[_0xc563('0x19')]?_0x5ed5c2['options'][_0xc563('0x1b')]||null:null,'attributes':_0x5ed5c2[_0xc563('0x19')]?_0x5ed5c2[_0xc563('0x19')][_0xc563('0x1c')]||null:null,'limit':_0x5ed5c2[_0xc563('0x19')]?_0x5ed5c2[_0xc563('0x19')]['limit']||null:null,'include':_0x5ed5c2[_0xc563('0x19')]?_0x5ed5c2[_0xc563('0x19')][_0xc563('0x1d')]?_[_0xc563('0x1e')](_0x5ed5c2[_0xc563('0x19')][_0xc563('0x1d')],function(_0x18bb8e){return{'model':db[_0x18bb8e['model']],'as':_0x18bb8e['as'],'attributes':_0x18bb8e[_0xc563('0x1c')],'include':_0x18bb8e[_0xc563('0x1d')]?_[_0xc563('0x1e')](_0x18bb8e[_0xc563('0x1d')],function(_0x5f4d8a){return{'model':db[_0x5f4d8a[_0xc563('0x1f')]],'as':_0x5f4d8a['as'],'attributes':_0x5f4d8a['attributes'],'include':_0x5f4d8a[_0xc563('0x1d')]?_['map'](_0x5f4d8a[_0xc563('0x1d')],function(_0x2e22d1){return{'model':db[_0x2e22d1[_0xc563('0x1f')]],'as':_0x2e22d1['as'],'attributes':_0x2e22d1[_0xc563('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc563('0xc')](function(_0x4ce271){logger[_0xc563('0xd')]('GetServicenowAccount',_0x5ed5c2);logger['debug'](_0xc563('0x16'),_0x5ed5c2,JSON[_0xc563('0x11')](_0x4ce271));_0x135b95(_0x4ce271);})['catch'](function(_0x408754){logger['error']('GetServicenowAccount',_0x408754['message'],_0x5ed5c2);_0x590ae5(_0x435450['error'](0x1f4,_0x408754['message']));});});};exports[_0xc563('0x20')]=function(_0x3cec37){var _0x31fb9b=this;return new Promise(function(_0x14bd63,_0x374be3){return db[_0xc563('0x17')]['find']({'raw':_0x3cec37[_0xc563('0x19')]?_0x3cec37[_0xc563('0x19')][_0xc563('0x1a')]===undefined?!![]:![]:!![],'where':_0x3cec37['options']?_0x3cec37[_0xc563('0x19')][_0xc563('0x1b')]||null:null,'attributes':_0x3cec37[_0xc563('0x19')]?_0x3cec37[_0xc563('0x19')]['attributes']||null:null,'include':_0x3cec37['options']?_0x3cec37['options']['include']?_[_0xc563('0x1e')](_0x3cec37[_0xc563('0x19')][_0xc563('0x1d')],function(_0x3e538b){return{'model':db[_0x3e538b[_0xc563('0x1f')]],'as':_0x3e538b['as'],'attributes':_0x3e538b[_0xc563('0x1c')],'include':_0x3e538b[_0xc563('0x1d')]?_[_0xc563('0x1e')](_0x3e538b['include'],function(_0x27889a){return{'model':db[_0x27889a[_0xc563('0x1f')]],'as':_0x27889a['as'],'attributes':_0x27889a[_0xc563('0x1c')],'include':_0x27889a[_0xc563('0x1d')]?_[_0xc563('0x1e')](_0x27889a[_0xc563('0x1d')],function(_0x3614fb){return{'model':db[_0x3614fb[_0xc563('0x1f')]],'as':_0x3614fb['as'],'attributes':_0x3614fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xc563('0xc')](function(_0x929b57){logger['info'](_0xc563('0x20'),_0x3cec37);logger['debug'](_0xc563('0x20'),_0x3cec37,JSON[_0xc563('0x11')](_0x929b57));_0x14bd63(_0x929b57);})[_0xc563('0x21')](function(_0x197336){logger[_0xc563('0x12')](_0xc563('0x20'),_0x197336[_0xc563('0x14')],_0x3cec37);_0x374be3(_0x31fb9b['error'](0x1f4,_0x197336[_0xc563('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 5c9cf9d..e912a5d 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 _0x4dcd=['/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3a8dc1,_0x2a7257){var _0x1f9222=function(_0x35b9d5){while(--_0x35b9d5){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x1f9222(++_0x2a7257);}(_0x4dcd,0x152));var _0xd4dc=function(_0x4a6e1b,_0x132674){_0x4a6e1b=_0x4a6e1b-0x0;var _0x2a49cc=_0x4dcd[_0x4a6e1b];return _0x2a49cc;};'use strict';var multer=require(_0xd4dc('0x0'));var util=require('util');var path=require(_0xd4dc('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd4dc('0x2')]();var fs_extra=require(_0xd4dc('0x3'));var auth=require(_0xd4dc('0x4'));var interaction=require(_0xd4dc('0x5'));var config=require(_0xd4dc('0x6'));var controller=require(_0xd4dc('0x7'));router[_0xd4dc('0x8')]('/',auth[_0xd4dc('0x9')](),controller[_0xd4dc('0xa')]);router[_0xd4dc('0x8')](_0xd4dc('0xb'),auth[_0xd4dc('0x9')](),controller[_0xd4dc('0xc')]);router[_0xd4dc('0x8')](_0xd4dc('0xd'),auth[_0xd4dc('0x9')](),controller['getFields']);router[_0xd4dc('0x8')](_0xd4dc('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xd4dc('0xf'),auth[_0xd4dc('0x9')](),controller[_0xd4dc('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd4dc('0x11')]);router[_0xd4dc('0x12')](_0xd4dc('0xb'),auth[_0xd4dc('0x9')](),controller[_0xd4dc('0x13')]);router[_0xd4dc('0x14')](_0xd4dc('0xb'),auth[_0xd4dc('0x9')](),controller['destroy']);module[_0xd4dc('0x15')]=router; \ No newline at end of file +var _0x1b9b=['isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x4f0244,_0x3fad49){var _0x5121f9=function(_0x5c3339){while(--_0x5c3339){_0x4f0244['push'](_0x4f0244['shift']());}};_0x5121f9(++_0x3fad49);}(_0x1b9b,0x178));var _0xb1b9=function(_0x5ebe44,_0x37425b){_0x5ebe44=_0x5ebe44-0x0;var _0x3443d6=_0x1b9b[_0x5ebe44];return _0x3443d6;};'use strict';var multer=require(_0xb1b9('0x0'));var util=require(_0xb1b9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb1b9('0x2'));var router=express[_0xb1b9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb1b9('0x4'));var interaction=require(_0xb1b9('0x5'));var config=require(_0xb1b9('0x6'));var controller=require(_0xb1b9('0x7'));router['get']('/',auth[_0xb1b9('0x8')](),controller[_0xb1b9('0x9')]);router[_0xb1b9('0xa')](_0xb1b9('0xb'),auth[_0xb1b9('0x8')](),controller[_0xb1b9('0xc')]);router[_0xb1b9('0xa')](_0xb1b9('0xd'),auth[_0xb1b9('0x8')](),controller[_0xb1b9('0xe')]);router[_0xb1b9('0xa')]('/:id/subjects',auth[_0xb1b9('0x8')](),controller[_0xb1b9('0xf')]);router['get'](_0xb1b9('0x10'),auth[_0xb1b9('0x8')](),controller[_0xb1b9('0x11')]);router[_0xb1b9('0x12')]('/',auth['isAuthenticated'](),controller[_0xb1b9('0x13')]);router['put'](_0xb1b9('0xb'),auth['isAuthenticated'](),controller[_0xb1b9('0x14')]);router[_0xb1b9('0x15')](_0xb1b9('0xb'),auth[_0xb1b9('0x8')](),controller[_0xb1b9('0x16')]);module[_0xb1b9('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 4b29133..45374c0 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 _0x55ce=['sequelize','STRING'];(function(_0x2c2ec0,_0x4b1c6a){var _0x3ca01d=function(_0x1acc7c){while(--_0x1acc7c){_0x2c2ec0['push'](_0x2c2ec0['shift']());}};_0x3ca01d(++_0x4b1c6a);}(_0x55ce,0x7e));var _0xe55c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x55ce[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe55c('0x0'));module['exports']={'name':{'type':Sequelize[_0xe55c('0x1')]},'description':{'type':Sequelize[_0xe55c('0x1')]}}; \ No newline at end of file +var _0xe664=['sequelize','STRING'];(function(_0x34c971,_0x2be6aa){var _0x370d53=function(_0x12a6e3){while(--_0x12a6e3){_0x34c971['push'](_0x34c971['shift']());}};_0x370d53(++_0x2be6aa);}(_0xe664,0x64));var _0x4e66=function(_0x158978,_0x192b39){_0x158978=_0x158978-0x0;var _0x6ba223=_0xe664[_0x158978];return _0x6ba223;};'use strict';var Sequelize=require(_0x4e66('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4e66('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index c3ac64b..34d69a0 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 _0x2fc2=['count','set','Content-Range','apply','reject','save','update','then','stack','send','index','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','include','ServicenowConfiguration','findAll','rows','catch','show','params','length','includeAll','find','create','body','getFields','findOne','ServicenowField','pick','options','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','limit','offset'];(function(_0x1100f1,_0xe8308f){var _0x1c7c02=function(_0xaa84b2){while(--_0xaa84b2){_0x1100f1['push'](_0x1100f1['shift']());}};_0x1c7c02(++_0xe8308f);}(_0x2fc2,0x85));var _0x22fc=function(_0x48e904,_0x520356){_0x48e904=_0x48e904-0x0;var _0x3c78d0=_0x2fc2[_0x48e904];return _0x3c78d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22fc('0x0'));var zipdir=require(_0x22fc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22fc('0x2'));var moment=require('moment');var BPromise=require(_0x22fc('0x3'));var Mustache=require(_0x22fc('0x4'));var util=require(_0x22fc('0x5'));var path=require(_0x22fc('0x6'));var sox=require(_0x22fc('0x7'));var csv=require(_0x22fc('0x8'));var ejs=require(_0x22fc('0x9'));var fs=require('fs');var fs_extra=require(_0x22fc('0xa'));var _=require(_0x22fc('0xb'));var squel=require(_0x22fc('0xc'));var crypto=require(_0x22fc('0xd'));var jsforce=require(_0x22fc('0xe'));var deskjs=require(_0x22fc('0xf'));var toCsv=require(_0x22fc('0x8'));var querystring=require(_0x22fc('0x10'));var Papa=require(_0x22fc('0x11'));var Redis=require(_0x22fc('0x12'));var authService=require(_0x22fc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x22fc('0x14'));var hardwareService=require(_0x22fc('0x15'));var logger=require(_0x22fc('0x16'))('api');var utils=require(_0x22fc('0x17'));var config=require(_0x22fc('0x18'));var licenseUtil=require(_0x22fc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1181ca,_0x5b160e){_0x5b160e=_0x5b160e||0xcc;return function(_0x5cac67){if(_0x5cac67){return _0x1181ca['sendStatus'](_0x5b160e);}return _0x1181ca['status'](_0x5b160e)[_0x22fc('0x1a')]();};}function respondWithResult(_0x24288f,_0x4924be){_0x4924be=_0x4924be||0xc8;return function(_0x5a674a){if(_0x5a674a){return _0x24288f[_0x22fc('0x1b')](_0x4924be)[_0x22fc('0x1c')](_0x5a674a);}};}function respondWithFilteredResult(_0x1fb7d0,_0x263ae3){return function(_0x2fc593){if(_0x2fc593){var _0x544da2=typeof _0x263ae3['offset']==='undefined'&&typeof _0x263ae3[_0x22fc('0x1d')]==='undefined';var _0x462dd6=_0x2fc593['count'];var _0x53d5bc=_0x544da2?0x0:_0x263ae3[_0x22fc('0x1e')];var _0x136f68=_0x544da2?_0x2fc593[_0x22fc('0x1f')]:_0x263ae3[_0x22fc('0x1e')]+_0x263ae3['limit'];var _0x3cf8e2;if(_0x136f68>=_0x462dd6){_0x136f68=_0x462dd6;_0x3cf8e2=0xc8;}else{_0x3cf8e2=0xce;}_0x1fb7d0[_0x22fc('0x1b')](_0x3cf8e2);return _0x1fb7d0[_0x22fc('0x20')](_0x22fc('0x21'),_0x53d5bc+'-'+_0x136f68+'/'+_0x462dd6)[_0x22fc('0x1c')](_0x2fc593);}return null;};}function patchUpdates(_0x21022b){return function(_0x243e6f){try{jsonpatch[_0x22fc('0x22')](_0x243e6f,_0x21022b,!![]);}catch(_0x1ee5d7){return BPromise[_0x22fc('0x23')](_0x1ee5d7);}return _0x243e6f[_0x22fc('0x24')]();};}function saveUpdates(_0x20e101,_0x290ca5){return function(_0x388a30){if(_0x388a30){return _0x388a30[_0x22fc('0x25')](_0x20e101)[_0x22fc('0x26')](function(_0x3d3480){return _0x3d3480;});}return null;};}function removeEntity(_0x31065c,_0x102c8a){return function(_0x31dda4){if(_0x31dda4){return _0x31dda4['destroy']()['then'](function(){_0x31065c[_0x22fc('0x1b')](0xcc)[_0x22fc('0x1a')]();});}};}function handleEntityNotFound(_0x4a9e5f,_0x4d29f4){return function(_0x4903df){if(!_0x4903df){_0x4a9e5f['sendStatus'](0x194);}return _0x4903df;};}function handleError(_0x5bd950,_0x4fd178){_0x4fd178=_0x4fd178||0x1f4;return function(_0x330872){logger['error'](_0x330872[_0x22fc('0x27')]);if(_0x330872['name']){delete _0x330872['name'];}_0x5bd950[_0x22fc('0x1b')](_0x4fd178)[_0x22fc('0x28')](_0x330872);};}exports[_0x22fc('0x29')]=function(_0x110692,_0x34c9e0){var _0x35f92b={},_0xe5507={},_0x21107e={'count':0x0,'rows':[]};var _0xd63c02=_['map'](db['ServicenowConfiguration'][_0x22fc('0x2a')],function(_0x1e3be2){return{'name':_0x1e3be2[_0x22fc('0x2b')],'type':_0x1e3be2[_0x22fc('0x2c')][_0x22fc('0x2d')]};});_0xe5507[_0x22fc('0x2e')]=_['map'](_0xd63c02,_0x22fc('0x2f'));_0xe5507['query']=_[_0x22fc('0x30')](_0x110692[_0x22fc('0x31')]);_0xe5507[_0x22fc('0x32')]=_['intersection'](_0xe5507[_0x22fc('0x2e')],_0xe5507[_0x22fc('0x31')]);_0x35f92b[_0x22fc('0x33')]=_[_0x22fc('0x34')](_0xe5507['model'],qs[_0x22fc('0x35')](_0x110692[_0x22fc('0x31')][_0x22fc('0x35')]));_0x35f92b[_0x22fc('0x33')]=_0x35f92b['attributes']['length']?_0x35f92b[_0x22fc('0x33')]:_0xe5507[_0x22fc('0x2e')];if(!_0x110692[_0x22fc('0x31')][_0x22fc('0x36')]('nolimit')){_0x35f92b[_0x22fc('0x1d')]=qs[_0x22fc('0x1d')](_0x110692[_0x22fc('0x31')][_0x22fc('0x1d')]);_0x35f92b['offset']=qs[_0x22fc('0x1e')](_0x110692[_0x22fc('0x31')][_0x22fc('0x1e')]);}_0x35f92b[_0x22fc('0x37')]=qs[_0x22fc('0x38')](_0x110692[_0x22fc('0x31')][_0x22fc('0x38')]);_0x35f92b[_0x22fc('0x39')]=qs[_0x22fc('0x32')](_['pick'](_0x110692[_0x22fc('0x31')],_0xe5507[_0x22fc('0x32')]),_0xd63c02);if(_0x110692['query'][_0x22fc('0x3a')]){_0x35f92b[_0x22fc('0x39')]=_[_0x22fc('0x3b')](_0x35f92b[_0x22fc('0x39')],{'$or':_[_0x22fc('0x3c')](_0xd63c02,function(_0x2a3ea1){if(_0x2a3ea1[_0x22fc('0x2c')]!==_0x22fc('0x3d')){var _0x59e409={};_0x59e409[_0x2a3ea1[_0x22fc('0x2f')]]={'$like':'%'+_0x110692[_0x22fc('0x31')]['filter']+'%'};return _0x59e409;}})});}_0x35f92b=_[_0x22fc('0x3b')]({},_0x35f92b,_0x110692['options']);var _0x136671={'where':_0x35f92b[_0x22fc('0x39')]};return db['ServicenowConfiguration']['count'](_0x136671)[_0x22fc('0x26')](function(_0x338aa3){_0x21107e['count']=_0x338aa3;if(_0x110692[_0x22fc('0x31')]['includeAll']){_0x35f92b[_0x22fc('0x3e')]=[{'all':!![]}];}return db[_0x22fc('0x3f')][_0x22fc('0x40')](_0x35f92b);})['then'](function(_0x5d2350){_0x21107e[_0x22fc('0x41')]=_0x5d2350;return _0x21107e;})['then'](respondWithFilteredResult(_0x34c9e0,_0x35f92b))[_0x22fc('0x42')](handleError(_0x34c9e0,null));};exports[_0x22fc('0x43')]=function(_0x2b1a17,_0x2c0664){var _0x1ad316={'raw':![],'where':{'id':_0x2b1a17[_0x22fc('0x44')]['id']}},_0x2fedb1={};_0x2fedb1['model']=_[_0x22fc('0x30')](db['ServicenowConfiguration'][_0x22fc('0x2a')]);_0x2fedb1[_0x22fc('0x31')]=_[_0x22fc('0x30')](_0x2b1a17['query']);_0x2fedb1[_0x22fc('0x32')]=_['intersection'](_0x2fedb1[_0x22fc('0x2e')],_0x2fedb1[_0x22fc('0x31')]);_0x1ad316[_0x22fc('0x33')]=_['intersection'](_0x2fedb1[_0x22fc('0x2e')],qs['fields'](_0x2b1a17[_0x22fc('0x31')][_0x22fc('0x35')]));_0x1ad316[_0x22fc('0x33')]=_0x1ad316[_0x22fc('0x33')][_0x22fc('0x45')]?_0x1ad316['attributes']:_0x2fedb1[_0x22fc('0x2e')];if(_0x2b1a17[_0x22fc('0x31')][_0x22fc('0x46')]){_0x1ad316[_0x22fc('0x3e')]=[{'all':!![]}];}_0x1ad316=_[_0x22fc('0x3b')]({},_0x1ad316,_0x2b1a17['options']);return db['ServicenowConfiguration'][_0x22fc('0x47')](_0x1ad316)['then'](handleEntityNotFound(_0x2c0664,null))['then'](respondWithResult(_0x2c0664,null))[_0x22fc('0x42')](handleError(_0x2c0664,null));};exports[_0x22fc('0x48')]=function(_0x57c28b,_0x361322){return db[_0x22fc('0x3f')][_0x22fc('0x48')](_0x57c28b['body'],{})[_0x22fc('0x26')](respondWithResult(_0x361322,0xc9))['catch'](handleError(_0x361322,null));};exports[_0x22fc('0x25')]=function(_0x18ce93,_0x46dcc1){if(_0x18ce93[_0x22fc('0x49')]['id']){delete _0x18ce93[_0x22fc('0x49')]['id'];}return db[_0x22fc('0x3f')]['find']({'where':{'id':_0x18ce93[_0x22fc('0x44')]['id']}})[_0x22fc('0x26')](handleEntityNotFound(_0x46dcc1,null))['then'](saveUpdates(_0x18ce93[_0x22fc('0x49')],null))[_0x22fc('0x26')](respondWithResult(_0x46dcc1,null))[_0x22fc('0x42')](handleError(_0x46dcc1,null));};exports['destroy']=function(_0xd38085,_0xd04389){return db[_0x22fc('0x3f')]['find']({'where':{'id':_0xd38085[_0x22fc('0x44')]['id']}})[_0x22fc('0x26')](handleEntityNotFound(_0xd04389,null))[_0x22fc('0x26')](removeEntity(_0xd04389,null))['catch'](handleError(_0xd04389,null));};exports[_0x22fc('0x4a')]=function(_0x526c24,_0x2a0f64,_0x448a10){var _0x6db8b5={};var _0x1ead27={};var _0x295cf6;var _0x125e5d;return db[_0x22fc('0x3f')][_0x22fc('0x4b')]({'where':{'id':_0x526c24[_0x22fc('0x44')]['id']}})[_0x22fc('0x26')](handleEntityNotFound(_0x2a0f64,null))[_0x22fc('0x26')](function(_0x184498){if(_0x184498){_0x295cf6=_0x184498;_0x1ead27[_0x22fc('0x2e')]=_[_0x22fc('0x30')](db[_0x22fc('0x4c')][_0x22fc('0x2a')]);_0x1ead27[_0x22fc('0x31')]=_[_0x22fc('0x30')](_0x526c24[_0x22fc('0x31')]);_0x1ead27['filters']=_[_0x22fc('0x34')](_0x1ead27[_0x22fc('0x2e')],_0x1ead27[_0x22fc('0x31')]);_0x6db8b5[_0x22fc('0x33')]=_[_0x22fc('0x34')](_0x1ead27[_0x22fc('0x2e')],qs[_0x22fc('0x35')](_0x526c24['query'][_0x22fc('0x35')]));_0x6db8b5['attributes']=_0x6db8b5[_0x22fc('0x33')]['length']?_0x6db8b5[_0x22fc('0x33')]:_0x1ead27[_0x22fc('0x2e')];_0x6db8b5[_0x22fc('0x37')]=qs[_0x22fc('0x38')](_0x526c24[_0x22fc('0x31')][_0x22fc('0x38')]);_0x6db8b5[_0x22fc('0x39')]=qs[_0x22fc('0x32')](_[_0x22fc('0x4d')](_0x526c24[_0x22fc('0x31')],_0x1ead27[_0x22fc('0x32')]));if(_0x526c24[_0x22fc('0x31')][_0x22fc('0x3a')]){_0x6db8b5[_0x22fc('0x39')]=_[_0x22fc('0x3b')](_0x6db8b5[_0x22fc('0x39')],{'$or':_[_0x22fc('0x3c')](_0x6db8b5['attributes'],function(_0xd68292){var _0x499e5a={};_0x499e5a[_0xd68292]={'$like':'%'+_0x526c24[_0x22fc('0x31')][_0x22fc('0x3a')]+'%'};return _0x499e5a;})});}_0x6db8b5=_[_0x22fc('0x3b')]({},_0x6db8b5,_0x526c24[_0x22fc('0x4e')]);return _0x295cf6[_0x22fc('0x4a')](_0x6db8b5);}})[_0x22fc('0x26')](function(_0x5f56f0){if(_0x5f56f0){_0x125e5d=_0x5f56f0['length'];if(!_0x526c24['query'][_0x22fc('0x36')](_0x22fc('0x4f'))){_0x6db8b5['limit']=qs['limit'](_0x526c24[_0x22fc('0x31')][_0x22fc('0x1d')]);_0x6db8b5[_0x22fc('0x1e')]=qs[_0x22fc('0x1e')](_0x526c24[_0x22fc('0x31')][_0x22fc('0x1e')]);}return _0x295cf6[_0x22fc('0x4a')](_0x6db8b5);}})[_0x22fc('0x26')](function(_0x3a8f97){if(_0x3a8f97){return _0x3a8f97?{'count':_0x125e5d,'rows':_0x3a8f97}:null;}})[_0x22fc('0x26')](respondWithResult(_0x2a0f64,null))[_0x22fc('0x42')](handleError(_0x2a0f64,null));};exports[_0x22fc('0x50')]=function(_0x2deed2,_0x136e3e,_0x48feca){var _0xddd38f={};var _0x13e680={};var _0x1dc3ba;var _0x38bcbc;return db[_0x22fc('0x3f')]['findOne']({'where':{'id':_0x2deed2[_0x22fc('0x44')]['id']}})[_0x22fc('0x26')](handleEntityNotFound(_0x136e3e,null))['then'](function(_0x44d0f2){if(_0x44d0f2){_0x1dc3ba=_0x44d0f2;_0x13e680[_0x22fc('0x2e')]=_[_0x22fc('0x30')](db[_0x22fc('0x4c')][_0x22fc('0x2a')]);_0x13e680[_0x22fc('0x31')]=_[_0x22fc('0x30')](_0x2deed2[_0x22fc('0x31')]);_0x13e680[_0x22fc('0x32')]=_[_0x22fc('0x34')](_0x13e680['model'],_0x13e680[_0x22fc('0x31')]);_0xddd38f[_0x22fc('0x33')]=_[_0x22fc('0x34')](_0x13e680[_0x22fc('0x2e')],qs[_0x22fc('0x35')](_0x2deed2['query'][_0x22fc('0x35')]));_0xddd38f['attributes']=_0xddd38f['attributes']['length']?_0xddd38f[_0x22fc('0x33')]:_0x13e680[_0x22fc('0x2e')];_0xddd38f[_0x22fc('0x37')]=qs['sort'](_0x2deed2[_0x22fc('0x31')]['sort']);_0xddd38f[_0x22fc('0x39')]=qs[_0x22fc('0x32')](_['pick'](_0x2deed2[_0x22fc('0x31')],_0x13e680[_0x22fc('0x32')]));if(_0x2deed2[_0x22fc('0x31')][_0x22fc('0x3a')]){_0xddd38f[_0x22fc('0x39')]=_[_0x22fc('0x3b')](_0xddd38f[_0x22fc('0x39')],{'$or':_['map'](_0xddd38f[_0x22fc('0x33')],function(_0x3ef01e){var _0x4073ae={};_0x4073ae[_0x3ef01e]={'$like':'%'+_0x2deed2[_0x22fc('0x31')][_0x22fc('0x3a')]+'%'};return _0x4073ae;})});}_0xddd38f=_[_0x22fc('0x3b')]({},_0xddd38f,_0x2deed2[_0x22fc('0x4e')]);return _0x1dc3ba[_0x22fc('0x50')](_0xddd38f);}})[_0x22fc('0x26')](function(_0x40f027){if(_0x40f027){_0x38bcbc=_0x40f027[_0x22fc('0x45')];if(!_0x2deed2[_0x22fc('0x31')][_0x22fc('0x36')]('nolimit')){_0xddd38f[_0x22fc('0x1d')]=qs['limit'](_0x2deed2[_0x22fc('0x31')][_0x22fc('0x1d')]);_0xddd38f[_0x22fc('0x1e')]=qs[_0x22fc('0x1e')](_0x2deed2[_0x22fc('0x31')][_0x22fc('0x1e')]);}return _0x1dc3ba[_0x22fc('0x50')](_0xddd38f);}})['then'](function(_0x49d0e9){if(_0x49d0e9){return _0x49d0e9?{'count':_0x38bcbc,'rows':_0x49d0e9}:null;}})[_0x22fc('0x26')](respondWithResult(_0x136e3e,null))[_0x22fc('0x42')](handleError(_0x136e3e,null));};exports[_0x22fc('0x51')]=function(_0x170795,_0x49c9d5,_0xfbe0e1){var _0x42e20d={};var _0x426f46={};var _0x31fe0f;var _0x1afefa;return db['ServicenowConfiguration'][_0x22fc('0x4b')]({'where':{'id':_0x170795[_0x22fc('0x44')]['id']}})[_0x22fc('0x26')](handleEntityNotFound(_0x49c9d5,null))[_0x22fc('0x26')](function(_0x3a4b23){if(_0x3a4b23){_0x31fe0f=_0x3a4b23;_0x426f46[_0x22fc('0x2e')]=_[_0x22fc('0x30')](db[_0x22fc('0x4c')][_0x22fc('0x2a')]);_0x426f46[_0x22fc('0x31')]=_['keys'](_0x170795[_0x22fc('0x31')]);_0x426f46[_0x22fc('0x32')]=_['intersection'](_0x426f46[_0x22fc('0x2e')],_0x426f46[_0x22fc('0x31')]);_0x42e20d[_0x22fc('0x33')]=_['intersection'](_0x426f46[_0x22fc('0x2e')],qs['fields'](_0x170795['query'][_0x22fc('0x35')]));_0x42e20d['attributes']=_0x42e20d[_0x22fc('0x33')][_0x22fc('0x45')]?_0x42e20d[_0x22fc('0x33')]:_0x426f46[_0x22fc('0x2e')];_0x42e20d[_0x22fc('0x37')]=qs[_0x22fc('0x38')](_0x170795[_0x22fc('0x31')][_0x22fc('0x38')]);_0x42e20d[_0x22fc('0x39')]=qs[_0x22fc('0x32')](_[_0x22fc('0x4d')](_0x170795[_0x22fc('0x31')],_0x426f46[_0x22fc('0x32')]));if(_0x170795[_0x22fc('0x31')]['filter']){_0x42e20d['where']=_[_0x22fc('0x3b')](_0x42e20d[_0x22fc('0x39')],{'$or':_['map'](_0x42e20d[_0x22fc('0x33')],function(_0x4d1dee){var _0x3985aa={};_0x3985aa[_0x4d1dee]={'$like':'%'+_0x170795['query'][_0x22fc('0x3a')]+'%'};return _0x3985aa;})});}_0x42e20d=_['merge']({},_0x42e20d,_0x170795[_0x22fc('0x4e')]);return _0x31fe0f[_0x22fc('0x51')](_0x42e20d);}})['then'](function(_0x4d1943){if(_0x4d1943){_0x1afefa=_0x4d1943[_0x22fc('0x45')];if(!_0x170795[_0x22fc('0x31')][_0x22fc('0x36')]('nolimit')){_0x42e20d[_0x22fc('0x1d')]=qs[_0x22fc('0x1d')](_0x170795[_0x22fc('0x31')][_0x22fc('0x1d')]);_0x42e20d['offset']=qs['offset'](_0x170795[_0x22fc('0x31')][_0x22fc('0x1e')]);}return _0x31fe0f[_0x22fc('0x51')](_0x42e20d);}})['then'](function(_0x4e916f){if(_0x4e916f){return _0x4e916f?{'count':_0x1afefa,'rows':_0x4e916f}:null;}})[_0x22fc('0x26')](respondWithResult(_0x49c9d5,null))[_0x22fc('0x42')](handleError(_0x49c9d5,null));}; \ No newline at end of file +var _0xe3a4=['apply','reject','save','then','destroy','stack','name','index','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','getFields','getSubjects','ServicenowField','getDescriptions','findOne','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','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','sendStatus','end','json','offset','undefined','count','status','set'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xe3a4,0xc8));var _0x4e3a=function(_0x2212b2,_0x3cacae){_0x2212b2=_0x2212b2-0x0;var _0x4a2ca0=_0xe3a4[_0x2212b2];return _0x4a2ca0;};'use strict';var emlformat=require(_0x4e3a('0x0'));var rimraf=require(_0x4e3a('0x1'));var zipdir=require(_0x4e3a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e3a('0x3'));var moment=require(_0x4e3a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4e3a('0x5'));var util=require(_0x4e3a('0x6'));var path=require(_0x4e3a('0x7'));var sox=require('sox');var csv=require(_0x4e3a('0x8'));var ejs=require(_0x4e3a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4e3a('0xa'));var jsforce=require(_0x4e3a('0xb'));var deskjs=require(_0x4e3a('0xc'));var toCsv=require(_0x4e3a('0x8'));var querystring=require(_0x4e3a('0xd'));var Papa=require(_0x4e3a('0xe'));var Redis=require(_0x4e3a('0xf'));var authService=require(_0x4e3a('0x10'));var qs=require(_0x4e3a('0x11'));var as=require(_0x4e3a('0x12'));var hardwareService=require(_0x4e3a('0x13'));var logger=require('../../config/logger')(_0x4e3a('0x14'));var utils=require(_0x4e3a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4e3a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f0550,_0x509622){_0x509622=_0x509622||0xcc;return function(_0x4f4345){if(_0x4f4345){return _0x1f0550[_0x4e3a('0x17')](_0x509622);}return _0x1f0550['status'](_0x509622)[_0x4e3a('0x18')]();};}function respondWithResult(_0x5a1ca3,_0x2b09f5){_0x2b09f5=_0x2b09f5||0xc8;return function(_0x3dc649){if(_0x3dc649){return _0x5a1ca3['status'](_0x2b09f5)[_0x4e3a('0x19')](_0x3dc649);}};}function respondWithFilteredResult(_0x288ab1,_0xd7fc2a){return function(_0x14d7d5){if(_0x14d7d5){var _0x51010f=typeof _0xd7fc2a[_0x4e3a('0x1a')]===_0x4e3a('0x1b')&&typeof _0xd7fc2a['limit']===_0x4e3a('0x1b');var _0x589bd6=_0x14d7d5['count'];var _0x76e09c=_0x51010f?0x0:_0xd7fc2a['offset'];var _0x10110b=_0x51010f?_0x14d7d5[_0x4e3a('0x1c')]:_0xd7fc2a[_0x4e3a('0x1a')]+_0xd7fc2a['limit'];var _0x3b79f9;if(_0x10110b>=_0x589bd6){_0x10110b=_0x589bd6;_0x3b79f9=0xc8;}else{_0x3b79f9=0xce;}_0x288ab1[_0x4e3a('0x1d')](_0x3b79f9);return _0x288ab1[_0x4e3a('0x1e')]('Content-Range',_0x76e09c+'-'+_0x10110b+'/'+_0x589bd6)['json'](_0x14d7d5);}return null;};}function patchUpdates(_0x489a65){return function(_0x1b3bdd){try{jsonpatch[_0x4e3a('0x1f')](_0x1b3bdd,_0x489a65,!![]);}catch(_0x16be1a){return BPromise[_0x4e3a('0x20')](_0x16be1a);}return _0x1b3bdd[_0x4e3a('0x21')]();};}function saveUpdates(_0x3a1bf3,_0x582016){return function(_0x4d489f){if(_0x4d489f){return _0x4d489f['update'](_0x3a1bf3)[_0x4e3a('0x22')](function(_0xe22a99){return _0xe22a99;});}return null;};}function removeEntity(_0x5e22b2,_0x104750){return function(_0x3d1d66){if(_0x3d1d66){return _0x3d1d66[_0x4e3a('0x23')]()[_0x4e3a('0x22')](function(){_0x5e22b2[_0x4e3a('0x1d')](0xcc)[_0x4e3a('0x18')]();});}};}function handleEntityNotFound(_0x102ab0,_0x2803da){return function(_0x151f99){if(!_0x151f99){_0x102ab0['sendStatus'](0x194);}return _0x151f99;};}function handleError(_0xd79ef1,_0x3ce4bb){_0x3ce4bb=_0x3ce4bb||0x1f4;return function(_0x3f08c8){logger['error'](_0x3f08c8[_0x4e3a('0x24')]);if(_0x3f08c8['name']){delete _0x3f08c8[_0x4e3a('0x25')];}_0xd79ef1[_0x4e3a('0x1d')](_0x3ce4bb)['send'](_0x3f08c8);};}exports[_0x4e3a('0x26')]=function(_0x570666,_0x44a994){var _0x523a8c={},_0x4d435d={},_0xc68623={'count':0x0,'rows':[]};var _0x8f7600=_['map'](db[_0x4e3a('0x27')][_0x4e3a('0x28')],function(_0x4ab902){return{'name':_0x4ab902[_0x4e3a('0x29')],'type':_0x4ab902[_0x4e3a('0x2a')]['key']};});_0x4d435d[_0x4e3a('0x2b')]=_['map'](_0x8f7600,_0x4e3a('0x25'));_0x4d435d[_0x4e3a('0x2c')]=_['keys'](_0x570666[_0x4e3a('0x2c')]);_0x4d435d[_0x4e3a('0x2d')]=_[_0x4e3a('0x2e')](_0x4d435d[_0x4e3a('0x2b')],_0x4d435d['query']);_0x523a8c[_0x4e3a('0x2f')]=_[_0x4e3a('0x2e')](_0x4d435d[_0x4e3a('0x2b')],qs['fields'](_0x570666[_0x4e3a('0x2c')][_0x4e3a('0x30')]));_0x523a8c[_0x4e3a('0x2f')]=_0x523a8c[_0x4e3a('0x2f')][_0x4e3a('0x31')]?_0x523a8c[_0x4e3a('0x2f')]:_0x4d435d[_0x4e3a('0x2b')];if(!_0x570666[_0x4e3a('0x2c')][_0x4e3a('0x32')](_0x4e3a('0x33'))){_0x523a8c[_0x4e3a('0x34')]=qs[_0x4e3a('0x34')](_0x570666[_0x4e3a('0x2c')][_0x4e3a('0x34')]);_0x523a8c['offset']=qs['offset'](_0x570666[_0x4e3a('0x2c')][_0x4e3a('0x1a')]);}_0x523a8c[_0x4e3a('0x35')]=qs[_0x4e3a('0x36')](_0x570666[_0x4e3a('0x2c')][_0x4e3a('0x36')]);_0x523a8c[_0x4e3a('0x37')]=qs[_0x4e3a('0x2d')](_[_0x4e3a('0x38')](_0x570666[_0x4e3a('0x2c')],_0x4d435d['filters']),_0x8f7600);if(_0x570666[_0x4e3a('0x2c')][_0x4e3a('0x39')]){_0x523a8c['where']=_[_0x4e3a('0x3a')](_0x523a8c[_0x4e3a('0x37')],{'$or':_[_0x4e3a('0x3b')](_0x8f7600,function(_0x3fed48){if(_0x3fed48[_0x4e3a('0x2a')]!=='VIRTUAL'){var _0x9269e6={};_0x9269e6[_0x3fed48[_0x4e3a('0x25')]]={'$like':'%'+_0x570666[_0x4e3a('0x2c')]['filter']+'%'};return _0x9269e6;}})});}_0x523a8c=_[_0x4e3a('0x3a')]({},_0x523a8c,_0x570666[_0x4e3a('0x3c')]);var _0x45f04b={'where':_0x523a8c[_0x4e3a('0x37')]};return db[_0x4e3a('0x27')][_0x4e3a('0x1c')](_0x45f04b)[_0x4e3a('0x22')](function(_0x40f430){_0xc68623['count']=_0x40f430;if(_0x570666[_0x4e3a('0x2c')][_0x4e3a('0x3d')]){_0x523a8c[_0x4e3a('0x3e')]=[{'all':!![]}];}return db[_0x4e3a('0x27')][_0x4e3a('0x3f')](_0x523a8c);})[_0x4e3a('0x22')](function(_0x20bd63){_0xc68623[_0x4e3a('0x40')]=_0x20bd63;return _0xc68623;})[_0x4e3a('0x22')](respondWithFilteredResult(_0x44a994,_0x523a8c))['catch'](handleError(_0x44a994,null));};exports[_0x4e3a('0x41')]=function(_0x36c041,_0x2fcd44){var _0x14bc32={'raw':![],'where':{'id':_0x36c041[_0x4e3a('0x42')]['id']}},_0x2de073={};_0x2de073[_0x4e3a('0x2b')]=_['keys'](db['ServicenowConfiguration'][_0x4e3a('0x28')]);_0x2de073[_0x4e3a('0x2c')]=_[_0x4e3a('0x43')](_0x36c041[_0x4e3a('0x2c')]);_0x2de073['filters']=_[_0x4e3a('0x2e')](_0x2de073[_0x4e3a('0x2b')],_0x2de073['query']);_0x14bc32[_0x4e3a('0x2f')]=_[_0x4e3a('0x2e')](_0x2de073[_0x4e3a('0x2b')],qs[_0x4e3a('0x30')](_0x36c041[_0x4e3a('0x2c')][_0x4e3a('0x30')]));_0x14bc32[_0x4e3a('0x2f')]=_0x14bc32[_0x4e3a('0x2f')][_0x4e3a('0x31')]?_0x14bc32[_0x4e3a('0x2f')]:_0x2de073[_0x4e3a('0x2b')];if(_0x36c041[_0x4e3a('0x2c')][_0x4e3a('0x3d')]){_0x14bc32['include']=[{'all':!![]}];}_0x14bc32=_[_0x4e3a('0x3a')]({},_0x14bc32,_0x36c041[_0x4e3a('0x3c')]);return db['ServicenowConfiguration'][_0x4e3a('0x44')](_0x14bc32)['then'](handleEntityNotFound(_0x2fcd44,null))[_0x4e3a('0x22')](respondWithResult(_0x2fcd44,null))[_0x4e3a('0x45')](handleError(_0x2fcd44,null));};exports[_0x4e3a('0x46')]=function(_0x53ebb1,_0x4353e7){return db[_0x4e3a('0x27')]['create'](_0x53ebb1[_0x4e3a('0x47')],{})[_0x4e3a('0x22')](respondWithResult(_0x4353e7,0xc9))[_0x4e3a('0x45')](handleError(_0x4353e7,null));};exports['update']=function(_0x58cdfb,_0x2f35df){if(_0x58cdfb[_0x4e3a('0x47')]['id']){delete _0x58cdfb[_0x4e3a('0x47')]['id'];}return db[_0x4e3a('0x27')]['find']({'where':{'id':_0x58cdfb[_0x4e3a('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f35df,null))[_0x4e3a('0x22')](saveUpdates(_0x58cdfb[_0x4e3a('0x47')],null))[_0x4e3a('0x22')](respondWithResult(_0x2f35df,null))[_0x4e3a('0x45')](handleError(_0x2f35df,null));};exports[_0x4e3a('0x23')]=function(_0x54a8d5,_0xc63f6d){return db[_0x4e3a('0x27')][_0x4e3a('0x44')]({'where':{'id':_0x54a8d5['params']['id']}})[_0x4e3a('0x22')](handleEntityNotFound(_0xc63f6d,null))[_0x4e3a('0x22')](removeEntity(_0xc63f6d,null))[_0x4e3a('0x45')](handleError(_0xc63f6d,null));};exports[_0x4e3a('0x48')]=function(_0x1a6637,_0x15713d,_0x1ecec1){var _0x2be8a3={};var _0x3da858={};var _0x2ed6b5;var _0x1fc7ee;return db[_0x4e3a('0x27')]['findOne']({'where':{'id':_0x1a6637['params']['id']}})['then'](handleEntityNotFound(_0x15713d,null))[_0x4e3a('0x22')](function(_0x10972b){if(_0x10972b){_0x2ed6b5=_0x10972b;_0x3da858[_0x4e3a('0x2b')]=_[_0x4e3a('0x43')](db['ServicenowField'][_0x4e3a('0x28')]);_0x3da858[_0x4e3a('0x2c')]=_[_0x4e3a('0x43')](_0x1a6637[_0x4e3a('0x2c')]);_0x3da858['filters']=_[_0x4e3a('0x2e')](_0x3da858[_0x4e3a('0x2b')],_0x3da858[_0x4e3a('0x2c')]);_0x2be8a3[_0x4e3a('0x2f')]=_[_0x4e3a('0x2e')](_0x3da858[_0x4e3a('0x2b')],qs[_0x4e3a('0x30')](_0x1a6637[_0x4e3a('0x2c')][_0x4e3a('0x30')]));_0x2be8a3[_0x4e3a('0x2f')]=_0x2be8a3[_0x4e3a('0x2f')][_0x4e3a('0x31')]?_0x2be8a3[_0x4e3a('0x2f')]:_0x3da858['model'];_0x2be8a3[_0x4e3a('0x35')]=qs[_0x4e3a('0x36')](_0x1a6637[_0x4e3a('0x2c')][_0x4e3a('0x36')]);_0x2be8a3[_0x4e3a('0x37')]=qs[_0x4e3a('0x2d')](_[_0x4e3a('0x38')](_0x1a6637[_0x4e3a('0x2c')],_0x3da858[_0x4e3a('0x2d')]));if(_0x1a6637[_0x4e3a('0x2c')]['filter']){_0x2be8a3[_0x4e3a('0x37')]=_[_0x4e3a('0x3a')](_0x2be8a3[_0x4e3a('0x37')],{'$or':_[_0x4e3a('0x3b')](_0x2be8a3['attributes'],function(_0xc85805){var _0x26a8d0={};_0x26a8d0[_0xc85805]={'$like':'%'+_0x1a6637[_0x4e3a('0x2c')][_0x4e3a('0x39')]+'%'};return _0x26a8d0;})});}_0x2be8a3=_[_0x4e3a('0x3a')]({},_0x2be8a3,_0x1a6637[_0x4e3a('0x3c')]);return _0x2ed6b5[_0x4e3a('0x48')](_0x2be8a3);}})[_0x4e3a('0x22')](function(_0x516d6d){if(_0x516d6d){_0x1fc7ee=_0x516d6d[_0x4e3a('0x31')];if(!_0x1a6637['query'][_0x4e3a('0x32')](_0x4e3a('0x33'))){_0x2be8a3[_0x4e3a('0x34')]=qs[_0x4e3a('0x34')](_0x1a6637[_0x4e3a('0x2c')][_0x4e3a('0x34')]);_0x2be8a3[_0x4e3a('0x1a')]=qs[_0x4e3a('0x1a')](_0x1a6637[_0x4e3a('0x2c')][_0x4e3a('0x1a')]);}return _0x2ed6b5[_0x4e3a('0x48')](_0x2be8a3);}})['then'](function(_0x29c8d1){if(_0x29c8d1){return _0x29c8d1?{'count':_0x1fc7ee,'rows':_0x29c8d1}:null;}})['then'](respondWithResult(_0x15713d,null))[_0x4e3a('0x45')](handleError(_0x15713d,null));};exports[_0x4e3a('0x49')]=function(_0x24a8d2,_0x20b9f0,_0x508f83){var _0x49df35={};var _0x3be3bb={};var _0x4f60cd;var _0x33d232;return db[_0x4e3a('0x27')]['findOne']({'where':{'id':_0x24a8d2[_0x4e3a('0x42')]['id']}})[_0x4e3a('0x22')](handleEntityNotFound(_0x20b9f0,null))[_0x4e3a('0x22')](function(_0x59af4c){if(_0x59af4c){_0x4f60cd=_0x59af4c;_0x3be3bb[_0x4e3a('0x2b')]=_[_0x4e3a('0x43')](db[_0x4e3a('0x4a')][_0x4e3a('0x28')]);_0x3be3bb['query']=_[_0x4e3a('0x43')](_0x24a8d2[_0x4e3a('0x2c')]);_0x3be3bb[_0x4e3a('0x2d')]=_[_0x4e3a('0x2e')](_0x3be3bb[_0x4e3a('0x2b')],_0x3be3bb[_0x4e3a('0x2c')]);_0x49df35['attributes']=_[_0x4e3a('0x2e')](_0x3be3bb[_0x4e3a('0x2b')],qs[_0x4e3a('0x30')](_0x24a8d2['query'][_0x4e3a('0x30')]));_0x49df35['attributes']=_0x49df35[_0x4e3a('0x2f')][_0x4e3a('0x31')]?_0x49df35[_0x4e3a('0x2f')]:_0x3be3bb[_0x4e3a('0x2b')];_0x49df35[_0x4e3a('0x35')]=qs[_0x4e3a('0x36')](_0x24a8d2[_0x4e3a('0x2c')][_0x4e3a('0x36')]);_0x49df35[_0x4e3a('0x37')]=qs[_0x4e3a('0x2d')](_[_0x4e3a('0x38')](_0x24a8d2[_0x4e3a('0x2c')],_0x3be3bb['filters']));if(_0x24a8d2[_0x4e3a('0x2c')]['filter']){_0x49df35[_0x4e3a('0x37')]=_[_0x4e3a('0x3a')](_0x49df35['where'],{'$or':_[_0x4e3a('0x3b')](_0x49df35[_0x4e3a('0x2f')],function(_0x87821c){var _0x21069a={};_0x21069a[_0x87821c]={'$like':'%'+_0x24a8d2['query'][_0x4e3a('0x39')]+'%'};return _0x21069a;})});}_0x49df35=_[_0x4e3a('0x3a')]({},_0x49df35,_0x24a8d2[_0x4e3a('0x3c')]);return _0x4f60cd[_0x4e3a('0x49')](_0x49df35);}})[_0x4e3a('0x22')](function(_0x391a5e){if(_0x391a5e){_0x33d232=_0x391a5e[_0x4e3a('0x31')];if(!_0x24a8d2['query'][_0x4e3a('0x32')](_0x4e3a('0x33'))){_0x49df35[_0x4e3a('0x34')]=qs[_0x4e3a('0x34')](_0x24a8d2[_0x4e3a('0x2c')][_0x4e3a('0x34')]);_0x49df35[_0x4e3a('0x1a')]=qs['offset'](_0x24a8d2[_0x4e3a('0x2c')][_0x4e3a('0x1a')]);}return _0x4f60cd[_0x4e3a('0x49')](_0x49df35);}})[_0x4e3a('0x22')](function(_0x4bc8a6){if(_0x4bc8a6){return _0x4bc8a6?{'count':_0x33d232,'rows':_0x4bc8a6}:null;}})['then'](respondWithResult(_0x20b9f0,null))[_0x4e3a('0x45')](handleError(_0x20b9f0,null));};exports[_0x4e3a('0x4b')]=function(_0x9db404,_0x480cef,_0x43821a){var _0x46146e={};var _0x4faf98={};var _0x73429e;var _0x88cea9;return db[_0x4e3a('0x27')][_0x4e3a('0x4c')]({'where':{'id':_0x9db404['params']['id']}})[_0x4e3a('0x22')](handleEntityNotFound(_0x480cef,null))['then'](function(_0x43389d){if(_0x43389d){_0x73429e=_0x43389d;_0x4faf98[_0x4e3a('0x2b')]=_['keys'](db[_0x4e3a('0x4a')][_0x4e3a('0x28')]);_0x4faf98['query']=_[_0x4e3a('0x43')](_0x9db404['query']);_0x4faf98[_0x4e3a('0x2d')]=_[_0x4e3a('0x2e')](_0x4faf98[_0x4e3a('0x2b')],_0x4faf98[_0x4e3a('0x2c')]);_0x46146e['attributes']=_[_0x4e3a('0x2e')](_0x4faf98[_0x4e3a('0x2b')],qs[_0x4e3a('0x30')](_0x9db404[_0x4e3a('0x2c')][_0x4e3a('0x30')]));_0x46146e[_0x4e3a('0x2f')]=_0x46146e[_0x4e3a('0x2f')][_0x4e3a('0x31')]?_0x46146e[_0x4e3a('0x2f')]:_0x4faf98[_0x4e3a('0x2b')];_0x46146e[_0x4e3a('0x35')]=qs[_0x4e3a('0x36')](_0x9db404[_0x4e3a('0x2c')][_0x4e3a('0x36')]);_0x46146e[_0x4e3a('0x37')]=qs[_0x4e3a('0x2d')](_['pick'](_0x9db404[_0x4e3a('0x2c')],_0x4faf98[_0x4e3a('0x2d')]));if(_0x9db404[_0x4e3a('0x2c')][_0x4e3a('0x39')]){_0x46146e[_0x4e3a('0x37')]=_[_0x4e3a('0x3a')](_0x46146e[_0x4e3a('0x37')],{'$or':_[_0x4e3a('0x3b')](_0x46146e[_0x4e3a('0x2f')],function(_0x4cca6a){var _0x45b0db={};_0x45b0db[_0x4cca6a]={'$like':'%'+_0x9db404[_0x4e3a('0x2c')][_0x4e3a('0x39')]+'%'};return _0x45b0db;})});}_0x46146e=_[_0x4e3a('0x3a')]({},_0x46146e,_0x9db404[_0x4e3a('0x3c')]);return _0x73429e['getDescriptions'](_0x46146e);}})[_0x4e3a('0x22')](function(_0x18b378){if(_0x18b378){_0x88cea9=_0x18b378[_0x4e3a('0x31')];if(!_0x9db404[_0x4e3a('0x2c')][_0x4e3a('0x32')]('nolimit')){_0x46146e[_0x4e3a('0x34')]=qs['limit'](_0x9db404['query'][_0x4e3a('0x34')]);_0x46146e[_0x4e3a('0x1a')]=qs[_0x4e3a('0x1a')](_0x9db404['query'][_0x4e3a('0x1a')]);}return _0x73429e[_0x4e3a('0x4b')](_0x46146e);}})[_0x4e3a('0x22')](function(_0x51032c){if(_0x51032c){return _0x51032c?{'count':_0x88cea9,'rows':_0x51032c}:null;}})[_0x4e3a('0x22')](respondWithResult(_0x480cef,null))[_0x4e3a('0x45')](handleError(_0x480cef,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 4e0e79c..2ef495f 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 _0x758a=['api','moment','bluebird','../../config/environment','exports','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x2c7cef,_0x52f00c){var _0x2c513b=function(_0x13099b){while(--_0x13099b){_0x2c7cef['push'](_0x2c7cef['shift']());}};_0x2c513b(++_0x52f00c);}(_0x758a,0x1d1));var _0xa758=function(_0x4489b8,_0x5992ba){_0x4489b8=_0x4489b8-0x0;var _0x3b4650=_0x758a[_0x4489b8];return _0x3b4650;};'use strict';var _=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var logger=require(_0xa758('0x2'))(_0xa758('0x3'));var moment=require(_0xa758('0x4'));var BPromise=require(_0xa758('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa758('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xa758('0x7')]=function(_0xa38e27,_0x1c13d4){return _0xa38e27['define']('ServicenowConfiguration',attributes,{'tableName':_0xa758('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaebd=['moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','../../config/logger','api'];(function(_0x417ab1,_0x1b4af8){var _0x49715f=function(_0x2af149){while(--_0x2af149){_0x417ab1['push'](_0x417ab1['shift']());}};_0x49715f(++_0x1b4af8);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x31967e,_0x32f2a6){_0x31967e=_0x31967e-0x0;var _0x2e59e4=_0xaebd[_0x31967e];return _0x2e59e4;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var logger=require(_0xdaeb('0x1'))(_0xdaeb('0x2'));var moment=require(_0xdaeb('0x3'));var BPromise=require(_0xdaeb('0x4'));var rp=require(_0xdaeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var attributes=require(_0xdaeb('0x8'));module[_0xdaeb('0x9')]=function(_0xee94f9,_0x4b7255){return _0xee94f9[_0xdaeb('0xa')](_0xdaeb('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 9c9bcfc..4fd70c5 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 _0x95a2=['../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4b8191,_0xbac94f){var _0x1336b6=function(_0x2f925e){while(--_0x2f925e){_0x4b8191['push'](_0x4b8191['shift']());}};_0x1336b6(++_0xbac94f);}(_0x95a2,0x1e1));var _0x295a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x95a2[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x295a('0x0'));var util=require(_0x295a('0x1'));var moment=require('moment');var BPromise=require(_0x295a('0x2'));var rs=require(_0x295a('0x3'));var fs=require('fs');var Redis=require(_0x295a('0x4'));var db=require(_0x295a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x295a('0x6'))('rpc');var config=require(_0x295a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x295a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ee0ac,_0x3562ef,_0xfef6a){return new BPromise(function(_0x29255d,_0x409b50){return client[_0x295a('0x9')](_0x1ee0ac,_0xfef6a)[_0x295a('0xa')](function(_0x3b745d){logger[_0x295a('0xb')](_0x295a('0xc'),_0x3562ef,_0x295a('0xd'));logger['debug'](_0x295a('0xe'),_0x3562ef,'request\x20sent',JSON['stringify'](_0x3b745d));if(_0x3b745d[_0x295a('0xf')]){if(_0x3b745d[_0x295a('0xf')]['code']===0x1f4){logger[_0x295a('0xf')](_0x295a('0xc'),_0x3562ef,_0x3b745d[_0x295a('0xf')][_0x295a('0x10')]);return _0x409b50(_0x3b745d[_0x295a('0xf')][_0x295a('0x10')]);}logger[_0x295a('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3562ef,_0x3b745d[_0x295a('0xf')]['message']);return _0x29255d(_0x3b745d['error'][_0x295a('0x10')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x3562ef,_0x295a('0xd'));_0x29255d(_0x3b745d[_0x295a('0x11')][_0x295a('0x10')]);}})['catch'](function(_0x57626b){logger[_0x295a('0xf')](_0x295a('0xc'),_0x3562ef,_0x57626b);_0x409b50(_0x57626b);});});} \ No newline at end of file +var _0xc0aa=['../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xe29420,_0x84d403){var _0xa21922=function(_0x3c764e){while(--_0x3c764e){_0xe29420['push'](_0xe29420['shift']());}};_0xa21922(++_0x84d403);}(_0xc0aa,0x1f3));var _0xac0a=function(_0x2d6bc2,_0x38c19d){_0x2d6bc2=_0x2d6bc2-0x0;var _0x2d6b21=_0xc0aa[_0x2d6bc2];return _0x2d6b21;};'use strict';var _=require(_0xac0a('0x0'));var util=require('util');var moment=require(_0xac0a('0x1'));var BPromise=require(_0xac0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac0a('0x3'));var db=require(_0xac0a('0x4'))['db'];var utils=require(_0xac0a('0x5'));var logger=require('../../config/logger')(_0xac0a('0x6'));var config=require(_0xac0a('0x7'));var jayson=require(_0xac0a('0x8'));var client=jayson[_0xac0a('0x9')][_0xac0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fd1a2,_0x1c68c3,_0x2c5c54){return new BPromise(function(_0x5dfed9,_0x57853f){return client[_0xac0a('0xb')](_0x3fd1a2,_0x2c5c54)[_0xac0a('0xc')](function(_0x441029){logger[_0xac0a('0xd')](_0xac0a('0xe'),_0x1c68c3,_0xac0a('0xf'));logger[_0xac0a('0x10')](_0xac0a('0x11'),_0x1c68c3,_0xac0a('0xf'),JSON[_0xac0a('0x12')](_0x441029));if(_0x441029['error']){if(_0x441029[_0xac0a('0x13')][_0xac0a('0x14')]===0x1f4){logger[_0xac0a('0x13')](_0xac0a('0xe'),_0x1c68c3,_0x441029[_0xac0a('0x13')][_0xac0a('0x15')]);return _0x57853f(_0x441029[_0xac0a('0x13')][_0xac0a('0x15')]);}logger[_0xac0a('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1c68c3,_0x441029[_0xac0a('0x13')][_0xac0a('0x15')]);return _0x5dfed9(_0x441029[_0xac0a('0x13')][_0xac0a('0x15')]);}else{logger[_0xac0a('0xd')](_0xac0a('0xe'),_0x1c68c3,_0xac0a('0xf'));_0x5dfed9(_0x441029[_0xac0a('0x16')][_0xac0a('0x15')]);}})['catch'](function(_0x4a59cc){logger[_0xac0a('0x13')](_0xac0a('0xe'),_0x1c68c3,_0x4a59cc);_0x57853f(_0x4a59cc);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 6a9d7fa..3e45292 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 _0x49c9=['connect-timeout','Router','fs-extra','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x52ed9e,_0x523599){var _0x35dc96=function(_0x2beeb7){while(--_0x2beeb7){_0x52ed9e['push'](_0x52ed9e['shift']());}};_0x35dc96(++_0x523599);}(_0x49c9,0x140));var _0x949c=function(_0x4a63ce,_0x1827e7){_0x4a63ce=_0x4a63ce-0x0;var _0x28aea9=_0x49c9[_0x4a63ce];return _0x28aea9;};'use strict';var multer=require(_0x949c('0x0'));var util=require(_0x949c('0x1'));var path=require(_0x949c('0x2'));var timeout=require(_0x949c('0x3'));var express=require('express');var router=express[_0x949c('0x4')]();var fs_extra=require(_0x949c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x949c('0x6'));var config=require('../../config/environment');var controller=require(_0x949c('0x7'));router['get']('/',auth[_0x949c('0x8')](),controller[_0x949c('0x9')]);router[_0x949c('0xa')](_0x949c('0xb'),auth['isAuthenticated'](),controller[_0x949c('0xc')]);router[_0x949c('0xd')]('/',auth[_0x949c('0x8')](),controller[_0x949c('0xe')]);router[_0x949c('0xf')](_0x949c('0xb'),auth[_0x949c('0x8')](),controller['update']);router[_0x949c('0x10')]('/:id',auth[_0x949c('0x8')](),controller[_0x949c('0x11')]);module[_0x949c('0x12')]=router; \ No newline at end of file +var _0x07ff=['./intServicenowField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','multer','express','Router','fs-extra','../../components/interaction/service'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x07ff,0x190));var _0xf07f=function(_0x5023ae,_0x2c8f4a){_0x5023ae=_0x5023ae-0x0;var _0x1179b4=_0x07ff[_0x5023ae];return _0x1179b4;};'use strict';var multer=require(_0xf07f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf07f('0x1'));var router=express[_0xf07f('0x2')]();var fs_extra=require(_0xf07f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf07f('0x4'));var config=require('../../config/environment');var controller=require(_0xf07f('0x5'));router['get']('/',auth[_0xf07f('0x6')](),controller[_0xf07f('0x7')]);router[_0xf07f('0x8')](_0xf07f('0x9'),auth[_0xf07f('0x6')](),controller[_0xf07f('0xa')]);router['post']('/',auth[_0xf07f('0x6')](),controller[_0xf07f('0xb')]);router[_0xf07f('0xc')](_0xf07f('0x9'),auth[_0xf07f('0x6')](),controller[_0xf07f('0xd')]);router[_0xf07f('0xe')]('/:id',auth[_0xf07f('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 355d225..c19ff49 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 _0x3184=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0xc8929b,_0x557d0d){var _0x375bb9=function(_0x2017dc){while(--_0x2017dc){_0xc8929b['push'](_0xc8929b['shift']());}};_0x375bb9(++_0x557d0d);}(_0x3184,0x1a2));var _0x4318=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x3184[_0x386525];return _0x14d015;};'use strict';var Sequelize=require(_0x4318('0x0'));module[_0x4318('0x1')]={'type':{'type':Sequelize[_0x4318('0x2')](_0x4318('0x3'),_0x4318('0x4'),_0x4318('0x5'),_0x4318('0x6'),'picklist'),'defaultValue':_0x4318('0x3')},'content':{'type':Sequelize[_0x4318('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4318('0x2')](_0x4318('0x3'),_0x4318('0x4'),_0x4318('0x5'))},'keyContent':{'type':Sequelize[_0x4318('0x7')]},'idField':{'type':Sequelize[_0x4318('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4318('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac55=['keyValue','STRING','string','variable','customVariable'];(function(_0x392a44,_0x359a4b){var _0x78dce3=function(_0x16f9ed){while(--_0x16f9ed){_0x392a44['push'](_0x392a44['shift']());}};_0x78dce3(++_0x359a4b);}(_0xac55,0xed));var _0x5ac5=function(_0x351f79,_0x3aa234){_0x351f79=_0x351f79-0x0;var _0x528d1a=_0xac55[_0x351f79];return _0x528d1a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x5ac5('0x0'),_0x5ac5('0x1'),_0x5ac5('0x2'),_0x5ac5('0x3'),'picklist'),'defaultValue':_0x5ac5('0x0')},'content':{'type':Sequelize[_0x5ac5('0x4')]},'key':{'type':Sequelize[_0x5ac5('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x5ac5('0x0'),_0x5ac5('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x5ac5('0x4')]},'idField':{'type':Sequelize[_0x5ac5('0x4')]},'nameField':{'type':Sequelize[_0x5ac5('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ac5('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index be634bc..76cdbe6 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 _0xb50d=['status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','merge','options','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x201c59,_0x24cbfd){var _0x4c8169=function(_0xcf49ac){while(--_0xcf49ac){_0x201c59['push'](_0x201c59['shift']());}};_0x4c8169(++_0x24cbfd);}(_0xb50d,0x81));var _0xdb50=function(_0x58b925,_0x4296d6){_0x58b925=_0x58b925-0x0;var _0x2e4b16=_0xb50d[_0x58b925];return _0x2e4b16;};'use strict';var emlformat=require(_0xdb50('0x0'));var rimraf=require(_0xdb50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb50('0x2'));var rp=require(_0xdb50('0x3'));var moment=require('moment');var BPromise=require(_0xdb50('0x4'));var Mustache=require(_0xdb50('0x5'));var util=require(_0xdb50('0x6'));var path=require(_0xdb50('0x7'));var sox=require(_0xdb50('0x8'));var csv=require('to-csv');var ejs=require(_0xdb50('0x9'));var fs=require('fs');var fs_extra=require(_0xdb50('0xa'));var _=require(_0xdb50('0xb'));var squel=require(_0xdb50('0xc'));var crypto=require(_0xdb50('0xd'));var jsforce=require(_0xdb50('0xe'));var deskjs=require(_0xdb50('0xf'));var toCsv=require(_0xdb50('0x10'));var querystring=require('querystring');var Papa=require(_0xdb50('0x11'));var Redis=require(_0xdb50('0x12'));var authService=require(_0xdb50('0x13'));var qs=require(_0xdb50('0x14'));var as=require(_0xdb50('0x15'));var hardwareService=require(_0xdb50('0x16'));var logger=require(_0xdb50('0x17'))(_0xdb50('0x18'));var utils=require(_0xdb50('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xdb50('0x1a'));var db=require(_0xdb50('0x1b'))['db'];function respondWithStatusCode(_0x356a55,_0x51fa51){_0x51fa51=_0x51fa51||0xcc;return function(_0x15d97f){if(_0x15d97f){return _0x356a55[_0xdb50('0x1c')](_0x51fa51);}return _0x356a55[_0xdb50('0x1d')](_0x51fa51)[_0xdb50('0x1e')]();};}function respondWithResult(_0x145c0d,_0x5d9939){_0x5d9939=_0x5d9939||0xc8;return function(_0x39ece3){if(_0x39ece3){return _0x145c0d[_0xdb50('0x1d')](_0x5d9939)[_0xdb50('0x1f')](_0x39ece3);}};}function respondWithFilteredResult(_0x56d590,_0x4d4e3a){return function(_0x3b01eb){if(_0x3b01eb){var _0x409cf4=typeof _0x4d4e3a['offset']===_0xdb50('0x20')&&typeof _0x4d4e3a[_0xdb50('0x21')]==='undefined';var _0x297516=_0x3b01eb['count'];var _0x4aefa9=_0x409cf4?0x0:_0x4d4e3a['offset'];var _0x3eaa93=_0x409cf4?_0x3b01eb[_0xdb50('0x22')]:_0x4d4e3a['offset']+_0x4d4e3a[_0xdb50('0x21')];var _0x4e9cd2;if(_0x3eaa93>=_0x297516){_0x3eaa93=_0x297516;_0x4e9cd2=0xc8;}else{_0x4e9cd2=0xce;}_0x56d590[_0xdb50('0x1d')](_0x4e9cd2);return _0x56d590[_0xdb50('0x23')](_0xdb50('0x24'),_0x4aefa9+'-'+_0x3eaa93+'/'+_0x297516)[_0xdb50('0x1f')](_0x3b01eb);}return null;};}function patchUpdates(_0x38ed70){return function(_0x58143c){try{jsonpatch[_0xdb50('0x25')](_0x58143c,_0x38ed70,!![]);}catch(_0x47b21d){return BPromise[_0xdb50('0x26')](_0x47b21d);}return _0x58143c['save']();};}function saveUpdates(_0xc091b9,_0x54c1fd){return function(_0x295f7c){if(_0x295f7c){return _0x295f7c[_0xdb50('0x27')](_0xc091b9)[_0xdb50('0x28')](function(_0x23d8e4){return _0x23d8e4;});}return null;};}function removeEntity(_0x226bc0,_0x46a3b8){return function(_0x103e68){if(_0x103e68){return _0x103e68[_0xdb50('0x29')]()[_0xdb50('0x28')](function(){_0x226bc0[_0xdb50('0x1d')](0xcc)[_0xdb50('0x1e')]();});}};}function handleEntityNotFound(_0x19e47f,_0x533e65){return function(_0x4376a8){if(!_0x4376a8){_0x19e47f[_0xdb50('0x1c')](0x194);}return _0x4376a8;};}function handleError(_0x4e5541,_0x150797){_0x150797=_0x150797||0x1f4;return function(_0x3813a8){logger[_0xdb50('0x2a')](_0x3813a8[_0xdb50('0x2b')]);if(_0x3813a8[_0xdb50('0x2c')]){delete _0x3813a8['name'];}_0x4e5541[_0xdb50('0x1d')](_0x150797)[_0xdb50('0x2d')](_0x3813a8);};}exports[_0xdb50('0x2e')]=function(_0x538959,_0x4ac4d0){var _0x230208={},_0x43b3f2={},_0x21cca1={'count':0x0,'rows':[]};var _0xe1ebbb=_['map'](db[_0xdb50('0x2f')][_0xdb50('0x30')],function(_0x23a437){return{'name':_0x23a437[_0xdb50('0x31')],'type':_0x23a437[_0xdb50('0x32')][_0xdb50('0x33')]};});_0x43b3f2[_0xdb50('0x34')]=_[_0xdb50('0x35')](_0xe1ebbb,_0xdb50('0x2c'));_0x43b3f2['query']=_[_0xdb50('0x36')](_0x538959[_0xdb50('0x37')]);_0x43b3f2['filters']=_[_0xdb50('0x38')](_0x43b3f2[_0xdb50('0x34')],_0x43b3f2[_0xdb50('0x37')]);_0x230208[_0xdb50('0x39')]=_[_0xdb50('0x38')](_0x43b3f2[_0xdb50('0x34')],qs[_0xdb50('0x3a')](_0x538959[_0xdb50('0x37')][_0xdb50('0x3a')]));_0x230208[_0xdb50('0x39')]=_0x230208['attributes'][_0xdb50('0x3b')]?_0x230208[_0xdb50('0x39')]:_0x43b3f2['model'];if(!_0x538959[_0xdb50('0x37')][_0xdb50('0x3c')](_0xdb50('0x3d'))){_0x230208['limit']=qs[_0xdb50('0x21')](_0x538959['query']['limit']);_0x230208[_0xdb50('0x3e')]=qs[_0xdb50('0x3e')](_0x538959[_0xdb50('0x37')][_0xdb50('0x3e')]);}_0x230208[_0xdb50('0x3f')]=qs[_0xdb50('0x40')](_0x538959['query'][_0xdb50('0x40')]);_0x230208[_0xdb50('0x41')]=qs['filters'](_[_0xdb50('0x42')](_0x538959[_0xdb50('0x37')],_0x43b3f2[_0xdb50('0x43')]),_0xe1ebbb);if(_0x538959[_0xdb50('0x37')][_0xdb50('0x44')]){_0x230208[_0xdb50('0x41')]=_[_0xdb50('0x45')](_0x230208[_0xdb50('0x41')],{'$or':_[_0xdb50('0x35')](_0xe1ebbb,function(_0x37cc7e){if(_0x37cc7e[_0xdb50('0x32')]!=='VIRTUAL'){var _0x281931={};_0x281931[_0x37cc7e[_0xdb50('0x2c')]]={'$like':'%'+_0x538959[_0xdb50('0x37')]['filter']+'%'};return _0x281931;}})});}_0x230208=_[_0xdb50('0x45')]({},_0x230208,_0x538959[_0xdb50('0x46')]);var _0x1a0fc3={'where':_0x230208[_0xdb50('0x41')]};return db[_0xdb50('0x2f')][_0xdb50('0x22')](_0x1a0fc3)[_0xdb50('0x28')](function(_0x5867dc){_0x21cca1[_0xdb50('0x22')]=_0x5867dc;if(_0x538959[_0xdb50('0x37')]['includeAll']){_0x230208['include']=[{'all':!![]}];}return db['ServicenowField'][_0xdb50('0x47')](_0x230208);})[_0xdb50('0x28')](function(_0x5b7842){_0x21cca1[_0xdb50('0x48')]=_0x5b7842;return _0x21cca1;})[_0xdb50('0x28')](respondWithFilteredResult(_0x4ac4d0,_0x230208))[_0xdb50('0x49')](handleError(_0x4ac4d0,null));};exports['show']=function(_0x34f7a4,_0x1df8ca){var _0x34280c={'raw':!![],'where':{'id':_0x34f7a4[_0xdb50('0x4a')]['id']}},_0x545a1c={};_0x545a1c[_0xdb50('0x34')]=_[_0xdb50('0x36')](db[_0xdb50('0x2f')][_0xdb50('0x30')]);_0x545a1c[_0xdb50('0x37')]=_[_0xdb50('0x36')](_0x34f7a4[_0xdb50('0x37')]);_0x545a1c[_0xdb50('0x43')]=_[_0xdb50('0x38')](_0x545a1c[_0xdb50('0x34')],_0x545a1c['query']);_0x34280c['attributes']=_[_0xdb50('0x38')](_0x545a1c[_0xdb50('0x34')],qs[_0xdb50('0x3a')](_0x34f7a4[_0xdb50('0x37')][_0xdb50('0x3a')]));_0x34280c[_0xdb50('0x39')]=_0x34280c['attributes'][_0xdb50('0x3b')]?_0x34280c[_0xdb50('0x39')]:_0x545a1c[_0xdb50('0x34')];if(_0x34f7a4[_0xdb50('0x37')][_0xdb50('0x4b')]){_0x34280c['include']=[{'all':!![]}];}_0x34280c=_[_0xdb50('0x45')]({},_0x34280c,_0x34f7a4['options']);return db[_0xdb50('0x2f')][_0xdb50('0x4c')](_0x34280c)['then'](handleEntityNotFound(_0x1df8ca,null))[_0xdb50('0x28')](respondWithResult(_0x1df8ca,null))['catch'](handleError(_0x1df8ca,null));};exports[_0xdb50('0x4d')]=function(_0x3bcd6e,_0x2c0dc9){return db[_0xdb50('0x2f')][_0xdb50('0x4d')](_0x3bcd6e[_0xdb50('0x4e')],{})[_0xdb50('0x28')](respondWithResult(_0x2c0dc9,0xc9))[_0xdb50('0x49')](handleError(_0x2c0dc9,null));};exports[_0xdb50('0x27')]=function(_0x5066d5,_0x1c7ac7){if(_0x5066d5[_0xdb50('0x4e')]['id']){delete _0x5066d5[_0xdb50('0x4e')]['id'];}return db[_0xdb50('0x2f')]['find']({'where':{'id':_0x5066d5[_0xdb50('0x4a')]['id']}})[_0xdb50('0x28')](handleEntityNotFound(_0x1c7ac7,null))[_0xdb50('0x28')](saveUpdates(_0x5066d5['body'],null))['then'](respondWithResult(_0x1c7ac7,null))[_0xdb50('0x49')](handleError(_0x1c7ac7,null));};exports[_0xdb50('0x29')]=function(_0x5deb62,_0x307212){return db[_0xdb50('0x2f')][_0xdb50('0x4c')]({'where':{'id':_0x5deb62['params']['id']}})[_0xdb50('0x28')](handleEntityNotFound(_0x307212,null))[_0xdb50('0x28')](removeEntity(_0x307212,null))[_0xdb50('0x49')](handleError(_0x307212,null));}; \ No newline at end of file +var _0x269b=['send','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','count','set','json','apply','save','update','destroy','then','sendStatus','stack','name'];(function(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0x269b,0x1d6));var _0xb269=function(_0x40a0a4,_0x5d30d0){_0x40a0a4=_0x40a0a4-0x0;var _0x50cc17=_0x269b[_0x40a0a4];return _0x50cc17;};'use strict';var emlformat=require(_0xb269('0x0'));var rimraf=require(_0xb269('0x1'));var zipdir=require(_0xb269('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb269('0x3'));var moment=require(_0xb269('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb269('0x5'));var util=require(_0xb269('0x6'));var path=require('path');var sox=require(_0xb269('0x7'));var csv=require(_0xb269('0x8'));var ejs=require(_0xb269('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb269('0xa'));var squel=require(_0xb269('0xb'));var crypto=require('crypto');var jsforce=require(_0xb269('0xc'));var deskjs=require(_0xb269('0xd'));var toCsv=require(_0xb269('0x8'));var querystring=require(_0xb269('0xe'));var Papa=require(_0xb269('0xf'));var Redis=require(_0xb269('0x10'));var authService=require(_0xb269('0x11'));var qs=require(_0xb269('0x12'));var as=require(_0xb269('0x13'));var hardwareService=require(_0xb269('0x14'));var logger=require(_0xb269('0x15'))(_0xb269('0x16'));var utils=require(_0xb269('0x17'));var config=require(_0xb269('0x18'));var licenseUtil=require(_0xb269('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45bc71,_0x3291ba){_0x3291ba=_0x3291ba||0xcc;return function(_0x351b89){if(_0x351b89){return _0x45bc71['sendStatus'](_0x3291ba);}return _0x45bc71[_0xb269('0x1a')](_0x3291ba)[_0xb269('0x1b')]();};}function respondWithResult(_0x4a1ad4,_0x471ea3){_0x471ea3=_0x471ea3||0xc8;return function(_0x3c0185){if(_0x3c0185){return _0x4a1ad4[_0xb269('0x1a')](_0x471ea3)['json'](_0x3c0185);}};}function respondWithFilteredResult(_0x23fc29,_0x3c4cc2){return function(_0x153460){if(_0x153460){var _0x295ea2=typeof _0x3c4cc2[_0xb269('0x1c')]==='undefined'&&typeof _0x3c4cc2[_0xb269('0x1d')]==='undefined';var _0x551696=_0x153460['count'];var _0xd8e8=_0x295ea2?0x0:_0x3c4cc2[_0xb269('0x1c')];var _0x180536=_0x295ea2?_0x153460[_0xb269('0x1e')]:_0x3c4cc2[_0xb269('0x1c')]+_0x3c4cc2[_0xb269('0x1d')];var _0x405d32;if(_0x180536>=_0x551696){_0x180536=_0x551696;_0x405d32=0xc8;}else{_0x405d32=0xce;}_0x23fc29[_0xb269('0x1a')](_0x405d32);return _0x23fc29[_0xb269('0x1f')]('Content-Range',_0xd8e8+'-'+_0x180536+'/'+_0x551696)[_0xb269('0x20')](_0x153460);}return null;};}function patchUpdates(_0x4f9951){return function(_0x4caea6){try{jsonpatch[_0xb269('0x21')](_0x4caea6,_0x4f9951,!![]);}catch(_0x3ba32b){return BPromise['reject'](_0x3ba32b);}return _0x4caea6[_0xb269('0x22')]();};}function saveUpdates(_0x9ee86a,_0x253ac7){return function(_0x29451a){if(_0x29451a){return _0x29451a[_0xb269('0x23')](_0x9ee86a)['then'](function(_0x36c29d){return _0x36c29d;});}return null;};}function removeEntity(_0x2ef80d,_0x177197){return function(_0x2bcfa9){if(_0x2bcfa9){return _0x2bcfa9[_0xb269('0x24')]()[_0xb269('0x25')](function(){_0x2ef80d[_0xb269('0x1a')](0xcc)[_0xb269('0x1b')]();});}};}function handleEntityNotFound(_0x54df85,_0x2ceaa5){return function(_0x5a73cb){if(!_0x5a73cb){_0x54df85[_0xb269('0x26')](0x194);}return _0x5a73cb;};}function handleError(_0x4d9b5d,_0x10943f){_0x10943f=_0x10943f||0x1f4;return function(_0x26fdd9){logger['error'](_0x26fdd9[_0xb269('0x27')]);if(_0x26fdd9[_0xb269('0x28')]){delete _0x26fdd9['name'];}_0x4d9b5d[_0xb269('0x1a')](_0x10943f)[_0xb269('0x29')](_0x26fdd9);};}exports['index']=function(_0x57eca6,_0x21a97c){var _0x45ddd6={},_0x1ed9ec={},_0x204274={'count':0x0,'rows':[]};var _0x2fbcb6=_[_0xb269('0x2a')](db[_0xb269('0x2b')][_0xb269('0x2c')],function(_0x5b91c4){return{'name':_0x5b91c4[_0xb269('0x2d')],'type':_0x5b91c4[_0xb269('0x2e')]['key']};});_0x1ed9ec[_0xb269('0x2f')]=_[_0xb269('0x2a')](_0x2fbcb6,_0xb269('0x28'));_0x1ed9ec[_0xb269('0x30')]=_[_0xb269('0x31')](_0x57eca6[_0xb269('0x30')]);_0x1ed9ec['filters']=_[_0xb269('0x32')](_0x1ed9ec[_0xb269('0x2f')],_0x1ed9ec[_0xb269('0x30')]);_0x45ddd6['attributes']=_['intersection'](_0x1ed9ec['model'],qs[_0xb269('0x33')](_0x57eca6['query'][_0xb269('0x33')]));_0x45ddd6['attributes']=_0x45ddd6[_0xb269('0x34')]['length']?_0x45ddd6['attributes']:_0x1ed9ec[_0xb269('0x2f')];if(!_0x57eca6['query'][_0xb269('0x35')](_0xb269('0x36'))){_0x45ddd6[_0xb269('0x1d')]=qs[_0xb269('0x1d')](_0x57eca6[_0xb269('0x30')]['limit']);_0x45ddd6[_0xb269('0x1c')]=qs[_0xb269('0x1c')](_0x57eca6['query'][_0xb269('0x1c')]);}_0x45ddd6[_0xb269('0x37')]=qs[_0xb269('0x38')](_0x57eca6['query'][_0xb269('0x38')]);_0x45ddd6[_0xb269('0x39')]=qs[_0xb269('0x3a')](_[_0xb269('0x3b')](_0x57eca6[_0xb269('0x30')],_0x1ed9ec['filters']),_0x2fbcb6);if(_0x57eca6['query']['filter']){_0x45ddd6[_0xb269('0x39')]=_[_0xb269('0x3c')](_0x45ddd6[_0xb269('0x39')],{'$or':_['map'](_0x2fbcb6,function(_0x590799){if(_0x590799[_0xb269('0x2e')]!=='VIRTUAL'){var _0x119c18={};_0x119c18[_0x590799[_0xb269('0x28')]]={'$like':'%'+_0x57eca6['query'][_0xb269('0x3d')]+'%'};return _0x119c18;}})});}_0x45ddd6=_['merge']({},_0x45ddd6,_0x57eca6[_0xb269('0x3e')]);var _0x1c509e={'where':_0x45ddd6[_0xb269('0x39')]};return db[_0xb269('0x2b')][_0xb269('0x1e')](_0x1c509e)[_0xb269('0x25')](function(_0x1671fa){_0x204274[_0xb269('0x1e')]=_0x1671fa;if(_0x57eca6['query'][_0xb269('0x3f')]){_0x45ddd6['include']=[{'all':!![]}];}return db[_0xb269('0x2b')][_0xb269('0x40')](_0x45ddd6);})[_0xb269('0x25')](function(_0x17f983){_0x204274[_0xb269('0x41')]=_0x17f983;return _0x204274;})[_0xb269('0x25')](respondWithFilteredResult(_0x21a97c,_0x45ddd6))[_0xb269('0x42')](handleError(_0x21a97c,null));};exports[_0xb269('0x43')]=function(_0x4f49b3,_0x91a17f){var _0x1cda18={'raw':!![],'where':{'id':_0x4f49b3[_0xb269('0x44')]['id']}},_0x5cf48e={};_0x5cf48e[_0xb269('0x2f')]=_['keys'](db['ServicenowField'][_0xb269('0x2c')]);_0x5cf48e['query']=_[_0xb269('0x31')](_0x4f49b3[_0xb269('0x30')]);_0x5cf48e[_0xb269('0x3a')]=_[_0xb269('0x32')](_0x5cf48e[_0xb269('0x2f')],_0x5cf48e['query']);_0x1cda18[_0xb269('0x34')]=_[_0xb269('0x32')](_0x5cf48e[_0xb269('0x2f')],qs[_0xb269('0x33')](_0x4f49b3[_0xb269('0x30')][_0xb269('0x33')]));_0x1cda18[_0xb269('0x34')]=_0x1cda18['attributes'][_0xb269('0x45')]?_0x1cda18[_0xb269('0x34')]:_0x5cf48e[_0xb269('0x2f')];if(_0x4f49b3[_0xb269('0x30')]['includeAll']){_0x1cda18[_0xb269('0x46')]=[{'all':!![]}];}_0x1cda18=_[_0xb269('0x3c')]({},_0x1cda18,_0x4f49b3[_0xb269('0x3e')]);return db[_0xb269('0x2b')][_0xb269('0x47')](_0x1cda18)[_0xb269('0x25')](handleEntityNotFound(_0x91a17f,null))[_0xb269('0x25')](respondWithResult(_0x91a17f,null))[_0xb269('0x42')](handleError(_0x91a17f,null));};exports['create']=function(_0x1dd292,_0x4db188){return db['ServicenowField'][_0xb269('0x48')](_0x1dd292['body'],{})[_0xb269('0x25')](respondWithResult(_0x4db188,0xc9))[_0xb269('0x42')](handleError(_0x4db188,null));};exports[_0xb269('0x23')]=function(_0x5abb03,_0x2bca36){if(_0x5abb03['body']['id']){delete _0x5abb03['body']['id'];}return db[_0xb269('0x2b')][_0xb269('0x47')]({'where':{'id':_0x5abb03['params']['id']}})[_0xb269('0x25')](handleEntityNotFound(_0x2bca36,null))[_0xb269('0x25')](saveUpdates(_0x5abb03['body'],null))[_0xb269('0x25')](respondWithResult(_0x2bca36,null))[_0xb269('0x42')](handleError(_0x2bca36,null));};exports[_0xb269('0x24')]=function(_0x4ec7dc,_0x459d2c){return db['ServicenowField'][_0xb269('0x47')]({'where':{'id':_0x4ec7dc[_0xb269('0x44')]['id']}})[_0xb269('0x25')](handleEntityNotFound(_0x459d2c,null))['then'](removeEntity(_0x459d2c,null))[_0xb269('0x42')](handleError(_0x459d2c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 8265da6..1e7c397 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 _0xfa97=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','define','servicenow_unique_index','idField','lodash','util','../../config/logger'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xfa97,0x65));var _0x7fa9=function(_0x4b6984,_0x5dd1c0){_0x4b6984=_0x4b6984-0x0;var _0x377e05=_0xfa97[_0x4b6984];return _0x377e05;};'use strict';var _=require(_0x7fa9('0x0'));var util=require(_0x7fa9('0x1'));var logger=require(_0x7fa9('0x2'))(_0x7fa9('0x3'));var moment=require(_0x7fa9('0x4'));var BPromise=require(_0x7fa9('0x5'));var rp=require(_0x7fa9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fa9('0x7'));var config=require(_0x7fa9('0x8'));var attributes=require(_0x7fa9('0x9'));module['exports']=function(_0x190e7f,_0x252aed){return _0x190e7f[_0x7fa9('0xa')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x7fa9('0xb'),'fields':[_0x7fa9('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd635=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x4729fe,_0x2b16ac){var _0x4bcbad=function(_0x27e2d9){while(--_0x27e2d9){_0x4729fe['push'](_0x4729fe['shift']());}};_0x4bcbad(++_0x2b16ac);}(_0xd635,0xe6));var _0x5d63=function(_0x375ac9,_0x262210){_0x375ac9=_0x375ac9-0x0;var _0x421ea2=_0xd635[_0x375ac9];return _0x421ea2;};'use strict';var _=require(_0x5d63('0x0'));var util=require(_0x5d63('0x1'));var logger=require('../../config/logger')(_0x5d63('0x2'));var moment=require(_0x5d63('0x3'));var BPromise=require(_0x5d63('0x4'));var rp=require(_0x5d63('0x5'));var fs=require('fs');var path=require(_0x5d63('0x6'));var rimraf=require(_0x5d63('0x7'));var config=require(_0x5d63('0x8'));var attributes=require(_0x5d63('0x9'));module[_0x5d63('0xa')]=function(_0x5357c6,_0x66f0){return _0x5357c6[_0x5d63('0xb')](_0x5d63('0xc'),attributes,{'tableName':_0x5d63('0xd'),'paranoid':![],'indexes':[{'name':_0x5d63('0xe'),'fields':['idField',_0x5d63('0xf')],'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 6fc1df1..47fe990 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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x19811d,_0x243372){var _0x400fd5=function(_0xb398f7){while(--_0xb398f7){_0x19811d['push'](_0x19811d['shift']());}};_0x400fd5(++_0x243372);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xda3f,0xec));var _0xfda3=function(_0x41d53e,_0x10b0e9){_0x41d53e=_0x41d53e-0x0;var _0x543178=_0xda3f[_0x41d53e];return _0x543178;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 804e030..1047073 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(_0x4f0de9,_0x3d4956){var _0x3cad81=function(_0x548b6d){while(--_0x548b6d){_0x4f0de9['push'](_0x4f0de9['shift']());}};_0x3cad81(++_0x3d4956);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x3ea4b1,_0x1c59b4){var _0x4fec31=function(_0x55fc7c){while(--_0x55fc7c){_0x3ea4b1['push'](_0x3ea4b1['shift']());}};_0x4fec31(++_0x1c59b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 bcd1bc0..478cf38 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(_0x109935,_0x324a52){var _0x5d04ae=function(_0x236cca){while(--_0x236cca){_0x109935['push'](_0x109935['shift']());}};_0x5d04ae(++_0x324a52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x5f1ea0,_0x374e46){var _0x368a09=function(_0x5b763f){while(--_0x5b763f){_0x5f1ea0['push'](_0x5f1ea0['shift']());}};_0x368a09(++_0x374e46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 2b84687..36dda58 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 _0xb452=['status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','SugarcrmConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','description','date_start','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','login','JSON','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','module_fields','remove','endsWith','values','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x361a1c,_0x45d736){var _0x2e57ac=function(_0x3abe43){while(--_0x3abe43){_0x361a1c['push'](_0x361a1c['shift']());}};_0x2e57ac(++_0x45d736);}(_0xb452,0xc9));var _0x2b45=function(_0x3cd025,_0x1e2adf){_0x3cd025=_0x3cd025-0x0;var _0xaa86eb=_0xb452[_0x3cd025];return _0xaa86eb;};'use strict';var emlformat=require(_0x2b45('0x0'));var rimraf=require(_0x2b45('0x1'));var zipdir=require(_0x2b45('0x2'));var jsonpatch=require(_0x2b45('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2b45('0x4'));var Mustache=require('mustache');var util=require(_0x2b45('0x5'));var path=require(_0x2b45('0x6'));var sox=require(_0x2b45('0x7'));var csv=require(_0x2b45('0x8'));var ejs=require(_0x2b45('0x9'));var fs=require('fs');var fs_extra=require(_0x2b45('0xa'));var _=require(_0x2b45('0xb'));var squel=require(_0x2b45('0xc'));var crypto=require(_0x2b45('0xd'));var jsforce=require(_0x2b45('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2b45('0x8'));var querystring=require(_0x2b45('0xf'));var Papa=require('papaparse');var Redis=require(_0x2b45('0x10'));var authService=require(_0x2b45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b45('0x12'));var hardwareService=require(_0x2b45('0x13'));var logger=require('../../config/logger')(_0x2b45('0x14'));var utils=require(_0x2b45('0x15'));var config=require(_0x2b45('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2fb161,_0x1fd2e7){_0x1fd2e7=_0x1fd2e7||0xcc;return function(_0x3f3ec2){if(_0x3f3ec2){return _0x2fb161['sendStatus'](_0x1fd2e7);}return _0x2fb161[_0x2b45('0x17')](_0x1fd2e7)['end']();};}function respondWithResult(_0x2a6333,_0xe7f40){_0xe7f40=_0xe7f40||0xc8;return function(_0x383d2e){if(_0x383d2e){return _0x2a6333[_0x2b45('0x17')](_0xe7f40)[_0x2b45('0x18')](_0x383d2e);}};}function respondWithFilteredResult(_0x361207,_0x3a6c4e){return function(_0x342730){if(_0x342730){var _0xaaf60c=typeof _0x3a6c4e[_0x2b45('0x19')]===_0x2b45('0x1a')&&typeof _0x3a6c4e[_0x2b45('0x1b')]===_0x2b45('0x1a');var _0x4a3457=_0x342730[_0x2b45('0x1c')];var _0x1917f2=_0xaaf60c?0x0:_0x3a6c4e[_0x2b45('0x19')];var _0x9ce08d=_0xaaf60c?_0x342730['count']:_0x3a6c4e['offset']+_0x3a6c4e['limit'];var _0x5a92e7;if(_0x9ce08d>=_0x4a3457){_0x9ce08d=_0x4a3457;_0x5a92e7=0xc8;}else{_0x5a92e7=0xce;}_0x361207['status'](_0x5a92e7);return _0x361207['set'](_0x2b45('0x1d'),_0x1917f2+'-'+_0x9ce08d+'/'+_0x4a3457)['json'](_0x342730);}return null;};}function patchUpdates(_0x29996c){return function(_0x44fc48){try{jsonpatch[_0x2b45('0x1e')](_0x44fc48,_0x29996c,!![]);}catch(_0x3dc3e7){return BPromise['reject'](_0x3dc3e7);}return _0x44fc48['save']();};}function saveUpdates(_0x3f30e2,_0x40d1db){return function(_0x65b6ab){if(_0x65b6ab){return _0x65b6ab[_0x2b45('0x1f')](_0x3f30e2)[_0x2b45('0x20')](function(_0x20d2f0){return _0x20d2f0;});}return null;};}function removeEntity(_0x582f6a,_0x2f95c8){return function(_0x21e69a){if(_0x21e69a){return _0x21e69a[_0x2b45('0x21')]()[_0x2b45('0x20')](function(){_0x582f6a[_0x2b45('0x17')](0xcc)[_0x2b45('0x22')]();});}};}function handleEntityNotFound(_0x3ffec3,_0x52a3e){return function(_0x4c0abe){if(!_0x4c0abe){_0x3ffec3['sendStatus'](0x194);}return _0x4c0abe;};}function handleError(_0x50cc1d,_0x242aed){_0x242aed=_0x242aed||0x1f4;return function(_0x306546){logger[_0x2b45('0x23')](_0x306546['stack']);if(_0x306546[_0x2b45('0x24')]){delete _0x306546['name'];}_0x50cc1d[_0x2b45('0x17')](_0x242aed)[_0x2b45('0x25')](_0x306546);};}exports[_0x2b45('0x26')]=function(_0x21ff39,_0x1d375e){var _0x3ae119={},_0x4b1ef2={},_0x5e44c7={'count':0x0,'rows':[]};var _0x328025=_[_0x2b45('0x27')](db[_0x2b45('0x28')][_0x2b45('0x29')],function(_0x5e7bc3){return{'name':_0x5e7bc3[_0x2b45('0x2a')],'type':_0x5e7bc3[_0x2b45('0x2b')][_0x2b45('0x2c')]};});_0x4b1ef2[_0x2b45('0x2d')]=_[_0x2b45('0x27')](_0x328025,_0x2b45('0x24'));_0x4b1ef2[_0x2b45('0x2e')]=_[_0x2b45('0x2f')](_0x21ff39[_0x2b45('0x2e')]);_0x4b1ef2[_0x2b45('0x30')]=_[_0x2b45('0x31')](_0x4b1ef2[_0x2b45('0x2d')],_0x4b1ef2[_0x2b45('0x2e')]);_0x3ae119[_0x2b45('0x32')]=_[_0x2b45('0x31')](_0x4b1ef2[_0x2b45('0x2d')],qs['fields'](_0x21ff39[_0x2b45('0x2e')][_0x2b45('0x33')]));_0x3ae119[_0x2b45('0x32')]=_0x3ae119[_0x2b45('0x32')][_0x2b45('0x34')]?_0x3ae119[_0x2b45('0x32')]:_0x4b1ef2[_0x2b45('0x2d')];if(!_0x21ff39[_0x2b45('0x2e')][_0x2b45('0x35')](_0x2b45('0x36'))){_0x3ae119[_0x2b45('0x1b')]=qs[_0x2b45('0x1b')](_0x21ff39[_0x2b45('0x2e')][_0x2b45('0x1b')]);_0x3ae119['offset']=qs[_0x2b45('0x19')](_0x21ff39[_0x2b45('0x2e')][_0x2b45('0x19')]);}_0x3ae119[_0x2b45('0x37')]=qs[_0x2b45('0x38')](_0x21ff39['query'][_0x2b45('0x38')]);_0x3ae119[_0x2b45('0x39')]=qs['filters'](_[_0x2b45('0x3a')](_0x21ff39[_0x2b45('0x2e')],_0x4b1ef2[_0x2b45('0x30')]),_0x328025);if(_0x21ff39[_0x2b45('0x2e')][_0x2b45('0x3b')]){_0x3ae119[_0x2b45('0x39')]=_['merge'](_0x3ae119['where'],{'$or':_[_0x2b45('0x27')](_0x328025,function(_0x56ce17){if(_0x56ce17[_0x2b45('0x2b')]!==_0x2b45('0x3c')){var _0x1716e8={};_0x1716e8[_0x56ce17[_0x2b45('0x24')]]={'$like':'%'+_0x21ff39[_0x2b45('0x2e')][_0x2b45('0x3b')]+'%'};return _0x1716e8;}})});}_0x3ae119=_[_0x2b45('0x3d')]({},_0x3ae119,_0x21ff39[_0x2b45('0x3e')]);var _0x1bd1f0={'where':_0x3ae119[_0x2b45('0x39')]};return db['SugarcrmAccount'][_0x2b45('0x1c')](_0x1bd1f0)[_0x2b45('0x20')](function(_0x3a2983){_0x5e44c7[_0x2b45('0x1c')]=_0x3a2983;if(_0x21ff39[_0x2b45('0x2e')][_0x2b45('0x3f')]){_0x3ae119[_0x2b45('0x40')]=[{'all':!![]}];}return db[_0x2b45('0x28')][_0x2b45('0x41')](_0x3ae119);})['then'](function(_0x421547){_0x5e44c7['rows']=_0x421547;return _0x5e44c7;})['then'](respondWithFilteredResult(_0x1d375e,_0x3ae119))[_0x2b45('0x42')](handleError(_0x1d375e,null));};exports[_0x2b45('0x43')]=function(_0x3bc161,_0x2ca857){var _0x43b56d={'raw':![],'where':{'id':_0x3bc161[_0x2b45('0x44')]['id']}},_0x2cf48a={};_0x2cf48a['model']=_['keys'](db['SugarcrmAccount'][_0x2b45('0x29')]);_0x2cf48a[_0x2b45('0x2e')]=_[_0x2b45('0x2f')](_0x3bc161[_0x2b45('0x2e')]);_0x2cf48a[_0x2b45('0x30')]=_[_0x2b45('0x31')](_0x2cf48a['model'],_0x2cf48a[_0x2b45('0x2e')]);_0x43b56d[_0x2b45('0x32')]=_[_0x2b45('0x31')](_0x2cf48a[_0x2b45('0x2d')],qs[_0x2b45('0x33')](_0x3bc161[_0x2b45('0x2e')][_0x2b45('0x33')]));_0x43b56d[_0x2b45('0x32')]=_0x43b56d[_0x2b45('0x32')]['length']?_0x43b56d[_0x2b45('0x32')]:_0x2cf48a[_0x2b45('0x2d')];if(_0x3bc161[_0x2b45('0x2e')]['includeAll']){_0x43b56d[_0x2b45('0x40')]=[{'all':!![]}];}_0x43b56d=_['merge']({},_0x43b56d,_0x3bc161[_0x2b45('0x3e')]);return db['SugarcrmAccount'][_0x2b45('0x45')](_0x43b56d)[_0x2b45('0x20')](handleEntityNotFound(_0x2ca857,null))[_0x2b45('0x20')](respondWithResult(_0x2ca857,null))[_0x2b45('0x42')](handleError(_0x2ca857,null));};exports[_0x2b45('0x46')]=function(_0x490f59,_0x3e0761){return db[_0x2b45('0x28')][_0x2b45('0x46')](_0x490f59['body'],{})[_0x2b45('0x20')](respondWithResult(_0x3e0761,0xc9))[_0x2b45('0x42')](handleError(_0x3e0761,null));};exports['update']=function(_0x4e5174,_0x2633b8){if(_0x4e5174[_0x2b45('0x47')]['id']){delete _0x4e5174[_0x2b45('0x47')]['id'];}return db[_0x2b45('0x28')]['find']({'where':{'id':_0x4e5174[_0x2b45('0x44')]['id']}})['then'](handleEntityNotFound(_0x2633b8,null))[_0x2b45('0x20')](saveUpdates(_0x4e5174['body'],null))[_0x2b45('0x20')](respondWithResult(_0x2633b8,null))[_0x2b45('0x42')](handleError(_0x2633b8,null));};exports[_0x2b45('0x21')]=function(_0x2faa5e,_0x217900){return db[_0x2b45('0x28')][_0x2b45('0x45')]({'where':{'id':_0x2faa5e['params']['id']}})[_0x2b45('0x20')](handleEntityNotFound(_0x217900,null))['then'](removeEntity(_0x217900,null))['catch'](handleError(_0x217900,null));};exports[_0x2b45('0x48')]=function(_0x451a7e,_0x95e5b,_0x19064e){var _0x13cd12={};var _0x3f7d04={};var _0x407dba;var _0x44c752;return db[_0x2b45('0x28')]['findOne']({'where':{'id':_0x451a7e[_0x2b45('0x44')]['id']}})[_0x2b45('0x20')](handleEntityNotFound(_0x95e5b,null))[_0x2b45('0x20')](function(_0x12d68b){if(_0x12d68b){_0x407dba=_0x12d68b;_0x3f7d04['model']=_['keys'](db[_0x2b45('0x49')][_0x2b45('0x29')]);_0x3f7d04[_0x2b45('0x2e')]=_[_0x2b45('0x2f')](_0x451a7e[_0x2b45('0x2e')]);_0x3f7d04[_0x2b45('0x30')]=_['intersection'](_0x3f7d04[_0x2b45('0x2d')],_0x3f7d04[_0x2b45('0x2e')]);_0x13cd12['attributes']=_[_0x2b45('0x31')](_0x3f7d04[_0x2b45('0x2d')],qs['fields'](_0x451a7e[_0x2b45('0x2e')]['fields']));_0x13cd12[_0x2b45('0x32')]=_0x13cd12['attributes'][_0x2b45('0x34')]?_0x13cd12['attributes']:_0x3f7d04['model'];_0x13cd12[_0x2b45('0x37')]=qs[_0x2b45('0x38')](_0x451a7e[_0x2b45('0x2e')][_0x2b45('0x38')]);_0x13cd12['where']=qs[_0x2b45('0x30')](_[_0x2b45('0x3a')](_0x451a7e['query'],_0x3f7d04[_0x2b45('0x30')]));if(_0x451a7e[_0x2b45('0x2e')][_0x2b45('0x3b')]){_0x13cd12['where']=_[_0x2b45('0x3d')](_0x13cd12[_0x2b45('0x39')],{'$or':_[_0x2b45('0x27')](_0x13cd12['attributes'],function(_0x267c81){var _0x34109e={};_0x34109e[_0x267c81]={'$like':'%'+_0x451a7e[_0x2b45('0x2e')][_0x2b45('0x3b')]+'%'};return _0x34109e;})});}_0x13cd12=_[_0x2b45('0x3d')]({},_0x13cd12,_0x451a7e[_0x2b45('0x3e')]);return _0x407dba[_0x2b45('0x48')](_0x13cd12);}})[_0x2b45('0x20')](function(_0x44a17d){if(_0x44a17d){_0x44c752=_0x44a17d['length'];if(!_0x451a7e[_0x2b45('0x2e')]['hasOwnProperty'](_0x2b45('0x36'))){_0x13cd12[_0x2b45('0x1b')]=qs[_0x2b45('0x1b')](_0x451a7e[_0x2b45('0x2e')][_0x2b45('0x1b')]);_0x13cd12[_0x2b45('0x19')]=qs[_0x2b45('0x19')](_0x451a7e[_0x2b45('0x2e')]['offset']);}return _0x407dba[_0x2b45('0x48')](_0x13cd12);}})[_0x2b45('0x20')](function(_0x178104){if(_0x178104){return _0x178104?{'count':_0x44c752,'rows':_0x178104}:null;}})[_0x2b45('0x20')](respondWithResult(_0x95e5b,null))[_0x2b45('0x42')](handleError(_0x95e5b,null));};exports[_0x2b45('0x4a')]=function(_0x1cb276,_0x14b6b8,_0x4fe4f9){if(_0x1cb276[_0x2b45('0x47')]['id']){delete _0x1cb276[_0x2b45('0x47')]['id'];}return db[_0x2b45('0x28')][_0x2b45('0x4b')]({'where':{'id':_0x1cb276[_0x2b45('0x44')]['id']}})[_0x2b45('0x20')](handleEntityNotFound(_0x14b6b8,null))[_0x2b45('0x20')](function(_0x2893b9){if(_0x2893b9){_0x1cb276['body'][_0x2b45('0x4c')]=_0x2893b9['id'];_0x1cb276['body'][_0x2b45('0x4d')]=integrations[_0x2b45('0x4e')](_0x1cb276[_0x2b45('0x47')][_0x2b45('0x4f')],_0x1cb276[_0x2b45('0x47')][_0x2b45('0x2b')]);_0x1cb276[_0x2b45('0x47')][_0x2b45('0x50')]=integrations[_0x2b45('0x51')](_0x1cb276['body']['channel'],_0x1cb276[_0x2b45('0x47')][_0x2b45('0x2b')]);return db[_0x2b45('0x49')][_0x2b45('0x46')](_0x1cb276[_0x2b45('0x47')],{'include':[{'model':db[_0x2b45('0x52')],'as':_0x2b45('0x4d')},{'model':db[_0x2b45('0x52')],'as':_0x2b45('0x50')}]});}return null;})[_0x2b45('0x20')](respondWithResult(_0x14b6b8,null))['catch'](handleError(_0x14b6b8,null));};exports[_0x2b45('0x53')]=function(_0x48db03,_0x190bf5,_0x36fda5){var _0x518f04='';var _0x3fad71=['id','name','assigned_user_id',_0x2b45('0x54'),_0x2b45('0x55'),_0x2b45('0x56'),'duration_hours','duration_minutes',_0x2b45('0x57'),_0x2b45('0x58'),_0x2b45('0x59'),_0x2b45('0x5a')];return db[_0x2b45('0x28')]['findOne']({'where':{'id':_0x48db03[_0x2b45('0x44')]['id']},'attributes':['id',_0x2b45('0x5b'),_0x2b45('0x5c'),_0x2b45('0x5d')]})[_0x2b45('0x20')](handleEntityNotFound(_0x190bf5,null))[_0x2b45('0x20')](function(_0x385022){if(_0x385022){_0x518f04=_0x385022[_0x2b45('0x5d')];var _0x54757c=_0x518f04['slice'](-0x1);if(_0x54757c==='/'){_0x518f04=_0x518f04[_0x2b45('0x5e')](0x0,_0x518f04[_0x2b45('0x5f')](_0x54757c));}return rp({'method':_0x2b45('0x60'),'uri':util[_0x2b45('0x61')](_0x2b45('0x62'),_0x518f04,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2b45('0x63'),'input_type':_0x2b45('0x64'),'response_type':_0x2b45('0x64'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x385022['username'],'password':_0x385022[_0x2b45('0x5c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x2b45('0x20')](function(_0x493e12){if(_0x493e12&&_0x493e12[_0x2b45('0x24')]!=='Invalid\x20Login'&&_0x493e12[_0x2b45('0x24')]!==_0x2b45('0x65')){return rp({'method':_0x2b45('0x60'),'uri':util[_0x2b45('0x61')](_0x2b45('0x62'),_0x518f04,_0x2b45('0x66')),'json':!![],'form':{'method':_0x2b45('0x67'),'input_type':_0x2b45('0x64'),'response_type':_0x2b45('0x64'),'rest_data':JSON['stringify']({'session':_0x493e12['id'],'module_name':'Calls'})}})[_0x2b45('0x20')](function(_0x25f39c){if(_0x25f39c){var _0x1a014c=_['values'](_0x25f39c[_0x2b45('0x68')]);_[_0x2b45('0x69')](_0x1a014c,function(_0x1a79ab){return _0x3fad71['includes'](_0x1a79ab[_0x2b45('0x24')]);});return{'count':_0x1a014c[_0x2b45('0x34')],'rows':_[_0x2b45('0x27')](_0x1a014c,function(_0x35117d){return{'id':_0x35117d[_0x2b45('0x24')],'name':_0x35117d['label'],'custom':_[_0x2b45('0x6a')](_0x35117d[_0x2b45('0x24')],'_c')?!![]:![],'options':_0x35117d[_0x2b45('0x3e')]?_[_0x2b45('0x27')](_[_0x2b45('0x6b')](_0x35117d['options']),function(_0x3b578f){return{'name':_0x3b578f['value'],'value':_0x3b578f['name']};}):[]};})};}})[_0x2b45('0x20')](respondWithResult(_0x190bf5,null))[_0x2b45('0x42')](function(_0x58f7b9){var _0x581044=_0x48db03[_0x2b45('0x2e')][_0x2b45('0x6c')]?0x1f4:_0x58f7b9[_0x2b45('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x2b45('0x53'),_0x581044,JSON[_0x2b45('0x6e')](_0x58f7b9));delete _0x58f7b9[_0x2b45('0x24')];if(_0x581044===0x191){_0x581044=0x190;}_0x190bf5[_0x2b45('0x17')](_0x581044)[_0x2b45('0x25')](_0x48db03[_0x2b45('0x2e')][_0x2b45('0x6c')]?{'message':_0x2b45('0x6f'),'statusCode':_0x58f7b9[_0x2b45('0x6d')]}:_0x58f7b9);});}else{var _0x38f490=0x1f4;_0x190bf5[_0x2b45('0x17')](_0x38f490)[_0x2b45('0x25')]({'message':_0x2b45('0x6f'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xfd56=['Subjects','getSubjects','channel','type','getDescriptions','SugarcrmConfiguration','SugarcrmField','Descriptions','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','Calls','values','remove','includes','label','endsWith','value','test','getFields','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','key','keys','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','options','findAll','rows','catch','show','params','include','merge','create','body','find','getConfigurations','findOne','filter','addConfiguration','AccountId'];(function(_0x5cc35f,_0x5acd94){var _0x3f33eb=function(_0x1af690){while(--_0x1af690){_0x5cc35f['push'](_0x5cc35f['shift']());}};_0x3f33eb(++_0x5acd94);}(_0xfd56,0x128));var _0x6fd5=function(_0x193e36,_0x636abe){_0x193e36=_0x193e36-0x0;var _0x168a94=_0xfd56[_0x193e36];return _0x168a94;};'use strict';var emlformat=require(_0x6fd5('0x0'));var rimraf=require(_0x6fd5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fd5('0x2'));var rp=require(_0x6fd5('0x3'));var moment=require(_0x6fd5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6fd5('0x5'));var util=require(_0x6fd5('0x6'));var path=require(_0x6fd5('0x7'));var sox=require(_0x6fd5('0x8'));var csv=require(_0x6fd5('0x9'));var ejs=require(_0x6fd5('0xa'));var fs=require('fs');var fs_extra=require(_0x6fd5('0xb'));var _=require('lodash');var squel=require(_0x6fd5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6fd5('0xd'));var toCsv=require(_0x6fd5('0x9'));var querystring=require(_0x6fd5('0xe'));var Papa=require(_0x6fd5('0xf'));var Redis=require(_0x6fd5('0x10'));var authService=require(_0x6fd5('0x11'));var qs=require(_0x6fd5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fd5('0x13'));var logger=require(_0x6fd5('0x14'))(_0x6fd5('0x15'));var utils=require(_0x6fd5('0x16'));var config=require(_0x6fd5('0x17'));var licenseUtil=require(_0x6fd5('0x18'));var db=require(_0x6fd5('0x19'))['db'];var integrations=require(_0x6fd5('0x1a'));function respondWithStatusCode(_0xa3c8c4,_0x5dae23){_0x5dae23=_0x5dae23||0xcc;return function(_0x1675dc){if(_0x1675dc){return _0xa3c8c4[_0x6fd5('0x1b')](_0x5dae23);}return _0xa3c8c4[_0x6fd5('0x1c')](_0x5dae23)[_0x6fd5('0x1d')]();};}function respondWithResult(_0x4d76c7,_0x3636ac){_0x3636ac=_0x3636ac||0xc8;return function(_0x8d82d8){if(_0x8d82d8){return _0x4d76c7['status'](_0x3636ac)['json'](_0x8d82d8);}};}function respondWithFilteredResult(_0x41faea,_0xbc5c61){return function(_0x545a41){if(_0x545a41){var _0x56402f=typeof _0xbc5c61[_0x6fd5('0x1e')]==='undefined'&&typeof _0xbc5c61['limit']===_0x6fd5('0x1f');var _0x52f8fe=_0x545a41[_0x6fd5('0x20')];var _0xea78ab=_0x56402f?0x0:_0xbc5c61[_0x6fd5('0x1e')];var _0x23936c=_0x56402f?_0x545a41[_0x6fd5('0x20')]:_0xbc5c61[_0x6fd5('0x1e')]+_0xbc5c61['limit'];var _0x6db6b2;if(_0x23936c>=_0x52f8fe){_0x23936c=_0x52f8fe;_0x6db6b2=0xc8;}else{_0x6db6b2=0xce;}_0x41faea[_0x6fd5('0x1c')](_0x6db6b2);return _0x41faea[_0x6fd5('0x21')](_0x6fd5('0x22'),_0xea78ab+'-'+_0x23936c+'/'+_0x52f8fe)[_0x6fd5('0x23')](_0x545a41);}return null;};}function patchUpdates(_0x49711b){return function(_0x4e9022){try{jsonpatch[_0x6fd5('0x24')](_0x4e9022,_0x49711b,!![]);}catch(_0x33963){return BPromise[_0x6fd5('0x25')](_0x33963);}return _0x4e9022['save']();};}function saveUpdates(_0xe49ce0,_0x1c757d){return function(_0x2f745a){if(_0x2f745a){return _0x2f745a[_0x6fd5('0x26')](_0xe49ce0)['then'](function(_0x3bcf98){return _0x3bcf98;});}return null;};}function removeEntity(_0xe8773,_0x256846){return function(_0x281316){if(_0x281316){return _0x281316[_0x6fd5('0x27')]()[_0x6fd5('0x28')](function(){_0xe8773[_0x6fd5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cd49,_0x88fa7e){return function(_0xdcf2be){if(!_0xdcf2be){_0x45cd49[_0x6fd5('0x1b')](0x194);}return _0xdcf2be;};}function handleError(_0x54f070,_0x1f01d9){_0x1f01d9=_0x1f01d9||0x1f4;return function(_0x501091){logger[_0x6fd5('0x29')](_0x501091[_0x6fd5('0x2a')]);if(_0x501091[_0x6fd5('0x2b')]){delete _0x501091[_0x6fd5('0x2b')];}_0x54f070[_0x6fd5('0x1c')](_0x1f01d9)['send'](_0x501091);};}exports[_0x6fd5('0x2c')]=function(_0x1af198,_0x4c184f){var _0x3da5c3={},_0x138374={},_0x20c226={'count':0x0,'rows':[]};var _0x1df546=_[_0x6fd5('0x2d')](db[_0x6fd5('0x2e')][_0x6fd5('0x2f')],function(_0x81691f){return{'name':_0x81691f[_0x6fd5('0x30')],'type':_0x81691f['type'][_0x6fd5('0x31')]};});_0x138374['model']=_[_0x6fd5('0x2d')](_0x1df546,_0x6fd5('0x2b'));_0x138374['query']=_[_0x6fd5('0x32')](_0x1af198[_0x6fd5('0x33')]);_0x138374[_0x6fd5('0x34')]=_['intersection'](_0x138374['model'],_0x138374[_0x6fd5('0x33')]);_0x3da5c3[_0x6fd5('0x35')]=_[_0x6fd5('0x36')](_0x138374['model'],qs[_0x6fd5('0x37')](_0x1af198[_0x6fd5('0x33')][_0x6fd5('0x37')]));_0x3da5c3[_0x6fd5('0x35')]=_0x3da5c3[_0x6fd5('0x35')][_0x6fd5('0x38')]?_0x3da5c3[_0x6fd5('0x35')]:_0x138374[_0x6fd5('0x39')];if(!_0x1af198[_0x6fd5('0x33')][_0x6fd5('0x3a')](_0x6fd5('0x3b'))){_0x3da5c3['limit']=qs[_0x6fd5('0x3c')](_0x1af198[_0x6fd5('0x33')][_0x6fd5('0x3c')]);_0x3da5c3[_0x6fd5('0x1e')]=qs[_0x6fd5('0x1e')](_0x1af198[_0x6fd5('0x33')]['offset']);}_0x3da5c3[_0x6fd5('0x3d')]=qs[_0x6fd5('0x3e')](_0x1af198[_0x6fd5('0x33')]['sort']);_0x3da5c3['where']=qs['filters'](_[_0x6fd5('0x3f')](_0x1af198[_0x6fd5('0x33')],_0x138374[_0x6fd5('0x34')]),_0x1df546);if(_0x1af198[_0x6fd5('0x33')]['filter']){_0x3da5c3[_0x6fd5('0x40')]=_['merge'](_0x3da5c3['where'],{'$or':_[_0x6fd5('0x2d')](_0x1df546,function(_0x23ab2e){if(_0x23ab2e['type']!==_0x6fd5('0x41')){var _0x177683={};_0x177683[_0x23ab2e[_0x6fd5('0x2b')]]={'$like':'%'+_0x1af198[_0x6fd5('0x33')]['filter']+'%'};return _0x177683;}})});}_0x3da5c3=_['merge']({},_0x3da5c3,_0x1af198[_0x6fd5('0x42')]);var _0x55b553={'where':_0x3da5c3[_0x6fd5('0x40')]};return db[_0x6fd5('0x2e')][_0x6fd5('0x20')](_0x55b553)[_0x6fd5('0x28')](function(_0x36f357){_0x20c226[_0x6fd5('0x20')]=_0x36f357;if(_0x1af198['query']['includeAll']){_0x3da5c3['include']=[{'all':!![]}];}return db[_0x6fd5('0x2e')][_0x6fd5('0x43')](_0x3da5c3);})['then'](function(_0x52ab2c){_0x20c226[_0x6fd5('0x44')]=_0x52ab2c;return _0x20c226;})['then'](respondWithFilteredResult(_0x4c184f,_0x3da5c3))[_0x6fd5('0x45')](handleError(_0x4c184f,null));};exports[_0x6fd5('0x46')]=function(_0x14f07a,_0x5c920e){var _0x496af9={'raw':![],'where':{'id':_0x14f07a[_0x6fd5('0x47')]['id']}},_0x14e430={};_0x14e430[_0x6fd5('0x39')]=_[_0x6fd5('0x32')](db['SugarcrmAccount'][_0x6fd5('0x2f')]);_0x14e430[_0x6fd5('0x33')]=_[_0x6fd5('0x32')](_0x14f07a[_0x6fd5('0x33')]);_0x14e430[_0x6fd5('0x34')]=_[_0x6fd5('0x36')](_0x14e430[_0x6fd5('0x39')],_0x14e430[_0x6fd5('0x33')]);_0x496af9[_0x6fd5('0x35')]=_['intersection'](_0x14e430[_0x6fd5('0x39')],qs[_0x6fd5('0x37')](_0x14f07a[_0x6fd5('0x33')][_0x6fd5('0x37')]));_0x496af9[_0x6fd5('0x35')]=_0x496af9[_0x6fd5('0x35')][_0x6fd5('0x38')]?_0x496af9[_0x6fd5('0x35')]:_0x14e430[_0x6fd5('0x39')];if(_0x14f07a[_0x6fd5('0x33')]['includeAll']){_0x496af9[_0x6fd5('0x48')]=[{'all':!![]}];}_0x496af9=_[_0x6fd5('0x49')]({},_0x496af9,_0x14f07a[_0x6fd5('0x42')]);return db[_0x6fd5('0x2e')]['find'](_0x496af9)['then'](handleEntityNotFound(_0x5c920e,null))[_0x6fd5('0x28')](respondWithResult(_0x5c920e,null))[_0x6fd5('0x45')](handleError(_0x5c920e,null));};exports['create']=function(_0x4eeef2,_0x57abb6){return db[_0x6fd5('0x2e')][_0x6fd5('0x4a')](_0x4eeef2[_0x6fd5('0x4b')],{})[_0x6fd5('0x28')](respondWithResult(_0x57abb6,0xc9))[_0x6fd5('0x45')](handleError(_0x57abb6,null));};exports[_0x6fd5('0x26')]=function(_0x6a9792,_0x35d955){if(_0x6a9792['body']['id']){delete _0x6a9792[_0x6fd5('0x4b')]['id'];}return db['SugarcrmAccount'][_0x6fd5('0x4c')]({'where':{'id':_0x6a9792[_0x6fd5('0x47')]['id']}})[_0x6fd5('0x28')](handleEntityNotFound(_0x35d955,null))[_0x6fd5('0x28')](saveUpdates(_0x6a9792[_0x6fd5('0x4b')],null))[_0x6fd5('0x28')](respondWithResult(_0x35d955,null))[_0x6fd5('0x45')](handleError(_0x35d955,null));};exports[_0x6fd5('0x27')]=function(_0x51f1ca,_0x2a3dd5){return db[_0x6fd5('0x2e')][_0x6fd5('0x4c')]({'where':{'id':_0x51f1ca[_0x6fd5('0x47')]['id']}})[_0x6fd5('0x28')](handleEntityNotFound(_0x2a3dd5,null))['then'](removeEntity(_0x2a3dd5,null))[_0x6fd5('0x45')](handleError(_0x2a3dd5,null));};exports[_0x6fd5('0x4d')]=function(_0x252248,_0x46af12,_0x202675){var _0x1fed16={};var _0x293ac7={};var _0x5d3647;var _0x3919b9;return db[_0x6fd5('0x2e')][_0x6fd5('0x4e')]({'where':{'id':_0x252248[_0x6fd5('0x47')]['id']}})['then'](handleEntityNotFound(_0x46af12,null))[_0x6fd5('0x28')](function(_0x3aeac1){if(_0x3aeac1){_0x5d3647=_0x3aeac1;_0x293ac7['model']=_[_0x6fd5('0x32')](db['SugarcrmConfiguration'][_0x6fd5('0x2f')]);_0x293ac7['query']=_[_0x6fd5('0x32')](_0x252248[_0x6fd5('0x33')]);_0x293ac7[_0x6fd5('0x34')]=_[_0x6fd5('0x36')](_0x293ac7['model'],_0x293ac7[_0x6fd5('0x33')]);_0x1fed16[_0x6fd5('0x35')]=_[_0x6fd5('0x36')](_0x293ac7[_0x6fd5('0x39')],qs[_0x6fd5('0x37')](_0x252248['query'][_0x6fd5('0x37')]));_0x1fed16[_0x6fd5('0x35')]=_0x1fed16[_0x6fd5('0x35')][_0x6fd5('0x38')]?_0x1fed16[_0x6fd5('0x35')]:_0x293ac7['model'];_0x1fed16['order']=qs['sort'](_0x252248[_0x6fd5('0x33')][_0x6fd5('0x3e')]);_0x1fed16[_0x6fd5('0x40')]=qs[_0x6fd5('0x34')](_['pick'](_0x252248[_0x6fd5('0x33')],_0x293ac7[_0x6fd5('0x34')]));if(_0x252248[_0x6fd5('0x33')]['filter']){_0x1fed16[_0x6fd5('0x40')]=_[_0x6fd5('0x49')](_0x1fed16[_0x6fd5('0x40')],{'$or':_['map'](_0x1fed16[_0x6fd5('0x35')],function(_0x586f6d){var _0x19d329={};_0x19d329[_0x586f6d]={'$like':'%'+_0x252248[_0x6fd5('0x33')][_0x6fd5('0x4f')]+'%'};return _0x19d329;})});}_0x1fed16=_['merge']({},_0x1fed16,_0x252248[_0x6fd5('0x42')]);return _0x5d3647[_0x6fd5('0x4d')](_0x1fed16);}})[_0x6fd5('0x28')](function(_0x83bb4d){if(_0x83bb4d){_0x3919b9=_0x83bb4d[_0x6fd5('0x38')];if(!_0x252248[_0x6fd5('0x33')]['hasOwnProperty']('nolimit')){_0x1fed16[_0x6fd5('0x3c')]=qs[_0x6fd5('0x3c')](_0x252248[_0x6fd5('0x33')][_0x6fd5('0x3c')]);_0x1fed16[_0x6fd5('0x1e')]=qs['offset'](_0x252248[_0x6fd5('0x33')]['offset']);}return _0x5d3647[_0x6fd5('0x4d')](_0x1fed16);}})['then'](function(_0x8c938){if(_0x8c938){return _0x8c938?{'count':_0x3919b9,'rows':_0x8c938}:null;}})[_0x6fd5('0x28')](respondWithResult(_0x46af12,null))['catch'](handleError(_0x46af12,null));};exports[_0x6fd5('0x50')]=function(_0x1d8867,_0x360cff,_0x3a5587){if(_0x1d8867[_0x6fd5('0x4b')]['id']){delete _0x1d8867[_0x6fd5('0x4b')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x1d8867[_0x6fd5('0x47')]['id']}})[_0x6fd5('0x28')](handleEntityNotFound(_0x360cff,null))['then'](function(_0x47669b){if(_0x47669b){_0x1d8867[_0x6fd5('0x4b')][_0x6fd5('0x51')]=_0x47669b['id'];_0x1d8867[_0x6fd5('0x4b')][_0x6fd5('0x52')]=integrations[_0x6fd5('0x53')](_0x1d8867[_0x6fd5('0x4b')][_0x6fd5('0x54')],_0x1d8867['body'][_0x6fd5('0x55')]);_0x1d8867[_0x6fd5('0x4b')]['Descriptions']=integrations[_0x6fd5('0x56')](_0x1d8867[_0x6fd5('0x4b')]['channel'],_0x1d8867[_0x6fd5('0x4b')][_0x6fd5('0x55')]);return db[_0x6fd5('0x57')]['create'](_0x1d8867[_0x6fd5('0x4b')],{'include':[{'model':db[_0x6fd5('0x58')],'as':_0x6fd5('0x52')},{'model':db['SugarcrmField'],'as':_0x6fd5('0x59')}]});}return null;})[_0x6fd5('0x28')](respondWithResult(_0x360cff,null))['catch'](handleError(_0x360cff,null));};exports['getFields']=function(_0x31ed4e,_0x39cb9e,_0x1f5731){var _0x176576='';var _0xbdabfb=['id',_0x6fd5('0x2b'),_0x6fd5('0x5a'),_0x6fd5('0x5b'),_0x6fd5('0x5c'),_0x6fd5('0x5d'),_0x6fd5('0x5e'),_0x6fd5('0x5f'),_0x6fd5('0x60'),_0x6fd5('0x61'),_0x6fd5('0x62'),_0x6fd5('0x63')];return db[_0x6fd5('0x2e')][_0x6fd5('0x4e')]({'where':{'id':_0x31ed4e[_0x6fd5('0x47')]['id']},'attributes':['id',_0x6fd5('0x64'),'password',_0x6fd5('0x65')]})[_0x6fd5('0x28')](handleEntityNotFound(_0x39cb9e,null))[_0x6fd5('0x28')](function(_0x27c333){if(_0x27c333){_0x176576=_0x27c333[_0x6fd5('0x65')];var _0x505406=_0x176576[_0x6fd5('0x66')](-0x1);if(_0x505406==='/'){_0x176576=_0x176576[_0x6fd5('0x67')](0x0,_0x176576[_0x6fd5('0x68')](_0x505406));}return rp({'method':_0x6fd5('0x69'),'uri':util[_0x6fd5('0x6a')](_0x6fd5('0x6b'),_0x176576,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x6fd5('0x6c'),'input_type':_0x6fd5('0x6d'),'response_type':_0x6fd5('0x6d'),'rest_data':JSON[_0x6fd5('0x6e')]({'user_auth':{'user_name':_0x27c333[_0x6fd5('0x64')],'password':_0x27c333['password'],'encryption':_0x6fd5('0x6f')},'application':_0x6fd5('0x70')})}});}})[_0x6fd5('0x28')](function(_0x30de8c){if(_0x30de8c&&_0x30de8c[_0x6fd5('0x2b')]!=='Invalid\x20Login'&&_0x30de8c[_0x6fd5('0x2b')]!==_0x6fd5('0x71')){return rp({'method':_0x6fd5('0x69'),'uri':util[_0x6fd5('0x6a')]('%s%s',_0x176576,_0x6fd5('0x72')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x6fd5('0x6d'),'response_type':_0x6fd5('0x6d'),'rest_data':JSON[_0x6fd5('0x6e')]({'session':_0x30de8c['id'],'module_name':_0x6fd5('0x73')})}})[_0x6fd5('0x28')](function(_0x266f44){if(_0x266f44){var _0x1a9db2=_[_0x6fd5('0x74')](_0x266f44['module_fields']);_[_0x6fd5('0x75')](_0x1a9db2,function(_0x1f4819){return _0xbdabfb[_0x6fd5('0x76')](_0x1f4819[_0x6fd5('0x2b')]);});return{'count':_0x1a9db2[_0x6fd5('0x38')],'rows':_[_0x6fd5('0x2d')](_0x1a9db2,function(_0x33550f){return{'id':_0x33550f[_0x6fd5('0x2b')],'name':_0x33550f[_0x6fd5('0x77')],'custom':_[_0x6fd5('0x78')](_0x33550f[_0x6fd5('0x2b')],'_c')?!![]:![],'options':_0x33550f[_0x6fd5('0x42')]?_[_0x6fd5('0x2d')](_[_0x6fd5('0x74')](_0x33550f[_0x6fd5('0x42')]),function(_0x4bc489){return{'name':_0x4bc489[_0x6fd5('0x79')],'value':_0x4bc489[_0x6fd5('0x2b')]};}):[]};})};}})[_0x6fd5('0x28')](respondWithResult(_0x39cb9e,null))[_0x6fd5('0x45')](function(_0x292827){var _0x475445=_0x31ed4e[_0x6fd5('0x33')][_0x6fd5('0x7a')]?0x1f4:_0x292827['statusCode']||0x1f4;logger[_0x6fd5('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x6fd5('0x7b'),_0x475445,JSON[_0x6fd5('0x6e')](_0x292827));delete _0x292827['name'];if(_0x475445===0x191){_0x475445=0x190;}_0x39cb9e[_0x6fd5('0x1c')](_0x475445)[_0x6fd5('0x7c')](_0x31ed4e['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x292827['statusCode']}:_0x292827);});}else{var _0x5cc47e=0x1f4;_0x39cb9e[_0x6fd5('0x1c')](_0x5cc47e)[_0x6fd5('0x7c')]({'message':_0x6fd5('0x7d'),'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 57a94d6..533527e 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 _0x6bec=['define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x585310,_0x536d07){var _0xa454d3=function(_0x2624f1){while(--_0x2624f1){_0x585310['push'](_0x585310['shift']());}};_0xa454d3(++_0x536d07);}(_0x6bec,0x86));var _0xc6be=function(_0x103f9d,_0x1eef47){_0x103f9d=_0x103f9d-0x0;var _0xc9342d=_0x6bec[_0x103f9d];return _0xc9342d;};'use strict';var _=require(_0xc6be('0x0'));var util=require(_0xc6be('0x1'));var logger=require(_0xc6be('0x2'))(_0xc6be('0x3'));var moment=require('moment');var BPromise=require(_0xc6be('0x4'));var rp=require(_0xc6be('0x5'));var fs=require('fs');var path=require(_0xc6be('0x6'));var rimraf=require(_0xc6be('0x7'));var config=require(_0xc6be('0x8'));var attributes=require(_0xc6be('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x25e421,_0x4acaeb){return _0x25e421[_0xc6be('0xa')]('SugarcrmAccount',attributes,{'tableName':_0xc6be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11c1=['moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api'];(function(_0x37e21b,_0x50b31e){var _0x411f61=function(_0x1dd731){while(--_0x1dd731){_0x37e21b['push'](_0x37e21b['shift']());}};_0x411f61(++_0x50b31e);}(_0x11c1,0x1cb));var _0x111c=function(_0x1e4fb8,_0x488cb7){_0x1e4fb8=_0x1e4fb8-0x0;var _0x32256a=_0x11c1[_0x1e4fb8];return _0x32256a;};'use strict';var _=require(_0x111c('0x0'));var util=require('util');var logger=require(_0x111c('0x1'))(_0x111c('0x2'));var moment=require(_0x111c('0x3'));var BPromise=require(_0x111c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x111c('0x5'));var rimraf=require(_0x111c('0x6'));var config=require(_0x111c('0x7'));var attributes=require(_0x111c('0x8'));var integrations=require(_0x111c('0x9'));module[_0x111c('0xa')]=function(_0x487ac7,_0xd1221b){return _0x487ac7[_0x111c('0xb')](_0x111c('0xc'),attributes,{'tableName':_0x111c('0xd'),'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 48b49f5..c4a2a9a 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 _0x75fa=['http','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','SugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x5f0a69,_0x499b4d){var _0x498d60=function(_0x3ef829){while(--_0x3ef829){_0x5f0a69['push'](_0x5f0a69['shift']());}};_0x498d60(++_0x499b4d);}(_0x75fa,0x182));var _0xa75f=function(_0x283f43,_0x72196b){_0x283f43=_0x283f43-0x0;var _0x544539=_0x75fa[_0x283f43];return _0x544539;};'use strict';var _=require(_0xa75f('0x0'));var util=require(_0xa75f('0x1'));var moment=require('moment');var BPromise=require(_0xa75f('0x2'));var rs=require(_0xa75f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa75f('0x4'))['db'];var utils=require(_0xa75f('0x5'));var logger=require('../../config/logger')(_0xa75f('0x6'));var config=require(_0xa75f('0x7'));var jayson=require(_0xa75f('0x8'));var client=jayson[_0xa75f('0x9')][_0xa75f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bade0,_0x159715,_0x64a9df){return new BPromise(function(_0x5e2a49,_0x27c0e3){return client['request'](_0x1bade0,_0x64a9df)['then'](function(_0x12d22a){logger['info'](_0xa75f('0xb'),_0x159715,_0xa75f('0xc'));logger[_0xa75f('0xd')](_0xa75f('0xe'),_0x159715,_0xa75f('0xc'),JSON[_0xa75f('0xf')](_0x12d22a));if(_0x12d22a['error']){if(_0x12d22a[_0xa75f('0x10')][_0xa75f('0x11')]===0x1f4){logger['error'](_0xa75f('0xb'),_0x159715,_0x12d22a['error'][_0xa75f('0x12')]);return _0x27c0e3(_0x12d22a['error'][_0xa75f('0x12')]);}logger['error'](_0xa75f('0xb'),_0x159715,_0x12d22a[_0xa75f('0x10')][_0xa75f('0x12')]);return _0x5e2a49(_0x12d22a[_0xa75f('0x10')][_0xa75f('0x12')]);}else{logger[_0xa75f('0x13')](_0xa75f('0xb'),_0x159715,_0xa75f('0xc'));_0x5e2a49(_0x12d22a[_0xa75f('0x14')][_0xa75f('0x12')]);}})[_0xa75f('0x15')](function(_0x840222){logger[_0xa75f('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x159715,_0x840222);_0x27c0e3(_0x840222);});});}exports[_0xa75f('0x16')]=function(_0x5bb951){var _0x47bdbe=this;return new Promise(function(_0x460044,_0x39c3db){return db['SugarcrmAccount'][_0xa75f('0x17')]({'raw':_0x5bb951[_0xa75f('0x18')]?_0x5bb951[_0xa75f('0x18')][_0xa75f('0x19')]===undefined?!![]:![]:!![],'where':_0x5bb951[_0xa75f('0x18')]?_0x5bb951[_0xa75f('0x18')][_0xa75f('0x1a')]||null:null,'attributes':_0x5bb951[_0xa75f('0x18')]?_0x5bb951[_0xa75f('0x18')][_0xa75f('0x1b')]||null:null,'limit':_0x5bb951['options']?_0x5bb951[_0xa75f('0x18')][_0xa75f('0x1c')]||null:null,'include':_0x5bb951['options']?_0x5bb951[_0xa75f('0x18')]['include']?_['map'](_0x5bb951[_0xa75f('0x18')][_0xa75f('0x1d')],function(_0x1f2be9){return{'model':db[_0x1f2be9[_0xa75f('0x1e')]],'as':_0x1f2be9['as'],'attributes':_0x1f2be9[_0xa75f('0x1b')],'include':_0x1f2be9[_0xa75f('0x1d')]?_[_0xa75f('0x1f')](_0x1f2be9[_0xa75f('0x1d')],function(_0x38300e){return{'model':db[_0x38300e[_0xa75f('0x1e')]],'as':_0x38300e['as'],'attributes':_0x38300e['attributes'],'include':_0x38300e[_0xa75f('0x1d')]?_[_0xa75f('0x1f')](_0x38300e[_0xa75f('0x1d')],function(_0x561ccd){return{'model':db[_0x561ccd[_0xa75f('0x1e')]],'as':_0x561ccd['as'],'attributes':_0x561ccd['attributes']};}):[]};}):[]};}):[]:[]})[_0xa75f('0x20')](function(_0x51262f){logger['info'](_0xa75f('0x16'),_0x5bb951);logger['debug']('GetSugarcrmAccount',_0x5bb951,JSON[_0xa75f('0xf')](_0x51262f));_0x460044(_0x51262f);})['catch'](function(_0x4041b8){logger[_0xa75f('0x10')]('GetSugarcrmAccount',_0x4041b8[_0xa75f('0x12')],_0x5bb951);_0x39c3db(_0x47bdbe[_0xa75f('0x10')](0x1f4,_0x4041b8['message']));});});};exports['ShowSugarcrmAccount']=function(_0x296f70){var _0x54a6ce=this;return new Promise(function(_0x8a5c8f,_0x2adfb0){return db[_0xa75f('0x21')][_0xa75f('0x22')]({'raw':_0x296f70[_0xa75f('0x18')]?_0x296f70[_0xa75f('0x18')][_0xa75f('0x19')]===undefined?!![]:![]:!![],'where':_0x296f70[_0xa75f('0x18')]?_0x296f70[_0xa75f('0x18')][_0xa75f('0x1a')]||null:null,'attributes':_0x296f70[_0xa75f('0x18')]?_0x296f70[_0xa75f('0x18')][_0xa75f('0x1b')]||null:null,'include':_0x296f70[_0xa75f('0x18')]?_0x296f70[_0xa75f('0x18')][_0xa75f('0x1d')]?_[_0xa75f('0x1f')](_0x296f70[_0xa75f('0x18')]['include'],function(_0x508ce9){return{'model':db[_0x508ce9[_0xa75f('0x1e')]],'as':_0x508ce9['as'],'attributes':_0x508ce9[_0xa75f('0x1b')],'include':_0x508ce9['include']?_[_0xa75f('0x1f')](_0x508ce9[_0xa75f('0x1d')],function(_0x2bcec1){return{'model':db[_0x2bcec1[_0xa75f('0x1e')]],'as':_0x2bcec1['as'],'attributes':_0x2bcec1[_0xa75f('0x1b')],'include':_0x2bcec1[_0xa75f('0x1d')]?_['map'](_0x2bcec1['include'],function(_0x29ec6f){return{'model':db[_0x29ec6f[_0xa75f('0x1e')]],'as':_0x29ec6f['as'],'attributes':_0x29ec6f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bad68){logger[_0xa75f('0x13')](_0xa75f('0x23'),_0x296f70);logger['debug'](_0xa75f('0x23'),_0x296f70,JSON[_0xa75f('0xf')](_0x4bad68));_0x8a5c8f(_0x4bad68);})[_0xa75f('0x15')](function(_0x5bbbfc){logger['error'](_0xa75f('0x23'),_0x5bbbfc['message'],_0x296f70);_0x2adfb0(_0x54a6ce['error'](0x1f4,_0x5bbbfc[_0xa75f('0x12')]));});});}; \ No newline at end of file +var _0x86fe=['SugarcrmAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','limit','map','include','model','ShowSugarcrmAccount','find','raw','lodash','moment','bluebird','randomstring','../../config/logger','jayson/promise','client','request','then','info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x330eec,_0x111981){var _0xb1575d=function(_0x325a2c){while(--_0x325a2c){_0x330eec['push'](_0x330eec['shift']());}};_0xb1575d(++_0x111981);}(_0x86fe,0xd1));var _0xe86f=function(_0x58356d,_0x2f0605){_0x58356d=_0x58356d-0x0;var _0xfaa63a=_0x86fe[_0x58356d];return _0xfaa63a;};'use strict';var _=require(_0xe86f('0x0'));var util=require('util');var moment=require(_0xe86f('0x1'));var BPromise=require(_0xe86f('0x2'));var rs=require(_0xe86f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe86f('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe86f('0x5'));var client=jayson[_0xe86f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46344c,_0x1a620a,_0x484c30){return new BPromise(function(_0x2f7d07,_0x16bccf){return client[_0xe86f('0x7')](_0x46344c,_0x484c30)[_0xe86f('0x8')](function(_0x542e28){logger[_0xe86f('0x9')]('SugarcrmAccount,\x20%s,\x20%s',_0x1a620a,'request\x20sent');logger[_0xe86f('0xa')](_0xe86f('0xb'),_0x1a620a,'request\x20sent',JSON[_0xe86f('0xc')](_0x542e28));if(_0x542e28[_0xe86f('0xd')]){if(_0x542e28['error'][_0xe86f('0xe')]===0x1f4){logger['error'](_0xe86f('0xf'),_0x1a620a,_0x542e28[_0xe86f('0xd')][_0xe86f('0x10')]);return _0x16bccf(_0x542e28[_0xe86f('0xd')][_0xe86f('0x10')]);}logger[_0xe86f('0xd')](_0xe86f('0xf'),_0x1a620a,_0x542e28[_0xe86f('0xd')][_0xe86f('0x10')]);return _0x2f7d07(_0x542e28[_0xe86f('0xd')][_0xe86f('0x10')]);}else{logger[_0xe86f('0x9')](_0xe86f('0xf'),_0x1a620a,_0xe86f('0x11'));_0x2f7d07(_0x542e28[_0xe86f('0x12')][_0xe86f('0x10')]);}})[_0xe86f('0x13')](function(_0x14f29a){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x1a620a,_0x14f29a);_0x16bccf(_0x14f29a);});});}exports[_0xe86f('0x14')]=function(_0x363457){var _0x3506ac=this;return new Promise(function(_0x3037ce,_0x17894d){return db[_0xe86f('0x15')]['findAll']({'raw':_0x363457[_0xe86f('0x16')]?_0x363457[_0xe86f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x363457['options']?_0x363457['options'][_0xe86f('0x17')]||null:null,'attributes':_0x363457[_0xe86f('0x16')]?_0x363457[_0xe86f('0x16')][_0xe86f('0x18')]||null:null,'limit':_0x363457[_0xe86f('0x16')]?_0x363457[_0xe86f('0x16')][_0xe86f('0x19')]||null:null,'include':_0x363457[_0xe86f('0x16')]?_0x363457[_0xe86f('0x16')]['include']?_[_0xe86f('0x1a')](_0x363457['options'][_0xe86f('0x1b')],function(_0x56724b){return{'model':db[_0x56724b[_0xe86f('0x1c')]],'as':_0x56724b['as'],'attributes':_0x56724b[_0xe86f('0x18')],'include':_0x56724b[_0xe86f('0x1b')]?_[_0xe86f('0x1a')](_0x56724b[_0xe86f('0x1b')],function(_0x2a38cd){return{'model':db[_0x2a38cd[_0xe86f('0x1c')]],'as':_0x2a38cd['as'],'attributes':_0x2a38cd[_0xe86f('0x18')],'include':_0x2a38cd[_0xe86f('0x1b')]?_[_0xe86f('0x1a')](_0x2a38cd[_0xe86f('0x1b')],function(_0x227aae){return{'model':db[_0x227aae[_0xe86f('0x1c')]],'as':_0x227aae['as'],'attributes':_0x227aae[_0xe86f('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe86f('0x8')](function(_0x3c4edf){logger[_0xe86f('0x9')](_0xe86f('0x14'),_0x363457);logger[_0xe86f('0xa')](_0xe86f('0x14'),_0x363457,JSON[_0xe86f('0xc')](_0x3c4edf));_0x3037ce(_0x3c4edf);})[_0xe86f('0x13')](function(_0x599118){logger['error']('GetSugarcrmAccount',_0x599118[_0xe86f('0x10')],_0x363457);_0x17894d(_0x3506ac[_0xe86f('0xd')](0x1f4,_0x599118[_0xe86f('0x10')]));});});};exports[_0xe86f('0x1d')]=function(_0x49e7ed){var _0x16f44d=this;return new Promise(function(_0x2d8419,_0xaf3072){return db[_0xe86f('0x15')][_0xe86f('0x1e')]({'raw':_0x49e7ed['options']?_0x49e7ed['options'][_0xe86f('0x1f')]===undefined?!![]:![]:!![],'where':_0x49e7ed['options']?_0x49e7ed[_0xe86f('0x16')][_0xe86f('0x17')]||null:null,'attributes':_0x49e7ed[_0xe86f('0x16')]?_0x49e7ed['options']['attributes']||null:null,'include':_0x49e7ed[_0xe86f('0x16')]?_0x49e7ed[_0xe86f('0x16')]['include']?_[_0xe86f('0x1a')](_0x49e7ed[_0xe86f('0x16')]['include'],function(_0xe5f49b){return{'model':db[_0xe5f49b[_0xe86f('0x1c')]],'as':_0xe5f49b['as'],'attributes':_0xe5f49b[_0xe86f('0x18')],'include':_0xe5f49b[_0xe86f('0x1b')]?_[_0xe86f('0x1a')](_0xe5f49b['include'],function(_0x557325){return{'model':db[_0x557325[_0xe86f('0x1c')]],'as':_0x557325['as'],'attributes':_0x557325['attributes'],'include':_0x557325['include']?_['map'](_0x557325[_0xe86f('0x1b')],function(_0x46ed07){return{'model':db[_0x46ed07[_0xe86f('0x1c')]],'as':_0x46ed07['as'],'attributes':_0x46ed07[_0xe86f('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24a6f3){logger['info'](_0xe86f('0x1d'),_0x49e7ed);logger['debug'](_0xe86f('0x1d'),_0x49e7ed,JSON[_0xe86f('0xc')](_0x24a6f3));_0x2d8419(_0x24a6f3);})[_0xe86f('0x13')](function(_0x199ecd){logger['error'](_0xe86f('0x1d'),_0x199ecd[_0xe86f('0x10')],_0x49e7ed);_0xaf3072(_0x16f44d['error'](0x1f4,_0x199ecd[_0xe86f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index ad68151..bd75d55 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 _0x9976=['/:id/subjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields'];(function(_0x239a48,_0x2b6239){var _0x136ad3=function(_0x1c1bf8){while(--_0x1c1bf8){_0x239a48['push'](_0x239a48['shift']());}};_0x136ad3(++_0x2b6239);}(_0x9976,0x1a6));var _0x6997=function(_0x4e0157,_0x1a7192){_0x4e0157=_0x4e0157-0x0;var _0x435419=_0x9976[_0x4e0157];return _0x435419;};'use strict';var multer=require('multer');var util=require(_0x6997('0x0'));var path=require(_0x6997('0x1'));var timeout=require(_0x6997('0x2'));var express=require(_0x6997('0x3'));var router=express[_0x6997('0x4')]();var fs_extra=require(_0x6997('0x5'));var auth=require(_0x6997('0x6'));var interaction=require(_0x6997('0x7'));var config=require(_0x6997('0x8'));var controller=require(_0x6997('0x9'));router[_0x6997('0xa')]('/',auth[_0x6997('0xb')](),controller['index']);router['get'](_0x6997('0xc'),auth['isAuthenticated'](),controller[_0x6997('0xd')]);router[_0x6997('0xa')](_0x6997('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x6997('0xa')](_0x6997('0xf'),auth[_0x6997('0xb')](),controller['getSubjects']);router['get'](_0x6997('0x10'),auth[_0x6997('0xb')](),controller[_0x6997('0x11')]);router[_0x6997('0x12')]('/',auth[_0x6997('0xb')](),controller['create']);router['put'](_0x6997('0xc'),auth[_0x6997('0xb')](),controller[_0x6997('0x13')]);router[_0x6997('0x14')](_0x6997('0xc'),auth[_0x6997('0xb')](),controller[_0x6997('0x15')]);module[_0x6997('0x16')]=router; \ No newline at end of file +var _0x75d8=['express','Router','../../components/auth/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0xd3fc94,_0x1275d7){var _0x1821f9=function(_0x5c4dbd){while(--_0x5c4dbd){_0xd3fc94['push'](_0xd3fc94['shift']());}};_0x1821f9(++_0x1275d7);}(_0x75d8,0x19b));var _0x875d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75d8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x875d('0x0'));var util=require('util');var path=require(_0x875d('0x1'));var timeout=require(_0x875d('0x2'));var express=require(_0x875d('0x3'));var router=express[_0x875d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x875d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x875d('0x6'));router[_0x875d('0x7')]('/',auth[_0x875d('0x8')](),controller[_0x875d('0x9')]);router[_0x875d('0x7')](_0x875d('0xa'),auth['isAuthenticated'](),controller[_0x875d('0xb')]);router[_0x875d('0x7')](_0x875d('0xc'),auth[_0x875d('0x8')](),controller[_0x875d('0xd')]);router[_0x875d('0x7')](_0x875d('0xe'),auth[_0x875d('0x8')](),controller['getSubjects']);router[_0x875d('0x7')](_0x875d('0xf'),auth['isAuthenticated'](),controller[_0x875d('0x10')]);router[_0x875d('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x875d('0x12')](_0x875d('0xa'),auth[_0x875d('0x8')](),controller[_0x875d('0x13')]);router[_0x875d('0x14')]('/:id',auth[_0x875d('0x8')](),controller[_0x875d('0x15')]);module[_0x875d('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 d49fc04..03b235f 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 _0x1d1d=['sequelize','exports','STRING'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x1d1d,0xf6));var _0xd1d1=function(_0x2f3d30,_0x15fe8b){_0x2f3d30=_0x2f3d30-0x0;var _0x25c7c0=_0x1d1d[_0x2f3d30];return _0x25c7c0;};'use strict';var Sequelize=require(_0xd1d1('0x0'));module[_0xd1d1('0x1')]={'name':{'type':Sequelize[_0xd1d1('0x2')]},'description':{'type':Sequelize[_0xd1d1('0x2')]}}; \ No newline at end of file +var _0x12b4=['STRING','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x12b4,0x12d));var _0x412b=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x12b4[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x412b('0x0'));module[_0x412b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x412b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b66a2f7..a40a266 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 _0x0277=['name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options','includeAll','include','then','rows','show','params','keys','create','body','catch','find','getFields','findOne','sort','pick','getSubjects','SugarcrmField','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../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','save','update','destroy','end','error','stack'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x0277,0x1bf));var _0x7027=function(_0x3a9ee1,_0x1c9619){_0x3a9ee1=_0x3a9ee1-0x0;var _0x3d9dcc=_0x0277[_0x3a9ee1];return _0x3d9dcc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7027('0x0'));var zipdir=require(_0x7027('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7027('0x2'));var moment=require('moment');var BPromise=require(_0x7027('0x3'));var Mustache=require(_0x7027('0x4'));var util=require(_0x7027('0x5'));var path=require(_0x7027('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7027('0x7'));var fs=require('fs');var fs_extra=require(_0x7027('0x8'));var _=require(_0x7027('0x9'));var squel=require('squel');var crypto=require(_0x7027('0xa'));var jsforce=require(_0x7027('0xb'));var deskjs=require(_0x7027('0xc'));var toCsv=require(_0x7027('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7027('0xe'));var as=require(_0x7027('0xf'));var hardwareService=require(_0x7027('0x10'));var logger=require(_0x7027('0x11'))(_0x7027('0x12'));var utils=require(_0x7027('0x13'));var config=require(_0x7027('0x14'));var licenseUtil=require(_0x7027('0x15'));var db=require(_0x7027('0x16'))['db'];function respondWithStatusCode(_0x85d866,_0x58c122){_0x58c122=_0x58c122||0xcc;return function(_0x3dbb81){if(_0x3dbb81){return _0x85d866[_0x7027('0x17')](_0x58c122);}return _0x85d866['status'](_0x58c122)['end']();};}function respondWithResult(_0x213096,_0x5d649b){_0x5d649b=_0x5d649b||0xc8;return function(_0x44dd76){if(_0x44dd76){return _0x213096[_0x7027('0x18')](_0x5d649b)[_0x7027('0x19')](_0x44dd76);}};}function respondWithFilteredResult(_0xedeb02,_0x4e4383){return function(_0x4f25da){if(_0x4f25da){var _0x346031=typeof _0x4e4383[_0x7027('0x1a')]===_0x7027('0x1b')&&typeof _0x4e4383[_0x7027('0x1c')]===_0x7027('0x1b');var _0x4e7277=_0x4f25da[_0x7027('0x1d')];var _0x4ecf39=_0x346031?0x0:_0x4e4383['offset'];var _0x42dd49=_0x346031?_0x4f25da[_0x7027('0x1d')]:_0x4e4383['offset']+_0x4e4383[_0x7027('0x1c')];var _0x4cd0e3;if(_0x42dd49>=_0x4e7277){_0x42dd49=_0x4e7277;_0x4cd0e3=0xc8;}else{_0x4cd0e3=0xce;}_0xedeb02[_0x7027('0x18')](_0x4cd0e3);return _0xedeb02[_0x7027('0x1e')](_0x7027('0x1f'),_0x4ecf39+'-'+_0x42dd49+'/'+_0x4e7277)[_0x7027('0x19')](_0x4f25da);}return null;};}function patchUpdates(_0x2feeb0){return function(_0x41e837){try{jsonpatch[_0x7027('0x20')](_0x41e837,_0x2feeb0,!![]);}catch(_0x5c49d7){return BPromise['reject'](_0x5c49d7);}return _0x41e837[_0x7027('0x21')]();};}function saveUpdates(_0x3e18db,_0x5f4b8f){return function(_0x5a7455){if(_0x5a7455){return _0x5a7455[_0x7027('0x22')](_0x3e18db)['then'](function(_0x790113){return _0x790113;});}return null;};}function removeEntity(_0x26b37e,_0x3ad4a1){return function(_0x9c6801){if(_0x9c6801){return _0x9c6801[_0x7027('0x23')]()['then'](function(){_0x26b37e[_0x7027('0x18')](0xcc)[_0x7027('0x24')]();});}};}function handleEntityNotFound(_0x41ed1,_0x2f1311){return function(_0x3eaf3c){if(!_0x3eaf3c){_0x41ed1[_0x7027('0x17')](0x194);}return _0x3eaf3c;};}function handleError(_0x2fe766,_0x509409){_0x509409=_0x509409||0x1f4;return function(_0x5bbac2){logger[_0x7027('0x25')](_0x5bbac2[_0x7027('0x26')]);if(_0x5bbac2[_0x7027('0x27')]){delete _0x5bbac2[_0x7027('0x27')];}_0x2fe766[_0x7027('0x18')](_0x509409)[_0x7027('0x28')](_0x5bbac2);};}exports[_0x7027('0x29')]=function(_0x583eed,_0xb701cf){var _0x3040e3={},_0x32754={},_0x24ec6b={'count':0x0,'rows':[]};var _0x3a018f=_[_0x7027('0x2a')](db[_0x7027('0x2b')][_0x7027('0x2c')],function(_0x58d5ed){return{'name':_0x58d5ed[_0x7027('0x2d')],'type':_0x58d5ed[_0x7027('0x2e')][_0x7027('0x2f')]};});_0x32754[_0x7027('0x30')]=_['map'](_0x3a018f,_0x7027('0x27'));_0x32754[_0x7027('0x31')]=_['keys'](_0x583eed[_0x7027('0x31')]);_0x32754[_0x7027('0x32')]=_[_0x7027('0x33')](_0x32754[_0x7027('0x30')],_0x32754['query']);_0x3040e3['attributes']=_[_0x7027('0x33')](_0x32754[_0x7027('0x30')],qs[_0x7027('0x34')](_0x583eed[_0x7027('0x31')]['fields']));_0x3040e3[_0x7027('0x35')]=_0x3040e3[_0x7027('0x35')][_0x7027('0x36')]?_0x3040e3[_0x7027('0x35')]:_0x32754[_0x7027('0x30')];if(!_0x583eed[_0x7027('0x31')][_0x7027('0x37')](_0x7027('0x38'))){_0x3040e3[_0x7027('0x1c')]=qs[_0x7027('0x1c')](_0x583eed[_0x7027('0x31')][_0x7027('0x1c')]);_0x3040e3[_0x7027('0x1a')]=qs[_0x7027('0x1a')](_0x583eed[_0x7027('0x31')][_0x7027('0x1a')]);}_0x3040e3[_0x7027('0x39')]=qs['sort'](_0x583eed[_0x7027('0x31')]['sort']);_0x3040e3[_0x7027('0x3a')]=qs['filters'](_['pick'](_0x583eed[_0x7027('0x31')],_0x32754['filters']),_0x3a018f);if(_0x583eed[_0x7027('0x31')][_0x7027('0x3b')]){_0x3040e3[_0x7027('0x3a')]=_['merge'](_0x3040e3[_0x7027('0x3a')],{'$or':_[_0x7027('0x2a')](_0x3a018f,function(_0x29d0a3){if(_0x29d0a3['type']!==_0x7027('0x3c')){var _0x4fb9f2={};_0x4fb9f2[_0x29d0a3[_0x7027('0x27')]]={'$like':'%'+_0x583eed[_0x7027('0x31')][_0x7027('0x3b')]+'%'};return _0x4fb9f2;}})});}_0x3040e3=_[_0x7027('0x3d')]({},_0x3040e3,_0x583eed[_0x7027('0x3e')]);var _0x39a160={'where':_0x3040e3[_0x7027('0x3a')]};return db[_0x7027('0x2b')][_0x7027('0x1d')](_0x39a160)['then'](function(_0x5a0a7a){_0x24ec6b[_0x7027('0x1d')]=_0x5a0a7a;if(_0x583eed[_0x7027('0x31')][_0x7027('0x3f')]){_0x3040e3[_0x7027('0x40')]=[{'all':!![]}];}return db[_0x7027('0x2b')]['findAll'](_0x3040e3);})[_0x7027('0x41')](function(_0x2d8a99){_0x24ec6b[_0x7027('0x42')]=_0x2d8a99;return _0x24ec6b;})[_0x7027('0x41')](respondWithFilteredResult(_0xb701cf,_0x3040e3))['catch'](handleError(_0xb701cf,null));};exports[_0x7027('0x43')]=function(_0x51bb78,_0x22fad4){var _0x13ce32={'raw':![],'where':{'id':_0x51bb78[_0x7027('0x44')]['id']}},_0x50f72f={};_0x50f72f['model']=_[_0x7027('0x45')](db[_0x7027('0x2b')][_0x7027('0x2c')]);_0x50f72f[_0x7027('0x31')]=_[_0x7027('0x45')](_0x51bb78[_0x7027('0x31')]);_0x50f72f[_0x7027('0x32')]=_[_0x7027('0x33')](_0x50f72f[_0x7027('0x30')],_0x50f72f[_0x7027('0x31')]);_0x13ce32[_0x7027('0x35')]=_[_0x7027('0x33')](_0x50f72f[_0x7027('0x30')],qs['fields'](_0x51bb78[_0x7027('0x31')][_0x7027('0x34')]));_0x13ce32[_0x7027('0x35')]=_0x13ce32[_0x7027('0x35')][_0x7027('0x36')]?_0x13ce32[_0x7027('0x35')]:_0x50f72f['model'];if(_0x51bb78[_0x7027('0x31')][_0x7027('0x3f')]){_0x13ce32[_0x7027('0x40')]=[{'all':!![]}];}_0x13ce32=_['merge']({},_0x13ce32,_0x51bb78[_0x7027('0x3e')]);return db['SugarcrmConfiguration']['find'](_0x13ce32)[_0x7027('0x41')](handleEntityNotFound(_0x22fad4,null))['then'](respondWithResult(_0x22fad4,null))['catch'](handleError(_0x22fad4,null));};exports[_0x7027('0x46')]=function(_0x5752c3,_0x592df8){return db[_0x7027('0x2b')][_0x7027('0x46')](_0x5752c3[_0x7027('0x47')],{})['then'](respondWithResult(_0x592df8,0xc9))[_0x7027('0x48')](handleError(_0x592df8,null));};exports[_0x7027('0x22')]=function(_0x3a4130,_0x3affaa){if(_0x3a4130[_0x7027('0x47')]['id']){delete _0x3a4130['body']['id'];}return db['SugarcrmConfiguration'][_0x7027('0x49')]({'where':{'id':_0x3a4130[_0x7027('0x44')]['id']}})[_0x7027('0x41')](handleEntityNotFound(_0x3affaa,null))[_0x7027('0x41')](saveUpdates(_0x3a4130[_0x7027('0x47')],null))[_0x7027('0x41')](respondWithResult(_0x3affaa,null))[_0x7027('0x48')](handleError(_0x3affaa,null));};exports[_0x7027('0x23')]=function(_0x221ca6,_0x101957){return db['SugarcrmConfiguration'][_0x7027('0x49')]({'where':{'id':_0x221ca6['params']['id']}})['then'](handleEntityNotFound(_0x101957,null))[_0x7027('0x41')](removeEntity(_0x101957,null))[_0x7027('0x48')](handleError(_0x101957,null));};exports[_0x7027('0x4a')]=function(_0x25aa95,_0x595efc,_0x506d09){var _0x36dea3={};var _0x5841c7={};var _0x46aa7e;var _0x4c1fc9;return db[_0x7027('0x2b')][_0x7027('0x4b')]({'where':{'id':_0x25aa95['params']['id']}})[_0x7027('0x41')](handleEntityNotFound(_0x595efc,null))[_0x7027('0x41')](function(_0x7f9385){if(_0x7f9385){_0x46aa7e=_0x7f9385;_0x5841c7['model']=_[_0x7027('0x45')](db['SugarcrmField'][_0x7027('0x2c')]);_0x5841c7['query']=_[_0x7027('0x45')](_0x25aa95[_0x7027('0x31')]);_0x5841c7[_0x7027('0x32')]=_[_0x7027('0x33')](_0x5841c7['model'],_0x5841c7['query']);_0x36dea3['attributes']=_[_0x7027('0x33')](_0x5841c7[_0x7027('0x30')],qs[_0x7027('0x34')](_0x25aa95[_0x7027('0x31')]['fields']));_0x36dea3[_0x7027('0x35')]=_0x36dea3[_0x7027('0x35')]['length']?_0x36dea3[_0x7027('0x35')]:_0x5841c7[_0x7027('0x30')];_0x36dea3[_0x7027('0x39')]=qs[_0x7027('0x4c')](_0x25aa95['query'][_0x7027('0x4c')]);_0x36dea3[_0x7027('0x3a')]=qs['filters'](_[_0x7027('0x4d')](_0x25aa95['query'],_0x5841c7[_0x7027('0x32')]));if(_0x25aa95[_0x7027('0x31')][_0x7027('0x3b')]){_0x36dea3[_0x7027('0x3a')]=_[_0x7027('0x3d')](_0x36dea3[_0x7027('0x3a')],{'$or':_[_0x7027('0x2a')](_0x36dea3[_0x7027('0x35')],function(_0x56862d){var _0x15ac3a={};_0x15ac3a[_0x56862d]={'$like':'%'+_0x25aa95[_0x7027('0x31')][_0x7027('0x3b')]+'%'};return _0x15ac3a;})});}_0x36dea3=_[_0x7027('0x3d')]({},_0x36dea3,_0x25aa95[_0x7027('0x3e')]);return _0x46aa7e['getFields'](_0x36dea3);}})['then'](function(_0x20f484){if(_0x20f484){_0x4c1fc9=_0x20f484[_0x7027('0x36')];if(!_0x25aa95[_0x7027('0x31')][_0x7027('0x37')](_0x7027('0x38'))){_0x36dea3[_0x7027('0x1c')]=qs[_0x7027('0x1c')](_0x25aa95[_0x7027('0x31')][_0x7027('0x1c')]);_0x36dea3[_0x7027('0x1a')]=qs['offset'](_0x25aa95[_0x7027('0x31')]['offset']);}return _0x46aa7e[_0x7027('0x4a')](_0x36dea3);}})[_0x7027('0x41')](function(_0xd9d15b){if(_0xd9d15b){return _0xd9d15b?{'count':_0x4c1fc9,'rows':_0xd9d15b}:null;}})[_0x7027('0x41')](respondWithResult(_0x595efc,null))[_0x7027('0x48')](handleError(_0x595efc,null));};exports[_0x7027('0x4e')]=function(_0x2353ff,_0x441a94,_0x834ec5){var _0x30e307={};var _0x269112={};var _0x12d5bd;var _0x42a060;return db[_0x7027('0x2b')][_0x7027('0x4b')]({'where':{'id':_0x2353ff[_0x7027('0x44')]['id']}})[_0x7027('0x41')](handleEntityNotFound(_0x441a94,null))[_0x7027('0x41')](function(_0x276150){if(_0x276150){_0x12d5bd=_0x276150;_0x269112[_0x7027('0x30')]=_[_0x7027('0x45')](db[_0x7027('0x4f')][_0x7027('0x2c')]);_0x269112[_0x7027('0x31')]=_['keys'](_0x2353ff[_0x7027('0x31')]);_0x269112['filters']=_[_0x7027('0x33')](_0x269112[_0x7027('0x30')],_0x269112['query']);_0x30e307['attributes']=_[_0x7027('0x33')](_0x269112[_0x7027('0x30')],qs[_0x7027('0x34')](_0x2353ff[_0x7027('0x31')][_0x7027('0x34')]));_0x30e307[_0x7027('0x35')]=_0x30e307[_0x7027('0x35')][_0x7027('0x36')]?_0x30e307[_0x7027('0x35')]:_0x269112[_0x7027('0x30')];_0x30e307[_0x7027('0x39')]=qs[_0x7027('0x4c')](_0x2353ff[_0x7027('0x31')][_0x7027('0x4c')]);_0x30e307['where']=qs[_0x7027('0x32')](_[_0x7027('0x4d')](_0x2353ff[_0x7027('0x31')],_0x269112['filters']));if(_0x2353ff[_0x7027('0x31')][_0x7027('0x3b')]){_0x30e307[_0x7027('0x3a')]=_[_0x7027('0x3d')](_0x30e307['where'],{'$or':_[_0x7027('0x2a')](_0x30e307[_0x7027('0x35')],function(_0x40607a){var _0x216d9b={};_0x216d9b[_0x40607a]={'$like':'%'+_0x2353ff[_0x7027('0x31')]['filter']+'%'};return _0x216d9b;})});}_0x30e307=_['merge']({},_0x30e307,_0x2353ff['options']);return _0x12d5bd['getSubjects'](_0x30e307);}})[_0x7027('0x41')](function(_0x2880da){if(_0x2880da){_0x42a060=_0x2880da[_0x7027('0x36')];if(!_0x2353ff[_0x7027('0x31')][_0x7027('0x37')](_0x7027('0x38'))){_0x30e307[_0x7027('0x1c')]=qs[_0x7027('0x1c')](_0x2353ff[_0x7027('0x31')][_0x7027('0x1c')]);_0x30e307[_0x7027('0x1a')]=qs[_0x7027('0x1a')](_0x2353ff['query']['offset']);}return _0x12d5bd[_0x7027('0x4e')](_0x30e307);}})[_0x7027('0x41')](function(_0x21f1bf){if(_0x21f1bf){return _0x21f1bf?{'count':_0x42a060,'rows':_0x21f1bf}:null;}})[_0x7027('0x41')](respondWithResult(_0x441a94,null))[_0x7027('0x48')](handleError(_0x441a94,null));};exports['getDescriptions']=function(_0x3d909c,_0x36a193,_0x10fce6){var _0xcc5f65={};var _0x5b17ca={};var _0x3e8948;var _0xf3d5e6;return db[_0x7027('0x2b')][_0x7027('0x4b')]({'where':{'id':_0x3d909c[_0x7027('0x44')]['id']}})['then'](handleEntityNotFound(_0x36a193,null))['then'](function(_0x1c8c38){if(_0x1c8c38){_0x3e8948=_0x1c8c38;_0x5b17ca[_0x7027('0x30')]=_[_0x7027('0x45')](db[_0x7027('0x4f')]['rawAttributes']);_0x5b17ca[_0x7027('0x31')]=_['keys'](_0x3d909c[_0x7027('0x31')]);_0x5b17ca[_0x7027('0x32')]=_[_0x7027('0x33')](_0x5b17ca[_0x7027('0x30')],_0x5b17ca['query']);_0xcc5f65[_0x7027('0x35')]=_[_0x7027('0x33')](_0x5b17ca[_0x7027('0x30')],qs[_0x7027('0x34')](_0x3d909c[_0x7027('0x31')][_0x7027('0x34')]));_0xcc5f65[_0x7027('0x35')]=_0xcc5f65[_0x7027('0x35')]['length']?_0xcc5f65[_0x7027('0x35')]:_0x5b17ca[_0x7027('0x30')];_0xcc5f65[_0x7027('0x39')]=qs[_0x7027('0x4c')](_0x3d909c['query'][_0x7027('0x4c')]);_0xcc5f65[_0x7027('0x3a')]=qs['filters'](_['pick'](_0x3d909c[_0x7027('0x31')],_0x5b17ca[_0x7027('0x32')]));if(_0x3d909c[_0x7027('0x31')]['filter']){_0xcc5f65[_0x7027('0x3a')]=_['merge'](_0xcc5f65[_0x7027('0x3a')],{'$or':_[_0x7027('0x2a')](_0xcc5f65[_0x7027('0x35')],function(_0x273054){var _0x24b4ef={};_0x24b4ef[_0x273054]={'$like':'%'+_0x3d909c[_0x7027('0x31')]['filter']+'%'};return _0x24b4ef;})});}_0xcc5f65=_[_0x7027('0x3d')]({},_0xcc5f65,_0x3d909c['options']);return _0x3e8948[_0x7027('0x50')](_0xcc5f65);}})['then'](function(_0xb86604){if(_0xb86604){_0xf3d5e6=_0xb86604['length'];if(!_0x3d909c[_0x7027('0x31')][_0x7027('0x37')](_0x7027('0x38'))){_0xcc5f65[_0x7027('0x1c')]=qs[_0x7027('0x1c')](_0x3d909c[_0x7027('0x31')][_0x7027('0x1c')]);_0xcc5f65[_0x7027('0x1a')]=qs[_0x7027('0x1a')](_0x3d909c[_0x7027('0x31')][_0x7027('0x1a')]);}return _0x3e8948['getDescriptions'](_0xcc5f65);}})[_0x7027('0x41')](function(_0x506327){if(_0x506327){return _0x506327?{'count':_0xf3d5e6,'rows':_0x506327}:null;}})[_0x7027('0x41')](respondWithResult(_0x36a193,null))[_0x7027('0x48')](handleError(_0x36a193,null));}; \ No newline at end of file +var _0xc4b9=['error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','catch','params','keys','find','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x49bca7,_0x597584){var _0x1f24c9=function(_0x4fccdf){while(--_0x4fccdf){_0x49bca7['push'](_0x49bca7['shift']());}};_0x1f24c9(++_0x597584);}(_0xc4b9,0xc3));var _0x9c4b=function(_0x20e061,_0x9cc9ff){_0x20e061=_0x20e061-0x0;var _0xae559d=_0xc4b9[_0x20e061];return _0xae559d;};'use strict';var emlformat=require(_0x9c4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c4b('0x1'));var jsonpatch=require(_0x9c4b('0x2'));var rp=require('request-promise');var moment=require(_0x9c4b('0x3'));var BPromise=require(_0x9c4b('0x4'));var Mustache=require(_0x9c4b('0x5'));var util=require('util');var path=require(_0x9c4b('0x6'));var sox=require(_0x9c4b('0x7'));var csv=require(_0x9c4b('0x8'));var ejs=require(_0x9c4b('0x9'));var fs=require('fs');var fs_extra=require(_0x9c4b('0xa'));var _=require(_0x9c4b('0xb'));var squel=require(_0x9c4b('0xc'));var crypto=require('crypto');var jsforce=require(_0x9c4b('0xd'));var deskjs=require(_0x9c4b('0xe'));var toCsv=require(_0x9c4b('0x8'));var querystring=require(_0x9c4b('0xf'));var Papa=require('papaparse');var Redis=require(_0x9c4b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c4b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c4b('0x12'));var utils=require(_0x9c4b('0x13'));var config=require(_0x9c4b('0x14'));var licenseUtil=require(_0x9c4b('0x15'));var db=require(_0x9c4b('0x16'))['db'];function respondWithStatusCode(_0x3ebbd3,_0x343c52){_0x343c52=_0x343c52||0xcc;return function(_0x1f0d2c){if(_0x1f0d2c){return _0x3ebbd3[_0x9c4b('0x17')](_0x343c52);}return _0x3ebbd3[_0x9c4b('0x18')](_0x343c52)[_0x9c4b('0x19')]();};}function respondWithResult(_0x1bd431,_0x1c5f08){_0x1c5f08=_0x1c5f08||0xc8;return function(_0x657d6d){if(_0x657d6d){return _0x1bd431[_0x9c4b('0x18')](_0x1c5f08)[_0x9c4b('0x1a')](_0x657d6d);}};}function respondWithFilteredResult(_0x1dd1c4,_0x3b65fe){return function(_0x28d0ae){if(_0x28d0ae){var _0x4db169=typeof _0x3b65fe[_0x9c4b('0x1b')]===_0x9c4b('0x1c')&&typeof _0x3b65fe[_0x9c4b('0x1d')]===_0x9c4b('0x1c');var _0x3806b0=_0x28d0ae[_0x9c4b('0x1e')];var _0x43df1a=_0x4db169?0x0:_0x3b65fe[_0x9c4b('0x1b')];var _0x43c05c=_0x4db169?_0x28d0ae[_0x9c4b('0x1e')]:_0x3b65fe[_0x9c4b('0x1b')]+_0x3b65fe[_0x9c4b('0x1d')];var _0x419b09;if(_0x43c05c>=_0x3806b0){_0x43c05c=_0x3806b0;_0x419b09=0xc8;}else{_0x419b09=0xce;}_0x1dd1c4['status'](_0x419b09);return _0x1dd1c4[_0x9c4b('0x1f')](_0x9c4b('0x20'),_0x43df1a+'-'+_0x43c05c+'/'+_0x3806b0)['json'](_0x28d0ae);}return null;};}function patchUpdates(_0x4914eb){return function(_0x4df828){try{jsonpatch[_0x9c4b('0x21')](_0x4df828,_0x4914eb,!![]);}catch(_0x30337c){return BPromise[_0x9c4b('0x22')](_0x30337c);}return _0x4df828[_0x9c4b('0x23')]();};}function saveUpdates(_0x35716d,_0x5ef1cf){return function(_0x22e316){if(_0x22e316){return _0x22e316[_0x9c4b('0x24')](_0x35716d)[_0x9c4b('0x25')](function(_0x46b7bc){return _0x46b7bc;});}return null;};}function removeEntity(_0x1e599e,_0x148089){return function(_0x4cb56b){if(_0x4cb56b){return _0x4cb56b[_0x9c4b('0x26')]()[_0x9c4b('0x25')](function(){_0x1e599e['status'](0xcc)[_0x9c4b('0x19')]();});}};}function handleEntityNotFound(_0x55cfd3,_0x1f423f){return function(_0x1f7453){if(!_0x1f7453){_0x55cfd3[_0x9c4b('0x17')](0x194);}return _0x1f7453;};}function handleError(_0x45e859,_0x5ac207){_0x5ac207=_0x5ac207||0x1f4;return function(_0xa24603){logger[_0x9c4b('0x27')](_0xa24603[_0x9c4b('0x28')]);if(_0xa24603[_0x9c4b('0x29')]){delete _0xa24603[_0x9c4b('0x29')];}_0x45e859[_0x9c4b('0x18')](_0x5ac207)[_0x9c4b('0x2a')](_0xa24603);};}exports[_0x9c4b('0x2b')]=function(_0x57c4b4,_0x57893b){var _0x58680c={},_0x2e736c={},_0x750eda={'count':0x0,'rows':[]};var _0x2f94b3=_['map'](db[_0x9c4b('0x2c')][_0x9c4b('0x2d')],function(_0x5bff97){return{'name':_0x5bff97[_0x9c4b('0x2e')],'type':_0x5bff97[_0x9c4b('0x2f')][_0x9c4b('0x30')]};});_0x2e736c[_0x9c4b('0x31')]=_[_0x9c4b('0x32')](_0x2f94b3,'name');_0x2e736c[_0x9c4b('0x33')]=_['keys'](_0x57c4b4[_0x9c4b('0x33')]);_0x2e736c[_0x9c4b('0x34')]=_['intersection'](_0x2e736c['model'],_0x2e736c[_0x9c4b('0x33')]);_0x58680c[_0x9c4b('0x35')]=_[_0x9c4b('0x36')](_0x2e736c[_0x9c4b('0x31')],qs['fields'](_0x57c4b4[_0x9c4b('0x33')][_0x9c4b('0x37')]));_0x58680c['attributes']=_0x58680c[_0x9c4b('0x35')][_0x9c4b('0x38')]?_0x58680c[_0x9c4b('0x35')]:_0x2e736c[_0x9c4b('0x31')];if(!_0x57c4b4[_0x9c4b('0x33')][_0x9c4b('0x39')](_0x9c4b('0x3a'))){_0x58680c[_0x9c4b('0x1d')]=qs[_0x9c4b('0x1d')](_0x57c4b4[_0x9c4b('0x33')][_0x9c4b('0x1d')]);_0x58680c[_0x9c4b('0x1b')]=qs[_0x9c4b('0x1b')](_0x57c4b4['query'][_0x9c4b('0x1b')]);}_0x58680c[_0x9c4b('0x3b')]=qs[_0x9c4b('0x3c')](_0x57c4b4[_0x9c4b('0x33')][_0x9c4b('0x3c')]);_0x58680c['where']=qs[_0x9c4b('0x34')](_[_0x9c4b('0x3d')](_0x57c4b4[_0x9c4b('0x33')],_0x2e736c[_0x9c4b('0x34')]),_0x2f94b3);if(_0x57c4b4[_0x9c4b('0x33')][_0x9c4b('0x3e')]){_0x58680c['where']=_[_0x9c4b('0x3f')](_0x58680c[_0x9c4b('0x40')],{'$or':_[_0x9c4b('0x32')](_0x2f94b3,function(_0x4f9097){if(_0x4f9097[_0x9c4b('0x2f')]!=='VIRTUAL'){var _0x191f37={};_0x191f37[_0x4f9097['name']]={'$like':'%'+_0x57c4b4['query'][_0x9c4b('0x3e')]+'%'};return _0x191f37;}})});}_0x58680c=_['merge']({},_0x58680c,_0x57c4b4[_0x9c4b('0x41')]);var _0x4f780d={'where':_0x58680c['where']};return db[_0x9c4b('0x2c')]['count'](_0x4f780d)[_0x9c4b('0x25')](function(_0x3cb16b){_0x750eda[_0x9c4b('0x1e')]=_0x3cb16b;if(_0x57c4b4[_0x9c4b('0x33')][_0x9c4b('0x42')]){_0x58680c[_0x9c4b('0x43')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x58680c);})['then'](function(_0xa7b82e){_0x750eda['rows']=_0xa7b82e;return _0x750eda;})[_0x9c4b('0x25')](respondWithFilteredResult(_0x57893b,_0x58680c))[_0x9c4b('0x44')](handleError(_0x57893b,null));};exports['show']=function(_0x238274,_0x5ce0bb){var _0x3fff05={'raw':![],'where':{'id':_0x238274[_0x9c4b('0x45')]['id']}},_0x1c9788={};_0x1c9788[_0x9c4b('0x31')]=_['keys'](db['SugarcrmConfiguration'][_0x9c4b('0x2d')]);_0x1c9788[_0x9c4b('0x33')]=_[_0x9c4b('0x46')](_0x238274['query']);_0x1c9788['filters']=_[_0x9c4b('0x36')](_0x1c9788[_0x9c4b('0x31')],_0x1c9788[_0x9c4b('0x33')]);_0x3fff05['attributes']=_[_0x9c4b('0x36')](_0x1c9788[_0x9c4b('0x31')],qs[_0x9c4b('0x37')](_0x238274[_0x9c4b('0x33')][_0x9c4b('0x37')]));_0x3fff05['attributes']=_0x3fff05[_0x9c4b('0x35')]['length']?_0x3fff05['attributes']:_0x1c9788['model'];if(_0x238274[_0x9c4b('0x33')][_0x9c4b('0x42')]){_0x3fff05['include']=[{'all':!![]}];}_0x3fff05=_['merge']({},_0x3fff05,_0x238274[_0x9c4b('0x41')]);return db[_0x9c4b('0x2c')][_0x9c4b('0x47')](_0x3fff05)[_0x9c4b('0x25')](handleEntityNotFound(_0x5ce0bb,null))[_0x9c4b('0x25')](respondWithResult(_0x5ce0bb,null))['catch'](handleError(_0x5ce0bb,null));};exports['create']=function(_0x53d4b8,_0x8c8e2d){return db[_0x9c4b('0x2c')]['create'](_0x53d4b8[_0x9c4b('0x48')],{})[_0x9c4b('0x25')](respondWithResult(_0x8c8e2d,0xc9))[_0x9c4b('0x44')](handleError(_0x8c8e2d,null));};exports[_0x9c4b('0x24')]=function(_0x2b15c2,_0x5582dd){if(_0x2b15c2['body']['id']){delete _0x2b15c2[_0x9c4b('0x48')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2b15c2[_0x9c4b('0x45')]['id']}})[_0x9c4b('0x25')](handleEntityNotFound(_0x5582dd,null))['then'](saveUpdates(_0x2b15c2[_0x9c4b('0x48')],null))['then'](respondWithResult(_0x5582dd,null))[_0x9c4b('0x44')](handleError(_0x5582dd,null));};exports['destroy']=function(_0x281ea7,_0x3f1ee7){return db['SugarcrmConfiguration'][_0x9c4b('0x47')]({'where':{'id':_0x281ea7[_0x9c4b('0x45')]['id']}})[_0x9c4b('0x25')](handleEntityNotFound(_0x3f1ee7,null))['then'](removeEntity(_0x3f1ee7,null))[_0x9c4b('0x44')](handleError(_0x3f1ee7,null));};exports[_0x9c4b('0x49')]=function(_0x16dcfa,_0x2f9d55,_0x1e9550){var _0x5b0175={};var _0xe3d9ff={};var _0x3ae31a;var _0x286d0f;return db[_0x9c4b('0x2c')][_0x9c4b('0x4a')]({'where':{'id':_0x16dcfa[_0x9c4b('0x45')]['id']}})[_0x9c4b('0x25')](handleEntityNotFound(_0x2f9d55,null))['then'](function(_0x5d18a3){if(_0x5d18a3){_0x3ae31a=_0x5d18a3;_0xe3d9ff[_0x9c4b('0x31')]=_[_0x9c4b('0x46')](db[_0x9c4b('0x4b')][_0x9c4b('0x2d')]);_0xe3d9ff[_0x9c4b('0x33')]=_[_0x9c4b('0x46')](_0x16dcfa[_0x9c4b('0x33')]);_0xe3d9ff[_0x9c4b('0x34')]=_[_0x9c4b('0x36')](_0xe3d9ff['model'],_0xe3d9ff['query']);_0x5b0175[_0x9c4b('0x35')]=_[_0x9c4b('0x36')](_0xe3d9ff[_0x9c4b('0x31')],qs['fields'](_0x16dcfa[_0x9c4b('0x33')][_0x9c4b('0x37')]));_0x5b0175[_0x9c4b('0x35')]=_0x5b0175[_0x9c4b('0x35')][_0x9c4b('0x38')]?_0x5b0175['attributes']:_0xe3d9ff[_0x9c4b('0x31')];_0x5b0175['order']=qs[_0x9c4b('0x3c')](_0x16dcfa['query'][_0x9c4b('0x3c')]);_0x5b0175[_0x9c4b('0x40')]=qs[_0x9c4b('0x34')](_['pick'](_0x16dcfa[_0x9c4b('0x33')],_0xe3d9ff[_0x9c4b('0x34')]));if(_0x16dcfa[_0x9c4b('0x33')][_0x9c4b('0x3e')]){_0x5b0175[_0x9c4b('0x40')]=_[_0x9c4b('0x3f')](_0x5b0175[_0x9c4b('0x40')],{'$or':_[_0x9c4b('0x32')](_0x5b0175['attributes'],function(_0x354b45){var _0xc43f88={};_0xc43f88[_0x354b45]={'$like':'%'+_0x16dcfa[_0x9c4b('0x33')][_0x9c4b('0x3e')]+'%'};return _0xc43f88;})});}_0x5b0175=_[_0x9c4b('0x3f')]({},_0x5b0175,_0x16dcfa[_0x9c4b('0x41')]);return _0x3ae31a[_0x9c4b('0x49')](_0x5b0175);}})['then'](function(_0x421b8d){if(_0x421b8d){_0x286d0f=_0x421b8d['length'];if(!_0x16dcfa['query'][_0x9c4b('0x39')](_0x9c4b('0x3a'))){_0x5b0175[_0x9c4b('0x1d')]=qs[_0x9c4b('0x1d')](_0x16dcfa[_0x9c4b('0x33')][_0x9c4b('0x1d')]);_0x5b0175[_0x9c4b('0x1b')]=qs[_0x9c4b('0x1b')](_0x16dcfa['query']['offset']);}return _0x3ae31a[_0x9c4b('0x49')](_0x5b0175);}})[_0x9c4b('0x25')](function(_0x48910f){if(_0x48910f){return _0x48910f?{'count':_0x286d0f,'rows':_0x48910f}:null;}})[_0x9c4b('0x25')](respondWithResult(_0x2f9d55,null))[_0x9c4b('0x44')](handleError(_0x2f9d55,null));};exports['getSubjects']=function(_0x138d68,_0x17d6a5,_0x4f280d){var _0x21c6c3={};var _0x16b2a7={};var _0x4afcb7;var _0x1fa31b;return db[_0x9c4b('0x2c')]['findOne']({'where':{'id':_0x138d68['params']['id']}})[_0x9c4b('0x25')](handleEntityNotFound(_0x17d6a5,null))[_0x9c4b('0x25')](function(_0x3a58ff){if(_0x3a58ff){_0x4afcb7=_0x3a58ff;_0x16b2a7['model']=_[_0x9c4b('0x46')](db[_0x9c4b('0x4b')][_0x9c4b('0x2d')]);_0x16b2a7['query']=_[_0x9c4b('0x46')](_0x138d68['query']);_0x16b2a7['filters']=_[_0x9c4b('0x36')](_0x16b2a7[_0x9c4b('0x31')],_0x16b2a7['query']);_0x21c6c3[_0x9c4b('0x35')]=_[_0x9c4b('0x36')](_0x16b2a7[_0x9c4b('0x31')],qs[_0x9c4b('0x37')](_0x138d68[_0x9c4b('0x33')][_0x9c4b('0x37')]));_0x21c6c3['attributes']=_0x21c6c3[_0x9c4b('0x35')][_0x9c4b('0x38')]?_0x21c6c3['attributes']:_0x16b2a7[_0x9c4b('0x31')];_0x21c6c3[_0x9c4b('0x3b')]=qs[_0x9c4b('0x3c')](_0x138d68['query'][_0x9c4b('0x3c')]);_0x21c6c3['where']=qs[_0x9c4b('0x34')](_[_0x9c4b('0x3d')](_0x138d68['query'],_0x16b2a7[_0x9c4b('0x34')]));if(_0x138d68[_0x9c4b('0x33')][_0x9c4b('0x3e')]){_0x21c6c3[_0x9c4b('0x40')]=_[_0x9c4b('0x3f')](_0x21c6c3[_0x9c4b('0x40')],{'$or':_[_0x9c4b('0x32')](_0x21c6c3['attributes'],function(_0x31f125){var _0x1c745f={};_0x1c745f[_0x31f125]={'$like':'%'+_0x138d68[_0x9c4b('0x33')]['filter']+'%'};return _0x1c745f;})});}_0x21c6c3=_['merge']({},_0x21c6c3,_0x138d68[_0x9c4b('0x41')]);return _0x4afcb7['getSubjects'](_0x21c6c3);}})[_0x9c4b('0x25')](function(_0x290284){if(_0x290284){_0x1fa31b=_0x290284[_0x9c4b('0x38')];if(!_0x138d68['query']['hasOwnProperty'](_0x9c4b('0x3a'))){_0x21c6c3[_0x9c4b('0x1d')]=qs[_0x9c4b('0x1d')](_0x138d68['query'][_0x9c4b('0x1d')]);_0x21c6c3[_0x9c4b('0x1b')]=qs[_0x9c4b('0x1b')](_0x138d68[_0x9c4b('0x33')][_0x9c4b('0x1b')]);}return _0x4afcb7[_0x9c4b('0x4c')](_0x21c6c3);}})[_0x9c4b('0x25')](function(_0x2e720e){if(_0x2e720e){return _0x2e720e?{'count':_0x1fa31b,'rows':_0x2e720e}:null;}})['then'](respondWithResult(_0x17d6a5,null))[_0x9c4b('0x44')](handleError(_0x17d6a5,null));};exports[_0x9c4b('0x4d')]=function(_0xa2ad40,_0x31197b,_0x34a94f){var _0x5cba94={};var _0x1bbcb3={};var _0x34d7a2;var _0x6bfef2;return db[_0x9c4b('0x2c')][_0x9c4b('0x4a')]({'where':{'id':_0xa2ad40[_0x9c4b('0x45')]['id']}})[_0x9c4b('0x25')](handleEntityNotFound(_0x31197b,null))[_0x9c4b('0x25')](function(_0x58056f){if(_0x58056f){_0x34d7a2=_0x58056f;_0x1bbcb3[_0x9c4b('0x31')]=_[_0x9c4b('0x46')](db['SugarcrmField'][_0x9c4b('0x2d')]);_0x1bbcb3[_0x9c4b('0x33')]=_['keys'](_0xa2ad40[_0x9c4b('0x33')]);_0x1bbcb3[_0x9c4b('0x34')]=_[_0x9c4b('0x36')](_0x1bbcb3['model'],_0x1bbcb3[_0x9c4b('0x33')]);_0x5cba94['attributes']=_[_0x9c4b('0x36')](_0x1bbcb3['model'],qs[_0x9c4b('0x37')](_0xa2ad40[_0x9c4b('0x33')][_0x9c4b('0x37')]));_0x5cba94['attributes']=_0x5cba94[_0x9c4b('0x35')]['length']?_0x5cba94[_0x9c4b('0x35')]:_0x1bbcb3['model'];_0x5cba94[_0x9c4b('0x3b')]=qs[_0x9c4b('0x3c')](_0xa2ad40[_0x9c4b('0x33')][_0x9c4b('0x3c')]);_0x5cba94[_0x9c4b('0x40')]=qs[_0x9c4b('0x34')](_[_0x9c4b('0x3d')](_0xa2ad40[_0x9c4b('0x33')],_0x1bbcb3[_0x9c4b('0x34')]));if(_0xa2ad40[_0x9c4b('0x33')][_0x9c4b('0x3e')]){_0x5cba94[_0x9c4b('0x40')]=_['merge'](_0x5cba94[_0x9c4b('0x40')],{'$or':_['map'](_0x5cba94['attributes'],function(_0x20814c){var _0x52c6ae={};_0x52c6ae[_0x20814c]={'$like':'%'+_0xa2ad40[_0x9c4b('0x33')]['filter']+'%'};return _0x52c6ae;})});}_0x5cba94=_[_0x9c4b('0x3f')]({},_0x5cba94,_0xa2ad40['options']);return _0x34d7a2[_0x9c4b('0x4d')](_0x5cba94);}})[_0x9c4b('0x25')](function(_0x1f0f71){if(_0x1f0f71){_0x6bfef2=_0x1f0f71['length'];if(!_0xa2ad40[_0x9c4b('0x33')][_0x9c4b('0x39')](_0x9c4b('0x3a'))){_0x5cba94[_0x9c4b('0x1d')]=qs['limit'](_0xa2ad40['query'][_0x9c4b('0x1d')]);_0x5cba94[_0x9c4b('0x1b')]=qs[_0x9c4b('0x1b')](_0xa2ad40[_0x9c4b('0x33')][_0x9c4b('0x1b')]);}return _0x34d7a2[_0x9c4b('0x4d')](_0x5cba94);}})[_0x9c4b('0x25')](function(_0x3a749a){if(_0x3a749a){return _0x3a749a?{'count':_0x6bfef2,'rows':_0x3a749a}:null;}})[_0x9c4b('0x25')](respondWithResult(_0x31197b,null))['catch'](handleError(_0x31197b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0355837..77f12f6 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 _0x96be=['util','api','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x26af15,_0x45237b){var _0xa070e5=function(_0x5ddc4a){while(--_0x5ddc4a){_0x26af15['push'](_0x26af15['shift']());}};_0xa070e5(++_0x45237b);}(_0x96be,0xe5));var _0xe96b=function(_0x3b2906,_0x5362f3){_0x3b2906=_0x3b2906-0x0;var _0x1a9996=_0x96be[_0x3b2906];return _0x1a9996;};'use strict';var _=require(_0xe96b('0x0'));var util=require(_0xe96b('0x1'));var logger=require('../../config/logger')(_0xe96b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe96b('0x3'));var rimraf=require(_0xe96b('0x4'));var config=require(_0xe96b('0x5'));var attributes=require(_0xe96b('0x6'));module['exports']=function(_0x32e016,_0xbc9a8d){return _0x32e016[_0xe96b('0x7')](_0xe96b('0x8'),attributes,{'tableName':_0xe96b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x107e=['rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','api','bluebird','request-promise','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x107e,0x11c));var _0xe107=function(_0x26d252,_0x3d7e71){_0x26d252=_0x26d252-0x0;var _0x5cd2be=_0x107e[_0x26d252];return _0x5cd2be;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe107('0x0'));var moment=require('moment');var BPromise=require(_0xe107('0x1'));var rp=require(_0xe107('0x2'));var fs=require('fs');var path=require(_0xe107('0x3'));var rimraf=require(_0xe107('0x4'));var config=require('../../config/environment');var attributes=require(_0xe107('0x5'));module[_0xe107('0x6')]=function(_0x2e5f13,_0x3f9ffd){return _0x2e5f13['define'](_0xe107('0x7'),attributes,{'tableName':_0xe107('0x8'),'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 c589765..71f00b5 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 _0x1235=['SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug'];(function(_0x7d5a8b,_0x2aedef){var _0x56ac46=function(_0x55a1ab){while(--_0x55a1ab){_0x7d5a8b['push'](_0x7d5a8b['shift']());}};_0x56ac46(++_0x2aedef);}(_0x1235,0x1d4));var _0x5123=function(_0xfb3935,_0x2c7c58){_0xfb3935=_0xfb3935-0x0;var _0x1d2cd0=_0x1235[_0xfb3935];return _0x1d2cd0;};'use strict';var _=require(_0x5123('0x0'));var util=require(_0x5123('0x1'));var moment=require(_0x5123('0x2'));var BPromise=require(_0x5123('0x3'));var rs=require(_0x5123('0x4'));var fs=require('fs');var Redis=require(_0x5123('0x5'));var db=require(_0x5123('0x6'))['db'];var utils=require(_0x5123('0x7'));var logger=require(_0x5123('0x8'))(_0x5123('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5123('0xa')][_0x5123('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d68dd,_0x1d19dd,_0x36a28a){return new BPromise(function(_0x57cf90,_0x47c46f){return client['request'](_0x4d68dd,_0x36a28a)[_0x5123('0xc')](function(_0x30b754){logger[_0x5123('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d19dd,_0x5123('0xe'));logger[_0x5123('0xf')](_0x5123('0x10'),_0x1d19dd,_0x5123('0xe'),JSON[_0x5123('0x11')](_0x30b754));if(_0x30b754[_0x5123('0x12')]){if(_0x30b754[_0x5123('0x12')][_0x5123('0x13')]===0x1f4){logger[_0x5123('0x12')](_0x5123('0x14'),_0x1d19dd,_0x30b754['error'][_0x5123('0x15')]);return _0x47c46f(_0x30b754[_0x5123('0x12')][_0x5123('0x15')]);}logger[_0x5123('0x12')](_0x5123('0x14'),_0x1d19dd,_0x30b754[_0x5123('0x12')]['message']);return _0x57cf90(_0x30b754[_0x5123('0x12')][_0x5123('0x15')]);}else{logger[_0x5123('0xd')](_0x5123('0x14'),_0x1d19dd,_0x5123('0xe'));_0x57cf90(_0x30b754['result'][_0x5123('0x15')]);}})['catch'](function(_0xf2de10){logger[_0x5123('0x12')](_0x5123('0x14'),_0x1d19dd,_0xf2de10);_0x47c46f(_0xf2de10);});});} \ No newline at end of file +var _0x5dc7=['request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3c1327,_0x2ceacc){var _0x4a4a9e=function(_0x55c207){while(--_0x55c207){_0x3c1327['push'](_0x3c1327['shift']());}};_0x4a4a9e(++_0x2ceacc);}(_0x5dc7,0x192));var _0x75dc=function(_0x423efe,_0x16497d){_0x423efe=_0x423efe-0x0;var _0x1466b8=_0x5dc7[_0x423efe];return _0x1466b8;};'use strict';var _=require(_0x75dc('0x0'));var util=require(_0x75dc('0x1'));var moment=require('moment');var BPromise=require(_0x75dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75dc('0x3'))['db'];var utils=require(_0x75dc('0x4'));var logger=require(_0x75dc('0x5'))(_0x75dc('0x6'));var config=require(_0x75dc('0x7'));var jayson=require(_0x75dc('0x8'));var client=jayson[_0x75dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d7a6b,_0x2ecfa4,_0x1f8636){return new BPromise(function(_0xeab7d4,_0x2ec1f4){return client[_0x75dc('0xa')](_0x3d7a6b,_0x1f8636)[_0x75dc('0xb')](function(_0x51ebb4){logger[_0x75dc('0xc')](_0x75dc('0xd'),_0x2ecfa4,'request\x20sent');logger[_0x75dc('0xe')](_0x75dc('0xf'),_0x2ecfa4,_0x75dc('0x10'),JSON[_0x75dc('0x11')](_0x51ebb4));if(_0x51ebb4[_0x75dc('0x12')]){if(_0x51ebb4[_0x75dc('0x12')][_0x75dc('0x13')]===0x1f4){logger[_0x75dc('0x12')](_0x75dc('0xd'),_0x2ecfa4,_0x51ebb4[_0x75dc('0x12')][_0x75dc('0x14')]);return _0x2ec1f4(_0x51ebb4[_0x75dc('0x12')][_0x75dc('0x14')]);}logger[_0x75dc('0x12')](_0x75dc('0xd'),_0x2ecfa4,_0x51ebb4[_0x75dc('0x12')][_0x75dc('0x14')]);return _0xeab7d4(_0x51ebb4[_0x75dc('0x12')][_0x75dc('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ecfa4,_0x75dc('0x10'));_0xeab7d4(_0x51ebb4['result'][_0x75dc('0x14')]);}})[_0x75dc('0x15')](function(_0x23d029){logger[_0x75dc('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ecfa4,_0x23d029);_0x2ec1f4(_0x23d029);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a37561f..1795752 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 _0x3ecb=['fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','get','/:id','post','put','update','destroy','exports','multer','util','path','Router'];(function(_0x4b4877,_0x209e13){var _0x5c032c=function(_0x2bf89f){while(--_0x2bf89f){_0x4b4877['push'](_0x4b4877['shift']());}};_0x5c032c(++_0x209e13);}(_0x3ecb,0x6c));var _0xb3ec=function(_0x167211,_0x52c558){_0x167211=_0x167211-0x0;var _0x395f67=_0x3ecb[_0x167211];return _0x395f67;};'use strict';var multer=require(_0xb3ec('0x0'));var util=require(_0xb3ec('0x1'));var path=require(_0xb3ec('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb3ec('0x3')]();var fs_extra=require(_0xb3ec('0x4'));var auth=require(_0xb3ec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb3ec('0x6'));var controller=require(_0xb3ec('0x7'));router['get']('/',auth[_0xb3ec('0x8')](),controller['index']);router[_0xb3ec('0x9')](_0xb3ec('0xa'),auth[_0xb3ec('0x8')](),controller['show']);router[_0xb3ec('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb3ec('0xc')](_0xb3ec('0xa'),auth['isAuthenticated'](),controller[_0xb3ec('0xd')]);router['delete'](_0xb3ec('0xa'),auth['isAuthenticated'](),controller[_0xb3ec('0xe')]);module[_0xb3ec('0xf')]=router; \ No newline at end of file +var _0x34b7=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34b7,0xfb));var _0x734b=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0x34b7[_0x39ea42];return _0x33f5b7;};'use strict';var multer=require(_0x734b('0x0'));var util=require(_0x734b('0x1'));var path=require('path');var timeout=require(_0x734b('0x2'));var express=require(_0x734b('0x3'));var router=express['Router']();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x734b('0x6'));var controller=require(_0x734b('0x7'));router[_0x734b('0x8')]('/',auth[_0x734b('0x9')](),controller[_0x734b('0xa')]);router['get'](_0x734b('0xb'),auth[_0x734b('0x9')](),controller[_0x734b('0xc')]);router[_0x734b('0xd')]('/',auth[_0x734b('0x9')](),controller['create']);router[_0x734b('0xe')](_0x734b('0xb'),auth[_0x734b('0x9')](),controller['update']);router[_0x734b('0xf')](_0x734b('0xb'),auth[_0x734b('0x9')](),controller[_0x734b('0x10')]);module[_0x734b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8ce80cf..920ab46 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 _0xce56=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x59aa25,_0x5b84d4){var _0x40fb26=function(_0x5a8049){while(--_0x5a8049){_0x59aa25['push'](_0x59aa25['shift']());}};_0x40fb26(++_0x5b84d4);}(_0xce56,0x187));var _0x6ce5=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0xce56[_0xa9a245];return _0x2d0eaa;};'use strict';var Sequelize=require(_0x6ce5('0x0'));module[_0x6ce5('0x1')]={'type':{'type':Sequelize[_0x6ce5('0x2')](_0x6ce5('0x3'),_0x6ce5('0x4'),_0x6ce5('0x5'),_0x6ce5('0x6'),_0x6ce5('0x7')),'defaultValue':_0x6ce5('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6ce5('0x2')](_0x6ce5('0x3'),_0x6ce5('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x6ce5('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6ce5('0x8')]},'customField':{'type':Sequelize[_0x6ce5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6ce5('0x8')]}}; \ No newline at end of file +var _0x69a0=['customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x1d90ca,_0x3bab16){var _0x28872b=function(_0x3ea71b){while(--_0x3ea71b){_0x1d90ca['push'](_0x1d90ca['shift']());}};_0x28872b(++_0x3bab16);}(_0x69a0,0x1ea));var _0x069a=function(_0x275463,_0x7e7ddd){_0x275463=_0x275463-0x0;var _0x11fdd3=_0x69a0[_0x275463];return _0x11fdd3;};'use strict';var Sequelize=require(_0x069a('0x0'));module[_0x069a('0x1')]={'type':{'type':Sequelize[_0x069a('0x2')](_0x069a('0x3'),_0x069a('0x4'),_0x069a('0x5'),'keyValue',_0x069a('0x6')),'defaultValue':_0x069a('0x3')},'content':{'type':Sequelize[_0x069a('0x7')]},'key':{'type':Sequelize[_0x069a('0x7')]},'keyType':{'type':Sequelize[_0x069a('0x2')]('string',_0x069a('0x4'),_0x069a('0x5'))},'keyContent':{'type':Sequelize[_0x069a('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x069a('0x7')]},'customField':{'type':Sequelize[_0x069a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x069a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 75a3d66..3d3c569 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 _0xf797=['include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','../../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','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x43aab8,_0xc687c2){var _0x3c8749=function(_0xe86c8b){while(--_0xe86c8b){_0x43aab8['push'](_0x43aab8['shift']());}};_0x3c8749(++_0xc687c2);}(_0xf797,0xec));var _0x7f79=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xf797[_0x58e469];return _0x4c01c5;};'use strict';var emlformat=require(_0x7f79('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7f79('0x1'));var rp=require(_0x7f79('0x2'));var moment=require(_0x7f79('0x3'));var BPromise=require(_0x7f79('0x4'));var Mustache=require(_0x7f79('0x5'));var util=require(_0x7f79('0x6'));var path=require(_0x7f79('0x7'));var sox=require('sox');var csv=require(_0x7f79('0x8'));var ejs=require(_0x7f79('0x9'));var fs=require('fs');var fs_extra=require(_0x7f79('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f79('0xb'));var jsforce=require(_0x7f79('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f79('0xd'));var Redis=require('ioredis');var authService=require(_0x7f79('0xe'));var qs=require(_0x7f79('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f79('0x10'));var logger=require(_0x7f79('0x11'))(_0x7f79('0x12'));var utils=require(_0x7f79('0x13'));var config=require(_0x7f79('0x14'));var licenseUtil=require(_0x7f79('0x15'));var db=require(_0x7f79('0x16'))['db'];function respondWithStatusCode(_0x51c20c,_0x38e132){_0x38e132=_0x38e132||0xcc;return function(_0x2dc3ce){if(_0x2dc3ce){return _0x51c20c[_0x7f79('0x17')](_0x38e132);}return _0x51c20c[_0x7f79('0x18')](_0x38e132)[_0x7f79('0x19')]();};}function respondWithResult(_0x74f28c,_0x37b650){_0x37b650=_0x37b650||0xc8;return function(_0x80f8){if(_0x80f8){return _0x74f28c[_0x7f79('0x18')](_0x37b650)[_0x7f79('0x1a')](_0x80f8);}};}function respondWithFilteredResult(_0x2f5495,_0xdfb95c){return function(_0x5b121a){if(_0x5b121a){var _0x39bc5b=typeof _0xdfb95c[_0x7f79('0x1b')]===_0x7f79('0x1c')&&typeof _0xdfb95c[_0x7f79('0x1d')]===_0x7f79('0x1c');var _0x33d916=_0x5b121a['count'];var _0x4594c8=_0x39bc5b?0x0:_0xdfb95c[_0x7f79('0x1b')];var _0x4670d9=_0x39bc5b?_0x5b121a[_0x7f79('0x1e')]:_0xdfb95c['offset']+_0xdfb95c[_0x7f79('0x1d')];var _0x4c170e;if(_0x4670d9>=_0x33d916){_0x4670d9=_0x33d916;_0x4c170e=0xc8;}else{_0x4c170e=0xce;}_0x2f5495[_0x7f79('0x18')](_0x4c170e);return _0x2f5495[_0x7f79('0x1f')](_0x7f79('0x20'),_0x4594c8+'-'+_0x4670d9+'/'+_0x33d916)[_0x7f79('0x1a')](_0x5b121a);}return null;};}function patchUpdates(_0x279a4f){return function(_0x4924aa){try{jsonpatch[_0x7f79('0x21')](_0x4924aa,_0x279a4f,!![]);}catch(_0x504e0a){return BPromise[_0x7f79('0x22')](_0x504e0a);}return _0x4924aa[_0x7f79('0x23')]();};}function saveUpdates(_0x2bb21a,_0x4edd95){return function(_0x3e2e3c){if(_0x3e2e3c){return _0x3e2e3c[_0x7f79('0x24')](_0x2bb21a)[_0x7f79('0x25')](function(_0x585547){return _0x585547;});}return null;};}function removeEntity(_0x41a9ab,_0x349c5d){return function(_0x24e5b6){if(_0x24e5b6){return _0x24e5b6['destroy']()[_0x7f79('0x25')](function(){_0x41a9ab[_0x7f79('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c307d,_0x2489e3){return function(_0x4f27a6){if(!_0x4f27a6){_0x5c307d[_0x7f79('0x17')](0x194);}return _0x4f27a6;};}function handleError(_0x545bf6,_0x1c7291){_0x1c7291=_0x1c7291||0x1f4;return function(_0x128e38){logger[_0x7f79('0x26')](_0x128e38[_0x7f79('0x27')]);if(_0x128e38['name']){delete _0x128e38[_0x7f79('0x28')];}_0x545bf6['status'](_0x1c7291)[_0x7f79('0x29')](_0x128e38);};}exports[_0x7f79('0x2a')]=function(_0x11f3e,_0x3444ca){var _0x5a251e={},_0xb26d8={},_0x20a49d={'count':0x0,'rows':[]};var _0x8384f8=_[_0x7f79('0x2b')](db[_0x7f79('0x2c')][_0x7f79('0x2d')],function(_0x31f9fe){return{'name':_0x31f9fe[_0x7f79('0x2e')],'type':_0x31f9fe['type'][_0x7f79('0x2f')]};});_0xb26d8['model']=_[_0x7f79('0x2b')](_0x8384f8,_0x7f79('0x28'));_0xb26d8[_0x7f79('0x30')]=_[_0x7f79('0x31')](_0x11f3e[_0x7f79('0x30')]);_0xb26d8[_0x7f79('0x32')]=_[_0x7f79('0x33')](_0xb26d8[_0x7f79('0x34')],_0xb26d8[_0x7f79('0x30')]);_0x5a251e[_0x7f79('0x35')]=_[_0x7f79('0x33')](_0xb26d8[_0x7f79('0x34')],qs[_0x7f79('0x36')](_0x11f3e[_0x7f79('0x30')][_0x7f79('0x36')]));_0x5a251e[_0x7f79('0x35')]=_0x5a251e['attributes']['length']?_0x5a251e[_0x7f79('0x35')]:_0xb26d8['model'];if(!_0x11f3e[_0x7f79('0x30')]['hasOwnProperty'](_0x7f79('0x37'))){_0x5a251e[_0x7f79('0x1d')]=qs[_0x7f79('0x1d')](_0x11f3e[_0x7f79('0x30')][_0x7f79('0x1d')]);_0x5a251e['offset']=qs['offset'](_0x11f3e[_0x7f79('0x30')][_0x7f79('0x1b')]);}_0x5a251e[_0x7f79('0x38')]=qs[_0x7f79('0x39')](_0x11f3e[_0x7f79('0x30')][_0x7f79('0x39')]);_0x5a251e[_0x7f79('0x3a')]=qs[_0x7f79('0x32')](_[_0x7f79('0x3b')](_0x11f3e[_0x7f79('0x30')],_0xb26d8['filters']),_0x8384f8);if(_0x11f3e['query'][_0x7f79('0x3c')]){_0x5a251e[_0x7f79('0x3a')]=_[_0x7f79('0x3d')](_0x5a251e[_0x7f79('0x3a')],{'$or':_[_0x7f79('0x2b')](_0x8384f8,function(_0x261966){if(_0x261966['type']!==_0x7f79('0x3e')){var _0x4e02fa={};_0x4e02fa[_0x261966[_0x7f79('0x28')]]={'$like':'%'+_0x11f3e[_0x7f79('0x30')]['filter']+'%'};return _0x4e02fa;}})});}_0x5a251e=_[_0x7f79('0x3d')]({},_0x5a251e,_0x11f3e[_0x7f79('0x3f')]);var _0xcc7aa7={'where':_0x5a251e[_0x7f79('0x3a')]};return db[_0x7f79('0x2c')][_0x7f79('0x1e')](_0xcc7aa7)[_0x7f79('0x25')](function(_0x34ee60){_0x20a49d['count']=_0x34ee60;if(_0x11f3e[_0x7f79('0x30')]['includeAll']){_0x5a251e[_0x7f79('0x40')]=[{'all':!![]}];}return db[_0x7f79('0x2c')][_0x7f79('0x41')](_0x5a251e);})['then'](function(_0x3e89e5){_0x20a49d[_0x7f79('0x42')]=_0x3e89e5;return _0x20a49d;})[_0x7f79('0x25')](respondWithFilteredResult(_0x3444ca,_0x5a251e))[_0x7f79('0x43')](handleError(_0x3444ca,null));};exports[_0x7f79('0x44')]=function(_0x108f12,_0x5df746){var _0x29fdd0={'raw':!![],'where':{'id':_0x108f12[_0x7f79('0x45')]['id']}},_0x365ca1={};_0x365ca1['model']=_[_0x7f79('0x31')](db['SugarcrmField']['rawAttributes']);_0x365ca1['query']=_[_0x7f79('0x31')](_0x108f12[_0x7f79('0x30')]);_0x365ca1[_0x7f79('0x32')]=_[_0x7f79('0x33')](_0x365ca1[_0x7f79('0x34')],_0x365ca1['query']);_0x29fdd0['attributes']=_['intersection'](_0x365ca1[_0x7f79('0x34')],qs[_0x7f79('0x36')](_0x108f12['query'][_0x7f79('0x36')]));_0x29fdd0[_0x7f79('0x35')]=_0x29fdd0[_0x7f79('0x35')]['length']?_0x29fdd0[_0x7f79('0x35')]:_0x365ca1[_0x7f79('0x34')];if(_0x108f12[_0x7f79('0x30')][_0x7f79('0x46')]){_0x29fdd0['include']=[{'all':!![]}];}_0x29fdd0=_[_0x7f79('0x3d')]({},_0x29fdd0,_0x108f12[_0x7f79('0x3f')]);return db[_0x7f79('0x2c')][_0x7f79('0x47')](_0x29fdd0)[_0x7f79('0x25')](handleEntityNotFound(_0x5df746,null))[_0x7f79('0x25')](respondWithResult(_0x5df746,null))['catch'](handleError(_0x5df746,null));};exports[_0x7f79('0x48')]=function(_0x42735d,_0x386514){return db[_0x7f79('0x2c')][_0x7f79('0x48')](_0x42735d['body'],{})[_0x7f79('0x25')](respondWithResult(_0x386514,0xc9))[_0x7f79('0x43')](handleError(_0x386514,null));};exports[_0x7f79('0x24')]=function(_0x2c901a,_0x2ecebc){if(_0x2c901a[_0x7f79('0x49')]['id']){delete _0x2c901a[_0x7f79('0x49')]['id'];}return db[_0x7f79('0x2c')][_0x7f79('0x47')]({'where':{'id':_0x2c901a[_0x7f79('0x45')]['id']}})[_0x7f79('0x25')](handleEntityNotFound(_0x2ecebc,null))['then'](saveUpdates(_0x2c901a[_0x7f79('0x49')],null))['then'](respondWithResult(_0x2ecebc,null))[_0x7f79('0x43')](handleError(_0x2ecebc,null));};exports[_0x7f79('0x4a')]=function(_0x69053e,_0x4aa9bd){return db[_0x7f79('0x2c')][_0x7f79('0x47')]({'where':{'id':_0x69053e[_0x7f79('0x45')]['id']}})[_0x7f79('0x25')](handleEntityNotFound(_0x4aa9bd,null))[_0x7f79('0x25')](removeEntity(_0x4aa9bd,null))[_0x7f79('0x43')](handleError(_0x4aa9bd,null));}; \ No newline at end of file +var _0x4611=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','SugarcrmField','count','includeAll','then','rows','show','include','find','create','body','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra'];(function(_0x38c7c6,_0x4402a1){var _0x35b48b=function(_0xda90eb){while(--_0xda90eb){_0x38c7c6['push'](_0x38c7c6['shift']());}};_0x35b48b(++_0x4402a1);}(_0x4611,0xd6));var _0x1461=function(_0x1e3b27,_0x5a4ab1){_0x1e3b27=_0x1e3b27-0x0;var _0x147598=_0x4611[_0x1e3b27];return _0x147598;};'use strict';var emlformat=require(_0x1461('0x0'));var rimraf=require(_0x1461('0x1'));var zipdir=require(_0x1461('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1461('0x3'));var moment=require(_0x1461('0x4'));var BPromise=require(_0x1461('0x5'));var Mustache=require(_0x1461('0x6'));var util=require(_0x1461('0x7'));var path=require('path');var sox=require(_0x1461('0x8'));var csv=require('to-csv');var ejs=require(_0x1461('0x9'));var fs=require('fs');var fs_extra=require(_0x1461('0xa'));var _=require(_0x1461('0xb'));var squel=require('squel');var crypto=require(_0x1461('0xc'));var jsforce=require(_0x1461('0xd'));var deskjs=require(_0x1461('0xe'));var toCsv=require(_0x1461('0xf'));var querystring=require(_0x1461('0x10'));var Papa=require(_0x1461('0x11'));var Redis=require(_0x1461('0x12'));var authService=require(_0x1461('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1461('0x14'));var logger=require(_0x1461('0x15'))(_0x1461('0x16'));var utils=require('../../config/utils');var config=require(_0x1461('0x17'));var licenseUtil=require(_0x1461('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4520fd,_0x15300f){_0x15300f=_0x15300f||0xcc;return function(_0x423779){if(_0x423779){return _0x4520fd[_0x1461('0x19')](_0x15300f);}return _0x4520fd[_0x1461('0x1a')](_0x15300f)[_0x1461('0x1b')]();};}function respondWithResult(_0x38718d,_0x2c583c){_0x2c583c=_0x2c583c||0xc8;return function(_0x5c6583){if(_0x5c6583){return _0x38718d['status'](_0x2c583c)[_0x1461('0x1c')](_0x5c6583);}};}function respondWithFilteredResult(_0x465259,_0x3501d5){return function(_0x159a96){if(_0x159a96){var _0x2df18e=typeof _0x3501d5['offset']===_0x1461('0x1d')&&typeof _0x3501d5[_0x1461('0x1e')]==='undefined';var _0x51d851=_0x159a96['count'];var _0x2b3f40=_0x2df18e?0x0:_0x3501d5[_0x1461('0x1f')];var _0x114817=_0x2df18e?_0x159a96['count']:_0x3501d5[_0x1461('0x1f')]+_0x3501d5[_0x1461('0x1e')];var _0x160637;if(_0x114817>=_0x51d851){_0x114817=_0x51d851;_0x160637=0xc8;}else{_0x160637=0xce;}_0x465259[_0x1461('0x1a')](_0x160637);return _0x465259[_0x1461('0x20')](_0x1461('0x21'),_0x2b3f40+'-'+_0x114817+'/'+_0x51d851)['json'](_0x159a96);}return null;};}function patchUpdates(_0xa2e84b){return function(_0x109f06){try{jsonpatch[_0x1461('0x22')](_0x109f06,_0xa2e84b,!![]);}catch(_0x4c5bf9){return BPromise[_0x1461('0x23')](_0x4c5bf9);}return _0x109f06[_0x1461('0x24')]();};}function saveUpdates(_0x5d0625,_0x34b3cb){return function(_0x2cbe96){if(_0x2cbe96){return _0x2cbe96[_0x1461('0x25')](_0x5d0625)['then'](function(_0xee751d){return _0xee751d;});}return null;};}function removeEntity(_0x5ee7b7,_0x149f1f){return function(_0x323916){if(_0x323916){return _0x323916[_0x1461('0x26')]()['then'](function(){_0x5ee7b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x368d26,_0x468fc0){return function(_0x4040f3){if(!_0x4040f3){_0x368d26[_0x1461('0x19')](0x194);}return _0x4040f3;};}function handleError(_0x4e9716,_0x2c65b9){_0x2c65b9=_0x2c65b9||0x1f4;return function(_0x52ef89){logger[_0x1461('0x27')](_0x52ef89[_0x1461('0x28')]);if(_0x52ef89[_0x1461('0x29')]){delete _0x52ef89[_0x1461('0x29')];}_0x4e9716[_0x1461('0x1a')](_0x2c65b9)[_0x1461('0x2a')](_0x52ef89);};}exports['index']=function(_0x2de23b,_0x158a55){var _0x2329e6={},_0x25597c={},_0x53d9b3={'count':0x0,'rows':[]};var _0x49d974=_['map'](db['SugarcrmField'][_0x1461('0x2b')],function(_0xe54e3e){return{'name':_0xe54e3e[_0x1461('0x2c')],'type':_0xe54e3e[_0x1461('0x2d')]['key']};});_0x25597c[_0x1461('0x2e')]=_[_0x1461('0x2f')](_0x49d974,_0x1461('0x29'));_0x25597c['query']=_[_0x1461('0x30')](_0x2de23b[_0x1461('0x31')]);_0x25597c[_0x1461('0x32')]=_[_0x1461('0x33')](_0x25597c['model'],_0x25597c[_0x1461('0x31')]);_0x2329e6[_0x1461('0x34')]=_['intersection'](_0x25597c['model'],qs[_0x1461('0x35')](_0x2de23b['query'][_0x1461('0x35')]));_0x2329e6[_0x1461('0x34')]=_0x2329e6[_0x1461('0x34')][_0x1461('0x36')]?_0x2329e6[_0x1461('0x34')]:_0x25597c[_0x1461('0x2e')];if(!_0x2de23b[_0x1461('0x31')][_0x1461('0x37')](_0x1461('0x38'))){_0x2329e6[_0x1461('0x1e')]=qs[_0x1461('0x1e')](_0x2de23b[_0x1461('0x31')]['limit']);_0x2329e6[_0x1461('0x1f')]=qs['offset'](_0x2de23b['query'][_0x1461('0x1f')]);}_0x2329e6[_0x1461('0x39')]=qs['sort'](_0x2de23b[_0x1461('0x31')]['sort']);_0x2329e6[_0x1461('0x3a')]=qs['filters'](_[_0x1461('0x3b')](_0x2de23b[_0x1461('0x31')],_0x25597c[_0x1461('0x32')]),_0x49d974);if(_0x2de23b[_0x1461('0x31')]['filter']){_0x2329e6['where']=_[_0x1461('0x3c')](_0x2329e6[_0x1461('0x3a')],{'$or':_['map'](_0x49d974,function(_0x36daf1){if(_0x36daf1[_0x1461('0x2d')]!=='VIRTUAL'){var _0x28cae0={};_0x28cae0[_0x36daf1[_0x1461('0x29')]]={'$like':'%'+_0x2de23b[_0x1461('0x31')][_0x1461('0x3d')]+'%'};return _0x28cae0;}})});}_0x2329e6=_[_0x1461('0x3c')]({},_0x2329e6,_0x2de23b[_0x1461('0x3e')]);var _0x134131={'where':_0x2329e6[_0x1461('0x3a')]};return db[_0x1461('0x3f')][_0x1461('0x40')](_0x134131)['then'](function(_0x4f4bf6){_0x53d9b3[_0x1461('0x40')]=_0x4f4bf6;if(_0x2de23b['query'][_0x1461('0x41')]){_0x2329e6['include']=[{'all':!![]}];}return db[_0x1461('0x3f')]['findAll'](_0x2329e6);})[_0x1461('0x42')](function(_0x1be606){_0x53d9b3[_0x1461('0x43')]=_0x1be606;return _0x53d9b3;})[_0x1461('0x42')](respondWithFilteredResult(_0x158a55,_0x2329e6))['catch'](handleError(_0x158a55,null));};exports[_0x1461('0x44')]=function(_0x3c6644,_0x5dbf00){var _0x4d0a8d={'raw':!![],'where':{'id':_0x3c6644['params']['id']}},_0x34296d={};_0x34296d[_0x1461('0x2e')]=_[_0x1461('0x30')](db[_0x1461('0x3f')][_0x1461('0x2b')]);_0x34296d[_0x1461('0x31')]=_[_0x1461('0x30')](_0x3c6644['query']);_0x34296d[_0x1461('0x32')]=_['intersection'](_0x34296d[_0x1461('0x2e')],_0x34296d[_0x1461('0x31')]);_0x4d0a8d[_0x1461('0x34')]=_[_0x1461('0x33')](_0x34296d[_0x1461('0x2e')],qs['fields'](_0x3c6644[_0x1461('0x31')][_0x1461('0x35')]));_0x4d0a8d[_0x1461('0x34')]=_0x4d0a8d[_0x1461('0x34')]['length']?_0x4d0a8d[_0x1461('0x34')]:_0x34296d[_0x1461('0x2e')];if(_0x3c6644[_0x1461('0x31')]['includeAll']){_0x4d0a8d[_0x1461('0x45')]=[{'all':!![]}];}_0x4d0a8d=_[_0x1461('0x3c')]({},_0x4d0a8d,_0x3c6644[_0x1461('0x3e')]);return db[_0x1461('0x3f')][_0x1461('0x46')](_0x4d0a8d)['then'](handleEntityNotFound(_0x5dbf00,null))[_0x1461('0x42')](respondWithResult(_0x5dbf00,null))['catch'](handleError(_0x5dbf00,null));};exports[_0x1461('0x47')]=function(_0x1eefd3,_0x50fca9){return db['SugarcrmField']['create'](_0x1eefd3[_0x1461('0x48')],{})['then'](respondWithResult(_0x50fca9,0xc9))['catch'](handleError(_0x50fca9,null));};exports[_0x1461('0x25')]=function(_0x394942,_0x3c551d){if(_0x394942[_0x1461('0x48')]['id']){delete _0x394942[_0x1461('0x48')]['id'];}return db[_0x1461('0x3f')][_0x1461('0x46')]({'where':{'id':_0x394942[_0x1461('0x49')]['id']}})[_0x1461('0x42')](handleEntityNotFound(_0x3c551d,null))['then'](saveUpdates(_0x394942[_0x1461('0x48')],null))[_0x1461('0x42')](respondWithResult(_0x3c551d,null))[_0x1461('0x4a')](handleError(_0x3c551d,null));};exports[_0x1461('0x26')]=function(_0x29161d,_0x57309a){return db[_0x1461('0x3f')][_0x1461('0x46')]({'where':{'id':_0x29161d[_0x1461('0x49')]['id']}})[_0x1461('0x42')](handleEntityNotFound(_0x57309a,null))['then'](removeEntity(_0x57309a,null))[_0x1461('0x4a')](handleError(_0x57309a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 7dfc0e6..3186d18 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 _0xff52=['idField','util','api','moment','bluebird','request-promise','path','../../config/environment','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x22e3d0,_0x7f7fed){var _0x4c1257=function(_0xe51904){while(--_0xe51904){_0x22e3d0['push'](_0x22e3d0['shift']());}};_0x4c1257(++_0x7f7fed);}(_0xff52,0x181));var _0x2ff5=function(_0x402950,_0x52d699){_0x402950=_0x402950-0x0;var _0x643b00=_0xff52[_0x402950];return _0x643b00;};'use strict';var _=require('lodash');var util=require(_0x2ff5('0x0'));var logger=require('../../config/logger')(_0x2ff5('0x1'));var moment=require(_0x2ff5('0x2'));var BPromise=require(_0x2ff5('0x3'));var rp=require(_0x2ff5('0x4'));var fs=require('fs');var path=require(_0x2ff5('0x5'));var rimraf=require('rimraf');var config=require(_0x2ff5('0x6'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0xba76d3,_0x2a64dc){return _0xba76d3[_0x2ff5('0x7')](_0x2ff5('0x8'),attributes,{'tableName':_0x2ff5('0x9'),'paranoid':![],'indexes':[{'name':_0x2ff5('0xa'),'fields':[_0x2ff5('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x692c=['sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x2e8a6e,_0x18e64f){var _0x259829=function(_0x230dac){while(--_0x230dac){_0x2e8a6e['push'](_0x2e8a6e['shift']());}};_0x259829(++_0x18e64f);}(_0x692c,0x128));var _0xc692=function(_0x4e13cb,_0x3874ab){_0x4e13cb=_0x4e13cb-0x0;var _0x13ae9b=_0x692c[_0x4e13cb];return _0x13ae9b;};'use strict';var _=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var logger=require(_0xc692('0x2'))(_0xc692('0x3'));var moment=require(_0xc692('0x4'));var BPromise=require(_0xc692('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc692('0x6'));var rimraf=require('rimraf');var config=require(_0xc692('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0xc692('0x8')]=function(_0x1b56c5,_0x2c80b0){return _0x1b56c5[_0xc692('0x9')](_0xc692('0xa'),attributes,{'tableName':_0xc692('0xb'),'paranoid':![],'indexes':[{'name':_0xc692('0xc'),'fields':[_0xc692('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 789c3ba..547a2ce 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 _0xa145=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','code','error','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x77fca0,_0x487210){var _0xbaac08=function(_0x2991b6){while(--_0x2991b6){_0x77fca0['push'](_0x77fca0['shift']());}};_0xbaac08(++_0x487210);}(_0xa145,0x132));var _0x5a14=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xa145[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x5a14('0x0'));var util=require(_0x5a14('0x1'));var moment=require(_0x5a14('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a14('0x3'));var fs=require('fs');var Redis=require(_0x5a14('0x4'));var db=require(_0x5a14('0x5'))['db'];var utils=require(_0x5a14('0x6'));var logger=require(_0x5a14('0x7'))(_0x5a14('0x8'));var config=require('../../config/environment');var jayson=require(_0x5a14('0x9'));var client=jayson[_0x5a14('0xa')][_0x5a14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x264cca,_0x2425c8,_0x455b2){return new BPromise(function(_0x333a24,_0x53f357){return client[_0x5a14('0xc')](_0x264cca,_0x455b2)[_0x5a14('0xd')](function(_0x3559e0){logger[_0x5a14('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2425c8,_0x5a14('0xf'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2425c8,_0x5a14('0xf'),JSON['stringify'](_0x3559e0));if(_0x3559e0['error']){if(_0x3559e0['error'][_0x5a14('0x10')]===0x1f4){logger[_0x5a14('0x11')](_0x5a14('0x12'),_0x2425c8,_0x3559e0[_0x5a14('0x11')][_0x5a14('0x13')]);return _0x53f357(_0x3559e0['error'][_0x5a14('0x13')]);}logger[_0x5a14('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x2425c8,_0x3559e0[_0x5a14('0x11')][_0x5a14('0x13')]);return _0x333a24(_0x3559e0[_0x5a14('0x11')][_0x5a14('0x13')]);}else{logger['info'](_0x5a14('0x12'),_0x2425c8,_0x5a14('0xf'));_0x333a24(_0x3559e0[_0x5a14('0x14')]['message']);}})[_0x5a14('0x15')](function(_0x2b5f0f){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x2425c8,_0x2b5f0f);_0x53f357(_0x2b5f0f);});});} \ No newline at end of file +var _0xa4e4=['message','result','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','SugarcrmField,\x20%s,\x20%s'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xa4e4,0x1cb));var _0x4a4e=function(_0x4beb7a,_0x246983){_0x4beb7a=_0x4beb7a-0x0;var _0x50c7dd=_0xa4e4[_0x4beb7a];return _0x50c7dd;};'use strict';var _=require('lodash');var util=require(_0x4a4e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a4e('0x1'));var db=require(_0x4a4e('0x2'))['db'];var utils=require(_0x4a4e('0x3'));var logger=require(_0x4a4e('0x4'))(_0x4a4e('0x5'));var config=require(_0x4a4e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4a4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53dd83,_0x1f5b9a,_0x127d3a){return new BPromise(function(_0x41ec06,_0x17c6c9){return client[_0x4a4e('0x8')](_0x53dd83,_0x127d3a)[_0x4a4e('0x9')](function(_0x36f6eb){logger[_0x4a4e('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x1f5b9a,_0x4a4e('0xb'));logger[_0x4a4e('0xc')](_0x4a4e('0xd'),_0x1f5b9a,_0x4a4e('0xb'),JSON['stringify'](_0x36f6eb));if(_0x36f6eb['error']){if(_0x36f6eb[_0x4a4e('0xe')]['code']===0x1f4){logger['error'](_0x4a4e('0xf'),_0x1f5b9a,_0x36f6eb[_0x4a4e('0xe')][_0x4a4e('0x10')]);return _0x17c6c9(_0x36f6eb[_0x4a4e('0xe')][_0x4a4e('0x10')]);}logger[_0x4a4e('0xe')](_0x4a4e('0xf'),_0x1f5b9a,_0x36f6eb[_0x4a4e('0xe')][_0x4a4e('0x10')]);return _0x41ec06(_0x36f6eb[_0x4a4e('0xe')]['message']);}else{logger['info'](_0x4a4e('0xf'),_0x1f5b9a,'request\x20sent');_0x41ec06(_0x36f6eb[_0x4a4e('0x11')][_0x4a4e('0x10')]);}})[_0x4a4e('0x12')](function(_0x3fa93a){logger[_0x4a4e('0xe')](_0x4a4e('0xf'),_0x1f5b9a,_0x3fa93a);_0x17c6c9(_0x3fa93a);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0269405..35a3f6f 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 _0x4403=['update','delete','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','index','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0x4403,0x179));var _0x3440=function(_0x119de9,_0xfe84f8){_0x119de9=_0x119de9-0x0;var _0x467fe7=_0x4403[_0x119de9];return _0x467fe7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3440('0x0'));var express=require('express');var router=express[_0x3440('0x1')]();var fs_extra=require(_0x3440('0x2'));var auth=require(_0x3440('0x3'));var interaction=require(_0x3440('0x4'));var config=require('../../config/environment');var controller=require(_0x3440('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x3440('0x6')]);router[_0x3440('0x7')](_0x3440('0x8'),auth['isAuthenticated'](),controller[_0x3440('0x9')]);router['get'](_0x3440('0xa'),auth[_0x3440('0xb')](),controller[_0x3440('0xc')]);router['get'](_0x3440('0xd'),auth[_0x3440('0xb')](),controller[_0x3440('0xe')]);router[_0x3440('0xf')]('/',auth[_0x3440('0xb')](),controller[_0x3440('0x10')]);router[_0x3440('0xf')]('/:id/configurations',auth[_0x3440('0xb')](),controller[_0x3440('0x11')]);router[_0x3440('0x12')]('/:id',auth[_0x3440('0xb')](),controller[_0x3440('0x13')]);router[_0x3440('0x14')](_0x3440('0x8'),auth[_0x3440('0xb')](),controller['destroy']);module[_0x3440('0x15')]=router; \ No newline at end of file +var _0xa0bc=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete'];(function(_0x920fbc,_0x4942cd){var _0x506299=function(_0x409dcf){while(--_0x409dcf){_0x920fbc['push'](_0x920fbc['shift']());}};_0x506299(++_0x4942cd);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xca0b('0x0'));var path=require(_0xca0b('0x1'));var timeout=require('connect-timeout');var express=require(_0xca0b('0x2'));var router=express[_0xca0b('0x3')]();var fs_extra=require(_0xca0b('0x4'));var auth=require(_0xca0b('0x5'));var interaction=require(_0xca0b('0x6'));var config=require(_0xca0b('0x7'));var controller=require(_0xca0b('0x8'));router[_0xca0b('0x9')]('/',auth[_0xca0b('0xa')](),controller[_0xca0b('0xb')]);router[_0xca0b('0x9')](_0xca0b('0xc'),auth[_0xca0b('0xa')](),controller[_0xca0b('0xd')]);router['get'](_0xca0b('0xe'),auth[_0xca0b('0xa')](),controller[_0xca0b('0xf')]);router[_0xca0b('0x9')](_0xca0b('0x10'),auth[_0xca0b('0xa')](),controller['getFields']);router[_0xca0b('0x11')]('/',auth[_0xca0b('0xa')](),controller[_0xca0b('0x12')]);router[_0xca0b('0x11')](_0xca0b('0xe'),auth[_0xca0b('0xa')](),controller[_0xca0b('0x13')]);router[_0xca0b('0x14')](_0xca0b('0xc'),auth[_0xca0b('0xa')](),controller['update']);router[_0xca0b('0x15')](_0xca0b('0xc'),auth[_0xca0b('0xa')](),controller['destroy']);module[_0xca0b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 24af282..a6ad263 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 _0x87af=['HelpDesk','sequelize','exports','STRING'];(function(_0x686b92,_0x2b5887){var _0xd961d=function(_0x243a1b){while(--_0x243a1b){_0x686b92['push'](_0x686b92['shift']());}};_0xd961d(++_0x2b5887);}(_0x87af,0x1c5));var _0xf87a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x87af[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xf87a('0x0'));module[_0xf87a('0x1')]={'name':{'type':Sequelize[_0xf87a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf87a('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf87a('0x2')],'allowNull':![],'defaultValue':_0xf87a('0x3')},'remoteUri':{'type':Sequelize[_0xf87a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf87a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xaf43=['sequelize','exports','STRING'];(function(_0x2ddbf0,_0xad6c39){var _0x14f9b0=function(_0x2d303a){while(--_0x2d303a){_0x2ddbf0['push'](_0x2ddbf0['shift']());}};_0x14f9b0(++_0xad6c39);}(_0xaf43,0xe1));var _0x3af4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xaf43[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x3af4('0x0'));module[_0x3af4('0x1')]={'name':{'type':Sequelize[_0x3af4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3af4('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3af4('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x3af4('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index b73949e..414e4d1 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 _0xa985=['reject','update','then','destroy','error','name','send','VtigerAccount','rawAttributes','fieldName','type','map','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','params','keys','includeAll','find','create','body','findOne','order','pick','getConfigurations','AccountId','Subjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','username','moduleName','accessKey','remoteUri','slice','substring','format','%s/webservice.php','GET','getchallenge','success','login','token','describe','result','sessionName','owner','includes','remove','false','startsWith','cf_','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x37b98e,_0x346b6a){var _0x5df77a=function(_0x27f2e7){while(--_0x27f2e7){_0x37b98e['push'](_0x37b98e['shift']());}};_0x5df77a(++_0x346b6a);}(_0xa985,0x139));var _0x5a98=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xa985[_0x256b72];return _0x2183e3;};'use strict';var emlformat=require(_0x5a98('0x0'));var rimraf=require(_0x5a98('0x1'));var zipdir=require(_0x5a98('0x2'));var jsonpatch=require(_0x5a98('0x3'));var rp=require('request-promise');var moment=require(_0x5a98('0x4'));var BPromise=require(_0x5a98('0x5'));var Mustache=require('mustache');var util=require(_0x5a98('0x6'));var path=require(_0x5a98('0x7'));var sox=require(_0x5a98('0x8'));var csv=require(_0x5a98('0x9'));var ejs=require(_0x5a98('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a98('0xb'));var squel=require(_0x5a98('0xc'));var crypto=require(_0x5a98('0xd'));var jsforce=require(_0x5a98('0xe'));var deskjs=require(_0x5a98('0xf'));var toCsv=require(_0x5a98('0x9'));var querystring=require(_0x5a98('0x10'));var Papa=require(_0x5a98('0x11'));var Redis=require('ioredis');var authService=require(_0x5a98('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a98('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5a98('0x14'));var config=require(_0x5a98('0x15'));var licenseUtil=require(_0x5a98('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5a98('0x17'));function respondWithStatusCode(_0x106805,_0x451f06){_0x451f06=_0x451f06||0xcc;return function(_0xa3b5d2){if(_0xa3b5d2){return _0x106805[_0x5a98('0x18')](_0x451f06);}return _0x106805[_0x5a98('0x19')](_0x451f06)[_0x5a98('0x1a')]();};}function respondWithResult(_0x4533ff,_0x28b452){_0x28b452=_0x28b452||0xc8;return function(_0x29c75d){if(_0x29c75d){return _0x4533ff[_0x5a98('0x19')](_0x28b452)[_0x5a98('0x1b')](_0x29c75d);}};}function respondWithFilteredResult(_0x492cc5,_0xd7e7f9){return function(_0xe14c76){if(_0xe14c76){var _0x323f1c=typeof _0xd7e7f9[_0x5a98('0x1c')]===_0x5a98('0x1d')&&typeof _0xd7e7f9[_0x5a98('0x1e')]==='undefined';var _0x3e82ff=_0xe14c76[_0x5a98('0x1f')];var _0x170cbf=_0x323f1c?0x0:_0xd7e7f9[_0x5a98('0x1c')];var _0x368ca5=_0x323f1c?_0xe14c76[_0x5a98('0x1f')]:_0xd7e7f9[_0x5a98('0x1c')]+_0xd7e7f9[_0x5a98('0x1e')];var _0x25b8dd;if(_0x368ca5>=_0x3e82ff){_0x368ca5=_0x3e82ff;_0x25b8dd=0xc8;}else{_0x25b8dd=0xce;}_0x492cc5[_0x5a98('0x19')](_0x25b8dd);return _0x492cc5[_0x5a98('0x20')](_0x5a98('0x21'),_0x170cbf+'-'+_0x368ca5+'/'+_0x3e82ff)[_0x5a98('0x1b')](_0xe14c76);}return null;};}function patchUpdates(_0x4d410c){return function(_0x2cd631){try{jsonpatch[_0x5a98('0x22')](_0x2cd631,_0x4d410c,!![]);}catch(_0x1f5a02){return BPromise[_0x5a98('0x23')](_0x1f5a02);}return _0x2cd631['save']();};}function saveUpdates(_0x450550,_0x5522b5){return function(_0x942237){if(_0x942237){return _0x942237[_0x5a98('0x24')](_0x450550)[_0x5a98('0x25')](function(_0x47dfaf){return _0x47dfaf;});}return null;};}function removeEntity(_0x2ddb9d,_0x59e028){return function(_0x215044){if(_0x215044){return _0x215044[_0x5a98('0x26')]()[_0x5a98('0x25')](function(){_0x2ddb9d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43db31,_0x4c3d9d){return function(_0x1a03a4){if(!_0x1a03a4){_0x43db31[_0x5a98('0x18')](0x194);}return _0x1a03a4;};}function handleError(_0x1c8230,_0x256602){_0x256602=_0x256602||0x1f4;return function(_0x37100e){logger[_0x5a98('0x27')](_0x37100e['stack']);if(_0x37100e[_0x5a98('0x28')]){delete _0x37100e[_0x5a98('0x28')];}_0x1c8230[_0x5a98('0x19')](_0x256602)[_0x5a98('0x29')](_0x37100e);};}exports['index']=function(_0x1ab6e6,_0x5a8388){var _0x182837={},_0x37b1c7={},_0x3235fe={'count':0x0,'rows':[]};var _0x3b5443=_['map'](db[_0x5a98('0x2a')][_0x5a98('0x2b')],function(_0x3ad46f){return{'name':_0x3ad46f[_0x5a98('0x2c')],'type':_0x3ad46f[_0x5a98('0x2d')]['key']};});_0x37b1c7['model']=_[_0x5a98('0x2e')](_0x3b5443,_0x5a98('0x28'));_0x37b1c7['query']=_['keys'](_0x1ab6e6[_0x5a98('0x2f')]);_0x37b1c7[_0x5a98('0x30')]=_[_0x5a98('0x31')](_0x37b1c7['model'],_0x37b1c7['query']);_0x182837['attributes']=_[_0x5a98('0x31')](_0x37b1c7['model'],qs[_0x5a98('0x32')](_0x1ab6e6[_0x5a98('0x2f')][_0x5a98('0x32')]));_0x182837['attributes']=_0x182837[_0x5a98('0x33')][_0x5a98('0x34')]?_0x182837[_0x5a98('0x33')]:_0x37b1c7[_0x5a98('0x35')];if(!_0x1ab6e6[_0x5a98('0x2f')][_0x5a98('0x36')](_0x5a98('0x37'))){_0x182837[_0x5a98('0x1e')]=qs[_0x5a98('0x1e')](_0x1ab6e6[_0x5a98('0x2f')]['limit']);_0x182837[_0x5a98('0x1c')]=qs[_0x5a98('0x1c')](_0x1ab6e6[_0x5a98('0x2f')][_0x5a98('0x1c')]);}_0x182837['order']=qs['sort'](_0x1ab6e6[_0x5a98('0x2f')][_0x5a98('0x38')]);_0x182837[_0x5a98('0x39')]=qs[_0x5a98('0x30')](_['pick'](_0x1ab6e6[_0x5a98('0x2f')],_0x37b1c7[_0x5a98('0x30')]),_0x3b5443);if(_0x1ab6e6['query'][_0x5a98('0x3a')]){_0x182837[_0x5a98('0x39')]=_[_0x5a98('0x3b')](_0x182837['where'],{'$or':_[_0x5a98('0x2e')](_0x3b5443,function(_0x5bc2eb){if(_0x5bc2eb[_0x5a98('0x2d')]!==_0x5a98('0x3c')){var _0x3b2ee1={};_0x3b2ee1[_0x5bc2eb[_0x5a98('0x28')]]={'$like':'%'+_0x1ab6e6[_0x5a98('0x2f')][_0x5a98('0x3a')]+'%'};return _0x3b2ee1;}})});}_0x182837=_[_0x5a98('0x3b')]({},_0x182837,_0x1ab6e6[_0x5a98('0x3d')]);var _0x1dec8c={'where':_0x182837[_0x5a98('0x39')]};return db[_0x5a98('0x2a')]['count'](_0x1dec8c)[_0x5a98('0x25')](function(_0x3d9b2e){_0x3235fe[_0x5a98('0x1f')]=_0x3d9b2e;if(_0x1ab6e6[_0x5a98('0x2f')]['includeAll']){_0x182837[_0x5a98('0x3e')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x182837);})[_0x5a98('0x25')](function(_0x2f591e){_0x3235fe[_0x5a98('0x3f')]=_0x2f591e;return _0x3235fe;})['then'](respondWithFilteredResult(_0x5a8388,_0x182837))[_0x5a98('0x40')](handleError(_0x5a8388,null));};exports['show']=function(_0x28d1f4,_0x321711){var _0x4c079a={'raw':![],'where':{'id':_0x28d1f4[_0x5a98('0x41')]['id']}},_0x1f62b1={};_0x1f62b1['model']=_[_0x5a98('0x42')](db[_0x5a98('0x2a')][_0x5a98('0x2b')]);_0x1f62b1['query']=_[_0x5a98('0x42')](_0x28d1f4['query']);_0x1f62b1[_0x5a98('0x30')]=_['intersection'](_0x1f62b1[_0x5a98('0x35')],_0x1f62b1[_0x5a98('0x2f')]);_0x4c079a['attributes']=_[_0x5a98('0x31')](_0x1f62b1[_0x5a98('0x35')],qs['fields'](_0x28d1f4[_0x5a98('0x2f')]['fields']));_0x4c079a['attributes']=_0x4c079a[_0x5a98('0x33')][_0x5a98('0x34')]?_0x4c079a[_0x5a98('0x33')]:_0x1f62b1[_0x5a98('0x35')];if(_0x28d1f4[_0x5a98('0x2f')][_0x5a98('0x43')]){_0x4c079a[_0x5a98('0x3e')]=[{'all':!![]}];}_0x4c079a=_[_0x5a98('0x3b')]({},_0x4c079a,_0x28d1f4[_0x5a98('0x3d')]);return db['VtigerAccount'][_0x5a98('0x44')](_0x4c079a)[_0x5a98('0x25')](handleEntityNotFound(_0x321711,null))[_0x5a98('0x25')](respondWithResult(_0x321711,null))[_0x5a98('0x40')](handleError(_0x321711,null));};exports[_0x5a98('0x45')]=function(_0x308a89,_0x3ad93f){return db[_0x5a98('0x2a')][_0x5a98('0x45')](_0x308a89[_0x5a98('0x46')],{})[_0x5a98('0x25')](respondWithResult(_0x3ad93f,0xc9))[_0x5a98('0x40')](handleError(_0x3ad93f,null));};exports[_0x5a98('0x24')]=function(_0x446784,_0x2a81d7){if(_0x446784['body']['id']){delete _0x446784[_0x5a98('0x46')]['id'];}return db[_0x5a98('0x2a')][_0x5a98('0x44')]({'where':{'id':_0x446784[_0x5a98('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a81d7,null))[_0x5a98('0x25')](saveUpdates(_0x446784[_0x5a98('0x46')],null))[_0x5a98('0x25')](respondWithResult(_0x2a81d7,null))[_0x5a98('0x40')](handleError(_0x2a81d7,null));};exports[_0x5a98('0x26')]=function(_0x5d723e,_0x3139ed){return db[_0x5a98('0x2a')]['find']({'where':{'id':_0x5d723e[_0x5a98('0x41')]['id']}})[_0x5a98('0x25')](handleEntityNotFound(_0x3139ed,null))[_0x5a98('0x25')](removeEntity(_0x3139ed,null))[_0x5a98('0x40')](handleError(_0x3139ed,null));};exports['getConfigurations']=function(_0x39ad58,_0x37daaa,_0x1ea807){var _0x4e6d9c={};var _0x46f56f={};var _0x3caf45;var _0x4ea690;return db[_0x5a98('0x2a')][_0x5a98('0x47')]({'where':{'id':_0x39ad58[_0x5a98('0x41')]['id']}})[_0x5a98('0x25')](handleEntityNotFound(_0x37daaa,null))[_0x5a98('0x25')](function(_0x1f6f40){if(_0x1f6f40){_0x3caf45=_0x1f6f40;_0x46f56f[_0x5a98('0x35')]=_[_0x5a98('0x42')](db['VtigerConfiguration'][_0x5a98('0x2b')]);_0x46f56f['query']=_[_0x5a98('0x42')](_0x39ad58['query']);_0x46f56f[_0x5a98('0x30')]=_[_0x5a98('0x31')](_0x46f56f['model'],_0x46f56f[_0x5a98('0x2f')]);_0x4e6d9c[_0x5a98('0x33')]=_[_0x5a98('0x31')](_0x46f56f[_0x5a98('0x35')],qs[_0x5a98('0x32')](_0x39ad58[_0x5a98('0x2f')][_0x5a98('0x32')]));_0x4e6d9c[_0x5a98('0x33')]=_0x4e6d9c['attributes']['length']?_0x4e6d9c['attributes']:_0x46f56f[_0x5a98('0x35')];_0x4e6d9c[_0x5a98('0x48')]=qs[_0x5a98('0x38')](_0x39ad58[_0x5a98('0x2f')][_0x5a98('0x38')]);_0x4e6d9c['where']=qs[_0x5a98('0x30')](_[_0x5a98('0x49')](_0x39ad58[_0x5a98('0x2f')],_0x46f56f['filters']));if(_0x39ad58[_0x5a98('0x2f')][_0x5a98('0x3a')]){_0x4e6d9c[_0x5a98('0x39')]=_[_0x5a98('0x3b')](_0x4e6d9c[_0x5a98('0x39')],{'$or':_[_0x5a98('0x2e')](_0x4e6d9c['attributes'],function(_0x5eb1a0){var _0x2da753={};_0x2da753[_0x5eb1a0]={'$like':'%'+_0x39ad58[_0x5a98('0x2f')]['filter']+'%'};return _0x2da753;})});}_0x4e6d9c=_[_0x5a98('0x3b')]({},_0x4e6d9c,_0x39ad58[_0x5a98('0x3d')]);return _0x3caf45['getConfigurations'](_0x4e6d9c);}})['then'](function(_0x335e01){if(_0x335e01){_0x4ea690=_0x335e01[_0x5a98('0x34')];if(!_0x39ad58['query']['hasOwnProperty']('nolimit')){_0x4e6d9c[_0x5a98('0x1e')]=qs['limit'](_0x39ad58[_0x5a98('0x2f')][_0x5a98('0x1e')]);_0x4e6d9c[_0x5a98('0x1c')]=qs[_0x5a98('0x1c')](_0x39ad58[_0x5a98('0x2f')]['offset']);}return _0x3caf45[_0x5a98('0x4a')](_0x4e6d9c);}})[_0x5a98('0x25')](function(_0x129d3e){if(_0x129d3e){return _0x129d3e?{'count':_0x4ea690,'rows':_0x129d3e}:null;}})[_0x5a98('0x25')](respondWithResult(_0x37daaa,null))[_0x5a98('0x40')](handleError(_0x37daaa,null));};exports['addConfiguration']=function(_0x4b8098,_0x1be6c3,_0x396572){if(_0x4b8098['body']['id']){delete _0x4b8098[_0x5a98('0x46')]['id'];}return db[_0x5a98('0x2a')][_0x5a98('0x47')]({'where':{'id':_0x4b8098[_0x5a98('0x41')]['id']}})[_0x5a98('0x25')](handleEntityNotFound(_0x1be6c3,null))[_0x5a98('0x25')](function(_0x20cec8){if(_0x20cec8){_0x4b8098[_0x5a98('0x46')][_0x5a98('0x4b')]=_0x20cec8['id'];_0x4b8098[_0x5a98('0x46')][_0x5a98('0x4c')]=integrations['getSubjects'](_0x4b8098[_0x5a98('0x46')][_0x5a98('0x4d')],_0x4b8098[_0x5a98('0x46')][_0x5a98('0x2d')]);_0x4b8098['body']['Descriptions']=integrations[_0x5a98('0x4e')](_0x4b8098['body'][_0x5a98('0x4d')],_0x4b8098['body'][_0x5a98('0x2d')]);return db[_0x5a98('0x4f')]['create'](_0x4b8098[_0x5a98('0x46')],{'include':[{'model':db[_0x5a98('0x50')],'as':_0x5a98('0x4c')},{'model':db[_0x5a98('0x50')],'as':_0x5a98('0x51')}]});}return null;})[_0x5a98('0x25')](respondWithResult(_0x1be6c3,null))[_0x5a98('0x40')](handleError(_0x1be6c3,null));};var md5=require(_0x5a98('0x52'));exports[_0x5a98('0x53')]=function(_0x3741d2,_0x5b4171,_0x22e508){var _0x109d94=null;var _0x4b2c50=null;var _0x340eed=null;var _0x5a545c=null;var _0x57fe57='';return db[_0x5a98('0x2a')][_0x5a98('0x47')]({'where':{'id':_0x3741d2[_0x5a98('0x41')]['id']},'attributes':['id',_0x5a98('0x28'),_0x5a98('0x54'),'description',_0x5a98('0x55'),'remoteUri','serverUrl',_0x5a98('0x56')]})[_0x5a98('0x25')](handleEntityNotFound(_0x5b4171,null))[_0x5a98('0x25')](function(_0x2b61e9){if(_0x2b61e9){_0x109d94=_0x2b61e9[_0x5a98('0x54')];_0x4b2c50=_0x2b61e9[_0x5a98('0x56')];_0x340eed=_0x2b61e9[_0x5a98('0x55')];_0x57fe57=_0x2b61e9[_0x5a98('0x57')];var _0x10e1c7=_0x57fe57[_0x5a98('0x58')](-0x1);if(_0x10e1c7==='/'){_0x57fe57=_0x57fe57[_0x5a98('0x59')](0x0,_0x57fe57['lastIndexOf'](_0x10e1c7));}_0x5a545c=util[_0x5a98('0x5a')](_0x5a98('0x5b'),_0x57fe57);var _0x466c49={'method':_0x5a98('0x5c'),'uri':_0x5a545c,'qs':{'operation':_0x5a98('0x5d'),'username':_0x2b61e9[_0x5a98('0x54')]},'json':!![]};return rp(_0x466c49);}})[_0x5a98('0x25')](function(_0x5b680f){if(_0x5b680f[_0x5a98('0x5e')]){var _0x3a3757={'method':'POST','uri':_0x5a545c,'form':{'operation':_0x5a98('0x5f'),'username':_0x109d94,'accessKey':md5(_0x5b680f['result'][_0x5a98('0x60')]+_0x4b2c50)},'json':!![]};return rp(_0x3a3757);}})[_0x5a98('0x25')](function(_0x29e5c6){if(_0x29e5c6[_0x5a98('0x5e')]){var _0x4249f4={'method':_0x5a98('0x5c'),'uri':_0x5a545c,'qs':{'operation':_0x5a98('0x61'),'username':_0x109d94,'sessionName':_0x29e5c6[_0x5a98('0x62')][_0x5a98('0x63')],'elementType':_0x340eed},'json':!![]};return rp(_0x4249f4);}})[_0x5a98('0x25')](function(_0x26ab87){if(_0x26ab87[_0x5a98('0x5e')]){var _0x472d7d=['autogenerated','reference',_0x5a98('0x64')];_['remove'](_0x26ab87[_0x5a98('0x62')]['fields'],function(_0x4400cb){return _0x472d7d[_0x5a98('0x65')](_0x4400cb['type']['name']);});_[_0x5a98('0x66')](_0x26ab87['result'][_0x5a98('0x32')],function(_0x2d7044){return _0x2d7044['editable']===_0x5a98('0x67');});return{'count':_0x26ab87['result'][_0x5a98('0x32')]['length'],'rows':_[_0x5a98('0x2e')](_0x26ab87[_0x5a98('0x62')][_0x5a98('0x32')],function(_0x59e7a0){return{'id':_0x59e7a0[_0x5a98('0x28')],'name':_0x59e7a0['label'],'custom':_[_0x5a98('0x68')](_0x59e7a0[_0x5a98('0x28')],_0x5a98('0x69'))?!![]:![],'options':_0x59e7a0[_0x5a98('0x2d')][_0x5a98('0x28')]==='picklist'&&_0x59e7a0['type'][_0x5a98('0x6a')]['length']>0x0?_['map'](_0x59e7a0['type'][_0x5a98('0x6a')],function(_0x18b645){return{'name':_0x18b645[_0x5a98('0x6b')],'value':_0x18b645[_0x5a98('0x6c')]};}):[]};})};}})['then'](respondWithResult(_0x5b4171,null))[_0x5a98('0x40')](function(_0x55b8be){console[_0x5a98('0x6d')](_0x5a98('0x6e')+_0x55b8be);var _0x19fb7d=_0x3741d2[_0x5a98('0x2f')][_0x5a98('0x6f')]?0x1f4:_0x55b8be[_0x5a98('0x70')]||0x1f4;logger[_0x5a98('0x27')](_0x5a98('0x71'),'getFields',_0x19fb7d,JSON[_0x5a98('0x72')](_0x55b8be));delete _0x55b8be[_0x5a98('0x28')];if(_0x19fb7d===0x191){_0x19fb7d=0x190;}_0x5b4171[_0x5a98('0x19')](_0x19fb7d)[_0x5a98('0x29')](_0x3741d2[_0x5a98('0x2f')][_0x5a98('0x6f')]?{'message':_0x5a98('0x73'),'statusCode':_0x55b8be[_0x5a98('0x70')]}:_0x55b8be);});}; \ No newline at end of file +var _0x0e9c=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','rawAttributes','options','create','body','update','find','getConfigurations','findOne','VtigerConfiguration','length','addConfiguration','AccountId','getSubjects','channel','VtigerField','Descriptions','md5','getFields','moduleName','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','username','POST','login','result','token','success','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','save','then','stack','name','send','index','map','VtigerAccount','fieldName','type','model','query'];(function(_0x19416d,_0x54c85e){var _0x17528f=function(_0x29fb3f){while(--_0x29fb3f){_0x19416d['push'](_0x19416d['shift']());}};_0x17528f(++_0x54c85e);}(_0x0e9c,0x134));var _0xc0e9=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x0e9c[_0x95411e];return _0x2c8718;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0e9('0x0'));var zipdir=require(_0xc0e9('0x1'));var jsonpatch=require(_0xc0e9('0x2'));var rp=require('request-promise');var moment=require(_0xc0e9('0x3'));var BPromise=require(_0xc0e9('0x4'));var Mustache=require(_0xc0e9('0x5'));var util=require(_0xc0e9('0x6'));var path=require(_0xc0e9('0x7'));var sox=require('sox');var csv=require(_0xc0e9('0x8'));var ejs=require(_0xc0e9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc0e9('0xa'));var squel=require(_0xc0e9('0xb'));var crypto=require(_0xc0e9('0xc'));var jsforce=require(_0xc0e9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc0e9('0x8'));var querystring=require(_0xc0e9('0xe'));var Papa=require('papaparse');var Redis=require(_0xc0e9('0xf'));var authService=require(_0xc0e9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc0e9('0x11'));var hardwareService=require(_0xc0e9('0x12'));var logger=require('../../config/logger')(_0xc0e9('0x13'));var utils=require(_0xc0e9('0x14'));var config=require(_0xc0e9('0x15'));var licenseUtil=require(_0xc0e9('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc0e9('0x17'));function respondWithStatusCode(_0x1857a7,_0x22559a){_0x22559a=_0x22559a||0xcc;return function(_0x14c552){if(_0x14c552){return _0x1857a7[_0xc0e9('0x18')](_0x22559a);}return _0x1857a7[_0xc0e9('0x19')](_0x22559a)[_0xc0e9('0x1a')]();};}function respondWithResult(_0x3772ea,_0x11a628){_0x11a628=_0x11a628||0xc8;return function(_0x41a444){if(_0x41a444){return _0x3772ea[_0xc0e9('0x19')](_0x11a628)['json'](_0x41a444);}};}function respondWithFilteredResult(_0x25d5c1,_0x80ff94){return function(_0x35b2b8){if(_0x35b2b8){var _0x392d27=typeof _0x80ff94['offset']===_0xc0e9('0x1b')&&typeof _0x80ff94[_0xc0e9('0x1c')]===_0xc0e9('0x1b');var _0x52489b=_0x35b2b8[_0xc0e9('0x1d')];var _0x1f8d49=_0x392d27?0x0:_0x80ff94['offset'];var _0x1677be=_0x392d27?_0x35b2b8[_0xc0e9('0x1d')]:_0x80ff94[_0xc0e9('0x1e')]+_0x80ff94['limit'];var _0x183bfe;if(_0x1677be>=_0x52489b){_0x1677be=_0x52489b;_0x183bfe=0xc8;}else{_0x183bfe=0xce;}_0x25d5c1['status'](_0x183bfe);return _0x25d5c1[_0xc0e9('0x1f')](_0xc0e9('0x20'),_0x1f8d49+'-'+_0x1677be+'/'+_0x52489b)[_0xc0e9('0x21')](_0x35b2b8);}return null;};}function patchUpdates(_0x4d19b5){return function(_0x37e691){try{jsonpatch['apply'](_0x37e691,_0x4d19b5,!![]);}catch(_0x5dee5d){return BPromise['reject'](_0x5dee5d);}return _0x37e691[_0xc0e9('0x22')]();};}function saveUpdates(_0x40f5a1,_0x273d91){return function(_0x394064){if(_0x394064){return _0x394064['update'](_0x40f5a1)[_0xc0e9('0x23')](function(_0x38ef66){return _0x38ef66;});}return null;};}function removeEntity(_0x286bd1,_0x3748ed){return function(_0x5b5949){if(_0x5b5949){return _0x5b5949['destroy']()[_0xc0e9('0x23')](function(){_0x286bd1[_0xc0e9('0x19')](0xcc)[_0xc0e9('0x1a')]();});}};}function handleEntityNotFound(_0x1c5f3c,_0x5b0c34){return function(_0x2f9906){if(!_0x2f9906){_0x1c5f3c[_0xc0e9('0x18')](0x194);}return _0x2f9906;};}function handleError(_0x5c62de,_0x2a5748){_0x2a5748=_0x2a5748||0x1f4;return function(_0xfd2226){logger['error'](_0xfd2226[_0xc0e9('0x24')]);if(_0xfd2226[_0xc0e9('0x25')]){delete _0xfd2226[_0xc0e9('0x25')];}_0x5c62de[_0xc0e9('0x19')](_0x2a5748)[_0xc0e9('0x26')](_0xfd2226);};}exports[_0xc0e9('0x27')]=function(_0x31f479,_0x4f5680){var _0x587c56={},_0x1f36b3={},_0x4dd0f1={'count':0x0,'rows':[]};var _0x10e9fc=_[_0xc0e9('0x28')](db[_0xc0e9('0x29')]['rawAttributes'],function(_0x3f9fdd){return{'name':_0x3f9fdd[_0xc0e9('0x2a')],'type':_0x3f9fdd[_0xc0e9('0x2b')]['key']};});_0x1f36b3[_0xc0e9('0x2c')]=_[_0xc0e9('0x28')](_0x10e9fc,'name');_0x1f36b3[_0xc0e9('0x2d')]=_['keys'](_0x31f479['query']);_0x1f36b3[_0xc0e9('0x2e')]=_['intersection'](_0x1f36b3[_0xc0e9('0x2c')],_0x1f36b3[_0xc0e9('0x2d')]);_0x587c56['attributes']=_[_0xc0e9('0x2f')](_0x1f36b3[_0xc0e9('0x2c')],qs['fields'](_0x31f479[_0xc0e9('0x2d')][_0xc0e9('0x30')]));_0x587c56[_0xc0e9('0x31')]=_0x587c56[_0xc0e9('0x31')]['length']?_0x587c56[_0xc0e9('0x31')]:_0x1f36b3['model'];if(!_0x31f479['query'][_0xc0e9('0x32')](_0xc0e9('0x33'))){_0x587c56[_0xc0e9('0x1c')]=qs[_0xc0e9('0x1c')](_0x31f479[_0xc0e9('0x2d')][_0xc0e9('0x1c')]);_0x587c56['offset']=qs[_0xc0e9('0x1e')](_0x31f479['query'][_0xc0e9('0x1e')]);}_0x587c56[_0xc0e9('0x34')]=qs[_0xc0e9('0x35')](_0x31f479[_0xc0e9('0x2d')][_0xc0e9('0x35')]);_0x587c56[_0xc0e9('0x36')]=qs[_0xc0e9('0x2e')](_['pick'](_0x31f479[_0xc0e9('0x2d')],_0x1f36b3[_0xc0e9('0x2e')]),_0x10e9fc);if(_0x31f479[_0xc0e9('0x2d')][_0xc0e9('0x37')]){_0x587c56[_0xc0e9('0x36')]=_[_0xc0e9('0x38')](_0x587c56[_0xc0e9('0x36')],{'$or':_[_0xc0e9('0x28')](_0x10e9fc,function(_0xe9e554){if(_0xe9e554['type']!==_0xc0e9('0x39')){var _0x2b1322={};_0x2b1322[_0xe9e554['name']]={'$like':'%'+_0x31f479[_0xc0e9('0x2d')]['filter']+'%'};return _0x2b1322;}})});}_0x587c56=_['merge']({},_0x587c56,_0x31f479['options']);var _0x42990c={'where':_0x587c56[_0xc0e9('0x36')]};return db['VtigerAccount'][_0xc0e9('0x1d')](_0x42990c)[_0xc0e9('0x23')](function(_0x35f43e){_0x4dd0f1['count']=_0x35f43e;if(_0x31f479[_0xc0e9('0x2d')][_0xc0e9('0x3a')]){_0x587c56[_0xc0e9('0x3b')]=[{'all':!![]}];}return db[_0xc0e9('0x29')][_0xc0e9('0x3c')](_0x587c56);})[_0xc0e9('0x23')](function(_0x39e536){_0x4dd0f1['rows']=_0x39e536;return _0x4dd0f1;})['then'](respondWithFilteredResult(_0x4f5680,_0x587c56))[_0xc0e9('0x3d')](handleError(_0x4f5680,null));};exports[_0xc0e9('0x3e')]=function(_0x1093ee,_0xc5b465){var _0x994cbb={'raw':![],'where':{'id':_0x1093ee[_0xc0e9('0x3f')]['id']}},_0x469959={};_0x469959['model']=_[_0xc0e9('0x40')](db[_0xc0e9('0x29')][_0xc0e9('0x41')]);_0x469959[_0xc0e9('0x2d')]=_['keys'](_0x1093ee[_0xc0e9('0x2d')]);_0x469959[_0xc0e9('0x2e')]=_[_0xc0e9('0x2f')](_0x469959['model'],_0x469959[_0xc0e9('0x2d')]);_0x994cbb['attributes']=_['intersection'](_0x469959[_0xc0e9('0x2c')],qs['fields'](_0x1093ee[_0xc0e9('0x2d')][_0xc0e9('0x30')]));_0x994cbb['attributes']=_0x994cbb[_0xc0e9('0x31')]['length']?_0x994cbb[_0xc0e9('0x31')]:_0x469959[_0xc0e9('0x2c')];if(_0x1093ee[_0xc0e9('0x2d')][_0xc0e9('0x3a')]){_0x994cbb['include']=[{'all':!![]}];}_0x994cbb=_[_0xc0e9('0x38')]({},_0x994cbb,_0x1093ee[_0xc0e9('0x42')]);return db['VtigerAccount']['find'](_0x994cbb)[_0xc0e9('0x23')](handleEntityNotFound(_0xc5b465,null))[_0xc0e9('0x23')](respondWithResult(_0xc5b465,null))[_0xc0e9('0x3d')](handleError(_0xc5b465,null));};exports[_0xc0e9('0x43')]=function(_0x8386c7,_0x383e83){return db[_0xc0e9('0x29')][_0xc0e9('0x43')](_0x8386c7[_0xc0e9('0x44')],{})[_0xc0e9('0x23')](respondWithResult(_0x383e83,0xc9))[_0xc0e9('0x3d')](handleError(_0x383e83,null));};exports[_0xc0e9('0x45')]=function(_0x54fedf,_0x6d467f){if(_0x54fedf[_0xc0e9('0x44')]['id']){delete _0x54fedf[_0xc0e9('0x44')]['id'];}return db[_0xc0e9('0x29')]['find']({'where':{'id':_0x54fedf[_0xc0e9('0x3f')]['id']}})[_0xc0e9('0x23')](handleEntityNotFound(_0x6d467f,null))[_0xc0e9('0x23')](saveUpdates(_0x54fedf[_0xc0e9('0x44')],null))[_0xc0e9('0x23')](respondWithResult(_0x6d467f,null))[_0xc0e9('0x3d')](handleError(_0x6d467f,null));};exports['destroy']=function(_0x3dcf92,_0x3b08c1){return db[_0xc0e9('0x29')][_0xc0e9('0x46')]({'where':{'id':_0x3dcf92['params']['id']}})[_0xc0e9('0x23')](handleEntityNotFound(_0x3b08c1,null))[_0xc0e9('0x23')](removeEntity(_0x3b08c1,null))[_0xc0e9('0x3d')](handleError(_0x3b08c1,null));};exports[_0xc0e9('0x47')]=function(_0x14e24d,_0x45a0c4,_0x30cebe){var _0x688a2={};var _0x54dfe6={};var _0x17abee;var _0x49162c;return db[_0xc0e9('0x29')][_0xc0e9('0x48')]({'where':{'id':_0x14e24d[_0xc0e9('0x3f')]['id']}})[_0xc0e9('0x23')](handleEntityNotFound(_0x45a0c4,null))['then'](function(_0xf2298c){if(_0xf2298c){_0x17abee=_0xf2298c;_0x54dfe6[_0xc0e9('0x2c')]=_[_0xc0e9('0x40')](db[_0xc0e9('0x49')]['rawAttributes']);_0x54dfe6[_0xc0e9('0x2d')]=_[_0xc0e9('0x40')](_0x14e24d['query']);_0x54dfe6[_0xc0e9('0x2e')]=_['intersection'](_0x54dfe6[_0xc0e9('0x2c')],_0x54dfe6['query']);_0x688a2['attributes']=_[_0xc0e9('0x2f')](_0x54dfe6[_0xc0e9('0x2c')],qs['fields'](_0x14e24d[_0xc0e9('0x2d')][_0xc0e9('0x30')]));_0x688a2[_0xc0e9('0x31')]=_0x688a2['attributes'][_0xc0e9('0x4a')]?_0x688a2[_0xc0e9('0x31')]:_0x54dfe6[_0xc0e9('0x2c')];_0x688a2[_0xc0e9('0x34')]=qs[_0xc0e9('0x35')](_0x14e24d[_0xc0e9('0x2d')][_0xc0e9('0x35')]);_0x688a2[_0xc0e9('0x36')]=qs[_0xc0e9('0x2e')](_['pick'](_0x14e24d['query'],_0x54dfe6[_0xc0e9('0x2e')]));if(_0x14e24d[_0xc0e9('0x2d')][_0xc0e9('0x37')]){_0x688a2[_0xc0e9('0x36')]=_[_0xc0e9('0x38')](_0x688a2[_0xc0e9('0x36')],{'$or':_[_0xc0e9('0x28')](_0x688a2[_0xc0e9('0x31')],function(_0x5440eb){var _0x164743={};_0x164743[_0x5440eb]={'$like':'%'+_0x14e24d[_0xc0e9('0x2d')][_0xc0e9('0x37')]+'%'};return _0x164743;})});}_0x688a2=_['merge']({},_0x688a2,_0x14e24d['options']);return _0x17abee[_0xc0e9('0x47')](_0x688a2);}})['then'](function(_0x462dd5){if(_0x462dd5){_0x49162c=_0x462dd5[_0xc0e9('0x4a')];if(!_0x14e24d[_0xc0e9('0x2d')][_0xc0e9('0x32')]('nolimit')){_0x688a2[_0xc0e9('0x1c')]=qs[_0xc0e9('0x1c')](_0x14e24d[_0xc0e9('0x2d')][_0xc0e9('0x1c')]);_0x688a2['offset']=qs['offset'](_0x14e24d[_0xc0e9('0x2d')]['offset']);}return _0x17abee['getConfigurations'](_0x688a2);}})[_0xc0e9('0x23')](function(_0x51bf07){if(_0x51bf07){return _0x51bf07?{'count':_0x49162c,'rows':_0x51bf07}:null;}})['then'](respondWithResult(_0x45a0c4,null))[_0xc0e9('0x3d')](handleError(_0x45a0c4,null));};exports[_0xc0e9('0x4b')]=function(_0x5266b3,_0x209295,_0x22e4f4){if(_0x5266b3[_0xc0e9('0x44')]['id']){delete _0x5266b3['body']['id'];}return db[_0xc0e9('0x29')][_0xc0e9('0x48')]({'where':{'id':_0x5266b3[_0xc0e9('0x3f')]['id']}})[_0xc0e9('0x23')](handleEntityNotFound(_0x209295,null))[_0xc0e9('0x23')](function(_0xcbb22f){if(_0xcbb22f){_0x5266b3[_0xc0e9('0x44')][_0xc0e9('0x4c')]=_0xcbb22f['id'];_0x5266b3['body']['Subjects']=integrations[_0xc0e9('0x4d')](_0x5266b3[_0xc0e9('0x44')]['channel'],_0x5266b3[_0xc0e9('0x44')]['type']);_0x5266b3[_0xc0e9('0x44')]['Descriptions']=integrations['getDescriptions'](_0x5266b3['body'][_0xc0e9('0x4e')],_0x5266b3[_0xc0e9('0x44')][_0xc0e9('0x2b')]);return db[_0xc0e9('0x49')]['create'](_0x5266b3[_0xc0e9('0x44')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xc0e9('0x4f')],'as':_0xc0e9('0x50')}]});}return null;})[_0xc0e9('0x23')](respondWithResult(_0x209295,null))[_0xc0e9('0x3d')](handleError(_0x209295,null));};var md5=require(_0xc0e9('0x51'));exports[_0xc0e9('0x52')]=function(_0x31b478,_0x368ee5,_0x283bcf){var _0xc6a041=null;var _0x3c5531=null;var _0x551f52=null;var _0x4696e4=null;var _0x18fcdd='';return db[_0xc0e9('0x29')][_0xc0e9('0x48')]({'where':{'id':_0x31b478[_0xc0e9('0x3f')]['id']},'attributes':['id','name','username','description',_0xc0e9('0x53'),'remoteUri',_0xc0e9('0x54'),_0xc0e9('0x55')]})[_0xc0e9('0x23')](handleEntityNotFound(_0x368ee5,null))[_0xc0e9('0x23')](function(_0x54357a){if(_0x54357a){_0xc6a041=_0x54357a['username'];_0x3c5531=_0x54357a[_0xc0e9('0x55')];_0x551f52=_0x54357a[_0xc0e9('0x53')];_0x18fcdd=_0x54357a['remoteUri'];var _0x675fc5=_0x18fcdd[_0xc0e9('0x56')](-0x1);if(_0x675fc5==='/'){_0x18fcdd=_0x18fcdd[_0xc0e9('0x57')](0x0,_0x18fcdd[_0xc0e9('0x58')](_0x675fc5));}_0x4696e4=util[_0xc0e9('0x59')](_0xc0e9('0x5a'),_0x18fcdd);var _0x1d3fa7={'method':_0xc0e9('0x5b'),'uri':_0x4696e4,'qs':{'operation':'getchallenge','username':_0x54357a[_0xc0e9('0x5c')]},'json':!![]};return rp(_0x1d3fa7);}})[_0xc0e9('0x23')](function(_0x3fa34e){if(_0x3fa34e['success']){var _0x2c591c={'method':_0xc0e9('0x5d'),'uri':_0x4696e4,'form':{'operation':_0xc0e9('0x5e'),'username':_0xc6a041,'accessKey':md5(_0x3fa34e[_0xc0e9('0x5f')][_0xc0e9('0x60')]+_0x3c5531)},'json':!![]};return rp(_0x2c591c);}})[_0xc0e9('0x23')](function(_0x239fb7){if(_0x239fb7[_0xc0e9('0x61')]){var _0x3893e1={'method':_0xc0e9('0x5b'),'uri':_0x4696e4,'qs':{'operation':'describe','username':_0xc6a041,'sessionName':_0x239fb7[_0xc0e9('0x5f')][_0xc0e9('0x62')],'elementType':_0x551f52},'json':!![]};return rp(_0x3893e1);}})[_0xc0e9('0x23')](function(_0xc6dbd0){if(_0xc6dbd0[_0xc0e9('0x61')]){var _0x1e84a3=[_0xc0e9('0x63'),_0xc0e9('0x64'),_0xc0e9('0x65')];_[_0xc0e9('0x66')](_0xc6dbd0['result'][_0xc0e9('0x30')],function(_0x779806){return _0x1e84a3[_0xc0e9('0x67')](_0x779806['type']['name']);});_['remove'](_0xc6dbd0[_0xc0e9('0x5f')][_0xc0e9('0x30')],function(_0x5e8274){return _0x5e8274[_0xc0e9('0x68')]===_0xc0e9('0x69');});return{'count':_0xc6dbd0[_0xc0e9('0x5f')][_0xc0e9('0x30')][_0xc0e9('0x4a')],'rows':_['map'](_0xc6dbd0[_0xc0e9('0x5f')][_0xc0e9('0x30')],function(_0x847241){return{'id':_0x847241[_0xc0e9('0x25')],'name':_0x847241[_0xc0e9('0x6a')],'custom':_[_0xc0e9('0x6b')](_0x847241[_0xc0e9('0x25')],_0xc0e9('0x6c'))?!![]:![],'options':_0x847241['type'][_0xc0e9('0x25')]==='picklist'&&_0x847241[_0xc0e9('0x2b')][_0xc0e9('0x6d')][_0xc0e9('0x4a')]>0x0?_[_0xc0e9('0x28')](_0x847241[_0xc0e9('0x2b')][_0xc0e9('0x6d')],function(_0x1dd60a){return{'name':_0x1dd60a[_0xc0e9('0x6a')],'value':_0x1dd60a[_0xc0e9('0x6e')]};}):[]};})};}})['then'](respondWithResult(_0x368ee5,null))[_0xc0e9('0x3d')](function(_0x264fd4){console[_0xc0e9('0x6f')](_0xc0e9('0x70')+_0x264fd4);var _0x55927f=_0x31b478[_0xc0e9('0x2d')][_0xc0e9('0x71')]?0x1f4:_0x264fd4['statusCode']||0x1f4;logger[_0xc0e9('0x72')](_0xc0e9('0x73'),'getFields',_0x55927f,JSON[_0xc0e9('0x74')](_0x264fd4));delete _0x264fd4[_0xc0e9('0x25')];if(_0x55927f===0x191){_0x55927f=0x190;}_0x368ee5[_0xc0e9('0x19')](_0x55927f)['send'](_0x31b478['query'][_0xc0e9('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x264fd4[_0xc0e9('0x75')]}:_0x264fd4);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 702fa65..fb74e0d 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 _0xe6f0=['exports','define','VtigerAccount','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x1f3f4f,_0x2eb964){var _0x1f85ec=function(_0x13189e){while(--_0x13189e){_0x1f3f4f['push'](_0x1f3f4f['shift']());}};_0x1f85ec(++_0x2eb964);}(_0xe6f0,0x153));var _0x0e6f=function(_0x1a9bd6,_0x20bcb8){_0x1a9bd6=_0x1a9bd6-0x0;var _0x8d30a5=_0xe6f0[_0x1a9bd6];return _0x8d30a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0e6f('0x0'))(_0x0e6f('0x1'));var moment=require(_0x0e6f('0x2'));var BPromise=require(_0x0e6f('0x3'));var rp=require(_0x0e6f('0x4'));var fs=require('fs');var path=require(_0x0e6f('0x5'));var rimraf=require(_0x0e6f('0x6'));var config=require('../../config/environment');var attributes=require(_0x0e6f('0x7'));var integrations=require(_0x0e6f('0x8'));module[_0x0e6f('0x9')]=function(_0x8e0d4a,_0x28c4f4){return _0x8e0d4a[_0x0e6f('0xa')](_0x0e6f('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x768f=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3350f9,_0x4b24cc){var _0x3a4ecc=function(_0x5be5e0){while(--_0x5be5e0){_0x3350f9['push'](_0x3350f9['shift']());}};_0x3a4ecc(++_0x4b24cc);}(_0x768f,0xdc));var _0xf768=function(_0x120a59,_0x108f04){_0x120a59=_0x120a59-0x0;var _0x53c72b=_0x768f[_0x120a59];return _0x53c72b;};'use strict';var _=require(_0xf768('0x0'));var util=require(_0xf768('0x1'));var logger=require('../../config/logger')(_0xf768('0x2'));var moment=require(_0xf768('0x3'));var BPromise=require(_0xf768('0x4'));var rp=require(_0xf768('0x5'));var fs=require('fs');var path=require(_0xf768('0x6'));var rimraf=require(_0xf768('0x7'));var config=require(_0xf768('0x8'));var attributes=require(_0xf768('0x9'));var integrations=require(_0xf768('0xa'));module['exports']=function(_0x54b0d2,_0x5dce4c){return _0x54b0d2[_0xf768('0xb')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 0e1bc1d..e7ae24d 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 _0x4ded=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','error','code','VtigerAccount,\x20%s,\x20%s','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','stringify','find','ShowVtigerAccount','lodash','util'];(function(_0x37f47c,_0xbefd31){var _0x8dee29=function(_0x1c4614){while(--_0x1c4614){_0x37f47c['push'](_0x37f47c['shift']());}};_0x8dee29(++_0xbefd31);}(_0x4ded,0x116));var _0xd4de=function(_0x244e36,_0x15c62c){_0x244e36=_0x244e36-0x0;var _0x754c53=_0x4ded[_0x244e36];return _0x754c53;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var moment=require(_0xd4de('0x2'));var BPromise=require(_0xd4de('0x3'));var rs=require(_0xd4de('0x4'));var fs=require('fs');var Redis=require(_0xd4de('0x5'));var db=require(_0xd4de('0x6'))['db'];var utils=require(_0xd4de('0x7'));var logger=require(_0xd4de('0x8'))(_0xd4de('0x9'));var config=require(_0xd4de('0xa'));var jayson=require(_0xd4de('0xb'));var client=jayson['client'][_0xd4de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2433b8,_0x15eb91,_0x2c56d5){return new BPromise(function(_0x4453c2,_0x1e8c35){return client['request'](_0x2433b8,_0x2c56d5)[_0xd4de('0xd')](function(_0x5ebcf3){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x15eb91,_0xd4de('0xe'));logger[_0xd4de('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x15eb91,'request\x20sent',JSON['stringify'](_0x5ebcf3));if(_0x5ebcf3[_0xd4de('0x10')]){if(_0x5ebcf3['error'][_0xd4de('0x11')]===0x1f4){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x1e8c35(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);return _0x4453c2(_0x5ebcf3[_0xd4de('0x10')][_0xd4de('0x13')]);}else{logger[_0xd4de('0x14')](_0xd4de('0x12'),_0x15eb91,_0xd4de('0xe'));_0x4453c2(_0x5ebcf3[_0xd4de('0x15')]['message']);}})['catch'](function(_0x3df820){logger[_0xd4de('0x10')](_0xd4de('0x12'),_0x15eb91,_0x3df820);_0x1e8c35(_0x3df820);});});}exports[_0xd4de('0x16')]=function(_0x5b1d1c){var _0x4d0df6=this;return new Promise(function(_0x1e91d5,_0x54b757){return db[_0xd4de('0x17')][_0xd4de('0x18')]({'raw':_0x5b1d1c['options']?_0x5b1d1c[_0xd4de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1a')]||null:null,'attributes':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c['options'][_0xd4de('0x1b')]||null:null,'limit':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1c')]||null:null,'include':_0x5b1d1c[_0xd4de('0x19')]?_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x5b1d1c[_0xd4de('0x19')][_0xd4de('0x1d')],function(_0x534b37){return{'model':db[_0x534b37[_0xd4de('0x1f')]],'as':_0x534b37['as'],'attributes':_0x534b37[_0xd4de('0x1b')],'include':_0x534b37[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x534b37[_0xd4de('0x1d')],function(_0x984904){return{'model':db[_0x984904[_0xd4de('0x1f')]],'as':_0x984904['as'],'attributes':_0x984904[_0xd4de('0x1b')],'include':_0x984904[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x984904[_0xd4de('0x1d')],function(_0xb2d8a1){return{'model':db[_0xb2d8a1['model']],'as':_0xb2d8a1['as'],'attributes':_0xb2d8a1[_0xd4de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd4de('0xd')](function(_0x5005b0){logger[_0xd4de('0x14')]('GetVtigerAccount',_0x5b1d1c);logger[_0xd4de('0xf')](_0xd4de('0x16'),_0x5b1d1c,JSON[_0xd4de('0x20')](_0x5005b0));_0x1e91d5(_0x5005b0);})['catch'](function(_0xd4de93){logger[_0xd4de('0x10')](_0xd4de('0x16'),_0xd4de93['message'],_0x5b1d1c);_0x54b757(_0x4d0df6[_0xd4de('0x10')](0x1f4,_0xd4de93[_0xd4de('0x13')]));});});};exports['ShowVtigerAccount']=function(_0x5103b5){var _0x5706fe=this;return new Promise(function(_0x3f6491,_0x496795){return db[_0xd4de('0x17')][_0xd4de('0x21')]({'raw':_0x5103b5[_0xd4de('0x19')]?_0x5103b5[_0xd4de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5103b5[_0xd4de('0x19')]?_0x5103b5[_0xd4de('0x19')]['where']||null:null,'attributes':_0x5103b5[_0xd4de('0x19')]?_0x5103b5[_0xd4de('0x19')]['attributes']||null:null,'include':_0x5103b5['options']?_0x5103b5[_0xd4de('0x19')][_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x5103b5[_0xd4de('0x19')]['include'],function(_0x2bdc98){return{'model':db[_0x2bdc98[_0xd4de('0x1f')]],'as':_0x2bdc98['as'],'attributes':_0x2bdc98['attributes'],'include':_0x2bdc98[_0xd4de('0x1d')]?_[_0xd4de('0x1e')](_0x2bdc98[_0xd4de('0x1d')],function(_0x34528a){return{'model':db[_0x34528a[_0xd4de('0x1f')]],'as':_0x34528a['as'],'attributes':_0x34528a[_0xd4de('0x1b')],'include':_0x34528a['include']?_['map'](_0x34528a[_0xd4de('0x1d')],function(_0x2d2fda){return{'model':db[_0x2d2fda[_0xd4de('0x1f')]],'as':_0x2d2fda['as'],'attributes':_0x2d2fda['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4de('0xd')](function(_0x44b96c){logger['info'](_0xd4de('0x22'),_0x5103b5);logger[_0xd4de('0xf')](_0xd4de('0x22'),_0x5103b5,JSON[_0xd4de('0x20')](_0x44b96c));_0x3f6491(_0x44b96c);})['catch'](function(_0x53d7dc){logger[_0xd4de('0x10')]('ShowVtigerAccount',_0x53d7dc[_0xd4de('0x13')],_0x5103b5);_0x496795(_0x5706fe['error'](0x1f4,_0x53d7dc[_0xd4de('0x13')]));});});}; \ No newline at end of file +var _0x6c76=['findAll','options','raw','where','attributes','map','include','model','GetVtigerAccount','debug','ShowVtigerAccount','VtigerAccount','find','then','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x44503c,_0xbfb69f){var _0x526847=function(_0x3205c1){while(--_0x3205c1){_0x44503c['push'](_0x44503c['shift']());}};_0x526847(++_0xbfb69f);}(_0x6c76,0x184));var _0x66c7=function(_0x2c1923,_0x5446e9){_0x2c1923=_0x2c1923-0x0;var _0x73c9b4=_0x6c76[_0x2c1923];return _0x73c9b4;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});}exports['GetVtigerAccount']=function(_0x5129f6){var _0x8ad572=this;return new Promise(function(_0x19f29d,_0x47a299){return db['VtigerAccount'][_0x66c7('0x14')]({'raw':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x5129f6['options']?_0x5129f6['options'][_0x66c7('0x17')]||null:null,'attributes':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'limit':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['limit']||null:null,'include':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['include']?_[_0x66c7('0x19')](_0x5129f6[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fc9d3){return{'model':db[_0x1fc9d3['model']],'as':_0x1fc9d3['as'],'attributes':_0x1fc9d3[_0x66c7('0x18')],'include':_0x1fc9d3[_0x66c7('0x1a')]?_['map'](_0x1fc9d3[_0x66c7('0x1a')],function(_0x11a6b9){return{'model':db[_0x11a6b9[_0x66c7('0x1b')]],'as':_0x11a6b9['as'],'attributes':_0x11a6b9[_0x66c7('0x18')],'include':_0x11a6b9[_0x66c7('0x1a')]?_['map'](_0x11a6b9['include'],function(_0x4e514a){return{'model':db[_0x4e514a[_0x66c7('0x1b')]],'as':_0x4e514a['as'],'attributes':_0x4e514a[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9afd50){logger[_0x66c7('0xa')](_0x66c7('0x1c'),_0x5129f6);logger[_0x66c7('0x1d')](_0x66c7('0x1c'),_0x5129f6,JSON[_0x66c7('0xe')](_0x9afd50));_0x19f29d(_0x9afd50);})['catch'](function(_0xccefb2){logger[_0x66c7('0xf')](_0x66c7('0x1c'),_0xccefb2[_0x66c7('0x11')],_0x5129f6);_0x47a299(_0x8ad572[_0x66c7('0xf')](0x1f4,_0xccefb2['message']));});});};exports[_0x66c7('0x1e')]=function(_0x4f1a34){var _0xfbd97=this;return new Promise(function(_0x543fbf,_0x296875){return db[_0x66c7('0x1f')][_0x66c7('0x20')]({'raw':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x4f1a34['options']?_0x4f1a34['options'][_0x66c7('0x17')]||null:null,'attributes':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'include':_0x4f1a34[_0x66c7('0x15')]?_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x4f1a34[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fd460){return{'model':db[_0x1fd460[_0x66c7('0x1b')]],'as':_0x1fd460['as'],'attributes':_0x1fd460['attributes'],'include':_0x1fd460['include']?_[_0x66c7('0x19')](_0x1fd460[_0x66c7('0x1a')],function(_0x367ad5){return{'model':db[_0x367ad5[_0x66c7('0x1b')]],'as':_0x367ad5['as'],'attributes':_0x367ad5[_0x66c7('0x18')],'include':_0x367ad5[_0x66c7('0x1a')]?_[_0x66c7('0x19')](_0x367ad5['include'],function(_0x30b90f){return{'model':db[_0x30b90f[_0x66c7('0x1b')]],'as':_0x30b90f['as'],'attributes':_0x30b90f[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x66c7('0x21')](function(_0x1e5993){logger[_0x66c7('0xa')](_0x66c7('0x1e'),_0x4f1a34);logger[_0x66c7('0x1d')](_0x66c7('0x1e'),_0x4f1a34,JSON[_0x66c7('0xe')](_0x1e5993));_0x543fbf(_0x1e5993);})[_0x66c7('0x13')](function(_0x4cd663){logger['error'](_0x66c7('0x1e'),_0x4cd663[_0x66c7('0x11')],_0x4f1a34);_0x296875(_0xfbd97[_0x66c7('0xf')](0x1f4,_0x4cd663['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 9c46a85..20fc8b0 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 _0x2b61=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x242349,_0x389cae){var _0x1b5bde=function(_0x48ec5b){while(--_0x48ec5b){_0x242349['push'](_0x242349['shift']());}};_0x1b5bde(++_0x389cae);}(_0x2b61,0x1dc));var _0x12b6=function(_0x5227ab,_0x514da4){_0x5227ab=_0x5227ab-0x0;var _0x3dc702=_0x2b61[_0x5227ab];return _0x3dc702;};'use strict';var multer=require('multer');var util=require(_0x12b6('0x0'));var path=require(_0x12b6('0x1'));var timeout=require(_0x12b6('0x2'));var express=require(_0x12b6('0x3'));var router=express[_0x12b6('0x4')]();var fs_extra=require(_0x12b6('0x5'));var auth=require(_0x12b6('0x6'));var interaction=require(_0x12b6('0x7'));var config=require(_0x12b6('0x8'));var controller=require(_0x12b6('0x9'));router[_0x12b6('0xa')]('/',auth[_0x12b6('0xb')](),controller['index']);router[_0x12b6('0xa')](_0x12b6('0xc'),auth[_0x12b6('0xb')](),controller[_0x12b6('0xd')]);router[_0x12b6('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x12b6('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x12b6('0xa')](_0x12b6('0xf'),auth[_0x12b6('0xb')](),controller[_0x12b6('0x10')]);router[_0x12b6('0x11')]('/',auth[_0x12b6('0xb')](),controller[_0x12b6('0x12')]);router[_0x12b6('0x13')](_0x12b6('0xc'),auth[_0x12b6('0xb')](),controller[_0x12b6('0x14')]);router[_0x12b6('0x15')](_0x12b6('0xc'),auth[_0x12b6('0xb')](),controller[_0x12b6('0x16')]);module[_0x12b6('0x17')]=router; \ No newline at end of file +var _0xad9c=['fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x12dcbd,_0x2853ee){var _0x24a82c=function(_0x57812a){while(--_0x57812a){_0x12dcbd['push'](_0x12dcbd['shift']());}};_0x24a82c(++_0x2853ee);}(_0xad9c,0x1dd));var _0xcad9=function(_0x5f480f,_0x334f28){_0x5f480f=_0x5f480f-0x0;var _0x2681ee=_0xad9c[_0x5f480f];return _0x2681ee;};'use strict';var multer=require(_0xcad9('0x0'));var util=require(_0xcad9('0x1'));var path=require(_0xcad9('0x2'));var timeout=require(_0xcad9('0x3'));var express=require(_0xcad9('0x4'));var router=express[_0xcad9('0x5')]();var fs_extra=require(_0xcad9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcad9('0x7'));var config=require('../../config/environment');var controller=require(_0xcad9('0x8'));router['get']('/',auth[_0xcad9('0x9')](),controller[_0xcad9('0xa')]);router[_0xcad9('0xb')](_0xcad9('0xc'),auth[_0xcad9('0x9')](),controller[_0xcad9('0xd')]);router['get']('/:id/fields',auth[_0xcad9('0x9')](),controller['getFields']);router[_0xcad9('0xb')](_0xcad9('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xcad9('0xb')](_0xcad9('0xf'),auth[_0xcad9('0x9')](),controller[_0xcad9('0x10')]);router[_0xcad9('0x11')]('/',auth[_0xcad9('0x9')](),controller[_0xcad9('0x12')]);router['put'](_0xcad9('0xc'),auth[_0xcad9('0x9')](),controller[_0xcad9('0x13')]);router[_0xcad9('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xcad9('0x15')]);module[_0xcad9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 53fe158..6bc7f2c 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 _0x16d7=['STRING','exports'];(function(_0x2fb80e,_0x2cae7a){var _0x5eeb1d=function(_0x1739d0){while(--_0x1739d0){_0x2fb80e['push'](_0x2fb80e['shift']());}};_0x5eeb1d(++_0x2cae7a);}(_0x16d7,0x169));var _0x716d=function(_0x2fbf2c,_0xb5a8f9){_0x2fbf2c=_0x2fbf2c-0x0;var _0x132005=_0x16d7[_0x2fbf2c];return _0x132005;};'use strict';var Sequelize=require('sequelize');module[_0x716d('0x0')]={'name':{'type':Sequelize[_0x716d('0x1')]},'description':{'type':Sequelize[_0x716d('0x1')]}}; \ No newline at end of file +var _0xfab0=['exports','STRING','sequelize'];(function(_0x3dda00,_0x392dca){var _0x2a6b26=function(_0x4634f3){while(--_0x4634f3){_0x3dda00['push'](_0x3dda00['shift']());}};_0x2a6b26(++_0x392dca);}(_0xfab0,0x1ac));var _0x0fab=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xfab0[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0x0fab('0x0'));module[_0x0fab('0x1')]={'name':{'type':Sequelize[_0x0fab('0x2')]},'description':{'type':Sequelize[_0x0fab('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index cd4ffb6..c72d77d 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 _0xe1fb=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','map','VtigerConfiguration','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','fields','options','create','body','find','destroy','getFields','findOne','VtigerField','rawAttributes','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5455e2,_0x4675b4){var _0x4c8a44=function(_0xd15cb8){while(--_0xd15cb8){_0x5455e2['push'](_0x5455e2['shift']());}};_0x4c8a44(++_0x4675b4);}(_0xe1fb,0xe1));var _0xbe1f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe1fb[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xbe1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe1f('0x1'));var jsonpatch=require(_0xbe1f('0x2'));var rp=require(_0xbe1f('0x3'));var moment=require(_0xbe1f('0x4'));var BPromise=require(_0xbe1f('0x5'));var Mustache=require('mustache');var util=require(_0xbe1f('0x6'));var path=require('path');var sox=require(_0xbe1f('0x7'));var csv=require(_0xbe1f('0x8'));var ejs=require(_0xbe1f('0x9'));var fs=require('fs');var fs_extra=require(_0xbe1f('0xa'));var _=require(_0xbe1f('0xb'));var squel=require(_0xbe1f('0xc'));var crypto=require(_0xbe1f('0xd'));var jsforce=require(_0xbe1f('0xe'));var deskjs=require(_0xbe1f('0xf'));var toCsv=require(_0xbe1f('0x8'));var querystring=require(_0xbe1f('0x10'));var Papa=require(_0xbe1f('0x11'));var Redis=require(_0xbe1f('0x12'));var authService=require(_0xbe1f('0x13'));var qs=require(_0xbe1f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe1f('0x15'));var logger=require(_0xbe1f('0x16'))('api');var utils=require(_0xbe1f('0x17'));var config=require(_0xbe1f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe1f('0x19'))['db'];function respondWithStatusCode(_0x52a7c6,_0x322791){_0x322791=_0x322791||0xcc;return function(_0x42f66a){if(_0x42f66a){return _0x52a7c6['sendStatus'](_0x322791);}return _0x52a7c6[_0xbe1f('0x1a')](_0x322791)[_0xbe1f('0x1b')]();};}function respondWithResult(_0xa46fc3,_0x3d4f90){_0x3d4f90=_0x3d4f90||0xc8;return function(_0x592548){if(_0x592548){return _0xa46fc3[_0xbe1f('0x1a')](_0x3d4f90)[_0xbe1f('0x1c')](_0x592548);}};}function respondWithFilteredResult(_0x1d1949,_0x15b204){return function(_0x400799){if(_0x400799){var _0x85b0b8=typeof _0x15b204[_0xbe1f('0x1d')]===_0xbe1f('0x1e')&&typeof _0x15b204[_0xbe1f('0x1f')]==='undefined';var _0x4ddced=_0x400799[_0xbe1f('0x20')];var _0x9d2049=_0x85b0b8?0x0:_0x15b204[_0xbe1f('0x1d')];var _0x42b9a6=_0x85b0b8?_0x400799[_0xbe1f('0x20')]:_0x15b204['offset']+_0x15b204[_0xbe1f('0x1f')];var _0x17b365;if(_0x42b9a6>=_0x4ddced){_0x42b9a6=_0x4ddced;_0x17b365=0xc8;}else{_0x17b365=0xce;}_0x1d1949[_0xbe1f('0x1a')](_0x17b365);return _0x1d1949['set'](_0xbe1f('0x21'),_0x9d2049+'-'+_0x42b9a6+'/'+_0x4ddced)['json'](_0x400799);}return null;};}function patchUpdates(_0x3ccb21){return function(_0x5a7de7){try{jsonpatch[_0xbe1f('0x22')](_0x5a7de7,_0x3ccb21,!![]);}catch(_0x4ef912){return BPromise[_0xbe1f('0x23')](_0x4ef912);}return _0x5a7de7[_0xbe1f('0x24')]();};}function saveUpdates(_0x26a541,_0x173dcd){return function(_0x2aa190){if(_0x2aa190){return _0x2aa190[_0xbe1f('0x25')](_0x26a541)[_0xbe1f('0x26')](function(_0x12184e){return _0x12184e;});}return null;};}function removeEntity(_0x11c722,_0xdfc536){return function(_0xc22c9b){if(_0xc22c9b){return _0xc22c9b['destroy']()['then'](function(){_0x11c722['status'](0xcc)[_0xbe1f('0x1b')]();});}};}function handleEntityNotFound(_0x1d6c8d,_0x55d3b2){return function(_0x2c2d96){if(!_0x2c2d96){_0x1d6c8d[_0xbe1f('0x27')](0x194);}return _0x2c2d96;};}function handleError(_0x129a4f,_0x2a83a1){_0x2a83a1=_0x2a83a1||0x1f4;return function(_0x312eba){logger[_0xbe1f('0x28')](_0x312eba['stack']);if(_0x312eba[_0xbe1f('0x29')]){delete _0x312eba[_0xbe1f('0x29')];}_0x129a4f[_0xbe1f('0x1a')](_0x2a83a1)[_0xbe1f('0x2a')](_0x312eba);};}exports['index']=function(_0x4ab40c,_0x5694f9){var _0x1e330a={},_0x307ff2={},_0x4e8989={'count':0x0,'rows':[]};var _0xb4a696=_[_0xbe1f('0x2b')](db[_0xbe1f('0x2c')]['rawAttributes'],function(_0x5b9712){return{'name':_0x5b9712['fieldName'],'type':_0x5b9712['type'][_0xbe1f('0x2d')]};});_0x307ff2['model']=_[_0xbe1f('0x2b')](_0xb4a696,_0xbe1f('0x29'));_0x307ff2[_0xbe1f('0x2e')]=_[_0xbe1f('0x2f')](_0x4ab40c[_0xbe1f('0x2e')]);_0x307ff2[_0xbe1f('0x30')]=_['intersection'](_0x307ff2[_0xbe1f('0x31')],_0x307ff2[_0xbe1f('0x2e')]);_0x1e330a[_0xbe1f('0x32')]=_[_0xbe1f('0x33')](_0x307ff2['model'],qs['fields'](_0x4ab40c[_0xbe1f('0x2e')]['fields']));_0x1e330a[_0xbe1f('0x32')]=_0x1e330a[_0xbe1f('0x32')][_0xbe1f('0x34')]?_0x1e330a[_0xbe1f('0x32')]:_0x307ff2[_0xbe1f('0x31')];if(!_0x4ab40c[_0xbe1f('0x2e')][_0xbe1f('0x35')]('nolimit')){_0x1e330a[_0xbe1f('0x1f')]=qs[_0xbe1f('0x1f')](_0x4ab40c[_0xbe1f('0x2e')]['limit']);_0x1e330a['offset']=qs[_0xbe1f('0x1d')](_0x4ab40c[_0xbe1f('0x2e')][_0xbe1f('0x1d')]);}_0x1e330a[_0xbe1f('0x36')]=qs[_0xbe1f('0x37')](_0x4ab40c[_0xbe1f('0x2e')][_0xbe1f('0x37')]);_0x1e330a[_0xbe1f('0x38')]=qs[_0xbe1f('0x30')](_[_0xbe1f('0x39')](_0x4ab40c[_0xbe1f('0x2e')],_0x307ff2['filters']),_0xb4a696);if(_0x4ab40c['query'][_0xbe1f('0x3a')]){_0x1e330a[_0xbe1f('0x38')]=_[_0xbe1f('0x3b')](_0x1e330a[_0xbe1f('0x38')],{'$or':_[_0xbe1f('0x2b')](_0xb4a696,function(_0x356a28){if(_0x356a28['type']!==_0xbe1f('0x3c')){var _0x3df8d8={};_0x3df8d8[_0x356a28['name']]={'$like':'%'+_0x4ab40c[_0xbe1f('0x2e')]['filter']+'%'};return _0x3df8d8;}})});}_0x1e330a=_['merge']({},_0x1e330a,_0x4ab40c['options']);var _0x4dbcae={'where':_0x1e330a[_0xbe1f('0x38')]};return db[_0xbe1f('0x2c')]['count'](_0x4dbcae)['then'](function(_0x23415b){_0x4e8989[_0xbe1f('0x20')]=_0x23415b;if(_0x4ab40c[_0xbe1f('0x2e')][_0xbe1f('0x3d')]){_0x1e330a[_0xbe1f('0x3e')]=[{'all':!![]}];}return db[_0xbe1f('0x2c')]['findAll'](_0x1e330a);})[_0xbe1f('0x26')](function(_0x2f319e){_0x4e8989[_0xbe1f('0x3f')]=_0x2f319e;return _0x4e8989;})[_0xbe1f('0x26')](respondWithFilteredResult(_0x5694f9,_0x1e330a))[_0xbe1f('0x40')](handleError(_0x5694f9,null));};exports['show']=function(_0x29cbbe,_0x1ae269){var _0x58049d={'raw':![],'where':{'id':_0x29cbbe[_0xbe1f('0x41')]['id']}},_0x10fc4d={};_0x10fc4d[_0xbe1f('0x31')]=_[_0xbe1f('0x2f')](db[_0xbe1f('0x2c')]['rawAttributes']);_0x10fc4d[_0xbe1f('0x2e')]=_[_0xbe1f('0x2f')](_0x29cbbe[_0xbe1f('0x2e')]);_0x10fc4d['filters']=_[_0xbe1f('0x33')](_0x10fc4d[_0xbe1f('0x31')],_0x10fc4d[_0xbe1f('0x2e')]);_0x58049d[_0xbe1f('0x32')]=_[_0xbe1f('0x33')](_0x10fc4d['model'],qs[_0xbe1f('0x42')](_0x29cbbe[_0xbe1f('0x2e')][_0xbe1f('0x42')]));_0x58049d[_0xbe1f('0x32')]=_0x58049d[_0xbe1f('0x32')]['length']?_0x58049d[_0xbe1f('0x32')]:_0x10fc4d[_0xbe1f('0x31')];if(_0x29cbbe['query'][_0xbe1f('0x3d')]){_0x58049d['include']=[{'all':!![]}];}_0x58049d=_[_0xbe1f('0x3b')]({},_0x58049d,_0x29cbbe[_0xbe1f('0x43')]);return db[_0xbe1f('0x2c')]['find'](_0x58049d)['then'](handleEntityNotFound(_0x1ae269,null))['then'](respondWithResult(_0x1ae269,null))[_0xbe1f('0x40')](handleError(_0x1ae269,null));};exports[_0xbe1f('0x44')]=function(_0x30d6ed,_0x393af9){return db[_0xbe1f('0x2c')][_0xbe1f('0x44')](_0x30d6ed['body'],{})[_0xbe1f('0x26')](respondWithResult(_0x393af9,0xc9))[_0xbe1f('0x40')](handleError(_0x393af9,null));};exports[_0xbe1f('0x25')]=function(_0x5e58ef,_0x3ec34c){if(_0x5e58ef[_0xbe1f('0x45')]['id']){delete _0x5e58ef['body']['id'];}return db['VtigerConfiguration'][_0xbe1f('0x46')]({'where':{'id':_0x5e58ef['params']['id']}})[_0xbe1f('0x26')](handleEntityNotFound(_0x3ec34c,null))[_0xbe1f('0x26')](saveUpdates(_0x5e58ef[_0xbe1f('0x45')],null))[_0xbe1f('0x26')](respondWithResult(_0x3ec34c,null))[_0xbe1f('0x40')](handleError(_0x3ec34c,null));};exports[_0xbe1f('0x47')]=function(_0x298aee,_0xf58222){return db[_0xbe1f('0x2c')]['find']({'where':{'id':_0x298aee['params']['id']}})['then'](handleEntityNotFound(_0xf58222,null))[_0xbe1f('0x26')](removeEntity(_0xf58222,null))['catch'](handleError(_0xf58222,null));};exports[_0xbe1f('0x48')]=function(_0xd3dea6,_0x1482ce,_0x33ae6c){var _0x3f3728={};var _0x2a3b46={};var _0x31f4c9;var _0x527677;return db['VtigerConfiguration'][_0xbe1f('0x49')]({'where':{'id':_0xd3dea6['params']['id']}})[_0xbe1f('0x26')](handleEntityNotFound(_0x1482ce,null))['then'](function(_0x2de8db){if(_0x2de8db){_0x31f4c9=_0x2de8db;_0x2a3b46[_0xbe1f('0x31')]=_[_0xbe1f('0x2f')](db[_0xbe1f('0x4a')][_0xbe1f('0x4b')]);_0x2a3b46['query']=_[_0xbe1f('0x2f')](_0xd3dea6[_0xbe1f('0x2e')]);_0x2a3b46[_0xbe1f('0x30')]=_['intersection'](_0x2a3b46[_0xbe1f('0x31')],_0x2a3b46['query']);_0x3f3728[_0xbe1f('0x32')]=_[_0xbe1f('0x33')](_0x2a3b46['model'],qs[_0xbe1f('0x42')](_0xd3dea6[_0xbe1f('0x2e')][_0xbe1f('0x42')]));_0x3f3728[_0xbe1f('0x32')]=_0x3f3728[_0xbe1f('0x32')][_0xbe1f('0x34')]?_0x3f3728[_0xbe1f('0x32')]:_0x2a3b46[_0xbe1f('0x31')];_0x3f3728[_0xbe1f('0x36')]=qs[_0xbe1f('0x37')](_0xd3dea6[_0xbe1f('0x2e')]['sort']);_0x3f3728[_0xbe1f('0x38')]=qs[_0xbe1f('0x30')](_[_0xbe1f('0x39')](_0xd3dea6[_0xbe1f('0x2e')],_0x2a3b46[_0xbe1f('0x30')]));if(_0xd3dea6['query'][_0xbe1f('0x3a')]){_0x3f3728[_0xbe1f('0x38')]=_['merge'](_0x3f3728[_0xbe1f('0x38')],{'$or':_[_0xbe1f('0x2b')](_0x3f3728[_0xbe1f('0x32')],function(_0x29d51d){var _0x3f8871={};_0x3f8871[_0x29d51d]={'$like':'%'+_0xd3dea6[_0xbe1f('0x2e')][_0xbe1f('0x3a')]+'%'};return _0x3f8871;})});}_0x3f3728=_[_0xbe1f('0x3b')]({},_0x3f3728,_0xd3dea6['options']);return _0x31f4c9[_0xbe1f('0x48')](_0x3f3728);}})[_0xbe1f('0x26')](function(_0x1addf9){if(_0x1addf9){_0x527677=_0x1addf9[_0xbe1f('0x34')];if(!_0xd3dea6[_0xbe1f('0x2e')][_0xbe1f('0x35')](_0xbe1f('0x4c'))){_0x3f3728['limit']=qs[_0xbe1f('0x1f')](_0xd3dea6[_0xbe1f('0x2e')][_0xbe1f('0x1f')]);_0x3f3728['offset']=qs[_0xbe1f('0x1d')](_0xd3dea6['query']['offset']);}return _0x31f4c9['getFields'](_0x3f3728);}})['then'](function(_0x28ad33){if(_0x28ad33){return _0x28ad33?{'count':_0x527677,'rows':_0x28ad33}:null;}})['then'](respondWithResult(_0x1482ce,null))[_0xbe1f('0x40')](handleError(_0x1482ce,null));};exports[_0xbe1f('0x4d')]=function(_0x3e0026,_0x268583,_0x27a6f2){var _0x48e054={};var _0x597968={};var _0x57d58d;var _0x4854ff;return db['VtigerConfiguration'][_0xbe1f('0x49')]({'where':{'id':_0x3e0026[_0xbe1f('0x41')]['id']}})[_0xbe1f('0x26')](handleEntityNotFound(_0x268583,null))['then'](function(_0x3e78fd){if(_0x3e78fd){_0x57d58d=_0x3e78fd;_0x597968[_0xbe1f('0x31')]=_[_0xbe1f('0x2f')](db['VtigerField'][_0xbe1f('0x4b')]);_0x597968['query']=_[_0xbe1f('0x2f')](_0x3e0026['query']);_0x597968[_0xbe1f('0x30')]=_[_0xbe1f('0x33')](_0x597968[_0xbe1f('0x31')],_0x597968[_0xbe1f('0x2e')]);_0x48e054[_0xbe1f('0x32')]=_[_0xbe1f('0x33')](_0x597968[_0xbe1f('0x31')],qs[_0xbe1f('0x42')](_0x3e0026[_0xbe1f('0x2e')]['fields']));_0x48e054[_0xbe1f('0x32')]=_0x48e054[_0xbe1f('0x32')][_0xbe1f('0x34')]?_0x48e054[_0xbe1f('0x32')]:_0x597968[_0xbe1f('0x31')];_0x48e054['order']=qs[_0xbe1f('0x37')](_0x3e0026[_0xbe1f('0x2e')][_0xbe1f('0x37')]);_0x48e054[_0xbe1f('0x38')]=qs[_0xbe1f('0x30')](_[_0xbe1f('0x39')](_0x3e0026[_0xbe1f('0x2e')],_0x597968[_0xbe1f('0x30')]));if(_0x3e0026[_0xbe1f('0x2e')][_0xbe1f('0x3a')]){_0x48e054['where']=_['merge'](_0x48e054['where'],{'$or':_[_0xbe1f('0x2b')](_0x48e054[_0xbe1f('0x32')],function(_0x54d9f6){var _0x167371={};_0x167371[_0x54d9f6]={'$like':'%'+_0x3e0026[_0xbe1f('0x2e')][_0xbe1f('0x3a')]+'%'};return _0x167371;})});}_0x48e054=_[_0xbe1f('0x3b')]({},_0x48e054,_0x3e0026['options']);return _0x57d58d[_0xbe1f('0x4d')](_0x48e054);}})[_0xbe1f('0x26')](function(_0x5ee576){if(_0x5ee576){_0x4854ff=_0x5ee576[_0xbe1f('0x34')];if(!_0x3e0026[_0xbe1f('0x2e')][_0xbe1f('0x35')](_0xbe1f('0x4c'))){_0x48e054[_0xbe1f('0x1f')]=qs[_0xbe1f('0x1f')](_0x3e0026[_0xbe1f('0x2e')][_0xbe1f('0x1f')]);_0x48e054[_0xbe1f('0x1d')]=qs[_0xbe1f('0x1d')](_0x3e0026[_0xbe1f('0x2e')]['offset']);}return _0x57d58d[_0xbe1f('0x4d')](_0x48e054);}})['then'](function(_0x405f51){if(_0x405f51){return _0x405f51?{'count':_0x4854ff,'rows':_0x405f51}:null;}})['then'](respondWithResult(_0x268583,null))['catch'](handleError(_0x268583,null));};exports[_0xbe1f('0x4e')]=function(_0x145beb,_0x29d49d,_0x1dfcb1){var _0x42d6b5={};var _0x468b0c={};var _0x536321;var _0x24375a;return db[_0xbe1f('0x2c')][_0xbe1f('0x49')]({'where':{'id':_0x145beb[_0xbe1f('0x41')]['id']}})['then'](handleEntityNotFound(_0x29d49d,null))[_0xbe1f('0x26')](function(_0xd3bc17){if(_0xd3bc17){_0x536321=_0xd3bc17;_0x468b0c[_0xbe1f('0x31')]=_[_0xbe1f('0x2f')](db[_0xbe1f('0x4a')][_0xbe1f('0x4b')]);_0x468b0c[_0xbe1f('0x2e')]=_['keys'](_0x145beb['query']);_0x468b0c[_0xbe1f('0x30')]=_[_0xbe1f('0x33')](_0x468b0c[_0xbe1f('0x31')],_0x468b0c[_0xbe1f('0x2e')]);_0x42d6b5[_0xbe1f('0x32')]=_[_0xbe1f('0x33')](_0x468b0c[_0xbe1f('0x31')],qs[_0xbe1f('0x42')](_0x145beb['query'][_0xbe1f('0x42')]));_0x42d6b5[_0xbe1f('0x32')]=_0x42d6b5[_0xbe1f('0x32')][_0xbe1f('0x34')]?_0x42d6b5[_0xbe1f('0x32')]:_0x468b0c[_0xbe1f('0x31')];_0x42d6b5[_0xbe1f('0x36')]=qs[_0xbe1f('0x37')](_0x145beb[_0xbe1f('0x2e')][_0xbe1f('0x37')]);_0x42d6b5[_0xbe1f('0x38')]=qs[_0xbe1f('0x30')](_['pick'](_0x145beb[_0xbe1f('0x2e')],_0x468b0c[_0xbe1f('0x30')]));if(_0x145beb[_0xbe1f('0x2e')][_0xbe1f('0x3a')]){_0x42d6b5[_0xbe1f('0x38')]=_[_0xbe1f('0x3b')](_0x42d6b5['where'],{'$or':_[_0xbe1f('0x2b')](_0x42d6b5[_0xbe1f('0x32')],function(_0x4661ad){var _0x5bbbcd={};_0x5bbbcd[_0x4661ad]={'$like':'%'+_0x145beb[_0xbe1f('0x2e')]['filter']+'%'};return _0x5bbbcd;})});}_0x42d6b5=_[_0xbe1f('0x3b')]({},_0x42d6b5,_0x145beb[_0xbe1f('0x43')]);return _0x536321[_0xbe1f('0x4e')](_0x42d6b5);}})[_0xbe1f('0x26')](function(_0x4239db){if(_0x4239db){_0x24375a=_0x4239db[_0xbe1f('0x34')];if(!_0x145beb['query']['hasOwnProperty'](_0xbe1f('0x4c'))){_0x42d6b5[_0xbe1f('0x1f')]=qs['limit'](_0x145beb['query'][_0xbe1f('0x1f')]);_0x42d6b5[_0xbe1f('0x1d')]=qs[_0xbe1f('0x1d')](_0x145beb[_0xbe1f('0x2e')][_0xbe1f('0x1d')]);}return _0x536321[_0xbe1f('0x4e')](_0x42d6b5);}})[_0xbe1f('0x26')](function(_0x46f226){if(_0x46f226){return _0x46f226?{'count':_0x24375a,'rows':_0x46f226}:null;}})[_0xbe1f('0x26')](respondWithResult(_0x29d49d,null))[_0xbe1f('0x40')](handleError(_0x29d49d,null));}; \ No newline at end of file +var _0xa96f=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','offset','count','set','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','type','key','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','model','rawAttributes','includeAll','include','catch','create','body','find','destroy','getFields','VtigerField','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa96f,0x13a));var _0xfa96=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0xa96f[_0x2932cf];return _0x1711dd;};'use strict';var emlformat=require(_0xfa96('0x0'));var rimraf=require(_0xfa96('0x1'));var zipdir=require(_0xfa96('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa96('0x3'));var moment=require(_0xfa96('0x4'));var BPromise=require(_0xfa96('0x5'));var Mustache=require('mustache');var util=require(_0xfa96('0x6'));var path=require(_0xfa96('0x7'));var sox=require(_0xfa96('0x8'));var csv=require(_0xfa96('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa96('0xa'));var squel=require(_0xfa96('0xb'));var crypto=require(_0xfa96('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfa96('0xd'));var Papa=require(_0xfa96('0xe'));var Redis=require(_0xfa96('0xf'));var authService=require(_0xfa96('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfa96('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa96('0x12'))(_0xfa96('0x13'));var utils=require(_0xfa96('0x14'));var config=require(_0xfa96('0x15'));var licenseUtil=require(_0xfa96('0x16'));var db=require(_0xfa96('0x17'))['db'];function respondWithStatusCode(_0x265eea,_0x7002f0){_0x7002f0=_0x7002f0||0xcc;return function(_0x4e79e5){if(_0x4e79e5){return _0x265eea['sendStatus'](_0x7002f0);}return _0x265eea[_0xfa96('0x18')](_0x7002f0)[_0xfa96('0x19')]();};}function respondWithResult(_0x4d2794,_0xaef490){_0xaef490=_0xaef490||0xc8;return function(_0x51d4de){if(_0x51d4de){return _0x4d2794[_0xfa96('0x18')](_0xaef490)['json'](_0x51d4de);}};}function respondWithFilteredResult(_0xea3170,_0x503800){return function(_0x24ffa6){if(_0x24ffa6){var _0x27b9ac=typeof _0x503800['offset']==='undefined'&&typeof _0x503800[_0xfa96('0x1a')]===_0xfa96('0x1b');var _0x224f96=_0x24ffa6['count'];var _0x20c885=_0x27b9ac?0x0:_0x503800[_0xfa96('0x1c')];var _0x111637=_0x27b9ac?_0x24ffa6[_0xfa96('0x1d')]:_0x503800[_0xfa96('0x1c')]+_0x503800['limit'];var _0x2f610b;if(_0x111637>=_0x224f96){_0x111637=_0x224f96;_0x2f610b=0xc8;}else{_0x2f610b=0xce;}_0xea3170[_0xfa96('0x18')](_0x2f610b);return _0xea3170[_0xfa96('0x1e')]('Content-Range',_0x20c885+'-'+_0x111637+'/'+_0x224f96)[_0xfa96('0x1f')](_0x24ffa6);}return null;};}function patchUpdates(_0x53bd1e){return function(_0x32a5c5){try{jsonpatch[_0xfa96('0x20')](_0x32a5c5,_0x53bd1e,!![]);}catch(_0x6d51c5){return BPromise[_0xfa96('0x21')](_0x6d51c5);}return _0x32a5c5[_0xfa96('0x22')]();};}function saveUpdates(_0x35b4c1,_0x1fdc14){return function(_0x39c1f9){if(_0x39c1f9){return _0x39c1f9[_0xfa96('0x23')](_0x35b4c1)[_0xfa96('0x24')](function(_0x1a9e70){return _0x1a9e70;});}return null;};}function removeEntity(_0x20bcd0,_0x1bbcb8){return function(_0x13b41e){if(_0x13b41e){return _0x13b41e['destroy']()[_0xfa96('0x24')](function(){_0x20bcd0['status'](0xcc)[_0xfa96('0x19')]();});}};}function handleEntityNotFound(_0x1a3d6d,_0x897cf6){return function(_0x4aa153){if(!_0x4aa153){_0x1a3d6d[_0xfa96('0x25')](0x194);}return _0x4aa153;};}function handleError(_0x2e43f1,_0x27475e){_0x27475e=_0x27475e||0x1f4;return function(_0x1dc565){logger[_0xfa96('0x26')](_0x1dc565[_0xfa96('0x27')]);if(_0x1dc565[_0xfa96('0x28')]){delete _0x1dc565[_0xfa96('0x28')];}_0x2e43f1['status'](_0x27475e)[_0xfa96('0x29')](_0x1dc565);};}exports[_0xfa96('0x2a')]=function(_0x4daac8,_0x1b5034){var _0x7a4bd6={},_0x4f589f={},_0x1abe1e={'count':0x0,'rows':[]};var _0x4b3505=_[_0xfa96('0x2b')](db[_0xfa96('0x2c')]['rawAttributes'],function(_0x256ced){return{'name':_0x256ced['fieldName'],'type':_0x256ced[_0xfa96('0x2d')][_0xfa96('0x2e')]};});_0x4f589f['model']=_['map'](_0x4b3505,_0xfa96('0x28'));_0x4f589f[_0xfa96('0x2f')]=_[_0xfa96('0x30')](_0x4daac8[_0xfa96('0x2f')]);_0x4f589f['filters']=_['intersection'](_0x4f589f['model'],_0x4f589f[_0xfa96('0x2f')]);_0x7a4bd6['attributes']=_[_0xfa96('0x31')](_0x4f589f['model'],qs[_0xfa96('0x32')](_0x4daac8[_0xfa96('0x2f')][_0xfa96('0x32')]));_0x7a4bd6['attributes']=_0x7a4bd6[_0xfa96('0x33')][_0xfa96('0x34')]?_0x7a4bd6[_0xfa96('0x33')]:_0x4f589f['model'];if(!_0x4daac8[_0xfa96('0x2f')][_0xfa96('0x35')](_0xfa96('0x36'))){_0x7a4bd6[_0xfa96('0x1a')]=qs[_0xfa96('0x1a')](_0x4daac8[_0xfa96('0x2f')][_0xfa96('0x1a')]);_0x7a4bd6[_0xfa96('0x1c')]=qs[_0xfa96('0x1c')](_0x4daac8[_0xfa96('0x2f')][_0xfa96('0x1c')]);}_0x7a4bd6[_0xfa96('0x37')]=qs['sort'](_0x4daac8['query'][_0xfa96('0x38')]);_0x7a4bd6['where']=qs[_0xfa96('0x39')](_[_0xfa96('0x3a')](_0x4daac8[_0xfa96('0x2f')],_0x4f589f['filters']),_0x4b3505);if(_0x4daac8[_0xfa96('0x2f')][_0xfa96('0x3b')]){_0x7a4bd6[_0xfa96('0x3c')]=_[_0xfa96('0x3d')](_0x7a4bd6[_0xfa96('0x3c')],{'$or':_[_0xfa96('0x2b')](_0x4b3505,function(_0x103810){if(_0x103810['type']!==_0xfa96('0x3e')){var _0x10857c={};_0x10857c[_0x103810[_0xfa96('0x28')]]={'$like':'%'+_0x4daac8[_0xfa96('0x2f')]['filter']+'%'};return _0x10857c;}})});}_0x7a4bd6=_[_0xfa96('0x3d')]({},_0x7a4bd6,_0x4daac8[_0xfa96('0x3f')]);var _0x156fa6={'where':_0x7a4bd6['where']};return db[_0xfa96('0x2c')][_0xfa96('0x1d')](_0x156fa6)[_0xfa96('0x24')](function(_0x1f0b09){_0x1abe1e[_0xfa96('0x1d')]=_0x1f0b09;if(_0x4daac8[_0xfa96('0x2f')]['includeAll']){_0x7a4bd6['include']=[{'all':!![]}];}return db[_0xfa96('0x2c')][_0xfa96('0x40')](_0x7a4bd6);})['then'](function(_0x16ae16){_0x1abe1e[_0xfa96('0x41')]=_0x16ae16;return _0x1abe1e;})[_0xfa96('0x24')](respondWithFilteredResult(_0x1b5034,_0x7a4bd6))['catch'](handleError(_0x1b5034,null));};exports[_0xfa96('0x42')]=function(_0x264329,_0x4d23cb){var _0x23e560={'raw':![],'where':{'id':_0x264329[_0xfa96('0x43')]['id']}},_0x240075={};_0x240075[_0xfa96('0x44')]=_['keys'](db['VtigerConfiguration'][_0xfa96('0x45')]);_0x240075[_0xfa96('0x2f')]=_[_0xfa96('0x30')](_0x264329[_0xfa96('0x2f')]);_0x240075[_0xfa96('0x39')]=_[_0xfa96('0x31')](_0x240075[_0xfa96('0x44')],_0x240075[_0xfa96('0x2f')]);_0x23e560[_0xfa96('0x33')]=_[_0xfa96('0x31')](_0x240075[_0xfa96('0x44')],qs[_0xfa96('0x32')](_0x264329[_0xfa96('0x2f')][_0xfa96('0x32')]));_0x23e560['attributes']=_0x23e560['attributes'][_0xfa96('0x34')]?_0x23e560[_0xfa96('0x33')]:_0x240075[_0xfa96('0x44')];if(_0x264329['query'][_0xfa96('0x46')]){_0x23e560[_0xfa96('0x47')]=[{'all':!![]}];}_0x23e560=_[_0xfa96('0x3d')]({},_0x23e560,_0x264329[_0xfa96('0x3f')]);return db[_0xfa96('0x2c')]['find'](_0x23e560)[_0xfa96('0x24')](handleEntityNotFound(_0x4d23cb,null))[_0xfa96('0x24')](respondWithResult(_0x4d23cb,null))[_0xfa96('0x48')](handleError(_0x4d23cb,null));};exports[_0xfa96('0x49')]=function(_0x21a557,_0x861807){return db[_0xfa96('0x2c')][_0xfa96('0x49')](_0x21a557[_0xfa96('0x4a')],{})['then'](respondWithResult(_0x861807,0xc9))[_0xfa96('0x48')](handleError(_0x861807,null));};exports[_0xfa96('0x23')]=function(_0x392f6d,_0x5ac6a1){if(_0x392f6d[_0xfa96('0x4a')]['id']){delete _0x392f6d[_0xfa96('0x4a')]['id'];}return db[_0xfa96('0x2c')][_0xfa96('0x4b')]({'where':{'id':_0x392f6d[_0xfa96('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ac6a1,null))[_0xfa96('0x24')](saveUpdates(_0x392f6d[_0xfa96('0x4a')],null))[_0xfa96('0x24')](respondWithResult(_0x5ac6a1,null))[_0xfa96('0x48')](handleError(_0x5ac6a1,null));};exports[_0xfa96('0x4c')]=function(_0x330c14,_0x29ba07){return db[_0xfa96('0x2c')][_0xfa96('0x4b')]({'where':{'id':_0x330c14[_0xfa96('0x43')]['id']}})[_0xfa96('0x24')](handleEntityNotFound(_0x29ba07,null))[_0xfa96('0x24')](removeEntity(_0x29ba07,null))[_0xfa96('0x48')](handleError(_0x29ba07,null));};exports[_0xfa96('0x4d')]=function(_0x4eb426,_0x30f7cd,_0x32134e){var _0xa4001e={};var _0x30bc4c={};var _0x1094ad;var _0x127621;return db[_0xfa96('0x2c')]['findOne']({'where':{'id':_0x4eb426['params']['id']}})[_0xfa96('0x24')](handleEntityNotFound(_0x30f7cd,null))[_0xfa96('0x24')](function(_0x16f867){if(_0x16f867){_0x1094ad=_0x16f867;_0x30bc4c[_0xfa96('0x44')]=_[_0xfa96('0x30')](db[_0xfa96('0x4e')][_0xfa96('0x45')]);_0x30bc4c['query']=_[_0xfa96('0x30')](_0x4eb426[_0xfa96('0x2f')]);_0x30bc4c[_0xfa96('0x39')]=_[_0xfa96('0x31')](_0x30bc4c[_0xfa96('0x44')],_0x30bc4c['query']);_0xa4001e[_0xfa96('0x33')]=_[_0xfa96('0x31')](_0x30bc4c[_0xfa96('0x44')],qs['fields'](_0x4eb426[_0xfa96('0x2f')]['fields']));_0xa4001e[_0xfa96('0x33')]=_0xa4001e['attributes'][_0xfa96('0x34')]?_0xa4001e[_0xfa96('0x33')]:_0x30bc4c['model'];_0xa4001e[_0xfa96('0x37')]=qs[_0xfa96('0x38')](_0x4eb426['query'][_0xfa96('0x38')]);_0xa4001e[_0xfa96('0x3c')]=qs[_0xfa96('0x39')](_[_0xfa96('0x3a')](_0x4eb426[_0xfa96('0x2f')],_0x30bc4c[_0xfa96('0x39')]));if(_0x4eb426[_0xfa96('0x2f')][_0xfa96('0x3b')]){_0xa4001e[_0xfa96('0x3c')]=_[_0xfa96('0x3d')](_0xa4001e[_0xfa96('0x3c')],{'$or':_[_0xfa96('0x2b')](_0xa4001e[_0xfa96('0x33')],function(_0x4981a3){var _0x4c41ef={};_0x4c41ef[_0x4981a3]={'$like':'%'+_0x4eb426[_0xfa96('0x2f')][_0xfa96('0x3b')]+'%'};return _0x4c41ef;})});}_0xa4001e=_[_0xfa96('0x3d')]({},_0xa4001e,_0x4eb426['options']);return _0x1094ad['getFields'](_0xa4001e);}})[_0xfa96('0x24')](function(_0x27ea84){if(_0x27ea84){_0x127621=_0x27ea84['length'];if(!_0x4eb426[_0xfa96('0x2f')][_0xfa96('0x35')]('nolimit')){_0xa4001e[_0xfa96('0x1a')]=qs[_0xfa96('0x1a')](_0x4eb426[_0xfa96('0x2f')][_0xfa96('0x1a')]);_0xa4001e[_0xfa96('0x1c')]=qs[_0xfa96('0x1c')](_0x4eb426[_0xfa96('0x2f')][_0xfa96('0x1c')]);}return _0x1094ad[_0xfa96('0x4d')](_0xa4001e);}})['then'](function(_0x20595f){if(_0x20595f){return _0x20595f?{'count':_0x127621,'rows':_0x20595f}:null;}})[_0xfa96('0x24')](respondWithResult(_0x30f7cd,null))[_0xfa96('0x48')](handleError(_0x30f7cd,null));};exports['getSubjects']=function(_0xb1b27c,_0x1d561b,_0x41af62){var _0x457add={};var _0x560381={};var _0x124287;var _0x52a1b7;return db[_0xfa96('0x2c')]['findOne']({'where':{'id':_0xb1b27c['params']['id']}})[_0xfa96('0x24')](handleEntityNotFound(_0x1d561b,null))[_0xfa96('0x24')](function(_0x19cad0){if(_0x19cad0){_0x124287=_0x19cad0;_0x560381['model']=_[_0xfa96('0x30')](db[_0xfa96('0x4e')][_0xfa96('0x45')]);_0x560381[_0xfa96('0x2f')]=_[_0xfa96('0x30')](_0xb1b27c[_0xfa96('0x2f')]);_0x560381['filters']=_[_0xfa96('0x31')](_0x560381[_0xfa96('0x44')],_0x560381[_0xfa96('0x2f')]);_0x457add[_0xfa96('0x33')]=_[_0xfa96('0x31')](_0x560381[_0xfa96('0x44')],qs[_0xfa96('0x32')](_0xb1b27c['query'][_0xfa96('0x32')]));_0x457add['attributes']=_0x457add[_0xfa96('0x33')][_0xfa96('0x34')]?_0x457add['attributes']:_0x560381['model'];_0x457add[_0xfa96('0x37')]=qs[_0xfa96('0x38')](_0xb1b27c['query'][_0xfa96('0x38')]);_0x457add[_0xfa96('0x3c')]=qs['filters'](_[_0xfa96('0x3a')](_0xb1b27c[_0xfa96('0x2f')],_0x560381[_0xfa96('0x39')]));if(_0xb1b27c['query'][_0xfa96('0x3b')]){_0x457add['where']=_[_0xfa96('0x3d')](_0x457add[_0xfa96('0x3c')],{'$or':_[_0xfa96('0x2b')](_0x457add[_0xfa96('0x33')],function(_0x3acd38){var _0x1cb941={};_0x1cb941[_0x3acd38]={'$like':'%'+_0xb1b27c[_0xfa96('0x2f')][_0xfa96('0x3b')]+'%'};return _0x1cb941;})});}_0x457add=_['merge']({},_0x457add,_0xb1b27c[_0xfa96('0x3f')]);return _0x124287[_0xfa96('0x4f')](_0x457add);}})[_0xfa96('0x24')](function(_0x5dc8a8){if(_0x5dc8a8){_0x52a1b7=_0x5dc8a8[_0xfa96('0x34')];if(!_0xb1b27c[_0xfa96('0x2f')][_0xfa96('0x35')](_0xfa96('0x36'))){_0x457add[_0xfa96('0x1a')]=qs[_0xfa96('0x1a')](_0xb1b27c[_0xfa96('0x2f')][_0xfa96('0x1a')]);_0x457add[_0xfa96('0x1c')]=qs[_0xfa96('0x1c')](_0xb1b27c['query'][_0xfa96('0x1c')]);}return _0x124287[_0xfa96('0x4f')](_0x457add);}})[_0xfa96('0x24')](function(_0x3c4604){if(_0x3c4604){return _0x3c4604?{'count':_0x52a1b7,'rows':_0x3c4604}:null;}})[_0xfa96('0x24')](respondWithResult(_0x1d561b,null))['catch'](handleError(_0x1d561b,null));};exports[_0xfa96('0x50')]=function(_0x3952bb,_0x396d66,_0x19931a){var _0x196f03={};var _0x267635={};var _0x2d36da;var _0x2679b8;return db[_0xfa96('0x2c')][_0xfa96('0x51')]({'where':{'id':_0x3952bb['params']['id']}})['then'](handleEntityNotFound(_0x396d66,null))[_0xfa96('0x24')](function(_0x520603){if(_0x520603){_0x2d36da=_0x520603;_0x267635[_0xfa96('0x44')]=_['keys'](db['VtigerField'][_0xfa96('0x45')]);_0x267635['query']=_[_0xfa96('0x30')](_0x3952bb[_0xfa96('0x2f')]);_0x267635[_0xfa96('0x39')]=_['intersection'](_0x267635[_0xfa96('0x44')],_0x267635['query']);_0x196f03['attributes']=_[_0xfa96('0x31')](_0x267635[_0xfa96('0x44')],qs['fields'](_0x3952bb['query'][_0xfa96('0x32')]));_0x196f03[_0xfa96('0x33')]=_0x196f03[_0xfa96('0x33')][_0xfa96('0x34')]?_0x196f03['attributes']:_0x267635['model'];_0x196f03[_0xfa96('0x37')]=qs[_0xfa96('0x38')](_0x3952bb[_0xfa96('0x2f')][_0xfa96('0x38')]);_0x196f03['where']=qs[_0xfa96('0x39')](_[_0xfa96('0x3a')](_0x3952bb[_0xfa96('0x2f')],_0x267635['filters']));if(_0x3952bb[_0xfa96('0x2f')][_0xfa96('0x3b')]){_0x196f03[_0xfa96('0x3c')]=_[_0xfa96('0x3d')](_0x196f03[_0xfa96('0x3c')],{'$or':_[_0xfa96('0x2b')](_0x196f03[_0xfa96('0x33')],function(_0x17bb04){var _0x1ca442={};_0x1ca442[_0x17bb04]={'$like':'%'+_0x3952bb[_0xfa96('0x2f')][_0xfa96('0x3b')]+'%'};return _0x1ca442;})});}_0x196f03=_[_0xfa96('0x3d')]({},_0x196f03,_0x3952bb['options']);return _0x2d36da[_0xfa96('0x50')](_0x196f03);}})[_0xfa96('0x24')](function(_0x33875b){if(_0x33875b){_0x2679b8=_0x33875b[_0xfa96('0x34')];if(!_0x3952bb[_0xfa96('0x2f')][_0xfa96('0x35')](_0xfa96('0x36'))){_0x196f03[_0xfa96('0x1a')]=qs['limit'](_0x3952bb[_0xfa96('0x2f')]['limit']);_0x196f03[_0xfa96('0x1c')]=qs[_0xfa96('0x1c')](_0x3952bb[_0xfa96('0x2f')][_0xfa96('0x1c')]);}return _0x2d36da[_0xfa96('0x50')](_0x196f03);}})[_0xfa96('0x24')](function(_0x559206){if(_0x559206){return _0x559206?{'count':_0x2679b8,'rows':_0x559206}:null;}})[_0xfa96('0x24')](respondWithResult(_0x396d66,null))[_0xfa96('0x48')](handleError(_0x396d66,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index da62340..2436259 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 _0x7207=['bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','util','api','moment'];(function(_0x5c38c3,_0x22c96f){var _0x4dfe8c=function(_0x1859a9){while(--_0x1859a9){_0x5c38c3['push'](_0x5c38c3['shift']());}};_0x4dfe8c(++_0x22c96f);}(_0x7207,0x105));var _0x7720=function(_0xbba984,_0x52aeb0){_0xbba984=_0xbba984-0x0;var _0x49024d=_0x7207[_0xbba984];return _0x49024d;};'use strict';var _=require('lodash');var util=require(_0x7720('0x0'));var logger=require('../../config/logger')(_0x7720('0x1'));var moment=require(_0x7720('0x2'));var BPromise=require(_0x7720('0x3'));var rp=require(_0x7720('0x4'));var fs=require('fs');var path=require(_0x7720('0x5'));var rimraf=require('rimraf');var config=require(_0x7720('0x6'));var attributes=require(_0x7720('0x7'));module[_0x7720('0x8')]=function(_0x73d887,_0x528e73){return _0x73d887['define'](_0x7720('0x9'),attributes,{'tableName':_0x7720('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe83f=['moment','bluebird','path','rimraf','./intVtigerConfiguration.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x294eba,_0x432e12){var _0x40e65f=function(_0x2efec3){while(--_0x2efec3){_0x294eba['push'](_0x294eba['shift']());}};_0x40e65f(++_0x432e12);}(_0xe83f,0x93));var _0xfe83=function(_0x39c641,_0xd05eb4){_0x39c641=_0x39c641-0x0;var _0x53f283=_0xe83f[_0x39c641];return _0x53f283;};'use strict';var _=require(_0xfe83('0x0'));var util=require(_0xfe83('0x1'));var logger=require(_0xfe83('0x2'))('api');var moment=require(_0xfe83('0x3'));var BPromise=require(_0xfe83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe83('0x5'));var rimraf=require(_0xfe83('0x6'));var config=require('../../config/environment');var attributes=require(_0xfe83('0x7'));module[_0xfe83('0x8')]=function(_0x1972d1,_0x2ecf00){return _0x1972d1[_0xfe83('0x9')]('VtigerConfiguration',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 ec8fffe..afd5495 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 _0xafa3=['client','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x19616a,_0x545c46){var _0x57bfb4=function(_0x9ab37b){while(--_0x9ab37b){_0x19616a['push'](_0x19616a['shift']());}};_0x57bfb4(++_0x545c46);}(_0xafa3,0xde));var _0x3afa=function(_0x3ec319,_0x319d9e){_0x3ec319=_0x3ec319-0x0;var _0x322b06=_0xafa3[_0x3ec319];return _0x322b06;};'use strict';var _=require('lodash');var util=require(_0x3afa('0x0'));var moment=require(_0x3afa('0x1'));var BPromise=require(_0x3afa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3afa('0x3'));var db=require(_0x3afa('0x4'))['db'];var utils=require(_0x3afa('0x5'));var logger=require(_0x3afa('0x6'))('rpc');var config=require(_0x3afa('0x7'));var jayson=require(_0x3afa('0x8'));var client=jayson[_0x3afa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184579,_0xd5a1db,_0xbce6b1){return new BPromise(function(_0x44cc76,_0x59768a){return client['request'](_0x184579,_0xbce6b1)['then'](function(_0x3beaa2){logger[_0x3afa('0xa')](_0x3afa('0xb'),_0xd5a1db,_0x3afa('0xc'));logger[_0x3afa('0xd')](_0x3afa('0xe'),_0xd5a1db,_0x3afa('0xc'),JSON[_0x3afa('0xf')](_0x3beaa2));if(_0x3beaa2['error']){if(_0x3beaa2[_0x3afa('0x10')][_0x3afa('0x11')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0xd5a1db,_0x3beaa2[_0x3afa('0x10')][_0x3afa('0x12')]);return _0x59768a(_0x3beaa2['error'][_0x3afa('0x12')]);}logger[_0x3afa('0x10')](_0x3afa('0xb'),_0xd5a1db,_0x3beaa2[_0x3afa('0x10')]['message']);return _0x44cc76(_0x3beaa2[_0x3afa('0x10')][_0x3afa('0x12')]);}else{logger[_0x3afa('0xa')](_0x3afa('0xb'),_0xd5a1db,_0x3afa('0xc'));_0x44cc76(_0x3beaa2[_0x3afa('0x13')][_0x3afa('0x12')]);}})[_0x3afa('0x14')](function(_0x5a5c60){logger[_0x3afa('0x10')](_0x3afa('0xb'),_0xd5a1db,_0x5a5c60);_0x59768a(_0x5a5c60);});});} \ No newline at end of file +var _0x1047=['error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1047,0x79));var _0x7104=function(_0x17b63f,_0x42c7bd){_0x17b63f=_0x17b63f-0x0;var _0x32bfd6=_0x1047[_0x17b63f];return _0x32bfd6;};'use strict';var _=require(_0x7104('0x0'));var util=require('util');var moment=require(_0x7104('0x1'));var BPromise=require(_0x7104('0x2'));var rs=require(_0x7104('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7104('0x4'));var logger=require(_0x7104('0x5'))(_0x7104('0x6'));var config=require(_0x7104('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7104('0x8')][_0x7104('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46dc65,_0x32df8b,_0x2248bf){return new BPromise(function(_0x2da5fa,_0x3ce041){return client[_0x7104('0xa')](_0x46dc65,_0x2248bf)[_0x7104('0xb')](function(_0x3add15){logger[_0x7104('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x32df8b,_0x7104('0xd'));logger[_0x7104('0xe')](_0x7104('0xf'),_0x32df8b,_0x7104('0xd'),JSON[_0x7104('0x10')](_0x3add15));if(_0x3add15[_0x7104('0x11')]){if(_0x3add15[_0x7104('0x11')][_0x7104('0x12')]===0x1f4){logger[_0x7104('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x32df8b,_0x3add15[_0x7104('0x11')][_0x7104('0x13')]);return _0x3ce041(_0x3add15[_0x7104('0x11')][_0x7104('0x13')]);}logger[_0x7104('0x11')](_0x7104('0x14'),_0x32df8b,_0x3add15[_0x7104('0x11')][_0x7104('0x13')]);return _0x2da5fa(_0x3add15['error'][_0x7104('0x13')]);}else{logger[_0x7104('0xc')](_0x7104('0x14'),_0x32df8b,'request\x20sent');_0x2da5fa(_0x3add15[_0x7104('0x15')]['message']);}})[_0x7104('0x16')](function(_0x23470e){logger[_0x7104('0x11')](_0x7104('0x14'),_0x32df8b,_0x23470e);_0x3ce041(_0x23470e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index a68bc42..4061c66 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 _0xb61d=['../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','create','put','/:id','update','exports','multer','path','connect-timeout','fs-extra'];(function(_0xd2f4a9,_0x526225){var _0x274da4=function(_0x22db45){while(--_0x22db45){_0xd2f4a9['push'](_0xd2f4a9['shift']());}};_0x274da4(++_0x526225);}(_0xb61d,0x182));var _0xdb61=function(_0x3c9427,_0x525030){_0x3c9427=_0x3c9427-0x0;var _0x550f0e=_0xb61d[_0x3c9427];return _0x550f0e;};'use strict';var multer=require(_0xdb61('0x0'));var util=require('util');var path=require(_0xdb61('0x1'));var timeout=require(_0xdb61('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdb61('0x3'));var auth=require(_0xdb61('0x4'));var interaction=require(_0xdb61('0x5'));var config=require('../../config/environment');var controller=require(_0xdb61('0x6'));router['get']('/',auth[_0xdb61('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xdb61('0x7')](),controller[_0xdb61('0x8')]);router[_0xdb61('0x9')](_0xdb61('0xa'),auth[_0xdb61('0x7')](),controller[_0xdb61('0xb')]);router['delete']('/:id',auth[_0xdb61('0x7')](),controller['destroy']);module[_0xdb61('0xc')]=router; \ No newline at end of file +var _0x56c8=['connect-timeout','express','Router','fs-extra','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update','multer','util'];(function(_0x23740e,_0xb9b72c){var _0x1a70c3=function(_0x575ace){while(--_0x575ace){_0x23740e['push'](_0x23740e['shift']());}};_0x1a70c3(++_0xb9b72c);}(_0x56c8,0x16e));var _0x856c=function(_0x5b7653,_0x32d3ba){_0x5b7653=_0x5b7653-0x0;var _0xe0148a=_0x56c8[_0x5b7653];return _0xe0148a;};'use strict';var multer=require(_0x856c('0x0'));var util=require(_0x856c('0x1'));var path=require('path');var timeout=require(_0x856c('0x2'));var express=require(_0x856c('0x3'));var router=express[_0x856c('0x4')]();var fs_extra=require(_0x856c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x856c('0x6'));var controller=require(_0x856c('0x7'));router[_0x856c('0x8')]('/',auth[_0x856c('0x9')](),controller[_0x856c('0xa')]);router[_0x856c('0x8')](_0x856c('0xb'),auth[_0x856c('0x9')](),controller[_0x856c('0xc')]);router['post']('/',auth[_0x856c('0x9')](),controller[_0x856c('0xd')]);router[_0x856c('0xe')](_0x856c('0xb'),auth[_0x856c('0x9')](),controller[_0x856c('0xf')]);router['delete'](_0x856c('0xb'),auth[_0x856c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 2c7b807..a4a5fe5 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 _0x9a43=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','sequelize'];(function(_0x454b96,_0xecdccc){var _0x3f27b1=function(_0x4ad486){while(--_0x4ad486){_0x454b96['push'](_0x454b96['shift']());}};_0x3f27b1(++_0xecdccc);}(_0x9a43,0xe0));var _0x39a4=function(_0x153faa,_0x75f2a){_0x153faa=_0x153faa-0x0;var _0x43c32a=_0x9a43[_0x153faa];return _0x43c32a;};'use strict';var Sequelize=require(_0x39a4('0x0'));module[_0x39a4('0x1')]={'type':{'type':Sequelize[_0x39a4('0x2')](_0x39a4('0x3'),'variable',_0x39a4('0x4'),_0x39a4('0x5'),_0x39a4('0x6')),'defaultValue':_0x39a4('0x3')},'content':{'type':Sequelize[_0x39a4('0x7')]},'key':{'type':Sequelize[_0x39a4('0x7')]},'keyType':{'type':Sequelize[_0x39a4('0x2')]('string',_0x39a4('0x8'),_0x39a4('0x4'))},'keyContent':{'type':Sequelize[_0x39a4('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x39a4('0x7')]}}; \ No newline at end of file +var _0x18f1=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x5e4b18,_0xf57d47){var _0x160187=function(_0xf452fd){while(--_0xf452fd){_0x5e4b18['push'](_0x5e4b18['shift']());}};_0x160187(++_0xf57d47);}(_0x18f1,0x1ea));var _0x118f=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x18f1[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x118f('0x0')](_0x118f('0x1'),_0x118f('0x2'),_0x118f('0x3'),'keyValue',_0x118f('0x4')),'defaultValue':_0x118f('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x118f('0x0')]('string',_0x118f('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x118f('0x5')]},'idField':{'type':Sequelize[_0x118f('0x5')]},'nameField':{'type':Sequelize[_0x118f('0x5')]},'customField':{'type':Sequelize[_0x118f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x118f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5a3a212..05995c2 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 _0x23a3=['reject','save','then','error','stack','name','send','index','map','VtigerField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x5c65b5,_0x35670c){var _0x36b468=function(_0x1da96f){while(--_0x1da96f){_0x5c65b5['push'](_0x5c65b5['shift']());}};_0x36b468(++_0x35670c);}(_0x23a3,0x1ac));var _0x323a=function(_0x55adee,_0x4d9108){_0x55adee=_0x55adee-0x0;var _0x5f0455=_0x23a3[_0x55adee];return _0x5f0455;};'use strict';var emlformat=require(_0x323a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x323a('0x1'));var jsonpatch=require(_0x323a('0x2'));var rp=require(_0x323a('0x3'));var moment=require(_0x323a('0x4'));var BPromise=require(_0x323a('0x5'));var Mustache=require(_0x323a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x323a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x323a('0x8'));var _=require('lodash');var squel=require(_0x323a('0x9'));var crypto=require(_0x323a('0xa'));var jsforce=require(_0x323a('0xb'));var deskjs=require(_0x323a('0xc'));var toCsv=require(_0x323a('0xd'));var querystring=require(_0x323a('0xe'));var Papa=require('papaparse');var Redis=require(_0x323a('0xf'));var authService=require(_0x323a('0x10'));var qs=require(_0x323a('0x11'));var as=require(_0x323a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x323a('0x13'))(_0x323a('0x14'));var utils=require(_0x323a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x323a('0x16'));var db=require(_0x323a('0x17'))['db'];function respondWithStatusCode(_0x37bacc,_0xec35c3){_0xec35c3=_0xec35c3||0xcc;return function(_0x200b45){if(_0x200b45){return _0x37bacc[_0x323a('0x18')](_0xec35c3);}return _0x37bacc[_0x323a('0x19')](_0xec35c3)[_0x323a('0x1a')]();};}function respondWithResult(_0x445bd2,_0x1c2028){_0x1c2028=_0x1c2028||0xc8;return function(_0x18db87){if(_0x18db87){return _0x445bd2['status'](_0x1c2028)[_0x323a('0x1b')](_0x18db87);}};}function respondWithFilteredResult(_0x51d792,_0x3688ff){return function(_0x359527){if(_0x359527){var _0x4243d5=typeof _0x3688ff[_0x323a('0x1c')]==='undefined'&&typeof _0x3688ff['limit']===_0x323a('0x1d');var _0x4ac740=_0x359527['count'];var _0x12e2f1=_0x4243d5?0x0:_0x3688ff[_0x323a('0x1c')];var _0x106ed5=_0x4243d5?_0x359527[_0x323a('0x1e')]:_0x3688ff[_0x323a('0x1c')]+_0x3688ff[_0x323a('0x1f')];var _0x4cb121;if(_0x106ed5>=_0x4ac740){_0x106ed5=_0x4ac740;_0x4cb121=0xc8;}else{_0x4cb121=0xce;}_0x51d792['status'](_0x4cb121);return _0x51d792[_0x323a('0x20')](_0x323a('0x21'),_0x12e2f1+'-'+_0x106ed5+'/'+_0x4ac740)['json'](_0x359527);}return null;};}function patchUpdates(_0x2d69dc){return function(_0x2e6da3){try{jsonpatch['apply'](_0x2e6da3,_0x2d69dc,!![]);}catch(_0xe8a615){return BPromise[_0x323a('0x22')](_0xe8a615);}return _0x2e6da3[_0x323a('0x23')]();};}function saveUpdates(_0x156e22,_0x3bfe12){return function(_0x54fbdc){if(_0x54fbdc){return _0x54fbdc['update'](_0x156e22)[_0x323a('0x24')](function(_0x51b98d){return _0x51b98d;});}return null;};}function removeEntity(_0x1a1946,_0x438028){return function(_0x5b762e){if(_0x5b762e){return _0x5b762e['destroy']()[_0x323a('0x24')](function(){_0x1a1946['status'](0xcc)[_0x323a('0x1a')]();});}};}function handleEntityNotFound(_0x520477,_0x227e7e){return function(_0x3bacc8){if(!_0x3bacc8){_0x520477[_0x323a('0x18')](0x194);}return _0x3bacc8;};}function handleError(_0x5b740b,_0xe6f8d0){_0xe6f8d0=_0xe6f8d0||0x1f4;return function(_0x2c8a33){logger[_0x323a('0x25')](_0x2c8a33[_0x323a('0x26')]);if(_0x2c8a33[_0x323a('0x27')]){delete _0x2c8a33[_0x323a('0x27')];}_0x5b740b[_0x323a('0x19')](_0xe6f8d0)[_0x323a('0x28')](_0x2c8a33);};}exports[_0x323a('0x29')]=function(_0x1523c4,_0xad6972){var _0x746de8={},_0x13650e={},_0x5a0020={'count':0x0,'rows':[]};var _0x7bbb8c=_[_0x323a('0x2a')](db[_0x323a('0x2b')]['rawAttributes'],function(_0x56238b){return{'name':_0x56238b[_0x323a('0x2c')],'type':_0x56238b[_0x323a('0x2d')][_0x323a('0x2e')]};});_0x13650e[_0x323a('0x2f')]=_['map'](_0x7bbb8c,_0x323a('0x27'));_0x13650e[_0x323a('0x30')]=_[_0x323a('0x31')](_0x1523c4[_0x323a('0x30')]);_0x13650e[_0x323a('0x32')]=_['intersection'](_0x13650e[_0x323a('0x2f')],_0x13650e['query']);_0x746de8['attributes']=_[_0x323a('0x33')](_0x13650e[_0x323a('0x2f')],qs[_0x323a('0x34')](_0x1523c4[_0x323a('0x30')]['fields']));_0x746de8[_0x323a('0x35')]=_0x746de8[_0x323a('0x35')][_0x323a('0x36')]?_0x746de8[_0x323a('0x35')]:_0x13650e[_0x323a('0x2f')];if(!_0x1523c4[_0x323a('0x30')]['hasOwnProperty'](_0x323a('0x37'))){_0x746de8[_0x323a('0x1f')]=qs[_0x323a('0x1f')](_0x1523c4[_0x323a('0x30')][_0x323a('0x1f')]);_0x746de8['offset']=qs[_0x323a('0x1c')](_0x1523c4[_0x323a('0x30')][_0x323a('0x1c')]);}_0x746de8[_0x323a('0x38')]=qs[_0x323a('0x39')](_0x1523c4['query'][_0x323a('0x39')]);_0x746de8[_0x323a('0x3a')]=qs['filters'](_[_0x323a('0x3b')](_0x1523c4[_0x323a('0x30')],_0x13650e[_0x323a('0x32')]),_0x7bbb8c);if(_0x1523c4[_0x323a('0x30')][_0x323a('0x3c')]){_0x746de8[_0x323a('0x3a')]=_[_0x323a('0x3d')](_0x746de8['where'],{'$or':_[_0x323a('0x2a')](_0x7bbb8c,function(_0x3f1a80){if(_0x3f1a80[_0x323a('0x2d')]!==_0x323a('0x3e')){var _0x38f898={};_0x38f898[_0x3f1a80[_0x323a('0x27')]]={'$like':'%'+_0x1523c4['query'][_0x323a('0x3c')]+'%'};return _0x38f898;}})});}_0x746de8=_['merge']({},_0x746de8,_0x1523c4[_0x323a('0x3f')]);var _0x31ac33={'where':_0x746de8[_0x323a('0x3a')]};return db[_0x323a('0x2b')][_0x323a('0x1e')](_0x31ac33)[_0x323a('0x24')](function(_0x3606a1){_0x5a0020['count']=_0x3606a1;if(_0x1523c4[_0x323a('0x30')][_0x323a('0x40')]){_0x746de8[_0x323a('0x41')]=[{'all':!![]}];}return db[_0x323a('0x2b')][_0x323a('0x42')](_0x746de8);})['then'](function(_0x445e35){_0x5a0020[_0x323a('0x43')]=_0x445e35;return _0x5a0020;})[_0x323a('0x24')](respondWithFilteredResult(_0xad6972,_0x746de8))[_0x323a('0x44')](handleError(_0xad6972,null));};exports[_0x323a('0x45')]=function(_0x26f020,_0x3d2c15){var _0x1f3972={'raw':!![],'where':{'id':_0x26f020['params']['id']}},_0x3e1b6b={};_0x3e1b6b[_0x323a('0x2f')]=_['keys'](db[_0x323a('0x2b')][_0x323a('0x46')]);_0x3e1b6b[_0x323a('0x30')]=_[_0x323a('0x31')](_0x26f020[_0x323a('0x30')]);_0x3e1b6b['filters']=_[_0x323a('0x33')](_0x3e1b6b[_0x323a('0x2f')],_0x3e1b6b[_0x323a('0x30')]);_0x1f3972[_0x323a('0x35')]=_[_0x323a('0x33')](_0x3e1b6b[_0x323a('0x2f')],qs[_0x323a('0x34')](_0x26f020[_0x323a('0x30')][_0x323a('0x34')]));_0x1f3972[_0x323a('0x35')]=_0x1f3972[_0x323a('0x35')]['length']?_0x1f3972['attributes']:_0x3e1b6b['model'];if(_0x26f020[_0x323a('0x30')]['includeAll']){_0x1f3972[_0x323a('0x41')]=[{'all':!![]}];}_0x1f3972=_[_0x323a('0x3d')]({},_0x1f3972,_0x26f020[_0x323a('0x3f')]);return db[_0x323a('0x2b')][_0x323a('0x47')](_0x1f3972)[_0x323a('0x24')](handleEntityNotFound(_0x3d2c15,null))[_0x323a('0x24')](respondWithResult(_0x3d2c15,null))[_0x323a('0x44')](handleError(_0x3d2c15,null));};exports[_0x323a('0x48')]=function(_0x4ccbf7,_0x4bb6bf){return db[_0x323a('0x2b')][_0x323a('0x48')](_0x4ccbf7[_0x323a('0x49')],{})[_0x323a('0x24')](respondWithResult(_0x4bb6bf,0xc9))[_0x323a('0x44')](handleError(_0x4bb6bf,null));};exports[_0x323a('0x4a')]=function(_0x5056d5,_0x1b466f){if(_0x5056d5[_0x323a('0x49')]['id']){delete _0x5056d5[_0x323a('0x49')]['id'];}return db[_0x323a('0x2b')][_0x323a('0x47')]({'where':{'id':_0x5056d5[_0x323a('0x4b')]['id']}})[_0x323a('0x24')](handleEntityNotFound(_0x1b466f,null))[_0x323a('0x24')](saveUpdates(_0x5056d5[_0x323a('0x49')],null))[_0x323a('0x24')](respondWithResult(_0x1b466f,null))['catch'](handleError(_0x1b466f,null));};exports[_0x323a('0x4c')]=function(_0x4287a3,_0x2e17ec){return db[_0x323a('0x2b')][_0x323a('0x47')]({'where':{'id':_0x4287a3[_0x323a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e17ec,null))[_0x323a('0x24')](removeEntity(_0x2e17ec,null))['catch'](handleError(_0x2e17ec,null));}; \ No newline at end of file +var _0xfea6=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','VtigerField','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x485034,_0x43f507){var _0x34e386=function(_0x520f8e){while(--_0x520f8e){_0x485034['push'](_0x485034['shift']());}};_0x34e386(++_0x43f507);}(_0xfea6,0x19a));var _0x6fea=function(_0x5e3d96,_0x591394){_0x5e3d96=_0x5e3d96-0x0;var _0x4c349a=_0xfea6[_0x5e3d96];return _0x4c349a;};'use strict';var emlformat=require(_0x6fea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6fea('0x1'));var jsonpatch=require(_0x6fea('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6fea('0x3'));var Mustache=require(_0x6fea('0x4'));var util=require(_0x6fea('0x5'));var path=require(_0x6fea('0x6'));var sox=require(_0x6fea('0x7'));var csv=require('to-csv');var ejs=require(_0x6fea('0x8'));var fs=require('fs');var fs_extra=require(_0x6fea('0x9'));var _=require(_0x6fea('0xa'));var squel=require(_0x6fea('0xb'));var crypto=require(_0x6fea('0xc'));var jsforce=require(_0x6fea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6fea('0xe'));var querystring=require(_0x6fea('0xf'));var Papa=require('papaparse');var Redis=require(_0x6fea('0x10'));var authService=require(_0x6fea('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6fea('0x12'));var hardwareService=require(_0x6fea('0x13'));var logger=require(_0x6fea('0x14'))(_0x6fea('0x15'));var utils=require('../../config/utils');var config=require(_0x6fea('0x16'));var licenseUtil=require(_0x6fea('0x17'));var db=require(_0x6fea('0x18'))['db'];function respondWithStatusCode(_0x32ce79,_0x1cb4b6){_0x1cb4b6=_0x1cb4b6||0xcc;return function(_0x28c147){if(_0x28c147){return _0x32ce79[_0x6fea('0x19')](_0x1cb4b6);}return _0x32ce79['status'](_0x1cb4b6)['end']();};}function respondWithResult(_0x428b04,_0x463177){_0x463177=_0x463177||0xc8;return function(_0x27f226){if(_0x27f226){return _0x428b04[_0x6fea('0x1a')](_0x463177)['json'](_0x27f226);}};}function respondWithFilteredResult(_0x1adb28,_0xa83949){return function(_0x2d0773){if(_0x2d0773){var _0x1126c5=typeof _0xa83949[_0x6fea('0x1b')]===_0x6fea('0x1c')&&typeof _0xa83949[_0x6fea('0x1d')]===_0x6fea('0x1c');var _0x3b4d4d=_0x2d0773['count'];var _0x5d5601=_0x1126c5?0x0:_0xa83949[_0x6fea('0x1b')];var _0x25dfe4=_0x1126c5?_0x2d0773[_0x6fea('0x1e')]:_0xa83949['offset']+_0xa83949[_0x6fea('0x1d')];var _0x5f5434;if(_0x25dfe4>=_0x3b4d4d){_0x25dfe4=_0x3b4d4d;_0x5f5434=0xc8;}else{_0x5f5434=0xce;}_0x1adb28['status'](_0x5f5434);return _0x1adb28['set'](_0x6fea('0x1f'),_0x5d5601+'-'+_0x25dfe4+'/'+_0x3b4d4d)['json'](_0x2d0773);}return null;};}function patchUpdates(_0x582ebe){return function(_0x1202b3){try{jsonpatch[_0x6fea('0x20')](_0x1202b3,_0x582ebe,!![]);}catch(_0x2465fb){return BPromise[_0x6fea('0x21')](_0x2465fb);}return _0x1202b3[_0x6fea('0x22')]();};}function saveUpdates(_0x4ddcd7,_0x4d18d1){return function(_0x44c760){if(_0x44c760){return _0x44c760[_0x6fea('0x23')](_0x4ddcd7)[_0x6fea('0x24')](function(_0x41c827){return _0x41c827;});}return null;};}function removeEntity(_0x3df7a2,_0x1514d0){return function(_0x395a44){if(_0x395a44){return _0x395a44[_0x6fea('0x25')]()['then'](function(){_0x3df7a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f879,_0x2a9645){return function(_0x4ba933){if(!_0x4ba933){_0x50f879[_0x6fea('0x19')](0x194);}return _0x4ba933;};}function handleError(_0x4edd37,_0x50b397){_0x50b397=_0x50b397||0x1f4;return function(_0x4f05a2){logger[_0x6fea('0x26')](_0x4f05a2[_0x6fea('0x27')]);if(_0x4f05a2[_0x6fea('0x28')]){delete _0x4f05a2[_0x6fea('0x28')];}_0x4edd37['status'](_0x50b397)[_0x6fea('0x29')](_0x4f05a2);};}exports['index']=function(_0x406a49,_0xa7294f){var _0x4fc22f={},_0x23e192={},_0x11e72c={'count':0x0,'rows':[]};var _0x5adc57=_['map'](db[_0x6fea('0x2a')][_0x6fea('0x2b')],function(_0x46241a){return{'name':_0x46241a[_0x6fea('0x2c')],'type':_0x46241a[_0x6fea('0x2d')]['key']};});_0x23e192[_0x6fea('0x2e')]=_[_0x6fea('0x2f')](_0x5adc57,'name');_0x23e192[_0x6fea('0x30')]=_['keys'](_0x406a49['query']);_0x23e192['filters']=_[_0x6fea('0x31')](_0x23e192[_0x6fea('0x2e')],_0x23e192[_0x6fea('0x30')]);_0x4fc22f[_0x6fea('0x32')]=_[_0x6fea('0x31')](_0x23e192[_0x6fea('0x2e')],qs[_0x6fea('0x33')](_0x406a49[_0x6fea('0x30')][_0x6fea('0x33')]));_0x4fc22f['attributes']=_0x4fc22f[_0x6fea('0x32')]['length']?_0x4fc22f[_0x6fea('0x32')]:_0x23e192[_0x6fea('0x2e')];if(!_0x406a49[_0x6fea('0x30')][_0x6fea('0x34')](_0x6fea('0x35'))){_0x4fc22f[_0x6fea('0x1d')]=qs[_0x6fea('0x1d')](_0x406a49[_0x6fea('0x30')][_0x6fea('0x1d')]);_0x4fc22f[_0x6fea('0x1b')]=qs[_0x6fea('0x1b')](_0x406a49[_0x6fea('0x30')][_0x6fea('0x1b')]);}_0x4fc22f[_0x6fea('0x36')]=qs[_0x6fea('0x37')](_0x406a49[_0x6fea('0x30')][_0x6fea('0x37')]);_0x4fc22f[_0x6fea('0x38')]=qs[_0x6fea('0x39')](_[_0x6fea('0x3a')](_0x406a49[_0x6fea('0x30')],_0x23e192[_0x6fea('0x39')]),_0x5adc57);if(_0x406a49[_0x6fea('0x30')][_0x6fea('0x3b')]){_0x4fc22f[_0x6fea('0x38')]=_[_0x6fea('0x3c')](_0x4fc22f[_0x6fea('0x38')],{'$or':_['map'](_0x5adc57,function(_0x42b1f0){if(_0x42b1f0[_0x6fea('0x2d')]!==_0x6fea('0x3d')){var _0x45fd75={};_0x45fd75[_0x42b1f0['name']]={'$like':'%'+_0x406a49[_0x6fea('0x30')][_0x6fea('0x3b')]+'%'};return _0x45fd75;}})});}_0x4fc22f=_[_0x6fea('0x3c')]({},_0x4fc22f,_0x406a49[_0x6fea('0x3e')]);var _0x43c223={'where':_0x4fc22f[_0x6fea('0x38')]};return db[_0x6fea('0x2a')][_0x6fea('0x1e')](_0x43c223)['then'](function(_0x517872){_0x11e72c[_0x6fea('0x1e')]=_0x517872;if(_0x406a49[_0x6fea('0x30')][_0x6fea('0x3f')]){_0x4fc22f[_0x6fea('0x40')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x4fc22f);})[_0x6fea('0x24')](function(_0x3c7cdd){_0x11e72c['rows']=_0x3c7cdd;return _0x11e72c;})[_0x6fea('0x24')](respondWithFilteredResult(_0xa7294f,_0x4fc22f))[_0x6fea('0x41')](handleError(_0xa7294f,null));};exports[_0x6fea('0x42')]=function(_0x37d1cd,_0xb87db9){var _0x50a521={'raw':!![],'where':{'id':_0x37d1cd[_0x6fea('0x43')]['id']}},_0x2b7d81={};_0x2b7d81[_0x6fea('0x2e')]=_[_0x6fea('0x44')](db[_0x6fea('0x2a')][_0x6fea('0x2b')]);_0x2b7d81['query']=_[_0x6fea('0x44')](_0x37d1cd[_0x6fea('0x30')]);_0x2b7d81[_0x6fea('0x39')]=_[_0x6fea('0x31')](_0x2b7d81[_0x6fea('0x2e')],_0x2b7d81['query']);_0x50a521[_0x6fea('0x32')]=_[_0x6fea('0x31')](_0x2b7d81[_0x6fea('0x2e')],qs[_0x6fea('0x33')](_0x37d1cd[_0x6fea('0x30')][_0x6fea('0x33')]));_0x50a521[_0x6fea('0x32')]=_0x50a521[_0x6fea('0x32')]['length']?_0x50a521[_0x6fea('0x32')]:_0x2b7d81[_0x6fea('0x2e')];if(_0x37d1cd[_0x6fea('0x30')]['includeAll']){_0x50a521[_0x6fea('0x40')]=[{'all':!![]}];}_0x50a521=_[_0x6fea('0x3c')]({},_0x50a521,_0x37d1cd[_0x6fea('0x3e')]);return db['VtigerField'][_0x6fea('0x45')](_0x50a521)[_0x6fea('0x24')](handleEntityNotFound(_0xb87db9,null))[_0x6fea('0x24')](respondWithResult(_0xb87db9,null))[_0x6fea('0x41')](handleError(_0xb87db9,null));};exports[_0x6fea('0x46')]=function(_0x720824,_0x1e2802){return db[_0x6fea('0x2a')][_0x6fea('0x46')](_0x720824[_0x6fea('0x47')],{})[_0x6fea('0x24')](respondWithResult(_0x1e2802,0xc9))[_0x6fea('0x41')](handleError(_0x1e2802,null));};exports[_0x6fea('0x23')]=function(_0x451830,_0x58077a){if(_0x451830[_0x6fea('0x47')]['id']){delete _0x451830[_0x6fea('0x47')]['id'];}return db[_0x6fea('0x2a')][_0x6fea('0x45')]({'where':{'id':_0x451830[_0x6fea('0x43')]['id']}})[_0x6fea('0x24')](handleEntityNotFound(_0x58077a,null))[_0x6fea('0x24')](saveUpdates(_0x451830[_0x6fea('0x47')],null))[_0x6fea('0x24')](respondWithResult(_0x58077a,null))['catch'](handleError(_0x58077a,null));};exports['destroy']=function(_0x57ba15,_0xc5e63){return db[_0x6fea('0x2a')][_0x6fea('0x45')]({'where':{'id':_0x57ba15['params']['id']}})['then'](handleEntityNotFound(_0xc5e63,null))[_0x6fea('0x24')](removeEntity(_0xc5e63,null))[_0x6fea('0x41')](handleError(_0xc5e63,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index cb87e68..0f3ba3c 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 _0x10f2=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','moment'];(function(_0x261aad,_0x4bc661){var _0x3b2266=function(_0x44a08f){while(--_0x44a08f){_0x261aad['push'](_0x261aad['shift']());}};_0x3b2266(++_0x4bc661);}(_0x10f2,0xd7));var _0x210f=function(_0x269a72,_0x2ba574){_0x269a72=_0x269a72-0x0;var _0xa8f9b0=_0x10f2[_0x269a72];return _0xa8f9b0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x210f('0x0'));var BPromise=require(_0x210f('0x1'));var rp=require(_0x210f('0x2'));var fs=require('fs');var path=require(_0x210f('0x3'));var rimraf=require(_0x210f('0x4'));var config=require(_0x210f('0x5'));var attributes=require(_0x210f('0x6'));module['exports']=function(_0x3b5b33,_0x4be235){return _0x3b5b33['define'](_0x210f('0x7'),attributes,{'tableName':_0x210f('0x8'),'paranoid':![],'indexes':[{'name':_0x210f('0x9'),'fields':[_0x210f('0xa'),_0x210f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe090=['bluebird','request-promise','exports','define','VtigerField','int_vtiger_fields','lodash','util','../../config/logger','api','moment'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xe090,0xed));var _0x0e09=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xe090[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x0e09('0x0'));var util=require(_0x0e09('0x1'));var logger=require(_0x0e09('0x2'))(_0x0e09('0x3'));var moment=require(_0x0e09('0x4'));var BPromise=require(_0x0e09('0x5'));var rp=require(_0x0e09('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x0e09('0x7')]=function(_0x5b7402,_0x20ad3e){return _0x5b7402[_0x0e09('0x8')](_0x0e09('0x9'),attributes,{'tableName':_0x0e09('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index f18d6fb..37b6e82 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 _0x518c=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VtigerField,\x20%s,\x20%s','message','catch','lodash','moment','bluebird'];(function(_0x22f5c9,_0x29f501){var _0x20f444=function(_0x47372b){while(--_0x47372b){_0x22f5c9['push'](_0x22f5c9['shift']());}};_0x20f444(++_0x29f501);}(_0x518c,0x90));var _0xc518=function(_0xad7968,_0x25f4e7){_0xad7968=_0xad7968-0x0;var _0x29778d=_0x518c[_0xad7968];return _0x29778d;};'use strict';var _=require(_0xc518('0x0'));var util=require('util');var moment=require(_0xc518('0x1'));var BPromise=require(_0xc518('0x2'));var rs=require(_0xc518('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc518('0x4'));var logger=require(_0xc518('0x5'))(_0xc518('0x6'));var config=require(_0xc518('0x7'));var jayson=require(_0xc518('0x8'));var client=jayson['client'][_0xc518('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cc5cd,_0x3d6214,_0x4db026){return new BPromise(function(_0x156a18,_0x427b42){return client[_0xc518('0xa')](_0x4cc5cd,_0x4db026)[_0xc518('0xb')](function(_0x449591){logger[_0xc518('0xc')]('VtigerField,\x20%s,\x20%s',_0x3d6214,'request\x20sent');logger[_0xc518('0xd')](_0xc518('0xe'),_0x3d6214,_0xc518('0xf'),JSON[_0xc518('0x10')](_0x449591));if(_0x449591[_0xc518('0x11')]){if(_0x449591[_0xc518('0x11')]['code']===0x1f4){logger[_0xc518('0x11')](_0xc518('0x12'),_0x3d6214,_0x449591[_0xc518('0x11')][_0xc518('0x13')]);return _0x427b42(_0x449591[_0xc518('0x11')]['message']);}logger['error'](_0xc518('0x12'),_0x3d6214,_0x449591['error']['message']);return _0x156a18(_0x449591['error'][_0xc518('0x13')]);}else{logger[_0xc518('0xc')]('VtigerField,\x20%s,\x20%s',_0x3d6214,_0xc518('0xf'));_0x156a18(_0x449591['result'][_0xc518('0x13')]);}})[_0xc518('0x14')](function(_0xb1ead3){logger[_0xc518('0x11')](_0xc518('0x12'),_0x3d6214,_0xb1ead3);_0x427b42(_0xb1ead3);});});} \ No newline at end of file +var _0x78e3=['request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s'];(function(_0x153625,_0x4a09bc){var _0x5ed132=function(_0x946fc0){while(--_0x946fc0){_0x153625['push'](_0x153625['shift']());}};_0x5ed132(++_0x4a09bc);}(_0x78e3,0xa6));var _0x378e=function(_0x3e83dc,_0x47fb4c){_0x3e83dc=_0x3e83dc-0x0;var _0x46cbfa=_0x78e3[_0x3e83dc];return _0x46cbfa;};'use strict';var _=require(_0x378e('0x0'));var util=require(_0x378e('0x1'));var moment=require(_0x378e('0x2'));var BPromise=require('bluebird');var rs=require(_0x378e('0x3'));var fs=require('fs');var Redis=require(_0x378e('0x4'));var db=require(_0x378e('0x5'))['db'];var utils=require(_0x378e('0x6'));var logger=require(_0x378e('0x7'))('rpc');var config=require(_0x378e('0x8'));var jayson=require(_0x378e('0x9'));var client=jayson['client'][_0x378e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbf46de,_0x2fac2e,_0xc41887){return new BPromise(function(_0x4c129c,_0x48db71){return client['request'](_0xbf46de,_0xc41887)[_0x378e('0xb')](function(_0x121213){logger[_0x378e('0xc')](_0x378e('0xd'),_0x2fac2e,_0x378e('0xe'));logger['debug'](_0x378e('0xf'),_0x2fac2e,_0x378e('0xe'),JSON['stringify'](_0x121213));if(_0x121213['error']){if(_0x121213[_0x378e('0x10')][_0x378e('0x11')]===0x1f4){logger[_0x378e('0x10')](_0x378e('0xd'),_0x2fac2e,_0x121213[_0x378e('0x10')][_0x378e('0x12')]);return _0x48db71(_0x121213[_0x378e('0x10')][_0x378e('0x12')]);}logger[_0x378e('0x10')](_0x378e('0xd'),_0x2fac2e,_0x121213[_0x378e('0x10')]['message']);return _0x4c129c(_0x121213['error'][_0x378e('0x12')]);}else{logger[_0x378e('0xc')](_0x378e('0xd'),_0x2fac2e,'request\x20sent');_0x4c129c(_0x121213[_0x378e('0x13')][_0x378e('0x12')]);}})['catch'](function(_0x4be094){logger[_0x378e('0x10')](_0x378e('0xd'),_0x2fac2e,_0x4be094);_0x48db71(_0x4be094);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6207c66..27649d5 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 _0xdd50=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x33848c,_0xc1c884){var _0x4b5d3a=function(_0x1f48e7){while(--_0x1f48e7){_0x33848c['push'](_0x33848c['shift']());}};_0x4b5d3a(++_0xc1c884);}(_0xdd50,0x11a));var _0x0dd5=function(_0x4227f7,_0x5e2633){_0x4227f7=_0x4227f7-0x0;var _0x4d394e=_0xdd50[_0x4227f7];return _0x4d394e;};'use strict';var multer=require(_0x0dd5('0x0'));var util=require(_0x0dd5('0x1'));var path=require(_0x0dd5('0x2'));var timeout=require(_0x0dd5('0x3'));var express=require(_0x0dd5('0x4'));var router=express['Router']();var fs_extra=require(_0x0dd5('0x5'));var auth=require(_0x0dd5('0x6'));var interaction=require(_0x0dd5('0x7'));var config=require(_0x0dd5('0x8'));var controller=require(_0x0dd5('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x0dd5('0xa')]);router[_0x0dd5('0xb')](_0x0dd5('0xc'),auth[_0x0dd5('0xd')](),controller[_0x0dd5('0xe')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x0dd5('0xf'),auth['isAuthenticated'](),controller[_0x0dd5('0x10')]);router[_0x0dd5('0x11')]('/',auth[_0x0dd5('0xd')](),controller[_0x0dd5('0x12')]);router[_0x0dd5('0x11')](_0x0dd5('0x13'),auth[_0x0dd5('0xd')](),controller[_0x0dd5('0x14')]);router[_0x0dd5('0x15')](_0x0dd5('0xc'),auth[_0x0dd5('0xd')](),controller[_0x0dd5('0x16')]);router[_0x0dd5('0x17')](_0x0dd5('0xc'),auth[_0x0dd5('0xd')](),controller[_0x0dd5('0x18')]);module[_0x0dd5('0x19')]=router; \ No newline at end of file +var _0x5acd=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','update','delete','/:id','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x5acd,0x126));var _0xd5ac=function(_0x1930e3,_0x24cbe6){_0x1930e3=_0x1930e3-0x0;var _0x97b4b0=_0x5acd[_0x1930e3];return _0x97b4b0;};'use strict';var multer=require(_0xd5ac('0x0'));var util=require('util');var path=require(_0xd5ac('0x1'));var timeout=require('connect-timeout');var express=require(_0xd5ac('0x2'));var router=express['Router']();var fs_extra=require(_0xd5ac('0x3'));var auth=require(_0xd5ac('0x4'));var interaction=require(_0xd5ac('0x5'));var config=require(_0xd5ac('0x6'));var controller=require(_0xd5ac('0x7'));router[_0xd5ac('0x8')]('/',auth[_0xd5ac('0x9')](),controller[_0xd5ac('0xa')]);router[_0xd5ac('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd5ac('0xb')]);router['get'](_0xd5ac('0xc'),auth['isAuthenticated'](),controller[_0xd5ac('0xd')]);router[_0xd5ac('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd5ac('0xe')]);router[_0xd5ac('0xf')]('/',auth[_0xd5ac('0x9')](),controller['create']);router[_0xd5ac('0xf')](_0xd5ac('0xc'),auth[_0xd5ac('0x9')](),controller['addConfiguration']);router['put']('/:id',auth[_0xd5ac('0x9')](),controller[_0xd5ac('0x10')]);router[_0xd5ac('0x11')](_0xd5ac('0x12'),auth[_0xd5ac('0x9')](),controller[_0xd5ac('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d1cbc6f..d9ca057 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 _0x8aad=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','token','password'];(function(_0x8aa13c,_0x32dfcb){var _0x883079=function(_0x556182){while(--_0x556182){_0x8aa13c['push'](_0x8aa13c['shift']());}};_0x883079(++_0x32dfcb);}(_0x8aad,0x146));var _0xd8aa=function(_0x55e111,_0xcf8012){_0x55e111=_0x55e111-0x0;var _0x250207=_0x8aad[_0x55e111];return _0x250207;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8aa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x3')},'password':{'type':Sequelize[_0xd8aa('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0xd8aa('0x5')),'defaultValue':_0xd8aa('0x6')},'serverUrl':{'type':Sequelize[_0xd8aa('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd8aa('0x7'),_0xd8aa('0x8')),'defaultValue':_0xd8aa('0x7')}}; \ No newline at end of file +var _0xfe39=['integrationTab','sequelize','exports','STRING','ENUM','password','token'];(function(_0x1e23a4,_0x29f31a){var _0x543656=function(_0x5c7a3b){while(--_0x5c7a3b){_0x1e23a4['push'](_0x1e23a4['shift']());}};_0x543656(++_0x29f31a);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xfe39[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x9fe3('0x0'));module[_0x9fe3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9fe3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x9fe3('0x2')]},'token':{'type':Sequelize[_0x9fe3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x9fe3('0x3')](_0x9fe3('0x4'),_0x9fe3('0x5')),'defaultValue':_0x9fe3('0x4')},'serverUrl':{'type':Sequelize[_0x9fe3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9fe3('0x3')](_0x9fe3('0x6'),'newTab'),'defaultValue':_0x9fe3('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6241047..3f52106 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 _0x7916=['hasOwnProperty','order','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','findOne','password','token','remoteUri','slice','substring','GET','format','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','username','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','count','limit','status','set','apply','save','then','destroy','error','name','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x7de18d,_0x511405){var _0x625ad0=function(_0xb25a82){while(--_0xb25a82){_0x7de18d['push'](_0x7de18d['shift']());}};_0x625ad0(++_0x511405);}(_0x7916,0x128));var _0x6791=function(_0x1569bd,_0x1a1461){_0x1569bd=_0x1569bd-0x0;var _0x40e370=_0x7916[_0x1569bd];return _0x40e370;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];var integrations=require(_0x6791('0x17'));function respondWithStatusCode(_0x16c62b,_0x423e22){_0x423e22=_0x423e22||0xcc;return function(_0x11c730){if(_0x11c730){return _0x16c62b[_0x6791('0x18')](_0x423e22);}return _0x16c62b['status'](_0x423e22)['end']();};}function respondWithResult(_0x34b28d,_0x5122f9){_0x5122f9=_0x5122f9||0xc8;return function(_0x2a9151){if(_0x2a9151){return _0x34b28d['status'](_0x5122f9)[_0x6791('0x19')](_0x2a9151);}};}function respondWithFilteredResult(_0x163898,_0x517910){return function(_0x3e4792){if(_0x3e4792){var _0x4b80ed=typeof _0x517910[_0x6791('0x1a')]===_0x6791('0x1b')&&typeof _0x517910['limit']===_0x6791('0x1b');var _0x36d7a1=_0x3e4792['count'];var _0x1872f5=_0x4b80ed?0x0:_0x517910['offset'];var _0xe55dba=_0x4b80ed?_0x3e4792[_0x6791('0x1c')]:_0x517910[_0x6791('0x1a')]+_0x517910[_0x6791('0x1d')];var _0x25adbc;if(_0xe55dba>=_0x36d7a1){_0xe55dba=_0x36d7a1;_0x25adbc=0xc8;}else{_0x25adbc=0xce;}_0x163898[_0x6791('0x1e')](_0x25adbc);return _0x163898[_0x6791('0x1f')]('Content-Range',_0x1872f5+'-'+_0xe55dba+'/'+_0x36d7a1)[_0x6791('0x19')](_0x3e4792);}return null;};}function patchUpdates(_0x306acb){return function(_0x51368e){try{jsonpatch[_0x6791('0x20')](_0x51368e,_0x306acb,!![]);}catch(_0x3b57f0){return BPromise['reject'](_0x3b57f0);}return _0x51368e[_0x6791('0x21')]();};}function saveUpdates(_0x309610,_0x15b9ab){return function(_0x12d83b){if(_0x12d83b){return _0x12d83b['update'](_0x309610)[_0x6791('0x22')](function(_0x1b516d){return _0x1b516d;});}return null;};}function removeEntity(_0x4a8717,_0x53bb44){return function(_0x4b23bc){if(_0x4b23bc){return _0x4b23bc[_0x6791('0x23')]()['then'](function(){_0x4a8717[_0x6791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a092,_0x496273){return function(_0x5cadc){if(!_0x5cadc){_0x54a092[_0x6791('0x18')](0x194);}return _0x5cadc;};}function handleError(_0xd49b84,_0x56a74e){_0x56a74e=_0x56a74e||0x1f4;return function(_0x3def2e){logger[_0x6791('0x24')](_0x3def2e['stack']);if(_0x3def2e[_0x6791('0x25')]){delete _0x3def2e['name'];}_0xd49b84[_0x6791('0x1e')](_0x56a74e)['send'](_0x3def2e);};}exports['index']=function(_0x270a1d,_0x551718){var _0x2f56a2={},_0x34b006={},_0x483d6c={'count':0x0,'rows':[]};var _0x240a9f=_[_0x6791('0x26')](db[_0x6791('0x27')][_0x6791('0x28')],function(_0x5d9d54){return{'name':_0x5d9d54['fieldName'],'type':_0x5d9d54[_0x6791('0x29')]['key']};});_0x34b006[_0x6791('0x2a')]=_[_0x6791('0x26')](_0x240a9f,_0x6791('0x25'));_0x34b006[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x270a1d[_0x6791('0x2b')]);_0x34b006[_0x6791('0x2d')]=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],_0x34b006[_0x6791('0x2b')]);_0x2f56a2['attributes']=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x2f')]));_0x2f56a2[_0x6791('0x30')]=_0x2f56a2['attributes']['length']?_0x2f56a2['attributes']:_0x34b006[_0x6791('0x2a')];if(!_0x270a1d[_0x6791('0x2b')][_0x6791('0x31')]('nolimit')){_0x2f56a2['limit']=qs[_0x6791('0x1d')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1d')]);_0x2f56a2[_0x6791('0x1a')]=qs['offset'](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1a')]);}_0x2f56a2[_0x6791('0x32')]=qs['sort'](_0x270a1d[_0x6791('0x2b')]['sort']);_0x2f56a2['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x270a1d['query'],_0x34b006[_0x6791('0x2d')]),_0x240a9f);if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x34')]){_0x2f56a2[_0x6791('0x35')]=_[_0x6791('0x36')](_0x2f56a2['where'],{'$or':_[_0x6791('0x26')](_0x240a9f,function(_0xc95516){if(_0xc95516[_0x6791('0x29')]!=='VIRTUAL'){var _0x3a6062={};_0x3a6062[_0xc95516[_0x6791('0x25')]]={'$like':'%'+_0x270a1d[_0x6791('0x2b')]['filter']+'%'};return _0x3a6062;}})});}_0x2f56a2=_[_0x6791('0x36')]({},_0x2f56a2,_0x270a1d[_0x6791('0x37')]);var _0x13be81={'where':_0x2f56a2[_0x6791('0x35')]};return db['ZendeskAccount'][_0x6791('0x1c')](_0x13be81)[_0x6791('0x22')](function(_0x3e95b6){_0x483d6c[_0x6791('0x1c')]=_0x3e95b6;if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x38')]){_0x2f56a2[_0x6791('0x39')]=[{'all':!![]}];}return db[_0x6791('0x27')][_0x6791('0x3a')](_0x2f56a2);})['then'](function(_0x52c03a){_0x483d6c[_0x6791('0x3b')]=_0x52c03a;return _0x483d6c;})[_0x6791('0x22')](respondWithFilteredResult(_0x551718,_0x2f56a2))['catch'](handleError(_0x551718,null));};exports[_0x6791('0x3c')]=function(_0x1c9913,_0x1c6803){var _0x3edb86={'raw':![],'where':{'id':_0x1c9913[_0x6791('0x3d')]['id']}},_0x1a922e={};_0x1a922e[_0x6791('0x2a')]=_['keys'](db[_0x6791('0x27')]['rawAttributes']);_0x1a922e[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x1c9913[_0x6791('0x2b')]);_0x1a922e[_0x6791('0x2d')]=_['intersection'](_0x1a922e[_0x6791('0x2a')],_0x1a922e[_0x6791('0x2b')]);_0x3edb86[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x1a922e[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x1c9913[_0x6791('0x2b')][_0x6791('0x2f')]));_0x3edb86['attributes']=_0x3edb86[_0x6791('0x30')][_0x6791('0x3e')]?_0x3edb86[_0x6791('0x30')]:_0x1a922e[_0x6791('0x2a')];if(_0x1c9913['query'][_0x6791('0x38')]){_0x3edb86[_0x6791('0x39')]=[{'all':!![]}];}_0x3edb86=_['merge']({},_0x3edb86,_0x1c9913[_0x6791('0x37')]);return db['ZendeskAccount'][_0x6791('0x3f')](_0x3edb86)[_0x6791('0x22')](handleEntityNotFound(_0x1c6803,null))[_0x6791('0x22')](respondWithResult(_0x1c6803,null))[_0x6791('0x40')](handleError(_0x1c6803,null));};exports[_0x6791('0x41')]=function(_0xb2a2,_0x4163f5){return db[_0x6791('0x27')][_0x6791('0x41')](_0xb2a2['body'],{})[_0x6791('0x22')](respondWithResult(_0x4163f5,0xc9))['catch'](handleError(_0x4163f5,null));};exports[_0x6791('0x42')]=function(_0x2bb86a,_0x276002){if(_0x2bb86a[_0x6791('0x43')]['id']){delete _0x2bb86a[_0x6791('0x43')]['id'];}return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x2bb86a[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x276002,null))[_0x6791('0x22')](saveUpdates(_0x2bb86a[_0x6791('0x43')],null))['then'](respondWithResult(_0x276002,null))[_0x6791('0x40')](handleError(_0x276002,null));};exports[_0x6791('0x23')]=function(_0x4ff9f4,_0x3df699){return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x4ff9f4[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x3df699,null))[_0x6791('0x22')](removeEntity(_0x3df699,null))['catch'](handleError(_0x3df699,null));};exports[_0x6791('0x44')]=function(_0x243faf,_0x5655c8,_0x189b22){var _0x4370ab={};var _0x3a895b={};var _0x5df56e;var _0x355e97;return db[_0x6791('0x27')]['findOne']({'where':{'id':_0x243faf[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5655c8,null))['then'](function(_0x169531){if(_0x169531){_0x5df56e=_0x169531;_0x3a895b[_0x6791('0x2a')]=_[_0x6791('0x2c')](db[_0x6791('0x45')]['rawAttributes']);_0x3a895b[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x243faf[_0x6791('0x2b')]);_0x3a895b['filters']=_['intersection'](_0x3a895b[_0x6791('0x2a')],_0x3a895b[_0x6791('0x2b')]);_0x4370ab[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x3a895b[_0x6791('0x2a')],qs['fields'](_0x243faf['query'][_0x6791('0x2f')]));_0x4370ab['attributes']=_0x4370ab['attributes'][_0x6791('0x3e')]?_0x4370ab[_0x6791('0x30')]:_0x3a895b[_0x6791('0x2a')];_0x4370ab[_0x6791('0x32')]=qs[_0x6791('0x46')](_0x243faf[_0x6791('0x2b')]['sort']);_0x4370ab['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x243faf['query'],_0x3a895b[_0x6791('0x2d')]));if(_0x243faf['query'][_0x6791('0x34')]){_0x4370ab[_0x6791('0x35')]=_['merge'](_0x4370ab[_0x6791('0x35')],{'$or':_[_0x6791('0x26')](_0x4370ab[_0x6791('0x30')],function(_0x49ed65){var _0x3ba679={};_0x3ba679[_0x49ed65]={'$like':'%'+_0x243faf[_0x6791('0x2b')][_0x6791('0x34')]+'%'};return _0x3ba679;})});}_0x4370ab=_[_0x6791('0x36')]({},_0x4370ab,_0x243faf[_0x6791('0x37')]);return _0x5df56e['getConfigurations'](_0x4370ab);}})['then'](function(_0x1a9acd){if(_0x1a9acd){_0x355e97=_0x1a9acd[_0x6791('0x3e')];if(!_0x243faf['query'][_0x6791('0x31')](_0x6791('0x47'))){_0x4370ab[_0x6791('0x1d')]=qs[_0x6791('0x1d')](_0x243faf[_0x6791('0x2b')][_0x6791('0x1d')]);_0x4370ab[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x243faf['query'][_0x6791('0x1a')]);}return _0x5df56e[_0x6791('0x44')](_0x4370ab);}})[_0x6791('0x22')](function(_0x1a9a2e){if(_0x1a9a2e){return _0x1a9a2e?{'count':_0x355e97,'rows':_0x1a9a2e}:null;}})['then'](respondWithResult(_0x5655c8,null))[_0x6791('0x40')](handleError(_0x5655c8,null));};exports[_0x6791('0x48')]=function(_0xa8a8dd,_0x5ca809,_0x205320){if(_0xa8a8dd[_0x6791('0x43')]['id']){delete _0xa8a8dd[_0x6791('0x43')]['id'];}return db[_0x6791('0x27')]['findOne']({'where':{'id':_0xa8a8dd[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5ca809,null))['then'](function(_0x1114d4){if(_0x1114d4){_0xa8a8dd[_0x6791('0x43')][_0x6791('0x49')]=_0x1114d4['id'];_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4a')]=integrations[_0x6791('0x4b')](_0xa8a8dd['body'][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);_0xa8a8dd['body'][_0x6791('0x4d')]=integrations['getDescriptions'](_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);return db[_0x6791('0x45')]['create'](_0xa8a8dd[_0x6791('0x43')],{'include':[{'model':db[_0x6791('0x4e')],'as':_0x6791('0x4a')},{'model':db[_0x6791('0x4e')],'as':'Descriptions'}]});}return null;})[_0x6791('0x22')](respondWithResult(_0x5ca809,null))[_0x6791('0x40')](handleError(_0x5ca809,null));};exports['getFields']=function(_0x34691c,_0x1fa44a,_0x567302){var _0x201465='';return db[_0x6791('0x27')][_0x6791('0x4f')]({'where':{'id':_0x34691c[_0x6791('0x3d')]['id']},'attributes':['id','username',_0x6791('0x50'),_0x6791('0x51'),'authType',_0x6791('0x52')]})[_0x6791('0x22')](handleEntityNotFound(_0x1fa44a,null))[_0x6791('0x22')](function(_0x20c736){if(_0x20c736){_0x201465=_0x20c736[_0x6791('0x52')];var _0x4ecf62=_0x201465[_0x6791('0x53')](-0x1);if(_0x4ecf62==='/'){_0x201465=_0x201465[_0x6791('0x54')](0x0,_0x201465['lastIndexOf'](_0x4ecf62));}var _0x4463ef={'method':_0x6791('0x55'),'uri':util[_0x6791('0x56')]('%s/%s',_0x201465,_0x6791('0x57')),'json':!![]};switch(_0x20c736[_0x6791('0x58')]){case _0x6791('0x50'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')](_0x6791('0x5a'),new Buffer(util[_0x6791('0x56')](_0x6791('0x5b'),_0x20c736['username'],_0x20c736[_0x6791('0x50')]))[_0x6791('0x5c')]('base64'))};break;case _0x6791('0x51'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')]('Basic\x20%s',new Buffer(util[_0x6791('0x56')]('%s/token:%s',_0x20c736[_0x6791('0x5d')],_0x20c736[_0x6791('0x51')]))[_0x6791('0x5c')](_0x6791('0x5e')))};break;default:throw new db[(_0x6791('0x5f'))][(_0x6791('0x60'))](_0x6791('0x61'));}return rp(_0x4463ef);}})[_0x6791('0x22')](function(_0x23e0d3){if(_0x23e0d3){var _0x1fa853=[_0x6791('0x62'),_0x6791('0x63'),_0x6791('0x64'),_0x6791('0x65')];_[_0x6791('0x66')](_0x23e0d3[_0x6791('0x57')],function(_0x3b53b8){return _0x1fa853[_0x6791('0x67')](_0x3b53b8[_0x6791('0x29')]);});return{'count':_0x23e0d3['ticket_fields']['length'],'rows':_['map'](_0x23e0d3[_0x6791('0x57')],function(_0x31c1a8){return{'id':_0x31c1a8['id'],'name':_0x31c1a8[_0x6791('0x68')]>0x7?_0x31c1a8[_0x6791('0x69')]:_0x31c1a8[_0x6791('0x29')],'custom':_0x31c1a8[_0x6791('0x68')]>0x7?!![]:![],'options':_0x31c1a8[_0x6791('0x6a')]?_0x31c1a8[_0x6791('0x6a')]:_0x31c1a8[_0x6791('0x6b')]?_0x31c1a8[_0x6791('0x6b')]:[]};})};}})[_0x6791('0x22')](respondWithResult(_0x1fa44a,null))[_0x6791('0x40')](function(_0x44ec4d){var _0x4047b6=_0x34691c[_0x6791('0x2b')][_0x6791('0x6c')]?0x1f4:_0x44ec4d[_0x6791('0x6d')]||0x1f4;logger[_0x6791('0x24')](_0x6791('0x6e'),_0x6791('0x6f'),_0x4047b6,JSON[_0x6791('0x70')](_0x44ec4d));delete _0x44ec4d[_0x6791('0x25')];if(_0x4047b6===0x191){_0x4047b6=0x190;}_0x1fa44a[_0x6791('0x1e')](_0x4047b6)[_0x6791('0x71')](_0x34691c[_0x6791('0x2b')]['test']?{'message':_0x6791('0x72'),'statusCode':_0x44ec4d['statusCode']}:_0x44ec4d);});}; \ No newline at end of file +var _0xe5b5=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','map','addConfiguration','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','base64','%s/token:%s','toString','Sequelize','Unknown\x20authentication\x20type','group','assignee','remove','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection'];(function(_0x4faf96,_0x1db35c){var _0x28ff12=function(_0x358bf5){while(--_0x358bf5){_0x4faf96['push'](_0x4faf96['shift']());}};_0x28ff12(++_0x1db35c);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x10e840,_0x5b3935){_0x10e840=_0x10e840-0x0;var _0x405caa=_0xe5b5[_0x10e840];return _0x405caa;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x5e5b('0x1b'));function respondWithStatusCode(_0x18434e,_0x4559a0){_0x4559a0=_0x4559a0||0xcc;return function(_0x1694ff){if(_0x1694ff){return _0x18434e[_0x5e5b('0x1c')](_0x4559a0);}return _0x18434e[_0x5e5b('0x1d')](_0x4559a0)[_0x5e5b('0x1e')]();};}function respondWithResult(_0x49edd0,_0x2b37fa){_0x2b37fa=_0x2b37fa||0xc8;return function(_0x2e92c3){if(_0x2e92c3){return _0x49edd0['status'](_0x2b37fa)[_0x5e5b('0x1f')](_0x2e92c3);}};}function respondWithFilteredResult(_0x578c14,_0x4e9509){return function(_0x13a1cb){if(_0x13a1cb){var _0x444435=typeof _0x4e9509[_0x5e5b('0x20')]==='undefined'&&typeof _0x4e9509[_0x5e5b('0x21')]==='undefined';var _0x1796af=_0x13a1cb[_0x5e5b('0x22')];var _0x4c5f9a=_0x444435?0x0:_0x4e9509[_0x5e5b('0x20')];var _0x1560e1=_0x444435?_0x13a1cb[_0x5e5b('0x22')]:_0x4e9509['offset']+_0x4e9509[_0x5e5b('0x21')];var _0x3f1103;if(_0x1560e1>=_0x1796af){_0x1560e1=_0x1796af;_0x3f1103=0xc8;}else{_0x3f1103=0xce;}_0x578c14['status'](_0x3f1103);return _0x578c14[_0x5e5b('0x23')](_0x5e5b('0x24'),_0x4c5f9a+'-'+_0x1560e1+'/'+_0x1796af)[_0x5e5b('0x1f')](_0x13a1cb);}return null;};}function patchUpdates(_0x2d8252){return function(_0x2cb0bb){try{jsonpatch[_0x5e5b('0x25')](_0x2cb0bb,_0x2d8252,!![]);}catch(_0x93df5c){return BPromise[_0x5e5b('0x26')](_0x93df5c);}return _0x2cb0bb['save']();};}function saveUpdates(_0x512e46,_0x256a00){return function(_0x3326fb){if(_0x3326fb){return _0x3326fb[_0x5e5b('0x27')](_0x512e46)[_0x5e5b('0x28')](function(_0x2e38ed){return _0x2e38ed;});}return null;};}function removeEntity(_0x28cd95,_0x135c6c){return function(_0x18903e){if(_0x18903e){return _0x18903e[_0x5e5b('0x29')]()[_0x5e5b('0x28')](function(){_0x28cd95[_0x5e5b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ebb11,_0x75800d){return function(_0x3527a8){if(!_0x3527a8){_0x1ebb11['sendStatus'](0x194);}return _0x3527a8;};}function handleError(_0x988e5d,_0xdb2863){_0xdb2863=_0xdb2863||0x1f4;return function(_0x5ee866){logger[_0x5e5b('0x2a')](_0x5ee866[_0x5e5b('0x2b')]);if(_0x5ee866[_0x5e5b('0x2c')]){delete _0x5ee866[_0x5e5b('0x2c')];}_0x988e5d[_0x5e5b('0x1d')](_0xdb2863)[_0x5e5b('0x2d')](_0x5ee866);};}exports[_0x5e5b('0x2e')]=function(_0x2b4351,_0x3f6b25){var _0x42da3b={},_0xcb272c={},_0x28157a={'count':0x0,'rows':[]};var _0x4ed688=_['map'](db[_0x5e5b('0x2f')][_0x5e5b('0x30')],function(_0xb68419){return{'name':_0xb68419[_0x5e5b('0x31')],'type':_0xb68419[_0x5e5b('0x32')]['key']};});_0xcb272c[_0x5e5b('0x33')]=_['map'](_0x4ed688,_0x5e5b('0x2c'));_0xcb272c[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x2b4351[_0x5e5b('0x34')]);_0xcb272c['filters']=_[_0x5e5b('0x36')](_0xcb272c[_0x5e5b('0x33')],_0xcb272c['query']);_0x42da3b[_0x5e5b('0x37')]=_[_0x5e5b('0x36')](_0xcb272c[_0x5e5b('0x33')],qs[_0x5e5b('0x38')](_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x38')]));_0x42da3b[_0x5e5b('0x37')]=_0x42da3b[_0x5e5b('0x37')]['length']?_0x42da3b[_0x5e5b('0x37')]:_0xcb272c[_0x5e5b('0x33')];if(!_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x39')](_0x5e5b('0x3a'))){_0x42da3b[_0x5e5b('0x21')]=qs['limit'](_0x2b4351['query'][_0x5e5b('0x21')]);_0x42da3b[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0x2b4351['query'][_0x5e5b('0x20')]);}_0x42da3b[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3c')](_0x2b4351[_0x5e5b('0x34')]['sort']);_0x42da3b[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_['pick'](_0x2b4351['query'],_0xcb272c[_0x5e5b('0x3e')]),_0x4ed688);if(_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x3f')]){_0x42da3b['where']=_[_0x5e5b('0x40')](_0x42da3b['where'],{'$or':_['map'](_0x4ed688,function(_0x261057){if(_0x261057[_0x5e5b('0x32')]!==_0x5e5b('0x41')){var _0xc666f7={};_0xc666f7[_0x261057[_0x5e5b('0x2c')]]={'$like':'%'+_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x3f')]+'%'};return _0xc666f7;}})});}_0x42da3b=_[_0x5e5b('0x40')]({},_0x42da3b,_0x2b4351[_0x5e5b('0x42')]);var _0x53b88f={'where':_0x42da3b[_0x5e5b('0x3d')]};return db[_0x5e5b('0x2f')]['count'](_0x53b88f)[_0x5e5b('0x28')](function(_0x4b54b0){_0x28157a[_0x5e5b('0x22')]=_0x4b54b0;if(_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x43')]){_0x42da3b[_0x5e5b('0x44')]=[{'all':!![]}];}return db[_0x5e5b('0x2f')][_0x5e5b('0x45')](_0x42da3b);})[_0x5e5b('0x28')](function(_0x24d81f){_0x28157a[_0x5e5b('0x46')]=_0x24d81f;return _0x28157a;})[_0x5e5b('0x28')](respondWithFilteredResult(_0x3f6b25,_0x42da3b))[_0x5e5b('0x47')](handleError(_0x3f6b25,null));};exports['show']=function(_0x2b81dd,_0x40e8ce){var _0x46fec9={'raw':![],'where':{'id':_0x2b81dd[_0x5e5b('0x48')]['id']}},_0x570413={};_0x570413[_0x5e5b('0x33')]=_['keys'](db[_0x5e5b('0x2f')][_0x5e5b('0x30')]);_0x570413['query']=_[_0x5e5b('0x35')](_0x2b81dd['query']);_0x570413['filters']=_['intersection'](_0x570413[_0x5e5b('0x33')],_0x570413['query']);_0x46fec9[_0x5e5b('0x37')]=_['intersection'](_0x570413[_0x5e5b('0x33')],qs[_0x5e5b('0x38')](_0x2b81dd[_0x5e5b('0x34')][_0x5e5b('0x38')]));_0x46fec9[_0x5e5b('0x37')]=_0x46fec9[_0x5e5b('0x37')][_0x5e5b('0x49')]?_0x46fec9['attributes']:_0x570413['model'];if(_0x2b81dd[_0x5e5b('0x34')]['includeAll']){_0x46fec9['include']=[{'all':!![]}];}_0x46fec9=_['merge']({},_0x46fec9,_0x2b81dd[_0x5e5b('0x42')]);return db['ZendeskAccount'][_0x5e5b('0x4a')](_0x46fec9)[_0x5e5b('0x28')](handleEntityNotFound(_0x40e8ce,null))[_0x5e5b('0x28')](respondWithResult(_0x40e8ce,null))[_0x5e5b('0x47')](handleError(_0x40e8ce,null));};exports[_0x5e5b('0x4b')]=function(_0x192445,_0x4fd265){return db[_0x5e5b('0x2f')][_0x5e5b('0x4b')](_0x192445['body'],{})[_0x5e5b('0x28')](respondWithResult(_0x4fd265,0xc9))['catch'](handleError(_0x4fd265,null));};exports[_0x5e5b('0x27')]=function(_0x36d8fa,_0x42ebaf){if(_0x36d8fa[_0x5e5b('0x4c')]['id']){delete _0x36d8fa['body']['id'];}return db[_0x5e5b('0x2f')][_0x5e5b('0x4a')]({'where':{'id':_0x36d8fa['params']['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x42ebaf,null))[_0x5e5b('0x28')](saveUpdates(_0x36d8fa[_0x5e5b('0x4c')],null))[_0x5e5b('0x28')](respondWithResult(_0x42ebaf,null))[_0x5e5b('0x47')](handleError(_0x42ebaf,null));};exports[_0x5e5b('0x29')]=function(_0x50fc9c,_0x690f8c){return db[_0x5e5b('0x2f')]['find']({'where':{'id':_0x50fc9c[_0x5e5b('0x48')]['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x690f8c,null))[_0x5e5b('0x28')](removeEntity(_0x690f8c,null))['catch'](handleError(_0x690f8c,null));};exports[_0x5e5b('0x4d')]=function(_0x3e0ce5,_0x1f32f2,_0x4844ec){var _0x3877e9={};var _0x2e04d6={};var _0x239804;var _0x4a4e0f;return db['ZendeskAccount'][_0x5e5b('0x4e')]({'where':{'id':_0x3e0ce5['params']['id']}})['then'](handleEntityNotFound(_0x1f32f2,null))[_0x5e5b('0x28')](function(_0x13eee9){if(_0x13eee9){_0x239804=_0x13eee9;_0x2e04d6[_0x5e5b('0x33')]=_['keys'](db[_0x5e5b('0x4f')][_0x5e5b('0x30')]);_0x2e04d6[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x3e0ce5[_0x5e5b('0x34')]);_0x2e04d6[_0x5e5b('0x3e')]=_['intersection'](_0x2e04d6['model'],_0x2e04d6[_0x5e5b('0x34')]);_0x3877e9[_0x5e5b('0x37')]=_[_0x5e5b('0x36')](_0x2e04d6[_0x5e5b('0x33')],qs['fields'](_0x3e0ce5[_0x5e5b('0x34')]['fields']));_0x3877e9[_0x5e5b('0x37')]=_0x3877e9[_0x5e5b('0x37')][_0x5e5b('0x49')]?_0x3877e9[_0x5e5b('0x37')]:_0x2e04d6[_0x5e5b('0x33')];_0x3877e9[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3c')](_0x3e0ce5[_0x5e5b('0x34')]['sort']);_0x3877e9[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_[_0x5e5b('0x50')](_0x3e0ce5[_0x5e5b('0x34')],_0x2e04d6[_0x5e5b('0x3e')]));if(_0x3e0ce5['query'][_0x5e5b('0x3f')]){_0x3877e9[_0x5e5b('0x3d')]=_[_0x5e5b('0x40')](_0x3877e9[_0x5e5b('0x3d')],{'$or':_[_0x5e5b('0x51')](_0x3877e9['attributes'],function(_0x13fb51){var _0x5d9ff9={};_0x5d9ff9[_0x13fb51]={'$like':'%'+_0x3e0ce5[_0x5e5b('0x34')]['filter']+'%'};return _0x5d9ff9;})});}_0x3877e9=_[_0x5e5b('0x40')]({},_0x3877e9,_0x3e0ce5[_0x5e5b('0x42')]);return _0x239804[_0x5e5b('0x4d')](_0x3877e9);}})[_0x5e5b('0x28')](function(_0x229a2d){if(_0x229a2d){_0x4a4e0f=_0x229a2d[_0x5e5b('0x49')];if(!_0x3e0ce5['query'][_0x5e5b('0x39')](_0x5e5b('0x3a'))){_0x3877e9[_0x5e5b('0x21')]=qs[_0x5e5b('0x21')](_0x3e0ce5['query']['limit']);_0x3877e9[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0x3e0ce5['query'][_0x5e5b('0x20')]);}return _0x239804[_0x5e5b('0x4d')](_0x3877e9);}})[_0x5e5b('0x28')](function(_0x470042){if(_0x470042){return _0x470042?{'count':_0x4a4e0f,'rows':_0x470042}:null;}})[_0x5e5b('0x28')](respondWithResult(_0x1f32f2,null))['catch'](handleError(_0x1f32f2,null));};exports[_0x5e5b('0x52')]=function(_0x61faf2,_0x494b1d,_0x4795a7){if(_0x61faf2['body']['id']){delete _0x61faf2[_0x5e5b('0x4c')]['id'];}return db[_0x5e5b('0x2f')][_0x5e5b('0x4e')]({'where':{'id':_0x61faf2[_0x5e5b('0x48')]['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x494b1d,null))['then'](function(_0x28d834){if(_0x28d834){_0x61faf2[_0x5e5b('0x4c')]['AccountId']=_0x28d834['id'];_0x61faf2[_0x5e5b('0x4c')]['Subjects']=integrations['getSubjects'](_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x53')],_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x32')]);_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x54')]=integrations[_0x5e5b('0x55')](_0x61faf2['body'][_0x5e5b('0x53')],_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x32')]);return db[_0x5e5b('0x4f')][_0x5e5b('0x4b')](_0x61faf2[_0x5e5b('0x4c')],{'include':[{'model':db[_0x5e5b('0x56')],'as':_0x5e5b('0x57')},{'model':db[_0x5e5b('0x56')],'as':_0x5e5b('0x54')}]});}return null;})[_0x5e5b('0x28')](respondWithResult(_0x494b1d,null))['catch'](handleError(_0x494b1d,null));};exports[_0x5e5b('0x58')]=function(_0x1a3d7b,_0x3c57ad,_0x271af6){var _0xc7171a='';return db['ZendeskAccount'][_0x5e5b('0x4e')]({'where':{'id':_0x1a3d7b[_0x5e5b('0x48')]['id']},'attributes':['id',_0x5e5b('0x59'),_0x5e5b('0x5a'),_0x5e5b('0x5b'),_0x5e5b('0x5c'),'remoteUri']})[_0x5e5b('0x28')](handleEntityNotFound(_0x3c57ad,null))[_0x5e5b('0x28')](function(_0x359c04){if(_0x359c04){_0xc7171a=_0x359c04['remoteUri'];var _0xc8316a=_0xc7171a[_0x5e5b('0x5d')](-0x1);if(_0xc8316a==='/'){_0xc7171a=_0xc7171a[_0x5e5b('0x5e')](0x0,_0xc7171a[_0x5e5b('0x5f')](_0xc8316a));}var _0x344c25={'method':_0x5e5b('0x60'),'uri':util[_0x5e5b('0x61')](_0x5e5b('0x62'),_0xc7171a,_0x5e5b('0x63')),'json':!![]};switch(_0x359c04['authType']){case _0x5e5b('0x5a'):_0x344c25['headers']={'Authorization':util[_0x5e5b('0x61')](_0x5e5b('0x64'),new Buffer(util['format']('%s:%s',_0x359c04[_0x5e5b('0x59')],_0x359c04[_0x5e5b('0x5a')]))['toString'](_0x5e5b('0x65')))};break;case'token':_0x344c25['headers']={'Authorization':util[_0x5e5b('0x61')]('Basic\x20%s',new Buffer(util[_0x5e5b('0x61')](_0x5e5b('0x66'),_0x359c04[_0x5e5b('0x59')],_0x359c04['token']))[_0x5e5b('0x67')](_0x5e5b('0x65')))};break;default:throw new db[(_0x5e5b('0x68'))]['ValidationError'](_0x5e5b('0x69'));}return rp(_0x344c25);}})[_0x5e5b('0x28')](function(_0x58aef4){if(_0x58aef4){var _0x388dbe=['subject','description',_0x5e5b('0x6a'),_0x5e5b('0x6b')];_[_0x5e5b('0x6c')](_0x58aef4[_0x5e5b('0x63')],function(_0x1a7c5c){return _0x388dbe['includes'](_0x1a7c5c[_0x5e5b('0x32')]);});return{'count':_0x58aef4[_0x5e5b('0x63')]['length'],'rows':_['map'](_0x58aef4[_0x5e5b('0x63')],function(_0x467c6b){return{'id':_0x467c6b['id'],'name':_0x467c6b[_0x5e5b('0x6d')]>0x7?_0x467c6b[_0x5e5b('0x6e')]:_0x467c6b[_0x5e5b('0x32')],'custom':_0x467c6b[_0x5e5b('0x6d')]>0x7?!![]:![],'options':_0x467c6b['system_field_options']?_0x467c6b[_0x5e5b('0x6f')]:_0x467c6b[_0x5e5b('0x70')]?_0x467c6b[_0x5e5b('0x70')]:[]};})};}})['then'](respondWithResult(_0x3c57ad,null))['catch'](function(_0x24bcc9){var _0x1eb8cd=_0x1a3d7b[_0x5e5b('0x34')]['test']?0x1f4:_0x24bcc9[_0x5e5b('0x71')]||0x1f4;logger[_0x5e5b('0x2a')](_0x5e5b('0x72'),'getFields',_0x1eb8cd,JSON[_0x5e5b('0x73')](_0x24bcc9));delete _0x24bcc9[_0x5e5b('0x2c')];if(_0x1eb8cd===0x191){_0x1eb8cd=0x190;}_0x3c57ad[_0x5e5b('0x1d')](_0x1eb8cd)['send'](_0x1a3d7b[_0x5e5b('0x34')][_0x5e5b('0x74')]?{'message':_0x5e5b('0x75'),'statusCode':_0x24bcc9[_0x5e5b('0x71')]}:_0x24bcc9);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index ba6ad55..5550019 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 _0xd85c=['exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x542d6b,_0x1615bd){var _0x22d616=function(_0x1db71f){while(--_0x1db71f){_0x542d6b['push'](_0x542d6b['shift']());}};_0x22d616(++_0x1615bd);}(_0xd85c,0x155));var _0xcd85=function(_0x248e85,_0x313681){_0x248e85=_0x248e85-0x0;var _0x1923b4=_0xd85c[_0x248e85];return _0x1923b4;};'use strict';var _=require(_0xcd85('0x0'));var util=require(_0xcd85('0x1'));var logger=require(_0xcd85('0x2'))(_0xcd85('0x3'));var moment=require(_0xcd85('0x4'));var BPromise=require(_0xcd85('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcd85('0x6'));var config=require(_0xcd85('0x7'));var attributes=require(_0xcd85('0x8'));var integrations=require(_0xcd85('0x9'));module[_0xcd85('0xa')]=function(_0x5788c7,_0x51eeed){return _0x5788c7['define'](_0xcd85('0xb'),attributes,{'tableName':_0xcd85('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7f6=['int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0xb7f6,0x17b));var _0x6b7f=function(_0x12dde9,_0x3fa33b){_0x12dde9=_0x12dde9-0x0;var _0x5c2621=_0xb7f6[_0x12dde9];return _0x5c2621;};'use strict';var _=require(_0x6b7f('0x0'));var util=require(_0x6b7f('0x1'));var logger=require('../../config/logger')(_0x6b7f('0x2'));var moment=require(_0x6b7f('0x3'));var BPromise=require(_0x6b7f('0x4'));var rp=require(_0x6b7f('0x5'));var fs=require('fs');var path=require(_0x6b7f('0x6'));var rimraf=require(_0x6b7f('0x7'));var config=require(_0x6b7f('0x8'));var attributes=require(_0x6b7f('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x6b7f('0xa')]=function(_0x2331df,_0x35091b){return _0x2331df[_0x6b7f('0xb')](_0x6b7f('0xc'),attributes,{'tableName':_0x6b7f('0xd'),'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 2979011..8c2f687 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 _0xfa97=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','limit','map','model','attributes','include','ShowZendeskAccount','lodash','util','moment','bluebird'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xfa97,0x65));var _0x7fa9=function(_0x22cef0,_0x3d5137){_0x22cef0=_0x22cef0-0x0;var _0x24a980=_0xfa97[_0x22cef0];return _0x24a980;};'use strict';var _=require(_0x7fa9('0x0'));var util=require(_0x7fa9('0x1'));var moment=require(_0x7fa9('0x2'));var BPromise=require(_0x7fa9('0x3'));var rs=require(_0x7fa9('0x4'));var fs=require('fs');var Redis=require(_0x7fa9('0x5'));var db=require(_0x7fa9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fa9('0x7'))(_0x7fa9('0x8'));var config=require(_0x7fa9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7fa9('0xa')][_0x7fa9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x165bf7,_0x51e53a,_0x593b4a){return new BPromise(function(_0x2b75dd,_0x35ae4a){return client['request'](_0x165bf7,_0x593b4a)[_0x7fa9('0xc')](function(_0x169ec6){logger[_0x7fa9('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x51e53a,_0x7fa9('0xe'));logger[_0x7fa9('0xf')](_0x7fa9('0x10'),_0x51e53a,'request\x20sent',JSON[_0x7fa9('0x11')](_0x169ec6));if(_0x169ec6[_0x7fa9('0x12')]){if(_0x169ec6[_0x7fa9('0x12')][_0x7fa9('0x13')]===0x1f4){logger[_0x7fa9('0x12')](_0x7fa9('0x14'),_0x51e53a,_0x169ec6['error']['message']);return _0x35ae4a(_0x169ec6[_0x7fa9('0x12')][_0x7fa9('0x15')]);}logger['error'](_0x7fa9('0x14'),_0x51e53a,_0x169ec6[_0x7fa9('0x12')]['message']);return _0x2b75dd(_0x169ec6[_0x7fa9('0x12')]['message']);}else{logger['info'](_0x7fa9('0x14'),_0x51e53a,_0x7fa9('0xe'));_0x2b75dd(_0x169ec6[_0x7fa9('0x16')][_0x7fa9('0x15')]);}})[_0x7fa9('0x17')](function(_0x1762db){logger[_0x7fa9('0x12')](_0x7fa9('0x14'),_0x51e53a,_0x1762db);_0x35ae4a(_0x1762db);});});}exports[_0x7fa9('0x18')]=function(_0x2e1d0f){var _0x22b3da=this;return new Promise(function(_0x13fd61,_0x48119c){return db[_0x7fa9('0x19')][_0x7fa9('0x1a')]({'raw':_0x2e1d0f[_0x7fa9('0x1b')]?_0x2e1d0f[_0x7fa9('0x1b')][_0x7fa9('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e1d0f[_0x7fa9('0x1b')]?_0x2e1d0f[_0x7fa9('0x1b')]['where']||null:null,'attributes':_0x2e1d0f[_0x7fa9('0x1b')]?_0x2e1d0f[_0x7fa9('0x1b')]['attributes']||null:null,'limit':_0x2e1d0f[_0x7fa9('0x1b')]?_0x2e1d0f[_0x7fa9('0x1b')][_0x7fa9('0x1d')]||null:null,'include':_0x2e1d0f['options']?_0x2e1d0f['options']['include']?_[_0x7fa9('0x1e')](_0x2e1d0f['options']['include'],function(_0x45bd8c){return{'model':db[_0x45bd8c[_0x7fa9('0x1f')]],'as':_0x45bd8c['as'],'attributes':_0x45bd8c[_0x7fa9('0x20')],'include':_0x45bd8c[_0x7fa9('0x21')]?_[_0x7fa9('0x1e')](_0x45bd8c[_0x7fa9('0x21')],function(_0x1873e0){return{'model':db[_0x1873e0[_0x7fa9('0x1f')]],'as':_0x1873e0['as'],'attributes':_0x1873e0[_0x7fa9('0x20')],'include':_0x1873e0[_0x7fa9('0x21')]?_[_0x7fa9('0x1e')](_0x1873e0[_0x7fa9('0x21')],function(_0x4c55f7){return{'model':db[_0x4c55f7[_0x7fa9('0x1f')]],'as':_0x4c55f7['as'],'attributes':_0x4c55f7[_0x7fa9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7fa9('0xc')](function(_0x3653a6){logger[_0x7fa9('0xd')](_0x7fa9('0x18'),_0x2e1d0f);logger[_0x7fa9('0xf')](_0x7fa9('0x18'),_0x2e1d0f,JSON[_0x7fa9('0x11')](_0x3653a6));_0x13fd61(_0x3653a6);})[_0x7fa9('0x17')](function(_0x230a09){logger[_0x7fa9('0x12')](_0x7fa9('0x18'),_0x230a09['message'],_0x2e1d0f);_0x48119c(_0x22b3da[_0x7fa9('0x12')](0x1f4,_0x230a09[_0x7fa9('0x15')]));});});};exports[_0x7fa9('0x22')]=function(_0x5b6b41){var _0x205237=this;return new Promise(function(_0x16cd04,_0x4abec6){return db[_0x7fa9('0x19')]['find']({'raw':_0x5b6b41['options']?_0x5b6b41[_0x7fa9('0x1b')][_0x7fa9('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b6b41['options']?_0x5b6b41[_0x7fa9('0x1b')]['where']||null:null,'attributes':_0x5b6b41['options']?_0x5b6b41[_0x7fa9('0x1b')]['attributes']||null:null,'include':_0x5b6b41[_0x7fa9('0x1b')]?_0x5b6b41['options'][_0x7fa9('0x21')]?_[_0x7fa9('0x1e')](_0x5b6b41[_0x7fa9('0x1b')]['include'],function(_0x1f129e){return{'model':db[_0x1f129e['model']],'as':_0x1f129e['as'],'attributes':_0x1f129e['attributes'],'include':_0x1f129e[_0x7fa9('0x21')]?_[_0x7fa9('0x1e')](_0x1f129e['include'],function(_0x34c0ab){return{'model':db[_0x34c0ab['model']],'as':_0x34c0ab['as'],'attributes':_0x34c0ab[_0x7fa9('0x20')],'include':_0x34c0ab['include']?_[_0x7fa9('0x1e')](_0x34c0ab[_0x7fa9('0x21')],function(_0x5404e2){return{'model':db[_0x5404e2['model']],'as':_0x5404e2['as'],'attributes':_0x5404e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x7fa9('0xc')](function(_0x3e73e1){logger[_0x7fa9('0xd')]('ShowZendeskAccount',_0x5b6b41);logger['debug'](_0x7fa9('0x22'),_0x5b6b41,JSON[_0x7fa9('0x11')](_0x3e73e1));_0x16cd04(_0x3e73e1);})[_0x7fa9('0x17')](function(_0x3125fb){logger['error'](_0x7fa9('0x22'),_0x3125fb[_0x7fa9('0x15')],_0x5b6b41);_0x4abec6(_0x205237['error'](0x1f4,_0x3125fb['message']));});});}; \ No newline at end of file +var _0x3a9f=['GetZendeskAccount','ZendeskAccount','findAll','options','where','include','map','model','attributes','info','ShowZendeskAccount','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x575a38,_0x2e83d7){var _0x5a7bdd=function(_0x1bf478){while(--_0x1bf478){_0x575a38['push'](_0x575a38['shift']());}};_0x5a7bdd(++_0x2e83d7);}(_0x3a9f,0x1e8));var _0xf3a9=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x3a9f[_0x1f8053];return _0x174fd8;};'use strict';var _=require(_0xf3a9('0x0'));var util=require(_0xf3a9('0x1'));var moment=require('moment');var BPromise=require(_0xf3a9('0x2'));var rs=require(_0xf3a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3a9('0x4'))['db'];var utils=require(_0xf3a9('0x5'));var logger=require(_0xf3a9('0x6'))(_0xf3a9('0x7'));var config=require(_0xf3a9('0x8'));var jayson=require(_0xf3a9('0x9'));var client=jayson[_0xf3a9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d9a48,_0x378af5,_0xd55c7d){return new BPromise(function(_0x5c2732,_0x306785){return client[_0xf3a9('0xb')](_0x4d9a48,_0xd55c7d)[_0xf3a9('0xc')](function(_0xdcf5c5){logger['info'](_0xf3a9('0xd'),_0x378af5,_0xf3a9('0xe'));logger[_0xf3a9('0xf')](_0xf3a9('0x10'),_0x378af5,'request\x20sent',JSON[_0xf3a9('0x11')](_0xdcf5c5));if(_0xdcf5c5[_0xf3a9('0x12')]){if(_0xdcf5c5[_0xf3a9('0x12')][_0xf3a9('0x13')]===0x1f4){logger[_0xf3a9('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x378af5,_0xdcf5c5[_0xf3a9('0x12')]['message']);return _0x306785(_0xdcf5c5['error'][_0xf3a9('0x14')]);}logger['error'](_0xf3a9('0xd'),_0x378af5,_0xdcf5c5[_0xf3a9('0x12')][_0xf3a9('0x14')]);return _0x5c2732(_0xdcf5c5[_0xf3a9('0x12')][_0xf3a9('0x14')]);}else{logger['info'](_0xf3a9('0xd'),_0x378af5,_0xf3a9('0xe'));_0x5c2732(_0xdcf5c5['result'][_0xf3a9('0x14')]);}})[_0xf3a9('0x15')](function(_0x27691e){logger[_0xf3a9('0x12')](_0xf3a9('0xd'),_0x378af5,_0x27691e);_0x306785(_0x27691e);});});}exports[_0xf3a9('0x16')]=function(_0x5ab6f7){var _0x40a74a=this;return new Promise(function(_0x3ed2aa,_0x1b1d6f){return db[_0xf3a9('0x17')][_0xf3a9('0x18')]({'raw':_0x5ab6f7['options']?_0x5ab6f7[_0xf3a9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5ab6f7[_0xf3a9('0x19')]?_0x5ab6f7[_0xf3a9('0x19')][_0xf3a9('0x1a')]||null:null,'attributes':_0x5ab6f7['options']?_0x5ab6f7[_0xf3a9('0x19')]['attributes']||null:null,'limit':_0x5ab6f7['options']?_0x5ab6f7[_0xf3a9('0x19')]['limit']||null:null,'include':_0x5ab6f7[_0xf3a9('0x19')]?_0x5ab6f7[_0xf3a9('0x19')][_0xf3a9('0x1b')]?_[_0xf3a9('0x1c')](_0x5ab6f7[_0xf3a9('0x19')][_0xf3a9('0x1b')],function(_0x41c6cf){return{'model':db[_0x41c6cf[_0xf3a9('0x1d')]],'as':_0x41c6cf['as'],'attributes':_0x41c6cf[_0xf3a9('0x1e')],'include':_0x41c6cf['include']?_['map'](_0x41c6cf[_0xf3a9('0x1b')],function(_0x369c64){return{'model':db[_0x369c64[_0xf3a9('0x1d')]],'as':_0x369c64['as'],'attributes':_0x369c64[_0xf3a9('0x1e')],'include':_0x369c64['include']?_['map'](_0x369c64[_0xf3a9('0x1b')],function(_0x537dfc){return{'model':db[_0x537dfc['model']],'as':_0x537dfc['as'],'attributes':_0x537dfc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x24b15c){logger[_0xf3a9('0x1f')](_0xf3a9('0x16'),_0x5ab6f7);logger[_0xf3a9('0xf')](_0xf3a9('0x16'),_0x5ab6f7,JSON[_0xf3a9('0x11')](_0x24b15c));_0x3ed2aa(_0x24b15c);})['catch'](function(_0x5ba66c){logger[_0xf3a9('0x12')]('GetZendeskAccount',_0x5ba66c[_0xf3a9('0x14')],_0x5ab6f7);_0x1b1d6f(_0x40a74a[_0xf3a9('0x12')](0x1f4,_0x5ba66c[_0xf3a9('0x14')]));});});};exports[_0xf3a9('0x20')]=function(_0x4a35e2){var _0x32dc82=this;return new Promise(function(_0x39c8e1,_0x230782){return db[_0xf3a9('0x17')]['find']({'raw':_0x4a35e2[_0xf3a9('0x19')]?_0x4a35e2[_0xf3a9('0x19')][_0xf3a9('0x21')]===undefined?!![]:![]:!![],'where':_0x4a35e2[_0xf3a9('0x19')]?_0x4a35e2[_0xf3a9('0x19')][_0xf3a9('0x1a')]||null:null,'attributes':_0x4a35e2[_0xf3a9('0x19')]?_0x4a35e2['options'][_0xf3a9('0x1e')]||null:null,'include':_0x4a35e2[_0xf3a9('0x19')]?_0x4a35e2[_0xf3a9('0x19')][_0xf3a9('0x1b')]?_['map'](_0x4a35e2[_0xf3a9('0x19')][_0xf3a9('0x1b')],function(_0xc7aff){return{'model':db[_0xc7aff[_0xf3a9('0x1d')]],'as':_0xc7aff['as'],'attributes':_0xc7aff[_0xf3a9('0x1e')],'include':_0xc7aff['include']?_[_0xf3a9('0x1c')](_0xc7aff[_0xf3a9('0x1b')],function(_0x3746e1){return{'model':db[_0x3746e1['model']],'as':_0x3746e1['as'],'attributes':_0x3746e1[_0xf3a9('0x1e')],'include':_0x3746e1[_0xf3a9('0x1b')]?_[_0xf3a9('0x1c')](_0x3746e1['include'],function(_0x5b9d7a){return{'model':db[_0x5b9d7a['model']],'as':_0x5b9d7a['as'],'attributes':_0x5b9d7a[_0xf3a9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa6c183){logger[_0xf3a9('0x1f')](_0xf3a9('0x20'),_0x4a35e2);logger[_0xf3a9('0xf')](_0xf3a9('0x20'),_0x4a35e2,JSON[_0xf3a9('0x11')](_0xa6c183));_0x39c8e1(_0xa6c183);})[_0xf3a9('0x15')](function(_0x13c49a){logger['error'](_0xf3a9('0x20'),_0x13c49a['message'],_0x4a35e2);_0x230782(_0x32dc82[_0xf3a9('0x12')](0x1f4,_0x13c49a[_0xf3a9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 234b934..7485b46 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 _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0xb688,0xcf));var _0x8b68=function(_0x1ca693,_0x1235da){_0x1ca693=_0x1ca693-0x0;var _0x2ae933=_0xb688[_0x1ca693];return _0x2ae933;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file +var _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x4ea61e,_0x5abebf){var _0x1429fc=function(_0x216984){while(--_0x216984){_0x4ea61e['push'](_0x4ea61e['shift']());}};_0x1429fc(++_0x5abebf);}(_0x5eb8,0xb0));var _0x85eb=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0x5eb8[_0x104a84];return _0x4973ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index baf5b16..1bcd345 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 _0xe6ab=['sequelize','exports','STRING'];(function(_0x375d4d,_0x51c87e){var _0xe7c3e4=function(_0x129ed0){while(--_0x129ed0){_0x375d4d['push'](_0x375d4d['shift']());}};_0xe7c3e4(++_0x51c87e);}(_0xe6ab,0x141));var _0xbe6a=function(_0x115a94,_0x13be10){_0x115a94=_0x115a94-0x0;var _0x2e9594=_0xe6ab[_0x115a94];return _0x2e9594;};'use strict';var Sequelize=require(_0xbe6a('0x0'));module[_0xbe6a('0x1')]={'name':{'type':Sequelize[_0xbe6a('0x2')]},'description':{'type':Sequelize[_0xbe6a('0x2')]}}; \ No newline at end of file +var _0xea34=['exports','sequelize'];(function(_0x47ca45,_0x4805b7){var _0x5dad8a=function(_0x18379e){while(--_0x18379e){_0x47ca45['push'](_0x47ca45['shift']());}};_0x5dad8a(++_0x4805b7);}(_0xea34,0xed));var _0x4ea3=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xea34[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require(_0x4ea3('0x0'));module[_0x4ea3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index e54247e..a9914ee 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 _0xdbc2=['filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','keys','body','find','params','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','key','map','query'];(function(_0x513a46,_0x4689ef){var _0x478b47=function(_0x4219e4){while(--_0x4219e4){_0x513a46['push'](_0x513a46['shift']());}};_0x478b47(++_0x4689ef);}(_0xdbc2,0x169));var _0x2dbc=function(_0x1740bf,_0x2b4e0c){_0x1740bf=_0x1740bf-0x0;var _0x2ab239=_0xdbc2[_0x1740bf];return _0x2ab239;};'use strict';var emlformat=require(_0x2dbc('0x0'));var rimraf=require(_0x2dbc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dbc('0x2'));var rp=require(_0x2dbc('0x3'));var moment=require(_0x2dbc('0x4'));var BPromise=require(_0x2dbc('0x5'));var Mustache=require(_0x2dbc('0x6'));var util=require(_0x2dbc('0x7'));var path=require(_0x2dbc('0x8'));var sox=require(_0x2dbc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2dbc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2dbc('0xb'));var jsforce=require(_0x2dbc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2dbc('0xd'));var querystring=require(_0x2dbc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2dbc('0xf'));var qs=require(_0x2dbc('0x10'));var as=require(_0x2dbc('0x11'));var hardwareService=require(_0x2dbc('0x12'));var logger=require(_0x2dbc('0x13'))(_0x2dbc('0x14'));var utils=require(_0x2dbc('0x15'));var config=require(_0x2dbc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2dbc('0x17'))['db'];function respondWithStatusCode(_0x407fbf,_0x345ca9){_0x345ca9=_0x345ca9||0xcc;return function(_0x8961e2){if(_0x8961e2){return _0x407fbf[_0x2dbc('0x18')](_0x345ca9);}return _0x407fbf['status'](_0x345ca9)[_0x2dbc('0x19')]();};}function respondWithResult(_0x56ceb0,_0x10efcb){_0x10efcb=_0x10efcb||0xc8;return function(_0x1f5a42){if(_0x1f5a42){return _0x56ceb0[_0x2dbc('0x1a')](_0x10efcb)['json'](_0x1f5a42);}};}function respondWithFilteredResult(_0x50a480,_0x506d53){return function(_0x94a389){if(_0x94a389){var _0xe18c5=typeof _0x506d53[_0x2dbc('0x1b')]===_0x2dbc('0x1c')&&typeof _0x506d53[_0x2dbc('0x1d')]===_0x2dbc('0x1c');var _0x14dc4c=_0x94a389['count'];var _0x1fd561=_0xe18c5?0x0:_0x506d53['offset'];var _0x21cc8d=_0xe18c5?_0x94a389[_0x2dbc('0x1e')]:_0x506d53[_0x2dbc('0x1b')]+_0x506d53[_0x2dbc('0x1d')];var _0x27a21f;if(_0x21cc8d>=_0x14dc4c){_0x21cc8d=_0x14dc4c;_0x27a21f=0xc8;}else{_0x27a21f=0xce;}_0x50a480[_0x2dbc('0x1a')](_0x27a21f);return _0x50a480['set'](_0x2dbc('0x1f'),_0x1fd561+'-'+_0x21cc8d+'/'+_0x14dc4c)[_0x2dbc('0x20')](_0x94a389);}return null;};}function patchUpdates(_0x67e8e6){return function(_0x299a8f){try{jsonpatch['apply'](_0x299a8f,_0x67e8e6,!![]);}catch(_0x291899){return BPromise[_0x2dbc('0x21')](_0x291899);}return _0x299a8f[_0x2dbc('0x22')]();};}function saveUpdates(_0x2a18e5,_0x4ca8d4){return function(_0x38dd80){if(_0x38dd80){return _0x38dd80[_0x2dbc('0x23')](_0x2a18e5)[_0x2dbc('0x24')](function(_0x4e155c){return _0x4e155c;});}return null;};}function removeEntity(_0x4a5122,_0x12ae8d){return function(_0x13e970){if(_0x13e970){return _0x13e970[_0x2dbc('0x25')]()[_0x2dbc('0x24')](function(){_0x4a5122[_0x2dbc('0x1a')](0xcc)[_0x2dbc('0x19')]();});}};}function handleEntityNotFound(_0x1c74ee,_0xcff559){return function(_0x50298a){if(!_0x50298a){_0x1c74ee[_0x2dbc('0x18')](0x194);}return _0x50298a;};}function handleError(_0xdd8dc3,_0x26330a){_0x26330a=_0x26330a||0x1f4;return function(_0x2b49da){logger[_0x2dbc('0x26')](_0x2b49da[_0x2dbc('0x27')]);if(_0x2b49da[_0x2dbc('0x28')]){delete _0x2b49da[_0x2dbc('0x28')];}_0xdd8dc3[_0x2dbc('0x1a')](_0x26330a)[_0x2dbc('0x29')](_0x2b49da);};}exports[_0x2dbc('0x2a')]=function(_0x281d08,_0x57e987){var _0xe36bd={},_0x13ea06={},_0x1d7b52={'count':0x0,'rows':[]};var _0x233f20=_['map'](db[_0x2dbc('0x2b')][_0x2dbc('0x2c')],function(_0x48a3ed){return{'name':_0x48a3ed[_0x2dbc('0x2d')],'type':_0x48a3ed['type'][_0x2dbc('0x2e')]};});_0x13ea06['model']=_[_0x2dbc('0x2f')](_0x233f20,_0x2dbc('0x28'));_0x13ea06['query']=_['keys'](_0x281d08[_0x2dbc('0x30')]);_0x13ea06[_0x2dbc('0x31')]=_[_0x2dbc('0x32')](_0x13ea06['model'],_0x13ea06[_0x2dbc('0x30')]);_0xe36bd[_0x2dbc('0x33')]=_[_0x2dbc('0x32')](_0x13ea06[_0x2dbc('0x34')],qs[_0x2dbc('0x35')](_0x281d08[_0x2dbc('0x30')][_0x2dbc('0x35')]));_0xe36bd['attributes']=_0xe36bd[_0x2dbc('0x33')][_0x2dbc('0x36')]?_0xe36bd[_0x2dbc('0x33')]:_0x13ea06[_0x2dbc('0x34')];if(!_0x281d08[_0x2dbc('0x30')][_0x2dbc('0x37')](_0x2dbc('0x38'))){_0xe36bd[_0x2dbc('0x1d')]=qs[_0x2dbc('0x1d')](_0x281d08[_0x2dbc('0x30')]['limit']);_0xe36bd[_0x2dbc('0x1b')]=qs['offset'](_0x281d08['query']['offset']);}_0xe36bd[_0x2dbc('0x39')]=qs['sort'](_0x281d08[_0x2dbc('0x30')][_0x2dbc('0x3a')]);_0xe36bd[_0x2dbc('0x3b')]=qs[_0x2dbc('0x31')](_[_0x2dbc('0x3c')](_0x281d08[_0x2dbc('0x30')],_0x13ea06[_0x2dbc('0x31')]),_0x233f20);if(_0x281d08[_0x2dbc('0x30')][_0x2dbc('0x3d')]){_0xe36bd[_0x2dbc('0x3b')]=_[_0x2dbc('0x3e')](_0xe36bd[_0x2dbc('0x3b')],{'$or':_[_0x2dbc('0x2f')](_0x233f20,function(_0x460ef5){if(_0x460ef5['type']!=='VIRTUAL'){var _0x3b0e29={};_0x3b0e29[_0x460ef5[_0x2dbc('0x28')]]={'$like':'%'+_0x281d08['query']['filter']+'%'};return _0x3b0e29;}})});}_0xe36bd=_[_0x2dbc('0x3e')]({},_0xe36bd,_0x281d08[_0x2dbc('0x3f')]);var _0x4d9f82={'where':_0xe36bd[_0x2dbc('0x3b')]};return db['ZendeskConfiguration'][_0x2dbc('0x1e')](_0x4d9f82)[_0x2dbc('0x24')](function(_0x525d31){_0x1d7b52['count']=_0x525d31;if(_0x281d08[_0x2dbc('0x30')][_0x2dbc('0x40')]){_0xe36bd[_0x2dbc('0x41')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x2dbc('0x42')](_0xe36bd);})['then'](function(_0x25cf61){_0x1d7b52['rows']=_0x25cf61;return _0x1d7b52;})['then'](respondWithFilteredResult(_0x57e987,_0xe36bd))[_0x2dbc('0x43')](handleError(_0x57e987,null));};exports[_0x2dbc('0x44')]=function(_0xe32848,_0xac4984){var _0x5ce1be={'raw':![],'where':{'id':_0xe32848['params']['id']}},_0xc3ece0={};_0xc3ece0['model']=_['keys'](db[_0x2dbc('0x2b')]['rawAttributes']);_0xc3ece0[_0x2dbc('0x30')]=_[_0x2dbc('0x45')](_0xe32848['query']);_0xc3ece0[_0x2dbc('0x31')]=_[_0x2dbc('0x32')](_0xc3ece0[_0x2dbc('0x34')],_0xc3ece0[_0x2dbc('0x30')]);_0x5ce1be[_0x2dbc('0x33')]=_[_0x2dbc('0x32')](_0xc3ece0[_0x2dbc('0x34')],qs[_0x2dbc('0x35')](_0xe32848['query']['fields']));_0x5ce1be[_0x2dbc('0x33')]=_0x5ce1be[_0x2dbc('0x33')][_0x2dbc('0x36')]?_0x5ce1be['attributes']:_0xc3ece0[_0x2dbc('0x34')];if(_0xe32848[_0x2dbc('0x30')][_0x2dbc('0x40')]){_0x5ce1be['include']=[{'all':!![]}];}_0x5ce1be=_[_0x2dbc('0x3e')]({},_0x5ce1be,_0xe32848[_0x2dbc('0x3f')]);return db[_0x2dbc('0x2b')]['find'](_0x5ce1be)[_0x2dbc('0x24')](handleEntityNotFound(_0xac4984,null))['then'](respondWithResult(_0xac4984,null))[_0x2dbc('0x43')](handleError(_0xac4984,null));};exports['create']=function(_0x193145,_0x113ffe){return db[_0x2dbc('0x2b')]['create'](_0x193145[_0x2dbc('0x46')],{})[_0x2dbc('0x24')](respondWithResult(_0x113ffe,0xc9))[_0x2dbc('0x43')](handleError(_0x113ffe,null));};exports[_0x2dbc('0x23')]=function(_0x5d29f9,_0x210b1e){if(_0x5d29f9[_0x2dbc('0x46')]['id']){delete _0x5d29f9[_0x2dbc('0x46')]['id'];}return db['ZendeskConfiguration'][_0x2dbc('0x47')]({'where':{'id':_0x5d29f9[_0x2dbc('0x48')]['id']}})[_0x2dbc('0x24')](handleEntityNotFound(_0x210b1e,null))['then'](saveUpdates(_0x5d29f9['body'],null))[_0x2dbc('0x24')](respondWithResult(_0x210b1e,null))[_0x2dbc('0x43')](handleError(_0x210b1e,null));};exports[_0x2dbc('0x25')]=function(_0x393f5d,_0x4a1aab){return db[_0x2dbc('0x2b')][_0x2dbc('0x47')]({'where':{'id':_0x393f5d[_0x2dbc('0x48')]['id']}})[_0x2dbc('0x24')](handleEntityNotFound(_0x4a1aab,null))[_0x2dbc('0x24')](removeEntity(_0x4a1aab,null))['catch'](handleError(_0x4a1aab,null));};exports[_0x2dbc('0x49')]=function(_0x2b0267,_0x36c580,_0xbc9aac){var _0x420fc3={};var _0x1c1bf5={};var _0x5593c3;var _0x382448;return db['ZendeskConfiguration'][_0x2dbc('0x4a')]({'where':{'id':_0x2b0267[_0x2dbc('0x48')]['id']}})[_0x2dbc('0x24')](handleEntityNotFound(_0x36c580,null))[_0x2dbc('0x24')](function(_0x1ca5f3){if(_0x1ca5f3){_0x5593c3=_0x1ca5f3;_0x1c1bf5['model']=_['keys'](db[_0x2dbc('0x4b')]['rawAttributes']);_0x1c1bf5[_0x2dbc('0x30')]=_[_0x2dbc('0x45')](_0x2b0267[_0x2dbc('0x30')]);_0x1c1bf5[_0x2dbc('0x31')]=_['intersection'](_0x1c1bf5['model'],_0x1c1bf5['query']);_0x420fc3[_0x2dbc('0x33')]=_[_0x2dbc('0x32')](_0x1c1bf5['model'],qs[_0x2dbc('0x35')](_0x2b0267[_0x2dbc('0x30')][_0x2dbc('0x35')]));_0x420fc3[_0x2dbc('0x33')]=_0x420fc3['attributes'][_0x2dbc('0x36')]?_0x420fc3[_0x2dbc('0x33')]:_0x1c1bf5[_0x2dbc('0x34')];_0x420fc3[_0x2dbc('0x39')]=qs[_0x2dbc('0x3a')](_0x2b0267[_0x2dbc('0x30')][_0x2dbc('0x3a')]);_0x420fc3[_0x2dbc('0x3b')]=qs[_0x2dbc('0x31')](_[_0x2dbc('0x3c')](_0x2b0267[_0x2dbc('0x30')],_0x1c1bf5[_0x2dbc('0x31')]));if(_0x2b0267[_0x2dbc('0x30')][_0x2dbc('0x3d')]){_0x420fc3[_0x2dbc('0x3b')]=_[_0x2dbc('0x3e')](_0x420fc3[_0x2dbc('0x3b')],{'$or':_[_0x2dbc('0x2f')](_0x420fc3[_0x2dbc('0x33')],function(_0x3f7f61){var _0x354218={};_0x354218[_0x3f7f61]={'$like':'%'+_0x2b0267[_0x2dbc('0x30')][_0x2dbc('0x3d')]+'%'};return _0x354218;})});}_0x420fc3=_['merge']({},_0x420fc3,_0x2b0267[_0x2dbc('0x3f')]);return _0x5593c3[_0x2dbc('0x49')](_0x420fc3);}})[_0x2dbc('0x24')](function(_0x1b88ee){if(_0x1b88ee){_0x382448=_0x1b88ee[_0x2dbc('0x36')];if(!_0x2b0267[_0x2dbc('0x30')][_0x2dbc('0x37')](_0x2dbc('0x38'))){_0x420fc3[_0x2dbc('0x1d')]=qs[_0x2dbc('0x1d')](_0x2b0267[_0x2dbc('0x30')][_0x2dbc('0x1d')]);_0x420fc3[_0x2dbc('0x1b')]=qs[_0x2dbc('0x1b')](_0x2b0267[_0x2dbc('0x30')][_0x2dbc('0x1b')]);}return _0x5593c3['getFields'](_0x420fc3);}})['then'](function(_0x47282e){if(_0x47282e){return _0x47282e?{'count':_0x382448,'rows':_0x47282e}:null;}})[_0x2dbc('0x24')](respondWithResult(_0x36c580,null))[_0x2dbc('0x43')](handleError(_0x36c580,null));};exports[_0x2dbc('0x4c')]=function(_0x479cda,_0x1d07be,_0x504d8c){var _0xcbea66={};var _0x301366={};var _0x140c14;var _0x540fee;return db['ZendeskConfiguration'][_0x2dbc('0x4a')]({'where':{'id':_0x479cda[_0x2dbc('0x48')]['id']}})[_0x2dbc('0x24')](handleEntityNotFound(_0x1d07be,null))[_0x2dbc('0x24')](function(_0x27b07f){if(_0x27b07f){_0x140c14=_0x27b07f;_0x301366[_0x2dbc('0x34')]=_[_0x2dbc('0x45')](db[_0x2dbc('0x4b')][_0x2dbc('0x2c')]);_0x301366[_0x2dbc('0x30')]=_[_0x2dbc('0x45')](_0x479cda[_0x2dbc('0x30')]);_0x301366[_0x2dbc('0x31')]=_['intersection'](_0x301366[_0x2dbc('0x34')],_0x301366[_0x2dbc('0x30')]);_0xcbea66[_0x2dbc('0x33')]=_[_0x2dbc('0x32')](_0x301366[_0x2dbc('0x34')],qs[_0x2dbc('0x35')](_0x479cda['query'][_0x2dbc('0x35')]));_0xcbea66['attributes']=_0xcbea66[_0x2dbc('0x33')][_0x2dbc('0x36')]?_0xcbea66[_0x2dbc('0x33')]:_0x301366['model'];_0xcbea66[_0x2dbc('0x39')]=qs[_0x2dbc('0x3a')](_0x479cda['query'][_0x2dbc('0x3a')]);_0xcbea66[_0x2dbc('0x3b')]=qs[_0x2dbc('0x31')](_[_0x2dbc('0x3c')](_0x479cda[_0x2dbc('0x30')],_0x301366[_0x2dbc('0x31')]));if(_0x479cda[_0x2dbc('0x30')][_0x2dbc('0x3d')]){_0xcbea66[_0x2dbc('0x3b')]=_['merge'](_0xcbea66['where'],{'$or':_[_0x2dbc('0x2f')](_0xcbea66[_0x2dbc('0x33')],function(_0x233c5f){var _0x4ac2c7={};_0x4ac2c7[_0x233c5f]={'$like':'%'+_0x479cda['query']['filter']+'%'};return _0x4ac2c7;})});}_0xcbea66=_['merge']({},_0xcbea66,_0x479cda[_0x2dbc('0x3f')]);return _0x140c14['getSubjects'](_0xcbea66);}})[_0x2dbc('0x24')](function(_0x9e0e5e){if(_0x9e0e5e){_0x540fee=_0x9e0e5e[_0x2dbc('0x36')];if(!_0x479cda[_0x2dbc('0x30')]['hasOwnProperty'](_0x2dbc('0x38'))){_0xcbea66['limit']=qs[_0x2dbc('0x1d')](_0x479cda['query'][_0x2dbc('0x1d')]);_0xcbea66[_0x2dbc('0x1b')]=qs[_0x2dbc('0x1b')](_0x479cda['query'][_0x2dbc('0x1b')]);}return _0x140c14[_0x2dbc('0x4c')](_0xcbea66);}})[_0x2dbc('0x24')](function(_0x49b8ad){if(_0x49b8ad){return _0x49b8ad?{'count':_0x540fee,'rows':_0x49b8ad}:null;}})[_0x2dbc('0x24')](respondWithResult(_0x1d07be,null))[_0x2dbc('0x43')](handleError(_0x1d07be,null));};exports[_0x2dbc('0x4d')]=function(_0x152960,_0x3435f6,_0x40b28c){var _0x563781={};var _0x4da904={};var _0x3e6803;var _0x3f7392;return db[_0x2dbc('0x2b')]['findOne']({'where':{'id':_0x152960['params']['id']}})[_0x2dbc('0x24')](handleEntityNotFound(_0x3435f6,null))[_0x2dbc('0x24')](function(_0x55ff07){if(_0x55ff07){_0x3e6803=_0x55ff07;_0x4da904[_0x2dbc('0x34')]=_['keys'](db[_0x2dbc('0x4b')][_0x2dbc('0x2c')]);_0x4da904[_0x2dbc('0x30')]=_[_0x2dbc('0x45')](_0x152960['query']);_0x4da904[_0x2dbc('0x31')]=_[_0x2dbc('0x32')](_0x4da904[_0x2dbc('0x34')],_0x4da904['query']);_0x563781[_0x2dbc('0x33')]=_[_0x2dbc('0x32')](_0x4da904[_0x2dbc('0x34')],qs['fields'](_0x152960['query'][_0x2dbc('0x35')]));_0x563781[_0x2dbc('0x33')]=_0x563781[_0x2dbc('0x33')][_0x2dbc('0x36')]?_0x563781[_0x2dbc('0x33')]:_0x4da904[_0x2dbc('0x34')];_0x563781[_0x2dbc('0x39')]=qs[_0x2dbc('0x3a')](_0x152960['query']['sort']);_0x563781[_0x2dbc('0x3b')]=qs[_0x2dbc('0x31')](_[_0x2dbc('0x3c')](_0x152960[_0x2dbc('0x30')],_0x4da904['filters']));if(_0x152960[_0x2dbc('0x30')][_0x2dbc('0x3d')]){_0x563781[_0x2dbc('0x3b')]=_['merge'](_0x563781['where'],{'$or':_[_0x2dbc('0x2f')](_0x563781[_0x2dbc('0x33')],function(_0x25d693){var _0x51db25={};_0x51db25[_0x25d693]={'$like':'%'+_0x152960['query'][_0x2dbc('0x3d')]+'%'};return _0x51db25;})});}_0x563781=_[_0x2dbc('0x3e')]({},_0x563781,_0x152960[_0x2dbc('0x3f')]);return _0x3e6803['getDescriptions'](_0x563781);}})[_0x2dbc('0x24')](function(_0x2e6d7d){if(_0x2e6d7d){_0x3f7392=_0x2e6d7d['length'];if(!_0x152960[_0x2dbc('0x30')][_0x2dbc('0x37')](_0x2dbc('0x38'))){_0x563781['limit']=qs[_0x2dbc('0x1d')](_0x152960[_0x2dbc('0x30')][_0x2dbc('0x1d')]);_0x563781[_0x2dbc('0x1b')]=qs['offset'](_0x152960[_0x2dbc('0x30')]['offset']);}return _0x3e6803[_0x2dbc('0x4d')](_0x563781);}})['then'](function(_0x12edd1){if(_0x12edd1){return _0x12edd1?{'count':_0x3f7392,'rows':_0x12edd1}:null;}})[_0x2dbc('0x24')](respondWithResult(_0x3435f6,null))['catch'](handleError(_0x3435f6,null));};exports[_0x2dbc('0x4e')]=function(_0x31c976,_0x326193,_0x4a4959){var _0x3ada6f={};var _0x37334e={};var _0x39631b;var _0x2225de;return db[_0x2dbc('0x2b')]['findOne']({'where':{'id':_0x31c976[_0x2dbc('0x48')]['id']}})['then'](handleEntityNotFound(_0x326193,null))[_0x2dbc('0x24')](function(_0x20299c){if(_0x20299c){_0x39631b=_0x20299c;_0x37334e[_0x2dbc('0x34')]=_[_0x2dbc('0x45')](db[_0x2dbc('0x4f')]['rawAttributes']);_0x37334e[_0x2dbc('0x30')]=_['keys'](_0x31c976[_0x2dbc('0x30')]);_0x37334e['filters']=_[_0x2dbc('0x32')](_0x37334e[_0x2dbc('0x34')],_0x37334e[_0x2dbc('0x30')]);_0x3ada6f['attributes']=_[_0x2dbc('0x32')](_0x37334e[_0x2dbc('0x34')],qs['fields'](_0x31c976[_0x2dbc('0x30')][_0x2dbc('0x35')]));_0x3ada6f[_0x2dbc('0x33')]=_0x3ada6f['attributes']['length']?_0x3ada6f[_0x2dbc('0x33')]:_0x37334e['model'];_0x3ada6f[_0x2dbc('0x39')]=qs[_0x2dbc('0x3a')](_0x31c976[_0x2dbc('0x30')][_0x2dbc('0x3a')]);_0x3ada6f[_0x2dbc('0x3b')]=qs[_0x2dbc('0x31')](_[_0x2dbc('0x3c')](_0x31c976[_0x2dbc('0x30')],_0x37334e[_0x2dbc('0x31')]));if(_0x31c976[_0x2dbc('0x30')]['filter']){_0x3ada6f[_0x2dbc('0x3b')]=_['merge'](_0x3ada6f['where'],{'$or':_[_0x2dbc('0x2f')](_0x3ada6f[_0x2dbc('0x33')],function(_0x53a1a1){var _0x3ddbb0={};_0x3ddbb0[_0x53a1a1]={'$like':'%'+_0x31c976['query'][_0x2dbc('0x3d')]+'%'};return _0x3ddbb0;})});}_0x3ada6f=_[_0x2dbc('0x3e')]({},_0x3ada6f,_0x31c976[_0x2dbc('0x3f')]);return _0x39631b['getTags'](_0x3ada6f);}})[_0x2dbc('0x24')](function(_0x5605b8){if(_0x5605b8){_0x2225de=_0x5605b8[_0x2dbc('0x36')];if(!_0x31c976[_0x2dbc('0x30')][_0x2dbc('0x37')](_0x2dbc('0x38'))){_0x3ada6f[_0x2dbc('0x1d')]=qs[_0x2dbc('0x1d')](_0x31c976['query'][_0x2dbc('0x1d')]);_0x3ada6f['offset']=qs[_0x2dbc('0x1b')](_0x31c976[_0x2dbc('0x30')][_0x2dbc('0x1b')]);}return _0x39631b[_0x2dbc('0x4e')](_0x3ada6f);}})[_0x2dbc('0x24')](function(_0x6cdb8){if(_0x6cdb8){return _0x6cdb8?{'count':_0x2225de,'rows':_0x6cdb8}:null;}})['then'](respondWithResult(_0x326193,null))['catch'](handleError(_0x326193,null));};exports[_0x2dbc('0x50')]=function(_0x2601db,_0x314bb8,_0x2ac6d4){if(_0x2601db[_0x2dbc('0x46')]['id']){delete _0x2601db[_0x2dbc('0x46')]['id'];}return db[_0x2dbc('0x2b')]['findOne']({'where':{'id':_0x2601db[_0x2dbc('0x48')]['id']}})[_0x2dbc('0x24')](handleEntityNotFound(_0x314bb8,null))[_0x2dbc('0x24')](function(_0x559ae9){if(_0x559ae9){return _0x559ae9[_0x2dbc('0x50')](_0x2601db[_0x2dbc('0x46')][_0x2dbc('0x51')]||[]);}return null;})[_0x2dbc('0x24')](respondWithResult(_0x314bb8,null))['catch'](handleError(_0x314bb8,null));}; \ No newline at end of file +var _0xb8a2=['../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb8a2,0x137));var _0x2b8a=function(_0x410239,_0x584d25){_0x410239=_0x410239-0x0;var _0x1728b6=_0xb8a2[_0x410239];return _0x1728b6;};'use strict';var emlformat=require(_0x2b8a('0x0'));var rimraf=require(_0x2b8a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b8a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b8a('0x3'));var util=require(_0x2b8a('0x4'));var path=require(_0x2b8a('0x5'));var sox=require(_0x2b8a('0x6'));var csv=require('to-csv');var ejs=require(_0x2b8a('0x7'));var fs=require('fs');var fs_extra=require(_0x2b8a('0x8'));var _=require(_0x2b8a('0x9'));var squel=require(_0x2b8a('0xa'));var crypto=require(_0x2b8a('0xb'));var jsforce=require(_0x2b8a('0xc'));var deskjs=require(_0x2b8a('0xd'));var toCsv=require(_0x2b8a('0xe'));var querystring=require(_0x2b8a('0xf'));var Papa=require(_0x2b8a('0x10'));var Redis=require('ioredis');var authService=require(_0x2b8a('0x11'));var qs=require(_0x2b8a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b8a('0x13'));var logger=require(_0x2b8a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x2b8a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b8a('0x16'))['db'];function respondWithStatusCode(_0x337d38,_0x342f71){_0x342f71=_0x342f71||0xcc;return function(_0xfa7a88){if(_0xfa7a88){return _0x337d38[_0x2b8a('0x17')](_0x342f71);}return _0x337d38[_0x2b8a('0x18')](_0x342f71)['end']();};}function respondWithResult(_0x40eb61,_0x4b4f51){_0x4b4f51=_0x4b4f51||0xc8;return function(_0x199d33){if(_0x199d33){return _0x40eb61[_0x2b8a('0x18')](_0x4b4f51)['json'](_0x199d33);}};}function respondWithFilteredResult(_0x2e81ac,_0x5022ed){return function(_0x344088){if(_0x344088){var _0x37a9de=typeof _0x5022ed[_0x2b8a('0x19')]===_0x2b8a('0x1a')&&typeof _0x5022ed['limit']===_0x2b8a('0x1a');var _0x292817=_0x344088[_0x2b8a('0x1b')];var _0x1c7b05=_0x37a9de?0x0:_0x5022ed[_0x2b8a('0x19')];var _0x432bce=_0x37a9de?_0x344088['count']:_0x5022ed[_0x2b8a('0x19')]+_0x5022ed[_0x2b8a('0x1c')];var _0x71242a;if(_0x432bce>=_0x292817){_0x432bce=_0x292817;_0x71242a=0xc8;}else{_0x71242a=0xce;}_0x2e81ac[_0x2b8a('0x18')](_0x71242a);return _0x2e81ac[_0x2b8a('0x1d')](_0x2b8a('0x1e'),_0x1c7b05+'-'+_0x432bce+'/'+_0x292817)[_0x2b8a('0x1f')](_0x344088);}return null;};}function patchUpdates(_0x30899f){return function(_0x27fcdf){try{jsonpatch[_0x2b8a('0x20')](_0x27fcdf,_0x30899f,!![]);}catch(_0x564643){return BPromise[_0x2b8a('0x21')](_0x564643);}return _0x27fcdf['save']();};}function saveUpdates(_0x4e241d,_0x226b6d){return function(_0x2e1f69){if(_0x2e1f69){return _0x2e1f69[_0x2b8a('0x22')](_0x4e241d)['then'](function(_0x500c56){return _0x500c56;});}return null;};}function removeEntity(_0x516f4b,_0x22ba37){return function(_0x5f3b68){if(_0x5f3b68){return _0x5f3b68['destroy']()[_0x2b8a('0x23')](function(){_0x516f4b[_0x2b8a('0x18')](0xcc)[_0x2b8a('0x24')]();});}};}function handleEntityNotFound(_0x2e50ee,_0x233571){return function(_0x44273b){if(!_0x44273b){_0x2e50ee[_0x2b8a('0x17')](0x194);}return _0x44273b;};}function handleError(_0x11d2c4,_0x574c8f){_0x574c8f=_0x574c8f||0x1f4;return function(_0x429ac4){logger['error'](_0x429ac4[_0x2b8a('0x25')]);if(_0x429ac4[_0x2b8a('0x26')]){delete _0x429ac4[_0x2b8a('0x26')];}_0x11d2c4[_0x2b8a('0x18')](_0x574c8f)[_0x2b8a('0x27')](_0x429ac4);};}exports['index']=function(_0x55f0f1,_0x433e63){var _0x36121a={},_0x453f89={},_0x3a87f5={'count':0x0,'rows':[]};var _0xf9a76b=_[_0x2b8a('0x28')](db[_0x2b8a('0x29')][_0x2b8a('0x2a')],function(_0x4a0793){return{'name':_0x4a0793[_0x2b8a('0x2b')],'type':_0x4a0793[_0x2b8a('0x2c')][_0x2b8a('0x2d')]};});_0x453f89[_0x2b8a('0x2e')]=_['map'](_0xf9a76b,'name');_0x453f89['query']=_['keys'](_0x55f0f1[_0x2b8a('0x2f')]);_0x453f89['filters']=_['intersection'](_0x453f89['model'],_0x453f89[_0x2b8a('0x2f')]);_0x36121a[_0x2b8a('0x30')]=_[_0x2b8a('0x31')](_0x453f89[_0x2b8a('0x2e')],qs[_0x2b8a('0x32')](_0x55f0f1['query'][_0x2b8a('0x32')]));_0x36121a[_0x2b8a('0x30')]=_0x36121a['attributes'][_0x2b8a('0x33')]?_0x36121a[_0x2b8a('0x30')]:_0x453f89['model'];if(!_0x55f0f1[_0x2b8a('0x2f')][_0x2b8a('0x34')](_0x2b8a('0x35'))){_0x36121a[_0x2b8a('0x1c')]=qs[_0x2b8a('0x1c')](_0x55f0f1[_0x2b8a('0x2f')]['limit']);_0x36121a[_0x2b8a('0x19')]=qs[_0x2b8a('0x19')](_0x55f0f1[_0x2b8a('0x2f')]['offset']);}_0x36121a[_0x2b8a('0x36')]=qs[_0x2b8a('0x37')](_0x55f0f1[_0x2b8a('0x2f')][_0x2b8a('0x37')]);_0x36121a[_0x2b8a('0x38')]=qs[_0x2b8a('0x39')](_[_0x2b8a('0x3a')](_0x55f0f1[_0x2b8a('0x2f')],_0x453f89['filters']),_0xf9a76b);if(_0x55f0f1['query'][_0x2b8a('0x3b')]){_0x36121a['where']=_[_0x2b8a('0x3c')](_0x36121a[_0x2b8a('0x38')],{'$or':_[_0x2b8a('0x28')](_0xf9a76b,function(_0x5b416f){if(_0x5b416f[_0x2b8a('0x2c')]!=='VIRTUAL'){var _0x6aadb6={};_0x6aadb6[_0x5b416f[_0x2b8a('0x26')]]={'$like':'%'+_0x55f0f1[_0x2b8a('0x2f')][_0x2b8a('0x3b')]+'%'};return _0x6aadb6;}})});}_0x36121a=_[_0x2b8a('0x3c')]({},_0x36121a,_0x55f0f1[_0x2b8a('0x3d')]);var _0x36ce4b={'where':_0x36121a[_0x2b8a('0x38')]};return db[_0x2b8a('0x29')]['count'](_0x36ce4b)[_0x2b8a('0x23')](function(_0x55039b){_0x3a87f5[_0x2b8a('0x1b')]=_0x55039b;if(_0x55f0f1[_0x2b8a('0x2f')][_0x2b8a('0x3e')]){_0x36121a[_0x2b8a('0x3f')]=[{'all':!![]}];}return db[_0x2b8a('0x29')][_0x2b8a('0x40')](_0x36121a);})[_0x2b8a('0x23')](function(_0x56a35b){_0x3a87f5[_0x2b8a('0x41')]=_0x56a35b;return _0x3a87f5;})[_0x2b8a('0x23')](respondWithFilteredResult(_0x433e63,_0x36121a))[_0x2b8a('0x42')](handleError(_0x433e63,null));};exports[_0x2b8a('0x43')]=function(_0x12abf8,_0x642eff){var _0x1a298e={'raw':![],'where':{'id':_0x12abf8[_0x2b8a('0x44')]['id']}},_0x241cdc={};_0x241cdc[_0x2b8a('0x2e')]=_[_0x2b8a('0x45')](db['ZendeskConfiguration'][_0x2b8a('0x2a')]);_0x241cdc[_0x2b8a('0x2f')]=_[_0x2b8a('0x45')](_0x12abf8[_0x2b8a('0x2f')]);_0x241cdc[_0x2b8a('0x39')]=_['intersection'](_0x241cdc[_0x2b8a('0x2e')],_0x241cdc[_0x2b8a('0x2f')]);_0x1a298e[_0x2b8a('0x30')]=_[_0x2b8a('0x31')](_0x241cdc[_0x2b8a('0x2e')],qs['fields'](_0x12abf8['query'][_0x2b8a('0x32')]));_0x1a298e[_0x2b8a('0x30')]=_0x1a298e['attributes'][_0x2b8a('0x33')]?_0x1a298e[_0x2b8a('0x30')]:_0x241cdc[_0x2b8a('0x2e')];if(_0x12abf8[_0x2b8a('0x2f')][_0x2b8a('0x3e')]){_0x1a298e[_0x2b8a('0x3f')]=[{'all':!![]}];}_0x1a298e=_[_0x2b8a('0x3c')]({},_0x1a298e,_0x12abf8[_0x2b8a('0x3d')]);return db['ZendeskConfiguration'][_0x2b8a('0x46')](_0x1a298e)[_0x2b8a('0x23')](handleEntityNotFound(_0x642eff,null))[_0x2b8a('0x23')](respondWithResult(_0x642eff,null))[_0x2b8a('0x42')](handleError(_0x642eff,null));};exports[_0x2b8a('0x47')]=function(_0x455890,_0x475077){return db[_0x2b8a('0x29')][_0x2b8a('0x47')](_0x455890[_0x2b8a('0x48')],{})[_0x2b8a('0x23')](respondWithResult(_0x475077,0xc9))[_0x2b8a('0x42')](handleError(_0x475077,null));};exports[_0x2b8a('0x22')]=function(_0x5a4764,_0x59f02f){if(_0x5a4764[_0x2b8a('0x48')]['id']){delete _0x5a4764[_0x2b8a('0x48')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x5a4764[_0x2b8a('0x44')]['id']}})['then'](handleEntityNotFound(_0x59f02f,null))[_0x2b8a('0x23')](saveUpdates(_0x5a4764['body'],null))[_0x2b8a('0x23')](respondWithResult(_0x59f02f,null))[_0x2b8a('0x42')](handleError(_0x59f02f,null));};exports[_0x2b8a('0x49')]=function(_0x38bed0,_0x56d255){return db[_0x2b8a('0x29')][_0x2b8a('0x46')]({'where':{'id':_0x38bed0[_0x2b8a('0x44')]['id']}})[_0x2b8a('0x23')](handleEntityNotFound(_0x56d255,null))[_0x2b8a('0x23')](removeEntity(_0x56d255,null))[_0x2b8a('0x42')](handleError(_0x56d255,null));};exports[_0x2b8a('0x4a')]=function(_0x33e8f6,_0x5c2e4b,_0x53f8ca){var _0x25afdd={};var _0x47d9d1={};var _0x20d1ef;var _0x2bed8f;return db[_0x2b8a('0x29')][_0x2b8a('0x4b')]({'where':{'id':_0x33e8f6[_0x2b8a('0x44')]['id']}})[_0x2b8a('0x23')](handleEntityNotFound(_0x5c2e4b,null))[_0x2b8a('0x23')](function(_0x14fd99){if(_0x14fd99){_0x20d1ef=_0x14fd99;_0x47d9d1['model']=_[_0x2b8a('0x45')](db['ZendeskField'][_0x2b8a('0x2a')]);_0x47d9d1['query']=_[_0x2b8a('0x45')](_0x33e8f6[_0x2b8a('0x2f')]);_0x47d9d1[_0x2b8a('0x39')]=_[_0x2b8a('0x31')](_0x47d9d1['model'],_0x47d9d1[_0x2b8a('0x2f')]);_0x25afdd[_0x2b8a('0x30')]=_[_0x2b8a('0x31')](_0x47d9d1[_0x2b8a('0x2e')],qs['fields'](_0x33e8f6[_0x2b8a('0x2f')][_0x2b8a('0x32')]));_0x25afdd['attributes']=_0x25afdd[_0x2b8a('0x30')][_0x2b8a('0x33')]?_0x25afdd[_0x2b8a('0x30')]:_0x47d9d1[_0x2b8a('0x2e')];_0x25afdd[_0x2b8a('0x36')]=qs[_0x2b8a('0x37')](_0x33e8f6[_0x2b8a('0x2f')][_0x2b8a('0x37')]);_0x25afdd[_0x2b8a('0x38')]=qs['filters'](_['pick'](_0x33e8f6[_0x2b8a('0x2f')],_0x47d9d1[_0x2b8a('0x39')]));if(_0x33e8f6[_0x2b8a('0x2f')]['filter']){_0x25afdd['where']=_['merge'](_0x25afdd[_0x2b8a('0x38')],{'$or':_[_0x2b8a('0x28')](_0x25afdd[_0x2b8a('0x30')],function(_0x36a289){var _0x337abc={};_0x337abc[_0x36a289]={'$like':'%'+_0x33e8f6['query'][_0x2b8a('0x3b')]+'%'};return _0x337abc;})});}_0x25afdd=_[_0x2b8a('0x3c')]({},_0x25afdd,_0x33e8f6['options']);return _0x20d1ef[_0x2b8a('0x4a')](_0x25afdd);}})['then'](function(_0x388aad){if(_0x388aad){_0x2bed8f=_0x388aad[_0x2b8a('0x33')];if(!_0x33e8f6[_0x2b8a('0x2f')]['hasOwnProperty']('nolimit')){_0x25afdd[_0x2b8a('0x1c')]=qs[_0x2b8a('0x1c')](_0x33e8f6['query']['limit']);_0x25afdd[_0x2b8a('0x19')]=qs[_0x2b8a('0x19')](_0x33e8f6[_0x2b8a('0x2f')]['offset']);}return _0x20d1ef[_0x2b8a('0x4a')](_0x25afdd);}})['then'](function(_0x1f3bb7){if(_0x1f3bb7){return _0x1f3bb7?{'count':_0x2bed8f,'rows':_0x1f3bb7}:null;}})[_0x2b8a('0x23')](respondWithResult(_0x5c2e4b,null))[_0x2b8a('0x42')](handleError(_0x5c2e4b,null));};exports['getSubjects']=function(_0x20ee57,_0x3b67d3,_0x21a815){var _0x502b08={};var _0x50374b={};var _0x1bfe6e;var _0x2388f4;return db['ZendeskConfiguration'][_0x2b8a('0x4b')]({'where':{'id':_0x20ee57[_0x2b8a('0x44')]['id']}})[_0x2b8a('0x23')](handleEntityNotFound(_0x3b67d3,null))[_0x2b8a('0x23')](function(_0x3d586c){if(_0x3d586c){_0x1bfe6e=_0x3d586c;_0x50374b[_0x2b8a('0x2e')]=_['keys'](db[_0x2b8a('0x4c')][_0x2b8a('0x2a')]);_0x50374b[_0x2b8a('0x2f')]=_['keys'](_0x20ee57[_0x2b8a('0x2f')]);_0x50374b[_0x2b8a('0x39')]=_[_0x2b8a('0x31')](_0x50374b['model'],_0x50374b[_0x2b8a('0x2f')]);_0x502b08[_0x2b8a('0x30')]=_[_0x2b8a('0x31')](_0x50374b[_0x2b8a('0x2e')],qs[_0x2b8a('0x32')](_0x20ee57[_0x2b8a('0x2f')]['fields']));_0x502b08[_0x2b8a('0x30')]=_0x502b08[_0x2b8a('0x30')][_0x2b8a('0x33')]?_0x502b08[_0x2b8a('0x30')]:_0x50374b[_0x2b8a('0x2e')];_0x502b08[_0x2b8a('0x36')]=qs['sort'](_0x20ee57['query'][_0x2b8a('0x37')]);_0x502b08['where']=qs[_0x2b8a('0x39')](_[_0x2b8a('0x3a')](_0x20ee57[_0x2b8a('0x2f')],_0x50374b['filters']));if(_0x20ee57[_0x2b8a('0x2f')][_0x2b8a('0x3b')]){_0x502b08[_0x2b8a('0x38')]=_[_0x2b8a('0x3c')](_0x502b08[_0x2b8a('0x38')],{'$or':_[_0x2b8a('0x28')](_0x502b08[_0x2b8a('0x30')],function(_0x111a0a){var _0x49e955={};_0x49e955[_0x111a0a]={'$like':'%'+_0x20ee57[_0x2b8a('0x2f')][_0x2b8a('0x3b')]+'%'};return _0x49e955;})});}_0x502b08=_['merge']({},_0x502b08,_0x20ee57[_0x2b8a('0x3d')]);return _0x1bfe6e[_0x2b8a('0x4d')](_0x502b08);}})['then'](function(_0x2b87cc){if(_0x2b87cc){_0x2388f4=_0x2b87cc[_0x2b8a('0x33')];if(!_0x20ee57[_0x2b8a('0x2f')][_0x2b8a('0x34')](_0x2b8a('0x35'))){_0x502b08['limit']=qs['limit'](_0x20ee57[_0x2b8a('0x2f')][_0x2b8a('0x1c')]);_0x502b08[_0x2b8a('0x19')]=qs['offset'](_0x20ee57[_0x2b8a('0x2f')][_0x2b8a('0x19')]);}return _0x1bfe6e['getSubjects'](_0x502b08);}})[_0x2b8a('0x23')](function(_0x5e6b1f){if(_0x5e6b1f){return _0x5e6b1f?{'count':_0x2388f4,'rows':_0x5e6b1f}:null;}})[_0x2b8a('0x23')](respondWithResult(_0x3b67d3,null))[_0x2b8a('0x42')](handleError(_0x3b67d3,null));};exports['getDescriptions']=function(_0x8af9c4,_0x2ae1a6,_0x17c631){var _0x3366d5={};var _0x12b380={};var _0x57cc9d;var _0x280f0c;return db[_0x2b8a('0x29')]['findOne']({'where':{'id':_0x8af9c4['params']['id']}})[_0x2b8a('0x23')](handleEntityNotFound(_0x2ae1a6,null))['then'](function(_0x1cc86f){if(_0x1cc86f){_0x57cc9d=_0x1cc86f;_0x12b380[_0x2b8a('0x2e')]=_[_0x2b8a('0x45')](db[_0x2b8a('0x4c')][_0x2b8a('0x2a')]);_0x12b380[_0x2b8a('0x2f')]=_[_0x2b8a('0x45')](_0x8af9c4['query']);_0x12b380[_0x2b8a('0x39')]=_[_0x2b8a('0x31')](_0x12b380[_0x2b8a('0x2e')],_0x12b380[_0x2b8a('0x2f')]);_0x3366d5[_0x2b8a('0x30')]=_[_0x2b8a('0x31')](_0x12b380[_0x2b8a('0x2e')],qs['fields'](_0x8af9c4['query'][_0x2b8a('0x32')]));_0x3366d5['attributes']=_0x3366d5[_0x2b8a('0x30')][_0x2b8a('0x33')]?_0x3366d5[_0x2b8a('0x30')]:_0x12b380[_0x2b8a('0x2e')];_0x3366d5[_0x2b8a('0x36')]=qs['sort'](_0x8af9c4[_0x2b8a('0x2f')][_0x2b8a('0x37')]);_0x3366d5[_0x2b8a('0x38')]=qs[_0x2b8a('0x39')](_[_0x2b8a('0x3a')](_0x8af9c4[_0x2b8a('0x2f')],_0x12b380[_0x2b8a('0x39')]));if(_0x8af9c4[_0x2b8a('0x2f')]['filter']){_0x3366d5[_0x2b8a('0x38')]=_[_0x2b8a('0x3c')](_0x3366d5[_0x2b8a('0x38')],{'$or':_[_0x2b8a('0x28')](_0x3366d5[_0x2b8a('0x30')],function(_0x5310d3){var _0x2d169a={};_0x2d169a[_0x5310d3]={'$like':'%'+_0x8af9c4[_0x2b8a('0x2f')][_0x2b8a('0x3b')]+'%'};return _0x2d169a;})});}_0x3366d5=_[_0x2b8a('0x3c')]({},_0x3366d5,_0x8af9c4['options']);return _0x57cc9d[_0x2b8a('0x4e')](_0x3366d5);}})[_0x2b8a('0x23')](function(_0x2e331e){if(_0x2e331e){_0x280f0c=_0x2e331e[_0x2b8a('0x33')];if(!_0x8af9c4[_0x2b8a('0x2f')][_0x2b8a('0x34')]('nolimit')){_0x3366d5[_0x2b8a('0x1c')]=qs['limit'](_0x8af9c4['query'][_0x2b8a('0x1c')]);_0x3366d5[_0x2b8a('0x19')]=qs[_0x2b8a('0x19')](_0x8af9c4[_0x2b8a('0x2f')][_0x2b8a('0x19')]);}return _0x57cc9d[_0x2b8a('0x4e')](_0x3366d5);}})[_0x2b8a('0x23')](function(_0x5ff448){if(_0x5ff448){return _0x5ff448?{'count':_0x280f0c,'rows':_0x5ff448}:null;}})[_0x2b8a('0x23')](respondWithResult(_0x2ae1a6,null))[_0x2b8a('0x42')](handleError(_0x2ae1a6,null));};exports[_0x2b8a('0x4f')]=function(_0x450038,_0x214a56,_0x1e5ade){var _0x11c875={};var _0xafac91={};var _0x3bde9c;var _0x4a6f91;return db[_0x2b8a('0x29')][_0x2b8a('0x4b')]({'where':{'id':_0x450038[_0x2b8a('0x44')]['id']}})['then'](handleEntityNotFound(_0x214a56,null))[_0x2b8a('0x23')](function(_0x4639b8){if(_0x4639b8){_0x3bde9c=_0x4639b8;_0xafac91[_0x2b8a('0x2e')]=_[_0x2b8a('0x45')](db[_0x2b8a('0x50')][_0x2b8a('0x2a')]);_0xafac91['query']=_[_0x2b8a('0x45')](_0x450038[_0x2b8a('0x2f')]);_0xafac91['filters']=_[_0x2b8a('0x31')](_0xafac91[_0x2b8a('0x2e')],_0xafac91[_0x2b8a('0x2f')]);_0x11c875[_0x2b8a('0x30')]=_[_0x2b8a('0x31')](_0xafac91[_0x2b8a('0x2e')],qs[_0x2b8a('0x32')](_0x450038[_0x2b8a('0x2f')]['fields']));_0x11c875[_0x2b8a('0x30')]=_0x11c875[_0x2b8a('0x30')][_0x2b8a('0x33')]?_0x11c875[_0x2b8a('0x30')]:_0xafac91['model'];_0x11c875[_0x2b8a('0x36')]=qs[_0x2b8a('0x37')](_0x450038[_0x2b8a('0x2f')]['sort']);_0x11c875[_0x2b8a('0x38')]=qs[_0x2b8a('0x39')](_[_0x2b8a('0x3a')](_0x450038[_0x2b8a('0x2f')],_0xafac91[_0x2b8a('0x39')]));if(_0x450038[_0x2b8a('0x2f')][_0x2b8a('0x3b')]){_0x11c875['where']=_[_0x2b8a('0x3c')](_0x11c875[_0x2b8a('0x38')],{'$or':_[_0x2b8a('0x28')](_0x11c875[_0x2b8a('0x30')],function(_0x1433f7){var _0x5b6b84={};_0x5b6b84[_0x1433f7]={'$like':'%'+_0x450038['query'][_0x2b8a('0x3b')]+'%'};return _0x5b6b84;})});}_0x11c875=_[_0x2b8a('0x3c')]({},_0x11c875,_0x450038[_0x2b8a('0x3d')]);return _0x3bde9c['getTags'](_0x11c875);}})[_0x2b8a('0x23')](function(_0x34daad){if(_0x34daad){_0x4a6f91=_0x34daad['length'];if(!_0x450038['query'][_0x2b8a('0x34')](_0x2b8a('0x35'))){_0x11c875[_0x2b8a('0x1c')]=qs['limit'](_0x450038[_0x2b8a('0x2f')][_0x2b8a('0x1c')]);_0x11c875[_0x2b8a('0x19')]=qs[_0x2b8a('0x19')](_0x450038[_0x2b8a('0x2f')]['offset']);}return _0x3bde9c[_0x2b8a('0x4f')](_0x11c875);}})[_0x2b8a('0x23')](function(_0x2b3f0e){if(_0x2b3f0e){return _0x2b3f0e?{'count':_0x4a6f91,'rows':_0x2b3f0e}:null;}})[_0x2b8a('0x23')](respondWithResult(_0x214a56,null))[_0x2b8a('0x42')](handleError(_0x214a56,null));};exports[_0x2b8a('0x51')]=function(_0x21f9af,_0x5c9fc4,_0x6345){if(_0x21f9af[_0x2b8a('0x48')]['id']){delete _0x21f9af[_0x2b8a('0x48')]['id'];}return db[_0x2b8a('0x29')][_0x2b8a('0x4b')]({'where':{'id':_0x21f9af[_0x2b8a('0x44')]['id']}})[_0x2b8a('0x23')](handleEntityNotFound(_0x5c9fc4,null))[_0x2b8a('0x23')](function(_0x455b12){if(_0x455b12){return _0x455b12[_0x2b8a('0x51')](_0x21f9af[_0x2b8a('0x48')][_0x2b8a('0x52')]||[]);}return null;})[_0x2b8a('0x23')](respondWithResult(_0x5c9fc4,null))[_0x2b8a('0x42')](handleError(_0x5c9fc4,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ae81abe..8ce1c28 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 _0x0972=['util','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0972,0x64));var _0x2097=function(_0x158101,_0x1e45c8){_0x158101=_0x158101-0x0;var _0x45b932=_0x0972[_0x158101];return _0x45b932;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require('../../config/logger')(_0x2097('0x1'));var moment=require('moment');var BPromise=require(_0x2097('0x2'));var rp=require(_0x2097('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x2f84d8,_0x11ed13){return _0x2f84d8[_0x2097('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x2097('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','util','api','moment','bluebird'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f66[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('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 73008c1..316f039 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 _0xdd61=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','http','request','then'];(function(_0x41447d,_0x4d7555){var _0x4ae3f1=function(_0x1c8170){while(--_0x1c8170){_0x41447d['push'](_0x41447d['shift']());}};_0x4ae3f1(++_0x4d7555);}(_0xdd61,0xa1));var _0x1dd6=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xdd61[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0x1dd6('0x0'));var util=require(_0x1dd6('0x1'));var moment=require(_0x1dd6('0x2'));var BPromise=require(_0x1dd6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dd6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1dd6('0x5'));var jayson=require(_0x1dd6('0x6'));var client=jayson['client'][_0x1dd6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1508cf,_0x31b69e,_0x425401){return new BPromise(function(_0x1f0fc9,_0x319084){return client[_0x1dd6('0x8')](_0x1508cf,_0x425401)[_0x1dd6('0x9')](function(_0x457f40){logger[_0x1dd6('0xa')](_0x1dd6('0xb'),_0x31b69e,_0x1dd6('0xc'));logger[_0x1dd6('0xd')](_0x1dd6('0xe'),_0x31b69e,'request\x20sent',JSON['stringify'](_0x457f40));if(_0x457f40[_0x1dd6('0xf')]){if(_0x457f40['error']['code']===0x1f4){logger[_0x1dd6('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x31b69e,_0x457f40[_0x1dd6('0xf')][_0x1dd6('0x10')]);return _0x319084(_0x457f40[_0x1dd6('0xf')][_0x1dd6('0x10')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x31b69e,_0x457f40['error'][_0x1dd6('0x10')]);return _0x1f0fc9(_0x457f40[_0x1dd6('0xf')][_0x1dd6('0x10')]);}else{logger['info'](_0x1dd6('0xb'),_0x31b69e,_0x1dd6('0xc'));_0x1f0fc9(_0x457f40[_0x1dd6('0x11')]['message']);}})[_0x1dd6('0x12')](function(_0x18522a){logger[_0x1dd6('0xf')](_0x1dd6('0xb'),_0x31b69e,_0x18522a);_0x319084(_0x18522a);});});} \ No newline at end of file +var _0x97d2=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x97d2,0x116));var _0x297d=function(_0x48deab,_0x1668d8){_0x48deab=_0x48deab-0x0;var _0x241788=_0x97d2[_0x48deab];return _0x241788;};'use strict';var _=require(_0x297d('0x0'));var util=require(_0x297d('0x1'));var moment=require(_0x297d('0x2'));var BPromise=require(_0x297d('0x3'));var rs=require(_0x297d('0x4'));var fs=require('fs');var Redis=require(_0x297d('0x5'));var db=require(_0x297d('0x6'))['db'];var utils=require(_0x297d('0x7'));var logger=require('../../config/logger')(_0x297d('0x8'));var config=require(_0x297d('0x9'));var jayson=require(_0x297d('0xa'));var client=jayson[_0x297d('0xb')][_0x297d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3537c4,_0x1dc2b0,_0x2f403a){return new BPromise(function(_0x13307b,_0x13921a){return client[_0x297d('0xd')](_0x3537c4,_0x2f403a)[_0x297d('0xe')](function(_0x534b5d){logger['info'](_0x297d('0xf'),_0x1dc2b0,_0x297d('0x10'));logger[_0x297d('0x11')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1dc2b0,_0x297d('0x10'),JSON[_0x297d('0x12')](_0x534b5d));if(_0x534b5d['error']){if(_0x534b5d[_0x297d('0x13')][_0x297d('0x14')]===0x1f4){logger[_0x297d('0x13')](_0x297d('0xf'),_0x1dc2b0,_0x534b5d[_0x297d('0x13')][_0x297d('0x15')]);return _0x13921a(_0x534b5d['error'][_0x297d('0x15')]);}logger[_0x297d('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1dc2b0,_0x534b5d[_0x297d('0x13')][_0x297d('0x15')]);return _0x13307b(_0x534b5d[_0x297d('0x13')][_0x297d('0x15')]);}else{logger[_0x297d('0x16')](_0x297d('0xf'),_0x1dc2b0,_0x297d('0x10'));_0x13307b(_0x534b5d[_0x297d('0x17')][_0x297d('0x15')]);}})[_0x297d('0x18')](function(_0x1fc32d){logger[_0x297d('0x13')](_0x297d('0xf'),_0x1dc2b0,_0x1fc32d);_0x13921a(_0x1fc32d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8caabf3..6713fd4 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 _0x195f=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x3a6d8b,_0x571093){var _0x24260b=function(_0x4f0f50){while(--_0x4f0f50){_0x3a6d8b['push'](_0x3a6d8b['shift']());}};_0x24260b(++_0x571093);}(_0x195f,0xa8));var _0xf195=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0x195f[_0x14d896];return _0x28679a;};'use strict';var multer=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var path=require(_0xf195('0x2'));var timeout=require(_0xf195('0x3'));var express=require(_0xf195('0x4'));var router=express[_0xf195('0x5')]();var fs_extra=require(_0xf195('0x6'));var auth=require(_0xf195('0x7'));var interaction=require(_0xf195('0x8'));var config=require('../../config/environment');var controller=require(_0xf195('0x9'));router[_0xf195('0xa')]('/',auth[_0xf195('0xb')](),controller[_0xf195('0xc')]);router['get'](_0xf195('0xd'),auth[_0xf195('0xb')](),controller[_0xf195('0xe')]);router[_0xf195('0xf')]('/',auth[_0xf195('0xb')](),controller['create']);router[_0xf195('0x10')](_0xf195('0xd'),auth[_0xf195('0xb')](),controller[_0xf195('0x11')]);router[_0xf195('0x12')](_0xf195('0xd'),auth[_0xf195('0xb')](),controller[_0xf195('0x13')]);module[_0xf195('0x14')]=router; \ No newline at end of file +var _0xd056=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports'];(function(_0x26d734,_0x5e4925){var _0x201ce2=function(_0x13128d){while(--_0x13128d){_0x26d734['push'](_0x26d734['shift']());}};_0x201ce2(++_0x5e4925);}(_0xd056,0x1cb));var _0x6d05=function(_0x294759,_0x34d93e){_0x294759=_0x294759-0x0;var _0x92d268=_0xd056[_0x294759];return _0x92d268;};'use strict';var multer=require(_0x6d05('0x0'));var util=require(_0x6d05('0x1'));var path=require(_0x6d05('0x2'));var timeout=require('connect-timeout');var express=require(_0x6d05('0x3'));var router=express[_0x6d05('0x4')]();var fs_extra=require(_0x6d05('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6d05('0x6'));var config=require(_0x6d05('0x7'));var controller=require('./intZendeskField.controller');router[_0x6d05('0x8')]('/',auth[_0x6d05('0x9')](),controller[_0x6d05('0xa')]);router[_0x6d05('0x8')](_0x6d05('0xb'),auth[_0x6d05('0x9')](),controller['show']);router[_0x6d05('0xc')]('/',auth[_0x6d05('0x9')](),controller[_0x6d05('0xd')]);router['put'](_0x6d05('0xb'),auth[_0x6d05('0x9')](),controller['update']);router[_0x6d05('0xe')](_0x6d05('0xb'),auth[_0x6d05('0x9')](),controller[_0x6d05('0xf')]);module[_0x6d05('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 874d19c..b14da6f 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 _0x7ab3=['picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x7ab3,0xc9));var _0x37ab=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0x7ab3[_0x16cb03];return _0x10944e;};'use strict';var Sequelize=require(_0x37ab('0x0'));module['exports']={'type':{'type':Sequelize[_0x37ab('0x1')](_0x37ab('0x2'),_0x37ab('0x3'),_0x37ab('0x4'),_0x37ab('0x5'),_0x37ab('0x6')),'defaultValue':_0x37ab('0x2')},'content':{'type':Sequelize[_0x37ab('0x7')]},'key':{'type':Sequelize[_0x37ab('0x7')]},'keyType':{'type':Sequelize[_0x37ab('0x1')](_0x37ab('0x2'),_0x37ab('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x37ab('0x7')]},'idField':{'type':Sequelize[_0x37ab('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x37ab('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc4d=['customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xfc4d,0x124));var _0xdfc4=function(_0x3a23b4,_0x49d839){_0x3a23b4=_0x3a23b4-0x0;var _0x302bca=_0xfc4d[_0x3a23b4];return _0x302bca;};'use strict';var Sequelize=require(_0xdfc4('0x0'));module['exports']={'type':{'type':Sequelize[_0xdfc4('0x1')](_0xdfc4('0x2'),_0xdfc4('0x3'),_0xdfc4('0x4'),'keyValue',_0xdfc4('0x5')),'defaultValue':_0xdfc4('0x2')},'content':{'type':Sequelize[_0xdfc4('0x6')]},'key':{'type':Sequelize[_0xdfc4('0x6')]},'keyType':{'type':Sequelize[_0xdfc4('0x1')](_0xdfc4('0x2'),_0xdfc4('0x3'),_0xdfc4('0x4'))},'keyContent':{'type':Sequelize[_0xdfc4('0x6')]},'idField':{'type':Sequelize[_0xdfc4('0x6')]},'nameField':{'type':Sequelize[_0xdfc4('0x6')]},'customField':{'type':Sequelize[_0xdfc4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index bbb5deb..5fa523d 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 _0xbee3=['reject','save','destroy','then','end','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskField','includeAll','include','findAll','show','params','find','catch','update','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbee3,0x1dd));var _0x3bee=function(_0x1b77b0,_0x2e83d8){_0x1b77b0=_0x1b77b0-0x0;var _0x4dc656=_0xbee3[_0x1b77b0];return _0x4dc656;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3bee('0x1'));var rp=require(_0x3bee('0x2'));var moment=require(_0x3bee('0x3'));var BPromise=require(_0x3bee('0x4'));var Mustache=require('mustache');var util=require(_0x3bee('0x5'));var path=require(_0x3bee('0x6'));var sox=require(_0x3bee('0x7'));var csv=require(_0x3bee('0x8'));var ejs=require(_0x3bee('0x9'));var fs=require('fs');var fs_extra=require(_0x3bee('0xa'));var _=require(_0x3bee('0xb'));var squel=require(_0x3bee('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3bee('0xd'));var toCsv=require(_0x3bee('0x8'));var querystring=require(_0x3bee('0xe'));var Papa=require(_0x3bee('0xf'));var Redis=require(_0x3bee('0x10'));var authService=require(_0x3bee('0x11'));var qs=require(_0x3bee('0x12'));var as=require(_0x3bee('0x13'));var hardwareService=require(_0x3bee('0x14'));var logger=require(_0x3bee('0x15'))(_0x3bee('0x16'));var utils=require(_0x3bee('0x17'));var config=require(_0x3bee('0x18'));var licenseUtil=require(_0x3bee('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2000eb,_0x360615){_0x360615=_0x360615||0xcc;return function(_0x38c4b4){if(_0x38c4b4){return _0x2000eb[_0x3bee('0x1a')](_0x360615);}return _0x2000eb[_0x3bee('0x1b')](_0x360615)['end']();};}function respondWithResult(_0x35659b,_0x2532ab){_0x2532ab=_0x2532ab||0xc8;return function(_0x7d4fd6){if(_0x7d4fd6){return _0x35659b[_0x3bee('0x1b')](_0x2532ab)[_0x3bee('0x1c')](_0x7d4fd6);}};}function respondWithFilteredResult(_0x30107d,_0xbc2a52){return function(_0x4ebf53){if(_0x4ebf53){var _0x1624d3=typeof _0xbc2a52[_0x3bee('0x1d')]===_0x3bee('0x1e')&&typeof _0xbc2a52['limit']==='undefined';var _0x48d83b=_0x4ebf53['count'];var _0x4656fb=_0x1624d3?0x0:_0xbc2a52[_0x3bee('0x1d')];var _0x524d18=_0x1624d3?_0x4ebf53[_0x3bee('0x1f')]:_0xbc2a52[_0x3bee('0x1d')]+_0xbc2a52[_0x3bee('0x20')];var _0x279334;if(_0x524d18>=_0x48d83b){_0x524d18=_0x48d83b;_0x279334=0xc8;}else{_0x279334=0xce;}_0x30107d[_0x3bee('0x1b')](_0x279334);return _0x30107d[_0x3bee('0x21')]('Content-Range',_0x4656fb+'-'+_0x524d18+'/'+_0x48d83b)[_0x3bee('0x1c')](_0x4ebf53);}return null;};}function patchUpdates(_0x2159c7){return function(_0x14930d){try{jsonpatch['apply'](_0x14930d,_0x2159c7,!![]);}catch(_0x313a29){return BPromise[_0x3bee('0x22')](_0x313a29);}return _0x14930d[_0x3bee('0x23')]();};}function saveUpdates(_0x108f33,_0x55b83c){return function(_0x4c93f3){if(_0x4c93f3){return _0x4c93f3['update'](_0x108f33)['then'](function(_0x820cf6){return _0x820cf6;});}return null;};}function removeEntity(_0x495134,_0x2f3bec){return function(_0x46c669){if(_0x46c669){return _0x46c669[_0x3bee('0x24')]()[_0x3bee('0x25')](function(){_0x495134['status'](0xcc)[_0x3bee('0x26')]();});}};}function handleEntityNotFound(_0x28e7a7,_0x2d7798){return function(_0x5907f9){if(!_0x5907f9){_0x28e7a7[_0x3bee('0x1a')](0x194);}return _0x5907f9;};}function handleError(_0x2c759e,_0x407b48){_0x407b48=_0x407b48||0x1f4;return function(_0x41d125){logger[_0x3bee('0x27')](_0x41d125[_0x3bee('0x28')]);if(_0x41d125['name']){delete _0x41d125[_0x3bee('0x29')];}_0x2c759e[_0x3bee('0x1b')](_0x407b48)['send'](_0x41d125);};}exports['index']=function(_0x2e5b8a,_0x657bd3){var _0x288d91={},_0x2b774a={},_0x4b7a50={'count':0x0,'rows':[]};var _0x300529=_[_0x3bee('0x2a')](db['ZendeskField'][_0x3bee('0x2b')],function(_0x2fd373){return{'name':_0x2fd373['fieldName'],'type':_0x2fd373[_0x3bee('0x2c')][_0x3bee('0x2d')]};});_0x2b774a[_0x3bee('0x2e')]=_[_0x3bee('0x2a')](_0x300529,_0x3bee('0x29'));_0x2b774a[_0x3bee('0x2f')]=_[_0x3bee('0x30')](_0x2e5b8a['query']);_0x2b774a[_0x3bee('0x31')]=_[_0x3bee('0x32')](_0x2b774a['model'],_0x2b774a['query']);_0x288d91['attributes']=_[_0x3bee('0x32')](_0x2b774a[_0x3bee('0x2e')],qs['fields'](_0x2e5b8a[_0x3bee('0x2f')][_0x3bee('0x33')]));_0x288d91[_0x3bee('0x34')]=_0x288d91['attributes'][_0x3bee('0x35')]?_0x288d91[_0x3bee('0x34')]:_0x2b774a['model'];if(!_0x2e5b8a[_0x3bee('0x2f')]['hasOwnProperty'](_0x3bee('0x36'))){_0x288d91['limit']=qs[_0x3bee('0x20')](_0x2e5b8a['query']['limit']);_0x288d91[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x2e5b8a[_0x3bee('0x2f')][_0x3bee('0x1d')]);}_0x288d91[_0x3bee('0x37')]=qs[_0x3bee('0x38')](_0x2e5b8a[_0x3bee('0x2f')][_0x3bee('0x38')]);_0x288d91[_0x3bee('0x39')]=qs['filters'](_[_0x3bee('0x3a')](_0x2e5b8a[_0x3bee('0x2f')],_0x2b774a[_0x3bee('0x31')]),_0x300529);if(_0x2e5b8a[_0x3bee('0x2f')][_0x3bee('0x3b')]){_0x288d91[_0x3bee('0x39')]=_[_0x3bee('0x3c')](_0x288d91[_0x3bee('0x39')],{'$or':_[_0x3bee('0x2a')](_0x300529,function(_0x4bbc16){if(_0x4bbc16[_0x3bee('0x2c')]!==_0x3bee('0x3d')){var _0x3d3423={};_0x3d3423[_0x4bbc16[_0x3bee('0x29')]]={'$like':'%'+_0x2e5b8a[_0x3bee('0x2f')][_0x3bee('0x3b')]+'%'};return _0x3d3423;}})});}_0x288d91=_[_0x3bee('0x3c')]({},_0x288d91,_0x2e5b8a[_0x3bee('0x3e')]);var _0x1de21e={'where':_0x288d91[_0x3bee('0x39')]};return db[_0x3bee('0x3f')][_0x3bee('0x1f')](_0x1de21e)[_0x3bee('0x25')](function(_0x1427f7){_0x4b7a50[_0x3bee('0x1f')]=_0x1427f7;if(_0x2e5b8a[_0x3bee('0x2f')][_0x3bee('0x40')]){_0x288d91[_0x3bee('0x41')]=[{'all':!![]}];}return db[_0x3bee('0x3f')][_0x3bee('0x42')](_0x288d91);})[_0x3bee('0x25')](function(_0x49b218){_0x4b7a50['rows']=_0x49b218;return _0x4b7a50;})[_0x3bee('0x25')](respondWithFilteredResult(_0x657bd3,_0x288d91))['catch'](handleError(_0x657bd3,null));};exports[_0x3bee('0x43')]=function(_0x2a24c8,_0x2a570a){var _0xcc160e={'raw':!![],'where':{'id':_0x2a24c8[_0x3bee('0x44')]['id']}},_0x440400={};_0x440400[_0x3bee('0x2e')]=_[_0x3bee('0x30')](db[_0x3bee('0x3f')]['rawAttributes']);_0x440400[_0x3bee('0x2f')]=_[_0x3bee('0x30')](_0x2a24c8[_0x3bee('0x2f')]);_0x440400['filters']=_[_0x3bee('0x32')](_0x440400['model'],_0x440400['query']);_0xcc160e[_0x3bee('0x34')]=_[_0x3bee('0x32')](_0x440400['model'],qs[_0x3bee('0x33')](_0x2a24c8['query'][_0x3bee('0x33')]));_0xcc160e[_0x3bee('0x34')]=_0xcc160e['attributes']['length']?_0xcc160e[_0x3bee('0x34')]:_0x440400[_0x3bee('0x2e')];if(_0x2a24c8[_0x3bee('0x2f')]['includeAll']){_0xcc160e[_0x3bee('0x41')]=[{'all':!![]}];}_0xcc160e=_['merge']({},_0xcc160e,_0x2a24c8['options']);return db[_0x3bee('0x3f')][_0x3bee('0x45')](_0xcc160e)['then'](handleEntityNotFound(_0x2a570a,null))['then'](respondWithResult(_0x2a570a,null))[_0x3bee('0x46')](handleError(_0x2a570a,null));};exports['create']=function(_0xbe1dc4,_0x280e95){return db['ZendeskField']['create'](_0xbe1dc4['body'],{})['then'](respondWithResult(_0x280e95,0xc9))[_0x3bee('0x46')](handleError(_0x280e95,null));};exports[_0x3bee('0x47')]=function(_0x275664,_0x3c57f0){if(_0x275664[_0x3bee('0x48')]['id']){delete _0x275664['body']['id'];}return db[_0x3bee('0x3f')]['find']({'where':{'id':_0x275664[_0x3bee('0x44')]['id']}})[_0x3bee('0x25')](handleEntityNotFound(_0x3c57f0,null))['then'](saveUpdates(_0x275664[_0x3bee('0x48')],null))[_0x3bee('0x25')](respondWithResult(_0x3c57f0,null))[_0x3bee('0x46')](handleError(_0x3c57f0,null));};exports[_0x3bee('0x24')]=function(_0xaef4f0,_0xee3f0f){return db[_0x3bee('0x3f')][_0x3bee('0x45')]({'where':{'id':_0xaef4f0['params']['id']}})[_0x3bee('0x25')](handleEntityNotFound(_0xee3f0f,null))[_0x3bee('0x25')](removeEntity(_0xee3f0f,null))['catch'](handleError(_0xee3f0f,null));}; \ No newline at end of file +var _0xf2f5=['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','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','name','send','index','map','ZendeskField','rawAttributes','fieldName','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf2f5,0x179));var _0x5f2f=function(_0x21c684,_0x142bf3){_0x21c684=_0x21c684-0x0;var _0x278e1a=_0xf2f5[_0x21c684];return _0x278e1a;};'use strict';var emlformat=require(_0x5f2f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f2f('0x2'));var moment=require(_0x5f2f('0x3'));var BPromise=require(_0x5f2f('0x4'));var Mustache=require(_0x5f2f('0x5'));var util=require(_0x5f2f('0x6'));var path=require(_0x5f2f('0x7'));var sox=require(_0x5f2f('0x8'));var csv=require(_0x5f2f('0x9'));var ejs=require(_0x5f2f('0xa'));var fs=require('fs');var fs_extra=require(_0x5f2f('0xb'));var _=require(_0x5f2f('0xc'));var squel=require(_0x5f2f('0xd'));var crypto=require(_0x5f2f('0xe'));var jsforce=require(_0x5f2f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5f2f('0x9'));var querystring=require(_0x5f2f('0x10'));var Papa=require('papaparse');var Redis=require(_0x5f2f('0x11'));var authService=require(_0x5f2f('0x12'));var qs=require(_0x5f2f('0x13'));var as=require(_0x5f2f('0x14'));var hardwareService=require(_0x5f2f('0x15'));var logger=require(_0x5f2f('0x16'))(_0x5f2f('0x17'));var utils=require(_0x5f2f('0x18'));var config=require(_0x5f2f('0x19'));var licenseUtil=require(_0x5f2f('0x1a'));var db=require(_0x5f2f('0x1b'))['db'];function respondWithStatusCode(_0x55ed4e,_0x22ba15){_0x22ba15=_0x22ba15||0xcc;return function(_0x20a13d){if(_0x20a13d){return _0x55ed4e[_0x5f2f('0x1c')](_0x22ba15);}return _0x55ed4e[_0x5f2f('0x1d')](_0x22ba15)['end']();};}function respondWithResult(_0xc6b720,_0x3751da){_0x3751da=_0x3751da||0xc8;return function(_0x563986){if(_0x563986){return _0xc6b720[_0x5f2f('0x1d')](_0x3751da)[_0x5f2f('0x1e')](_0x563986);}};}function respondWithFilteredResult(_0x1a5902,_0x3a17bd){return function(_0x1caa96){if(_0x1caa96){var _0x818d8=typeof _0x3a17bd['offset']===_0x5f2f('0x1f')&&typeof _0x3a17bd['limit']===_0x5f2f('0x1f');var _0x4aa08b=_0x1caa96[_0x5f2f('0x20')];var _0x6567d6=_0x818d8?0x0:_0x3a17bd[_0x5f2f('0x21')];var _0x598174=_0x818d8?_0x1caa96[_0x5f2f('0x20')]:_0x3a17bd[_0x5f2f('0x21')]+_0x3a17bd[_0x5f2f('0x22')];var _0x5ed5b8;if(_0x598174>=_0x4aa08b){_0x598174=_0x4aa08b;_0x5ed5b8=0xc8;}else{_0x5ed5b8=0xce;}_0x1a5902['status'](_0x5ed5b8);return _0x1a5902[_0x5f2f('0x23')](_0x5f2f('0x24'),_0x6567d6+'-'+_0x598174+'/'+_0x4aa08b)['json'](_0x1caa96);}return null;};}function patchUpdates(_0x187e87){return function(_0xe0082b){try{jsonpatch[_0x5f2f('0x25')](_0xe0082b,_0x187e87,!![]);}catch(_0x249715){return BPromise[_0x5f2f('0x26')](_0x249715);}return _0xe0082b['save']();};}function saveUpdates(_0x34fa42,_0x29e8fb){return function(_0x4910e8){if(_0x4910e8){return _0x4910e8[_0x5f2f('0x27')](_0x34fa42)[_0x5f2f('0x28')](function(_0x1363c1){return _0x1363c1;});}return null;};}function removeEntity(_0x58d79d,_0x300881){return function(_0x654ea6){if(_0x654ea6){return _0x654ea6[_0x5f2f('0x29')]()['then'](function(){_0x58d79d[_0x5f2f('0x1d')](0xcc)[_0x5f2f('0x2a')]();});}};}function handleEntityNotFound(_0x31d8bc,_0x203d00){return function(_0x492c1b){if(!_0x492c1b){_0x31d8bc['sendStatus'](0x194);}return _0x492c1b;};}function handleError(_0x2db35c,_0x47d333){_0x47d333=_0x47d333||0x1f4;return function(_0x117ff0){logger['error'](_0x117ff0['stack']);if(_0x117ff0[_0x5f2f('0x2b')]){delete _0x117ff0[_0x5f2f('0x2b')];}_0x2db35c[_0x5f2f('0x1d')](_0x47d333)[_0x5f2f('0x2c')](_0x117ff0);};}exports[_0x5f2f('0x2d')]=function(_0x376f75,_0x4a6cf0){var _0x3a36f2={},_0x2d0ff0={},_0x3250c9={'count':0x0,'rows':[]};var _0xa07221=_[_0x5f2f('0x2e')](db[_0x5f2f('0x2f')][_0x5f2f('0x30')],function(_0x208c61){return{'name':_0x208c61[_0x5f2f('0x31')],'type':_0x208c61['type']['key']};});_0x2d0ff0['model']=_[_0x5f2f('0x2e')](_0xa07221,_0x5f2f('0x2b'));_0x2d0ff0['query']=_[_0x5f2f('0x32')](_0x376f75[_0x5f2f('0x33')]);_0x2d0ff0[_0x5f2f('0x34')]=_[_0x5f2f('0x35')](_0x2d0ff0[_0x5f2f('0x36')],_0x2d0ff0[_0x5f2f('0x33')]);_0x3a36f2['attributes']=_[_0x5f2f('0x35')](_0x2d0ff0[_0x5f2f('0x36')],qs[_0x5f2f('0x37')](_0x376f75[_0x5f2f('0x33')]['fields']));_0x3a36f2[_0x5f2f('0x38')]=_0x3a36f2[_0x5f2f('0x38')]['length']?_0x3a36f2[_0x5f2f('0x38')]:_0x2d0ff0[_0x5f2f('0x36')];if(!_0x376f75[_0x5f2f('0x33')][_0x5f2f('0x39')](_0x5f2f('0x3a'))){_0x3a36f2[_0x5f2f('0x22')]=qs[_0x5f2f('0x22')](_0x376f75[_0x5f2f('0x33')][_0x5f2f('0x22')]);_0x3a36f2['offset']=qs['offset'](_0x376f75['query'][_0x5f2f('0x21')]);}_0x3a36f2[_0x5f2f('0x3b')]=qs[_0x5f2f('0x3c')](_0x376f75['query'][_0x5f2f('0x3c')]);_0x3a36f2[_0x5f2f('0x3d')]=qs['filters'](_[_0x5f2f('0x3e')](_0x376f75[_0x5f2f('0x33')],_0x2d0ff0[_0x5f2f('0x34')]),_0xa07221);if(_0x376f75['query'][_0x5f2f('0x3f')]){_0x3a36f2['where']=_[_0x5f2f('0x40')](_0x3a36f2['where'],{'$or':_['map'](_0xa07221,function(_0xf49828){if(_0xf49828[_0x5f2f('0x41')]!==_0x5f2f('0x42')){var _0x501a22={};_0x501a22[_0xf49828[_0x5f2f('0x2b')]]={'$like':'%'+_0x376f75[_0x5f2f('0x33')][_0x5f2f('0x3f')]+'%'};return _0x501a22;}})});}_0x3a36f2=_[_0x5f2f('0x40')]({},_0x3a36f2,_0x376f75[_0x5f2f('0x43')]);var _0x18e17b={'where':_0x3a36f2[_0x5f2f('0x3d')]};return db[_0x5f2f('0x2f')]['count'](_0x18e17b)[_0x5f2f('0x28')](function(_0x546f82){_0x3250c9['count']=_0x546f82;if(_0x376f75[_0x5f2f('0x33')][_0x5f2f('0x44')]){_0x3a36f2[_0x5f2f('0x45')]=[{'all':!![]}];}return db['ZendeskField'][_0x5f2f('0x46')](_0x3a36f2);})[_0x5f2f('0x28')](function(_0x1ac2f3){_0x3250c9['rows']=_0x1ac2f3;return _0x3250c9;})[_0x5f2f('0x28')](respondWithFilteredResult(_0x4a6cf0,_0x3a36f2))[_0x5f2f('0x47')](handleError(_0x4a6cf0,null));};exports[_0x5f2f('0x48')]=function(_0x584bb9,_0x3b35a3){var _0x2e4a3b={'raw':!![],'where':{'id':_0x584bb9[_0x5f2f('0x49')]['id']}},_0x34aa6a={};_0x34aa6a[_0x5f2f('0x36')]=_[_0x5f2f('0x32')](db[_0x5f2f('0x2f')][_0x5f2f('0x30')]);_0x34aa6a[_0x5f2f('0x33')]=_['keys'](_0x584bb9['query']);_0x34aa6a['filters']=_['intersection'](_0x34aa6a[_0x5f2f('0x36')],_0x34aa6a[_0x5f2f('0x33')]);_0x2e4a3b[_0x5f2f('0x38')]=_['intersection'](_0x34aa6a['model'],qs[_0x5f2f('0x37')](_0x584bb9['query']['fields']));_0x2e4a3b[_0x5f2f('0x38')]=_0x2e4a3b[_0x5f2f('0x38')][_0x5f2f('0x4a')]?_0x2e4a3b[_0x5f2f('0x38')]:_0x34aa6a[_0x5f2f('0x36')];if(_0x584bb9[_0x5f2f('0x33')][_0x5f2f('0x44')]){_0x2e4a3b[_0x5f2f('0x45')]=[{'all':!![]}];}_0x2e4a3b=_[_0x5f2f('0x40')]({},_0x2e4a3b,_0x584bb9[_0x5f2f('0x43')]);return db[_0x5f2f('0x2f')][_0x5f2f('0x4b')](_0x2e4a3b)[_0x5f2f('0x28')](handleEntityNotFound(_0x3b35a3,null))[_0x5f2f('0x28')](respondWithResult(_0x3b35a3,null))[_0x5f2f('0x47')](handleError(_0x3b35a3,null));};exports['create']=function(_0x3fbb5d,_0x149bc1){return db[_0x5f2f('0x2f')][_0x5f2f('0x4c')](_0x3fbb5d[_0x5f2f('0x4d')],{})['then'](respondWithResult(_0x149bc1,0xc9))[_0x5f2f('0x47')](handleError(_0x149bc1,null));};exports[_0x5f2f('0x27')]=function(_0x1d0cb2,_0xece615){if(_0x1d0cb2[_0x5f2f('0x4d')]['id']){delete _0x1d0cb2[_0x5f2f('0x4d')]['id'];}return db[_0x5f2f('0x2f')][_0x5f2f('0x4b')]({'where':{'id':_0x1d0cb2[_0x5f2f('0x49')]['id']}})[_0x5f2f('0x28')](handleEntityNotFound(_0xece615,null))[_0x5f2f('0x28')](saveUpdates(_0x1d0cb2['body'],null))[_0x5f2f('0x28')](respondWithResult(_0xece615,null))['catch'](handleError(_0xece615,null));};exports[_0x5f2f('0x29')]=function(_0x338d75,_0xe36705){return db[_0x5f2f('0x2f')]['find']({'where':{'id':_0x338d75[_0x5f2f('0x49')]['id']}})[_0x5f2f('0x28')](handleEntityNotFound(_0xe36705,null))[_0x5f2f('0x28')](removeEntity(_0xe36705,null))[_0x5f2f('0x47')](handleError(_0xe36705,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index b39bf71..706bbe9 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 _0x017e=['ZendeskField','int_zendesk_fields','idField','FieldId','util','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x4cac18,_0x2d4c72){var _0xd8775b=function(_0x468219){while(--_0x468219){_0x4cac18['push'](_0x4cac18['shift']());}};_0xd8775b(++_0x2d4c72);}(_0x017e,0x1f0));var _0xe017=function(_0x3c9bdf,_0x3b30cd){_0x3c9bdf=_0x3c9bdf-0x0;var _0x5664a6=_0x017e[_0x3c9bdf];return _0x5664a6;};'use strict';var _=require('lodash');var util=require(_0xe017('0x0'));var logger=require('../../config/logger')(_0xe017('0x1'));var moment=require('moment');var BPromise=require(_0xe017('0x2'));var rp=require(_0xe017('0x3'));var fs=require('fs');var path=require(_0xe017('0x4'));var rimraf=require(_0xe017('0x5'));var config=require(_0xe017('0x6'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x5942b3,_0x4cb808){return _0x5942b3[_0xe017('0x7')](_0xe017('0x8'),attributes,{'tableName':_0xe017('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xe017('0xa'),_0xe017('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf4c=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util'];(function(_0x5c697c,_0x294022){var _0x2b4ac0=function(_0x5d83ab){while(--_0x5d83ab){_0x5c697c['push'](_0x5c697c['shift']());}};_0x2b4ac0(++_0x294022);}(_0xcf4c,0x94));var _0xccf4=function(_0x591e82,_0x42c201){_0x591e82=_0x591e82-0x0;var _0x153a9f=_0xcf4c[_0x591e82];return _0x153a9f;};'use strict';var _=require(_0xccf4('0x0'));var util=require(_0xccf4('0x1'));var logger=require(_0xccf4('0x2'))(_0xccf4('0x3'));var moment=require(_0xccf4('0x4'));var BPromise=require(_0xccf4('0x5'));var rp=require(_0xccf4('0x6'));var fs=require('fs');var path=require(_0xccf4('0x7'));var rimraf=require('rimraf');var config=require(_0xccf4('0x8'));var attributes=require(_0xccf4('0x9'));module[_0xccf4('0xa')]=function(_0x553879,_0xb3dcb7){return _0x553879[_0xccf4('0xb')]('ZendeskField',attributes,{'tableName':_0xccf4('0xc'),'paranoid':![],'indexes':[{'name':_0xccf4('0xd'),'fields':['idField',_0xccf4('0xe')],'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 14f468d..a19a2f4 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 _0x9d35=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9d35,0x1a4));var _0x59d3=function(_0x263b0e,_0xc6479f){_0x263b0e=_0x263b0e-0x0;var _0x113fee=_0x9d35[_0x263b0e];return _0x113fee;};'use strict';var _=require('lodash');var util=require(_0x59d3('0x0'));var moment=require(_0x59d3('0x1'));var BPromise=require(_0x59d3('0x2'));var rs=require(_0x59d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x59d3('0x4'))(_0x59d3('0x5'));var config=require('../../config/environment');var jayson=require(_0x59d3('0x6'));var client=jayson['client'][_0x59d3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x538d65,_0x2ad212,_0x3f01d4){return new BPromise(function(_0x2cac19,_0x39cee4){return client[_0x59d3('0x8')](_0x538d65,_0x3f01d4)['then'](function(_0xcfd69b){logger[_0x59d3('0x9')](_0x59d3('0xa'),_0x2ad212,_0x59d3('0xb'));logger[_0x59d3('0xc')](_0x59d3('0xd'),_0x2ad212,_0x59d3('0xb'),JSON['stringify'](_0xcfd69b));if(_0xcfd69b[_0x59d3('0xe')]){if(_0xcfd69b[_0x59d3('0xe')]['code']===0x1f4){logger['error'](_0x59d3('0xa'),_0x2ad212,_0xcfd69b['error'][_0x59d3('0xf')]);return _0x39cee4(_0xcfd69b[_0x59d3('0xe')][_0x59d3('0xf')]);}logger[_0x59d3('0xe')](_0x59d3('0xa'),_0x2ad212,_0xcfd69b[_0x59d3('0xe')]['message']);return _0x2cac19(_0xcfd69b[_0x59d3('0xe')][_0x59d3('0xf')]);}else{logger[_0x59d3('0x9')](_0x59d3('0xa'),_0x2ad212,_0x59d3('0xb'));_0x2cac19(_0xcfd69b[_0x59d3('0x10')][_0x59d3('0xf')]);}})[_0x59d3('0x11')](function(_0xac2bdd){logger[_0x59d3('0xe')](_0x59d3('0xa'),_0x2ad212,_0xac2bdd);_0x39cee4(_0xac2bdd);});});} \ No newline at end of file +var _0xfd0c=['client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x288ca8,_0x21f49b){var _0x1129b6=function(_0x2da22b){while(--_0x2da22b){_0x288ca8['push'](_0x288ca8['shift']());}};_0x1129b6(++_0x21f49b);}(_0xfd0c,0x11e));var _0xcfd0=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xfd0c[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0xcfd0('0x0'));var util=require(_0xcfd0('0x1'));var moment=require(_0xcfd0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfd0('0x3'));var db=require(_0xcfd0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcfd0('0x5'));var config=require(_0xcfd0('0x6'));var jayson=require(_0xcfd0('0x7'));var client=jayson[_0xcfd0('0x8')][_0xcfd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f844a,_0x3d4dd9,_0x5339cc){return new BPromise(function(_0x2dc0a4,_0x425c76){return client[_0xcfd0('0xa')](_0x1f844a,_0x5339cc)['then'](function(_0x28eb90){logger[_0xcfd0('0xb')](_0xcfd0('0xc'),_0x3d4dd9,_0xcfd0('0xd'));logger[_0xcfd0('0xe')](_0xcfd0('0xf'),_0x3d4dd9,_0xcfd0('0xd'),JSON['stringify'](_0x28eb90));if(_0x28eb90[_0xcfd0('0x10')]){if(_0x28eb90[_0xcfd0('0x10')][_0xcfd0('0x11')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x3d4dd9,_0x28eb90[_0xcfd0('0x10')]['message']);return _0x425c76(_0x28eb90['error']['message']);}logger[_0xcfd0('0x10')](_0xcfd0('0xc'),_0x3d4dd9,_0x28eb90[_0xcfd0('0x10')][_0xcfd0('0x12')]);return _0x2dc0a4(_0x28eb90['error']['message']);}else{logger[_0xcfd0('0xb')]('ZendeskField,\x20%s,\x20%s',_0x3d4dd9,_0xcfd0('0xd'));_0x2dc0a4(_0x28eb90[_0xcfd0('0x13')][_0xcfd0('0x12')]);}})[_0xcfd0('0x14')](function(_0x11f424){logger['error'](_0xcfd0('0xc'),_0x3d4dd9,_0x11f424);_0x425c76(_0x11f424);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ad273f7..84650a8 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 _0xbc64=['/:id/configurations','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x36e3de,_0xdd340e){var _0x1201a0=function(_0x3adcf4){while(--_0x3adcf4){_0x36e3de['push'](_0x36e3de['shift']());}};_0x1201a0(++_0xdd340e);}(_0xbc64,0x6d));var _0x4bc6=function(_0x37635e,_0x21b6f5){_0x37635e=_0x37635e-0x0;var _0x3c0965=_0xbc64[_0x37635e];return _0x3c0965;};'use strict';var multer=require(_0x4bc6('0x0'));var util=require(_0x4bc6('0x1'));var path=require(_0x4bc6('0x2'));var timeout=require(_0x4bc6('0x3'));var express=require(_0x4bc6('0x4'));var router=express[_0x4bc6('0x5')]();var fs_extra=require(_0x4bc6('0x6'));var auth=require(_0x4bc6('0x7'));var interaction=require(_0x4bc6('0x8'));var config=require(_0x4bc6('0x9'));var controller=require(_0x4bc6('0xa'));router[_0x4bc6('0xb')]('/',auth[_0x4bc6('0xc')](),controller[_0x4bc6('0xd')]);router[_0x4bc6('0xb')](_0x4bc6('0xe'),auth[_0x4bc6('0xc')](),controller[_0x4bc6('0xf')]);router[_0x4bc6('0xb')](_0x4bc6('0x10'),auth[_0x4bc6('0xc')](),controller['getConfigurations']);router[_0x4bc6('0xb')]('/:id/fields',auth[_0x4bc6('0xc')](),controller[_0x4bc6('0x11')]);router[_0x4bc6('0x12')]('/',auth[_0x4bc6('0xc')](),controller[_0x4bc6('0x13')]);router[_0x4bc6('0x12')](_0x4bc6('0x10'),auth[_0x4bc6('0xc')](),controller['addConfiguration']);router[_0x4bc6('0x14')](_0x4bc6('0xe'),auth['isAuthenticated'](),controller[_0x4bc6('0x15')]);router[_0x4bc6('0x16')](_0x4bc6('0xe'),auth[_0x4bc6('0xc')](),controller[_0x4bc6('0x17')]);module[_0x4bc6('0x18')]=router; \ No newline at end of file +var _0xc501=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x2100d3,_0x37696a){var _0x59a0ae=function(_0x1e8910){while(--_0x1e8910){_0x2100d3['push'](_0x2100d3['shift']());}};_0x59a0ae(++_0x37696a);}(_0xc501,0x9d));var _0x1c50=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0xc501[_0x289a67];return _0x572b49;};'use strict';var multer=require(_0x1c50('0x0'));var util=require(_0x1c50('0x1'));var path=require(_0x1c50('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c50('0x3'));var router=express[_0x1c50('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1c50('0x5'));var interaction=require(_0x1c50('0x6'));var config=require(_0x1c50('0x7'));var controller=require('./intZohoAccount.controller');router[_0x1c50('0x8')]('/',auth['isAuthenticated'](),controller[_0x1c50('0x9')]);router[_0x1c50('0x8')](_0x1c50('0xa'),auth[_0x1c50('0xb')](),controller[_0x1c50('0xc')]);router[_0x1c50('0x8')](_0x1c50('0xd'),auth[_0x1c50('0xb')](),controller[_0x1c50('0xe')]);router[_0x1c50('0x8')](_0x1c50('0xf'),auth['isAuthenticated'](),controller[_0x1c50('0x10')]);router[_0x1c50('0x11')]('/',auth[_0x1c50('0xb')](),controller[_0x1c50('0x12')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1c50('0x13')](_0x1c50('0xa'),auth[_0x1c50('0xb')](),controller[_0x1c50('0x14')]);router[_0x1c50('0x15')]('/:id',auth[_0x1c50('0xb')](),controller[_0x1c50('0x16')]);module[_0x1c50('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 9b5224c..e6e5294 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 _0x6f0d=['exports','STRING'];(function(_0x1a8571,_0x5d02ac){var _0x3df629=function(_0x43dd68){while(--_0x43dd68){_0x1a8571['push'](_0x1a8571['shift']());}};_0x3df629(++_0x5d02ac);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5368d1,_0x50a7d3){_0x5368d1=_0x5368d1-0x0;var _0x3af225=_0x6f0d[_0x5368d1];return _0x3af225;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'name':{'type':Sequelize[_0xd6f0('0x1')]},'description':{'type':Sequelize[_0xd6f0('0x1')]},'host':{'type':Sequelize[_0xd6f0('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd6f0('0x1')]},'clientSecret':{'type':Sequelize[_0xd6f0('0x1')]},'serverUrl':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xd6f0('0x1')]},'refreshToken':{'type':Sequelize[_0xd6f0('0x1')]}}; \ No newline at end of file +var _0xb821=['STRING','exports'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb821,0xa7));var _0x1b82=function(_0x1255d6,_0xb24e0f){_0x1255d6=_0x1255d6-0x0;var _0x567440=_0xb821[_0x1255d6];return _0x567440;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'name':{'type':Sequelize[_0x1b82('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x1b82('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1b82('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x1b82('0x1')]},'refreshToken':{'type':Sequelize[_0x1b82('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a06a58d..a953d45 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 _0x9790=['display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','ZohoAccount','include','rows','catch','show','params','rawAttributes','length','includeAll','merge','options','find','create','body','getConfigurations','findOne','ZohoConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','getFields','host','serverUrl','code','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push'];(function(_0xf0641d,_0x2b6818){var _0x592e99=function(_0x196a7a){while(--_0x196a7a){_0xf0641d['push'](_0xf0641d['shift']());}};_0x592e99(++_0x2b6818);}(_0x9790,0x183));var _0x0979=function(_0x2b6a97,_0x1e3f1c){_0x2b6a97=_0x2b6a97-0x0;var _0x217aff=_0x9790[_0x2b6a97];return _0x217aff;};'use strict';var emlformat=require(_0x0979('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0979('0x1'));var BPromise=require(_0x0979('0x2'));var Mustache=require('mustache');var util=require(_0x0979('0x3'));var path=require(_0x0979('0x4'));var sox=require(_0x0979('0x5'));var csv=require('to-csv');var ejs=require(_0x0979('0x6'));var fs=require('fs');var fs_extra=require(_0x0979('0x7'));var _=require(_0x0979('0x8'));var squel=require(_0x0979('0x9'));var crypto=require(_0x0979('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0979('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0979('0xc'));var Redis=require('ioredis');var authService=require(_0x0979('0xd'));var qs=require(_0x0979('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0979('0xf'))(_0x0979('0x10'));var utils=require(_0x0979('0x11'));var config=require(_0x0979('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0979('0x13'))['db'];var integrations=require(_0x0979('0x14'));function respondWithStatusCode(_0x24429d,_0x19f831){_0x19f831=_0x19f831||0xcc;return function(_0x2f02eb){if(_0x2f02eb){return _0x24429d[_0x0979('0x15')](_0x19f831);}return _0x24429d[_0x0979('0x16')](_0x19f831)['end']();};}function respondWithResult(_0x3e8785,_0x2edd30){_0x2edd30=_0x2edd30||0xc8;return function(_0x1e67be){if(_0x1e67be){return _0x3e8785[_0x0979('0x16')](_0x2edd30)[_0x0979('0x17')](_0x1e67be);}};}function respondWithFilteredResult(_0x366bdb,_0x10bbe7){return function(_0x101a7d){if(_0x101a7d){var _0x20e2d8=typeof _0x10bbe7[_0x0979('0x18')]===_0x0979('0x19')&&typeof _0x10bbe7[_0x0979('0x1a')]===_0x0979('0x19');var _0x38084a=_0x101a7d[_0x0979('0x1b')];var _0x409483=_0x20e2d8?0x0:_0x10bbe7[_0x0979('0x18')];var _0x54db2e=_0x20e2d8?_0x101a7d[_0x0979('0x1b')]:_0x10bbe7[_0x0979('0x18')]+_0x10bbe7[_0x0979('0x1a')];var _0x39efa3;if(_0x54db2e>=_0x38084a){_0x54db2e=_0x38084a;_0x39efa3=0xc8;}else{_0x39efa3=0xce;}_0x366bdb[_0x0979('0x16')](_0x39efa3);return _0x366bdb['set'](_0x0979('0x1c'),_0x409483+'-'+_0x54db2e+'/'+_0x38084a)['json'](_0x101a7d);}return null;};}function patchUpdates(_0xdc7214){return function(_0x38ea93){try{jsonpatch['apply'](_0x38ea93,_0xdc7214,!![]);}catch(_0x9a81bb){return BPromise[_0x0979('0x1d')](_0x9a81bb);}return _0x38ea93[_0x0979('0x1e')]();};}function saveUpdates(_0x494d5a,_0x51deea){return function(_0x32afc6){if(_0x32afc6){return _0x32afc6[_0x0979('0x1f')](_0x494d5a)['then'](function(_0xe39768){return _0xe39768;});}return null;};}function removeEntity(_0xaefb6e,_0x316257){return function(_0x316597){if(_0x316597){return _0x316597[_0x0979('0x20')]()[_0x0979('0x21')](function(){_0xaefb6e[_0x0979('0x16')](0xcc)[_0x0979('0x22')]();});}};}function handleEntityNotFound(_0x261e4c,_0x3f4f1d){return function(_0x303821){if(!_0x303821){_0x261e4c[_0x0979('0x15')](0x194);}return _0x303821;};}function handleError(_0x378c48,_0x3ade45){_0x3ade45=_0x3ade45||0x1f4;return function(_0x5a6334){logger[_0x0979('0x23')](_0x5a6334[_0x0979('0x24')]);if(_0x5a6334[_0x0979('0x25')]){delete _0x5a6334[_0x0979('0x25')];}_0x378c48['status'](_0x3ade45)[_0x0979('0x26')](_0x5a6334);};}exports[_0x0979('0x27')]=function(_0x17829e,_0xd37c5e){var _0x4f44b1={},_0x4e233a={},_0xf99ffd={'count':0x0,'rows':[]};var _0x3a9550=_[_0x0979('0x28')](db['ZohoAccount']['rawAttributes'],function(_0x1f325d){return{'name':_0x1f325d[_0x0979('0x29')],'type':_0x1f325d[_0x0979('0x2a')][_0x0979('0x2b')]};});_0x4e233a['model']=_[_0x0979('0x28')](_0x3a9550,'name');_0x4e233a[_0x0979('0x2c')]=_[_0x0979('0x2d')](_0x17829e[_0x0979('0x2c')]);_0x4e233a[_0x0979('0x2e')]=_[_0x0979('0x2f')](_0x4e233a['model'],_0x4e233a['query']);_0x4f44b1[_0x0979('0x30')]=_[_0x0979('0x2f')](_0x4e233a[_0x0979('0x31')],qs[_0x0979('0x32')](_0x17829e[_0x0979('0x2c')]['fields']));_0x4f44b1[_0x0979('0x30')]=_0x4f44b1['attributes']['length']?_0x4f44b1[_0x0979('0x30')]:_0x4e233a[_0x0979('0x31')];if(!_0x17829e['query'][_0x0979('0x33')](_0x0979('0x34'))){_0x4f44b1[_0x0979('0x1a')]=qs[_0x0979('0x1a')](_0x17829e[_0x0979('0x2c')][_0x0979('0x1a')]);_0x4f44b1[_0x0979('0x18')]=qs[_0x0979('0x18')](_0x17829e['query'][_0x0979('0x18')]);}_0x4f44b1[_0x0979('0x35')]=qs[_0x0979('0x36')](_0x17829e[_0x0979('0x2c')][_0x0979('0x36')]);_0x4f44b1[_0x0979('0x37')]=qs[_0x0979('0x2e')](_[_0x0979('0x38')](_0x17829e[_0x0979('0x2c')],_0x4e233a[_0x0979('0x2e')]),_0x3a9550);if(_0x17829e[_0x0979('0x2c')][_0x0979('0x39')]){_0x4f44b1[_0x0979('0x37')]=_['merge'](_0x4f44b1[_0x0979('0x37')],{'$or':_[_0x0979('0x28')](_0x3a9550,function(_0x2a7cd4){if(_0x2a7cd4[_0x0979('0x2a')]!==_0x0979('0x3a')){var _0x47b64c={};_0x47b64c[_0x2a7cd4['name']]={'$like':'%'+_0x17829e[_0x0979('0x2c')][_0x0979('0x39')]+'%'};return _0x47b64c;}})});}_0x4f44b1=_['merge']({},_0x4f44b1,_0x17829e['options']);var _0x143864={'where':_0x4f44b1[_0x0979('0x37')]};return db[_0x0979('0x3b')][_0x0979('0x1b')](_0x143864)[_0x0979('0x21')](function(_0x28b505){_0xf99ffd[_0x0979('0x1b')]=_0x28b505;if(_0x17829e[_0x0979('0x2c')]['includeAll']){_0x4f44b1[_0x0979('0x3c')]=[{'all':!![]}];}return db[_0x0979('0x3b')]['findAll'](_0x4f44b1);})['then'](function(_0x2ed100){_0xf99ffd[_0x0979('0x3d')]=_0x2ed100;return _0xf99ffd;})[_0x0979('0x21')](respondWithFilteredResult(_0xd37c5e,_0x4f44b1))[_0x0979('0x3e')](handleError(_0xd37c5e,null));};exports[_0x0979('0x3f')]=function(_0x35ba41,_0x321fb2){var _0x1f65e7={'raw':![],'where':{'id':_0x35ba41[_0x0979('0x40')]['id']}},_0x1f75f7={};_0x1f75f7[_0x0979('0x31')]=_[_0x0979('0x2d')](db[_0x0979('0x3b')][_0x0979('0x41')]);_0x1f75f7[_0x0979('0x2c')]=_[_0x0979('0x2d')](_0x35ba41['query']);_0x1f75f7[_0x0979('0x2e')]=_['intersection'](_0x1f75f7[_0x0979('0x31')],_0x1f75f7[_0x0979('0x2c')]);_0x1f65e7[_0x0979('0x30')]=_['intersection'](_0x1f75f7[_0x0979('0x31')],qs[_0x0979('0x32')](_0x35ba41[_0x0979('0x2c')][_0x0979('0x32')]));_0x1f65e7['attributes']=_0x1f65e7[_0x0979('0x30')][_0x0979('0x42')]?_0x1f65e7[_0x0979('0x30')]:_0x1f75f7['model'];if(_0x35ba41[_0x0979('0x2c')][_0x0979('0x43')]){_0x1f65e7[_0x0979('0x3c')]=[{'all':!![]}];}_0x1f65e7=_[_0x0979('0x44')]({},_0x1f65e7,_0x35ba41[_0x0979('0x45')]);return db['ZohoAccount'][_0x0979('0x46')](_0x1f65e7)[_0x0979('0x21')](handleEntityNotFound(_0x321fb2,null))['then'](respondWithResult(_0x321fb2,null))[_0x0979('0x3e')](handleError(_0x321fb2,null));};exports['create']=function(_0x399c68,_0x10a3b5){return db[_0x0979('0x3b')][_0x0979('0x47')](_0x399c68[_0x0979('0x48')],{})[_0x0979('0x21')](respondWithResult(_0x10a3b5,0xc9))['catch'](handleError(_0x10a3b5,null));};exports[_0x0979('0x1f')]=function(_0xed53b7,_0x2fc398){if(_0xed53b7['body']['id']){delete _0xed53b7[_0x0979('0x48')]['id'];}return db[_0x0979('0x3b')]['find']({'where':{'id':_0xed53b7[_0x0979('0x40')]['id']}})['then'](handleEntityNotFound(_0x2fc398,null))[_0x0979('0x21')](saveUpdates(_0xed53b7[_0x0979('0x48')],null))['then'](respondWithResult(_0x2fc398,null))['catch'](handleError(_0x2fc398,null));};exports[_0x0979('0x20')]=function(_0x42b042,_0x3a40ea){return db['ZohoAccount']['find']({'where':{'id':_0x42b042[_0x0979('0x40')]['id']}})[_0x0979('0x21')](handleEntityNotFound(_0x3a40ea,null))['then'](removeEntity(_0x3a40ea,null))[_0x0979('0x3e')](handleError(_0x3a40ea,null));};exports[_0x0979('0x49')]=function(_0x12861b,_0x40b1d6,_0xa9cbe5){var _0x1dcced={};var _0xf47b19={};var _0x39fdc1;var _0x588641;return db[_0x0979('0x3b')][_0x0979('0x4a')]({'where':{'id':_0x12861b['params']['id']}})[_0x0979('0x21')](handleEntityNotFound(_0x40b1d6,null))[_0x0979('0x21')](function(_0x2620be){if(_0x2620be){_0x39fdc1=_0x2620be;_0xf47b19[_0x0979('0x31')]=_[_0x0979('0x2d')](db[_0x0979('0x4b')][_0x0979('0x41')]);_0xf47b19['query']=_[_0x0979('0x2d')](_0x12861b[_0x0979('0x2c')]);_0xf47b19[_0x0979('0x2e')]=_[_0x0979('0x2f')](_0xf47b19[_0x0979('0x31')],_0xf47b19[_0x0979('0x2c')]);_0x1dcced[_0x0979('0x30')]=_[_0x0979('0x2f')](_0xf47b19['model'],qs[_0x0979('0x32')](_0x12861b[_0x0979('0x2c')][_0x0979('0x32')]));_0x1dcced[_0x0979('0x30')]=_0x1dcced[_0x0979('0x30')]['length']?_0x1dcced['attributes']:_0xf47b19[_0x0979('0x31')];_0x1dcced[_0x0979('0x35')]=qs[_0x0979('0x36')](_0x12861b[_0x0979('0x2c')][_0x0979('0x36')]);_0x1dcced[_0x0979('0x37')]=qs[_0x0979('0x2e')](_[_0x0979('0x38')](_0x12861b[_0x0979('0x2c')],_0xf47b19[_0x0979('0x2e')]));if(_0x12861b[_0x0979('0x2c')][_0x0979('0x39')]){_0x1dcced['where']=_['merge'](_0x1dcced[_0x0979('0x37')],{'$or':_['map'](_0x1dcced['attributes'],function(_0x26f631){var _0x4a6546={};_0x4a6546[_0x26f631]={'$like':'%'+_0x12861b[_0x0979('0x2c')][_0x0979('0x39')]+'%'};return _0x4a6546;})});}_0x1dcced=_[_0x0979('0x44')]({},_0x1dcced,_0x12861b[_0x0979('0x45')]);return _0x39fdc1['getConfigurations'](_0x1dcced);}})['then'](function(_0x2a1145){if(_0x2a1145){_0x588641=_0x2a1145[_0x0979('0x42')];if(!_0x12861b[_0x0979('0x2c')]['hasOwnProperty'](_0x0979('0x34'))){_0x1dcced[_0x0979('0x1a')]=qs[_0x0979('0x1a')](_0x12861b[_0x0979('0x2c')][_0x0979('0x1a')]);_0x1dcced[_0x0979('0x18')]=qs['offset'](_0x12861b[_0x0979('0x2c')][_0x0979('0x18')]);}return _0x39fdc1[_0x0979('0x49')](_0x1dcced);}})[_0x0979('0x21')](function(_0x31ef87){if(_0x31ef87){return _0x31ef87?{'count':_0x588641,'rows':_0x31ef87}:null;}})['then'](respondWithResult(_0x40b1d6,null))['catch'](handleError(_0x40b1d6,null));};exports['addConfiguration']=function(_0xf95faf,_0x3b7d75,_0x2d587d){if(_0xf95faf[_0x0979('0x48')]['id']){delete _0xf95faf[_0x0979('0x48')]['id'];}return db[_0x0979('0x3b')][_0x0979('0x4a')]({'where':{'id':_0xf95faf[_0x0979('0x40')]['id']}})[_0x0979('0x21')](handleEntityNotFound(_0x3b7d75,null))['then'](function(_0x10f0a3){if(_0x10f0a3){_0xf95faf['body']['AccountId']=_0x10f0a3['id'];_0xf95faf['body'][_0x0979('0x4c')]=integrations[_0x0979('0x4d')](_0xf95faf[_0x0979('0x48')]['channel'],_0xf95faf['body']['type']);_0xf95faf[_0x0979('0x48')][_0x0979('0x4e')]=integrations[_0x0979('0x4f')](_0xf95faf[_0x0979('0x48')][_0x0979('0x50')],_0xf95faf['body'][_0x0979('0x2a')]);return db[_0x0979('0x4b')]['create'](_0xf95faf[_0x0979('0x48')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x0979('0x51')],'as':_0x0979('0x4e')}]});}return null;})[_0x0979('0x21')](respondWithResult(_0x3b7d75,null))[_0x0979('0x3e')](handleError(_0x3b7d75,null));};function getAccessToken(_0x2394be){return new Promise(function(_0x4e6024,_0x14339b){var _0x49355a;switch(_0x2394be[_0x0979('0x52')]){case'US':_0x49355a='https://accounts.zoho.com';break;case'AU':_0x49355a=_0x0979('0x53');break;case'EU':_0x49355a=_0x0979('0x54');break;case'IN':_0x49355a=_0x0979('0x55');break;case'CN':_0x49355a='https://accounts.zoho.com.cn';break;default:_0x49355a=_0x0979('0x54');break;}var _0x2b10ba={'method':_0x0979('0x56'),'uri':_0x49355a+_0x0979('0x57'),'qs':{'refresh_token':_0x2394be[_0x0979('0x58')],'client_id':_0x2394be[_0x0979('0x59')],'client_secret':_0x2394be[_0x0979('0x5a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2b10ba)[_0x0979('0x21')](function(_0x31561e){if(_0x31561e['access_token']){_0x4e6024(_0x31561e[_0x0979('0x5b')]);}else{_0x14339b('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x0979('0x3e')](function(_0x42ef26){_0x14339b(_0x42ef26);});});}exports[_0x0979('0x5c')]=function(_0x51ea0e,_0x450820,_0x4783aa){var _0x4a9cd4,_0x54038d,_0x153c28,_0x3aa513,_0x19cc96;return db[_0x0979('0x3b')][_0x0979('0x4a')]({'where':{'id':_0x51ea0e[_0x0979('0x40')]['id']},'attributes':['id',_0x0979('0x5d'),_0x0979('0x52'),_0x0979('0x59'),_0x0979('0x5a'),_0x0979('0x5e'),_0x0979('0x5f'),_0x0979('0x58')]})['then'](handleEntityNotFound(_0x450820,null))['then'](function(_0x120f72){_0x19cc96=_0x120f72;_0x4a9cd4=_0x19cc96[_0x0979('0x5d')];_0x54038d=_0x4a9cd4==='zoho.eu'?'eu':_0x0979('0x60');_0x153c28=_0x19cc96['serverUrl'];var _0x2418c1=_0x153c28['slice'](-0x1);if(_0x2418c1==='/'||_0x2418c1==='\x5c'||_0x2418c1===':'){_0x153c28=_0x153c28[_0x0979('0x61')](0x0,_0x153c28[_0x0979('0x62')](_0x2418c1));}if(!_0x19cc96[_0x0979('0x58')]){throw new Error(_0x0979('0x63'));}return getAccessToken(_0x19cc96);})['then'](function(_0x545f17){if(_0x545f17){return rp({'method':'GET','uri':util[_0x0979('0x64')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x54038d),'qs':{'module':_0x0979('0x65')},'headers':{'Authorization':_0x0979('0x66')+_0x545f17},'json':!![]});}})['then'](function(_0x499b17){if(_0x499b17){if(_0x499b17['response']&&_0x499b17['response'][_0x0979('0x23')]){throw new Error(_0x499b17['response'][_0x0979('0x23')][_0x0979('0x67')]);}var _0x4f28dd=[];var _0x252e3a=[];var _0x48638e=[_0x0979('0x68'),_0x0979('0x69'),_0x0979('0x6a'),_0x0979('0x6b'),_0x0979('0x6c'),_0x0979('0x6d'),_0x0979('0x6e'),_0x0979('0x6f')];_0x252e3a=_[_0x0979('0x70')](_0x499b17[_0x0979('0x32')],function(_0x33ad27){return _0x48638e[_0x0979('0x71')](_0x33ad27[_0x0979('0x72')]);});for(var _0x32ee62=0x0;_0x32ee62<_0x252e3a[_0x0979('0x42')];_0x32ee62++){if(_0x252e3a[_0x32ee62][_0x0979('0x73')]===![]){_0x4f28dd[_0x0979('0x74')]({'id':_0x252e3a[_0x32ee62]['id'],'name':_0x252e3a[_0x32ee62][_0x0979('0x75')],'custom':_0x252e3a[_0x32ee62][_0x0979('0x76')],'options':_0x252e3a[_0x32ee62][_0x0979('0x77')]==='picklist'&&_0x252e3a[_0x32ee62][_0x0979('0x78')]['length']>-0x1?_[_0x0979('0x28')](_0x252e3a[_0x32ee62][_0x0979('0x78')],function(_0x45faed){return{'name':_0x45faed,'value':_0x45faed};}):[]});}}return{'count':_0x4f28dd[_0x0979('0x42')],'rows':_0x4f28dd};}else{return{'count':0x0,'rows':[]};}})[_0x0979('0x21')](respondWithResult(_0x450820,null))[_0x0979('0x3e')](function(_0x559251){var _0x4759d7=_0x51ea0e[_0x0979('0x2c')][_0x0979('0x79')]?0x1f4:_0x559251[_0x0979('0x7a')]||0x1f4;logger[_0x0979('0x23')](_0x0979('0x7b'),_0x0979('0x5c'),_0x4759d7,JSON[_0x0979('0x7c')](_0x559251));delete _0x559251[_0x0979('0x25')];if(_0x4759d7===0x191){_0x4759d7=0x190;}_0x450820['status'](_0x4759d7)[_0x0979('0x26')](_0x51ea0e['query'][_0x0979('0x79')]?{'message':_0x0979('0x7d'),'statusCode':_0x559251[_0x0979('0x7a')]}:_0x559251);});}; \ No newline at end of file +var _0x3b95=['zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','then','error','stack','name','send','map','ZohoAccount','fieldName','type','key','query','intersection','model','attributes','fields','length','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','update','findOne','ZohoConfiguration','getConfigurations','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields','stringify','eml-format','rimraf'];(function(_0x3f6047,_0x2d4f4d){var _0x18cf85=function(_0x5b1b7d){while(--_0x5b1b7d){_0x3f6047['push'](_0x3f6047['shift']());}};_0x18cf85(++_0x2d4f4d);}(_0x3b95,0x10a));var _0x53b9=function(_0x373d6c,_0x21668b){_0x373d6c=_0x373d6c-0x0;var _0x28eb00=_0x3b95[_0x373d6c];return _0x28eb00;};'use strict';var emlformat=require(_0x53b9('0x0'));var rimraf=require(_0x53b9('0x1'));var zipdir=require(_0x53b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53b9('0x3'));var moment=require(_0x53b9('0x4'));var BPromise=require(_0x53b9('0x5'));var Mustache=require(_0x53b9('0x6'));var util=require('util');var path=require(_0x53b9('0x7'));var sox=require(_0x53b9('0x8'));var csv=require('to-csv');var ejs=require(_0x53b9('0x9'));var fs=require('fs');var fs_extra=require(_0x53b9('0xa'));var _=require(_0x53b9('0xb'));var squel=require(_0x53b9('0xc'));var crypto=require(_0x53b9('0xd'));var jsforce=require(_0x53b9('0xe'));var deskjs=require(_0x53b9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x53b9('0x10'));var Papa=require(_0x53b9('0x11'));var Redis=require(_0x53b9('0x12'));var authService=require(_0x53b9('0x13'));var qs=require(_0x53b9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x53b9('0x15'))(_0x53b9('0x16'));var utils=require(_0x53b9('0x17'));var config=require(_0x53b9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x53b9('0x19'))['db'];var integrations=require(_0x53b9('0x1a'));function respondWithStatusCode(_0x3540be,_0xc1c01e){_0xc1c01e=_0xc1c01e||0xcc;return function(_0x2a9dcc){if(_0x2a9dcc){return _0x3540be['sendStatus'](_0xc1c01e);}return _0x3540be['status'](_0xc1c01e)[_0x53b9('0x1b')]();};}function respondWithResult(_0x384f63,_0x54bb1f){_0x54bb1f=_0x54bb1f||0xc8;return function(_0x2227ac){if(_0x2227ac){return _0x384f63['status'](_0x54bb1f)[_0x53b9('0x1c')](_0x2227ac);}};}function respondWithFilteredResult(_0x353ea6,_0x28e600){return function(_0x3d972a){if(_0x3d972a){var _0x1ab61e=typeof _0x28e600[_0x53b9('0x1d')]==='undefined'&&typeof _0x28e600['limit']===_0x53b9('0x1e');var _0x1ecf84=_0x3d972a[_0x53b9('0x1f')];var _0x4c9a5e=_0x1ab61e?0x0:_0x28e600[_0x53b9('0x1d')];var _0x4380b3=_0x1ab61e?_0x3d972a[_0x53b9('0x1f')]:_0x28e600[_0x53b9('0x1d')]+_0x28e600[_0x53b9('0x20')];var _0x354a48;if(_0x4380b3>=_0x1ecf84){_0x4380b3=_0x1ecf84;_0x354a48=0xc8;}else{_0x354a48=0xce;}_0x353ea6[_0x53b9('0x21')](_0x354a48);return _0x353ea6[_0x53b9('0x22')](_0x53b9('0x23'),_0x4c9a5e+'-'+_0x4380b3+'/'+_0x1ecf84)['json'](_0x3d972a);}return null;};}function patchUpdates(_0x1adc58){return function(_0x77e243){try{jsonpatch[_0x53b9('0x24')](_0x77e243,_0x1adc58,!![]);}catch(_0x5e24c9){return BPromise[_0x53b9('0x25')](_0x5e24c9);}return _0x77e243['save']();};}function saveUpdates(_0xca8d3c,_0x577bc3){return function(_0x2bb4a5){if(_0x2bb4a5){return _0x2bb4a5['update'](_0xca8d3c)[_0x53b9('0x26')](function(_0x142e9d){return _0x142e9d;});}return null;};}function removeEntity(_0x1ba88c,_0xe1c6cb){return function(_0x1c5dd1){if(_0x1c5dd1){return _0x1c5dd1['destroy']()['then'](function(){_0x1ba88c[_0x53b9('0x21')](0xcc)[_0x53b9('0x1b')]();});}};}function handleEntityNotFound(_0x16f441,_0x23257c){return function(_0x1f3e1c){if(!_0x1f3e1c){_0x16f441['sendStatus'](0x194);}return _0x1f3e1c;};}function handleError(_0x553039,_0x8dfdc3){_0x8dfdc3=_0x8dfdc3||0x1f4;return function(_0x2398f5){logger[_0x53b9('0x27')](_0x2398f5[_0x53b9('0x28')]);if(_0x2398f5[_0x53b9('0x29')]){delete _0x2398f5[_0x53b9('0x29')];}_0x553039['status'](_0x8dfdc3)[_0x53b9('0x2a')](_0x2398f5);};}exports['index']=function(_0x4d4a0d,_0x4c2fc7){var _0x44c42c={},_0x37bdef={},_0x20ac88={'count':0x0,'rows':[]};var _0x53d067=_[_0x53b9('0x2b')](db[_0x53b9('0x2c')]['rawAttributes'],function(_0xdb2dc2){return{'name':_0xdb2dc2[_0x53b9('0x2d')],'type':_0xdb2dc2[_0x53b9('0x2e')][_0x53b9('0x2f')]};});_0x37bdef['model']=_['map'](_0x53d067,'name');_0x37bdef[_0x53b9('0x30')]=_['keys'](_0x4d4a0d['query']);_0x37bdef['filters']=_[_0x53b9('0x31')](_0x37bdef[_0x53b9('0x32')],_0x37bdef[_0x53b9('0x30')]);_0x44c42c[_0x53b9('0x33')]=_[_0x53b9('0x31')](_0x37bdef['model'],qs[_0x53b9('0x34')](_0x4d4a0d[_0x53b9('0x30')]['fields']));_0x44c42c[_0x53b9('0x33')]=_0x44c42c[_0x53b9('0x33')][_0x53b9('0x35')]?_0x44c42c['attributes']:_0x37bdef['model'];if(!_0x4d4a0d['query']['hasOwnProperty']('nolimit')){_0x44c42c[_0x53b9('0x20')]=qs[_0x53b9('0x20')](_0x4d4a0d['query'][_0x53b9('0x20')]);_0x44c42c['offset']=qs[_0x53b9('0x1d')](_0x4d4a0d[_0x53b9('0x30')]['offset']);}_0x44c42c[_0x53b9('0x36')]=qs[_0x53b9('0x37')](_0x4d4a0d[_0x53b9('0x30')][_0x53b9('0x37')]);_0x44c42c[_0x53b9('0x38')]=qs['filters'](_[_0x53b9('0x39')](_0x4d4a0d[_0x53b9('0x30')],_0x37bdef[_0x53b9('0x3a')]),_0x53d067);if(_0x4d4a0d['query']['filter']){_0x44c42c[_0x53b9('0x38')]=_[_0x53b9('0x3b')](_0x44c42c['where'],{'$or':_[_0x53b9('0x2b')](_0x53d067,function(_0xa1069e){if(_0xa1069e[_0x53b9('0x2e')]!==_0x53b9('0x3c')){var _0x1b13bd={};_0x1b13bd[_0xa1069e['name']]={'$like':'%'+_0x4d4a0d[_0x53b9('0x30')][_0x53b9('0x3d')]+'%'};return _0x1b13bd;}})});}_0x44c42c=_[_0x53b9('0x3b')]({},_0x44c42c,_0x4d4a0d[_0x53b9('0x3e')]);var _0x4df5b9={'where':_0x44c42c[_0x53b9('0x38')]};return db[_0x53b9('0x2c')][_0x53b9('0x1f')](_0x4df5b9)['then'](function(_0x2f5960){_0x20ac88[_0x53b9('0x1f')]=_0x2f5960;if(_0x4d4a0d[_0x53b9('0x30')][_0x53b9('0x3f')]){_0x44c42c[_0x53b9('0x40')]=[{'all':!![]}];}return db[_0x53b9('0x2c')][_0x53b9('0x41')](_0x44c42c);})['then'](function(_0x4809f3){_0x20ac88[_0x53b9('0x42')]=_0x4809f3;return _0x20ac88;})[_0x53b9('0x26')](respondWithFilteredResult(_0x4c2fc7,_0x44c42c))['catch'](handleError(_0x4c2fc7,null));};exports[_0x53b9('0x43')]=function(_0x4fa51e,_0x457915){var _0x2f9ca3={'raw':![],'where':{'id':_0x4fa51e[_0x53b9('0x44')]['id']}},_0x4c8d8f={};_0x4c8d8f[_0x53b9('0x32')]=_[_0x53b9('0x45')](db['ZohoAccount'][_0x53b9('0x46')]);_0x4c8d8f[_0x53b9('0x30')]=_[_0x53b9('0x45')](_0x4fa51e[_0x53b9('0x30')]);_0x4c8d8f['filters']=_[_0x53b9('0x31')](_0x4c8d8f[_0x53b9('0x32')],_0x4c8d8f[_0x53b9('0x30')]);_0x2f9ca3[_0x53b9('0x33')]=_[_0x53b9('0x31')](_0x4c8d8f['model'],qs[_0x53b9('0x34')](_0x4fa51e[_0x53b9('0x30')][_0x53b9('0x34')]));_0x2f9ca3[_0x53b9('0x33')]=_0x2f9ca3[_0x53b9('0x33')][_0x53b9('0x35')]?_0x2f9ca3['attributes']:_0x4c8d8f[_0x53b9('0x32')];if(_0x4fa51e[_0x53b9('0x30')][_0x53b9('0x3f')]){_0x2f9ca3[_0x53b9('0x40')]=[{'all':!![]}];}_0x2f9ca3=_['merge']({},_0x2f9ca3,_0x4fa51e['options']);return db['ZohoAccount'][_0x53b9('0x47')](_0x2f9ca3)[_0x53b9('0x26')](handleEntityNotFound(_0x457915,null))[_0x53b9('0x26')](respondWithResult(_0x457915,null))[_0x53b9('0x48')](handleError(_0x457915,null));};exports[_0x53b9('0x49')]=function(_0x2a5e10,_0x4f4dd8){return db[_0x53b9('0x2c')]['create'](_0x2a5e10[_0x53b9('0x4a')],{})['then'](respondWithResult(_0x4f4dd8,0xc9))[_0x53b9('0x48')](handleError(_0x4f4dd8,null));};exports[_0x53b9('0x4b')]=function(_0x311b80,_0x352268){if(_0x311b80[_0x53b9('0x4a')]['id']){delete _0x311b80[_0x53b9('0x4a')]['id'];}return db[_0x53b9('0x2c')]['find']({'where':{'id':_0x311b80[_0x53b9('0x44')]['id']}})[_0x53b9('0x26')](handleEntityNotFound(_0x352268,null))['then'](saveUpdates(_0x311b80[_0x53b9('0x4a')],null))[_0x53b9('0x26')](respondWithResult(_0x352268,null))[_0x53b9('0x48')](handleError(_0x352268,null));};exports['destroy']=function(_0x20f4e0,_0x2a17c){return db['ZohoAccount'][_0x53b9('0x47')]({'where':{'id':_0x20f4e0['params']['id']}})[_0x53b9('0x26')](handleEntityNotFound(_0x2a17c,null))[_0x53b9('0x26')](removeEntity(_0x2a17c,null))[_0x53b9('0x48')](handleError(_0x2a17c,null));};exports['getConfigurations']=function(_0x24a5b1,_0x522263,_0x21de3e){var _0x4207b9={};var _0x556e2d={};var _0xf1b537;var _0x18b8bc;return db[_0x53b9('0x2c')][_0x53b9('0x4c')]({'where':{'id':_0x24a5b1[_0x53b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x522263,null))['then'](function(_0x59ceaf){if(_0x59ceaf){_0xf1b537=_0x59ceaf;_0x556e2d['model']=_[_0x53b9('0x45')](db[_0x53b9('0x4d')][_0x53b9('0x46')]);_0x556e2d[_0x53b9('0x30')]=_[_0x53b9('0x45')](_0x24a5b1[_0x53b9('0x30')]);_0x556e2d['filters']=_[_0x53b9('0x31')](_0x556e2d['model'],_0x556e2d[_0x53b9('0x30')]);_0x4207b9['attributes']=_['intersection'](_0x556e2d[_0x53b9('0x32')],qs[_0x53b9('0x34')](_0x24a5b1[_0x53b9('0x30')][_0x53b9('0x34')]));_0x4207b9['attributes']=_0x4207b9[_0x53b9('0x33')]['length']?_0x4207b9[_0x53b9('0x33')]:_0x556e2d[_0x53b9('0x32')];_0x4207b9['order']=qs[_0x53b9('0x37')](_0x24a5b1[_0x53b9('0x30')][_0x53b9('0x37')]);_0x4207b9[_0x53b9('0x38')]=qs[_0x53b9('0x3a')](_[_0x53b9('0x39')](_0x24a5b1[_0x53b9('0x30')],_0x556e2d[_0x53b9('0x3a')]));if(_0x24a5b1[_0x53b9('0x30')][_0x53b9('0x3d')]){_0x4207b9[_0x53b9('0x38')]=_['merge'](_0x4207b9[_0x53b9('0x38')],{'$or':_[_0x53b9('0x2b')](_0x4207b9[_0x53b9('0x33')],function(_0x1de6a6){var _0x5e1956={};_0x5e1956[_0x1de6a6]={'$like':'%'+_0x24a5b1[_0x53b9('0x30')][_0x53b9('0x3d')]+'%'};return _0x5e1956;})});}_0x4207b9=_[_0x53b9('0x3b')]({},_0x4207b9,_0x24a5b1['options']);return _0xf1b537[_0x53b9('0x4e')](_0x4207b9);}})[_0x53b9('0x26')](function(_0x5338e6){if(_0x5338e6){_0x18b8bc=_0x5338e6[_0x53b9('0x35')];if(!_0x24a5b1[_0x53b9('0x30')][_0x53b9('0x4f')](_0x53b9('0x50'))){_0x4207b9[_0x53b9('0x20')]=qs[_0x53b9('0x20')](_0x24a5b1[_0x53b9('0x30')][_0x53b9('0x20')]);_0x4207b9[_0x53b9('0x1d')]=qs[_0x53b9('0x1d')](_0x24a5b1[_0x53b9('0x30')][_0x53b9('0x1d')]);}return _0xf1b537[_0x53b9('0x4e')](_0x4207b9);}})[_0x53b9('0x26')](function(_0x22b089){if(_0x22b089){return _0x22b089?{'count':_0x18b8bc,'rows':_0x22b089}:null;}})[_0x53b9('0x26')](respondWithResult(_0x522263,null))[_0x53b9('0x48')](handleError(_0x522263,null));};exports[_0x53b9('0x51')]=function(_0x4d429b,_0x1595cd,_0x51e048){if(_0x4d429b[_0x53b9('0x4a')]['id']){delete _0x4d429b[_0x53b9('0x4a')]['id'];}return db['ZohoAccount'][_0x53b9('0x4c')]({'where':{'id':_0x4d429b[_0x53b9('0x44')]['id']}})[_0x53b9('0x26')](handleEntityNotFound(_0x1595cd,null))[_0x53b9('0x26')](function(_0x27f67a){if(_0x27f67a){_0x4d429b[_0x53b9('0x4a')][_0x53b9('0x52')]=_0x27f67a['id'];_0x4d429b[_0x53b9('0x4a')][_0x53b9('0x53')]=integrations[_0x53b9('0x54')](_0x4d429b[_0x53b9('0x4a')][_0x53b9('0x55')],_0x4d429b['body'][_0x53b9('0x2e')]);_0x4d429b[_0x53b9('0x4a')]['Descriptions']=integrations[_0x53b9('0x56')](_0x4d429b[_0x53b9('0x4a')][_0x53b9('0x55')],_0x4d429b[_0x53b9('0x4a')]['type']);return db[_0x53b9('0x4d')]['create'](_0x4d429b[_0x53b9('0x4a')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x53b9('0x57')],'as':_0x53b9('0x58')}]});}return null;})['then'](respondWithResult(_0x1595cd,null))[_0x53b9('0x48')](handleError(_0x1595cd,null));};function getAccessToken(_0x2003fa){return new Promise(function(_0x35ea7f,_0x2d0e0d){var _0x4060ec;switch(_0x2003fa[_0x53b9('0x59')]){case'US':_0x4060ec=_0x53b9('0x5a');break;case'AU':_0x4060ec='https://accounts.zoho.com.au';break;case'EU':_0x4060ec=_0x53b9('0x5b');break;case'IN':_0x4060ec=_0x53b9('0x5c');break;case'CN':_0x4060ec=_0x53b9('0x5d');break;default:_0x4060ec=_0x53b9('0x5b');break;}var _0x38a50b={'method':'POST','uri':_0x4060ec+_0x53b9('0x5e'),'qs':{'refresh_token':_0x2003fa[_0x53b9('0x5f')],'client_id':_0x2003fa[_0x53b9('0x60')],'client_secret':_0x2003fa[_0x53b9('0x61')],'grant_type':_0x53b9('0x62')},'json':!![]};return rp(_0x38a50b)['then'](function(_0x37faf8){if(_0x37faf8['access_token']){_0x35ea7f(_0x37faf8[_0x53b9('0x63')]);}else{_0x2d0e0d('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x53b9('0x48')](function(_0x198821){_0x2d0e0d(_0x198821);});});}exports['getFields']=function(_0x404e78,_0x1c5f4b,_0x3b881){var _0x28191b,_0x17a424,_0x28a89f,_0x261a0a,_0x20ac7d;return db[_0x53b9('0x2c')][_0x53b9('0x4c')]({'where':{'id':_0x404e78[_0x53b9('0x44')]['id']},'attributes':['id',_0x53b9('0x64'),_0x53b9('0x59'),_0x53b9('0x60'),'clientSecret',_0x53b9('0x65'),_0x53b9('0x66'),_0x53b9('0x5f')]})[_0x53b9('0x26')](handleEntityNotFound(_0x1c5f4b,null))[_0x53b9('0x26')](function(_0x2af6a5){_0x20ac7d=_0x2af6a5;_0x28191b=_0x20ac7d[_0x53b9('0x64')];_0x17a424=_0x28191b===_0x53b9('0x67')?'eu':_0x53b9('0x68');_0x28a89f=_0x20ac7d[_0x53b9('0x65')];var _0x2fb24f=_0x28a89f[_0x53b9('0x69')](-0x1);if(_0x2fb24f==='/'||_0x2fb24f==='\x5c'||_0x2fb24f===':'){_0x28a89f=_0x28a89f[_0x53b9('0x6a')](0x0,_0x28a89f[_0x53b9('0x6b')](_0x2fb24f));}if(!_0x20ac7d[_0x53b9('0x5f')]){throw new Error(_0x53b9('0x6c'));}return getAccessToken(_0x20ac7d);})['then'](function(_0x186f5f){if(_0x186f5f){return rp({'method':_0x53b9('0x6d'),'uri':util[_0x53b9('0x6e')](_0x53b9('0x6f'),_0x17a424),'qs':{'module':_0x53b9('0x70')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x186f5f},'json':!![]});}})[_0x53b9('0x26')](function(_0x1500ec){if(_0x1500ec){if(_0x1500ec[_0x53b9('0x71')]&&_0x1500ec[_0x53b9('0x71')][_0x53b9('0x27')]){throw new Error(_0x1500ec[_0x53b9('0x71')][_0x53b9('0x27')][_0x53b9('0x72')]);}var _0x823488=[];var _0x6e7438=[];var _0x246c14=[_0x53b9('0x73'),_0x53b9('0x74'),_0x53b9('0x75'),_0x53b9('0x76'),_0x53b9('0x77'),_0x53b9('0x78'),'Call_Start_Time',_0x53b9('0x79')];_0x6e7438=_[_0x53b9('0x7a')](_0x1500ec[_0x53b9('0x34')],function(_0x1099c5){return _0x246c14[_0x53b9('0x7b')](_0x1099c5[_0x53b9('0x7c')]);});for(var _0x591529=0x0;_0x591529<_0x6e7438[_0x53b9('0x35')];_0x591529++){if(_0x6e7438[_0x591529]['system_mandatory']===![]){_0x823488[_0x53b9('0x7d')]({'id':_0x6e7438[_0x591529]['id'],'name':_0x6e7438[_0x591529][_0x53b9('0x7e')],'custom':_0x6e7438[_0x591529]['custom_field'],'options':_0x6e7438[_0x591529][_0x53b9('0x7f')]===_0x53b9('0x80')&&_0x6e7438[_0x591529][_0x53b9('0x81')][_0x53b9('0x35')]>-0x1?_[_0x53b9('0x2b')](_0x6e7438[_0x591529][_0x53b9('0x81')],function(_0x3acbaa){return{'name':_0x3acbaa,'value':_0x3acbaa};}):[]});}}return{'count':_0x823488['length'],'rows':_0x823488};}else{return{'count':0x0,'rows':[]};}})[_0x53b9('0x26')](respondWithResult(_0x1c5f4b,null))[_0x53b9('0x48')](function(_0xf765df){var _0x147b0a=_0x404e78[_0x53b9('0x30')][_0x53b9('0x82')]?0x1f4:_0xf765df[_0x53b9('0x83')]||0x1f4;logger[_0x53b9('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x53b9('0x84'),_0x147b0a,JSON[_0x53b9('0x85')](_0xf765df));delete _0xf765df[_0x53b9('0x29')];if(_0x147b0a===0x191){_0x147b0a=0x190;}_0x1c5f4b[_0x53b9('0x21')](_0x147b0a)[_0x53b9('0x2a')](_0x404e78[_0x53b9('0x30')][_0x53b9('0x82')]?{'message':'Wrong\x20credentials','statusCode':_0xf765df['statusCode']}:_0xf765df);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c275fe0..77ac17a 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 _0x8c17=['lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.com.cn','application/x-www-form-urlencoded','parse','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','refreshToken','refresh_token','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','catch'];(function(_0x559cfd,_0x48c74f){var _0x43a5b1=function(_0x12218c){while(--_0x12218c){_0x559cfd['push'](_0x559cfd['shift']());}};_0x43a5b1(++_0x48c74f);}(_0x8c17,0xd7));var _0x78c1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8c17[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x78c1('0x0'))(_0x78c1('0x1'));var moment=require(_0x78c1('0x2'));var BPromise=require(_0x78c1('0x3'));var rp=require(_0x78c1('0x4'));var fs=require('fs');var path=require(_0x78c1('0x5'));var rimraf=require(_0x78c1('0x6'));var config=require(_0x78c1('0x7'));var attributes=require(_0x78c1('0x8'));var integrations=require(_0x78c1('0x9'));module['exports']=function(_0x184b62,_0x40f828){return _0x184b62[_0x78c1('0xa')]('ZohoAccount',attributes,{'tableName':_0x78c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3602d5,_0xd99683,_0x4287dd){if(_0x3602d5[_0x78c1('0xc')]('zone')||_0x3602d5[_0x78c1('0xc')](_0x78c1('0xd'))||_0x3602d5[_0x78c1('0xc')](_0x78c1('0xe'))||_0x3602d5[_0x78c1('0xc')](_0x78c1('0xf'))||_0x3602d5['changed'](_0x78c1('0x10'))||_0x3602d5[_0x78c1('0xc')](_0x78c1('0x11'))){var _0x2fc009,_0x274445;_0x2fc009=_0x3602d5['serverUrl'];var _0x76e078=_0x2fc009[_0x78c1('0x12')](-0x1);if(_0x76e078==='/'||_0x76e078==='\x5c'||_0x76e078===':'){_0x2fc009=_0x2fc009[_0x78c1('0x13')](0x0,_0x2fc009['lastIndexOf'](_0x76e078));}switch(_0x3602d5['zone']){case'US':_0x274445=_0x78c1('0x14');break;case'AU':_0x274445=_0x78c1('0x15');break;case'IN':_0x274445='https://accounts.zoho.in';break;case'CN':_0x274445='https://accounts.zoho.com.cn';break;default:_0x274445=_0x78c1('0x16');break;}var _0x2906f2={'method':_0x78c1('0x17'),'uri':_0x274445+_0x78c1('0x18'),'form':{'grant_type':_0x78c1('0x19'),'client_id':_0x3602d5[_0x78c1('0xe')],'client_secret':_0x3602d5[_0x78c1('0xf')],'redirect_uri':_0x3602d5[_0x78c1('0xd')],'code':_0x3602d5[_0x78c1('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2906f2)[_0x78c1('0x1a')](function(_0x5390e1){var _0x500208=JSON['parse'](_0x5390e1);if(_0x500208['refresh_token']){_0x3602d5[_0x78c1('0x1b')]=_0x500208[_0x78c1('0x1c')];logger[_0x78c1('0x1d')](util[_0x78c1('0x1e')](_0x78c1('0x1f'),_0x3602d5['name'],_0x3602d5['id']));}else{logger[_0x78c1('0x20')](util[_0x78c1('0x1e')](_0x78c1('0x21'),_0x3602d5[_0x78c1('0x22')],_0x3602d5['id']),util[_0x78c1('0x23')](_0x500208,{'showHidden':![],'depth':null}));}return _0x4287dd(null,_0xd99683);})[_0x78c1('0x24')](function(_0x5733e4){logger[_0x78c1('0x20')](util[_0x78c1('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3602d5[_0x78c1('0x22')],_0x3602d5['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4287dd(_0x5733e4);});}else{return _0x4287dd(null,_0xd99683);}},'beforeUpdate':function(_0x2fd93b,_0x1f9117,_0x16c3f5){if(_0x2fd93b['changed']('zone')||_0x2fd93b['changed'](_0x78c1('0xd'))||_0x2fd93b[_0x78c1('0xc')](_0x78c1('0xe'))||_0x2fd93b[_0x78c1('0xc')](_0x78c1('0xf'))||_0x2fd93b[_0x78c1('0xc')]('code')||_0x2fd93b[_0x78c1('0xc')](_0x78c1('0x11'))){var _0x5e83c9,_0x2f30c3;_0x5e83c9=_0x2fd93b[_0x78c1('0xd')];var _0x1adf3e=_0x5e83c9[_0x78c1('0x12')](-0x1);if(_0x1adf3e==='/'||_0x1adf3e==='\x5c'||_0x1adf3e===':'){_0x5e83c9=_0x5e83c9[_0x78c1('0x13')](0x0,_0x5e83c9[_0x78c1('0x25')](_0x1adf3e));}switch(_0x2fd93b['zone']){case'US':_0x2f30c3=_0x78c1('0x14');break;case'AU':_0x2f30c3=_0x78c1('0x15');break;case'IN':_0x2f30c3=_0x78c1('0x26');break;case'CN':_0x2f30c3=_0x78c1('0x27');break;default:_0x2f30c3='https://accounts.zoho.eu';break;}var _0x4b50f0={'method':_0x78c1('0x17'),'uri':_0x2f30c3+_0x78c1('0x18'),'form':{'grant_type':_0x78c1('0x19'),'client_id':_0x2fd93b[_0x78c1('0xe')],'client_secret':_0x2fd93b[_0x78c1('0xf')],'redirect_uri':_0x2fd93b['serverUrl'],'code':_0x2fd93b[_0x78c1('0x10')]},'headers':{'Content-Type':_0x78c1('0x28')}};return rp(_0x4b50f0)[_0x78c1('0x1a')](function(_0x62f6bc){var _0x5e512f=JSON[_0x78c1('0x29')](_0x62f6bc);if(_0x5e512f[_0x78c1('0x1c')]){_0x2fd93b[_0x78c1('0x1b')]=_0x5e512f[_0x78c1('0x1c')];logger['info'](util['format'](_0x78c1('0x1f'),_0x2fd93b['name'],_0x2fd93b['id']));}else{logger[_0x78c1('0x20')](util[_0x78c1('0x1e')](_0x78c1('0x21'),_0x2fd93b['name'],_0x2fd93b['id']),util[_0x78c1('0x23')](_0x5e512f,{'showHidden':![],'depth':null}));}return _0x16c3f5(null,_0x1f9117);})[_0x78c1('0x24')](function(_0xb0bd45){logger[_0x78c1('0x20')](util[_0x78c1('0x1e')](_0x78c1('0x21'),_0x2fd93b[_0x78c1('0x22')],_0x2fd93b['id']),util[_0x78c1('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x16c3f5(_0xb0bd45);});}else{return _0x16c3f5(null,_0x1f9117);}}}});}; \ No newline at end of file +var _0x4b3a=['clientId','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.in','util','../../config/logger','api','moment','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','changed','serverUrl','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code'];(function(_0x454f02,_0x32ce79){var _0x3369f7=function(_0x4c455c){while(--_0x4c455c){_0x454f02['push'](_0x454f02['shift']());}};_0x3369f7(++_0x32ce79);}(_0x4b3a,0x16c));var _0xa4b3=function(_0x18fc63,_0x59d474){_0x18fc63=_0x18fc63-0x0;var _0x42d002=_0x4b3a[_0x18fc63];return _0x42d002;};'use strict';var _=require('lodash');var util=require(_0xa4b3('0x0'));var logger=require(_0xa4b3('0x1'))(_0xa4b3('0x2'));var moment=require(_0xa4b3('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4b3('0x4'));var fs=require('fs');var path=require(_0xa4b3('0x5'));var rimraf=require('rimraf');var config=require(_0xa4b3('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xa4b3('0x7'));module[_0xa4b3('0x8')]=function(_0x14d5f5,_0x15e8a4){return _0x14d5f5['define'](_0xa4b3('0x9'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x17a103,_0x5711c9,_0xc4327b){if(_0x17a103[_0xa4b3('0xa')]('zone')||_0x17a103[_0xa4b3('0xa')](_0xa4b3('0xb'))||_0x17a103[_0xa4b3('0xa')]('clientId')||_0x17a103[_0xa4b3('0xa')](_0xa4b3('0xc'))||_0x17a103['changed'](_0xa4b3('0xd'))||_0x17a103[_0xa4b3('0xa')](_0xa4b3('0xe'))){var _0x4b06d5,_0x5e7b88;_0x4b06d5=_0x17a103[_0xa4b3('0xb')];var _0x133678=_0x4b06d5[_0xa4b3('0xf')](-0x1);if(_0x133678==='/'||_0x133678==='\x5c'||_0x133678===':'){_0x4b06d5=_0x4b06d5[_0xa4b3('0x10')](0x0,_0x4b06d5[_0xa4b3('0x11')](_0x133678));}switch(_0x17a103[_0xa4b3('0x12')]){case'US':_0x5e7b88=_0xa4b3('0x13');break;case'AU':_0x5e7b88=_0xa4b3('0x14');break;case'IN':_0x5e7b88='https://accounts.zoho.in';break;case'CN':_0x5e7b88=_0xa4b3('0x15');break;default:_0x5e7b88=_0xa4b3('0x16');break;}var _0x101494={'method':_0xa4b3('0x17'),'uri':_0x5e7b88+_0xa4b3('0x18'),'form':{'grant_type':_0xa4b3('0x19'),'client_id':_0x17a103[_0xa4b3('0x1a')],'client_secret':_0x17a103[_0xa4b3('0xc')],'redirect_uri':_0x17a103[_0xa4b3('0xb')],'code':_0x17a103['code']},'headers':{'Content-Type':_0xa4b3('0x1b')}};return rp(_0x101494)[_0xa4b3('0x1c')](function(_0x8fa9ff){var _0x30489b=JSON['parse'](_0x8fa9ff);if(_0x30489b[_0xa4b3('0x1d')]){_0x17a103[_0xa4b3('0x1e')]=_0x30489b[_0xa4b3('0x1d')];logger[_0xa4b3('0x1f')](util[_0xa4b3('0x20')](_0xa4b3('0x21'),_0x17a103[_0xa4b3('0x22')],_0x17a103['id']));}else{logger[_0xa4b3('0x23')](util[_0xa4b3('0x20')](_0xa4b3('0x24'),_0x17a103[_0xa4b3('0x22')],_0x17a103['id']),util[_0xa4b3('0x25')](_0x30489b,{'showHidden':![],'depth':null}));}return _0xc4327b(null,_0x5711c9);})['catch'](function(_0x10e493){logger[_0xa4b3('0x23')](util[_0xa4b3('0x20')](_0xa4b3('0x24'),_0x17a103[_0xa4b3('0x22')],_0x17a103['id']),util[_0xa4b3('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0xc4327b(_0x10e493);});}else{return _0xc4327b(null,_0x5711c9);}},'beforeUpdate':function(_0x3e15d0,_0xd50d99,_0x742efd){if(_0x3e15d0[_0xa4b3('0xa')](_0xa4b3('0x12'))||_0x3e15d0['changed'](_0xa4b3('0xb'))||_0x3e15d0['changed'](_0xa4b3('0x1a'))||_0x3e15d0['changed']('clientSecret')||_0x3e15d0[_0xa4b3('0xa')]('code')||_0x3e15d0['changed']('host')){var _0xab15fd,_0x45d73f;_0xab15fd=_0x3e15d0['serverUrl'];var _0x2ef2cf=_0xab15fd['slice'](-0x1);if(_0x2ef2cf==='/'||_0x2ef2cf==='\x5c'||_0x2ef2cf===':'){_0xab15fd=_0xab15fd['substring'](0x0,_0xab15fd[_0xa4b3('0x11')](_0x2ef2cf));}switch(_0x3e15d0['zone']){case'US':_0x45d73f=_0xa4b3('0x13');break;case'AU':_0x45d73f='https://accounts.zoho.com.au';break;case'IN':_0x45d73f=_0xa4b3('0x26');break;case'CN':_0x45d73f=_0xa4b3('0x15');break;default:_0x45d73f=_0xa4b3('0x16');break;}var _0x13c334={'method':_0xa4b3('0x17'),'uri':_0x45d73f+_0xa4b3('0x18'),'form':{'grant_type':_0xa4b3('0x19'),'client_id':_0x3e15d0['clientId'],'client_secret':_0x3e15d0[_0xa4b3('0xc')],'redirect_uri':_0x3e15d0[_0xa4b3('0xb')],'code':_0x3e15d0[_0xa4b3('0xd')]},'headers':{'Content-Type':_0xa4b3('0x1b')}};return rp(_0x13c334)[_0xa4b3('0x1c')](function(_0x29bc92){var _0x438aa8=JSON['parse'](_0x29bc92);if(_0x438aa8[_0xa4b3('0x1d')]){_0x3e15d0['refreshToken']=_0x438aa8[_0xa4b3('0x1d')];logger['info'](util[_0xa4b3('0x20')](_0xa4b3('0x21'),_0x3e15d0[_0xa4b3('0x22')],_0x3e15d0['id']));}else{logger['error'](util[_0xa4b3('0x20')](_0xa4b3('0x24'),_0x3e15d0[_0xa4b3('0x22')],_0x3e15d0['id']),util['inspect'](_0x438aa8,{'showHidden':![],'depth':null}));}return _0x742efd(null,_0xd50d99);})['catch'](function(_0x2a7c3e){logger['error'](util[_0xa4b3('0x20')](_0xa4b3('0x24'),_0x3e15d0['name'],_0x3e15d0['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x742efd(_0x2a7c3e);});}else{return _0x742efd(null,_0xd50d99);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 13dfc4f..da0f00d 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 _0xd5f9=['limit','map','include','model','ShowZohoAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes'];(function(_0x378487,_0x1fdc2c){var _0x3bb63b=function(_0x38c2e0){while(--_0x38c2e0){_0x378487['push'](_0x378487['shift']());}};_0x3bb63b(++_0x1fdc2c);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x553c2a,_0x592c23){_0x553c2a=_0x553c2a-0x0;var _0x37988b=_0xd5f9[_0x553c2a];return _0x37988b;};'use strict';var _=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var moment=require(_0x9d5f('0x2'));var BPromise=require(_0x9d5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d5f('0x4'));var db=require(_0x9d5f('0x5'))['db'];var utils=require(_0x9d5f('0x6'));var logger=require(_0x9d5f('0x7'))(_0x9d5f('0x8'));var config=require(_0x9d5f('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dca4b,_0x2e1c4e,_0x4ac60a){return new BPromise(function(_0x402a35,_0x255389){return client['request'](_0x1dca4b,_0x4ac60a)[_0x9d5f('0xa')](function(_0x241166){logger['info'](_0x9d5f('0xb'),_0x2e1c4e,'request\x20sent');logger[_0x9d5f('0xc')](_0x9d5f('0xd'),_0x2e1c4e,_0x9d5f('0xe'),JSON[_0x9d5f('0xf')](_0x241166));if(_0x241166[_0x9d5f('0x10')]){if(_0x241166['error'][_0x9d5f('0x11')]===0x1f4){logger[_0x9d5f('0x10')](_0x9d5f('0xb'),_0x2e1c4e,_0x241166[_0x9d5f('0x10')][_0x9d5f('0x12')]);return _0x255389(_0x241166[_0x9d5f('0x10')][_0x9d5f('0x12')]);}logger[_0x9d5f('0x10')](_0x9d5f('0xb'),_0x2e1c4e,_0x241166['error']['message']);return _0x402a35(_0x241166['error']['message']);}else{logger[_0x9d5f('0x13')](_0x9d5f('0xb'),_0x2e1c4e,'request\x20sent');_0x402a35(_0x241166[_0x9d5f('0x14')][_0x9d5f('0x12')]);}})[_0x9d5f('0x15')](function(_0x3a9220){logger[_0x9d5f('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x2e1c4e,_0x3a9220);_0x255389(_0x3a9220);});});}exports[_0x9d5f('0x16')]=function(_0x463c1e){var _0xbfb436=this;return new Promise(function(_0x31ba0a,_0x3118ca){return db[_0x9d5f('0x17')][_0x9d5f('0x18')]({'raw':_0x463c1e['options']?_0x463c1e[_0x9d5f('0x19')][_0x9d5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x463c1e[_0x9d5f('0x19')]?_0x463c1e['options']['where']||null:null,'attributes':_0x463c1e[_0x9d5f('0x19')]?_0x463c1e[_0x9d5f('0x19')][_0x9d5f('0x1b')]||null:null,'limit':_0x463c1e[_0x9d5f('0x19')]?_0x463c1e['options'][_0x9d5f('0x1c')]||null:null,'include':_0x463c1e['options']?_0x463c1e[_0x9d5f('0x19')]['include']?_[_0x9d5f('0x1d')](_0x463c1e[_0x9d5f('0x19')][_0x9d5f('0x1e')],function(_0xfb3e00){return{'model':db[_0xfb3e00[_0x9d5f('0x1f')]],'as':_0xfb3e00['as'],'attributes':_0xfb3e00['attributes'],'include':_0xfb3e00[_0x9d5f('0x1e')]?_[_0x9d5f('0x1d')](_0xfb3e00['include'],function(_0x2a032a){return{'model':db[_0x2a032a[_0x9d5f('0x1f')]],'as':_0x2a032a['as'],'attributes':_0x2a032a[_0x9d5f('0x1b')],'include':_0x2a032a[_0x9d5f('0x1e')]?_[_0x9d5f('0x1d')](_0x2a032a['include'],function(_0x209f7b){return{'model':db[_0x209f7b[_0x9d5f('0x1f')]],'as':_0x209f7b['as'],'attributes':_0x209f7b[_0x9d5f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f8281){logger['info'](_0x9d5f('0x16'),_0x463c1e);logger[_0x9d5f('0xc')]('GetZohoAccount',_0x463c1e,JSON[_0x9d5f('0xf')](_0x5f8281));_0x31ba0a(_0x5f8281);})[_0x9d5f('0x15')](function(_0x3def92){logger['error']('GetZohoAccount',_0x3def92['message'],_0x463c1e);_0x3118ca(_0xbfb436[_0x9d5f('0x10')](0x1f4,_0x3def92[_0x9d5f('0x12')]));});});};exports[_0x9d5f('0x20')]=function(_0x4fafae){var _0x332191=this;return new Promise(function(_0x4c15e4,_0x540ec){return db[_0x9d5f('0x17')][_0x9d5f('0x21')]({'raw':_0x4fafae[_0x9d5f('0x19')]?_0x4fafae[_0x9d5f('0x19')][_0x9d5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x4fafae['options']?_0x4fafae[_0x9d5f('0x19')][_0x9d5f('0x22')]||null:null,'attributes':_0x4fafae[_0x9d5f('0x19')]?_0x4fafae['options']['attributes']||null:null,'include':_0x4fafae[_0x9d5f('0x19')]?_0x4fafae[_0x9d5f('0x19')][_0x9d5f('0x1e')]?_[_0x9d5f('0x1d')](_0x4fafae[_0x9d5f('0x19')][_0x9d5f('0x1e')],function(_0x23de5a){return{'model':db[_0x23de5a[_0x9d5f('0x1f')]],'as':_0x23de5a['as'],'attributes':_0x23de5a[_0x9d5f('0x1b')],'include':_0x23de5a[_0x9d5f('0x1e')]?_[_0x9d5f('0x1d')](_0x23de5a[_0x9d5f('0x1e')],function(_0x1ee626){return{'model':db[_0x1ee626[_0x9d5f('0x1f')]],'as':_0x1ee626['as'],'attributes':_0x1ee626[_0x9d5f('0x1b')],'include':_0x1ee626[_0x9d5f('0x1e')]?_[_0x9d5f('0x1d')](_0x1ee626[_0x9d5f('0x1e')],function(_0x215ec8){return{'model':db[_0x215ec8[_0x9d5f('0x1f')]],'as':_0x215ec8['as'],'attributes':_0x215ec8[_0x9d5f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f4c39){logger[_0x9d5f('0x13')](_0x9d5f('0x20'),_0x4fafae);logger[_0x9d5f('0xc')](_0x9d5f('0x20'),_0x4fafae,JSON[_0x9d5f('0xf')](_0x5f4c39));_0x4c15e4(_0x5f4c39);})['catch'](function(_0x5548d6){logger[_0x9d5f('0x10')]('ShowZohoAccount',_0x5548d6[_0x9d5f('0x12')],_0x4fafae);_0x540ec(_0x332191['error'](0x1f4,_0x5548d6[_0x9d5f('0x12')]));});});}; \ No newline at end of file +var _0x0760=['GetZohoAccount','catch','ShowZohoAccount','find','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','info'];(function(_0x2ed12b,_0x482aeb){var _0x3abe98=function(_0x450ea0){while(--_0x450ea0){_0x2ed12b['push'](_0x2ed12b['shift']());}};_0x3abe98(++_0x482aeb);}(_0x0760,0xa9));var _0x0076=function(_0x1fd88b,_0x520877){_0x1fd88b=_0x1fd88b-0x0;var _0x1f996d=_0x0760[_0x1fd88b];return _0x1f996d;};'use strict';var _=require(_0x0076('0x0'));var util=require('util');var moment=require(_0x0076('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0076('0x2'))['db'];var utils=require(_0x0076('0x3'));var logger=require(_0x0076('0x4'))(_0x0076('0x5'));var config=require(_0x0076('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0076('0x7')][_0x0076('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b7f29,_0x9b8b1a,_0x1d61d6){return new BPromise(function(_0x5b4c91,_0x411b4b){return client['request'](_0x1b7f29,_0x1d61d6)[_0x0076('0x9')](function(_0x31ad28){logger['info'](_0x0076('0xa'),_0x9b8b1a,_0x0076('0xb'));logger[_0x0076('0xc')](_0x0076('0xd'),_0x9b8b1a,_0x0076('0xb'),JSON[_0x0076('0xe')](_0x31ad28));if(_0x31ad28['error']){if(_0x31ad28[_0x0076('0xf')][_0x0076('0x10')]===0x1f4){logger[_0x0076('0xf')](_0x0076('0xa'),_0x9b8b1a,_0x31ad28[_0x0076('0xf')][_0x0076('0x11')]);return _0x411b4b(_0x31ad28[_0x0076('0xf')][_0x0076('0x11')]);}logger[_0x0076('0xf')](_0x0076('0xa'),_0x9b8b1a,_0x31ad28[_0x0076('0xf')]['message']);return _0x5b4c91(_0x31ad28[_0x0076('0xf')]['message']);}else{logger['info'](_0x0076('0xa'),_0x9b8b1a,_0x0076('0xb'));_0x5b4c91(_0x31ad28['result'][_0x0076('0x11')]);}})['catch'](function(_0x2ff722){logger[_0x0076('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x9b8b1a,_0x2ff722);_0x411b4b(_0x2ff722);});});}exports['GetZohoAccount']=function(_0x5761a4){var _0xc0a663=this;return new Promise(function(_0x30fb20,_0x1fb63f){return db[_0x0076('0x12')][_0x0076('0x13')]({'raw':_0x5761a4[_0x0076('0x14')]?_0x5761a4[_0x0076('0x14')][_0x0076('0x15')]===undefined?!![]:![]:!![],'where':_0x5761a4[_0x0076('0x14')]?_0x5761a4[_0x0076('0x14')][_0x0076('0x16')]||null:null,'attributes':_0x5761a4[_0x0076('0x14')]?_0x5761a4[_0x0076('0x14')][_0x0076('0x17')]||null:null,'limit':_0x5761a4['options']?_0x5761a4[_0x0076('0x14')][_0x0076('0x18')]||null:null,'include':_0x5761a4[_0x0076('0x14')]?_0x5761a4['options'][_0x0076('0x19')]?_[_0x0076('0x1a')](_0x5761a4[_0x0076('0x14')][_0x0076('0x19')],function(_0x250f57){return{'model':db[_0x250f57['model']],'as':_0x250f57['as'],'attributes':_0x250f57[_0x0076('0x17')],'include':_0x250f57[_0x0076('0x19')]?_[_0x0076('0x1a')](_0x250f57[_0x0076('0x19')],function(_0x2c7def){return{'model':db[_0x2c7def[_0x0076('0x1b')]],'as':_0x2c7def['as'],'attributes':_0x2c7def['attributes'],'include':_0x2c7def[_0x0076('0x19')]?_[_0x0076('0x1a')](_0x2c7def[_0x0076('0x19')],function(_0x187827){return{'model':db[_0x187827[_0x0076('0x1b')]],'as':_0x187827['as'],'attributes':_0x187827['attributes']};}):[]};}):[]};}):[]:[]})[_0x0076('0x9')](function(_0x712db9){logger[_0x0076('0x1c')](_0x0076('0x1d'),_0x5761a4);logger[_0x0076('0xc')](_0x0076('0x1d'),_0x5761a4,JSON[_0x0076('0xe')](_0x712db9));_0x30fb20(_0x712db9);})[_0x0076('0x1e')](function(_0x2bc8b7){logger[_0x0076('0xf')]('GetZohoAccount',_0x2bc8b7[_0x0076('0x11')],_0x5761a4);_0x1fb63f(_0xc0a663[_0x0076('0xf')](0x1f4,_0x2bc8b7[_0x0076('0x11')]));});});};exports[_0x0076('0x1f')]=function(_0x365049){var _0x501b23=this;return new Promise(function(_0x522273,_0x170881){return db[_0x0076('0x12')][_0x0076('0x20')]({'raw':_0x365049[_0x0076('0x14')]?_0x365049['options']['raw']===undefined?!![]:![]:!![],'where':_0x365049[_0x0076('0x14')]?_0x365049[_0x0076('0x14')][_0x0076('0x16')]||null:null,'attributes':_0x365049['options']?_0x365049[_0x0076('0x14')][_0x0076('0x17')]||null:null,'include':_0x365049[_0x0076('0x14')]?_0x365049[_0x0076('0x14')][_0x0076('0x19')]?_[_0x0076('0x1a')](_0x365049[_0x0076('0x14')][_0x0076('0x19')],function(_0x15cdc8){return{'model':db[_0x15cdc8[_0x0076('0x1b')]],'as':_0x15cdc8['as'],'attributes':_0x15cdc8[_0x0076('0x17')],'include':_0x15cdc8['include']?_[_0x0076('0x1a')](_0x15cdc8[_0x0076('0x19')],function(_0x308515){return{'model':db[_0x308515[_0x0076('0x1b')]],'as':_0x308515['as'],'attributes':_0x308515[_0x0076('0x17')],'include':_0x308515[_0x0076('0x19')]?_[_0x0076('0x1a')](_0x308515['include'],function(_0x3012ff){return{'model':db[_0x3012ff[_0x0076('0x1b')]],'as':_0x3012ff['as'],'attributes':_0x3012ff[_0x0076('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0076('0x9')](function(_0x4a4cff){logger[_0x0076('0x1c')]('ShowZohoAccount',_0x365049);logger[_0x0076('0xc')](_0x0076('0x1f'),_0x365049,JSON[_0x0076('0xe')](_0x4a4cff));_0x522273(_0x4a4cff);})[_0x0076('0x1e')](function(_0x3ac727){logger[_0x0076('0xf')](_0x0076('0x1f'),_0x3ac727[_0x0076('0x11')],_0x365049);_0x170881(_0x501b23[_0x0076('0xf')](0x1f4,_0x3ac727[_0x0076('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 88426ad..d416cb9 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 _0x09c9=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','index','get','show','isAuthenticated','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','delete','destroy','exports','util','path'];(function(_0x5a5d12,_0x52753c){var _0x160411=function(_0x3ce59e){while(--_0x3ce59e){_0x5a5d12['push'](_0x5a5d12['shift']());}};_0x160411(++_0x52753c);}(_0x09c9,0x18a));var _0x909c=function(_0x24262c,_0x5e4958){_0x24262c=_0x24262c-0x0;var _0x170cd8=_0x09c9[_0x24262c];return _0x170cd8;};'use strict';var multer=require('multer');var util=require(_0x909c('0x0'));var path=require(_0x909c('0x1'));var timeout=require(_0x909c('0x2'));var express=require('express');var router=express[_0x909c('0x3')]();var fs_extra=require(_0x909c('0x4'));var auth=require(_0x909c('0x5'));var interaction=require(_0x909c('0x6'));var config=require('../../config/environment');var controller=require(_0x909c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x909c('0x8')]);router[_0x909c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x909c('0xa')]);router[_0x909c('0x9')]('/:id/fields',auth[_0x909c('0xb')](),controller[_0x909c('0xc')]);router[_0x909c('0x9')]('/:id/subjects',auth[_0x909c('0xb')](),controller[_0x909c('0xd')]);router['get'](_0x909c('0xe'),auth[_0x909c('0xb')](),controller[_0x909c('0xf')]);router['post']('/',auth[_0x909c('0xb')](),controller[_0x909c('0x10')]);router[_0x909c('0x11')](_0x909c('0x12'),auth[_0x909c('0xb')](),controller['update']);router[_0x909c('0x13')](_0x909c('0x12'),auth['isAuthenticated'](),controller[_0x909c('0x14')]);module[_0x909c('0x15')]=router; \ No newline at end of file +var _0x94d1=['getDescriptions','post','create','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects'];(function(_0x49dd96,_0x239f63){var _0x560512=function(_0x1cff49){while(--_0x1cff49){_0x49dd96['push'](_0x49dd96['shift']());}};_0x560512(++_0x239f63);}(_0x94d1,0xb6));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x194d('0x0'));var timeout=require(_0x194d('0x1'));var express=require(_0x194d('0x2'));var router=express[_0x194d('0x3')]();var fs_extra=require(_0x194d('0x4'));var auth=require(_0x194d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x194d('0x6'));var controller=require(_0x194d('0x7'));router[_0x194d('0x8')]('/',auth[_0x194d('0x9')](),controller[_0x194d('0xa')]);router['get'](_0x194d('0xb'),auth['isAuthenticated'](),controller[_0x194d('0xc')]);router['get'](_0x194d('0xd'),auth[_0x194d('0x9')](),controller[_0x194d('0xe')]);router[_0x194d('0x8')]('/:id/subjects',auth[_0x194d('0x9')](),controller[_0x194d('0xf')]);router[_0x194d('0x8')]('/:id/descriptions',auth[_0x194d('0x9')](),controller[_0x194d('0x10')]);router[_0x194d('0x11')]('/',auth[_0x194d('0x9')](),controller[_0x194d('0x12')]);router['put'](_0x194d('0xb'),auth[_0x194d('0x9')](),controller['update']);router[_0x194d('0x13')]('/:id',auth[_0x194d('0x9')](),controller[_0x194d('0x14')]);module[_0x194d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 63c161a..874bd35 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 _0xe9a6=['nothing','contact_lead','sequelize','STRING','ENUM','lead','contact'];(function(_0x5e6bec,_0x1eb54d){var _0x5dc5cf=function(_0x59429a){while(--_0x59429a){_0x5e6bec['push'](_0x5e6bec['shift']());}};_0x5dc5cf(++_0x1eb54d);}(_0xe9a6,0x64));var _0x6e9a=function(_0x3839fd,_0x42db51){_0x3839fd=_0x3839fd-0x0;var _0x2ad001=_0xe9a6[_0x3839fd];return _0x2ad001;};'use strict';var Sequelize=require(_0x6e9a('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e9a('0x1')]},'moduleCreate':{'type':Sequelize[_0x6e9a('0x2')](_0x6e9a('0x3'),_0x6e9a('0x4'),_0x6e9a('0x5')),'defaultValue':_0x6e9a('0x3')},'moduleSearch':{'type':Sequelize[_0x6e9a('0x2')](_0x6e9a('0x6'),'contact','lead'),'defaultValue':_0x6e9a('0x6')},'description':{'type':Sequelize[_0x6e9a('0x1')]}}; \ No newline at end of file +var _0x5e93=['lead','contact','nothing','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5e93,0x174));var _0x35e9=function(_0x1dd595,_0x4e1102){_0x1dd595=_0x1dd595-0x0;var _0x2d3865=_0x5e93[_0x1dd595];return _0x2d3865;};'use strict';var Sequelize=require(_0x35e9('0x0'));module[_0x35e9('0x1')]={'name':{'type':Sequelize[_0x35e9('0x2')]},'moduleCreate':{'type':Sequelize[_0x35e9('0x3')](_0x35e9('0x4'),_0x35e9('0x5'),_0x35e9('0x6')),'defaultValue':_0x35e9('0x4')},'moduleSearch':{'type':Sequelize[_0x35e9('0x3')](_0x35e9('0x7'),_0x35e9('0x5'),_0x35e9('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x35e9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index ca2ef2d..b5492e3 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 _0x3a13=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','create','ZohoConfiguration','update','body','find','findOne','ZohoField','order','sort','nolimit','getSubjects','getDescriptions','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','reject','save','then','destroy','end','error','name','map','rawAttributes','fieldName','type'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x3a13,0x152));var _0x33a1=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x3a13[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0x33a1('0x0'));var rimraf=require(_0x33a1('0x1'));var zipdir=require(_0x33a1('0x2'));var jsonpatch=require(_0x33a1('0x3'));var rp=require('request-promise');var moment=require(_0x33a1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x33a1('0x5'));var path=require(_0x33a1('0x6'));var sox=require(_0x33a1('0x7'));var csv=require(_0x33a1('0x8'));var ejs=require(_0x33a1('0x9'));var fs=require('fs');var fs_extra=require(_0x33a1('0xa'));var _=require(_0x33a1('0xb'));var squel=require(_0x33a1('0xc'));var crypto=require('crypto');var jsforce=require(_0x33a1('0xd'));var deskjs=require(_0x33a1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x33a1('0xf'));var Papa=require(_0x33a1('0x10'));var Redis=require(_0x33a1('0x11'));var authService=require(_0x33a1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x33a1('0x13'));var hardwareService=require(_0x33a1('0x14'));var logger=require(_0x33a1('0x15'))('api');var utils=require(_0x33a1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x33a1('0x17'));var db=require(_0x33a1('0x18'))['db'];function respondWithStatusCode(_0x41ae2c,_0x5e857f){_0x5e857f=_0x5e857f||0xcc;return function(_0x4657ca){if(_0x4657ca){return _0x41ae2c[_0x33a1('0x19')](_0x5e857f);}return _0x41ae2c[_0x33a1('0x1a')](_0x5e857f)['end']();};}function respondWithResult(_0x4b8b50,_0x35d5c){_0x35d5c=_0x35d5c||0xc8;return function(_0x3937df){if(_0x3937df){return _0x4b8b50[_0x33a1('0x1a')](_0x35d5c)['json'](_0x3937df);}};}function respondWithFilteredResult(_0x1fb384,_0x42b50b){return function(_0x8e9612){if(_0x8e9612){var _0x3558b0=typeof _0x42b50b[_0x33a1('0x1b')]==='undefined'&&typeof _0x42b50b['limit']===_0x33a1('0x1c');var _0x22b2a5=_0x8e9612[_0x33a1('0x1d')];var _0x305203=_0x3558b0?0x0:_0x42b50b['offset'];var _0x50895c=_0x3558b0?_0x8e9612[_0x33a1('0x1d')]:_0x42b50b[_0x33a1('0x1b')]+_0x42b50b[_0x33a1('0x1e')];var _0x4c3ffe;if(_0x50895c>=_0x22b2a5){_0x50895c=_0x22b2a5;_0x4c3ffe=0xc8;}else{_0x4c3ffe=0xce;}_0x1fb384[_0x33a1('0x1a')](_0x4c3ffe);return _0x1fb384['set']('Content-Range',_0x305203+'-'+_0x50895c+'/'+_0x22b2a5)['json'](_0x8e9612);}return null;};}function patchUpdates(_0x147a18){return function(_0x43ed81){try{jsonpatch['apply'](_0x43ed81,_0x147a18,!![]);}catch(_0x11a90c){return BPromise[_0x33a1('0x1f')](_0x11a90c);}return _0x43ed81[_0x33a1('0x20')]();};}function saveUpdates(_0x64dd50,_0x1e7d28){return function(_0x4cf927){if(_0x4cf927){return _0x4cf927['update'](_0x64dd50)[_0x33a1('0x21')](function(_0x1c550e){return _0x1c550e;});}return null;};}function removeEntity(_0x3f55be,_0x4ef574){return function(_0x2f4407){if(_0x2f4407){return _0x2f4407[_0x33a1('0x22')]()[_0x33a1('0x21')](function(){_0x3f55be['status'](0xcc)[_0x33a1('0x23')]();});}};}function handleEntityNotFound(_0x2f65a7,_0x5a9a6e){return function(_0x637917){if(!_0x637917){_0x2f65a7[_0x33a1('0x19')](0x194);}return _0x637917;};}function handleError(_0x536631,_0x7b04dc){_0x7b04dc=_0x7b04dc||0x1f4;return function(_0x592918){logger[_0x33a1('0x24')](_0x592918['stack']);if(_0x592918[_0x33a1('0x25')]){delete _0x592918[_0x33a1('0x25')];}_0x536631['status'](_0x7b04dc)['send'](_0x592918);};}exports['index']=function(_0x3a3b35,_0x385fe0){var _0x5b6575={},_0x430420={},_0x3bd3e9={'count':0x0,'rows':[]};var _0x48085e=_[_0x33a1('0x26')](db['ZohoConfiguration'][_0x33a1('0x27')],function(_0x26eb85){return{'name':_0x26eb85[_0x33a1('0x28')],'type':_0x26eb85[_0x33a1('0x29')][_0x33a1('0x2a')]};});_0x430420[_0x33a1('0x2b')]=_[_0x33a1('0x26')](_0x48085e,_0x33a1('0x25'));_0x430420[_0x33a1('0x2c')]=_['keys'](_0x3a3b35[_0x33a1('0x2c')]);_0x430420[_0x33a1('0x2d')]=_[_0x33a1('0x2e')](_0x430420[_0x33a1('0x2b')],_0x430420[_0x33a1('0x2c')]);_0x5b6575[_0x33a1('0x2f')]=_[_0x33a1('0x2e')](_0x430420[_0x33a1('0x2b')],qs[_0x33a1('0x30')](_0x3a3b35[_0x33a1('0x2c')]['fields']));_0x5b6575['attributes']=_0x5b6575[_0x33a1('0x2f')][_0x33a1('0x31')]?_0x5b6575[_0x33a1('0x2f')]:_0x430420['model'];if(!_0x3a3b35[_0x33a1('0x2c')][_0x33a1('0x32')]('nolimit')){_0x5b6575[_0x33a1('0x1e')]=qs[_0x33a1('0x1e')](_0x3a3b35[_0x33a1('0x2c')][_0x33a1('0x1e')]);_0x5b6575[_0x33a1('0x1b')]=qs[_0x33a1('0x1b')](_0x3a3b35[_0x33a1('0x2c')][_0x33a1('0x1b')]);}_0x5b6575['order']=qs['sort'](_0x3a3b35[_0x33a1('0x2c')]['sort']);_0x5b6575[_0x33a1('0x33')]=qs[_0x33a1('0x2d')](_['pick'](_0x3a3b35[_0x33a1('0x2c')],_0x430420[_0x33a1('0x2d')]),_0x48085e);if(_0x3a3b35[_0x33a1('0x2c')][_0x33a1('0x34')]){_0x5b6575[_0x33a1('0x33')]=_[_0x33a1('0x35')](_0x5b6575[_0x33a1('0x33')],{'$or':_[_0x33a1('0x26')](_0x48085e,function(_0x4e2376){if(_0x4e2376[_0x33a1('0x29')]!==_0x33a1('0x36')){var _0x57bda7={};_0x57bda7[_0x4e2376['name']]={'$like':'%'+_0x3a3b35[_0x33a1('0x2c')][_0x33a1('0x34')]+'%'};return _0x57bda7;}})});}_0x5b6575=_['merge']({},_0x5b6575,_0x3a3b35[_0x33a1('0x37')]);var _0x30b04b={'where':_0x5b6575[_0x33a1('0x33')]};return db['ZohoConfiguration']['count'](_0x30b04b)[_0x33a1('0x21')](function(_0x39900d){_0x3bd3e9[_0x33a1('0x1d')]=_0x39900d;if(_0x3a3b35[_0x33a1('0x2c')]['includeAll']){_0x5b6575[_0x33a1('0x38')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x5b6575);})[_0x33a1('0x21')](function(_0x1baac9){_0x3bd3e9[_0x33a1('0x39')]=_0x1baac9;return _0x3bd3e9;})[_0x33a1('0x21')](respondWithFilteredResult(_0x385fe0,_0x5b6575))[_0x33a1('0x3a')](handleError(_0x385fe0,null));};exports[_0x33a1('0x3b')]=function(_0x441416,_0x24c31b){var _0x287252={'raw':![],'where':{'id':_0x441416[_0x33a1('0x3c')]['id']}},_0x18f971={};_0x18f971['model']=_[_0x33a1('0x3d')](db['ZohoConfiguration']['rawAttributes']);_0x18f971[_0x33a1('0x2c')]=_[_0x33a1('0x3d')](_0x441416[_0x33a1('0x2c')]);_0x18f971[_0x33a1('0x2d')]=_[_0x33a1('0x2e')](_0x18f971[_0x33a1('0x2b')],_0x18f971[_0x33a1('0x2c')]);_0x287252[_0x33a1('0x2f')]=_[_0x33a1('0x2e')](_0x18f971['model'],qs[_0x33a1('0x30')](_0x441416[_0x33a1('0x2c')][_0x33a1('0x30')]));_0x287252['attributes']=_0x287252[_0x33a1('0x2f')][_0x33a1('0x31')]?_0x287252[_0x33a1('0x2f')]:_0x18f971[_0x33a1('0x2b')];if(_0x441416[_0x33a1('0x2c')][_0x33a1('0x3e')]){_0x287252[_0x33a1('0x38')]=[{'all':!![]}];}_0x287252=_['merge']({},_0x287252,_0x441416['options']);return db['ZohoConfiguration']['find'](_0x287252)[_0x33a1('0x21')](handleEntityNotFound(_0x24c31b,null))[_0x33a1('0x21')](respondWithResult(_0x24c31b,null))[_0x33a1('0x3a')](handleError(_0x24c31b,null));};exports[_0x33a1('0x3f')]=function(_0x3a4ca1,_0x4c7197){return db[_0x33a1('0x40')][_0x33a1('0x3f')](_0x3a4ca1['body'],{})['then'](respondWithResult(_0x4c7197,0xc9))[_0x33a1('0x3a')](handleError(_0x4c7197,null));};exports[_0x33a1('0x41')]=function(_0x2a3e93,_0x4c4ee7){if(_0x2a3e93[_0x33a1('0x42')]['id']){delete _0x2a3e93[_0x33a1('0x42')]['id'];}return db[_0x33a1('0x40')][_0x33a1('0x43')]({'where':{'id':_0x2a3e93[_0x33a1('0x3c')]['id']}})[_0x33a1('0x21')](handleEntityNotFound(_0x4c4ee7,null))[_0x33a1('0x21')](saveUpdates(_0x2a3e93['body'],null))[_0x33a1('0x21')](respondWithResult(_0x4c4ee7,null))[_0x33a1('0x3a')](handleError(_0x4c4ee7,null));};exports[_0x33a1('0x22')]=function(_0x154b95,_0x81f245){return db[_0x33a1('0x40')][_0x33a1('0x43')]({'where':{'id':_0x154b95[_0x33a1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x81f245,null))[_0x33a1('0x21')](removeEntity(_0x81f245,null))[_0x33a1('0x3a')](handleError(_0x81f245,null));};exports['getFields']=function(_0x41eaf6,_0x55d02d,_0x4967e2){var _0x2a07d6={};var _0x36105a={};var _0x31f363;var _0x458068;return db['ZohoConfiguration'][_0x33a1('0x44')]({'where':{'id':_0x41eaf6['params']['id']}})['then'](handleEntityNotFound(_0x55d02d,null))[_0x33a1('0x21')](function(_0x5dc996){if(_0x5dc996){_0x31f363=_0x5dc996;_0x36105a['model']=_[_0x33a1('0x3d')](db[_0x33a1('0x45')]['rawAttributes']);_0x36105a['query']=_[_0x33a1('0x3d')](_0x41eaf6[_0x33a1('0x2c')]);_0x36105a[_0x33a1('0x2d')]=_['intersection'](_0x36105a[_0x33a1('0x2b')],_0x36105a[_0x33a1('0x2c')]);_0x2a07d6[_0x33a1('0x2f')]=_[_0x33a1('0x2e')](_0x36105a['model'],qs[_0x33a1('0x30')](_0x41eaf6[_0x33a1('0x2c')][_0x33a1('0x30')]));_0x2a07d6['attributes']=_0x2a07d6['attributes'][_0x33a1('0x31')]?_0x2a07d6[_0x33a1('0x2f')]:_0x36105a['model'];_0x2a07d6[_0x33a1('0x46')]=qs[_0x33a1('0x47')](_0x41eaf6[_0x33a1('0x2c')]['sort']);_0x2a07d6[_0x33a1('0x33')]=qs[_0x33a1('0x2d')](_['pick'](_0x41eaf6[_0x33a1('0x2c')],_0x36105a[_0x33a1('0x2d')]));if(_0x41eaf6[_0x33a1('0x2c')]['filter']){_0x2a07d6[_0x33a1('0x33')]=_[_0x33a1('0x35')](_0x2a07d6[_0x33a1('0x33')],{'$or':_[_0x33a1('0x26')](_0x2a07d6['attributes'],function(_0x5497bc){var _0x19a517={};_0x19a517[_0x5497bc]={'$like':'%'+_0x41eaf6[_0x33a1('0x2c')][_0x33a1('0x34')]+'%'};return _0x19a517;})});}_0x2a07d6=_[_0x33a1('0x35')]({},_0x2a07d6,_0x41eaf6[_0x33a1('0x37')]);return _0x31f363['getFields'](_0x2a07d6);}})[_0x33a1('0x21')](function(_0x29a341){if(_0x29a341){_0x458068=_0x29a341[_0x33a1('0x31')];if(!_0x41eaf6[_0x33a1('0x2c')][_0x33a1('0x32')](_0x33a1('0x48'))){_0x2a07d6['limit']=qs[_0x33a1('0x1e')](_0x41eaf6['query'][_0x33a1('0x1e')]);_0x2a07d6[_0x33a1('0x1b')]=qs['offset'](_0x41eaf6[_0x33a1('0x2c')][_0x33a1('0x1b')]);}return _0x31f363['getFields'](_0x2a07d6);}})[_0x33a1('0x21')](function(_0x32f74b){if(_0x32f74b){return _0x32f74b?{'count':_0x458068,'rows':_0x32f74b}:null;}})['then'](respondWithResult(_0x55d02d,null))[_0x33a1('0x3a')](handleError(_0x55d02d,null));};exports[_0x33a1('0x49')]=function(_0x5094d6,_0x5a1b00,_0x33fedf){var _0x5e4f37={};var _0x2eb37e={};var _0x57d409;var _0x217428;return db['ZohoConfiguration'][_0x33a1('0x44')]({'where':{'id':_0x5094d6[_0x33a1('0x3c')]['id']}})[_0x33a1('0x21')](handleEntityNotFound(_0x5a1b00,null))[_0x33a1('0x21')](function(_0x2df162){if(_0x2df162){_0x57d409=_0x2df162;_0x2eb37e['model']=_[_0x33a1('0x3d')](db[_0x33a1('0x45')]['rawAttributes']);_0x2eb37e[_0x33a1('0x2c')]=_[_0x33a1('0x3d')](_0x5094d6[_0x33a1('0x2c')]);_0x2eb37e[_0x33a1('0x2d')]=_[_0x33a1('0x2e')](_0x2eb37e[_0x33a1('0x2b')],_0x2eb37e[_0x33a1('0x2c')]);_0x5e4f37['attributes']=_[_0x33a1('0x2e')](_0x2eb37e[_0x33a1('0x2b')],qs[_0x33a1('0x30')](_0x5094d6[_0x33a1('0x2c')]['fields']));_0x5e4f37['attributes']=_0x5e4f37['attributes'][_0x33a1('0x31')]?_0x5e4f37[_0x33a1('0x2f')]:_0x2eb37e[_0x33a1('0x2b')];_0x5e4f37[_0x33a1('0x46')]=qs['sort'](_0x5094d6[_0x33a1('0x2c')][_0x33a1('0x47')]);_0x5e4f37[_0x33a1('0x33')]=qs['filters'](_['pick'](_0x5094d6['query'],_0x2eb37e[_0x33a1('0x2d')]));if(_0x5094d6[_0x33a1('0x2c')][_0x33a1('0x34')]){_0x5e4f37[_0x33a1('0x33')]=_[_0x33a1('0x35')](_0x5e4f37[_0x33a1('0x33')],{'$or':_['map'](_0x5e4f37[_0x33a1('0x2f')],function(_0x5efe1e){var _0x35d209={};_0x35d209[_0x5efe1e]={'$like':'%'+_0x5094d6[_0x33a1('0x2c')][_0x33a1('0x34')]+'%'};return _0x35d209;})});}_0x5e4f37=_[_0x33a1('0x35')]({},_0x5e4f37,_0x5094d6[_0x33a1('0x37')]);return _0x57d409[_0x33a1('0x49')](_0x5e4f37);}})['then'](function(_0x1a3b1c){if(_0x1a3b1c){_0x217428=_0x1a3b1c[_0x33a1('0x31')];if(!_0x5094d6[_0x33a1('0x2c')][_0x33a1('0x32')](_0x33a1('0x48'))){_0x5e4f37[_0x33a1('0x1e')]=qs[_0x33a1('0x1e')](_0x5094d6['query']['limit']);_0x5e4f37['offset']=qs[_0x33a1('0x1b')](_0x5094d6['query'][_0x33a1('0x1b')]);}return _0x57d409[_0x33a1('0x49')](_0x5e4f37);}})[_0x33a1('0x21')](function(_0x3d0ab0){if(_0x3d0ab0){return _0x3d0ab0?{'count':_0x217428,'rows':_0x3d0ab0}:null;}})[_0x33a1('0x21')](respondWithResult(_0x5a1b00,null))['catch'](handleError(_0x5a1b00,null));};exports[_0x33a1('0x4a')]=function(_0x4b39db,_0x518a4c,_0x5b1803){var _0x554352={};var _0x442563={};var _0x4f3889;var _0x14b89c;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x4b39db[_0x33a1('0x3c')]['id']}})[_0x33a1('0x21')](handleEntityNotFound(_0x518a4c,null))['then'](function(_0x5e6229){if(_0x5e6229){_0x4f3889=_0x5e6229;_0x442563[_0x33a1('0x2b')]=_[_0x33a1('0x3d')](db[_0x33a1('0x45')][_0x33a1('0x27')]);_0x442563['query']=_[_0x33a1('0x3d')](_0x4b39db[_0x33a1('0x2c')]);_0x442563[_0x33a1('0x2d')]=_[_0x33a1('0x2e')](_0x442563['model'],_0x442563[_0x33a1('0x2c')]);_0x554352[_0x33a1('0x2f')]=_[_0x33a1('0x2e')](_0x442563[_0x33a1('0x2b')],qs[_0x33a1('0x30')](_0x4b39db[_0x33a1('0x2c')][_0x33a1('0x30')]));_0x554352[_0x33a1('0x2f')]=_0x554352[_0x33a1('0x2f')][_0x33a1('0x31')]?_0x554352[_0x33a1('0x2f')]:_0x442563[_0x33a1('0x2b')];_0x554352[_0x33a1('0x46')]=qs['sort'](_0x4b39db['query']['sort']);_0x554352[_0x33a1('0x33')]=qs['filters'](_[_0x33a1('0x4b')](_0x4b39db[_0x33a1('0x2c')],_0x442563[_0x33a1('0x2d')]));if(_0x4b39db['query'][_0x33a1('0x34')]){_0x554352[_0x33a1('0x33')]=_['merge'](_0x554352['where'],{'$or':_[_0x33a1('0x26')](_0x554352['attributes'],function(_0x39c94f){var _0x207a71={};_0x207a71[_0x39c94f]={'$like':'%'+_0x4b39db[_0x33a1('0x2c')]['filter']+'%'};return _0x207a71;})});}_0x554352=_[_0x33a1('0x35')]({},_0x554352,_0x4b39db[_0x33a1('0x37')]);return _0x4f3889['getDescriptions'](_0x554352);}})[_0x33a1('0x21')](function(_0x5b6f85){if(_0x5b6f85){_0x14b89c=_0x5b6f85['length'];if(!_0x4b39db['query']['hasOwnProperty'](_0x33a1('0x48'))){_0x554352['limit']=qs['limit'](_0x4b39db[_0x33a1('0x2c')]['limit']);_0x554352[_0x33a1('0x1b')]=qs[_0x33a1('0x1b')](_0x4b39db[_0x33a1('0x2c')][_0x33a1('0x1b')]);}return _0x4f3889[_0x33a1('0x4a')](_0x554352);}})[_0x33a1('0x21')](function(_0x4732e3){if(_0x4732e3){return _0x4732e3?{'count':_0x14b89c,'rows':_0x4732e3}:null;}})[_0x33a1('0x21')](respondWithResult(_0x518a4c,null))[_0x33a1('0x3a')](handleError(_0x518a4c,null));}; \ No newline at end of file +var _0xb381=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','zip-dir','request-promise','moment','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys'];(function(_0x418ca7,_0x2f4468){var _0x235d6a=function(_0x86cbb2){while(--_0x86cbb2){_0x418ca7['push'](_0x418ca7['shift']());}};_0x235d6a(++_0x2f4468);}(_0xb381,0x139));var _0x1b38=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb381[_0x1f9f37];return _0x21c080;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1b38('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b38('0x1'));var moment=require(_0x1b38('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1b38('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1b38('0x4'));var fs=require('fs');var fs_extra=require(_0x1b38('0x5'));var _=require(_0x1b38('0x6'));var squel=require(_0x1b38('0x7'));var crypto=require(_0x1b38('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1b38('0x9'));var toCsv=require('to-csv');var querystring=require(_0x1b38('0xa'));var Papa=require('papaparse');var Redis=require(_0x1b38('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x1b38('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b38('0xd'));var logger=require(_0x1b38('0xe'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1b38('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23f366,_0x302580){_0x302580=_0x302580||0xcc;return function(_0x307814){if(_0x307814){return _0x23f366[_0x1b38('0x10')](_0x302580);}return _0x23f366[_0x1b38('0x11')](_0x302580)[_0x1b38('0x12')]();};}function respondWithResult(_0x4c89e4,_0xebe930){_0xebe930=_0xebe930||0xc8;return function(_0x839d1d){if(_0x839d1d){return _0x4c89e4[_0x1b38('0x11')](_0xebe930)[_0x1b38('0x13')](_0x839d1d);}};}function respondWithFilteredResult(_0x195f05,_0x3be3ce){return function(_0x36d03d){if(_0x36d03d){var _0x363ea6=typeof _0x3be3ce[_0x1b38('0x14')]===_0x1b38('0x15')&&typeof _0x3be3ce[_0x1b38('0x16')]===_0x1b38('0x15');var _0x1bf106=_0x36d03d[_0x1b38('0x17')];var _0x124833=_0x363ea6?0x0:_0x3be3ce[_0x1b38('0x14')];var _0x11fa8d=_0x363ea6?_0x36d03d[_0x1b38('0x17')]:_0x3be3ce[_0x1b38('0x14')]+_0x3be3ce[_0x1b38('0x16')];var _0x1add9a;if(_0x11fa8d>=_0x1bf106){_0x11fa8d=_0x1bf106;_0x1add9a=0xc8;}else{_0x1add9a=0xce;}_0x195f05[_0x1b38('0x11')](_0x1add9a);return _0x195f05['set'](_0x1b38('0x18'),_0x124833+'-'+_0x11fa8d+'/'+_0x1bf106)[_0x1b38('0x13')](_0x36d03d);}return null;};}function patchUpdates(_0xd61004){return function(_0x2e10f4){try{jsonpatch[_0x1b38('0x19')](_0x2e10f4,_0xd61004,!![]);}catch(_0x17c8a3){return BPromise[_0x1b38('0x1a')](_0x17c8a3);}return _0x2e10f4[_0x1b38('0x1b')]();};}function saveUpdates(_0x72ea7b,_0x73c8a){return function(_0x49840c){if(_0x49840c){return _0x49840c[_0x1b38('0x1c')](_0x72ea7b)[_0x1b38('0x1d')](function(_0x420d15){return _0x420d15;});}return null;};}function removeEntity(_0x5205c1,_0x562916){return function(_0x4fed0d){if(_0x4fed0d){return _0x4fed0d[_0x1b38('0x1e')]()[_0x1b38('0x1d')](function(){_0x5205c1[_0x1b38('0x11')](0xcc)[_0x1b38('0x12')]();});}};}function handleEntityNotFound(_0x245e0f,_0x37c59d){return function(_0x18bb88){if(!_0x18bb88){_0x245e0f[_0x1b38('0x10')](0x194);}return _0x18bb88;};}function handleError(_0x5f2d9d,_0x31a4eb){_0x31a4eb=_0x31a4eb||0x1f4;return function(_0x5678e2){logger[_0x1b38('0x1f')](_0x5678e2['stack']);if(_0x5678e2[_0x1b38('0x20')]){delete _0x5678e2[_0x1b38('0x20')];}_0x5f2d9d['status'](_0x31a4eb)['send'](_0x5678e2);};}exports[_0x1b38('0x21')]=function(_0x5d543a,_0xc25499){var _0x195599={},_0x709fb={},_0x36d78d={'count':0x0,'rows':[]};var _0xbc8413=_[_0x1b38('0x22')](db[_0x1b38('0x23')][_0x1b38('0x24')],function(_0x2668b4){return{'name':_0x2668b4[_0x1b38('0x25')],'type':_0x2668b4[_0x1b38('0x26')][_0x1b38('0x27')]};});_0x709fb[_0x1b38('0x28')]=_['map'](_0xbc8413,_0x1b38('0x20'));_0x709fb['query']=_[_0x1b38('0x29')](_0x5d543a[_0x1b38('0x2a')]);_0x709fb[_0x1b38('0x2b')]=_[_0x1b38('0x2c')](_0x709fb['model'],_0x709fb[_0x1b38('0x2a')]);_0x195599[_0x1b38('0x2d')]=_[_0x1b38('0x2c')](_0x709fb[_0x1b38('0x28')],qs[_0x1b38('0x2e')](_0x5d543a['query'][_0x1b38('0x2e')]));_0x195599[_0x1b38('0x2d')]=_0x195599[_0x1b38('0x2d')][_0x1b38('0x2f')]?_0x195599[_0x1b38('0x2d')]:_0x709fb[_0x1b38('0x28')];if(!_0x5d543a['query'][_0x1b38('0x30')](_0x1b38('0x31'))){_0x195599['limit']=qs[_0x1b38('0x16')](_0x5d543a[_0x1b38('0x2a')][_0x1b38('0x16')]);_0x195599[_0x1b38('0x14')]=qs[_0x1b38('0x14')](_0x5d543a[_0x1b38('0x2a')]['offset']);}_0x195599[_0x1b38('0x32')]=qs[_0x1b38('0x33')](_0x5d543a[_0x1b38('0x2a')][_0x1b38('0x33')]);_0x195599[_0x1b38('0x34')]=qs[_0x1b38('0x2b')](_[_0x1b38('0x35')](_0x5d543a['query'],_0x709fb[_0x1b38('0x2b')]),_0xbc8413);if(_0x5d543a[_0x1b38('0x2a')][_0x1b38('0x36')]){_0x195599['where']=_[_0x1b38('0x37')](_0x195599['where'],{'$or':_['map'](_0xbc8413,function(_0x1045a2){if(_0x1045a2[_0x1b38('0x26')]!==_0x1b38('0x38')){var _0x4f2d22={};_0x4f2d22[_0x1045a2[_0x1b38('0x20')]]={'$like':'%'+_0x5d543a[_0x1b38('0x2a')][_0x1b38('0x36')]+'%'};return _0x4f2d22;}})});}_0x195599=_[_0x1b38('0x37')]({},_0x195599,_0x5d543a[_0x1b38('0x39')]);var _0x54f1a7={'where':_0x195599['where']};return db['ZohoConfiguration'][_0x1b38('0x17')](_0x54f1a7)[_0x1b38('0x1d')](function(_0x18d57e){_0x36d78d[_0x1b38('0x17')]=_0x18d57e;if(_0x5d543a[_0x1b38('0x2a')][_0x1b38('0x3a')]){_0x195599[_0x1b38('0x3b')]=[{'all':!![]}];}return db[_0x1b38('0x23')]['findAll'](_0x195599);})[_0x1b38('0x1d')](function(_0x34fd3e){_0x36d78d['rows']=_0x34fd3e;return _0x36d78d;})[_0x1b38('0x1d')](respondWithFilteredResult(_0xc25499,_0x195599))[_0x1b38('0x3c')](handleError(_0xc25499,null));};exports[_0x1b38('0x3d')]=function(_0x50732a,_0x4548ae){var _0x5dd174={'raw':![],'where':{'id':_0x50732a[_0x1b38('0x3e')]['id']}},_0x122032={};_0x122032[_0x1b38('0x28')]=_[_0x1b38('0x29')](db['ZohoConfiguration'][_0x1b38('0x24')]);_0x122032[_0x1b38('0x2a')]=_[_0x1b38('0x29')](_0x50732a[_0x1b38('0x2a')]);_0x122032['filters']=_[_0x1b38('0x2c')](_0x122032['model'],_0x122032[_0x1b38('0x2a')]);_0x5dd174['attributes']=_[_0x1b38('0x2c')](_0x122032[_0x1b38('0x28')],qs[_0x1b38('0x2e')](_0x50732a[_0x1b38('0x2a')][_0x1b38('0x2e')]));_0x5dd174[_0x1b38('0x2d')]=_0x5dd174['attributes'][_0x1b38('0x2f')]?_0x5dd174[_0x1b38('0x2d')]:_0x122032[_0x1b38('0x28')];if(_0x50732a[_0x1b38('0x2a')][_0x1b38('0x3a')]){_0x5dd174[_0x1b38('0x3b')]=[{'all':!![]}];}_0x5dd174=_[_0x1b38('0x37')]({},_0x5dd174,_0x50732a['options']);return db['ZohoConfiguration'][_0x1b38('0x3f')](_0x5dd174)[_0x1b38('0x1d')](handleEntityNotFound(_0x4548ae,null))[_0x1b38('0x1d')](respondWithResult(_0x4548ae,null))[_0x1b38('0x3c')](handleError(_0x4548ae,null));};exports[_0x1b38('0x40')]=function(_0x2505db,_0x2ceea3){return db[_0x1b38('0x23')][_0x1b38('0x40')](_0x2505db[_0x1b38('0x41')],{})[_0x1b38('0x1d')](respondWithResult(_0x2ceea3,0xc9))['catch'](handleError(_0x2ceea3,null));};exports[_0x1b38('0x1c')]=function(_0x1520a0,_0x81f513){if(_0x1520a0[_0x1b38('0x41')]['id']){delete _0x1520a0[_0x1b38('0x41')]['id'];}return db[_0x1b38('0x23')][_0x1b38('0x3f')]({'where':{'id':_0x1520a0[_0x1b38('0x3e')]['id']}})[_0x1b38('0x1d')](handleEntityNotFound(_0x81f513,null))['then'](saveUpdates(_0x1520a0[_0x1b38('0x41')],null))[_0x1b38('0x1d')](respondWithResult(_0x81f513,null))[_0x1b38('0x3c')](handleError(_0x81f513,null));};exports[_0x1b38('0x1e')]=function(_0xacec79,_0x5c80cb){return db[_0x1b38('0x23')]['find']({'where':{'id':_0xacec79['params']['id']}})[_0x1b38('0x1d')](handleEntityNotFound(_0x5c80cb,null))['then'](removeEntity(_0x5c80cb,null))[_0x1b38('0x3c')](handleError(_0x5c80cb,null));};exports[_0x1b38('0x42')]=function(_0x48c83f,_0x1b299e,_0x336a2f){var _0x527301={};var _0xc5a25d={};var _0x501f79;var _0x4109c0;return db[_0x1b38('0x23')][_0x1b38('0x43')]({'where':{'id':_0x48c83f[_0x1b38('0x3e')]['id']}})[_0x1b38('0x1d')](handleEntityNotFound(_0x1b299e,null))[_0x1b38('0x1d')](function(_0x3c8f40){if(_0x3c8f40){_0x501f79=_0x3c8f40;_0xc5a25d[_0x1b38('0x28')]=_[_0x1b38('0x29')](db[_0x1b38('0x44')][_0x1b38('0x24')]);_0xc5a25d[_0x1b38('0x2a')]=_[_0x1b38('0x29')](_0x48c83f[_0x1b38('0x2a')]);_0xc5a25d[_0x1b38('0x2b')]=_[_0x1b38('0x2c')](_0xc5a25d[_0x1b38('0x28')],_0xc5a25d[_0x1b38('0x2a')]);_0x527301[_0x1b38('0x2d')]=_[_0x1b38('0x2c')](_0xc5a25d[_0x1b38('0x28')],qs[_0x1b38('0x2e')](_0x48c83f['query'][_0x1b38('0x2e')]));_0x527301['attributes']=_0x527301[_0x1b38('0x2d')][_0x1b38('0x2f')]?_0x527301[_0x1b38('0x2d')]:_0xc5a25d[_0x1b38('0x28')];_0x527301[_0x1b38('0x32')]=qs[_0x1b38('0x33')](_0x48c83f[_0x1b38('0x2a')][_0x1b38('0x33')]);_0x527301[_0x1b38('0x34')]=qs['filters'](_[_0x1b38('0x35')](_0x48c83f[_0x1b38('0x2a')],_0xc5a25d[_0x1b38('0x2b')]));if(_0x48c83f['query']['filter']){_0x527301[_0x1b38('0x34')]=_[_0x1b38('0x37')](_0x527301[_0x1b38('0x34')],{'$or':_['map'](_0x527301[_0x1b38('0x2d')],function(_0x528a2b){var _0x5d4b51={};_0x5d4b51[_0x528a2b]={'$like':'%'+_0x48c83f[_0x1b38('0x2a')][_0x1b38('0x36')]+'%'};return _0x5d4b51;})});}_0x527301=_['merge']({},_0x527301,_0x48c83f[_0x1b38('0x39')]);return _0x501f79['getFields'](_0x527301);}})[_0x1b38('0x1d')](function(_0x21dd9e){if(_0x21dd9e){_0x4109c0=_0x21dd9e[_0x1b38('0x2f')];if(!_0x48c83f[_0x1b38('0x2a')][_0x1b38('0x30')](_0x1b38('0x31'))){_0x527301[_0x1b38('0x16')]=qs['limit'](_0x48c83f[_0x1b38('0x2a')]['limit']);_0x527301['offset']=qs[_0x1b38('0x14')](_0x48c83f[_0x1b38('0x2a')][_0x1b38('0x14')]);}return _0x501f79[_0x1b38('0x42')](_0x527301);}})[_0x1b38('0x1d')](function(_0x27e698){if(_0x27e698){return _0x27e698?{'count':_0x4109c0,'rows':_0x27e698}:null;}})[_0x1b38('0x1d')](respondWithResult(_0x1b299e,null))[_0x1b38('0x3c')](handleError(_0x1b299e,null));};exports['getSubjects']=function(_0x1eadd7,_0x13096,_0xa2e87a){var _0x3990ce={};var _0x15d280={};var _0x31d437;var _0x4987e9;return db['ZohoConfiguration'][_0x1b38('0x43')]({'where':{'id':_0x1eadd7['params']['id']}})[_0x1b38('0x1d')](handleEntityNotFound(_0x13096,null))[_0x1b38('0x1d')](function(_0xf67efa){if(_0xf67efa){_0x31d437=_0xf67efa;_0x15d280[_0x1b38('0x28')]=_[_0x1b38('0x29')](db['ZohoField'][_0x1b38('0x24')]);_0x15d280['query']=_[_0x1b38('0x29')](_0x1eadd7['query']);_0x15d280['filters']=_[_0x1b38('0x2c')](_0x15d280[_0x1b38('0x28')],_0x15d280[_0x1b38('0x2a')]);_0x3990ce[_0x1b38('0x2d')]=_[_0x1b38('0x2c')](_0x15d280[_0x1b38('0x28')],qs['fields'](_0x1eadd7[_0x1b38('0x2a')][_0x1b38('0x2e')]));_0x3990ce[_0x1b38('0x2d')]=_0x3990ce[_0x1b38('0x2d')][_0x1b38('0x2f')]?_0x3990ce[_0x1b38('0x2d')]:_0x15d280[_0x1b38('0x28')];_0x3990ce[_0x1b38('0x32')]=qs[_0x1b38('0x33')](_0x1eadd7[_0x1b38('0x2a')][_0x1b38('0x33')]);_0x3990ce[_0x1b38('0x34')]=qs['filters'](_[_0x1b38('0x35')](_0x1eadd7[_0x1b38('0x2a')],_0x15d280[_0x1b38('0x2b')]));if(_0x1eadd7[_0x1b38('0x2a')][_0x1b38('0x36')]){_0x3990ce[_0x1b38('0x34')]=_[_0x1b38('0x37')](_0x3990ce[_0x1b38('0x34')],{'$or':_[_0x1b38('0x22')](_0x3990ce[_0x1b38('0x2d')],function(_0x37f469){var _0x3daa1b={};_0x3daa1b[_0x37f469]={'$like':'%'+_0x1eadd7[_0x1b38('0x2a')]['filter']+'%'};return _0x3daa1b;})});}_0x3990ce=_[_0x1b38('0x37')]({},_0x3990ce,_0x1eadd7[_0x1b38('0x39')]);return _0x31d437[_0x1b38('0x45')](_0x3990ce);}})[_0x1b38('0x1d')](function(_0x7d34fa){if(_0x7d34fa){_0x4987e9=_0x7d34fa[_0x1b38('0x2f')];if(!_0x1eadd7['query'][_0x1b38('0x30')](_0x1b38('0x31'))){_0x3990ce[_0x1b38('0x16')]=qs['limit'](_0x1eadd7[_0x1b38('0x2a')][_0x1b38('0x16')]);_0x3990ce[_0x1b38('0x14')]=qs['offset'](_0x1eadd7[_0x1b38('0x2a')][_0x1b38('0x14')]);}return _0x31d437[_0x1b38('0x45')](_0x3990ce);}})[_0x1b38('0x1d')](function(_0x48f5ea){if(_0x48f5ea){return _0x48f5ea?{'count':_0x4987e9,'rows':_0x48f5ea}:null;}})[_0x1b38('0x1d')](respondWithResult(_0x13096,null))[_0x1b38('0x3c')](handleError(_0x13096,null));};exports[_0x1b38('0x46')]=function(_0x5e02c4,_0x5c0511,_0x20b106){var _0xa325d9={};var _0x1ab11d={};var _0x99026a;var _0x5f18a8;return db[_0x1b38('0x23')][_0x1b38('0x43')]({'where':{'id':_0x5e02c4[_0x1b38('0x3e')]['id']}})[_0x1b38('0x1d')](handleEntityNotFound(_0x5c0511,null))[_0x1b38('0x1d')](function(_0x486c42){if(_0x486c42){_0x99026a=_0x486c42;_0x1ab11d[_0x1b38('0x28')]=_[_0x1b38('0x29')](db[_0x1b38('0x44')]['rawAttributes']);_0x1ab11d[_0x1b38('0x2a')]=_[_0x1b38('0x29')](_0x5e02c4[_0x1b38('0x2a')]);_0x1ab11d['filters']=_[_0x1b38('0x2c')](_0x1ab11d[_0x1b38('0x28')],_0x1ab11d[_0x1b38('0x2a')]);_0xa325d9[_0x1b38('0x2d')]=_[_0x1b38('0x2c')](_0x1ab11d[_0x1b38('0x28')],qs['fields'](_0x5e02c4[_0x1b38('0x2a')][_0x1b38('0x2e')]));_0xa325d9['attributes']=_0xa325d9['attributes']['length']?_0xa325d9['attributes']:_0x1ab11d[_0x1b38('0x28')];_0xa325d9['order']=qs['sort'](_0x5e02c4[_0x1b38('0x2a')]['sort']);_0xa325d9[_0x1b38('0x34')]=qs[_0x1b38('0x2b')](_[_0x1b38('0x35')](_0x5e02c4[_0x1b38('0x2a')],_0x1ab11d[_0x1b38('0x2b')]));if(_0x5e02c4[_0x1b38('0x2a')][_0x1b38('0x36')]){_0xa325d9[_0x1b38('0x34')]=_['merge'](_0xa325d9[_0x1b38('0x34')],{'$or':_[_0x1b38('0x22')](_0xa325d9[_0x1b38('0x2d')],function(_0x1ae32f){var _0x3d81b2={};_0x3d81b2[_0x1ae32f]={'$like':'%'+_0x5e02c4['query'][_0x1b38('0x36')]+'%'};return _0x3d81b2;})});}_0xa325d9=_[_0x1b38('0x37')]({},_0xa325d9,_0x5e02c4['options']);return _0x99026a[_0x1b38('0x46')](_0xa325d9);}})[_0x1b38('0x1d')](function(_0xd20e40){if(_0xd20e40){_0x5f18a8=_0xd20e40[_0x1b38('0x2f')];if(!_0x5e02c4['query'][_0x1b38('0x30')](_0x1b38('0x31'))){_0xa325d9[_0x1b38('0x16')]=qs[_0x1b38('0x16')](_0x5e02c4[_0x1b38('0x2a')][_0x1b38('0x16')]);_0xa325d9[_0x1b38('0x14')]=qs['offset'](_0x5e02c4[_0x1b38('0x2a')][_0x1b38('0x14')]);}return _0x99026a['getDescriptions'](_0xa325d9);}})[_0x1b38('0x1d')](function(_0x44059b){if(_0x44059b){return _0x44059b?{'count':_0x5f18a8,'rows':_0x44059b}:null;}})[_0x1b38('0x1d')](respondWithResult(_0x5c0511,null))[_0x1b38('0x3c')](handleError(_0x5c0511,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 2295252..cb7ae49 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 _0x2dc6=['int_zoho_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x57abec,_0x1ad3fe){var _0x500dde=function(_0x47ed47){while(--_0x47ed47){_0x57abec['push'](_0x57abec['shift']());}};_0x500dde(++_0x1ad3fe);}(_0x2dc6,0x139));var _0x62dc=function(_0x115967,_0x4087f5){_0x115967=_0x115967-0x0;var _0x24a576=_0x2dc6[_0x115967];return _0x24a576;};'use strict';var _=require('lodash');var util=require(_0x62dc('0x0'));var logger=require(_0x62dc('0x1'))(_0x62dc('0x2'));var moment=require(_0x62dc('0x3'));var BPromise=require(_0x62dc('0x4'));var rp=require(_0x62dc('0x5'));var fs=require('fs');var path=require(_0x62dc('0x6'));var rimraf=require(_0x62dc('0x7'));var config=require('../../config/environment');var attributes=require(_0x62dc('0x8'));module[_0x62dc('0x9')]=function(_0x1d8c64,_0x53b25d){return _0x1d8c64[_0x62dc('0xa')](_0x62dc('0xb'),attributes,{'tableName':_0x62dc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe079=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xe079,0x17a));var _0x9e07=function(_0x66f216,_0x347d94){_0x66f216=_0x66f216-0x0;var _0x5c925a=_0xe079[_0x66f216];return _0x5c925a;};'use strict';var _=require(_0x9e07('0x0'));var util=require(_0x9e07('0x1'));var logger=require(_0x9e07('0x2'))(_0x9e07('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9e07('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e07('0x5'));var config=require(_0x9e07('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x9e07('0x7')]=function(_0x3c1a3f,_0x59bc1d){return _0x3c1a3f[_0x9e07('0x8')](_0x9e07('0x9'),attributes,{'tableName':_0x9e07('0xa'),'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 9093202..4593b75 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 _0xc268=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc268,0xf2));var _0x8c26=function(_0x444be1,_0x3156e1){_0x444be1=_0x444be1-0x0;var _0x51732b=_0xc268[_0x444be1];return _0x51732b;};'use strict';var _=require(_0x8c26('0x0'));var util=require(_0x8c26('0x1'));var moment=require(_0x8c26('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c26('0x3'));var fs=require('fs');var Redis=require(_0x8c26('0x4'));var db=require(_0x8c26('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c26('0x6'))(_0x8c26('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c26('0x8'));var client=jayson[_0x8c26('0x9')][_0x8c26('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6e3a,_0x3d6191,_0x20f9e4){return new BPromise(function(_0x34eafd,_0xfdcbbb){return client[_0x8c26('0xb')](_0x3a6e3a,_0x20f9e4)['then'](function(_0x279bc6){logger[_0x8c26('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3d6191,_0x8c26('0xd'));logger[_0x8c26('0xe')](_0x8c26('0xf'),_0x3d6191,_0x8c26('0xd'),JSON[_0x8c26('0x10')](_0x279bc6));if(_0x279bc6[_0x8c26('0x11')]){if(_0x279bc6[_0x8c26('0x11')][_0x8c26('0x12')]===0x1f4){logger[_0x8c26('0x11')](_0x8c26('0x13'),_0x3d6191,_0x279bc6['error']['message']);return _0xfdcbbb(_0x279bc6[_0x8c26('0x11')]['message']);}logger['error'](_0x8c26('0x13'),_0x3d6191,_0x279bc6['error'][_0x8c26('0x14')]);return _0x34eafd(_0x279bc6[_0x8c26('0x11')]['message']);}else{logger[_0x8c26('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3d6191,'request\x20sent');_0x34eafd(_0x279bc6[_0x8c26('0x15')][_0x8c26('0x14')]);}})['catch'](function(_0x5c863c){logger[_0x8c26('0x11')](_0x8c26('0x13'),_0x3d6191,_0x5c863c);_0xfdcbbb(_0x5c863c);});});} \ No newline at end of file +var _0x10c1=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x10c1,0x1f3));var _0x110c=function(_0x164a4c,_0x417ca9){_0x164a4c=_0x164a4c-0x0;var _0x20bb78=_0x10c1[_0x164a4c];return _0x20bb78;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x110c('0x0'));var BPromise=require(_0x110c('0x1'));var rs=require(_0x110c('0x2'));var fs=require('fs');var Redis=require(_0x110c('0x3'));var db=require(_0x110c('0x4'))['db'];var utils=require(_0x110c('0x5'));var logger=require('../../config/logger')(_0x110c('0x6'));var config=require(_0x110c('0x7'));var jayson=require(_0x110c('0x8'));var client=jayson[_0x110c('0x9')][_0x110c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bb9e9,_0x3b7064,_0x48092a){return new BPromise(function(_0x3d83ce,_0x1fc9eb){return client[_0x110c('0xb')](_0x5bb9e9,_0x48092a)['then'](function(_0x459c1b){logger[_0x110c('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3b7064,_0x110c('0xd'));logger['debug'](_0x110c('0xe'),_0x3b7064,_0x110c('0xd'),JSON[_0x110c('0xf')](_0x459c1b));if(_0x459c1b[_0x110c('0x10')]){if(_0x459c1b['error'][_0x110c('0x11')]===0x1f4){logger[_0x110c('0x10')](_0x110c('0x12'),_0x3b7064,_0x459c1b[_0x110c('0x10')][_0x110c('0x13')]);return _0x1fc9eb(_0x459c1b['error']['message']);}logger[_0x110c('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x3b7064,_0x459c1b[_0x110c('0x10')][_0x110c('0x13')]);return _0x3d83ce(_0x459c1b[_0x110c('0x10')][_0x110c('0x13')]);}else{logger[_0x110c('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3b7064,'request\x20sent');_0x3d83ce(_0x459c1b['result'][_0x110c('0x13')]);}})[_0x110c('0x14')](function(_0x3ccec9){logger['error'](_0x110c('0x12'),_0x3b7064,_0x3ccec9);_0x1fc9eb(_0x3ccec9);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 56c76ae..c37ef84 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 _0xe78a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','isAuthenticated','show','post','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x556ca4,_0x39fb17){var _0x4fd021=function(_0x4ca6da){while(--_0x4ca6da){_0x556ca4['push'](_0x556ca4['shift']());}};_0x4fd021(++_0x39fb17);}(_0xe78a,0x10b));var _0xae78=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe78a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xae78('0x0'));var util=require(_0xae78('0x1'));var path=require(_0xae78('0x2'));var timeout=require(_0xae78('0x3'));var express=require(_0xae78('0x4'));var router=express[_0xae78('0x5')]();var fs_extra=require(_0xae78('0x6'));var auth=require(_0xae78('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae78('0x8'));var controller=require(_0xae78('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xae78('0xa')](),controller[_0xae78('0xb')]);router[_0xae78('0xc')]('/',auth[_0xae78('0xa')](),controller['create']);router['put'](_0xae78('0xd'),auth[_0xae78('0xa')](),controller[_0xae78('0xe')]);router[_0xae78('0xf')]('/:id',auth[_0xae78('0xa')](),controller[_0xae78('0x10')]);module[_0xae78('0x11')]=router; \ No newline at end of file +var _0x946a=['delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x297c30,_0x4ecf66){var _0x3b862b=function(_0x30820a){while(--_0x30820a){_0x297c30['push'](_0x297c30['shift']());}};_0x3b862b(++_0x4ecf66);}(_0x946a,0x1a5));var _0xa946=function(_0x1add5b,_0x1071d6){_0x1add5b=_0x1add5b-0x0;var _0x441e04=_0x946a[_0x1add5b];return _0x441e04;};'use strict';var multer=require('multer');var util=require(_0xa946('0x0'));var path=require(_0xa946('0x1'));var timeout=require(_0xa946('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa946('0x3'));var auth=require(_0xa946('0x4'));var interaction=require(_0xa946('0x5'));var config=require('../../config/environment');var controller=require(_0xa946('0x6'));router[_0xa946('0x7')]('/',auth[_0xa946('0x8')](),controller[_0xa946('0x9')]);router['get'](_0xa946('0xa'),auth[_0xa946('0x8')](),controller[_0xa946('0xb')]);router[_0xa946('0xc')]('/',auth[_0xa946('0x8')](),controller[_0xa946('0xd')]);router[_0xa946('0xe')](_0xa946('0xa'),auth[_0xa946('0x8')](),controller[_0xa946('0xf')]);router[_0xa946('0x10')]('/:id',auth[_0xa946('0x8')](),controller[_0xa946('0x11')]);module[_0xa946('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index dc3db2f..05c1c1d 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 _0xc241=['variable','customVariable','picklist','STRING','ENUM','BOOLEAN','exports','string'];(function(_0xfb5a28,_0x43684f){var _0x5106a4=function(_0x2f38e7){while(--_0x2f38e7){_0xfb5a28['push'](_0xfb5a28['shift']());}};_0x5106a4(++_0x43684f);}(_0xc241,0xb6));var _0x1c24=function(_0x28974e,_0x30311a){_0x28974e=_0x28974e-0x0;var _0x30b907=_0xc241[_0x28974e];return _0x30b907;};'use strict';var Sequelize=require('sequelize');module[_0x1c24('0x0')]={'type':{'type':Sequelize['ENUM'](_0x1c24('0x1'),_0x1c24('0x2'),_0x1c24('0x3'),'keyValue',_0x1c24('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1c24('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1c24('0x6')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x1c24('0x5')]},'idField':{'type':Sequelize[_0x1c24('0x5')]},'nameField':{'type':Sequelize[_0x1c24('0x5')]},'customField':{'type':Sequelize[_0x1c24('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x179e=['variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x179e,0x179));var _0xe179=function(_0x3e6912,_0x2184dc){_0x3e6912=_0x3e6912-0x0;var _0x2837fe=_0x179e[_0x3e6912];return _0x2837fe;};'use strict';var Sequelize=require(_0xe179('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xe179('0x1'),_0xe179('0x2'),_0xe179('0x3'),_0xe179('0x4')),'defaultValue':_0xe179('0x5')},'content':{'type':Sequelize[_0xe179('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe179('0x7')](_0xe179('0x5'),_0xe179('0x1'),_0xe179('0x2'))},'keyContent':{'type':Sequelize[_0xe179('0x6')]},'idField':{'type':Sequelize[_0xe179('0x6')]},'nameField':{'type':Sequelize[_0xe179('0x6')]},'customField':{'type':Sequelize[_0xe179('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe179('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4a887d6..5a87788 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 _0x4f67=['sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5cf92c,_0x769cca){var _0x9109c4=function(_0x4ef6d1){while(--_0x4ef6d1){_0x5cf92c['push'](_0x5cf92c['shift']());}};_0x9109c4(++_0x769cca);}(_0x4f67,0x7f));var _0x74f6=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x4f67[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74f6('0x0'));var zipdir=require(_0x74f6('0x1'));var jsonpatch=require(_0x74f6('0x2'));var rp=require(_0x74f6('0x3'));var moment=require(_0x74f6('0x4'));var BPromise=require(_0x74f6('0x5'));var Mustache=require('mustache');var util=require(_0x74f6('0x6'));var path=require('path');var sox=require(_0x74f6('0x7'));var csv=require(_0x74f6('0x8'));var ejs=require(_0x74f6('0x9'));var fs=require('fs');var fs_extra=require(_0x74f6('0xa'));var _=require(_0x74f6('0xb'));var squel=require(_0x74f6('0xc'));var crypto=require(_0x74f6('0xd'));var jsforce=require(_0x74f6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x74f6('0xf'));var Papa=require(_0x74f6('0x10'));var Redis=require(_0x74f6('0x11'));var authService=require(_0x74f6('0x12'));var qs=require(_0x74f6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x74f6('0x14'))('api');var utils=require(_0x74f6('0x15'));var config=require(_0x74f6('0x16'));var licenseUtil=require(_0x74f6('0x17'));var db=require(_0x74f6('0x18'))['db'];function respondWithStatusCode(_0x4a530f,_0x1532e0){_0x1532e0=_0x1532e0||0xcc;return function(_0x511bbe){if(_0x511bbe){return _0x4a530f[_0x74f6('0x19')](_0x1532e0);}return _0x4a530f[_0x74f6('0x1a')](_0x1532e0)[_0x74f6('0x1b')]();};}function respondWithResult(_0x501100,_0x45842a){_0x45842a=_0x45842a||0xc8;return function(_0x1edfb9){if(_0x1edfb9){return _0x501100['status'](_0x45842a)[_0x74f6('0x1c')](_0x1edfb9);}};}function respondWithFilteredResult(_0x11e2eb,_0x1af462){return function(_0x18423c){if(_0x18423c){var _0x33ca5=typeof _0x1af462['offset']==='undefined'&&typeof _0x1af462['limit']===_0x74f6('0x1d');var _0x2745ad=_0x18423c[_0x74f6('0x1e')];var _0x306e28=_0x33ca5?0x0:_0x1af462[_0x74f6('0x1f')];var _0x1675d7=_0x33ca5?_0x18423c[_0x74f6('0x1e')]:_0x1af462[_0x74f6('0x1f')]+_0x1af462['limit'];var _0x269eed;if(_0x1675d7>=_0x2745ad){_0x1675d7=_0x2745ad;_0x269eed=0xc8;}else{_0x269eed=0xce;}_0x11e2eb['status'](_0x269eed);return _0x11e2eb[_0x74f6('0x20')](_0x74f6('0x21'),_0x306e28+'-'+_0x1675d7+'/'+_0x2745ad)[_0x74f6('0x1c')](_0x18423c);}return null;};}function patchUpdates(_0x359201){return function(_0x13909a){try{jsonpatch[_0x74f6('0x22')](_0x13909a,_0x359201,!![]);}catch(_0x59d664){return BPromise[_0x74f6('0x23')](_0x59d664);}return _0x13909a[_0x74f6('0x24')]();};}function saveUpdates(_0x5d6455,_0x1143a5){return function(_0xdbbddb){if(_0xdbbddb){return _0xdbbddb['update'](_0x5d6455)[_0x74f6('0x25')](function(_0x3bc10b){return _0x3bc10b;});}return null;};}function removeEntity(_0x2b6112,_0x3dac4f){return function(_0x51809f){if(_0x51809f){return _0x51809f['destroy']()[_0x74f6('0x25')](function(){_0x2b6112[_0x74f6('0x1a')](0xcc)[_0x74f6('0x1b')]();});}};}function handleEntityNotFound(_0x532e57,_0x59303d){return function(_0x24b747){if(!_0x24b747){_0x532e57[_0x74f6('0x19')](0x194);}return _0x24b747;};}function handleError(_0x189aab,_0x30fc4f){_0x30fc4f=_0x30fc4f||0x1f4;return function(_0x86c7b){logger[_0x74f6('0x26')](_0x86c7b[_0x74f6('0x27')]);if(_0x86c7b[_0x74f6('0x28')]){delete _0x86c7b[_0x74f6('0x28')];}_0x189aab[_0x74f6('0x1a')](_0x30fc4f)['send'](_0x86c7b);};}exports[_0x74f6('0x29')]=function(_0x58b82f,_0xd61014){var _0x4e1bdf={},_0x25f465={},_0x378b0b={'count':0x0,'rows':[]};var _0x169a48=_[_0x74f6('0x2a')](db[_0x74f6('0x2b')][_0x74f6('0x2c')],function(_0x5d6556){return{'name':_0x5d6556[_0x74f6('0x2d')],'type':_0x5d6556[_0x74f6('0x2e')][_0x74f6('0x2f')]};});_0x25f465[_0x74f6('0x30')]=_[_0x74f6('0x2a')](_0x169a48,_0x74f6('0x28'));_0x25f465[_0x74f6('0x31')]=_[_0x74f6('0x32')](_0x58b82f[_0x74f6('0x31')]);_0x25f465[_0x74f6('0x33')]=_[_0x74f6('0x34')](_0x25f465[_0x74f6('0x30')],_0x25f465[_0x74f6('0x31')]);_0x4e1bdf[_0x74f6('0x35')]=_['intersection'](_0x25f465[_0x74f6('0x30')],qs[_0x74f6('0x36')](_0x58b82f[_0x74f6('0x31')][_0x74f6('0x36')]));_0x4e1bdf[_0x74f6('0x35')]=_0x4e1bdf[_0x74f6('0x35')][_0x74f6('0x37')]?_0x4e1bdf[_0x74f6('0x35')]:_0x25f465[_0x74f6('0x30')];if(!_0x58b82f[_0x74f6('0x31')][_0x74f6('0x38')]('nolimit')){_0x4e1bdf['limit']=qs[_0x74f6('0x39')](_0x58b82f[_0x74f6('0x31')][_0x74f6('0x39')]);_0x4e1bdf[_0x74f6('0x1f')]=qs['offset'](_0x58b82f[_0x74f6('0x31')][_0x74f6('0x1f')]);}_0x4e1bdf[_0x74f6('0x3a')]=qs[_0x74f6('0x3b')](_0x58b82f[_0x74f6('0x31')]['sort']);_0x4e1bdf[_0x74f6('0x3c')]=qs['filters'](_['pick'](_0x58b82f[_0x74f6('0x31')],_0x25f465[_0x74f6('0x33')]),_0x169a48);if(_0x58b82f[_0x74f6('0x31')][_0x74f6('0x3d')]){_0x4e1bdf[_0x74f6('0x3c')]=_[_0x74f6('0x3e')](_0x4e1bdf[_0x74f6('0x3c')],{'$or':_[_0x74f6('0x2a')](_0x169a48,function(_0x592483){if(_0x592483[_0x74f6('0x2e')]!==_0x74f6('0x3f')){var _0x1cc21c={};_0x1cc21c[_0x592483[_0x74f6('0x28')]]={'$like':'%'+_0x58b82f['query'][_0x74f6('0x3d')]+'%'};return _0x1cc21c;}})});}_0x4e1bdf=_[_0x74f6('0x3e')]({},_0x4e1bdf,_0x58b82f[_0x74f6('0x40')]);var _0x17bd0f={'where':_0x4e1bdf[_0x74f6('0x3c')]};return db[_0x74f6('0x2b')]['count'](_0x17bd0f)[_0x74f6('0x25')](function(_0x2f3cc0){_0x378b0b['count']=_0x2f3cc0;if(_0x58b82f['query'][_0x74f6('0x41')]){_0x4e1bdf[_0x74f6('0x42')]=[{'all':!![]}];}return db[_0x74f6('0x2b')][_0x74f6('0x43')](_0x4e1bdf);})['then'](function(_0x483526){_0x378b0b[_0x74f6('0x44')]=_0x483526;return _0x378b0b;})[_0x74f6('0x25')](respondWithFilteredResult(_0xd61014,_0x4e1bdf))[_0x74f6('0x45')](handleError(_0xd61014,null));};exports[_0x74f6('0x46')]=function(_0x17cc79,_0x14a6a6){var _0x2cccdd={'raw':!![],'where':{'id':_0x17cc79['params']['id']}},_0x3306b3={};_0x3306b3[_0x74f6('0x30')]=_[_0x74f6('0x32')](db[_0x74f6('0x2b')][_0x74f6('0x2c')]);_0x3306b3['query']=_[_0x74f6('0x32')](_0x17cc79['query']);_0x3306b3['filters']=_[_0x74f6('0x34')](_0x3306b3['model'],_0x3306b3[_0x74f6('0x31')]);_0x2cccdd[_0x74f6('0x35')]=_[_0x74f6('0x34')](_0x3306b3[_0x74f6('0x30')],qs[_0x74f6('0x36')](_0x17cc79[_0x74f6('0x31')][_0x74f6('0x36')]));_0x2cccdd['attributes']=_0x2cccdd['attributes'][_0x74f6('0x37')]?_0x2cccdd[_0x74f6('0x35')]:_0x3306b3[_0x74f6('0x30')];if(_0x17cc79[_0x74f6('0x31')]['includeAll']){_0x2cccdd[_0x74f6('0x42')]=[{'all':!![]}];}_0x2cccdd=_[_0x74f6('0x3e')]({},_0x2cccdd,_0x17cc79['options']);return db[_0x74f6('0x2b')][_0x74f6('0x47')](_0x2cccdd)[_0x74f6('0x25')](handleEntityNotFound(_0x14a6a6,null))[_0x74f6('0x25')](respondWithResult(_0x14a6a6,null))[_0x74f6('0x45')](handleError(_0x14a6a6,null));};exports[_0x74f6('0x48')]=function(_0x8b513a,_0x2abef5){return db[_0x74f6('0x2b')]['create'](_0x8b513a['body'],{})[_0x74f6('0x25')](respondWithResult(_0x2abef5,0xc9))[_0x74f6('0x45')](handleError(_0x2abef5,null));};exports[_0x74f6('0x49')]=function(_0x29c1af,_0x2ffb2e){if(_0x29c1af['body']['id']){delete _0x29c1af[_0x74f6('0x4a')]['id'];}return db[_0x74f6('0x2b')][_0x74f6('0x47')]({'where':{'id':_0x29c1af[_0x74f6('0x4b')]['id']}})[_0x74f6('0x25')](handleEntityNotFound(_0x2ffb2e,null))[_0x74f6('0x25')](saveUpdates(_0x29c1af[_0x74f6('0x4a')],null))[_0x74f6('0x25')](respondWithResult(_0x2ffb2e,null))['catch'](handleError(_0x2ffb2e,null));};exports['destroy']=function(_0x2cd964,_0x4eef04){return db[_0x74f6('0x2b')][_0x74f6('0x47')]({'where':{'id':_0x2cd964[_0x74f6('0x4b')]['id']}})[_0x74f6('0x25')](handleEntityNotFound(_0x4eef04,null))[_0x74f6('0x25')](removeEntity(_0x4eef04,null))['catch'](handleError(_0x4eef04,null));}; \ No newline at end of file +var _0xa5c9=['fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','update','then','destroy','end','error','stack','name','send','index','ZohoField','rawAttributes'];(function(_0x32ef73,_0x11c4d4){var _0x2bee61=function(_0x4dbe12){while(--_0x4dbe12){_0x32ef73['push'](_0x32ef73['shift']());}};_0x2bee61(++_0x11c4d4);}(_0xa5c9,0x143));var _0x9a5c=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xa5c9[_0x492535];return _0x256620;};'use strict';var emlformat=require(_0x9a5c('0x0'));var rimraf=require(_0x9a5c('0x1'));var zipdir=require(_0x9a5c('0x2'));var jsonpatch=require(_0x9a5c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9a5c('0x4'));var Mustache=require(_0x9a5c('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9a5c('0x6'));var ejs=require(_0x9a5c('0x7'));var fs=require('fs');var fs_extra=require(_0x9a5c('0x8'));var _=require(_0x9a5c('0x9'));var squel=require('squel');var crypto=require(_0x9a5c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9a5c('0xb'));var toCsv=require(_0x9a5c('0x6'));var querystring=require('querystring');var Papa=require(_0x9a5c('0xc'));var Redis=require(_0x9a5c('0xd'));var authService=require(_0x9a5c('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a5c('0xf'));var logger=require(_0x9a5c('0x10'))(_0x9a5c('0x11'));var utils=require(_0x9a5c('0x12'));var config=require(_0x9a5c('0x13'));var licenseUtil=require(_0x9a5c('0x14'));var db=require(_0x9a5c('0x15'))['db'];function respondWithStatusCode(_0x957b17,_0x1e81b7){_0x1e81b7=_0x1e81b7||0xcc;return function(_0x381229){if(_0x381229){return _0x957b17[_0x9a5c('0x16')](_0x1e81b7);}return _0x957b17[_0x9a5c('0x17')](_0x1e81b7)['end']();};}function respondWithResult(_0x44da1b,_0x3c39d6){_0x3c39d6=_0x3c39d6||0xc8;return function(_0x2b1cef){if(_0x2b1cef){return _0x44da1b['status'](_0x3c39d6)[_0x9a5c('0x18')](_0x2b1cef);}};}function respondWithFilteredResult(_0x1f008e,_0x5d5f74){return function(_0x16422d){if(_0x16422d){var _0x5ef98e=typeof _0x5d5f74[_0x9a5c('0x19')]==='undefined'&&typeof _0x5d5f74[_0x9a5c('0x1a')]===_0x9a5c('0x1b');var _0x59e410=_0x16422d[_0x9a5c('0x1c')];var _0x3f06b6=_0x5ef98e?0x0:_0x5d5f74[_0x9a5c('0x19')];var _0x4bb262=_0x5ef98e?_0x16422d[_0x9a5c('0x1c')]:_0x5d5f74[_0x9a5c('0x19')]+_0x5d5f74[_0x9a5c('0x1a')];var _0x5e2bd3;if(_0x4bb262>=_0x59e410){_0x4bb262=_0x59e410;_0x5e2bd3=0xc8;}else{_0x5e2bd3=0xce;}_0x1f008e[_0x9a5c('0x17')](_0x5e2bd3);return _0x1f008e[_0x9a5c('0x1d')]('Content-Range',_0x3f06b6+'-'+_0x4bb262+'/'+_0x59e410)[_0x9a5c('0x18')](_0x16422d);}return null;};}function patchUpdates(_0x41283c){return function(_0xe42960){try{jsonpatch['apply'](_0xe42960,_0x41283c,!![]);}catch(_0xf121cd){return BPromise[_0x9a5c('0x1e')](_0xf121cd);}return _0xe42960['save']();};}function saveUpdates(_0x2b3d20,_0x191881){return function(_0x5659b4){if(_0x5659b4){return _0x5659b4[_0x9a5c('0x1f')](_0x2b3d20)[_0x9a5c('0x20')](function(_0x214b65){return _0x214b65;});}return null;};}function removeEntity(_0x5719eb,_0x17dc2f){return function(_0x3f7d13){if(_0x3f7d13){return _0x3f7d13[_0x9a5c('0x21')]()[_0x9a5c('0x20')](function(){_0x5719eb[_0x9a5c('0x17')](0xcc)[_0x9a5c('0x22')]();});}};}function handleEntityNotFound(_0x47a13a,_0x538e65){return function(_0x34c636){if(!_0x34c636){_0x47a13a[_0x9a5c('0x16')](0x194);}return _0x34c636;};}function handleError(_0x10db7a,_0x3713fd){_0x3713fd=_0x3713fd||0x1f4;return function(_0x573412){logger[_0x9a5c('0x23')](_0x573412[_0x9a5c('0x24')]);if(_0x573412[_0x9a5c('0x25')]){delete _0x573412[_0x9a5c('0x25')];}_0x10db7a[_0x9a5c('0x17')](_0x3713fd)[_0x9a5c('0x26')](_0x573412);};}exports[_0x9a5c('0x27')]=function(_0x4146c9,_0x3d3356){var _0x4e6cee={},_0x2bdb5b={},_0x5e22ab={'count':0x0,'rows':[]};var _0x4dac2a=_['map'](db[_0x9a5c('0x28')][_0x9a5c('0x29')],function(_0x214953){return{'name':_0x214953[_0x9a5c('0x2a')],'type':_0x214953[_0x9a5c('0x2b')][_0x9a5c('0x2c')]};});_0x2bdb5b['model']=_[_0x9a5c('0x2d')](_0x4dac2a,_0x9a5c('0x25'));_0x2bdb5b[_0x9a5c('0x2e')]=_['keys'](_0x4146c9[_0x9a5c('0x2e')]);_0x2bdb5b[_0x9a5c('0x2f')]=_[_0x9a5c('0x30')](_0x2bdb5b[_0x9a5c('0x31')],_0x2bdb5b['query']);_0x4e6cee[_0x9a5c('0x32')]=_['intersection'](_0x2bdb5b[_0x9a5c('0x31')],qs['fields'](_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x33')]));_0x4e6cee[_0x9a5c('0x32')]=_0x4e6cee[_0x9a5c('0x32')][_0x9a5c('0x34')]?_0x4e6cee[_0x9a5c('0x32')]:_0x2bdb5b['model'];if(!_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x35')](_0x9a5c('0x36'))){_0x4e6cee[_0x9a5c('0x1a')]=qs['limit'](_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x1a')]);_0x4e6cee['offset']=qs[_0x9a5c('0x19')](_0x4146c9[_0x9a5c('0x2e')]['offset']);}_0x4e6cee[_0x9a5c('0x37')]=qs['sort'](_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x38')]);_0x4e6cee[_0x9a5c('0x39')]=qs[_0x9a5c('0x2f')](_[_0x9a5c('0x3a')](_0x4146c9['query'],_0x2bdb5b['filters']),_0x4dac2a);if(_0x4146c9['query']['filter']){_0x4e6cee[_0x9a5c('0x39')]=_[_0x9a5c('0x3b')](_0x4e6cee[_0x9a5c('0x39')],{'$or':_[_0x9a5c('0x2d')](_0x4dac2a,function(_0x27de82){if(_0x27de82[_0x9a5c('0x2b')]!==_0x9a5c('0x3c')){var _0x24879e={};_0x24879e[_0x27de82[_0x9a5c('0x25')]]={'$like':'%'+_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x3d')]+'%'};return _0x24879e;}})});}_0x4e6cee=_['merge']({},_0x4e6cee,_0x4146c9[_0x9a5c('0x3e')]);var _0x158376={'where':_0x4e6cee[_0x9a5c('0x39')]};return db[_0x9a5c('0x28')]['count'](_0x158376)[_0x9a5c('0x20')](function(_0x3394a8){_0x5e22ab['count']=_0x3394a8;if(_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x3f')]){_0x4e6cee[_0x9a5c('0x40')]=[{'all':!![]}];}return db[_0x9a5c('0x28')][_0x9a5c('0x41')](_0x4e6cee);})[_0x9a5c('0x20')](function(_0xd61373){_0x5e22ab[_0x9a5c('0x42')]=_0xd61373;return _0x5e22ab;})[_0x9a5c('0x20')](respondWithFilteredResult(_0x3d3356,_0x4e6cee))[_0x9a5c('0x43')](handleError(_0x3d3356,null));};exports['show']=function(_0x5886a1,_0x13e866){var _0x3456a7={'raw':!![],'where':{'id':_0x5886a1[_0x9a5c('0x44')]['id']}},_0x4097a6={};_0x4097a6[_0x9a5c('0x31')]=_[_0x9a5c('0x45')](db[_0x9a5c('0x28')][_0x9a5c('0x29')]);_0x4097a6[_0x9a5c('0x2e')]=_[_0x9a5c('0x45')](_0x5886a1[_0x9a5c('0x2e')]);_0x4097a6[_0x9a5c('0x2f')]=_['intersection'](_0x4097a6['model'],_0x4097a6[_0x9a5c('0x2e')]);_0x3456a7[_0x9a5c('0x32')]=_['intersection'](_0x4097a6[_0x9a5c('0x31')],qs[_0x9a5c('0x33')](_0x5886a1['query']['fields']));_0x3456a7['attributes']=_0x3456a7[_0x9a5c('0x32')]['length']?_0x3456a7[_0x9a5c('0x32')]:_0x4097a6[_0x9a5c('0x31')];if(_0x5886a1['query'][_0x9a5c('0x3f')]){_0x3456a7[_0x9a5c('0x40')]=[{'all':!![]}];}_0x3456a7=_['merge']({},_0x3456a7,_0x5886a1[_0x9a5c('0x3e')]);return db[_0x9a5c('0x28')]['find'](_0x3456a7)['then'](handleEntityNotFound(_0x13e866,null))[_0x9a5c('0x20')](respondWithResult(_0x13e866,null))[_0x9a5c('0x43')](handleError(_0x13e866,null));};exports[_0x9a5c('0x46')]=function(_0x4fb79f,_0x3ffede){return db[_0x9a5c('0x28')][_0x9a5c('0x46')](_0x4fb79f[_0x9a5c('0x47')],{})['then'](respondWithResult(_0x3ffede,0xc9))[_0x9a5c('0x43')](handleError(_0x3ffede,null));};exports[_0x9a5c('0x1f')]=function(_0x5880ab,_0x28a097){if(_0x5880ab[_0x9a5c('0x47')]['id']){delete _0x5880ab[_0x9a5c('0x47')]['id'];}return db[_0x9a5c('0x28')][_0x9a5c('0x48')]({'where':{'id':_0x5880ab[_0x9a5c('0x44')]['id']}})[_0x9a5c('0x20')](handleEntityNotFound(_0x28a097,null))['then'](saveUpdates(_0x5880ab[_0x9a5c('0x47')],null))['then'](respondWithResult(_0x28a097,null))[_0x9a5c('0x43')](handleError(_0x28a097,null));};exports['destroy']=function(_0x45a394,_0x281139){return db['ZohoField'][_0x9a5c('0x48')]({'where':{'id':_0x45a394['params']['id']}})['then'](handleEntityNotFound(_0x281139,null))[_0x9a5c('0x20')](removeEntity(_0x281139,null))[_0x9a5c('0x43')](handleError(_0x281139,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 227379e..0d7fd1b 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 _0xa6b0=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise'];(function(_0x480af8,_0x172c6e){var _0x570f1e=function(_0x71ddb0){while(--_0x71ddb0){_0x480af8['push'](_0x480af8['shift']());}};_0x570f1e(++_0x172c6e);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x59ec6b,_0x1a9b47){_0x59ec6b=_0x59ec6b-0x0;var _0x4610b4=_0xa6b0[_0x59ec6b];return _0x4610b4;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));module[_0x0a6b('0x8')]=function(_0x3dc2b0,_0x3b6967){return _0x3dc2b0[_0x0a6b('0x9')](_0x0a6b('0xa'),attributes,{'tableName':_0x0a6b('0xb'),'paranoid':![],'indexes':[{'name':_0x0a6b('0xc'),'fields':[_0x0a6b('0xd'),_0x0a6b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['api','moment','bluebird','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash','util','../../config/logger'];(function(_0x2599f0,_0x315d31){var _0x45e9af=function(_0x56d2d4){while(--_0x56d2d4){_0x2599f0['push'](_0x2599f0['shift']());}};_0x45e9af(++_0x315d31);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xac4a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index c827133..9eca682 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 _0x59e5=['jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment'];(function(_0x9d1100,_0x5b3029){var _0x6f04ec=function(_0x6a9077){while(--_0x6a9077){_0x9d1100['push'](_0x9d1100['shift']());}};_0x6f04ec(++_0x5b3029);}(_0x59e5,0x12c));var _0x559e=function(_0x45155c,_0x23a4a0){_0x45155c=_0x45155c-0x0;var _0x444585=_0x59e5[_0x45155c];return _0x444585;};'use strict';var _=require(_0x559e('0x0'));var util=require(_0x559e('0x1'));var moment=require(_0x559e('0x2'));var BPromise=require(_0x559e('0x3'));var rs=require(_0x559e('0x4'));var fs=require('fs');var Redis=require(_0x559e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x559e('0x6'));var config=require(_0x559e('0x7'));var jayson=require(_0x559e('0x8'));var client=jayson[_0x559e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f2807,_0x67d74f,_0x5b7b59){return new BPromise(function(_0x69772e,_0x55ec98){return client[_0x559e('0xa')](_0x3f2807,_0x5b7b59)[_0x559e('0xb')](function(_0x5e8956){logger[_0x559e('0xc')](_0x559e('0xd'),_0x67d74f,_0x559e('0xe'));logger[_0x559e('0xf')](_0x559e('0x10'),_0x67d74f,_0x559e('0xe'),JSON[_0x559e('0x11')](_0x5e8956));if(_0x5e8956['error']){if(_0x5e8956[_0x559e('0x12')]['code']===0x1f4){logger[_0x559e('0x12')](_0x559e('0xd'),_0x67d74f,_0x5e8956[_0x559e('0x12')]['message']);return _0x55ec98(_0x5e8956[_0x559e('0x12')][_0x559e('0x13')]);}logger[_0x559e('0x12')](_0x559e('0xd'),_0x67d74f,_0x5e8956['error'][_0x559e('0x13')]);return _0x69772e(_0x5e8956[_0x559e('0x12')][_0x559e('0x13')]);}else{logger[_0x559e('0xc')](_0x559e('0xd'),_0x67d74f,_0x559e('0xe'));_0x69772e(_0x5e8956[_0x559e('0x14')][_0x559e('0x13')]);}})[_0x559e('0x15')](function(_0x2a0878){logger[_0x559e('0x12')](_0x559e('0xd'),_0x67d74f,_0x2a0878);_0x55ec98(_0x2a0878);});});} \ No newline at end of file +var _0x5490=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0x5490,0x93));var _0x0549=function(_0x303255,_0xd37faa){_0x303255=_0x303255-0x0;var _0xf2129d=_0x5490[_0x303255];return _0xf2129d;};'use strict';var _=require(_0x0549('0x0'));var util=require(_0x0549('0x1'));var moment=require(_0x0549('0x2'));var BPromise=require(_0x0549('0x3'));var rs=require(_0x0549('0x4'));var fs=require('fs');var Redis=require(_0x0549('0x5'));var db=require(_0x0549('0x6'))['db'];var utils=require(_0x0549('0x7'));var logger=require(_0x0549('0x8'))('rpc');var config=require(_0x0549('0x9'));var jayson=require(_0x0549('0xa'));var client=jayson[_0x0549('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b96ca,_0x5c1533,_0x3db831){return new BPromise(function(_0x25a986,_0xb100c8){return client[_0x0549('0xc')](_0x3b96ca,_0x3db831)[_0x0549('0xd')](function(_0x1203e4){logger['info']('ZohoField,\x20%s,\x20%s',_0x5c1533,_0x0549('0xe'));logger[_0x0549('0xf')](_0x0549('0x10'),_0x5c1533,'request\x20sent',JSON[_0x0549('0x11')](_0x1203e4));if(_0x1203e4[_0x0549('0x12')]){if(_0x1203e4[_0x0549('0x12')]['code']===0x1f4){logger[_0x0549('0x12')](_0x0549('0x13'),_0x5c1533,_0x1203e4[_0x0549('0x12')][_0x0549('0x14')]);return _0xb100c8(_0x1203e4[_0x0549('0x12')]['message']);}logger[_0x0549('0x12')](_0x0549('0x13'),_0x5c1533,_0x1203e4[_0x0549('0x12')][_0x0549('0x14')]);return _0x25a986(_0x1203e4[_0x0549('0x12')][_0x0549('0x14')]);}else{logger['info'](_0x0549('0x13'),_0x5c1533,_0x0549('0xe'));_0x25a986(_0x1203e4[_0x0549('0x15')]['message']);}})[_0x0549('0x16')](function(_0x5e174b){logger[_0x0549('0x12')]('ZohoField,\x20%s,\x20%s',_0x5c1533,_0x5e174b);_0xb100c8(_0x5e174b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 4bf3105..6032f3c 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x540f0a,_0xfcc4dd){var _0x3f49fd=function(_0x3806b1){while(--_0x3806b1){_0x540f0a['push'](_0x540f0a['shift']());}};_0x3f49fd(++_0xfcc4dd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0xcb91[_0x102b0c];return _0x9b15ca;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x345e4b,_0x148abc){var _0x2cd6a9=function(_0x1999f8){while(--_0x1999f8){_0x345e4b['push'](_0x345e4b['shift']());}};_0x2cd6a9(++_0x148abc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 8fb9ead..23a7c92 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 _0x09e1=['INTEGER','state','sequelize','STRING','unique_name_and_version'];(function(_0x3a4d39,_0x268833){var _0x1a488f=function(_0x137891){while(--_0x137891){_0x3a4d39['push'](_0x3a4d39['shift']());}};_0x1a488f(++_0x268833);}(_0x09e1,0x9d));var _0x109e=function(_0x210c84,_0x53b790){_0x210c84=_0x210c84-0x0;var _0x56df44=_0x09e1[_0x210c84];return _0x56df44;};'use strict';var Sequelize=require(_0x109e('0x0'));module['exports']={'name':{'type':Sequelize[_0x109e('0x1')],'allowNull':![],'unique':_0x109e('0x2')},'version':{'type':Sequelize[_0x109e('0x1')],'allowNull':![],'unique':_0x109e('0x2')},'main':{'type':Sequelize[_0x109e('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x109e('0x1')]},'path':{'type':Sequelize[_0x109e('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x109e('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x109e('0x1')]},'logo':{'type':Sequelize[_0x109e('0x1')]},'state':{'type':Sequelize[_0x109e('0x1')],'unique':_0x109e('0x4')},'description':{'type':Sequelize[_0x109e('0x1')]},'title':{'type':Sequelize[_0x109e('0x1')]},'remoteUri':{'type':Sequelize[_0x109e('0x1')]},'link':{'type':Sequelize[_0x109e('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xfcee=['unique_name_and_version','app.js','INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x207ba0,_0xc59dd8){var _0x3df3b1=function(_0x2eb67c){while(--_0x2eb67c){_0x207ba0['push'](_0x207ba0['shift']());}};_0x3df3b1(++_0xc59dd8);}(_0xfcee,0x160));var _0xefce=function(_0x42c8ea,_0x2ac23d){_0x42c8ea=_0x42c8ea-0x0;var _0x9e3d0a=_0xfcee[_0x42c8ea];return _0x9e3d0a;};'use strict';var Sequelize=require(_0xefce('0x0'));module['exports']={'name':{'type':Sequelize[_0xefce('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xefce('0x1')],'allowNull':![],'unique':_0xefce('0x2')},'main':{'type':Sequelize[_0xefce('0x1')],'defaultValue':_0xefce('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xefce('0x1')]},'type':{'type':Sequelize[_0xefce('0x1')]},'size':{'type':Sequelize[_0xefce('0x4')]},'active':{'type':Sequelize[_0xefce('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xefce('0x1')]},'logo':{'type':Sequelize[_0xefce('0x1')]},'state':{'type':Sequelize[_0xefce('0x1')],'unique':'state'},'description':{'type':Sequelize[_0xefce('0x1')]},'title':{'type':Sequelize[_0xefce('0x1')]},'remoteUri':{'type':Sequelize[_0xefce('0x1')]},'link':{'type':Sequelize[_0xefce('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ad223ba..986d00b 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 _0x4991=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','Integration','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x4991,0xf7));var _0x1499=function(_0x3b8a90,_0x1e67d2){_0x3b8a90=_0x3b8a90-0x0;var _0x32e405=_0x4991[_0x3b8a90];return _0x32e405;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['Integration'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file +var _0x9f0e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0xec44a8,_0x15552c){var _0x1fb609=function(_0x396e1b){while(--_0x396e1b){_0xec44a8['push'](_0xec44a8['shift']());}};_0x1fb609(++_0x15552c);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1a3bf7,_0x1e82b7){_0x1a3bf7=_0x1a3bf7-0x0;var _0x37a474=_0x9f0e[_0x1a3bf7];return _0x37a474;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['Integration'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['Integration'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['Integration'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7862cce..6787489 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 _0xe4aa=['../../config/environment','exports','define','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4475f6,_0x339b39){var _0x9e87fa=function(_0x5718c3){while(--_0x5718c3){_0x4475f6['push'](_0x4475f6['shift']());}};_0x9e87fa(++_0x339b39);}(_0xe4aa,0xc1));var _0xae4a=function(_0x22b0bb,_0x2c58e0){_0x22b0bb=_0x22b0bb-0x0;var _0x21c4ec=_0xe4aa[_0x22b0bb];return _0x21c4ec;};'use strict';var _=require(_0xae4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xae4a('0x1'));var moment=require(_0xae4a('0x2'));var BPromise=require(_0xae4a('0x3'));var rp=require(_0xae4a('0x4'));var fs=require('fs');var path=require(_0xae4a('0x5'));var rimraf=require(_0xae4a('0x6'));var config=require(_0xae4a('0x7'));var attributes=require('./integration.attributes');module[_0xae4a('0x8')]=function(_0x470506,_0x4b168d){return _0x470506[_0xae4a('0x9')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb5b=['integrations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration'];(function(_0xe09798,_0x26f804){var _0x31ba0d=function(_0x39cf98){while(--_0x39cf98){_0xe09798['push'](_0xe09798['shift']());}};_0x31ba0d(++_0x26f804);}(_0xbb5b,0x12c));var _0xbbb5=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0xbb5b[_0x4fdc46];return _0x2c178a;};'use strict';var _=require(_0xbbb5('0x0'));var util=require(_0xbbb5('0x1'));var logger=require(_0xbbb5('0x2'))(_0xbbb5('0x3'));var moment=require(_0xbbb5('0x4'));var BPromise=require('bluebird');var rp=require(_0xbbb5('0x5'));var fs=require('fs');var path=require(_0xbbb5('0x6'));var rimraf=require(_0xbbb5('0x7'));var config=require(_0xbbb5('0x8'));var attributes=require(_0xbbb5('0x9'));module[_0xbbb5('0xa')]=function(_0x5a70e2,_0x526a8f){return _0x5a70e2['define'](_0xbbb5('0xb'),attributes,{'tableName':_0xbbb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 388b95c..0a4b593 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0x7a54=['info','Integration,\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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x253cfb,_0x27df9f){_0x253cfb=_0x253cfb-0x0;var _0x1c3b43=_0x7a54[_0x253cfb];return _0x1c3b43;};'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')]('Integration,\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/integrationReport/index.js b/server/api/integrationReport/index.js index 437d5c8..52b0b36 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x44be08,_0x314180){var _0x4a423a=function(_0x55bfb6){while(--_0x55bfb6){_0x44be08['push'](_0x44be08['shift']());}};_0x4a423a(++_0x314180);}(_0xba34,0x119));var _0x4ba3=function(_0x163667,_0x50df43){_0x163667=_0x163667-0x0;var _0x1aa67f=_0xba34[_0x163667];return _0x1aa67f;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file +var _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x1ea300,_0x128218){var _0x894b27=function(_0x184afb){while(--_0x184afb){_0x1ea300['push'](_0x1ea300['shift']());}};_0x894b27(++_0x128218);}(_0xba34,0x119));var _0x4ba3=function(_0x5e3ecd,_0x52da96){_0x5e3ecd=_0x5e3ecd-0x0;var _0x120f7f=_0xba34[_0x5e3ecd];return _0x120f7f;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 014524e..33ae0bb 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 _0xd034=['exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd034,0x6b));var _0x4d03=function(_0x367054,_0x1debc3){_0x367054=_0x367054-0x0;var _0x472454=_0xd034[_0x367054];return _0x472454;};'use strict';var Sequelize=require(_0x4d03('0x0'));module[_0x4d03('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x4d03('0x2')]},'ticketId':{'type':Sequelize[_0x4d03('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4d03('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x4d03('0x2')]},'membername':{'type':Sequelize[_0x4d03('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4d03('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4d03('0x3')]},'holdtime':{'type':Sequelize[_0x4d03('0x4')]},'agentcomplete':{'type':Sequelize[_0x4d03('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4d03('0x3')]},'talktime':{'type':Sequelize[_0x4d03('0x4')]},'agentacw':{'type':Sequelize[_0x4d03('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4d03('0x4')]},'reason':{'type':Sequelize[_0x4d03('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4d03('0x3')]},'agentdump':{'type':Sequelize[_0x4d03('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4d03('0x3')]},'lastevent':{'type':Sequelize[_0x4d03('0x2')]},'channel':{'type':Sequelize[_0x4d03('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x4d03('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4d03('0x2')]},'connectedlinename':{'type':Sequelize[_0x4d03('0x2')]},'language':{'type':Sequelize[_0x4d03('0x2')]},'accountcode':{'type':Sequelize[_0x4d03('0x2')]},'context':{'type':Sequelize[_0x4d03('0x2')]},'exten':{'type':Sequelize[_0x4d03('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4d03('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4d03('0x2')]},'destcalleridname':{'type':Sequelize[_0x4d03('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4d03('0x2')]},'destlanguage':{'type':Sequelize[_0x4d03('0x2')]},'destaccountcode':{'type':Sequelize[_0x4d03('0x2')]},'destcontext':{'type':Sequelize[_0x4d03('0x2')]},'destexten':{'type':Sequelize[_0x4d03('0x2')]},'destpriority':{'type':Sequelize[_0x4d03('0x2')]},'destuniqueid':{'type':Sequelize[_0x4d03('0x2')]},'messageId':{'type':Sequelize[_0x4d03('0x2')]},'inReplyTo':{'type':Sequelize[_0x4d03('0x2')]},'subject':{'type':Sequelize[_0x4d03('0x2')]},'from':{'type':Sequelize[_0x4d03('0x2')]},'to':{'type':Sequelize[_0x4d03('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x4d03('0x6')]},'html':{'type':Sequelize[_0x4d03('0x6')]},'text':{'type':Sequelize[_0x4d03('0x6')]},'status':{'type':Sequelize[_0x4d03('0x7')](_0x4d03('0x8'),_0x4d03('0x9'),_0x4d03('0xa'),_0x4d03('0xb'))},'url':{'type':Sequelize[_0x4d03('0x2')]},'app':{'type':Sequelize[_0x4d03('0x2')]},'appdata':{'type':Sequelize[_0x4d03('0x2')]},'projectId':{'type':Sequelize[_0x4d03('0x4')]}}; \ No newline at end of file +var _0x871a=['DATE','BOOLEAN','TEXT','SENT','SENDING','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x2f4be6,_0xee8a5b){var _0x5fc17=function(_0x48542a){while(--_0x48542a){_0x2f4be6['push'](_0x2f4be6['shift']());}};_0x5fc17(++_0xee8a5b);}(_0x871a,0x1dc));var _0xa871=function(_0x214a7b,_0x4e7847){_0x214a7b=_0x214a7b-0x0;var _0x36c004=_0x871a[_0x214a7b];return _0x36c004;};'use strict';var Sequelize=require(_0xa871('0x0'));module[_0xa871('0x1')]={'integration':{'type':Sequelize[_0xa871('0x2')]},'eventChannel':{'type':Sequelize[_0xa871('0x2')]},'exitStatus':{'type':Sequelize[_0xa871('0x2')]},'ticketId':{'type':Sequelize[_0xa871('0x2')]},'integrationId':{'type':Sequelize[_0xa871('0x3')]},'contacts':{'type':Sequelize[_0xa871('0x2')]},'uniqueid':{'type':Sequelize[_0xa871('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa871('0x2')]},'interface':{'type':Sequelize[_0xa871('0x2')]},'membername':{'type':Sequelize[_0xa871('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa871('0x4')]},'agentconnectAt':{'type':Sequelize[_0xa871('0x4')]},'holdtime':{'type':Sequelize[_0xa871('0x3')]},'agentcomplete':{'type':Sequelize[_0xa871('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa871('0x4')]},'talktime':{'type':Sequelize[_0xa871('0x3')]},'agentacw':{'type':Sequelize[_0xa871('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa871('0x3')]},'reason':{'type':Sequelize[_0xa871('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xa871('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa871('0x4')]},'agentdump':{'type':Sequelize[_0xa871('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xa871('0x3')]},'channelstatedesc':{'type':Sequelize[_0xa871('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa871('0x2')]},'connectedlinename':{'type':Sequelize[_0xa871('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa871('0x2')]},'context':{'type':Sequelize[_0xa871('0x2')]},'exten':{'type':Sequelize[_0xa871('0x2')]},'priority':{'type':Sequelize[_0xa871('0x2')]},'destchannel':{'type':Sequelize[_0xa871('0x2')]},'destchannelstate':{'type':Sequelize[_0xa871('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xa871('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa871('0x2')]},'destcalleridname':{'type':Sequelize[_0xa871('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa871('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xa871('0x2')]},'destpriority':{'type':Sequelize[_0xa871('0x2')]},'destuniqueid':{'type':Sequelize[_0xa871('0x2')]},'messageId':{'type':Sequelize[_0xa871('0x2')]},'inReplyTo':{'type':Sequelize[_0xa871('0x2')]},'subject':{'type':Sequelize[_0xa871('0x2')]},'from':{'type':Sequelize[_0xa871('0x2')]},'to':{'type':Sequelize[_0xa871('0x2')]},'cc':{'type':Sequelize[_0xa871('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xa871('0x6')]},'text':{'type':Sequelize[_0xa871('0x6')]},'status':{'type':Sequelize['ENUM'](_0xa871('0x7'),_0xa871('0x8'),'RECEIVED',_0xa871('0x9'))},'url':{'type':Sequelize[_0xa871('0x2')]},'app':{'type':Sequelize[_0xa871('0x2')]},'appdata':{'type':Sequelize[_0xa871('0x2')]},'projectId':{'type':Sequelize[_0xa871('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 06389f7..8257485 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 _0x0b0d=['fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','error','name','send','index','map','IntegrationReport','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','length','find','create','body','describe','zip-dir','fast-json-patch','moment','util','path'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x0b0d,0x154));var _0xd0b0=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x0b0d[_0x3ab9ee];return _0x82ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd0b0('0x0'));var jsonpatch=require(_0xd0b0('0x1'));var rp=require('request-promise');var moment=require(_0xd0b0('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd0b0('0x3'));var path=require(_0xd0b0('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0b0('0x5'));var _=require(_0xd0b0('0x6'));var squel=require(_0xd0b0('0x7'));var crypto=require('crypto');var jsforce=require(_0xd0b0('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xd0b0('0x9'));var querystring=require(_0xd0b0('0xa'));var Papa=require('papaparse');var Redis=require(_0xd0b0('0xb'));var authService=require(_0xd0b0('0xc'));var qs=require(_0xd0b0('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0b0('0xe'));var logger=require('../../config/logger')(_0xd0b0('0xf'));var utils=require(_0xd0b0('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd0b0('0x11'))['db'];function respondWithStatusCode(_0x333996,_0x54df01){_0x54df01=_0x54df01||0xcc;return function(_0x1c325b){if(_0x1c325b){return _0x333996[_0xd0b0('0x12')](_0x54df01);}return _0x333996[_0xd0b0('0x13')](_0x54df01)[_0xd0b0('0x14')]();};}function respondWithResult(_0x5b7149,_0x5d81a9){_0x5d81a9=_0x5d81a9||0xc8;return function(_0x4181c0){if(_0x4181c0){return _0x5b7149[_0xd0b0('0x13')](_0x5d81a9)['json'](_0x4181c0);}};}function respondWithFilteredResult(_0x56393b,_0xc3b578){return function(_0x1abe27){if(_0x1abe27){var _0x26bc6b=typeof _0xc3b578[_0xd0b0('0x15')]===_0xd0b0('0x16')&&typeof _0xc3b578[_0xd0b0('0x17')]===_0xd0b0('0x16');var _0x5f2330=_0x1abe27[_0xd0b0('0x18')];var _0x4e2b8d=_0x26bc6b?0x0:_0xc3b578['offset'];var _0x515b59=_0x26bc6b?_0x1abe27[_0xd0b0('0x18')]:_0xc3b578[_0xd0b0('0x15')]+_0xc3b578['limit'];var _0x1db4cd;if(_0x515b59>=_0x5f2330){_0x515b59=_0x5f2330;_0x1db4cd=0xc8;}else{_0x1db4cd=0xce;}_0x56393b[_0xd0b0('0x13')](_0x1db4cd);return _0x56393b[_0xd0b0('0x19')](_0xd0b0('0x1a'),_0x4e2b8d+'-'+_0x515b59+'/'+_0x5f2330)[_0xd0b0('0x1b')](_0x1abe27);}return null;};}function patchUpdates(_0x549883){return function(_0x33f2f4){try{jsonpatch['apply'](_0x33f2f4,_0x549883,!![]);}catch(_0x25f2ff){return BPromise['reject'](_0x25f2ff);}return _0x33f2f4[_0xd0b0('0x1c')]();};}function saveUpdates(_0xdb2ad,_0x18b3d7){return function(_0x2b88fc){if(_0x2b88fc){return _0x2b88fc[_0xd0b0('0x1d')](_0xdb2ad)[_0xd0b0('0x1e')](function(_0x284ea9){return _0x284ea9;});}return null;};}function removeEntity(_0x57d6f2,_0x4206b3){return function(_0x3d343a){if(_0x3d343a){return _0x3d343a['destroy']()[_0xd0b0('0x1e')](function(){_0x57d6f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x563d9e,_0x1d998c){return function(_0x3f6ad9){if(!_0x3f6ad9){_0x563d9e[_0xd0b0('0x12')](0x194);}return _0x3f6ad9;};}function handleError(_0x316827,_0x302a6e){_0x302a6e=_0x302a6e||0x1f4;return function(_0xfeeda2){logger[_0xd0b0('0x1f')](_0xfeeda2['stack']);if(_0xfeeda2['name']){delete _0xfeeda2[_0xd0b0('0x20')];}_0x316827[_0xd0b0('0x13')](_0x302a6e)[_0xd0b0('0x21')](_0xfeeda2);};}exports[_0xd0b0('0x22')]=function(_0x1667b8,_0x5bbff5){var _0x5729fa={},_0x3b256b={},_0x186968={'count':0x0,'rows':[]};var _0xe9a90b=_[_0xd0b0('0x23')](db[_0xd0b0('0x24')]['rawAttributes'],function(_0x230d17){return{'name':_0x230d17[_0xd0b0('0x25')],'type':_0x230d17['type'][_0xd0b0('0x26')]};});_0x3b256b[_0xd0b0('0x27')]=_[_0xd0b0('0x23')](_0xe9a90b,_0xd0b0('0x20'));_0x3b256b['query']=_['keys'](_0x1667b8[_0xd0b0('0x28')]);_0x3b256b[_0xd0b0('0x29')]=_['intersection'](_0x3b256b[_0xd0b0('0x27')],_0x3b256b['query']);_0x5729fa[_0xd0b0('0x2a')]=_['intersection'](_0x3b256b['model'],qs[_0xd0b0('0x2b')](_0x1667b8[_0xd0b0('0x28')][_0xd0b0('0x2b')]));_0x5729fa['attributes']=_0x5729fa['attributes']['length']?_0x5729fa[_0xd0b0('0x2a')]:_0x3b256b[_0xd0b0('0x27')];if(!_0x1667b8[_0xd0b0('0x28')][_0xd0b0('0x2c')](_0xd0b0('0x2d'))){_0x5729fa[_0xd0b0('0x17')]=qs[_0xd0b0('0x17')](_0x1667b8[_0xd0b0('0x28')]['limit']);_0x5729fa[_0xd0b0('0x15')]=qs[_0xd0b0('0x15')](_0x1667b8['query'][_0xd0b0('0x15')]);}_0x5729fa[_0xd0b0('0x2e')]=qs[_0xd0b0('0x2f')](_0x1667b8[_0xd0b0('0x28')]['sort']);_0x5729fa[_0xd0b0('0x30')]=qs[_0xd0b0('0x29')](_[_0xd0b0('0x31')](_0x1667b8[_0xd0b0('0x28')],_0x3b256b[_0xd0b0('0x29')]),_0xe9a90b);if(_0x1667b8[_0xd0b0('0x28')][_0xd0b0('0x32')]){_0x5729fa[_0xd0b0('0x30')]=_[_0xd0b0('0x33')](_0x5729fa[_0xd0b0('0x30')],{'$or':_[_0xd0b0('0x23')](_0xe9a90b,function(_0x447e7d){if(_0x447e7d['type']!==_0xd0b0('0x34')){var _0x2c451f={};_0x2c451f[_0x447e7d[_0xd0b0('0x20')]]={'$like':'%'+_0x1667b8[_0xd0b0('0x28')][_0xd0b0('0x32')]+'%'};return _0x2c451f;}})});}_0x5729fa=_[_0xd0b0('0x33')]({},_0x5729fa,_0x1667b8[_0xd0b0('0x35')]);var _0x1fbd92={'where':_0x5729fa['where']};return db[_0xd0b0('0x24')][_0xd0b0('0x18')](_0x1fbd92)[_0xd0b0('0x1e')](function(_0x1e3d94){_0x186968[_0xd0b0('0x18')]=_0x1e3d94;if(_0x1667b8[_0xd0b0('0x28')][_0xd0b0('0x36')]){_0x5729fa[_0xd0b0('0x37')]=[{'all':!![]}];}return db[_0xd0b0('0x24')][_0xd0b0('0x38')](_0x5729fa);})['then'](function(_0x5cd662){_0x186968[_0xd0b0('0x39')]=_0x5cd662;return _0x186968;})['then'](respondWithFilteredResult(_0x5bbff5,_0x5729fa))[_0xd0b0('0x3a')](handleError(_0x5bbff5,null));};exports[_0xd0b0('0x3b')]=function(_0x51eb39,_0x3cc8e2){var _0x44c061={'raw':![],'where':{'id':_0x51eb39[_0xd0b0('0x3c')]['id']}},_0x3dc5de={};_0x3dc5de[_0xd0b0('0x27')]=_[_0xd0b0('0x3d')](db[_0xd0b0('0x24')][_0xd0b0('0x3e')]);_0x3dc5de[_0xd0b0('0x28')]=_[_0xd0b0('0x3d')](_0x51eb39[_0xd0b0('0x28')]);_0x3dc5de[_0xd0b0('0x29')]=_[_0xd0b0('0x3f')](_0x3dc5de[_0xd0b0('0x27')],_0x3dc5de[_0xd0b0('0x28')]);_0x44c061[_0xd0b0('0x2a')]=_['intersection'](_0x3dc5de[_0xd0b0('0x27')],qs['fields'](_0x51eb39[_0xd0b0('0x28')]['fields']));_0x44c061[_0xd0b0('0x2a')]=_0x44c061[_0xd0b0('0x2a')][_0xd0b0('0x40')]?_0x44c061[_0xd0b0('0x2a')]:_0x3dc5de[_0xd0b0('0x27')];if(_0x51eb39['query'][_0xd0b0('0x36')]){_0x44c061[_0xd0b0('0x37')]=[{'all':!![]}];}_0x44c061=_[_0xd0b0('0x33')]({},_0x44c061,_0x51eb39[_0xd0b0('0x35')]);return db[_0xd0b0('0x24')][_0xd0b0('0x41')](_0x44c061)['then'](handleEntityNotFound(_0x3cc8e2,null))[_0xd0b0('0x1e')](respondWithResult(_0x3cc8e2,null))[_0xd0b0('0x3a')](handleError(_0x3cc8e2,null));};exports[_0xd0b0('0x42')]=function(_0x100401,_0x5110a7){return db[_0xd0b0('0x24')][_0xd0b0('0x42')](_0x100401[_0xd0b0('0x43')],{})[_0xd0b0('0x1e')](respondWithResult(_0x5110a7,0xc9))[_0xd0b0('0x3a')](handleError(_0x5110a7,null));};exports[_0xd0b0('0x1d')]=function(_0x416752,_0xf5925a){if(_0x416752[_0xd0b0('0x43')]['id']){delete _0x416752['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x416752['params']['id']}})[_0xd0b0('0x1e')](handleEntityNotFound(_0xf5925a,null))[_0xd0b0('0x1e')](saveUpdates(_0x416752['body'],null))[_0xd0b0('0x1e')](respondWithResult(_0xf5925a,null))[_0xd0b0('0x3a')](handleError(_0xf5925a,null));};exports['destroy']=function(_0x313598,_0xaf0157){return db[_0xd0b0('0x24')]['find']({'where':{'id':_0x313598[_0xd0b0('0x3c')]['id']}})[_0xd0b0('0x1e')](handleEntityNotFound(_0xaf0157,null))[_0xd0b0('0x1e')](removeEntity(_0xaf0157,null))[_0xd0b0('0x3a')](handleError(_0xaf0157,null));};exports[_0xd0b0('0x44')]=function(_0x13226d,_0x48fc7b){return db[_0xd0b0('0x24')][_0xd0b0('0x44')]()[_0xd0b0('0x1e')](respondWithResult(_0x48fc7b,null))[_0xd0b0('0x3a')](handleError(_0x48fc7b,null));}; \ No newline at end of file +var _0x00ac=['then','destroy','stack','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','name','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','save','update'];(function(_0x53cc08,_0x3c4ee9){var _0x29d3fc=function(_0x114725){while(--_0x114725){_0x53cc08['push'](_0x53cc08['shift']());}};_0x29d3fc(++_0x3c4ee9);}(_0x00ac,0xbf));var _0xc00a=function(_0x2d827e,_0x1ae619){_0x2d827e=_0x2d827e-0x0;var _0x5d180c=_0x00ac[_0x2d827e];return _0x5d180c;};'use strict';var emlformat=require(_0xc00a('0x0'));var rimraf=require(_0xc00a('0x1'));var zipdir=require(_0xc00a('0x2'));var jsonpatch=require(_0xc00a('0x3'));var rp=require(_0xc00a('0x4'));var moment=require('moment');var BPromise=require(_0xc00a('0x5'));var Mustache=require(_0xc00a('0x6'));var util=require(_0xc00a('0x7'));var path=require(_0xc00a('0x8'));var sox=require(_0xc00a('0x9'));var csv=require(_0xc00a('0xa'));var ejs=require(_0xc00a('0xb'));var fs=require('fs');var fs_extra=require(_0xc00a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc00a('0xd'));var deskjs=require(_0xc00a('0xe'));var toCsv=require(_0xc00a('0xa'));var querystring=require(_0xc00a('0xf'));var Papa=require(_0xc00a('0x10'));var Redis=require(_0xc00a('0x11'));var authService=require(_0xc00a('0x12'));var qs=require(_0xc00a('0x13'));var as=require(_0xc00a('0x14'));var hardwareService=require(_0xc00a('0x15'));var logger=require(_0xc00a('0x16'))(_0xc00a('0x17'));var utils=require('../../config/utils');var config=require(_0xc00a('0x18'));var licenseUtil=require(_0xc00a('0x19'));var db=require(_0xc00a('0x1a'))['db'];function respondWithStatusCode(_0x25aaae,_0x4bcd72){_0x4bcd72=_0x4bcd72||0xcc;return function(_0x5ac2dd){if(_0x5ac2dd){return _0x25aaae[_0xc00a('0x1b')](_0x4bcd72);}return _0x25aaae[_0xc00a('0x1c')](_0x4bcd72)[_0xc00a('0x1d')]();};}function respondWithResult(_0x24f245,_0x5dbcdf){_0x5dbcdf=_0x5dbcdf||0xc8;return function(_0x5f10df){if(_0x5f10df){return _0x24f245[_0xc00a('0x1c')](_0x5dbcdf)[_0xc00a('0x1e')](_0x5f10df);}};}function respondWithFilteredResult(_0x22a06c,_0x20c3d1){return function(_0xcde404){if(_0xcde404){var _0x3a60f4=typeof _0x20c3d1[_0xc00a('0x1f')]===_0xc00a('0x20')&&typeof _0x20c3d1[_0xc00a('0x21')]==='undefined';var _0x4d167f=_0xcde404[_0xc00a('0x22')];var _0x3337e2=_0x3a60f4?0x0:_0x20c3d1['offset'];var _0x5adb14=_0x3a60f4?_0xcde404[_0xc00a('0x22')]:_0x20c3d1[_0xc00a('0x1f')]+_0x20c3d1[_0xc00a('0x21')];var _0x3d0b5d;if(_0x5adb14>=_0x4d167f){_0x5adb14=_0x4d167f;_0x3d0b5d=0xc8;}else{_0x3d0b5d=0xce;}_0x22a06c[_0xc00a('0x1c')](_0x3d0b5d);return _0x22a06c['set']('Content-Range',_0x3337e2+'-'+_0x5adb14+'/'+_0x4d167f)[_0xc00a('0x1e')](_0xcde404);}return null;};}function patchUpdates(_0xadabc2){return function(_0x56c559){try{jsonpatch['apply'](_0x56c559,_0xadabc2,!![]);}catch(_0x5a8515){return BPromise['reject'](_0x5a8515);}return _0x56c559[_0xc00a('0x23')]();};}function saveUpdates(_0x8b1d5a,_0x25ec3d){return function(_0x5be764){if(_0x5be764){return _0x5be764[_0xc00a('0x24')](_0x8b1d5a)[_0xc00a('0x25')](function(_0x46a2ac){return _0x46a2ac;});}return null;};}function removeEntity(_0x108aee,_0x2a4610){return function(_0x5dd25b){if(_0x5dd25b){return _0x5dd25b[_0xc00a('0x26')]()[_0xc00a('0x25')](function(){_0x108aee[_0xc00a('0x1c')](0xcc)[_0xc00a('0x1d')]();});}};}function handleEntityNotFound(_0x5c8185,_0x507175){return function(_0x140621){if(!_0x140621){_0x5c8185[_0xc00a('0x1b')](0x194);}return _0x140621;};}function handleError(_0x564a66,_0x27f1a6){_0x27f1a6=_0x27f1a6||0x1f4;return function(_0x2a894e){logger['error'](_0x2a894e[_0xc00a('0x27')]);if(_0x2a894e['name']){delete _0x2a894e['name'];}_0x564a66[_0xc00a('0x1c')](_0x27f1a6)[_0xc00a('0x28')](_0x2a894e);};}exports[_0xc00a('0x29')]=function(_0x4b6b79,_0x17ab8c){var _0x5d68e5={},_0x90cc9b={},_0x1acde0={'count':0x0,'rows':[]};var _0x33b8f6=_[_0xc00a('0x2a')](db[_0xc00a('0x2b')][_0xc00a('0x2c')],function(_0x4160e5){return{'name':_0x4160e5[_0xc00a('0x2d')],'type':_0x4160e5[_0xc00a('0x2e')][_0xc00a('0x2f')]};});_0x90cc9b['model']=_[_0xc00a('0x2a')](_0x33b8f6,_0xc00a('0x30'));_0x90cc9b[_0xc00a('0x31')]=_['keys'](_0x4b6b79[_0xc00a('0x31')]);_0x90cc9b[_0xc00a('0x32')]=_['intersection'](_0x90cc9b[_0xc00a('0x33')],_0x90cc9b[_0xc00a('0x31')]);_0x5d68e5[_0xc00a('0x34')]=_[_0xc00a('0x35')](_0x90cc9b[_0xc00a('0x33')],qs[_0xc00a('0x36')](_0x4b6b79[_0xc00a('0x31')][_0xc00a('0x36')]));_0x5d68e5[_0xc00a('0x34')]=_0x5d68e5[_0xc00a('0x34')][_0xc00a('0x37')]?_0x5d68e5[_0xc00a('0x34')]:_0x90cc9b[_0xc00a('0x33')];if(!_0x4b6b79[_0xc00a('0x31')][_0xc00a('0x38')](_0xc00a('0x39'))){_0x5d68e5[_0xc00a('0x21')]=qs['limit'](_0x4b6b79[_0xc00a('0x31')][_0xc00a('0x21')]);_0x5d68e5['offset']=qs[_0xc00a('0x1f')](_0x4b6b79[_0xc00a('0x31')][_0xc00a('0x1f')]);}_0x5d68e5[_0xc00a('0x3a')]=qs[_0xc00a('0x3b')](_0x4b6b79[_0xc00a('0x31')][_0xc00a('0x3b')]);_0x5d68e5[_0xc00a('0x3c')]=qs['filters'](_[_0xc00a('0x3d')](_0x4b6b79[_0xc00a('0x31')],_0x90cc9b[_0xc00a('0x32')]),_0x33b8f6);if(_0x4b6b79[_0xc00a('0x31')][_0xc00a('0x3e')]){_0x5d68e5[_0xc00a('0x3c')]=_[_0xc00a('0x3f')](_0x5d68e5[_0xc00a('0x3c')],{'$or':_['map'](_0x33b8f6,function(_0x209834){if(_0x209834[_0xc00a('0x2e')]!==_0xc00a('0x40')){var _0x1172c8={};_0x1172c8[_0x209834[_0xc00a('0x30')]]={'$like':'%'+_0x4b6b79[_0xc00a('0x31')][_0xc00a('0x3e')]+'%'};return _0x1172c8;}})});}_0x5d68e5=_[_0xc00a('0x3f')]({},_0x5d68e5,_0x4b6b79[_0xc00a('0x41')]);var _0x5664fc={'where':_0x5d68e5[_0xc00a('0x3c')]};return db[_0xc00a('0x2b')][_0xc00a('0x22')](_0x5664fc)[_0xc00a('0x25')](function(_0x5e988c){_0x1acde0['count']=_0x5e988c;if(_0x4b6b79[_0xc00a('0x31')][_0xc00a('0x42')]){_0x5d68e5[_0xc00a('0x43')]=[{'all':!![]}];}return db['IntegrationReport'][_0xc00a('0x44')](_0x5d68e5);})['then'](function(_0x37e3a0){_0x1acde0['rows']=_0x37e3a0;return _0x1acde0;})[_0xc00a('0x25')](respondWithFilteredResult(_0x17ab8c,_0x5d68e5))[_0xc00a('0x45')](handleError(_0x17ab8c,null));};exports['show']=function(_0xeb7eb7,_0x1a4c62){var _0x5564aa={'raw':![],'where':{'id':_0xeb7eb7[_0xc00a('0x46')]['id']}},_0x1ea292={};_0x1ea292[_0xc00a('0x33')]=_[_0xc00a('0x47')](db[_0xc00a('0x2b')][_0xc00a('0x2c')]);_0x1ea292['query']=_['keys'](_0xeb7eb7[_0xc00a('0x31')]);_0x1ea292[_0xc00a('0x32')]=_[_0xc00a('0x35')](_0x1ea292['model'],_0x1ea292[_0xc00a('0x31')]);_0x5564aa[_0xc00a('0x34')]=_[_0xc00a('0x35')](_0x1ea292[_0xc00a('0x33')],qs[_0xc00a('0x36')](_0xeb7eb7[_0xc00a('0x31')][_0xc00a('0x36')]));_0x5564aa[_0xc00a('0x34')]=_0x5564aa[_0xc00a('0x34')]['length']?_0x5564aa[_0xc00a('0x34')]:_0x1ea292[_0xc00a('0x33')];if(_0xeb7eb7[_0xc00a('0x31')][_0xc00a('0x42')]){_0x5564aa[_0xc00a('0x43')]=[{'all':!![]}];}_0x5564aa=_['merge']({},_0x5564aa,_0xeb7eb7[_0xc00a('0x41')]);return db[_0xc00a('0x2b')][_0xc00a('0x48')](_0x5564aa)[_0xc00a('0x25')](handleEntityNotFound(_0x1a4c62,null))[_0xc00a('0x25')](respondWithResult(_0x1a4c62,null))[_0xc00a('0x45')](handleError(_0x1a4c62,null));};exports[_0xc00a('0x49')]=function(_0xceb634,_0x462669){return db[_0xc00a('0x2b')][_0xc00a('0x49')](_0xceb634[_0xc00a('0x4a')],{})[_0xc00a('0x25')](respondWithResult(_0x462669,0xc9))[_0xc00a('0x45')](handleError(_0x462669,null));};exports[_0xc00a('0x24')]=function(_0x4c3ee8,_0x1e81f7){if(_0x4c3ee8[_0xc00a('0x4a')]['id']){delete _0x4c3ee8[_0xc00a('0x4a')]['id'];}return db[_0xc00a('0x2b')][_0xc00a('0x48')]({'where':{'id':_0x4c3ee8[_0xc00a('0x46')]['id']}})[_0xc00a('0x25')](handleEntityNotFound(_0x1e81f7,null))[_0xc00a('0x25')](saveUpdates(_0x4c3ee8[_0xc00a('0x4a')],null))['then'](respondWithResult(_0x1e81f7,null))['catch'](handleError(_0x1e81f7,null));};exports[_0xc00a('0x26')]=function(_0x2094fc,_0x430e07){return db[_0xc00a('0x2b')][_0xc00a('0x48')]({'where':{'id':_0x2094fc[_0xc00a('0x46')]['id']}})[_0xc00a('0x25')](handleEntityNotFound(_0x430e07,null))['then'](removeEntity(_0x430e07,null))[_0xc00a('0x45')](handleError(_0x430e07,null));};exports['describe']=function(_0x4cdbcf,_0x3904b9){return db[_0xc00a('0x2b')][_0xc00a('0x4b')]()[_0xc00a('0x25')](respondWithResult(_0x3904b9,null))[_0xc00a('0x45')](handleError(_0x3904b9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6de67c4..eb10f43 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 _0xcf20=['IntegrationReport','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0xcf20,0x1ed));var _0x0cf2=function(_0x39ea5d,_0x293d49){_0x39ea5d=_0x39ea5d-0x0;var _0x271394=_0xcf20[_0x39ea5d];return _0x271394;};'use strict';var _=require(_0x0cf2('0x0'));var util=require(_0x0cf2('0x1'));var logger=require(_0x0cf2('0x2'))(_0x0cf2('0x3'));var moment=require('moment');var BPromise=require(_0x0cf2('0x4'));var rp=require(_0x0cf2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cf2('0x6'));var config=require(_0x0cf2('0x7'));var attributes=require(_0x0cf2('0x8'));module[_0x0cf2('0x9')]=function(_0x585ac7,_0x58ab3c){return _0x585ac7[_0x0cf2('0xa')](_0x0cf2('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48a0=['rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d8a02,_0x559736){var _0xb01ff4=function(_0x5095a8){while(--_0x5095a8){_0x2d8a02['push'](_0x2d8a02['shift']());}};_0xb01ff4(++_0x559736);}(_0x48a0,0x19c));var _0x048a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x48a0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x048a('0x0'));var util=require(_0x048a('0x1'));var logger=require(_0x048a('0x2'))(_0x048a('0x3'));var moment=require(_0x048a('0x4'));var BPromise=require(_0x048a('0x5'));var rp=require(_0x048a('0x6'));var fs=require('fs');var path=require(_0x048a('0x7'));var rimraf=require(_0x048a('0x8'));var config=require(_0x048a('0x9'));var attributes=require(_0x048a('0xa'));module[_0x048a('0xb')]=function(_0x38081e,_0x3b525c){return _0x38081e[_0x048a('0xc')](_0x048a('0xd'),attributes,{'tableName':_0x048a('0xe'),'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 3d3c415..870bba7 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0xf494,0x1c6));var _0x4f49=function(_0x21b9fe,_0x4a505a){_0x21b9fe=_0x21b9fe-0x0;var _0x5da6b0=_0xf494[_0x21b9fe];return _0x5da6b0;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x574b70,_0x278385){var _0x5dd834=function(_0xba13cd){while(--_0xba13cd){_0x574b70['push'](_0x574b70['shift']());}};_0x5dd834(++_0x278385);}(_0x0295,0x1f0));var _0x5029=function(_0x14dbe6,_0x3b32fc){_0x14dbe6=_0x14dbe6-0x0;var _0x58bb00=_0x0295[_0x14dbe6];return _0x58bb00;};'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')]('IntegrationReport,\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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index de39cb2..4f81f61 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 _0xcf67=['post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x30b077,_0x5a9aa7){var _0x599659=function(_0x67a7fd){while(--_0x67a7fd){_0x30b077['push'](_0x30b077['shift']());}};_0x599659(++_0x5a9aa7);}(_0xcf67,0x1ed));var _0x7cf6=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0xcf67[_0x498334];return _0x13bb70;};'use strict';var multer=require(_0x7cf6('0x0'));var util=require(_0x7cf6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7cf6('0x2'));var router=express['Router']();var fs_extra=require(_0x7cf6('0x3'));var auth=require(_0x7cf6('0x4'));var interaction=require(_0x7cf6('0x5'));var config=require(_0x7cf6('0x6'));var controller=require('./interval.controller');router[_0x7cf6('0x7')]('/',auth['isAuthenticated'](),controller[_0x7cf6('0x8')]);router[_0x7cf6('0x7')](_0x7cf6('0x9'),auth[_0x7cf6('0xa')](),controller['show']);router['get']('/:id/sub_intervals',auth['isAuthenticated'](),controller['getIntervals']);router[_0x7cf6('0xb')]('/',auth[_0x7cf6('0xa')](),controller[_0x7cf6('0xc')]);router[_0x7cf6('0xb')](_0x7cf6('0xd'),auth[_0x7cf6('0xa')](),controller[_0x7cf6('0xe')]);router[_0x7cf6('0xb')](_0x7cf6('0xf'),auth[_0x7cf6('0xa')](),controller[_0x7cf6('0x10')]);router[_0x7cf6('0x11')](_0x7cf6('0x9'),auth[_0x7cf6('0xa')](),controller['update']);router[_0x7cf6('0x12')](_0x7cf6('0x9'),auth[_0x7cf6('0xa')](),controller[_0x7cf6('0x13')]);module[_0x7cf6('0x14')]=router; \ No newline at end of file +var _0x27af=['isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./interval.controller','get'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x27af,0x199));var _0xf27a=function(_0x4a73e0,_0x509993){_0x4a73e0=_0x4a73e0-0x0;var _0x129d4b=_0x27af[_0x4a73e0];return _0x129d4b;};'use strict';var multer=require(_0xf27a('0x0'));var util=require(_0xf27a('0x1'));var path=require(_0xf27a('0x2'));var timeout=require('connect-timeout');var express=require(_0xf27a('0x3'));var router=express[_0xf27a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf27a('0x5'));var config=require(_0xf27a('0x6'));var controller=require(_0xf27a('0x7'));router[_0xf27a('0x8')]('/',auth[_0xf27a('0x9')](),controller[_0xf27a('0xa')]);router[_0xf27a('0x8')](_0xf27a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf27a('0x8')](_0xf27a('0xc'),auth[_0xf27a('0x9')](),controller[_0xf27a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf27a('0xe')]);router[_0xf27a('0xf')](_0xf27a('0xc'),auth[_0xf27a('0x9')](),controller[_0xf27a('0x10')]);router[_0xf27a('0xf')](_0xf27a('0x11'),auth[_0xf27a('0x9')](),controller[_0xf27a('0x12')]);router[_0xf27a('0x13')](_0xf27a('0xb'),auth[_0xf27a('0x9')](),controller['update']);router[_0xf27a('0x14')]('/:id',auth[_0xf27a('0x9')](),controller[_0xf27a('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index cda43fa..f6b20ad 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 _0xd80a=['STRING','sequelize','exports'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xd80a,0x88));var _0xad80=function(_0x52586c,_0x31e2b7){_0x52586c=_0x52586c-0x0;var _0x1b7419=_0xd80a[_0x52586c];return _0x1b7419;};'use strict';var Sequelize=require(_0xad80('0x0'));module[_0xad80('0x1')]={'name':{'type':Sequelize[_0xad80('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xad80('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3af5=['STRING'];(function(_0x389c8a,_0x387eef){var _0x26a356=function(_0x56a36d){while(--_0x56a36d){_0x389c8a['push'](_0x389c8a['shift']());}};_0x26a356(++_0x387eef);}(_0x3af5,0xc5));var _0x53af=function(_0x12d917,_0x59ddd4){_0x12d917=_0x12d917-0x0;var _0x576d1a=_0x3af5[_0x12d917];return _0x576d1a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x53af('0x0')]},'description':{'type':Sequelize[_0x53af('0x0')]},'interval':{'type':Sequelize[_0x53af('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 3cf68f6..a3feea9 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 _0x1d65=['offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','get','Intervals','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Interval','findAll','params','intersection','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','update','body','addInterval','IntervalId','getIntervals','findOne','addIntervals','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','json'];(function(_0x2e1e3d,_0x2d6648){var _0x129355=function(_0x2f341a){while(--_0x2f341a){_0x2e1e3d['push'](_0x2e1e3d['shift']());}};_0x129355(++_0x2d6648);}(_0x1d65,0x97));var _0x51d6=function(_0x149ab3,_0x42172b){_0x149ab3=_0x149ab3-0x0;var _0xa0ee4a=_0x1d65[_0x149ab3];return _0xa0ee4a;};'use strict';var emlformat=require(_0x51d6('0x0'));var rimraf=require(_0x51d6('0x1'));var zipdir=require(_0x51d6('0x2'));var jsonpatch=require(_0x51d6('0x3'));var rp=require(_0x51d6('0x4'));var moment=require('moment');var BPromise=require(_0x51d6('0x5'));var Mustache=require(_0x51d6('0x6'));var util=require(_0x51d6('0x7'));var path=require(_0x51d6('0x8'));var sox=require(_0x51d6('0x9'));var csv=require(_0x51d6('0xa'));var ejs=require(_0x51d6('0xb'));var fs=require('fs');var fs_extra=require(_0x51d6('0xc'));var _=require('lodash');var squel=require(_0x51d6('0xd'));var crypto=require(_0x51d6('0xe'));var jsforce=require(_0x51d6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x51d6('0xa'));var querystring=require(_0x51d6('0x10'));var Papa=require(_0x51d6('0x11'));var Redis=require(_0x51d6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x51d6('0x13'));var as=require(_0x51d6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x51d6('0x15'));var utils=require('../../config/utils');var config=require(_0x51d6('0x16'));var licenseUtil=require(_0x51d6('0x17'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x23a070,_0x20e5a2){_0x20e5a2=_0x20e5a2||0xcc;return function(_0x3c8259){if(_0x3c8259){return _0x23a070[_0x51d6('0x18')](_0x20e5a2);}return _0x23a070[_0x51d6('0x19')](_0x20e5a2)['end']();};}function respondWithResult(_0x21d8ee,_0x5bdc3c){_0x5bdc3c=_0x5bdc3c||0xc8;return function(_0x11f4ba){if(_0x11f4ba){return _0x21d8ee[_0x51d6('0x19')](_0x5bdc3c)[_0x51d6('0x1a')](_0x11f4ba);}};}function respondWithFilteredResult(_0x3c7262,_0x133b76){return function(_0x22d798){if(_0x22d798){var _0x47884d=typeof _0x133b76[_0x51d6('0x1b')]==='undefined'&&typeof _0x133b76[_0x51d6('0x1c')]===_0x51d6('0x1d');var _0x4a8b66=_0x22d798[_0x51d6('0x1e')];var _0x477253=_0x47884d?0x0:_0x133b76[_0x51d6('0x1b')];var _0x5b379f=_0x47884d?_0x22d798['count']:_0x133b76[_0x51d6('0x1b')]+_0x133b76[_0x51d6('0x1c')];var _0x40c017;if(_0x5b379f>=_0x4a8b66){_0x5b379f=_0x4a8b66;_0x40c017=0xc8;}else{_0x40c017=0xce;}_0x3c7262[_0x51d6('0x19')](_0x40c017);return _0x3c7262[_0x51d6('0x1f')](_0x51d6('0x20'),_0x477253+'-'+_0x5b379f+'/'+_0x4a8b66)[_0x51d6('0x1a')](_0x22d798);}return null;};}function patchUpdates(_0x1ed01b){return function(_0x346548){try{jsonpatch[_0x51d6('0x21')](_0x346548,_0x1ed01b,!![]);}catch(_0x1b7f95){return BPromise[_0x51d6('0x22')](_0x1b7f95);}return _0x346548[_0x51d6('0x23')]();};}function saveUpdates(_0x2d6e65,_0x4264d5){return function(_0x29bde5){if(_0x29bde5){return _0x29bde5['update'](_0x2d6e65)[_0x51d6('0x24')](function(_0x343924){return _0x343924;});}return null;};}function removeEntity(_0x19e799,_0x373ed6){return function(_0x5ae07d){if(_0x5ae07d){return _0x5ae07d['destroy']()[_0x51d6('0x24')](function(){var _0x5a4c6d=_0x5ae07d[_0x51d6('0x25')]({'plain':!![]});var _0x171d4a=_0x51d6('0x26');return db[_0x51d6('0x27')][_0x51d6('0x28')]({'where':{'type':_0x171d4a,'resourceId':_0x5a4c6d['id']}})['then'](function(){return _0x5ae07d;});})[_0x51d6('0x24')](function(){_0x19e799[_0x51d6('0x19')](0xcc)[_0x51d6('0x29')]();});}};}function handleEntityNotFound(_0x4b9f89,_0x679556){return function(_0x249192){if(!_0x249192){_0x4b9f89[_0x51d6('0x18')](0x194);}return _0x249192;};}function handleError(_0x7e079a,_0x23e14b){_0x23e14b=_0x23e14b||0x1f4;return function(_0xc2bbea){logger[_0x51d6('0x2a')](_0xc2bbea[_0x51d6('0x2b')]);if(_0xc2bbea[_0x51d6('0x2c')]){delete _0xc2bbea[_0x51d6('0x2c')];}_0x7e079a[_0x51d6('0x19')](_0x23e14b)[_0x51d6('0x2d')](_0xc2bbea);};}exports[_0x51d6('0x2e')]=function(_0x1969bf,_0x5d45ff){var _0x3825f1={},_0x1ba6cd={},_0x454c8d={'count':0x0,'rows':[]};var _0x59768f=_[_0x51d6('0x2f')](db['Interval'][_0x51d6('0x30')],function(_0x1c3834){return{'name':_0x1c3834[_0x51d6('0x31')],'type':_0x1c3834[_0x51d6('0x32')][_0x51d6('0x33')]};});_0x1ba6cd[_0x51d6('0x34')]=_[_0x51d6('0x2f')](_0x59768f,'name');_0x1ba6cd[_0x51d6('0x35')]=_[_0x51d6('0x36')](_0x1969bf[_0x51d6('0x35')]);_0x1ba6cd[_0x51d6('0x37')]=_['intersection'](_0x1ba6cd[_0x51d6('0x34')],_0x1ba6cd[_0x51d6('0x35')]);_0x3825f1[_0x51d6('0x38')]=_['intersection'](_0x1ba6cd[_0x51d6('0x34')],qs[_0x51d6('0x39')](_0x1969bf[_0x51d6('0x35')][_0x51d6('0x39')]));_0x3825f1[_0x51d6('0x38')]=_0x3825f1[_0x51d6('0x38')][_0x51d6('0x3a')]?_0x3825f1[_0x51d6('0x38')]:_0x1ba6cd[_0x51d6('0x34')];if(!_0x1969bf[_0x51d6('0x35')][_0x51d6('0x3b')](_0x51d6('0x3c'))){_0x3825f1[_0x51d6('0x1c')]=qs[_0x51d6('0x1c')](_0x1969bf[_0x51d6('0x35')]['limit']);_0x3825f1[_0x51d6('0x1b')]=qs[_0x51d6('0x1b')](_0x1969bf['query'][_0x51d6('0x1b')]);}_0x3825f1[_0x51d6('0x3d')]=qs[_0x51d6('0x3e')](_0x1969bf[_0x51d6('0x35')]['sort']);_0x3825f1[_0x51d6('0x3f')]=qs[_0x51d6('0x37')](_[_0x51d6('0x40')](_0x1969bf[_0x51d6('0x35')],_0x1ba6cd[_0x51d6('0x37')]),_0x59768f);if(_0x1969bf['query'][_0x51d6('0x41')]){_0x3825f1['where']=_[_0x51d6('0x42')](_0x3825f1[_0x51d6('0x3f')],{'$or':_[_0x51d6('0x2f')](_0x59768f,function(_0x336f4e){if(_0x336f4e[_0x51d6('0x32')]!=='VIRTUAL'){var _0x3a869a={};_0x3a869a[_0x336f4e[_0x51d6('0x2c')]]={'$like':'%'+_0x1969bf[_0x51d6('0x35')]['filter']+'%'};return _0x3a869a;}})});}_0x3825f1=_['merge']({},_0x3825f1,_0x1969bf[_0x51d6('0x43')]);var _0x16a4b9={'where':_0x3825f1[_0x51d6('0x3f')]};return db['Interval'][_0x51d6('0x1e')](_0x16a4b9)['then'](function(_0x53b259){_0x454c8d['count']=_0x53b259;if(_0x1969bf['query'][_0x51d6('0x44')]){_0x3825f1[_0x51d6('0x45')]=[{'all':!![]}];}return db[_0x51d6('0x46')][_0x51d6('0x47')](_0x3825f1);})[_0x51d6('0x24')](function(_0x16c542){_0x454c8d['rows']=_0x16c542;return _0x454c8d;})[_0x51d6('0x24')](respondWithFilteredResult(_0x5d45ff,_0x3825f1))['catch'](handleError(_0x5d45ff,null));};exports['show']=function(_0x906302,_0x41d629){var _0x501617={'raw':!![],'where':{'id':_0x906302[_0x51d6('0x48')]['id']}},_0x535dbf={};_0x535dbf['model']=_[_0x51d6('0x36')](db['Interval'][_0x51d6('0x30')]);_0x535dbf['query']=_[_0x51d6('0x36')](_0x906302[_0x51d6('0x35')]);_0x535dbf['filters']=_[_0x51d6('0x49')](_0x535dbf[_0x51d6('0x34')],_0x535dbf[_0x51d6('0x35')]);_0x501617[_0x51d6('0x38')]=_[_0x51d6('0x49')](_0x535dbf[_0x51d6('0x34')],qs['fields'](_0x906302[_0x51d6('0x35')][_0x51d6('0x39')]));_0x501617[_0x51d6('0x38')]=_0x501617[_0x51d6('0x38')]['length']?_0x501617[_0x51d6('0x38')]:_0x535dbf['model'];if(_0x906302[_0x51d6('0x35')][_0x51d6('0x44')]){_0x501617[_0x51d6('0x45')]=[{'all':!![]}];}_0x501617=_[_0x51d6('0x42')]({},_0x501617,_0x906302['options']);return db[_0x51d6('0x46')]['find'](_0x501617)[_0x51d6('0x24')](handleEntityNotFound(_0x41d629,null))[_0x51d6('0x24')](respondWithResult(_0x41d629,null))[_0x51d6('0x4a')](handleError(_0x41d629,null));};exports[_0x51d6('0x4b')]=function(_0x5f879a,_0x1cca8d){return db[_0x51d6('0x46')][_0x51d6('0x4b')](_0x5f879a['body'],{})[_0x51d6('0x24')](function(_0x2af2b5){var _0x30ec3f=_0x5f879a['user']['get']({'plain':!![]});if(!_0x30ec3f)throw new Error(_0x51d6('0x4c'));if(_0x30ec3f['role']===_0x51d6('0x4d')){var _0xc21c76=_0x2af2b5['get']({'plain':!![]});var _0x3a3583=_0x51d6('0x26');return db['UserProfileSection'][_0x51d6('0x4e')]({'where':{'name':_0x3a3583,'userProfileId':_0x30ec3f[_0x51d6('0x4f')]},'raw':!![]})['then'](function(_0x3e14aa){if(_0x3e14aa&&_0x3e14aa[_0x51d6('0x50')]===0x0){return db[_0x51d6('0x27')][_0x51d6('0x4b')]({'name':_0xc21c76[_0x51d6('0x2c')],'resourceId':_0xc21c76['id'],'type':_0x3e14aa[_0x51d6('0x2c')],'sectionId':_0x3e14aa['id']},{})[_0x51d6('0x24')](function(){return _0x2af2b5;});}else{return _0x2af2b5;}})[_0x51d6('0x4a')](function(_0x5a47c6){logger[_0x51d6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a47c6);throw _0x5a47c6;});}return _0x2af2b5;})[_0x51d6('0x24')](respondWithResult(_0x1cca8d,0xc9))[_0x51d6('0x4a')](handleError(_0x1cca8d,null));};exports[_0x51d6('0x51')]=function(_0x160d1c,_0x26b475){if(_0x160d1c['body']['id']){delete _0x160d1c[_0x51d6('0x52')]['id'];}return db[_0x51d6('0x46')]['find']({'where':{'id':_0x160d1c[_0x51d6('0x48')]['id']}})[_0x51d6('0x24')](handleEntityNotFound(_0x26b475,null))['then'](saveUpdates(_0x160d1c[_0x51d6('0x52')],null))[_0x51d6('0x24')](respondWithResult(_0x26b475,null))[_0x51d6('0x4a')](handleError(_0x26b475,null));};exports[_0x51d6('0x28')]=function(_0x538f56,_0x117fd7){return db['Interval'][_0x51d6('0x4e')]({'where':{'id':_0x538f56[_0x51d6('0x48')]['id']}})[_0x51d6('0x24')](handleEntityNotFound(_0x117fd7,null))[_0x51d6('0x24')](removeEntity(_0x117fd7,null))[_0x51d6('0x4a')](handleError(_0x117fd7,null));};exports[_0x51d6('0x53')]=function(_0x529d99,_0x4ff443,_0x1ffee8){if(_0x529d99['body']['id']){delete _0x529d99[_0x51d6('0x52')]['id'];}return db['Interval'][_0x51d6('0x4e')]({'where':{'id':_0x529d99[_0x51d6('0x48')]['id']}})[_0x51d6('0x24')](handleEntityNotFound(_0x4ff443,null))['then'](function(_0x557b8a){if(_0x557b8a){_0x529d99[_0x51d6('0x52')][_0x51d6('0x54')]=_0x557b8a['id'];return db[_0x51d6('0x46')][_0x51d6('0x4b')](_0x529d99['body']);}})[_0x51d6('0x24')](respondWithResult(_0x4ff443,null))[_0x51d6('0x4a')](handleError(_0x4ff443,null));};exports[_0x51d6('0x55')]=function(_0x4d515c,_0x2e4e7c,_0x5385ce){var _0x1b10a0={};var _0x36d4a9={};var _0x517cd8;var _0x1f8071;return db[_0x51d6('0x46')][_0x51d6('0x56')]({'where':{'id':_0x4d515c['params']['id']}})[_0x51d6('0x24')](handleEntityNotFound(_0x2e4e7c,null))[_0x51d6('0x24')](function(_0x652102){if(_0x652102){_0x517cd8=_0x652102;_0x36d4a9[_0x51d6('0x34')]=_[_0x51d6('0x36')](db[_0x51d6('0x46')][_0x51d6('0x30')]);_0x36d4a9[_0x51d6('0x35')]=_['keys'](_0x4d515c['query']);_0x36d4a9['filters']=_['intersection'](_0x36d4a9[_0x51d6('0x34')],_0x36d4a9['query']);_0x1b10a0['attributes']=_[_0x51d6('0x49')](_0x36d4a9[_0x51d6('0x34')],qs[_0x51d6('0x39')](_0x4d515c[_0x51d6('0x35')][_0x51d6('0x39')]));_0x1b10a0[_0x51d6('0x38')]=_0x1b10a0[_0x51d6('0x38')][_0x51d6('0x3a')]?_0x1b10a0['attributes']:_0x36d4a9[_0x51d6('0x34')];_0x1b10a0[_0x51d6('0x3d')]=qs['sort'](_0x4d515c['query']['sort']);_0x1b10a0[_0x51d6('0x3f')]=qs[_0x51d6('0x37')](_[_0x51d6('0x40')](_0x4d515c['query'],_0x36d4a9[_0x51d6('0x37')]));if(_0x4d515c['query'][_0x51d6('0x41')]){_0x1b10a0[_0x51d6('0x3f')]=_[_0x51d6('0x42')](_0x1b10a0[_0x51d6('0x3f')],{'$or':_[_0x51d6('0x2f')](_0x1b10a0['attributes'],function(_0x5687b0){var _0x236bf7={};_0x236bf7[_0x5687b0]={'$like':'%'+_0x4d515c['query'][_0x51d6('0x41')]+'%'};return _0x236bf7;})});}_0x1b10a0=_[_0x51d6('0x42')]({},_0x1b10a0,_0x4d515c[_0x51d6('0x43')]);return _0x517cd8['getIntervals'](_0x1b10a0);}})['then'](function(_0x4624db){if(_0x4624db){_0x1f8071=_0x4624db['length'];if(!_0x4d515c[_0x51d6('0x35')][_0x51d6('0x3b')](_0x51d6('0x3c'))){_0x1b10a0[_0x51d6('0x1c')]=qs[_0x51d6('0x1c')](_0x4d515c[_0x51d6('0x35')][_0x51d6('0x1c')]);_0x1b10a0[_0x51d6('0x1b')]=qs[_0x51d6('0x1b')](_0x4d515c[_0x51d6('0x35')]['offset']);}return _0x517cd8['getIntervals'](_0x1b10a0);}})[_0x51d6('0x24')](function(_0x199db1){if(_0x199db1){return _0x199db1?{'count':_0x1f8071,'rows':_0x199db1}:null;}})['then'](respondWithResult(_0x2e4e7c,null))['catch'](handleError(_0x2e4e7c,null));};exports[_0x51d6('0x57')]=function(_0x41450b,_0x1ceda0,_0x51ca4c){return db[_0x51d6('0x46')][_0x51d6('0x56')]({'where':{'id':_0x41450b['params']['id']}})[_0x51d6('0x24')](handleEntityNotFound(_0x1ceda0,null))[_0x51d6('0x24')](function(_0x64584){if(_0x64584){return db['sequelize']['transaction'](function(_0x250dac){return db[_0x51d6('0x46')][_0x51d6('0x28')]({'where':{'IntervalId':_0x41450b[_0x51d6('0x48')]['id']},'transaction':_0x250dac})['then'](function(_0x81e95f){var _0x2a6690=_[_0x51d6('0x2f')](_0x41450b[_0x51d6('0x52')],function(_0x519017){delete _0x519017['id'];_0x519017['IntervalId']=_0x41450b[_0x51d6('0x48')]['id'];return _0x519017;});return db['Interval'][_0x51d6('0x58')](_0x2a6690,{'transaction':_0x250dac});});})[_0x51d6('0x24')](function(){return db['Interval'][_0x51d6('0x47')]({'where':{'IntervalId':_0x41450b[_0x51d6('0x48')]['id']}});});}})['then'](respondWithResult(_0x1ceda0,null))[_0x51d6('0x4a')](handleError(_0x1ceda0,null));}; \ No newline at end of file +var _0x45b5=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','userProfileId','autoAssociation','error','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','get','UserProfileResource','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','fields'];(function(_0x1ac16c,_0x405177){var _0x1e0c9f=function(_0x116854){while(--_0x116854){_0x1ac16c['push'](_0x1ac16c['shift']());}};_0x1e0c9f(++_0x405177);}(_0x45b5,0x6f));var _0x545b=function(_0x4437e0,_0x5aef31){_0x4437e0=_0x4437e0-0x0;var _0x1f57a7=_0x45b5[_0x4437e0];return _0x1f57a7;};'use strict';var emlformat=require(_0x545b('0x0'));var rimraf=require(_0x545b('0x1'));var zipdir=require(_0x545b('0x2'));var jsonpatch=require(_0x545b('0x3'));var rp=require(_0x545b('0x4'));var moment=require(_0x545b('0x5'));var BPromise=require(_0x545b('0x6'));var Mustache=require(_0x545b('0x7'));var util=require(_0x545b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x545b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x545b('0xa'));var _=require(_0x545b('0xb'));var squel=require(_0x545b('0xc'));var crypto=require(_0x545b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x545b('0x9'));var querystring=require(_0x545b('0xe'));var Papa=require(_0x545b('0xf'));var Redis=require('ioredis');var authService=require(_0x545b('0x10'));var qs=require(_0x545b('0x11'));var as=require(_0x545b('0x12'));var hardwareService=require(_0x545b('0x13'));var logger=require(_0x545b('0x14'))(_0x545b('0x15'));var utils=require(_0x545b('0x16'));var config=require(_0x545b('0x17'));var licenseUtil=require(_0x545b('0x18'));var db=require(_0x545b('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x7fde6d,_0x44f3d1){_0x44f3d1=_0x44f3d1||0xcc;return function(_0x25bc9b){if(_0x25bc9b){return _0x7fde6d[_0x545b('0x1a')](_0x44f3d1);}return _0x7fde6d[_0x545b('0x1b')](_0x44f3d1)[_0x545b('0x1c')]();};}function respondWithResult(_0x126e92,_0x82ef95){_0x82ef95=_0x82ef95||0xc8;return function(_0x12f9f8){if(_0x12f9f8){return _0x126e92[_0x545b('0x1b')](_0x82ef95)[_0x545b('0x1d')](_0x12f9f8);}};}function respondWithFilteredResult(_0x3ca7d4,_0x186dac){return function(_0x3ed045){if(_0x3ed045){var _0x32a85a=typeof _0x186dac[_0x545b('0x1e')]==='undefined'&&typeof _0x186dac[_0x545b('0x1f')]===_0x545b('0x20');var _0x48e430=_0x3ed045['count'];var _0x2ac970=_0x32a85a?0x0:_0x186dac[_0x545b('0x1e')];var _0x5ec4f1=_0x32a85a?_0x3ed045[_0x545b('0x21')]:_0x186dac[_0x545b('0x1e')]+_0x186dac[_0x545b('0x1f')];var _0x469010;if(_0x5ec4f1>=_0x48e430){_0x5ec4f1=_0x48e430;_0x469010=0xc8;}else{_0x469010=0xce;}_0x3ca7d4[_0x545b('0x1b')](_0x469010);return _0x3ca7d4[_0x545b('0x22')]('Content-Range',_0x2ac970+'-'+_0x5ec4f1+'/'+_0x48e430)[_0x545b('0x1d')](_0x3ed045);}return null;};}function patchUpdates(_0x5ee769){return function(_0x28cf39){try{jsonpatch[_0x545b('0x23')](_0x28cf39,_0x5ee769,!![]);}catch(_0x4daba6){return BPromise[_0x545b('0x24')](_0x4daba6);}return _0x28cf39[_0x545b('0x25')]();};}function saveUpdates(_0x3006f9,_0x416126){return function(_0xf13c4e){if(_0xf13c4e){return _0xf13c4e[_0x545b('0x26')](_0x3006f9)['then'](function(_0x22a17f){return _0x22a17f;});}return null;};}function removeEntity(_0x3618dc,_0x1c5145){return function(_0xe0484){if(_0xe0484){return _0xe0484[_0x545b('0x27')]()[_0x545b('0x28')](function(){var _0x5ea3a8=_0xe0484[_0x545b('0x29')]({'plain':!![]});var _0x1c34ea='Intervals';return db[_0x545b('0x2a')][_0x545b('0x27')]({'where':{'type':_0x1c34ea,'resourceId':_0x5ea3a8['id']}})[_0x545b('0x28')](function(){return _0xe0484;});})[_0x545b('0x28')](function(){_0x3618dc[_0x545b('0x1b')](0xcc)[_0x545b('0x1c')]();});}};}function handleEntityNotFound(_0x2e897a,_0x40b539){return function(_0xf532ea){if(!_0xf532ea){_0x2e897a[_0x545b('0x1a')](0x194);}return _0xf532ea;};}function handleError(_0x352008,_0x3b91b4){_0x3b91b4=_0x3b91b4||0x1f4;return function(_0x4e8bd2){logger['error'](_0x4e8bd2['stack']);if(_0x4e8bd2[_0x545b('0x2b')]){delete _0x4e8bd2[_0x545b('0x2b')];}_0x352008[_0x545b('0x1b')](_0x3b91b4)[_0x545b('0x2c')](_0x4e8bd2);};}exports[_0x545b('0x2d')]=function(_0x3da5d8,_0x50fcd8){var _0x98b28d={},_0x243103={},_0x3bc1fe={'count':0x0,'rows':[]};var _0x5b3a6e=_[_0x545b('0x2e')](db[_0x545b('0x2f')][_0x545b('0x30')],function(_0xe3b79a){return{'name':_0xe3b79a[_0x545b('0x31')],'type':_0xe3b79a[_0x545b('0x32')][_0x545b('0x33')]};});_0x243103[_0x545b('0x34')]=_['map'](_0x5b3a6e,_0x545b('0x2b'));_0x243103['query']=_[_0x545b('0x35')](_0x3da5d8[_0x545b('0x36')]);_0x243103[_0x545b('0x37')]=_[_0x545b('0x38')](_0x243103['model'],_0x243103['query']);_0x98b28d[_0x545b('0x39')]=_['intersection'](_0x243103[_0x545b('0x34')],qs['fields'](_0x3da5d8[_0x545b('0x36')]['fields']));_0x98b28d['attributes']=_0x98b28d[_0x545b('0x39')][_0x545b('0x3a')]?_0x98b28d['attributes']:_0x243103[_0x545b('0x34')];if(!_0x3da5d8[_0x545b('0x36')]['hasOwnProperty'](_0x545b('0x3b'))){_0x98b28d['limit']=qs[_0x545b('0x1f')](_0x3da5d8[_0x545b('0x36')][_0x545b('0x1f')]);_0x98b28d[_0x545b('0x1e')]=qs['offset'](_0x3da5d8[_0x545b('0x36')][_0x545b('0x1e')]);}_0x98b28d[_0x545b('0x3c')]=qs[_0x545b('0x3d')](_0x3da5d8[_0x545b('0x36')][_0x545b('0x3d')]);_0x98b28d[_0x545b('0x3e')]=qs[_0x545b('0x37')](_[_0x545b('0x3f')](_0x3da5d8[_0x545b('0x36')],_0x243103[_0x545b('0x37')]),_0x5b3a6e);if(_0x3da5d8[_0x545b('0x36')][_0x545b('0x40')]){_0x98b28d[_0x545b('0x3e')]=_[_0x545b('0x41')](_0x98b28d[_0x545b('0x3e')],{'$or':_[_0x545b('0x2e')](_0x5b3a6e,function(_0x291a56){if(_0x291a56[_0x545b('0x32')]!==_0x545b('0x42')){var _0x49a660={};_0x49a660[_0x291a56[_0x545b('0x2b')]]={'$like':'%'+_0x3da5d8[_0x545b('0x36')]['filter']+'%'};return _0x49a660;}})});}_0x98b28d=_[_0x545b('0x41')]({},_0x98b28d,_0x3da5d8[_0x545b('0x43')]);var _0x29eace={'where':_0x98b28d[_0x545b('0x3e')]};return db['Interval'][_0x545b('0x21')](_0x29eace)['then'](function(_0x26996c){_0x3bc1fe['count']=_0x26996c;if(_0x3da5d8[_0x545b('0x36')]['includeAll']){_0x98b28d[_0x545b('0x44')]=[{'all':!![]}];}return db[_0x545b('0x2f')][_0x545b('0x45')](_0x98b28d);})[_0x545b('0x28')](function(_0x2dd821){_0x3bc1fe[_0x545b('0x46')]=_0x2dd821;return _0x3bc1fe;})[_0x545b('0x28')](respondWithFilteredResult(_0x50fcd8,_0x98b28d))[_0x545b('0x47')](handleError(_0x50fcd8,null));};exports[_0x545b('0x48')]=function(_0xc35663,_0x23c839){var _0x337698={'raw':!![],'where':{'id':_0xc35663[_0x545b('0x49')]['id']}},_0x19a7a3={};_0x19a7a3[_0x545b('0x34')]=_[_0x545b('0x35')](db[_0x545b('0x2f')][_0x545b('0x30')]);_0x19a7a3[_0x545b('0x36')]=_[_0x545b('0x35')](_0xc35663[_0x545b('0x36')]);_0x19a7a3[_0x545b('0x37')]=_[_0x545b('0x38')](_0x19a7a3[_0x545b('0x34')],_0x19a7a3[_0x545b('0x36')]);_0x337698[_0x545b('0x39')]=_[_0x545b('0x38')](_0x19a7a3[_0x545b('0x34')],qs[_0x545b('0x4a')](_0xc35663[_0x545b('0x36')]['fields']));_0x337698[_0x545b('0x39')]=_0x337698[_0x545b('0x39')][_0x545b('0x3a')]?_0x337698[_0x545b('0x39')]:_0x19a7a3[_0x545b('0x34')];if(_0xc35663['query']['includeAll']){_0x337698[_0x545b('0x44')]=[{'all':!![]}];}_0x337698=_[_0x545b('0x41')]({},_0x337698,_0xc35663[_0x545b('0x43')]);return db[_0x545b('0x2f')][_0x545b('0x4b')](_0x337698)['then'](handleEntityNotFound(_0x23c839,null))[_0x545b('0x28')](respondWithResult(_0x23c839,null))[_0x545b('0x47')](handleError(_0x23c839,null));};exports[_0x545b('0x4c')]=function(_0x6618cd,_0x20eacf){return db['Interval'][_0x545b('0x4c')](_0x6618cd[_0x545b('0x4d')],{})[_0x545b('0x28')](function(_0x17d9b4){var _0x38ccc3=_0x6618cd[_0x545b('0x4e')][_0x545b('0x29')]({'plain':!![]});if(!_0x38ccc3)throw new Error(_0x545b('0x4f'));if(_0x38ccc3['role']==='user'){var _0x45dec0=_0x17d9b4[_0x545b('0x29')]({'plain':!![]});var _0x539cab=_0x545b('0x50');return db[_0x545b('0x51')][_0x545b('0x4b')]({'where':{'name':_0x539cab,'userProfileId':_0x38ccc3[_0x545b('0x52')]},'raw':!![]})[_0x545b('0x28')](function(_0x4f690c){if(_0x4f690c&&_0x4f690c[_0x545b('0x53')]===0x0){return db[_0x545b('0x2a')][_0x545b('0x4c')]({'name':_0x45dec0['name'],'resourceId':_0x45dec0['id'],'type':_0x4f690c['name'],'sectionId':_0x4f690c['id']},{})[_0x545b('0x28')](function(){return _0x17d9b4;});}else{return _0x17d9b4;}})[_0x545b('0x47')](function(_0x2f634a){logger[_0x545b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f634a);throw _0x2f634a;});}return _0x17d9b4;})[_0x545b('0x28')](respondWithResult(_0x20eacf,0xc9))[_0x545b('0x47')](handleError(_0x20eacf,null));};exports[_0x545b('0x26')]=function(_0x459bd3,_0x21f519){if(_0x459bd3[_0x545b('0x4d')]['id']){delete _0x459bd3['body']['id'];}return db[_0x545b('0x2f')][_0x545b('0x4b')]({'where':{'id':_0x459bd3[_0x545b('0x49')]['id']}})[_0x545b('0x28')](handleEntityNotFound(_0x21f519,null))[_0x545b('0x28')](saveUpdates(_0x459bd3[_0x545b('0x4d')],null))[_0x545b('0x28')](respondWithResult(_0x21f519,null))['catch'](handleError(_0x21f519,null));};exports[_0x545b('0x27')]=function(_0x241a18,_0x4c6f01){return db[_0x545b('0x2f')]['find']({'where':{'id':_0x241a18['params']['id']}})[_0x545b('0x28')](handleEntityNotFound(_0x4c6f01,null))[_0x545b('0x28')](removeEntity(_0x4c6f01,null))['catch'](handleError(_0x4c6f01,null));};exports[_0x545b('0x55')]=function(_0x35641f,_0x11402f,_0x438fdc){if(_0x35641f[_0x545b('0x4d')]['id']){delete _0x35641f['body']['id'];}return db[_0x545b('0x2f')][_0x545b('0x4b')]({'where':{'id':_0x35641f[_0x545b('0x49')]['id']}})['then'](handleEntityNotFound(_0x11402f,null))[_0x545b('0x28')](function(_0x1d1358){if(_0x1d1358){_0x35641f[_0x545b('0x4d')][_0x545b('0x56')]=_0x1d1358['id'];return db[_0x545b('0x2f')]['create'](_0x35641f[_0x545b('0x4d')]);}})['then'](respondWithResult(_0x11402f,null))[_0x545b('0x47')](handleError(_0x11402f,null));};exports[_0x545b('0x57')]=function(_0x3a31ac,_0x4d82c0,_0x55227f){var _0x1f017d={};var _0x223346={};var _0x5e5123;var _0x54e955;return db['Interval'][_0x545b('0x58')]({'where':{'id':_0x3a31ac['params']['id']}})[_0x545b('0x28')](handleEntityNotFound(_0x4d82c0,null))['then'](function(_0x240839){if(_0x240839){_0x5e5123=_0x240839;_0x223346[_0x545b('0x34')]=_[_0x545b('0x35')](db[_0x545b('0x2f')]['rawAttributes']);_0x223346[_0x545b('0x36')]=_[_0x545b('0x35')](_0x3a31ac[_0x545b('0x36')]);_0x223346[_0x545b('0x37')]=_[_0x545b('0x38')](_0x223346[_0x545b('0x34')],_0x223346[_0x545b('0x36')]);_0x1f017d['attributes']=_[_0x545b('0x38')](_0x223346[_0x545b('0x34')],qs[_0x545b('0x4a')](_0x3a31ac[_0x545b('0x36')][_0x545b('0x4a')]));_0x1f017d[_0x545b('0x39')]=_0x1f017d[_0x545b('0x39')][_0x545b('0x3a')]?_0x1f017d[_0x545b('0x39')]:_0x223346['model'];_0x1f017d[_0x545b('0x3c')]=qs[_0x545b('0x3d')](_0x3a31ac[_0x545b('0x36')][_0x545b('0x3d')]);_0x1f017d[_0x545b('0x3e')]=qs[_0x545b('0x37')](_[_0x545b('0x3f')](_0x3a31ac['query'],_0x223346[_0x545b('0x37')]));if(_0x3a31ac[_0x545b('0x36')][_0x545b('0x40')]){_0x1f017d[_0x545b('0x3e')]=_['merge'](_0x1f017d[_0x545b('0x3e')],{'$or':_[_0x545b('0x2e')](_0x1f017d['attributes'],function(_0x5beddb){var _0x37fd62={};_0x37fd62[_0x5beddb]={'$like':'%'+_0x3a31ac[_0x545b('0x36')]['filter']+'%'};return _0x37fd62;})});}_0x1f017d=_['merge']({},_0x1f017d,_0x3a31ac[_0x545b('0x43')]);return _0x5e5123[_0x545b('0x57')](_0x1f017d);}})['then'](function(_0x3fe22e){if(_0x3fe22e){_0x54e955=_0x3fe22e[_0x545b('0x3a')];if(!_0x3a31ac[_0x545b('0x36')][_0x545b('0x59')]('nolimit')){_0x1f017d[_0x545b('0x1f')]=qs[_0x545b('0x1f')](_0x3a31ac[_0x545b('0x36')][_0x545b('0x1f')]);_0x1f017d[_0x545b('0x1e')]=qs['offset'](_0x3a31ac[_0x545b('0x36')]['offset']);}return _0x5e5123[_0x545b('0x57')](_0x1f017d);}})[_0x545b('0x28')](function(_0x270221){if(_0x270221){return _0x270221?{'count':_0x54e955,'rows':_0x270221}:null;}})[_0x545b('0x28')](respondWithResult(_0x4d82c0,null))[_0x545b('0x47')](handleError(_0x4d82c0,null));};exports[_0x545b('0x5a')]=function(_0x20a464,_0x528fd7,_0x1e1a5b){return db[_0x545b('0x2f')][_0x545b('0x58')]({'where':{'id':_0x20a464[_0x545b('0x49')]['id']}})[_0x545b('0x28')](handleEntityNotFound(_0x528fd7,null))['then'](function(_0x2be20f){if(_0x2be20f){return db[_0x545b('0x5b')][_0x545b('0x5c')](function(_0x2127d3){return db['Interval'][_0x545b('0x27')]({'where':{'IntervalId':_0x20a464[_0x545b('0x49')]['id']},'transaction':_0x2127d3})[_0x545b('0x28')](function(_0x310566){var _0x5e3f1a=_[_0x545b('0x2e')](_0x20a464[_0x545b('0x4d')],function(_0x4a90a8){delete _0x4a90a8['id'];_0x4a90a8[_0x545b('0x56')]=_0x20a464[_0x545b('0x49')]['id'];return _0x4a90a8;});return db[_0x545b('0x2f')]['bulkCreate'](_0x5e3f1a,{'transaction':_0x2127d3});});})['then'](function(){return db[_0x545b('0x2f')][_0x545b('0x45')]({'where':{'IntervalId':_0x20a464[_0x545b('0x49')]['id']}});});}})[_0x545b('0x28')](respondWithResult(_0x528fd7,null))[_0x545b('0x47')](handleError(_0x528fd7,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 465f8cf..7e4ba9f 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 _0x35bd=['iftime','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime'];(function(_0x17d5db,_0x40c2a7){var _0x442a71=function(_0x3db44e){while(--_0x3db44e){_0x17d5db['push'](_0x17d5db['shift']());}};_0x442a71(++_0x40c2a7);}(_0x35bd,0x1a1));var _0xd35b=function(_0x9a82a4,_0xc8bb10){_0x9a82a4=_0x9a82a4-0x0;var _0x4af8ab=_0x35bd[_0x9a82a4];return _0x4af8ab;};'use strict';var attributes=require(_0xd35b('0x0'));var extensions=require(_0xd35b('0x1'));var iftime=require(_0xd35b('0x2'))[_0xd35b('0x3')];module['exports']=function(_0xea4ebc){return _0xea4ebc[_0xd35b('0x4')](_0xd35b('0x5'),attributes,{'tableName':_0xd35b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1440f3){extensions[_0xd35b('0x7')](_0xea4ebc,_0x1440f3);},'afterBulkCreate':function(_0x34ff40,_0x45c46a,_0x13cb8f){_0x13cb8f();extensions[_0xd35b('0x7')](_0xea4ebc,_0x34ff40[0x0]);},'afterUpdate':function(_0x2de4e9){extensions[_0xd35b('0x7')](_0xea4ebc,_0x2de4e9);},'afterDestroy':function(_0x5d6c2b){extensions[_0xd35b('0x7')](_0xea4ebc,_0x5d6c2b);}},'instanceMethods':{'ifTime':function(_0x28285b=undefined,_0x3088b2=new Date()){if(typeof this[_0xd35b('0x8')]===_0xd35b('0x9')){return iftime(this[_0xd35b('0x8')],_0x28285b,_0x3088b2);}else{return this[_0xd35b('0xa')]()['then'](function(_0x51c3c9){return Promise['all'](_0x51c3c9[_0xd35b('0xb')](function(_0x271a03){return _0x271a03[_0xd35b('0xc')](_0x28285b,_0x3088b2);}));})[_0xd35b('0xd')](function(_0x3248fe){return _0x3248fe[_0xd35b('0xe')](function(_0x5a55aa,_0x4bf8e5){return _0x5a55aa||_0x4bf8e5;},![]);});}}}});}; \ No newline at end of file +var _0x2906=['./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','interval','string','then','map','reduce'];(function(_0x2fefd2,_0x5556a2){var _0x37d740=function(_0x3ab3c4){while(--_0x3ab3c4){_0x2fefd2['push'](_0x2fefd2['shift']());}};_0x37d740(++_0x5556a2);}(_0x2906,0xa9));var _0x6290=function(_0x58b332,_0x54787d){_0x58b332=_0x58b332-0x0;var _0xb8e97e=_0x2906[_0x58b332];return _0xb8e97e;};'use strict';var attributes=require(_0x6290('0x0'));var extensions=require(_0x6290('0x1'));var iftime=require(_0x6290('0x2'))[_0x6290('0x3')];module[_0x6290('0x4')]=function(_0x349859){return _0x349859[_0x6290('0x5')]('Interval',attributes,{'tableName':_0x6290('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7b0e54){extensions[_0x6290('0x7')](_0x349859,_0x7b0e54);},'afterBulkCreate':function(_0x4c45ef,_0x5ceac5,_0x532eda){_0x532eda();extensions[_0x6290('0x7')](_0x349859,_0x4c45ef[0x0]);},'afterUpdate':function(_0x3c27ad){extensions['rewrite'](_0x349859,_0x3c27ad);},'afterDestroy':function(_0x3c3c94){extensions[_0x6290('0x7')](_0x349859,_0x3c3c94);}},'instanceMethods':{'ifTime':function(_0x17b099=undefined,_0x592d33=new Date()){if(typeof this[_0x6290('0x8')]===_0x6290('0x9')){return iftime(this[_0x6290('0x8')],_0x17b099,_0x592d33);}else{return this['getIntervals']()[_0x6290('0xa')](function(_0x388df0){return Promise['all'](_0x388df0[_0x6290('0xb')](function(_0x22dad3){return _0x22dad3['ifTime'](_0x17b099,_0x592d33);}));})[_0x6290('0xa')](function(_0x265165){return _0x265165[_0x6290('0xc')](function(_0x1433f3,_0x3d93a3){return _0x1433f3||_0x3d93a3;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 8a1fb9b..21447f3 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 _0x81bc=['GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowInterval','Interval','ifTime','reduce','format','name','join','findById','IntervalIftime','intervalIds','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','isArray','lodash','util','../../mysqldb','iftime','rpc'];(function(_0x3f40e4,_0x2828d0){var _0x4d1e10=function(_0x2c5ff4){while(--_0x2c5ff4){_0x3f40e4['push'](_0x3f40e4['shift']());}};_0x4d1e10(++_0x2828d0);}(_0x81bc,0x1c9));var _0xc81b=function(_0x4a6a6b,_0x1909e3){_0x4a6a6b=_0x4a6a6b-0x0;var _0x3335a6=_0x81bc[_0x4a6a6b];return _0x3335a6;};'use strict';var _=require(_0xc81b('0x0'));var util=require(_0xc81b('0x1'));var db=require(_0xc81b('0x2'))['db'];var iftime=require('../../utils/iftime')[_0xc81b('0x3')];var logger=require('../../config/logger')(_0xc81b('0x4'));exports[_0xc81b('0x5')]=function(_0x16f1ae){var _0x5061a0=this;return new Promise(function(_0x455fe1,_0x3a0c1b){return db['Interval'][_0xc81b('0x6')]({'raw':_0x16f1ae['options']?_0x16f1ae[_0xc81b('0x7')][_0xc81b('0x8')]===undefined?!![]:![]:!![],'where':_0x16f1ae[_0xc81b('0x7')]?_0x16f1ae[_0xc81b('0x7')][_0xc81b('0x9')]||null:null,'attributes':_0x16f1ae['options']?_0x16f1ae[_0xc81b('0x7')][_0xc81b('0xa')]||null:null,'limit':_0x16f1ae[_0xc81b('0x7')]?_0x16f1ae['options'][_0xc81b('0xb')]||null:null,'include':_0x16f1ae[_0xc81b('0x7')]?_0x16f1ae[_0xc81b('0x7')][_0xc81b('0xc')]?_[_0xc81b('0xd')](_0x16f1ae[_0xc81b('0x7')]['include'],function(_0x2a0d2b){return{'model':db[_0x2a0d2b[_0xc81b('0xe')]],'as':_0x2a0d2b['as'],'attributes':_0x2a0d2b[_0xc81b('0xa')],'include':_0x2a0d2b[_0xc81b('0xc')]?_[_0xc81b('0xd')](_0x2a0d2b['include'],function(_0x560131){return{'model':db[_0x560131['model']],'as':_0x560131['as'],'attributes':_0x560131[_0xc81b('0xa')],'include':_0x560131['include']?_[_0xc81b('0xd')](_0x560131[_0xc81b('0xc')],function(_0x25826e){return{'model':db[_0x25826e['model']],'as':_0x25826e['as'],'attributes':_0x25826e[_0xc81b('0xa')]};}):[]};}):[]};}):[]:[]})[_0xc81b('0xf')](function(_0x3f3be7){logger[_0xc81b('0x10')](_0xc81b('0x5'),_0x16f1ae);logger[_0xc81b('0x11')](_0xc81b('0x5'),_0x16f1ae,JSON[_0xc81b('0x12')](_0x3f3be7));_0x455fe1(_0x3f3be7);})[_0xc81b('0x13')](function(_0x2cafde){logger[_0xc81b('0x14')](_0xc81b('0x5'),_0x2cafde[_0xc81b('0x15')],_0x16f1ae);_0x3a0c1b(_0x5061a0[_0xc81b('0x14')](0x1f4,_0x2cafde[_0xc81b('0x15')]));});});};exports['ShowInterval']=function(_0x44195c){var _0x4db205=this;return new Promise(function(_0x44edab,_0x31ed65){return db['Interval']['find']({'raw':_0x44195c['options']?_0x44195c['options'][_0xc81b('0x8')]===undefined?!![]:![]:!![],'where':_0x44195c[_0xc81b('0x7')]?_0x44195c[_0xc81b('0x7')][_0xc81b('0x9')]||null:null,'attributes':_0x44195c[_0xc81b('0x7')]?_0x44195c[_0xc81b('0x7')][_0xc81b('0xa')]||null:null,'include':_0x44195c[_0xc81b('0x7')]?_0x44195c['options'][_0xc81b('0xc')]?_[_0xc81b('0xd')](_0x44195c[_0xc81b('0x7')][_0xc81b('0xc')],function(_0xea0c2){return{'model':db[_0xea0c2[_0xc81b('0xe')]],'as':_0xea0c2['as'],'attributes':_0xea0c2[_0xc81b('0xa')],'include':_0xea0c2[_0xc81b('0xc')]?_[_0xc81b('0xd')](_0xea0c2[_0xc81b('0xc')],function(_0x2e5acb){return{'model':db[_0x2e5acb[_0xc81b('0xe')]],'as':_0x2e5acb['as'],'attributes':_0x2e5acb['attributes'],'include':_0x2e5acb[_0xc81b('0xc')]?_[_0xc81b('0xd')](_0x2e5acb[_0xc81b('0xc')],function(_0x1653e7){return{'model':db[_0x1653e7[_0xc81b('0xe')]],'as':_0x1653e7['as'],'attributes':_0x1653e7[_0xc81b('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44687d){logger['info']('ShowInterval',_0x44195c);logger['debug'](_0xc81b('0x16'),_0x44195c,JSON[_0xc81b('0x12')](_0x44687d));_0x44edab(_0x44687d);})[_0xc81b('0x13')](function(_0x346678){logger[_0xc81b('0x14')]('ShowInterval',_0x346678[_0xc81b('0x15')],_0x44195c);_0x31ed65(_0x4db205[_0xc81b('0x14')](0x1f4,_0x346678['message']));});});};function checkArrayOfIntervals(_0x1d84f6,_0x31ac9e){var _0x540291=[];return db[_0xc81b('0x17')][_0xc81b('0x6')]({'where':{'id':_0x1d84f6}})['then'](function(_0x1cdb54){_0x540291=_0x1cdb54;return Promise['all'](_0x540291[_0xc81b('0xd')](function(_0x45bd29){return _0x45bd29[_0xc81b('0x18')](_0x31ac9e);}));})[_0xc81b('0xf')](function(_0x2825eb){var _0x1775d8=_0x2825eb[_0xc81b('0x19')](function(_0x40041d,_0x713df2){return _0x40041d||_0x713df2;},![]);logger[_0xc81b('0x10')](util[_0xc81b('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x540291[_0xc81b('0xd')](function(_0x550916){return _0x550916[_0xc81b('0x1b')];})[_0xc81b('0x1c')](',\x20'),_0x540291[_0xc81b('0xd')](function(_0x1c7453){return _0x1c7453['id'];})['join'](',\x20')));return _0x1775d8;});}function checkSingleInterval(_0x5efd79,_0x1eb416){return db[_0xc81b('0x17')][_0xc81b('0x1d')](_0x5efd79)[_0xc81b('0xf')](function(_0x2a71d6){if(_0x2a71d6){logger[_0xc81b('0x10')](util[_0xc81b('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x2a71d6[_0xc81b('0x1b')],_0x2a71d6['id']));return _0x2a71d6[_0xc81b('0x18')](_0x1eb416);}});}exports[_0xc81b('0x1e')]=function(_0x63fa2d){var _0x11b4c6=_0x63fa2d[_0xc81b('0x1f')];var _0x16d9de=Array['isArray'](_0x63fa2d[_0xc81b('0x20')])?_0x63fa2d[_0xc81b('0x20')]:typeof _0x63fa2d['intervals']===_0xc81b('0x21')?[_0x63fa2d[_0xc81b('0x20')]]:[];var _0x2ea0a2=_0x63fa2d[_0xc81b('0x22')]||undefined;var _0x4eb4d8=![];if(_0x16d9de[_0xc81b('0x23')]){logger[_0xc81b('0x10')](util[_0xc81b('0x1a')](_0xc81b('0x24'),_0x16d9de[_0xc81b('0x1c')](';\x20')));}if(_0x2ea0a2){logger['info'](util['format'](_0xc81b('0x25'),_0x2ea0a2));}logger[_0xc81b('0x11')](_0xc81b('0x26'),_0x4eb4d8);logger[_0xc81b('0x27')](_0xc81b('0x1e'),_0x63fa2d);return Promise[_0xc81b('0x28')]()[_0xc81b('0xf')](function(){if(Array[_0xc81b('0x29')](_0x11b4c6)){return checkArrayOfIntervals(_0x11b4c6,_0x2ea0a2);}else if(_0x11b4c6){return checkSingleInterval(_0x11b4c6,_0x2ea0a2);}})[_0xc81b('0xf')](function(_0x24d64b){var _0x11a73c=_0x16d9de[_0xc81b('0x19')](function(_0x180991,_0x46849c){return _0x180991||iftime(_0x46849c,_0x2ea0a2);},![]);_0x4eb4d8=_0x24d64b||_0x11a73c;return _0x4eb4d8;})[_0xc81b('0x13')](function(_0x2143a0){logger[_0xc81b('0x14')]('IntervalIftime',_0x63fa2d,_0x2143a0);throw this[_0xc81b('0x14')](0x1f4,_0x2143a0[_0xc81b('0x15')]);});}; \ No newline at end of file +var _0x7a87=['intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','rpc','GetInterval','options','raw','where','attributes','limit','include','map','model','then','info','stringify','catch','error','message','Interval','find','debug','ShowInterval','findAll','ifTime','reduce','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray'];(function(_0x2dcfd9,_0x5c56e9){var _0x48c508=function(_0x384d0e){while(--_0x384d0e){_0x2dcfd9['push'](_0x2dcfd9['shift']());}};_0x48c508(++_0x5c56e9);}(_0x7a87,0x161));var _0x77a8=function(_0x51c834,_0x25a85d){_0x51c834=_0x51c834-0x0;var _0x5f2782=_0x7a87[_0x51c834];return _0x5f2782;};'use strict';var _=require(_0x77a8('0x0'));var util=require(_0x77a8('0x1'));var db=require(_0x77a8('0x2'))['db'];var iftime=require(_0x77a8('0x3'))['iftime'];var logger=require('../../config/logger')(_0x77a8('0x4'));exports[_0x77a8('0x5')]=function(_0x1f5849){var _0xad817a=this;return new Promise(function(_0x5b4599,_0x55d54d){return db['Interval']['findAll']({'raw':_0x1f5849[_0x77a8('0x6')]?_0x1f5849[_0x77a8('0x6')][_0x77a8('0x7')]===undefined?!![]:![]:!![],'where':_0x1f5849[_0x77a8('0x6')]?_0x1f5849[_0x77a8('0x6')][_0x77a8('0x8')]||null:null,'attributes':_0x1f5849[_0x77a8('0x6')]?_0x1f5849[_0x77a8('0x6')][_0x77a8('0x9')]||null:null,'limit':_0x1f5849[_0x77a8('0x6')]?_0x1f5849[_0x77a8('0x6')][_0x77a8('0xa')]||null:null,'include':_0x1f5849[_0x77a8('0x6')]?_0x1f5849[_0x77a8('0x6')][_0x77a8('0xb')]?_[_0x77a8('0xc')](_0x1f5849[_0x77a8('0x6')][_0x77a8('0xb')],function(_0xb4756c){return{'model':db[_0xb4756c['model']],'as':_0xb4756c['as'],'attributes':_0xb4756c['attributes'],'include':_0xb4756c[_0x77a8('0xb')]?_[_0x77a8('0xc')](_0xb4756c['include'],function(_0xb885f8){return{'model':db[_0xb885f8['model']],'as':_0xb885f8['as'],'attributes':_0xb885f8[_0x77a8('0x9')],'include':_0xb885f8[_0x77a8('0xb')]?_[_0x77a8('0xc')](_0xb885f8['include'],function(_0x256b8d){return{'model':db[_0x256b8d[_0x77a8('0xd')]],'as':_0x256b8d['as'],'attributes':_0x256b8d[_0x77a8('0x9')]};}):[]};}):[]};}):[]:[]})[_0x77a8('0xe')](function(_0x134ac3){logger[_0x77a8('0xf')](_0x77a8('0x5'),_0x1f5849);logger['debug']('GetInterval',_0x1f5849,JSON[_0x77a8('0x10')](_0x134ac3));_0x5b4599(_0x134ac3);})[_0x77a8('0x11')](function(_0x1620d3){logger[_0x77a8('0x12')](_0x77a8('0x5'),_0x1620d3['message'],_0x1f5849);_0x55d54d(_0xad817a[_0x77a8('0x12')](0x1f4,_0x1620d3[_0x77a8('0x13')]));});});};exports['ShowInterval']=function(_0x5ed55d){var _0x535da3=this;return new Promise(function(_0x363c72,_0x3fe787){return db[_0x77a8('0x14')][_0x77a8('0x15')]({'raw':_0x5ed55d['options']?_0x5ed55d[_0x77a8('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x5ed55d[_0x77a8('0x6')]?_0x5ed55d[_0x77a8('0x6')]['where']||null:null,'attributes':_0x5ed55d[_0x77a8('0x6')]?_0x5ed55d[_0x77a8('0x6')][_0x77a8('0x9')]||null:null,'include':_0x5ed55d['options']?_0x5ed55d['options'][_0x77a8('0xb')]?_[_0x77a8('0xc')](_0x5ed55d[_0x77a8('0x6')][_0x77a8('0xb')],function(_0x3295f1){return{'model':db[_0x3295f1['model']],'as':_0x3295f1['as'],'attributes':_0x3295f1[_0x77a8('0x9')],'include':_0x3295f1[_0x77a8('0xb')]?_[_0x77a8('0xc')](_0x3295f1[_0x77a8('0xb')],function(_0x4f45a4){return{'model':db[_0x4f45a4[_0x77a8('0xd')]],'as':_0x4f45a4['as'],'attributes':_0x4f45a4['attributes'],'include':_0x4f45a4[_0x77a8('0xb')]?_[_0x77a8('0xc')](_0x4f45a4[_0x77a8('0xb')],function(_0xa3912f){return{'model':db[_0xa3912f[_0x77a8('0xd')]],'as':_0xa3912f['as'],'attributes':_0xa3912f['attributes']};}):[]};}):[]};}):[]:[]})[_0x77a8('0xe')](function(_0x4cebbb){logger[_0x77a8('0xf')]('ShowInterval',_0x5ed55d);logger[_0x77a8('0x16')](_0x77a8('0x17'),_0x5ed55d,JSON[_0x77a8('0x10')](_0x4cebbb));_0x363c72(_0x4cebbb);})[_0x77a8('0x11')](function(_0x4274a8){logger[_0x77a8('0x12')](_0x77a8('0x17'),_0x4274a8['message'],_0x5ed55d);_0x3fe787(_0x535da3[_0x77a8('0x12')](0x1f4,_0x4274a8['message']));});});};function checkArrayOfIntervals(_0x861c4f,_0x33aabd){var _0x463910=[];return db[_0x77a8('0x14')][_0x77a8('0x18')]({'where':{'id':_0x861c4f}})[_0x77a8('0xe')](function(_0x1075a8){_0x463910=_0x1075a8;return Promise['all'](_0x463910[_0x77a8('0xc')](function(_0xc86334){return _0xc86334[_0x77a8('0x19')](_0x33aabd);}));})[_0x77a8('0xe')](function(_0x224d52){var _0x2b68fb=_0x224d52[_0x77a8('0x1a')](function(_0x1bb29a,_0x19b229){return _0x1bb29a||_0x19b229;},![]);logger[_0x77a8('0xf')](util[_0x77a8('0x1b')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x463910[_0x77a8('0xc')](function(_0x3460e9){return _0x3460e9[_0x77a8('0x1c')];})[_0x77a8('0x1d')](',\x20'),_0x463910['map'](function(_0x1b103d){return _0x1b103d['id'];})['join'](',\x20')));return _0x2b68fb;});}function checkSingleInterval(_0x2d818b,_0x50158a){return db[_0x77a8('0x14')][_0x77a8('0x1e')](_0x2d818b)[_0x77a8('0xe')](function(_0x3a403f){if(_0x3a403f){logger[_0x77a8('0xf')](util[_0x77a8('0x1b')](_0x77a8('0x1f'),_0x3a403f[_0x77a8('0x1c')],_0x3a403f['id']));return _0x3a403f[_0x77a8('0x19')](_0x50158a);}});}exports['IntervalIftime']=function(_0x281839){var _0x2b34f3=_0x281839[_0x77a8('0x20')];var _0x4a18f0=Array[_0x77a8('0x21')](_0x281839['intervals'])?_0x281839['intervals']:typeof _0x281839[_0x77a8('0x22')]===_0x77a8('0x23')?[_0x281839[_0x77a8('0x22')]]:[];var _0x1876d6=_0x281839[_0x77a8('0x24')]||undefined;var _0x3a8d50=![];if(_0x4a18f0[_0x77a8('0x25')]){logger['info'](util['format'](_0x77a8('0x26'),_0x4a18f0[_0x77a8('0x1d')](';\x20')));}if(_0x1876d6){logger[_0x77a8('0xf')](util[_0x77a8('0x1b')](_0x77a8('0x27'),_0x1876d6));}logger[_0x77a8('0x16')]('Iftime',_0x3a8d50);logger[_0x77a8('0x28')](_0x77a8('0x29'),_0x281839);return Promise[_0x77a8('0x2a')]()[_0x77a8('0xe')](function(){if(Array[_0x77a8('0x21')](_0x2b34f3)){return checkArrayOfIntervals(_0x2b34f3,_0x1876d6);}else if(_0x2b34f3){return checkSingleInterval(_0x2b34f3,_0x1876d6);}})['then'](function(_0x598ed2){var _0x264cba=_0x4a18f0[_0x77a8('0x1a')](function(_0x42669b,_0xc83a9e){return _0x42669b||iftime(_0xc83a9e,_0x1876d6);},![]);_0x3a8d50=_0x598ed2||_0x264cba;return _0x3a8d50;})[_0x77a8('0x11')](function(_0x4e7b25){logger[_0x77a8('0x12')]('IntervalIftime',_0x281839,_0x4e7b25);throw this[_0x77a8('0x12')](0x1f4,_0x4e7b25[_0x77a8('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index a3a36bb..56bc1bd 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0x0b0e[_0x443494];return _0x4a6794;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x54a454,_0x4561d3){var _0x159be1=function(_0x34f580){while(--_0x34f580){_0x54a454['push'](_0x54a454['shift']());}};_0x159be1(++_0x4561d3);}(_0xadb5,0xad));var _0x5adb=function(_0x26277d,_0x4095c9){_0x26277d=_0x26277d-0x0;var _0x2fe92a=_0xadb5[_0x26277d];return _0x2fe92a;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a990511..24ff08d 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 _0x786d=['json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','body','headers','x-forwarded-for','socket','remoteAddress','connection','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','description','stringify','issuetype','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','base64','request','setEncoding','data','end','status','statusCode'];(function(_0x57bf82,_0x31578b){var _0x18749b=function(_0x4fbfa4){while(--_0x4fbfa4){_0x57bf82['push'](_0x57bf82['shift']());}};_0x18749b(++_0x31578b);}(_0x786d,0x18e));var _0xd786=function(_0x5e73b9,_0x6963a3){_0x5e73b9=_0x5e73b9-0x0;var _0x4550ec=_0x786d[_0x5e73b9];return _0x4550ec;};'use strict';var BPromise=require(_0xd786('0x0'));var https=require(_0xd786('0x1'));var logger=require('../../config/logger')(_0xd786('0x2'));var USERNAME=_0xd786('0x3');var PASSWORD=_0xd786('0x4');function openIssue(_0x526192,_0x21e788){var _0x21572f={'fields':{'project':{'key':_0x526192[_0xd786('0x5')]||_0xd786('0x6')},'summary':(_0x526192['summary']||'Report')+'\x20from\x20'+_0x526192['ip'],'description':_0x526192[_0xd786('0x7')]||JSON[_0xd786('0x8')](_0x526192),'issuetype':{'name':_0x526192[_0xd786('0x9')]||'Bug'}}};_0x21572f['fields'][_0xd786('0xa')]=_0x526192[_0xd786('0xb')];_0x21572f[_0xd786('0xc')][_0xd786('0xd')]=_0x526192[_0xd786('0xe')];_0x21572f['fields'][_0xd786('0xf')]=_0x526192[_0xd786('0x10')];_0x21572f[_0xd786('0xc')][_0xd786('0x11')]=_0x526192[_0xd786('0x12')];_0x21572f['fields'][_0xd786('0x13')]=_0x526192[_0xd786('0x14')];_0x21572f['fields']['customfield_10102']=_0x526192['ip'];var _0x18ba83={'host':_0xd786('0x15'),'port':0x1bb,'path':_0xd786('0x16'),'method':_0xd786('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xd786('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xd786('0x19'))}};var _0x7c6dd5=JSON['stringify'](_0x21572f);var _0x1e1556=https[_0xd786('0x1a')](_0x18ba83,function(_0x2a127d){_0x2a127d[_0xd786('0x1b')]('utf8');var _0xd1d232='';_0x2a127d['on'](_0xd786('0x1c'),function(_0x522870){_0xd1d232+=_0x522870;});_0x2a127d['on'](_0xd786('0x1d'),function(){if(_0x21e788){return _0x21e788[_0xd786('0x1e')](_0x2a127d[_0xd786('0x1f')])[_0xd786('0x20')](JSON[_0xd786('0x21')](_0xd1d232));}});});_0x1e1556['on'](_0xd786('0x22'),function(_0xf028df){if(_0x21e788){return _0x21e788[_0xd786('0x1e')](0x1f4)[_0xd786('0x20')]({'errors':[{'message':_0xd786('0x23'),'type':_0xd786('0x24')}]});}});_0x1e1556['write'](_0x7c6dd5);_0x1e1556[_0xd786('0x1d')]();}exports['openIssue']=openIssue;exports['send']=function(_0x545194,_0x6e3cc){_0x545194[_0xd786('0x25')]['ip']=_0x545194[_0xd786('0x26')][_0xd786('0x27')]||_0x545194['connection']['remoteAddress']||_0x545194[_0xd786('0x28')][_0xd786('0x29')]||_0x545194[_0xd786('0x2a')][_0xd786('0x28')][_0xd786('0x29')];return openIssue(_0x545194['body'],_0x6e3cc);}; \ No newline at end of file +var _0xdeae=['POST','application/json','Basic\x20','toString','setEncoding','utf8','data','status','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','fields','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x303d65,_0x1ad5d9){var _0x3613e1=function(_0x200353){while(--_0x200353){_0x303d65['push'](_0x303d65['shift']());}};_0x3613e1(++_0x1ad5d9);}(_0xdeae,0xdc));var _0xedea=function(_0x244a7d,_0x3c4a5b){_0x244a7d=_0x244a7d-0x0;var _0x509e5b=_0xdeae[_0x244a7d];return _0x509e5b;};'use strict';var BPromise=require(_0xedea('0x0'));var https=require(_0xedea('0x1'));var logger=require(_0xedea('0x2'))(_0xedea('0x3'));var USERNAME=_0xedea('0x4');var PASSWORD=_0xedea('0x5');function openIssue(_0x5f4bc6,_0x47a85e){var _0x36f9ac={'fields':{'project':{'key':_0x5f4bc6[_0xedea('0x6')]||'MOTGUI'},'summary':(_0x5f4bc6[_0xedea('0x7')]||_0xedea('0x8'))+_0xedea('0x9')+_0x5f4bc6['ip'],'description':_0x5f4bc6[_0xedea('0xa')]||JSON['stringify'](_0x5f4bc6),'issuetype':{'name':_0x5f4bc6['issuetype']||'Bug'}}};_0x36f9ac[_0xedea('0xb')]['customfield_11500']=_0x5f4bc6['email'];_0x36f9ac[_0xedea('0xb')]['customfield_11501']=_0x5f4bc6['oldToken'];_0x36f9ac[_0xedea('0xb')][_0xedea('0xc')]=_0x5f4bc6['newToken'];_0x36f9ac[_0xedea('0xb')][_0xedea('0xd')]=_0x5f4bc6[_0xedea('0xe')];_0x36f9ac[_0xedea('0xb')][_0xedea('0xf')]=_0x5f4bc6[_0xedea('0x10')];_0x36f9ac[_0xedea('0xb')][_0xedea('0x11')]=_0x5f4bc6['ip'];var _0x125383={'host':_0xedea('0x12'),'port':0x1bb,'path':_0xedea('0x13'),'method':_0xedea('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xedea('0x15'),'Authorization':_0xedea('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xedea('0x17')]('base64')}};var _0x5c3899=JSON['stringify'](_0x36f9ac);var _0x31f246=https['request'](_0x125383,function(_0x34130a){_0x34130a[_0xedea('0x18')](_0xedea('0x19'));var _0xdbca90='';_0x34130a['on'](_0xedea('0x1a'),function(_0x51fd0d){_0xdbca90+=_0x51fd0d;});_0x34130a['on']('end',function(){if(_0x47a85e){return _0x47a85e[_0xedea('0x1b')](_0x34130a['statusCode'])[_0xedea('0x1c')](JSON['parse'](_0xdbca90));}});});_0x31f246['on'](_0xedea('0x1d'),function(_0x289725){if(_0x47a85e){return _0x47a85e['status'](0x1f4)[_0xedea('0x1c')]({'errors':[{'message':_0xedea('0x1e'),'type':_0xedea('0x1f')}]});}});_0x31f246['write'](_0x5c3899);_0x31f246['end']();}exports[_0xedea('0x20')]=openIssue;exports[_0xedea('0x21')]=function(_0x1cf2db,_0x549bfc){_0x1cf2db[_0xedea('0x22')]['ip']=_0x1cf2db[_0xedea('0x23')][_0xedea('0x24')]||_0x1cf2db[_0xedea('0x25')][_0xedea('0x26')]||_0x1cf2db[_0xedea('0x27')][_0xedea('0x26')]||_0x1cf2db[_0xedea('0x25')][_0xedea('0x27')][_0xedea('0x26')];return openIssue(_0x1cf2db[_0xedea('0x22')],_0x549bfc);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3054a6e..71ce9a1 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','show','post'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xf3cd=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x7acb41,_0x26b090){var _0x5b9831=function(_0x3ef512){while(--_0x3ef512){_0x7acb41['push'](_0x7acb41['shift']());}};_0x5b9831(++_0x26b090);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x594670,_0x4b9fdd){_0x594670=_0x594670-0x0;var _0x36a5b7=_0xf3cd[_0x594670];return _0x36a5b7;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller['destroy']);module[_0xdf3c('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index fb7a75b..06731fb 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(_0x406839,_0xf313bc){_0x406839=_0x406839-0x0;var _0x4e230e=_0x7a54[_0x406839];return _0x4e230e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x1d4480,_0x8f6086){_0x1d4480=_0x1d4480-0x0;var _0x14702c=_0x7a54[_0x1d4480];return _0x14702c;};'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 8598236..87da364 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 _0x41fe=['fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','keys','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x136d0c,_0x371832){var _0x56b2e7=function(_0x1fd0d9){while(--_0x1fd0d9){_0x136d0c['push'](_0x136d0c['shift']());}};_0x56b2e7(++_0x371832);}(_0x41fe,0xd1));var _0xe41f=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x41fe[_0x4cbf20];return _0x582ae4;};'use strict';var emlformat=require(_0xe41f('0x0'));var rimraf=require(_0xe41f('0x1'));var zipdir=require(_0xe41f('0x2'));var jsonpatch=require(_0xe41f('0x3'));var rp=require(_0xe41f('0x4'));var moment=require(_0xe41f('0x5'));var BPromise=require(_0xe41f('0x6'));var Mustache=require(_0xe41f('0x7'));var util=require(_0xe41f('0x8'));var path=require(_0xe41f('0x9'));var sox=require(_0xe41f('0xa'));var csv=require(_0xe41f('0xb'));var ejs=require(_0xe41f('0xc'));var fs=require('fs');var fs_extra=require(_0xe41f('0xd'));var _=require(_0xe41f('0xe'));var squel=require(_0xe41f('0xf'));var crypto=require(_0xe41f('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xe41f('0x11'));var toCsv=require(_0xe41f('0xb'));var querystring=require('querystring');var Papa=require(_0xe41f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe41f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe41f('0x14'));var config=require(_0xe41f('0x15'));var licenseUtil=require(_0xe41f('0x16'));var db=require(_0xe41f('0x17'))['db'];function respondWithStatusCode(_0x2ed268,_0x139162){_0x139162=_0x139162||0xcc;return function(_0x34ae3a){if(_0x34ae3a){return _0x2ed268[_0xe41f('0x18')](_0x139162);}return _0x2ed268[_0xe41f('0x19')](_0x139162)[_0xe41f('0x1a')]();};}function respondWithResult(_0x53e2f6,_0x445e1c){_0x445e1c=_0x445e1c||0xc8;return function(_0x13a2dd){if(_0x13a2dd){return _0x53e2f6['status'](_0x445e1c)[_0xe41f('0x1b')](_0x13a2dd);}};}function respondWithFilteredResult(_0x9cb27c,_0x3b5992){return function(_0x1fb373){if(_0x1fb373){var _0x194653=typeof _0x3b5992[_0xe41f('0x1c')]===_0xe41f('0x1d')&&typeof _0x3b5992['limit']==='undefined';var _0x2b5688=_0x1fb373['count'];var _0x5b5dd7=_0x194653?0x0:_0x3b5992[_0xe41f('0x1c')];var _0x15f6c1=_0x194653?_0x1fb373[_0xe41f('0x1e')]:_0x3b5992[_0xe41f('0x1c')]+_0x3b5992[_0xe41f('0x1f')];var _0x5bd220;if(_0x15f6c1>=_0x2b5688){_0x15f6c1=_0x2b5688;_0x5bd220=0xc8;}else{_0x5bd220=0xce;}_0x9cb27c[_0xe41f('0x19')](_0x5bd220);return _0x9cb27c['set'](_0xe41f('0x20'),_0x5b5dd7+'-'+_0x15f6c1+'/'+_0x2b5688)[_0xe41f('0x1b')](_0x1fb373);}return null;};}function patchUpdates(_0x4dcb21){return function(_0x3ce4d8){try{jsonpatch[_0xe41f('0x21')](_0x3ce4d8,_0x4dcb21,!![]);}catch(_0x171851){return BPromise['reject'](_0x171851);}return _0x3ce4d8[_0xe41f('0x22')]();};}function saveUpdates(_0x3666c3,_0x37fce9){return function(_0x10ee63){if(_0x10ee63){return _0x10ee63[_0xe41f('0x23')](_0x3666c3)[_0xe41f('0x24')](function(_0x9c0c33){return _0x9c0c33;});}return null;};}function removeEntity(_0x520136,_0x18c6ba){return function(_0x5a443f){if(_0x5a443f){return _0x5a443f['destroy']()[_0xe41f('0x24')](function(){_0x520136[_0xe41f('0x19')](0xcc)[_0xe41f('0x1a')]();});}};}function handleEntityNotFound(_0x4f7965,_0x1ac25a){return function(_0x573b3){if(!_0x573b3){_0x4f7965[_0xe41f('0x18')](0x194);}return _0x573b3;};}function handleError(_0x479387,_0x15ccae){_0x15ccae=_0x15ccae||0x1f4;return function(_0x5790ae){logger[_0xe41f('0x25')](_0x5790ae[_0xe41f('0x26')]);if(_0x5790ae['name']){delete _0x5790ae[_0xe41f('0x27')];}_0x479387[_0xe41f('0x19')](_0x15ccae)[_0xe41f('0x28')](_0x5790ae);};}exports[_0xe41f('0x29')]=function(_0x348531,_0x2a7bf4){var _0x1a182b={},_0x4438cf={},_0x6ec664={'count':0x0,'rows':[]};var _0x1c3c38=_[_0xe41f('0x2a')](db[_0xe41f('0x2b')][_0xe41f('0x2c')],function(_0xbca5b0){return{'name':_0xbca5b0[_0xe41f('0x2d')],'type':_0xbca5b0['type'][_0xe41f('0x2e')]};});_0x4438cf[_0xe41f('0x2f')]=_[_0xe41f('0x2a')](_0x1c3c38,_0xe41f('0x27'));_0x4438cf[_0xe41f('0x30')]=_['keys'](_0x348531[_0xe41f('0x30')]);_0x4438cf[_0xe41f('0x31')]=_[_0xe41f('0x32')](_0x4438cf[_0xe41f('0x2f')],_0x4438cf['query']);_0x1a182b['attributes']=_['intersection'](_0x4438cf[_0xe41f('0x2f')],qs[_0xe41f('0x33')](_0x348531[_0xe41f('0x30')]['fields']));_0x1a182b[_0xe41f('0x34')]=_0x1a182b[_0xe41f('0x34')][_0xe41f('0x35')]?_0x1a182b[_0xe41f('0x34')]:_0x4438cf[_0xe41f('0x2f')];if(!_0x348531[_0xe41f('0x30')][_0xe41f('0x36')](_0xe41f('0x37'))){_0x1a182b[_0xe41f('0x1f')]=qs[_0xe41f('0x1f')](_0x348531[_0xe41f('0x30')][_0xe41f('0x1f')]);_0x1a182b['offset']=qs[_0xe41f('0x1c')](_0x348531['query'][_0xe41f('0x1c')]);}_0x1a182b['order']=qs[_0xe41f('0x38')](_0x348531['query']['sort']);_0x1a182b[_0xe41f('0x39')]=qs[_0xe41f('0x31')](_[_0xe41f('0x3a')](_0x348531[_0xe41f('0x30')],_0x4438cf[_0xe41f('0x31')]),_0x1c3c38);if(_0x348531['query'][_0xe41f('0x3b')]){_0x1a182b[_0xe41f('0x39')]=_[_0xe41f('0x3c')](_0x1a182b[_0xe41f('0x39')],{'$or':_[_0xe41f('0x2a')](_0x1c3c38,function(_0x10083c){if(_0x10083c[_0xe41f('0x3d')]!=='VIRTUAL'){var _0x438ead={};_0x438ead[_0x10083c[_0xe41f('0x27')]]={'$like':'%'+_0x348531[_0xe41f('0x30')][_0xe41f('0x3b')]+'%'};return _0x438ead;}})});}_0x1a182b=_[_0xe41f('0x3c')]({},_0x1a182b,_0x348531[_0xe41f('0x3e')]);var _0x2d0cf7={'where':_0x1a182b[_0xe41f('0x39')]};return db[_0xe41f('0x2b')]['count'](_0x2d0cf7)['then'](function(_0x537fbf){_0x6ec664['count']=_0x537fbf;if(_0x348531[_0xe41f('0x30')][_0xe41f('0x3f')]){_0x1a182b[_0xe41f('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xe41f('0x41')](_0x1a182b);})[_0xe41f('0x24')](function(_0x55bf6f){_0x6ec664['rows']=_0x55bf6f;return _0x6ec664;})[_0xe41f('0x24')](respondWithFilteredResult(_0x2a7bf4,_0x1a182b))[_0xe41f('0x42')](handleError(_0x2a7bf4,null));};exports[_0xe41f('0x43')]=function(_0x384001,_0x27bdee){var _0x56e180={'raw':!![],'where':{'id':_0x384001['params']['id']}},_0x82727b={};_0x82727b[_0xe41f('0x2f')]=_[_0xe41f('0x44')](db['JscriptyAnswerReport'][_0xe41f('0x2c')]);_0x82727b['query']=_[_0xe41f('0x44')](_0x384001[_0xe41f('0x30')]);_0x82727b[_0xe41f('0x31')]=_['intersection'](_0x82727b[_0xe41f('0x2f')],_0x82727b['query']);_0x56e180[_0xe41f('0x34')]=_[_0xe41f('0x32')](_0x82727b[_0xe41f('0x2f')],qs[_0xe41f('0x33')](_0x384001[_0xe41f('0x30')][_0xe41f('0x33')]));_0x56e180[_0xe41f('0x34')]=_0x56e180[_0xe41f('0x34')]['length']?_0x56e180[_0xe41f('0x34')]:_0x82727b['model'];if(_0x384001[_0xe41f('0x30')]['includeAll']){_0x56e180[_0xe41f('0x40')]=[{'all':!![]}];}_0x56e180=_[_0xe41f('0x3c')]({},_0x56e180,_0x384001[_0xe41f('0x3e')]);return db[_0xe41f('0x2b')]['find'](_0x56e180)[_0xe41f('0x24')](handleEntityNotFound(_0x27bdee,null))['then'](respondWithResult(_0x27bdee,null))[_0xe41f('0x42')](handleError(_0x27bdee,null));};exports[_0xe41f('0x45')]=function(_0x6154a,_0x3a5974){return db['JscriptyAnswerReport'][_0xe41f('0x45')](_0x6154a['body'],{})['then'](respondWithResult(_0x3a5974,0xc9))['catch'](handleError(_0x3a5974,null));};exports[_0xe41f('0x23')]=function(_0x25b374,_0x59ef57){if(_0x25b374[_0xe41f('0x46')]['id']){delete _0x25b374[_0xe41f('0x46')]['id'];}return db[_0xe41f('0x2b')][_0xe41f('0x47')]({'where':{'id':_0x25b374[_0xe41f('0x48')]['id']}})[_0xe41f('0x24')](handleEntityNotFound(_0x59ef57,null))[_0xe41f('0x24')](saveUpdates(_0x25b374[_0xe41f('0x46')],null))[_0xe41f('0x24')](respondWithResult(_0x59ef57,null))[_0xe41f('0x42')](handleError(_0x59ef57,null));};exports['destroy']=function(_0x119e32,_0x97c6c6){return db[_0xe41f('0x2b')]['find']({'where':{'id':_0x119e32[_0xe41f('0x48')]['id']}})[_0xe41f('0x24')](handleEntityNotFound(_0x97c6c6,null))[_0xe41f('0x24')](removeEntity(_0x97c6c6,null))[_0xe41f('0x42')](handleError(_0x97c6c6,null));};exports[_0xe41f('0x49')]=function(_0x4f8f47,_0x23cb73){return db[_0xe41f('0x2b')]['describe']()['then'](respondWithResult(_0x23cb73,null))['catch'](handleError(_0x23cb73,null));}; \ No newline at end of file +var _0x1db9=['merge','VIRTUAL','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x5ed32c,_0x956025){var _0x271ea3=function(_0x206a21){while(--_0x206a21){_0x5ed32c['push'](_0x5ed32c['shift']());}};_0x271ea3(++_0x956025);}(_0x1db9,0x176));var _0x91db=function(_0x19e220,_0x46f8a5){_0x19e220=_0x19e220-0x0;var _0x53f64f=_0x1db9[_0x19e220];return _0x53f64f;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=typeof _0x33b39d[_0x91db('0x19')]===_0x91db('0x1a')&&typeof _0x33b39d[_0x91db('0x1b')]===_0x91db('0x1a');var _0x5f5440=_0x260b56[_0x91db('0x1c')];var _0x23d125=_0x143bc4?0x0:_0x33b39d[_0x91db('0x19')];var _0x42e66c=_0x143bc4?_0x260b56[_0x91db('0x1c')]:_0x33b39d[_0x91db('0x19')]+_0x33b39d['limit'];var _0x4ae820;if(_0x42e66c>=_0x5f5440){_0x42e66c=_0x5f5440;_0x4ae820=0xc8;}else{_0x4ae820=0xce;}_0x2df307[_0x91db('0x16')](_0x4ae820);return _0x2df307[_0x91db('0x1d')](_0x91db('0x1e'),_0x23d125+'-'+_0x42e66c+'/'+_0x5f5440)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x50cf9c){return function(_0x168dea){try{jsonpatch[_0x91db('0x1f')](_0x168dea,_0x50cf9c,!![]);}catch(_0x6e3ca6){return BPromise[_0x91db('0x20')](_0x6e3ca6);}return _0x168dea[_0x91db('0x21')]();};}function saveUpdates(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x22')](_0x31b96c)[_0x91db('0x23')](function(_0x554454){return _0x554454;});}return null;};}function removeEntity(_0x58774f,_0x134caa){return function(_0x2ac8d5){if(_0x2ac8d5){return _0x2ac8d5['destroy']()[_0x91db('0x23')](function(){_0x58774f[_0x91db('0x16')](0xcc)[_0x91db('0x17')]();});}};}function handleEntityNotFound(_0x6e3a9c,_0x3729d3){return function(_0x4e2a8f){if(!_0x4e2a8f){_0x6e3a9c['sendStatus'](0x194);}return _0x4e2a8f;};}function handleError(_0x42e53f,_0x2f0b86){_0x2f0b86=_0x2f0b86||0x1f4;return function(_0x329118){logger['error'](_0x329118[_0x91db('0x24')]);if(_0x329118[_0x91db('0x25')]){delete _0x329118[_0x91db('0x25')];}_0x42e53f[_0x91db('0x16')](_0x2f0b86)['send'](_0x329118);};}exports[_0x91db('0x26')]=function(_0x2a00d1,_0x1805ef){var _0x49c504={},_0x2ff6c8={},_0x69fdc2={'count':0x0,'rows':[]};var _0x2d3ebd=_[_0x91db('0x27')](db[_0x91db('0x28')][_0x91db('0x29')],function(_0x2e6a27){return{'name':_0x2e6a27[_0x91db('0x2a')],'type':_0x2e6a27[_0x91db('0x2b')][_0x91db('0x2c')]};});_0x2ff6c8[_0x91db('0x2d')]=_[_0x91db('0x27')](_0x2d3ebd,_0x91db('0x25'));_0x2ff6c8[_0x91db('0x2e')]=_['keys'](_0x2a00d1[_0x91db('0x2e')]);_0x2ff6c8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],_0x2ff6c8[_0x91db('0x2e')]);_0x49c504['attributes']=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],qs[_0x91db('0x31')](_0x2a00d1['query'][_0x91db('0x31')]));_0x49c504['attributes']=_0x49c504[_0x91db('0x32')][_0x91db('0x33')]?_0x49c504[_0x91db('0x32')]:_0x2ff6c8[_0x91db('0x2d')];if(!_0x2a00d1['query'][_0x91db('0x34')](_0x91db('0x35'))){_0x49c504[_0x91db('0x1b')]=qs['limit'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x1b')]);_0x49c504['offset']=qs[_0x91db('0x19')](_0x2a00d1[_0x91db('0x2e')]['offset']);}_0x49c504[_0x91db('0x36')]=qs['sort'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x37')]);_0x49c504['where']=qs['filters'](_['pick'](_0x2a00d1[_0x91db('0x2e')],_0x2ff6c8[_0x91db('0x2f')]),_0x2d3ebd);if(_0x2a00d1['query'][_0x91db('0x38')]){_0x49c504[_0x91db('0x39')]=_[_0x91db('0x3a')](_0x49c504[_0x91db('0x39')],{'$or':_[_0x91db('0x27')](_0x2d3ebd,function(_0x3cccc7){if(_0x3cccc7[_0x91db('0x2b')]!==_0x91db('0x3b')){var _0xcdc472={};_0xcdc472[_0x3cccc7[_0x91db('0x25')]]={'$like':'%'+_0x2a00d1[_0x91db('0x2e')]['filter']+'%'};return _0xcdc472;}})});}_0x49c504=_[_0x91db('0x3a')]({},_0x49c504,_0x2a00d1['options']);var _0x14de6d={'where':_0x49c504[_0x91db('0x39')]};return db['JscriptyAnswerReport'][_0x91db('0x1c')](_0x14de6d)[_0x91db('0x23')](function(_0x16a7e9){_0x69fdc2[_0x91db('0x1c')]=_0x16a7e9;if(_0x2a00d1[_0x91db('0x2e')]['includeAll']){_0x49c504[_0x91db('0x3c')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3d')](_0x49c504);})['then'](function(_0x4733a4){_0x69fdc2[_0x91db('0x3e')]=_0x4733a4;return _0x69fdc2;})[_0x91db('0x23')](respondWithFilteredResult(_0x1805ef,_0x49c504))['catch'](handleError(_0x1805ef,null));};exports[_0x91db('0x3f')]=function(_0x2b7830,_0x29831c){var _0x3d73a7={'raw':!![],'where':{'id':_0x2b7830['params']['id']}},_0x3609e1={};_0x3609e1[_0x91db('0x2d')]=_['keys'](db[_0x91db('0x28')][_0x91db('0x29')]);_0x3609e1[_0x91db('0x2e')]=_[_0x91db('0x40')](_0x2b7830[_0x91db('0x2e')]);_0x3609e1[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x3609e1[_0x91db('0x2d')],_0x3609e1[_0x91db('0x2e')]);_0x3d73a7[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3609e1['model'],qs['fields'](_0x2b7830[_0x91db('0x2e')][_0x91db('0x31')]));_0x3d73a7[_0x91db('0x32')]=_0x3d73a7['attributes'][_0x91db('0x33')]?_0x3d73a7[_0x91db('0x32')]:_0x3609e1[_0x91db('0x2d')];if(_0x2b7830[_0x91db('0x2e')][_0x91db('0x41')]){_0x3d73a7['include']=[{'all':!![]}];}_0x3d73a7=_[_0x91db('0x3a')]({},_0x3d73a7,_0x2b7830['options']);return db[_0x91db('0x28')][_0x91db('0x42')](_0x3d73a7)[_0x91db('0x23')](handleEntityNotFound(_0x29831c,null))[_0x91db('0x23')](respondWithResult(_0x29831c,null))[_0x91db('0x43')](handleError(_0x29831c,null));};exports[_0x91db('0x44')]=function(_0x17f7b3,_0xd5a8fb){return db[_0x91db('0x28')]['create'](_0x17f7b3['body'],{})[_0x91db('0x23')](respondWithResult(_0xd5a8fb,0xc9))[_0x91db('0x43')](handleError(_0xd5a8fb,null));};exports[_0x91db('0x22')]=function(_0x410423,_0x27e224){if(_0x410423['body']['id']){delete _0x410423[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x42')]({'where':{'id':_0x410423[_0x91db('0x46')]['id']}})[_0x91db('0x23')](handleEntityNotFound(_0x27e224,null))['then'](saveUpdates(_0x410423[_0x91db('0x45')],null))[_0x91db('0x23')](respondWithResult(_0x27e224,null))[_0x91db('0x43')](handleError(_0x27e224,null));};exports[_0x91db('0x47')]=function(_0x50b269,_0x3d8dfb){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x50b269[_0x91db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d8dfb,null))[_0x91db('0x23')](removeEntity(_0x3d8dfb,null))['catch'](handleError(_0x3d8dfb,null));};exports['describe']=function(_0x2c30ff,_0x371277){return db[_0x91db('0x28')]['describe']()[_0x91db('0x23')](respondWithResult(_0x371277,null))[_0x91db('0x43')](handleError(_0x371277,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index cf8d870..2dbb674 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 _0x8d41=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x323853,_0x1eee86){var _0x26dca4=function(_0x154fb0){while(--_0x154fb0){_0x323853['push'](_0x323853['shift']());}};_0x26dca4(++_0x1eee86);}(_0x8d41,0x138));var _0x18d4=function(_0x1b943f,_0x6f6e83){_0x1b943f=_0x1b943f-0x0;var _0x8b7549=_0x8d41[_0x1b943f];return _0x8b7549;};'use strict';var _=require(_0x18d4('0x0'));var util=require('util');var logger=require(_0x18d4('0x1'))(_0x18d4('0x2'));var moment=require(_0x18d4('0x3'));var BPromise=require(_0x18d4('0x4'));var rp=require(_0x18d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18d4('0x6'));var config=require(_0x18d4('0x7'));var attributes=require(_0x18d4('0x8'));module[_0x18d4('0x9')]=function(_0x400286,_0x59a85d){return _0x400286[_0x18d4('0xa')](_0x18d4('0xb'),attributes,{'tableName':_0x18d4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fd5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','lodash','util'];(function(_0x1926bd,_0x582970){var _0x5ae719=function(_0x554de3){while(--_0x554de3){_0x1926bd['push'](_0x1926bd['shift']());}};_0x5ae719(++_0x582970);}(_0x5fd5,0x1df));var _0x55fd=function(_0x337dcc,_0x35de56){_0x337dcc=_0x337dcc-0x0;var _0x5a54b4=_0x5fd5[_0x337dcc];return _0x5a54b4;};'use strict';var _=require(_0x55fd('0x0'));var util=require(_0x55fd('0x1'));var logger=require(_0x55fd('0x2'))(_0x55fd('0x3'));var moment=require(_0x55fd('0x4'));var BPromise=require(_0x55fd('0x5'));var rp=require(_0x55fd('0x6'));var fs=require('fs');var path=require(_0x55fd('0x7'));var rimraf=require(_0x55fd('0x8'));var config=require(_0x55fd('0x9'));var attributes=require(_0x55fd('0xa'));module[_0x55fd('0xb')]=function(_0x5a3001,_0x4cce42){return _0x5a3001['define']('JscriptyAnswerReport',attributes,{'tableName':_0x55fd('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 22e1c72..cbcc5a8 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 _0x6202=['error','message','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3d8522,_0x14fe7a){var _0x27fb05=function(_0x5e53c7){while(--_0x5e53c7){_0x3d8522['push'](_0x3d8522['shift']());}};_0x27fb05(++_0x14fe7a);}(_0x6202,0x1bd));var _0x2620=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x6202[_0x36ed48];return _0x51c63a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2620('0x0'));var BPromise=require('bluebird');var rs=require(_0x2620('0x1'));var fs=require('fs');var Redis=require(_0x2620('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2620('0x3'));var logger=require(_0x2620('0x4'))(_0x2620('0x5'));var config=require(_0x2620('0x6'));var jayson=require(_0x2620('0x7'));var client=jayson[_0x2620('0x8')][_0x2620('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x183fed,_0x2121fd,_0x1f792b){return new BPromise(function(_0x3a7ca8,_0x268202){return client[_0x2620('0xa')](_0x183fed,_0x1f792b)[_0x2620('0xb')](function(_0x1a01f0){logger[_0x2620('0xc')](_0x2620('0xd'),_0x2121fd,_0x2620('0xe'));logger[_0x2620('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x2121fd,_0x2620('0xe'),JSON[_0x2620('0x10')](_0x1a01f0));if(_0x1a01f0[_0x2620('0x11')]){if(_0x1a01f0[_0x2620('0x11')]['code']===0x1f4){logger[_0x2620('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2121fd,_0x1a01f0[_0x2620('0x11')][_0x2620('0x12')]);return _0x268202(_0x1a01f0['error'][_0x2620('0x12')]);}logger[_0x2620('0x11')](_0x2620('0xd'),_0x2121fd,_0x1a01f0[_0x2620('0x11')][_0x2620('0x12')]);return _0x3a7ca8(_0x1a01f0[_0x2620('0x11')]['message']);}else{logger[_0x2620('0xc')](_0x2620('0xd'),_0x2121fd,_0x2620('0xe'));_0x3a7ca8(_0x1a01f0[_0x2620('0x13')][_0x2620('0x12')]);}})[_0x2620('0x14')](function(_0x458055){logger[_0x2620('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2121fd,_0x458055);_0x268202(_0x458055);});});} \ No newline at end of file +var _0xce0a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xce0a,0x83));var _0xace0=function(_0x446f11,_0x95cf21){_0x446f11=_0x446f11-0x0;var _0x385cb5=_0xce0a[_0x446f11];return _0x385cb5;};'use strict';var _=require('lodash');var util=require(_0xace0('0x0'));var moment=require('moment');var BPromise=require(_0xace0('0x1'));var rs=require(_0xace0('0x2'));var fs=require('fs');var Redis=require(_0xace0('0x3'));var db=require(_0xace0('0x4'))['db'];var utils=require(_0xace0('0x5'));var logger=require(_0xace0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xace0('0x7'));var client=jayson[_0xace0('0x8')][_0xace0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e0ec9,_0xb8792a,_0x570ab2){return new BPromise(function(_0xee7b84,_0x3b7517){return client[_0xace0('0xa')](_0x3e0ec9,_0x570ab2)[_0xace0('0xb')](function(_0x2bdbc2){logger[_0xace0('0xc')](_0xace0('0xd'),_0xb8792a,_0xace0('0xe'));logger[_0xace0('0xf')](_0xace0('0x10'),_0xb8792a,'request\x20sent',JSON[_0xace0('0x11')](_0x2bdbc2));if(_0x2bdbc2[_0xace0('0x12')]){if(_0x2bdbc2[_0xace0('0x12')]['code']===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0xb8792a,_0x2bdbc2['error'][_0xace0('0x13')]);return _0x3b7517(_0x2bdbc2[_0xace0('0x12')]['message']);}logger[_0xace0('0x12')](_0xace0('0xd'),_0xb8792a,_0x2bdbc2['error'][_0xace0('0x13')]);return _0xee7b84(_0x2bdbc2[_0xace0('0x12')]['message']);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0xb8792a,_0xace0('0xe'));_0xee7b84(_0x2bdbc2[_0xace0('0x14')][_0xace0('0x13')]);}})[_0xace0('0x15')](function(_0x5fc1a1){logger['error'](_0xace0('0xd'),_0xb8792a,_0x5fc1a1);_0x3b7517(_0x5fc1a1);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 9a20682..e930fdf 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 _0xa315=['../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','getSessions','/:id/answers','getAnswers','getSummary','create','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x24aadd,_0x57c7e8){var _0x27437d=function(_0xb24e5a){while(--_0xb24e5a){_0x24aadd['push'](_0x24aadd['shift']());}};_0x27437d(++_0x57c7e8);}(_0xa315,0x119));var _0x5a31=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0xa315[_0x1e6e4e];return _0x3d746b;};'use strict';var multer=require(_0x5a31('0x0'));var util=require(_0x5a31('0x1'));var path=require(_0x5a31('0x2'));var timeout=require(_0x5a31('0x3'));var express=require('express');var router=express[_0x5a31('0x4')]();var fs_extra=require(_0x5a31('0x5'));var auth=require(_0x5a31('0x6'));var interaction=require(_0x5a31('0x7'));var config=require(_0x5a31('0x8'));var controller=require(_0x5a31('0x9'));router[_0x5a31('0xa')]('/',auth[_0x5a31('0xb')](),controller['index']);router[_0x5a31('0xa')](_0x5a31('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5a31('0xa')]('/:id/sessions',auth[_0x5a31('0xb')](),controller[_0x5a31('0xd')]);router[_0x5a31('0xa')](_0x5a31('0xe'),auth['isAuthenticated'](),controller[_0x5a31('0xf')]);router[_0x5a31('0xa')]('/:id/summary',auth[_0x5a31('0xb')](),timeout('30s'),controller[_0x5a31('0x10')]);router['post']('/',auth[_0x5a31('0xb')](),controller[_0x5a31('0x11')]);router[_0x5a31('0x12')]('/:id/clone',auth[_0x5a31('0xb')](),controller['clone']);router[_0x5a31('0x13')](_0x5a31('0xc'),auth['isAuthenticated'](),controller[_0x5a31('0x14')]);router[_0x5a31('0x15')](_0x5a31('0xc'),auth[_0x5a31('0xb')](),controller[_0x5a31('0x16')]);module[_0x5a31('0x17')]=router; \ No newline at end of file +var _0xb6d2=['/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','post','create','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index'];(function(_0x19bc48,_0x5cab08){var _0xe7fb47=function(_0x548f7a){while(--_0x548f7a){_0x19bc48['push'](_0x19bc48['shift']());}};_0xe7fb47(++_0x5cab08);}(_0xb6d2,0x7f));var _0x2b6d=function(_0x4be603,_0x7fe9cd){_0x4be603=_0x4be603-0x0;var _0x4288bf=_0xb6d2[_0x4be603];return _0x4288bf;};'use strict';var multer=require(_0x2b6d('0x0'));var util=require(_0x2b6d('0x1'));var path=require(_0x2b6d('0x2'));var timeout=require(_0x2b6d('0x3'));var express=require('express');var router=express[_0x2b6d('0x4')]();var fs_extra=require(_0x2b6d('0x5'));var auth=require(_0x2b6d('0x6'));var interaction=require(_0x2b6d('0x7'));var config=require(_0x2b6d('0x8'));var controller=require(_0x2b6d('0x9'));router[_0x2b6d('0xa')]('/',auth[_0x2b6d('0xb')](),controller[_0x2b6d('0xc')]);router[_0x2b6d('0xa')](_0x2b6d('0xd'),auth[_0x2b6d('0xb')](),controller[_0x2b6d('0xe')]);router[_0x2b6d('0xa')](_0x2b6d('0xf'),auth[_0x2b6d('0xb')](),controller[_0x2b6d('0x10')]);router[_0x2b6d('0xa')](_0x2b6d('0x11'),auth['isAuthenticated'](),controller[_0x2b6d('0x12')]);router[_0x2b6d('0xa')]('/:id/summary',auth[_0x2b6d('0xb')](),timeout(_0x2b6d('0x13')),controller['getSummary']);router[_0x2b6d('0x14')]('/',auth[_0x2b6d('0xb')](),controller[_0x2b6d('0x15')]);router[_0x2b6d('0x14')]('/:id/clone',auth['isAuthenticated'](),controller[_0x2b6d('0x16')]);router[_0x2b6d('0x17')](_0x2b6d('0xd'),auth[_0x2b6d('0xb')](),controller[_0x2b6d('0x18')]);router[_0x2b6d('0x19')](_0x2b6d('0xd'),auth[_0x2b6d('0xb')](),controller[_0x2b6d('0x1a')]);module[_0x2b6d('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 a27f57f..729bae6 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 _0x41f2=['formData','stringify','isString','format','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','isObjectLike','setDataValue'];(function(_0x6f8972,_0x343da7){var _0x5677d9=function(_0x5eb51f){while(--_0x5eb51f){_0x6f8972['push'](_0x6f8972['shift']());}};_0x5677d9(++_0x343da7);}(_0x41f2,0x105));var _0x241f=function(_0xfad1d2,_0x58c24e){_0xfad1d2=_0xfad1d2-0x0;var _0x50f4e6=_0x41f2[_0xfad1d2];return _0x50f4e6;};'use strict';var Sequelize=require(_0x241f('0x0'));var _=require(_0x241f('0x1'));var util=require(_0x241f('0x2'));module[_0x241f('0x3')]={'name':{'type':Sequelize[_0x241f('0x4')],'unique':_0x241f('0x5')},'description':{'type':Sequelize[_0x241f('0x4')]},'formData':{'type':Sequelize[_0x241f('0x6')]('long'),'set':function(_0x48cdf2){if(_[_0x241f('0x7')](_0x48cdf2)){this[_0x241f('0x8')](_0x241f('0x9'),JSON[_0x241f('0xa')](_0x48cdf2));}else if(_[_0x241f('0xb')](_0x48cdf2)){this[_0x241f('0x8')](_0x241f('0x9'),_0x48cdf2);}else{this['setDataValue'](_0x241f('0x9'),util[_0x241f('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x241f('0x5'))||'',this['getDataValue'](_0x241f('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x241f('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x4190=['util','STRING','TEXT','long','setDataValue','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize'];(function(_0x4f6312,_0x2eb7b3){var _0x42ef2c=function(_0x2aab96){while(--_0x2aab96){_0x4f6312['push'](_0x4f6312['shift']());}};_0x42ef2c(++_0x2eb7b3);}(_0x4190,0xe5));var _0x0419=function(_0x415ff8,_0x176fb5){_0x415ff8=_0x415ff8-0x0;var _0x1f347a=_0x4190[_0x415ff8];return _0x1f347a;};'use strict';var Sequelize=require(_0x0419('0x0'));var _=require('lodash');var util=require(_0x0419('0x1'));module['exports']={'name':{'type':Sequelize[_0x0419('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x0419('0x3')](_0x0419('0x4')),'set':function(_0x204f1d){if(_['isObjectLike'](_0x204f1d)){this[_0x0419('0x5')]('formData',JSON['stringify'](_0x204f1d));}else if(_[_0x0419('0x6')](_0x204f1d)){this[_0x0419('0x5')]('formData',_0x204f1d);}else{this[_0x0419('0x5')]('formData',util['format'](_0x0419('0x7'),this[_0x0419('0x8')]('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0419('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index f773cb3..b4d025b 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 _0x77e2=['JscriptySessionReport','rows','getAnswers','JscriptyAnswerReport','pick','ProjectId','fromCharCode','apply','indexOf','toString','replace','getSummary','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','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','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','Content-Range','update','then','destroy','Projects','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','count','findAll','includeAll','find','catch','create','body','get','role','user','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getSessions','findOne','nolimit','include'];(function(_0x531273,_0x329c01){var _0x3ef126=function(_0x48ab8e){while(--_0x48ab8e){_0x531273['push'](_0x531273['shift']());}};_0x3ef126(++_0x329c01);}(_0x77e2,0x176));var _0x277e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x77e2[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x277e('0x0'));var rimraf=require(_0x277e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x277e('0x2'));var rp=require(_0x277e('0x3'));var moment=require('moment');var BPromise=require(_0x277e('0x4'));var Mustache=require('mustache');var util=require(_0x277e('0x5'));var path=require(_0x277e('0x6'));var sox=require('sox');var csv=require(_0x277e('0x7'));var ejs=require(_0x277e('0x8'));var fs=require('fs');var fs_extra=require(_0x277e('0x9'));var _=require(_0x277e('0xa'));var squel=require(_0x277e('0xb'));var crypto=require('crypto');var jsforce=require(_0x277e('0xc'));var deskjs=require(_0x277e('0xd'));var toCsv=require(_0x277e('0x7'));var querystring=require(_0x277e('0xe'));var Papa=require(_0x277e('0xf'));var Redis=require(_0x277e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x277e('0x11'));var as=require(_0x277e('0x12'));var hardwareService=require(_0x277e('0x13'));var logger=require(_0x277e('0x14'))(_0x277e('0x15'));var utils=require(_0x277e('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x277e('0x17'))['db'];function respondWithStatusCode(_0x2f184b,_0x4e75c4){_0x4e75c4=_0x4e75c4||0xcc;return function(_0x119fb4){if(_0x119fb4){return _0x2f184b[_0x277e('0x18')](_0x4e75c4);}return _0x2f184b[_0x277e('0x19')](_0x4e75c4)[_0x277e('0x1a')]();};}function respondWithResult(_0x557d7c,_0xefc7fa){_0xefc7fa=_0xefc7fa||0xc8;return function(_0x5f5f34){if(_0x5f5f34){return _0x557d7c[_0x277e('0x19')](_0xefc7fa)[_0x277e('0x1b')](_0x5f5f34);}};}function respondWithFilteredResult(_0x153cf6,_0x234059){return function(_0x358f37){if(_0x358f37){var _0x19fca0=typeof _0x234059['offset']===_0x277e('0x1c')&&typeof _0x234059[_0x277e('0x1d')]==='undefined';var _0x32b901=_0x358f37['count'];var _0x35bc8e=_0x19fca0?0x0:_0x234059[_0x277e('0x1e')];var _0x196fca=_0x19fca0?_0x358f37['count']:_0x234059[_0x277e('0x1e')]+_0x234059['limit'];var _0x2b4dce;if(_0x196fca>=_0x32b901){_0x196fca=_0x32b901;_0x2b4dce=0xc8;}else{_0x2b4dce=0xce;}_0x153cf6[_0x277e('0x19')](_0x2b4dce);return _0x153cf6['set'](_0x277e('0x1f'),_0x35bc8e+'-'+_0x196fca+'/'+_0x32b901)[_0x277e('0x1b')](_0x358f37);}return null;};}function patchUpdates(_0x37d634){return function(_0x21f065){try{jsonpatch['apply'](_0x21f065,_0x37d634,!![]);}catch(_0x2f6325){return BPromise['reject'](_0x2f6325);}return _0x21f065['save']();};}function saveUpdates(_0x17a812,_0x7927e8){return function(_0x10dfae){if(_0x10dfae){return _0x10dfae[_0x277e('0x20')](_0x17a812)[_0x277e('0x21')](function(_0x3536eb){return _0x3536eb;});}return null;};}function removeEntity(_0x26c2bd,_0x2acf6f){return function(_0x3717d6){if(_0x3717d6){return _0x3717d6[_0x277e('0x22')]()[_0x277e('0x21')](function(){var _0x2b6154=_0x3717d6['get']({'plain':!![]});var _0x20c069=_0x277e('0x23');return db['UserProfileResource'][_0x277e('0x22')]({'where':{'type':_0x20c069,'resourceId':_0x2b6154['id']}})['then'](function(){return _0x3717d6;});})['then'](function(){_0x26c2bd[_0x277e('0x19')](0xcc)[_0x277e('0x1a')]();});}};}function handleEntityNotFound(_0x159b2e,_0x220809){return function(_0x41158d){if(!_0x41158d){_0x159b2e[_0x277e('0x18')](0x194);}return _0x41158d;};}function handleError(_0x22eb18,_0x4828e1){_0x4828e1=_0x4828e1||0x1f4;return function(_0x9b4821){logger['error'](_0x9b4821[_0x277e('0x24')]);if(_0x9b4821[_0x277e('0x25')]){delete _0x9b4821['name'];}_0x22eb18['status'](_0x4828e1)[_0x277e('0x26')](_0x9b4821);};}exports[_0x277e('0x27')]=function(_0x5eb0fa,_0x12734a){var _0x598db={},_0x3967c7={},_0x4095fa={'count':0x0,'rows':[]};var _0x5e53bd=_[_0x277e('0x28')](db[_0x277e('0x29')][_0x277e('0x2a')],function(_0x352cdc){return{'name':_0x352cdc[_0x277e('0x2b')],'type':_0x352cdc['type']['key']};});_0x3967c7[_0x277e('0x2c')]=_[_0x277e('0x28')](_0x5e53bd,_0x277e('0x25'));_0x3967c7[_0x277e('0x2d')]=_[_0x277e('0x2e')](_0x5eb0fa[_0x277e('0x2d')]);_0x3967c7[_0x277e('0x2f')]=_['intersection'](_0x3967c7[_0x277e('0x2c')],_0x3967c7['query']);_0x598db[_0x277e('0x30')]=_[_0x277e('0x31')](_0x3967c7['model'],qs[_0x277e('0x32')](_0x5eb0fa[_0x277e('0x2d')][_0x277e('0x32')]));_0x598db['attributes']=_0x598db['attributes'][_0x277e('0x33')]?_0x598db['attributes']:_0x3967c7[_0x277e('0x2c')];if(!_0x5eb0fa[_0x277e('0x2d')][_0x277e('0x34')]('nolimit')){_0x598db['limit']=qs[_0x277e('0x1d')](_0x5eb0fa[_0x277e('0x2d')][_0x277e('0x1d')]);_0x598db[_0x277e('0x1e')]=qs[_0x277e('0x1e')](_0x5eb0fa[_0x277e('0x2d')][_0x277e('0x1e')]);}_0x598db[_0x277e('0x35')]=qs[_0x277e('0x36')](_0x5eb0fa['query'][_0x277e('0x36')]);_0x598db[_0x277e('0x37')]=qs[_0x277e('0x2f')](_['pick'](_0x5eb0fa[_0x277e('0x2d')],_0x3967c7[_0x277e('0x2f')]),_0x5e53bd);if(_0x5eb0fa[_0x277e('0x2d')]['filter']){_0x598db[_0x277e('0x37')]=_[_0x277e('0x38')](_0x598db[_0x277e('0x37')],{'$or':_['map'](_0x5e53bd,function(_0x2512e3){if(_0x2512e3[_0x277e('0x39')]!==_0x277e('0x3a')){var _0x50c077={};_0x50c077[_0x2512e3[_0x277e('0x25')]]={'$like':'%'+_0x5eb0fa[_0x277e('0x2d')][_0x277e('0x3b')]+'%'};return _0x50c077;}})});}_0x598db=_[_0x277e('0x38')]({},_0x598db,_0x5eb0fa[_0x277e('0x3c')]);var _0xe8bc18={'where':_0x598db['where']};return db[_0x277e('0x29')][_0x277e('0x3d')](_0xe8bc18)[_0x277e('0x21')](function(_0x1c79a6){_0x4095fa[_0x277e('0x3d')]=_0x1c79a6;if(_0x5eb0fa[_0x277e('0x2d')]['includeAll']){_0x598db['include']=[{'all':!![]}];}return db[_0x277e('0x29')][_0x277e('0x3e')](_0x598db);})[_0x277e('0x21')](function(_0x421b5a){_0x4095fa['rows']=_0x421b5a;return _0x4095fa;})['then'](respondWithFilteredResult(_0x12734a,_0x598db))['catch'](handleError(_0x12734a,null));};exports['show']=function(_0x3e2a61,_0x43316a){var _0x2862d2={'raw':![],'where':{'id':_0x3e2a61['params']['id']}},_0x197479={};_0x197479[_0x277e('0x2c')]=_[_0x277e('0x2e')](db[_0x277e('0x29')][_0x277e('0x2a')]);_0x197479[_0x277e('0x2d')]=_[_0x277e('0x2e')](_0x3e2a61[_0x277e('0x2d')]);_0x197479[_0x277e('0x2f')]=_[_0x277e('0x31')](_0x197479['model'],_0x197479[_0x277e('0x2d')]);_0x2862d2[_0x277e('0x30')]=_[_0x277e('0x31')](_0x197479[_0x277e('0x2c')],qs[_0x277e('0x32')](_0x3e2a61['query'][_0x277e('0x32')]));_0x2862d2[_0x277e('0x30')]=_0x2862d2[_0x277e('0x30')][_0x277e('0x33')]?_0x2862d2[_0x277e('0x30')]:_0x197479[_0x277e('0x2c')];if(_0x3e2a61[_0x277e('0x2d')][_0x277e('0x3f')]){_0x2862d2['include']=[{'all':!![]}];}_0x2862d2=_['merge']({},_0x2862d2,_0x3e2a61[_0x277e('0x3c')]);return db[_0x277e('0x29')][_0x277e('0x40')](_0x2862d2)[_0x277e('0x21')](handleEntityNotFound(_0x43316a,null))[_0x277e('0x21')](respondWithResult(_0x43316a,null))[_0x277e('0x41')](handleError(_0x43316a,null));};exports[_0x277e('0x42')]=function(_0x1dbbba,_0x2983e2){return db['JscriptyProject']['create'](_0x1dbbba[_0x277e('0x43')],{})[_0x277e('0x21')](function(_0x503797){var _0x252886=_0x1dbbba['user'][_0x277e('0x44')]({'plain':!![]});if(!_0x252886)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x252886[_0x277e('0x45')]===_0x277e('0x46')){var _0x176b9b=_0x503797[_0x277e('0x44')]({'plain':!![]});var _0x39937b=_0x277e('0x23');return db[_0x277e('0x47')][_0x277e('0x40')]({'where':{'name':_0x39937b,'userProfileId':_0x252886['userProfileId']},'raw':!![]})[_0x277e('0x21')](function(_0x1a001b){if(_0x1a001b&&_0x1a001b['autoAssociation']===0x0){return db[_0x277e('0x48')][_0x277e('0x42')]({'name':_0x176b9b[_0x277e('0x25')],'resourceId':_0x176b9b['id'],'type':_0x1a001b['name'],'sectionId':_0x1a001b['id']},{})[_0x277e('0x21')](function(){return _0x503797;});}else{return _0x503797;}})['catch'](function(_0x471856){logger[_0x277e('0x49')](_0x277e('0x4a'),_0x471856);throw _0x471856;});}return _0x503797;})[_0x277e('0x21')](respondWithResult(_0x2983e2,0xc9))['catch'](handleError(_0x2983e2,null));};exports[_0x277e('0x4b')]=function(_0x358656,_0x35a483){var _0x40fd8c={'where':{'id':_0x358656[_0x277e('0x4c')]['id']}},_0x5e3cc9={};_0x5e3cc9[_0x277e('0x2c')]=_[_0x277e('0x2e')](db[_0x277e('0x29')][_0x277e('0x2a')]);_0x40fd8c[_0x277e('0x30')]=_[_0x277e('0x31')](_0x5e3cc9['model'],qs[_0x277e('0x32')](_0x358656[_0x277e('0x2d')][_0x277e('0x32')]));_0x40fd8c[_0x277e('0x30')]=_0x40fd8c[_0x277e('0x30')][_0x277e('0x33')]?_0x40fd8c[_0x277e('0x30')]:_0x5e3cc9[_0x277e('0x2c')];if(_0x358656['query'][_0x277e('0x3f')]){_0x40fd8c['include']=[{'all':!![]}];}_0x40fd8c=_[_0x277e('0x38')]({},_0x40fd8c,_0x358656[_0x277e('0x3c')]);return db[_0x277e('0x29')]['find'](_0x40fd8c)[_0x277e('0x21')](handleEntityNotFound(_0x35a483,null))[_0x277e('0x21')](function(_0x34ea28){if(_0x34ea28){var _0x288d98=_0x34ea28[_0x277e('0x44')]({'plain':!![]});_0x288d98=qs[_0x277e('0x4d')](_0x288d98,['id',_0x277e('0x4e'),_0x277e('0x4f')]);_0x358656[_0x277e('0x43')]=_[_0x277e('0x4d')](_0x358656[_0x277e('0x43')],['id','createdAt',_0x277e('0x4f')]);return db[_0x277e('0x29')][_0x277e('0x42')](_[_0x277e('0x38')](_0x288d98,_0x358656[_0x277e('0x43')]),{'include':_0x358656[_0x277e('0x2d')][_0x277e('0x3f')]?[{'all':!![]}]:undefined})[_0x277e('0x21')](function(_0x217d14){var _0x28c60e=_0x358656[_0x277e('0x46')][_0x277e('0x44')]({'plain':!![]});if(!_0x28c60e)throw new Error(_0x277e('0x50'));if(_0x28c60e[_0x277e('0x45')]===_0x277e('0x46')){var _0x355b5a=_0x217d14[_0x277e('0x44')]({'plain':!![]});var _0x2da001=_0x277e('0x23');return db[_0x277e('0x47')][_0x277e('0x40')]({'where':{'name':_0x2da001,'userProfileId':_0x28c60e['userProfileId']},'raw':!![]})[_0x277e('0x21')](function(_0x1e23f8){if(_0x1e23f8&&_0x1e23f8[_0x277e('0x51')]===0x0){return db[_0x277e('0x48')][_0x277e('0x42')]({'name':_0x355b5a[_0x277e('0x25')],'resourceId':_0x355b5a['id'],'type':_0x1e23f8['name'],'sectionId':_0x1e23f8['id']},{})[_0x277e('0x21')](function(){return _0x217d14;});}else{return _0x217d14;}})[_0x277e('0x41')](function(_0x57f9ee){logger['error'](_0x277e('0x4a'),_0x57f9ee);throw _0x57f9ee;});}return _0x217d14;});}})['then'](respondWithResult(_0x35a483,0xc9))[_0x277e('0x41')](handleError(_0x35a483,null));};exports['update']=function(_0x2dc56b,_0x2d82e5){if(_0x2dc56b['body']['id']){delete _0x2dc56b[_0x277e('0x43')]['id'];}return db[_0x277e('0x29')]['find']({'where':{'id':_0x2dc56b[_0x277e('0x4c')]['id']}})[_0x277e('0x21')](handleEntityNotFound(_0x2d82e5,null))['then'](saveUpdates(_0x2dc56b['body'],null))[_0x277e('0x21')](respondWithResult(_0x2d82e5,null))[_0x277e('0x41')](handleError(_0x2d82e5,null));};exports[_0x277e('0x22')]=function(_0x466e62,_0x5d5a9d){return db['JscriptyProject']['find']({'where':{'id':_0x466e62[_0x277e('0x4c')]['id']}})[_0x277e('0x21')](handleEntityNotFound(_0x5d5a9d,null))[_0x277e('0x21')](removeEntity(_0x5d5a9d,null))[_0x277e('0x41')](handleError(_0x5d5a9d,null));};exports[_0x277e('0x52')]=function(_0x4f1a7c,_0x4c32d4,_0x5d0da4){var _0x50623a={'raw':!![],'where':{}};var _0x22bb3a={};var _0xc17670={'count':0x0,'rows':[]};return db[_0x277e('0x29')][_0x277e('0x53')]({'where':{'id':_0x4f1a7c['params']['id']}})['then'](handleEntityNotFound(_0x4c32d4,null))[_0x277e('0x21')](function(_0x49c91e){if(_0x49c91e){_0x22bb3a[_0x277e('0x2c')]=_[_0x277e('0x2e')](db['JscriptySessionReport']['rawAttributes']);_0x22bb3a[_0x277e('0x2d')]=_['keys'](_0x4f1a7c[_0x277e('0x2d')]);_0x22bb3a[_0x277e('0x2f')]=_[_0x277e('0x31')](_0x22bb3a[_0x277e('0x2c')],_0x22bb3a['query']);_0x50623a[_0x277e('0x30')]=_['intersection'](_0x22bb3a['model'],qs[_0x277e('0x32')](_0x4f1a7c[_0x277e('0x2d')][_0x277e('0x32')]));_0x50623a[_0x277e('0x30')]=_0x50623a['attributes']['length']?_0x50623a['attributes']:_0x22bb3a['model'];if(!_0x4f1a7c[_0x277e('0x2d')][_0x277e('0x34')](_0x277e('0x54'))){_0x50623a[_0x277e('0x1d')]=qs[_0x277e('0x1d')](_0x4f1a7c['query']['limit']);_0x50623a['offset']=qs['offset'](_0x4f1a7c[_0x277e('0x2d')][_0x277e('0x1e')]);}_0x50623a[_0x277e('0x35')]=qs[_0x277e('0x36')](_0x4f1a7c[_0x277e('0x2d')]['sort']);_0x50623a[_0x277e('0x37')]=qs[_0x277e('0x2f')](_['pick'](_0x4f1a7c[_0x277e('0x2d')],_0x22bb3a[_0x277e('0x2f')]));_0x50623a[_0x277e('0x37')]['ProjectId']=_0x49c91e['id'];if(_0x4f1a7c['query'][_0x277e('0x3b')]){_0x50623a[_0x277e('0x37')]=_[_0x277e('0x38')](_0x50623a[_0x277e('0x37')],{'$or':_['map'](_0x50623a[_0x277e('0x30')],function(_0x23efe8){var _0x2e55e2={};_0x2e55e2[_0x23efe8]={'$like':'%'+_0x4f1a7c[_0x277e('0x2d')][_0x277e('0x3b')]+'%'};return _0x2e55e2;})});}_0x50623a=_[_0x277e('0x38')]({},_0x50623a,_0x4f1a7c[_0x277e('0x3c')]);return db['JscriptySessionReport'][_0x277e('0x3d')]({'where':_0x50623a[_0x277e('0x37')]})['then'](function(_0x2030a3){_0xc17670[_0x277e('0x3d')]=_0x2030a3;if(_0x4f1a7c[_0x277e('0x2d')][_0x277e('0x3f')]){_0x50623a[_0x277e('0x55')]=[{'all':!![]}];}return db[_0x277e('0x56')][_0x277e('0x3e')](_0x50623a);})[_0x277e('0x21')](function(_0x2e1f75){_0xc17670[_0x277e('0x57')]=_0x2e1f75;return _0xc17670;});}})[_0x277e('0x21')](respondWithFilteredResult(_0x4c32d4,_0x50623a))[_0x277e('0x41')](handleError(_0x4c32d4,null));};exports[_0x277e('0x58')]=function(_0x548426,_0x24b5c8,_0x35414e){var _0x59f0ba={'raw':!![],'where':{}};var _0x697857={};var _0x534715={'count':0x0,'rows':[]};return db[_0x277e('0x29')]['findOne']({'where':{'id':_0x548426[_0x277e('0x4c')]['id']}})[_0x277e('0x21')](handleEntityNotFound(_0x24b5c8,null))['then'](function(_0x391282){if(_0x391282){_0x697857[_0x277e('0x2c')]=_[_0x277e('0x2e')](db[_0x277e('0x59')][_0x277e('0x2a')]);_0x697857[_0x277e('0x2d')]=_[_0x277e('0x2e')](_0x548426['query']);_0x697857[_0x277e('0x2f')]=_[_0x277e('0x31')](_0x697857[_0x277e('0x2c')],_0x697857[_0x277e('0x2d')]);_0x59f0ba[_0x277e('0x30')]=_[_0x277e('0x31')](_0x697857[_0x277e('0x2c')],qs[_0x277e('0x32')](_0x548426['query'][_0x277e('0x32')]));_0x59f0ba[_0x277e('0x30')]=_0x59f0ba[_0x277e('0x30')]['length']?_0x59f0ba['attributes']:_0x697857['model'];if(!_0x548426[_0x277e('0x2d')][_0x277e('0x34')](_0x277e('0x54'))){_0x59f0ba[_0x277e('0x1d')]=qs['limit'](_0x548426[_0x277e('0x2d')]['limit']);_0x59f0ba['offset']=qs[_0x277e('0x1e')](_0x548426[_0x277e('0x2d')]['offset']);}_0x59f0ba['order']=qs['sort'](_0x548426[_0x277e('0x2d')][_0x277e('0x36')]);_0x59f0ba[_0x277e('0x37')]=qs[_0x277e('0x2f')](_[_0x277e('0x5a')](_0x548426[_0x277e('0x2d')],_0x697857[_0x277e('0x2f')]));_0x59f0ba[_0x277e('0x37')][_0x277e('0x5b')]=_0x391282['id'];if(_0x548426[_0x277e('0x2d')][_0x277e('0x3b')]){_0x59f0ba[_0x277e('0x37')]=_['merge'](_0x59f0ba['where'],{'$or':_[_0x277e('0x28')](_0x59f0ba['attributes'],function(_0x520f40){var _0x2fe123={};_0x2fe123[_0x520f40]={'$like':'%'+_0x548426[_0x277e('0x2d')][_0x277e('0x3b')]+'%'};return _0x2fe123;})});}_0x59f0ba=_[_0x277e('0x38')]({},_0x59f0ba,_0x548426[_0x277e('0x3c')]);return db['JscriptyAnswerReport'][_0x277e('0x3d')]({'where':_0x59f0ba[_0x277e('0x37')]})[_0x277e('0x21')](function(_0x24d95b){_0x534715[_0x277e('0x3d')]=_0x24d95b;if(_0x548426[_0x277e('0x2d')][_0x277e('0x3f')]){_0x59f0ba['include']=[{'all':!![]}];}return db[_0x277e('0x59')][_0x277e('0x3e')](_0x59f0ba);})[_0x277e('0x21')](function(_0x7b8fd8){_0x534715[_0x277e('0x57')]=_0x7b8fd8;return _0x534715;});}})[_0x277e('0x21')](respondWithFilteredResult(_0x24b5c8,_0x59f0ba))[_0x277e('0x41')](handleError(_0x24b5c8,null));};function char(_0x511470){return'number'===typeof _0x511470?String[_0x277e('0x5c')][_0x277e('0x5d')](null,arguments):_0x511470;}function needsEncapsulation(_0x1fd45e){return!!_0x1fd45e&&(_0x1fd45e['toString']()[_0x277e('0x5e')](char(0xd))>=0x0||_0x1fd45e[_0x277e('0x5f')]()[_0x277e('0x5e')](char(0xa))>=0x0||_0x1fd45e[_0x277e('0x5f')]()[_0x277e('0x5e')](char(0x2c))>=0x0||_0x1fd45e[_0x277e('0x5f')]()[_0x277e('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x5c7735){var _0x5c27cc=char(0x22),_0x5bef6b='\x5c'+char(0x22),_0x1e9d8d=_0x5c7735[_0x277e('0x5f')]()[_0x277e('0x60')](new RegExp(_0x5c27cc,'g'),_0x5bef6b);return _0x5c27cc+_0x1e9d8d+_0x5c27cc;}exports[_0x277e('0x61')]=function(_0x51fce0,_0x441d08,_0x19e522){var _0x5b317a,_0x31fe76;var _0x3c9931={'where':{'ProjectId':_0x51fce0[_0x277e('0x4c')]['id']}};if(_0x51fce0['query']['startTime']){_0x3c9931[_0x277e('0x37')][_0x277e('0x62')]=JSON[_0x277e('0x63')](_0x51fce0['query']['startTime']);}return db[_0x277e('0x56')][_0x277e('0x3e')](_0x3c9931)[_0x277e('0x21')](handleEntityNotFound(_0x441d08,null))['then'](function(_0x2478d0){if(_0x2478d0){_0x5b317a=_0x2478d0;return db[_0x277e('0x64')]['findAll']({'where':{'SessionId':{'$in':_[_0x277e('0x28')](_0x5b317a,'id')},'ProjectId':_0x51fce0[_0x277e('0x4c')]['id']},'order':_0x277e('0x65')});}})['then'](handleEntityNotFound(_0x441d08,null))[_0x277e('0x21')](function(_0x234cf7){if(_0x234cf7){_0x31fe76=_0x234cf7;var _0xe254b3={};for(var _0x338c16=0x0,_0x3118b7=_0x31fe76[_0x277e('0x33')];_0x338c16<_0x3118b7;_0x338c16++){if(!_0xe254b3[_0x277e('0x34')](_0x31fe76[_0x338c16][_0x277e('0x66')])){_0xe254b3[_0x31fe76[_0x338c16]['questionId']]=needsEncapsulation(_0x31fe76[_0x338c16][_0x277e('0x67')])?encapsulate(_0x31fe76[_0x338c16][_0x277e('0x67')]):_0x31fe76[_0x338c16][_0x277e('0x67')];}}var _0x4f6529=[],_0x4acbe6={};for(var _0xbf99c9=0x0,_0x36203c=_0x5b317a[_0x277e('0x33')];_0xbf99c9<_0x36203c;_0xbf99c9++){_0x4acbe6={'ProjectId':_0x51fce0['params']['id'],'SessionId':_0x5b317a[_0xbf99c9]['id'],'StartTime':moment(_0x5b317a[_0xbf99c9][_0x277e('0x62')])[_0x277e('0x68')](_0x277e('0x69'))};for(var _0x2f5413=0x0,_0x16680c=_0x31fe76[_0x277e('0x33')];_0x2f5413<_0x16680c;_0x2f5413++){if(_0x31fe76[_0x2f5413][_0x277e('0x6a')]==_0x5b317a[_0xbf99c9]['id']&&_0xe254b3[_0x277e('0x34')](_0x31fe76[_0x2f5413]['questionId'])){_0x4acbe6[_0xe254b3[_0x31fe76[_0x2f5413][_0x277e('0x66')]]]=_0x31fe76[_0x2f5413][_0x277e('0x6b')];}}for(var _0x376c1a in _0xe254b3){if(!_0x4acbe6[_0x277e('0x34')](_0xe254b3[_0x376c1a])){_0x4acbe6[_0xe254b3[_0x376c1a]]=null;}}_0x4f6529[_0x277e('0x6c')](_0x4acbe6);}return _0x4f6529;}})[_0x277e('0x21')](function(_0x1c6dba){if(!_['isEmpty'](_0x1c6dba)){var _0x1097b3=toCsv(_0x1c6dba);var _0x2d7598=Date[_0x277e('0x6d')]();fs['writeFileSync'](util[_0x277e('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x51fce0[_0x277e('0x4c')]['id'],_0x2d7598),_0x1097b3);_0x441d08[_0x277e('0x6e')]('Content-disposition',_0x277e('0x6f')+util[_0x277e('0x68')](_0x277e('0x70'),_0x51fce0['params']['id'],_0x2d7598));_0x441d08[_0x277e('0x6e')](_0x277e('0x71'),'text/csv');return _0x441d08[_0x277e('0x72')](util[_0x277e('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x51fce0[_0x277e('0x4c')]['id'],_0x2d7598));}else{return _0x441d08['sendStatus'](0xcc);}})[_0x277e('0x41')](handleError(_0x441d08,null));}; \ No newline at end of file +var _0xeb3e=['ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','Projects','UserProfileResource','end','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','rows','show','params','intersection','includeAll','include','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','findOne','JscriptySessionReport','limit'];(function(_0xbf0a97,_0x55c3ad){var _0x219c25=function(_0x3eb943){while(--_0x3eb943){_0xbf0a97['push'](_0xbf0a97['shift']());}};_0x219c25(++_0x55c3ad);}(_0xeb3e,0x106));var _0xeeb3=function(_0x25c5a4,_0x1922b9){_0x25c5a4=_0x25c5a4-0x0;var _0x3f191b=_0xeb3e[_0x25c5a4];return _0x3f191b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeeb3('0x0'));var zipdir=require(_0xeeb3('0x1'));var jsonpatch=require(_0xeeb3('0x2'));var rp=require(_0xeeb3('0x3'));var moment=require(_0xeeb3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeeb3('0x5'));var util=require(_0xeeb3('0x6'));var path=require(_0xeeb3('0x7'));var sox=require('sox');var csv=require(_0xeeb3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeeb3('0x9'));var _=require(_0xeeb3('0xa'));var squel=require(_0xeeb3('0xb'));var crypto=require(_0xeeb3('0xc'));var jsforce=require(_0xeeb3('0xd'));var deskjs=require(_0xeeb3('0xe'));var toCsv=require(_0xeeb3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeeb3('0xf'));var authService=require(_0xeeb3('0x10'));var qs=require(_0xeeb3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeeb3('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xeeb3('0x13'));var config=require(_0xeeb3('0x14'));var licenseUtil=require(_0xeeb3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x192dfc,_0x3003c4){_0x3003c4=_0x3003c4||0xcc;return function(_0x36c088){if(_0x36c088){return _0x192dfc[_0xeeb3('0x16')](_0x3003c4);}return _0x192dfc['status'](_0x3003c4)['end']();};}function respondWithResult(_0x8bf4af,_0x1fb3d3){_0x1fb3d3=_0x1fb3d3||0xc8;return function(_0x20d82b){if(_0x20d82b){return _0x8bf4af[_0xeeb3('0x17')](_0x1fb3d3)[_0xeeb3('0x18')](_0x20d82b);}};}function respondWithFilteredResult(_0x2f5434,_0x2830ce){return function(_0x394bba){if(_0x394bba){var _0x3ef44e=typeof _0x2830ce[_0xeeb3('0x19')]===_0xeeb3('0x1a')&&typeof _0x2830ce['limit']===_0xeeb3('0x1a');var _0x19dcae=_0x394bba[_0xeeb3('0x1b')];var _0x105470=_0x3ef44e?0x0:_0x2830ce[_0xeeb3('0x19')];var _0x45ee24=_0x3ef44e?_0x394bba[_0xeeb3('0x1b')]:_0x2830ce['offset']+_0x2830ce['limit'];var _0x5da019;if(_0x45ee24>=_0x19dcae){_0x45ee24=_0x19dcae;_0x5da019=0xc8;}else{_0x5da019=0xce;}_0x2f5434['status'](_0x5da019);return _0x2f5434[_0xeeb3('0x1c')](_0xeeb3('0x1d'),_0x105470+'-'+_0x45ee24+'/'+_0x19dcae)[_0xeeb3('0x18')](_0x394bba);}return null;};}function patchUpdates(_0xc1727){return function(_0x22029b){try{jsonpatch[_0xeeb3('0x1e')](_0x22029b,_0xc1727,!![]);}catch(_0x40bdd2){return BPromise['reject'](_0x40bdd2);}return _0x22029b['save']();};}function saveUpdates(_0x392b6d,_0x5d770a){return function(_0x35e958){if(_0x35e958){return _0x35e958[_0xeeb3('0x1f')](_0x392b6d)[_0xeeb3('0x20')](function(_0x1f6811){return _0x1f6811;});}return null;};}function removeEntity(_0x51bba0,_0x173107){return function(_0x28eb6c){if(_0x28eb6c){return _0x28eb6c['destroy']()[_0xeeb3('0x20')](function(){var _0x214381=_0x28eb6c['get']({'plain':!![]});var _0x47b235=_0xeeb3('0x21');return db[_0xeeb3('0x22')]['destroy']({'where':{'type':_0x47b235,'resourceId':_0x214381['id']}})[_0xeeb3('0x20')](function(){return _0x28eb6c;});})[_0xeeb3('0x20')](function(){_0x51bba0['status'](0xcc)[_0xeeb3('0x23')]();});}};}function handleEntityNotFound(_0x5b3a0d,_0x4ab6ca){return function(_0x132437){if(!_0x132437){_0x5b3a0d[_0xeeb3('0x16')](0x194);}return _0x132437;};}function handleError(_0xe0b460,_0x2611e6){_0x2611e6=_0x2611e6||0x1f4;return function(_0x468076){logger[_0xeeb3('0x24')](_0x468076[_0xeeb3('0x25')]);if(_0x468076['name']){delete _0x468076[_0xeeb3('0x26')];}_0xe0b460[_0xeeb3('0x17')](_0x2611e6)[_0xeeb3('0x27')](_0x468076);};}exports[_0xeeb3('0x28')]=function(_0x45feaf,_0x49c30e){var _0x3dacf3={},_0x3ddd2f={},_0x38b338={'count':0x0,'rows':[]};var _0x51c9a1=_[_0xeeb3('0x29')](db[_0xeeb3('0x2a')][_0xeeb3('0x2b')],function(_0x201c17){return{'name':_0x201c17[_0xeeb3('0x2c')],'type':_0x201c17[_0xeeb3('0x2d')][_0xeeb3('0x2e')]};});_0x3ddd2f[_0xeeb3('0x2f')]=_['map'](_0x51c9a1,_0xeeb3('0x26'));_0x3ddd2f[_0xeeb3('0x30')]=_[_0xeeb3('0x31')](_0x45feaf[_0xeeb3('0x30')]);_0x3ddd2f[_0xeeb3('0x32')]=_['intersection'](_0x3ddd2f[_0xeeb3('0x2f')],_0x3ddd2f[_0xeeb3('0x30')]);_0x3dacf3[_0xeeb3('0x33')]=_['intersection'](_0x3ddd2f[_0xeeb3('0x2f')],qs[_0xeeb3('0x34')](_0x45feaf['query'][_0xeeb3('0x34')]));_0x3dacf3[_0xeeb3('0x33')]=_0x3dacf3[_0xeeb3('0x33')][_0xeeb3('0x35')]?_0x3dacf3[_0xeeb3('0x33')]:_0x3ddd2f[_0xeeb3('0x2f')];if(!_0x45feaf[_0xeeb3('0x30')][_0xeeb3('0x36')](_0xeeb3('0x37'))){_0x3dacf3['limit']=qs['limit'](_0x45feaf[_0xeeb3('0x30')]['limit']);_0x3dacf3[_0xeeb3('0x19')]=qs[_0xeeb3('0x19')](_0x45feaf[_0xeeb3('0x30')][_0xeeb3('0x19')]);}_0x3dacf3[_0xeeb3('0x38')]=qs[_0xeeb3('0x39')](_0x45feaf[_0xeeb3('0x30')][_0xeeb3('0x39')]);_0x3dacf3['where']=qs['filters'](_[_0xeeb3('0x3a')](_0x45feaf[_0xeeb3('0x30')],_0x3ddd2f[_0xeeb3('0x32')]),_0x51c9a1);if(_0x45feaf[_0xeeb3('0x30')][_0xeeb3('0x3b')]){_0x3dacf3[_0xeeb3('0x3c')]=_[_0xeeb3('0x3d')](_0x3dacf3['where'],{'$or':_['map'](_0x51c9a1,function(_0x3c8ccb){if(_0x3c8ccb[_0xeeb3('0x2d')]!==_0xeeb3('0x3e')){var _0x1ca275={};_0x1ca275[_0x3c8ccb[_0xeeb3('0x26')]]={'$like':'%'+_0x45feaf[_0xeeb3('0x30')]['filter']+'%'};return _0x1ca275;}})});}_0x3dacf3=_['merge']({},_0x3dacf3,_0x45feaf[_0xeeb3('0x3f')]);var _0x315203={'where':_0x3dacf3[_0xeeb3('0x3c')]};return db[_0xeeb3('0x2a')]['count'](_0x315203)[_0xeeb3('0x20')](function(_0x549154){_0x38b338[_0xeeb3('0x1b')]=_0x549154;if(_0x45feaf[_0xeeb3('0x30')]['includeAll']){_0x3dacf3['include']=[{'all':!![]}];}return db[_0xeeb3('0x2a')]['findAll'](_0x3dacf3);})[_0xeeb3('0x20')](function(_0x37ed38){_0x38b338[_0xeeb3('0x40')]=_0x37ed38;return _0x38b338;})[_0xeeb3('0x20')](respondWithFilteredResult(_0x49c30e,_0x3dacf3))['catch'](handleError(_0x49c30e,null));};exports[_0xeeb3('0x41')]=function(_0x15ddb7,_0x1dbdf6){var _0x52e8ab={'raw':![],'where':{'id':_0x15ddb7[_0xeeb3('0x42')]['id']}},_0x1e974c={};_0x1e974c[_0xeeb3('0x2f')]=_['keys'](db[_0xeeb3('0x2a')]['rawAttributes']);_0x1e974c[_0xeeb3('0x30')]=_[_0xeeb3('0x31')](_0x15ddb7[_0xeeb3('0x30')]);_0x1e974c[_0xeeb3('0x32')]=_['intersection'](_0x1e974c[_0xeeb3('0x2f')],_0x1e974c[_0xeeb3('0x30')]);_0x52e8ab['attributes']=_[_0xeeb3('0x43')](_0x1e974c['model'],qs['fields'](_0x15ddb7[_0xeeb3('0x30')][_0xeeb3('0x34')]));_0x52e8ab[_0xeeb3('0x33')]=_0x52e8ab[_0xeeb3('0x33')][_0xeeb3('0x35')]?_0x52e8ab[_0xeeb3('0x33')]:_0x1e974c['model'];if(_0x15ddb7[_0xeeb3('0x30')][_0xeeb3('0x44')]){_0x52e8ab[_0xeeb3('0x45')]=[{'all':!![]}];}_0x52e8ab=_[_0xeeb3('0x3d')]({},_0x52e8ab,_0x15ddb7[_0xeeb3('0x3f')]);return db['JscriptyProject'][_0xeeb3('0x46')](_0x52e8ab)[_0xeeb3('0x20')](handleEntityNotFound(_0x1dbdf6,null))[_0xeeb3('0x20')](respondWithResult(_0x1dbdf6,null))[_0xeeb3('0x47')](handleError(_0x1dbdf6,null));};exports[_0xeeb3('0x48')]=function(_0x240f3a,_0x5c196f){return db[_0xeeb3('0x2a')][_0xeeb3('0x48')](_0x240f3a[_0xeeb3('0x49')],{})[_0xeeb3('0x20')](function(_0x27d692){var _0x272cc3=_0x240f3a['user'][_0xeeb3('0x4a')]({'plain':!![]});if(!_0x272cc3)throw new Error(_0xeeb3('0x4b'));if(_0x272cc3[_0xeeb3('0x4c')]==='user'){var _0x13f2d3=_0x27d692[_0xeeb3('0x4a')]({'plain':!![]});var _0x49569a='Projects';return db[_0xeeb3('0x4d')][_0xeeb3('0x46')]({'where':{'name':_0x49569a,'userProfileId':_0x272cc3[_0xeeb3('0x4e')]},'raw':!![]})[_0xeeb3('0x20')](function(_0x1a88a8){if(_0x1a88a8&&_0x1a88a8[_0xeeb3('0x4f')]===0x0){return db['UserProfileResource'][_0xeeb3('0x48')]({'name':_0x13f2d3[_0xeeb3('0x26')],'resourceId':_0x13f2d3['id'],'type':_0x1a88a8[_0xeeb3('0x26')],'sectionId':_0x1a88a8['id']},{})[_0xeeb3('0x20')](function(){return _0x27d692;});}else{return _0x27d692;}})[_0xeeb3('0x47')](function(_0x33fb4d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33fb4d);throw _0x33fb4d;});}return _0x27d692;})[_0xeeb3('0x20')](respondWithResult(_0x5c196f,0xc9))[_0xeeb3('0x47')](handleError(_0x5c196f,null));};exports[_0xeeb3('0x50')]=function(_0x1d113f,_0x44d5de){var _0x121d4={'where':{'id':_0x1d113f['params']['id']}},_0x21cf45={};_0x21cf45[_0xeeb3('0x2f')]=_[_0xeeb3('0x31')](db[_0xeeb3('0x2a')]['rawAttributes']);_0x121d4[_0xeeb3('0x33')]=_[_0xeeb3('0x43')](_0x21cf45[_0xeeb3('0x2f')],qs[_0xeeb3('0x34')](_0x1d113f[_0xeeb3('0x30')][_0xeeb3('0x34')]));_0x121d4[_0xeeb3('0x33')]=_0x121d4[_0xeeb3('0x33')][_0xeeb3('0x35')]?_0x121d4[_0xeeb3('0x33')]:_0x21cf45[_0xeeb3('0x2f')];if(_0x1d113f[_0xeeb3('0x30')]['includeAll']){_0x121d4[_0xeeb3('0x45')]=[{'all':!![]}];}_0x121d4=_[_0xeeb3('0x3d')]({},_0x121d4,_0x1d113f[_0xeeb3('0x3f')]);return db['JscriptyProject'][_0xeeb3('0x46')](_0x121d4)[_0xeeb3('0x20')](handleEntityNotFound(_0x44d5de,null))[_0xeeb3('0x20')](function(_0x103e82){if(_0x103e82){var _0x1afa89=_0x103e82['get']({'plain':!![]});_0x1afa89=qs[_0xeeb3('0x51')](_0x1afa89,['id',_0xeeb3('0x52'),'updatedAt']);_0x1d113f[_0xeeb3('0x49')]=_[_0xeeb3('0x51')](_0x1d113f[_0xeeb3('0x49')],['id',_0xeeb3('0x52'),'updatedAt']);return db[_0xeeb3('0x2a')][_0xeeb3('0x48')](_[_0xeeb3('0x3d')](_0x1afa89,_0x1d113f['body']),{'include':_0x1d113f[_0xeeb3('0x30')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x28c51c){var _0xecac2f=_0x1d113f[_0xeeb3('0x53')][_0xeeb3('0x4a')]({'plain':!![]});if(!_0xecac2f)throw new Error(_0xeeb3('0x4b'));if(_0xecac2f[_0xeeb3('0x4c')]===_0xeeb3('0x53')){var _0x4c2059=_0x28c51c[_0xeeb3('0x4a')]({'plain':!![]});var _0x26067d='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x26067d,'userProfileId':_0xecac2f[_0xeeb3('0x4e')]},'raw':!![]})[_0xeeb3('0x20')](function(_0x26340b){if(_0x26340b&&_0x26340b[_0xeeb3('0x4f')]===0x0){return db[_0xeeb3('0x22')][_0xeeb3('0x48')]({'name':_0x4c2059[_0xeeb3('0x26')],'resourceId':_0x4c2059['id'],'type':_0x26340b['name'],'sectionId':_0x26340b['id']},{})[_0xeeb3('0x20')](function(){return _0x28c51c;});}else{return _0x28c51c;}})[_0xeeb3('0x47')](function(_0x47ba0b){logger['error'](_0xeeb3('0x54'),_0x47ba0b);throw _0x47ba0b;});}return _0x28c51c;});}})[_0xeeb3('0x20')](respondWithResult(_0x44d5de,0xc9))[_0xeeb3('0x47')](handleError(_0x44d5de,null));};exports[_0xeeb3('0x1f')]=function(_0x18c6d9,_0x18e9b3){if(_0x18c6d9[_0xeeb3('0x49')]['id']){delete _0x18c6d9['body']['id'];}return db[_0xeeb3('0x2a')][_0xeeb3('0x46')]({'where':{'id':_0x18c6d9[_0xeeb3('0x42')]['id']}})[_0xeeb3('0x20')](handleEntityNotFound(_0x18e9b3,null))['then'](saveUpdates(_0x18c6d9[_0xeeb3('0x49')],null))[_0xeeb3('0x20')](respondWithResult(_0x18e9b3,null))[_0xeeb3('0x47')](handleError(_0x18e9b3,null));};exports[_0xeeb3('0x55')]=function(_0x1994f5,_0x10ab63){return db['JscriptyProject'][_0xeeb3('0x46')]({'where':{'id':_0x1994f5[_0xeeb3('0x42')]['id']}})[_0xeeb3('0x20')](handleEntityNotFound(_0x10ab63,null))[_0xeeb3('0x20')](removeEntity(_0x10ab63,null))[_0xeeb3('0x47')](handleError(_0x10ab63,null));};exports['getSessions']=function(_0x3abb86,_0x44d7e9,_0x5aa583){var _0x496a3f={'raw':!![],'where':{}};var _0x48359={};var _0xdcdede={'count':0x0,'rows':[]};return db[_0xeeb3('0x2a')][_0xeeb3('0x56')]({'where':{'id':_0x3abb86[_0xeeb3('0x42')]['id']}})[_0xeeb3('0x20')](handleEntityNotFound(_0x44d7e9,null))[_0xeeb3('0x20')](function(_0x4acebb){if(_0x4acebb){_0x48359[_0xeeb3('0x2f')]=_[_0xeeb3('0x31')](db[_0xeeb3('0x57')]['rawAttributes']);_0x48359[_0xeeb3('0x30')]=_[_0xeeb3('0x31')](_0x3abb86[_0xeeb3('0x30')]);_0x48359[_0xeeb3('0x32')]=_['intersection'](_0x48359['model'],_0x48359[_0xeeb3('0x30')]);_0x496a3f[_0xeeb3('0x33')]=_[_0xeeb3('0x43')](_0x48359['model'],qs[_0xeeb3('0x34')](_0x3abb86[_0xeeb3('0x30')][_0xeeb3('0x34')]));_0x496a3f[_0xeeb3('0x33')]=_0x496a3f[_0xeeb3('0x33')][_0xeeb3('0x35')]?_0x496a3f[_0xeeb3('0x33')]:_0x48359[_0xeeb3('0x2f')];if(!_0x3abb86[_0xeeb3('0x30')][_0xeeb3('0x36')](_0xeeb3('0x37'))){_0x496a3f[_0xeeb3('0x58')]=qs[_0xeeb3('0x58')](_0x3abb86[_0xeeb3('0x30')][_0xeeb3('0x58')]);_0x496a3f[_0xeeb3('0x19')]=qs[_0xeeb3('0x19')](_0x3abb86[_0xeeb3('0x30')]['offset']);}_0x496a3f['order']=qs[_0xeeb3('0x39')](_0x3abb86['query'][_0xeeb3('0x39')]);_0x496a3f[_0xeeb3('0x3c')]=qs['filters'](_[_0xeeb3('0x3a')](_0x3abb86[_0xeeb3('0x30')],_0x48359[_0xeeb3('0x32')]));_0x496a3f[_0xeeb3('0x3c')][_0xeeb3('0x59')]=_0x4acebb['id'];if(_0x3abb86[_0xeeb3('0x30')][_0xeeb3('0x3b')]){_0x496a3f[_0xeeb3('0x3c')]=_[_0xeeb3('0x3d')](_0x496a3f[_0xeeb3('0x3c')],{'$or':_[_0xeeb3('0x29')](_0x496a3f[_0xeeb3('0x33')],function(_0x25d664){var _0x23453e={};_0x23453e[_0x25d664]={'$like':'%'+_0x3abb86['query']['filter']+'%'};return _0x23453e;})});}_0x496a3f=_[_0xeeb3('0x3d')]({},_0x496a3f,_0x3abb86['options']);return db[_0xeeb3('0x57')][_0xeeb3('0x1b')]({'where':_0x496a3f[_0xeeb3('0x3c')]})[_0xeeb3('0x20')](function(_0x23150d){_0xdcdede['count']=_0x23150d;if(_0x3abb86[_0xeeb3('0x30')][_0xeeb3('0x44')]){_0x496a3f[_0xeeb3('0x45')]=[{'all':!![]}];}return db[_0xeeb3('0x57')][_0xeeb3('0x5a')](_0x496a3f);})[_0xeeb3('0x20')](function(_0xbd722e){_0xdcdede[_0xeeb3('0x40')]=_0xbd722e;return _0xdcdede;});}})[_0xeeb3('0x20')](respondWithFilteredResult(_0x44d7e9,_0x496a3f))[_0xeeb3('0x47')](handleError(_0x44d7e9,null));};exports[_0xeeb3('0x5b')]=function(_0x3188ce,_0x5b2454,_0x427eac){var _0x2ab8d4={'raw':!![],'where':{}};var _0x58a329={};var _0x53a580={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xeeb3('0x56')]({'where':{'id':_0x3188ce['params']['id']}})['then'](handleEntityNotFound(_0x5b2454,null))['then'](function(_0x3ca19d){if(_0x3ca19d){_0x58a329[_0xeeb3('0x2f')]=_['keys'](db[_0xeeb3('0x5c')][_0xeeb3('0x2b')]);_0x58a329[_0xeeb3('0x30')]=_['keys'](_0x3188ce[_0xeeb3('0x30')]);_0x58a329['filters']=_[_0xeeb3('0x43')](_0x58a329[_0xeeb3('0x2f')],_0x58a329[_0xeeb3('0x30')]);_0x2ab8d4[_0xeeb3('0x33')]=_[_0xeeb3('0x43')](_0x58a329[_0xeeb3('0x2f')],qs['fields'](_0x3188ce[_0xeeb3('0x30')][_0xeeb3('0x34')]));_0x2ab8d4[_0xeeb3('0x33')]=_0x2ab8d4['attributes'][_0xeeb3('0x35')]?_0x2ab8d4[_0xeeb3('0x33')]:_0x58a329['model'];if(!_0x3188ce[_0xeeb3('0x30')][_0xeeb3('0x36')]('nolimit')){_0x2ab8d4[_0xeeb3('0x58')]=qs['limit'](_0x3188ce[_0xeeb3('0x30')][_0xeeb3('0x58')]);_0x2ab8d4[_0xeeb3('0x19')]=qs[_0xeeb3('0x19')](_0x3188ce[_0xeeb3('0x30')]['offset']);}_0x2ab8d4[_0xeeb3('0x38')]=qs['sort'](_0x3188ce[_0xeeb3('0x30')][_0xeeb3('0x39')]);_0x2ab8d4[_0xeeb3('0x3c')]=qs[_0xeeb3('0x32')](_[_0xeeb3('0x3a')](_0x3188ce['query'],_0x58a329[_0xeeb3('0x32')]));_0x2ab8d4[_0xeeb3('0x3c')][_0xeeb3('0x59')]=_0x3ca19d['id'];if(_0x3188ce[_0xeeb3('0x30')]['filter']){_0x2ab8d4[_0xeeb3('0x3c')]=_[_0xeeb3('0x3d')](_0x2ab8d4['where'],{'$or':_['map'](_0x2ab8d4[_0xeeb3('0x33')],function(_0x2fbb8f){var _0x56cc0c={};_0x56cc0c[_0x2fbb8f]={'$like':'%'+_0x3188ce[_0xeeb3('0x30')][_0xeeb3('0x3b')]+'%'};return _0x56cc0c;})});}_0x2ab8d4=_[_0xeeb3('0x3d')]({},_0x2ab8d4,_0x3188ce['options']);return db['JscriptyAnswerReport']['count']({'where':_0x2ab8d4[_0xeeb3('0x3c')]})[_0xeeb3('0x20')](function(_0x46e556){_0x53a580[_0xeeb3('0x1b')]=_0x46e556;if(_0x3188ce[_0xeeb3('0x30')][_0xeeb3('0x44')]){_0x2ab8d4[_0xeeb3('0x45')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x2ab8d4);})[_0xeeb3('0x20')](function(_0x10607c){_0x53a580[_0xeeb3('0x40')]=_0x10607c;return _0x53a580;});}})[_0xeeb3('0x20')](respondWithFilteredResult(_0x5b2454,_0x2ab8d4))['catch'](handleError(_0x5b2454,null));};function char(_0x210d29){return _0xeeb3('0x5d')===typeof _0x210d29?String[_0xeeb3('0x5e')]['apply'](null,arguments):_0x210d29;}function needsEncapsulation(_0x308413){return!!_0x308413&&(_0x308413[_0xeeb3('0x5f')]()[_0xeeb3('0x60')](char(0xd))>=0x0||_0x308413[_0xeeb3('0x5f')]()[_0xeeb3('0x60')](char(0xa))>=0x0||_0x308413['toString']()[_0xeeb3('0x60')](char(0x2c))>=0x0||_0x308413[_0xeeb3('0x5f')]()[_0xeeb3('0x60')](char(0x22))>=0x0);}function encapsulate(_0x28c28b){var _0x59f3cb=char(0x22),_0x4a8a1a='\x5c'+char(0x22),_0x3f7164=_0x28c28b[_0xeeb3('0x5f')]()[_0xeeb3('0x61')](new RegExp(_0x59f3cb,'g'),_0x4a8a1a);return _0x59f3cb+_0x3f7164+_0x59f3cb;}exports['getSummary']=function(_0x36ab2c,_0x1a1b40,_0x2bf1af){var _0x31b8aa,_0x360a8d;var _0x582730={'where':{'ProjectId':_0x36ab2c[_0xeeb3('0x42')]['id']}};if(_0x36ab2c[_0xeeb3('0x30')][_0xeeb3('0x62')]){_0x582730[_0xeeb3('0x3c')][_0xeeb3('0x63')]=JSON[_0xeeb3('0x64')](_0x36ab2c[_0xeeb3('0x30')]['startTime']);}return db[_0xeeb3('0x57')][_0xeeb3('0x5a')](_0x582730)[_0xeeb3('0x20')](handleEntityNotFound(_0x1a1b40,null))[_0xeeb3('0x20')](function(_0xdd2cb){if(_0xdd2cb){_0x31b8aa=_0xdd2cb;return db['JscriptyQuestionReport'][_0xeeb3('0x5a')]({'where':{'SessionId':{'$in':_[_0xeeb3('0x29')](_0x31b8aa,'id')},'ProjectId':_0x36ab2c[_0xeeb3('0x42')]['id']},'order':_0xeeb3('0x65')});}})[_0xeeb3('0x20')](handleEntityNotFound(_0x1a1b40,null))[_0xeeb3('0x20')](function(_0x343292){if(_0x343292){_0x360a8d=_0x343292;var _0x4bbd2b={};for(var _0x42bf08=0x0,_0x130e0d=_0x360a8d[_0xeeb3('0x35')];_0x42bf08<_0x130e0d;_0x42bf08++){if(!_0x4bbd2b[_0xeeb3('0x36')](_0x360a8d[_0x42bf08]['questionId'])){_0x4bbd2b[_0x360a8d[_0x42bf08][_0xeeb3('0x66')]]=needsEncapsulation(_0x360a8d[_0x42bf08][_0xeeb3('0x67')])?encapsulate(_0x360a8d[_0x42bf08]['question']):_0x360a8d[_0x42bf08]['question'];}}var _0x3fb32f=[],_0xa619d1={};for(var _0x1c21aa=0x0,_0x18d6b9=_0x31b8aa[_0xeeb3('0x35')];_0x1c21aa<_0x18d6b9;_0x1c21aa++){_0xa619d1={'ProjectId':_0x36ab2c[_0xeeb3('0x42')]['id'],'SessionId':_0x31b8aa[_0x1c21aa]['id'],'StartTime':moment(_0x31b8aa[_0x1c21aa][_0xeeb3('0x63')])['format'](_0xeeb3('0x68'))};for(var _0x1e9966=0x0,_0x504acb=_0x360a8d[_0xeeb3('0x35')];_0x1e9966<_0x504acb;_0x1e9966++){if(_0x360a8d[_0x1e9966]['SessionId']==_0x31b8aa[_0x1c21aa]['id']&&_0x4bbd2b[_0xeeb3('0x36')](_0x360a8d[_0x1e9966][_0xeeb3('0x66')])){_0xa619d1[_0x4bbd2b[_0x360a8d[_0x1e9966]['questionId']]]=_0x360a8d[_0x1e9966]['answer'];}}for(var _0x2db55f in _0x4bbd2b){if(!_0xa619d1['hasOwnProperty'](_0x4bbd2b[_0x2db55f])){_0xa619d1[_0x4bbd2b[_0x2db55f]]=null;}}_0x3fb32f[_0xeeb3('0x69')](_0xa619d1);}return _0x3fb32f;}})[_0xeeb3('0x20')](function(_0x3ffbbf){if(!_[_0xeeb3('0x6a')](_0x3ffbbf)){var _0x275cbc=toCsv(_0x3ffbbf);var _0x1ebd98=Date[_0xeeb3('0x6b')]();fs[_0xeeb3('0x6c')](util['format'](_0xeeb3('0x6d'),_0x36ab2c[_0xeeb3('0x42')]['id'],_0x1ebd98),_0x275cbc);_0x1a1b40[_0xeeb3('0x6e')](_0xeeb3('0x6f'),_0xeeb3('0x70')+util[_0xeeb3('0x71')]('Jscripty_Project_%d_Summary_%s.csv',_0x36ab2c[_0xeeb3('0x42')]['id'],_0x1ebd98));_0x1a1b40[_0xeeb3('0x6e')](_0xeeb3('0x72'),_0xeeb3('0x73'));return _0x1a1b40[_0xeeb3('0x74')](util[_0xeeb3('0x71')](_0xeeb3('0x6d'),_0x36ab2c['params']['id'],_0x1ebd98));}else{return _0x1a1b40[_0xeeb3('0x16')](0xcc);}})[_0xeeb3('0x47')](handleError(_0x1a1b40,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a51031b..60e8dd1 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 _0x4a25=['path','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x4a25,0x1d4));var _0x54a2=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x4a25[_0x3d2e4b];return _0x509e78;};'use strict';var _=require(_0x54a2('0x0'));var util=require('util');var logger=require(_0x54a2('0x1'))('api');var moment=require(_0x54a2('0x2'));var BPromise=require(_0x54a2('0x3'));var rp=require(_0x54a2('0x4'));var fs=require('fs');var path=require(_0x54a2('0x5'));var rimraf=require('rimraf');var config=require(_0x54a2('0x6'));var attributes=require(_0x54a2('0x7'));module[_0x54a2('0x8')]=function(_0x3ecde5,_0x472eed){return _0x3ecde5['define'](_0x54a2('0x9'),attributes,{'tableName':_0x54a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4300=['bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyProject','jscripty_projects','lodash'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x4300,0x1a6));var _0x0430=function(_0x48a8d4,_0x49ee87){_0x48a8d4=_0x48a8d4-0x0;var _0x47bfc4=_0x4300[_0x48a8d4];return _0x47bfc4;};'use strict';var _=require(_0x0430('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0430('0x1'));var rp=require(_0x0430('0x2'));var fs=require('fs');var path=require(_0x0430('0x3'));var rimraf=require(_0x0430('0x4'));var config=require(_0x0430('0x5'));var attributes=require('./jscriptyProject.attributes');module[_0x0430('0x6')]=function(_0x5943c0,_0x16efe3){return _0x5943c0['define'](_0x0430('0x7'),attributes,{'tableName':_0x0430('0x8'),'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 d1e6a21..ba089c0 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x3c68bb,_0x3ee29d){var _0x5e1fde=function(_0x20920e){while(--_0x20920e){_0x3c68bb['push'](_0x3c68bb['shift']());}};_0x5e1fde(++_0x3ee29d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x52407d,_0x23b62e){var _0x761b45=function(_0x28800e){while(--_0x28800e){_0x52407d['push'](_0x52407d['shift']());}};_0x761b45(++_0x23b62e);}(_0xe706,0xa3));var _0x6e70=function(_0x45964b,_0xe849e5){_0x45964b=_0x45964b-0x0;var _0x4dc863=_0xe706[_0x45964b];return _0x4dc863;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index c657bf0..e948807 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 _0x20cd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','multer','util','fs-extra'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x20cd,0x19f));var _0xd20c=function(_0x49e9be,_0x31acc1){_0x49e9be=_0x49e9be-0x0;var _0x4ddc45=_0x20cd[_0x49e9be];return _0x4ddc45;};'use strict';var multer=require(_0xd20c('0x0'));var util=require(_0xd20c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd20c('0x2'));var auth=require(_0xd20c('0x3'));var interaction=require(_0xd20c('0x4'));var config=require(_0xd20c('0x5'));var controller=require(_0xd20c('0x6'));router[_0xd20c('0x7')]('/',auth[_0xd20c('0x8')](),controller[_0xd20c('0x9')]);router[_0xd20c('0x7')]('/describe',auth[_0xd20c('0x8')](),controller[_0xd20c('0xa')]);router[_0xd20c('0x7')](_0xd20c('0xb'),auth['isAuthenticated'](),controller[_0xd20c('0xc')]);router[_0xd20c('0xd')]('/',auth['isAuthenticated'](),controller[_0xd20c('0xe')]);router[_0xd20c('0xf')](_0xd20c('0xb'),auth['isAuthenticated'](),controller[_0xd20c('0x10')]);router[_0xd20c('0x11')](_0xd20c('0xb'),auth[_0xd20c('0x8')](),controller['destroy']);module[_0xd20c('0x12')]=router; \ No newline at end of file +var _0x0ca0=['describe','/:id','post','put','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x0ca0,0xd6));var _0x00ca=function(_0x5e01f3,_0x143086){_0x5e01f3=_0x5e01f3-0x0;var _0x5dc9c2=_0x0ca0[_0x5e01f3];return _0x5dc9c2;};'use strict';var multer=require(_0x00ca('0x0'));var util=require(_0x00ca('0x1'));var path=require('path');var timeout=require(_0x00ca('0x2'));var express=require('express');var router=express[_0x00ca('0x3')]();var fs_extra=require(_0x00ca('0x4'));var auth=require(_0x00ca('0x5'));var interaction=require(_0x00ca('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x00ca('0x7')]);router[_0x00ca('0x8')]('/describe',auth[_0x00ca('0x9')](),controller[_0x00ca('0xa')]);router[_0x00ca('0x8')](_0x00ca('0xb'),auth[_0x00ca('0x9')](),controller['show']);router[_0x00ca('0xc')]('/',auth[_0x00ca('0x9')](),controller['create']);router[_0x00ca('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x00ca('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x00ca('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index dbf7ada..bb6cde3 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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x18d206,_0xc4d7f9){_0x18d206=_0x18d206-0x0;var _0x1240f0=_0x7a54[_0x18d206];return _0x1240f0;};'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(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x7a54,0x106));var _0x47a5=function(_0x109f94,_0x48e29e){_0x109f94=_0x109f94-0x0;var _0x5f15b7=_0x7a54[_0x109f94];return _0x5f15b7;};'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 ba2e097..60d1441 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 _0x12e0=['where','VIRTUAL','merge','options','includeAll','include','JscriptyQuestionReport','findAll','rows','catch','show','params','length','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','end','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','order','sort','filters','pick','filter'];(function(_0x29c294,_0x5230af){var _0x560166=function(_0x3c8251){while(--_0x3c8251){_0x29c294['push'](_0x29c294['shift']());}};_0x560166(++_0x5230af);}(_0x12e0,0x184));var _0x012e=function(_0x5ca534,_0x238119){_0x5ca534=_0x5ca534-0x0;var _0x2df5ae=_0x12e0[_0x5ca534];return _0x2df5ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x012e('0x0'));var zipdir=require(_0x012e('0x1'));var jsonpatch=require(_0x012e('0x2'));var rp=require(_0x012e('0x3'));var moment=require(_0x012e('0x4'));var BPromise=require(_0x012e('0x5'));var Mustache=require(_0x012e('0x6'));var util=require('util');var path=require(_0x012e('0x7'));var sox=require('sox');var csv=require(_0x012e('0x8'));var ejs=require(_0x012e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x012e('0xa'));var crypto=require(_0x012e('0xb'));var jsforce=require(_0x012e('0xc'));var deskjs=require(_0x012e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x012e('0xe'));var Papa=require(_0x012e('0xf'));var Redis=require(_0x012e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x012e('0x11'));var hardwareService=require(_0x012e('0x12'));var logger=require(_0x012e('0x13'))('api');var utils=require(_0x012e('0x14'));var config=require(_0x012e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x012e('0x16'))['db'];function respondWithStatusCode(_0x22663e,_0x209a2f){_0x209a2f=_0x209a2f||0xcc;return function(_0x5440da){if(_0x5440da){return _0x22663e[_0x012e('0x17')](_0x209a2f);}return _0x22663e[_0x012e('0x18')](_0x209a2f)['end']();};}function respondWithResult(_0x7cb00f,_0xac5c27){_0xac5c27=_0xac5c27||0xc8;return function(_0x48cd29){if(_0x48cd29){return _0x7cb00f['status'](_0xac5c27)['json'](_0x48cd29);}};}function respondWithFilteredResult(_0x17073f,_0x1ba348){return function(_0x24687a){if(_0x24687a){var _0x5d8dcf=typeof _0x1ba348[_0x012e('0x19')]===_0x012e('0x1a')&&typeof _0x1ba348[_0x012e('0x1b')]==='undefined';var _0x43f3c1=_0x24687a[_0x012e('0x1c')];var _0x2428b7=_0x5d8dcf?0x0:_0x1ba348['offset'];var _0x3aef52=_0x5d8dcf?_0x24687a[_0x012e('0x1c')]:_0x1ba348['offset']+_0x1ba348[_0x012e('0x1b')];var _0x59ffe5;if(_0x3aef52>=_0x43f3c1){_0x3aef52=_0x43f3c1;_0x59ffe5=0xc8;}else{_0x59ffe5=0xce;}_0x17073f[_0x012e('0x18')](_0x59ffe5);return _0x17073f[_0x012e('0x1d')](_0x012e('0x1e'),_0x2428b7+'-'+_0x3aef52+'/'+_0x43f3c1)[_0x012e('0x1f')](_0x24687a);}return null;};}function patchUpdates(_0x42175b){return function(_0x3cb27f){try{jsonpatch[_0x012e('0x20')](_0x3cb27f,_0x42175b,!![]);}catch(_0x283e34){return BPromise['reject'](_0x283e34);}return _0x3cb27f[_0x012e('0x21')]();};}function saveUpdates(_0x17939b,_0x3870b7){return function(_0x5dfcc1){if(_0x5dfcc1){return _0x5dfcc1['update'](_0x17939b)[_0x012e('0x22')](function(_0x26eb40){return _0x26eb40;});}return null;};}function removeEntity(_0x400a66,_0x4881e7){return function(_0x103895){if(_0x103895){return _0x103895[_0x012e('0x23')]()[_0x012e('0x22')](function(){_0x400a66[_0x012e('0x18')](0xcc)[_0x012e('0x24')]();});}};}function handleEntityNotFound(_0x4874ec,_0x5d7378){return function(_0xf4cfae){if(!_0xf4cfae){_0x4874ec['sendStatus'](0x194);}return _0xf4cfae;};}function handleError(_0x31cc5f,_0x5b96d3){_0x5b96d3=_0x5b96d3||0x1f4;return function(_0x3b2d79){logger['error'](_0x3b2d79['stack']);if(_0x3b2d79[_0x012e('0x25')]){delete _0x3b2d79[_0x012e('0x25')];}_0x31cc5f['status'](_0x5b96d3)[_0x012e('0x26')](_0x3b2d79);};}exports['index']=function(_0x9020a6,_0x147715){var _0x1647c6={},_0x58af69={},_0x33a9c6={'count':0x0,'rows':[]};var _0x250ea1=_[_0x012e('0x27')](db['JscriptyQuestionReport'][_0x012e('0x28')],function(_0x330c71){return{'name':_0x330c71[_0x012e('0x29')],'type':_0x330c71[_0x012e('0x2a')][_0x012e('0x2b')]};});_0x58af69['model']=_[_0x012e('0x27')](_0x250ea1,_0x012e('0x25'));_0x58af69[_0x012e('0x2c')]=_[_0x012e('0x2d')](_0x9020a6[_0x012e('0x2c')]);_0x58af69['filters']=_[_0x012e('0x2e')](_0x58af69[_0x012e('0x2f')],_0x58af69[_0x012e('0x2c')]);_0x1647c6['attributes']=_['intersection'](_0x58af69[_0x012e('0x2f')],qs['fields'](_0x9020a6[_0x012e('0x2c')][_0x012e('0x30')]));_0x1647c6[_0x012e('0x31')]=_0x1647c6['attributes']['length']?_0x1647c6[_0x012e('0x31')]:_0x58af69[_0x012e('0x2f')];if(!_0x9020a6[_0x012e('0x2c')][_0x012e('0x32')]('nolimit')){_0x1647c6[_0x012e('0x1b')]=qs[_0x012e('0x1b')](_0x9020a6[_0x012e('0x2c')][_0x012e('0x1b')]);_0x1647c6[_0x012e('0x19')]=qs[_0x012e('0x19')](_0x9020a6[_0x012e('0x2c')][_0x012e('0x19')]);}_0x1647c6[_0x012e('0x33')]=qs[_0x012e('0x34')](_0x9020a6[_0x012e('0x2c')][_0x012e('0x34')]);_0x1647c6['where']=qs[_0x012e('0x35')](_[_0x012e('0x36')](_0x9020a6[_0x012e('0x2c')],_0x58af69['filters']),_0x250ea1);if(_0x9020a6[_0x012e('0x2c')][_0x012e('0x37')]){_0x1647c6[_0x012e('0x38')]=_['merge'](_0x1647c6[_0x012e('0x38')],{'$or':_[_0x012e('0x27')](_0x250ea1,function(_0x1f2589){if(_0x1f2589[_0x012e('0x2a')]!==_0x012e('0x39')){var _0x1c8f95={};_0x1c8f95[_0x1f2589[_0x012e('0x25')]]={'$like':'%'+_0x9020a6[_0x012e('0x2c')]['filter']+'%'};return _0x1c8f95;}})});}_0x1647c6=_[_0x012e('0x3a')]({},_0x1647c6,_0x9020a6[_0x012e('0x3b')]);var _0x18684={'where':_0x1647c6[_0x012e('0x38')]};return db['JscriptyQuestionReport'][_0x012e('0x1c')](_0x18684)[_0x012e('0x22')](function(_0x1f7c3e){_0x33a9c6[_0x012e('0x1c')]=_0x1f7c3e;if(_0x9020a6[_0x012e('0x2c')][_0x012e('0x3c')]){_0x1647c6[_0x012e('0x3d')]=[{'all':!![]}];}return db[_0x012e('0x3e')][_0x012e('0x3f')](_0x1647c6);})[_0x012e('0x22')](function(_0x3cb3d9){_0x33a9c6[_0x012e('0x40')]=_0x3cb3d9;return _0x33a9c6;})['then'](respondWithFilteredResult(_0x147715,_0x1647c6))[_0x012e('0x41')](handleError(_0x147715,null));};exports[_0x012e('0x42')]=function(_0x502a5f,_0x33bcae){var _0x4bca4f={'raw':!![],'where':{'id':_0x502a5f[_0x012e('0x43')]['id']}},_0x1e63dc={};_0x1e63dc['model']=_['keys'](db['JscriptyQuestionReport'][_0x012e('0x28')]);_0x1e63dc['query']=_[_0x012e('0x2d')](_0x502a5f['query']);_0x1e63dc[_0x012e('0x35')]=_['intersection'](_0x1e63dc[_0x012e('0x2f')],_0x1e63dc['query']);_0x4bca4f['attributes']=_[_0x012e('0x2e')](_0x1e63dc[_0x012e('0x2f')],qs[_0x012e('0x30')](_0x502a5f[_0x012e('0x2c')][_0x012e('0x30')]));_0x4bca4f['attributes']=_0x4bca4f['attributes'][_0x012e('0x44')]?_0x4bca4f[_0x012e('0x31')]:_0x1e63dc['model'];if(_0x502a5f[_0x012e('0x2c')]['includeAll']){_0x4bca4f[_0x012e('0x3d')]=[{'all':!![]}];}_0x4bca4f=_[_0x012e('0x3a')]({},_0x4bca4f,_0x502a5f[_0x012e('0x3b')]);return db[_0x012e('0x3e')][_0x012e('0x45')](_0x4bca4f)[_0x012e('0x22')](handleEntityNotFound(_0x33bcae,null))[_0x012e('0x22')](respondWithResult(_0x33bcae,null))[_0x012e('0x41')](handleError(_0x33bcae,null));};exports[_0x012e('0x46')]=function(_0x4c1c43,_0x1b376e){return db['JscriptyQuestionReport'][_0x012e('0x46')](_0x4c1c43[_0x012e('0x47')],{})['then'](respondWithResult(_0x1b376e,0xc9))[_0x012e('0x41')](handleError(_0x1b376e,null));};exports[_0x012e('0x48')]=function(_0x5cda32,_0x1e8cda){if(_0x5cda32[_0x012e('0x47')]['id']){delete _0x5cda32[_0x012e('0x47')]['id'];}return db[_0x012e('0x3e')][_0x012e('0x45')]({'where':{'id':_0x5cda32[_0x012e('0x43')]['id']}})[_0x012e('0x22')](handleEntityNotFound(_0x1e8cda,null))[_0x012e('0x22')](saveUpdates(_0x5cda32['body'],null))['then'](respondWithResult(_0x1e8cda,null))[_0x012e('0x41')](handleError(_0x1e8cda,null));};exports[_0x012e('0x23')]=function(_0x2e3a19,_0x9b989a){return db[_0x012e('0x3e')][_0x012e('0x45')]({'where':{'id':_0x2e3a19[_0x012e('0x43')]['id']}})[_0x012e('0x22')](handleEntityNotFound(_0x9b989a,null))[_0x012e('0x22')](removeEntity(_0x9b989a,null))[_0x012e('0x41')](handleError(_0x9b989a,null));};exports[_0x012e('0x49')]=function(_0x450a0e,_0xc5dc43){return db[_0x012e('0x3e')]['describe']()[_0x012e('0x22')](respondWithResult(_0xc5dc43,null))[_0x012e('0x41')](handleError(_0xc5dc43,null));}; \ No newline at end of file +var _0x527f=['fieldName','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','keys','fields','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes'];(function(_0x3956c2,_0x125cdd){var _0x4afed3=function(_0x3d07d7){while(--_0x3d07d7){_0x3956c2['push'](_0x3956c2['shift']());}};_0x4afed3(++_0x125cdd);}(_0x527f,0x1dd));var _0xf527=function(_0x1024f4,_0xa4d412){_0x1024f4=_0x1024f4-0x0;var _0x58b740=_0x527f[_0x1024f4];return _0x58b740;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf527('0x0'));var zipdir=require(_0xf527('0x1'));var jsonpatch=require(_0xf527('0x2'));var rp=require('request-promise');var moment=require(_0xf527('0x3'));var BPromise=require(_0xf527('0x4'));var Mustache=require(_0xf527('0x5'));var util=require(_0xf527('0x6'));var path=require(_0xf527('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf527('0x8'));var fs=require('fs');var fs_extra=require(_0xf527('0x9'));var _=require(_0xf527('0xa'));var squel=require('squel');var crypto=require(_0xf527('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf527('0xc'));var toCsv=require(_0xf527('0xd'));var querystring=require(_0xf527('0xe'));var Papa=require(_0xf527('0xf'));var Redis=require(_0xf527('0x10'));var authService=require(_0xf527('0x11'));var qs=require(_0xf527('0x12'));var as=require(_0xf527('0x13'));var hardwareService=require(_0xf527('0x14'));var logger=require('../../config/logger')(_0xf527('0x15'));var utils=require(_0xf527('0x16'));var config=require(_0xf527('0x17'));var licenseUtil=require(_0xf527('0x18'));var db=require(_0xf527('0x19'))['db'];function respondWithStatusCode(_0x3f4837,_0x47e07f){_0x47e07f=_0x47e07f||0xcc;return function(_0x1c419c){if(_0x1c419c){return _0x3f4837[_0xf527('0x1a')](_0x47e07f);}return _0x3f4837[_0xf527('0x1b')](_0x47e07f)[_0xf527('0x1c')]();};}function respondWithResult(_0x45a17d,_0x52aebd){_0x52aebd=_0x52aebd||0xc8;return function(_0x9f7f6f){if(_0x9f7f6f){return _0x45a17d['status'](_0x52aebd)[_0xf527('0x1d')](_0x9f7f6f);}};}function respondWithFilteredResult(_0x3c7763,_0x23c453){return function(_0x2dd80){if(_0x2dd80){var _0xfe6266=typeof _0x23c453['offset']==='undefined'&&typeof _0x23c453[_0xf527('0x1e')]===_0xf527('0x1f');var _0x5e8fc2=_0x2dd80[_0xf527('0x20')];var _0x53b5a4=_0xfe6266?0x0:_0x23c453[_0xf527('0x21')];var _0x5c13ff=_0xfe6266?_0x2dd80['count']:_0x23c453[_0xf527('0x21')]+_0x23c453['limit'];var _0x544b95;if(_0x5c13ff>=_0x5e8fc2){_0x5c13ff=_0x5e8fc2;_0x544b95=0xc8;}else{_0x544b95=0xce;}_0x3c7763[_0xf527('0x1b')](_0x544b95);return _0x3c7763[_0xf527('0x22')](_0xf527('0x23'),_0x53b5a4+'-'+_0x5c13ff+'/'+_0x5e8fc2)[_0xf527('0x1d')](_0x2dd80);}return null;};}function patchUpdates(_0x7c697c){return function(_0x300832){try{jsonpatch['apply'](_0x300832,_0x7c697c,!![]);}catch(_0x2a7207){return BPromise[_0xf527('0x24')](_0x2a7207);}return _0x300832[_0xf527('0x25')]();};}function saveUpdates(_0x5e3114,_0x94afcc){return function(_0x2bdb7a){if(_0x2bdb7a){return _0x2bdb7a[_0xf527('0x26')](_0x5e3114)[_0xf527('0x27')](function(_0x471d17){return _0x471d17;});}return null;};}function removeEntity(_0x998045,_0x5869b4){return function(_0x5c75f6){if(_0x5c75f6){return _0x5c75f6[_0xf527('0x28')]()[_0xf527('0x27')](function(){_0x998045['status'](0xcc)[_0xf527('0x1c')]();});}};}function handleEntityNotFound(_0x40f4bb,_0x256e3f){return function(_0x5e7548){if(!_0x5e7548){_0x40f4bb[_0xf527('0x1a')](0x194);}return _0x5e7548;};}function handleError(_0x1cd148,_0x2a6967){_0x2a6967=_0x2a6967||0x1f4;return function(_0x5256d2){logger['error'](_0x5256d2[_0xf527('0x29')]);if(_0x5256d2['name']){delete _0x5256d2[_0xf527('0x2a')];}_0x1cd148[_0xf527('0x1b')](_0x2a6967)[_0xf527('0x2b')](_0x5256d2);};}exports[_0xf527('0x2c')]=function(_0x1c0941,_0x51819f){var _0xde09b6={},_0x1f8d38={},_0x5d9df0={'count':0x0,'rows':[]};var _0x481dae=_[_0xf527('0x2d')](db[_0xf527('0x2e')][_0xf527('0x2f')],function(_0x356ec2){return{'name':_0x356ec2[_0xf527('0x30')],'type':_0x356ec2['type'][_0xf527('0x31')]};});_0x1f8d38['model']=_[_0xf527('0x2d')](_0x481dae,'name');_0x1f8d38['query']=_['keys'](_0x1c0941[_0xf527('0x32')]);_0x1f8d38[_0xf527('0x33')]=_[_0xf527('0x34')](_0x1f8d38[_0xf527('0x35')],_0x1f8d38[_0xf527('0x32')]);_0xde09b6[_0xf527('0x36')]=_[_0xf527('0x34')](_0x1f8d38[_0xf527('0x35')],qs['fields'](_0x1c0941[_0xf527('0x32')]['fields']));_0xde09b6[_0xf527('0x36')]=_0xde09b6['attributes'][_0xf527('0x37')]?_0xde09b6['attributes']:_0x1f8d38[_0xf527('0x35')];if(!_0x1c0941['query']['hasOwnProperty'](_0xf527('0x38'))){_0xde09b6['limit']=qs['limit'](_0x1c0941[_0xf527('0x32')][_0xf527('0x1e')]);_0xde09b6[_0xf527('0x21')]=qs[_0xf527('0x21')](_0x1c0941['query'][_0xf527('0x21')]);}_0xde09b6[_0xf527('0x39')]=qs[_0xf527('0x3a')](_0x1c0941[_0xf527('0x32')][_0xf527('0x3a')]);_0xde09b6['where']=qs['filters'](_[_0xf527('0x3b')](_0x1c0941[_0xf527('0x32')],_0x1f8d38['filters']),_0x481dae);if(_0x1c0941[_0xf527('0x32')]['filter']){_0xde09b6[_0xf527('0x3c')]=_[_0xf527('0x3d')](_0xde09b6['where'],{'$or':_[_0xf527('0x2d')](_0x481dae,function(_0x582d43){if(_0x582d43['type']!==_0xf527('0x3e')){var _0x118abe={};_0x118abe[_0x582d43['name']]={'$like':'%'+_0x1c0941[_0xf527('0x32')][_0xf527('0x3f')]+'%'};return _0x118abe;}})});}_0xde09b6=_[_0xf527('0x3d')]({},_0xde09b6,_0x1c0941['options']);var _0x49a1c9={'where':_0xde09b6[_0xf527('0x3c')]};return db[_0xf527('0x2e')][_0xf527('0x20')](_0x49a1c9)[_0xf527('0x27')](function(_0x2a7aa1){_0x5d9df0[_0xf527('0x20')]=_0x2a7aa1;if(_0x1c0941[_0xf527('0x32')][_0xf527('0x40')]){_0xde09b6['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0xde09b6);})['then'](function(_0x2d343f){_0x5d9df0[_0xf527('0x41')]=_0x2d343f;return _0x5d9df0;})[_0xf527('0x27')](respondWithFilteredResult(_0x51819f,_0xde09b6))[_0xf527('0x42')](handleError(_0x51819f,null));};exports[_0xf527('0x43')]=function(_0x37a2fe,_0x56c107){var _0x5e0236={'raw':!![],'where':{'id':_0x37a2fe[_0xf527('0x44')]['id']}},_0x40e771={};_0x40e771[_0xf527('0x35')]=_[_0xf527('0x45')](db[_0xf527('0x2e')][_0xf527('0x2f')]);_0x40e771[_0xf527('0x32')]=_[_0xf527('0x45')](_0x37a2fe[_0xf527('0x32')]);_0x40e771[_0xf527('0x33')]=_[_0xf527('0x34')](_0x40e771[_0xf527('0x35')],_0x40e771['query']);_0x5e0236[_0xf527('0x36')]=_['intersection'](_0x40e771[_0xf527('0x35')],qs[_0xf527('0x46')](_0x37a2fe[_0xf527('0x32')][_0xf527('0x46')]));_0x5e0236[_0xf527('0x36')]=_0x5e0236[_0xf527('0x36')][_0xf527('0x37')]?_0x5e0236[_0xf527('0x36')]:_0x40e771[_0xf527('0x35')];if(_0x37a2fe[_0xf527('0x32')][_0xf527('0x40')]){_0x5e0236['include']=[{'all':!![]}];}_0x5e0236=_['merge']({},_0x5e0236,_0x37a2fe['options']);return db[_0xf527('0x2e')][_0xf527('0x47')](_0x5e0236)[_0xf527('0x27')](handleEntityNotFound(_0x56c107,null))[_0xf527('0x27')](respondWithResult(_0x56c107,null))[_0xf527('0x42')](handleError(_0x56c107,null));};exports[_0xf527('0x48')]=function(_0x5c1aef,_0x36c4b5){return db['JscriptyQuestionReport']['create'](_0x5c1aef['body'],{})[_0xf527('0x27')](respondWithResult(_0x36c4b5,0xc9))['catch'](handleError(_0x36c4b5,null));};exports['update']=function(_0x23eb31,_0x105b4d){if(_0x23eb31['body']['id']){delete _0x23eb31[_0xf527('0x49')]['id'];}return db['JscriptyQuestionReport'][_0xf527('0x47')]({'where':{'id':_0x23eb31[_0xf527('0x44')]['id']}})['then'](handleEntityNotFound(_0x105b4d,null))[_0xf527('0x27')](saveUpdates(_0x23eb31[_0xf527('0x49')],null))[_0xf527('0x27')](respondWithResult(_0x105b4d,null))[_0xf527('0x42')](handleError(_0x105b4d,null));};exports[_0xf527('0x28')]=function(_0x9fc6c,_0x1964c3){return db[_0xf527('0x2e')][_0xf527('0x47')]({'where':{'id':_0x9fc6c[_0xf527('0x44')]['id']}})['then'](handleEntityNotFound(_0x1964c3,null))['then'](removeEntity(_0x1964c3,null))['catch'](handleError(_0x1964c3,null));};exports[_0xf527('0x4a')]=function(_0x492282,_0x350b16){return db[_0xf527('0x2e')][_0xf527('0x4a')]()[_0xf527('0x27')](respondWithResult(_0x350b16,null))[_0xf527('0x42')](handleError(_0x350b16,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 9a25f9a..052c33a 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 _0x24ea=['report_jscripty_questions','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport'];(function(_0x17b1c0,_0x5f48f5){var _0x5b0ff5=function(_0x404a6c){while(--_0x404a6c){_0x17b1c0['push'](_0x17b1c0['shift']());}};_0x5b0ff5(++_0x5f48f5);}(_0x24ea,0x119));var _0xa24e=function(_0x5a69df,_0x2b21fd){_0x5a69df=_0x5a69df-0x0;var _0x220ad0=_0x24ea[_0x5a69df];return _0x220ad0;};'use strict';var _=require(_0xa24e('0x0'));var util=require('util');var logger=require(_0xa24e('0x1'))(_0xa24e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa24e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa24e('0x4'));var config=require(_0xa24e('0x5'));var attributes=require(_0xa24e('0x6'));module[_0xa24e('0x7')]=function(_0x57d812,_0xb0c313){return _0x57d812['define'](_0xa24e('0x8'),attributes,{'tableName':_0xa24e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e6f=['define','report_jscripty_questions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4400ee,_0x26ef9f){var _0x43d1ac=function(_0x4e97ab){while(--_0x4e97ab){_0x4400ee['push'](_0x4400ee['shift']());}};_0x43d1ac(++_0x26ef9f);}(_0x9e6f,0x86));var _0xf9e6=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9e6f[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xf9e6('0x0'));var util=require(_0xf9e6('0x1'));var logger=require('../../config/logger')(_0xf9e6('0x2'));var moment=require(_0xf9e6('0x3'));var BPromise=require(_0xf9e6('0x4'));var rp=require(_0xf9e6('0x5'));var fs=require('fs');var path=require(_0xf9e6('0x6'));var rimraf=require(_0xf9e6('0x7'));var config=require(_0xf9e6('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xf9e6('0x9')]=function(_0x18887d,_0x224ba0){return _0x18887d[_0xf9e6('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0xf9e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 197e9ed..61725e4 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 _0x249a=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x11df22,_0x4311b7){var _0x4dcb6a=function(_0xf7ec8a){while(--_0xf7ec8a){_0x11df22['push'](_0x11df22['shift']());}};_0x4dcb6a(++_0x4311b7);}(_0x249a,0x122));var _0xa249=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x249a[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xa249('0x0'));var util=require('util');var moment=require(_0xa249('0x1'));var BPromise=require(_0xa249('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa249('0x3'));var db=require(_0xa249('0x4'))['db'];var utils=require(_0xa249('0x5'));var logger=require('../../config/logger')(_0xa249('0x6'));var config=require(_0xa249('0x7'));var jayson=require(_0xa249('0x8'));var client=jayson[_0xa249('0x9')][_0xa249('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x263ae6,_0x2044f9,_0x5e4ad0){return new BPromise(function(_0x5c487d,_0x287c76){return client[_0xa249('0xb')](_0x263ae6,_0x5e4ad0)[_0xa249('0xc')](function(_0x5a4b25){logger[_0xa249('0xd')](_0xa249('0xe'),_0x2044f9,_0xa249('0xf'));logger[_0xa249('0x10')](_0xa249('0x11'),_0x2044f9,_0xa249('0xf'),JSON[_0xa249('0x12')](_0x5a4b25));if(_0x5a4b25[_0xa249('0x13')]){if(_0x5a4b25[_0xa249('0x13')][_0xa249('0x14')]===0x1f4){logger[_0xa249('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2044f9,_0x5a4b25[_0xa249('0x13')][_0xa249('0x15')]);return _0x287c76(_0x5a4b25[_0xa249('0x13')][_0xa249('0x15')]);}logger['error'](_0xa249('0xe'),_0x2044f9,_0x5a4b25[_0xa249('0x13')][_0xa249('0x15')]);return _0x5c487d(_0x5a4b25[_0xa249('0x13')][_0xa249('0x15')]);}else{logger[_0xa249('0xd')](_0xa249('0xe'),_0x2044f9,'request\x20sent');_0x5c487d(_0x5a4b25[_0xa249('0x16')]['message']);}})[_0xa249('0x17')](function(_0x28b2da){logger[_0xa249('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2044f9,_0x28b2da);_0x287c76(_0x28b2da);});});} \ No newline at end of file +var _0x732c=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message'];(function(_0x433c11,_0x509a13){var _0x1bbb06=function(_0x54697b){while(--_0x54697b){_0x433c11['push'](_0x433c11['shift']());}};_0x1bbb06(++_0x509a13);}(_0x732c,0x96));var _0xc732=function(_0x25abcf,_0x406f84){_0x25abcf=_0x25abcf-0x0;var _0xb49ba=_0x732c[_0x25abcf];return _0xb49ba;};'use strict';var _=require(_0xc732('0x0'));var util=require(_0xc732('0x1'));var moment=require(_0xc732('0x2'));var BPromise=require(_0xc732('0x3'));var rs=require(_0xc732('0x4'));var fs=require('fs');var Redis=require(_0xc732('0x5'));var db=require(_0xc732('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc732('0x7'))(_0xc732('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc732('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x230b21,_0x3d4d79,_0x11ffa9){return new BPromise(function(_0x1defee,_0x4d1df0){return client[_0xc732('0xa')](_0x230b21,_0x11ffa9)['then'](function(_0xb9dd37){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3d4d79,_0xc732('0xb'));logger[_0xc732('0xc')](_0xc732('0xd'),_0x3d4d79,'request\x20sent',JSON[_0xc732('0xe')](_0xb9dd37));if(_0xb9dd37[_0xc732('0xf')]){if(_0xb9dd37[_0xc732('0xf')]['code']===0x1f4){logger['error'](_0xc732('0x10'),_0x3d4d79,_0xb9dd37[_0xc732('0xf')][_0xc732('0x11')]);return _0x4d1df0(_0xb9dd37[_0xc732('0xf')][_0xc732('0x11')]);}logger[_0xc732('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3d4d79,_0xb9dd37['error']['message']);return _0x1defee(_0xb9dd37[_0xc732('0xf')][_0xc732('0x11')]);}else{logger[_0xc732('0x12')](_0xc732('0x10'),_0x3d4d79,'request\x20sent');_0x1defee(_0xb9dd37[_0xc732('0x13')]['message']);}})[_0xc732('0x14')](function(_0xf57f7e){logger[_0xc732('0xf')](_0xc732('0x10'),_0x3d4d79,_0xf57f7e);_0x4d1df0(_0xf57f7e);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4dfc1e3..c0c7e72 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 _0xa96b=['update','delete','destroy','exports','connect-timeout','express','Router','../../components/interaction/service','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/questions','getQuestions','post','create','put'];(function(_0x40798d,_0x3d4bbb){var _0x6a942=function(_0x1ae3d1){while(--_0x1ae3d1){_0x40798d['push'](_0x40798d['shift']());}};_0x6a942(++_0x3d4bbb);}(_0xa96b,0x7c));var _0xba96=function(_0x3ddd8a,_0x17ee7b){_0x3ddd8a=_0x3ddd8a-0x0;var _0x494a72=_0xa96b[_0x3ddd8a];return _0x494a72;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xba96('0x0'));var express=require(_0xba96('0x1'));var router=express[_0xba96('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba96('0x3'));var config=require('../../config/environment');var controller=require(_0xba96('0x4'));router[_0xba96('0x5')]('/',auth['isAuthenticated'](),controller[_0xba96('0x6')]);router[_0xba96('0x5')](_0xba96('0x7'),auth[_0xba96('0x8')](),controller['describe']);router[_0xba96('0x5')](_0xba96('0x9'),auth[_0xba96('0x8')](),controller[_0xba96('0xa')]);router[_0xba96('0x5')](_0xba96('0xb'),auth[_0xba96('0x8')](),controller[_0xba96('0xc')]);router[_0xba96('0xd')]('/',auth[_0xba96('0x8')](),controller[_0xba96('0xe')]);router[_0xba96('0xf')](_0xba96('0x9'),auth[_0xba96('0x8')](),controller[_0xba96('0x10')]);router[_0xba96('0x11')](_0xba96('0x9'),auth['isAuthenticated'](),controller[_0xba96('0x12')]);module[_0xba96('0x13')]=router; \ No newline at end of file +var _0x5710=['multer','util','path','express','Router','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/questions','getQuestions','create','update','delete','destroy','exports'];(function(_0x171f5a,_0xf4e4c8){var _0x182780=function(_0x14107d){while(--_0x14107d){_0x171f5a['push'](_0x171f5a['shift']());}};_0x182780(++_0xf4e4c8);}(_0x5710,0xbd));var _0x0571=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5710[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0571('0x0'));var util=require(_0x0571('0x1'));var path=require(_0x0571('0x2'));var timeout=require('connect-timeout');var express=require(_0x0571('0x3'));var router=express[_0x0571('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0571('0x5'));var config=require('../../config/environment');var controller=require(_0x0571('0x6'));router['get']('/',auth[_0x0571('0x7')](),controller[_0x0571('0x8')]);router[_0x0571('0x9')](_0x0571('0xa'),auth[_0x0571('0x7')](),controller[_0x0571('0xb')]);router[_0x0571('0x9')](_0x0571('0xc'),auth['isAuthenticated'](),controller[_0x0571('0xd')]);router['get'](_0x0571('0xe'),auth[_0x0571('0x7')](),controller[_0x0571('0xf')]);router['post']('/',auth[_0x0571('0x7')](),controller[_0x0571('0x10')]);router['put'](_0x0571('0xc'),auth[_0x0571('0x7')](),controller[_0x0571('0x11')]);router[_0x0571('0x12')]('/:id',auth[_0x0571('0x7')](),controller[_0x0571('0x13')]);module[_0x0571('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 4cef251..6632493 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 _0xf751=['moment','sequelize','exports','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x57d3c5,_0x2eb41a){var _0x5c5056=function(_0x56316b){while(--_0x56316b){_0x57d3c5['push'](_0x57d3c5['shift']());}};_0x5c5056(++_0x2eb41a);}(_0xf751,0x132));var _0x1f75=function(_0x237c56,_0x13c40e){_0x237c56=_0x237c56-0x0;var _0x216033=_0xf751[_0x237c56];return _0x216033;};'use strict';var moment=require(_0x1f75('0x0'));var Sequelize=require(_0x1f75('0x1'));module[_0x1f75('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3cab10){this[_0x1f75('0x3')](_0x1f75('0x4'),_0x3cab10);this[_0x1f75('0x3')]('endtime',moment()[_0x1f75('0x5')](_0x1f75('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x1f75('0x7')]},'projectname':{'type':Sequelize[_0x1f75('0x7')]},'queue':{'type':Sequelize[_0x1f75('0x7')]},'uniqueid':{'type':Sequelize[_0x1f75('0x7')]},'calleridname':{'type':Sequelize[_0x1f75('0x7')]},'calleridnum':{'type':Sequelize[_0x1f75('0x7')]},'completed':{'type':Sequelize[_0x1f75('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xda34=['setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','exports','DATE'];(function(_0x2263f1,_0x13dea4){var _0x285df4=function(_0x3cdbb3){while(--_0x3cdbb3){_0x2263f1['push'](_0x2263f1['shift']());}};_0x285df4(++_0x13dea4);}(_0xda34,0x14e));var _0x4da3=function(_0x4240f0,_0x2ccabe){_0x4240f0=_0x4240f0-0x0;var _0xa45a32=_0xda34[_0x4240f0];return _0xa45a32;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4da3('0x0')]={'starttime':{'type':Sequelize[_0x4da3('0x1')],'set':function(_0x4d76c5){this[_0x4da3('0x2')](_0x4da3('0x3'),_0x4d76c5);this['setDataValue']('endtime',moment()[_0x4da3('0x4')](_0x4da3('0x5')));}},'endtime':{'type':Sequelize[_0x4da3('0x1')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4da3('0x6')]},'calleridnum':{'type':Sequelize[_0x4da3('0x6')]},'completed':{'type':Sequelize[_0x4da3('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 2293218..9302ce1 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 _0x578b=['JscriptyQuestionReport','includeAll','findAll','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','send','index','map','JscriptySessionReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','SessionId'];(function(_0x2f6926,_0x3daccf){var _0x17538b=function(_0x941a2a){while(--_0x941a2a){_0x2f6926['push'](_0x2f6926['shift']());}};_0x17538b(++_0x3daccf);}(_0x578b,0x1e3));var _0xb578=function(_0x1bf8cc,_0x118778){_0x1bf8cc=_0x1bf8cc-0x0;var _0x322d20=_0x578b[_0x1bf8cc];return _0x322d20;};'use strict';var emlformat=require(_0xb578('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb578('0x1'));var rp=require(_0xb578('0x2'));var moment=require(_0xb578('0x3'));var BPromise=require(_0xb578('0x4'));var Mustache=require(_0xb578('0x5'));var util=require(_0xb578('0x6'));var path=require(_0xb578('0x7'));var sox=require(_0xb578('0x8'));var csv=require('to-csv');var ejs=require(_0xb578('0x9'));var fs=require('fs');var fs_extra=require(_0xb578('0xa'));var _=require(_0xb578('0xb'));var squel=require(_0xb578('0xc'));var crypto=require(_0xb578('0xd'));var jsforce=require(_0xb578('0xe'));var deskjs=require(_0xb578('0xf'));var toCsv=require(_0xb578('0x10'));var querystring=require(_0xb578('0x11'));var Papa=require(_0xb578('0x12'));var Redis=require('ioredis');var authService=require(_0xb578('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb578('0x14'));var hardwareService=require(_0xb578('0x15'));var logger=require(_0xb578('0x16'))('api');var utils=require(_0xb578('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb578('0x18'));var db=require(_0xb578('0x19'))['db'];function respondWithStatusCode(_0x446a04,_0x38b302){_0x38b302=_0x38b302||0xcc;return function(_0x5a40f6){if(_0x5a40f6){return _0x446a04['sendStatus'](_0x38b302);}return _0x446a04[_0xb578('0x1a')](_0x38b302)[_0xb578('0x1b')]();};}function respondWithResult(_0x2d4d84,_0x2d7a1a){_0x2d7a1a=_0x2d7a1a||0xc8;return function(_0x19ba95){if(_0x19ba95){return _0x2d4d84[_0xb578('0x1a')](_0x2d7a1a)[_0xb578('0x1c')](_0x19ba95);}};}function respondWithFilteredResult(_0x59fdd5,_0x3a01f6){return function(_0x493403){if(_0x493403){var _0x5bc3b3=typeof _0x3a01f6[_0xb578('0x1d')]==='undefined'&&typeof _0x3a01f6[_0xb578('0x1e')]===_0xb578('0x1f');var _0x4a289d=_0x493403[_0xb578('0x20')];var _0x5bee0e=_0x5bc3b3?0x0:_0x3a01f6['offset'];var _0x4d44b9=_0x5bc3b3?_0x493403[_0xb578('0x20')]:_0x3a01f6[_0xb578('0x1d')]+_0x3a01f6[_0xb578('0x1e')];var _0x1d5519;if(_0x4d44b9>=_0x4a289d){_0x4d44b9=_0x4a289d;_0x1d5519=0xc8;}else{_0x1d5519=0xce;}_0x59fdd5[_0xb578('0x1a')](_0x1d5519);return _0x59fdd5[_0xb578('0x21')](_0xb578('0x22'),_0x5bee0e+'-'+_0x4d44b9+'/'+_0x4a289d)[_0xb578('0x1c')](_0x493403);}return null;};}function patchUpdates(_0x3a02e5){return function(_0x185294){try{jsonpatch[_0xb578('0x23')](_0x185294,_0x3a02e5,!![]);}catch(_0x28c7a3){return BPromise['reject'](_0x28c7a3);}return _0x185294['save']();};}function saveUpdates(_0x292e0f,_0x393187){return function(_0x34104c){if(_0x34104c){return _0x34104c[_0xb578('0x24')](_0x292e0f)['then'](function(_0x268a68){return _0x268a68;});}return null;};}function removeEntity(_0x1a8b38,_0x136c5a){return function(_0x110f05){if(_0x110f05){return _0x110f05['destroy']()[_0xb578('0x25')](function(){_0x1a8b38[_0xb578('0x1a')](0xcc)[_0xb578('0x1b')]();});}};}function handleEntityNotFound(_0x5edf78,_0x3a4a10){return function(_0xc05871){if(!_0xc05871){_0x5edf78['sendStatus'](0x194);}return _0xc05871;};}function handleError(_0x3a5c0f,_0x3fe150){_0x3fe150=_0x3fe150||0x1f4;return function(_0x3efdc6){logger[_0xb578('0x26')](_0x3efdc6[_0xb578('0x27')]);if(_0x3efdc6[_0xb578('0x28')]){delete _0x3efdc6[_0xb578('0x28')];}_0x3a5c0f[_0xb578('0x1a')](_0x3fe150)[_0xb578('0x29')](_0x3efdc6);};}exports[_0xb578('0x2a')]=function(_0x5d7019,_0x5df302){var _0x180cd6={},_0x3b9981={},_0x520e63={'count':0x0,'rows':[]};var _0x53a3fc=_[_0xb578('0x2b')](db[_0xb578('0x2c')]['rawAttributes'],function(_0x38764b){return{'name':_0x38764b['fieldName'],'type':_0x38764b[_0xb578('0x2d')][_0xb578('0x2e')]};});_0x3b9981[_0xb578('0x2f')]=_[_0xb578('0x2b')](_0x53a3fc,_0xb578('0x28'));_0x3b9981[_0xb578('0x30')]=_[_0xb578('0x31')](_0x5d7019['query']);_0x3b9981[_0xb578('0x32')]=_['intersection'](_0x3b9981['model'],_0x3b9981[_0xb578('0x30')]);_0x180cd6['attributes']=_[_0xb578('0x33')](_0x3b9981[_0xb578('0x2f')],qs[_0xb578('0x34')](_0x5d7019[_0xb578('0x30')][_0xb578('0x34')]));_0x180cd6[_0xb578('0x35')]=_0x180cd6['attributes'][_0xb578('0x36')]?_0x180cd6[_0xb578('0x35')]:_0x3b9981[_0xb578('0x2f')];if(!_0x5d7019['query'][_0xb578('0x37')](_0xb578('0x38'))){_0x180cd6[_0xb578('0x1e')]=qs[_0xb578('0x1e')](_0x5d7019['query'][_0xb578('0x1e')]);_0x180cd6[_0xb578('0x1d')]=qs[_0xb578('0x1d')](_0x5d7019['query'][_0xb578('0x1d')]);}_0x180cd6[_0xb578('0x39')]=qs[_0xb578('0x3a')](_0x5d7019['query'][_0xb578('0x3a')]);_0x180cd6[_0xb578('0x3b')]=qs[_0xb578('0x32')](_[_0xb578('0x3c')](_0x5d7019['query'],_0x3b9981[_0xb578('0x32')]),_0x53a3fc);if(_0x5d7019['query']['filter']){_0x180cd6[_0xb578('0x3b')]=_[_0xb578('0x3d')](_0x180cd6[_0xb578('0x3b')],{'$or':_['map'](_0x53a3fc,function(_0x387dc7){if(_0x387dc7[_0xb578('0x2d')]!==_0xb578('0x3e')){var _0x3a6b67={};_0x3a6b67[_0x387dc7[_0xb578('0x28')]]={'$like':'%'+_0x5d7019['query'][_0xb578('0x3f')]+'%'};return _0x3a6b67;}})});}_0x180cd6=_['merge']({},_0x180cd6,_0x5d7019[_0xb578('0x40')]);var _0x1fd76b={'where':_0x180cd6['where']};return db[_0xb578('0x2c')][_0xb578('0x20')](_0x1fd76b)['then'](function(_0x338ea5){_0x520e63[_0xb578('0x20')]=_0x338ea5;if(_0x5d7019[_0xb578('0x30')]['includeAll']){_0x180cd6[_0xb578('0x41')]=[{'all':!![]}];}return db[_0xb578('0x2c')]['findAll'](_0x180cd6);})['then'](function(_0x4ec996){_0x520e63[_0xb578('0x42')]=_0x4ec996;return _0x520e63;})['then'](respondWithFilteredResult(_0x5df302,_0x180cd6))[_0xb578('0x43')](handleError(_0x5df302,null));};exports[_0xb578('0x44')]=function(_0x143075,_0x80e760){var _0x57d92c={'raw':!![],'where':{'id':_0x143075[_0xb578('0x45')]['id']}},_0x3e16da={};_0x3e16da[_0xb578('0x2f')]=_['keys'](db[_0xb578('0x2c')][_0xb578('0x46')]);_0x3e16da[_0xb578('0x30')]=_['keys'](_0x143075[_0xb578('0x30')]);_0x3e16da[_0xb578('0x32')]=_[_0xb578('0x33')](_0x3e16da[_0xb578('0x2f')],_0x3e16da[_0xb578('0x30')]);_0x57d92c[_0xb578('0x35')]=_['intersection'](_0x3e16da['model'],qs['fields'](_0x143075[_0xb578('0x30')][_0xb578('0x34')]));_0x57d92c['attributes']=_0x57d92c[_0xb578('0x35')]['length']?_0x57d92c[_0xb578('0x35')]:_0x3e16da[_0xb578('0x2f')];if(_0x143075[_0xb578('0x30')]['includeAll']){_0x57d92c[_0xb578('0x41')]=[{'all':!![]}];}_0x57d92c=_[_0xb578('0x3d')]({},_0x57d92c,_0x143075['options']);return db['JscriptySessionReport'][_0xb578('0x47')](_0x57d92c)[_0xb578('0x25')](handleEntityNotFound(_0x80e760,null))['then'](respondWithResult(_0x80e760,null))['catch'](handleError(_0x80e760,null));};exports[_0xb578('0x48')]=function(_0x707f04,_0x2af257){return db[_0xb578('0x2c')][_0xb578('0x48')](_0x707f04['body'],{})['then'](respondWithResult(_0x2af257,0xc9))[_0xb578('0x43')](handleError(_0x2af257,null));};exports[_0xb578('0x24')]=function(_0x2a85dd,_0x55ca19){if(_0x2a85dd[_0xb578('0x49')]['id']){delete _0x2a85dd[_0xb578('0x49')]['id'];}return db['JscriptySessionReport'][_0xb578('0x47')]({'where':{'id':_0x2a85dd[_0xb578('0x45')]['id']}})[_0xb578('0x25')](handleEntityNotFound(_0x55ca19,null))[_0xb578('0x25')](saveUpdates(_0x2a85dd[_0xb578('0x49')],null))[_0xb578('0x25')](respondWithResult(_0x55ca19,null))['catch'](handleError(_0x55ca19,null));};exports[_0xb578('0x4a')]=function(_0x179375,_0x50b253){return db[_0xb578('0x2c')][_0xb578('0x47')]({'where':{'id':_0x179375[_0xb578('0x45')]['id']}})[_0xb578('0x25')](handleEntityNotFound(_0x50b253,null))[_0xb578('0x25')](removeEntity(_0x50b253,null))['catch'](handleError(_0x50b253,null));};exports[_0xb578('0x4b')]=function(_0x4de93a,_0x32185b){return db['JscriptySessionReport'][_0xb578('0x4b')]()[_0xb578('0x25')](respondWithResult(_0x32185b,null))['catch'](handleError(_0x32185b,null));};exports['getQuestions']=function(_0x1139b1,_0x491f66,_0x5ac051){var _0x3e5316={'raw':!![],'where':{}};var _0x19882b={};var _0x2f96d9={'count':0x0,'rows':[]};return db[_0xb578('0x2c')]['findOne']({'where':{'id':_0x1139b1[_0xb578('0x45')]['id']}})[_0xb578('0x25')](handleEntityNotFound(_0x491f66,null))[_0xb578('0x25')](function(_0x52c13b){if(_0x52c13b){_0x19882b[_0xb578('0x2f')]=_[_0xb578('0x31')](db['JscriptyQuestionReport'][_0xb578('0x46')]);_0x19882b['query']=_[_0xb578('0x31')](_0x1139b1[_0xb578('0x30')]);_0x19882b['filters']=_[_0xb578('0x33')](_0x19882b[_0xb578('0x2f')],_0x19882b[_0xb578('0x30')]);_0x3e5316[_0xb578('0x35')]=_[_0xb578('0x33')](_0x19882b['model'],qs['fields'](_0x1139b1['query'][_0xb578('0x34')]));_0x3e5316[_0xb578('0x35')]=_0x3e5316[_0xb578('0x35')][_0xb578('0x36')]?_0x3e5316[_0xb578('0x35')]:_0x19882b[_0xb578('0x2f')];if(!_0x1139b1[_0xb578('0x30')][_0xb578('0x37')](_0xb578('0x38'))){_0x3e5316['limit']=qs[_0xb578('0x1e')](_0x1139b1[_0xb578('0x30')][_0xb578('0x1e')]);_0x3e5316[_0xb578('0x1d')]=qs['offset'](_0x1139b1[_0xb578('0x30')][_0xb578('0x1d')]);}_0x3e5316[_0xb578('0x39')]=qs['sort'](_0x1139b1[_0xb578('0x30')][_0xb578('0x3a')]);_0x3e5316[_0xb578('0x3b')]=qs[_0xb578('0x32')](_[_0xb578('0x3c')](_0x1139b1[_0xb578('0x30')],_0x19882b[_0xb578('0x32')]));_0x3e5316['where'][_0xb578('0x4c')]=_0x52c13b['id'];if(_0x1139b1['query']['filter']){_0x3e5316[_0xb578('0x3b')]=_['merge'](_0x3e5316[_0xb578('0x3b')],{'$or':_[_0xb578('0x2b')](_0x3e5316[_0xb578('0x35')],function(_0x5e27ec){var _0x206f8e={};_0x206f8e[_0x5e27ec]={'$like':'%'+_0x1139b1['query']['filter']+'%'};return _0x206f8e;})});}_0x3e5316=_[_0xb578('0x3d')]({},_0x3e5316,_0x1139b1['options']);return db[_0xb578('0x4d')][_0xb578('0x20')]({'where':_0x3e5316[_0xb578('0x3b')]})[_0xb578('0x25')](function(_0xe9e2e7){_0x2f96d9[_0xb578('0x20')]=_0xe9e2e7;if(_0x1139b1['query'][_0xb578('0x4e')]){_0x3e5316['include']=[{'all':!![]}];}return db[_0xb578('0x4d')][_0xb578('0x4f')](_0x3e5316);})[_0xb578('0x25')](function(_0x4a6d2b){_0x2f96d9[_0xb578('0x42')]=_0x4a6d2b;return _0x2f96d9;});}})[_0xb578('0x25')](respondWithFilteredResult(_0x491f66,_0x3e5316))[_0xb578('0x43')](handleError(_0x491f66,null));}; \ No newline at end of file +var _0x40a3=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','error','stack','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','params','length','find','catch','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x40a3,0x9b));var _0x340a=function(_0x806129,_0x2c46c9){_0x806129=_0x806129-0x0;var _0x3b3b04=_0x40a3[_0x806129];return _0x3b3b04;};'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(_0x340a('0x0'));var moment=require(_0x340a('0x1'));var BPromise=require(_0x340a('0x2'));var Mustache=require(_0x340a('0x3'));var util=require(_0x340a('0x4'));var path=require(_0x340a('0x5'));var sox=require(_0x340a('0x6'));var csv=require(_0x340a('0x7'));var ejs=require(_0x340a('0x8'));var fs=require('fs');var fs_extra=require(_0x340a('0x9'));var _=require(_0x340a('0xa'));var squel=require(_0x340a('0xb'));var crypto=require(_0x340a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x340a('0xd'));var toCsv=require(_0x340a('0x7'));var querystring=require(_0x340a('0xe'));var Papa=require('papaparse');var Redis=require(_0x340a('0xf'));var authService=require(_0x340a('0x10'));var qs=require(_0x340a('0x11'));var as=require(_0x340a('0x12'));var hardwareService=require(_0x340a('0x13'));var logger=require(_0x340a('0x14'))(_0x340a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x340a('0x16'))['db'];function respondWithStatusCode(_0x476890,_0x4459a8){_0x4459a8=_0x4459a8||0xcc;return function(_0x32d6fa){if(_0x32d6fa){return _0x476890[_0x340a('0x17')](_0x4459a8);}return _0x476890[_0x340a('0x18')](_0x4459a8)[_0x340a('0x19')]();};}function respondWithResult(_0x15d54d,_0x36c8b0){_0x36c8b0=_0x36c8b0||0xc8;return function(_0x1756b0){if(_0x1756b0){return _0x15d54d[_0x340a('0x18')](_0x36c8b0)['json'](_0x1756b0);}};}function respondWithFilteredResult(_0x69a210,_0x287336){return function(_0x27f6e0){if(_0x27f6e0){var _0x3bf869=typeof _0x287336['offset']===_0x340a('0x1a')&&typeof _0x287336[_0x340a('0x1b')]===_0x340a('0x1a');var _0x3fa2e6=_0x27f6e0[_0x340a('0x1c')];var _0x1c38eb=_0x3bf869?0x0:_0x287336[_0x340a('0x1d')];var _0x33b6d9=_0x3bf869?_0x27f6e0['count']:_0x287336['offset']+_0x287336[_0x340a('0x1b')];var _0x1c0879;if(_0x33b6d9>=_0x3fa2e6){_0x33b6d9=_0x3fa2e6;_0x1c0879=0xc8;}else{_0x1c0879=0xce;}_0x69a210[_0x340a('0x18')](_0x1c0879);return _0x69a210[_0x340a('0x1e')](_0x340a('0x1f'),_0x1c38eb+'-'+_0x33b6d9+'/'+_0x3fa2e6)[_0x340a('0x20')](_0x27f6e0);}return null;};}function patchUpdates(_0xfce7a9){return function(_0x1fbdbf){try{jsonpatch[_0x340a('0x21')](_0x1fbdbf,_0xfce7a9,!![]);}catch(_0x4bca54){return BPromise[_0x340a('0x22')](_0x4bca54);}return _0x1fbdbf[_0x340a('0x23')]();};}function saveUpdates(_0x4336e1,_0x4338fa){return function(_0x5fafa8){if(_0x5fafa8){return _0x5fafa8[_0x340a('0x24')](_0x4336e1)['then'](function(_0x5da808){return _0x5da808;});}return null;};}function removeEntity(_0x2e8496,_0x35386d){return function(_0x413d4b){if(_0x413d4b){return _0x413d4b['destroy']()['then'](function(){_0x2e8496[_0x340a('0x18')](0xcc)[_0x340a('0x19')]();});}};}function handleEntityNotFound(_0x3d4be4,_0x3e5fd9){return function(_0x1b9b6f){if(!_0x1b9b6f){_0x3d4be4[_0x340a('0x17')](0x194);}return _0x1b9b6f;};}function handleError(_0x399370,_0x236e85){_0x236e85=_0x236e85||0x1f4;return function(_0x12883a){logger[_0x340a('0x25')](_0x12883a[_0x340a('0x26')]);if(_0x12883a['name']){delete _0x12883a['name'];}_0x399370['status'](_0x236e85)[_0x340a('0x27')](_0x12883a);};}exports[_0x340a('0x28')]=function(_0x4cd971,_0x2e5f4c){var _0x2c6f96={},_0x38b482={},_0x195c40={'count':0x0,'rows':[]};var _0x4630f2=_[_0x340a('0x29')](db[_0x340a('0x2a')][_0x340a('0x2b')],function(_0x40eac1){return{'name':_0x40eac1[_0x340a('0x2c')],'type':_0x40eac1['type'][_0x340a('0x2d')]};});_0x38b482[_0x340a('0x2e')]=_[_0x340a('0x29')](_0x4630f2,_0x340a('0x2f'));_0x38b482[_0x340a('0x30')]=_[_0x340a('0x31')](_0x4cd971[_0x340a('0x30')]);_0x38b482[_0x340a('0x32')]=_['intersection'](_0x38b482['model'],_0x38b482['query']);_0x2c6f96['attributes']=_[_0x340a('0x33')](_0x38b482[_0x340a('0x2e')],qs['fields'](_0x4cd971[_0x340a('0x30')][_0x340a('0x34')]));_0x2c6f96['attributes']=_0x2c6f96['attributes']['length']?_0x2c6f96[_0x340a('0x35')]:_0x38b482['model'];if(!_0x4cd971[_0x340a('0x30')][_0x340a('0x36')](_0x340a('0x37'))){_0x2c6f96[_0x340a('0x1b')]=qs[_0x340a('0x1b')](_0x4cd971[_0x340a('0x30')][_0x340a('0x1b')]);_0x2c6f96[_0x340a('0x1d')]=qs[_0x340a('0x1d')](_0x4cd971[_0x340a('0x30')][_0x340a('0x1d')]);}_0x2c6f96[_0x340a('0x38')]=qs['sort'](_0x4cd971['query'][_0x340a('0x39')]);_0x2c6f96[_0x340a('0x3a')]=qs[_0x340a('0x32')](_[_0x340a('0x3b')](_0x4cd971[_0x340a('0x30')],_0x38b482['filters']),_0x4630f2);if(_0x4cd971[_0x340a('0x30')][_0x340a('0x3c')]){_0x2c6f96[_0x340a('0x3a')]=_[_0x340a('0x3d')](_0x2c6f96['where'],{'$or':_[_0x340a('0x29')](_0x4630f2,function(_0xbda883){if(_0xbda883['type']!==_0x340a('0x3e')){var _0x32673a={};_0x32673a[_0xbda883['name']]={'$like':'%'+_0x4cd971[_0x340a('0x30')][_0x340a('0x3c')]+'%'};return _0x32673a;}})});}_0x2c6f96=_[_0x340a('0x3d')]({},_0x2c6f96,_0x4cd971[_0x340a('0x3f')]);var _0x52f627={'where':_0x2c6f96['where']};return db[_0x340a('0x2a')][_0x340a('0x1c')](_0x52f627)[_0x340a('0x40')](function(_0x171052){_0x195c40['count']=_0x171052;if(_0x4cd971[_0x340a('0x30')][_0x340a('0x41')]){_0x2c6f96[_0x340a('0x42')]=[{'all':!![]}];}return db[_0x340a('0x2a')][_0x340a('0x43')](_0x2c6f96);})[_0x340a('0x40')](function(_0x148a2f){_0x195c40[_0x340a('0x44')]=_0x148a2f;return _0x195c40;})['then'](respondWithFilteredResult(_0x2e5f4c,_0x2c6f96))['catch'](handleError(_0x2e5f4c,null));};exports['show']=function(_0x57afe9,_0x3e93b3){var _0x5e4241={'raw':!![],'where':{'id':_0x57afe9[_0x340a('0x45')]['id']}},_0xe3c8c4={};_0xe3c8c4[_0x340a('0x2e')]=_[_0x340a('0x31')](db['JscriptySessionReport']['rawAttributes']);_0xe3c8c4[_0x340a('0x30')]=_[_0x340a('0x31')](_0x57afe9['query']);_0xe3c8c4[_0x340a('0x32')]=_['intersection'](_0xe3c8c4[_0x340a('0x2e')],_0xe3c8c4[_0x340a('0x30')]);_0x5e4241[_0x340a('0x35')]=_[_0x340a('0x33')](_0xe3c8c4['model'],qs[_0x340a('0x34')](_0x57afe9[_0x340a('0x30')][_0x340a('0x34')]));_0x5e4241[_0x340a('0x35')]=_0x5e4241[_0x340a('0x35')][_0x340a('0x46')]?_0x5e4241['attributes']:_0xe3c8c4[_0x340a('0x2e')];if(_0x57afe9[_0x340a('0x30')][_0x340a('0x41')]){_0x5e4241['include']=[{'all':!![]}];}_0x5e4241=_[_0x340a('0x3d')]({},_0x5e4241,_0x57afe9[_0x340a('0x3f')]);return db[_0x340a('0x2a')][_0x340a('0x47')](_0x5e4241)[_0x340a('0x40')](handleEntityNotFound(_0x3e93b3,null))[_0x340a('0x40')](respondWithResult(_0x3e93b3,null))[_0x340a('0x48')](handleError(_0x3e93b3,null));};exports[_0x340a('0x49')]=function(_0x495de5,_0xbaf30){return db[_0x340a('0x2a')][_0x340a('0x49')](_0x495de5[_0x340a('0x4a')],{})[_0x340a('0x40')](respondWithResult(_0xbaf30,0xc9))[_0x340a('0x48')](handleError(_0xbaf30,null));};exports[_0x340a('0x24')]=function(_0x1b76f0,_0x47e085){if(_0x1b76f0[_0x340a('0x4a')]['id']){delete _0x1b76f0['body']['id'];}return db['JscriptySessionReport'][_0x340a('0x47')]({'where':{'id':_0x1b76f0[_0x340a('0x45')]['id']}})[_0x340a('0x40')](handleEntityNotFound(_0x47e085,null))[_0x340a('0x40')](saveUpdates(_0x1b76f0[_0x340a('0x4a')],null))[_0x340a('0x40')](respondWithResult(_0x47e085,null))[_0x340a('0x48')](handleError(_0x47e085,null));};exports[_0x340a('0x4b')]=function(_0x3b9e62,_0x149f20){return db[_0x340a('0x2a')][_0x340a('0x47')]({'where':{'id':_0x3b9e62[_0x340a('0x45')]['id']}})[_0x340a('0x40')](handleEntityNotFound(_0x149f20,null))[_0x340a('0x40')](removeEntity(_0x149f20,null))[_0x340a('0x48')](handleError(_0x149f20,null));};exports['describe']=function(_0x50aecf,_0x349e28){return db['JscriptySessionReport'][_0x340a('0x4c')]()[_0x340a('0x40')](respondWithResult(_0x349e28,null))[_0x340a('0x48')](handleError(_0x349e28,null));};exports[_0x340a('0x4d')]=function(_0x10920b,_0x1c33c7,_0x24fd54){var _0x59612b={'raw':!![],'where':{}};var _0x24b93e={};var _0x5c84bf={'count':0x0,'rows':[]};return db[_0x340a('0x2a')][_0x340a('0x4e')]({'where':{'id':_0x10920b['params']['id']}})[_0x340a('0x40')](handleEntityNotFound(_0x1c33c7,null))[_0x340a('0x40')](function(_0x124501){if(_0x124501){_0x24b93e[_0x340a('0x2e')]=_[_0x340a('0x31')](db[_0x340a('0x4f')][_0x340a('0x2b')]);_0x24b93e[_0x340a('0x30')]=_[_0x340a('0x31')](_0x10920b['query']);_0x24b93e[_0x340a('0x32')]=_[_0x340a('0x33')](_0x24b93e[_0x340a('0x2e')],_0x24b93e[_0x340a('0x30')]);_0x59612b[_0x340a('0x35')]=_[_0x340a('0x33')](_0x24b93e[_0x340a('0x2e')],qs[_0x340a('0x34')](_0x10920b[_0x340a('0x30')][_0x340a('0x34')]));_0x59612b[_0x340a('0x35')]=_0x59612b['attributes'][_0x340a('0x46')]?_0x59612b[_0x340a('0x35')]:_0x24b93e['model'];if(!_0x10920b[_0x340a('0x30')][_0x340a('0x36')](_0x340a('0x37'))){_0x59612b[_0x340a('0x1b')]=qs[_0x340a('0x1b')](_0x10920b[_0x340a('0x30')]['limit']);_0x59612b[_0x340a('0x1d')]=qs['offset'](_0x10920b[_0x340a('0x30')][_0x340a('0x1d')]);}_0x59612b[_0x340a('0x38')]=qs[_0x340a('0x39')](_0x10920b[_0x340a('0x30')]['sort']);_0x59612b[_0x340a('0x3a')]=qs[_0x340a('0x32')](_[_0x340a('0x3b')](_0x10920b['query'],_0x24b93e[_0x340a('0x32')]));_0x59612b[_0x340a('0x3a')][_0x340a('0x50')]=_0x124501['id'];if(_0x10920b[_0x340a('0x30')][_0x340a('0x3c')]){_0x59612b[_0x340a('0x3a')]=_[_0x340a('0x3d')](_0x59612b['where'],{'$or':_[_0x340a('0x29')](_0x59612b['attributes'],function(_0xef66c7){var _0x68bb99={};_0x68bb99[_0xef66c7]={'$like':'%'+_0x10920b[_0x340a('0x30')][_0x340a('0x3c')]+'%'};return _0x68bb99;})});}_0x59612b=_[_0x340a('0x3d')]({},_0x59612b,_0x10920b['options']);return db[_0x340a('0x4f')][_0x340a('0x1c')]({'where':_0x59612b[_0x340a('0x3a')]})[_0x340a('0x40')](function(_0x167215){_0x5c84bf[_0x340a('0x1c')]=_0x167215;if(_0x10920b[_0x340a('0x30')]['includeAll']){_0x59612b[_0x340a('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x340a('0x43')](_0x59612b);})[_0x340a('0x40')](function(_0x38fc08){_0x5c84bf[_0x340a('0x44')]=_0x38fc08;return _0x5c84bf;});}})[_0x340a('0x40')](respondWithFilteredResult(_0x1c33c7,_0x59612b))[_0x340a('0x48')](handleError(_0x1c33c7,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c445721..812e8eb 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 _0x277c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x397d9c,_0x35d784){var _0x526a97=function(_0x139ab1){while(--_0x139ab1){_0x397d9c['push'](_0x397d9c['shift']());}};_0x526a97(++_0x35d784);}(_0x277c,0x153));var _0xc277=function(_0x551a2f,_0x174e15){_0x551a2f=_0x551a2f-0x0;var _0x11a5f8=_0x277c[_0x551a2f];return _0x11a5f8;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var logger=require(_0xc277('0x1'))(_0xc277('0x2'));var moment=require(_0xc277('0x3'));var BPromise=require(_0xc277('0x4'));var rp=require(_0xc277('0x5'));var fs=require('fs');var path=require(_0xc277('0x6'));var rimraf=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1a6582,_0x5a4f03){return _0x1a6582[_0xc277('0x9')]('JscriptySessionReport',attributes,{'tableName':_0xc277('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb66=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xcb66,0x19f));var _0x6cb6=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0xcb66[_0x22b39b];return _0x280e1d;};'use strict';var _=require('lodash');var util=require(_0x6cb6('0x0'));var logger=require(_0x6cb6('0x1'))(_0x6cb6('0x2'));var moment=require(_0x6cb6('0x3'));var BPromise=require(_0x6cb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cb6('0x5'));var rimraf=require(_0x6cb6('0x6'));var config=require(_0x6cb6('0x7'));var attributes=require(_0x6cb6('0x8'));module[_0x6cb6('0x9')]=function(_0x506d14,_0x53078d){return _0x506d14[_0x6cb6('0xa')](_0x6cb6('0xb'),attributes,{'tableName':_0x6cb6('0xc'),'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 bd9885e..2306b97 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 _0x6a55=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x6a55,0xdb));var _0x56a5=function(_0x57fcc0,_0x585004){_0x57fcc0=_0x57fcc0-0x0;var _0x5270df=_0x6a55[_0x57fcc0];return _0x5270df;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56a5('0x2'));var logger=require('../../config/logger')(_0x56a5('0x3'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x4'));var client=jayson[_0x56a5('0x5')][_0x56a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x293ea1,_0x444c65,_0x2272d9){return new BPromise(function(_0x2b8f57,_0x387dcb){return client['request'](_0x293ea1,_0x2272d9)[_0x56a5('0x7')](function(_0xf15490){logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,_0x56a5('0xa'));logger[_0x56a5('0xb')](_0x56a5('0xc'),_0x444c65,_0x56a5('0xa'),JSON[_0x56a5('0xd')](_0xf15490));if(_0xf15490['error']){if(_0xf15490['error'][_0x56a5('0xe')]===0x1f4){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x387dcb(_0xf15490[_0x56a5('0xf')]['message']);}logger['error'](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x2b8f57(_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);}else{logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,'request\x20sent');_0x2b8f57(_0xf15490[_0x56a5('0x11')]['message']);}})[_0x56a5('0x12')](function(_0x51d031){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0x51d031);_0x387dcb(_0x51d031);});});} \ No newline at end of file +var _0x2542=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0xbd9aa1,_0x220cad){var _0x1484e5=function(_0x172618){while(--_0x172618){_0xbd9aa1['push'](_0xbd9aa1['shift']());}};_0x1484e5(++_0x220cad);}(_0x2542,0x169));var _0x2254=function(_0x3aded2,_0x32eebe){_0x3aded2=_0x3aded2-0x0;var _0x58dc56=_0x2542[_0x3aded2];return _0x58dc56;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d9a164a..be914b0 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 _0x946b=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','update','/download_log_file','isAuthenticated'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x946b,0x1a5));var _0xb946=function(_0x2c64fe,_0x1403c5){_0x2c64fe=_0x2c64fe-0x0;var _0x16e733=_0x946b[_0x2c64fe];return _0x16e733;};'use strict';var multer=require(_0xb946('0x0'));var util=require(_0xb946('0x1'));var path=require('path');var timeout=require(_0xb946('0x2'));var express=require(_0xb946('0x3'));var router=express[_0xb946('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb946('0x5'));var interaction=require(_0xb946('0x6'));var config=require('../../config/environment');var controller=require(_0xb946('0x7'));router[_0xb946('0x8')]('/',controller[_0xb946('0x9')]);router[_0xb946('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb946('0xb')]);router[_0xb946('0x8')](_0xb946('0xc'),auth[_0xb946('0xd')](),controller['downloadLogFile']);module[_0xb946('0xe')]=router; \ No newline at end of file +var _0xc132=['../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/download_log_file','downloadLogFile','exports','multer','util','path','express','fs-extra'];(function(_0x401c42,_0xe0892b){var _0x5cbd71=function(_0x38cfa8){while(--_0x38cfa8){_0x401c42['push'](_0x401c42['shift']());}};_0x5cbd71(++_0xe0892b);}(_0xc132,0xcd));var _0x2c13=function(_0x53d418,_0x366d71){_0x53d418=_0x53d418-0x0;var _0x4dbf34=_0xc132[_0x53d418];return _0x4dbf34;};'use strict';var multer=require(_0x2c13('0x0'));var util=require(_0x2c13('0x1'));var path=require(_0x2c13('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c13('0x3'));var router=express['Router']();var fs_extra=require(_0x2c13('0x4'));var auth=require(_0x2c13('0x5'));var interaction=require(_0x2c13('0x6'));var config=require(_0x2c13('0x7'));var controller=require(_0x2c13('0x8'));router[_0x2c13('0x9')]('/',controller[_0x2c13('0xa')]);router[_0x2c13('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2c13('0x9')](_0x2c13('0xc'),auth['isAuthenticated'](),controller[_0x2c13('0xd')]);module[_0x2c13('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index c83b2ee..04cd72f 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 _0xac51=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x1f62c3,_0x1ff95b){var _0x385c1c=function(_0x1db580){while(--_0x1db580){_0x1f62c3['push'](_0x1f62c3['shift']());}};_0x385c1c(++_0x1ff95b);}(_0xac51,0xdd));var _0x1ac5=function(_0x38d8a3,_0x8d39e3){_0x38d8a3=_0x38d8a3-0x0;var _0x3726be=_0xac51[_0x38d8a3];return _0x3726be;};'use strict';var Sequelize=require(_0x1ac5('0x0'));module[_0x1ac5('0x1')]={'license':{'type':Sequelize[_0x1ac5('0x2')]},'data1':{'type':Sequelize[_0x1ac5('0x3')]},'data2':{'type':Sequelize[_0x1ac5('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x1ac5('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcdab=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0xcdab,0x147));var _0xbcda=function(_0x2375e1,_0x3d125a){_0x2375e1=_0x2375e1-0x0;var _0x2ccc7d=_0xcdab[_0x2375e1];return _0x2ccc7d;};'use strict';var Sequelize=require(_0xbcda('0x0'));module[_0xbcda('0x1')]={'license':{'type':Sequelize[_0xbcda('0x2')]},'data1':{'type':Sequelize[_0xbcda('0x3')]},'data2':{'type':Sequelize[_0xbcda('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xbcda('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 4aa261f..d5d7205 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 _0x4c6c=['index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','License','find','params','get','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','download','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','end','error','stack','name','send'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4c6c,0xfd));var _0xc4c6=function(_0x3f5ef9,_0x4dd8e8){_0x3f5ef9=_0x3f5ef9-0x0;var _0x4c41b7=_0x4c6c[_0x3f5ef9];return _0x4c41b7;};'use strict';var emlformat=require(_0xc4c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4c6('0x1'));var jsonpatch=require(_0xc4c6('0x2'));var rp=require(_0xc4c6('0x3'));var moment=require(_0xc4c6('0x4'));var BPromise=require(_0xc4c6('0x5'));var Mustache=require(_0xc4c6('0x6'));var util=require(_0xc4c6('0x7'));var path=require(_0xc4c6('0x8'));var sox=require(_0xc4c6('0x9'));var csv=require(_0xc4c6('0xa'));var ejs=require(_0xc4c6('0xb'));var fs=require('fs');var fs_extra=require(_0xc4c6('0xc'));var _=require(_0xc4c6('0xd'));var squel=require(_0xc4c6('0xe'));var crypto=require(_0xc4c6('0xf'));var jsforce=require(_0xc4c6('0x10'));var deskjs=require(_0xc4c6('0x11'));var toCsv=require(_0xc4c6('0xa'));var querystring=require(_0xc4c6('0x12'));var Papa=require('papaparse');var Redis=require(_0xc4c6('0x13'));var authService=require(_0xc4c6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc4c6('0x15'));var hardwareService=require(_0xc4c6('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc4c6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc4c6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40398d,_0x3d1794){_0x3d1794=_0x3d1794||0xcc;return function(_0x257b3c){if(_0x257b3c){return _0x40398d[_0xc4c6('0x19')](_0x3d1794);}return _0x40398d[_0xc4c6('0x1a')](_0x3d1794)['end']();};}function respondWithResult(_0x1b4dc2,_0x53d10c){_0x53d10c=_0x53d10c||0xc8;return function(_0x380906){if(_0x380906){return _0x1b4dc2[_0xc4c6('0x1a')](_0x53d10c)['json'](_0x380906);}};}function respondWithFilteredResult(_0x17420e,_0x177b25){return function(_0x3bf7b7){if(_0x3bf7b7){var _0x58bc33=typeof _0x177b25[_0xc4c6('0x1b')]===_0xc4c6('0x1c')&&typeof _0x177b25[_0xc4c6('0x1d')]==='undefined';var _0x4c95a6=_0x3bf7b7[_0xc4c6('0x1e')];var _0x4f712e=_0x58bc33?0x0:_0x177b25[_0xc4c6('0x1b')];var _0x3b2a5f=_0x58bc33?_0x3bf7b7['count']:_0x177b25[_0xc4c6('0x1b')]+_0x177b25['limit'];var _0x44437a;if(_0x3b2a5f>=_0x4c95a6){_0x3b2a5f=_0x4c95a6;_0x44437a=0xc8;}else{_0x44437a=0xce;}_0x17420e[_0xc4c6('0x1a')](_0x44437a);return _0x17420e['set']('Content-Range',_0x4f712e+'-'+_0x3b2a5f+'/'+_0x4c95a6)[_0xc4c6('0x1f')](_0x3bf7b7);}return null;};}function patchUpdates(_0x244118){return function(_0x2549de){try{jsonpatch[_0xc4c6('0x20')](_0x2549de,_0x244118,!![]);}catch(_0x5e6b89){return BPromise[_0xc4c6('0x21')](_0x5e6b89);}return _0x2549de[_0xc4c6('0x22')]();};}function saveUpdates(_0x11eb18,_0x243a8b){return function(_0x40c92d){if(_0x40c92d){return _0x40c92d[_0xc4c6('0x23')](_0x11eb18)[_0xc4c6('0x24')](function(_0x1d0093){return _0x1d0093;});}return null;};}function removeEntity(_0x2958ea,_0x4028b1){return function(_0x46cc73){if(_0x46cc73){return _0x46cc73[_0xc4c6('0x25')]()[_0xc4c6('0x24')](function(){_0x2958ea['status'](0xcc)[_0xc4c6('0x26')]();});}};}function handleEntityNotFound(_0x5e7be8,_0x48b778){return function(_0x222a81){if(!_0x222a81){_0x5e7be8[_0xc4c6('0x19')](0x194);}return _0x222a81;};}function handleError(_0x35c6c3,_0x3e0be1){_0x3e0be1=_0x3e0be1||0x1f4;return function(_0x27e1b4){logger[_0xc4c6('0x27')](_0x27e1b4[_0xc4c6('0x28')]);if(_0x27e1b4[_0xc4c6('0x29')]){delete _0x27e1b4[_0xc4c6('0x29')];}_0x35c6c3['status'](_0x3e0be1)[_0xc4c6('0x2a')](_0x27e1b4);};}var utilLicense=require(_0xc4c6('0x18'));exports[_0xc4c6('0x2b')]=function(_0x14e159,_0x2715f1){var _0x5b1890={'raw':!![],'where':{'id':0x1}},_0x4b8775={};_0x4b8775[_0xc4c6('0x2c')]=_[_0xc4c6('0x2d')](db['License'][_0xc4c6('0x2e')]);_0x4b8775['query']=_[_0xc4c6('0x2d')](_0x14e159[_0xc4c6('0x2f')]);_0x4b8775[_0xc4c6('0x30')]=_[_0xc4c6('0x31')](_0x4b8775[_0xc4c6('0x2c')],_0x4b8775[_0xc4c6('0x2f')]);_0x5b1890[_0xc4c6('0x32')]=_['intersection'](_0x4b8775[_0xc4c6('0x2c')],qs[_0xc4c6('0x33')](_0x14e159[_0xc4c6('0x2f')][_0xc4c6('0x33')]));_0x5b1890['attributes']=_0x5b1890['attributes'][_0xc4c6('0x34')]?_0x5b1890[_0xc4c6('0x32')]:_0x4b8775['model'];_0x5b1890=_[_0xc4c6('0x35')]({},_0x5b1890,_0x14e159[_0xc4c6('0x36')]);return utilLicense[_0xc4c6('0x37')](_0x5b1890)[_0xc4c6('0x24')](respondWithResult(_0x2715f1,null))[_0xc4c6('0x38')](handleError(_0x2715f1,null));};exports[_0xc4c6('0x23')]=function(_0x4d46d3,_0x3655b9){if(_0x4d46d3['body']['id']){delete _0x4d46d3['body']['id'];}return db[_0xc4c6('0x39')][_0xc4c6('0x3a')]({'where':{'id':_0x4d46d3[_0xc4c6('0x3b')]['id']}})[_0xc4c6('0x24')](handleEntityNotFound(_0x3655b9,null))[_0xc4c6('0x24')](function(_0x190c8c){var _0x2fce10=_0x190c8c[_0xc4c6('0x3c')]({'plain':!![]});return utilLicense['checkLicense'](_0x2fce10,_0x4d46d3['body'][_0xc4c6('0x3d')]);})['then'](function(_0x5e6425){if(!_0x5e6425[_0xc4c6('0x3e')]){return saveUpdates(_0x4d46d3['body'],null);}return _0x5e6425;})[_0xc4c6('0x24')](respondWithResult(_0x3655b9,null))['catch'](handleError(_0x3655b9,null));};exports[_0xc4c6('0x3f')]=function(_0x268c7c,_0x387158){var _0x366927=_0xc4c6('0x40');var _0x2f4e5c=path[_0xc4c6('0x41')](_0xc4c6('0x42'),_0xc4c6('0x43'),'xcally',_0x366927);_0x387158[_0xc4c6('0x44')](_0xc4c6('0x45'),_0xc4c6('0x46')+_0x366927);_0x387158[_0xc4c6('0x47')](_0xc4c6('0x48'),'text/plain');_0x387158[_0xc4c6('0x49')](_0x2f4e5c);}; \ No newline at end of file +var _0xefe5=['../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','stack','name','send','../../config/license/util','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','options','getLicense','body','find','get','key','demo','catch','downloadLogFile','license-info.log','join','/var','xcally','Content-disposition','attachment;\x20filename=','Content-Type','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x51b60e,_0x20619e){var _0x2927fd=function(_0x1ff233){while(--_0x1ff233){_0x51b60e['push'](_0x51b60e['shift']());}};_0x2927fd(++_0x20619e);}(_0xefe5,0xf6));var _0x5efe=function(_0x4e1078,_0x24a9dd){_0x4e1078=_0x4e1078-0x0;var _0xb795fe=_0xefe5[_0x4e1078];return _0xb795fe;};'use strict';var emlformat=require(_0x5efe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5efe('0x1'));var jsonpatch=require(_0x5efe('0x2'));var rp=require('request-promise');var moment=require(_0x5efe('0x3'));var BPromise=require(_0x5efe('0x4'));var Mustache=require('mustache');var util=require(_0x5efe('0x5'));var path=require('path');var sox=require(_0x5efe('0x6'));var csv=require(_0x5efe('0x7'));var ejs=require(_0x5efe('0x8'));var fs=require('fs');var fs_extra=require(_0x5efe('0x9'));var _=require(_0x5efe('0xa'));var squel=require('squel');var crypto=require(_0x5efe('0xb'));var jsforce=require(_0x5efe('0xc'));var deskjs=require(_0x5efe('0xd'));var toCsv=require(_0x5efe('0x7'));var querystring=require(_0x5efe('0xe'));var Papa=require(_0x5efe('0xf'));var Redis=require(_0x5efe('0x10'));var authService=require(_0x5efe('0x11'));var qs=require(_0x5efe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5efe('0x13'));var logger=require(_0x5efe('0x14'))(_0x5efe('0x15'));var utils=require(_0x5efe('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e896f,_0x2fe866){_0x2fe866=_0x2fe866||0xcc;return function(_0x1b99c6){if(_0x1b99c6){return _0x3e896f[_0x5efe('0x17')](_0x2fe866);}return _0x3e896f[_0x5efe('0x18')](_0x2fe866)[_0x5efe('0x19')]();};}function respondWithResult(_0xe2d9e8,_0x362781){_0x362781=_0x362781||0xc8;return function(_0x31bfd8){if(_0x31bfd8){return _0xe2d9e8[_0x5efe('0x18')](_0x362781)[_0x5efe('0x1a')](_0x31bfd8);}};}function respondWithFilteredResult(_0x5041a8,_0x28036d){return function(_0xe69cfa){if(_0xe69cfa){var _0x649b61=typeof _0x28036d[_0x5efe('0x1b')]==='undefined'&&typeof _0x28036d[_0x5efe('0x1c')]===_0x5efe('0x1d');var _0x502784=_0xe69cfa[_0x5efe('0x1e')];var _0x1c9d47=_0x649b61?0x0:_0x28036d['offset'];var _0x50351d=_0x649b61?_0xe69cfa[_0x5efe('0x1e')]:_0x28036d['offset']+_0x28036d['limit'];var _0x1461a3;if(_0x50351d>=_0x502784){_0x50351d=_0x502784;_0x1461a3=0xc8;}else{_0x1461a3=0xce;}_0x5041a8[_0x5efe('0x18')](_0x1461a3);return _0x5041a8[_0x5efe('0x1f')](_0x5efe('0x20'),_0x1c9d47+'-'+_0x50351d+'/'+_0x502784)['json'](_0xe69cfa);}return null;};}function patchUpdates(_0x47e03b){return function(_0x1f1ef9){try{jsonpatch[_0x5efe('0x21')](_0x1f1ef9,_0x47e03b,!![]);}catch(_0x40c7c7){return BPromise[_0x5efe('0x22')](_0x40c7c7);}return _0x1f1ef9[_0x5efe('0x23')]();};}function saveUpdates(_0x5d880c,_0x11b770){return function(_0x5e6f9f){if(_0x5e6f9f){return _0x5e6f9f['update'](_0x5d880c)[_0x5efe('0x24')](function(_0x58b0cf){return _0x58b0cf;});}return null;};}function removeEntity(_0x3ddd67,_0x3e035c){return function(_0x21e9da){if(_0x21e9da){return _0x21e9da['destroy']()[_0x5efe('0x24')](function(){_0x3ddd67['status'](0xcc)[_0x5efe('0x19')]();});}};}function handleEntityNotFound(_0x1a2754,_0x394344){return function(_0x4560fb){if(!_0x4560fb){_0x1a2754[_0x5efe('0x17')](0x194);}return _0x4560fb;};}function handleError(_0x377c9a,_0x442c34){_0x442c34=_0x442c34||0x1f4;return function(_0x42dc9c){logger['error'](_0x42dc9c[_0x5efe('0x25')]);if(_0x42dc9c[_0x5efe('0x26')]){delete _0x42dc9c['name'];}_0x377c9a[_0x5efe('0x18')](_0x442c34)[_0x5efe('0x27')](_0x42dc9c);};}var utilLicense=require(_0x5efe('0x28'));exports['index']=function(_0x14b530,_0x4aeac7){var _0x23e796={'raw':!![],'where':{'id':0x1}},_0x48fca8={};_0x48fca8[_0x5efe('0x29')]=_[_0x5efe('0x2a')](db[_0x5efe('0x2b')][_0x5efe('0x2c')]);_0x48fca8[_0x5efe('0x2d')]=_['keys'](_0x14b530['query']);_0x48fca8[_0x5efe('0x2e')]=_['intersection'](_0x48fca8[_0x5efe('0x29')],_0x48fca8['query']);_0x23e796[_0x5efe('0x2f')]=_[_0x5efe('0x30')](_0x48fca8[_0x5efe('0x29')],qs[_0x5efe('0x31')](_0x14b530[_0x5efe('0x2d')][_0x5efe('0x31')]));_0x23e796['attributes']=_0x23e796[_0x5efe('0x2f')]['length']?_0x23e796[_0x5efe('0x2f')]:_0x48fca8[_0x5efe('0x29')];_0x23e796=_['merge']({},_0x23e796,_0x14b530[_0x5efe('0x32')]);return utilLicense[_0x5efe('0x33')](_0x23e796)[_0x5efe('0x24')](respondWithResult(_0x4aeac7,null))['catch'](handleError(_0x4aeac7,null));};exports['update']=function(_0x3aea2b,_0xda61a8){if(_0x3aea2b['body']['id']){delete _0x3aea2b[_0x5efe('0x34')]['id'];}return db[_0x5efe('0x2b')][_0x5efe('0x35')]({'where':{'id':_0x3aea2b['params']['id']}})[_0x5efe('0x24')](handleEntityNotFound(_0xda61a8,null))[_0x5efe('0x24')](function(_0x4583cb){var _0x5f1d33=_0x4583cb[_0x5efe('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x5f1d33,_0x3aea2b['body'][_0x5efe('0x37')]);})[_0x5efe('0x24')](function(_0x4cd895){if(!_0x4cd895[_0x5efe('0x38')]){return saveUpdates(_0x3aea2b[_0x5efe('0x34')],null);}return _0x4cd895;})[_0x5efe('0x24')](respondWithResult(_0xda61a8,null))[_0x5efe('0x39')](handleError(_0xda61a8,null));};exports[_0x5efe('0x3a')]=function(_0x51698c,_0x4c7d1b){var _0x7c5a79=_0x5efe('0x3b');var _0x1e5d5b=path[_0x5efe('0x3c')](_0x5efe('0x3d'),'log',_0x5efe('0x3e'),_0x7c5a79);_0x4c7d1b['setHeader'](_0x5efe('0x3f'),_0x5efe('0x40')+_0x7c5a79);_0x4c7d1b[_0x5efe('0x1f')](_0x5efe('0x41'),'text/plain');_0x4c7d1b[_0x5efe('0x42')](_0x1e5d5b);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 22c2df0..47c5c87 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 _0xdd0d=['../../config/logger','moment','bluebird','path','../../config/environment','./license.attributes','define','License','lodash','util'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0xdd0d,0x1c0));var _0xddd0=function(_0x11e90b,_0x3ec29a){_0x11e90b=_0x11e90b-0x0;var _0x31452e=_0xdd0d[_0x11e90b];return _0x31452e;};'use strict';var _=require(_0xddd0('0x0'));var util=require(_0xddd0('0x1'));var logger=require(_0xddd0('0x2'))('api');var moment=require(_0xddd0('0x3'));var BPromise=require(_0xddd0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddd0('0x5'));var rimraf=require('rimraf');var config=require(_0xddd0('0x6'));var attributes=require(_0xddd0('0x7'));module['exports']=function(_0x2f13e8,_0x4ef62a){return _0x2f13e8[_0xddd0('0x8')](_0xddd0('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa64d=['exports','License','../../config/logger','moment','request-promise','path','rimraf','./license.attributes'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xa64d,0xa2));var _0xda64=function(_0xcc22ef,_0x410e8d){_0xcc22ef=_0xcc22ef-0x0;var _0x3382f7=_0xa64d[_0xcc22ef];return _0x3382f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xda64('0x0'))('api');var moment=require(_0xda64('0x1'));var BPromise=require('bluebird');var rp=require(_0xda64('0x2'));var fs=require('fs');var path=require(_0xda64('0x3'));var rimraf=require(_0xda64('0x4'));var config=require('../../config/environment');var attributes=require(_0xda64('0x5'));module[_0xda64('0x6')]=function(_0x228143,_0x247f3d){return _0x228143['define'](_0xda64('0x7'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index c956fcc..bf2831b 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 _0x76e2=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','License,\x20%s,\x20%s','message','request\x20sent','result','catch'];(function(_0x1a27ae,_0x51b59f){var _0x24d981=function(_0x560a56){while(--_0x560a56){_0x1a27ae['push'](_0x1a27ae['shift']());}};_0x24d981(++_0x51b59f);}(_0x76e2,0x1b8));var _0x276e=function(_0x17cded,_0xa51b6b){_0x17cded=_0x17cded-0x0;var _0x41b11f=_0x76e2[_0x17cded];return _0x41b11f;};'use strict';var _=require(_0x276e('0x0'));var util=require(_0x276e('0x1'));var moment=require(_0x276e('0x2'));var BPromise=require('bluebird');var rs=require(_0x276e('0x3'));var fs=require('fs');var Redis=require(_0x276e('0x4'));var db=require(_0x276e('0x5'))['db'];var utils=require(_0x276e('0x6'));var logger=require('../../config/logger')(_0x276e('0x7'));var config=require(_0x276e('0x8'));var jayson=require(_0x276e('0x9'));var client=jayson[_0x276e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33b6dd,_0xecd438,_0x3dfaa6){return new BPromise(function(_0x49bcef,_0x216ca6){return client[_0x276e('0xb')](_0x33b6dd,_0x3dfaa6)['then'](function(_0x1fd9ec){logger[_0x276e('0xc')]('License,\x20%s,\x20%s',_0xecd438,'request\x20sent');logger[_0x276e('0xd')](_0x276e('0xe'),_0xecd438,'request\x20sent',JSON[_0x276e('0xf')](_0x1fd9ec));if(_0x1fd9ec[_0x276e('0x10')]){if(_0x1fd9ec[_0x276e('0x10')]['code']===0x1f4){logger[_0x276e('0x10')](_0x276e('0x11'),_0xecd438,_0x1fd9ec[_0x276e('0x10')]['message']);return _0x216ca6(_0x1fd9ec[_0x276e('0x10')]['message']);}logger[_0x276e('0x10')](_0x276e('0x11'),_0xecd438,_0x1fd9ec['error']['message']);return _0x49bcef(_0x1fd9ec[_0x276e('0x10')][_0x276e('0x12')]);}else{logger[_0x276e('0xc')]('License,\x20%s,\x20%s',_0xecd438,_0x276e('0x13'));_0x49bcef(_0x1fd9ec[_0x276e('0x14')]['message']);}})[_0x276e('0x15')](function(_0xd6ee80){logger[_0x276e('0x10')](_0x276e('0x11'),_0xecd438,_0xd6ee80);_0x216ca6(_0xd6ee80);});});} \ No newline at end of file +var _0xd483=['catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x262cd6,_0x403a1c){var _0x49eb63=function(_0x1f0ba6){while(--_0x1f0ba6){_0x262cd6['push'](_0x262cd6['shift']());}};_0x49eb63(++_0x403a1c);}(_0xd483,0x144));var _0x3d48=function(_0x5a7d1f,_0x4f2142){_0x5a7d1f=_0x5a7d1f-0x0;var _0x21ba11=_0xd483[_0x5a7d1f];return _0x21ba11;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3d48('0x0'));var rs=require(_0x3d48('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d48('0x2'))['db'];var utils=require(_0x3d48('0x3'));var logger=require(_0x3d48('0x4'))(_0x3d48('0x5'));var config=require(_0x3d48('0x6'));var jayson=require(_0x3d48('0x7'));var client=jayson[_0x3d48('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xec3f25,_0xfe8f98,_0x48b5b8){return new BPromise(function(_0x59bc8c,_0x1bd3fd){return client[_0x3d48('0x9')](_0xec3f25,_0x48b5b8)[_0x3d48('0xa')](function(_0x48883e){logger['info'](_0x3d48('0xb'),_0xfe8f98,_0x3d48('0xc'));logger[_0x3d48('0xd')]('License,\x20%s,\x20%s,\x20%s',_0xfe8f98,_0x3d48('0xc'),JSON[_0x3d48('0xe')](_0x48883e));if(_0x48883e['error']){if(_0x48883e[_0x3d48('0xf')][_0x3d48('0x10')]===0x1f4){logger[_0x3d48('0xf')]('License,\x20%s,\x20%s',_0xfe8f98,_0x48883e[_0x3d48('0xf')][_0x3d48('0x11')]);return _0x1bd3fd(_0x48883e[_0x3d48('0xf')][_0x3d48('0x11')]);}logger[_0x3d48('0xf')](_0x3d48('0xb'),_0xfe8f98,_0x48883e[_0x3d48('0xf')][_0x3d48('0x11')]);return _0x59bc8c(_0x48883e[_0x3d48('0xf')][_0x3d48('0x11')]);}else{logger['info'](_0x3d48('0xb'),_0xfe8f98,'request\x20sent');_0x59bc8c(_0x48883e['result']['message']);}})[_0x3d48('0x12')](function(_0x1e1cc5){logger['error']('License,\x20%s,\x20%s',_0xfe8f98,_0x1e1cc5);_0x1bd3fd(_0x1e1cc5);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index bf52613..ffec56c 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 _0x95d8=['getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','/:id/dispositions','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x2cfc4e,_0x155bd9){var _0x4788ac=function(_0x9c86ba){while(--_0x9c86ba){_0x2cfc4e['push'](_0x2cfc4e['shift']());}};_0x4788ac(++_0x155bd9);}(_0x95d8,0x1a9));var _0x895d=function(_0xe326ba,_0x4ec618){_0xe326ba=_0xe326ba-0x0;var _0x2cb944=_0x95d8[_0xe326ba];return _0x2cb944;};'use strict';var multer=require(_0x895d('0x0'));var util=require(_0x895d('0x1'));var path=require(_0x895d('0x2'));var timeout=require(_0x895d('0x3'));var express=require('express');var router=express[_0x895d('0x4')]();var fs_extra=require(_0x895d('0x5'));var auth=require(_0x895d('0x6'));var interaction=require(_0x895d('0x7'));var config=require(_0x895d('0x8'));var controller=require(_0x895d('0x9'));router['get']('/',auth[_0x895d('0xa')](),controller[_0x895d('0xb')]);router[_0x895d('0xc')]('/describe',auth[_0x895d('0xa')](),controller[_0x895d('0xd')]);router[_0x895d('0xc')](_0x895d('0xe'),auth[_0x895d('0xa')](),controller[_0x895d('0xf')]);router[_0x895d('0xc')]('/:id/dispositions',auth[_0x895d('0xa')](),controller[_0x895d('0x10')]);router['get'](_0x895d('0x11'),auth[_0x895d('0xa')](),controller[_0x895d('0x12')]);router[_0x895d('0xc')](_0x895d('0x13'),auth[_0x895d('0xa')](),controller[_0x895d('0x14')]);router[_0x895d('0xc')]('/:id/out_servers',auth[_0x895d('0xa')](),controller['getSmtp']);router['get'](_0x895d('0x15'),auth[_0x895d('0xa')](),controller['getInteractions']);router['get'](_0x895d('0x16'),auth['isAuthenticated'](),controller[_0x895d('0x17')]);router['get'](_0x895d('0x18'),auth[_0x895d('0xa')](),controller[_0x895d('0x19')]);router[_0x895d('0xc')](_0x895d('0x1a'),auth[_0x895d('0xa')](),controller[_0x895d('0x1b')]);router[_0x895d('0xc')]('/:id/users',auth['isAuthenticated'](),controller[_0x895d('0x1c')]);router[_0x895d('0x1d')](_0x895d('0x1e'),auth[_0x895d('0xa')](),controller['addDisposition']);router['post'](_0x895d('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x895d('0x1d')]('/',auth[_0x895d('0xa')](),controller[_0x895d('0x1f')]);router[_0x895d('0x1d')]('/:id/in_servers',auth[_0x895d('0xa')](),controller[_0x895d('0x20')]);router[_0x895d('0x1d')](_0x895d('0x21'),auth[_0x895d('0xa')](),controller[_0x895d('0x22')]);router[_0x895d('0x1d')](_0x895d('0x15'),auth[_0x895d('0xa')](),controller[_0x895d('0x23')]);router['post'](_0x895d('0x16'),auth[_0x895d('0xa')](),controller[_0x895d('0x24')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x895d('0x25')]);router['post'](_0x895d('0x26'),auth[_0x895d('0xa')](),controller['addAgents']);router[_0x895d('0x27')](_0x895d('0xe'),auth[_0x895d('0xa')](),controller[_0x895d('0x28')]);router[_0x895d('0x29')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x895d('0x2a')]);router[_0x895d('0x29')]('/:id/canned_answers',auth[_0x895d('0xa')](),controller[_0x895d('0x2b')]);router[_0x895d('0x29')](_0x895d('0x13'),auth[_0x895d('0xa')](),controller[_0x895d('0x2c')]);router['delete'](_0x895d('0x21'),auth[_0x895d('0xa')](),controller[_0x895d('0x2d')]);router[_0x895d('0x29')](_0x895d('0xe'),auth[_0x895d('0xa')](),controller[_0x895d('0x2e')]);router['delete'](_0x895d('0x26'),auth[_0x895d('0xa')](),controller[_0x895d('0x2f')]);module[_0x895d('0x30')]=router; \ No newline at end of file +var _0xc7e0=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addInteraction','/:id/applications','addApplications','/:id/send','put','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports'];(function(_0x34a9c1,_0x5d39a0){var _0x192963=function(_0x3749b2){while(--_0x3749b2){_0x34a9c1['push'](_0x34a9c1['shift']());}};_0x192963(++_0x5d39a0);}(_0xc7e0,0xf5));var _0x0c7e=function(_0x12b15f,_0x2b6040){_0x12b15f=_0x12b15f-0x0;var _0x1adc10=_0xc7e0[_0x12b15f];return _0x1adc10;};'use strict';var multer=require(_0x0c7e('0x0'));var util=require(_0x0c7e('0x1'));var path=require(_0x0c7e('0x2'));var timeout=require(_0x0c7e('0x3'));var express=require('express');var router=express[_0x0c7e('0x4')]();var fs_extra=require(_0x0c7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0c7e('0x6'));var config=require(_0x0c7e('0x7'));var controller=require(_0x0c7e('0x8'));router[_0x0c7e('0x9')]('/',auth[_0x0c7e('0xa')](),controller[_0x0c7e('0xb')]);router['get'](_0x0c7e('0xc'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0xd')]);router[_0x0c7e('0x9')](_0x0c7e('0xe'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0xf')]);router[_0x0c7e('0x9')](_0x0c7e('0x10'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x11')]);router[_0x0c7e('0x9')](_0x0c7e('0x12'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x13')]);router[_0x0c7e('0x9')](_0x0c7e('0x14'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x15')]);router[_0x0c7e('0x9')]('/:id/out_servers',auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x16')]);router['get'](_0x0c7e('0x17'),auth['isAuthenticated'](),controller[_0x0c7e('0x18')]);router[_0x0c7e('0x9')]('/:id/applications',auth[_0x0c7e('0xa')](),controller['getApplications']);router[_0x0c7e('0x9')](_0x0c7e('0x19'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x1a')]);router[_0x0c7e('0x9')](_0x0c7e('0x1b'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x1c')]);router[_0x0c7e('0x9')](_0x0c7e('0x1d'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0c7e('0x1e')](_0x0c7e('0x10'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x1f')]);router[_0x0c7e('0x1e')]('/:id/canned_answers',auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x20')]);router['post']('/',auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x21')]);router[_0x0c7e('0x1e')](_0x0c7e('0x14'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x22')]);router[_0x0c7e('0x1e')](_0x0c7e('0x23'),auth[_0x0c7e('0xa')](),controller['addSmtp']);router['post'](_0x0c7e('0x17'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x24')]);router[_0x0c7e('0x1e')](_0x0c7e('0x25'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x26')]);router['post'](_0x0c7e('0x27'),auth['isAuthenticated'](),controller['send']);router[_0x0c7e('0x1e')](_0x0c7e('0x1d'),auth[_0x0c7e('0xa')](),controller['addAgents']);router[_0x0c7e('0x28')](_0x0c7e('0xe'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x29')]);router[_0x0c7e('0x2a')](_0x0c7e('0x10'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x2b')]);router[_0x0c7e('0x2a')](_0x0c7e('0x12'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x2c')]);router[_0x0c7e('0x2a')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0c7e('0x2d')]);router[_0x0c7e('0x2a')](_0x0c7e('0x23'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x0c7e('0x2a')](_0x0c7e('0xe'),auth[_0x0c7e('0xa')](),controller[_0x0c7e('0x2e')]);router[_0x0c7e('0x2a')](_0x0c7e('0x1d'),auth['isAuthenticated'](),controller[_0x0c7e('0x2f')]);module[_0x0c7e('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 83482ca..ab23b69 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 _0x733b=['sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','provider','custom'];(function(_0x3b227c,_0x517e67){var _0x64ccad=function(_0x197e4c){while(--_0x197e4c){_0x3b227c['push'](_0x3b227c['shift']());}};_0x64ccad(++_0x517e67);}(_0x733b,0x1a2));var _0xb733=function(_0x2ffe92,_0x5a2f02){_0x2ffe92=_0x2ffe92-0x0;var _0x3aeb9f=_0x733b[_0x2ffe92];return _0x3aeb9f;};'use strict';var Sequelize=require(_0xb733('0x0'));module[_0xb733('0x1')]={'description':{'type':Sequelize[_0xb733('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xb733('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xb733('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb733('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xb733('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb733('0x4')},'fontSize':{'type':Sequelize[_0xb733('0x5')](0x2)[_0xb733('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb733('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb733('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb733('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb733('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb733('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb733('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb733('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xb733('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xb733('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x682773){if(!_0x682773)this[_0xb733('0x9')](_0xb733('0xa'),null);this[_0xb733('0x9')](_0xb733('0xb'),_0x682773);}},'provider':{'type':Sequelize[_0xb733('0xc')](_0xb733('0xd'),_0xb733('0xe'),_0xb733('0xf'),_0xb733('0x10')),'defaultValue':null,'get':function(){var _0x2b3cfb=this['getDataValue'](_0xb733('0x11'));return _0x2b3cfb||_0xb733('0x12');},'set':function(_0xe61835){if(_0xe61835===_0xb733('0x12')){_0xe61835=null;}return this[_0xb733('0x9')](_0xb733('0x11'),_0xe61835);}}}; \ No newline at end of file +var _0xbfbd=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','custom','provider','STRING','BOOLEAN','TEXT'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0xbfbd,0x184));var _0xdbfb=function(_0x29b0d1,_0x1c8581){_0x29b0d1=_0x29b0d1-0x0;var _0x1da980=_0xbfbd[_0x29b0d1];return _0x1da980;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xdbfb('0x0')]},'name':{'type':Sequelize[_0xdbfb('0x0')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xdbfb('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdbfb('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0xdbfb('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0xdbfb('0x2')]},'markAsUnread':{'type':Sequelize[_0xdbfb('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdbfb('0x0')],'allowNull':![],'defaultValue':_0xdbfb('0x3')},'fontSize':{'type':Sequelize[_0xdbfb('0x4')](0x2)[_0xdbfb('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xdbfb('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdbfb('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdbfb('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdbfb('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdbfb('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdbfb('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdbfb('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdbfb('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xdbfb('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xdbfb('0x1')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x362a2f){if(!_0x362a2f)this[_0xdbfb('0x7')](_0xdbfb('0x8'),null);this[_0xdbfb('0x7')]('mandatoryDisposition',_0x362a2f);}},'provider':{'type':Sequelize[_0xdbfb('0x9')](_0xdbfb('0xa'),_0xdbfb('0xb'),_0xdbfb('0xc'),_0xdbfb('0xd')),'defaultValue':null,'get':function(){var _0x5ce025=this[_0xdbfb('0xe')]('provider');return _0x5ce025||_0xdbfb('0xf');},'set':function(_0x13a497){if(_0x13a497===_0xdbfb('0xf')){_0x13a497=null;}return this[_0xdbfb('0x7')](_0xdbfb('0x10'),_0x13a497);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 65248e7..42d2b75 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 _0xd0fa=['rawAttributes','include','body','provider','custom','find','Mail\x20Account\x20not\x20found','addDisposition','MailAccountId','Disposition','create','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','DESC','CloudProvider','isNil','from','%s\x20<%s>','attachments','join','getSmtpOptions','SendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','count','limit','set','update','destroy','get','MailAccounts','UserProfileResource','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','type','filter','options','includeAll','rows','show','params'];(function(_0x416468,_0x2e7a72){var _0x2ee9b7=function(_0xf354ce){while(--_0xf354ce){_0x416468['push'](_0x416468['shift']());}};_0x2ee9b7(++_0x2e7a72);}(_0xd0fa,0x11c));var _0xad0f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd0fa[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0xad0f('0x0'));var BPromise=require(_0xad0f('0x1'));var util=require('util');var path=require(_0xad0f('0x2'));var _=require(_0xad0f('0x3'));var juice=require(_0xad0f('0x4'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xad0f('0x5'))(_0xad0f('0x6'));var config=require(_0xad0f('0x7'));var db=require(_0xad0f('0x8'))['db'];config[_0xad0f('0x9')]=_[_0xad0f('0xa')](config[_0xad0f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xad0f('0xb'))(new Redis(config[_0xad0f('0x9')]));require('./mailAccount.socket')[_0xad0f('0xc')](socket);var jayson=require(_0xad0f('0xd'));var client=jayson[_0xad0f('0xe')][_0xad0f('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x482b41,_0x23d512,_0x4f6622,_0x57e1d6){return new BPromise(function(_0xbe36a3,_0x45d395){var _0xaf6454=_0x57e1d6||client;return _0xaf6454['request'](_0x482b41,_0x4f6622)[_0xad0f('0x10')](function(_0x5f5673){logger[_0xad0f('0x11')](_0xad0f('0x12'),_0x23d512,_0xad0f('0x13'));logger[_0xad0f('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x23d512,_0xad0f('0x13'),JSON['stringify'](_0x5f5673));if(_0x5f5673['error']){if(_0x5f5673[_0xad0f('0x15')][_0xad0f('0x16')]===0x1f4){logger[_0xad0f('0x15')]('MailAccount,\x20%s,\x20%s',_0x23d512,_0x5f5673[_0xad0f('0x15')][_0xad0f('0x17')]);return _0x45d395(_0x5f5673[_0xad0f('0x15')][_0xad0f('0x17')]);}logger['error'](_0xad0f('0x12'),_0x23d512,_0x5f5673[_0xad0f('0x15')][_0xad0f('0x17')]);return _0xbe36a3(_0x5f5673[_0xad0f('0x15')][_0xad0f('0x17')]);}else{logger[_0xad0f('0x11')](_0xad0f('0x12'),_0x23d512,_0xad0f('0x13'));_0xbe36a3(_0x5f5673[_0xad0f('0x18')][_0xad0f('0x17')]);}})[_0xad0f('0x19')](function(_0xc17090){logger['error']('MailAccount,\x20%s,\x20%s',_0x23d512,_0xc17090);_0x45d395(_0xc17090);});});}function respondWithStatusCode(_0x15bcb9,_0x317a4d){_0x317a4d=_0x317a4d||0xcc;return function(_0x4e8f5d){if(_0x4e8f5d){return _0x15bcb9[_0xad0f('0x1a')](_0x317a4d);}return _0x15bcb9[_0xad0f('0x1b')](_0x317a4d)[_0xad0f('0x1c')]();};}function respondWithResult(_0x55ddaa,_0x7743f1){_0x7743f1=_0x7743f1||0xc8;return function(_0x55c234){if(_0x55c234){return _0x55ddaa[_0xad0f('0x1b')](_0x7743f1)[_0xad0f('0x1d')](_0x55c234);}};}function respondWithFilteredResult(_0x4835e9,_0x4169d8){return function(_0x4c3913){if(_0x4c3913){var _0x1a16ae=typeof _0x4169d8[_0xad0f('0x1e')]==='undefined'&&typeof _0x4169d8['limit']==='undefined';var _0x28dc8d=_0x4c3913[_0xad0f('0x1f')];var _0xf9f43d=_0x1a16ae?0x0:_0x4169d8[_0xad0f('0x1e')];var _0x2e804d=_0x1a16ae?_0x4c3913[_0xad0f('0x1f')]:_0x4169d8[_0xad0f('0x1e')]+_0x4169d8[_0xad0f('0x20')];var _0x34c6f8;if(_0x2e804d>=_0x28dc8d){_0x2e804d=_0x28dc8d;_0x34c6f8=0xc8;}else{_0x34c6f8=0xce;}_0x4835e9[_0xad0f('0x1b')](_0x34c6f8);return _0x4835e9[_0xad0f('0x21')]('Content-Range',_0xf9f43d+'-'+_0x2e804d+'/'+_0x28dc8d)[_0xad0f('0x1d')](_0x4c3913);}return null;};}function saveUpdates(_0x26112d){return function(_0x2da2d7){if(_0x2da2d7){return _0x2da2d7[_0xad0f('0x22')](_0x26112d)[_0xad0f('0x10')](function(_0x15fe7a){return _0x15fe7a;});}return null;};}function removeEntity(_0x586b36){return function(_0xeca4a){if(_0xeca4a){return _0xeca4a[_0xad0f('0x23')]()['then'](function(){var _0x4f7087=_0xeca4a[_0xad0f('0x24')]({'plain':!![]});var _0x5b11c1=_0xad0f('0x25');return db[_0xad0f('0x26')][_0xad0f('0x23')]({'where':{'type':_0x5b11c1,'resourceId':_0x4f7087['id']}})[_0xad0f('0x10')](function(){return _0xeca4a;});})[_0xad0f('0x10')](function(){_0x586b36[_0xad0f('0x1b')](0xcc)[_0xad0f('0x1c')]();});}};}function handleEntityNotFound(_0x4d4e14){return function(_0x1f3b58){if(!_0x1f3b58){_0x4d4e14[_0xad0f('0x1a')](0x194);}return _0x1f3b58;};}function handleError(_0x3a0c23,_0x2c21d5){_0x2c21d5=_0x2c21d5||0x1f4;return function(_0x23ceb2){logger[_0xad0f('0x15')](_0x23ceb2['stack']);if(_0x23ceb2['name']){delete _0x23ceb2['name'];}_0x3a0c23[_0xad0f('0x1b')](_0x2c21d5)[_0xad0f('0x27')](_0x23ceb2);};}function getImapHost(_0x839f56){switch(_0x839f56){case _0xad0f('0x28'):return _0xad0f('0x29');case _0xad0f('0x2a'):return _0xad0f('0x2b');case'hotmail':return'imap-mail.outlook.com';case'outlook365':return _0xad0f('0x2c');}throw new Error(_0xad0f('0x2d'),_0x839f56);}function getSmtpHost(_0x16555e){switch(_0x16555e){case _0xad0f('0x28'):return _0xad0f('0x2e');case _0xad0f('0x2a'):return _0xad0f('0x2f');case'hotmail':return _0xad0f('0x30');case _0xad0f('0x31'):return _0xad0f('0x32');}throw new Error(_0xad0f('0x2d'),_0x16555e);}function getAuthenticationOptions(_0x53ce88,_0x3b4d39){var _0x54a24e={};var _0x46d901={};if(_0x53ce88){_0x54a24e[_0xad0f('0x33')]=_0x46d901[_0xad0f('0x33')]=_0x3b4d39[_0xad0f('0x34')];_0x54a24e[_0xad0f('0x35')]=_0x46d901[_0xad0f('0x36')]=_0x3b4d39[_0xad0f('0x35')];if(_0x3b4d39['modernAuthentication']){_0x54a24e[_0xad0f('0x37')]=_0x46d901[_0xad0f('0x37')]=!![];_0x54a24e['CloudProviderId']=_0x46d901[_0xad0f('0x38')]=_0x3b4d39[_0xad0f('0x38')];_0x54a24e[_0xad0f('0x35')]=_0x46d901[_0xad0f('0x36')]=null;}else{_0x54a24e[_0xad0f('0x38')]=_0x46d901[_0xad0f('0x38')]=null;}_0x54a24e[_0xad0f('0x39')]=getImapHost(_0x53ce88);_0x54a24e[_0xad0f('0x3a')]=0x3e1;_0x46d901[_0xad0f('0x39')]=getSmtpHost(_0x53ce88);_0x46d901[_0xad0f('0x3a')]=0x24b;_0x46d901[_0xad0f('0x3b')]=![];_0x54a24e[_0xad0f('0x3c')]=_0x46d901[_0xad0f('0x3c')]=null;}else{if(_0x3b4d39[_0xad0f('0x3d')]){_0x54a24e[_0xad0f('0x33')]=_0x46d901[_0xad0f('0x33')]=_0x3b4d39[_0xad0f('0x34')];_0x54a24e['password']=_0x46d901[_0xad0f('0x36')]=_0x3b4d39[_0xad0f('0x35')];}else{_0x54a24e[_0xad0f('0x3d')]=_0x46d901[_0xad0f('0x3d')]=![];_0x54a24e[_0xad0f('0x33')]=_0x46d901[_0xad0f('0x33')]=null;_0x54a24e['password']=_0x46d901[_0xad0f('0x36')]=null;}_0x54a24e['host']=_0x3b4d39[_0xad0f('0x3e')]['host'];_0x54a24e[_0xad0f('0x3a')]=_0x3b4d39[_0xad0f('0x3e')][_0xad0f('0x3a')];_0x46d901[_0xad0f('0x39')]=_0x3b4d39[_0xad0f('0x3f')][_0xad0f('0x39')];_0x46d901[_0xad0f('0x3a')]=_0x3b4d39['Smtp'][_0xad0f('0x3a')];}return{'Imap':_0x54a24e,'Smtp':_0x46d901};}exports[_0xad0f('0x40')]=function(_0x2133d1,_0xac5ffe){var _0x4e237b={'include':[{'model':db[_0xad0f('0x41')],'as':_0xad0f('0x3e')},{'model':db[_0xad0f('0x42')],'as':_0xad0f('0x3f')},{'model':db[_0xad0f('0x43')],'as':_0xad0f('0x44')}]},_0x1d75a5={},_0x20607b={'count':0x0,'rows':[]};var _0x1e5856=_['map'](db[_0xad0f('0x45')]['rawAttributes'],function(_0x1a9b9e){return{'name':_0x1a9b9e[_0xad0f('0x46')],'type':_0x1a9b9e['type'][_0xad0f('0x47')]};});_0x1d75a5[_0xad0f('0x48')]=_['map'](_0x1e5856,_0xad0f('0x49'));_0x1d75a5[_0xad0f('0x4a')]=_[_0xad0f('0x4b')](_0x2133d1['query']);_0x1d75a5['filters']=_[_0xad0f('0x4c')](_0x1d75a5[_0xad0f('0x48')],_0x1d75a5[_0xad0f('0x4a')]);_0x4e237b[_0xad0f('0x4d')]=_[_0xad0f('0x4c')](_0x1d75a5[_0xad0f('0x48')],qs['fields'](_0x2133d1[_0xad0f('0x4a')][_0xad0f('0x4e')]));_0x4e237b[_0xad0f('0x4d')]=_0x4e237b[_0xad0f('0x4d')][_0xad0f('0x4f')]?_0x4e237b['attributes']:_0x1d75a5[_0xad0f('0x48')];if(!_0x2133d1[_0xad0f('0x4a')][_0xad0f('0x50')](_0xad0f('0x51'))){_0x4e237b['limit']=qs[_0xad0f('0x20')](_0x2133d1[_0xad0f('0x4a')]['limit']);_0x4e237b[_0xad0f('0x1e')]=qs[_0xad0f('0x1e')](_0x2133d1[_0xad0f('0x4a')][_0xad0f('0x1e')]);}_0x4e237b[_0xad0f('0x52')]=qs[_0xad0f('0x53')](_0x2133d1[_0xad0f('0x4a')]['sort']);_0x4e237b[_0xad0f('0x54')]=qs[_0xad0f('0x55')](_[_0xad0f('0x56')](_0x2133d1[_0xad0f('0x4a')],_0x1d75a5['filters']),_0x1e5856);if(_0x2133d1['query']['filter']){_0x4e237b['where']=_[_0xad0f('0x57')](_0x4e237b[_0xad0f('0x54')],{'$or':_[_0xad0f('0x58')](_0x1e5856,function(_0xcac5b9){if(_0xcac5b9[_0xad0f('0x59')]!=='VIRTUAL'){var _0x16b478={};_0x16b478[_0xcac5b9[_0xad0f('0x49')]]={'$like':'%'+_0x2133d1['query'][_0xad0f('0x5a')]+'%'};return _0x16b478;}})});}_0x4e237b=_[_0xad0f('0x57')]({},_0x4e237b,_0x2133d1[_0xad0f('0x5b')]);var _0x223bc3={'where':_0x4e237b[_0xad0f('0x54')]};return db[_0xad0f('0x45')][_0xad0f('0x1f')](_0x223bc3)[_0xad0f('0x10')](function(_0x28a29d){_0x20607b[_0xad0f('0x1f')]=_0x28a29d;if(_0x2133d1[_0xad0f('0x4a')][_0xad0f('0x5c')]){_0x4e237b['include']=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x4e237b);})[_0xad0f('0x10')](function(_0x229880){_0x20607b[_0xad0f('0x5d')]=_0x229880;return _0x20607b;})['then'](respondWithFilteredResult(_0xac5ffe,_0x4e237b))[_0xad0f('0x19')](handleError(_0xac5ffe,null));};exports[_0xad0f('0x5e')]=function(_0x174f1a,_0x5cd00d){var _0x494f0b={'raw':![],'where':{'id':_0x174f1a[_0xad0f('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xad0f('0x42')],'as':'Smtp'},{'model':db[_0xad0f('0x43')],'as':_0xad0f('0x44')}]},_0x460544={};_0x460544['model']=_[_0xad0f('0x4b')](db[_0xad0f('0x45')][_0xad0f('0x60')]);_0x460544[_0xad0f('0x4a')]=_['keys'](_0x174f1a[_0xad0f('0x4a')]);_0x460544[_0xad0f('0x55')]=_['intersection'](_0x460544[_0xad0f('0x48')],_0x460544[_0xad0f('0x4a')]);_0x494f0b['attributes']=_['intersection'](_0x460544['model'],qs[_0xad0f('0x4e')](_0x174f1a[_0xad0f('0x4a')][_0xad0f('0x4e')]));_0x494f0b['attributes']=_0x494f0b[_0xad0f('0x4d')]['length']?_0x494f0b[_0xad0f('0x4d')]:_0x460544[_0xad0f('0x48')];if(_0x174f1a['query'][_0xad0f('0x5c')]){_0x494f0b[_0xad0f('0x61')]=[{'all':!![]}];}_0x494f0b=_[_0xad0f('0x57')]({},_0x494f0b,_0x174f1a[_0xad0f('0x5b')]);return db['MailAccount']['find'](_0x494f0b)[_0xad0f('0x10')](handleEntityNotFound(_0x5cd00d,null))[_0xad0f('0x10')](respondWithResult(_0x5cd00d,null))[_0xad0f('0x19')](handleError(_0x5cd00d,null));};exports[_0xad0f('0x22')]=function(_0x5b5d99,_0x47d463){if(_0x5b5d99[_0xad0f('0x62')]['id']){delete _0x5b5d99[_0xad0f('0x62')]['id'];}var _0x23eea6=_0x5b5d99[_0xad0f('0x62')][_0xad0f('0x63')]===_0xad0f('0x64')?null:_0x5b5d99[_0xad0f('0x62')][_0xad0f('0x63')];var _0x173226=_0x5b5d99['body'][_0xad0f('0x3e')]||{};var _0x41d0dd=_0x5b5d99[_0xad0f('0x62')]['Smtp']||{};if(_0x23eea6){_0x173226[_0xad0f('0x39')]=getImapHost(_0x23eea6);_0x173226['port']=0x3e1;_0x41d0dd[_0xad0f('0x39')]=getSmtpHost(_0x23eea6);_0x41d0dd[_0xad0f('0x3a')]=0x24b;_0x41d0dd['secure']=![];}if(_0x41d0dd['modernAuthentication']){_0x41d0dd[_0xad0f('0x3b')]=![];}else{_0x41d0dd[_0xad0f('0x38')]=null;}if(!_0x173226[_0xad0f('0x37')])_0x173226[_0xad0f('0x38')]=null;_0x5b5d99[_0xad0f('0x62')][_0xad0f('0x3e')]=_0x173226;_0x5b5d99[_0xad0f('0x62')]['Smtp']=_0x41d0dd;return db[_0xad0f('0x45')][_0xad0f('0x65')]({'where':{'id':_0x5b5d99[_0xad0f('0x5f')]['id']},'include':[{'model':db[_0xad0f('0x41')],'as':_0xad0f('0x3e')},{'model':db[_0xad0f('0x42')],'as':_0xad0f('0x3f')},{'model':db[_0xad0f('0x43')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x47d463,null))['then'](function(_0x3d6c1d){if(!_0x3d6c1d)throw new Error(_0xad0f('0x66'));if(_0x3d6c1d['service'])delete _0x5b5d99[_0xad0f('0x62')][_0xad0f('0x3e')];return _0x3d6c1d;})[_0xad0f('0x10')](saveUpdates(_0x5b5d99[_0xad0f('0x62')],null))[_0xad0f('0x10')](function(_0x51f762){if(!_0x5b5d99[_0xad0f('0x62')][_0xad0f('0x3e')])return _0x51f762;return db[_0xad0f('0x41')]['update'](_0x5b5d99[_0xad0f('0x62')]['Imap'],{'where':{'MailAccountId':_0x51f762['id']}})[_0xad0f('0x10')](function(){return _0x51f762;});})[_0xad0f('0x10')](function(_0x1642d9){if(!_0x5b5d99[_0xad0f('0x62')]['Smtp'])return _0x1642d9;return db[_0xad0f('0x42')][_0xad0f('0x22')](_0x5b5d99['body']['Smtp'],{'where':{'MailAccountId':_0x1642d9['id']}})[_0xad0f('0x10')](function(){return _0x1642d9;});})[_0xad0f('0x10')](respondWithResult(_0x47d463,null))['catch'](handleError(_0x47d463,null));};exports['describe']=function(_0x970635,_0x2ce8d7){return db[_0xad0f('0x45')]['describe']()[_0xad0f('0x10')](respondWithResult(_0x2ce8d7,null))[_0xad0f('0x19')](handleError(_0x2ce8d7,null));};exports[_0xad0f('0x67')]=function(_0x600721,_0x22d31f){if(_0x600721[_0xad0f('0x62')]['id']){delete _0x600721[_0xad0f('0x62')]['id'];}return db[_0xad0f('0x45')][_0xad0f('0x65')]({'where':{'id':_0x600721['params']['id']}})['then'](handleEntityNotFound(_0x22d31f,null))[_0xad0f('0x10')](function(_0x279da3){if(_0x279da3){_0x600721[_0xad0f('0x62')][_0xad0f('0x68')]=_0x279da3['id'];return db[_0xad0f('0x69')][_0xad0f('0x6a')](_0x600721[_0xad0f('0x62')]);}})[_0xad0f('0x10')](respondWithResult(_0x22d31f,null))['catch'](handleError(_0x22d31f,null));};exports['getDispositions']=function(_0xb9280d,_0xebb9a7){var _0x4e6db1={'raw':![],'where':{}};var _0x17ee75={};var _0x224697={'count':0x0,'rows':[]};return db[_0xad0f('0x45')][_0xad0f('0x6b')]({'where':{'id':_0xb9280d[_0xad0f('0x5f')]['id']}})['then'](handleEntityNotFound(_0xebb9a7,null))[_0xad0f('0x10')](function(_0x4274ec){if(_0x4274ec){_0x17ee75[_0xad0f('0x48')]=_['keys'](db[_0xad0f('0x69')][_0xad0f('0x60')]);_0x17ee75['query']=_[_0xad0f('0x4b')](_0xb9280d['query']);_0x17ee75[_0xad0f('0x55')]=_[_0xad0f('0x4c')](_0x17ee75[_0xad0f('0x48')],_0x17ee75['query']);_0x4e6db1[_0xad0f('0x4d')]=_['intersection'](_0x17ee75[_0xad0f('0x48')],qs['fields'](_0xb9280d[_0xad0f('0x4a')][_0xad0f('0x4e')]));_0x4e6db1['attributes']=_0x4e6db1[_0xad0f('0x4d')]['length']?_0x4e6db1['attributes']:_0x17ee75['model'];if(!_0xb9280d['query'][_0xad0f('0x50')]('nolimit')){_0x4e6db1['limit']=qs['limit'](_0xb9280d[_0xad0f('0x4a')]['limit']);_0x4e6db1['offset']=qs['offset'](_0xb9280d['query'][_0xad0f('0x1e')]);}_0x4e6db1['order']=qs[_0xad0f('0x53')](_0xb9280d['query'][_0xad0f('0x53')]);_0x4e6db1[_0xad0f('0x54')]=qs[_0xad0f('0x55')](_['pick'](_0xb9280d[_0xad0f('0x4a')],_0x17ee75['filters']));_0x4e6db1[_0xad0f('0x54')][_0xad0f('0x68')]=_0x4274ec['id'];if(_0xb9280d[_0xad0f('0x4a')][_0xad0f('0x5a')]){_0x4e6db1[_0xad0f('0x54')]=_[_0xad0f('0x57')](_0x4e6db1[_0xad0f('0x54')],{'$or':_[_0xad0f('0x58')](_0x4e6db1[_0xad0f('0x4d')],function(_0x16724d){var _0x16f51f={};_0x16f51f[_0x16724d]={'$like':'%'+_0xb9280d[_0xad0f('0x4a')][_0xad0f('0x5a')]+'%'};return _0x16f51f;})});}_0x4e6db1=_[_0xad0f('0x57')]({},_0x4e6db1,_0xb9280d[_0xad0f('0x5b')]);return db[_0xad0f('0x69')][_0xad0f('0x1f')]({'where':_0x4e6db1['where']})[_0xad0f('0x10')](function(_0x94835d){_0x224697[_0xad0f('0x1f')]=_0x94835d;if(_0xb9280d['query'][_0xad0f('0x5c')]){_0x4e6db1['include']=[{'all':!![]}];}return db[_0xad0f('0x69')]['findAll'](_0x4e6db1);})[_0xad0f('0x10')](function(_0x15d33f){_0x224697['rows']=_0x15d33f;return _0x224697;});}})['then'](respondWithFilteredResult(_0xebb9a7,_0x4e6db1))[_0xad0f('0x19')](handleError(_0xebb9a7,null));};exports[_0xad0f('0x6c')]=function(_0x6ecade,_0x255287){return db[_0xad0f('0x45')][_0xad0f('0x65')]({'where':{'id':_0x6ecade['params']['id']}})['then'](handleEntityNotFound(_0x255287,null))[_0xad0f('0x10')](function(_0x5b74ee){if(_0x5b74ee){return _0x5b74ee['removeDispositions'](_0x6ecade['query'][_0xad0f('0x6d')]);}})['then'](respondWithStatusCode(_0x255287,null))[_0xad0f('0x19')](handleError(_0x255287,null));};exports[_0xad0f('0x6e')]=function(_0x1142d1,_0x383617){if(_0x1142d1[_0xad0f('0x62')]['id']){delete _0x1142d1['body']['id'];}return db[_0xad0f('0x45')][_0xad0f('0x65')]({'where':{'id':_0x1142d1[_0xad0f('0x5f')]['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0x383617,null))['then'](function(_0x42144b){if(_0x42144b){_0x1142d1['body']['MailAccountId']=_0x42144b['id'];return db[_0xad0f('0x6f')]['create'](_0x1142d1[_0xad0f('0x62')]);}})['then'](respondWithResult(_0x383617,null))[_0xad0f('0x19')](handleError(_0x383617,null));};exports[_0xad0f('0x70')]=function(_0x4ec82f,_0x39a0b5){var _0x4e1b89={'raw':![],'where':{}};var _0x476b12={};var _0x2acb44={'count':0x0,'rows':[]};return db[_0xad0f('0x45')]['findOne']({'where':{'id':_0x4ec82f[_0xad0f('0x5f')]['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0x39a0b5,null))[_0xad0f('0x10')](function(_0x4632eb){if(_0x4632eb){_0x476b12[_0xad0f('0x48')]=_['keys'](db[_0xad0f('0x6f')][_0xad0f('0x60')]);_0x476b12[_0xad0f('0x4a')]=_[_0xad0f('0x4b')](_0x4ec82f['query']);_0x476b12[_0xad0f('0x55')]=_[_0xad0f('0x4c')](_0x476b12[_0xad0f('0x48')],_0x476b12['query']);_0x4e1b89[_0xad0f('0x4d')]=_[_0xad0f('0x4c')](_0x476b12[_0xad0f('0x48')],qs[_0xad0f('0x4e')](_0x4ec82f[_0xad0f('0x4a')][_0xad0f('0x4e')]));_0x4e1b89[_0xad0f('0x4d')]=_0x4e1b89[_0xad0f('0x4d')][_0xad0f('0x4f')]?_0x4e1b89['attributes']:_0x476b12[_0xad0f('0x48')];if(!_0x4ec82f[_0xad0f('0x4a')]['hasOwnProperty'](_0xad0f('0x51'))){_0x4e1b89[_0xad0f('0x20')]=qs['limit'](_0x4ec82f['query'][_0xad0f('0x20')]);_0x4e1b89[_0xad0f('0x1e')]=qs[_0xad0f('0x1e')](_0x4ec82f[_0xad0f('0x4a')][_0xad0f('0x1e')]);}_0x4e1b89[_0xad0f('0x52')]=qs[_0xad0f('0x53')](_0x4ec82f['query'][_0xad0f('0x53')]);_0x4e1b89['where']=qs[_0xad0f('0x55')](_['pick'](_0x4ec82f['query'],_0x476b12[_0xad0f('0x55')]));_0x4e1b89[_0xad0f('0x54')][_0xad0f('0x68')]=_0x4632eb['id'];if(_0x4ec82f[_0xad0f('0x4a')][_0xad0f('0x5a')]){_0x4e1b89[_0xad0f('0x54')]=_[_0xad0f('0x57')](_0x4e1b89[_0xad0f('0x54')],{'$or':_[_0xad0f('0x58')](_0x4e1b89[_0xad0f('0x4d')],function(_0x313bf2){var _0x331846={};_0x331846[_0x313bf2]={'$like':'%'+_0x4ec82f[_0xad0f('0x4a')][_0xad0f('0x5a')]+'%'};return _0x331846;})});}_0x4e1b89=_['merge']({},_0x4e1b89,_0x4ec82f[_0xad0f('0x5b')]);return db[_0xad0f('0x6f')]['count']({'where':_0x4e1b89['where']})[_0xad0f('0x10')](function(_0x53f297){_0x2acb44['count']=_0x53f297;if(_0x4ec82f[_0xad0f('0x4a')][_0xad0f('0x5c')]){_0x4e1b89[_0xad0f('0x61')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4e1b89);})[_0xad0f('0x10')](function(_0x2941a8){_0x2acb44['rows']=_0x2941a8;return _0x2acb44;});}})[_0xad0f('0x10')](respondWithFilteredResult(_0x39a0b5,_0x4e1b89))[_0xad0f('0x19')](handleError(_0x39a0b5,null));};exports[_0xad0f('0x71')]=function(_0x128606,_0x1bdbca){return db[_0xad0f('0x45')][_0xad0f('0x65')]({'where':{'id':_0x128606[_0xad0f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1bdbca,null))[_0xad0f('0x10')](function(_0x2ca814){if(_0x2ca814){return _0x2ca814['removeAnswers'](_0x128606[_0xad0f('0x4a')]['ids']);}})['then'](respondWithStatusCode(_0x1bdbca,null))[_0xad0f('0x19')](handleError(_0x1bdbca,null));};exports['create']=function(_0x913a4,_0x33189f){var _0x1e768b={'name':_0x913a4[_0xad0f('0x62')]['name'],'key':_0x913a4[_0xad0f('0x62')][_0xad0f('0x47')],'provider':_0x913a4[_0xad0f('0x62')][_0xad0f('0x63')]===_0xad0f('0x64')?null:_0x913a4['body']['provider'],'email':_0x913a4[_0xad0f('0x62')]['email'],'ListId':_0x913a4['body'][_0xad0f('0x72')],'active':!_['isNil'](_0x913a4['body'][_0xad0f('0x73')])?_0x913a4[_0xad0f('0x62')]['active']:!![],'description':_0x913a4['body'][_0xad0f('0x74')]||null};var _0x237a32=getAuthenticationOptions(_0x1e768b[_0xad0f('0x63')],_0x913a4['body']);_0x1e768b[_0xad0f('0x3e')]=_0x237a32[_0xad0f('0x3e')];_0x1e768b[_0xad0f('0x3f')]=_0x237a32[_0xad0f('0x3f')];return db[_0xad0f('0x45')][_0xad0f('0x6a')](_0x1e768b,{'include':[{'model':db[_0xad0f('0x42')],'as':_0xad0f('0x3f')},{'model':db[_0xad0f('0x41')],'as':_0xad0f('0x3e')}]})[_0xad0f('0x10')](function(_0x358fbc){var _0x322b34=_0x913a4[_0xad0f('0x33')]['get']({'plain':!![]});if(!_0x322b34)throw new Error(_0xad0f('0x75'));if(_0x322b34['role']===_0xad0f('0x33')){var _0x2d3738=_0x358fbc[_0xad0f('0x24')]({'plain':!![]});return db[_0xad0f('0x76')][_0xad0f('0x65')]({'where':{'name':_0xad0f('0x25'),'userProfileId':_0x322b34[_0xad0f('0x77')]},'raw':!![]})[_0xad0f('0x10')](function(_0x510eed){if(_0x510eed&&_0x510eed[_0xad0f('0x78')]===0x0){return db['UserProfileResource']['create']({'name':_0x2d3738[_0xad0f('0x49')],'resourceId':_0x2d3738['id'],'type':_0x510eed[_0xad0f('0x49')],'sectionId':_0x510eed['id']},{})[_0xad0f('0x10')](function(){return _0x358fbc;});}else{return _0x358fbc;}})[_0xad0f('0x19')](function(_0x1e5b0f){logger['error'](_0xad0f('0x79'),_0x1e5b0f);throw _0x1e5b0f;});}return _0x358fbc;})['then'](respondWithResult(_0x33189f,0xc9))[_0xad0f('0x19')](handleError(_0x33189f,null));};exports[_0xad0f('0x7a')]=function(_0x5eedd5,_0x39a638){return db[_0xad0f('0x45')][_0xad0f('0x6b')]({'where':{'id':_0x5eedd5[_0xad0f('0x5f')]['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0x39a638,null))[_0xad0f('0x10')](function(_0x5e0b06){if(_0x5e0b06){return _0x5e0b06[_0xad0f('0x7a')]();}return null;})['then'](respondWithResult(_0x39a638,null))[_0xad0f('0x19')](handleError(_0x39a638,null));};exports[_0xad0f('0x7b')]=function(_0x5f5000,_0x37afac){if(_0x5f5000['body']['id']){delete _0x5f5000[_0xad0f('0x62')]['id'];}return db[_0xad0f('0x45')]['find']({'where':{'id':_0x5f5000[_0xad0f('0x5f')]['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0x37afac,null))['then'](function(_0x1d8db2){if(_0x1d8db2){_0x5f5000[_0xad0f('0x62')][_0xad0f('0x68')]=_0x1d8db2['id'];return db[_0xad0f('0x41')][_0xad0f('0x6a')](_0x5f5000['body']);}})[_0xad0f('0x10')](respondWithResult(_0x37afac,null))[_0xad0f('0x19')](handleError(_0x37afac,null));};exports[_0xad0f('0x7c')]=function(_0x4f53f1,_0x1533ac){return db[_0xad0f('0x45')][_0xad0f('0x6b')]({'where':{'id':_0x4f53f1[_0xad0f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1533ac,null))[_0xad0f('0x10')](function(_0x6c9a43){if(_0x6c9a43){return _0x6c9a43[_0xad0f('0x7d')](null);}return null;})[_0xad0f('0x10')](respondWithStatusCode(_0x1533ac,null))['catch'](handleError(_0x1533ac,null));};exports['getSmtp']=function(_0x225b44,_0x22d424){return db[_0xad0f('0x45')][_0xad0f('0x6b')]({'where':{'id':_0x225b44[_0xad0f('0x5f')]['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0x22d424,null))[_0xad0f('0x10')](function(_0x1c925c){if(_0x1c925c){return _0x1c925c[_0xad0f('0x7e')]();}return null;})[_0xad0f('0x10')](respondWithResult(_0x22d424,null))[_0xad0f('0x19')](handleError(_0x22d424,null));};exports['addSmtp']=function(_0x53f07a,_0x5f1778){if(_0x53f07a[_0xad0f('0x62')]['id']){delete _0x53f07a['body']['id'];}return db[_0xad0f('0x45')]['find']({'where':{'id':_0x53f07a['params']['id']}})['then'](handleEntityNotFound(_0x5f1778,null))[_0xad0f('0x10')](function(_0x30dcfe){if(_0x30dcfe){_0x53f07a[_0xad0f('0x62')]['MailAccountId']=_0x30dcfe['id'];return db[_0xad0f('0x42')][_0xad0f('0x6a')](_0x53f07a[_0xad0f('0x62')]);}})[_0xad0f('0x10')](respondWithResult(_0x5f1778,null))[_0xad0f('0x19')](handleError(_0x5f1778,null));};exports[_0xad0f('0x7f')]=function(_0x52423e,_0xfea8e){return db['MailAccount'][_0xad0f('0x6b')]({'where':{'id':_0x52423e['params']['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0xfea8e,null))[_0xad0f('0x10')](function(_0x228fb2){if(_0x228fb2){return _0x228fb2['setSmtp'](null);}return null;})[_0xad0f('0x10')](respondWithStatusCode(_0xfea8e,null))['catch'](handleError(_0xfea8e,null));};exports[_0xad0f('0x80')]=function(_0xd5a7d7,_0x2d8caf){return db[_0xad0f('0x81')][_0xad0f('0x65')]({'where':{'id':_0xd5a7d7[_0xad0f('0x5f')]['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0x2d8caf,null))[_0xad0f('0x10')](function(_0x45709e){if(_0x45709e){return _0x45709e[_0xad0f('0x80')](_0xd5a7d7['body']['ids'],_['omit'](_0xd5a7d7[_0xad0f('0x62')],[_0xad0f('0x6d'),'id'])||{});}})[_0xad0f('0x10')](respondWithResult(_0x2d8caf,null))[_0xad0f('0x19')](handleError(_0x2d8caf,null));};exports[_0xad0f('0x82')]=function(_0x154012,_0x5ae2eb){var _0x592543={'raw':![],'where':{}};var _0x3b2f2e={};var _0x39b88e={'count':0x0,'rows':[]};return db['MailAccount'][_0xad0f('0x6b')]({'where':{'id':_0x154012['params']['id']}})['then'](handleEntityNotFound(_0x5ae2eb,null))[_0xad0f('0x10')](function(_0x352029){if(_0x352029){_0x3b2f2e['model']=_[_0xad0f('0x4b')](db[_0xad0f('0x81')]['rawAttributes']);_0x3b2f2e['query']=_[_0xad0f('0x4b')](_0x154012[_0xad0f('0x4a')]);_0x3b2f2e[_0xad0f('0x55')]=_['intersection'](_0x3b2f2e[_0xad0f('0x48')],_0x3b2f2e[_0xad0f('0x4a')]);_0x592543['attributes']=_['intersection'](_0x3b2f2e[_0xad0f('0x48')],qs['fields'](_0x154012[_0xad0f('0x4a')][_0xad0f('0x4e')]));_0x592543[_0xad0f('0x4d')]=_0x592543[_0xad0f('0x4d')][_0xad0f('0x4f')]?_0x592543['attributes']:_0x3b2f2e[_0xad0f('0x48')];if(!_0x154012['query'][_0xad0f('0x50')](_0xad0f('0x51'))){_0x592543[_0xad0f('0x20')]=qs[_0xad0f('0x20')](_0x154012['query']['limit']);_0x592543[_0xad0f('0x1e')]=qs[_0xad0f('0x1e')](_0x154012[_0xad0f('0x4a')]['offset']);}_0x592543[_0xad0f('0x52')]=qs[_0xad0f('0x53')](_0x154012['query'][_0xad0f('0x53')]);_0x592543[_0xad0f('0x54')]=qs[_0xad0f('0x55')](_[_0xad0f('0x56')](_0x154012[_0xad0f('0x4a')],_0x3b2f2e[_0xad0f('0x55')]));_0x592543['where'][_0xad0f('0x68')]=_0x352029['id'];if(_0x154012['query'][_0xad0f('0x5a')]){_0x592543[_0xad0f('0x54')]=_[_0xad0f('0x57')](_0x592543['where'],{'$or':_[_0xad0f('0x58')](_0x592543['attributes'],function(_0x1a60a3){var _0x21e6d4={};_0x21e6d4[_0x1a60a3]={'$like':'%'+_0x154012[_0xad0f('0x4a')][_0xad0f('0x5a')]+'%'};return _0x21e6d4;})});}_0x592543=_[_0xad0f('0x57')]({},_0x592543,_0x154012[_0xad0f('0x5b')]);return db[_0xad0f('0x81')][_0xad0f('0x1f')]({'where':_0x592543[_0xad0f('0x54')]})[_0xad0f('0x10')](function(_0x4c2e90){_0x39b88e[_0xad0f('0x1f')]=_0x4c2e90;if(_0x154012[_0xad0f('0x4a')][_0xad0f('0x5c')]){_0x592543[_0xad0f('0x61')]=[{'model':db[_0xad0f('0x83')],'as':_0xad0f('0x84'),'required':![]},{'model':db[_0xad0f('0x85')],'as':_0xad0f('0x86'),'attributes':[_0xad0f('0x49'),_0xad0f('0x87'),_0xad0f('0x88')],'required':![]},{'model':db[_0xad0f('0x89')],'as':_0xad0f('0x8a'),'attributes':['id',_0xad0f('0x49'),_0xad0f('0x8b')],'where':_0x154012['query'][_0xad0f('0x8c')]?{'id':_0x154012['query'][_0xad0f('0x8c')]}:undefined,'required':_0x154012['query']['tag']?!![]:![]}];}return db[_0xad0f('0x81')]['findAll'](_0x592543);})[_0xad0f('0x10')](function(_0x4b1ed5){_0x39b88e['rows']=_0x4b1ed5;return _0x39b88e;});}})['then'](respondWithFilteredResult(_0x5ae2eb,_0x592543))['catch'](handleError(_0x5ae2eb,null));};exports[_0xad0f('0x8d')]=function addApplications(_0x587fd0,_0x32d387){var _0x90591a=_0x587fd0[_0xad0f('0x5f')]['id'];var _0x563d84=_0x587fd0[_0xad0f('0x62')];var _0x9661ee=0xc8;var _0x1a6f80=null;return db[_0xad0f('0x8e')][_0xad0f('0x8f')]({'isolationLevel':db[_0xad0f('0x8e')][_0xad0f('0x90')][_0xad0f('0x91')][_0xad0f('0x92')]},function(_0x304689){return db[_0xad0f('0x45')][_0xad0f('0x6b')]({'where':{'id':_0x90591a},'transaction':_0x304689})[_0xad0f('0x10')](function(_0x3c5459){if(_0x3c5459){return db[_0xad0f('0x93')]['destroy']({'where':{'MailAccountId':_0x90591a},'transaction':_0x304689})['then'](function(){var _0x4d86ff=_[_0xad0f('0x58')](_0x563d84,function(_0xf6b1a0){_0xf6b1a0[_0xad0f('0x68')]=_0x90591a;return _0xf6b1a0;});return db[_0xad0f('0x93')][_0xad0f('0x94')](_0x4d86ff,{'transaction':_0x304689});});}else{_0x9661ee=0x194;_0x1a6f80=[];}});})['then'](function(){if(_0x9661ee!==0x194){return db[_0xad0f('0x93')][_0xad0f('0x95')]({'where':{'MailAccountId':_0x90591a},'order':_0xad0f('0x96')})[_0xad0f('0x10')](function(_0xbddd44){_0x1a6f80=_0xbddd44;});}})[_0xad0f('0x19')](function(_0x2da025){_0x9661ee=0x1f4;logger[_0xad0f('0x15')](_0x2da025[_0xad0f('0x97')]);if(_0x2da025[_0xad0f('0x49')]){delete _0x2da025[_0xad0f('0x49')];}_0x1a6f80=_0x2da025;})[_0xad0f('0x98')](function(){if(_0x1a6f80===null){_0x32d387[_0xad0f('0x1a')](_0x9661ee);}else{if(_0x9661ee===0x1f4){_0x32d387[_0xad0f('0x1b')](_0x9661ee)[_0xad0f('0x27')](_0x1a6f80);}else{_0x32d387[_0xad0f('0x1b')](_0x9661ee)[_0xad0f('0x1d')](_0x1a6f80);}}});};exports[_0xad0f('0x99')]=function(_0x4c6c43,_0x25aec0){var _0x189097={};var _0x41443a={};var _0x3bc66a;var _0x4030f7;return db[_0xad0f('0x45')][_0xad0f('0x6b')]({'where':{'id':_0x4c6c43[_0xad0f('0x5f')]['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0x25aec0,null))['then'](function(_0x1b977f){if(_0x1b977f){_0x3bc66a=_0x1b977f;_0x41443a['model']=_[_0xad0f('0x4b')](db[_0xad0f('0x93')][_0xad0f('0x60')]);_0x41443a['query']=_['keys'](_0x4c6c43[_0xad0f('0x4a')]);_0x41443a[_0xad0f('0x55')]=_['intersection'](_0x41443a[_0xad0f('0x48')],_0x41443a[_0xad0f('0x4a')]);_0x189097[_0xad0f('0x4d')]=_['intersection'](_0x41443a[_0xad0f('0x48')],qs[_0xad0f('0x4e')](_0x4c6c43['query'][_0xad0f('0x4e')]));_0x189097[_0xad0f('0x4d')]=_0x189097['attributes'][_0xad0f('0x4f')]?_0x189097['attributes']:_0x41443a[_0xad0f('0x48')];_0x189097[_0xad0f('0x52')]=qs[_0xad0f('0x53')](_0x4c6c43[_0xad0f('0x4a')][_0xad0f('0x53')]);_0x189097[_0xad0f('0x54')]=qs[_0xad0f('0x55')](_['pick'](_0x4c6c43[_0xad0f('0x4a')],_0x41443a[_0xad0f('0x55')]));if(_0x4c6c43[_0xad0f('0x4a')]['filter']){_0x189097[_0xad0f('0x54')]=_[_0xad0f('0x57')](_0x189097[_0xad0f('0x54')],{'$or':_['map'](_0x189097[_0xad0f('0x4d')],function(_0x40ef99){var _0x3d48e8={};_0x3d48e8[_0x40ef99]={'$like':'%'+_0x4c6c43[_0xad0f('0x4a')]['filter']+'%'};return _0x3d48e8;})});}_0x189097=_[_0xad0f('0x57')]({},_0x189097,_0x4c6c43[_0xad0f('0x5b')]);return _0x3bc66a['getApplications'](_0x189097);}})['then'](function(_0x1c6ebd){if(_0x1c6ebd){_0x4030f7=_0x1c6ebd[_0xad0f('0x4f')];if(!_0x4c6c43[_0xad0f('0x4a')][_0xad0f('0x50')](_0xad0f('0x51'))){_0x189097[_0xad0f('0x20')]=qs[_0xad0f('0x20')](_0x4c6c43['query'][_0xad0f('0x20')]);_0x189097['offset']=qs[_0xad0f('0x1e')](_0x4c6c43[_0xad0f('0x4a')][_0xad0f('0x1e')]);}return _0x3bc66a[_0xad0f('0x99')](_0x189097);}})[_0xad0f('0x10')](function(_0xb8e159){if(_0xb8e159){return _0xb8e159?{'count':_0x4030f7,'rows':_0xb8e159}:null;}})[_0xad0f('0x10')](respondWithResult(_0x25aec0,null))[_0xad0f('0x19')](handleError(_0x25aec0,null));};exports['getMessages']=function(_0xe9a899,_0x43cc6b){var _0x17c0db={'raw':!![],'where':{}};var _0x2f1133={};var _0x2030fd={'count':0x0,'rows':[]};return db[_0xad0f('0x45')][_0xad0f('0x6b')]({'where':{'id':_0xe9a899[_0xad0f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x43cc6b,null))['then'](function(_0x182f0b){if(_0x182f0b){_0x2f1133[_0xad0f('0x48')]=_[_0xad0f('0x4b')](db[_0xad0f('0x9a')]['rawAttributes']);_0x2f1133[_0xad0f('0x4a')]=_[_0xad0f('0x4b')](_0xe9a899[_0xad0f('0x4a')]);_0x2f1133['filters']=_[_0xad0f('0x4c')](_0x2f1133['model'],_0x2f1133[_0xad0f('0x4a')]);_0x17c0db['attributes']=_[_0xad0f('0x4c')](_0x2f1133[_0xad0f('0x48')],qs[_0xad0f('0x4e')](_0xe9a899[_0xad0f('0x4a')][_0xad0f('0x4e')]));_0x17c0db[_0xad0f('0x4d')]=_0x17c0db[_0xad0f('0x4d')][_0xad0f('0x4f')]?_0x17c0db['attributes']:_0x2f1133[_0xad0f('0x48')];if(!_0xe9a899['query'][_0xad0f('0x50')](_0xad0f('0x51'))){_0x17c0db[_0xad0f('0x20')]=qs[_0xad0f('0x20')](_0xe9a899[_0xad0f('0x4a')][_0xad0f('0x20')]);_0x17c0db[_0xad0f('0x1e')]=qs[_0xad0f('0x1e')](_0xe9a899[_0xad0f('0x4a')][_0xad0f('0x1e')]);}_0x17c0db['order']=qs[_0xad0f('0x53')](_0xe9a899['query'][_0xad0f('0x53')]);_0x17c0db[_0xad0f('0x54')]=qs['filters'](_[_0xad0f('0x56')](_0xe9a899['query'],_0x2f1133[_0xad0f('0x55')]));_0x17c0db[_0xad0f('0x54')][_0xad0f('0x68')]=_0x182f0b['id'];if(_0xe9a899['query'][_0xad0f('0x5a')]){_0x17c0db['where']=_[_0xad0f('0x57')](_0x17c0db[_0xad0f('0x54')],{'$or':_[_0xad0f('0x58')](_0x17c0db[_0xad0f('0x4d')],function(_0x5c498a){var _0x5e89c4={};_0x5e89c4[_0x5c498a]={'$like':'%'+_0xe9a899[_0xad0f('0x4a')][_0xad0f('0x5a')]+'%'};return _0x5e89c4;})});}if(_0xe9a899[_0xad0f('0x4a')][_0xad0f('0x9b')]){var _0x25af60=_0xe9a899[_0xad0f('0x4a')][_0xad0f('0x9b')][_0xad0f('0x9c')](',');var _0x470dca={};_0x470dca[_0x25af60[0x0]]={'$gte':moment(_0x25af60[0x1])[_0xad0f('0x9d')](_0xad0f('0x9e'))};_0x17c0db[_0xad0f('0x54')]=_[_0xad0f('0x57')](_0x17c0db[_0xad0f('0x54')],_0x470dca);}_0x17c0db=_[_0xad0f('0x57')]({},_0x17c0db,_0xe9a899['options']);return db[_0xad0f('0x9a')][_0xad0f('0x1f')]({'where':_0x17c0db[_0xad0f('0x54')]})[_0xad0f('0x10')](function(_0x102cdc){_0x2030fd['count']=_0x102cdc;if(_0xe9a899['query'][_0xad0f('0x5c')]){_0x17c0db[_0xad0f('0x61')]=[{'all':!![]}];}return db[_0xad0f('0x9a')]['findAll'](_0x17c0db);})[_0xad0f('0x10')](function(_0x5b843b){if(_0xe9a899[_0xad0f('0x4a')][_0xad0f('0x9f')]===_0xad0f('0xa0')){for(var _0x429b33=0x0;_0x429b33<_0x5b843b['length'];_0x429b33++){_0x5b843b[_0x429b33][_0xad0f('0x62')]=juice(_0x5b843b[_0x429b33]['body']);}}_0x2030fd[_0xad0f('0x5d')]=_0x5b843b;return _0x2030fd;});}})['then'](respondWithFilteredResult(_0x43cc6b,_0x17c0db))['catch'](handleError(_0x43cc6b,null));};exports['send']=function(_0x32e8dd,_0x57e6cb){var _0xd806ea,_0x3b2ff8={},_0xb19bd3;if(_0x32e8dd[_0xad0f('0x62')]['to']){_0xb19bd3=_0x32e8dd[_0xad0f('0x62')]['to'][_0xad0f('0x9c')](',')[0x0];}return db[_0xad0f('0x45')][_0xad0f('0x65')]({'where':{'id':_0x32e8dd[_0xad0f('0x5f')]['id']},'include':[{'model':db[_0xad0f('0xa1')],'as':_0xad0f('0xa2'),'include':[{'model':db['CmContact'],'as':_0xad0f('0xa3'),'where':{'email':_0xb19bd3},'limit':0x1,'order':[['updatedAt',_0xad0f('0xa4')]]}]},{'model':db['MailServerOut'],'as':_0xad0f('0x3f'),'raw':!![],'include':[{'model':db[_0xad0f('0xa5')],'as':_0xad0f('0xa5'),'raw':!![]}]}]})[_0xad0f('0x10')](handleEntityNotFound(_0x57e6cb,null))[_0xad0f('0x10')](function(_0x5d3a94){if(!_0x5d3a94)return;_0xd806ea=_0x5d3a94;if(!_0x5d3a94[_0xad0f('0x3f')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xad0f('0xa6')](_0x32e8dd['body'][_0xad0f('0xa7')])){_0x32e8dd[_0xad0f('0x62')][_0xad0f('0xa7')]=util['format'](_0xad0f('0xa8'),_0x5d3a94[_0xad0f('0x49')],_0x5d3a94['email']||_0x5d3a94[_0xad0f('0x3f')][_0xad0f('0x33')]);}if(_0x32e8dd[_0xad0f('0x62')]['attachments']&&_0x32e8dd[_0xad0f('0x62')][_0xad0f('0xa9')][_0xad0f('0x4f')]){for(var _0x4913a4=0x0;_0x4913a4<_0x32e8dd[_0xad0f('0x62')][_0xad0f('0xa9')][_0xad0f('0x4f')];_0x4913a4+=0x1){_0x32e8dd[_0xad0f('0x62')]['attachments'][_0x4913a4]={'filename':_0x32e8dd[_0xad0f('0x62')][_0xad0f('0xa9')][_0x4913a4][_0xad0f('0x49')],'path':path[_0xad0f('0xaa')](config['root'],'server/files/attachments',_0x32e8dd[_0xad0f('0x62')][_0xad0f('0xa9')][_0x4913a4]['basename'])};}}var _0x143926=_0x5d3a94[_0xad0f('0xab')]();return respondWithRpcPromise(_0xad0f('0xac'),'sendMail',{'account':_0x143926,'message':_0x32e8dd[_0xad0f('0x62')]});})[_0xad0f('0x10')](function(_0x2463c2){if(!_0x2463c2)return;_0x3b2ff8=_0x2463c2;if(!_0xd806ea[_0xad0f('0xa2')])throw new Error(_0xad0f('0xad'));if(_0xd806ea[_0xad0f('0xa2')][_0xad0f('0xa3')]['length'])return _0xd806ea[_0xad0f('0xa2')]['Contacts'][0x0];return db[_0xad0f('0x83')][_0xad0f('0x6a')](_['defaults'](_0x32e8dd['body'],{'firstName':_0x32e8dd['body']['to'],'email':_0x32e8dd[_0xad0f('0x62')]['to'],'phone':_0x32e8dd[_0xad0f('0x62')]['to'],'ListId':_0xd806ea[_0xad0f('0x72')]}));})[_0xad0f('0x10')](function(_0x468094){if(!_0x468094)return;var _0x1d9db3={'UserId':_0x32e8dd['user']['id'],'ContactId':_0x468094['id'],'MailAccountId':_0xd806ea['id'],'inReplyTo':_0x3b2ff8[_0xad0f('0xae')],'to':_0x32e8dd[_0xad0f('0x62')][_0xad0f('0xa7')],'cc':_0x32e8dd[_0xad0f('0x62')]['cc'],'subject':_0x32e8dd[_0xad0f('0x62')]['subject'],'attach':_0x32e8dd[_0xad0f('0x62')][_0xad0f('0xaf')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xad0f('0x9e')),'lastMsgDirection':_0xad0f('0xb0'),'Messages':[_[_0xad0f('0x57')](_0x32e8dd[_0xad0f('0x62')],{'messageId':_0x3b2ff8[_0xad0f('0xae')],'sentAt':moment()[_0xad0f('0x9d')](_0xad0f('0x9e')),'read':!![],'MailAccountId':_0xd806ea['id'],'UserId':_0x32e8dd['user']['id'],'ContactId':_0x468094['id']})]};if(_0x32e8dd[_0xad0f('0x62')][_0xad0f('0xb1')]){_0x1d9db3=_[_0xad0f('0x57')](_0x1d9db3,_0x32e8dd['body'][_0xad0f('0xb1')]);}return db[_0xad0f('0x81')][_0xad0f('0x6a')](_0x1d9db3,{'include':[{'model':db[_0xad0f('0x9a')],'as':_0xad0f('0xb2')}]});})[_0xad0f('0x10')](respondWithResult(_0x57e6cb,null))[_0xad0f('0x19')](handleError(_0x57e6cb,null));};exports[_0xad0f('0xb3')]=function(_0x3d350b,_0xee5401){return db['MailAccount'][_0xad0f('0x65')]({'where':{'id':_0x3d350b[_0xad0f('0x5f')]['id']},'include':[{'model':db[_0xad0f('0x42')],'as':_0xad0f('0x3f'),'raw':!![],'include':[{'model':db[_0xad0f('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0xad0f('0x10')](handleEntityNotFound(_0xee5401,null))['then'](function(_0x4645ca){if(!_0x4645ca[_0xad0f('0x3f')])return;var _0x3abcc6=_0x4645ca[_0xad0f('0xab')]();return respondWithRpcPromise(_0xad0f('0xb4'),_0xad0f('0xb3'),{'account':_0x3abcc6});})[_0xad0f('0x10')](respondWithResult(_0xee5401,null))[_0xad0f('0x19')](handleError(_0xee5401,null));};exports[_0xad0f('0x23')]=function(_0xbc4973,_0x318522){return db['MailAccount'][_0xad0f('0x65')]({'where':{'id':_0xbc4973['params']['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0x318522,null))[_0xad0f('0x10')](function(_0x508ce){if(_0x508ce&&_0x508ce[_0xad0f('0x3c')]){throw new db['Sequelize']['ValidationError'](_0xad0f('0xb5'));}return _0x508ce;})[_0xad0f('0x10')](removeEntity(_0x318522,null))['catch'](handleError(_0x318522,null));};exports[_0xad0f('0xb6')]=function(_0x2d977b,_0x3d4132){return db[_0xad0f('0x45')][_0xad0f('0x65')]({'where':{'id':_0x2d977b[_0xad0f('0x5f')]['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0x3d4132,null))['then'](function(_0x259a41){if(_0x259a41){return _0x259a41[_0xad0f('0xb6')](_0x2d977b[_0xad0f('0x62')][_0xad0f('0x6d')],_['omit'](_0x2d977b[_0xad0f('0x62')],['ids','id'])||{})[_0xad0f('0xb7')](function(_0x14ac57){for(var _0x47e4cc=0x0;_0x47e4cc<_0x2d977b['body']['ids'][_0xad0f('0x4f')];_0x47e4cc+=0x1){socket['emit'](_0xad0f('0xb8'),{'UserId':Number(_0x2d977b[_0xad0f('0x62')][_0xad0f('0x6d')][_0x47e4cc]),'MailAccountId':Number(_0x2d977b[_0xad0f('0x5f')]['id'])});}return _0x14ac57;});}})['then'](respondWithResult(_0x3d4132,null))[_0xad0f('0x19')](handleError(_0x3d4132,null));};exports[_0xad0f('0xb9')]=function(_0x2ad065,_0x2bfb63){return db[_0xad0f('0x45')]['find']({'where':{'id':_0x2ad065[_0xad0f('0x5f')]['id']}})[_0xad0f('0x10')](handleEntityNotFound(_0x2bfb63,null))[_0xad0f('0x10')](function(_0x54f952){if(_0x54f952){return _0x54f952[_0xad0f('0xb9')](_0x2ad065[_0xad0f('0x4a')]['ids'])[_0xad0f('0x10')](function(){if(_[_0xad0f('0xba')](_0x2ad065[_0xad0f('0x4a')][_0xad0f('0x6d')])){for(var _0x2d42a5=0x0;_0x2d42a5<_0x2ad065[_0xad0f('0x4a')][_0xad0f('0x6d')]['length'];_0x2d42a5+=0x1){socket[_0xad0f('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x2ad065[_0xad0f('0x4a')][_0xad0f('0x6d')][_0x2d42a5]),'MailAccountId':Number(_0x2ad065['params']['id'])});}}else{socket[_0xad0f('0xbb')](_0xad0f('0xbc'),{'UserId':Number(_0x2ad065[_0xad0f('0x4a')][_0xad0f('0x6d')]),'MailAccountId':Number(_0x2ad065[_0xad0f('0x5f')]['id'])});}});}})[_0xad0f('0x10')](respondWithStatusCode(_0x2bfb63,null))[_0xad0f('0x19')](handleError(_0x2bfb63,null));};exports[_0xad0f('0xbd')]=function(_0x4d0db7,_0x287fbf){var _0x563c21={};var _0x455d38={};var _0x4b338c;var _0x168d70;return db[_0xad0f('0x45')][_0xad0f('0x6b')]({'where':{'id':_0x4d0db7[_0xad0f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x287fbf,null))['then'](function(_0x50685c){if(_0x50685c){_0x4b338c=_0x50685c;_0x455d38[_0xad0f('0x48')]=_[_0xad0f('0x4b')](db[_0xad0f('0x85')]['rawAttributes']);_0x455d38['query']=_['keys'](_0x4d0db7['query']);_0x455d38[_0xad0f('0x55')]=_[_0xad0f('0x4c')](_0x455d38[_0xad0f('0x48')],_0x455d38['query']);_0x563c21[_0xad0f('0x4d')]=_['intersection'](_0x455d38['model'],qs[_0xad0f('0x4e')](_0x4d0db7['query'][_0xad0f('0x4e')]));_0x563c21['attributes']=_0x563c21['attributes'][_0xad0f('0x4f')]?_0x563c21[_0xad0f('0x4d')]:_0x455d38['model'];_0x563c21[_0xad0f('0x52')]=qs[_0xad0f('0x53')](_0x4d0db7['query']['sort']);_0x563c21[_0xad0f('0x54')]=qs[_0xad0f('0x55')](_[_0xad0f('0x56')](_0x4d0db7[_0xad0f('0x4a')],_0x455d38[_0xad0f('0x55')]));if(_0x4d0db7[_0xad0f('0x4a')][_0xad0f('0x5a')]){_0x563c21[_0xad0f('0x54')]=_['merge'](_0x563c21[_0xad0f('0x54')],{'$or':_[_0xad0f('0x58')](_0x563c21[_0xad0f('0x4d')],function(_0x102bed){var _0x3937f2={};_0x3937f2[_0x102bed]={'$like':'%'+_0x4d0db7[_0xad0f('0x4a')][_0xad0f('0x5a')]+'%'};return _0x3937f2;})});}_0x563c21=_[_0xad0f('0x57')]({},_0x563c21,_0x4d0db7['options']);return _0x4b338c[_0xad0f('0xbd')](_0x563c21);}})['then'](function(_0x29d300){if(_0x29d300){_0x168d70=_0x29d300[_0xad0f('0x4f')];if(!_0x4d0db7[_0xad0f('0x4a')][_0xad0f('0x50')](_0xad0f('0x51'))){_0x563c21[_0xad0f('0x20')]=qs[_0xad0f('0x20')](_0x4d0db7[_0xad0f('0x4a')][_0xad0f('0x20')]);_0x563c21[_0xad0f('0x1e')]=qs[_0xad0f('0x1e')](_0x4d0db7[_0xad0f('0x4a')]['offset']);}return _0x4b338c[_0xad0f('0xbd')](_0x563c21);}})[_0xad0f('0x10')](function(_0x45dc96){if(_0x45dc96){return _0x45dc96?{'count':_0x168d70,'rows':_0x45dc96}:null;}})['then'](respondWithResult(_0x287fbf,null))[_0xad0f('0x19')](handleError(_0x287fbf,null));}; \ No newline at end of file +var _0xbc38=['%s\x20<%s>','attachments','root','server/files/attachments','basename','SendMail','sendMail','List','List\x20not\x20found','defaults','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','getSmtpOptions','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','then','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','get','MailAccounts','end','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','Unknown\x20email\x20service\x20provider','yahoo','smtp.mail.yahoo.com','smtp.office365.com','user','username','password','modernAuthentication','pass','CloudProviderId','service','authentication','host','Imap','port','MailServerIn','MailServerOut','Pause','map','MailAccount','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','Smtp','mandatoryDispositionPause','length','includeAll','body','provider','custom','secure','find','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','rawAttributes','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','email','ListId','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','order','CmContact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','destroy','MailApplication','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','split','inlineCss','CmList','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format'];(function(_0x34b044,_0x536ec7){var _0x3917af=function(_0x17509c){while(--_0x17509c){_0x34b044['push'](_0x34b044['shift']());}};_0x3917af(++_0x536ec7);}(_0xbc38,0x18f));var _0x8bc3=function(_0x567ac9,_0x43b49e){_0x567ac9=_0x567ac9-0x0;var _0x101959=_0xbc38[_0x567ac9];return _0x101959;};'use strict';var moment=require(_0x8bc3('0x0'));var BPromise=require('bluebird');var util=require(_0x8bc3('0x1'));var path=require(_0x8bc3('0x2'));var _=require(_0x8bc3('0x3'));var juice=require(_0x8bc3('0x4'));var Redis=require('ioredis');var qs=require(_0x8bc3('0x5'));var logger=require(_0x8bc3('0x6'))(_0x8bc3('0x7'));var config=require(_0x8bc3('0x8'));var db=require(_0x8bc3('0x9'))['db'];config['redis']=_['defaults'](config[_0x8bc3('0xa')],{'host':_0x8bc3('0xb'),'port':0x18eb});var socket=require(_0x8bc3('0xc'))(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x8bc3('0xd'));var client=jayson[_0x8bc3('0xe')][_0x8bc3('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x5bf0b3,_0x47300e,_0xadfd49,_0x14417d){return new BPromise(function(_0x30f5db,_0x5403e7){var _0x348911=_0x14417d||client;return _0x348911['request'](_0x5bf0b3,_0xadfd49)[_0x8bc3('0x10')](function(_0x53b998){logger['info']('MailAccount,\x20%s,\x20%s',_0x47300e,_0x8bc3('0x11'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x47300e,'request\x20sent',JSON[_0x8bc3('0x12')](_0x53b998));if(_0x53b998[_0x8bc3('0x13')]){if(_0x53b998[_0x8bc3('0x13')][_0x8bc3('0x14')]===0x1f4){logger[_0x8bc3('0x13')](_0x8bc3('0x15'),_0x47300e,_0x53b998[_0x8bc3('0x13')]['message']);return _0x5403e7(_0x53b998[_0x8bc3('0x13')][_0x8bc3('0x16')]);}logger[_0x8bc3('0x13')](_0x8bc3('0x15'),_0x47300e,_0x53b998[_0x8bc3('0x13')][_0x8bc3('0x16')]);return _0x30f5db(_0x53b998[_0x8bc3('0x13')][_0x8bc3('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x47300e,'request\x20sent');_0x30f5db(_0x53b998[_0x8bc3('0x17')]['message']);}})[_0x8bc3('0x18')](function(_0xfddea9){logger[_0x8bc3('0x13')](_0x8bc3('0x15'),_0x47300e,_0xfddea9);_0x5403e7(_0xfddea9);});});}function respondWithStatusCode(_0x5011d2,_0x50222c){_0x50222c=_0x50222c||0xcc;return function(_0x5998d5){if(_0x5998d5){return _0x5011d2[_0x8bc3('0x19')](_0x50222c);}return _0x5011d2[_0x8bc3('0x1a')](_0x50222c)['end']();};}function respondWithResult(_0x4037f8,_0x18836c){_0x18836c=_0x18836c||0xc8;return function(_0x3c5c39){if(_0x3c5c39){return _0x4037f8[_0x8bc3('0x1a')](_0x18836c)[_0x8bc3('0x1b')](_0x3c5c39);}};}function respondWithFilteredResult(_0x1f4936,_0x44a164){return function(_0x19f8a2){if(_0x19f8a2){var _0x32f889=typeof _0x44a164[_0x8bc3('0x1c')]===_0x8bc3('0x1d')&&typeof _0x44a164[_0x8bc3('0x1e')]===_0x8bc3('0x1d');var _0x1b01b1=_0x19f8a2[_0x8bc3('0x1f')];var _0x6d03b2=_0x32f889?0x0:_0x44a164['offset'];var _0x29db06=_0x32f889?_0x19f8a2['count']:_0x44a164[_0x8bc3('0x1c')]+_0x44a164['limit'];var _0x2c671e;if(_0x29db06>=_0x1b01b1){_0x29db06=_0x1b01b1;_0x2c671e=0xc8;}else{_0x2c671e=0xce;}_0x1f4936[_0x8bc3('0x1a')](_0x2c671e);return _0x1f4936[_0x8bc3('0x20')](_0x8bc3('0x21'),_0x6d03b2+'-'+_0x29db06+'/'+_0x1b01b1)[_0x8bc3('0x1b')](_0x19f8a2);}return null;};}function saveUpdates(_0x34d32a){return function(_0x1dd511){if(_0x1dd511){return _0x1dd511[_0x8bc3('0x22')](_0x34d32a)[_0x8bc3('0x10')](function(_0x41d7b6){return _0x41d7b6;});}return null;};}function removeEntity(_0x1abc88){return function(_0x44a0d6){if(_0x44a0d6){return _0x44a0d6['destroy']()[_0x8bc3('0x10')](function(){var _0x274e58=_0x44a0d6[_0x8bc3('0x23')]({'plain':!![]});var _0x37031f=_0x8bc3('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x37031f,'resourceId':_0x274e58['id']}})[_0x8bc3('0x10')](function(){return _0x44a0d6;});})[_0x8bc3('0x10')](function(){_0x1abc88['status'](0xcc)[_0x8bc3('0x25')]();});}};}function handleEntityNotFound(_0x3a5187){return function(_0x3360f7){if(!_0x3360f7){_0x3a5187[_0x8bc3('0x19')](0x194);}return _0x3360f7;};}function handleError(_0x4de7bf,_0x525175){_0x525175=_0x525175||0x1f4;return function(_0x1ad387){logger[_0x8bc3('0x13')](_0x1ad387['stack']);if(_0x1ad387[_0x8bc3('0x26')]){delete _0x1ad387['name'];}_0x4de7bf[_0x8bc3('0x1a')](_0x525175)[_0x8bc3('0x27')](_0x1ad387);};}function getImapHost(_0x37fcf5){switch(_0x37fcf5){case _0x8bc3('0x28'):return _0x8bc3('0x29');case'yahoo':return _0x8bc3('0x2a');case _0x8bc3('0x2b'):return'imap-mail.outlook.com';case _0x8bc3('0x2c'):return'outlook.office365.com';}throw new Error(_0x8bc3('0x2d'),_0x37fcf5);}function getSmtpHost(_0x3e074e){switch(_0x3e074e){case'gmail':return'smtp.gmail.com';case _0x8bc3('0x2e'):return _0x8bc3('0x2f');case _0x8bc3('0x2b'):return'smtp-mail.outlook.com';case _0x8bc3('0x2c'):return _0x8bc3('0x30');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3e074e);}function getAuthenticationOptions(_0x43ed6e,_0xa7aa11){var _0x5041e5={};var _0x18558c={};if(_0x43ed6e){_0x5041e5[_0x8bc3('0x31')]=_0x18558c[_0x8bc3('0x31')]=_0xa7aa11[_0x8bc3('0x32')];_0x5041e5[_0x8bc3('0x33')]=_0x18558c['pass']=_0xa7aa11[_0x8bc3('0x33')];if(_0xa7aa11[_0x8bc3('0x34')]){_0x5041e5[_0x8bc3('0x34')]=_0x18558c[_0x8bc3('0x34')]=!![];_0x5041e5['CloudProviderId']=_0x18558c['CloudProviderId']=_0xa7aa11['CloudProviderId'];_0x5041e5[_0x8bc3('0x33')]=_0x18558c[_0x8bc3('0x35')]=null;}else{_0x5041e5[_0x8bc3('0x36')]=_0x18558c[_0x8bc3('0x36')]=null;}_0x5041e5['host']=getImapHost(_0x43ed6e);_0x5041e5['port']=0x3e1;_0x18558c['host']=getSmtpHost(_0x43ed6e);_0x18558c['port']=0x24b;_0x18558c['secure']=![];_0x5041e5[_0x8bc3('0x37')]=_0x18558c['service']=null;}else{if(_0xa7aa11['authentication']){_0x5041e5[_0x8bc3('0x31')]=_0x18558c['user']=_0xa7aa11[_0x8bc3('0x32')];_0x5041e5[_0x8bc3('0x33')]=_0x18558c['pass']=_0xa7aa11['password'];}else{_0x5041e5[_0x8bc3('0x38')]=_0x18558c['authentication']=![];_0x5041e5[_0x8bc3('0x31')]=_0x18558c[_0x8bc3('0x31')]=null;_0x5041e5[_0x8bc3('0x33')]=_0x18558c[_0x8bc3('0x35')]=null;}_0x5041e5['host']=_0xa7aa11['Imap'][_0x8bc3('0x39')];_0x5041e5['port']=_0xa7aa11[_0x8bc3('0x3a')][_0x8bc3('0x3b')];_0x18558c['host']=_0xa7aa11['Smtp']['host'];_0x18558c[_0x8bc3('0x3b')]=_0xa7aa11['Smtp'][_0x8bc3('0x3b')];}return{'Imap':_0x5041e5,'Smtp':_0x18558c};}exports['index']=function(_0x442220,_0x20de94){var _0x4e26c5={'include':[{'model':db[_0x8bc3('0x3c')],'as':_0x8bc3('0x3a')},{'model':db[_0x8bc3('0x3d')],'as':'Smtp'},{'model':db[_0x8bc3('0x3e')],'as':'mandatoryDispositionPause'}]},_0x1cc685={},_0x11dd34={'count':0x0,'rows':[]};var _0x38b53e=_[_0x8bc3('0x3f')](db[_0x8bc3('0x40')]['rawAttributes'],function(_0x3265fd){return{'name':_0x3265fd[_0x8bc3('0x41')],'type':_0x3265fd['type'][_0x8bc3('0x42')]};});_0x1cc685[_0x8bc3('0x43')]=_['map'](_0x38b53e,'name');_0x1cc685[_0x8bc3('0x44')]=_[_0x8bc3('0x45')](_0x442220[_0x8bc3('0x44')]);_0x1cc685['filters']=_[_0x8bc3('0x46')](_0x1cc685[_0x8bc3('0x43')],_0x1cc685[_0x8bc3('0x44')]);_0x4e26c5['attributes']=_[_0x8bc3('0x46')](_0x1cc685[_0x8bc3('0x43')],qs['fields'](_0x442220[_0x8bc3('0x44')][_0x8bc3('0x47')]));_0x4e26c5[_0x8bc3('0x48')]=_0x4e26c5[_0x8bc3('0x48')]['length']?_0x4e26c5[_0x8bc3('0x48')]:_0x1cc685[_0x8bc3('0x43')];if(!_0x442220[_0x8bc3('0x44')][_0x8bc3('0x49')](_0x8bc3('0x4a'))){_0x4e26c5['limit']=qs['limit'](_0x442220[_0x8bc3('0x44')]['limit']);_0x4e26c5[_0x8bc3('0x1c')]=qs[_0x8bc3('0x1c')](_0x442220[_0x8bc3('0x44')][_0x8bc3('0x1c')]);}_0x4e26c5['order']=qs['sort'](_0x442220['query'][_0x8bc3('0x4b')]);_0x4e26c5[_0x8bc3('0x4c')]=qs[_0x8bc3('0x4d')](_[_0x8bc3('0x4e')](_0x442220[_0x8bc3('0x44')],_0x1cc685[_0x8bc3('0x4d')]),_0x38b53e);if(_0x442220['query'][_0x8bc3('0x4f')]){_0x4e26c5[_0x8bc3('0x4c')]=_[_0x8bc3('0x50')](_0x4e26c5[_0x8bc3('0x4c')],{'$or':_[_0x8bc3('0x3f')](_0x38b53e,function(_0x1dc6d4){if(_0x1dc6d4['type']!=='VIRTUAL'){var _0x23bb59={};_0x23bb59[_0x1dc6d4[_0x8bc3('0x26')]]={'$like':'%'+_0x442220[_0x8bc3('0x44')][_0x8bc3('0x4f')]+'%'};return _0x23bb59;}})});}_0x4e26c5=_[_0x8bc3('0x50')]({},_0x4e26c5,_0x442220[_0x8bc3('0x51')]);var _0x136955={'where':_0x4e26c5[_0x8bc3('0x4c')]};return db[_0x8bc3('0x40')][_0x8bc3('0x1f')](_0x136955)['then'](function(_0x4117e6){_0x11dd34[_0x8bc3('0x1f')]=_0x4117e6;if(_0x442220[_0x8bc3('0x44')]['includeAll']){_0x4e26c5[_0x8bc3('0x52')]=[{'all':!![]}];}return db[_0x8bc3('0x40')][_0x8bc3('0x53')](_0x4e26c5);})[_0x8bc3('0x10')](function(_0x1e25e8){_0x11dd34[_0x8bc3('0x54')]=_0x1e25e8;return _0x11dd34;})[_0x8bc3('0x10')](respondWithFilteredResult(_0x20de94,_0x4e26c5))[_0x8bc3('0x18')](handleError(_0x20de94,null));};exports[_0x8bc3('0x55')]=function(_0x3432d5,_0x30b516){var _0x21d4c2={'raw':![],'where':{'id':_0x3432d5['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x8bc3('0x3a')},{'model':db['MailServerOut'],'as':_0x8bc3('0x56')},{'model':db[_0x8bc3('0x3e')],'as':_0x8bc3('0x57')}]},_0x331841={};_0x331841[_0x8bc3('0x43')]=_[_0x8bc3('0x45')](db[_0x8bc3('0x40')]['rawAttributes']);_0x331841['query']=_[_0x8bc3('0x45')](_0x3432d5[_0x8bc3('0x44')]);_0x331841[_0x8bc3('0x4d')]=_[_0x8bc3('0x46')](_0x331841[_0x8bc3('0x43')],_0x331841[_0x8bc3('0x44')]);_0x21d4c2['attributes']=_[_0x8bc3('0x46')](_0x331841[_0x8bc3('0x43')],qs[_0x8bc3('0x47')](_0x3432d5[_0x8bc3('0x44')][_0x8bc3('0x47')]));_0x21d4c2['attributes']=_0x21d4c2['attributes'][_0x8bc3('0x58')]?_0x21d4c2['attributes']:_0x331841[_0x8bc3('0x43')];if(_0x3432d5[_0x8bc3('0x44')][_0x8bc3('0x59')]){_0x21d4c2[_0x8bc3('0x52')]=[{'all':!![]}];}_0x21d4c2=_[_0x8bc3('0x50')]({},_0x21d4c2,_0x3432d5[_0x8bc3('0x51')]);return db[_0x8bc3('0x40')]['find'](_0x21d4c2)[_0x8bc3('0x10')](handleEntityNotFound(_0x30b516,null))[_0x8bc3('0x10')](respondWithResult(_0x30b516,null))[_0x8bc3('0x18')](handleError(_0x30b516,null));};exports[_0x8bc3('0x22')]=function(_0x1b9701,_0x2bfac1){if(_0x1b9701['body']['id']){delete _0x1b9701[_0x8bc3('0x5a')]['id'];}var _0x3d32bf=_0x1b9701['body'][_0x8bc3('0x5b')]===_0x8bc3('0x5c')?null:_0x1b9701['body']['provider'];var _0x5ea022=_0x1b9701[_0x8bc3('0x5a')][_0x8bc3('0x3a')]||{};var _0x1c4fa4=_0x1b9701[_0x8bc3('0x5a')][_0x8bc3('0x56')]||{};if(_0x3d32bf){_0x5ea022[_0x8bc3('0x39')]=getImapHost(_0x3d32bf);_0x5ea022['port']=0x3e1;_0x1c4fa4['host']=getSmtpHost(_0x3d32bf);_0x1c4fa4[_0x8bc3('0x3b')]=0x24b;_0x1c4fa4[_0x8bc3('0x5d')]=![];}if(_0x1c4fa4['modernAuthentication']){_0x1c4fa4['secure']=![];}else{_0x1c4fa4[_0x8bc3('0x36')]=null;}if(!_0x5ea022[_0x8bc3('0x34')])_0x5ea022[_0x8bc3('0x36')]=null;_0x1b9701['body'][_0x8bc3('0x3a')]=_0x5ea022;_0x1b9701[_0x8bc3('0x5a')][_0x8bc3('0x56')]=_0x1c4fa4;return db[_0x8bc3('0x40')][_0x8bc3('0x5e')]({'where':{'id':_0x1b9701[_0x8bc3('0x5f')]['id']},'include':[{'model':db[_0x8bc3('0x3c')],'as':'Imap'},{'model':db[_0x8bc3('0x3d')],'as':_0x8bc3('0x56')},{'model':db[_0x8bc3('0x3e')],'as':_0x8bc3('0x57')}]})[_0x8bc3('0x10')](handleEntityNotFound(_0x2bfac1,null))[_0x8bc3('0x10')](function(_0x249a8a){if(!_0x249a8a)throw new Error(_0x8bc3('0x60'));if(_0x249a8a['service'])delete _0x1b9701[_0x8bc3('0x5a')][_0x8bc3('0x3a')];return _0x249a8a;})[_0x8bc3('0x10')](saveUpdates(_0x1b9701[_0x8bc3('0x5a')],null))[_0x8bc3('0x10')](function(_0x8ff494){if(!_0x1b9701[_0x8bc3('0x5a')]['Imap'])return _0x8ff494;return db[_0x8bc3('0x3c')][_0x8bc3('0x22')](_0x1b9701[_0x8bc3('0x5a')][_0x8bc3('0x3a')],{'where':{'MailAccountId':_0x8ff494['id']}})['then'](function(){return _0x8ff494;});})['then'](function(_0x3bc091){if(!_0x1b9701['body']['Smtp'])return _0x3bc091;return db[_0x8bc3('0x3d')][_0x8bc3('0x22')](_0x1b9701[_0x8bc3('0x5a')][_0x8bc3('0x56')],{'where':{'MailAccountId':_0x3bc091['id']}})['then'](function(){return _0x3bc091;});})[_0x8bc3('0x10')](respondWithResult(_0x2bfac1,null))[_0x8bc3('0x18')](handleError(_0x2bfac1,null));};exports[_0x8bc3('0x61')]=function(_0x2ff95f,_0x2b5f2d){return db['MailAccount'][_0x8bc3('0x61')]()['then'](respondWithResult(_0x2b5f2d,null))['catch'](handleError(_0x2b5f2d,null));};exports[_0x8bc3('0x62')]=function(_0x52106b,_0x140342){if(_0x52106b['body']['id']){delete _0x52106b['body']['id'];}return db[_0x8bc3('0x40')][_0x8bc3('0x5e')]({'where':{'id':_0x52106b[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x140342,null))[_0x8bc3('0x10')](function(_0x1d9e24){if(_0x1d9e24){_0x52106b[_0x8bc3('0x5a')][_0x8bc3('0x63')]=_0x1d9e24['id'];return db['Disposition'][_0x8bc3('0x64')](_0x52106b['body']);}})['then'](respondWithResult(_0x140342,null))['catch'](handleError(_0x140342,null));};exports[_0x8bc3('0x65')]=function(_0x593c77,_0x3891b4){var _0x28e74d={'raw':![],'where':{}};var _0x1123a5={};var _0x412e1d={'count':0x0,'rows':[]};return db[_0x8bc3('0x40')]['findOne']({'where':{'id':_0x593c77[_0x8bc3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3891b4,null))[_0x8bc3('0x10')](function(_0x3e7011){if(_0x3e7011){_0x1123a5['model']=_[_0x8bc3('0x45')](db[_0x8bc3('0x66')][_0x8bc3('0x67')]);_0x1123a5[_0x8bc3('0x44')]=_['keys'](_0x593c77['query']);_0x1123a5[_0x8bc3('0x4d')]=_[_0x8bc3('0x46')](_0x1123a5[_0x8bc3('0x43')],_0x1123a5[_0x8bc3('0x44')]);_0x28e74d['attributes']=_[_0x8bc3('0x46')](_0x1123a5[_0x8bc3('0x43')],qs['fields'](_0x593c77[_0x8bc3('0x44')]['fields']));_0x28e74d[_0x8bc3('0x48')]=_0x28e74d[_0x8bc3('0x48')][_0x8bc3('0x58')]?_0x28e74d['attributes']:_0x1123a5['model'];if(!_0x593c77['query'][_0x8bc3('0x49')](_0x8bc3('0x4a'))){_0x28e74d[_0x8bc3('0x1e')]=qs['limit'](_0x593c77[_0x8bc3('0x44')][_0x8bc3('0x1e')]);_0x28e74d[_0x8bc3('0x1c')]=qs[_0x8bc3('0x1c')](_0x593c77[_0x8bc3('0x44')][_0x8bc3('0x1c')]);}_0x28e74d['order']=qs[_0x8bc3('0x4b')](_0x593c77[_0x8bc3('0x44')]['sort']);_0x28e74d[_0x8bc3('0x4c')]=qs['filters'](_['pick'](_0x593c77[_0x8bc3('0x44')],_0x1123a5[_0x8bc3('0x4d')]));_0x28e74d[_0x8bc3('0x4c')][_0x8bc3('0x63')]=_0x3e7011['id'];if(_0x593c77['query'][_0x8bc3('0x4f')]){_0x28e74d[_0x8bc3('0x4c')]=_['merge'](_0x28e74d['where'],{'$or':_[_0x8bc3('0x3f')](_0x28e74d['attributes'],function(_0x51670c){var _0x72afc9={};_0x72afc9[_0x51670c]={'$like':'%'+_0x593c77[_0x8bc3('0x44')][_0x8bc3('0x4f')]+'%'};return _0x72afc9;})});}_0x28e74d=_[_0x8bc3('0x50')]({},_0x28e74d,_0x593c77[_0x8bc3('0x51')]);return db['Disposition'][_0x8bc3('0x1f')]({'where':_0x28e74d[_0x8bc3('0x4c')]})[_0x8bc3('0x10')](function(_0x2b5eaa){_0x412e1d[_0x8bc3('0x1f')]=_0x2b5eaa;if(_0x593c77[_0x8bc3('0x44')]['includeAll']){_0x28e74d[_0x8bc3('0x52')]=[{'all':!![]}];}return db[_0x8bc3('0x66')][_0x8bc3('0x53')](_0x28e74d);})[_0x8bc3('0x10')](function(_0x3ef263){_0x412e1d[_0x8bc3('0x54')]=_0x3ef263;return _0x412e1d;});}})[_0x8bc3('0x10')](respondWithFilteredResult(_0x3891b4,_0x28e74d))[_0x8bc3('0x18')](handleError(_0x3891b4,null));};exports[_0x8bc3('0x68')]=function(_0x505263,_0x1ef7a4){return db['MailAccount'][_0x8bc3('0x5e')]({'where':{'id':_0x505263['params']['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x1ef7a4,null))[_0x8bc3('0x10')](function(_0x26a7ce){if(_0x26a7ce){return _0x26a7ce['removeDispositions'](_0x505263[_0x8bc3('0x44')][_0x8bc3('0x69')]);}})['then'](respondWithStatusCode(_0x1ef7a4,null))['catch'](handleError(_0x1ef7a4,null));};exports[_0x8bc3('0x6a')]=function(_0x3a232e,_0x2b7a3e){if(_0x3a232e[_0x8bc3('0x5a')]['id']){delete _0x3a232e[_0x8bc3('0x5a')]['id'];}return db[_0x8bc3('0x40')][_0x8bc3('0x5e')]({'where':{'id':_0x3a232e[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x2b7a3e,null))['then'](function(_0x1ee29e){if(_0x1ee29e){_0x3a232e[_0x8bc3('0x5a')][_0x8bc3('0x63')]=_0x1ee29e['id'];return db['CannedAnswer']['create'](_0x3a232e[_0x8bc3('0x5a')]);}})['then'](respondWithResult(_0x2b7a3e,null))[_0x8bc3('0x18')](handleError(_0x2b7a3e,null));};exports[_0x8bc3('0x6b')]=function(_0x27f023,_0x1f2719){var _0x1b1ec7={'raw':![],'where':{}};var _0x112951={};var _0x2e5f4f={'count':0x0,'rows':[]};return db[_0x8bc3('0x40')][_0x8bc3('0x6c')]({'where':{'id':_0x27f023[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x1f2719,null))[_0x8bc3('0x10')](function(_0x3379ce){if(_0x3379ce){_0x112951[_0x8bc3('0x43')]=_[_0x8bc3('0x45')](db[_0x8bc3('0x6d')]['rawAttributes']);_0x112951['query']=_[_0x8bc3('0x45')](_0x27f023[_0x8bc3('0x44')]);_0x112951[_0x8bc3('0x4d')]=_[_0x8bc3('0x46')](_0x112951[_0x8bc3('0x43')],_0x112951[_0x8bc3('0x44')]);_0x1b1ec7['attributes']=_[_0x8bc3('0x46')](_0x112951[_0x8bc3('0x43')],qs[_0x8bc3('0x47')](_0x27f023[_0x8bc3('0x44')][_0x8bc3('0x47')]));_0x1b1ec7['attributes']=_0x1b1ec7[_0x8bc3('0x48')][_0x8bc3('0x58')]?_0x1b1ec7[_0x8bc3('0x48')]:_0x112951['model'];if(!_0x27f023[_0x8bc3('0x44')][_0x8bc3('0x49')](_0x8bc3('0x4a'))){_0x1b1ec7[_0x8bc3('0x1e')]=qs[_0x8bc3('0x1e')](_0x27f023[_0x8bc3('0x44')][_0x8bc3('0x1e')]);_0x1b1ec7['offset']=qs[_0x8bc3('0x1c')](_0x27f023[_0x8bc3('0x44')][_0x8bc3('0x1c')]);}_0x1b1ec7['order']=qs[_0x8bc3('0x4b')](_0x27f023[_0x8bc3('0x44')][_0x8bc3('0x4b')]);_0x1b1ec7[_0x8bc3('0x4c')]=qs[_0x8bc3('0x4d')](_['pick'](_0x27f023[_0x8bc3('0x44')],_0x112951['filters']));_0x1b1ec7[_0x8bc3('0x4c')][_0x8bc3('0x63')]=_0x3379ce['id'];if(_0x27f023[_0x8bc3('0x44')]['filter']){_0x1b1ec7[_0x8bc3('0x4c')]=_['merge'](_0x1b1ec7['where'],{'$or':_['map'](_0x1b1ec7[_0x8bc3('0x48')],function(_0x3c4e27){var _0x88a15a={};_0x88a15a[_0x3c4e27]={'$like':'%'+_0x27f023[_0x8bc3('0x44')]['filter']+'%'};return _0x88a15a;})});}_0x1b1ec7=_[_0x8bc3('0x50')]({},_0x1b1ec7,_0x27f023[_0x8bc3('0x51')]);return db[_0x8bc3('0x6d')][_0x8bc3('0x1f')]({'where':_0x1b1ec7[_0x8bc3('0x4c')]})[_0x8bc3('0x10')](function(_0x38cfdf){_0x2e5f4f[_0x8bc3('0x1f')]=_0x38cfdf;if(_0x27f023[_0x8bc3('0x44')][_0x8bc3('0x59')]){_0x1b1ec7[_0x8bc3('0x52')]=[{'all':!![]}];}return db[_0x8bc3('0x6d')][_0x8bc3('0x53')](_0x1b1ec7);})['then'](function(_0xcdff80){_0x2e5f4f[_0x8bc3('0x54')]=_0xcdff80;return _0x2e5f4f;});}})['then'](respondWithFilteredResult(_0x1f2719,_0x1b1ec7))[_0x8bc3('0x18')](handleError(_0x1f2719,null));};exports[_0x8bc3('0x6e')]=function(_0x46cbf8,_0x113667){return db['MailAccount'][_0x8bc3('0x5e')]({'where':{'id':_0x46cbf8['params']['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x113667,null))[_0x8bc3('0x10')](function(_0x5d40e2){if(_0x5d40e2){return _0x5d40e2['removeAnswers'](_0x46cbf8['query'][_0x8bc3('0x69')]);}})['then'](respondWithStatusCode(_0x113667,null))[_0x8bc3('0x18')](handleError(_0x113667,null));};exports['create']=function(_0x3b457c,_0x2ad9b6){var _0x486367={'name':_0x3b457c[_0x8bc3('0x5a')][_0x8bc3('0x26')],'key':_0x3b457c[_0x8bc3('0x5a')][_0x8bc3('0x42')],'provider':_0x3b457c['body'][_0x8bc3('0x5b')]==='custom'?null:_0x3b457c[_0x8bc3('0x5a')][_0x8bc3('0x5b')],'email':_0x3b457c['body'][_0x8bc3('0x6f')],'ListId':_0x3b457c[_0x8bc3('0x5a')][_0x8bc3('0x70')],'active':!_['isNil'](_0x3b457c['body'][_0x8bc3('0x71')])?_0x3b457c[_0x8bc3('0x5a')][_0x8bc3('0x71')]:!![],'description':_0x3b457c[_0x8bc3('0x5a')]['description']||null};var _0x4e1014=getAuthenticationOptions(_0x486367[_0x8bc3('0x5b')],_0x3b457c[_0x8bc3('0x5a')]);_0x486367[_0x8bc3('0x3a')]=_0x4e1014[_0x8bc3('0x3a')];_0x486367[_0x8bc3('0x56')]=_0x4e1014['Smtp'];return db[_0x8bc3('0x40')][_0x8bc3('0x64')](_0x486367,{'include':[{'model':db['MailServerOut'],'as':_0x8bc3('0x56')},{'model':db[_0x8bc3('0x3c')],'as':_0x8bc3('0x3a')}]})[_0x8bc3('0x10')](function(_0x507bbe){var _0x521c1f=_0x3b457c[_0x8bc3('0x31')][_0x8bc3('0x23')]({'plain':!![]});if(!_0x521c1f)throw new Error(_0x8bc3('0x72'));if(_0x521c1f[_0x8bc3('0x73')]===_0x8bc3('0x31')){var _0x2f8fc4=_0x507bbe[_0x8bc3('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x8bc3('0x5e')]({'where':{'name':_0x8bc3('0x24'),'userProfileId':_0x521c1f[_0x8bc3('0x74')]},'raw':!![]})['then'](function(_0x3be945){if(_0x3be945&&_0x3be945[_0x8bc3('0x75')]===0x0){return db['UserProfileResource']['create']({'name':_0x2f8fc4[_0x8bc3('0x26')],'resourceId':_0x2f8fc4['id'],'type':_0x3be945[_0x8bc3('0x26')],'sectionId':_0x3be945['id']},{})['then'](function(){return _0x507bbe;});}else{return _0x507bbe;}})['catch'](function(_0x2e8cb0){logger['error'](_0x8bc3('0x76'),_0x2e8cb0);throw _0x2e8cb0;});}return _0x507bbe;})[_0x8bc3('0x10')](respondWithResult(_0x2ad9b6,0xc9))['catch'](handleError(_0x2ad9b6,null));};exports[_0x8bc3('0x77')]=function(_0x540f5a,_0x5505cb){return db[_0x8bc3('0x40')][_0x8bc3('0x6c')]({'where':{'id':_0x540f5a[_0x8bc3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5505cb,null))['then'](function(_0x1b80d8){if(_0x1b80d8){return _0x1b80d8['getImap']();}return null;})[_0x8bc3('0x10')](respondWithResult(_0x5505cb,null))[_0x8bc3('0x18')](handleError(_0x5505cb,null));};exports[_0x8bc3('0x78')]=function(_0x54f5eb,_0x464550){if(_0x54f5eb['body']['id']){delete _0x54f5eb['body']['id'];}return db[_0x8bc3('0x40')]['find']({'where':{'id':_0x54f5eb[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x464550,null))[_0x8bc3('0x10')](function(_0x5a066d){if(_0x5a066d){_0x54f5eb[_0x8bc3('0x5a')][_0x8bc3('0x63')]=_0x5a066d['id'];return db[_0x8bc3('0x3c')][_0x8bc3('0x64')](_0x54f5eb[_0x8bc3('0x5a')]);}})[_0x8bc3('0x10')](respondWithResult(_0x464550,null))[_0x8bc3('0x18')](handleError(_0x464550,null));};exports[_0x8bc3('0x79')]=function(_0x23ace3,_0x5bb0cf){return db[_0x8bc3('0x40')][_0x8bc3('0x6c')]({'where':{'id':_0x23ace3['params']['id']}})['then'](handleEntityNotFound(_0x5bb0cf,null))['then'](function(_0x3c6bc6){if(_0x3c6bc6){return _0x3c6bc6['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x5bb0cf,null))[_0x8bc3('0x18')](handleError(_0x5bb0cf,null));};exports[_0x8bc3('0x7a')]=function(_0x40c06f,_0xec28d8){return db[_0x8bc3('0x40')]['findOne']({'where':{'id':_0x40c06f[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0xec28d8,null))[_0x8bc3('0x10')](function(_0x4e588b){if(_0x4e588b){return _0x4e588b[_0x8bc3('0x7a')]();}return null;})['then'](respondWithResult(_0xec28d8,null))['catch'](handleError(_0xec28d8,null));};exports['addSmtp']=function(_0x98e1aa,_0x1dd4fc){if(_0x98e1aa[_0x8bc3('0x5a')]['id']){delete _0x98e1aa['body']['id'];}return db[_0x8bc3('0x40')][_0x8bc3('0x5e')]({'where':{'id':_0x98e1aa[_0x8bc3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1dd4fc,null))[_0x8bc3('0x10')](function(_0x3f1b4c){if(_0x3f1b4c){_0x98e1aa[_0x8bc3('0x5a')][_0x8bc3('0x63')]=_0x3f1b4c['id'];return db[_0x8bc3('0x3d')]['create'](_0x98e1aa['body']);}})[_0x8bc3('0x10')](respondWithResult(_0x1dd4fc,null))[_0x8bc3('0x18')](handleError(_0x1dd4fc,null));};exports[_0x8bc3('0x7b')]=function(_0x1353fc,_0x204f3e){return db[_0x8bc3('0x40')][_0x8bc3('0x6c')]({'where':{'id':_0x1353fc[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x204f3e,null))['then'](function(_0x4c1da0){if(_0x4c1da0){return _0x4c1da0[_0x8bc3('0x7c')](null);}return null;})[_0x8bc3('0x10')](respondWithStatusCode(_0x204f3e,null))[_0x8bc3('0x18')](handleError(_0x204f3e,null));};exports[_0x8bc3('0x7d')]=function(_0x3f4090,_0x20ed58){return db['MailInteraction']['find']({'where':{'id':_0x3f4090['params']['id']}})['then'](handleEntityNotFound(_0x20ed58,null))['then'](function(_0x2afa49){if(_0x2afa49){return _0x2afa49[_0x8bc3('0x7d')](_0x3f4090[_0x8bc3('0x5a')]['ids'],_[_0x8bc3('0x7e')](_0x3f4090[_0x8bc3('0x5a')],[_0x8bc3('0x69'),'id'])||{});}})['then'](respondWithResult(_0x20ed58,null))[_0x8bc3('0x18')](handleError(_0x20ed58,null));};exports['getInteractions']=function(_0x37ef4c,_0x428a6f){var _0x3a6dea={'raw':![],'where':{}};var _0x6fa2c7={};var _0x14a72d={'count':0x0,'rows':[]};return db[_0x8bc3('0x40')][_0x8bc3('0x6c')]({'where':{'id':_0x37ef4c[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x428a6f,null))['then'](function(_0x53da57){if(_0x53da57){_0x6fa2c7[_0x8bc3('0x43')]=_[_0x8bc3('0x45')](db[_0x8bc3('0x7f')]['rawAttributes']);_0x6fa2c7[_0x8bc3('0x44')]=_[_0x8bc3('0x45')](_0x37ef4c[_0x8bc3('0x44')]);_0x6fa2c7['filters']=_[_0x8bc3('0x46')](_0x6fa2c7[_0x8bc3('0x43')],_0x6fa2c7['query']);_0x3a6dea[_0x8bc3('0x48')]=_[_0x8bc3('0x46')](_0x6fa2c7[_0x8bc3('0x43')],qs[_0x8bc3('0x47')](_0x37ef4c[_0x8bc3('0x44')][_0x8bc3('0x47')]));_0x3a6dea[_0x8bc3('0x48')]=_0x3a6dea[_0x8bc3('0x48')][_0x8bc3('0x58')]?_0x3a6dea[_0x8bc3('0x48')]:_0x6fa2c7[_0x8bc3('0x43')];if(!_0x37ef4c[_0x8bc3('0x44')]['hasOwnProperty'](_0x8bc3('0x4a'))){_0x3a6dea['limit']=qs[_0x8bc3('0x1e')](_0x37ef4c[_0x8bc3('0x44')][_0x8bc3('0x1e')]);_0x3a6dea['offset']=qs[_0x8bc3('0x1c')](_0x37ef4c[_0x8bc3('0x44')][_0x8bc3('0x1c')]);}_0x3a6dea[_0x8bc3('0x80')]=qs['sort'](_0x37ef4c[_0x8bc3('0x44')]['sort']);_0x3a6dea[_0x8bc3('0x4c')]=qs[_0x8bc3('0x4d')](_[_0x8bc3('0x4e')](_0x37ef4c[_0x8bc3('0x44')],_0x6fa2c7[_0x8bc3('0x4d')]));_0x3a6dea['where'][_0x8bc3('0x63')]=_0x53da57['id'];if(_0x37ef4c[_0x8bc3('0x44')]['filter']){_0x3a6dea[_0x8bc3('0x4c')]=_[_0x8bc3('0x50')](_0x3a6dea[_0x8bc3('0x4c')],{'$or':_[_0x8bc3('0x3f')](_0x3a6dea[_0x8bc3('0x48')],function(_0x9bf85a){var _0xab8216={};_0xab8216[_0x9bf85a]={'$like':'%'+_0x37ef4c['query'][_0x8bc3('0x4f')]+'%'};return _0xab8216;})});}_0x3a6dea=_[_0x8bc3('0x50')]({},_0x3a6dea,_0x37ef4c[_0x8bc3('0x51')]);return db[_0x8bc3('0x7f')][_0x8bc3('0x1f')]({'where':_0x3a6dea[_0x8bc3('0x4c')]})[_0x8bc3('0x10')](function(_0x4359aa){_0x14a72d[_0x8bc3('0x1f')]=_0x4359aa;if(_0x37ef4c[_0x8bc3('0x44')][_0x8bc3('0x59')]){_0x3a6dea[_0x8bc3('0x52')]=[{'model':db[_0x8bc3('0x81')],'as':'Contact','required':![]},{'model':db[_0x8bc3('0x82')],'as':_0x8bc3('0x83'),'attributes':[_0x8bc3('0x26'),_0x8bc3('0x84'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x8bc3('0x85'),'attributes':['id',_0x8bc3('0x26'),_0x8bc3('0x86')],'where':_0x37ef4c[_0x8bc3('0x44')][_0x8bc3('0x87')]?{'id':_0x37ef4c[_0x8bc3('0x44')]['tag']}:undefined,'required':_0x37ef4c[_0x8bc3('0x44')][_0x8bc3('0x87')]?!![]:![]}];}return db[_0x8bc3('0x7f')][_0x8bc3('0x53')](_0x3a6dea);})[_0x8bc3('0x10')](function(_0x443e0f){_0x14a72d[_0x8bc3('0x54')]=_0x443e0f;return _0x14a72d;});}})['then'](respondWithFilteredResult(_0x428a6f,_0x3a6dea))[_0x8bc3('0x18')](handleError(_0x428a6f,null));};exports[_0x8bc3('0x88')]=function addApplications(_0x5b4d3a,_0x6da731){var _0x40648b=_0x5b4d3a['params']['id'];var _0x1943d3=_0x5b4d3a[_0x8bc3('0x5a')];var _0x73884d=0xc8;var _0x372e63=null;return db[_0x8bc3('0x89')][_0x8bc3('0x8a')]({'isolationLevel':db[_0x8bc3('0x89')][_0x8bc3('0x8b')][_0x8bc3('0x8c')][_0x8bc3('0x8d')]},function(_0x5c6c66){return db[_0x8bc3('0x40')][_0x8bc3('0x6c')]({'where':{'id':_0x40648b},'transaction':_0x5c6c66})['then'](function(_0x478d6a){if(_0x478d6a){return db['MailApplication'][_0x8bc3('0x8e')]({'where':{'MailAccountId':_0x40648b},'transaction':_0x5c6c66})[_0x8bc3('0x10')](function(){var _0x28cf81=_[_0x8bc3('0x3f')](_0x1943d3,function(_0x2a35e1){_0x2a35e1[_0x8bc3('0x63')]=_0x40648b;return _0x2a35e1;});return db[_0x8bc3('0x8f')]['bulkCreate'](_0x28cf81,{'transaction':_0x5c6c66});});}else{_0x73884d=0x194;_0x372e63=[];}});})[_0x8bc3('0x10')](function(){if(_0x73884d!==0x194){return db[_0x8bc3('0x8f')][_0x8bc3('0x90')]({'where':{'MailAccountId':_0x40648b},'order':_0x8bc3('0x91')})[_0x8bc3('0x10')](function(_0x1ff9f5){_0x372e63=_0x1ff9f5;});}})['catch'](function(_0x3ee21e){_0x73884d=0x1f4;logger[_0x8bc3('0x13')](_0x3ee21e['stack']);if(_0x3ee21e[_0x8bc3('0x26')]){delete _0x3ee21e[_0x8bc3('0x26')];}_0x372e63=_0x3ee21e;})[_0x8bc3('0x92')](function(){if(_0x372e63===null){_0x6da731[_0x8bc3('0x19')](_0x73884d);}else{if(_0x73884d===0x1f4){_0x6da731[_0x8bc3('0x1a')](_0x73884d)['send'](_0x372e63);}else{_0x6da731[_0x8bc3('0x1a')](_0x73884d)[_0x8bc3('0x1b')](_0x372e63);}}});};exports[_0x8bc3('0x93')]=function(_0x262327,_0x3284b7){var _0x1f9893={};var _0x59545a={};var _0x5de574;var _0x1325fe;return db[_0x8bc3('0x40')][_0x8bc3('0x6c')]({'where':{'id':_0x262327[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x3284b7,null))[_0x8bc3('0x10')](function(_0x4d4e73){if(_0x4d4e73){_0x5de574=_0x4d4e73;_0x59545a[_0x8bc3('0x43')]=_[_0x8bc3('0x45')](db['MailApplication'][_0x8bc3('0x67')]);_0x59545a[_0x8bc3('0x44')]=_[_0x8bc3('0x45')](_0x262327[_0x8bc3('0x44')]);_0x59545a['filters']=_[_0x8bc3('0x46')](_0x59545a[_0x8bc3('0x43')],_0x59545a[_0x8bc3('0x44')]);_0x1f9893['attributes']=_[_0x8bc3('0x46')](_0x59545a[_0x8bc3('0x43')],qs[_0x8bc3('0x47')](_0x262327['query'][_0x8bc3('0x47')]));_0x1f9893[_0x8bc3('0x48')]=_0x1f9893[_0x8bc3('0x48')]['length']?_0x1f9893['attributes']:_0x59545a[_0x8bc3('0x43')];_0x1f9893[_0x8bc3('0x80')]=qs['sort'](_0x262327[_0x8bc3('0x44')]['sort']);_0x1f9893[_0x8bc3('0x4c')]=qs[_0x8bc3('0x4d')](_[_0x8bc3('0x4e')](_0x262327[_0x8bc3('0x44')],_0x59545a[_0x8bc3('0x4d')]));if(_0x262327['query'][_0x8bc3('0x4f')]){_0x1f9893['where']=_[_0x8bc3('0x50')](_0x1f9893[_0x8bc3('0x4c')],{'$or':_[_0x8bc3('0x3f')](_0x1f9893['attributes'],function(_0x35a809){var _0x215b52={};_0x215b52[_0x35a809]={'$like':'%'+_0x262327[_0x8bc3('0x44')][_0x8bc3('0x4f')]+'%'};return _0x215b52;})});}_0x1f9893=_[_0x8bc3('0x50')]({},_0x1f9893,_0x262327['options']);return _0x5de574['getApplications'](_0x1f9893);}})['then'](function(_0x52d0fb){if(_0x52d0fb){_0x1325fe=_0x52d0fb[_0x8bc3('0x58')];if(!_0x262327[_0x8bc3('0x44')][_0x8bc3('0x49')](_0x8bc3('0x4a'))){_0x1f9893[_0x8bc3('0x1e')]=qs[_0x8bc3('0x1e')](_0x262327[_0x8bc3('0x44')][_0x8bc3('0x1e')]);_0x1f9893[_0x8bc3('0x1c')]=qs[_0x8bc3('0x1c')](_0x262327['query'][_0x8bc3('0x1c')]);}return _0x5de574[_0x8bc3('0x93')](_0x1f9893);}})['then'](function(_0x11b7d6){if(_0x11b7d6){return _0x11b7d6?{'count':_0x1325fe,'rows':_0x11b7d6}:null;}})[_0x8bc3('0x10')](respondWithResult(_0x3284b7,null))['catch'](handleError(_0x3284b7,null));};exports['getMessages']=function(_0xa34283,_0x5c7c84){var _0x3d74dc={'raw':!![],'where':{}};var _0x5c918a={};var _0x4f554d={'count':0x0,'rows':[]};return db[_0x8bc3('0x40')][_0x8bc3('0x6c')]({'where':{'id':_0xa34283[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x5c7c84,null))[_0x8bc3('0x10')](function(_0x1ca45a){if(_0x1ca45a){_0x5c918a['model']=_['keys'](db[_0x8bc3('0x94')][_0x8bc3('0x67')]);_0x5c918a[_0x8bc3('0x44')]=_[_0x8bc3('0x45')](_0xa34283[_0x8bc3('0x44')]);_0x5c918a[_0x8bc3('0x4d')]=_[_0x8bc3('0x46')](_0x5c918a['model'],_0x5c918a[_0x8bc3('0x44')]);_0x3d74dc[_0x8bc3('0x48')]=_[_0x8bc3('0x46')](_0x5c918a['model'],qs[_0x8bc3('0x47')](_0xa34283[_0x8bc3('0x44')][_0x8bc3('0x47')]));_0x3d74dc[_0x8bc3('0x48')]=_0x3d74dc['attributes'][_0x8bc3('0x58')]?_0x3d74dc[_0x8bc3('0x48')]:_0x5c918a[_0x8bc3('0x43')];if(!_0xa34283[_0x8bc3('0x44')][_0x8bc3('0x49')](_0x8bc3('0x4a'))){_0x3d74dc[_0x8bc3('0x1e')]=qs[_0x8bc3('0x1e')](_0xa34283[_0x8bc3('0x44')][_0x8bc3('0x1e')]);_0x3d74dc[_0x8bc3('0x1c')]=qs[_0x8bc3('0x1c')](_0xa34283[_0x8bc3('0x44')][_0x8bc3('0x1c')]);}_0x3d74dc[_0x8bc3('0x80')]=qs[_0x8bc3('0x4b')](_0xa34283[_0x8bc3('0x44')]['sort']);_0x3d74dc['where']=qs['filters'](_[_0x8bc3('0x4e')](_0xa34283['query'],_0x5c918a[_0x8bc3('0x4d')]));_0x3d74dc[_0x8bc3('0x4c')][_0x8bc3('0x63')]=_0x1ca45a['id'];if(_0xa34283['query']['filter']){_0x3d74dc[_0x8bc3('0x4c')]=_[_0x8bc3('0x50')](_0x3d74dc[_0x8bc3('0x4c')],{'$or':_[_0x8bc3('0x3f')](_0x3d74dc[_0x8bc3('0x48')],function(_0x3fbaa){var _0x29c974={};_0x29c974[_0x3fbaa]={'$like':'%'+_0xa34283[_0x8bc3('0x44')][_0x8bc3('0x4f')]+'%'};return _0x29c974;})});}if(_0xa34283['query'][_0x8bc3('0x95')]){var _0x5d0cb7=_0xa34283[_0x8bc3('0x44')][_0x8bc3('0x95')][_0x8bc3('0x96')](',');var _0x4a8ea4={};_0x4a8ea4[_0x5d0cb7[0x0]]={'$gte':moment(_0x5d0cb7[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3d74dc[_0x8bc3('0x4c')]=_[_0x8bc3('0x50')](_0x3d74dc[_0x8bc3('0x4c')],_0x4a8ea4);}_0x3d74dc=_[_0x8bc3('0x50')]({},_0x3d74dc,_0xa34283['options']);return db[_0x8bc3('0x94')][_0x8bc3('0x1f')]({'where':_0x3d74dc[_0x8bc3('0x4c')]})[_0x8bc3('0x10')](function(_0x48be56){_0x4f554d['count']=_0x48be56;if(_0xa34283['query'][_0x8bc3('0x59')]){_0x3d74dc[_0x8bc3('0x52')]=[{'all':!![]}];}return db[_0x8bc3('0x94')][_0x8bc3('0x53')](_0x3d74dc);})[_0x8bc3('0x10')](function(_0xde918c){if(_0xa34283[_0x8bc3('0x44')][_0x8bc3('0x97')]==='true'){for(var _0xd3ac3=0x0;_0xd3ac3<_0xde918c[_0x8bc3('0x58')];_0xd3ac3++){_0xde918c[_0xd3ac3][_0x8bc3('0x5a')]=juice(_0xde918c[_0xd3ac3]['body']);}}_0x4f554d[_0x8bc3('0x54')]=_0xde918c;return _0x4f554d;});}})[_0x8bc3('0x10')](respondWithFilteredResult(_0x5c7c84,_0x3d74dc))[_0x8bc3('0x18')](handleError(_0x5c7c84,null));};exports['send']=function(_0x158ff6,_0xb229c4){var _0x514f43,_0x98048c={},_0x184cac;if(_0x158ff6[_0x8bc3('0x5a')]['to']){_0x184cac=_0x158ff6[_0x8bc3('0x5a')]['to'][_0x8bc3('0x96')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x158ff6[_0x8bc3('0x5f')]['id']},'include':[{'model':db[_0x8bc3('0x98')],'as':'List','include':[{'model':db[_0x8bc3('0x81')],'as':_0x8bc3('0x99'),'where':{'email':_0x184cac},'limit':0x1,'order':[['updatedAt',_0x8bc3('0x9a')]]}]},{'model':db['MailServerOut'],'as':_0x8bc3('0x56'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x8bc3('0x9b'),'raw':!![]}]}]})[_0x8bc3('0x10')](handleEntityNotFound(_0xb229c4,null))['then'](function(_0xbed07b){if(!_0xbed07b)return;_0x514f43=_0xbed07b;if(!_0xbed07b['Smtp'])throw new Error(_0x8bc3('0x9c'));if(_['isNil'](_0x158ff6[_0x8bc3('0x5a')]['from'])){_0x158ff6['body'][_0x8bc3('0x9d')]=util[_0x8bc3('0x9e')](_0x8bc3('0x9f'),_0xbed07b[_0x8bc3('0x26')],_0xbed07b[_0x8bc3('0x6f')]||_0xbed07b[_0x8bc3('0x56')]['user']);}if(_0x158ff6[_0x8bc3('0x5a')][_0x8bc3('0xa0')]&&_0x158ff6[_0x8bc3('0x5a')][_0x8bc3('0xa0')][_0x8bc3('0x58')]){for(var _0x5d17b2=0x0;_0x5d17b2<_0x158ff6[_0x8bc3('0x5a')][_0x8bc3('0xa0')][_0x8bc3('0x58')];_0x5d17b2+=0x1){_0x158ff6[_0x8bc3('0x5a')][_0x8bc3('0xa0')][_0x5d17b2]={'filename':_0x158ff6['body'][_0x8bc3('0xa0')][_0x5d17b2][_0x8bc3('0x26')],'path':path['join'](config[_0x8bc3('0xa1')],_0x8bc3('0xa2'),_0x158ff6[_0x8bc3('0x5a')][_0x8bc3('0xa0')][_0x5d17b2][_0x8bc3('0xa3')])};}}var _0x40cc3a=_0xbed07b['getSmtpOptions']();return respondWithRpcPromise(_0x8bc3('0xa4'),_0x8bc3('0xa5'),{'account':_0x40cc3a,'message':_0x158ff6[_0x8bc3('0x5a')]});})[_0x8bc3('0x10')](function(_0x5527b1){if(!_0x5527b1)return;_0x98048c=_0x5527b1;if(!_0x514f43[_0x8bc3('0xa6')])throw new Error(_0x8bc3('0xa7'));if(_0x514f43['List'][_0x8bc3('0x99')]['length'])return _0x514f43[_0x8bc3('0xa6')]['Contacts'][0x0];return db[_0x8bc3('0x81')][_0x8bc3('0x64')](_[_0x8bc3('0xa8')](_0x158ff6[_0x8bc3('0x5a')],{'firstName':_0x158ff6[_0x8bc3('0x5a')]['to'],'email':_0x158ff6['body']['to'],'phone':_0x158ff6[_0x8bc3('0x5a')]['to'],'ListId':_0x514f43[_0x8bc3('0x70')]}));})[_0x8bc3('0x10')](function(_0x337994){if(!_0x337994)return;var _0x506b92={'UserId':_0x158ff6['user']['id'],'ContactId':_0x337994['id'],'MailAccountId':_0x514f43['id'],'inReplyTo':_0x98048c[_0x8bc3('0xa9')],'to':_0x158ff6[_0x8bc3('0x5a')][_0x8bc3('0x9d')],'cc':_0x158ff6[_0x8bc3('0x5a')]['cc'],'subject':_0x158ff6[_0x8bc3('0x5a')][_0x8bc3('0xaa')],'attach':_0x158ff6[_0x8bc3('0x5a')][_0x8bc3('0xab')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x8bc3('0x9e')](_0x8bc3('0xac')),'lastMsgDirection':_0x8bc3('0xad'),'Messages':[_[_0x8bc3('0x50')](_0x158ff6['body'],{'messageId':_0x98048c['messageId'],'sentAt':moment()[_0x8bc3('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x514f43['id'],'UserId':_0x158ff6['user']['id'],'ContactId':_0x337994['id']})]};if(_0x158ff6[_0x8bc3('0x5a')]['Interaction']){_0x506b92=_[_0x8bc3('0x50')](_0x506b92,_0x158ff6['body'][_0x8bc3('0xae')]);}return db[_0x8bc3('0x7f')]['create'](_0x506b92,{'include':[{'model':db[_0x8bc3('0x94')],'as':_0x8bc3('0xaf')}]});})[_0x8bc3('0x10')](respondWithResult(_0xb229c4,null))[_0x8bc3('0x18')](handleError(_0xb229c4,null));};exports['verifySmtp']=function(_0x2d6857,_0x77ae78){return db[_0x8bc3('0x40')][_0x8bc3('0x5e')]({'where':{'id':_0x2d6857[_0x8bc3('0x5f')]['id']},'include':[{'model':db[_0x8bc3('0x3d')],'as':_0x8bc3('0x56'),'raw':!![],'include':[{'model':db[_0x8bc3('0x9b')],'as':_0x8bc3('0x9b'),'raw':!![]}]}]})[_0x8bc3('0x10')](handleEntityNotFound(_0x77ae78,null))[_0x8bc3('0x10')](function(_0x5d9d91){if(!_0x5d9d91[_0x8bc3('0x56')])return;var _0x4f91fb=_0x5d9d91[_0x8bc3('0xb0')]();return respondWithRpcPromise('VerifySmtp',_0x8bc3('0xb1'),{'account':_0x4f91fb});})[_0x8bc3('0x10')](respondWithResult(_0x77ae78,null))[_0x8bc3('0x18')](handleError(_0x77ae78,null));};exports[_0x8bc3('0x8e')]=function(_0x1bd022,_0x60cf5b){return db[_0x8bc3('0x40')]['find']({'where':{'id':_0x1bd022[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x60cf5b,null))['then'](function(_0x3781a1){if(_0x3781a1&&_0x3781a1[_0x8bc3('0x37')]){throw new db[(_0x8bc3('0xb2'))][(_0x8bc3('0xb3'))](_0x8bc3('0xb4'));}return _0x3781a1;})[_0x8bc3('0x10')](removeEntity(_0x60cf5b,null))[_0x8bc3('0x18')](handleError(_0x60cf5b,null));};exports[_0x8bc3('0xb5')]=function(_0x2bc577,_0x3ae396){return db[_0x8bc3('0x40')][_0x8bc3('0x5e')]({'where':{'id':_0x2bc577[_0x8bc3('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3ae396,null))[_0x8bc3('0x10')](function(_0x462812){if(_0x462812){return _0x462812[_0x8bc3('0xb5')](_0x2bc577[_0x8bc3('0x5a')][_0x8bc3('0x69')],_['omit'](_0x2bc577[_0x8bc3('0x5a')],[_0x8bc3('0x69'),'id'])||{})['spread'](function(_0x3a3bd2){for(var _0x39a8ed=0x0;_0x39a8ed<_0x2bc577[_0x8bc3('0x5a')][_0x8bc3('0x69')][_0x8bc3('0x58')];_0x39a8ed+=0x1){socket[_0x8bc3('0xb6')]('userMailAccount:save',{'UserId':Number(_0x2bc577[_0x8bc3('0x5a')][_0x8bc3('0x69')][_0x39a8ed]),'MailAccountId':Number(_0x2bc577[_0x8bc3('0x5f')]['id'])});}return _0x3a3bd2;});}})[_0x8bc3('0x10')](respondWithResult(_0x3ae396,null))[_0x8bc3('0x18')](handleError(_0x3ae396,null));};exports[_0x8bc3('0xb7')]=function(_0x34cfa3,_0x1da473){return db['MailAccount']['find']({'where':{'id':_0x34cfa3[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x1da473,null))[_0x8bc3('0x10')](function(_0x1872df){if(_0x1872df){return _0x1872df['removeAgents'](_0x34cfa3[_0x8bc3('0x44')]['ids'])[_0x8bc3('0x10')](function(){if(_['isArray'](_0x34cfa3[_0x8bc3('0x44')]['ids'])){for(var _0x444957=0x0;_0x444957<_0x34cfa3['query'][_0x8bc3('0x69')]['length'];_0x444957+=0x1){socket[_0x8bc3('0xb6')](_0x8bc3('0xb8'),{'UserId':Number(_0x34cfa3[_0x8bc3('0x44')][_0x8bc3('0x69')][_0x444957]),'MailAccountId':Number(_0x34cfa3['params']['id'])});}}else{socket['emit'](_0x8bc3('0xb8'),{'UserId':Number(_0x34cfa3[_0x8bc3('0x44')][_0x8bc3('0x69')]),'MailAccountId':Number(_0x34cfa3[_0x8bc3('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x1da473,null))['catch'](handleError(_0x1da473,null));};exports[_0x8bc3('0xb9')]=function(_0x28ee36,_0x5e50b2){var _0x4a60d0={};var _0x11e18e={};var _0x3772b4;var _0x44fc08;return db['MailAccount']['findOne']({'where':{'id':_0x28ee36[_0x8bc3('0x5f')]['id']}})[_0x8bc3('0x10')](handleEntityNotFound(_0x5e50b2,null))['then'](function(_0x2c6fdd){if(_0x2c6fdd){_0x3772b4=_0x2c6fdd;_0x11e18e['model']=_[_0x8bc3('0x45')](db[_0x8bc3('0x82')][_0x8bc3('0x67')]);_0x11e18e[_0x8bc3('0x44')]=_[_0x8bc3('0x45')](_0x28ee36[_0x8bc3('0x44')]);_0x11e18e[_0x8bc3('0x4d')]=_['intersection'](_0x11e18e[_0x8bc3('0x43')],_0x11e18e['query']);_0x4a60d0[_0x8bc3('0x48')]=_[_0x8bc3('0x46')](_0x11e18e[_0x8bc3('0x43')],qs[_0x8bc3('0x47')](_0x28ee36[_0x8bc3('0x44')]['fields']));_0x4a60d0[_0x8bc3('0x48')]=_0x4a60d0['attributes'][_0x8bc3('0x58')]?_0x4a60d0[_0x8bc3('0x48')]:_0x11e18e[_0x8bc3('0x43')];_0x4a60d0[_0x8bc3('0x80')]=qs['sort'](_0x28ee36[_0x8bc3('0x44')][_0x8bc3('0x4b')]);_0x4a60d0['where']=qs[_0x8bc3('0x4d')](_['pick'](_0x28ee36[_0x8bc3('0x44')],_0x11e18e[_0x8bc3('0x4d')]));if(_0x28ee36['query'][_0x8bc3('0x4f')]){_0x4a60d0[_0x8bc3('0x4c')]=_[_0x8bc3('0x50')](_0x4a60d0[_0x8bc3('0x4c')],{'$or':_[_0x8bc3('0x3f')](_0x4a60d0['attributes'],function(_0x5f0b2d){var _0x42b9fd={};_0x42b9fd[_0x5f0b2d]={'$like':'%'+_0x28ee36['query'][_0x8bc3('0x4f')]+'%'};return _0x42b9fd;})});}_0x4a60d0=_[_0x8bc3('0x50')]({},_0x4a60d0,_0x28ee36[_0x8bc3('0x51')]);return _0x3772b4[_0x8bc3('0xb9')](_0x4a60d0);}})[_0x8bc3('0x10')](function(_0x339974){if(_0x339974){_0x44fc08=_0x339974[_0x8bc3('0x58')];if(!_0x28ee36[_0x8bc3('0x44')][_0x8bc3('0x49')](_0x8bc3('0x4a'))){_0x4a60d0[_0x8bc3('0x1e')]=qs[_0x8bc3('0x1e')](_0x28ee36[_0x8bc3('0x44')]['limit']);_0x4a60d0['offset']=qs['offset'](_0x28ee36['query']['offset']);}return _0x3772b4[_0x8bc3('0xb9')](_0x4a60d0);}})[_0x8bc3('0x10')](function(_0x12a807){if(_0x12a807){return _0x12a807?{'count':_0x44fc08,'rows':_0x12a807}:null;}})[_0x8bc3('0x10')](respondWithResult(_0x5e50b2,null))['catch'](handleError(_0x5e50b2,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3c0c36a..bea124a 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 _0xde1a=['hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x4d5cfd,_0x5b5c6c){var _0x442f17=function(_0x32a375){while(--_0x32a375){_0x4d5cfd['push'](_0x4d5cfd['shift']());}};_0x442f17(++_0x5b5c6c);}(_0xde1a,0xfd));var _0xade1=function(_0x27478a,_0x10c3d1){_0x27478a=_0x27478a-0x0;var _0xd1db69=_0xde1a[_0x27478a];return _0xd1db69;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xade1('0x0'))['db'][_0xade1('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xade1('0x2')](0x0);var events={'afterCreate':_0xade1('0x3'),'afterUpdate':_0xade1('0x4'),'afterDestroy':_0xade1('0x5')};function emitEvent(_0x218b3b){return function(_0x30c804,_0x4bdb6d,_0x42725a){MailAccountEvents[_0xade1('0x6')](_0x218b3b+':'+_0x30c804['id'],_0x30c804);MailAccountEvents[_0xade1('0x6')](_0x218b3b,_0x30c804);_0x42725a(null);};}for(var e in events){if(events[_0xade1('0x7')](e)){var event=events[e];MailAccount[_0xade1('0x8')](e,emitEvent(event));}}module[_0xade1('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x677a=['setMaxListeners','save','update','remove','emit','hook','exports','events','MailAccount'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x677a,0xd6));var _0xa677=function(_0x472394,_0x2416d6){_0x472394=_0x472394-0x0;var _0x1ed766=_0x677a[_0x472394];return _0x1ed766;};'use strict';var EventEmitter=require(_0xa677('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xa677('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa677('0x2')](0x0);var events={'afterCreate':_0xa677('0x3'),'afterUpdate':_0xa677('0x4'),'afterDestroy':_0xa677('0x5')};function emitEvent(_0x4a7c34){return function(_0x1ca988,_0x2e46f8,_0x45eebf){MailAccountEvents[_0xa677('0x6')](_0x4a7c34+':'+_0x1ca988['id'],_0x1ca988);MailAccountEvents[_0xa677('0x6')](_0x4a7c34,_0x1ca988);_0x45eebf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xa677('0x7')](e,emitEvent(event));}}module[_0xa677('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 751e699..2b06947 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 _0x40ff=['secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','mail_accounts','provider','custom','service','port','Smtp'];(function(_0x236912,_0x4167cd){var _0x582904=function(_0x3d9a19){while(--_0x3d9a19){_0x236912['push'](_0x236912['shift']());}};_0x582904(++_0x4167cd);}(_0x40ff,0x17f));var _0xf40f=function(_0x1ded0e,_0xd412f3){_0x1ded0e=_0x1ded0e-0x0;var _0x5833d5=_0x40ff[_0x1ded0e];return _0x5833d5;};'use strict';var attributes=require(_0xf40f('0x0'));module[_0xf40f('0x1')]=function(_0x1dfe2d){return _0x1dfe2d['define']('MailAccount',attributes,{'tableName':_0xf40f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4b730f=this;var _0x5edc16={'id':_0x4b730f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4b730f[_0xf40f('0x3')]!==_0xf40f('0x4')){_0x5edc16[_0xf40f('0x5')]=_0x4b730f[_0xf40f('0x3')];}else{_0x5edc16['host']=_0x4b730f['Smtp']['host'];_0x5edc16[_0xf40f('0x6')]=_0x4b730f[_0xf40f('0x7')][_0xf40f('0x6')];_0x5edc16[_0xf40f('0x8')]=_0x4b730f[_0xf40f('0x7')][_0xf40f('0x8')];}if(_0x4b730f['Smtp'][_0xf40f('0x9')]){if(_0x4b730f['Smtp'][_0xf40f('0xa')]){if(!_0x4b730f[_0xf40f('0x7')]['CloudProvider'])throw new Error(_0xf40f('0xb'));_0x5edc16[_0xf40f('0xc')]={'type':_0xf40f('0xd'),'user':_0x4b730f[_0xf40f('0x7')][_0xf40f('0xe')],'accessToken':_0x4b730f['Smtp']['CloudProvider'][_0xf40f('0xf')]};}else{_0x5edc16['auth']={'user':_0x4b730f[_0xf40f('0x7')][_0xf40f('0xe')],'pass':_0x4b730f['Smtp'][_0xf40f('0x10')]};}}return _0x5edc16;}}});}; \ No newline at end of file +var _0xcd63=['custom','service','host','Smtp','port','secure','authentication','CloudProvider','auth','user','data5','pass','exports','define','MailAccount','mail_accounts','provider'];(function(_0x3e28ab,_0x47b1d7){var _0x3f9014=function(_0x5490a2){while(--_0x5490a2){_0x3e28ab['push'](_0x3e28ab['shift']());}};_0x3f9014(++_0x47b1d7);}(_0xcd63,0xe9));var _0x3cd6=function(_0x4e30d8,_0x33ea49){_0x4e30d8=_0x4e30d8-0x0;var _0x425e30=_0xcd63[_0x4e30d8];return _0x425e30;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x3cd6('0x0')]=function(_0x1218a6){return _0x1218a6[_0x3cd6('0x1')](_0x3cd6('0x2'),attributes,{'tableName':_0x3cd6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x20b5df=this;var _0x1e76a6={'id':_0x20b5df['id'],'tls':{'rejectUnauthorized':![]}};if(_0x20b5df[_0x3cd6('0x4')]!==_0x3cd6('0x5')){_0x1e76a6[_0x3cd6('0x6')]=_0x20b5df[_0x3cd6('0x4')];}else{_0x1e76a6[_0x3cd6('0x7')]=_0x20b5df[_0x3cd6('0x8')][_0x3cd6('0x7')];_0x1e76a6['port']=_0x20b5df[_0x3cd6('0x8')][_0x3cd6('0x9')];_0x1e76a6[_0x3cd6('0xa')]=_0x20b5df[_0x3cd6('0x8')][_0x3cd6('0xa')];}if(_0x20b5df[_0x3cd6('0x8')][_0x3cd6('0xb')]){if(_0x20b5df[_0x3cd6('0x8')]['modernAuthentication']){if(!_0x20b5df[_0x3cd6('0x8')][_0x3cd6('0xc')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x1e76a6[_0x3cd6('0xd')]={'type':'OAuth2','user':_0x20b5df[_0x3cd6('0x8')][_0x3cd6('0xe')],'accessToken':_0x20b5df[_0x3cd6('0x8')][_0x3cd6('0xc')][_0x3cd6('0xf')]};}else{_0x1e76a6['auth']={'user':_0x20b5df[_0x3cd6('0x8')][_0x3cd6('0xe')],'pass':_0x20b5df[_0x3cd6('0x8')][_0x3cd6('0x10')]};}}return _0x1e76a6;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 110d2ee..a7bfa9c 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 _0xa751=['from','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','applications','list','orderBy','priority','autoclose','push','*,*,*,*','create','List\x20not\x20found','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','update','subject','interaction','created','attachments','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','include','map','model','GetMailAccount','MailAccount','find','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','body','isNil'];(function(_0x42158d,_0xbf2f80){var _0x3587a4=function(_0x5aeff5){while(--_0x5aeff5){_0x42158d['push'](_0x42158d['shift']());}};_0x3587a4(++_0xbf2f80);}(_0xa751,0x175));var _0x1a75=function(_0x39ea16,_0x517270){_0x39ea16=_0x39ea16-0x0;var _0x5a8c5a=_0xa751[_0x39ea16];return _0x5a8c5a;};'use strict';var _=require(_0x1a75('0x0'));var moment=require(_0x1a75('0x1'));var BPromise=require(_0x1a75('0x2'));var rs=require(_0x1a75('0x3'));var Redis=require('ioredis');var db=require(_0x1a75('0x4'))['db'];var logger=require('../../config/logger')(_0x1a75('0x5'));var config=require(_0x1a75('0x6'));var jayson=require(_0x1a75('0x7'));var client=jayson['client'][_0x1a75('0x8')]({'port':0x232c});config[_0x1a75('0x9')]=_[_0x1a75('0xa')](config[_0x1a75('0x9')],{'host':_0x1a75('0xb'),'port':0x18eb});var socket=require(_0x1a75('0xc'))(new Redis(config[_0x1a75('0x9')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4f77c2,_0x41aa8f,_0x377b3b){return new BPromise(function(_0x1d7819,_0x271286){return client[_0x1a75('0xd')](_0x4f77c2,_0x377b3b)[_0x1a75('0xe')](function(_0x2d61d2){logger[_0x1a75('0xf')]('MailAccount,\x20%s,\x20%s',_0x41aa8f,'request\x20sent');logger['debug'](_0x1a75('0x10'),_0x41aa8f,_0x1a75('0x11'),JSON[_0x1a75('0x12')](_0x2d61d2));if(_0x2d61d2[_0x1a75('0x13')]){if(_0x2d61d2['error']['code']===0x1f4){logger[_0x1a75('0x13')](_0x1a75('0x14'),_0x41aa8f,_0x2d61d2['error'][_0x1a75('0x15')]);return _0x271286(_0x2d61d2[_0x1a75('0x13')]['message']);}logger[_0x1a75('0x13')](_0x1a75('0x14'),_0x41aa8f,_0x2d61d2[_0x1a75('0x13')]['message']);return _0x1d7819(_0x2d61d2['error']['message']);}else{logger[_0x1a75('0xf')](_0x1a75('0x14'),_0x41aa8f,_0x1a75('0x11'));_0x1d7819(_0x2d61d2[_0x1a75('0x16')][_0x1a75('0x15')]);}})[_0x1a75('0x17')](function(_0x47f384){logger[_0x1a75('0x13')]('MailAccount,\x20%s,\x20%s',_0x41aa8f,_0x47f384);_0x271286(_0x47f384);});});}exports['GetMailAccount']=function(_0x42df2c){var _0x3928b7=this;return new Promise(function(_0x5ae0f4,_0x42d283){return db['MailAccount'][_0x1a75('0x18')]({'raw':_0x42df2c[_0x1a75('0x19')]?_0x42df2c[_0x1a75('0x19')][_0x1a75('0x1a')]===undefined?!![]:![]:!![],'where':_0x42df2c[_0x1a75('0x19')]?_0x42df2c[_0x1a75('0x19')]['where']||null:null,'attributes':_0x42df2c[_0x1a75('0x19')]?_0x42df2c['options'][_0x1a75('0x1b')]||null:null,'limit':_0x42df2c[_0x1a75('0x19')]?_0x42df2c[_0x1a75('0x19')]['limit']||null:null,'include':_0x42df2c[_0x1a75('0x19')]?_0x42df2c['options'][_0x1a75('0x1c')]?_[_0x1a75('0x1d')](_0x42df2c[_0x1a75('0x19')]['include'],function(_0x9fe9fe){return{'model':db[_0x9fe9fe[_0x1a75('0x1e')]],'as':_0x9fe9fe['as'],'attributes':_0x9fe9fe['attributes'],'include':_0x9fe9fe[_0x1a75('0x1c')]?_[_0x1a75('0x1d')](_0x9fe9fe['include'],function(_0x168e06){return{'model':db[_0x168e06[_0x1a75('0x1e')]],'as':_0x168e06['as'],'attributes':_0x168e06[_0x1a75('0x1b')],'include':_0x168e06[_0x1a75('0x1c')]?_['map'](_0x168e06[_0x1a75('0x1c')],function(_0x2744ab){return{'model':db[_0x2744ab[_0x1a75('0x1e')]],'as':_0x2744ab['as'],'attributes':_0x2744ab[_0x1a75('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1a75('0xe')](function(_0x9e66b9){logger[_0x1a75('0xf')](_0x1a75('0x1f'),_0x42df2c);logger['debug']('GetMailAccount',_0x42df2c,JSON[_0x1a75('0x12')](_0x9e66b9));_0x5ae0f4(_0x9e66b9);})[_0x1a75('0x17')](function(_0x1a0359){logger[_0x1a75('0x13')](_0x1a75('0x1f'),_0x1a0359[_0x1a75('0x15')],_0x42df2c);_0x42d283(_0x3928b7[_0x1a75('0x13')](0x1f4,_0x1a0359[_0x1a75('0x15')]));});});};exports['ShowMailAccount']=function(_0x4d6f8d){var _0x4c30d5=this;return new Promise(function(_0xdef8cb,_0x291789){return db[_0x1a75('0x20')][_0x1a75('0x21')]({'raw':_0x4d6f8d['options']?_0x4d6f8d['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d6f8d[_0x1a75('0x19')]?_0x4d6f8d[_0x1a75('0x19')]['where']||null:null,'attributes':_0x4d6f8d['options']?_0x4d6f8d[_0x1a75('0x19')]['attributes']||null:null,'include':_0x4d6f8d[_0x1a75('0x19')]?_0x4d6f8d[_0x1a75('0x19')][_0x1a75('0x1c')]?_['map'](_0x4d6f8d['options'][_0x1a75('0x1c')],function(_0x2a2a44){return{'model':db[_0x2a2a44[_0x1a75('0x1e')]],'as':_0x2a2a44['as'],'attributes':_0x2a2a44[_0x1a75('0x1b')],'include':_0x2a2a44[_0x1a75('0x1c')]?_[_0x1a75('0x1d')](_0x2a2a44[_0x1a75('0x1c')],function(_0x3231bb){return{'model':db[_0x3231bb[_0x1a75('0x1e')]],'as':_0x3231bb['as'],'attributes':_0x3231bb[_0x1a75('0x1b')],'include':_0x3231bb[_0x1a75('0x1c')]?_[_0x1a75('0x1d')](_0x3231bb[_0x1a75('0x1c')],function(_0x37ce1f){return{'model':db[_0x37ce1f[_0x1a75('0x1e')]],'as':_0x37ce1f['as'],'attributes':_0x37ce1f[_0x1a75('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc203ad){if(_0x4d6f8d['options']['smtp']===!![])_0xc203ad[_0x1a75('0x22')](_0x1a75('0x23'),_0xc203ad[_0x1a75('0x24')]());logger[_0x1a75('0xf')](_0x1a75('0x25'),_0x4d6f8d);logger['debug'](_0x1a75('0x25'),_0x4d6f8d,JSON[_0x1a75('0x12')](_0xc203ad));_0xdef8cb(_0xc203ad);})[_0x1a75('0x17')](function(_0x32c064){logger[_0x1a75('0x13')]('ShowMailAccount',_0x32c064[_0x1a75('0x15')],_0x4d6f8d);_0x291789(_0x4c30d5['error'](0x1f4,_0x32c064[_0x1a75('0x15')]));});});};exports[_0x1a75('0x26')]=function(_0x2c6a9c){var _0x41c983=this;return new Promise(function(_0x269ed6,_0x26f836){var _0xa5002c={'body':_0x2c6a9c['body'],'channel':'mail'};var _0x25e2e5=_['difference'](_[_0x1a75('0x27')](db[_0x1a75('0x28')][_0x1a75('0x29')]),['createdAt',_0x1a75('0x2a'),_0x1a75('0x2b'),_0x1a75('0x2c')]);var _0x5a2c51=![];if(_0x2c6a9c[_0x1a75('0x2d')]['id']){delete _0x2c6a9c[_0x1a75('0x2d')]['id'];}if(_[_0x1a75('0x2e')](_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x2f')])){return _0x26f836(_0x41c983[_0x1a75('0x13')](0x1f4,_0x1a75('0x30')));}if(_['isNil'](_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x2d')])||_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x2d')]===''){return _0x26f836(_0x41c983[_0x1a75('0x13')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x1a75('0x2e')](_0x2c6a9c[_0x1a75('0x2d')]['mapKey'])){return _0x26f836(_0x41c983[_0x1a75('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25e2e5));}if(!_[_0x1a75('0x31')](_0x25e2e5,_0x2c6a9c['body'][_0x1a75('0x32')])){return _0x26f836(_0x41c983[_0x1a75('0x13')](0x1f4,_0x1a75('0x33')+_0x25e2e5));}var _0x14d113={};_0x14d113[_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x32')]]=_0x2c6a9c[_0x1a75('0x2d')]['from'];return db[_0x1a75('0x20')]['find']({'where':{'id':_0x2c6a9c[_0x1a75('0x34')]['id']},'include':[{'model':db[_0x1a75('0x35')],'as':_0x1a75('0x36'),'include':[{'model':db[_0x1a75('0x28')],'as':_0x1a75('0x37'),'where':_0x14d113,'limit':0x1,'order':[[_0x1a75('0x2a'),_0x1a75('0x38')]]}]},{'model':db[_0x1a75('0x39')],'as':'Applications'},{'model':db[_0x1a75('0x3a')],'as':_0x1a75('0x3b'),'include':[{'model':db[_0x1a75('0x3c')],'as':_0x1a75('0x3c')}]}]})[_0x1a75('0xe')](function(_0x1b76d){if(_0x1b76d&&_0x1b76d[_0x1a75('0x36')]){var _0x12b298=_0x1b76d[_0x1a75('0x3d')]({'plain':!![]});_0xa5002c[_0x1a75('0x34')]=_[_0x1a75('0x3e')](_0x12b298,[_0x1a75('0x3f'),_0x1a75('0x36')]);_0xa5002c[_0x1a75('0x34')][_0x1a75('0x23')]=_0x1b76d['getSmtpOptions']();_0xa5002c[_0x1a75('0x40')]=_0x12b298[_0x1a75('0x3f')];_0xa5002c[_0x1a75('0x41')]=_0x12b298[_0x1a75('0x36')];_0xa5002c[_0x1a75('0x40')]=_[_0x1a75('0x42')](_0xa5002c[_0x1a75('0x40')],[_0x1a75('0x43')],['asc']);if(_0xa5002c[_0x1a75('0x34')]&&_0xa5002c['account'][_0x1a75('0x44')]){_0xa5002c[_0x1a75('0x40')][_0x1a75('0x45')]({'id':0x0,'priority':_0xa5002c['applications']['length']+0x1,'app':'close','appdata':_0x1a75('0x44'),'interval':_0x1a75('0x46')});}if(_0xa5002c[_0x1a75('0x34')][_0x1a75('0x3f')]){delete _0xa5002c[_0x1a75('0x34')]['Applications'];}if(_0xa5002c[_0x1a75('0x34')][_0x1a75('0x36')]){delete _0xa5002c[_0x1a75('0x34')][_0x1a75('0x36')];}if(_0x12b298[_0x1a75('0x36')][_0x1a75('0x37')]['length']){return _0x12b298['List']['Contacts'][0x0];}var _0xba704c=_[_0x1a75('0xa')](_0x2c6a9c[_0x1a75('0x2d')],{'firstName':_0x2c6a9c['body']['from'],'ListId':_0x12b298[_0x1a75('0x2c')]});_0xba704c[_0x2c6a9c[_0x1a75('0x2d')]['mapKey']]=_0x2c6a9c[_0x1a75('0x2d')]['from'];return db['CmContact'][_0x1a75('0x47')](_0xba704c);}else{throw new Error(_0x1a75('0x48'));}})['then'](function(_0x11a069){_0xa5002c[_0x1a75('0x49')]=_0x11a069;if(_0x11a069){if(!_0x2c6a9c['body'][_0x1a75('0x15')][_0x1a75('0x4a')]){_0x2c6a9c[_0x1a75('0x2d')]['message'][_0x1a75('0x4a')]=rs['generate']()+'\x20'+_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['from'];}var _0xd5f80b={'ContactId':_0x11a069['id'],'MailAccountId':_0x2c6a9c[_0x1a75('0x34')]['id'],'inReplyTo':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['messageId'],'to':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['from'],'cc':_0x2c6a9c[_0x1a75('0x2d')]['message']['cc'],'subject':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['subject'],'attach':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x4b')],'lastMsgAt':moment()[_0x1a75('0x4c')](_0x1a75('0x4d')),'lastMsgDirection':'in'};return db[_0x1a75('0x4e')]['find']({'where':{'closed':![],'MailAccountId':_0x2c6a9c[_0x1a75('0x34')]['id']},'include':[{'model':db[_0x1a75('0x4f')],'as':_0x1a75('0x50'),'attributes':[_0x1a75('0x4a')],'where':{'messageId':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x51')]}}]})['then'](function(_0x3b4da2){if(_0x3b4da2){return[_0x3b4da2,![]];}return db['MailInteraction'][_0x1a75('0x47')](_0xd5f80b)[_0x1a75('0xe')](function(_0x4fa838){return[_0x4fa838,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x315bcb,_0x2b7a3f){if(_0x315bcb){_0x5a2c51=_0x2b7a3f;if(!_0x2b7a3f){return _0x315bcb[_0x1a75('0x52')]({'inReplyTo':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x4a')],'to':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x2f')],'cc':_0x2c6a9c[_0x1a75('0x2d')]['message']['cc'],'subject':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x53')],'attach':_0x315bcb[_0x1a75('0x4b')]?_0x315bcb[_0x1a75('0x4b')]:_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x4b')],'substatus':null,'substatusAt':moment()[_0x1a75('0x4c')](_0x1a75('0x4d')),'lastMsgAt':moment()[_0x1a75('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x315bcb;}}})['then'](function(_0x58ea57){_0xa5002c['interaction']=_0x58ea57[_0x1a75('0x3d')]({'plain':!![]});_0xa5002c[_0x1a75('0x54')][_0x1a75('0x55')]=_0x5a2c51;return db[_0x1a75('0x4f')][_0x1a75('0x47')]({'body':_0x2c6a9c[_0x1a75('0x2d')]['body'],'MailAccountId':_0x2c6a9c[_0x1a75('0x34')]['id'],'MailInteractionId':_0x58ea57['id'],'direction':'in','ContactId':_0xa5002c[_0x1a75('0x49')]['id'],'messageId':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['messageId'],'from':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x2f')],'to':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['to'],'cc':_0x2c6a9c[_0x1a75('0x2d')]['message']['cc'],'subject':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['subject'],'attach':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['attach'],'Attachments':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x56')],'originTo':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x57')],'originCc':_0x2c6a9c[_0x1a75('0x2d')]['message'][_0x1a75('0x58')],'bcc':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')][_0x1a75('0x59')],'ChatWebsiteId':_0x2c6a9c[_0x1a75('0x2d')][_0x1a75('0x15')]['ChatWebsiteId']||null,'originChannel':_0x2c6a9c['body']['message'][_0x1a75('0x5a')]||'Email','ChatOfflineMessageId':_0x2c6a9c[_0x1a75('0x2d')]['message'][_0x1a75('0x5b')]||null},{'include':[{'model':db[_0x1a75('0x5c')],'as':_0x1a75('0x5d')}]});})[_0x1a75('0xe')](function(_0x54120d){_0xa5002c[_0x1a75('0x15')]=_0x54120d;if(!_0xa5002c[_0x1a75('0x54')][_0x1a75('0x5e')]){return;}return db[_0x1a75('0x5f')][_0x1a75('0x21')]({'attributes':['id',_0x1a75('0x60')],'where':{'id':_0xa5002c[_0x1a75('0x54')][_0x1a75('0x5e')]}});})[_0x1a75('0xe')](function(_0x28658f){if(_0x28658f){_0xa5002c[_0x1a75('0x40')][_0x1a75('0x61')]({'id':0x0,'priority':0x0,'app':_0x1a75('0x62'),'appdata':_0x28658f['name']+','+(_0xa5002c[_0x1a75('0x34')]['waitForTheAssignedAgent']||0xa),'interval':_0x1a75('0x46')});}if(!_0xa5002c[_0x1a75('0x54')][_0x1a75('0x63')]){return;}return db[_0x1a75('0x64')][_0x1a75('0x21')]({'attributes':['id',_0x1a75('0x60')],'where':{'id':_0xa5002c[_0x1a75('0x54')][_0x1a75('0x63')]}});})[_0x1a75('0xe')](function(_0x4f72ad){if(_0x4f72ad){_0xa5002c['applications'][_0x1a75('0x61')]({'id':0x0,'priority':0x1,'app':_0x1a75('0x65'),'appdata':_0x4f72ad['name']+','+(_0xa5002c[_0x1a75('0x34')][_0x1a75('0x66')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1a75('0x67'),_0x1a75('0x68'),_0xa5002c);})[_0x1a75('0xe')](function(_0x53c8eb){_0x269ed6(_0x53c8eb);})[_0x1a75('0x17')](function(_0xd063a8){_0x26f836(_0x41c983[_0x1a75('0x13')](0x1f4,_0xd063a8[_0x1a75('0x15')]));});});}; \ No newline at end of file +var _0x885a=['NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','List','Contacts','Applications','MailServerOut','Smtp','CloudProvider','get','smtpOptions','applications','list','orderBy','priority','asc','autoclose','push','length','*,*,*,*','mapKey','create','List\x20not\x20found','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','subject','interaction','attachments','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','waitForTheAssignedAgent','queueId','MailQueue','queue','Start','startRouting','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','MailAccount','findAll','options','raw','attributes','limit','map','include','model','GetMailAccount','ShowMailAccount','setDataValue','getSmtpOptions'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x885a,0x180));var _0xa885=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x885a[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var moment=require(_0xa885('0x0'));var BPromise=require(_0xa885('0x1'));var rs=require(_0xa885('0x2'));var Redis=require(_0xa885('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xa885('0x4'))(_0xa885('0x5'));var config=require(_0xa885('0x6'));var jayson=require(_0xa885('0x7'));var client=jayson[_0xa885('0x8')][_0xa885('0x9')]({'port':0x232c});config['redis']=_[_0xa885('0xa')](config[_0xa885('0xb')],{'host':_0xa885('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa885('0xb')]));require(_0xa885('0xd'))[_0xa885('0xe')](socket);function respondWithRpcPromise(_0x5e49d0,_0x2305b1,_0x299f57){return new BPromise(function(_0x42ab89,_0x745710){return client[_0xa885('0xf')](_0x5e49d0,_0x299f57)[_0xa885('0x10')](function(_0xcf5f96){logger['info'](_0xa885('0x11'),_0x2305b1,_0xa885('0x12'));logger[_0xa885('0x13')](_0xa885('0x14'),_0x2305b1,_0xa885('0x12'),JSON[_0xa885('0x15')](_0xcf5f96));if(_0xcf5f96[_0xa885('0x16')]){if(_0xcf5f96['error'][_0xa885('0x17')]===0x1f4){logger[_0xa885('0x16')](_0xa885('0x11'),_0x2305b1,_0xcf5f96[_0xa885('0x16')][_0xa885('0x18')]);return _0x745710(_0xcf5f96['error'][_0xa885('0x18')]);}logger[_0xa885('0x16')]('MailAccount,\x20%s,\x20%s',_0x2305b1,_0xcf5f96[_0xa885('0x16')][_0xa885('0x18')]);return _0x42ab89(_0xcf5f96['error'][_0xa885('0x18')]);}else{logger[_0xa885('0x19')]('MailAccount,\x20%s,\x20%s',_0x2305b1,_0xa885('0x12'));_0x42ab89(_0xcf5f96['result'][_0xa885('0x18')]);}})[_0xa885('0x1a')](function(_0x8c26c){logger['error'](_0xa885('0x11'),_0x2305b1,_0x8c26c);_0x745710(_0x8c26c);});});}exports['GetMailAccount']=function(_0x127a86){var _0x1d5d0b=this;return new Promise(function(_0x113043,_0x523916){return db[_0xa885('0x1b')][_0xa885('0x1c')]({'raw':_0x127a86[_0xa885('0x1d')]?_0x127a86['options'][_0xa885('0x1e')]===undefined?!![]:![]:!![],'where':_0x127a86[_0xa885('0x1d')]?_0x127a86[_0xa885('0x1d')]['where']||null:null,'attributes':_0x127a86[_0xa885('0x1d')]?_0x127a86['options'][_0xa885('0x1f')]||null:null,'limit':_0x127a86[_0xa885('0x1d')]?_0x127a86['options'][_0xa885('0x20')]||null:null,'include':_0x127a86[_0xa885('0x1d')]?_0x127a86[_0xa885('0x1d')]['include']?_[_0xa885('0x21')](_0x127a86[_0xa885('0x1d')]['include'],function(_0x39ae58){return{'model':db[_0x39ae58['model']],'as':_0x39ae58['as'],'attributes':_0x39ae58[_0xa885('0x1f')],'include':_0x39ae58['include']?_[_0xa885('0x21')](_0x39ae58[_0xa885('0x22')],function(_0x3e347e){return{'model':db[_0x3e347e[_0xa885('0x23')]],'as':_0x3e347e['as'],'attributes':_0x3e347e[_0xa885('0x1f')],'include':_0x3e347e[_0xa885('0x22')]?_[_0xa885('0x21')](_0x3e347e[_0xa885('0x22')],function(_0x55efb1){return{'model':db[_0x55efb1['model']],'as':_0x55efb1['as'],'attributes':_0x55efb1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c94ab){logger[_0xa885('0x19')](_0xa885('0x24'),_0x127a86);logger[_0xa885('0x13')](_0xa885('0x24'),_0x127a86,JSON[_0xa885('0x15')](_0x1c94ab));_0x113043(_0x1c94ab);})['catch'](function(_0x40d982){logger['error'](_0xa885('0x24'),_0x40d982['message'],_0x127a86);_0x523916(_0x1d5d0b[_0xa885('0x16')](0x1f4,_0x40d982['message']));});});};exports[_0xa885('0x25')]=function(_0x9c6b86){var _0x14eb7e=this;return new Promise(function(_0x5d62c2,_0x15f3a){return db[_0xa885('0x1b')]['find']({'raw':_0x9c6b86[_0xa885('0x1d')]?_0x9c6b86['options'][_0xa885('0x1e')]===undefined?!![]:![]:!![],'where':_0x9c6b86[_0xa885('0x1d')]?_0x9c6b86[_0xa885('0x1d')]['where']||null:null,'attributes':_0x9c6b86[_0xa885('0x1d')]?_0x9c6b86[_0xa885('0x1d')][_0xa885('0x1f')]||null:null,'include':_0x9c6b86['options']?_0x9c6b86[_0xa885('0x1d')][_0xa885('0x22')]?_[_0xa885('0x21')](_0x9c6b86[_0xa885('0x1d')][_0xa885('0x22')],function(_0x209758){return{'model':db[_0x209758[_0xa885('0x23')]],'as':_0x209758['as'],'attributes':_0x209758[_0xa885('0x1f')],'include':_0x209758['include']?_['map'](_0x209758[_0xa885('0x22')],function(_0x1d43b5){return{'model':db[_0x1d43b5[_0xa885('0x23')]],'as':_0x1d43b5['as'],'attributes':_0x1d43b5[_0xa885('0x1f')],'include':_0x1d43b5[_0xa885('0x22')]?_[_0xa885('0x21')](_0x1d43b5[_0xa885('0x22')],function(_0x337e55){return{'model':db[_0x337e55[_0xa885('0x23')]],'as':_0x337e55['as'],'attributes':_0x337e55['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17cad1){if(_0x9c6b86['options']['smtp']===!![])_0x17cad1[_0xa885('0x26')]('smtpOptions',_0x17cad1[_0xa885('0x27')]());logger[_0xa885('0x19')](_0xa885('0x25'),_0x9c6b86);logger[_0xa885('0x13')](_0xa885('0x25'),_0x9c6b86,JSON[_0xa885('0x15')](_0x17cad1));_0x5d62c2(_0x17cad1);})[_0xa885('0x1a')](function(_0x3a10e5){logger[_0xa885('0x16')](_0xa885('0x25'),_0x3a10e5['message'],_0x9c6b86);_0x15f3a(_0x14eb7e[_0xa885('0x16')](0x1f4,_0x3a10e5[_0xa885('0x18')]));});});};exports[_0xa885('0x28')]=function(_0x97fdde){var _0x129639=this;return new Promise(function(_0x5e327f,_0x57d912){var _0x3afe38={'body':_0x97fdde[_0xa885('0x29')],'channel':_0xa885('0x2a')};var _0x2a1e90=_[_0xa885('0x2b')](_['keys'](db[_0xa885('0x2c')][_0xa885('0x2d')]),['createdAt','updatedAt',_0xa885('0x2e'),_0xa885('0x2f')]);var _0x4da64c=![];if(_0x97fdde['body']['id']){delete _0x97fdde[_0xa885('0x29')]['id'];}if(_[_0xa885('0x30')](_0x97fdde[_0xa885('0x29')][_0xa885('0x31')])){return _0x57d912(_0x129639[_0xa885('0x16')](0x1f4,_0xa885('0x32')));}if(_[_0xa885('0x30')](_0x97fdde[_0xa885('0x29')][_0xa885('0x29')])||_0x97fdde[_0xa885('0x29')][_0xa885('0x29')]===''){return _0x57d912(_0x129639['error'](0x1f4,_0xa885('0x33')));}if(_[_0xa885('0x30')](_0x97fdde[_0xa885('0x29')]['mapKey'])){return _0x57d912(_0x129639[_0xa885('0x16')](0x1f4,_0xa885('0x34')+_0x2a1e90));}if(!_[_0xa885('0x35')](_0x2a1e90,_0x97fdde[_0xa885('0x29')]['mapKey'])){return _0x57d912(_0x129639[_0xa885('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a1e90));}var _0x2d4bb5={};_0x2d4bb5[_0x97fdde[_0xa885('0x29')]['mapKey']]=_0x97fdde[_0xa885('0x29')][_0xa885('0x31')];return db[_0xa885('0x1b')][_0xa885('0x36')]({'where':{'id':_0x97fdde[_0xa885('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0xa885('0x38'),'include':[{'model':db[_0xa885('0x2c')],'as':_0xa885('0x39'),'where':_0x2d4bb5,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailApplication'],'as':_0xa885('0x3a')},{'model':db[_0xa885('0x3b')],'as':_0xa885('0x3c'),'include':[{'model':db[_0xa885('0x3d')],'as':_0xa885('0x3d')}]}]})[_0xa885('0x10')](function(_0x43245c){if(_0x43245c&&_0x43245c[_0xa885('0x38')]){var _0x4397d6=_0x43245c[_0xa885('0x3e')]({'plain':!![]});_0x3afe38[_0xa885('0x37')]=_['omit'](_0x4397d6,['Applications','List']);_0x3afe38[_0xa885('0x37')][_0xa885('0x3f')]=_0x43245c[_0xa885('0x27')]();_0x3afe38[_0xa885('0x40')]=_0x4397d6[_0xa885('0x3a')];_0x3afe38[_0xa885('0x41')]=_0x4397d6[_0xa885('0x38')];_0x3afe38['applications']=_[_0xa885('0x42')](_0x3afe38[_0xa885('0x40')],[_0xa885('0x43')],[_0xa885('0x44')]);if(_0x3afe38[_0xa885('0x37')]&&_0x3afe38[_0xa885('0x37')][_0xa885('0x45')]){_0x3afe38['applications'][_0xa885('0x46')]({'id':0x0,'priority':_0x3afe38[_0xa885('0x40')][_0xa885('0x47')]+0x1,'app':'close','appdata':_0xa885('0x45'),'interval':_0xa885('0x48')});}if(_0x3afe38[_0xa885('0x37')][_0xa885('0x3a')]){delete _0x3afe38[_0xa885('0x37')][_0xa885('0x3a')];}if(_0x3afe38[_0xa885('0x37')][_0xa885('0x38')]){delete _0x3afe38['account'][_0xa885('0x38')];}if(_0x4397d6[_0xa885('0x38')][_0xa885('0x39')]['length']){return _0x4397d6[_0xa885('0x38')][_0xa885('0x39')][0x0];}var _0x43798c=_[_0xa885('0xa')](_0x97fdde[_0xa885('0x29')],{'firstName':_0x97fdde[_0xa885('0x29')]['from'],'ListId':_0x4397d6[_0xa885('0x2f')]});_0x43798c[_0x97fdde[_0xa885('0x29')][_0xa885('0x49')]]=_0x97fdde['body'][_0xa885('0x31')];return db[_0xa885('0x2c')][_0xa885('0x4a')](_0x43798c);}else{throw new Error(_0xa885('0x4b'));}})[_0xa885('0x10')](function(_0x2ee5eb){_0x3afe38[_0xa885('0x4c')]=_0x2ee5eb;if(_0x2ee5eb){if(!_0x97fdde[_0xa885('0x29')][_0xa885('0x18')]['messageId']){_0x97fdde[_0xa885('0x29')][_0xa885('0x18')]['messageId']=rs['generate']()+'\x20'+_0x97fdde[_0xa885('0x29')][_0xa885('0x18')]['from'];}var _0x8aba4={'ContactId':_0x2ee5eb['id'],'MailAccountId':_0x97fdde[_0xa885('0x37')]['id'],'inReplyTo':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')][_0xa885('0x4d')],'to':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')]['from'],'cc':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')]['cc'],'subject':_0x97fdde['body'][_0xa885('0x18')]['subject'],'attach':_0x97fdde[_0xa885('0x29')]['message'][_0xa885('0x4e')],'lastMsgAt':moment()[_0xa885('0x4f')](_0xa885('0x50')),'lastMsgDirection':'in'};return db[_0xa885('0x51')]['find']({'where':{'closed':![],'MailAccountId':_0x97fdde[_0xa885('0x37')]['id']},'include':[{'model':db[_0xa885('0x52')],'as':_0xa885('0x53'),'attributes':['messageId'],'where':{'messageId':_0x97fdde[_0xa885('0x29')]['message'][_0xa885('0x54')]}}]})[_0xa885('0x10')](function(_0x48e205){if(_0x48e205){return[_0x48e205,![]];}return db[_0xa885('0x51')]['create'](_0x8aba4)[_0xa885('0x10')](function(_0x2f053a){return[_0x2f053a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa885('0x55')](function(_0x569d63,_0x1ef168){if(_0x569d63){_0x4da64c=_0x1ef168;if(!_0x1ef168){return _0x569d63[_0xa885('0x56')]({'inReplyTo':_0x97fdde['body']['message'][_0xa885('0x4d')],'to':_0x97fdde[_0xa885('0x29')]['message']['from'],'cc':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')]['cc'],'subject':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')][_0xa885('0x57')],'attach':_0x569d63[_0xa885('0x4e')]?_0x569d63[_0xa885('0x4e')]:_0x97fdde[_0xa885('0x29')][_0xa885('0x18')][_0xa885('0x4e')],'substatus':null,'substatusAt':moment()[_0xa885('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xa885('0x4f')](_0xa885('0x50')),'lastMsgDirection':'in'});}else{return _0x569d63;}}})[_0xa885('0x10')](function(_0x3a0794){_0x3afe38[_0xa885('0x58')]=_0x3a0794['get']({'plain':!![]});_0x3afe38[_0xa885('0x58')]['created']=_0x4da64c;return db['MailMessage'][_0xa885('0x4a')]({'body':_0x97fdde[_0xa885('0x29')]['body'],'MailAccountId':_0x97fdde['account']['id'],'MailInteractionId':_0x3a0794['id'],'direction':'in','ContactId':_0x3afe38[_0xa885('0x4c')]['id'],'messageId':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')]['messageId'],'from':_0x97fdde['body'][_0xa885('0x18')][_0xa885('0x31')],'to':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')]['to'],'cc':_0x97fdde['body'][_0xa885('0x18')]['cc'],'subject':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')]['subject'],'attach':_0x97fdde['body'][_0xa885('0x18')][_0xa885('0x4e')],'Attachments':_0x97fdde[_0xa885('0x29')]['message'][_0xa885('0x59')],'originTo':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')][_0xa885('0x5a')],'originCc':_0x97fdde['body'][_0xa885('0x18')][_0xa885('0x5b')],'bcc':_0x97fdde['body'][_0xa885('0x18')][_0xa885('0x5c')],'ChatWebsiteId':_0x97fdde['body'][_0xa885('0x18')]['ChatWebsiteId']||null,'originChannel':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')][_0xa885('0x5d')]||_0xa885('0x5e'),'ChatOfflineMessageId':_0x97fdde[_0xa885('0x29')][_0xa885('0x18')][_0xa885('0x5f')]||null},{'include':[{'model':db[_0xa885('0x60')],'as':'Attachments'}]});})['then'](function(_0x272b18){_0x3afe38[_0xa885('0x18')]=_0x272b18;if(!_0x3afe38['interaction'][_0xa885('0x61')]){return;}return db[_0xa885('0x62')]['find']({'attributes':['id',_0xa885('0x63')],'where':{'id':_0x3afe38['interaction'][_0xa885('0x61')]}});})[_0xa885('0x10')](function(_0x37ef1b){if(_0x37ef1b){_0x3afe38[_0xa885('0x40')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x37ef1b[_0xa885('0x63')]+','+(_0x3afe38[_0xa885('0x37')][_0xa885('0x64')]||0xa),'interval':_0xa885('0x48')});}if(!_0x3afe38[_0xa885('0x58')][_0xa885('0x65')]){return;}return db[_0xa885('0x66')][_0xa885('0x36')]({'attributes':['id','name'],'where':{'id':_0x3afe38[_0xa885('0x58')]['queueId']}});})[_0xa885('0x10')](function(_0x39e520){if(_0x39e520){_0x3afe38[_0xa885('0x40')]['unshift']({'id':0x0,'priority':0x1,'app':_0xa885('0x67'),'appdata':_0x39e520[_0xa885('0x63')]+','+(_0x3afe38['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xa885('0x48')});}return respondWithRpcPromise(_0xa885('0x68'),_0xa885('0x69'),_0x3afe38);})[_0xa885('0x10')](function(_0x243d5e){_0x5e327f(_0x243d5e);})['catch'](function(_0x573e3d){_0x57d912(_0x129639[_0xa885('0x16')](0x1f4,_0x573e3d[_0xa885('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 93343d6..41571ab 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 _0x58a4=['length','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x59d7fb,_0x33a009){var _0x6b4105=function(_0x5d61af){while(--_0x5d61af){_0x59d7fb['push'](_0x59d7fb['shift']());}};_0x6b4105(++_0x33a009);}(_0x58a4,0xbf));var _0x458a=function(_0x56d049,_0x31caff){_0x56d049=_0x56d049-0x0;var _0x39a317=_0x58a4[_0x56d049];return _0x39a317;};'use strict';var MailAccountEvents=require(_0x458a('0x0'));var events=[_0x458a('0x1'),_0x458a('0x2'),_0x458a('0x3')];function createListener(_0xd2a36e,_0x15239b){return function(_0x2a1838){_0x15239b[_0x458a('0x4')](_0xd2a36e,_0x2a1838);};}function removeListener(_0x362079,_0x1b4d2e){return function(){MailAccountEvents[_0x458a('0x5')](_0x362079,_0x1b4d2e);};}exports[_0x458a('0x6')]=function(_0x2f5d44){for(var _0x57de3c=0x0,_0x5358c2=events[_0x458a('0x7')];_0x57de3c<_0x5358c2;_0x57de3c++){var _0x11fcaa=events[_0x57de3c];var _0x2029bc=createListener(_0x458a('0x8')+_0x11fcaa,_0x2f5d44);MailAccountEvents['on'](_0x11fcaa,_0x2029bc);}}; \ No newline at end of file +var _0x19f6=['./mailAccount.events','save','remove','update','register','length'];(function(_0x35db86,_0x20d1dc){var _0x1d2523=function(_0x3d920f){while(--_0x3d920f){_0x35db86['push'](_0x35db86['shift']());}};_0x1d2523(++_0x20d1dc);}(_0x19f6,0x1ce));var _0x619f=function(_0x317722,_0x58fba2){_0x317722=_0x317722-0x0;var _0xa152ad=_0x19f6[_0x317722];return _0xa152ad;};'use strict';var MailAccountEvents=require(_0x619f('0x0'));var events=[_0x619f('0x1'),_0x619f('0x2'),_0x619f('0x3')];function createListener(_0x42084e,_0x103373){return function(_0x100761){_0x103373['emit'](_0x42084e,_0x100761);};}function removeListener(_0x128f4f,_0x2eb86d){return function(){MailAccountEvents['removeListener'](_0x128f4f,_0x2eb86d);};}exports[_0x619f('0x4')]=function(_0x59b1a6){for(var _0x38b131=0x0,_0xcbfda5=events[_0x619f('0x5')];_0x38b131<_0xcbfda5;_0x38b131++){var _0x3b344a=events[_0x38b131];var _0x23f114=createListener('mailAccount:'+_0x3b344a,_0x59b1a6);MailAccountEvents['on'](_0x3b344a,_0x23f114);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index a7153e5..1a02beb 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 _0x7d1c=['put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','show'];(function(_0x4e4879,_0x372468){var _0x238c91=function(_0x2af9ea){while(--_0x2af9ea){_0x4e4879['push'](_0x4e4879['shift']());}};_0x238c91(++_0x372468);}(_0x7d1c,0xe5));var _0xc7d1=function(_0x19318e,_0x46c067){_0x19318e=_0x19318e-0x0;var _0x425540=_0x7d1c[_0x19318e];return _0x425540;};'use strict';var multer=require(_0xc7d1('0x0'));var util=require(_0xc7d1('0x1'));var path=require(_0xc7d1('0x2'));var timeout=require(_0xc7d1('0x3'));var express=require(_0xc7d1('0x4'));var router=express[_0xc7d1('0x5')]();var fs_extra=require(_0xc7d1('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc7d1('0x7'));var controller=require('./mailApplication.controller');router[_0xc7d1('0x8')]('/:id',auth[_0xc7d1('0x9')](),controller[_0xc7d1('0xa')]);router[_0xc7d1('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc7d1('0xc')](_0xc7d1('0xd'),auth[_0xc7d1('0x9')](),controller[_0xc7d1('0xe')]);module[_0xc7d1('0xf')]=router; \ No newline at end of file +var _0x66dd=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','show','put','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5d421d,_0x153768){var _0x51fbfb=function(_0x5cf3e1){while(--_0x5cf3e1){_0x5d421d['push'](_0x5d421d['shift']());}};_0x51fbfb(++_0x153768);}(_0x66dd,0x16c));var _0xd66d=function(_0xf6a49f,_0x25c9c2){_0xf6a49f=_0xf6a49f-0x0;var _0x2c3920=_0x66dd[_0xf6a49f];return _0x2c3920;};'use strict';var multer=require(_0xd66d('0x0'));var util=require('util');var path=require(_0xd66d('0x1'));var timeout=require(_0xd66d('0x2'));var express=require(_0xd66d('0x3'));var router=express[_0xd66d('0x4')]();var fs_extra=require(_0xd66d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd66d('0x6'));var config=require(_0xd66d('0x7'));var controller=require('./mailApplication.controller');router[_0xd66d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd66d('0x9')]);router[_0xd66d('0xa')]('/:id',auth[_0xd66d('0xb')](),controller[_0xd66d('0xc')]);router[_0xd66d('0xd')]('/:id',auth[_0xd66d('0xb')](),controller[_0xd66d('0xe')]);module[_0xd66d('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index eed7261..63b0a5c 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 _0x30b5=['STRING','TEXT','sequelize'];(function(_0x45b4b2,_0x1fa3a1){var _0x54ce8d=function(_0x486097){while(--_0x486097){_0x45b4b2['push'](_0x45b4b2['shift']());}};_0x54ce8d(++_0x1fa3a1);}(_0x30b5,0xd1));var _0x530b=function(_0x582f72,_0x886d8){_0x582f72=_0x582f72-0x0;var _0x4cd5fe=_0x30b5[_0x582f72];return _0x4cd5fe;};'use strict';var Sequelize=require(_0x530b('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x530b('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x530b('0x2')]()},'description':{'type':Sequelize[_0x530b('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5f64=['sequelize','exports','STRING','noop','TEXT'];(function(_0x2e0e59,_0x8b5d64){var _0x3bbca9=function(_0xeff44d){while(--_0xeff44d){_0x2e0e59['push'](_0x2e0e59['shift']());}};_0x3bbca9(++_0x8b5d64);}(_0x5f64,0x154));var _0x45f6=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0x5f64[_0x58d5ac];return _0x37985c;};'use strict';var Sequelize=require(_0x45f6('0x0'));module[_0x45f6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x45f6('0x2')],'allowNull':![],'defaultValue':_0x45f6('0x3')},'appdata':{'type':Sequelize[_0x45f6('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x45f6('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 25214a4..7600576 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x504f7b,_0x1ac4e0){var _0x2b0904=function(_0x28e51d){while(--_0x28e51d){_0x504f7b['push'](_0x504f7b['shift']());}};_0x2b0904(++_0x1ac4e0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5c7972,_0x573c72){_0x5c7972=_0x5c7972-0x0;var _0x164369=_0x9bde[_0x5c7972];return _0x164369;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x105278,_0x774ed2){var _0x47b1f=function(_0xf8a100){while(--_0xf8a100){_0x105278['push'](_0x105278['shift']());}};_0x47b1f(++_0x774ed2);}(_0x70e0,0x17b));var _0x070e=function(_0x3c09f4,_0xfc2774){_0x3c09f4=_0x3c09f4-0x0;var _0x50a346=_0x70e0[_0x3c09f4];return _0x50a346;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 4d6038b..f7cd61e 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 _0x63e3=['rimraf','exports','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2c16f9,_0x4753cb){var _0x2d7aef=function(_0x38bb92){while(--_0x38bb92){_0x2c16f9['push'](_0x2c16f9['shift']());}};_0x2d7aef(++_0x4753cb);}(_0x63e3,0xd1));var _0x363e=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x63e3[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x363e('0x0'));var util=require('util');var logger=require(_0x363e('0x1'))(_0x363e('0x2'));var moment=require(_0x363e('0x3'));var BPromise=require(_0x363e('0x4'));var rp=require(_0x363e('0x5'));var fs=require('fs');var path=require(_0x363e('0x6'));var rimraf=require(_0x363e('0x7'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x363e('0x8')]=function(_0x542781,_0x43f9c5){return _0x542781['define'](_0x363e('0x9'),attributes,{'tableName':_0x363e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x363e('0xb')});}; \ No newline at end of file +var _0x50e4=['../../config/environment','./mailApplication.attributes','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5a7fbc,_0xa081de){var _0xcba0fc=function(_0x4f083b){while(--_0x4f083b){_0x5a7fbc['push'](_0x5a7fbc['shift']());}};_0xcba0fc(++_0xa081de);}(_0x50e4,0xe3));var _0x450e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x50e4[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x450e('0x0'));var logger=require(_0x450e('0x1'))(_0x450e('0x2'));var moment=require(_0x450e('0x3'));var BPromise=require(_0x450e('0x4'));var rp=require(_0x450e('0x5'));var fs=require('fs');var path=require(_0x450e('0x6'));var rimraf=require('rimraf');var config=require(_0x450e('0x7'));var attributes=require(_0x450e('0x8'));module['exports']=function(_0x4ddc26,_0x2cd962){return _0x4ddc26[_0x450e('0x9')]('MailApplication',attributes,{'tableName':_0x450e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x450e('0xb'),'collate':_0x450e('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 4928f03..e4e5792 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 _0x1f80=['rpc','../../config/environment','jayson/promise','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xa45111,_0x1cae28){var _0x3e54ee=function(_0x9661c6){while(--_0x9661c6){_0xa45111['push'](_0xa45111['shift']());}};_0x3e54ee(++_0x1cae28);}(_0x1f80,0x148));var _0x01f8=function(_0x29340c,_0x4c7511){_0x29340c=_0x29340c-0x0;var _0x970def=_0x1f80[_0x29340c];return _0x970def;};'use strict';var _=require('lodash');var util=require(_0x01f8('0x0'));var moment=require(_0x01f8('0x1'));var BPromise=require(_0x01f8('0x2'));var rs=require(_0x01f8('0x3'));var fs=require('fs');var Redis=require(_0x01f8('0x4'));var db=require(_0x01f8('0x5'))['db'];var utils=require(_0x01f8('0x6'));var logger=require(_0x01f8('0x7'))(_0x01f8('0x8'));var config=require(_0x01f8('0x9'));var jayson=require(_0x01f8('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x12d07a,_0x50a318,_0x2aa88e){return new BPromise(function(_0x535abf,_0x19d90d){return client['request'](_0x12d07a,_0x2aa88e)['then'](function(_0x313811){logger[_0x01f8('0xb')](_0x01f8('0xc'),_0x50a318,_0x01f8('0xd'));logger[_0x01f8('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x50a318,_0x01f8('0xd'),JSON[_0x01f8('0xf')](_0x313811));if(_0x313811[_0x01f8('0x10')]){if(_0x313811[_0x01f8('0x10')][_0x01f8('0x11')]===0x1f4){logger['error'](_0x01f8('0xc'),_0x50a318,_0x313811[_0x01f8('0x10')][_0x01f8('0x12')]);return _0x19d90d(_0x313811['error'][_0x01f8('0x12')]);}logger['error'](_0x01f8('0xc'),_0x50a318,_0x313811[_0x01f8('0x10')][_0x01f8('0x12')]);return _0x535abf(_0x313811[_0x01f8('0x10')][_0x01f8('0x12')]);}else{logger[_0x01f8('0xb')](_0x01f8('0xc'),_0x50a318,'request\x20sent');_0x535abf(_0x313811['result'][_0x01f8('0x12')]);}})[_0x01f8('0x13')](function(_0x69fd8a){logger[_0x01f8('0x10')](_0x01f8('0xc'),_0x50a318,_0x69fd8a);_0x19d90d(_0x69fd8a);});});}exports[_0x01f8('0x14')]=function(_0x352854){var _0x2df24b=this;return new Promise(function(_0x46380c,_0x30d34a){return db['MailApplication'][_0x01f8('0x15')](_0x352854[_0x01f8('0x16')],{'raw':_0x352854[_0x01f8('0x17')]?_0x352854['options'][_0x01f8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x352854[_0x01f8('0x17')]?_0x352854[_0x01f8('0x17')][_0x01f8('0x19')]||null:null,'attributes':_0x352854[_0x01f8('0x17')]?_0x352854[_0x01f8('0x17')][_0x01f8('0x1a')]||null:null,'limit':_0x352854[_0x01f8('0x17')]?_0x352854[_0x01f8('0x17')][_0x01f8('0x1b')]||null:null})['then'](function(_0x2b0755){logger['info'](_0x01f8('0x14'),_0x352854);logger[_0x01f8('0xe')](_0x01f8('0x14'),_0x352854,JSON[_0x01f8('0xf')](_0x2b0755));_0x46380c(_0x2b0755);})[_0x01f8('0x13')](function(_0x3b3b32){logger['error'](_0x01f8('0x14'),_0x3b3b32[_0x01f8('0x12')],_0x352854);_0x30d34a(_0x2df24b[_0x01f8('0x10')](0x1f4,_0x3b3b32[_0x01f8('0x12')]));});});}; \ No newline at end of file +var _0x3403=['http','request','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailApplication','update','options','raw','limit','debug','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x240d9b,_0x198f97){var _0x31b3bc=function(_0x141095){while(--_0x141095){_0x240d9b['push'](_0x240d9b['shift']());}};_0x31b3bc(++_0x198f97);}(_0x3403,0x1b7));var _0x3340=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x3403[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x3340('0x0'));var util=require(_0x3340('0x1'));var moment=require(_0x3340('0x2'));var BPromise=require(_0x3340('0x3'));var rs=require(_0x3340('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3340('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3340('0x6'))(_0x3340('0x7'));var config=require('../../config/environment');var jayson=require(_0x3340('0x8'));var client=jayson['client'][_0x3340('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aec6e,_0x3067d8,_0x4cc4fb){return new BPromise(function(_0x5ca2b0,_0x1eeb35){return client[_0x3340('0xa')](_0x4aec6e,_0x4cc4fb)['then'](function(_0x1cb8e6){logger[_0x3340('0xb')](_0x3340('0xc'),_0x3067d8,'request\x20sent');logger['debug'](_0x3340('0xd'),_0x3067d8,_0x3340('0xe'),JSON[_0x3340('0xf')](_0x1cb8e6));if(_0x1cb8e6[_0x3340('0x10')]){if(_0x1cb8e6['error'][_0x3340('0x11')]===0x1f4){logger['error'](_0x3340('0xc'),_0x3067d8,_0x1cb8e6[_0x3340('0x10')][_0x3340('0x12')]);return _0x1eeb35(_0x1cb8e6[_0x3340('0x10')][_0x3340('0x12')]);}logger[_0x3340('0x10')](_0x3340('0xc'),_0x3067d8,_0x1cb8e6['error'][_0x3340('0x12')]);return _0x5ca2b0(_0x1cb8e6[_0x3340('0x10')][_0x3340('0x12')]);}else{logger[_0x3340('0xb')]('MailApplication,\x20%s,\x20%s',_0x3067d8,_0x3340('0xe'));_0x5ca2b0(_0x1cb8e6[_0x3340('0x13')][_0x3340('0x12')]);}})[_0x3340('0x14')](function(_0x2f91c8){logger[_0x3340('0x10')]('MailApplication,\x20%s,\x20%s',_0x3067d8,_0x2f91c8);_0x1eeb35(_0x2f91c8);});});}exports['UpdateMailApplication']=function(_0x2dfa7d){var _0x273dda=this;return new Promise(function(_0x4c101a,_0x5c46f4){return db[_0x3340('0x15')][_0x3340('0x16')](_0x2dfa7d['body'],{'raw':_0x2dfa7d[_0x3340('0x17')]?_0x2dfa7d['options'][_0x3340('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dfa7d[_0x3340('0x17')]?_0x2dfa7d[_0x3340('0x17')]['where']||null:null,'attributes':_0x2dfa7d[_0x3340('0x17')]?_0x2dfa7d[_0x3340('0x17')]['attributes']||null:null,'limit':_0x2dfa7d[_0x3340('0x17')]?_0x2dfa7d['options'][_0x3340('0x19')]||null:null})['then'](function(_0x515bbe){logger[_0x3340('0xb')]('UpdateMailApplication',_0x2dfa7d);logger[_0x3340('0x1a')](_0x3340('0x1b'),_0x2dfa7d,JSON['stringify'](_0x515bbe));_0x4c101a(_0x515bbe);})[_0x3340('0x14')](function(_0x22ce2c){logger['error']('UpdateMailApplication',_0x22ce2c[_0x3340('0x12')],_0x2dfa7d);_0x5c46f4(_0x273dda[_0x3340('0x10')](0x1f4,_0x22ce2c[_0x3340('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 91d76c9..e03acd4 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 _0x423e=['getMessages','post','create','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','exports','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/messages'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x423e,0x1c5));var _0xe423=function(_0x51e916,_0x549682){_0x51e916=_0x51e916-0x0;var _0x2f718d=_0x423e[_0x51e916];return _0x2f718d;};'use strict';var express=require(_0xe423('0x0'));var router=express['Router']();var auth=require(_0xe423('0x1'));var interaction=require(_0xe423('0x2'));var controller=require('./mailInteraction.controller');router[_0xe423('0x3')]('/',auth[_0xe423('0x4')](),controller[_0xe423('0x5')]);router['get'](_0xe423('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0xe423('0x3')](_0xe423('0x7'),auth[_0xe423('0x4')](),controller['show']);router['get'](_0xe423('0x8'),auth[_0xe423('0x4')](),controller[_0xe423('0x9')]);router[_0xe423('0x3')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xe423('0xa')]('/',auth['isAuthenticated'](),controller[_0xe423('0xb')]);router[_0xe423('0xa')](_0xe423('0x8'),auth[_0xe423('0x4')](),controller[_0xe423('0xc')]);router[_0xe423('0xa')]('/:id/tags',auth[_0xe423('0x4')](),interaction[_0xe423('0xd')](_0xe423('0xe'),_0xe423('0xf')),controller[_0xe423('0x10')]);router[_0xe423('0x11')]('/:id',auth[_0xe423('0x4')](),interaction[_0xe423('0xd')](_0xe423('0xe'),_0xe423('0x12')),controller[_0xe423('0x13')]);router['delete'](_0xe423('0x7'),auth['isAuthenticated'](),interaction['tracked'](_0xe423('0xe'),'mailinteraction:destroy'),controller['destroy']);router[_0xe423('0x14')]('/:id/tags',auth[_0xe423('0x4')](),controller['removeTags']);module[_0xe423('0x15')]=router; \ No newline at end of file +var _0x52f9=['../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','download','create','addMessage','post','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','destroy','removeTags','exports','express','Router'];(function(_0x2ec13e,_0x2ea526){var _0xb48415=function(_0x5566e4){while(--_0x5566e4){_0x2ec13e['push'](_0x2ec13e['shift']());}};_0xb48415(++_0x2ea526);}(_0x52f9,0xbe));var _0x952f=function(_0x315716,_0x539a12){_0x315716=_0x315716-0x0;var _0x5521f2=_0x52f9[_0x315716];return _0x5521f2;};'use strict';var express=require(_0x952f('0x0'));var router=express[_0x952f('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x952f('0x2'));var controller=require('./mailInteraction.controller');router[_0x952f('0x3')]('/',auth[_0x952f('0x4')](),controller[_0x952f('0x5')]);router[_0x952f('0x3')](_0x952f('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x952f('0x3')](_0x952f('0x7'),auth['isAuthenticated'](),controller[_0x952f('0x8')]);router[_0x952f('0x3')](_0x952f('0x9'),auth[_0x952f('0x4')](),controller['getMessages']);router['get']('/:id/download',auth[_0x952f('0x4')](),controller[_0x952f('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x952f('0xb')]);router['post'](_0x952f('0x9'),auth[_0x952f('0x4')](),controller[_0x952f('0xc')]);router[_0x952f('0xd')](_0x952f('0xe'),auth[_0x952f('0x4')](),interaction[_0x952f('0xf')](_0x952f('0x10'),_0x952f('0x11')),controller[_0x952f('0x12')]);router[_0x952f('0x13')]('/:id',auth['isAuthenticated'](),interaction[_0x952f('0xf')](_0x952f('0x10'),_0x952f('0x14')),controller['update']);router['delete'](_0x952f('0x7'),auth[_0x952f('0x4')](),interaction[_0x952f('0xf')](_0x952f('0x10'),'mailinteraction:destroy'),controller[_0x952f('0x15')]);router['delete'](_0x952f('0xe'),auth['isAuthenticated'](),controller[_0x952f('0x16')]);module[_0x952f('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 486d72c..021cb12 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 _0x6536=['out','ENUM','sequelize','iconv','exports','DATE','STRING','TEXT','BOOLEAN'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x6536,0x1cd));var _0x6653=function(_0xb19354,_0x581dd3){_0xb19354=_0xb19354-0x0;var _0x2a22ea=_0x6536[_0xb19354];return _0x2a22ea;};'use strict';var Sequelize=require(_0x6653('0x0'));var iconv=require(_0x6653('0x1'));module[_0x6653('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6653('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6653('0x4')]},'inReplyTo':{'type':Sequelize[_0x6653('0x4')](0x1fe)},'to':{'type':Sequelize[_0x6653('0x4')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x6653('0x5')]()},'attach':{'type':Sequelize[_0x6653('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6653('0x3')]},'substatus':{'type':Sequelize[_0x6653('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6653('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6653('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6653('0x8')]('in',_0x6653('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6653('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe5c0=['ENUM','out','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x4faec6,_0x2e110c){var _0x4eebf4=function(_0x3046ed){while(--_0x3046ed){_0x4faec6['push'](_0x4faec6['shift']());}};_0x4eebf4(++_0x2e110c);}(_0xe5c0,0x146));var _0x0e5c=function(_0x5d54bf,_0x195ccd){_0x5d54bf=_0x5d54bf-0x0;var _0x2c255d=_0xe5c0[_0x5d54bf];return _0x2c255d;};'use strict';var Sequelize=require(_0x0e5c('0x0'));var iconv=require(_0x0e5c('0x1'));module['exports']={'closed':{'type':Sequelize[_0x0e5c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0e5c('0x3')]},'disposition':{'type':Sequelize[_0x0e5c('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0e5c('0x4')]},'note':{'type':Sequelize[_0x0e5c('0x4')]},'inReplyTo':{'type':Sequelize[_0x0e5c('0x4')](0x1fe)},'to':{'type':Sequelize[_0x0e5c('0x4')]},'cc':{'type':Sequelize[_0x0e5c('0x5')](_0x0e5c('0x6'))},'subject':{'type':Sequelize[_0x0e5c('0x5')]()},'attach':{'type':Sequelize[_0x0e5c('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0e5c('0x3')]},'substatus':{'type':Sequelize[_0x0e5c('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x0e5c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0e5c('0x7')]('in',_0x0e5c('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0e5c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0e5c('0x7')]('in',_0x0e5c('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0e5c('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index eb75b9d..f8b5420 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 _0xe83b=['update','destroy','then','error','name','send','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','query','user','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','MailMessage','addMessage','ids','filters','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','map','split','format','inlineCss','addTags','omit','spread','color','mailInteractionTags:save','removeTags','download','unix','root','tmp','server','files','attachments','transcript-%d-%s.zip','join','push','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','sendStatus','eml-format','moment','bluebird','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','Content-Range'];(function(_0x4426f4,_0x238778){var _0x1f3e55=function(_0x8ad6a3){while(--_0x8ad6a3){_0x4426f4['push'](_0x4426f4['shift']());}};_0x1f3e55(++_0x238778);}(_0xe83b,0x128));var _0xbe83=function(_0x5ecd78,_0x1da033){_0x5ecd78=_0x5ecd78-0x0;var _0x144f9=_0xe83b[_0x5ecd78];return _0x144f9;};'use strict';var emlformat=require(_0xbe83('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xbe83('0x1'));var BPromise=require(_0xbe83('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xbe83('0x3'));var juice=require('juice');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xbe83('0x4'))(_0xbe83('0x5'));var config=require(_0xbe83('0x6'));var db=require(_0xbe83('0x7'))['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config[_0xbe83('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xbe83('0x9'))(new Redis(config[_0xbe83('0x8')]));require('./mailInteraction.socket')[_0xbe83('0xa')](socket);function respondWithStatusCode(_0x35ed11,_0x5f35c8){_0x5f35c8=_0x5f35c8||0xcc;return function(_0x8aecc1){if(_0x8aecc1){return _0x35ed11['sendStatus'](_0x5f35c8);}return _0x35ed11[_0xbe83('0xb')](_0x5f35c8)[_0xbe83('0xc')]();};}function respondWithResult(_0x2b6b57,_0x3db25b){_0x3db25b=_0x3db25b||0xc8;return function(_0x317220){if(_0x317220){return _0x2b6b57['status'](_0x3db25b)[_0xbe83('0xd')](_0x317220);}};}function respondWithFilteredResult(_0x126efb,_0x1d8c12){return function(_0x5dfbaa){if(_0x5dfbaa){var _0x1257ac=typeof _0x1d8c12[_0xbe83('0xe')]==='undefined'&&typeof _0x1d8c12[_0xbe83('0xf')]===_0xbe83('0x10');var _0x85e03e=_0x5dfbaa[_0xbe83('0x11')];var _0x5e2a00=_0x1257ac?0x0:_0x1d8c12[_0xbe83('0xe')];var _0x55160d=_0x1257ac?_0x5dfbaa['count']:_0x1d8c12[_0xbe83('0xe')]+_0x1d8c12[_0xbe83('0xf')];var _0x20a486;if(_0x55160d>=_0x85e03e){_0x55160d=_0x85e03e;_0x20a486=0xc8;}else{_0x20a486=0xce;}_0x126efb[_0xbe83('0xb')](_0x20a486);return _0x126efb['set'](_0xbe83('0x12'),_0x5e2a00+'-'+_0x55160d+'/'+_0x85e03e)[_0xbe83('0xd')](_0x5dfbaa);}return null;};}function saveUpdates(_0x4836ff){return function(_0x25f4bd){if(_0x25f4bd){return _0x25f4bd[_0xbe83('0x13')](_0x4836ff)['then'](function(_0x40bd1d){return _0x40bd1d;});}return null;};}function removeEntity(_0x433e8b){return function(_0x219318){if(_0x219318){return _0x219318[_0xbe83('0x14')]()[_0xbe83('0x15')](function(){_0x433e8b['status'](0xcc)[_0xbe83('0xc')]();});}};}function handleEntityNotFound(_0x16ea8a){return function(_0x41b81f){if(!_0x41b81f){_0x16ea8a['sendStatus'](0x194);}return _0x41b81f;};}function handleError(_0x13b2e8,_0x17d266){_0x17d266=_0x17d266||0x1f4;return function(_0xb9668a){logger[_0xbe83('0x16')](_0xb9668a['stack']);if(_0xb9668a['name']){delete _0xb9668a[_0xbe83('0x17')];}_0x13b2e8[_0xbe83('0xb')](_0x17d266)[_0xbe83('0x18')](_0xb9668a);};}exports['index']=function(_0x48db6d,_0x38e9d1){var _0x404b6d={};var _0x38bef3=_['map'](db[_0xbe83('0x19')][_0xbe83('0x1a')],function(_0x4c0241){return{'name':_0x4c0241[_0xbe83('0x1b')],'type':_0x4c0241[_0xbe83('0x1c')][_0xbe83('0x1d')]};});_0x404b6d=qs['getOptions'](_0x38bef3,_0x48db6d);return interaction[_0xbe83('0x1e')](_0xbe83('0x1f'),_0x48db6d[_0xbe83('0x20')],_0x48db6d[_0xbe83('0x21')],_0x404b6d,_0x38bef3)[_0xbe83('0x15')](respondWithFilteredResult(_0x38e9d1,_0x404b6d))[_0xbe83('0x22')](handleError(_0x38e9d1,null));};exports[_0xbe83('0x23')]=function(_0x58b80e,_0x15c4ea){var _0x48c525={'raw':![],'where':{'id':_0x58b80e[_0xbe83('0x24')]['id']}},_0x38a990={};_0x38a990[_0xbe83('0x25')]=_[_0xbe83('0x26')](db[_0xbe83('0x19')][_0xbe83('0x1a')]);_0x38a990[_0xbe83('0x20')]=_[_0xbe83('0x26')](_0x58b80e[_0xbe83('0x20')]);_0x38a990['filters']=_[_0xbe83('0x27')](_0x38a990[_0xbe83('0x25')],_0x38a990['query']);_0x48c525[_0xbe83('0x28')]=_[_0xbe83('0x27')](_0x38a990[_0xbe83('0x25')],qs[_0xbe83('0x29')](_0x58b80e[_0xbe83('0x20')][_0xbe83('0x29')]));_0x48c525[_0xbe83('0x28')]=_0x48c525[_0xbe83('0x28')][_0xbe83('0x2a')]?_0x48c525[_0xbe83('0x28')]:_0x38a990[_0xbe83('0x25')];if(_0x58b80e[_0xbe83('0x20')][_0xbe83('0x2b')]){_0x48c525[_0xbe83('0x2c')]=[{'all':!![]}];}_0x48c525=_[_0xbe83('0x2d')]({},_0x48c525,_0x58b80e[_0xbe83('0x2e')]);return db['MailInteraction'][_0xbe83('0x2f')](_0x48c525)[_0xbe83('0x15')](handleEntityNotFound(_0x15c4ea,null))['then'](respondWithResult(_0x15c4ea,null))[_0xbe83('0x22')](handleError(_0x15c4ea,null));};exports[_0xbe83('0x30')]=function(_0x53fe7f,_0x35ca8b){return db[_0xbe83('0x19')][_0xbe83('0x30')](_0x53fe7f[_0xbe83('0x31')],{})[_0xbe83('0x15')](respondWithResult(_0x35ca8b,0xc9))['catch'](handleError(_0x35ca8b,null));};exports['update']=function(_0x4b79d6,_0x5dd5a8){if(_0x4b79d6[_0xbe83('0x31')]['id']){delete _0x4b79d6[_0xbe83('0x31')]['id'];}return db[_0xbe83('0x19')]['find']({'where':{'id':_0x4b79d6[_0xbe83('0x24')]['id']}})[_0xbe83('0x15')](handleEntityNotFound(_0x5dd5a8,null))[_0xbe83('0x15')](saveUpdates(_0x4b79d6[_0xbe83('0x31')],null))[_0xbe83('0x15')](respondWithResult(_0x5dd5a8,null))[_0xbe83('0x22')](handleError(_0x5dd5a8,null));};exports[_0xbe83('0x14')]=function(_0x8b841,_0x56cc40){return db[_0xbe83('0x19')][_0xbe83('0x2f')]({'where':{'id':_0x8b841[_0xbe83('0x24')]['id']}})[_0xbe83('0x15')](handleEntityNotFound(_0x56cc40,null))['then'](removeEntity(_0x56cc40,null))[_0xbe83('0x22')](handleError(_0x56cc40,null));};exports[_0xbe83('0x32')]=function(_0x2bb369,_0x880fc8){return db['MailInteraction']['describe']()[_0xbe83('0x15')](respondWithResult(_0x880fc8,null))['catch'](handleError(_0x880fc8,null));};exports['addMessage']=function(_0x58de56,_0x4bb0d7){return db[_0xbe83('0x33')][_0xbe83('0x2f')]({'where':{'id':_0x58de56[_0xbe83('0x24')]['id']}})[_0xbe83('0x15')](handleEntityNotFound(_0x4bb0d7,null))[_0xbe83('0x15')](function(_0x59de41){if(_0x59de41){return _0x59de41[_0xbe83('0x34')](_0x58de56['body'][_0xbe83('0x35')],_['omit'](_0x58de56[_0xbe83('0x31')],[_0xbe83('0x35'),'id'])||{});}})[_0xbe83('0x15')](respondWithResult(_0x4bb0d7,null))[_0xbe83('0x22')](handleError(_0x4bb0d7,null));};exports['getMessages']=function(_0x33fb1e,_0x1f7812){var _0x539ef1={'raw':![],'where':{}};var _0x2d1f05={};var _0xe57edf={'count':0x0,'rows':[]};return db[_0xbe83('0x19')]['findOne']({'where':{'id':_0x33fb1e[_0xbe83('0x24')]['id']}})[_0xbe83('0x15')](handleEntityNotFound(_0x1f7812,null))[_0xbe83('0x15')](function(_0x1fd4a8){if(_0x1fd4a8){_0x2d1f05['model']=_[_0xbe83('0x26')](db[_0xbe83('0x33')]['rawAttributes']);_0x2d1f05[_0xbe83('0x20')]=_[_0xbe83('0x26')](_0x33fb1e[_0xbe83('0x20')]);_0x2d1f05[_0xbe83('0x36')]=_[_0xbe83('0x27')](_0x2d1f05['model'],_0x2d1f05['query']);_0x539ef1['attributes']=_[_0xbe83('0x27')](_0x2d1f05[_0xbe83('0x25')],qs[_0xbe83('0x29')](_0x33fb1e[_0xbe83('0x20')][_0xbe83('0x29')]));_0x539ef1[_0xbe83('0x28')]=_0x539ef1[_0xbe83('0x28')]['length']?_0x539ef1[_0xbe83('0x28')]:_0x2d1f05[_0xbe83('0x25')];if(!_0x33fb1e[_0xbe83('0x20')][_0xbe83('0x37')](_0xbe83('0x38'))){_0x539ef1[_0xbe83('0xf')]=qs[_0xbe83('0xf')](_0x33fb1e[_0xbe83('0x20')][_0xbe83('0xf')]);_0x539ef1[_0xbe83('0xe')]=qs[_0xbe83('0xe')](_0x33fb1e[_0xbe83('0x20')][_0xbe83('0xe')]);}_0x539ef1[_0xbe83('0x39')]=qs[_0xbe83('0x3a')](_0x33fb1e[_0xbe83('0x20')][_0xbe83('0x3a')]);_0x539ef1[_0xbe83('0x3b')]=qs['filters'](_[_0xbe83('0x3c')](_0x33fb1e['query'],_0x2d1f05['filters']));_0x539ef1[_0xbe83('0x3b')][_0xbe83('0x3d')]=_0x1fd4a8['id'];if(_0x33fb1e[_0xbe83('0x20')][_0xbe83('0x3e')]){_0x539ef1[_0xbe83('0x3b')]=_[_0xbe83('0x2d')](_0x539ef1['where'],{'$or':_[_0xbe83('0x3f')](_0x539ef1[_0xbe83('0x28')],function(_0x59de38){var _0x2d391f={};_0x2d391f[_0x59de38]={'$like':'%'+_0x33fb1e[_0xbe83('0x20')][_0xbe83('0x3e')]+'%'};return _0x2d391f;})});}if(_0x33fb1e[_0xbe83('0x20')]['$gte']){var _0xd1d97e=_0x33fb1e['query']['$gte'][_0xbe83('0x40')](',');var _0x3e501d={};_0x3e501d[_0xd1d97e[0x0]]={'$gte':moment(_0xd1d97e[0x1])[_0xbe83('0x41')]('YYYY-MM-DD\x20HH:mm:ss')};_0x539ef1[_0xbe83('0x3b')]=_[_0xbe83('0x2d')](_0x539ef1[_0xbe83('0x3b')],_0x3e501d);}_0x539ef1=_[_0xbe83('0x2d')]({},_0x539ef1,_0x33fb1e[_0xbe83('0x2e')]);return db[_0xbe83('0x33')][_0xbe83('0x11')]({'where':_0x539ef1['where']})[_0xbe83('0x15')](function(_0x59e25d){_0xe57edf[_0xbe83('0x11')]=_0x59e25d;if(_0x33fb1e[_0xbe83('0x20')][_0xbe83('0x2b')]){_0x539ef1[_0xbe83('0x2c')]=[{'all':!![]}];}return db[_0xbe83('0x33')]['findAll'](_0x539ef1);})[_0xbe83('0x15')](function(_0xd5cc78){if(_0x33fb1e[_0xbe83('0x20')][_0xbe83('0x42')]==='true'){for(var _0x5207a5=0x0;_0x5207a5<_0xd5cc78[_0xbe83('0x2a')];_0x5207a5++){_0xd5cc78[_0x5207a5][_0xbe83('0x31')]=juice(_0xd5cc78[_0x5207a5][_0xbe83('0x31')]);}}_0xe57edf['rows']=_0xd5cc78;return _0xe57edf;});}})['then'](respondWithFilteredResult(_0x1f7812,_0x539ef1))[_0xbe83('0x22')](handleError(_0x1f7812,null));};exports[_0xbe83('0x43')]=function(_0x547e28,_0x17a497){return db[_0xbe83('0x19')]['find']({'where':{'id':_0x547e28['params']['id']}})[_0xbe83('0x15')](handleEntityNotFound(_0x17a497,null))[_0xbe83('0x15')](function(_0xb31ef9){if(_0xb31ef9){return _0xb31ef9['setTags'](_0x547e28[_0xbe83('0x31')][_0xbe83('0x35')],_[_0xbe83('0x44')](_0x547e28[_0xbe83('0x31')],[_0xbe83('0x35'),'id'])||{})[_0xbe83('0x45')](function(){return db['Tag'][_0xbe83('0x1e')]({'attributes':['id',_0xbe83('0x17'),_0xbe83('0x46')],'where':{'id':_0x547e28['body'][_0xbe83('0x35')]}});})['then'](function(_0x3a6082){socket['emit'](_0xbe83('0x47'),{'id':Number(_0x547e28[_0xbe83('0x24')]['id']),'tags':_0x3a6082||[]});return{'id':Number(_0x547e28[_0xbe83('0x24')]['id']),'tags':_0x3a6082||[]};});}})[_0xbe83('0x15')](respondWithResult(_0x17a497,null))[_0xbe83('0x22')](handleError(_0x17a497,null));};exports[_0xbe83('0x48')]=function(_0x5e18c3,_0x98a471){return db[_0xbe83('0x19')]['find']({'where':{'id':_0x5e18c3[_0xbe83('0x24')]['id']}})[_0xbe83('0x15')](handleEntityNotFound(_0x98a471,null))['then'](function(_0x334c26){if(_0x334c26){return _0x334c26[_0xbe83('0x48')](_0x5e18c3[_0xbe83('0x20')]['ids']);}})[_0xbe83('0x15')](respondWithStatusCode(_0x98a471,null))['catch'](handleError(_0x98a471,null));};exports[_0xbe83('0x49')]=function(_0x19e305,_0x3d85af){var _0x362cfb=moment()[_0xbe83('0x4a')]()['toString']();var _0x45129c=path['join'](config[_0xbe83('0x4b')],'server','files',_0xbe83('0x4c'));var _0x1c8774=path['join'](config[_0xbe83('0x4b')],_0xbe83('0x4d'),_0xbe83('0x4e'),_0xbe83('0x4f'));var _0x26f1b3=path['join'](_0x45129c,_0x362cfb);var _0x571358=util[_0xbe83('0x41')](_0xbe83('0x50'),_0x19e305[_0xbe83('0x24')]['id'],_0x362cfb);var _0x3a64c3=path[_0xbe83('0x51')](_0x45129c,_0x571358);var _0x160764=[];if(_0x19e305[_0xbe83('0x20')][_0xbe83('0x4f')]){_0x160764[_0xbe83('0x52')]({'model':db[_0xbe83('0x53')],'as':_0xbe83('0x54'),'raw':!![]});}var _0xe21d8e=[{'model':db[_0xbe83('0x33')],'as':_0xbe83('0x55'),'attributes':['id',_0xbe83('0x31'),'from','to','cc',_0xbe83('0x56'),_0xbe83('0x57'),_0xbe83('0x58')],'where':{'secret':![]},'order':qs[_0xbe83('0x3a')]('id'),'include':_0x160764}];return db['MailInteraction'][_0xbe83('0x2f')]({'where':{'id':_0x19e305[_0xbe83('0x24')]['id']},'include':_0xe21d8e})[_0xbe83('0x15')](handleEntityNotFound(_0x3d85af,null))[_0xbe83('0x15')](function(_0x341747){if(_0x341747&&_0x341747[_0xbe83('0x55')]){var _0x35d072=_0x341747[_0xbe83('0x59')]({'plain':!![]});fs[_0xbe83('0x5a')](_0x26f1b3);return BPromise[_0xbe83('0x5b')](_0x35d072[_0xbe83('0x55')],function(_0x178153,_0xeb10f5){var _0x14132d={'from':_0x178153[_0xbe83('0x5c')],'to':_0x178153['to']||_0xbe83('0x5d'),'subject':_0x178153[_0xbe83('0x57')],'html':htmlEntities['decode'](_0x178153[_0xbe83('0x31')]),'headers':{'Date':moment(_0x178153['createdAt'])[_0xbe83('0x41')](_0xbe83('0x5e'))},'attachments':[]};if(_0x178153['cc']){_0x14132d[_0xbe83('0x5f')]['Cc']=_0x178153['cc'];}if(_0x178153[_0xbe83('0x56')]){_0x14132d[_0xbe83('0x5f')][_0xbe83('0x60')]=_0x178153[_0xbe83('0x56')];}return new BPromise(function(_0x44e727,_0x1bb1e0){if(_0x178153[_0xbe83('0x54')]){for(var _0x27688d=0x0;_0x27688d<_0x178153[_0xbe83('0x54')][_0xbe83('0x2a')];_0x27688d++){var _0x3ba279=_0x178153[_0xbe83('0x54')][_0x27688d];var _0x54e22d=path[_0xbe83('0x51')](_0x1c8774,_0x3ba279[_0xbe83('0x61')]);if(fs[_0xbe83('0x62')](_0x54e22d)){_0x14132d['attachments']['push']({'name':_0x3ba279[_0xbe83('0x17')],'contentType':_0x3ba279[_0xbe83('0x1c')],'data':fs[_0xbe83('0x63')](_0x54e22d)});}}}emlformat[_0xbe83('0x64')](_0x14132d,function(_0x5e96b3,_0x244061){if(_0x5e96b3)return _0x1bb1e0(_0x5e96b3);fs[_0xbe83('0x65')](path['join'](_0x26f1b3,util['format'](_0xbe83('0x66'),_0xeb10f5)),_0x244061);return _0x44e727(_0x244061);});});})[_0xbe83('0x15')](function(){return new BPromise(function(_0x4bbe0e,_0x274983){zipdir(_0x26f1b3,{'saveTo':_0x3a64c3},function(_0x25ad89,_0x2e3c62){if(_0x25ad89)return _0x274983(_0x25ad89);return _0x4bbe0e(_0x2e3c62);});})['then'](function(){return new BPromise(function(_0x1492d1,_0x128cfc){rimraf(_0x26f1b3,function(_0x2277cb){if(_0x2277cb)_0x128cfc(_0x2277cb);return _0x1492d1();});});})['then'](function(){return _0x3d85af[_0xbe83('0x49')](_0x3a64c3,_0x571358,function(_0x123991){if(!_0x123991)fs[_0xbe83('0x67')](_0x3a64c3);});});});}else{return _0x3d85af[_0xbe83('0x68')](0xc8);}})[_0xbe83('0x22')](handleError(_0x3d85af,null));}; \ No newline at end of file +var _0x6219=['writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','error','name','send','rawAttributes','key','getOptions','findAll','mail','query','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','options','find','create','MailInteraction','body','destroy','describe','addMessage','MailMessage','ids','omit','findOne','filters','hasOwnProperty','sort','where','pick','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','color','mailInteractionTags:save','removeTags','download','unix','join','root','server','tmp','attachments','push','Attachment','Attachments','Messages','from','createdAt','mkdirSync','each','missing.recipient@your.company.com','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','existsSync','readFileSync','build'];(function(_0x529143,_0x10f538){var _0x1364f5=function(_0x30d170){while(--_0x30d170){_0x529143['push'](_0x529143['shift']());}};_0x1364f5(++_0x10f538);}(_0x6219,0x1b3));var _0x9621=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x6219[_0x5d31f3];return _0x1cc88c;};'use strict';var emlformat=require(_0x9621('0x0'));var rimraf=require(_0x9621('0x1'));var zipdir=require(_0x9621('0x2'));var moment=require(_0x9621('0x3'));var BPromise=require('bluebird');var util=require(_0x9621('0x4'));var path=require(_0x9621('0x5'));var fs=require('fs');var _=require('lodash');var juice=require(_0x9621('0x6'));var Redis=require(_0x9621('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x9621('0x8'));var logger=require(_0x9621('0x9'))(_0x9621('0xa'));var config=require(_0x9621('0xb'));var db=require(_0x9621('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x9621('0xd')]=_[_0x9621('0xe')](config['redis'],{'host':_0x9621('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9621('0xd')]));require(_0x9621('0x10'))[_0x9621('0x11')](socket);function respondWithStatusCode(_0x112b69,_0x26f30d){_0x26f30d=_0x26f30d||0xcc;return function(_0x24eef1){if(_0x24eef1){return _0x112b69[_0x9621('0x12')](_0x26f30d);}return _0x112b69[_0x9621('0x13')](_0x26f30d)[_0x9621('0x14')]();};}function respondWithResult(_0x9ee364,_0x255774){_0x255774=_0x255774||0xc8;return function(_0x163494){if(_0x163494){return _0x9ee364[_0x9621('0x13')](_0x255774)[_0x9621('0x15')](_0x163494);}};}function respondWithFilteredResult(_0xe0b10e,_0x243e28){return function(_0x17070b){if(_0x17070b){var _0x320936=typeof _0x243e28[_0x9621('0x16')]===_0x9621('0x17')&&typeof _0x243e28[_0x9621('0x18')]===_0x9621('0x17');var _0x26f017=_0x17070b[_0x9621('0x19')];var _0x3f1687=_0x320936?0x0:_0x243e28[_0x9621('0x16')];var _0x55bd87=_0x320936?_0x17070b[_0x9621('0x19')]:_0x243e28['offset']+_0x243e28['limit'];var _0x34cac6;if(_0x55bd87>=_0x26f017){_0x55bd87=_0x26f017;_0x34cac6=0xc8;}else{_0x34cac6=0xce;}_0xe0b10e[_0x9621('0x13')](_0x34cac6);return _0xe0b10e[_0x9621('0x1a')]('Content-Range',_0x3f1687+'-'+_0x55bd87+'/'+_0x26f017)[_0x9621('0x15')](_0x17070b);}return null;};}function saveUpdates(_0x303e4c){return function(_0x665bba){if(_0x665bba){return _0x665bba[_0x9621('0x1b')](_0x303e4c)[_0x9621('0x1c')](function(_0x566161){return _0x566161;});}return null;};}function removeEntity(_0x426c4f){return function(_0x5e34ff){if(_0x5e34ff){return _0x5e34ff['destroy']()['then'](function(){_0x426c4f[_0x9621('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bbc66){return function(_0x5de46a){if(!_0x5de46a){_0x1bbc66[_0x9621('0x12')](0x194);}return _0x5de46a;};}function handleError(_0xf14d1f,_0x2ad559){_0x2ad559=_0x2ad559||0x1f4;return function(_0x2652ab){logger[_0x9621('0x1d')](_0x2652ab['stack']);if(_0x2652ab[_0x9621('0x1e')]){delete _0x2652ab[_0x9621('0x1e')];}_0xf14d1f[_0x9621('0x13')](_0x2ad559)[_0x9621('0x1f')](_0x2652ab);};}exports['index']=function(_0x538012,_0x120759){var _0x241787={};var _0x5a61f5=_['map'](db['MailInteraction'][_0x9621('0x20')],function(_0x54798e){return{'name':_0x54798e['fieldName'],'type':_0x54798e['type'][_0x9621('0x21')]};});_0x241787=qs[_0x9621('0x22')](_0x5a61f5,_0x538012);return interaction[_0x9621('0x23')](_0x9621('0x24'),_0x538012[_0x9621('0x25')],_0x538012['user'],_0x241787,_0x5a61f5)[_0x9621('0x1c')](respondWithFilteredResult(_0x120759,_0x241787))[_0x9621('0x26')](handleError(_0x120759,null));};exports[_0x9621('0x27')]=function(_0x440ddd,_0x94b627){var _0x3f3ad1={'raw':![],'where':{'id':_0x440ddd[_0x9621('0x28')]['id']}},_0x59a23a={};_0x59a23a[_0x9621('0x29')]=_[_0x9621('0x2a')](db['MailInteraction'][_0x9621('0x20')]);_0x59a23a['query']=_['keys'](_0x440ddd[_0x9621('0x25')]);_0x59a23a['filters']=_[_0x9621('0x2b')](_0x59a23a[_0x9621('0x29')],_0x59a23a[_0x9621('0x25')]);_0x3f3ad1[_0x9621('0x2c')]=_[_0x9621('0x2b')](_0x59a23a[_0x9621('0x29')],qs[_0x9621('0x2d')](_0x440ddd[_0x9621('0x25')][_0x9621('0x2d')]));_0x3f3ad1['attributes']=_0x3f3ad1[_0x9621('0x2c')][_0x9621('0x2e')]?_0x3f3ad1[_0x9621('0x2c')]:_0x59a23a[_0x9621('0x29')];if(_0x440ddd[_0x9621('0x25')][_0x9621('0x2f')]){_0x3f3ad1[_0x9621('0x30')]=[{'all':!![]}];}_0x3f3ad1=_['merge']({},_0x3f3ad1,_0x440ddd[_0x9621('0x31')]);return db['MailInteraction'][_0x9621('0x32')](_0x3f3ad1)[_0x9621('0x1c')](handleEntityNotFound(_0x94b627,null))[_0x9621('0x1c')](respondWithResult(_0x94b627,null))['catch'](handleError(_0x94b627,null));};exports[_0x9621('0x33')]=function(_0x307406,_0x102ed0){return db[_0x9621('0x34')][_0x9621('0x33')](_0x307406[_0x9621('0x35')],{})['then'](respondWithResult(_0x102ed0,0xc9))[_0x9621('0x26')](handleError(_0x102ed0,null));};exports[_0x9621('0x1b')]=function(_0x9b94ae,_0x17675b){if(_0x9b94ae[_0x9621('0x35')]['id']){delete _0x9b94ae[_0x9621('0x35')]['id'];}return db[_0x9621('0x34')]['find']({'where':{'id':_0x9b94ae[_0x9621('0x28')]['id']}})[_0x9621('0x1c')](handleEntityNotFound(_0x17675b,null))[_0x9621('0x1c')](saveUpdates(_0x9b94ae[_0x9621('0x35')],null))[_0x9621('0x1c')](respondWithResult(_0x17675b,null))['catch'](handleError(_0x17675b,null));};exports[_0x9621('0x36')]=function(_0x374537,_0x407498){return db[_0x9621('0x34')]['find']({'where':{'id':_0x374537['params']['id']}})['then'](handleEntityNotFound(_0x407498,null))['then'](removeEntity(_0x407498,null))['catch'](handleError(_0x407498,null));};exports[_0x9621('0x37')]=function(_0x4cc3c9,_0x4db323){return db[_0x9621('0x34')][_0x9621('0x37')]()[_0x9621('0x1c')](respondWithResult(_0x4db323,null))[_0x9621('0x26')](handleError(_0x4db323,null));};exports[_0x9621('0x38')]=function(_0x2b1741,_0x569b75){return db[_0x9621('0x39')][_0x9621('0x32')]({'where':{'id':_0x2b1741[_0x9621('0x28')]['id']}})['then'](handleEntityNotFound(_0x569b75,null))[_0x9621('0x1c')](function(_0x1b8a24){if(_0x1b8a24){return _0x1b8a24[_0x9621('0x38')](_0x2b1741['body'][_0x9621('0x3a')],_[_0x9621('0x3b')](_0x2b1741[_0x9621('0x35')],[_0x9621('0x3a'),'id'])||{});}})[_0x9621('0x1c')](respondWithResult(_0x569b75,null))[_0x9621('0x26')](handleError(_0x569b75,null));};exports['getMessages']=function(_0x5a3bc2,_0x5abbe2){var _0x11cbc8={'raw':![],'where':{}};var _0x21d761={};var _0x3501fe={'count':0x0,'rows':[]};return db[_0x9621('0x34')][_0x9621('0x3c')]({'where':{'id':_0x5a3bc2[_0x9621('0x28')]['id']}})[_0x9621('0x1c')](handleEntityNotFound(_0x5abbe2,null))[_0x9621('0x1c')](function(_0x55bc1a){if(_0x55bc1a){_0x21d761[_0x9621('0x29')]=_['keys'](db[_0x9621('0x39')][_0x9621('0x20')]);_0x21d761[_0x9621('0x25')]=_[_0x9621('0x2a')](_0x5a3bc2[_0x9621('0x25')]);_0x21d761[_0x9621('0x3d')]=_['intersection'](_0x21d761[_0x9621('0x29')],_0x21d761[_0x9621('0x25')]);_0x11cbc8['attributes']=_['intersection'](_0x21d761[_0x9621('0x29')],qs[_0x9621('0x2d')](_0x5a3bc2[_0x9621('0x25')][_0x9621('0x2d')]));_0x11cbc8[_0x9621('0x2c')]=_0x11cbc8['attributes'][_0x9621('0x2e')]?_0x11cbc8[_0x9621('0x2c')]:_0x21d761['model'];if(!_0x5a3bc2[_0x9621('0x25')][_0x9621('0x3e')]('nolimit')){_0x11cbc8[_0x9621('0x18')]=qs[_0x9621('0x18')](_0x5a3bc2[_0x9621('0x25')][_0x9621('0x18')]);_0x11cbc8[_0x9621('0x16')]=qs[_0x9621('0x16')](_0x5a3bc2[_0x9621('0x25')]['offset']);}_0x11cbc8['order']=qs[_0x9621('0x3f')](_0x5a3bc2['query']['sort']);_0x11cbc8[_0x9621('0x40')]=qs[_0x9621('0x3d')](_[_0x9621('0x41')](_0x5a3bc2['query'],_0x21d761[_0x9621('0x3d')]));_0x11cbc8[_0x9621('0x40')]['MailInteractionId']=_0x55bc1a['id'];if(_0x5a3bc2[_0x9621('0x25')][_0x9621('0x42')]){_0x11cbc8[_0x9621('0x40')]=_[_0x9621('0x43')](_0x11cbc8[_0x9621('0x40')],{'$or':_[_0x9621('0x44')](_0x11cbc8[_0x9621('0x2c')],function(_0x5073ac){var _0x25cc6f={};_0x25cc6f[_0x5073ac]={'$like':'%'+_0x5a3bc2[_0x9621('0x25')][_0x9621('0x42')]+'%'};return _0x25cc6f;})});}if(_0x5a3bc2[_0x9621('0x25')][_0x9621('0x45')]){var _0x344a49=_0x5a3bc2['query'][_0x9621('0x45')]['split'](',');var _0x12f43e={};_0x12f43e[_0x344a49[0x0]]={'$gte':moment(_0x344a49[0x1])[_0x9621('0x46')](_0x9621('0x47'))};_0x11cbc8[_0x9621('0x40')]=_['merge'](_0x11cbc8['where'],_0x12f43e);}_0x11cbc8=_[_0x9621('0x43')]({},_0x11cbc8,_0x5a3bc2['options']);return db['MailMessage'][_0x9621('0x19')]({'where':_0x11cbc8[_0x9621('0x40')]})[_0x9621('0x1c')](function(_0x44ea7f){_0x3501fe[_0x9621('0x19')]=_0x44ea7f;if(_0x5a3bc2[_0x9621('0x25')][_0x9621('0x2f')]){_0x11cbc8['include']=[{'all':!![]}];}return db['MailMessage'][_0x9621('0x23')](_0x11cbc8);})['then'](function(_0x2dd1fe){if(_0x5a3bc2[_0x9621('0x25')][_0x9621('0x48')]===_0x9621('0x49')){for(var _0x1ec076=0x0;_0x1ec076<_0x2dd1fe[_0x9621('0x2e')];_0x1ec076++){_0x2dd1fe[_0x1ec076][_0x9621('0x35')]=juice(_0x2dd1fe[_0x1ec076]['body']);}}_0x3501fe[_0x9621('0x4a')]=_0x2dd1fe;return _0x3501fe;});}})[_0x9621('0x1c')](respondWithFilteredResult(_0x5abbe2,_0x11cbc8))[_0x9621('0x26')](handleError(_0x5abbe2,null));};exports[_0x9621('0x4b')]=function(_0x4bc222,_0x2529e5){return db[_0x9621('0x34')][_0x9621('0x32')]({'where':{'id':_0x4bc222[_0x9621('0x28')]['id']}})[_0x9621('0x1c')](handleEntityNotFound(_0x2529e5,null))['then'](function(_0x4ba836){if(_0x4ba836){return _0x4ba836[_0x9621('0x4c')](_0x4bc222['body']['ids'],_[_0x9621('0x3b')](_0x4bc222[_0x9621('0x35')],[_0x9621('0x3a'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x9621('0x4d')],'where':{'id':_0x4bc222[_0x9621('0x35')]['ids']}});})[_0x9621('0x1c')](function(_0x25b55a){socket['emit'](_0x9621('0x4e'),{'id':Number(_0x4bc222[_0x9621('0x28')]['id']),'tags':_0x25b55a||[]});return{'id':Number(_0x4bc222[_0x9621('0x28')]['id']),'tags':_0x25b55a||[]};});}})[_0x9621('0x1c')](respondWithResult(_0x2529e5,null))[_0x9621('0x26')](handleError(_0x2529e5,null));};exports[_0x9621('0x4f')]=function(_0x337950,_0x5f25cc){return db[_0x9621('0x34')][_0x9621('0x32')]({'where':{'id':_0x337950[_0x9621('0x28')]['id']}})[_0x9621('0x1c')](handleEntityNotFound(_0x5f25cc,null))[_0x9621('0x1c')](function(_0x16bc7b){if(_0x16bc7b){return _0x16bc7b['removeTags'](_0x337950[_0x9621('0x25')][_0x9621('0x3a')]);}})[_0x9621('0x1c')](respondWithStatusCode(_0x5f25cc,null))[_0x9621('0x26')](handleError(_0x5f25cc,null));};exports[_0x9621('0x50')]=function(_0x11bd9d,_0x2a1880){var _0x316052=moment()[_0x9621('0x51')]()['toString']();var _0xd1881c=path[_0x9621('0x52')](config[_0x9621('0x53')],_0x9621('0x54'),'files',_0x9621('0x55'));var _0x3c6401=path[_0x9621('0x52')](config['root'],'server','files',_0x9621('0x56'));var _0x4f742e=path[_0x9621('0x52')](_0xd1881c,_0x316052);var _0x40a21c=util['format']('transcript-%d-%s.zip',_0x11bd9d[_0x9621('0x28')]['id'],_0x316052);var _0x3bcdaa=path['join'](_0xd1881c,_0x40a21c);var _0x59cf54=[];if(_0x11bd9d['query'][_0x9621('0x56')]){_0x59cf54[_0x9621('0x57')]({'model':db[_0x9621('0x58')],'as':_0x9621('0x59'),'raw':!![]});}var _0x458daa=[{'model':db[_0x9621('0x39')],'as':_0x9621('0x5a'),'attributes':['id',_0x9621('0x35'),_0x9621('0x5b'),'to','cc','bcc','subject',_0x9621('0x5c')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x59cf54}];return db[_0x9621('0x34')]['find']({'where':{'id':_0x11bd9d['params']['id']},'include':_0x458daa})[_0x9621('0x1c')](handleEntityNotFound(_0x2a1880,null))[_0x9621('0x1c')](function(_0x4f2471){if(_0x4f2471&&_0x4f2471[_0x9621('0x5a')]){var _0x405fa2=_0x4f2471['get']({'plain':!![]});fs[_0x9621('0x5d')](_0x4f742e);return BPromise[_0x9621('0x5e')](_0x405fa2[_0x9621('0x5a')],function(_0x2b841f,_0x39313d){var _0x27433d={'from':_0x2b841f['from'],'to':_0x2b841f['to']||_0x9621('0x5f'),'subject':_0x2b841f[_0x9621('0x60')],'html':htmlEntities[_0x9621('0x61')](_0x2b841f[_0x9621('0x35')]),'headers':{'Date':moment(_0x2b841f[_0x9621('0x5c')])[_0x9621('0x46')](_0x9621('0x62'))},'attachments':[]};if(_0x2b841f['cc']){_0x27433d[_0x9621('0x63')]['Cc']=_0x2b841f['cc'];}if(_0x2b841f[_0x9621('0x64')]){_0x27433d[_0x9621('0x63')]['Bcc']=_0x2b841f['bcc'];}return new BPromise(function(_0x33cfe2,_0x283939){if(_0x2b841f[_0x9621('0x59')]){for(var _0x42cc2c=0x0;_0x42cc2c<_0x2b841f[_0x9621('0x59')][_0x9621('0x2e')];_0x42cc2c++){var _0x397d12=_0x2b841f['Attachments'][_0x42cc2c];var _0xfb0084=path[_0x9621('0x52')](_0x3c6401,_0x397d12[_0x9621('0x65')]);if(fs[_0x9621('0x66')](_0xfb0084)){_0x27433d['attachments']['push']({'name':_0x397d12[_0x9621('0x1e')],'contentType':_0x397d12['type'],'data':fs[_0x9621('0x67')](_0xfb0084)});}}}emlformat[_0x9621('0x68')](_0x27433d,function(_0x23a505,_0x40f5f2){if(_0x23a505)return _0x283939(_0x23a505);fs[_0x9621('0x69')](path['join'](_0x4f742e,util[_0x9621('0x46')](_0x9621('0x6a'),_0x39313d)),_0x40f5f2);return _0x33cfe2(_0x40f5f2);});});})['then'](function(){return new BPromise(function(_0x559849,_0x2a6f77){zipdir(_0x4f742e,{'saveTo':_0x3bcdaa},function(_0x46d9a0,_0x4b79e3){if(_0x46d9a0)return _0x2a6f77(_0x46d9a0);return _0x559849(_0x4b79e3);});})[_0x9621('0x1c')](function(){return new BPromise(function(_0x7c232,_0x58e214){rimraf(_0x4f742e,function(_0x3c1cf8){if(_0x3c1cf8)_0x58e214(_0x3c1cf8);return _0x7c232();});});})['then'](function(){return _0x2a1880[_0x9621('0x50')](_0x3bcdaa,_0x40a21c,function(_0x2e7159){if(!_0x2e7159)fs[_0x9621('0x6b')](_0x3bcdaa);});});});}else{return _0x2a1880['sendStatus'](0xc8);}})[_0x9621('0x26')](handleError(_0x2a1880,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d0ce635..d3f361a 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 _0xb057=['catch','hook','exports','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x371474,_0x11546f){var _0xee9fec=function(_0x470124){while(--_0x470124){_0x371474['push'](_0x371474['shift']());}};_0xee9fec(++_0x11546f);}(_0xb057,0x1f0));var _0x7b05=function(_0x4e94be,_0x3e3b1e){_0x4e94be=_0x4e94be-0x0;var _0x3fb3f4=_0xb057[_0x4e94be];return _0x3fb3f4;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x7b05('0x0'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7b05('0x1')](0x0);var events={'afterCreate':_0x7b05('0x2'),'afterUpdate':_0x7b05('0x3'),'afterDestroy':_0x7b05('0x4')};function emitEvent(_0x472013){return function(_0x2a49e2,_0x1f7fc4,_0x42351a){_0x2a49e2[_0x7b05('0x5')]({'attributes':['id'],'raw':!![]})[_0x7b05('0x6')](function(_0x26b15b){_0x2a49e2[_0x7b05('0x7')](_0x7b05('0x8'),_0x26b15b[_0x7b05('0x9')](function(_0x17a27a){return{'id':_0x17a27a['id']};}));return MailMessage[_0x7b05('0xa')]({'where':{'MailInteractionId':_0x2a49e2['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5d8a09){_0x2a49e2['setDataValue'](_0x7b05('0xb'),_0x5d8a09[_0x7b05('0xc')]);MailInteractionEvents[_0x7b05('0xd')](_0x472013+':'+_0x2a49e2['id'],_0x2a49e2);MailInteractionEvents[_0x7b05('0xd')](_0x472013,_0x2a49e2);_0x42351a(null);})[_0x7b05('0xe')](_0x42351a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x7b05('0xf')](e,emitEvent(event));}}module[_0x7b05('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x7857=['hasOwnProperty','hook','../../mysqldb','MailMessage','setMaxListeners','remove','getUsers','then','setDataValue','map','unreadMessages','emit','catch'];(function(_0x288514,_0x1eab7e){var _0x1dac9c=function(_0x3b7175){while(--_0x3b7175){_0x288514['push'](_0x288514['shift']());}};_0x1dac9c(++_0x1eab7e);}(_0x7857,0x1af));var _0x7785=function(_0x19a71e,_0x2f0739){_0x19a71e=_0x19a71e-0x0;var _0x3b8b0f=_0x7857[_0x19a71e];return _0x3b8b0f;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x7785('0x0'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x7785('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7785('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7785('0x3')};function emitEvent(_0xa7f0b4){return function(_0x226aba,_0x29a678,_0x2f4e4f){_0x226aba[_0x7785('0x4')]({'attributes':['id'],'raw':!![]})[_0x7785('0x5')](function(_0x2b728e){_0x226aba[_0x7785('0x6')]('Users',_0x2b728e[_0x7785('0x7')](function(_0x318809){return{'id':_0x318809['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x226aba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7785('0x5')](function(_0xd65aa8){_0x226aba[_0x7785('0x6')](_0x7785('0x8'),_0xd65aa8['length']);MailInteractionEvents[_0x7785('0x9')](_0xa7f0b4+':'+_0x226aba['id'],_0x226aba);MailInteractionEvents[_0x7785('0x9')](_0xa7f0b4,_0x226aba);_0x2f4e4f(null);})[_0x7785('0xa')](_0x2f4e4f(null));};}for(var e in events){if(events[_0x7785('0xb')](e)){var event=events[e];MailInteraction[_0x7785('0xc')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d08d51e..91ba00b 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 _0x7ae7=['changed','substatus','YYYY-MM-DD\x20HH:mm:ss','get','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closed','closedAt'];(function(_0x577954,_0x5f39c7){var _0xc0da7b=function(_0x329940){while(--_0x329940){_0x577954['push'](_0x577954['shift']());}};_0xc0da7b(++_0x5f39c7);}(_0x7ae7,0x164));var _0x77ae=function(_0xfbb69e,_0x1c65dd){_0xfbb69e=_0xfbb69e-0x0;var _0x31666f=_0x7ae7[_0xfbb69e];return _0x31666f;};'use strict';var _=require(_0x77ae('0x0'));var util=require(_0x77ae('0x1'));var logger=require(_0x77ae('0x2'))(_0x77ae('0x3'));var moment=require(_0x77ae('0x4'));var BPromise=require(_0x77ae('0x5'));var rp=require(_0x77ae('0x6'));var fs=require('fs');var path=require(_0x77ae('0x7'));var rimraf=require(_0x77ae('0x8'));var config=require(_0x77ae('0x9'));var attributes=require(_0x77ae('0xa'));module[_0x77ae('0xb')]=function(_0x48c1b4,_0x20ada3){return _0x48c1b4[_0x77ae('0xc')](_0x77ae('0xd'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x77ae('0xe'),'fields':[_0x77ae('0xf'),'to'],'type':_0x77ae('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f3d02,_0x6ffa2,_0x3232e0){if(_0x3f3d02['substatus']){_0x3f3d02[_0x77ae('0x11')]=moment()[_0x77ae('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3f3d02[_0x77ae('0x13')]){_0x3f3d02[_0x77ae('0x14')]=moment()[_0x77ae('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3232e0(null,_0x6ffa2);},'beforeUpdate':function(_0x3d5374,_0x3b57dc,_0x49eb1d){if(_0x3d5374[_0x77ae('0x15')]('substatus')){_0x3d5374[_0x77ae('0x11')]=_0x3d5374[_0x77ae('0x16')]?moment()[_0x77ae('0x12')](_0x77ae('0x17')):null;}if(_0x3d5374[_0x77ae('0x15')](_0x77ae('0x13'))){_0x3d5374[_0x77ae('0x14')]=moment()[_0x77ae('0x12')](_0x77ae('0x17'));_0x3d5374['substatus']=null;_0x3d5374['substatusAt']=null;}_0x49eb1d(null,_0x3d5374);},'afterUpdate':function(_0x470268,_0x49de0b,_0x2c0914){var _0x4011c6=_0x48c1b4['models'];var _0x5694e5=_0x470268[_0x77ae('0x18')]({'plain':!![]});if(_0x5694e5[_0x77ae('0x13')]){return _0x4011c6['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x5694e5['id']}})[_0x77ae('0x19')](function(){_0x2c0914();})[_0x77ae('0x1a')](function(_0x45a918){_0x2c0914(_0x45a918);});}else{_0x2c0914();}}},'charset':_0x77ae('0x1b'),'collate':_0x77ae('0x1c')});}; \ No newline at end of file +var _0xc155=['utf8mb4','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','catch'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0xc155,0x187));var _0x5c15=function(_0x369ea8,_0x35b6cd){_0x369ea8=_0x369ea8-0x0;var _0x11162f=_0xc155[_0x369ea8];return _0x11162f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c15('0x0'))(_0x5c15('0x1'));var moment=require('moment');var BPromise=require(_0x5c15('0x2'));var rp=require(_0x5c15('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c15('0x4'));var config=require(_0x5c15('0x5'));var attributes=require(_0x5c15('0x6'));module['exports']=function(_0x5435ee,_0x2036d6){return _0x5435ee[_0x5c15('0x7')](_0x5c15('0x8'),attributes,{'tableName':_0x5c15('0x9'),'paranoid':![],'indexes':[{'name':_0x5c15('0xa'),'fields':[_0x5c15('0xb'),'to'],'type':_0x5c15('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1766dd,_0x434322,_0x64f4f5){if(_0x1766dd[_0x5c15('0xd')]){_0x1766dd[_0x5c15('0xe')]=moment()[_0x5c15('0xf')](_0x5c15('0x10'));}if(_0x1766dd[_0x5c15('0x11')]){_0x1766dd[_0x5c15('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x64f4f5(null,_0x434322);},'beforeUpdate':function(_0x4f06dd,_0x2c2295,_0x14b1fd){if(_0x4f06dd[_0x5c15('0x13')]('substatus')){_0x4f06dd['substatusAt']=_0x4f06dd[_0x5c15('0xd')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x4f06dd[_0x5c15('0x13')]('closed')){_0x4f06dd[_0x5c15('0x12')]=moment()[_0x5c15('0xf')](_0x5c15('0x10'));_0x4f06dd[_0x5c15('0xd')]=null;_0x4f06dd[_0x5c15('0xe')]=null;}_0x14b1fd(null,_0x4f06dd);},'afterUpdate':function(_0xf7e770,_0x7b87b7,_0x15c2a4){var _0x5b7680=_0x5435ee[_0x5c15('0x14')];var _0x16e69f=_0xf7e770[_0x5c15('0x15')]({'plain':!![]});if(_0x16e69f[_0x5c15('0x11')]){return _0x5b7680[_0x5c15('0x16')][_0x5c15('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x16e69f['id']}})['then'](function(){_0x15c2a4();})[_0x5c15('0x18')](function(_0x2c7603){_0x15c2a4(_0x2c7603);});}else{_0x15c2a4();}}},'charset':_0x5c15('0x19'),'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 fb865b8..c77745d 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 _0xba6e=['result','catch','UpdateMailInteraction','MailInteraction','update','body','raw','options','where','attributes','limit','AddTagsToMailInteraction','find','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message'];(function(_0x7e42fc,_0x109277){var _0x569c37=function(_0x581d9f){while(--_0x581d9f){_0x7e42fc['push'](_0x7e42fc['shift']());}};_0x569c37(++_0x109277);}(_0xba6e,0x168));var _0xeba6=function(_0x5e1eae,_0x1b0c16){_0x5e1eae=_0x5e1eae-0x0;var _0x51f5d7=_0xba6e[_0x5e1eae];return _0x51f5d7;};'use strict';var _=require(_0xeba6('0x0'));var util=require(_0xeba6('0x1'));var moment=require('moment');var BPromise=require(_0xeba6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeba6('0x3'));var db=require(_0xeba6('0x4'))['db'];var utils=require(_0xeba6('0x5'));var logger=require(_0xeba6('0x6'))(_0xeba6('0x7'));var config=require(_0xeba6('0x8'));var jayson=require(_0xeba6('0x9'));var client=jayson[_0xeba6('0xa')][_0xeba6('0xb')]({'port':0x232a});config[_0xeba6('0xc')]=_[_0xeba6('0xd')](config[_0xeba6('0xc')],{'host':_0xeba6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeba6('0xc')]));require(_0xeba6('0xf'))[_0xeba6('0x10')](socket);function respondWithRpcPromise(_0x1a1010,_0x18e626,_0x229f9a){return new BPromise(function(_0x59c0b8,_0x3b713e){return client[_0xeba6('0x11')](_0x1a1010,_0x229f9a)[_0xeba6('0x12')](function(_0x39b3b){logger[_0xeba6('0x13')]('MailInteraction,\x20%s,\x20%s',_0x18e626,_0xeba6('0x14'));logger[_0xeba6('0x15')](_0xeba6('0x16'),_0x18e626,_0xeba6('0x14'),JSON[_0xeba6('0x17')](_0x39b3b));if(_0x39b3b['error']){if(_0x39b3b[_0xeba6('0x18')]['code']===0x1f4){logger[_0xeba6('0x18')](_0xeba6('0x19'),_0x18e626,_0x39b3b[_0xeba6('0x18')][_0xeba6('0x1a')]);return _0x3b713e(_0x39b3b[_0xeba6('0x18')][_0xeba6('0x1a')]);}logger[_0xeba6('0x18')]('MailInteraction,\x20%s,\x20%s',_0x18e626,_0x39b3b[_0xeba6('0x18')][_0xeba6('0x1a')]);return _0x59c0b8(_0x39b3b['error'][_0xeba6('0x1a')]);}else{logger[_0xeba6('0x13')](_0xeba6('0x19'),_0x18e626,_0xeba6('0x14'));_0x59c0b8(_0x39b3b[_0xeba6('0x1b')][_0xeba6('0x1a')]);}})[_0xeba6('0x1c')](function(_0x1157a5){logger[_0xeba6('0x18')](_0xeba6('0x19'),_0x18e626,_0x1157a5);_0x3b713e(_0x1157a5);});});}exports[_0xeba6('0x1d')]=function(_0x45186b){var _0x131b0d=this;return new Promise(function(_0x13ba08,_0x5a7c69){return db[_0xeba6('0x1e')][_0xeba6('0x1f')](_0x45186b[_0xeba6('0x20')],{'raw':_0x45186b['options']?_0x45186b['options'][_0xeba6('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45186b[_0xeba6('0x22')]?_0x45186b[_0xeba6('0x22')][_0xeba6('0x23')]||null:null,'attributes':_0x45186b[_0xeba6('0x22')]?_0x45186b[_0xeba6('0x22')][_0xeba6('0x24')]||null:null,'limit':_0x45186b['options']?_0x45186b[_0xeba6('0x22')][_0xeba6('0x25')]||null:null})[_0xeba6('0x12')](function(_0x57d141){logger[_0xeba6('0x13')](_0xeba6('0x1d'),_0x45186b);logger[_0xeba6('0x15')](_0xeba6('0x1d'),_0x45186b,JSON[_0xeba6('0x17')](_0x57d141));_0x13ba08(_0x57d141);})[_0xeba6('0x1c')](function(_0x53a140){logger[_0xeba6('0x18')](_0xeba6('0x1d'),_0x53a140[_0xeba6('0x1a')],_0x45186b);_0x5a7c69(_0x131b0d[_0xeba6('0x18')](0x1f4,_0x53a140['message']));});});};exports[_0xeba6('0x26')]=function(_0x555d74){return new Promise(function(_0x4e09d9,_0x288a08){return db['MailInteraction'][_0xeba6('0x27')]({'where':_0x555d74[_0xeba6('0x22')]?_0x555d74['options']['where']||null:null})[_0xeba6('0x12')](function(_0x4ac185){if(_0x4ac185){return _0x4ac185['addTags'](_0x555d74[_0xeba6('0x20')][_0xeba6('0x28')],_['omit'](_0x555d74[_0xeba6('0x20')],['ids','id'])||{});}})[_0xeba6('0x29')](function(_0x1b8d06){logger[_0xeba6('0x13')]('AddTags',_0x555d74);logger[_0xeba6('0x15')]('AddTags',_0x555d74,JSON[_0xeba6('0x17')](_0x1b8d06));_0x4e09d9(_0x1b8d06);})[_0xeba6('0x1c')](function(_0x50dad8){logger[_0xeba6('0x18')](_0xeba6('0x2a'),_0x50dad8[_0xeba6('0x1a')],_0x555d74);_0x288a08(_this[_0xeba6('0x18')](0x1f4,_0x50dad8[_0xeba6('0x1a')]));});});}; \ No newline at end of file +var _0x8c2e=['options','raw','where','limit','then','debug','stringify','AddTagsToMailInteraction','find','addTags','body','ids','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','MailInteraction','update'];(function(_0x2bb942,_0x41751d){var _0x5b7d25=function(_0x2419e4){while(--_0x2419e4){_0x2bb942['push'](_0x2bb942['shift']());}};_0x5b7d25(++_0x41751d);}(_0x8c2e,0x17f));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe8c2('0x0'));var util=require(_0xe8c2('0x1'));var moment=require(_0xe8c2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8c2('0x3'));var fs=require('fs');var Redis=require(_0xe8c2('0x4'));var db=require(_0xe8c2('0x5'))['db'];var utils=require(_0xe8c2('0x6'));var logger=require('../../config/logger')(_0xe8c2('0x7'));var config=require(_0xe8c2('0x8'));var jayson=require(_0xe8c2('0x9'));var client=jayson[_0xe8c2('0xa')]['http']({'port':0x232a});config[_0xe8c2('0xb')]=_['defaults'](config[_0xe8c2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8c2('0xc'))(new Redis(config[_0xe8c2('0xb')]));require(_0xe8c2('0xd'))[_0xe8c2('0xe')](socket);function respondWithRpcPromise(_0x31be25,_0x76520c,_0x3eba75){return new BPromise(function(_0x59ae83,_0x375c0c){return client[_0xe8c2('0xf')](_0x31be25,_0x3eba75)['then'](function(_0x5e5c91){logger[_0xe8c2('0x10')]('MailInteraction,\x20%s,\x20%s',_0x76520c,'request\x20sent');logger['debug'](_0xe8c2('0x11'),_0x76520c,_0xe8c2('0x12'),JSON['stringify'](_0x5e5c91));if(_0x5e5c91[_0xe8c2('0x13')]){if(_0x5e5c91[_0xe8c2('0x13')][_0xe8c2('0x14')]===0x1f4){logger['error'](_0xe8c2('0x15'),_0x76520c,_0x5e5c91['error'][_0xe8c2('0x16')]);return _0x375c0c(_0x5e5c91['error']['message']);}logger[_0xe8c2('0x13')]('MailInteraction,\x20%s,\x20%s',_0x76520c,_0x5e5c91[_0xe8c2('0x13')][_0xe8c2('0x16')]);return _0x59ae83(_0x5e5c91[_0xe8c2('0x13')][_0xe8c2('0x16')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x76520c,_0xe8c2('0x12'));_0x59ae83(_0x5e5c91[_0xe8c2('0x17')]['message']);}})['catch'](function(_0x3a2f1d){logger[_0xe8c2('0x13')](_0xe8c2('0x15'),_0x76520c,_0x3a2f1d);_0x375c0c(_0x3a2f1d);});});}exports[_0xe8c2('0x18')]=function(_0x3efb86){var _0x25a3b0=this;return new Promise(function(_0x3ce022,_0x188dac){return db[_0xe8c2('0x19')][_0xe8c2('0x1a')](_0x3efb86['body'],{'raw':_0x3efb86['options']?_0x3efb86[_0xe8c2('0x1b')][_0xe8c2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3efb86[_0xe8c2('0x1b')]?_0x3efb86[_0xe8c2('0x1b')][_0xe8c2('0x1d')]||null:null,'attributes':_0x3efb86['options']?_0x3efb86[_0xe8c2('0x1b')]['attributes']||null:null,'limit':_0x3efb86[_0xe8c2('0x1b')]?_0x3efb86[_0xe8c2('0x1b')][_0xe8c2('0x1e')]||null:null})[_0xe8c2('0x1f')](function(_0x42c164){logger[_0xe8c2('0x10')]('UpdateMailInteraction',_0x3efb86);logger[_0xe8c2('0x20')](_0xe8c2('0x18'),_0x3efb86,JSON[_0xe8c2('0x21')](_0x42c164));_0x3ce022(_0x42c164);})['catch'](function(_0x4fe874){logger[_0xe8c2('0x13')](_0xe8c2('0x18'),_0x4fe874[_0xe8c2('0x16')],_0x3efb86);_0x188dac(_0x25a3b0[_0xe8c2('0x13')](0x1f4,_0x4fe874[_0xe8c2('0x16')]));});});};exports[_0xe8c2('0x22')]=function(_0x1ce19a){return new Promise(function(_0xd163a4,_0x1a2a52){return db['MailInteraction'][_0xe8c2('0x23')]({'where':_0x1ce19a[_0xe8c2('0x1b')]?_0x1ce19a['options']['where']||null:null})[_0xe8c2('0x1f')](function(_0x239a68){if(_0x239a68){return _0x239a68[_0xe8c2('0x24')](_0x1ce19a[_0xe8c2('0x25')][_0xe8c2('0x26')],_['omit'](_0x1ce19a[_0xe8c2('0x25')],[_0xe8c2('0x26'),'id'])||{});}})['spread'](function(_0xbd5345){logger[_0xe8c2('0x10')](_0xe8c2('0x27'),_0x1ce19a);logger[_0xe8c2('0x20')]('AddTags',_0x1ce19a,JSON['stringify'](_0xbd5345));_0xd163a4(_0xbd5345);})[_0xe8c2('0x28')](function(_0x57c727){logger[_0xe8c2('0x13')](_0xe8c2('0x27'),_0x57c727[_0xe8c2('0x16')],_0x1ce19a);_0x1a2a52(_this[_0xe8c2('0x13')](0x1f4,_0x57c727[_0xe8c2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 566a2fd..45d7c06 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 _0x9c06=['register','length','./mailInteraction.events','save','emit','removeListener'];(function(_0x3b3f4f,_0x403216){var _0x174dbe=function(_0x30e333){while(--_0x30e333){_0x3b3f4f['push'](_0x3b3f4f['shift']());}};_0x174dbe(++_0x403216);}(_0x9c06,0x116));var _0x69c0=function(_0xb5867,_0x3d07ee){_0xb5867=_0xb5867-0x0;var _0x463ab8=_0x9c06[_0xb5867];return _0x463ab8;};'use strict';var MailInteractionEvents=require(_0x69c0('0x0'));var events=[_0x69c0('0x1'),'remove','update'];function createListener(_0x3cf619,_0x1e4df1){return function(_0x58f2c1){_0x1e4df1[_0x69c0('0x2')](_0x3cf619,_0x58f2c1);};}function removeListener(_0x3abd5e,_0x1b4f7c){return function(){MailInteractionEvents[_0x69c0('0x3')](_0x3abd5e,_0x1b4f7c);};}exports[_0x69c0('0x4')]=function(_0x289630){for(var _0x314a9b=0x0,_0x35c9de=events[_0x69c0('0x5')];_0x314a9b<_0x35c9de;_0x314a9b++){var _0x195200=events[_0x314a9b];var _0x991097=createListener('mailInteraction:'+_0x195200,_0x289630);MailInteractionEvents['on'](_0x195200,_0x991097);}}; \ No newline at end of file +var _0xd842=['emit','removeListener','register','mailInteraction:','save','remove','update'];(function(_0x570182,_0xaabeeb){var _0x94acd8=function(_0x43a5d0){while(--_0x43a5d0){_0x570182['push'](_0x570182['shift']());}};_0x94acd8(++_0xaabeeb);}(_0xd842,0x1a8));var _0x2d84=function(_0x44ca53,_0x2db586){_0x44ca53=_0x44ca53-0x0;var _0x15b43e=_0xd842[_0x44ca53];return _0x15b43e;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x2d84('0x0'),_0x2d84('0x1'),_0x2d84('0x2')];function createListener(_0x1bcb87,_0x41f550){return function(_0x18995b){_0x41f550[_0x2d84('0x3')](_0x1bcb87,_0x18995b);};}function removeListener(_0xbbca27,_0x73a67f){return function(){MailInteractionEvents[_0x2d84('0x4')](_0xbbca27,_0x73a67f);};}exports[_0x2d84('0x5')]=function(_0x9a7ca3){for(var _0x51c74f=0x0,_0x21aee2=events['length'];_0x51c74f<_0x21aee2;_0x51c74f++){var _0xacbc5c=events[_0x51c74f];var _0x20f4ef=createListener(_0x2d84('0x6')+_0xacbc5c,_0x9a7ca3);MailInteractionEvents['on'](_0xacbc5c,_0x20f4ef);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 2f9b031..f29c616 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f27=['get','isAuthenticated','describe','express','Router','../../components/auth/service','./mailInteractionHasTag.controller'];(function(_0x19c483,_0x3b63fc){var _0x47ae32=function(_0x5fd5a0){while(--_0x5fd5a0){_0x19c483['push'](_0x19c483['shift']());}};_0x47ae32(++_0x3b63fc);}(_0x3f27,0x1f4));var _0x73f2=function(_0x445455,_0x37859b){_0x445455=_0x445455-0x0;var _0x3f8124=_0x3f27[_0x445455];return _0x3f8124;};'use strict';var express=require(_0x73f2('0x0'));var router=express[_0x73f2('0x1')]();var auth=require(_0x73f2('0x2'));var controller=require(_0x73f2('0x3'));router[_0x73f2('0x4')]('/describe',auth[_0x73f2('0x5')](),controller[_0x73f2('0x6')]);module['exports']=router; \ No newline at end of file +var _0xd4f4=['express','./mailInteractionHasTag.controller','get','describe'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0xd4f4,0x1bc));var _0x4d4f=function(_0x10486c,_0x812723){_0x10486c=_0x10486c-0x0;var _0x4cc618=_0xd4f4[_0x10486c];return _0x4cc618;};'use strict';var express=require(_0x4d4f('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x4d4f('0x1'));router[_0x4d4f('0x2')]('/describe',auth['isAuthenticated'](),controller[_0x4d4f('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index a72135b..fa2dbb3 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0xdd41e0,_0x20c610){var _0x1079e3=function(_0x1b4bc9){while(--_0x1b4bc9){_0xdd41e0['push'](_0xdd41e0['shift']());}};_0x1079e3(++_0x20c610);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x5dd55b,_0xeed781){var _0x2a439d=function(_0x50894b){while(--_0x50894b){_0x5dd55b['push'](_0x5dd55b['shift']());}};_0x2a439d(++_0xeed781);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 8604ef9..1250c9e 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2adb=['INTEGER'];(function(_0x452dbd,_0x3d1c96){var _0x1e669a=function(_0x265b25){while(--_0x265b25){_0x452dbd['push'](_0x452dbd['shift']());}};_0x1e669a(++_0x3d1c96);}(_0x2adb,0xac));var _0xb2ad=function(_0x59d609,_0x261b22){_0x59d609=_0x59d609-0x0;var _0x3f71cb=_0x2adb[_0x59d609];return _0x3f71cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xb2ad('0x0')],'defaultValue':null}}; \ No newline at end of file +var _0xe6eb=['exports','INTEGER','sequelize'];(function(_0x2f76a3,_0x3ddf73){var _0x3a4e1a=function(_0x17016f){while(--_0x17016f){_0x2f76a3['push'](_0x2f76a3['shift']());}};_0x3a4e1a(++_0x3ddf73);}(_0xe6eb,0x122));var _0xbe6e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe6eb[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xbe6e('0x0'));module[_0xbe6e('0x1')]={'MailInteractionId':{'type':Sequelize[_0xbe6e('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 6627734..6817b02 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bde=['exports','define','MailInteractionHasTag','./mailInteractionHasTag'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x6bde,0x11b));var _0xe6bd=function(_0x33f2dc,_0x6477c9){_0x33f2dc=_0x33f2dc-0x0;var _0x2f2cda=_0x6bde[_0x33f2dc];return _0x2f2cda;};'use strict';var attributes=require(_0xe6bd('0x0'));module[_0xe6bd('0x1')]=function(_0x36b89f){return _0x36b89f[_0xe6bd('0x2')](_0xe6bd('0x3'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe72=['exports','define','MailInteractionHasTag','mail_interaction_has_tags'];(function(_0x28ea3b,_0x13d7a1){var _0x5ac766=function(_0x1ea77b){while(--_0x1ea77b){_0x28ea3b['push'](_0x28ea3b['shift']());}};_0x5ac766(++_0x13d7a1);}(_0xfe72,0x170));var _0x2fe7=function(_0x51702d,_0x5a3af3){_0x51702d=_0x51702d-0x0;var _0x37d0ae=_0xfe72[_0x51702d];return _0x37d0ae;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x2fe7('0x0')]=function(_0x123127){return _0x123127[_0x2fe7('0x1')](_0x2fe7('0x2'),attributes,{'tableName':_0x2fe7('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 7e40cd7..9fd9225 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 _0x536f=['get','describe','/:id','/:id/download','tracked','mail','mailmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','isAuthenticated','index'];(function(_0x16e2b6,_0x31d3b6){var _0x398668=function(_0x541563){while(--_0x541563){_0x16e2b6['push'](_0x16e2b6['shift']());}};_0x398668(++_0x31d3b6);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf536('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf536('0x1')]();var fs_extra=require(_0xf536('0x2'));var auth=require(_0xf536('0x3'));var interaction=require(_0xf536('0x4'));var config=require('../../config/environment');var controller=require(_0xf536('0x5'));router['get']('/',auth[_0xf536('0x6')](),controller[_0xf536('0x7')]);router[_0xf536('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf536('0x9')]);router[_0xf536('0x8')](_0xf536('0xa'),auth[_0xf536('0x6')](),controller['show']);router['get'](_0xf536('0xb'),auth[_0xf536('0x6')](),controller['download']);router['post']('/',auth[_0xf536('0x6')](),interaction[_0xf536('0xc')](_0xf536('0xd'),_0xf536('0xe')),controller[_0xf536('0xf')]);router['put'](_0xf536('0xa'),auth['isAuthenticated'](),controller[_0xf536('0x10')]);router[_0xf536('0x11')](_0xf536('0x12'),auth[_0xf536('0x6')](),controller[_0xf536('0x13')]);router[_0xf536('0x11')](_0xf536('0x14'),auth[_0xf536('0x6')](),controller[_0xf536('0x15')]);router[_0xf536('0x16')](_0xf536('0xa'),auth[_0xf536('0x6')](),controller['destroy']);module[_0xf536('0x17')]=router; \ No newline at end of file +var _0xa45c=['download','post','tracked','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/download'];(function(_0x539128,_0x2f958b){var _0x2e956a=function(_0x1791fd){while(--_0x1791fd){_0x539128['push'](_0x539128['shift']());}};_0x2e956a(++_0x2f958b);}(_0xa45c,0x6d));var _0xca45=function(_0x5d30ce,_0x359294){_0x5d30ce=_0x5d30ce-0x0;var _0x1bb17b=_0xa45c[_0x5d30ce];return _0x1bb17b;};'use strict';var multer=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xca45('0x2'));var router=express['Router']();var fs_extra=require(_0xca45('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xca45('0x4'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xca45('0x5')]('/',auth[_0xca45('0x6')](),controller[_0xca45('0x7')]);router[_0xca45('0x5')]('/describe',auth[_0xca45('0x6')](),controller[_0xca45('0x8')]);router[_0xca45('0x5')](_0xca45('0x9'),auth[_0xca45('0x6')](),controller['show']);router[_0xca45('0x5')](_0xca45('0xa'),auth[_0xca45('0x6')](),controller[_0xca45('0xb')]);router[_0xca45('0xc')]('/',auth[_0xca45('0x6')](),interaction[_0xca45('0xd')]('mail',_0xca45('0xe')),controller[_0xca45('0xf')]);router[_0xca45('0x10')](_0xca45('0x9'),auth['isAuthenticated'](),controller[_0xca45('0x11')]);router[_0xca45('0x10')](_0xca45('0x12'),auth['isAuthenticated'](),controller[_0xca45('0x13')]);router['put'](_0xca45('0x14'),auth[_0xca45('0x6')](),controller[_0xca45('0x15')]);router[_0xca45('0x16')](_0xca45('0x9'),auth[_0xca45('0x6')](),controller[_0xca45('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 218133f..3c99948 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 _0xe597=['Chat','sequelize','lodash','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email'];(function(_0x4bedba,_0x301dec){var _0x4f72e4=function(_0xe6906b){while(--_0xe6906b){_0x4bedba['push'](_0x4bedba['shift']());}};_0x4f72e4(++_0x301dec);}(_0xe597,0xf8));var _0x7e59=function(_0x3b0fe4,_0x24dc73){_0x3b0fe4=_0x3b0fe4-0x0;var _0x1fc4f3=_0xe597[_0x3b0fe4];return _0x1fc4f3;};'use strict';var Sequelize=require(_0x7e59('0x0'));var _=require(_0x7e59('0x1'));module['exports']={'body':{'type':Sequelize[_0x7e59('0x2')](_0x7e59('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7e59('0x2')](_0x7e59('0x4'))},'read':{'type':Sequelize[_0x7e59('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7e59('0x6')]('in',_0x7e59('0x7')),'defaultValue':_0x7e59('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x7e59('0x8')]},'to':{'type':Sequelize[_0x7e59('0x2')](_0x7e59('0x3'))},'cc':{'type':Sequelize[_0x7e59('0x2')](_0x7e59('0x3'))},'bcc':{'type':Sequelize[_0x7e59('0x2')](_0x7e59('0x3'))},'subject':{'type':Sequelize[_0x7e59('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x7e59('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7e59('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7e59('0xa')]},'originTo':{'type':Sequelize[_0x7e59('0x2')](_0x7e59('0x3'))},'originCc':{'type':Sequelize[_0x7e59('0x2')](_0x7e59('0x3'))},'originChannel':{'type':Sequelize[_0x7e59('0x6')](_0x7e59('0xb'),_0x7e59('0xc')),'defaultValue':_0x7e59('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x8b15=['DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x290c0f,_0x205a99){var _0x3f369b=function(_0x7674b3){while(--_0x7674b3){_0x290c0f['push'](_0x290c0f['shift']());}};_0x3f369b(++_0x205a99);}(_0x8b15,0x162));var _0x58b1=function(_0x10312f,_0x25302b){_0x10312f=_0x10312f-0x0;var _0x2e95c7=_0x8b15[_0x10312f];return _0x2e95c7;};'use strict';var Sequelize=require(_0x58b1('0x0'));var _=require(_0x58b1('0x1'));module[_0x58b1('0x2')]={'body':{'type':Sequelize[_0x58b1('0x3')](_0x58b1('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x58b1('0x3')](_0x58b1('0x5'))},'read':{'type':Sequelize[_0x58b1('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x58b1('0x7')]('in',_0x58b1('0x8')),'defaultValue':_0x58b1('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x58b1('0x9')](0x1fe)},'from':{'type':Sequelize[_0x58b1('0x9')]},'to':{'type':Sequelize[_0x58b1('0x3')](_0x58b1('0x4'))},'cc':{'type':Sequelize[_0x58b1('0x3')](_0x58b1('0x4'))},'bcc':{'type':Sequelize[_0x58b1('0x3')]('long')},'subject':{'type':Sequelize[_0x58b1('0x3')]},'sentAt':{'type':Sequelize[_0x58b1('0xa')]},'attach':{'type':Sequelize[_0x58b1('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x58b1('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x58b1('0xa')]},'originTo':{'type':Sequelize[_0x58b1('0x3')](_0x58b1('0x4'))},'originCc':{'type':Sequelize[_0x58b1('0x3')](_0x58b1('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x58b1('0xc'),_0x58b1('0xd')),'defaultValue':_0x58b1('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0564945..b89adae 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 _0x4e71=['http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','stack','name','send','MailMessage','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','keys','length','find','body','params','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','reject','UserId','user','get','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','agent','interface','SIP/%s','channel','EventManager','rejectmessage','download','unix','toString','server','message-%s.eml','bcc','subject','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0x4e71,0x81));var _0x14e7=function(_0x5ce448,_0x2ecb1c){_0x5ce448=_0x5ce448-0x0;var _0x4bc29b=_0x4e71[_0x5ce448];return _0x4bc29b;};'use strict';var emlformat=require(_0x14e7('0x0'));var moment=require(_0x14e7('0x1'));var util=require(_0x14e7('0x2'));var path=require(_0x14e7('0x3'));var fs=require('fs');var _=require(_0x14e7('0x4'));var Redis=require(_0x14e7('0x5'));var htmlToText=require(_0x14e7('0x6'));var interactionService=require(_0x14e7('0x7'));var qs=require(_0x14e7('0x8'));var logger=require(_0x14e7('0x9'))(_0x14e7('0xa'));var interaction_log=require(_0x14e7('0x9'))('mail-interactions');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x14e7('0xb')]=_[_0x14e7('0xc')](config['redis'],{'host':_0x14e7('0xd'),'port':0x18eb});var socket=require(_0x14e7('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0x14e7('0xf'));require(_0x14e7('0x10'))[_0x14e7('0x11')](socket);var jayson=require(_0x14e7('0x12'));var client=jayson[_0x14e7('0x13')]['http']({'port':0x232c});var client9003=jayson[_0x14e7('0x13')]['http']({'port':0x232b});var client9002=jayson[_0x14e7('0x13')][_0x14e7('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x3d8866,_0x166347,_0x2157ba,_0xb4e04f){return new Promise(function(_0x55b036,_0x115af8){var _0x51bbfa=_0xb4e04f||client;return _0x51bbfa[_0x14e7('0x15')](_0x3d8866,_0x2157ba)['then'](function(_0x551702){logger[_0x14e7('0x16')](_0x14e7('0x17'),_0x166347,_0x14e7('0x18'));logger['debug'](_0x14e7('0x19'),_0x166347,_0x14e7('0x18'),JSON[_0x14e7('0x1a')](_0x551702));if(_0x551702[_0x14e7('0x1b')]){if(_0x551702['error'][_0x14e7('0x1c')]===0x1f4){logger[_0x14e7('0x1b')](_0x14e7('0x17'),_0x166347,_0x551702['error'][_0x14e7('0x1d')]);return _0x115af8(_0x551702['error'][_0x14e7('0x1d')]);}logger[_0x14e7('0x1b')](_0x14e7('0x17'),_0x166347,_0x551702[_0x14e7('0x1b')][_0x14e7('0x1d')]);return _0x55b036(_0x551702[_0x14e7('0x1b')][_0x14e7('0x1d')]);}else{logger[_0x14e7('0x16')](_0x14e7('0x17'),_0x166347,_0x14e7('0x18'));_0x55b036(_0x551702[_0x14e7('0x1e')]['message']);}})[_0x14e7('0x1f')](function(_0x5b37bb){logger[_0x14e7('0x1b')](_0x14e7('0x17'),_0x166347,_0x5b37bb);_0x115af8(_0x5b37bb);});});}function respondWithResult(_0x65a43f,_0x4e896d){_0x4e896d=_0x4e896d||0xc8;return function(_0x3b4866){if(_0x3b4866){return _0x65a43f[_0x14e7('0x20')](_0x4e896d)[_0x14e7('0x21')](_0x3b4866);}};}function respondWithFilteredResult(_0x28e407,_0x2eff8d){return function(_0x4aa55d){if(_0x4aa55d){var _0x2e4e80=typeof _0x2eff8d[_0x14e7('0x22')]===_0x14e7('0x23')&&typeof _0x2eff8d['limit']==='undefined';var _0x27c794=_0x4aa55d[_0x14e7('0x24')];var _0x1654d2=_0x2e4e80?0x0:_0x2eff8d[_0x14e7('0x22')];var _0x4e8a10=_0x2e4e80?_0x4aa55d[_0x14e7('0x24')]:_0x2eff8d['offset']+_0x2eff8d[_0x14e7('0x25')];var _0x24398c;if(_0x4e8a10>=_0x27c794){_0x4e8a10=_0x27c794;_0x24398c=0xc8;}else{_0x24398c=0xce;}_0x28e407[_0x14e7('0x20')](_0x24398c);return _0x28e407[_0x14e7('0x26')](_0x14e7('0x27'),_0x1654d2+'-'+_0x4e8a10+'/'+_0x27c794)['json'](_0x4aa55d);}return null;};}function saveUpdates(_0x141f57){return function(_0x364ff0){if(_0x364ff0){return _0x364ff0[_0x14e7('0x28')](_0x141f57)[_0x14e7('0x29')](function(_0x4e43fb){return _0x4e43fb;});}return null;};}function removeEntity(_0x855dcc){return function(_0x54ea8f){if(_0x54ea8f){return _0x54ea8f['destroy']()[_0x14e7('0x29')](function(){_0x855dcc[_0x14e7('0x20')](0xcc)[_0x14e7('0x2a')]();});}};}function handleEntityNotFound(_0x1b1780){return function(_0x2f0e2a){if(!_0x2f0e2a){_0x1b1780[_0x14e7('0x2b')](0x194);}return _0x2f0e2a;};}function handleError(_0x2d4e96,_0x426da3){_0x426da3=_0x426da3||0x1f4;return function(_0x13c8ce){logger[_0x14e7('0x1b')](_0x13c8ce[_0x14e7('0x2c')]);if(_0x13c8ce['name']){delete _0x13c8ce[_0x14e7('0x2d')];}_0x2d4e96[_0x14e7('0x20')](_0x426da3)[_0x14e7('0x2e')](_0x13c8ce);};}exports['index']=function(_0x40f7b7,_0x550b93){var _0x248031={},_0x555b37={},_0x298a48={'count':0x0,'rows':[]};var _0x3bf6e6=_['map'](db[_0x14e7('0x2f')][_0x14e7('0x30')],function(_0x3939a6){return{'name':_0x3939a6[_0x14e7('0x31')],'type':_0x3939a6[_0x14e7('0x32')][_0x14e7('0x33')]};});_0x555b37[_0x14e7('0x34')]=_[_0x14e7('0x35')](_0x3bf6e6,_0x14e7('0x2d'));_0x555b37[_0x14e7('0x36')]=_['keys'](_0x40f7b7[_0x14e7('0x36')]);_0x555b37[_0x14e7('0x37')]=_['intersection'](_0x555b37['model'],_0x555b37[_0x14e7('0x36')]);_0x248031[_0x14e7('0x38')]=_[_0x14e7('0x39')](_0x555b37['model'],qs[_0x14e7('0x3a')](_0x40f7b7['query'][_0x14e7('0x3a')]));_0x248031[_0x14e7('0x38')]=_0x248031[_0x14e7('0x38')]['length']?_0x248031[_0x14e7('0x38')]:_0x555b37[_0x14e7('0x34')];if(!_0x40f7b7['query'][_0x14e7('0x3b')](_0x14e7('0x3c'))){_0x248031[_0x14e7('0x25')]=qs['limit'](_0x40f7b7[_0x14e7('0x36')][_0x14e7('0x25')]);_0x248031[_0x14e7('0x22')]=qs[_0x14e7('0x22')](_0x40f7b7[_0x14e7('0x36')][_0x14e7('0x22')]);}_0x248031[_0x14e7('0x3d')]=qs[_0x14e7('0x3e')](_0x40f7b7[_0x14e7('0x36')][_0x14e7('0x3e')]);_0x248031['where']=qs[_0x14e7('0x37')](_[_0x14e7('0x3f')](_0x40f7b7[_0x14e7('0x36')],_0x555b37[_0x14e7('0x37')]),_0x3bf6e6);if(_0x40f7b7[_0x14e7('0x36')]['filter']){_0x248031[_0x14e7('0x40')]=_['merge'](_0x248031[_0x14e7('0x40')],{'$or':_[_0x14e7('0x35')](_0x3bf6e6,function(_0x2eb838){if(_0x2eb838['type']!==_0x14e7('0x41')){var _0xcdd7bd={};_0xcdd7bd[_0x2eb838['name']]={'$like':'%'+_0x40f7b7[_0x14e7('0x36')][_0x14e7('0x42')]+'%'};return _0xcdd7bd;}})});}_0x248031=_[_0x14e7('0x43')]({},_0x248031,_0x40f7b7[_0x14e7('0x44')]);var _0x2231f5={'where':_0x248031[_0x14e7('0x40')]};return db[_0x14e7('0x2f')][_0x14e7('0x24')](_0x2231f5)[_0x14e7('0x29')](function(_0x4ae26c){_0x298a48[_0x14e7('0x24')]=_0x4ae26c;if(_0x40f7b7[_0x14e7('0x36')][_0x14e7('0x45')]){_0x248031[_0x14e7('0x46')]=[{'all':!![]}];}return db[_0x14e7('0x2f')]['findAll'](_0x248031);})[_0x14e7('0x29')](function(_0x4c8f12){_0x298a48[_0x14e7('0x47')]=_0x4c8f12;return _0x298a48;})[_0x14e7('0x29')](respondWithFilteredResult(_0x550b93,_0x248031))['catch'](handleError(_0x550b93,null));};exports['show']=function(_0x5f0b03,_0x3e7272){var _0x49d049={'raw':!![],'where':{'id':_0x5f0b03['params']['id']}},_0x5ef46f={};_0x5ef46f[_0x14e7('0x34')]=_[_0x14e7('0x48')](db['MailMessage']['rawAttributes']);_0x5ef46f['query']=_[_0x14e7('0x48')](_0x5f0b03['query']);_0x5ef46f[_0x14e7('0x37')]=_[_0x14e7('0x39')](_0x5ef46f[_0x14e7('0x34')],_0x5ef46f[_0x14e7('0x36')]);_0x49d049[_0x14e7('0x38')]=_[_0x14e7('0x39')](_0x5ef46f[_0x14e7('0x34')],qs[_0x14e7('0x3a')](_0x5f0b03[_0x14e7('0x36')][_0x14e7('0x3a')]));_0x49d049[_0x14e7('0x38')]=_0x49d049[_0x14e7('0x38')][_0x14e7('0x49')]?_0x49d049[_0x14e7('0x38')]:_0x5ef46f['model'];if(_0x5f0b03[_0x14e7('0x36')][_0x14e7('0x45')]){_0x49d049[_0x14e7('0x46')]=[{'all':!![]}];}_0x49d049=_[_0x14e7('0x43')]({},_0x49d049,_0x5f0b03[_0x14e7('0x44')]);return db[_0x14e7('0x2f')][_0x14e7('0x4a')](_0x49d049)['then'](handleEntityNotFound(_0x3e7272,null))[_0x14e7('0x29')](respondWithResult(_0x3e7272,null))[_0x14e7('0x1f')](handleError(_0x3e7272,null));};exports['update']=function(_0x44cf2d,_0x1aaf1a){if(_0x44cf2d['body']['id']){delete _0x44cf2d[_0x14e7('0x4b')]['id'];}return db[_0x14e7('0x2f')][_0x14e7('0x4a')]({'where':{'id':_0x44cf2d[_0x14e7('0x4c')]['id']}})[_0x14e7('0x29')](handleEntityNotFound(_0x1aaf1a,null))[_0x14e7('0x29')](saveUpdates(_0x44cf2d['body'],null))[_0x14e7('0x29')](respondWithResult(_0x1aaf1a,null))[_0x14e7('0x1f')](handleError(_0x1aaf1a,null));};exports[_0x14e7('0x4d')]=function(_0xcb6470,_0x5b25d6){return db[_0x14e7('0x2f')][_0x14e7('0x4a')]({'where':{'id':_0xcb6470[_0x14e7('0x4c')]['id']}})[_0x14e7('0x29')](handleEntityNotFound(_0x5b25d6,null))[_0x14e7('0x29')](removeEntity(_0x5b25d6,null))[_0x14e7('0x1f')](handleError(_0x5b25d6,null));};exports[_0x14e7('0x4e')]=function(_0x33e738,_0xc2521e){return db[_0x14e7('0x2f')][_0x14e7('0x4e')]()[_0x14e7('0x29')](respondWithResult(_0xc2521e,null))[_0x14e7('0x1f')](handleError(_0xc2521e,null));};exports[_0x14e7('0x4f')]=function(_0x18802d,_0x2c86f1){return db['MailMessage'][_0x14e7('0x4f')](_0x18802d[_0x14e7('0x4b')])[_0x14e7('0x29')](function(_0x7fc2c5){if(_0x7fc2c5){if(_0x7fc2c5[_0x14e7('0x50')]===_0x14e7('0x51')&&!_0x7fc2c5[_0x14e7('0x52')]){var _0xf5a3e6,_0x48d325,_0x5374f6;if(_0x18802d[_0x14e7('0x4b')]['to']){_0x48d325=_0x18802d['body']['to'][_0x14e7('0x53')](',')[0x0];}return db[_0x14e7('0x54')][_0x14e7('0x55')]({'where':{'id':_0x7fc2c5[_0x14e7('0x56')]},'include':[{'model':db['CmList'],'as':_0x14e7('0x57'),'include':[{'model':db[_0x14e7('0x58')],'as':_0x14e7('0x59'),'where':{'email':_0x48d325},'limit':0x1,'order':[[_0x14e7('0x5a'),'DESC']]}]},{'model':db[_0x14e7('0x5b')],'as':_0x14e7('0x5c'),'raw':!![],'include':[{'model':db[_0x14e7('0x5d')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x2da5fd){_0xf5a3e6=_0x2da5fd;if(!_0xf5a3e6||!_0xf5a3e6[_0x14e7('0x5c')])return;var _0xe7a4bc=_0xf5a3e6[_0x14e7('0x5e')]();if(_0x18802d['body'][_0x14e7('0x5f')]&&_0x18802d['body']['attachments'][_0x14e7('0x49')]){for(var _0xa08a5e=0x0;_0xa08a5e<_0x18802d[_0x14e7('0x4b')][_0x14e7('0x5f')]['length'];_0xa08a5e+=0x1){_0x18802d[_0x14e7('0x4b')]['attachments'][_0xa08a5e]={'filename':_0x18802d[_0x14e7('0x4b')][_0x14e7('0x5f')][_0xa08a5e]['name'],'path':path[_0x14e7('0x60')](config[_0x14e7('0x61')],_0x14e7('0x62'),_0x18802d[_0x14e7('0x4b')][_0x14e7('0x5f')][_0xa08a5e][_0x14e7('0x63')])};}}_0x5374f6={'account':_0xe7a4bc,'message':_0x18802d[_0x14e7('0x4b')]};return;})[_0x14e7('0x29')](function(){if(_0xf5a3e6[_0x14e7('0x57')]){if(_0xf5a3e6['List']['Contacts'][_0x14e7('0x49')]){return _0xf5a3e6['List'][_0x14e7('0x59')][0x0];}else{return db[_0x14e7('0x58')][_0x14e7('0x4f')](_[_0x14e7('0xc')](_0x18802d[_0x14e7('0x4b')],{'firstName':_0x18802d[_0x14e7('0x4b')]['to'],'email':_0x18802d[_0x14e7('0x4b')]['to'],'phone':_0x18802d['body']['to'],'ListId':_0xf5a3e6[_0x14e7('0x64')]}));}}else{throw new Error(_0x14e7('0x65'));}})[_0x14e7('0x29')](function(){if(_0x5374f6){return respondWithRpcPromise(_0x14e7('0x66'),_0x14e7('0x67'),_0x5374f6,client9003)[_0x14e7('0x29')](function(_0x4d1932){return _0x7fc2c5[_0x14e7('0x28')]({'read':!![],'messageId':_0x4d1932[_0x14e7('0x68')],'sentAt':moment()[_0x14e7('0x69')](_0x14e7('0x6a'))});})[_0x14e7('0x1f')](function(_0x15ef58){logger[_0x14e7('0x1b')]('%s',JSON[_0x14e7('0x1a')](_0x15ef58));return _0x7fc2c5;});}return _0x7fc2c5;});}return _0x7fc2c5;}})['then'](respondWithResult(_0x2c86f1,0xc9))[_0x14e7('0x1f')](handleError(_0x2c86f1,null));};exports['accept']=function(_0x12c4cd,_0x5afe85){var _0x5b9a6e=_0x14e7('0x6b');return interactionService['acceptMessage'](_0x12c4cd,_0x5b9a6e)[_0x14e7('0x29')](respondWithResult(_0x5afe85,null))[_0x14e7('0x1f')](handleError(_0x5afe85,null));};exports[_0x14e7('0x6c')]=function(_0x5da5d5,_0x2df73c){var _0x23587b={'agent':{},'channel':_0x14e7('0x6b')};if(_0x5da5d5[_0x14e7('0x4b')]['id']){delete _0x5da5d5[_0x14e7('0x4b')]['id'];}_0x5da5d5[_0x14e7('0x4b')]['UserId']=_0x5da5d5[_0x14e7('0x4b')][_0x14e7('0x6d')]||_0x5da5d5[_0x14e7('0x6e')]['id'];_0x23587b['agent']['id']=_0x5da5d5[_0x14e7('0x4b')][_0x14e7('0x6d')];return db[_0x14e7('0x2f')][_0x14e7('0x4a')]({'where':{'id':_0x5da5d5['params']['id'],'UserId':null}})[_0x14e7('0x29')](handleEntityNotFound(_0x2df73c,null))[_0x14e7('0x29')](function(_0x23e117){if(_0x23e117){_0x23587b[_0x14e7('0x1d')]=_0x23e117[_0x14e7('0x6f')]({'plain':!![]});return db[_0x14e7('0x70')][_0x14e7('0x4a')]({'where':{'id':_0x23e117['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2df73c,null))[_0x14e7('0x29')](function(_0x40c06f){if(_0x40c06f){_0x23587b['interaction']=_0x40c06f['get']({'plain':!![]});interaction_log[_0x14e7('0x16')](_0x14e7('0x71'),_0x5da5d5['user']['id'],_0x5da5d5[_0x14e7('0x6e')][_0x14e7('0x2d')],_0x5da5d5[_0x14e7('0x6e')]['role'],_0x23587b[_0x14e7('0x72')]['id'],_0x5da5d5[_0x14e7('0x4b')]?JSON[_0x14e7('0x1a')](_0x5da5d5[_0x14e7('0x4b')]):_0x14e7('0x73'));return respondWithRpcPromise(_0x14e7('0x74'),_0x14e7('0x75'),_0x23587b);}return null;})[_0x14e7('0x29')](function(_0x75201e){var _0xbec74f=_0x14e7('0x76')+_0x75201e[_0x14e7('0x1d')]['ContactId'];return db['sequelize'][_0x14e7('0x36')](_0xbec74f,{'type':db[_0x14e7('0x77')][_0x14e7('0x78')][_0x14e7('0x79')],'raw':!![]})[_0x14e7('0x29')](function(_0x4f5580){return _0x4f5580;});})['then'](function(_0x15c270){if(_0x15c270){_0x23587b['message'][_0x14e7('0x7a')]=_0x15c270[0x0];if(!_0x5da5d5['body'][_0x14e7('0x6d')])return;return db['User']['find']({'where':{'id':_0x5da5d5[_0x14e7('0x4b')][_0x14e7('0x6d')],'role':'agent'},'attributes':['id',_0x14e7('0x2d'),_0x14e7('0x7b'),_0x14e7('0x7c'),_0x14e7('0x7d')],'raw':!![]});}return null;})['then'](function(_0x1a1ca3){if(!_0x1a1ca3)return null;_0x23587b[_0x14e7('0x1d')][_0x14e7('0x7e')]=_0x1a1ca3;return _0x23587b;})[_0x14e7('0x29')](function(_0x22c70e){if(_0x22c70e){_0x22c70e[_0x14e7('0x1d')][_0x14e7('0x7f')]=util[_0x14e7('0x69')](_0x14e7('0x80'),_0x5da5d5['user'][_0x14e7('0x2d')]);_0x22c70e[_0x14e7('0x1d')][_0x14e7('0x81')]=_0x23587b['channel'];_0x22c70e['message']['motionChannel']=_0x23587b['channel'];_0x22c70e[_0x14e7('0x1d')]['event']=_0x14e7('0x6c');_0x22c70e[_0x14e7('0x1d')]['body']=htmlToText['fromString'](_0x23587b[_0x14e7('0x1d')][_0x14e7('0x4b')]);respondWithRpcPromise(_0x14e7('0x82'),_0x14e7('0x82'),{'event':_0x14e7('0x83'),'message':_0x22c70e['message']},client9002);return _0x23587b;}return null;})[_0x14e7('0x29')](respondWithResult(_0x2df73c,null))[_0x14e7('0x1f')](handleError(_0x2df73c,null));};exports[_0x14e7('0x84')]=function(_0x481326,_0x259765){var _0x523153=moment()[_0x14e7('0x85')]()[_0x14e7('0x86')]();var _0xeb5333=path[_0x14e7('0x60')](config[_0x14e7('0x61')],_0x14e7('0x87'),'files','tmp');var _0x45b46e=path['join'](config['root'],_0x14e7('0x87'),'files',_0x14e7('0x5f'));var _0xe8e387=util[_0x14e7('0x69')](_0x14e7('0x88'),_0x523153);return db[_0x14e7('0x2f')]['find']({'where':{'id':_0x481326[_0x14e7('0x4c')]['id']},'attributes':['id',_0x14e7('0x4b'),'from','to','cc',_0x14e7('0x89'),_0x14e7('0x8a'),'createdAt'],'include':_0x481326[_0x14e7('0x36')]['attachments']?[{'model':db[_0x14e7('0x8b')],'as':_0x14e7('0x8c')}]:undefined})[_0x14e7('0x29')](handleEntityNotFound(_0x259765,null))[_0x14e7('0x29')](function(_0xd29ba5){if(_0xd29ba5){var _0xf99766=_0xd29ba5;var _0x381b71={'from':_0xf99766[_0x14e7('0x8d')],'to':_0xf99766['to'],'subject':_0xf99766[_0x14e7('0x8a')],'html':htmlEntities[_0x14e7('0x8e')](_0xf99766[_0x14e7('0x4b')]),'headers':{'Date':moment(_0xf99766['createdAt'])[_0x14e7('0x69')](_0x14e7('0x8f'))},'attachments':[]};if(_0xd29ba5['cc']){_0x381b71['headers']['Cc']=_0xd29ba5['cc'];}if(_0xd29ba5['bcc']){_0x381b71['headers'][_0x14e7('0x90')]=_0xd29ba5['bcc'];}return new Promise(function(_0x8b1757,_0x3a2e37){if(_0xd29ba5[_0x14e7('0x8c')]){for(var _0x30d264=0x0;_0x30d264<_0xd29ba5[_0x14e7('0x8c')][_0x14e7('0x49')];_0x30d264++){var _0x2dfb34=_0xd29ba5[_0x14e7('0x8c')][_0x30d264];var _0x5871a1=path[_0x14e7('0x60')](_0x45b46e,_0x2dfb34[_0x14e7('0x63')]);if(fs[_0x14e7('0x91')](_0x5871a1)){_0x381b71[_0x14e7('0x5f')][_0x14e7('0x92')]({'name':_0x2dfb34[_0x14e7('0x2d')],'contentType':_0x2dfb34['type'],'data':fs[_0x14e7('0x93')](_0x5871a1)});}}}emlformat[_0x14e7('0x94')](_0x381b71,function(_0x11f775,_0x183286){if(_0x11f775)return _0x3a2e37(_0x11f775);fs['writeFileSync'](path[_0x14e7('0x60')](_0xeb5333,_0xe8e387),_0x183286);return _0x8b1757(_0x183286);});});}})[_0x14e7('0x29')](function(_0x429597){if(_0x429597){return _0x259765['download'](path[_0x14e7('0x60')](_0xeb5333,_0xe8e387),_0xe8e387,function(_0x10d3aa){if(!_0x10d3aa)fs['unlinkSync'](path[_0x14e7('0x60')](_0xeb5333,_0xe8e387));});}})['catch'](handleError(_0x259765,null));}; \ No newline at end of file +var _0x198f=['join','server/files/attachments','basename','List','Contacts','ListId','List\x20not\x20found','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','acceptMessage','UserId','user','agent','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','SIP/%s','channel','motionChannel','reject','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','subject','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','push','readFileSync','build','unlinkSync','eml-format','moment','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','info','MailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','limit','count','set','Content-Range','update','destroy','then','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','findAll','rows','show','params','keys','includeAll','include','body','find','describe','create','out','secret','MailAccount','findOne','CmList','CmContact','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments'];(function(_0x276ae4,_0x32b699){var _0x22d832=function(_0xa4e3d2){while(--_0xa4e3d2){_0x276ae4['push'](_0x276ae4['shift']());}};_0x22d832(++_0x32b699);}(_0x198f,0x16a));var _0xf198=function(_0x33adeb,_0x2a9393){_0x33adeb=_0x33adeb-0x0;var _0x579bed=_0x198f[_0x33adeb];return _0x579bed;};'use strict';var emlformat=require(_0xf198('0x0'));var moment=require(_0xf198('0x1'));var util=require('util');var path=require(_0xf198('0x2'));var fs=require('fs');var _=require(_0xf198('0x3'));var Redis=require(_0xf198('0x4'));var htmlToText=require('html-to-text');var interactionService=require(_0xf198('0x5'));var qs=require(_0xf198('0x6'));var logger=require(_0xf198('0x7'))(_0xf198('0x8'));var interaction_log=require('../../config/logger')(_0xf198('0x9'));var config=require(_0xf198('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf198('0xb')](config[_0xf198('0xc')],{'host':_0xf198('0xd'),'port':0x18eb});var socket=require(_0xf198('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0xf198('0xf'));require(_0xf198('0x10'))[_0xf198('0x11')](socket);var jayson=require(_0xf198('0x12'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0xf198('0x13')]({'port':0x232b});var client9002=jayson[_0xf198('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29698a,_0x6326a6,_0x5ae071,_0x586181){return new Promise(function(_0x317fec,_0x212b8b){var _0x374553=_0x586181||client;return _0x374553[_0xf198('0x15')](_0x29698a,_0x5ae071)['then'](function(_0x35bcf3){logger[_0xf198('0x16')](_0xf198('0x17'),_0x6326a6,'request\x20sent');logger[_0xf198('0x18')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x6326a6,'request\x20sent',JSON[_0xf198('0x19')](_0x35bcf3));if(_0x35bcf3[_0xf198('0x1a')]){if(_0x35bcf3['error'][_0xf198('0x1b')]===0x1f4){logger[_0xf198('0x1a')](_0xf198('0x17'),_0x6326a6,_0x35bcf3['error'][_0xf198('0x1c')]);return _0x212b8b(_0x35bcf3[_0xf198('0x1a')][_0xf198('0x1c')]);}logger[_0xf198('0x1a')]('MailMessage,\x20%s,\x20%s',_0x6326a6,_0x35bcf3[_0xf198('0x1a')][_0xf198('0x1c')]);return _0x317fec(_0x35bcf3[_0xf198('0x1a')][_0xf198('0x1c')]);}else{logger[_0xf198('0x16')](_0xf198('0x17'),_0x6326a6,_0xf198('0x1d'));_0x317fec(_0x35bcf3[_0xf198('0x1e')][_0xf198('0x1c')]);}})[_0xf198('0x1f')](function(_0x36ed9a){logger[_0xf198('0x1a')](_0xf198('0x17'),_0x6326a6,_0x36ed9a);_0x212b8b(_0x36ed9a);});});}function respondWithResult(_0x2c7322,_0x1b9e7a){_0x1b9e7a=_0x1b9e7a||0xc8;return function(_0x462b0d){if(_0x462b0d){return _0x2c7322[_0xf198('0x20')](_0x1b9e7a)[_0xf198('0x21')](_0x462b0d);}};}function respondWithFilteredResult(_0x35662c,_0x3186e7){return function(_0x3065d2){if(_0x3065d2){var _0x1c34d8=typeof _0x3186e7[_0xf198('0x22')]==='undefined'&&typeof _0x3186e7[_0xf198('0x23')]==='undefined';var _0x13f702=_0x3065d2[_0xf198('0x24')];var _0x23eb44=_0x1c34d8?0x0:_0x3186e7['offset'];var _0x3d6990=_0x1c34d8?_0x3065d2['count']:_0x3186e7[_0xf198('0x22')]+_0x3186e7['limit'];var _0x2ad5fe;if(_0x3d6990>=_0x13f702){_0x3d6990=_0x13f702;_0x2ad5fe=0xc8;}else{_0x2ad5fe=0xce;}_0x35662c[_0xf198('0x20')](_0x2ad5fe);return _0x35662c[_0xf198('0x25')](_0xf198('0x26'),_0x23eb44+'-'+_0x3d6990+'/'+_0x13f702)[_0xf198('0x21')](_0x3065d2);}return null;};}function saveUpdates(_0x450cc1){return function(_0x57919b){if(_0x57919b){return _0x57919b[_0xf198('0x27')](_0x450cc1)['then'](function(_0xc98450){return _0xc98450;});}return null;};}function removeEntity(_0x42eba4){return function(_0x3b6c05){if(_0x3b6c05){return _0x3b6c05[_0xf198('0x28')]()[_0xf198('0x29')](function(){_0x42eba4[_0xf198('0x20')](0xcc)[_0xf198('0x2a')]();});}};}function handleEntityNotFound(_0x493e34){return function(_0x2d625f){if(!_0x2d625f){_0x493e34[_0xf198('0x2b')](0x194);}return _0x2d625f;};}function handleError(_0xf7ced1,_0x126f8a){_0x126f8a=_0x126f8a||0x1f4;return function(_0x416de3){logger[_0xf198('0x1a')](_0x416de3[_0xf198('0x2c')]);if(_0x416de3['name']){delete _0x416de3[_0xf198('0x2d')];}_0xf7ced1[_0xf198('0x20')](_0x126f8a)[_0xf198('0x2e')](_0x416de3);};}exports[_0xf198('0x2f')]=function(_0x1e217a,_0x48aaef){var _0x3890a7={},_0x261662={},_0x3c4aaf={'count':0x0,'rows':[]};var _0x1385f7=_['map'](db[_0xf198('0x30')][_0xf198('0x31')],function(_0x1cf6fa){return{'name':_0x1cf6fa[_0xf198('0x32')],'type':_0x1cf6fa[_0xf198('0x33')][_0xf198('0x34')]};});_0x261662[_0xf198('0x35')]=_['map'](_0x1385f7,_0xf198('0x2d'));_0x261662[_0xf198('0x36')]=_['keys'](_0x1e217a['query']);_0x261662[_0xf198('0x37')]=_[_0xf198('0x38')](_0x261662[_0xf198('0x35')],_0x261662[_0xf198('0x36')]);_0x3890a7['attributes']=_[_0xf198('0x38')](_0x261662[_0xf198('0x35')],qs[_0xf198('0x39')](_0x1e217a[_0xf198('0x36')][_0xf198('0x39')]));_0x3890a7[_0xf198('0x3a')]=_0x3890a7[_0xf198('0x3a')][_0xf198('0x3b')]?_0x3890a7[_0xf198('0x3a')]:_0x261662['model'];if(!_0x1e217a[_0xf198('0x36')][_0xf198('0x3c')](_0xf198('0x3d'))){_0x3890a7[_0xf198('0x23')]=qs[_0xf198('0x23')](_0x1e217a[_0xf198('0x36')]['limit']);_0x3890a7[_0xf198('0x22')]=qs[_0xf198('0x22')](_0x1e217a[_0xf198('0x36')][_0xf198('0x22')]);}_0x3890a7[_0xf198('0x3e')]=qs[_0xf198('0x3f')](_0x1e217a[_0xf198('0x36')][_0xf198('0x3f')]);_0x3890a7[_0xf198('0x40')]=qs[_0xf198('0x37')](_['pick'](_0x1e217a[_0xf198('0x36')],_0x261662['filters']),_0x1385f7);if(_0x1e217a['query'][_0xf198('0x41')]){_0x3890a7[_0xf198('0x40')]=_[_0xf198('0x42')](_0x3890a7[_0xf198('0x40')],{'$or':_[_0xf198('0x43')](_0x1385f7,function(_0x13b0e6){if(_0x13b0e6[_0xf198('0x33')]!==_0xf198('0x44')){var _0x592f02={};_0x592f02[_0x13b0e6[_0xf198('0x2d')]]={'$like':'%'+_0x1e217a[_0xf198('0x36')][_0xf198('0x41')]+'%'};return _0x592f02;}})});}_0x3890a7=_['merge']({},_0x3890a7,_0x1e217a[_0xf198('0x45')]);var _0x5b26c8={'where':_0x3890a7[_0xf198('0x40')]};return db[_0xf198('0x30')][_0xf198('0x24')](_0x5b26c8)['then'](function(_0x573b6c){_0x3c4aaf[_0xf198('0x24')]=_0x573b6c;if(_0x1e217a[_0xf198('0x36')]['includeAll']){_0x3890a7['include']=[{'all':!![]}];}return db[_0xf198('0x30')][_0xf198('0x46')](_0x3890a7);})[_0xf198('0x29')](function(_0x17466c){_0x3c4aaf[_0xf198('0x47')]=_0x17466c;return _0x3c4aaf;})[_0xf198('0x29')](respondWithFilteredResult(_0x48aaef,_0x3890a7))[_0xf198('0x1f')](handleError(_0x48aaef,null));};exports[_0xf198('0x48')]=function(_0x16511a,_0x2c01d7){var _0x5a343c={'raw':!![],'where':{'id':_0x16511a[_0xf198('0x49')]['id']}},_0x2110bb={};_0x2110bb[_0xf198('0x35')]=_[_0xf198('0x4a')](db['MailMessage']['rawAttributes']);_0x2110bb[_0xf198('0x36')]=_[_0xf198('0x4a')](_0x16511a['query']);_0x2110bb['filters']=_[_0xf198('0x38')](_0x2110bb[_0xf198('0x35')],_0x2110bb[_0xf198('0x36')]);_0x5a343c[_0xf198('0x3a')]=_[_0xf198('0x38')](_0x2110bb[_0xf198('0x35')],qs[_0xf198('0x39')](_0x16511a[_0xf198('0x36')][_0xf198('0x39')]));_0x5a343c[_0xf198('0x3a')]=_0x5a343c[_0xf198('0x3a')][_0xf198('0x3b')]?_0x5a343c[_0xf198('0x3a')]:_0x2110bb[_0xf198('0x35')];if(_0x16511a[_0xf198('0x36')][_0xf198('0x4b')]){_0x5a343c[_0xf198('0x4c')]=[{'all':!![]}];}_0x5a343c=_[_0xf198('0x42')]({},_0x5a343c,_0x16511a[_0xf198('0x45')]);return db[_0xf198('0x30')]['find'](_0x5a343c)[_0xf198('0x29')](handleEntityNotFound(_0x2c01d7,null))[_0xf198('0x29')](respondWithResult(_0x2c01d7,null))[_0xf198('0x1f')](handleError(_0x2c01d7,null));};exports[_0xf198('0x27')]=function(_0x2358a0,_0x4eaa79){if(_0x2358a0[_0xf198('0x4d')]['id']){delete _0x2358a0[_0xf198('0x4d')]['id'];}return db[_0xf198('0x30')][_0xf198('0x4e')]({'where':{'id':_0x2358a0[_0xf198('0x49')]['id']}})[_0xf198('0x29')](handleEntityNotFound(_0x4eaa79,null))[_0xf198('0x29')](saveUpdates(_0x2358a0[_0xf198('0x4d')],null))[_0xf198('0x29')](respondWithResult(_0x4eaa79,null))[_0xf198('0x1f')](handleError(_0x4eaa79,null));};exports[_0xf198('0x28')]=function(_0x5afde8,_0x4effb6){return db[_0xf198('0x30')][_0xf198('0x4e')]({'where':{'id':_0x5afde8['params']['id']}})[_0xf198('0x29')](handleEntityNotFound(_0x4effb6,null))[_0xf198('0x29')](removeEntity(_0x4effb6,null))[_0xf198('0x1f')](handleError(_0x4effb6,null));};exports[_0xf198('0x4f')]=function(_0x4b1130,_0x4c18e4){return db[_0xf198('0x30')][_0xf198('0x4f')]()['then'](respondWithResult(_0x4c18e4,null))[_0xf198('0x1f')](handleError(_0x4c18e4,null));};exports[_0xf198('0x50')]=function(_0x34ae05,_0x3cf643){return db[_0xf198('0x30')]['create'](_0x34ae05['body'])['then'](function(_0x3aaa8c){if(_0x3aaa8c){if(_0x3aaa8c['direction']===_0xf198('0x51')&&!_0x3aaa8c[_0xf198('0x52')]){var _0x2a52a4,_0x233f07,_0x5b9807;if(_0x34ae05[_0xf198('0x4d')]['to']){_0x233f07=_0x34ae05[_0xf198('0x4d')]['to']['split'](',')[0x0];}return db[_0xf198('0x53')][_0xf198('0x54')]({'where':{'id':_0x3aaa8c['MailAccountId']},'include':[{'model':db[_0xf198('0x55')],'as':'List','include':[{'model':db[_0xf198('0x56')],'as':'Contacts','where':{'email':_0x233f07},'limit':0x1,'order':[[_0xf198('0x57'),_0xf198('0x58')]]}]},{'model':db[_0xf198('0x59')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xf198('0x5a')],'as':_0xf198('0x5a'),'raw':!![]}]}]})[_0xf198('0x29')](function(_0x44b0c8){_0x2a52a4=_0x44b0c8;if(!_0x2a52a4||!_0x2a52a4[_0xf198('0x5b')])return;var _0x54ad18=_0x2a52a4[_0xf198('0x5c')]();if(_0x34ae05[_0xf198('0x4d')][_0xf198('0x5d')]&&_0x34ae05[_0xf198('0x4d')][_0xf198('0x5d')][_0xf198('0x3b')]){for(var _0x47202e=0x0;_0x47202e<_0x34ae05[_0xf198('0x4d')][_0xf198('0x5d')][_0xf198('0x3b')];_0x47202e+=0x1){_0x34ae05[_0xf198('0x4d')][_0xf198('0x5d')][_0x47202e]={'filename':_0x34ae05[_0xf198('0x4d')][_0xf198('0x5d')][_0x47202e][_0xf198('0x2d')],'path':path[_0xf198('0x5e')](config['root'],_0xf198('0x5f'),_0x34ae05['body'][_0xf198('0x5d')][_0x47202e][_0xf198('0x60')])};}}_0x5b9807={'account':_0x54ad18,'message':_0x34ae05['body']};return;})['then'](function(){if(_0x2a52a4[_0xf198('0x61')]){if(_0x2a52a4[_0xf198('0x61')][_0xf198('0x62')][_0xf198('0x3b')]){return _0x2a52a4[_0xf198('0x61')][_0xf198('0x62')][0x0];}else{return db[_0xf198('0x56')][_0xf198('0x50')](_[_0xf198('0xb')](_0x34ae05['body'],{'firstName':_0x34ae05['body']['to'],'email':_0x34ae05['body']['to'],'phone':_0x34ae05[_0xf198('0x4d')]['to'],'ListId':_0x2a52a4[_0xf198('0x63')]}));}}else{throw new Error(_0xf198('0x64'));}})['then'](function(){if(_0x5b9807){return respondWithRpcPromise('SendMail','sendMail',_0x5b9807,client9003)[_0xf198('0x29')](function(_0x300ec5){return _0x3aaa8c[_0xf198('0x27')]({'read':!![],'messageId':_0x300ec5[_0xf198('0x65')],'sentAt':moment()['format'](_0xf198('0x66'))});})[_0xf198('0x1f')](function(_0x23901e){logger[_0xf198('0x1a')]('%s',JSON[_0xf198('0x19')](_0x23901e));return _0x3aaa8c;});}return _0x3aaa8c;});}return _0x3aaa8c;}})[_0xf198('0x29')](respondWithResult(_0x3cf643,0xc9))[_0xf198('0x1f')](handleError(_0x3cf643,null));};exports[_0xf198('0x67')]=function(_0x117070,_0x2cfd13){var _0xcb8a64=_0xf198('0x68');return interactionService[_0xf198('0x69')](_0x117070,_0xcb8a64)['then'](respondWithResult(_0x2cfd13,null))[_0xf198('0x1f')](handleError(_0x2cfd13,null));};exports['reject']=function(_0x43a132,_0x3e8c38){var _0x50c23f={'agent':{},'channel':_0xf198('0x68')};if(_0x43a132[_0xf198('0x4d')]['id']){delete _0x43a132[_0xf198('0x4d')]['id'];}_0x43a132[_0xf198('0x4d')][_0xf198('0x6a')]=_0x43a132[_0xf198('0x4d')]['UserId']||_0x43a132[_0xf198('0x6b')]['id'];_0x50c23f[_0xf198('0x6c')]['id']=_0x43a132[_0xf198('0x4d')][_0xf198('0x6a')];return db[_0xf198('0x30')]['find']({'where':{'id':_0x43a132[_0xf198('0x49')]['id'],'UserId':null}})[_0xf198('0x29')](handleEntityNotFound(_0x3e8c38,null))[_0xf198('0x29')](function(_0x2d0275){if(_0x2d0275){_0x50c23f['message']=_0x2d0275[_0xf198('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xf198('0x4e')]({'where':{'id':_0x2d0275['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3e8c38,null))[_0xf198('0x29')](function(_0x5e4ecc){if(_0x5e4ecc){_0x50c23f['interaction']=_0x5e4ecc[_0xf198('0x6d')]({'plain':!![]});interaction_log[_0xf198('0x16')](_0xf198('0x6e'),_0x43a132[_0xf198('0x6b')]['id'],_0x43a132['user'][_0xf198('0x2d')],_0x43a132[_0xf198('0x6b')][_0xf198('0x6f')],_0x50c23f['interaction']['id'],_0x43a132[_0xf198('0x4d')]?JSON[_0xf198('0x19')](_0x43a132['body']):_0xf198('0x70'));return respondWithRpcPromise(_0xf198('0x71'),_0xf198('0x72'),_0x50c23f);}return null;})[_0xf198('0x29')](function(_0x45465a){var _0x487636=_0xf198('0x73')+_0x45465a[_0xf198('0x1c')][_0xf198('0x74')];return db[_0xf198('0x75')]['query'](_0x487636,{'type':db[_0xf198('0x76')][_0xf198('0x77')][_0xf198('0x78')],'raw':!![]})['then'](function(_0xe5234e){return _0xe5234e;});})[_0xf198('0x29')](function(_0x192213){if(_0x192213){_0x50c23f['message'][_0xf198('0x79')]=_0x192213[0x0];if(!_0x43a132[_0xf198('0x4d')][_0xf198('0x6a')])return;return db[_0xf198('0x7a')][_0xf198('0x4e')]({'where':{'id':_0x43a132[_0xf198('0x4d')][_0xf198('0x6a')],'role':'agent'},'attributes':['id',_0xf198('0x2d'),_0xf198('0x7b'),'email',_0xf198('0x7c')],'raw':!![]});}return null;})['then'](function(_0x232d0c){if(!_0x232d0c)return null;_0x50c23f[_0xf198('0x1c')][_0xf198('0x6c')]=_0x232d0c;return _0x50c23f;})['then'](function(_0xd24985){if(_0xd24985){_0xd24985[_0xf198('0x1c')]['interface']=util['format'](_0xf198('0x7d'),_0x43a132['user'][_0xf198('0x2d')]);_0xd24985[_0xf198('0x1c')]['channel']=_0x50c23f[_0xf198('0x7e')];_0xd24985[_0xf198('0x1c')][_0xf198('0x7f')]=_0x50c23f[_0xf198('0x7e')];_0xd24985[_0xf198('0x1c')]['event']=_0xf198('0x80');_0xd24985[_0xf198('0x1c')][_0xf198('0x4d')]=htmlToText['fromString'](_0x50c23f['message'][_0xf198('0x4d')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0xf198('0x81'),'message':_0xd24985['message']},client9002);return _0x50c23f;}return null;})['then'](respondWithResult(_0x3e8c38,null))['catch'](handleError(_0x3e8c38,null));};exports[_0xf198('0x82')]=function(_0xb637b0,_0x9ae4c7){var _0x30af59=moment()[_0xf198('0x83')]()[_0xf198('0x84')]();var _0x14216f=path[_0xf198('0x5e')](config[_0xf198('0x85')],_0xf198('0x86'),_0xf198('0x87'),_0xf198('0x88'));var _0x3b7363=path[_0xf198('0x5e')](config[_0xf198('0x85')],_0xf198('0x86'),_0xf198('0x87'),_0xf198('0x5d'));var _0x3d32f7=util['format'](_0xf198('0x89'),_0x30af59);return db[_0xf198('0x30')][_0xf198('0x4e')]({'where':{'id':_0xb637b0[_0xf198('0x49')]['id']},'attributes':['id',_0xf198('0x4d'),_0xf198('0x8a'),'to','cc',_0xf198('0x8b'),'subject',_0xf198('0x8c')],'include':_0xb637b0[_0xf198('0x36')]['attachments']?[{'model':db[_0xf198('0x8d')],'as':'Attachments'}]:undefined})[_0xf198('0x29')](handleEntityNotFound(_0x9ae4c7,null))[_0xf198('0x29')](function(_0x5861f0){if(_0x5861f0){var _0x44771a=_0x5861f0;var _0x2e0fbf={'from':_0x44771a['from'],'to':_0x44771a['to'],'subject':_0x44771a[_0xf198('0x8e')],'html':htmlEntities['decode'](_0x44771a[_0xf198('0x4d')]),'headers':{'Date':moment(_0x44771a[_0xf198('0x8c')])[_0xf198('0x8f')](_0xf198('0x90'))},'attachments':[]};if(_0x5861f0['cc']){_0x2e0fbf[_0xf198('0x91')]['Cc']=_0x5861f0['cc'];}if(_0x5861f0['bcc']){_0x2e0fbf['headers']['Bcc']=_0x5861f0['bcc'];}return new Promise(function(_0x4f9d23,_0x5a3c68){if(_0x5861f0[_0xf198('0x92')]){for(var _0x4dedc7=0x0;_0x4dedc7<_0x5861f0['Attachments'][_0xf198('0x3b')];_0x4dedc7++){var _0x34960b=_0x5861f0['Attachments'][_0x4dedc7];var _0x27f31d=path[_0xf198('0x5e')](_0x3b7363,_0x34960b[_0xf198('0x60')]);if(fs[_0xf198('0x93')](_0x27f31d)){_0x2e0fbf[_0xf198('0x5d')][_0xf198('0x94')]({'name':_0x34960b['name'],'contentType':_0x34960b['type'],'data':fs[_0xf198('0x95')](_0x27f31d)});}}}emlformat[_0xf198('0x96')](_0x2e0fbf,function(_0xa356ee,_0x500d4b){if(_0xa356ee)return _0x5a3c68(_0xa356ee);fs['writeFileSync'](path[_0xf198('0x5e')](_0x14216f,_0x3d32f7),_0x500d4b);return _0x4f9d23(_0x500d4b);});});}})['then'](function(_0x23fb4f){if(_0x23fb4f){return _0x9ae4c7[_0xf198('0x82')](path[_0xf198('0x5e')](_0x14216f,_0x3d32f7),_0x3d32f7,function(_0xd04d56){if(!_0xd04d56)fs[_0xf198('0x97')](path[_0xf198('0x5e')](_0x14216f,_0x3d32f7));});}})[_0xf198('0x1f')](handleError(_0x9ae4c7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 7ba85c2..2ce2619 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 _0xf879=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','update'];(function(_0x4a6813,_0x5d10cb){var _0x4ddb41=function(_0x2e19c4){while(--_0x2e19c4){_0x4a6813['push'](_0x4a6813['shift']());}};_0x4ddb41(++_0x5d10cb);}(_0xf879,0xb9));var _0x9f87=function(_0x488c16,_0x4ff7d2){_0x488c16=_0x488c16-0x0;var _0x262b53=_0xf879[_0x488c16];return _0x262b53;};'use strict';var EventEmitter=require(_0x9f87('0x0'));var MailMessage=require(_0x9f87('0x1'))['db'][_0x9f87('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f87('0x3'),'afterDestroy':_0x9f87('0x4')};function emitEvent(_0x37287c){return function(_0x20e78d,_0x1a22a3,_0x259f2d){MailMessageEvents[_0x9f87('0x5')](_0x37287c+':'+_0x20e78d['id'],_0x20e78d);MailMessageEvents[_0x9f87('0x5')](_0x37287c,_0x20e78d);_0x259f2d(null);};}for(var e in events){if(events[_0x9f87('0x6')](e)){var event=events[e];MailMessage[_0x9f87('0x7')](e,emitEvent(event));}}module[_0x9f87('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xf985=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x57383b,_0x32357b){var _0xc96c4c=function(_0x4f0b07){while(--_0x4f0b07){_0x57383b['push'](_0x57383b['shift']());}};_0xc96c4c(++_0x32357b);}(_0xf985,0xcf));var _0x5f98=function(_0x4dbae5,_0x5ba091){_0x4dbae5=_0x4dbae5-0x0;var _0x4b093b=_0xf985[_0x4dbae5];return _0x4b093b;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x5f98('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5f98('0x1')](0x0);var events={'afterCreate':_0x5f98('0x2'),'afterUpdate':_0x5f98('0x3'),'afterDestroy':_0x5f98('0x4')};function emitEvent(_0x4dfebc){return function(_0x3c6133,_0x11354d,_0x11ea54){MailMessageEvents[_0x5f98('0x5')](_0x4dfebc+':'+_0x3c6133['id'],_0x3c6133);MailMessageEvents[_0x5f98('0x5')](_0x4dfebc,_0x3c6133);_0x11ea54(null);};}for(var e in events){if(events[_0x5f98('0x6')](e)){var event=events[e];MailMessage[_0x5f98('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f0b8f8c..e0735b9 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 _0xe849=['get','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','fromString','body','models'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0xe849,0xf6));var _0x9e84=function(_0x4831d7,_0x384d17){_0x4831d7=_0x4831d7-0x0;var _0x1ea2e8=_0xe849[_0x4831d7];return _0x1ea2e8;};'use strict';var _=require(_0x9e84('0x0'));var util=require(_0x9e84('0x1'));var logger=require('../../config/logger')(_0x9e84('0x2'));var moment=require(_0x9e84('0x3'));var BPromise=require('bluebird');var rp=require(_0x9e84('0x4'));var htmlToText=require(_0x9e84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e84('0x6'));var config=require(_0x9e84('0x7'));var attributes=require(_0x9e84('0x8'));module[_0x9e84('0x9')]=function(_0x218d42,_0x1a51ca){return _0x218d42[_0x9e84('0xa')]('MailMessage',attributes,{'tableName':_0x9e84('0xb'),'paranoid':![],'indexes':[{'name':_0x9e84('0xc'),'fields':[_0x9e84('0xc')]},{'name':_0x9e84('0xd'),'fields':['plainBody','subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49a877,_0x212299,_0xf9fb72){if(_0x49a877['body']){_0x49a877[_0x9e84('0xe')]=htmlToText[_0x9e84('0xf')](_0x49a877[_0x9e84('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xf9fb72(null,_0x212299);},'afterCreate':function(_0x3626db,_0x151a8c,_0x49d447){var _0x19f7fc=_0x218d42[_0x9e84('0x11')];var _0x3e7d44=_0x3626db[_0x9e84('0x12')]({'plain':!![]});if(_0x3e7d44['direction'][_0x9e84('0x13')]()==='in'||_0x3e7d44[_0x9e84('0x14')][_0x9e84('0x13')]()===_0x9e84('0x15')&&!_0x3e7d44[_0x9e84('0x16')]&&!_[_0x9e84('0x17')](_0x3e7d44[_0x9e84('0x18')])){_0x19f7fc[_0x9e84('0x19')][_0x9e84('0x1a')]({'where':{'id':_0x3e7d44[_0x9e84('0x1b')]}})[_0x9e84('0x1c')](function(_0xd133e6){if(_0xd133e6){_0xd133e6['update']({'lastMsgAt':_0x3e7d44['createdAt'],'lastMsgDirection':_0x3e7d44['direction'][_0x9e84('0x13')]()});}})[_0x9e84('0x1d')](function(_0x2ee6e5){console[_0x9e84('0x1e')](_0x2ee6e5);});}_0x49d447();}},'charset':_0x9e84('0x1f'),'collate':_0x9e84('0x20')});}; \ No newline at end of file +var _0xd52a=['findOne','MailInteractionId','then','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','html-to-text','path','rimraf','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction'];(function(_0x5ce0b6,_0x4c0ff2){var _0x1ea998=function(_0x24be62){while(--_0x24be62){_0x5ce0b6['push'](_0x5ce0b6['shift']());}};_0x1ea998(++_0x4c0ff2);}(_0xd52a,0xcc));var _0xad52=function(_0x2f85bf,_0x2953c2){_0x2f85bf=_0x2f85bf-0x0;var _0x10a44a=_0xd52a[_0x2f85bf];return _0x10a44a;};'use strict';var _=require(_0xad52('0x0'));var util=require(_0xad52('0x1'));var logger=require(_0xad52('0x2'))('api');var moment=require(_0xad52('0x3'));var BPromise=require('bluebird');var rp=require(_0xad52('0x4'));var htmlToText=require(_0xad52('0x5'));var fs=require('fs');var path=require(_0xad52('0x6'));var rimraf=require(_0xad52('0x7'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0xad52('0x8')]=function(_0x451ee3,_0x47a9c2){return _0x451ee3[_0xad52('0x9')](_0xad52('0xa'),attributes,{'tableName':_0xad52('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xad52('0xc')]},{'name':_0xad52('0xd'),'fields':['plainBody',_0xad52('0xe')],'type':_0xad52('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47efdf,_0x462737,_0x5748c9){if(_0x47efdf[_0xad52('0x10')]){_0x47efdf[_0xad52('0x11')]=htmlToText['fromString'](_0x47efdf['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5748c9(null,_0x462737);},'afterCreate':function(_0x382e9e,_0x33ddb8,_0x5b022d){var _0x18741c=_0x451ee3[_0xad52('0x12')];var _0x1f0a81=_0x382e9e[_0xad52('0x13')]({'plain':!![]});if(_0x1f0a81[_0xad52('0x14')]['toLowerCase']()==='in'||_0x1f0a81['direction'][_0xad52('0x15')]()===_0xad52('0x16')&&!_0x1f0a81[_0xad52('0x17')]&&!_[_0xad52('0x18')](_0x1f0a81[_0xad52('0x19')])){_0x18741c[_0xad52('0x1a')][_0xad52('0x1b')]({'where':{'id':_0x1f0a81[_0xad52('0x1c')]}})[_0xad52('0x1d')](function(_0x377fc2){if(_0x377fc2){_0x377fc2['update']({'lastMsgAt':_0x1f0a81[_0xad52('0x1e')],'lastMsgDirection':_0x1f0a81[_0xad52('0x14')][_0xad52('0x15')]()});}})['catch'](function(_0x561bdd){console['error'](_0x561bdd);});}_0x5b022d();}},'charset':_0xad52('0x1f'),'collate':_0xad52('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 880ef21..2a87683 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 _0x583c=['request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','CreateMailMessage','MailMessage','create','body','options','raw','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x1fe559,_0x25fba7){var _0xb5b18c=function(_0x5ca09d){while(--_0x5ca09d){_0x1fe559['push'](_0x1fe559['shift']());}};_0xb5b18c(++_0x25fba7);}(_0x583c,0x12b));var _0xc583=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x583c[_0x391c55];return _0xa434e0;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});config[_0xc583('0xa')]=_[_0xc583('0xb')](config['redis'],{'host':_0xc583('0xc'),'port':0x18eb});var socket=require(_0xc583('0xd'))(new Redis(config['redis']));require(_0xc583('0xe'))[_0xc583('0xf')](socket);function respondWithRpcPromise(_0x25f8d3,_0xb23f07,_0x2d99ca){return new BPromise(function(_0x550b1e,_0x3437be){return client[_0xc583('0x10')](_0x25f8d3,_0x2d99ca)['then'](function(_0x23c51a){logger[_0xc583('0x11')]('MailMessage,\x20%s,\x20%s',_0xb23f07,_0xc583('0x12'));logger[_0xc583('0x13')](_0xc583('0x14'),_0xb23f07,_0xc583('0x12'),JSON[_0xc583('0x15')](_0x23c51a));if(_0x23c51a[_0xc583('0x16')]){if(_0x23c51a[_0xc583('0x16')][_0xc583('0x17')]===0x1f4){logger[_0xc583('0x16')]('MailMessage,\x20%s,\x20%s',_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x3437be(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}logger['error'](_0xc583('0x19'),_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x550b1e(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}else{logger['info'](_0xc583('0x19'),_0xb23f07,_0xc583('0x12'));_0x550b1e(_0x23c51a[_0xc583('0x1a')][_0xc583('0x18')]);}})['catch'](function(_0x3dd3cc){logger['error'](_0xc583('0x19'),_0xb23f07,_0x3dd3cc);_0x3437be(_0x3dd3cc);});});}exports[_0xc583('0x1b')]=function(_0xfd9a60){var _0x774f4c=this;return new Promise(function(_0x1052b5,_0x12b910){return db[_0xc583('0x1c')][_0xc583('0x1d')](_0xfd9a60[_0xc583('0x1e')],{'raw':_0xfd9a60[_0xc583('0x1f')]?_0xfd9a60[_0xc583('0x1f')][_0xc583('0x20')]===undefined?!![]:![]:!![]})[_0xc583('0x21')](function(_0x478ee1){logger['info'](_0xc583('0x1b'),_0xfd9a60);logger[_0xc583('0x13')](_0xc583('0x1b'),_0xfd9a60,JSON['stringify'](_0x478ee1));_0x1052b5(_0x478ee1);})[_0xc583('0x22')](function(_0x959500){logger[_0xc583('0x16')](_0xc583('0x1b'),_0x959500[_0xc583('0x18')],_0xfd9a60);_0x12b910(_0x774f4c['error'](0x1f4,_0x959500['message']));});});}; \ No newline at end of file +var _0xe5af=['result','MailMessage','create','body','options','CreateMailMessage','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe5af,0x9c));var _0xfe5a=function(_0x6d2237,_0x59a621){_0x6d2237=_0x6d2237-0x0;var _0x336726=_0xe5af[_0x6d2237];return _0x336726;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});config['redis']=_[_0xfe5a('0x8')](config[_0xfe5a('0x9')],{'host':_0xfe5a('0xa'),'port':0x18eb});var socket=require(_0xfe5a('0xb'))(new Redis(config['redis']));require(_0xfe5a('0xc'))['register'](socket);function respondWithRpcPromise(_0x51718e,_0x259e8a,_0x2cb946){return new BPromise(function(_0x543619,_0xb51e47){return client[_0xfe5a('0xd')](_0x51718e,_0x2cb946)[_0xfe5a('0xe')](function(_0x50024c){logger[_0xfe5a('0xf')]('MailMessage,\x20%s,\x20%s',_0x259e8a,_0xfe5a('0x10'));logger[_0xfe5a('0x11')](_0xfe5a('0x12'),_0x259e8a,_0xfe5a('0x10'),JSON[_0xfe5a('0x13')](_0x50024c));if(_0x50024c['error']){if(_0x50024c[_0xfe5a('0x14')][_0xfe5a('0x15')]===0x1f4){logger[_0xfe5a('0x14')](_0xfe5a('0x16'),_0x259e8a,_0x50024c[_0xfe5a('0x14')][_0xfe5a('0x17')]);return _0xb51e47(_0x50024c[_0xfe5a('0x14')][_0xfe5a('0x17')]);}logger[_0xfe5a('0x14')](_0xfe5a('0x16'),_0x259e8a,_0x50024c[_0xfe5a('0x14')][_0xfe5a('0x17')]);return _0x543619(_0x50024c[_0xfe5a('0x14')][_0xfe5a('0x17')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x16'),_0x259e8a,'request\x20sent');_0x543619(_0x50024c[_0xfe5a('0x18')][_0xfe5a('0x17')]);}})['catch'](function(_0x3b0101){logger[_0xfe5a('0x14')](_0xfe5a('0x16'),_0x259e8a,_0x3b0101);_0xb51e47(_0x3b0101);});});}exports['CreateMailMessage']=function(_0x485c15){var _0x3e11ad=this;return new Promise(function(_0x1c6ba7,_0xded538){return db[_0xfe5a('0x19')][_0xfe5a('0x1a')](_0x485c15[_0xfe5a('0x1b')],{'raw':_0x485c15['options']?_0x485c15[_0xfe5a('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xfe5a('0xe')](function(_0x39d825){logger[_0xfe5a('0xf')]('CreateMailMessage',_0x485c15);logger['debug'](_0xfe5a('0x1d'),_0x485c15,JSON[_0xfe5a('0x13')](_0x39d825));_0x1c6ba7(_0x39d825);})['catch'](function(_0x44a0bd){logger[_0xfe5a('0x14')]('CreateMailMessage',_0x44a0bd[_0xfe5a('0x17')],_0x485c15);_0xded538(_0x3e11ad[_0xfe5a('0x14')](0x1f4,_0x44a0bd[_0xfe5a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index fe0cda0..d9512b4 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 _0x8498=['emit','removeListener','register','length','./mailMessage.events','remove','update'];(function(_0x1f8017,_0x32ddcd){var _0x87a566=function(_0x2749d5){while(--_0x2749d5){_0x1f8017['push'](_0x1f8017['shift']());}};_0x87a566(++_0x32ddcd);}(_0x8498,0xf2));var _0x8849=function(_0x4324aa,_0x1bcdd0){_0x4324aa=_0x4324aa-0x0;var _0x270aa2=_0x8498[_0x4324aa];return _0x270aa2;};'use strict';var MailMessageEvents=require(_0x8849('0x0'));var events=['save',_0x8849('0x1'),_0x8849('0x2')];function createListener(_0x32e4b8,_0xbe5f0){return function(_0x4d8c82){_0xbe5f0[_0x8849('0x3')](_0x32e4b8,_0x4d8c82);};}function removeListener(_0xce90ef,_0x46244e){return function(){MailMessageEvents[_0x8849('0x4')](_0xce90ef,_0x46244e);};}exports[_0x8849('0x5')]=function(_0x99c777){for(var _0xe66682=0x0,_0x11144e=events[_0x8849('0x6')];_0xe66682<_0x11144e;_0xe66682++){var _0x2a4b17=events[_0xe66682];var _0x14ad36=createListener('mailMessage:'+_0x2a4b17,_0x99c777);MailMessageEvents['on'](_0x2a4b17,_0x14ad36);}}; \ No newline at end of file +var _0xfe11=['mailMessage:','./mailMessage.events','save','remove','update','emit','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe11,0x94));var _0x1fe1=function(_0x251fa4,_0x3d5860){_0x251fa4=_0x251fa4-0x0;var _0x453047=_0xfe11[_0x251fa4];return _0x453047;};'use strict';var MailMessageEvents=require(_0x1fe1('0x0'));var events=[_0x1fe1('0x1'),_0x1fe1('0x2'),_0x1fe1('0x3')];function createListener(_0x993ea4,_0x53063e){return function(_0x583380){_0x53063e[_0x1fe1('0x4')](_0x993ea4,_0x583380);};}function removeListener(_0x116f9b,_0x4d4b2e){return function(){MailMessageEvents['removeListener'](_0x116f9b,_0x4d4b2e);};}exports['register']=function(_0x53145e){for(var _0x16e421=0x0,_0x340c29=events[_0x1fe1('0x5')];_0x16e421<_0x340c29;_0x16e421++){var _0x2f08ce=events[_0x16e421];var _0x49b66c=createListener(_0x1fe1('0x6')+_0x2f08ce,_0x53145e);MailMessageEvents['on'](_0x2f08ce,_0x49b66c);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 58fc7f6..730ae81 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 _0x4ac5=['create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x417139,_0x304781){var _0x1ff3fc=function(_0x53691f){while(--_0x53691f){_0x417139['push'](_0x417139['shift']());}};_0x1ff3fc(++_0x304781);}(_0x4ac5,0x140));var _0x54ac=function(_0x54fc1f,_0x1703c2){_0x54fc1f=_0x54fc1f-0x0;var _0x53f699=_0x4ac5[_0x54fc1f];return _0x53f699;};'use strict';var multer=require(_0x54ac('0x0'));var util=require(_0x54ac('0x1'));var path=require('path');var timeout=require(_0x54ac('0x2'));var express=require(_0x54ac('0x3'));var router=express['Router']();var fs_extra=require(_0x54ac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x54ac('0x5'));var config=require(_0x54ac('0x6'));var controller=require(_0x54ac('0x7'));router[_0x54ac('0x8')]('/',auth[_0x54ac('0x9')](),controller[_0x54ac('0xa')]);router[_0x54ac('0x8')](_0x54ac('0xb'),auth[_0x54ac('0x9')](),controller[_0x54ac('0xc')]);router[_0x54ac('0x8')](_0x54ac('0xd'),auth['isAuthenticated'](),controller[_0x54ac('0xe')]);router[_0x54ac('0x8')]('/:id/members',auth[_0x54ac('0x9')](),controller[_0x54ac('0xf')]);router[_0x54ac('0x8')](_0x54ac('0x10'),auth[_0x54ac('0x9')](),controller[_0x54ac('0x11')]);router['get'](_0x54ac('0x12'),auth[_0x54ac('0x9')](),controller[_0x54ac('0x13')]);router[_0x54ac('0x14')]('/',auth[_0x54ac('0x9')](),controller[_0x54ac('0x15')]);router[_0x54ac('0x14')]('/:id/teams',auth[_0x54ac('0x9')](),controller[_0x54ac('0x16')]);router['post'](_0x54ac('0x12'),auth[_0x54ac('0x9')](),controller[_0x54ac('0x17')]);router[_0x54ac('0x18')](_0x54ac('0xd'),auth['isAuthenticated'](),controller[_0x54ac('0x19')]);router[_0x54ac('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x54ac('0x1b')]);router[_0x54ac('0x1a')](_0x54ac('0x10'),auth['isAuthenticated'](),controller[_0x54ac('0x1c')]);router['delete'](_0x54ac('0x12'),auth['isAuthenticated'](),controller[_0x54ac('0x1d')]);module[_0x54ac('0x1e')]=router; \ No newline at end of file +var _0x7738=['getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','delete','removeTeams','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','describe','/:id','isAuthenticated','show'];(function(_0x4ce637,_0x463346){var _0x2e9cba=function(_0x11f3d1){while(--_0x11f3d1){_0x4ce637['push'](_0x4ce637['shift']());}};_0x2e9cba(++_0x463346);}(_0x7738,0xba));var _0x8773=function(_0xd4d369,_0x4f6ad2){_0xd4d369=_0xd4d369-0x0;var _0x293e5d=_0x7738[_0xd4d369];return _0x293e5d;};'use strict';var multer=require(_0x8773('0x0'));var util=require(_0x8773('0x1'));var path=require(_0x8773('0x2'));var timeout=require('connect-timeout');var express=require(_0x8773('0x3'));var router=express[_0x8773('0x4')]();var fs_extra=require(_0x8773('0x5'));var auth=require(_0x8773('0x6'));var interaction=require(_0x8773('0x7'));var config=require(_0x8773('0x8'));var controller=require(_0x8773('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8773('0xa')]);router[_0x8773('0xb')](_0x8773('0xc'),auth['isAuthenticated'](),controller[_0x8773('0xd')]);router['get'](_0x8773('0xe'),auth[_0x8773('0xf')](),controller[_0x8773('0x10')]);router[_0x8773('0xb')]('/:id/members',auth[_0x8773('0xf')](),controller[_0x8773('0x11')]);router['get']('/:id/teams',auth[_0x8773('0xf')](),controller['getTeams']);router[_0x8773('0xb')](_0x8773('0x12'),auth['isAuthenticated'](),controller[_0x8773('0x13')]);router[_0x8773('0x14')]('/',auth[_0x8773('0xf')](),controller[_0x8773('0x15')]);router['post'](_0x8773('0x16'),auth['isAuthenticated'](),controller[_0x8773('0x17')]);router['post'](_0x8773('0x12'),auth[_0x8773('0xf')](),controller[_0x8773('0x18')]);router['put'](_0x8773('0xe'),auth[_0x8773('0xf')](),controller[_0x8773('0x19')]);router[_0x8773('0x1a')](_0x8773('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/teams',auth[_0x8773('0xf')](),controller[_0x8773('0x1b')]);router[_0x8773('0x1a')](_0x8773('0x12'),auth[_0x8773('0xf')](),controller[_0x8773('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8c74825..1628fde 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 _0x3b35=['exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x3991dc,_0xf10b20){var _0x3ed26f=function(_0x548a00){while(--_0x548a00){_0x3991dc['push'](_0x3991dc['shift']());}};_0x3ed26f(++_0xf10b20);}(_0x3b35,0x197));var _0x53b3=function(_0x294793,_0x12fd45){_0x294793=_0x294793-0x0;var _0x268ca0=_0x3b35[_0x294793];return _0x268ca0;};'use strict';var Sequelize=require(_0x53b3('0x0'));module[_0x53b3('0x1')]={'name':{'type':Sequelize[_0x53b3('0x2')],'unique':_0x53b3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x53b3('0x2')]},'timeout':{'type':Sequelize[_0x53b3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x53b3('0x5')](_0x53b3('0x6'),'beepall',_0x53b3('0x7'))}}; \ No newline at end of file +var _0x909e=['rrmemory','beepall','roundrobin','sequelize','STRING','INTEGER','ENUM'];(function(_0x5a12fe,_0x422ae3){var _0x2a7274=function(_0x2a2ada){while(--_0x2a2ada){_0x5a12fe['push'](_0x5a12fe['shift']());}};_0x2a7274(++_0x422ae3);}(_0x909e,0x168));var _0xe909=function(_0x27614b,_0x2fd9d6){_0x27614b=_0x27614b-0x0;var _0x4be3f2=_0x909e[_0x27614b];return _0x4be3f2;};'use strict';var Sequelize=require(_0xe909('0x0'));module['exports']={'name':{'type':Sequelize[_0xe909('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe909('0x1')]},'timeout':{'type':Sequelize[_0xe909('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe909('0x3')](_0xe909('0x4'),_0xe909('0x5'),_0xe909('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 588471a..7e245b9 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 _0xee11=['undefined','limit','count','status','set','Content-Range','update','then','destroy','get','MailQueues','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','compact','isEmpty','userMailQueue:remove','addAgents','removeAgents','isArray','getAgents','User','bluebird','util','squel','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','json','offset'];(function(_0x3db335,_0x591b87){var _0x3af01d=function(_0x330b08){while(--_0x330b08){_0x3db335['push'](_0x3db335['shift']());}};_0x3af01d(++_0x591b87);}(_0xee11,0xdf));var _0x1ee1=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0xee11[_0x687ddc];return _0x441991;};'use strict';var BPromise=require(_0x1ee1('0x0'));var util=require(_0x1ee1('0x1'));var _=require('lodash');var squel=require(_0x1ee1('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x1ee1('0x3'))(_0x1ee1('0x4'));var config=require(_0x1ee1('0x5'));var db=require('../../mysqldb')['db'];config[_0x1ee1('0x6')]=_[_0x1ee1('0x7')](config[_0x1ee1('0x6')],{'host':_0x1ee1('0x8'),'port':0x18eb});var socket=require(_0x1ee1('0x9'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x1ee1('0xa')](socket);function respondWithStatusCode(_0x26a7e3,_0x5920c3){_0x5920c3=_0x5920c3||0xcc;return function(_0x50305c){if(_0x50305c){return _0x26a7e3['sendStatus'](_0x5920c3);}return _0x26a7e3['status'](_0x5920c3)['end']();};}function respondWithResult(_0x4c77d3,_0x260031){_0x260031=_0x260031||0xc8;return function(_0x42e532){if(_0x42e532){return _0x4c77d3['status'](_0x260031)[_0x1ee1('0xb')](_0x42e532);}};}function respondWithFilteredResult(_0x4fe59c,_0x5a207e){return function(_0x142ac0){if(_0x142ac0){var _0x262612=typeof _0x5a207e[_0x1ee1('0xc')]===_0x1ee1('0xd')&&typeof _0x5a207e[_0x1ee1('0xe')]===_0x1ee1('0xd');var _0x3cdd58=_0x142ac0['count'];var _0x55e772=_0x262612?0x0:_0x5a207e[_0x1ee1('0xc')];var _0x823cf2=_0x262612?_0x142ac0[_0x1ee1('0xf')]:_0x5a207e[_0x1ee1('0xc')]+_0x5a207e[_0x1ee1('0xe')];var _0x561b30;if(_0x823cf2>=_0x3cdd58){_0x823cf2=_0x3cdd58;_0x561b30=0xc8;}else{_0x561b30=0xce;}_0x4fe59c[_0x1ee1('0x10')](_0x561b30);return _0x4fe59c[_0x1ee1('0x11')](_0x1ee1('0x12'),_0x55e772+'-'+_0x823cf2+'/'+_0x3cdd58)[_0x1ee1('0xb')](_0x142ac0);}return null;};}function saveUpdates(_0x1b3dab){return function(_0x26000e){if(_0x26000e){return _0x26000e[_0x1ee1('0x13')](_0x1b3dab)[_0x1ee1('0x14')](function(_0x43067a){return _0x43067a;});}return null;};}function removeEntity(_0x39733f){return function(_0x2ac1a7){if(_0x2ac1a7){return _0x2ac1a7[_0x1ee1('0x15')]()[_0x1ee1('0x14')](function(){var _0x7d4aae=_0x2ac1a7[_0x1ee1('0x16')]({'plain':!![]});var _0x22d342=_0x1ee1('0x17');return db['UserProfileResource']['destroy']({'where':{'type':_0x22d342,'resourceId':_0x7d4aae['id']}})['then'](function(){return _0x2ac1a7;});})[_0x1ee1('0x14')](function(){_0x39733f[_0x1ee1('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35fc65){return function(_0x479d8b){if(!_0x479d8b){_0x35fc65[_0x1ee1('0x18')](0x194);}return _0x479d8b;};}function handleError(_0x4c16ee,_0x27ccce){_0x27ccce=_0x27ccce||0x1f4;return function(_0x3f0369){logger[_0x1ee1('0x19')](_0x3f0369[_0x1ee1('0x1a')]);if(_0x3f0369[_0x1ee1('0x1b')]){delete _0x3f0369[_0x1ee1('0x1b')];}_0x4c16ee[_0x1ee1('0x10')](_0x27ccce)[_0x1ee1('0x1c')](_0x3f0369);};}exports[_0x1ee1('0x1d')]=function(_0x41ce1b,_0x56e67b){var _0x489170={};var _0xd132b3={'count':0x0,'rows':[]};var _0x318544=_[_0x1ee1('0x1e')](db[_0x1ee1('0x1f')][_0x1ee1('0x20')],function(_0x526015){return{'name':_0x526015[_0x1ee1('0x21')],'type':_0x526015[_0x1ee1('0x22')][_0x1ee1('0x23')]};});_0x489170=qs[_0x1ee1('0x24')](_0x318544,_0x41ce1b);var _0xe5e59c={'where':_0x489170[_0x1ee1('0x25')]};return db[_0x1ee1('0x1f')]['count'](_0xe5e59c)[_0x1ee1('0x14')](function(_0x56d8c0){_0xd132b3['count']=_0x56d8c0;_0x489170[_0x1ee1('0x26')]=qs[_0x1ee1('0x26')](_0x41ce1b[_0x1ee1('0x27')]);return db['MailQueue'][_0x1ee1('0x28')](_0x489170);})[_0x1ee1('0x14')](function(_0x510025){_0xd132b3[_0x1ee1('0x29')]=_0x510025;return _0xd132b3;})[_0x1ee1('0x14')](respondWithFilteredResult(_0x56e67b,_0x489170))[_0x1ee1('0x2a')](handleError(_0x56e67b,null));};exports[_0x1ee1('0x2b')]=function(_0x26963a,_0x441e8e){var _0x2045e6={'raw':!![],'where':{'id':_0x26963a['params']['id']}},_0x1f2635={};_0x1f2635['model']=_[_0x1ee1('0x2c')](db['MailQueue'][_0x1ee1('0x20')]);_0x1f2635[_0x1ee1('0x27')]=_[_0x1ee1('0x2c')](_0x26963a[_0x1ee1('0x27')]);_0x1f2635[_0x1ee1('0x2d')]=_[_0x1ee1('0x2e')](_0x1f2635[_0x1ee1('0x2f')],_0x1f2635[_0x1ee1('0x27')]);_0x2045e6[_0x1ee1('0x30')]=_[_0x1ee1('0x2e')](_0x1f2635[_0x1ee1('0x2f')],qs['fields'](_0x26963a[_0x1ee1('0x27')][_0x1ee1('0x31')]));_0x2045e6[_0x1ee1('0x30')]=_0x2045e6[_0x1ee1('0x30')][_0x1ee1('0x32')]?_0x2045e6[_0x1ee1('0x30')]:_0x1f2635[_0x1ee1('0x2f')];if(_0x26963a['query'][_0x1ee1('0x33')]){_0x2045e6[_0x1ee1('0x26')]=[{'all':!![]}];}_0x2045e6=_[_0x1ee1('0x34')]({},_0x2045e6,_0x26963a[_0x1ee1('0x35')]);return db['MailQueue'][_0x1ee1('0x36')](_0x2045e6)['then'](handleEntityNotFound(_0x441e8e,null))[_0x1ee1('0x14')](respondWithResult(_0x441e8e,null))['catch'](handleError(_0x441e8e,null));};exports['create']=function(_0x258d6c,_0x5a6c43){return db[_0x1ee1('0x1f')]['create'](_0x258d6c[_0x1ee1('0x37')],{})[_0x1ee1('0x14')](function(_0xe33178){var _0x22f995=_0x258d6c[_0x1ee1('0x38')][_0x1ee1('0x16')]({'plain':!![]});if(!_0x22f995)throw new Error(_0x1ee1('0x39'));if(_0x22f995['role']==='user'){var _0x29d76f=_0xe33178['get']({'plain':!![]});var _0x979ffa=_0x1ee1('0x17');return db['UserProfileSection'][_0x1ee1('0x36')]({'where':{'name':_0x979ffa,'userProfileId':_0x22f995[_0x1ee1('0x3a')]},'raw':!![]})['then'](function(_0xe2f4f0){if(_0xe2f4f0&&_0xe2f4f0[_0x1ee1('0x3b')]===0x0){return db[_0x1ee1('0x3c')][_0x1ee1('0x3d')]({'name':_0x29d76f[_0x1ee1('0x1b')],'resourceId':_0x29d76f['id'],'type':_0xe2f4f0[_0x1ee1('0x1b')],'sectionId':_0xe2f4f0['id']},{})[_0x1ee1('0x14')](function(){return _0xe33178;});}else{return _0xe33178;}})[_0x1ee1('0x2a')](function(_0x597b83){logger[_0x1ee1('0x19')](_0x1ee1('0x3e'),_0x597b83);throw _0x597b83;});}return _0xe33178;})[_0x1ee1('0x14')](respondWithResult(_0x5a6c43,0xc9))['catch'](handleError(_0x5a6c43,null));};exports[_0x1ee1('0x13')]=function(_0x1b2184,_0x5d3175){if(_0x1b2184[_0x1ee1('0x37')]['id']){delete _0x1b2184[_0x1ee1('0x37')]['id'];}return db['MailQueue'][_0x1ee1('0x36')]({'where':{'id':_0x1b2184[_0x1ee1('0x3f')]['id']}})[_0x1ee1('0x14')](handleEntityNotFound(_0x5d3175,null))[_0x1ee1('0x14')](saveUpdates(_0x1b2184[_0x1ee1('0x37')],null))[_0x1ee1('0x14')](respondWithResult(_0x5d3175,null))[_0x1ee1('0x2a')](handleError(_0x5d3175,null));};exports[_0x1ee1('0x15')]=function(_0x7ecb46,_0x30c5ee){return db[_0x1ee1('0x1f')][_0x1ee1('0x36')]({'where':{'id':_0x7ecb46[_0x1ee1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x30c5ee,null))[_0x1ee1('0x14')](removeEntity(_0x30c5ee,null))['catch'](handleError(_0x30c5ee,null));};exports['describe']=function(_0x5332b5,_0xf7cdd3){return db['MailQueue'][_0x1ee1('0x40')]()['then'](respondWithResult(_0xf7cdd3,null))[_0x1ee1('0x2a')](handleError(_0xf7cdd3,null));};exports['getMembers']=function(_0x48f49d,_0x48861d){var _0x4761b0={'raw':!![],'where':{}},_0x26236c={},_0x4c6832;return db[_0x1ee1('0x1f')][_0x1ee1('0x41')]({'where':{'id':_0x48f49d['params']['id']}})[_0x1ee1('0x14')](handleEntityNotFound(_0x48861d,null))[_0x1ee1('0x14')](function(_0xadae44){if(_0xadae44){_0x4c6832=_0xadae44[_0x1ee1('0x16')]({'plain':!![]});_0x26236c['model']=_['keys'](db[_0x1ee1('0x42')][_0x1ee1('0x20')]);_0x26236c['query']=_[_0x1ee1('0x2c')](_0x48f49d[_0x1ee1('0x27')]);_0x26236c[_0x1ee1('0x2d')]=_[_0x1ee1('0x2e')](_0x26236c['model'],_0x26236c['query']);_0x4761b0[_0x1ee1('0x30')]=_['intersection'](_0x26236c['model'],qs['fields'](_0x48f49d['query'][_0x1ee1('0x31')]));_0x4761b0[_0x1ee1('0x30')]=_0x4761b0[_0x1ee1('0x30')][_0x1ee1('0x32')]?_0x4761b0[_0x1ee1('0x30')]:_0x26236c[_0x1ee1('0x2f')];if(!_0x48f49d['query'][_0x1ee1('0x43')](_0x1ee1('0x44'))){_0x4761b0[_0x1ee1('0xe')]=qs[_0x1ee1('0xe')](_0x48f49d[_0x1ee1('0x27')][_0x1ee1('0xe')]);_0x4761b0[_0x1ee1('0xc')]=qs[_0x1ee1('0xc')](_0x48f49d[_0x1ee1('0x27')]['offset']);}_0x4761b0[_0x1ee1('0x45')]=qs[_0x1ee1('0x46')](_0x48f49d[_0x1ee1('0x27')]['sort']);_0x4761b0[_0x1ee1('0x25')]=qs[_0x1ee1('0x2d')](_[_0x1ee1('0x47')](_0x48f49d['query'],_0x26236c['filters']));_0x4761b0[_0x1ee1('0x25')][_0x1ee1('0x48')]=_0xadae44['id'];if(_0x48f49d[_0x1ee1('0x27')][_0x1ee1('0x49')]){_0x4761b0[_0x1ee1('0x25')]=_[_0x1ee1('0x34')](_0x4761b0[_0x1ee1('0x25')],{'$or':_[_0x1ee1('0x1e')](_0x4761b0[_0x1ee1('0x30')],function(_0x4755e5){var _0x53dede={};_0x53dede[_0x4755e5]={'$like':'%'+_0x48f49d[_0x1ee1('0x27')][_0x1ee1('0x49')]+'%'};return _0x53dede;})});}_0x4761b0=_[_0x1ee1('0x34')]({},_0x4761b0,_0x48f49d[_0x1ee1('0x35')]);return db[_0x1ee1('0x42')][_0x1ee1('0x28')](_0x4761b0);}})[_0x1ee1('0x14')](function(_0x1acbc7){if(_0x1acbc7){return db['User'][_0x1ee1('0x4a')]({'where':{'id':_['map'](_0x1acbc7,_0x1ee1('0x4b')),'role':_0x1ee1('0x4c')},'attributes':['id',_0x1ee1('0x1b'),_0x1ee1('0x4d'),_0x1ee1('0x4e'),_0x1ee1('0x4f')]});}})['then'](function(_0x47f37d){if(_0x47f37d){return{'count':_0x47f37d[_0x1ee1('0xf')],'rows':_[_0x1ee1('0x1e')](_0x47f37d[_0x1ee1('0x29')],function(_0x1064f6){return{'membername':_0x1064f6[_0x1ee1('0x1b')],'UserId':_0x1064f6['id'],'queue_name':_0x4c6832[_0x1ee1('0x1b')],'MailQueueId':_0x4c6832['id'],'interface':util[_0x1ee1('0x50')](_0x1ee1('0x51'),'SIP',_0x1064f6[_0x1ee1('0x1b')]),'penalty':0x0,'paused':_0x1064f6[_0x1ee1('0x4d')],'createdAt':_0x1064f6['createdAt'],'updatedAt':_0x1064f6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1ee1('0x14')](respondWithFilteredResult(_0x48861d,_0x4761b0))[_0x1ee1('0x2a')](handleError(_0x48861d,null));};exports[_0x1ee1('0x52')]=function(_0x57fdc1,_0x1180f7){var _0xfc49b2={};var _0x5d7570={};var _0x14b69f;var _0x4d80eb;return db[_0x1ee1('0x1f')]['findOne']({'where':{'id':_0x57fdc1[_0x1ee1('0x3f')]['id']}})[_0x1ee1('0x14')](handleEntityNotFound(_0x1180f7,null))['then'](function(_0x52b57c){if(_0x52b57c){_0x14b69f=_0x52b57c;_0x5d7570[_0x1ee1('0x2f')]=_[_0x1ee1('0x2c')](db['Team']['rawAttributes']);_0x5d7570[_0x1ee1('0x27')]=_['keys'](_0x57fdc1['query']);_0x5d7570[_0x1ee1('0x2d')]=_['intersection'](_0x5d7570[_0x1ee1('0x2f')],_0x5d7570[_0x1ee1('0x27')]);_0xfc49b2[_0x1ee1('0x30')]=_['intersection'](_0x5d7570[_0x1ee1('0x2f')],qs[_0x1ee1('0x31')](_0x57fdc1[_0x1ee1('0x27')][_0x1ee1('0x31')]));_0xfc49b2[_0x1ee1('0x30')]=_0xfc49b2[_0x1ee1('0x30')][_0x1ee1('0x32')]?_0xfc49b2[_0x1ee1('0x30')]:_0x5d7570['model'];_0xfc49b2['order']=qs[_0x1ee1('0x46')](_0x57fdc1[_0x1ee1('0x27')][_0x1ee1('0x46')]);_0xfc49b2[_0x1ee1('0x25')]=qs[_0x1ee1('0x2d')](_['pick'](_0x57fdc1[_0x1ee1('0x27')],_0x5d7570['filters']));if(_0x57fdc1[_0x1ee1('0x27')][_0x1ee1('0x49')]){_0xfc49b2['where']=_[_0x1ee1('0x34')](_0xfc49b2[_0x1ee1('0x25')],{'$or':_[_0x1ee1('0x1e')](_0xfc49b2[_0x1ee1('0x30')],function(_0x40c283){var _0x41697b={};_0x41697b[_0x40c283]={'$like':'%'+_0x57fdc1[_0x1ee1('0x27')]['filter']+'%'};return _0x41697b;})});}_0xfc49b2=_['merge']({},_0xfc49b2,_0x57fdc1[_0x1ee1('0x35')]);return _0x14b69f[_0x1ee1('0x52')](_0xfc49b2);}})[_0x1ee1('0x14')](function(_0x1c5ffc){if(_0x1c5ffc){_0x4d80eb=_0x1c5ffc[_0x1ee1('0x32')];if(!_0x57fdc1[_0x1ee1('0x27')][_0x1ee1('0x43')](_0x1ee1('0x44'))){_0xfc49b2[_0x1ee1('0xe')]=qs['limit'](_0x57fdc1['query'][_0x1ee1('0xe')]);_0xfc49b2[_0x1ee1('0xc')]=qs[_0x1ee1('0xc')](_0x57fdc1[_0x1ee1('0x27')]['offset']);}return _0x14b69f[_0x1ee1('0x52')](_0xfc49b2);}})[_0x1ee1('0x14')](function(_0x171be8){if(_0x171be8){return _0x171be8?{'count':_0x4d80eb,'rows':_0x171be8}:null;}})[_0x1ee1('0x14')](respondWithResult(_0x1180f7,null))[_0x1ee1('0x2a')](handleError(_0x1180f7,null));};exports[_0x1ee1('0x53')]=function(_0x575174,_0x56433d){var _0x2f2110=_0x575174[_0x1ee1('0x37')]['ids'];return db['Team'][_0x1ee1('0x28')]({'where':{'id':_0x2f2110},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x1ee1('0x1b'),'online','voicePause',_0x1ee1('0x54')],'raw':!![]}]})[_0x1ee1('0x14')](function(_0x445bc5){if(_0x445bc5){var _0x9eb40a=_['flatMap'](_0x445bc5,function(_0x3dfbfc){var _0x431777=_0x3dfbfc[_0x1ee1('0x16')]({'plain':!![]});return _0x431777[_0x1ee1('0x55')];});return db[_0x1ee1('0x1f')][_0x1ee1('0x36')]({'where':{'id':_0x575174['params']['id']}})[_0x1ee1('0x14')](function(_0x58042c){return db[_0x1ee1('0x56')][_0x1ee1('0x57')](function(_0x5d8952){return _0x58042c[_0x1ee1('0x53')](_0x2f2110,{'transaction':_0x5d8952})['then'](function(){return BPromise[_0x1ee1('0x58')](_0x9eb40a,function(_0x1464a4){return db[_0x1ee1('0x42')][_0x1ee1('0x59')]({'where':{'UserId':_0x1464a4['id'],'MailQueueId':_0x575174[_0x1ee1('0x3f')]['id']},'transaction':_0x5d8952});});})[_0x1ee1('0x14')](function(){_0x9eb40a[_0x1ee1('0x5a')](function(_0x5aaa30){socket[_0x1ee1('0x5b')](_0x1ee1('0x5c'),{'UserId':_0x5aaa30['id'],'MailQueueId':_0x58042c['id']});});});});});}})[_0x1ee1('0x14')](respondWithStatusCode(_0x56433d,null))[_0x1ee1('0x2a')](handleError(_0x56433d,null));};exports[_0x1ee1('0x5d')]=function(_0x15faca,_0x4cb262){return db['Team'][_0x1ee1('0x28')]({'where':{'id':_0x15faca[_0x1ee1('0x27')][_0x1ee1('0x5e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1ee1('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4cb262,null))['then'](function(_0x1452b6){var _0x5d7d41=_[_0x1ee1('0x1e')](_0x1452b6,'id');var _0x252231=[];var _0xb2f815=[];var _0x327ade=squel[_0x1ee1('0x5f')]();_0x327ade[_0x1ee1('0x60')](_0x1ee1('0x61'))['from'](_0x1ee1('0x62'),'tq')['join'](_0x1ee1('0x63'),'ut',_0x1ee1('0x64'))['where'](_0x1ee1('0x65'),_0x15faca[_0x1ee1('0x3f')]['id']);for(var _0x4cfd57=0x0;_0x4cfd57<_0x1452b6[_0x1ee1('0x32')];_0x4cfd57+=0x1){let _0x20185e=_0x1452b6[_0x4cfd57];for(var _0x367164=0x0;_0x367164<_0x20185e[_0x1ee1('0x55')][_0x1ee1('0x32')];_0x367164+=0x1){let _0x25ffce=_0x20185e['Agents'][_0x367164];var _0xb13ae8=_0x327ade[_0x1ee1('0x66')]();_0xb13ae8[_0x1ee1('0x25')](_0x1ee1('0x67'),_0x25ffce['id']);_0xb2f815[_0x1ee1('0x68')](db['sequelize'][_0x1ee1('0x27')](_0xb13ae8[_0x1ee1('0x69')](),{'type':db['sequelize']['QueryTypes'][_0x1ee1('0x6a')]})[_0x1ee1('0x14')](function(_0x1cd55e){if(_0x1cd55e['length']===0x1){return _0x25ffce['id'];}else{var _0x1e5941=_[_0x1ee1('0x6b')](_[_0x1ee1('0x1e')](_0x1cd55e,_0x1ee1('0x6c')),function(_0x10adf1){return _['includes'](_0x5d7d41,_0x10adf1);});if(_0x1e5941){return _0x25ffce['id'];}}}));}}return BPromise[_0x1ee1('0x6d')](_0xb2f815)[_0x1ee1('0x14')](function(_0x4f504a){_0x252231=_(_0x252231)['union'](_0x4f504a)[_0x1ee1('0x6e')]()['value']();return db[_0x1ee1('0x1f')][_0x1ee1('0x36')]({'where':{'id':_0x15faca['params']['id']}})[_0x1ee1('0x14')](function(_0x4e147e){return db['sequelize'][_0x1ee1('0x57')](function(_0x21eaf2){return _0x4e147e[_0x1ee1('0x5d')](_0x15faca[_0x1ee1('0x27')][_0x1ee1('0x5e')],{'transaction':_0x21eaf2})[_0x1ee1('0x14')](function(){if(!_[_0x1ee1('0x6f')](_0x252231)){return _0x4e147e['removeAgents'](_0x252231,{'transaction':_0x21eaf2});}})[_0x1ee1('0x14')](function(){_0x252231[_0x1ee1('0x5a')](function(_0x1ccfb6){socket[_0x1ee1('0x5b')](_0x1ee1('0x70'),{'UserId':_0x1ccfb6,'MailQueueId':_0x4e147e['id']});});});});});});})[_0x1ee1('0x14')](respondWithStatusCode(_0x4cb262,null))[_0x1ee1('0x2a')](handleError(_0x4cb262,null));};exports[_0x1ee1('0x71')]=function(_0x18c197,_0x3915df){return db[_0x1ee1('0x1f')]['find']({'where':{'id':_0x18c197[_0x1ee1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3915df,null))[_0x1ee1('0x14')](function(_0x39b1e5){if(_0x39b1e5){return _0x39b1e5[_0x1ee1('0x71')](_0x18c197[_0x1ee1('0x37')][_0x1ee1('0x5e')],_['omit'](_0x18c197[_0x1ee1('0x37')],['ids','id'])||{})['spread'](function(_0x5e8812){for(var _0x396c45=0x0;_0x396c45<_0x18c197[_0x1ee1('0x37')][_0x1ee1('0x5e')]['length'];_0x396c45+=0x1){socket[_0x1ee1('0x5b')](_0x1ee1('0x5c'),{'UserId':Number(_0x18c197[_0x1ee1('0x37')][_0x1ee1('0x5e')][_0x396c45]),'MailQueueId':Number(_0x18c197[_0x1ee1('0x3f')]['id'])});}return _0x5e8812;});}})['then'](respondWithResult(_0x3915df,null))['catch'](handleError(_0x3915df,null));};exports[_0x1ee1('0x72')]=function(_0x563e46,_0x2f9124){return db['MailQueue']['find']({'where':{'id':_0x563e46[_0x1ee1('0x3f')]['id']}})[_0x1ee1('0x14')](handleEntityNotFound(_0x2f9124,null))['then'](function(_0x11109a){if(_0x11109a){return _0x11109a[_0x1ee1('0x72')](_0x563e46[_0x1ee1('0x27')][_0x1ee1('0x5e')])[_0x1ee1('0x14')](function(){if(_[_0x1ee1('0x73')](_0x563e46[_0x1ee1('0x27')][_0x1ee1('0x5e')])){for(var _0xeaa3a3=0x0;_0xeaa3a3<_0x563e46[_0x1ee1('0x27')][_0x1ee1('0x5e')][_0x1ee1('0x32')];_0xeaa3a3+=0x1){socket[_0x1ee1('0x5b')]('userMailQueue:remove',{'UserId':Number(_0x563e46[_0x1ee1('0x27')]['ids'][_0xeaa3a3]),'MailQueueId':Number(_0x563e46[_0x1ee1('0x3f')]['id'])});}}else{socket[_0x1ee1('0x5b')](_0x1ee1('0x70'),{'UserId':Number(_0x563e46[_0x1ee1('0x27')][_0x1ee1('0x5e')]),'MailQueueId':Number(_0x563e46[_0x1ee1('0x3f')]['id'])});}});}})[_0x1ee1('0x14')](respondWithStatusCode(_0x2f9124,null))[_0x1ee1('0x2a')](handleError(_0x2f9124,null));};exports[_0x1ee1('0x74')]=function(_0x24cefa,_0x55fdf4){var _0xdb3f94={};var _0x177a03={};var _0x307224;var _0x289f27;return db[_0x1ee1('0x1f')][_0x1ee1('0x41')]({'where':{'id':_0x24cefa[_0x1ee1('0x3f')]['id']}})[_0x1ee1('0x14')](handleEntityNotFound(_0x55fdf4,null))[_0x1ee1('0x14')](function(_0x2c2a9d){if(_0x2c2a9d){_0x307224=_0x2c2a9d;_0x177a03[_0x1ee1('0x2f')]=_[_0x1ee1('0x2c')](db[_0x1ee1('0x75')][_0x1ee1('0x20')]);_0x177a03[_0x1ee1('0x27')]=_[_0x1ee1('0x2c')](_0x24cefa[_0x1ee1('0x27')]);_0x177a03[_0x1ee1('0x2d')]=_[_0x1ee1('0x2e')](_0x177a03[_0x1ee1('0x2f')],_0x177a03[_0x1ee1('0x27')]);_0xdb3f94[_0x1ee1('0x30')]=_[_0x1ee1('0x2e')](_0x177a03[_0x1ee1('0x2f')],qs['fields'](_0x24cefa[_0x1ee1('0x27')]['fields']));_0xdb3f94[_0x1ee1('0x30')]=_0xdb3f94[_0x1ee1('0x30')]['length']?_0xdb3f94[_0x1ee1('0x30')]:_0x177a03[_0x1ee1('0x2f')];_0xdb3f94['order']=qs['sort'](_0x24cefa['query'][_0x1ee1('0x46')]);_0xdb3f94[_0x1ee1('0x25')]=qs[_0x1ee1('0x2d')](_[_0x1ee1('0x47')](_0x24cefa['query'],_0x177a03['filters']));if(_0x24cefa['query'][_0x1ee1('0x49')]){_0xdb3f94[_0x1ee1('0x25')]=_[_0x1ee1('0x34')](_0xdb3f94[_0x1ee1('0x25')],{'$or':_[_0x1ee1('0x1e')](_0xdb3f94['attributes'],function(_0x30a41e){var _0x451c5f={};_0x451c5f[_0x30a41e]={'$like':'%'+_0x24cefa[_0x1ee1('0x27')][_0x1ee1('0x49')]+'%'};return _0x451c5f;})});}_0xdb3f94=_[_0x1ee1('0x34')]({},_0xdb3f94,_0x24cefa[_0x1ee1('0x35')]);return _0x307224['getAgents'](_0xdb3f94);}})[_0x1ee1('0x14')](function(_0x40d227){if(_0x40d227){_0x289f27=_0x40d227[_0x1ee1('0x32')];if(!_0x24cefa[_0x1ee1('0x27')][_0x1ee1('0x43')](_0x1ee1('0x44'))){_0xdb3f94['limit']=qs[_0x1ee1('0xe')](_0x24cefa['query']['limit']);_0xdb3f94[_0x1ee1('0xc')]=qs[_0x1ee1('0xc')](_0x24cefa[_0x1ee1('0x27')]['offset']);}return _0x307224[_0x1ee1('0x74')](_0xdb3f94);}})[_0x1ee1('0x14')](function(_0x15dbae){if(_0x15dbae){return _0x15dbae?{'count':_0x289f27,'rows':_0x15dbae}:null;}})[_0x1ee1('0x14')](respondWithResult(_0x55fdf4,null))['catch'](handleError(_0x55fdf4,null));}; \ No newline at end of file +var _0x3656=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','MailQueueId','merge','map','findAll','User','UserId','agent','mailPause','createdAt','format','SIP','updatedAt','Team','rawAttributes','pick','filter','getTeams','addTeams','interface','Agents','sequelize','each','findOrCreate','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','includes','all','union','compact','transaction','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','end','json','offset','undefined','count','limit','status','then','destroy','MailQueues','UserProfileResource','name','send','index','MailQueue','type','key','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','create','user','get'];(function(_0x3a1771,_0xc4a050){var _0x1493a5=function(_0x472ad1){while(--_0x472ad1){_0x3a1771['push'](_0x3a1771['shift']());}};_0x1493a5(++_0xc4a050);}(_0x3656,0x1a1));var _0x6365=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x3656[_0x5d6456];return _0x4d66c1;};'use strict';var BPromise=require(_0x6365('0x0'));var util=require(_0x6365('0x1'));var _=require(_0x6365('0x2'));var squel=require(_0x6365('0x3'));var Redis=require('ioredis');var qs=require(_0x6365('0x4'));var logger=require(_0x6365('0x5'))(_0x6365('0x6'));var config=require('../../config/environment');var db=require(_0x6365('0x7'))['db'];config[_0x6365('0x8')]=_[_0x6365('0x9')](config[_0x6365('0x8')],{'host':_0x6365('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6365('0x8')]));require(_0x6365('0xb'))[_0x6365('0xc')](socket);function respondWithStatusCode(_0x277e27,_0x308662){_0x308662=_0x308662||0xcc;return function(_0x355f84){if(_0x355f84){return _0x277e27[_0x6365('0xd')](_0x308662);}return _0x277e27['status'](_0x308662)[_0x6365('0xe')]();};}function respondWithResult(_0x2c2bbd,_0x401619){_0x401619=_0x401619||0xc8;return function(_0x5ef816){if(_0x5ef816){return _0x2c2bbd['status'](_0x401619)[_0x6365('0xf')](_0x5ef816);}};}function respondWithFilteredResult(_0x317b81,_0x92a0ce){return function(_0x5cd859){if(_0x5cd859){var _0x37ed3c=typeof _0x92a0ce[_0x6365('0x10')]===_0x6365('0x11')&&typeof _0x92a0ce['limit']==='undefined';var _0x3a2356=_0x5cd859['count'];var _0x5844f0=_0x37ed3c?0x0:_0x92a0ce[_0x6365('0x10')];var _0x1062dd=_0x37ed3c?_0x5cd859[_0x6365('0x12')]:_0x92a0ce[_0x6365('0x10')]+_0x92a0ce[_0x6365('0x13')];var _0x2f221a;if(_0x1062dd>=_0x3a2356){_0x1062dd=_0x3a2356;_0x2f221a=0xc8;}else{_0x2f221a=0xce;}_0x317b81[_0x6365('0x14')](_0x2f221a);return _0x317b81['set']('Content-Range',_0x5844f0+'-'+_0x1062dd+'/'+_0x3a2356)['json'](_0x5cd859);}return null;};}function saveUpdates(_0x31c7ea){return function(_0x26b419){if(_0x26b419){return _0x26b419['update'](_0x31c7ea)[_0x6365('0x15')](function(_0x5f17ba){return _0x5f17ba;});}return null;};}function removeEntity(_0x2a8cdd){return function(_0x42ee09){if(_0x42ee09){return _0x42ee09[_0x6365('0x16')]()[_0x6365('0x15')](function(){var _0x86f9d3=_0x42ee09['get']({'plain':!![]});var _0x1860b0=_0x6365('0x17');return db[_0x6365('0x18')]['destroy']({'where':{'type':_0x1860b0,'resourceId':_0x86f9d3['id']}})[_0x6365('0x15')](function(){return _0x42ee09;});})[_0x6365('0x15')](function(){_0x2a8cdd[_0x6365('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b47e){return function(_0x158a6c){if(!_0x158a6c){_0x29b47e[_0x6365('0xd')](0x194);}return _0x158a6c;};}function handleError(_0x562a31,_0x374529){_0x374529=_0x374529||0x1f4;return function(_0x359afb){logger['error'](_0x359afb['stack']);if(_0x359afb[_0x6365('0x19')]){delete _0x359afb[_0x6365('0x19')];}_0x562a31[_0x6365('0x14')](_0x374529)[_0x6365('0x1a')](_0x359afb);};}exports[_0x6365('0x1b')]=function(_0xa64674,_0x2c3c42){var _0x111610={};var _0x1c4205={'count':0x0,'rows':[]};var _0x3d8177=_['map'](db[_0x6365('0x1c')]['rawAttributes'],function(_0x4c0d19){return{'name':_0x4c0d19['fieldName'],'type':_0x4c0d19[_0x6365('0x1d')][_0x6365('0x1e')]};});_0x111610=qs[_0x6365('0x1f')](_0x3d8177,_0xa64674);var _0x400ee0={'where':_0x111610[_0x6365('0x20')]};return db[_0x6365('0x1c')]['count'](_0x400ee0)[_0x6365('0x15')](function(_0x1e3e95){_0x1c4205['count']=_0x1e3e95;_0x111610[_0x6365('0x21')]=qs['include'](_0xa64674[_0x6365('0x22')]);return db[_0x6365('0x1c')]['findAll'](_0x111610);})[_0x6365('0x15')](function(_0x40c56a){_0x1c4205[_0x6365('0x23')]=_0x40c56a;return _0x1c4205;})[_0x6365('0x15')](respondWithFilteredResult(_0x2c3c42,_0x111610))[_0x6365('0x24')](handleError(_0x2c3c42,null));};exports[_0x6365('0x25')]=function(_0x193113,_0x3f391b){var _0x58c4b6={'raw':!![],'where':{'id':_0x193113[_0x6365('0x26')]['id']}},_0x4497b4={};_0x4497b4[_0x6365('0x27')]=_[_0x6365('0x28')](db['MailQueue']['rawAttributes']);_0x4497b4['query']=_['keys'](_0x193113['query']);_0x4497b4[_0x6365('0x29')]=_[_0x6365('0x2a')](_0x4497b4[_0x6365('0x27')],_0x4497b4[_0x6365('0x22')]);_0x58c4b6[_0x6365('0x2b')]=_['intersection'](_0x4497b4[_0x6365('0x27')],qs[_0x6365('0x2c')](_0x193113[_0x6365('0x22')]['fields']));_0x58c4b6['attributes']=_0x58c4b6[_0x6365('0x2b')][_0x6365('0x2d')]?_0x58c4b6[_0x6365('0x2b')]:_0x4497b4[_0x6365('0x27')];if(_0x193113[_0x6365('0x22')][_0x6365('0x2e')]){_0x58c4b6[_0x6365('0x21')]=[{'all':!![]}];}_0x58c4b6=_['merge']({},_0x58c4b6,_0x193113[_0x6365('0x2f')]);return db['MailQueue']['find'](_0x58c4b6)[_0x6365('0x15')](handleEntityNotFound(_0x3f391b,null))[_0x6365('0x15')](respondWithResult(_0x3f391b,null))['catch'](handleError(_0x3f391b,null));};exports[_0x6365('0x30')]=function(_0x4dac4b,_0x3173e5){return db[_0x6365('0x1c')][_0x6365('0x30')](_0x4dac4b['body'],{})['then'](function(_0x3e2dc6){var _0x6adad0=_0x4dac4b[_0x6365('0x31')][_0x6365('0x32')]({'plain':!![]});if(!_0x6adad0)throw new Error(_0x6365('0x33'));if(_0x6adad0[_0x6365('0x34')]===_0x6365('0x31')){var _0x31bb68=_0x3e2dc6[_0x6365('0x32')]({'plain':!![]});var _0x3703e2=_0x6365('0x17');return db[_0x6365('0x35')]['find']({'where':{'name':_0x3703e2,'userProfileId':_0x6adad0[_0x6365('0x36')]},'raw':!![]})[_0x6365('0x15')](function(_0x26626e){if(_0x26626e&&_0x26626e['autoAssociation']===0x0){return db[_0x6365('0x18')][_0x6365('0x30')]({'name':_0x31bb68[_0x6365('0x19')],'resourceId':_0x31bb68['id'],'type':_0x26626e['name'],'sectionId':_0x26626e['id']},{})[_0x6365('0x15')](function(){return _0x3e2dc6;});}else{return _0x3e2dc6;}})['catch'](function(_0xdd7e1c){logger[_0x6365('0x37')](_0x6365('0x38'),_0xdd7e1c);throw _0xdd7e1c;});}return _0x3e2dc6;})[_0x6365('0x15')](respondWithResult(_0x3173e5,0xc9))[_0x6365('0x24')](handleError(_0x3173e5,null));};exports[_0x6365('0x39')]=function(_0xef5307,_0x1d88ea){if(_0xef5307[_0x6365('0x3a')]['id']){delete _0xef5307['body']['id'];}return db[_0x6365('0x1c')]['find']({'where':{'id':_0xef5307['params']['id']}})[_0x6365('0x15')](handleEntityNotFound(_0x1d88ea,null))[_0x6365('0x15')](saveUpdates(_0xef5307['body'],null))[_0x6365('0x15')](respondWithResult(_0x1d88ea,null))[_0x6365('0x24')](handleError(_0x1d88ea,null));};exports['destroy']=function(_0x21b5ed,_0x137e75){return db[_0x6365('0x1c')][_0x6365('0x3b')]({'where':{'id':_0x21b5ed['params']['id']}})['then'](handleEntityNotFound(_0x137e75,null))['then'](removeEntity(_0x137e75,null))['catch'](handleError(_0x137e75,null));};exports[_0x6365('0x3c')]=function(_0x25195c,_0x4723e6){return db[_0x6365('0x1c')][_0x6365('0x3c')]()['then'](respondWithResult(_0x4723e6,null))[_0x6365('0x24')](handleError(_0x4723e6,null));};exports['getMembers']=function(_0x257b1,_0x1a6104){var _0x3a1434={'raw':!![],'where':{}},_0x1704b5={},_0x19d12f;return db[_0x6365('0x1c')][_0x6365('0x3d')]({'where':{'id':_0x257b1['params']['id']}})['then'](handleEntityNotFound(_0x1a6104,null))['then'](function(_0x41399d){if(_0x41399d){_0x19d12f=_0x41399d[_0x6365('0x32')]({'plain':!![]});_0x1704b5[_0x6365('0x27')]=_[_0x6365('0x28')](db[_0x6365('0x3e')]['rawAttributes']);_0x1704b5[_0x6365('0x22')]=_[_0x6365('0x28')](_0x257b1[_0x6365('0x22')]);_0x1704b5[_0x6365('0x29')]=_[_0x6365('0x2a')](_0x1704b5[_0x6365('0x27')],_0x1704b5[_0x6365('0x22')]);_0x3a1434['attributes']=_['intersection'](_0x1704b5[_0x6365('0x27')],qs[_0x6365('0x2c')](_0x257b1['query']['fields']));_0x3a1434[_0x6365('0x2b')]=_0x3a1434[_0x6365('0x2b')]['length']?_0x3a1434['attributes']:_0x1704b5[_0x6365('0x27')];if(!_0x257b1[_0x6365('0x22')][_0x6365('0x3f')](_0x6365('0x40'))){_0x3a1434['limit']=qs[_0x6365('0x13')](_0x257b1['query'][_0x6365('0x13')]);_0x3a1434[_0x6365('0x10')]=qs['offset'](_0x257b1[_0x6365('0x22')]['offset']);}_0x3a1434[_0x6365('0x41')]=qs[_0x6365('0x42')](_0x257b1['query'][_0x6365('0x42')]);_0x3a1434[_0x6365('0x20')]=qs[_0x6365('0x29')](_['pick'](_0x257b1[_0x6365('0x22')],_0x1704b5[_0x6365('0x29')]));_0x3a1434[_0x6365('0x20')][_0x6365('0x43')]=_0x41399d['id'];if(_0x257b1[_0x6365('0x22')]['filter']){_0x3a1434[_0x6365('0x20')]=_[_0x6365('0x44')](_0x3a1434['where'],{'$or':_[_0x6365('0x45')](_0x3a1434[_0x6365('0x2b')],function(_0x51679e){var _0x8ef6ca={};_0x8ef6ca[_0x51679e]={'$like':'%'+_0x257b1['query']['filter']+'%'};return _0x8ef6ca;})});}_0x3a1434=_[_0x6365('0x44')]({},_0x3a1434,_0x257b1['options']);return db[_0x6365('0x3e')][_0x6365('0x46')](_0x3a1434);}})[_0x6365('0x15')](function(_0x36c9f7){if(_0x36c9f7){return db[_0x6365('0x47')]['findAndCountAll']({'where':{'id':_[_0x6365('0x45')](_0x36c9f7,_0x6365('0x48')),'role':_0x6365('0x49')},'attributes':['id',_0x6365('0x19'),_0x6365('0x4a'),'updatedAt',_0x6365('0x4b')]});}})['then'](function(_0x1020a1){if(_0x1020a1){return{'count':_0x1020a1['count'],'rows':_[_0x6365('0x45')](_0x1020a1[_0x6365('0x23')],function(_0x168bee){return{'membername':_0x168bee[_0x6365('0x19')],'UserId':_0x168bee['id'],'queue_name':_0x19d12f[_0x6365('0x19')],'MailQueueId':_0x19d12f['id'],'interface':util[_0x6365('0x4c')]('%s/%s',_0x6365('0x4d'),_0x168bee[_0x6365('0x19')]),'penalty':0x0,'paused':_0x168bee[_0x6365('0x4a')],'createdAt':_0x168bee['createdAt'],'updatedAt':_0x168bee[_0x6365('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6365('0x15')](respondWithFilteredResult(_0x1a6104,_0x3a1434))['catch'](handleError(_0x1a6104,null));};exports['getTeams']=function(_0x11289f,_0x364d19){var _0x2e3eac={};var _0x1d4aba={};var _0x4e6be5;var _0x105fc0;return db['MailQueue'][_0x6365('0x3d')]({'where':{'id':_0x11289f[_0x6365('0x26')]['id']}})['then'](handleEntityNotFound(_0x364d19,null))['then'](function(_0x46ac69){if(_0x46ac69){_0x4e6be5=_0x46ac69;_0x1d4aba[_0x6365('0x27')]=_[_0x6365('0x28')](db[_0x6365('0x4f')][_0x6365('0x50')]);_0x1d4aba[_0x6365('0x22')]=_['keys'](_0x11289f['query']);_0x1d4aba[_0x6365('0x29')]=_[_0x6365('0x2a')](_0x1d4aba[_0x6365('0x27')],_0x1d4aba[_0x6365('0x22')]);_0x2e3eac[_0x6365('0x2b')]=_[_0x6365('0x2a')](_0x1d4aba[_0x6365('0x27')],qs[_0x6365('0x2c')](_0x11289f[_0x6365('0x22')]['fields']));_0x2e3eac['attributes']=_0x2e3eac[_0x6365('0x2b')][_0x6365('0x2d')]?_0x2e3eac[_0x6365('0x2b')]:_0x1d4aba[_0x6365('0x27')];_0x2e3eac[_0x6365('0x41')]=qs[_0x6365('0x42')](_0x11289f[_0x6365('0x22')]['sort']);_0x2e3eac[_0x6365('0x20')]=qs['filters'](_[_0x6365('0x51')](_0x11289f[_0x6365('0x22')],_0x1d4aba[_0x6365('0x29')]));if(_0x11289f['query'][_0x6365('0x52')]){_0x2e3eac[_0x6365('0x20')]=_[_0x6365('0x44')](_0x2e3eac[_0x6365('0x20')],{'$or':_['map'](_0x2e3eac['attributes'],function(_0x1005b6){var _0x4976e3={};_0x4976e3[_0x1005b6]={'$like':'%'+_0x11289f[_0x6365('0x22')][_0x6365('0x52')]+'%'};return _0x4976e3;})});}_0x2e3eac=_['merge']({},_0x2e3eac,_0x11289f[_0x6365('0x2f')]);return _0x4e6be5[_0x6365('0x53')](_0x2e3eac);}})['then'](function(_0xeec1d0){if(_0xeec1d0){_0x105fc0=_0xeec1d0[_0x6365('0x2d')];if(!_0x11289f[_0x6365('0x22')][_0x6365('0x3f')](_0x6365('0x40'))){_0x2e3eac[_0x6365('0x13')]=qs[_0x6365('0x13')](_0x11289f[_0x6365('0x22')][_0x6365('0x13')]);_0x2e3eac[_0x6365('0x10')]=qs[_0x6365('0x10')](_0x11289f['query'][_0x6365('0x10')]);}return _0x4e6be5['getTeams'](_0x2e3eac);}})[_0x6365('0x15')](function(_0x2f6b2f){if(_0x2f6b2f){return _0x2f6b2f?{'count':_0x105fc0,'rows':_0x2f6b2f}:null;}})[_0x6365('0x15')](respondWithResult(_0x364d19,null))[_0x6365('0x24')](handleError(_0x364d19,null));};exports[_0x6365('0x54')]=function(_0x8e827,_0x1585c5){var _0x28dd84=_0x8e827['body']['ids'];return db['Team'][_0x6365('0x46')]({'where':{'id':_0x28dd84},'attributes':['id'],'include':[{'model':db[_0x6365('0x47')],'as':'Agents','attributes':['id',_0x6365('0x19'),'online','voicePause',_0x6365('0x55')],'raw':!![]}]})[_0x6365('0x15')](function(_0x25f16e){if(_0x25f16e){var _0x28269f=_['flatMap'](_0x25f16e,function(_0x50ba91){var _0x146cd2=_0x50ba91['get']({'plain':!![]});return _0x146cd2[_0x6365('0x56')];});return db['MailQueue'][_0x6365('0x3b')]({'where':{'id':_0x8e827[_0x6365('0x26')]['id']}})['then'](function(_0x2ee995){return db[_0x6365('0x57')]['transaction'](function(_0x2ea0da){return _0x2ee995[_0x6365('0x54')](_0x28dd84,{'transaction':_0x2ea0da})['then'](function(){return BPromise[_0x6365('0x58')](_0x28269f,function(_0x2458ea){return db[_0x6365('0x3e')][_0x6365('0x59')]({'where':{'UserId':_0x2458ea['id'],'MailQueueId':_0x8e827[_0x6365('0x26')]['id']},'transaction':_0x2ea0da});});})[_0x6365('0x15')](function(){_0x28269f['forEach'](function(_0x4d0faf){socket[_0x6365('0x5a')]('userMailQueue:save',{'UserId':_0x4d0faf['id'],'MailQueueId':_0x2ee995['id']});});});});});}})[_0x6365('0x15')](respondWithStatusCode(_0x1585c5,null))[_0x6365('0x24')](handleError(_0x1585c5,null));};exports[_0x6365('0x5b')]=function(_0x55d00f,_0x4066ec){return db[_0x6365('0x4f')]['findAll']({'where':{'id':_0x55d00f[_0x6365('0x22')][_0x6365('0x5c')]},'attributes':['id'],'include':[{'model':db[_0x6365('0x47')],'as':_0x6365('0x56'),'attributes':['id'],'raw':!![]}]})[_0x6365('0x15')](handleEntityNotFound(_0x4066ec,null))[_0x6365('0x15')](function(_0x4986cd){var _0x19f735=_['map'](_0x4986cd,'id');var _0x4bf4dc=[];var _0x159df9=[];var _0x20de24=squel[_0x6365('0x5d')]();_0x20de24[_0x6365('0x5e')](_0x6365('0x5f'))[_0x6365('0x60')](_0x6365('0x61'),'tq')[_0x6365('0x62')]('user_has_teams','ut',_0x6365('0x63'))[_0x6365('0x20')]('MailQueueId\x20=\x20?',_0x55d00f[_0x6365('0x26')]['id']);for(var _0x2f64a1=0x0;_0x2f64a1<_0x4986cd[_0x6365('0x2d')];_0x2f64a1+=0x1){let _0x4193db=_0x4986cd[_0x2f64a1];for(var _0x478616=0x0;_0x478616<_0x4193db[_0x6365('0x56')]['length'];_0x478616+=0x1){let _0x489f9e=_0x4193db[_0x6365('0x56')][_0x478616];var _0x560aba=_0x20de24[_0x6365('0x64')]();_0x560aba[_0x6365('0x20')]('ut.UserId\x20=\x20?',_0x489f9e['id']);_0x159df9[_0x6365('0x65')](db[_0x6365('0x57')][_0x6365('0x22')](_0x560aba[_0x6365('0x66')](),{'type':db[_0x6365('0x57')][_0x6365('0x67')]['SELECT']})[_0x6365('0x15')](function(_0x59ec06){if(_0x59ec06[_0x6365('0x2d')]===0x1){return _0x489f9e['id'];}else{var _0x75bf30=_['every'](_[_0x6365('0x45')](_0x59ec06,'TeamId'),function(_0x51772a){return _[_0x6365('0x68')](_0x19f735,_0x51772a);});if(_0x75bf30){return _0x489f9e['id'];}}}));}}return BPromise[_0x6365('0x69')](_0x159df9)[_0x6365('0x15')](function(_0xdbebc){_0x4bf4dc=_(_0x4bf4dc)[_0x6365('0x6a')](_0xdbebc)[_0x6365('0x6b')]()['value']();return db[_0x6365('0x1c')]['find']({'where':{'id':_0x55d00f[_0x6365('0x26')]['id']}})[_0x6365('0x15')](function(_0x172fa6){return db['sequelize'][_0x6365('0x6c')](function(_0x278af1){return _0x172fa6['removeTeams'](_0x55d00f['query'][_0x6365('0x5c')],{'transaction':_0x278af1})[_0x6365('0x15')](function(){if(!_[_0x6365('0x6d')](_0x4bf4dc)){return _0x172fa6[_0x6365('0x6e')](_0x4bf4dc,{'transaction':_0x278af1});}})['then'](function(){_0x4bf4dc[_0x6365('0x6f')](function(_0x165f24){socket['emit'](_0x6365('0x70'),{'UserId':_0x165f24,'MailQueueId':_0x172fa6['id']});});});});});});})[_0x6365('0x15')](respondWithStatusCode(_0x4066ec,null))['catch'](handleError(_0x4066ec,null));};exports[_0x6365('0x71')]=function(_0x3d5231,_0x5415f5){return db['MailQueue'][_0x6365('0x3b')]({'where':{'id':_0x3d5231[_0x6365('0x26')]['id']}})[_0x6365('0x15')](handleEntityNotFound(_0x5415f5,null))[_0x6365('0x15')](function(_0x33329b){if(_0x33329b){return _0x33329b['addAgents'](_0x3d5231[_0x6365('0x3a')][_0x6365('0x5c')],_['omit'](_0x3d5231[_0x6365('0x3a')],[_0x6365('0x5c'),'id'])||{})[_0x6365('0x72')](function(_0x138d09){for(var _0x1ec348=0x0;_0x1ec348<_0x3d5231[_0x6365('0x3a')]['ids'][_0x6365('0x2d')];_0x1ec348+=0x1){socket[_0x6365('0x5a')]('userMailQueue:save',{'UserId':Number(_0x3d5231[_0x6365('0x3a')]['ids'][_0x1ec348]),'MailQueueId':Number(_0x3d5231[_0x6365('0x26')]['id'])});}return _0x138d09;});}})[_0x6365('0x15')](respondWithResult(_0x5415f5,null))[_0x6365('0x24')](handleError(_0x5415f5,null));};exports[_0x6365('0x6e')]=function(_0x4c1445,_0x109661){return db[_0x6365('0x1c')][_0x6365('0x3b')]({'where':{'id':_0x4c1445[_0x6365('0x26')]['id']}})[_0x6365('0x15')](handleEntityNotFound(_0x109661,null))[_0x6365('0x15')](function(_0x3fadc1){if(_0x3fadc1){return _0x3fadc1[_0x6365('0x6e')](_0x4c1445['query'][_0x6365('0x5c')])['then'](function(){if(_[_0x6365('0x73')](_0x4c1445[_0x6365('0x22')][_0x6365('0x5c')])){for(var _0x5e5047=0x0;_0x5e5047<_0x4c1445['query'][_0x6365('0x5c')][_0x6365('0x2d')];_0x5e5047+=0x1){socket[_0x6365('0x5a')](_0x6365('0x70'),{'UserId':Number(_0x4c1445[_0x6365('0x22')][_0x6365('0x5c')][_0x5e5047]),'MailQueueId':Number(_0x4c1445['params']['id'])});}}else{socket[_0x6365('0x5a')](_0x6365('0x70'),{'UserId':Number(_0x4c1445[_0x6365('0x22')][_0x6365('0x5c')]),'MailQueueId':Number(_0x4c1445['params']['id'])});}});}})[_0x6365('0x15')](respondWithStatusCode(_0x109661,null))[_0x6365('0x24')](handleError(_0x109661,null));};exports[_0x6365('0x74')]=function(_0x198520,_0x2e02eb){var _0x506dec={};var _0x5da0d0={};var _0x22bdae;var _0x2284b0;return db[_0x6365('0x1c')][_0x6365('0x3d')]({'where':{'id':_0x198520[_0x6365('0x26')]['id']}})[_0x6365('0x15')](handleEntityNotFound(_0x2e02eb,null))['then'](function(_0xf2b334){if(_0xf2b334){_0x22bdae=_0xf2b334;_0x5da0d0[_0x6365('0x27')]=_[_0x6365('0x28')](db[_0x6365('0x47')][_0x6365('0x50')]);_0x5da0d0[_0x6365('0x22')]=_[_0x6365('0x28')](_0x198520[_0x6365('0x22')]);_0x5da0d0['filters']=_[_0x6365('0x2a')](_0x5da0d0[_0x6365('0x27')],_0x5da0d0[_0x6365('0x22')]);_0x506dec[_0x6365('0x2b')]=_[_0x6365('0x2a')](_0x5da0d0[_0x6365('0x27')],qs['fields'](_0x198520[_0x6365('0x22')][_0x6365('0x2c')]));_0x506dec[_0x6365('0x2b')]=_0x506dec[_0x6365('0x2b')]['length']?_0x506dec[_0x6365('0x2b')]:_0x5da0d0['model'];_0x506dec['order']=qs[_0x6365('0x42')](_0x198520[_0x6365('0x22')]['sort']);_0x506dec[_0x6365('0x20')]=qs[_0x6365('0x29')](_['pick'](_0x198520[_0x6365('0x22')],_0x5da0d0[_0x6365('0x29')]));if(_0x198520['query']['filter']){_0x506dec['where']=_[_0x6365('0x44')](_0x506dec['where'],{'$or':_[_0x6365('0x45')](_0x506dec[_0x6365('0x2b')],function(_0x339d32){var _0x38544d={};_0x38544d[_0x339d32]={'$like':'%'+_0x198520[_0x6365('0x22')][_0x6365('0x52')]+'%'};return _0x38544d;})});}_0x506dec=_[_0x6365('0x44')]({},_0x506dec,_0x198520[_0x6365('0x2f')]);return _0x22bdae[_0x6365('0x74')](_0x506dec);}})[_0x6365('0x15')](function(_0x32ab8b){if(_0x32ab8b){_0x2284b0=_0x32ab8b['length'];if(!_0x198520[_0x6365('0x22')]['hasOwnProperty'](_0x6365('0x40'))){_0x506dec['limit']=qs[_0x6365('0x13')](_0x198520[_0x6365('0x22')][_0x6365('0x13')]);_0x506dec[_0x6365('0x10')]=qs[_0x6365('0x10')](_0x198520[_0x6365('0x22')][_0x6365('0x10')]);}return _0x22bdae['getAgents'](_0x506dec);}})[_0x6365('0x15')](function(_0xab8fe6){if(_0xab8fe6){return _0xab8fe6?{'count':_0x2284b0,'rows':_0xab8fe6}:null;}})[_0x6365('0x15')](respondWithResult(_0x2e02eb,null))[_0x6365('0x24')](handleError(_0x2e02eb,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5f8e95f..94759e0 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 _0xbd8a=['remove','emit','hook','exports','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x4c77d5,_0x1b16c6){var _0x377fe3=function(_0x49c7db){while(--_0x49c7db){_0x4c77d5['push'](_0x4c77d5['shift']());}};_0x377fe3(++_0x1b16c6);}(_0xbd8a,0x18c));var _0xabd8=function(_0x229a03,_0x36fefc){_0x229a03=_0x229a03-0x0;var _0x2d6e11=_0xbd8a[_0x229a03];return _0x2d6e11;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xabd8('0x0'))['db'][_0xabd8('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xabd8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xabd8('0x3'),'afterDestroy':_0xabd8('0x4')};function emitEvent(_0x5f26b6){return function(_0x16fb75,_0x125639,_0x57a413){MailQueueEvents[_0xabd8('0x5')](_0x5f26b6+':'+_0x16fb75['id'],_0x16fb75);MailQueueEvents['emit'](_0x5f26b6,_0x16fb75);_0x57a413(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xabd8('0x6')](e,emitEvent(event));}}module[_0xabd8('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x4ff2=['hook','exports','events','save','update','remove','emit'];(function(_0x274143,_0x1d3767){var _0x14fa70=function(_0x4378fb){while(--_0x4378fb){_0x274143['push'](_0x274143['shift']());}};_0x14fa70(++_0x1d3767);}(_0x4ff2,0x8e));var _0x24ff=function(_0x259cdb,_0x3696ff){_0x259cdb=_0x259cdb-0x0;var _0x102792=_0x4ff2[_0x259cdb];return _0x102792;};'use strict';var EventEmitter=require(_0x24ff('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x24ff('0x1'),'afterUpdate':_0x24ff('0x2'),'afterDestroy':_0x24ff('0x3')};function emitEvent(_0x432f41){return function(_0x545761,_0x44fbc6,_0x551b55){MailQueueEvents[_0x24ff('0x4')](_0x432f41+':'+_0x545761['id'],_0x545761);MailQueueEvents['emit'](_0x432f41,_0x545761);_0x551b55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x24ff('0x5')](e,emitEvent(event));}}module[_0x24ff('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index ecf11e3..706d127 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 _0xb9f8=['api','moment','bluebird','request-promise','path','rimraf','define','MailQueue','lodash','../../config/logger'];(function(_0x30cf23,_0x1994a2){var _0x2123e4=function(_0x4f0cb1){while(--_0x4f0cb1){_0x30cf23['push'](_0x30cf23['shift']());}};_0x2123e4(++_0x1994a2);}(_0xb9f8,0x1de));var _0x8b9f=function(_0x2ea9f6,_0x3a5500){_0x2ea9f6=_0x2ea9f6-0x0;var _0x36bcce=_0xb9f8[_0x2ea9f6];return _0x36bcce;};'use strict';var _=require(_0x8b9f('0x0'));var util=require('util');var logger=require(_0x8b9f('0x1'))(_0x8b9f('0x2'));var moment=require(_0x8b9f('0x3'));var BPromise=require(_0x8b9f('0x4'));var rp=require(_0x8b9f('0x5'));var fs=require('fs');var path=require(_0x8b9f('0x6'));var rimraf=require(_0x8b9f('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module['exports']=function(_0x1d279d,_0x593486){return _0x1d279d[_0x8b9f('0x8')](_0x8b9f('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24ac=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','mail_queues'];(function(_0x4bcd7a,_0x1bff35){var _0x43c1df=function(_0x1ed3c4){while(--_0x1ed3c4){_0x4bcd7a['push'](_0x4bcd7a['shift']());}};_0x43c1df(++_0x1bff35);}(_0x24ac,0x18c));var _0xc24a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc24a('0x0'));var util=require('util');var logger=require(_0xc24a('0x1'))(_0xc24a('0x2'));var moment=require(_0xc24a('0x3'));var BPromise=require('bluebird');var rp=require(_0xc24a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc24a('0x5'));var config=require(_0xc24a('0x6'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x43886f,_0x4a360f){return _0x43886f[_0xc24a('0x7')]('MailQueue',attributes,{'tableName':_0xc24a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 439e86f..b703b1d 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 _0x7e36=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','where','limit','include','map','attributes','model','GetMailQueue','find','ShowMailQueue','lodash','util'];(function(_0x1013b6,_0x34769a){var _0x175cc7=function(_0x457e21){while(--_0x457e21){_0x1013b6['push'](_0x1013b6['shift']());}};_0x175cc7(++_0x34769a);}(_0x7e36,0x166));var _0x67e3=function(_0x3a7bdf,_0x58bdd8){_0x3a7bdf=_0x3a7bdf-0x0;var _0x35a9a8=_0x7e36[_0x3a7bdf];return _0x35a9a8;};'use strict';var _=require(_0x67e3('0x0'));var util=require(_0x67e3('0x1'));var moment=require(_0x67e3('0x2'));var BPromise=require(_0x67e3('0x3'));var rs=require(_0x67e3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67e3('0x5'))['db'];var utils=require(_0x67e3('0x6'));var logger=require(_0x67e3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x67e3('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x67e3('0x9')](config['redis'],{'host':_0x67e3('0xa'),'port':0x18eb});var socket=require(_0x67e3('0xb'))(new Redis(config[_0x67e3('0xc')]));require(_0x67e3('0xd'))[_0x67e3('0xe')](socket);function respondWithRpcPromise(_0x525d79,_0x5648ae,_0x29c716){return new BPromise(function(_0x3428a3,_0x6b006c){return client[_0x67e3('0xf')](_0x525d79,_0x29c716)[_0x67e3('0x10')](function(_0x1d1595){logger[_0x67e3('0x11')](_0x67e3('0x12'),_0x5648ae,_0x67e3('0x13'));logger['debug'](_0x67e3('0x14'),_0x5648ae,_0x67e3('0x13'),JSON[_0x67e3('0x15')](_0x1d1595));if(_0x1d1595[_0x67e3('0x16')]){if(_0x1d1595[_0x67e3('0x16')][_0x67e3('0x17')]===0x1f4){logger[_0x67e3('0x16')](_0x67e3('0x12'),_0x5648ae,_0x1d1595[_0x67e3('0x16')][_0x67e3('0x18')]);return _0x6b006c(_0x1d1595[_0x67e3('0x16')][_0x67e3('0x18')]);}logger[_0x67e3('0x16')](_0x67e3('0x12'),_0x5648ae,_0x1d1595[_0x67e3('0x16')]['message']);return _0x3428a3(_0x1d1595[_0x67e3('0x16')][_0x67e3('0x18')]);}else{logger['info'](_0x67e3('0x12'),_0x5648ae,_0x67e3('0x13'));_0x3428a3(_0x1d1595[_0x67e3('0x19')]['message']);}})[_0x67e3('0x1a')](function(_0x43edad){logger['error'](_0x67e3('0x12'),_0x5648ae,_0x43edad);_0x6b006c(_0x43edad);});});}exports['GetMailQueue']=function(_0xa19555){var _0x426a33=this;return new Promise(function(_0x470e75,_0x38874a){return db[_0x67e3('0x1b')][_0x67e3('0x1c')]({'raw':_0xa19555[_0x67e3('0x1d')]?_0xa19555[_0x67e3('0x1d')][_0x67e3('0x1e')]===undefined?!![]:![]:!![],'where':_0xa19555[_0x67e3('0x1d')]?_0xa19555[_0x67e3('0x1d')][_0x67e3('0x1f')]||null:null,'attributes':_0xa19555['options']?_0xa19555[_0x67e3('0x1d')]['attributes']||null:null,'limit':_0xa19555[_0x67e3('0x1d')]?_0xa19555[_0x67e3('0x1d')][_0x67e3('0x20')]||null:null,'include':_0xa19555['options']?_0xa19555[_0x67e3('0x1d')][_0x67e3('0x21')]?_[_0x67e3('0x22')](_0xa19555[_0x67e3('0x1d')][_0x67e3('0x21')],function(_0x1a04c1){return{'model':db[_0x1a04c1['model']],'as':_0x1a04c1['as'],'attributes':_0x1a04c1[_0x67e3('0x23')],'include':_0x1a04c1[_0x67e3('0x21')]?_[_0x67e3('0x22')](_0x1a04c1[_0x67e3('0x21')],function(_0x5100a0){return{'model':db[_0x5100a0[_0x67e3('0x24')]],'as':_0x5100a0['as'],'attributes':_0x5100a0['attributes'],'include':_0x5100a0[_0x67e3('0x21')]?_['map'](_0x5100a0[_0x67e3('0x21')],function(_0x13a2f0){return{'model':db[_0x13a2f0[_0x67e3('0x24')]],'as':_0x13a2f0['as'],'attributes':_0x13a2f0[_0x67e3('0x23')]};}):[]};}):[]};}):[]:[]})[_0x67e3('0x10')](function(_0x219ef0){logger['info'](_0x67e3('0x25'),_0xa19555);logger['debug'](_0x67e3('0x25'),_0xa19555,JSON[_0x67e3('0x15')](_0x219ef0));_0x470e75(_0x219ef0);})['catch'](function(_0x300aef){logger['error']('GetMailQueue',_0x300aef[_0x67e3('0x18')],_0xa19555);_0x38874a(_0x426a33['error'](0x1f4,_0x300aef[_0x67e3('0x18')]));});});};exports['ShowMailQueue']=function(_0x4647f8){var _0x27e997=this;return new Promise(function(_0xb0b812,_0x29804b){return db[_0x67e3('0x1b')][_0x67e3('0x26')]({'raw':_0x4647f8[_0x67e3('0x1d')]?_0x4647f8[_0x67e3('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4647f8[_0x67e3('0x1d')]?_0x4647f8['options'][_0x67e3('0x1f')]||null:null,'attributes':_0x4647f8['options']?_0x4647f8['options'][_0x67e3('0x23')]||null:null,'include':_0x4647f8[_0x67e3('0x1d')]?_0x4647f8['options']['include']?_[_0x67e3('0x22')](_0x4647f8[_0x67e3('0x1d')][_0x67e3('0x21')],function(_0x17bd14){return{'model':db[_0x17bd14[_0x67e3('0x24')]],'as':_0x17bd14['as'],'attributes':_0x17bd14[_0x67e3('0x23')],'include':_0x17bd14[_0x67e3('0x21')]?_['map'](_0x17bd14[_0x67e3('0x21')],function(_0x19d2f2){return{'model':db[_0x19d2f2['model']],'as':_0x19d2f2['as'],'attributes':_0x19d2f2[_0x67e3('0x23')],'include':_0x19d2f2[_0x67e3('0x21')]?_['map'](_0x19d2f2['include'],function(_0x5cd867){return{'model':db[_0x5cd867['model']],'as':_0x5cd867['as'],'attributes':_0x5cd867[_0x67e3('0x23')]};}):[]};}):[]};}):[]:[]})[_0x67e3('0x10')](function(_0x207ab1){logger[_0x67e3('0x11')](_0x67e3('0x27'),_0x4647f8);logger['debug']('ShowMailQueue',_0x4647f8,JSON[_0x67e3('0x15')](_0x207ab1));_0xb0b812(_0x207ab1);})['catch'](function(_0x2103b2){logger[_0x67e3('0x16')](_0x67e3('0x27'),_0x2103b2[_0x67e3('0x18')],_0x4647f8);_0x29804b(_0x27e997[_0x67e3('0x16')](0x1f4,_0x2103b2[_0x67e3('0x18')]));});});}; \ No newline at end of file +var _0xa4db=['error','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetMailQueue','message','ShowMailQueue','MailQueue','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x676a8e,_0x5af886){var _0xc9e634=function(_0x5e3297){while(--_0x5e3297){_0x676a8e['push'](_0x676a8e['shift']());}};_0xc9e634(++_0x5af886);}(_0xa4db,0x139));var _0xba4d=function(_0x39ee05,_0x4bd243){_0x39ee05=_0x39ee05-0x0;var _0x4c7ad7=_0xa4db[_0x39ee05];return _0x4c7ad7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xba4d('0x0'));var rs=require(_0xba4d('0x1'));var fs=require('fs');var Redis=require(_0xba4d('0x2'));var db=require(_0xba4d('0x3'))['db'];var utils=require(_0xba4d('0x4'));var logger=require(_0xba4d('0x5'))('rpc');var config=require(_0xba4d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xba4d('0x7')][_0xba4d('0x8')]({'port':0x232a});config[_0xba4d('0x9')]=_[_0xba4d('0xa')](config[_0xba4d('0x9')],{'host':_0xba4d('0xb'),'port':0x18eb});var socket=require(_0xba4d('0xc'))(new Redis(config[_0xba4d('0x9')]));require(_0xba4d('0xd'))['register'](socket);function respondWithRpcPromise(_0x3a7804,_0x1675a8,_0x1ff504){return new BPromise(function(_0x36dbbd,_0x32d281){return client[_0xba4d('0xe')](_0x3a7804,_0x1ff504)[_0xba4d('0xf')](function(_0x32c429){logger[_0xba4d('0x10')](_0xba4d('0x11'),_0x1675a8,_0xba4d('0x12'));logger[_0xba4d('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x1675a8,'request\x20sent',JSON['stringify'](_0x32c429));if(_0x32c429[_0xba4d('0x14')]){if(_0x32c429['error']['code']===0x1f4){logger[_0xba4d('0x14')](_0xba4d('0x11'),_0x1675a8,_0x32c429[_0xba4d('0x14')]['message']);return _0x32d281(_0x32c429['error']['message']);}logger[_0xba4d('0x14')](_0xba4d('0x11'),_0x1675a8,_0x32c429[_0xba4d('0x14')]['message']);return _0x36dbbd(_0x32c429['error']['message']);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x1675a8,'request\x20sent');_0x36dbbd(_0x32c429[_0xba4d('0x15')]['message']);}})[_0xba4d('0x16')](function(_0x4deeaf){logger['error']('MailQueue,\x20%s,\x20%s',_0x1675a8,_0x4deeaf);_0x32d281(_0x4deeaf);});});}exports['GetMailQueue']=function(_0x555884){var _0x13c1f2=this;return new Promise(function(_0x2a2806,_0x4ea891){return db['MailQueue'][_0xba4d('0x17')]({'raw':_0x555884['options']?_0x555884[_0xba4d('0x18')][_0xba4d('0x19')]===undefined?!![]:![]:!![],'where':_0x555884[_0xba4d('0x18')]?_0x555884[_0xba4d('0x18')][_0xba4d('0x1a')]||null:null,'attributes':_0x555884[_0xba4d('0x18')]?_0x555884[_0xba4d('0x18')][_0xba4d('0x1b')]||null:null,'limit':_0x555884[_0xba4d('0x18')]?_0x555884[_0xba4d('0x18')][_0xba4d('0x1c')]||null:null,'include':_0x555884['options']?_0x555884[_0xba4d('0x18')][_0xba4d('0x1d')]?_[_0xba4d('0x1e')](_0x555884[_0xba4d('0x18')][_0xba4d('0x1d')],function(_0x49e2f6){return{'model':db[_0x49e2f6['model']],'as':_0x49e2f6['as'],'attributes':_0x49e2f6['attributes'],'include':_0x49e2f6[_0xba4d('0x1d')]?_[_0xba4d('0x1e')](_0x49e2f6[_0xba4d('0x1d')],function(_0x49ca17){return{'model':db[_0x49ca17[_0xba4d('0x1f')]],'as':_0x49ca17['as'],'attributes':_0x49ca17[_0xba4d('0x1b')],'include':_0x49ca17['include']?_['map'](_0x49ca17[_0xba4d('0x1d')],function(_0x1d1c51){return{'model':db[_0x1d1c51['model']],'as':_0x1d1c51['as'],'attributes':_0x1d1c51[_0xba4d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xba4d('0xf')](function(_0x334b98){logger[_0xba4d('0x10')]('GetMailQueue',_0x555884);logger[_0xba4d('0x13')](_0xba4d('0x20'),_0x555884,JSON['stringify'](_0x334b98));_0x2a2806(_0x334b98);})[_0xba4d('0x16')](function(_0x3f9b41){logger[_0xba4d('0x14')](_0xba4d('0x20'),_0x3f9b41[_0xba4d('0x21')],_0x555884);_0x4ea891(_0x13c1f2['error'](0x1f4,_0x3f9b41['message']));});});};exports[_0xba4d('0x22')]=function(_0x3e3b7){var _0x134c05=this;return new Promise(function(_0x5e0e24,_0x52aa8b){return db[_0xba4d('0x23')][_0xba4d('0x24')]({'raw':_0x3e3b7['options']?_0x3e3b7['options'][_0xba4d('0x19')]===undefined?!![]:![]:!![],'where':_0x3e3b7[_0xba4d('0x18')]?_0x3e3b7[_0xba4d('0x18')][_0xba4d('0x1a')]||null:null,'attributes':_0x3e3b7[_0xba4d('0x18')]?_0x3e3b7[_0xba4d('0x18')][_0xba4d('0x1b')]||null:null,'include':_0x3e3b7[_0xba4d('0x18')]?_0x3e3b7[_0xba4d('0x18')][_0xba4d('0x1d')]?_[_0xba4d('0x1e')](_0x3e3b7['options']['include'],function(_0x39d26b){return{'model':db[_0x39d26b[_0xba4d('0x1f')]],'as':_0x39d26b['as'],'attributes':_0x39d26b[_0xba4d('0x1b')],'include':_0x39d26b[_0xba4d('0x1d')]?_[_0xba4d('0x1e')](_0x39d26b['include'],function(_0x515acf){return{'model':db[_0x515acf[_0xba4d('0x1f')]],'as':_0x515acf['as'],'attributes':_0x515acf[_0xba4d('0x1b')],'include':_0x515acf['include']?_['map'](_0x515acf['include'],function(_0x1be3a9){return{'model':db[_0x1be3a9[_0xba4d('0x1f')]],'as':_0x1be3a9['as'],'attributes':_0x1be3a9[_0xba4d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xba4d('0xf')](function(_0x2c0cae){logger['info'](_0xba4d('0x22'),_0x3e3b7);logger[_0xba4d('0x13')](_0xba4d('0x22'),_0x3e3b7,JSON['stringify'](_0x2c0cae));_0x5e0e24(_0x2c0cae);})[_0xba4d('0x16')](function(_0x466035){logger[_0xba4d('0x14')](_0xba4d('0x22'),_0x466035[_0xba4d('0x21')],_0x3e3b7);_0x52aa8b(_0x134c05['error'](0x1f4,_0x466035[_0xba4d('0x21')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index b0b3529..4ae4eab 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 _0x7899=['./mailQueue.events','save','remove','update','emit','register','length','mailQueue:'];(function(_0x53072d,_0x518bfa){var _0x39e06f=function(_0x583c08){while(--_0x583c08){_0x53072d['push'](_0x53072d['shift']());}};_0x39e06f(++_0x518bfa);}(_0x7899,0x168));var _0x9789=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x7899[_0x310d10];return _0x1fb8af;};'use strict';var MailQueueEvents=require(_0x9789('0x0'));var events=[_0x9789('0x1'),_0x9789('0x2'),_0x9789('0x3')];function createListener(_0x3e7a16,_0x2072a7){return function(_0x15ea0d){_0x2072a7[_0x9789('0x4')](_0x3e7a16,_0x15ea0d);};}function removeListener(_0x4d1c31,_0x2763de){return function(){MailQueueEvents['removeListener'](_0x4d1c31,_0x2763de);};}exports[_0x9789('0x5')]=function(_0x41a7bb){for(var _0x1aa0be=0x0,_0x4c0e9b=events[_0x9789('0x6')];_0x1aa0be<_0x4c0e9b;_0x1aa0be++){var _0x49c9c2=events[_0x1aa0be];var _0xc1dc7b=createListener(_0x9789('0x7')+_0x49c9c2,_0x41a7bb);MailQueueEvents['on'](_0x49c9c2,_0xc1dc7b);}}; \ No newline at end of file +var _0xea30=['length','mailQueue:','update','removeListener','register'];(function(_0x4a875f,_0x4f9494){var _0x251184=function(_0x456e){while(--_0x456e){_0x4a875f['push'](_0x4a875f['shift']());}};_0x251184(++_0x4f9494);}(_0xea30,0x183));var _0x0ea3=function(_0x571f0b,_0x158637){_0x571f0b=_0x571f0b-0x0;var _0x428d92=_0xea30[_0x571f0b];return _0x428d92;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save','remove',_0x0ea3('0x0')];function createListener(_0x2f34d1,_0x59561b){return function(_0x40d103){_0x59561b['emit'](_0x2f34d1,_0x40d103);};}function removeListener(_0x47b961,_0xa06537){return function(){MailQueueEvents[_0x0ea3('0x1')](_0x47b961,_0xa06537);};}exports[_0x0ea3('0x2')]=function(_0x34bdd1){for(var _0x3b25f8=0x0,_0x114af0=events[_0x0ea3('0x3')];_0x3b25f8<_0x114af0;_0x3b25f8++){var _0x23e8c3=events[_0x3b25f8];var _0x1b412f=createListener(_0x0ea3('0x4')+_0x23e8c3,_0x34bdd1);MailQueueEvents['on'](_0x23e8c3,_0x1b412f);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 520b92c..97520fa 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 _0x9106=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','util'];(function(_0x5a2dfa,_0x2ae6df){var _0x5aeefb=function(_0x10ac12){while(--_0x10ac12){_0x5a2dfa['push'](_0x5a2dfa['shift']());}};_0x5aeefb(++_0x2ae6df);}(_0x9106,0xe3));var _0x6910=function(_0x2d1ff6,_0x182530){_0x2d1ff6=_0x2d1ff6-0x0;var _0x2f1298=_0x9106[_0x2d1ff6];return _0x2f1298;};'use strict';var multer=require('multer');var util=require(_0x6910('0x0'));var path=require(_0x6910('0x1'));var timeout=require(_0x6910('0x2'));var express=require(_0x6910('0x3'));var router=express[_0x6910('0x4')]();var fs_extra=require(_0x6910('0x5'));var auth=require(_0x6910('0x6'));var interaction=require(_0x6910('0x7'));var config=require(_0x6910('0x8'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x6910('0x9')](),controller[_0x6910('0xa')]);router['get'](_0x6910('0xb'),auth['isAuthenticated'](),controller[_0x6910('0xc')]);router['get'](_0x6910('0xd'),auth[_0x6910('0x9')](),controller[_0x6910('0xe')]);router[_0x6910('0xf')]('/',auth[_0x6910('0x9')](),controller[_0x6910('0x10')]);router[_0x6910('0x11')](_0x6910('0xd'),auth[_0x6910('0x9')](),controller['update']);router[_0x6910('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6e31=['exports','multer','util','path','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x44b12a,_0x5d09f4){var _0x30ca76=function(_0x4c05bc){while(--_0x4c05bc){_0x44b12a['push'](_0x44b12a['shift']());}};_0x30ca76(++_0x5d09f4);}(_0x6e31,0xa3));var _0x16e3=function(_0x560232,_0x3d3008){_0x560232=_0x560232-0x0;var _0x478ab6=_0x6e31[_0x560232];return _0x478ab6;};'use strict';var multer=require(_0x16e3('0x0'));var util=require(_0x16e3('0x1'));var path=require(_0x16e3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x16e3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x16e3('0x4'));var config=require('../../config/environment');var controller=require(_0x16e3('0x5'));router[_0x16e3('0x6')]('/',auth[_0x16e3('0x7')](),controller[_0x16e3('0x8')]);router[_0x16e3('0x6')]('/describe',auth[_0x16e3('0x7')](),controller[_0x16e3('0x9')]);router[_0x16e3('0x6')](_0x16e3('0xa'),auth[_0x16e3('0x7')](),controller[_0x16e3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x16e3('0xc')]);router[_0x16e3('0xd')](_0x16e3('0xa'),auth[_0x16e3('0x7')](),controller[_0x16e3('0xe')]);router[_0x16e3('0xf')]('/:id',auth[_0x16e3('0x7')](),controller[_0x16e3('0x10')]);module[_0x16e3('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 2052bd6..a41f7cb 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 _0xb806=['STRING','DATE','moment'];(function(_0x3969a3,_0x839c14){var _0x4c92a8=function(_0x2b9fd7){while(--_0x2b9fd7){_0x3969a3['push'](_0x3969a3['shift']());}};_0x4c92a8(++_0x839c14);}(_0xb806,0x95));var _0x6b80=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xb806[_0x2aecb2];return _0x3ebb80;};'use strict';var moment=require(_0x6b80('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6b80('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x6b80('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6b80('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd819=['moment','sequelize','exports','STRING','DATE'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xd819,0x1d1));var _0x9d81=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0xd819[_0x9b2bb0];return _0x2cdb3b;};'use strict';var moment=require(_0x9d81('0x0'));var Sequelize=require(_0x9d81('0x1'));module[_0x9d81('0x2')]={'uniqueid':{'type':Sequelize[_0x9d81('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9d81('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9d81('0x4')]},'exitAt':{'type':Sequelize[_0x9d81('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0615ada..c831662 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 _0x8ace=['keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','include','rows','params','rawAttributes','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','stack','name','send','map','MailQueueReport','type','query'];(function(_0x33ffdb,_0x4b2f02){var _0x1c0079=function(_0x95be9c){while(--_0x95be9c){_0x33ffdb['push'](_0x33ffdb['shift']());}};_0x1c0079(++_0x4b2f02);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x5cc71f,_0x4f6f52){_0x5cc71f=_0x5cc71f-0x0;var _0x4e1b52=_0x8ace[_0x5cc71f];return _0x4e1b52;};'use strict';var emlformat=require(_0xe8ac('0x0'));var rimraf=require(_0xe8ac('0x1'));var zipdir=require(_0xe8ac('0x2'));var jsonpatch=require(_0xe8ac('0x3'));var rp=require(_0xe8ac('0x4'));var moment=require(_0xe8ac('0x5'));var BPromise=require(_0xe8ac('0x6'));var Mustache=require(_0xe8ac('0x7'));var util=require(_0xe8ac('0x8'));var path=require(_0xe8ac('0x9'));var sox=require(_0xe8ac('0xa'));var csv=require(_0xe8ac('0xb'));var ejs=require(_0xe8ac('0xc'));var fs=require('fs');var fs_extra=require(_0xe8ac('0xd'));var _=require('lodash');var squel=require(_0xe8ac('0xe'));var crypto=require(_0xe8ac('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe8ac('0xb'));var querystring=require('querystring');var Papa=require(_0xe8ac('0x10'));var Redis=require(_0xe8ac('0x11'));var authService=require(_0xe8ac('0x12'));var qs=require(_0xe8ac('0x13'));var as=require(_0xe8ac('0x14'));var hardwareService=require(_0xe8ac('0x15'));var logger=require('../../config/logger')(_0xe8ac('0x16'));var utils=require(_0xe8ac('0x17'));var config=require(_0xe8ac('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe8ac('0x19'))['db'];function respondWithStatusCode(_0x4735cb,_0x4cc3b1){_0x4cc3b1=_0x4cc3b1||0xcc;return function(_0x183b7d){if(_0x183b7d){return _0x4735cb[_0xe8ac('0x1a')](_0x4cc3b1);}return _0x4735cb[_0xe8ac('0x1b')](_0x4cc3b1)[_0xe8ac('0x1c')]();};}function respondWithResult(_0x268f61,_0x317078){_0x317078=_0x317078||0xc8;return function(_0x1be138){if(_0x1be138){return _0x268f61[_0xe8ac('0x1b')](_0x317078)[_0xe8ac('0x1d')](_0x1be138);}};}function respondWithFilteredResult(_0x369d36,_0x5e4495){return function(_0x224bda){if(_0x224bda){var _0x18ddb3=typeof _0x5e4495['offset']===_0xe8ac('0x1e')&&typeof _0x5e4495[_0xe8ac('0x1f')]===_0xe8ac('0x1e');var _0xe1c52e=_0x224bda[_0xe8ac('0x20')];var _0x36759c=_0x18ddb3?0x0:_0x5e4495['offset'];var _0x59df3d=_0x18ddb3?_0x224bda['count']:_0x5e4495[_0xe8ac('0x21')]+_0x5e4495[_0xe8ac('0x1f')];var _0x4e5d00;if(_0x59df3d>=_0xe1c52e){_0x59df3d=_0xe1c52e;_0x4e5d00=0xc8;}else{_0x4e5d00=0xce;}_0x369d36[_0xe8ac('0x1b')](_0x4e5d00);return _0x369d36['set'](_0xe8ac('0x22'),_0x36759c+'-'+_0x59df3d+'/'+_0xe1c52e)[_0xe8ac('0x1d')](_0x224bda);}return null;};}function patchUpdates(_0x47e63e){return function(_0x6258f8){try{jsonpatch[_0xe8ac('0x23')](_0x6258f8,_0x47e63e,!![]);}catch(_0x13aa7c){return BPromise[_0xe8ac('0x24')](_0x13aa7c);}return _0x6258f8['save']();};}function saveUpdates(_0x6a7dbd,_0x59a9ea){return function(_0x1eb5f1){if(_0x1eb5f1){return _0x1eb5f1[_0xe8ac('0x25')](_0x6a7dbd)[_0xe8ac('0x26')](function(_0x252440){return _0x252440;});}return null;};}function removeEntity(_0x36108c,_0x31956a){return function(_0x38565d){if(_0x38565d){return _0x38565d['destroy']()[_0xe8ac('0x26')](function(){_0x36108c[_0xe8ac('0x1b')](0xcc)[_0xe8ac('0x1c')]();});}};}function handleEntityNotFound(_0x7c3450,_0x340ae0){return function(_0x3a92e1){if(!_0x3a92e1){_0x7c3450[_0xe8ac('0x1a')](0x194);}return _0x3a92e1;};}function handleError(_0x3e3fc2,_0x44b07c){_0x44b07c=_0x44b07c||0x1f4;return function(_0x562e44){logger['error'](_0x562e44[_0xe8ac('0x27')]);if(_0x562e44[_0xe8ac('0x28')]){delete _0x562e44['name'];}_0x3e3fc2[_0xe8ac('0x1b')](_0x44b07c)[_0xe8ac('0x29')](_0x562e44);};}exports['index']=function(_0x4c1d08,_0x1f1e44){var _0x41294e={},_0x3798c5={},_0x5d7562={'count':0x0,'rows':[]};var _0x156550=_[_0xe8ac('0x2a')](db[_0xe8ac('0x2b')]['rawAttributes'],function(_0xc1947d){return{'name':_0xc1947d['fieldName'],'type':_0xc1947d[_0xe8ac('0x2c')]['key']};});_0x3798c5['model']=_['map'](_0x156550,'name');_0x3798c5[_0xe8ac('0x2d')]=_[_0xe8ac('0x2e')](_0x4c1d08[_0xe8ac('0x2d')]);_0x3798c5[_0xe8ac('0x2f')]=_[_0xe8ac('0x30')](_0x3798c5[_0xe8ac('0x31')],_0x3798c5[_0xe8ac('0x2d')]);_0x41294e['attributes']=_[_0xe8ac('0x30')](_0x3798c5['model'],qs['fields'](_0x4c1d08['query'][_0xe8ac('0x32')]));_0x41294e[_0xe8ac('0x33')]=_0x41294e[_0xe8ac('0x33')]['length']?_0x41294e['attributes']:_0x3798c5[_0xe8ac('0x31')];if(!_0x4c1d08[_0xe8ac('0x2d')][_0xe8ac('0x34')](_0xe8ac('0x35'))){_0x41294e['limit']=qs[_0xe8ac('0x1f')](_0x4c1d08[_0xe8ac('0x2d')][_0xe8ac('0x1f')]);_0x41294e[_0xe8ac('0x21')]=qs[_0xe8ac('0x21')](_0x4c1d08[_0xe8ac('0x2d')][_0xe8ac('0x21')]);}_0x41294e['order']=qs[_0xe8ac('0x36')](_0x4c1d08[_0xe8ac('0x2d')]['sort']);_0x41294e[_0xe8ac('0x37')]=qs[_0xe8ac('0x2f')](_[_0xe8ac('0x38')](_0x4c1d08[_0xe8ac('0x2d')],_0x3798c5['filters']),_0x156550);if(_0x4c1d08[_0xe8ac('0x2d')]['filter']){_0x41294e['where']=_[_0xe8ac('0x39')](_0x41294e[_0xe8ac('0x37')],{'$or':_[_0xe8ac('0x2a')](_0x156550,function(_0x7f3445){if(_0x7f3445[_0xe8ac('0x2c')]!==_0xe8ac('0x3a')){var _0x78f1ea={};_0x78f1ea[_0x7f3445[_0xe8ac('0x28')]]={'$like':'%'+_0x4c1d08[_0xe8ac('0x2d')]['filter']+'%'};return _0x78f1ea;}})});}_0x41294e=_['merge']({},_0x41294e,_0x4c1d08[_0xe8ac('0x3b')]);var _0x10a9e8={'where':_0x41294e['where']};return db['MailQueueReport']['count'](_0x10a9e8)[_0xe8ac('0x26')](function(_0x46f291){_0x5d7562[_0xe8ac('0x20')]=_0x46f291;if(_0x4c1d08[_0xe8ac('0x2d')]['includeAll']){_0x41294e[_0xe8ac('0x3c')]=[{'all':!![]}];}return db[_0xe8ac('0x2b')]['findAll'](_0x41294e);})[_0xe8ac('0x26')](function(_0x41bbc2){_0x5d7562[_0xe8ac('0x3d')]=_0x41bbc2;return _0x5d7562;})[_0xe8ac('0x26')](respondWithFilteredResult(_0x1f1e44,_0x41294e))['catch'](handleError(_0x1f1e44,null));};exports['show']=function(_0x4e0f3d,_0x3710f4){var _0x2c2f18={'raw':!![],'where':{'id':_0x4e0f3d[_0xe8ac('0x3e')]['id']}},_0x28a913={};_0x28a913['model']=_['keys'](db[_0xe8ac('0x2b')][_0xe8ac('0x3f')]);_0x28a913[_0xe8ac('0x2d')]=_[_0xe8ac('0x2e')](_0x4e0f3d[_0xe8ac('0x2d')]);_0x28a913[_0xe8ac('0x2f')]=_[_0xe8ac('0x30')](_0x28a913[_0xe8ac('0x31')],_0x28a913[_0xe8ac('0x2d')]);_0x2c2f18[_0xe8ac('0x33')]=_[_0xe8ac('0x30')](_0x28a913[_0xe8ac('0x31')],qs[_0xe8ac('0x32')](_0x4e0f3d[_0xe8ac('0x2d')]['fields']));_0x2c2f18[_0xe8ac('0x33')]=_0x2c2f18['attributes']['length']?_0x2c2f18['attributes']:_0x28a913['model'];if(_0x4e0f3d[_0xe8ac('0x2d')]['includeAll']){_0x2c2f18[_0xe8ac('0x3c')]=[{'all':!![]}];}_0x2c2f18=_['merge']({},_0x2c2f18,_0x4e0f3d[_0xe8ac('0x3b')]);return db[_0xe8ac('0x2b')]['find'](_0x2c2f18)[_0xe8ac('0x26')](handleEntityNotFound(_0x3710f4,null))['then'](respondWithResult(_0x3710f4,null))[_0xe8ac('0x40')](handleError(_0x3710f4,null));};exports[_0xe8ac('0x41')]=function(_0x386aca,_0x5346d8){return db[_0xe8ac('0x2b')][_0xe8ac('0x41')](_0x386aca[_0xe8ac('0x42')],{})['then'](respondWithResult(_0x5346d8,0xc9))[_0xe8ac('0x40')](handleError(_0x5346d8,null));};exports[_0xe8ac('0x25')]=function(_0x2ed574,_0x478a0c){if(_0x2ed574[_0xe8ac('0x42')]['id']){delete _0x2ed574['body']['id'];}return db[_0xe8ac('0x2b')][_0xe8ac('0x43')]({'where':{'id':_0x2ed574[_0xe8ac('0x3e')]['id']}})['then'](handleEntityNotFound(_0x478a0c,null))[_0xe8ac('0x26')](saveUpdates(_0x2ed574[_0xe8ac('0x42')],null))[_0xe8ac('0x26')](respondWithResult(_0x478a0c,null))[_0xe8ac('0x40')](handleError(_0x478a0c,null));};exports[_0xe8ac('0x44')]=function(_0x406eb0,_0x1e7eb5){return db[_0xe8ac('0x2b')][_0xe8ac('0x43')]({'where':{'id':_0x406eb0[_0xe8ac('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1e7eb5,null))[_0xe8ac('0x26')](removeEntity(_0x1e7eb5,null))[_0xe8ac('0x40')](handleError(_0x1e7eb5,null));};exports[_0xe8ac('0x45')]=function(_0x5daa4a,_0xce6848){return db[_0xe8ac('0x2b')][_0xe8ac('0x45')]()[_0xe8ac('0x26')](respondWithResult(_0xce6848,null))[_0xe8ac('0x40')](handleError(_0xce6848,null));}; \ No newline at end of file +var _0xdb28=['index','MailQueueReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send'];(function(_0xccdde3,_0x4786bb){var _0x3e3a29=function(_0x4e9bc2){while(--_0x4e9bc2){_0xccdde3['push'](_0xccdde3['shift']());}};_0x3e3a29(++_0x4786bb);}(_0xdb28,0x106));var _0x8db2=function(_0x20f83d,_0xaf6aeb){_0x20f83d=_0x20f83d-0x0;var _0x33e65f=_0xdb28[_0x20f83d];return _0x33e65f;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));};exports[_0x8db2('0x4b')]=function(_0x426ae0,_0x3bc632){return db[_0x8db2('0x2b')][_0x8db2('0x4b')]()[_0x8db2('0x24')](respondWithResult(_0x3bc632,null))[_0x8db2('0x42')](handleError(_0x3bc632,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f3cdc60..d00f7cd 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 _0x39b5=['uniqueid','../../config/logger','moment','bluebird','rimraf','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue'];(function(_0x592cbc,_0x5ec030){var _0x39b8d9=function(_0x39055c){while(--_0x39055c){_0x592cbc['push'](_0x592cbc['shift']());}};_0x39b8d9(++_0x5ec030);}(_0x39b5,0x1ba));var _0x539b=function(_0x5268b0,_0x9173bb){_0x5268b0=_0x5268b0-0x0;var _0x5f1337=_0x39b5[_0x5268b0];return _0x5f1337;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x539b('0x0'))('api');var moment=require(_0x539b('0x1'));var BPromise=require(_0x539b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x539b('0x3'));var config=require('../../config/environment');var attributes=require(_0x539b('0x4'));module['exports']=function(_0x3e2164,_0x11a8e8){return _0x3e2164[_0x539b('0x5')](_0x539b('0x6'),attributes,{'tableName':_0x539b('0x7'),'paranoid':![],'indexes':[{'name':_0x539b('0x8'),'fields':[_0x539b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4496=['util','../../config/logger','api','moment','request-promise','../../config/environment','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x4496,0x1c1));var _0x6449=function(_0x3bf80c,_0x39e7a8){_0x3bf80c=_0x3bf80c-0x0;var _0x295889=_0x4496[_0x3bf80c];return _0x295889;};'use strict';var _=require(_0x6449('0x0'));var util=require(_0x6449('0x1'));var logger=require(_0x6449('0x2'))(_0x6449('0x3'));var moment=require(_0x6449('0x4'));var BPromise=require('bluebird');var rp=require(_0x6449('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6449('0x6'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x2e7c14,_0x20442a){return _0x2e7c14['define'](_0x6449('0x7'),attributes,{'tableName':_0x6449('0x8'),'paranoid':![],'indexes':[{'name':_0x6449('0x9'),'fields':[_0x6449('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 c90bd6f..0146d5a 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x18b851,_0x998026){var _0x322d83=function(_0x3023f3){while(--_0x3023f3){_0x18b851['push'](_0x18b851['shift']());}};_0x322d83(++_0x998026);}(_0x7a54,0x106));var _0x47a5=function(_0x449e46,_0x2ff896){_0x449e46=_0x449e46-0x0;var _0x120290=_0x7a54[_0x449e46];return _0x120290;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x510fdb,_0x11f0c7){var _0x558ee8=function(_0x5848da){while(--_0x5848da){_0x510fdb['push'](_0x510fdb['shift']());}};_0x558ee8(++_0x11f0c7);}(_0x326f,0xd1));var _0xf326=function(_0x1f7687,_0x240d54){_0x1f7687=_0x1f7687-0x0;var _0x407660=_0x326f[_0x1f7687];return _0x407660;};'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')]('MailQueueReport,\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')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 564a9f2..78c6400 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x48eda8,_0x25d217){var _0xcfdf71=function(_0x3ff60b){while(--_0x3ff60b){_0x48eda8['push'](_0x48eda8['shift']());}};_0xcfdf71(++_0x25d217);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x32b649,_0x53f984){var _0x3c20e8=function(_0x4ab234){while(--_0x4ab234){_0x32b649['push'](_0x32b649['shift']());}};_0x3c20e8(++_0x53f984);}(_0xe706,0xa3));var _0x6e70=function(_0x1aeb39,_0x2e8404){_0x1aeb39=_0x1aeb39-0x0;var _0x439790=_0xe706[_0x1aeb39];return _0x439790;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 39ae108..0995b57 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 _0xe1f5=['sequelize','exports','STRING','INTEGER','BOOLEAN','INBOX'];(function(_0x17a12d,_0x4263ee){var _0x29290b=function(_0x1c0bbf){while(--_0x1c0bbf){_0x17a12d['push'](_0x17a12d['shift']());}};_0x29290b(++_0x4263ee);}(_0xe1f5,0x1ec));var _0x5e1f=function(_0x571d35,_0x507926){_0x571d35=_0x571d35-0x0;var _0x1dea6f=_0xe1f5[_0x571d35];return _0x1dea6f;};'use strict';var Sequelize=require(_0x5e1f('0x0'));module[_0x5e1f('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5e1f('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x5e1f('0x2')]},'password':{'type':Sequelize[_0x5e1f('0x2')]},'port':{'type':Sequelize[_0x5e1f('0x3')]},'tls':{'type':Sequelize[_0x5e1f('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x5e1f('0x5')},'connTimeout':{'type':Sequelize[_0x5e1f('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5e1f('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x5e1f('0x2')]},'modernAuthentication':{'type':Sequelize[_0x5e1f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xf31a=['STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x175fc7,_0x545448){var _0x39335c=function(_0x2c412e){while(--_0x2c412e){_0x175fc7['push'](_0x175fc7['shift']());}};_0x39335c(++_0x545448);}(_0xf31a,0x170));var _0xaf31=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf31a[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xaf31('0x0')]},'host':{'type':Sequelize[_0xaf31('0x0')]},'authentication':{'type':Sequelize[_0xaf31('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xaf31('0x0')]},'password':{'type':Sequelize[_0xaf31('0x0')]},'port':{'type':Sequelize[_0xaf31('0x2')]},'tls':{'type':Sequelize[_0xaf31('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xaf31('0x0')],'defaultValue':_0xaf31('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xaf31('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xaf31('0x0')]},'modernAuthentication':{'type':Sequelize[_0xaf31('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 794010f..1cc2a7f 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 _0x4a06=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4bb4d3,_0x3c7700){var _0x2c47ed=function(_0x18740e){while(--_0x18740e){_0x4bb4d3['push'](_0x4bb4d3['shift']());}};_0x2c47ed(++_0x3c7700);}(_0x4a06,0xa4));var _0x64a0=function(_0x3045c9,_0x2c9ac5){_0x3045c9=_0x3045c9-0x0;var _0x57a307=_0x4a06[_0x3045c9];return _0x57a307;};'use strict';var _=require(_0x64a0('0x0'));var util=require('util');var logger=require(_0x64a0('0x1'))(_0x64a0('0x2'));var moment=require(_0x64a0('0x3'));var BPromise=require(_0x64a0('0x4'));var rp=require(_0x64a0('0x5'));var fs=require('fs');var path=require(_0x64a0('0x6'));var rimraf=require(_0x64a0('0x7'));var config=require(_0x64a0('0x8'));var attributes=require(_0x64a0('0x9'));module[_0x64a0('0xa')]=function(_0xdf3a58,_0x25e75d){return _0xdf3a58[_0x64a0('0xb')]('MailServerIn',attributes,{'tableName':_0x64a0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x060d=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x318841,_0x4992c5){var _0x399a00=function(_0xbf4b61){while(--_0xbf4b61){_0x318841['push'](_0x318841['shift']());}};_0x399a00(++_0x4992c5);}(_0x060d,0xd7));var _0xd060=function(_0x5d79df,_0x58f013){_0x5d79df=_0x5d79df-0x0;var _0x54d3e8=_0x060d[_0x5d79df];return _0x54d3e8;};'use strict';var _=require(_0xd060('0x0'));var util=require('util');var logger=require(_0xd060('0x1'))('api');var moment=require(_0xd060('0x2'));var BPromise=require(_0xd060('0x3'));var rp=require(_0xd060('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd060('0x5'));var config=require(_0xd060('0x6'));var attributes=require(_0xd060('0x7'));module[_0xd060('0x8')]=function(_0xf9c63d,_0xf8a718){return _0xf9c63d[_0xd060('0x9')](_0xd060('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index bea2931..5e38208 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 _0x354c=['request\x20sent','debug','stringify','error','MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x354c,0x1e4));var _0xc354=function(_0x515475,_0x579748){_0x515475=_0x515475-0x0;var _0x2b4abc=_0x354c[_0x515475];return _0x2b4abc;};'use strict';var _=require(_0xc354('0x0'));var util=require(_0xc354('0x1'));var moment=require(_0xc354('0x2'));var BPromise=require(_0xc354('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc354('0x4'));var db=require(_0xc354('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc354('0x6'))(_0xc354('0x7'));var config=require(_0xc354('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc354('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x140fa1,_0x53759b,_0x1f6d98){return new BPromise(function(_0x56dfe0,_0x110b52){return client[_0xc354('0xa')](_0x140fa1,_0x1f6d98)['then'](function(_0x585bbd){logger[_0xc354('0xb')]('MailServerIn,\x20%s,\x20%s',_0x53759b,_0xc354('0xc'));logger[_0xc354('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x53759b,_0xc354('0xc'),JSON[_0xc354('0xe')](_0x585bbd));if(_0x585bbd['error']){if(_0x585bbd[_0xc354('0xf')]['code']===0x1f4){logger[_0xc354('0xf')](_0xc354('0x10'),_0x53759b,_0x585bbd['error']['message']);return _0x110b52(_0x585bbd[_0xc354('0xf')][_0xc354('0x11')]);}logger[_0xc354('0xf')]('MailServerIn,\x20%s,\x20%s',_0x53759b,_0x585bbd[_0xc354('0xf')]['message']);return _0x56dfe0(_0x585bbd[_0xc354('0xf')][_0xc354('0x11')]);}else{logger[_0xc354('0xb')](_0xc354('0x10'),_0x53759b,_0xc354('0xc'));_0x56dfe0(_0x585bbd['result'][_0xc354('0x11')]);}})[_0xc354('0x12')](function(_0x313f36){logger['error']('MailServerIn,\x20%s,\x20%s',_0x53759b,_0x313f36);_0x110b52(_0x313f36);});});}exports[_0xc354('0x13')]=function(_0x44f962){var _0x162a72=this;return new Promise(function(_0x1bc99e,_0x522d4c){return db[_0xc354('0x14')][_0xc354('0x15')]({'raw':_0x44f962[_0xc354('0x16')]?_0x44f962[_0xc354('0x16')][_0xc354('0x17')]===undefined?!![]:![]:!![],'where':_0x44f962[_0xc354('0x16')]?_0x44f962['options'][_0xc354('0x18')]||null:null,'attributes':_0x44f962[_0xc354('0x16')]?_0x44f962[_0xc354('0x16')][_0xc354('0x19')]||null:null,'limit':_0x44f962['options']?_0x44f962[_0xc354('0x16')][_0xc354('0x1a')]||null:null,'include':_0x44f962[_0xc354('0x16')]?_0x44f962['options'][_0xc354('0x1b')]?_[_0xc354('0x1c')](_0x44f962['options']['include'],function(_0x11f2bf){return{'model':db[_0x11f2bf[_0xc354('0x1d')]],'as':_0x11f2bf['as'],'attributes':_0x11f2bf[_0xc354('0x19')],'include':_0x11f2bf[_0xc354('0x1b')]?_[_0xc354('0x1c')](_0x11f2bf['include'],function(_0x1bafa5){return{'model':db[_0x1bafa5[_0xc354('0x1d')]],'as':_0x1bafa5['as'],'attributes':_0x1bafa5['attributes'],'include':_0x1bafa5[_0xc354('0x1b')]?_['map'](_0x1bafa5['include'],function(_0x5e1657){return{'model':db[_0x5e1657['model']],'as':_0x5e1657['as'],'attributes':_0x5e1657[_0xc354('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc354('0x1e')](function(_0x2dd22b){logger[_0xc354('0xb')]('GetMailServerIn',_0x44f962);logger[_0xc354('0xd')](_0xc354('0x13'),_0x44f962,JSON['stringify'](_0x2dd22b));_0x1bc99e(_0x2dd22b);})['catch'](function(_0x20cdd2){logger[_0xc354('0xf')](_0xc354('0x13'),_0x20cdd2[_0xc354('0x11')],_0x44f962);_0x522d4c(_0x162a72['error'](0x1f4,_0x20cdd2[_0xc354('0x11')]));});});}; \ No newline at end of file +var _0xc9be=['rpc','../../config/environment','jayson/promise','client','then','info','debug','request\x20sent','stringify','error','code','message','result','catch','MailServerIn,\x20%s,\x20%s','findAll','options','attributes','limit','map','include','model','GetMailServerIn','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5afc8d,_0x5a4001){var _0x10a6ea=function(_0xcf0250){while(--_0xcf0250){_0x5afc8d['push'](_0x5afc8d['shift']());}};_0x10a6ea(++_0x5a4001);}(_0xc9be,0x1aa));var _0xec9b=function(_0x4caf71,_0x230605){_0x4caf71=_0x4caf71-0x0;var _0x42d5c8=_0xc9be[_0x4caf71];return _0x42d5c8;};'use strict';var _=require(_0xec9b('0x0'));var util=require(_0xec9b('0x1'));var moment=require(_0xec9b('0x2'));var BPromise=require(_0xec9b('0x3'));var rs=require(_0xec9b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec9b('0x5'))['db'];var utils=require(_0xec9b('0x6'));var logger=require(_0xec9b('0x7'))(_0xec9b('0x8'));var config=require(_0xec9b('0x9'));var jayson=require(_0xec9b('0xa'));var client=jayson[_0xec9b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d4a65,_0x47510d,_0x543d32){return new BPromise(function(_0x2961c5,_0x23cdb6){return client['request'](_0x1d4a65,_0x543d32)[_0xec9b('0xc')](function(_0x443e5c){logger[_0xec9b('0xd')]('MailServerIn,\x20%s,\x20%s',_0x47510d,'request\x20sent');logger[_0xec9b('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x47510d,_0xec9b('0xf'),JSON[_0xec9b('0x10')](_0x443e5c));if(_0x443e5c[_0xec9b('0x11')]){if(_0x443e5c[_0xec9b('0x11')][_0xec9b('0x12')]===0x1f4){logger[_0xec9b('0x11')]('MailServerIn,\x20%s,\x20%s',_0x47510d,_0x443e5c[_0xec9b('0x11')][_0xec9b('0x13')]);return _0x23cdb6(_0x443e5c[_0xec9b('0x11')][_0xec9b('0x13')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x47510d,_0x443e5c['error'][_0xec9b('0x13')]);return _0x2961c5(_0x443e5c[_0xec9b('0x11')][_0xec9b('0x13')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x47510d,_0xec9b('0xf'));_0x2961c5(_0x443e5c[_0xec9b('0x14')][_0xec9b('0x13')]);}})[_0xec9b('0x15')](function(_0x221dce){logger[_0xec9b('0x11')](_0xec9b('0x16'),_0x47510d,_0x221dce);_0x23cdb6(_0x221dce);});});}exports['GetMailServerIn']=function(_0x39498a){var _0xb230c8=this;return new Promise(function(_0x535487,_0x18ba9c){return db['MailServerIn'][_0xec9b('0x17')]({'raw':_0x39498a[_0xec9b('0x18')]?_0x39498a['options']['raw']===undefined?!![]:![]:!![],'where':_0x39498a['options']?_0x39498a['options']['where']||null:null,'attributes':_0x39498a['options']?_0x39498a[_0xec9b('0x18')][_0xec9b('0x19')]||null:null,'limit':_0x39498a[_0xec9b('0x18')]?_0x39498a[_0xec9b('0x18')][_0xec9b('0x1a')]||null:null,'include':_0x39498a[_0xec9b('0x18')]?_0x39498a[_0xec9b('0x18')]['include']?_[_0xec9b('0x1b')](_0x39498a['options'][_0xec9b('0x1c')],function(_0x2a9a3a){return{'model':db[_0x2a9a3a[_0xec9b('0x1d')]],'as':_0x2a9a3a['as'],'attributes':_0x2a9a3a[_0xec9b('0x19')],'include':_0x2a9a3a[_0xec9b('0x1c')]?_[_0xec9b('0x1b')](_0x2a9a3a[_0xec9b('0x1c')],function(_0x35d043){return{'model':db[_0x35d043[_0xec9b('0x1d')]],'as':_0x35d043['as'],'attributes':_0x35d043[_0xec9b('0x19')],'include':_0x35d043['include']?_[_0xec9b('0x1b')](_0x35d043['include'],function(_0x4735ce){return{'model':db[_0x4735ce[_0xec9b('0x1d')]],'as':_0x4735ce['as'],'attributes':_0x4735ce[_0xec9b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xec9b('0xc')](function(_0x1c3e5a){logger[_0xec9b('0xd')](_0xec9b('0x1e'),_0x39498a);logger[_0xec9b('0xe')](_0xec9b('0x1e'),_0x39498a,JSON[_0xec9b('0x10')](_0x1c3e5a));_0x535487(_0x1c3e5a);})[_0xec9b('0x15')](function(_0x59c85b){logger['error'](_0xec9b('0x1e'),_0x59c85b['message'],_0x39498a);_0x18ba9c(_0xb230c8[_0xec9b('0x11')](0x1f4,_0x59c85b[_0xec9b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 7342975..0452192 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(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7a54,0x106));var _0x47a5=function(_0x3cdf39,_0x5d49e6){_0x3cdf39=_0x3cdf39-0x0;var _0x1b3b08=_0x7a54[_0x3cdf39];return _0x1b3b08;};'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(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7a54,0x106));var _0x47a5=function(_0x4011a0,_0xb93392){_0x4011a0=_0x4011a0-0x0;var _0x251da3=_0x7a54[_0x4011a0];return _0x251da3;};'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 ee01d21..8b8f588 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 _0xbc9d=['sequelize','exports','STRING','BOOLEAN'];(function(_0x4dd0c0,_0x108477){var _0x4b6aeb=function(_0x120340){while(--_0x120340){_0x4dd0c0['push'](_0x4dd0c0['shift']());}};_0x4b6aeb(++_0x108477);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x57c4bb,_0x284386){_0x57c4bb=_0x57c4bb-0x0;var _0x2ca240=_0xbc9d[_0x57c4bb];return _0x2ca240;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'description':{'type':Sequelize[_0xdbc9('0x2')]},'host':{'type':Sequelize[_0xdbc9('0x2')]},'user':{'type':Sequelize[_0xdbc9('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xdbc9('0x2')]},'authentication':{'type':Sequelize[_0xdbc9('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xdbc9('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0fd9=['BOOLEAN','exports','STRING'];(function(_0x2bb447,_0x20009f){var _0x4b450f=function(_0x37c0d5){while(--_0x37c0d5){_0x2bb447['push'](_0x2bb447['shift']());}};_0x4b450f(++_0x20009f);}(_0x0fd9,0xa3));var _0x90fd=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0x0fd9[_0x3ff685];return _0x2046c9;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'description':{'type':Sequelize[_0x90fd('0x1')]},'host':{'type':Sequelize[_0x90fd('0x1')]},'user':{'type':Sequelize[_0x90fd('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x90fd('0x1')]},'authentication':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x90fd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index f1c46cf..653411e 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 _0xbf79=['eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','show','params','find','catch','create','body'];(function(_0x42f05a,_0x391615){var _0x310d6e=function(_0x92e8b7){while(--_0x92e8b7){_0x42f05a['push'](_0x42f05a['shift']());}};_0x310d6e(++_0x391615);}(_0xbf79,0x192));var _0x9bf7=function(_0x247873,_0x51d554){_0x247873=_0x247873-0x0;var _0x2d71f2=_0xbf79[_0x247873];return _0x2d71f2;};'use strict';var emlformat=require(_0x9bf7('0x0'));var rimraf=require(_0x9bf7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bf7('0x2'));var rp=require(_0x9bf7('0x3'));var moment=require('moment');var BPromise=require(_0x9bf7('0x4'));var Mustache=require(_0x9bf7('0x5'));var util=require('util');var path=require(_0x9bf7('0x6'));var sox=require(_0x9bf7('0x7'));var csv=require(_0x9bf7('0x8'));var ejs=require(_0x9bf7('0x9'));var fs=require('fs');var fs_extra=require(_0x9bf7('0xa'));var _=require(_0x9bf7('0xb'));var squel=require(_0x9bf7('0xc'));var crypto=require('crypto');var jsforce=require(_0x9bf7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9bf7('0x8'));var querystring=require(_0x9bf7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9bf7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9bf7('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x9bf7('0x11'));var licenseUtil=require(_0x9bf7('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7d7852,_0x242d53){_0x242d53=_0x242d53||0xcc;return function(_0x207a50){if(_0x207a50){return _0x7d7852[_0x9bf7('0x13')](_0x242d53);}return _0x7d7852[_0x9bf7('0x14')](_0x242d53)[_0x9bf7('0x15')]();};}function respondWithResult(_0x163f6e,_0x2fb0cb){_0x2fb0cb=_0x2fb0cb||0xc8;return function(_0x33583d){if(_0x33583d){return _0x163f6e[_0x9bf7('0x14')](_0x2fb0cb)[_0x9bf7('0x16')](_0x33583d);}};}function respondWithFilteredResult(_0x45c180,_0x2654b8){return function(_0x464aeb){if(_0x464aeb){var _0x1cdbe9=typeof _0x2654b8[_0x9bf7('0x17')]==='undefined'&&typeof _0x2654b8[_0x9bf7('0x18')]===_0x9bf7('0x19');var _0x1ad7bf=_0x464aeb[_0x9bf7('0x1a')];var _0x37666d=_0x1cdbe9?0x0:_0x2654b8['offset'];var _0x19aaf8=_0x1cdbe9?_0x464aeb[_0x9bf7('0x1a')]:_0x2654b8[_0x9bf7('0x17')]+_0x2654b8['limit'];var _0x248cbe;if(_0x19aaf8>=_0x1ad7bf){_0x19aaf8=_0x1ad7bf;_0x248cbe=0xc8;}else{_0x248cbe=0xce;}_0x45c180['status'](_0x248cbe);return _0x45c180[_0x9bf7('0x1b')]('Content-Range',_0x37666d+'-'+_0x19aaf8+'/'+_0x1ad7bf)['json'](_0x464aeb);}return null;};}function patchUpdates(_0x479c16){return function(_0x20764){try{jsonpatch['apply'](_0x20764,_0x479c16,!![]);}catch(_0x4dc00f){return BPromise[_0x9bf7('0x1c')](_0x4dc00f);}return _0x20764[_0x9bf7('0x1d')]();};}function saveUpdates(_0xbdb004,_0x184539){return function(_0x4a99e4){if(_0x4a99e4){return _0x4a99e4[_0x9bf7('0x1e')](_0xbdb004)[_0x9bf7('0x1f')](function(_0x3941ec){return _0x3941ec;});}return null;};}function removeEntity(_0x5a6bb7,_0x11c132){return function(_0x17fca0){if(_0x17fca0){return _0x17fca0[_0x9bf7('0x20')]()['then'](function(){_0x5a6bb7[_0x9bf7('0x14')](0xcc)[_0x9bf7('0x15')]();});}};}function handleEntityNotFound(_0x2da5b8,_0x3cc175){return function(_0x5ace4c){if(!_0x5ace4c){_0x2da5b8['sendStatus'](0x194);}return _0x5ace4c;};}function handleError(_0x1aaac3,_0x20286b){_0x20286b=_0x20286b||0x1f4;return function(_0x2eaca0){logger[_0x9bf7('0x21')](_0x2eaca0[_0x9bf7('0x22')]);if(_0x2eaca0[_0x9bf7('0x23')]){delete _0x2eaca0[_0x9bf7('0x23')];}_0x1aaac3[_0x9bf7('0x14')](_0x20286b)['send'](_0x2eaca0);};}exports[_0x9bf7('0x24')]=function(_0x214e9a,_0x1129ba){var _0x3ddd69={},_0x2be564={},_0x25cb87={'count':0x0,'rows':[]};var _0xc46ac2=_[_0x9bf7('0x25')](db[_0x9bf7('0x26')][_0x9bf7('0x27')],function(_0x192f81){return{'name':_0x192f81[_0x9bf7('0x28')],'type':_0x192f81[_0x9bf7('0x29')][_0x9bf7('0x2a')]};});_0x2be564['model']=_[_0x9bf7('0x25')](_0xc46ac2,_0x9bf7('0x23'));_0x2be564['query']=_[_0x9bf7('0x2b')](_0x214e9a[_0x9bf7('0x2c')]);_0x2be564[_0x9bf7('0x2d')]=_['intersection'](_0x2be564[_0x9bf7('0x2e')],_0x2be564['query']);_0x3ddd69[_0x9bf7('0x2f')]=_[_0x9bf7('0x30')](_0x2be564['model'],qs['fields'](_0x214e9a[_0x9bf7('0x2c')][_0x9bf7('0x31')]));_0x3ddd69[_0x9bf7('0x2f')]=_0x3ddd69[_0x9bf7('0x2f')][_0x9bf7('0x32')]?_0x3ddd69[_0x9bf7('0x2f')]:_0x2be564[_0x9bf7('0x2e')];if(!_0x214e9a[_0x9bf7('0x2c')]['hasOwnProperty']('nolimit')){_0x3ddd69[_0x9bf7('0x18')]=qs[_0x9bf7('0x18')](_0x214e9a[_0x9bf7('0x2c')][_0x9bf7('0x18')]);_0x3ddd69['offset']=qs[_0x9bf7('0x17')](_0x214e9a[_0x9bf7('0x2c')][_0x9bf7('0x17')]);}_0x3ddd69[_0x9bf7('0x33')]=qs['sort'](_0x214e9a[_0x9bf7('0x2c')][_0x9bf7('0x34')]);_0x3ddd69[_0x9bf7('0x35')]=qs[_0x9bf7('0x2d')](_[_0x9bf7('0x36')](_0x214e9a[_0x9bf7('0x2c')],_0x2be564[_0x9bf7('0x2d')]),_0xc46ac2);if(_0x214e9a[_0x9bf7('0x2c')]['filter']){_0x3ddd69[_0x9bf7('0x35')]=_['merge'](_0x3ddd69[_0x9bf7('0x35')],{'$or':_[_0x9bf7('0x25')](_0xc46ac2,function(_0x3d68fa){if(_0x3d68fa['type']!==_0x9bf7('0x37')){var _0x50786f={};_0x50786f[_0x3d68fa[_0x9bf7('0x23')]]={'$like':'%'+_0x214e9a[_0x9bf7('0x2c')][_0x9bf7('0x38')]+'%'};return _0x50786f;}})});}_0x3ddd69=_[_0x9bf7('0x39')]({},_0x3ddd69,_0x214e9a[_0x9bf7('0x3a')]);var _0x14f776={'where':_0x3ddd69[_0x9bf7('0x35')]};return db[_0x9bf7('0x26')][_0x9bf7('0x1a')](_0x14f776)['then'](function(_0x79210f){_0x25cb87['count']=_0x79210f;if(_0x214e9a[_0x9bf7('0x2c')][_0x9bf7('0x3b')]){_0x3ddd69[_0x9bf7('0x3c')]=[{'all':!![]}];}return db[_0x9bf7('0x26')]['findAll'](_0x3ddd69);})[_0x9bf7('0x1f')](function(_0x26c0a0){_0x25cb87['rows']=_0x26c0a0;return _0x25cb87;})[_0x9bf7('0x1f')](respondWithFilteredResult(_0x1129ba,_0x3ddd69))['catch'](handleError(_0x1129ba,null));};exports[_0x9bf7('0x3d')]=function(_0x5c1a81,_0x12220a){var _0xf9dda5={'raw':!![],'where':{'id':_0x5c1a81[_0x9bf7('0x3e')]['id']}},_0x193330={};_0x193330[_0x9bf7('0x2e')]=_['keys'](db['MailServerOut'][_0x9bf7('0x27')]);_0x193330[_0x9bf7('0x2c')]=_[_0x9bf7('0x2b')](_0x5c1a81[_0x9bf7('0x2c')]);_0x193330['filters']=_[_0x9bf7('0x30')](_0x193330[_0x9bf7('0x2e')],_0x193330[_0x9bf7('0x2c')]);_0xf9dda5[_0x9bf7('0x2f')]=_[_0x9bf7('0x30')](_0x193330[_0x9bf7('0x2e')],qs[_0x9bf7('0x31')](_0x5c1a81['query'][_0x9bf7('0x31')]));_0xf9dda5[_0x9bf7('0x2f')]=_0xf9dda5['attributes']['length']?_0xf9dda5['attributes']:_0x193330['model'];if(_0x5c1a81[_0x9bf7('0x2c')][_0x9bf7('0x3b')]){_0xf9dda5['include']=[{'all':!![]}];}_0xf9dda5=_[_0x9bf7('0x39')]({},_0xf9dda5,_0x5c1a81[_0x9bf7('0x3a')]);return db[_0x9bf7('0x26')][_0x9bf7('0x3f')](_0xf9dda5)[_0x9bf7('0x1f')](handleEntityNotFound(_0x12220a,null))['then'](respondWithResult(_0x12220a,null))[_0x9bf7('0x40')](handleError(_0x12220a,null));};exports[_0x9bf7('0x41')]=function(_0x8784a8,_0x1a9865){return db[_0x9bf7('0x26')][_0x9bf7('0x41')](_0x8784a8[_0x9bf7('0x42')],{})[_0x9bf7('0x1f')](respondWithResult(_0x1a9865,0xc9))[_0x9bf7('0x40')](handleError(_0x1a9865,null));};exports[_0x9bf7('0x1e')]=function(_0x140203,_0x25cd83){if(_0x140203['body']['id']){delete _0x140203[_0x9bf7('0x42')]['id'];}return db[_0x9bf7('0x26')][_0x9bf7('0x3f')]({'where':{'id':_0x140203[_0x9bf7('0x3e')]['id']}})[_0x9bf7('0x1f')](handleEntityNotFound(_0x25cd83,null))[_0x9bf7('0x1f')](saveUpdates(_0x140203['body'],null))[_0x9bf7('0x1f')](respondWithResult(_0x25cd83,null))['catch'](handleError(_0x25cd83,null));};exports['destroy']=function(_0x2aca20,_0x2aa6e9){return db[_0x9bf7('0x26')]['find']({'where':{'id':_0x2aca20[_0x9bf7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2aa6e9,null))[_0x9bf7('0x1f')](removeEntity(_0x2aa6e9,null))[_0x9bf7('0x40')](handleError(_0x2aa6e9,null));}; \ No newline at end of file +var _0xb350=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','error','stack','send','index','MailServerOut','rawAttributes','fieldName','type','key','map','name','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','merge','options','includeAll','findAll','catch','params','keys','create','body','find','zip-dir','request-promise','bluebird','mustache','path','sox'];(function(_0x4391a,_0x3668de){var _0x3d6ad2=function(_0x5888f0){while(--_0x5888f0){_0x4391a['push'](_0x4391a['shift']());}};_0x3d6ad2(++_0x3668de);}(_0xb350,0x1eb));var _0x0b35=function(_0xdc71d3,_0x23722c){_0xdc71d3=_0xdc71d3-0x0;var _0xd9cac8=_0xb350[_0xdc71d3];return _0xd9cac8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0b35('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b35('0x1'));var moment=require('moment');var BPromise=require(_0x0b35('0x2'));var Mustache=require(_0x0b35('0x3'));var util=require('util');var path=require(_0x0b35('0x4'));var sox=require(_0x0b35('0x5'));var csv=require(_0x0b35('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b35('0x7'));var _=require(_0x0b35('0x8'));var squel=require(_0x0b35('0x9'));var crypto=require(_0x0b35('0xa'));var jsforce=require(_0x0b35('0xb'));var deskjs=require(_0x0b35('0xc'));var toCsv=require(_0x0b35('0x6'));var querystring=require(_0x0b35('0xd'));var Papa=require(_0x0b35('0xe'));var Redis=require('ioredis');var authService=require(_0x0b35('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0b35('0x10'));var hardwareService=require(_0x0b35('0x11'));var logger=require(_0x0b35('0x12'))(_0x0b35('0x13'));var utils=require('../../config/utils');var config=require(_0x0b35('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b35('0x15'))['db'];function respondWithStatusCode(_0x5889bd,_0x2f9a25){_0x2f9a25=_0x2f9a25||0xcc;return function(_0x523cf3){if(_0x523cf3){return _0x5889bd[_0x0b35('0x16')](_0x2f9a25);}return _0x5889bd[_0x0b35('0x17')](_0x2f9a25)['end']();};}function respondWithResult(_0x26283f,_0x203bfe){_0x203bfe=_0x203bfe||0xc8;return function(_0x1cc76b){if(_0x1cc76b){return _0x26283f[_0x0b35('0x17')](_0x203bfe)[_0x0b35('0x18')](_0x1cc76b);}};}function respondWithFilteredResult(_0x936604,_0x17afa0){return function(_0x498615){if(_0x498615){var _0x595112=typeof _0x17afa0[_0x0b35('0x19')]===_0x0b35('0x1a')&&typeof _0x17afa0[_0x0b35('0x1b')]==='undefined';var _0x54ff49=_0x498615[_0x0b35('0x1c')];var _0x4ac288=_0x595112?0x0:_0x17afa0[_0x0b35('0x19')];var _0x12da24=_0x595112?_0x498615[_0x0b35('0x1c')]:_0x17afa0[_0x0b35('0x19')]+_0x17afa0['limit'];var _0xb8289;if(_0x12da24>=_0x54ff49){_0x12da24=_0x54ff49;_0xb8289=0xc8;}else{_0xb8289=0xce;}_0x936604[_0x0b35('0x17')](_0xb8289);return _0x936604[_0x0b35('0x1d')]('Content-Range',_0x4ac288+'-'+_0x12da24+'/'+_0x54ff49)[_0x0b35('0x18')](_0x498615);}return null;};}function patchUpdates(_0x768f67){return function(_0x1ee12b){try{jsonpatch[_0x0b35('0x1e')](_0x1ee12b,_0x768f67,!![]);}catch(_0x542c24){return BPromise[_0x0b35('0x1f')](_0x542c24);}return _0x1ee12b[_0x0b35('0x20')]();};}function saveUpdates(_0x5a20a7,_0x3e1d5d){return function(_0x15166a){if(_0x15166a){return _0x15166a['update'](_0x5a20a7)[_0x0b35('0x21')](function(_0x42ffde){return _0x42ffde;});}return null;};}function removeEntity(_0x16899c,_0x498158){return function(_0x16c4fe){if(_0x16c4fe){return _0x16c4fe[_0x0b35('0x22')]()['then'](function(){_0x16899c[_0x0b35('0x17')](0xcc)[_0x0b35('0x23')]();});}};}function handleEntityNotFound(_0x169e5c,_0x51c89d){return function(_0xa105e4){if(!_0xa105e4){_0x169e5c['sendStatus'](0x194);}return _0xa105e4;};}function handleError(_0x380600,_0x62551a){_0x62551a=_0x62551a||0x1f4;return function(_0x5ad9c1){logger[_0x0b35('0x24')](_0x5ad9c1[_0x0b35('0x25')]);if(_0x5ad9c1['name']){delete _0x5ad9c1['name'];}_0x380600['status'](_0x62551a)[_0x0b35('0x26')](_0x5ad9c1);};}exports[_0x0b35('0x27')]=function(_0x18ac4b,_0x32306d){var _0x5ed454={},_0x4b3d28={},_0x1ff24e={'count':0x0,'rows':[]};var _0x889b97=_['map'](db[_0x0b35('0x28')][_0x0b35('0x29')],function(_0x4815dc){return{'name':_0x4815dc[_0x0b35('0x2a')],'type':_0x4815dc[_0x0b35('0x2b')][_0x0b35('0x2c')]};});_0x4b3d28['model']=_[_0x0b35('0x2d')](_0x889b97,_0x0b35('0x2e'));_0x4b3d28[_0x0b35('0x2f')]=_['keys'](_0x18ac4b['query']);_0x4b3d28['filters']=_[_0x0b35('0x30')](_0x4b3d28[_0x0b35('0x31')],_0x4b3d28[_0x0b35('0x2f')]);_0x5ed454['attributes']=_[_0x0b35('0x30')](_0x4b3d28['model'],qs[_0x0b35('0x32')](_0x18ac4b['query'][_0x0b35('0x32')]));_0x5ed454[_0x0b35('0x33')]=_0x5ed454['attributes'][_0x0b35('0x34')]?_0x5ed454['attributes']:_0x4b3d28[_0x0b35('0x31')];if(!_0x18ac4b[_0x0b35('0x2f')][_0x0b35('0x35')](_0x0b35('0x36'))){_0x5ed454[_0x0b35('0x1b')]=qs[_0x0b35('0x1b')](_0x18ac4b[_0x0b35('0x2f')][_0x0b35('0x1b')]);_0x5ed454[_0x0b35('0x19')]=qs[_0x0b35('0x19')](_0x18ac4b[_0x0b35('0x2f')]['offset']);}_0x5ed454[_0x0b35('0x37')]=qs[_0x0b35('0x38')](_0x18ac4b['query'][_0x0b35('0x38')]);_0x5ed454['where']=qs[_0x0b35('0x39')](_[_0x0b35('0x3a')](_0x18ac4b['query'],_0x4b3d28[_0x0b35('0x39')]),_0x889b97);if(_0x18ac4b[_0x0b35('0x2f')]['filter']){_0x5ed454[_0x0b35('0x3b')]=_['merge'](_0x5ed454[_0x0b35('0x3b')],{'$or':_[_0x0b35('0x2d')](_0x889b97,function(_0x52b5c4){if(_0x52b5c4['type']!==_0x0b35('0x3c')){var _0x577171={};_0x577171[_0x52b5c4['name']]={'$like':'%'+_0x18ac4b[_0x0b35('0x2f')]['filter']+'%'};return _0x577171;}})});}_0x5ed454=_[_0x0b35('0x3d')]({},_0x5ed454,_0x18ac4b[_0x0b35('0x3e')]);var _0x5362af={'where':_0x5ed454[_0x0b35('0x3b')]};return db[_0x0b35('0x28')][_0x0b35('0x1c')](_0x5362af)[_0x0b35('0x21')](function(_0x4bcf18){_0x1ff24e[_0x0b35('0x1c')]=_0x4bcf18;if(_0x18ac4b[_0x0b35('0x2f')][_0x0b35('0x3f')]){_0x5ed454['include']=[{'all':!![]}];}return db[_0x0b35('0x28')][_0x0b35('0x40')](_0x5ed454);})[_0x0b35('0x21')](function(_0x1f217d){_0x1ff24e['rows']=_0x1f217d;return _0x1ff24e;})['then'](respondWithFilteredResult(_0x32306d,_0x5ed454))[_0x0b35('0x41')](handleError(_0x32306d,null));};exports['show']=function(_0xa53d37,_0x478606){var _0x2cc8ef={'raw':!![],'where':{'id':_0xa53d37[_0x0b35('0x42')]['id']}},_0x3cbee6={};_0x3cbee6[_0x0b35('0x31')]=_['keys'](db[_0x0b35('0x28')][_0x0b35('0x29')]);_0x3cbee6['query']=_[_0x0b35('0x43')](_0xa53d37[_0x0b35('0x2f')]);_0x3cbee6[_0x0b35('0x39')]=_[_0x0b35('0x30')](_0x3cbee6['model'],_0x3cbee6[_0x0b35('0x2f')]);_0x2cc8ef[_0x0b35('0x33')]=_['intersection'](_0x3cbee6[_0x0b35('0x31')],qs['fields'](_0xa53d37[_0x0b35('0x2f')][_0x0b35('0x32')]));_0x2cc8ef[_0x0b35('0x33')]=_0x2cc8ef['attributes'][_0x0b35('0x34')]?_0x2cc8ef['attributes']:_0x3cbee6[_0x0b35('0x31')];if(_0xa53d37[_0x0b35('0x2f')][_0x0b35('0x3f')]){_0x2cc8ef['include']=[{'all':!![]}];}_0x2cc8ef=_[_0x0b35('0x3d')]({},_0x2cc8ef,_0xa53d37[_0x0b35('0x3e')]);return db[_0x0b35('0x28')]['find'](_0x2cc8ef)[_0x0b35('0x21')](handleEntityNotFound(_0x478606,null))[_0x0b35('0x21')](respondWithResult(_0x478606,null))[_0x0b35('0x41')](handleError(_0x478606,null));};exports[_0x0b35('0x44')]=function(_0x371c55,_0x4e7c1e){return db[_0x0b35('0x28')][_0x0b35('0x44')](_0x371c55[_0x0b35('0x45')],{})[_0x0b35('0x21')](respondWithResult(_0x4e7c1e,0xc9))[_0x0b35('0x41')](handleError(_0x4e7c1e,null));};exports['update']=function(_0x37003f,_0x3bf8b9){if(_0x37003f[_0x0b35('0x45')]['id']){delete _0x37003f[_0x0b35('0x45')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x37003f['params']['id']}})[_0x0b35('0x21')](handleEntityNotFound(_0x3bf8b9,null))[_0x0b35('0x21')](saveUpdates(_0x37003f[_0x0b35('0x45')],null))[_0x0b35('0x21')](respondWithResult(_0x3bf8b9,null))[_0x0b35('0x41')](handleError(_0x3bf8b9,null));};exports[_0x0b35('0x22')]=function(_0x14ece5,_0x1daf62){return db[_0x0b35('0x28')][_0x0b35('0x46')]({'where':{'id':_0x14ece5[_0x0b35('0x42')]['id']}})[_0x0b35('0x21')](handleEntityNotFound(_0x1daf62,null))['then'](removeEntity(_0x1daf62,null))[_0x0b35('0x41')](handleError(_0x1daf62,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 461aaa8..9443f79 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 _0x62e6=['exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x4f386e,_0x56ffdd){var _0x4694e2=function(_0x3d16e4){while(--_0x3d16e4){_0x4f386e['push'](_0x4f386e['shift']());}};_0x4694e2(++_0x56ffdd);}(_0x62e6,0xba));var _0x662e=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0x62e6[_0x542da8];return _0x533d7e;};'use strict';var _=require(_0x662e('0x0'));var util=require(_0x662e('0x1'));var logger=require(_0x662e('0x2'))(_0x662e('0x3'));var moment=require('moment');var BPromise=require(_0x662e('0x4'));var rp=require(_0x662e('0x5'));var fs=require('fs');var path=require(_0x662e('0x6'));var rimraf=require(_0x662e('0x7'));var config=require(_0x662e('0x8'));var attributes=require(_0x662e('0x9'));module[_0x662e('0xa')]=function(_0x533b23,_0x1af209){return _0x533b23[_0x662e('0xb')](_0x662e('0xc'),attributes,{'tableName':_0x662e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x157c=['rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x672f83,_0x65a3bf){var _0x282162=function(_0x4d795b){while(--_0x4d795b){_0x672f83['push'](_0x672f83['shift']());}};_0x282162(++_0x65a3bf);}(_0x157c,0xbc));var _0xc157=function(_0x53da0e,_0x2c4eb0){_0x53da0e=_0x53da0e-0x0;var _0x3a6ae7=_0x157c[_0x53da0e];return _0x3a6ae7;};'use strict';var _=require(_0xc157('0x0'));var util=require(_0xc157('0x1'));var logger=require(_0xc157('0x2'))(_0xc157('0x3'));var moment=require(_0xc157('0x4'));var BPromise=require(_0xc157('0x5'));var rp=require(_0xc157('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc157('0x7'));var config=require('../../config/environment');var attributes=require(_0xc157('0x8'));module[_0xc157('0x9')]=function(_0x5b084c,_0x239bdb){return _0x5b084c[_0xc157('0xa')](_0xc157('0xb'),attributes,{'tableName':_0xc157('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index bd7e1a6..2ec9009 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x27ffc3,_0x6a9a3f){var _0x139f94=function(_0x26d528){while(--_0x26d528){_0x27ffc3['push'](_0x27ffc3['shift']());}};_0x139f94(++_0x6a9a3f);}(_0xadb5,0xad));var _0x5adb=function(_0x3d9020,_0x875829){_0x3d9020=_0x3d9020-0x0;var _0x4c853a=_0xadb5[_0x3d9020];return _0x4c853a;};'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']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x347399,_0x42bbda){var _0x24e7be=function(_0x33fdc){while(--_0x33fdc){_0x347399['push'](_0x347399['shift']());}};_0x24e7be(++_0x42bbda);}(_0xadb5,0xad));var _0x5adb=function(_0x24322d,_0x5b2146){_0x24322d=_0x24322d-0x0;var _0x4a9274=_0xadb5[_0x24322d];return _0x4a9274;};'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']('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 2f1e75b..e57d59b 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 _0xb55d=['create','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','/:id','show','post'];(function(_0x14d175,_0x159cbe){var _0x18ab05=function(_0x31d4ce){while(--_0x31d4ce){_0x14d175['push'](_0x14d175['shift']());}};_0x18ab05(++_0x159cbe);}(_0xb55d,0x125));var _0xdb55=function(_0x1bb771,_0x48f810){_0x1bb771=_0x1bb771-0x0;var _0x485de8=_0xb55d[_0x1bb771];return _0x485de8;};'use strict';var multer=require(_0xdb55('0x0'));var util=require(_0xdb55('0x1'));var path=require('path');var timeout=require(_0xdb55('0x2'));var express=require('express');var router=express[_0xdb55('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdb55('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdb55('0x5'));var controller=require(_0xdb55('0x6'));router[_0xdb55('0x7')]('/',auth[_0xdb55('0x8')](),controller['index']);router['get'](_0xdb55('0x9'),auth[_0xdb55('0x8')](),controller['describe']);router[_0xdb55('0x7')](_0xdb55('0xa'),auth[_0xdb55('0x8')](),controller[_0xdb55('0xb')]);router[_0xdb55('0xc')]('/',auth[_0xdb55('0x8')](),controller[_0xdb55('0xd')]);router['put']('/:id',auth[_0xdb55('0x8')](),controller[_0xdb55('0xe')]);router[_0xdb55('0xf')](_0xdb55('0xa'),auth[_0xdb55('0x8')](),controller['destroy']);module[_0xdb55('0x10')]=router; \ No newline at end of file +var _0x38ea=['index','/describe','describe','show','create','put','/:id','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x4ec33c,_0x36d203){var _0x4320ac=function(_0x36b298){while(--_0x36b298){_0x4ec33c['push'](_0x4ec33c['shift']());}};_0x4320ac(++_0x36d203);}(_0x38ea,0x182));var _0xa38e=function(_0x5f55cd,_0x556b8b){_0x5f55cd=_0x5f55cd-0x0;var _0x22dd09=_0x38ea[_0x5f55cd];return _0x22dd09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa38e('0x0'));var timeout=require(_0xa38e('0x1'));var express=require(_0xa38e('0x2'));var router=express[_0xa38e('0x3')]();var fs_extra=require(_0xa38e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa38e('0x5'));var config=require(_0xa38e('0x6'));var controller=require(_0xa38e('0x7'));router[_0xa38e('0x8')]('/',auth[_0xa38e('0x9')](),controller[_0xa38e('0xa')]);router[_0xa38e('0x8')](_0xa38e('0xb'),auth['isAuthenticated'](),controller[_0xa38e('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa38e('0xd')]);router['post']('/',auth[_0xa38e('0x9')](),controller[_0xa38e('0xe')]);router[_0xa38e('0xf')](_0xa38e('0x10'),auth[_0xa38e('0x9')](),controller['update']);router['delete'](_0xa38e('0x10'),auth['isAuthenticated'](),controller[_0xa38e('0x11')]);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 a4490f5..30ffb9e 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 _0xa46e=['name','STRING','sequelize','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa46e,0x8a));var _0xea46=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0xa46e[_0x5b3950];return _0x41e436;};'use strict';var Sequelize=require(_0xea46('0x0'));module[_0xea46('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea46('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xea46('0x3')]}}; \ No newline at end of file +var _0x1670=['name','sequelize','exports'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x1670,0x9a));var _0x0167=function(_0x22a77c,_0x567591){_0x22a77c=_0x22a77c-0x0;var _0x3f9871=_0x1670[_0x22a77c];return _0x3f9871;};'use strict';var Sequelize=require(_0x0167('0x0'));module[_0x0167('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0167('0x2'),'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 b1c6d53..b761e2c 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 _0x271e=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','then','includeAll','MailSubstatus','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x409d51,_0x1f0de6){var _0x13eb4b=function(_0x374388){while(--_0x374388){_0x409d51['push'](_0x409d51['shift']());}};_0x13eb4b(++_0x1f0de6);}(_0x271e,0x95));var _0xe271=function(_0x25397b,_0x241778){_0x25397b=_0x25397b-0x0;var _0x456103=_0x271e[_0x25397b];return _0x456103;};'use strict';var emlformat=require(_0xe271('0x0'));var rimraf=require(_0xe271('0x1'));var zipdir=require(_0xe271('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe271('0x3'));var moment=require('moment');var BPromise=require(_0xe271('0x4'));var Mustache=require(_0xe271('0x5'));var util=require(_0xe271('0x6'));var path=require(_0xe271('0x7'));var sox=require(_0xe271('0x8'));var csv=require(_0xe271('0x9'));var ejs=require(_0xe271('0xa'));var fs=require('fs');var fs_extra=require(_0xe271('0xb'));var _=require(_0xe271('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe271('0xd'));var toCsv=require(_0xe271('0x9'));var querystring=require(_0xe271('0xe'));var Papa=require(_0xe271('0xf'));var Redis=require(_0xe271('0x10'));var authService=require(_0xe271('0x11'));var qs=require(_0xe271('0x12'));var as=require(_0xe271('0x13'));var hardwareService=require(_0xe271('0x14'));var logger=require(_0xe271('0x15'))(_0xe271('0x16'));var utils=require(_0xe271('0x17'));var config=require(_0xe271('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe271('0x19'))['db'];function respondWithStatusCode(_0x4e49f3,_0x1f08a7){_0x1f08a7=_0x1f08a7||0xcc;return function(_0xd3436){if(_0xd3436){return _0x4e49f3[_0xe271('0x1a')](_0x1f08a7);}return _0x4e49f3[_0xe271('0x1b')](_0x1f08a7)[_0xe271('0x1c')]();};}function respondWithResult(_0x411cc7,_0x30f14b){_0x30f14b=_0x30f14b||0xc8;return function(_0x4589e5){if(_0x4589e5){return _0x411cc7['status'](_0x30f14b)[_0xe271('0x1d')](_0x4589e5);}};}function respondWithFilteredResult(_0x31ec87,_0x441f02){return function(_0x2e54e6){if(_0x2e54e6){var _0x3a3219=typeof _0x441f02[_0xe271('0x1e')]===_0xe271('0x1f')&&typeof _0x441f02[_0xe271('0x20')]==='undefined';var _0x1d1838=_0x2e54e6['count'];var _0x223515=_0x3a3219?0x0:_0x441f02[_0xe271('0x1e')];var _0x197e5f=_0x3a3219?_0x2e54e6[_0xe271('0x21')]:_0x441f02[_0xe271('0x1e')]+_0x441f02[_0xe271('0x20')];var _0x4d0885;if(_0x197e5f>=_0x1d1838){_0x197e5f=_0x1d1838;_0x4d0885=0xc8;}else{_0x4d0885=0xce;}_0x31ec87['status'](_0x4d0885);return _0x31ec87[_0xe271('0x22')](_0xe271('0x23'),_0x223515+'-'+_0x197e5f+'/'+_0x1d1838)[_0xe271('0x1d')](_0x2e54e6);}return null;};}function patchUpdates(_0xbfa751){return function(_0x1b434a){try{jsonpatch[_0xe271('0x24')](_0x1b434a,_0xbfa751,!![]);}catch(_0x45a1b6){return BPromise[_0xe271('0x25')](_0x45a1b6);}return _0x1b434a[_0xe271('0x26')]();};}function saveUpdates(_0x58117c,_0x765e46){return function(_0x1253e2){if(_0x1253e2){return _0x1253e2[_0xe271('0x27')](_0x58117c)['then'](function(_0x523722){return _0x523722;});}return null;};}function removeEntity(_0x4d7fae,_0x487f32){return function(_0x32310a){if(_0x32310a){return _0x32310a['destroy']()['then'](function(){_0x4d7fae[_0xe271('0x1b')](0xcc)[_0xe271('0x1c')]();});}};}function handleEntityNotFound(_0x5947ca,_0x3ba9db){return function(_0x3baf5b){if(!_0x3baf5b){_0x5947ca[_0xe271('0x1a')](0x194);}return _0x3baf5b;};}function handleError(_0x2fbe6e,_0x4bb248){_0x4bb248=_0x4bb248||0x1f4;return function(_0x8b965b){logger[_0xe271('0x28')](_0x8b965b[_0xe271('0x29')]);if(_0x8b965b[_0xe271('0x2a')]){delete _0x8b965b[_0xe271('0x2a')];}_0x2fbe6e['status'](_0x4bb248)[_0xe271('0x2b')](_0x8b965b);};}exports['index']=function(_0x188a54,_0x33db82){var _0x2e274e={},_0xc390be={},_0x163392={'count':0x0,'rows':[]};var _0x108fd7=_[_0xe271('0x2c')](db['MailSubstatus'][_0xe271('0x2d')],function(_0x81c1){return{'name':_0x81c1[_0xe271('0x2e')],'type':_0x81c1[_0xe271('0x2f')][_0xe271('0x30')]};});_0xc390be[_0xe271('0x31')]=_['map'](_0x108fd7,_0xe271('0x2a'));_0xc390be[_0xe271('0x32')]=_[_0xe271('0x33')](_0x188a54[_0xe271('0x32')]);_0xc390be[_0xe271('0x34')]=_[_0xe271('0x35')](_0xc390be[_0xe271('0x31')],_0xc390be[_0xe271('0x32')]);_0x2e274e[_0xe271('0x36')]=_[_0xe271('0x35')](_0xc390be[_0xe271('0x31')],qs[_0xe271('0x37')](_0x188a54[_0xe271('0x32')]['fields']));_0x2e274e['attributes']=_0x2e274e[_0xe271('0x36')][_0xe271('0x38')]?_0x2e274e['attributes']:_0xc390be[_0xe271('0x31')];if(!_0x188a54[_0xe271('0x32')][_0xe271('0x39')](_0xe271('0x3a'))){_0x2e274e[_0xe271('0x20')]=qs['limit'](_0x188a54[_0xe271('0x32')][_0xe271('0x20')]);_0x2e274e[_0xe271('0x1e')]=qs['offset'](_0x188a54[_0xe271('0x32')][_0xe271('0x1e')]);}_0x2e274e['order']=qs[_0xe271('0x3b')](_0x188a54[_0xe271('0x32')][_0xe271('0x3b')]);_0x2e274e[_0xe271('0x3c')]=qs['filters'](_['pick'](_0x188a54[_0xe271('0x32')],_0xc390be[_0xe271('0x34')]),_0x108fd7);if(_0x188a54[_0xe271('0x32')][_0xe271('0x3d')]){_0x2e274e[_0xe271('0x3c')]=_[_0xe271('0x3e')](_0x2e274e[_0xe271('0x3c')],{'$or':_[_0xe271('0x2c')](_0x108fd7,function(_0x8c8d70){if(_0x8c8d70['type']!=='VIRTUAL'){var _0x474932={};_0x474932[_0x8c8d70[_0xe271('0x2a')]]={'$like':'%'+_0x188a54[_0xe271('0x32')][_0xe271('0x3d')]+'%'};return _0x474932;}})});}_0x2e274e=_[_0xe271('0x3e')]({},_0x2e274e,_0x188a54[_0xe271('0x3f')]);var _0xb30277={'where':_0x2e274e[_0xe271('0x3c')]};return db['MailSubstatus'][_0xe271('0x21')](_0xb30277)[_0xe271('0x40')](function(_0x16c7d5){_0x163392[_0xe271('0x21')]=_0x16c7d5;if(_0x188a54[_0xe271('0x32')][_0xe271('0x41')]){_0x2e274e['include']=[{'all':!![]}];}return db[_0xe271('0x42')]['findAll'](_0x2e274e);})[_0xe271('0x40')](function(_0x5d0042){_0x163392['rows']=_0x5d0042;return _0x163392;})['then'](respondWithFilteredResult(_0x33db82,_0x2e274e))[_0xe271('0x43')](handleError(_0x33db82,null));};exports[_0xe271('0x44')]=function(_0x3844dd,_0x5b207c){var _0x43a78c={'raw':!![],'where':{'id':_0x3844dd[_0xe271('0x45')]['id']}},_0x3a12e0={};_0x3a12e0[_0xe271('0x31')]=_['keys'](db[_0xe271('0x42')][_0xe271('0x2d')]);_0x3a12e0[_0xe271('0x32')]=_['keys'](_0x3844dd[_0xe271('0x32')]);_0x3a12e0[_0xe271('0x34')]=_[_0xe271('0x35')](_0x3a12e0[_0xe271('0x31')],_0x3a12e0[_0xe271('0x32')]);_0x43a78c[_0xe271('0x36')]=_['intersection'](_0x3a12e0[_0xe271('0x31')],qs[_0xe271('0x37')](_0x3844dd[_0xe271('0x32')]['fields']));_0x43a78c[_0xe271('0x36')]=_0x43a78c[_0xe271('0x36')][_0xe271('0x38')]?_0x43a78c[_0xe271('0x36')]:_0x3a12e0[_0xe271('0x31')];if(_0x3844dd[_0xe271('0x32')][_0xe271('0x41')]){_0x43a78c[_0xe271('0x46')]=[{'all':!![]}];}_0x43a78c=_['merge']({},_0x43a78c,_0x3844dd[_0xe271('0x3f')]);return db[_0xe271('0x42')][_0xe271('0x47')](_0x43a78c)['then'](handleEntityNotFound(_0x5b207c,null))[_0xe271('0x40')](respondWithResult(_0x5b207c,null))[_0xe271('0x43')](handleError(_0x5b207c,null));};exports[_0xe271('0x48')]=function(_0x4c4e2c,_0x114583){return db['MailSubstatus']['create'](_0x4c4e2c[_0xe271('0x49')],{})[_0xe271('0x40')](respondWithResult(_0x114583,0xc9))[_0xe271('0x43')](handleError(_0x114583,null));};exports[_0xe271('0x27')]=function(_0x4b35b3,_0x2b9bad){if(_0x4b35b3[_0xe271('0x49')]['id']){delete _0x4b35b3['body']['id'];}return db[_0xe271('0x42')]['find']({'where':{'id':_0x4b35b3[_0xe271('0x45')]['id']}})[_0xe271('0x40')](handleEntityNotFound(_0x2b9bad,null))['then'](saveUpdates(_0x4b35b3[_0xe271('0x49')],null))[_0xe271('0x40')](respondWithResult(_0x2b9bad,null))[_0xe271('0x43')](handleError(_0x2b9bad,null));};exports[_0xe271('0x4a')]=function(_0x165869,_0xafbbbe){return db['MailSubstatus']['find']({'where':{'id':_0x165869[_0xe271('0x45')]['id']}})[_0xe271('0x40')](handleEntityNotFound(_0xafbbbe,null))[_0xe271('0x40')](removeEntity(_0xafbbbe,null))['catch'](handleError(_0xafbbbe,null));};exports[_0xe271('0x4b')]=function(_0x59913c,_0xf66475){return db['MailSubstatus']['describe']()[_0xe271('0x40')](respondWithResult(_0xf66475,null))['catch'](handleError(_0xf66475,null));}; \ No newline at end of file +var _0xc9ef=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','update','then','end','error','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3464fb,_0x4670c8){var _0x397199=function(_0x588a8f){while(--_0x588a8f){_0x3464fb['push'](_0x3464fb['shift']());}};_0x397199(++_0x4670c8);}(_0xc9ef,0x125));var _0xfc9e=function(_0x40bf8e,_0x4a6e8c){_0x40bf8e=_0x40bf8e-0x0;var _0x1e6de9=_0xc9ef[_0x40bf8e];return _0x1e6de9;};'use strict';var emlformat=require(_0xfc9e('0x0'));var rimraf=require(_0xfc9e('0x1'));var zipdir=require(_0xfc9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc9e('0x3'));var Mustache=require(_0xfc9e('0x4'));var util=require(_0xfc9e('0x5'));var path=require(_0xfc9e('0x6'));var sox=require('sox');var csv=require(_0xfc9e('0x7'));var ejs=require(_0xfc9e('0x8'));var fs=require('fs');var fs_extra=require(_0xfc9e('0x9'));var _=require('lodash');var squel=require(_0xfc9e('0xa'));var crypto=require(_0xfc9e('0xb'));var jsforce=require(_0xfc9e('0xc'));var deskjs=require(_0xfc9e('0xd'));var toCsv=require(_0xfc9e('0x7'));var querystring=require(_0xfc9e('0xe'));var Papa=require('papaparse');var Redis=require(_0xfc9e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc9e('0x10'))(_0xfc9e('0x11'));var utils=require(_0xfc9e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xfc9e('0x13'));var db=require(_0xfc9e('0x14'))['db'];function respondWithStatusCode(_0x8519b4,_0x406a42){_0x406a42=_0x406a42||0xcc;return function(_0x1ef793){if(_0x1ef793){return _0x8519b4['sendStatus'](_0x406a42);}return _0x8519b4[_0xfc9e('0x15')](_0x406a42)['end']();};}function respondWithResult(_0x398dc1,_0x203499){_0x203499=_0x203499||0xc8;return function(_0x338053){if(_0x338053){return _0x398dc1[_0xfc9e('0x15')](_0x203499)[_0xfc9e('0x16')](_0x338053);}};}function respondWithFilteredResult(_0x11d859,_0x3c417f){return function(_0x2fe6f4){if(_0x2fe6f4){var _0x1f7af4=typeof _0x3c417f['offset']===_0xfc9e('0x17')&&typeof _0x3c417f[_0xfc9e('0x18')]===_0xfc9e('0x17');var _0x32d3d4=_0x2fe6f4['count'];var _0x30a957=_0x1f7af4?0x0:_0x3c417f[_0xfc9e('0x19')];var _0x5634c7=_0x1f7af4?_0x2fe6f4[_0xfc9e('0x1a')]:_0x3c417f[_0xfc9e('0x19')]+_0x3c417f[_0xfc9e('0x18')];var _0x32a5c1;if(_0x5634c7>=_0x32d3d4){_0x5634c7=_0x32d3d4;_0x32a5c1=0xc8;}else{_0x32a5c1=0xce;}_0x11d859[_0xfc9e('0x15')](_0x32a5c1);return _0x11d859[_0xfc9e('0x1b')](_0xfc9e('0x1c'),_0x30a957+'-'+_0x5634c7+'/'+_0x32d3d4)[_0xfc9e('0x16')](_0x2fe6f4);}return null;};}function patchUpdates(_0xd78888){return function(_0x201f4d){try{jsonpatch[_0xfc9e('0x1d')](_0x201f4d,_0xd78888,!![]);}catch(_0x36b222){return BPromise['reject'](_0x36b222);}return _0x201f4d['save']();};}function saveUpdates(_0x922824,_0x278fc9){return function(_0x18aeea){if(_0x18aeea){return _0x18aeea[_0xfc9e('0x1e')](_0x922824)[_0xfc9e('0x1f')](function(_0x3e78b0){return _0x3e78b0;});}return null;};}function removeEntity(_0x34e4e6,_0x15478c){return function(_0x29011c){if(_0x29011c){return _0x29011c['destroy']()[_0xfc9e('0x1f')](function(){_0x34e4e6[_0xfc9e('0x15')](0xcc)[_0xfc9e('0x20')]();});}};}function handleEntityNotFound(_0x3acc6e,_0xf06ae3){return function(_0x1f7bb9){if(!_0x1f7bb9){_0x3acc6e['sendStatus'](0x194);}return _0x1f7bb9;};}function handleError(_0x242ad6,_0xecb973){_0xecb973=_0xecb973||0x1f4;return function(_0x4ac608){logger[_0xfc9e('0x21')](_0x4ac608['stack']);if(_0x4ac608[_0xfc9e('0x22')]){delete _0x4ac608[_0xfc9e('0x22')];}_0x242ad6[_0xfc9e('0x15')](_0xecb973)[_0xfc9e('0x23')](_0x4ac608);};}exports[_0xfc9e('0x24')]=function(_0x3596f9,_0x1fc2d3){var _0x4d821e={},_0x22545d={},_0x8d2ea2={'count':0x0,'rows':[]};var _0x4b9707=_[_0xfc9e('0x25')](db[_0xfc9e('0x26')][_0xfc9e('0x27')],function(_0x3b3a5b){return{'name':_0x3b3a5b[_0xfc9e('0x28')],'type':_0x3b3a5b[_0xfc9e('0x29')][_0xfc9e('0x2a')]};});_0x22545d[_0xfc9e('0x2b')]=_[_0xfc9e('0x25')](_0x4b9707,_0xfc9e('0x22'));_0x22545d[_0xfc9e('0x2c')]=_['keys'](_0x3596f9[_0xfc9e('0x2c')]);_0x22545d[_0xfc9e('0x2d')]=_[_0xfc9e('0x2e')](_0x22545d[_0xfc9e('0x2b')],_0x22545d['query']);_0x4d821e[_0xfc9e('0x2f')]=_[_0xfc9e('0x2e')](_0x22545d['model'],qs[_0xfc9e('0x30')](_0x3596f9['query'][_0xfc9e('0x30')]));_0x4d821e[_0xfc9e('0x2f')]=_0x4d821e[_0xfc9e('0x2f')][_0xfc9e('0x31')]?_0x4d821e[_0xfc9e('0x2f')]:_0x22545d['model'];if(!_0x3596f9[_0xfc9e('0x2c')][_0xfc9e('0x32')](_0xfc9e('0x33'))){_0x4d821e[_0xfc9e('0x18')]=qs[_0xfc9e('0x18')](_0x3596f9[_0xfc9e('0x2c')][_0xfc9e('0x18')]);_0x4d821e[_0xfc9e('0x19')]=qs['offset'](_0x3596f9[_0xfc9e('0x2c')]['offset']);}_0x4d821e['order']=qs[_0xfc9e('0x34')](_0x3596f9[_0xfc9e('0x2c')][_0xfc9e('0x34')]);_0x4d821e[_0xfc9e('0x35')]=qs[_0xfc9e('0x2d')](_['pick'](_0x3596f9['query'],_0x22545d[_0xfc9e('0x2d')]),_0x4b9707);if(_0x3596f9[_0xfc9e('0x2c')][_0xfc9e('0x36')]){_0x4d821e[_0xfc9e('0x35')]=_[_0xfc9e('0x37')](_0x4d821e[_0xfc9e('0x35')],{'$or':_['map'](_0x4b9707,function(_0x10e0f3){if(_0x10e0f3['type']!==_0xfc9e('0x38')){var _0x27ade4={};_0x27ade4[_0x10e0f3[_0xfc9e('0x22')]]={'$like':'%'+_0x3596f9[_0xfc9e('0x2c')][_0xfc9e('0x36')]+'%'};return _0x27ade4;}})});}_0x4d821e=_[_0xfc9e('0x37')]({},_0x4d821e,_0x3596f9[_0xfc9e('0x39')]);var _0x15ab57={'where':_0x4d821e[_0xfc9e('0x35')]};return db[_0xfc9e('0x26')][_0xfc9e('0x1a')](_0x15ab57)[_0xfc9e('0x1f')](function(_0x3d058e){_0x8d2ea2[_0xfc9e('0x1a')]=_0x3d058e;if(_0x3596f9[_0xfc9e('0x2c')][_0xfc9e('0x3a')]){_0x4d821e[_0xfc9e('0x3b')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x4d821e);})[_0xfc9e('0x1f')](function(_0x5dd3c6){_0x8d2ea2[_0xfc9e('0x3c')]=_0x5dd3c6;return _0x8d2ea2;})[_0xfc9e('0x1f')](respondWithFilteredResult(_0x1fc2d3,_0x4d821e))[_0xfc9e('0x3d')](handleError(_0x1fc2d3,null));};exports[_0xfc9e('0x3e')]=function(_0x57cd58,_0x156069){var _0x3762a6={'raw':!![],'where':{'id':_0x57cd58[_0xfc9e('0x3f')]['id']}},_0x58715c={};_0x58715c[_0xfc9e('0x2b')]=_[_0xfc9e('0x40')](db[_0xfc9e('0x26')][_0xfc9e('0x27')]);_0x58715c[_0xfc9e('0x2c')]=_['keys'](_0x57cd58[_0xfc9e('0x2c')]);_0x58715c[_0xfc9e('0x2d')]=_['intersection'](_0x58715c[_0xfc9e('0x2b')],_0x58715c['query']);_0x3762a6[_0xfc9e('0x2f')]=_['intersection'](_0x58715c['model'],qs[_0xfc9e('0x30')](_0x57cd58[_0xfc9e('0x2c')][_0xfc9e('0x30')]));_0x3762a6[_0xfc9e('0x2f')]=_0x3762a6[_0xfc9e('0x2f')][_0xfc9e('0x31')]?_0x3762a6['attributes']:_0x58715c['model'];if(_0x57cd58[_0xfc9e('0x2c')][_0xfc9e('0x3a')]){_0x3762a6[_0xfc9e('0x3b')]=[{'all':!![]}];}_0x3762a6=_[_0xfc9e('0x37')]({},_0x3762a6,_0x57cd58['options']);return db['MailSubstatus'][_0xfc9e('0x41')](_0x3762a6)[_0xfc9e('0x1f')](handleEntityNotFound(_0x156069,null))[_0xfc9e('0x1f')](respondWithResult(_0x156069,null))[_0xfc9e('0x3d')](handleError(_0x156069,null));};exports[_0xfc9e('0x42')]=function(_0x1ffcc5,_0x2282d1){return db[_0xfc9e('0x26')][_0xfc9e('0x42')](_0x1ffcc5[_0xfc9e('0x43')],{})['then'](respondWithResult(_0x2282d1,0xc9))[_0xfc9e('0x3d')](handleError(_0x2282d1,null));};exports[_0xfc9e('0x1e')]=function(_0x450803,_0x23a195){if(_0x450803[_0xfc9e('0x43')]['id']){delete _0x450803[_0xfc9e('0x43')]['id'];}return db[_0xfc9e('0x26')]['find']({'where':{'id':_0x450803[_0xfc9e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x23a195,null))[_0xfc9e('0x1f')](saveUpdates(_0x450803[_0xfc9e('0x43')],null))[_0xfc9e('0x1f')](respondWithResult(_0x23a195,null))['catch'](handleError(_0x23a195,null));};exports[_0xfc9e('0x44')]=function(_0x1fb881,_0x2d6747){return db[_0xfc9e('0x26')][_0xfc9e('0x41')]({'where':{'id':_0x1fb881[_0xfc9e('0x3f')]['id']}})[_0xfc9e('0x1f')](handleEntityNotFound(_0x2d6747,null))[_0xfc9e('0x1f')](removeEntity(_0x2d6747,null))[_0xfc9e('0x3d')](handleError(_0x2d6747,null));};exports['describe']=function(_0x3e6ff6,_0x543664){return db[_0xfc9e('0x26')]['describe']()['then'](respondWithResult(_0x543664,null))[_0xfc9e('0x3d')](handleError(_0x543664,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index af93ed8..8a989ea 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 _0x3f44=['setMaxListeners','update','emit','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x379967,_0x466bf8){var _0x33ff2d=function(_0x674456){while(--_0x674456){_0x379967['push'](_0x379967['shift']());}};_0x33ff2d(++_0x466bf8);}(_0x3f44,0x1d5));var _0x43f4=function(_0xf34eb8,_0x1df33a){_0xf34eb8=_0xf34eb8-0x0;var _0x20f11a=_0x3f44[_0xf34eb8];return _0x20f11a;};'use strict';var EventEmitter=require(_0x43f4('0x0'));var MailSubstatus=require(_0x43f4('0x1'))['db'][_0x43f4('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x43f4('0x3')](0x0);var events={'afterUpdate':_0x43f4('0x4')};function emitEvent(_0x18bcde){return function(_0x4c35a6,_0x111774,_0x31375d){MailSubstatusEvents[_0x43f4('0x5')](_0x18bcde+':'+_0x4c35a6['id'],_0x4c35a6);MailSubstatusEvents['emit'](_0x18bcde,_0x4c35a6);_0x31375d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x43f4('0x6')](e,emitEvent(event));}}module[_0x43f4('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xdfee=['update','emit','hasOwnProperty','hook','exports','events','MailSubstatus','setMaxListeners'];(function(_0x52c1c7,_0xd2cdf){var _0x5954f5=function(_0x14b032){while(--_0x14b032){_0x52c1c7['push'](_0x52c1c7['shift']());}};_0x5954f5(++_0xd2cdf);}(_0xdfee,0x14d));var _0xedfe=function(_0x2c9a15,_0x5d67f3){_0x2c9a15=_0x2c9a15-0x0;var _0x2cee45=_0xdfee[_0x2c9a15];return _0x2cee45;};'use strict';var EventEmitter=require(_0xedfe('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xedfe('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xedfe('0x2')](0x0);var events={'afterUpdate':_0xedfe('0x3')};function emitEvent(_0x208f05){return function(_0x37b9fd,_0x181cb1,_0x15d197){MailSubstatusEvents[_0xedfe('0x4')](_0x208f05+':'+_0x37b9fd['id'],_0x37b9fd);MailSubstatusEvents[_0xedfe('0x4')](_0x208f05,_0x37b9fd);_0x15d197(null);};}for(var e in events){if(events[_0xedfe('0x5')](e)){var event=events[e];MailSubstatus[_0xedfe('0x6')](e,emitEvent(event));}}module[_0xedfe('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5d5c4de..5e4a011 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 _0x7784=['mailSubstatus','_previousDataValues','name','then','catch','exports','models','define','mail_substatuses'];(function(_0x226212,_0x17f906){var _0x1c452b=function(_0x48570d){while(--_0x48570d){_0x226212['push'](_0x226212['shift']());}};_0x1c452b(++_0x17f906);}(_0x7784,0xd4));var _0x4778=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7784[_0x5b644e];return _0x49c6bf;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x4778('0x0')]=function(_0x4c6c59){var _0x250b0a=_0x4c6c59[_0x4778('0x1')];return _0x4c6c59[_0x4778('0x2')]('MailSubstatus',attributes,{'tableName':_0x4778('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x307669,_0x501a05,_0x5110a3){return _0x250b0a['Condition']['update']({'value':_0x307669['name']},{'where':{'field':_0x4778('0x4'),'value':_0x307669[_0x4778('0x5')][_0x4778('0x6')]}})[_0x4778('0x7')](function(){_0x5110a3();})[_0x4778('0x8')](function(_0xe0e26b){_0x5110a3(_0xe0e26b);});}}});}; \ No newline at end of file +var _0x2a4c=['MailSubstatus','mail_substatuses','update','name','mailSubstatus','then','./mailSubstatus.attributes','exports','models','define'];(function(_0xe5f260,_0x4546a7){var _0x3b3240=function(_0xb6e9fc){while(--_0xb6e9fc){_0xe5f260['push'](_0xe5f260['shift']());}};_0x3b3240(++_0x4546a7);}(_0x2a4c,0x1b4));var _0xc2a4=function(_0x3a0b4a,_0x3d8f6f){_0x3a0b4a=_0x3a0b4a-0x0;var _0x3d4a81=_0x2a4c[_0x3a0b4a];return _0x3d4a81;};'use strict';var attributes=require(_0xc2a4('0x0'));module[_0xc2a4('0x1')]=function(_0x9636ac){var _0x45a261=_0x9636ac[_0xc2a4('0x2')];return _0x9636ac[_0xc2a4('0x3')](_0xc2a4('0x4'),attributes,{'tableName':_0xc2a4('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5b9046,_0x431a3f,_0x4c4875){return _0x45a261['Condition'][_0xc2a4('0x6')]({'value':_0x5b9046[_0xc2a4('0x7')]},{'where':{'field':_0xc2a4('0x8'),'value':_0x5b9046['_previousDataValues'][_0xc2a4('0x7')]}})[_0xc2a4('0x9')](function(){_0x4c4875();})['catch'](function(_0x361b58){_0x4c4875(_0x361b58);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 3067b1b..bbc13ae 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 _0x21d1=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x2f175d,_0x2b12f5){var _0x59a6fc=function(_0x19762a){while(--_0x19762a){_0x2f175d['push'](_0x2f175d['shift']());}};_0x59a6fc(++_0x2b12f5);}(_0x21d1,0x1c9));var _0x121d=function(_0x454a79,_0x3816c2){_0x454a79=_0x454a79-0x0;var _0x117434=_0x21d1[_0x454a79];return _0x117434;};'use strict';var _=require(_0x121d('0x0'));var util=require(_0x121d('0x1'));var moment=require(_0x121d('0x2'));var BPromise=require(_0x121d('0x3'));var rs=require(_0x121d('0x4'));var fs=require('fs');var Redis=require(_0x121d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x121d('0x6'))(_0x121d('0x7'));var config=require(_0x121d('0x8'));var jayson=require(_0x121d('0x9'));var client=jayson[_0x121d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x226625,_0x2bd1e8,_0x47b50b){return new BPromise(function(_0x2d4d7e,_0x242f0c){return client[_0x121d('0xb')](_0x226625,_0x47b50b)[_0x121d('0xc')](function(_0x8b07c2){logger[_0x121d('0xd')](_0x121d('0xe'),_0x2bd1e8,'request\x20sent');logger[_0x121d('0xf')](_0x121d('0x10'),_0x2bd1e8,_0x121d('0x11'),JSON['stringify'](_0x8b07c2));if(_0x8b07c2['error']){if(_0x8b07c2[_0x121d('0x12')][_0x121d('0x13')]===0x1f4){logger[_0x121d('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x2bd1e8,_0x8b07c2['error'][_0x121d('0x14')]);return _0x242f0c(_0x8b07c2['error'][_0x121d('0x14')]);}logger[_0x121d('0x12')](_0x121d('0xe'),_0x2bd1e8,_0x8b07c2['error'][_0x121d('0x14')]);return _0x2d4d7e(_0x8b07c2[_0x121d('0x12')][_0x121d('0x14')]);}else{logger[_0x121d('0xd')](_0x121d('0xe'),_0x2bd1e8,_0x121d('0x11'));_0x2d4d7e(_0x8b07c2[_0x121d('0x15')][_0x121d('0x14')]);}})[_0x121d('0x16')](function(_0x475541){logger[_0x121d('0x12')](_0x121d('0xe'),_0x2bd1e8,_0x475541);_0x242f0c(_0x475541);});});} \ No newline at end of file +var _0xed76=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x195ce5,_0x332b12){var _0x20baaf=function(_0x499f38){while(--_0x499f38){_0x195ce5['push'](_0x195ce5['shift']());}};_0x20baaf(++_0x332b12);}(_0xed76,0x8f));var _0x6ed7=function(_0x4b20a5,_0x3f6935){_0x4b20a5=_0x4b20a5-0x0;var _0x27aaf2=_0xed76[_0x4b20a5];return _0x27aaf2;};'use strict';var _=require(_0x6ed7('0x0'));var util=require(_0x6ed7('0x1'));var moment=require(_0x6ed7('0x2'));var BPromise=require(_0x6ed7('0x3'));var rs=require(_0x6ed7('0x4'));var fs=require('fs');var Redis=require(_0x6ed7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ed7('0x6'));var logger=require(_0x6ed7('0x7'))(_0x6ed7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3941f3,_0x2dd5ed,_0x7217e0){return new BPromise(function(_0xde6c07,_0x2f5e46){return client['request'](_0x3941f3,_0x7217e0)[_0x6ed7('0x9')](function(_0x4d9f2b){logger['info'](_0x6ed7('0xa'),_0x2dd5ed,_0x6ed7('0xb'));logger[_0x6ed7('0xc')](_0x6ed7('0xd'),_0x2dd5ed,_0x6ed7('0xb'),JSON[_0x6ed7('0xe')](_0x4d9f2b));if(_0x4d9f2b['error']){if(_0x4d9f2b[_0x6ed7('0xf')]['code']===0x1f4){logger[_0x6ed7('0xf')](_0x6ed7('0xa'),_0x2dd5ed,_0x4d9f2b['error'][_0x6ed7('0x10')]);return _0x2f5e46(_0x4d9f2b[_0x6ed7('0xf')][_0x6ed7('0x10')]);}logger['error'](_0x6ed7('0xa'),_0x2dd5ed,_0x4d9f2b[_0x6ed7('0xf')][_0x6ed7('0x10')]);return _0xde6c07(_0x4d9f2b[_0x6ed7('0xf')]['message']);}else{logger[_0x6ed7('0x11')](_0x6ed7('0xa'),_0x2dd5ed,_0x6ed7('0xb'));_0xde6c07(_0x4d9f2b[_0x6ed7('0x12')]['message']);}})[_0x6ed7('0x13')](function(_0x1c0cd9){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x2dd5ed,_0x1c0cd9);_0x2f5e46(_0x1c0cd9);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index db7305c..2168252 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 _0xe1f7=['create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x176ffa,_0x1a3aee){var _0xb56056=function(_0x30c1a0){while(--_0x30c1a0){_0x176ffa['push'](_0x176ffa['shift']());}};_0xb56056(++_0x1a3aee);}(_0xe1f7,0x155));var _0x7e1f=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0xe1f7[_0x28394f];return _0x2618d2;};'use strict';var multer=require('multer');var util=require(_0x7e1f('0x0'));var path=require(_0x7e1f('0x1'));var timeout=require(_0x7e1f('0x2'));var express=require(_0x7e1f('0x3'));var router=express[_0x7e1f('0x4')]();var fs_extra=require(_0x7e1f('0x5'));var auth=require(_0x7e1f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7e1f('0x7'));var controller=require(_0x7e1f('0x8'));router['get']('/',auth[_0x7e1f('0x9')](),controller['index']);router[_0x7e1f('0xa')](_0x7e1f('0xb'),auth[_0x7e1f('0x9')](),controller[_0x7e1f('0xc')]);router['get'](_0x7e1f('0xd'),auth['isAuthenticated'](),controller[_0x7e1f('0xe')]);router[_0x7e1f('0xf')]('/',auth['isAuthenticated'](),controller[_0x7e1f('0x10')]);router['put']('/:id',auth[_0x7e1f('0x9')](),controller[_0x7e1f('0x11')]);router[_0x7e1f('0x12')](_0x7e1f('0xd'),auth['isAuthenticated'](),controller[_0x7e1f('0x13')]);module[_0x7e1f('0x14')]=router; \ No newline at end of file +var _0x880a=['/:id','post','create','update','multer','util','path','connect-timeout','express','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe'];(function(_0x4e1532,_0x8b5209){var _0x1fabce=function(_0x4c58e9){while(--_0x4c58e9){_0x4e1532['push'](_0x4e1532['shift']());}};_0x1fabce(++_0x8b5209);}(_0x880a,0x13f));var _0xa880=function(_0xf3f706,_0x38a484){_0xf3f706=_0xf3f706-0x0;var _0x43e438=_0x880a[_0xf3f706];return _0x43e438;};'use strict';var multer=require(_0xa880('0x0'));var util=require(_0xa880('0x1'));var path=require(_0xa880('0x2'));var timeout=require(_0xa880('0x3'));var express=require(_0xa880('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa880('0x5'));var controller=require(_0xa880('0x6'));router['get']('/',auth[_0xa880('0x7')](),controller[_0xa880('0x8')]);router[_0xa880('0x9')](_0xa880('0xa'),auth[_0xa880('0x7')](),controller['describe']);router['get'](_0xa880('0xb'),auth[_0xa880('0x7')](),controller['show']);router[_0xa880('0xc')]('/',auth[_0xa880('0x7')](),controller[_0xa880('0xd')]);router['put'](_0xa880('0xb'),auth[_0xa880('0x7')](),controller[_0xa880('0xe')]);router['delete'](_0xa880('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 4f870e3..9cc7cff 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x9e678b,_0x56cab9){var _0x57774d=function(_0x3a6af2){while(--_0x3a6af2){_0x9e678b['push'](_0x9e678b['shift']());}};_0x57774d(++_0x56cab9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3c8841,_0x39f3e7){_0x3c8841=_0x3c8841-0x0;var _0x54cffa=_0xf4eb[_0x3c8841];return _0x54cffa;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3f6f78,_0x222d85){var _0x534963=function(_0x42a95b){while(--_0x42a95b){_0x3f6f78['push'](_0x3f6f78['shift']());}};_0x534963(++_0x222d85);}(_0x34e8,0x12c));var _0x834e=function(_0x40c4fe,_0x367507){_0x40c4fe=_0x40c4fe-0x0;var _0xa80c96=_0x34e8[_0x40c4fe];return _0xa80c96;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index aa74740..77c0bbb 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 _0x38dd=['apply','then','destroy','end','error','stack','name','index','map','MailTransferReport','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','findAll','rows','catch','show','keys','includeAll','include','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range'];(function(_0x410536,_0x336ab0){var _0x41bf53=function(_0x37af53){while(--_0x37af53){_0x410536['push'](_0x410536['shift']());}};_0x41bf53(++_0x336ab0);}(_0x38dd,0x19b));var _0xd38d=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0x38dd[_0x336ca2];return _0xda59a6;};'use strict';var emlformat=require(_0xd38d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd38d('0x1'));var jsonpatch=require(_0xd38d('0x2'));var rp=require('request-promise');var moment=require(_0xd38d('0x3'));var BPromise=require(_0xd38d('0x4'));var Mustache=require(_0xd38d('0x5'));var util=require(_0xd38d('0x6'));var path=require(_0xd38d('0x7'));var sox=require(_0xd38d('0x8'));var csv=require(_0xd38d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd38d('0xa'));var _=require(_0xd38d('0xb'));var squel=require(_0xd38d('0xc'));var crypto=require('crypto');var jsforce=require(_0xd38d('0xd'));var deskjs=require(_0xd38d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd38d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd38d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd38d('0x11'));var hardwareService=require(_0xd38d('0x12'));var logger=require(_0xd38d('0x13'))(_0xd38d('0x14'));var utils=require(_0xd38d('0x15'));var config=require(_0xd38d('0x16'));var licenseUtil=require(_0xd38d('0x17'));var db=require(_0xd38d('0x18'))['db'];function respondWithStatusCode(_0x6786a2,_0x1a91cf){_0x1a91cf=_0x1a91cf||0xcc;return function(_0x5bac1f){if(_0x5bac1f){return _0x6786a2[_0xd38d('0x19')](_0x1a91cf);}return _0x6786a2[_0xd38d('0x1a')](_0x1a91cf)['end']();};}function respondWithResult(_0x3f4009,_0x279726){_0x279726=_0x279726||0xc8;return function(_0x46f412){if(_0x46f412){return _0x3f4009[_0xd38d('0x1a')](_0x279726)['json'](_0x46f412);}};}function respondWithFilteredResult(_0x307d74,_0x41faac){return function(_0x2081bc){if(_0x2081bc){var _0x29068d=typeof _0x41faac[_0xd38d('0x1b')]==='undefined'&&typeof _0x41faac[_0xd38d('0x1c')]===_0xd38d('0x1d');var _0x569d93=_0x2081bc[_0xd38d('0x1e')];var _0x2c5674=_0x29068d?0x0:_0x41faac[_0xd38d('0x1b')];var _0x53f389=_0x29068d?_0x2081bc[_0xd38d('0x1e')]:_0x41faac['offset']+_0x41faac['limit'];var _0x4e7f9a;if(_0x53f389>=_0x569d93){_0x53f389=_0x569d93;_0x4e7f9a=0xc8;}else{_0x4e7f9a=0xce;}_0x307d74['status'](_0x4e7f9a);return _0x307d74[_0xd38d('0x1f')](_0xd38d('0x20'),_0x2c5674+'-'+_0x53f389+'/'+_0x569d93)['json'](_0x2081bc);}return null;};}function patchUpdates(_0x79072a){return function(_0x20034a){try{jsonpatch[_0xd38d('0x21')](_0x20034a,_0x79072a,!![]);}catch(_0x294f2b){return BPromise['reject'](_0x294f2b);}return _0x20034a['save']();};}function saveUpdates(_0x3b80f7,_0x14782e){return function(_0x3fa934){if(_0x3fa934){return _0x3fa934['update'](_0x3b80f7)[_0xd38d('0x22')](function(_0x4264cc){return _0x4264cc;});}return null;};}function removeEntity(_0x4efba9,_0x36f82d){return function(_0x492ea1){if(_0x492ea1){return _0x492ea1[_0xd38d('0x23')]()[_0xd38d('0x22')](function(){_0x4efba9[_0xd38d('0x1a')](0xcc)[_0xd38d('0x24')]();});}};}function handleEntityNotFound(_0x375c86,_0x20ae52){return function(_0x379043){if(!_0x379043){_0x375c86[_0xd38d('0x19')](0x194);}return _0x379043;};}function handleError(_0x38be71,_0x1cfbf7){_0x1cfbf7=_0x1cfbf7||0x1f4;return function(_0x5ce47b){logger[_0xd38d('0x25')](_0x5ce47b[_0xd38d('0x26')]);if(_0x5ce47b[_0xd38d('0x27')]){delete _0x5ce47b[_0xd38d('0x27')];}_0x38be71[_0xd38d('0x1a')](_0x1cfbf7)['send'](_0x5ce47b);};}exports[_0xd38d('0x28')]=function(_0x1bfc7f,_0x3fb616){var _0x22bed0={},_0x3c7573={},_0x5e01eb={'count':0x0,'rows':[]};var _0x43ca68=_[_0xd38d('0x29')](db[_0xd38d('0x2a')][_0xd38d('0x2b')],function(_0x66a927){return{'name':_0x66a927['fieldName'],'type':_0x66a927['type'][_0xd38d('0x2c')]};});_0x3c7573[_0xd38d('0x2d')]=_[_0xd38d('0x29')](_0x43ca68,_0xd38d('0x27'));_0x3c7573[_0xd38d('0x2e')]=_['keys'](_0x1bfc7f[_0xd38d('0x2e')]);_0x3c7573[_0xd38d('0x2f')]=_['intersection'](_0x3c7573[_0xd38d('0x2d')],_0x3c7573[_0xd38d('0x2e')]);_0x22bed0[_0xd38d('0x30')]=_[_0xd38d('0x31')](_0x3c7573[_0xd38d('0x2d')],qs[_0xd38d('0x32')](_0x1bfc7f[_0xd38d('0x2e')][_0xd38d('0x32')]));_0x22bed0[_0xd38d('0x30')]=_0x22bed0[_0xd38d('0x30')][_0xd38d('0x33')]?_0x22bed0[_0xd38d('0x30')]:_0x3c7573[_0xd38d('0x2d')];if(!_0x1bfc7f[_0xd38d('0x2e')][_0xd38d('0x34')]('nolimit')){_0x22bed0[_0xd38d('0x1c')]=qs[_0xd38d('0x1c')](_0x1bfc7f[_0xd38d('0x2e')][_0xd38d('0x1c')]);_0x22bed0[_0xd38d('0x1b')]=qs[_0xd38d('0x1b')](_0x1bfc7f[_0xd38d('0x2e')]['offset']);}_0x22bed0[_0xd38d('0x35')]=qs[_0xd38d('0x36')](_0x1bfc7f[_0xd38d('0x2e')][_0xd38d('0x36')]);_0x22bed0['where']=qs[_0xd38d('0x2f')](_[_0xd38d('0x37')](_0x1bfc7f[_0xd38d('0x2e')],_0x3c7573[_0xd38d('0x2f')]),_0x43ca68);if(_0x1bfc7f[_0xd38d('0x2e')][_0xd38d('0x38')]){_0x22bed0[_0xd38d('0x39')]=_[_0xd38d('0x3a')](_0x22bed0[_0xd38d('0x39')],{'$or':_[_0xd38d('0x29')](_0x43ca68,function(_0x3eeac3){if(_0x3eeac3[_0xd38d('0x3b')]!==_0xd38d('0x3c')){var _0x2a8064={};_0x2a8064[_0x3eeac3[_0xd38d('0x27')]]={'$like':'%'+_0x1bfc7f['query'][_0xd38d('0x38')]+'%'};return _0x2a8064;}})});}_0x22bed0=_[_0xd38d('0x3a')]({},_0x22bed0,_0x1bfc7f['options']);var _0x598d91={'where':_0x22bed0['where']};return db[_0xd38d('0x2a')][_0xd38d('0x1e')](_0x598d91)['then'](function(_0xd2ffff){_0x5e01eb['count']=_0xd2ffff;if(_0x1bfc7f['query']['includeAll']){_0x22bed0['include']=[{'all':!![]}];}return db['MailTransferReport'][_0xd38d('0x3d')](_0x22bed0);})[_0xd38d('0x22')](function(_0x13f3af){_0x5e01eb[_0xd38d('0x3e')]=_0x13f3af;return _0x5e01eb;})['then'](respondWithFilteredResult(_0x3fb616,_0x22bed0))[_0xd38d('0x3f')](handleError(_0x3fb616,null));};exports[_0xd38d('0x40')]=function(_0x2efde6,_0x5b5067){var _0x123def={'raw':!![],'where':{'id':_0x2efde6['params']['id']}},_0x4b897d={};_0x4b897d[_0xd38d('0x2d')]=_[_0xd38d('0x41')](db[_0xd38d('0x2a')][_0xd38d('0x2b')]);_0x4b897d[_0xd38d('0x2e')]=_[_0xd38d('0x41')](_0x2efde6[_0xd38d('0x2e')]);_0x4b897d[_0xd38d('0x2f')]=_[_0xd38d('0x31')](_0x4b897d[_0xd38d('0x2d')],_0x4b897d[_0xd38d('0x2e')]);_0x123def[_0xd38d('0x30')]=_[_0xd38d('0x31')](_0x4b897d['model'],qs[_0xd38d('0x32')](_0x2efde6[_0xd38d('0x2e')][_0xd38d('0x32')]));_0x123def[_0xd38d('0x30')]=_0x123def[_0xd38d('0x30')][_0xd38d('0x33')]?_0x123def[_0xd38d('0x30')]:_0x4b897d[_0xd38d('0x2d')];if(_0x2efde6['query'][_0xd38d('0x42')]){_0x123def[_0xd38d('0x43')]=[{'all':!![]}];}_0x123def=_[_0xd38d('0x3a')]({},_0x123def,_0x2efde6[_0xd38d('0x44')]);return db[_0xd38d('0x2a')][_0xd38d('0x45')](_0x123def)['then'](handleEntityNotFound(_0x5b5067,null))[_0xd38d('0x22')](respondWithResult(_0x5b5067,null))[_0xd38d('0x3f')](handleError(_0x5b5067,null));};exports['create']=function(_0x1d325f,_0x1ba7be){return db[_0xd38d('0x2a')][_0xd38d('0x46')](_0x1d325f[_0xd38d('0x47')],{})[_0xd38d('0x22')](respondWithResult(_0x1ba7be,0xc9))[_0xd38d('0x3f')](handleError(_0x1ba7be,null));};exports['update']=function(_0x143453,_0x54d4cd){if(_0x143453[_0xd38d('0x47')]['id']){delete _0x143453[_0xd38d('0x47')]['id'];}return db[_0xd38d('0x2a')][_0xd38d('0x45')]({'where':{'id':_0x143453['params']['id']}})[_0xd38d('0x22')](handleEntityNotFound(_0x54d4cd,null))['then'](saveUpdates(_0x143453[_0xd38d('0x47')],null))[_0xd38d('0x22')](respondWithResult(_0x54d4cd,null))[_0xd38d('0x3f')](handleError(_0x54d4cd,null));};exports[_0xd38d('0x23')]=function(_0x2ed648,_0x4d7314){return db[_0xd38d('0x2a')][_0xd38d('0x45')]({'where':{'id':_0x2ed648[_0xd38d('0x48')]['id']}})['then'](handleEntityNotFound(_0x4d7314,null))[_0xd38d('0x22')](removeEntity(_0x4d7314,null))[_0xd38d('0x3f')](handleError(_0x4d7314,null));};exports[_0xd38d('0x49')]=function(_0x40184b,_0x1b0057){return db[_0xd38d('0x2a')]['describe']()['then'](respondWithResult(_0x1b0057,null))['catch'](handleError(_0x1b0057,null));}; \ No newline at end of file +var _0x1d7a=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../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','Content-Range','apply','reject','save','then','destroy','end','error','name','index','map','MailTransferReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x1d7a,0x136));var _0xa1d7=function(_0x1aa8f6,_0x1f1c93){_0x1aa8f6=_0x1aa8f6-0x0;var _0x3050ea=_0x1d7a[_0x1aa8f6];return _0x3050ea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa1d7('0x0'));var jsonpatch=require(_0xa1d7('0x1'));var rp=require('request-promise');var moment=require(_0xa1d7('0x2'));var BPromise=require(_0xa1d7('0x3'));var Mustache=require(_0xa1d7('0x4'));var util=require('util');var path=require(_0xa1d7('0x5'));var sox=require(_0xa1d7('0x6'));var csv=require(_0xa1d7('0x7'));var ejs=require(_0xa1d7('0x8'));var fs=require('fs');var fs_extra=require(_0xa1d7('0x9'));var _=require('lodash');var squel=require(_0xa1d7('0xa'));var crypto=require(_0xa1d7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa1d7('0x7'));var querystring=require('querystring');var Papa=require(_0xa1d7('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa1d7('0xd'));var as=require(_0xa1d7('0xe'));var hardwareService=require(_0xa1d7('0xf'));var logger=require(_0xa1d7('0x10'))(_0xa1d7('0x11'));var utils=require(_0xa1d7('0x12'));var config=require(_0xa1d7('0x13'));var licenseUtil=require(_0xa1d7('0x14'));var db=require(_0xa1d7('0x15'))['db'];function respondWithStatusCode(_0x91e835,_0xe5f982){_0xe5f982=_0xe5f982||0xcc;return function(_0x2836db){if(_0x2836db){return _0x91e835[_0xa1d7('0x16')](_0xe5f982);}return _0x91e835[_0xa1d7('0x17')](_0xe5f982)['end']();};}function respondWithResult(_0x26464e,_0x46fdab){_0x46fdab=_0x46fdab||0xc8;return function(_0x3938f7){if(_0x3938f7){return _0x26464e['status'](_0x46fdab)[_0xa1d7('0x18')](_0x3938f7);}};}function respondWithFilteredResult(_0x991cd0,_0x56da45){return function(_0x4ed760){if(_0x4ed760){var _0x5b5668=typeof _0x56da45[_0xa1d7('0x19')]===_0xa1d7('0x1a')&&typeof _0x56da45[_0xa1d7('0x1b')]===_0xa1d7('0x1a');var _0x1aa4ae=_0x4ed760[_0xa1d7('0x1c')];var _0x214fdc=_0x5b5668?0x0:_0x56da45[_0xa1d7('0x19')];var _0x5aa6fd=_0x5b5668?_0x4ed760[_0xa1d7('0x1c')]:_0x56da45[_0xa1d7('0x19')]+_0x56da45[_0xa1d7('0x1b')];var _0x49c3ae;if(_0x5aa6fd>=_0x1aa4ae){_0x5aa6fd=_0x1aa4ae;_0x49c3ae=0xc8;}else{_0x49c3ae=0xce;}_0x991cd0[_0xa1d7('0x17')](_0x49c3ae);return _0x991cd0['set'](_0xa1d7('0x1d'),_0x214fdc+'-'+_0x5aa6fd+'/'+_0x1aa4ae)[_0xa1d7('0x18')](_0x4ed760);}return null;};}function patchUpdates(_0x575db8){return function(_0xccfea9){try{jsonpatch[_0xa1d7('0x1e')](_0xccfea9,_0x575db8,!![]);}catch(_0x3c796c){return BPromise[_0xa1d7('0x1f')](_0x3c796c);}return _0xccfea9[_0xa1d7('0x20')]();};}function saveUpdates(_0x42c4a6,_0x2a4e9b){return function(_0x309265){if(_0x309265){return _0x309265['update'](_0x42c4a6)[_0xa1d7('0x21')](function(_0x3b4706){return _0x3b4706;});}return null;};}function removeEntity(_0x45c244,_0x2f766d){return function(_0x3fb92b){if(_0x3fb92b){return _0x3fb92b[_0xa1d7('0x22')]()['then'](function(){_0x45c244[_0xa1d7('0x17')](0xcc)[_0xa1d7('0x23')]();});}};}function handleEntityNotFound(_0x4a916b,_0x44a3ce){return function(_0xca0402){if(!_0xca0402){_0x4a916b[_0xa1d7('0x16')](0x194);}return _0xca0402;};}function handleError(_0x5e264c,_0x3a9d5f){_0x3a9d5f=_0x3a9d5f||0x1f4;return function(_0x514dcf){logger[_0xa1d7('0x24')](_0x514dcf['stack']);if(_0x514dcf['name']){delete _0x514dcf[_0xa1d7('0x25')];}_0x5e264c[_0xa1d7('0x17')](_0x3a9d5f)['send'](_0x514dcf);};}exports[_0xa1d7('0x26')]=function(_0x5834c4,_0x25b8e){var _0x5e2648={},_0x31e0ca={},_0x3fc058={'count':0x0,'rows':[]};var _0x4fea34=_[_0xa1d7('0x27')](db[_0xa1d7('0x28')][_0xa1d7('0x29')],function(_0x353760){return{'name':_0x353760['fieldName'],'type':_0x353760['type'][_0xa1d7('0x2a')]};});_0x31e0ca[_0xa1d7('0x2b')]=_[_0xa1d7('0x27')](_0x4fea34,'name');_0x31e0ca[_0xa1d7('0x2c')]=_[_0xa1d7('0x2d')](_0x5834c4['query']);_0x31e0ca[_0xa1d7('0x2e')]=_[_0xa1d7('0x2f')](_0x31e0ca[_0xa1d7('0x2b')],_0x31e0ca['query']);_0x5e2648[_0xa1d7('0x30')]=_['intersection'](_0x31e0ca[_0xa1d7('0x2b')],qs[_0xa1d7('0x31')](_0x5834c4[_0xa1d7('0x2c')][_0xa1d7('0x31')]));_0x5e2648[_0xa1d7('0x30')]=_0x5e2648[_0xa1d7('0x30')][_0xa1d7('0x32')]?_0x5e2648[_0xa1d7('0x30')]:_0x31e0ca[_0xa1d7('0x2b')];if(!_0x5834c4[_0xa1d7('0x2c')][_0xa1d7('0x33')](_0xa1d7('0x34'))){_0x5e2648['limit']=qs[_0xa1d7('0x1b')](_0x5834c4[_0xa1d7('0x2c')][_0xa1d7('0x1b')]);_0x5e2648[_0xa1d7('0x19')]=qs[_0xa1d7('0x19')](_0x5834c4[_0xa1d7('0x2c')]['offset']);}_0x5e2648[_0xa1d7('0x35')]=qs['sort'](_0x5834c4['query'][_0xa1d7('0x36')]);_0x5e2648[_0xa1d7('0x37')]=qs[_0xa1d7('0x2e')](_[_0xa1d7('0x38')](_0x5834c4[_0xa1d7('0x2c')],_0x31e0ca[_0xa1d7('0x2e')]),_0x4fea34);if(_0x5834c4[_0xa1d7('0x2c')][_0xa1d7('0x39')]){_0x5e2648[_0xa1d7('0x37')]=_[_0xa1d7('0x3a')](_0x5e2648[_0xa1d7('0x37')],{'$or':_[_0xa1d7('0x27')](_0x4fea34,function(_0x2ec417){if(_0x2ec417['type']!=='VIRTUAL'){var _0x20ffd7={};_0x20ffd7[_0x2ec417[_0xa1d7('0x25')]]={'$like':'%'+_0x5834c4['query'][_0xa1d7('0x39')]+'%'};return _0x20ffd7;}})});}_0x5e2648=_[_0xa1d7('0x3a')]({},_0x5e2648,_0x5834c4[_0xa1d7('0x3b')]);var _0x4ce094={'where':_0x5e2648[_0xa1d7('0x37')]};return db[_0xa1d7('0x28')][_0xa1d7('0x1c')](_0x4ce094)[_0xa1d7('0x21')](function(_0x50a78f){_0x3fc058['count']=_0x50a78f;if(_0x5834c4[_0xa1d7('0x2c')][_0xa1d7('0x3c')]){_0x5e2648[_0xa1d7('0x3d')]=[{'all':!![]}];}return db[_0xa1d7('0x28')][_0xa1d7('0x3e')](_0x5e2648);})[_0xa1d7('0x21')](function(_0x4c4627){_0x3fc058[_0xa1d7('0x3f')]=_0x4c4627;return _0x3fc058;})[_0xa1d7('0x21')](respondWithFilteredResult(_0x25b8e,_0x5e2648))[_0xa1d7('0x40')](handleError(_0x25b8e,null));};exports[_0xa1d7('0x41')]=function(_0x206b2f,_0x22bd44){var _0x3087cc={'raw':!![],'where':{'id':_0x206b2f[_0xa1d7('0x42')]['id']}},_0x30d04a={};_0x30d04a[_0xa1d7('0x2b')]=_[_0xa1d7('0x2d')](db[_0xa1d7('0x28')][_0xa1d7('0x29')]);_0x30d04a[_0xa1d7('0x2c')]=_[_0xa1d7('0x2d')](_0x206b2f[_0xa1d7('0x2c')]);_0x30d04a['filters']=_[_0xa1d7('0x2f')](_0x30d04a[_0xa1d7('0x2b')],_0x30d04a['query']);_0x3087cc[_0xa1d7('0x30')]=_[_0xa1d7('0x2f')](_0x30d04a[_0xa1d7('0x2b')],qs['fields'](_0x206b2f['query'][_0xa1d7('0x31')]));_0x3087cc[_0xa1d7('0x30')]=_0x3087cc[_0xa1d7('0x30')]['length']?_0x3087cc[_0xa1d7('0x30')]:_0x30d04a['model'];if(_0x206b2f[_0xa1d7('0x2c')][_0xa1d7('0x3c')]){_0x3087cc[_0xa1d7('0x3d')]=[{'all':!![]}];}_0x3087cc=_['merge']({},_0x3087cc,_0x206b2f[_0xa1d7('0x3b')]);return db['MailTransferReport']['find'](_0x3087cc)['then'](handleEntityNotFound(_0x22bd44,null))[_0xa1d7('0x21')](respondWithResult(_0x22bd44,null))[_0xa1d7('0x40')](handleError(_0x22bd44,null));};exports[_0xa1d7('0x43')]=function(_0xcb90b,_0x3a3547){return db[_0xa1d7('0x28')][_0xa1d7('0x43')](_0xcb90b[_0xa1d7('0x44')],{})[_0xa1d7('0x21')](respondWithResult(_0x3a3547,0xc9))[_0xa1d7('0x40')](handleError(_0x3a3547,null));};exports[_0xa1d7('0x45')]=function(_0x408cba,_0x50a5a6){if(_0x408cba[_0xa1d7('0x44')]['id']){delete _0x408cba['body']['id'];}return db['MailTransferReport'][_0xa1d7('0x46')]({'where':{'id':_0x408cba[_0xa1d7('0x42')]['id']}})[_0xa1d7('0x21')](handleEntityNotFound(_0x50a5a6,null))[_0xa1d7('0x21')](saveUpdates(_0x408cba[_0xa1d7('0x44')],null))['then'](respondWithResult(_0x50a5a6,null))['catch'](handleError(_0x50a5a6,null));};exports[_0xa1d7('0x22')]=function(_0x38925b,_0x20d163){return db[_0xa1d7('0x28')][_0xa1d7('0x46')]({'where':{'id':_0x38925b[_0xa1d7('0x42')]['id']}})[_0xa1d7('0x21')](handleEntityNotFound(_0x20d163,null))[_0xa1d7('0x21')](removeEntity(_0x20d163,null))['catch'](handleError(_0x20d163,null));};exports[_0xa1d7('0x47')]=function(_0x260abc,_0x356f01){return db[_0xa1d7('0x28')]['describe']()[_0xa1d7('0x21')](respondWithResult(_0x356f01,null))['catch'](handleError(_0x356f01,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 55c6f9a..62a6171 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 _0x33c5=['request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0x1b8a6c,_0x4c2a5f){var _0x13ec3b=function(_0x53e579){while(--_0x53e579){_0x1b8a6c['push'](_0x1b8a6c['shift']());}};_0x13ec3b(++_0x4c2a5f);}(_0x33c5,0xe6));var _0x533c=function(_0x1d3046,_0x8b14e1){_0x1d3046=_0x1d3046-0x0;var _0x3b9b62=_0x33c5[_0x1d3046];return _0x3b9b62;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var logger=require(_0x533c('0x1'))('api');var moment=require(_0x533c('0x2'));var BPromise=require(_0x533c('0x3'));var rp=require(_0x533c('0x4'));var fs=require('fs');var path=require(_0x533c('0x5'));var rimraf=require(_0x533c('0x6'));var config=require('../../config/environment');var attributes=require(_0x533c('0x7'));module[_0x533c('0x8')]=function(_0x31d912,_0x151732){return _0x31d912[_0x533c('0x9')](_0x533c('0xa'),attributes,{'tableName':_0x533c('0xb'),'paranoid':![],'indexes':[{'name':_0x533c('0xc'),'fields':[_0x533c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5900=['../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2ff5aa,_0x4d251f){var _0x366c91=function(_0x205a2d){while(--_0x205a2d){_0x2ff5aa['push'](_0x2ff5aa['shift']());}};_0x366c91(++_0x4d251f);}(_0x5900,0xd2));var _0x0590=function(_0x5f2d31,_0x4a7572){_0x5f2d31=_0x5f2d31-0x0;var _0x39f6e8=_0x5900[_0x5f2d31];return _0x39f6e8;};'use strict';var _=require('lodash');var util=require(_0x0590('0x0'));var logger=require(_0x0590('0x1'))('api');var moment=require(_0x0590('0x2'));var BPromise=require(_0x0590('0x3'));var rp=require(_0x0590('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0590('0x5'));var config=require(_0x0590('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0x0590('0x7')]=function(_0x1d9927,_0x494b17){return _0x1d9927[_0x0590('0x8')](_0x0590('0x9'),attributes,{'tableName':_0x0590('0xa'),'paranoid':![],'indexes':[{'name':_0x0590('0xb'),'fields':[_0x0590('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index a33e366..1dc5dd2 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 _0x6684=['bluebird','randomstring','../../mysqldb','../../config/utils','client','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment'];(function(_0x393438,_0x4883a6){var _0x2a0986=function(_0x15a93b){while(--_0x15a93b){_0x393438['push'](_0x393438['shift']());}};_0x2a0986(++_0x4883a6);}(_0x6684,0xb1));var _0x4668=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x6684[_0x354164];return _0x5db9a8;};'use strict';var _=require(_0x4668('0x0'));var util=require(_0x4668('0x1'));var moment=require(_0x4668('0x2'));var BPromise=require(_0x4668('0x3'));var rs=require(_0x4668('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4668('0x5'))['db'];var utils=require(_0x4668('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4668('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x114dbf,_0x3168db,_0x342ef0){return new BPromise(function(_0x200276,_0x4b5f8e){return client[_0x4668('0x8')](_0x114dbf,_0x342ef0)[_0x4668('0x9')](function(_0x228a3b){logger['info'](_0x4668('0xa'),_0x3168db,_0x4668('0xb'));logger[_0x4668('0xc')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x3168db,_0x4668('0xb'),JSON[_0x4668('0xd')](_0x228a3b));if(_0x228a3b[_0x4668('0xe')]){if(_0x228a3b[_0x4668('0xe')]['code']===0x1f4){logger[_0x4668('0xe')](_0x4668('0xa'),_0x3168db,_0x228a3b[_0x4668('0xe')]['message']);return _0x4b5f8e(_0x228a3b['error'][_0x4668('0xf')]);}logger[_0x4668('0xe')](_0x4668('0xa'),_0x3168db,_0x228a3b[_0x4668('0xe')]['message']);return _0x200276(_0x228a3b[_0x4668('0xe')][_0x4668('0xf')]);}else{logger[_0x4668('0x10')](_0x4668('0xa'),_0x3168db,_0x4668('0xb'));_0x200276(_0x228a3b[_0x4668('0x11')][_0x4668('0xf')]);}})['catch'](function(_0x5269e5){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x3168db,_0x5269e5);_0x4b5f8e(_0x5269e5);});});} \ No newline at end of file +var _0xda47=['result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0xda47,0xc0));var _0x7da4=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xda47[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require(_0x7da4('0x0'));var moment=require(_0x7da4('0x1'));var BPromise=require(_0x7da4('0x2'));var rs=require(_0x7da4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7da4('0x4'));var logger=require(_0x7da4('0x5'))(_0x7da4('0x6'));var config=require('../../config/environment');var jayson=require(_0x7da4('0x7'));var client=jayson[_0x7da4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d2e8e,_0x1eb0e7,_0xb9c09a){return new BPromise(function(_0x27e159,_0x2e540c){return client['request'](_0x1d2e8e,_0xb9c09a)[_0x7da4('0x9')](function(_0x54ad99){logger['info'](_0x7da4('0xa'),_0x1eb0e7,'request\x20sent');logger[_0x7da4('0xb')](_0x7da4('0xc'),_0x1eb0e7,_0x7da4('0xd'),JSON[_0x7da4('0xe')](_0x54ad99));if(_0x54ad99[_0x7da4('0xf')]){if(_0x54ad99[_0x7da4('0xf')]['code']===0x1f4){logger[_0x7da4('0xf')](_0x7da4('0xa'),_0x1eb0e7,_0x54ad99['error'][_0x7da4('0x10')]);return _0x2e540c(_0x54ad99['error'][_0x7da4('0x10')]);}logger[_0x7da4('0xf')](_0x7da4('0xa'),_0x1eb0e7,_0x54ad99[_0x7da4('0xf')][_0x7da4('0x10')]);return _0x27e159(_0x54ad99[_0x7da4('0xf')][_0x7da4('0x10')]);}else{logger['info'](_0x7da4('0xa'),_0x1eb0e7,_0x7da4('0xd'));_0x27e159(_0x54ad99[_0x7da4('0x11')]['message']);}})[_0x7da4('0x12')](function(_0x1cc64a){logger[_0x7da4('0xf')](_0x7da4('0xa'),_0x1eb0e7,_0x1cc64a);_0x2e540c(_0x1cc64a);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index d5c36f4..5908534 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 _0x7938=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x9ad8b,_0xd6b992){var _0x2e8a20=function(_0x2c22b4){while(--_0x2c22b4){_0x9ad8b['push'](_0x9ad8b['shift']());}};_0x2e8a20(++_0xd6b992);}(_0x7938,0x12e));var _0x8793=function(_0x2b3b93,_0x274a12){_0x2b3b93=_0x2b3b93-0x0;var _0x335266=_0x7938[_0x2b3b93];return _0x335266;};'use strict';var multer=require(_0x8793('0x0'));var util=require('util');var path=require(_0x8793('0x1'));var timeout=require(_0x8793('0x2'));var express=require(_0x8793('0x3'));var router=express[_0x8793('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8793('0x5'));var config=require(_0x8793('0x6'));var controller=require('./memberReport.controller');router['get']('/',auth[_0x8793('0x7')](),controller[_0x8793('0x8')]);router[_0x8793('0x9')]('/describe',auth[_0x8793('0x7')](),controller[_0x8793('0xa')]);router[_0x8793('0x9')](_0x8793('0xb'),auth[_0x8793('0x7')](),controller[_0x8793('0xc')]);router['post']('/',auth[_0x8793('0x7')](),controller[_0x8793('0xd')]);router[_0x8793('0xe')]('/:id',auth[_0x8793('0x7')](),controller[_0x8793('0xf')]);router[_0x8793('0x10')]('/:id',auth[_0x8793('0x7')](),controller[_0x8793('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4726=['get','/describe','describe','/:id','show','post','create','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index'];(function(_0xdbed4c,_0x1156e6){var _0x9f5b92=function(_0x2dd084){while(--_0x2dd084){_0xdbed4c['push'](_0xdbed4c['shift']());}};_0x9f5b92(++_0x1156e6);}(_0x4726,0x1e4));var _0x6472=function(_0x4a3244,_0x2ad39d){_0x4a3244=_0x4a3244-0x0;var _0x17ecaf=_0x4726[_0x4a3244];return _0x17ecaf;};'use strict';var multer=require(_0x6472('0x0'));var util=require(_0x6472('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6472('0x2'));var router=express['Router']();var fs_extra=require(_0x6472('0x3'));var auth=require(_0x6472('0x4'));var interaction=require(_0x6472('0x5'));var config=require(_0x6472('0x6'));var controller=require(_0x6472('0x7'));router['get']('/',auth[_0x6472('0x8')](),controller[_0x6472('0x9')]);router[_0x6472('0xa')](_0x6472('0xb'),auth[_0x6472('0x8')](),controller[_0x6472('0xc')]);router['get'](_0x6472('0xd'),auth[_0x6472('0x8')](),controller[_0x6472('0xe')]);router[_0x6472('0xf')]('/',auth[_0x6472('0x8')](),controller[_0x6472('0x10')]);router['put'](_0x6472('0xd'),auth[_0x6472('0x8')](),controller['update']);router['delete'](_0x6472('0xd'),auth['isAuthenticated'](),controller[_0x6472('0x11')]);module[_0x6472('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 90cfd1b..10b851d 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 _0x1619=['talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1619,0xff));var _0x9161=function(_0x491a1b,_0x345b25){_0x491a1b=_0x491a1b-0x0;var _0x112170=_0x1619[_0x491a1b];return _0x112170;};'use strict';var Sequelize=require(_0x9161('0x0'));var moment=require(_0x9161('0x1'));module[_0x9161('0x2')]={'channel':{'type':Sequelize[_0x9161('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9161('0x3')],'defaultValue':_0x9161('0x4'),'comment':_0x9161('0x5')},'duration':{'type':Sequelize[_0x9161('0x6')]},'enterAt':{'type':Sequelize[_0x9161('0x7')]},'exitAt':{'type':Sequelize[_0x9161('0x7')],'set':function(_0x124c69){var _0x2365e4=moment(_0x124c69);var _0x44c37b=moment(this[_0x9161('0x8')](_0x9161('0x9')));var _0xd3de30=_0x2365e4[_0x9161('0xa')](_0x44c37b,_0x9161('0xb'));this[_0x9161('0xc')](_0x9161('0xd'),_0x124c69);this[_0x9161('0xc')]('duration',_0xd3de30>=0x0?_0xd3de30:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x9161('0xe')},'data2':{'type':Sequelize[_0x9161('0x3')],'comment':_0x9161('0xf')},'data3':{'type':Sequelize[_0x9161('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x9161('0x3')],'comment':_0x9161('0x10')},'data5':{'type':Sequelize[_0x9161('0x3')],'comment':_0x9161('0x11')},'role':{'type':Sequelize[_0x9161('0x3')]},'internal':{'type':Sequelize[_0x9161('0x6')]},'uniqueid':{'type':Sequelize[_0x9161('0x3')]}}; \ No newline at end of file +var _0x931c=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x5a0215,_0x19ef64){var _0x3ae62f=function(_0x63afdb){while(--_0x63afdb){_0x5a0215['push'](_0x5a0215['shift']());}};_0x3ae62f(++_0x19ef64);}(_0x931c,0x14d));var _0xc931=function(_0x3bc58c,_0x3d6b7b){_0x3bc58c=_0x3bc58c-0x0;var _0x2a10f1=_0x931c[_0x3bc58c];return _0x2a10f1;};'use strict';var Sequelize=require(_0xc931('0x0'));var moment=require(_0xc931('0x1'));module[_0xc931('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc931('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xc931('0x4'),'comment':_0xc931('0x5')},'duration':{'type':Sequelize[_0xc931('0x6')]},'enterAt':{'type':Sequelize[_0xc931('0x7')]},'exitAt':{'type':Sequelize[_0xc931('0x7')],'set':function(_0x31b99a){var _0x448f89=moment(_0x31b99a);var _0x485217=moment(this[_0xc931('0x8')]('enterAt'));var _0x6d005a=_0x448f89[_0xc931('0x9')](_0x485217,'seconds');this[_0xc931('0xa')]('exitAt',_0x31b99a);this[_0xc931('0xa')](_0xc931('0xb'),_0x6d005a>=0x0?_0x6d005a:null);}},'data1':{'type':Sequelize[_0xc931('0x3')],'comment':_0xc931('0xc')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xc931('0x3')],'comment':_0xc931('0xd')},'data4':{'type':Sequelize[_0xc931('0x3')],'comment':_0xc931('0xe')},'data5':{'type':Sequelize[_0xc931('0x3')],'comment':_0xc931('0xf')},'role':{'type':Sequelize[_0xc931('0x3')]},'internal':{'type':Sequelize[_0xc931('0x6')]},'uniqueid':{'type':Sequelize[_0xc931('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 638c2f2..789ff70 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x34e8,0x12c));var _0x834e=function(_0x3c7310,_0x31f215){_0x3c7310=_0x3c7310-0x0;var _0x211ec7=_0x34e8[_0x3c7310];return _0x211ec7;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xedd9,0xfc));var _0x9edd=function(_0x21cfe4,_0x5ff11d){_0x21cfe4=_0x21cfe4-0x0;var _0x43834d=_0xedd9[_0x21cfe4];return _0x43834d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index f903f8f..dbaab00 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 _0x2192=['lodash','util','api','moment','bluebird','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername','interface'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x2192,0x1a0));var _0x2219=function(_0x51d9a5,_0x15c41a){_0x51d9a5=_0x51d9a5-0x0;var _0x38e7ac=_0x2192[_0x51d9a5];return _0x38e7ac;};'use strict';var _=require(_0x2219('0x0'));var util=require(_0x2219('0x1'));var logger=require('../../config/logger')(_0x2219('0x2'));var moment=require(_0x2219('0x3'));var BPromise=require(_0x2219('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2219('0x5'));var config=require('../../config/environment');var attributes=require(_0x2219('0x6'));module[_0x2219('0x7')]=function(_0x1b28ca,_0x2dc670){return _0x1b28ca[_0x2219('0x8')](_0x2219('0x9'),attributes,{'tableName':_0x2219('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x2219('0xb'),_0x2219('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ebb=['./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8ebb,0x88));var _0xb8eb=function(_0x30fbbf,_0x2f16de){_0x30fbbf=_0x30fbbf-0x0;var _0x947ef0=_0x8ebb[_0x30fbbf];return _0x947ef0;};'use strict';var _=require(_0xb8eb('0x0'));var util=require('util');var logger=require(_0xb8eb('0x1'))(_0xb8eb('0x2'));var moment=require('moment');var BPromise=require(_0xb8eb('0x3'));var rp=require(_0xb8eb('0x4'));var fs=require('fs');var path=require(_0xb8eb('0x5'));var rimraf=require(_0xb8eb('0x6'));var config=require(_0xb8eb('0x7'));var attributes=require(_0xb8eb('0x8'));module[_0xb8eb('0x9')]=function(_0x201a9d,_0x3d34df){return _0x201a9d[_0xb8eb('0xa')](_0xb8eb('0xb'),attributes,{'tableName':_0xb8eb('0xc'),'paranoid':![],'indexes':[{'name':_0xb8eb('0xd'),'fields':[_0xb8eb('0xe'),_0xb8eb('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 593a1b8..b72ec39 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 _0x7958=['MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMemberReport','MemberReport','options','where','attributes','limit','include','model','map','catch','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2937a7,_0x274e4a){var _0x1b9b15=function(_0x8718c6){while(--_0x8718c6){_0x2937a7['push'](_0x2937a7['shift']());}};_0x1b9b15(++_0x274e4a);}(_0x7958,0x126));var _0x8795=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7958[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var moment=require('moment');var BPromise=require(_0x8795('0x2'));var rs=require(_0x8795('0x3'));var fs=require('fs');var Redis=require(_0x8795('0x4'));var db=require(_0x8795('0x5'))['db'];var utils=require(_0x8795('0x6'));var logger=require(_0x8795('0x7'))(_0x8795('0x8'));var config=require(_0x8795('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8795('0xa')][_0x8795('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427ba5,_0x527da1,_0x12c15c){return new BPromise(function(_0x4ea71f,_0x10506d){return client[_0x8795('0xc')](_0x427ba5,_0x12c15c)[_0x8795('0xd')](function(_0x29746f){logger[_0x8795('0xe')](_0x8795('0xf'),_0x527da1,_0x8795('0x10'));logger[_0x8795('0x11')](_0x8795('0x12'),_0x527da1,_0x8795('0x10'),JSON[_0x8795('0x13')](_0x29746f));if(_0x29746f[_0x8795('0x14')]){if(_0x29746f[_0x8795('0x14')]['code']===0x1f4){logger[_0x8795('0x14')](_0x8795('0xf'),_0x527da1,_0x29746f[_0x8795('0x14')][_0x8795('0x15')]);return _0x10506d(_0x29746f[_0x8795('0x14')][_0x8795('0x15')]);}logger[_0x8795('0x14')]('MemberReport,\x20%s,\x20%s',_0x527da1,_0x29746f['error']['message']);return _0x4ea71f(_0x29746f[_0x8795('0x14')][_0x8795('0x15')]);}else{logger[_0x8795('0xe')](_0x8795('0xf'),_0x527da1,_0x8795('0x10'));_0x4ea71f(_0x29746f[_0x8795('0x16')][_0x8795('0x15')]);}})['catch'](function(_0x15f1db){logger['error'](_0x8795('0xf'),_0x527da1,_0x15f1db);_0x10506d(_0x15f1db);});});}exports[_0x8795('0x17')]=function(_0x498eea){var _0x2e5452=this;return new Promise(function(_0x322110,_0x275f1f){return db[_0x8795('0x18')]['findAll']({'raw':_0x498eea[_0x8795('0x19')]?_0x498eea[_0x8795('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x498eea[_0x8795('0x19')]?_0x498eea[_0x8795('0x19')][_0x8795('0x1a')]||null:null,'attributes':_0x498eea[_0x8795('0x19')]?_0x498eea['options'][_0x8795('0x1b')]||null:null,'limit':_0x498eea['options']?_0x498eea['options'][_0x8795('0x1c')]||null:null,'include':_0x498eea['options']?_0x498eea[_0x8795('0x19')][_0x8795('0x1d')]?_['map'](_0x498eea[_0x8795('0x19')][_0x8795('0x1d')],function(_0xb1becd){return{'model':db[_0xb1becd[_0x8795('0x1e')]],'as':_0xb1becd['as'],'attributes':_0xb1becd[_0x8795('0x1b')],'include':_0xb1becd[_0x8795('0x1d')]?_['map'](_0xb1becd['include'],function(_0x163707){return{'model':db[_0x163707['model']],'as':_0x163707['as'],'attributes':_0x163707[_0x8795('0x1b')],'include':_0x163707[_0x8795('0x1d')]?_[_0x8795('0x1f')](_0x163707[_0x8795('0x1d')],function(_0x26365b){return{'model':db[_0x26365b['model']],'as':_0x26365b['as'],'attributes':_0x26365b[_0x8795('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8795('0xd')](function(_0x5e06c5){logger[_0x8795('0xe')](_0x8795('0x17'),_0x498eea);logger[_0x8795('0x11')](_0x8795('0x17'),_0x498eea,JSON[_0x8795('0x13')](_0x5e06c5));_0x322110(_0x5e06c5);})[_0x8795('0x20')](function(_0x41428b){logger[_0x8795('0x14')](_0x8795('0x17'),_0x41428b[_0x8795('0x15')],_0x498eea);_0x275f1f(_0x2e5452[_0x8795('0x14')](0x1f4,_0x41428b['message']));});});};exports[_0x8795('0x21')]=function(_0xa5c815){var _0x3aab08=this;return new Promise(function(_0x2840b5,_0x4fbaee){return db[_0x8795('0x18')][_0x8795('0x22')](_0xa5c815[_0x8795('0x23')],{'raw':_0xa5c815[_0x8795('0x19')]?_0xa5c815[_0x8795('0x19')][_0x8795('0x24')]===undefined?!![]:![]:!![]})[_0x8795('0xd')](function(_0x2a358a){logger['info']('CreateMemberReport',_0xa5c815);logger[_0x8795('0x11')](_0x8795('0x21'),_0xa5c815,JSON[_0x8795('0x13')](_0x2a358a));_0x2840b5(_0x2a358a);})[_0x8795('0x20')](function(_0x4f556f){logger[_0x8795('0x14')](_0x8795('0x21'),_0x4f556f[_0x8795('0x15')],_0xa5c815);_0x4fbaee(_0x3aab08[_0x8795('0x14')](0x1f4,_0x4f556f[_0x8795('0x15')]));});});};exports[_0x8795('0x25')]=function(_0x3f10a6){var _0x3677af=this;return new Promise(function(_0x3809f0,_0x33fcdb){return db[_0x8795('0x18')][_0x8795('0x26')](_0x3f10a6[_0x8795('0x23')],{'raw':_0x3f10a6[_0x8795('0x19')]?_0x3f10a6[_0x8795('0x19')][_0x8795('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f10a6[_0x8795('0x19')]?_0x3f10a6[_0x8795('0x19')][_0x8795('0x1a')]||null:null,'attributes':_0x3f10a6[_0x8795('0x19')]?_0x3f10a6[_0x8795('0x19')][_0x8795('0x1b')]||null:null,'limit':_0x3f10a6[_0x8795('0x19')]?_0x3f10a6[_0x8795('0x19')][_0x8795('0x1c')]||null:null})[_0x8795('0xd')](function(_0x5b26a2){logger['info'](_0x8795('0x25'),_0x3f10a6);logger[_0x8795('0x11')](_0x8795('0x25'),_0x3f10a6,JSON[_0x8795('0x13')](_0x5b26a2));_0x3809f0(_0x5b26a2);})['catch'](function(_0x182878){logger['error'](_0x8795('0x25'),_0x182878[_0x8795('0x15')],_0x3f10a6);_0x33fcdb(_0x3677af['error'](0x1f4,_0x182878[_0x8795('0x15')]));});});}; \ No newline at end of file +var _0xd1f9=['../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','options','raw','limit','include','map','model','attributes','CreateMemberReport','MemberReport','UpdateMemberReport','update','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x402db2,_0x2c84ad){var _0x526a5f=function(_0x41a5d0){while(--_0x41a5d0){_0x402db2['push'](_0x402db2['shift']());}};_0x526a5f(++_0x2c84ad);}(_0xd1f9,0x88));var _0x9d1f=function(_0x5bc4ca,_0x21f738){_0x5bc4ca=_0x5bc4ca-0x0;var _0x12bf3b=_0xd1f9[_0x5bc4ca];return _0x12bf3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d1f('0x0'));var BPromise=require(_0x9d1f('0x1'));var rs=require(_0x9d1f('0x2'));var fs=require('fs');var Redis=require(_0x9d1f('0x3'));var db=require(_0x9d1f('0x4'))['db'];var utils=require(_0x9d1f('0x5'));var logger=require(_0x9d1f('0x6'))(_0x9d1f('0x7'));var config=require(_0x9d1f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d1f('0x9')][_0x9d1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c146b,_0x432319,_0x10ce17){return new BPromise(function(_0x270b08,_0xb6b61c){return client[_0x9d1f('0xb')](_0x2c146b,_0x10ce17)[_0x9d1f('0xc')](function(_0x259a49){logger[_0x9d1f('0xd')](_0x9d1f('0xe'),_0x432319,_0x9d1f('0xf'));logger[_0x9d1f('0x10')](_0x9d1f('0x11'),_0x432319,_0x9d1f('0xf'),JSON[_0x9d1f('0x12')](_0x259a49));if(_0x259a49[_0x9d1f('0x13')]){if(_0x259a49[_0x9d1f('0x13')]['code']===0x1f4){logger[_0x9d1f('0x13')](_0x9d1f('0xe'),_0x432319,_0x259a49[_0x9d1f('0x13')]['message']);return _0xb6b61c(_0x259a49[_0x9d1f('0x13')]['message']);}logger['error'](_0x9d1f('0xe'),_0x432319,_0x259a49[_0x9d1f('0x13')][_0x9d1f('0x14')]);return _0x270b08(_0x259a49[_0x9d1f('0x13')][_0x9d1f('0x14')]);}else{logger[_0x9d1f('0xd')](_0x9d1f('0xe'),_0x432319,_0x9d1f('0xf'));_0x270b08(_0x259a49[_0x9d1f('0x15')][_0x9d1f('0x14')]);}})[_0x9d1f('0x16')](function(_0x1dd0bd){logger[_0x9d1f('0x13')]('MemberReport,\x20%s,\x20%s',_0x432319,_0x1dd0bd);_0xb6b61c(_0x1dd0bd);});});}exports[_0x9d1f('0x17')]=function(_0x42a2b4){var _0x4e5328=this;return new Promise(function(_0x329b69,_0x4f7224){return db['MemberReport']['findAll']({'raw':_0x42a2b4[_0x9d1f('0x18')]?_0x42a2b4[_0x9d1f('0x18')][_0x9d1f('0x19')]===undefined?!![]:![]:!![],'where':_0x42a2b4['options']?_0x42a2b4[_0x9d1f('0x18')]['where']||null:null,'attributes':_0x42a2b4[_0x9d1f('0x18')]?_0x42a2b4['options']['attributes']||null:null,'limit':_0x42a2b4[_0x9d1f('0x18')]?_0x42a2b4[_0x9d1f('0x18')][_0x9d1f('0x1a')]||null:null,'include':_0x42a2b4[_0x9d1f('0x18')]?_0x42a2b4[_0x9d1f('0x18')][_0x9d1f('0x1b')]?_[_0x9d1f('0x1c')](_0x42a2b4[_0x9d1f('0x18')][_0x9d1f('0x1b')],function(_0xc05aa){return{'model':db[_0xc05aa[_0x9d1f('0x1d')]],'as':_0xc05aa['as'],'attributes':_0xc05aa[_0x9d1f('0x1e')],'include':_0xc05aa[_0x9d1f('0x1b')]?_[_0x9d1f('0x1c')](_0xc05aa['include'],function(_0x2b234d){return{'model':db[_0x2b234d[_0x9d1f('0x1d')]],'as':_0x2b234d['as'],'attributes':_0x2b234d['attributes'],'include':_0x2b234d['include']?_[_0x9d1f('0x1c')](_0x2b234d[_0x9d1f('0x1b')],function(_0x3ca450){return{'model':db[_0x3ca450[_0x9d1f('0x1d')]],'as':_0x3ca450['as'],'attributes':_0x3ca450[_0x9d1f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47fc5e){logger[_0x9d1f('0xd')](_0x9d1f('0x17'),_0x42a2b4);logger[_0x9d1f('0x10')](_0x9d1f('0x17'),_0x42a2b4,JSON[_0x9d1f('0x12')](_0x47fc5e));_0x329b69(_0x47fc5e);})[_0x9d1f('0x16')](function(_0x48fbf5){logger[_0x9d1f('0x13')]('GetMemberReport',_0x48fbf5[_0x9d1f('0x14')],_0x42a2b4);_0x4f7224(_0x4e5328[_0x9d1f('0x13')](0x1f4,_0x48fbf5[_0x9d1f('0x14')]));});});};exports[_0x9d1f('0x1f')]=function(_0x1bb45e){var _0x57f521=this;return new Promise(function(_0x350089,_0x24dfcb){return db[_0x9d1f('0x20')]['create'](_0x1bb45e['body'],{'raw':_0x1bb45e[_0x9d1f('0x18')]?_0x1bb45e[_0x9d1f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9d1f('0xc')](function(_0x3de2d1){logger[_0x9d1f('0xd')](_0x9d1f('0x1f'),_0x1bb45e);logger['debug'](_0x9d1f('0x1f'),_0x1bb45e,JSON[_0x9d1f('0x12')](_0x3de2d1));_0x350089(_0x3de2d1);})[_0x9d1f('0x16')](function(_0x24c6ef){logger['error'](_0x9d1f('0x1f'),_0x24c6ef['message'],_0x1bb45e);_0x24dfcb(_0x57f521[_0x9d1f('0x13')](0x1f4,_0x24c6ef[_0x9d1f('0x14')]));});});};exports[_0x9d1f('0x21')]=function(_0x51f465){var _0x35f7d5=this;return new Promise(function(_0x12cb01,_0x324242){return db[_0x9d1f('0x20')][_0x9d1f('0x22')](_0x51f465['body'],{'raw':_0x51f465[_0x9d1f('0x18')]?_0x51f465[_0x9d1f('0x18')][_0x9d1f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51f465[_0x9d1f('0x18')]?_0x51f465[_0x9d1f('0x18')][_0x9d1f('0x23')]||null:null,'attributes':_0x51f465[_0x9d1f('0x18')]?_0x51f465['options'][_0x9d1f('0x1e')]||null:null,'limit':_0x51f465[_0x9d1f('0x18')]?_0x51f465[_0x9d1f('0x18')][_0x9d1f('0x1a')]||null:null})['then'](function(_0x459bbe){logger['info']('UpdateMemberReport',_0x51f465);logger['debug'](_0x9d1f('0x21'),_0x51f465,JSON[_0x9d1f('0x12')](_0x459bbe));_0x12cb01(_0x459bbe);})['catch'](function(_0x347435){logger[_0x9d1f('0x13')](_0x9d1f('0x21'),_0x347435[_0x9d1f('0x14')],_0x51f465);_0x324242(_0x35f7d5[_0x9d1f('0x13')](0x1f4,_0x347435[_0x9d1f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d5e8183..16165e2 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 _0x27e3=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x27e3,0x15d));var _0x327e=function(_0x4ef689,_0xa167a0){_0x4ef689=_0x4ef689-0x0;var _0x2852c1=_0x27e3[_0x4ef689];return _0x2852c1;};'use strict';var multer=require('multer');var util=require(_0x327e('0x0'));var path=require(_0x327e('0x1'));var timeout=require(_0x327e('0x2'));var express=require(_0x327e('0x3'));var router=express['Router']();var fs_extra=require(_0x327e('0x4'));var auth=require(_0x327e('0x5'));var interaction=require(_0x327e('0x6'));var config=require(_0x327e('0x7'));var controller=require(_0x327e('0x8'));router[_0x327e('0x9')]('/',controller[_0x327e('0xa')]);module[_0x327e('0xb')]=router; \ No newline at end of file +var _0xbca8=['fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express'];(function(_0x1da4e3,_0x26224b){var _0x368452=function(_0x41a252){while(--_0x41a252){_0x1da4e3['push'](_0x1da4e3['shift']());}};_0x368452(++_0x26224b);}(_0xbca8,0xf7));var _0x8bca=function(_0x5327e5,_0x5a5907){_0x5327e5=_0x5327e5-0x0;var _0x1b5612=_0xbca8[_0x5327e5];return _0x1b5612;};'use strict';var multer=require(_0x8bca('0x0'));var util=require(_0x8bca('0x1'));var path=require(_0x8bca('0x2'));var timeout=require(_0x8bca('0x3'));var express=require(_0x8bca('0x4'));var router=express['Router']();var fs_extra=require(_0x8bca('0x5'));var auth=require(_0x8bca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8bca('0x7'));var controller=require(_0x8bca('0x8'));router[_0x8bca('0x9')]('/',controller[_0x8bca('0xa')]);module[_0x8bca('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 9eb8a79..8546acb 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 _0x465b=['STRING','version'];(function(_0x5606ad,_0x3b265b){var _0x1ee1b0=function(_0x123753){while(--_0x123753){_0x5606ad['push'](_0x5606ad['shift']());}};_0x1ee1b0(++_0x3b265b);}(_0x465b,0xfe));var _0xb465=function(_0x1f4cbf,_0x1ec5fe){_0x1f4cbf=_0x1f4cbf-0x0;var _0x53e928=_0x465b[_0x1f4cbf];return _0x53e928;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0xb465('0x0')],'unique':_0xb465('0x1')}}; \ No newline at end of file +var _0x81b2=['sequelize','STRING','version'];(function(_0x2891d1,_0x2ddd3e){var _0x486948=function(_0x13fa0f){while(--_0x13fa0f){_0x2891d1['push'](_0x2891d1['shift']());}};_0x486948(++_0x2ddd3e);}(_0x81b2,0x81));var _0x281b=function(_0xb5a041,_0x394f01){_0xb5a041=_0xb5a041-0x0;var _0x187974=_0x81b2[_0xb5a041];return _0x187974;};'use strict';var Sequelize=require(_0x281b('0x0'));module['exports']={'version':{'type':Sequelize[_0x281b('0x1')],'unique':_0x281b('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d6390d7..f54ef7f 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 _0x594a=['nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Migration','fieldName','key','model','query','attributes','fields','length'];(function(_0xb5f08f,_0x209ba7){var _0x1e2b5d=function(_0x4cc14c){while(--_0x4cc14c){_0xb5f08f['push'](_0xb5f08f['shift']());}};_0x1e2b5d(++_0x209ba7);}(_0x594a,0x1a5));var _0xa594=function(_0x1251ce,_0x1ba8d2){_0x1251ce=_0x1251ce-0x0;var _0x12d3b1=_0x594a[_0x1251ce];return _0x12d3b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa594('0x0'));var zipdir=require(_0xa594('0x1'));var jsonpatch=require(_0xa594('0x2'));var rp=require(_0xa594('0x3'));var moment=require(_0xa594('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa594('0x5'));var util=require(_0xa594('0x6'));var path=require(_0xa594('0x7'));var sox=require(_0xa594('0x8'));var csv=require(_0xa594('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa594('0xa'));var _=require(_0xa594('0xb'));var squel=require(_0xa594('0xc'));var crypto=require(_0xa594('0xd'));var jsforce=require(_0xa594('0xe'));var deskjs=require(_0xa594('0xf'));var toCsv=require(_0xa594('0x9'));var querystring=require(_0xa594('0x10'));var Papa=require(_0xa594('0x11'));var Redis=require(_0xa594('0x12'));var authService=require(_0xa594('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa594('0x14'))(_0xa594('0x15'));var utils=require(_0xa594('0x16'));var config=require(_0xa594('0x17'));var licenseUtil=require(_0xa594('0x18'));var db=require(_0xa594('0x19'))['db'];function respondWithStatusCode(_0x3e60d0,_0x3c39d1){_0x3c39d1=_0x3c39d1||0xcc;return function(_0x389203){if(_0x389203){return _0x3e60d0[_0xa594('0x1a')](_0x3c39d1);}return _0x3e60d0['status'](_0x3c39d1)[_0xa594('0x1b')]();};}function respondWithResult(_0x14a0eb,_0x1b997c){_0x1b997c=_0x1b997c||0xc8;return function(_0x1ee574){if(_0x1ee574){return _0x14a0eb[_0xa594('0x1c')](_0x1b997c)['json'](_0x1ee574);}};}function respondWithFilteredResult(_0x38562c,_0x28f8ef){return function(_0x14780c){if(_0x14780c){var _0x133ddc=typeof _0x28f8ef[_0xa594('0x1d')]===_0xa594('0x1e')&&typeof _0x28f8ef[_0xa594('0x1f')]===_0xa594('0x1e');var _0x4f23bd=_0x14780c[_0xa594('0x20')];var _0x28b050=_0x133ddc?0x0:_0x28f8ef[_0xa594('0x1d')];var _0x29ae37=_0x133ddc?_0x14780c[_0xa594('0x20')]:_0x28f8ef[_0xa594('0x1d')]+_0x28f8ef[_0xa594('0x1f')];var _0x2478b1;if(_0x29ae37>=_0x4f23bd){_0x29ae37=_0x4f23bd;_0x2478b1=0xc8;}else{_0x2478b1=0xce;}_0x38562c[_0xa594('0x1c')](_0x2478b1);return _0x38562c['set'](_0xa594('0x21'),_0x28b050+'-'+_0x29ae37+'/'+_0x4f23bd)[_0xa594('0x22')](_0x14780c);}return null;};}function patchUpdates(_0x5652e4){return function(_0x24d0f9){try{jsonpatch[_0xa594('0x23')](_0x24d0f9,_0x5652e4,!![]);}catch(_0x2bd2cc){return BPromise[_0xa594('0x24')](_0x2bd2cc);}return _0x24d0f9[_0xa594('0x25')]();};}function saveUpdates(_0x4ac615,_0x1eab5e){return function(_0x618321){if(_0x618321){return _0x618321[_0xa594('0x26')](_0x4ac615)['then'](function(_0x11c8d0){return _0x11c8d0;});}return null;};}function removeEntity(_0xc34edc,_0x24660d){return function(_0x1b0cde){if(_0x1b0cde){return _0x1b0cde[_0xa594('0x27')]()[_0xa594('0x28')](function(){_0xc34edc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f18b5,_0x21dacf){return function(_0x276e33){if(!_0x276e33){_0x3f18b5[_0xa594('0x1a')](0x194);}return _0x276e33;};}function handleError(_0x5abf7e,_0x4a320f){_0x4a320f=_0x4a320f||0x1f4;return function(_0x1236f3){logger[_0xa594('0x29')](_0x1236f3[_0xa594('0x2a')]);if(_0x1236f3[_0xa594('0x2b')]){delete _0x1236f3[_0xa594('0x2b')];}_0x5abf7e[_0xa594('0x1c')](_0x4a320f)[_0xa594('0x2c')](_0x1236f3);};}exports[_0xa594('0x2d')]=function(_0x431c51,_0x48ced5){var _0x290316={},_0x15aa92={},_0x28df19={'count':0x0,'rows':[]};var _0x539d08=_[_0xa594('0x2e')](db[_0xa594('0x2f')]['rawAttributes'],function(_0x9c496){return{'name':_0x9c496[_0xa594('0x30')],'type':_0x9c496['type'][_0xa594('0x31')]};});_0x15aa92[_0xa594('0x32')]=_[_0xa594('0x2e')](_0x539d08,_0xa594('0x2b'));_0x15aa92['query']=_['keys'](_0x431c51[_0xa594('0x33')]);_0x15aa92['filters']=_['intersection'](_0x15aa92['model'],_0x15aa92['query']);_0x290316[_0xa594('0x34')]=_['intersection'](_0x15aa92[_0xa594('0x32')],qs[_0xa594('0x35')](_0x431c51[_0xa594('0x33')]['fields']));_0x290316[_0xa594('0x34')]=_0x290316['attributes'][_0xa594('0x36')]?_0x290316[_0xa594('0x34')]:_0x15aa92['model'];if(!_0x431c51[_0xa594('0x33')]['hasOwnProperty'](_0xa594('0x37'))){_0x290316[_0xa594('0x1f')]=qs['limit'](_0x431c51[_0xa594('0x33')][_0xa594('0x1f')]);_0x290316['offset']=qs[_0xa594('0x1d')](_0x431c51[_0xa594('0x33')][_0xa594('0x1d')]);}_0x290316[_0xa594('0x38')]=qs[_0xa594('0x39')](_0x431c51[_0xa594('0x33')]['sort']);_0x290316[_0xa594('0x3a')]=qs[_0xa594('0x3b')](_[_0xa594('0x3c')](_0x431c51[_0xa594('0x33')],_0x15aa92[_0xa594('0x3b')]),_0x539d08);if(_0x431c51[_0xa594('0x33')][_0xa594('0x3d')]){_0x290316[_0xa594('0x3a')]=_[_0xa594('0x3e')](_0x290316[_0xa594('0x3a')],{'$or':_[_0xa594('0x2e')](_0x539d08,function(_0x53fdcf){if(_0x53fdcf[_0xa594('0x3f')]!=='VIRTUAL'){var _0x7812e7={};_0x7812e7[_0x53fdcf[_0xa594('0x2b')]]={'$like':'%'+_0x431c51[_0xa594('0x33')][_0xa594('0x3d')]+'%'};return _0x7812e7;}})});}_0x290316=_['merge']({},_0x290316,_0x431c51['options']);var _0x57a777={'where':_0x290316[_0xa594('0x3a')]};return db[_0xa594('0x2f')]['count'](_0x57a777)[_0xa594('0x28')](function(_0x2ce2aa){_0x28df19[_0xa594('0x20')]=_0x2ce2aa;if(_0x431c51[_0xa594('0x33')][_0xa594('0x40')]){_0x290316[_0xa594('0x41')]=[{'all':!![]}];}return db[_0xa594('0x2f')][_0xa594('0x42')](_0x290316);})['then'](function(_0x4f5294){_0x28df19[_0xa594('0x43')]=_0x4f5294;return _0x28df19;})['then'](respondWithFilteredResult(_0x48ced5,_0x290316))['catch'](handleError(_0x48ced5,null));}; \ No newline at end of file +var _0x15be=['zip-dir','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','eml-format','rimraf'];(function(_0xf6816,_0x58e872){var _0x5d8336=function(_0x2b1c72){while(--_0x2b1c72){_0xf6816['push'](_0xf6816['shift']());}};_0x5d8336(++_0x58e872);}(_0x15be,0xc1));var _0xe15b=function(_0x4b3cb2,_0x850154){_0x4b3cb2=_0x4b3cb2-0x0;var _0x166410=_0x15be[_0x4b3cb2];return _0x166410;};'use strict';var emlformat=require(_0xe15b('0x0'));var rimraf=require(_0xe15b('0x1'));var zipdir=require(_0xe15b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe15b('0x3'));var moment=require(_0xe15b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe15b('0x5'));var util=require('util');var path=require(_0xe15b('0x6'));var sox=require('sox');var csv=require(_0xe15b('0x7'));var ejs=require(_0xe15b('0x8'));var fs=require('fs');var fs_extra=require(_0xe15b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe15b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe15b('0xb'));var toCsv=require(_0xe15b('0x7'));var querystring=require(_0xe15b('0xc'));var Papa=require('papaparse');var Redis=require(_0xe15b('0xd'));var authService=require(_0xe15b('0xe'));var qs=require(_0xe15b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe15b('0x10'));var logger=require(_0xe15b('0x11'))(_0xe15b('0x12'));var utils=require(_0xe15b('0x13'));var config=require(_0xe15b('0x14'));var licenseUtil=require(_0xe15b('0x15'));var db=require(_0xe15b('0x16'))['db'];function respondWithStatusCode(_0x23b9ba,_0x5354cd){_0x5354cd=_0x5354cd||0xcc;return function(_0x2be1c3){if(_0x2be1c3){return _0x23b9ba['sendStatus'](_0x5354cd);}return _0x23b9ba['status'](_0x5354cd)[_0xe15b('0x17')]();};}function respondWithResult(_0x531e9e,_0x351f33){_0x351f33=_0x351f33||0xc8;return function(_0x267423){if(_0x267423){return _0x531e9e[_0xe15b('0x18')](_0x351f33)[_0xe15b('0x19')](_0x267423);}};}function respondWithFilteredResult(_0x514245,_0x21fd49){return function(_0x22af00){if(_0x22af00){var _0x2abc54=typeof _0x21fd49[_0xe15b('0x1a')]===_0xe15b('0x1b')&&typeof _0x21fd49[_0xe15b('0x1c')]===_0xe15b('0x1b');var _0x51f844=_0x22af00[_0xe15b('0x1d')];var _0x39fbf2=_0x2abc54?0x0:_0x21fd49[_0xe15b('0x1a')];var _0x4e4306=_0x2abc54?_0x22af00['count']:_0x21fd49[_0xe15b('0x1a')]+_0x21fd49[_0xe15b('0x1c')];var _0x2844db;if(_0x4e4306>=_0x51f844){_0x4e4306=_0x51f844;_0x2844db=0xc8;}else{_0x2844db=0xce;}_0x514245[_0xe15b('0x18')](_0x2844db);return _0x514245[_0xe15b('0x1e')](_0xe15b('0x1f'),_0x39fbf2+'-'+_0x4e4306+'/'+_0x51f844)['json'](_0x22af00);}return null;};}function patchUpdates(_0x388983){return function(_0x6de3f0){try{jsonpatch[_0xe15b('0x20')](_0x6de3f0,_0x388983,!![]);}catch(_0x250e5d){return BPromise[_0xe15b('0x21')](_0x250e5d);}return _0x6de3f0['save']();};}function saveUpdates(_0x3715eb,_0x4b6c2a){return function(_0x250c53){if(_0x250c53){return _0x250c53[_0xe15b('0x22')](_0x3715eb)[_0xe15b('0x23')](function(_0x45afb5){return _0x45afb5;});}return null;};}function removeEntity(_0x5886fb,_0x184084){return function(_0x3ae883){if(_0x3ae883){return _0x3ae883[_0xe15b('0x24')]()['then'](function(){_0x5886fb[_0xe15b('0x18')](0xcc)[_0xe15b('0x17')]();});}};}function handleEntityNotFound(_0x57b208,_0x23eea){return function(_0x46cd18){if(!_0x46cd18){_0x57b208[_0xe15b('0x25')](0x194);}return _0x46cd18;};}function handleError(_0x17a416,_0x5452cb){_0x5452cb=_0x5452cb||0x1f4;return function(_0x2f9f62){logger[_0xe15b('0x26')](_0x2f9f62['stack']);if(_0x2f9f62[_0xe15b('0x27')]){delete _0x2f9f62[_0xe15b('0x27')];}_0x17a416[_0xe15b('0x18')](_0x5452cb)[_0xe15b('0x28')](_0x2f9f62);};}exports[_0xe15b('0x29')]=function(_0x523f13,_0x27a802){var _0x2ca943={},_0x1977b2={},_0x430c05={'count':0x0,'rows':[]};var _0x351f63=_[_0xe15b('0x2a')](db[_0xe15b('0x2b')][_0xe15b('0x2c')],function(_0x5d8c3a){return{'name':_0x5d8c3a[_0xe15b('0x2d')],'type':_0x5d8c3a[_0xe15b('0x2e')]['key']};});_0x1977b2[_0xe15b('0x2f')]=_[_0xe15b('0x2a')](_0x351f63,_0xe15b('0x27'));_0x1977b2[_0xe15b('0x30')]=_[_0xe15b('0x31')](_0x523f13[_0xe15b('0x30')]);_0x1977b2[_0xe15b('0x32')]=_[_0xe15b('0x33')](_0x1977b2[_0xe15b('0x2f')],_0x1977b2[_0xe15b('0x30')]);_0x2ca943[_0xe15b('0x34')]=_[_0xe15b('0x33')](_0x1977b2[_0xe15b('0x2f')],qs[_0xe15b('0x35')](_0x523f13['query'][_0xe15b('0x35')]));_0x2ca943['attributes']=_0x2ca943['attributes']['length']?_0x2ca943[_0xe15b('0x34')]:_0x1977b2[_0xe15b('0x2f')];if(!_0x523f13[_0xe15b('0x30')]['hasOwnProperty'](_0xe15b('0x36'))){_0x2ca943[_0xe15b('0x1c')]=qs[_0xe15b('0x1c')](_0x523f13[_0xe15b('0x30')][_0xe15b('0x1c')]);_0x2ca943[_0xe15b('0x1a')]=qs['offset'](_0x523f13[_0xe15b('0x30')]['offset']);}_0x2ca943['order']=qs[_0xe15b('0x37')](_0x523f13[_0xe15b('0x30')][_0xe15b('0x37')]);_0x2ca943[_0xe15b('0x38')]=qs[_0xe15b('0x32')](_[_0xe15b('0x39')](_0x523f13[_0xe15b('0x30')],_0x1977b2[_0xe15b('0x32')]),_0x351f63);if(_0x523f13[_0xe15b('0x30')][_0xe15b('0x3a')]){_0x2ca943[_0xe15b('0x38')]=_[_0xe15b('0x3b')](_0x2ca943[_0xe15b('0x38')],{'$or':_['map'](_0x351f63,function(_0x3c7210){if(_0x3c7210['type']!==_0xe15b('0x3c')){var _0x36b7e3={};_0x36b7e3[_0x3c7210[_0xe15b('0x27')]]={'$like':'%'+_0x523f13[_0xe15b('0x30')][_0xe15b('0x3a')]+'%'};return _0x36b7e3;}})});}_0x2ca943=_[_0xe15b('0x3b')]({},_0x2ca943,_0x523f13[_0xe15b('0x3d')]);var _0xa9e988={'where':_0x2ca943[_0xe15b('0x38')]};return db['Migration']['count'](_0xa9e988)['then'](function(_0x1353a4){_0x430c05['count']=_0x1353a4;if(_0x523f13[_0xe15b('0x30')]['includeAll']){_0x2ca943['include']=[{'all':!![]}];}return db['Migration'][_0xe15b('0x3e')](_0x2ca943);})[_0xe15b('0x23')](function(_0x18bea1){_0x430c05[_0xe15b('0x3f')]=_0x18bea1;return _0x430c05;})['then'](respondWithFilteredResult(_0x27a802,_0x2ca943))[_0xe15b('0x40')](handleError(_0x27a802,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 033e73b..60a1955 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 _0xc826=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0xc826,0x6c));var _0x6c82=function(_0x1ca75a,_0x2af57f){_0x1ca75a=_0x1ca75a-0x0;var _0x464339=_0xc826[_0x1ca75a];return _0x464339;};'use strict';var _=require(_0x6c82('0x0'));var util=require('util');var logger=require(_0x6c82('0x1'))(_0x6c82('0x2'));var moment=require(_0x6c82('0x3'));var BPromise=require(_0x6c82('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c82('0x5'));var rimraf=require(_0x6c82('0x6'));var config=require(_0x6c82('0x7'));var attributes=require(_0x6c82('0x8'));module[_0x6c82('0x9')]=function(_0x356039,_0x2be4a9){return _0x356039[_0x6c82('0xa')](_0x6c82('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70d1=['exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes'];(function(_0x5d58be,_0x32040d){var _0x7f6b42=function(_0x5e87fa){while(--_0x5e87fa){_0x5d58be['push'](_0x5d58be['shift']());}};_0x7f6b42(++_0x32040d);}(_0x70d1,0x16c));var _0x170d=function(_0x36888d,_0x22988e){_0x36888d=_0x36888d-0x0;var _0x14f524=_0x70d1[_0x36888d];return _0x14f524;};'use strict';var _=require(_0x170d('0x0'));var util=require(_0x170d('0x1'));var logger=require(_0x170d('0x2'))(_0x170d('0x3'));var moment=require(_0x170d('0x4'));var BPromise=require(_0x170d('0x5'));var rp=require(_0x170d('0x6'));var fs=require('fs');var path=require(_0x170d('0x7'));var rimraf=require(_0x170d('0x8'));var config=require(_0x170d('0x9'));var attributes=require(_0x170d('0xa'));module[_0x170d('0xb')]=function(_0x154d5b,_0x4ab28c){return _0x154d5b[_0x170d('0xc')](_0x170d('0xd'),attributes,{'tableName':_0x170d('0xe'),'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 23843cb..ca9038d 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 _0x6599=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','result','catch'];(function(_0x39cc7c,_0xa755db){var _0x1abc09=function(_0x4f203e){while(--_0x4f203e){_0x39cc7c['push'](_0x39cc7c['shift']());}};_0x1abc09(++_0xa755db);}(_0x6599,0xb0));var _0x9659=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x6599[_0x4063a4];return _0x17908d;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var moment=require(_0x9659('0x1'));var BPromise=require(_0x9659('0x2'));var rs=require(_0x9659('0x3'));var fs=require('fs');var Redis=require(_0x9659('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9659('0x5'));var logger=require('../../config/logger')(_0x9659('0x6'));var config=require('../../config/environment');var jayson=require(_0x9659('0x7'));var client=jayson[_0x9659('0x8')][_0x9659('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x478dfa,_0x4e4402,_0xabdd12){return new BPromise(function(_0x14cb81,_0x4d0a52){return client[_0x9659('0xa')](_0x478dfa,_0xabdd12)['then'](function(_0x23f34a){logger[_0x9659('0xb')]('Migration,\x20%s,\x20%s',_0x4e4402,_0x9659('0xc'));logger[_0x9659('0xd')](_0x9659('0xe'),_0x4e4402,'request\x20sent',JSON[_0x9659('0xf')](_0x23f34a));if(_0x23f34a['error']){if(_0x23f34a[_0x9659('0x10')][_0x9659('0x11')]===0x1f4){logger[_0x9659('0x10')]('Migration,\x20%s,\x20%s',_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x4d0a52(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);return _0x14cb81(_0x23f34a[_0x9659('0x10')][_0x9659('0x12')]);}else{logger[_0x9659('0xb')](_0x9659('0x13'),_0x4e4402,_0x9659('0xc'));_0x14cb81(_0x23f34a[_0x9659('0x14')]['message']);}})[_0x9659('0x15')](function(_0xd1ab56){logger[_0x9659('0x10')](_0x9659('0x13'),_0x4e4402,_0xd1ab56);_0x4d0a52(_0xd1ab56);});});} \ No newline at end of file +var _0x0fec=['moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','Migration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x30a068,_0x550cee){var _0x473115=function(_0x969f5d){while(--_0x969f5d){_0x30a068['push'](_0x30a068['shift']());}};_0x473115(++_0x550cee);}(_0x0fec,0x1ca));var _0xc0fe=function(_0x532dfd,_0x1ce2d9){_0x532dfd=_0x532dfd-0x0;var _0x2917ab=_0x0fec[_0x532dfd];return _0x2917ab;};'use strict';var _=require(_0xc0fe('0x0'));var util=require(_0xc0fe('0x1'));var moment=require(_0xc0fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0fe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0fe('0x4'));var logger=require(_0xc0fe('0x5'))('rpc');var config=require(_0xc0fe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc0fe('0x7')][_0xc0fe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cc359,_0x53e410,_0x5b3f5a){return new BPromise(function(_0x326ab7,_0x2cd914){return client[_0xc0fe('0x9')](_0x4cc359,_0x5b3f5a)['then'](function(_0x5e33c4){logger['info'](_0xc0fe('0xa'),_0x53e410,'request\x20sent');logger[_0xc0fe('0xb')]('Migration,\x20%s,\x20%s,\x20%s',_0x53e410,_0xc0fe('0xc'),JSON[_0xc0fe('0xd')](_0x5e33c4));if(_0x5e33c4[_0xc0fe('0xe')]){if(_0x5e33c4[_0xc0fe('0xe')][_0xc0fe('0xf')]===0x1f4){logger[_0xc0fe('0xe')]('Migration,\x20%s,\x20%s',_0x53e410,_0x5e33c4[_0xc0fe('0xe')][_0xc0fe('0x10')]);return _0x2cd914(_0x5e33c4['error']['message']);}logger['error'](_0xc0fe('0xa'),_0x53e410,_0x5e33c4[_0xc0fe('0xe')][_0xc0fe('0x10')]);return _0x326ab7(_0x5e33c4['error'][_0xc0fe('0x10')]);}else{logger[_0xc0fe('0x11')]('Migration,\x20%s,\x20%s',_0x53e410,'request\x20sent');_0x326ab7(_0x5e33c4[_0xc0fe('0x12')][_0xc0fe('0x10')]);}})[_0xc0fe('0x13')](function(_0x1dd571){logger[_0xc0fe('0xe')](_0xc0fe('0xa'),_0x53e410,_0x1dd571);_0x2cd914(_0x1dd571);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index e7f8bd5..6d93335 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 _0x070f=['/:id','show','post','put','delete','isAuthenticated','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x11673c,_0x3b7a07){var _0x3a0917=function(_0x3fc223){while(--_0x3fc223){_0x11673c['push'](_0x11673c['shift']());}};_0x3a0917(++_0x3b7a07);}(_0x070f,0x13a));var _0xf070=function(_0x2cf045,_0x42ec27){_0x2cf045=_0x2cf045-0x0;var _0x466d33=_0x070f[_0x2cf045];return _0x466d33;};'use strict';var multer=require(_0xf070('0x0'));var util=require('util');var path=require(_0xf070('0x1'));var timeout=require('connect-timeout');var express=require(_0xf070('0x2'));var router=express[_0xf070('0x3')]();var fs_extra=require(_0xf070('0x4'));var auth=require(_0xf070('0x5'));var interaction=require(_0xf070('0x6'));var config=require(_0xf070('0x7'));var controller=require('./network.controller');router[_0xf070('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf070('0x9'),auth['isAuthenticated'](),controller[_0xf070('0xa')]);router[_0xf070('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf070('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf070('0xd')](_0xf070('0x9'),auth[_0xf070('0xe')](),controller[_0xf070('0xf')]);module[_0xf070('0x10')]=router; \ No newline at end of file +var _0xb1ad=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xb1ad,0x184));var _0xdb1a=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb1ad[_0x1b5aea];return _0x15cfc6;};'use strict';var multer=require(_0xdb1a('0x0'));var util=require(_0xdb1a('0x1'));var path=require(_0xdb1a('0x2'));var timeout=require(_0xdb1a('0x3'));var express=require(_0xdb1a('0x4'));var router=express[_0xdb1a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdb1a('0x6'));var interaction=require(_0xdb1a('0x7'));var config=require(_0xdb1a('0x8'));var controller=require(_0xdb1a('0x9'));router[_0xdb1a('0xa')]('/',auth[_0xdb1a('0xb')](),controller[_0xdb1a('0xc')]);router[_0xdb1a('0xa')](_0xdb1a('0xd'),auth[_0xdb1a('0xb')](),controller[_0xdb1a('0xe')]);router[_0xdb1a('0xf')]('/',auth[_0xdb1a('0xb')](),controller[_0xdb1a('0x10')]);router[_0xdb1a('0x11')]('/:id',auth[_0xdb1a('0xb')](),controller[_0xdb1a('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xdb1a('0x13')]);module[_0xdb1a('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 262d11e..9f0c801 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 _0xbcc9=['exports','localnet','stun','turn','STRING'];(function(_0x1ecdc4,_0x2f495e){var _0x5ec3d3=function(_0x5e45e9){while(--_0x5e45e9){_0x1ecdc4['push'](_0x1ecdc4['shift']());}};_0x5ec3d3(++_0x2f495e);}(_0xbcc9,0x19f));var _0x9bcc=function(_0x15d6fc,_0x482d0e){_0x15d6fc=_0x15d6fc-0x0;var _0x1e5d9a=_0xbcc9[_0x15d6fc];return _0x1e5d9a;};'use strict';var Sequelize=require('sequelize');module[_0x9bcc('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9bcc('0x1'),'externip',_0x9bcc('0x2'),_0x9bcc('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9bcc('0x4')]},'password':{'type':Sequelize[_0x9bcc('0x4')]}}; \ No newline at end of file +var _0xf34b=['sequelize','exports','ENUM','localnet','externip','stun','STRING'];(function(_0x4cad64,_0x13a1d1){var _0x1ebb2d=function(_0x564d94){while(--_0x564d94){_0x4cad64['push'](_0x4cad64['shift']());}};_0x1ebb2d(++_0x13a1d1);}(_0xf34b,0x7e));var _0xbf34=function(_0x543dff,_0x13b83a){_0x543dff=_0x543dff-0x0;var _0x1117ce=_0xf34b[_0x543dff];return _0x1117ce;};'use strict';var Sequelize=require(_0xbf34('0x0'));module[_0xbf34('0x1')]={'type':{'type':Sequelize[_0xbf34('0x2')](_0xbf34('0x3'),_0xbf34('0x4'),_0xbf34('0x5'),'turn')},'value':{'type':Sequelize[_0xbf34('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index faa703e..ee51195 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 _0xe08e=['http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','undefined','offset','limit','set','Content-Range','update','sendStatus','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','count','includeAll','include','Network','rows','show','params','rawAttributes','merge','create','body','findAll','toUpperCase','STUN','join','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','TURN','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','readFileSync','server/files/templates/stun_multiple.ejs','server/files/templates/network.ejs','destroy','util','path','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client'];(function(_0x580264,_0x16d921){var _0x361f68=function(_0x16ca1c){while(--_0x16ca1c){_0x580264['push'](_0x580264['shift']());}};_0x361f68(++_0x16d921);}(_0xe08e,0x101));var _0xee08=function(_0x36be3a,_0x231b35){_0x36be3a=_0x36be3a-0x0;var _0x4867b3=_0xe08e[_0x36be3a];return _0x4867b3;};'use strict';var util=require(_0xee08('0x0'));var path=require(_0xee08('0x1'));var ejs=require(_0xee08('0x2'));var fs=require('fs');var _=require(_0xee08('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xee08('0x4'))(_0xee08('0x5'));var config=require(_0xee08('0x6'));var db=require(_0xee08('0x7'))['db'];var jayson=require(_0xee08('0x8'));var client=jayson[_0xee08('0x9')][_0xee08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ebed9,_0x378558,_0x495ae2,_0x41c1a){return new Promise(function(_0x1eb0e1,_0x5f6abc){var _0x45270a=_0x41c1a||client;return _0x45270a[_0xee08('0xb')](_0x5ebed9,_0x495ae2)[_0xee08('0xc')](function(_0x19ff39){logger[_0xee08('0xd')]('Network,\x20%s,\x20%s',_0x378558,_0xee08('0xe'));logger[_0xee08('0xf')](_0xee08('0x10'),_0x378558,_0xee08('0xe'),JSON[_0xee08('0x11')](_0x19ff39));if(_0x19ff39['error']){if(_0x19ff39[_0xee08('0x12')][_0xee08('0x13')]===0x1f4){logger['error'](_0xee08('0x14'),_0x378558,_0x19ff39[_0xee08('0x12')]['message']);return _0x5f6abc(_0x19ff39[_0xee08('0x12')]['message']);}logger[_0xee08('0x12')](_0xee08('0x14'),_0x378558,_0x19ff39[_0xee08('0x12')][_0xee08('0x15')]);return _0x1eb0e1(_0x19ff39[_0xee08('0x12')][_0xee08('0x15')]);}else{logger[_0xee08('0xd')]('Network,\x20%s,\x20%s',_0x378558,'request\x20sent');_0x1eb0e1(_0x19ff39[_0xee08('0x16')][_0xee08('0x15')]);}})[_0xee08('0x17')](function(_0x54f0af){logger[_0xee08('0x12')](_0xee08('0x14'),_0x378558,_0x54f0af);_0x5f6abc(_0x54f0af);});});}function respondWithResult(_0x311fc1,_0x15b51c){_0x15b51c=_0x15b51c||0xc8;return function(_0x2d82b6){if(_0x2d82b6){return _0x311fc1[_0xee08('0x18')](_0x15b51c)[_0xee08('0x19')](_0x2d82b6);}};}function respondWithFilteredResult(_0x1e3340,_0x4e380a){return function(_0x2a5eb2){if(_0x2a5eb2){var _0x41ed6d=typeof _0x4e380a['offset']===_0xee08('0x1a')&&typeof _0x4e380a['limit']===_0xee08('0x1a');var _0x587ca7=_0x2a5eb2['count'];var _0x171457=_0x41ed6d?0x0:_0x4e380a[_0xee08('0x1b')];var _0x477ae2=_0x41ed6d?_0x2a5eb2['count']:_0x4e380a[_0xee08('0x1b')]+_0x4e380a[_0xee08('0x1c')];var _0x275ce5;if(_0x477ae2>=_0x587ca7){_0x477ae2=_0x587ca7;_0x275ce5=0xc8;}else{_0x275ce5=0xce;}_0x1e3340[_0xee08('0x18')](_0x275ce5);return _0x1e3340[_0xee08('0x1d')](_0xee08('0x1e'),_0x171457+'-'+_0x477ae2+'/'+_0x587ca7)['json'](_0x2a5eb2);}return null;};}function saveUpdates(_0x36e155){return function(_0x2cb2b5){if(_0x2cb2b5){return _0x2cb2b5[_0xee08('0x1f')](_0x36e155)[_0xee08('0xc')](function(_0x2dccba){return _0x2dccba;});}return null;};}function removeEntity(_0x484ca6){return function(_0x409d61){if(_0x409d61){return _0x409d61['destroy']()[_0xee08('0xc')](function(){_0x484ca6[_0xee08('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaefa24){return function(_0x2d1e9a){if(!_0x2d1e9a){_0xaefa24[_0xee08('0x20')](0x194);}return _0x2d1e9a;};}function handleError(_0x3c8e6a,_0x1a2dfc){_0x1a2dfc=_0x1a2dfc||0x1f4;return function(_0xc6a0e){logger['error'](_0xc6a0e[_0xee08('0x21')]);if(_0xc6a0e[_0xee08('0x22')]){delete _0xc6a0e[_0xee08('0x22')];}_0x3c8e6a[_0xee08('0x18')](_0x1a2dfc)[_0xee08('0x23')](_0xc6a0e);};}exports[_0xee08('0x24')]=function(_0x3a9bae,_0x2c9a42){var _0x21985a={},_0x2f1714={},_0x5966f9={'count':0x0,'rows':[]};var _0x1067b1=_[_0xee08('0x25')](db['Network']['rawAttributes'],function(_0x142a09){return{'name':_0x142a09['fieldName'],'type':_0x142a09[_0xee08('0x26')][_0xee08('0x27')]};});_0x2f1714[_0xee08('0x28')]=_[_0xee08('0x25')](_0x1067b1,'name');_0x2f1714[_0xee08('0x29')]=_[_0xee08('0x2a')](_0x3a9bae[_0xee08('0x29')]);_0x2f1714[_0xee08('0x2b')]=_[_0xee08('0x2c')](_0x2f1714[_0xee08('0x28')],_0x2f1714[_0xee08('0x29')]);_0x21985a['attributes']=_[_0xee08('0x2c')](_0x2f1714[_0xee08('0x28')],qs[_0xee08('0x2d')](_0x3a9bae['query'][_0xee08('0x2d')]));_0x21985a[_0xee08('0x2e')]=_0x21985a['attributes']['length']?_0x21985a[_0xee08('0x2e')]:_0x2f1714[_0xee08('0x28')];if(!_0x3a9bae[_0xee08('0x29')][_0xee08('0x2f')](_0xee08('0x30'))){_0x21985a[_0xee08('0x1c')]=qs[_0xee08('0x1c')](_0x3a9bae['query'][_0xee08('0x1c')]);_0x21985a[_0xee08('0x1b')]=qs['offset'](_0x3a9bae[_0xee08('0x29')][_0xee08('0x1b')]);}_0x21985a[_0xee08('0x31')]=qs[_0xee08('0x32')](_0x3a9bae[_0xee08('0x29')][_0xee08('0x32')]);_0x21985a[_0xee08('0x33')]=qs[_0xee08('0x2b')](_[_0xee08('0x34')](_0x3a9bae['query'],_0x2f1714[_0xee08('0x2b')]),_0x1067b1);if(_0x3a9bae[_0xee08('0x29')]['filter']){_0x21985a[_0xee08('0x33')]=_['merge'](_0x21985a[_0xee08('0x33')],{'$or':_[_0xee08('0x25')](_0x1067b1,function(_0x50561c){if(_0x50561c[_0xee08('0x26')]!=='VIRTUAL'){var _0x1fc221={};_0x1fc221[_0x50561c[_0xee08('0x22')]]={'$like':'%'+_0x3a9bae[_0xee08('0x29')][_0xee08('0x35')]+'%'};return _0x1fc221;}})});}_0x21985a=_['merge']({},_0x21985a,_0x3a9bae[_0xee08('0x36')]);var _0x45fa8b={'where':_0x21985a[_0xee08('0x33')]};return db['Network'][_0xee08('0x37')](_0x45fa8b)[_0xee08('0xc')](function(_0x40f50c){_0x5966f9[_0xee08('0x37')]=_0x40f50c;if(_0x3a9bae[_0xee08('0x29')][_0xee08('0x38')]){_0x21985a[_0xee08('0x39')]=[{'all':!![]}];}return db[_0xee08('0x3a')]['findAll'](_0x21985a);})[_0xee08('0xc')](function(_0x3af6f2){_0x5966f9[_0xee08('0x3b')]=_0x3af6f2;return _0x5966f9;})['then'](respondWithFilteredResult(_0x2c9a42,_0x21985a))[_0xee08('0x17')](handleError(_0x2c9a42,null));};exports[_0xee08('0x3c')]=function(_0x6dcd03,_0x5250eb){var _0xc39d8a={'raw':!![],'where':{'id':_0x6dcd03[_0xee08('0x3d')]['id']}},_0x3f92f6={};_0x3f92f6[_0xee08('0x28')]=_['keys'](db[_0xee08('0x3a')][_0xee08('0x3e')]);_0x3f92f6[_0xee08('0x29')]=_[_0xee08('0x2a')](_0x6dcd03[_0xee08('0x29')]);_0x3f92f6['filters']=_['intersection'](_0x3f92f6['model'],_0x3f92f6[_0xee08('0x29')]);_0xc39d8a['attributes']=_[_0xee08('0x2c')](_0x3f92f6[_0xee08('0x28')],qs[_0xee08('0x2d')](_0x6dcd03['query'][_0xee08('0x2d')]));_0xc39d8a['attributes']=_0xc39d8a['attributes']['length']?_0xc39d8a[_0xee08('0x2e')]:_0x3f92f6[_0xee08('0x28')];if(_0x6dcd03[_0xee08('0x29')][_0xee08('0x38')]){_0xc39d8a[_0xee08('0x39')]=[{'all':!![]}];}_0xc39d8a=_[_0xee08('0x3f')]({},_0xc39d8a,_0x6dcd03[_0xee08('0x36')]);return db[_0xee08('0x3a')]['find'](_0xc39d8a)[_0xee08('0xc')](handleEntityNotFound(_0x5250eb,null))[_0xee08('0xc')](respondWithResult(_0x5250eb,null))[_0xee08('0x17')](handleError(_0x5250eb,null));};exports[_0xee08('0x40')]=function(_0x12741d,_0xdb426a){var _0x1bc5b0;return db['Network'][_0xee08('0x40')](_0x12741d[_0xee08('0x41')],{'raw':!![]})['then'](function(_0x245740){_0x1bc5b0=_0x245740;return db['Network'][_0xee08('0x42')]({'where':{'type':_0x12741d[_0xee08('0x41')][_0xee08('0x26')]},'raw':!![]});})['then'](function(_0x14759d){if(_0x1bc5b0[_0xee08('0x26')][_0xee08('0x43')]()==_0xee08('0x44')){var _0x5f1874=fs['readFileSync'](path[_0xee08('0x45')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xee08('0x46'));var _0x1e4084=ejs[_0xee08('0x47')](_0x5f1874,{'networks':_0x14759d||[]});fs['writeFileSync'](_0xee08('0x48'),_0x1e4084);return respondWithRpcPromise(_0xee08('0x49'),_0xee08('0x40'),{'module':'res_stun_monitor.so'});}else if(_0x1bc5b0[_0xee08('0x26')][_0xee08('0x43')]()==_0xee08('0x4a')){var _0x411c74=fs['readFileSync'](path[_0xee08('0x45')](config[_0xee08('0x4b')],_0xee08('0x4c')),_0xee08('0x46'));var _0x457a6a=ejs[_0xee08('0x47')](_0x411c74,{'networks':_0x14759d||[]});fs[_0xee08('0x4d')](_0xee08('0x4e'),_0x457a6a);return respondWithRpcPromise('Reload',_0xee08('0x40'),{'module':_0xee08('0x4f')});}else{var _0x45cd2c=fs['readFileSync'](path['join'](config[_0xee08('0x4b')],'server/files/templates/network.ejs'),_0xee08('0x46'));var _0x31adaa=ejs[_0xee08('0x47')](_0x45cd2c,{'networks':_0x14759d||[]});fs[_0xee08('0x4d')](util[_0xee08('0x50')](_0xee08('0x51'),_0x12741d[_0xee08('0x41')][_0xee08('0x26')][_0xee08('0x52')]()),_0x31adaa);return respondWithRpcPromise(_0xee08('0x49'),_0xee08('0x40'),{'module':_0xee08('0x53')});}})[_0xee08('0xc')](function(){return _0x1bc5b0;})[_0xee08('0xc')](respondWithResult(_0xdb426a,0xc9))[_0xee08('0x17')](handleError(_0xdb426a,null));};exports['update']=function(_0x55b679,_0x14dcdf){var _0x26c901;return db[_0xee08('0x3a')][_0xee08('0x54')]({'where':{'id':_0x55b679[_0xee08('0x3d')]['id']}})[_0xee08('0xc')](handleEntityNotFound(_0x14dcdf,null))['then'](saveUpdates(_0x55b679[_0xee08('0x41')],null))[_0xee08('0xc')](function(_0x2bda6c){if(_0x2bda6c){_0x26c901=_0x2bda6c;return db['Network']['findAll']({'where':{'type':_0x26c901[_0xee08('0x26')]},'raw':!![]});}return null;})[_0xee08('0xc')](function(_0x5d0ade){if(_0x26c901[_0xee08('0x26')][_0xee08('0x43')]()=='STUN'){var _0x54b566=fs[_0xee08('0x55')](path[_0xee08('0x45')](config[_0xee08('0x4b')],_0xee08('0x56')),_0xee08('0x46'));var _0x31f113=ejs['render'](_0x54b566,{'networks':_0x5d0ade||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x31f113);return respondWithRpcPromise(_0xee08('0x49'),_0xee08('0x1f'),{'module':_0xee08('0x4f')});}else if(_0x26c901[_0xee08('0x26')][_0xee08('0x43')]()==_0xee08('0x4a')){var _0x15feae=fs[_0xee08('0x55')](path['join'](config[_0xee08('0x4b')],_0xee08('0x4c')),_0xee08('0x46'));var _0x4f701c=ejs[_0xee08('0x47')](_0x15feae,{'networks':_0x5d0ade||[]});fs[_0xee08('0x4d')](_0xee08('0x4e'),_0x4f701c);return respondWithRpcPromise('Reload',_0xee08('0x1f'),{'module':'res_stun_monitor.so'});}else{var _0x45a701=fs['readFileSync'](path[_0xee08('0x45')](config[_0xee08('0x4b')],_0xee08('0x57')),_0xee08('0x46'));var _0x5e7a24=ejs['render'](_0x45a701,{'networks':_0x5d0ade||[]});fs[_0xee08('0x4d')](util['format'](_0xee08('0x51'),_0x55b679[_0xee08('0x41')]['type'][_0xee08('0x52')]()),_0x5e7a24);return respondWithRpcPromise(_0xee08('0x49'),'update',{'module':_0xee08('0x53')});}})[_0xee08('0xc')](function(_0x397a3d){if(_0x397a3d){return _0x26c901;}return null;})[_0xee08('0xc')](respondWithResult(_0x14dcdf,null))[_0xee08('0x17')](handleError(_0x14dcdf,null));};exports[_0xee08('0x58')]=function(_0x49058e,_0x5cd51b){var _0x1809f1;return db['Network'][_0xee08('0x54')]({'where':{'id':_0x49058e['params']['id']}})[_0xee08('0xc')](function(_0x4d910c){_0x1809f1=_0x4d910c;return _0x4d910c;})[_0xee08('0xc')](handleEntityNotFound(_0x5cd51b,null))['then'](removeEntity(_0x5cd51b,null))[_0xee08('0xc')](function(){if(_0x1809f1){return db[_0xee08('0x3a')][_0xee08('0x42')]({'where':{'type':_0x1809f1[_0xee08('0x26')]},'raw':!![]});}})['then'](function(_0x5566d8){if(_0x1809f1['type']['toUpperCase']()==_0xee08('0x44')){var _0x1d90ee=fs[_0xee08('0x55')](path[_0xee08('0x45')](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x100497=ejs[_0xee08('0x47')](_0x1d90ee,{'networks':_0x5566d8||[]});fs[_0xee08('0x4d')]('/etc/asterisk/stun_xcally.conf',_0x100497);return respondWithRpcPromise(_0xee08('0x49'),_0xee08('0x58'),{'module':_0xee08('0x4f')});}else if(_0x1809f1[_0xee08('0x26')][_0xee08('0x43')]()==_0xee08('0x4a')){var _0x3f0163=fs[_0xee08('0x55')](path[_0xee08('0x45')](config[_0xee08('0x4b')],_0xee08('0x4c')),_0xee08('0x46'));var _0xca578d=ejs[_0xee08('0x47')](_0x3f0163,{'networks':_0x5566d8||[]});fs[_0xee08('0x4d')](_0xee08('0x4e'),_0xca578d);return respondWithRpcPromise(_0xee08('0x49'),_0xee08('0x58'),{'module':_0xee08('0x4f')});}else{var _0x3da1c6=fs[_0xee08('0x55')](path[_0xee08('0x45')](config[_0xee08('0x4b')],'server/files/templates/network.ejs'),'utf8');var _0x3aa226=ejs[_0xee08('0x47')](_0x3da1c6,{'networks':_0x5566d8||[]});fs['writeFileSync'](util[_0xee08('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x1809f1[_0xee08('0x26')][_0xee08('0x52')]()),_0x3aa226);return respondWithRpcPromise(_0xee08('0x49'),_0xee08('0x58'),{'module':_0xee08('0x53')});}})[_0xee08('0x17')](handleError(_0x5cd51b,null));}; \ No newline at end of file +var _0x655e=['length','attributes','hasOwnProperty','nolimit','sort','where','filter','type','merge','options','includeAll','include','findAll','rows','show','keys','find','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','create','res_stun_monitor.so','toUpperCase','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','update','TURN','server/files/templates/turn_multiple.ejs','format','params','util','path','lodash','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','stack','name','index','map','Network','rawAttributes','fieldName','model','query','filters','intersection','fields'];(function(_0x3673bd,_0x156cea){var _0x2bc009=function(_0x4ad72e){while(--_0x4ad72e){_0x3673bd['push'](_0x3673bd['shift']());}};_0x2bc009(++_0x156cea);}(_0x655e,0x11c));var _0xe655=function(_0x2bd1f0,_0x19f306){_0x2bd1f0=_0x2bd1f0-0x0;var _0x4112db=_0x655e[_0x2bd1f0];return _0x4112db;};'use strict';var util=require(_0xe655('0x0'));var path=require(_0xe655('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe655('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xe655('0x3'))('api');var config=require(_0xe655('0x4'));var db=require(_0xe655('0x5'))['db'];var jayson=require(_0xe655('0x6'));var client=jayson[_0xe655('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfeadee,_0x265a78,_0x2500d5,_0x208750){return new Promise(function(_0x18e6c1,_0x39a9b4){var _0x31cbc3=_0x208750||client;return _0x31cbc3[_0xe655('0x8')](_0xfeadee,_0x2500d5)[_0xe655('0x9')](function(_0x510da8){logger[_0xe655('0xa')](_0xe655('0xb'),_0x265a78,_0xe655('0xc'));logger['debug'](_0xe655('0xd'),_0x265a78,_0xe655('0xc'),JSON['stringify'](_0x510da8));if(_0x510da8['error']){if(_0x510da8[_0xe655('0xe')]['code']===0x1f4){logger[_0xe655('0xe')](_0xe655('0xb'),_0x265a78,_0x510da8[_0xe655('0xe')]['message']);return _0x39a9b4(_0x510da8['error'][_0xe655('0xf')]);}logger['error'](_0xe655('0xb'),_0x265a78,_0x510da8[_0xe655('0xe')][_0xe655('0xf')]);return _0x18e6c1(_0x510da8['error'][_0xe655('0xf')]);}else{logger[_0xe655('0xa')](_0xe655('0xb'),_0x265a78,_0xe655('0xc'));_0x18e6c1(_0x510da8[_0xe655('0x10')][_0xe655('0xf')]);}})[_0xe655('0x11')](function(_0x2bd51a){logger[_0xe655('0xe')](_0xe655('0xb'),_0x265a78,_0x2bd51a);_0x39a9b4(_0x2bd51a);});});}function respondWithResult(_0x486dfe,_0x25c1c9){_0x25c1c9=_0x25c1c9||0xc8;return function(_0x3b19dd){if(_0x3b19dd){return _0x486dfe[_0xe655('0x12')](_0x25c1c9)['json'](_0x3b19dd);}};}function respondWithFilteredResult(_0x89b387,_0x290aa1){return function(_0x1b47cc){if(_0x1b47cc){var _0x42ebf6=typeof _0x290aa1[_0xe655('0x13')]===_0xe655('0x14')&&typeof _0x290aa1[_0xe655('0x15')]==='undefined';var _0x4158c1=_0x1b47cc[_0xe655('0x16')];var _0x363391=_0x42ebf6?0x0:_0x290aa1[_0xe655('0x13')];var _0x2942d5=_0x42ebf6?_0x1b47cc[_0xe655('0x16')]:_0x290aa1[_0xe655('0x13')]+_0x290aa1[_0xe655('0x15')];var _0x190d90;if(_0x2942d5>=_0x4158c1){_0x2942d5=_0x4158c1;_0x190d90=0xc8;}else{_0x190d90=0xce;}_0x89b387['status'](_0x190d90);return _0x89b387[_0xe655('0x17')](_0xe655('0x18'),_0x363391+'-'+_0x2942d5+'/'+_0x4158c1)['json'](_0x1b47cc);}return null;};}function saveUpdates(_0x57110a){return function(_0x144de9){if(_0x144de9){return _0x144de9['update'](_0x57110a)[_0xe655('0x9')](function(_0x92ce58){return _0x92ce58;});}return null;};}function removeEntity(_0x4e7163){return function(_0x4c184c){if(_0x4c184c){return _0x4c184c[_0xe655('0x19')]()[_0xe655('0x9')](function(){_0x4e7163[_0xe655('0x12')](0xcc)[_0xe655('0x1a')]();});}};}function handleEntityNotFound(_0x48e32b){return function(_0xa34c69){if(!_0xa34c69){_0x48e32b[_0xe655('0x1b')](0x194);}return _0xa34c69;};}function handleError(_0x36a94a,_0x221066){_0x221066=_0x221066||0x1f4;return function(_0x4a832e){logger[_0xe655('0xe')](_0x4a832e[_0xe655('0x1c')]);if(_0x4a832e['name']){delete _0x4a832e[_0xe655('0x1d')];}_0x36a94a[_0xe655('0x12')](_0x221066)['send'](_0x4a832e);};}exports[_0xe655('0x1e')]=function(_0xb83814,_0x2bc076){var _0x30fe56={},_0x1be25e={},_0x1a583b={'count':0x0,'rows':[]};var _0x44c974=_[_0xe655('0x1f')](db[_0xe655('0x20')][_0xe655('0x21')],function(_0x4bd1cc){return{'name':_0x4bd1cc[_0xe655('0x22')],'type':_0x4bd1cc['type']['key']};});_0x1be25e[_0xe655('0x23')]=_[_0xe655('0x1f')](_0x44c974,'name');_0x1be25e['query']=_['keys'](_0xb83814[_0xe655('0x24')]);_0x1be25e[_0xe655('0x25')]=_[_0xe655('0x26')](_0x1be25e[_0xe655('0x23')],_0x1be25e[_0xe655('0x24')]);_0x30fe56['attributes']=_[_0xe655('0x26')](_0x1be25e['model'],qs[_0xe655('0x27')](_0xb83814[_0xe655('0x24')]['fields']));_0x30fe56['attributes']=_0x30fe56['attributes'][_0xe655('0x28')]?_0x30fe56[_0xe655('0x29')]:_0x1be25e['model'];if(!_0xb83814[_0xe655('0x24')][_0xe655('0x2a')](_0xe655('0x2b'))){_0x30fe56['limit']=qs[_0xe655('0x15')](_0xb83814['query']['limit']);_0x30fe56[_0xe655('0x13')]=qs[_0xe655('0x13')](_0xb83814[_0xe655('0x24')][_0xe655('0x13')]);}_0x30fe56['order']=qs[_0xe655('0x2c')](_0xb83814[_0xe655('0x24')]['sort']);_0x30fe56[_0xe655('0x2d')]=qs['filters'](_['pick'](_0xb83814[_0xe655('0x24')],_0x1be25e[_0xe655('0x25')]),_0x44c974);if(_0xb83814[_0xe655('0x24')][_0xe655('0x2e')]){_0x30fe56['where']=_['merge'](_0x30fe56[_0xe655('0x2d')],{'$or':_[_0xe655('0x1f')](_0x44c974,function(_0x2513c6){if(_0x2513c6[_0xe655('0x2f')]!=='VIRTUAL'){var _0x507e8e={};_0x507e8e[_0x2513c6[_0xe655('0x1d')]]={'$like':'%'+_0xb83814[_0xe655('0x24')][_0xe655('0x2e')]+'%'};return _0x507e8e;}})});}_0x30fe56=_[_0xe655('0x30')]({},_0x30fe56,_0xb83814[_0xe655('0x31')]);var _0x42b348={'where':_0x30fe56[_0xe655('0x2d')]};return db['Network']['count'](_0x42b348)[_0xe655('0x9')](function(_0x2d343f){_0x1a583b['count']=_0x2d343f;if(_0xb83814['query'][_0xe655('0x32')]){_0x30fe56[_0xe655('0x33')]=[{'all':!![]}];}return db[_0xe655('0x20')][_0xe655('0x34')](_0x30fe56);})[_0xe655('0x9')](function(_0x1f1cde){_0x1a583b[_0xe655('0x35')]=_0x1f1cde;return _0x1a583b;})[_0xe655('0x9')](respondWithFilteredResult(_0x2bc076,_0x30fe56))['catch'](handleError(_0x2bc076,null));};exports[_0xe655('0x36')]=function(_0x14a151,_0x1a90dc){var _0x2ff3a1={'raw':!![],'where':{'id':_0x14a151['params']['id']}},_0x1d9ddf={};_0x1d9ddf[_0xe655('0x23')]=_[_0xe655('0x37')](db[_0xe655('0x20')][_0xe655('0x21')]);_0x1d9ddf[_0xe655('0x24')]=_[_0xe655('0x37')](_0x14a151[_0xe655('0x24')]);_0x1d9ddf[_0xe655('0x25')]=_['intersection'](_0x1d9ddf[_0xe655('0x23')],_0x1d9ddf['query']);_0x2ff3a1['attributes']=_[_0xe655('0x26')](_0x1d9ddf[_0xe655('0x23')],qs[_0xe655('0x27')](_0x14a151['query'][_0xe655('0x27')]));_0x2ff3a1[_0xe655('0x29')]=_0x2ff3a1[_0xe655('0x29')][_0xe655('0x28')]?_0x2ff3a1[_0xe655('0x29')]:_0x1d9ddf[_0xe655('0x23')];if(_0x14a151[_0xe655('0x24')][_0xe655('0x32')]){_0x2ff3a1[_0xe655('0x33')]=[{'all':!![]}];}_0x2ff3a1=_[_0xe655('0x30')]({},_0x2ff3a1,_0x14a151[_0xe655('0x31')]);return db['Network'][_0xe655('0x38')](_0x2ff3a1)[_0xe655('0x9')](handleEntityNotFound(_0x1a90dc,null))[_0xe655('0x9')](respondWithResult(_0x1a90dc,null))[_0xe655('0x11')](handleError(_0x1a90dc,null));};exports['create']=function(_0xa56e97,_0x4ff938){var _0x154bc4;return db[_0xe655('0x20')]['create'](_0xa56e97[_0xe655('0x39')],{'raw':!![]})[_0xe655('0x9')](function(_0x1731f5){_0x154bc4=_0x1731f5;return db[_0xe655('0x20')]['findAll']({'where':{'type':_0xa56e97[_0xe655('0x39')]['type']},'raw':!![]});})[_0xe655('0x9')](function(_0xf7ab6b){if(_0x154bc4['type']['toUpperCase']()==_0xe655('0x3a')){var _0x4a263f=fs[_0xe655('0x3b')](path[_0xe655('0x3c')](config[_0xe655('0x3d')],_0xe655('0x3e')),'utf8');var _0x4b5489=ejs[_0xe655('0x3f')](_0x4a263f,{'networks':_0xf7ab6b||[]});fs[_0xe655('0x40')](_0xe655('0x41'),_0x4b5489);return respondWithRpcPromise('Reload',_0xe655('0x42'),{'module':_0xe655('0x43')});}else if(_0x154bc4[_0xe655('0x2f')][_0xe655('0x44')]()=='TURN'){var _0x238b16=fs['readFileSync'](path[_0xe655('0x3c')](config[_0xe655('0x3d')],'server/files/templates/turn_multiple.ejs'),_0xe655('0x45'));var _0x44b035=ejs['render'](_0x238b16,{'networks':_0xf7ab6b||[]});fs[_0xe655('0x40')](_0xe655('0x46'),_0x44b035);return respondWithRpcPromise('Reload',_0xe655('0x42'),{'module':_0xe655('0x43')});}else{var _0x3d258d=fs[_0xe655('0x3b')](path[_0xe655('0x3c')](config['root'],_0xe655('0x47')),_0xe655('0x45'));var _0xdb1d9e=ejs[_0xe655('0x3f')](_0x3d258d,{'networks':_0xf7ab6b||[]});fs['writeFileSync'](util['format'](_0xe655('0x48'),_0xa56e97['body'][_0xe655('0x2f')][_0xe655('0x49')]()),_0xdb1d9e);return respondWithRpcPromise(_0xe655('0x4a'),_0xe655('0x42'),{'module':_0xe655('0x4b')});}})[_0xe655('0x9')](function(){return _0x154bc4;})[_0xe655('0x9')](respondWithResult(_0x4ff938,0xc9))[_0xe655('0x11')](handleError(_0x4ff938,null));};exports['update']=function(_0x5b1b47,_0x1b0432){var _0x20b963;return db[_0xe655('0x20')][_0xe655('0x38')]({'where':{'id':_0x5b1b47['params']['id']}})[_0xe655('0x9')](handleEntityNotFound(_0x1b0432,null))['then'](saveUpdates(_0x5b1b47['body'],null))[_0xe655('0x9')](function(_0xd77c5d){if(_0xd77c5d){_0x20b963=_0xd77c5d;return db[_0xe655('0x20')][_0xe655('0x34')]({'where':{'type':_0x20b963[_0xe655('0x2f')]},'raw':!![]});}return null;})[_0xe655('0x9')](function(_0x11b0a0){if(_0x20b963[_0xe655('0x2f')]['toUpperCase']()=='STUN'){var _0x27a3ec=fs[_0xe655('0x3b')](path[_0xe655('0x3c')](config[_0xe655('0x3d')],_0xe655('0x3e')),_0xe655('0x45'));var _0x1555d9=ejs[_0xe655('0x3f')](_0x27a3ec,{'networks':_0x11b0a0||[]});fs['writeFileSync'](_0xe655('0x41'),_0x1555d9);return respondWithRpcPromise(_0xe655('0x4a'),_0xe655('0x4c'),{'module':_0xe655('0x43')});}else if(_0x20b963[_0xe655('0x2f')][_0xe655('0x44')]()==_0xe655('0x4d')){var _0x3dffa2=fs[_0xe655('0x3b')](path['join'](config[_0xe655('0x3d')],_0xe655('0x4e')),_0xe655('0x45'));var _0x4d549a=ejs[_0xe655('0x3f')](_0x3dffa2,{'networks':_0x11b0a0||[]});fs[_0xe655('0x40')]('/etc/asterisk/turn_xcally.conf',_0x4d549a);return respondWithRpcPromise('Reload','update',{'module':_0xe655('0x43')});}else{var _0x2f3cf7=fs['readFileSync'](path[_0xe655('0x3c')](config[_0xe655('0x3d')],'server/files/templates/network.ejs'),_0xe655('0x45'));var _0x490683=ejs[_0xe655('0x3f')](_0x2f3cf7,{'networks':_0x11b0a0||[]});fs[_0xe655('0x40')](util[_0xe655('0x4f')](_0xe655('0x48'),_0x5b1b47[_0xe655('0x39')][_0xe655('0x2f')]['toLowerCase']()),_0x490683);return respondWithRpcPromise(_0xe655('0x4a'),_0xe655('0x4c'),{'module':'chan_sip.so'});}})['then'](function(_0x19a14f){if(_0x19a14f){return _0x20b963;}return null;})['then'](respondWithResult(_0x1b0432,null))[_0xe655('0x11')](handleError(_0x1b0432,null));};exports[_0xe655('0x19')]=function(_0x29f64e,_0x391851){var _0x3d2f90;return db['Network'][_0xe655('0x38')]({'where':{'id':_0x29f64e[_0xe655('0x50')]['id']}})[_0xe655('0x9')](function(_0xa19c64){_0x3d2f90=_0xa19c64;return _0xa19c64;})[_0xe655('0x9')](handleEntityNotFound(_0x391851,null))[_0xe655('0x9')](removeEntity(_0x391851,null))[_0xe655('0x9')](function(){if(_0x3d2f90){return db['Network'][_0xe655('0x34')]({'where':{'type':_0x3d2f90[_0xe655('0x2f')]},'raw':!![]});}})[_0xe655('0x9')](function(_0x2c6b4e){if(_0x3d2f90[_0xe655('0x2f')][_0xe655('0x44')]()==_0xe655('0x3a')){var _0x268b36=fs[_0xe655('0x3b')](path['join'](config['root'],_0xe655('0x3e')),_0xe655('0x45'));var _0x88221f=ejs[_0xe655('0x3f')](_0x268b36,{'networks':_0x2c6b4e||[]});fs[_0xe655('0x40')]('/etc/asterisk/stun_xcally.conf',_0x88221f);return respondWithRpcPromise(_0xe655('0x4a'),_0xe655('0x19'),{'module':_0xe655('0x43')});}else if(_0x3d2f90[_0xe655('0x2f')][_0xe655('0x44')]()==_0xe655('0x4d')){var _0x123077=fs[_0xe655('0x3b')](path[_0xe655('0x3c')](config[_0xe655('0x3d')],_0xe655('0x4e')),_0xe655('0x45'));var _0x4eefb6=ejs[_0xe655('0x3f')](_0x123077,{'networks':_0x2c6b4e||[]});fs[_0xe655('0x40')]('/etc/asterisk/turn_xcally.conf',_0x4eefb6);return respondWithRpcPromise(_0xe655('0x4a'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x525911=fs[_0xe655('0x3b')](path[_0xe655('0x3c')](config[_0xe655('0x3d')],_0xe655('0x47')),_0xe655('0x45'));var _0xbb928c=ejs['render'](_0x525911,{'networks':_0x2c6b4e||[]});fs[_0xe655('0x40')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3d2f90[_0xe655('0x2f')][_0xe655('0x49')]()),_0xbb928c);return respondWithRpcPromise(_0xe655('0x4a'),_0xe655('0x19'),{'module':_0xe655('0x4b')});}})[_0xe655('0x11')](handleError(_0x391851,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6bb7d78..aa1fa40 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 _0xc36d=['rimraf','./network.attributes','exports','define','network','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xe26ae2,_0x1fe026){var _0x101f32=function(_0x59f2f5){while(--_0x59f2f5){_0xe26ae2['push'](_0xe26ae2['shift']());}};_0x101f32(++_0x1fe026);}(_0xc36d,0x7d));var _0xdc36=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0xc36d[_0x7cb10c];return _0x11df59;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var logger=require(_0xdc36('0x2'))(_0xdc36('0x3'));var moment=require(_0xdc36('0x4'));var BPromise=require(_0xdc36('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc36('0x6'));var rimraf=require(_0xdc36('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc36('0x8'));module[_0xdc36('0x9')]=function(_0x186c58,_0x11ad3b){return _0x186c58[_0xdc36('0xa')]('Network',attributes,{'tableName':_0xdc36('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','api','moment','bluebird'];(function(_0x5a0fdf,_0x52f85a){var _0xdcf173=function(_0x307beb){while(--_0x307beb){_0x5a0fdf['push'](_0x5a0fdf['shift']());}};_0xdcf173(++_0x52f85a);}(_0xbec5,0xe5));var _0x5bec=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xbec5[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 47cd184..74f4baf 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(_0x3d6d07,_0x37c693){var _0x5ab854=function(_0x255496){while(--_0x255496){_0x3d6d07['push'](_0x3d6d07['shift']());}};_0x5ab854(++_0x37c693);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x4f098f,_0x9a5a40){_0x4f098f=_0x4f098f-0x0;var _0x18352f=_0x7a54[_0x4f098f];return _0x18352f;};'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 b0194f9..2fdb484 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 _0x36ee=['removeDispositions','removeAnswers','removeAgents','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','/:id/notify','addApplications','addAgents','/:id/send','send','put','delete','destroy'];(function(_0x21c071,_0x436fe8){var _0x569308=function(_0x56b1b1){while(--_0x56b1b1){_0x21c071['push'](_0x21c071['shift']());}};_0x569308(++_0x436fe8);}(_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['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getApplications']);router[_0xe36e('0x8')](_0xe36e('0x14'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router['get'](_0xe36e('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe36e('0x17')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);router[_0xe36e('0x17')](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x19')]);router[_0xe36e('0x17')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller['addAnswer']);router[_0xe36e('0x17')](_0xe36e('0x1a'),controller['notify']);router[_0xe36e('0x17')]('/:id/applications',auth[_0xe36e('0x9')](),controller[_0xe36e('0x1b')]);router['post'](_0xe36e('0x16'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x1c')]);router['post'](_0xe36e('0x1d'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x1e')]);router[_0xe36e('0x1f')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller['update']);router[_0xe36e('0x20')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x21')]);router[_0xe36e('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe36e('0x22')]);router[_0xe36e('0x20')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x23')]);router[_0xe36e('0x20')](_0xe36e('0x16'),auth['isAuthenticated'](),controller[_0xe36e('0x24')]);module[_0xe36e('0x25')]=router; \ No newline at end of file +var _0x7708=['send','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','create','addDisposition','addAnswer','post','/:id/notify','notify','addApplications','/:id/send'];(function(_0x32bc66,_0x39003d){var _0x6baa47=function(_0x40ba1f){while(--_0x40ba1f){_0x32bc66['push'](_0x32bc66['shift']());}};_0x6baa47(++_0x39003d);}(_0x7708,0x188));var _0x8770=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x7708[_0x39772f];return _0xc9edbf;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./openchannelAccount.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['getAnswers']);router[_0x8770('0x5')](_0x8770('0xf'),auth[_0x8770('0x8')](),controller['getApplications']);router[_0x8770('0x5')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0x5')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x13')]);router['post']('/',auth[_0x8770('0x8')](),controller[_0x8770('0x14')]);router['post'](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0x15')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8770('0x16')]);router[_0x8770('0x17')](_0x8770('0x18'),controller[_0x8770('0x19')]);router['post']('/:id/applications',auth[_0x8770('0x8')](),controller[_0x8770('0x1a')]);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller['addAgents']);router[_0x8770('0x17')](_0x8770('0x1b'),auth[_0x8770('0x8')](),controller[_0x8770('0x1c')]);router['put']('/:id',auth[_0x8770('0x8')](),controller[_0x8770('0x1d')]);router[_0x8770('0x1e')](_0x8770('0xa'),auth[_0x8770('0x8')](),controller[_0x8770('0x1f')]);router['delete'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x20')]);router[_0x8770('0x1e')]('/:id/canned_answers',auth[_0x8770('0x8')](),controller['removeAnswers']);router[_0x8770('0x1e')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x21')]);module[_0x8770('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 4894d60..863a4b1 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 _0x7704=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7704,0x1d1));var _0x4770=function(_0x5f03a3,_0x5867ae){_0x5f03a3=_0x5f03a3-0x0;var _0x93b521=_0x7704[_0x5f03a3];return _0x93b521;};'use strict';var Sequelize=require(_0x4770('0x0'));var rs=require(_0x4770('0x1'));module[_0x4770('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x4770('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4770('0x4')]},'token':{'type':Sequelize[_0x4770('0x4')],'defaultValue':function(){return rs[_0x4770('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x4770('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4770('0x6')],'defaultValue':function(){return _0x4770('0x7');}},'notificationSound':{'type':Sequelize[_0x4770('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4770('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4770('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x4770('0x4')]},'queueTransfer':{'type':Sequelize[_0x4770('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4770('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4770('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4770('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4770('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x4770('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x4770('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x33f8c9){if(!_0x33f8c9)this['setDataValue'](_0x4770('0xb'),null);this[_0x4770('0xc')](_0x4770('0xd'),_0x33f8c9);}}}; \ No newline at end of file +var _0xa2ed=['name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports'];(function(_0x4be76e,_0xd853ed){var _0x37f788=function(_0x48dbe7){while(--_0x48dbe7){_0x4be76e['push'](_0x4be76e['shift']());}};_0x37f788(++_0xd853ed);}(_0xa2ed,0x15b));var _0xda2e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2ed[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xda2e('0x0'));var rs=require(_0xda2e('0x1'));module[_0xda2e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xda2e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xda2e('0x4')]},'token':{'type':Sequelize[_0xda2e('0x4')],'defaultValue':function(){return rs[_0xda2e('0x5')]();}},'replyUri':{'type':Sequelize[_0xda2e('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xda2e('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xda2e('0x6')],'defaultValue':function(){return _0xda2e('0x7');}},'notificationSound':{'type':Sequelize[_0xda2e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xda2e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xda2e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xda2e('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xda2e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xda2e('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xda2e('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xda2e('0xb'),'set':function(_0x17ce3e){if(!_0x17ce3e)this[_0xda2e('0xc')](_0xda2e('0xd'),null);this[_0xda2e('0xc')]('mandatoryDisposition',_0x17ce3e);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 3fbe52d..39e5832 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 _0xfc17=['threadId','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','OpenchannelQueue','queueId','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','User','Owner','fullname','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','get','OpenchannelAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','fieldName','type','keys','filters','intersection','query','attributes','model','length','hasOwnProperty','order','sort','where','filter','merge','options','OpenchannelAccount','includeAll','include','findAll','rows','params','fields','find','body','role','user','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rawAttributes','nolimit','removeDispositions','ids','CannedAnswer','getAnswers','pick','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','createdAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','updatedAt','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','asc','from','firstName','lastName'];(function(_0x27ae45,_0x6fe56f){var _0x4f8787=function(_0x5c0a60){while(--_0x5c0a60){_0x27ae45['push'](_0x27ae45['shift']());}};_0x4f8787(++_0x6fe56f);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x406047,_0x15ecfc){_0x406047=_0x406047-0x0;var _0x5e5f33=_0xfc17[_0x406047];return _0x5e5f33;};'use strict';var emlformat=require(_0x7fc1('0x0'));var rimraf=require(_0x7fc1('0x1'));var zipdir=require(_0x7fc1('0x2'));var jsonpatch=require(_0x7fc1('0x3'));var rp=require('request-promise');var moment=require(_0x7fc1('0x4'));var BPromise=require(_0x7fc1('0x5'));var Mustache=require(_0x7fc1('0x6'));var util=require(_0x7fc1('0x7'));var path=require(_0x7fc1('0x8'));var sox=require(_0x7fc1('0x9'));var csv=require('to-csv');var ejs=require(_0x7fc1('0xa'));var fs=require('fs');var fs_extra=require(_0x7fc1('0xb'));var _=require(_0x7fc1('0xc'));var squel=require(_0x7fc1('0xd'));var crypto=require(_0x7fc1('0xe'));var jsforce=require(_0x7fc1('0xf'));var deskjs=require(_0x7fc1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7fc1('0x11'));var Papa=require(_0x7fc1('0x12'));var Redis=require(_0x7fc1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7fc1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fc1('0x15'))(_0x7fc1('0x16'));var utils=require(_0x7fc1('0x17'));var config=require(_0x7fc1('0x18'));var licenseUtil=require(_0x7fc1('0x19'));var db=require(_0x7fc1('0x1a'))['db'];config[_0x7fc1('0x1b')]=_[_0x7fc1('0x1c')](config[_0x7fc1('0x1b')],{'host':_0x7fc1('0x1d'),'port':0x18eb});var socket=require(_0x7fc1('0x1e'))(new Redis(config[_0x7fc1('0x1b')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x7fc1('0x1f'));var client=jayson[_0x7fc1('0x20')][_0x7fc1('0x21')]({'port':0x232c});var client9002=jayson[_0x7fc1('0x20')][_0x7fc1('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3c4671,_0x3d8e82,_0x37af05,_0x18be8e){return new BPromise(function(_0x442176,_0x5e634a){var _0x419170=_0x18be8e||client;return _0x419170['request'](_0x3c4671,_0x37af05)[_0x7fc1('0x22')](function(_0x88c6e3){logger['info'](_0x7fc1('0x23'),_0x3d8e82,_0x7fc1('0x24'));logger['debug'](_0x7fc1('0x25'),_0x3d8e82,_0x7fc1('0x24'),JSON[_0x7fc1('0x26')](_0x88c6e3));if(_0x88c6e3[_0x7fc1('0x27')]){if(_0x88c6e3[_0x7fc1('0x27')][_0x7fc1('0x28')]===0x1f4){logger[_0x7fc1('0x27')](_0x7fc1('0x23'),_0x3d8e82,_0x88c6e3[_0x7fc1('0x27')][_0x7fc1('0x29')]);return _0x5e634a(_0x88c6e3['error']['message']);}logger[_0x7fc1('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x3d8e82,_0x88c6e3[_0x7fc1('0x27')][_0x7fc1('0x29')]);return _0x442176(_0x88c6e3[_0x7fc1('0x27')][_0x7fc1('0x29')]);}else{logger['info'](_0x7fc1('0x23'),_0x3d8e82,_0x7fc1('0x24'));_0x442176(_0x88c6e3[_0x7fc1('0x2a')]['message']);}})[_0x7fc1('0x2b')](function(_0x252b18){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3d8e82,_0x252b18);_0x5e634a(_0x252b18);});});}function respondWithStatusCode(_0x2e4256,_0x293a2a){_0x293a2a=_0x293a2a||0xcc;return function(_0x1f58ca){if(_0x1f58ca){return _0x2e4256[_0x7fc1('0x2c')](_0x293a2a);}return _0x2e4256['status'](_0x293a2a)[_0x7fc1('0x2d')]();};}function respondWithResult(_0x1628fd,_0x378b2f){_0x378b2f=_0x378b2f||0xc8;return function(_0x1fda3f){if(_0x1fda3f){return _0x1628fd['status'](_0x378b2f)[_0x7fc1('0x2e')](_0x1fda3f);}};}function respondWithFilteredResult(_0x583e60,_0x1f7fce){return function(_0x22a3c1){if(_0x22a3c1){var _0x34ec70=typeof _0x1f7fce[_0x7fc1('0x2f')]===_0x7fc1('0x30')&&typeof _0x1f7fce['limit']===_0x7fc1('0x30');var _0x59a89a=_0x22a3c1['count'];var _0x19e79b=_0x34ec70?0x0:_0x1f7fce[_0x7fc1('0x2f')];var _0x3ffd76=_0x34ec70?_0x22a3c1[_0x7fc1('0x31')]:_0x1f7fce[_0x7fc1('0x2f')]+_0x1f7fce[_0x7fc1('0x32')];var _0x28c434;if(_0x3ffd76>=_0x59a89a){_0x3ffd76=_0x59a89a;_0x28c434=0xc8;}else{_0x28c434=0xce;}_0x583e60[_0x7fc1('0x33')](_0x28c434);return _0x583e60[_0x7fc1('0x34')](_0x7fc1('0x35'),_0x19e79b+'-'+_0x3ffd76+'/'+_0x59a89a)[_0x7fc1('0x2e')](_0x22a3c1);}return null;};}function patchUpdates(_0x2c95c8){return function(_0x242fd1){try{jsonpatch[_0x7fc1('0x36')](_0x242fd1,_0x2c95c8,!![]);}catch(_0x211df6){return BPromise[_0x7fc1('0x37')](_0x211df6);}return _0x242fd1['save']();};}function saveUpdates(_0x24904b,_0x2bba7c){return function(_0x4282b5){if(_0x4282b5){return _0x4282b5[_0x7fc1('0x38')](_0x24904b)[_0x7fc1('0x22')](function(_0x2af537){return _0x2af537;});}return null;};}function removeEntity(_0x5b96ea,_0x185d06){return function(_0x3f8961){if(_0x3f8961){return _0x3f8961['destroy']()[_0x7fc1('0x22')](function(){var _0x2b1788=_0x3f8961[_0x7fc1('0x39')]({'plain':!![]});var _0x20f629=_0x7fc1('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x20f629,'resourceId':_0x2b1788['id']}})[_0x7fc1('0x22')](function(){return _0x3f8961;});})[_0x7fc1('0x22')](function(){_0x5b96ea[_0x7fc1('0x33')](0xcc)[_0x7fc1('0x2d')]();});}};}function handleEntityNotFound(_0x12ac96,_0x2474a3){return function(_0x2c8993){if(!_0x2c8993){_0x12ac96[_0x7fc1('0x2c')](0x194);}return _0x2c8993;};}function handleError(_0x53da04,_0x2c1367){_0x2c1367=_0x2c1367||0x1f4;return function(_0x4bf8d6){logger['error'](_0x4bf8d6[_0x7fc1('0x3b')]);if(_0x4bf8d6[_0x7fc1('0x3c')]){delete _0x4bf8d6[_0x7fc1('0x3c')];}_0x53da04['status'](_0x2c1367)['send'](_0x4bf8d6);};}exports[_0x7fc1('0x3d')]=function(_0x459ab0,_0xafc8b0){var _0x564437={'include':[{'model':db[_0x7fc1('0x3e')],'as':_0x7fc1('0x3f')}]},_0x4e640b={},_0x50c728={'count':0x0,'rows':[]};var _0x32607c=_[_0x7fc1('0x40')](db['OpenchannelAccount']['rawAttributes'],function(_0x4115c5){return{'name':_0x4115c5[_0x7fc1('0x41')],'type':_0x4115c5[_0x7fc1('0x42')]['key']};});_0x4e640b['model']=_['map'](_0x32607c,'name');_0x4e640b['query']=_[_0x7fc1('0x43')](_0x459ab0['query']);_0x4e640b[_0x7fc1('0x44')]=_[_0x7fc1('0x45')](_0x4e640b['model'],_0x4e640b[_0x7fc1('0x46')]);_0x564437[_0x7fc1('0x47')]=_[_0x7fc1('0x45')](_0x4e640b[_0x7fc1('0x48')],qs['fields'](_0x459ab0[_0x7fc1('0x46')]['fields']));_0x564437[_0x7fc1('0x47')]=_0x564437[_0x7fc1('0x47')][_0x7fc1('0x49')]?_0x564437[_0x7fc1('0x47')]:_0x4e640b['model'];if(!_0x459ab0[_0x7fc1('0x46')][_0x7fc1('0x4a')]('nolimit')){_0x564437[_0x7fc1('0x32')]=qs[_0x7fc1('0x32')](_0x459ab0['query'][_0x7fc1('0x32')]);_0x564437[_0x7fc1('0x2f')]=qs['offset'](_0x459ab0[_0x7fc1('0x46')][_0x7fc1('0x2f')]);}_0x564437[_0x7fc1('0x4b')]=qs['sort'](_0x459ab0[_0x7fc1('0x46')][_0x7fc1('0x4c')]);_0x564437[_0x7fc1('0x4d')]=qs[_0x7fc1('0x44')](_['pick'](_0x459ab0['query'],_0x4e640b[_0x7fc1('0x44')]),_0x32607c);if(_0x459ab0[_0x7fc1('0x46')][_0x7fc1('0x4e')]){_0x564437[_0x7fc1('0x4d')]=_[_0x7fc1('0x4f')](_0x564437[_0x7fc1('0x4d')],{'$or':_[_0x7fc1('0x40')](_0x32607c,function(_0x40b356){if(_0x40b356[_0x7fc1('0x42')]!=='VIRTUAL'){var _0x518a54={};_0x518a54[_0x40b356['name']]={'$like':'%'+_0x459ab0[_0x7fc1('0x46')][_0x7fc1('0x4e')]+'%'};return _0x518a54;}})});}_0x564437=_[_0x7fc1('0x4f')]({},_0x564437,_0x459ab0[_0x7fc1('0x50')]);var _0x4bcd63={'where':_0x564437[_0x7fc1('0x4d')]};return db[_0x7fc1('0x51')][_0x7fc1('0x31')](_0x4bcd63)[_0x7fc1('0x22')](function(_0x5aee49){_0x50c728[_0x7fc1('0x31')]=_0x5aee49;if(_0x459ab0[_0x7fc1('0x46')][_0x7fc1('0x52')]){_0x564437[_0x7fc1('0x53')]=[{'all':!![]}];}return db[_0x7fc1('0x51')][_0x7fc1('0x54')](_0x564437);})[_0x7fc1('0x22')](function(_0x4d27db){_0x50c728[_0x7fc1('0x55')]=_0x4d27db;return _0x50c728;})['then'](respondWithFilteredResult(_0xafc8b0,_0x564437))[_0x7fc1('0x2b')](handleError(_0xafc8b0,null));};exports['show']=function(_0x10ce10,_0x316ba4){var _0x4dbd61={'raw':![],'where':{'id':_0x10ce10[_0x7fc1('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x7fc1('0x3f')}]},_0x54f63f={};_0x54f63f[_0x7fc1('0x48')]=_[_0x7fc1('0x43')](db[_0x7fc1('0x51')]['rawAttributes']);_0x54f63f['query']=_[_0x7fc1('0x43')](_0x10ce10['query']);_0x54f63f[_0x7fc1('0x44')]=_[_0x7fc1('0x45')](_0x54f63f[_0x7fc1('0x48')],_0x54f63f[_0x7fc1('0x46')]);_0x4dbd61[_0x7fc1('0x47')]=_[_0x7fc1('0x45')](_0x54f63f[_0x7fc1('0x48')],qs[_0x7fc1('0x57')](_0x10ce10[_0x7fc1('0x46')]['fields']));_0x4dbd61['attributes']=_0x4dbd61[_0x7fc1('0x47')]['length']?_0x4dbd61[_0x7fc1('0x47')]:_0x54f63f['model'];if(_0x10ce10[_0x7fc1('0x46')][_0x7fc1('0x52')]){_0x4dbd61[_0x7fc1('0x53')]=[{'all':!![]}];}_0x4dbd61=_[_0x7fc1('0x4f')]({},_0x4dbd61,_0x10ce10[_0x7fc1('0x50')]);return db[_0x7fc1('0x51')][_0x7fc1('0x58')](_0x4dbd61)[_0x7fc1('0x22')](handleEntityNotFound(_0x316ba4,null))['then'](respondWithResult(_0x316ba4,null))[_0x7fc1('0x2b')](handleError(_0x316ba4,null));};exports['create']=function(_0x1212d4,_0x4a0849){return db[_0x7fc1('0x51')]['create'](_0x1212d4[_0x7fc1('0x59')],{})[_0x7fc1('0x22')](function(_0x382567){var _0x1d471f=_0x1212d4['user'][_0x7fc1('0x39')]({'plain':!![]});if(!_0x1d471f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d471f[_0x7fc1('0x5a')]===_0x7fc1('0x5b')){var _0x1c1d06=_0x382567[_0x7fc1('0x39')]({'plain':!![]});var _0x18cdea=_0x7fc1('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x18cdea,'userProfileId':_0x1d471f['userProfileId']},'raw':!![]})[_0x7fc1('0x22')](function(_0x30bc86){if(_0x30bc86&&_0x30bc86[_0x7fc1('0x5c')]===0x0){return db[_0x7fc1('0x5d')][_0x7fc1('0x5e')]({'name':_0x1c1d06[_0x7fc1('0x3c')],'resourceId':_0x1c1d06['id'],'type':_0x30bc86[_0x7fc1('0x3c')],'sectionId':_0x30bc86['id']},{})[_0x7fc1('0x22')](function(){return _0x382567;});}else{return _0x382567;}})[_0x7fc1('0x2b')](function(_0x4c524e){logger[_0x7fc1('0x27')](_0x7fc1('0x5f'),_0x4c524e);throw _0x4c524e;});}return _0x382567;})[_0x7fc1('0x22')](respondWithResult(_0x4a0849,0xc9))[_0x7fc1('0x2b')](handleError(_0x4a0849,null));};exports[_0x7fc1('0x38')]=function(_0x543685,_0x54cd5e){if(_0x543685[_0x7fc1('0x59')]['id']){delete _0x543685[_0x7fc1('0x59')]['id'];}return db[_0x7fc1('0x51')][_0x7fc1('0x58')]({'where':{'id':_0x543685[_0x7fc1('0x56')]['id']},'include':[{'model':db[_0x7fc1('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x7fc1('0x22')](handleEntityNotFound(_0x54cd5e,null))[_0x7fc1('0x22')](saveUpdates(_0x543685[_0x7fc1('0x59')],null))[_0x7fc1('0x22')](respondWithResult(_0x54cd5e,null))[_0x7fc1('0x2b')](handleError(_0x54cd5e,null));};exports[_0x7fc1('0x60')]=function(_0x3794ad,_0x14c6d9){return db['OpenchannelAccount'][_0x7fc1('0x58')]({'where':{'id':_0x3794ad['params']['id']}})[_0x7fc1('0x22')](handleEntityNotFound(_0x14c6d9,null))[_0x7fc1('0x22')](removeEntity(_0x14c6d9,null))[_0x7fc1('0x2b')](handleError(_0x14c6d9,null));};exports[_0x7fc1('0x61')]=function(_0x29e2d7,_0x5da55e){return db[_0x7fc1('0x51')][_0x7fc1('0x61')]()[_0x7fc1('0x22')](respondWithResult(_0x5da55e,null))['catch'](handleError(_0x5da55e,null));};exports[_0x7fc1('0x62')]=function(_0x4f2cf0,_0x4269a8,_0x3987b8){if(_0x4f2cf0['body']['id']){delete _0x4f2cf0[_0x7fc1('0x59')]['id'];}return db[_0x7fc1('0x51')][_0x7fc1('0x58')]({'where':{'id':_0x4f2cf0[_0x7fc1('0x56')]['id']}})['then'](handleEntityNotFound(_0x4269a8,null))[_0x7fc1('0x22')](function(_0x264d99){if(_0x264d99){_0x4f2cf0[_0x7fc1('0x59')][_0x7fc1('0x63')]=_0x264d99['id'];return db[_0x7fc1('0x64')][_0x7fc1('0x5e')](_0x4f2cf0[_0x7fc1('0x59')]);}})[_0x7fc1('0x22')](respondWithResult(_0x4269a8,null))[_0x7fc1('0x2b')](handleError(_0x4269a8,null));};exports[_0x7fc1('0x65')]=function(_0xc7629c,_0x135662,_0x372905){var _0x40d32e={'raw':![],'where':{}};var _0x2683ee={};var _0x4a8c11={'count':0x0,'rows':[]};return db[_0x7fc1('0x51')][_0x7fc1('0x66')]({'where':{'id':_0xc7629c[_0x7fc1('0x56')]['id']}})[_0x7fc1('0x22')](handleEntityNotFound(_0x135662,null))[_0x7fc1('0x22')](function(_0x6943b){if(_0x6943b){_0x2683ee['model']=_['keys'](db[_0x7fc1('0x64')][_0x7fc1('0x67')]);_0x2683ee[_0x7fc1('0x46')]=_[_0x7fc1('0x43')](_0xc7629c[_0x7fc1('0x46')]);_0x2683ee[_0x7fc1('0x44')]=_['intersection'](_0x2683ee[_0x7fc1('0x48')],_0x2683ee[_0x7fc1('0x46')]);_0x40d32e['attributes']=_[_0x7fc1('0x45')](_0x2683ee['model'],qs[_0x7fc1('0x57')](_0xc7629c[_0x7fc1('0x46')]['fields']));_0x40d32e['attributes']=_0x40d32e[_0x7fc1('0x47')][_0x7fc1('0x49')]?_0x40d32e[_0x7fc1('0x47')]:_0x2683ee[_0x7fc1('0x48')];if(!_0xc7629c[_0x7fc1('0x46')][_0x7fc1('0x4a')](_0x7fc1('0x68'))){_0x40d32e['limit']=qs[_0x7fc1('0x32')](_0xc7629c[_0x7fc1('0x46')][_0x7fc1('0x32')]);_0x40d32e[_0x7fc1('0x2f')]=qs[_0x7fc1('0x2f')](_0xc7629c[_0x7fc1('0x46')]['offset']);}_0x40d32e[_0x7fc1('0x4b')]=qs[_0x7fc1('0x4c')](_0xc7629c[_0x7fc1('0x46')]['sort']);_0x40d32e[_0x7fc1('0x4d')]=qs['filters'](_['pick'](_0xc7629c['query'],_0x2683ee[_0x7fc1('0x44')]));_0x40d32e[_0x7fc1('0x4d')][_0x7fc1('0x63')]=_0x6943b['id'];if(_0xc7629c[_0x7fc1('0x46')][_0x7fc1('0x4e')]){_0x40d32e[_0x7fc1('0x4d')]=_['merge'](_0x40d32e[_0x7fc1('0x4d')],{'$or':_['map'](_0x40d32e['attributes'],function(_0x4aa587){var _0x43cb18={};_0x43cb18[_0x4aa587]={'$like':'%'+_0xc7629c[_0x7fc1('0x46')][_0x7fc1('0x4e')]+'%'};return _0x43cb18;})});}_0x40d32e=_['merge']({},_0x40d32e,_0xc7629c[_0x7fc1('0x50')]);return db[_0x7fc1('0x64')][_0x7fc1('0x31')]({'where':_0x40d32e[_0x7fc1('0x4d')]})[_0x7fc1('0x22')](function(_0x2f28be){_0x4a8c11['count']=_0x2f28be;if(_0xc7629c[_0x7fc1('0x46')][_0x7fc1('0x52')]){_0x40d32e[_0x7fc1('0x53')]=[{'all':!![]}];}return db[_0x7fc1('0x64')]['findAll'](_0x40d32e);})['then'](function(_0x5b6669){_0x4a8c11[_0x7fc1('0x55')]=_0x5b6669;return _0x4a8c11;});}})[_0x7fc1('0x22')](respondWithFilteredResult(_0x135662,_0x40d32e))[_0x7fc1('0x2b')](handleError(_0x135662,null));};exports[_0x7fc1('0x69')]=function(_0x5a0428,_0x3576aa,_0x771c6a){return db['OpenchannelAccount']['find']({'where':{'id':_0x5a0428[_0x7fc1('0x56')]['id']}})[_0x7fc1('0x22')](handleEntityNotFound(_0x3576aa,null))['then'](function(_0x15899d){if(_0x15899d){return _0x15899d[_0x7fc1('0x69')](_0x5a0428['query'][_0x7fc1('0x6a')]);}})[_0x7fc1('0x22')](respondWithStatusCode(_0x3576aa,null))[_0x7fc1('0x2b')](handleError(_0x3576aa,null));};exports['addAnswer']=function(_0x191e21,_0x357bf1,_0x152a6e){if(_0x191e21[_0x7fc1('0x59')]['id']){delete _0x191e21['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x191e21[_0x7fc1('0x56')]['id']}})[_0x7fc1('0x22')](handleEntityNotFound(_0x357bf1,null))['then'](function(_0x474256){if(_0x474256){_0x191e21[_0x7fc1('0x59')][_0x7fc1('0x63')]=_0x474256['id'];return db[_0x7fc1('0x6b')][_0x7fc1('0x5e')](_0x191e21[_0x7fc1('0x59')]);}})[_0x7fc1('0x22')](respondWithResult(_0x357bf1,null))[_0x7fc1('0x2b')](handleError(_0x357bf1,null));};exports[_0x7fc1('0x6c')]=function(_0x38abee,_0xdeea02,_0x565c08){var _0x4581f8={'raw':![],'where':{}};var _0x388817={};var _0x512a31={'count':0x0,'rows':[]};return db[_0x7fc1('0x51')][_0x7fc1('0x66')]({'where':{'id':_0x38abee['params']['id']}})['then'](handleEntityNotFound(_0xdeea02,null))[_0x7fc1('0x22')](function(_0x6b25e5){if(_0x6b25e5){_0x388817[_0x7fc1('0x48')]=_['keys'](db[_0x7fc1('0x6b')][_0x7fc1('0x67')]);_0x388817[_0x7fc1('0x46')]=_[_0x7fc1('0x43')](_0x38abee[_0x7fc1('0x46')]);_0x388817['filters']=_['intersection'](_0x388817[_0x7fc1('0x48')],_0x388817[_0x7fc1('0x46')]);_0x4581f8[_0x7fc1('0x47')]=_[_0x7fc1('0x45')](_0x388817[_0x7fc1('0x48')],qs['fields'](_0x38abee[_0x7fc1('0x46')]['fields']));_0x4581f8[_0x7fc1('0x47')]=_0x4581f8[_0x7fc1('0x47')][_0x7fc1('0x49')]?_0x4581f8['attributes']:_0x388817[_0x7fc1('0x48')];if(!_0x38abee[_0x7fc1('0x46')]['hasOwnProperty'](_0x7fc1('0x68'))){_0x4581f8['limit']=qs['limit'](_0x38abee[_0x7fc1('0x46')]['limit']);_0x4581f8['offset']=qs[_0x7fc1('0x2f')](_0x38abee[_0x7fc1('0x46')]['offset']);}_0x4581f8[_0x7fc1('0x4b')]=qs[_0x7fc1('0x4c')](_0x38abee[_0x7fc1('0x46')]['sort']);_0x4581f8['where']=qs[_0x7fc1('0x44')](_[_0x7fc1('0x6d')](_0x38abee['query'],_0x388817['filters']));_0x4581f8[_0x7fc1('0x4d')][_0x7fc1('0x63')]=_0x6b25e5['id'];if(_0x38abee[_0x7fc1('0x46')][_0x7fc1('0x4e')]){_0x4581f8[_0x7fc1('0x4d')]=_['merge'](_0x4581f8[_0x7fc1('0x4d')],{'$or':_[_0x7fc1('0x40')](_0x4581f8[_0x7fc1('0x47')],function(_0x4c5c84){var _0x48ee2b={};_0x48ee2b[_0x4c5c84]={'$like':'%'+_0x38abee[_0x7fc1('0x46')]['filter']+'%'};return _0x48ee2b;})});}_0x4581f8=_[_0x7fc1('0x4f')]({},_0x4581f8,_0x38abee['options']);return db[_0x7fc1('0x6b')][_0x7fc1('0x31')]({'where':_0x4581f8['where']})[_0x7fc1('0x22')](function(_0x155022){_0x512a31['count']=_0x155022;if(_0x38abee['query'][_0x7fc1('0x52')]){_0x4581f8['include']=[{'all':!![]}];}return db[_0x7fc1('0x6b')][_0x7fc1('0x54')](_0x4581f8);})[_0x7fc1('0x22')](function(_0x401919){_0x512a31[_0x7fc1('0x55')]=_0x401919;return _0x512a31;});}})[_0x7fc1('0x22')](respondWithFilteredResult(_0xdeea02,_0x4581f8))[_0x7fc1('0x2b')](handleError(_0xdeea02,null));};exports[_0x7fc1('0x6e')]=function(_0x4ed9bb,_0x524d5d,_0x203a6e){return db[_0x7fc1('0x51')]['find']({'where':{'id':_0x4ed9bb[_0x7fc1('0x56')]['id']}})['then'](handleEntityNotFound(_0x524d5d,null))['then'](function(_0x2094ab){if(_0x2094ab){return _0x2094ab['removeAnswers'](_0x4ed9bb[_0x7fc1('0x46')][_0x7fc1('0x6a')]);}})['then'](respondWithStatusCode(_0x524d5d,null))[_0x7fc1('0x2b')](handleError(_0x524d5d,null));};exports[_0x7fc1('0x6f')]=function(_0x5275f8,_0x19ead1,_0x5391c2){var _0x87bd80={'body':_0x5275f8[_0x7fc1('0x59')],'channel':_0x7fc1('0x70')};var _0x5f5d56=[];var _0x15a7aa=[];var _0x43e7b8={};var _0x5e42f2=![];return db[_0x7fc1('0x71')][_0x7fc1('0x61')]()[_0x7fc1('0x22')](function(_0x52be0e){if(!_0x52be0e){throw new db['Sequelize'][(_0x7fc1('0x72'))](_0x7fc1('0x73'));}_0x5f5d56=_['difference'](_[_0x7fc1('0x43')](_0x52be0e),[_0x7fc1('0x74'),'updatedAt']);_0x15a7aa=_['difference'](_[_0x7fc1('0x43')](_0x52be0e),[_0x7fc1('0x74'),'updatedAt',_0x7fc1('0x75'),_0x7fc1('0x76')]);if(_0x5275f8['body']['id']){delete _0x5275f8[_0x7fc1('0x59')]['id'];}if(_[_0x7fc1('0x77')](_0x5275f8[_0x7fc1('0x59')]['from'])){throw new db[(_0x7fc1('0x78'))][(_0x7fc1('0x72'))](_0x7fc1('0x79'));}if(_['isNil'](_0x5275f8['body'][_0x7fc1('0x59')])||_0x5275f8['body']['body']===''){throw new db['Sequelize'][(_0x7fc1('0x72'))](_0x7fc1('0x7a'));}if(_[_0x7fc1('0x77')](_0x5275f8['body'][_0x7fc1('0x7b')])){throw new db[(_0x7fc1('0x78'))]['ValidationError'](_0x7fc1('0x7c')+_0x15a7aa);}if(!_['includes'](_0x15a7aa,_0x5275f8[_0x7fc1('0x59')][_0x7fc1('0x7b')])){throw new db[(_0x7fc1('0x78'))][(_0x7fc1('0x72'))](_0x7fc1('0x7d')+_0x15a7aa);}_0x43e7b8[_0x5275f8[_0x7fc1('0x59')][_0x7fc1('0x7b')]]=_0x5275f8[_0x7fc1('0x59')]['from'];})[_0x7fc1('0x22')](function(){return db[_0x7fc1('0x51')][_0x7fc1('0x58')]({'where':{'id':_0x5275f8[_0x7fc1('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x7fc1('0x7e'),'where':_0x43e7b8,'limit':0x1,'order':[[_0x7fc1('0x7f'),'DESC']]}]},{'model':db[_0x7fc1('0x80')],'as':_0x7fc1('0x81')}]});})[_0x7fc1('0x22')](handleEntityNotFound(_0x19ead1,null))['then'](function(_0x11d81c){if(_0x11d81c&&_0x11d81c[_0x7fc1('0x82')]){_0x87bd80[_0x7fc1('0x83')]=_0x11d81c;_0x87bd80[_0x7fc1('0x84')]=_0x11d81c[_0x7fc1('0x81')];_0x87bd80[_0x7fc1('0x85')]=_0x11d81c[_0x7fc1('0x82')];_0x87bd80[_0x7fc1('0x84')]=_[_0x7fc1('0x86')](_0x87bd80[_0x7fc1('0x84')],[_0x7fc1('0x87')],[_0x7fc1('0x88')]);if(_0x87bd80[_0x7fc1('0x83')][_0x7fc1('0x81')]){delete _0x87bd80[_0x7fc1('0x83')][_0x7fc1('0x81')];}if(_0x87bd80[_0x7fc1('0x83')]['List']&&_0x87bd80[_0x7fc1('0x83')][_0x7fc1('0x82')][_0x7fc1('0x7e')][_0x7fc1('0x49')]){return _0x87bd80['account'][_0x7fc1('0x82')][_0x7fc1('0x7e')][0x0];}var _0x23dea8=_[_0x7fc1('0x1c')](_0x5275f8[_0x7fc1('0x59')],{'firstName':_0x5275f8[_0x7fc1('0x59')][_0x7fc1('0x89')],'ListId':_0x11d81c['ListId']});_0x23dea8[_0x5275f8['body'][_0x7fc1('0x7b')]]=_0x5275f8[_0x7fc1('0x59')][_0x7fc1('0x89')];return db[_0x7fc1('0x71')][_0x7fc1('0x5e')](_0x23dea8,{'fields':_0x5f5d56,'raw':!![]});}})[_0x7fc1('0x22')](handleEntityNotFound(_0x19ead1,null))['then'](function(_0x52a5b4){_0x87bd80['contact']=_0x52a5b4;if(_0x52a5b4){var _0x1e6619={'ContactId':_0x52a5b4['id'],'OpenchannelAccountId':_0x5275f8[_0x7fc1('0x56')]['id'],'from':(_0x52a5b4[_0x7fc1('0x8a')]||'')+'\x20'+(_0x52a5b4[_0x7fc1('0x8b')]||'')};var _0x487bc7={'OpenchannelAccountId':_0x5275f8['params']['id'],'closed':![]};if(_0x5275f8['body'][_0x7fc1('0x8c')]){_0x487bc7[_0x7fc1('0x8c')]=_0x5275f8[_0x7fc1('0x59')][_0x7fc1('0x8c')];return db[_0x7fc1('0x8d')][_0x7fc1('0x58')]({'where':_0x487bc7})[_0x7fc1('0x22')](function(_0x3281c8){if(_0x3281c8){return[_0x3281c8,![]];}_0x1e6619[_0x7fc1('0x8c')]=_0x5275f8[_0x7fc1('0x59')]['threadId'];_0x1e6619['externalUrl']=_0x5275f8[_0x7fc1('0x59')]['externalUrl'];return db[_0x7fc1('0x8d')][_0x7fc1('0x5e')](_0x1e6619)[_0x7fc1('0x22')](function(_0x1aaf75){return[_0x1aaf75,!![]];});});}else{_0x487bc7[_0x7fc1('0x8c')]=null;}_0x487bc7[_0x7fc1('0x8e')]=_0x52a5b4['id'];return db['OpenchannelInteraction'][_0x7fc1('0x58')]({'where':_0x487bc7})[_0x7fc1('0x22')](function(_0x4e370f){if(_0x4e370f){return[_0x4e370f,![]];}return db[_0x7fc1('0x8d')][_0x7fc1('0x5e')](_0x1e6619)[_0x7fc1('0x22')](function(_0x389b69){return[_0x389b69,!![]];});});}})[_0x7fc1('0x8f')](function(_0x98ad70,_0x3bc1d2){if(_0x98ad70){_0x5e42f2=_0x3bc1d2;if(!_0x3bc1d2){var _0x5aeb6c={'from':(_0x87bd80[_0x7fc1('0x90')][_0x7fc1('0x8a')]||'')+'\x20'+(_0x87bd80[_0x7fc1('0x90')][_0x7fc1('0x8b')]||'')};if(_0x5275f8[_0x7fc1('0x59')][_0x7fc1('0x8c')]&&_0x5275f8[_0x7fc1('0x59')][_0x7fc1('0x91')]&&_0x5275f8[_0x7fc1('0x59')]['threadId']!=_0x5275f8[_0x7fc1('0x59')][_0x7fc1('0x91')]){_0x5aeb6c[_0x7fc1('0x8c')]=_0x5275f8[_0x7fc1('0x59')][_0x7fc1('0x91')];}return _0x98ad70[_0x7fc1('0x38')](_0x5aeb6c);}else{return _0x98ad70;}}})[_0x7fc1('0x22')](function(_0x28e9bb){_0x87bd80[_0x7fc1('0x92')]=_0x28e9bb[_0x7fc1('0x39')]({'plain':!![]});_0x87bd80[_0x7fc1('0x92')][_0x7fc1('0x93')]=_0x5e42f2;if(_0x87bd80[_0x7fc1('0x92')]['created']){if(_0x87bd80[_0x7fc1('0x83')]['autoclose']){_0x87bd80[_0x7fc1('0x84')][_0x7fc1('0x94')]({'id':0x0,'priority':_0x87bd80['applications'][_0x7fc1('0x49')]+0x1,'app':_0x7fc1('0x95'),'appdata':_0x7fc1('0x96'),'interval':_0x7fc1('0x97')});}}return db[_0x7fc1('0x98')][_0x7fc1('0x5e')]({'body':_0x5275f8['body']['body'],'OpenchannelAccountId':_0x5275f8[_0x7fc1('0x56')]['id'],'OpenchannelInteractionId':_0x28e9bb['id'],'direction':'in','ContactId':_0x87bd80[_0x7fc1('0x90')]['id'],'AttachmentId':_0x5275f8[_0x7fc1('0x59')][_0x7fc1('0x99')]});})[_0x7fc1('0x22')](function(_0x4f8b2f){_0x87bd80[_0x7fc1('0x29')]=_0x4f8b2f;if(!_0x87bd80[_0x7fc1('0x92')][_0x7fc1('0x9a')])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x87bd80['interaction'][_0x7fc1('0x9a')]}});})[_0x7fc1('0x22')](function(_0x675112){if(_0x675112){_0x87bd80[_0x7fc1('0x84')][_0x7fc1('0x9b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x675112[_0x7fc1('0x3c')]+','+(_0x87bd80[_0x7fc1('0x83')][_0x7fc1('0x9c')]||0xa),'interval':_0x7fc1('0x97')});}if(!_0x87bd80[_0x7fc1('0x92')]['queueId'])return;return db[_0x7fc1('0x9d')][_0x7fc1('0x58')]({'attributes':['id',_0x7fc1('0x3c')],'where':{'id':_0x87bd80[_0x7fc1('0x92')][_0x7fc1('0x9e')]}});})[_0x7fc1('0x22')](function(_0x55cb98){if(_0x55cb98){_0x87bd80[_0x7fc1('0x84')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x55cb98[_0x7fc1('0x3c')]+','+(_0x87bd80[_0x7fc1('0x83')][_0x7fc1('0x9f')]||0x12c),'interval':_0x7fc1('0x97')});}return respondWithRpcPromise('Start',_0x7fc1('0xa0'),_0x87bd80);})[_0x7fc1('0x22')](function(_0xff6d1a){respondWithRpcPromise(_0x7fc1('0xa1'),'EventManager',{'event':_0x7fc1('0x6f'),'message':_0xff6d1a},client9002);return _0xff6d1a;})['then'](respondWithResult(_0x19ead1,null))[_0x7fc1('0x2b')](handleError(_0x19ead1,null));};exports[_0x7fc1('0xa2')]=function(_0xd79842,_0x21b102){var _0x890dc6=_0xd79842[_0x7fc1('0x56')]['id'];var _0x805f5a=_0xd79842[_0x7fc1('0x59')];var _0x5105f6=0xc8;var _0x47798c=null;return db[_0x7fc1('0xa3')][_0x7fc1('0xa4')]({'isolationLevel':db[_0x7fc1('0xa3')][_0x7fc1('0xa5')][_0x7fc1('0xa6')][_0x7fc1('0xa7')]},function(_0x354508){return db[_0x7fc1('0x51')][_0x7fc1('0x66')]({'where':{'id':_0x890dc6},'transaction':_0x354508})[_0x7fc1('0x22')](function(_0x4aee8a){if(_0x4aee8a){return db[_0x7fc1('0x80')][_0x7fc1('0x60')]({'where':{'OpenchannelAccountId':_0x890dc6},'transaction':_0x354508})[_0x7fc1('0x22')](function(){var _0x293640=_[_0x7fc1('0x40')](_0x805f5a,function(_0x169ed7){_0x169ed7[_0x7fc1('0x63')]=_0x890dc6;return _0x169ed7;});return db[_0x7fc1('0x80')][_0x7fc1('0xa8')](_0x293640,{'transaction':_0x354508});});}else{_0x5105f6=0x194;_0x47798c=[];}});})[_0x7fc1('0x22')](function(){if(_0x5105f6!==0x194){return db[_0x7fc1('0x80')][_0x7fc1('0xa9')]({'where':{'OpenchannelAccountId':_0x890dc6},'order':_0x7fc1('0x87')})['then'](function(_0x4d75fc){_0x47798c=_0x4d75fc;});}})[_0x7fc1('0x2b')](function(_0x16b642){_0x5105f6=0x1f4;logger[_0x7fc1('0x27')](_0x16b642[_0x7fc1('0x3b')]);if(_0x16b642['name']){delete _0x16b642[_0x7fc1('0x3c')];}_0x47798c=_0x16b642;})[_0x7fc1('0xaa')](function(){if(_0x47798c===null){_0x21b102[_0x7fc1('0x2c')](_0x5105f6);}else{if(_0x5105f6===0x1f4){_0x21b102[_0x7fc1('0x33')](_0x5105f6)[_0x7fc1('0xab')](_0x47798c);}else{_0x21b102[_0x7fc1('0x33')](_0x5105f6)['json'](_0x47798c);}}});};exports[_0x7fc1('0xac')]=function(_0x3bff5a,_0x382e02,_0x1d17de){var _0x64762e={};var _0x5c17f1={};var _0x29ee44;var _0x181086;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3bff5a[_0x7fc1('0x56')]['id']}})[_0x7fc1('0x22')](handleEntityNotFound(_0x382e02,null))[_0x7fc1('0x22')](function(_0x4866b8){if(_0x4866b8){_0x29ee44=_0x4866b8;_0x5c17f1[_0x7fc1('0x48')]=_['keys'](db[_0x7fc1('0x80')][_0x7fc1('0x67')]);_0x5c17f1[_0x7fc1('0x46')]=_[_0x7fc1('0x43')](_0x3bff5a[_0x7fc1('0x46')]);_0x5c17f1[_0x7fc1('0x44')]=_[_0x7fc1('0x45')](_0x5c17f1[_0x7fc1('0x48')],_0x5c17f1[_0x7fc1('0x46')]);_0x64762e[_0x7fc1('0x47')]=_[_0x7fc1('0x45')](_0x5c17f1[_0x7fc1('0x48')],qs[_0x7fc1('0x57')](_0x3bff5a[_0x7fc1('0x46')][_0x7fc1('0x57')]));_0x64762e[_0x7fc1('0x47')]=_0x64762e[_0x7fc1('0x47')][_0x7fc1('0x49')]?_0x64762e[_0x7fc1('0x47')]:_0x5c17f1[_0x7fc1('0x48')];_0x64762e[_0x7fc1('0x4b')]=qs[_0x7fc1('0x4c')](_0x3bff5a['query'][_0x7fc1('0x4c')]);_0x64762e[_0x7fc1('0x4d')]=qs[_0x7fc1('0x44')](_[_0x7fc1('0x6d')](_0x3bff5a[_0x7fc1('0x46')],_0x5c17f1['filters']));if(_0x3bff5a[_0x7fc1('0x46')][_0x7fc1('0x4e')]){_0x64762e['where']=_[_0x7fc1('0x4f')](_0x64762e[_0x7fc1('0x4d')],{'$or':_[_0x7fc1('0x40')](_0x64762e[_0x7fc1('0x47')],function(_0x467293){var _0x59849c={};_0x59849c[_0x467293]={'$like':'%'+_0x3bff5a[_0x7fc1('0x46')][_0x7fc1('0x4e')]+'%'};return _0x59849c;})});}_0x64762e=_[_0x7fc1('0x4f')]({},_0x64762e,_0x3bff5a['options']);return _0x29ee44[_0x7fc1('0xac')](_0x64762e);}})[_0x7fc1('0x22')](function(_0x313ea1){if(_0x313ea1){_0x181086=_0x313ea1[_0x7fc1('0x49')];if(!_0x3bff5a[_0x7fc1('0x46')]['hasOwnProperty'](_0x7fc1('0x68'))){_0x64762e[_0x7fc1('0x32')]=qs[_0x7fc1('0x32')](_0x3bff5a[_0x7fc1('0x46')]['limit']);_0x64762e[_0x7fc1('0x2f')]=qs[_0x7fc1('0x2f')](_0x3bff5a[_0x7fc1('0x46')][_0x7fc1('0x2f')]);}return _0x29ee44[_0x7fc1('0xac')](_0x64762e);}})[_0x7fc1('0x22')](function(_0x4cd0b4){if(_0x4cd0b4){return _0x4cd0b4?{'count':_0x181086,'rows':_0x4cd0b4}:null;}})[_0x7fc1('0x22')](respondWithResult(_0x382e02,null))[_0x7fc1('0x2b')](handleError(_0x382e02,null));};exports[_0x7fc1('0xad')]=function(_0x1e2887,_0x5d2b3a,_0x4bb095){var _0x560fb5={'raw':![],'where':{}};var _0x58c541={};var _0x2d2721={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1e2887[_0x7fc1('0x56')]['id']}})[_0x7fc1('0x22')](handleEntityNotFound(_0x5d2b3a,null))[_0x7fc1('0x22')](function(_0x4b52e7){if(_0x4b52e7){_0x58c541[_0x7fc1('0x48')]=_[_0x7fc1('0x43')](db[_0x7fc1('0x8d')][_0x7fc1('0x67')]);_0x58c541[_0x7fc1('0x46')]=_[_0x7fc1('0x43')](_0x1e2887[_0x7fc1('0x46')]);_0x58c541[_0x7fc1('0x44')]=_[_0x7fc1('0x45')](_0x58c541[_0x7fc1('0x48')],_0x58c541[_0x7fc1('0x46')]);_0x560fb5[_0x7fc1('0x47')]=_['intersection'](_0x58c541[_0x7fc1('0x48')],qs[_0x7fc1('0x57')](_0x1e2887[_0x7fc1('0x46')]['fields']));_0x560fb5[_0x7fc1('0x47')]=_0x560fb5[_0x7fc1('0x47')][_0x7fc1('0x49')]?_0x560fb5[_0x7fc1('0x47')]:_0x58c541[_0x7fc1('0x48')];if(!_0x1e2887[_0x7fc1('0x46')][_0x7fc1('0x4a')]('nolimit')){_0x560fb5[_0x7fc1('0x32')]=qs[_0x7fc1('0x32')](_0x1e2887['query'][_0x7fc1('0x32')]);_0x560fb5[_0x7fc1('0x2f')]=qs[_0x7fc1('0x2f')](_0x1e2887['query'][_0x7fc1('0x2f')]);}_0x560fb5[_0x7fc1('0x4b')]=qs[_0x7fc1('0x4c')](_0x1e2887['query'][_0x7fc1('0x4c')]);_0x560fb5[_0x7fc1('0x4d')]=qs[_0x7fc1('0x44')](_[_0x7fc1('0x6d')](_0x1e2887['query'],_0x58c541['filters']));_0x560fb5[_0x7fc1('0x4d')]['OpenchannelAccountId']=_0x4b52e7['id'];if(_0x1e2887[_0x7fc1('0x46')]['filter']){_0x560fb5[_0x7fc1('0x4d')]=_[_0x7fc1('0x4f')](_0x560fb5[_0x7fc1('0x4d')],{'$or':_[_0x7fc1('0x40')](_0x560fb5[_0x7fc1('0x47')],function(_0xec17a){var _0x5ac685={};_0x5ac685[_0xec17a]={'$like':'%'+_0x1e2887[_0x7fc1('0x46')][_0x7fc1('0x4e')]+'%'};return _0x5ac685;})});}_0x560fb5=_[_0x7fc1('0x4f')]({},_0x560fb5,_0x1e2887[_0x7fc1('0x50')]);return db[_0x7fc1('0x8d')][_0x7fc1('0x31')]({'where':_0x560fb5[_0x7fc1('0x4d')]})[_0x7fc1('0x22')](function(_0x369616){_0x2d2721['count']=_0x369616;if(_0x1e2887['query']['includeAll']){_0x560fb5[_0x7fc1('0x53')]=[{'model':db[_0x7fc1('0x71')],'as':'Contact','required':![]},{'model':db[_0x7fc1('0xae')],'as':_0x7fc1('0xaf'),'attributes':['name',_0x7fc1('0xb0'),'internal'],'required':![]},{'model':db[_0x7fc1('0xb1')],'as':'Tags','attributes':['id',_0x7fc1('0x3c'),_0x7fc1('0xb2')],'where':_0x1e2887['query'][_0x7fc1('0xb3')]?{'id':_0x1e2887[_0x7fc1('0x46')][_0x7fc1('0xb3')]}:undefined,'required':_0x1e2887[_0x7fc1('0x46')][_0x7fc1('0xb3')]?!![]:![]}];}return db[_0x7fc1('0x8d')][_0x7fc1('0x54')](_0x560fb5);})[_0x7fc1('0x22')](function(_0x185df9){_0x2d2721[_0x7fc1('0x55')]=_0x185df9;return _0x2d2721;});}})[_0x7fc1('0x22')](respondWithFilteredResult(_0x5d2b3a,_0x560fb5))[_0x7fc1('0x2b')](handleError(_0x5d2b3a,null));};exports[_0x7fc1('0xb4')]=function(_0xbf3021,_0xb56e6c,_0x5293d8){return db[_0x7fc1('0x51')][_0x7fc1('0x58')]({'where':{'id':_0xbf3021['params']['id']}})[_0x7fc1('0x22')](handleEntityNotFound(_0xb56e6c,null))[_0x7fc1('0x22')](function(_0x5e06ca){if(_0x5e06ca){return _0x5e06ca[_0x7fc1('0xb4')](_0xbf3021[_0x7fc1('0x59')][_0x7fc1('0x6a')],_[_0x7fc1('0xb5')](_0xbf3021[_0x7fc1('0x59')],[_0x7fc1('0x6a'),'id'])||{})[_0x7fc1('0x8f')](function(_0x19e053){for(var _0x3fc359=0x0;_0x3fc359<_0xbf3021[_0x7fc1('0x59')][_0x7fc1('0x6a')][_0x7fc1('0x49')];_0x3fc359+=0x1){socket[_0x7fc1('0xb6')](_0x7fc1('0xb7'),{'UserId':Number(_0xbf3021['body'][_0x7fc1('0x6a')][_0x3fc359]),'OpenchannelAccountId':Number(_0xbf3021[_0x7fc1('0x56')]['id'])});}return _0x19e053;});}})['then'](respondWithResult(_0xb56e6c,null))[_0x7fc1('0x2b')](handleError(_0xb56e6c,null));};exports[_0x7fc1('0xb8')]=function(_0x54342d,_0x2c1766,_0x534604){return db[_0x7fc1('0x51')][_0x7fc1('0x58')]({'where':{'id':_0x54342d['params']['id']}})[_0x7fc1('0x22')](handleEntityNotFound(_0x2c1766,null))[_0x7fc1('0x22')](function(_0xfd967e){if(_0xfd967e){return _0xfd967e[_0x7fc1('0xb8')](_0x54342d[_0x7fc1('0x46')][_0x7fc1('0x6a')])[_0x7fc1('0x22')](function(){if(_[_0x7fc1('0xb9')](_0x54342d['query'][_0x7fc1('0x6a')])){for(var _0x25c72a=0x0;_0x25c72a<_0x54342d[_0x7fc1('0x46')][_0x7fc1('0x6a')][_0x7fc1('0x49')];_0x25c72a+=0x1){socket[_0x7fc1('0xb6')](_0x7fc1('0xba'),{'UserId':Number(_0x54342d['query'][_0x7fc1('0x6a')][_0x25c72a]),'OpenchannelAccountId':Number(_0x54342d[_0x7fc1('0x56')]['id'])});}}else{socket[_0x7fc1('0xb6')](_0x7fc1('0xba'),{'UserId':Number(_0x54342d[_0x7fc1('0x46')][_0x7fc1('0x6a')]),'OpenchannelAccountId':Number(_0x54342d[_0x7fc1('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c1766,null))['catch'](handleError(_0x2c1766,null));};exports[_0x7fc1('0xbb')]=function(_0x2ce672,_0x5a4127,_0x5a4427){var _0x264dd8={};var _0x503ab7={};var _0x3cbde5;var _0x5eaf65;return db[_0x7fc1('0x51')][_0x7fc1('0x66')]({'where':{'id':_0x2ce672[_0x7fc1('0x56')]['id']}})[_0x7fc1('0x22')](handleEntityNotFound(_0x5a4127,null))[_0x7fc1('0x22')](function(_0x5916e4){if(_0x5916e4){_0x3cbde5=_0x5916e4;_0x503ab7[_0x7fc1('0x48')]=_[_0x7fc1('0x43')](db[_0x7fc1('0xae')][_0x7fc1('0x67')]);_0x503ab7[_0x7fc1('0x46')]=_[_0x7fc1('0x43')](_0x2ce672['query']);_0x503ab7[_0x7fc1('0x44')]=_[_0x7fc1('0x45')](_0x503ab7[_0x7fc1('0x48')],_0x503ab7[_0x7fc1('0x46')]);_0x264dd8[_0x7fc1('0x47')]=_['intersection'](_0x503ab7[_0x7fc1('0x48')],qs['fields'](_0x2ce672[_0x7fc1('0x46')][_0x7fc1('0x57')]));_0x264dd8['attributes']=_0x264dd8[_0x7fc1('0x47')]['length']?_0x264dd8['attributes']:_0x503ab7[_0x7fc1('0x48')];_0x264dd8['order']=qs[_0x7fc1('0x4c')](_0x2ce672[_0x7fc1('0x46')][_0x7fc1('0x4c')]);_0x264dd8[_0x7fc1('0x4d')]=qs[_0x7fc1('0x44')](_['pick'](_0x2ce672[_0x7fc1('0x46')],_0x503ab7[_0x7fc1('0x44')]));if(_0x2ce672[_0x7fc1('0x46')]['filter']){_0x264dd8[_0x7fc1('0x4d')]=_[_0x7fc1('0x4f')](_0x264dd8[_0x7fc1('0x4d')],{'$or':_[_0x7fc1('0x40')](_0x264dd8[_0x7fc1('0x47')],function(_0x5eb79a){var _0x6f3ea9={};_0x6f3ea9[_0x5eb79a]={'$like':'%'+_0x2ce672['query'][_0x7fc1('0x4e')]+'%'};return _0x6f3ea9;})});}_0x264dd8=_[_0x7fc1('0x4f')]({},_0x264dd8,_0x2ce672['options']);return _0x3cbde5[_0x7fc1('0xbb')](_0x264dd8);}})[_0x7fc1('0x22')](function(_0x2a921d){if(_0x2a921d){_0x5eaf65=_0x2a921d[_0x7fc1('0x49')];if(!_0x2ce672['query'][_0x7fc1('0x4a')](_0x7fc1('0x68'))){_0x264dd8[_0x7fc1('0x32')]=qs[_0x7fc1('0x32')](_0x2ce672[_0x7fc1('0x46')][_0x7fc1('0x32')]);_0x264dd8['offset']=qs[_0x7fc1('0x2f')](_0x2ce672[_0x7fc1('0x46')][_0x7fc1('0x2f')]);}return _0x3cbde5[_0x7fc1('0xbb')](_0x264dd8);}})[_0x7fc1('0x22')](function(_0x412c7e){if(_0x412c7e){return _0x412c7e?{'count':_0x5eaf65,'rows':_0x412c7e}:null;}})['then'](respondWithResult(_0x5a4127,null))['catch'](handleError(_0x5a4127,null));};exports[_0x7fc1('0xab')]=function(_0x1d079a,_0x5f12e0,_0x40aad8){var _0x5a774a,_0x5c816c,_0x5b7309;if(_[_0x7fc1('0x77')](_0x1d079a['body'][_0x7fc1('0x59')])||_0x1d079a[_0x7fc1('0x59')][_0x7fc1('0x59')]===''){throw new db['Sequelize'][(_0x7fc1('0x72'))](_0x7fc1('0x7a'));}if(_[_0x7fc1('0x77')](_0x1d079a[_0x7fc1('0x59')]['to'])){}_0x5a774a=_0x1d079a[_0x7fc1('0x59')]['to'];return db[_0x7fc1('0x51')][_0x7fc1('0x66')]({'where':{'id':_0x1d079a[_0x7fc1('0x56')]['id']}})[_0x7fc1('0x22')](handleEntityNotFound(_0x5f12e0,null))[_0x7fc1('0x22')](function(_0x35cf99){if(_0x35cf99){return db['OpenchannelAccount']['find']({'where':{'id':_0x35cf99['id']},'include':[{'model':db['CmList'],'as':_0x7fc1('0x82'),'include':[{'model':db[_0x7fc1('0x71')],'as':_0x7fc1('0x7e'),'where':{[_0x35cf99[_0x7fc1('0x7b')]]:_0x5a774a},'limit':0x1,'order':[[_0x7fc1('0x7f'),_0x7fc1('0xbc')]]}]}]})[_0x7fc1('0x22')](handleEntityNotFound(_0x5f12e0,null))[_0x7fc1('0x22')](function(_0x277fee){if(_0x277fee&&_0x277fee['List']){_0x5c816c=_0x277fee[_0x7fc1('0x39')]({'plain':!![]});if(_0x5c816c[_0x7fc1('0x82')]&&_0x5c816c['List'][_0x7fc1('0x7e')][_0x7fc1('0x49')]){return _0x5c816c[_0x7fc1('0x82')][_0x7fc1('0x7e')][0x0];}return db[_0x7fc1('0x71')][_0x7fc1('0x5e')](_[_0x7fc1('0x1c')](_0x1d079a[_0x7fc1('0x59')],{'firstName':_0x5a774a,[_0x277fee[_0x7fc1('0x7b')]]:_0x5a774a,'phone':_0x5a774a,'ListId':_0x5c816c['ListId']}));}})['then'](handleEntityNotFound(_0x5f12e0,null))[_0x7fc1('0x22')](function(_0x51ab7b){if(_0x51ab7b){_0x5b7309=_0x51ab7b;return db['OpenchannelInteraction'][_0x7fc1('0x58')]({'where':{'ContactId':_0x5b7309['id'],'closed':![],'OpenchannelAccountId':_0x5c816c['id']}})[_0x7fc1('0x22')](function(_0x3ad916){if(_0x3ad916){return[_0x3ad916,![]];}return db[_0x7fc1('0x8d')]['create']({'UserId':_0x1d079a[_0x7fc1('0x5b')]['id'],'ContactId':_0x5b7309['id'],'OpenchannelAccountId':_0x5c816c['id'],'lastMsgDirection':_0x7fc1('0xbd'),'firstMsgDirection':_0x7fc1('0xbd'),'Messages':[_[_0x7fc1('0x4f')](_0x1d079a[_0x7fc1('0x59')],{'read':![],'body':_0x1d079a[_0x7fc1('0x59')][_0x7fc1('0x59')],'OpenchannelAccountId':_0x5c816c['id'],'UserId':_0x1d079a[_0x7fc1('0x5b')]['id'],'ContactId':_0x5b7309['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x7fc1('0xbe')}]})['then'](function(_0x1ceefd){return[_0x1ceefd,!![]];});});}})['spread'](function(_0xa1e4b6,_0x403bc6){if(_0x403bc6){return _0xa1e4b6;}return db[_0x7fc1('0x98')][_0x7fc1('0x5e')](_[_0x7fc1('0x4f')](_0x1d079a[_0x7fc1('0x59')],{'read':![],'body':_0x1d079a['body']['body'],'OpenchannelAccountId':_0x5c816c['id'],'OpenchannelInteractionId':_0xa1e4b6['id'],'UserId':_0x1d079a['user']['id'],'ContactId':_0x5b7309['id']}))['then'](function(_0x536d10){_0xa1e4b6[_0x7fc1('0xbf')][_0x7fc1('0xbe')]=[];_0xa1e4b6[_0x7fc1('0xbf')]['Messages'][_0x7fc1('0x94')](_0x536d10[_0x7fc1('0xbf')]);return _0xa1e4b6;});});}})[_0x7fc1('0x22')](respondWithResult(_0x5f12e0,null))[_0x7fc1('0x2b')](handleError(_0x5f12e0,null));}; \ No newline at end of file +var _0x79bf=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','includes','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','asc','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','findAndCountAll','stack','finally','send','getApplications','getInteractions','Contact','User','Owner','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','OpenchannelMessage','Messages','dataValues','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','update','destroy','get','OpenchannelAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','OpenchannelAccount','findAll','show','params','intersection','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId'];(function(_0x2c5a9f,_0xc94df5){var _0x496312=function(_0x50108b){while(--_0x50108b){_0x2c5a9f['push'](_0x2c5a9f['shift']());}};_0x496312(++_0xc94df5);}(_0x79bf,0x1df));var _0xf79b=function(_0x8eb9d,_0x320ee6){_0x8eb9d=_0x8eb9d-0x0;var _0x28c28=_0x79bf[_0x8eb9d];return _0x28c28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf79b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf79b('0x1'));var rp=require('request-promise');var moment=require(_0xf79b('0x2'));var BPromise=require(_0xf79b('0x3'));var Mustache=require(_0xf79b('0x4'));var util=require(_0xf79b('0x5'));var path=require(_0xf79b('0x6'));var sox=require(_0xf79b('0x7'));var csv=require(_0xf79b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf79b('0x9'));var _=require(_0xf79b('0xa'));var squel=require(_0xf79b('0xb'));var crypto=require('crypto');var jsforce=require(_0xf79b('0xc'));var deskjs=require(_0xf79b('0xd'));var toCsv=require(_0xf79b('0x8'));var querystring=require(_0xf79b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf79b('0xf'));var qs=require(_0xf79b('0x10'));var as=require(_0xf79b('0x11'));var hardwareService=require(_0xf79b('0x12'));var logger=require(_0xf79b('0x13'))(_0xf79b('0x14'));var utils=require(_0xf79b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf79b('0x16'));var db=require(_0xf79b('0x17'))['db'];config[_0xf79b('0x18')]=_[_0xf79b('0x19')](config[_0xf79b('0x18')],{'host':_0xf79b('0x1a'),'port':0x18eb});var socket=require(_0xf79b('0x1b'))(new Redis(config[_0xf79b('0x18')]));require(_0xf79b('0x1c'))[_0xf79b('0x1d')](socket);var jayson=require(_0xf79b('0x1e'));var client=jayson[_0xf79b('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0xf79b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x595790,_0x3caf78,_0x4ed585,_0x39536e){return new BPromise(function(_0x597338,_0x575294){var _0x14b21d=_0x39536e||client;return _0x14b21d['request'](_0x595790,_0x4ed585)[_0xf79b('0x21')](function(_0x97c15d){logger[_0xf79b('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x3caf78,_0xf79b('0x23'));logger['debug'](_0xf79b('0x24'),_0x3caf78,_0xf79b('0x23'),JSON[_0xf79b('0x25')](_0x97c15d));if(_0x97c15d[_0xf79b('0x26')]){if(_0x97c15d[_0xf79b('0x26')]['code']===0x1f4){logger[_0xf79b('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x3caf78,_0x97c15d['error'][_0xf79b('0x27')]);return _0x575294(_0x97c15d[_0xf79b('0x26')][_0xf79b('0x27')]);}logger[_0xf79b('0x26')](_0xf79b('0x28'),_0x3caf78,_0x97c15d[_0xf79b('0x26')]['message']);return _0x597338(_0x97c15d[_0xf79b('0x26')][_0xf79b('0x27')]);}else{logger[_0xf79b('0x22')](_0xf79b('0x28'),_0x3caf78,_0xf79b('0x23'));_0x597338(_0x97c15d[_0xf79b('0x29')][_0xf79b('0x27')]);}})[_0xf79b('0x2a')](function(_0xf1480e){logger[_0xf79b('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x3caf78,_0xf1480e);_0x575294(_0xf1480e);});});}function respondWithStatusCode(_0x2dfa65,_0x5e7f72){_0x5e7f72=_0x5e7f72||0xcc;return function(_0x55740a){if(_0x55740a){return _0x2dfa65[_0xf79b('0x2b')](_0x5e7f72);}return _0x2dfa65['status'](_0x5e7f72)[_0xf79b('0x2c')]();};}function respondWithResult(_0x112019,_0x291c8a){_0x291c8a=_0x291c8a||0xc8;return function(_0x17a310){if(_0x17a310){return _0x112019[_0xf79b('0x2d')](_0x291c8a)[_0xf79b('0x2e')](_0x17a310);}};}function respondWithFilteredResult(_0x3e6171,_0x479b41){return function(_0x1bd31c){if(_0x1bd31c){var _0x470f5b=typeof _0x479b41[_0xf79b('0x2f')]==='undefined'&&typeof _0x479b41[_0xf79b('0x30')]===_0xf79b('0x31');var _0x4fbb4b=_0x1bd31c[_0xf79b('0x32')];var _0x55e264=_0x470f5b?0x0:_0x479b41[_0xf79b('0x2f')];var _0x45be6=_0x470f5b?_0x1bd31c[_0xf79b('0x32')]:_0x479b41[_0xf79b('0x2f')]+_0x479b41[_0xf79b('0x30')];var _0x22cbd9;if(_0x45be6>=_0x4fbb4b){_0x45be6=_0x4fbb4b;_0x22cbd9=0xc8;}else{_0x22cbd9=0xce;}_0x3e6171[_0xf79b('0x2d')](_0x22cbd9);return _0x3e6171[_0xf79b('0x33')]('Content-Range',_0x55e264+'-'+_0x45be6+'/'+_0x4fbb4b)[_0xf79b('0x2e')](_0x1bd31c);}return null;};}function patchUpdates(_0x1e0702){return function(_0x3d33c0){try{jsonpatch[_0xf79b('0x34')](_0x3d33c0,_0x1e0702,!![]);}catch(_0x24e603){return BPromise['reject'](_0x24e603);}return _0x3d33c0['save']();};}function saveUpdates(_0x3e6829,_0xadccc0){return function(_0x69f2a6){if(_0x69f2a6){return _0x69f2a6[_0xf79b('0x35')](_0x3e6829)[_0xf79b('0x21')](function(_0x4bb695){return _0x4bb695;});}return null;};}function removeEntity(_0x5701d7,_0x3c8fb5){return function(_0x1957ba){if(_0x1957ba){return _0x1957ba[_0xf79b('0x36')]()[_0xf79b('0x21')](function(){var _0x417036=_0x1957ba[_0xf79b('0x37')]({'plain':!![]});var _0x59f576=_0xf79b('0x38');return db[_0xf79b('0x39')][_0xf79b('0x36')]({'where':{'type':_0x59f576,'resourceId':_0x417036['id']}})[_0xf79b('0x21')](function(){return _0x1957ba;});})[_0xf79b('0x21')](function(){_0x5701d7['status'](0xcc)[_0xf79b('0x2c')]();});}};}function handleEntityNotFound(_0x4831d3,_0x119e4a){return function(_0x57a32e){if(!_0x57a32e){_0x4831d3[_0xf79b('0x2b')](0x194);}return _0x57a32e;};}function handleError(_0x144003,_0x13b135){_0x13b135=_0x13b135||0x1f4;return function(_0x1c62f1){logger['error'](_0x1c62f1['stack']);if(_0x1c62f1['name']){delete _0x1c62f1[_0xf79b('0x3a')];}_0x144003[_0xf79b('0x2d')](_0x13b135)['send'](_0x1c62f1);};}exports[_0xf79b('0x3b')]=function(_0x5a5707,_0x14501a){var _0x3cd65e={'include':[{'model':db[_0xf79b('0x3c')],'as':_0xf79b('0x3d')}]},_0x3533f4={},_0x51063d={'count':0x0,'rows':[]};var _0x4ae653=_[_0xf79b('0x3e')](db['OpenchannelAccount'][_0xf79b('0x3f')],function(_0x3e6d17){return{'name':_0x3e6d17[_0xf79b('0x40')],'type':_0x3e6d17[_0xf79b('0x41')][_0xf79b('0x42')]};});_0x3533f4[_0xf79b('0x43')]=_[_0xf79b('0x3e')](_0x4ae653,_0xf79b('0x3a'));_0x3533f4[_0xf79b('0x44')]=_[_0xf79b('0x45')](_0x5a5707[_0xf79b('0x44')]);_0x3533f4[_0xf79b('0x46')]=_['intersection'](_0x3533f4[_0xf79b('0x43')],_0x3533f4[_0xf79b('0x44')]);_0x3cd65e['attributes']=_['intersection'](_0x3533f4[_0xf79b('0x43')],qs[_0xf79b('0x47')](_0x5a5707[_0xf79b('0x44')][_0xf79b('0x47')]));_0x3cd65e[_0xf79b('0x48')]=_0x3cd65e['attributes'][_0xf79b('0x49')]?_0x3cd65e[_0xf79b('0x48')]:_0x3533f4[_0xf79b('0x43')];if(!_0x5a5707[_0xf79b('0x44')][_0xf79b('0x4a')](_0xf79b('0x4b'))){_0x3cd65e[_0xf79b('0x30')]=qs[_0xf79b('0x30')](_0x5a5707[_0xf79b('0x44')][_0xf79b('0x30')]);_0x3cd65e[_0xf79b('0x2f')]=qs[_0xf79b('0x2f')](_0x5a5707[_0xf79b('0x44')][_0xf79b('0x2f')]);}_0x3cd65e[_0xf79b('0x4c')]=qs[_0xf79b('0x4d')](_0x5a5707['query'][_0xf79b('0x4d')]);_0x3cd65e['where']=qs[_0xf79b('0x46')](_[_0xf79b('0x4e')](_0x5a5707[_0xf79b('0x44')],_0x3533f4[_0xf79b('0x46')]),_0x4ae653);if(_0x5a5707[_0xf79b('0x44')][_0xf79b('0x4f')]){_0x3cd65e[_0xf79b('0x50')]=_[_0xf79b('0x51')](_0x3cd65e[_0xf79b('0x50')],{'$or':_['map'](_0x4ae653,function(_0x55f2e2){if(_0x55f2e2[_0xf79b('0x41')]!=='VIRTUAL'){var _0x4d7bdd={};_0x4d7bdd[_0x55f2e2['name']]={'$like':'%'+_0x5a5707[_0xf79b('0x44')][_0xf79b('0x4f')]+'%'};return _0x4d7bdd;}})});}_0x3cd65e=_[_0xf79b('0x51')]({},_0x3cd65e,_0x5a5707['options']);var _0xe5b3e6={'where':_0x3cd65e[_0xf79b('0x50')]};return db['OpenchannelAccount'][_0xf79b('0x32')](_0xe5b3e6)[_0xf79b('0x21')](function(_0x58d7b6){_0x51063d[_0xf79b('0x32')]=_0x58d7b6;if(_0x5a5707[_0xf79b('0x44')][_0xf79b('0x52')]){_0x3cd65e[_0xf79b('0x53')]=[{'all':!![]}];}return db[_0xf79b('0x54')][_0xf79b('0x55')](_0x3cd65e);})[_0xf79b('0x21')](function(_0x1ca74a){_0x51063d['rows']=_0x1ca74a;return _0x51063d;})[_0xf79b('0x21')](respondWithFilteredResult(_0x14501a,_0x3cd65e))[_0xf79b('0x2a')](handleError(_0x14501a,null));};exports[_0xf79b('0x56')]=function(_0x46ee8d,_0x3a2f6f){var _0x12b07c={'raw':![],'where':{'id':_0x46ee8d[_0xf79b('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xf79b('0x3d')}]},_0x5da701={};_0x5da701[_0xf79b('0x43')]=_[_0xf79b('0x45')](db['OpenchannelAccount'][_0xf79b('0x3f')]);_0x5da701['query']=_[_0xf79b('0x45')](_0x46ee8d[_0xf79b('0x44')]);_0x5da701['filters']=_[_0xf79b('0x58')](_0x5da701['model'],_0x5da701[_0xf79b('0x44')]);_0x12b07c['attributes']=_['intersection'](_0x5da701[_0xf79b('0x43')],qs[_0xf79b('0x47')](_0x46ee8d[_0xf79b('0x44')][_0xf79b('0x47')]));_0x12b07c[_0xf79b('0x48')]=_0x12b07c['attributes'][_0xf79b('0x49')]?_0x12b07c[_0xf79b('0x48')]:_0x5da701[_0xf79b('0x43')];if(_0x46ee8d[_0xf79b('0x44')]['includeAll']){_0x12b07c[_0xf79b('0x53')]=[{'all':!![]}];}_0x12b07c=_[_0xf79b('0x51')]({},_0x12b07c,_0x46ee8d[_0xf79b('0x59')]);return db['OpenchannelAccount'][_0xf79b('0x5a')](_0x12b07c)[_0xf79b('0x21')](handleEntityNotFound(_0x3a2f6f,null))['then'](respondWithResult(_0x3a2f6f,null))[_0xf79b('0x2a')](handleError(_0x3a2f6f,null));};exports[_0xf79b('0x5b')]=function(_0x46b156,_0x5f137f){return db[_0xf79b('0x54')][_0xf79b('0x5b')](_0x46b156['body'],{})['then'](function(_0x128f0f){var _0x5bad4f=_0x46b156['user']['get']({'plain':!![]});if(!_0x5bad4f)throw new Error(_0xf79b('0x5c'));if(_0x5bad4f[_0xf79b('0x5d')]===_0xf79b('0x5e')){var _0x5b1e3d=_0x128f0f[_0xf79b('0x37')]({'plain':!![]});var _0x5e1f53=_0xf79b('0x38');return db[_0xf79b('0x5f')][_0xf79b('0x5a')]({'where':{'name':_0x5e1f53,'userProfileId':_0x5bad4f[_0xf79b('0x60')]},'raw':!![]})[_0xf79b('0x21')](function(_0x31de45){if(_0x31de45&&_0x31de45['autoAssociation']===0x0){return db[_0xf79b('0x39')][_0xf79b('0x5b')]({'name':_0x5b1e3d[_0xf79b('0x3a')],'resourceId':_0x5b1e3d['id'],'type':_0x31de45['name'],'sectionId':_0x31de45['id']},{})[_0xf79b('0x21')](function(){return _0x128f0f;});}else{return _0x128f0f;}})['catch'](function(_0x5472bc){logger[_0xf79b('0x26')](_0xf79b('0x61'),_0x5472bc);throw _0x5472bc;});}return _0x128f0f;})[_0xf79b('0x21')](respondWithResult(_0x5f137f,0xc9))[_0xf79b('0x2a')](handleError(_0x5f137f,null));};exports['update']=function(_0x5ec01d,_0x3c335e){if(_0x5ec01d[_0xf79b('0x62')]['id']){delete _0x5ec01d['body']['id'];}return db[_0xf79b('0x54')][_0xf79b('0x5a')]({'where':{'id':_0x5ec01d[_0xf79b('0x57')]['id']},'include':[{'model':db[_0xf79b('0x3c')],'as':_0xf79b('0x3d')}]})[_0xf79b('0x21')](handleEntityNotFound(_0x3c335e,null))['then'](saveUpdates(_0x5ec01d[_0xf79b('0x62')],null))[_0xf79b('0x21')](respondWithResult(_0x3c335e,null))[_0xf79b('0x2a')](handleError(_0x3c335e,null));};exports['destroy']=function(_0x397eb9,_0x33d934){return db[_0xf79b('0x54')][_0xf79b('0x5a')]({'where':{'id':_0x397eb9[_0xf79b('0x57')]['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x33d934,null))['then'](removeEntity(_0x33d934,null))['catch'](handleError(_0x33d934,null));};exports[_0xf79b('0x63')]=function(_0xbbae99,_0x10178a){return db[_0xf79b('0x54')]['describe']()[_0xf79b('0x21')](respondWithResult(_0x10178a,null))[_0xf79b('0x2a')](handleError(_0x10178a,null));};exports[_0xf79b('0x64')]=function(_0x1e2da4,_0x3b79cf,_0x371481){if(_0x1e2da4[_0xf79b('0x62')]['id']){delete _0x1e2da4['body']['id'];}return db[_0xf79b('0x54')][_0xf79b('0x5a')]({'where':{'id':_0x1e2da4[_0xf79b('0x57')]['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x3b79cf,null))[_0xf79b('0x21')](function(_0x1f889e){if(_0x1f889e){_0x1e2da4['body'][_0xf79b('0x65')]=_0x1f889e['id'];return db[_0xf79b('0x66')][_0xf79b('0x5b')](_0x1e2da4[_0xf79b('0x62')]);}})[_0xf79b('0x21')](respondWithResult(_0x3b79cf,null))[_0xf79b('0x2a')](handleError(_0x3b79cf,null));};exports[_0xf79b('0x67')]=function(_0x5d2a44,_0x38c84f,_0x556d7a){var _0xb7a80a={'raw':![],'where':{}};var _0x2730b5={};var _0xd269b9={'count':0x0,'rows':[]};return db[_0xf79b('0x54')]['findOne']({'where':{'id':_0x5d2a44[_0xf79b('0x57')]['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x38c84f,null))[_0xf79b('0x21')](function(_0x9f5cae){if(_0x9f5cae){_0x2730b5[_0xf79b('0x43')]=_[_0xf79b('0x45')](db[_0xf79b('0x66')][_0xf79b('0x3f')]);_0x2730b5[_0xf79b('0x44')]=_['keys'](_0x5d2a44[_0xf79b('0x44')]);_0x2730b5[_0xf79b('0x46')]=_[_0xf79b('0x58')](_0x2730b5[_0xf79b('0x43')],_0x2730b5['query']);_0xb7a80a['attributes']=_[_0xf79b('0x58')](_0x2730b5[_0xf79b('0x43')],qs[_0xf79b('0x47')](_0x5d2a44[_0xf79b('0x44')][_0xf79b('0x47')]));_0xb7a80a[_0xf79b('0x48')]=_0xb7a80a[_0xf79b('0x48')][_0xf79b('0x49')]?_0xb7a80a[_0xf79b('0x48')]:_0x2730b5[_0xf79b('0x43')];if(!_0x5d2a44['query']['hasOwnProperty'](_0xf79b('0x4b'))){_0xb7a80a[_0xf79b('0x30')]=qs[_0xf79b('0x30')](_0x5d2a44['query'][_0xf79b('0x30')]);_0xb7a80a[_0xf79b('0x2f')]=qs[_0xf79b('0x2f')](_0x5d2a44[_0xf79b('0x44')][_0xf79b('0x2f')]);}_0xb7a80a[_0xf79b('0x4c')]=qs[_0xf79b('0x4d')](_0x5d2a44[_0xf79b('0x44')]['sort']);_0xb7a80a[_0xf79b('0x50')]=qs[_0xf79b('0x46')](_['pick'](_0x5d2a44[_0xf79b('0x44')],_0x2730b5['filters']));_0xb7a80a[_0xf79b('0x50')]['OpenchannelAccountId']=_0x9f5cae['id'];if(_0x5d2a44['query'][_0xf79b('0x4f')]){_0xb7a80a[_0xf79b('0x50')]=_[_0xf79b('0x51')](_0xb7a80a[_0xf79b('0x50')],{'$or':_[_0xf79b('0x3e')](_0xb7a80a[_0xf79b('0x48')],function(_0x5094fb){var _0x51e31c={};_0x51e31c[_0x5094fb]={'$like':'%'+_0x5d2a44[_0xf79b('0x44')]['filter']+'%'};return _0x51e31c;})});}_0xb7a80a=_[_0xf79b('0x51')]({},_0xb7a80a,_0x5d2a44[_0xf79b('0x59')]);return db[_0xf79b('0x66')][_0xf79b('0x32')]({'where':_0xb7a80a[_0xf79b('0x50')]})[_0xf79b('0x21')](function(_0x530c33){_0xd269b9[_0xf79b('0x32')]=_0x530c33;if(_0x5d2a44[_0xf79b('0x44')][_0xf79b('0x52')]){_0xb7a80a[_0xf79b('0x53')]=[{'all':!![]}];}return db[_0xf79b('0x66')][_0xf79b('0x55')](_0xb7a80a);})[_0xf79b('0x21')](function(_0x4ef901){_0xd269b9[_0xf79b('0x68')]=_0x4ef901;return _0xd269b9;});}})[_0xf79b('0x21')](respondWithFilteredResult(_0x38c84f,_0xb7a80a))[_0xf79b('0x2a')](handleError(_0x38c84f,null));};exports['removeDispositions']=function(_0x515d48,_0x4a84b0,_0x489782){return db['OpenchannelAccount'][_0xf79b('0x5a')]({'where':{'id':_0x515d48['params']['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x4a84b0,null))['then'](function(_0x2c4b79){if(_0x2c4b79){return _0x2c4b79[_0xf79b('0x69')](_0x515d48['query'][_0xf79b('0x6a')]);}})['then'](respondWithStatusCode(_0x4a84b0,null))[_0xf79b('0x2a')](handleError(_0x4a84b0,null));};exports[_0xf79b('0x6b')]=function(_0x4c619b,_0x4f1982,_0x3c5a5f){if(_0x4c619b[_0xf79b('0x62')]['id']){delete _0x4c619b[_0xf79b('0x62')]['id'];}return db[_0xf79b('0x54')][_0xf79b('0x5a')]({'where':{'id':_0x4c619b[_0xf79b('0x57')]['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x4f1982,null))[_0xf79b('0x21')](function(_0x548d9e){if(_0x548d9e){_0x4c619b['body'][_0xf79b('0x65')]=_0x548d9e['id'];return db[_0xf79b('0x6c')][_0xf79b('0x5b')](_0x4c619b['body']);}})[_0xf79b('0x21')](respondWithResult(_0x4f1982,null))[_0xf79b('0x2a')](handleError(_0x4f1982,null));};exports[_0xf79b('0x6d')]=function(_0x2f583c,_0x3b2df1,_0x2a942f){var _0xcc03a0={'raw':![],'where':{}};var _0x3e6232={};var _0x21fe17={'count':0x0,'rows':[]};return db[_0xf79b('0x54')][_0xf79b('0x6e')]({'where':{'id':_0x2f583c[_0xf79b('0x57')]['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x3b2df1,null))['then'](function(_0x55892a){if(_0x55892a){_0x3e6232[_0xf79b('0x43')]=_[_0xf79b('0x45')](db[_0xf79b('0x6c')][_0xf79b('0x3f')]);_0x3e6232[_0xf79b('0x44')]=_[_0xf79b('0x45')](_0x2f583c[_0xf79b('0x44')]);_0x3e6232[_0xf79b('0x46')]=_['intersection'](_0x3e6232[_0xf79b('0x43')],_0x3e6232[_0xf79b('0x44')]);_0xcc03a0['attributes']=_[_0xf79b('0x58')](_0x3e6232[_0xf79b('0x43')],qs[_0xf79b('0x47')](_0x2f583c[_0xf79b('0x44')][_0xf79b('0x47')]));_0xcc03a0[_0xf79b('0x48')]=_0xcc03a0[_0xf79b('0x48')][_0xf79b('0x49')]?_0xcc03a0['attributes']:_0x3e6232[_0xf79b('0x43')];if(!_0x2f583c[_0xf79b('0x44')][_0xf79b('0x4a')](_0xf79b('0x4b'))){_0xcc03a0['limit']=qs['limit'](_0x2f583c[_0xf79b('0x44')]['limit']);_0xcc03a0[_0xf79b('0x2f')]=qs['offset'](_0x2f583c[_0xf79b('0x44')][_0xf79b('0x2f')]);}_0xcc03a0[_0xf79b('0x4c')]=qs[_0xf79b('0x4d')](_0x2f583c[_0xf79b('0x44')]['sort']);_0xcc03a0['where']=qs[_0xf79b('0x46')](_[_0xf79b('0x4e')](_0x2f583c[_0xf79b('0x44')],_0x3e6232['filters']));_0xcc03a0['where'][_0xf79b('0x65')]=_0x55892a['id'];if(_0x2f583c[_0xf79b('0x44')]['filter']){_0xcc03a0['where']=_['merge'](_0xcc03a0[_0xf79b('0x50')],{'$or':_['map'](_0xcc03a0[_0xf79b('0x48')],function(_0x1c1949){var _0x34ad64={};_0x34ad64[_0x1c1949]={'$like':'%'+_0x2f583c['query'][_0xf79b('0x4f')]+'%'};return _0x34ad64;})});}_0xcc03a0=_[_0xf79b('0x51')]({},_0xcc03a0,_0x2f583c[_0xf79b('0x59')]);return db[_0xf79b('0x6c')][_0xf79b('0x32')]({'where':_0xcc03a0[_0xf79b('0x50')]})['then'](function(_0x174040){_0x21fe17[_0xf79b('0x32')]=_0x174040;if(_0x2f583c[_0xf79b('0x44')]['includeAll']){_0xcc03a0['include']=[{'all':!![]}];}return db[_0xf79b('0x6c')][_0xf79b('0x55')](_0xcc03a0);})[_0xf79b('0x21')](function(_0x3762cf){_0x21fe17[_0xf79b('0x68')]=_0x3762cf;return _0x21fe17;});}})[_0xf79b('0x21')](respondWithFilteredResult(_0x3b2df1,_0xcc03a0))[_0xf79b('0x2a')](handleError(_0x3b2df1,null));};exports[_0xf79b('0x6f')]=function(_0x41f8cb,_0x3f66bc,_0x4605fb){return db[_0xf79b('0x54')][_0xf79b('0x5a')]({'where':{'id':_0x41f8cb[_0xf79b('0x57')]['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x3f66bc,null))[_0xf79b('0x21')](function(_0xbcfb7b){if(_0xbcfb7b){return _0xbcfb7b[_0xf79b('0x6f')](_0x41f8cb['query'][_0xf79b('0x6a')]);}})[_0xf79b('0x21')](respondWithStatusCode(_0x3f66bc,null))[_0xf79b('0x2a')](handleError(_0x3f66bc,null));};exports['notify']=function(_0x9b3fe6,_0x19a281,_0x15317b){var _0x37f68e={'body':_0x9b3fe6['body'],'channel':_0xf79b('0x70')};var _0x5822f3=[];var _0x20a4d5=[];var _0x1df814={};var _0x39dbcc=![];return db[_0xf79b('0x71')][_0xf79b('0x63')]()[_0xf79b('0x21')](function(_0x33d597){if(!_0x33d597){throw new db['Sequelize']['ValidationError'](_0xf79b('0x72'));}_0x5822f3=_[_0xf79b('0x73')](_[_0xf79b('0x45')](_0x33d597),[_0xf79b('0x74'),_0xf79b('0x75')]);_0x20a4d5=_[_0xf79b('0x73')](_[_0xf79b('0x45')](_0x33d597),[_0xf79b('0x74'),_0xf79b('0x75'),'CompanyId','ListId']);if(_0x9b3fe6[_0xf79b('0x62')]['id']){delete _0x9b3fe6['body']['id'];}if(_[_0xf79b('0x76')](_0x9b3fe6['body'][_0xf79b('0x77')])){throw new db[(_0xf79b('0x78'))]['ValidationError'](_0xf79b('0x79'));}if(_[_0xf79b('0x76')](_0x9b3fe6['body'][_0xf79b('0x62')])||_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x62')]===''){throw new db[(_0xf79b('0x78'))]['ValidationError'](_0xf79b('0x7a'));}if(_[_0xf79b('0x76')](_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x7b')])){throw new db[(_0xf79b('0x78'))][(_0xf79b('0x7c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x20a4d5);}if(!_[_0xf79b('0x7d')](_0x20a4d5,_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x7b')])){throw new db[(_0xf79b('0x78'))][(_0xf79b('0x7c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x20a4d5);}_0x1df814[_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x7b')]]=_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x77')];})['then'](function(){return db[_0xf79b('0x54')][_0xf79b('0x5a')]({'where':{'id':_0x9b3fe6['params']['id']},'include':[{'model':db['CmList'],'as':_0xf79b('0x7e'),'include':[{'model':db[_0xf79b('0x71')],'as':_0xf79b('0x7f'),'where':_0x1df814,'limit':0x1,'order':[['updatedAt',_0xf79b('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0xf79b('0x81')}]});})[_0xf79b('0x21')](handleEntityNotFound(_0x19a281,null))[_0xf79b('0x21')](function(_0x34069b){if(_0x34069b&&_0x34069b[_0xf79b('0x7e')]){_0x37f68e[_0xf79b('0x82')]=_0x34069b;_0x37f68e[_0xf79b('0x83')]=_0x34069b[_0xf79b('0x81')];_0x37f68e[_0xf79b('0x84')]=_0x34069b['List'];_0x37f68e[_0xf79b('0x83')]=_[_0xf79b('0x85')](_0x37f68e[_0xf79b('0x83')],[_0xf79b('0x86')],[_0xf79b('0x87')]);if(_0x37f68e['account']['Applications']){delete _0x37f68e[_0xf79b('0x82')][_0xf79b('0x81')];}if(_0x37f68e['account'][_0xf79b('0x7e')]&&_0x37f68e['account'][_0xf79b('0x7e')][_0xf79b('0x7f')][_0xf79b('0x49')]){return _0x37f68e[_0xf79b('0x82')][_0xf79b('0x7e')][_0xf79b('0x7f')][0x0];}var _0x98db07=_[_0xf79b('0x19')](_0x9b3fe6[_0xf79b('0x62')],{'firstName':_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x77')],'ListId':_0x34069b[_0xf79b('0x88')]});_0x98db07[_0x9b3fe6['body'][_0xf79b('0x7b')]]=_0x9b3fe6[_0xf79b('0x62')]['from'];return db[_0xf79b('0x71')]['create'](_0x98db07,{'fields':_0x5822f3,'raw':!![]});}})[_0xf79b('0x21')](handleEntityNotFound(_0x19a281,null))['then'](function(_0x52a68e){_0x37f68e[_0xf79b('0x89')]=_0x52a68e;if(_0x52a68e){var _0x5f4550={'ContactId':_0x52a68e['id'],'OpenchannelAccountId':_0x9b3fe6[_0xf79b('0x57')]['id'],'from':(_0x52a68e[_0xf79b('0x8a')]||'')+'\x20'+(_0x52a68e[_0xf79b('0x8b')]||'')};var _0x30b121={'OpenchannelAccountId':_0x9b3fe6['params']['id'],'closed':![]};if(_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x8c')]){_0x30b121['threadId']=_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x8c')];return db[_0xf79b('0x8d')][_0xf79b('0x5a')]({'where':_0x30b121})[_0xf79b('0x21')](function(_0x2cab48){if(_0x2cab48){return[_0x2cab48,![]];}_0x5f4550[_0xf79b('0x8c')]=_0x9b3fe6[_0xf79b('0x62')]['threadId'];_0x5f4550['externalUrl']=_0x9b3fe6['body']['externalUrl'];return db[_0xf79b('0x8d')]['create'](_0x5f4550)[_0xf79b('0x21')](function(_0x46d9da){return[_0x46d9da,!![]];});});}else{_0x30b121[_0xf79b('0x8c')]=null;}_0x30b121['ContactId']=_0x52a68e['id'];return db[_0xf79b('0x8d')][_0xf79b('0x5a')]({'where':_0x30b121})[_0xf79b('0x21')](function(_0x103593){if(_0x103593){return[_0x103593,![]];}return db[_0xf79b('0x8d')][_0xf79b('0x5b')](_0x5f4550)[_0xf79b('0x21')](function(_0x13ac83){return[_0x13ac83,!![]];});});}})['spread'](function(_0x24e87e,_0x2a2a8e){if(_0x24e87e){_0x39dbcc=_0x2a2a8e;if(!_0x2a2a8e){var _0x39179b={'from':(_0x37f68e['contact'][_0xf79b('0x8a')]||'')+'\x20'+(_0x37f68e[_0xf79b('0x89')][_0xf79b('0x8b')]||'')};if(_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x8c')]&&_0x9b3fe6[_0xf79b('0x62')]['messageId']&&_0x9b3fe6[_0xf79b('0x62')]['threadId']!=_0x9b3fe6['body'][_0xf79b('0x8e')]){_0x39179b[_0xf79b('0x8c')]=_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x8e')];}return _0x24e87e['update'](_0x39179b);}else{return _0x24e87e;}}})[_0xf79b('0x21')](function(_0x177bd0){_0x37f68e[_0xf79b('0x8f')]=_0x177bd0['get']({'plain':!![]});_0x37f68e[_0xf79b('0x8f')][_0xf79b('0x90')]=_0x39dbcc;if(_0x37f68e['interaction'][_0xf79b('0x90')]){if(_0x37f68e[_0xf79b('0x82')][_0xf79b('0x91')]){_0x37f68e['applications'][_0xf79b('0x92')]({'id':0x0,'priority':_0x37f68e[_0xf79b('0x83')][_0xf79b('0x49')]+0x1,'app':_0xf79b('0x93'),'appdata':_0xf79b('0x94'),'interval':_0xf79b('0x95')});}}return db['OpenchannelMessage'][_0xf79b('0x5b')]({'body':_0x9b3fe6['body'][_0xf79b('0x62')],'OpenchannelAccountId':_0x9b3fe6[_0xf79b('0x57')]['id'],'OpenchannelInteractionId':_0x177bd0['id'],'direction':'in','ContactId':_0x37f68e[_0xf79b('0x89')]['id'],'AttachmentId':_0x9b3fe6[_0xf79b('0x62')][_0xf79b('0x96')]});})['then'](function(_0x4f55f5){_0x37f68e['message']=_0x4f55f5;if(!_0x37f68e[_0xf79b('0x8f')][_0xf79b('0x97')])return;return db['User'][_0xf79b('0x5a')]({'attributes':['id','name'],'where':{'id':_0x37f68e['interaction']['UserId']}});})[_0xf79b('0x21')](function(_0x30e43a){if(_0x30e43a){_0x37f68e['applications'][_0xf79b('0x98')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x30e43a[_0xf79b('0x3a')]+','+(_0x37f68e[_0xf79b('0x82')][_0xf79b('0x99')]||0xa),'interval':_0xf79b('0x95')});}if(!_0x37f68e['interaction'][_0xf79b('0x9a')])return;return db[_0xf79b('0x9b')][_0xf79b('0x5a')]({'attributes':['id',_0xf79b('0x3a')],'where':{'id':_0x37f68e[_0xf79b('0x8f')]['queueId']}});})[_0xf79b('0x21')](function(_0x374546){if(_0x374546){_0x37f68e['applications'][_0xf79b('0x98')]({'id':0x0,'priority':0x1,'app':_0xf79b('0x9c'),'appdata':_0x374546['name']+','+(_0x37f68e[_0xf79b('0x82')][_0xf79b('0x9d')]||0x12c),'interval':_0xf79b('0x95')});}return respondWithRpcPromise('Start',_0xf79b('0x9e'),_0x37f68e);})[_0xf79b('0x21')](function(_0x458c16){respondWithRpcPromise(_0xf79b('0x9f'),_0xf79b('0x9f'),{'event':_0xf79b('0xa0'),'message':_0x458c16},client9002);return _0x458c16;})[_0xf79b('0x21')](respondWithResult(_0x19a281,null))[_0xf79b('0x2a')](handleError(_0x19a281,null));};exports[_0xf79b('0xa1')]=function(_0x20b43e,_0x73ef25){var _0x4a8d29=_0x20b43e['params']['id'];var _0x233229=_0x20b43e[_0xf79b('0x62')];var _0x5264f7=0xc8;var _0x292a08=null;return db[_0xf79b('0xa2')][_0xf79b('0xa3')]({'isolationLevel':db[_0xf79b('0xa2')][_0xf79b('0xa4')][_0xf79b('0xa5')]['READ_COMMITTED']},function(_0xc2da81){return db[_0xf79b('0x54')][_0xf79b('0x6e')]({'where':{'id':_0x4a8d29},'transaction':_0xc2da81})['then'](function(_0x33a723){if(_0x33a723){return db['OpenchannelApplication'][_0xf79b('0x36')]({'where':{'OpenchannelAccountId':_0x4a8d29},'transaction':_0xc2da81})['then'](function(){var _0x2dbd19=_['map'](_0x233229,function(_0x1bbfd1){_0x1bbfd1[_0xf79b('0x65')]=_0x4a8d29;return _0x1bbfd1;});return db[_0xf79b('0xa6')][_0xf79b('0xa7')](_0x2dbd19,{'transaction':_0xc2da81});});}else{_0x5264f7=0x194;_0x292a08=[];}});})[_0xf79b('0x21')](function(){if(_0x5264f7!==0x194){return db[_0xf79b('0xa6')][_0xf79b('0xa8')]({'where':{'OpenchannelAccountId':_0x4a8d29},'order':'priority'})[_0xf79b('0x21')](function(_0x40eb1c){_0x292a08=_0x40eb1c;});}})[_0xf79b('0x2a')](function(_0x3e3725){_0x5264f7=0x1f4;logger[_0xf79b('0x26')](_0x3e3725[_0xf79b('0xa9')]);if(_0x3e3725[_0xf79b('0x3a')]){delete _0x3e3725[_0xf79b('0x3a')];}_0x292a08=_0x3e3725;})[_0xf79b('0xaa')](function(){if(_0x292a08===null){_0x73ef25[_0xf79b('0x2b')](_0x5264f7);}else{if(_0x5264f7===0x1f4){_0x73ef25[_0xf79b('0x2d')](_0x5264f7)[_0xf79b('0xab')](_0x292a08);}else{_0x73ef25[_0xf79b('0x2d')](_0x5264f7)[_0xf79b('0x2e')](_0x292a08);}}});};exports[_0xf79b('0xac')]=function(_0x49321c,_0x1414c8,_0x412950){var _0x297cfd={};var _0x23d50e={};var _0x4925f4;var _0x2d9507;return db[_0xf79b('0x54')][_0xf79b('0x6e')]({'where':{'id':_0x49321c['params']['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x1414c8,null))['then'](function(_0x46f0d9){if(_0x46f0d9){_0x4925f4=_0x46f0d9;_0x23d50e['model']=_['keys'](db[_0xf79b('0xa6')][_0xf79b('0x3f')]);_0x23d50e['query']=_[_0xf79b('0x45')](_0x49321c[_0xf79b('0x44')]);_0x23d50e[_0xf79b('0x46')]=_[_0xf79b('0x58')](_0x23d50e[_0xf79b('0x43')],_0x23d50e['query']);_0x297cfd[_0xf79b('0x48')]=_[_0xf79b('0x58')](_0x23d50e[_0xf79b('0x43')],qs[_0xf79b('0x47')](_0x49321c[_0xf79b('0x44')][_0xf79b('0x47')]));_0x297cfd[_0xf79b('0x48')]=_0x297cfd[_0xf79b('0x48')][_0xf79b('0x49')]?_0x297cfd[_0xf79b('0x48')]:_0x23d50e[_0xf79b('0x43')];_0x297cfd[_0xf79b('0x4c')]=qs['sort'](_0x49321c[_0xf79b('0x44')][_0xf79b('0x4d')]);_0x297cfd[_0xf79b('0x50')]=qs[_0xf79b('0x46')](_[_0xf79b('0x4e')](_0x49321c[_0xf79b('0x44')],_0x23d50e[_0xf79b('0x46')]));if(_0x49321c[_0xf79b('0x44')][_0xf79b('0x4f')]){_0x297cfd[_0xf79b('0x50')]=_[_0xf79b('0x51')](_0x297cfd[_0xf79b('0x50')],{'$or':_[_0xf79b('0x3e')](_0x297cfd[_0xf79b('0x48')],function(_0x1329f1){var _0x5721e0={};_0x5721e0[_0x1329f1]={'$like':'%'+_0x49321c['query']['filter']+'%'};return _0x5721e0;})});}_0x297cfd=_['merge']({},_0x297cfd,_0x49321c[_0xf79b('0x59')]);return _0x4925f4['getApplications'](_0x297cfd);}})[_0xf79b('0x21')](function(_0xa1bd5c){if(_0xa1bd5c){_0x2d9507=_0xa1bd5c[_0xf79b('0x49')];if(!_0x49321c['query'][_0xf79b('0x4a')](_0xf79b('0x4b'))){_0x297cfd[_0xf79b('0x30')]=qs['limit'](_0x49321c[_0xf79b('0x44')]['limit']);_0x297cfd[_0xf79b('0x2f')]=qs[_0xf79b('0x2f')](_0x49321c[_0xf79b('0x44')][_0xf79b('0x2f')]);}return _0x4925f4[_0xf79b('0xac')](_0x297cfd);}})[_0xf79b('0x21')](function(_0x589238){if(_0x589238){return _0x589238?{'count':_0x2d9507,'rows':_0x589238}:null;}})['then'](respondWithResult(_0x1414c8,null))[_0xf79b('0x2a')](handleError(_0x1414c8,null));};exports[_0xf79b('0xad')]=function(_0x54429e,_0x4defb9,_0x192cff){var _0x50ffc3={'raw':![],'where':{}};var _0x288531={};var _0x323496={'count':0x0,'rows':[]};return db[_0xf79b('0x54')][_0xf79b('0x6e')]({'where':{'id':_0x54429e[_0xf79b('0x57')]['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x4defb9,null))[_0xf79b('0x21')](function(_0x5c804b){if(_0x5c804b){_0x288531[_0xf79b('0x43')]=_[_0xf79b('0x45')](db[_0xf79b('0x8d')][_0xf79b('0x3f')]);_0x288531[_0xf79b('0x44')]=_['keys'](_0x54429e[_0xf79b('0x44')]);_0x288531[_0xf79b('0x46')]=_[_0xf79b('0x58')](_0x288531[_0xf79b('0x43')],_0x288531[_0xf79b('0x44')]);_0x50ffc3['attributes']=_[_0xf79b('0x58')](_0x288531['model'],qs[_0xf79b('0x47')](_0x54429e['query']['fields']));_0x50ffc3[_0xf79b('0x48')]=_0x50ffc3[_0xf79b('0x48')][_0xf79b('0x49')]?_0x50ffc3[_0xf79b('0x48')]:_0x288531[_0xf79b('0x43')];if(!_0x54429e[_0xf79b('0x44')][_0xf79b('0x4a')](_0xf79b('0x4b'))){_0x50ffc3['limit']=qs['limit'](_0x54429e[_0xf79b('0x44')][_0xf79b('0x30')]);_0x50ffc3[_0xf79b('0x2f')]=qs[_0xf79b('0x2f')](_0x54429e[_0xf79b('0x44')]['offset']);}_0x50ffc3[_0xf79b('0x4c')]=qs[_0xf79b('0x4d')](_0x54429e[_0xf79b('0x44')][_0xf79b('0x4d')]);_0x50ffc3[_0xf79b('0x50')]=qs[_0xf79b('0x46')](_[_0xf79b('0x4e')](_0x54429e['query'],_0x288531[_0xf79b('0x46')]));_0x50ffc3['where'][_0xf79b('0x65')]=_0x5c804b['id'];if(_0x54429e[_0xf79b('0x44')][_0xf79b('0x4f')]){_0x50ffc3[_0xf79b('0x50')]=_['merge'](_0x50ffc3['where'],{'$or':_['map'](_0x50ffc3['attributes'],function(_0xd527e6){var _0x1cd936={};_0x1cd936[_0xd527e6]={'$like':'%'+_0x54429e[_0xf79b('0x44')][_0xf79b('0x4f')]+'%'};return _0x1cd936;})});}_0x50ffc3=_[_0xf79b('0x51')]({},_0x50ffc3,_0x54429e[_0xf79b('0x59')]);return db['OpenchannelInteraction'][_0xf79b('0x32')]({'where':_0x50ffc3[_0xf79b('0x50')]})[_0xf79b('0x21')](function(_0x339529){_0x323496['count']=_0x339529;if(_0x54429e[_0xf79b('0x44')][_0xf79b('0x52')]){_0x50ffc3['include']=[{'model':db[_0xf79b('0x71')],'as':_0xf79b('0xae'),'required':![]},{'model':db[_0xf79b('0xaf')],'as':_0xf79b('0xb0'),'attributes':['name','fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xf79b('0xb1')],'where':_0x54429e[_0xf79b('0x44')][_0xf79b('0xb2')]?{'id':_0x54429e[_0xf79b('0x44')][_0xf79b('0xb2')]}:undefined,'required':_0x54429e['query'][_0xf79b('0xb2')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xf79b('0x55')](_0x50ffc3);})[_0xf79b('0x21')](function(_0x2f9054){_0x323496[_0xf79b('0x68')]=_0x2f9054;return _0x323496;});}})[_0xf79b('0x21')](respondWithFilteredResult(_0x4defb9,_0x50ffc3))[_0xf79b('0x2a')](handleError(_0x4defb9,null));};exports['addAgents']=function(_0x2356ed,_0x4dedf6,_0x23ebc9){return db[_0xf79b('0x54')][_0xf79b('0x5a')]({'where':{'id':_0x2356ed['params']['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x4dedf6,null))[_0xf79b('0x21')](function(_0x5475d4){if(_0x5475d4){return _0x5475d4[_0xf79b('0xb3')](_0x2356ed[_0xf79b('0x62')]['ids'],_[_0xf79b('0xb4')](_0x2356ed[_0xf79b('0x62')],['ids','id'])||{})[_0xf79b('0xb5')](function(_0x1eb356){for(var _0x2d09e4=0x0;_0x2d09e4<_0x2356ed[_0xf79b('0x62')][_0xf79b('0x6a')][_0xf79b('0x49')];_0x2d09e4+=0x1){socket[_0xf79b('0xb6')](_0xf79b('0xb7'),{'UserId':Number(_0x2356ed[_0xf79b('0x62')][_0xf79b('0x6a')][_0x2d09e4]),'OpenchannelAccountId':Number(_0x2356ed[_0xf79b('0x57')]['id'])});}return _0x1eb356;});}})['then'](respondWithResult(_0x4dedf6,null))[_0xf79b('0x2a')](handleError(_0x4dedf6,null));};exports[_0xf79b('0xb8')]=function(_0x273b07,_0xdd5bb0,_0x5d9bd1){return db['OpenchannelAccount']['find']({'where':{'id':_0x273b07[_0xf79b('0x57')]['id']}})['then'](handleEntityNotFound(_0xdd5bb0,null))[_0xf79b('0x21')](function(_0x248b91){if(_0x248b91){return _0x248b91[_0xf79b('0xb8')](_0x273b07[_0xf79b('0x44')][_0xf79b('0x6a')])[_0xf79b('0x21')](function(){if(_[_0xf79b('0xb9')](_0x273b07[_0xf79b('0x44')][_0xf79b('0x6a')])){for(var _0x49be42=0x0;_0x49be42<_0x273b07[_0xf79b('0x44')][_0xf79b('0x6a')][_0xf79b('0x49')];_0x49be42+=0x1){socket['emit'](_0xf79b('0xba'),{'UserId':Number(_0x273b07[_0xf79b('0x44')][_0xf79b('0x6a')][_0x49be42]),'OpenchannelAccountId':Number(_0x273b07['params']['id'])});}}else{socket[_0xf79b('0xb6')](_0xf79b('0xba'),{'UserId':Number(_0x273b07['query'][_0xf79b('0x6a')]),'OpenchannelAccountId':Number(_0x273b07['params']['id'])});}});}})[_0xf79b('0x21')](respondWithStatusCode(_0xdd5bb0,null))[_0xf79b('0x2a')](handleError(_0xdd5bb0,null));};exports['getAgents']=function(_0x1e2675,_0x470808,_0x2ef37c){var _0x51bb8b={};var _0x476ad2={};var _0x52ffe4;var _0x37ecfb;return db[_0xf79b('0x54')][_0xf79b('0x6e')]({'where':{'id':_0x1e2675['params']['id']}})['then'](handleEntityNotFound(_0x470808,null))['then'](function(_0x19a9c6){if(_0x19a9c6){_0x52ffe4=_0x19a9c6;_0x476ad2[_0xf79b('0x43')]=_[_0xf79b('0x45')](db[_0xf79b('0xaf')][_0xf79b('0x3f')]);_0x476ad2[_0xf79b('0x44')]=_[_0xf79b('0x45')](_0x1e2675[_0xf79b('0x44')]);_0x476ad2['filters']=_[_0xf79b('0x58')](_0x476ad2[_0xf79b('0x43')],_0x476ad2[_0xf79b('0x44')]);_0x51bb8b[_0xf79b('0x48')]=_[_0xf79b('0x58')](_0x476ad2['model'],qs[_0xf79b('0x47')](_0x1e2675[_0xf79b('0x44')][_0xf79b('0x47')]));_0x51bb8b[_0xf79b('0x48')]=_0x51bb8b[_0xf79b('0x48')][_0xf79b('0x49')]?_0x51bb8b[_0xf79b('0x48')]:_0x476ad2[_0xf79b('0x43')];_0x51bb8b[_0xf79b('0x4c')]=qs['sort'](_0x1e2675[_0xf79b('0x44')]['sort']);_0x51bb8b['where']=qs['filters'](_[_0xf79b('0x4e')](_0x1e2675['query'],_0x476ad2[_0xf79b('0x46')]));if(_0x1e2675[_0xf79b('0x44')][_0xf79b('0x4f')]){_0x51bb8b[_0xf79b('0x50')]=_[_0xf79b('0x51')](_0x51bb8b[_0xf79b('0x50')],{'$or':_[_0xf79b('0x3e')](_0x51bb8b['attributes'],function(_0x26f570){var _0x5b4d24={};_0x5b4d24[_0x26f570]={'$like':'%'+_0x1e2675[_0xf79b('0x44')][_0xf79b('0x4f')]+'%'};return _0x5b4d24;})});}_0x51bb8b=_['merge']({},_0x51bb8b,_0x1e2675[_0xf79b('0x59')]);return _0x52ffe4[_0xf79b('0xbb')](_0x51bb8b);}})['then'](function(_0x4fd93b){if(_0x4fd93b){_0x37ecfb=_0x4fd93b[_0xf79b('0x49')];if(!_0x1e2675[_0xf79b('0x44')][_0xf79b('0x4a')](_0xf79b('0x4b'))){_0x51bb8b[_0xf79b('0x30')]=qs[_0xf79b('0x30')](_0x1e2675[_0xf79b('0x44')][_0xf79b('0x30')]);_0x51bb8b[_0xf79b('0x2f')]=qs[_0xf79b('0x2f')](_0x1e2675[_0xf79b('0x44')]['offset']);}return _0x52ffe4[_0xf79b('0xbb')](_0x51bb8b);}})[_0xf79b('0x21')](function(_0x7a9a98){if(_0x7a9a98){return _0x7a9a98?{'count':_0x37ecfb,'rows':_0x7a9a98}:null;}})['then'](respondWithResult(_0x470808,null))[_0xf79b('0x2a')](handleError(_0x470808,null));};exports['send']=function(_0x2813e9,_0x4ca133,_0x4887be){var _0x44f07a,_0x5c69a5,_0x207ec4;if(_[_0xf79b('0x76')](_0x2813e9['body']['body'])||_0x2813e9[_0xf79b('0x62')][_0xf79b('0x62')]===''){throw new db[(_0xf79b('0x78'))][(_0xf79b('0x7c'))](_0xf79b('0x7a'));}if(_[_0xf79b('0x76')](_0x2813e9[_0xf79b('0x62')]['to'])){}_0x44f07a=_0x2813e9['body']['to'];return db[_0xf79b('0x54')][_0xf79b('0x6e')]({'where':{'id':_0x2813e9[_0xf79b('0x57')]['id']}})[_0xf79b('0x21')](handleEntityNotFound(_0x4ca133,null))[_0xf79b('0x21')](function(_0x433cbe){if(_0x433cbe){return db[_0xf79b('0x54')][_0xf79b('0x5a')]({'where':{'id':_0x433cbe['id']},'include':[{'model':db[_0xf79b('0xbc')],'as':_0xf79b('0x7e'),'include':[{'model':db[_0xf79b('0x71')],'as':'Contacts','where':{[_0x433cbe['mapKey']]:_0x44f07a},'limit':0x1,'order':[[_0xf79b('0x75'),_0xf79b('0x80')]]}]}]})[_0xf79b('0x21')](handleEntityNotFound(_0x4ca133,null))[_0xf79b('0x21')](function(_0x2280f5){if(_0x2280f5&&_0x2280f5[_0xf79b('0x7e')]){_0x5c69a5=_0x2280f5[_0xf79b('0x37')]({'plain':!![]});if(_0x5c69a5[_0xf79b('0x7e')]&&_0x5c69a5[_0xf79b('0x7e')][_0xf79b('0x7f')][_0xf79b('0x49')]){return _0x5c69a5[_0xf79b('0x7e')][_0xf79b('0x7f')][0x0];}return db[_0xf79b('0x71')][_0xf79b('0x5b')](_['defaults'](_0x2813e9[_0xf79b('0x62')],{'firstName':_0x44f07a,[_0x2280f5[_0xf79b('0x7b')]]:_0x44f07a,'phone':_0x44f07a,'ListId':_0x5c69a5['ListId']}));}})[_0xf79b('0x21')](handleEntityNotFound(_0x4ca133,null))['then'](function(_0x23e0a6){if(_0x23e0a6){_0x207ec4=_0x23e0a6;return db['OpenchannelInteraction'][_0xf79b('0x5a')]({'where':{'ContactId':_0x207ec4['id'],'closed':![],'OpenchannelAccountId':_0x5c69a5['id']}})[_0xf79b('0x21')](function(_0x29c491){if(_0x29c491){return[_0x29c491,![]];}return db[_0xf79b('0x8d')]['create']({'UserId':_0x2813e9['user']['id'],'ContactId':_0x207ec4['id'],'OpenchannelAccountId':_0x5c69a5['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0xf79b('0x51')](_0x2813e9['body'],{'read':![],'body':_0x2813e9['body'][_0xf79b('0x62')],'OpenchannelAccountId':_0x5c69a5['id'],'UserId':_0x2813e9[_0xf79b('0x5e')]['id'],'ContactId':_0x207ec4['id']})]},{'include':[{'model':db[_0xf79b('0xbd')],'as':_0xf79b('0xbe')}]})[_0xf79b('0x21')](function(_0x5daab9){return[_0x5daab9,!![]];});});}})[_0xf79b('0xb5')](function(_0x302741,_0x2d5a83){if(_0x2d5a83){return _0x302741;}return db[_0xf79b('0xbd')][_0xf79b('0x5b')](_['merge'](_0x2813e9[_0xf79b('0x62')],{'read':![],'body':_0x2813e9[_0xf79b('0x62')][_0xf79b('0x62')],'OpenchannelAccountId':_0x5c69a5['id'],'OpenchannelInteractionId':_0x302741['id'],'UserId':_0x2813e9[_0xf79b('0x5e')]['id'],'ContactId':_0x207ec4['id']}))[_0xf79b('0x21')](function(_0x37d648){_0x302741[_0xf79b('0xbf')][_0xf79b('0xbe')]=[];_0x302741[_0xf79b('0xbf')][_0xf79b('0xbe')][_0xf79b('0x92')](_0x37d648[_0xf79b('0xbf')]);return _0x302741;});});}})[_0xf79b('0x21')](respondWithResult(_0x4ca133,null))[_0xf79b('0x2a')](handleError(_0x4ca133,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ec90f33..8787c7b 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 _0xbdb7=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x4b288b,_0x16cf1b){var _0x3c957b=function(_0x557f6e){while(--_0x557f6e){_0x4b288b['push'](_0x4b288b['shift']());}};_0x3c957b(++_0x16cf1b);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x20c290,_0x47e736){_0x20c290=_0x20c290-0x0;var _0x3d7b3b=_0xbdb7[_0x20c290];return _0x3d7b3b;};'use strict';var EventEmitter=require(_0x7bdb('0x0'));var OpenchannelAccount=require(_0x7bdb('0x1'))['db'][_0x7bdb('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7bdb('0x3')](0x0);var events={'afterCreate':_0x7bdb('0x4'),'afterUpdate':_0x7bdb('0x5'),'afterDestroy':_0x7bdb('0x6')};function emitEvent(_0x2c7e07){return function(_0x46c068,_0x47aec5,_0x28542c){OpenchannelAccountEvents['emit'](_0x2c7e07+':'+_0x46c068['id'],_0x46c068);OpenchannelAccountEvents['emit'](_0x2c7e07,_0x46c068);_0x28542c(null);};}for(var e in events){if(events[_0x7bdb('0x7')](e)){var event=events[e];OpenchannelAccount[_0x7bdb('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x3c81=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0xe7d07d,_0x52e4e3){var _0x229e46=function(_0x376839){while(--_0x376839){_0xe7d07d['push'](_0xe7d07d['shift']());}};_0x229e46(++_0x52e4e3);}(_0x3c81,0x102));var _0x13c8=function(_0x31969a,_0x941154){_0x31969a=_0x31969a-0x0;var _0x82725a=_0x3c81[_0x31969a];return _0x82725a;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var OpenchannelAccount=require(_0x13c8('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c3ba4){return function(_0x548599,_0x101d4f,_0x3ec886){OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4+':'+_0x548599['id'],_0x548599);OpenchannelAccountEvents[_0x13c8('0x4')](_0x5c3ba4,_0x548599);_0x3ec886(null);};}for(var e in events){if(events[_0x13c8('0x5')](e)){var event=events[e];OpenchannelAccount[_0x13c8('0x6')](e,emitEvent(event));}}module[_0x13c8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index bab1bd7..3d7ef88 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(_0x9eb33c,_0x28e3bf){var _0x300bf7=function(_0xd57c7b){while(--_0xd57c7b){_0x9eb33c['push'](_0x9eb33c['shift']());}};_0x300bf7(++_0x28e3bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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(_0x117a30,_0x380c00){var _0x3d58a0=function(_0x125207){while(--_0x125207){_0x117a30['push'](_0x117a30['shift']());}};_0x3d58a0(++_0x380c00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 8b2a23b..dd20152 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 _0x94df=['register','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x94df,0xa3));var _0xf94d=function(_0x3ebb0f,_0x1683f9){_0x3ebb0f=_0x3ebb0f-0x0;var _0x1d5c2b=_0x94df[_0x3ebb0f];return _0x1d5c2b;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var moment=require(_0xf94d('0x2'));var BPromise=require(_0xf94d('0x3'));var rs=require(_0xf94d('0x4'));var fs=require('fs');var Redis=require(_0xf94d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf94d('0x6'));var logger=require(_0xf94d('0x7'))(_0xf94d('0x8'));var config=require(_0xf94d('0x9'));var jayson=require(_0xf94d('0xa'));var client=jayson[_0xf94d('0xb')][_0xf94d('0xc')]({'port':0x232a});config[_0xf94d('0xd')]=_[_0xf94d('0xe')](config[_0xf94d('0xd')],{'host':_0xf94d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf94d('0xd')]));require(_0xf94d('0x10'))[_0xf94d('0x11')](socket);function respondWithRpcPromise(_0x1bde05,_0xdaa8d6,_0x45739c){return new BPromise(function(_0x47efc6,_0x25c68e){return client[_0xf94d('0x12')](_0x1bde05,_0x45739c)[_0xf94d('0x13')](function(_0x19b1de){logger[_0xf94d('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0xdaa8d6,'request\x20sent');logger[_0xf94d('0x15')](_0xf94d('0x16'),_0xdaa8d6,_0xf94d('0x17'),JSON[_0xf94d('0x18')](_0x19b1de));if(_0x19b1de[_0xf94d('0x19')]){if(_0x19b1de[_0xf94d('0x19')]['code']===0x1f4){logger[_0xf94d('0x19')](_0xf94d('0x1a'),_0xdaa8d6,_0x19b1de[_0xf94d('0x19')][_0xf94d('0x1b')]);return _0x25c68e(_0x19b1de[_0xf94d('0x19')][_0xf94d('0x1b')]);}logger[_0xf94d('0x19')](_0xf94d('0x1a'),_0xdaa8d6,_0x19b1de['error'][_0xf94d('0x1b')]);return _0x47efc6(_0x19b1de['error'][_0xf94d('0x1b')]);}else{logger['info'](_0xf94d('0x1a'),_0xdaa8d6,'request\x20sent');_0x47efc6(_0x19b1de[_0xf94d('0x1c')][_0xf94d('0x1b')]);}})[_0xf94d('0x1d')](function(_0x349de5){logger['error'](_0xf94d('0x1a'),_0xdaa8d6,_0x349de5);_0x25c68e(_0x349de5);});});} \ No newline at end of file +var _0x823c=['redis','./openchannelAccount.socket','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0x823c,0x143));var _0xc823=function(_0x16069b,_0x50b1c5){_0x16069b=_0x16069b-0x0;var _0x2e2c15=_0x823c[_0x16069b];return _0x2e2c15;};'use strict';var _=require(_0xc823('0x0'));var util=require('util');var moment=require(_0xc823('0x1'));var BPromise=require(_0xc823('0x2'));var rs=require(_0xc823('0x3'));var fs=require('fs');var Redis=require(_0xc823('0x4'));var db=require(_0xc823('0x5'))['db'];var utils=require(_0xc823('0x6'));var logger=require('../../config/logger')(_0xc823('0x7'));var config=require(_0xc823('0x8'));var jayson=require(_0xc823('0x9'));var client=jayson[_0xc823('0xa')][_0xc823('0xb')]({'port':0x232a});config['redis']=_[_0xc823('0xc')](config[_0xc823('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc823('0xd')]));require(_0xc823('0xe'))['register'](socket);function respondWithRpcPromise(_0x43bbd8,_0x2716a0,_0x5c214c){return new BPromise(function(_0x4dbd5b,_0x409ae1){return client[_0xc823('0xf')](_0x43bbd8,_0x5c214c)[_0xc823('0x10')](function(_0x35afbd){logger[_0xc823('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2716a0,_0xc823('0x12'));logger[_0xc823('0x13')](_0xc823('0x14'),_0x2716a0,_0xc823('0x12'),JSON[_0xc823('0x15')](_0x35afbd));if(_0x35afbd[_0xc823('0x16')]){if(_0x35afbd['error'][_0xc823('0x17')]===0x1f4){logger[_0xc823('0x16')](_0xc823('0x18'),_0x2716a0,_0x35afbd[_0xc823('0x16')]['message']);return _0x409ae1(_0x35afbd['error']['message']);}logger['error'](_0xc823('0x18'),_0x2716a0,_0x35afbd['error'][_0xc823('0x19')]);return _0x4dbd5b(_0x35afbd[_0xc823('0x16')][_0xc823('0x19')]);}else{logger[_0xc823('0x11')](_0xc823('0x18'),_0x2716a0,_0xc823('0x12'));_0x4dbd5b(_0x35afbd[_0xc823('0x1a')]['message']);}})[_0xc823('0x1b')](function(_0x4a713a){logger[_0xc823('0x16')](_0xc823('0x18'),_0x2716a0,_0x4a713a);_0x409ae1(_0x4a713a);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7b987ec..43bf923 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 _0xdf0c=['register','length','openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xdf0c,0x1ab));var _0xcdf0=function(_0x37e6a2,_0x58a3e4){_0x37e6a2=_0x37e6a2-0x0;var _0x4c2938=_0xdf0c[_0x37e6a2];return _0x4c2938;};'use strict';var OpenchannelAccountEvents=require(_0xcdf0('0x0'));var events=['save',_0xcdf0('0x1'),_0xcdf0('0x2')];function createListener(_0x5233f6,_0x436e7e){return function(_0x27f933){_0x436e7e[_0xcdf0('0x3')](_0x5233f6,_0x27f933);};}function removeListener(_0x2917be,_0x57a58c){return function(){OpenchannelAccountEvents[_0xcdf0('0x4')](_0x2917be,_0x57a58c);};}exports[_0xcdf0('0x5')]=function(_0x5f4c9c){for(var _0x3c97df=0x0,_0xe282be=events[_0xcdf0('0x6')];_0x3c97df<_0xe282be;_0x3c97df++){var _0x5b39b8=events[_0x3c97df];var _0x62e18=createListener(_0xcdf0('0x7')+_0x5b39b8,_0x5f4c9c);OpenchannelAccountEvents['on'](_0x5b39b8,_0x62e18);}}; \ No newline at end of file +var _0xb28a=['removeListener','register','length','openchannelAccount:','save','remove'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xb28a,0x166));var _0xab28=function(_0x4b57ef,_0x394481){_0x4b57ef=_0x4b57ef-0x0;var _0x396c0b=_0xb28a[_0x4b57ef];return _0x396c0b;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xab28('0x0'),_0xab28('0x1'),'update'];function createListener(_0x45d26d,_0x4cb73b){return function(_0x5ae2aa){_0x4cb73b['emit'](_0x45d26d,_0x5ae2aa);};}function removeListener(_0x451fc9,_0x1cdc41){return function(){OpenchannelAccountEvents[_0xab28('0x2')](_0x451fc9,_0x1cdc41);};}exports[_0xab28('0x3')]=function(_0x133169){for(var _0x128a13=0x0,_0x450e5b=events[_0xab28('0x4')];_0x128a13<_0x450e5b;_0x128a13++){var _0x48949b=events[_0x128a13];var _0x479267=createListener(_0xab28('0x5')+_0x48949b,_0x133169);OpenchannelAccountEvents['on'](_0x48949b,_0x479267);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index a09404b..45a7a99 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 _0x860a=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xf56197,_0x3da8f3){var _0x3dd377=function(_0x3fca02){while(--_0x3fca02){_0xf56197['push'](_0xf56197['shift']());}};_0x3dd377(++_0x3da8f3);}(_0x860a,0x75));var _0xa860=function(_0x272d34,_0x3cf171){_0x272d34=_0x272d34-0x0;var _0x3f9d2f=_0x860a[_0x272d34];return _0x3f9d2f;};'use strict';var multer=require(_0xa860('0x0'));var util=require(_0xa860('0x1'));var path=require(_0xa860('0x2'));var timeout=require(_0xa860('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa860('0x4'));var interaction=require(_0xa860('0x5'));var config=require(_0xa860('0x6'));var controller=require(_0xa860('0x7'));router[_0xa860('0x8')]('/',auth['isAuthenticated'](),controller[_0xa860('0x9')]);router[_0xa860('0x8')](_0xa860('0xa'),auth['isAuthenticated'](),controller[_0xa860('0xb')]);router[_0xa860('0xc')]('/',auth[_0xa860('0xd')](),controller[_0xa860('0xe')]);router[_0xa860('0xf')](_0xa860('0xa'),auth[_0xa860('0xd')](),controller[_0xa860('0x10')]);router[_0xa860('0x11')](_0xa860('0xa'),auth[_0xa860('0xd')](),controller[_0xa860('0x12')]);module[_0xa860('0x13')]=router; \ No newline at end of file +var _0xd1d1=['create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x5cc568,_0x3bf5c2){var _0x38e6a7=function(_0x499158){while(--_0x499158){_0x5cc568['push'](_0x5cc568['shift']());}};_0x38e6a7(++_0x3bf5c2);}(_0xd1d1,0xad));var _0x1d1d=function(_0x113ce0,_0x1d14fa){_0x113ce0=_0x113ce0-0x0;var _0x1f0858=_0xd1d1[_0x113ce0];return _0x1f0858;};'use strict';var multer=require(_0x1d1d('0x0'));var util=require(_0x1d1d('0x1'));var path=require(_0x1d1d('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d1d('0x3'));var router=express[_0x1d1d('0x4')]();var fs_extra=require(_0x1d1d('0x5'));var auth=require(_0x1d1d('0x6'));var interaction=require(_0x1d1d('0x7'));var config=require(_0x1d1d('0x8'));var controller=require(_0x1d1d('0x9'));router[_0x1d1d('0xa')]('/',auth[_0x1d1d('0xb')](),controller[_0x1d1d('0xc')]);router[_0x1d1d('0xa')](_0x1d1d('0xd'),auth[_0x1d1d('0xb')](),controller[_0x1d1d('0xe')]);router[_0x1d1d('0xf')]('/',auth[_0x1d1d('0xb')](),controller[_0x1d1d('0x10')]);router[_0x1d1d('0x11')](_0x1d1d('0xd'),auth[_0x1d1d('0xb')](),controller[_0x1d1d('0x12')]);router[_0x1d1d('0x13')](_0x1d1d('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x1d1d('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 3031116..6f3793c 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 _0xfda7=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xfda7,0x1d1));var _0x7fda=function(_0x198492,_0x10d7b0){_0x198492=_0x198492-0x0;var _0x306549=_0xfda7[_0x198492];return _0x306549;};'use strict';var Sequelize=require('sequelize');module[_0x7fda('0x0')]={'priority':{'type':Sequelize[_0x7fda('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7fda('0x2')],'allowNull':![],'defaultValue':_0x7fda('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7fda('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7fda('0x4')}}; \ No newline at end of file +var _0x4336=['INTEGER','STRING','*,*,*,*','exports'];(function(_0x43a471,_0x253d04){var _0xfd29c6=function(_0x56c6e5){while(--_0x56c6e5){_0x43a471['push'](_0x43a471['shift']());}};_0xfd29c6(++_0x253d04);}(_0x4336,0xdb));var _0x6433=function(_0x565925,_0x22996f){_0x565925=_0x565925-0x0;var _0x1e6486=_0x4336[_0x565925];return _0x1e6486;};'use strict';var Sequelize=require('sequelize');module[_0x6433('0x0')]={'priority':{'type':Sequelize[_0x6433('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6433('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6433('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 16436cd..de7f2dc 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 _0x3ad5=['then','sendStatus','error','stack','name','send','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','destroy','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','apply','update'];(function(_0x335c78,_0x3733bb){var _0x455078=function(_0x27df36){while(--_0x27df36){_0x335c78['push'](_0x335c78['shift']());}};_0x455078(++_0x3733bb);}(_0x3ad5,0x1c8));var _0x53ad=function(_0x3e949e,_0x1ef9d1){_0x3e949e=_0x3e949e-0x0;var _0x9bb50=_0x3ad5[_0x3e949e];return _0x9bb50;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x53ad('0x0'));var zipdir=require(_0x53ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53ad('0x2'));var moment=require(_0x53ad('0x3'));var BPromise=require(_0x53ad('0x4'));var Mustache=require(_0x53ad('0x5'));var util=require(_0x53ad('0x6'));var path=require('path');var sox=require(_0x53ad('0x7'));var csv=require(_0x53ad('0x8'));var ejs=require(_0x53ad('0x9'));var fs=require('fs');var fs_extra=require(_0x53ad('0xa'));var _=require(_0x53ad('0xb'));var squel=require('squel');var crypto=require(_0x53ad('0xc'));var jsforce=require(_0x53ad('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x53ad('0x8'));var querystring=require(_0x53ad('0xe'));var Papa=require(_0x53ad('0xf'));var Redis=require('ioredis');var authService=require(_0x53ad('0x10'));var qs=require(_0x53ad('0x11'));var as=require(_0x53ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53ad('0x13'))('api');var utils=require(_0x53ad('0x14'));var config=require(_0x53ad('0x15'));var licenseUtil=require(_0x53ad('0x16'));var db=require(_0x53ad('0x17'))['db'];function respondWithStatusCode(_0x4d092f,_0x27e491){_0x27e491=_0x27e491||0xcc;return function(_0x5c7a89){if(_0x5c7a89){return _0x4d092f['sendStatus'](_0x27e491);}return _0x4d092f[_0x53ad('0x18')](_0x27e491)[_0x53ad('0x19')]();};}function respondWithResult(_0x1209fd,_0x2f69be){_0x2f69be=_0x2f69be||0xc8;return function(_0x2780d5){if(_0x2780d5){return _0x1209fd[_0x53ad('0x18')](_0x2f69be)['json'](_0x2780d5);}};}function respondWithFilteredResult(_0x1f1a2e,_0x447e0a){return function(_0x99950f){if(_0x99950f){var _0xeb563=typeof _0x447e0a[_0x53ad('0x1a')]===_0x53ad('0x1b')&&typeof _0x447e0a['limit']===_0x53ad('0x1b');var _0x5f5b30=_0x99950f['count'];var _0x3765fa=_0xeb563?0x0:_0x447e0a[_0x53ad('0x1a')];var _0x22f3b7=_0xeb563?_0x99950f[_0x53ad('0x1c')]:_0x447e0a['offset']+_0x447e0a[_0x53ad('0x1d')];var _0x3afb7d;if(_0x22f3b7>=_0x5f5b30){_0x22f3b7=_0x5f5b30;_0x3afb7d=0xc8;}else{_0x3afb7d=0xce;}_0x1f1a2e[_0x53ad('0x18')](_0x3afb7d);return _0x1f1a2e[_0x53ad('0x1e')](_0x53ad('0x1f'),_0x3765fa+'-'+_0x22f3b7+'/'+_0x5f5b30)['json'](_0x99950f);}return null;};}function patchUpdates(_0x5f4623){return function(_0x3ec09d){try{jsonpatch[_0x53ad('0x20')](_0x3ec09d,_0x5f4623,!![]);}catch(_0x1376fa){return BPromise['reject'](_0x1376fa);}return _0x3ec09d['save']();};}function saveUpdates(_0x40d102,_0x483ad6){return function(_0x1d0ba0){if(_0x1d0ba0){return _0x1d0ba0[_0x53ad('0x21')](_0x40d102)[_0x53ad('0x22')](function(_0x2e9dc5){return _0x2e9dc5;});}return null;};}function removeEntity(_0x5c1aa7,_0x9e7cd){return function(_0x40597e){if(_0x40597e){return _0x40597e['destroy']()['then'](function(){_0x5c1aa7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22e40c,_0x149cc9){return function(_0x15339a){if(!_0x15339a){_0x22e40c[_0x53ad('0x23')](0x194);}return _0x15339a;};}function handleError(_0x4f0d5c,_0x26eadd){_0x26eadd=_0x26eadd||0x1f4;return function(_0x4cb833){logger[_0x53ad('0x24')](_0x4cb833[_0x53ad('0x25')]);if(_0x4cb833[_0x53ad('0x26')]){delete _0x4cb833[_0x53ad('0x26')];}_0x4f0d5c[_0x53ad('0x18')](_0x26eadd)[_0x53ad('0x27')](_0x4cb833);};}exports['index']=function(_0x252f85,_0x1caa80){var _0x1cf8ae={},_0x4d39a4={},_0x34c38d={'count':0x0,'rows':[]};var _0x52ecad=_[_0x53ad('0x28')](db[_0x53ad('0x29')][_0x53ad('0x2a')],function(_0x362b0f){return{'name':_0x362b0f[_0x53ad('0x2b')],'type':_0x362b0f[_0x53ad('0x2c')]['key']};});_0x4d39a4[_0x53ad('0x2d')]=_['map'](_0x52ecad,_0x53ad('0x26'));_0x4d39a4[_0x53ad('0x2e')]=_[_0x53ad('0x2f')](_0x252f85['query']);_0x4d39a4[_0x53ad('0x30')]=_['intersection'](_0x4d39a4[_0x53ad('0x2d')],_0x4d39a4[_0x53ad('0x2e')]);_0x1cf8ae['attributes']=_[_0x53ad('0x31')](_0x4d39a4[_0x53ad('0x2d')],qs['fields'](_0x252f85['query'][_0x53ad('0x32')]));_0x1cf8ae[_0x53ad('0x33')]=_0x1cf8ae['attributes']['length']?_0x1cf8ae[_0x53ad('0x33')]:_0x4d39a4['model'];if(!_0x252f85[_0x53ad('0x2e')]['hasOwnProperty'](_0x53ad('0x34'))){_0x1cf8ae['limit']=qs[_0x53ad('0x1d')](_0x252f85['query']['limit']);_0x1cf8ae[_0x53ad('0x1a')]=qs[_0x53ad('0x1a')](_0x252f85[_0x53ad('0x2e')]['offset']);}_0x1cf8ae['order']=qs['sort'](_0x252f85['query'][_0x53ad('0x35')]);_0x1cf8ae['where']=qs[_0x53ad('0x30')](_['pick'](_0x252f85[_0x53ad('0x2e')],_0x4d39a4[_0x53ad('0x30')]),_0x52ecad);if(_0x252f85[_0x53ad('0x2e')][_0x53ad('0x36')]){_0x1cf8ae['where']=_[_0x53ad('0x37')](_0x1cf8ae[_0x53ad('0x38')],{'$or':_['map'](_0x52ecad,function(_0x11b851){if(_0x11b851[_0x53ad('0x2c')]!=='VIRTUAL'){var _0x448cdc={};_0x448cdc[_0x11b851[_0x53ad('0x26')]]={'$like':'%'+_0x252f85[_0x53ad('0x2e')][_0x53ad('0x36')]+'%'};return _0x448cdc;}})});}_0x1cf8ae=_[_0x53ad('0x37')]({},_0x1cf8ae,_0x252f85[_0x53ad('0x39')]);var _0x460ea1={'where':_0x1cf8ae['where']};return db[_0x53ad('0x29')][_0x53ad('0x1c')](_0x460ea1)[_0x53ad('0x22')](function(_0x486c76){_0x34c38d[_0x53ad('0x1c')]=_0x486c76;if(_0x252f85[_0x53ad('0x2e')][_0x53ad('0x3a')]){_0x1cf8ae[_0x53ad('0x3b')]=[{'all':!![]}];}return db[_0x53ad('0x29')][_0x53ad('0x3c')](_0x1cf8ae);})[_0x53ad('0x22')](function(_0x2d2aec){_0x34c38d[_0x53ad('0x3d')]=_0x2d2aec;return _0x34c38d;})[_0x53ad('0x22')](respondWithFilteredResult(_0x1caa80,_0x1cf8ae))['catch'](handleError(_0x1caa80,null));};exports[_0x53ad('0x3e')]=function(_0x4dcc93,_0x1273d0){var _0x46ebf4={'raw':!![],'where':{'id':_0x4dcc93[_0x53ad('0x3f')]['id']}},_0x5d7dee={};_0x5d7dee[_0x53ad('0x2d')]=_[_0x53ad('0x2f')](db[_0x53ad('0x29')]['rawAttributes']);_0x5d7dee[_0x53ad('0x2e')]=_[_0x53ad('0x2f')](_0x4dcc93[_0x53ad('0x2e')]);_0x5d7dee[_0x53ad('0x30')]=_[_0x53ad('0x31')](_0x5d7dee[_0x53ad('0x2d')],_0x5d7dee['query']);_0x46ebf4['attributes']=_[_0x53ad('0x31')](_0x5d7dee['model'],qs[_0x53ad('0x32')](_0x4dcc93[_0x53ad('0x2e')][_0x53ad('0x32')]));_0x46ebf4[_0x53ad('0x33')]=_0x46ebf4['attributes'][_0x53ad('0x40')]?_0x46ebf4[_0x53ad('0x33')]:_0x5d7dee[_0x53ad('0x2d')];if(_0x4dcc93[_0x53ad('0x2e')][_0x53ad('0x3a')]){_0x46ebf4[_0x53ad('0x3b')]=[{'all':!![]}];}_0x46ebf4=_[_0x53ad('0x37')]({},_0x46ebf4,_0x4dcc93[_0x53ad('0x39')]);return db['OpenchannelApplication'][_0x53ad('0x41')](_0x46ebf4)[_0x53ad('0x22')](handleEntityNotFound(_0x1273d0,null))['then'](respondWithResult(_0x1273d0,null))['catch'](handleError(_0x1273d0,null));};exports[_0x53ad('0x42')]=function(_0xeafb66,_0x2dbaaa){return db[_0x53ad('0x29')][_0x53ad('0x42')](_0xeafb66['body'],{})[_0x53ad('0x22')](respondWithResult(_0x2dbaaa,0xc9))['catch'](handleError(_0x2dbaaa,null));};exports[_0x53ad('0x21')]=function(_0x41a8bb,_0x13a69a){if(_0x41a8bb[_0x53ad('0x43')]['id']){delete _0x41a8bb['body']['id'];}return db[_0x53ad('0x29')]['find']({'where':{'id':_0x41a8bb[_0x53ad('0x3f')]['id']}})[_0x53ad('0x22')](handleEntityNotFound(_0x13a69a,null))[_0x53ad('0x22')](saveUpdates(_0x41a8bb[_0x53ad('0x43')],null))['then'](respondWithResult(_0x13a69a,null))[_0x53ad('0x44')](handleError(_0x13a69a,null));};exports[_0x53ad('0x45')]=function(_0x24c1ba,_0x238f1f){return db['OpenchannelApplication'][_0x53ad('0x41')]({'where':{'id':_0x24c1ba[_0x53ad('0x3f')]['id']}})[_0x53ad('0x22')](handleEntityNotFound(_0x238f1f,null))[_0x53ad('0x22')](removeEntity(_0x238f1f,null))[_0x53ad('0x44')](handleError(_0x238f1f,null));}; \ No newline at end of file +var _0xc87b=['to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','offset','undefined','limit','count','status','set','json','update','destroy','then','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0xc87b,0x10c));var _0xbc87=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xc87b[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc87('0x0'));var zipdir=require(_0xbc87('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc87('0x2'));var moment=require(_0xbc87('0x3'));var BPromise=require(_0xbc87('0x4'));var Mustache=require(_0xbc87('0x5'));var util=require(_0xbc87('0x6'));var path=require('path');var sox=require(_0xbc87('0x7'));var csv=require(_0xbc87('0x8'));var ejs=require(_0xbc87('0x9'));var fs=require('fs');var fs_extra=require(_0xbc87('0xa'));var _=require(_0xbc87('0xb'));var squel=require('squel');var crypto=require(_0xbc87('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbc87('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbc87('0xe'));var as=require(_0xbc87('0xf'));var hardwareService=require(_0xbc87('0x10'));var logger=require(_0xbc87('0x11'))(_0xbc87('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbc87('0x13'))['db'];function respondWithStatusCode(_0x59f1c1,_0x254d8e){_0x254d8e=_0x254d8e||0xcc;return function(_0x4e1739){if(_0x4e1739){return _0x59f1c1['sendStatus'](_0x254d8e);}return _0x59f1c1['status'](_0x254d8e)[_0xbc87('0x14')]();};}function respondWithResult(_0x6e0c0b,_0x24788f){_0x24788f=_0x24788f||0xc8;return function(_0x1f5482){if(_0x1f5482){return _0x6e0c0b['status'](_0x24788f)['json'](_0x1f5482);}};}function respondWithFilteredResult(_0x2bd3fe,_0x45a611){return function(_0x237fef){if(_0x237fef){var _0x1b4455=typeof _0x45a611[_0xbc87('0x15')]===_0xbc87('0x16')&&typeof _0x45a611[_0xbc87('0x17')]===_0xbc87('0x16');var _0xb0d903=_0x237fef[_0xbc87('0x18')];var _0xc83c31=_0x1b4455?0x0:_0x45a611[_0xbc87('0x15')];var _0x3e9b4d=_0x1b4455?_0x237fef['count']:_0x45a611[_0xbc87('0x15')]+_0x45a611[_0xbc87('0x17')];var _0x579e83;if(_0x3e9b4d>=_0xb0d903){_0x3e9b4d=_0xb0d903;_0x579e83=0xc8;}else{_0x579e83=0xce;}_0x2bd3fe[_0xbc87('0x19')](_0x579e83);return _0x2bd3fe[_0xbc87('0x1a')]('Content-Range',_0xc83c31+'-'+_0x3e9b4d+'/'+_0xb0d903)[_0xbc87('0x1b')](_0x237fef);}return null;};}function patchUpdates(_0x3a928b){return function(_0x3b401f){try{jsonpatch['apply'](_0x3b401f,_0x3a928b,!![]);}catch(_0x469045){return BPromise['reject'](_0x469045);}return _0x3b401f['save']();};}function saveUpdates(_0x23a659,_0x169134){return function(_0x39999c){if(_0x39999c){return _0x39999c[_0xbc87('0x1c')](_0x23a659)['then'](function(_0x45910c){return _0x45910c;});}return null;};}function removeEntity(_0x8bc478,_0x2ce840){return function(_0x4d8d36){if(_0x4d8d36){return _0x4d8d36[_0xbc87('0x1d')]()[_0xbc87('0x1e')](function(){_0x8bc478[_0xbc87('0x19')](0xcc)[_0xbc87('0x14')]();});}};}function handleEntityNotFound(_0x50c2f7,_0x14950f){return function(_0x5c7680){if(!_0x5c7680){_0x50c2f7[_0xbc87('0x1f')](0x194);}return _0x5c7680;};}function handleError(_0x25ea55,_0x1f46ea){_0x1f46ea=_0x1f46ea||0x1f4;return function(_0x29e840){logger[_0xbc87('0x20')](_0x29e840[_0xbc87('0x21')]);if(_0x29e840[_0xbc87('0x22')]){delete _0x29e840[_0xbc87('0x22')];}_0x25ea55[_0xbc87('0x19')](_0x1f46ea)[_0xbc87('0x23')](_0x29e840);};}exports[_0xbc87('0x24')]=function(_0x3eda55,_0x317969){var _0x52976d={},_0x2ba241={},_0x293e0d={'count':0x0,'rows':[]};var _0x36f3e2=_[_0xbc87('0x25')](db[_0xbc87('0x26')]['rawAttributes'],function(_0x393069){return{'name':_0x393069[_0xbc87('0x27')],'type':_0x393069[_0xbc87('0x28')][_0xbc87('0x29')]};});_0x2ba241[_0xbc87('0x2a')]=_[_0xbc87('0x25')](_0x36f3e2,_0xbc87('0x22'));_0x2ba241[_0xbc87('0x2b')]=_[_0xbc87('0x2c')](_0x3eda55[_0xbc87('0x2b')]);_0x2ba241['filters']=_['intersection'](_0x2ba241[_0xbc87('0x2a')],_0x2ba241[_0xbc87('0x2b')]);_0x52976d[_0xbc87('0x2d')]=_[_0xbc87('0x2e')](_0x2ba241['model'],qs[_0xbc87('0x2f')](_0x3eda55[_0xbc87('0x2b')][_0xbc87('0x2f')]));_0x52976d[_0xbc87('0x2d')]=_0x52976d[_0xbc87('0x2d')][_0xbc87('0x30')]?_0x52976d[_0xbc87('0x2d')]:_0x2ba241['model'];if(!_0x3eda55[_0xbc87('0x2b')][_0xbc87('0x31')](_0xbc87('0x32'))){_0x52976d['limit']=qs[_0xbc87('0x17')](_0x3eda55[_0xbc87('0x2b')]['limit']);_0x52976d['offset']=qs[_0xbc87('0x15')](_0x3eda55[_0xbc87('0x2b')]['offset']);}_0x52976d['order']=qs[_0xbc87('0x33')](_0x3eda55['query']['sort']);_0x52976d[_0xbc87('0x34')]=qs[_0xbc87('0x35')](_[_0xbc87('0x36')](_0x3eda55['query'],_0x2ba241[_0xbc87('0x35')]),_0x36f3e2);if(_0x3eda55['query'][_0xbc87('0x37')]){_0x52976d[_0xbc87('0x34')]=_[_0xbc87('0x38')](_0x52976d[_0xbc87('0x34')],{'$or':_[_0xbc87('0x25')](_0x36f3e2,function(_0x3b62b8){if(_0x3b62b8[_0xbc87('0x28')]!==_0xbc87('0x39')){var _0x5327e6={};_0x5327e6[_0x3b62b8['name']]={'$like':'%'+_0x3eda55[_0xbc87('0x2b')][_0xbc87('0x37')]+'%'};return _0x5327e6;}})});}_0x52976d=_[_0xbc87('0x38')]({},_0x52976d,_0x3eda55[_0xbc87('0x3a')]);var _0x1dcf1e={'where':_0x52976d['where']};return db[_0xbc87('0x26')][_0xbc87('0x18')](_0x1dcf1e)['then'](function(_0x2d4827){_0x293e0d['count']=_0x2d4827;if(_0x3eda55[_0xbc87('0x2b')][_0xbc87('0x3b')]){_0x52976d['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xbc87('0x3c')](_0x52976d);})[_0xbc87('0x1e')](function(_0xa74562){_0x293e0d['rows']=_0xa74562;return _0x293e0d;})[_0xbc87('0x1e')](respondWithFilteredResult(_0x317969,_0x52976d))[_0xbc87('0x3d')](handleError(_0x317969,null));};exports[_0xbc87('0x3e')]=function(_0x13ced2,_0x52fd21){var _0x2d4738={'raw':!![],'where':{'id':_0x13ced2['params']['id']}},_0x1cbd16={};_0x1cbd16[_0xbc87('0x2a')]=_[_0xbc87('0x2c')](db[_0xbc87('0x26')][_0xbc87('0x3f')]);_0x1cbd16['query']=_[_0xbc87('0x2c')](_0x13ced2['query']);_0x1cbd16['filters']=_['intersection'](_0x1cbd16[_0xbc87('0x2a')],_0x1cbd16[_0xbc87('0x2b')]);_0x2d4738['attributes']=_[_0xbc87('0x2e')](_0x1cbd16['model'],qs[_0xbc87('0x2f')](_0x13ced2[_0xbc87('0x2b')]['fields']));_0x2d4738['attributes']=_0x2d4738[_0xbc87('0x2d')]['length']?_0x2d4738[_0xbc87('0x2d')]:_0x1cbd16[_0xbc87('0x2a')];if(_0x13ced2['query']['includeAll']){_0x2d4738[_0xbc87('0x40')]=[{'all':!![]}];}_0x2d4738=_['merge']({},_0x2d4738,_0x13ced2[_0xbc87('0x3a')]);return db['OpenchannelApplication'][_0xbc87('0x41')](_0x2d4738)[_0xbc87('0x1e')](handleEntityNotFound(_0x52fd21,null))[_0xbc87('0x1e')](respondWithResult(_0x52fd21,null))[_0xbc87('0x3d')](handleError(_0x52fd21,null));};exports[_0xbc87('0x42')]=function(_0x48a3e6,_0x5db2b7){return db[_0xbc87('0x26')][_0xbc87('0x42')](_0x48a3e6[_0xbc87('0x43')],{})['then'](respondWithResult(_0x5db2b7,0xc9))[_0xbc87('0x3d')](handleError(_0x5db2b7,null));};exports[_0xbc87('0x1c')]=function(_0x262020,_0x2410ca){if(_0x262020[_0xbc87('0x43')]['id']){delete _0x262020['body']['id'];}return db[_0xbc87('0x26')][_0xbc87('0x41')]({'where':{'id':_0x262020[_0xbc87('0x44')]['id']}})[_0xbc87('0x1e')](handleEntityNotFound(_0x2410ca,null))[_0xbc87('0x1e')](saveUpdates(_0x262020['body'],null))['then'](respondWithResult(_0x2410ca,null))[_0xbc87('0x3d')](handleError(_0x2410ca,null));};exports[_0xbc87('0x1d')]=function(_0x1ea60a,_0x2c01cc){return db[_0xbc87('0x26')][_0xbc87('0x41')]({'where':{'id':_0x1ea60a[_0xbc87('0x44')]['id']}})[_0xbc87('0x1e')](handleEntityNotFound(_0x2c01cc,null))['then'](removeEntity(_0x2c01cc,null))[_0xbc87('0x3d')](handleError(_0x2c01cc,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index f0e5764..97a1c7e 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 _0x1285=['api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x110671,_0x5decf3){var _0x1e4dae=function(_0x20ec32){while(--_0x20ec32){_0x110671['push'](_0x110671['shift']());}};_0x1e4dae(++_0x5decf3);}(_0x1285,0x11a));var _0x5128=function(_0x11861a,_0x54b6e8){_0x11861a=_0x11861a-0x0;var _0x5988bb=_0x1285[_0x11861a];return _0x5988bb;};'use strict';var _=require(_0x5128('0x0'));var util=require(_0x5128('0x1'));var logger=require(_0x5128('0x2'))(_0x5128('0x3'));var moment=require('moment');var BPromise=require(_0x5128('0x4'));var rp=require(_0x5128('0x5'));var fs=require('fs');var path=require(_0x5128('0x6'));var rimraf=require(_0x5128('0x7'));var config=require(_0x5128('0x8'));var attributes=require(_0x5128('0x9'));module[_0x5128('0xa')]=function(_0x4ad4d4,_0x4ac5a9){return _0x4ad4d4[_0x5128('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x5128('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5128('0xd'),'collate':_0x5128('0xe')});}; \ No newline at end of file +var _0x66b0=['api','moment','bluebird','path','rimraf','./openchannelApplication.attributes','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x50be19,_0x3ea1d0){var _0x54fa7b=function(_0x46d883){while(--_0x46d883){_0x50be19['push'](_0x50be19['shift']());}};_0x54fa7b(++_0x3ea1d0);}(_0x66b0,0x98));var _0x066b=function(_0x1a63f7,_0x3daced){_0x1a63f7=_0x1a63f7-0x0;var _0x4ef8ae=_0x66b0[_0x1a63f7];return _0x4ef8ae;};'use strict';var _=require(_0x066b('0x0'));var util=require(_0x066b('0x1'));var logger=require('../../config/logger')(_0x066b('0x2'));var moment=require(_0x066b('0x3'));var BPromise=require(_0x066b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x066b('0x5'));var rimraf=require(_0x066b('0x6'));var config=require('../../config/environment');var attributes=require(_0x066b('0x7'));module['exports']=function(_0x184e91,_0x5df56f){return _0x184e91['define'](_0x066b('0x8'),attributes,{'tableName':_0x066b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x066b('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7c4f156..e6d36bb 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 _0x1657=['body','options','where','attributes','limit','lodash','util','randomstring','ioredis','../../config/utils','client','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1657,0x8c));var _0x7165=function(_0x2fdbed,_0x38af82){_0x2fdbed=_0x2fdbed-0x0;var _0x85f56a=_0x1657[_0x2fdbed];return _0x85f56a;};'use strict';var _=require(_0x7165('0x0'));var util=require(_0x7165('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7165('0x2'));var fs=require('fs');var Redis=require(_0x7165('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7165('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7165('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b8232,_0x57272e,_0x4bddf0){return new BPromise(function(_0x46a90d,_0x31d650){return client[_0x7165('0x6')](_0x4b8232,_0x4bddf0)[_0x7165('0x7')](function(_0x4e5c31){logger['info'](_0x7165('0x8'),_0x57272e,_0x7165('0x9'));logger[_0x7165('0xa')](_0x7165('0xb'),_0x57272e,'request\x20sent',JSON[_0x7165('0xc')](_0x4e5c31));if(_0x4e5c31['error']){if(_0x4e5c31['error'][_0x7165('0xd')]===0x1f4){logger['error'](_0x7165('0x8'),_0x57272e,_0x4e5c31[_0x7165('0xe')]['message']);return _0x31d650(_0x4e5c31[_0x7165('0xe')][_0x7165('0xf')]);}logger[_0x7165('0xe')](_0x7165('0x8'),_0x57272e,_0x4e5c31[_0x7165('0xe')]['message']);return _0x46a90d(_0x4e5c31['error']['message']);}else{logger[_0x7165('0x10')](_0x7165('0x8'),_0x57272e,'request\x20sent');_0x46a90d(_0x4e5c31[_0x7165('0x11')][_0x7165('0xf')]);}})[_0x7165('0x12')](function(_0x5c3e38){logger[_0x7165('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x57272e,_0x5c3e38);_0x31d650(_0x5c3e38);});});}exports[_0x7165('0x13')]=function(_0x5192fa){var _0x3a9b8c=this;return new Promise(function(_0x1a8c5f,_0x39aae9){return db[_0x7165('0x14')][_0x7165('0x15')](_0x5192fa[_0x7165('0x16')],{'raw':_0x5192fa[_0x7165('0x17')]?_0x5192fa['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5192fa[_0x7165('0x17')]?_0x5192fa['options'][_0x7165('0x18')]||null:null,'attributes':_0x5192fa[_0x7165('0x17')]?_0x5192fa[_0x7165('0x17')][_0x7165('0x19')]||null:null,'limit':_0x5192fa[_0x7165('0x17')]?_0x5192fa[_0x7165('0x17')][_0x7165('0x1a')]||null:null})[_0x7165('0x7')](function(_0x49c074){logger['info'](_0x7165('0x13'),_0x5192fa);logger[_0x7165('0xa')](_0x7165('0x13'),_0x5192fa,JSON['stringify'](_0x49c074));_0x1a8c5f(_0x49c074);})['catch'](function(_0xaef2bb){logger['error'](_0x7165('0x13'),_0xaef2bb['message'],_0x5192fa);_0x39aae9(_0x3a9b8c[_0x7165('0xe')](0x1f4,_0xaef2bb['message']));});});}; \ No newline at end of file +var _0x67a7=['code','message','info','result','catch','UpdateOpenchannelApplication','update','body','options','attributes','limit','stringify','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x31e11e,_0x24b637){var _0x2a6776=function(_0x2db785){while(--_0x2db785){_0x31e11e['push'](_0x31e11e['shift']());}};_0x2a6776(++_0x24b637);}(_0x67a7,0xba));var _0x767a=function(_0x2b7806,_0x3b0257){_0x2b7806=_0x2b7806-0x0;var _0x162485=_0x67a7[_0x2b7806];return _0x162485;};'use strict';var _=require(_0x767a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x767a('0x1'));var rs=require(_0x767a('0x2'));var fs=require('fs');var Redis=require(_0x767a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x767a('0x4'));var logger=require(_0x767a('0x5'))(_0x767a('0x6'));var config=require(_0x767a('0x7'));var jayson=require(_0x767a('0x8'));var client=jayson['client'][_0x767a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9e08,_0x18561e,_0x58e564){return new BPromise(function(_0x3b8287,_0x324f06){return client[_0x767a('0xa')](_0x3b9e08,_0x58e564)[_0x767a('0xb')](function(_0x47bca3){logger['info'](_0x767a('0xc'),_0x18561e,_0x767a('0xd'));logger[_0x767a('0xe')](_0x767a('0xf'),_0x18561e,_0x767a('0xd'),JSON['stringify'](_0x47bca3));if(_0x47bca3[_0x767a('0x10')]){if(_0x47bca3[_0x767a('0x10')][_0x767a('0x11')]===0x1f4){logger['error'](_0x767a('0xc'),_0x18561e,_0x47bca3[_0x767a('0x10')][_0x767a('0x12')]);return _0x324f06(_0x47bca3[_0x767a('0x10')][_0x767a('0x12')]);}logger[_0x767a('0x10')](_0x767a('0xc'),_0x18561e,_0x47bca3[_0x767a('0x10')][_0x767a('0x12')]);return _0x3b8287(_0x47bca3[_0x767a('0x10')][_0x767a('0x12')]);}else{logger[_0x767a('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x18561e,_0x767a('0xd'));_0x3b8287(_0x47bca3[_0x767a('0x14')][_0x767a('0x12')]);}})[_0x767a('0x15')](function(_0x1a70ae){logger[_0x767a('0x10')](_0x767a('0xc'),_0x18561e,_0x1a70ae);_0x324f06(_0x1a70ae);});});}exports[_0x767a('0x16')]=function(_0x2d24ff){var _0x1b49a5=this;return new Promise(function(_0x8cb6b4,_0x17ae54){return db['OpenchannelApplication'][_0x767a('0x17')](_0x2d24ff[_0x767a('0x18')],{'raw':_0x2d24ff[_0x767a('0x19')]?_0x2d24ff[_0x767a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d24ff[_0x767a('0x19')]?_0x2d24ff[_0x767a('0x19')]['where']||null:null,'attributes':_0x2d24ff[_0x767a('0x19')]?_0x2d24ff['options'][_0x767a('0x1a')]||null:null,'limit':_0x2d24ff[_0x767a('0x19')]?_0x2d24ff[_0x767a('0x19')][_0x767a('0x1b')]||null:null})['then'](function(_0x32e2d4){logger[_0x767a('0x13')](_0x767a('0x16'),_0x2d24ff);logger['debug'](_0x767a('0x16'),_0x2d24ff,JSON[_0x767a('0x1c')](_0x32e2d4));_0x8cb6b4(_0x32e2d4);})[_0x767a('0x15')](function(_0x4be54f){logger[_0x767a('0x10')](_0x767a('0x16'),_0x4be54f['message'],_0x2d24ff);_0x17ae54(_0x1b49a5[_0x767a('0x10')](0x1f4,_0x4be54f[_0x767a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 5ed2185..93af8b8 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 _0x8386=['isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','index','get','/describe'];(function(_0x46ce14,_0x4f7796){var _0x1f15f0=function(_0x314f19){while(--_0x314f19){_0x46ce14['push'](_0x46ce14['shift']());}};_0x1f15f0(++_0x4f7796);}(_0x8386,0x12c));var _0x6838=function(_0x40a16b,_0x394ef5){_0x40a16b=_0x40a16b-0x0;var _0x1d3102=_0x8386[_0x40a16b];return _0x1d3102;};'use strict';var multer=require(_0x6838('0x0'));var util=require('util');var path=require(_0x6838('0x1'));var timeout=require('connect-timeout');var express=require(_0x6838('0x2'));var router=express['Router']();var fs_extra=require(_0x6838('0x3'));var auth=require(_0x6838('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6838('0x5'));var controller=require(_0x6838('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6838('0x7')]);router[_0x6838('0x8')](_0x6838('0x9'),auth[_0x6838('0xa')](),controller[_0x6838('0xb')]);router['get'](_0x6838('0xc'),auth[_0x6838('0xa')](),controller['show']);router[_0x6838('0x8')](_0x6838('0xd'),auth['isAuthenticated'](),controller[_0x6838('0xe')]);router[_0x6838('0x8')](_0x6838('0xf'),auth[_0x6838('0xa')](),controller[_0x6838('0x10')]);router[_0x6838('0x11')]('/',auth[_0x6838('0xa')](),controller[_0x6838('0x12')]);router['post'](_0x6838('0xd'),auth[_0x6838('0xa')](),controller['addMessage']);router[_0x6838('0x11')](_0x6838('0x13'),auth['isAuthenticated'](),interaction[_0x6838('0x14')](_0x6838('0x15'),_0x6838('0x16')),controller[_0x6838('0x17')]);router[_0x6838('0x18')](_0x6838('0xc'),auth[_0x6838('0xa')](),interaction['tracked']('openchannel',_0x6838('0x19')),controller['update']);router['delete'](_0x6838('0xc'),auth['isAuthenticated'](),interaction[_0x6838('0x14')](_0x6838('0x15'),_0x6838('0x1a')),controller[_0x6838('0x1b')]);router[_0x6838('0x1c')](_0x6838('0x13'),auth[_0x6838('0xa')](),controller[_0x6838('0x1d')]);module[_0x6838('0x1e')]=router; \ No newline at end of file +var _0xf0f8=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout'];(function(_0x33600f,_0x4d7d6e){var _0x282427=function(_0x86af5c){while(--_0x86af5c){_0x33600f['push'](_0x33600f['shift']());}};_0x282427(++_0x4d7d6e);}(_0xf0f8,0x15c));var _0x8f0f=function(_0x32c654,_0x85c054){_0x32c654=_0x32c654-0x0;var _0x362b8d=_0xf0f8[_0x32c654];return _0x362b8d;};'use strict';var multer=require(_0x8f0f('0x0'));var util=require(_0x8f0f('0x1'));var path=require(_0x8f0f('0x2'));var timeout=require(_0x8f0f('0x3'));var express=require(_0x8f0f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8f0f('0x5'));var interaction=require(_0x8f0f('0x6'));var config=require(_0x8f0f('0x7'));var controller=require(_0x8f0f('0x8'));router['get']('/',auth[_0x8f0f('0x9')](),controller[_0x8f0f('0xa')]);router[_0x8f0f('0xb')](_0x8f0f('0xc'),auth[_0x8f0f('0x9')](),controller['describe']);router[_0x8f0f('0xb')](_0x8f0f('0xd'),auth[_0x8f0f('0x9')](),controller[_0x8f0f('0xe')]);router[_0x8f0f('0xb')]('/:id/messages',auth[_0x8f0f('0x9')](),controller[_0x8f0f('0xf')]);router['get']('/:id/download',auth[_0x8f0f('0x9')](),controller[_0x8f0f('0x10')]);router[_0x8f0f('0x11')]('/',auth[_0x8f0f('0x9')](),controller[_0x8f0f('0x12')]);router['post'](_0x8f0f('0x13'),auth[_0x8f0f('0x9')](),controller[_0x8f0f('0x14')]);router[_0x8f0f('0x11')](_0x8f0f('0x15'),auth[_0x8f0f('0x9')](),interaction[_0x8f0f('0x16')](_0x8f0f('0x17'),'openchannelinteraction:addtags'),controller[_0x8f0f('0x18')]);router[_0x8f0f('0x19')](_0x8f0f('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x8f0f('0x17'),_0x8f0f('0x1a')),controller[_0x8f0f('0x1b')]);router[_0x8f0f('0x1c')](_0x8f0f('0xd'),auth['isAuthenticated'](),interaction[_0x8f0f('0x16')]('openchannel',_0x8f0f('0x1d')),controller[_0x8f0f('0x1e')]);router[_0x8f0f('0x1c')]('/:id/tags',auth[_0x8f0f('0x9')](),controller[_0x8f0f('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 23883f4..d10536e 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 _0x8322=['BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','exports'];(function(_0x41e9c7,_0x23ab71){var _0x17921d=function(_0x16bc85){while(--_0x16bc85){_0x41e9c7['push'](_0x41e9c7['shift']());}};_0x17921d(++_0x23ab71);}(_0x8322,0x186));var _0x2832=function(_0x48c615,_0x4cc757){_0x48c615=_0x48c615-0x0;var _0x3d9e22=_0x8322[_0x48c615];return _0x3d9e22;};'use strict';var Sequelize=require(_0x2832('0x0'));module[_0x2832('0x1')]={'closed':{'type':Sequelize[_0x2832('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2832('0x3')]},'disposition':{'type':Sequelize[_0x2832('0x4')]},'secondDisposition':{'type':Sequelize[_0x2832('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2832('0x4')]},'note':{'type':Sequelize[_0x2832('0x4')]},'read1stAt':{'type':Sequelize[_0x2832('0x3')]},'threadId':{'type':Sequelize[_0x2832('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x2832('0x5')]('in',_0x2832('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x2832('0x5')]('in',_0x2832('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2832('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2832('0x7')]}}; \ No newline at end of file +var _0x84cd=['STRING','ENUM','out','INTEGER','exports','BOOLEAN','DATE'];(function(_0x19869e,_0x2e1dd4){var _0x51d836=function(_0x4f0214){while(--_0x4f0214){_0x19869e['push'](_0x19869e['shift']());}};_0x51d836(++_0x2e1dd4);}(_0x84cd,0x1e0));var _0xd84c=function(_0x3409ad,_0x3ef901){_0x3409ad=_0x3409ad-0x0;var _0x3cb297=_0x84cd[_0x3409ad];return _0x3cb297;};'use strict';var Sequelize=require('sequelize');module[_0xd84c('0x0')]={'closed':{'type':Sequelize[_0xd84c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd84c('0x2')]},'disposition':{'type':Sequelize[_0xd84c('0x3')]},'secondDisposition':{'type':Sequelize[_0xd84c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd84c('0x3')]},'note':{'type':Sequelize[_0xd84c('0x3')]},'read1stAt':{'type':Sequelize[_0xd84c('0x2')]},'threadId':{'type':Sequelize[_0xd84c('0x3')]},'externalUrl':{'type':Sequelize[_0xd84c('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd84c('0x4')]('in',_0xd84c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd84c('0x4')]('in',_0xd84c('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd84c('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 67b224a..7970791 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 _0xdf63=['threadId','Public','Private','map','basename','createReadStream','pipe','createWriteStream','out','lastName','views','transcript-','download','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','update','destroy','then','end','stack','name','send','index','OpenchannelInteraction','fieldName','key','findAll','openchannel','query','user','catch','show','type','from','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','include','addTags','setTags','omit','spread','color','openchannelInteractionTags:save','removeTags','unix','join','root','tmp','server','files','attachments','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Openchannel','Account','Owner','fullname','N.A.','toString','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition'];(function(_0x1b1b64,_0x482097){var _0x1f546a=function(_0x55f1d4){while(--_0x55f1d4){_0x1b1b64['push'](_0x1b1b64['shift']());}};_0x1f546a(++_0x482097);}(_0xdf63,0x90));var _0x3df6=function(_0x3a1972,_0x194511){_0x3a1972=_0x3a1972-0x0;var _0xc7e0b5=_0xdf63[_0x3a1972];return _0xc7e0b5;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x3df6('0x0'));var util=require(_0x3df6('0x1'));var path=require(_0x3df6('0x2'));var ejs=require(_0x3df6('0x3'));var fs=require('fs');var _=require(_0x3df6('0x4'));var Redis=require(_0x3df6('0x5'));var interaction=require(_0x3df6('0x6'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x3df6('0x7'))(_0x3df6('0x8'));var config=require(_0x3df6('0x9'));var db=require(_0x3df6('0xa'))['db'];config['redis']=_[_0x3df6('0xb')](config[_0x3df6('0xc')],{'host':_0x3df6('0xd'),'port':0x18eb});var socket=require(_0x3df6('0xe'))(new Redis(config[_0x3df6('0xc')]));require('./openchannelInteraction.socket')[_0x3df6('0xf')](socket);function respondWithStatusCode(_0x377c68,_0xd5b325){_0xd5b325=_0xd5b325||0xcc;return function(_0x116c8f){if(_0x116c8f){return _0x377c68[_0x3df6('0x10')](_0xd5b325);}return _0x377c68[_0x3df6('0x11')](_0xd5b325)['end']();};}function respondWithResult(_0x4491df,_0x105396){_0x105396=_0x105396||0xc8;return function(_0x368719){if(_0x368719){return _0x4491df['status'](_0x105396)['json'](_0x368719);}};}function respondWithFilteredResult(_0x5696cd,_0x575f17){return function(_0x40e7cf){if(_0x40e7cf){var _0x6c349b=typeof _0x575f17[_0x3df6('0x12')]===_0x3df6('0x13')&&typeof _0x575f17['limit']===_0x3df6('0x13');var _0x1d8678=_0x40e7cf[_0x3df6('0x14')];var _0x2e550d=_0x6c349b?0x0:_0x575f17[_0x3df6('0x12')];var _0x39aa4f=_0x6c349b?_0x40e7cf[_0x3df6('0x14')]:_0x575f17[_0x3df6('0x12')]+_0x575f17[_0x3df6('0x15')];var _0x3f2d15;if(_0x39aa4f>=_0x1d8678){_0x39aa4f=_0x1d8678;_0x3f2d15=0xc8;}else{_0x3f2d15=0xce;}_0x5696cd[_0x3df6('0x11')](_0x3f2d15);return _0x5696cd[_0x3df6('0x16')](_0x3df6('0x17'),_0x2e550d+'-'+_0x39aa4f+'/'+_0x1d8678)['json'](_0x40e7cf);}return null;};}function saveUpdates(_0x45070b){return function(_0x29aca6){if(_0x29aca6){return _0x29aca6[_0x3df6('0x18')](_0x45070b)['then'](function(_0x255ce8){return _0x255ce8;});}return null;};}function removeEntity(_0x39c416){return function(_0x4ed2b7){if(_0x4ed2b7){return _0x4ed2b7[_0x3df6('0x19')]()[_0x3df6('0x1a')](function(){_0x39c416[_0x3df6('0x11')](0xcc)[_0x3df6('0x1b')]();});}};}function handleEntityNotFound(_0x27a5f1){return function(_0x47a50d){if(!_0x47a50d){_0x27a5f1[_0x3df6('0x10')](0x194);}return _0x47a50d;};}function handleError(_0x52ccae,_0x5ed711){_0x5ed711=_0x5ed711||0x1f4;return function(_0x465c13){logger['error'](_0x465c13[_0x3df6('0x1c')]);if(_0x465c13[_0x3df6('0x1d')]){delete _0x465c13[_0x3df6('0x1d')];}_0x52ccae[_0x3df6('0x11')](_0x5ed711)[_0x3df6('0x1e')](_0x465c13);};}exports[_0x3df6('0x1f')]=function(_0x3904cd,_0x3a6a13){var _0x2415d2={};var _0x3ddd6c=_['map'](db[_0x3df6('0x20')]['rawAttributes'],function(_0xc2a7e0){return{'name':_0xc2a7e0[_0x3df6('0x21')],'type':_0xc2a7e0['type'][_0x3df6('0x22')]};});_0x2415d2=qs['getOptions'](_0x3ddd6c,_0x3904cd);return interaction[_0x3df6('0x23')](_0x3df6('0x24'),_0x3904cd[_0x3df6('0x25')],_0x3904cd[_0x3df6('0x26')],_0x2415d2,_0x3ddd6c)[_0x3df6('0x1a')](respondWithFilteredResult(_0x3a6a13,_0x2415d2))[_0x3df6('0x27')](handleError(_0x3a6a13,null));};exports[_0x3df6('0x28')]=function(_0x16fe12,_0x41652a){var _0x152737={};if(_0x16fe12[_0x3df6('0x25')][_0x3df6('0x29')]&&_0x16fe12[_0x3df6('0x25')][_0x3df6('0x29')]==='from'){_0x152737[_0x3df6('0x2a')]=_0x16fe12[_0x3df6('0x2b')]['id'];}else{_0x152737['id']=_0x16fe12[_0x3df6('0x2b')]['id'];}var _0x35b859={'raw':![],'where':_0x152737},_0x47ddeb={};_0x47ddeb[_0x3df6('0x2c')]=_[_0x3df6('0x2d')](db['OpenchannelInteraction'][_0x3df6('0x2e')]);_0x47ddeb[_0x3df6('0x25')]=_[_0x3df6('0x2d')](_0x16fe12[_0x3df6('0x25')]);_0x47ddeb[_0x3df6('0x2f')]=_['intersection'](_0x47ddeb[_0x3df6('0x2c')],_0x47ddeb[_0x3df6('0x25')]);_0x35b859[_0x3df6('0x30')]=_[_0x3df6('0x31')](_0x47ddeb[_0x3df6('0x2c')],qs[_0x3df6('0x32')](_0x16fe12[_0x3df6('0x25')][_0x3df6('0x32')]));_0x35b859[_0x3df6('0x30')]=_0x35b859['attributes'][_0x3df6('0x33')]?_0x35b859[_0x3df6('0x30')]:_0x47ddeb['model'];if(_0x16fe12[_0x3df6('0x25')][_0x3df6('0x34')]){_0x35b859['include']=[{'all':!![]}];}_0x35b859=_[_0x3df6('0x35')]({},_0x35b859,_0x16fe12[_0x3df6('0x36')]);return db[_0x3df6('0x20')][_0x3df6('0x37')](_0x35b859)['then'](handleEntityNotFound(_0x41652a,null))[_0x3df6('0x1a')](respondWithResult(_0x41652a,null))[_0x3df6('0x27')](handleError(_0x41652a,null));};exports['create']=function(_0x9bde7e,_0x19b9e1){return db[_0x3df6('0x20')][_0x3df6('0x38')](_0x9bde7e['body'],{})[_0x3df6('0x1a')](respondWithResult(_0x19b9e1,0xc9))['catch'](handleError(_0x19b9e1,null));};exports[_0x3df6('0x18')]=function(_0x20adb9,_0x225490){if(_0x20adb9['body']['id']){delete _0x20adb9[_0x3df6('0x39')]['id'];}return db[_0x3df6('0x20')][_0x3df6('0x37')]({'where':{'id':_0x20adb9[_0x3df6('0x2b')]['id']}})[_0x3df6('0x1a')](handleEntityNotFound(_0x225490,null))[_0x3df6('0x1a')](saveUpdates(_0x20adb9[_0x3df6('0x39')],null))[_0x3df6('0x1a')](respondWithResult(_0x225490,null))['catch'](handleError(_0x225490,null));};exports['destroy']=function(_0x2a6eae,_0x3ea8af){return db[_0x3df6('0x20')][_0x3df6('0x37')]({'where':{'id':_0x2a6eae[_0x3df6('0x2b')]['id']}})[_0x3df6('0x1a')](handleEntityNotFound(_0x3ea8af,null))[_0x3df6('0x1a')](removeEntity(_0x3ea8af,null))['catch'](handleError(_0x3ea8af,null));};exports['describe']=function(_0x249a16,_0x2005f9){return db[_0x3df6('0x20')][_0x3df6('0x3a')]()['then'](respondWithResult(_0x2005f9,null))[_0x3df6('0x27')](handleError(_0x2005f9,null));};exports[_0x3df6('0x3b')]=function(_0x3928ac,_0x1710af){return db[_0x3df6('0x3c')][_0x3df6('0x37')]({'where':{'id':_0x3928ac[_0x3df6('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1710af,null))[_0x3df6('0x1a')](function(_0xaaa937){if(_0xaaa937){return _0xaaa937[_0x3df6('0x3b')](_0x3928ac['body'][_0x3df6('0x3d')],_['omit'](_0x3928ac['body'],[_0x3df6('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x1710af,null))['catch'](handleError(_0x1710af,null));};exports[_0x3df6('0x3e')]=function(_0x29a470,_0x219a14){var _0xeac8b={'raw':![],'where':{}};var _0x5a7d6e={};var _0x4c02c0={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x3df6('0x3f')]({'where':{'id':_0x29a470[_0x3df6('0x2b')]['id']}})[_0x3df6('0x1a')](handleEntityNotFound(_0x219a14,null))['then'](function(_0x24dd61){if(_0x24dd61){_0x5a7d6e[_0x3df6('0x2c')]=_[_0x3df6('0x2d')](db['OpenchannelMessage'][_0x3df6('0x2e')]);_0x5a7d6e[_0x3df6('0x25')]=_[_0x3df6('0x2d')](_0x29a470['query']);_0x5a7d6e[_0x3df6('0x2f')]=_[_0x3df6('0x31')](_0x5a7d6e[_0x3df6('0x2c')],_0x5a7d6e[_0x3df6('0x25')]);_0xeac8b[_0x3df6('0x30')]=_[_0x3df6('0x31')](_0x5a7d6e['model'],qs['fields'](_0x29a470[_0x3df6('0x25')]['fields']));_0xeac8b[_0x3df6('0x30')]=_0xeac8b[_0x3df6('0x30')][_0x3df6('0x33')]?_0xeac8b[_0x3df6('0x30')]:_0x5a7d6e[_0x3df6('0x2c')];if(!_0x29a470[_0x3df6('0x25')][_0x3df6('0x40')](_0x3df6('0x41'))){_0xeac8b[_0x3df6('0x15')]=qs[_0x3df6('0x15')](_0x29a470[_0x3df6('0x25')][_0x3df6('0x15')]);_0xeac8b[_0x3df6('0x12')]=qs[_0x3df6('0x12')](_0x29a470['query'][_0x3df6('0x12')]);}_0xeac8b[_0x3df6('0x42')]=qs['sort'](_0x29a470[_0x3df6('0x25')][_0x3df6('0x43')]);_0xeac8b[_0x3df6('0x44')]=qs[_0x3df6('0x2f')](_[_0x3df6('0x45')](_0x29a470['query'],_0x5a7d6e['filters']));_0xeac8b[_0x3df6('0x44')][_0x3df6('0x46')]=_0x24dd61['id'];if(_0x29a470[_0x3df6('0x25')][_0x3df6('0x47')]){_0xeac8b[_0x3df6('0x44')]=_[_0x3df6('0x35')](_0xeac8b[_0x3df6('0x44')],{'$or':_['map'](_0xeac8b[_0x3df6('0x30')],function(_0x2e8ae2){var _0x38b9d5={};_0x38b9d5[_0x2e8ae2]={'$like':'%'+_0x29a470[_0x3df6('0x25')][_0x3df6('0x47')]+'%'};return _0x38b9d5;})});}if(_0x29a470['query'][_0x3df6('0x48')]){var _0x276d8b=_0x29a470[_0x3df6('0x25')][_0x3df6('0x48')]['split'](',');var _0x49e638={};_0x49e638[_0x276d8b[0x0]]={'$gte':moment(_0x276d8b[0x1])[_0x3df6('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0xeac8b[_0x3df6('0x44')]=_[_0x3df6('0x35')](_0xeac8b[_0x3df6('0x44')],_0x49e638);}_0xeac8b=_['merge']({},_0xeac8b,_0x29a470[_0x3df6('0x36')]);return db[_0x3df6('0x3c')][_0x3df6('0x14')]({'where':_0xeac8b[_0x3df6('0x44')]})[_0x3df6('0x1a')](function(_0x41d324){_0x4c02c0[_0x3df6('0x14')]=_0x41d324;if(_0x29a470[_0x3df6('0x25')]['includeAll']){_0xeac8b[_0x3df6('0x4a')]=[{'all':!![]}];}return db[_0x3df6('0x3c')][_0x3df6('0x23')](_0xeac8b);})[_0x3df6('0x1a')](function(_0x18126a){_0x4c02c0['rows']=_0x18126a;return _0x4c02c0;});}})['then'](respondWithFilteredResult(_0x219a14,_0xeac8b))[_0x3df6('0x27')](handleError(_0x219a14,null));};exports[_0x3df6('0x4b')]=function(_0x30aa21,_0x1d2e98){return db[_0x3df6('0x20')][_0x3df6('0x37')]({'where':{'id':_0x30aa21[_0x3df6('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1d2e98,null))['then'](function(_0x489055){if(_0x489055){return _0x489055[_0x3df6('0x4c')](_0x30aa21[_0x3df6('0x39')][_0x3df6('0x3d')],_[_0x3df6('0x4d')](_0x30aa21['body'],[_0x3df6('0x3d'),'id'])||{})[_0x3df6('0x4e')](function(){return db['Tag'][_0x3df6('0x23')]({'attributes':['id',_0x3df6('0x1d'),_0x3df6('0x4f')],'where':{'id':_0x30aa21[_0x3df6('0x39')][_0x3df6('0x3d')]}});})[_0x3df6('0x1a')](function(_0x1ebe0e){socket['emit'](_0x3df6('0x50'),{'id':Number(_0x30aa21['params']['id']),'tags':_0x1ebe0e||[]});return{'id':Number(_0x30aa21[_0x3df6('0x2b')]['id']),'tags':_0x1ebe0e||[]};});}})[_0x3df6('0x1a')](respondWithResult(_0x1d2e98,null))[_0x3df6('0x27')](handleError(_0x1d2e98,null));};exports[_0x3df6('0x51')]=function(_0x30dcea,_0x38d0ee){return db['OpenchannelInteraction']['find']({'where':{'id':_0x30dcea[_0x3df6('0x2b')]['id']}})[_0x3df6('0x1a')](handleEntityNotFound(_0x38d0ee,null))[_0x3df6('0x1a')](function(_0x12b007){if(_0x12b007){return _0x12b007[_0x3df6('0x51')](_0x30dcea[_0x3df6('0x25')][_0x3df6('0x3d')]);}})[_0x3df6('0x1a')](respondWithStatusCode(_0x38d0ee,null))[_0x3df6('0x27')](handleError(_0x38d0ee,null));};exports['download']=function(_0x151514,_0x485d58){var _0x54cbc9=moment()[_0x3df6('0x52')]()['toString']();var _0x258113=path[_0x3df6('0x53')](config[_0x3df6('0x54')],'server','files',_0x3df6('0x55'));var _0x4c8ad3=path[_0x3df6('0x53')](config[_0x3df6('0x54')],_0x3df6('0x56'),_0x3df6('0x57'),_0x3df6('0x58'));var _0x63532b=path[_0x3df6('0x53')](_0x258113,_0x54cbc9);var _0x3cbd3e=util[_0x3df6('0x49')](_0x3df6('0x59'),_0x151514[_0x3df6('0x2b')]['id'],_0x54cbc9);var _0x171cad=path[_0x3df6('0x53')](_0x258113,_0x3cbd3e);var _0x3926b9=[];_0x3926b9['push']({'model':db[_0x3df6('0x5a')],'as':_0x3df6('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x3926b9[_0x3df6('0x5b')]({'model':db[_0x3df6('0x5c')],'as':_0x3df6('0x5d'),'attributes':['id',_0x3df6('0x5e'),'lastName'],'raw':!![]});if(_0x151514[_0x3df6('0x25')]['attachments']){_0x3926b9[_0x3df6('0x5b')]({'model':db[_0x3df6('0x5f')],'as':_0x3df6('0x5f'),'raw':!![]});}var _0x48c974=[{'model':db[_0x3df6('0x3c')],'as':_0x3df6('0x60'),'attributes':['id',_0x3df6('0x39'),_0x3df6('0x61'),_0x3df6('0x62'),_0x3df6('0x63'),_0x3df6('0x64')],'include':_0x3926b9}];_0x48c974[_0x3df6('0x5b')]({'model':db[_0x3df6('0x65')],'as':'Account','attributes':['id',_0x3df6('0x1d')]});_0x48c974[_0x3df6('0x5b')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0x3df6('0x20')][_0x3df6('0x37')]({'where':{'id':_0x151514[_0x3df6('0x2b')]['id']},'include':_0x48c974})['then'](handleEntityNotFound(_0x485d58,null))[_0x3df6('0x1a')](function(_0x213604){if(_0x213604){var _0x3fff27=_0x213604['get']({'plain':!![]});fs['mkdirSync'](_0x63532b);var _0x27f81d={'channel':_0x3df6('0x66'),'account':_0x3fff27[_0x3df6('0x67')]['name'],'agent':_0x3fff27['Owner']?_0x3fff27[_0x3df6('0x68')][_0x3df6('0x69')]:_0x3df6('0x6a'),'createdAt':moment(_0x3fff27[_0x3df6('0x61')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3df6('0x6b')](),'closedAt':_0x3fff27[_0x3df6('0x6c')]?moment(_0x3fff27[_0x3df6('0x6d')])[_0x3df6('0x49')](_0x3df6('0x6e'))[_0x3df6('0x6b')]():'','disposition':_0x3fff27[_0x3df6('0x6f')],'visibility':_0x3fff27[_0x3df6('0x70')]?_0x3df6('0x71'):_0x3df6('0x72'),'messages':_(_0x3fff27[_0x3df6('0x60')])[_0x3df6('0x47')]({'secret':![]})[_0x3df6('0x73')](function(_0x44c2d6){if(_0x44c2d6[_0x3df6('0x5f')]){var _0x3e76ff=path[_0x3df6('0x53')](_0x4c8ad3,_0x44c2d6['Attachment'][_0x3df6('0x74')]);if(fs['existsSync'](_0x3e76ff)){fs[_0x3df6('0x75')](_0x3e76ff)[_0x3df6('0x76')](fs[_0x3df6('0x77')](path[_0x3df6('0x53')](_0x63532b,_0x44c2d6[_0x3df6('0x5f')][_0x3df6('0x74')])));}}return{'date':moment(_0x44c2d6[_0x3df6('0x61')])['format'](_0x3df6('0x6e'))['toString'](),'sender':_0x44c2d6['direction']===_0x3df6('0x78')?_0x44c2d6['User']?_0x44c2d6[_0x3df6('0x5a')]['fullname']:'System':_0x44c2d6[_0x3df6('0x5d')][_0x3df6('0x5e')]+(_0x44c2d6['Contact'][_0x3df6('0x79')]?'\x20'+_0x44c2d6[_0x3df6('0x5d')][_0x3df6('0x79')]:''),'body':_0x44c2d6[_0x3df6('0x5f')]?_0x44c2d6['Attachment'][_0x3df6('0x74')]:_0x44c2d6[_0x3df6('0x39')],'direction':_0x44c2d6[_0x3df6('0x62')]===_0x3df6('0x78')?'A':'C','secret':_0x44c2d6['secret'],'read':_0x44c2d6[_0x3df6('0x64')],'attachment':_0x44c2d6[_0x3df6('0x5f')]};})['value']()};return ejs['renderFile'](path[_0x3df6('0x53')](config[_0x3df6('0x54')],_0x3df6('0x56'),_0x3df6('0x7a'),'downloadInteraction.ejs'),{'interaction':_0x27f81d})['then'](function(_0x2ad09f){var _0x3e5e54=path[_0x3df6('0x53')](_0x63532b,_0x3df6('0x7b')+_0x3fff27['id']+'-'+_0x54cbc9+'.pdf');var _0x11c5af={'path':_0x3e5e54,'channel':_0x3df6('0x66'),'interactionId':_0x3fff27['id']};return pdf['createPdfFromHTML'](_0x2ad09f,_0x11c5af);})[_0x3df6('0x1a')](function(){return new Promise(function(_0xdbd77a,_0x3ba9c4){zipdir(_0x63532b,{'saveTo':_0x171cad},function(_0x5de9d1,_0x3d30ac){if(_0x5de9d1)return _0x3ba9c4(_0x5de9d1);return _0xdbd77a(_0x3d30ac);});})[_0x3df6('0x1a')](function(){return new Promise(function(_0x4de01c,_0x433224){rimraf(_0x63532b,function(_0x233f6e){if(_0x233f6e)_0x433224(_0x233f6e);return _0x4de01c();});});})[_0x3df6('0x1a')](function(){return _0x485d58[_0x3df6('0x7c')](_0x171cad,_0x3cbd3e,function(_0x29cfbd){if(_0x29cfbd){logger[_0x3df6('0x7d')](_0x3df6('0x7e'),_0x29cfbd);}else{fs[_0x3df6('0x7f')](_0x171cad);}});});});}else{return _0x485d58['sendStatus'](0xc8);}})[_0x3df6('0x27')](handleError(_0x485d58,null));}; \ No newline at end of file +var _0xad39=['lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','fullname','get','mkdirSync','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','toString','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','out','firstName','Contact','basename','value','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','error','name','send','index','map','OpenchannelInteraction','rawAttributes','type','key','getOptions','findAll','openchannel','query','user','show','from','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','catch','create','body','destroy','describe','addMessage','OpenchannelMessage','omit','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','split','format','count','includeAll','rows','addTags','setTags','ids','spread','color','openchannelInteractionTags:save','removeTags','root','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','CmContact'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xad39,0x1b5));var _0x9ad3=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xad39[_0x5d2803];return _0xdcad2c;};'use strict';var rimraf=require(_0x9ad3('0x0'));var zipdir=require(_0x9ad3('0x1'));var moment=require(_0x9ad3('0x2'));var util=require(_0x9ad3('0x3'));var path=require('path');var ejs=require(_0x9ad3('0x4'));var fs=require('fs');var _=require(_0x9ad3('0x5'));var Redis=require(_0x9ad3('0x6'));var interaction=require(_0x9ad3('0x7'));var qs=require(_0x9ad3('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x9ad3('0x9'))(_0x9ad3('0xa'));var config=require(_0x9ad3('0xb'));var db=require(_0x9ad3('0xc'))['db'];config['redis']=_[_0x9ad3('0xd')](config[_0x9ad3('0xe')],{'host':_0x9ad3('0xf'),'port':0x18eb});var socket=require(_0x9ad3('0x10'))(new Redis(config[_0x9ad3('0xe')]));require(_0x9ad3('0x11'))[_0x9ad3('0x12')](socket);function respondWithStatusCode(_0x193f46,_0x525f73){_0x525f73=_0x525f73||0xcc;return function(_0xe6006){if(_0xe6006){return _0x193f46[_0x9ad3('0x13')](_0x525f73);}return _0x193f46[_0x9ad3('0x14')](_0x525f73)[_0x9ad3('0x15')]();};}function respondWithResult(_0x2b6d59,_0x4e98bb){_0x4e98bb=_0x4e98bb||0xc8;return function(_0x4a820f){if(_0x4a820f){return _0x2b6d59[_0x9ad3('0x14')](_0x4e98bb)[_0x9ad3('0x16')](_0x4a820f);}};}function respondWithFilteredResult(_0x9f4942,_0x40719e){return function(_0x46691e){if(_0x46691e){var _0x4ef891=typeof _0x40719e[_0x9ad3('0x17')]===_0x9ad3('0x18')&&typeof _0x40719e[_0x9ad3('0x19')]===_0x9ad3('0x18');var _0x5800d6=_0x46691e['count'];var _0x20a319=_0x4ef891?0x0:_0x40719e[_0x9ad3('0x17')];var _0x108f6c=_0x4ef891?_0x46691e['count']:_0x40719e[_0x9ad3('0x17')]+_0x40719e[_0x9ad3('0x19')];var _0x27e061;if(_0x108f6c>=_0x5800d6){_0x108f6c=_0x5800d6;_0x27e061=0xc8;}else{_0x27e061=0xce;}_0x9f4942[_0x9ad3('0x14')](_0x27e061);return _0x9f4942[_0x9ad3('0x1a')](_0x9ad3('0x1b'),_0x20a319+'-'+_0x108f6c+'/'+_0x5800d6)[_0x9ad3('0x16')](_0x46691e);}return null;};}function saveUpdates(_0x20a616){return function(_0x309317){if(_0x309317){return _0x309317[_0x9ad3('0x1c')](_0x20a616)[_0x9ad3('0x1d')](function(_0x44a682){return _0x44a682;});}return null;};}function removeEntity(_0x4359c1){return function(_0x48bb83){if(_0x48bb83){return _0x48bb83['destroy']()['then'](function(){_0x4359c1[_0x9ad3('0x14')](0xcc)[_0x9ad3('0x15')]();});}};}function handleEntityNotFound(_0x583244){return function(_0x5c9709){if(!_0x5c9709){_0x583244[_0x9ad3('0x13')](0x194);}return _0x5c9709;};}function handleError(_0xd3b80b,_0x56ddb6){_0x56ddb6=_0x56ddb6||0x1f4;return function(_0x1fc1e6){logger[_0x9ad3('0x1e')](_0x1fc1e6['stack']);if(_0x1fc1e6[_0x9ad3('0x1f')]){delete _0x1fc1e6[_0x9ad3('0x1f')];}_0xd3b80b[_0x9ad3('0x14')](_0x56ddb6)[_0x9ad3('0x20')](_0x1fc1e6);};}exports[_0x9ad3('0x21')]=function(_0x1bb0e0,_0x2e4040){var _0x3196d1={};var _0x134816=_[_0x9ad3('0x22')](db[_0x9ad3('0x23')][_0x9ad3('0x24')],function(_0x3f9de1){return{'name':_0x3f9de1['fieldName'],'type':_0x3f9de1[_0x9ad3('0x25')][_0x9ad3('0x26')]};});_0x3196d1=qs[_0x9ad3('0x27')](_0x134816,_0x1bb0e0);return interaction[_0x9ad3('0x28')](_0x9ad3('0x29'),_0x1bb0e0[_0x9ad3('0x2a')],_0x1bb0e0[_0x9ad3('0x2b')],_0x3196d1,_0x134816)[_0x9ad3('0x1d')](respondWithFilteredResult(_0x2e4040,_0x3196d1))['catch'](handleError(_0x2e4040,null));};exports[_0x9ad3('0x2c')]=function(_0x21589,_0x11bf90){var _0x407e0d={};if(_0x21589['query'][_0x9ad3('0x25')]&&_0x21589[_0x9ad3('0x2a')]['type']===_0x9ad3('0x2d')){_0x407e0d[_0x9ad3('0x2d')]=_0x21589[_0x9ad3('0x2e')]['id'];}else{_0x407e0d['id']=_0x21589[_0x9ad3('0x2e')]['id'];}var _0x67f1dd={'raw':![],'where':_0x407e0d},_0xb15877={};_0xb15877[_0x9ad3('0x2f')]=_[_0x9ad3('0x30')](db[_0x9ad3('0x23')][_0x9ad3('0x24')]);_0xb15877[_0x9ad3('0x2a')]=_['keys'](_0x21589[_0x9ad3('0x2a')]);_0xb15877[_0x9ad3('0x31')]=_[_0x9ad3('0x32')](_0xb15877[_0x9ad3('0x2f')],_0xb15877[_0x9ad3('0x2a')]);_0x67f1dd[_0x9ad3('0x33')]=_[_0x9ad3('0x32')](_0xb15877[_0x9ad3('0x2f')],qs[_0x9ad3('0x34')](_0x21589[_0x9ad3('0x2a')][_0x9ad3('0x34')]));_0x67f1dd[_0x9ad3('0x33')]=_0x67f1dd[_0x9ad3('0x33')][_0x9ad3('0x35')]?_0x67f1dd[_0x9ad3('0x33')]:_0xb15877['model'];if(_0x21589[_0x9ad3('0x2a')]['includeAll']){_0x67f1dd[_0x9ad3('0x36')]=[{'all':!![]}];}_0x67f1dd=_[_0x9ad3('0x37')]({},_0x67f1dd,_0x21589[_0x9ad3('0x38')]);return db[_0x9ad3('0x23')][_0x9ad3('0x39')](_0x67f1dd)[_0x9ad3('0x1d')](handleEntityNotFound(_0x11bf90,null))[_0x9ad3('0x1d')](respondWithResult(_0x11bf90,null))[_0x9ad3('0x3a')](handleError(_0x11bf90,null));};exports[_0x9ad3('0x3b')]=function(_0x40f78a,_0x296dbd){return db['OpenchannelInteraction'][_0x9ad3('0x3b')](_0x40f78a[_0x9ad3('0x3c')],{})['then'](respondWithResult(_0x296dbd,0xc9))[_0x9ad3('0x3a')](handleError(_0x296dbd,null));};exports['update']=function(_0x340b55,_0x150b1c){if(_0x340b55[_0x9ad3('0x3c')]['id']){delete _0x340b55[_0x9ad3('0x3c')]['id'];}return db[_0x9ad3('0x23')]['find']({'where':{'id':_0x340b55[_0x9ad3('0x2e')]['id']}})[_0x9ad3('0x1d')](handleEntityNotFound(_0x150b1c,null))['then'](saveUpdates(_0x340b55['body'],null))[_0x9ad3('0x1d')](respondWithResult(_0x150b1c,null))[_0x9ad3('0x3a')](handleError(_0x150b1c,null));};exports[_0x9ad3('0x3d')]=function(_0x337adb,_0x21506b){return db[_0x9ad3('0x23')][_0x9ad3('0x39')]({'where':{'id':_0x337adb[_0x9ad3('0x2e')]['id']}})[_0x9ad3('0x1d')](handleEntityNotFound(_0x21506b,null))[_0x9ad3('0x1d')](removeEntity(_0x21506b,null))[_0x9ad3('0x3a')](handleError(_0x21506b,null));};exports[_0x9ad3('0x3e')]=function(_0x27aa40,_0x23119a){return db[_0x9ad3('0x23')][_0x9ad3('0x3e')]()['then'](respondWithResult(_0x23119a,null))['catch'](handleError(_0x23119a,null));};exports[_0x9ad3('0x3f')]=function(_0x34e4a7,_0x1060a6){return db[_0x9ad3('0x40')][_0x9ad3('0x39')]({'where':{'id':_0x34e4a7[_0x9ad3('0x2e')]['id']}})[_0x9ad3('0x1d')](handleEntityNotFound(_0x1060a6,null))[_0x9ad3('0x1d')](function(_0xaba2ea){if(_0xaba2ea){return _0xaba2ea[_0x9ad3('0x3f')](_0x34e4a7['body']['ids'],_[_0x9ad3('0x41')](_0x34e4a7['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x1060a6,null))[_0x9ad3('0x3a')](handleError(_0x1060a6,null));};exports['getMessages']=function(_0x97541c,_0x16ccbf){var _0x42fdc2={'raw':![],'where':{}};var _0x4522f5={};var _0x2d9fbb={'count':0x0,'rows':[]};return db[_0x9ad3('0x23')]['findOne']({'where':{'id':_0x97541c[_0x9ad3('0x2e')]['id']}})[_0x9ad3('0x1d')](handleEntityNotFound(_0x16ccbf,null))[_0x9ad3('0x1d')](function(_0xc4b619){if(_0xc4b619){_0x4522f5[_0x9ad3('0x2f')]=_[_0x9ad3('0x30')](db[_0x9ad3('0x40')][_0x9ad3('0x24')]);_0x4522f5[_0x9ad3('0x2a')]=_[_0x9ad3('0x30')](_0x97541c[_0x9ad3('0x2a')]);_0x4522f5[_0x9ad3('0x31')]=_['intersection'](_0x4522f5[_0x9ad3('0x2f')],_0x4522f5[_0x9ad3('0x2a')]);_0x42fdc2[_0x9ad3('0x33')]=_['intersection'](_0x4522f5[_0x9ad3('0x2f')],qs[_0x9ad3('0x34')](_0x97541c['query'][_0x9ad3('0x34')]));_0x42fdc2[_0x9ad3('0x33')]=_0x42fdc2[_0x9ad3('0x33')]['length']?_0x42fdc2[_0x9ad3('0x33')]:_0x4522f5[_0x9ad3('0x2f')];if(!_0x97541c[_0x9ad3('0x2a')][_0x9ad3('0x42')](_0x9ad3('0x43'))){_0x42fdc2[_0x9ad3('0x19')]=qs[_0x9ad3('0x19')](_0x97541c[_0x9ad3('0x2a')][_0x9ad3('0x19')]);_0x42fdc2[_0x9ad3('0x17')]=qs[_0x9ad3('0x17')](_0x97541c[_0x9ad3('0x2a')][_0x9ad3('0x17')]);}_0x42fdc2[_0x9ad3('0x44')]=qs[_0x9ad3('0x45')](_0x97541c['query'][_0x9ad3('0x45')]);_0x42fdc2[_0x9ad3('0x46')]=qs[_0x9ad3('0x31')](_['pick'](_0x97541c[_0x9ad3('0x2a')],_0x4522f5[_0x9ad3('0x31')]));_0x42fdc2[_0x9ad3('0x46')][_0x9ad3('0x47')]=_0xc4b619['id'];if(_0x97541c[_0x9ad3('0x2a')][_0x9ad3('0x48')]){_0x42fdc2[_0x9ad3('0x46')]=_[_0x9ad3('0x37')](_0x42fdc2[_0x9ad3('0x46')],{'$or':_['map'](_0x42fdc2['attributes'],function(_0x2c336c){var _0x2afd36={};_0x2afd36[_0x2c336c]={'$like':'%'+_0x97541c[_0x9ad3('0x2a')][_0x9ad3('0x48')]+'%'};return _0x2afd36;})});}if(_0x97541c[_0x9ad3('0x2a')][_0x9ad3('0x49')]){var _0x12cf68=_0x97541c[_0x9ad3('0x2a')][_0x9ad3('0x49')][_0x9ad3('0x4a')](',');var _0x1e7ebc={};_0x1e7ebc[_0x12cf68[0x0]]={'$gte':moment(_0x12cf68[0x1])[_0x9ad3('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x42fdc2[_0x9ad3('0x46')]=_[_0x9ad3('0x37')](_0x42fdc2[_0x9ad3('0x46')],_0x1e7ebc);}_0x42fdc2=_['merge']({},_0x42fdc2,_0x97541c['options']);return db['OpenchannelMessage'][_0x9ad3('0x4c')]({'where':_0x42fdc2[_0x9ad3('0x46')]})['then'](function(_0x56946f){_0x2d9fbb['count']=_0x56946f;if(_0x97541c[_0x9ad3('0x2a')][_0x9ad3('0x4d')]){_0x42fdc2[_0x9ad3('0x36')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x42fdc2);})[_0x9ad3('0x1d')](function(_0x2bb0d0){_0x2d9fbb[_0x9ad3('0x4e')]=_0x2bb0d0;return _0x2d9fbb;});}})[_0x9ad3('0x1d')](respondWithFilteredResult(_0x16ccbf,_0x42fdc2))[_0x9ad3('0x3a')](handleError(_0x16ccbf,null));};exports[_0x9ad3('0x4f')]=function(_0x16fc87,_0x4ee31){return db[_0x9ad3('0x23')][_0x9ad3('0x39')]({'where':{'id':_0x16fc87[_0x9ad3('0x2e')]['id']}})[_0x9ad3('0x1d')](handleEntityNotFound(_0x4ee31,null))['then'](function(_0x4c0f11){if(_0x4c0f11){return _0x4c0f11[_0x9ad3('0x50')](_0x16fc87[_0x9ad3('0x3c')][_0x9ad3('0x51')],_[_0x9ad3('0x41')](_0x16fc87['body'],[_0x9ad3('0x51'),'id'])||{})[_0x9ad3('0x52')](function(){return db['Tag'][_0x9ad3('0x28')]({'attributes':['id',_0x9ad3('0x1f'),_0x9ad3('0x53')],'where':{'id':_0x16fc87[_0x9ad3('0x3c')]['ids']}});})[_0x9ad3('0x1d')](function(_0x33e6b9){socket['emit'](_0x9ad3('0x54'),{'id':Number(_0x16fc87[_0x9ad3('0x2e')]['id']),'tags':_0x33e6b9||[]});return{'id':Number(_0x16fc87['params']['id']),'tags':_0x33e6b9||[]};});}})['then'](respondWithResult(_0x4ee31,null))['catch'](handleError(_0x4ee31,null));};exports[_0x9ad3('0x55')]=function(_0x4684d2,_0x6abec2){return db[_0x9ad3('0x23')][_0x9ad3('0x39')]({'where':{'id':_0x4684d2[_0x9ad3('0x2e')]['id']}})[_0x9ad3('0x1d')](handleEntityNotFound(_0x6abec2,null))[_0x9ad3('0x1d')](function(_0x23288c){if(_0x23288c){return _0x23288c[_0x9ad3('0x55')](_0x4684d2[_0x9ad3('0x2a')]['ids']);}})[_0x9ad3('0x1d')](respondWithStatusCode(_0x6abec2,null))[_0x9ad3('0x3a')](handleError(_0x6abec2,null));};exports['download']=function(_0x3ae1ec,_0xd91da3){var _0x24cff3=moment()['unix']()['toString']();var _0x129ba9=path['join'](config[_0x9ad3('0x56')],'server',_0x9ad3('0x57'),_0x9ad3('0x58'));var _0x1e0bf9=path[_0x9ad3('0x59')](config['root'],'server',_0x9ad3('0x57'),_0x9ad3('0x5a'));var _0x2b29d2=path[_0x9ad3('0x59')](_0x129ba9,_0x24cff3);var _0x3c5a5f=util[_0x9ad3('0x4b')](_0x9ad3('0x5b'),_0x3ae1ec[_0x9ad3('0x2e')]['id'],_0x24cff3);var _0xa231f9=path['join'](_0x129ba9,_0x3c5a5f);var _0x186e95=[];_0x186e95[_0x9ad3('0x5c')]({'model':db['User'],'as':_0x9ad3('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x186e95[_0x9ad3('0x5c')]({'model':db[_0x9ad3('0x5e')],'as':'Contact','attributes':['id','firstName',_0x9ad3('0x5f')],'raw':!![]});if(_0x3ae1ec[_0x9ad3('0x2a')][_0x9ad3('0x5a')]){_0x186e95['push']({'model':db[_0x9ad3('0x60')],'as':_0x9ad3('0x60'),'raw':!![]});}var _0x3572d7=[{'model':db[_0x9ad3('0x40')],'as':_0x9ad3('0x61'),'attributes':['id',_0x9ad3('0x3c'),_0x9ad3('0x62'),_0x9ad3('0x63'),_0x9ad3('0x64'),_0x9ad3('0x65')],'include':_0x186e95}];_0x3572d7['push']({'model':db[_0x9ad3('0x66')],'as':'Account','attributes':['id','name']});_0x3572d7[_0x9ad3('0x5c')]({'model':db[_0x9ad3('0x5d')],'as':_0x9ad3('0x67'),'attributes':['id',_0x9ad3('0x68')]});return db[_0x9ad3('0x23')][_0x9ad3('0x39')]({'where':{'id':_0x3ae1ec[_0x9ad3('0x2e')]['id']},'include':_0x3572d7})['then'](handleEntityNotFound(_0xd91da3,null))[_0x9ad3('0x1d')](function(_0x5284fd){if(_0x5284fd){var _0x4cb1f2=_0x5284fd[_0x9ad3('0x69')]({'plain':!![]});fs[_0x9ad3('0x6a')](_0x2b29d2);var _0x5cc063={'channel':_0x9ad3('0x6b'),'account':_0x4cb1f2[_0x9ad3('0x6c')]['name'],'agent':_0x4cb1f2[_0x9ad3('0x67')]?_0x4cb1f2['Owner'][_0x9ad3('0x68')]:_0x9ad3('0x6d'),'createdAt':moment(_0x4cb1f2[_0x9ad3('0x62')])['format'](_0x9ad3('0x6e'))['toString'](),'closedAt':_0x4cb1f2['closed']?moment(_0x4cb1f2[_0x9ad3('0x6f')])[_0x9ad3('0x4b')](_0x9ad3('0x6e'))[_0x9ad3('0x70')]():'','disposition':_0x4cb1f2[_0x9ad3('0x71')],'visibility':_0x4cb1f2[_0x9ad3('0x72')]?_0x9ad3('0x73'):_0x9ad3('0x74'),'messages':_(_0x4cb1f2[_0x9ad3('0x61')])[_0x9ad3('0x48')]({'secret':![]})['map'](function(_0x4d13b3){if(_0x4d13b3['Attachment']){var _0x7f0337=path[_0x9ad3('0x59')](_0x1e0bf9,_0x4d13b3[_0x9ad3('0x60')]['basename']);if(fs[_0x9ad3('0x75')](_0x7f0337)){fs[_0x9ad3('0x76')](_0x7f0337)[_0x9ad3('0x77')](fs[_0x9ad3('0x78')](path[_0x9ad3('0x59')](_0x2b29d2,_0x4d13b3[_0x9ad3('0x60')]['basename'])));}}return{'date':moment(_0x4d13b3[_0x9ad3('0x62')])[_0x9ad3('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4d13b3[_0x9ad3('0x63')]===_0x9ad3('0x79')?_0x4d13b3[_0x9ad3('0x5d')]?_0x4d13b3['User'][_0x9ad3('0x68')]:'System':_0x4d13b3['Contact'][_0x9ad3('0x7a')]+(_0x4d13b3['Contact'][_0x9ad3('0x5f')]?'\x20'+_0x4d13b3[_0x9ad3('0x7b')][_0x9ad3('0x5f')]:''),'body':_0x4d13b3['Attachment']?_0x4d13b3[_0x9ad3('0x60')][_0x9ad3('0x7c')]:_0x4d13b3[_0x9ad3('0x3c')],'direction':_0x4d13b3[_0x9ad3('0x63')]==='out'?'A':'C','secret':_0x4d13b3[_0x9ad3('0x64')],'read':_0x4d13b3['read'],'attachment':_0x4d13b3[_0x9ad3('0x60')]};})[_0x9ad3('0x7d')]()};return ejs[_0x9ad3('0x7e')](path['join'](config[_0x9ad3('0x56')],'server','views',_0x9ad3('0x7f')),{'interaction':_0x5cc063})['then'](function(_0x1adbce){var _0x2b4cef=path[_0x9ad3('0x59')](_0x2b29d2,_0x9ad3('0x80')+_0x4cb1f2['id']+'-'+_0x24cff3+'.pdf');var _0x394cd6={'path':_0x2b4cef,'channel':_0x9ad3('0x6b'),'interactionId':_0x4cb1f2['id']};return pdf[_0x9ad3('0x81')](_0x1adbce,_0x394cd6);})['then'](function(){return new Promise(function(_0x4df552,_0x43e0d1){zipdir(_0x2b29d2,{'saveTo':_0xa231f9},function(_0x134394,_0x150c39){if(_0x134394)return _0x43e0d1(_0x134394);return _0x4df552(_0x150c39);});})[_0x9ad3('0x1d')](function(){return new Promise(function(_0x2c03c5,_0xbb0edb){rimraf(_0x2b29d2,function(_0x5e1d00){if(_0x5e1d00)_0xbb0edb(_0x5e1d00);return _0x2c03c5();});});})[_0x9ad3('0x1d')](function(){return _0xd91da3[_0x9ad3('0x82')](_0xa231f9,_0x3c5a5f,function(_0x2b2341){if(_0x2b2341){logger[_0x9ad3('0x1e')](_0x9ad3('0x83'),_0x2b2341);}else{fs[_0x9ad3('0x84')](_0xa231f9);}});});});}else{return _0xd91da3[_0x9ad3('0x13')](0xc8);}})[_0x9ad3('0x3a')](handleError(_0xd91da3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index acb45c5..41132c5 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 _0xc4f6=['emit','catch','hasOwnProperty','exports','../../mysqldb','OpenchannelInteraction','save','update','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x1ffc0e,_0x3ad69b){var _0x3c1d8f=function(_0x52741f){while(--_0x52741f){_0x1ffc0e['push'](_0x1ffc0e['shift']());}};_0x3c1d8f(++_0x3ad69b);}(_0xc4f6,0x1e4));var _0x6c4f=function(_0x443f0f,_0x8a58a7){_0x443f0f=_0x443f0f-0x0;var _0x2dfd5b=_0xc4f6[_0x443f0f];return _0x2dfd5b;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x6c4f('0x0'))['db'][_0x6c4f('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c4f('0x2'),'afterUpdate':_0x6c4f('0x3'),'afterDestroy':_0x6c4f('0x4')};function emitEvent(_0x45fe6b){return function(_0x3d3cfc,_0x53b81c,_0x290019){_0x3d3cfc[_0x6c4f('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1d7cf9){_0x3d3cfc[_0x6c4f('0x6')](_0x6c4f('0x7'),_0x1d7cf9[_0x6c4f('0x8')](function(_0x362524){return{'id':_0x362524['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3d3cfc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6c4f('0x9')](function(_0x6bbbf7){_0x3d3cfc[_0x6c4f('0x6')](_0x6c4f('0xa'),_0x6bbbf7[_0x6c4f('0xb')]);OpenchannelInteractionEvents[_0x6c4f('0xc')](_0x45fe6b+':'+_0x3d3cfc['id'],_0x3d3cfc);OpenchannelInteractionEvents[_0x6c4f('0xc')](_0x45fe6b,_0x3d3cfc);_0x290019(null);})[_0x6c4f('0xd')](_0x290019(null));};}for(var e in events){if(events[_0x6c4f('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x6c4f('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x8a7b=['Users','unreadMessages','length','emit','catch','hook','exports','events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','then','setDataValue'];(function(_0x5b04c3,_0x19fd6a){var _0x47565e=function(_0x1233b2){while(--_0x1233b2){_0x5b04c3['push'](_0x5b04c3['shift']());}};_0x47565e(++_0x19fd6a);}(_0x8a7b,0xca));var _0xb8a7=function(_0x4d0d85,_0x3250d3){_0x4d0d85=_0x4d0d85-0x0;var _0x290a74=_0x8a7b[_0x4d0d85];return _0x290a74;};'use strict';var EventEmitter=require(_0xb8a7('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xb8a7('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xb8a7('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb8a7('0x3')](0x0);var events={'afterCreate':_0xb8a7('0x4'),'afterUpdate':'update','afterDestroy':_0xb8a7('0x5')};function emitEvent(_0x555d93){return function(_0x392313,_0x571ba1,_0x2b82c4){_0x392313['getUsers']({'attributes':['id'],'raw':!![]})[_0xb8a7('0x6')](function(_0x6fa2fb){_0x392313[_0xb8a7('0x7')](_0xb8a7('0x8'),_0x6fa2fb['map'](function(_0x1803a3){return{'id':_0x1803a3['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x392313['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb8a7('0x6')](function(_0x2d0073){_0x392313[_0xb8a7('0x7')](_0xb8a7('0x9'),_0x2d0073[_0xb8a7('0xa')]);OpenchannelInteractionEvents[_0xb8a7('0xb')](_0x555d93+':'+_0x392313['id'],_0x392313);OpenchannelInteractionEvents[_0xb8a7('0xb')](_0x555d93,_0x392313);_0x2b82c4(null);})[_0xb8a7('0xc')](_0x2b82c4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xb8a7('0xd')](e,emitEvent(event));}}module[_0xb8a7('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index e776b56..90b39d0 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 _0x73a8=['OpenchannelInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define'];(function(_0x1b0c8c,_0x486222){var _0x2e67c9=function(_0x4f27c6){while(--_0x4f27c6){_0x1b0c8c['push'](_0x1b0c8c['shift']());}};_0x2e67c9(++_0x486222);}(_0x73a8,0x12a));var _0x873a=function(_0x1d041f,_0xe70d36){_0x1d041f=_0x1d041f-0x0;var _0x16d415=_0x73a8[_0x1d041f];return _0x16d415;};'use strict';var _=require('lodash');var util=require(_0x873a('0x0'));var logger=require('../../config/logger')(_0x873a('0x1'));var moment=require(_0x873a('0x2'));var BPromise=require(_0x873a('0x3'));var rp=require(_0x873a('0x4'));var fs=require('fs');var path=require(_0x873a('0x5'));var rimraf=require(_0x873a('0x6'));var config=require('../../config/environment');var attributes=require(_0x873a('0x7'));module[_0x873a('0x8')]=function(_0x1e2396,_0x384e29){return _0x1e2396[_0x873a('0x9')](_0x873a('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x187e30,_0x12a0cc,_0x33add6){if(_0x187e30['changed'](_0x873a('0xb'))){_0x187e30['closedAt']=moment()[_0x873a('0xc')](_0x873a('0xd'));}_0x33add6(null,_0x187e30);}}});}; \ No newline at end of file +var _0xa3fc=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0xa3fc,0x1c4));var _0xca3f=function(_0x2faf52,_0x398229){_0x2faf52=_0x2faf52-0x0;var _0x58c8f3=_0xa3fc[_0x2faf52];return _0x58c8f3;};'use strict';var _=require(_0xca3f('0x0'));var util=require(_0xca3f('0x1'));var logger=require(_0xca3f('0x2'))(_0xca3f('0x3'));var moment=require(_0xca3f('0x4'));var BPromise=require(_0xca3f('0x5'));var rp=require(_0xca3f('0x6'));var fs=require('fs');var path=require(_0xca3f('0x7'));var rimraf=require(_0xca3f('0x8'));var config=require(_0xca3f('0x9'));var attributes=require(_0xca3f('0xa'));module[_0xca3f('0xb')]=function(_0x134346,_0x1623d0){return _0x134346[_0xca3f('0xc')](_0xca3f('0xd'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xca3f('0xe'),'collate':_0xca3f('0xf'),'hooks':{'beforeUpdate':function(_0x409df4,_0x99dfce,_0x745dca){if(_0x409df4['changed'](_0xca3f('0x10'))){_0x409df4[_0xca3f('0x11')]=moment()[_0xca3f('0x12')](_0xca3f('0x13'));}_0x745dca(null,_0x409df4);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 581abb4..cafc994 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 _0x7010=['error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','OpenchannelInteraction','then','ids','omit','spread','AddTags','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','info','request\x20sent','debug','stringify'];(function(_0x525e98,_0x1e6b3c){var _0x56b01c=function(_0x1d67a6){while(--_0x1d67a6){_0x525e98['push'](_0x525e98['shift']());}};_0x56b01c(++_0x1e6b3c);}(_0x7010,0x85));var _0x0701=function(_0x276387,_0xd0a20f){_0x276387=_0x276387-0x0;var _0x23089f=_0x7010[_0x276387];return _0x23089f;};'use strict';var _=require(_0x0701('0x0'));var util=require('util');var moment=require(_0x0701('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0701('0x2'))['db'];var utils=require(_0x0701('0x3'));var logger=require(_0x0701('0x4'))(_0x0701('0x5'));var config=require(_0x0701('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0701('0x7')][_0x0701('0x8')]({'port':0x232a});config[_0x0701('0x9')]=_[_0x0701('0xa')](config[_0x0701('0x9')],{'host':_0x0701('0xb'),'port':0x18eb});var socket=require(_0x0701('0xc'))(new Redis(config[_0x0701('0x9')]));require(_0x0701('0xd'))[_0x0701('0xe')](socket);function respondWithRpcPromise(_0x92fa32,_0xea6a14,_0x3b1b61){return new BPromise(function(_0x13cee0,_0x75ca81){return client['request'](_0x92fa32,_0x3b1b61)['then'](function(_0x31a890){logger[_0x0701('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0xea6a14,_0x0701('0x10'));logger[_0x0701('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0xea6a14,'request\x20sent',JSON[_0x0701('0x12')](_0x31a890));if(_0x31a890['error']){if(_0x31a890[_0x0701('0x13')][_0x0701('0x14')]===0x1f4){logger[_0x0701('0x13')](_0x0701('0x15'),_0xea6a14,_0x31a890[_0x0701('0x13')][_0x0701('0x16')]);return _0x75ca81(_0x31a890['error'][_0x0701('0x16')]);}logger['error'](_0x0701('0x15'),_0xea6a14,_0x31a890[_0x0701('0x13')][_0x0701('0x16')]);return _0x13cee0(_0x31a890[_0x0701('0x13')][_0x0701('0x16')]);}else{logger[_0x0701('0xf')](_0x0701('0x15'),_0xea6a14,_0x0701('0x10'));_0x13cee0(_0x31a890[_0x0701('0x17')][_0x0701('0x16')]);}})[_0x0701('0x18')](function(_0x46c6d5){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0xea6a14,_0x46c6d5);_0x75ca81(_0x46c6d5);});});}exports[_0x0701('0x19')]=function(_0x573e48){var _0x969004=this;return new Promise(function(_0x385697,_0x5514f5){return db['OpenchannelInteraction'][_0x0701('0x1a')](_0x573e48[_0x0701('0x1b')],{'raw':_0x573e48[_0x0701('0x1c')]?_0x573e48['options'][_0x0701('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x573e48[_0x0701('0x1c')]?_0x573e48[_0x0701('0x1c')][_0x0701('0x1e')]||null:null,'attributes':_0x573e48[_0x0701('0x1c')]?_0x573e48[_0x0701('0x1c')][_0x0701('0x1f')]||null:null,'limit':_0x573e48['options']?_0x573e48[_0x0701('0x1c')]['limit']||null:null})['then'](function(_0x8fc39){logger[_0x0701('0xf')](_0x0701('0x19'),_0x573e48);logger[_0x0701('0x11')](_0x0701('0x19'),_0x573e48,JSON[_0x0701('0x12')](_0x8fc39));_0x385697(_0x8fc39);})[_0x0701('0x18')](function(_0x4e8d72){logger[_0x0701('0x13')]('UpdateOpenchannelInteraction',_0x4e8d72[_0x0701('0x16')],_0x573e48);_0x5514f5(_0x969004[_0x0701('0x13')](0x1f4,_0x4e8d72[_0x0701('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x13b89b){return new Promise(function(_0x394e27,_0x524cf0){return db[_0x0701('0x20')]['find']({'where':_0x13b89b[_0x0701('0x1c')]?_0x13b89b['options'][_0x0701('0x1e')]||null:null})[_0x0701('0x21')](function(_0x2ca9fd){if(_0x2ca9fd){return _0x2ca9fd['addTags'](_0x13b89b[_0x0701('0x1b')][_0x0701('0x22')],_[_0x0701('0x23')](_0x13b89b[_0x0701('0x1b')],[_0x0701('0x22'),'id'])||{});}})[_0x0701('0x24')](function(_0x540992){logger['info']('AddTags',_0x13b89b);logger[_0x0701('0x11')](_0x0701('0x25'),_0x13b89b,JSON[_0x0701('0x12')](_0x540992));_0x394e27(_0x540992);})['catch'](function(_0x5800bc){logger['error'](_0x0701('0x25'),_0x5800bc[_0x0701('0x16')],_0x13b89b);_0x524cf0(_this[_0x0701('0x13')](0x1f4,_0x5800bc[_0x0701('0x16')]));});});}; \ No newline at end of file +var _0x8dc1=['UpdateOpenchannelInteraction','stringify','find','addTags','body','ids','spread','AddTags','catch','lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','OpenchannelInteraction','update','options','raw','attributes','limit','then'];(function(_0xbd1f9e,_0x4b05e0){var _0x2036e7=function(_0x5c0a85){while(--_0x5c0a85){_0xbd1f9e['push'](_0xbd1f9e['shift']());}};_0x2036e7(++_0x4b05e0);}(_0x8dc1,0xad));var _0x18dc=function(_0x14a07a,_0xdf5495){_0x14a07a=_0x14a07a-0x0;var _0x2b609c=_0x8dc1[_0x14a07a];return _0x2b609c;};'use strict';var _=require(_0x18dc('0x0'));var util=require(_0x18dc('0x1'));var moment=require(_0x18dc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x18dc('0x4'));var logger=require('../../config/logger')(_0x18dc('0x5'));var config=require('../../config/environment');var jayson=require(_0x18dc('0x6'));var client=jayson[_0x18dc('0x7')][_0x18dc('0x8')]({'port':0x232a});config[_0x18dc('0x9')]=_[_0x18dc('0xa')](config[_0x18dc('0x9')],{'host':_0x18dc('0xb'),'port':0x18eb});var socket=require(_0x18dc('0xc'))(new Redis(config[_0x18dc('0x9')]));require(_0x18dc('0xd'))[_0x18dc('0xe')](socket);function respondWithRpcPromise(_0x406269,_0x2ac477,_0x4f1dbf){return new BPromise(function(_0x5c2ce1,_0x178236){return client[_0x18dc('0xf')](_0x406269,_0x4f1dbf)['then'](function(_0x477635){logger[_0x18dc('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2ac477,_0x18dc('0x11'));logger[_0x18dc('0x12')](_0x18dc('0x13'),_0x2ac477,_0x18dc('0x11'),JSON['stringify'](_0x477635));if(_0x477635[_0x18dc('0x14')]){if(_0x477635['error'][_0x18dc('0x15')]===0x1f4){logger[_0x18dc('0x14')](_0x18dc('0x16'),_0x2ac477,_0x477635[_0x18dc('0x14')][_0x18dc('0x17')]);return _0x178236(_0x477635[_0x18dc('0x14')]['message']);}logger[_0x18dc('0x14')](_0x18dc('0x16'),_0x2ac477,_0x477635[_0x18dc('0x14')][_0x18dc('0x17')]);return _0x5c2ce1(_0x477635[_0x18dc('0x14')][_0x18dc('0x17')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x2ac477,_0x18dc('0x11'));_0x5c2ce1(_0x477635[_0x18dc('0x18')][_0x18dc('0x17')]);}})['catch'](function(_0x22be35){logger[_0x18dc('0x14')](_0x18dc('0x16'),_0x2ac477,_0x22be35);_0x178236(_0x22be35);});});}exports['UpdateOpenchannelInteraction']=function(_0xfe69b0){var _0x54f409=this;return new Promise(function(_0x17a147,_0x5737c1){return db[_0x18dc('0x19')][_0x18dc('0x1a')](_0xfe69b0['body'],{'raw':_0xfe69b0[_0x18dc('0x1b')]?_0xfe69b0[_0x18dc('0x1b')][_0x18dc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfe69b0[_0x18dc('0x1b')]?_0xfe69b0[_0x18dc('0x1b')]['where']||null:null,'attributes':_0xfe69b0[_0x18dc('0x1b')]?_0xfe69b0[_0x18dc('0x1b')][_0x18dc('0x1d')]||null:null,'limit':_0xfe69b0[_0x18dc('0x1b')]?_0xfe69b0[_0x18dc('0x1b')][_0x18dc('0x1e')]||null:null})[_0x18dc('0x1f')](function(_0x27c927){logger[_0x18dc('0x10')](_0x18dc('0x20'),_0xfe69b0);logger[_0x18dc('0x12')](_0x18dc('0x20'),_0xfe69b0,JSON[_0x18dc('0x21')](_0x27c927));_0x17a147(_0x27c927);})['catch'](function(_0xe9b29d){logger[_0x18dc('0x14')](_0x18dc('0x20'),_0xe9b29d['message'],_0xfe69b0);_0x5737c1(_0x54f409[_0x18dc('0x14')](0x1f4,_0xe9b29d[_0x18dc('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x182bc9){return new Promise(function(_0x1fcb5d,_0xa01329){return db[_0x18dc('0x19')][_0x18dc('0x22')]({'where':_0x182bc9[_0x18dc('0x1b')]?_0x182bc9[_0x18dc('0x1b')]['where']||null:null})['then'](function(_0x536d5b){if(_0x536d5b){return _0x536d5b[_0x18dc('0x23')](_0x182bc9[_0x18dc('0x24')]['ids'],_['omit'](_0x182bc9[_0x18dc('0x24')],[_0x18dc('0x25'),'id'])||{});}})[_0x18dc('0x26')](function(_0x5b0bb2){logger[_0x18dc('0x10')](_0x18dc('0x27'),_0x182bc9);logger[_0x18dc('0x12')](_0x18dc('0x27'),_0x182bc9,JSON[_0x18dc('0x21')](_0x5b0bb2));_0x1fcb5d(_0x5b0bb2);})[_0x18dc('0x28')](function(_0x5643d7){logger[_0x18dc('0x14')]('AddTags',_0x5643d7[_0x18dc('0x17')],_0x182bc9);_0xa01329(_this[_0x18dc('0x14')](0x1f4,_0x5643d7['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 5478510..96efe78 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 _0x3dfc=['length','openchannelInteraction:','save','update','emit','register'];(function(_0x4b447c,_0x28cf8c){var _0x430307=function(_0xc0e121){while(--_0xc0e121){_0x4b447c['push'](_0x4b447c['shift']());}};_0x430307(++_0x28cf8c);}(_0x3dfc,0xb0));var _0xc3df=function(_0x26253d,_0x5dfc80){_0x26253d=_0x26253d-0x0;var _0x318a82=_0x3dfc[_0x26253d];return _0x318a82;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xc3df('0x0'),'remove',_0xc3df('0x1')];function createListener(_0x34375f,_0x401e76){return function(_0x4ddc66){_0x401e76[_0xc3df('0x2')](_0x34375f,_0x4ddc66);};}function removeListener(_0xbcacc2,_0x51b00c){return function(){OpenchannelInteractionEvents['removeListener'](_0xbcacc2,_0x51b00c);};}exports[_0xc3df('0x3')]=function(_0x2ab140){for(var _0xe05077=0x0,_0x4cf9f4=events[_0xc3df('0x4')];_0xe05077<_0x4cf9f4;_0xe05077++){var _0x318026=events[_0xe05077];var _0x4c8bb5=createListener(_0xc3df('0x5')+_0x318026,_0x2ab140);OpenchannelInteractionEvents['on'](_0x318026,_0x4c8bb5);}}; \ No newline at end of file +var _0xd529=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x417307,_0x21ebbf){var _0x2c21da=function(_0x5304ba){while(--_0x5304ba){_0x417307['push'](_0x417307['shift']());}};_0x2c21da(++_0x21ebbf);}(_0xd529,0xb8));var _0x9d52=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd529[_0x42cae2];return _0x5f256f;};'use strict';var OpenchannelInteractionEvents=require(_0x9d52('0x0'));var events=[_0x9d52('0x1'),_0x9d52('0x2'),_0x9d52('0x3')];function createListener(_0x448231,_0x1e503e){return function(_0xb75cee){_0x1e503e[_0x9d52('0x4')](_0x448231,_0xb75cee);};}function removeListener(_0x5a7b43,_0xd6d380){return function(){OpenchannelInteractionEvents[_0x9d52('0x5')](_0x5a7b43,_0xd6d380);};}exports[_0x9d52('0x6')]=function(_0x5cafab){for(var _0x29f280=0x0,_0x1f693c=events[_0x9d52('0x7')];_0x29f280<_0x1f693c;_0x29f280++){var _0x2d91c5=events[_0x29f280];var _0x4a34ca=createListener(_0x9d52('0x8')+_0x2d91c5,_0x5cafab);OpenchannelInteractionEvents['on'](_0x2d91c5,_0x4a34ca);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 15ffe18..4bc5574 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x45cef2,_0x42cc61){var _0x168349=function(_0x508822){while(--_0x508822){_0x45cef2['push'](_0x45cef2['shift']());}};_0x168349(++_0x42cc61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_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 ba224cf..a989679 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 _0x4c99=['sequelize','TEXT','ENUM','out','DATE','STRING'];(function(_0x5f4a1d,_0xba888c){var _0x3d5230=function(_0x478d6b){while(--_0x478d6b){_0x5f4a1d['push'](_0x5f4a1d['shift']());}};_0x3d5230(++_0xba888c);}(_0x4c99,0x1ec));var _0x94c9=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4c99[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x94c9('0x0'));module['exports']={'body':{'type':Sequelize[_0x94c9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x94c9('0x2')]('in',_0x94c9('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x94c9('0x4')]},'providerName':{'type':Sequelize[_0x94c9('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x235a=['exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x1190c2,_0x2c078b){var _0x6ec988=function(_0x333cdf){while(--_0x333cdf){_0x1190c2['push'](_0x1190c2['shift']());}};_0x6ec988(++_0x2c078b);}(_0x235a,0x1ef));var _0xa235=function(_0x33ab87,_0x9cb0be){_0x33ab87=_0x33ab87-0x0;var _0x178cea=_0x235a[_0x33ab87];return _0x178cea;};'use strict';var Sequelize=require(_0xa235('0x0'));module[_0xa235('0x1')]={'body':{'type':Sequelize[_0xa235('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa235('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa235('0x4')]('in',_0xa235('0x5')),'defaultValue':_0xa235('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa235('0x6')]},'providerName':{'type':Sequelize[_0xa235('0x7')]},'providerResponse':{'type':Sequelize[_0xa235('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e8f6206..4292c6e 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 _0xb9ef=['then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','status','undefined','limit','set','Content-Range','json','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','options','count','includeAll','include','findAll','show','params','find','create','body','describe','accept','openchannel','reject','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','interaction','get','info','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','interface','format','SIP/%s','channel','event','EventManager','rejectmessage','util','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','openchannel-interactions','request'];(function(_0x5cd8c2,_0x4bc8ee){var _0x4d2440=function(_0xd55420){while(--_0xd55420){_0x5cd8c2['push'](_0x5cd8c2['shift']());}};_0x4d2440(++_0x4bc8ee);}(_0xb9ef,0xb9));var _0xfb9e=function(_0x432f5d,_0xcee8a6){_0x432f5d=_0x432f5d-0x0;var _0x33bfe9=_0xb9ef[_0x432f5d];return _0x33bfe9;};'use strict';var util=require(_0xfb9e('0x0'));var _=require('lodash');var Redis=require('ioredis');var interactionService=require(_0xfb9e('0x1'));var qs=require(_0xfb9e('0x2'));var logger=require(_0xfb9e('0x3'))(_0xfb9e('0x4'));var config=require(_0xfb9e('0x5'));var db=require(_0xfb9e('0x6'))['db'];config[_0xfb9e('0x7')]=_[_0xfb9e('0x8')](config[_0xfb9e('0x7')],{'host':_0xfb9e('0x9'),'port':0x18eb});var socket=require(_0xfb9e('0xa'))(new Redis(config[_0xfb9e('0x7')]));require('./openchannelMessage.socket')[_0xfb9e('0xb')](socket);var jayson=require(_0xfb9e('0xc'));var client=jayson[_0xfb9e('0xd')][_0xfb9e('0xe')]({'port':0x232c});var client9002=jayson[_0xfb9e('0xd')][_0xfb9e('0xe')]({'port':0x232a});var interaction_log=require(_0xfb9e('0x3'))(_0xfb9e('0xf'));function respondWithRpcPromise(_0x506be4,_0xfd8516,_0x2f436f,_0x51586e){return new Promise(function(_0x42781f,_0x33077b){var _0x33c76f=_0x51586e||client;return _0x33c76f[_0xfb9e('0x10')](_0x506be4,_0x2f436f)[_0xfb9e('0x11')](function(_0x68b544){logger['info'](_0xfb9e('0x12'),_0xfd8516,_0xfb9e('0x13'));logger[_0xfb9e('0x14')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xfd8516,_0xfb9e('0x13'),JSON['stringify'](_0x68b544));if(_0x68b544['error']){if(_0x68b544['error'][_0xfb9e('0x15')]===0x1f4){logger['error'](_0xfb9e('0x12'),_0xfd8516,_0x68b544['error']['message']);return _0x33077b(_0x68b544[_0xfb9e('0x16')][_0xfb9e('0x17')]);}logger[_0xfb9e('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0xfd8516,_0x68b544[_0xfb9e('0x16')][_0xfb9e('0x17')]);return _0x42781f(_0x68b544['error'][_0xfb9e('0x17')]);}else{logger['info'](_0xfb9e('0x12'),_0xfd8516,_0xfb9e('0x13'));_0x42781f(_0x68b544[_0xfb9e('0x18')][_0xfb9e('0x17')]);}})[_0xfb9e('0x19')](function(_0x35b13f){logger[_0xfb9e('0x16')](_0xfb9e('0x12'),_0xfd8516,_0x35b13f);_0x33077b(_0x35b13f);});});}function respondWithResult(_0x2478d3,_0x3ce29a){_0x3ce29a=_0x3ce29a||0xc8;return function(_0x35f665){if(_0x35f665){return _0x2478d3[_0xfb9e('0x1a')](_0x3ce29a)['json'](_0x35f665);}};}function respondWithFilteredResult(_0x393fab,_0x437d86){return function(_0x34b7fb){if(_0x34b7fb){var _0x91465c=typeof _0x437d86['offset']===_0xfb9e('0x1b')&&typeof _0x437d86[_0xfb9e('0x1c')]===_0xfb9e('0x1b');var _0x5a3f18=_0x34b7fb['count'];var _0x442c64=_0x91465c?0x0:_0x437d86['offset'];var _0x41d1f3=_0x91465c?_0x34b7fb['count']:_0x437d86['offset']+_0x437d86['limit'];var _0x2a7f07;if(_0x41d1f3>=_0x5a3f18){_0x41d1f3=_0x5a3f18;_0x2a7f07=0xc8;}else{_0x2a7f07=0xce;}_0x393fab['status'](_0x2a7f07);return _0x393fab[_0xfb9e('0x1d')](_0xfb9e('0x1e'),_0x442c64+'-'+_0x41d1f3+'/'+_0x5a3f18)[_0xfb9e('0x1f')](_0x34b7fb);}return null;};}function saveUpdates(_0xef5123){return function(_0x4238a4){if(_0x4238a4){return _0x4238a4['update'](_0xef5123)['then'](function(_0x18e6aa){return _0x18e6aa;});}return null;};}function removeEntity(_0xc55239){return function(_0x5b9e1c){if(_0x5b9e1c){return _0x5b9e1c[_0xfb9e('0x20')]()[_0xfb9e('0x11')](function(){_0xc55239[_0xfb9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a085d){return function(_0x3936b6){if(!_0x3936b6){_0x5a085d[_0xfb9e('0x21')](0x194);}return _0x3936b6;};}function handleError(_0x3f6688,_0x9e854){_0x9e854=_0x9e854||0x1f4;return function(_0x5d4c97){logger[_0xfb9e('0x16')](_0x5d4c97[_0xfb9e('0x22')]);if(_0x5d4c97[_0xfb9e('0x23')]){delete _0x5d4c97['name'];}_0x3f6688['status'](_0x9e854)[_0xfb9e('0x24')](_0x5d4c97);};}exports[_0xfb9e('0x25')]=function(_0x2afd16,_0x5ddae6){var _0x31a204={},_0x14f3a6={},_0x5af026={'count':0x0,'rows':[]};var _0x172ced=_[_0xfb9e('0x26')](db[_0xfb9e('0x27')][_0xfb9e('0x28')],function(_0x467c6f){return{'name':_0x467c6f['fieldName'],'type':_0x467c6f[_0xfb9e('0x29')][_0xfb9e('0x2a')]};});_0x14f3a6[_0xfb9e('0x2b')]=_['map'](_0x172ced,_0xfb9e('0x23'));_0x14f3a6[_0xfb9e('0x2c')]=_[_0xfb9e('0x2d')](_0x2afd16[_0xfb9e('0x2c')]);_0x14f3a6[_0xfb9e('0x2e')]=_[_0xfb9e('0x2f')](_0x14f3a6[_0xfb9e('0x2b')],_0x14f3a6['query']);_0x31a204[_0xfb9e('0x30')]=_['intersection'](_0x14f3a6[_0xfb9e('0x2b')],qs[_0xfb9e('0x31')](_0x2afd16[_0xfb9e('0x2c')]['fields']));_0x31a204['attributes']=_0x31a204['attributes'][_0xfb9e('0x32')]?_0x31a204[_0xfb9e('0x30')]:_0x14f3a6['model'];if(!_0x2afd16[_0xfb9e('0x2c')][_0xfb9e('0x33')](_0xfb9e('0x34'))){_0x31a204[_0xfb9e('0x1c')]=qs['limit'](_0x2afd16[_0xfb9e('0x2c')][_0xfb9e('0x1c')]);_0x31a204[_0xfb9e('0x35')]=qs[_0xfb9e('0x35')](_0x2afd16[_0xfb9e('0x2c')][_0xfb9e('0x35')]);}_0x31a204[_0xfb9e('0x36')]=qs[_0xfb9e('0x37')](_0x2afd16[_0xfb9e('0x2c')][_0xfb9e('0x37')]);_0x31a204[_0xfb9e('0x38')]=qs[_0xfb9e('0x2e')](_['pick'](_0x2afd16[_0xfb9e('0x2c')],_0x14f3a6[_0xfb9e('0x2e')]),_0x172ced);if(_0x2afd16[_0xfb9e('0x2c')][_0xfb9e('0x39')]){_0x31a204['where']=_[_0xfb9e('0x3a')](_0x31a204[_0xfb9e('0x38')],{'$or':_['map'](_0x172ced,function(_0x520056){if(_0x520056[_0xfb9e('0x29')]!=='VIRTUAL'){var _0xb05404={};_0xb05404[_0x520056[_0xfb9e('0x23')]]={'$like':'%'+_0x2afd16[_0xfb9e('0x2c')]['filter']+'%'};return _0xb05404;}})});}_0x31a204=_[_0xfb9e('0x3a')]({},_0x31a204,_0x2afd16[_0xfb9e('0x3b')]);var _0x25ab24={'where':_0x31a204[_0xfb9e('0x38')]};return db[_0xfb9e('0x27')][_0xfb9e('0x3c')](_0x25ab24)[_0xfb9e('0x11')](function(_0x282076){_0x5af026[_0xfb9e('0x3c')]=_0x282076;if(_0x2afd16[_0xfb9e('0x2c')][_0xfb9e('0x3d')]){_0x31a204[_0xfb9e('0x3e')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xfb9e('0x3f')](_0x31a204);})[_0xfb9e('0x11')](function(_0x4eff2c){_0x5af026['rows']=_0x4eff2c;return _0x5af026;})[_0xfb9e('0x11')](respondWithFilteredResult(_0x5ddae6,_0x31a204))[_0xfb9e('0x19')](handleError(_0x5ddae6,null));};exports[_0xfb9e('0x40')]=function(_0x45394c,_0x43cce5){var _0x230e8e={'raw':!![],'where':{'id':_0x45394c[_0xfb9e('0x41')]['id']}},_0x5832af={};_0x5832af[_0xfb9e('0x2b')]=_[_0xfb9e('0x2d')](db['OpenchannelMessage']['rawAttributes']);_0x5832af[_0xfb9e('0x2c')]=_['keys'](_0x45394c['query']);_0x5832af[_0xfb9e('0x2e')]=_[_0xfb9e('0x2f')](_0x5832af[_0xfb9e('0x2b')],_0x5832af[_0xfb9e('0x2c')]);_0x230e8e[_0xfb9e('0x30')]=_['intersection'](_0x5832af['model'],qs[_0xfb9e('0x31')](_0x45394c[_0xfb9e('0x2c')][_0xfb9e('0x31')]));_0x230e8e['attributes']=_0x230e8e['attributes'][_0xfb9e('0x32')]?_0x230e8e[_0xfb9e('0x30')]:_0x5832af['model'];if(_0x45394c[_0xfb9e('0x2c')][_0xfb9e('0x3d')]){_0x230e8e[_0xfb9e('0x3e')]=[{'all':!![]}];}_0x230e8e=_[_0xfb9e('0x3a')]({},_0x230e8e,_0x45394c[_0xfb9e('0x3b')]);return db[_0xfb9e('0x27')][_0xfb9e('0x42')](_0x230e8e)[_0xfb9e('0x11')](handleEntityNotFound(_0x43cce5,null))[_0xfb9e('0x11')](respondWithResult(_0x43cce5,null))[_0xfb9e('0x19')](handleError(_0x43cce5,null));};exports[_0xfb9e('0x43')]=function(_0x194256,_0x30be54){return db[_0xfb9e('0x27')][_0xfb9e('0x43')](_0x194256[_0xfb9e('0x44')],{})[_0xfb9e('0x11')](respondWithResult(_0x30be54,0xc9))[_0xfb9e('0x19')](handleError(_0x30be54,null));};exports['update']=function(_0xa045f5,_0xc4b56){if(_0xa045f5['body']['id']){delete _0xa045f5['body']['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0xa045f5[_0xfb9e('0x41')]['id']}})['then'](handleEntityNotFound(_0xc4b56,null))[_0xfb9e('0x11')](saveUpdates(_0xa045f5[_0xfb9e('0x44')],null))[_0xfb9e('0x11')](respondWithResult(_0xc4b56,null))[_0xfb9e('0x19')](handleError(_0xc4b56,null));};exports[_0xfb9e('0x20')]=function(_0x52f765,_0x2f7e2c){return db[_0xfb9e('0x27')][_0xfb9e('0x42')]({'where':{'id':_0x52f765['params']['id']}})[_0xfb9e('0x11')](handleEntityNotFound(_0x2f7e2c,null))[_0xfb9e('0x11')](removeEntity(_0x2f7e2c,null))[_0xfb9e('0x19')](handleError(_0x2f7e2c,null));};exports[_0xfb9e('0x45')]=function(_0x23955d,_0x28c8b7){return db[_0xfb9e('0x27')][_0xfb9e('0x45')]()[_0xfb9e('0x11')](respondWithResult(_0x28c8b7,null))[_0xfb9e('0x19')](handleError(_0x28c8b7,null));};exports[_0xfb9e('0x46')]=function(_0x446b24,_0x3a8235){var _0x575c4f=_0xfb9e('0x47');return interactionService['acceptMessage'](_0x446b24,_0x575c4f)[_0xfb9e('0x11')](respondWithResult(_0x3a8235,null))[_0xfb9e('0x19')](handleError(_0x3a8235,null));};exports[_0xfb9e('0x48')]=function(_0x356e68,_0x6c604a){var _0x46ba23={'agent':{},'channel':_0xfb9e('0x47')};if(_0x356e68[_0xfb9e('0x44')]['id']){delete _0x356e68['body']['id'];}_0x356e68['body'][_0xfb9e('0x49')]=_0x356e68[_0xfb9e('0x44')][_0xfb9e('0x49')]||_0x356e68[_0xfb9e('0x4a')]['id'];_0x46ba23[_0xfb9e('0x4b')]['id']=_0x356e68[_0xfb9e('0x44')]['UserId'];return db[_0xfb9e('0x27')][_0xfb9e('0x42')]({'where':{'id':_0x356e68[_0xfb9e('0x41')]['id'],'UserId':null}})[_0xfb9e('0x11')](handleEntityNotFound(_0x6c604a,null))[_0xfb9e('0x11')](function(_0x5d0a94){if(_0x5d0a94){_0x46ba23[_0xfb9e('0x17')]=_0x5d0a94['get']({'plain':!![]});return db[_0xfb9e('0x4c')][_0xfb9e('0x42')]({'where':{'id':_0x5d0a94[_0xfb9e('0x4d')]}});}return null;})[_0xfb9e('0x11')](handleEntityNotFound(_0x6c604a,null))[_0xfb9e('0x11')](function(_0x467432){if(_0x467432){_0x46ba23[_0xfb9e('0x4e')]=_0x467432[_0xfb9e('0x4f')]({'plain':!![]});interaction_log[_0xfb9e('0x50')](_0xfb9e('0x51'),_0x356e68[_0xfb9e('0x4a')]['id'],_0x356e68[_0xfb9e('0x4a')][_0xfb9e('0x23')],_0x356e68['user'][_0xfb9e('0x52')],_0x46ba23[_0xfb9e('0x4e')]['id'],_0x356e68['body']?JSON[_0xfb9e('0x53')](_0x356e68[_0xfb9e('0x44')]):'null');return respondWithRpcPromise(_0xfb9e('0x54'),'rejectMessage',_0x46ba23);}return null;})[_0xfb9e('0x11')](function(_0x53c6ad){var _0x4c9c11=_0xfb9e('0x55')+_0x53c6ad[_0xfb9e('0x17')][_0xfb9e('0x56')];return db[_0xfb9e('0x57')][_0xfb9e('0x2c')](_0x4c9c11,{'type':db[_0xfb9e('0x58')][_0xfb9e('0x59')][_0xfb9e('0x5a')],'raw':!![]})[_0xfb9e('0x11')](function(_0x2a2423){return _0x2a2423;});})[_0xfb9e('0x11')](function(_0x46aeb7){if(_0x46aeb7){_0x46ba23[_0xfb9e('0x17')]['contact']=_0x46aeb7[0x0];if(!_0x356e68[_0xfb9e('0x44')][_0xfb9e('0x49')])return;return db[_0xfb9e('0x5b')][_0xfb9e('0x42')]({'where':{'id':_0x356e68[_0xfb9e('0x44')][_0xfb9e('0x49')],'role':_0xfb9e('0x4b')},'attributes':['id',_0xfb9e('0x23'),_0xfb9e('0x5c'),'email',_0xfb9e('0x5d')],'raw':!![]});}return null;})[_0xfb9e('0x11')](function(_0x531153){if(!_0x531153)return null;_0x46ba23[_0xfb9e('0x17')]['agent']=_0x531153;return _0x46ba23;})['then'](function(_0x2aebab){if(_0x2aebab){_0x2aebab[_0xfb9e('0x17')][_0xfb9e('0x5e')]=util[_0xfb9e('0x5f')](_0xfb9e('0x60'),_0x356e68[_0xfb9e('0x4a')][_0xfb9e('0x23')]);_0x2aebab[_0xfb9e('0x17')]['channel']=_0x46ba23[_0xfb9e('0x61')];_0x2aebab['message']['motionChannel']=_0x46ba23[_0xfb9e('0x61')];_0x2aebab[_0xfb9e('0x17')][_0xfb9e('0x62')]='reject';respondWithRpcPromise(_0xfb9e('0x63'),_0xfb9e('0x63'),{'event':_0xfb9e('0x64'),'message':_0x2aebab[_0xfb9e('0x17')]},client9002);return _0x46ba23;}return null;})[_0xfb9e('0x11')](respondWithResult(_0x6c604a,null))['catch'](handleError(_0x6c604a,null));}; \ No newline at end of file +var _0xd653=['../../components/interaction/service','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','openchannel-interactions','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','undefined','count','offset','limit','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','index','map','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','OpenchannelMessage','include','findAll','rows','show','params','includeAll','options','find','create','body','describe','accept','openchannel','acceptMessage','reject','UserId','user','get','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','agent','email','interface','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','util','lodash','ioredis'];(function(_0x65a640,_0x547d73){var _0xbe0a82=function(_0x2f0ef5){while(--_0x2f0ef5){_0x65a640['push'](_0x65a640['shift']());}};_0xbe0a82(++_0x547d73);}(_0xd653,0x18d));var _0x3d65=function(_0x38e860,_0x47ce0f){_0x38e860=_0x38e860-0x0;var _0x37b5fe=_0xd653[_0x38e860];return _0x37b5fe;};'use strict';var util=require(_0x3d65('0x0'));var _=require(_0x3d65('0x1'));var Redis=require(_0x3d65('0x2'));var interactionService=require(_0x3d65('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x3d65('0x4'))(_0x3d65('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x3d65('0x6')]=_[_0x3d65('0x7')](config[_0x3d65('0x6')],{'host':_0x3d65('0x8'),'port':0x18eb});var socket=require(_0x3d65('0x9'))(new Redis(config[_0x3d65('0x6')]));require('./openchannelMessage.socket')[_0x3d65('0xa')](socket);var jayson=require(_0x3d65('0xb'));var client=jayson[_0x3d65('0xc')][_0x3d65('0xd')]({'port':0x232c});var client9002=jayson['client'][_0x3d65('0xd')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x3d65('0xe'));function respondWithRpcPromise(_0x5e814c,_0x252272,_0x179c6d,_0x70585c){return new Promise(function(_0x59d9f6,_0x542052){var _0x50af39=_0x70585c||client;return _0x50af39[_0x3d65('0xf')](_0x5e814c,_0x179c6d)[_0x3d65('0x10')](function(_0x587ff0){logger[_0x3d65('0x11')](_0x3d65('0x12'),_0x252272,_0x3d65('0x13'));logger[_0x3d65('0x14')](_0x3d65('0x15'),_0x252272,'request\x20sent',JSON[_0x3d65('0x16')](_0x587ff0));if(_0x587ff0[_0x3d65('0x17')]){if(_0x587ff0[_0x3d65('0x17')][_0x3d65('0x18')]===0x1f4){logger[_0x3d65('0x17')](_0x3d65('0x12'),_0x252272,_0x587ff0[_0x3d65('0x17')]['message']);return _0x542052(_0x587ff0[_0x3d65('0x17')]['message']);}logger['error'](_0x3d65('0x12'),_0x252272,_0x587ff0[_0x3d65('0x17')][_0x3d65('0x19')]);return _0x59d9f6(_0x587ff0[_0x3d65('0x17')][_0x3d65('0x19')]);}else{logger[_0x3d65('0x11')](_0x3d65('0x12'),_0x252272,_0x3d65('0x13'));_0x59d9f6(_0x587ff0['result'][_0x3d65('0x19')]);}})[_0x3d65('0x1a')](function(_0x30a450){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x252272,_0x30a450);_0x542052(_0x30a450);});});}function respondWithResult(_0x1c59de,_0x33ec66){_0x33ec66=_0x33ec66||0xc8;return function(_0x53656a){if(_0x53656a){return _0x1c59de[_0x3d65('0x1b')](_0x33ec66)['json'](_0x53656a);}};}function respondWithFilteredResult(_0x47e1f0,_0x213f6b){return function(_0xfcff9e){if(_0xfcff9e){var _0x549a3d=typeof _0x213f6b['offset']===_0x3d65('0x1c')&&typeof _0x213f6b['limit']===_0x3d65('0x1c');var _0x5848bc=_0xfcff9e[_0x3d65('0x1d')];var _0x211d29=_0x549a3d?0x0:_0x213f6b[_0x3d65('0x1e')];var _0x1f66e5=_0x549a3d?_0xfcff9e['count']:_0x213f6b['offset']+_0x213f6b[_0x3d65('0x1f')];var _0x40ab56;if(_0x1f66e5>=_0x5848bc){_0x1f66e5=_0x5848bc;_0x40ab56=0xc8;}else{_0x40ab56=0xce;}_0x47e1f0[_0x3d65('0x1b')](_0x40ab56);return _0x47e1f0[_0x3d65('0x20')](_0x3d65('0x21'),_0x211d29+'-'+_0x1f66e5+'/'+_0x5848bc)[_0x3d65('0x22')](_0xfcff9e);}return null;};}function saveUpdates(_0x489953){return function(_0x5777d0){if(_0x5777d0){return _0x5777d0[_0x3d65('0x23')](_0x489953)['then'](function(_0x13d517){return _0x13d517;});}return null;};}function removeEntity(_0x54c19f){return function(_0x9da226){if(_0x9da226){return _0x9da226[_0x3d65('0x24')]()[_0x3d65('0x10')](function(){_0x54c19f[_0x3d65('0x1b')](0xcc)[_0x3d65('0x25')]();});}};}function handleEntityNotFound(_0x4ba421){return function(_0x442151){if(!_0x442151){_0x4ba421[_0x3d65('0x26')](0x194);}return _0x442151;};}function handleError(_0x3bb0f5,_0x5c66e0){_0x5c66e0=_0x5c66e0||0x1f4;return function(_0x5a0cd2){logger[_0x3d65('0x17')](_0x5a0cd2[_0x3d65('0x27')]);if(_0x5a0cd2[_0x3d65('0x28')]){delete _0x5a0cd2[_0x3d65('0x28')];}_0x3bb0f5[_0x3d65('0x1b')](_0x5c66e0)['send'](_0x5a0cd2);};}exports[_0x3d65('0x29')]=function(_0x5bfe57,_0x252310){var _0x5d0c96={},_0x232034={},_0x1e7ebf={'count':0x0,'rows':[]};var _0x22bd2e=_[_0x3d65('0x2a')](db['OpenchannelMessage']['rawAttributes'],function(_0x139258){return{'name':_0x139258[_0x3d65('0x2b')],'type':_0x139258[_0x3d65('0x2c')]['key']};});_0x232034[_0x3d65('0x2d')]=_[_0x3d65('0x2a')](_0x22bd2e,_0x3d65('0x28'));_0x232034[_0x3d65('0x2e')]=_[_0x3d65('0x2f')](_0x5bfe57['query']);_0x232034['filters']=_['intersection'](_0x232034[_0x3d65('0x2d')],_0x232034[_0x3d65('0x2e')]);_0x5d0c96[_0x3d65('0x30')]=_[_0x3d65('0x31')](_0x232034['model'],qs[_0x3d65('0x32')](_0x5bfe57[_0x3d65('0x2e')][_0x3d65('0x32')]));_0x5d0c96[_0x3d65('0x30')]=_0x5d0c96['attributes'][_0x3d65('0x33')]?_0x5d0c96[_0x3d65('0x30')]:_0x232034[_0x3d65('0x2d')];if(!_0x5bfe57[_0x3d65('0x2e')][_0x3d65('0x34')]('nolimit')){_0x5d0c96['limit']=qs[_0x3d65('0x1f')](_0x5bfe57['query']['limit']);_0x5d0c96[_0x3d65('0x1e')]=qs[_0x3d65('0x1e')](_0x5bfe57['query']['offset']);}_0x5d0c96[_0x3d65('0x35')]=qs[_0x3d65('0x36')](_0x5bfe57[_0x3d65('0x2e')][_0x3d65('0x36')]);_0x5d0c96[_0x3d65('0x37')]=qs[_0x3d65('0x38')](_['pick'](_0x5bfe57[_0x3d65('0x2e')],_0x232034[_0x3d65('0x38')]),_0x22bd2e);if(_0x5bfe57[_0x3d65('0x2e')][_0x3d65('0x39')]){_0x5d0c96[_0x3d65('0x37')]=_[_0x3d65('0x3a')](_0x5d0c96[_0x3d65('0x37')],{'$or':_[_0x3d65('0x2a')](_0x22bd2e,function(_0x3d309c){if(_0x3d309c[_0x3d65('0x2c')]!==_0x3d65('0x3b')){var _0x36cdb5={};_0x36cdb5[_0x3d309c[_0x3d65('0x28')]]={'$like':'%'+_0x5bfe57[_0x3d65('0x2e')][_0x3d65('0x39')]+'%'};return _0x36cdb5;}})});}_0x5d0c96=_[_0x3d65('0x3a')]({},_0x5d0c96,_0x5bfe57['options']);var _0x438fa7={'where':_0x5d0c96[_0x3d65('0x37')]};return db[_0x3d65('0x3c')][_0x3d65('0x1d')](_0x438fa7)[_0x3d65('0x10')](function(_0x3535b2){_0x1e7ebf[_0x3d65('0x1d')]=_0x3535b2;if(_0x5bfe57[_0x3d65('0x2e')]['includeAll']){_0x5d0c96[_0x3d65('0x3d')]=[{'all':!![]}];}return db[_0x3d65('0x3c')][_0x3d65('0x3e')](_0x5d0c96);})['then'](function(_0x53b69a){_0x1e7ebf[_0x3d65('0x3f')]=_0x53b69a;return _0x1e7ebf;})[_0x3d65('0x10')](respondWithFilteredResult(_0x252310,_0x5d0c96))[_0x3d65('0x1a')](handleError(_0x252310,null));};exports[_0x3d65('0x40')]=function(_0xd98214,_0x517ae5){var _0x385e9e={'raw':!![],'where':{'id':_0xd98214[_0x3d65('0x41')]['id']}},_0x483aa7={};_0x483aa7[_0x3d65('0x2d')]=_[_0x3d65('0x2f')](db['OpenchannelMessage']['rawAttributes']);_0x483aa7[_0x3d65('0x2e')]=_[_0x3d65('0x2f')](_0xd98214[_0x3d65('0x2e')]);_0x483aa7[_0x3d65('0x38')]=_[_0x3d65('0x31')](_0x483aa7[_0x3d65('0x2d')],_0x483aa7[_0x3d65('0x2e')]);_0x385e9e['attributes']=_['intersection'](_0x483aa7[_0x3d65('0x2d')],qs[_0x3d65('0x32')](_0xd98214[_0x3d65('0x2e')][_0x3d65('0x32')]));_0x385e9e[_0x3d65('0x30')]=_0x385e9e['attributes'][_0x3d65('0x33')]?_0x385e9e[_0x3d65('0x30')]:_0x483aa7[_0x3d65('0x2d')];if(_0xd98214[_0x3d65('0x2e')][_0x3d65('0x42')]){_0x385e9e[_0x3d65('0x3d')]=[{'all':!![]}];}_0x385e9e=_[_0x3d65('0x3a')]({},_0x385e9e,_0xd98214[_0x3d65('0x43')]);return db[_0x3d65('0x3c')][_0x3d65('0x44')](_0x385e9e)['then'](handleEntityNotFound(_0x517ae5,null))['then'](respondWithResult(_0x517ae5,null))['catch'](handleError(_0x517ae5,null));};exports[_0x3d65('0x45')]=function(_0x1600fd,_0x1412c3){return db[_0x3d65('0x3c')][_0x3d65('0x45')](_0x1600fd[_0x3d65('0x46')],{})['then'](respondWithResult(_0x1412c3,0xc9))[_0x3d65('0x1a')](handleError(_0x1412c3,null));};exports[_0x3d65('0x23')]=function(_0x8d728b,_0x34c322){if(_0x8d728b[_0x3d65('0x46')]['id']){delete _0x8d728b[_0x3d65('0x46')]['id'];}return db[_0x3d65('0x3c')][_0x3d65('0x44')]({'where':{'id':_0x8d728b[_0x3d65('0x41')]['id']}})[_0x3d65('0x10')](handleEntityNotFound(_0x34c322,null))[_0x3d65('0x10')](saveUpdates(_0x8d728b['body'],null))[_0x3d65('0x10')](respondWithResult(_0x34c322,null))[_0x3d65('0x1a')](handleError(_0x34c322,null));};exports['destroy']=function(_0x154e56,_0x8c8dd3){return db[_0x3d65('0x3c')][_0x3d65('0x44')]({'where':{'id':_0x154e56[_0x3d65('0x41')]['id']}})[_0x3d65('0x10')](handleEntityNotFound(_0x8c8dd3,null))[_0x3d65('0x10')](removeEntity(_0x8c8dd3,null))[_0x3d65('0x1a')](handleError(_0x8c8dd3,null));};exports[_0x3d65('0x47')]=function(_0x491892,_0x450772){return db[_0x3d65('0x3c')][_0x3d65('0x47')]()[_0x3d65('0x10')](respondWithResult(_0x450772,null))[_0x3d65('0x1a')](handleError(_0x450772,null));};exports[_0x3d65('0x48')]=function(_0x10ea9c,_0x532d31){var _0x2e3eba=_0x3d65('0x49');return interactionService[_0x3d65('0x4a')](_0x10ea9c,_0x2e3eba)[_0x3d65('0x10')](respondWithResult(_0x532d31,null))[_0x3d65('0x1a')](handleError(_0x532d31,null));};exports[_0x3d65('0x4b')]=function(_0x22fb6d,_0x26ddd5){var _0x2fa31c={'agent':{},'channel':'openchannel'};if(_0x22fb6d[_0x3d65('0x46')]['id']){delete _0x22fb6d[_0x3d65('0x46')]['id'];}_0x22fb6d[_0x3d65('0x46')][_0x3d65('0x4c')]=_0x22fb6d[_0x3d65('0x46')]['UserId']||_0x22fb6d[_0x3d65('0x4d')]['id'];_0x2fa31c['agent']['id']=_0x22fb6d['body'][_0x3d65('0x4c')];return db[_0x3d65('0x3c')][_0x3d65('0x44')]({'where':{'id':_0x22fb6d[_0x3d65('0x41')]['id'],'UserId':null}})[_0x3d65('0x10')](handleEntityNotFound(_0x26ddd5,null))[_0x3d65('0x10')](function(_0x59ec71){if(_0x59ec71){_0x2fa31c[_0x3d65('0x19')]=_0x59ec71[_0x3d65('0x4e')]({'plain':!![]});return db['OpenchannelInteraction'][_0x3d65('0x44')]({'where':{'id':_0x59ec71[_0x3d65('0x4f')]}});}return null;})[_0x3d65('0x10')](handleEntityNotFound(_0x26ddd5,null))[_0x3d65('0x10')](function(_0x48f748){if(_0x48f748){_0x2fa31c['interaction']=_0x48f748[_0x3d65('0x4e')]({'plain':!![]});interaction_log['info'](_0x3d65('0x50'),_0x22fb6d[_0x3d65('0x4d')]['id'],_0x22fb6d[_0x3d65('0x4d')][_0x3d65('0x28')],_0x22fb6d[_0x3d65('0x4d')][_0x3d65('0x51')],_0x2fa31c['interaction']['id'],_0x22fb6d[_0x3d65('0x46')]?JSON[_0x3d65('0x16')](_0x22fb6d[_0x3d65('0x46')]):_0x3d65('0x52'));return respondWithRpcPromise(_0x3d65('0x53'),_0x3d65('0x54'),_0x2fa31c);}return null;})['then'](function(_0x3f3223){var _0x21bdc4=_0x3d65('0x55')+_0x3f3223['message']['ContactId'];return db[_0x3d65('0x56')][_0x3d65('0x2e')](_0x21bdc4,{'type':db[_0x3d65('0x57')]['QueryTypes'][_0x3d65('0x58')],'raw':!![]})['then'](function(_0x26bf1c){return _0x26bf1c;});})[_0x3d65('0x10')](function(_0x467a3a){if(_0x467a3a){_0x2fa31c['message'][_0x3d65('0x59')]=_0x467a3a[0x0];if(!_0x22fb6d[_0x3d65('0x46')][_0x3d65('0x4c')])return;return db[_0x3d65('0x5a')][_0x3d65('0x44')]({'where':{'id':_0x22fb6d[_0x3d65('0x46')][_0x3d65('0x4c')],'role':_0x3d65('0x5b')},'attributes':['id','name','fullname',_0x3d65('0x5c'),'internal'],'raw':!![]});}return null;})[_0x3d65('0x10')](function(_0x17de36){if(!_0x17de36)return null;_0x2fa31c['message'][_0x3d65('0x5b')]=_0x17de36;return _0x2fa31c;})['then'](function(_0x3f4a0e){if(_0x3f4a0e){_0x3f4a0e[_0x3d65('0x19')][_0x3d65('0x5d')]=util['format'](_0x3d65('0x5e'),_0x22fb6d[_0x3d65('0x4d')][_0x3d65('0x28')]);_0x3f4a0e['message'][_0x3d65('0x5f')]=_0x2fa31c['channel'];_0x3f4a0e[_0x3d65('0x19')][_0x3d65('0x60')]=_0x2fa31c[_0x3d65('0x5f')];_0x3f4a0e[_0x3d65('0x19')][_0x3d65('0x61')]=_0x3d65('0x4b');respondWithRpcPromise(_0x3d65('0x62'),_0x3d65('0x62'),{'event':_0x3d65('0x63'),'message':_0x3f4a0e[_0x3d65('0x19')]},client9002);return _0x2fa31c;}return null;})[_0x3d65('0x10')](respondWithResult(_0x26ddd5,null))[_0x3d65('0x1a')](handleError(_0x26ddd5,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index af7ba8c..9d5a357 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 _0x635f=['save','update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x4c4ea4,_0xb586d){var _0x57d966=function(_0x15dda6){while(--_0x15dda6){_0x4c4ea4['push'](_0x4c4ea4['shift']());}};_0x57d966(++_0xb586d);}(_0x635f,0x7e));var _0xf635=function(_0x566df8,_0x29d8c8){_0x566df8=_0x566df8-0x0;var _0x5fd1c6=_0x635f[_0x566df8];return _0x5fd1c6;};'use strict';var EventEmitter=require(_0xf635('0x0'));var OpenchannelMessage=require(_0xf635('0x1'))['db'][_0xf635('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf635('0x3')](0x0);var events={'afterCreate':_0xf635('0x4'),'afterUpdate':_0xf635('0x5'),'afterDestroy':_0xf635('0x6')};function emitEvent(_0x588ec6){return function(_0x11eb60,_0x893851,_0x3147d4){OpenchannelMessageEvents[_0xf635('0x7')](_0x588ec6+':'+_0x11eb60['id'],_0x11eb60);OpenchannelMessageEvents[_0xf635('0x7')](_0x588ec6,_0x11eb60);_0x3147d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xf635('0x8')](e,emitEvent(event));}}module[_0xf635('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x0a6a=['OpenchannelMessage','setMaxListeners','update','remove','emit','hook','events','../../mysqldb'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0x0a6a,0x96));var _0xa0a6=function(_0x247a5e,_0x40b75d){_0x247a5e=_0x247a5e-0x0;var _0x16e004=_0x0a6a[_0x247a5e];return _0x16e004;};'use strict';var EventEmitter=require(_0xa0a6('0x0'));var OpenchannelMessage=require(_0xa0a6('0x1'))['db'][_0xa0a6('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa0a6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0a6('0x4'),'afterDestroy':_0xa0a6('0x5')};function emitEvent(_0x2d1afe){return function(_0x2fc04e,_0x1cf605,_0x463f68){OpenchannelMessageEvents[_0xa0a6('0x6')](_0x2d1afe+':'+_0x2fc04e['id'],_0x2fc04e);OpenchannelMessageEvents[_0xa0a6('0x6')](_0x2d1afe,_0x2fc04e);_0x463f68(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xa0a6('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 26ffd04..8396a8f 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 _0x3ef0=['direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','OpenchannelAccount','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','afterCreate','format','length','Interaction','omit','POST','method','body','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelMessage,\x20%s,\x20%s','inspect','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','fti_openchannel_messages','FULLTEXT','models','get'];(function(_0x410c9f,_0x1c464a){var _0xfc4322=function(_0x42e52c){while(--_0x42e52c){_0x410c9f['push'](_0x410c9f['shift']());}};_0xfc4322(++_0x1c464a);}(_0x3ef0,0xd9));var _0x03ef=function(_0x3dbd7e,_0x551437){_0x3dbd7e=_0x3dbd7e-0x0;var _0x234877=_0x3ef0[_0x3dbd7e];return _0x234877;};'use strict';var _=require(_0x03ef('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x03ef('0x1'));var BPromise=require(_0x03ef('0x2'));var rp=require(_0x03ef('0x3'));var fs=require('fs');var path=require(_0x03ef('0x4'));var rimraf=require(_0x03ef('0x5'));var config=require(_0x03ef('0x6'));var attributes=require(_0x03ef('0x7'));module[_0x03ef('0x8')]=function(_0x2ed11b,_0x5687a8){return _0x2ed11b['define']('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x03ef('0x9'),'fields':['body'],'type':_0x03ef('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x472c57,_0x6c3fdb,_0x1f1322){var _0x2f3a03=_0x2ed11b[_0x03ef('0xb')];var _0x1da1c7=_0x472c57[_0x03ef('0xc')]({'plain':!![]});if(_0x1da1c7[_0x03ef('0xd')][_0x03ef('0xe')]()==='in'||_0x1da1c7['direction']['toLowerCase']()===_0x03ef('0xf')&&!_0x1da1c7[_0x03ef('0x10')]&&!_['isNil'](_0x1da1c7[_0x03ef('0x11')])){_0x2f3a03[_0x03ef('0x12')]['findOne']({'where':{'id':_0x1da1c7[_0x03ef('0x13')]}})[_0x03ef('0x14')](function(_0x5a198d){if(_0x5a198d){_0x5a198d[_0x03ef('0x15')]({'lastMsgAt':_0x1da1c7[_0x03ef('0x16')],'lastMsgDirection':_0x1da1c7['direction'][_0x03ef('0xe')]()});}})[_0x03ef('0x17')](function(_0x35fc88){console[_0x03ef('0x18')](_0x35fc88);});}if(_0x1da1c7[_0x03ef('0xd')]===_0x03ef('0xf')&&!_0x1da1c7[_0x03ef('0x10')]){var _0x1cb588;_0x2f3a03['CmContact']['describe']()[_0x03ef('0x14')](function(_0x5a0171){return _0x2f3a03[_0x03ef('0x19')]['find']({'where':{'id':_0x1da1c7[_0x03ef('0x1a')]},'include':[{'model':_0x2f3a03[_0x03ef('0x12')],'as':_0x03ef('0x1b'),'where':{'id':_0x1da1c7[_0x03ef('0x13')]},'limit':0x1,'include':[{'model':_0x2f3a03[_0x03ef('0x1c')],'as':_0x03ef('0x1d'),'attributes':_[_0x03ef('0x1e')](_0x5a0171)}]}]});})[_0x03ef('0x14')](function(_0x4cb9de){_0x1cb588=_0x4cb9de['get']({'plain':!![]});if(_0x1cb588&&_0x1cb588[_0x03ef('0x1f')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x03ef('0x20'),util[_0x03ef('0x21')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x1da1c7['id'],_0x1cb588['replyUri']));if(_0x1cb588[_0x03ef('0x1b')]&&_0x1cb588[_0x03ef('0x1b')][_0x03ef('0x22')]){_0x1da1c7[_0x03ef('0x23')]=_[_0x03ef('0x24')](_0x1cb588[_0x03ef('0x1b')][0x0],_0x03ef('0x1d'));_0x1da1c7[_0x03ef('0x1d')]=_0x1cb588['Interactions'][0x0]['Contact'];}var _0x6c3fdb={'method':_0x03ef('0x25'),'uri':encodeURI(_0x1cb588[_0x03ef('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x6c3fdb[_0x03ef('0x26')]){case'GET':_0x6c3fdb['qs']=_0x1da1c7;break;case _0x03ef('0x25'):_0x6c3fdb[_0x03ef('0x27')]=_0x1da1c7;break;}return rp(_0x6c3fdb)[_0x03ef('0x14')](function(_0xfc1841){logger[_0x03ef('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x03ef('0x20'),util[_0x03ef('0x21')](_0x03ef('0x29'),_0x1da1c7['id'],_0x1cb588[_0x03ef('0x1f')]));if(_0xfc1841[_0x03ef('0x27')][_0x03ef('0x2a')]&&_0xfc1841[_0x03ef('0x27')][_0x03ef('0x2a')]!=_0x1da1c7['Interaction']['threadId']){return _0x2f3a03[_0x03ef('0x12')][_0x03ef('0x15')]({'threadId':_0xfc1841[_0x03ef('0x27')]['threadId']},{'where':{'id':_0x1da1c7['Interaction']['id']}});}else{return;}})[_0x03ef('0x14')](function(){return _0x472c57['update']({'read':!![]});})[_0x03ef('0x17')](function(_0x55a2ee){logger[_0x03ef('0x18')](_0x03ef('0x2b'),_0x03ef('0x20'),util[_0x03ef('0x2c')](_0x55a2ee,{'showHidden':![],'depth':null}));_0x1f1322();});}else{_0x1f1322();}})['finally'](function(){_0x1f1322();});}else{_0x1f1322();}}},'charset':'utf8mb4','collate':_0x03ef('0x2d')});}; \ No newline at end of file +var _0x6c6f=['find','OpenchannelAccountId','Interactions','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','Contact','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','error','secret','CmContact','then','OpenchannelAccount'];(function(_0x25b40d,_0x3d8e6c){var _0x25adab=function(_0x44de2b){while(--_0x44de2b){_0x25b40d['push'](_0x25b40d['shift']());}};_0x25adab(++_0x3d8e6c);}(_0x6c6f,0x7e));var _0xf6c6=function(_0x2d2a02,_0x15d58d){_0x2d2a02=_0x2d2a02-0x0;var _0x34bd58=_0x6c6f[_0x2d2a02];return _0x34bd58;};'use strict';var _=require(_0xf6c6('0x0'));var util=require('util');var logger=require(_0xf6c6('0x1'))(_0xf6c6('0x2'));var moment=require('moment');var BPromise=require(_0xf6c6('0x3'));var rp=require(_0xf6c6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6c6('0x5'));var config=require('../../config/environment');var attributes=require(_0xf6c6('0x6'));module[_0xf6c6('0x7')]=function(_0x545a49,_0x38bda8){return _0x545a49[_0xf6c6('0x8')](_0xf6c6('0x9'),attributes,{'tableName':_0xf6c6('0xa'),'paranoid':![],'indexes':[{'name':_0xf6c6('0xb'),'fields':[_0xf6c6('0xc')],'type':_0xf6c6('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c676a,_0x282921,_0x282de0){var _0x4fd2df=_0x545a49[_0xf6c6('0xe')];var _0x14a06a=_0x1c676a['get']({'plain':!![]});if(_0x14a06a[_0xf6c6('0xf')][_0xf6c6('0x10')]()==='in'||_0x14a06a[_0xf6c6('0xf')][_0xf6c6('0x10')]()===_0xf6c6('0x11')&&!_0x14a06a['secret']&&!_[_0xf6c6('0x12')](_0x14a06a[_0xf6c6('0x13')])){_0x4fd2df[_0xf6c6('0x14')][_0xf6c6('0x15')]({'where':{'id':_0x14a06a[_0xf6c6('0x16')]}})['then'](function(_0x5a5567){if(_0x5a5567){_0x5a5567['update']({'lastMsgAt':_0x14a06a[_0xf6c6('0x17')],'lastMsgDirection':_0x14a06a[_0xf6c6('0xf')][_0xf6c6('0x10')]()});}})[_0xf6c6('0x18')](function(_0x1ad7a9){console[_0xf6c6('0x19')](_0x1ad7a9);});}if(_0x14a06a['direction']===_0xf6c6('0x11')&&!_0x14a06a[_0xf6c6('0x1a')]){var _0x12cd55;_0x4fd2df[_0xf6c6('0x1b')]['describe']()[_0xf6c6('0x1c')](function(_0x3fc100){return _0x4fd2df[_0xf6c6('0x1d')][_0xf6c6('0x1e')]({'where':{'id':_0x14a06a[_0xf6c6('0x1f')]},'include':[{'model':_0x4fd2df['OpenchannelInteraction'],'as':_0xf6c6('0x20'),'where':{'id':_0x14a06a[_0xf6c6('0x16')]},'limit':0x1,'include':[{'model':_0x4fd2df[_0xf6c6('0x1b')],'as':'Contact','attributes':_['keys'](_0x3fc100)}]}]});})[_0xf6c6('0x1c')](function(_0x56434d){_0x12cd55=_0x56434d[_0xf6c6('0x21')]({'plain':!![]});if(_0x12cd55&&_0x12cd55[_0xf6c6('0x22')]){logger[_0xf6c6('0x23')](_0xf6c6('0x24'),_0xf6c6('0x25'),util[_0xf6c6('0x26')](_0xf6c6('0x27'),_0x14a06a['id'],_0x12cd55[_0xf6c6('0x22')]));if(_0x12cd55[_0xf6c6('0x20')]&&_0x12cd55[_0xf6c6('0x20')]['length']){_0x14a06a['Interaction']=_[_0xf6c6('0x28')](_0x12cd55[_0xf6c6('0x20')][0x0],_0xf6c6('0x29'));_0x14a06a[_0xf6c6('0x29')]=_0x12cd55[_0xf6c6('0x20')][0x0]['Contact'];}var _0x282921={'method':_0xf6c6('0x2a'),'uri':encodeURI(_0x12cd55[_0xf6c6('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x282921['method']){case _0xf6c6('0x2b'):_0x282921['qs']=_0x14a06a;break;case _0xf6c6('0x2a'):_0x282921[_0xf6c6('0xc')]=_0x14a06a;break;}return rp(_0x282921)[_0xf6c6('0x1c')](function(_0x2ed791){logger[_0xf6c6('0x23')](_0xf6c6('0x24'),_0xf6c6('0x25'),util[_0xf6c6('0x26')](_0xf6c6('0x2c'),_0x14a06a['id'],_0x12cd55['replyUri']));if(_0x2ed791[_0xf6c6('0xc')][_0xf6c6('0x2d')]&&_0x2ed791[_0xf6c6('0xc')][_0xf6c6('0x2d')]!=_0x14a06a[_0xf6c6('0x2e')]['threadId']){return _0x4fd2df[_0xf6c6('0x14')]['update']({'threadId':_0x2ed791[_0xf6c6('0xc')][_0xf6c6('0x2d')]},{'where':{'id':_0x14a06a[_0xf6c6('0x2e')]['id']}});}else{return;}})[_0xf6c6('0x1c')](function(){return _0x1c676a[_0xf6c6('0x2f')]({'read':!![]});})[_0xf6c6('0x18')](function(_0x5c8f7d){logger[_0xf6c6('0x19')](_0xf6c6('0x24'),_0xf6c6('0x25'),util[_0xf6c6('0x30')](_0x5c8f7d,{'showHidden':![],'depth':null}));_0x282de0();});}else{_0x282de0();}})[_0xf6c6('0x31')](function(){_0x282de0();});}else{_0x282de0();}}},'charset':_0xf6c6('0x32'),'collate':_0xf6c6('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d57eb1c..0ec242a 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2b53aa,_0x3c95e7){var _0x1c4e75=function(_0x479883){while(--_0x479883){_0x2b53aa['push'](_0x2b53aa['shift']());}};_0x1c4e75(++_0x3c95e7);}(_0x7a54,0x106));var _0x47a5=function(_0xb9b013,_0x5a1349){_0xb9b013=_0xb9b013-0x0;var _0x194cca=_0x7a54[_0xb9b013];return _0x194cca;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +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(_0x421c96,_0x455597){var _0x3d3023=function(_0x3984a1){while(--_0x3984a1){_0x421c96['push'](_0x421c96['shift']());}};_0x3d3023(++_0x455597);}(_0xadb5,0xad));var _0x5adb=function(_0x449f23,_0x21e75a){_0x449f23=_0x449f23-0x0;var _0x5ec385=_0xadb5[_0x449f23];return _0x5ec385;};'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 7c7364b..f185d19 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 _0xf29c=['removeListener','register','length','save','remove','update','emit'];(function(_0x37e450,_0x14a808){var _0x160600=function(_0x9226f1){while(--_0x9226f1){_0x37e450['push'](_0x37e450['shift']());}};_0x160600(++_0x14a808);}(_0xf29c,0xc7));var _0xcf29=function(_0x102827,_0x7ea0ff){_0x102827=_0x102827-0x0;var _0x15ee28=_0xf29c[_0x102827];return _0x15ee28;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xcf29('0x0'),_0xcf29('0x1'),_0xcf29('0x2')];function createListener(_0x326d3c,_0xe09619){return function(_0xe7c034){_0xe09619[_0xcf29('0x3')](_0x326d3c,_0xe7c034);};}function removeListener(_0x148004,_0x1f2b5d){return function(){OpenchannelMessageEvents[_0xcf29('0x4')](_0x148004,_0x1f2b5d);};}exports[_0xcf29('0x5')]=function(_0x89a1c8){for(var _0x347493=0x0,_0x157dfe=events[_0xcf29('0x6')];_0x347493<_0x157dfe;_0x347493++){var _0x435ced=events[_0x347493];var _0x4e6469=createListener('openchannelMessage:'+_0x435ced,_0x89a1c8);OpenchannelMessageEvents['on'](_0x435ced,_0x4e6469);}}; \ No newline at end of file +var _0x79c3=['save','removeListener','length','openchannelMessage:'];(function(_0x48da45,_0x259bea){var _0x5d5687=function(_0x2d0a0f){while(--_0x2d0a0f){_0x48da45['push'](_0x48da45['shift']());}};_0x5d5687(++_0x259bea);}(_0x79c3,0xe8));var _0x379c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x79c3[_0x5b644e];return _0x49c6bf;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x379c('0x0'),'remove','update'];function createListener(_0xddf924,_0x5d8fe0){return function(_0x80c04c){_0x5d8fe0['emit'](_0xddf924,_0x80c04c);};}function removeListener(_0x67d422,_0x3bb8c7){return function(){OpenchannelMessageEvents[_0x379c('0x1')](_0x67d422,_0x3bb8c7);};}exports['register']=function(_0x31258e){for(var _0xddde0e=0x0,_0x1b4703=events[_0x379c('0x2')];_0xddde0e<_0x1b4703;_0xddde0e++){var _0x3a30bc=events[_0xddde0e];var _0x2554b5=createListener(_0x379c('0x3')+_0x3a30bc,_0x31258e);OpenchannelMessageEvents['on'](_0x3a30bc,_0x2554b5);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 9067513..723726c 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 _0x0a72=['../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x0a72,0xa8));var _0x20a7=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x0a72[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x20a7('0x0'));var util=require(_0x20a7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x20a7('0x2'));var router=express[_0x20a7('0x3')]();var fs_extra=require(_0x20a7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x20a7('0x5'));var config=require(_0x20a7('0x6'));var controller=require(_0x20a7('0x7'));router[_0x20a7('0x8')]('/',auth['isAuthenticated'](),controller[_0x20a7('0x9')]);router[_0x20a7('0x8')](_0x20a7('0xa'),auth[_0x20a7('0xb')](),controller[_0x20a7('0xc')]);router['get'](_0x20a7('0xd'),auth[_0x20a7('0xb')](),controller[_0x20a7('0xe')]);router[_0x20a7('0x8')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x20a7('0x8')](_0x20a7('0xf'),auth[_0x20a7('0xb')](),controller[_0x20a7('0x10')]);router[_0x20a7('0x8')](_0x20a7('0x11'),auth['isAuthenticated'](),controller[_0x20a7('0x12')]);router[_0x20a7('0x13')]('/',auth[_0x20a7('0xb')](),controller[_0x20a7('0x14')]);router[_0x20a7('0x13')](_0x20a7('0xf'),auth[_0x20a7('0xb')](),controller[_0x20a7('0x15')]);router['post'](_0x20a7('0x11'),auth[_0x20a7('0xb')](),controller['addAgents']);router[_0x20a7('0x16')](_0x20a7('0xd'),auth['isAuthenticated'](),controller[_0x20a7('0x17')]);router['delete']('/:id',auth[_0x20a7('0xb')](),controller[_0x20a7('0x18')]);router['delete']('/:id/teams',auth[_0x20a7('0xb')](),controller[_0x20a7('0x19')]);router[_0x20a7('0x1a')]('/:id/users',auth[_0x20a7('0xb')](),controller[_0x20a7('0x1b')]);module[_0x20a7('0x1c')]=router; \ No newline at end of file +var _0x3e1c=['show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe'];(function(_0x36b41d,_0x36db9f){var _0xec7011=function(_0x4427b7){while(--_0x4427b7){_0x36b41d['push'](_0x36b41d['shift']());}};_0xec7011(++_0x36db9f);}(_0x3e1c,0x1ec));var _0xc3e1=function(_0x5cc57e,_0x281427){_0x5cc57e=_0x5cc57e-0x0;var _0x30fd9f=_0x3e1c[_0x5cc57e];return _0x30fd9f;};'use strict';var multer=require(_0xc3e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc3e1('0x1'));var express=require(_0xc3e1('0x2'));var router=express[_0xc3e1('0x3')]();var fs_extra=require(_0xc3e1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc3e1('0x5'));var config=require(_0xc3e1('0x6'));var controller=require(_0xc3e1('0x7'));router[_0xc3e1('0x8')]('/',auth[_0xc3e1('0x9')](),controller[_0xc3e1('0xa')]);router['get']('/describe',auth[_0xc3e1('0x9')](),controller[_0xc3e1('0xb')]);router[_0xc3e1('0x8')]('/:id',auth[_0xc3e1('0x9')](),controller[_0xc3e1('0xc')]);router[_0xc3e1('0x8')](_0xc3e1('0xd'),auth['isAuthenticated'](),controller[_0xc3e1('0xe')]);router['get'](_0xc3e1('0xf'),auth[_0xc3e1('0x9')](),controller['getTeams']);router[_0xc3e1('0x8')](_0xc3e1('0x10'),auth[_0xc3e1('0x9')](),controller[_0xc3e1('0x11')]);router[_0xc3e1('0x12')]('/',auth[_0xc3e1('0x9')](),controller['create']);router[_0xc3e1('0x12')](_0xc3e1('0xf'),auth[_0xc3e1('0x9')](),controller['addTeams']);router['post'](_0xc3e1('0x10'),auth['isAuthenticated'](),controller[_0xc3e1('0x13')]);router[_0xc3e1('0x14')](_0xc3e1('0x15'),auth[_0xc3e1('0x9')](),controller[_0xc3e1('0x16')]);router[_0xc3e1('0x17')](_0xc3e1('0x15'),auth['isAuthenticated'](),controller[_0xc3e1('0x18')]);router['delete'](_0xc3e1('0xf'),auth[_0xc3e1('0x9')](),controller[_0xc3e1('0x19')]);router[_0xc3e1('0x17')]('/:id/users',auth[_0xc3e1('0x9')](),controller[_0xc3e1('0x1a')]);module[_0xc3e1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 328a284..ea34233 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 _0xea0d=['exports','STRING','sequelize'];(function(_0x26a901,_0x29dd83){var _0x305c2a=function(_0x54c8f9){while(--_0x54c8f9){_0x26a901['push'](_0x26a901['shift']());}};_0x305c2a(++_0x29dd83);}(_0xea0d,0x1ac));var _0xdea0=function(_0x1bfb48,_0x2de37a){_0x1bfb48=_0x1bfb48-0x0;var _0x1f432a=_0xea0d[_0x1bfb48];return _0x1f432a;};'use strict';var Sequelize=require(_0xdea0('0x0'));module[_0xdea0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdea0('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0xdfb8=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x178753,_0x4de165){var _0x1917f4=function(_0x380e84){while(--_0x380e84){_0x178753['push'](_0x178753['shift']());}};_0x1917f4(++_0x4de165);}(_0xdfb8,0x7f));var _0x8dfb=function(_0x5fb9da,_0x1ac0d0){_0x5fb9da=_0x5fb9da-0x0;var _0x528081=_0xdfb8[_0x5fb9da];return _0x528081;};'use strict';var Sequelize=require('sequelize');module[_0x8dfb('0x0')]={'name':{'type':Sequelize[_0x8dfb('0x1')],'unique':_0x8dfb('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8dfb('0x1')]},'timeout':{'type':Sequelize[_0x8dfb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8dfb('0x4')](_0x8dfb('0x5'),_0x8dfb('0x6'),_0x8dfb('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 3039d94..9f0c77e 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 _0x1e30=['forEach','emit','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','TeamId','union','compact','value','transaction','addAgents','omit','spread','userOpenchannelQueue:save','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','util','squel','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','status','offset','limit','undefined','count','set','json','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','fieldName','type','key','getOptions','include','query','rows','show','params','keys','intersection','attributes','model','fields','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','body','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','filters','hasOwnProperty','nolimit','order','sort','pick','where','filter','findAll','User','UserId','openchannelPause','updatedAt','format','%s/%s','SIP','Team','length','getTeams','ids','Agents','online','voicePause','interface','flatMap','addTeams','each','findOrCreate'];(function(_0x34b43f,_0x472d2e){var _0x5b8249=function(_0x3121a8){while(--_0x3121a8){_0x34b43f['push'](_0x34b43f['shift']());}};_0x5b8249(++_0x472d2e);}(_0x1e30,0x107));var _0x01e3=function(_0xb9e2bc,_0x1bb304){_0xb9e2bc=_0xb9e2bc-0x0;var _0x5cddae=_0x1e30[_0xb9e2bc];return _0x5cddae;};'use strict';var BPromise=require('bluebird');var util=require(_0x01e3('0x0'));var _=require('lodash');var squel=require(_0x01e3('0x1'));var Redis=require(_0x01e3('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x01e3('0x3'));var config=require(_0x01e3('0x4'));var db=require(_0x01e3('0x5'))['db'];config[_0x01e3('0x6')]=_[_0x01e3('0x7')](config[_0x01e3('0x6')],{'host':_0x01e3('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01e3('0x6')]));require(_0x01e3('0x9'))[_0x01e3('0xa')](socket);function respondWithStatusCode(_0x7f35a7,_0x2930dc){_0x2930dc=_0x2930dc||0xcc;return function(_0x4f57bf){if(_0x4f57bf){return _0x7f35a7['sendStatus'](_0x2930dc);}return _0x7f35a7['status'](_0x2930dc)['end']();};}function respondWithResult(_0x15d82b,_0x54ea25){_0x54ea25=_0x54ea25||0xc8;return function(_0x3b3d36){if(_0x3b3d36){return _0x15d82b[_0x01e3('0xb')](_0x54ea25)['json'](_0x3b3d36);}};}function respondWithFilteredResult(_0x50e070,_0x10274d){return function(_0x25822b){if(_0x25822b){var _0x16bdae=typeof _0x10274d[_0x01e3('0xc')]==='undefined'&&typeof _0x10274d[_0x01e3('0xd')]===_0x01e3('0xe');var _0x2846d1=_0x25822b[_0x01e3('0xf')];var _0x467701=_0x16bdae?0x0:_0x10274d[_0x01e3('0xc')];var _0x425341=_0x16bdae?_0x25822b[_0x01e3('0xf')]:_0x10274d[_0x01e3('0xc')]+_0x10274d['limit'];var _0xcde4cd;if(_0x425341>=_0x2846d1){_0x425341=_0x2846d1;_0xcde4cd=0xc8;}else{_0xcde4cd=0xce;}_0x50e070[_0x01e3('0xb')](_0xcde4cd);return _0x50e070[_0x01e3('0x10')]('Content-Range',_0x467701+'-'+_0x425341+'/'+_0x2846d1)[_0x01e3('0x11')](_0x25822b);}return null;};}function saveUpdates(_0x13c062){return function(_0x495f36){if(_0x495f36){return _0x495f36[_0x01e3('0x12')](_0x13c062)[_0x01e3('0x13')](function(_0x8d9c15){return _0x8d9c15;});}return null;};}function removeEntity(_0x33ddf2){return function(_0x3de2c9){if(_0x3de2c9){return _0x3de2c9[_0x01e3('0x14')]()[_0x01e3('0x13')](function(){var _0x545ac1=_0x3de2c9[_0x01e3('0x15')]({'plain':!![]});var _0x4b254f=_0x01e3('0x16');return db[_0x01e3('0x17')][_0x01e3('0x14')]({'where':{'type':_0x4b254f,'resourceId':_0x545ac1['id']}})[_0x01e3('0x13')](function(){return _0x3de2c9;});})[_0x01e3('0x13')](function(){_0x33ddf2[_0x01e3('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c6be){return function(_0x24b628){if(!_0x24b628){_0x46c6be[_0x01e3('0x18')](0x194);}return _0x24b628;};}function handleError(_0xd533ef,_0xcbfaf2){_0xcbfaf2=_0xcbfaf2||0x1f4;return function(_0x369a15){logger[_0x01e3('0x19')](_0x369a15[_0x01e3('0x1a')]);if(_0x369a15[_0x01e3('0x1b')]){delete _0x369a15[_0x01e3('0x1b')];}_0xd533ef[_0x01e3('0xb')](_0xcbfaf2)[_0x01e3('0x1c')](_0x369a15);};}exports[_0x01e3('0x1d')]=function(_0x4aa587,_0x5182c8){var _0x5a9835={};var _0x20403c={'count':0x0,'rows':[]};var _0x3a6387=_[_0x01e3('0x1e')](db[_0x01e3('0x1f')]['rawAttributes'],function(_0x11e3a6){return{'name':_0x11e3a6[_0x01e3('0x20')],'type':_0x11e3a6[_0x01e3('0x21')][_0x01e3('0x22')]};});_0x5a9835=qs[_0x01e3('0x23')](_0x3a6387,_0x4aa587);var _0x30f31c={'where':_0x5a9835['where']};return db[_0x01e3('0x1f')]['count'](_0x30f31c)[_0x01e3('0x13')](function(_0x2f1468){_0x20403c[_0x01e3('0xf')]=_0x2f1468;_0x5a9835[_0x01e3('0x24')]=qs[_0x01e3('0x24')](_0x4aa587[_0x01e3('0x25')]);return db[_0x01e3('0x1f')]['findAll'](_0x5a9835);})[_0x01e3('0x13')](function(_0x403c9c){_0x20403c[_0x01e3('0x26')]=_0x403c9c;return _0x20403c;})[_0x01e3('0x13')](respondWithFilteredResult(_0x5182c8,_0x5a9835))['catch'](handleError(_0x5182c8,null));};exports[_0x01e3('0x27')]=function(_0x6a708c,_0x438767){var _0x291cbf={'raw':!![],'where':{'id':_0x6a708c[_0x01e3('0x28')]['id']}},_0x38e0cf={};_0x38e0cf['model']=_[_0x01e3('0x29')](db[_0x01e3('0x1f')]['rawAttributes']);_0x38e0cf[_0x01e3('0x25')]=_[_0x01e3('0x29')](_0x6a708c['query']);_0x38e0cf['filters']=_[_0x01e3('0x2a')](_0x38e0cf['model'],_0x38e0cf[_0x01e3('0x25')]);_0x291cbf[_0x01e3('0x2b')]=_['intersection'](_0x38e0cf[_0x01e3('0x2c')],qs[_0x01e3('0x2d')](_0x6a708c[_0x01e3('0x25')][_0x01e3('0x2d')]));_0x291cbf[_0x01e3('0x2b')]=_0x291cbf['attributes']['length']?_0x291cbf[_0x01e3('0x2b')]:_0x38e0cf[_0x01e3('0x2c')];if(_0x6a708c[_0x01e3('0x25')][_0x01e3('0x2e')]){_0x291cbf[_0x01e3('0x24')]=[{'all':!![]}];}_0x291cbf=_[_0x01e3('0x2f')]({},_0x291cbf,_0x6a708c[_0x01e3('0x30')]);return db[_0x01e3('0x1f')][_0x01e3('0x31')](_0x291cbf)[_0x01e3('0x13')](handleEntityNotFound(_0x438767,null))['then'](respondWithResult(_0x438767,null))['catch'](handleError(_0x438767,null));};exports[_0x01e3('0x32')]=function(_0x4e279a,_0x19a18d){return db[_0x01e3('0x1f')][_0x01e3('0x32')](_0x4e279a['body'],{})[_0x01e3('0x13')](function(_0x5100eb){var _0x2a3169=_0x4e279a[_0x01e3('0x33')][_0x01e3('0x15')]({'plain':!![]});if(!_0x2a3169)throw new Error(_0x01e3('0x34'));if(_0x2a3169[_0x01e3('0x35')]===_0x01e3('0x33')){var _0x2776c9=_0x5100eb[_0x01e3('0x15')]({'plain':!![]});var _0x5ea464=_0x01e3('0x16');return db[_0x01e3('0x36')]['find']({'where':{'name':_0x5ea464,'userProfileId':_0x2a3169['userProfileId']},'raw':!![]})[_0x01e3('0x13')](function(_0x19fba9){if(_0x19fba9&&_0x19fba9[_0x01e3('0x37')]===0x0){return db[_0x01e3('0x17')][_0x01e3('0x32')]({'name':_0x2776c9[_0x01e3('0x1b')],'resourceId':_0x2776c9['id'],'type':_0x19fba9[_0x01e3('0x1b')],'sectionId':_0x19fba9['id']},{})[_0x01e3('0x13')](function(){return _0x5100eb;});}else{return _0x5100eb;}})[_0x01e3('0x38')](function(_0x1d27f0){logger[_0x01e3('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d27f0);throw _0x1d27f0;});}return _0x5100eb;})['then'](respondWithResult(_0x19a18d,0xc9))[_0x01e3('0x38')](handleError(_0x19a18d,null));};exports['update']=function(_0x42e7b0,_0x49449c){if(_0x42e7b0[_0x01e3('0x39')]['id']){delete _0x42e7b0[_0x01e3('0x39')]['id'];}return db[_0x01e3('0x1f')][_0x01e3('0x31')]({'where':{'id':_0x42e7b0[_0x01e3('0x28')]['id']}})[_0x01e3('0x13')](handleEntityNotFound(_0x49449c,null))[_0x01e3('0x13')](saveUpdates(_0x42e7b0['body'],null))[_0x01e3('0x13')](respondWithResult(_0x49449c,null))[_0x01e3('0x38')](handleError(_0x49449c,null));};exports[_0x01e3('0x14')]=function(_0x253b2d,_0x4c7b9e){return db[_0x01e3('0x1f')][_0x01e3('0x31')]({'where':{'id':_0x253b2d[_0x01e3('0x28')]['id']}})['then'](handleEntityNotFound(_0x4c7b9e,null))[_0x01e3('0x13')](removeEntity(_0x4c7b9e,null))[_0x01e3('0x38')](handleError(_0x4c7b9e,null));};exports[_0x01e3('0x3a')]=function(_0x349529,_0x4ba840){return db[_0x01e3('0x1f')][_0x01e3('0x3a')]()[_0x01e3('0x13')](respondWithResult(_0x4ba840,null))[_0x01e3('0x38')](handleError(_0x4ba840,null));};exports[_0x01e3('0x3b')]=function(_0x20abe4,_0x43d69f){var _0x420694={'raw':!![],'where':{}},_0x4f91aa={},_0x43c67f;return db[_0x01e3('0x1f')][_0x01e3('0x3c')]({'where':{'id':_0x20abe4[_0x01e3('0x28')]['id']}})[_0x01e3('0x13')](handleEntityNotFound(_0x43d69f,null))['then'](function(_0x811cef){if(_0x811cef){_0x43c67f=_0x811cef['get']({'plain':!![]});_0x4f91aa['model']=_[_0x01e3('0x29')](db[_0x01e3('0x3d')][_0x01e3('0x3e')]);_0x4f91aa[_0x01e3('0x25')]=_['keys'](_0x20abe4[_0x01e3('0x25')]);_0x4f91aa[_0x01e3('0x3f')]=_[_0x01e3('0x2a')](_0x4f91aa[_0x01e3('0x2c')],_0x4f91aa['query']);_0x420694[_0x01e3('0x2b')]=_[_0x01e3('0x2a')](_0x4f91aa[_0x01e3('0x2c')],qs[_0x01e3('0x2d')](_0x20abe4[_0x01e3('0x25')][_0x01e3('0x2d')]));_0x420694['attributes']=_0x420694[_0x01e3('0x2b')]['length']?_0x420694[_0x01e3('0x2b')]:_0x4f91aa['model'];if(!_0x20abe4[_0x01e3('0x25')][_0x01e3('0x40')](_0x01e3('0x41'))){_0x420694[_0x01e3('0xd')]=qs[_0x01e3('0xd')](_0x20abe4[_0x01e3('0x25')]['limit']);_0x420694[_0x01e3('0xc')]=qs['offset'](_0x20abe4[_0x01e3('0x25')][_0x01e3('0xc')]);}_0x420694[_0x01e3('0x42')]=qs['sort'](_0x20abe4[_0x01e3('0x25')][_0x01e3('0x43')]);_0x420694['where']=qs['filters'](_[_0x01e3('0x44')](_0x20abe4[_0x01e3('0x25')],_0x4f91aa[_0x01e3('0x3f')]));_0x420694[_0x01e3('0x45')]['OpenchannelQueueId']=_0x811cef['id'];if(_0x20abe4[_0x01e3('0x25')][_0x01e3('0x46')]){_0x420694[_0x01e3('0x45')]=_['merge'](_0x420694[_0x01e3('0x45')],{'$or':_['map'](_0x420694[_0x01e3('0x2b')],function(_0x1f8817){var _0x23c5e1={};_0x23c5e1[_0x1f8817]={'$like':'%'+_0x20abe4[_0x01e3('0x25')]['filter']+'%'};return _0x23c5e1;})});}_0x420694=_[_0x01e3('0x2f')]({},_0x420694,_0x20abe4['options']);return db['UserOpenchannelQueue'][_0x01e3('0x47')](_0x420694);}})[_0x01e3('0x13')](function(_0x48033a){if(_0x48033a){return db[_0x01e3('0x48')]['findAndCountAll']({'where':{'id':_[_0x01e3('0x1e')](_0x48033a,_0x01e3('0x49')),'role':'agent'},'attributes':['id','name',_0x01e3('0x4a'),_0x01e3('0x4b'),'createdAt']});}})[_0x01e3('0x13')](function(_0x13ee56){if(_0x13ee56){return{'count':_0x13ee56[_0x01e3('0xf')],'rows':_['map'](_0x13ee56[_0x01e3('0x26')],function(_0xac9257){return{'membername':_0xac9257[_0x01e3('0x1b')],'UserId':_0xac9257['id'],'queue_name':_0x43c67f[_0x01e3('0x1b')],'OpenchannelQueueId':_0x43c67f['id'],'interface':util[_0x01e3('0x4c')](_0x01e3('0x4d'),_0x01e3('0x4e'),_0xac9257[_0x01e3('0x1b')]),'penalty':0x0,'paused':_0xac9257[_0x01e3('0x4a')],'createdAt':_0xac9257['createdAt'],'updatedAt':_0xac9257[_0x01e3('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x01e3('0x13')](respondWithFilteredResult(_0x43d69f,_0x420694))[_0x01e3('0x38')](handleError(_0x43d69f,null));};exports['getTeams']=function(_0x27ab90,_0x4bf077){var _0x4132aa={};var _0x55c59d={};var _0x2e928e;var _0x4b041e;return db[_0x01e3('0x1f')][_0x01e3('0x3c')]({'where':{'id':_0x27ab90[_0x01e3('0x28')]['id']}})['then'](handleEntityNotFound(_0x4bf077,null))[_0x01e3('0x13')](function(_0x217e98){if(_0x217e98){_0x2e928e=_0x217e98;_0x55c59d[_0x01e3('0x2c')]=_[_0x01e3('0x29')](db[_0x01e3('0x4f')][_0x01e3('0x3e')]);_0x55c59d['query']=_[_0x01e3('0x29')](_0x27ab90[_0x01e3('0x25')]);_0x55c59d['filters']=_[_0x01e3('0x2a')](_0x55c59d[_0x01e3('0x2c')],_0x55c59d[_0x01e3('0x25')]);_0x4132aa[_0x01e3('0x2b')]=_[_0x01e3('0x2a')](_0x55c59d[_0x01e3('0x2c')],qs[_0x01e3('0x2d')](_0x27ab90[_0x01e3('0x25')]['fields']));_0x4132aa['attributes']=_0x4132aa['attributes'][_0x01e3('0x50')]?_0x4132aa[_0x01e3('0x2b')]:_0x55c59d[_0x01e3('0x2c')];_0x4132aa[_0x01e3('0x42')]=qs[_0x01e3('0x43')](_0x27ab90[_0x01e3('0x25')][_0x01e3('0x43')]);_0x4132aa[_0x01e3('0x45')]=qs[_0x01e3('0x3f')](_['pick'](_0x27ab90[_0x01e3('0x25')],_0x55c59d[_0x01e3('0x3f')]));if(_0x27ab90[_0x01e3('0x25')][_0x01e3('0x46')]){_0x4132aa['where']=_[_0x01e3('0x2f')](_0x4132aa[_0x01e3('0x45')],{'$or':_[_0x01e3('0x1e')](_0x4132aa['attributes'],function(_0x1750df){var _0x526eeb={};_0x526eeb[_0x1750df]={'$like':'%'+_0x27ab90[_0x01e3('0x25')][_0x01e3('0x46')]+'%'};return _0x526eeb;})});}_0x4132aa=_[_0x01e3('0x2f')]({},_0x4132aa,_0x27ab90[_0x01e3('0x30')]);return _0x2e928e['getTeams'](_0x4132aa);}})[_0x01e3('0x13')](function(_0x590e49){if(_0x590e49){_0x4b041e=_0x590e49[_0x01e3('0x50')];if(!_0x27ab90[_0x01e3('0x25')][_0x01e3('0x40')](_0x01e3('0x41'))){_0x4132aa[_0x01e3('0xd')]=qs[_0x01e3('0xd')](_0x27ab90[_0x01e3('0x25')][_0x01e3('0xd')]);_0x4132aa[_0x01e3('0xc')]=qs[_0x01e3('0xc')](_0x27ab90[_0x01e3('0x25')][_0x01e3('0xc')]);}return _0x2e928e[_0x01e3('0x51')](_0x4132aa);}})[_0x01e3('0x13')](function(_0x2b8b72){if(_0x2b8b72){return _0x2b8b72?{'count':_0x4b041e,'rows':_0x2b8b72}:null;}})[_0x01e3('0x13')](respondWithResult(_0x4bf077,null))[_0x01e3('0x38')](handleError(_0x4bf077,null));};exports['addTeams']=function(_0x186d37,_0x573d1c){var _0x2e0aa9=_0x186d37['body'][_0x01e3('0x52')];return db[_0x01e3('0x4f')][_0x01e3('0x47')]({'where':{'id':_0x2e0aa9},'attributes':['id'],'include':[{'model':db[_0x01e3('0x48')],'as':_0x01e3('0x53'),'attributes':['id',_0x01e3('0x1b'),_0x01e3('0x54'),_0x01e3('0x55'),_0x01e3('0x56')],'raw':!![]}]})[_0x01e3('0x13')](function(_0x3c09f3){if(_0x3c09f3){var _0x96d052=_[_0x01e3('0x57')](_0x3c09f3,function(_0x20f4d2){var _0x41d8ca=_0x20f4d2[_0x01e3('0x15')]({'plain':!![]});return _0x41d8ca[_0x01e3('0x53')];});return db[_0x01e3('0x1f')][_0x01e3('0x31')]({'where':{'id':_0x186d37['params']['id']}})[_0x01e3('0x13')](function(_0x31657f){return db['sequelize']['transaction'](function(_0x5e8d01){return _0x31657f[_0x01e3('0x58')](_0x2e0aa9,{'transaction':_0x5e8d01})['then'](function(){return BPromise[_0x01e3('0x59')](_0x96d052,function(_0x1e64f2){return db[_0x01e3('0x3d')][_0x01e3('0x5a')]({'where':{'UserId':_0x1e64f2['id'],'OpenchannelQueueId':_0x186d37['params']['id']},'transaction':_0x5e8d01});});})[_0x01e3('0x13')](function(){_0x96d052[_0x01e3('0x5b')](function(_0x52a883){socket[_0x01e3('0x5c')]('userOpenchannelQueue:save',{'UserId':_0x52a883['id'],'OpenchannelQueueId':_0x31657f['id']});});});});});}})[_0x01e3('0x13')](respondWithStatusCode(_0x573d1c,null))['catch'](handleError(_0x573d1c,null));};exports[_0x01e3('0x5d')]=function(_0x4e629d,_0x2014a8){return db[_0x01e3('0x4f')][_0x01e3('0x47')]({'where':{'id':_0x4e629d[_0x01e3('0x25')][_0x01e3('0x52')]},'attributes':['id'],'include':[{'model':db[_0x01e3('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2014a8,null))['then'](function(_0x4d63c5){var _0x143549=_['map'](_0x4d63c5,'id');var _0x54e66d=[];var _0x5560a9=[];var _0x9375d0=squel['select']();_0x9375d0[_0x01e3('0x5e')](_0x01e3('0x5f'))[_0x01e3('0x60')](_0x01e3('0x61'),'tq')['join']('user_has_teams','ut',_0x01e3('0x62'))[_0x01e3('0x45')]('OpenchannelQueueId\x20=\x20?',_0x4e629d[_0x01e3('0x28')]['id']);for(var _0x48444a=0x0;_0x48444a<_0x4d63c5['length'];_0x48444a+=0x1){let _0x41aa99=_0x4d63c5[_0x48444a];for(var _0x1f551c=0x0;_0x1f551c<_0x41aa99[_0x01e3('0x53')][_0x01e3('0x50')];_0x1f551c+=0x1){let _0x5c6c3c=_0x41aa99['Agents'][_0x1f551c];var _0x388d63=_0x9375d0[_0x01e3('0x63')]();_0x388d63['where'](_0x01e3('0x64'),_0x5c6c3c['id']);_0x5560a9[_0x01e3('0x65')](db['sequelize'][_0x01e3('0x25')](_0x388d63['toString'](),{'type':db[_0x01e3('0x66')][_0x01e3('0x67')][_0x01e3('0x68')]})[_0x01e3('0x13')](function(_0x162bfe){if(_0x162bfe[_0x01e3('0x50')]===0x1){return _0x5c6c3c['id'];}else{var _0x4e096b=_['every'](_['map'](_0x162bfe,_0x01e3('0x69')),function(_0x21051b){return _['includes'](_0x143549,_0x21051b);});if(_0x4e096b){return _0x5c6c3c['id'];}}}));}}return BPromise['all'](_0x5560a9)[_0x01e3('0x13')](function(_0x44625a){_0x54e66d=_(_0x54e66d)[_0x01e3('0x6a')](_0x44625a)[_0x01e3('0x6b')]()[_0x01e3('0x6c')]();return db[_0x01e3('0x1f')][_0x01e3('0x31')]({'where':{'id':_0x4e629d[_0x01e3('0x28')]['id']}})[_0x01e3('0x13')](function(_0x5d017b){return db[_0x01e3('0x66')][_0x01e3('0x6d')](function(_0x4c34cf){return _0x5d017b[_0x01e3('0x5d')](_0x4e629d[_0x01e3('0x25')][_0x01e3('0x52')],{'transaction':_0x4c34cf})[_0x01e3('0x13')](function(){if(!_['isEmpty'](_0x54e66d)){return _0x5d017b['removeAgents'](_0x54e66d,{'transaction':_0x4c34cf});}})[_0x01e3('0x13')](function(){_0x54e66d[_0x01e3('0x5b')](function(_0x5938bc){socket[_0x01e3('0x5c')]('userOpenchannelQueue:remove',{'UserId':_0x5938bc,'OpenchannelQueueId':_0x5d017b['id']});});});});});});})[_0x01e3('0x13')](respondWithStatusCode(_0x2014a8,null))['catch'](handleError(_0x2014a8,null));};exports['addAgents']=function(_0x4724a0,_0x505d03){return db[_0x01e3('0x1f')][_0x01e3('0x31')]({'where':{'id':_0x4724a0[_0x01e3('0x28')]['id']}})['then'](handleEntityNotFound(_0x505d03,null))[_0x01e3('0x13')](function(_0x4df42a){if(_0x4df42a){return _0x4df42a[_0x01e3('0x6e')](_0x4724a0['body'][_0x01e3('0x52')],_[_0x01e3('0x6f')](_0x4724a0[_0x01e3('0x39')],['ids','id'])||{})[_0x01e3('0x70')](function(_0x139d0e){for(var _0x1e0923=0x0;_0x1e0923<_0x4724a0[_0x01e3('0x39')][_0x01e3('0x52')][_0x01e3('0x50')];_0x1e0923+=0x1){socket['emit'](_0x01e3('0x71'),{'UserId':Number(_0x4724a0[_0x01e3('0x39')][_0x01e3('0x52')][_0x1e0923]),'OpenchannelQueueId':Number(_0x4724a0['params']['id'])});}return _0x139d0e;});}})['then'](respondWithResult(_0x505d03,null))[_0x01e3('0x38')](handleError(_0x505d03,null));};exports[_0x01e3('0x72')]=function(_0x107691,_0xb91e8f){return db[_0x01e3('0x1f')][_0x01e3('0x31')]({'where':{'id':_0x107691[_0x01e3('0x28')]['id']}})[_0x01e3('0x13')](handleEntityNotFound(_0xb91e8f,null))[_0x01e3('0x13')](function(_0xa44b15){if(_0xa44b15){return _0xa44b15[_0x01e3('0x72')](_0x107691[_0x01e3('0x25')][_0x01e3('0x52')])[_0x01e3('0x13')](function(){if(_[_0x01e3('0x73')](_0x107691['query'][_0x01e3('0x52')])){for(var _0x248e99=0x0;_0x248e99<_0x107691[_0x01e3('0x25')]['ids'][_0x01e3('0x50')];_0x248e99+=0x1){socket['emit'](_0x01e3('0x74'),{'UserId':Number(_0x107691['query'][_0x01e3('0x52')][_0x248e99]),'OpenchannelQueueId':Number(_0x107691['params']['id'])});}}else{socket[_0x01e3('0x5c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x107691['query']['ids']),'OpenchannelQueueId':Number(_0x107691[_0x01e3('0x28')]['id'])});}});}})[_0x01e3('0x13')](respondWithStatusCode(_0xb91e8f,null))[_0x01e3('0x38')](handleError(_0xb91e8f,null));};exports[_0x01e3('0x75')]=function(_0x11a1ab,_0x4e3e9c){var _0x499c81={};var _0x3c5193={};var _0xb86a92;var _0x443a31;return db[_0x01e3('0x1f')]['findOne']({'where':{'id':_0x11a1ab[_0x01e3('0x28')]['id']}})[_0x01e3('0x13')](handleEntityNotFound(_0x4e3e9c,null))[_0x01e3('0x13')](function(_0x313f83){if(_0x313f83){_0xb86a92=_0x313f83;_0x3c5193[_0x01e3('0x2c')]=_['keys'](db[_0x01e3('0x48')][_0x01e3('0x3e')]);_0x3c5193[_0x01e3('0x25')]=_[_0x01e3('0x29')](_0x11a1ab['query']);_0x3c5193['filters']=_['intersection'](_0x3c5193[_0x01e3('0x2c')],_0x3c5193['query']);_0x499c81[_0x01e3('0x2b')]=_[_0x01e3('0x2a')](_0x3c5193[_0x01e3('0x2c')],qs[_0x01e3('0x2d')](_0x11a1ab[_0x01e3('0x25')][_0x01e3('0x2d')]));_0x499c81[_0x01e3('0x2b')]=_0x499c81[_0x01e3('0x2b')][_0x01e3('0x50')]?_0x499c81[_0x01e3('0x2b')]:_0x3c5193[_0x01e3('0x2c')];_0x499c81[_0x01e3('0x42')]=qs[_0x01e3('0x43')](_0x11a1ab[_0x01e3('0x25')]['sort']);_0x499c81[_0x01e3('0x45')]=qs[_0x01e3('0x3f')](_[_0x01e3('0x44')](_0x11a1ab[_0x01e3('0x25')],_0x3c5193[_0x01e3('0x3f')]));if(_0x11a1ab[_0x01e3('0x25')]['filter']){_0x499c81[_0x01e3('0x45')]=_[_0x01e3('0x2f')](_0x499c81['where'],{'$or':_[_0x01e3('0x1e')](_0x499c81['attributes'],function(_0x1cefef){var _0x3e8d8b={};_0x3e8d8b[_0x1cefef]={'$like':'%'+_0x11a1ab[_0x01e3('0x25')][_0x01e3('0x46')]+'%'};return _0x3e8d8b;})});}_0x499c81=_[_0x01e3('0x2f')]({},_0x499c81,_0x11a1ab[_0x01e3('0x30')]);return _0xb86a92['getAgents'](_0x499c81);}})[_0x01e3('0x13')](function(_0x2537fc){if(_0x2537fc){_0x443a31=_0x2537fc[_0x01e3('0x50')];if(!_0x11a1ab[_0x01e3('0x25')]['hasOwnProperty'](_0x01e3('0x41'))){_0x499c81[_0x01e3('0xd')]=qs[_0x01e3('0xd')](_0x11a1ab[_0x01e3('0x25')][_0x01e3('0xd')]);_0x499c81['offset']=qs[_0x01e3('0xc')](_0x11a1ab[_0x01e3('0x25')]['offset']);}return _0xb86a92[_0x01e3('0x75')](_0x499c81);}})[_0x01e3('0x13')](function(_0x143a91){if(_0x143a91){return _0x143a91?{'count':_0x443a31,'rows':_0x143a91}:null;}})[_0x01e3('0x13')](respondWithResult(_0x4e3e9c,null))['catch'](handleError(_0x4e3e9c,null));}; \ No newline at end of file +var _0xe0d5=['isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','count','limit','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','stack','name','index','map','OpenchannelQueue','type','key','getOptions','where','query','findAll','rows','catch','show','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','from','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','compact'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xe0d5,0xf3));var _0x5e0d=function(_0x276c92,_0x4b611f){_0x276c92=_0x276c92-0x0;var _0x1abf64=_0xe0d5[_0x276c92];return _0x1abf64;};'use strict';var BPromise=require(_0x5e0d('0x0'));var util=require(_0x5e0d('0x1'));var _=require(_0x5e0d('0x2'));var squel=require(_0x5e0d('0x3'));var Redis=require(_0x5e0d('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x5e0d('0x5'))['db'];config[_0x5e0d('0x6')]=_[_0x5e0d('0x7')](config[_0x5e0d('0x6')],{'host':_0x5e0d('0x8'),'port':0x18eb});var socket=require(_0x5e0d('0x9'))(new Redis(config[_0x5e0d('0x6')]));require('./openchannelQueue.socket')[_0x5e0d('0xa')](socket);function respondWithStatusCode(_0x3eb8b2,_0x5a461c){_0x5a461c=_0x5a461c||0xcc;return function(_0x39dbd2){if(_0x39dbd2){return _0x3eb8b2[_0x5e0d('0xb')](_0x5a461c);}return _0x3eb8b2[_0x5e0d('0xc')](_0x5a461c)['end']();};}function respondWithResult(_0x585af8,_0x2e49e0){_0x2e49e0=_0x2e49e0||0xc8;return function(_0x10c417){if(_0x10c417){return _0x585af8[_0x5e0d('0xc')](_0x2e49e0)['json'](_0x10c417);}};}function respondWithFilteredResult(_0x14bf89,_0x165c08){return function(_0x145ff6){if(_0x145ff6){var _0x25ba79=typeof _0x165c08[_0x5e0d('0xd')]===_0x5e0d('0xe')&&typeof _0x165c08['limit']==='undefined';var _0x508da4=_0x145ff6[_0x5e0d('0xf')];var _0x3be159=_0x25ba79?0x0:_0x165c08['offset'];var _0x41d891=_0x25ba79?_0x145ff6[_0x5e0d('0xf')]:_0x165c08['offset']+_0x165c08[_0x5e0d('0x10')];var _0x93fd2;if(_0x41d891>=_0x508da4){_0x41d891=_0x508da4;_0x93fd2=0xc8;}else{_0x93fd2=0xce;}_0x14bf89['status'](_0x93fd2);return _0x14bf89['set'](_0x5e0d('0x11'),_0x3be159+'-'+_0x41d891+'/'+_0x508da4)['json'](_0x145ff6);}return null;};}function saveUpdates(_0x473312){return function(_0x149664){if(_0x149664){return _0x149664[_0x5e0d('0x12')](_0x473312)[_0x5e0d('0x13')](function(_0x53a159){return _0x53a159;});}return null;};}function removeEntity(_0x297e36){return function(_0x1dd28f){if(_0x1dd28f){return _0x1dd28f[_0x5e0d('0x14')]()[_0x5e0d('0x13')](function(){var _0x28c6a7=_0x1dd28f[_0x5e0d('0x15')]({'plain':!![]});var _0xfd98fe=_0x5e0d('0x16');return db[_0x5e0d('0x17')][_0x5e0d('0x14')]({'where':{'type':_0xfd98fe,'resourceId':_0x28c6a7['id']}})[_0x5e0d('0x13')](function(){return _0x1dd28f;});})[_0x5e0d('0x13')](function(){_0x297e36[_0x5e0d('0xc')](0xcc)[_0x5e0d('0x18')]();});}};}function handleEntityNotFound(_0x4b41f8){return function(_0x132aae){if(!_0x132aae){_0x4b41f8[_0x5e0d('0xb')](0x194);}return _0x132aae;};}function handleError(_0x2cf370,_0x1cda98){_0x1cda98=_0x1cda98||0x1f4;return function(_0x419d19){logger[_0x5e0d('0x19')](_0x419d19[_0x5e0d('0x1a')]);if(_0x419d19[_0x5e0d('0x1b')]){delete _0x419d19['name'];}_0x2cf370[_0x5e0d('0xc')](_0x1cda98)['send'](_0x419d19);};}exports[_0x5e0d('0x1c')]=function(_0xdd7758,_0x43a146){var _0x59bb04={};var _0x2c3aea={'count':0x0,'rows':[]};var _0x17c97d=_[_0x5e0d('0x1d')](db[_0x5e0d('0x1e')]['rawAttributes'],function(_0x547132){return{'name':_0x547132['fieldName'],'type':_0x547132[_0x5e0d('0x1f')][_0x5e0d('0x20')]};});_0x59bb04=qs[_0x5e0d('0x21')](_0x17c97d,_0xdd7758);var _0x5a902e={'where':_0x59bb04[_0x5e0d('0x22')]};return db[_0x5e0d('0x1e')][_0x5e0d('0xf')](_0x5a902e)[_0x5e0d('0x13')](function(_0xf7031c){_0x2c3aea[_0x5e0d('0xf')]=_0xf7031c;_0x59bb04['include']=qs['include'](_0xdd7758[_0x5e0d('0x23')]);return db[_0x5e0d('0x1e')][_0x5e0d('0x24')](_0x59bb04);})[_0x5e0d('0x13')](function(_0x4ad899){_0x2c3aea[_0x5e0d('0x25')]=_0x4ad899;return _0x2c3aea;})['then'](respondWithFilteredResult(_0x43a146,_0x59bb04))[_0x5e0d('0x26')](handleError(_0x43a146,null));};exports[_0x5e0d('0x27')]=function(_0x45f1d3,_0xcd0691){var _0xf1ab80={'raw':!![],'where':{'id':_0x45f1d3['params']['id']}},_0x594ce0={};_0x594ce0[_0x5e0d('0x28')]=_[_0x5e0d('0x29')](db[_0x5e0d('0x1e')]['rawAttributes']);_0x594ce0['query']=_['keys'](_0x45f1d3['query']);_0x594ce0[_0x5e0d('0x2a')]=_['intersection'](_0x594ce0['model'],_0x594ce0[_0x5e0d('0x23')]);_0xf1ab80['attributes']=_[_0x5e0d('0x2b')](_0x594ce0['model'],qs[_0x5e0d('0x2c')](_0x45f1d3[_0x5e0d('0x23')][_0x5e0d('0x2c')]));_0xf1ab80[_0x5e0d('0x2d')]=_0xf1ab80['attributes'][_0x5e0d('0x2e')]?_0xf1ab80[_0x5e0d('0x2d')]:_0x594ce0[_0x5e0d('0x28')];if(_0x45f1d3[_0x5e0d('0x23')][_0x5e0d('0x2f')]){_0xf1ab80['include']=[{'all':!![]}];}_0xf1ab80=_[_0x5e0d('0x30')]({},_0xf1ab80,_0x45f1d3[_0x5e0d('0x31')]);return db[_0x5e0d('0x1e')][_0x5e0d('0x32')](_0xf1ab80)['then'](handleEntityNotFound(_0xcd0691,null))['then'](respondWithResult(_0xcd0691,null))[_0x5e0d('0x26')](handleError(_0xcd0691,null));};exports[_0x5e0d('0x33')]=function(_0x939535,_0x2e7ac0){return db['OpenchannelQueue'][_0x5e0d('0x33')](_0x939535[_0x5e0d('0x34')],{})[_0x5e0d('0x13')](function(_0x1dc65f){var _0x3dece2=_0x939535[_0x5e0d('0x35')]['get']({'plain':!![]});if(!_0x3dece2)throw new Error(_0x5e0d('0x36'));if(_0x3dece2[_0x5e0d('0x37')]==='user'){var _0x229ef9=_0x1dc65f[_0x5e0d('0x15')]({'plain':!![]});var _0x32319f=_0x5e0d('0x16');return db[_0x5e0d('0x38')][_0x5e0d('0x32')]({'where':{'name':_0x32319f,'userProfileId':_0x3dece2[_0x5e0d('0x39')]},'raw':!![]})[_0x5e0d('0x13')](function(_0x57d2ee){if(_0x57d2ee&&_0x57d2ee[_0x5e0d('0x3a')]===0x0){return db[_0x5e0d('0x17')][_0x5e0d('0x33')]({'name':_0x229ef9[_0x5e0d('0x1b')],'resourceId':_0x229ef9['id'],'type':_0x57d2ee[_0x5e0d('0x1b')],'sectionId':_0x57d2ee['id']},{})[_0x5e0d('0x13')](function(){return _0x1dc65f;});}else{return _0x1dc65f;}})[_0x5e0d('0x26')](function(_0x1d1d02){logger[_0x5e0d('0x19')](_0x5e0d('0x3b'),_0x1d1d02);throw _0x1d1d02;});}return _0x1dc65f;})[_0x5e0d('0x13')](respondWithResult(_0x2e7ac0,0xc9))[_0x5e0d('0x26')](handleError(_0x2e7ac0,null));};exports[_0x5e0d('0x12')]=function(_0x56ea69,_0x5751f2){if(_0x56ea69[_0x5e0d('0x34')]['id']){delete _0x56ea69[_0x5e0d('0x34')]['id'];}return db[_0x5e0d('0x1e')][_0x5e0d('0x32')]({'where':{'id':_0x56ea69[_0x5e0d('0x3c')]['id']}})[_0x5e0d('0x13')](handleEntityNotFound(_0x5751f2,null))[_0x5e0d('0x13')](saveUpdates(_0x56ea69[_0x5e0d('0x34')],null))['then'](respondWithResult(_0x5751f2,null))[_0x5e0d('0x26')](handleError(_0x5751f2,null));};exports[_0x5e0d('0x14')]=function(_0x5952c6,_0x4cdddd){return db[_0x5e0d('0x1e')]['find']({'where':{'id':_0x5952c6[_0x5e0d('0x3c')]['id']}})[_0x5e0d('0x13')](handleEntityNotFound(_0x4cdddd,null))['then'](removeEntity(_0x4cdddd,null))[_0x5e0d('0x26')](handleError(_0x4cdddd,null));};exports[_0x5e0d('0x3d')]=function(_0x34c56f,_0xce6526){return db[_0x5e0d('0x1e')][_0x5e0d('0x3d')]()['then'](respondWithResult(_0xce6526,null))[_0x5e0d('0x26')](handleError(_0xce6526,null));};exports['getMembers']=function(_0x35df39,_0x3f17f9){var _0x519a39={'raw':!![],'where':{}},_0x24cc4e={},_0x2d9bc9;return db[_0x5e0d('0x1e')][_0x5e0d('0x3e')]({'where':{'id':_0x35df39['params']['id']}})[_0x5e0d('0x13')](handleEntityNotFound(_0x3f17f9,null))[_0x5e0d('0x13')](function(_0x2f6b5c){if(_0x2f6b5c){_0x2d9bc9=_0x2f6b5c[_0x5e0d('0x15')]({'plain':!![]});_0x24cc4e[_0x5e0d('0x28')]=_[_0x5e0d('0x29')](db['UserOpenchannelQueue'][_0x5e0d('0x3f')]);_0x24cc4e[_0x5e0d('0x23')]=_[_0x5e0d('0x29')](_0x35df39[_0x5e0d('0x23')]);_0x24cc4e[_0x5e0d('0x2a')]=_[_0x5e0d('0x2b')](_0x24cc4e[_0x5e0d('0x28')],_0x24cc4e['query']);_0x519a39[_0x5e0d('0x2d')]=_['intersection'](_0x24cc4e[_0x5e0d('0x28')],qs[_0x5e0d('0x2c')](_0x35df39[_0x5e0d('0x23')][_0x5e0d('0x2c')]));_0x519a39[_0x5e0d('0x2d')]=_0x519a39[_0x5e0d('0x2d')][_0x5e0d('0x2e')]?_0x519a39[_0x5e0d('0x2d')]:_0x24cc4e[_0x5e0d('0x28')];if(!_0x35df39[_0x5e0d('0x23')][_0x5e0d('0x40')](_0x5e0d('0x41'))){_0x519a39[_0x5e0d('0x10')]=qs['limit'](_0x35df39['query'][_0x5e0d('0x10')]);_0x519a39[_0x5e0d('0xd')]=qs[_0x5e0d('0xd')](_0x35df39[_0x5e0d('0x23')]['offset']);}_0x519a39[_0x5e0d('0x42')]=qs[_0x5e0d('0x43')](_0x35df39[_0x5e0d('0x23')]['sort']);_0x519a39[_0x5e0d('0x22')]=qs['filters'](_['pick'](_0x35df39['query'],_0x24cc4e[_0x5e0d('0x2a')]));_0x519a39[_0x5e0d('0x22')][_0x5e0d('0x44')]=_0x2f6b5c['id'];if(_0x35df39['query'][_0x5e0d('0x45')]){_0x519a39['where']=_['merge'](_0x519a39[_0x5e0d('0x22')],{'$or':_['map'](_0x519a39[_0x5e0d('0x2d')],function(_0x50c5b3){var _0x230ee9={};_0x230ee9[_0x50c5b3]={'$like':'%'+_0x35df39['query']['filter']+'%'};return _0x230ee9;})});}_0x519a39=_['merge']({},_0x519a39,_0x35df39['options']);return db[_0x5e0d('0x46')][_0x5e0d('0x24')](_0x519a39);}})['then'](function(_0x1bc257){if(_0x1bc257){return db[_0x5e0d('0x47')][_0x5e0d('0x48')]({'where':{'id':_[_0x5e0d('0x1d')](_0x1bc257,_0x5e0d('0x49')),'role':_0x5e0d('0x4a')},'attributes':['id',_0x5e0d('0x1b'),_0x5e0d('0x4b'),_0x5e0d('0x4c'),_0x5e0d('0x4d')]});}})[_0x5e0d('0x13')](function(_0x520e81){if(_0x520e81){return{'count':_0x520e81['count'],'rows':_[_0x5e0d('0x1d')](_0x520e81['rows'],function(_0xb80f63){return{'membername':_0xb80f63['name'],'UserId':_0xb80f63['id'],'queue_name':_0x2d9bc9[_0x5e0d('0x1b')],'OpenchannelQueueId':_0x2d9bc9['id'],'interface':util[_0x5e0d('0x4e')](_0x5e0d('0x4f'),_0x5e0d('0x50'),_0xb80f63[_0x5e0d('0x1b')]),'penalty':0x0,'paused':_0xb80f63[_0x5e0d('0x4b')],'createdAt':_0xb80f63['createdAt'],'updatedAt':_0xb80f63[_0x5e0d('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5e0d('0x13')](respondWithFilteredResult(_0x3f17f9,_0x519a39))[_0x5e0d('0x26')](handleError(_0x3f17f9,null));};exports[_0x5e0d('0x51')]=function(_0x281e83,_0x504397){var _0x29e567={};var _0x56f31b={};var _0x51c8cf;var _0x441baf;return db[_0x5e0d('0x1e')][_0x5e0d('0x3e')]({'where':{'id':_0x281e83[_0x5e0d('0x3c')]['id']}})[_0x5e0d('0x13')](handleEntityNotFound(_0x504397,null))['then'](function(_0x1cf8e9){if(_0x1cf8e9){_0x51c8cf=_0x1cf8e9;_0x56f31b[_0x5e0d('0x28')]=_[_0x5e0d('0x29')](db[_0x5e0d('0x52')][_0x5e0d('0x3f')]);_0x56f31b[_0x5e0d('0x23')]=_[_0x5e0d('0x29')](_0x281e83['query']);_0x56f31b[_0x5e0d('0x2a')]=_[_0x5e0d('0x2b')](_0x56f31b[_0x5e0d('0x28')],_0x56f31b[_0x5e0d('0x23')]);_0x29e567['attributes']=_[_0x5e0d('0x2b')](_0x56f31b[_0x5e0d('0x28')],qs[_0x5e0d('0x2c')](_0x281e83['query'][_0x5e0d('0x2c')]));_0x29e567['attributes']=_0x29e567[_0x5e0d('0x2d')][_0x5e0d('0x2e')]?_0x29e567['attributes']:_0x56f31b[_0x5e0d('0x28')];_0x29e567[_0x5e0d('0x42')]=qs[_0x5e0d('0x43')](_0x281e83[_0x5e0d('0x23')]['sort']);_0x29e567['where']=qs[_0x5e0d('0x2a')](_[_0x5e0d('0x53')](_0x281e83[_0x5e0d('0x23')],_0x56f31b['filters']));if(_0x281e83[_0x5e0d('0x23')]['filter']){_0x29e567[_0x5e0d('0x22')]=_['merge'](_0x29e567[_0x5e0d('0x22')],{'$or':_[_0x5e0d('0x1d')](_0x29e567[_0x5e0d('0x2d')],function(_0x26e71b){var _0x119f37={};_0x119f37[_0x26e71b]={'$like':'%'+_0x281e83[_0x5e0d('0x23')]['filter']+'%'};return _0x119f37;})});}_0x29e567=_['merge']({},_0x29e567,_0x281e83[_0x5e0d('0x31')]);return _0x51c8cf['getTeams'](_0x29e567);}})[_0x5e0d('0x13')](function(_0x4d3c86){if(_0x4d3c86){_0x441baf=_0x4d3c86['length'];if(!_0x281e83[_0x5e0d('0x23')][_0x5e0d('0x40')](_0x5e0d('0x41'))){_0x29e567[_0x5e0d('0x10')]=qs[_0x5e0d('0x10')](_0x281e83['query']['limit']);_0x29e567[_0x5e0d('0xd')]=qs[_0x5e0d('0xd')](_0x281e83['query'][_0x5e0d('0xd')]);}return _0x51c8cf[_0x5e0d('0x51')](_0x29e567);}})[_0x5e0d('0x13')](function(_0x56edbe){if(_0x56edbe){return _0x56edbe?{'count':_0x441baf,'rows':_0x56edbe}:null;}})[_0x5e0d('0x13')](respondWithResult(_0x504397,null))[_0x5e0d('0x26')](handleError(_0x504397,null));};exports[_0x5e0d('0x54')]=function(_0x384707,_0x131340){var _0x19ac0f=_0x384707[_0x5e0d('0x34')][_0x5e0d('0x55')];return db[_0x5e0d('0x52')][_0x5e0d('0x24')]({'where':{'id':_0x19ac0f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5e0d('0x56'),'attributes':['id',_0x5e0d('0x1b'),_0x5e0d('0x57'),_0x5e0d('0x58'),'interface'],'raw':!![]}]})['then'](function(_0x2bf17d){if(_0x2bf17d){var _0x1d7d3f=_['flatMap'](_0x2bf17d,function(_0x5bfea4){var _0x5abecc=_0x5bfea4[_0x5e0d('0x15')]({'plain':!![]});return _0x5abecc['Agents'];});return db[_0x5e0d('0x1e')]['find']({'where':{'id':_0x384707[_0x5e0d('0x3c')]['id']}})[_0x5e0d('0x13')](function(_0xc092ec){return db[_0x5e0d('0x59')][_0x5e0d('0x5a')](function(_0x481d06){return _0xc092ec['addTeams'](_0x19ac0f,{'transaction':_0x481d06})[_0x5e0d('0x13')](function(){return BPromise[_0x5e0d('0x5b')](_0x1d7d3f,function(_0x4cc18a){return db[_0x5e0d('0x46')]['findOrCreate']({'where':{'UserId':_0x4cc18a['id'],'OpenchannelQueueId':_0x384707['params']['id']},'transaction':_0x481d06});});})[_0x5e0d('0x13')](function(){_0x1d7d3f[_0x5e0d('0x5c')](function(_0x60019c){socket[_0x5e0d('0x5d')](_0x5e0d('0x5e'),{'UserId':_0x60019c['id'],'OpenchannelQueueId':_0xc092ec['id']});});});});});}})[_0x5e0d('0x13')](respondWithStatusCode(_0x131340,null))[_0x5e0d('0x26')](handleError(_0x131340,null));};exports[_0x5e0d('0x5f')]=function(_0x584d10,_0xef4dea){return db['Team'][_0x5e0d('0x24')]({'where':{'id':_0x584d10['query'][_0x5e0d('0x55')]},'attributes':['id'],'include':[{'model':db[_0x5e0d('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5e0d('0x13')](handleEntityNotFound(_0xef4dea,null))['then'](function(_0x569c24){var _0x4c0f2e=_['map'](_0x569c24,'id');var _0xb0b901=[];var _0x16424f=[];var _0x329594=squel[_0x5e0d('0x60')]();_0x329594[_0x5e0d('0x61')]('tq.TeamId')[_0x5e0d('0x62')]('team_has_openchannel_queues','tq')['join']('user_has_teams','ut',_0x5e0d('0x63'))[_0x5e0d('0x22')](_0x5e0d('0x64'),_0x584d10['params']['id']);for(var _0x3de0b1=0x0;_0x3de0b1<_0x569c24['length'];_0x3de0b1+=0x1){let _0x2b00ab=_0x569c24[_0x3de0b1];for(var _0x678fce=0x0;_0x678fce<_0x2b00ab[_0x5e0d('0x56')][_0x5e0d('0x2e')];_0x678fce+=0x1){let _0x3c1842=_0x2b00ab[_0x5e0d('0x56')][_0x678fce];var _0x5b8d1d=_0x329594[_0x5e0d('0x65')]();_0x5b8d1d[_0x5e0d('0x22')](_0x5e0d('0x66'),_0x3c1842['id']);_0x16424f[_0x5e0d('0x67')](db['sequelize'][_0x5e0d('0x23')](_0x5b8d1d['toString'](),{'type':db[_0x5e0d('0x59')][_0x5e0d('0x68')][_0x5e0d('0x69')]})[_0x5e0d('0x13')](function(_0x138f92){if(_0x138f92[_0x5e0d('0x2e')]===0x1){return _0x3c1842['id'];}else{var _0x3e1c77=_['every'](_[_0x5e0d('0x1d')](_0x138f92,_0x5e0d('0x6a')),function(_0x113452){return _[_0x5e0d('0x6b')](_0x4c0f2e,_0x113452);});if(_0x3e1c77){return _0x3c1842['id'];}}}));}}return BPromise[_0x5e0d('0x6c')](_0x16424f)[_0x5e0d('0x13')](function(_0x5cc8f9){_0xb0b901=_(_0xb0b901)[_0x5e0d('0x6d')](_0x5cc8f9)[_0x5e0d('0x6e')]()['value']();return db[_0x5e0d('0x1e')][_0x5e0d('0x32')]({'where':{'id':_0x584d10[_0x5e0d('0x3c')]['id']}})['then'](function(_0x2d37bc){return db[_0x5e0d('0x59')][_0x5e0d('0x5a')](function(_0x2ed241){return _0x2d37bc[_0x5e0d('0x5f')](_0x584d10['query']['ids'],{'transaction':_0x2ed241})[_0x5e0d('0x13')](function(){if(!_[_0x5e0d('0x6f')](_0xb0b901)){return _0x2d37bc[_0x5e0d('0x70')](_0xb0b901,{'transaction':_0x2ed241});}})[_0x5e0d('0x13')](function(){_0xb0b901[_0x5e0d('0x5c')](function(_0x527a29){socket[_0x5e0d('0x5d')](_0x5e0d('0x71'),{'UserId':_0x527a29,'OpenchannelQueueId':_0x2d37bc['id']});});});});});});})[_0x5e0d('0x13')](respondWithStatusCode(_0xef4dea,null))[_0x5e0d('0x26')](handleError(_0xef4dea,null));};exports[_0x5e0d('0x72')]=function(_0x2b0095,_0x3298c8){return db[_0x5e0d('0x1e')]['find']({'where':{'id':_0x2b0095[_0x5e0d('0x3c')]['id']}})[_0x5e0d('0x13')](handleEntityNotFound(_0x3298c8,null))[_0x5e0d('0x13')](function(_0x3f0cc5){if(_0x3f0cc5){return _0x3f0cc5[_0x5e0d('0x72')](_0x2b0095['body'][_0x5e0d('0x55')],_[_0x5e0d('0x73')](_0x2b0095[_0x5e0d('0x34')],[_0x5e0d('0x55'),'id'])||{})['spread'](function(_0xa454cd){for(var _0x50a9d9=0x0;_0x50a9d9<_0x2b0095[_0x5e0d('0x34')][_0x5e0d('0x55')]['length'];_0x50a9d9+=0x1){socket[_0x5e0d('0x5d')](_0x5e0d('0x5e'),{'UserId':Number(_0x2b0095['body'][_0x5e0d('0x55')][_0x50a9d9]),'OpenchannelQueueId':Number(_0x2b0095['params']['id'])});}return _0xa454cd;});}})[_0x5e0d('0x13')](respondWithResult(_0x3298c8,null))[_0x5e0d('0x26')](handleError(_0x3298c8,null));};exports[_0x5e0d('0x70')]=function(_0xd98b55,_0x11dec9){return db[_0x5e0d('0x1e')][_0x5e0d('0x32')]({'where':{'id':_0xd98b55[_0x5e0d('0x3c')]['id']}})['then'](handleEntityNotFound(_0x11dec9,null))[_0x5e0d('0x13')](function(_0x298764){if(_0x298764){return _0x298764[_0x5e0d('0x70')](_0xd98b55[_0x5e0d('0x23')][_0x5e0d('0x55')])[_0x5e0d('0x13')](function(){if(_[_0x5e0d('0x74')](_0xd98b55[_0x5e0d('0x23')][_0x5e0d('0x55')])){for(var _0x5307b3=0x0;_0x5307b3<_0xd98b55[_0x5e0d('0x23')][_0x5e0d('0x55')][_0x5e0d('0x2e')];_0x5307b3+=0x1){socket[_0x5e0d('0x5d')](_0x5e0d('0x71'),{'UserId':Number(_0xd98b55[_0x5e0d('0x23')][_0x5e0d('0x55')][_0x5307b3]),'OpenchannelQueueId':Number(_0xd98b55[_0x5e0d('0x3c')]['id'])});}}else{socket[_0x5e0d('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0xd98b55[_0x5e0d('0x23')][_0x5e0d('0x55')]),'OpenchannelQueueId':Number(_0xd98b55[_0x5e0d('0x3c')]['id'])});}});}})['then'](respondWithStatusCode(_0x11dec9,null))[_0x5e0d('0x26')](handleError(_0x11dec9,null));};exports[_0x5e0d('0x75')]=function(_0x1cc04c,_0xcf0fb1){var _0x2d164d={};var _0x249f20={};var _0xf0bb28;var _0x172044;return db[_0x5e0d('0x1e')][_0x5e0d('0x3e')]({'where':{'id':_0x1cc04c[_0x5e0d('0x3c')]['id']}})[_0x5e0d('0x13')](handleEntityNotFound(_0xcf0fb1,null))['then'](function(_0x46cbe9){if(_0x46cbe9){_0xf0bb28=_0x46cbe9;_0x249f20[_0x5e0d('0x28')]=_[_0x5e0d('0x29')](db[_0x5e0d('0x47')]['rawAttributes']);_0x249f20[_0x5e0d('0x23')]=_[_0x5e0d('0x29')](_0x1cc04c[_0x5e0d('0x23')]);_0x249f20[_0x5e0d('0x2a')]=_[_0x5e0d('0x2b')](_0x249f20[_0x5e0d('0x28')],_0x249f20[_0x5e0d('0x23')]);_0x2d164d['attributes']=_[_0x5e0d('0x2b')](_0x249f20[_0x5e0d('0x28')],qs[_0x5e0d('0x2c')](_0x1cc04c[_0x5e0d('0x23')][_0x5e0d('0x2c')]));_0x2d164d[_0x5e0d('0x2d')]=_0x2d164d['attributes'][_0x5e0d('0x2e')]?_0x2d164d[_0x5e0d('0x2d')]:_0x249f20[_0x5e0d('0x28')];_0x2d164d[_0x5e0d('0x42')]=qs[_0x5e0d('0x43')](_0x1cc04c[_0x5e0d('0x23')][_0x5e0d('0x43')]);_0x2d164d[_0x5e0d('0x22')]=qs[_0x5e0d('0x2a')](_[_0x5e0d('0x53')](_0x1cc04c[_0x5e0d('0x23')],_0x249f20[_0x5e0d('0x2a')]));if(_0x1cc04c[_0x5e0d('0x23')][_0x5e0d('0x45')]){_0x2d164d[_0x5e0d('0x22')]=_['merge'](_0x2d164d[_0x5e0d('0x22')],{'$or':_['map'](_0x2d164d[_0x5e0d('0x2d')],function(_0x7dc648){var _0x5a0970={};_0x5a0970[_0x7dc648]={'$like':'%'+_0x1cc04c[_0x5e0d('0x23')][_0x5e0d('0x45')]+'%'};return _0x5a0970;})});}_0x2d164d=_[_0x5e0d('0x30')]({},_0x2d164d,_0x1cc04c[_0x5e0d('0x31')]);return _0xf0bb28['getAgents'](_0x2d164d);}})[_0x5e0d('0x13')](function(_0x503106){if(_0x503106){_0x172044=_0x503106[_0x5e0d('0x2e')];if(!_0x1cc04c[_0x5e0d('0x23')][_0x5e0d('0x40')](_0x5e0d('0x41'))){_0x2d164d[_0x5e0d('0x10')]=qs[_0x5e0d('0x10')](_0x1cc04c[_0x5e0d('0x23')][_0x5e0d('0x10')]);_0x2d164d[_0x5e0d('0xd')]=qs['offset'](_0x1cc04c['query'][_0x5e0d('0xd')]);}return _0xf0bb28['getAgents'](_0x2d164d);}})['then'](function(_0x4903e5){if(_0x4903e5){return _0x4903e5?{'count':_0x172044,'rows':_0x4903e5}:null;}})['then'](respondWithResult(_0xcf0fb1,null))[_0x5e0d('0x26')](handleError(_0xcf0fb1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 71913d6..50f3b9c 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 _0x3ba7=['OpenchannelQueue','setMaxListeners','save','update','emit','exports','events','../../mysqldb'];(function(_0xecb894,_0x32d161){var _0x9e8ba6=function(_0x754078){while(--_0x754078){_0xecb894['push'](_0xecb894['shift']());}};_0x9e8ba6(++_0x32d161);}(_0x3ba7,0xce));var _0x73ba=function(_0x287b91,_0x33f0bf){_0x287b91=_0x287b91-0x0;var _0x427b98=_0x3ba7[_0x287b91];return _0x427b98;};'use strict';var EventEmitter=require(_0x73ba('0x0'));var OpenchannelQueue=require(_0x73ba('0x1'))['db'][_0x73ba('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x73ba('0x3')](0x0);var events={'afterCreate':_0x73ba('0x4'),'afterUpdate':_0x73ba('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2387a0){return function(_0x261d03,_0x539509,_0x257a01){OpenchannelQueueEvents[_0x73ba('0x6')](_0x2387a0+':'+_0x261d03['id'],_0x261d03);OpenchannelQueueEvents['emit'](_0x2387a0,_0x261d03);_0x257a01(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x73ba('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7aaf=['hook','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x4e93ff,_0x59c46b){var _0x3fb0c9=function(_0x547d43){while(--_0x547d43){_0x4e93ff['push'](_0x4e93ff['shift']());}};_0x3fb0c9(++_0x59c46b);}(_0x7aaf,0x199));var _0xf7aa=function(_0x4af275,_0x2ac11f){_0x4af275=_0x4af275-0x0;var _0x36cd28=_0x7aaf[_0x4af275];return _0x36cd28;};'use strict';var EventEmitter=require(_0xf7aa('0x0'));var OpenchannelQueue=require(_0xf7aa('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf7aa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf7aa('0x3'),'afterDestroy':'remove'};function emitEvent(_0xa9010b){return function(_0x49f97e,_0x561d06,_0x387bac){OpenchannelQueueEvents[_0xf7aa('0x4')](_0xa9010b+':'+_0x49f97e['id'],_0x49f97e);OpenchannelQueueEvents[_0xf7aa('0x4')](_0xa9010b,_0x49f97e);_0x387bac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xf7aa('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8df30ff..f18dfc7 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 _0xed52=['openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x1f6775,_0x46110c){var _0x908991=function(_0xb14de1){while(--_0xb14de1){_0x1f6775['push'](_0x1f6775['shift']());}};_0x908991(++_0x46110c);}(_0xed52,0x1a5));var _0x2ed5=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xed52[_0x257642];return _0x3d813b;};'use strict';var _=require(_0x2ed5('0x0'));var util=require(_0x2ed5('0x1'));var logger=require(_0x2ed5('0x2'))(_0x2ed5('0x3'));var moment=require(_0x2ed5('0x4'));var BPromise=require(_0x2ed5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ed5('0x6'));var rimraf=require(_0x2ed5('0x7'));var config=require(_0x2ed5('0x8'));var attributes=require(_0x2ed5('0x9'));module[_0x2ed5('0xa')]=function(_0x2f678f,_0x1a3ed6){return _0x2f678f[_0x2ed5('0xb')](_0x2ed5('0xc'),attributes,{'tableName':_0x2ed5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x870c=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x370852,_0x2c7e62){var _0x40cc7e=function(_0x34a439){while(--_0x34a439){_0x370852['push'](_0x370852['shift']());}};_0x40cc7e(++_0x2c7e62);}(_0x870c,0xad));var _0xc870=function(_0x2dd96f,_0x2b3249){_0x2dd96f=_0x2dd96f-0x0;var _0x43b6db=_0x870c[_0x2dd96f];return _0x43b6db;};'use strict';var _=require(_0xc870('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc870('0x1'));var moment=require(_0xc870('0x2'));var BPromise=require('bluebird');var rp=require(_0xc870('0x3'));var fs=require('fs');var path=require(_0xc870('0x4'));var rimraf=require(_0xc870('0x5'));var config=require(_0xc870('0x6'));var attributes=require(_0xc870('0x7'));module[_0xc870('0x8')]=function(_0x16bd7a,_0x287787){return _0x16bd7a[_0xc870('0x9')](_0xc870('0xa'),attributes,{'tableName':_0xc870('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 985524e..4983548 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 _0x763b=['defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','OpenchannelQueue,\x20%s,\x20%s','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','catch','ShowOpenchannelQueue','find','raw','then','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x763b,0xe2));var _0xb763=function(_0x656bba,_0x272515){_0x656bba=_0x656bba-0x0;var _0x619253=_0x763b[_0x656bba];return _0x619253;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb763('0x0'));var rs=require(_0xb763('0x1'));var fs=require('fs');var Redis=require(_0xb763('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb763('0x3'));var logger=require(_0xb763('0x4'))(_0xb763('0x5'));var config=require('../../config/environment');var jayson=require(_0xb763('0x6'));var client=jayson['client'][_0xb763('0x7')]({'port':0x232a});config['redis']=_[_0xb763('0x8')](config[_0xb763('0x9')],{'host':_0xb763('0xa'),'port':0x18eb});var socket=require(_0xb763('0xb'))(new Redis(config['redis']));require(_0xb763('0xc'))[_0xb763('0xd')](socket);function respondWithRpcPromise(_0x365624,_0xce8e76,_0x32c499){return new BPromise(function(_0x196ca4,_0x55c4bd){return client[_0xb763('0xe')](_0x365624,_0x32c499)['then'](function(_0x523a63){logger[_0xb763('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0xce8e76,'request\x20sent');logger[_0xb763('0x10')](_0xb763('0x11'),_0xce8e76,_0xb763('0x12'),JSON[_0xb763('0x13')](_0x523a63));if(_0x523a63[_0xb763('0x14')]){if(_0x523a63[_0xb763('0x14')]['code']===0x1f4){logger[_0xb763('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0xce8e76,_0x523a63['error'][_0xb763('0x15')]);return _0x55c4bd(_0x523a63[_0xb763('0x14')][_0xb763('0x15')]);}logger['error'](_0xb763('0x16'),_0xce8e76,_0x523a63[_0xb763('0x14')][_0xb763('0x15')]);return _0x196ca4(_0x523a63[_0xb763('0x14')]['message']);}else{logger[_0xb763('0xf')](_0xb763('0x16'),_0xce8e76,'request\x20sent');_0x196ca4(_0x523a63[_0xb763('0x17')][_0xb763('0x15')]);}})['catch'](function(_0x4ce2d4){logger[_0xb763('0x14')](_0xb763('0x16'),_0xce8e76,_0x4ce2d4);_0x55c4bd(_0x4ce2d4);});});}exports[_0xb763('0x18')]=function(_0x15e123){var _0x2f7d7c=this;return new Promise(function(_0x567f48,_0x14c6b9){return db[_0xb763('0x19')][_0xb763('0x1a')]({'raw':_0x15e123[_0xb763('0x1b')]?_0x15e123[_0xb763('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x15e123[_0xb763('0x1b')]?_0x15e123[_0xb763('0x1b')][_0xb763('0x1c')]||null:null,'attributes':_0x15e123[_0xb763('0x1b')]?_0x15e123['options'][_0xb763('0x1d')]||null:null,'limit':_0x15e123[_0xb763('0x1b')]?_0x15e123[_0xb763('0x1b')][_0xb763('0x1e')]||null:null,'include':_0x15e123['options']?_0x15e123[_0xb763('0x1b')][_0xb763('0x1f')]?_[_0xb763('0x20')](_0x15e123[_0xb763('0x1b')][_0xb763('0x1f')],function(_0x188356){return{'model':db[_0x188356['model']],'as':_0x188356['as'],'attributes':_0x188356[_0xb763('0x1d')],'include':_0x188356[_0xb763('0x1f')]?_['map'](_0x188356[_0xb763('0x1f')],function(_0x4d3144){return{'model':db[_0x4d3144[_0xb763('0x21')]],'as':_0x4d3144['as'],'attributes':_0x4d3144[_0xb763('0x1d')],'include':_0x4d3144[_0xb763('0x1f')]?_[_0xb763('0x20')](_0x4d3144[_0xb763('0x1f')],function(_0x2fa778){return{'model':db[_0x2fa778[_0xb763('0x21')]],'as':_0x2fa778['as'],'attributes':_0x2fa778[_0xb763('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45cf7a){logger[_0xb763('0xf')]('GetOpenchannelQueue',_0x15e123);logger[_0xb763('0x10')](_0xb763('0x18'),_0x15e123,JSON['stringify'](_0x45cf7a));_0x567f48(_0x45cf7a);})[_0xb763('0x22')](function(_0x2f83eb){logger['error']('GetOpenchannelQueue',_0x2f83eb[_0xb763('0x15')],_0x15e123);_0x14c6b9(_0x2f7d7c[_0xb763('0x14')](0x1f4,_0x2f83eb[_0xb763('0x15')]));});});};exports[_0xb763('0x23')]=function(_0x4c19c6){var _0x485a86=this;return new Promise(function(_0x5a3885,_0x3cd602){return db[_0xb763('0x19')][_0xb763('0x24')]({'raw':_0x4c19c6[_0xb763('0x1b')]?_0x4c19c6[_0xb763('0x1b')][_0xb763('0x25')]===undefined?!![]:![]:!![],'where':_0x4c19c6['options']?_0x4c19c6['options'][_0xb763('0x1c')]||null:null,'attributes':_0x4c19c6[_0xb763('0x1b')]?_0x4c19c6[_0xb763('0x1b')][_0xb763('0x1d')]||null:null,'include':_0x4c19c6[_0xb763('0x1b')]?_0x4c19c6[_0xb763('0x1b')][_0xb763('0x1f')]?_[_0xb763('0x20')](_0x4c19c6['options']['include'],function(_0x3ef30e){return{'model':db[_0x3ef30e[_0xb763('0x21')]],'as':_0x3ef30e['as'],'attributes':_0x3ef30e[_0xb763('0x1d')],'include':_0x3ef30e['include']?_['map'](_0x3ef30e['include'],function(_0x17f98e){return{'model':db[_0x17f98e[_0xb763('0x21')]],'as':_0x17f98e['as'],'attributes':_0x17f98e[_0xb763('0x1d')],'include':_0x17f98e[_0xb763('0x1f')]?_[_0xb763('0x20')](_0x17f98e[_0xb763('0x1f')],function(_0x3a9102){return{'model':db[_0x3a9102[_0xb763('0x21')]],'as':_0x3a9102['as'],'attributes':_0x3a9102[_0xb763('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb763('0x26')](function(_0x3f4ead){logger[_0xb763('0xf')]('ShowOpenchannelQueue',_0x4c19c6);logger['debug'](_0xb763('0x23'),_0x4c19c6,JSON[_0xb763('0x13')](_0x3f4ead));_0x5a3885(_0x3f4ead);})[_0xb763('0x22')](function(_0x17da23){logger['error'](_0xb763('0x23'),_0x17da23['message'],_0x4c19c6);_0x3cd602(_0x485a86[_0xb763('0x14')](0x1f4,_0x17da23['message']));});});}; \ No newline at end of file +var _0x38ce=['code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowOpenchannelQueue','find','lodash','util','bluebird','ioredis','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x38ce,0xa1));var _0xe38c=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x38ce[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xe38c('0x0'));var util=require(_0xe38c('0x1'));var moment=require('moment');var BPromise=require(_0xe38c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe38c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe38c('0x4'));var config=require(_0xe38c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe38c('0x6')][_0xe38c('0x7')]({'port':0x232a});config[_0xe38c('0x8')]=_[_0xe38c('0x9')](config[_0xe38c('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe38c('0xa'))(new Redis(config[_0xe38c('0x8')]));require('./openchannelQueue.socket')[_0xe38c('0xb')](socket);function respondWithRpcPromise(_0x5186e8,_0x3b089a,_0x4236e3){return new BPromise(function(_0x376f4a,_0x492365){return client[_0xe38c('0xc')](_0x5186e8,_0x4236e3)['then'](function(_0x369daa){logger[_0xe38c('0xd')](_0xe38c('0xe'),_0x3b089a,_0xe38c('0xf'));logger[_0xe38c('0x10')](_0xe38c('0x11'),_0x3b089a,_0xe38c('0xf'),JSON['stringify'](_0x369daa));if(_0x369daa[_0xe38c('0x12')]){if(_0x369daa[_0xe38c('0x12')][_0xe38c('0x13')]===0x1f4){logger[_0xe38c('0x12')](_0xe38c('0xe'),_0x3b089a,_0x369daa[_0xe38c('0x12')][_0xe38c('0x14')]);return _0x492365(_0x369daa[_0xe38c('0x12')][_0xe38c('0x14')]);}logger[_0xe38c('0x12')](_0xe38c('0xe'),_0x3b089a,_0x369daa[_0xe38c('0x12')]['message']);return _0x376f4a(_0x369daa[_0xe38c('0x12')][_0xe38c('0x14')]);}else{logger[_0xe38c('0xd')](_0xe38c('0xe'),_0x3b089a,_0xe38c('0xf'));_0x376f4a(_0x369daa['result'][_0xe38c('0x14')]);}})[_0xe38c('0x15')](function(_0x209014){logger[_0xe38c('0x12')](_0xe38c('0xe'),_0x3b089a,_0x209014);_0x492365(_0x209014);});});}exports[_0xe38c('0x16')]=function(_0x5a566e){var _0x52d51f=this;return new Promise(function(_0x23fefa,_0x46628f){return db[_0xe38c('0x17')][_0xe38c('0x18')]({'raw':_0x5a566e[_0xe38c('0x19')]?_0x5a566e['options'][_0xe38c('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a566e[_0xe38c('0x19')]?_0x5a566e[_0xe38c('0x19')][_0xe38c('0x1b')]||null:null,'attributes':_0x5a566e['options']?_0x5a566e[_0xe38c('0x19')][_0xe38c('0x1c')]||null:null,'limit':_0x5a566e[_0xe38c('0x19')]?_0x5a566e[_0xe38c('0x19')][_0xe38c('0x1d')]||null:null,'include':_0x5a566e['options']?_0x5a566e[_0xe38c('0x19')][_0xe38c('0x1e')]?_[_0xe38c('0x1f')](_0x5a566e[_0xe38c('0x19')][_0xe38c('0x1e')],function(_0x238d10){return{'model':db[_0x238d10['model']],'as':_0x238d10['as'],'attributes':_0x238d10['attributes'],'include':_0x238d10[_0xe38c('0x1e')]?_['map'](_0x238d10[_0xe38c('0x1e')],function(_0x395d1e){return{'model':db[_0x395d1e[_0xe38c('0x20')]],'as':_0x395d1e['as'],'attributes':_0x395d1e[_0xe38c('0x1c')],'include':_0x395d1e['include']?_[_0xe38c('0x1f')](_0x395d1e[_0xe38c('0x1e')],function(_0x2a4ac8){return{'model':db[_0x2a4ac8[_0xe38c('0x20')]],'as':_0x2a4ac8['as'],'attributes':_0x2a4ac8[_0xe38c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe38c('0x21')](function(_0x2fe9f0){logger[_0xe38c('0xd')](_0xe38c('0x16'),_0x5a566e);logger[_0xe38c('0x10')](_0xe38c('0x16'),_0x5a566e,JSON['stringify'](_0x2fe9f0));_0x23fefa(_0x2fe9f0);})[_0xe38c('0x15')](function(_0x2e068c){logger[_0xe38c('0x12')](_0xe38c('0x16'),_0x2e068c[_0xe38c('0x14')],_0x5a566e);_0x46628f(_0x52d51f[_0xe38c('0x12')](0x1f4,_0x2e068c['message']));});});};exports[_0xe38c('0x22')]=function(_0x219785){var _0x2fdd85=this;return new Promise(function(_0x505e03,_0x1d4842){return db[_0xe38c('0x17')][_0xe38c('0x23')]({'raw':_0x219785[_0xe38c('0x19')]?_0x219785[_0xe38c('0x19')][_0xe38c('0x1a')]===undefined?!![]:![]:!![],'where':_0x219785[_0xe38c('0x19')]?_0x219785[_0xe38c('0x19')]['where']||null:null,'attributes':_0x219785['options']?_0x219785['options'][_0xe38c('0x1c')]||null:null,'include':_0x219785[_0xe38c('0x19')]?_0x219785[_0xe38c('0x19')]['include']?_[_0xe38c('0x1f')](_0x219785[_0xe38c('0x19')][_0xe38c('0x1e')],function(_0x40dd11){return{'model':db[_0x40dd11[_0xe38c('0x20')]],'as':_0x40dd11['as'],'attributes':_0x40dd11[_0xe38c('0x1c')],'include':_0x40dd11[_0xe38c('0x1e')]?_[_0xe38c('0x1f')](_0x40dd11[_0xe38c('0x1e')],function(_0x6c499){return{'model':db[_0x6c499[_0xe38c('0x20')]],'as':_0x6c499['as'],'attributes':_0x6c499[_0xe38c('0x1c')],'include':_0x6c499[_0xe38c('0x1e')]?_['map'](_0x6c499[_0xe38c('0x1e')],function(_0x42f926){return{'model':db[_0x42f926[_0xe38c('0x20')]],'as':_0x42f926['as'],'attributes':_0x42f926[_0xe38c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe38c('0x21')](function(_0x475468){logger['info'](_0xe38c('0x22'),_0x219785);logger[_0xe38c('0x10')]('ShowOpenchannelQueue',_0x219785,JSON['stringify'](_0x475468));_0x505e03(_0x475468);})[_0xe38c('0x15')](function(_0x4211ac){logger[_0xe38c('0x12')](_0xe38c('0x22'),_0x4211ac['message'],_0x219785);_0x1d4842(_0x2fdd85[_0xe38c('0x12')](0x1f4,_0x4211ac['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 4987ce7..20ea7a6 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 _0xcde1=['remove','update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x19e3a6,_0xfe1776){var _0x45a9cf=function(_0x32d7b4){while(--_0x32d7b4){_0x19e3a6['push'](_0x19e3a6['shift']());}};_0x45a9cf(++_0xfe1776);}(_0xcde1,0x1b1));var _0x1cde=function(_0x40d73d,_0x107d1a){_0x40d73d=_0x40d73d-0x0;var _0x1e7882=_0xcde1[_0x40d73d];return _0x1e7882;};'use strict';var OpenchannelQueueEvents=require(_0x1cde('0x0'));var events=['save',_0x1cde('0x1'),_0x1cde('0x2')];function createListener(_0x23353b,_0x1ca8c3){return function(_0x105490){_0x1ca8c3[_0x1cde('0x3')](_0x23353b,_0x105490);};}function removeListener(_0x59239c,_0x1fce55){return function(){OpenchannelQueueEvents[_0x1cde('0x4')](_0x59239c,_0x1fce55);};}exports[_0x1cde('0x5')]=function(_0x1a4440){for(var _0x2212c0=0x0,_0xfff1de=events['length'];_0x2212c0<_0xfff1de;_0x2212c0++){var _0x3dc5e5=events[_0x2212c0];var _0x4f5b49=createListener(_0x1cde('0x6')+_0x3dc5e5,_0x1a4440);OpenchannelQueueEvents['on'](_0x3dc5e5,_0x4f5b49);}}; \ No newline at end of file +var _0x7173=['update','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x2dc375,_0x24b1d6){var _0x4e9fed=function(_0x7f55d6){while(--_0x7f55d6){_0x2dc375['push'](_0x2dc375['shift']());}};_0x4e9fed(++_0x24b1d6);}(_0x7173,0x14e));var _0x3717=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x7173[_0x7e2eb0];return _0xd92de4;};'use strict';var OpenchannelQueueEvents=require(_0x3717('0x0'));var events=[_0x3717('0x1'),'remove',_0x3717('0x2')];function createListener(_0x156699,_0x23f1a9){return function(_0x4c7aef){_0x23f1a9['emit'](_0x156699,_0x4c7aef);};}function removeListener(_0x4fe4c6,_0x5e86dc){return function(){OpenchannelQueueEvents[_0x3717('0x3')](_0x4fe4c6,_0x5e86dc);};}exports[_0x3717('0x4')]=function(_0x188884){for(var _0x15de14=0x0,_0x409b56=events[_0x3717('0x5')];_0x15de14<_0x409b56;_0x15de14++){var _0x504890=events[_0x15de14];var _0x2ebd77=createListener(_0x3717('0x6')+_0x504890,_0x188884);OpenchannelQueueEvents['on'](_0x504890,_0x2ebd77);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 8c8199b..107857a 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 _0xb28b=['../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','describe','post','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x19731e,_0x3ad3f7){var _0x4cd026=function(_0x351f83){while(--_0x351f83){_0x19731e['push'](_0x19731e['shift']());}};_0x4cd026(++_0x3ad3f7);}(_0xb28b,0x14d));var _0xbb28=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb28b[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0xbb28('0x0'));var path=require(_0xbb28('0x1'));var timeout=require(_0xbb28('0x2'));var express=require(_0xbb28('0x3'));var router=express[_0xbb28('0x4')]();var fs_extra=require(_0xbb28('0x5'));var auth=require(_0xbb28('0x6'));var interaction=require(_0xbb28('0x7'));var config=require(_0xbb28('0x8'));var controller=require(_0xbb28('0x9'));router[_0xbb28('0xa')]('/',auth[_0xbb28('0xb')](),controller['index']);router['get']('/describe',auth[_0xbb28('0xb')](),controller[_0xbb28('0xc')]);router['get']('/:id',auth[_0xbb28('0xb')](),controller['show']);router[_0xbb28('0xd')]('/',auth[_0xbb28('0xb')](),controller['create']);router[_0xbb28('0xe')]('/:id',auth[_0xbb28('0xb')](),controller[_0xbb28('0xf')]);router[_0xbb28('0x10')](_0xbb28('0x11'),auth[_0xbb28('0xb')](),controller[_0xbb28('0x12')]);module[_0xbb28('0x13')]=router; \ No newline at end of file +var _0xf11d=['exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','/:id','delete','destroy'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf11d,0x133));var _0xdf11=function(_0x475cf3,_0x30917b){_0x475cf3=_0x475cf3-0x0;var _0x3c0f1b=_0xf11d[_0x475cf3];return _0x3c0f1b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdf11('0x0'));var express=require(_0xdf11('0x1'));var router=express[_0xdf11('0x2')]();var fs_extra=require(_0xdf11('0x3'));var auth=require(_0xdf11('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdf11('0x5'));router[_0xdf11('0x6')]('/',auth[_0xdf11('0x7')](),controller['index']);router[_0xdf11('0x6')](_0xdf11('0x8'),auth[_0xdf11('0x7')](),controller[_0xdf11('0x9')]);router[_0xdf11('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xdf11('0xa')]);router[_0xdf11('0xb')]('/',auth[_0xdf11('0x7')](),controller[_0xdf11('0xc')]);router['put'](_0xdf11('0xd'),auth[_0xdf11('0x7')](),controller['update']);router[_0xdf11('0xe')](_0xdf11('0xd'),auth[_0xdf11('0x7')](),controller[_0xdf11('0xf')]);module[_0xdf11('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 64bd690..ceefd54 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 _0xb5a2=['moment','sequelize','exports','STRING','DATE'];(function(_0xa8a187,_0x29d36d){var _0x57f3e6=function(_0x55e594){while(--_0x55e594){_0xa8a187['push'](_0xa8a187['shift']());}};_0x57f3e6(++_0x29d36d);}(_0xb5a2,0x73));var _0x2b5a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb5a2[_0x21a9d9];return _0x46adce;};'use strict';var moment=require(_0x2b5a('0x0'));var Sequelize=require(_0x2b5a('0x1'));module[_0x2b5a('0x2')]={'uniqueid':{'type':Sequelize[_0x2b5a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2b5a('0x3')]},'joinAt':{'type':Sequelize[_0x2b5a('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2b5a('0x4')]},'exitAt':{'type':Sequelize[_0x2b5a('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeedf=['moment','sequelize','exports','STRING','DATE'];(function(_0x1d8fab,_0x8b632d){var _0x3542d0=function(_0x317d1d){while(--_0x317d1d){_0x1d8fab['push'](_0x1d8fab['shift']());}};_0x3542d0(++_0x8b632d);}(_0xeedf,0x12c));var _0xfeed=function(_0x1ce388,_0x29c9e1){_0x1ce388=_0x1ce388-0x0;var _0x346842=_0xeedf[_0x1ce388];return _0x346842;};'use strict';var moment=require(_0xfeed('0x0'));var Sequelize=require(_0xfeed('0x1'));module[_0xfeed('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfeed('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfeed('0x4')]},'acceptAt':{'type':Sequelize[_0xfeed('0x4')]},'exitAt':{'type':Sequelize[_0xfeed('0x4')]},'reason':{'type':Sequelize[_0xfeed('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a1c39b4..40d9fb2 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 _0x4c16=['crypto','jsforce','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4fabcc,_0x3d10cc){var _0x912b3e=function(_0x4d930f){while(--_0x4d930f){_0x4fabcc['push'](_0x4fabcc['shift']());}};_0x912b3e(++_0x3d10cc);}(_0x4c16,0x1ae));var _0x64c1=function(_0x15f43a,_0x57c8b5){_0x15f43a=_0x15f43a-0x0;var _0x2369bc=_0x4c16[_0x15f43a];return _0x2369bc;};'use strict';var emlformat=require(_0x64c1('0x0'));var rimraf=require(_0x64c1('0x1'));var zipdir=require(_0x64c1('0x2'));var jsonpatch=require(_0x64c1('0x3'));var rp=require(_0x64c1('0x4'));var moment=require('moment');var BPromise=require(_0x64c1('0x5'));var Mustache=require('mustache');var util=require(_0x64c1('0x6'));var path=require(_0x64c1('0x7'));var sox=require(_0x64c1('0x8'));var csv=require(_0x64c1('0x9'));var ejs=require(_0x64c1('0xa'));var fs=require('fs');var fs_extra=require(_0x64c1('0xb'));var _=require(_0x64c1('0xc'));var squel=require(_0x64c1('0xd'));var crypto=require(_0x64c1('0xe'));var jsforce=require(_0x64c1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x64c1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64c1('0x10'));var logger=require(_0x64c1('0x11'))(_0x64c1('0x12'));var utils=require(_0x64c1('0x13'));var config=require(_0x64c1('0x14'));var licenseUtil=require(_0x64c1('0x15'));var db=require(_0x64c1('0x16'))['db'];function respondWithStatusCode(_0x404c76,_0x42431d){_0x42431d=_0x42431d||0xcc;return function(_0x350761){if(_0x350761){return _0x404c76[_0x64c1('0x17')](_0x42431d);}return _0x404c76[_0x64c1('0x18')](_0x42431d)[_0x64c1('0x19')]();};}function respondWithResult(_0xc30c69,_0x248bc3){_0x248bc3=_0x248bc3||0xc8;return function(_0xa48ea9){if(_0xa48ea9){return _0xc30c69[_0x64c1('0x18')](_0x248bc3)['json'](_0xa48ea9);}};}function respondWithFilteredResult(_0x301c4b,_0x45f251){return function(_0x291745){if(_0x291745){var _0xb0c94e=typeof _0x45f251[_0x64c1('0x1a')]===_0x64c1('0x1b')&&typeof _0x45f251[_0x64c1('0x1c')]===_0x64c1('0x1b');var _0x28a4f8=_0x291745[_0x64c1('0x1d')];var _0x55aa26=_0xb0c94e?0x0:_0x45f251[_0x64c1('0x1a')];var _0x4fd778=_0xb0c94e?_0x291745['count']:_0x45f251[_0x64c1('0x1a')]+_0x45f251['limit'];var _0x5234f1;if(_0x4fd778>=_0x28a4f8){_0x4fd778=_0x28a4f8;_0x5234f1=0xc8;}else{_0x5234f1=0xce;}_0x301c4b['status'](_0x5234f1);return _0x301c4b[_0x64c1('0x1e')]('Content-Range',_0x55aa26+'-'+_0x4fd778+'/'+_0x28a4f8)['json'](_0x291745);}return null;};}function patchUpdates(_0x267bf5){return function(_0x2b0ba6){try{jsonpatch[_0x64c1('0x1f')](_0x2b0ba6,_0x267bf5,!![]);}catch(_0x56c7a6){return BPromise[_0x64c1('0x20')](_0x56c7a6);}return _0x2b0ba6['save']();};}function saveUpdates(_0x4753ea,_0x3d505d){return function(_0x4e123c){if(_0x4e123c){return _0x4e123c[_0x64c1('0x21')](_0x4753ea)[_0x64c1('0x22')](function(_0x13b3f4){return _0x13b3f4;});}return null;};}function removeEntity(_0x40d184,_0x124a45){return function(_0x5080b5){if(_0x5080b5){return _0x5080b5[_0x64c1('0x23')]()[_0x64c1('0x22')](function(){_0x40d184[_0x64c1('0x18')](0xcc)[_0x64c1('0x19')]();});}};}function handleEntityNotFound(_0x271f7f,_0x6f570a){return function(_0x55eba1){if(!_0x55eba1){_0x271f7f[_0x64c1('0x17')](0x194);}return _0x55eba1;};}function handleError(_0x59d4a9,_0x1be246){_0x1be246=_0x1be246||0x1f4;return function(_0x5915db){logger[_0x64c1('0x24')](_0x5915db[_0x64c1('0x25')]);if(_0x5915db[_0x64c1('0x26')]){delete _0x5915db[_0x64c1('0x26')];}_0x59d4a9[_0x64c1('0x18')](_0x1be246)[_0x64c1('0x27')](_0x5915db);};}exports['index']=function(_0x429124,_0x275a48){var _0x20cf89={},_0x49d040={},_0x59f7a7={'count':0x0,'rows':[]};var _0x541191=_[_0x64c1('0x28')](db['OpenchannelQueueReport'][_0x64c1('0x29')],function(_0x31cd64){return{'name':_0x31cd64[_0x64c1('0x2a')],'type':_0x31cd64['type'][_0x64c1('0x2b')]};});_0x49d040['model']=_['map'](_0x541191,'name');_0x49d040[_0x64c1('0x2c')]=_[_0x64c1('0x2d')](_0x429124[_0x64c1('0x2c')]);_0x49d040[_0x64c1('0x2e')]=_[_0x64c1('0x2f')](_0x49d040[_0x64c1('0x30')],_0x49d040[_0x64c1('0x2c')]);_0x20cf89[_0x64c1('0x31')]=_[_0x64c1('0x2f')](_0x49d040[_0x64c1('0x30')],qs['fields'](_0x429124[_0x64c1('0x2c')][_0x64c1('0x32')]));_0x20cf89[_0x64c1('0x31')]=_0x20cf89[_0x64c1('0x31')][_0x64c1('0x33')]?_0x20cf89[_0x64c1('0x31')]:_0x49d040[_0x64c1('0x30')];if(!_0x429124[_0x64c1('0x2c')][_0x64c1('0x34')](_0x64c1('0x35'))){_0x20cf89[_0x64c1('0x1c')]=qs['limit'](_0x429124[_0x64c1('0x2c')][_0x64c1('0x1c')]);_0x20cf89[_0x64c1('0x1a')]=qs[_0x64c1('0x1a')](_0x429124['query'][_0x64c1('0x1a')]);}_0x20cf89[_0x64c1('0x36')]=qs[_0x64c1('0x37')](_0x429124[_0x64c1('0x2c')][_0x64c1('0x37')]);_0x20cf89[_0x64c1('0x38')]=qs['filters'](_[_0x64c1('0x39')](_0x429124[_0x64c1('0x2c')],_0x49d040['filters']),_0x541191);if(_0x429124[_0x64c1('0x2c')]['filter']){_0x20cf89[_0x64c1('0x38')]=_[_0x64c1('0x3a')](_0x20cf89[_0x64c1('0x38')],{'$or':_[_0x64c1('0x28')](_0x541191,function(_0x2e1228){if(_0x2e1228[_0x64c1('0x3b')]!==_0x64c1('0x3c')){var _0x3355a9={};_0x3355a9[_0x2e1228['name']]={'$like':'%'+_0x429124[_0x64c1('0x2c')]['filter']+'%'};return _0x3355a9;}})});}_0x20cf89=_[_0x64c1('0x3a')]({},_0x20cf89,_0x429124[_0x64c1('0x3d')]);var _0x25b65e={'where':_0x20cf89[_0x64c1('0x38')]};return db[_0x64c1('0x3e')][_0x64c1('0x1d')](_0x25b65e)['then'](function(_0x6f395e){_0x59f7a7[_0x64c1('0x1d')]=_0x6f395e;if(_0x429124[_0x64c1('0x2c')][_0x64c1('0x3f')]){_0x20cf89[_0x64c1('0x40')]=[{'all':!![]}];}return db[_0x64c1('0x3e')][_0x64c1('0x41')](_0x20cf89);})[_0x64c1('0x22')](function(_0x31dcc9){_0x59f7a7[_0x64c1('0x42')]=_0x31dcc9;return _0x59f7a7;})[_0x64c1('0x22')](respondWithFilteredResult(_0x275a48,_0x20cf89))[_0x64c1('0x43')](handleError(_0x275a48,null));};exports[_0x64c1('0x44')]=function(_0x145b66,_0x3bb3ad){var _0x129fda={'raw':!![],'where':{'id':_0x145b66['params']['id']}},_0x36952a={};_0x36952a[_0x64c1('0x30')]=_[_0x64c1('0x2d')](db[_0x64c1('0x3e')][_0x64c1('0x29')]);_0x36952a[_0x64c1('0x2c')]=_[_0x64c1('0x2d')](_0x145b66[_0x64c1('0x2c')]);_0x36952a['filters']=_['intersection'](_0x36952a[_0x64c1('0x30')],_0x36952a[_0x64c1('0x2c')]);_0x129fda['attributes']=_[_0x64c1('0x2f')](_0x36952a[_0x64c1('0x30')],qs[_0x64c1('0x32')](_0x145b66['query'][_0x64c1('0x32')]));_0x129fda[_0x64c1('0x31')]=_0x129fda[_0x64c1('0x31')][_0x64c1('0x33')]?_0x129fda[_0x64c1('0x31')]:_0x36952a[_0x64c1('0x30')];if(_0x145b66[_0x64c1('0x2c')]['includeAll']){_0x129fda[_0x64c1('0x40')]=[{'all':!![]}];}_0x129fda=_[_0x64c1('0x3a')]({},_0x129fda,_0x145b66[_0x64c1('0x3d')]);return db[_0x64c1('0x3e')][_0x64c1('0x45')](_0x129fda)[_0x64c1('0x22')](handleEntityNotFound(_0x3bb3ad,null))['then'](respondWithResult(_0x3bb3ad,null))[_0x64c1('0x43')](handleError(_0x3bb3ad,null));};exports[_0x64c1('0x46')]=function(_0x225504,_0x3fe2a3){return db['OpenchannelQueueReport'][_0x64c1('0x46')](_0x225504[_0x64c1('0x47')],{})[_0x64c1('0x22')](respondWithResult(_0x3fe2a3,0xc9))[_0x64c1('0x43')](handleError(_0x3fe2a3,null));};exports[_0x64c1('0x21')]=function(_0x2ea6fa,_0x1d5b57){if(_0x2ea6fa[_0x64c1('0x47')]['id']){delete _0x2ea6fa[_0x64c1('0x47')]['id'];}return db[_0x64c1('0x3e')][_0x64c1('0x45')]({'where':{'id':_0x2ea6fa[_0x64c1('0x48')]['id']}})[_0x64c1('0x22')](handleEntityNotFound(_0x1d5b57,null))[_0x64c1('0x22')](saveUpdates(_0x2ea6fa[_0x64c1('0x47')],null))[_0x64c1('0x22')](respondWithResult(_0x1d5b57,null))[_0x64c1('0x43')](handleError(_0x1d5b57,null));};exports[_0x64c1('0x23')]=function(_0x3b34a9,_0x425029){return db[_0x64c1('0x3e')][_0x64c1('0x45')]({'where':{'id':_0x3b34a9['params']['id']}})[_0x64c1('0x22')](handleEntityNotFound(_0x425029,null))['then'](removeEntity(_0x425029,null))['catch'](handleError(_0x425029,null));};exports[_0x64c1('0x49')]=function(_0x2b190c,_0x31744e){return db[_0x64c1('0x3e')][_0x64c1('0x49')]()[_0x64c1('0x22')](respondWithResult(_0x31744e,null))[_0x64c1('0x43')](handleError(_0x31744e,null));}; \ No newline at end of file +var _0x1ad7=['merge','VIRTUAL','options','includeAll','include','findAll','show','params','attributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','where','filter'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x1ad7,0x1e2));var _0x71ad=function(_0x4be634,_0x2b1a67){_0x4be634=_0x4be634-0x0;var _0x2df900=_0x1ad7[_0x4be634];return _0x2df900;};'use strict';var emlformat=require(_0x71ad('0x0'));var rimraf=require(_0x71ad('0x1'));var zipdir=require(_0x71ad('0x2'));var jsonpatch=require(_0x71ad('0x3'));var rp=require(_0x71ad('0x4'));var moment=require('moment');var BPromise=require(_0x71ad('0x5'));var Mustache=require(_0x71ad('0x6'));var util=require(_0x71ad('0x7'));var path=require(_0x71ad('0x8'));var sox=require(_0x71ad('0x9'));var csv=require(_0x71ad('0xa'));var ejs=require(_0x71ad('0xb'));var fs=require('fs');var fs_extra=require(_0x71ad('0xc'));var _=require(_0x71ad('0xd'));var squel=require(_0x71ad('0xe'));var crypto=require(_0x71ad('0xf'));var jsforce=require(_0x71ad('0x10'));var deskjs=require(_0x71ad('0x11'));var toCsv=require(_0x71ad('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71ad('0x12'));var authService=require(_0x71ad('0x13'));var qs=require(_0x71ad('0x14'));var as=require(_0x71ad('0x15'));var hardwareService=require(_0x71ad('0x16'));var logger=require('../../config/logger')(_0x71ad('0x17'));var utils=require(_0x71ad('0x18'));var config=require(_0x71ad('0x19'));var licenseUtil=require(_0x71ad('0x1a'));var db=require(_0x71ad('0x1b'))['db'];function respondWithStatusCode(_0x38f066,_0x22ff80){_0x22ff80=_0x22ff80||0xcc;return function(_0x50f1cd){if(_0x50f1cd){return _0x38f066[_0x71ad('0x1c')](_0x22ff80);}return _0x38f066[_0x71ad('0x1d')](_0x22ff80)['end']();};}function respondWithResult(_0x2fd0ab,_0x6bb22c){_0x6bb22c=_0x6bb22c||0xc8;return function(_0x34b09b){if(_0x34b09b){return _0x2fd0ab['status'](_0x6bb22c)[_0x71ad('0x1e')](_0x34b09b);}};}function respondWithFilteredResult(_0x13e632,_0x4a386a){return function(_0x75b1dd){if(_0x75b1dd){var _0x36b0aa=typeof _0x4a386a[_0x71ad('0x1f')]===_0x71ad('0x20')&&typeof _0x4a386a[_0x71ad('0x21')]==='undefined';var _0x383796=_0x75b1dd[_0x71ad('0x22')];var _0x2a936d=_0x36b0aa?0x0:_0x4a386a[_0x71ad('0x1f')];var _0x26505a=_0x36b0aa?_0x75b1dd[_0x71ad('0x22')]:_0x4a386a[_0x71ad('0x1f')]+_0x4a386a['limit'];var _0x5b0b3d;if(_0x26505a>=_0x383796){_0x26505a=_0x383796;_0x5b0b3d=0xc8;}else{_0x5b0b3d=0xce;}_0x13e632[_0x71ad('0x1d')](_0x5b0b3d);return _0x13e632[_0x71ad('0x23')](_0x71ad('0x24'),_0x2a936d+'-'+_0x26505a+'/'+_0x383796)[_0x71ad('0x1e')](_0x75b1dd);}return null;};}function patchUpdates(_0x5b3bd1){return function(_0x49fa45){try{jsonpatch[_0x71ad('0x25')](_0x49fa45,_0x5b3bd1,!![]);}catch(_0x199de8){return BPromise[_0x71ad('0x26')](_0x199de8);}return _0x49fa45['save']();};}function saveUpdates(_0x3f75f6,_0x3709b2){return function(_0x1d1bcf){if(_0x1d1bcf){return _0x1d1bcf[_0x71ad('0x27')](_0x3f75f6)[_0x71ad('0x28')](function(_0x19599c){return _0x19599c;});}return null;};}function removeEntity(_0x57a0d7,_0xf36408){return function(_0x4f89fd){if(_0x4f89fd){return _0x4f89fd[_0x71ad('0x29')]()[_0x71ad('0x28')](function(){_0x57a0d7[_0x71ad('0x1d')](0xcc)[_0x71ad('0x2a')]();});}};}function handleEntityNotFound(_0x50a16d,_0x47a11e){return function(_0x1c27b4){if(!_0x1c27b4){_0x50a16d[_0x71ad('0x1c')](0x194);}return _0x1c27b4;};}function handleError(_0x460eff,_0x305d5c){_0x305d5c=_0x305d5c||0x1f4;return function(_0x43054c){logger['error'](_0x43054c[_0x71ad('0x2b')]);if(_0x43054c['name']){delete _0x43054c[_0x71ad('0x2c')];}_0x460eff['status'](_0x305d5c)[_0x71ad('0x2d')](_0x43054c);};}exports[_0x71ad('0x2e')]=function(_0x55b36a,_0x4dadb6){var _0x45a107={},_0x150480={},_0x5db8f5={'count':0x0,'rows':[]};var _0x51b2b0=_[_0x71ad('0x2f')](db[_0x71ad('0x30')][_0x71ad('0x31')],function(_0x19ec39){return{'name':_0x19ec39[_0x71ad('0x32')],'type':_0x19ec39[_0x71ad('0x33')]['key']};});_0x150480[_0x71ad('0x34')]=_[_0x71ad('0x2f')](_0x51b2b0,_0x71ad('0x2c'));_0x150480[_0x71ad('0x35')]=_[_0x71ad('0x36')](_0x55b36a[_0x71ad('0x35')]);_0x150480[_0x71ad('0x37')]=_[_0x71ad('0x38')](_0x150480['model'],_0x150480[_0x71ad('0x35')]);_0x45a107['attributes']=_[_0x71ad('0x38')](_0x150480['model'],qs['fields'](_0x55b36a[_0x71ad('0x35')][_0x71ad('0x39')]));_0x45a107['attributes']=_0x45a107['attributes'][_0x71ad('0x3a')]?_0x45a107['attributes']:_0x150480['model'];if(!_0x55b36a[_0x71ad('0x35')][_0x71ad('0x3b')]('nolimit')){_0x45a107[_0x71ad('0x21')]=qs['limit'](_0x55b36a[_0x71ad('0x35')][_0x71ad('0x21')]);_0x45a107[_0x71ad('0x1f')]=qs[_0x71ad('0x1f')](_0x55b36a[_0x71ad('0x35')][_0x71ad('0x1f')]);}_0x45a107[_0x71ad('0x3c')]=qs[_0x71ad('0x3d')](_0x55b36a[_0x71ad('0x35')]['sort']);_0x45a107[_0x71ad('0x3e')]=qs[_0x71ad('0x37')](_['pick'](_0x55b36a[_0x71ad('0x35')],_0x150480['filters']),_0x51b2b0);if(_0x55b36a[_0x71ad('0x35')][_0x71ad('0x3f')]){_0x45a107[_0x71ad('0x3e')]=_[_0x71ad('0x40')](_0x45a107[_0x71ad('0x3e')],{'$or':_[_0x71ad('0x2f')](_0x51b2b0,function(_0x282f30){if(_0x282f30['type']!==_0x71ad('0x41')){var _0x53d884={};_0x53d884[_0x282f30['name']]={'$like':'%'+_0x55b36a[_0x71ad('0x35')][_0x71ad('0x3f')]+'%'};return _0x53d884;}})});}_0x45a107=_['merge']({},_0x45a107,_0x55b36a[_0x71ad('0x42')]);var _0x5e96b5={'where':_0x45a107['where']};return db[_0x71ad('0x30')]['count'](_0x5e96b5)[_0x71ad('0x28')](function(_0x34dd6f){_0x5db8f5[_0x71ad('0x22')]=_0x34dd6f;if(_0x55b36a[_0x71ad('0x35')][_0x71ad('0x43')]){_0x45a107[_0x71ad('0x44')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x71ad('0x45')](_0x45a107);})[_0x71ad('0x28')](function(_0x4d249f){_0x5db8f5['rows']=_0x4d249f;return _0x5db8f5;})[_0x71ad('0x28')](respondWithFilteredResult(_0x4dadb6,_0x45a107))['catch'](handleError(_0x4dadb6,null));};exports[_0x71ad('0x46')]=function(_0x5a4c43,_0x471aa8){var _0xe4d5ef={'raw':!![],'where':{'id':_0x5a4c43[_0x71ad('0x47')]['id']}},_0x1c5bdd={};_0x1c5bdd[_0x71ad('0x34')]=_['keys'](db['OpenchannelQueueReport'][_0x71ad('0x31')]);_0x1c5bdd[_0x71ad('0x35')]=_['keys'](_0x5a4c43[_0x71ad('0x35')]);_0x1c5bdd[_0x71ad('0x37')]=_[_0x71ad('0x38')](_0x1c5bdd[_0x71ad('0x34')],_0x1c5bdd[_0x71ad('0x35')]);_0xe4d5ef[_0x71ad('0x48')]=_[_0x71ad('0x38')](_0x1c5bdd[_0x71ad('0x34')],qs['fields'](_0x5a4c43[_0x71ad('0x35')][_0x71ad('0x39')]));_0xe4d5ef[_0x71ad('0x48')]=_0xe4d5ef['attributes'][_0x71ad('0x3a')]?_0xe4d5ef[_0x71ad('0x48')]:_0x1c5bdd[_0x71ad('0x34')];if(_0x5a4c43[_0x71ad('0x35')][_0x71ad('0x43')]){_0xe4d5ef[_0x71ad('0x44')]=[{'all':!![]}];}_0xe4d5ef=_[_0x71ad('0x40')]({},_0xe4d5ef,_0x5a4c43[_0x71ad('0x42')]);return db[_0x71ad('0x30')][_0x71ad('0x49')](_0xe4d5ef)[_0x71ad('0x28')](handleEntityNotFound(_0x471aa8,null))[_0x71ad('0x28')](respondWithResult(_0x471aa8,null))[_0x71ad('0x4a')](handleError(_0x471aa8,null));};exports[_0x71ad('0x4b')]=function(_0x2c73f0,_0x587917){return db[_0x71ad('0x30')][_0x71ad('0x4b')](_0x2c73f0['body'],{})[_0x71ad('0x28')](respondWithResult(_0x587917,0xc9))[_0x71ad('0x4a')](handleError(_0x587917,null));};exports[_0x71ad('0x27')]=function(_0x214a7e,_0x103834){if(_0x214a7e[_0x71ad('0x4c')]['id']){delete _0x214a7e[_0x71ad('0x4c')]['id'];}return db['OpenchannelQueueReport'][_0x71ad('0x49')]({'where':{'id':_0x214a7e[_0x71ad('0x47')]['id']}})[_0x71ad('0x28')](handleEntityNotFound(_0x103834,null))[_0x71ad('0x28')](saveUpdates(_0x214a7e[_0x71ad('0x4c')],null))[_0x71ad('0x28')](respondWithResult(_0x103834,null))['catch'](handleError(_0x103834,null));};exports[_0x71ad('0x29')]=function(_0x5a3246,_0x30d722){return db[_0x71ad('0x30')][_0x71ad('0x49')]({'where':{'id':_0x5a3246[_0x71ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x30d722,null))[_0x71ad('0x28')](removeEntity(_0x30d722,null))[_0x71ad('0x4a')](handleError(_0x30d722,null));};exports[_0x71ad('0x4d')]=function(_0x348691,_0xb71692){return db['OpenchannelQueueReport'][_0x71ad('0x4d')]()[_0x71ad('0x28')](respondWithResult(_0xb71692,null))[_0x71ad('0x4a')](handleError(_0xb71692,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 472056a..6e679fe 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x26cfe2,_0x1212a2){var _0x5b0ad8=function(_0x16acec){while(--_0x16acec){_0x26cfe2['push'](_0x26cfe2['shift']());}};_0x5b0ad8(++_0x1212a2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0x5fc3[_0x5dee2a];return _0x31e98e;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x467ff3,_0x3e30d6){var _0x4959f2=function(_0x568718){while(--_0x568718){_0x467ff3['push'](_0x467ff3['shift']());}};_0x4959f2(++_0x3e30d6);}(_0xe14b,0x93));var _0xbe14=function(_0x5cc5d3,_0x7e5a47){_0x5cc5d3=_0x5cc5d3-0x0;var _0xdf5173=_0xe14b[_0x5cc5d3];return _0xdf5173;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 8ea4708..f5ff11b 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 _0x5204=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x61e3ee,_0x3cd5ee){var _0x41b545=function(_0x5b4739){while(--_0x5b4739){_0x61e3ee['push'](_0x61e3ee['shift']());}};_0x41b545(++_0x3cd5ee);}(_0x5204,0xdf));var _0x4520=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x5204[_0x3e478c];return _0x29ef89;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c46c5){logger[_0x4520('0xc')]('CreateOpenchannelQueueReport',_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x4c46c5));_0x4ba69f(_0x4c46c5);})['catch'](function(_0x3199a9){logger[_0x4520('0x12')](_0x4520('0x17'),_0x3199a9['message'],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x3199a9[_0x4520('0x14')]));});});};exports[_0x4520('0x1c')]=function(_0x3a4680){var _0x2a8528=this;return new Promise(function(_0x552da1,_0x3774bd){return db[_0x4520('0x18')][_0x4520('0x1d')](_0x3a4680[_0x4520('0x1a')],{'raw':_0x3a4680['options']?_0x3a4680[_0x4520('0x1b')][_0x4520('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')][_0x4520('0x1f')]||null:null,'attributes':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')][_0x4520('0x20')]||null:null,'limit':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')]['limit']||null:null})[_0x4520('0x21')](function(_0x5c1a0b){logger[_0x4520('0xc')](_0x4520('0x1c'),_0x3a4680);logger[_0x4520('0xf')](_0x4520('0x1c'),_0x3a4680,JSON[_0x4520('0x11')](_0x5c1a0b));_0x552da1(_0x5c1a0b);})[_0x4520('0x16')](function(_0x5bb163){logger[_0x4520('0x12')]('UpdateOpenchannelQueueReport',_0x5bb163[_0x4520('0x14')],_0x3a4680);_0x3774bd(_0x2a8528['error'](0x1f4,_0x5bb163[_0x4520('0x14')]));});});}; \ No newline at end of file +var _0x531a=['catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x531a,0x100));var _0xa531=function(_0x139229,_0x236164){_0x139229=_0x139229-0x0;var _0xa15684=_0x531a[_0x139229];return _0xa15684;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var moment=require(_0xa531('0x2'));var BPromise=require(_0xa531('0x3'));var rs=require(_0xa531('0x4'));var fs=require('fs');var Redis=require(_0xa531('0x5'));var db=require(_0xa531('0x6'))['db'];var utils=require(_0xa531('0x7'));var logger=require(_0xa531('0x8'))(_0xa531('0x9'));var config=require('../../config/environment');var jayson=require(_0xa531('0xa'));var client=jayson['client'][_0xa531('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4446b9,_0x3fd172,_0x286dc7){return new BPromise(function(_0x3b68a7,_0x5bd2f9){return client[_0xa531('0xc')](_0x4446b9,_0x286dc7)[_0xa531('0xd')](function(_0x4d07e4){logger[_0xa531('0xe')](_0xa531('0xf'),_0x3fd172,_0xa531('0x10'));logger[_0xa531('0x11')](_0xa531('0x12'),_0x3fd172,'request\x20sent',JSON[_0xa531('0x13')](_0x4d07e4));if(_0x4d07e4['error']){if(_0x4d07e4[_0xa531('0x14')][_0xa531('0x15')]===0x1f4){logger[_0xa531('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x5bd2f9(_0x4d07e4['error'][_0xa531('0x16')]);}logger[_0xa531('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x3b68a7(_0x4d07e4[_0xa531('0x14')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0xa531('0x10'));_0x3b68a7(_0x4d07e4[_0xa531('0x17')][_0xa531('0x16')]);}})[_0xa531('0x18')](function(_0x324076){logger[_0xa531('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3fd172,_0x324076);_0x5bd2f9(_0x324076);});});}exports[_0xa531('0x19')]=function(_0x5124a1){var _0x412b84=this;return new Promise(function(_0x146013,_0x4fb62e){return db['OpenchannelQueueReport'][_0xa531('0x1a')](_0x5124a1[_0xa531('0x1b')],{'raw':_0x5124a1[_0xa531('0x1c')]?_0x5124a1['options'][_0xa531('0x1d')]===undefined?!![]:![]:!![]})[_0xa531('0xd')](function(_0x4096f0){logger['info'](_0xa531('0x19'),_0x5124a1);logger[_0xa531('0x11')]('CreateOpenchannelQueueReport',_0x5124a1,JSON[_0xa531('0x13')](_0x4096f0));_0x146013(_0x4096f0);})[_0xa531('0x18')](function(_0x3a2016){logger[_0xa531('0x14')](_0xa531('0x19'),_0x3a2016[_0xa531('0x16')],_0x5124a1);_0x4fb62e(_0x412b84[_0xa531('0x14')](0x1f4,_0x3a2016[_0xa531('0x16')]));});});};exports[_0xa531('0x1e')]=function(_0x39f640){var _0x8e9ab3=this;return new Promise(function(_0x3ac4eb,_0x57f1b3){return db[_0xa531('0x1f')][_0xa531('0x20')](_0x39f640[_0xa531('0x1b')],{'raw':_0x39f640['options']?_0x39f640[_0xa531('0x1c')][_0xa531('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39f640['options']?_0x39f640['options'][_0xa531('0x21')]||null:null,'attributes':_0x39f640['options']?_0x39f640[_0xa531('0x1c')][_0xa531('0x22')]||null:null,'limit':_0x39f640['options']?_0x39f640[_0xa531('0x1c')]['limit']||null:null})[_0xa531('0xd')](function(_0x531b8c){logger['info']('UpdateOpenchannelQueueReport',_0x39f640);logger[_0xa531('0x11')](_0xa531('0x1e'),_0x39f640,JSON['stringify'](_0x531b8c));_0x3ac4eb(_0x531b8c);})['catch'](function(_0x380cec){logger['error'](_0xa531('0x1e'),_0x380cec[_0xa531('0x16')],_0x39f640);_0x57f1b3(_0x8e9ab3['error'](0x1f4,_0x380cec[_0xa531('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 68baa13..2ff5551 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 _0xb483=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x5b43cf,_0x2505e3){var _0x419f5a=function(_0x1b592d){while(--_0x1b592d){_0x5b43cf['push'](_0x5b43cf['shift']());}};_0x419f5a(++_0x2505e3);}(_0xb483,0x67));var _0x3b48=function(_0x48b708,_0x102da6){_0x48b708=_0x48b708-0x0;var _0x474c16=_0xb483[_0x48b708];return _0x474c16;};'use strict';var multer=require(_0x3b48('0x0'));var util=require(_0x3b48('0x1'));var path=require(_0x3b48('0x2'));var timeout=require(_0x3b48('0x3'));var express=require('express');var router=express[_0x3b48('0x4')]();var fs_extra=require(_0x3b48('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3b48('0x6'));var config=require(_0x3b48('0x7'));var controller=require(_0x3b48('0x8'));router[_0x3b48('0x9')]('/',auth['isAuthenticated'](),controller[_0x3b48('0xa')]);router[_0x3b48('0x9')](_0x3b48('0xb'),auth[_0x3b48('0xc')](),controller[_0x3b48('0xd')]);router[_0x3b48('0x9')](_0x3b48('0xe'),auth['isAuthenticated'](),controller[_0x3b48('0xf')]);router[_0x3b48('0x10')]('/',auth[_0x3b48('0xc')](),controller[_0x3b48('0x11')]);router['put'](_0x3b48('0xe'),auth[_0x3b48('0xc')](),controller[_0x3b48('0x12')]);router[_0x3b48('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3b48('0x14')]=router; \ No newline at end of file +var _0x74f1=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','index','get','/describe','isAuthenticated','show','post','create','put','/:id','exports','multer','util','path'];(function(_0x3ea154,_0x13a4f1){var _0x17ecf1=function(_0x8b7864){while(--_0x8b7864){_0x3ea154['push'](_0x3ea154['shift']());}};_0x17ecf1(++_0x13a4f1);}(_0x74f1,0xa8));var _0x174f=function(_0x50c7d6,_0x43aaed){_0x50c7d6=_0x50c7d6-0x0;var _0x4e1b11=_0x74f1[_0x50c7d6];return _0x4e1b11;};'use strict';var multer=require(_0x174f('0x0'));var util=require(_0x174f('0x1'));var path=require(_0x174f('0x2'));var timeout=require(_0x174f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x174f('0x4'));var auth=require(_0x174f('0x5'));var interaction=require(_0x174f('0x6'));var config=require(_0x174f('0x7'));var controller=require(_0x174f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x174f('0x9')]);router[_0x174f('0xa')](_0x174f('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x174f('0xa')]('/:id',auth[_0x174f('0xc')](),controller[_0x174f('0xd')]);router[_0x174f('0xe')]('/',auth[_0x174f('0xc')](),controller[_0x174f('0xf')]);router[_0x174f('0x10')](_0x174f('0x11'),auth[_0x174f('0xc')](),controller['update']);router['delete'](_0x174f('0x11'),auth[_0x174f('0xc')](),controller['destroy']);module[_0x174f('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 6216c02..eb05522 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0xb43b,0x1b2));var _0xbb43=function(_0x266934,_0x28c6e4){_0x266934=_0x266934-0x0;var _0x253615=_0xb43b[_0x266934];return _0x253615;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1bf112,_0x5f1669){_0x1bf112=_0x1bf112-0x0;var _0x468675=_0x9bde[_0x1bf112];return _0x468675;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4bfa95d..725faf8 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 _0x8298=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','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'];(function(_0xc9feef,_0x20ebcc){var _0x330946=function(_0x1323ff){while(--_0x1323ff){_0xc9feef['push'](_0xc9feef['shift']());}};_0x330946(++_0x20ebcc);}(_0x8298,0xd1));var _0x8829=function(_0x178e71,_0x5c6c7d){_0x178e71=_0x178e71-0x0;var _0x3eec6c=_0x8298[_0x178e71];return _0x3eec6c;};'use strict';var emlformat=require(_0x8829('0x0'));var rimraf=require(_0x8829('0x1'));var zipdir=require(_0x8829('0x2'));var jsonpatch=require(_0x8829('0x3'));var rp=require(_0x8829('0x4'));var moment=require(_0x8829('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8829('0x6'));var util=require(_0x8829('0x7'));var path=require(_0x8829('0x8'));var sox=require(_0x8829('0x9'));var csv=require(_0x8829('0xa'));var ejs=require(_0x8829('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8829('0xc'));var crypto=require(_0x8829('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8829('0xe'));var toCsv=require(_0x8829('0xa'));var querystring=require(_0x8829('0xf'));var Papa=require('papaparse');var Redis=require(_0x8829('0x10'));var authService=require(_0x8829('0x11'));var qs=require(_0x8829('0x12'));var as=require(_0x8829('0x13'));var hardwareService=require(_0x8829('0x14'));var logger=require(_0x8829('0x15'))(_0x8829('0x16'));var utils=require(_0x8829('0x17'));var config=require(_0x8829('0x18'));var licenseUtil=require(_0x8829('0x19'));var db=require(_0x8829('0x1a'))['db'];function respondWithStatusCode(_0x560a7d,_0x549e99){_0x549e99=_0x549e99||0xcc;return function(_0x170c23){if(_0x170c23){return _0x560a7d[_0x8829('0x1b')](_0x549e99);}return _0x560a7d[_0x8829('0x1c')](_0x549e99)[_0x8829('0x1d')]();};}function respondWithResult(_0x4ed45f,_0x4ea6ba){_0x4ea6ba=_0x4ea6ba||0xc8;return function(_0xdc557b){if(_0xdc557b){return _0x4ed45f[_0x8829('0x1c')](_0x4ea6ba)['json'](_0xdc557b);}};}function respondWithFilteredResult(_0x4b7382,_0x58927a){return function(_0x3e9385){if(_0x3e9385){var _0x8c7884=typeof _0x58927a[_0x8829('0x1e')]===_0x8829('0x1f')&&typeof _0x58927a[_0x8829('0x20')]===_0x8829('0x1f');var _0x33005=_0x3e9385[_0x8829('0x21')];var _0xca4a60=_0x8c7884?0x0:_0x58927a['offset'];var _0x33ea0e=_0x8c7884?_0x3e9385[_0x8829('0x21')]:_0x58927a[_0x8829('0x1e')]+_0x58927a[_0x8829('0x20')];var _0x706da0;if(_0x33ea0e>=_0x33005){_0x33ea0e=_0x33005;_0x706da0=0xc8;}else{_0x706da0=0xce;}_0x4b7382[_0x8829('0x1c')](_0x706da0);return _0x4b7382['set'](_0x8829('0x22'),_0xca4a60+'-'+_0x33ea0e+'/'+_0x33005)['json'](_0x3e9385);}return null;};}function patchUpdates(_0x4d1a3c){return function(_0x52389c){try{jsonpatch[_0x8829('0x23')](_0x52389c,_0x4d1a3c,!![]);}catch(_0x508f8c){return BPromise[_0x8829('0x24')](_0x508f8c);}return _0x52389c['save']();};}function saveUpdates(_0x5c0c86,_0x2a3b5f){return function(_0x27bc07){if(_0x27bc07){return _0x27bc07['update'](_0x5c0c86)[_0x8829('0x25')](function(_0x316e0f){return _0x316e0f;});}return null;};}function removeEntity(_0x4366a3,_0x50ba98){return function(_0x4ea7b1){if(_0x4ea7b1){return _0x4ea7b1[_0x8829('0x26')]()[_0x8829('0x25')](function(){_0x4366a3['status'](0xcc)[_0x8829('0x1d')]();});}};}function handleEntityNotFound(_0x528f10,_0x226052){return function(_0x4560fc){if(!_0x4560fc){_0x528f10[_0x8829('0x1b')](0x194);}return _0x4560fc;};}function handleError(_0x135b69,_0x497053){_0x497053=_0x497053||0x1f4;return function(_0x188fb8){logger[_0x8829('0x27')](_0x188fb8[_0x8829('0x28')]);if(_0x188fb8[_0x8829('0x29')]){delete _0x188fb8[_0x8829('0x29')];}_0x135b69['status'](_0x497053)[_0x8829('0x2a')](_0x188fb8);};}exports[_0x8829('0x2b')]=function(_0x290b75,_0x36d801){var _0x477358={},_0x36318c={},_0x52d3eb={'count':0x0,'rows':[]};var _0x4a5920=_[_0x8829('0x2c')](db[_0x8829('0x2d')][_0x8829('0x2e')],function(_0x548d30){return{'name':_0x548d30[_0x8829('0x2f')],'type':_0x548d30['type'][_0x8829('0x30')]};});_0x36318c[_0x8829('0x31')]=_[_0x8829('0x2c')](_0x4a5920,_0x8829('0x29'));_0x36318c[_0x8829('0x32')]=_[_0x8829('0x33')](_0x290b75[_0x8829('0x32')]);_0x36318c[_0x8829('0x34')]=_[_0x8829('0x35')](_0x36318c[_0x8829('0x31')],_0x36318c[_0x8829('0x32')]);_0x477358[_0x8829('0x36')]=_[_0x8829('0x35')](_0x36318c[_0x8829('0x31')],qs['fields'](_0x290b75['query'][_0x8829('0x37')]));_0x477358[_0x8829('0x36')]=_0x477358[_0x8829('0x36')][_0x8829('0x38')]?_0x477358[_0x8829('0x36')]:_0x36318c['model'];if(!_0x290b75[_0x8829('0x32')][_0x8829('0x39')](_0x8829('0x3a'))){_0x477358[_0x8829('0x20')]=qs['limit'](_0x290b75[_0x8829('0x32')]['limit']);_0x477358[_0x8829('0x1e')]=qs[_0x8829('0x1e')](_0x290b75[_0x8829('0x32')][_0x8829('0x1e')]);}_0x477358['order']=qs[_0x8829('0x3b')](_0x290b75[_0x8829('0x32')][_0x8829('0x3b')]);_0x477358[_0x8829('0x3c')]=qs['filters'](_[_0x8829('0x3d')](_0x290b75[_0x8829('0x32')],_0x36318c[_0x8829('0x34')]),_0x4a5920);if(_0x290b75[_0x8829('0x32')][_0x8829('0x3e')]){_0x477358[_0x8829('0x3c')]=_[_0x8829('0x3f')](_0x477358[_0x8829('0x3c')],{'$or':_[_0x8829('0x2c')](_0x4a5920,function(_0x2f24a7){if(_0x2f24a7[_0x8829('0x40')]!==_0x8829('0x41')){var _0x5505ec={};_0x5505ec[_0x2f24a7[_0x8829('0x29')]]={'$like':'%'+_0x290b75[_0x8829('0x32')][_0x8829('0x3e')]+'%'};return _0x5505ec;}})});}_0x477358=_[_0x8829('0x3f')]({},_0x477358,_0x290b75[_0x8829('0x42')]);var _0x27b0ac={'where':_0x477358[_0x8829('0x3c')]};return db['OpenchannelTransferReport']['count'](_0x27b0ac)[_0x8829('0x25')](function(_0x409076){_0x52d3eb['count']=_0x409076;if(_0x290b75['query'][_0x8829('0x43')]){_0x477358[_0x8829('0x44')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x8829('0x45')](_0x477358);})['then'](function(_0x2f9e44){_0x52d3eb['rows']=_0x2f9e44;return _0x52d3eb;})['then'](respondWithFilteredResult(_0x36d801,_0x477358))[_0x8829('0x46')](handleError(_0x36d801,null));};exports[_0x8829('0x47')]=function(_0x3e4d5e,_0xde5065){var _0x2ccc9e={'raw':!![],'where':{'id':_0x3e4d5e[_0x8829('0x48')]['id']}},_0x32bc93={};_0x32bc93[_0x8829('0x31')]=_[_0x8829('0x33')](db[_0x8829('0x2d')][_0x8829('0x2e')]);_0x32bc93[_0x8829('0x32')]=_['keys'](_0x3e4d5e[_0x8829('0x32')]);_0x32bc93[_0x8829('0x34')]=_[_0x8829('0x35')](_0x32bc93[_0x8829('0x31')],_0x32bc93[_0x8829('0x32')]);_0x2ccc9e[_0x8829('0x36')]=_[_0x8829('0x35')](_0x32bc93[_0x8829('0x31')],qs[_0x8829('0x37')](_0x3e4d5e['query'][_0x8829('0x37')]));_0x2ccc9e[_0x8829('0x36')]=_0x2ccc9e[_0x8829('0x36')][_0x8829('0x38')]?_0x2ccc9e[_0x8829('0x36')]:_0x32bc93['model'];if(_0x3e4d5e[_0x8829('0x32')][_0x8829('0x43')]){_0x2ccc9e[_0x8829('0x44')]=[{'all':!![]}];}_0x2ccc9e=_[_0x8829('0x3f')]({},_0x2ccc9e,_0x3e4d5e[_0x8829('0x42')]);return db[_0x8829('0x2d')][_0x8829('0x49')](_0x2ccc9e)[_0x8829('0x25')](handleEntityNotFound(_0xde5065,null))[_0x8829('0x25')](respondWithResult(_0xde5065,null))[_0x8829('0x46')](handleError(_0xde5065,null));};exports['create']=function(_0x4bad7b,_0x10a347){return db[_0x8829('0x2d')][_0x8829('0x4a')](_0x4bad7b[_0x8829('0x4b')],{})['then'](respondWithResult(_0x10a347,0xc9))[_0x8829('0x46')](handleError(_0x10a347,null));};exports[_0x8829('0x4c')]=function(_0x3d2766,_0x1b0edb){if(_0x3d2766[_0x8829('0x4b')]['id']){delete _0x3d2766[_0x8829('0x4b')]['id'];}return db['OpenchannelTransferReport'][_0x8829('0x49')]({'where':{'id':_0x3d2766['params']['id']}})[_0x8829('0x25')](handleEntityNotFound(_0x1b0edb,null))[_0x8829('0x25')](saveUpdates(_0x3d2766[_0x8829('0x4b')],null))[_0x8829('0x25')](respondWithResult(_0x1b0edb,null))[_0x8829('0x46')](handleError(_0x1b0edb,null));};exports[_0x8829('0x26')]=function(_0x157603,_0x2e9979){return db[_0x8829('0x2d')][_0x8829('0x49')]({'where':{'id':_0x157603['params']['id']}})[_0x8829('0x25')](handleEntityNotFound(_0x2e9979,null))[_0x8829('0x25')](removeEntity(_0x2e9979,null))[_0x8829('0x46')](handleError(_0x2e9979,null));};exports[_0x8829('0x4d')]=function(_0x557268,_0x4773e1){return db[_0x8829('0x2d')][_0x8829('0x4d')]()['then'](respondWithResult(_0x4773e1,null))[_0x8829('0x46')](handleError(_0x4773e1,null));}; \ No newline at end of file +var _0x886e=['update','then','destroy','error','stack','name','map','OpenchannelTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','fields','attributes','length','model','sort','pick','filter','where','merge','type','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','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','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x886e,0x166));var _0xe886=function(_0xf68053,_0x273d78){_0xf68053=_0xf68053-0x0;var _0x536358=_0x886e[_0xf68053];return _0x536358;};'use strict';var emlformat=require(_0xe886('0x0'));var rimraf=require(_0xe886('0x1'));var zipdir=require(_0xe886('0x2'));var jsonpatch=require(_0xe886('0x3'));var rp=require(_0xe886('0x4'));var moment=require(_0xe886('0x5'));var BPromise=require(_0xe886('0x6'));var Mustache=require(_0xe886('0x7'));var util=require(_0xe886('0x8'));var path=require('path');var sox=require(_0xe886('0x9'));var csv=require(_0xe886('0xa'));var ejs=require(_0xe886('0xb'));var fs=require('fs');var fs_extra=require(_0xe886('0xc'));var _=require(_0xe886('0xd'));var squel=require(_0xe886('0xe'));var crypto=require(_0xe886('0xf'));var jsforce=require(_0xe886('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe886('0xa'));var querystring=require(_0xe886('0x11'));var Papa=require(_0xe886('0x12'));var Redis=require(_0xe886('0x13'));var authService=require(_0xe886('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe886('0x15'));var hardwareService=require(_0xe886('0x16'));var logger=require(_0xe886('0x17'))(_0xe886('0x18'));var utils=require(_0xe886('0x19'));var config=require(_0xe886('0x1a'));var licenseUtil=require(_0xe886('0x1b'));var db=require(_0xe886('0x1c'))['db'];function respondWithStatusCode(_0x25b009,_0x5e802c){_0x5e802c=_0x5e802c||0xcc;return function(_0x2a4f2b){if(_0x2a4f2b){return _0x25b009[_0xe886('0x1d')](_0x5e802c);}return _0x25b009[_0xe886('0x1e')](_0x5e802c)[_0xe886('0x1f')]();};}function respondWithResult(_0x5f2559,_0x15cf3f){_0x15cf3f=_0x15cf3f||0xc8;return function(_0x32daf6){if(_0x32daf6){return _0x5f2559[_0xe886('0x1e')](_0x15cf3f)[_0xe886('0x20')](_0x32daf6);}};}function respondWithFilteredResult(_0x11516c,_0x46421d){return function(_0x4163e4){if(_0x4163e4){var _0x159614=typeof _0x46421d['offset']===_0xe886('0x21')&&typeof _0x46421d[_0xe886('0x22')]===_0xe886('0x21');var _0x1c78dd=_0x4163e4[_0xe886('0x23')];var _0x3db5fd=_0x159614?0x0:_0x46421d[_0xe886('0x24')];var _0x3c56b0=_0x159614?_0x4163e4[_0xe886('0x23')]:_0x46421d['offset']+_0x46421d['limit'];var _0x35d8f1;if(_0x3c56b0>=_0x1c78dd){_0x3c56b0=_0x1c78dd;_0x35d8f1=0xc8;}else{_0x35d8f1=0xce;}_0x11516c[_0xe886('0x1e')](_0x35d8f1);return _0x11516c[_0xe886('0x25')](_0xe886('0x26'),_0x3db5fd+'-'+_0x3c56b0+'/'+_0x1c78dd)[_0xe886('0x20')](_0x4163e4);}return null;};}function patchUpdates(_0x2655d4){return function(_0x3b256d){try{jsonpatch[_0xe886('0x27')](_0x3b256d,_0x2655d4,!![]);}catch(_0x4964ca){return BPromise[_0xe886('0x28')](_0x4964ca);}return _0x3b256d[_0xe886('0x29')]();};}function saveUpdates(_0x1943ff,_0x351482){return function(_0x226833){if(_0x226833){return _0x226833[_0xe886('0x2a')](_0x1943ff)[_0xe886('0x2b')](function(_0x8cf2e9){return _0x8cf2e9;});}return null;};}function removeEntity(_0x53fd12,_0x1f648c){return function(_0x4bfdd0){if(_0x4bfdd0){return _0x4bfdd0[_0xe886('0x2c')]()[_0xe886('0x2b')](function(){_0x53fd12[_0xe886('0x1e')](0xcc)[_0xe886('0x1f')]();});}};}function handleEntityNotFound(_0x28416a,_0x16a5ba){return function(_0x599fc5){if(!_0x599fc5){_0x28416a[_0xe886('0x1d')](0x194);}return _0x599fc5;};}function handleError(_0x246dca,_0xbc7029){_0xbc7029=_0xbc7029||0x1f4;return function(_0x2614c7){logger[_0xe886('0x2d')](_0x2614c7[_0xe886('0x2e')]);if(_0x2614c7['name']){delete _0x2614c7[_0xe886('0x2f')];}_0x246dca[_0xe886('0x1e')](_0xbc7029)['send'](_0x2614c7);};}exports['index']=function(_0x142ed3,_0x5de0ad){var _0x561010={},_0x22e7f8={},_0x1d0ef9={'count':0x0,'rows':[]};var _0x365c83=_[_0xe886('0x30')](db[_0xe886('0x31')][_0xe886('0x32')],function(_0xfe32e7){return{'name':_0xfe32e7[_0xe886('0x33')],'type':_0xfe32e7['type'][_0xe886('0x34')]};});_0x22e7f8['model']=_['map'](_0x365c83,_0xe886('0x2f'));_0x22e7f8[_0xe886('0x35')]=_[_0xe886('0x36')](_0x142ed3[_0xe886('0x35')]);_0x22e7f8[_0xe886('0x37')]=_[_0xe886('0x38')](_0x22e7f8['model'],_0x22e7f8['query']);_0x561010['attributes']=_[_0xe886('0x38')](_0x22e7f8['model'],qs[_0xe886('0x39')](_0x142ed3[_0xe886('0x35')]['fields']));_0x561010[_0xe886('0x3a')]=_0x561010[_0xe886('0x3a')][_0xe886('0x3b')]?_0x561010['attributes']:_0x22e7f8[_0xe886('0x3c')];if(!_0x142ed3[_0xe886('0x35')]['hasOwnProperty']('nolimit')){_0x561010[_0xe886('0x22')]=qs[_0xe886('0x22')](_0x142ed3[_0xe886('0x35')][_0xe886('0x22')]);_0x561010['offset']=qs[_0xe886('0x24')](_0x142ed3[_0xe886('0x35')]['offset']);}_0x561010['order']=qs[_0xe886('0x3d')](_0x142ed3[_0xe886('0x35')][_0xe886('0x3d')]);_0x561010['where']=qs[_0xe886('0x37')](_[_0xe886('0x3e')](_0x142ed3['query'],_0x22e7f8[_0xe886('0x37')]),_0x365c83);if(_0x142ed3['query'][_0xe886('0x3f')]){_0x561010[_0xe886('0x40')]=_[_0xe886('0x41')](_0x561010['where'],{'$or':_[_0xe886('0x30')](_0x365c83,function(_0x45c05d){if(_0x45c05d[_0xe886('0x42')]!==_0xe886('0x43')){var _0x5448da={};_0x5448da[_0x45c05d[_0xe886('0x2f')]]={'$like':'%'+_0x142ed3[_0xe886('0x35')][_0xe886('0x3f')]+'%'};return _0x5448da;}})});}_0x561010=_['merge']({},_0x561010,_0x142ed3[_0xe886('0x44')]);var _0x29c8e0={'where':_0x561010[_0xe886('0x40')]};return db[_0xe886('0x31')][_0xe886('0x23')](_0x29c8e0)[_0xe886('0x2b')](function(_0xe79ae1){_0x1d0ef9[_0xe886('0x23')]=_0xe79ae1;if(_0x142ed3[_0xe886('0x35')][_0xe886('0x45')]){_0x561010[_0xe886('0x46')]=[{'all':!![]}];}return db[_0xe886('0x31')][_0xe886('0x47')](_0x561010);})[_0xe886('0x2b')](function(_0x19a54c){_0x1d0ef9[_0xe886('0x48')]=_0x19a54c;return _0x1d0ef9;})[_0xe886('0x2b')](respondWithFilteredResult(_0x5de0ad,_0x561010))[_0xe886('0x49')](handleError(_0x5de0ad,null));};exports[_0xe886('0x4a')]=function(_0x19f1c4,_0x341e9f){var _0x4fa1f3={'raw':!![],'where':{'id':_0x19f1c4[_0xe886('0x4b')]['id']}},_0x9da344={};_0x9da344['model']=_[_0xe886('0x36')](db[_0xe886('0x31')]['rawAttributes']);_0x9da344[_0xe886('0x35')]=_[_0xe886('0x36')](_0x19f1c4['query']);_0x9da344[_0xe886('0x37')]=_['intersection'](_0x9da344[_0xe886('0x3c')],_0x9da344[_0xe886('0x35')]);_0x4fa1f3[_0xe886('0x3a')]=_['intersection'](_0x9da344[_0xe886('0x3c')],qs['fields'](_0x19f1c4[_0xe886('0x35')][_0xe886('0x39')]));_0x4fa1f3[_0xe886('0x3a')]=_0x4fa1f3['attributes'][_0xe886('0x3b')]?_0x4fa1f3[_0xe886('0x3a')]:_0x9da344[_0xe886('0x3c')];if(_0x19f1c4[_0xe886('0x35')][_0xe886('0x45')]){_0x4fa1f3[_0xe886('0x46')]=[{'all':!![]}];}_0x4fa1f3=_[_0xe886('0x41')]({},_0x4fa1f3,_0x19f1c4[_0xe886('0x44')]);return db[_0xe886('0x31')][_0xe886('0x4c')](_0x4fa1f3)[_0xe886('0x2b')](handleEntityNotFound(_0x341e9f,null))[_0xe886('0x2b')](respondWithResult(_0x341e9f,null))['catch'](handleError(_0x341e9f,null));};exports[_0xe886('0x4d')]=function(_0x1a7619,_0x360c9c){return db[_0xe886('0x31')][_0xe886('0x4d')](_0x1a7619['body'],{})[_0xe886('0x2b')](respondWithResult(_0x360c9c,0xc9))[_0xe886('0x49')](handleError(_0x360c9c,null));};exports[_0xe886('0x2a')]=function(_0x413c5a,_0x274b97){if(_0x413c5a[_0xe886('0x4e')]['id']){delete _0x413c5a[_0xe886('0x4e')]['id'];}return db[_0xe886('0x31')]['find']({'where':{'id':_0x413c5a['params']['id']}})[_0xe886('0x2b')](handleEntityNotFound(_0x274b97,null))[_0xe886('0x2b')](saveUpdates(_0x413c5a['body'],null))[_0xe886('0x2b')](respondWithResult(_0x274b97,null))[_0xe886('0x49')](handleError(_0x274b97,null));};exports[_0xe886('0x2c')]=function(_0x465793,_0x13c5a0){return db[_0xe886('0x31')]['find']({'where':{'id':_0x465793['params']['id']}})['then'](handleEntityNotFound(_0x13c5a0,null))['then'](removeEntity(_0x13c5a0,null))[_0xe886('0x49')](handleError(_0x13c5a0,null));};exports[_0xe886('0x4f')]=function(_0x20237c,_0x194424){return db[_0xe886('0x31')][_0xe886('0x4f')]()[_0xe886('0x2b')](respondWithResult(_0x194424,null))[_0xe886('0x49')](handleError(_0x194424,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a7f33af..3a6d96e 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 _0xb9ba=['report_openchannel_transfer','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport'];(function(_0x13d287,_0x167d79){var _0x3c7025=function(_0x44b566){while(--_0x44b566){_0x13d287['push'](_0x13d287['shift']());}};_0x3c7025(++_0x167d79);}(_0xb9ba,0xe1));var _0xab9b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb9ba[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xab9b('0x0'));var util=require(_0xab9b('0x1'));var logger=require(_0xab9b('0x2'))(_0xab9b('0x3'));var moment=require(_0xab9b('0x4'));var BPromise=require('bluebird');var rp=require(_0xab9b('0x5'));var fs=require('fs');var path=require(_0xab9b('0x6'));var rimraf=require(_0xab9b('0x7'));var config=require(_0xab9b('0x8'));var attributes=require(_0xab9b('0x9'));module[_0xab9b('0xa')]=function(_0x23c8fa,_0x271548){return _0x23c8fa[_0xab9b('0xb')](_0xab9b('0xc'),attributes,{'tableName':_0xab9b('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x21be=['exports','OpenchannelTransferReport','uniqueid','lodash','moment','path','./openchannelTransferReport.attributes'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0x21be,0x130));var _0xe21b=function(_0x154cbb,_0x43c57f){_0x154cbb=_0x154cbb-0x0;var _0x494584=_0x21be[_0x154cbb];return _0x494584;};'use strict';var _=require(_0xe21b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe21b('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe21b('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe21b('0x3'));module[_0xe21b('0x4')]=function(_0x2fe26c,_0x4e534b){return _0x2fe26c['define'](_0xe21b('0x5'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xe21b('0x6'),'fields':[_0xe21b('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4577d4a..9529c4c 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 _0x615a=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0x615a,0x119));var _0xa615=function(_0x9bd1eb,_0x24ccb4){_0x9bd1eb=_0x9bd1eb-0x0;var _0x51b468=_0x615a[_0x9bd1eb];return _0x51b468;};'use strict';var _=require(_0xa615('0x0'));var util=require('util');var moment=require(_0xa615('0x1'));var BPromise=require('bluebird');var rs=require(_0xa615('0x2'));var fs=require('fs');var Redis=require(_0xa615('0x3'));var db=require(_0xa615('0x4'))['db'];var utils=require(_0xa615('0x5'));var logger=require('../../config/logger')(_0xa615('0x6'));var config=require(_0xa615('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa615('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44afda,_0x389dd4,_0x2db48d){return new BPromise(function(_0x1e714d,_0x2eae10){return client['request'](_0x44afda,_0x2db48d)[_0xa615('0x9')](function(_0x52470e){logger[_0xa615('0xa')](_0xa615('0xb'),_0x389dd4,'request\x20sent');logger[_0xa615('0xc')](_0xa615('0xd'),_0x389dd4,_0xa615('0xe'),JSON[_0xa615('0xf')](_0x52470e));if(_0x52470e[_0xa615('0x10')]){if(_0x52470e['error']['code']===0x1f4){logger[_0xa615('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x389dd4,_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);return _0x2eae10(_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x389dd4,_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);return _0x1e714d(_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);}else{logger[_0xa615('0xa')](_0xa615('0xb'),_0x389dd4,_0xa615('0xe'));_0x1e714d(_0x52470e[_0xa615('0x12')][_0xa615('0x11')]);}})[_0xa615('0x13')](function(_0xa86873){logger[_0xa615('0x10')](_0xa615('0xb'),_0x389dd4,_0xa86873);_0x2eae10(_0xa86873);});});} \ No newline at end of file +var _0x7d55=['request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','OpenchannelTransferReport,\x20%s,\x20%s','error','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d55,0x1bc));var _0x57d5=function(_0x232bfe,_0x20b341){_0x232bfe=_0x232bfe-0x0;var _0x2944dc=_0x7d55[_0x232bfe];return _0x2944dc;};'use strict';var _=require(_0x57d5('0x0'));var util=require(_0x57d5('0x1'));var moment=require(_0x57d5('0x2'));var BPromise=require(_0x57d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57d5('0x4'))['db'];var utils=require(_0x57d5('0x5'));var logger=require(_0x57d5('0x6'))('rpc');var config=require(_0x57d5('0x7'));var jayson=require(_0x57d5('0x8'));var client=jayson[_0x57d5('0x9')][_0x57d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4393ed,_0x47282c,_0x599ec5){return new BPromise(function(_0x50bc50,_0x59e164){return client['request'](_0x4393ed,_0x599ec5)[_0x57d5('0xb')](function(_0x1e8e1c){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x47282c,_0x57d5('0xc'));logger['debug'](_0x57d5('0xd'),_0x47282c,_0x57d5('0xc'),JSON[_0x57d5('0xe')](_0x1e8e1c));if(_0x1e8e1c['error']){if(_0x1e8e1c['error'][_0x57d5('0xf')]===0x1f4){logger['error'](_0x57d5('0x10'),_0x47282c,_0x1e8e1c[_0x57d5('0x11')][_0x57d5('0x12')]);return _0x59e164(_0x1e8e1c[_0x57d5('0x11')][_0x57d5('0x12')]);}logger[_0x57d5('0x11')](_0x57d5('0x10'),_0x47282c,_0x1e8e1c[_0x57d5('0x11')]['message']);return _0x50bc50(_0x1e8e1c['error'][_0x57d5('0x12')]);}else{logger['info'](_0x57d5('0x10'),_0x47282c,_0x57d5('0xc'));_0x50bc50(_0x1e8e1c['result'][_0x57d5('0x12')]);}})['catch'](function(_0x5e99df){logger[_0x57d5('0x11')](_0x57d5('0x10'),_0x47282c,_0x5e99df);_0x59e164(_0x5e99df);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a4795d7..7a86c35 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 _0x6427=['isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get'];(function(_0x45d705,_0x4d191b){var _0x4b7bc5=function(_0x1c450a){while(--_0x1c450a){_0x45d705['push'](_0x45d705['shift']());}};_0x4b7bc5(++_0x4d191b);}(_0x6427,0xbe));var _0x7642=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x6427[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require(_0x7642('0x0'));var path=require(_0x7642('0x1'));var timeout=require(_0x7642('0x2'));var express=require(_0x7642('0x3'));var router=express[_0x7642('0x4')]();var fs_extra=require(_0x7642('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7642('0x6'));var config=require(_0x7642('0x7'));var controller=require(_0x7642('0x8'));router[_0x7642('0x9')]('/',auth[_0x7642('0xa')](),controller[_0x7642('0xb')]);router[_0x7642('0x9')](_0x7642('0xc'),auth[_0x7642('0xa')](),controller[_0x7642('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7642('0xe')]);router[_0x7642('0xf')](_0x7642('0xc'),auth[_0x7642('0xa')](),controller[_0x7642('0x10')]);router[_0x7642('0x11')](_0x7642('0xc'),auth[_0x7642('0xa')](),controller[_0x7642('0x12')]);module[_0x7642('0x13')]=router; \ No newline at end of file +var _0xf91d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','show','post','create','/:id','update','destroy','exports','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf91d,0x155));var _0xdf91=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf91d[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xdf91('0x0'));var util=require(_0xdf91('0x1'));var path=require(_0xdf91('0x2'));var timeout=require(_0xdf91('0x3'));var express=require(_0xdf91('0x4'));var router=express[_0xdf91('0x5')]();var fs_extra=require(_0xdf91('0x6'));var auth=require(_0xdf91('0x7'));var interaction=require(_0xdf91('0x8'));var config=require('../../config/environment');var controller=require(_0xdf91('0x9'));router[_0xdf91('0xa')]('/',auth[_0xdf91('0xb')](),controller['index']);router[_0xdf91('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xdf91('0xc')]);router[_0xdf91('0xd')]('/',auth['isAuthenticated'](),controller[_0xdf91('0xe')]);router['put'](_0xdf91('0xf'),auth[_0xdf91('0xb')](),controller[_0xdf91('0x10')]);router['delete'](_0xdf91('0xf'),auth[_0xdf91('0xb')](),controller[_0xdf91('0x11')]);module[_0xdf91('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 372ec5f..77d06a8 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 _0xc48b=['STRING','name'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc48b,0x1dc));var _0xbc48=function(_0x4f4757,_0x44241a){_0x4f4757=_0x4f4757-0x0;var _0x549c37=_0xc48b[_0x4f4757];return _0x549c37;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbc48('0x0')],'unique':_0xbc48('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xbc48('0x0')]}}; \ No newline at end of file +var _0x4f14=['sequelize','exports','STRING','name'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0x4f14,0xa8));var _0x44f1=function(_0x5128d5,_0x340941){_0x5128d5=_0x5128d5-0x0;var _0x2a64dc=_0x4f14[_0x5128d5];return _0x2a64dc;};'use strict';var Sequelize=require(_0x44f1('0x0'));module[_0x44f1('0x1')]={'name':{'type':Sequelize[_0x44f1('0x2')],'unique':_0x44f1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x44f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index fcf6cf4..ef7a83f 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 _0xe99b=['reject','save','update','then','destroy','Pauses','UserProfileResource','sendStatus','error','stack','name','index','map','Pause','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe99b,0x13b));var _0xbe99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe99b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbe99('0x0'));var rimraf=require(_0xbe99('0x1'));var zipdir=require(_0xbe99('0x2'));var jsonpatch=require(_0xbe99('0x3'));var rp=require(_0xbe99('0x4'));var moment=require(_0xbe99('0x5'));var BPromise=require(_0xbe99('0x6'));var Mustache=require(_0xbe99('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbe99('0x8'));var ejs=require(_0xbe99('0x9'));var fs=require('fs');var fs_extra=require(_0xbe99('0xa'));var _=require('lodash');var squel=require(_0xbe99('0xb'));var crypto=require(_0xbe99('0xc'));var jsforce=require(_0xbe99('0xd'));var deskjs=require(_0xbe99('0xe'));var toCsv=require(_0xbe99('0x8'));var querystring=require(_0xbe99('0xf'));var Papa=require(_0xbe99('0x10'));var Redis=require(_0xbe99('0x11'));var authService=require(_0xbe99('0x12'));var qs=require(_0xbe99('0x13'));var as=require(_0xbe99('0x14'));var hardwareService=require(_0xbe99('0x15'));var logger=require(_0xbe99('0x16'))(_0xbe99('0x17'));var utils=require(_0xbe99('0x18'));var config=require(_0xbe99('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbe99('0x1a'))['db'];function respondWithStatusCode(_0x49f54f,_0x4c8f0b){_0x4c8f0b=_0x4c8f0b||0xcc;return function(_0x33359a){if(_0x33359a){return _0x49f54f['sendStatus'](_0x4c8f0b);}return _0x49f54f['status'](_0x4c8f0b)[_0xbe99('0x1b')]();};}function respondWithResult(_0x5ac649,_0x57ba8e){_0x57ba8e=_0x57ba8e||0xc8;return function(_0x55a8d5){if(_0x55a8d5){return _0x5ac649[_0xbe99('0x1c')](_0x57ba8e)[_0xbe99('0x1d')](_0x55a8d5);}};}function respondWithFilteredResult(_0x2a809d,_0xc44139){return function(_0x3e37e4){if(_0x3e37e4){var _0x185550=typeof _0xc44139[_0xbe99('0x1e')]===_0xbe99('0x1f')&&typeof _0xc44139['limit']===_0xbe99('0x1f');var _0x4446d0=_0x3e37e4['count'];var _0x47c0e5=_0x185550?0x0:_0xc44139[_0xbe99('0x1e')];var _0x3c5184=_0x185550?_0x3e37e4[_0xbe99('0x20')]:_0xc44139[_0xbe99('0x1e')]+_0xc44139[_0xbe99('0x21')];var _0x181c14;if(_0x3c5184>=_0x4446d0){_0x3c5184=_0x4446d0;_0x181c14=0xc8;}else{_0x181c14=0xce;}_0x2a809d[_0xbe99('0x1c')](_0x181c14);return _0x2a809d[_0xbe99('0x22')](_0xbe99('0x23'),_0x47c0e5+'-'+_0x3c5184+'/'+_0x4446d0)[_0xbe99('0x1d')](_0x3e37e4);}return null;};}function patchUpdates(_0xd7b32){return function(_0x20e555){try{jsonpatch[_0xbe99('0x24')](_0x20e555,_0xd7b32,!![]);}catch(_0x727f85){return BPromise[_0xbe99('0x25')](_0x727f85);}return _0x20e555[_0xbe99('0x26')]();};}function saveUpdates(_0x2f03e3,_0x3bbd70){return function(_0x1bcdda){if(_0x1bcdda){return _0x1bcdda[_0xbe99('0x27')](_0x2f03e3)[_0xbe99('0x28')](function(_0x2f8ff6){return _0x2f8ff6;});}return null;};}function removeEntity(_0x1ef385,_0x3818a9){return function(_0x140034){if(_0x140034){return _0x140034[_0xbe99('0x29')]()[_0xbe99('0x28')](function(){var _0x43a2f8=_0x140034['get']({'plain':!![]});var _0x476228=_0xbe99('0x2a');return db[_0xbe99('0x2b')][_0xbe99('0x29')]({'where':{'type':_0x476228,'resourceId':_0x43a2f8['id']}})[_0xbe99('0x28')](function(){return _0x140034;});})[_0xbe99('0x28')](function(){_0x1ef385['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0cfb,_0x188d0e){return function(_0x403453){if(!_0x403453){_0x5a0cfb[_0xbe99('0x2c')](0x194);}return _0x403453;};}function handleError(_0x3537c8,_0x5c2a76){_0x5c2a76=_0x5c2a76||0x1f4;return function(_0x5a667d){logger[_0xbe99('0x2d')](_0x5a667d[_0xbe99('0x2e')]);if(_0x5a667d[_0xbe99('0x2f')]){delete _0x5a667d['name'];}_0x3537c8['status'](_0x5c2a76)['send'](_0x5a667d);};}exports[_0xbe99('0x30')]=function(_0x8234b2,_0x12bb3c){var _0x4d253a={},_0x328f19={},_0xc6928a={'count':0x0,'rows':[]};var _0x5e13cd=_[_0xbe99('0x31')](db[_0xbe99('0x32')][_0xbe99('0x33')],function(_0x180a48){return{'name':_0x180a48[_0xbe99('0x34')],'type':_0x180a48[_0xbe99('0x35')]['key']};});_0x328f19[_0xbe99('0x36')]=_[_0xbe99('0x31')](_0x5e13cd,'name');_0x328f19[_0xbe99('0x37')]=_[_0xbe99('0x38')](_0x8234b2['query']);_0x328f19['filters']=_['intersection'](_0x328f19[_0xbe99('0x36')],_0x328f19[_0xbe99('0x37')]);_0x4d253a[_0xbe99('0x39')]=_[_0xbe99('0x3a')](_0x328f19[_0xbe99('0x36')],qs[_0xbe99('0x3b')](_0x8234b2['query'][_0xbe99('0x3b')]));_0x4d253a['attributes']=_0x4d253a[_0xbe99('0x39')]['length']?_0x4d253a[_0xbe99('0x39')]:_0x328f19['model'];if(!_0x8234b2[_0xbe99('0x37')][_0xbe99('0x3c')](_0xbe99('0x3d'))){_0x4d253a[_0xbe99('0x21')]=qs[_0xbe99('0x21')](_0x8234b2[_0xbe99('0x37')][_0xbe99('0x21')]);_0x4d253a[_0xbe99('0x1e')]=qs[_0xbe99('0x1e')](_0x8234b2['query'][_0xbe99('0x1e')]);}_0x4d253a[_0xbe99('0x3e')]=qs[_0xbe99('0x3f')](_0x8234b2[_0xbe99('0x37')][_0xbe99('0x3f')]);_0x4d253a[_0xbe99('0x40')]=qs[_0xbe99('0x41')](_[_0xbe99('0x42')](_0x8234b2['query'],_0x328f19[_0xbe99('0x41')]),_0x5e13cd);if(_0x8234b2['query'][_0xbe99('0x43')]){_0x4d253a[_0xbe99('0x40')]=_['merge'](_0x4d253a[_0xbe99('0x40')],{'$or':_[_0xbe99('0x31')](_0x5e13cd,function(_0x93c845){if(_0x93c845[_0xbe99('0x35')]!==_0xbe99('0x44')){var _0x107b3b={};_0x107b3b[_0x93c845[_0xbe99('0x2f')]]={'$like':'%'+_0x8234b2[_0xbe99('0x37')][_0xbe99('0x43')]+'%'};return _0x107b3b;}})});}_0x4d253a=_[_0xbe99('0x45')]({},_0x4d253a,_0x8234b2['options']);var _0x4f5a17={'where':_0x4d253a[_0xbe99('0x40')]};return db[_0xbe99('0x32')][_0xbe99('0x20')](_0x4f5a17)[_0xbe99('0x28')](function(_0x4a8d1e){_0xc6928a[_0xbe99('0x20')]=_0x4a8d1e;if(_0x8234b2['query'][_0xbe99('0x46')]){_0x4d253a[_0xbe99('0x47')]=[{'all':!![]}];}return db[_0xbe99('0x32')][_0xbe99('0x48')](_0x4d253a);})[_0xbe99('0x28')](function(_0x23fa73){_0xc6928a[_0xbe99('0x49')]=_0x23fa73;return _0xc6928a;})[_0xbe99('0x28')](respondWithFilteredResult(_0x12bb3c,_0x4d253a))[_0xbe99('0x4a')](handleError(_0x12bb3c,null));};exports[_0xbe99('0x4b')]=function(_0x4c047e,_0x17e837){var _0x6e0a50={'raw':!![],'where':{'id':_0x4c047e[_0xbe99('0x4c')]['id']}},_0x322b1a={};_0x322b1a[_0xbe99('0x36')]=_[_0xbe99('0x38')](db[_0xbe99('0x32')]['rawAttributes']);_0x322b1a['query']=_[_0xbe99('0x38')](_0x4c047e[_0xbe99('0x37')]);_0x322b1a[_0xbe99('0x41')]=_['intersection'](_0x322b1a[_0xbe99('0x36')],_0x322b1a[_0xbe99('0x37')]);_0x6e0a50[_0xbe99('0x39')]=_[_0xbe99('0x3a')](_0x322b1a['model'],qs[_0xbe99('0x3b')](_0x4c047e[_0xbe99('0x37')][_0xbe99('0x3b')]));_0x6e0a50[_0xbe99('0x39')]=_0x6e0a50[_0xbe99('0x39')][_0xbe99('0x4d')]?_0x6e0a50['attributes']:_0x322b1a[_0xbe99('0x36')];if(_0x4c047e[_0xbe99('0x37')][_0xbe99('0x46')]){_0x6e0a50[_0xbe99('0x47')]=[{'all':!![]}];}_0x6e0a50=_[_0xbe99('0x45')]({},_0x6e0a50,_0x4c047e[_0xbe99('0x4e')]);return db[_0xbe99('0x32')][_0xbe99('0x4f')](_0x6e0a50)[_0xbe99('0x28')](handleEntityNotFound(_0x17e837,null))[_0xbe99('0x28')](respondWithResult(_0x17e837,null))[_0xbe99('0x4a')](handleError(_0x17e837,null));};exports[_0xbe99('0x50')]=function(_0x34fd4f,_0x3d47e9){return db[_0xbe99('0x32')][_0xbe99('0x50')](_0x34fd4f[_0xbe99('0x51')],{})[_0xbe99('0x28')](function(_0x5c9620){var _0x3d81a1=_0x34fd4f[_0xbe99('0x52')]['get']({'plain':!![]});if(!_0x3d81a1)throw new Error(_0xbe99('0x53'));if(_0x3d81a1[_0xbe99('0x54')]===_0xbe99('0x52')){var _0x4c47d1=_0x5c9620[_0xbe99('0x55')]({'plain':!![]});var _0x113730=_0xbe99('0x2a');return db[_0xbe99('0x56')][_0xbe99('0x4f')]({'where':{'name':_0x113730,'userProfileId':_0x3d81a1['userProfileId']},'raw':!![]})[_0xbe99('0x28')](function(_0x50802c){if(_0x50802c&&_0x50802c[_0xbe99('0x57')]===0x0){return db[_0xbe99('0x2b')][_0xbe99('0x50')]({'name':_0x4c47d1['name'],'resourceId':_0x4c47d1['id'],'type':_0x50802c[_0xbe99('0x2f')],'sectionId':_0x50802c['id']},{})['then'](function(){return _0x5c9620;});}else{return _0x5c9620;}})['catch'](function(_0x267fee){logger[_0xbe99('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x267fee);throw _0x267fee;});}return _0x5c9620;})[_0xbe99('0x28')](respondWithResult(_0x3d47e9,0xc9))[_0xbe99('0x4a')](handleError(_0x3d47e9,null));};exports[_0xbe99('0x27')]=function(_0x1578cf,_0x57d435){if(_0x1578cf[_0xbe99('0x51')]['id']){delete _0x1578cf[_0xbe99('0x51')]['id'];}return db['Pause'][_0xbe99('0x4f')]({'where':{'id':_0x1578cf['params']['id']}})[_0xbe99('0x28')](handleEntityNotFound(_0x57d435,null))[_0xbe99('0x28')](saveUpdates(_0x1578cf[_0xbe99('0x51')],null))[_0xbe99('0x28')](respondWithResult(_0x57d435,null))[_0xbe99('0x4a')](handleError(_0x57d435,null));};exports[_0xbe99('0x29')]=function(_0xee72c1,_0x1ec92a){return db[_0xbe99('0x32')][_0xbe99('0x4f')]({'where':{'id':_0xee72c1[_0xbe99('0x4c')]['id']}})[_0xbe99('0x28')](handleEntityNotFound(_0x1ec92a,null))[_0xbe99('0x28')](removeEntity(_0x1ec92a,null))[_0xbe99('0x4a')](handleError(_0x1ec92a,null));}; \ No newline at end of file +var _0x76ce=['path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','get','Pauses','UserProfileResource','end','sendStatus','error','stack','name','map','Pause','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x76ce,0x1e6));var _0xe76c=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x76ce[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0xe76c('0x0'));var rimraf=require(_0xe76c('0x1'));var zipdir=require(_0xe76c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe76c('0x3'));var moment=require(_0xe76c('0x4'));var BPromise=require(_0xe76c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe76c('0x6'));var sox=require(_0xe76c('0x7'));var csv=require(_0xe76c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe76c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe76c('0xa'));var deskjs=require(_0xe76c('0xb'));var toCsv=require(_0xe76c('0x8'));var querystring=require(_0xe76c('0xc'));var Papa=require(_0xe76c('0xd'));var Redis=require(_0xe76c('0xe'));var authService=require(_0xe76c('0xf'));var qs=require(_0xe76c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe76c('0x11'));var logger=require(_0xe76c('0x12'))(_0xe76c('0x13'));var utils=require(_0xe76c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe76c('0x15'));var db=require(_0xe76c('0x16'))['db'];function respondWithStatusCode(_0x3c6371,_0x45084c){_0x45084c=_0x45084c||0xcc;return function(_0xc1ce8b){if(_0xc1ce8b){return _0x3c6371['sendStatus'](_0x45084c);}return _0x3c6371[_0xe76c('0x17')](_0x45084c)['end']();};}function respondWithResult(_0x1a758a,_0x4d982c){_0x4d982c=_0x4d982c||0xc8;return function(_0x482e09){if(_0x482e09){return _0x1a758a[_0xe76c('0x17')](_0x4d982c)[_0xe76c('0x18')](_0x482e09);}};}function respondWithFilteredResult(_0xbe6618,_0x43c663){return function(_0x2cb890){if(_0x2cb890){var _0x588d11=typeof _0x43c663[_0xe76c('0x19')]===_0xe76c('0x1a')&&typeof _0x43c663[_0xe76c('0x1b')]==='undefined';var _0x8da6f9=_0x2cb890[_0xe76c('0x1c')];var _0x53ea1e=_0x588d11?0x0:_0x43c663['offset'];var _0x1212cd=_0x588d11?_0x2cb890[_0xe76c('0x1c')]:_0x43c663[_0xe76c('0x19')]+_0x43c663[_0xe76c('0x1b')];var _0x2dac55;if(_0x1212cd>=_0x8da6f9){_0x1212cd=_0x8da6f9;_0x2dac55=0xc8;}else{_0x2dac55=0xce;}_0xbe6618[_0xe76c('0x17')](_0x2dac55);return _0xbe6618[_0xe76c('0x1d')](_0xe76c('0x1e'),_0x53ea1e+'-'+_0x1212cd+'/'+_0x8da6f9)['json'](_0x2cb890);}return null;};}function patchUpdates(_0x306c67){return function(_0x172587){try{jsonpatch['apply'](_0x172587,_0x306c67,!![]);}catch(_0x193d26){return BPromise[_0xe76c('0x1f')](_0x193d26);}return _0x172587[_0xe76c('0x20')]();};}function saveUpdates(_0x36d831,_0x108e3c){return function(_0x28df10){if(_0x28df10){return _0x28df10['update'](_0x36d831)['then'](function(_0x147468){return _0x147468;});}return null;};}function removeEntity(_0x6a7b09,_0x209894){return function(_0x4d2be9){if(_0x4d2be9){return _0x4d2be9[_0xe76c('0x21')]()[_0xe76c('0x22')](function(){var _0x2a23ef=_0x4d2be9[_0xe76c('0x23')]({'plain':!![]});var _0x5621b5=_0xe76c('0x24');return db[_0xe76c('0x25')]['destroy']({'where':{'type':_0x5621b5,'resourceId':_0x2a23ef['id']}})['then'](function(){return _0x4d2be9;});})[_0xe76c('0x22')](function(){_0x6a7b09[_0xe76c('0x17')](0xcc)[_0xe76c('0x26')]();});}};}function handleEntityNotFound(_0x255c94,_0x360e14){return function(_0x281440){if(!_0x281440){_0x255c94[_0xe76c('0x27')](0x194);}return _0x281440;};}function handleError(_0x48fcb1,_0x302c2e){_0x302c2e=_0x302c2e||0x1f4;return function(_0x136c16){logger[_0xe76c('0x28')](_0x136c16[_0xe76c('0x29')]);if(_0x136c16[_0xe76c('0x2a')]){delete _0x136c16[_0xe76c('0x2a')];}_0x48fcb1['status'](_0x302c2e)['send'](_0x136c16);};}exports['index']=function(_0x490930,_0x417918){var _0x30158f={},_0x495853={},_0x5f2978={'count':0x0,'rows':[]};var _0x548040=_[_0xe76c('0x2b')](db[_0xe76c('0x2c')][_0xe76c('0x2d')],function(_0xdf7186){return{'name':_0xdf7186[_0xe76c('0x2e')],'type':_0xdf7186[_0xe76c('0x2f')][_0xe76c('0x30')]};});_0x495853[_0xe76c('0x31')]=_[_0xe76c('0x2b')](_0x548040,_0xe76c('0x2a'));_0x495853['query']=_[_0xe76c('0x32')](_0x490930['query']);_0x495853[_0xe76c('0x33')]=_[_0xe76c('0x34')](_0x495853[_0xe76c('0x31')],_0x495853[_0xe76c('0x35')]);_0x30158f[_0xe76c('0x36')]=_[_0xe76c('0x34')](_0x495853['model'],qs['fields'](_0x490930[_0xe76c('0x35')][_0xe76c('0x37')]));_0x30158f[_0xe76c('0x36')]=_0x30158f[_0xe76c('0x36')][_0xe76c('0x38')]?_0x30158f[_0xe76c('0x36')]:_0x495853[_0xe76c('0x31')];if(!_0x490930[_0xe76c('0x35')][_0xe76c('0x39')]('nolimit')){_0x30158f[_0xe76c('0x1b')]=qs[_0xe76c('0x1b')](_0x490930['query'][_0xe76c('0x1b')]);_0x30158f[_0xe76c('0x19')]=qs[_0xe76c('0x19')](_0x490930[_0xe76c('0x35')][_0xe76c('0x19')]);}_0x30158f[_0xe76c('0x3a')]=qs[_0xe76c('0x3b')](_0x490930[_0xe76c('0x35')][_0xe76c('0x3b')]);_0x30158f[_0xe76c('0x3c')]=qs[_0xe76c('0x33')](_[_0xe76c('0x3d')](_0x490930[_0xe76c('0x35')],_0x495853[_0xe76c('0x33')]),_0x548040);if(_0x490930['query'][_0xe76c('0x3e')]){_0x30158f[_0xe76c('0x3c')]=_[_0xe76c('0x3f')](_0x30158f[_0xe76c('0x3c')],{'$or':_['map'](_0x548040,function(_0x27cee7){if(_0x27cee7[_0xe76c('0x2f')]!==_0xe76c('0x40')){var _0x32b94b={};_0x32b94b[_0x27cee7[_0xe76c('0x2a')]]={'$like':'%'+_0x490930[_0xe76c('0x35')][_0xe76c('0x3e')]+'%'};return _0x32b94b;}})});}_0x30158f=_[_0xe76c('0x3f')]({},_0x30158f,_0x490930[_0xe76c('0x41')]);var _0x3dcc99={'where':_0x30158f[_0xe76c('0x3c')]};return db[_0xe76c('0x2c')][_0xe76c('0x1c')](_0x3dcc99)[_0xe76c('0x22')](function(_0x331e88){_0x5f2978[_0xe76c('0x1c')]=_0x331e88;if(_0x490930['query']['includeAll']){_0x30158f[_0xe76c('0x42')]=[{'all':!![]}];}return db[_0xe76c('0x2c')]['findAll'](_0x30158f);})[_0xe76c('0x22')](function(_0x35eaf2){_0x5f2978[_0xe76c('0x43')]=_0x35eaf2;return _0x5f2978;})[_0xe76c('0x22')](respondWithFilteredResult(_0x417918,_0x30158f))[_0xe76c('0x44')](handleError(_0x417918,null));};exports[_0xe76c('0x45')]=function(_0x3c47bf,_0xb156f2){var _0x31aa0e={'raw':!![],'where':{'id':_0x3c47bf['params']['id']}},_0x53d87f={};_0x53d87f[_0xe76c('0x31')]=_[_0xe76c('0x32')](db['Pause'][_0xe76c('0x2d')]);_0x53d87f[_0xe76c('0x35')]=_[_0xe76c('0x32')](_0x3c47bf['query']);_0x53d87f[_0xe76c('0x33')]=_[_0xe76c('0x34')](_0x53d87f[_0xe76c('0x31')],_0x53d87f[_0xe76c('0x35')]);_0x31aa0e[_0xe76c('0x36')]=_[_0xe76c('0x34')](_0x53d87f[_0xe76c('0x31')],qs['fields'](_0x3c47bf[_0xe76c('0x35')][_0xe76c('0x37')]));_0x31aa0e[_0xe76c('0x36')]=_0x31aa0e[_0xe76c('0x36')]['length']?_0x31aa0e[_0xe76c('0x36')]:_0x53d87f['model'];if(_0x3c47bf[_0xe76c('0x35')][_0xe76c('0x46')]){_0x31aa0e['include']=[{'all':!![]}];}_0x31aa0e=_[_0xe76c('0x3f')]({},_0x31aa0e,_0x3c47bf[_0xe76c('0x41')]);return db[_0xe76c('0x2c')]['find'](_0x31aa0e)[_0xe76c('0x22')](handleEntityNotFound(_0xb156f2,null))['then'](respondWithResult(_0xb156f2,null))[_0xe76c('0x44')](handleError(_0xb156f2,null));};exports[_0xe76c('0x47')]=function(_0x111867,_0x221496){return db['Pause'][_0xe76c('0x47')](_0x111867[_0xe76c('0x48')],{})[_0xe76c('0x22')](function(_0x58e7af){var _0x24f80b=_0x111867[_0xe76c('0x49')]['get']({'plain':!![]});if(!_0x24f80b)throw new Error(_0xe76c('0x4a'));if(_0x24f80b[_0xe76c('0x4b')]===_0xe76c('0x49')){var _0xef06bf=_0x58e7af[_0xe76c('0x23')]({'plain':!![]});var _0xd696af='Pauses';return db[_0xe76c('0x4c')][_0xe76c('0x4d')]({'where':{'name':_0xd696af,'userProfileId':_0x24f80b[_0xe76c('0x4e')]},'raw':!![]})['then'](function(_0x409178){if(_0x409178&&_0x409178['autoAssociation']===0x0){return db[_0xe76c('0x25')][_0xe76c('0x47')]({'name':_0xef06bf['name'],'resourceId':_0xef06bf['id'],'type':_0x409178[_0xe76c('0x2a')],'sectionId':_0x409178['id']},{})[_0xe76c('0x22')](function(){return _0x58e7af;});}else{return _0x58e7af;}})[_0xe76c('0x44')](function(_0x58519d){logger[_0xe76c('0x28')](_0xe76c('0x4f'),_0x58519d);throw _0x58519d;});}return _0x58e7af;})[_0xe76c('0x22')](respondWithResult(_0x221496,0xc9))[_0xe76c('0x44')](handleError(_0x221496,null));};exports[_0xe76c('0x50')]=function(_0x13f584,_0x5dfe0c){if(_0x13f584[_0xe76c('0x48')]['id']){delete _0x13f584[_0xe76c('0x48')]['id'];}return db['Pause'][_0xe76c('0x4d')]({'where':{'id':_0x13f584[_0xe76c('0x51')]['id']}})[_0xe76c('0x22')](handleEntityNotFound(_0x5dfe0c,null))['then'](saveUpdates(_0x13f584[_0xe76c('0x48')],null))[_0xe76c('0x22')](respondWithResult(_0x5dfe0c,null))[_0xe76c('0x44')](handleError(_0x5dfe0c,null));};exports[_0xe76c('0x21')]=function(_0x32de88,_0xc5427a){return db[_0xe76c('0x2c')][_0xe76c('0x4d')]({'where':{'id':_0x32de88[_0xe76c('0x51')]['id']}})['then'](handleEntityNotFound(_0xc5427a,null))[_0xe76c('0x22')](removeEntity(_0xc5427a,null))[_0xe76c('0x44')](handleError(_0xc5427a,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 4693719..974267b 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x460ed5,_0x2e85b1){var _0x73c7eb=function(_0x8d9f9){while(--_0x8d9f9){_0x460ed5['push'](_0x460ed5['shift']());}};_0x73c7eb(++_0x2e85b1);}(_0xabce,0x103));var _0xeabc=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xabce[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x5549c3,_0xe4fd61){var _0x4e6a9f=function(_0x46d7f2){while(--_0x46d7f2){_0x5549c3['push'](_0x5549c3['shift']());}};_0x4e6a9f(++_0xe4fd61);}(_0x53ec,0x192));var _0xc53e=function(_0x28d391,_0x1357b3){_0x28d391=_0x28d391-0x0;var _0x3c8bf0=_0x53ec[_0x28d391];return _0x3c8bf0;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 5af5fb6..6d6d211 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x23b9f0,_0x3563c5){var _0x177f40=function(_0x235fdd){while(--_0x235fdd){_0x23b9f0['push'](_0x23b9f0['shift']());}};_0x177f40(++_0x3563c5);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xb10b[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x459b4f,_0x27d389){var _0x1538b3=function(_0x93f4af){while(--_0x93f4af){_0x459b4f['push'](_0x459b4f['shift']());}};_0x1538b3(++_0x27d389);}(_0x7a54,0x106));var _0x47a5=function(_0x45fba3,_0x4edcc7){_0x45fba3=_0x45fba3-0x0;var _0x37f37c=_0x7a54[_0x45fba3];return _0x37f37c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 8c01ef4..8171969 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 _0x303a=['show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','/:id','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook'];(function(_0x1a4c27,_0x5a4b45){var _0x578d9=function(_0x10b6df){while(--_0x10b6df){_0x1a4c27['push'](_0x1a4c27['shift']());}};_0x578d9(++_0x5a4b45);}(_0x303a,0x1a0));var _0xa303=function(_0xf671c8,_0x275759){_0xf671c8=_0xf671c8-0x0;var _0x2a7d44=_0x303a[_0xf671c8];return _0x2a7d44;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),controller['webhookGet']);router['get']('/:id',auth[_0xa303('0xa')](),controller[_0xa303('0xd')]);router['get'](_0xa303('0xe'),auth['isAuthenticated'](),controller[_0xa303('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29cd60,_0x17dfcd,_0x382cfd){_0x382cfd(null,path[_0xa303('0x10')](config['root'],_0xa303('0x11')));},'filename':function(_0x4c0169,_0xf5df1e,_0x43a054){_0xf5df1e[_0xa303('0x12')]=_0xf5df1e['originalname'][_0xa303('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x43a054(null,util[_0xa303('0x14')](_0xa303('0x15'),path[_0xa303('0x16')](_0xf5df1e[_0xa303('0x12')],path[_0xa303('0x17')](_0xf5df1e[_0xa303('0x12')])),Date[_0xa303('0x18')](),path['extname'](_0xf5df1e[_0xa303('0x12')])));}})});router[_0xa303('0x19')]('/',upload[_0xa303('0x1a')](_0xa303('0x1b')),controller[_0xa303('0x1c')]);router[_0xa303('0x19')]('/webhook',controller[_0xa303('0x1d')]);router['put'](_0xa303('0x1e'),auth['isAuthenticated'](),controller[_0xa303('0x1f')]);router['delete'](_0xa303('0x1e'),auth[_0xa303('0xa')](),controller[_0xa303('0x20')]);module['exports']=router; \ No newline at end of file +var _0x00bb=['upload','post','put','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','/webhook','webhookGet','/:id','isAuthenticated','/:id/download','download','diskStorage','originalname','replace','%s-%s%s','basename','extname','file'];(function(_0x3bcc52,_0x564670){var _0x4b53d3=function(_0x3a3970){while(--_0x3a3970){_0x3bcc52['push'](_0x3bcc52['shift']());}};_0x4b53d3(++_0x564670);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x00bb[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),controller[_0xb00b('0xa')]);router[_0xb00b('0x8')](_0xb00b('0xb'),auth[_0xb00b('0xc')](),controller['show']);router['get'](_0xb00b('0xd'),auth[_0xb00b('0xc')](),controller[_0xb00b('0xe')]);var upload=multer({'storage':multer[_0xb00b('0xf')]({'destination':function(_0x28d3cc,_0x48e125,_0x3182db){_0x3182db(null,path['join'](config['root'],'server/files/plugins'));},'filename':function(_0x4ff792,_0x2d8ddf,_0x1be8aa){_0x2d8ddf[_0xb00b('0x10')]=_0x2d8ddf[_0xb00b('0x10')][_0xb00b('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1be8aa(null,util['format'](_0xb00b('0x12'),path[_0xb00b('0x13')](_0x2d8ddf['originalname'],path[_0xb00b('0x14')](_0x2d8ddf[_0xb00b('0x10')])),Date['now'](),path['extname'](_0x2d8ddf[_0xb00b('0x10')])));}})});router['post']('/',upload['single'](_0xb00b('0x15')),controller[_0xb00b('0x16')]);router[_0xb00b('0x17')](_0xb00b('0x9'),controller['webhookPost']);router[_0xb00b('0x18')]('/:id',auth[_0xb00b('0xc')](),controller['update']);router[_0xb00b('0x19')]('/:id',auth[_0xb00b('0xc')](),controller[_0xb00b('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 716d508..5a8631e 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 _0x19b7=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly'];(function(_0x1bbfa0,_0x2aad7b){var _0x4d8e06=function(_0x456566){while(--_0x456566){_0x1bbfa0['push'](_0x1bbfa0['shift']());}};_0x4d8e06(++_0x2aad7b);}(_0x19b7,0x1b0));var _0x719b=function(_0xcf2847,_0x520baa){_0xcf2847=_0xcf2847-0x0;var _0xe40d10=_0x19b7[_0xcf2847];return _0xe40d10;};'use strict';var Sequelize=require(_0x719b('0x0'));module[_0x719b('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x719b('0x2')]('html',_0x719b('0x3'))},'description':{'type':Sequelize[_0x719b('0x4')]},'version':{'type':Sequelize[_0x719b('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x719b('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x719b('0x6')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x719b('0x7'),_0x719b('0x8'),'never'),'defaultValue':_0x719b('0x8'),'comment':_0x719b('0x9')},'icon':{'type':Sequelize[_0x719b('0xa')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x719b('0xa')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x719b('0xa')]}}; \ No newline at end of file +var _0x8523=['adminOnly','agentOnly','always','never','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x278d17,_0xd3c031){var _0x5ac95e=function(_0x27424f){while(--_0x27424f){_0x278d17['push'](_0x278d17['shift']());}};_0x5ac95e(++_0xd3c031);}(_0x8523,0x90));var _0x3852=function(_0x20a878,_0x18dd17){_0x20a878=_0x20a878-0x0;var _0x1f76c0=_0x8523[_0x20a878];return _0x1f76c0;};'use strict';var Sequelize=require(_0x3852('0x0'));module[_0x3852('0x1')]={'name':{'type':Sequelize[_0x3852('0x2')]},'type':{'type':Sequelize[_0x3852('0x3')](_0x3852('0x4'),_0x3852('0x5'))},'description':{'type':Sequelize[_0x3852('0x6')]},'version':{'type':Sequelize[_0x3852('0x6')]},'path':{'type':Sequelize['STRING'],'comment':_0x3852('0x7')},'active':{'type':Sequelize[_0x3852('0x8')],'defaultValue':0x0,'comment':_0x3852('0x9')},'sidebar':{'type':Sequelize[_0x3852('0x3')](_0x3852('0xa'),_0x3852('0xb'),_0x3852('0xc'),_0x3852('0xd')),'defaultValue':_0x3852('0xc'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x3852('0x2')]},'adminUrl':{'type':Sequelize[_0x3852('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x3852('0x2')]},'scriptPath':{'type':Sequelize[_0x3852('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 08313c7..e4d215c 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 _0x74df=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','get','Plugins','UserProfileResource','end','error','name','index','Plugin','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','download','path','join','root','%s.zip','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','server/files/plugins','node_modules/**/*','basename','attachments/**/*','Plugin\x20not\x20found','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','scriptPath','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','create','send','Zip\x20archive\x20removed','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','zip-dir','fast-json-patch','request-promise'];(function(_0x3855fd,_0x26003f){var _0x226a53=function(_0x14186f){while(--_0x14186f){_0x3855fd['push'](_0x3855fd['shift']());}};_0x226a53(++_0x26003f);}(_0x74df,0x151));var _0xf74d=function(_0x49bf97,_0x4db7f5){_0x49bf97=_0x49bf97-0x0;var _0x533532=_0x74df[_0x49bf97];return _0x533532;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf74d('0x0'));var jsonpatch=require(_0xf74d('0x1'));var rp=require(_0xf74d('0x2'));var moment=require(_0xf74d('0x3'));var BPromise=require(_0xf74d('0x4'));var Mustache=require(_0xf74d('0x5'));var util=require(_0xf74d('0x6'));var path=require('path');var sox=require(_0xf74d('0x7'));var csv=require(_0xf74d('0x8'));var ejs=require(_0xf74d('0x9'));var fs=require('fs');var fs_extra=require(_0xf74d('0xa'));var _=require(_0xf74d('0xb'));var squel=require(_0xf74d('0xc'));var crypto=require(_0xf74d('0xd'));var jsforce=require(_0xf74d('0xe'));var deskjs=require(_0xf74d('0xf'));var toCsv=require(_0xf74d('0x8'));var querystring=require('querystring');var Papa=require(_0xf74d('0x10'));var extract=require(_0xf74d('0x11'));var rimraf=require(_0xf74d('0x12'));var archiver=require(_0xf74d('0x13'));var Redis=require(_0xf74d('0x14'));var authService=require(_0xf74d('0x15'));var qs=require(_0xf74d('0x16'));var as=require(_0xf74d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf74d('0x18'));var utils=require('../../config/utils');var config=require(_0xf74d('0x19'));var licenseUtil=require(_0xf74d('0x1a'));var db=require(_0xf74d('0x1b'))['db'];config[_0xf74d('0x1c')]=_[_0xf74d('0x1d')](config[_0xf74d('0x1c')],{'host':_0xf74d('0x1e'),'port':0x18eb});var socket=require(_0xf74d('0x1f'))(new Redis(config['redis']));require(_0xf74d('0x20'))[_0xf74d('0x21')](socket);function respondWithStatusCode(_0x2355c4,_0x76e7fc){_0x76e7fc=_0x76e7fc||0xcc;return function(_0x14b031){if(_0x14b031){return _0x2355c4[_0xf74d('0x22')](_0x76e7fc);}return _0x2355c4[_0xf74d('0x23')](_0x76e7fc)['end']();};}function respondWithResult(_0x205165,_0xe8285){_0xe8285=_0xe8285||0xc8;return function(_0x15476d){if(_0x15476d){return _0x205165['status'](_0xe8285)['json'](_0x15476d);}};}function respondWithFilteredResult(_0x352202,_0x237ccd){return function(_0x3bd5b2){if(_0x3bd5b2){var _0x3ad165=typeof _0x237ccd[_0xf74d('0x24')]==='undefined'&&typeof _0x237ccd['limit']===_0xf74d('0x25');var _0x17fef6=_0x3bd5b2[_0xf74d('0x26')];var _0x2ef04e=_0x3ad165?0x0:_0x237ccd[_0xf74d('0x24')];var _0x1c1e32=_0x3ad165?_0x3bd5b2[_0xf74d('0x26')]:_0x237ccd[_0xf74d('0x24')]+_0x237ccd[_0xf74d('0x27')];var _0x32e096;if(_0x1c1e32>=_0x17fef6){_0x1c1e32=_0x17fef6;_0x32e096=0xc8;}else{_0x32e096=0xce;}_0x352202[_0xf74d('0x23')](_0x32e096);return _0x352202[_0xf74d('0x28')](_0xf74d('0x29'),_0x2ef04e+'-'+_0x1c1e32+'/'+_0x17fef6)[_0xf74d('0x2a')](_0x3bd5b2);}return null;};}function patchUpdates(_0x470dd3){return function(_0x5c9320){try{jsonpatch[_0xf74d('0x2b')](_0x5c9320,_0x470dd3,!![]);}catch(_0x513217){return BPromise[_0xf74d('0x2c')](_0x513217);}return _0x5c9320[_0xf74d('0x2d')]();};}function saveUpdates(_0xed5b4a,_0x1dabf3){return function(_0x1e72f0){if(_0x1e72f0){return _0x1e72f0['update'](_0xed5b4a)['then'](function(_0x4ffd6f){return _0x4ffd6f;});}return null;};}function removeEntity(_0x157da2,_0x4a8c17){return function(_0xaf463e){if(_0xaf463e){return _0xaf463e[_0xf74d('0x2e')]()[_0xf74d('0x2f')](function(){var _0x10259d=_0xaf463e[_0xf74d('0x30')]({'plain':!![]});var _0x52909f=_0xf74d('0x31');return db[_0xf74d('0x32')]['destroy']({'where':{'type':_0x52909f,'resourceId':_0x10259d['id']}})[_0xf74d('0x2f')](function(){return _0xaf463e;});})[_0xf74d('0x2f')](function(){_0x157da2[_0xf74d('0x23')](0xcc)[_0xf74d('0x33')]();});}};}function handleEntityNotFound(_0x5b0dc2,_0x1bafc3){return function(_0x10f46c){if(!_0x10f46c){_0x5b0dc2[_0xf74d('0x22')](0x194);}return _0x10f46c;};}function handleError(_0x10cfbd,_0x494511){_0x494511=_0x494511||0x1f4;return function(_0x25dbeb){logger[_0xf74d('0x34')](_0x25dbeb['stack']);if(_0x25dbeb['name']){delete _0x25dbeb[_0xf74d('0x35')];}_0x10cfbd[_0xf74d('0x23')](_0x494511)['send'](_0x25dbeb);};}exports[_0xf74d('0x36')]=function(_0x34323d,_0x4f7708){var _0x4db79a={},_0x4a59c1={},_0x1c89d1={'count':0x0,'rows':[]};var _0x570b31=_['map'](db[_0xf74d('0x37')]['rawAttributes'],function(_0x32c8c1){return{'name':_0x32c8c1[_0xf74d('0x38')],'type':_0x32c8c1[_0xf74d('0x39')][_0xf74d('0x3a')]};});_0x4a59c1[_0xf74d('0x3b')]=_[_0xf74d('0x3c')](_0x570b31,'name');_0x4a59c1[_0xf74d('0x3d')]=_['keys'](_0x34323d[_0xf74d('0x3d')]);_0x4a59c1[_0xf74d('0x3e')]=_[_0xf74d('0x3f')](_0x4a59c1['model'],_0x4a59c1[_0xf74d('0x3d')]);_0x4db79a['attributes']=_[_0xf74d('0x3f')](_0x4a59c1[_0xf74d('0x3b')],qs[_0xf74d('0x40')](_0x34323d[_0xf74d('0x3d')]['fields']));_0x4db79a[_0xf74d('0x41')]=_0x4db79a['attributes'][_0xf74d('0x42')]?_0x4db79a[_0xf74d('0x41')]:_0x4a59c1[_0xf74d('0x3b')];if(!_0x34323d[_0xf74d('0x3d')][_0xf74d('0x43')]('nolimit')){_0x4db79a[_0xf74d('0x27')]=qs[_0xf74d('0x27')](_0x34323d['query'][_0xf74d('0x27')]);_0x4db79a[_0xf74d('0x24')]=qs[_0xf74d('0x24')](_0x34323d[_0xf74d('0x3d')][_0xf74d('0x24')]);}_0x4db79a[_0xf74d('0x44')]=qs[_0xf74d('0x45')](_0x34323d[_0xf74d('0x3d')][_0xf74d('0x45')]);_0x4db79a[_0xf74d('0x46')]=qs['filters'](_[_0xf74d('0x47')](_0x34323d['query'],_0x4a59c1[_0xf74d('0x3e')]),_0x570b31);if(_0x34323d[_0xf74d('0x3d')]['filter']){_0x4db79a[_0xf74d('0x46')]=_[_0xf74d('0x48')](_0x4db79a[_0xf74d('0x46')],{'$or':_[_0xf74d('0x3c')](_0x570b31,function(_0x523ac0){if(_0x523ac0[_0xf74d('0x39')]!==_0xf74d('0x49')){var _0xb06828={};_0xb06828[_0x523ac0['name']]={'$like':'%'+_0x34323d['query'][_0xf74d('0x4a')]+'%'};return _0xb06828;}})});}_0x4db79a=_['merge']({},_0x4db79a,_0x34323d[_0xf74d('0x4b')]);var _0x4f19f9={'where':_0x4db79a['where']};return db[_0xf74d('0x37')][_0xf74d('0x26')](_0x4f19f9)[_0xf74d('0x2f')](function(_0x9b5708){_0x1c89d1[_0xf74d('0x26')]=_0x9b5708;if(_0x34323d[_0xf74d('0x3d')][_0xf74d('0x4c')]){_0x4db79a[_0xf74d('0x4d')]=[{'all':!![]}];}return db[_0xf74d('0x37')][_0xf74d('0x4e')](_0x4db79a);})['then'](function(_0x5c1144){_0x1c89d1['rows']=_0x5c1144;return _0x1c89d1;})['then'](respondWithFilteredResult(_0x4f7708,_0x4db79a))[_0xf74d('0x4f')](handleError(_0x4f7708,null));};exports[_0xf74d('0x50')]=function(_0x53b53d,_0x584834){var _0x5be900={'raw':!![],'where':{'id':_0x53b53d[_0xf74d('0x51')]['id']}},_0x117ef1={};_0x117ef1[_0xf74d('0x3b')]=_['keys'](db[_0xf74d('0x37')][_0xf74d('0x52')]);_0x117ef1[_0xf74d('0x3d')]=_[_0xf74d('0x53')](_0x53b53d[_0xf74d('0x3d')]);_0x117ef1['filters']=_['intersection'](_0x117ef1[_0xf74d('0x3b')],_0x117ef1[_0xf74d('0x3d')]);_0x5be900[_0xf74d('0x41')]=_[_0xf74d('0x3f')](_0x117ef1[_0xf74d('0x3b')],qs['fields'](_0x53b53d[_0xf74d('0x3d')][_0xf74d('0x40')]));_0x5be900[_0xf74d('0x41')]=_0x5be900['attributes']['length']?_0x5be900[_0xf74d('0x41')]:_0x117ef1[_0xf74d('0x3b')];if(_0x53b53d[_0xf74d('0x3d')][_0xf74d('0x4c')]){_0x5be900[_0xf74d('0x4d')]=[{'all':!![]}];}_0x5be900=_['merge']({},_0x5be900,_0x53b53d[_0xf74d('0x4b')]);return db['Plugin']['find'](_0x5be900)[_0xf74d('0x2f')](handleEntityNotFound(_0x584834,null))[_0xf74d('0x2f')](respondWithResult(_0x584834,null))[_0xf74d('0x4f')](handleError(_0x584834,null));};exports[_0xf74d('0x54')]=function(_0x30edcd,_0x273b4f,_0x3e25ab){return db[_0xf74d('0x37')]['find']({'where':{'id':_0x30edcd['params']['id']},'attributes':[_0xf74d('0x35'),_0xf74d('0x55')],'raw':!![]})[_0xf74d('0x2f')](handleEntityNotFound(_0x273b4f,null))['then'](function(_0x166cbf){if(_0x166cbf){var _0x59f4c5=path[_0xf74d('0x56')](config[_0xf74d('0x57')],'server/files/plugins',util['format'](_0xf74d('0x58'),path['basename'](_0x166cbf[_0xf74d('0x55')])));var _0x2df4aa=fs[_0xf74d('0x59')](_0x59f4c5);var _0x2a4c84=archiver(_0xf74d('0x5a'),{'zlib':{'level':0x9}});_0x2a4c84['on']('warning',function(_0x36de96){if(_0x36de96[_0xf74d('0x5b')]===_0xf74d('0x5c')){logger[_0xf74d('0x34')](_0x36de96);}else{throw new db[(_0xf74d('0x5d'))][(_0xf74d('0x5e'))](_0xf74d('0x5f'));}});_0x2a4c84['on'](_0xf74d('0x34'),function(_0x487499){throw new db[(_0xf74d('0x5d'))][(_0xf74d('0x5e'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2a4c84['pipe'](_0x2df4aa);_0x2a4c84['glob'](_0xf74d('0x60'),{'cwd':path[_0xf74d('0x56')](config['root'],_0xf74d('0x61'),path['dirname'](_0x166cbf[_0xf74d('0x55')])),'ignore':[path[_0xf74d('0x56')](path['basename'](_0x166cbf[_0xf74d('0x55')]),_0xf74d('0x62')),path['join'](path[_0xf74d('0x63')](_0x166cbf[_0xf74d('0x55')]),_0xf74d('0x64'))],'nodir':!![]})['finalize']();_0x2df4aa['on']('close',function(){if(!fs['existsSync'](_0x59f4c5)){throw new db['Sequelize'][(_0xf74d('0x5e'))](_0xf74d('0x65'));}return _0x273b4f[_0xf74d('0x54')](_0x59f4c5,util[_0xf74d('0x66')]('%s.zip',path['basename'](_0x166cbf[_0xf74d('0x55')])),function(_0x3e4a84){if(_0x3e4a84){throw new db[(_0xf74d('0x5d'))][(_0xf74d('0x5e'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xf74d('0x67')](_0x59f4c5);logger[_0xf74d('0x68')](_0xf74d('0x69'));logger[_0xf74d('0x68')](_0xf74d('0x6a'));});});}return null;})['catch'](handleError(_0x273b4f,null));};exports['upload']=function(_0x1bff10,_0x435c4c,_0x14d31a){var _0xfd7fa1=path[_0xf74d('0x63')](_0x1bff10['file'][_0xf74d('0x6b')],path['extname'](_0x1bff10[_0xf74d('0x6c')][_0xf74d('0x6b')]));var _0x257740=path[_0xf74d('0x56')](config[_0xf74d('0x57')],_0xf74d('0x61'),_0x1bff10[_0xf74d('0x6c')]['filename']);var _0x25d4f9=path[_0xf74d('0x56')](config[_0xf74d('0x57')],_0xf74d('0x61'),_0xfd7fa1);logger[_0xf74d('0x68')](_0xf74d('0x6d'),_0x257740);logger[_0xf74d('0x68')](_0xf74d('0x6e'),_0x25d4f9);try{fs[_0xf74d('0x6f')](_0x257740,parseInt(_0xf74d('0x70'),0x8));extract(_0x257740,{'dir':_0x25d4f9},function(_0x89e2df){if(_0x89e2df){logger[_0xf74d('0x34')](_0x89e2df);handleError(_0x89e2df,!![]);};var _0x5eef2c=fs[_0xf74d('0x71')](_0x25d4f9);if(_0x5eef2c['length']>0x1){removeReferences(_0x257740,_0x25d4f9);logger[_0xf74d('0x34')](_0xf74d('0x72'));return _0x14d31a(new Error(_0xf74d('0x72')));}var _0x35c6c1=fs[_0xf74d('0x73')](path[_0xf74d('0x56')](_0x25d4f9,_0x5eef2c[0x0]));if(_0x35c6c1['isFile']()){removeReferences(_0x257740,_0x25d4f9);logger[_0xf74d('0x34')](_0xf74d('0x72'));return _0x14d31a(new Error(_0xf74d('0x72')));}if(_0x35c6c1[_0xf74d('0x74')]()){var _0x3344a4=fs['readdirSync'](path[_0xf74d('0x56')](_0x25d4f9,_0x5eef2c[0x0]));if(_0x3344a4[_0xf74d('0x42')]===0x0){removeReferences(_0x257740,_0x25d4f9);logger[_0xf74d('0x34')]('Invalid\x20plugin\x20structure');return _0x14d31a(new Error(_0xf74d('0x72')));}var _0x256518=_0x3344a4[_0xf74d('0x75')](function(_0x47c01f){return _0x47c01f===_0xf74d('0x76');});if(!_0x256518){return _0x14d31a(new Error(_0xf74d('0x77')));}var _0x595226=fs[_0xf74d('0x78')](path['join'](_0x25d4f9,_0x5eef2c[0x0],_0xf74d('0x76')));var _0x539355=JSON[_0xf74d('0x79')](_0x595226);if(_0xf74d('0x25')==typeof _0x539355['name']){return _0x14d31a(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xf74d('0x25')==typeof _0x539355[_0xf74d('0x39')]){return _0x14d31a(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xf74d('0x25')==typeof _0x539355[_0xf74d('0x7a')]){return _0x14d31a(new Error(_0xf74d('0x7b')));}if(_0xf74d('0x25')==typeof _0x539355[_0xf74d('0x7c')]){return _0x14d31a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x539355[_0xf74d('0x39')]===_0xf74d('0x7d')){if('undefined'==typeof _0x539355['parameters'][_0xf74d('0x7e')]){return _0x14d31a(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xf74d('0x25')==typeof _0x539355[_0xf74d('0x7c')][_0xf74d('0x7e')][_0xf74d('0x7f')]&&_0xf74d('0x25')==typeof _0x539355[_0xf74d('0x7c')][_0xf74d('0x7e')]['agent']){return _0x14d31a(new Error(_0xf74d('0x80')));}}else if(_0x539355[_0xf74d('0x39')]===_0xf74d('0x81')){if('undefined'==typeof _0x539355[_0xf74d('0x7c')][_0xf74d('0x82')]){return _0x14d31a(new Error(_0xf74d('0x83')));}if(_0xf74d('0x25')==typeof _0x539355['parameters']['scriptPath']){return _0x14d31a(new Error(_0xf74d('0x84')));}}else{return _0x14d31a(new Error(_0xf74d('0x85')));}var _0x166cab=_0x539355[_0xf74d('0x35')];var _0x44b952=_0x539355[_0xf74d('0x86')];var _0x3ae683=_0x539355[_0xf74d('0x39')];var _0x430d1f=_0x539355[_0xf74d('0x87')]?_0x539355[_0xf74d('0x87')]:_0xf74d('0x88');var _0x4b7296=_0x539355[_0xf74d('0x89')]?_0x539355['icon']:_0xf74d('0x8a');var _0x339bf9='';var _0x49e350='';var _0x31bb8c='';var _0x3e0a5d='';var _0x4f6d8a=_0x539355['version'];if(_0x3ae683===_0xf74d('0x7d')){if(_0xf74d('0x25')!=typeof _0x539355[_0xf74d('0x7c')][_0xf74d('0x7e')][_0xf74d('0x7f')]){var _0x1ddd53=_0x539355['parameters'][_0xf74d('0x7e')][_0xf74d('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xf74d('0x8b')](_0x1ddd53)){_0x339bf9=path[_0xf74d('0x56')](_0xf74d('0x8c'),_0xfd7fa1,_0x5eef2c[0x0],_0x1ddd53);}else{_0x339bf9=_0x1ddd53;}}else{logger[_0xf74d('0x68')](_0xf74d('0x8d'));}if(_0xf74d('0x25')!=typeof _0x539355[_0xf74d('0x7c')][_0xf74d('0x7e')][_0xf74d('0x8e')]){var _0x383bf5=_0x539355['parameters'][_0xf74d('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x383bf5)){_0x49e350=path[_0xf74d('0x56')](_0xf74d('0x8c'),_0xfd7fa1,_0x5eef2c[0x0],_0x383bf5);}else{_0x49e350=_0x383bf5;}}else{logger[_0xf74d('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x3ae683===_0xf74d('0x81')){_0x31bb8c=_0x539355['parameters'][_0xf74d('0x82')];_0x3e0a5d=_0x539355['parameters'][_0xf74d('0x8f')];if(_0xf74d('0x25')!=typeof _0x539355['parameters'][_0xf74d('0x7e')]){if(_0xf74d('0x25')!=typeof _0x539355[_0xf74d('0x7c')][_0xf74d('0x7e')][_0xf74d('0x7f')]){var _0x1ddd53=_0x539355[_0xf74d('0x7c')][_0xf74d('0x7e')][_0xf74d('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xf74d('0x8b')](_0x1ddd53)){_0x339bf9=path[_0xf74d('0x56')](_0xf74d('0x8c'),_0xfd7fa1,_0x5eef2c[0x0],_0x1ddd53);}else{_0x339bf9=_0x1ddd53;}}if('undefined'!=typeof _0x539355[_0xf74d('0x7c')][_0xf74d('0x7e')][_0xf74d('0x8e')]){var _0x383bf5=_0x539355['parameters']['views'][_0xf74d('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0xf74d('0x8b')](_0x383bf5)){_0x49e350=path[_0xf74d('0x56')](_0xf74d('0x8c'),_0xfd7fa1,_0x5eef2c[0x0],_0x383bf5);}else{_0x49e350=_0x383bf5;}}}}var _0x1649c8={'name':_0x166cab,'description':_0x44b952,'path':path[_0xf74d('0x56')](_0xfd7fa1,_0x5eef2c[0x0]),'type':_0x3ae683,'sidebar':_0x430d1f,'icon':_0x4b7296,'adminUrl':_0x339bf9,'agentUrl':_0x49e350,'scriptName':_0x31bb8c,'scriptPath':_0x3e0a5d,'version':_0x4f6d8a};removeReferences(_0x257740,null);return db[_0xf74d('0x37')]['create'](_0x1649c8)[_0xf74d('0x2f')](function(_0x3b4855){var _0x17c821={'role':_0x1bff10[_0xf74d('0x90')][_0xf74d('0x91')],'userProfileId':_0x1bff10[_0xf74d('0x90')][_0xf74d('0x92')]};if(!_0x17c821)throw new Error(_0xf74d('0x93'));if(_0x17c821[_0xf74d('0x91')]==='user'){var _0xf19d82=_0x3b4855[_0xf74d('0x30')]({'plain':!![]});return db[_0xf74d('0x94')][_0xf74d('0x95')]({'where':{'name':_0xf74d('0x31'),'userProfileId':_0x17c821['userProfileId']},'raw':!![]})[_0xf74d('0x2f')](function(_0x39d830){if(_0x39d830&&_0x39d830[_0xf74d('0x96')]===0x0){return db[_0xf74d('0x32')][_0xf74d('0x97')]({'name':_0xf19d82[_0xf74d('0x35')],'resourceId':_0xf19d82['id'],'type':_0x39d830[_0xf74d('0x35')],'sectionId':_0x39d830['id']},{})[_0xf74d('0x2f')](function(){return _0x3b4855;});}else{return _0x3b4855;}})['catch'](function(_0x540d82){logger[_0xf74d('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x540d82);throw _0x540d82;});}return _0x3b4855;})['then'](respondWithResult(_0x435c4c,null))['catch'](handleError(_0x435c4c,null));}});}catch(_0x54b24d){_0x435c4c[_0xf74d('0x23')](0x1f4)[_0xf74d('0x98')](_0x54b24d);}};function removeReferences(_0x1c20c9,_0x50d2d7){try{if(_0x1c20c9){fs['unlinkSync'](_0x1c20c9);logger[_0xf74d('0x68')](_0xf74d('0x99'));}if(_0x50d2d7){rimraf(_0x50d2d7,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x252c99){logger['error'](_0x252c99);}}exports['update']=function(_0x4cd2e,_0x29c3bf,_0x4e9b28){return db[_0xf74d('0x37')]['find']({'where':{'id':_0x4cd2e['params']['id']}})[_0xf74d('0x2f')](handleEntityNotFound(_0x29c3bf,null))['then'](saveUpdates(_0x4cd2e['body'],null))['then'](respondWithResult(_0x29c3bf,null))[_0xf74d('0x4f')](handleError(_0x29c3bf,null));};exports['delete']=function(_0x258b3e,_0x18b8be,_0x564050){return db[_0xf74d('0x37')][_0xf74d('0x95')]({'where':{'id':_0x258b3e[_0xf74d('0x51')]['id']}})[_0xf74d('0x2f')](function(_0x34e348){if(_0x34e348){return _0x34e348[_0xf74d('0x2e')]();}})[_0xf74d('0x2f')](function(_0x715d7e){rimraf(path['join'](config[_0xf74d('0x57')],_0xf74d('0x61'),path[_0xf74d('0x9a')](_0x715d7e[_0xf74d('0x55')])),function(){});return _0x715d7e;})[_0xf74d('0x2f')](handleEntityNotFound(_0x18b8be,null))[_0xf74d('0x2f')](respondWithStatusCode(_0x18b8be,null))[_0xf74d('0x4f')](handleError(_0x18b8be,null));};exports[_0xf74d('0x9b')]=function(_0x2eadec,_0x5324ef,_0x35b71c){return BPromise[_0xf74d('0x9c')]()[_0xf74d('0x2f')](function(){if(!_0x2eadec[_0xf74d('0x3d')][_0xf74d('0x55')]){throw new Error(_0xf74d('0x9d'));}if(!_0x2eadec[_0xf74d('0x3d')]['port']){throw new Error(_0xf74d('0x9e'));}var _0x52c1c2=_0x2eadec[_0xf74d('0x3d')][_0xf74d('0x9f')]?_0x2eadec[_0xf74d('0x3d')]['hostname']+':'+_0x2eadec['query'][_0xf74d('0xa0')]:_0xf74d('0xa1')+_0x2eadec[_0xf74d('0x3d')][_0xf74d('0xa0')];var _0x9873d6=_0x2eadec[_0xf74d('0x3d')]['json']?_0x2eadec['query'][_0xf74d('0x2a')]:!![];var _0x14cc99=_0x2eadec['query']['encoding']?_0x2eadec['query'][_0xf74d('0xa2')]:null;var _0x232679={'method':_0x2eadec[_0xf74d('0xa3')],'uri':util['format']('%s%s',_0x52c1c2,_0x2eadec[_0xf74d('0x3d')][_0xf74d('0x55')]),'json':_0x9873d6,'resolveWithFullResponse':!![],'encoding':_0x14cc99,'qs':_0x2eadec[_0xf74d('0x3d')]};if(_0x2eadec['headers']){_0x232679[_0xf74d('0xa4')]=_0x2eadec['headers'];if(_0x232679['headers'][_0xf74d('0xa5')]){delete _0x232679[_0xf74d('0xa4')][_0xf74d('0xa5')];}}if(_0x232679['headers'][_0xf74d('0xa6')]){delete _0x232679[_0xf74d('0xa4')]['content-type'];}return rp(_0x232679);})[_0xf74d('0x2f')](function(_0x157bb1){if(_0x157bb1){_0x5324ef['set'](_0x157bb1['headers']);logger[_0xf74d('0x68')](_0x157bb1[_0xf74d('0x90')]);if(_[_0xf74d('0xa7')](_0x2eadec['query'][_0xf74d('0x55')],'download')&&_0x157bb1['statusCode']==0x1f4){return _0x5324ef['sendStatus'](_0x157bb1[_0xf74d('0xa8')]);}else{return _0x5324ef[_0xf74d('0x23')](_0x157bb1[_0xf74d('0xa8')])[_0xf74d('0x98')](_0x157bb1[_0xf74d('0x90')]);}}else{return _0x5324ef['sendStatus'](0xc8);}})['catch'](handleError(_0x5324ef,null));};exports[_0xf74d('0xa9')]=function(_0x58451b,_0x36fba7,_0x170958){return BPromise['resolve']()[_0xf74d('0x2f')](function(){if(!_0x58451b[_0xf74d('0x3d')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x58451b[_0xf74d('0x3d')][_0xf74d('0xa0')]){throw new Error(_0xf74d('0x9e'));}var _0x7f45c0=_0x58451b[_0xf74d('0x3d')][_0xf74d('0x9f')]?_0x58451b['query'][_0xf74d('0x9f')]+':'+_0x58451b[_0xf74d('0x3d')]['port']:_0xf74d('0xa1')+_0x58451b[_0xf74d('0x3d')][_0xf74d('0xa0')];var _0x1e13d6=_0x58451b[_0xf74d('0x3d')][_0xf74d('0x2a')]?_0x58451b['query'][_0xf74d('0x2a')]:!![];var _0xe380ff=_0x58451b[_0xf74d('0x3d')][_0xf74d('0xa2')]?_0x58451b[_0xf74d('0x3d')][_0xf74d('0xa2')]:null;var _0x1cea3c={'method':_0x58451b['method'],'uri':util['format']('%s%s',_0x7f45c0,_0x58451b['query'][_0xf74d('0x55')]),'json':_0x1e13d6,'resolveWithFullResponse':!![],'encoding':_0xe380ff,'body':_0x58451b[_0xf74d('0x90')]};if(_0x58451b[_0xf74d('0xa4')]){_0x1cea3c[_0xf74d('0xa4')]=_0x58451b[_0xf74d('0xa4')];if(_0x1cea3c['headers'][_0xf74d('0xa5')]){delete _0x1cea3c['headers']['content-length'];}}if(_0x1cea3c['headers'][_0xf74d('0xa6')]){delete _0x1cea3c[_0xf74d('0xa4')][_0xf74d('0xa6')];}return rp(_0x1cea3c);})[_0xf74d('0x2f')](function(_0x4548f2){if(_0x4548f2){_0x36fba7['set'](_0x4548f2[_0xf74d('0xa4')]);logger[_0xf74d('0x68')](_0x4548f2[_0xf74d('0x90')]);return _0x36fba7[_0xf74d('0x23')](_0x4548f2[_0xf74d('0xa8')])[_0xf74d('0x98')](_0x4548f2[_0xf74d('0x90')]);}else{return _0x36fba7[_0xf74d('0x22')](0xc8);}})['catch'](handleError(_0x36fba7,null));}; \ No newline at end of file +var _0x5558=['Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','download','statusCode','%s%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','then','destroy','Plugins','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','options','Plugin','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','join','server/files/plugins','format','%s.zip','basename','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing'];(function(_0x27906a,_0x3d58c8){var _0x3c956b=function(_0x488a7d){while(--_0x488a7d){_0x27906a['push'](_0x27906a['shift']());}};_0x3c956b(++_0x3d58c8);}(_0x5558,0x183));var _0x8555=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5558[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x8555('0x0'));var rimraf=require(_0x8555('0x1'));var zipdir=require(_0x8555('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8555('0x3'));var moment=require(_0x8555('0x4'));var BPromise=require(_0x8555('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8555('0x6'));var sox=require(_0x8555('0x7'));var csv=require(_0x8555('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8555('0x9'));var squel=require(_0x8555('0xa'));var crypto=require('crypto');var jsforce=require(_0x8555('0xb'));var deskjs=require(_0x8555('0xc'));var toCsv=require(_0x8555('0x8'));var querystring=require('querystring');var Papa=require(_0x8555('0xd'));var extract=require(_0x8555('0xe'));var rimraf=require(_0x8555('0x1'));var archiver=require('archiver');var Redis=require(_0x8555('0xf'));var authService=require(_0x8555('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8555('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8555('0x12'))(_0x8555('0x13'));var utils=require(_0x8555('0x14'));var config=require(_0x8555('0x15'));var licenseUtil=require(_0x8555('0x16'));var db=require(_0x8555('0x17'))['db'];config['redis']=_[_0x8555('0x18')](config[_0x8555('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8555('0x1a'))(new Redis(config[_0x8555('0x19')]));require(_0x8555('0x1b'))[_0x8555('0x1c')](socket);function respondWithStatusCode(_0x12993e,_0x3273e3){_0x3273e3=_0x3273e3||0xcc;return function(_0x3b8f11){if(_0x3b8f11){return _0x12993e[_0x8555('0x1d')](_0x3273e3);}return _0x12993e[_0x8555('0x1e')](_0x3273e3)[_0x8555('0x1f')]();};}function respondWithResult(_0x354feb,_0x1e7b9f){_0x1e7b9f=_0x1e7b9f||0xc8;return function(_0x3a703a){if(_0x3a703a){return _0x354feb[_0x8555('0x1e')](_0x1e7b9f)[_0x8555('0x20')](_0x3a703a);}};}function respondWithFilteredResult(_0x502b87,_0x2b980d){return function(_0x4d35d9){if(_0x4d35d9){var _0x321f86=typeof _0x2b980d['offset']==='undefined'&&typeof _0x2b980d[_0x8555('0x21')]==='undefined';var _0x4475d5=_0x4d35d9[_0x8555('0x22')];var _0x2a8454=_0x321f86?0x0:_0x2b980d[_0x8555('0x23')];var _0x26c4b7=_0x321f86?_0x4d35d9[_0x8555('0x22')]:_0x2b980d['offset']+_0x2b980d[_0x8555('0x21')];var _0x4ad7b3;if(_0x26c4b7>=_0x4475d5){_0x26c4b7=_0x4475d5;_0x4ad7b3=0xc8;}else{_0x4ad7b3=0xce;}_0x502b87['status'](_0x4ad7b3);return _0x502b87[_0x8555('0x24')](_0x8555('0x25'),_0x2a8454+'-'+_0x26c4b7+'/'+_0x4475d5)[_0x8555('0x20')](_0x4d35d9);}return null;};}function patchUpdates(_0x52db63){return function(_0x19a672){try{jsonpatch[_0x8555('0x26')](_0x19a672,_0x52db63,!![]);}catch(_0x85d639){return BPromise['reject'](_0x85d639);}return _0x19a672[_0x8555('0x27')]();};}function saveUpdates(_0x3fc1be,_0x2eb2b4){return function(_0x3e4a62){if(_0x3e4a62){return _0x3e4a62['update'](_0x3fc1be)[_0x8555('0x28')](function(_0x526807){return _0x526807;});}return null;};}function removeEntity(_0x5b4e28,_0xf31085){return function(_0x561abc){if(_0x561abc){return _0x561abc[_0x8555('0x29')]()[_0x8555('0x28')](function(){var _0x25e7bc=_0x561abc['get']({'plain':!![]});var _0x1e3a45=_0x8555('0x2a');return db['UserProfileResource'][_0x8555('0x29')]({'where':{'type':_0x1e3a45,'resourceId':_0x25e7bc['id']}})[_0x8555('0x28')](function(){return _0x561abc;});})['then'](function(){_0x5b4e28['status'](0xcc)[_0x8555('0x1f')]();});}};}function handleEntityNotFound(_0x17ab50,_0x2f4e74){return function(_0x3bb64e){if(!_0x3bb64e){_0x17ab50[_0x8555('0x1d')](0x194);}return _0x3bb64e;};}function handleError(_0x4f696c,_0x1ef5ef){_0x1ef5ef=_0x1ef5ef||0x1f4;return function(_0x5c4874){logger[_0x8555('0x2b')](_0x5c4874[_0x8555('0x2c')]);if(_0x5c4874[_0x8555('0x2d')]){delete _0x5c4874[_0x8555('0x2d')];}_0x4f696c[_0x8555('0x1e')](_0x1ef5ef)[_0x8555('0x2e')](_0x5c4874);};}exports['index']=function(_0x5c53d5,_0x3cdfcb){var _0x276b57={},_0x353bd2={},_0x490711={'count':0x0,'rows':[]};var _0x1d9ff0=_[_0x8555('0x2f')](db['Plugin']['rawAttributes'],function(_0x40de8a){return{'name':_0x40de8a[_0x8555('0x30')],'type':_0x40de8a[_0x8555('0x31')][_0x8555('0x32')]};});_0x353bd2[_0x8555('0x33')]=_[_0x8555('0x2f')](_0x1d9ff0,_0x8555('0x2d'));_0x353bd2[_0x8555('0x34')]=_[_0x8555('0x35')](_0x5c53d5[_0x8555('0x34')]);_0x353bd2[_0x8555('0x36')]=_[_0x8555('0x37')](_0x353bd2[_0x8555('0x33')],_0x353bd2['query']);_0x276b57['attributes']=_['intersection'](_0x353bd2['model'],qs[_0x8555('0x38')](_0x5c53d5[_0x8555('0x34')]['fields']));_0x276b57[_0x8555('0x39')]=_0x276b57[_0x8555('0x39')][_0x8555('0x3a')]?_0x276b57[_0x8555('0x39')]:_0x353bd2['model'];if(!_0x5c53d5[_0x8555('0x34')][_0x8555('0x3b')](_0x8555('0x3c'))){_0x276b57['limit']=qs[_0x8555('0x21')](_0x5c53d5[_0x8555('0x34')][_0x8555('0x21')]);_0x276b57[_0x8555('0x23')]=qs[_0x8555('0x23')](_0x5c53d5['query'][_0x8555('0x23')]);}_0x276b57[_0x8555('0x3d')]=qs['sort'](_0x5c53d5[_0x8555('0x34')][_0x8555('0x3e')]);_0x276b57[_0x8555('0x3f')]=qs[_0x8555('0x36')](_['pick'](_0x5c53d5['query'],_0x353bd2['filters']),_0x1d9ff0);if(_0x5c53d5['query']['filter']){_0x276b57['where']=_[_0x8555('0x40')](_0x276b57[_0x8555('0x3f')],{'$or':_['map'](_0x1d9ff0,function(_0x2eca49){if(_0x2eca49[_0x8555('0x31')]!=='VIRTUAL'){var _0x4fa24b={};_0x4fa24b[_0x2eca49[_0x8555('0x2d')]]={'$like':'%'+_0x5c53d5[_0x8555('0x34')]['filter']+'%'};return _0x4fa24b;}})});}_0x276b57=_[_0x8555('0x40')]({},_0x276b57,_0x5c53d5[_0x8555('0x41')]);var _0x2cf3f1={'where':_0x276b57['where']};return db[_0x8555('0x42')][_0x8555('0x22')](_0x2cf3f1)[_0x8555('0x28')](function(_0x23a712){_0x490711[_0x8555('0x22')]=_0x23a712;if(_0x5c53d5['query'][_0x8555('0x43')]){_0x276b57[_0x8555('0x44')]=[{'all':!![]}];}return db[_0x8555('0x42')][_0x8555('0x45')](_0x276b57);})[_0x8555('0x28')](function(_0x202b72){_0x490711[_0x8555('0x46')]=_0x202b72;return _0x490711;})['then'](respondWithFilteredResult(_0x3cdfcb,_0x276b57))[_0x8555('0x47')](handleError(_0x3cdfcb,null));};exports[_0x8555('0x48')]=function(_0x8c6d71,_0x1e362a){var _0x4e40d2={'raw':!![],'where':{'id':_0x8c6d71[_0x8555('0x49')]['id']}},_0x357cb5={};_0x357cb5['model']=_[_0x8555('0x35')](db['Plugin'][_0x8555('0x4a')]);_0x357cb5['query']=_[_0x8555('0x35')](_0x8c6d71[_0x8555('0x34')]);_0x357cb5[_0x8555('0x36')]=_[_0x8555('0x37')](_0x357cb5[_0x8555('0x33')],_0x357cb5[_0x8555('0x34')]);_0x4e40d2[_0x8555('0x39')]=_[_0x8555('0x37')](_0x357cb5[_0x8555('0x33')],qs[_0x8555('0x38')](_0x8c6d71[_0x8555('0x34')]['fields']));_0x4e40d2[_0x8555('0x39')]=_0x4e40d2[_0x8555('0x39')][_0x8555('0x3a')]?_0x4e40d2['attributes']:_0x357cb5[_0x8555('0x33')];if(_0x8c6d71[_0x8555('0x34')][_0x8555('0x43')]){_0x4e40d2[_0x8555('0x44')]=[{'all':!![]}];}_0x4e40d2=_[_0x8555('0x40')]({},_0x4e40d2,_0x8c6d71['options']);return db[_0x8555('0x42')][_0x8555('0x4b')](_0x4e40d2)['then'](handleEntityNotFound(_0x1e362a,null))['then'](respondWithResult(_0x1e362a,null))[_0x8555('0x47')](handleError(_0x1e362a,null));};exports['download']=function(_0x562aed,_0x54ba62,_0x5f35fd){return db[_0x8555('0x42')][_0x8555('0x4b')]({'where':{'id':_0x562aed['params']['id']},'attributes':[_0x8555('0x2d'),'path'],'raw':!![]})[_0x8555('0x28')](handleEntityNotFound(_0x54ba62,null))[_0x8555('0x28')](function(_0x321e06){if(_0x321e06){var _0xa541e3=path[_0x8555('0x4c')](config['root'],_0x8555('0x4d'),util[_0x8555('0x4e')](_0x8555('0x4f'),path[_0x8555('0x50')](_0x321e06[_0x8555('0x6')])));var _0x3d285d=fs['createWriteStream'](_0xa541e3);var _0x421dee=archiver('zip',{'zlib':{'level':0x9}});_0x421dee['on']('warning',function(_0x142e68){if(_0x142e68[_0x8555('0x51')]==='ENOENT'){logger[_0x8555('0x2b')](_0x142e68);}else{throw new db[(_0x8555('0x52'))][(_0x8555('0x53'))](_0x8555('0x54'));}});_0x421dee['on'](_0x8555('0x2b'),function(_0x317be7){throw new db[(_0x8555('0x52'))][(_0x8555('0x53'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x421dee['pipe'](_0x3d285d);_0x421dee[_0x8555('0x55')](_0x8555('0x56'),{'cwd':path[_0x8555('0x4c')](config[_0x8555('0x57')],_0x8555('0x4d'),path[_0x8555('0x58')](_0x321e06[_0x8555('0x6')])),'ignore':[path['join'](path[_0x8555('0x50')](_0x321e06[_0x8555('0x6')]),_0x8555('0x59')),path['join'](path[_0x8555('0x50')](_0x321e06['path']),_0x8555('0x5a'))],'nodir':!![]})[_0x8555('0x5b')]();_0x3d285d['on']('close',function(){if(!fs[_0x8555('0x5c')](_0xa541e3)){throw new db[(_0x8555('0x52'))][(_0x8555('0x53'))]('Plugin\x20not\x20found');}return _0x54ba62['download'](_0xa541e3,util[_0x8555('0x4e')](_0x8555('0x4f'),path[_0x8555('0x50')](_0x321e06[_0x8555('0x6')])),function(_0x3e6e2a){if(_0x3e6e2a){throw new db[(_0x8555('0x52'))]['Error'](_0x8555('0x5d'));}fs[_0x8555('0x5e')](_0xa541e3);logger[_0x8555('0x5f')](_0x8555('0x60'));logger[_0x8555('0x5f')](_0x8555('0x61'));});});}return null;})[_0x8555('0x47')](handleError(_0x54ba62,null));};exports[_0x8555('0x62')]=function(_0x3a2c94,_0x2c15d3,_0x21827b){var _0x7c404=path[_0x8555('0x50')](_0x3a2c94['file'][_0x8555('0x63')],path[_0x8555('0x64')](_0x3a2c94[_0x8555('0x65')]['filename']));var _0x1db4f2=path[_0x8555('0x4c')](config[_0x8555('0x57')],_0x8555('0x4d'),_0x3a2c94[_0x8555('0x65')]['filename']);var _0x49a0eb=path['join'](config[_0x8555('0x57')],_0x8555('0x4d'),_0x7c404);logger[_0x8555('0x5f')](_0x8555('0x66'),_0x1db4f2);logger[_0x8555('0x5f')](_0x8555('0x67'),_0x49a0eb);try{fs[_0x8555('0x68')](_0x1db4f2,parseInt('0777',0x8));extract(_0x1db4f2,{'dir':_0x49a0eb},function(_0x1fd320){if(_0x1fd320){logger[_0x8555('0x2b')](_0x1fd320);handleError(_0x1fd320,!![]);};var _0x3cc26c=fs[_0x8555('0x69')](_0x49a0eb);if(_0x3cc26c['length']>0x1){removeReferences(_0x1db4f2,_0x49a0eb);logger[_0x8555('0x2b')](_0x8555('0x6a'));return _0x21827b(new Error(_0x8555('0x6a')));}var _0x2e6633=fs[_0x8555('0x6b')](path[_0x8555('0x4c')](_0x49a0eb,_0x3cc26c[0x0]));if(_0x2e6633[_0x8555('0x6c')]()){removeReferences(_0x1db4f2,_0x49a0eb);logger[_0x8555('0x2b')](_0x8555('0x6a'));return _0x21827b(new Error('Invalid\x20plugin\x20structure'));}if(_0x2e6633[_0x8555('0x6d')]()){var _0xc1b992=fs[_0x8555('0x69')](path[_0x8555('0x4c')](_0x49a0eb,_0x3cc26c[0x0]));if(_0xc1b992['length']===0x0){removeReferences(_0x1db4f2,_0x49a0eb);logger[_0x8555('0x2b')](_0x8555('0x6a'));return _0x21827b(new Error(_0x8555('0x6a')));}var _0x4f62e1=_0xc1b992[_0x8555('0x6e')](function(_0x1717b5){return _0x1717b5===_0x8555('0x6f');});if(!_0x4f62e1){return _0x21827b(new Error(_0x8555('0x70')));}var _0x45c18f=fs[_0x8555('0x71')](path['join'](_0x49a0eb,_0x3cc26c[0x0],_0x8555('0x6f')));var _0x37b48a=JSON[_0x8555('0x72')](_0x45c18f);if(_0x8555('0x73')==typeof _0x37b48a[_0x8555('0x2d')]){return _0x21827b(new Error(_0x8555('0x74')));}if(_0x8555('0x73')==typeof _0x37b48a[_0x8555('0x31')]){return _0x21827b(new Error(_0x8555('0x75')));}if('undefined'==typeof _0x37b48a[_0x8555('0x76')]){return _0x21827b(new Error(_0x8555('0x77')));}if('undefined'==typeof _0x37b48a[_0x8555('0x78')]){return _0x21827b(new Error(_0x8555('0x79')));}if(_0x37b48a[_0x8555('0x31')]==='html'){if(_0x8555('0x73')==typeof _0x37b48a[_0x8555('0x78')][_0x8555('0x7a')]){return _0x21827b(new Error(_0x8555('0x7b')));}if(_0x8555('0x73')==typeof _0x37b48a[_0x8555('0x78')]['views']['admin']&&_0x8555('0x73')==typeof _0x37b48a['parameters']['views'][_0x8555('0x7c')]){return _0x21827b(new Error(_0x8555('0x7d')));}}else if(_0x37b48a[_0x8555('0x31')]===_0x8555('0x7e')){if(_0x8555('0x73')==typeof _0x37b48a[_0x8555('0x78')][_0x8555('0x7f')]){return _0x21827b(new Error(_0x8555('0x80')));}if(_0x8555('0x73')==typeof _0x37b48a['parameters']['scriptPath']){return _0x21827b(new Error(_0x8555('0x81')));}}else{return _0x21827b(new Error(_0x8555('0x82')));}var _0x35fb86=_0x37b48a[_0x8555('0x2d')];var _0x2bdb5f=_0x37b48a[_0x8555('0x83')];var _0x4bc409=_0x37b48a['type'];var _0x5c1ed8=_0x37b48a['sidebar']?_0x37b48a[_0x8555('0x84')]:'always';var _0x246a0d=_0x37b48a[_0x8555('0x85')]?_0x37b48a[_0x8555('0x85')]:_0x8555('0x86');var _0x2ebfa2='';var _0x2622f7='';var _0x470e65='';var _0x5e2bbe='';var _0x4bb07c=_0x37b48a[_0x8555('0x76')];if(_0x4bc409===_0x8555('0x87')){if(_0x8555('0x73')!=typeof _0x37b48a['parameters'][_0x8555('0x7a')][_0x8555('0x88')]){var _0x13ff8b=_0x37b48a[_0x8555('0x78')][_0x8555('0x7a')][_0x8555('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x8555('0x89')](_0x13ff8b)){_0x2ebfa2=path[_0x8555('0x4c')](_0x8555('0x8a'),_0x7c404,_0x3cc26c[0x0],_0x13ff8b);}else{_0x2ebfa2=_0x13ff8b;}}else{logger[_0x8555('0x5f')](_0x8555('0x8b'));}if(_0x8555('0x73')!=typeof _0x37b48a[_0x8555('0x78')][_0x8555('0x7a')]['agent']){var _0x34f710=_0x37b48a['parameters'][_0x8555('0x7a')][_0x8555('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x34f710)){_0x2622f7=path[_0x8555('0x4c')](_0x8555('0x8a'),_0x7c404,_0x3cc26c[0x0],_0x34f710);}else{_0x2622f7=_0x34f710;}}else{logger['info'](_0x8555('0x8c'));}}else if(_0x4bc409===_0x8555('0x7e')){_0x470e65=_0x37b48a[_0x8555('0x78')]['scriptName'];_0x5e2bbe=_0x37b48a[_0x8555('0x78')][_0x8555('0x8d')];if('undefined'!=typeof _0x37b48a[_0x8555('0x78')]['views']){if(_0x8555('0x73')!=typeof _0x37b48a[_0x8555('0x78')][_0x8555('0x7a')]['admin']){var _0x13ff8b=_0x37b48a[_0x8555('0x78')][_0x8555('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x8555('0x89')](_0x13ff8b)){_0x2ebfa2=path[_0x8555('0x4c')](_0x8555('0x8a'),_0x7c404,_0x3cc26c[0x0],_0x13ff8b);}else{_0x2ebfa2=_0x13ff8b;}}if(_0x8555('0x73')!=typeof _0x37b48a[_0x8555('0x78')]['views'][_0x8555('0x7c')]){var _0x34f710=_0x37b48a[_0x8555('0x78')][_0x8555('0x7a')][_0x8555('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x8555('0x89')](_0x34f710)){_0x2622f7=path['join'](_0x8555('0x8a'),_0x7c404,_0x3cc26c[0x0],_0x34f710);}else{_0x2622f7=_0x34f710;}}}}var _0x18b5c0={'name':_0x35fb86,'description':_0x2bdb5f,'path':path[_0x8555('0x4c')](_0x7c404,_0x3cc26c[0x0]),'type':_0x4bc409,'sidebar':_0x5c1ed8,'icon':_0x246a0d,'adminUrl':_0x2ebfa2,'agentUrl':_0x2622f7,'scriptName':_0x470e65,'scriptPath':_0x5e2bbe,'version':_0x4bb07c};removeReferences(_0x1db4f2,null);return db[_0x8555('0x42')][_0x8555('0x8e')](_0x18b5c0)['then'](function(_0xd8bc0b){var _0x420ac3={'role':_0x3a2c94[_0x8555('0x8f')][_0x8555('0x90')],'userProfileId':_0x3a2c94[_0x8555('0x8f')][_0x8555('0x91')]};if(!_0x420ac3)throw new Error(_0x8555('0x92'));if(_0x420ac3[_0x8555('0x90')]===_0x8555('0x93')){var _0x10fad8=_0xd8bc0b[_0x8555('0x94')]({'plain':!![]});return db[_0x8555('0x95')][_0x8555('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x420ac3['userProfileId']},'raw':!![]})[_0x8555('0x28')](function(_0x41b1b5){if(_0x41b1b5&&_0x41b1b5[_0x8555('0x96')]===0x0){return db[_0x8555('0x97')][_0x8555('0x8e')]({'name':_0x10fad8[_0x8555('0x2d')],'resourceId':_0x10fad8['id'],'type':_0x41b1b5[_0x8555('0x2d')],'sectionId':_0x41b1b5['id']},{})[_0x8555('0x28')](function(){return _0xd8bc0b;});}else{return _0xd8bc0b;}})[_0x8555('0x47')](function(_0x542740){logger[_0x8555('0x2b')](_0x8555('0x98'),_0x542740);throw _0x542740;});}return _0xd8bc0b;})[_0x8555('0x28')](respondWithResult(_0x2c15d3,null))[_0x8555('0x47')](handleError(_0x2c15d3,null));}});}catch(_0xdb3ab0){_0x2c15d3[_0x8555('0x1e')](0x1f4)[_0x8555('0x2e')](_0xdb3ab0);}};function removeReferences(_0x5126d7,_0x3d4e7f){try{if(_0x5126d7){fs[_0x8555('0x5e')](_0x5126d7);logger[_0x8555('0x5f')](_0x8555('0x99'));}if(_0x3d4e7f){rimraf(_0x3d4e7f,function(){});logger[_0x8555('0x5f')](_0x8555('0x9a'));}}catch(_0x3c62cb){logger[_0x8555('0x2b')](_0x3c62cb);}}exports[_0x8555('0x9b')]=function(_0x5c864f,_0x417366,_0x2502c7){return db[_0x8555('0x42')][_0x8555('0x4b')]({'where':{'id':_0x5c864f[_0x8555('0x49')]['id']}})[_0x8555('0x28')](handleEntityNotFound(_0x417366,null))['then'](saveUpdates(_0x5c864f[_0x8555('0x8f')],null))[_0x8555('0x28')](respondWithResult(_0x417366,null))['catch'](handleError(_0x417366,null));};exports[_0x8555('0x9c')]=function(_0x494aad,_0x21d2f5,_0x459496){return db[_0x8555('0x42')][_0x8555('0x4b')]({'where':{'id':_0x494aad[_0x8555('0x49')]['id']}})['then'](function(_0xbad3e9){if(_0xbad3e9){return _0xbad3e9[_0x8555('0x29')]();}})['then'](function(_0x135a9a){rimraf(path[_0x8555('0x4c')](config[_0x8555('0x57')],_0x8555('0x4d'),path[_0x8555('0x58')](_0x135a9a[_0x8555('0x6')])),function(){});return _0x135a9a;})['then'](handleEntityNotFound(_0x21d2f5,null))[_0x8555('0x28')](respondWithStatusCode(_0x21d2f5,null))[_0x8555('0x47')](handleError(_0x21d2f5,null));};exports['webhookGet']=function(_0x10e3a0,_0x4700c6,_0x3c6d12){return BPromise[_0x8555('0x9d')]()[_0x8555('0x28')](function(){if(!_0x10e3a0[_0x8555('0x34')]['path']){throw new Error(_0x8555('0x9e'));}if(!_0x10e3a0[_0x8555('0x34')]['port']){throw new Error(_0x8555('0x9f'));}var _0x47e966=_0x10e3a0[_0x8555('0x34')]['hostname']?_0x10e3a0[_0x8555('0x34')][_0x8555('0xa0')]+':'+_0x10e3a0[_0x8555('0x34')][_0x8555('0xa1')]:_0x8555('0xa2')+_0x10e3a0[_0x8555('0x34')]['port'];var _0x544723=_0x10e3a0[_0x8555('0x34')]['json']?_0x10e3a0[_0x8555('0x34')][_0x8555('0x20')]:!![];var _0x28b7be=_0x10e3a0[_0x8555('0x34')]['encoding']?_0x10e3a0[_0x8555('0x34')][_0x8555('0xa3')]:null;var _0x42f86c={'method':_0x10e3a0[_0x8555('0xa4')],'uri':util['format']('%s%s',_0x47e966,_0x10e3a0[_0x8555('0x34')]['path']),'json':_0x544723,'resolveWithFullResponse':!![],'encoding':_0x28b7be,'qs':_0x10e3a0[_0x8555('0x34')]};if(_0x10e3a0['headers']){_0x42f86c[_0x8555('0xa5')]=_0x10e3a0[_0x8555('0xa5')];if(_0x42f86c[_0x8555('0xa5')][_0x8555('0xa6')]){delete _0x42f86c['headers'][_0x8555('0xa6')];}}if(_0x42f86c[_0x8555('0xa5')][_0x8555('0xa7')]){delete _0x42f86c[_0x8555('0xa5')]['content-type'];}return rp(_0x42f86c);})[_0x8555('0x28')](function(_0x4562be){if(_0x4562be){_0x4700c6[_0x8555('0x24')](_0x4562be['headers']);logger[_0x8555('0x5f')](_0x4562be['body']);if(_[_0x8555('0xa8')](_0x10e3a0['query'][_0x8555('0x6')],_0x8555('0xa9'))&&_0x4562be['statusCode']==0x1f4){return _0x4700c6[_0x8555('0x1d')](_0x4562be['statusCode']);}else{return _0x4700c6[_0x8555('0x1e')](_0x4562be[_0x8555('0xaa')])[_0x8555('0x2e')](_0x4562be['body']);}}else{return _0x4700c6[_0x8555('0x1d')](0xc8);}})[_0x8555('0x47')](handleError(_0x4700c6,null));};exports['webhookPost']=function(_0x598910,_0x1bcf8c,_0x5ef1aa){return BPromise[_0x8555('0x9d')]()[_0x8555('0x28')](function(){if(!_0x598910[_0x8555('0x34')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x598910[_0x8555('0x34')][_0x8555('0xa1')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1aa84c=_0x598910['query'][_0x8555('0xa0')]?_0x598910[_0x8555('0x34')]['hostname']+':'+_0x598910['query'][_0x8555('0xa1')]:_0x8555('0xa2')+_0x598910['query'][_0x8555('0xa1')];var _0x248466=_0x598910['query']['json']?_0x598910[_0x8555('0x34')][_0x8555('0x20')]:!![];var _0x4115cb=_0x598910['query'][_0x8555('0xa3')]?_0x598910[_0x8555('0x34')]['encoding']:null;var _0xb114ce={'method':_0x598910['method'],'uri':util[_0x8555('0x4e')](_0x8555('0xab'),_0x1aa84c,_0x598910[_0x8555('0x34')][_0x8555('0x6')]),'json':_0x248466,'resolveWithFullResponse':!![],'encoding':_0x4115cb,'body':_0x598910[_0x8555('0x8f')]};if(_0x598910[_0x8555('0xa5')]){_0xb114ce['headers']=_0x598910['headers'];if(_0xb114ce[_0x8555('0xa5')][_0x8555('0xa6')]){delete _0xb114ce[_0x8555('0xa5')][_0x8555('0xa6')];}}if(_0xb114ce[_0x8555('0xa5')]['content-type']){delete _0xb114ce['headers'][_0x8555('0xa7')];}return rp(_0xb114ce);})[_0x8555('0x28')](function(_0x35f6b9){if(_0x35f6b9){_0x1bcf8c[_0x8555('0x24')](_0x35f6b9['headers']);logger[_0x8555('0x5f')](_0x35f6b9[_0x8555('0x8f')]);return _0x1bcf8c[_0x8555('0x1e')](_0x35f6b9[_0x8555('0xaa')])[_0x8555('0x2e')](_0x35f6b9[_0x8555('0x8f')]);}else{return _0x1bcf8c[_0x8555('0x1d')](0xc8);}})[_0x8555('0x47')](handleError(_0x1bcf8c,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ec640b6..28d4b29 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 _0x3baf=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin'];(function(_0x251a78,_0x262fea){var _0x5467f3=function(_0x1bbcaf){while(--_0x1bbcaf){_0x251a78['push'](_0x251a78['shift']());}};_0x5467f3(++_0x262fea);}(_0x3baf,0xf7));var _0xf3ba=function(_0x90b0d8,_0x2f0d79){_0x90b0d8=_0x90b0d8-0x0;var _0x281b55=_0x3baf[_0x90b0d8];return _0x281b55;};'use strict';var EventEmitter=require(_0xf3ba('0x0'));var Plugin=require(_0xf3ba('0x1'))['db'][_0xf3ba('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf3ba('0x3')](0x0);var events={'afterCreate':_0xf3ba('0x4'),'afterUpdate':_0xf3ba('0x5'),'afterDestroy':_0xf3ba('0x6')};function emitEvent(_0x306bdd){return function(_0x3e6058,_0x1ae6e6,_0x57e17d){PluginEvents[_0xf3ba('0x7')](_0x306bdd+':'+_0x3e6058['id'],_0x3e6058);PluginEvents[_0xf3ba('0x7')](_0x306bdd,_0x3e6058);_0x57e17d(null);};}for(var e in events){if(events[_0xf3ba('0x8')](e)){var event=events[e];Plugin[_0xf3ba('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xe0c1=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x386f73,_0x4ab3c6){var _0xda2950=function(_0x35b9cf){while(--_0x35b9cf){_0x386f73['push'](_0x386f73['shift']());}};_0xda2950(++_0x4ab3c6);}(_0xe0c1,0x10f));var _0x1e0c=function(_0xb9e49f,_0x56be62){_0xb9e49f=_0xb9e49f-0x0;var _0x267d33=_0xe0c1[_0xb9e49f];return _0x267d33;};'use strict';var EventEmitter=require(_0x1e0c('0x0'));var Plugin=require(_0x1e0c('0x1'))['db'][_0x1e0c('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1e0c('0x3')](0x0);var events={'afterCreate':_0x1e0c('0x4'),'afterUpdate':_0x1e0c('0x5'),'afterDestroy':_0x1e0c('0x6')};function emitEvent(_0x5b2f24){return function(_0x565573,_0x4ad70a,_0x492b78){PluginEvents['emit'](_0x5b2f24+':'+_0x565573['id'],_0x565573);PluginEvents['emit'](_0x5b2f24,_0x565573);_0x492b78(null);};}for(var e in events){if(events[_0x1e0c('0x7')](e)){var event=events[e];Plugin[_0x1e0c('0x8')](e,emitEvent(event));}}module[_0x1e0c('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index e35b316..a092ed5 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 _0xd5a1=['../../config/environment','./plugin.attributes','exports','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x178ccd,_0x28efd3){var _0x40e8bc=function(_0x262e1e){while(--_0x262e1e){_0x178ccd['push'](_0x178ccd['shift']());}};_0x40e8bc(++_0x28efd3);}(_0xd5a1,0x162));var _0x1d5a=function(_0x2441c9,_0x101da6){_0x2441c9=_0x2441c9-0x0;var _0x231ee3=_0xd5a1[_0x2441c9];return _0x231ee3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1d5a('0x0'))(_0x1d5a('0x1'));var moment=require(_0x1d5a('0x2'));var BPromise=require(_0x1d5a('0x3'));var rp=require(_0x1d5a('0x4'));var fs=require('fs');var path=require(_0x1d5a('0x5'));var rimraf=require('rimraf');var config=require(_0x1d5a('0x6'));var attributes=require(_0x1d5a('0x7'));module[_0x1d5a('0x8')]=function(_0x49b157,_0x444d5b){return _0x49b157['define']('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36f3=['../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x594d5c,_0x144cb3){var _0x357e58=function(_0x11785c){while(--_0x11785c){_0x594d5c['push'](_0x594d5c['shift']());}};_0x357e58(++_0x144cb3);}(_0x36f3,0x19c));var _0x336f=function(_0x229e8d,_0x51097f){_0x229e8d=_0x229e8d-0x0;var _0x5e288d=_0x36f3[_0x229e8d];return _0x5e288d;};'use strict';var _=require(_0x336f('0x0'));var util=require(_0x336f('0x1'));var logger=require(_0x336f('0x2'))(_0x336f('0x3'));var moment=require('moment');var BPromise=require(_0x336f('0x4'));var rp=require(_0x336f('0x5'));var fs=require('fs');var path=require(_0x336f('0x6'));var rimraf=require(_0x336f('0x7'));var config=require(_0x336f('0x8'));var attributes=require(_0x336f('0x9'));module[_0x336f('0xa')]=function(_0x299e92,_0x21b8d8){return _0x299e92[_0x336f('0xb')](_0x336f('0xc'),attributes,{'tableName':_0x336f('0xd'),'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 6acc602..76ffd27 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 _0x2713=['Plugin','create','options','raw','CreatePlugin','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x367cdd,_0x288e69){var _0x319b0d=function(_0x3d4f57){while(--_0x3d4f57){_0x367cdd['push'](_0x367cdd['shift']());}};_0x319b0d(++_0x288e69);}(_0x2713,0x1db));var _0x3271=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2713[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3271('0x0'));var util=require(_0x3271('0x1'));var moment=require(_0x3271('0x2'));var BPromise=require(_0x3271('0x3'));var rs=require(_0x3271('0x4'));var fs=require('fs');var Redis=require(_0x3271('0x5'));var db=require(_0x3271('0x6'))['db'];var utils=require(_0x3271('0x7'));var logger=require(_0x3271('0x8'))('rpc');var config=require(_0x3271('0x9'));var jayson=require(_0x3271('0xa'));var client=jayson[_0x3271('0xb')][_0x3271('0xc')]({'port':0x232a});config[_0x3271('0xd')]=_[_0x3271('0xe')](config[_0x3271('0xd')],{'host':_0x3271('0xf'),'port':0x18eb});var socket=require(_0x3271('0x10'))(new Redis(config[_0x3271('0xd')]));require('./plugin.socket')[_0x3271('0x11')](socket);function respondWithRpcPromise(_0x2d303a,_0x5e259a,_0x3916b0){return new BPromise(function(_0x4d8618,_0x5b090e){return client[_0x3271('0x12')](_0x2d303a,_0x3916b0)[_0x3271('0x13')](function(_0x5d7f86){logger[_0x3271('0x14')](_0x3271('0x15'),_0x5e259a,_0x3271('0x16'));logger['debug'](_0x3271('0x17'),_0x5e259a,_0x3271('0x16'),JSON[_0x3271('0x18')](_0x5d7f86));if(_0x5d7f86[_0x3271('0x19')]){if(_0x5d7f86[_0x3271('0x19')][_0x3271('0x1a')]===0x1f4){logger['error'](_0x3271('0x15'),_0x5e259a,_0x5d7f86[_0x3271('0x19')]['message']);return _0x5b090e(_0x5d7f86[_0x3271('0x19')][_0x3271('0x1b')]);}logger[_0x3271('0x19')]('Plugin,\x20%s,\x20%s',_0x5e259a,_0x5d7f86[_0x3271('0x19')][_0x3271('0x1b')]);return _0x4d8618(_0x5d7f86[_0x3271('0x19')][_0x3271('0x1b')]);}else{logger[_0x3271('0x14')]('Plugin,\x20%s,\x20%s',_0x5e259a,'request\x20sent');_0x4d8618(_0x5d7f86[_0x3271('0x1c')][_0x3271('0x1b')]);}})['catch'](function(_0x1344ab){logger[_0x3271('0x19')](_0x3271('0x15'),_0x5e259a,_0x1344ab);_0x5b090e(_0x1344ab);});});}exports['CreatePlugin']=function(_0x45ece1){var _0x13d81e=this;return new Promise(function(_0xefb524,_0x3d1e53){return db[_0x3271('0x1d')][_0x3271('0x1e')](_0x45ece1['body'],{'raw':_0x45ece1[_0x3271('0x1f')]?_0x45ece1[_0x3271('0x1f')][_0x3271('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0xf9c085){logger[_0x3271('0x14')](_0x3271('0x21'),_0x45ece1);logger[_0x3271('0x22')](_0x3271('0x21'),_0x45ece1,JSON[_0x3271('0x18')](_0xf9c085));_0xefb524(_0xf9c085);})[_0x3271('0x23')](function(_0x156096){logger['error'](_0x3271('0x21'),_0x156096[_0x3271('0x1b')],_0x45ece1);_0x3d1e53(_0x13d81e[_0x3271('0x19')](0x1f4,_0x156096['message']));});});}; \ No newline at end of file +var _0xa4e3=['body','options','raw','CreatePlugin','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create'];(function(_0x372a27,_0x4ec1c6){var _0x4e8005=function(_0x33f5de){while(--_0x33f5de){_0x372a27['push'](_0x372a27['shift']());}};_0x4e8005(++_0x4ec1c6);}(_0xa4e3,0x17c));var _0x3a4e=function(_0x18269d,_0xcc550c){_0x18269d=_0x18269d-0x0;var _0x3ba06f=_0xa4e3[_0x18269d];return _0x3ba06f;};'use strict';var _=require(_0x3a4e('0x0'));var util=require(_0x3a4e('0x1'));var moment=require('moment');var BPromise=require(_0x3a4e('0x2'));var rs=require(_0x3a4e('0x3'));var fs=require('fs');var Redis=require(_0x3a4e('0x4'));var db=require(_0x3a4e('0x5'))['db'];var utils=require(_0x3a4e('0x6'));var logger=require(_0x3a4e('0x7'))(_0x3a4e('0x8'));var config=require(_0x3a4e('0x9'));var jayson=require(_0x3a4e('0xa'));var client=jayson[_0x3a4e('0xb')][_0x3a4e('0xc')]({'port':0x232a});config[_0x3a4e('0xd')]=_[_0x3a4e('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3a4e('0xf'))(new Redis(config[_0x3a4e('0xd')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x191ccb,_0x4e7ca4,_0x40e403){return new BPromise(function(_0x2f9c97,_0xb737c){return client[_0x3a4e('0x10')](_0x191ccb,_0x40e403)[_0x3a4e('0x11')](function(_0x3eadbf){logger[_0x3a4e('0x12')](_0x3a4e('0x13'),_0x4e7ca4,_0x3a4e('0x14'));logger['debug'](_0x3a4e('0x15'),_0x4e7ca4,_0x3a4e('0x14'),JSON[_0x3a4e('0x16')](_0x3eadbf));if(_0x3eadbf[_0x3a4e('0x17')]){if(_0x3eadbf['error'][_0x3a4e('0x18')]===0x1f4){logger['error'](_0x3a4e('0x13'),_0x4e7ca4,_0x3eadbf[_0x3a4e('0x17')][_0x3a4e('0x19')]);return _0xb737c(_0x3eadbf[_0x3a4e('0x17')]['message']);}logger[_0x3a4e('0x17')](_0x3a4e('0x13'),_0x4e7ca4,_0x3eadbf[_0x3a4e('0x17')][_0x3a4e('0x19')]);return _0x2f9c97(_0x3eadbf[_0x3a4e('0x17')][_0x3a4e('0x19')]);}else{logger[_0x3a4e('0x12')](_0x3a4e('0x13'),_0x4e7ca4,'request\x20sent');_0x2f9c97(_0x3eadbf[_0x3a4e('0x1a')][_0x3a4e('0x19')]);}})['catch'](function(_0x5daf23){logger['error']('Plugin,\x20%s,\x20%s',_0x4e7ca4,_0x5daf23);_0xb737c(_0x5daf23);});});}exports['CreatePlugin']=function(_0x5778c8){var _0x526e5d=this;return new Promise(function(_0x3f631f,_0xd6c77d){return db['Plugin'][_0x3a4e('0x1b')](_0x5778c8[_0x3a4e('0x1c')],{'raw':_0x5778c8[_0x3a4e('0x1d')]?_0x5778c8[_0x3a4e('0x1d')][_0x3a4e('0x1e')]===undefined?!![]:![]:!![]})[_0x3a4e('0x11')](function(_0x3dd607){logger[_0x3a4e('0x12')](_0x3a4e('0x1f'),_0x5778c8);logger[_0x3a4e('0x20')](_0x3a4e('0x1f'),_0x5778c8,JSON['stringify'](_0x3dd607));_0x3f631f(_0x3dd607);})[_0x3a4e('0x21')](function(_0x30bbda){logger[_0x3a4e('0x17')](_0x3a4e('0x1f'),_0x30bbda['message'],_0x5778c8);_0xd6c77d(_0x526e5d[_0x3a4e('0x17')](0x1f4,_0x30bbda[_0x3a4e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5f3edcb..4df86de 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 _0xae45=['./plugin.events','save','remove','removeListener','register','length','plugin:'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0xae45,0x13b));var _0x5ae4=function(_0x5f4f1c,_0x426059){_0x5f4f1c=_0x5f4f1c-0x0;var _0x2bc417=_0xae45[_0x5f4f1c];return _0x2bc417;};'use strict';var PluginEvents=require(_0x5ae4('0x0'));var events=[_0x5ae4('0x1'),_0x5ae4('0x2'),'update'];function createListener(_0x172aac,_0x1b35bf){return function(_0x114e96){_0x1b35bf['emit'](_0x172aac,_0x114e96);};}function removeListener(_0xf1807e,_0x4576cb){return function(){PluginEvents[_0x5ae4('0x3')](_0xf1807e,_0x4576cb);};}exports[_0x5ae4('0x4')]=function(_0x258db6){for(var _0x4df728=0x0,_0xfb9a57=events[_0x5ae4('0x5')];_0x4df728<_0xfb9a57;_0x4df728++){var _0x4b00a2=events[_0x4df728];var _0x4dea4b=createListener(_0x5ae4('0x6')+_0x4b00a2,_0x258db6);PluginEvents['on'](_0x4b00a2,_0x4dea4b);}}; \ No newline at end of file +var _0x9aad=['update','emit','removeListener','register','length','plugin:','save','remove'];(function(_0xe25418,_0x59605b){var _0x11f26e=function(_0x2aa70c){while(--_0x2aa70c){_0xe25418['push'](_0xe25418['shift']());}};_0x11f26e(++_0x59605b);}(_0x9aad,0x12e));var _0xd9aa=function(_0x13f029,_0xcdb350){_0x13f029=_0x13f029-0x0;var _0x1ba463=_0x9aad[_0x13f029];return _0x1ba463;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xd9aa('0x0'),_0xd9aa('0x1'),_0xd9aa('0x2')];function createListener(_0x543c07,_0x4cee0c){return function(_0x5d75b6){_0x4cee0c[_0xd9aa('0x3')](_0x543c07,_0x5d75b6);};}function removeListener(_0x4a8ac6,_0x3b9657){return function(){PluginEvents[_0xd9aa('0x4')](_0x4a8ac6,_0x3b9657);};}exports[_0xd9aa('0x5')]=function(_0x71ad1c){for(var _0x2d28b0=0x0,_0x2405d7=events[_0xd9aa('0x6')];_0x2d28b0<_0x2405d7;_0x2d28b0++){var _0x215a51=events[_0x2d28b0];var _0x1d5da8=createListener(_0xd9aa('0x7')+_0x215a51,_0x71ad1c);PluginEvents['on'](_0x215a51,_0x1d5da8);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index eaca7f5..86c63a0 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(_0x285c16,_0xa01d2c){var _0x58088f=function(_0x19ad34){while(--_0x19ad34){_0x285c16['push'](_0x285c16['shift']());}};_0x58088f(++_0xa01d2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x1f5082,_0x3f878e){var _0x26cf61=function(_0x50ca3a){while(--_0x50ca3a){_0x1f5082['push'](_0x1f5082['shift']());}};_0x26cf61(++_0x3f878e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 a5b5e4c..cdfe913 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 _0x153f=['Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty'];(function(_0x683097,_0x4d3942){var _0x401ff5=function(_0x2c3824){while(--_0x2c3824){_0x683097['push'](_0x683097['shift']());}};_0x401ff5(++_0x4d3942);}(_0x153f,0x15b));var _0xf153=function(_0x483408,_0x43e1ef){_0x483408=_0x483408-0x0;var _0x35f00d=_0x153f[_0x483408];return _0x35f00d;};'use strict';var _=require(_0xf153('0x0'));var pm2=require(_0xf153('0x1'));var logger=require(_0xf153('0x2'))(_0xf153('0x3'));var path=require(_0xf153('0x4'));var exec=require(_0xf153('0x5'))[_0xf153('0x6')];var BPromise=require('bluebird');function handleEntityNotFound(_0x364e65,_0x5c49c7){return function(_0x1f9ead){if(!_0x1f9ead){_0x364e65[_0xf153('0x7')](0x194);;}return _0x1f9ead;};}function respondWithResult(_0x342a45,_0xafd987){_0xafd987=_0xafd987||0xc8;return function(_0x21f432){if(_0x21f432){return _0x342a45['status'](_0xafd987)[_0xf153('0x8')](_0x21f432);}return null;};}function handleError(_0x143497,_0x224f88){_0x224f88=_0x224f88||0x1f4;return function(_0x5f6cb5){logger[_0xf153('0x9')](_0x5f6cb5[_0xf153('0xa')]);if(_0x5f6cb5[_0xf153('0xb')]){delete _0x5f6cb5[_0xf153('0xb')];}_0x143497[_0xf153('0xc')](_0x224f88)[_0xf153('0xd')](_0x5f6cb5);};}function execChildProcess(){return new BPromise(function(_0x5c8ae9,_0x2b76eb){exec(_0xf153('0xe'),function(_0x2bea70,_0x493324,_0x3a8838){logger[_0xf153('0xf')](_0x493324);logger[_0xf153('0xf')](_0x3a8838);if(_0x2bea70){logger[_0xf153('0x9')](_0x2bea70);return _0x2b76eb(_0x2bea70);}return _0x5c8ae9(_0x493324);});});}exports[_0xf153('0x10')]=function(_0x107d31,_0x3f915c){return pm2[_0xf153('0x11')]()[_0xf153('0x12')](function(_0x4c5283){if(_0x4c5283){var _0x18be7e=_[_0xf153('0x13')](_0x4c5283,function(_0x2b666e){return _0x2b666e[_0xf153('0xb')]===_0xf153('0x14')||_0x2b666e[_0xf153('0xb')]===_0xf153('0x15');});return{'rows':_0x18be7e,'count':_0x18be7e[_0xf153('0x16')]};}return null;})['then'](respondWithResult(_0x3f915c,null))[_0xf153('0x17')](handleError(_0x3f915c,null));};exports['show']=function(_0x37093a,_0x2c62b6){return pm2[_0xf153('0x18')](_0x37093a[_0xf153('0x19')]['id'])['then'](respondWithResult(_0x2c62b6,null))[_0xf153('0x12')](handleEntityNotFound(_0x2c62b6,null))[_0xf153('0x17')](handleError(_0x2c62b6,null));};exports[_0xf153('0x1a')]=function(_0x14b83f,_0x15230c){if(_0x14b83f[_0xf153('0x1b')][_0xf153('0xb')]&&_0x14b83f[_0xf153('0x1b')][_0xf153('0x1c')]){var _0x1dd340=path[_0xf153('0x1d')](__dirname,_0xf153('0x1e'),_0x14b83f['body'][_0xf153('0x1c')]);var _0x395f28=process[_0xf153('0x1f')]();process[_0xf153('0x20')](path[_0xf153('0x21')](_0x1dd340));return execChildProcess()[_0xf153('0x12')](function(_0x465d88){process[_0xf153('0x20')](_0x395f28);return pm2[_0xf153('0x22')]({'name':_0x14b83f[_0xf153('0x1b')][_0xf153('0xb')],'script':_0x1dd340});})[_0xf153('0x12')](function(_0x35cfe3){pm2[_0xf153('0x23')]();return _0x35cfe3[0x0];})[_0xf153('0x12')](respondWithResult(_0x15230c,0xc9))[_0xf153('0x17')](handleError(_0x15230c,null));}else{return _0x15230c[_0xf153('0xc')](0x1f4)[_0xf153('0xd')]({'message':_0xf153('0x24')});}};exports[_0xf153('0x25')]=function(_0x48ebdc,_0x6d62ef){if(_0x48ebdc[_0xf153('0x1b')]['id']){delete _0x48ebdc['body']['id'];}var _0x16cdcd={'online':_0xf153('0x26'),'stopped':'stop'};if(_0x16cdcd[_0xf153('0x27')](_0x48ebdc[_0xf153('0x1b')][_0xf153('0xc')])){return pm2[_0x16cdcd[_0x48ebdc[_0xf153('0x1b')][_0xf153('0xc')]]](_0x48ebdc[_0xf153('0x19')]['id'])[_0xf153('0x12')](respondWithResult(_0x6d62ef,0xc8))[_0xf153('0x17')](handleError(_0x6d62ef,null));}else{return _0x6d62ef[_0xf153('0xc')](0x1f4)[_0xf153('0xd')]({'message':_0xf153('0x28')});}};exports[_0xf153('0x29')]=function(_0x5b5237,_0x258fb0){if(_0x5b5237[_0xf153('0x1b')]['id']){delete _0x5b5237[_0xf153('0x1b')]['id'];}if(_0x5b5237[_0xf153('0x19')]['id']){return pm2['delete'](_0x5b5237['params']['id'])[_0xf153('0x12')](function(_0x4c6ea0){pm2['dump']();return _0x4c6ea0[0x0];})[_0xf153('0x12')](respondWithResult(_0x258fb0,null))['catch'](handleError(_0x258fb0,null));}else{return _0x258fb0[_0xf153('0xc')](0x1f4)['send']({'message':_0xf153('0x2a')});}}; \ No newline at end of file +var _0x3667=['lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','create','body','join','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','params','destroy','delete'];(function(_0x143d33,_0x5ae149){var _0x2ec94e=function(_0x62625a){while(--_0x62625a){_0x143d33['push'](_0x143d33['shift']());}};_0x2ec94e(++_0x5ae149);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var pm2=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var path=require(_0x7366('0x4'));var exec=require('child_process')[_0x7366('0x5')];var BPromise=require(_0x7366('0x6'));function handleEntityNotFound(_0x4b32a7,_0x27726b){return function(_0x22bfc0){if(!_0x22bfc0){_0x4b32a7[_0x7366('0x7')](0x194);;}return _0x22bfc0;};}function respondWithResult(_0x1c0cf4,_0x101e3d){_0x101e3d=_0x101e3d||0xc8;return function(_0x589397){if(_0x589397){return _0x1c0cf4[_0x7366('0x8')](_0x101e3d)[_0x7366('0x9')](_0x589397);}return null;};}function handleError(_0x2dd32b,_0x26e9a9){_0x26e9a9=_0x26e9a9||0x1f4;return function(_0x171fe2){logger[_0x7366('0xa')](_0x171fe2[_0x7366('0xb')]);if(_0x171fe2[_0x7366('0xc')]){delete _0x171fe2[_0x7366('0xc')];}_0x2dd32b[_0x7366('0x8')](_0x26e9a9)[_0x7366('0xd')](_0x171fe2);};}function execChildProcess(){return new BPromise(function(_0x2d7e38,_0x57ea7f){exec(_0x7366('0xe'),function(_0x2694fc,_0xbcd488,_0x4718db){logger[_0x7366('0xf')](_0xbcd488);logger[_0x7366('0xf')](_0x4718db);if(_0x2694fc){logger[_0x7366('0xa')](_0x2694fc);return _0x57ea7f(_0x2694fc);}return _0x2d7e38(_0xbcd488);});});}exports[_0x7366('0x10')]=function(_0x37e47e,_0x1813b7){return pm2[_0x7366('0x11')]()[_0x7366('0x12')](function(_0x27500c){if(_0x27500c){var _0x22562f=_[_0x7366('0x13')](_0x27500c,function(_0x4dd111){return _0x4dd111[_0x7366('0xc')]===_0x7366('0x14')||_0x4dd111[_0x7366('0xc')]===_0x7366('0x15');});return{'rows':_0x22562f,'count':_0x22562f[_0x7366('0x16')]};}return null;})[_0x7366('0x12')](respondWithResult(_0x1813b7,null))[_0x7366('0x17')](handleError(_0x1813b7,null));};exports[_0x7366('0x18')]=function(_0x83e5d5,_0x41113f){return pm2[_0x7366('0x19')](_0x83e5d5['params']['id'])[_0x7366('0x12')](respondWithResult(_0x41113f,null))['then'](handleEntityNotFound(_0x41113f,null))[_0x7366('0x17')](handleError(_0x41113f,null));};exports[_0x7366('0x1a')]=function(_0x3f23cd,_0x52b43e){if(_0x3f23cd[_0x7366('0x1b')][_0x7366('0xc')]&&_0x3f23cd[_0x7366('0x1b')]['script']){var _0x16e038=path[_0x7366('0x1c')](__dirname,'../../files/plugins',_0x3f23cd[_0x7366('0x1b')][_0x7366('0x1d')]);var _0xaab659=process[_0x7366('0x1e')]();process[_0x7366('0x1f')](path[_0x7366('0x20')](_0x16e038));return execChildProcess()[_0x7366('0x12')](function(_0x22ed7e){process[_0x7366('0x1f')](_0xaab659);return pm2[_0x7366('0x21')]({'name':_0x3f23cd[_0x7366('0x1b')][_0x7366('0xc')],'script':_0x16e038});})[_0x7366('0x12')](function(_0x563b22){pm2[_0x7366('0x22')]();return _0x563b22[0x0];})['then'](respondWithResult(_0x52b43e,0xc9))[_0x7366('0x17')](handleError(_0x52b43e,null));}else{return _0x52b43e['status'](0x1f4)['send']({'message':_0x7366('0x23')});}};exports['update']=function(_0x254374,_0x4ac138){if(_0x254374[_0x7366('0x1b')]['id']){delete _0x254374[_0x7366('0x1b')]['id'];}var _0x5c37e2={'online':_0x7366('0x24'),'stopped':'stop'};if(_0x5c37e2[_0x7366('0x25')](_0x254374[_0x7366('0x1b')]['status'])){return pm2[_0x5c37e2[_0x254374[_0x7366('0x1b')]['status']]](_0x254374[_0x7366('0x26')]['id'])[_0x7366('0x12')](respondWithResult(_0x4ac138,0xc8))[_0x7366('0x17')](handleError(_0x4ac138,null));}else{return _0x4ac138[_0x7366('0x8')](0x1f4)[_0x7366('0xd')]({'message':'Unknown\x20status'});}};exports[_0x7366('0x27')]=function(_0x447807,_0x538d42){if(_0x447807['body']['id']){delete _0x447807['body']['id'];}if(_0x447807['params']['id']){return pm2[_0x7366('0x28')](_0x447807[_0x7366('0x26')]['id'])[_0x7366('0x12')](function(_0x15286a){pm2['dump']();return _0x15286a[0x0];})[_0x7366('0x12')](respondWithResult(_0x538d42,null))[_0x7366('0x17')](handleError(_0x538d42,null));}else{return _0x538d42[_0x7366('0x8')](0x1f4)[_0x7366('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 62cbcb2..bb71ca1 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 _0x5dc0=['getAgents','getQueues','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x361b78,_0x49638f){var _0x4b95cc=function(_0x194d87){while(--_0x194d87){_0x361b78['push'](_0x361b78['shift']());}};_0x4b95cc(++_0x49638f);}(_0x5dc0,0xd1));var _0x05dc=function(_0x236a8d,_0x2e9b1d){_0x236a8d=_0x236a8d-0x0;var _0x212efe=_0x5dc0[_0x236a8d];return _0x212efe;};'use strict';var express=require(_0x05dc('0x0'));var router=express[_0x05dc('0x1')]();var auth=require(_0x05dc('0x2'));var controller=require(_0x05dc('0x3'));router[_0x05dc('0x4')](_0x05dc('0x5'),auth[_0x05dc('0x6')](),controller[_0x05dc('0x7')]);router[_0x05dc('0x4')]('/queues',auth['isAuthenticated'](),controller[_0x05dc('0x8')]);module['exports']=router; \ No newline at end of file +var _0xa9ea=['Router','get','isAuthenticated','getAgents','/queues','getQueues','exports'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0xa9ea,0x111));var _0xaa9e=function(_0x3198fd,_0x3729d8){_0x3198fd=_0x3198fd-0x0;var _0x2dd0b=_0xa9ea[_0x3198fd];return _0x2dd0b;};'use strict';var express=require('express');var router=express[_0xaa9e('0x0')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router[_0xaa9e('0x1')]('/agents',auth[_0xaa9e('0x2')](),controller[_0xaa9e('0x3')]);router[_0xaa9e('0x1')](_0xaa9e('0x4'),auth[_0xaa9e('0x2')](),controller[_0xaa9e('0x5')]);module[_0xaa9e('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 4a67061..e37e938 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 _0x5593=['UserProfile','getResources','findAndCountAll','map','find','filterAgentAttributes','globalStatus','pause','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','startCase','voice','outbound','dialActive','dialMethod','getOptions','Queues','name','filter','assign','getRealtimeQueues','initializeQueues','catch','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','User','rawAttributes','fieldName','type','key','role','agent','length','push','forEach','*pause','Pause','where','merge','user','userProfileId','Agents','online'];(function(_0x5bd838,_0x4c1ca1){var _0x4aeba5=function(_0x4bf0a7){while(--_0x4bf0a7){_0x5bd838['push'](_0x5bd838['shift']());}};_0x4aeba5(++_0x4c1ca1);}(_0x5593,0x1f3));var _0x3559=function(_0x2c7900,_0x44f3b6){_0x2c7900=_0x2c7900-0x0;var _0x35c02f=_0x5593[_0x2c7900];return _0x35c02f;};'use strict';var _=require(_0x3559('0x0'));var util=require(_0x3559('0x1'));var rta=require(_0x3559('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x3559('0x3'));var utils=require(_0x3559('0x4'));var db=require(_0x3559('0x5'))['db'];var APIBadRequestError=require(_0x3559('0x6'))[_0x3559('0x7')];var APIHandleError=require(_0x3559('0x6'))[_0x3559('0x8')];function respondWithFilteredResult(_0xc5b6b2,_0x379ba7){return function(_0x21c3b4){if(_0x21c3b4){var _0x4aa360=typeof _0x379ba7[_0x3559('0x9')]===_0x3559('0xa')&&typeof _0x379ba7[_0x3559('0xb')]===_0x3559('0xa');var _0x21c6b2=_0x21c3b4[_0x3559('0xc')];var _0x58e767=_0x4aa360?0x0:_0x379ba7[_0x3559('0x9')];var _0x39c70b=_0x4aa360?_0x21c3b4[_0x3559('0xc')]:_0x379ba7[_0x3559('0x9')]+_0x379ba7['limit'];var _0x56ae92;if(_0x39c70b>=_0x21c6b2){_0x39c70b=_0x21c6b2;_0x56ae92=0xc8;}else{_0x56ae92=0xce;}_0xc5b6b2['status'](_0x56ae92);return _0xc5b6b2[_0x3559('0xd')](_0x3559('0xe'),_0x58e767+'-'+_0x39c70b+'/'+_0x21c6b2)[_0x3559('0xf')](_0x21c3b4);}return null;};}exports[_0x3559('0x10')]=function(_0x2ef2fc,_0x1a845b){var _0x3fa7be={'count':0x0,'rows':[]};var _0x4af693={};var _0x3ce839;var _0x8eafee=utils[_0x3559('0x11')]();var _0x4a25e3;var _0x5ad177;var _0x1573a2=_0x2ef2fc[_0x3559('0x12')][_0x3559('0x13')];var _0x35b6ea=_0x2ef2fc['query']['globalStatusFilter'];var _0x51002d=_0x2ef2fc[_0x3559('0x12')][_0x3559('0x14')];var _0xf0ced6=_0x35b6ea==='pause'||_0x35b6ea==='*pause'?!![]:![];var _0x237742=[];var _0x12ade6;var _0x1f766e;Promise[_0x3559('0x15')]()[_0x3559('0x16')](function(){if(_0x2ef2fc[_0x3559('0x12')][_0x3559('0x17')]){if(!utils[_0x3559('0x18')](_0x2ef2fc[_0x3559('0x12')][_0x3559('0x17')])){throw new APIBadRequestError(util[_0x3559('0x19')](_0x3559('0x1a'),_0x2ef2fc[_0x3559('0x12')][_0x3559('0x17')]));}_0x3ce839=_0x2ef2fc['query'][_0x3559('0x17')][_0x3559('0x1b')]();}if(!_0x2ef2fc[_0x3559('0x12')][_0x3559('0x1c')]||!_0x2ef2fc[_0x3559('0x12')][_0x3559('0x1c')][_0x3559('0x1d')]('globalStatus')){_0x2ef2fc['query']['sort']=rta['validateSortParameter'](_0x2ef2fc[_0x3559('0x12')]['sort']);return;}var _0x5d8ee3=rta['getUpdatedSortOptions'](_0x2ef2fc['query'][_0x3559('0x1c')]);_0x2ef2fc[_0x3559('0x12')][_0x3559('0x1c')]=_0x5d8ee3[_0x3559('0x1e')][_0x3559('0x1f')](',');_0x12ade6=_0x5d8ee3[_0x3559('0x20')];})[_0x3559('0x16')](function(){if(!_0x1573a2){return[];}return rta[_0x3559('0x21')](_0x1573a2,_0x3ce839);})['then'](function(_0x3bf06d){_0x237742=_0x3bf06d;return rta['getRealtimeAgents']();})[_0x3559('0x16')](function(_0x15c7f8){_0x5ad177=_0x15c7f8[_0x3559('0x22')];if((!_0x35b6ea||_0xf0ced6)&&!_0x12ade6){return _0x237742;}if(_0x12ade6&&!_0x35b6ea){return rta[_0x3559('0x23')](_0x5ad177,_0x237742,_0x12ade6);}else{return rta['getAgentIdsByStatus'](_0x5ad177,_0x237742,_0x35b6ea);}})[_0x3559('0x16')](function(_0x50d466){_0x237742=_0x50d466;var _0x491f56=![];if(_0x237742['length']===0x0){if(_0x1573a2||_0x35b6ea){_0x491f56=!![];}if(_0xf0ced6){_0x491f56=![];}}if(_0x491f56){return _0x3fa7be;}var _0x36466c=_['map'](db[_0x3559('0x24')][_0x3559('0x25')],function(_0x54fade){return{'name':_0x54fade[_0x3559('0x26')],'type':_0x54fade[_0x3559('0x27')][_0x3559('0x28')]};});_0x2ef2fc[_0x3559('0x12')][_0x3559('0x29')]=_0x3559('0x2a');_0x4af693=qs['getOptions'](_0x36466c,_0x2ef2fc);_0x4af693['raw']=!![];var _0x1d03a6=[];if(_0x237742[_0x3559('0x2b')]>0x0){_0x1d03a6[_0x3559('0x2c')]({'id':{'$in':_0x237742}});if(_0x12ade6&&!_0x35b6ea){_0x1f766e=[db['sequelize']['literal']('FIELD(id,'+_0x237742+')')];_0x4af693['order']=_0x1f766e;}}if(_0xf0ced6){_0x8eafee[_0x3559('0x2d')](function(_0x173a33){var _0x363338=!![];if(_0x35b6ea===_0x3559('0x2e')&&_0x3ce839!==_0x173a33){_0x363338=![];}_0x1d03a6[_0x3559('0x2c')]({[_0x173a33+_0x3559('0x2f')]:_0x363338});});if(_0x51002d){_0x1d03a6[_0x3559('0x2c')]({'pauseType':_0x51002d});}}else if(_0x35b6ea){_0x8eafee[_0x3559('0x2d')](function(_0x2d5167){_0x1d03a6[_0x3559('0x2c')]({[_0x2d5167+'Pause']:![]});});}_0x4af693[_0x3559('0x30')]=_[_0x3559('0x31')](_0x4af693[_0x3559('0x30')],{'$and':_0x1d03a6});if(_0x2ef2fc[_0x3559('0x32')]['role']===_0x3559('0x32')){var _0x2e9808={'params':{'id':_0x2ef2fc['user'][_0x3559('0x33')]},'query':{'section':_0x3559('0x34'),'role':_0x3559('0x2a'),'raw':!![],'ids':_0x237742,'customSorting':_0x1f766e}};if(_0x2ef2fc[_0x3559('0x12')]['online']){_0x2e9808[_0x3559('0x12')][_0x3559('0x35')]=!![];}if(_0xf0ced6){_0x2e9808[_0x3559('0x12')]['extraQueryConditions']=_0x1d03a6;}_0x2e9808[_0x3559('0x12')]=Object['assign'](_0x2e9808[_0x3559('0x12')],_['omit'](_0x2ef2fc[_0x3559('0x12')],'id'));return db[_0x3559('0x36')][_0x3559('0x37')](_0x2e9808);}return db['User'][_0x3559('0x38')](_0x4af693);})[_0x3559('0x16')](function(_0x3cc31a){_0x3fa7be[_0x3559('0xc')]=_0x3cc31a['count'];_0x4a25e3=_0x3cc31a[_0x3559('0x22')];return _0x4a25e3[_0x3559('0x39')](function(_0x562b7f){var _0x256424=_[_0x3559('0x3a')](_0x5ad177,['id',_0x562b7f['id']]);if(_0x256424){var _0x4d728a=rta[_0x3559('0x3b')](_0x256424);_[_0x3559('0x31')](_0x562b7f,_0x4d728a);}_0x562b7f[_0x3559('0x3c')]=rta['getAgentStatus'](_0x562b7f);if(_0x562b7f['globalStatus'][_0x3559('0x1d')](_0x3559('0x3d'))){_0x8eafee[_0x3559('0x2d')](function(_0x325fa7){if(_0x562b7f[_0x325fa7+_0x3559('0x2f')]){if(_0x325fa7==='voice'){if(_0x562b7f[_0x3559('0x3e')]!==_0x3559('0x3f')){_0x562b7f['voiceStatus']=_0x3559('0x3d');}}else{_0x562b7f[_0x325fa7+_0x3559('0x40')]=_0x3559('0x3d');}}});}return _0x562b7f;});})[_0x3559('0x16')](function(_0x202172){if(!_0x12ade6||_0x1f766e){return _0x202172;}return rta['sortAgentsByStatus'](_0x202172,_0x12ade6);})[_0x3559('0x16')](function(_0x11171e){var _0x4c9a48=rta[_0x3559('0x41')]();_0x3fa7be[_0x3559('0x22')]=_0x11171e[_0x3559('0x39')](function(_0xeb27c5){return _['pick'](_0xeb27c5,_0x4c9a48);});return _0x3fa7be;})[_0x3559('0x16')](respondWithFilteredResult(_0x1a845b,_0x4af693))['catch'](APIHandleError(_0x1a845b));};exports['getQueues']=function(_0x3b78a3,_0xbad16d){var _0x17ef6b={'count':0x0,'rows':[]};var _0x38e15d={};var _0x3eb15e;var _0x42e84d;var _0x574406;Promise[_0x3559('0x15')]()[_0x3559('0x16')](function(){if(_0x3b78a3[_0x3559('0x12')][_0x3559('0x17')]){if(!utils[_0x3559('0x18')](_0x3b78a3[_0x3559('0x12')]['channel'])){throw new APIBadRequestError(util[_0x3559('0x19')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3b78a3['query'][_0x3559('0x17')]));}_0x3eb15e=_0x3b78a3[_0x3559('0x12')][_0x3559('0x17')][_0x3559('0x1b')]();}var _0x3145c0=_[_0x3559('0x42')](_0x3eb15e)+'Queue';var _0x3e2840=_[_0x3559('0x39')](db[_0x3145c0][_0x3559('0x25')],function(_0x274e7e){return{'name':_0x274e7e[_0x3559('0x26')],'type':_0x274e7e[_0x3559('0x27')][_0x3559('0x28')]};});if(!_0x3b78a3[_0x3559('0x12')][_0x3559('0x1e')]){var _0x1ddddb=['id','name'];if(_0x3eb15e===_0x3559('0x43')){_0x1ddddb['push'](_0x3559('0x27'));if(_0x3b78a3['query'][_0x3559('0x27')]===_0x3559('0x44')){_0x1ddddb[_0x3559('0x2c')]([_0x3559('0x45'),_0x3559('0x46')]);}}_0x3b78a3[_0x3559('0x12')]['fields']=_0x1ddddb[_0x3559('0x1f')](',');}_0x38e15d=qs[_0x3559('0x47')](_0x3e2840,_0x3b78a3);if(_0x3b78a3[_0x3559('0x32')][_0x3559('0x29')]===_0x3559('0x32')){var _0x391b24={'params':{'id':_0x3b78a3[_0x3559('0x32')]['userProfileId']},'query':{'section':_0x3eb15e===_0x3559('0x43')&&_0x3b78a3[_0x3559('0x12')]['type']===_0x3559('0x44')?'QueueCampaigns':_['startCase'](_0x3eb15e)+_0x3559('0x48'),'type':_0x3b78a3[_0x3559('0x12')][_0x3559('0x27')],'nolimit':!![],'sort':_0x3559('0x49'),'filter':_0x3b78a3[_0x3559('0x12')][_0x3559('0x4a')]}};_0x391b24[_0x3559('0x12')]=Object[_0x3559('0x4b')](_0x391b24[_0x3559('0x12')],_0x3b78a3[_0x3559('0x12')]);delete _0x391b24['query']['id'];return db[_0x3559('0x36')][_0x3559('0x37')](_0x391b24);}return db[_0x3145c0][_0x3559('0x38')](_0x38e15d);})[_0x3559('0x16')](function(_0x2e857f){_0x17ef6b['count']=_0x2e857f[_0x3559('0xc')];_0x42e84d=_0x2e857f[_0x3559('0x22')];return rtq[_0x3559('0x4c')](_0x3b78a3,_0x3eb15e);})[_0x3559('0x16')](function(_0x56e6ba){_0x574406=_0x56e6ba[_0x3559('0x22')];return rtq[_0x3559('0x4d')](_0x42e84d,_0x574406,_0x3eb15e,_0x3b78a3[_0x3559('0x12')][_0x3559('0x27')]);})[_0x3559('0x16')](function(_0x1c1f88){_0x17ef6b[_0x3559('0x22')]=_0x1c1f88;return _0x17ef6b;})['then'](respondWithFilteredResult(_0xbad16d,_0x38e15d))[_0x3559('0x4e')](APIHandleError(_0xbad16d));}; \ No newline at end of file +var _0xf10f=['format','startCase','name','voice','outbound','dialActive','dialMethod','Queues','rows','getRealtimeQueues','catch','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pause','*pause','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','fields','join','order','then','getRealtimeAgents','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','forEach','push','Pause','where','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','getAgentStatus','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','getQueues','isValidChannel'];(function(_0x2e0e4b,_0xa3d22e){var _0x2bc65d=function(_0xba1ba6){while(--_0xba1ba6){_0x2e0e4b['push'](_0x2e0e4b['shift']());}};_0x2bc65d(++_0xa3d22e);}(_0xf10f,0x14f));var _0xff10=function(_0x3701ed,_0x4a749c){_0x3701ed=_0x3701ed-0x0;var _0x7622a2=_0xf10f[_0x3701ed];return _0x7622a2;};'use strict';var _=require('lodash');var util=require(_0xff10('0x0'));var rta=require(_0xff10('0x1'));var rtq=require(_0xff10('0x2'));var qs=require(_0xff10('0x3'));var utils=require(_0xff10('0x4'));var db=require(_0xff10('0x5'))['db'];var APIBadRequestError=require(_0xff10('0x6'))[_0xff10('0x7')];var APIHandleError=require(_0xff10('0x6'))[_0xff10('0x8')];function respondWithFilteredResult(_0x418aff,_0x52a4c9){return function(_0x4534a1){if(_0x4534a1){var _0x1b317c=typeof _0x52a4c9[_0xff10('0x9')]==='undefined'&&typeof _0x52a4c9[_0xff10('0xa')]==='undefined';var _0x3e2504=_0x4534a1[_0xff10('0xb')];var _0x5b087a=_0x1b317c?0x0:_0x52a4c9[_0xff10('0x9')];var _0x2f2746=_0x1b317c?_0x4534a1['count']:_0x52a4c9[_0xff10('0x9')]+_0x52a4c9[_0xff10('0xa')];var _0x51d5bc;if(_0x2f2746>=_0x3e2504){_0x2f2746=_0x3e2504;_0x51d5bc=0xc8;}else{_0x51d5bc=0xce;}_0x418aff[_0xff10('0xc')](_0x51d5bc);return _0x418aff[_0xff10('0xd')](_0xff10('0xe'),_0x5b087a+'-'+_0x2f2746+'/'+_0x3e2504)[_0xff10('0xf')](_0x4534a1);}return null;};}exports[_0xff10('0x10')]=function(_0x4862a7,_0x5cd4bc){var _0x448d36={'count':0x0,'rows':[]};var _0x4a940d={};var _0x42e66a;var _0x441dcf=utils[_0xff10('0x11')]();var _0x5c432a;var _0x4b9a36;var _0x51f09c=_0x4862a7['query']['globalQueueFilter'];var _0x293388=_0x4862a7[_0xff10('0x12')][_0xff10('0x13')];var _0x3dd19a=_0x4862a7[_0xff10('0x12')]['pauseTypeFilter'];var _0xf5867=_0x293388===_0xff10('0x14')||_0x293388===_0xff10('0x15')?!![]:![];var _0x4d197c=[];var _0xc1eec3;var _0x16de4;Promise[_0xff10('0x16')]()['then'](function(){if(_0x4862a7[_0xff10('0x12')][_0xff10('0x17')]){if(!utils['isValidChannel'](_0x4862a7['query'][_0xff10('0x17')])){throw new APIBadRequestError(util['format'](_0xff10('0x18'),_0x4862a7[_0xff10('0x12')]['channel']));}_0x42e66a=_0x4862a7[_0xff10('0x12')]['channel'][_0xff10('0x19')]();}if(!_0x4862a7[_0xff10('0x12')][_0xff10('0x1a')]||!_0x4862a7[_0xff10('0x12')][_0xff10('0x1a')]['includes'](_0xff10('0x1b'))){_0x4862a7[_0xff10('0x12')]['sort']=rta['validateSortParameter'](_0x4862a7[_0xff10('0x12')][_0xff10('0x1a')]);return;}var _0x1078e5=rta['getUpdatedSortOptions'](_0x4862a7[_0xff10('0x12')][_0xff10('0x1a')]);_0x4862a7[_0xff10('0x12')]['sort']=_0x1078e5[_0xff10('0x1c')][_0xff10('0x1d')](',');_0xc1eec3=_0x1078e5[_0xff10('0x1e')];})[_0xff10('0x1f')](function(){if(!_0x51f09c){return[];}return rta['getAgentIdsByQueues'](_0x51f09c,_0x42e66a);})[_0xff10('0x1f')](function(_0x2b3afa){_0x4d197c=_0x2b3afa;return rta[_0xff10('0x20')]();})[_0xff10('0x1f')](function(_0x119e65){_0x4b9a36=_0x119e65['rows'];if((!_0x293388||_0xf5867)&&!_0xc1eec3){return _0x4d197c;}if(_0xc1eec3&&!_0x293388){return rta['getSortedAgentsIdsByStatus'](_0x4b9a36,_0x4d197c,_0xc1eec3);}else{return rta[_0xff10('0x21')](_0x4b9a36,_0x4d197c,_0x293388);}})['then'](function(_0x5f3f1a){_0x4d197c=_0x5f3f1a;var _0x3d0a0f=![];if(_0x4d197c[_0xff10('0x22')]===0x0){if(_0x51f09c||_0x293388){_0x3d0a0f=!![];}if(_0xf5867){_0x3d0a0f=![];}}if(_0x3d0a0f){return _0x448d36;}var _0x628ddd=_[_0xff10('0x23')](db[_0xff10('0x24')][_0xff10('0x25')],function(_0x3bf894){return{'name':_0x3bf894[_0xff10('0x26')],'type':_0x3bf894[_0xff10('0x27')][_0xff10('0x28')]};});_0x4862a7[_0xff10('0x12')][_0xff10('0x29')]=_0xff10('0x2a');_0x4a940d=qs[_0xff10('0x2b')](_0x628ddd,_0x4862a7);_0x4a940d[_0xff10('0x2c')]=!![];var _0x1a40d6=[];if(_0x4d197c[_0xff10('0x22')]>0x0){_0x1a40d6['push']({'id':{'$in':_0x4d197c}});if(_0xc1eec3&&!_0x293388){_0x16de4=[db[_0xff10('0x2d')][_0xff10('0x2e')](_0xff10('0x2f')+_0x4d197c+')')];_0x4a940d[_0xff10('0x1e')]=_0x16de4;}}if(_0xf5867){_0x441dcf[_0xff10('0x30')](function(_0x580d6e){var _0x57066c=!![];if(_0x293388===_0xff10('0x15')&&_0x42e66a!==_0x580d6e){_0x57066c=![];}_0x1a40d6[_0xff10('0x31')]({[_0x580d6e+_0xff10('0x32')]:_0x57066c});});if(_0x3dd19a){_0x1a40d6[_0xff10('0x31')]({'pauseType':_0x3dd19a});}}else if(_0x293388){_0x441dcf[_0xff10('0x30')](function(_0x4c9276){_0x1a40d6['push']({[_0x4c9276+_0xff10('0x32')]:![]});});}_0x4a940d[_0xff10('0x33')]=_['merge'](_0x4a940d[_0xff10('0x33')],{'$and':_0x1a40d6});if(_0x4862a7[_0xff10('0x34')][_0xff10('0x29')]===_0xff10('0x34')){var _0xa9cd80={'params':{'id':_0x4862a7[_0xff10('0x34')][_0xff10('0x35')]},'query':{'section':_0xff10('0x36'),'role':'agent','raw':!![],'ids':_0x4d197c,'customSorting':_0x16de4}};if(_0x4862a7[_0xff10('0x12')][_0xff10('0x37')]){_0xa9cd80[_0xff10('0x12')][_0xff10('0x37')]=!![];}if(_0xf5867){_0xa9cd80[_0xff10('0x12')][_0xff10('0x38')]=_0x1a40d6;}_0xa9cd80[_0xff10('0x12')]=Object[_0xff10('0x39')](_0xa9cd80[_0xff10('0x12')],_['omit'](_0x4862a7[_0xff10('0x12')],'id'));return db[_0xff10('0x3a')][_0xff10('0x3b')](_0xa9cd80);}return db[_0xff10('0x24')][_0xff10('0x3c')](_0x4a940d);})[_0xff10('0x1f')](function(_0x588a5b){_0x448d36[_0xff10('0xb')]=_0x588a5b[_0xff10('0xb')];_0x5c432a=_0x588a5b['rows'];return _0x5c432a[_0xff10('0x23')](function(_0x19178e){var _0x28b3d9=_['find'](_0x4b9a36,['id',_0x19178e['id']]);if(_0x28b3d9){var _0x79aae3=rta[_0xff10('0x3d')](_0x28b3d9);_['merge'](_0x19178e,_0x79aae3);}_0x19178e[_0xff10('0x1b')]=rta[_0xff10('0x3e')](_0x19178e);if(_0x19178e[_0xff10('0x1b')]['includes']('pause')){_0x441dcf[_0xff10('0x30')](function(_0x1dfd29){if(_0x19178e[_0x1dfd29+'Pause']){if(_0x1dfd29==='voice'){if(_0x19178e[_0xff10('0x3f')]!==_0xff10('0x40')){_0x19178e['voiceStatus']=_0xff10('0x14');}}else{_0x19178e[_0x1dfd29+'Status']='pause';}}});}return _0x19178e;});})[_0xff10('0x1f')](function(_0x2ce9ed){if(!_0xc1eec3||_0x16de4){return _0x2ce9ed;}return rta[_0xff10('0x41')](_0x2ce9ed,_0xc1eec3);})[_0xff10('0x1f')](function(_0x32e9f7){var _0x564c3a=rta[_0xff10('0x42')]();_0x448d36['rows']=_0x32e9f7[_0xff10('0x23')](function(_0x1b5a82){return _[_0xff10('0x43')](_0x1b5a82,_0x564c3a);});return _0x448d36;})[_0xff10('0x1f')](respondWithFilteredResult(_0x5cd4bc,_0x4a940d))['catch'](APIHandleError(_0x5cd4bc));};exports[_0xff10('0x44')]=function(_0x1b6d31,_0x40fb4e){var _0x5e092d={'count':0x0,'rows':[]};var _0x3af069={};var _0x2c4c21;var _0x12dbdf;var _0x181d19;Promise[_0xff10('0x16')]()[_0xff10('0x1f')](function(){if(_0x1b6d31[_0xff10('0x12')][_0xff10('0x17')]){if(!utils[_0xff10('0x45')](_0x1b6d31[_0xff10('0x12')][_0xff10('0x17')])){throw new APIBadRequestError(util[_0xff10('0x46')](_0xff10('0x18'),_0x1b6d31['query'][_0xff10('0x17')]));}_0x2c4c21=_0x1b6d31[_0xff10('0x12')][_0xff10('0x17')]['toLowerCase']();}var _0x41bca5=_[_0xff10('0x47')](_0x2c4c21)+'Queue';var _0x4baeb4=_[_0xff10('0x23')](db[_0x41bca5]['rawAttributes'],function(_0x41e8c7){return{'name':_0x41e8c7[_0xff10('0x26')],'type':_0x41e8c7[_0xff10('0x27')]['key']};});if(!_0x1b6d31['query'][_0xff10('0x1c')]){var _0x1de0ba=['id',_0xff10('0x48')];if(_0x2c4c21===_0xff10('0x49')){_0x1de0ba[_0xff10('0x31')]('type');if(_0x1b6d31['query'][_0xff10('0x27')]===_0xff10('0x4a')){_0x1de0ba[_0xff10('0x31')]([_0xff10('0x4b'),_0xff10('0x4c')]);}}_0x1b6d31[_0xff10('0x12')]['fields']=_0x1de0ba[_0xff10('0x1d')](',');}_0x3af069=qs[_0xff10('0x2b')](_0x4baeb4,_0x1b6d31);if(_0x1b6d31['user'][_0xff10('0x29')]===_0xff10('0x34')){var _0x30b218={'params':{'id':_0x1b6d31['user']['userProfileId']},'query':{'section':_0x2c4c21==='voice'&&_0x1b6d31[_0xff10('0x12')]['type']===_0xff10('0x4a')?'QueueCampaigns':_[_0xff10('0x47')](_0x2c4c21)+_0xff10('0x4d'),'type':_0x1b6d31[_0xff10('0x12')]['type'],'nolimit':!![],'sort':_0xff10('0x48'),'filter':_0x1b6d31[_0xff10('0x12')]['filter']}};_0x30b218[_0xff10('0x12')]=Object[_0xff10('0x39')](_0x30b218[_0xff10('0x12')],_0x1b6d31[_0xff10('0x12')]);delete _0x30b218['query']['id'];return db[_0xff10('0x3a')][_0xff10('0x3b')](_0x30b218);}return db[_0x41bca5][_0xff10('0x3c')](_0x3af069);})[_0xff10('0x1f')](function(_0x1dc598){_0x5e092d[_0xff10('0xb')]=_0x1dc598[_0xff10('0xb')];_0x12dbdf=_0x1dc598[_0xff10('0x4e')];return rtq[_0xff10('0x4f')](_0x1b6d31,_0x2c4c21);})['then'](function(_0xa4a020){_0x181d19=_0xa4a020[_0xff10('0x4e')];return rtq['initializeQueues'](_0x12dbdf,_0x181d19,_0x2c4c21,_0x1b6d31[_0xff10('0x12')][_0xff10('0x27')]);})[_0xff10('0x1f')](function(_0x1b4a50){_0x5e092d[_0xff10('0x4e')]=_0x1b4a50;return _0x5e092d;})[_0xff10('0x1f')](respondWithFilteredResult(_0x40fb4e,_0x3af069))[_0xff10('0x50')](APIHandleError(_0x40fb4e));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b749b39..9a1fbf2 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xd5709b,_0x101823){var _0x3dc484=function(_0x28a409){while(--_0x28a409){_0xd5709b['push'](_0xd5709b['shift']());}};_0x3dc484(++_0x101823);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5b7fe3,_0x590356){var _0x19be58=function(_0x63e7c6){while(--_0x63e7c6){_0x5b7fe3['push'](_0x5b7fe3['shift']());}};_0x19be58(++_0x590356);}(_0xe706,0xa3));var _0x6e70=function(_0x30c3c2,_0x330cca){_0x30c3c2=_0x30c3c2-0x0;var _0x738110=_0xe706[_0x30c3c2];return _0x738110;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index b176254..d03d9c4 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 _0x3dba=['INTEGER','STRING','DATE'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0x3dba,0x73));var _0xa3db=function(_0x34f499,_0xd8ff6e){_0x34f499=_0x34f499-0x0;var _0x2be65b=_0x3dba[_0x34f499];return _0x2be65b;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xa3db('0x0')]},'scheduledat':{'type':Sequelize[_0xa3db('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xa3db('0x1')]},'responsetime':{'type':Sequelize[_0xa3db('0x1')]},'ringtime':{'type':Sequelize[_0xa3db('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa3db('0x0')]},'campaigntype':{'type':Sequelize[_0xa3db('0x0')]},'membername':{'type':Sequelize[_0xa3db('0x0')]}}; \ No newline at end of file +var _0x0eb2=['sequelize','INTEGER','STRING','DATE'];(function(_0x30bedc,_0x46d991){var _0x1715e4=function(_0xf49dc9){while(--_0xf49dc9){_0x30bedc['push'](_0x30bedc['shift']());}};_0x1715e4(++_0x46d991);}(_0x0eb2,0x11c));var _0x20eb=function(_0x18ab18,_0x40b0e9){_0x18ab18=_0x18ab18-0x0;var _0x305236=_0x0eb2[_0x18ab18];return _0x305236;};'use strict';var Sequelize=require(_0x20eb('0x0'));module['exports']={'state':{'type':Sequelize[_0x20eb('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x20eb('0x2')]},'scheduledat':{'type':Sequelize[_0x20eb('0x3')]},'uniqueid':{'type':Sequelize[_0x20eb('0x2')]},'starttime':{'type':Sequelize[_0x20eb('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x20eb('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5998232..b7a552b 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 _0x2b01=['report_agent_preview','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b01,0xaa));var _0x12b0=function(_0x2b9efc,_0xebce6c){_0x2b9efc=_0x2b9efc-0x0;var _0x5eb144=_0x2b01[_0x2b9efc];return _0x5eb144;};'use strict';var _=require(_0x12b0('0x0'));var util=require(_0x12b0('0x1'));var logger=require(_0x12b0('0x2'))(_0x12b0('0x3'));var moment=require('moment');var BPromise=require(_0x12b0('0x4'));var rp=require(_0x12b0('0x5'));var fs=require('fs');var path=require(_0x12b0('0x6'));var rimraf=require(_0x12b0('0x7'));var config=require('../../config/environment');var attributes=require(_0x12b0('0x8'));module[_0x12b0('0x9')]=function(_0x1926a1,_0x1ac136){return _0x1926a1[_0x12b0('0xa')](_0x12b0('0xb'),attributes,{'tableName':_0x12b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f14=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x3ceec5,_0x4d3442){var _0x192285=function(_0x5f32b3){while(--_0x5f32b3){_0x3ceec5['push'](_0x3ceec5['shift']());}};_0x192285(++_0x4d3442);}(_0x3f14,0x108));var _0x43f1=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0x3f14[_0x4d337e];return _0x247963;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x43f1('0x0'))('api');var moment=require(_0x43f1('0x1'));var BPromise=require(_0x43f1('0x2'));var rp=require(_0x43f1('0x3'));var fs=require('fs');var path=require(_0x43f1('0x4'));var rimraf=require(_0x43f1('0x5'));var config=require(_0x43f1('0x6'));var attributes=require(_0x43f1('0x7'));module[_0x43f1('0x8')]=function(_0x4ec504,_0x18208f){return _0x4ec504[_0x43f1('0x9')](_0x43f1('0xa'),attributes,{'tableName':_0x43f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 11aa20c..51c35a4 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 _0x5196=['create','body','options','raw','debug','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateReportAgentPreview','ReportAgentPreview'];(function(_0xfdb87e,_0x17aeca){var _0x909bfa=function(_0x4b105b){while(--_0x4b105b){_0xfdb87e['push'](_0xfdb87e['shift']());}};_0x909bfa(++_0x17aeca);}(_0x5196,0x164));var _0x6519=function(_0x264571,_0x7dd5e2){_0x264571=_0x264571-0x0;var _0x413819=_0x5196[_0x264571];return _0x413819;};'use strict';var _=require(_0x6519('0x0'));var util=require('util');var moment=require(_0x6519('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6519('0x2'));var db=require(_0x6519('0x3'))['db'];var utils=require(_0x6519('0x4'));var logger=require(_0x6519('0x5'))('rpc');var config=require(_0x6519('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14c9e8,_0x15724c,_0x7fcdf5){return new BPromise(function(_0x57387e,_0x2f379b){return client['request'](_0x14c9e8,_0x7fcdf5)[_0x6519('0x7')](function(_0x5a7ade){logger['info'](_0x6519('0x8'),_0x15724c,'request\x20sent');logger['debug'](_0x6519('0x9'),_0x15724c,_0x6519('0xa'),JSON[_0x6519('0xb')](_0x5a7ade));if(_0x5a7ade[_0x6519('0xc')]){if(_0x5a7ade[_0x6519('0xc')][_0x6519('0xd')]===0x1f4){logger[_0x6519('0xc')](_0x6519('0x8'),_0x15724c,_0x5a7ade[_0x6519('0xc')][_0x6519('0xe')]);return _0x2f379b(_0x5a7ade[_0x6519('0xc')][_0x6519('0xe')]);}logger[_0x6519('0xc')](_0x6519('0x8'),_0x15724c,_0x5a7ade[_0x6519('0xc')][_0x6519('0xe')]);return _0x57387e(_0x5a7ade[_0x6519('0xc')][_0x6519('0xe')]);}else{logger[_0x6519('0xf')](_0x6519('0x8'),_0x15724c,_0x6519('0xa'));_0x57387e(_0x5a7ade[_0x6519('0x10')][_0x6519('0xe')]);}})['catch'](function(_0x3d5e2e){logger[_0x6519('0xc')](_0x6519('0x8'),_0x15724c,_0x3d5e2e);_0x2f379b(_0x3d5e2e);});});}exports[_0x6519('0x11')]=function(_0x4d3dc1){var _0x3078e7=this;return new Promise(function(_0x156565,_0x151f09){return db[_0x6519('0x12')][_0x6519('0x13')](_0x4d3dc1[_0x6519('0x14')],{'raw':_0x4d3dc1[_0x6519('0x15')]?_0x4d3dc1[_0x6519('0x15')][_0x6519('0x16')]===undefined?!![]:![]:!![]})[_0x6519('0x7')](function(_0x6b6a04){logger[_0x6519('0xf')](_0x6519('0x11'),_0x4d3dc1);logger[_0x6519('0x17')](_0x6519('0x11'),_0x4d3dc1,JSON[_0x6519('0xb')](_0x6b6a04));_0x156565(_0x6b6a04);})[_0x6519('0x18')](function(_0x1d5b4e){logger['error'](_0x6519('0x11'),_0x1d5b4e[_0x6519('0xe')],_0x4d3dc1);_0x151f09(_0x3078e7['error'](0x1f4,_0x1d5b4e[_0x6519('0xe')]));});});}; \ No newline at end of file +var _0xa991=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create','options','info','stringify','catch'];(function(_0x3a3727,_0xed98af){var _0x1b2764=function(_0x53bf34){while(--_0x53bf34){_0x3a3727['push'](_0x3a3727['shift']());}};_0x1b2764(++_0xed98af);}(_0xa991,0xc0));var _0x1a99=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xa991[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x1a99('0x0'));var util=require('util');var moment=require(_0x1a99('0x1'));var BPromise=require(_0x1a99('0x2'));var rs=require(_0x1a99('0x3'));var fs=require('fs');var Redis=require(_0x1a99('0x4'));var db=require(_0x1a99('0x5'))['db'];var utils=require(_0x1a99('0x6'));var logger=require(_0x1a99('0x7'))(_0x1a99('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1a99('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39cb70,_0x47b117,_0x18e308){return new BPromise(function(_0x1906e0,_0x29a6d7){return client['request'](_0x39cb70,_0x18e308)[_0x1a99('0xa')](function(_0x514e08){logger['info'](_0x1a99('0xb'),_0x47b117,_0x1a99('0xc'));logger[_0x1a99('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x47b117,'request\x20sent',JSON['stringify'](_0x514e08));if(_0x514e08[_0x1a99('0xe')]){if(_0x514e08['error']['code']===0x1f4){logger[_0x1a99('0xe')](_0x1a99('0xb'),_0x47b117,_0x514e08[_0x1a99('0xe')]['message']);return _0x29a6d7(_0x514e08[_0x1a99('0xe')][_0x1a99('0xf')]);}logger[_0x1a99('0xe')](_0x1a99('0xb'),_0x47b117,_0x514e08['error']['message']);return _0x1906e0(_0x514e08[_0x1a99('0xe')][_0x1a99('0xf')]);}else{logger['info'](_0x1a99('0xb'),_0x47b117,_0x1a99('0xc'));_0x1906e0(_0x514e08[_0x1a99('0x10')]['message']);}})['catch'](function(_0x433247){logger['error'](_0x1a99('0xb'),_0x47b117,_0x433247);_0x29a6d7(_0x433247);});});}exports[_0x1a99('0x11')]=function(_0x3d8ef5){var _0x3dc6b5=this;return new Promise(function(_0x3146d0,_0x163dfe){return db[_0x1a99('0x12')][_0x1a99('0x13')](_0x3d8ef5['body'],{'raw':_0x3d8ef5['options']?_0x3d8ef5[_0x1a99('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x1a99('0xa')](function(_0x2ddf30){logger[_0x1a99('0x15')](_0x1a99('0x11'),_0x3d8ef5);logger[_0x1a99('0xd')]('CreateReportAgentPreview',_0x3d8ef5,JSON[_0x1a99('0x16')](_0x2ddf30));_0x3146d0(_0x2ddf30);})[_0x1a99('0x17')](function(_0x65b0b0){logger[_0x1a99('0xe')](_0x1a99('0x11'),_0x65b0b0[_0x1a99('0xf')],_0x3d8ef5);_0x163dfe(_0x3dc6b5[_0x1a99('0xe')](0x1f4,_0x65b0b0['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 70e5688..240e15f 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 _0xa6f3=['chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify'];(function(_0x2ea911,_0x377891){var _0x492208=function(_0x358e45){while(--_0x358e45){_0x2ea911['push'](_0x2ea911['shift']());}};_0x492208(++_0x377891);}(_0xa6f3,0xa6));var _0x3a6f=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0xa6f3[_0x1529a3];return _0x1a0d4b;};'use strict';var multer=require(_0x3a6f('0x0'));var util=require(_0x3a6f('0x1'));var path=require(_0x3a6f('0x2'));var express=require('express');var router=express[_0x3a6f('0x3')]();var auth=require(_0x3a6f('0x4'));var controller=require(_0x3a6f('0x5'));router[_0x3a6f('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0x3a6f('0x7')]);router[_0x3a6f('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x9')]);router[_0x3a6f('0x6')](_0x3a6f('0xa'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x3a6f('0x6')](_0x3a6f('0xb'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x3a6f('0x6')](_0x3a6f('0xc'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0xd')]);router[_0x3a6f('0x6')](_0x3a6f('0xe'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0xf')]);router[_0x3a6f('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x3a6f('0x10')]);router[_0x3a6f('0x6')](_0x3a6f('0x11'),auth[_0x3a6f('0x8')](),controller['openchannelQueues']);router['get'](_0x3a6f('0x12'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x13')]);router[_0x3a6f('0x6')](_0x3a6f('0x14'),auth[_0x3a6f('0x8')](),controller['whatsappQueues']);router[_0x3a6f('0x6')](_0x3a6f('0x15'),auth['isAuthenticated'](),controller[_0x3a6f('0x16')]);router[_0x3a6f('0x6')]('/voice/queues/preview/:id',auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x17')]);router[_0x3a6f('0x6')](_0x3a6f('0x18'),auth[_0x3a6f('0x8')](),controller['voiceQueuesChannels']);router['get']('/voice/queues/channels/:uniqueid',auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x19')]);router[_0x3a6f('0x6')](_0x3a6f('0x1a'),auth[_0x3a6f('0x8')](),controller['voiceQueuesChannelHangup']);router[_0x3a6f('0x6')](_0x3a6f('0x1b'),auth[_0x3a6f('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0x3a6f('0x6')](_0x3a6f('0x1c'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x1d')]);router[_0x3a6f('0x1e')](_0x3a6f('0x1c'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x1f')]);router[_0x3a6f('0x6')](_0x3a6f('0x20'),auth['isAuthenticated'](),controller[_0x3a6f('0x21')]);router[_0x3a6f('0x6')]('/outbound/channels',auth['isAuthenticated'](),controller['outboundChannels']);router[_0x3a6f('0x6')]('/agents',auth['isAuthenticated'](),controller[_0x3a6f('0x22')]);router[_0x3a6f('0x1e')](_0x3a6f('0x23'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x24')]);router[_0x3a6f('0x6')](_0x3a6f('0x25'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x26')]);router[_0x3a6f('0x6')](_0x3a6f('0x27'),auth[_0x3a6f('0x8')](),controller['trunks']);router[_0x3a6f('0x6')](_0x3a6f('0x28'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x29')]);router[_0x3a6f('0x6')]('/fax/accounts',auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x2a')]);router[_0x3a6f('0x6')](_0x3a6f('0x2b'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x2c')]);router[_0x3a6f('0x6')](_0x3a6f('0x2d'),auth[_0x3a6f('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0x3a6f('0x6')](_0x3a6f('0x2e'),auth[_0x3a6f('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0x3a6f('0x6')](_0x3a6f('0x2f'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x30')]);router[_0x3a6f('0x6')](_0x3a6f('0x31'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x32')]);router[_0x3a6f('0x6')](_0x3a6f('0x33'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x34')]);router[_0x3a6f('0x6')](_0x3a6f('0x35'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x3a6f('0x36')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x3a6f('0x37')](_0x3a6f('0x38')));router['get']('/mail/queues/:id',auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x39')]);router['post'](_0x3a6f('0x3a'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x37')](_0x3a6f('0x3b')));router[_0x3a6f('0x6')](_0x3a6f('0x3c'),auth[_0x3a6f('0x8')](),controller['showChatQueues']);router['post'](_0x3a6f('0x3d'),auth['isAuthenticated'](),controller['queueNotify'](_0x3a6f('0x3e')));router['get'](_0x3a6f('0x3f'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x40')]);router[_0x3a6f('0x36')](_0x3a6f('0x41'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x37')](_0x3a6f('0x42')));router[_0x3a6f('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x3a6f('0x43')]);router[_0x3a6f('0x36')](_0x3a6f('0x44'),auth[_0x3a6f('0x8')](),controller[_0x3a6f('0x37')](_0x3a6f('0x45')));router[_0x3a6f('0x36')](_0x3a6f('0x46'),auth[_0x3a6f('0x8')](),controller['queueNotify'](_0x3a6f('0x47')));router['get'](_0x3a6f('0x48'),auth[_0x3a6f('0x8')](),controller['showSmsQueues']);router[_0x3a6f('0x6')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x3a6f('0x49')]);router['post']('/agents/:id/notify',auth[_0x3a6f('0x8')](),controller['agentNotify']);module[_0x3a6f('0x4a')]=router; \ No newline at end of file +var _0xca96=['post','/mail/queues/:id/notify','mail','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','/trunks','/campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions'];(function(_0x35b7fd,_0x4a9f4d){var _0x1f8acd=function(_0x1f66a1){while(--_0x1f66a1){_0x35b7fd['push'](_0x35b7fd['shift']());}};_0x1f8acd(++_0x4a9f4d);}(_0xca96,0x1e9));var _0x6ca9=function(_0x133440,_0x4cb0b8){_0x133440=_0x133440-0x0;var _0x370f72=_0xca96[_0x133440];return _0x370f72;};'use strict';var multer=require(_0x6ca9('0x0'));var util=require(_0x6ca9('0x1'));var path=require(_0x6ca9('0x2'));var express=require(_0x6ca9('0x3'));var router=express[_0x6ca9('0x4')]();var auth=require(_0x6ca9('0x5'));var controller=require(_0x6ca9('0x6'));router[_0x6ca9('0x7')]('/voice/channels',auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x9')]);router['get'](_0x6ca9('0xa'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0xb')]);router[_0x6ca9('0x7')](_0x6ca9('0xc'),auth[_0x6ca9('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x6ca9('0x7')](_0x6ca9('0xd'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0xe')]);router['get'](_0x6ca9('0xf'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x10')]);router[_0x6ca9('0x7')](_0x6ca9('0x11'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x12')]);router[_0x6ca9('0x7')]('/mail/accounts',auth[_0x6ca9('0x8')](),controller['mailAccounts']);router[_0x6ca9('0x7')](_0x6ca9('0x13'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x14')]);router[_0x6ca9('0x7')](_0x6ca9('0x15'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x16')]);router[_0x6ca9('0x7')](_0x6ca9('0x17'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x18')]);router[_0x6ca9('0x7')](_0x6ca9('0x19'),auth[_0x6ca9('0x8')](),controller['faxQueues']);router[_0x6ca9('0x7')](_0x6ca9('0x1a'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x1b')]);router[_0x6ca9('0x7')](_0x6ca9('0x1c'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x1d')]);router[_0x6ca9('0x7')](_0x6ca9('0x1e'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x6ca9('0x20')]);router[_0x6ca9('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x21')]);router['get'](_0x6ca9('0x22'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x23')]);router['put'](_0x6ca9('0x22'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x24')]);router['get']('/outbound',auth['isAuthenticated'](),controller[_0x6ca9('0x25')]);router[_0x6ca9('0x7')](_0x6ca9('0x26'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x27')]);router[_0x6ca9('0x7')](_0x6ca9('0x28'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x29')]);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x6ca9('0x2a')]);router[_0x6ca9('0x7')](_0x6ca9('0x2b'),auth['isAuthenticated'](),controller[_0x6ca9('0x2c')]);router[_0x6ca9('0x7')](_0x6ca9('0x2d'),auth[_0x6ca9('0x8')](),controller['trunks']);router['get'](_0x6ca9('0x2e'),auth['isAuthenticated'](),controller['campaigns']);router[_0x6ca9('0x7')]('/fax/accounts',auth[_0x6ca9('0x8')](),controller['faxAccounts']);router[_0x6ca9('0x7')](_0x6ca9('0x2f'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x30')]);router[_0x6ca9('0x7')](_0x6ca9('0x31'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x32')]);router[_0x6ca9('0x7')]('/openchannel/queues/waitinginteractions',auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x33')]);router['get'](_0x6ca9('0x34'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x35')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x6ca9('0x36')]);router[_0x6ca9('0x7')](_0x6ca9('0x37'),auth['isAuthenticated'](),controller[_0x6ca9('0x38')]);router['get']('/fax/queues/waitinginteractions',auth[_0x6ca9('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x6ca9('0x39')](_0x6ca9('0x3a'),auth[_0x6ca9('0x8')](),controller['queueNotify'](_0x6ca9('0x3b')));router[_0x6ca9('0x7')](_0x6ca9('0x3c'),auth[_0x6ca9('0x8')](),controller['showMailQueues']);router[_0x6ca9('0x39')](_0x6ca9('0x3d'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x3e')](_0x6ca9('0x3f')));router[_0x6ca9('0x7')](_0x6ca9('0x40'),auth['isAuthenticated'](),controller[_0x6ca9('0x41')]);router[_0x6ca9('0x39')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x6ca9('0x3e')](_0x6ca9('0x42')));router['get'](_0x6ca9('0x43'),auth['isAuthenticated'](),controller['showFaxQueues']);router['post'](_0x6ca9('0x44'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x3e')](_0x6ca9('0x45')));router[_0x6ca9('0x7')](_0x6ca9('0x46'),auth[_0x6ca9('0x8')](),controller['showOpenchannelQueues']);router[_0x6ca9('0x39')](_0x6ca9('0x47'),auth['isAuthenticated'](),controller['queueNotify']('sms'));router['post']('/whatsapp/queues/:id/notify',auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x3e')](_0x6ca9('0x48')));router[_0x6ca9('0x7')](_0x6ca9('0x49'),auth['isAuthenticated'](),controller[_0x6ca9('0x4a')]);router[_0x6ca9('0x7')]('/whatsapp/queues/:id',auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x4b')]);router['post'](_0x6ca9('0x4c'),auth[_0x6ca9('0x8')](),controller['agentNotify']);module[_0x6ca9('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 8659796..34a9ada 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 _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file +var _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index b752440..55ffd60 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 _0x46c3=['/:id','show','/:id/run','run','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0x5eea6c,_0x1fc17d){var _0x5e75e3=function(_0x1058ee){while(--_0x1058ee){_0x5eea6c['push'](_0x5eea6c['shift']());}};_0x5e75e3(++_0x1fc17d);}(_0x46c3,0x1ea));var _0x346c=function(_0x193d8d,_0x6eaaaa){_0x193d8d=_0x193d8d-0x0;var _0x11994b=_0x46c3[_0x193d8d];return _0x11994b;};'use strict';var multer=require('multer');var util=require(_0x346c('0x0'));var path=require(_0x346c('0x1'));var timeout=require(_0x346c('0x2'));var express=require(_0x346c('0x3'));var router=express[_0x346c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x346c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x346c('0x6'));var controller=require(_0x346c('0x7'));router[_0x346c('0x8')]('/',auth[_0x346c('0x9')](),controller['index']);router[_0x346c('0x8')](_0x346c('0xa'),auth[_0x346c('0x9')](),controller[_0x346c('0xb')]);router[_0x346c('0x8')](_0x346c('0xc'),auth[_0x346c('0x9')](),controller[_0x346c('0xd')]);router[_0x346c('0xe')]('/',auth['isAuthenticated'](),controller[_0x346c('0xf')]);router[_0x346c('0x10')]('/:id',auth[_0x346c('0x9')](),controller['update']);router[_0x346c('0x11')](_0x346c('0xa'),auth[_0x346c('0x9')](),controller[_0x346c('0x12')]);module[_0x346c('0x13')]=router; \ No newline at end of file +var _0x609a=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/run','run','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4a29a9,_0x58cd04){var _0x386570=function(_0x1d2d09){while(--_0x1d2d09){_0x4a29a9['push'](_0x4a29a9['shift']());}};_0x386570(++_0x58cd04);}(_0x609a,0x8f));var _0xa609=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x609a[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var path=require(_0xa609('0x2'));var timeout=require(_0xa609('0x3'));var express=require(_0xa609('0x4'));var router=express['Router']();var fs_extra=require(_0xa609('0x5'));var auth=require(_0xa609('0x6'));var interaction=require(_0xa609('0x7'));var config=require(_0xa609('0x8'));var controller=require('./schedule.controller');router[_0xa609('0x9')]('/',auth[_0xa609('0xa')](),controller['index']);router['get'](_0xa609('0xb'),auth['isAuthenticated'](),controller[_0xa609('0xc')]);router[_0xa609('0x9')](_0xa609('0xd'),auth['isAuthenticated'](),controller[_0xa609('0xe')]);router[_0xa609('0xf')]('/',auth[_0xa609('0xa')](),controller[_0xa609('0x10')]);router['put']('/:id',auth[_0xa609('0xa')](),controller[_0xa609('0x11')]);router[_0xa609('0x12')]('/:id',auth[_0xa609('0xa')](),controller[_0xa609('0x13')]);module[_0xa609('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index cdb8c7a..3583ecf 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 _0xd026=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','days','hours','minutes','csv','pdf','xlsx','TEXT','sequelize','STRING','BOOLEAN'];(function(_0x546e09,_0x207840){var _0x5201c3=function(_0x22ca59){while(--_0x22ca59){_0x546e09['push'](_0x546e09['shift']());}};_0x5201c3(++_0x207840);}(_0xd026,0x66));var _0x6d02=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xd026[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x6d02('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d02('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6d02('0x1')]},'active':{'type':Sequelize[_0x6d02('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6d02('0x3')},'startAt':{'type':Sequelize[_0x6d02('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x6d02('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x6d02('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6d02('0x6')]('years',_0x6d02('0x7'),'months','weeks',_0x6d02('0x8'),_0x6d02('0x9'),_0x6d02('0xa')),'allowNull':![],'defaultValue':_0x6d02('0x8')},'output':{'type':Sequelize['ENUM'](_0x6d02('0xb'),_0x6d02('0xc'),_0x6d02('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x6d02('0x6')]('custom','default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x6d02('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6d02('0xe')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x0ebf=['pdf','xlsx','csv','custom','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','ENUM','years','months','weeks','minutes','days'];(function(_0x535ed0,_0x34b0e0){var _0x237fd8=function(_0x40062c){while(--_0x40062c){_0x535ed0['push'](_0x535ed0['shift']());}};_0x237fd8(++_0x34b0e0);}(_0x0ebf,0xad));var _0xf0eb=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0x0ebf[_0x5e1e25];return _0x548e5f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf0eb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xf0eb('0x0')]},'active':{'type':Sequelize[_0xf0eb('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf0eb('0x0')],'allowNull':![],'defaultValue':_0xf0eb('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf0eb('0x3')](_0xf0eb('0x4'),'quarters',_0xf0eb('0x5'),_0xf0eb('0x6'),'days','hours',_0xf0eb('0x7')),'allowNull':![],'defaultValue':_0xf0eb('0x8')},'output':{'type':Sequelize['ENUM']('csv',_0xf0eb('0x9'),_0xf0eb('0xa')),'allowNull':![],'defaultValue':_0xf0eb('0xb')},'type':{'type':Sequelize[_0xf0eb('0x3')](_0xf0eb('0xc'),'default'),'allowNull':![],'defaultValue':_0xf0eb('0xc')},'sendMail':{'type':Sequelize[_0xf0eb('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xf0eb('0x0')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xf0eb('0xd')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 9741473..f92621d 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 _0xb4fd=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','Scheduler','UserProfileResource','destroy','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','Schedule','includeAll','include','rows','catch','show','params','create','user','get','role','UserProfileSection','find','autoAssociation','error'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0xb4fd,0x153));var _0xdb4f=function(_0x597a43,_0x1df74b){_0x597a43=_0x597a43-0x0;var _0x365eb9=_0xb4fd[_0x597a43];return _0x365eb9;};'use strict';var emlformat=require(_0xdb4f('0x0'));var rimraf=require(_0xdb4f('0x1'));var zipdir=require(_0xdb4f('0x2'));var jsonpatch=require(_0xdb4f('0x3'));var rp=require('request-promise');var moment=require(_0xdb4f('0x4'));var BPromise=require(_0xdb4f('0x5'));var Mustache=require(_0xdb4f('0x6'));var util=require(_0xdb4f('0x7'));var path=require('path');var sox=require(_0xdb4f('0x8'));var csv=require(_0xdb4f('0x9'));var ejs=require(_0xdb4f('0xa'));var fs=require('fs');var fs_extra=require(_0xdb4f('0xb'));var _=require('lodash');var squel=require(_0xdb4f('0xc'));var crypto=require('crypto');var jsforce=require(_0xdb4f('0xd'));var deskjs=require(_0xdb4f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdb4f('0xf'));var Papa=require(_0xdb4f('0x10'));var Redis=require(_0xdb4f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdb4f('0x12'));var as=require(_0xdb4f('0x13'));var hardwareService=require(_0xdb4f('0x14'));var logger=require(_0xdb4f('0x15'))(_0xdb4f('0x16'));var utils=require('../../config/utils');var config=require(_0xdb4f('0x17'));var licenseUtil=require(_0xdb4f('0x18'));var db=require(_0xdb4f('0x19'))['db'];function respondWithStatusCode(_0xa0576d,_0x216d47){_0x216d47=_0x216d47||0xcc;return function(_0x500237){if(_0x500237){return _0xa0576d[_0xdb4f('0x1a')](_0x216d47);}return _0xa0576d['status'](_0x216d47)[_0xdb4f('0x1b')]();};}function respondWithResult(_0x154d38,_0x3a3bd4){_0x3a3bd4=_0x3a3bd4||0xc8;return function(_0x7b221a){if(_0x7b221a){return _0x154d38[_0xdb4f('0x1c')](_0x3a3bd4)['json'](_0x7b221a);}};}function respondWithFilteredResult(_0x13a3a3,_0x5a4a22){return function(_0x1b09d0){if(_0x1b09d0){var _0x21138f=typeof _0x5a4a22[_0xdb4f('0x1d')]===_0xdb4f('0x1e')&&typeof _0x5a4a22[_0xdb4f('0x1f')]===_0xdb4f('0x1e');var _0x3710bd=_0x1b09d0[_0xdb4f('0x20')];var _0x379b6f=_0x21138f?0x0:_0x5a4a22[_0xdb4f('0x1d')];var _0x38dcb1=_0x21138f?_0x1b09d0[_0xdb4f('0x20')]:_0x5a4a22[_0xdb4f('0x1d')]+_0x5a4a22['limit'];var _0x37e5ec;if(_0x38dcb1>=_0x3710bd){_0x38dcb1=_0x3710bd;_0x37e5ec=0xc8;}else{_0x37e5ec=0xce;}_0x13a3a3['status'](_0x37e5ec);return _0x13a3a3[_0xdb4f('0x21')](_0xdb4f('0x22'),_0x379b6f+'-'+_0x38dcb1+'/'+_0x3710bd)[_0xdb4f('0x23')](_0x1b09d0);}return null;};}function patchUpdates(_0x4aa4f8){return function(_0x17ffc3){try{jsonpatch[_0xdb4f('0x24')](_0x17ffc3,_0x4aa4f8,!![]);}catch(_0x8a942c){return BPromise[_0xdb4f('0x25')](_0x8a942c);}return _0x17ffc3['save']();};}function saveUpdates(_0x1ab82c,_0x3861bd){return function(_0x3dc28d){if(_0x3dc28d){return _0x3dc28d[_0xdb4f('0x26')](_0x1ab82c)['then'](function(_0xdf1aa5){return _0xdf1aa5;});}return null;};}function removeEntity(_0x60b84,_0x2a9e54){return function(_0x7a77b4){if(_0x7a77b4){return _0x7a77b4['destroy']()[_0xdb4f('0x27')](function(){var _0x8bd17a=_0x7a77b4['get']({'plain':!![]});var _0x11b5c9=_0xdb4f('0x28');return db[_0xdb4f('0x29')][_0xdb4f('0x2a')]({'where':{'type':_0x11b5c9,'resourceId':_0x8bd17a['id']}})['then'](function(){return _0x7a77b4;});})[_0xdb4f('0x27')](function(){_0x60b84[_0xdb4f('0x1c')](0xcc)[_0xdb4f('0x1b')]();});}};}function handleEntityNotFound(_0x333afe,_0x346054){return function(_0x44a3d4){if(!_0x44a3d4){_0x333afe[_0xdb4f('0x1a')](0x194);}return _0x44a3d4;};}function handleError(_0xf5da84,_0x1d50d2){_0x1d50d2=_0x1d50d2||0x1f4;return function(_0x11b6d4){logger['error'](_0x11b6d4[_0xdb4f('0x2b')]);if(_0x11b6d4[_0xdb4f('0x2c')]){delete _0x11b6d4['name'];}_0xf5da84[_0xdb4f('0x1c')](_0x1d50d2)[_0xdb4f('0x2d')](_0x11b6d4);};}exports[_0xdb4f('0x2e')]=function(_0xba366b,_0x1950d5){var _0xe2dd71={},_0x362e3f={},_0x374b9e={'count':0x0,'rows':[]};var _0x5360db=_[_0xdb4f('0x2f')](db['Schedule']['rawAttributes'],function(_0x3d8a36){return{'name':_0x3d8a36[_0xdb4f('0x30')],'type':_0x3d8a36['type'][_0xdb4f('0x31')]};});_0x362e3f[_0xdb4f('0x32')]=_[_0xdb4f('0x2f')](_0x5360db,'name');_0x362e3f[_0xdb4f('0x33')]=_[_0xdb4f('0x34')](_0xba366b['query']);_0x362e3f['filters']=_[_0xdb4f('0x35')](_0x362e3f[_0xdb4f('0x32')],_0x362e3f['query']);_0xe2dd71[_0xdb4f('0x36')]=_[_0xdb4f('0x35')](_0x362e3f[_0xdb4f('0x32')],qs[_0xdb4f('0x37')](_0xba366b[_0xdb4f('0x33')][_0xdb4f('0x37')]));_0xe2dd71[_0xdb4f('0x36')]=_0xe2dd71[_0xdb4f('0x36')][_0xdb4f('0x38')]?_0xe2dd71[_0xdb4f('0x36')]:_0x362e3f['model'];if(!_0xba366b[_0xdb4f('0x33')][_0xdb4f('0x39')](_0xdb4f('0x3a'))){_0xe2dd71[_0xdb4f('0x1f')]=qs['limit'](_0xba366b[_0xdb4f('0x33')]['limit']);_0xe2dd71[_0xdb4f('0x1d')]=qs[_0xdb4f('0x1d')](_0xba366b[_0xdb4f('0x33')]['offset']);}_0xe2dd71[_0xdb4f('0x3b')]=qs[_0xdb4f('0x3c')](_0xba366b['query'][_0xdb4f('0x3c')]);_0xe2dd71[_0xdb4f('0x3d')]=qs['filters'](_['pick'](_0xba366b['query'],_0x362e3f[_0xdb4f('0x3e')]),_0x5360db);if(_0xba366b[_0xdb4f('0x33')][_0xdb4f('0x3f')]){_0xe2dd71[_0xdb4f('0x3d')]=_[_0xdb4f('0x40')](_0xe2dd71[_0xdb4f('0x3d')],{'$or':_[_0xdb4f('0x2f')](_0x5360db,function(_0x58e7d2){if(_0x58e7d2['type']!=='VIRTUAL'){var _0x404cee={};_0x404cee[_0x58e7d2[_0xdb4f('0x2c')]]={'$like':'%'+_0xba366b[_0xdb4f('0x33')][_0xdb4f('0x3f')]+'%'};return _0x404cee;}})});}_0xe2dd71=_[_0xdb4f('0x40')]({},_0xe2dd71,_0xba366b[_0xdb4f('0x41')]);var _0x1e60f2={'where':_0xe2dd71[_0xdb4f('0x3d')]};return db[_0xdb4f('0x42')][_0xdb4f('0x20')](_0x1e60f2)[_0xdb4f('0x27')](function(_0x497443){_0x374b9e[_0xdb4f('0x20')]=_0x497443;if(_0xba366b[_0xdb4f('0x33')][_0xdb4f('0x43')]){_0xe2dd71[_0xdb4f('0x44')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0xe2dd71);})[_0xdb4f('0x27')](function(_0x192951){_0x374b9e[_0xdb4f('0x45')]=_0x192951;return _0x374b9e;})['then'](respondWithFilteredResult(_0x1950d5,_0xe2dd71))[_0xdb4f('0x46')](handleError(_0x1950d5,null));};exports[_0xdb4f('0x47')]=function(_0x3450de,_0xe6b596){var _0x3910f9={'raw':![],'where':{'id':_0x3450de[_0xdb4f('0x48')]['id']}},_0x41c13b={};_0x41c13b[_0xdb4f('0x32')]=_[_0xdb4f('0x34')](db[_0xdb4f('0x42')]['rawAttributes']);_0x41c13b[_0xdb4f('0x33')]=_['keys'](_0x3450de[_0xdb4f('0x33')]);_0x41c13b[_0xdb4f('0x3e')]=_[_0xdb4f('0x35')](_0x41c13b[_0xdb4f('0x32')],_0x41c13b[_0xdb4f('0x33')]);_0x3910f9[_0xdb4f('0x36')]=_[_0xdb4f('0x35')](_0x41c13b[_0xdb4f('0x32')],qs[_0xdb4f('0x37')](_0x3450de[_0xdb4f('0x33')]['fields']));_0x3910f9['attributes']=_0x3910f9[_0xdb4f('0x36')][_0xdb4f('0x38')]?_0x3910f9[_0xdb4f('0x36')]:_0x41c13b['model'];if(_0x3450de['query']['includeAll']){_0x3910f9[_0xdb4f('0x44')]=[{'all':!![]}];}_0x3910f9=_['merge']({},_0x3910f9,_0x3450de[_0xdb4f('0x41')]);return db['Schedule']['find'](_0x3910f9)[_0xdb4f('0x27')](handleEntityNotFound(_0xe6b596,null))[_0xdb4f('0x27')](respondWithResult(_0xe6b596,null))[_0xdb4f('0x46')](handleError(_0xe6b596,null));};exports[_0xdb4f('0x49')]=function(_0x3240bb,_0x497dfc){return db['Schedule'][_0xdb4f('0x49')](_0x3240bb['body'],{})[_0xdb4f('0x27')](function(_0x192deb){var _0x347461=_0x3240bb[_0xdb4f('0x4a')][_0xdb4f('0x4b')]({'plain':!![]});if(!_0x347461)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347461[_0xdb4f('0x4c')]===_0xdb4f('0x4a')){var _0x50b210=_0x192deb[_0xdb4f('0x4b')]({'plain':!![]});var _0x156694=_0xdb4f('0x28');return db[_0xdb4f('0x4d')][_0xdb4f('0x4e')]({'where':{'name':_0x156694,'userProfileId':_0x347461['userProfileId']},'raw':!![]})[_0xdb4f('0x27')](function(_0x43c7ad){if(_0x43c7ad&&_0x43c7ad[_0xdb4f('0x4f')]===0x0){return db[_0xdb4f('0x29')][_0xdb4f('0x49')]({'name':_0x50b210[_0xdb4f('0x2c')],'resourceId':_0x50b210['id'],'type':_0x43c7ad['name'],'sectionId':_0x43c7ad['id']},{})[_0xdb4f('0x27')](function(){return _0x192deb;});}else{return _0x192deb;}})[_0xdb4f('0x46')](function(_0x44819c){logger[_0xdb4f('0x50')](_0xdb4f('0x51'),_0x44819c);throw _0x44819c;});}return _0x192deb;})['then'](respondWithResult(_0x497dfc,0xc9))[_0xdb4f('0x46')](handleError(_0x497dfc,null));};exports[_0xdb4f('0x26')]=function(_0x45800a,_0x24fa9d){if(_0x45800a['body']['id']){delete _0x45800a[_0xdb4f('0x52')]['id'];}return db['Schedule']['find']({'where':{'id':_0x45800a[_0xdb4f('0x48')]['id']}})[_0xdb4f('0x27')](handleEntityNotFound(_0x24fa9d,null))['then'](saveUpdates(_0x45800a[_0xdb4f('0x52')],null))[_0xdb4f('0x27')](respondWithResult(_0x24fa9d,null))[_0xdb4f('0x46')](handleError(_0x24fa9d,null));};exports[_0xdb4f('0x2a')]=function(_0x27f8fd,_0x3225b0){return db['Schedule'][_0xdb4f('0x4e')]({'where':{'id':_0x27f8fd['params']['id']}})['then'](handleEntityNotFound(_0x3225b0,null))['then'](removeEntity(_0x3225b0,null))[_0xdb4f('0x46')](handleError(_0x3225b0,null));};exports['run']=function(_0x1d550c,_0x520d85,_0x3a337b){var _0x37d0bd=require('../../config/schedule');return db[_0xdb4f('0x42')][_0xdb4f('0x4e')]({'where':{'id':_0x1d550c[_0xdb4f('0x48')]['id']},'raw':!![]})[_0xdb4f('0x27')](handleEntityNotFound(_0x520d85,null))['then'](function(){_0x37d0bd[_0xdb4f('0x53')](_0x1d550c[_0xdb4f('0x48')]['id']);})[_0xdb4f('0x27')](respondWithStatusCode(_0x520d85,null))[_0xdb4f('0x46')](handleError(_0x520d85,null));}; \ No newline at end of file +var _0xec82=['then','destroy','get','Scheduler','UserProfileResource','stack','name','send','index','map','Schedule','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update'];(function(_0x2565a4,_0x5d6a87){var _0x5e87f4=function(_0x5222ae){while(--_0x5222ae){_0x2565a4['push'](_0x2565a4['shift']());}};_0x5e87f4(++_0x5d6a87);}(_0xec82,0x1c5));var _0x2ec8=function(_0x3f548b,_0x3a4e6a){_0x3f548b=_0x3f548b-0x0;var _0x14a406=_0xec82[_0x3f548b];return _0x14a406;};'use strict';var emlformat=require(_0x2ec8('0x0'));var rimraf=require(_0x2ec8('0x1'));var zipdir=require(_0x2ec8('0x2'));var jsonpatch=require(_0x2ec8('0x3'));var rp=require(_0x2ec8('0x4'));var moment=require(_0x2ec8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2ec8('0x6'));var util=require(_0x2ec8('0x7'));var path=require(_0x2ec8('0x8'));var sox=require('sox');var csv=require(_0x2ec8('0x9'));var ejs=require(_0x2ec8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ec8('0xb'));var crypto=require(_0x2ec8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2ec8('0xd'));var Papa=require(_0x2ec8('0xe'));var Redis=require(_0x2ec8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2ec8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ec8('0x11'))(_0x2ec8('0x12'));var utils=require('../../config/utils');var config=require(_0x2ec8('0x13'));var licenseUtil=require(_0x2ec8('0x14'));var db=require(_0x2ec8('0x15'))['db'];function respondWithStatusCode(_0x9ecc6,_0x3afddf){_0x3afddf=_0x3afddf||0xcc;return function(_0x2501ca){if(_0x2501ca){return _0x9ecc6[_0x2ec8('0x16')](_0x3afddf);}return _0x9ecc6[_0x2ec8('0x17')](_0x3afddf)[_0x2ec8('0x18')]();};}function respondWithResult(_0x1f04c8,_0x4371fd){_0x4371fd=_0x4371fd||0xc8;return function(_0xe3e413){if(_0xe3e413){return _0x1f04c8[_0x2ec8('0x17')](_0x4371fd)[_0x2ec8('0x19')](_0xe3e413);}};}function respondWithFilteredResult(_0x4850cc,_0x48150a){return function(_0x542f5b){if(_0x542f5b){var _0x44daca=typeof _0x48150a[_0x2ec8('0x1a')]===_0x2ec8('0x1b')&&typeof _0x48150a['limit']===_0x2ec8('0x1b');var _0x3f09f4=_0x542f5b[_0x2ec8('0x1c')];var _0x406e42=_0x44daca?0x0:_0x48150a[_0x2ec8('0x1a')];var _0x2bc4ec=_0x44daca?_0x542f5b['count']:_0x48150a['offset']+_0x48150a['limit'];var _0x34067b;if(_0x2bc4ec>=_0x3f09f4){_0x2bc4ec=_0x3f09f4;_0x34067b=0xc8;}else{_0x34067b=0xce;}_0x4850cc[_0x2ec8('0x17')](_0x34067b);return _0x4850cc['set'](_0x2ec8('0x1d'),_0x406e42+'-'+_0x2bc4ec+'/'+_0x3f09f4)['json'](_0x542f5b);}return null;};}function patchUpdates(_0x44114d){return function(_0x46f7ad){try{jsonpatch[_0x2ec8('0x1e')](_0x46f7ad,_0x44114d,!![]);}catch(_0x2fea6d){return BPromise['reject'](_0x2fea6d);}return _0x46f7ad[_0x2ec8('0x1f')]();};}function saveUpdates(_0x52f7dc,_0x4d7b66){return function(_0x4c29ca){if(_0x4c29ca){return _0x4c29ca[_0x2ec8('0x20')](_0x52f7dc)[_0x2ec8('0x21')](function(_0x21a0d7){return _0x21a0d7;});}return null;};}function removeEntity(_0x3a8e25,_0x21f311){return function(_0x23be47){if(_0x23be47){return _0x23be47[_0x2ec8('0x22')]()[_0x2ec8('0x21')](function(){var _0x311b12=_0x23be47[_0x2ec8('0x23')]({'plain':!![]});var _0x4e9e17=_0x2ec8('0x24');return db[_0x2ec8('0x25')][_0x2ec8('0x22')]({'where':{'type':_0x4e9e17,'resourceId':_0x311b12['id']}})[_0x2ec8('0x21')](function(){return _0x23be47;});})['then'](function(){_0x3a8e25[_0x2ec8('0x17')](0xcc)[_0x2ec8('0x18')]();});}};}function handleEntityNotFound(_0x30a027,_0x579a01){return function(_0x3b1e0a){if(!_0x3b1e0a){_0x30a027[_0x2ec8('0x16')](0x194);}return _0x3b1e0a;};}function handleError(_0x1232b4,_0x3b028f){_0x3b028f=_0x3b028f||0x1f4;return function(_0x834114){logger['error'](_0x834114[_0x2ec8('0x26')]);if(_0x834114[_0x2ec8('0x27')]){delete _0x834114[_0x2ec8('0x27')];}_0x1232b4[_0x2ec8('0x17')](_0x3b028f)[_0x2ec8('0x28')](_0x834114);};}exports[_0x2ec8('0x29')]=function(_0x44f3b7,_0x5421e4){var _0x439432={},_0x56697a={},_0x183358={'count':0x0,'rows':[]};var _0x1fd003=_[_0x2ec8('0x2a')](db[_0x2ec8('0x2b')]['rawAttributes'],function(_0x3c6622){return{'name':_0x3c6622[_0x2ec8('0x2c')],'type':_0x3c6622[_0x2ec8('0x2d')][_0x2ec8('0x2e')]};});_0x56697a[_0x2ec8('0x2f')]=_[_0x2ec8('0x2a')](_0x1fd003,_0x2ec8('0x27'));_0x56697a[_0x2ec8('0x30')]=_['keys'](_0x44f3b7[_0x2ec8('0x30')]);_0x56697a[_0x2ec8('0x31')]=_[_0x2ec8('0x32')](_0x56697a[_0x2ec8('0x2f')],_0x56697a['query']);_0x439432[_0x2ec8('0x33')]=_[_0x2ec8('0x32')](_0x56697a[_0x2ec8('0x2f')],qs[_0x2ec8('0x34')](_0x44f3b7[_0x2ec8('0x30')]['fields']));_0x439432['attributes']=_0x439432[_0x2ec8('0x33')][_0x2ec8('0x35')]?_0x439432['attributes']:_0x56697a['model'];if(!_0x44f3b7[_0x2ec8('0x30')][_0x2ec8('0x36')](_0x2ec8('0x37'))){_0x439432[_0x2ec8('0x38')]=qs[_0x2ec8('0x38')](_0x44f3b7[_0x2ec8('0x30')][_0x2ec8('0x38')]);_0x439432[_0x2ec8('0x1a')]=qs[_0x2ec8('0x1a')](_0x44f3b7[_0x2ec8('0x30')]['offset']);}_0x439432['order']=qs[_0x2ec8('0x39')](_0x44f3b7[_0x2ec8('0x30')][_0x2ec8('0x39')]);_0x439432[_0x2ec8('0x3a')]=qs['filters'](_[_0x2ec8('0x3b')](_0x44f3b7[_0x2ec8('0x30')],_0x56697a[_0x2ec8('0x31')]),_0x1fd003);if(_0x44f3b7[_0x2ec8('0x30')]['filter']){_0x439432[_0x2ec8('0x3a')]=_[_0x2ec8('0x3c')](_0x439432[_0x2ec8('0x3a')],{'$or':_['map'](_0x1fd003,function(_0x3ee127){if(_0x3ee127['type']!==_0x2ec8('0x3d')){var _0x3feed3={};_0x3feed3[_0x3ee127[_0x2ec8('0x27')]]={'$like':'%'+_0x44f3b7[_0x2ec8('0x30')]['filter']+'%'};return _0x3feed3;}})});}_0x439432=_[_0x2ec8('0x3c')]({},_0x439432,_0x44f3b7['options']);var _0x81ffb4={'where':_0x439432[_0x2ec8('0x3a')]};return db[_0x2ec8('0x2b')][_0x2ec8('0x1c')](_0x81ffb4)[_0x2ec8('0x21')](function(_0x1e806a){_0x183358[_0x2ec8('0x1c')]=_0x1e806a;if(_0x44f3b7[_0x2ec8('0x30')][_0x2ec8('0x3e')]){_0x439432[_0x2ec8('0x3f')]=[{'all':!![]}];}return db[_0x2ec8('0x2b')][_0x2ec8('0x40')](_0x439432);})[_0x2ec8('0x21')](function(_0x34ffb6){_0x183358['rows']=_0x34ffb6;return _0x183358;})[_0x2ec8('0x21')](respondWithFilteredResult(_0x5421e4,_0x439432))[_0x2ec8('0x41')](handleError(_0x5421e4,null));};exports[_0x2ec8('0x42')]=function(_0x25efa4,_0x358f03){var _0x390877={'raw':![],'where':{'id':_0x25efa4[_0x2ec8('0x43')]['id']}},_0x409d01={};_0x409d01['model']=_['keys'](db['Schedule'][_0x2ec8('0x44')]);_0x409d01[_0x2ec8('0x30')]=_[_0x2ec8('0x45')](_0x25efa4[_0x2ec8('0x30')]);_0x409d01[_0x2ec8('0x31')]=_[_0x2ec8('0x32')](_0x409d01[_0x2ec8('0x2f')],_0x409d01[_0x2ec8('0x30')]);_0x390877[_0x2ec8('0x33')]=_['intersection'](_0x409d01[_0x2ec8('0x2f')],qs[_0x2ec8('0x34')](_0x25efa4[_0x2ec8('0x30')][_0x2ec8('0x34')]));_0x390877[_0x2ec8('0x33')]=_0x390877['attributes'][_0x2ec8('0x35')]?_0x390877[_0x2ec8('0x33')]:_0x409d01[_0x2ec8('0x2f')];if(_0x25efa4[_0x2ec8('0x30')][_0x2ec8('0x3e')]){_0x390877[_0x2ec8('0x3f')]=[{'all':!![]}];}_0x390877=_[_0x2ec8('0x3c')]({},_0x390877,_0x25efa4[_0x2ec8('0x46')]);return db['Schedule']['find'](_0x390877)['then'](handleEntityNotFound(_0x358f03,null))[_0x2ec8('0x21')](respondWithResult(_0x358f03,null))[_0x2ec8('0x41')](handleError(_0x358f03,null));};exports[_0x2ec8('0x47')]=function(_0x25ef96,_0x1d20f8){return db[_0x2ec8('0x2b')][_0x2ec8('0x47')](_0x25ef96[_0x2ec8('0x48')],{})[_0x2ec8('0x21')](function(_0x33fa81){var _0x93df2f=_0x25ef96[_0x2ec8('0x49')][_0x2ec8('0x23')]({'plain':!![]});if(!_0x93df2f)throw new Error(_0x2ec8('0x4a'));if(_0x93df2f[_0x2ec8('0x4b')]===_0x2ec8('0x49')){var _0x1b5964=_0x33fa81[_0x2ec8('0x23')]({'plain':!![]});var _0x3dca43='Scheduler';return db['UserProfileSection'][_0x2ec8('0x4c')]({'where':{'name':_0x3dca43,'userProfileId':_0x93df2f['userProfileId']},'raw':!![]})[_0x2ec8('0x21')](function(_0x442728){if(_0x442728&&_0x442728[_0x2ec8('0x4d')]===0x0){return db['UserProfileResource'][_0x2ec8('0x47')]({'name':_0x1b5964[_0x2ec8('0x27')],'resourceId':_0x1b5964['id'],'type':_0x442728['name'],'sectionId':_0x442728['id']},{})['then'](function(){return _0x33fa81;});}else{return _0x33fa81;}})['catch'](function(_0x2c88aa){logger['error'](_0x2ec8('0x4e'),_0x2c88aa);throw _0x2c88aa;});}return _0x33fa81;})[_0x2ec8('0x21')](respondWithResult(_0x1d20f8,0xc9))['catch'](handleError(_0x1d20f8,null));};exports[_0x2ec8('0x20')]=function(_0x25622b,_0x4b715){if(_0x25622b[_0x2ec8('0x48')]['id']){delete _0x25622b[_0x2ec8('0x48')]['id'];}return db[_0x2ec8('0x2b')]['find']({'where':{'id':_0x25622b['params']['id']}})['then'](handleEntityNotFound(_0x4b715,null))[_0x2ec8('0x21')](saveUpdates(_0x25622b[_0x2ec8('0x48')],null))['then'](respondWithResult(_0x4b715,null))[_0x2ec8('0x41')](handleError(_0x4b715,null));};exports['destroy']=function(_0x5116f1,_0x48335a){return db['Schedule'][_0x2ec8('0x4c')]({'where':{'id':_0x5116f1[_0x2ec8('0x43')]['id']}})[_0x2ec8('0x21')](handleEntityNotFound(_0x48335a,null))[_0x2ec8('0x21')](removeEntity(_0x48335a,null))['catch'](handleError(_0x48335a,null));};exports[_0x2ec8('0x4f')]=function(_0x19857b,_0x29f8ac,_0x56c1fe){var _0x4ac0a1=require(_0x2ec8('0x50'));return db[_0x2ec8('0x2b')][_0x2ec8('0x4c')]({'where':{'id':_0x19857b[_0x2ec8('0x43')]['id']},'raw':!![]})[_0x2ec8('0x21')](handleEntityNotFound(_0x29f8ac,null))[_0x2ec8('0x21')](function(){_0x4ac0a1['run'](_0x19857b['params']['id']);})[_0x2ec8('0x21')](respondWithStatusCode(_0x29f8ac,null))[_0x2ec8('0x41')](handleError(_0x29f8ac,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 1c02af0..1825e86 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 _0x7ea5=['api','bluebird','request-promise','path','rimraf','../../config/environment','Schedule','util','../../config/logger'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7ea5,0x1ed));var _0x57ea=function(_0x6842c7,_0x1950c1){_0x6842c7=_0x6842c7-0x0;var _0x526c0a=_0x7ea5[_0x6842c7];return _0x526c0a;};'use strict';var _=require('lodash');var util=require(_0x57ea('0x0'));var logger=require(_0x57ea('0x1'))(_0x57ea('0x2'));var moment=require('moment');var BPromise=require(_0x57ea('0x3'));var rp=require(_0x57ea('0x4'));var fs=require('fs');var path=require(_0x57ea('0x5'));var rimraf=require(_0x57ea('0x6'));var config=require(_0x57ea('0x7'));var attributes=require('./schedule.attributes');module['exports']=function(_0x491dde,_0x333046){return _0x491dde['define'](_0x57ea('0x8'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd330=['request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xd330,0x126));var _0x0d33=function(_0x43af25,_0x3f96b4){_0x43af25=_0x43af25-0x0;var _0x19f036=_0xd330[_0x43af25];return _0x19f036;};'use strict';var _=require(_0x0d33('0x0'));var util=require(_0x0d33('0x1'));var logger=require(_0x0d33('0x2'))('api');var moment=require(_0x0d33('0x3'));var BPromise=require(_0x0d33('0x4'));var rp=require(_0x0d33('0x5'));var fs=require('fs');var path=require(_0x0d33('0x6'));var rimraf=require(_0x0d33('0x7'));var config=require('../../config/environment');var attributes=require(_0x0d33('0x8'));module[_0x0d33('0x9')]=function(_0x13a497,_0x3f0529){return _0x13a497[_0x0d33('0xa')](_0x0d33('0xb'),attributes,{'tableName':_0x0d33('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index a64243a..61f22ac 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 _0xd34f=['request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0xe1441d,_0x36fb8e){var _0x2ef242=function(_0x52bf2d){while(--_0x52bf2d){_0xe1441d['push'](_0xe1441d['shift']());}};_0x2ef242(++_0x36fb8e);}(_0xd34f,0x175));var _0xfd34=function(_0x222369,_0x55f317){_0x222369=_0x222369-0x0;var _0x2d50b1=_0xd34f[_0x222369];return _0x2d50b1;};'use strict';var _=require(_0xfd34('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfd34('0x1'));var rs=require(_0xfd34('0x2'));var fs=require('fs');var Redis=require(_0xfd34('0x3'));var db=require(_0xfd34('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd34('0x5'))('rpc');var config=require(_0xfd34('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26d62d,_0x8185e1,_0x4bdd84){return new BPromise(function(_0x45ea17,_0x4806f9){return client[_0xfd34('0x7')](_0x26d62d,_0x4bdd84)[_0xfd34('0x8')](function(_0x446a2f){logger[_0xfd34('0x9')](_0xfd34('0xa'),_0x8185e1,'request\x20sent');logger[_0xfd34('0xb')](_0xfd34('0xc'),_0x8185e1,_0xfd34('0xd'),JSON[_0xfd34('0xe')](_0x446a2f));if(_0x446a2f[_0xfd34('0xf')]){if(_0x446a2f['error'][_0xfd34('0x10')]===0x1f4){logger['error'](_0xfd34('0xa'),_0x8185e1,_0x446a2f[_0xfd34('0xf')]['message']);return _0x4806f9(_0x446a2f[_0xfd34('0xf')][_0xfd34('0x11')]);}logger[_0xfd34('0xf')]('Schedule,\x20%s,\x20%s',_0x8185e1,_0x446a2f[_0xfd34('0xf')]['message']);return _0x45ea17(_0x446a2f['error'][_0xfd34('0x11')]);}else{logger[_0xfd34('0x9')](_0xfd34('0xa'),_0x8185e1,_0xfd34('0xd'));_0x45ea17(_0x446a2f[_0xfd34('0x12')][_0xfd34('0x11')]);}})[_0xfd34('0x13')](function(_0x1f4785){logger['error'](_0xfd34('0xa'),_0x8185e1,_0x1f4785);_0x4806f9(_0x1f4785);});});} \ No newline at end of file +var _0x3cfb=['debug','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s'];(function(_0xc298fe,_0x53be01){var _0x2096d3=function(_0x27d6b6){while(--_0x27d6b6){_0xc298fe['push'](_0xc298fe['shift']());}};_0x2096d3(++_0x53be01);}(_0x3cfb,0xcb));var _0xb3cf=function(_0x54fa48,_0x57d384){_0x54fa48=_0x54fa48-0x0;var _0x48de69=_0x3cfb[_0x54fa48];return _0x48de69;};'use strict';var _=require(_0xb3cf('0x0'));var util=require(_0xb3cf('0x1'));var moment=require(_0xb3cf('0x2'));var BPromise=require(_0xb3cf('0x3'));var rs=require(_0xb3cf('0x4'));var fs=require('fs');var Redis=require(_0xb3cf('0x5'));var db=require(_0xb3cf('0x6'))['db'];var utils=require(_0xb3cf('0x7'));var logger=require(_0xb3cf('0x8'))(_0xb3cf('0x9'));var config=require(_0xb3cf('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb3cf('0xb')][_0xb3cf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x80cb5f,_0x47e7a5,_0xbf5a67){return new BPromise(function(_0x3ca290,_0x11b3e3){return client[_0xb3cf('0xd')](_0x80cb5f,_0xbf5a67)[_0xb3cf('0xe')](function(_0x4f0167){logger[_0xb3cf('0xf')](_0xb3cf('0x10'),_0x47e7a5,'request\x20sent');logger[_0xb3cf('0x11')]('Schedule,\x20%s,\x20%s,\x20%s',_0x47e7a5,_0xb3cf('0x12'),JSON[_0xb3cf('0x13')](_0x4f0167));if(_0x4f0167[_0xb3cf('0x14')]){if(_0x4f0167[_0xb3cf('0x14')]['code']===0x1f4){logger[_0xb3cf('0x14')](_0xb3cf('0x10'),_0x47e7a5,_0x4f0167[_0xb3cf('0x14')][_0xb3cf('0x15')]);return _0x11b3e3(_0x4f0167[_0xb3cf('0x14')][_0xb3cf('0x15')]);}logger[_0xb3cf('0x14')]('Schedule,\x20%s,\x20%s',_0x47e7a5,_0x4f0167['error']['message']);return _0x3ca290(_0x4f0167[_0xb3cf('0x14')][_0xb3cf('0x15')]);}else{logger['info'](_0xb3cf('0x10'),_0x47e7a5,_0xb3cf('0x12'));_0x3ca290(_0x4f0167['result'][_0xb3cf('0x15')]);}})['catch'](function(_0x462708){logger[_0xb3cf('0x14')](_0xb3cf('0x10'),_0x47e7a5,_0x462708);_0x11b3e3(_0x462708);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index d518471..c063233 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 _0x1a4c=['download','post','create','update','destroy','exports','util','path','connect-timeout','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download'];(function(_0x48131d,_0x1dd4c6){var _0x2c13cd=function(_0x153744){while(--_0x153744){_0x48131d['push'](_0x48131d['shift']());}};_0x2c13cd(++_0x1dd4c6);}(_0x1a4c,0x72));var _0xc1a4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1a4c[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0xc1a4('0x0'));var path=require(_0xc1a4('0x1'));var timeout=require(_0xc1a4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc1a4('0x3'));var controller=require(_0xc1a4('0x4'));router[_0xc1a4('0x5')]('/',auth[_0xc1a4('0x6')](),controller['index']);router[_0xc1a4('0x5')](_0xc1a4('0x7'),auth['isAuthenticated'](),controller[_0xc1a4('0x8')]);router[_0xc1a4('0x5')](_0xc1a4('0x9'),auth['isAuthenticated'](),controller[_0xc1a4('0xa')]);router[_0xc1a4('0x5')](_0xc1a4('0xb'),auth[_0xc1a4('0x6')](),controller[_0xc1a4('0xc')]);router[_0xc1a4('0xd')]('/',auth[_0xc1a4('0x6')](),controller[_0xc1a4('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc1a4('0xf')]);router['delete'](_0xc1a4('0x9'),auth['isAuthenticated'](),controller[_0xc1a4('0x10')]);module[_0xc1a4('0x11')]=router; \ No newline at end of file +var _0x6ea9=['create','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','/:id','download'];(function(_0x3479fb,_0x55137f){var _0x3e8d4f=function(_0xfa755f){while(--_0xfa755f){_0x3479fb['push'](_0x3479fb['shift']());}};_0x3e8d4f(++_0x55137f);}(_0x6ea9,0x19b));var _0x96ea=function(_0x3278ad,_0x43897c){_0x3278ad=_0x3278ad-0x0;var _0xad3517=_0x6ea9[_0x3278ad];return _0xad3517;};'use strict';var multer=require(_0x96ea('0x0'));var util=require(_0x96ea('0x1'));var path=require('path');var timeout=require(_0x96ea('0x2'));var express=require(_0x96ea('0x3'));var router=express[_0x96ea('0x4')]();var fs_extra=require(_0x96ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x96ea('0x6'));var config=require(_0x96ea('0x7'));var controller=require(_0x96ea('0x8'));router[_0x96ea('0x9')]('/',auth[_0x96ea('0xa')](),controller['index']);router[_0x96ea('0x9')](_0x96ea('0xb'),auth[_0x96ea('0xa')](),controller['describe']);router[_0x96ea('0x9')](_0x96ea('0xc'),auth[_0x96ea('0xa')](),controller['show']);router[_0x96ea('0x9')]('/:id/download',auth[_0x96ea('0xa')](),controller[_0x96ea('0xd')]);router['post']('/',auth[_0x96ea('0xa')](),controller[_0x96ea('0xe')]);router['put'](_0x96ea('0xc'),auth[_0x96ea('0xa')](),controller['update']);router['delete'](_0x96ea('0xc'),auth[_0x96ea('0xa')](),controller[_0x96ea('0xf')]);module[_0x96ea('0x10')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 8316be9..d1cee5f 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 _0x0a93=['DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','duration'];(function(_0x39fd7d,_0x34447d){var _0x5293f9=function(_0x3efa2c){while(--_0x3efa2c){_0x39fd7d['push'](_0x39fd7d['shift']());}};_0x5293f9(++_0x34447d);}(_0x0a93,0x6a));var _0x30a9=function(_0x1b3c2f,_0x1c7357){_0x1b3c2f=_0x1b3c2f-0x0;var _0x4eae1d=_0x0a93[_0x1b3c2f];return _0x4eae1d;};'use strict';var Sequelize=require(_0x30a9('0x0'));var moment=require(_0x30a9('0x1'));var path=require(_0x30a9('0x2'));var config=require('../../config/environment');module[_0x30a9('0x3')]={'format':{'type':Sequelize[_0x30a9('0x4')],'get':function(){return this[_0x30a9('0x5')](_0x30a9('0x6'))?path['extname'](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x30a9('0x7')],'set':function(_0x1c46fb){var _0x5ae289=_0x1c46fb['replace'](/\\/g,'/');this[_0x30a9('0x8')](_0x30a9('0x6'),_0x5ae289);}},'rating':{'type':Sequelize[_0x30a9('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x146fae){this[_0x30a9('0x8')](_0x30a9('0xa'),moment()[_0x30a9('0xb')](_0x146fae,'ms'));this[_0x30a9('0x8')](_0x30a9('0xc'),moment());this[_0x30a9('0x8')](_0x30a9('0xd'),_0x146fae);}},'startedAt':{'type':Sequelize[_0x30a9('0xe')],'get':function(){return moment(this['getDataValue'](_0x30a9('0xa')))[_0x30a9('0xf')](_0x30a9('0x10'))[_0x30a9('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x30a9('0x5')]('closedAt'))[_0x30a9('0xf')](_0x30a9('0x10'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x30a9('0x5')](_0x30a9('0x12')))['format'](_0x30a9('0x10'))[_0x30a9('0x11')]();}},'updatedAt':{'type':Sequelize[_0x30a9('0xe')],'get':function(){return moment(this[_0x30a9('0x5')](_0x30a9('0x13')))[_0x30a9('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x30a9('0x11')]();}}}; \ No newline at end of file +var _0x5ea2=['updatedAt','sequelize','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x5ea2,0x99));var _0x25ea=function(_0x7ff662,_0x4cbf0e){_0x7ff662=_0x7ff662-0x0;var _0x3a70aa=_0x5ea2[_0x7ff662];return _0x3a70aa;};'use strict';var Sequelize=require(_0x25ea('0x0'));var moment=require('moment');var path=require('path');var config=require(_0x25ea('0x1'));module[_0x25ea('0x2')]={'format':{'type':Sequelize[_0x25ea('0x3')],'get':function(){return this[_0x25ea('0x4')](_0x25ea('0x5'))?path['extname'](this[_0x25ea('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x25ea('0x6')]},'value':{'type':Sequelize[_0x25ea('0x6')],'set':function(_0x3ca48f){var _0x214ed8=_0x3ca48f[_0x25ea('0x7')](/\\/g,'/');this[_0x25ea('0x8')](_0x25ea('0x5'),_0x214ed8);}},'rating':{'type':Sequelize[_0x25ea('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x25ea('0x9')],'set':function(_0x52b281){this[_0x25ea('0x8')](_0x25ea('0xa'),moment()[_0x25ea('0xb')](_0x52b281,'ms'));this[_0x25ea('0x8')]('closedAt',moment());this[_0x25ea('0x8')](_0x25ea('0xc'),_0x52b281);}},'startedAt':{'type':Sequelize[_0x25ea('0xd')],'get':function(){return moment(this[_0x25ea('0x4')](_0x25ea('0xa')))[_0x25ea('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0x25ea('0xd')],'get':function(){return moment(this[_0x25ea('0x4')]('closedAt'))[_0x25ea('0xe')](_0x25ea('0xf'))[_0x25ea('0x10')]();}},'createdAt':{'type':Sequelize[_0x25ea('0xd')],'get':function(){return moment(this[_0x25ea('0x4')](_0x25ea('0x11')))['format'](_0x25ea('0xf'))[_0x25ea('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x25ea('0x4')](_0x25ea('0x12')))[_0x25ea('0xe')](_0x25ea('0xf'))[_0x25ea('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1307996..7593a38 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 _0x2d17=['apply','then','error','name','index','map','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','count','includeAll','include','findAll','catch','show','find','create','body','update','duration','closedAt','value','params','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','filename','download','extname','unlink','Not\x20found','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range'];(function(_0xf220a0,_0x27701c){var _0x24482f=function(_0x53e389){while(--_0x53e389){_0xf220a0['push'](_0xf220a0['shift']());}};_0x24482f(++_0x27701c);}(_0x2d17,0x17e));var _0x72d1=function(_0x231c14,_0x3adedf){_0x231c14=_0x231c14-0x0;var _0x1670b3=_0x2d17[_0x231c14];return _0x1670b3;};'use strict';var emlformat=require(_0x72d1('0x0'));var rimraf=require(_0x72d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72d1('0x2'));var rp=require(_0x72d1('0x3'));var moment=require('moment');var BPromise=require(_0x72d1('0x4'));var Mustache=require(_0x72d1('0x5'));var util=require('util');var path=require(_0x72d1('0x6'));var sox=require('sox');var csv=require(_0x72d1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72d1('0x8'));var _=require(_0x72d1('0x9'));var squel=require('squel');var crypto=require(_0x72d1('0xa'));var jsforce=require(_0x72d1('0xb'));var deskjs=require(_0x72d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x72d1('0xd'));var Papa=require(_0x72d1('0xe'));var Redis=require(_0x72d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x72d1('0x10'));var as=require(_0x72d1('0x11'));var hardwareService=require(_0x72d1('0x12'));var logger=require(_0x72d1('0x13'))(_0x72d1('0x14'));var utils=require(_0x72d1('0x15'));var config=require(_0x72d1('0x16'));var licenseUtil=require(_0x72d1('0x17'));var db=require(_0x72d1('0x18'))['db'];function respondWithStatusCode(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xcc;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0x19')](_0x5ad4df);}return _0x2f5a78[_0x72d1('0x1a')](_0x5ad4df)[_0x72d1('0x1b')]();};}function respondWithResult(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0xc8;return function(_0x143718){if(_0x143718){return _0x22ac6f[_0x72d1('0x1a')](_0x685a27)[_0x72d1('0x1c')](_0x143718);}};}function respondWithFilteredResult(_0x3f190f,_0x21c85e){return function(_0x23a238){if(_0x23a238){var _0x8d458=typeof _0x21c85e['offset']===_0x72d1('0x1d')&&typeof _0x21c85e['limit']===_0x72d1('0x1d');var _0x2c9851=_0x23a238['count'];var _0x1061b7=_0x8d458?0x0:_0x21c85e[_0x72d1('0x1e')];var _0x1ca18d=_0x8d458?_0x23a238['count']:_0x21c85e['offset']+_0x21c85e[_0x72d1('0x1f')];var _0x10d464;if(_0x1ca18d>=_0x2c9851){_0x1ca18d=_0x2c9851;_0x10d464=0xc8;}else{_0x10d464=0xce;}_0x3f190f[_0x72d1('0x1a')](_0x10d464);return _0x3f190f[_0x72d1('0x20')](_0x72d1('0x21'),_0x1061b7+'-'+_0x1ca18d+'/'+_0x2c9851)[_0x72d1('0x1c')](_0x23a238);}return null;};}function patchUpdates(_0x1e2411){return function(_0x5c7982){try{jsonpatch[_0x72d1('0x22')](_0x5c7982,_0x1e2411,!![]);}catch(_0x56e8d3){return BPromise['reject'](_0x56e8d3);}return _0x5c7982['save']();};}function saveUpdates(_0x585243,_0x445985){return function(_0x374602){if(_0x374602){return _0x374602['update'](_0x585243)[_0x72d1('0x23')](function(_0x256dc1){return _0x256dc1;});}return null;};}function removeEntity(_0x492086,_0x1431ee){return function(_0x26fa35){if(_0x26fa35){return _0x26fa35['destroy']()['then'](function(){_0x492086[_0x72d1('0x1a')](0xcc)[_0x72d1('0x1b')]();});}};}function handleEntityNotFound(_0x2f661,_0x2f879f){return function(_0xdf6a69){if(!_0xdf6a69){_0x2f661[_0x72d1('0x19')](0x194);}return _0xdf6a69;};}function handleError(_0x163bec,_0x589f7c){_0x589f7c=_0x589f7c||0x1f4;return function(_0x57ec9e){logger[_0x72d1('0x24')](_0x57ec9e['stack']);if(_0x57ec9e[_0x72d1('0x25')]){delete _0x57ec9e[_0x72d1('0x25')];}_0x163bec[_0x72d1('0x1a')](_0x589f7c)['send'](_0x57ec9e);};}exports[_0x72d1('0x26')]=function(_0x4c4c41,_0x707cd0){var _0x20055f={},_0x32588f={},_0x2cc0c8={'count':0x0,'rows':[]};var _0x51242b=_[_0x72d1('0x27')](db['ScreenRecording'][_0x72d1('0x28')],function(_0x32dc5e){return{'name':_0x32dc5e['fieldName'],'type':_0x32dc5e[_0x72d1('0x29')][_0x72d1('0x2a')]};});_0x32588f[_0x72d1('0x2b')]=_[_0x72d1('0x2c')](_[_0x72d1('0x27')](_0x51242b,'name'),[_0x72d1('0x2d')]);_0x32588f[_0x72d1('0x2e')]=_[_0x72d1('0x2f')](_0x4c4c41['query']);_0x32588f[_0x72d1('0x30')]=_[_0x72d1('0x31')](_0x32588f['model'],_0x32588f[_0x72d1('0x2e')]);_0x20055f[_0x72d1('0x32')]=_[_0x72d1('0x31')](_0x32588f['model'],qs[_0x72d1('0x33')](_0x4c4c41['query'][_0x72d1('0x33')]));_0x20055f[_0x72d1('0x32')]=_0x20055f[_0x72d1('0x32')][_0x72d1('0x34')]?_0x20055f[_0x72d1('0x32')]:_0x32588f[_0x72d1('0x2b')];if(!_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x35')](_0x72d1('0x36'))){_0x20055f[_0x72d1('0x1f')]=qs[_0x72d1('0x1f')](_0x4c4c41['query'][_0x72d1('0x1f')]);_0x20055f[_0x72d1('0x1e')]=qs[_0x72d1('0x1e')](_0x4c4c41[_0x72d1('0x2e')]['offset']);}_0x20055f[_0x72d1('0x37')]=qs[_0x72d1('0x38')](_0x4c4c41[_0x72d1('0x2e')]['sort']);_0x20055f[_0x72d1('0x39')]=qs[_0x72d1('0x30')](_[_0x72d1('0x3a')](_0x4c4c41['query'],_0x32588f[_0x72d1('0x30')]),_0x51242b);if(_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x3b')]){_0x20055f['where']=_[_0x72d1('0x3c')](_0x20055f[_0x72d1('0x39')],{'$or':_[_0x72d1('0x27')](_0x51242b,function(_0x14cb3d){if(_0x14cb3d[_0x72d1('0x29')]!==_0x72d1('0x3d')){var _0xd7ec0f={};_0xd7ec0f[_0x14cb3d['name']]={'$like':'%'+_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x3b')]+'%'};return _0xd7ec0f;}})});}_0x20055f=_[_0x72d1('0x3c')]({},_0x20055f,_0x4c4c41[_0x72d1('0x3e')]);var _0x20fb2f={'where':_0x20055f[_0x72d1('0x39')]};return db[_0x72d1('0x3f')][_0x72d1('0x40')](_0x20fb2f)['then'](function(_0x44d5b2){_0x2cc0c8[_0x72d1('0x40')]=_0x44d5b2;if(_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x41')]){_0x20055f[_0x72d1('0x42')]=[{'all':!![]}];}return db[_0x72d1('0x3f')][_0x72d1('0x43')](_0x20055f);})[_0x72d1('0x23')](function(_0x5620f0){_0x2cc0c8['rows']=_0x5620f0;return _0x2cc0c8;})[_0x72d1('0x23')](respondWithFilteredResult(_0x707cd0,_0x20055f))[_0x72d1('0x44')](handleError(_0x707cd0,null));};exports[_0x72d1('0x45')]=function(_0x21d361,_0x5a6bc4){var _0x3fe286={'raw':![],'where':{'id':_0x21d361['params']['id']}},_0x3e80e0={};_0x3e80e0[_0x72d1('0x2b')]=_['keys'](db[_0x72d1('0x3f')][_0x72d1('0x28')]);_0x3e80e0['query']=_[_0x72d1('0x2f')](_0x21d361['query']);_0x3e80e0['filters']=_['intersection'](_0x3e80e0[_0x72d1('0x2b')],_0x3e80e0['query']);_0x3fe286[_0x72d1('0x32')]=_[_0x72d1('0x31')](_0x3e80e0[_0x72d1('0x2b')],qs['fields'](_0x21d361['query'][_0x72d1('0x33')]));_0x3fe286['attributes']=_0x3fe286['attributes'][_0x72d1('0x34')]?_0x3fe286[_0x72d1('0x32')]:_0x3e80e0[_0x72d1('0x2b')];if(_0x21d361['query']['includeAll']){_0x3fe286['include']=[{'all':!![]}];}_0x3fe286=_['merge']({},_0x3fe286,_0x21d361[_0x72d1('0x3e')]);return db[_0x72d1('0x3f')][_0x72d1('0x46')](_0x3fe286)[_0x72d1('0x23')](handleEntityNotFound(_0x5a6bc4,null))[_0x72d1('0x23')](respondWithResult(_0x5a6bc4,null))[_0x72d1('0x44')](handleError(_0x5a6bc4,null));};exports[_0x72d1('0x47')]=function(_0x5924c,_0x1e2c11){return db['ScreenRecording'][_0x72d1('0x47')](_0x5924c[_0x72d1('0x48')],{})[_0x72d1('0x23')](respondWithResult(_0x1e2c11,0xc9))['catch'](handleError(_0x1e2c11,null));};exports[_0x72d1('0x49')]=function(_0x29c88f,_0x12ad75){if(_0x29c88f['body']['id']){delete _0x29c88f[_0x72d1('0x48')]['id'];}delete _0x29c88f[_0x72d1('0x48')][_0x72d1('0x4a')];delete _0x29c88f[_0x72d1('0x48')]['createdAt'];delete _0x29c88f['body'][_0x72d1('0x4b')];delete _0x29c88f[_0x72d1('0x48')][_0x72d1('0x4c')];return db['ScreenRecording'][_0x72d1('0x46')]({'where':{'id':_0x29c88f[_0x72d1('0x4d')]['id']}})[_0x72d1('0x23')](handleEntityNotFound(_0x12ad75,null))[_0x72d1('0x23')](saveUpdates(_0x29c88f[_0x72d1('0x48')],null))[_0x72d1('0x23')](respondWithResult(_0x12ad75,null))[_0x72d1('0x44')](handleError(_0x12ad75,null));};exports[_0x72d1('0x4e')]=function(_0x12870c,_0x18f986){return db[_0x72d1('0x3f')]['describe']()[_0x72d1('0x23')](respondWithResult(_0x18f986,null))['catch'](handleError(_0x18f986,null));};exports['download']=function(_0x356196,_0x5f2bba,_0x3c880e){var _0x7e401b=require(_0x72d1('0x4f'));var _0x162248=![];var _0x473a7b={};if(_0x356196[_0x72d1('0x2e')][_0x72d1('0x29')]&&_0x356196[_0x72d1('0x2e')][_0x72d1('0x29')]===_0x72d1('0x50')){_0x473a7b[_0x72d1('0x50')]=_0x356196['params']['id'];}else{_0x473a7b['id']=_0x356196[_0x72d1('0x4d')]['id'];}return db[_0x72d1('0x3f')][_0x72d1('0x46')]({'where':_0x473a7b,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5f2bba,null))[_0x72d1('0x23')](function(_0x140f0b){if(_0x140f0b){var _0x16e9e7=path[_0x72d1('0x51')](config[_0x72d1('0x52')],'server/files/screen_recordings',_0x140f0b[_0x72d1('0x4c')]);var _0x48f4a7=util[_0x72d1('0x2d')](_0x72d1('0x53'),_0x16e9e7);if(fs[_0x72d1('0x54')](_0x48f4a7)){_0x162248=!![];return _0x7e401b[_0x72d1('0x55')](_0x48f4a7,_0x16e9e7,config[_0x72d1('0x56')][_0x72d1('0x57')])[_0x72d1('0x23')](function(){return _0x140f0b;});}return _0x140f0b;}})[_0x72d1('0x23')](function(_0x384f0a){if(_0x384f0a){var _0x3a2dfe=path[_0x72d1('0x51')](config[_0x72d1('0x52')],_0x72d1('0x58'),_0x384f0a[_0x72d1('0x4c')]);if(!fs[_0x72d1('0x54')](_0x3a2dfe)){throw new db[(_0x72d1('0x59'))][(_0x72d1('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x384f0a[_0x72d1('0x5b')]){return _0x5f2bba[_0x72d1('0x5c')](_0x3a2dfe,_0x384f0a[_0x72d1('0x5b')]+path[_0x72d1('0x5d')](_0x3a2dfe),function(){if(_0x162248){fs[_0x72d1('0x5e')](_0x3a2dfe);}});}else{return _0x5f2bba[_0x72d1('0x5c')](_0x3a2dfe,function(_0x4e2d85){if(_0x162248){fs[_0x72d1('0x5e')](_0x3a2dfe);}});}}})[_0x72d1('0x44')](function(_0xb05cd9){if(_0xb05cd9['message']==='ScreenRecording\x20not\x20found'){_0x5f2bba[_0x72d1('0x1a')](0x194)['send'](_0x72d1('0x5f'));}else{return handleError(_0x5f2bba,null);}});};exports[_0x72d1('0x60')]=function(_0x201810,_0x41525c){return db[_0x72d1('0x3f')][_0x72d1('0x46')]({'where':{'id':_0x201810[_0x72d1('0x4d')]['id']}})[_0x72d1('0x23')](function(_0x28e42b){if(_['isNil'](_0x28e42b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x28e42b;})[_0x72d1('0x23')](function(_0x1d44f0){var _0x1bd80b=path['join'](config[_0x72d1('0x52')],_0x72d1('0x58'),_0x1d44f0['value']);logger[_0x72d1('0x61')](_0x72d1('0x62'),_0x1bd80b);if(!_[_0x72d1('0x63')](_0x1d44f0[_0x72d1('0x4c')])&&fs[_0x72d1('0x54')](_0x1bd80b)){logger[_0x72d1('0x61')](_0x72d1('0x64')+_0x1bd80b+_0x72d1('0x65'));fs[_0x72d1('0x66')](_0x1bd80b);}_0x1bd80b=_0x1bd80b+_0x72d1('0x67');if(!_[_0x72d1('0x63')](_0x1d44f0[_0x72d1('0x4c')])&&fs['existsSync'](_0x1bd80b)){logger['info'](_0x72d1('0x64')+_0x1bd80b+_0x72d1('0x65'));fs[_0x72d1('0x66')](_0x1bd80b);}return _0x1d44f0;})[_0x72d1('0x23')](function(_0x2ae8c9){if(!_0x2ae8c9)throw new InternalError();return _0x2ae8c9[_0x72d1('0x60')]();})[_0x72d1('0x23')](function(){_0x41525c[_0x72d1('0x1a')](0xcc)['end']();})[_0x72d1('0x44')](handleError(_0x41525c,null));}; \ No newline at end of file +var _0x5c12=['undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','filter','include','rows','catch','keys','includeAll','options','find','create','body','createdAt','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit'];(function(_0x2555e8,_0x957b2f){var _0x20804b=function(_0x2b5fea){while(--_0x2b5fea){_0x2555e8['push'](_0x2555e8['shift']());}};_0x20804b(++_0x957b2f);}(_0x5c12,0x188));var _0x25c1=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x5c12[_0x3c2b2e];return _0x27a338;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25c1('0x0'));var zipdir=require(_0x25c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var Mustache=require(_0x25c1('0x5'));var util=require(_0x25c1('0x6'));var path=require(_0x25c1('0x7'));var sox=require(_0x25c1('0x8'));var csv=require('to-csv');var ejs=require(_0x25c1('0x9'));var fs=require('fs');var fs_extra=require(_0x25c1('0xa'));var _=require(_0x25c1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x25c1('0xc'));var deskjs=require(_0x25c1('0xd'));var toCsv=require(_0x25c1('0xe'));var querystring=require(_0x25c1('0xf'));var Papa=require(_0x25c1('0x10'));var Redis=require('ioredis');var authService=require(_0x25c1('0x11'));var qs=require(_0x25c1('0x12'));var as=require(_0x25c1('0x13'));var hardwareService=require(_0x25c1('0x14'));var logger=require(_0x25c1('0x15'))('api');var utils=require(_0x25c1('0x16'));var config=require(_0x25c1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x25c1('0x18'))['db'];function respondWithStatusCode(_0x209af5,_0x323d3c){_0x323d3c=_0x323d3c||0xcc;return function(_0x329ba9){if(_0x329ba9){return _0x209af5['sendStatus'](_0x323d3c);}return _0x209af5['status'](_0x323d3c)['end']();};}function respondWithResult(_0x54f6f4,_0x3ef429){_0x3ef429=_0x3ef429||0xc8;return function(_0x1412ed){if(_0x1412ed){return _0x54f6f4[_0x25c1('0x19')](_0x3ef429)[_0x25c1('0x1a')](_0x1412ed);}};}function respondWithFilteredResult(_0x17a032,_0x4ea926){return function(_0x4638f0){if(_0x4638f0){var _0x55b62d=typeof _0x4ea926['offset']==='undefined'&&typeof _0x4ea926[_0x25c1('0x1b')]===_0x25c1('0x1c');var _0x4dc64b=_0x4638f0['count'];var _0x61a29f=_0x55b62d?0x0:_0x4ea926['offset'];var _0x7175d4=_0x55b62d?_0x4638f0[_0x25c1('0x1d')]:_0x4ea926['offset']+_0x4ea926['limit'];var _0x542768;if(_0x7175d4>=_0x4dc64b){_0x7175d4=_0x4dc64b;_0x542768=0xc8;}else{_0x542768=0xce;}_0x17a032[_0x25c1('0x19')](_0x542768);return _0x17a032[_0x25c1('0x1e')](_0x25c1('0x1f'),_0x61a29f+'-'+_0x7175d4+'/'+_0x4dc64b)[_0x25c1('0x1a')](_0x4638f0);}return null;};}function patchUpdates(_0x481c12){return function(_0x119639){try{jsonpatch[_0x25c1('0x20')](_0x119639,_0x481c12,!![]);}catch(_0x34454a){return BPromise[_0x25c1('0x21')](_0x34454a);}return _0x119639['save']();};}function saveUpdates(_0x4c3259,_0x2a8a84){return function(_0xac3335){if(_0xac3335){return _0xac3335[_0x25c1('0x22')](_0x4c3259)[_0x25c1('0x23')](function(_0x15cf2f){return _0x15cf2f;});}return null;};}function removeEntity(_0x1a4b89,_0x2ba595){return function(_0x324ea9){if(_0x324ea9){return _0x324ea9[_0x25c1('0x24')]()[_0x25c1('0x23')](function(){_0x1a4b89[_0x25c1('0x19')](0xcc)[_0x25c1('0x25')]();});}};}function handleEntityNotFound(_0x399d72,_0x4915cc){return function(_0x2dadae){if(!_0x2dadae){_0x399d72[_0x25c1('0x26')](0x194);}return _0x2dadae;};}function handleError(_0x1b1c96,_0x1fb59f){_0x1fb59f=_0x1fb59f||0x1f4;return function(_0x21fdb8){logger[_0x25c1('0x27')](_0x21fdb8['stack']);if(_0x21fdb8[_0x25c1('0x28')]){delete _0x21fdb8[_0x25c1('0x28')];}_0x1b1c96[_0x25c1('0x19')](_0x1fb59f)[_0x25c1('0x29')](_0x21fdb8);};}exports[_0x25c1('0x2a')]=function(_0x193a68,_0x5c56ab){var _0x1e498={},_0x478f1e={},_0x76b360={'count':0x0,'rows':[]};var _0x31c153=_[_0x25c1('0x2b')](db[_0x25c1('0x2c')][_0x25c1('0x2d')],function(_0x21069c){return{'name':_0x21069c[_0x25c1('0x2e')],'type':_0x21069c[_0x25c1('0x2f')][_0x25c1('0x30')]};});_0x478f1e['model']=_[_0x25c1('0x31')](_['map'](_0x31c153,'name'),[_0x25c1('0x32')]);_0x478f1e[_0x25c1('0x33')]=_['keys'](_0x193a68[_0x25c1('0x33')]);_0x478f1e['filters']=_[_0x25c1('0x34')](_0x478f1e['model'],_0x478f1e[_0x25c1('0x33')]);_0x1e498[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x478f1e[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1e498[_0x25c1('0x35')]=_0x1e498['attributes'][_0x25c1('0x38')]?_0x1e498['attributes']:_0x478f1e[_0x25c1('0x36')];if(!_0x193a68['query'][_0x25c1('0x39')](_0x25c1('0x3a'))){_0x1e498[_0x25c1('0x1b')]=qs[_0x25c1('0x1b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x1b')]);_0x1e498[_0x25c1('0x3b')]=qs[_0x25c1('0x3b')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3b')]);}_0x1e498[_0x25c1('0x3c')]=qs[_0x25c1('0x3d')](_0x193a68[_0x25c1('0x33')][_0x25c1('0x3d')]);_0x1e498[_0x25c1('0x3e')]=qs[_0x25c1('0x3f')](_[_0x25c1('0x40')](_0x193a68[_0x25c1('0x33')],_0x478f1e[_0x25c1('0x3f')]),_0x31c153);if(_0x193a68[_0x25c1('0x33')]['filter']){_0x1e498[_0x25c1('0x3e')]=_[_0x25c1('0x41')](_0x1e498['where'],{'$or':_[_0x25c1('0x2b')](_0x31c153,function(_0x5eca99){if(_0x5eca99[_0x25c1('0x2f')]!=='VIRTUAL'){var _0x4326fb={};_0x4326fb[_0x5eca99[_0x25c1('0x28')]]={'$like':'%'+_0x193a68[_0x25c1('0x33')][_0x25c1('0x42')]+'%'};return _0x4326fb;}})});}_0x1e498=_[_0x25c1('0x41')]({},_0x1e498,_0x193a68['options']);var _0x1fe6d7={'where':_0x1e498['where']};return db[_0x25c1('0x2c')][_0x25c1('0x1d')](_0x1fe6d7)[_0x25c1('0x23')](function(_0x17fc23){_0x76b360['count']=_0x17fc23;if(_0x193a68['query']['includeAll']){_0x1e498[_0x25c1('0x43')]=[{'all':!![]}];}return db[_0x25c1('0x2c')]['findAll'](_0x1e498);})[_0x25c1('0x23')](function(_0x58792d){_0x76b360[_0x25c1('0x44')]=_0x58792d;return _0x76b360;})[_0x25c1('0x23')](respondWithFilteredResult(_0x5c56ab,_0x1e498))[_0x25c1('0x45')](handleError(_0x5c56ab,null));};exports['show']=function(_0x5502c1,_0x53f87b){var _0x1b1d17={'raw':![],'where':{'id':_0x5502c1['params']['id']}},_0x3cf9c0={};_0x3cf9c0[_0x25c1('0x36')]=_[_0x25c1('0x46')](db[_0x25c1('0x2c')]['rawAttributes']);_0x3cf9c0['query']=_['keys'](_0x5502c1['query']);_0x3cf9c0[_0x25c1('0x3f')]=_[_0x25c1('0x34')](_0x3cf9c0['model'],_0x3cf9c0[_0x25c1('0x33')]);_0x1b1d17[_0x25c1('0x35')]=_[_0x25c1('0x34')](_0x3cf9c0[_0x25c1('0x36')],qs[_0x25c1('0x37')](_0x5502c1[_0x25c1('0x33')][_0x25c1('0x37')]));_0x1b1d17['attributes']=_0x1b1d17['attributes'][_0x25c1('0x38')]?_0x1b1d17[_0x25c1('0x35')]:_0x3cf9c0[_0x25c1('0x36')];if(_0x5502c1['query'][_0x25c1('0x47')]){_0x1b1d17[_0x25c1('0x43')]=[{'all':!![]}];}_0x1b1d17=_[_0x25c1('0x41')]({},_0x1b1d17,_0x5502c1[_0x25c1('0x48')]);return db['ScreenRecording'][_0x25c1('0x49')](_0x1b1d17)[_0x25c1('0x23')](handleEntityNotFound(_0x53f87b,null))[_0x25c1('0x23')](respondWithResult(_0x53f87b,null))[_0x25c1('0x45')](handleError(_0x53f87b,null));};exports['create']=function(_0x59e96b,_0x13ac06){return db[_0x25c1('0x2c')][_0x25c1('0x4a')](_0x59e96b[_0x25c1('0x4b')],{})['then'](respondWithResult(_0x13ac06,0xc9))[_0x25c1('0x45')](handleError(_0x13ac06,null));};exports[_0x25c1('0x22')]=function(_0x5770dd,_0x102f5){if(_0x5770dd[_0x25c1('0x4b')]['id']){delete _0x5770dd[_0x25c1('0x4b')]['id'];}delete _0x5770dd[_0x25c1('0x4b')]['duration'];delete _0x5770dd['body'][_0x25c1('0x4c')];delete _0x5770dd[_0x25c1('0x4b')][_0x25c1('0x4d')];delete _0x5770dd['body'][_0x25c1('0x4e')];return db[_0x25c1('0x2c')]['find']({'where':{'id':_0x5770dd[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](handleEntityNotFound(_0x102f5,null))[_0x25c1('0x23')](saveUpdates(_0x5770dd[_0x25c1('0x4b')],null))[_0x25c1('0x23')](respondWithResult(_0x102f5,null))[_0x25c1('0x45')](handleError(_0x102f5,null));};exports[_0x25c1('0x50')]=function(_0x5102a0,_0x5344da){return db['ScreenRecording'][_0x25c1('0x50')]()['then'](respondWithResult(_0x5344da,null))[_0x25c1('0x45')](handleError(_0x5344da,null));};exports[_0x25c1('0x51')]=function(_0x42fd6e,_0x153603,_0x40fe57){var _0x1b72e5=require('../../components/encryptor');var _0x4a876b=![];var _0x68e295={};if(_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]&&_0x42fd6e[_0x25c1('0x33')][_0x25c1('0x2f')]==='uniqueid'){_0x68e295[_0x25c1('0x52')]=_0x42fd6e[_0x25c1('0x4f')]['id'];}else{_0x68e295['id']=_0x42fd6e[_0x25c1('0x4f')]['id'];}return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':_0x68e295,'attributes':['id','value'],'raw':!![]})[_0x25c1('0x23')](handleEntityNotFound(_0x153603,null))[_0x25c1('0x23')](function(_0x49b192){if(_0x49b192){var _0x1341d2=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x49b192[_0x25c1('0x4e')]);var _0x3d051a=util['format'](_0x25c1('0x56'),_0x1341d2);if(fs[_0x25c1('0x57')](_0x3d051a)){_0x4a876b=!![];return _0x1b72e5[_0x25c1('0x58')](_0x3d051a,_0x1341d2,config[_0x25c1('0x59')][_0x25c1('0x5a')])[_0x25c1('0x23')](function(){return _0x49b192;});}return _0x49b192;}})[_0x25c1('0x23')](function(_0x5d54cd){if(_0x5d54cd){var _0x321833=path[_0x25c1('0x53')](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x5d54cd[_0x25c1('0x4e')]);if(!fs[_0x25c1('0x57')](_0x321833)){throw new db['Sequelize'][(_0x25c1('0x5b'))](_0x25c1('0x5c'));}if(_0x5d54cd[_0x25c1('0x5d')]){return _0x153603[_0x25c1('0x51')](_0x321833,_0x5d54cd[_0x25c1('0x5d')]+path[_0x25c1('0x5e')](_0x321833),function(){if(_0x4a876b){fs[_0x25c1('0x5f')](_0x321833);}});}else{return _0x153603['download'](_0x321833,function(_0x44efc9){if(_0x4a876b){fs['unlink'](_0x321833);}});}}})[_0x25c1('0x45')](function(_0x24568c){if(_0x24568c[_0x25c1('0x60')]===_0x25c1('0x5c')){_0x153603[_0x25c1('0x19')](0x194)[_0x25c1('0x29')](_0x25c1('0x61'));}else{return handleError(_0x153603,null);}});};exports[_0x25c1('0x24')]=function(_0x4c435c,_0x7dbbe1){return db[_0x25c1('0x2c')][_0x25c1('0x49')]({'where':{'id':_0x4c435c[_0x25c1('0x4f')]['id']}})[_0x25c1('0x23')](function(_0x338f70){if(_[_0x25c1('0x62')](_0x338f70)){throw new ReferenceError('Entity\x20not\x20found');}return _0x338f70;})[_0x25c1('0x23')](function(_0x51e747){var _0x5e1517=path['join'](config[_0x25c1('0x54')],_0x25c1('0x55'),_0x51e747[_0x25c1('0x4e')]);logger[_0x25c1('0x63')](_0x25c1('0x64'),_0x5e1517);if(!_['isNil'](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}_0x5e1517=_0x5e1517+_0x25c1('0x68');if(!_[_0x25c1('0x62')](_0x51e747[_0x25c1('0x4e')])&&fs['existsSync'](_0x5e1517)){logger[_0x25c1('0x63')](_0x25c1('0x65')+_0x5e1517+_0x25c1('0x66'));fs[_0x25c1('0x67')](_0x5e1517);}return _0x51e747;})[_0x25c1('0x23')](function(_0x425f3e){if(!_0x425f3e)throw new InternalError();return _0x425f3e['destroy']();})[_0x25c1('0x23')](function(){_0x7dbbe1['status'](0xcc)[_0x25c1('0x25')]();})['catch'](handleError(_0x7dbbe1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 90750f2..e579269 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 _0x00ee=['define','interactionid','lodash','util','../../config/logger','api','moment','request-promise','./screenRecording.attributes','exports'];(function(_0x207b0b,_0x3069b7){var _0x52e908=function(_0x1af08d){while(--_0x1af08d){_0x207b0b['push'](_0x207b0b['shift']());}};_0x52e908(++_0x3069b7);}(_0x00ee,0x1c4));var _0xe00e=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x00ee[_0x3747ae];return _0x339035;};'use strict';var _=require(_0xe00e('0x0'));var util=require(_0xe00e('0x1'));var logger=require(_0xe00e('0x2'))(_0xe00e('0x3'));var moment=require(_0xe00e('0x4'));var BPromise=require('bluebird');var rp=require(_0xe00e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe00e('0x6'));module[_0xe00e('0x7')]=function(_0x4fdb95,_0xfdb348){return _0x4fdb95[_0xe00e('0x8')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xe00e('0x9'),'fields':[_0xe00e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae3f=['request-promise','path','rimraf','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','util','api','moment','bluebird'];(function(_0x3b738d,_0x2f6ab8){var _0x3c4744=function(_0xfc2077){while(--_0xfc2077){_0x3b738d['push'](_0x3b738d['shift']());}};_0x3c4744(++_0x2f6ab8);}(_0xae3f,0x182));var _0xfae3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xae3f[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xfae3('0x0'));var logger=require('../../config/logger')(_0xfae3('0x1'));var moment=require(_0xfae3('0x2'));var BPromise=require(_0xfae3('0x3'));var rp=require(_0xfae3('0x4'));var fs=require('fs');var path=require(_0xfae3('0x5'));var rimraf=require(_0xfae3('0x6'));var config=require('../../config/environment');var attributes=require(_0xfae3('0x7'));module[_0xfae3('0x8')]=function(_0x267556,_0x2c5cae){return _0x267556[_0xfae3('0x9')](_0xfae3('0xa'),attributes,{'tableName':_0xfae3('0xb'),'paranoid':![],'indexes':[{'name':_0xfae3('0xc'),'fields':[_0xfae3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index d3101cf..5bfe258 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 _0x88b9=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x6f5e4f,_0x5c213b){var _0x2d5553=function(_0x5b6c54){while(--_0x5b6c54){_0x6f5e4f['push'](_0x6f5e4f['shift']());}};_0x2d5553(++_0x5c213b);}(_0x88b9,0x11a));var _0x988b=function(_0x4a811e,_0x47dfca){_0x4a811e=_0x4a811e-0x0;var _0x6567b6=_0x88b9[_0x4a811e];return _0x6567b6;};'use strict';var _=require(_0x988b('0x0'));var util=require(_0x988b('0x1'));var moment=require(_0x988b('0x2'));var BPromise=require(_0x988b('0x3'));var rs=require(_0x988b('0x4'));var fs=require('fs');var Redis=require(_0x988b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x988b('0x6'))(_0x988b('0x7'));var config=require(_0x988b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x988b('0x9')][_0x988b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d0b09,_0x2edee5,_0x3f89e3){return new BPromise(function(_0x4b238e,_0x205975){return client[_0x988b('0xb')](_0x2d0b09,_0x3f89e3)[_0x988b('0xc')](function(_0x4ecf93){logger[_0x988b('0xd')](_0x988b('0xe'),_0x2edee5,_0x988b('0xf'));logger[_0x988b('0x10')](_0x988b('0x11'),_0x2edee5,'request\x20sent',JSON['stringify'](_0x4ecf93));if(_0x4ecf93[_0x988b('0x12')]){if(_0x4ecf93[_0x988b('0x12')]['code']===0x1f4){logger['error'](_0x988b('0xe'),_0x2edee5,_0x4ecf93[_0x988b('0x12')][_0x988b('0x13')]);return _0x205975(_0x4ecf93[_0x988b('0x12')][_0x988b('0x13')]);}logger[_0x988b('0x12')](_0x988b('0xe'),_0x2edee5,_0x4ecf93[_0x988b('0x12')][_0x988b('0x13')]);return _0x4b238e(_0x4ecf93[_0x988b('0x12')][_0x988b('0x13')]);}else{logger[_0x988b('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x2edee5,_0x988b('0xf'));_0x4b238e(_0x4ecf93[_0x988b('0x14')][_0x988b('0x13')]);}})[_0x988b('0x15')](function(_0x4a0800){logger[_0x988b('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x2edee5,_0x4a0800);_0x205975(_0x4a0800);});});} \ No newline at end of file +var _0x7469=['client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x7469,0x145));var _0x9746=function(_0x3ad1a3,_0x1e865d){_0x3ad1a3=_0x3ad1a3-0x0;var _0x3df964=_0x7469[_0x3ad1a3];return _0x3df964;};'use strict';var _=require(_0x9746('0x0'));var util=require(_0x9746('0x1'));var moment=require(_0x9746('0x2'));var BPromise=require('bluebird');var rs=require(_0x9746('0x3'));var fs=require('fs');var Redis=require(_0x9746('0x4'));var db=require(_0x9746('0x5'))['db'];var utils=require(_0x9746('0x6'));var logger=require(_0x9746('0x7'))(_0x9746('0x8'));var config=require(_0x9746('0x9'));var jayson=require(_0x9746('0xa'));var client=jayson[_0x9746('0xb')][_0x9746('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c28bd,_0x40be4c,_0x98e23a){return new BPromise(function(_0x1c2ea6,_0xbf43db){return client[_0x9746('0xd')](_0x2c28bd,_0x98e23a)[_0x9746('0xe')](function(_0x53838e){logger[_0x9746('0xf')](_0x9746('0x10'),_0x40be4c,_0x9746('0x11'));logger[_0x9746('0x12')](_0x9746('0x13'),_0x40be4c,_0x9746('0x11'),JSON[_0x9746('0x14')](_0x53838e));if(_0x53838e[_0x9746('0x15')]){if(_0x53838e[_0x9746('0x15')][_0x9746('0x16')]===0x1f4){logger['error'](_0x9746('0x10'),_0x40be4c,_0x53838e[_0x9746('0x15')][_0x9746('0x17')]);return _0xbf43db(_0x53838e[_0x9746('0x15')][_0x9746('0x17')]);}logger[_0x9746('0x15')](_0x9746('0x10'),_0x40be4c,_0x53838e[_0x9746('0x15')][_0x9746('0x17')]);return _0x1c2ea6(_0x53838e['error'][_0x9746('0x17')]);}else{logger['info'](_0x9746('0x10'),_0x40be4c,'request\x20sent');_0x1c2ea6(_0x53838e['result'][_0x9746('0x17')]);}})['catch'](function(_0x4bb669){logger[_0x9746('0x15')](_0x9746('0x10'),_0x40be4c,_0x4bb669);_0xbf43db(_0x4bb669);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 452f8a5..0332629 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 _0x2608=['exports','util','path','express','Router','fs-extra','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','extname','originalname','post','file','addLogo','%s%s','logologin','single','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update'];(function(_0x491f3f,_0x5ed56a){var _0x2a817f=function(_0x2162cb){while(--_0x2162cb){_0x491f3f['push'](_0x491f3f['shift']());}};_0x2a817f(++_0x5ed56a);}(_0x2608,0xfd));var _0x8260=function(_0x2df8c0,_0x228920){_0x2df8c0=_0x2df8c0-0x0;var _0x3794da=_0x2608[_0x2df8c0];return _0x3794da;};'use strict';var multer=require('multer');var util=require(_0x8260('0x0'));var path=require(_0x8260('0x1'));var timeout=require('connect-timeout');var express=require(_0x8260('0x2'));var router=express[_0x8260('0x3')]();var fs_extra=require(_0x8260('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8260('0x5'));var controller=require(_0x8260('0x6'));router[_0x8260('0x7')]('/',auth[_0x8260('0x8')](),controller[_0x8260('0x9')]);router[_0x8260('0x7')](_0x8260('0xa'),controller[_0x8260('0xb')]);router[_0x8260('0x7')](_0x8260('0xc'),controller['show']);router[_0x8260('0x7')](_0x8260('0xd'),controller['getLogo']);router['get'](_0x8260('0xe'),controller[_0x8260('0xf')]);router['get'](_0x8260('0x10'),controller[_0x8260('0x11')]);router[_0x8260('0x7')](_0x8260('0x12'),controller[_0x8260('0x13')]);router[_0x8260('0x7')](_0x8260('0x14'),controller['getFavicon']);var upload=multer({'storage':multer[_0x8260('0x15')]({'destination':function(_0x4ac703,_0x2d0de2,_0x49f5f4){_0x49f5f4(null,path[_0x8260('0x16')](config[_0x8260('0x17')],_0x8260('0x18')));},'filename':function(_0x6e3a38,_0x4439eb,_0x33bb6b){_0x33bb6b(null,util[_0x8260('0x19')]('%s%s','logo',path[_0x8260('0x1a')](_0x4439eb[_0x8260('0x1b')])));}})});router[_0x8260('0x1c')](_0x8260('0xd'),upload['single'](_0x8260('0x1d')),controller[_0x8260('0x1e')]);var upload=multer({'storage':multer[_0x8260('0x15')]({'destination':function(_0x175128,_0xd08e18,_0x4862ec){_0x4862ec(null,path[_0x8260('0x16')](config['root'],_0x8260('0x18')));},'filename':function(_0x3b670c,_0x269969,_0x37a7f4){_0x37a7f4(null,util[_0x8260('0x19')](_0x8260('0x1f'),_0x8260('0x20'),path[_0x8260('0x1a')](_0x269969[_0x8260('0x1b')])));}})});router[_0x8260('0x1c')](_0x8260('0xe'),upload[_0x8260('0x21')](_0x8260('0x1d')),controller[_0x8260('0x22')]);var upload=multer({'storage':multer[_0x8260('0x15')]({'destination':function(_0x23c655,_0x1b8556,_0xd7cad){_0xd7cad(null,path['join'](config[_0x8260('0x17')],_0x8260('0x18')));},'filename':function(_0x26db0a,_0x57bfe7,_0xf84513){_0xf84513(null,util['format'](_0x8260('0x1f'),_0x8260('0x23'),path[_0x8260('0x1a')](_0x57bfe7[_0x8260('0x1b')])));}})});router[_0x8260('0x1c')](_0x8260('0x12'),upload['single']('file'),controller[_0x8260('0x24')]);var upload=multer({'storage':multer[_0x8260('0x15')]({'destination':function(_0x18de8a,_0x193d12,_0x6d8ec8){_0x6d8ec8(null,path[_0x8260('0x16')](config[_0x8260('0x17')],_0x8260('0x18')));},'filename':function(_0x129508,_0x56edba,_0x5831ad){_0x5831ad(null,util[_0x8260('0x19')](_0x8260('0x1f'),_0x8260('0x25'),path[_0x8260('0x1a')](_0x56edba['originalname'])));}})});router['post'](_0x8260('0x14'),upload['single'](_0x8260('0x1d')),controller[_0x8260('0x26')]);router[_0x8260('0x27')](_0x8260('0xc'),auth[_0x8260('0x8')](),controller[_0x8260('0x28')]);module[_0x8260('0x29')]=router; \ No newline at end of file +var _0x87c0=['logo','extname','originalname','post','single','file','root','preferred','/:id/preferred','favicon','put','update','exports','multer','util','path','express','Router','../../config/environment','get','isAuthenticated','index','getDate','/:id','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s'];(function(_0x1d919b,_0x3188f8){var _0x233c28=function(_0x37927a){while(--_0x37927a){_0x1d919b['push'](_0x1d919b['shift']());}};_0x233c28(++_0x3188f8);}(_0x87c0,0x1a4));var _0x087c=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x87c0[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0x087c('0x0'));var util=require(_0x087c('0x1'));var path=require(_0x087c('0x2'));var timeout=require('connect-timeout');var express=require(_0x087c('0x3'));var router=express[_0x087c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x087c('0x5'));var controller=require('./setting.controller');router[_0x087c('0x6')]('/',auth[_0x087c('0x7')](),controller[_0x087c('0x8')]);router[_0x087c('0x6')]('/now',controller[_0x087c('0x9')]);router[_0x087c('0x6')](_0x087c('0xa'),controller['show']);router[_0x087c('0x6')](_0x087c('0xb'),controller[_0x087c('0xc')]);router[_0x087c('0x6')]('/:id/logo_login',controller[_0x087c('0xd')]);router[_0x087c('0x6')](_0x087c('0xe'),controller[_0x087c('0xf')]);router[_0x087c('0x6')]('/:id/preferred',controller[_0x087c('0x10')]);router[_0x087c('0x6')](_0x087c('0x11'),controller[_0x087c('0x12')]);var upload=multer({'storage':multer[_0x087c('0x13')]({'destination':function(_0x3cbe42,_0x3607e7,_0x1242ac){_0x1242ac(null,path[_0x087c('0x14')](config['root'],_0x087c('0x15')));},'filename':function(_0x48f9b8,_0x1a2480,_0x3a7ba0){_0x3a7ba0(null,util[_0x087c('0x16')](_0x087c('0x17'),_0x087c('0x18'),path[_0x087c('0x19')](_0x1a2480[_0x087c('0x1a')])));}})});router[_0x087c('0x1b')]('/:id/logo',upload[_0x087c('0x1c')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x087c('0x13')]({'destination':function(_0x51a75a,_0x4864a2,_0x48bbd7){_0x48bbd7(null,path['join'](config['root'],_0x087c('0x15')));},'filename':function(_0x266f0e,_0x483ca9,_0x4063eb){_0x4063eb(null,util['format'](_0x087c('0x17'),'logologin',path[_0x087c('0x19')](_0x483ca9[_0x087c('0x1a')])));}})});router['post']('/:id/logo_login',upload[_0x087c('0x1c')](_0x087c('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x087c('0x13')]({'destination':function(_0x16e2fa,_0x4b6a66,_0x5017e5){_0x5017e5(null,path[_0x087c('0x14')](config[_0x087c('0x1e')],_0x087c('0x15')));},'filename':function(_0xaff21f,_0x28043c,_0x126289){_0x126289(null,util['format'](_0x087c('0x17'),_0x087c('0x1f'),path[_0x087c('0x19')](_0x28043c[_0x087c('0x1a')])));}})});router[_0x087c('0x1b')](_0x087c('0x20'),upload[_0x087c('0x1c')](_0x087c('0x1d')),controller['addPreferred']);var upload=multer({'storage':multer[_0x087c('0x13')]({'destination':function(_0x40860c,_0x345dc1,_0x5f1751){_0x5f1751(null,path[_0x087c('0x14')](config[_0x087c('0x1e')],_0x087c('0x15')));},'filename':function(_0x440fec,_0x1019e0,_0x2c0bc6){_0x2c0bc6(null,util[_0x087c('0x16')](_0x087c('0x17'),_0x087c('0x21'),path['extname'](_0x1019e0['originalname'])));}})});router[_0x087c('0x1b')]('/:id/favicon',upload[_0x087c('0x1c')](_0x087c('0x1d')),controller['addFavicon']);router[_0x087c('0x22')](_0x087c('0xa'),auth[_0x087c('0x7')](),controller[_0x087c('0x23')]);module[_0x087c('0x24')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 377e22c..340fd0d 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 _0xedf1=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN'];(function(_0x42ef35,_0x4f4790){var _0xe3001f=function(_0x55d011){while(--_0x55d011){_0x42ef35['push'](_0x42ef35['shift']());}};_0xe3001f(++_0x4f4790);}(_0xedf1,0x1e3));var _0x1edf=function(_0x299182,_0x2053c1){_0x299182=_0x299182-0x0;var _0x14cf3e=_0xedf1[_0x299182];return _0x14cf3e;};'use strict';var Sequelize=require(_0x1edf('0x0'));module[_0x1edf('0x1')]={'min_internal':{'type':Sequelize[_0x1edf('0x2')](0xb),'unique':_0x1edf('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x1edf('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1edf('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x1edf('0x5')]},'defaultLogo':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1edf('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1edf('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1edf('0x5')]},'turnaddr':{'type':Sequelize[_0x1edf('0x5')]},'turnusername':{'type':Sequelize[_0x1edf('0x5')]},'turnpassword':{'type':Sequelize[_0x1edf('0x5')]},'pageTitle':{'type':Sequelize[_0x1edf('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1edf('0x5')],'defaultValue':_0x1edf('0x7')},'enableEmailPreview':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x1edf('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1edf('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1edf('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1edf('0x5')],'defaultValue':_0x1edf('0x8')},'chatTimeout':{'type':Sequelize[_0x1edf('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1edf('0x5')]},'defaultPreferred':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1edf('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1edf('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1edf('0x5')]},'defaultFavicon':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1edf('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1edf('0x2')]},'transcribeRegion':{'type':Sequelize[_0x1edf('0x5')]},'sentiment':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1edf('0x2')]},'sentimentRegion':{'type':Sequelize[_0x1edf('0x5')]},'language':{'type':Sequelize[_0x1edf('0x5')]},'bucket':{'type':Sequelize[_0x1edf('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x1edf('0x2')](0x2)[_0x1edf('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1edf('0x2')](0x2)[_0x1edf('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x1edf('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x1edf('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x1edf('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x1edf('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x1edf('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x1edf('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x1edf('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x6d23=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','min_internal','INTEGER'];(function(_0x3c6023,_0x56ec4){var _0x5a21d7=function(_0x3183fa){while(--_0x3183fa){_0x3c6023['push'](_0x3c6023['shift']());}};_0x5a21d7(++_0x56ec4);}(_0x6d23,0x11e));var _0x36d2=function(_0x29cf8f,_0x2447f0){_0x29cf8f=_0x29cf8f-0x0;var _0x178467=_0x6d23[_0x29cf8f];return _0x178467;};'use strict';var Sequelize=require(_0x36d2('0x0'));module[_0x36d2('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x36d2('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x36d2('0x3')](0xb),'unique':_0x36d2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x36d2('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x36d2('0x5')],'defaultValue':_0x36d2('0x6')},'logo':{'type':Sequelize[_0x36d2('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x36d2('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x36d2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x36d2('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x36d2('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x36d2('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x36d2('0x5')],'defaultValue':_0x36d2('0x8')},'enableEmailPreview':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x36d2('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x36d2('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x36d2('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x36d2('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x36d2('0x5')]},'defaultPreferred':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x36d2('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x36d2('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x36d2('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x36d2('0x3')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x36d2('0x3')]},'sentimentRegion':{'type':Sequelize[_0x36d2('0x5')]},'language':{'type':Sequelize[_0x36d2('0x5')]},'bucket':{'type':Sequelize[_0x36d2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x36d2('0x3')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x36d2('0x3')](0x2)[_0x36d2('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x36d2('0x3')](0x2)[_0x36d2('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x36d2('0x3')](0x2)[_0x36d2('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x36d2('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x36d2('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x36d2('0x3')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x36d2('0x3')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x36d2('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 28ec27c..77592ed 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 _0x4958=['fields','body','find','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','client','request','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','update','then','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','options','Setting','includeAll','include','findAll','rows','catch'];(function(_0x1b3da8,_0x4a058f){var _0x26829=function(_0x30e662){while(--_0x30e662){_0x1b3da8['push'](_0x1b3da8['shift']());}};_0x26829(++_0x4a058f);}(_0x4958,0x192));var _0x8495=function(_0x1c9a6f,_0x38b348){_0x1c9a6f=_0x1c9a6f-0x0;var _0x5a9f2e=_0x4958[_0x1c9a6f];return _0x5a9f2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8495('0x0'));var zipdir=require(_0x8495('0x1'));var jsonpatch=require(_0x8495('0x2'));var rp=require(_0x8495('0x3'));var moment=require(_0x8495('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8495('0x5'));var util=require(_0x8495('0x6'));var path=require(_0x8495('0x7'));var sox=require(_0x8495('0x8'));var csv=require('to-csv');var ejs=require(_0x8495('0x9'));var fs=require('fs');var fs_extra=require(_0x8495('0xa'));var _=require(_0x8495('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8495('0xc'));var deskjs=require(_0x8495('0xd'));var toCsv=require(_0x8495('0xe'));var querystring=require(_0x8495('0xf'));var Papa=require(_0x8495('0x10'));var Redis=require(_0x8495('0x11'));var authService=require(_0x8495('0x12'));var qs=require(_0x8495('0x13'));var as=require(_0x8495('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8495('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8495('0x16'));var licenseUtil=require(_0x8495('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x8495('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e2a2e,_0xd5fe95,_0x4c2499,_0x3256d2){return new BPromise(function(_0x3ea554,_0x1d56f0){var _0x27279e=_0x3256d2||client;return _0x27279e[_0x8495('0x19')](_0x5e2a2e,_0x4c2499)['then'](function(_0x50deb8){logger['info'](_0x8495('0x1a'),_0xd5fe95,'request\x20sent');logger[_0x8495('0x1b')](_0x8495('0x1c'),_0xd5fe95,_0x8495('0x1d'),JSON['stringify'](_0x50deb8));if(_0x50deb8['error']){if(_0x50deb8[_0x8495('0x1e')][_0x8495('0x1f')]===0x1f4){logger[_0x8495('0x1e')]('Setting,\x20%s,\x20%s',_0xd5fe95,_0x50deb8[_0x8495('0x1e')][_0x8495('0x20')]);return _0x1d56f0(_0x50deb8[_0x8495('0x1e')][_0x8495('0x20')]);}logger['error']('Setting,\x20%s,\x20%s',_0xd5fe95,_0x50deb8[_0x8495('0x1e')]['message']);return _0x3ea554(_0x50deb8[_0x8495('0x1e')][_0x8495('0x20')]);}else{logger['info'](_0x8495('0x1a'),_0xd5fe95,'request\x20sent');_0x3ea554(_0x50deb8['result'][_0x8495('0x20')]);}})['catch'](function(_0xf1e07d){logger['error'](_0x8495('0x1a'),_0xd5fe95,_0xf1e07d);_0x1d56f0(_0xf1e07d);});});}function respondWithStatusCode(_0x3eb76c,_0x5edf55){_0x5edf55=_0x5edf55||0xcc;return function(_0x2fe0ac){if(_0x2fe0ac){return _0x3eb76c[_0x8495('0x21')](_0x5edf55);}return _0x3eb76c['status'](_0x5edf55)[_0x8495('0x22')]();};}function respondWithResult(_0x4b47ab,_0x471229){_0x471229=_0x471229||0xc8;return function(_0x327d1f){if(_0x327d1f){return _0x4b47ab['status'](_0x471229)[_0x8495('0x23')](_0x327d1f);}};}function respondWithFilteredResult(_0x57c81c,_0x55aa12){return function(_0x371686){if(_0x371686){var _0x368288=typeof _0x55aa12['offset']===_0x8495('0x24')&&typeof _0x55aa12[_0x8495('0x25')]===_0x8495('0x24');var _0xc61c81=_0x371686[_0x8495('0x26')];var _0x3517fa=_0x368288?0x0:_0x55aa12[_0x8495('0x27')];var _0x33b3b7=_0x368288?_0x371686[_0x8495('0x26')]:_0x55aa12[_0x8495('0x27')]+_0x55aa12['limit'];var _0x469c96;if(_0x33b3b7>=_0xc61c81){_0x33b3b7=_0xc61c81;_0x469c96=0xc8;}else{_0x469c96=0xce;}_0x57c81c[_0x8495('0x28')](_0x469c96);return _0x57c81c[_0x8495('0x29')](_0x8495('0x2a'),_0x3517fa+'-'+_0x33b3b7+'/'+_0xc61c81)[_0x8495('0x23')](_0x371686);}return null;};}function patchUpdates(_0x14b757){return function(_0x1bca35){try{jsonpatch['apply'](_0x1bca35,_0x14b757,!![]);}catch(_0x3684f3){return BPromise[_0x8495('0x2b')](_0x3684f3);}return _0x1bca35['save']();};}function saveUpdates(_0x4effd8,_0x11f149){return function(_0x25c3dd){if(_0x25c3dd){return _0x25c3dd[_0x8495('0x2c')](_0x4effd8)[_0x8495('0x2d')](function(_0xa59f2d){return _0xa59f2d;});}return null;};}function removeEntity(_0x4479b9,_0x9009d3){return function(_0x5dba94){if(_0x5dba94){return _0x5dba94[_0x8495('0x2e')]()[_0x8495('0x2d')](function(){_0x4479b9[_0x8495('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507f11,_0x52717e){return function(_0x5499d8){if(!_0x5499d8){_0x507f11[_0x8495('0x21')](0x194);}return _0x5499d8;};}function handleError(_0x18b639,_0x95dac0){_0x95dac0=_0x95dac0||0x1f4;return function(_0x42a6ce){logger[_0x8495('0x1e')](_0x42a6ce[_0x8495('0x2f')]);if(_0x42a6ce[_0x8495('0x30')]){delete _0x42a6ce[_0x8495('0x30')];}_0x18b639['status'](_0x95dac0)['send'](_0x42a6ce);};}exports[_0x8495('0x31')]=function(_0x3fda32,_0x128f72){var _0x375c0b={},_0x45932a={},_0x5686bb={'count':0x0,'rows':[]};var _0x3ee12a=_[_0x8495('0x32')](db['Setting'][_0x8495('0x33')],function(_0x28a190){return{'name':_0x28a190['fieldName'],'type':_0x28a190[_0x8495('0x34')][_0x8495('0x35')]};});_0x45932a[_0x8495('0x36')]=_[_0x8495('0x32')](_0x3ee12a,_0x8495('0x30'));_0x45932a[_0x8495('0x37')]=_[_0x8495('0x38')](_0x3fda32[_0x8495('0x37')]);_0x45932a[_0x8495('0x39')]=_[_0x8495('0x3a')](_0x45932a[_0x8495('0x36')],_0x45932a[_0x8495('0x37')]);_0x375c0b['attributes']=_[_0x8495('0x3a')](_0x45932a[_0x8495('0x36')],qs['fields'](_0x3fda32[_0x8495('0x37')]['fields']));_0x375c0b['attributes']=_0x375c0b[_0x8495('0x3b')]['length']?_0x375c0b[_0x8495('0x3b')]:_0x45932a[_0x8495('0x36')];if(!_0x3fda32[_0x8495('0x37')]['hasOwnProperty'](_0x8495('0x3c'))){_0x375c0b[_0x8495('0x25')]=qs[_0x8495('0x25')](_0x3fda32[_0x8495('0x37')][_0x8495('0x25')]);_0x375c0b['offset']=qs[_0x8495('0x27')](_0x3fda32['query']['offset']);}_0x375c0b[_0x8495('0x3d')]=qs[_0x8495('0x3e')](_0x3fda32[_0x8495('0x37')][_0x8495('0x3e')]);_0x375c0b[_0x8495('0x3f')]=qs[_0x8495('0x39')](_[_0x8495('0x40')](_0x3fda32[_0x8495('0x37')],_0x45932a['filters']),_0x3ee12a);if(_0x3fda32[_0x8495('0x37')][_0x8495('0x41')]){_0x375c0b['where']=_[_0x8495('0x42')](_0x375c0b[_0x8495('0x3f')],{'$or':_[_0x8495('0x32')](_0x3ee12a,function(_0x85ebfd){if(_0x85ebfd[_0x8495('0x34')]!=='VIRTUAL'){var _0x6ef4c5={};_0x6ef4c5[_0x85ebfd['name']]={'$like':'%'+_0x3fda32[_0x8495('0x37')][_0x8495('0x41')]+'%'};return _0x6ef4c5;}})});}_0x375c0b=_['merge']({},_0x375c0b,_0x3fda32[_0x8495('0x43')]);var _0x221c6c={'where':_0x375c0b[_0x8495('0x3f')]};return db[_0x8495('0x44')][_0x8495('0x26')](_0x221c6c)[_0x8495('0x2d')](function(_0x10805b){_0x5686bb['count']=_0x10805b;if(_0x3fda32['query'][_0x8495('0x45')]){_0x375c0b[_0x8495('0x46')]=[{'all':!![]}];}return db['Setting'][_0x8495('0x47')](_0x375c0b);})[_0x8495('0x2d')](function(_0x3024e3){_0x5686bb[_0x8495('0x48')]=_0x3024e3;return _0x5686bb;})[_0x8495('0x2d')](respondWithFilteredResult(_0x128f72,_0x375c0b))[_0x8495('0x49')](handleError(_0x128f72,null));};exports['show']=function(_0xf74dcb,_0x161304){var _0x2b3539={'raw':![],'where':{'id':_0xf74dcb['params']['id']}},_0x571e30={};_0x571e30[_0x8495('0x36')]=_[_0x8495('0x38')](db['Setting'][_0x8495('0x33')]);_0x571e30[_0x8495('0x37')]=_['keys'](_0xf74dcb['query']);_0x571e30['filters']=_[_0x8495('0x3a')](_0x571e30[_0x8495('0x36')],_0x571e30[_0x8495('0x37')]);_0x2b3539[_0x8495('0x3b')]=_[_0x8495('0x3a')](_0x571e30[_0x8495('0x36')],qs[_0x8495('0x4a')](_0xf74dcb[_0x8495('0x37')]['fields']));_0x2b3539[_0x8495('0x3b')]=_0x2b3539['attributes']['length']?_0x2b3539[_0x8495('0x3b')]:_0x571e30[_0x8495('0x36')];if(_0xf74dcb[_0x8495('0x37')]['includeAll']){_0x2b3539[_0x8495('0x46')]=[{'all':!![]}];}_0x2b3539=_[_0x8495('0x42')]({},_0x2b3539,_0xf74dcb[_0x8495('0x43')]);return db[_0x8495('0x44')]['find'](_0x2b3539)[_0x8495('0x2d')](handleEntityNotFound(_0x161304,null))[_0x8495('0x2d')](respondWithResult(_0x161304,null))[_0x8495('0x49')](handleError(_0x161304,null));};exports[_0x8495('0x2c')]=function(_0x202ca2,_0x510b56){if(_0x202ca2[_0x8495('0x4b')]['id']){delete _0x202ca2[_0x8495('0x4b')]['id'];}return db[_0x8495('0x44')][_0x8495('0x4c')]({'where':{'id':_0x202ca2[_0x8495('0x4d')]['id']}})['then'](handleEntityNotFound(_0x510b56,null))[_0x8495('0x2d')](saveUpdates(_0x202ca2[_0x8495('0x4b')],null))['then'](respondWithResult(_0x510b56,null))['catch'](handleError(_0x510b56,null));};exports[_0x8495('0x4e')]=function(_0x2f5214,_0x10c5f8,_0x47be30){if(_0x2f5214[_0x8495('0x4f')]&&_0x2f5214[_0x8495('0x4f')][_0x8495('0x50')]){_0x2f5214['body'][_0x8495('0x51')]=_0x2f5214[_0x8495('0x4f')]['filename'];}return db['Setting']['find']({'where':{'id':_0x2f5214[_0x8495('0x4d')]['id']}})['then'](handleEntityNotFound(_0x10c5f8,null))[_0x8495('0x2d')](saveUpdates(_0x2f5214['body'],null))['then'](respondWithResult(_0x10c5f8,null))[_0x8495('0x49')](handleError(_0x10c5f8,null));};exports[_0x8495('0x52')]=function(_0x2376a2,_0x25215f,_0x57f192){if(_0x2376a2[_0x8495('0x4f')]&&_0x2376a2[_0x8495('0x4f')][_0x8495('0x50')]){_0x2376a2[_0x8495('0x4b')][_0x8495('0x53')]=_0x2376a2[_0x8495('0x4f')][_0x8495('0x50')];}return db[_0x8495('0x44')][_0x8495('0x4c')]({'where':{'id':_0x2376a2['params']['id']}})[_0x8495('0x2d')](handleEntityNotFound(_0x25215f,null))[_0x8495('0x2d')](saveUpdates(_0x2376a2['body'],null))['then'](respondWithResult(_0x25215f,null))[_0x8495('0x49')](handleError(_0x25215f,null));};var utilLicense=require(_0x8495('0x17'));exports['getLogo']=function(_0x31afc9,_0xd6ffe5,_0x3cb2fb){var _0x4c78c5=_0x8495('0x54');var _0x449f1f={'custom':![]};return utilLicense[_0x8495('0x55')]()[_0x8495('0x2d')](function(_0x15f90d){if(_0x15f90d){_0x449f1f=_0x15f90d;}return db[_0x8495('0x44')][_0x8495('0x4c')]({'where':{'id':_0x31afc9[_0x8495('0x4d')]['id']},'attributes':[_0x8495('0x51'),_0x8495('0x53'),_0x8495('0x56'),_0x8495('0x57'),_0x8495('0x58'),_0x8495('0x59'),_0x8495('0x5a'),_0x8495('0x5b')],'raw':!![]});})[_0x8495('0x2d')](handleEntityNotFound(_0xd6ffe5,null))[_0x8495('0x2d')](function(_0x312c18){if(_0x312c18){var _0x15e643=_0x312c18['logo']&&fs[_0x8495('0x5c')](path['join'](config[_0x8495('0x5d')],_0x4c78c5,_[_0x8495('0x5e')](_0x312c18[_0x8495('0x51')])))?path[_0x8495('0x5f')](config[_0x8495('0x5d')],_0x4c78c5,_[_0x8495('0x5e')](_0x312c18[_0x8495('0x51')])):path[_0x8495('0x5f')](config['root'],_0x4c78c5,_['toLower'](_0x8495('0x60')));var _0x1e1e01=_0x8495('0x61')+_[_0x8495('0x62')]('logo');if(_0x312c18[_0x1e1e01]||!_0x449f1f[_0x8495('0x63')]){_0x15e643=path[_0x8495('0x5f')](config['root'],_0x4c78c5,_['toLower']('default_logo.svg'));}if(!fs[_0x8495('0x5c')](_0x15e643)){throw new db[(_0x8495('0x64'))][(_0x8495('0x65'))](_[_0x8495('0x62')](_0x8495('0x51'))+_0x8495('0x66'));}return _0xd6ffe5[_0x8495('0x67')](_0x15e643);}})[_0x8495('0x49')](handleError(_0xd6ffe5,null));};var utilLicense=require(_0x8495('0x17'));exports[_0x8495('0x68')]=function(_0x4f9846,_0x4e64a1,_0x2698d6){var _0x30bc93=_0x8495('0x54');var _0x32d89a={'custom':![]};return utilLicense[_0x8495('0x55')]()[_0x8495('0x2d')](function(_0x10796d){if(_0x10796d){_0x32d89a=_0x10796d;}return db[_0x8495('0x44')]['find']({'where':{'id':_0x4f9846['params']['id']},'attributes':['logo',_0x8495('0x53'),_0x8495('0x56'),_0x8495('0x57'),'defaultLogo',_0x8495('0x59'),'defaultPreferred',_0x8495('0x5b')],'raw':!![]});})[_0x8495('0x2d')](handleEntityNotFound(_0x4e64a1,null))[_0x8495('0x2d')](function(_0x29f865){if(_0x29f865){var _0x252de8=_0x29f865[_0x8495('0x53')]&&fs[_0x8495('0x5c')](path[_0x8495('0x5f')](config[_0x8495('0x5d')],_0x30bc93,_[_0x8495('0x5e')](_0x29f865[_0x8495('0x53')])))?path[_0x8495('0x5f')](config['root'],_0x30bc93,_['toLower'](_0x29f865[_0x8495('0x53')])):path[_0x8495('0x5f')](config[_0x8495('0x5d')],_0x30bc93,_['toLower'](_0x8495('0x69')));var _0x2c5431=_0x8495('0x61')+_['upperFirst']('loginLogo');if(_0x29f865[_0x2c5431]||!_0x32d89a['custom']){_0x252de8=path[_0x8495('0x5f')](config[_0x8495('0x5d')],_0x30bc93,_[_0x8495('0x5e')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x252de8)){throw new db[(_0x8495('0x64'))][(_0x8495('0x65'))](_[_0x8495('0x62')](_0x8495('0x53'))+_0x8495('0x66'));}return _0x4e64a1[_0x8495('0x67')](_0x252de8);}})[_0x8495('0x49')](handleError(_0x4e64a1,null));};exports[_0x8495('0x6a')]=function(_0x2892fb,_0x5d1ba5){return db['Setting'][_0x8495('0x4c')]({'where':{'id':_0x2892fb[_0x8495('0x4d')]['id']},'attributes':['securePassword']})[_0x8495('0x2d')](respondWithResult(_0x5d1ba5,null))[_0x8495('0x49')](handleError(_0x5d1ba5,null));};exports[_0x8495('0x6b')]=function(_0x2f7228,_0x26cb33,_0x1ae831){if(_0x2f7228[_0x8495('0x4f')]&&_0x2f7228[_0x8495('0x4f')][_0x8495('0x50')]){_0x2f7228[_0x8495('0x4b')][_0x8495('0x56')]=_0x2f7228[_0x8495('0x4f')]['filename'];}return db[_0x8495('0x44')][_0x8495('0x4c')]({'where':{'id':_0x2f7228[_0x8495('0x4d')]['id']}})['then'](handleEntityNotFound(_0x26cb33,null))[_0x8495('0x2d')](saveUpdates(_0x2f7228['body'],null))['then'](respondWithResult(_0x26cb33,null))[_0x8495('0x49')](handleError(_0x26cb33,null));};var utilLicense=require(_0x8495('0x17'));exports[_0x8495('0x6c')]=function(_0x305824,_0x46c59b,_0x546ed5){var _0x3327f5=_0x8495('0x54');var _0x560363={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2d394a){if(_0x2d394a){_0x560363=_0x2d394a;}return db[_0x8495('0x44')]['find']({'where':{'id':_0x305824[_0x8495('0x4d')]['id']},'attributes':[_0x8495('0x51'),_0x8495('0x53'),_0x8495('0x56'),_0x8495('0x57'),_0x8495('0x58'),_0x8495('0x59'),_0x8495('0x5a'),_0x8495('0x5b')],'raw':!![]});})[_0x8495('0x2d')](handleEntityNotFound(_0x46c59b,null))['then'](function(_0x5baf0c){if(_0x5baf0c){var _0x304350=_0x5baf0c[_0x8495('0x56')]&&fs[_0x8495('0x5c')](path[_0x8495('0x5f')](config['root'],_0x3327f5,_[_0x8495('0x5e')](_0x5baf0c['preferred'])))?path[_0x8495('0x5f')](config['root'],_0x3327f5,_[_0x8495('0x5e')](_0x5baf0c[_0x8495('0x56')])):path[_0x8495('0x5f')](config[_0x8495('0x5d')],_0x3327f5,_[_0x8495('0x5e')]('default_preferred.png'));var _0x655a7c=_0x8495('0x61')+_[_0x8495('0x62')](_0x8495('0x56'));if(_0x5baf0c[_0x655a7c]||!_0x560363[_0x8495('0x63')]||!_0x560363[_0x8495('0x56')]){_0x304350=path['join'](config['root'],_0x3327f5,_[_0x8495('0x5e')](_0x8495('0x6d')));}if(!fs['existsSync'](_0x304350)){throw new db[(_0x8495('0x64'))][(_0x8495('0x65'))](_[_0x8495('0x62')](_0x8495('0x56'))+_0x8495('0x66'));}return _0x46c59b[_0x8495('0x67')](_0x304350);}})[_0x8495('0x49')](handleError(_0x46c59b,null));};exports[_0x8495('0x6e')]=function(_0x2b65d5,_0x95dae2,_0x50fae6){if(_0x2b65d5[_0x8495('0x4f')]&&_0x2b65d5[_0x8495('0x4f')]['filename']){_0x2b65d5[_0x8495('0x4b')][_0x8495('0x57')]=_0x2b65d5['file'][_0x8495('0x50')];}return db[_0x8495('0x44')]['find']({'where':{'id':_0x2b65d5[_0x8495('0x4d')]['id']}})[_0x8495('0x2d')](handleEntityNotFound(_0x95dae2,null))[_0x8495('0x2d')](saveUpdates(_0x2b65d5[_0x8495('0x4b')],null))[_0x8495('0x2d')](respondWithResult(_0x95dae2,null))[_0x8495('0x49')](handleError(_0x95dae2,null));};var utilLicense=require(_0x8495('0x17'));exports[_0x8495('0x6f')]=function(_0x3c7741,_0x113908,_0x4ac710){var _0x278080=_0x8495('0x54');var _0xfcb2fe={'custom':![]};return utilLicense[_0x8495('0x55')]()[_0x8495('0x2d')](function(_0x5a2936){if(_0x5a2936){_0xfcb2fe=_0x5a2936;}return db[_0x8495('0x44')][_0x8495('0x4c')]({'where':{'id':_0x3c7741[_0x8495('0x4d')]['id']},'attributes':[_0x8495('0x51'),_0x8495('0x53'),_0x8495('0x56'),_0x8495('0x57'),'defaultLogo','defaultLoginLogo',_0x8495('0x5a'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x113908,null))[_0x8495('0x2d')](function(_0x4c8b3b){if(_0x4c8b3b){var _0x3428e5=_0x4c8b3b['favicon']&&fs['existsSync'](path[_0x8495('0x5f')](config[_0x8495('0x5d')],_0x278080,_[_0x8495('0x5e')](_0x4c8b3b[_0x8495('0x57')])))?path[_0x8495('0x5f')](config[_0x8495('0x5d')],_0x278080,_['toLower'](_0x4c8b3b[_0x8495('0x57')])):path[_0x8495('0x5f')](config['root'],_0x278080,_['toLower']('default_favicon.ico'));var _0x2101a4='default'+_[_0x8495('0x62')](_0x8495('0x57'));if(_0x4c8b3b[_0x2101a4]||!_0xfcb2fe[_0x8495('0x63')]){_0x3428e5=path[_0x8495('0x5f')](config['root'],_0x278080,_[_0x8495('0x5e')](_0x8495('0x70')));}if(!fs[_0x8495('0x5c')](_0x3428e5)){throw new db[(_0x8495('0x64'))][(_0x8495('0x65'))](_[_0x8495('0x62')](_0x8495('0x57'))+_0x8495('0x66'));}return _0x113908[_0x8495('0x67')](_0x3428e5);}})[_0x8495('0x49')](handleError(_0x113908,null));};exports[_0x8495('0x71')]=function(_0x4e1e7a,_0x5732eb){var _0x38ad10={'offset':moment()[_0x8495('0x72')]()};_0x38ad10[_0x8495('0x73')]=moment()[_0x8495('0x72')](_0x38ad10[_0x8495('0x27')])[_0x8495('0x74')](_0x8495('0x75'));return _0x5732eb[_0x8495('0x28')](0xc8)[_0x8495('0x76')](_0x38ad10);}; \ No newline at end of file +var _0x18ea=['map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','root','toLower','join','default_logo.svg','default','upperFirst','custom','existsSync','Sequelize','ValidationError','download','preferred','defaultPreferred','default_loginLogo.svg','securePassword','addPreferred','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','info','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','stack','index','Setting','rawAttributes','type','key','model'];(function(_0x2f446f,_0x37533e){var _0x2350b9=function(_0x2ab14d){while(--_0x2ab14d){_0x2f446f['push'](_0x2f446f['shift']());}};_0x2350b9(++_0x37533e);}(_0x18ea,0xbe));var _0xa18e=function(_0x446157,_0x5cae34){_0x446157=_0x446157-0x0;var _0x341a86=_0x18ea[_0x446157];return _0x341a86;};'use strict';var emlformat=require(_0xa18e('0x0'));var rimraf=require(_0xa18e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa18e('0x2'));var moment=require(_0xa18e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa18e('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa18e('0x5'));var csv=require('to-csv');var ejs=require(_0xa18e('0x6'));var fs=require('fs');var fs_extra=require(_0xa18e('0x7'));var _=require(_0xa18e('0x8'));var squel=require(_0xa18e('0x9'));var crypto=require(_0xa18e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa18e('0xb'));var toCsv=require(_0xa18e('0xc'));var querystring=require(_0xa18e('0xd'));var Papa=require('papaparse');var Redis=require(_0xa18e('0xe'));var authService=require(_0xa18e('0xf'));var qs=require(_0xa18e('0x10'));var as=require(_0xa18e('0x11'));var hardwareService=require(_0xa18e('0x12'));var logger=require(_0xa18e('0x13'))('api');var utils=require(_0xa18e('0x14'));var config=require(_0xa18e('0x15'));var licenseUtil=require(_0xa18e('0x16'));var db=require(_0xa18e('0x17'))['db'];var jayson=require(_0xa18e('0x18'));var client=jayson['client'][_0xa18e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x54b07e,_0x5b3495,_0x44af56,_0x34a87f){return new BPromise(function(_0x5e41df,_0x206f07){var _0x2da8db=_0x34a87f||client;return _0x2da8db['request'](_0x54b07e,_0x44af56)['then'](function(_0x4b33f2){logger[_0xa18e('0x1a')]('Setting,\x20%s,\x20%s',_0x5b3495,'request\x20sent');logger[_0xa18e('0x1b')](_0xa18e('0x1c'),_0x5b3495,'request\x20sent',JSON[_0xa18e('0x1d')](_0x4b33f2));if(_0x4b33f2[_0xa18e('0x1e')]){if(_0x4b33f2[_0xa18e('0x1e')]['code']===0x1f4){logger[_0xa18e('0x1e')](_0xa18e('0x1f'),_0x5b3495,_0x4b33f2['error'][_0xa18e('0x20')]);return _0x206f07(_0x4b33f2['error'][_0xa18e('0x20')]);}logger[_0xa18e('0x1e')](_0xa18e('0x1f'),_0x5b3495,_0x4b33f2[_0xa18e('0x1e')]['message']);return _0x5e41df(_0x4b33f2['error'][_0xa18e('0x20')]);}else{logger[_0xa18e('0x1a')](_0xa18e('0x1f'),_0x5b3495,_0xa18e('0x21'));_0x5e41df(_0x4b33f2[_0xa18e('0x22')]['message']);}})[_0xa18e('0x23')](function(_0x1f2a1a){logger[_0xa18e('0x1e')]('Setting,\x20%s,\x20%s',_0x5b3495,_0x1f2a1a);_0x206f07(_0x1f2a1a);});});}function respondWithStatusCode(_0x3b84de,_0x1ddca9){_0x1ddca9=_0x1ddca9||0xcc;return function(_0x35040a){if(_0x35040a){return _0x3b84de[_0xa18e('0x24')](_0x1ddca9);}return _0x3b84de[_0xa18e('0x25')](_0x1ddca9)['end']();};}function respondWithResult(_0x3f53a4,_0x2a64df){_0x2a64df=_0x2a64df||0xc8;return function(_0x79796c){if(_0x79796c){return _0x3f53a4[_0xa18e('0x25')](_0x2a64df)[_0xa18e('0x26')](_0x79796c);}};}function respondWithFilteredResult(_0x14558a,_0x3c4a50){return function(_0x3f0f8c){if(_0x3f0f8c){var _0x1bfec9=typeof _0x3c4a50[_0xa18e('0x27')]===_0xa18e('0x28')&&typeof _0x3c4a50[_0xa18e('0x29')]===_0xa18e('0x28');var _0x360d37=_0x3f0f8c[_0xa18e('0x2a')];var _0xabd760=_0x1bfec9?0x0:_0x3c4a50[_0xa18e('0x27')];var _0x336057=_0x1bfec9?_0x3f0f8c[_0xa18e('0x2a')]:_0x3c4a50['offset']+_0x3c4a50['limit'];var _0x4aeb5a;if(_0x336057>=_0x360d37){_0x336057=_0x360d37;_0x4aeb5a=0xc8;}else{_0x4aeb5a=0xce;}_0x14558a[_0xa18e('0x25')](_0x4aeb5a);return _0x14558a[_0xa18e('0x2b')](_0xa18e('0x2c'),_0xabd760+'-'+_0x336057+'/'+_0x360d37)[_0xa18e('0x26')](_0x3f0f8c);}return null;};}function patchUpdates(_0x50e765){return function(_0x16ceb4){try{jsonpatch[_0xa18e('0x2d')](_0x16ceb4,_0x50e765,!![]);}catch(_0x1f32a4){return BPromise['reject'](_0x1f32a4);}return _0x16ceb4[_0xa18e('0x2e')]();};}function saveUpdates(_0x40d2ae,_0x529034){return function(_0x4156f1){if(_0x4156f1){return _0x4156f1[_0xa18e('0x2f')](_0x40d2ae)[_0xa18e('0x30')](function(_0xd0b2e7){return _0xd0b2e7;});}return null;};}function removeEntity(_0x7d2993,_0x45602d){return function(_0x43e0a4){if(_0x43e0a4){return _0x43e0a4[_0xa18e('0x31')]()[_0xa18e('0x30')](function(){_0x7d2993['status'](0xcc)[_0xa18e('0x32')]();});}};}function handleEntityNotFound(_0x27087a,_0x22ec1b){return function(_0x4fee76){if(!_0x4fee76){_0x27087a[_0xa18e('0x24')](0x194);}return _0x4fee76;};}function handleError(_0x4bc626,_0x21b326){_0x21b326=_0x21b326||0x1f4;return function(_0x34570f){logger[_0xa18e('0x1e')](_0x34570f[_0xa18e('0x33')]);if(_0x34570f['name']){delete _0x34570f['name'];}_0x4bc626[_0xa18e('0x25')](_0x21b326)['send'](_0x34570f);};}exports[_0xa18e('0x34')]=function(_0x38b803,_0xafe5f7){var _0x5ac867={},_0x27af2f={},_0x3d8d6b={'count':0x0,'rows':[]};var _0x2de146=_['map'](db[_0xa18e('0x35')][_0xa18e('0x36')],function(_0x56d214){return{'name':_0x56d214['fieldName'],'type':_0x56d214[_0xa18e('0x37')][_0xa18e('0x38')]};});_0x27af2f[_0xa18e('0x39')]=_[_0xa18e('0x3a')](_0x2de146,_0xa18e('0x3b'));_0x27af2f[_0xa18e('0x3c')]=_[_0xa18e('0x3d')](_0x38b803[_0xa18e('0x3c')]);_0x27af2f['filters']=_[_0xa18e('0x3e')](_0x27af2f['model'],_0x27af2f[_0xa18e('0x3c')]);_0x5ac867[_0xa18e('0x3f')]=_[_0xa18e('0x3e')](_0x27af2f[_0xa18e('0x39')],qs['fields'](_0x38b803[_0xa18e('0x3c')][_0xa18e('0x40')]));_0x5ac867[_0xa18e('0x3f')]=_0x5ac867[_0xa18e('0x3f')][_0xa18e('0x41')]?_0x5ac867[_0xa18e('0x3f')]:_0x27af2f['model'];if(!_0x38b803[_0xa18e('0x3c')][_0xa18e('0x42')](_0xa18e('0x43'))){_0x5ac867[_0xa18e('0x29')]=qs[_0xa18e('0x29')](_0x38b803[_0xa18e('0x3c')][_0xa18e('0x29')]);_0x5ac867[_0xa18e('0x27')]=qs[_0xa18e('0x27')](_0x38b803['query']['offset']);}_0x5ac867[_0xa18e('0x44')]=qs[_0xa18e('0x45')](_0x38b803[_0xa18e('0x3c')][_0xa18e('0x45')]);_0x5ac867[_0xa18e('0x46')]=qs[_0xa18e('0x47')](_[_0xa18e('0x48')](_0x38b803[_0xa18e('0x3c')],_0x27af2f[_0xa18e('0x47')]),_0x2de146);if(_0x38b803[_0xa18e('0x3c')][_0xa18e('0x49')]){_0x5ac867[_0xa18e('0x46')]=_['merge'](_0x5ac867[_0xa18e('0x46')],{'$or':_[_0xa18e('0x3a')](_0x2de146,function(_0xab7be){if(_0xab7be[_0xa18e('0x37')]!==_0xa18e('0x4a')){var _0x214958={};_0x214958[_0xab7be[_0xa18e('0x3b')]]={'$like':'%'+_0x38b803[_0xa18e('0x3c')][_0xa18e('0x49')]+'%'};return _0x214958;}})});}_0x5ac867=_[_0xa18e('0x4b')]({},_0x5ac867,_0x38b803[_0xa18e('0x4c')]);var _0x5a7f0d={'where':_0x5ac867['where']};return db['Setting'][_0xa18e('0x2a')](_0x5a7f0d)[_0xa18e('0x30')](function(_0x46c1cc){_0x3d8d6b[_0xa18e('0x2a')]=_0x46c1cc;if(_0x38b803['query'][_0xa18e('0x4d')]){_0x5ac867['include']=[{'all':!![]}];}return db[_0xa18e('0x35')][_0xa18e('0x4e')](_0x5ac867);})['then'](function(_0x3ccdd8){_0x3d8d6b[_0xa18e('0x4f')]=_0x3ccdd8;return _0x3d8d6b;})[_0xa18e('0x30')](respondWithFilteredResult(_0xafe5f7,_0x5ac867))[_0xa18e('0x23')](handleError(_0xafe5f7,null));};exports[_0xa18e('0x50')]=function(_0x373371,_0x3976e9){var _0x3b2690={'raw':![],'where':{'id':_0x373371[_0xa18e('0x51')]['id']}},_0xdeaa4f={};_0xdeaa4f[_0xa18e('0x39')]=_[_0xa18e('0x3d')](db[_0xa18e('0x35')][_0xa18e('0x36')]);_0xdeaa4f[_0xa18e('0x3c')]=_[_0xa18e('0x3d')](_0x373371[_0xa18e('0x3c')]);_0xdeaa4f[_0xa18e('0x47')]=_['intersection'](_0xdeaa4f[_0xa18e('0x39')],_0xdeaa4f[_0xa18e('0x3c')]);_0x3b2690[_0xa18e('0x3f')]=_[_0xa18e('0x3e')](_0xdeaa4f[_0xa18e('0x39')],qs['fields'](_0x373371['query'][_0xa18e('0x40')]));_0x3b2690['attributes']=_0x3b2690[_0xa18e('0x3f')]['length']?_0x3b2690[_0xa18e('0x3f')]:_0xdeaa4f[_0xa18e('0x39')];if(_0x373371[_0xa18e('0x3c')][_0xa18e('0x4d')]){_0x3b2690['include']=[{'all':!![]}];}_0x3b2690=_[_0xa18e('0x4b')]({},_0x3b2690,_0x373371[_0xa18e('0x4c')]);return db['Setting']['find'](_0x3b2690)['then'](handleEntityNotFound(_0x3976e9,null))[_0xa18e('0x30')](respondWithResult(_0x3976e9,null))['catch'](handleError(_0x3976e9,null));};exports[_0xa18e('0x2f')]=function(_0x3f46ec,_0x5d54e1){if(_0x3f46ec[_0xa18e('0x52')]['id']){delete _0x3f46ec['body']['id'];}return db['Setting'][_0xa18e('0x53')]({'where':{'id':_0x3f46ec['params']['id']}})[_0xa18e('0x30')](handleEntityNotFound(_0x5d54e1,null))[_0xa18e('0x30')](saveUpdates(_0x3f46ec['body'],null))[_0xa18e('0x30')](respondWithResult(_0x5d54e1,null))[_0xa18e('0x23')](handleError(_0x5d54e1,null));};exports[_0xa18e('0x54')]=function(_0x185a25,_0x45b90f,_0x27ba20){if(_0x185a25[_0xa18e('0x55')]&&_0x185a25[_0xa18e('0x55')][_0xa18e('0x56')]){_0x185a25[_0xa18e('0x52')][_0xa18e('0x57')]=_0x185a25[_0xa18e('0x55')][_0xa18e('0x56')];}return db['Setting']['find']({'where':{'id':_0x185a25[_0xa18e('0x51')]['id']}})[_0xa18e('0x30')](handleEntityNotFound(_0x45b90f,null))['then'](saveUpdates(_0x185a25[_0xa18e('0x52')],null))['then'](respondWithResult(_0x45b90f,null))[_0xa18e('0x23')](handleError(_0x45b90f,null));};exports[_0xa18e('0x58')]=function(_0x1b1af2,_0x42a050,_0x12a2f3){if(_0x1b1af2[_0xa18e('0x55')]&&_0x1b1af2[_0xa18e('0x55')][_0xa18e('0x56')]){_0x1b1af2[_0xa18e('0x52')][_0xa18e('0x59')]=_0x1b1af2[_0xa18e('0x55')]['filename'];}return db[_0xa18e('0x35')][_0xa18e('0x53')]({'where':{'id':_0x1b1af2[_0xa18e('0x51')]['id']}})['then'](handleEntityNotFound(_0x42a050,null))[_0xa18e('0x30')](saveUpdates(_0x1b1af2['body'],null))['then'](respondWithResult(_0x42a050,null))[_0xa18e('0x23')](handleError(_0x42a050,null));};var utilLicense=require(_0xa18e('0x16'));exports[_0xa18e('0x5a')]=function(_0x45f199,_0x5d20a2,_0x3be638){var _0x50ff85=_0xa18e('0x5b');var _0x5bd898={'custom':![]};return utilLicense[_0xa18e('0x5c')]()[_0xa18e('0x30')](function(_0x3dc0b5){if(_0x3dc0b5){_0x5bd898=_0x3dc0b5;}return db[_0xa18e('0x35')][_0xa18e('0x53')]({'where':{'id':_0x45f199[_0xa18e('0x51')]['id']},'attributes':[_0xa18e('0x57'),_0xa18e('0x59'),'preferred',_0xa18e('0x5d'),_0xa18e('0x5e'),_0xa18e('0x5f'),'defaultPreferred',_0xa18e('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d20a2,null))[_0xa18e('0x30')](function(_0x1f0bc9){if(_0x1f0bc9){var _0x128492=_0x1f0bc9[_0xa18e('0x57')]&&fs['existsSync'](path['join'](config[_0xa18e('0x61')],_0x50ff85,_[_0xa18e('0x62')](_0x1f0bc9[_0xa18e('0x57')])))?path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x50ff85,_['toLower'](_0x1f0bc9['logo'])):path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x50ff85,_['toLower'](_0xa18e('0x64')));var _0x487beb=_0xa18e('0x65')+_[_0xa18e('0x66')](_0xa18e('0x57'));if(_0x1f0bc9[_0x487beb]||!_0x5bd898[_0xa18e('0x67')]){_0x128492=path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x50ff85,_[_0xa18e('0x62')](_0xa18e('0x64')));}if(!fs[_0xa18e('0x68')](_0x128492)){throw new db[(_0xa18e('0x69'))][(_0xa18e('0x6a'))](_[_0xa18e('0x66')]('logo')+'\x20not\x20found');}return _0x5d20a2[_0xa18e('0x6b')](_0x128492);}})[_0xa18e('0x23')](handleError(_0x5d20a2,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x7a08ed,_0x3b1bff,_0x2e7f16){var _0x3a86ff=_0xa18e('0x5b');var _0x5162d7={'custom':![]};return utilLicense[_0xa18e('0x5c')]()[_0xa18e('0x30')](function(_0x3aea59){if(_0x3aea59){_0x5162d7=_0x3aea59;}return db[_0xa18e('0x35')]['find']({'where':{'id':_0x7a08ed[_0xa18e('0x51')]['id']},'attributes':[_0xa18e('0x57'),'loginLogo',_0xa18e('0x6c'),_0xa18e('0x5d'),_0xa18e('0x5e'),_0xa18e('0x5f'),_0xa18e('0x6d'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3b1bff,null))['then'](function(_0x29fc73){if(_0x29fc73){var _0x2a5c91=_0x29fc73['loginLogo']&&fs[_0xa18e('0x68')](path[_0xa18e('0x63')](config['root'],_0x3a86ff,_[_0xa18e('0x62')](_0x29fc73[_0xa18e('0x59')])))?path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x3a86ff,_[_0xa18e('0x62')](_0x29fc73[_0xa18e('0x59')])):path[_0xa18e('0x63')](config['root'],_0x3a86ff,_['toLower'](_0xa18e('0x6e')));var _0x3d1173=_0xa18e('0x65')+_[_0xa18e('0x66')]('loginLogo');if(_0x29fc73[_0x3d1173]||!_0x5162d7['custom']){_0x2a5c91=path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x3a86ff,_[_0xa18e('0x62')]('default_loginLogo.svg'));}if(!fs[_0xa18e('0x68')](_0x2a5c91)){throw new db[(_0xa18e('0x69'))]['ValidationError'](_[_0xa18e('0x66')]('loginLogo')+'\x20not\x20found');}return _0x3b1bff[_0xa18e('0x6b')](_0x2a5c91);}})[_0xa18e('0x23')](handleError(_0x3b1bff,null));};exports['gdpr']=function(_0x325ddb,_0x3d791c){return db['Setting'][_0xa18e('0x53')]({'where':{'id':_0x325ddb[_0xa18e('0x51')]['id']},'attributes':[_0xa18e('0x6f')]})['then'](respondWithResult(_0x3d791c,null))[_0xa18e('0x23')](handleError(_0x3d791c,null));};exports[_0xa18e('0x70')]=function(_0x9d4e50,_0x582bc3,_0x34362a){if(_0x9d4e50[_0xa18e('0x55')]&&_0x9d4e50[_0xa18e('0x55')][_0xa18e('0x56')]){_0x9d4e50['body'][_0xa18e('0x6c')]=_0x9d4e50[_0xa18e('0x55')][_0xa18e('0x56')];}return db[_0xa18e('0x35')]['find']({'where':{'id':_0x9d4e50[_0xa18e('0x51')]['id']}})[_0xa18e('0x30')](handleEntityNotFound(_0x582bc3,null))[_0xa18e('0x30')](saveUpdates(_0x9d4e50['body'],null))[_0xa18e('0x30')](respondWithResult(_0x582bc3,null))['catch'](handleError(_0x582bc3,null));};var utilLicense=require(_0xa18e('0x16'));exports[_0xa18e('0x71')]=function(_0x18c899,_0x14486f,_0x2ec8d4){var _0x3c77b8=_0xa18e('0x5b');var _0x5e5cbb={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2e4b54){if(_0x2e4b54){_0x5e5cbb=_0x2e4b54;}return db[_0xa18e('0x35')][_0xa18e('0x53')]({'where':{'id':_0x18c899[_0xa18e('0x51')]['id']},'attributes':[_0xa18e('0x57'),'loginLogo',_0xa18e('0x6c'),'favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa18e('0x30')](handleEntityNotFound(_0x14486f,null))['then'](function(_0x40f1f1){if(_0x40f1f1){var _0x2fa396=_0x40f1f1[_0xa18e('0x6c')]&&fs[_0xa18e('0x68')](path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x3c77b8,_[_0xa18e('0x62')](_0x40f1f1[_0xa18e('0x6c')])))?path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x3c77b8,_[_0xa18e('0x62')](_0x40f1f1[_0xa18e('0x6c')])):path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x3c77b8,_['toLower'](_0xa18e('0x72')));var _0x2c419f=_0xa18e('0x65')+_[_0xa18e('0x66')](_0xa18e('0x6c'));if(_0x40f1f1[_0x2c419f]||!_0x5e5cbb[_0xa18e('0x67')]||!_0x5e5cbb['preferred']){_0x2fa396=path['join'](config[_0xa18e('0x61')],_0x3c77b8,_['toLower'](_0xa18e('0x72')));}if(!fs[_0xa18e('0x68')](_0x2fa396)){throw new db[(_0xa18e('0x69'))][(_0xa18e('0x6a'))](_[_0xa18e('0x66')](_0xa18e('0x6c'))+_0xa18e('0x73'));}return _0x14486f[_0xa18e('0x6b')](_0x2fa396);}})[_0xa18e('0x23')](handleError(_0x14486f,null));};exports[_0xa18e('0x74')]=function(_0x455367,_0x55f1bb,_0x4137cb){if(_0x455367['file']&&_0x455367[_0xa18e('0x55')][_0xa18e('0x56')]){_0x455367[_0xa18e('0x52')][_0xa18e('0x5d')]=_0x455367[_0xa18e('0x55')]['filename'];}return db[_0xa18e('0x35')]['find']({'where':{'id':_0x455367[_0xa18e('0x51')]['id']}})[_0xa18e('0x30')](handleEntityNotFound(_0x55f1bb,null))[_0xa18e('0x30')](saveUpdates(_0x455367[_0xa18e('0x52')],null))[_0xa18e('0x30')](respondWithResult(_0x55f1bb,null))[_0xa18e('0x23')](handleError(_0x55f1bb,null));};var utilLicense=require(_0xa18e('0x16'));exports[_0xa18e('0x75')]=function(_0x4b68c1,_0x2ec4fa,_0x478fa7){var _0x4845dc=_0xa18e('0x5b');var _0x1baf0b={'custom':![]};return utilLicense[_0xa18e('0x5c')]()['then'](function(_0x5c8643){if(_0x5c8643){_0x1baf0b=_0x5c8643;}return db[_0xa18e('0x35')][_0xa18e('0x53')]({'where':{'id':_0x4b68c1[_0xa18e('0x51')]['id']},'attributes':[_0xa18e('0x57'),_0xa18e('0x59'),_0xa18e('0x6c'),_0xa18e('0x5d'),_0xa18e('0x5e'),_0xa18e('0x5f'),_0xa18e('0x6d'),_0xa18e('0x60')],'raw':!![]});})[_0xa18e('0x30')](handleEntityNotFound(_0x2ec4fa,null))[_0xa18e('0x30')](function(_0x2e663d){if(_0x2e663d){var _0x4708e3=_0x2e663d[_0xa18e('0x5d')]&&fs[_0xa18e('0x68')](path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x4845dc,_[_0xa18e('0x62')](_0x2e663d['favicon'])))?path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x4845dc,_[_0xa18e('0x62')](_0x2e663d['favicon'])):path[_0xa18e('0x63')](config[_0xa18e('0x61')],_0x4845dc,_[_0xa18e('0x62')](_0xa18e('0x76')));var _0x155efd=_0xa18e('0x65')+_[_0xa18e('0x66')]('favicon');if(_0x2e663d[_0x155efd]||!_0x1baf0b[_0xa18e('0x67')]){_0x4708e3=path['join'](config[_0xa18e('0x61')],_0x4845dc,_['toLower'](_0xa18e('0x76')));}if(!fs['existsSync'](_0x4708e3)){throw new db[(_0xa18e('0x69'))][(_0xa18e('0x6a'))](_[_0xa18e('0x66')](_0xa18e('0x5d'))+_0xa18e('0x73'));}return _0x2ec4fa[_0xa18e('0x6b')](_0x4708e3);}})[_0xa18e('0x23')](handleError(_0x2ec4fa,null));};exports[_0xa18e('0x77')]=function(_0x1358e3,_0x2713a9){var _0x34e8e7={'offset':moment()[_0xa18e('0x78')]()};_0x34e8e7[_0xa18e('0x79')]=moment()[_0xa18e('0x78')](_0x34e8e7[_0xa18e('0x27')])['format'](_0xa18e('0x7a'));return _0x2713a9[_0xa18e('0x25')](0xc8)[_0xa18e('0x7b')](_0x34e8e7);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index d0527b6..1e779f9 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x307a48,_0x178fff){var _0x5d542f=function(_0x459ec9){while(--_0x459ec9){_0x307a48['push'](_0x307a48['shift']());}};_0x5d542f(++_0x178fff);}(_0xe14b,0x93));var _0xbe14=function(_0x27404c,_0x4e8a5e){_0x27404c=_0x27404c-0x0;var _0xe944a0=_0xe14b[_0x27404c];return _0xe944a0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x414810,_0x5e924d){var _0x2d4df5=function(_0x390860){while(--_0x390860){_0x414810['push'](_0x414810['shift']());}};_0x2d4df5(++_0x5e924d);}(_0x3e74,0x175));var _0x43e7=function(_0x573c75,_0x38a8d3){_0x573c75=_0x573c75-0x0;var _0x8a9ff=_0x3e74[_0x573c75];return _0x8a9ff;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 39f3dc8..556844b 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 _0x72ee=['ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','debug','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','result','catch'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x72ee,0x1b9));var _0xe72e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x72ee[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xe72e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe72e('0x1'));var rs=require(_0xe72e('0x2'));var fs=require('fs');var Redis=require(_0xe72e('0x3'));var db=require(_0xe72e('0x4'))['db'];var utils=require(_0xe72e('0x5'));var logger=require(_0xe72e('0x6'))(_0xe72e('0x7'));var config=require('../../config/environment');var jayson=require(_0xe72e('0x8'));var client=jayson[_0xe72e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x541a53,_0x6e2f6c,_0x15ff0c){return new BPromise(function(_0x2ef6cc,_0x23c3cc){return client[_0xe72e('0xa')](_0x541a53,_0x15ff0c)[_0xe72e('0xb')](function(_0x38bbbf){logger[_0xe72e('0xc')]('Setting,\x20%s,\x20%s',_0x6e2f6c,_0xe72e('0xd'));logger['debug'](_0xe72e('0xe'),_0x6e2f6c,_0xe72e('0xd'),JSON['stringify'](_0x38bbbf));if(_0x38bbbf[_0xe72e('0xf')]){if(_0x38bbbf[_0xe72e('0xf')][_0xe72e('0x10')]===0x1f4){logger[_0xe72e('0xf')](_0xe72e('0x11'),_0x6e2f6c,_0x38bbbf['error'][_0xe72e('0x12')]);return _0x23c3cc(_0x38bbbf[_0xe72e('0xf')][_0xe72e('0x12')]);}logger[_0xe72e('0xf')](_0xe72e('0x11'),_0x6e2f6c,_0x38bbbf[_0xe72e('0xf')][_0xe72e('0x12')]);return _0x2ef6cc(_0x38bbbf[_0xe72e('0xf')][_0xe72e('0x12')]);}else{logger['info'](_0xe72e('0x11'),_0x6e2f6c,_0xe72e('0xd'));_0x2ef6cc(_0x38bbbf[_0xe72e('0x13')][_0xe72e('0x12')]);}})[_0xe72e('0x14')](function(_0x580507){logger[_0xe72e('0xf')]('Setting,\x20%s,\x20%s',_0x6e2f6c,_0x580507);_0x23c3cc(_0x580507);});});}exports[_0xe72e('0x15')]=function(_0x40079d){var _0x408337=this;return new Promise(function(_0x1b8d69,_0x5ec5e8){return db[_0xe72e('0x16')][_0xe72e('0x17')]({'raw':_0x40079d[_0xe72e('0x18')]?_0x40079d[_0xe72e('0x18')][_0xe72e('0x19')]===undefined?!![]:![]:!![],'where':_0x40079d[_0xe72e('0x18')]?_0x40079d[_0xe72e('0x18')][_0xe72e('0x1a')]||null:null,'attributes':_0x40079d[_0xe72e('0x18')]?_0x40079d[_0xe72e('0x18')][_0xe72e('0x1b')]||null:null,'include':_0x40079d[_0xe72e('0x18')]?_0x40079d[_0xe72e('0x18')][_0xe72e('0x1c')]?_[_0xe72e('0x1d')](_0x40079d[_0xe72e('0x18')][_0xe72e('0x1c')],function(_0x4bffd7){return{'model':db[_0x4bffd7['model']],'as':_0x4bffd7['as'],'attributes':_0x4bffd7[_0xe72e('0x1b')],'include':_0x4bffd7[_0xe72e('0x1c')]?_[_0xe72e('0x1d')](_0x4bffd7[_0xe72e('0x1c')],function(_0x58271e){return{'model':db[_0x58271e[_0xe72e('0x1e')]],'as':_0x58271e['as'],'attributes':_0x58271e[_0xe72e('0x1b')],'include':_0x58271e[_0xe72e('0x1c')]?_[_0xe72e('0x1d')](_0x58271e[_0xe72e('0x1c')],function(_0x583b9e){return{'model':db[_0x583b9e['model']],'as':_0x583b9e['as'],'attributes':_0x583b9e[_0xe72e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe72e('0xb')](function(_0x7b164b){logger[_0xe72e('0xc')](_0xe72e('0x15'),_0x40079d);logger[_0xe72e('0x1f')]('ShowSetting',_0x40079d,JSON[_0xe72e('0x20')](_0x7b164b));_0x1b8d69(_0x7b164b);})['catch'](function(_0x44d908){logger[_0xe72e('0xf')](_0xe72e('0x15'),_0x44d908[_0xe72e('0x12')],_0x40079d);_0x5ec5e8(_0x408337[_0xe72e('0xf')](0x1f4,_0x44d908[_0xe72e('0x12')]));});});}; \ No newline at end of file +var _0xdac3=['stringify','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','attributes','include','model','map'];(function(_0x316838,_0x39ff59){var _0x560c93=function(_0x16e813){while(--_0x16e813){_0x316838['push'](_0x316838['shift']());}};_0x560c93(++_0x39ff59);}(_0xdac3,0xc1));var _0x3dac=function(_0x5a33e5,_0xf91e32){_0x5a33e5=_0x5a33e5-0x0;var _0x3e73dd=_0xdac3[_0x5a33e5];return _0x3e73dd;};'use strict';var _=require('lodash');var util=require(_0x3dac('0x0'));var moment=require(_0x3dac('0x1'));var BPromise=require(_0x3dac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dac('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3dac('0x4'));var logger=require(_0x3dac('0x5'))(_0x3dac('0x6'));var config=require('../../config/environment');var jayson=require(_0x3dac('0x7'));var client=jayson[_0x3dac('0x8')][_0x3dac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ba886,_0x49f4ed,_0x199e44){return new BPromise(function(_0x14fa29,_0x57bf0a){return client[_0x3dac('0xa')](_0x5ba886,_0x199e44)[_0x3dac('0xb')](function(_0x2f9897){logger[_0x3dac('0xc')](_0x3dac('0xd'),_0x49f4ed,_0x3dac('0xe'));logger[_0x3dac('0xf')](_0x3dac('0x10'),_0x49f4ed,_0x3dac('0xe'),JSON['stringify'](_0x2f9897));if(_0x2f9897[_0x3dac('0x11')]){if(_0x2f9897[_0x3dac('0x11')][_0x3dac('0x12')]===0x1f4){logger[_0x3dac('0x11')]('Setting,\x20%s,\x20%s',_0x49f4ed,_0x2f9897[_0x3dac('0x11')][_0x3dac('0x13')]);return _0x57bf0a(_0x2f9897['error']['message']);}logger['error']('Setting,\x20%s,\x20%s',_0x49f4ed,_0x2f9897['error'][_0x3dac('0x13')]);return _0x14fa29(_0x2f9897[_0x3dac('0x11')]['message']);}else{logger[_0x3dac('0xc')](_0x3dac('0xd'),_0x49f4ed,_0x3dac('0xe'));_0x14fa29(_0x2f9897[_0x3dac('0x14')]['message']);}})[_0x3dac('0x15')](function(_0x35c5e7){logger[_0x3dac('0x11')](_0x3dac('0xd'),_0x49f4ed,_0x35c5e7);_0x57bf0a(_0x35c5e7);});});}exports[_0x3dac('0x16')]=function(_0x906f22){var _0x449d55=this;return new Promise(function(_0x1eb8b7,_0x1e2c4c){return db[_0x3dac('0x17')][_0x3dac('0x18')]({'raw':_0x906f22[_0x3dac('0x19')]?_0x906f22[_0x3dac('0x19')][_0x3dac('0x1a')]===undefined?!![]:![]:!![],'where':_0x906f22[_0x3dac('0x19')]?_0x906f22['options']['where']||null:null,'attributes':_0x906f22[_0x3dac('0x19')]?_0x906f22[_0x3dac('0x19')][_0x3dac('0x1b')]||null:null,'include':_0x906f22[_0x3dac('0x19')]?_0x906f22['options'][_0x3dac('0x1c')]?_['map'](_0x906f22[_0x3dac('0x19')][_0x3dac('0x1c')],function(_0x24a4c5){return{'model':db[_0x24a4c5[_0x3dac('0x1d')]],'as':_0x24a4c5['as'],'attributes':_0x24a4c5['attributes'],'include':_0x24a4c5['include']?_[_0x3dac('0x1e')](_0x24a4c5['include'],function(_0x88d26d){return{'model':db[_0x88d26d[_0x3dac('0x1d')]],'as':_0x88d26d['as'],'attributes':_0x88d26d[_0x3dac('0x1b')],'include':_0x88d26d['include']?_[_0x3dac('0x1e')](_0x88d26d['include'],function(_0x4790e6){return{'model':db[_0x4790e6[_0x3dac('0x1d')]],'as':_0x4790e6['as'],'attributes':_0x4790e6[_0x3dac('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13e621){logger[_0x3dac('0xc')]('ShowSetting',_0x906f22);logger[_0x3dac('0xf')](_0x3dac('0x16'),_0x906f22,JSON[_0x3dac('0x1f')](_0x13e621));_0x1eb8b7(_0x13e621);})['catch'](function(_0x2fe9bf){logger[_0x3dac('0x11')](_0x3dac('0x16'),_0x2fe9bf['message'],_0x906f22);_0x1e2c4c(_0x449d55[_0x3dac('0x11')](0x1f4,_0x2fe9bf['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7b45097..0cb413e 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x22241e,_0x10c0c6){var _0x2be510=function(_0x3dd7ca){while(--_0x3dd7ca){_0x22241e['push'](_0x22241e['shift']());}};_0x2be510(++_0x10c0c6);}(_0x7a54,0x106));var _0x47a5=function(_0x301f0e,_0x3869a4){_0x301f0e=_0x301f0e-0x0;var _0x315c44=_0x7a54[_0x301f0e];return _0x315c44;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x39df29,_0x450cdc){var _0x4cecc6=function(_0x32c11d){while(--_0x32c11d){_0x39df29['push'](_0x39df29['shift']());}};_0x4cecc6(++_0x450cdc);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index d73af62..3e13c3f 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 _0x2c2e=['sequelize','randomstring','STRING','name','ENUM','twilio','skebby','plivo','clickatell','bandwidth','csc','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0xcd001b,_0x350354){var _0x37e09f=function(_0x26f2e5){while(--_0x26f2e5){_0xcd001b['push'](_0xcd001b['shift']());}};_0x37e09f(++_0x350354);}(_0x2c2e,0x1f0));var _0xe2c2=function(_0x5162a7,_0x48ffc6){_0x5162a7=_0x5162a7-0x0;var _0x201178=_0x2c2e[_0x5162a7];return _0x201178;};'use strict';var Sequelize=require(_0xe2c2('0x0'));var rs=require(_0xe2c2('0x1'));module['exports']={'name':{'type':Sequelize[_0xe2c2('0x2')],'unique':_0xe2c2('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe2c2('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xe2c2('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xe2c2('0x2')]},'type':{'type':Sequelize[_0xe2c2('0x4')](_0xe2c2('0x5'),_0xe2c2('0x6'),'connectel','clicksend',_0xe2c2('0x7'),_0xe2c2('0x8'),_0xe2c2('0x9'),_0xe2c2('0xa'),'infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xe2c2('0x2')]},'authToken':{'type':Sequelize[_0xe2c2('0x2')]},'smsMethod':{'type':Sequelize[_0xe2c2('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe2c2('0x2')]},'password':{'type':Sequelize[_0xe2c2('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xe2c2('0x2')]},'senderString':{'type':Sequelize[_0xe2c2('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xe2c2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe2c2('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe2c2('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe2c2('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe2c2('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe2c2('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe2c2('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe2c2('0xb')],'defaultValue':![],'comment':_0xe2c2('0xd'),'set':function(_0x2a1a88){if(!_0x2a1a88)this[_0xe2c2('0xe')](_0xe2c2('0xf'),null);this[_0xe2c2('0xe')]('mandatoryDisposition',_0x2a1a88);}}}; \ No newline at end of file +var _0xa4cf=['sequelize','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x466b5b,_0x1a94f0){var _0x4b4f18=function(_0x5199af){while(--_0x5199af){_0x466b5b['push'](_0x466b5b['shift']());}};_0x4b4f18(++_0x1a94f0);}(_0xa4cf,0x1e3));var _0xfa4c=function(_0x3a10f1,_0x26f68e){_0x3a10f1=_0x3a10f1-0x0;var _0x170150=_0xa4cf[_0x3a10f1];return _0x170150;};'use strict';var Sequelize=require(_0xfa4c('0x0'));var rs=require('randomstring');module[_0xfa4c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfa4c('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xfa4c('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xfa4c('0x3')],'defaultValue':function(){return rs[_0xfa4c('0x4')]();}},'phone':{'type':Sequelize[_0xfa4c('0x3')]},'type':{'type':Sequelize[_0xfa4c('0x5')](_0xfa4c('0x6'),_0xfa4c('0x7'),_0xfa4c('0x8'),_0xfa4c('0x9'),_0xfa4c('0xa'),_0xfa4c('0xb'),_0xfa4c('0xc'),_0xfa4c('0xd'),'infobip',_0xfa4c('0xe'))},'accountSid':{'type':Sequelize[_0xfa4c('0x3')]},'authId':{'type':Sequelize[_0xfa4c('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xfa4c('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xfa4c('0x3')]},'password':{'type':Sequelize[_0xfa4c('0x3')]},'apiKey':{'type':Sequelize[_0xfa4c('0x3')]},'applicationId':{'type':Sequelize[_0xfa4c('0x3')]},'accountId':{'type':Sequelize[_0xfa4c('0x3')]},'senderString':{'type':Sequelize[_0xfa4c('0x3')]},'deliveryReport':{'type':Sequelize[_0xfa4c('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xfa4c('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xfa4c('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa4c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfa4c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfa4c('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfa4c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfa4c('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfa4c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xfa4c('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfa4c('0x11')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfa4c('0xf')],'defaultValue':![],'comment':_0xfa4c('0x12'),'set':function(_0x2bd203){if(!_0x2bd203)this[_0xfa4c('0x13')]('mandatoryDispositionPauseId',null);this[_0xfa4c('0x13')](_0xfa4c('0x14'),_0x2bd203);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2601a63..69d4a2c 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 _0x610c=['Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','SmsAccount','includeAll','include','rows','show','params','keys','filters','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','Disposition','getDispositions','findOne','SmsAccountId','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','notify','sms','SmsApplication','Applications','account','orderBy','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','mapKey','CmContact','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','SmsQueue','queueId','queue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','stack','finally','getApplications','hasOwnProperty','pick','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','groupName','clickatell','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','get','SmsAccounts','UserProfileResource','destroy','end','name','send'];(function(_0x35b87c,_0x166a8c){var _0x24795b=function(_0x2cb112){while(--_0x2cb112){_0x35b87c['push'](_0x35b87c['shift']());}};_0x24795b(++_0x166a8c);}(_0x610c,0x19c));var _0xc610=function(_0x434f80,_0x4c8ceb){_0x434f80=_0x434f80-0x0;var _0x2bb9fe=_0x610c[_0x434f80];return _0x2bb9fe;};'use strict';var emlformat=require(_0xc610('0x0'));var rimraf=require(_0xc610('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc610('0x2'));var rp=require(_0xc610('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc610('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc610('0x5'));var csv=require(_0xc610('0x6'));var ejs=require(_0xc610('0x7'));var fs=require('fs');var fs_extra=require(_0xc610('0x8'));var _=require(_0xc610('0x9'));var squel=require(_0xc610('0xa'));var crypto=require(_0xc610('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc610('0xc'));var toCsv=require(_0xc610('0x6'));var querystring=require(_0xc610('0xd'));var Papa=require('papaparse');var Redis=require(_0xc610('0xe'));var authService=require(_0xc610('0xf'));var qs=require(_0xc610('0x10'));var as=require(_0xc610('0x11'));var hardwareService=require(_0xc610('0x12'));var logger=require(_0xc610('0x13'))(_0xc610('0x14'));var utils=require('../../config/utils');var config=require(_0xc610('0x15'));var licenseUtil=require(_0xc610('0x16'));var db=require('../../mysqldb')['db'];config[_0xc610('0x17')]=_[_0xc610('0x18')](config[_0xc610('0x17')],{'host':_0xc610('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc610('0x17')]));require(_0xc610('0x1a'))[_0xc610('0x1b')](socket);var jayson=require(_0xc610('0x1c'));var client=jayson[_0xc610('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2b4dd9,_0x143bdd,_0x3d9da4,_0x4aae19){return new BPromise(function(_0x48cde6,_0x383415){var _0x3ef303=_0x4aae19||client;return _0x3ef303['request'](_0x2b4dd9,_0x3d9da4)[_0xc610('0x1e')](function(_0x4ccb50){logger[_0xc610('0x1f')](_0xc610('0x20'),_0x143bdd,_0xc610('0x21'));logger['debug'](_0xc610('0x22'),_0x143bdd,_0xc610('0x21'),JSON[_0xc610('0x23')](_0x4ccb50));if(_0x4ccb50['error']){if(_0x4ccb50['error'][_0xc610('0x24')]===0x1f4){logger[_0xc610('0x25')](_0xc610('0x20'),_0x143bdd,_0x4ccb50[_0xc610('0x25')][_0xc610('0x26')]);return _0x383415(_0x4ccb50[_0xc610('0x25')][_0xc610('0x26')]);}logger[_0xc610('0x25')](_0xc610('0x20'),_0x143bdd,_0x4ccb50[_0xc610('0x25')][_0xc610('0x26')]);return _0x48cde6(_0x4ccb50[_0xc610('0x25')][_0xc610('0x26')]);}else{logger['info'](_0xc610('0x20'),_0x143bdd,_0xc610('0x21'));_0x48cde6(_0x4ccb50[_0xc610('0x27')][_0xc610('0x26')]);}})[_0xc610('0x28')](function(_0x5ec6c9){logger['error'](_0xc610('0x20'),_0x143bdd,_0x5ec6c9);_0x383415(_0x5ec6c9);});});}function respondWithStatusCode(_0x332e07,_0x20b84e){_0x20b84e=_0x20b84e||0xcc;return function(_0x19ce4f){if(_0x19ce4f){return _0x332e07[_0xc610('0x29')](_0x20b84e);}return _0x332e07[_0xc610('0x2a')](_0x20b84e)['end']();};}function respondWithResult(_0x127890,_0x17e177){_0x17e177=_0x17e177||0xc8;return function(_0x25b4fb){if(_0x25b4fb){return _0x127890['status'](_0x17e177)[_0xc610('0x2b')](_0x25b4fb);}};}function respondWithFilteredResult(_0x476191,_0x32491b){return function(_0x47cb06){if(_0x47cb06){var _0x2a99b9=typeof _0x32491b['offset']===_0xc610('0x2c')&&typeof _0x32491b[_0xc610('0x2d')]===_0xc610('0x2c');var _0xfd0c7b=_0x47cb06[_0xc610('0x2e')];var _0x516edd=_0x2a99b9?0x0:_0x32491b[_0xc610('0x2f')];var _0x4bb678=_0x2a99b9?_0x47cb06[_0xc610('0x2e')]:_0x32491b[_0xc610('0x2f')]+_0x32491b[_0xc610('0x2d')];var _0x4e766d;if(_0x4bb678>=_0xfd0c7b){_0x4bb678=_0xfd0c7b;_0x4e766d=0xc8;}else{_0x4e766d=0xce;}_0x476191[_0xc610('0x2a')](_0x4e766d);return _0x476191[_0xc610('0x30')](_0xc610('0x31'),_0x516edd+'-'+_0x4bb678+'/'+_0xfd0c7b)[_0xc610('0x2b')](_0x47cb06);}return null;};}function patchUpdates(_0x422e3c){return function(_0x4fe41e){try{jsonpatch[_0xc610('0x32')](_0x4fe41e,_0x422e3c,!![]);}catch(_0x283822){return BPromise['reject'](_0x283822);}return _0x4fe41e[_0xc610('0x33')]();};}function saveUpdates(_0xebe152,_0x582d83){return function(_0x25f519){if(_0x25f519){return _0x25f519[_0xc610('0x34')](_0xebe152)[_0xc610('0x1e')](function(_0x1d5e09){return _0x1d5e09;});}return null;};}function removeEntity(_0xb21ebe,_0x433a5c){return function(_0x53ddd6){if(_0x53ddd6){return _0x53ddd6['destroy']()['then'](function(){var _0xf34fb=_0x53ddd6[_0xc610('0x35')]({'plain':!![]});var _0x1718a8=_0xc610('0x36');return db[_0xc610('0x37')][_0xc610('0x38')]({'where':{'type':_0x1718a8,'resourceId':_0xf34fb['id']}})[_0xc610('0x1e')](function(){return _0x53ddd6;});})[_0xc610('0x1e')](function(){_0xb21ebe['status'](0xcc)[_0xc610('0x39')]();});}};}function handleEntityNotFound(_0x3e1dfb,_0x24917e){return function(_0x289c45){if(!_0x289c45){_0x3e1dfb[_0xc610('0x29')](0x194);}return _0x289c45;};}function handleError(_0x8a5151,_0x967fc8){_0x967fc8=_0x967fc8||0x1f4;return function(_0x392d29){logger[_0xc610('0x25')](_0x392d29['stack']);if(_0x392d29[_0xc610('0x3a')]){delete _0x392d29[_0xc610('0x3a')];}_0x8a5151[_0xc610('0x2a')](_0x967fc8)[_0xc610('0x3b')](_0x392d29);};}exports['index']=function(_0x2a4a5d,_0x1f98aa){var _0x4c5de1={'include':[{'model':db[_0xc610('0x3c')],'as':_0xc610('0x3d')}]},_0x227e5c={},_0x4e239b={'count':0x0,'rows':[]};var _0x49f62a=_[_0xc610('0x3e')](db['SmsAccount'][_0xc610('0x3f')],function(_0xa02a6e){return{'name':_0xa02a6e[_0xc610('0x40')],'type':_0xa02a6e[_0xc610('0x41')][_0xc610('0x42')]};});_0x227e5c[_0xc610('0x43')]=_['map'](_0x49f62a,'name');_0x227e5c[_0xc610('0x44')]=_['keys'](_0x2a4a5d[_0xc610('0x44')]);_0x227e5c['filters']=_['intersection'](_0x227e5c['model'],_0x227e5c['query']);_0x4c5de1[_0xc610('0x45')]=_[_0xc610('0x46')](_0x227e5c[_0xc610('0x43')],qs['fields'](_0x2a4a5d[_0xc610('0x44')][_0xc610('0x47')]));_0x4c5de1[_0xc610('0x45')]=_0x4c5de1[_0xc610('0x45')]['length']?_0x4c5de1[_0xc610('0x45')]:_0x227e5c[_0xc610('0x43')];if(!_0x2a4a5d[_0xc610('0x44')]['hasOwnProperty'](_0xc610('0x48'))){_0x4c5de1[_0xc610('0x2d')]=qs['limit'](_0x2a4a5d[_0xc610('0x44')]['limit']);_0x4c5de1[_0xc610('0x2f')]=qs[_0xc610('0x2f')](_0x2a4a5d[_0xc610('0x44')][_0xc610('0x2f')]);}_0x4c5de1[_0xc610('0x49')]=qs[_0xc610('0x4a')](_0x2a4a5d[_0xc610('0x44')][_0xc610('0x4a')]);_0x4c5de1[_0xc610('0x4b')]=qs['filters'](_['pick'](_0x2a4a5d[_0xc610('0x44')],_0x227e5c['filters']),_0x49f62a);if(_0x2a4a5d[_0xc610('0x44')]['filter']){_0x4c5de1['where']=_[_0xc610('0x4c')](_0x4c5de1[_0xc610('0x4b')],{'$or':_[_0xc610('0x3e')](_0x49f62a,function(_0x16745f){if(_0x16745f[_0xc610('0x41')]!==_0xc610('0x4d')){var _0x3c1c57={};_0x3c1c57[_0x16745f['name']]={'$like':'%'+_0x2a4a5d['query'][_0xc610('0x4e')]+'%'};return _0x3c1c57;}})});}_0x4c5de1=_[_0xc610('0x4c')]({},_0x4c5de1,_0x2a4a5d['options']);var _0x1fce81={'where':_0x4c5de1['where']};return db[_0xc610('0x4f')][_0xc610('0x2e')](_0x1fce81)[_0xc610('0x1e')](function(_0x5788b2){_0x4e239b['count']=_0x5788b2;if(_0x2a4a5d[_0xc610('0x44')][_0xc610('0x50')]){_0x4c5de1[_0xc610('0x51')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x4c5de1);})[_0xc610('0x1e')](function(_0x57fbaf){_0x4e239b[_0xc610('0x52')]=_0x57fbaf;return _0x4e239b;})[_0xc610('0x1e')](respondWithFilteredResult(_0x1f98aa,_0x4c5de1))[_0xc610('0x28')](handleError(_0x1f98aa,null));};exports[_0xc610('0x53')]=function(_0x4dfe45,_0x59ca1f){var _0x18c487={'raw':![],'where':{'id':_0x4dfe45[_0xc610('0x54')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1403ad={};_0x1403ad[_0xc610('0x43')]=_[_0xc610('0x55')](db[_0xc610('0x4f')]['rawAttributes']);_0x1403ad[_0xc610('0x44')]=_[_0xc610('0x55')](_0x4dfe45[_0xc610('0x44')]);_0x1403ad[_0xc610('0x56')]=_[_0xc610('0x46')](_0x1403ad['model'],_0x1403ad[_0xc610('0x44')]);_0x18c487[_0xc610('0x45')]=_[_0xc610('0x46')](_0x1403ad[_0xc610('0x43')],qs[_0xc610('0x47')](_0x4dfe45['query'][_0xc610('0x47')]));_0x18c487['attributes']=_0x18c487[_0xc610('0x45')][_0xc610('0x57')]?_0x18c487[_0xc610('0x45')]:_0x1403ad['model'];if(_0x4dfe45[_0xc610('0x44')][_0xc610('0x50')]){_0x18c487['include']=[{'all':!![]}];}_0x18c487=_[_0xc610('0x4c')]({},_0x18c487,_0x4dfe45['options']);return db['SmsAccount']['find'](_0x18c487)[_0xc610('0x1e')](handleEntityNotFound(_0x59ca1f,null))['then'](respondWithResult(_0x59ca1f,null))['catch'](handleError(_0x59ca1f,null));};exports[_0xc610('0x58')]=function(_0x3a3fef,_0x175b44){return db[_0xc610('0x4f')]['create'](_0x3a3fef['body'],{})[_0xc610('0x1e')](function(_0x19e8d3){var _0x3e0f25=_0x3a3fef['user']['get']({'plain':!![]});if(!_0x3e0f25)throw new Error(_0xc610('0x59'));if(_0x3e0f25[_0xc610('0x5a')]===_0xc610('0x5b')){var _0x4bfb2e=_0x19e8d3[_0xc610('0x35')]({'plain':!![]});var _0x45d7c9='SmsAccounts';return db[_0xc610('0x5c')]['find']({'where':{'name':_0x45d7c9,'userProfileId':_0x3e0f25[_0xc610('0x5d')]},'raw':!![]})['then'](function(_0x1b98b1){if(_0x1b98b1&&_0x1b98b1[_0xc610('0x5e')]===0x0){return db[_0xc610('0x37')][_0xc610('0x58')]({'name':_0x4bfb2e['name'],'resourceId':_0x4bfb2e['id'],'type':_0x1b98b1[_0xc610('0x3a')],'sectionId':_0x1b98b1['id']},{})['then'](function(){return _0x19e8d3;});}else{return _0x19e8d3;}})[_0xc610('0x28')](function(_0x3ba19e){logger['error'](_0xc610('0x5f'),_0x3ba19e);throw _0x3ba19e;});}return _0x19e8d3;})[_0xc610('0x1e')](respondWithResult(_0x175b44,0xc9))[_0xc610('0x28')](handleError(_0x175b44,null));};exports[_0xc610('0x34')]=function(_0x2f99c2,_0x3aec77){if(_0x2f99c2[_0xc610('0x60')]['id']){delete _0x2f99c2[_0xc610('0x60')]['id'];}return db[_0xc610('0x4f')][_0xc610('0x61')]({'where':{'id':_0x2f99c2[_0xc610('0x54')]['id']},'include':[{'model':db[_0xc610('0x3c')],'as':_0xc610('0x3d')}]})[_0xc610('0x1e')](handleEntityNotFound(_0x3aec77,null))[_0xc610('0x1e')](saveUpdates(_0x2f99c2[_0xc610('0x60')],null))[_0xc610('0x1e')](respondWithResult(_0x3aec77,null))['catch'](handleError(_0x3aec77,null));};exports['destroy']=function(_0x1a5d6a,_0x40691d){return db[_0xc610('0x4f')][_0xc610('0x61')]({'where':{'id':_0x1a5d6a[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x40691d,null))[_0xc610('0x1e')](removeEntity(_0x40691d,null))[_0xc610('0x28')](handleError(_0x40691d,null));};exports[_0xc610('0x62')]=function(_0x5c3072,_0x28e55c){return db[_0xc610('0x4f')][_0xc610('0x62')]()[_0xc610('0x1e')](respondWithResult(_0x28e55c,null))[_0xc610('0x28')](handleError(_0x28e55c,null));};exports[_0xc610('0x63')]=function(_0x196035,_0x59c4eb,_0x2870a4){if(_0x196035[_0xc610('0x60')]['id']){delete _0x196035[_0xc610('0x60')]['id'];}return db[_0xc610('0x4f')]['find']({'where':{'id':_0x196035[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x59c4eb,null))[_0xc610('0x1e')](function(_0x3ec417){if(_0x3ec417){_0x196035[_0xc610('0x60')]['SmsAccountId']=_0x3ec417['id'];return db[_0xc610('0x64')][_0xc610('0x58')](_0x196035[_0xc610('0x60')]);}})['then'](respondWithResult(_0x59c4eb,null))['catch'](handleError(_0x59c4eb,null));};exports[_0xc610('0x65')]=function(_0x1a9b77,_0x304076,_0x521be7){var _0x4f676f={'raw':![],'where':{}};var _0x44053c={};var _0x217be9={'count':0x0,'rows':[]};return db[_0xc610('0x4f')][_0xc610('0x66')]({'where':{'id':_0x1a9b77[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x304076,null))[_0xc610('0x1e')](function(_0x39ace6){if(_0x39ace6){_0x44053c[_0xc610('0x43')]=_[_0xc610('0x55')](db['Disposition'][_0xc610('0x3f')]);_0x44053c['query']=_[_0xc610('0x55')](_0x1a9b77[_0xc610('0x44')]);_0x44053c[_0xc610('0x56')]=_[_0xc610('0x46')](_0x44053c[_0xc610('0x43')],_0x44053c[_0xc610('0x44')]);_0x4f676f[_0xc610('0x45')]=_['intersection'](_0x44053c[_0xc610('0x43')],qs['fields'](_0x1a9b77[_0xc610('0x44')]['fields']));_0x4f676f[_0xc610('0x45')]=_0x4f676f[_0xc610('0x45')][_0xc610('0x57')]?_0x4f676f[_0xc610('0x45')]:_0x44053c['model'];if(!_0x1a9b77[_0xc610('0x44')]['hasOwnProperty']('nolimit')){_0x4f676f[_0xc610('0x2d')]=qs[_0xc610('0x2d')](_0x1a9b77[_0xc610('0x44')][_0xc610('0x2d')]);_0x4f676f[_0xc610('0x2f')]=qs[_0xc610('0x2f')](_0x1a9b77['query'][_0xc610('0x2f')]);}_0x4f676f[_0xc610('0x49')]=qs[_0xc610('0x4a')](_0x1a9b77['query'][_0xc610('0x4a')]);_0x4f676f[_0xc610('0x4b')]=qs[_0xc610('0x56')](_['pick'](_0x1a9b77[_0xc610('0x44')],_0x44053c['filters']));_0x4f676f['where'][_0xc610('0x67')]=_0x39ace6['id'];if(_0x1a9b77[_0xc610('0x44')][_0xc610('0x4e')]){_0x4f676f[_0xc610('0x4b')]=_[_0xc610('0x4c')](_0x4f676f[_0xc610('0x4b')],{'$or':_[_0xc610('0x3e')](_0x4f676f[_0xc610('0x45')],function(_0x4b9725){var _0x49a8c8={};_0x49a8c8[_0x4b9725]={'$like':'%'+_0x1a9b77[_0xc610('0x44')][_0xc610('0x4e')]+'%'};return _0x49a8c8;})});}_0x4f676f=_[_0xc610('0x4c')]({},_0x4f676f,_0x1a9b77[_0xc610('0x68')]);return db[_0xc610('0x64')]['count']({'where':_0x4f676f[_0xc610('0x4b')]})[_0xc610('0x1e')](function(_0x227081){_0x217be9[_0xc610('0x2e')]=_0x227081;if(_0x1a9b77['query'][_0xc610('0x50')]){_0x4f676f[_0xc610('0x51')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4f676f);})['then'](function(_0xf4d9a7){_0x217be9[_0xc610('0x52')]=_0xf4d9a7;return _0x217be9;});}})['then'](respondWithFilteredResult(_0x304076,_0x4f676f))[_0xc610('0x28')](handleError(_0x304076,null));};exports[_0xc610('0x69')]=function(_0x4239cf,_0x28ec9b,_0x499c93){return db['SmsAccount'][_0xc610('0x61')]({'where':{'id':_0x4239cf[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x28ec9b,null))[_0xc610('0x1e')](function(_0x5aafc3){if(_0x5aafc3){return _0x5aafc3[_0xc610('0x69')](_0x4239cf[_0xc610('0x44')][_0xc610('0x6a')]);}})[_0xc610('0x1e')](respondWithStatusCode(_0x28ec9b,null))[_0xc610('0x28')](handleError(_0x28ec9b,null));};exports[_0xc610('0x6b')]=function(_0x1a054d,_0x9a55e5,_0x31d0a8){if(_0x1a054d[_0xc610('0x60')]['id']){delete _0x1a054d['body']['id'];}return db[_0xc610('0x4f')]['find']({'where':{'id':_0x1a054d[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x9a55e5,null))[_0xc610('0x1e')](function(_0x83b1b3){if(_0x83b1b3){_0x1a054d[_0xc610('0x60')]['SmsAccountId']=_0x83b1b3['id'];return db[_0xc610('0x6c')]['create'](_0x1a054d['body']);}})[_0xc610('0x1e')](respondWithResult(_0x9a55e5,null))[_0xc610('0x28')](handleError(_0x9a55e5,null));};exports[_0xc610('0x6d')]=function(_0x228a3d,_0x2894b2,_0x25d950){var _0x589ec3={'raw':![],'where':{}};var _0xabf3f6={};var _0x358e2a={'count':0x0,'rows':[]};return db[_0xc610('0x4f')]['findOne']({'where':{'id':_0x228a3d[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x2894b2,null))[_0xc610('0x1e')](function(_0x561987){if(_0x561987){_0xabf3f6['model']=_[_0xc610('0x55')](db[_0xc610('0x6c')][_0xc610('0x3f')]);_0xabf3f6['query']=_[_0xc610('0x55')](_0x228a3d[_0xc610('0x44')]);_0xabf3f6[_0xc610('0x56')]=_[_0xc610('0x46')](_0xabf3f6['model'],_0xabf3f6[_0xc610('0x44')]);_0x589ec3[_0xc610('0x45')]=_[_0xc610('0x46')](_0xabf3f6[_0xc610('0x43')],qs[_0xc610('0x47')](_0x228a3d[_0xc610('0x44')][_0xc610('0x47')]));_0x589ec3[_0xc610('0x45')]=_0x589ec3[_0xc610('0x45')]['length']?_0x589ec3[_0xc610('0x45')]:_0xabf3f6[_0xc610('0x43')];if(!_0x228a3d[_0xc610('0x44')]['hasOwnProperty'](_0xc610('0x48'))){_0x589ec3['limit']=qs['limit'](_0x228a3d[_0xc610('0x44')]['limit']);_0x589ec3[_0xc610('0x2f')]=qs[_0xc610('0x2f')](_0x228a3d[_0xc610('0x44')]['offset']);}_0x589ec3[_0xc610('0x49')]=qs['sort'](_0x228a3d[_0xc610('0x44')][_0xc610('0x4a')]);_0x589ec3[_0xc610('0x4b')]=qs[_0xc610('0x56')](_['pick'](_0x228a3d[_0xc610('0x44')],_0xabf3f6['filters']));_0x589ec3['where'][_0xc610('0x67')]=_0x561987['id'];if(_0x228a3d['query']['filter']){_0x589ec3['where']=_[_0xc610('0x4c')](_0x589ec3['where'],{'$or':_[_0xc610('0x3e')](_0x589ec3[_0xc610('0x45')],function(_0x35b1c2){var _0x49064d={};_0x49064d[_0x35b1c2]={'$like':'%'+_0x228a3d[_0xc610('0x44')][_0xc610('0x4e')]+'%'};return _0x49064d;})});}_0x589ec3=_[_0xc610('0x4c')]({},_0x589ec3,_0x228a3d[_0xc610('0x68')]);return db[_0xc610('0x6c')][_0xc610('0x2e')]({'where':_0x589ec3[_0xc610('0x4b')]})['then'](function(_0x213114){_0x358e2a['count']=_0x213114;if(_0x228a3d[_0xc610('0x44')][_0xc610('0x50')]){_0x589ec3[_0xc610('0x51')]=[{'all':!![]}];}return db[_0xc610('0x6c')][_0xc610('0x6e')](_0x589ec3);})[_0xc610('0x1e')](function(_0x14038f){_0x358e2a[_0xc610('0x52')]=_0x14038f;return _0x358e2a;});}})['then'](respondWithFilteredResult(_0x2894b2,_0x589ec3))[_0xc610('0x28')](handleError(_0x2894b2,null));};exports[_0xc610('0x6f')]=function(_0x4c7b34,_0x4f3e1a,_0x60a138){return db[_0xc610('0x4f')][_0xc610('0x61')]({'where':{'id':_0x4c7b34['params']['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x4f3e1a,null))[_0xc610('0x1e')](function(_0x417394){if(_0x417394){return _0x417394[_0xc610('0x6f')](_0x4c7b34[_0xc610('0x44')][_0xc610('0x6a')]);}})[_0xc610('0x1e')](respondWithStatusCode(_0x4f3e1a,null))[_0xc610('0x28')](handleError(_0x4f3e1a,null));};exports[_0xc610('0x70')]=function(_0x1aafdc,_0x3e4d55,_0x1eb988){var _0x5b5731={'channel':_0xc610('0x71')};var _0x3ca6be=[];var _0x57c66f=[];var _0x24883c={};return db[_0xc610('0x4f')][_0xc610('0x61')]({'where':{'id':_0x1aafdc[_0xc610('0x54')]['id']},'include':[{'model':db[_0xc610('0x72')],'as':_0xc610('0x73')}]})[_0xc610('0x1e')](handleEntityNotFound(_0x3e4d55,null))[_0xc610('0x1e')](function(_0x59f470){_0x5b5731[_0xc610('0x74')]=_0x59f470;_0x5b5731['applications']=_[_0xc610('0x75')](_0x59f470[_0xc610('0x73')],['priority'],[_0xc610('0x76')]);if(_0x5b5731['account']['Applications']){delete _0x5b5731[_0xc610('0x74')]['Applications'];}return db['CmContact']['describe']();})['then'](function(_0x41a19c){if(!_0x41a19c){throw new db[(_0xc610('0x77'))]['ValidationError'](_0xc610('0x78'));}_0x3ca6be=_[_0xc610('0x79')](_['keys'](_0x41a19c),[_0xc610('0x7a'),_0xc610('0x7b')]);_0x57c66f=_[_0xc610('0x79')](_[_0xc610('0x55')](_0x41a19c),[_0xc610('0x7a'),_0xc610('0x7b'),_0xc610('0x7c'),_0xc610('0x7d')]);_0x5b5731[_0xc610('0x60')]={'mapKey':_0xc610('0x7e')};if(_0x5b5731['account'][_0xc610('0x41')]){switch(_0x5b5731[_0xc610('0x74')][_0xc610('0x41')]){case _0xc610('0x7f'):_0x5b5731['body'][_0xc610('0x80')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x81')];_0x5b5731[_0xc610('0x60')][_0xc610('0x60')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x82')];_0x5b5731['body'][_0xc610('0x83')]=_0x1aafdc[_0xc610('0x60')]['MessageSid'];break;case'skebby':_0x5b5731[_0xc610('0x60')][_0xc610('0x80')]='+'+_0x1aafdc[_0xc610('0x60')]['sender'];_0x5b5731[_0xc610('0x60')][_0xc610('0x60')]=_0x1aafdc['body'][_0xc610('0x84')];break;case _0xc610('0x85'):_0x5b5731[_0xc610('0x60')][_0xc610('0x80')]=_0x1aafdc['body']['from'];_0x5b5731['body'][_0xc610('0x60')]=_0x1aafdc[_0xc610('0x60')]['message'];break;case _0xc610('0x86'):_0x5b5731[_0xc610('0x60')]['from']=_0x1aafdc[_0xc610('0x60')]['from'];_0x5b5731[_0xc610('0x60')][_0xc610('0x60')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x60')];_0x5b5731['body'][_0xc610('0x83')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x87')];break;case _0xc610('0x88'):_0x5b5731[_0xc610('0x60')][_0xc610('0x80')]=_0x1aafdc['body'][_0xc610('0x81')];_0x5b5731[_0xc610('0x60')][_0xc610('0x60')]=_0x1aafdc['body']['Text'];_0x5b5731['body'][_0xc610('0x83')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x89')];break;case _0xc610('0x8a'):_0x5b5731['body'][_0xc610('0x80')]='+'+_0x1aafdc['body'][_0xc610('0x8b')][0x0][_0xc610('0x80')];_0x5b5731[_0xc610('0x60')][_0xc610('0x60')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x8b')][0x0]['text'];_0x5b5731[_0xc610('0x60')][_0xc610('0x83')]=_0x1aafdc[_0xc610('0x60')]['results'][0x0][_0xc610('0x83')];break;case _0xc610('0x8c'):_0x5b5731[_0xc610('0x60')][_0xc610('0x80')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x8d')];_0x5b5731[_0xc610('0x60')][_0xc610('0x60')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x8e')][_0xc610('0x26')];break;case'clickatell':_0x5b5731['body'][_0xc610('0x80')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x8f')];_0x5b5731[_0xc610('0x60')][_0xc610('0x60')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x84')];_0x5b5731[_0xc610('0x60')][_0xc610('0x83')]=_0x1aafdc['body'][_0xc610('0x90')];break;case _0xc610('0x91'):_0x5b5731[_0xc610('0x60')][_0xc610('0x83')]=_0x1aafdc[_0xc610('0x60')][0x0][_0xc610('0x26')]['id'];_0x5b5731[_0xc610('0x60')][_0xc610('0x80')]=_0x1aafdc['body'][0x0][_0xc610('0x26')][_0xc610('0x80')];_0x5b5731[_0xc610('0x60')][_0xc610('0x60')]=_0x1aafdc[_0xc610('0x60')][0x0][_0xc610('0x26')]['text'];break;case _0xc610('0x92'):_0x5b5731['body'][_0xc610('0x80')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x80')];_0x5b5731[_0xc610('0x60')][_0xc610('0x60')]=_0x1aafdc['body'][_0xc610('0x26')];_0x5b5731[_0xc610('0x60')][_0xc610('0x83')]=_0x1aafdc[_0xc610('0x60')][_0xc610('0x93')];break;}}if(_0x5b5731['body']['id']){delete _0x5b5731[_0xc610('0x60')]['id'];}if(_[_0xc610('0x94')](_0x5b5731['body'][_0xc610('0x80')])){throw new db[(_0xc610('0x77'))]['ValidationError'](_0xc610('0x95'));}if(_[_0xc610('0x94')](_0x5b5731[_0xc610('0x60')][_0xc610('0x60')])||_0x5b5731[_0xc610('0x60')]['body']===''){throw new db[(_0xc610('0x77'))][(_0xc610('0x96'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5b5731[_0xc610('0x60')]['mapKey'])){throw new db['Sequelize'][(_0xc610('0x96'))](_0xc610('0x97')+_0x57c66f);}if(!_[_0xc610('0x98')](_0x57c66f,_0x5b5731[_0xc610('0x60')]['mapKey'])){throw new db['Sequelize'][(_0xc610('0x96'))](_0xc610('0x99')+_0x57c66f);}_0x24883c[_0x5b5731[_0xc610('0x60')]['mapKey']]=_0x5b5731[_0xc610('0x60')][_0xc610('0x80')];return db[_0xc610('0x9a')][_0xc610('0x61')]({'where':{'id':_0x5b5731[_0xc610('0x74')]['ListId']},'include':[{'model':db['CmContact'],'as':_0xc610('0x9b'),'where':_0x24883c,'limit':0x1,'order':[['updatedAt',_0xc610('0x9c')]]}]});})[_0xc610('0x1e')](handleEntityNotFound(_0x3e4d55,null))['then'](function(_0x3563f8){if(_0x3563f8){_0x5b5731[_0xc610('0x9d')]=_['omit'](_0x3563f8,[_0xc610('0x9b')]);if(_0x3563f8['Contacts'][_0xc610('0x57')]){return _0x3563f8[_0xc610('0x9b')][0x0];}var _0x495d1c=_[_0xc610('0x18')](_0x5b5731[_0xc610('0x60')],{'firstName':_0x5b5731[_0xc610('0x60')]['from'],'ListId':_0x3563f8['id']});_0x495d1c[_0x5b5731[_0xc610('0x60')][_0xc610('0x9e')]]=_0x5b5731['body'][_0xc610('0x80')];return db[_0xc610('0x9f')]['create'](_0x495d1c,{'fields':_0x3ca6be,'raw':!![]});}})[_0xc610('0x1e')](handleEntityNotFound(_0x3e4d55,null))[_0xc610('0x1e')](function(_0x232153){if(_0x232153){_0x5b5731[_0xc610('0xa0')]=_0x232153;var _0x67ebeb={'ContactId':_0x232153['id'],'phone':_0x5b5731[_0xc610('0x60')][_0xc610('0x80')],'SmsAccountId':_0x1aafdc['params']['id']};var _0x5cf7f4={'ContactId':_0x232153['id'],'SmsAccountId':_0x1aafdc[_0xc610('0x54')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x5cf7f4})[_0xc610('0x1e')](function(_0x3072ee){if(_0x3072ee){return[_0x3072ee,![]];}return db[_0xc610('0xa1')]['create'](_0x67ebeb)[_0xc610('0x1e')](function(_0x4a5990){return[_0x4a5990,!![]];});});}})[_0xc610('0xa2')](function(_0x2c18e5,_0x34a8c5){_0x5b5731[_0xc610('0xa3')]=_0x2c18e5['get']({'plain':!![]});_0x5b5731[_0xc610('0xa3')][_0xc610('0xa4')]=![];if(_0x34a8c5){if(_0x5b5731['account'][_0xc610('0xa5')]){_0x5b5731[_0xc610('0xa6')][_0xc610('0xa7')]({'id':0x0,'priority':_0x5b5731[_0xc610('0xa6')][_0xc610('0x57')]+0x1,'app':'close','appdata':_0xc610('0xa8'),'interval':_0xc610('0xa9')});}_0x5b5731['interaction'][_0xc610('0xa4')]=!![];}return db[_0xc610('0xaa')][_0xc610('0x58')]({'phone':_0x5b5731[_0xc610('0x60')][_0xc610('0x80')],'messageId':_0x5b5731[_0xc610('0x60')][_0xc610('0x83')],'body':_0x5b5731[_0xc610('0x60')][_0xc610('0x60')],'SmsAccountId':_0x1aafdc['params']['id'],'SmsInteractionId':_0x2c18e5['id'],'direction':'in','ContactId':_0x2c18e5[_0xc610('0xab')],'AttachmentId':_0x5b5731['body']['AttachmentId']});})['then'](function(_0x174516){_0x5b5731['message']=_0x174516;if(!_0x5b5731[_0xc610('0xa3')][_0xc610('0xac')])return;return db['User'][_0xc610('0x61')]({'attributes':['id',_0xc610('0x3a')],'where':{'id':_0x5b5731[_0xc610('0xa3')]['UserId']}});})[_0xc610('0x1e')](function(_0x2c455e){if(_0x2c455e){_0x5b5731[_0xc610('0xa6')][_0xc610('0xad')]({'id':0x0,'priority':0x0,'app':_0xc610('0xae'),'appdata':_0x2c455e['name']+','+(_0x5b5731[_0xc610('0x74')][_0xc610('0xaf')]||0xa),'interval':'*,*,*,*'});}if(!_0x5b5731[_0xc610('0xa3')]['queueId'])return;return db[_0xc610('0xb0')][_0xc610('0x61')]({'attributes':['id',_0xc610('0x3a')],'where':{'id':_0x5b5731[_0xc610('0xa3')][_0xc610('0xb1')]}});})['then'](function(_0x3a4b53){if(_0x3a4b53){_0x5b5731['applications'][_0xc610('0xad')]({'id':0x0,'priority':0x1,'app':_0xc610('0xb2'),'appdata':_0x3a4b53[_0xc610('0x3a')]+','+(_0x5b5731['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xc610('0xa9')});}return respondWithRpcPromise(_0xc610('0xb3'),_0xc610('0xb4'),_0x5b5731);})[_0xc610('0x1e')](function(_0x4af7ae){if(_0x4af7ae){var _0x772f=0xc8;var _0x180ef9=_0xc610('0xb5');logger['info'](_0xc610('0x22'),_0x180ef9,_0x772f,_0xc610('0xb6'));logger['debug'](_0xc610('0xb7'),_0x180ef9,_0x772f,_0xc610('0xb6'),JSON['stringify'](_0x4af7ae));if(_0x5b5731[_0xc610('0x74')][_0xc610('0x41')]===_0xc610('0x7f')){return _0x3e4d55[_0xc610('0x2a')](_0x772f)[_0xc610('0x30')](_0xc610('0xb8'),_0xc610('0xb9'))['send']('\x0a');}else{return _0x3e4d55['status'](_0x772f)[_0xc610('0x2b')](_0x4af7ae);}}})[_0xc610('0x28')](handleError(_0x3e4d55,null));};exports[_0xc610('0xba')]=function(_0x5cb9aa,_0x59dc2d){var _0x338a10=_0x5cb9aa['params']['id'];var _0x196ba3=_0x5cb9aa[_0xc610('0x60')];var _0x29d149=0xc8;var _0x5a26f0=null;return db[_0xc610('0xbb')]['transaction']({'isolationLevel':db[_0xc610('0xbb')][_0xc610('0xbc')][_0xc610('0xbd')][_0xc610('0xbe')]},function(_0x163048){return db[_0xc610('0x4f')]['findOne']({'where':{'id':_0x338a10},'transaction':_0x163048})[_0xc610('0x1e')](function(_0x19667f){if(_0x19667f){return db[_0xc610('0x72')][_0xc610('0x38')]({'where':{'SmsAccountId':_0x338a10},'transaction':_0x163048})[_0xc610('0x1e')](function(){var _0x404674=_['map'](_0x196ba3,function(_0x9cb5a5){_0x9cb5a5['SmsAccountId']=_0x338a10;return _0x9cb5a5;});return db[_0xc610('0x72')][_0xc610('0xbf')](_0x404674,{'transaction':_0x163048});});}else{_0x29d149=0x194;_0x5a26f0=[];}});})[_0xc610('0x1e')](function(){if(_0x29d149!==0x194){return db[_0xc610('0x72')]['findAndCountAll']({'where':{'SmsAccountId':_0x338a10},'order':_0xc610('0xc0')})[_0xc610('0x1e')](function(_0x27f578){_0x5a26f0=_0x27f578;});}})[_0xc610('0x28')](function(_0x6d4e4e){_0x29d149=0x1f4;logger['error'](_0x6d4e4e[_0xc610('0xc1')]);if(_0x6d4e4e[_0xc610('0x3a')]){delete _0x6d4e4e[_0xc610('0x3a')];}_0x5a26f0=_0x6d4e4e;})[_0xc610('0xc2')](function(){if(_0x5a26f0===null){_0x59dc2d['sendStatus'](_0x29d149);}else{if(_0x29d149===0x1f4){_0x59dc2d[_0xc610('0x2a')](_0x29d149)[_0xc610('0x3b')](_0x5a26f0);}else{_0x59dc2d[_0xc610('0x2a')](_0x29d149)['json'](_0x5a26f0);}}});};exports[_0xc610('0xc3')]=function(_0x3f0363,_0x5515a2,_0x6322f8){var _0x1ea8d4={};var _0x3efbd8={};var _0x3a260a;var _0xfac68b;return db['SmsAccount'][_0xc610('0x66')]({'where':{'id':_0x3f0363[_0xc610('0x54')]['id']}})['then'](handleEntityNotFound(_0x5515a2,null))[_0xc610('0x1e')](function(_0x5590b2){if(_0x5590b2){_0x3a260a=_0x5590b2;_0x3efbd8['model']=_[_0xc610('0x55')](db[_0xc610('0x72')][_0xc610('0x3f')]);_0x3efbd8[_0xc610('0x44')]=_['keys'](_0x3f0363['query']);_0x3efbd8[_0xc610('0x56')]=_['intersection'](_0x3efbd8[_0xc610('0x43')],_0x3efbd8[_0xc610('0x44')]);_0x1ea8d4[_0xc610('0x45')]=_['intersection'](_0x3efbd8['model'],qs['fields'](_0x3f0363[_0xc610('0x44')][_0xc610('0x47')]));_0x1ea8d4[_0xc610('0x45')]=_0x1ea8d4[_0xc610('0x45')][_0xc610('0x57')]?_0x1ea8d4[_0xc610('0x45')]:_0x3efbd8[_0xc610('0x43')];_0x1ea8d4['order']=qs[_0xc610('0x4a')](_0x3f0363['query']['sort']);_0x1ea8d4[_0xc610('0x4b')]=qs[_0xc610('0x56')](_['pick'](_0x3f0363[_0xc610('0x44')],_0x3efbd8[_0xc610('0x56')]));if(_0x3f0363[_0xc610('0x44')][_0xc610('0x4e')]){_0x1ea8d4[_0xc610('0x4b')]=_[_0xc610('0x4c')](_0x1ea8d4['where'],{'$or':_[_0xc610('0x3e')](_0x1ea8d4[_0xc610('0x45')],function(_0xba5129){var _0x295ffa={};_0x295ffa[_0xba5129]={'$like':'%'+_0x3f0363[_0xc610('0x44')][_0xc610('0x4e')]+'%'};return _0x295ffa;})});}_0x1ea8d4=_['merge']({},_0x1ea8d4,_0x3f0363[_0xc610('0x68')]);return _0x3a260a[_0xc610('0xc3')](_0x1ea8d4);}})['then'](function(_0x3e1731){if(_0x3e1731){_0xfac68b=_0x3e1731[_0xc610('0x57')];if(!_0x3f0363['query'][_0xc610('0xc4')](_0xc610('0x48'))){_0x1ea8d4[_0xc610('0x2d')]=qs[_0xc610('0x2d')](_0x3f0363[_0xc610('0x44')][_0xc610('0x2d')]);_0x1ea8d4[_0xc610('0x2f')]=qs[_0xc610('0x2f')](_0x3f0363[_0xc610('0x44')][_0xc610('0x2f')]);}return _0x3a260a[_0xc610('0xc3')](_0x1ea8d4);}})['then'](function(_0x2da97a){if(_0x2da97a){return _0x2da97a?{'count':_0xfac68b,'rows':_0x2da97a}:null;}})[_0xc610('0x1e')](respondWithResult(_0x5515a2,null))['catch'](handleError(_0x5515a2,null));};exports['getInteractions']=function(_0x3bd909,_0x288762,_0x69b93b){var _0x434d04={'raw':![],'where':{}};var _0x4e1b48={};var _0x199432={'count':0x0,'rows':[]};return db[_0xc610('0x4f')]['findOne']({'where':{'id':_0x3bd909[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x288762,null))['then'](function(_0x2e35f7){if(_0x2e35f7){_0x4e1b48[_0xc610('0x43')]=_[_0xc610('0x55')](db['SmsInteraction'][_0xc610('0x3f')]);_0x4e1b48[_0xc610('0x44')]=_[_0xc610('0x55')](_0x3bd909['query']);_0x4e1b48[_0xc610('0x56')]=_[_0xc610('0x46')](_0x4e1b48[_0xc610('0x43')],_0x4e1b48['query']);_0x434d04['attributes']=_[_0xc610('0x46')](_0x4e1b48[_0xc610('0x43')],qs[_0xc610('0x47')](_0x3bd909[_0xc610('0x44')][_0xc610('0x47')]));_0x434d04[_0xc610('0x45')]=_0x434d04['attributes']['length']?_0x434d04[_0xc610('0x45')]:_0x4e1b48[_0xc610('0x43')];if(!_0x3bd909[_0xc610('0x44')]['hasOwnProperty'](_0xc610('0x48'))){_0x434d04[_0xc610('0x2d')]=qs[_0xc610('0x2d')](_0x3bd909[_0xc610('0x44')]['limit']);_0x434d04['offset']=qs['offset'](_0x3bd909[_0xc610('0x44')]['offset']);}_0x434d04['order']=qs[_0xc610('0x4a')](_0x3bd909[_0xc610('0x44')][_0xc610('0x4a')]);_0x434d04[_0xc610('0x4b')]=qs[_0xc610('0x56')](_[_0xc610('0xc5')](_0x3bd909[_0xc610('0x44')],_0x4e1b48[_0xc610('0x56')]));_0x434d04['where'][_0xc610('0x67')]=_0x2e35f7['id'];if(_0x3bd909[_0xc610('0x44')]['filter']){_0x434d04[_0xc610('0x4b')]=_['merge'](_0x434d04['where'],{'$or':_[_0xc610('0x3e')](_0x434d04[_0xc610('0x45')],function(_0x301b32){var _0x440115={};_0x440115[_0x301b32]={'$like':'%'+_0x3bd909[_0xc610('0x44')][_0xc610('0x4e')]+'%'};return _0x440115;})});}_0x434d04=_['merge']({},_0x434d04,_0x3bd909[_0xc610('0x68')]);return db[_0xc610('0xa1')][_0xc610('0x2e')]({'where':_0x434d04[_0xc610('0x4b')]})[_0xc610('0x1e')](function(_0xe173f4){_0x199432[_0xc610('0x2e')]=_0xe173f4;if(_0x3bd909[_0xc610('0x44')][_0xc610('0x50')]){_0x434d04['include']=[{'model':db[_0xc610('0x9f')],'as':_0xc610('0xc6'),'required':![]},{'model':db['User'],'as':_0xc610('0xc7'),'attributes':[_0xc610('0x3a'),_0xc610('0xc8'),_0xc610('0xc9')],'required':![]},{'model':db[_0xc610('0xca')],'as':_0xc610('0xcb'),'attributes':['id','name',_0xc610('0xcc')],'where':_0x3bd909[_0xc610('0x44')][_0xc610('0xcd')]?{'id':_0x3bd909[_0xc610('0x44')][_0xc610('0xcd')]}:undefined,'required':_0x3bd909[_0xc610('0x44')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0xc610('0x6e')](_0x434d04);})[_0xc610('0x1e')](function(_0x3eb44e){_0x199432[_0xc610('0x52')]=_0x3eb44e;return _0x199432;});}})[_0xc610('0x1e')](respondWithFilteredResult(_0x288762,_0x434d04))[_0xc610('0x28')](handleError(_0x288762,null));};exports[_0xc610('0x3b')]=function(_0x28c15d,_0x449714,_0x3d8d7f){var _0x5455b0,_0x157952,_0x311618;if(_[_0xc610('0x94')](_0x28c15d[_0xc610('0x60')][_0xc610('0x60')])||_0x28c15d[_0xc610('0x60')][_0xc610('0x60')]===''){throw new db['Sequelize'][(_0xc610('0x96'))](_0xc610('0xce'));}if(_[_0xc610('0x94')](_0x28c15d['body']['to'])){throw new db[(_0xc610('0x77'))]['ValidationError']('to\x20is\x20mandatory');}_0x5455b0=_0x28c15d[_0xc610('0x60')]['to'];return db[_0xc610('0x4f')]['find']({'where':{'id':_0x28c15d[_0xc610('0x54')]['id']},'include':[{'model':db[_0xc610('0x9a')],'as':_0xc610('0xcf'),'include':[{'model':db[_0xc610('0x9f')],'as':_0xc610('0x9b'),'where':{'mobile':_0x5455b0},'limit':0x1,'order':[[_0xc610('0x7b'),_0xc610('0x9c')]]}]}]})[_0xc610('0x1e')](handleEntityNotFound(_0x449714,null))['then'](function(_0x455723){if(_0x455723&&_0x455723[_0xc610('0xcf')]){_0x157952=_0x455723[_0xc610('0x35')]({'plain':!![]});if(_0x157952[_0xc610('0xcf')]&&_0x157952[_0xc610('0xcf')][_0xc610('0x9b')][_0xc610('0x57')]){return _0x157952[_0xc610('0xcf')][_0xc610('0x9b')][0x0];}return db[_0xc610('0x9f')][_0xc610('0x58')](_[_0xc610('0x18')](_0x28c15d[_0xc610('0x60')],{'firstName':_0x5455b0,'mobile':_0x5455b0,'phone':_0x5455b0,'ListId':_0x157952[_0xc610('0x7d')]}));}})['then'](handleEntityNotFound(_0x449714,null))[_0xc610('0x1e')](function(_0x12d46e){if(_0x12d46e){_0x311618=_0x12d46e;return db[_0xc610('0xa1')][_0xc610('0x61')]({'where':{'ContactId':_0x311618['id'],'closed':![],'SmsAccountId':_0x157952['id']}})[_0xc610('0x1e')](function(_0x15a17c){if(_0x15a17c){return[_0x15a17c,![]];}return db[_0xc610('0xa1')][_0xc610('0x58')]({'UserId':_0x28c15d[_0xc610('0x5b')]['id'],'ContactId':_0x311618['id'],'SmsAccountId':_0x157952['id'],'phone':_0x5455b0,'firstMsgDirection':'out','Messages':[_[_0xc610('0x4c')](_0x28c15d[_0xc610('0x60')],{'read':![],'body':_0x28c15d['body'][_0xc610('0x60')],'phone':_0x5455b0,'SmsAccountId':_0x157952['id'],'UserId':_0x28c15d[_0xc610('0x5b')]['id'],'ContactId':_0x311618['id']})]},{'include':[{'model':db[_0xc610('0xaa')],'as':_0xc610('0xd0')}]})[_0xc610('0x1e')](function(_0x559d21){return[_0x559d21,!![]];});});}})[_0xc610('0xa2')](function(_0x5a4cef,_0x9b8ea5){if(_0x9b8ea5){return _0x5a4cef;}return db[_0xc610('0xaa')][_0xc610('0x58')](_[_0xc610('0x4c')](_0x28c15d[_0xc610('0x60')],{'read':![],'body':_0x28c15d['body'][_0xc610('0x60')],'phone':_0x5455b0,'SmsAccountId':_0x157952['id'],'SmsInteractionId':_0x5a4cef['id'],'UserId':_0x28c15d[_0xc610('0x5b')]['id'],'ContactId':_0x311618['id']}))[_0xc610('0x1e')](function(_0x45ebc8){_0x5a4cef[_0xc610('0xd1')][_0xc610('0xd0')]=[];_0x5a4cef['dataValues'][_0xc610('0xd0')][_0xc610('0xa7')](_0x45ebc8[_0xc610('0xd1')]);return _0x5a4cef;});})[_0xc610('0x1e')](respondWithResult(_0x449714,null))[_0xc610('0x28')](handleError(_0x449714,null));};exports[_0xc610('0x2a')]=function(_0x2464ec,_0x2da7f5,_0x39d4d5){if(_0x2464ec[_0xc610('0x60')]['id']){delete _0x2464ec[_0xc610('0x60')]['id'];}var _0x4865a2,_0x34eb52,_0x358627;return db[_0xc610('0x4f')]['find']({'where':{'id':_0x2464ec[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x2da7f5,null))[_0xc610('0x1e')](function(_0x48314a){if(_0x48314a){_0x358627=_0x48314a;logger['debug'](_0xc610('0x22'),_0xc610('0x2a'),_0xc610('0xd2'),_0x48314a[_0xc610('0x41')],util[_0xc610('0xd3')](_0x2464ec[_0xc610('0x60')],{'showHidden':![],'depth':null}));switch(_0x48314a['type']){case _0xc610('0xd4'):if(_0x2464ec[_0xc610('0x60')][_0xc610('0xd5')]&&_0x2464ec[_0xc610('0x60')][_0xc610('0x2a')]){_0x34eb52=_0x2464ec[_0xc610('0x60')][_0xc610('0x2a')];return db[_0xc610('0xaa')][_0xc610('0x61')]({'where':{'messageId':_0x2464ec[_0xc610('0x60')][_0xc610('0xd5')]}});}break;case _0xc610('0x85'):if(_0x2464ec[_0xc610('0x60')][_0xc610('0xd6')]&&_0x2464ec[_0xc610('0x60')][_0xc610('0xd7')]){_0x34eb52=_0x2464ec[_0xc610('0x60')][_0xc610('0xd7')];return db[_0xc610('0xaa')][_0xc610('0x61')]({'where':{'messageId':_0x2464ec[_0xc610('0x60')][_0xc610('0xd6')]}});}break;case _0xc610('0x86'):if(_0x2464ec[_0xc610('0x60')][_0xc610('0x87')]&&_0x2464ec[_0xc610('0x60')][_0xc610('0xd8')]){_0x34eb52=_0x2464ec[_0xc610('0x60')][_0xc610('0xd8')];return db[_0xc610('0xaa')][_0xc610('0x61')]({'where':{'messageId':_0x2464ec[_0xc610('0x60')]['message_id']}});}break;case _0xc610('0x8a'):var _0x5cc5e0=_0x2464ec[_0xc610('0x60')][_0xc610('0x8b')][0x0];if(_0x5cc5e0['messageId']&&_0x5cc5e0[_0xc610('0x2a')]['groupName']===_0xc610('0xd9')){_0x34eb52=_0x5cc5e0['status'][_0xc610('0xda')];return db[_0xc610('0xaa')][_0xc610('0x61')]({'where':{'messageId':_0x5cc5e0['messageId']}});}break;case _0xc610('0xdb'):if(_0x2464ec['body']['messageId']&&_0x2464ec[_0xc610('0x60')][_0xc610('0x2a')]){_0x34eb52=_0x2464ec[_0xc610('0x60')][_0xc610('0x2a')];return db[_0xc610('0xaa')][_0xc610('0x61')]({'where':{'messageId':_0x2464ec[_0xc610('0x60')][_0xc610('0x83')]}});}break;case _0xc610('0x91'):if(_0x2464ec['body'][0x0]['message']['id']){_0x34eb52=_0x2464ec['body'][0x0][_0xc610('0x41')];return db['SmsMessage'][_0xc610('0x61')]({'where':{'messageId':_0x2464ec[_0xc610('0x60')][0x0][_0xc610('0x26')]['id']}});}break;case _0xc610('0x92'):if(_0x2464ec[_0xc610('0x60')]['redif']&&_0x2464ec[_0xc610('0x60')][_0xc610('0x2a')]){_0x34eb52=_0x2464ec[_0xc610('0x60')][_0xc610('0x2a')];return db[_0xc610('0xaa')][_0xc610('0x61')]({'where':{'messageId':_0x2464ec['body'][_0xc610('0xdc')]}});}break;}}})['then'](handleEntityNotFound(_0x2da7f5,null))[_0xc610('0x1e')](function(_0x4e09b9){if(_0x4e09b9){_0x4865a2=_0x4e09b9;switch(_0x358627[_0xc610('0x41')]){case _0xc610('0xd4'):if(_0x34eb52===_0xc610('0xd9')){return _0x4865a2[_0xc610('0x34')]({'read':!![]});}else{logger[_0xc610('0x25')](_0xc610('0x22'),_0xc610('0x2a'),_0xc610('0xd4'),util[_0xc610('0xd3')](_0x2464ec[_0xc610('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc610('0x85'):if(_0x34eb52==='1'){return _0x4865a2['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc610('0x2a'),_0xc610('0xd4'),util[_0xc610('0xd3')](_0x2464ec['body'],{'showHidden':![],'depth':null}));}break;case _0xc610('0x86'):if(!_0x2464ec[_0xc610('0x60')]['error_code']&&_0x34eb52>=0xc8&&_0x34eb52<=0xce){return _0x4865a2[_0xc610('0x34')]({'read':!![]});}else{logger[_0xc610('0x25')](_0xc610('0x22'),_0xc610('0x2a'),_0xc610('0x86'),util[_0xc610('0xd3')](_0x2464ec[_0xc610('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc610('0x8a'):var _0x2afeef=_0x2464ec[_0xc610('0x60')]['results'][0x0];if(_0x2afeef[_0xc610('0x2a')]['groupName']===_0xc610('0xd9')){return _0x4865a2[_0xc610('0x34')]({'read':!![]});}else{logger['error'](_0xc610('0x22'),_0xc610('0x2a'),_0xc610('0x8a'),util[_0xc610('0xd3')](_0x2464ec[_0xc610('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x34eb52==_0xc610('0xdd')||_0x34eb52==_0xc610('0xde')){return _0x4865a2['update']({'read':!![]});}else{logger[_0xc610('0x25')](_0xc610('0x22'),_0xc610('0x2a'),_0xc610('0xdb'),util[_0xc610('0xd3')](_0x2464ec['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x34eb52==_0xc610('0xdf')){return _0x4865a2['update']({'read':!![]});}else{logger['error'](_0xc610('0x22'),'status',_0xc610('0x91'),util[_0xc610('0xd3')](_0x2464ec[_0xc610('0x60')],{'showHidden':![],'depth':null}));}break;case _0xc610('0x92'):if(_0x34eb52===_0xc610('0xe0')||_0x34eb52==='ACCEPTD'){return _0x4865a2['update']({'read':!![]});}else{logger['error'](_0xc610('0x22'),'status',_0xc610('0x92'),util[_0xc610('0xd3')](_0x2464ec[_0xc610('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x4865a2;}})['then'](respondWithResult(_0x2da7f5,null))[_0xc610('0x28')](handleError(_0x2da7f5,null));};exports[_0xc610('0xe1')]=function(_0x1afa17,_0x31590e,_0x53ed55){var _0x2c858a,_0xc8340f,_0x1808ba;return db[_0xc610('0x4f')][_0xc610('0x61')]({'where':{'id':_0x1afa17[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x31590e,null))['then'](function(_0x395aa0){if(_0x395aa0){_0x1808ba=_0x395aa0;logger['debug'](_0xc610('0x22'),_0xc610('0x2a'),_0xc610('0xd2'),_0x395aa0[_0xc610('0x41')],util['inspect'](_0x1afa17[_0xc610('0x44')],{'showHidden':![],'depth':null}));switch(_0x395aa0[_0xc610('0x41')]){case _0xc610('0x8c'):if(_0x1afa17['query']['message-id']&&_0x1afa17['query'][_0xc610('0xe2')]){_0xc8340f=_0x1afa17[_0xc610('0x44')]['state'];return db[_0xc610('0xaa')]['find']({'where':{'messageId':_0x1afa17[_0xc610('0x44')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x31590e,null))[_0xc610('0x1e')](function(_0x335e2d){if(_0x335e2d){_0x2c858a=_0x335e2d;switch(_0x1808ba[_0xc610('0x41')]){case _0xc610('0x8c'):if(_0xc8340f==='2'||_0xc8340f==='6'){return _0x2c858a[_0xc610('0x34')]({'read':!![]});}else{logger[_0xc610('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc610('0x2a'),'csc',util[_0xc610('0xd3')](_0x1afa17['query'],{'showHidden':![],'depth':null}));};break;}return _0x2c858a;}})['then'](respondWithResult(_0x31590e,null))[_0xc610('0x28')](handleError(_0x31590e,null));};exports[_0xc610('0xe3')]=function(_0x3df7bc,_0x3ed190,_0xa0cc48){return db[_0xc610('0x4f')][_0xc610('0x61')]({'where':{'id':_0x3df7bc[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x3ed190,null))[_0xc610('0x1e')](function(_0x2efbce){if(_0x2efbce){return _0x2efbce['addAgents'](_0x3df7bc[_0xc610('0x60')]['ids'],_[_0xc610('0xe4')](_0x3df7bc[_0xc610('0x60')],[_0xc610('0x6a'),'id'])||{})[_0xc610('0xa2')](function(_0x3ea55d){for(var _0x4e0f68=0x0;_0x4e0f68<_0x3df7bc[_0xc610('0x60')][_0xc610('0x6a')][_0xc610('0x57')];_0x4e0f68+=0x1){socket[_0xc610('0xe5')](_0xc610('0xe6'),{'UserId':Number(_0x3df7bc[_0xc610('0x60')]['ids'][_0x4e0f68]),'SmsAccountId':Number(_0x3df7bc[_0xc610('0x54')]['id'])});}return _0x3ea55d;});}})[_0xc610('0x1e')](respondWithResult(_0x3ed190,null))[_0xc610('0x28')](handleError(_0x3ed190,null));};exports['removeAgents']=function(_0x2dfdf3,_0x52619b,_0x487edf){return db[_0xc610('0x4f')]['find']({'where':{'id':_0x2dfdf3[_0xc610('0x54')]['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x52619b,null))[_0xc610('0x1e')](function(_0x4beb61){if(_0x4beb61){return _0x4beb61[_0xc610('0xe7')](_0x2dfdf3[_0xc610('0x44')]['ids'])['then'](function(){if(_[_0xc610('0xe8')](_0x2dfdf3[_0xc610('0x44')][_0xc610('0x6a')])){for(var _0x5d5a4f=0x0;_0x5d5a4f<_0x2dfdf3['query']['ids'][_0xc610('0x57')];_0x5d5a4f+=0x1){socket[_0xc610('0xe5')](_0xc610('0xe9'),{'UserId':Number(_0x2dfdf3[_0xc610('0x44')][_0xc610('0x6a')][_0x5d5a4f]),'SmsAccountId':Number(_0x2dfdf3[_0xc610('0x54')]['id'])});}}else{socket[_0xc610('0xe5')](_0xc610('0xe9'),{'UserId':Number(_0x2dfdf3[_0xc610('0x44')][_0xc610('0x6a')]),'SmsAccountId':Number(_0x2dfdf3[_0xc610('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x52619b,null))[_0xc610('0x28')](handleError(_0x52619b,null));};exports[_0xc610('0xea')]=function(_0x1ca3a5,_0x5f01cf,_0x14202b){var _0x323bd1={};var _0x4dfe8d={};var _0xa3766c;var _0x34c691;return db[_0xc610('0x4f')][_0xc610('0x66')]({'where':{'id':_0x1ca3a5['params']['id']}})[_0xc610('0x1e')](handleEntityNotFound(_0x5f01cf,null))['then'](function(_0x15fc8b){if(_0x15fc8b){_0xa3766c=_0x15fc8b;_0x4dfe8d['model']=_['keys'](db[_0xc610('0xeb')][_0xc610('0x3f')]);_0x4dfe8d[_0xc610('0x44')]=_[_0xc610('0x55')](_0x1ca3a5['query']);_0x4dfe8d[_0xc610('0x56')]=_[_0xc610('0x46')](_0x4dfe8d['model'],_0x4dfe8d[_0xc610('0x44')]);_0x323bd1[_0xc610('0x45')]=_[_0xc610('0x46')](_0x4dfe8d[_0xc610('0x43')],qs[_0xc610('0x47')](_0x1ca3a5[_0xc610('0x44')][_0xc610('0x47')]));_0x323bd1[_0xc610('0x45')]=_0x323bd1[_0xc610('0x45')][_0xc610('0x57')]?_0x323bd1[_0xc610('0x45')]:_0x4dfe8d['model'];_0x323bd1[_0xc610('0x49')]=qs[_0xc610('0x4a')](_0x1ca3a5[_0xc610('0x44')][_0xc610('0x4a')]);_0x323bd1[_0xc610('0x4b')]=qs[_0xc610('0x56')](_[_0xc610('0xc5')](_0x1ca3a5[_0xc610('0x44')],_0x4dfe8d[_0xc610('0x56')]));if(_0x1ca3a5[_0xc610('0x44')][_0xc610('0x4e')]){_0x323bd1[_0xc610('0x4b')]=_['merge'](_0x323bd1['where'],{'$or':_[_0xc610('0x3e')](_0x323bd1[_0xc610('0x45')],function(_0x41e0c1){var _0x9e8ea0={};_0x9e8ea0[_0x41e0c1]={'$like':'%'+_0x1ca3a5[_0xc610('0x44')][_0xc610('0x4e')]+'%'};return _0x9e8ea0;})});}_0x323bd1=_[_0xc610('0x4c')]({},_0x323bd1,_0x1ca3a5[_0xc610('0x68')]);return _0xa3766c['getAgents'](_0x323bd1);}})['then'](function(_0x1d09da){if(_0x1d09da){_0x34c691=_0x1d09da[_0xc610('0x57')];if(!_0x1ca3a5[_0xc610('0x44')][_0xc610('0xc4')](_0xc610('0x48'))){_0x323bd1['limit']=qs['limit'](_0x1ca3a5['query']['limit']);_0x323bd1[_0xc610('0x2f')]=qs[_0xc610('0x2f')](_0x1ca3a5['query'][_0xc610('0x2f')]);}return _0xa3766c[_0xc610('0xea')](_0x323bd1);}})['then'](function(_0x3a7895){if(_0x3a7895){return _0x3a7895?{'count':_0x34c691,'rows':_0x3a7895}:null;}})['then'](respondWithResult(_0x5f01cf,null))['catch'](handleError(_0x5f01cf,null));}; \ No newline at end of file +var _0x4496=['SmsApplication','Applications','account','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','ListId','from','From','Body','messageId','MessageSid','skebby','sender','connectel','message_id','Text','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','applications','push','close','*,*,*,*','SmsMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','twilio','Content-Type','\x0a','addApplications','sequelize','READ_COMMITTED','bulkCreate','stack','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','clicksend','groupName','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','destroy','UserProfileResource','name','send','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','SmsAccountId','include','removeDispositions','ids','CannedAnswer','removeAnswers','notify','sms'];(function(_0x1829f9,_0xad9ea7){var _0x17e2a6=function(_0x54c953){while(--_0x54c953){_0x1829f9['push'](_0x1829f9['shift']());}};_0x17e2a6(++_0xad9ea7);}(_0x4496,0x6b));var _0x6449=function(_0x211936,_0x499910){_0x211936=_0x211936-0x0;var _0x149913=_0x4496[_0x211936];return _0x149913;};'use strict';var emlformat=require(_0x6449('0x0'));var rimraf=require(_0x6449('0x1'));var zipdir=require(_0x6449('0x2'));var jsonpatch=require(_0x6449('0x3'));var rp=require(_0x6449('0x4'));var moment=require(_0x6449('0x5'));var BPromise=require(_0x6449('0x6'));var Mustache=require('mustache');var util=require(_0x6449('0x7'));var path=require(_0x6449('0x8'));var sox=require(_0x6449('0x9'));var csv=require(_0x6449('0xa'));var ejs=require(_0x6449('0xb'));var fs=require('fs');var fs_extra=require(_0x6449('0xc'));var _=require(_0x6449('0xd'));var squel=require('squel');var crypto=require(_0x6449('0xe'));var jsforce=require(_0x6449('0xf'));var deskjs=require(_0x6449('0x10'));var toCsv=require(_0x6449('0xa'));var querystring=require('querystring');var Papa=require(_0x6449('0x11'));var Redis=require(_0x6449('0x12'));var authService=require(_0x6449('0x13'));var qs=require(_0x6449('0x14'));var as=require(_0x6449('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6449('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6449('0x17'));var db=require(_0x6449('0x18'))['db'];config[_0x6449('0x19')]=_[_0x6449('0x1a')](config['redis'],{'host':_0x6449('0x1b'),'port':0x18eb});var socket=require(_0x6449('0x1c'))(new Redis(config[_0x6449('0x19')]));require('./smsAccount.socket')[_0x6449('0x1d')](socket);var jayson=require(_0x6449('0x1e'));var client=jayson[_0x6449('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0xe99695,_0x331512,_0x21c5b8,_0x47376a){return new BPromise(function(_0x11a819,_0x28e1cc){var _0x59b65b=_0x47376a||client;return _0x59b65b[_0x6449('0x20')](_0xe99695,_0x21c5b8)[_0x6449('0x21')](function(_0x42d01a){logger[_0x6449('0x22')]('SmsAccount,\x20%s,\x20%s',_0x331512,_0x6449('0x23'));logger[_0x6449('0x24')](_0x6449('0x25'),_0x331512,_0x6449('0x23'),JSON[_0x6449('0x26')](_0x42d01a));if(_0x42d01a[_0x6449('0x27')]){if(_0x42d01a[_0x6449('0x27')]['code']===0x1f4){logger[_0x6449('0x27')](_0x6449('0x28'),_0x331512,_0x42d01a[_0x6449('0x27')][_0x6449('0x29')]);return _0x28e1cc(_0x42d01a['error']['message']);}logger[_0x6449('0x27')](_0x6449('0x28'),_0x331512,_0x42d01a[_0x6449('0x27')]['message']);return _0x11a819(_0x42d01a[_0x6449('0x27')][_0x6449('0x29')]);}else{logger['info'](_0x6449('0x28'),_0x331512,_0x6449('0x23'));_0x11a819(_0x42d01a[_0x6449('0x2a')][_0x6449('0x29')]);}})['catch'](function(_0x11b923){logger[_0x6449('0x27')]('SmsAccount,\x20%s,\x20%s',_0x331512,_0x11b923);_0x28e1cc(_0x11b923);});});}function respondWithStatusCode(_0x282ee2,_0xd0a4c9){_0xd0a4c9=_0xd0a4c9||0xcc;return function(_0x52320f){if(_0x52320f){return _0x282ee2[_0x6449('0x2b')](_0xd0a4c9);}return _0x282ee2[_0x6449('0x2c')](_0xd0a4c9)[_0x6449('0x2d')]();};}function respondWithResult(_0x511f85,_0x41249c){_0x41249c=_0x41249c||0xc8;return function(_0x131de9){if(_0x131de9){return _0x511f85['status'](_0x41249c)[_0x6449('0x2e')](_0x131de9);}};}function respondWithFilteredResult(_0x242673,_0x344981){return function(_0x3d6e54){if(_0x3d6e54){var _0x5420ba=typeof _0x344981['offset']===_0x6449('0x2f')&&typeof _0x344981[_0x6449('0x30')]===_0x6449('0x2f');var _0x4b2653=_0x3d6e54[_0x6449('0x31')];var _0x2f1004=_0x5420ba?0x0:_0x344981[_0x6449('0x32')];var _0x396701=_0x5420ba?_0x3d6e54[_0x6449('0x31')]:_0x344981[_0x6449('0x32')]+_0x344981[_0x6449('0x30')];var _0x1f5fc9;if(_0x396701>=_0x4b2653){_0x396701=_0x4b2653;_0x1f5fc9=0xc8;}else{_0x1f5fc9=0xce;}_0x242673[_0x6449('0x2c')](_0x1f5fc9);return _0x242673[_0x6449('0x33')]('Content-Range',_0x2f1004+'-'+_0x396701+'/'+_0x4b2653)['json'](_0x3d6e54);}return null;};}function patchUpdates(_0x38a28c){return function(_0x3f69d2){try{jsonpatch[_0x6449('0x34')](_0x3f69d2,_0x38a28c,!![]);}catch(_0xde915e){return BPromise[_0x6449('0x35')](_0xde915e);}return _0x3f69d2['save']();};}function saveUpdates(_0x53a0c6,_0x201bc5){return function(_0x3d91a3){if(_0x3d91a3){return _0x3d91a3[_0x6449('0x36')](_0x53a0c6)['then'](function(_0x234779){return _0x234779;});}return null;};}function removeEntity(_0x53b547,_0x1b6dd8){return function(_0x3ba3f6){if(_0x3ba3f6){return _0x3ba3f6[_0x6449('0x37')]()[_0x6449('0x21')](function(){var _0x2d9ac2=_0x3ba3f6['get']({'plain':!![]});var _0x5d49ad='SmsAccounts';return db[_0x6449('0x38')][_0x6449('0x37')]({'where':{'type':_0x5d49ad,'resourceId':_0x2d9ac2['id']}})[_0x6449('0x21')](function(){return _0x3ba3f6;});})[_0x6449('0x21')](function(){_0x53b547['status'](0xcc)[_0x6449('0x2d')]();});}};}function handleEntityNotFound(_0x1b22a8,_0x5cda17){return function(_0x4f3042){if(!_0x4f3042){_0x1b22a8[_0x6449('0x2b')](0x194);}return _0x4f3042;};}function handleError(_0x1ddc52,_0x35ecd3){_0x35ecd3=_0x35ecd3||0x1f4;return function(_0x1c2996){logger[_0x6449('0x27')](_0x1c2996['stack']);if(_0x1c2996[_0x6449('0x39')]){delete _0x1c2996['name'];}_0x1ddc52[_0x6449('0x2c')](_0x35ecd3)[_0x6449('0x3a')](_0x1c2996);};}exports[_0x6449('0x3b')]=function(_0x3cec2e,_0xc96e45){var _0x458713={'include':[{'model':db[_0x6449('0x3c')],'as':'mandatoryDispositionPause'}]},_0x512bfb={},_0x421e90={'count':0x0,'rows':[]};var _0x6124a2=_[_0x6449('0x3d')](db[_0x6449('0x3e')][_0x6449('0x3f')],function(_0x3a7b81){return{'name':_0x3a7b81[_0x6449('0x40')],'type':_0x3a7b81[_0x6449('0x41')][_0x6449('0x42')]};});_0x512bfb['model']=_['map'](_0x6124a2,'name');_0x512bfb[_0x6449('0x43')]=_['keys'](_0x3cec2e[_0x6449('0x43')]);_0x512bfb[_0x6449('0x44')]=_['intersection'](_0x512bfb[_0x6449('0x45')],_0x512bfb[_0x6449('0x43')]);_0x458713[_0x6449('0x46')]=_[_0x6449('0x47')](_0x512bfb[_0x6449('0x45')],qs[_0x6449('0x48')](_0x3cec2e[_0x6449('0x43')][_0x6449('0x48')]));_0x458713[_0x6449('0x46')]=_0x458713['attributes'][_0x6449('0x49')]?_0x458713[_0x6449('0x46')]:_0x512bfb[_0x6449('0x45')];if(!_0x3cec2e[_0x6449('0x43')]['hasOwnProperty']('nolimit')){_0x458713[_0x6449('0x30')]=qs['limit'](_0x3cec2e['query'][_0x6449('0x30')]);_0x458713[_0x6449('0x32')]=qs[_0x6449('0x32')](_0x3cec2e[_0x6449('0x43')][_0x6449('0x32')]);}_0x458713[_0x6449('0x4a')]=qs['sort'](_0x3cec2e[_0x6449('0x43')][_0x6449('0x4b')]);_0x458713[_0x6449('0x4c')]=qs['filters'](_[_0x6449('0x4d')](_0x3cec2e['query'],_0x512bfb[_0x6449('0x44')]),_0x6124a2);if(_0x3cec2e[_0x6449('0x43')][_0x6449('0x4e')]){_0x458713[_0x6449('0x4c')]=_['merge'](_0x458713['where'],{'$or':_[_0x6449('0x3d')](_0x6124a2,function(_0x25bb88){if(_0x25bb88['type']!==_0x6449('0x4f')){var _0xc3091c={};_0xc3091c[_0x25bb88['name']]={'$like':'%'+_0x3cec2e[_0x6449('0x43')][_0x6449('0x4e')]+'%'};return _0xc3091c;}})});}_0x458713=_[_0x6449('0x50')]({},_0x458713,_0x3cec2e[_0x6449('0x51')]);var _0x247aba={'where':_0x458713[_0x6449('0x4c')]};return db[_0x6449('0x3e')]['count'](_0x247aba)[_0x6449('0x21')](function(_0x4f1bfb){_0x421e90['count']=_0x4f1bfb;if(_0x3cec2e[_0x6449('0x43')]['includeAll']){_0x458713['include']=[{'all':!![]}];}return db['SmsAccount'][_0x6449('0x52')](_0x458713);})[_0x6449('0x21')](function(_0x47d492){_0x421e90[_0x6449('0x53')]=_0x47d492;return _0x421e90;})['then'](respondWithFilteredResult(_0xc96e45,_0x458713))['catch'](handleError(_0xc96e45,null));};exports[_0x6449('0x54')]=function(_0x2e963f,_0x5afbc8){var _0x2d2f7f={'raw':![],'where':{'id':_0x2e963f[_0x6449('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x6449('0x56')}]},_0x33692a={};_0x33692a[_0x6449('0x45')]=_[_0x6449('0x57')](db[_0x6449('0x3e')]['rawAttributes']);_0x33692a['query']=_[_0x6449('0x57')](_0x2e963f[_0x6449('0x43')]);_0x33692a['filters']=_[_0x6449('0x47')](_0x33692a['model'],_0x33692a[_0x6449('0x43')]);_0x2d2f7f[_0x6449('0x46')]=_['intersection'](_0x33692a[_0x6449('0x45')],qs[_0x6449('0x48')](_0x2e963f[_0x6449('0x43')][_0x6449('0x48')]));_0x2d2f7f[_0x6449('0x46')]=_0x2d2f7f[_0x6449('0x46')][_0x6449('0x49')]?_0x2d2f7f[_0x6449('0x46')]:_0x33692a[_0x6449('0x45')];if(_0x2e963f[_0x6449('0x43')]['includeAll']){_0x2d2f7f['include']=[{'all':!![]}];}_0x2d2f7f=_[_0x6449('0x50')]({},_0x2d2f7f,_0x2e963f['options']);return db[_0x6449('0x3e')][_0x6449('0x58')](_0x2d2f7f)[_0x6449('0x21')](handleEntityNotFound(_0x5afbc8,null))[_0x6449('0x21')](respondWithResult(_0x5afbc8,null))['catch'](handleError(_0x5afbc8,null));};exports['create']=function(_0x49b124,_0x430acb){return db['SmsAccount'][_0x6449('0x59')](_0x49b124[_0x6449('0x5a')],{})[_0x6449('0x21')](function(_0x56c286){var _0x4af22d=_0x49b124[_0x6449('0x5b')][_0x6449('0x5c')]({'plain':!![]});if(!_0x4af22d)throw new Error(_0x6449('0x5d'));if(_0x4af22d['role']==='user'){var _0x57c6e9=_0x56c286[_0x6449('0x5c')]({'plain':!![]});var _0x43836d=_0x6449('0x5e');return db['UserProfileSection'][_0x6449('0x58')]({'where':{'name':_0x43836d,'userProfileId':_0x4af22d[_0x6449('0x5f')]},'raw':!![]})['then'](function(_0x743296){if(_0x743296&&_0x743296[_0x6449('0x60')]===0x0){return db[_0x6449('0x38')][_0x6449('0x59')]({'name':_0x57c6e9[_0x6449('0x39')],'resourceId':_0x57c6e9['id'],'type':_0x743296['name'],'sectionId':_0x743296['id']},{})['then'](function(){return _0x56c286;});}else{return _0x56c286;}})[_0x6449('0x61')](function(_0x4387c1){logger[_0x6449('0x27')](_0x6449('0x62'),_0x4387c1);throw _0x4387c1;});}return _0x56c286;})[_0x6449('0x21')](respondWithResult(_0x430acb,0xc9))[_0x6449('0x61')](handleError(_0x430acb,null));};exports[_0x6449('0x36')]=function(_0x28583a,_0x5403d2){if(_0x28583a[_0x6449('0x5a')]['id']){delete _0x28583a[_0x6449('0x5a')]['id'];}return db['SmsAccount'][_0x6449('0x58')]({'where':{'id':_0x28583a[_0x6449('0x55')]['id']},'include':[{'model':db[_0x6449('0x3c')],'as':_0x6449('0x56')}]})[_0x6449('0x21')](handleEntityNotFound(_0x5403d2,null))[_0x6449('0x21')](saveUpdates(_0x28583a[_0x6449('0x5a')],null))[_0x6449('0x21')](respondWithResult(_0x5403d2,null))['catch'](handleError(_0x5403d2,null));};exports[_0x6449('0x37')]=function(_0x1080a1,_0x209e90){return db[_0x6449('0x3e')][_0x6449('0x58')]({'where':{'id':_0x1080a1[_0x6449('0x55')]['id']}})[_0x6449('0x21')](handleEntityNotFound(_0x209e90,null))[_0x6449('0x21')](removeEntity(_0x209e90,null))[_0x6449('0x61')](handleError(_0x209e90,null));};exports[_0x6449('0x63')]=function(_0x59c759,_0x2abd31){return db['SmsAccount']['describe']()[_0x6449('0x21')](respondWithResult(_0x2abd31,null))[_0x6449('0x61')](handleError(_0x2abd31,null));};exports[_0x6449('0x64')]=function(_0x36c1c3,_0x3f1dd0,_0x54971f){if(_0x36c1c3['body']['id']){delete _0x36c1c3[_0x6449('0x5a')]['id'];}return db['SmsAccount'][_0x6449('0x58')]({'where':{'id':_0x36c1c3[_0x6449('0x55')]['id']}})[_0x6449('0x21')](handleEntityNotFound(_0x3f1dd0,null))[_0x6449('0x21')](function(_0x19d93f){if(_0x19d93f){_0x36c1c3[_0x6449('0x5a')]['SmsAccountId']=_0x19d93f['id'];return db[_0x6449('0x65')][_0x6449('0x59')](_0x36c1c3[_0x6449('0x5a')]);}})[_0x6449('0x21')](respondWithResult(_0x3f1dd0,null))[_0x6449('0x61')](handleError(_0x3f1dd0,null));};exports[_0x6449('0x66')]=function(_0x21f3fc,_0x3a7010,_0x56c694){var _0x3984a5={'raw':![],'where':{}};var _0x3ce8af={};var _0x3b93d1={'count':0x0,'rows':[]};return db[_0x6449('0x3e')][_0x6449('0x67')]({'where':{'id':_0x21f3fc['params']['id']}})[_0x6449('0x21')](handleEntityNotFound(_0x3a7010,null))['then'](function(_0x1a3d49){if(_0x1a3d49){_0x3ce8af[_0x6449('0x45')]=_[_0x6449('0x57')](db[_0x6449('0x65')][_0x6449('0x3f')]);_0x3ce8af[_0x6449('0x43')]=_[_0x6449('0x57')](_0x21f3fc[_0x6449('0x43')]);_0x3ce8af[_0x6449('0x44')]=_[_0x6449('0x47')](_0x3ce8af[_0x6449('0x45')],_0x3ce8af['query']);_0x3984a5[_0x6449('0x46')]=_['intersection'](_0x3ce8af[_0x6449('0x45')],qs['fields'](_0x21f3fc[_0x6449('0x43')][_0x6449('0x48')]));_0x3984a5[_0x6449('0x46')]=_0x3984a5[_0x6449('0x46')]['length']?_0x3984a5[_0x6449('0x46')]:_0x3ce8af['model'];if(!_0x21f3fc[_0x6449('0x43')][_0x6449('0x68')](_0x6449('0x69'))){_0x3984a5[_0x6449('0x30')]=qs[_0x6449('0x30')](_0x21f3fc[_0x6449('0x43')][_0x6449('0x30')]);_0x3984a5[_0x6449('0x32')]=qs[_0x6449('0x32')](_0x21f3fc[_0x6449('0x43')][_0x6449('0x32')]);}_0x3984a5[_0x6449('0x4a')]=qs['sort'](_0x21f3fc[_0x6449('0x43')][_0x6449('0x4b')]);_0x3984a5[_0x6449('0x4c')]=qs[_0x6449('0x44')](_[_0x6449('0x4d')](_0x21f3fc[_0x6449('0x43')],_0x3ce8af[_0x6449('0x44')]));_0x3984a5[_0x6449('0x4c')][_0x6449('0x6a')]=_0x1a3d49['id'];if(_0x21f3fc[_0x6449('0x43')][_0x6449('0x4e')]){_0x3984a5[_0x6449('0x4c')]=_[_0x6449('0x50')](_0x3984a5['where'],{'$or':_[_0x6449('0x3d')](_0x3984a5[_0x6449('0x46')],function(_0x504259){var _0x145b5a={};_0x145b5a[_0x504259]={'$like':'%'+_0x21f3fc[_0x6449('0x43')][_0x6449('0x4e')]+'%'};return _0x145b5a;})});}_0x3984a5=_[_0x6449('0x50')]({},_0x3984a5,_0x21f3fc['options']);return db[_0x6449('0x65')]['count']({'where':_0x3984a5[_0x6449('0x4c')]})[_0x6449('0x21')](function(_0xacf859){_0x3b93d1[_0x6449('0x31')]=_0xacf859;if(_0x21f3fc[_0x6449('0x43')]['includeAll']){_0x3984a5[_0x6449('0x6b')]=[{'all':!![]}];}return db['Disposition'][_0x6449('0x52')](_0x3984a5);})[_0x6449('0x21')](function(_0x257f7d){_0x3b93d1['rows']=_0x257f7d;return _0x3b93d1;});}})[_0x6449('0x21')](respondWithFilteredResult(_0x3a7010,_0x3984a5))[_0x6449('0x61')](handleError(_0x3a7010,null));};exports[_0x6449('0x6c')]=function(_0x28a418,_0x379b9f,_0x19dfd8){return db[_0x6449('0x3e')][_0x6449('0x58')]({'where':{'id':_0x28a418[_0x6449('0x55')]['id']}})[_0x6449('0x21')](handleEntityNotFound(_0x379b9f,null))[_0x6449('0x21')](function(_0x10aa54){if(_0x10aa54){return _0x10aa54[_0x6449('0x6c')](_0x28a418[_0x6449('0x43')][_0x6449('0x6d')]);}})[_0x6449('0x21')](respondWithStatusCode(_0x379b9f,null))[_0x6449('0x61')](handleError(_0x379b9f,null));};exports['addAnswer']=function(_0x3a98a1,_0x544646,_0x13b54c){if(_0x3a98a1[_0x6449('0x5a')]['id']){delete _0x3a98a1[_0x6449('0x5a')]['id'];}return db[_0x6449('0x3e')][_0x6449('0x58')]({'where':{'id':_0x3a98a1['params']['id']}})[_0x6449('0x21')](handleEntityNotFound(_0x544646,null))[_0x6449('0x21')](function(_0x2e4896){if(_0x2e4896){_0x3a98a1[_0x6449('0x5a')][_0x6449('0x6a')]=_0x2e4896['id'];return db[_0x6449('0x6e')][_0x6449('0x59')](_0x3a98a1['body']);}})[_0x6449('0x21')](respondWithResult(_0x544646,null))[_0x6449('0x61')](handleError(_0x544646,null));};exports['getAnswers']=function(_0x24f187,_0x9a70a8,_0x221604){var _0x26222a={'raw':![],'where':{}};var _0xce6333={};var _0x5b141c={'count':0x0,'rows':[]};return db[_0x6449('0x3e')][_0x6449('0x67')]({'where':{'id':_0x24f187[_0x6449('0x55')]['id']}})['then'](handleEntityNotFound(_0x9a70a8,null))[_0x6449('0x21')](function(_0x1fbe81){if(_0x1fbe81){_0xce6333['model']=_[_0x6449('0x57')](db[_0x6449('0x6e')][_0x6449('0x3f')]);_0xce6333[_0x6449('0x43')]=_[_0x6449('0x57')](_0x24f187['query']);_0xce6333[_0x6449('0x44')]=_[_0x6449('0x47')](_0xce6333['model'],_0xce6333[_0x6449('0x43')]);_0x26222a['attributes']=_[_0x6449('0x47')](_0xce6333[_0x6449('0x45')],qs[_0x6449('0x48')](_0x24f187[_0x6449('0x43')][_0x6449('0x48')]));_0x26222a[_0x6449('0x46')]=_0x26222a[_0x6449('0x46')]['length']?_0x26222a['attributes']:_0xce6333[_0x6449('0x45')];if(!_0x24f187[_0x6449('0x43')][_0x6449('0x68')](_0x6449('0x69'))){_0x26222a[_0x6449('0x30')]=qs[_0x6449('0x30')](_0x24f187['query'][_0x6449('0x30')]);_0x26222a[_0x6449('0x32')]=qs[_0x6449('0x32')](_0x24f187[_0x6449('0x43')]['offset']);}_0x26222a['order']=qs[_0x6449('0x4b')](_0x24f187[_0x6449('0x43')][_0x6449('0x4b')]);_0x26222a[_0x6449('0x4c')]=qs[_0x6449('0x44')](_[_0x6449('0x4d')](_0x24f187['query'],_0xce6333[_0x6449('0x44')]));_0x26222a[_0x6449('0x4c')][_0x6449('0x6a')]=_0x1fbe81['id'];if(_0x24f187[_0x6449('0x43')][_0x6449('0x4e')]){_0x26222a[_0x6449('0x4c')]=_['merge'](_0x26222a[_0x6449('0x4c')],{'$or':_[_0x6449('0x3d')](_0x26222a['attributes'],function(_0x598927){var _0x1ae1e8={};_0x1ae1e8[_0x598927]={'$like':'%'+_0x24f187[_0x6449('0x43')][_0x6449('0x4e')]+'%'};return _0x1ae1e8;})});}_0x26222a=_['merge']({},_0x26222a,_0x24f187[_0x6449('0x51')]);return db['CannedAnswer'][_0x6449('0x31')]({'where':_0x26222a[_0x6449('0x4c')]})[_0x6449('0x21')](function(_0x1efff8){_0x5b141c[_0x6449('0x31')]=_0x1efff8;if(_0x24f187[_0x6449('0x43')]['includeAll']){_0x26222a['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x26222a);})[_0x6449('0x21')](function(_0x26cd24){_0x5b141c[_0x6449('0x53')]=_0x26cd24;return _0x5b141c;});}})[_0x6449('0x21')](respondWithFilteredResult(_0x9a70a8,_0x26222a))[_0x6449('0x61')](handleError(_0x9a70a8,null));};exports[_0x6449('0x6f')]=function(_0x37c0c7,_0x197f7a,_0x34fd73){return db['SmsAccount'][_0x6449('0x58')]({'where':{'id':_0x37c0c7[_0x6449('0x55')]['id']}})[_0x6449('0x21')](handleEntityNotFound(_0x197f7a,null))['then'](function(_0x12ec49){if(_0x12ec49){return _0x12ec49[_0x6449('0x6f')](_0x37c0c7[_0x6449('0x43')][_0x6449('0x6d')]);}})[_0x6449('0x21')](respondWithStatusCode(_0x197f7a,null))[_0x6449('0x61')](handleError(_0x197f7a,null));};exports[_0x6449('0x70')]=function(_0x5a469b,_0x52883a,_0x34dacf){var _0x3a146a={'channel':_0x6449('0x71')};var _0xd21e29=[];var _0x1cc54c=[];var _0x53498d={};return db['SmsAccount']['find']({'where':{'id':_0x5a469b[_0x6449('0x55')]['id']},'include':[{'model':db[_0x6449('0x72')],'as':_0x6449('0x73')}]})[_0x6449('0x21')](handleEntityNotFound(_0x52883a,null))[_0x6449('0x21')](function(_0x4ebabe){_0x3a146a[_0x6449('0x74')]=_0x4ebabe;_0x3a146a['applications']=_[_0x6449('0x75')](_0x4ebabe[_0x6449('0x73')],[_0x6449('0x76')],['asc']);if(_0x3a146a[_0x6449('0x74')][_0x6449('0x73')]){delete _0x3a146a[_0x6449('0x74')][_0x6449('0x73')];}return db[_0x6449('0x77')][_0x6449('0x63')]();})[_0x6449('0x21')](function(_0x42ea49){if(!_0x42ea49){throw new db[(_0x6449('0x78'))][(_0x6449('0x79'))](_0x6449('0x7a'));}_0xd21e29=_[_0x6449('0x7b')](_[_0x6449('0x57')](_0x42ea49),['createdAt',_0x6449('0x7c')]);_0x1cc54c=_['difference'](_['keys'](_0x42ea49),['createdAt',_0x6449('0x7c'),'CompanyId',_0x6449('0x7d')]);_0x3a146a['body']={'mapKey':'mobile'};if(_0x3a146a[_0x6449('0x74')]['type']){switch(_0x3a146a[_0x6449('0x74')]['type']){case'twilio':_0x3a146a[_0x6449('0x5a')][_0x6449('0x7e')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x7f')];_0x3a146a[_0x6449('0x5a')][_0x6449('0x5a')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x80')];_0x3a146a[_0x6449('0x5a')][_0x6449('0x81')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x82')];break;case _0x6449('0x83'):_0x3a146a[_0x6449('0x5a')]['from']='+'+_0x5a469b[_0x6449('0x5a')][_0x6449('0x84')];_0x3a146a['body']['body']=_0x5a469b[_0x6449('0x5a')]['text'];break;case _0x6449('0x85'):_0x3a146a['body'][_0x6449('0x7e')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x7e')];_0x3a146a[_0x6449('0x5a')][_0x6449('0x5a')]=_0x5a469b['body']['message'];break;case'clicksend':_0x3a146a[_0x6449('0x5a')][_0x6449('0x7e')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x7e')];_0x3a146a[_0x6449('0x5a')]['body']=_0x5a469b[_0x6449('0x5a')][_0x6449('0x5a')];_0x3a146a['body'][_0x6449('0x81')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x86')];break;case'plivo':_0x3a146a[_0x6449('0x5a')]['from']=_0x5a469b[_0x6449('0x5a')][_0x6449('0x7f')];_0x3a146a[_0x6449('0x5a')][_0x6449('0x5a')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x87')];_0x3a146a['body'][_0x6449('0x81')]=_0x5a469b[_0x6449('0x5a')]['MessageUUID'];break;case _0x6449('0x88'):_0x3a146a['body'][_0x6449('0x7e')]='+'+_0x5a469b[_0x6449('0x5a')][_0x6449('0x89')][0x0][_0x6449('0x7e')];_0x3a146a[_0x6449('0x5a')]['body']=_0x5a469b[_0x6449('0x5a')][_0x6449('0x89')][0x0][_0x6449('0x8a')];_0x3a146a[_0x6449('0x5a')]['messageId']=_0x5a469b[_0x6449('0x5a')][_0x6449('0x89')][0x0]['messageId'];break;case _0x6449('0x8b'):_0x3a146a['body']['from']=_0x5a469b[_0x6449('0x5a')][_0x6449('0x8c')];_0x3a146a[_0x6449('0x5a')][_0x6449('0x5a')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x8d')]['message'];break;case _0x6449('0x8e'):_0x3a146a[_0x6449('0x5a')][_0x6449('0x7e')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x8f')];_0x3a146a[_0x6449('0x5a')][_0x6449('0x5a')]=_0x5a469b['body'][_0x6449('0x8a')];_0x3a146a[_0x6449('0x5a')][_0x6449('0x81')]=_0x5a469b['body'][_0x6449('0x90')];break;case _0x6449('0x91'):_0x3a146a['body'][_0x6449('0x81')]=_0x5a469b[_0x6449('0x5a')][0x0]['message']['id'];_0x3a146a[_0x6449('0x5a')][_0x6449('0x7e')]=_0x5a469b['body'][0x0][_0x6449('0x29')][_0x6449('0x7e')];_0x3a146a[_0x6449('0x5a')][_0x6449('0x5a')]=_0x5a469b[_0x6449('0x5a')][0x0][_0x6449('0x29')]['text'];break;case _0x6449('0x92'):_0x3a146a['body'][_0x6449('0x7e')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x7e')];_0x3a146a[_0x6449('0x5a')][_0x6449('0x5a')]=_0x5a469b[_0x6449('0x5a')][_0x6449('0x29')];_0x3a146a[_0x6449('0x5a')][_0x6449('0x81')]=_0x5a469b['body'][_0x6449('0x93')];break;}}if(_0x3a146a[_0x6449('0x5a')]['id']){delete _0x3a146a['body']['id'];}if(_[_0x6449('0x94')](_0x3a146a[_0x6449('0x5a')][_0x6449('0x7e')])){throw new db[(_0x6449('0x78'))][(_0x6449('0x79'))](_0x6449('0x95'));}if(_[_0x6449('0x94')](_0x3a146a[_0x6449('0x5a')][_0x6449('0x5a')])||_0x3a146a[_0x6449('0x5a')]['body']===''){throw new db[(_0x6449('0x78'))][(_0x6449('0x79'))](_0x6449('0x96'));}if(_[_0x6449('0x94')](_0x3a146a[_0x6449('0x5a')][_0x6449('0x97')])){throw new db[(_0x6449('0x78'))]['ValidationError'](_0x6449('0x98')+_0x1cc54c);}if(!_[_0x6449('0x99')](_0x1cc54c,_0x3a146a[_0x6449('0x5a')]['mapKey'])){throw new db[(_0x6449('0x78'))][(_0x6449('0x79'))](_0x6449('0x9a')+_0x1cc54c);}_0x53498d[_0x3a146a['body']['mapKey']]=_0x3a146a[_0x6449('0x5a')][_0x6449('0x7e')];return db[_0x6449('0x9b')][_0x6449('0x58')]({'where':{'id':_0x3a146a['account'][_0x6449('0x7d')]},'include':[{'model':db[_0x6449('0x77')],'as':_0x6449('0x9c'),'where':_0x53498d,'limit':0x1,'order':[[_0x6449('0x7c'),'DESC']]}]});})[_0x6449('0x21')](handleEntityNotFound(_0x52883a,null))['then'](function(_0x316908){if(_0x316908){_0x3a146a[_0x6449('0x9d')]=_[_0x6449('0x9e')](_0x316908,['Contacts']);if(_0x316908[_0x6449('0x9c')][_0x6449('0x49')]){return _0x316908[_0x6449('0x9c')][0x0];}var _0x111c48=_['defaults'](_0x3a146a[_0x6449('0x5a')],{'firstName':_0x3a146a[_0x6449('0x5a')][_0x6449('0x7e')],'ListId':_0x316908['id']});_0x111c48[_0x3a146a[_0x6449('0x5a')][_0x6449('0x97')]]=_0x3a146a['body']['from'];return db[_0x6449('0x77')][_0x6449('0x59')](_0x111c48,{'fields':_0xd21e29,'raw':!![]});}})[_0x6449('0x21')](handleEntityNotFound(_0x52883a,null))[_0x6449('0x21')](function(_0x8fec1){if(_0x8fec1){_0x3a146a[_0x6449('0x9f')]=_0x8fec1;var _0x169a98={'ContactId':_0x8fec1['id'],'phone':_0x3a146a[_0x6449('0x5a')]['from'],'SmsAccountId':_0x5a469b['params']['id']};var _0x3aa480={'ContactId':_0x8fec1['id'],'SmsAccountId':_0x5a469b['params']['id'],'closed':![]};return db['SmsInteraction'][_0x6449('0x58')]({'where':_0x3aa480})[_0x6449('0x21')](function(_0x18ae70){if(_0x18ae70){return[_0x18ae70,![]];}return db[_0x6449('0xa0')][_0x6449('0x59')](_0x169a98)['then'](function(_0x3b5e7f){return[_0x3b5e7f,!![]];});});}})[_0x6449('0xa1')](function(_0x54a0c0,_0x43a305){_0x3a146a[_0x6449('0xa2')]=_0x54a0c0['get']({'plain':!![]});_0x3a146a[_0x6449('0xa2')][_0x6449('0xa3')]=![];if(_0x43a305){if(_0x3a146a[_0x6449('0x74')]['autoclose']){_0x3a146a[_0x6449('0xa4')][_0x6449('0xa5')]({'id':0x0,'priority':_0x3a146a[_0x6449('0xa4')][_0x6449('0x49')]+0x1,'app':_0x6449('0xa6'),'appdata':'unmanaged','interval':_0x6449('0xa7')});}_0x3a146a['interaction'][_0x6449('0xa3')]=!![];}return db[_0x6449('0xa8')]['create']({'phone':_0x3a146a['body'][_0x6449('0x7e')],'messageId':_0x3a146a[_0x6449('0x5a')]['messageId'],'body':_0x3a146a[_0x6449('0x5a')]['body'],'SmsAccountId':_0x5a469b[_0x6449('0x55')]['id'],'SmsInteractionId':_0x54a0c0['id'],'direction':'in','ContactId':_0x54a0c0['ContactId'],'AttachmentId':_0x3a146a[_0x6449('0x5a')][_0x6449('0xa9')]});})['then'](function(_0x2097c9){_0x3a146a[_0x6449('0x29')]=_0x2097c9;if(!_0x3a146a[_0x6449('0xa2')]['UserId'])return;return db[_0x6449('0xaa')][_0x6449('0x58')]({'attributes':['id',_0x6449('0x39')],'where':{'id':_0x3a146a['interaction'][_0x6449('0xab')]}});})[_0x6449('0x21')](function(_0x80a4c7){if(_0x80a4c7){_0x3a146a['applications'][_0x6449('0xac')]({'id':0x0,'priority':0x0,'app':_0x6449('0xad'),'appdata':_0x80a4c7['name']+','+(_0x3a146a['account'][_0x6449('0xae')]||0xa),'interval':'*,*,*,*'});}if(!_0x3a146a['interaction'][_0x6449('0xaf')])return;return db['SmsQueue']['find']({'attributes':['id',_0x6449('0x39')],'where':{'id':_0x3a146a[_0x6449('0xa2')]['queueId']}});})[_0x6449('0x21')](function(_0x209a4a){if(_0x209a4a){_0x3a146a['applications'][_0x6449('0xac')]({'id':0x0,'priority':0x1,'app':_0x6449('0xb0'),'appdata':_0x209a4a[_0x6449('0x39')]+','+(_0x3a146a[_0x6449('0x74')][_0x6449('0xb1')]||0x12c),'interval':_0x6449('0xa7')});}return respondWithRpcPromise(_0x6449('0xb2'),'startRouting',_0x3a146a);})[_0x6449('0x21')](function(_0x195b84){if(_0x195b84){var _0x35915f=0xc8;var _0x2da3a5=_0x6449('0xb3');logger[_0x6449('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2da3a5,_0x35915f,_0x6449('0xb4'));logger[_0x6449('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2da3a5,_0x35915f,_0x6449('0xb4'),JSON[_0x6449('0x26')](_0x195b84));if(_0x3a146a['account']['type']===_0x6449('0xb5')){return _0x52883a[_0x6449('0x2c')](_0x35915f)['set'](_0x6449('0xb6'),'text/xml')[_0x6449('0x3a')](_0x6449('0xb7'));}else{return _0x52883a[_0x6449('0x2c')](_0x35915f)[_0x6449('0x2e')](_0x195b84);}}})[_0x6449('0x61')](handleError(_0x52883a,null));};exports[_0x6449('0xb8')]=function(_0x1f3f3d,_0x1d84c6){var _0x1d697c=_0x1f3f3d['params']['id'];var _0x261caa=_0x1f3f3d[_0x6449('0x5a')];var _0x45e2fb=0xc8;var _0x1a5a55=null;return db[_0x6449('0xb9')]['transaction']({'isolationLevel':db[_0x6449('0xb9')]['Transaction']['ISOLATION_LEVELS'][_0x6449('0xba')]},function(_0x3e1495){return db[_0x6449('0x3e')][_0x6449('0x67')]({'where':{'id':_0x1d697c},'transaction':_0x3e1495})['then'](function(_0x261fac){if(_0x261fac){return db[_0x6449('0x72')]['destroy']({'where':{'SmsAccountId':_0x1d697c},'transaction':_0x3e1495})[_0x6449('0x21')](function(){var _0x4003c3=_[_0x6449('0x3d')](_0x261caa,function(_0x1ab6a0){_0x1ab6a0[_0x6449('0x6a')]=_0x1d697c;return _0x1ab6a0;});return db['SmsApplication'][_0x6449('0xbb')](_0x4003c3,{'transaction':_0x3e1495});});}else{_0x45e2fb=0x194;_0x1a5a55=[];}});})[_0x6449('0x21')](function(){if(_0x45e2fb!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x1d697c},'order':_0x6449('0x76')})[_0x6449('0x21')](function(_0xd05b4e){_0x1a5a55=_0xd05b4e;});}})[_0x6449('0x61')](function(_0x284bae){_0x45e2fb=0x1f4;logger[_0x6449('0x27')](_0x284bae[_0x6449('0xbc')]);if(_0x284bae[_0x6449('0x39')]){delete _0x284bae[_0x6449('0x39')];}_0x1a5a55=_0x284bae;})[_0x6449('0xbd')](function(){if(_0x1a5a55===null){_0x1d84c6[_0x6449('0x2b')](_0x45e2fb);}else{if(_0x45e2fb===0x1f4){_0x1d84c6[_0x6449('0x2c')](_0x45e2fb)['send'](_0x1a5a55);}else{_0x1d84c6[_0x6449('0x2c')](_0x45e2fb)['json'](_0x1a5a55);}}});};exports[_0x6449('0xbe')]=function(_0x455c08,_0x1e4676,_0x53367b){var _0x103e60={};var _0x4e1697={};var _0x120bfb;var _0xc3c04;return db[_0x6449('0x3e')][_0x6449('0x67')]({'where':{'id':_0x455c08[_0x6449('0x55')]['id']}})['then'](handleEntityNotFound(_0x1e4676,null))[_0x6449('0x21')](function(_0x14df07){if(_0x14df07){_0x120bfb=_0x14df07;_0x4e1697[_0x6449('0x45')]=_[_0x6449('0x57')](db['SmsApplication'][_0x6449('0x3f')]);_0x4e1697[_0x6449('0x43')]=_[_0x6449('0x57')](_0x455c08[_0x6449('0x43')]);_0x4e1697[_0x6449('0x44')]=_[_0x6449('0x47')](_0x4e1697[_0x6449('0x45')],_0x4e1697[_0x6449('0x43')]);_0x103e60[_0x6449('0x46')]=_[_0x6449('0x47')](_0x4e1697[_0x6449('0x45')],qs[_0x6449('0x48')](_0x455c08[_0x6449('0x43')][_0x6449('0x48')]));_0x103e60[_0x6449('0x46')]=_0x103e60[_0x6449('0x46')][_0x6449('0x49')]?_0x103e60[_0x6449('0x46')]:_0x4e1697[_0x6449('0x45')];_0x103e60[_0x6449('0x4a')]=qs[_0x6449('0x4b')](_0x455c08[_0x6449('0x43')][_0x6449('0x4b')]);_0x103e60[_0x6449('0x4c')]=qs[_0x6449('0x44')](_['pick'](_0x455c08[_0x6449('0x43')],_0x4e1697[_0x6449('0x44')]));if(_0x455c08['query'][_0x6449('0x4e')]){_0x103e60['where']=_[_0x6449('0x50')](_0x103e60[_0x6449('0x4c')],{'$or':_['map'](_0x103e60[_0x6449('0x46')],function(_0x25bb7c){var _0x33c6e9={};_0x33c6e9[_0x25bb7c]={'$like':'%'+_0x455c08[_0x6449('0x43')][_0x6449('0x4e')]+'%'};return _0x33c6e9;})});}_0x103e60=_['merge']({},_0x103e60,_0x455c08[_0x6449('0x51')]);return _0x120bfb[_0x6449('0xbe')](_0x103e60);}})[_0x6449('0x21')](function(_0xd104e1){if(_0xd104e1){_0xc3c04=_0xd104e1[_0x6449('0x49')];if(!_0x455c08[_0x6449('0x43')][_0x6449('0x68')]('nolimit')){_0x103e60[_0x6449('0x30')]=qs[_0x6449('0x30')](_0x455c08['query']['limit']);_0x103e60[_0x6449('0x32')]=qs[_0x6449('0x32')](_0x455c08[_0x6449('0x43')][_0x6449('0x32')]);}return _0x120bfb['getApplications'](_0x103e60);}})[_0x6449('0x21')](function(_0x2dbda8){if(_0x2dbda8){return _0x2dbda8?{'count':_0xc3c04,'rows':_0x2dbda8}:null;}})[_0x6449('0x21')](respondWithResult(_0x1e4676,null))[_0x6449('0x61')](handleError(_0x1e4676,null));};exports[_0x6449('0xbf')]=function(_0x5278bf,_0x202a1c,_0x34a05d){var _0x10f1d9={'raw':![],'where':{}};var _0x49ea71={};var _0x143584={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x5278bf['params']['id']}})[_0x6449('0x21')](handleEntityNotFound(_0x202a1c,null))[_0x6449('0x21')](function(_0x1711b3){if(_0x1711b3){_0x49ea71['model']=_['keys'](db[_0x6449('0xa0')][_0x6449('0x3f')]);_0x49ea71[_0x6449('0x43')]=_['keys'](_0x5278bf['query']);_0x49ea71[_0x6449('0x44')]=_['intersection'](_0x49ea71[_0x6449('0x45')],_0x49ea71[_0x6449('0x43')]);_0x10f1d9[_0x6449('0x46')]=_['intersection'](_0x49ea71['model'],qs[_0x6449('0x48')](_0x5278bf[_0x6449('0x43')][_0x6449('0x48')]));_0x10f1d9[_0x6449('0x46')]=_0x10f1d9[_0x6449('0x46')][_0x6449('0x49')]?_0x10f1d9['attributes']:_0x49ea71[_0x6449('0x45')];if(!_0x5278bf[_0x6449('0x43')]['hasOwnProperty'](_0x6449('0x69'))){_0x10f1d9[_0x6449('0x30')]=qs[_0x6449('0x30')](_0x5278bf['query'][_0x6449('0x30')]);_0x10f1d9[_0x6449('0x32')]=qs[_0x6449('0x32')](_0x5278bf[_0x6449('0x43')][_0x6449('0x32')]);}_0x10f1d9[_0x6449('0x4a')]=qs[_0x6449('0x4b')](_0x5278bf['query']['sort']);_0x10f1d9['where']=qs[_0x6449('0x44')](_[_0x6449('0x4d')](_0x5278bf[_0x6449('0x43')],_0x49ea71[_0x6449('0x44')]));_0x10f1d9['where'][_0x6449('0x6a')]=_0x1711b3['id'];if(_0x5278bf[_0x6449('0x43')][_0x6449('0x4e')]){_0x10f1d9[_0x6449('0x4c')]=_[_0x6449('0x50')](_0x10f1d9['where'],{'$or':_[_0x6449('0x3d')](_0x10f1d9[_0x6449('0x46')],function(_0x305978){var _0x50673b={};_0x50673b[_0x305978]={'$like':'%'+_0x5278bf[_0x6449('0x43')][_0x6449('0x4e')]+'%'};return _0x50673b;})});}_0x10f1d9=_[_0x6449('0x50')]({},_0x10f1d9,_0x5278bf[_0x6449('0x51')]);return db['SmsInteraction'][_0x6449('0x31')]({'where':_0x10f1d9[_0x6449('0x4c')]})[_0x6449('0x21')](function(_0x22860a){_0x143584[_0x6449('0x31')]=_0x22860a;if(_0x5278bf[_0x6449('0x43')]['includeAll']){_0x10f1d9['include']=[{'model':db[_0x6449('0x77')],'as':_0x6449('0xc0'),'required':![]},{'model':db[_0x6449('0xaa')],'as':_0x6449('0xc1'),'attributes':[_0x6449('0x39'),'fullname',_0x6449('0xc2')],'required':![]},{'model':db[_0x6449('0xc3')],'as':'Tags','attributes':['id',_0x6449('0x39'),'color'],'where':_0x5278bf[_0x6449('0x43')]['tag']?{'id':_0x5278bf[_0x6449('0x43')]['tag']}:undefined,'required':_0x5278bf[_0x6449('0x43')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x6449('0x52')](_0x10f1d9);})[_0x6449('0x21')](function(_0x437ab6){_0x143584['rows']=_0x437ab6;return _0x143584;});}})[_0x6449('0x21')](respondWithFilteredResult(_0x202a1c,_0x10f1d9))[_0x6449('0x61')](handleError(_0x202a1c,null));};exports[_0x6449('0x3a')]=function(_0x1c7a0d,_0x12a276,_0x8b2a63){var _0x5b3c5a,_0x24bfd8,_0x597978;if(_[_0x6449('0x94')](_0x1c7a0d['body'][_0x6449('0x5a')])||_0x1c7a0d[_0x6449('0x5a')]['body']===''){throw new db[(_0x6449('0x78'))][(_0x6449('0x79'))](_0x6449('0x96'));}if(_[_0x6449('0x94')](_0x1c7a0d[_0x6449('0x5a')]['to'])){throw new db[(_0x6449('0x78'))][(_0x6449('0x79'))](_0x6449('0xc4'));}_0x5b3c5a=_0x1c7a0d[_0x6449('0x5a')]['to'];return db[_0x6449('0x3e')][_0x6449('0x58')]({'where':{'id':_0x1c7a0d['params']['id']},'include':[{'model':db[_0x6449('0x9b')],'as':_0x6449('0xc5'),'include':[{'model':db[_0x6449('0x77')],'as':_0x6449('0x9c'),'where':{'mobile':_0x5b3c5a},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x12a276,null))[_0x6449('0x21')](function(_0x5dbd79){if(_0x5dbd79&&_0x5dbd79[_0x6449('0xc5')]){_0x24bfd8=_0x5dbd79[_0x6449('0x5c')]({'plain':!![]});if(_0x24bfd8[_0x6449('0xc5')]&&_0x24bfd8[_0x6449('0xc5')][_0x6449('0x9c')][_0x6449('0x49')]){return _0x24bfd8[_0x6449('0xc5')][_0x6449('0x9c')][0x0];}return db[_0x6449('0x77')][_0x6449('0x59')](_[_0x6449('0x1a')](_0x1c7a0d['body'],{'firstName':_0x5b3c5a,'mobile':_0x5b3c5a,'phone':_0x5b3c5a,'ListId':_0x24bfd8[_0x6449('0x7d')]}));}})[_0x6449('0x21')](handleEntityNotFound(_0x12a276,null))[_0x6449('0x21')](function(_0x5b73f3){if(_0x5b73f3){_0x597978=_0x5b73f3;return db[_0x6449('0xa0')][_0x6449('0x58')]({'where':{'ContactId':_0x597978['id'],'closed':![],'SmsAccountId':_0x24bfd8['id']}})[_0x6449('0x21')](function(_0x1fdadb){if(_0x1fdadb){return[_0x1fdadb,![]];}return db[_0x6449('0xa0')][_0x6449('0x59')]({'UserId':_0x1c7a0d[_0x6449('0x5b')]['id'],'ContactId':_0x597978['id'],'SmsAccountId':_0x24bfd8['id'],'phone':_0x5b3c5a,'firstMsgDirection':_0x6449('0xc6'),'Messages':[_[_0x6449('0x50')](_0x1c7a0d['body'],{'read':![],'body':_0x1c7a0d[_0x6449('0x5a')]['body'],'phone':_0x5b3c5a,'SmsAccountId':_0x24bfd8['id'],'UserId':_0x1c7a0d[_0x6449('0x5b')]['id'],'ContactId':_0x597978['id']})]},{'include':[{'model':db[_0x6449('0xa8')],'as':_0x6449('0xc7')}]})[_0x6449('0x21')](function(_0x14940a){return[_0x14940a,!![]];});});}})[_0x6449('0xa1')](function(_0x1e8298,_0x5a4cee){if(_0x5a4cee){return _0x1e8298;}return db[_0x6449('0xa8')][_0x6449('0x59')](_[_0x6449('0x50')](_0x1c7a0d[_0x6449('0x5a')],{'read':![],'body':_0x1c7a0d[_0x6449('0x5a')][_0x6449('0x5a')],'phone':_0x5b3c5a,'SmsAccountId':_0x24bfd8['id'],'SmsInteractionId':_0x1e8298['id'],'UserId':_0x1c7a0d[_0x6449('0x5b')]['id'],'ContactId':_0x597978['id']}))[_0x6449('0x21')](function(_0x1aa9ac){_0x1e8298[_0x6449('0xc8')]['Messages']=[];_0x1e8298[_0x6449('0xc8')]['Messages'][_0x6449('0xa5')](_0x1aa9ac[_0x6449('0xc8')]);return _0x1e8298;});})[_0x6449('0x21')](respondWithResult(_0x12a276,null))[_0x6449('0x61')](handleError(_0x12a276,null));};exports['status']=function(_0x59964b,_0x4a6da2,_0x27f6c9){if(_0x59964b[_0x6449('0x5a')]['id']){delete _0x59964b[_0x6449('0x5a')]['id'];}var _0x5aaa72,_0x245acb,_0x2ad99f;return db[_0x6449('0x3e')][_0x6449('0x58')]({'where':{'id':_0x59964b[_0x6449('0x55')]['id']}})['then'](handleEntityNotFound(_0x4a6da2,null))[_0x6449('0x21')](function(_0x214161){if(_0x214161){_0x2ad99f=_0x214161;logger[_0x6449('0x24')](_0x6449('0x25'),_0x6449('0x2c'),_0x6449('0xc9'),_0x214161[_0x6449('0x41')],util[_0x6449('0xca')](_0x59964b[_0x6449('0x5a')],{'showHidden':![],'depth':null}));switch(_0x214161['type']){case _0x6449('0x83'):if(_0x59964b[_0x6449('0x5a')][_0x6449('0xcb')]&&_0x59964b['body']['status']){_0x245acb=_0x59964b[_0x6449('0x5a')][_0x6449('0x2c')];return db[_0x6449('0xa8')][_0x6449('0x58')]({'where':{'messageId':_0x59964b[_0x6449('0x5a')]['skebby_dispatch_id']}});}break;case _0x6449('0x85'):if(_0x59964b[_0x6449('0x5a')][_0x6449('0xcc')]&&_0x59964b['body']['statusInt']){_0x245acb=_0x59964b['body']['statusInt'];return db[_0x6449('0xa8')][_0x6449('0x58')]({'where':{'messageId':_0x59964b[_0x6449('0x5a')][_0x6449('0xcc')]}});}break;case _0x6449('0xcd'):if(_0x59964b[_0x6449('0x5a')][_0x6449('0x86')]&&_0x59964b[_0x6449('0x5a')]['status_code']){_0x245acb=_0x59964b['body']['status_code'];return db[_0x6449('0xa8')][_0x6449('0x58')]({'where':{'messageId':_0x59964b[_0x6449('0x5a')][_0x6449('0x86')]}});}break;case _0x6449('0x88'):var _0x551735=_0x59964b[_0x6449('0x5a')][_0x6449('0x89')][0x0];if(_0x551735[_0x6449('0x81')]&&_0x551735[_0x6449('0x2c')][_0x6449('0xce')]==='DELIVERED'){_0x245acb=_0x551735['status'][_0x6449('0xce')];return db[_0x6449('0xa8')][_0x6449('0x58')]({'where':{'messageId':_0x551735['messageId']}});}break;case _0x6449('0x8e'):if(_0x59964b['body'][_0x6449('0x81')]&&_0x59964b[_0x6449('0x5a')]['status']){_0x245acb=_0x59964b[_0x6449('0x5a')][_0x6449('0x2c')];return db[_0x6449('0xa8')][_0x6449('0x58')]({'where':{'messageId':_0x59964b[_0x6449('0x5a')][_0x6449('0x81')]}});}break;case _0x6449('0x91'):if(_0x59964b[_0x6449('0x5a')][0x0]['message']['id']){_0x245acb=_0x59964b[_0x6449('0x5a')][0x0]['type'];return db['SmsMessage']['find']({'where':{'messageId':_0x59964b[_0x6449('0x5a')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x59964b[_0x6449('0x5a')][_0x6449('0xcf')]&&_0x59964b[_0x6449('0x5a')]['status']){_0x245acb=_0x59964b[_0x6449('0x5a')][_0x6449('0x2c')];return db[_0x6449('0xa8')]['find']({'where':{'messageId':_0x59964b[_0x6449('0x5a')][_0x6449('0xcf')]}});}break;}}})[_0x6449('0x21')](handleEntityNotFound(_0x4a6da2,null))[_0x6449('0x21')](function(_0x2fbe60){if(_0x2fbe60){_0x5aaa72=_0x2fbe60;switch(_0x2ad99f['type']){case _0x6449('0x83'):if(_0x245acb===_0x6449('0xd0')){return _0x5aaa72['update']({'read':!![]});}else{logger[_0x6449('0x27')](_0x6449('0x25'),_0x6449('0x2c'),_0x6449('0x83'),util[_0x6449('0xca')](_0x59964b['body'],{'showHidden':![],'depth':null}));}break;case _0x6449('0x85'):if(_0x245acb==='1'){return _0x5aaa72[_0x6449('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x6449('0x83'),util['inspect'](_0x59964b[_0x6449('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6449('0xcd'):if(!_0x59964b[_0x6449('0x5a')][_0x6449('0xd1')]&&_0x245acb>=0xc8&&_0x245acb<=0xce){return _0x5aaa72[_0x6449('0x36')]({'read':!![]});}else{logger[_0x6449('0x27')](_0x6449('0x25'),_0x6449('0x2c'),_0x6449('0xcd'),util['inspect'](_0x59964b['body'],{'showHidden':![],'depth':null}));}break;case _0x6449('0x88'):var _0x1f765a=_0x59964b['body'][_0x6449('0x89')][0x0];if(_0x1f765a[_0x6449('0x2c')][_0x6449('0xce')]===_0x6449('0xd0')){return _0x5aaa72['update']({'read':!![]});}else{logger[_0x6449('0x27')](_0x6449('0x25'),_0x6449('0x2c'),'infobip',util['inspect'](_0x59964b['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x245acb=='DELIVERED_TO_GATEWAY'||_0x245acb==_0x6449('0xd2')){return _0x5aaa72[_0x6449('0x36')]({'read':!![]});}else{logger[_0x6449('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6449('0x2c'),'clickatell',util[_0x6449('0xca')](_0x59964b[_0x6449('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6449('0x91'):if(_0x245acb==_0x6449('0xd3')){return _0x5aaa72[_0x6449('0x36')]({'read':!![]});}else{logger[_0x6449('0x27')](_0x6449('0x25'),_0x6449('0x2c'),_0x6449('0x91'),util[_0x6449('0xca')](_0x59964b[_0x6449('0x5a')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x245acb==='DELIVRD'||_0x245acb===_0x6449('0xd4')){return _0x5aaa72[_0x6449('0x36')]({'read':!![]});}else{logger[_0x6449('0x27')](_0x6449('0x25'),_0x6449('0x2c'),_0x6449('0x92'),util[_0x6449('0xca')](_0x59964b[_0x6449('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x5aaa72;}})[_0x6449('0x21')](respondWithResult(_0x4a6da2,null))[_0x6449('0x61')](handleError(_0x4a6da2,null));};exports['statusGet']=function(_0x5bec38,_0x35d383,_0x5efc77){var _0x1340cd,_0x4b5945,_0x3313ef;return db[_0x6449('0x3e')][_0x6449('0x58')]({'where':{'id':_0x5bec38[_0x6449('0x55')]['id']}})[_0x6449('0x21')](handleEntityNotFound(_0x35d383,null))[_0x6449('0x21')](function(_0xee3c6f){if(_0xee3c6f){_0x3313ef=_0xee3c6f;logger[_0x6449('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6449('0x2c'),_0x6449('0xc9'),_0xee3c6f[_0x6449('0x41')],util[_0x6449('0xca')](_0x5bec38[_0x6449('0x43')],{'showHidden':![],'depth':null}));switch(_0xee3c6f[_0x6449('0x41')]){case _0x6449('0x8b'):if(_0x5bec38['query'][_0x6449('0xd5')]&&_0x5bec38[_0x6449('0x43')][_0x6449('0xd6')]){_0x4b5945=_0x5bec38['query'][_0x6449('0xd6')];return db[_0x6449('0xa8')][_0x6449('0x58')]({'where':{'messageId':_0x5bec38[_0x6449('0x43')][_0x6449('0xd5')]}});}break;}}})[_0x6449('0x21')](handleEntityNotFound(_0x35d383,null))['then'](function(_0x3e4252){if(_0x3e4252){_0x1340cd=_0x3e4252;switch(_0x3313ef[_0x6449('0x41')]){case'csc':if(_0x4b5945==='2'||_0x4b5945==='6'){return _0x1340cd['update']({'read':!![]});}else{logger[_0x6449('0x27')](_0x6449('0x25'),'status',_0x6449('0x8b'),util[_0x6449('0xca')](_0x5bec38[_0x6449('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x1340cd;}})[_0x6449('0x21')](respondWithResult(_0x35d383,null))[_0x6449('0x61')](handleError(_0x35d383,null));};exports[_0x6449('0xd7')]=function(_0x240208,_0x505b5a,_0x37b236){return db[_0x6449('0x3e')]['find']({'where':{'id':_0x240208[_0x6449('0x55')]['id']}})[_0x6449('0x21')](handleEntityNotFound(_0x505b5a,null))[_0x6449('0x21')](function(_0x2da4ba){if(_0x2da4ba){return _0x2da4ba['addAgents'](_0x240208[_0x6449('0x5a')][_0x6449('0x6d')],_[_0x6449('0x9e')](_0x240208[_0x6449('0x5a')],[_0x6449('0x6d'),'id'])||{})[_0x6449('0xa1')](function(_0x307e29){for(var _0x108bdb=0x0;_0x108bdb<_0x240208['body'][_0x6449('0x6d')][_0x6449('0x49')];_0x108bdb+=0x1){socket[_0x6449('0xd8')](_0x6449('0xd9'),{'UserId':Number(_0x240208[_0x6449('0x5a')][_0x6449('0x6d')][_0x108bdb]),'SmsAccountId':Number(_0x240208[_0x6449('0x55')]['id'])});}return _0x307e29;});}})[_0x6449('0x21')](respondWithResult(_0x505b5a,null))['catch'](handleError(_0x505b5a,null));};exports[_0x6449('0xda')]=function(_0xc44d68,_0x49bab1,_0x1dcd0a){return db[_0x6449('0x3e')]['find']({'where':{'id':_0xc44d68[_0x6449('0x55')]['id']}})[_0x6449('0x21')](handleEntityNotFound(_0x49bab1,null))[_0x6449('0x21')](function(_0x1d9508){if(_0x1d9508){return _0x1d9508['removeAgents'](_0xc44d68[_0x6449('0x43')][_0x6449('0x6d')])['then'](function(){if(_['isArray'](_0xc44d68['query'][_0x6449('0x6d')])){for(var _0x126511=0x0;_0x126511<_0xc44d68[_0x6449('0x43')][_0x6449('0x6d')]['length'];_0x126511+=0x1){socket[_0x6449('0xd8')]('userSmsAccount:remove',{'UserId':Number(_0xc44d68[_0x6449('0x43')][_0x6449('0x6d')][_0x126511]),'SmsAccountId':Number(_0xc44d68[_0x6449('0x55')]['id'])});}}else{socket[_0x6449('0xd8')](_0x6449('0xdb'),{'UserId':Number(_0xc44d68[_0x6449('0x43')][_0x6449('0x6d')]),'SmsAccountId':Number(_0xc44d68[_0x6449('0x55')]['id'])});}});}})[_0x6449('0x21')](respondWithStatusCode(_0x49bab1,null))['catch'](handleError(_0x49bab1,null));};exports[_0x6449('0xdc')]=function(_0x27478d,_0x2a4535,_0xe03d17){var _0x5b708d={};var _0x5ba946={};var _0x3996dc;var _0x46870a;return db[_0x6449('0x3e')]['findOne']({'where':{'id':_0x27478d['params']['id']}})['then'](handleEntityNotFound(_0x2a4535,null))[_0x6449('0x21')](function(_0x122a26){if(_0x122a26){_0x3996dc=_0x122a26;_0x5ba946[_0x6449('0x45')]=_['keys'](db['User'][_0x6449('0x3f')]);_0x5ba946[_0x6449('0x43')]=_[_0x6449('0x57')](_0x27478d[_0x6449('0x43')]);_0x5ba946[_0x6449('0x44')]=_['intersection'](_0x5ba946[_0x6449('0x45')],_0x5ba946[_0x6449('0x43')]);_0x5b708d[_0x6449('0x46')]=_['intersection'](_0x5ba946['model'],qs[_0x6449('0x48')](_0x27478d[_0x6449('0x43')][_0x6449('0x48')]));_0x5b708d[_0x6449('0x46')]=_0x5b708d[_0x6449('0x46')][_0x6449('0x49')]?_0x5b708d[_0x6449('0x46')]:_0x5ba946[_0x6449('0x45')];_0x5b708d['order']=qs[_0x6449('0x4b')](_0x27478d[_0x6449('0x43')][_0x6449('0x4b')]);_0x5b708d['where']=qs[_0x6449('0x44')](_[_0x6449('0x4d')](_0x27478d[_0x6449('0x43')],_0x5ba946[_0x6449('0x44')]));if(_0x27478d['query'][_0x6449('0x4e')]){_0x5b708d['where']=_[_0x6449('0x50')](_0x5b708d['where'],{'$or':_[_0x6449('0x3d')](_0x5b708d[_0x6449('0x46')],function(_0x4b4122){var _0x26226c={};_0x26226c[_0x4b4122]={'$like':'%'+_0x27478d[_0x6449('0x43')][_0x6449('0x4e')]+'%'};return _0x26226c;})});}_0x5b708d=_['merge']({},_0x5b708d,_0x27478d['options']);return _0x3996dc[_0x6449('0xdc')](_0x5b708d);}})[_0x6449('0x21')](function(_0x21115f){if(_0x21115f){_0x46870a=_0x21115f[_0x6449('0x49')];if(!_0x27478d[_0x6449('0x43')]['hasOwnProperty']('nolimit')){_0x5b708d['limit']=qs[_0x6449('0x30')](_0x27478d[_0x6449('0x43')][_0x6449('0x30')]);_0x5b708d[_0x6449('0x32')]=qs['offset'](_0x27478d[_0x6449('0x43')][_0x6449('0x32')]);}return _0x3996dc['getAgents'](_0x5b708d);}})['then'](function(_0x30577b){if(_0x30577b){return _0x30577b?{'count':_0x46870a,'rows':_0x30577b}:null;}})[_0x6449('0x21')](respondWithResult(_0x2a4535,null))[_0x6449('0x61')](handleError(_0x2a4535,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 49ac16e..ed75fe4 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 _0xddd6=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5daf4e,_0x4cdd2e){var _0x5afb6a=function(_0x35e8a0){while(--_0x35e8a0){_0x5daf4e['push'](_0x5daf4e['shift']());}};_0x5afb6a(++_0x4cdd2e);}(_0xddd6,0x182));var _0x6ddd=function(_0x1f92ca,_0x134eaa){_0x1f92ca=_0x1f92ca-0x0;var _0x130ebe=_0xddd6[_0x1f92ca];return _0x130ebe;};'use strict';var EventEmitter=require(_0x6ddd('0x0'));var SmsAccount=require(_0x6ddd('0x1'))['db'][_0x6ddd('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6ddd('0x3')](0x0);var events={'afterCreate':_0x6ddd('0x4'),'afterUpdate':_0x6ddd('0x5'),'afterDestroy':_0x6ddd('0x6')};function emitEvent(_0x3ba280){return function(_0x4433ee,_0x42e95d,_0x415ba5){SmsAccountEvents[_0x6ddd('0x7')](_0x3ba280+':'+_0x4433ee['id'],_0x4433ee);SmsAccountEvents['emit'](_0x3ba280,_0x4433ee);_0x415ba5(null);};}for(var e in events){if(events[_0x6ddd('0x8')](e)){var event=events[e];SmsAccount[_0x6ddd('0x9')](e,emitEvent(event));}}module[_0x6ddd('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x02f4=['events','../../mysqldb','SmsAccount','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x35d649,_0x37210f){var _0x541bc4=function(_0x4743bb){while(--_0x4743bb){_0x35d649['push'](_0x35d649['shift']());}};_0x541bc4(++_0x37210f);}(_0x02f4,0x171));var _0x402f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x02f4[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0x402f('0x0'));var SmsAccount=require(_0x402f('0x1'))['db'][_0x402f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x402f('0x3'),'afterUpdate':_0x402f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x19875c){return function(_0x349d96,_0x2643c2,_0x101106){SmsAccountEvents['emit'](_0x19875c+':'+_0x349d96['id'],_0x349d96);SmsAccountEvents[_0x402f('0x5')](_0x19875c,_0x349d96);_0x101106(null);};}for(var e in events){if(events[_0x402f('0x6')](e)){var event=events[e];SmsAccount[_0x402f('0x7')](e,emitEvent(event));}}module[_0x402f('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 62b5498..875097b 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 _0x21ad=['exports','define','SmsAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xcab4d9,_0x429f53){var _0x349da5=function(_0x22fef4){while(--_0x22fef4){_0xcab4d9['push'](_0xcab4d9['shift']());}};_0x349da5(++_0x429f53);}(_0x21ad,0x161));var _0xd21a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x21ad[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xd21a('0x0'));var util=require(_0xd21a('0x1'));var logger=require(_0xd21a('0x2'))(_0xd21a('0x3'));var moment=require('moment');var BPromise=require(_0xd21a('0x4'));var rp=require(_0xd21a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd21a('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xd21a('0x7')]=function(_0x5a59ec,_0x405417){return _0x5a59ec[_0xd21a('0x8')](_0xd21a('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eae=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util'];(function(_0x5e96db,_0x744ad3){var _0x31e5c5=function(_0x1cb5b4){while(--_0x1cb5b4){_0x5e96db['push'](_0x5e96db['shift']());}};_0x31e5c5(++_0x744ad3);}(_0x3eae,0x102));var _0xe3ea=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x3eae[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0xe3ea('0x0'));var util=require(_0xe3ea('0x1'));var logger=require(_0xe3ea('0x2'))('api');var moment=require(_0xe3ea('0x3'));var BPromise=require(_0xe3ea('0x4'));var rp=require(_0xe3ea('0x5'));var fs=require('fs');var path=require(_0xe3ea('0x6'));var rimraf=require(_0xe3ea('0x7'));var config=require(_0xe3ea('0x8'));var attributes=require('./smsAccount.attributes');module[_0xe3ea('0x9')]=function(_0x26c6f1,_0x11bcaf){return _0x26c6f1[_0xe3ea('0xa')](_0xe3ea('0xb'),attributes,{'tableName':_0xe3ea('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 456c5d0..038f504 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 _0x9f5d=['./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','SmsAccount','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x9f5d,0xdb));var _0xd9f5=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x9f5d[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0xd9f5('0x0'));var util=require(_0xd9f5('0x1'));var moment=require(_0xd9f5('0x2'));var BPromise=require(_0xd9f5('0x3'));var rs=require(_0xd9f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9f5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9f5('0x6'))(_0xd9f5('0x7'));var config=require('../../config/environment');var jayson=require(_0xd9f5('0x8'));var client=jayson[_0xd9f5('0x9')][_0xd9f5('0xa')]({'port':0x232a});config[_0xd9f5('0xb')]=_[_0xd9f5('0xc')](config[_0xd9f5('0xb')],{'host':_0xd9f5('0xd'),'port':0x18eb});var socket=require(_0xd9f5('0xe'))(new Redis(config[_0xd9f5('0xb')]));require(_0xd9f5('0xf'))['register'](socket);function respondWithRpcPromise(_0x199e8b,_0x501fb9,_0x29f103){return new BPromise(function(_0x58245d,_0x2d68ed){return client[_0xd9f5('0x10')](_0x199e8b,_0x29f103)[_0xd9f5('0x11')](function(_0x48c34d){logger['info'](_0xd9f5('0x12'),_0x501fb9,_0xd9f5('0x13'));logger[_0xd9f5('0x14')](_0xd9f5('0x15'),_0x501fb9,'request\x20sent',JSON['stringify'](_0x48c34d));if(_0x48c34d[_0xd9f5('0x16')]){if(_0x48c34d['error'][_0xd9f5('0x17')]===0x1f4){logger[_0xd9f5('0x16')]('SmsAccount,\x20%s,\x20%s',_0x501fb9,_0x48c34d[_0xd9f5('0x16')][_0xd9f5('0x18')]);return _0x2d68ed(_0x48c34d[_0xd9f5('0x16')][_0xd9f5('0x18')]);}logger[_0xd9f5('0x16')]('SmsAccount,\x20%s,\x20%s',_0x501fb9,_0x48c34d[_0xd9f5('0x16')][_0xd9f5('0x18')]);return _0x58245d(_0x48c34d[_0xd9f5('0x16')][_0xd9f5('0x18')]);}else{logger[_0xd9f5('0x19')](_0xd9f5('0x12'),_0x501fb9,_0xd9f5('0x13'));_0x58245d(_0x48c34d[_0xd9f5('0x1a')][_0xd9f5('0x18')]);}})[_0xd9f5('0x1b')](function(_0x47ad57){logger[_0xd9f5('0x16')](_0xd9f5('0x12'),_0x501fb9,_0x47ad57);_0x2d68ed(_0x47ad57);});});}exports['ShowSmsAccount']=function(_0x333c4d){var _0x374d95=this;return new Promise(function(_0x42fed3,_0x12c49e){return db[_0xd9f5('0x1c')][_0xd9f5('0x1d')]({'raw':_0x333c4d[_0xd9f5('0x1e')]?_0x333c4d[_0xd9f5('0x1e')][_0xd9f5('0x1f')]===undefined?!![]:![]:!![],'where':_0x333c4d[_0xd9f5('0x1e')]?_0x333c4d[_0xd9f5('0x1e')][_0xd9f5('0x20')]||null:null,'attributes':_0x333c4d[_0xd9f5('0x1e')]?_0x333c4d[_0xd9f5('0x1e')][_0xd9f5('0x21')]||null:null,'include':_0x333c4d[_0xd9f5('0x1e')]?_0x333c4d['options'][_0xd9f5('0x22')]?_[_0xd9f5('0x23')](_0x333c4d[_0xd9f5('0x1e')][_0xd9f5('0x22')],function(_0x52545c){return{'model':db[_0x52545c[_0xd9f5('0x24')]],'as':_0x52545c['as'],'attributes':_0x52545c[_0xd9f5('0x21')],'include':_0x52545c['include']?_[_0xd9f5('0x23')](_0x52545c['include'],function(_0x56a8a9){return{'model':db[_0x56a8a9[_0xd9f5('0x24')]],'as':_0x56a8a9['as'],'attributes':_0x56a8a9['attributes'],'include':_0x56a8a9[_0xd9f5('0x22')]?_[_0xd9f5('0x23')](_0x56a8a9['include'],function(_0x59e870){return{'model':db[_0x59e870[_0xd9f5('0x24')]],'as':_0x59e870['as'],'attributes':_0x59e870['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32220d){logger[_0xd9f5('0x19')](_0xd9f5('0x25'),_0x333c4d);logger[_0xd9f5('0x14')](_0xd9f5('0x25'),_0x333c4d,JSON[_0xd9f5('0x26')](_0x32220d));_0x42fed3(_0x32220d);})[_0xd9f5('0x1b')](function(_0x479846){logger[_0xd9f5('0x16')](_0xd9f5('0x25'),_0x479846['message'],_0x333c4d);_0x12c49e(_0x374d95[_0xd9f5('0x16')](0x1f4,_0x479846['message']));});});}; \ No newline at end of file +var _0x765f=['stringify','error','code','message','catch','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x765f,0x1ce));var _0xf765=function(_0x57c46a,_0x1d7f64){_0x57c46a=_0x57c46a-0x0;var _0x2c0478=_0x765f[_0x57c46a];return _0x2c0478;};'use strict';var _=require(_0xf765('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf765('0x1'));var fs=require('fs');var Redis=require(_0xf765('0x2'));var db=require(_0xf765('0x3'))['db'];var utils=require(_0xf765('0x4'));var logger=require(_0xf765('0x5'))(_0xf765('0x6'));var config=require(_0xf765('0x7'));var jayson=require(_0xf765('0x8'));var client=jayson['client'][_0xf765('0x9')]({'port':0x232a});config[_0xf765('0xa')]=_[_0xf765('0xb')](config[_0xf765('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf765('0xa')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x59d432,_0x49ecd1,_0x18048d){return new BPromise(function(_0x55e673,_0x242398){return client[_0xf765('0xc')](_0x59d432,_0x18048d)[_0xf765('0xd')](function(_0x299b22){logger[_0xf765('0xe')](_0xf765('0xf'),_0x49ecd1,_0xf765('0x10'));logger[_0xf765('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x49ecd1,_0xf765('0x10'),JSON[_0xf765('0x12')](_0x299b22));if(_0x299b22['error']){if(_0x299b22[_0xf765('0x13')][_0xf765('0x14')]===0x1f4){logger[_0xf765('0x13')]('SmsAccount,\x20%s,\x20%s',_0x49ecd1,_0x299b22[_0xf765('0x13')]['message']);return _0x242398(_0x299b22[_0xf765('0x13')][_0xf765('0x15')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x49ecd1,_0x299b22[_0xf765('0x13')]['message']);return _0x55e673(_0x299b22[_0xf765('0x13')]['message']);}else{logger[_0xf765('0xe')](_0xf765('0xf'),_0x49ecd1,'request\x20sent');_0x55e673(_0x299b22['result'][_0xf765('0x15')]);}})[_0xf765('0x16')](function(_0x21c5ec){logger[_0xf765('0x13')](_0xf765('0xf'),_0x49ecd1,_0x21c5ec);_0x242398(_0x21c5ec);});});}exports[_0xf765('0x17')]=function(_0x2285d0){var _0x56933e=this;return new Promise(function(_0x5e099b,_0x381e3f){return db['SmsAccount'][_0xf765('0x18')]({'raw':_0x2285d0[_0xf765('0x19')]?_0x2285d0[_0xf765('0x19')][_0xf765('0x1a')]===undefined?!![]:![]:!![],'where':_0x2285d0['options']?_0x2285d0[_0xf765('0x19')][_0xf765('0x1b')]||null:null,'attributes':_0x2285d0[_0xf765('0x19')]?_0x2285d0[_0xf765('0x19')][_0xf765('0x1c')]||null:null,'include':_0x2285d0[_0xf765('0x19')]?_0x2285d0[_0xf765('0x19')][_0xf765('0x1d')]?_[_0xf765('0x1e')](_0x2285d0[_0xf765('0x19')][_0xf765('0x1d')],function(_0x2983dd){return{'model':db[_0x2983dd['model']],'as':_0x2983dd['as'],'attributes':_0x2983dd[_0xf765('0x1c')],'include':_0x2983dd[_0xf765('0x1d')]?_[_0xf765('0x1e')](_0x2983dd['include'],function(_0xfd33dc){return{'model':db[_0xfd33dc[_0xf765('0x1f')]],'as':_0xfd33dc['as'],'attributes':_0xfd33dc[_0xf765('0x1c')],'include':_0xfd33dc[_0xf765('0x1d')]?_[_0xf765('0x1e')](_0xfd33dc[_0xf765('0x1d')],function(_0x44f7eb){return{'model':db[_0x44f7eb[_0xf765('0x1f')]],'as':_0x44f7eb['as'],'attributes':_0x44f7eb[_0xf765('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf765('0xd')](function(_0xa6248b){logger[_0xf765('0xe')](_0xf765('0x17'),_0x2285d0);logger['debug'](_0xf765('0x17'),_0x2285d0,JSON['stringify'](_0xa6248b));_0x5e099b(_0xa6248b);})[_0xf765('0x16')](function(_0x48c930){logger[_0xf765('0x13')](_0xf765('0x17'),_0x48c930['message'],_0x2285d0);_0x381e3f(_0x56933e['error'](0x1f4,_0x48c930[_0xf765('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 8d4c5f4..06116bc 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 ea9efc7..b4b9b43 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0xf335cc,_0x10985a){var _0x275c05=function(_0x12826a){while(--_0x12826a){_0xf335cc['push'](_0xf335cc['shift']());}};_0x275c05(++_0x10985a);}(_0x008c,0x188));var _0xc008=function(_0x30e8a1,_0x55fa82){_0x30e8a1=_0x30e8a1-0x0;var _0x37c6f1=_0x008c[_0x30e8a1];return _0x37c6f1;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +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(_0x366ce9,_0x457a54){var _0x56a9a6=function(_0x4710a8){while(--_0x4710a8){_0x366ce9['push'](_0x366ce9['shift']());}};_0x56a9a6(++_0x457a54);}(_0x3e74,0x175));var _0x43e7=function(_0x2b91b2,_0x3f7c27){_0x2b91b2=_0x2b91b2-0x0;var _0x453f10=_0x3e74[_0x2b91b2];return _0x453f10;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 33b505e..e0c3d99 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 _0x09fb=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x478830,_0x266465){var _0x1f2420=function(_0x236912){while(--_0x236912){_0x478830['push'](_0x478830['shift']());}};_0x1f2420(++_0x266465);}(_0x09fb,0x91));var _0xb09f=function(_0x3d65bb,_0x4084bc){_0x3d65bb=_0x3d65bb-0x0;var _0x27745a=_0x09fb[_0x3d65bb];return _0x27745a;};'use strict';var Sequelize=require(_0xb09f('0x0'));module[_0xb09f('0x1')]={'priority':{'type':Sequelize[_0xb09f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb09f('0x3')],'allowNull':![],'defaultValue':_0xb09f('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb09f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0866=['exports','INTEGER','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x2cc908,_0x2f4ccd){var _0x203f67=function(_0x511f0b){while(--_0x511f0b){_0x2cc908['push'](_0x2cc908['shift']());}};_0x203f67(++_0x2f4ccd);}(_0x0866,0x107));var _0x6086=function(_0x2580a3,_0x5a048e){_0x2580a3=_0x2580a3-0x0;var _0x433f98=_0x0866[_0x2580a3];return _0x433f98;};'use strict';var Sequelize=require(_0x6086('0x0'));module[_0x6086('0x1')]={'priority':{'type':Sequelize[_0x6086('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6086('0x3')]()},'description':{'type':Sequelize[_0x6086('0x4')]},'interval':{'type':Sequelize[_0x6086('0x4')],'defaultValue':_0x6086('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 49eedf7..0a0c78a 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 _0xfa14=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','apply','update','then','error','stack','name','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','SmsApplication','includeAll','include','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0xfa14,0x155));var _0x4fa1=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0xfa14[_0x2a4fe2];return _0x225c4a;};'use strict';var emlformat=require(_0x4fa1('0x0'));var rimraf=require(_0x4fa1('0x1'));var zipdir=require(_0x4fa1('0x2'));var jsonpatch=require(_0x4fa1('0x3'));var rp=require(_0x4fa1('0x4'));var moment=require(_0x4fa1('0x5'));var BPromise=require(_0x4fa1('0x6'));var Mustache=require(_0x4fa1('0x7'));var util=require(_0x4fa1('0x8'));var path=require(_0x4fa1('0x9'));var sox=require('sox');var csv=require(_0x4fa1('0xa'));var ejs=require(_0x4fa1('0xb'));var fs=require('fs');var fs_extra=require(_0x4fa1('0xc'));var _=require(_0x4fa1('0xd'));var squel=require('squel');var crypto=require(_0x4fa1('0xe'));var jsforce=require(_0x4fa1('0xf'));var deskjs=require(_0x4fa1('0x10'));var toCsv=require(_0x4fa1('0xa'));var querystring=require('querystring');var Papa=require(_0x4fa1('0x11'));var Redis=require(_0x4fa1('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fa1('0x13'));var logger=require('../../config/logger')(_0x4fa1('0x14'));var utils=require(_0x4fa1('0x15'));var config=require(_0x4fa1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4fa1('0x17'))['db'];function respondWithStatusCode(_0x50dbbb,_0x35798e){_0x35798e=_0x35798e||0xcc;return function(_0x4a06a4){if(_0x4a06a4){return _0x50dbbb[_0x4fa1('0x18')](_0x35798e);}return _0x50dbbb[_0x4fa1('0x19')](_0x35798e)[_0x4fa1('0x1a')]();};}function respondWithResult(_0x8c940b,_0x5c9887){_0x5c9887=_0x5c9887||0xc8;return function(_0x2483d9){if(_0x2483d9){return _0x8c940b[_0x4fa1('0x19')](_0x5c9887)['json'](_0x2483d9);}};}function respondWithFilteredResult(_0x144095,_0x5b61d7){return function(_0x510260){if(_0x510260){var _0x423b7e=typeof _0x5b61d7['offset']===_0x4fa1('0x1b')&&typeof _0x5b61d7[_0x4fa1('0x1c')]===_0x4fa1('0x1b');var _0x3238a6=_0x510260['count'];var _0x470bd6=_0x423b7e?0x0:_0x5b61d7[_0x4fa1('0x1d')];var _0x276a21=_0x423b7e?_0x510260[_0x4fa1('0x1e')]:_0x5b61d7[_0x4fa1('0x1d')]+_0x5b61d7[_0x4fa1('0x1c')];var _0x3a6c62;if(_0x276a21>=_0x3238a6){_0x276a21=_0x3238a6;_0x3a6c62=0xc8;}else{_0x3a6c62=0xce;}_0x144095['status'](_0x3a6c62);return _0x144095[_0x4fa1('0x1f')](_0x4fa1('0x20'),_0x470bd6+'-'+_0x276a21+'/'+_0x3238a6)['json'](_0x510260);}return null;};}function patchUpdates(_0x27aae5){return function(_0x21f078){try{jsonpatch[_0x4fa1('0x21')](_0x21f078,_0x27aae5,!![]);}catch(_0x422d50){return BPromise['reject'](_0x422d50);}return _0x21f078['save']();};}function saveUpdates(_0x2aa175,_0x4a426c){return function(_0x543876){if(_0x543876){return _0x543876[_0x4fa1('0x22')](_0x2aa175)[_0x4fa1('0x23')](function(_0x25171a){return _0x25171a;});}return null;};}function removeEntity(_0xf269dd,_0x5a65dd){return function(_0x56b89f){if(_0x56b89f){return _0x56b89f['destroy']()[_0x4fa1('0x23')](function(){_0xf269dd[_0x4fa1('0x19')](0xcc)[_0x4fa1('0x1a')]();});}};}function handleEntityNotFound(_0x4646e8,_0x2cddde){return function(_0x178784){if(!_0x178784){_0x4646e8[_0x4fa1('0x18')](0x194);}return _0x178784;};}function handleError(_0x326c2f,_0xd3f766){_0xd3f766=_0xd3f766||0x1f4;return function(_0x4a51e8){logger[_0x4fa1('0x24')](_0x4a51e8[_0x4fa1('0x25')]);if(_0x4a51e8['name']){delete _0x4a51e8[_0x4fa1('0x26')];}_0x326c2f[_0x4fa1('0x19')](_0xd3f766)['send'](_0x4a51e8);};}exports['index']=function(_0x511d39,_0x4f83bf){var _0x393729={},_0x18fe2f={},_0x19f879={'count':0x0,'rows':[]};var _0x30e525=_[_0x4fa1('0x27')](db['SmsApplication'][_0x4fa1('0x28')],function(_0x560b3b){return{'name':_0x560b3b['fieldName'],'type':_0x560b3b[_0x4fa1('0x29')]['key']};});_0x18fe2f[_0x4fa1('0x2a')]=_[_0x4fa1('0x27')](_0x30e525,_0x4fa1('0x26'));_0x18fe2f[_0x4fa1('0x2b')]=_[_0x4fa1('0x2c')](_0x511d39[_0x4fa1('0x2b')]);_0x18fe2f[_0x4fa1('0x2d')]=_[_0x4fa1('0x2e')](_0x18fe2f[_0x4fa1('0x2a')],_0x18fe2f['query']);_0x393729[_0x4fa1('0x2f')]=_[_0x4fa1('0x2e')](_0x18fe2f[_0x4fa1('0x2a')],qs[_0x4fa1('0x30')](_0x511d39[_0x4fa1('0x2b')][_0x4fa1('0x30')]));_0x393729[_0x4fa1('0x2f')]=_0x393729['attributes'][_0x4fa1('0x31')]?_0x393729[_0x4fa1('0x2f')]:_0x18fe2f['model'];if(!_0x511d39[_0x4fa1('0x2b')][_0x4fa1('0x32')](_0x4fa1('0x33'))){_0x393729[_0x4fa1('0x1c')]=qs['limit'](_0x511d39[_0x4fa1('0x2b')][_0x4fa1('0x1c')]);_0x393729['offset']=qs[_0x4fa1('0x1d')](_0x511d39[_0x4fa1('0x2b')]['offset']);}_0x393729[_0x4fa1('0x34')]=qs[_0x4fa1('0x35')](_0x511d39[_0x4fa1('0x2b')]['sort']);_0x393729['where']=qs['filters'](_[_0x4fa1('0x36')](_0x511d39[_0x4fa1('0x2b')],_0x18fe2f[_0x4fa1('0x2d')]),_0x30e525);if(_0x511d39[_0x4fa1('0x2b')]['filter']){_0x393729[_0x4fa1('0x37')]=_[_0x4fa1('0x38')](_0x393729[_0x4fa1('0x37')],{'$or':_[_0x4fa1('0x27')](_0x30e525,function(_0x175276){if(_0x175276[_0x4fa1('0x29')]!=='VIRTUAL'){var _0x22a2a5={};_0x22a2a5[_0x175276['name']]={'$like':'%'+_0x511d39[_0x4fa1('0x2b')][_0x4fa1('0x39')]+'%'};return _0x22a2a5;}})});}_0x393729=_[_0x4fa1('0x38')]({},_0x393729,_0x511d39[_0x4fa1('0x3a')]);var _0x4494ef={'where':_0x393729[_0x4fa1('0x37')]};return db[_0x4fa1('0x3b')][_0x4fa1('0x1e')](_0x4494ef)[_0x4fa1('0x23')](function(_0x8808d){_0x19f879[_0x4fa1('0x1e')]=_0x8808d;if(_0x511d39['query'][_0x4fa1('0x3c')]){_0x393729[_0x4fa1('0x3d')]=[{'all':!![]}];}return db[_0x4fa1('0x3b')]['findAll'](_0x393729);})[_0x4fa1('0x23')](function(_0x591537){_0x19f879['rows']=_0x591537;return _0x19f879;})[_0x4fa1('0x23')](respondWithFilteredResult(_0x4f83bf,_0x393729))[_0x4fa1('0x3e')](handleError(_0x4f83bf,null));};exports[_0x4fa1('0x3f')]=function(_0x49ae70,_0x44dfe8){var _0x254a07={'raw':!![],'where':{'id':_0x49ae70[_0x4fa1('0x40')]['id']}},_0x1e2ee={};_0x1e2ee[_0x4fa1('0x2a')]=_[_0x4fa1('0x2c')](db[_0x4fa1('0x3b')]['rawAttributes']);_0x1e2ee[_0x4fa1('0x2b')]=_[_0x4fa1('0x2c')](_0x49ae70[_0x4fa1('0x2b')]);_0x1e2ee[_0x4fa1('0x2d')]=_['intersection'](_0x1e2ee[_0x4fa1('0x2a')],_0x1e2ee[_0x4fa1('0x2b')]);_0x254a07[_0x4fa1('0x2f')]=_[_0x4fa1('0x2e')](_0x1e2ee[_0x4fa1('0x2a')],qs[_0x4fa1('0x30')](_0x49ae70[_0x4fa1('0x2b')]['fields']));_0x254a07[_0x4fa1('0x2f')]=_0x254a07[_0x4fa1('0x2f')][_0x4fa1('0x31')]?_0x254a07[_0x4fa1('0x2f')]:_0x1e2ee[_0x4fa1('0x2a')];if(_0x49ae70[_0x4fa1('0x2b')][_0x4fa1('0x3c')]){_0x254a07[_0x4fa1('0x3d')]=[{'all':!![]}];}_0x254a07=_[_0x4fa1('0x38')]({},_0x254a07,_0x49ae70[_0x4fa1('0x3a')]);return db['SmsApplication'][_0x4fa1('0x41')](_0x254a07)['then'](handleEntityNotFound(_0x44dfe8,null))[_0x4fa1('0x23')](respondWithResult(_0x44dfe8,null))[_0x4fa1('0x3e')](handleError(_0x44dfe8,null));};exports[_0x4fa1('0x42')]=function(_0xd9af6f,_0x2e9663){return db[_0x4fa1('0x3b')][_0x4fa1('0x42')](_0xd9af6f['body'],{})[_0x4fa1('0x23')](respondWithResult(_0x2e9663,0xc9))['catch'](handleError(_0x2e9663,null));};exports[_0x4fa1('0x22')]=function(_0x2c55df,_0x4b467a){if(_0x2c55df[_0x4fa1('0x43')]['id']){delete _0x2c55df['body']['id'];}return db[_0x4fa1('0x3b')][_0x4fa1('0x41')]({'where':{'id':_0x2c55df[_0x4fa1('0x40')]['id']}})[_0x4fa1('0x23')](handleEntityNotFound(_0x4b467a,null))[_0x4fa1('0x23')](saveUpdates(_0x2c55df[_0x4fa1('0x43')],null))[_0x4fa1('0x23')](respondWithResult(_0x4b467a,null))[_0x4fa1('0x3e')](handleError(_0x4b467a,null));};exports[_0x4fa1('0x44')]=function(_0x8ac528,_0x2448cc){return db[_0x4fa1('0x3b')][_0x4fa1('0x41')]({'where':{'id':_0x8ac528[_0x4fa1('0x40')]['id']}})[_0x4fa1('0x23')](handleEntityNotFound(_0x2448cc,null))[_0x4fa1('0x23')](removeEntity(_0x2448cc,null))[_0x4fa1('0x3e')](handleError(_0x2448cc,null));}; \ No newline at end of file +var _0xb1a4=['key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','status','Content-Range','apply','update','then','destroy','end','error','name','index','map','SmsApplication','rawAttributes','fieldName','type'];(function(_0x1a0945,_0x165b73){var _0x5a7c9b=function(_0x296333){while(--_0x296333){_0x1a0945['push'](_0x1a0945['shift']());}};_0x5a7c9b(++_0x165b73);}(_0xb1a4,0xf6));var _0x4b1a=function(_0x430804,_0x5363f8){_0x430804=_0x430804-0x0;var _0x3d23b8=_0xb1a4[_0x430804];return _0x3d23b8;};'use strict';var emlformat=require(_0x4b1a('0x0'));var rimraf=require(_0x4b1a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b1a('0x2'));var rp=require('request-promise');var moment=require(_0x4b1a('0x3'));var BPromise=require(_0x4b1a('0x4'));var Mustache=require('mustache');var util=require(_0x4b1a('0x5'));var path=require(_0x4b1a('0x6'));var sox=require(_0x4b1a('0x7'));var csv=require('to-csv');var ejs=require(_0x4b1a('0x8'));var fs=require('fs');var fs_extra=require(_0x4b1a('0x9'));var _=require(_0x4b1a('0xa'));var squel=require(_0x4b1a('0xb'));var crypto=require(_0x4b1a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4b1a('0xd'));var querystring=require(_0x4b1a('0xe'));var Papa=require(_0x4b1a('0xf'));var Redis=require(_0x4b1a('0x10'));var authService=require(_0x4b1a('0x11'));var qs=require(_0x4b1a('0x12'));var as=require(_0x4b1a('0x13'));var hardwareService=require(_0x4b1a('0x14'));var logger=require(_0x4b1a('0x15'))(_0x4b1a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4b1a('0x17'));var db=require(_0x4b1a('0x18'))['db'];function respondWithStatusCode(_0x5c19fd,_0x55fd2a){_0x55fd2a=_0x55fd2a||0xcc;return function(_0x5053f5){if(_0x5053f5){return _0x5c19fd[_0x4b1a('0x19')](_0x55fd2a);}return _0x5c19fd['status'](_0x55fd2a)['end']();};}function respondWithResult(_0x2254fd,_0x2d0870){_0x2d0870=_0x2d0870||0xc8;return function(_0x1061cc){if(_0x1061cc){return _0x2254fd['status'](_0x2d0870)[_0x4b1a('0x1a')](_0x1061cc);}};}function respondWithFilteredResult(_0x794eb7,_0x57fc5c){return function(_0x167ea0){if(_0x167ea0){var _0x2ade00=typeof _0x57fc5c['offset']===_0x4b1a('0x1b')&&typeof _0x57fc5c[_0x4b1a('0x1c')]==='undefined';var _0x531f67=_0x167ea0[_0x4b1a('0x1d')];var _0x2439a9=_0x2ade00?0x0:_0x57fc5c[_0x4b1a('0x1e')];var _0x229461=_0x2ade00?_0x167ea0[_0x4b1a('0x1d')]:_0x57fc5c[_0x4b1a('0x1e')]+_0x57fc5c[_0x4b1a('0x1c')];var _0x3239f6;if(_0x229461>=_0x531f67){_0x229461=_0x531f67;_0x3239f6=0xc8;}else{_0x3239f6=0xce;}_0x794eb7[_0x4b1a('0x1f')](_0x3239f6);return _0x794eb7['set'](_0x4b1a('0x20'),_0x2439a9+'-'+_0x229461+'/'+_0x531f67)[_0x4b1a('0x1a')](_0x167ea0);}return null;};}function patchUpdates(_0x48e829){return function(_0x4c6a4d){try{jsonpatch[_0x4b1a('0x21')](_0x4c6a4d,_0x48e829,!![]);}catch(_0xd81a5a){return BPromise['reject'](_0xd81a5a);}return _0x4c6a4d['save']();};}function saveUpdates(_0x47e086,_0x595d69){return function(_0x439835){if(_0x439835){return _0x439835[_0x4b1a('0x22')](_0x47e086)[_0x4b1a('0x23')](function(_0x3d4675){return _0x3d4675;});}return null;};}function removeEntity(_0x1e2eb0,_0x21b816){return function(_0x2dabbd){if(_0x2dabbd){return _0x2dabbd[_0x4b1a('0x24')]()['then'](function(){_0x1e2eb0[_0x4b1a('0x1f')](0xcc)[_0x4b1a('0x25')]();});}};}function handleEntityNotFound(_0x46fac4,_0x30bd4a){return function(_0x1877c6){if(!_0x1877c6){_0x46fac4[_0x4b1a('0x19')](0x194);}return _0x1877c6;};}function handleError(_0x431bab,_0x34a69f){_0x34a69f=_0x34a69f||0x1f4;return function(_0x4ff19f){logger[_0x4b1a('0x26')](_0x4ff19f['stack']);if(_0x4ff19f[_0x4b1a('0x27')]){delete _0x4ff19f[_0x4b1a('0x27')];}_0x431bab[_0x4b1a('0x1f')](_0x34a69f)['send'](_0x4ff19f);};}exports[_0x4b1a('0x28')]=function(_0x4c9836,_0x2ed22f){var _0x2c5bb1={},_0x2fb6f9={},_0x4a5b8e={'count':0x0,'rows':[]};var _0x42ee1c=_[_0x4b1a('0x29')](db[_0x4b1a('0x2a')][_0x4b1a('0x2b')],function(_0x5cc780){return{'name':_0x5cc780[_0x4b1a('0x2c')],'type':_0x5cc780[_0x4b1a('0x2d')][_0x4b1a('0x2e')]};});_0x2fb6f9['model']=_[_0x4b1a('0x29')](_0x42ee1c,_0x4b1a('0x27'));_0x2fb6f9[_0x4b1a('0x2f')]=_[_0x4b1a('0x30')](_0x4c9836['query']);_0x2fb6f9['filters']=_[_0x4b1a('0x31')](_0x2fb6f9[_0x4b1a('0x32')],_0x2fb6f9['query']);_0x2c5bb1[_0x4b1a('0x33')]=_[_0x4b1a('0x31')](_0x2fb6f9[_0x4b1a('0x32')],qs[_0x4b1a('0x34')](_0x4c9836[_0x4b1a('0x2f')]['fields']));_0x2c5bb1[_0x4b1a('0x33')]=_0x2c5bb1['attributes'][_0x4b1a('0x35')]?_0x2c5bb1[_0x4b1a('0x33')]:_0x2fb6f9['model'];if(!_0x4c9836[_0x4b1a('0x2f')][_0x4b1a('0x36')](_0x4b1a('0x37'))){_0x2c5bb1[_0x4b1a('0x1c')]=qs[_0x4b1a('0x1c')](_0x4c9836[_0x4b1a('0x2f')]['limit']);_0x2c5bb1[_0x4b1a('0x1e')]=qs[_0x4b1a('0x1e')](_0x4c9836[_0x4b1a('0x2f')][_0x4b1a('0x1e')]);}_0x2c5bb1[_0x4b1a('0x38')]=qs[_0x4b1a('0x39')](_0x4c9836[_0x4b1a('0x2f')][_0x4b1a('0x39')]);_0x2c5bb1[_0x4b1a('0x3a')]=qs[_0x4b1a('0x3b')](_[_0x4b1a('0x3c')](_0x4c9836[_0x4b1a('0x2f')],_0x2fb6f9[_0x4b1a('0x3b')]),_0x42ee1c);if(_0x4c9836[_0x4b1a('0x2f')]['filter']){_0x2c5bb1[_0x4b1a('0x3a')]=_[_0x4b1a('0x3d')](_0x2c5bb1[_0x4b1a('0x3a')],{'$or':_[_0x4b1a('0x29')](_0x42ee1c,function(_0x7dd363){if(_0x7dd363[_0x4b1a('0x2d')]!=='VIRTUAL'){var _0x59c0a6={};_0x59c0a6[_0x7dd363[_0x4b1a('0x27')]]={'$like':'%'+_0x4c9836[_0x4b1a('0x2f')][_0x4b1a('0x3e')]+'%'};return _0x59c0a6;}})});}_0x2c5bb1=_[_0x4b1a('0x3d')]({},_0x2c5bb1,_0x4c9836[_0x4b1a('0x3f')]);var _0x32ad12={'where':_0x2c5bb1['where']};return db[_0x4b1a('0x2a')]['count'](_0x32ad12)[_0x4b1a('0x23')](function(_0x3f7688){_0x4a5b8e[_0x4b1a('0x1d')]=_0x3f7688;if(_0x4c9836[_0x4b1a('0x2f')][_0x4b1a('0x40')]){_0x2c5bb1[_0x4b1a('0x41')]=[{'all':!![]}];}return db[_0x4b1a('0x2a')][_0x4b1a('0x42')](_0x2c5bb1);})[_0x4b1a('0x23')](function(_0x23df22){_0x4a5b8e['rows']=_0x23df22;return _0x4a5b8e;})[_0x4b1a('0x23')](respondWithFilteredResult(_0x2ed22f,_0x2c5bb1))['catch'](handleError(_0x2ed22f,null));};exports[_0x4b1a('0x43')]=function(_0x43cf30,_0x1ea129){var _0x47b861={'raw':!![],'where':{'id':_0x43cf30[_0x4b1a('0x44')]['id']}},_0x19ffc8={};_0x19ffc8[_0x4b1a('0x32')]=_[_0x4b1a('0x30')](db[_0x4b1a('0x2a')][_0x4b1a('0x2b')]);_0x19ffc8[_0x4b1a('0x2f')]=_[_0x4b1a('0x30')](_0x43cf30['query']);_0x19ffc8[_0x4b1a('0x3b')]=_[_0x4b1a('0x31')](_0x19ffc8[_0x4b1a('0x32')],_0x19ffc8['query']);_0x47b861['attributes']=_[_0x4b1a('0x31')](_0x19ffc8[_0x4b1a('0x32')],qs['fields'](_0x43cf30[_0x4b1a('0x2f')][_0x4b1a('0x34')]));_0x47b861[_0x4b1a('0x33')]=_0x47b861[_0x4b1a('0x33')][_0x4b1a('0x35')]?_0x47b861[_0x4b1a('0x33')]:_0x19ffc8[_0x4b1a('0x32')];if(_0x43cf30[_0x4b1a('0x2f')][_0x4b1a('0x40')]){_0x47b861['include']=[{'all':!![]}];}_0x47b861=_[_0x4b1a('0x3d')]({},_0x47b861,_0x43cf30['options']);return db[_0x4b1a('0x2a')][_0x4b1a('0x45')](_0x47b861)[_0x4b1a('0x23')](handleEntityNotFound(_0x1ea129,null))['then'](respondWithResult(_0x1ea129,null))[_0x4b1a('0x46')](handleError(_0x1ea129,null));};exports[_0x4b1a('0x47')]=function(_0x4fb1aa,_0x1788d0){return db[_0x4b1a('0x2a')]['create'](_0x4fb1aa[_0x4b1a('0x48')],{})[_0x4b1a('0x23')](respondWithResult(_0x1788d0,0xc9))['catch'](handleError(_0x1788d0,null));};exports[_0x4b1a('0x22')]=function(_0x66aa74,_0x163b4b){if(_0x66aa74[_0x4b1a('0x48')]['id']){delete _0x66aa74[_0x4b1a('0x48')]['id'];}return db['SmsApplication'][_0x4b1a('0x45')]({'where':{'id':_0x66aa74['params']['id']}})[_0x4b1a('0x23')](handleEntityNotFound(_0x163b4b,null))[_0x4b1a('0x23')](saveUpdates(_0x66aa74[_0x4b1a('0x48')],null))[_0x4b1a('0x23')](respondWithResult(_0x163b4b,null))[_0x4b1a('0x46')](handleError(_0x163b4b,null));};exports['destroy']=function(_0x836bef,_0x3034e4){return db['SmsApplication'][_0x4b1a('0x45')]({'where':{'id':_0x836bef[_0x4b1a('0x44')]['id']}})[_0x4b1a('0x23')](handleEntityNotFound(_0x3034e4,null))['then'](removeEntity(_0x3034e4,null))[_0x4b1a('0x46')](handleError(_0x3034e4,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a73d9a0..efec92d 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 _0x219f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','sms_applications','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x91ac5d,_0x1df130){var _0x2a21ef=function(_0x271563){while(--_0x271563){_0x91ac5d['push'](_0x91ac5d['shift']());}};_0x2a21ef(++_0x1df130);}(_0x219f,0x148));var _0xf219=function(_0x3dfece,_0x423c5b){_0x3dfece=_0x3dfece-0x0;var _0x1a1c8a=_0x219f[_0x3dfece];return _0x1a1c8a;};'use strict';var _=require('lodash');var util=require(_0xf219('0x0'));var logger=require(_0xf219('0x1'))(_0xf219('0x2'));var moment=require(_0xf219('0x3'));var BPromise=require(_0xf219('0x4'));var rp=require(_0xf219('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf219('0x6'));var config=require(_0xf219('0x7'));var attributes=require(_0xf219('0x8'));module['exports']=function(_0x4c6a97,_0x14dd70){return _0x4c6a97['define']('SmsApplication',attributes,{'tableName':_0xf219('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf219('0xa')});}; \ No newline at end of file +var _0x539f=['../../config/environment','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x539f,0xde));var _0xf539=function(_0x1755dc,_0x167e39){_0x1755dc=_0x1755dc-0x0;var _0x5a1cf6=_0x539f[_0x1755dc];return _0x5a1cf6;};'use strict';var _=require('lodash');var util=require(_0xf539('0x0'));var logger=require(_0xf539('0x1'))('api');var moment=require(_0xf539('0x2'));var BPromise=require(_0xf539('0x3'));var rp=require(_0xf539('0x4'));var fs=require('fs');var path=require(_0xf539('0x5'));var rimraf=require('rimraf');var config=require(_0xf539('0x6'));var attributes=require('./smsApplication.attributes');module[_0xf539('0x7')]=function(_0x3c14a8,_0x13fc6b){return _0x3c14a8['define'](_0xf539('0x8'),attributes,{'tableName':_0xf539('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf539('0xa'),'collate':_0xf539('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 7f72ee4..db575b6 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 _0x627e=['request','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x1f040e,_0x522a16){var _0x1cf5e5=function(_0x53a635){while(--_0x53a635){_0x1f040e['push'](_0x1f040e['shift']());}};_0x1cf5e5(++_0x522a16);}(_0x627e,0x14a));var _0xe627=function(_0x4fab94,_0x406f2c){_0x4fab94=_0x4fab94-0x0;var _0x7b8feb=_0x627e[_0x4fab94];return _0x7b8feb;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});} \ No newline at end of file +var _0xaf60=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','error','code','message','info','SmsApplication,\x20%s,\x20%s','lodash','util','moment'];(function(_0x3a60fc,_0x4b68d0){var _0x456411=function(_0x4d2abf){while(--_0x4d2abf){_0x3a60fc['push'](_0x3a60fc['shift']());}};_0x456411(++_0x4b68d0);}(_0xaf60,0x82));var _0x0af6=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xaf60[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var moment=require(_0x0af6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0af6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0af6('0x4'))(_0x0af6('0x5'));var config=require(_0x0af6('0x6'));var jayson=require(_0x0af6('0x7'));var client=jayson[_0x0af6('0x8')][_0x0af6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb218,_0x52c997,_0x376979){return new BPromise(function(_0x28d620,_0x525bcc){return client[_0x0af6('0xa')](_0x2eb218,_0x376979)[_0x0af6('0xb')](function(_0xe9d01a){logger['info']('SmsApplication,\x20%s,\x20%s',_0x52c997,'request\x20sent');logger[_0x0af6('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x52c997,_0x0af6('0xd'),JSON['stringify'](_0xe9d01a));if(_0xe9d01a['error']){if(_0xe9d01a[_0x0af6('0xe')][_0x0af6('0xf')]===0x1f4){logger[_0x0af6('0xe')]('SmsApplication,\x20%s,\x20%s',_0x52c997,_0xe9d01a[_0x0af6('0xe')][_0x0af6('0x10')]);return _0x525bcc(_0xe9d01a[_0x0af6('0xe')]['message']);}logger[_0x0af6('0xe')]('SmsApplication,\x20%s,\x20%s',_0x52c997,_0xe9d01a[_0x0af6('0xe')]['message']);return _0x28d620(_0xe9d01a[_0x0af6('0xe')][_0x0af6('0x10')]);}else{logger[_0x0af6('0x11')](_0x0af6('0x12'),_0x52c997,'request\x20sent');_0x28d620(_0xe9d01a['result']['message']);}})['catch'](function(_0x4d5936){logger[_0x0af6('0xe')](_0x0af6('0x12'),_0x52c997,_0x4d5936);_0x525bcc(_0x4d5936);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6393d74..2ce9313 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 _0xb10b=['smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','tracked','sms'];(function(_0x549b58,_0x4435f3){var _0x456873=function(_0x406249){while(--_0x406249){_0x549b58['push'](_0x549b58['shift']());}};_0x456873(++_0x4435f3);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xb10b[_0x2d89ce];return _0x3fad10;};'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('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['download']);router[_0xbb10('0x11')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x11')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x11')]('/:id/tags',auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x16')),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),'smsinteraction:update'),controller[_0xbb10('0x19')]);router[_0xbb10('0x1a')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x1b')),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1a')](_0xbb10('0x1d'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=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(_0x140c53,_0x13ca1e){var _0x29d2bb=function(_0x747690){while(--_0x747690){_0x140c53['push'](_0x140c53['shift']());}};_0x29d2bb(++_0x13ca1e);}(_0x4fc2,0x111));var _0x24fc=function(_0x53bc30,_0x2c9f32){_0x53bc30=_0x53bc30-0x0;var _0x5a7579=_0x4fc2[_0x53bc30];return _0x5a7579;};'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 b4387bd..db7aaea 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 _0x68a5=['DATE','out','ENUM','INTEGER','sequelize','exports','BOOLEAN','STRING'];(function(_0x5fd04,_0x5d6fff){var _0x48c27b=function(_0x3fd78b){while(--_0x3fd78b){_0x5fd04['push'](_0x5fd04['shift']());}};_0x48c27b(++_0x5d6fff);}(_0x68a5,0xfc));var _0x568a=function(_0x4df4f9,_0x1a0a61){_0x4df4f9=_0x4df4f9-0x0;var _0x1f7fc=_0x68a5[_0x4df4f9];return _0x1f7fc;};'use strict';var Sequelize=require(_0x568a('0x0'));var moment=require('moment');module[_0x568a('0x1')]={'closed':{'type':Sequelize[_0x568a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x568a('0x3')]},'secondDisposition':{'type':Sequelize[_0x568a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x568a('0x3')]},'note':{'type':Sequelize[_0x568a('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x568a('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x568a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x568a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x568a('0x6')]('in',_0x568a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x568a('0x7')]}}; \ No newline at end of file +var _0xf4f4=['ENUM','out','INTEGER','sequelize','moment','BOOLEAN','DATE','STRING'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x45a230,_0x5717f9){_0x45a230=_0x45a230-0x0;var _0x34a3d7=_0xf4f4[_0x45a230];return _0x34a3d7;};'use strict';var Sequelize=require(_0x4f4f('0x0'));var moment=require(_0x4f4f('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4f4f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4f4f('0x3')]},'disposition':{'type':Sequelize[_0x4f4f('0x4')]},'secondDisposition':{'type':Sequelize[_0x4f4f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4f4f('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4f4f('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4f4f('0x5')]('in',_0x4f4f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4f4f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4f4f('0x5')]('in',_0x4f4f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4f4f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4f4f('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index db51f4f..a8fc4a7 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 _0x7d2f=['catch','create','body','describe','addMessage','ids','findOne','SmsMessage','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','removeTags','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','fullname','push','Contact','firstName','lastName','Messages','createdAt','secret','read','Account','User','get','mkdirSync','Sms','Owner','N.A.','closedAt','disposition','direction','out','System','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','zip-dir','moment','bluebird','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','params','model','keys','SmsInteraction','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find'];(function(_0x3e9371,_0x5d7cae){var _0x345ae9=function(_0x29367c){while(--_0x29367c){_0x3e9371['push'](_0x3e9371['shift']());}};_0x345ae9(++_0x5d7cae);}(_0x7d2f,0xba));var _0xf7d2=function(_0x34d720,_0x1d7d2f){_0x34d720=_0x34d720-0x0;var _0x2f022d=_0x7d2f[_0x34d720];return _0x2f022d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xf7d2('0x0'));var moment=require(_0xf7d2('0x1'));var BPromise=require(_0xf7d2('0x2'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xf7d2('0x3'));var interaction=require(_0xf7d2('0x4'));var qs=require(_0xf7d2('0x5'));var pdf=require(_0xf7d2('0x6'));var logger=require(_0xf7d2('0x7'))(_0xf7d2('0x8'));var config=require(_0xf7d2('0x9'));var db=require('../../mysqldb')['db'];config[_0xf7d2('0xa')]=_[_0xf7d2('0xb')](config[_0xf7d2('0xa')],{'host':_0xf7d2('0xc'),'port':0x18eb});var socket=require(_0xf7d2('0xd'))(new Redis(config[_0xf7d2('0xa')]));require(_0xf7d2('0xe'))[_0xf7d2('0xf')](socket);function respondWithStatusCode(_0x2388bc,_0x70d4f2){_0x70d4f2=_0x70d4f2||0xcc;return function(_0x2db614){if(_0x2db614){return _0x2388bc[_0xf7d2('0x10')](_0x70d4f2);}return _0x2388bc['status'](_0x70d4f2)[_0xf7d2('0x11')]();};}function respondWithResult(_0x4023d7,_0x350600){_0x350600=_0x350600||0xc8;return function(_0x56d6fb){if(_0x56d6fb){return _0x4023d7[_0xf7d2('0x12')](_0x350600)[_0xf7d2('0x13')](_0x56d6fb);}};}function respondWithFilteredResult(_0x479e8e,_0x33d0bf){return function(_0x53770f){if(_0x53770f){var _0x4c6aa9=typeof _0x33d0bf[_0xf7d2('0x14')]===_0xf7d2('0x15')&&typeof _0x33d0bf[_0xf7d2('0x16')]===_0xf7d2('0x15');var _0x4307d1=_0x53770f[_0xf7d2('0x17')];var _0x116e74=_0x4c6aa9?0x0:_0x33d0bf[_0xf7d2('0x14')];var _0x396b01=_0x4c6aa9?_0x53770f[_0xf7d2('0x17')]:_0x33d0bf[_0xf7d2('0x14')]+_0x33d0bf[_0xf7d2('0x16')];var _0x5672bd;if(_0x396b01>=_0x4307d1){_0x396b01=_0x4307d1;_0x5672bd=0xc8;}else{_0x5672bd=0xce;}_0x479e8e[_0xf7d2('0x12')](_0x5672bd);return _0x479e8e[_0xf7d2('0x18')](_0xf7d2('0x19'),_0x116e74+'-'+_0x396b01+'/'+_0x4307d1)[_0xf7d2('0x13')](_0x53770f);}return null;};}function saveUpdates(_0x494310){return function(_0x317d3b){if(_0x317d3b){return _0x317d3b[_0xf7d2('0x1a')](_0x494310)[_0xf7d2('0x1b')](function(_0x1bb9b5){return _0x1bb9b5;});}return null;};}function removeEntity(_0x4592d3){return function(_0x3cde9f){if(_0x3cde9f){return _0x3cde9f[_0xf7d2('0x1c')]()[_0xf7d2('0x1b')](function(){_0x4592d3[_0xf7d2('0x12')](0xcc)[_0xf7d2('0x11')]();});}};}function handleEntityNotFound(_0x179901){return function(_0x5690ba){if(!_0x5690ba){_0x179901[_0xf7d2('0x10')](0x194);}return _0x5690ba;};}function handleError(_0x3e8997,_0x5983bf){_0x5983bf=_0x5983bf||0x1f4;return function(_0x1cfa36){logger[_0xf7d2('0x1d')](_0x1cfa36[_0xf7d2('0x1e')]);if(_0x1cfa36[_0xf7d2('0x1f')]){delete _0x1cfa36[_0xf7d2('0x1f')];}_0x3e8997['status'](_0x5983bf)['send'](_0x1cfa36);};}exports[_0xf7d2('0x20')]=function(_0x5b1f02,_0x15afa4){var _0x112632={};var _0x264694=_[_0xf7d2('0x21')](db['SmsInteraction'][_0xf7d2('0x22')],function(_0x62ca45){return{'name':_0x62ca45[_0xf7d2('0x23')],'type':_0x62ca45[_0xf7d2('0x24')][_0xf7d2('0x25')]};});_0x112632=qs[_0xf7d2('0x26')](_0x264694,_0x5b1f02);return interaction[_0xf7d2('0x27')](_0xf7d2('0x28'),_0x5b1f02[_0xf7d2('0x29')],_0x5b1f02['user'],_0x112632,_0x264694)['then'](respondWithFilteredResult(_0x15afa4,_0x112632))['catch'](handleError(_0x15afa4,null));};exports['show']=function(_0x5dfd45,_0x3768ed){var _0x4d06ec={'raw':![],'where':{'id':_0x5dfd45[_0xf7d2('0x2a')]['id']}},_0x4b04ed={};_0x4b04ed[_0xf7d2('0x2b')]=_[_0xf7d2('0x2c')](db[_0xf7d2('0x2d')][_0xf7d2('0x22')]);_0x4b04ed[_0xf7d2('0x29')]=_[_0xf7d2('0x2c')](_0x5dfd45['query']);_0x4b04ed[_0xf7d2('0x2e')]=_['intersection'](_0x4b04ed[_0xf7d2('0x2b')],_0x4b04ed[_0xf7d2('0x29')]);_0x4d06ec[_0xf7d2('0x2f')]=_[_0xf7d2('0x30')](_0x4b04ed['model'],qs[_0xf7d2('0x31')](_0x5dfd45[_0xf7d2('0x29')][_0xf7d2('0x31')]));_0x4d06ec[_0xf7d2('0x2f')]=_0x4d06ec['attributes'][_0xf7d2('0x32')]?_0x4d06ec[_0xf7d2('0x2f')]:_0x4b04ed['model'];if(_0x5dfd45['query'][_0xf7d2('0x33')]){_0x4d06ec[_0xf7d2('0x34')]=[{'all':!![]}];}_0x4d06ec=_[_0xf7d2('0x35')]({},_0x4d06ec,_0x5dfd45[_0xf7d2('0x36')]);return db['SmsInteraction'][_0xf7d2('0x37')](_0x4d06ec)['then'](handleEntityNotFound(_0x3768ed,null))[_0xf7d2('0x1b')](respondWithResult(_0x3768ed,null))[_0xf7d2('0x38')](handleError(_0x3768ed,null));};exports[_0xf7d2('0x39')]=function(_0x13129d,_0x4bca03){return db[_0xf7d2('0x2d')][_0xf7d2('0x39')](_0x13129d[_0xf7d2('0x3a')],{})[_0xf7d2('0x1b')](respondWithResult(_0x4bca03,0xc9))[_0xf7d2('0x38')](handleError(_0x4bca03,null));};exports['update']=function(_0x3f4569,_0x2534a8){if(_0x3f4569['body']['id']){delete _0x3f4569[_0xf7d2('0x3a')]['id'];}return db[_0xf7d2('0x2d')][_0xf7d2('0x37')]({'where':{'id':_0x3f4569[_0xf7d2('0x2a')]['id']}})[_0xf7d2('0x1b')](handleEntityNotFound(_0x2534a8,null))[_0xf7d2('0x1b')](saveUpdates(_0x3f4569[_0xf7d2('0x3a')],null))[_0xf7d2('0x1b')](respondWithResult(_0x2534a8,null))[_0xf7d2('0x38')](handleError(_0x2534a8,null));};exports[_0xf7d2('0x1c')]=function(_0x2bcb80,_0x379207){return db[_0xf7d2('0x2d')][_0xf7d2('0x37')]({'where':{'id':_0x2bcb80['params']['id']}})['then'](handleEntityNotFound(_0x379207,null))[_0xf7d2('0x1b')](removeEntity(_0x379207,null))[_0xf7d2('0x38')](handleError(_0x379207,null));};exports[_0xf7d2('0x3b')]=function(_0x3c5793,_0x3cac6b){return db['SmsInteraction'][_0xf7d2('0x3b')]()[_0xf7d2('0x1b')](respondWithResult(_0x3cac6b,null))['catch'](handleError(_0x3cac6b,null));};exports[_0xf7d2('0x3c')]=function(_0xfa639b,_0x4b6144){return db['SmsMessage'][_0xf7d2('0x37')]({'where':{'id':_0xfa639b[_0xf7d2('0x2a')]['id']}})[_0xf7d2('0x1b')](handleEntityNotFound(_0x4b6144,null))['then'](function(_0x4d4aa5){if(_0x4d4aa5){return _0x4d4aa5[_0xf7d2('0x3c')](_0xfa639b[_0xf7d2('0x3a')]['ids'],_['omit'](_0xfa639b[_0xf7d2('0x3a')],[_0xf7d2('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x4b6144,null))[_0xf7d2('0x38')](handleError(_0x4b6144,null));};exports['getMessages']=function(_0x5223fa,_0x3d1b7f){var _0x195b57={'raw':![],'where':{}};var _0x329076={};var _0x8ab94d={'count':0x0,'rows':[]};return db[_0xf7d2('0x2d')][_0xf7d2('0x3e')]({'where':{'id':_0x5223fa['params']['id']}})[_0xf7d2('0x1b')](handleEntityNotFound(_0x3d1b7f,null))[_0xf7d2('0x1b')](function(_0x40e2d4){if(_0x40e2d4){_0x329076['model']=_[_0xf7d2('0x2c')](db[_0xf7d2('0x3f')][_0xf7d2('0x22')]);_0x329076[_0xf7d2('0x29')]=_[_0xf7d2('0x2c')](_0x5223fa[_0xf7d2('0x29')]);_0x329076['filters']=_[_0xf7d2('0x30')](_0x329076[_0xf7d2('0x2b')],_0x329076[_0xf7d2('0x29')]);_0x195b57['attributes']=_[_0xf7d2('0x30')](_0x329076['model'],qs[_0xf7d2('0x31')](_0x5223fa['query']['fields']));_0x195b57[_0xf7d2('0x2f')]=_0x195b57[_0xf7d2('0x2f')][_0xf7d2('0x32')]?_0x195b57[_0xf7d2('0x2f')]:_0x329076[_0xf7d2('0x2b')];if(!_0x5223fa[_0xf7d2('0x29')][_0xf7d2('0x40')]('nolimit')){_0x195b57[_0xf7d2('0x16')]=qs[_0xf7d2('0x16')](_0x5223fa['query'][_0xf7d2('0x16')]);_0x195b57['offset']=qs['offset'](_0x5223fa[_0xf7d2('0x29')][_0xf7d2('0x14')]);}_0x195b57[_0xf7d2('0x41')]=qs[_0xf7d2('0x42')](_0x5223fa['query'][_0xf7d2('0x42')]);_0x195b57[_0xf7d2('0x43')]=qs[_0xf7d2('0x2e')](_[_0xf7d2('0x44')](_0x5223fa[_0xf7d2('0x29')],_0x329076['filters']));_0x195b57[_0xf7d2('0x43')][_0xf7d2('0x45')]=_0x40e2d4['id'];if(_0x5223fa[_0xf7d2('0x29')][_0xf7d2('0x46')]){_0x195b57[_0xf7d2('0x43')]=_['merge'](_0x195b57['where'],{'$or':_['map'](_0x195b57[_0xf7d2('0x2f')],function(_0x488315){var _0x134147={};_0x134147[_0x488315]={'$like':'%'+_0x5223fa[_0xf7d2('0x29')][_0xf7d2('0x46')]+'%'};return _0x134147;})});}if(_0x5223fa[_0xf7d2('0x29')][_0xf7d2('0x47')]){var _0x241182=_0x5223fa[_0xf7d2('0x29')]['$gte'][_0xf7d2('0x48')](',');var _0x587132={};_0x587132[_0x241182[0x0]]={'$gte':moment(_0x241182[0x1])[_0xf7d2('0x49')](_0xf7d2('0x4a'))};_0x195b57[_0xf7d2('0x43')]=_['merge'](_0x195b57[_0xf7d2('0x43')],_0x587132);}_0x195b57=_[_0xf7d2('0x35')]({},_0x195b57,_0x5223fa[_0xf7d2('0x36')]);return db['SmsMessage'][_0xf7d2('0x17')]({'where':_0x195b57['where']})[_0xf7d2('0x1b')](function(_0x7f14a6){_0x8ab94d[_0xf7d2('0x17')]=_0x7f14a6;if(_0x5223fa[_0xf7d2('0x29')][_0xf7d2('0x33')]){_0x195b57['include']=[{'all':!![]}];}return db[_0xf7d2('0x3f')][_0xf7d2('0x27')](_0x195b57);})[_0xf7d2('0x1b')](function(_0x5a9ac1){_0x8ab94d[_0xf7d2('0x4b')]=_0x5a9ac1;return _0x8ab94d;});}})[_0xf7d2('0x1b')](respondWithFilteredResult(_0x3d1b7f,_0x195b57))[_0xf7d2('0x38')](handleError(_0x3d1b7f,null));};exports[_0xf7d2('0x4c')]=function(_0x581554,_0x17123e){return db[_0xf7d2('0x2d')]['find']({'where':{'id':_0x581554[_0xf7d2('0x2a')]['id']}})[_0xf7d2('0x1b')](handleEntityNotFound(_0x17123e,null))[_0xf7d2('0x1b')](function(_0x2862dd){if(_0x2862dd){return _0x2862dd[_0xf7d2('0x4d')](_0x581554[_0xf7d2('0x3a')][_0xf7d2('0x3d')],_['omit'](_0x581554[_0xf7d2('0x3a')],[_0xf7d2('0x3d'),'id'])||{})[_0xf7d2('0x4e')](function(){return db[_0xf7d2('0x4f')][_0xf7d2('0x27')]({'attributes':['id',_0xf7d2('0x1f'),_0xf7d2('0x50')],'where':{'id':_0x581554[_0xf7d2('0x3a')][_0xf7d2('0x3d')]}});})[_0xf7d2('0x1b')](function(_0x52d653){socket['emit']('smsInteractionTags:save',{'id':Number(_0x581554[_0xf7d2('0x2a')]['id']),'tags':_0x52d653||[]});return{'id':Number(_0x581554['params']['id']),'tags':_0x52d653||[]};});}})[_0xf7d2('0x1b')](respondWithResult(_0x17123e,null))[_0xf7d2('0x38')](handleError(_0x17123e,null));};exports[_0xf7d2('0x51')]=function(_0x51f224,_0x400a59){return db[_0xf7d2('0x2d')][_0xf7d2('0x37')]({'where':{'id':_0x51f224[_0xf7d2('0x2a')]['id']}})[_0xf7d2('0x1b')](handleEntityNotFound(_0x400a59,null))[_0xf7d2('0x1b')](function(_0x2bf3fe){if(_0x2bf3fe){return _0x2bf3fe['removeTags'](_0x51f224['query'][_0xf7d2('0x3d')]);}})[_0xf7d2('0x1b')](respondWithStatusCode(_0x400a59,null))[_0xf7d2('0x38')](handleError(_0x400a59,null));};exports['download']=function(_0x2c003a,_0x59de15){var _0x454c80=moment()[_0xf7d2('0x52')]()[_0xf7d2('0x53')]();var _0xf68834=path[_0xf7d2('0x54')](config[_0xf7d2('0x55')],_0xf7d2('0x56'),_0xf7d2('0x57'),_0xf7d2('0x58'));var _0x39208d=path[_0xf7d2('0x54')](_0xf68834,_0x454c80);var _0x58ef59=util[_0xf7d2('0x49')](_0xf7d2('0x59'),_0x2c003a[_0xf7d2('0x2a')]['id'],_0x454c80);var _0x2af0f2=path['join'](_0xf68834,_0x58ef59);var _0x21e6f5=[];_0x21e6f5['push']({'model':db['User'],'as':'User','attributes':['id',_0xf7d2('0x5a')],'raw':!![]});_0x21e6f5[_0xf7d2('0x5b')]({'model':db['CmContact'],'as':_0xf7d2('0x5c'),'attributes':['id',_0xf7d2('0x5d'),_0xf7d2('0x5e')],'raw':!![]});var _0x536e9e=[{'model':db['SmsMessage'],'as':_0xf7d2('0x5f'),'attributes':['id',_0xf7d2('0x3a'),_0xf7d2('0x60'),'direction',_0xf7d2('0x61'),_0xf7d2('0x62')],'include':_0x21e6f5}];_0x536e9e[_0xf7d2('0x5b')]({'model':db['SmsAccount'],'as':_0xf7d2('0x63'),'attributes':['id',_0xf7d2('0x1f')]});_0x536e9e[_0xf7d2('0x5b')]({'model':db[_0xf7d2('0x64')],'as':'Owner','attributes':['id',_0xf7d2('0x5a')]});return db[_0xf7d2('0x2d')][_0xf7d2('0x37')]({'where':{'id':_0x2c003a['params']['id']},'include':_0x536e9e})[_0xf7d2('0x1b')](handleEntityNotFound(_0x59de15,null))[_0xf7d2('0x1b')](function(_0x1ba9d7){if(_0x1ba9d7){var _0x3b4ab9=_0x1ba9d7[_0xf7d2('0x65')]({'plain':!![]});fs[_0xf7d2('0x66')](_0x39208d);var _0xa803fb={'channel':_0xf7d2('0x67'),'account':_0x3b4ab9[_0xf7d2('0x63')][_0xf7d2('0x1f')],'agent':_0x3b4ab9[_0xf7d2('0x68')]?_0x3b4ab9[_0xf7d2('0x68')]['fullname']:_0xf7d2('0x69'),'createdAt':moment(_0x3b4ab9[_0xf7d2('0x60')])[_0xf7d2('0x49')](_0xf7d2('0x4a'))['toString'](),'closedAt':_0x3b4ab9['closed']?moment(_0x3b4ab9[_0xf7d2('0x6a')])[_0xf7d2('0x49')](_0xf7d2('0x4a'))['toString']():'','disposition':_0x3b4ab9[_0xf7d2('0x6b')],'messages':_(_0x3b4ab9[_0xf7d2('0x5f')])['filter']({'secret':![]})[_0xf7d2('0x21')](function(_0x47aa1d){return{'date':moment(_0x47aa1d['createdAt'])[_0xf7d2('0x49')](_0xf7d2('0x4a'))[_0xf7d2('0x53')](),'sender':_0x47aa1d[_0xf7d2('0x6c')]===_0xf7d2('0x6d')?_0x47aa1d[_0xf7d2('0x64')]?_0x47aa1d[_0xf7d2('0x64')]['fullname']:_0xf7d2('0x6e'):_0x47aa1d[_0xf7d2('0x5c')][_0xf7d2('0x5d')]+(_0x47aa1d['Contact'][_0xf7d2('0x5e')]?'\x20'+_0x47aa1d[_0xf7d2('0x5c')][_0xf7d2('0x5e')]:''),'body':_0x47aa1d['body'],'direction':_0x47aa1d[_0xf7d2('0x6c')]===_0xf7d2('0x6d')?'A':'C','secret':_0x47aa1d[_0xf7d2('0x61')],'read':_0x47aa1d[_0xf7d2('0x62')]};})[_0xf7d2('0x6f')]()};return ejs['renderFile'](path[_0xf7d2('0x54')](config[_0xf7d2('0x55')],'server',_0xf7d2('0x70'),_0xf7d2('0x71')),{'interaction':_0xa803fb})[_0xf7d2('0x1b')](function(_0xb2ba04){var _0x255428=path['join'](_0x39208d,_0xf7d2('0x72')+_0x3b4ab9['id']+'-'+_0x454c80+_0xf7d2('0x73'));var _0x3853f3={'path':_0x255428,'channel':_0xf7d2('0x67'),'interactionId':_0x3b4ab9['id']};return pdf[_0xf7d2('0x74')](_0xb2ba04,_0x3853f3);})[_0xf7d2('0x1b')](function(){return new BPromise(function(_0x45f3f9,_0x57a0c0){zipdir(_0x39208d,{'saveTo':_0x2af0f2},function(_0xf5374d,_0x1f32f6){if(_0xf5374d)return _0x57a0c0(_0xf5374d);return _0x45f3f9(_0x1f32f6);});})[_0xf7d2('0x1b')](function(){return new BPromise(function(_0x49b7a5,_0x38b3ab){rimraf(_0x39208d,function(_0x4fb512){if(_0x4fb512)_0x38b3ab(_0x4fb512);return _0x49b7a5();});});})['then'](function(){return _0x59de15[_0xf7d2('0x75')](_0x2af0f2,_0x58ef59,function(_0x5df92e){if(_0x5df92e){console[_0xf7d2('0x76')](_0xf7d2('0x77'),_0x5df92e);}else{fs[_0xf7d2('0x78')](_0x2af0f2);}});});});}else{return _0x59de15[_0xf7d2('0x10')](0xc8);}})[_0xf7d2('0x38')](handleError(_0x59de15,null));}; \ No newline at end of file +var _0x4eb0=['getOptions','findAll','query','catch','show','params','model','keys','SmsInteraction','rawAttributes','filters','intersection','attributes','fields','length','includeAll','find','create','body','describe','SmsMessage','addMessage','omit','findOne','nolimit','sort','where','pick','SmsInteractionId','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','ids','spread','Tag','color','emit','removeTags','download','unix','toString','root','server','tmp','join','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','createdAt','direction','secret','read','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','closed','closedAt','Messages','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','bluebird','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','type'];(function(_0x200c84,_0x34e0fd){var _0x1248f3=function(_0x261a6a){while(--_0x261a6a){_0x200c84['push'](_0x200c84['shift']());}};_0x1248f3(++_0x34e0fd);}(_0x4eb0,0x13b));var _0x04eb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4eb0[_0x3bf83f];return _0x22c4a9;};'use strict';var rimraf=require(_0x04eb('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x04eb('0x1'));var util=require('util');var path=require(_0x04eb('0x2'));var ejs=require(_0x04eb('0x3'));var fs=require('fs');var _=require(_0x04eb('0x4'));var Redis=require('ioredis');var interaction=require(_0x04eb('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x04eb('0x6'));var logger=require(_0x04eb('0x7'))(_0x04eb('0x8'));var config=require(_0x04eb('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x04eb('0xa')](config[_0x04eb('0xb')],{'host':_0x04eb('0xc'),'port':0x18eb});var socket=require(_0x04eb('0xd'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x04eb('0xe')](socket);function respondWithStatusCode(_0x24f910,_0x35a2ef){_0x35a2ef=_0x35a2ef||0xcc;return function(_0x5f54f2){if(_0x5f54f2){return _0x24f910[_0x04eb('0xf')](_0x35a2ef);}return _0x24f910[_0x04eb('0x10')](_0x35a2ef)['end']();};}function respondWithResult(_0x1da460,_0x2bf968){_0x2bf968=_0x2bf968||0xc8;return function(_0x22d548){if(_0x22d548){return _0x1da460['status'](_0x2bf968)[_0x04eb('0x11')](_0x22d548);}};}function respondWithFilteredResult(_0x1c8f0a,_0xa3b2f6){return function(_0x386a05){if(_0x386a05){var _0x19b39f=typeof _0xa3b2f6['offset']===_0x04eb('0x12')&&typeof _0xa3b2f6['limit']===_0x04eb('0x12');var _0x54b637=_0x386a05[_0x04eb('0x13')];var _0x458abf=_0x19b39f?0x0:_0xa3b2f6[_0x04eb('0x14')];var _0xeaccd4=_0x19b39f?_0x386a05[_0x04eb('0x13')]:_0xa3b2f6[_0x04eb('0x14')]+_0xa3b2f6[_0x04eb('0x15')];var _0x1a0b19;if(_0xeaccd4>=_0x54b637){_0xeaccd4=_0x54b637;_0x1a0b19=0xc8;}else{_0x1a0b19=0xce;}_0x1c8f0a['status'](_0x1a0b19);return _0x1c8f0a[_0x04eb('0x16')](_0x04eb('0x17'),_0x458abf+'-'+_0xeaccd4+'/'+_0x54b637)[_0x04eb('0x11')](_0x386a05);}return null;};}function saveUpdates(_0x5e94e3){return function(_0x173854){if(_0x173854){return _0x173854[_0x04eb('0x18')](_0x5e94e3)[_0x04eb('0x19')](function(_0x471560){return _0x471560;});}return null;};}function removeEntity(_0x1e721f){return function(_0x433cf6){if(_0x433cf6){return _0x433cf6[_0x04eb('0x1a')]()[_0x04eb('0x19')](function(){_0x1e721f[_0x04eb('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa344f7){return function(_0x10cccf){if(!_0x10cccf){_0xa344f7[_0x04eb('0xf')](0x194);}return _0x10cccf;};}function handleError(_0x1b5648,_0x5b50ba){_0x5b50ba=_0x5b50ba||0x1f4;return function(_0x14f8e6){logger[_0x04eb('0x1b')](_0x14f8e6[_0x04eb('0x1c')]);if(_0x14f8e6[_0x04eb('0x1d')]){delete _0x14f8e6['name'];}_0x1b5648[_0x04eb('0x10')](_0x5b50ba)[_0x04eb('0x1e')](_0x14f8e6);};}exports[_0x04eb('0x1f')]=function(_0x161a8a,_0x194784){var _0x1d22cb={};var _0x530e70=_['map'](db['SmsInteraction']['rawAttributes'],function(_0x234c75){return{'name':_0x234c75['fieldName'],'type':_0x234c75[_0x04eb('0x20')]['key']};});_0x1d22cb=qs[_0x04eb('0x21')](_0x530e70,_0x161a8a);return interaction[_0x04eb('0x22')]('sms',_0x161a8a[_0x04eb('0x23')],_0x161a8a['user'],_0x1d22cb,_0x530e70)[_0x04eb('0x19')](respondWithFilteredResult(_0x194784,_0x1d22cb))[_0x04eb('0x24')](handleError(_0x194784,null));};exports[_0x04eb('0x25')]=function(_0x46cade,_0x1da7e2){var _0x51e64c={'raw':![],'where':{'id':_0x46cade[_0x04eb('0x26')]['id']}},_0x14eaae={};_0x14eaae[_0x04eb('0x27')]=_[_0x04eb('0x28')](db[_0x04eb('0x29')][_0x04eb('0x2a')]);_0x14eaae[_0x04eb('0x23')]=_[_0x04eb('0x28')](_0x46cade[_0x04eb('0x23')]);_0x14eaae[_0x04eb('0x2b')]=_[_0x04eb('0x2c')](_0x14eaae[_0x04eb('0x27')],_0x14eaae[_0x04eb('0x23')]);_0x51e64c[_0x04eb('0x2d')]=_['intersection'](_0x14eaae[_0x04eb('0x27')],qs[_0x04eb('0x2e')](_0x46cade['query'][_0x04eb('0x2e')]));_0x51e64c[_0x04eb('0x2d')]=_0x51e64c[_0x04eb('0x2d')][_0x04eb('0x2f')]?_0x51e64c[_0x04eb('0x2d')]:_0x14eaae[_0x04eb('0x27')];if(_0x46cade[_0x04eb('0x23')][_0x04eb('0x30')]){_0x51e64c['include']=[{'all':!![]}];}_0x51e64c=_['merge']({},_0x51e64c,_0x46cade['options']);return db['SmsInteraction'][_0x04eb('0x31')](_0x51e64c)['then'](handleEntityNotFound(_0x1da7e2,null))[_0x04eb('0x19')](respondWithResult(_0x1da7e2,null))[_0x04eb('0x24')](handleError(_0x1da7e2,null));};exports[_0x04eb('0x32')]=function(_0x8898fd,_0x3ea94e){return db['SmsInteraction'][_0x04eb('0x32')](_0x8898fd[_0x04eb('0x33')],{})[_0x04eb('0x19')](respondWithResult(_0x3ea94e,0xc9))[_0x04eb('0x24')](handleError(_0x3ea94e,null));};exports[_0x04eb('0x18')]=function(_0x30e1c9,_0x4b027f){if(_0x30e1c9[_0x04eb('0x33')]['id']){delete _0x30e1c9['body']['id'];}return db[_0x04eb('0x29')][_0x04eb('0x31')]({'where':{'id':_0x30e1c9['params']['id']}})['then'](handleEntityNotFound(_0x4b027f,null))[_0x04eb('0x19')](saveUpdates(_0x30e1c9[_0x04eb('0x33')],null))['then'](respondWithResult(_0x4b027f,null))[_0x04eb('0x24')](handleError(_0x4b027f,null));};exports[_0x04eb('0x1a')]=function(_0x53da7a,_0x1ccafb){return db[_0x04eb('0x29')][_0x04eb('0x31')]({'where':{'id':_0x53da7a[_0x04eb('0x26')]['id']}})[_0x04eb('0x19')](handleEntityNotFound(_0x1ccafb,null))[_0x04eb('0x19')](removeEntity(_0x1ccafb,null))[_0x04eb('0x24')](handleError(_0x1ccafb,null));};exports[_0x04eb('0x34')]=function(_0x5f788e,_0x183efd){return db[_0x04eb('0x29')][_0x04eb('0x34')]()[_0x04eb('0x19')](respondWithResult(_0x183efd,null))['catch'](handleError(_0x183efd,null));};exports['addMessage']=function(_0x48453c,_0x6c931b){return db[_0x04eb('0x35')]['find']({'where':{'id':_0x48453c['params']['id']}})['then'](handleEntityNotFound(_0x6c931b,null))[_0x04eb('0x19')](function(_0x15aa5e){if(_0x15aa5e){return _0x15aa5e[_0x04eb('0x36')](_0x48453c['body']['ids'],_[_0x04eb('0x37')](_0x48453c[_0x04eb('0x33')],['ids','id'])||{});}})['then'](respondWithResult(_0x6c931b,null))['catch'](handleError(_0x6c931b,null));};exports['getMessages']=function(_0x11c650,_0x37bc9a){var _0x506731={'raw':![],'where':{}};var _0x13bd1c={};var _0x316441={'count':0x0,'rows':[]};return db[_0x04eb('0x29')][_0x04eb('0x38')]({'where':{'id':_0x11c650[_0x04eb('0x26')]['id']}})[_0x04eb('0x19')](handleEntityNotFound(_0x37bc9a,null))[_0x04eb('0x19')](function(_0x104d1b){if(_0x104d1b){_0x13bd1c['model']=_['keys'](db[_0x04eb('0x35')]['rawAttributes']);_0x13bd1c[_0x04eb('0x23')]=_[_0x04eb('0x28')](_0x11c650[_0x04eb('0x23')]);_0x13bd1c[_0x04eb('0x2b')]=_[_0x04eb('0x2c')](_0x13bd1c[_0x04eb('0x27')],_0x13bd1c['query']);_0x506731[_0x04eb('0x2d')]=_[_0x04eb('0x2c')](_0x13bd1c[_0x04eb('0x27')],qs[_0x04eb('0x2e')](_0x11c650[_0x04eb('0x23')][_0x04eb('0x2e')]));_0x506731[_0x04eb('0x2d')]=_0x506731['attributes'][_0x04eb('0x2f')]?_0x506731[_0x04eb('0x2d')]:_0x13bd1c['model'];if(!_0x11c650[_0x04eb('0x23')]['hasOwnProperty'](_0x04eb('0x39'))){_0x506731[_0x04eb('0x15')]=qs['limit'](_0x11c650['query'][_0x04eb('0x15')]);_0x506731['offset']=qs[_0x04eb('0x14')](_0x11c650[_0x04eb('0x23')]['offset']);}_0x506731['order']=qs[_0x04eb('0x3a')](_0x11c650[_0x04eb('0x23')][_0x04eb('0x3a')]);_0x506731[_0x04eb('0x3b')]=qs[_0x04eb('0x2b')](_[_0x04eb('0x3c')](_0x11c650[_0x04eb('0x23')],_0x13bd1c[_0x04eb('0x2b')]));_0x506731[_0x04eb('0x3b')][_0x04eb('0x3d')]=_0x104d1b['id'];if(_0x11c650[_0x04eb('0x23')][_0x04eb('0x3e')]){_0x506731[_0x04eb('0x3b')]=_[_0x04eb('0x3f')](_0x506731['where'],{'$or':_[_0x04eb('0x40')](_0x506731[_0x04eb('0x2d')],function(_0x460be4){var _0x3b846d={};_0x3b846d[_0x460be4]={'$like':'%'+_0x11c650['query']['filter']+'%'};return _0x3b846d;})});}if(_0x11c650['query']['$gte']){var _0x1f02e8=_0x11c650[_0x04eb('0x23')][_0x04eb('0x41')][_0x04eb('0x42')](',');var _0x452da6={};_0x452da6[_0x1f02e8[0x0]]={'$gte':moment(_0x1f02e8[0x1])[_0x04eb('0x43')](_0x04eb('0x44'))};_0x506731[_0x04eb('0x3b')]=_[_0x04eb('0x3f')](_0x506731[_0x04eb('0x3b')],_0x452da6);}_0x506731=_[_0x04eb('0x3f')]({},_0x506731,_0x11c650['options']);return db[_0x04eb('0x35')][_0x04eb('0x13')]({'where':_0x506731['where']})['then'](function(_0x2d15e8){_0x316441[_0x04eb('0x13')]=_0x2d15e8;if(_0x11c650[_0x04eb('0x23')][_0x04eb('0x30')]){_0x506731['include']=[{'all':!![]}];}return db[_0x04eb('0x35')][_0x04eb('0x22')](_0x506731);})['then'](function(_0x2b28f9){_0x316441[_0x04eb('0x45')]=_0x2b28f9;return _0x316441;});}})[_0x04eb('0x19')](respondWithFilteredResult(_0x37bc9a,_0x506731))['catch'](handleError(_0x37bc9a,null));};exports[_0x04eb('0x46')]=function(_0x26b39b,_0x786362){return db[_0x04eb('0x29')]['find']({'where':{'id':_0x26b39b[_0x04eb('0x26')]['id']}})[_0x04eb('0x19')](handleEntityNotFound(_0x786362,null))['then'](function(_0x1ef582){if(_0x1ef582){return _0x1ef582[_0x04eb('0x47')](_0x26b39b[_0x04eb('0x33')][_0x04eb('0x48')],_[_0x04eb('0x37')](_0x26b39b[_0x04eb('0x33')],['ids','id'])||{})[_0x04eb('0x49')](function(){return db[_0x04eb('0x4a')][_0x04eb('0x22')]({'attributes':['id',_0x04eb('0x1d'),_0x04eb('0x4b')],'where':{'id':_0x26b39b[_0x04eb('0x33')][_0x04eb('0x48')]}});})[_0x04eb('0x19')](function(_0xfbf49a){socket[_0x04eb('0x4c')]('smsInteractionTags:save',{'id':Number(_0x26b39b[_0x04eb('0x26')]['id']),'tags':_0xfbf49a||[]});return{'id':Number(_0x26b39b[_0x04eb('0x26')]['id']),'tags':_0xfbf49a||[]};});}})[_0x04eb('0x19')](respondWithResult(_0x786362,null))[_0x04eb('0x24')](handleError(_0x786362,null));};exports['removeTags']=function(_0x24b2c7,_0x4c54ee){return db[_0x04eb('0x29')]['find']({'where':{'id':_0x24b2c7[_0x04eb('0x26')]['id']}})[_0x04eb('0x19')](handleEntityNotFound(_0x4c54ee,null))[_0x04eb('0x19')](function(_0x260c1c){if(_0x260c1c){return _0x260c1c[_0x04eb('0x4d')](_0x24b2c7[_0x04eb('0x23')][_0x04eb('0x48')]);}})['then'](respondWithStatusCode(_0x4c54ee,null))[_0x04eb('0x24')](handleError(_0x4c54ee,null));};exports[_0x04eb('0x4e')]=function(_0x2541b3,_0x2444b0){var _0x1c94a6=moment()[_0x04eb('0x4f')]()[_0x04eb('0x50')]();var _0x2d64ef=path['join'](config[_0x04eb('0x51')],_0x04eb('0x52'),'files',_0x04eb('0x53'));var _0x19722c=path[_0x04eb('0x54')](_0x2d64ef,_0x1c94a6);var _0x2dd0e5=util[_0x04eb('0x43')](_0x04eb('0x55'),_0x2541b3[_0x04eb('0x26')]['id'],_0x1c94a6);var _0x497224=path[_0x04eb('0x54')](_0x2d64ef,_0x2dd0e5);var _0x581a2c=[];_0x581a2c['push']({'model':db[_0x04eb('0x56')],'as':_0x04eb('0x56'),'attributes':['id',_0x04eb('0x57')],'raw':!![]});_0x581a2c[_0x04eb('0x58')]({'model':db[_0x04eb('0x59')],'as':_0x04eb('0x5a'),'attributes':['id',_0x04eb('0x5b'),_0x04eb('0x5c')],'raw':!![]});var _0x4afee5=[{'model':db[_0x04eb('0x35')],'as':'Messages','attributes':['id',_0x04eb('0x33'),_0x04eb('0x5d'),_0x04eb('0x5e'),_0x04eb('0x5f'),_0x04eb('0x60')],'include':_0x581a2c}];_0x4afee5[_0x04eb('0x58')]({'model':db[_0x04eb('0x61')],'as':_0x04eb('0x62'),'attributes':['id',_0x04eb('0x1d')]});_0x4afee5[_0x04eb('0x58')]({'model':db['User'],'as':'Owner','attributes':['id',_0x04eb('0x57')]});return db[_0x04eb('0x29')][_0x04eb('0x31')]({'where':{'id':_0x2541b3['params']['id']},'include':_0x4afee5})[_0x04eb('0x19')](handleEntityNotFound(_0x2444b0,null))[_0x04eb('0x19')](function(_0x5f2dc5){if(_0x5f2dc5){var _0x42ebbc=_0x5f2dc5[_0x04eb('0x63')]({'plain':!![]});fs[_0x04eb('0x64')](_0x19722c);var _0x5337d1={'channel':_0x04eb('0x65'),'account':_0x42ebbc[_0x04eb('0x62')][_0x04eb('0x1d')],'agent':_0x42ebbc[_0x04eb('0x66')]?_0x42ebbc[_0x04eb('0x66')][_0x04eb('0x57')]:_0x04eb('0x67'),'createdAt':moment(_0x42ebbc[_0x04eb('0x5d')])[_0x04eb('0x43')](_0x04eb('0x44'))[_0x04eb('0x50')](),'closedAt':_0x42ebbc[_0x04eb('0x68')]?moment(_0x42ebbc[_0x04eb('0x69')])[_0x04eb('0x43')](_0x04eb('0x44'))[_0x04eb('0x50')]():'','disposition':_0x42ebbc['disposition'],'messages':_(_0x42ebbc[_0x04eb('0x6a')])[_0x04eb('0x3e')]({'secret':![]})[_0x04eb('0x40')](function(_0xc2c8f9){return{'date':moment(_0xc2c8f9[_0x04eb('0x5d')])[_0x04eb('0x43')](_0x04eb('0x44'))[_0x04eb('0x50')](),'sender':_0xc2c8f9[_0x04eb('0x5e')]==='out'?_0xc2c8f9[_0x04eb('0x56')]?_0xc2c8f9[_0x04eb('0x56')]['fullname']:'System':_0xc2c8f9[_0x04eb('0x5a')][_0x04eb('0x5b')]+(_0xc2c8f9[_0x04eb('0x5a')][_0x04eb('0x5c')]?'\x20'+_0xc2c8f9[_0x04eb('0x5a')]['lastName']:''),'body':_0xc2c8f9[_0x04eb('0x33')],'direction':_0xc2c8f9[_0x04eb('0x5e')]==='out'?'A':'C','secret':_0xc2c8f9[_0x04eb('0x5f')],'read':_0xc2c8f9[_0x04eb('0x60')]};})[_0x04eb('0x6b')]()};return ejs[_0x04eb('0x6c')](path[_0x04eb('0x54')](config[_0x04eb('0x51')],_0x04eb('0x52'),'views',_0x04eb('0x6d')),{'interaction':_0x5337d1})[_0x04eb('0x19')](function(_0x2cfa85){var _0x42269d=path['join'](_0x19722c,_0x04eb('0x6e')+_0x42ebbc['id']+'-'+_0x1c94a6+_0x04eb('0x6f'));var _0x449f53={'path':_0x42269d,'channel':'Sms','interactionId':_0x42ebbc['id']};return pdf[_0x04eb('0x70')](_0x2cfa85,_0x449f53);})['then'](function(){return new BPromise(function(_0x5a4edb,_0x18b028){zipdir(_0x19722c,{'saveTo':_0x497224},function(_0x5e422c,_0x32b810){if(_0x5e422c)return _0x18b028(_0x5e422c);return _0x5a4edb(_0x32b810);});})[_0x04eb('0x19')](function(){return new BPromise(function(_0x257c9e,_0x3d0533){rimraf(_0x19722c,function(_0x36525b){if(_0x36525b)_0x3d0533(_0x36525b);return _0x257c9e();});});})[_0x04eb('0x19')](function(){return _0x2444b0['download'](_0x497224,_0x2dd0e5,function(_0x13ae9b){if(_0x13ae9b){console[_0x04eb('0x71')](_0x04eb('0x72'),_0x13ae9b);}else{fs[_0x04eb('0x73')](_0x497224);}});});});}else{return _0x2444b0[_0x04eb('0xf')](0xc8);}})[_0x04eb('0x24')](handleError(_0x2444b0,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c02a9cd..bb05fa6 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 _0x8f4c=['length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','Users','map','findAll','then','setDataValue','unreadMessages'];(function(_0x1b78d1,_0x2e525f){var _0x36c818=function(_0x168c6f){while(--_0x168c6f){_0x1b78d1['push'](_0x1b78d1['shift']());}};_0x36c818(++_0x2e525f);}(_0x8f4c,0x113));var _0xc8f4=function(_0x4f9617,_0x16a10a){_0x4f9617=_0x4f9617-0x0;var _0x55b7d0=_0x8f4c[_0x4f9617];return _0x55b7d0;};'use strict';var EventEmitter=require(_0xc8f4('0x0'));var SmsInteraction=require(_0xc8f4('0x1'))['db'][_0xc8f4('0x2')];var SmsMessage=require(_0xc8f4('0x1'))['db'][_0xc8f4('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc8f4('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc8f4('0x5'),'afterDestroy':_0xc8f4('0x6')};function emitEvent(_0x133764){return function(_0x56c9b1,_0x32cd80,_0x5208da){_0x56c9b1['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x373506){_0x56c9b1['setDataValue'](_0xc8f4('0x7'),_0x373506[_0xc8f4('0x8')](function(_0xceb9b3){return{'id':_0xceb9b3['id']};}));return SmsMessage[_0xc8f4('0x9')]({'where':{'SmsInteractionId':_0x56c9b1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc8f4('0xa')](function(_0x599de3){_0x56c9b1[_0xc8f4('0xb')](_0xc8f4('0xc'),_0x599de3[_0xc8f4('0xd')]);SmsInteractionEvents[_0xc8f4('0xe')](_0x133764+':'+_0x56c9b1['id'],_0x56c9b1);SmsInteractionEvents['emit'](_0x133764,_0x56c9b1);_0x5208da(null);})[_0xc8f4('0xf')](_0x5208da(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xc8f4('0x10')](e,emitEvent(event));}}module[_0xc8f4('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xcf2f=['setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then'];(function(_0x219fa0,_0x18b239){var _0xc603fb=function(_0x3371ad){while(--_0x3371ad){_0x219fa0['push'](_0x219fa0['shift']());}};_0xc603fb(++_0x18b239);}(_0xcf2f,0xa7));var _0xfcf2=function(_0xda53f0,_0x5c9b31){_0xda53f0=_0xda53f0-0x0;var _0x153b41=_0xcf2f[_0xda53f0];return _0x153b41;};'use strict';var EventEmitter=require(_0xfcf2('0x0'));var SmsInteraction=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x2')];var SmsMessage=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfcf2('0x4'),'afterUpdate':_0xfcf2('0x5'),'afterDestroy':_0xfcf2('0x6')};function emitEvent(_0x34bcaf){return function(_0x179e60,_0x167a77,_0x1e6d99){_0x179e60[_0xfcf2('0x7')]({'attributes':['id'],'raw':!![]})[_0xfcf2('0x8')](function(_0x157f48){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xa'),_0x157f48[_0xfcf2('0xb')](function(_0x13ce18){return{'id':_0x13ce18['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x179e60['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4d6fc9){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xc'),_0x4d6fc9['length']);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf+':'+_0x179e60['id'],_0x179e60);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf,_0x179e60);_0x1e6d99(null);})[_0xfcf2('0xe')](_0x1e6d99(null));};}for(var e in events){if(events[_0xfcf2('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 3ccb555..62ac144 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 _0x148c=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions'];(function(_0xaf2a97,_0x256ce7){var _0x2cbfaa=function(_0x5504b8){while(--_0x5504b8){_0xaf2a97['push'](_0xaf2a97['shift']());}};_0x2cbfaa(++_0x256ce7);}(_0x148c,0x6a));var _0xc148=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x148c[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0xc148('0x0'));var util=require(_0xc148('0x1'));var logger=require(_0xc148('0x2'))(_0xc148('0x3'));var moment=require(_0xc148('0x4'));var BPromise=require(_0xc148('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc148('0x6'));var rimraf=require('rimraf');var config=require(_0xc148('0x7'));var attributes=require(_0xc148('0x8'));module[_0xc148('0x9')]=function(_0x56c7d7,_0x461596){return _0x56c7d7[_0xc148('0xa')](_0xc148('0xb'),attributes,{'tableName':_0xc148('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x281758,_0x381506,_0x6d9854){if(_0x281758[_0xc148('0xd')](_0xc148('0xe'))){_0x281758['closedAt']=moment()[_0xc148('0xf')](_0xc148('0x10'));}_0x6d9854(null,_0x281758);}}});}; \ No newline at end of file +var _0x36c8=['api','request-promise','path','rimraf','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x465fa6,_0x34e716){var _0x205c56=function(_0x152b3d){while(--_0x152b3d){_0x465fa6['push'](_0x465fa6['shift']());}};_0x205c56(++_0x34e716);}(_0x36c8,0x14d));var _0x836c=function(_0x72e877,_0x11a079){_0x72e877=_0x72e877-0x0;var _0x3bbfda=_0x36c8[_0x72e877];return _0x3bbfda;};'use strict';var _=require(_0x836c('0x0'));var util=require(_0x836c('0x1'));var logger=require(_0x836c('0x2'))(_0x836c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x836c('0x4'));var fs=require('fs');var path=require(_0x836c('0x5'));var rimraf=require(_0x836c('0x6'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x836c('0x7')]=function(_0x319f94,_0x1a719e){return _0x319f94['define'](_0x836c('0x8'),attributes,{'tableName':_0x836c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49210d,_0xe08b4f,_0x3fc92c){if(_0x49210d[_0x836c('0xa')](_0x836c('0xb'))){_0x49210d[_0x836c('0xc')]=moment()[_0x836c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3fc92c(null,_0x49210d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 812eba6..b398c93 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 _0x3e90=['error','code','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','options','raw','where','limit','AddTagsToSmsInteraction','body','ids','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4c1f97,_0x5db3fc){var _0x556838=function(_0x4fc3d6){while(--_0x4fc3d6){_0x4c1f97['push'](_0x4c1f97['shift']());}};_0x556838(++_0x5db3fc);}(_0x3e90,0x82));var _0x03e9=function(_0x3e39bf,_0x10904c){_0x3e39bf=_0x3e39bf-0x0;var _0x65a574=_0x3e90[_0x3e39bf];return _0x65a574;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x03e9('0x0'));var BPromise=require(_0x03e9('0x1'));var rs=require(_0x03e9('0x2'));var fs=require('fs');var Redis=require(_0x03e9('0x3'));var db=require(_0x03e9('0x4'))['db'];var utils=require(_0x03e9('0x5'));var logger=require('../../config/logger')(_0x03e9('0x6'));var config=require('../../config/environment');var jayson=require(_0x03e9('0x7'));var client=jayson[_0x03e9('0x8')][_0x03e9('0x9')]({'port':0x232a});config[_0x03e9('0xa')]=_[_0x03e9('0xb')](config[_0x03e9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x03e9('0xc'))(new Redis(config['redis']));require(_0x03e9('0xd'))[_0x03e9('0xe')](socket);function respondWithRpcPromise(_0x1918d9,_0x41e85e,_0x5f30dd){return new BPromise(function(_0x4d063c,_0x3c97d8){return client[_0x03e9('0xf')](_0x1918d9,_0x5f30dd)[_0x03e9('0x10')](function(_0x123ba9){logger['info'](_0x03e9('0x11'),_0x41e85e,'request\x20sent');logger[_0x03e9('0x12')](_0x03e9('0x13'),_0x41e85e,_0x03e9('0x14'),JSON[_0x03e9('0x15')](_0x123ba9));if(_0x123ba9[_0x03e9('0x16')]){if(_0x123ba9[_0x03e9('0x16')][_0x03e9('0x17')]===0x1f4){logger['error'](_0x03e9('0x11'),_0x41e85e,_0x123ba9[_0x03e9('0x16')][_0x03e9('0x18')]);return _0x3c97d8(_0x123ba9[_0x03e9('0x16')][_0x03e9('0x18')]);}logger[_0x03e9('0x16')](_0x03e9('0x11'),_0x41e85e,_0x123ba9[_0x03e9('0x16')][_0x03e9('0x18')]);return _0x4d063c(_0x123ba9['error'][_0x03e9('0x18')]);}else{logger[_0x03e9('0x19')](_0x03e9('0x11'),_0x41e85e,_0x03e9('0x14'));_0x4d063c(_0x123ba9[_0x03e9('0x1a')][_0x03e9('0x18')]);}})[_0x03e9('0x1b')](function(_0x37f49a){logger[_0x03e9('0x16')](_0x03e9('0x11'),_0x41e85e,_0x37f49a);_0x3c97d8(_0x37f49a);});});}exports[_0x03e9('0x1c')]=function(_0xf4facd){var _0x562aa=this;return new Promise(function(_0x1bfe79,_0x5ee39f){return db[_0x03e9('0x1d')]['update'](_0xf4facd['body'],{'raw':_0xf4facd[_0x03e9('0x1e')]?_0xf4facd[_0x03e9('0x1e')][_0x03e9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf4facd[_0x03e9('0x1e')]?_0xf4facd[_0x03e9('0x1e')][_0x03e9('0x20')]||null:null,'attributes':_0xf4facd[_0x03e9('0x1e')]?_0xf4facd[_0x03e9('0x1e')]['attributes']||null:null,'limit':_0xf4facd[_0x03e9('0x1e')]?_0xf4facd[_0x03e9('0x1e')][_0x03e9('0x21')]||null:null})[_0x03e9('0x10')](function(_0x37a3e5){logger['info']('UpdateSmsInteraction',_0xf4facd);logger[_0x03e9('0x12')](_0x03e9('0x1c'),_0xf4facd,JSON[_0x03e9('0x15')](_0x37a3e5));_0x1bfe79(_0x37a3e5);})[_0x03e9('0x1b')](function(_0x74f079){logger['error'](_0x03e9('0x1c'),_0x74f079[_0x03e9('0x18')],_0xf4facd);_0x5ee39f(_0x562aa[_0x03e9('0x16')](0x1f4,_0x74f079[_0x03e9('0x18')]));});});};exports[_0x03e9('0x22')]=function(_0x2ff167){return new Promise(function(_0x367566,_0x4f1359){return db[_0x03e9('0x1d')]['find']({'where':_0x2ff167[_0x03e9('0x1e')]?_0x2ff167[_0x03e9('0x1e')][_0x03e9('0x20')]||null:null})[_0x03e9('0x10')](function(_0x253d4c){if(_0x253d4c){return _0x253d4c['addTags'](_0x2ff167[_0x03e9('0x23')][_0x03e9('0x24')],_['omit'](_0x2ff167[_0x03e9('0x23')],[_0x03e9('0x24'),'id'])||{});}})['spread'](function(_0x19bc7c){logger[_0x03e9('0x19')](_0x03e9('0x25'),_0x2ff167);logger[_0x03e9('0x12')](_0x03e9('0x25'),_0x2ff167,JSON[_0x03e9('0x15')](_0x19bc7c));_0x367566(_0x19bc7c);})[_0x03e9('0x1b')](function(_0x17a84d){logger[_0x03e9('0x16')](_0x03e9('0x25'),_0x17a84d[_0x03e9('0x18')],_0x2ff167);_0x4f1359(_this[_0x03e9('0x16')](0x1f4,_0x17a84d[_0x03e9('0x18')]));});});}; \ No newline at end of file +var _0xf3f1=['addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToSmsInteraction','SmsInteraction','find'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0xf3f1,0xe1));var _0x1f3f=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xf3f1[_0x2b8077];return _0x308091;};'use strict';var _=require(_0x1f3f('0x0'));var util=require(_0x1f3f('0x1'));var moment=require(_0x1f3f('0x2'));var BPromise=require(_0x1f3f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f3f('0x4'))['db'];var utils=require(_0x1f3f('0x5'));var logger=require(_0x1f3f('0x6'))('rpc');var config=require(_0x1f3f('0x7'));var jayson=require(_0x1f3f('0x8'));var client=jayson[_0x1f3f('0x9')][_0x1f3f('0xa')]({'port':0x232a});config[_0x1f3f('0xb')]=_['defaults'](config[_0x1f3f('0xb')],{'host':_0x1f3f('0xc'),'port':0x18eb});var socket=require(_0x1f3f('0xd'))(new Redis(config[_0x1f3f('0xb')]));require(_0x1f3f('0xe'))[_0x1f3f('0xf')](socket);function respondWithRpcPromise(_0x3b7efb,_0x36a4e0,_0x418466){return new BPromise(function(_0x59a9ea,_0x143b08){return client['request'](_0x3b7efb,_0x418466)[_0x1f3f('0x10')](function(_0x101771){logger[_0x1f3f('0x11')](_0x1f3f('0x12'),_0x36a4e0,'request\x20sent');logger['debug'](_0x1f3f('0x13'),_0x36a4e0,_0x1f3f('0x14'),JSON[_0x1f3f('0x15')](_0x101771));if(_0x101771['error']){if(_0x101771[_0x1f3f('0x16')][_0x1f3f('0x17')]===0x1f4){logger[_0x1f3f('0x16')](_0x1f3f('0x12'),_0x36a4e0,_0x101771[_0x1f3f('0x16')][_0x1f3f('0x18')]);return _0x143b08(_0x101771['error'][_0x1f3f('0x18')]);}logger[_0x1f3f('0x16')](_0x1f3f('0x12'),_0x36a4e0,_0x101771[_0x1f3f('0x16')][_0x1f3f('0x18')]);return _0x59a9ea(_0x101771[_0x1f3f('0x16')][_0x1f3f('0x18')]);}else{logger[_0x1f3f('0x11')](_0x1f3f('0x12'),_0x36a4e0,_0x1f3f('0x14'));_0x59a9ea(_0x101771[_0x1f3f('0x19')]['message']);}})[_0x1f3f('0x1a')](function(_0x21f503){logger[_0x1f3f('0x16')](_0x1f3f('0x12'),_0x36a4e0,_0x21f503);_0x143b08(_0x21f503);});});}exports[_0x1f3f('0x1b')]=function(_0x3ff467){var _0x21c12c=this;return new Promise(function(_0x4ce91a,_0xcbcf69){return db['SmsInteraction'][_0x1f3f('0x1c')](_0x3ff467[_0x1f3f('0x1d')],{'raw':_0x3ff467['options']?_0x3ff467[_0x1f3f('0x1e')][_0x1f3f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ff467[_0x1f3f('0x1e')]?_0x3ff467[_0x1f3f('0x1e')][_0x1f3f('0x20')]||null:null,'attributes':_0x3ff467[_0x1f3f('0x1e')]?_0x3ff467[_0x1f3f('0x1e')][_0x1f3f('0x21')]||null:null,'limit':_0x3ff467[_0x1f3f('0x1e')]?_0x3ff467[_0x1f3f('0x1e')][_0x1f3f('0x22')]||null:null})[_0x1f3f('0x10')](function(_0x40ff74){logger[_0x1f3f('0x11')]('UpdateSmsInteraction',_0x3ff467);logger[_0x1f3f('0x23')](_0x1f3f('0x1b'),_0x3ff467,JSON[_0x1f3f('0x15')](_0x40ff74));_0x4ce91a(_0x40ff74);})['catch'](function(_0x3e7882){logger['error']('UpdateSmsInteraction',_0x3e7882[_0x1f3f('0x18')],_0x3ff467);_0xcbcf69(_0x21c12c[_0x1f3f('0x16')](0x1f4,_0x3e7882[_0x1f3f('0x18')]));});});};exports[_0x1f3f('0x24')]=function(_0x39be92){return new Promise(function(_0x4fabea,_0x4189b4){return db[_0x1f3f('0x25')][_0x1f3f('0x26')]({'where':_0x39be92[_0x1f3f('0x1e')]?_0x39be92[_0x1f3f('0x1e')][_0x1f3f('0x20')]||null:null})[_0x1f3f('0x10')](function(_0x1a06f1){if(_0x1a06f1){return _0x1a06f1[_0x1f3f('0x27')](_0x39be92[_0x1f3f('0x1d')][_0x1f3f('0x28')],_[_0x1f3f('0x29')](_0x39be92[_0x1f3f('0x1d')],[_0x1f3f('0x28'),'id'])||{});}})[_0x1f3f('0x2a')](function(_0x4d5bb8){logger[_0x1f3f('0x11')](_0x1f3f('0x2b'),_0x39be92);logger[_0x1f3f('0x23')]('AddTags',_0x39be92,JSON[_0x1f3f('0x15')](_0x4d5bb8));_0x4fabea(_0x4d5bb8);})[_0x1f3f('0x1a')](function(_0x4a70ec){logger[_0x1f3f('0x16')](_0x1f3f('0x2b'),_0x4a70ec['message'],_0x39be92);_0x4189b4(_this[_0x1f3f('0x16')](0x1f4,_0x4a70ec[_0x1f3f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index ee5856a..0aa390e 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 _0x21f5=['smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x58dc3e,_0x29d6ee){var _0x4ff34a=function(_0x27ce28){while(--_0x27ce28){_0x58dc3e['push'](_0x58dc3e['shift']());}};_0x4ff34a(++_0x29d6ee);}(_0x21f5,0x1a9));var _0x521f=function(_0x102350,_0x327cea){_0x102350=_0x102350-0x0;var _0x50e292=_0x21f5[_0x102350];return _0x50e292;};'use strict';var SmsInteractionEvents=require(_0x521f('0x0'));var events=[_0x521f('0x1'),_0x521f('0x2'),_0x521f('0x3')];function createListener(_0x1b0ca6,_0x411b72){return function(_0x9c2bd6){_0x411b72[_0x521f('0x4')](_0x1b0ca6,_0x9c2bd6);};}function removeListener(_0x2e25d7,_0x35baa8){return function(){SmsInteractionEvents[_0x521f('0x5')](_0x2e25d7,_0x35baa8);};}exports[_0x521f('0x6')]=function(_0x5c1fd0){for(var _0x710f3b=0x0,_0x537996=events['length'];_0x710f3b<_0x537996;_0x710f3b++){var _0xb37300=events[_0x710f3b];var _0xdf12ce=createListener(_0x521f('0x7')+_0xb37300,_0x5c1fd0);SmsInteractionEvents['on'](_0xb37300,_0xdf12ce);}}; \ No newline at end of file +var _0x6489=['update','emit','removeListener','remove'];(function(_0x53c278,_0x3b3dd1){var _0x2863a8=function(_0xc85ce2){while(--_0xc85ce2){_0x53c278['push'](_0x53c278['shift']());}};_0x2863a8(++_0x3b3dd1);}(_0x6489,0x9f));var _0x9648=function(_0x4cb629,_0x2cd2dd){_0x4cb629=_0x4cb629-0x0;var _0x18bd88=_0x6489[_0x4cb629];return _0x18bd88;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save',_0x9648('0x0'),_0x9648('0x1')];function createListener(_0x39537b,_0x45498c){return function(_0x1247e8){_0x45498c[_0x9648('0x2')](_0x39537b,_0x1247e8);};}function removeListener(_0x50c0da,_0x25df33){return function(){SmsInteractionEvents[_0x9648('0x3')](_0x50c0da,_0x25df33);};}exports['register']=function(_0x2d87ac){for(var _0x4eff2b=0x0,_0x24d3d5=events['length'];_0x4eff2b<_0x24d3d5;_0x4eff2b++){var _0x2cf886=events[_0x4eff2b];var _0x4a7821=createListener('smsInteraction:'+_0x2cf886,_0x2d87ac);SmsInteractionEvents['on'](_0x2cf886,_0x4a7821);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d4e8e80..e6c00b4 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 _0x621a=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x539d03,_0x2b523a){var _0x436e82=function(_0x20b974){while(--_0x20b974){_0x539d03['push'](_0x539d03['shift']());}};_0x436e82(++_0x2b523a);}(_0x621a,0x195));var _0xa621=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x621a[_0x251d9c];return _0x16ae64;};'use strict';var multer=require('multer');var util=require(_0xa621('0x0'));var path=require(_0xa621('0x1'));var timeout=require(_0xa621('0x2'));var express=require(_0xa621('0x3'));var router=express['Router']();var fs_extra=require(_0xa621('0x4'));var auth=require(_0xa621('0x5'));var interaction=require(_0xa621('0x6'));var config=require(_0xa621('0x7'));var controller=require('./smsMessage.controller');router[_0xa621('0x8')]('/',auth[_0xa621('0x9')](),controller['index']);router['get'](_0xa621('0xa'),auth[_0xa621('0x9')](),controller['describe']);router[_0xa621('0x8')](_0xa621('0xb'),auth[_0xa621('0x9')](),controller[_0xa621('0xc')]);router[_0xa621('0xd')]('/',auth['isAuthenticated'](),interaction[_0xa621('0xe')](_0xa621('0xf'),_0xa621('0x10')),controller[_0xa621('0x11')]);router['post'](_0xa621('0x12'),controller['status']);router[_0xa621('0x13')]('/:id',auth[_0xa621('0x9')](),controller['update']);router[_0xa621('0x13')](_0xa621('0x14'),auth['isAuthenticated'](),controller[_0xa621('0x15')]);router['put'](_0xa621('0x16'),auth[_0xa621('0x9')](),controller[_0xa621('0x17')]);router[_0xa621('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xa621('0x19')]);module[_0xa621('0x1a')]=router; \ No newline at end of file +var _0x7d19=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','index','get','/describe','isAuthenticated','describe','show','post','smsmessage:create','create','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer'];(function(_0x162a87,_0x205131){var _0x22e1ff=function(_0x25a859){while(--_0x25a859){_0x162a87['push'](_0x162a87['shift']());}};_0x22e1ff(++_0x205131);}(_0x7d19,0x104));var _0x97d1=function(_0x2efd1d,_0x44f696){_0x2efd1d=_0x2efd1d-0x0;var _0x1ef3f6=_0x7d19[_0x2efd1d];return _0x1ef3f6;};'use strict';var multer=require(_0x97d1('0x0'));var util=require(_0x97d1('0x1'));var path=require(_0x97d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x97d1('0x3'));var router=express[_0x97d1('0x4')]();var fs_extra=require(_0x97d1('0x5'));var auth=require(_0x97d1('0x6'));var interaction=require(_0x97d1('0x7'));var config=require(_0x97d1('0x8'));var controller=require(_0x97d1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x97d1('0xa')]);router[_0x97d1('0xb')](_0x97d1('0xc'),auth[_0x97d1('0xd')](),controller[_0x97d1('0xe')]);router[_0x97d1('0xb')]('/:id',auth[_0x97d1('0xd')](),controller[_0x97d1('0xf')]);router[_0x97d1('0x10')]('/',auth['isAuthenticated'](),interaction['tracked']('sms',_0x97d1('0x11')),controller[_0x97d1('0x12')]);router[_0x97d1('0x10')]('/:id/status',controller[_0x97d1('0x13')]);router[_0x97d1('0x14')](_0x97d1('0x15'),auth[_0x97d1('0xd')](),controller[_0x97d1('0x16')]);router[_0x97d1('0x14')](_0x97d1('0x17'),auth[_0x97d1('0xd')](),controller[_0x97d1('0x18')]);router['put'](_0x97d1('0x19'),auth[_0x97d1('0xd')](),controller[_0x97d1('0x1a')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x97d1('0x1b')]);module[_0x97d1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d76a666..5887923 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 _0xf941=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf941,0x135));var _0x1f94=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf941[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x1f94('0x0'));module[_0x1f94('0x1')]={'body':{'type':Sequelize[_0x1f94('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1f94('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1f94('0x4')]('in',_0x1f94('0x5')),'defaultValue':_0x1f94('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1f94('0x6')](0xbe)},'phone':{'type':Sequelize[_0x1f94('0x6')]},'readAt':{'type':Sequelize[_0x1f94('0x7')]},'secret':{'type':Sequelize[_0x1f94('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1f94('0x6')]},'providerResponse':{'type':Sequelize[_0x1f94('0x2')]}}; \ No newline at end of file +var _0xda7f=['out','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x56cb20,_0x49c5a3){var _0x386cc5=function(_0xc6dc16){while(--_0xc6dc16){_0x56cb20['push'](_0x56cb20['shift']());}};_0x386cc5(++_0x49c5a3);}(_0xda7f,0xc6));var _0xfda7=function(_0x52d238,_0x2c3a58){_0x52d238=_0x52d238-0x0;var _0x51520a=_0xda7f[_0x52d238];return _0x51520a;};'use strict';var Sequelize=require(_0xfda7('0x0'));module['exports']={'body':{'type':Sequelize[_0xfda7('0x1')](_0xfda7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfda7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfda7('0x4')]('in',_0xfda7('0x5')),'defaultValue':_0xfda7('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfda7('0x6')](0xbe)},'phone':{'type':Sequelize[_0xfda7('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xfda7('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 2882610..0a8339a 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 _0x8d6d=['UserId','agent','get','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','RejectMessage','rejectMessage','ContactId','QueryTypes','SELECT','User','fullname','email','internal','interface','format','channel','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','Status','plivio','infobip','groupName','DELIVERED','util','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','./smsMessage.socket','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','json','offset','undefined','limit','count','status','Content-Range','update','destroy','end','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','create','body','describe','accept','sms','acceptMessage'];(function(_0x503c63,_0x2d54e9){var _0x52d6da=function(_0xe604b4){while(--_0xe604b4){_0x503c63['push'](_0x503c63['shift']());}};_0x52d6da(++_0x2d54e9);}(_0x8d6d,0x172));var _0xd8d6=function(_0x25d4dd,_0x214aef){_0x25d4dd=_0x25d4dd-0x0;var _0x2080a5=_0x8d6d[_0x25d4dd];return _0x2080a5;};'use strict';var util=require(_0xd8d6('0x0'));var _=require(_0xd8d6('0x1'));var Redis=require('ioredis');var interactionService=require('../../components/interaction/service');var qs=require(_0xd8d6('0x2'));var logger=require('../../config/logger')(_0xd8d6('0x3'));var config=require(_0xd8d6('0x4'));var db=require(_0xd8d6('0x5'))['db'];config[_0xd8d6('0x6')]=_[_0xd8d6('0x7')](config[_0xd8d6('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8d6('0x6')]));require(_0xd8d6('0x8'))['register'](socket);var jayson=require(_0xd8d6('0x9'));var client=jayson[_0xd8d6('0xa')]['http']({'port':0x232c});var client9002=jayson[_0xd8d6('0xa')][_0xd8d6('0xb')]({'port':0x232a});var interaction_log=require('../../config/logger')('sms-interactions');function respondWithRpcPromise(_0x1f6149,_0x556596,_0x484547,_0x5bb9fb){return new Promise(function(_0x201f52,_0x1f5105){var _0x47c488=_0x5bb9fb||client;return _0x47c488[_0xd8d6('0xc')](_0x1f6149,_0x484547)[_0xd8d6('0xd')](function(_0x3c92a2){logger['info'](_0xd8d6('0xe'),_0x556596,_0xd8d6('0xf'));logger[_0xd8d6('0x10')](_0xd8d6('0x11'),_0x556596,_0xd8d6('0xf'),JSON[_0xd8d6('0x12')](_0x3c92a2));if(_0x3c92a2['error']){if(_0x3c92a2[_0xd8d6('0x13')][_0xd8d6('0x14')]===0x1f4){logger[_0xd8d6('0x13')](_0xd8d6('0xe'),_0x556596,_0x3c92a2[_0xd8d6('0x13')][_0xd8d6('0x15')]);return _0x1f5105(_0x3c92a2[_0xd8d6('0x13')][_0xd8d6('0x15')]);}logger[_0xd8d6('0x13')](_0xd8d6('0xe'),_0x556596,_0x3c92a2[_0xd8d6('0x13')]['message']);return _0x201f52(_0x3c92a2[_0xd8d6('0x13')][_0xd8d6('0x15')]);}else{logger[_0xd8d6('0x16')](_0xd8d6('0xe'),_0x556596,_0xd8d6('0xf'));_0x201f52(_0x3c92a2['result'][_0xd8d6('0x15')]);}})[_0xd8d6('0x17')](function(_0x1aeb12){logger[_0xd8d6('0x13')](_0xd8d6('0xe'),_0x556596,_0x1aeb12);_0x1f5105(_0x1aeb12);});});}function respondWithResult(_0x6b966c,_0x56ec19){_0x56ec19=_0x56ec19||0xc8;return function(_0x3c0b57){if(_0x3c0b57){return _0x6b966c['status'](_0x56ec19)[_0xd8d6('0x18')](_0x3c0b57);}};}function respondWithFilteredResult(_0x304176,_0x2eaaee){return function(_0x15e2f9){if(_0x15e2f9){var _0x29917b=typeof _0x2eaaee[_0xd8d6('0x19')]===_0xd8d6('0x1a')&&typeof _0x2eaaee[_0xd8d6('0x1b')]===_0xd8d6('0x1a');var _0x12df13=_0x15e2f9[_0xd8d6('0x1c')];var _0x2c8f5c=_0x29917b?0x0:_0x2eaaee[_0xd8d6('0x19')];var _0x4fb7eb=_0x29917b?_0x15e2f9[_0xd8d6('0x1c')]:_0x2eaaee['offset']+_0x2eaaee[_0xd8d6('0x1b')];var _0x4f9360;if(_0x4fb7eb>=_0x12df13){_0x4fb7eb=_0x12df13;_0x4f9360=0xc8;}else{_0x4f9360=0xce;}_0x304176[_0xd8d6('0x1d')](_0x4f9360);return _0x304176['set'](_0xd8d6('0x1e'),_0x2c8f5c+'-'+_0x4fb7eb+'/'+_0x12df13)[_0xd8d6('0x18')](_0x15e2f9);}return null;};}function saveUpdates(_0xc7729f){return function(_0x10c4f5){if(_0x10c4f5){return _0x10c4f5[_0xd8d6('0x1f')](_0xc7729f)[_0xd8d6('0xd')](function(_0x39dee9){return _0x39dee9;});}return null;};}function removeEntity(_0x1e1f7b){return function(_0xcb36a3){if(_0xcb36a3){return _0xcb36a3[_0xd8d6('0x20')]()[_0xd8d6('0xd')](function(){_0x1e1f7b[_0xd8d6('0x1d')](0xcc)[_0xd8d6('0x21')]();});}};}function handleEntityNotFound(_0x565355){return function(_0x5aa171){if(!_0x5aa171){_0x565355['sendStatus'](0x194);}return _0x5aa171;};}function handleError(_0xa3be8d,_0x32df6f){_0x32df6f=_0x32df6f||0x1f4;return function(_0xa3c2d6){logger['error'](_0xa3c2d6[_0xd8d6('0x22')]);if(_0xa3c2d6['name']){delete _0xa3c2d6[_0xd8d6('0x23')];}_0xa3be8d[_0xd8d6('0x1d')](_0x32df6f)['send'](_0xa3c2d6);};}exports[_0xd8d6('0x24')]=function(_0x4d724e,_0x570c91){var _0x3090b5={},_0x575eec={},_0x76f841={'count':0x0,'rows':[]};var _0x32c2a1=_[_0xd8d6('0x25')](db[_0xd8d6('0x26')][_0xd8d6('0x27')],function(_0x4cd259){return{'name':_0x4cd259[_0xd8d6('0x28')],'type':_0x4cd259[_0xd8d6('0x29')][_0xd8d6('0x2a')]};});_0x575eec[_0xd8d6('0x2b')]=_[_0xd8d6('0x25')](_0x32c2a1,_0xd8d6('0x23'));_0x575eec[_0xd8d6('0x2c')]=_[_0xd8d6('0x2d')](_0x4d724e['query']);_0x575eec[_0xd8d6('0x2e')]=_[_0xd8d6('0x2f')](_0x575eec['model'],_0x575eec[_0xd8d6('0x2c')]);_0x3090b5['attributes']=_[_0xd8d6('0x2f')](_0x575eec[_0xd8d6('0x2b')],qs[_0xd8d6('0x30')](_0x4d724e[_0xd8d6('0x2c')][_0xd8d6('0x30')]));_0x3090b5[_0xd8d6('0x31')]=_0x3090b5[_0xd8d6('0x31')][_0xd8d6('0x32')]?_0x3090b5[_0xd8d6('0x31')]:_0x575eec[_0xd8d6('0x2b')];if(!_0x4d724e['query'][_0xd8d6('0x33')](_0xd8d6('0x34'))){_0x3090b5[_0xd8d6('0x1b')]=qs['limit'](_0x4d724e[_0xd8d6('0x2c')][_0xd8d6('0x1b')]);_0x3090b5[_0xd8d6('0x19')]=qs['offset'](_0x4d724e[_0xd8d6('0x2c')][_0xd8d6('0x19')]);}_0x3090b5[_0xd8d6('0x35')]=qs['sort'](_0x4d724e['query'][_0xd8d6('0x36')]);_0x3090b5['where']=qs[_0xd8d6('0x2e')](_[_0xd8d6('0x37')](_0x4d724e[_0xd8d6('0x2c')],_0x575eec[_0xd8d6('0x2e')]),_0x32c2a1);if(_0x4d724e[_0xd8d6('0x2c')]['filter']){_0x3090b5[_0xd8d6('0x38')]=_[_0xd8d6('0x39')](_0x3090b5[_0xd8d6('0x38')],{'$or':_[_0xd8d6('0x25')](_0x32c2a1,function(_0x2ac9ea){if(_0x2ac9ea['type']!==_0xd8d6('0x3a')){var _0x2fee0b={};_0x2fee0b[_0x2ac9ea['name']]={'$like':'%'+_0x4d724e[_0xd8d6('0x2c')][_0xd8d6('0x3b')]+'%'};return _0x2fee0b;}})});}_0x3090b5=_[_0xd8d6('0x39')]({},_0x3090b5,_0x4d724e['options']);var _0x4e74a3={'where':_0x3090b5['where']};return db['SmsMessage'][_0xd8d6('0x1c')](_0x4e74a3)[_0xd8d6('0xd')](function(_0x5b9604){_0x76f841['count']=_0x5b9604;if(_0x4d724e[_0xd8d6('0x2c')][_0xd8d6('0x3c')]){_0x3090b5[_0xd8d6('0x3d')]=[{'all':!![]}];}return db['SmsMessage'][_0xd8d6('0x3e')](_0x3090b5);})['then'](function(_0x3bf0f8){_0x76f841[_0xd8d6('0x3f')]=_0x3bf0f8;return _0x76f841;})['then'](respondWithFilteredResult(_0x570c91,_0x3090b5))[_0xd8d6('0x17')](handleError(_0x570c91,null));};exports[_0xd8d6('0x40')]=function(_0x39cec9,_0x13908d){var _0x1512f4={'raw':!![],'where':{'id':_0x39cec9[_0xd8d6('0x41')]['id']}},_0x457b92={};_0x457b92['model']=_['keys'](db[_0xd8d6('0x26')][_0xd8d6('0x27')]);_0x457b92[_0xd8d6('0x2c')]=_[_0xd8d6('0x2d')](_0x39cec9[_0xd8d6('0x2c')]);_0x457b92['filters']=_['intersection'](_0x457b92['model'],_0x457b92[_0xd8d6('0x2c')]);_0x1512f4['attributes']=_[_0xd8d6('0x2f')](_0x457b92[_0xd8d6('0x2b')],qs['fields'](_0x39cec9['query'][_0xd8d6('0x30')]));_0x1512f4[_0xd8d6('0x31')]=_0x1512f4['attributes'][_0xd8d6('0x32')]?_0x1512f4[_0xd8d6('0x31')]:_0x457b92[_0xd8d6('0x2b')];if(_0x39cec9['query'][_0xd8d6('0x3c')]){_0x1512f4[_0xd8d6('0x3d')]=[{'all':!![]}];}_0x1512f4=_[_0xd8d6('0x39')]({},_0x1512f4,_0x39cec9[_0xd8d6('0x42')]);return db['SmsMessage'][_0xd8d6('0x43')](_0x1512f4)['then'](handleEntityNotFound(_0x13908d,null))[_0xd8d6('0xd')](respondWithResult(_0x13908d,null))[_0xd8d6('0x17')](handleError(_0x13908d,null));};exports[_0xd8d6('0x44')]=function(_0x17f6b5,_0x42bfae){return db[_0xd8d6('0x26')][_0xd8d6('0x44')](_0x17f6b5[_0xd8d6('0x45')],{})[_0xd8d6('0xd')](respondWithResult(_0x42bfae,0xc9))[_0xd8d6('0x17')](handleError(_0x42bfae,null));};exports[_0xd8d6('0x1f')]=function(_0x2306a7,_0x1addf9){if(_0x2306a7[_0xd8d6('0x45')]['id']){delete _0x2306a7['body']['id'];}return db[_0xd8d6('0x26')][_0xd8d6('0x43')]({'where':{'id':_0x2306a7['params']['id']}})['then'](handleEntityNotFound(_0x1addf9,null))[_0xd8d6('0xd')](saveUpdates(_0x2306a7['body'],null))['then'](respondWithResult(_0x1addf9,null))[_0xd8d6('0x17')](handleError(_0x1addf9,null));};exports[_0xd8d6('0x20')]=function(_0x482a52,_0x39de20){return db[_0xd8d6('0x26')][_0xd8d6('0x43')]({'where':{'id':_0x482a52[_0xd8d6('0x41')]['id']}})[_0xd8d6('0xd')](handleEntityNotFound(_0x39de20,null))[_0xd8d6('0xd')](removeEntity(_0x39de20,null))['catch'](handleError(_0x39de20,null));};exports[_0xd8d6('0x46')]=function(_0x3843f5,_0x26d566){return db['SmsMessage'][_0xd8d6('0x46')]()[_0xd8d6('0xd')](respondWithResult(_0x26d566,null))[_0xd8d6('0x17')](handleError(_0x26d566,null));};exports[_0xd8d6('0x47')]=function(_0x5094b6,_0xc251d0){var _0x1d5023=_0xd8d6('0x48');return interactionService[_0xd8d6('0x49')](_0x5094b6,_0x1d5023)[_0xd8d6('0xd')](respondWithResult(_0xc251d0,null))[_0xd8d6('0x17')](handleError(_0xc251d0,null));};exports['reject']=function(_0x55c527,_0x4b8a03){var _0xae6eb8={'agent':{},'channel':_0xd8d6('0x48')};if(_0x55c527[_0xd8d6('0x45')]['id']){delete _0x55c527['body']['id'];}_0x55c527[_0xd8d6('0x45')][_0xd8d6('0x4a')]=_0x55c527[_0xd8d6('0x45')]['UserId']||_0x55c527['user']['id'];_0xae6eb8[_0xd8d6('0x4b')]['id']=_0x55c527[_0xd8d6('0x45')][_0xd8d6('0x4a')];return db['SmsMessage'][_0xd8d6('0x43')]({'where':{'id':_0x55c527[_0xd8d6('0x41')]['id'],'UserId':null}})[_0xd8d6('0xd')](handleEntityNotFound(_0x4b8a03,null))[_0xd8d6('0xd')](function(_0x5f0ec6){if(_0x5f0ec6){_0xae6eb8[_0xd8d6('0x15')]=_0x5f0ec6[_0xd8d6('0x4c')]({'plain':!![]});return db['SmsInteraction'][_0xd8d6('0x43')]({'where':{'id':_0x5f0ec6[_0xd8d6('0x4d')]}});}return null;})[_0xd8d6('0xd')](handleEntityNotFound(_0x4b8a03,null))['then'](function(_0x4639c0){if(_0x4639c0){_0xae6eb8[_0xd8d6('0x4e')]=_0x4639c0['get']({'plain':!![]});interaction_log[_0xd8d6('0x16')](_0xd8d6('0x4f'),_0x55c527['user']['id'],_0x55c527[_0xd8d6('0x50')]['name'],_0x55c527[_0xd8d6('0x50')]['role'],_0xae6eb8['interaction']['id'],_0x55c527[_0xd8d6('0x45')]?JSON[_0xd8d6('0x12')](_0x55c527['body']):_0xd8d6('0x51'));return respondWithRpcPromise(_0xd8d6('0x52'),_0xd8d6('0x53'),_0xae6eb8);}return null;})[_0xd8d6('0xd')](function(_0x3c2ff3){var _0x5360d9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c2ff3[_0xd8d6('0x15')][_0xd8d6('0x54')];return db['sequelize']['query'](_0x5360d9,{'type':db['Sequelize'][_0xd8d6('0x55')][_0xd8d6('0x56')],'raw':!![]})[_0xd8d6('0xd')](function(_0x10dc89){return _0x10dc89;});})['then'](function(_0x2e10b8){if(_0x2e10b8){_0xae6eb8['message']['contact']=_0x2e10b8[0x0];if(!_0x55c527['body']['UserId'])return;return db[_0xd8d6('0x57')]['find']({'where':{'id':_0x55c527['body'][_0xd8d6('0x4a')],'role':'agent'},'attributes':['id','name',_0xd8d6('0x58'),_0xd8d6('0x59'),_0xd8d6('0x5a')],'raw':!![]});}return null;})[_0xd8d6('0xd')](function(_0x3aba63){if(!_0x3aba63)return null;_0xae6eb8[_0xd8d6('0x15')][_0xd8d6('0x4b')]=_0x3aba63;return _0xae6eb8;})[_0xd8d6('0xd')](function(_0x2727e5){if(_0x2727e5){_0x2727e5[_0xd8d6('0x15')][_0xd8d6('0x5b')]=util[_0xd8d6('0x5c')]('SIP/%s',_0x55c527[_0xd8d6('0x50')]['name']);_0x2727e5['message'][_0xd8d6('0x5d')]=_0xae6eb8[_0xd8d6('0x5d')];_0x2727e5[_0xd8d6('0x15')]['motionChannel']=_0xae6eb8[_0xd8d6('0x5d')];_0x2727e5['message']['event']='reject';respondWithRpcPromise(_0xd8d6('0x5e'),'EventManager',{'event':_0xd8d6('0x5f'),'message':_0x2727e5[_0xd8d6('0x15')]},client9002);return _0xae6eb8;}return null;})[_0xd8d6('0xd')](respondWithResult(_0x4b8a03,null))[_0xd8d6('0x17')](handleError(_0x4b8a03,null));};exports['status']=function(_0x2a24cd,_0x387d6a){if(_0x2a24cd[_0xd8d6('0x45')]['id']){delete _0x2a24cd[_0xd8d6('0x45')]['id'];}var _0x2b4341;return db['SmsMessage'][_0xd8d6('0x43')]({'where':{'id':_0x2a24cd['params']['id']}})['then'](handleEntityNotFound(_0x387d6a,null))[_0xd8d6('0xd')](function(_0x5a5180){if(_0x5a5180){_0x2b4341=_0x5a5180;return db[_0xd8d6('0x60')]['find']({'where':{'id':_0x5a5180[_0xd8d6('0x61')]}});}})[_0xd8d6('0xd')](handleEntityNotFound(_0x387d6a,null))['then'](function(_0x50d0cc){if(_0x50d0cc){logger[_0xd8d6('0x10')](_0xd8d6('0x11'),'status',_0xd8d6('0x62'),_0x50d0cc['type'],util[_0xd8d6('0x63')](_0x2a24cd['body'],{'showHidden':![],'depth':null}));switch(_0x50d0cc[_0xd8d6('0x29')]){case _0xd8d6('0x64'):if(_0x2a24cd[_0xd8d6('0x45')][_0xd8d6('0x65')]&&_0x2a24cd[_0xd8d6('0x45')][_0xd8d6('0x65')]===_0x2b4341[_0xd8d6('0x66')]){return _0x2b4341['update']({'read':!![]});}else{logger[_0xd8d6('0x13')](_0xd8d6('0x67'),'status',_0xd8d6('0x64'),util['inspect'](_0x2a24cd[_0xd8d6('0x45')],{'showHidden':![],'depth':null}));}break;case _0xd8d6('0x68'):if(_0x2a24cd[_0xd8d6('0x45')][_0xd8d6('0x69')]&&_0x2a24cd[_0xd8d6('0x45')]['MessageUUID']===_0x2b4341[_0xd8d6('0x66')]&&_['indexOf'](['sent','delivered'],_0x2a24cd[_0xd8d6('0x45')][_0xd8d6('0x6a')])>=0x0){return _0x2b4341[_0xd8d6('0x1f')]({'read':!![]});}else{logger['error'](_0xd8d6('0x67'),_0xd8d6('0x1d'),_0xd8d6('0x6b'),util[_0xd8d6('0x63')](_0x2a24cd[_0xd8d6('0x45')],{'showHidden':![],'depth':null}));}break;case _0xd8d6('0x6c'):var _0x49a337=_0x2a24cd[_0xd8d6('0x45')]['results'][0x0];if(_0x49a337[_0xd8d6('0x1d')][_0xd8d6('0x6d')]===_0xd8d6('0x6e')){return _0x2b4341[_0xd8d6('0x1f')]({'read':!![]});}else{logger[_0xd8d6('0x13')](_0xd8d6('0x67'),_0xd8d6('0x1d'),'infobip',util[_0xd8d6('0x63')](_0x2a24cd['body'],{'showHidden':![],'depth':null}));}break;}return _0x2b4341;}})[_0xd8d6('0xd')](respondWithResult(_0x387d6a,null))[_0xd8d6('0x17')](handleError(_0x387d6a,null));}; \ No newline at end of file +var _0x8b4b=['../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','status','json','undefined','limit','count','offset','update','destroy','end','sendStatus','stack','name','index','map','SmsMessage','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','merge','options','include','rows','catch','show','params','find','create','body','describe','accept','sms','acceptMessage','UserId','user','get','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','agent','fullname','internal','interface','format','SIP/%s','channel','reject','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','delivered','Status','infobip','results','groupName','DELIVERED','util','lodash','../../components/interaction/service','../../components/parsers/qs'];(function(_0x5a5dc6,_0x1ad6dd){var _0x4c47b9=function(_0x550e62){while(--_0x550e62){_0x5a5dc6['push'](_0x5a5dc6['shift']());}};_0x4c47b9(++_0x1ad6dd);}(_0x8b4b,0xe0));var _0xb8b4=function(_0x2a2aef,_0x4d93fb){_0x2a2aef=_0x2a2aef-0x0;var _0x5367dd=_0x8b4b[_0x2a2aef];return _0x5367dd;};'use strict';var util=require(_0xb8b4('0x0'));var _=require(_0xb8b4('0x1'));var Redis=require('ioredis');var interactionService=require(_0xb8b4('0x2'));var qs=require(_0xb8b4('0x3'));var logger=require(_0xb8b4('0x4'))(_0xb8b4('0x5'));var config=require(_0xb8b4('0x6'));var db=require(_0xb8b4('0x7'))['db'];config[_0xb8b4('0x8')]=_[_0xb8b4('0x9')](config[_0xb8b4('0x8')],{'host':_0xb8b4('0xa'),'port':0x18eb});var socket=require(_0xb8b4('0xb'))(new Redis(config['redis']));require(_0xb8b4('0xc'))[_0xb8b4('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb8b4('0xe')]['http']({'port':0x232c});var client9002=jayson[_0xb8b4('0xe')]['http']({'port':0x232a});var interaction_log=require('../../config/logger')('sms-interactions');function respondWithRpcPromise(_0x1b2206,_0x193b98,_0x37a5b3,_0x375b50){return new Promise(function(_0x1afae8,_0x51d3eb){var _0x44720c=_0x375b50||client;return _0x44720c[_0xb8b4('0xf')](_0x1b2206,_0x37a5b3)[_0xb8b4('0x10')](function(_0x548b50){logger[_0xb8b4('0x11')]('SmsMessage,\x20%s,\x20%s',_0x193b98,_0xb8b4('0x12'));logger[_0xb8b4('0x13')](_0xb8b4('0x14'),_0x193b98,_0xb8b4('0x12'),JSON[_0xb8b4('0x15')](_0x548b50));if(_0x548b50[_0xb8b4('0x16')]){if(_0x548b50[_0xb8b4('0x16')]['code']===0x1f4){logger[_0xb8b4('0x16')](_0xb8b4('0x17'),_0x193b98,_0x548b50[_0xb8b4('0x16')]['message']);return _0x51d3eb(_0x548b50[_0xb8b4('0x16')][_0xb8b4('0x18')]);}logger[_0xb8b4('0x16')](_0xb8b4('0x17'),_0x193b98,_0x548b50[_0xb8b4('0x16')][_0xb8b4('0x18')]);return _0x1afae8(_0x548b50[_0xb8b4('0x16')]['message']);}else{logger[_0xb8b4('0x11')](_0xb8b4('0x17'),_0x193b98,_0xb8b4('0x12'));_0x1afae8(_0x548b50[_0xb8b4('0x19')]['message']);}})['catch'](function(_0x322f47){logger[_0xb8b4('0x16')](_0xb8b4('0x17'),_0x193b98,_0x322f47);_0x51d3eb(_0x322f47);});});}function respondWithResult(_0x3b130f,_0x118fc6){_0x118fc6=_0x118fc6||0xc8;return function(_0x45fceb){if(_0x45fceb){return _0x3b130f[_0xb8b4('0x1a')](_0x118fc6)[_0xb8b4('0x1b')](_0x45fceb);}};}function respondWithFilteredResult(_0x5df5b2,_0x24dad1){return function(_0x1fee40){if(_0x1fee40){var _0x8a3621=typeof _0x24dad1['offset']===_0xb8b4('0x1c')&&typeof _0x24dad1[_0xb8b4('0x1d')]===_0xb8b4('0x1c');var _0x4f0506=_0x1fee40[_0xb8b4('0x1e')];var _0xfc9d37=_0x8a3621?0x0:_0x24dad1[_0xb8b4('0x1f')];var _0x31ff4a=_0x8a3621?_0x1fee40[_0xb8b4('0x1e')]:_0x24dad1[_0xb8b4('0x1f')]+_0x24dad1['limit'];var _0x200dbe;if(_0x31ff4a>=_0x4f0506){_0x31ff4a=_0x4f0506;_0x200dbe=0xc8;}else{_0x200dbe=0xce;}_0x5df5b2[_0xb8b4('0x1a')](_0x200dbe);return _0x5df5b2['set']('Content-Range',_0xfc9d37+'-'+_0x31ff4a+'/'+_0x4f0506)[_0xb8b4('0x1b')](_0x1fee40);}return null;};}function saveUpdates(_0x153327){return function(_0x40b11e){if(_0x40b11e){return _0x40b11e[_0xb8b4('0x20')](_0x153327)[_0xb8b4('0x10')](function(_0x197253){return _0x197253;});}return null;};}function removeEntity(_0x2574ab){return function(_0x144724){if(_0x144724){return _0x144724[_0xb8b4('0x21')]()[_0xb8b4('0x10')](function(){_0x2574ab[_0xb8b4('0x1a')](0xcc)[_0xb8b4('0x22')]();});}};}function handleEntityNotFound(_0x313d48){return function(_0x4b162b){if(!_0x4b162b){_0x313d48[_0xb8b4('0x23')](0x194);}return _0x4b162b;};}function handleError(_0x1b544a,_0x2168e3){_0x2168e3=_0x2168e3||0x1f4;return function(_0x583488){logger[_0xb8b4('0x16')](_0x583488[_0xb8b4('0x24')]);if(_0x583488['name']){delete _0x583488[_0xb8b4('0x25')];}_0x1b544a[_0xb8b4('0x1a')](_0x2168e3)['send'](_0x583488);};}exports[_0xb8b4('0x26')]=function(_0x114cea,_0x41cd5c){var _0x1a399e={},_0x3e3811={},_0x5503f1={'count':0x0,'rows':[]};var _0xbbf9d3=_[_0xb8b4('0x27')](db[_0xb8b4('0x28')][_0xb8b4('0x29')],function(_0x1db20f){return{'name':_0x1db20f['fieldName'],'type':_0x1db20f['type'][_0xb8b4('0x2a')]};});_0x3e3811[_0xb8b4('0x2b')]=_[_0xb8b4('0x27')](_0xbbf9d3,'name');_0x3e3811[_0xb8b4('0x2c')]=_[_0xb8b4('0x2d')](_0x114cea[_0xb8b4('0x2c')]);_0x3e3811[_0xb8b4('0x2e')]=_['intersection'](_0x3e3811[_0xb8b4('0x2b')],_0x3e3811[_0xb8b4('0x2c')]);_0x1a399e[_0xb8b4('0x2f')]=_[_0xb8b4('0x30')](_0x3e3811['model'],qs[_0xb8b4('0x31')](_0x114cea[_0xb8b4('0x2c')][_0xb8b4('0x31')]));_0x1a399e['attributes']=_0x1a399e[_0xb8b4('0x2f')][_0xb8b4('0x32')]?_0x1a399e[_0xb8b4('0x2f')]:_0x3e3811[_0xb8b4('0x2b')];if(!_0x114cea[_0xb8b4('0x2c')][_0xb8b4('0x33')](_0xb8b4('0x34'))){_0x1a399e[_0xb8b4('0x1d')]=qs[_0xb8b4('0x1d')](_0x114cea[_0xb8b4('0x2c')][_0xb8b4('0x1d')]);_0x1a399e[_0xb8b4('0x1f')]=qs[_0xb8b4('0x1f')](_0x114cea[_0xb8b4('0x2c')][_0xb8b4('0x1f')]);}_0x1a399e[_0xb8b4('0x35')]=qs[_0xb8b4('0x36')](_0x114cea[_0xb8b4('0x2c')][_0xb8b4('0x36')]);_0x1a399e[_0xb8b4('0x37')]=qs['filters'](_[_0xb8b4('0x38')](_0x114cea[_0xb8b4('0x2c')],_0x3e3811[_0xb8b4('0x2e')]),_0xbbf9d3);if(_0x114cea[_0xb8b4('0x2c')]['filter']){_0x1a399e[_0xb8b4('0x37')]=_['merge'](_0x1a399e[_0xb8b4('0x37')],{'$or':_[_0xb8b4('0x27')](_0xbbf9d3,function(_0x4da2ea){if(_0x4da2ea[_0xb8b4('0x39')]!=='VIRTUAL'){var _0x491ebd={};_0x491ebd[_0x4da2ea[_0xb8b4('0x25')]]={'$like':'%'+_0x114cea[_0xb8b4('0x2c')]['filter']+'%'};return _0x491ebd;}})});}_0x1a399e=_[_0xb8b4('0x3a')]({},_0x1a399e,_0x114cea[_0xb8b4('0x3b')]);var _0x405db4={'where':_0x1a399e[_0xb8b4('0x37')]};return db[_0xb8b4('0x28')][_0xb8b4('0x1e')](_0x405db4)['then'](function(_0x2bdd97){_0x5503f1[_0xb8b4('0x1e')]=_0x2bdd97;if(_0x114cea[_0xb8b4('0x2c')]['includeAll']){_0x1a399e[_0xb8b4('0x3c')]=[{'all':!![]}];}return db[_0xb8b4('0x28')]['findAll'](_0x1a399e);})[_0xb8b4('0x10')](function(_0x5e7790){_0x5503f1[_0xb8b4('0x3d')]=_0x5e7790;return _0x5503f1;})['then'](respondWithFilteredResult(_0x41cd5c,_0x1a399e))[_0xb8b4('0x3e')](handleError(_0x41cd5c,null));};exports[_0xb8b4('0x3f')]=function(_0x44e195,_0x47fdd6){var _0x2b5e3b={'raw':!![],'where':{'id':_0x44e195[_0xb8b4('0x40')]['id']}},_0x1c7958={};_0x1c7958[_0xb8b4('0x2b')]=_[_0xb8b4('0x2d')](db[_0xb8b4('0x28')]['rawAttributes']);_0x1c7958[_0xb8b4('0x2c')]=_[_0xb8b4('0x2d')](_0x44e195[_0xb8b4('0x2c')]);_0x1c7958[_0xb8b4('0x2e')]=_[_0xb8b4('0x30')](_0x1c7958[_0xb8b4('0x2b')],_0x1c7958[_0xb8b4('0x2c')]);_0x2b5e3b[_0xb8b4('0x2f')]=_['intersection'](_0x1c7958[_0xb8b4('0x2b')],qs[_0xb8b4('0x31')](_0x44e195['query']['fields']));_0x2b5e3b[_0xb8b4('0x2f')]=_0x2b5e3b[_0xb8b4('0x2f')][_0xb8b4('0x32')]?_0x2b5e3b[_0xb8b4('0x2f')]:_0x1c7958[_0xb8b4('0x2b')];if(_0x44e195['query']['includeAll']){_0x2b5e3b[_0xb8b4('0x3c')]=[{'all':!![]}];}_0x2b5e3b=_[_0xb8b4('0x3a')]({},_0x2b5e3b,_0x44e195[_0xb8b4('0x3b')]);return db[_0xb8b4('0x28')][_0xb8b4('0x41')](_0x2b5e3b)[_0xb8b4('0x10')](handleEntityNotFound(_0x47fdd6,null))[_0xb8b4('0x10')](respondWithResult(_0x47fdd6,null))[_0xb8b4('0x3e')](handleError(_0x47fdd6,null));};exports[_0xb8b4('0x42')]=function(_0x4a8226,_0x1356d7){return db[_0xb8b4('0x28')]['create'](_0x4a8226[_0xb8b4('0x43')],{})['then'](respondWithResult(_0x1356d7,0xc9))[_0xb8b4('0x3e')](handleError(_0x1356d7,null));};exports[_0xb8b4('0x20')]=function(_0x59d999,_0x4075dd){if(_0x59d999[_0xb8b4('0x43')]['id']){delete _0x59d999['body']['id'];}return db[_0xb8b4('0x28')][_0xb8b4('0x41')]({'where':{'id':_0x59d999[_0xb8b4('0x40')]['id']}})['then'](handleEntityNotFound(_0x4075dd,null))[_0xb8b4('0x10')](saveUpdates(_0x59d999['body'],null))[_0xb8b4('0x10')](respondWithResult(_0x4075dd,null))['catch'](handleError(_0x4075dd,null));};exports[_0xb8b4('0x21')]=function(_0x5361d4,_0x3250ab){return db[_0xb8b4('0x28')][_0xb8b4('0x41')]({'where':{'id':_0x5361d4[_0xb8b4('0x40')]['id']}})[_0xb8b4('0x10')](handleEntityNotFound(_0x3250ab,null))['then'](removeEntity(_0x3250ab,null))['catch'](handleError(_0x3250ab,null));};exports[_0xb8b4('0x44')]=function(_0x1bb856,_0x12bce3){return db[_0xb8b4('0x28')][_0xb8b4('0x44')]()[_0xb8b4('0x10')](respondWithResult(_0x12bce3,null))[_0xb8b4('0x3e')](handleError(_0x12bce3,null));};exports[_0xb8b4('0x45')]=function(_0x4a2c61,_0x23d50f){var _0x516cfc=_0xb8b4('0x46');return interactionService[_0xb8b4('0x47')](_0x4a2c61,_0x516cfc)[_0xb8b4('0x10')](respondWithResult(_0x23d50f,null))['catch'](handleError(_0x23d50f,null));};exports['reject']=function(_0x1afbe5,_0xd4679){var _0x4a9407={'agent':{},'channel':_0xb8b4('0x46')};if(_0x1afbe5[_0xb8b4('0x43')]['id']){delete _0x1afbe5[_0xb8b4('0x43')]['id'];}_0x1afbe5[_0xb8b4('0x43')][_0xb8b4('0x48')]=_0x1afbe5['body'][_0xb8b4('0x48')]||_0x1afbe5[_0xb8b4('0x49')]['id'];_0x4a9407['agent']['id']=_0x1afbe5['body'][_0xb8b4('0x48')];return db[_0xb8b4('0x28')][_0xb8b4('0x41')]({'where':{'id':_0x1afbe5['params']['id'],'UserId':null}})[_0xb8b4('0x10')](handleEntityNotFound(_0xd4679,null))[_0xb8b4('0x10')](function(_0x5482ae){if(_0x5482ae){_0x4a9407[_0xb8b4('0x18')]=_0x5482ae[_0xb8b4('0x4a')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x5482ae[_0xb8b4('0x4b')]}});}return null;})['then'](handleEntityNotFound(_0xd4679,null))['then'](function(_0x2b9362){if(_0x2b9362){_0x4a9407[_0xb8b4('0x4c')]=_0x2b9362[_0xb8b4('0x4a')]({'plain':!![]});interaction_log[_0xb8b4('0x11')](_0xb8b4('0x4d'),_0x1afbe5[_0xb8b4('0x49')]['id'],_0x1afbe5['user'][_0xb8b4('0x25')],_0x1afbe5['user'][_0xb8b4('0x4e')],_0x4a9407['interaction']['id'],_0x1afbe5[_0xb8b4('0x43')]?JSON[_0xb8b4('0x15')](_0x1afbe5[_0xb8b4('0x43')]):_0xb8b4('0x4f'));return respondWithRpcPromise(_0xb8b4('0x50'),_0xb8b4('0x51'),_0x4a9407);}return null;})[_0xb8b4('0x10')](function(_0x206246){var _0x183c09=_0xb8b4('0x52')+_0x206246[_0xb8b4('0x18')][_0xb8b4('0x53')];return db[_0xb8b4('0x54')][_0xb8b4('0x2c')](_0x183c09,{'type':db['Sequelize'][_0xb8b4('0x55')][_0xb8b4('0x56')],'raw':!![]})['then'](function(_0x39a756){return _0x39a756;});})[_0xb8b4('0x10')](function(_0x3f80c8){if(_0x3f80c8){_0x4a9407[_0xb8b4('0x18')]['contact']=_0x3f80c8[0x0];if(!_0x1afbe5[_0xb8b4('0x43')][_0xb8b4('0x48')])return;return db[_0xb8b4('0x57')][_0xb8b4('0x41')]({'where':{'id':_0x1afbe5['body'][_0xb8b4('0x48')],'role':_0xb8b4('0x58')},'attributes':['id',_0xb8b4('0x25'),_0xb8b4('0x59'),'email',_0xb8b4('0x5a')],'raw':!![]});}return null;})['then'](function(_0x5f9236){if(!_0x5f9236)return null;_0x4a9407[_0xb8b4('0x18')][_0xb8b4('0x58')]=_0x5f9236;return _0x4a9407;})['then'](function(_0x34c498){if(_0x34c498){_0x34c498[_0xb8b4('0x18')][_0xb8b4('0x5b')]=util[_0xb8b4('0x5c')](_0xb8b4('0x5d'),_0x1afbe5[_0xb8b4('0x49')][_0xb8b4('0x25')]);_0x34c498[_0xb8b4('0x18')][_0xb8b4('0x5e')]=_0x4a9407[_0xb8b4('0x5e')];_0x34c498[_0xb8b4('0x18')]['motionChannel']=_0x4a9407[_0xb8b4('0x5e')];_0x34c498[_0xb8b4('0x18')]['event']=_0xb8b4('0x5f');respondWithRpcPromise(_0xb8b4('0x60'),_0xb8b4('0x60'),{'event':_0xb8b4('0x61'),'message':_0x34c498[_0xb8b4('0x18')]},client9002);return _0x4a9407;}return null;})[_0xb8b4('0x10')](respondWithResult(_0xd4679,null))[_0xb8b4('0x3e')](handleError(_0xd4679,null));};exports[_0xb8b4('0x1a')]=function(_0x2cd40a,_0x6b6bc2){if(_0x2cd40a['body']['id']){delete _0x2cd40a['body']['id'];}var _0x72cee9;return db[_0xb8b4('0x28')][_0xb8b4('0x41')]({'where':{'id':_0x2cd40a[_0xb8b4('0x40')]['id']}})[_0xb8b4('0x10')](handleEntityNotFound(_0x6b6bc2,null))[_0xb8b4('0x10')](function(_0x4a643a){if(_0x4a643a){_0x72cee9=_0x4a643a;return db[_0xb8b4('0x62')][_0xb8b4('0x41')]({'where':{'id':_0x4a643a[_0xb8b4('0x63')]}});}})[_0xb8b4('0x10')](handleEntityNotFound(_0x6b6bc2,null))[_0xb8b4('0x10')](function(_0x2645a1){if(_0x2645a1){logger['debug'](_0xb8b4('0x14'),'status',_0xb8b4('0x64'),_0x2645a1[_0xb8b4('0x39')],util['inspect'](_0x2cd40a['body'],{'showHidden':![],'depth':null}));switch(_0x2645a1['type']){case _0xb8b4('0x65'):if(_0x2cd40a[_0xb8b4('0x43')]['MessageSid']&&_0x2cd40a[_0xb8b4('0x43')]['MessageSid']===_0x72cee9[_0xb8b4('0x66')]){return _0x72cee9[_0xb8b4('0x20')]({'read':!![]});}else{logger[_0xb8b4('0x16')](_0xb8b4('0x67'),_0xb8b4('0x1a'),_0xb8b4('0x65'),util[_0xb8b4('0x68')](_0x2cd40a[_0xb8b4('0x43')],{'showHidden':![],'depth':null}));}break;case _0xb8b4('0x69'):if(_0x2cd40a[_0xb8b4('0x43')][_0xb8b4('0x6a')]&&_0x2cd40a[_0xb8b4('0x43')][_0xb8b4('0x6a')]===_0x72cee9['messageId']&&_[_0xb8b4('0x6b')](['sent',_0xb8b4('0x6c')],_0x2cd40a[_0xb8b4('0x43')][_0xb8b4('0x6d')])>=0x0){return _0x72cee9[_0xb8b4('0x20')]({'read':!![]});}else{logger[_0xb8b4('0x16')](_0xb8b4('0x67'),_0xb8b4('0x1a'),'plivio',util[_0xb8b4('0x68')](_0x2cd40a['body'],{'showHidden':![],'depth':null}));}break;case _0xb8b4('0x6e'):var _0x49d017=_0x2cd40a[_0xb8b4('0x43')][_0xb8b4('0x6f')][0x0];if(_0x49d017[_0xb8b4('0x1a')][_0xb8b4('0x70')]===_0xb8b4('0x71')){return _0x72cee9[_0xb8b4('0x20')]({'read':!![]});}else{logger[_0xb8b4('0x16')](_0xb8b4('0x67'),_0xb8b4('0x1a'),'infobip',util[_0xb8b4('0x68')](_0x2cd40a[_0xb8b4('0x43')],{'showHidden':![],'depth':null}));}break;}return _0x72cee9;}})[_0xb8b4('0x10')](respondWithResult(_0x6b6bc2,null))[_0xb8b4('0x3e')](handleError(_0x6b6bc2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0541d83..d2aba64 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 _0xfb5d=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0xfb5d,0x192));var _0xdfb5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfb5d[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xdfb5('0x0'));var SmsMessage=require(_0xdfb5('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xdfb5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdfb5('0x3'),'afterDestroy':_0xdfb5('0x4')};function emitEvent(_0x29c216){return function(_0x4e156c,_0x244362,_0x3cd38f){SmsMessageEvents[_0xdfb5('0x5')](_0x29c216+':'+_0x4e156c['id'],_0x4e156c);SmsMessageEvents[_0xdfb5('0x5')](_0x29c216,_0x4e156c);_0x3cd38f(null);};}for(var e in events){if(events[_0xdfb5('0x6')](e)){var event=events[e];SmsMessage[_0xdfb5('0x7')](e,emitEvent(event));}}module[_0xdfb5('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x2c63=['SmsMessage','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x2c63,0x134));var _0x32c6=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x2c63[_0x456fb1];return _0x4083d6;};'use strict';var EventEmitter=require(_0x32c6('0x0'));var SmsMessage=require(_0x32c6('0x1'))['db'][_0x32c6('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x32c6('0x3')](0x0);var events={'afterCreate':_0x32c6('0x4'),'afterUpdate':_0x32c6('0x5'),'afterDestroy':_0x32c6('0x6')};function emitEvent(_0x35eabd){return function(_0x8fcdda,_0x5bbd9c,_0xb3d349){SmsMessageEvents['emit'](_0x35eabd+':'+_0x8fcdda['id'],_0x8fcdda);SmsMessageEvents[_0x32c6('0x7')](_0x35eabd,_0x8fcdda);_0xb3d349(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x32c6('0x8')](e,emitEvent(event));}}module[_0x32c6('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 8402b3e..a12d31f 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 _0x4998=['login','timestamp','keys','sort','length','apiKey','md5','digest','/external/get/send.php?','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','clickatell','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','toString','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','/status?token=','token','SmsMessage,\x20%s,\x20%s,\x20%s','error','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto'];(function(_0x202619,_0x1241ea){var _0x1b5e4b=function(_0x1b21bc){while(--_0x1b21bc){_0x202619['push'](_0x202619['shift']());}};_0x1b5e4b(++_0x1241ea);}(_0x4998,0x194));var _0x8499=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x4998[_0x5e4563];return _0x8d1bf5;};'use strict';var _=require(_0x8499('0x0'));var util=require('util');var logger=require(_0x8499('0x1'))(_0x8499('0x2'));var moment=require('moment');var BPromise=require(_0x8499('0x3'));var rp=require(_0x8499('0x4'));var fs=require('fs');var path=require(_0x8499('0x5'));var rimraf=require(_0x8499('0x6'));var config=require(_0x8499('0x7'));var attributes=require(_0x8499('0x8'));module[_0x8499('0x9')]=function(_0x514850,_0x22c8c2){return _0x514850['define'](_0x8499('0xa'),attributes,{'tableName':_0x8499('0xb'),'paranoid':![],'indexes':[{'name':_0x8499('0xc'),'fields':[_0x8499('0xc')]},{'name':_0x8499('0xd'),'fields':[_0x8499('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15f09e,_0x15e680,_0x367dff){var _0x40ff03=_0x514850[_0x8499('0xf')];var _0xb63138=_0x15f09e[_0x8499('0x10')]({'plain':!![]});if(_0xb63138[_0x8499('0x11')][_0x8499('0x12')]()==='in'||_0xb63138['direction'][_0x8499('0x12')]()===_0x8499('0x13')&&!_0xb63138['secret']&&!_['isNil'](_0xb63138[_0x8499('0x14')])&&!_[_0x8499('0x15')](_0xb63138[_0x8499('0x16')])){_0x40ff03[_0x8499('0x17')][_0x8499('0x18')]({'where':{'id':_0xb63138[_0x8499('0x16')]}})[_0x8499('0x19')](function(_0x114332){if(_0x114332){_0x114332[_0x8499('0x1a')]({'lastMsgAt':_0xb63138[_0x8499('0x1b')],'lastMsgDirection':_0xb63138[_0x8499('0x11')][_0x8499('0x12')]()});}})[_0x8499('0x1c')](function(_0x11112d){console['error'](_0x11112d);});}if(_0xb63138[_0x8499('0x11')]==='out'&&!_0xb63138['secret']){var _0x4a43a3;_0x40ff03[_0x8499('0x1d')][_0x8499('0x1e')]({'where':{'id':_0xb63138[_0x8499('0x1f')]},'raw':!![]})['then'](function(_0x5e01f9){_0x4a43a3=_0x5e01f9;if(_0x4a43a3&&_0x4a43a3[_0x8499('0x20')]){switch(_0x4a43a3[_0x8499('0x20')]){case _0x8499('0x21'):var _0x54b044=require(_0x8499('0x21'));if(_0x4a43a3[_0x8499('0x22')]&&_0x4a43a3[_0x8499('0x23')]&&_0x4a43a3[_0x8499('0x24')]){var _0x401304=new _0x54b044(_0x4a43a3[_0x8499('0x22')],_0x4a43a3[_0x8499('0x23')]);_0x401304[_0x8499('0x25')][_0x8499('0x26')]({'body':_0xb63138['body'],'to':_0xb63138[_0x8499('0x24')],'from':_0x4a43a3['phone'],'statusCallback':_0x4a43a3['remote']+_0x8499('0x27')+_0xb63138['id']+_0x8499('0x28')+_0x4a43a3[_0x8499('0x29')]})[_0x8499('0x19')](function(_0x2fb100){if(_0x2fb100['sid']){return _0x15f09e[_0x8499('0x1a')]({'messageId':_0x2fb100['sid']});}})[_0x8499('0x1c')](function(_0x429837){logger['error'](_0x8499('0x2a'),'afterCreate','twilio',util['inspect'](_0x429837,{'showHidden':![],'depth':null}));});}else{logger[_0x8499('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8499('0x2c'),_0x8499('0x21'),_0x8499('0x2d'));}break;case _0x8499('0x2e'):var _0x187f08=_0x8499('0x2f');if(_0x4a43a3[_0x8499('0x30')]&&_0x4a43a3[_0x8499('0x31')]){var _0x1871c3={'recipient':[_0xb63138['phone']],'message':_0xb63138['body'],'message_type':_0x4a43a3['smsMethod']};if(_0x4a43a3[_0x8499('0x32')]&&_0x4a43a3[_0x8499('0x32')]!=='SI'){_0x1871c3[_0x8499('0x33')]=_0x4a43a3[_0x8499('0x24')];}var _0x30359e={'url':_0x187f08+_0x8499('0x34')+_0x4a43a3[_0x8499('0x30')]+_0x8499('0x35')+_0x4a43a3['password'],'method':_0x8499('0x36')};rp(_0x30359e)[_0x8499('0x19')](function(_0x10bfd7){var _0xe8f288=_0x10bfd7[_0x8499('0x37')](';');var _0x2aa27f={'user_key':_0xe8f288[0x0],'session_key':_0xe8f288[0x1]};_0x30359e={'url':_0x187f08+_0x8499('0x38'),'method':'POST','headers':{'user_key':_0x2aa27f[_0x8499('0x39')],'Session_key':_0x2aa27f[_0x8499('0x3a')]},'json':!![],'body':_0x1871c3};return rp(_0x30359e);})['then'](function(_0x3e1ba8){if(_0x3e1ba8[_0x8499('0x3b')]>=0x1){var _0x36dc78={'messageId':_0x3e1ba8[_0x8499('0x3c')]};if(_0x4a43a3[_0x8499('0x32')]!=='GP'||!_0x4a43a3[_0x8499('0x3d')]){_0x36dc78[_0x8499('0x3e')]=!![];}return _0x15f09e[_0x8499('0x1a')](_0x36dc78);}else{return logger['error'](_0x8499('0x2a'),_0x8499('0x2c'),_0x8499('0x2e'),util[_0x8499('0x3f')](_0x3e1ba8,{'showHidden':![],'depth':null}));}})[_0x8499('0x1c')](function(_0x5e7059){return logger['error'](_0x8499('0x2a'),'afterCreate',_0x8499('0x2e'),util['inspect'](_0x5e7059,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8499('0x2a'),'afterCreate',_0x8499('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x8499('0x40'):if(_0x4a43a3[_0x8499('0x23')]){var _0x276bac={'recipient':_0xb63138[_0x8499('0x24')],'message':_0xb63138[_0x8499('0xe')],'sender':_0x4a43a3['senderString']||_0x4a43a3['phone'],'authorization':_0x4a43a3[_0x8499('0x23')]};var _0x15e680={'method':_0x8499('0x41'),'uri':_0x8499('0x42'),'body':_0x276bac,'json':!![]};rp(_0x15e680)[_0x8499('0x19')](function(_0x16266b){var _0x16cccb={'messageId':_0x16266b[_0x8499('0x43')]};if(!_0x4a43a3[_0x8499('0x3d')]){_0x16cccb[_0x8499('0x3e')]=!![];}return _0x15f09e[_0x8499('0x1a')](_0x16cccb);})[_0x8499('0x1c')](function(_0xf78194){logger[_0x8499('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8499('0x2c'),'connectel',util['inspect'](_0xf78194,{'showHidden':![],'depth':null}));});}else{logger[_0x8499('0x2b')](_0x8499('0x2a'),'afterCreate',_0x8499('0x40'),_0x8499('0x44'));}break;case _0x8499('0x45'):if(_0x4a43a3[_0x8499('0x30')]&&_0x4a43a3[_0x8499('0x31')]){var _0x276bac={'messages':[{'source':_0x8499('0x46'),'to':_0xb63138[_0x8499('0x24')],'body':_0xb63138[_0x8499('0xe')],'from':_0x4a43a3[_0x8499('0x47')]||_0x4a43a3[_0x8499('0x24')]}]};var _0xeaf3a=util[_0x8499('0x48')]('%s:%s',_0x4a43a3[_0x8499('0x30')],_0x4a43a3[_0x8499('0x31')]);var _0x15e680={'method':_0x8499('0x41'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x276bac,'headers':{'Authorization':util[_0x8499('0x48')](_0x8499('0x49'),new Buffer(_0xeaf3a)['toString'](_0x8499('0x4a')))},'json':!![]};rp(_0x15e680)[_0x8499('0x19')](function(_0x4bfdd2){if(_0x4bfdd2['http_code']>=0xc8&&_0x4bfdd2[_0x8499('0x4b')]<=0xce){if(_0x4bfdd2[_0x8499('0x4c')]&&_0x4bfdd2['data'][_0x8499('0x4d')]>0x0){var _0x1d9491=_[_0x8499('0x4e')](_0x4bfdd2['data'][_0x8499('0x25')]);var _0x3377ac={'messageId':_0x1d9491[_0x8499('0x4f')]};if(!_0x4a43a3[_0x8499('0x3d')]){_0x3377ac['read']=!![];}return _0x15f09e['update'](_0x3377ac);}else{logger[_0x8499('0x2b')](_0x8499('0x2a'),_0x8499('0x2c'),_0x8499('0x50'),util[_0x8499('0x3f')](_0x4bfdd2,{'showHidden':![],'depth':null}));}}else{logger[_0x8499('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8499('0x50'),util[_0x8499('0x3f')](_0x4bfdd2,{'showHidden':![],'depth':null}));}})[_0x8499('0x1c')](function(_0x3b6a36){logger[_0x8499('0x2b')](_0x8499('0x2a'),_0x8499('0x2c'),'clickSend',util[_0x8499('0x3f')](_0x3b6a36,{'showHidden':![],'depth':null}));});}else{logger[_0x8499('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8499('0x2c'),'clickSend',_0x8499('0x51'));}break;case _0x8499('0x52'):if(_0x4a43a3[_0x8499('0x53')]&&_0x4a43a3[_0x8499('0x23')]){var _0x276bac={'dst':_0xb63138['phone'],'text':_0xb63138[_0x8499('0xe')],'src':_0x4a43a3[_0x8499('0x47')]||_0x4a43a3[_0x8499('0x24')],'url':_0x4a43a3[_0x8499('0x54')]+_0x8499('0x27')+_0xb63138['id']+_0x8499('0x28')+_0x4a43a3[_0x8499('0x29')]};var _0xeaf3a=util['format'](_0x8499('0x55'),_0x4a43a3[_0x8499('0x53')],_0x4a43a3[_0x8499('0x23')]);var _0x15e680={'method':_0x8499('0x41'),'uri':util['format'](_0x8499('0x56'),_0x4a43a3['authId']),'body':_0x276bac,'headers':{'Authorization':util[_0x8499('0x48')](_0x8499('0x49'),new Buffer(_0xeaf3a)['toString'](_0x8499('0x4a')))},'json':!![]};rp(_0x15e680)[_0x8499('0x19')](function(_0x40b888){var _0x4eb7cd={'messageId':_0x40b888[_0x8499('0x57')][0x0]};return _0x15f09e['update'](_0x4eb7cd);})[_0x8499('0x1c')](function(_0x26c8d8){logger[_0x8499('0x2b')](_0x8499('0x2a'),'afterCreate',_0x8499('0x52'),util[_0x8499('0x3f')](_0x26c8d8,{'showHidden':![],'depth':null}));});}else{logger[_0x8499('0x2b')](_0x8499('0x2a'),'afterCreate',_0x8499('0x52'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x4a43a3[_0x8499('0x30')]&&_0x4a43a3[_0x8499('0x31')]){if(_0x4a43a3[_0x8499('0x58')]){var _0x5bac80={'method':_0x8499('0x41'),'uri':_0x4a43a3['baseUrl']+_0x8499('0x59'),'body':{'username':_0x4a43a3['username'],'password':_0x4a43a3[_0x8499('0x31')]},'json':!![]};return rp(_0x5bac80)[_0x8499('0x19')](function(_0x39bb0e){var _0x1dca53={'method':'POST','uri':_0x4a43a3['baseUrl']+_0x8499('0x5a'),'body':{'messages':[{'from':_0x4a43a3['phone'],'destinations':[{'to':_0xb63138[_0x8499('0x24')]}],'text':_0xb63138['body'],'notifyUrl':_0x4a43a3[_0x8499('0x54')]+_0x8499('0x27')+_0xb63138['id']+_0x8499('0x28')+_0x4a43a3[_0x8499('0x29')],'notifyContentType':_0x8499('0x5b'),'callbackData':_0x4a43a3[_0x8499('0x24')]+';'+_0xb63138['body']}]},'headers':{'Authorization':_0x8499('0x5c')+_0x39bb0e['token']},'json':!![]};return rp(_0x1dca53)[_0x8499('0x19')](function(_0x205659){if(_0x205659['messages']){var _0x1af273={'messageId':_0x205659[_0x8499('0x25')][0x0]['messageId']};if(!_0x4a43a3[_0x8499('0x3d')]){_0x1af273[_0x8499('0x3e')]=!![];}return _0x15f09e[_0x8499('0x1a')](_0x1af273);}else{return logger[_0x8499('0x2b')](_0x8499('0x2a'),_0x8499('0x2c'),'infobip',util[_0x8499('0x3f')](_0x205659,{'showHidden':![],'depth':null}));}});})[_0x8499('0x1c')](function(_0x3b4f37){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8499('0x2c'),_0x8499('0x5d'),util['inspect'](_0x3b4f37,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8499('0x2a'),_0x8499('0x2c'),_0x8499('0x5d'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x8499('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8499('0x2c'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x8499('0x5e'):var _0x4320bd=require(_0x8499('0x5f'));if(_0x4a43a3['apiKey']){var _0x3341ea={};_0x3341ea[_0x8499('0x60')]=_0x4a43a3[_0x8499('0x30')];_0x3341ea[_0x8499('0x24')]=_0xb63138[_0x8499('0x24')];_0x3341ea[_0x8499('0x33')]=_0x4a43a3[_0x8499('0x24')];_0x3341ea['text']=_0xb63138[_0x8499('0xe')];_0x3341ea[_0x8499('0x61')]=+new Date();var _0x24a75e='';var _0x42bd6e='';var _0x55440b=Object[_0x8499('0x62')](_0x3341ea);_0x55440b[_0x8499('0x63')]();for(var _0x5baef9=0x0;_0x5baef9<_0x55440b[_0x8499('0x64')];_0x5baef9++){if(_0x24a75e!=''){_0x24a75e+='&';}_0x24a75e+=_0x55440b[_0x5baef9]+'='+encodeURIComponent(_0x3341ea[_0x55440b[_0x5baef9]]);_0x42bd6e+=_0x3341ea[_0x55440b[_0x5baef9]];}_0x42bd6e+=_0x4a43a3[_0x8499('0x65')];_0x42bd6e=_0x4320bd['createHash'](_0x8499('0x66'))[_0x8499('0x1a')](_0x42bd6e)[_0x8499('0x67')]('hex');if(_0x24a75e!==''){_0x24a75e+='&';}_0x24a75e+='signature='+_0x42bd6e;var _0x30359e={'method':_0x8499('0x36'),'uri':_0x4a43a3[_0x8499('0x58')]+_0x8499('0x68')+_0x24a75e,'json':!![]};return rp(_0x30359e)[_0x8499('0x19')](function(_0x402a62){var _0x29e375=Object[_0x8499('0x62')](_0x402a62);if(_0x402a62[_0x29e375[0x0]][_0x8499('0x2b')]&&parseInt(_0x402a62[_0x29e375[0x0]][_0x8499('0x2b')])===0x0){var _0x45047e={'messageId':_0x402a62[_0x29e375[0x0]]['id_sms']};if(!_0x4a43a3['deliveryReport']){_0x45047e[_0x8499('0x3e')]=!![];}return _0x15f09e[_0x8499('0x1a')](_0x45047e);}else{return logger[_0x8499('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8499('0x2c'),_0x8499('0x5e'),util['inspect'](_0x402a62[_0x8499('0x2b')],{'showHidden':![],'depth':null}));}})[_0x8499('0x1c')](function(_0x3dfcda){return logger['error'](_0x8499('0x2a'),_0x8499('0x2c'),'csc',util[_0x8499('0x3f')](_0x3dfcda,{'showHidden':![],'depth':null}));});}else{logger[_0x8499('0x2b')](_0x8499('0x2a'),_0x8499('0x2c'),_0x8499('0x5e'),_0x8499('0x69'));}break;case'clickatell':if(_0x4a43a3[_0x8499('0x65')]){var _0x54ec74={'method':_0x8499('0x41'),'uri':_0x8499('0x6a'),'headers':{'Authorization':_0x4a43a3['apiKey']},'body':{'content':_0xb63138[_0x8499('0xe')],'to':[_0xb63138[_0x8499('0x24')]],'from':_0x4a43a3[_0x8499('0x24')],'binary':![],'clientMessageId':'uuid','charset':_0x8499('0x6b')},'json':!![]};rp(_0x54ec74)[_0x8499('0x19')](function(_0xdd4b50){if(!_0xdd4b50[_0x8499('0x2b')]){var _0x55936c={'messageId':_0xdd4b50[_0x8499('0x25')][0x0]['apiMessageId']};if(!_0x4a43a3['deliveryReport']){_0x55936c['read']=!![];}return _0x15f09e[_0x8499('0x1a')](_0x55936c);}else{return logger[_0x8499('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8499('0x6c'),util[_0x8499('0x3f')](_0xdd4b50['error'],{'showHidden':![],'depth':null}));}})[_0x8499('0x1c')](function(_0x3bcda6){return logger[_0x8499('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8499('0x2c'),_0x8499('0x6c'),util[_0x8499('0x3f')](_0x3bcda6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8499('0x2a'),_0x8499('0x2c'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x4a43a3[_0x8499('0x30')]&&_0x4a43a3[_0x8499('0x31')]){var _0xeaf3a=util[_0x8499('0x48')](_0x8499('0x55'),_0x4a43a3[_0x8499('0x30')],_0x4a43a3[_0x8499('0x31')]);var _0x15e680={'method':_0x8499('0x41'),'uri':_0x8499('0x6d')+_0x4a43a3[_0x8499('0x6e')]+_0x8499('0x6f'),'body':{'to':[_0xb63138['phone']],'text':_0xb63138[_0x8499('0xe')],'from':_0x4a43a3[_0x8499('0x24')],'applicationId':_0x4a43a3[_0x8499('0x70')]},'headers':{'Authorization':util[_0x8499('0x48')]('Basic\x20%s',new Buffer(_0xeaf3a)[_0x8499('0x71')](_0x8499('0x4a')))},'json':!![]};rp(_0x15e680)[_0x8499('0x19')](function(_0x251dee){if(_0x251dee['id']){var _0x204406={'messageId':_0x251dee['id']};return _0x15f09e[_0x8499('0x1a')](_0x204406);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8499('0x2c'),_0x8499('0x72'),util[_0x8499('0x3f')](_0x251dee,{'showHidden':![],'depth':null}));}})[_0x8499('0x1c')](function(_0x1c535a){logger[_0x8499('0x2b')](_0x8499('0x2a'),'afterCreate',_0x8499('0x72'),util[_0x8499('0x3f')](_0x1c535a,{'showHidden':![],'depth':null}));});}else{logger[_0x8499('0x2b')](_0x8499('0x2a'),'afterCreate',_0x8499('0x72'),_0x8499('0x51'));}break;case _0x8499('0x73'):if(_0x4a43a3['apiKey']){var _0x16232e={};var _0x30359e={'method':_0x8499('0x41'),'uri':_0x8499('0x74'),'headers':{'Authorization':'Bearer\x20'+_0x4a43a3[_0x8499('0x65')],'Content-Type':_0x8499('0x5b')},'body':{'from':_0x4a43a3[_0x8499('0x24')],'to':_0xb63138[_0x8499('0x24')],'text':_0xb63138[_0x8499('0xe')]},'json':!![]};return rp(_0x30359e)['then'](function(_0x2f393d){if(_0x2f393d[_0x8499('0x75')]==0xca){_0x16232e['message']=_0x2f393d;var _0x50e01f={'method':_0x8499('0x41'),'uri':_0x8499('0x76'),'headers':{'Authorization':'Bearer\x20'+_0x4a43a3[_0x8499('0x65')],'Content-Type':_0x8499('0x5b')},'body':{'refid':_0x16232e['message'][_0x8499('0x77')]},'json':!![]};return rp(_0x50e01f)[_0x8499('0x19')](function(_0x20e755){_0x16232e[_0x8499('0x78')]=_0x20e755;var _0x5e04b8={'messageId':_0x16232e['message'][_0x8499('0x77')],'read':!![]};return _0x15f09e[_0x8499('0x1a')](_0x5e04b8);});}else{return logger[_0x8499('0x2b')](_0x8499('0x2a'),_0x8499('0x2c'),_0x8499('0x73'),util[_0x8499('0x3f')](_0x2f393d,{'showHidden':![],'depth':null}));}})[_0x8499('0x1c')](function(_0xbd4019){return logger[_0x8499('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x8499('0x3f')](_0xbd4019,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x8499('0x2a'),'afterCreate',_0x8499('0x73'),_0x8499('0x79'));}break;}}})[_0x8499('0x7a')](function(){_0x367dff();});}else{_0x367dff();}}},'charset':_0x8499('0x7b'),'collate':_0x8499('0x7c')});}; \ No newline at end of file +var _0x1b38=['error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','csc','crypto','login','text','timestamp','keys','sort','length','apiKey','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','Missing\x20parameters:\x20apiKey','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid'];(function(_0x5ca1bf,_0x17ccc9){var _0x4bfd3b=function(_0x2b8752){while(--_0x2b8752){_0x5ca1bf['push'](_0x5ca1bf['shift']());}};_0x4bfd3b(++_0x17ccc9);}(_0x1b38,0x14b));var _0x81b3=function(_0x31f739,_0x468cf6){_0x31f739=_0x31f739-0x0;var _0x3d0ac1=_0x1b38[_0x31f739];return _0x3d0ac1;};'use strict';var _=require(_0x81b3('0x0'));var util=require(_0x81b3('0x1'));var logger=require(_0x81b3('0x2'))(_0x81b3('0x3'));var moment=require('moment');var BPromise=require(_0x81b3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81b3('0x5'));var rimraf=require(_0x81b3('0x6'));var config=require(_0x81b3('0x7'));var attributes=require(_0x81b3('0x8'));module[_0x81b3('0x9')]=function(_0x17c979,_0x448a97){return _0x17c979[_0x81b3('0xa')](_0x81b3('0xb'),attributes,{'tableName':_0x81b3('0xc'),'paranoid':![],'indexes':[{'name':_0x81b3('0xd'),'fields':[_0x81b3('0xd')]},{'name':_0x81b3('0xe'),'fields':[_0x81b3('0xf')],'type':_0x81b3('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e7c26,_0x1274c4,_0x4e9d1e){var _0x1dd934=_0x17c979['models'];var _0xc62d31=_0x4e7c26[_0x81b3('0x11')]({'plain':!![]});if(_0xc62d31[_0x81b3('0x12')][_0x81b3('0x13')]()==='in'||_0xc62d31[_0x81b3('0x12')][_0x81b3('0x13')]()===_0x81b3('0x14')&&!_0xc62d31[_0x81b3('0x15')]&&!_[_0x81b3('0x16')](_0xc62d31[_0x81b3('0x17')])&&!_[_0x81b3('0x16')](_0xc62d31['SmsInteractionId'])){_0x1dd934[_0x81b3('0x18')][_0x81b3('0x19')]({'where':{'id':_0xc62d31['SmsInteractionId']}})[_0x81b3('0x1a')](function(_0x31c108){if(_0x31c108){_0x31c108[_0x81b3('0x1b')]({'lastMsgAt':_0xc62d31[_0x81b3('0x1c')],'lastMsgDirection':_0xc62d31['direction']['toLowerCase']()});}})[_0x81b3('0x1d')](function(_0x4e838d){console['error'](_0x4e838d);});}if(_0xc62d31[_0x81b3('0x12')]===_0x81b3('0x14')&&!_0xc62d31[_0x81b3('0x15')]){var _0x8a4838;_0x1dd934['SmsAccount'][_0x81b3('0x1e')]({'where':{'id':_0xc62d31[_0x81b3('0x1f')]},'raw':!![]})[_0x81b3('0x1a')](function(_0x5b5e75){_0x8a4838=_0x5b5e75;if(_0x8a4838&&_0x8a4838[_0x81b3('0x20')]){switch(_0x8a4838[_0x81b3('0x20')]){case'twilio':var _0x692f7=require(_0x81b3('0x21'));if(_0x8a4838['accountSid']&&_0x8a4838['authToken']&&_0x8a4838['phone']){var _0x35534c=new _0x692f7(_0x8a4838[_0x81b3('0x22')],_0x8a4838[_0x81b3('0x23')]);_0x35534c[_0x81b3('0x24')][_0x81b3('0x25')]({'body':_0xc62d31[_0x81b3('0xf')],'to':_0xc62d31['phone'],'from':_0x8a4838[_0x81b3('0x26')],'statusCallback':_0x8a4838[_0x81b3('0x27')]+_0x81b3('0x28')+_0xc62d31['id']+_0x81b3('0x29')+_0x8a4838[_0x81b3('0x2a')]})['then'](function(_0x3f0fb8){if(_0x3f0fb8[_0x81b3('0x2b')]){return _0x4e7c26[_0x81b3('0x1b')]({'messageId':_0x3f0fb8['sid']});}})['catch'](function(_0xaa627a){logger[_0x81b3('0x2c')](_0x81b3('0x2d'),_0x81b3('0x2e'),'twilio',util[_0x81b3('0x2f')](_0xaa627a,{'showHidden':![],'depth':null}));});}else{logger[_0x81b3('0x2c')](_0x81b3('0x2d'),_0x81b3('0x2e'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x81b3('0x30'):var _0x39946c=_0x81b3('0x31');if(_0x8a4838[_0x81b3('0x32')]&&_0x8a4838['password']){var _0xa84e7d={'recipient':[_0xc62d31[_0x81b3('0x26')]],'message':_0xc62d31['body'],'message_type':_0x8a4838[_0x81b3('0x33')]};if(_0x8a4838[_0x81b3('0x33')]&&_0x8a4838[_0x81b3('0x33')]!=='SI'){_0xa84e7d[_0x81b3('0x34')]=_0x8a4838['phone'];}var _0x205690={'url':_0x39946c+_0x81b3('0x35')+_0x8a4838[_0x81b3('0x32')]+_0x81b3('0x36')+_0x8a4838[_0x81b3('0x37')],'method':_0x81b3('0x38')};rp(_0x205690)['then'](function(_0x42813a){var _0x25dda2=_0x42813a['split'](';');var _0x4c2f75={'user_key':_0x25dda2[0x0],'session_key':_0x25dda2[0x1]};_0x205690={'url':_0x39946c+_0x81b3('0x39'),'method':_0x81b3('0x3a'),'headers':{'user_key':_0x4c2f75[_0x81b3('0x3b')],'Session_key':_0x4c2f75[_0x81b3('0x3c')]},'json':!![],'body':_0xa84e7d};return rp(_0x205690);})[_0x81b3('0x1a')](function(_0x51f76e){if(_0x51f76e[_0x81b3('0x3d')]>=0x1){var _0x469307={'messageId':_0x51f76e[_0x81b3('0x3e')]};if(_0x8a4838[_0x81b3('0x33')]!=='GP'||!_0x8a4838[_0x81b3('0x3f')]){_0x469307[_0x81b3('0x40')]=!![];}return _0x4e7c26['update'](_0x469307);}else{return logger[_0x81b3('0x2c')](_0x81b3('0x2d'),_0x81b3('0x2e'),_0x81b3('0x30'),util[_0x81b3('0x2f')](_0x51f76e,{'showHidden':![],'depth':null}));}})[_0x81b3('0x1d')](function(_0x39cd99){return logger[_0x81b3('0x2c')](_0x81b3('0x2d'),_0x81b3('0x2e'),_0x81b3('0x30'),util[_0x81b3('0x2f')](_0x39cd99,{'showHidden':![],'depth':null}));});}else{logger[_0x81b3('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x81b3('0x2e'),_0x81b3('0x30'),_0x81b3('0x41'));}break;case _0x81b3('0x42'):if(_0x8a4838['authToken']){var _0x45a714={'recipient':_0xc62d31[_0x81b3('0x26')],'message':_0xc62d31[_0x81b3('0xf')],'sender':_0x8a4838['senderString']||_0x8a4838[_0x81b3('0x26')],'authorization':_0x8a4838[_0x81b3('0x23')]};var _0x1274c4={'method':_0x81b3('0x3a'),'uri':_0x81b3('0x43'),'body':_0x45a714,'json':!![]};rp(_0x1274c4)[_0x81b3('0x1a')](function(_0x3ae670){var _0x825be0={'messageId':_0x3ae670['requestid']};if(!_0x8a4838[_0x81b3('0x3f')]){_0x825be0[_0x81b3('0x40')]=!![];}return _0x4e7c26['update'](_0x825be0);})['catch'](function(_0x14590b){logger[_0x81b3('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x81b3('0x2e'),_0x81b3('0x42'),util['inspect'](_0x14590b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x81b3('0x2d'),_0x81b3('0x2e'),_0x81b3('0x42'),_0x81b3('0x44'));}break;case _0x81b3('0x45'):if(_0x8a4838[_0x81b3('0x32')]&&_0x8a4838[_0x81b3('0x37')]){var _0x45a714={'messages':[{'source':_0x81b3('0x46'),'to':_0xc62d31[_0x81b3('0x26')],'body':_0xc62d31[_0x81b3('0xf')],'from':_0x8a4838[_0x81b3('0x47')]||_0x8a4838['phone']}]};var _0x2a706a=util[_0x81b3('0x48')](_0x81b3('0x49'),_0x8a4838[_0x81b3('0x32')],_0x8a4838[_0x81b3('0x37')]);var _0x1274c4={'method':'POST','uri':_0x81b3('0x4a'),'body':_0x45a714,'headers':{'Authorization':util[_0x81b3('0x48')](_0x81b3('0x4b'),new Buffer(_0x2a706a)[_0x81b3('0x4c')](_0x81b3('0x4d')))},'json':!![]};rp(_0x1274c4)[_0x81b3('0x1a')](function(_0x54d243){if(_0x54d243[_0x81b3('0x4e')]>=0xc8&&_0x54d243[_0x81b3('0x4e')]<=0xce){if(_0x54d243[_0x81b3('0x4f')]&&_0x54d243[_0x81b3('0x4f')][_0x81b3('0x50')]>0x0){var _0x468a19=_[_0x81b3('0x51')](_0x54d243[_0x81b3('0x4f')][_0x81b3('0x24')]);var _0x255dce={'messageId':_0x468a19[_0x81b3('0x52')]};if(!_0x8a4838['deliveryReport']){_0x255dce[_0x81b3('0x40')]=!![];}return _0x4e7c26['update'](_0x255dce);}else{logger[_0x81b3('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x81b3('0x2e'),'clickSend',util['inspect'](_0x54d243,{'showHidden':![],'depth':null}));}}else{logger[_0x81b3('0x2c')](_0x81b3('0x2d'),'afterCreate',_0x81b3('0x53'),util[_0x81b3('0x2f')](_0x54d243,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4c8f06){logger[_0x81b3('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x81b3('0x2e'),'clickSend',util[_0x81b3('0x2f')](_0x4c8f06,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x81b3('0x2d'),'afterCreate',_0x81b3('0x53'),_0x81b3('0x41'));}break;case'plivo':if(_0x8a4838[_0x81b3('0x54')]&&_0x8a4838['authToken']){var _0x45a714={'dst':_0xc62d31[_0x81b3('0x26')],'text':_0xc62d31[_0x81b3('0xf')],'src':_0x8a4838[_0x81b3('0x47')]||_0x8a4838[_0x81b3('0x26')],'url':_0x8a4838[_0x81b3('0x27')]+_0x81b3('0x28')+_0xc62d31['id']+_0x81b3('0x29')+_0x8a4838['token']};var _0x2a706a=util[_0x81b3('0x48')](_0x81b3('0x49'),_0x8a4838[_0x81b3('0x54')],_0x8a4838['authToken']);var _0x1274c4={'method':'POST','uri':util['format'](_0x81b3('0x55'),_0x8a4838[_0x81b3('0x54')]),'body':_0x45a714,'headers':{'Authorization':util['format'](_0x81b3('0x4b'),new Buffer(_0x2a706a)[_0x81b3('0x4c')](_0x81b3('0x4d')))},'json':!![]};rp(_0x1274c4)[_0x81b3('0x1a')](function(_0x59ca5e){var _0x387008={'messageId':_0x59ca5e[_0x81b3('0x56')][0x0]};return _0x4e7c26['update'](_0x387008);})[_0x81b3('0x1d')](function(_0x529af9){logger[_0x81b3('0x2c')](_0x81b3('0x2d'),_0x81b3('0x2e'),_0x81b3('0x57'),util[_0x81b3('0x2f')](_0x529af9,{'showHidden':![],'depth':null}));});}else{logger[_0x81b3('0x2c')](_0x81b3('0x2d'),'afterCreate',_0x81b3('0x57'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x81b3('0x58'):if(_0x8a4838[_0x81b3('0x32')]&&_0x8a4838[_0x81b3('0x37')]){if(_0x8a4838[_0x81b3('0x59')]){var _0x58b52d={'method':_0x81b3('0x3a'),'uri':_0x8a4838['baseUrl']+_0x81b3('0x5a'),'body':{'username':_0x8a4838[_0x81b3('0x32')],'password':_0x8a4838[_0x81b3('0x37')]},'json':!![]};return rp(_0x58b52d)[_0x81b3('0x1a')](function(_0x2a8497){var _0x3c56a6={'method':_0x81b3('0x3a'),'uri':_0x8a4838[_0x81b3('0x59')]+_0x81b3('0x5b'),'body':{'messages':[{'from':_0x8a4838[_0x81b3('0x26')],'destinations':[{'to':_0xc62d31[_0x81b3('0x26')]}],'text':_0xc62d31[_0x81b3('0xf')],'notifyUrl':_0x8a4838[_0x81b3('0x27')]+_0x81b3('0x28')+_0xc62d31['id']+_0x81b3('0x29')+_0x8a4838[_0x81b3('0x2a')],'notifyContentType':_0x81b3('0x5c'),'callbackData':_0x8a4838['phone']+';'+_0xc62d31[_0x81b3('0xf')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x2a8497[_0x81b3('0x2a')]},'json':!![]};return rp(_0x3c56a6)[_0x81b3('0x1a')](function(_0x113f46){if(_0x113f46[_0x81b3('0x24')]){var _0x1bcc39={'messageId':_0x113f46[_0x81b3('0x24')][0x0][_0x81b3('0xd')]};if(!_0x8a4838[_0x81b3('0x3f')]){_0x1bcc39['read']=!![];}return _0x4e7c26[_0x81b3('0x1b')](_0x1bcc39);}else{return logger[_0x81b3('0x2c')](_0x81b3('0x2d'),_0x81b3('0x2e'),_0x81b3('0x58'),util[_0x81b3('0x2f')](_0x113f46,{'showHidden':![],'depth':null}));}});})[_0x81b3('0x1d')](function(_0x2a8539){return logger[_0x81b3('0x2c')](_0x81b3('0x2d'),'afterCreate',_0x81b3('0x58'),util[_0x81b3('0x2f')](_0x2a8539,{'showHidden':![],'depth':null}));});}else{logger[_0x81b3('0x2c')](_0x81b3('0x2d'),_0x81b3('0x2e'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x81b3('0x2d'),_0x81b3('0x2e'),_0x81b3('0x58'),_0x81b3('0x41'));}break;case _0x81b3('0x5d'):var _0xac86de=require(_0x81b3('0x5e'));if(_0x8a4838['apiKey']){var _0x46b01a={};_0x46b01a[_0x81b3('0x5f')]=_0x8a4838[_0x81b3('0x32')];_0x46b01a['phone']=_0xc62d31[_0x81b3('0x26')];_0x46b01a[_0x81b3('0x34')]=_0x8a4838[_0x81b3('0x26')];_0x46b01a[_0x81b3('0x60')]=_0xc62d31[_0x81b3('0xf')];_0x46b01a[_0x81b3('0x61')]=+new Date();var _0x2a1332='';var _0x3d08fc='';var _0x3534d9=Object[_0x81b3('0x62')](_0x46b01a);_0x3534d9[_0x81b3('0x63')]();for(var _0x922d2b=0x0;_0x922d2b<_0x3534d9[_0x81b3('0x64')];_0x922d2b++){if(_0x2a1332!=''){_0x2a1332+='&';}_0x2a1332+=_0x3534d9[_0x922d2b]+'='+encodeURIComponent(_0x46b01a[_0x3534d9[_0x922d2b]]);_0x3d08fc+=_0x46b01a[_0x3534d9[_0x922d2b]];}_0x3d08fc+=_0x8a4838[_0x81b3('0x65')];_0x3d08fc=_0xac86de[_0x81b3('0x66')](_0x81b3('0x67'))[_0x81b3('0x1b')](_0x3d08fc)[_0x81b3('0x68')](_0x81b3('0x69'));if(_0x2a1332!==''){_0x2a1332+='&';}_0x2a1332+=_0x81b3('0x6a')+_0x3d08fc;var _0x205690={'method':_0x81b3('0x38'),'uri':_0x8a4838[_0x81b3('0x59')]+_0x81b3('0x6b')+_0x2a1332,'json':!![]};return rp(_0x205690)[_0x81b3('0x1a')](function(_0x898b43){var _0x3a8329=Object[_0x81b3('0x62')](_0x898b43);if(_0x898b43[_0x3a8329[0x0]][_0x81b3('0x2c')]&&parseInt(_0x898b43[_0x3a8329[0x0]]['error'])===0x0){var _0x5181b3={'messageId':_0x898b43[_0x3a8329[0x0]][_0x81b3('0x6c')]};if(!_0x8a4838[_0x81b3('0x3f')]){_0x5181b3[_0x81b3('0x40')]=!![];}return _0x4e7c26[_0x81b3('0x1b')](_0x5181b3);}else{return logger['error'](_0x81b3('0x2d'),_0x81b3('0x2e'),_0x81b3('0x5d'),util[_0x81b3('0x2f')](_0x898b43['error'],{'showHidden':![],'depth':null}));}})[_0x81b3('0x1d')](function(_0x3df90b){return logger[_0x81b3('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x81b3('0x5d'),util['inspect'](_0x3df90b,{'showHidden':![],'depth':null}));});}else{logger[_0x81b3('0x2c')](_0x81b3('0x2d'),_0x81b3('0x2e'),_0x81b3('0x5d'),'Missing\x20parameters:\x20apiKey');}break;case _0x81b3('0x6d'):if(_0x8a4838['apiKey']){var _0x82c3c3={'method':_0x81b3('0x3a'),'uri':_0x81b3('0x6e'),'headers':{'Authorization':_0x8a4838['apiKey']},'body':{'content':_0xc62d31[_0x81b3('0xf')],'to':[_0xc62d31[_0x81b3('0x26')]],'from':_0x8a4838[_0x81b3('0x26')],'binary':![],'clientMessageId':_0x81b3('0x6f'),'charset':_0x81b3('0x70')},'json':!![]};rp(_0x82c3c3)[_0x81b3('0x1a')](function(_0x14c575){if(!_0x14c575[_0x81b3('0x2c')]){var _0x4f2902={'messageId':_0x14c575[_0x81b3('0x24')][0x0]['apiMessageId']};if(!_0x8a4838['deliveryReport']){_0x4f2902['read']=!![];}return _0x4e7c26['update'](_0x4f2902);}else{return logger[_0x81b3('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x81b3('0x2e'),_0x81b3('0x6d'),util['inspect'](_0x14c575['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3e6ca2){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x81b3('0x2e'),_0x81b3('0x6d'),util['inspect'](_0x3e6ca2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x81b3('0x2d'),_0x81b3('0x2e'),'clickatell',_0x81b3('0x71'));}break;case'bandwidth':if(_0x8a4838[_0x81b3('0x32')]&&_0x8a4838[_0x81b3('0x37')]){var _0x2a706a=util[_0x81b3('0x48')]('%s:%s',_0x8a4838[_0x81b3('0x32')],_0x8a4838[_0x81b3('0x37')]);var _0x1274c4={'method':_0x81b3('0x3a'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x8a4838['accountId']+'/messages','body':{'to':[_0xc62d31[_0x81b3('0x26')]],'text':_0xc62d31[_0x81b3('0xf')],'from':_0x8a4838[_0x81b3('0x26')],'applicationId':_0x8a4838['applicationId']},'headers':{'Authorization':util[_0x81b3('0x48')](_0x81b3('0x4b'),new Buffer(_0x2a706a)['toString'](_0x81b3('0x4d')))},'json':!![]};rp(_0x1274c4)[_0x81b3('0x1a')](function(_0x4e2960){if(_0x4e2960['id']){var _0x5e6659={'messageId':_0x4e2960['id']};return _0x4e7c26[_0x81b3('0x1b')](_0x5e6659);}else{logger['error'](_0x81b3('0x2d'),_0x81b3('0x2e'),'bandwidth',util[_0x81b3('0x2f')](_0x4e2960,{'showHidden':![],'depth':null}));}})[_0x81b3('0x1d')](function(_0x5cb2bf){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x81b3('0x2e'),_0x81b3('0x72'),util[_0x81b3('0x2f')](_0x5cb2bf,{'showHidden':![],'depth':null}));});}else{logger[_0x81b3('0x2c')](_0x81b3('0x2d'),'afterCreate',_0x81b3('0x72'),_0x81b3('0x41'));}break;case _0x81b3('0x73'):if(_0x8a4838[_0x81b3('0x65')]){var _0xb8dc69={};var _0x205690={'method':'POST','uri':_0x81b3('0x74'),'headers':{'Authorization':_0x81b3('0x75')+_0x8a4838['apiKey'],'Content-Type':_0x81b3('0x5c')},'body':{'from':_0x8a4838[_0x81b3('0x26')],'to':_0xc62d31['phone'],'text':_0xc62d31[_0x81b3('0xf')]},'json':!![]};return rp(_0x205690)['then'](function(_0x390a3e){if(_0x390a3e[_0x81b3('0x76')]==0xca){_0xb8dc69[_0x81b3('0x77')]=_0x390a3e;var _0x4c2c5a={'method':'POST','uri':_0x81b3('0x78'),'headers':{'Authorization':_0x81b3('0x75')+_0x8a4838['apiKey'],'Content-Type':_0x81b3('0x5c')},'body':{'refid':_0xb8dc69[_0x81b3('0x77')][_0x81b3('0x79')]},'json':!![]};return rp(_0x4c2c5a)[_0x81b3('0x1a')](function(_0x19a0d0){_0xb8dc69[_0x81b3('0x7a')]=_0x19a0d0;var _0x47ce6f={'messageId':_0xb8dc69[_0x81b3('0x77')][_0x81b3('0x79')],'read':!![]};return _0x4e7c26[_0x81b3('0x1b')](_0x47ce6f);});}else{return logger[_0x81b3('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x81b3('0x2e'),'intelepeer',util[_0x81b3('0x2f')](_0x390a3e,{'showHidden':![],'depth':null}));}})[_0x81b3('0x1d')](function(_0x4dd0bb){return logger[_0x81b3('0x2c')](_0x81b3('0x2d'),_0x81b3('0x2e'),_0x81b3('0x73'),util[_0x81b3('0x2f')](_0x4dd0bb,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x81b3('0x2d'),_0x81b3('0x2e'),_0x81b3('0x73'),_0x81b3('0x7b'));}break;}}})['finally'](function(){_0x4e9d1e();});}else{_0x4e9d1e();}}},'charset':'utf8mb4','collate':_0x81b3('0x7c')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index ae1a24e..be5a715 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 _0x9d2c=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','body','options','raw','CreateSmsMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./smsMessage.socket'];(function(_0x236380,_0x25476c){var _0x2e4104=function(_0x2b6a71){while(--_0x2b6a71){_0x236380['push'](_0x236380['shift']());}};_0x2e4104(++_0x25476c);}(_0x9d2c,0x166));var _0xc9d2=function(_0x452036,_0x28e180){_0x452036=_0x452036-0x0;var _0x452480=_0x9d2c[_0x452036];return _0x452480;};'use strict';var _=require('lodash');var util=require(_0xc9d2('0x0'));var moment=require('moment');var BPromise=require(_0xc9d2('0x1'));var rs=require(_0xc9d2('0x2'));var fs=require('fs');var Redis=require(_0xc9d2('0x3'));var db=require(_0xc9d2('0x4'))['db'];var utils=require(_0xc9d2('0x5'));var logger=require(_0xc9d2('0x6'))(_0xc9d2('0x7'));var config=require('../../config/environment');var jayson=require(_0xc9d2('0x8'));var client=jayson[_0xc9d2('0x9')][_0xc9d2('0xa')]({'port':0x232a});config[_0xc9d2('0xb')]=_['defaults'](config[_0xc9d2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc9d2('0xc'))(new Redis(config[_0xc9d2('0xb')]));require(_0xc9d2('0xd'))['register'](socket);function respondWithRpcPromise(_0x5640e9,_0x4490db,_0x4e7a47){return new BPromise(function(_0x322932,_0x3479c9){return client['request'](_0x5640e9,_0x4e7a47)[_0xc9d2('0xe')](function(_0x590068){logger[_0xc9d2('0xf')](_0xc9d2('0x10'),_0x4490db,_0xc9d2('0x11'));logger[_0xc9d2('0x12')](_0xc9d2('0x13'),_0x4490db,_0xc9d2('0x11'),JSON[_0xc9d2('0x14')](_0x590068));if(_0x590068[_0xc9d2('0x15')]){if(_0x590068[_0xc9d2('0x15')][_0xc9d2('0x16')]===0x1f4){logger[_0xc9d2('0x15')](_0xc9d2('0x10'),_0x4490db,_0x590068[_0xc9d2('0x15')]['message']);return _0x3479c9(_0x590068['error'][_0xc9d2('0x17')]);}logger['error'](_0xc9d2('0x10'),_0x4490db,_0x590068[_0xc9d2('0x15')]['message']);return _0x322932(_0x590068[_0xc9d2('0x15')]['message']);}else{logger[_0xc9d2('0xf')]('SmsMessage,\x20%s,\x20%s',_0x4490db,_0xc9d2('0x11'));_0x322932(_0x590068[_0xc9d2('0x18')][_0xc9d2('0x17')]);}})['catch'](function(_0x47c5d9){logger[_0xc9d2('0x15')]('SmsMessage,\x20%s,\x20%s',_0x4490db,_0x47c5d9);_0x3479c9(_0x47c5d9);});});}exports['CreateSmsMessage']=function(_0x3ffd13){var _0x5af5a9=this;return new Promise(function(_0x308bc5,_0x47beae){return db['SmsMessage'][_0xc9d2('0x19')](_0x3ffd13[_0xc9d2('0x1a')],{'raw':_0x3ffd13[_0xc9d2('0x1b')]?_0x3ffd13[_0xc9d2('0x1b')][_0xc9d2('0x1c')]===undefined?!![]:![]:!![]})[_0xc9d2('0xe')](function(_0x5552aa){logger[_0xc9d2('0xf')](_0xc9d2('0x1d'),_0x3ffd13);logger['debug'](_0xc9d2('0x1d'),_0x3ffd13,JSON[_0xc9d2('0x14')](_0x5552aa));_0x308bc5(_0x5552aa);})[_0xc9d2('0x1e')](function(_0x57ec61){logger[_0xc9d2('0x15')](_0xc9d2('0x1d'),_0x57ec61[_0xc9d2('0x17')],_0x3ffd13);_0x47beae(_0x5af5a9[_0xc9d2('0x15')](0x1f4,_0x57ec61['message']));});});}; \ No newline at end of file +var _0x5211=['body','options','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreateSmsMessage','SmsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5211,0x196));var _0x1521=function(_0x54a8bc,_0x199365){_0x54a8bc=_0x54a8bc-0x0;var _0x43389c=_0x5211[_0x54a8bc];return _0x43389c;};'use strict';var _=require('lodash');var util=require(_0x1521('0x0'));var moment=require(_0x1521('0x1'));var BPromise=require(_0x1521('0x2'));var rs=require(_0x1521('0x3'));var fs=require('fs');var Redis=require(_0x1521('0x4'));var db=require(_0x1521('0x5'))['db'];var utils=require(_0x1521('0x6'));var logger=require(_0x1521('0x7'))(_0x1521('0x8'));var config=require(_0x1521('0x9'));var jayson=require(_0x1521('0xa'));var client=jayson['client'][_0x1521('0xb')]({'port':0x232a});config[_0x1521('0xc')]=_['defaults'](config[_0x1521('0xc')],{'host':_0x1521('0xd'),'port':0x18eb});var socket=require(_0x1521('0xe'))(new Redis(config[_0x1521('0xc')]));require('./smsMessage.socket')[_0x1521('0xf')](socket);function respondWithRpcPromise(_0x493fbe,_0x2200d0,_0x12b8a4){return new BPromise(function(_0x35200d,_0x2f7ed4){return client[_0x1521('0x10')](_0x493fbe,_0x12b8a4)[_0x1521('0x11')](function(_0x1e62bf){logger[_0x1521('0x12')](_0x1521('0x13'),_0x2200d0,_0x1521('0x14'));logger[_0x1521('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2200d0,'request\x20sent',JSON['stringify'](_0x1e62bf));if(_0x1e62bf['error']){if(_0x1e62bf[_0x1521('0x16')]['code']===0x1f4){logger[_0x1521('0x16')](_0x1521('0x13'),_0x2200d0,_0x1e62bf[_0x1521('0x16')][_0x1521('0x17')]);return _0x2f7ed4(_0x1e62bf['error'][_0x1521('0x17')]);}logger[_0x1521('0x16')](_0x1521('0x13'),_0x2200d0,_0x1e62bf[_0x1521('0x16')][_0x1521('0x17')]);return _0x35200d(_0x1e62bf[_0x1521('0x16')]['message']);}else{logger[_0x1521('0x12')](_0x1521('0x13'),_0x2200d0,_0x1521('0x14'));_0x35200d(_0x1e62bf[_0x1521('0x18')]['message']);}})[_0x1521('0x19')](function(_0x3a9d0){logger['error']('SmsMessage,\x20%s,\x20%s',_0x2200d0,_0x3a9d0);_0x2f7ed4(_0x3a9d0);});});}exports[_0x1521('0x1a')]=function(_0x432424){var _0x123a3c=this;return new Promise(function(_0x166ec1,_0x36bee7){return db[_0x1521('0x1b')]['create'](_0x432424[_0x1521('0x1c')],{'raw':_0x432424[_0x1521('0x1d')]?_0x432424[_0x1521('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x1521('0x11')](function(_0x498b36){logger[_0x1521('0x12')]('CreateSmsMessage',_0x432424);logger[_0x1521('0x15')](_0x1521('0x1a'),_0x432424,JSON[_0x1521('0x1e')](_0x498b36));_0x166ec1(_0x498b36);})['catch'](function(_0x88882c){logger['error'](_0x1521('0x1a'),_0x88882c[_0x1521('0x17')],_0x432424);_0x36bee7(_0x123a3c[_0x1521('0x16')](0x1f4,_0x88882c[_0x1521('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c5462bf..a4832f4 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 _0xb5c3=['emit','removeListener','register','smsMessage:','./smsMessage.events','save'];(function(_0x14b9e7,_0x4cf803){var _0x2099a7=function(_0x44ac84){while(--_0x44ac84){_0x14b9e7['push'](_0x14b9e7['shift']());}};_0x2099a7(++_0x4cf803);}(_0xb5c3,0xd6));var _0x3b5c=function(_0xf3a5ae,_0x3aeb07){_0xf3a5ae=_0xf3a5ae-0x0;var _0x14d5be=_0xb5c3[_0xf3a5ae];return _0x14d5be;};'use strict';var SmsMessageEvents=require(_0x3b5c('0x0'));var events=[_0x3b5c('0x1'),'remove','update'];function createListener(_0x48db5c,_0x4fcdb7){return function(_0x173f02){_0x4fcdb7[_0x3b5c('0x2')](_0x48db5c,_0x173f02);};}function removeListener(_0x1df7d7,_0xa53827){return function(){SmsMessageEvents[_0x3b5c('0x3')](_0x1df7d7,_0xa53827);};}exports[_0x3b5c('0x4')]=function(_0x1351f5){for(var _0x203b76=0x0,_0x227f80=events['length'];_0x203b76<_0x227f80;_0x203b76++){var _0x4b7fdf=events[_0x203b76];var _0x1ef348=createListener(_0x3b5c('0x5')+_0x4b7fdf,_0x1351f5);SmsMessageEvents['on'](_0x4b7fdf,_0x1ef348);}}; \ No newline at end of file +var _0x3789=['length','smsMessage:','./smsMessage.events','save','update','register'];(function(_0x127fde,_0x26890a){var _0x3edb5f=function(_0x32a950){while(--_0x32a950){_0x127fde['push'](_0x127fde['shift']());}};_0x3edb5f(++_0x26890a);}(_0x3789,0x1a0));var _0x9378=function(_0x20aada,_0x238631){_0x20aada=_0x20aada-0x0;var _0x2a0857=_0x3789[_0x20aada];return _0x2a0857;};'use strict';var SmsMessageEvents=require(_0x9378('0x0'));var events=[_0x9378('0x1'),'remove',_0x9378('0x2')];function createListener(_0x4833ab,_0x5f3aeb){return function(_0x4b3b4f){_0x5f3aeb['emit'](_0x4833ab,_0x4b3b4f);};}function removeListener(_0x52460d,_0x320e03){return function(){SmsMessageEvents['removeListener'](_0x52460d,_0x320e03);};}exports[_0x9378('0x3')]=function(_0x401231){for(var _0x475f37=0x0,_0x1a1e05=events[_0x9378('0x4')];_0x475f37<_0x1a1e05;_0x475f37++){var _0x1e5532=events[_0x475f37];var _0x5609ef=createListener(_0x9378('0x5')+_0x1e5532,_0x401231);SmsMessageEvents['on'](_0x1e5532,_0x5609ef);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 23a7572..11de73b 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 _0x817f=['../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','put','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3fe98e,_0x29ba14){var _0x35686d=function(_0x19f079){while(--_0x19f079){_0x3fe98e['push'](_0x3fe98e['shift']());}};_0x35686d(++_0x29ba14);}(_0x817f,0x149));var _0xf817=function(_0x160425,_0x2983aa){_0x160425=_0x160425-0x0;var _0x455b67=_0x817f[_0x160425];return _0x455b67;};'use strict';var multer=require(_0xf817('0x0'));var util=require(_0xf817('0x1'));var path=require(_0xf817('0x2'));var timeout=require(_0xf817('0x3'));var express=require(_0xf817('0x4'));var router=express[_0xf817('0x5')]();var fs_extra=require(_0xf817('0x6'));var auth=require(_0xf817('0x7'));var interaction=require(_0xf817('0x8'));var config=require('../../config/environment');var controller=require(_0xf817('0x9'));router[_0xf817('0xa')]('/',auth[_0xf817('0xb')](),controller[_0xf817('0xc')]);router[_0xf817('0xa')](_0xf817('0xd'),auth[_0xf817('0xb')](),controller[_0xf817('0xe')]);router['get'](_0xf817('0xf'),auth[_0xf817('0xb')](),controller['show']);router[_0xf817('0xa')](_0xf817('0x10'),auth[_0xf817('0xb')](),controller['getMembers']);router['get'](_0xf817('0x11'),auth[_0xf817('0xb')](),controller[_0xf817('0x12')]);router[_0xf817('0xa')](_0xf817('0x13'),auth[_0xf817('0xb')](),controller['getAgents']);router[_0xf817('0x14')]('/',auth[_0xf817('0xb')](),controller[_0xf817('0x15')]);router[_0xf817('0x14')](_0xf817('0x11'),auth[_0xf817('0xb')](),controller[_0xf817('0x16')]);router[_0xf817('0x14')](_0xf817('0x13'),auth[_0xf817('0xb')](),controller['addAgents']);router[_0xf817('0x17')](_0xf817('0xf'),auth[_0xf817('0xb')](),controller[_0xf817('0x18')]);router[_0xf817('0x19')]('/:id',auth[_0xf817('0xb')](),controller[_0xf817('0x1a')]);router[_0xf817('0x19')](_0xf817('0x11'),auth['isAuthenticated'](),controller[_0xf817('0x1b')]);router[_0xf817('0x19')](_0xf817('0x13'),auth[_0xf817('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf700=['../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2bff9c,_0xe5758){var _0x24ca0b=function(_0x20223a){while(--_0x20223a){_0x2bff9c['push'](_0x2bff9c['shift']());}};_0x24ca0b(++_0xe5758);}(_0xf700,0x143));var _0x0f70=function(_0x5f4db7,_0x29af33){_0x5f4db7=_0x5f4db7-0x0;var _0x4421ec=_0xf700[_0x5f4db7];return _0x4421ec;};'use strict';var multer=require(_0x0f70('0x0'));var util=require('util');var path=require(_0x0f70('0x1'));var timeout=require(_0x0f70('0x2'));var express=require(_0x0f70('0x3'));var router=express[_0x0f70('0x4')]();var fs_extra=require(_0x0f70('0x5'));var auth=require(_0x0f70('0x6'));var interaction=require(_0x0f70('0x7'));var config=require(_0x0f70('0x8'));var controller=require(_0x0f70('0x9'));router['get']('/',auth[_0x0f70('0xa')](),controller[_0x0f70('0xb')]);router[_0x0f70('0xc')](_0x0f70('0xd'),auth[_0x0f70('0xa')](),controller[_0x0f70('0xe')]);router[_0x0f70('0xc')]('/:id',auth[_0x0f70('0xa')](),controller[_0x0f70('0xf')]);router[_0x0f70('0xc')](_0x0f70('0x10'),auth['isAuthenticated'](),controller[_0x0f70('0x11')]);router[_0x0f70('0xc')]('/:id/teams',auth[_0x0f70('0xa')](),controller[_0x0f70('0x12')]);router['get'](_0x0f70('0x13'),auth[_0x0f70('0xa')](),controller[_0x0f70('0x14')]);router[_0x0f70('0x15')]('/',auth[_0x0f70('0xa')](),controller[_0x0f70('0x16')]);router['post']('/:id/teams',auth[_0x0f70('0xa')](),controller[_0x0f70('0x17')]);router[_0x0f70('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x0f70('0x18')]);router[_0x0f70('0x19')](_0x0f70('0x1a'),auth[_0x0f70('0xa')](),controller['update']);router[_0x0f70('0x1b')](_0x0f70('0x1a'),auth[_0x0f70('0xa')](),controller[_0x0f70('0x1c')]);router['delete'](_0x0f70('0x1d'),auth[_0x0f70('0xa')](),controller[_0x0f70('0x1e')]);router[_0x0f70('0x1b')](_0x0f70('0x13'),auth['isAuthenticated'](),controller[_0x0f70('0x1f')]);module[_0x0f70('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 4124e20..eac15d0 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 _0x7a17=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','beepall'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7a17,0x94));var _0x77a1=function(_0x3c823f,_0x179fc8){_0x3c823f=_0x3c823f-0x0;var _0xc0d7f7=_0x7a17[_0x3c823f];return _0xc0d7f7;};'use strict';var Sequelize=require(_0x77a1('0x0'));module['exports']={'name':{'type':Sequelize[_0x77a1('0x1')],'unique':_0x77a1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x77a1('0x1')]},'timeout':{'type':Sequelize[_0x77a1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x77a1('0x4')]('rrmemory',_0x77a1('0x5'),_0x77a1('0x6'))}}; \ No newline at end of file +var _0xc2e7=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','STRING'];(function(_0x365a3c,_0x1102c5){var _0x34b631=function(_0x47136d){while(--_0x47136d){_0x365a3c['push'](_0x365a3c['shift']());}};_0x34b631(++_0x1102c5);}(_0xc2e7,0x6e));var _0x7c2e=function(_0xd2eda2,_0x239680){_0xd2eda2=_0xd2eda2-0x0;var _0x1e5ff8=_0xc2e7[_0xd2eda2];return _0x1e5ff8;};'use strict';var Sequelize=require(_0x7c2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c2e('0x1')],'unique':_0x7c2e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7c2e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7c2e('0x4')](_0x7c2e('0x5'),'beepall',_0x7c2e('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index b14e540..0259e23 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 _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x2a0bc2,_0x33f79b){var _0x840555=function(_0x1171d3){while(--_0x1171d3){_0x2a0bc2['push'](_0x2a0bc2['shift']());}};_0x840555(++_0x33f79b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32c4dc,_0x2e5965){_0x32c4dc=_0x32c4dc-0x0;var _0x4c8f72=_0x5f2f[_0x32c4dc];return _0x4c8f72;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x56ee9c,_0x4cd8ba){var _0x30fa0e=function(_0x5099fd){while(--_0x5099fd){_0x56ee9c['push'](_0x56ee9c['shift']());}};_0x30fa0e(++_0x4cd8ba);}(_0xdb28,0x106));var _0x8db2=function(_0x1b36c2,_0x564ac2){_0x1b36c2=_0x1b36c2-0x0;var _0x16c6a6=_0xdb28[_0x1b36c2];return _0x16c6a6;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 337940f..3f1c516 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 _0x7434=['save','remove','emit','exports','events','../../mysqldb','SmsQueue'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7434,0x162));var _0x4743=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7434[_0x4a9fb1];return _0x348672;};'use strict';var EventEmitter=require(_0x4743('0x0'));var SmsQueue=require(_0x4743('0x1'))['db'][_0x4743('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4743('0x3'),'afterUpdate':'update','afterDestroy':_0x4743('0x4')};function emitEvent(_0x119481){return function(_0xc2db18,_0x53eeaf,_0x469092){SmsQueueEvents[_0x4743('0x5')](_0x119481+':'+_0xc2db18['id'],_0xc2db18);SmsQueueEvents[_0x4743('0x5')](_0x119481,_0xc2db18);_0x469092(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x4743('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0xda98=['../../mysqldb','save','update','emit','hook','exports','events'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xda98,0x1cd));var _0x8da9=function(_0x4d05a0,_0x53aa7e){_0x4d05a0=_0x4d05a0-0x0;var _0x4c999c=_0xda98[_0x4d05a0];return _0x4c999c;};'use strict';var EventEmitter=require(_0x8da9('0x0'));var SmsQueue=require(_0x8da9('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8da9('0x2'),'afterUpdate':_0x8da9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x57cfe5){return function(_0x28edcc,_0x1c1c90,_0x5e6b5f){SmsQueueEvents['emit'](_0x57cfe5+':'+_0x28edcc['id'],_0x28edcc);SmsQueueEvents[_0x8da9('0x4')](_0x57cfe5,_0x28edcc);_0x5e6b5f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x8da9('0x5')](e,emitEvent(event));}}module[_0x8da9('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8b1d430..926eae7 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 _0x6be5=['rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5b25af,_0x121dd7){var _0x181a07=function(_0x2462e1){while(--_0x2462e1){_0x5b25af['push'](_0x5b25af['shift']());}};_0x181a07(++_0x121dd7);}(_0x6be5,0x181));var _0x56be=function(_0x27add9,_0x4eb304){_0x27add9=_0x27add9-0x0;var _0x5dc2ab=_0x6be5[_0x27add9];return _0x5dc2ab;};'use strict';var _=require(_0x56be('0x0'));var util=require(_0x56be('0x1'));var logger=require(_0x56be('0x2'))(_0x56be('0x3'));var moment=require('moment');var BPromise=require(_0x56be('0x4'));var rp=require(_0x56be('0x5'));var fs=require('fs');var path=require(_0x56be('0x6'));var rimraf=require(_0x56be('0x7'));var config=require(_0x56be('0x8'));var attributes=require(_0x56be('0x9'));module[_0x56be('0xa')]=function(_0x3c3fc8,_0x319946){return _0x3c3fc8[_0x56be('0xb')](_0x56be('0xc'),attributes,{'tableName':_0x56be('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b4e=['./smsQueue.attributes','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xfadc1a,_0xc6a189){var _0x1be3a4=function(_0x1a9107){while(--_0x1a9107){_0xfadc1a['push'](_0xfadc1a['shift']());}};_0x1be3a4(++_0xc6a189);}(_0x4b4e,0x117));var _0xe4b4=function(_0x4c0ca5,_0xf33ad7){_0x4c0ca5=_0x4c0ca5-0x0;var _0x1458aa=_0x4b4e[_0x4c0ca5];return _0x1458aa;};'use strict';var _=require(_0xe4b4('0x0'));var util=require(_0xe4b4('0x1'));var logger=require(_0xe4b4('0x2'))(_0xe4b4('0x3'));var moment=require(_0xe4b4('0x4'));var BPromise=require(_0xe4b4('0x5'));var rp=require(_0xe4b4('0x6'));var fs=require('fs');var path=require(_0xe4b4('0x7'));var rimraf=require(_0xe4b4('0x8'));var config=require('../../config/environment');var attributes=require(_0xe4b4('0x9'));module['exports']=function(_0x136e40,_0x11ac93){return _0x136e40['define'](_0xe4b4('0xa'),attributes,{'tableName':_0xe4b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 335e263..712548c 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 _0x5a2f=['include','model','catch','find','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','redis','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','map'];(function(_0xb74674,_0x2a2bd3){var _0x2ab4a2=function(_0x2c1e9d){while(--_0x2c1e9d){_0xb74674['push'](_0xb74674['shift']());}};_0x2ab4a2(++_0x2a2bd3);}(_0x5a2f,0x74));var _0xf5a2=function(_0x4a53e6,_0x40aecd){_0x4a53e6=_0x4a53e6-0x0;var _0x351f76=_0x5a2f[_0x4a53e6];return _0x351f76;};'use strict';var _=require(_0xf5a2('0x0'));var util=require(_0xf5a2('0x1'));var moment=require(_0xf5a2('0x2'));var BPromise=require(_0xf5a2('0x3'));var rs=require(_0xf5a2('0x4'));var fs=require('fs');var Redis=require(_0xf5a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf5a2('0x6'));var logger=require('../../config/logger')(_0xf5a2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5a2('0x8')]['http']({'port':0x232a});config[_0xf5a2('0x9')]=_['defaults'](config[_0xf5a2('0x9')],{'host':_0xf5a2('0xa'),'port':0x18eb});var socket=require(_0xf5a2('0xb'))(new Redis(config['redis']));require(_0xf5a2('0xc'))[_0xf5a2('0xd')](socket);function respondWithRpcPromise(_0x1e905c,_0x52dfe4,_0x2242ab){return new BPromise(function(_0x48496b,_0x1c9dfc){return client['request'](_0x1e905c,_0x2242ab)[_0xf5a2('0xe')](function(_0x2a391a){logger[_0xf5a2('0xf')]('SmsQueue,\x20%s,\x20%s',_0x52dfe4,_0xf5a2('0x10'));logger['debug'](_0xf5a2('0x11'),_0x52dfe4,_0xf5a2('0x10'),JSON[_0xf5a2('0x12')](_0x2a391a));if(_0x2a391a[_0xf5a2('0x13')]){if(_0x2a391a['error'][_0xf5a2('0x14')]===0x1f4){logger[_0xf5a2('0x13')](_0xf5a2('0x15'),_0x52dfe4,_0x2a391a['error']['message']);return _0x1c9dfc(_0x2a391a[_0xf5a2('0x13')]['message']);}logger[_0xf5a2('0x13')](_0xf5a2('0x15'),_0x52dfe4,_0x2a391a[_0xf5a2('0x13')][_0xf5a2('0x16')]);return _0x48496b(_0x2a391a[_0xf5a2('0x13')][_0xf5a2('0x16')]);}else{logger['info'](_0xf5a2('0x15'),_0x52dfe4,_0xf5a2('0x10'));_0x48496b(_0x2a391a[_0xf5a2('0x17')]['message']);}})['catch'](function(_0x239a26){logger[_0xf5a2('0x13')](_0xf5a2('0x15'),_0x52dfe4,_0x239a26);_0x1c9dfc(_0x239a26);});});}exports[_0xf5a2('0x18')]=function(_0x20251c){var _0xa7fe9e=this;return new Promise(function(_0x13294c,_0x58e0f4){return db[_0xf5a2('0x19')]['findAll']({'raw':_0x20251c[_0xf5a2('0x1a')]?_0x20251c[_0xf5a2('0x1a')][_0xf5a2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20251c['options']?_0x20251c[_0xf5a2('0x1a')][_0xf5a2('0x1c')]||null:null,'attributes':_0x20251c[_0xf5a2('0x1a')]?_0x20251c[_0xf5a2('0x1a')][_0xf5a2('0x1d')]||null:null,'limit':_0x20251c[_0xf5a2('0x1a')]?_0x20251c['options'][_0xf5a2('0x1e')]||null:null,'include':_0x20251c[_0xf5a2('0x1a')]?_0x20251c[_0xf5a2('0x1a')]['include']?_[_0xf5a2('0x1f')](_0x20251c[_0xf5a2('0x1a')][_0xf5a2('0x20')],function(_0x18e182){return{'model':db[_0x18e182[_0xf5a2('0x21')]],'as':_0x18e182['as'],'attributes':_0x18e182[_0xf5a2('0x1d')],'include':_0x18e182[_0xf5a2('0x20')]?_['map'](_0x18e182[_0xf5a2('0x20')],function(_0x471c94){return{'model':db[_0x471c94['model']],'as':_0x471c94['as'],'attributes':_0x471c94[_0xf5a2('0x1d')],'include':_0x471c94[_0xf5a2('0x20')]?_[_0xf5a2('0x1f')](_0x471c94[_0xf5a2('0x20')],function(_0x2eacf4){return{'model':db[_0x2eacf4[_0xf5a2('0x21')]],'as':_0x2eacf4['as'],'attributes':_0x2eacf4[_0xf5a2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf5a2('0xe')](function(_0x43b354){logger[_0xf5a2('0xf')]('GetSmsQueue',_0x20251c);logger['debug']('GetSmsQueue',_0x20251c,JSON['stringify'](_0x43b354));_0x13294c(_0x43b354);})[_0xf5a2('0x22')](function(_0x129d69){logger[_0xf5a2('0x13')](_0xf5a2('0x18'),_0x129d69['message'],_0x20251c);_0x58e0f4(_0xa7fe9e[_0xf5a2('0x13')](0x1f4,_0x129d69[_0xf5a2('0x16')]));});});};exports['ShowSmsQueue']=function(_0x582c4a){var _0x5f371b=this;return new Promise(function(_0x4f5117,_0x8188f8){return db['SmsQueue'][_0xf5a2('0x23')]({'raw':_0x582c4a[_0xf5a2('0x1a')]?_0x582c4a['options'][_0xf5a2('0x1b')]===undefined?!![]:![]:!![],'where':_0x582c4a[_0xf5a2('0x1a')]?_0x582c4a[_0xf5a2('0x1a')]['where']||null:null,'attributes':_0x582c4a[_0xf5a2('0x1a')]?_0x582c4a[_0xf5a2('0x1a')][_0xf5a2('0x1d')]||null:null,'include':_0x582c4a['options']?_0x582c4a[_0xf5a2('0x1a')]['include']?_['map'](_0x582c4a[_0xf5a2('0x1a')][_0xf5a2('0x20')],function(_0x32cee9){return{'model':db[_0x32cee9[_0xf5a2('0x21')]],'as':_0x32cee9['as'],'attributes':_0x32cee9[_0xf5a2('0x1d')],'include':_0x32cee9[_0xf5a2('0x20')]?_[_0xf5a2('0x1f')](_0x32cee9[_0xf5a2('0x20')],function(_0x42b638){return{'model':db[_0x42b638[_0xf5a2('0x21')]],'as':_0x42b638['as'],'attributes':_0x42b638[_0xf5a2('0x1d')],'include':_0x42b638[_0xf5a2('0x20')]?_[_0xf5a2('0x1f')](_0x42b638[_0xf5a2('0x20')],function(_0x4c7b1f){return{'model':db[_0x4c7b1f[_0xf5a2('0x21')]],'as':_0x4c7b1f['as'],'attributes':_0x4c7b1f[_0xf5a2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf5a2('0xe')](function(_0x4dfddc){logger['info'](_0xf5a2('0x24'),_0x582c4a);logger['debug']('ShowSmsQueue',_0x582c4a,JSON[_0xf5a2('0x12')](_0x4dfddc));_0x4f5117(_0x4dfddc);})[_0xf5a2('0x22')](function(_0xf4bc32){logger['error']('ShowSmsQueue',_0xf4bc32[_0xf5a2('0x16')],_0x582c4a);_0x8188f8(_0x5f371b[_0xf5a2('0x13')](0x1f4,_0xf4bc32[_0xf5a2('0x16')]));});});}; \ No newline at end of file +var _0xa0db=['message','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0db,0x1a1));var _0xba0d=function(_0x1de6f8,_0x38f52a){_0x1de6f8=_0x1de6f8-0x0;var _0x50c45b=_0xa0db[_0x1de6f8];return _0x50c45b;};'use strict';var _=require(_0xba0d('0x0'));var util=require(_0xba0d('0x1'));var moment=require(_0xba0d('0x2'));var BPromise=require(_0xba0d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba0d('0x4'))['db'];var utils=require(_0xba0d('0x5'));var logger=require(_0xba0d('0x6'))('rpc');var config=require(_0xba0d('0x7'));var jayson=require(_0xba0d('0x8'));var client=jayson[_0xba0d('0x9')][_0xba0d('0xa')]({'port':0x232a});config[_0xba0d('0xb')]=_[_0xba0d('0xc')](config['redis'],{'host':_0xba0d('0xd'),'port':0x18eb});var socket=require(_0xba0d('0xe'))(new Redis(config[_0xba0d('0xb')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x473b03,_0x1d24dc,_0x474715){return new BPromise(function(_0x7b232d,_0x50fdce){return client[_0xba0d('0xf')](_0x473b03,_0x474715)['then'](function(_0x435e59){logger[_0xba0d('0x10')](_0xba0d('0x11'),_0x1d24dc,_0xba0d('0x12'));logger['debug'](_0xba0d('0x13'),_0x1d24dc,_0xba0d('0x12'),JSON[_0xba0d('0x14')](_0x435e59));if(_0x435e59['error']){if(_0x435e59[_0xba0d('0x15')][_0xba0d('0x16')]===0x1f4){logger[_0xba0d('0x15')](_0xba0d('0x11'),_0x1d24dc,_0x435e59['error'][_0xba0d('0x17')]);return _0x50fdce(_0x435e59[_0xba0d('0x15')]['message']);}logger[_0xba0d('0x15')]('SmsQueue,\x20%s,\x20%s',_0x1d24dc,_0x435e59[_0xba0d('0x15')][_0xba0d('0x17')]);return _0x7b232d(_0x435e59['error']['message']);}else{logger[_0xba0d('0x10')]('SmsQueue,\x20%s,\x20%s',_0x1d24dc,_0xba0d('0x12'));_0x7b232d(_0x435e59[_0xba0d('0x18')][_0xba0d('0x17')]);}})[_0xba0d('0x19')](function(_0x4333b8){logger[_0xba0d('0x15')](_0xba0d('0x11'),_0x1d24dc,_0x4333b8);_0x50fdce(_0x4333b8);});});}exports[_0xba0d('0x1a')]=function(_0x70ec2b){var _0x44283f=this;return new Promise(function(_0x574e59,_0x34d4ad){return db[_0xba0d('0x1b')][_0xba0d('0x1c')]({'raw':_0x70ec2b[_0xba0d('0x1d')]?_0x70ec2b[_0xba0d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x70ec2b[_0xba0d('0x1d')]?_0x70ec2b[_0xba0d('0x1d')][_0xba0d('0x1e')]||null:null,'attributes':_0x70ec2b['options']?_0x70ec2b[_0xba0d('0x1d')][_0xba0d('0x1f')]||null:null,'limit':_0x70ec2b[_0xba0d('0x1d')]?_0x70ec2b['options'][_0xba0d('0x20')]||null:null,'include':_0x70ec2b[_0xba0d('0x1d')]?_0x70ec2b[_0xba0d('0x1d')][_0xba0d('0x21')]?_[_0xba0d('0x22')](_0x70ec2b[_0xba0d('0x1d')][_0xba0d('0x21')],function(_0x36b91b){return{'model':db[_0x36b91b[_0xba0d('0x23')]],'as':_0x36b91b['as'],'attributes':_0x36b91b[_0xba0d('0x1f')],'include':_0x36b91b[_0xba0d('0x21')]?_[_0xba0d('0x22')](_0x36b91b[_0xba0d('0x21')],function(_0x189817){return{'model':db[_0x189817[_0xba0d('0x23')]],'as':_0x189817['as'],'attributes':_0x189817[_0xba0d('0x1f')],'include':_0x189817[_0xba0d('0x21')]?_[_0xba0d('0x22')](_0x189817['include'],function(_0x517335){return{'model':db[_0x517335['model']],'as':_0x517335['as'],'attributes':_0x517335[_0xba0d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xba0d('0x24')](function(_0x14bd91){logger['info']('GetSmsQueue',_0x70ec2b);logger['debug'](_0xba0d('0x1a'),_0x70ec2b,JSON['stringify'](_0x14bd91));_0x574e59(_0x14bd91);})[_0xba0d('0x19')](function(_0x57a14d){logger[_0xba0d('0x15')](_0xba0d('0x1a'),_0x57a14d[_0xba0d('0x17')],_0x70ec2b);_0x34d4ad(_0x44283f[_0xba0d('0x15')](0x1f4,_0x57a14d[_0xba0d('0x17')]));});});};exports[_0xba0d('0x25')]=function(_0x362d0d){var _0x2b4e72=this;return new Promise(function(_0x36a418,_0x4e6dd0){return db['SmsQueue'][_0xba0d('0x26')]({'raw':_0x362d0d[_0xba0d('0x1d')]?_0x362d0d[_0xba0d('0x1d')][_0xba0d('0x27')]===undefined?!![]:![]:!![],'where':_0x362d0d[_0xba0d('0x1d')]?_0x362d0d[_0xba0d('0x1d')][_0xba0d('0x1e')]||null:null,'attributes':_0x362d0d[_0xba0d('0x1d')]?_0x362d0d[_0xba0d('0x1d')][_0xba0d('0x1f')]||null:null,'include':_0x362d0d[_0xba0d('0x1d')]?_0x362d0d[_0xba0d('0x1d')]['include']?_[_0xba0d('0x22')](_0x362d0d['options'][_0xba0d('0x21')],function(_0x4c7886){return{'model':db[_0x4c7886[_0xba0d('0x23')]],'as':_0x4c7886['as'],'attributes':_0x4c7886[_0xba0d('0x1f')],'include':_0x4c7886[_0xba0d('0x21')]?_[_0xba0d('0x22')](_0x4c7886[_0xba0d('0x21')],function(_0x2a7918){return{'model':db[_0x2a7918[_0xba0d('0x23')]],'as':_0x2a7918['as'],'attributes':_0x2a7918[_0xba0d('0x1f')],'include':_0x2a7918[_0xba0d('0x21')]?_[_0xba0d('0x22')](_0x2a7918['include'],function(_0x1bf9c0){return{'model':db[_0x1bf9c0['model']],'as':_0x1bf9c0['as'],'attributes':_0x1bf9c0[_0xba0d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ac081){logger[_0xba0d('0x10')]('ShowSmsQueue',_0x362d0d);logger['debug']('ShowSmsQueue',_0x362d0d,JSON[_0xba0d('0x14')](_0x4ac081));_0x36a418(_0x4ac081);})['catch'](function(_0x392307){logger['error'](_0xba0d('0x25'),_0x392307[_0xba0d('0x17')],_0x362d0d);_0x4e6dd0(_0x2b4e72['error'](0x1f4,_0x392307['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e507e68..f0321e9 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 _0xe569=['length','smsQueue:','save','remove','update','removeListener','register'];(function(_0x185e2e,_0x29ce6a){var _0xecdde2=function(_0x3b0762){while(--_0x3b0762){_0x185e2e['push'](_0x185e2e['shift']());}};_0xecdde2(++_0x29ce6a);}(_0xe569,0xf7));var _0x9e56=function(_0x3adec3,_0x32c463){_0x3adec3=_0x3adec3-0x0;var _0xc01b43=_0xe569[_0x3adec3];return _0xc01b43;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x9e56('0x0'),_0x9e56('0x1'),_0x9e56('0x2')];function createListener(_0x19c97b,_0x5e1d92){return function(_0x401e08){_0x5e1d92['emit'](_0x19c97b,_0x401e08);};}function removeListener(_0x368131,_0x3fd584){return function(){SmsQueueEvents[_0x9e56('0x3')](_0x368131,_0x3fd584);};}exports[_0x9e56('0x4')]=function(_0x543c7d){for(var _0x50395a=0x0,_0x1c00a5=events[_0x9e56('0x5')];_0x50395a<_0x1c00a5;_0x50395a++){var _0x365ecb=events[_0x50395a];var _0x43f4e9=createListener(_0x9e56('0x6')+_0x365ecb,_0x543c7d);SmsQueueEvents['on'](_0x365ecb,_0x43f4e9);}}; \ No newline at end of file +var _0x6173=['emit','removeListener','register','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x2afc7b,_0x54aef8){var _0x1b0b8e=function(_0x283890){while(--_0x283890){_0x2afc7b['push'](_0x2afc7b['shift']());}};_0x1b0b8e(++_0x54aef8);}(_0x6173,0xb4));var _0x3617=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6173[_0x3ab51d];return _0x29a04e;};'use strict';var SmsQueueEvents=require(_0x3617('0x0'));var events=[_0x3617('0x1'),_0x3617('0x2'),_0x3617('0x3')];function createListener(_0x5440c4,_0x945a6a){return function(_0x3f9900){_0x945a6a[_0x3617('0x4')](_0x5440c4,_0x3f9900);};}function removeListener(_0x467db0,_0x29d48f){return function(){SmsQueueEvents[_0x3617('0x5')](_0x467db0,_0x29d48f);};}exports[_0x3617('0x6')]=function(_0x58eb3c){for(var _0x3fa14b=0x0,_0xa04743=events['length'];_0x3fa14b<_0xa04743;_0x3fa14b++){var _0x3accb7=events[_0x3fa14b];var _0xe60345=createListener(_0x3617('0x7')+_0x3accb7,_0x58eb3c);SmsQueueEvents['on'](_0x3accb7,_0xe60345);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index ded67c0..e43b149 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 _0xcafb=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3ccfe9,_0x3c6533){var _0x182243=function(_0x8006f0){while(--_0x8006f0){_0x3ccfe9['push'](_0x3ccfe9['shift']());}};_0x182243(++_0x3c6533);}(_0xcafb,0x188));var _0xbcaf=function(_0xf31930,_0x49d9a6){_0xf31930=_0xf31930-0x0;var _0x360358=_0xcafb[_0xf31930];return _0x360358;};'use strict';var multer=require('multer');var util=require(_0xbcaf('0x0'));var path=require(_0xbcaf('0x1'));var timeout=require(_0xbcaf('0x2'));var express=require(_0xbcaf('0x3'));var router=express[_0xbcaf('0x4')]();var fs_extra=require(_0xbcaf('0x5'));var auth=require(_0xbcaf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbcaf('0x7'));var controller=require(_0xbcaf('0x8'));router[_0xbcaf('0x9')]('/',auth[_0xbcaf('0xa')](),controller[_0xbcaf('0xb')]);router['get']('/describe',auth[_0xbcaf('0xa')](),controller['describe']);router[_0xbcaf('0x9')](_0xbcaf('0xc'),auth[_0xbcaf('0xa')](),controller[_0xbcaf('0xd')]);router[_0xbcaf('0xe')]('/',auth[_0xbcaf('0xa')](),controller['create']);router[_0xbcaf('0xf')](_0xbcaf('0xc'),auth[_0xbcaf('0xa')](),controller['update']);router[_0xbcaf('0x10')](_0xbcaf('0xc'),auth[_0xbcaf('0xa')](),controller[_0xbcaf('0x11')]);module[_0xbcaf('0x12')]=router; \ No newline at end of file +var _0x4279=['/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','create','put'];(function(_0x802fe1,_0x15435e){var _0x3f5fe1=function(_0x39e490){while(--_0x39e490){_0x802fe1['push'](_0x802fe1['shift']());}};_0x3f5fe1(++_0x15435e);}(_0x4279,0x8d));var _0x9427=function(_0x28c714,_0x459f05){_0x28c714=_0x28c714-0x0;var _0x55e2d1=_0x4279[_0x28c714];return _0x55e2d1;};'use strict';var multer=require('multer');var util=require(_0x9427('0x0'));var path=require(_0x9427('0x1'));var timeout=require('connect-timeout');var express=require(_0x9427('0x2'));var router=express[_0x9427('0x3')]();var fs_extra=require(_0x9427('0x4'));var auth=require(_0x9427('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9427('0x6'));var controller=require('./smsQueueReport.controller');router[_0x9427('0x7')]('/',auth[_0x9427('0x8')](),controller['index']);router[_0x9427('0x7')](_0x9427('0x9'),auth[_0x9427('0x8')](),controller['describe']);router[_0x9427('0x7')]('/:id',auth[_0x9427('0x8')](),controller['show']);router['post']('/',auth[_0x9427('0x8')](),controller[_0x9427('0xa')]);router[_0x9427('0xb')](_0x9427('0xc'),auth[_0x9427('0x8')](),controller[_0x9427('0xd')]);router[_0x9427('0xe')](_0x9427('0xc'),auth['isAuthenticated'](),controller[_0x9427('0xf')]);module[_0x9427('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index a8e30dc..fd2ce06 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 _0xbcbb=['exports','STRING','DATE','moment','sequelize'];(function(_0x532155,_0x110247){var _0x3f2619=function(_0x236b60){while(--_0x236b60){_0x532155['push'](_0x532155['shift']());}};_0x3f2619(++_0x110247);}(_0xbcbb,0x14d));var _0xbbcb=function(_0x33a47b,_0x25022a){_0x33a47b=_0x33a47b-0x0;var _0x3164d0=_0xbcbb[_0x33a47b];return _0x3164d0;};'use strict';var moment=require(_0xbbcb('0x0'));var Sequelize=require(_0xbbcb('0x1'));module[_0xbbcb('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbbcb('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbbcb('0x4')]},'exitAt':{'type':Sequelize[_0xbbcb('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3a01=['DATE','moment','exports','STRING'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x3a01,0x105));var _0x13a0=function(_0x316a78,_0x217de9){_0x316a78=_0x316a78-0x0;var _0x46fce5=_0x3a01[_0x316a78];return _0x46fce5;};'use strict';var moment=require(_0x13a0('0x0'));var Sequelize=require('sequelize');module[_0x13a0('0x1')]={'uniqueid':{'type':Sequelize[_0x13a0('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x13a0('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x13a0('0x3')]},'reason':{'type':Sequelize[_0x13a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index e67e75a..3a12b17 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 _0x11cb=['order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','SmsQueueReport','findAll','rows','catch','show','create','body','find','params','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit'];(function(_0x860f79,_0x121fbb){var _0xe7c610=function(_0x3b7a11){while(--_0x3b7a11){_0x860f79['push'](_0x860f79['shift']());}};_0xe7c610(++_0x121fbb);}(_0x11cb,0x13e));var _0xb11c=function(_0x5b656a,_0x154687){_0x5b656a=_0x5b656a-0x0;var _0x3bc9d2=_0x11cb[_0x5b656a];return _0x3bc9d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb11c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb11c('0x1'));var rp=require('request-promise');var moment=require(_0xb11c('0x2'));var BPromise=require(_0xb11c('0x3'));var Mustache=require(_0xb11c('0x4'));var util=require(_0xb11c('0x5'));var path=require('path');var sox=require(_0xb11c('0x6'));var csv=require(_0xb11c('0x7'));var ejs=require(_0xb11c('0x8'));var fs=require('fs');var fs_extra=require(_0xb11c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb11c('0xa'));var jsforce=require(_0xb11c('0xb'));var deskjs=require(_0xb11c('0xc'));var toCsv=require(_0xb11c('0x7'));var querystring=require(_0xb11c('0xd'));var Papa=require(_0xb11c('0xe'));var Redis=require('ioredis');var authService=require(_0xb11c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb11c('0x10'));var hardwareService=require(_0xb11c('0x11'));var logger=require('../../config/logger')(_0xb11c('0x12'));var utils=require(_0xb11c('0x13'));var config=require(_0xb11c('0x14'));var licenseUtil=require(_0xb11c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53a569,_0x576018){_0x576018=_0x576018||0xcc;return function(_0x5771a8){if(_0x5771a8){return _0x53a569[_0xb11c('0x16')](_0x576018);}return _0x53a569['status'](_0x576018)[_0xb11c('0x17')]();};}function respondWithResult(_0x5c4c30,_0x54086c){_0x54086c=_0x54086c||0xc8;return function(_0x5f0e88){if(_0x5f0e88){return _0x5c4c30[_0xb11c('0x18')](_0x54086c)[_0xb11c('0x19')](_0x5f0e88);}};}function respondWithFilteredResult(_0x3984fe,_0x308021){return function(_0x874a01){if(_0x874a01){var _0xe198a1=typeof _0x308021[_0xb11c('0x1a')]===_0xb11c('0x1b')&&typeof _0x308021[_0xb11c('0x1c')]===_0xb11c('0x1b');var _0x15adb7=_0x874a01[_0xb11c('0x1d')];var _0x3bc080=_0xe198a1?0x0:_0x308021[_0xb11c('0x1a')];var _0x1980f4=_0xe198a1?_0x874a01[_0xb11c('0x1d')]:_0x308021['offset']+_0x308021[_0xb11c('0x1c')];var _0xaf09d5;if(_0x1980f4>=_0x15adb7){_0x1980f4=_0x15adb7;_0xaf09d5=0xc8;}else{_0xaf09d5=0xce;}_0x3984fe[_0xb11c('0x18')](_0xaf09d5);return _0x3984fe['set'](_0xb11c('0x1e'),_0x3bc080+'-'+_0x1980f4+'/'+_0x15adb7)[_0xb11c('0x19')](_0x874a01);}return null;};}function patchUpdates(_0x4ef441){return function(_0x5773a6){try{jsonpatch[_0xb11c('0x1f')](_0x5773a6,_0x4ef441,!![]);}catch(_0x92009d){return BPromise['reject'](_0x92009d);}return _0x5773a6[_0xb11c('0x20')]();};}function saveUpdates(_0x3ad441,_0x376c2e){return function(_0x547ce5){if(_0x547ce5){return _0x547ce5[_0xb11c('0x21')](_0x3ad441)[_0xb11c('0x22')](function(_0x38ff40){return _0x38ff40;});}return null;};}function removeEntity(_0x1f204f,_0x3ff044){return function(_0x4953ee){if(_0x4953ee){return _0x4953ee[_0xb11c('0x23')]()[_0xb11c('0x22')](function(){_0x1f204f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f04f,_0x5a558f){return function(_0x36c1bb){if(!_0x36c1bb){_0x22f04f[_0xb11c('0x16')](0x194);}return _0x36c1bb;};}function handleError(_0x294fe9,_0x2409db){_0x2409db=_0x2409db||0x1f4;return function(_0x487405){logger[_0xb11c('0x24')](_0x487405[_0xb11c('0x25')]);if(_0x487405[_0xb11c('0x26')]){delete _0x487405[_0xb11c('0x26')];}_0x294fe9[_0xb11c('0x18')](_0x2409db)[_0xb11c('0x27')](_0x487405);};}exports['index']=function(_0x42aaea,_0x419c17){var _0xb14427={},_0x5e6a36={},_0x5953cf={'count':0x0,'rows':[]};var _0xdb247b=_[_0xb11c('0x28')](db['SmsQueueReport'][_0xb11c('0x29')],function(_0xfed49c){return{'name':_0xfed49c[_0xb11c('0x2a')],'type':_0xfed49c['type'][_0xb11c('0x2b')]};});_0x5e6a36['model']=_[_0xb11c('0x28')](_0xdb247b,'name');_0x5e6a36[_0xb11c('0x2c')]=_[_0xb11c('0x2d')](_0x42aaea[_0xb11c('0x2c')]);_0x5e6a36['filters']=_[_0xb11c('0x2e')](_0x5e6a36[_0xb11c('0x2f')],_0x5e6a36['query']);_0xb14427[_0xb11c('0x30')]=_[_0xb11c('0x2e')](_0x5e6a36[_0xb11c('0x2f')],qs[_0xb11c('0x31')](_0x42aaea[_0xb11c('0x2c')]['fields']));_0xb14427[_0xb11c('0x30')]=_0xb14427[_0xb11c('0x30')][_0xb11c('0x32')]?_0xb14427[_0xb11c('0x30')]:_0x5e6a36['model'];if(!_0x42aaea[_0xb11c('0x2c')]['hasOwnProperty'](_0xb11c('0x33'))){_0xb14427[_0xb11c('0x1c')]=qs[_0xb11c('0x1c')](_0x42aaea[_0xb11c('0x2c')][_0xb11c('0x1c')]);_0xb14427[_0xb11c('0x1a')]=qs[_0xb11c('0x1a')](_0x42aaea[_0xb11c('0x2c')][_0xb11c('0x1a')]);}_0xb14427[_0xb11c('0x34')]=qs[_0xb11c('0x35')](_0x42aaea[_0xb11c('0x2c')][_0xb11c('0x35')]);_0xb14427[_0xb11c('0x36')]=qs[_0xb11c('0x37')](_[_0xb11c('0x38')](_0x42aaea[_0xb11c('0x2c')],_0x5e6a36[_0xb11c('0x37')]),_0xdb247b);if(_0x42aaea[_0xb11c('0x2c')][_0xb11c('0x39')]){_0xb14427[_0xb11c('0x36')]=_[_0xb11c('0x3a')](_0xb14427[_0xb11c('0x36')],{'$or':_[_0xb11c('0x28')](_0xdb247b,function(_0x5317ce){if(_0x5317ce[_0xb11c('0x3b')]!==_0xb11c('0x3c')){var _0x5aefb5={};_0x5aefb5[_0x5317ce['name']]={'$like':'%'+_0x42aaea['query'][_0xb11c('0x39')]+'%'};return _0x5aefb5;}})});}_0xb14427=_[_0xb11c('0x3a')]({},_0xb14427,_0x42aaea[_0xb11c('0x3d')]);var _0x2071fe={'where':_0xb14427[_0xb11c('0x36')]};return db['SmsQueueReport'][_0xb11c('0x1d')](_0x2071fe)[_0xb11c('0x22')](function(_0x9a870b){_0x5953cf['count']=_0x9a870b;if(_0x42aaea['query'][_0xb11c('0x3e')]){_0xb14427[_0xb11c('0x3f')]=[{'all':!![]}];}return db[_0xb11c('0x40')][_0xb11c('0x41')](_0xb14427);})[_0xb11c('0x22')](function(_0xb03808){_0x5953cf[_0xb11c('0x42')]=_0xb03808;return _0x5953cf;})['then'](respondWithFilteredResult(_0x419c17,_0xb14427))[_0xb11c('0x43')](handleError(_0x419c17,null));};exports[_0xb11c('0x44')]=function(_0x50e07f,_0x2c4c57){var _0x1bf1ad={'raw':!![],'where':{'id':_0x50e07f['params']['id']}},_0x3554ee={};_0x3554ee['model']=_[_0xb11c('0x2d')](db[_0xb11c('0x40')][_0xb11c('0x29')]);_0x3554ee[_0xb11c('0x2c')]=_['keys'](_0x50e07f[_0xb11c('0x2c')]);_0x3554ee[_0xb11c('0x37')]=_[_0xb11c('0x2e')](_0x3554ee['model'],_0x3554ee['query']);_0x1bf1ad[_0xb11c('0x30')]=_['intersection'](_0x3554ee[_0xb11c('0x2f')],qs[_0xb11c('0x31')](_0x50e07f[_0xb11c('0x2c')][_0xb11c('0x31')]));_0x1bf1ad[_0xb11c('0x30')]=_0x1bf1ad[_0xb11c('0x30')][_0xb11c('0x32')]?_0x1bf1ad['attributes']:_0x3554ee[_0xb11c('0x2f')];if(_0x50e07f['query']['includeAll']){_0x1bf1ad[_0xb11c('0x3f')]=[{'all':!![]}];}_0x1bf1ad=_[_0xb11c('0x3a')]({},_0x1bf1ad,_0x50e07f['options']);return db[_0xb11c('0x40')]['find'](_0x1bf1ad)['then'](handleEntityNotFound(_0x2c4c57,null))[_0xb11c('0x22')](respondWithResult(_0x2c4c57,null))['catch'](handleError(_0x2c4c57,null));};exports[_0xb11c('0x45')]=function(_0x3a872e,_0x541d1d){return db[_0xb11c('0x40')]['create'](_0x3a872e[_0xb11c('0x46')],{})[_0xb11c('0x22')](respondWithResult(_0x541d1d,0xc9))[_0xb11c('0x43')](handleError(_0x541d1d,null));};exports['update']=function(_0x468db2,_0x1f44b8){if(_0x468db2[_0xb11c('0x46')]['id']){delete _0x468db2[_0xb11c('0x46')]['id'];}return db[_0xb11c('0x40')][_0xb11c('0x47')]({'where':{'id':_0x468db2[_0xb11c('0x48')]['id']}})[_0xb11c('0x22')](handleEntityNotFound(_0x1f44b8,null))['then'](saveUpdates(_0x468db2['body'],null))['then'](respondWithResult(_0x1f44b8,null))[_0xb11c('0x43')](handleError(_0x1f44b8,null));};exports[_0xb11c('0x23')]=function(_0x4e95c1,_0x2083d8){return db[_0xb11c('0x40')][_0xb11c('0x47')]({'where':{'id':_0x4e95c1[_0xb11c('0x48')]['id']}})[_0xb11c('0x22')](handleEntityNotFound(_0x2083d8,null))['then'](removeEntity(_0x2083d8,null))[_0xb11c('0x43')](handleError(_0x2083d8,null));};exports[_0xb11c('0x49')]=function(_0x22f319,_0xaff430){return db['SmsQueueReport'][_0xb11c('0x49')]()[_0xb11c('0x22')](respondWithResult(_0xaff430,null))['catch'](handleError(_0xaff430,null));}; \ No newline at end of file +var _0x780d=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','SmsQueueReport','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x780d,0x122));var _0xd780=function(_0x3a297b,_0x10d410){_0x3a297b=_0x3a297b-0x0;var _0x5d3626=_0x780d[_0x3a297b];return _0x5d3626;};'use strict';var emlformat=require(_0xd780('0x0'));var rimraf=require(_0xd780('0x1'));var zipdir=require(_0xd780('0x2'));var jsonpatch=require(_0xd780('0x3'));var rp=require(_0xd780('0x4'));var moment=require(_0xd780('0x5'));var BPromise=require(_0xd780('0x6'));var Mustache=require(_0xd780('0x7'));var util=require(_0xd780('0x8'));var path=require(_0xd780('0x9'));var sox=require(_0xd780('0xa'));var csv=require(_0xd780('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd780('0xc'));var _=require('lodash');var squel=require(_0xd780('0xd'));var crypto=require('crypto');var jsforce=require(_0xd780('0xe'));var deskjs=require(_0xd780('0xf'));var toCsv=require(_0xd780('0xb'));var querystring=require(_0xd780('0x10'));var Papa=require(_0xd780('0x11'));var Redis=require('ioredis');var authService=require(_0xd780('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd780('0x13'));var hardwareService=require(_0xd780('0x14'));var logger=require(_0xd780('0x15'))(_0xd780('0x16'));var utils=require(_0xd780('0x17'));var config=require(_0xd780('0x18'));var licenseUtil=require(_0xd780('0x19'));var db=require(_0xd780('0x1a'))['db'];function respondWithStatusCode(_0x294cfe,_0x305959){_0x305959=_0x305959||0xcc;return function(_0x105a12){if(_0x105a12){return _0x294cfe[_0xd780('0x1b')](_0x305959);}return _0x294cfe[_0xd780('0x1c')](_0x305959)[_0xd780('0x1d')]();};}function respondWithResult(_0x4b2b7b,_0x295b07){_0x295b07=_0x295b07||0xc8;return function(_0x7f9fdc){if(_0x7f9fdc){return _0x4b2b7b['status'](_0x295b07)[_0xd780('0x1e')](_0x7f9fdc);}};}function respondWithFilteredResult(_0xe5a6af,_0x42b945){return function(_0x5e92c5){if(_0x5e92c5){var _0x4bca84=typeof _0x42b945[_0xd780('0x1f')]==='undefined'&&typeof _0x42b945[_0xd780('0x20')]===_0xd780('0x21');var _0x4d8436=_0x5e92c5[_0xd780('0x22')];var _0x5c0281=_0x4bca84?0x0:_0x42b945[_0xd780('0x1f')];var _0x296ffe=_0x4bca84?_0x5e92c5['count']:_0x42b945['offset']+_0x42b945[_0xd780('0x20')];var _0x38422a;if(_0x296ffe>=_0x4d8436){_0x296ffe=_0x4d8436;_0x38422a=0xc8;}else{_0x38422a=0xce;}_0xe5a6af[_0xd780('0x1c')](_0x38422a);return _0xe5a6af['set']('Content-Range',_0x5c0281+'-'+_0x296ffe+'/'+_0x4d8436)['json'](_0x5e92c5);}return null;};}function patchUpdates(_0x82ad57){return function(_0x1044ac){try{jsonpatch[_0xd780('0x23')](_0x1044ac,_0x82ad57,!![]);}catch(_0x694c5){return BPromise[_0xd780('0x24')](_0x694c5);}return _0x1044ac[_0xd780('0x25')]();};}function saveUpdates(_0x3ca117,_0x11ca8d){return function(_0x2d6975){if(_0x2d6975){return _0x2d6975[_0xd780('0x26')](_0x3ca117)[_0xd780('0x27')](function(_0x24bd9f){return _0x24bd9f;});}return null;};}function removeEntity(_0x9d7a7c,_0x2db5de){return function(_0x2f4dd9){if(_0x2f4dd9){return _0x2f4dd9[_0xd780('0x28')]()[_0xd780('0x27')](function(){_0x9d7a7c['status'](0xcc)[_0xd780('0x1d')]();});}};}function handleEntityNotFound(_0x4ab7ac,_0x1dae5f){return function(_0x1357fe){if(!_0x1357fe){_0x4ab7ac[_0xd780('0x1b')](0x194);}return _0x1357fe;};}function handleError(_0x4c6872,_0x151e31){_0x151e31=_0x151e31||0x1f4;return function(_0x2da698){logger['error'](_0x2da698['stack']);if(_0x2da698[_0xd780('0x29')]){delete _0x2da698['name'];}_0x4c6872[_0xd780('0x1c')](_0x151e31)['send'](_0x2da698);};}exports[_0xd780('0x2a')]=function(_0x589e13,_0xc7c3d7){var _0x3e1717={},_0x1c9f9e={},_0x1886fb={'count':0x0,'rows':[]};var _0x177ad9=_[_0xd780('0x2b')](db['SmsQueueReport'][_0xd780('0x2c')],function(_0x3ba9dd){return{'name':_0x3ba9dd['fieldName'],'type':_0x3ba9dd[_0xd780('0x2d')][_0xd780('0x2e')]};});_0x1c9f9e[_0xd780('0x2f')]=_[_0xd780('0x2b')](_0x177ad9,_0xd780('0x29'));_0x1c9f9e['query']=_[_0xd780('0x30')](_0x589e13['query']);_0x1c9f9e['filters']=_[_0xd780('0x31')](_0x1c9f9e[_0xd780('0x2f')],_0x1c9f9e[_0xd780('0x32')]);_0x3e1717[_0xd780('0x33')]=_[_0xd780('0x31')](_0x1c9f9e[_0xd780('0x2f')],qs[_0xd780('0x34')](_0x589e13[_0xd780('0x32')][_0xd780('0x34')]));_0x3e1717[_0xd780('0x33')]=_0x3e1717[_0xd780('0x33')]['length']?_0x3e1717['attributes']:_0x1c9f9e[_0xd780('0x2f')];if(!_0x589e13[_0xd780('0x32')][_0xd780('0x35')](_0xd780('0x36'))){_0x3e1717[_0xd780('0x20')]=qs[_0xd780('0x20')](_0x589e13[_0xd780('0x32')]['limit']);_0x3e1717['offset']=qs[_0xd780('0x1f')](_0x589e13[_0xd780('0x32')][_0xd780('0x1f')]);}_0x3e1717[_0xd780('0x37')]=qs['sort'](_0x589e13['query'][_0xd780('0x38')]);_0x3e1717[_0xd780('0x39')]=qs[_0xd780('0x3a')](_[_0xd780('0x3b')](_0x589e13[_0xd780('0x32')],_0x1c9f9e[_0xd780('0x3a')]),_0x177ad9);if(_0x589e13['query']['filter']){_0x3e1717[_0xd780('0x39')]=_[_0xd780('0x3c')](_0x3e1717[_0xd780('0x39')],{'$or':_[_0xd780('0x2b')](_0x177ad9,function(_0x11d991){if(_0x11d991[_0xd780('0x2d')]!==_0xd780('0x3d')){var _0xdeee1d={};_0xdeee1d[_0x11d991['name']]={'$like':'%'+_0x589e13[_0xd780('0x32')][_0xd780('0x3e')]+'%'};return _0xdeee1d;}})});}_0x3e1717=_[_0xd780('0x3c')]({},_0x3e1717,_0x589e13['options']);var _0x4cf288={'where':_0x3e1717[_0xd780('0x39')]};return db[_0xd780('0x3f')][_0xd780('0x22')](_0x4cf288)[_0xd780('0x27')](function(_0x303b04){_0x1886fb[_0xd780('0x22')]=_0x303b04;if(_0x589e13[_0xd780('0x32')]['includeAll']){_0x3e1717[_0xd780('0x40')]=[{'all':!![]}];}return db[_0xd780('0x3f')][_0xd780('0x41')](_0x3e1717);})['then'](function(_0x38d044){_0x1886fb[_0xd780('0x42')]=_0x38d044;return _0x1886fb;})[_0xd780('0x27')](respondWithFilteredResult(_0xc7c3d7,_0x3e1717))[_0xd780('0x43')](handleError(_0xc7c3d7,null));};exports[_0xd780('0x44')]=function(_0x254d65,_0x333859){var _0x17693c={'raw':!![],'where':{'id':_0x254d65[_0xd780('0x45')]['id']}},_0x3bd8de={};_0x3bd8de[_0xd780('0x2f')]=_[_0xd780('0x30')](db[_0xd780('0x3f')][_0xd780('0x2c')]);_0x3bd8de[_0xd780('0x32')]=_[_0xd780('0x30')](_0x254d65[_0xd780('0x32')]);_0x3bd8de[_0xd780('0x3a')]=_['intersection'](_0x3bd8de['model'],_0x3bd8de[_0xd780('0x32')]);_0x17693c[_0xd780('0x33')]=_[_0xd780('0x31')](_0x3bd8de[_0xd780('0x2f')],qs[_0xd780('0x34')](_0x254d65[_0xd780('0x32')][_0xd780('0x34')]));_0x17693c[_0xd780('0x33')]=_0x17693c[_0xd780('0x33')][_0xd780('0x46')]?_0x17693c[_0xd780('0x33')]:_0x3bd8de['model'];if(_0x254d65['query']['includeAll']){_0x17693c[_0xd780('0x40')]=[{'all':!![]}];}_0x17693c=_['merge']({},_0x17693c,_0x254d65[_0xd780('0x47')]);return db[_0xd780('0x3f')][_0xd780('0x48')](_0x17693c)['then'](handleEntityNotFound(_0x333859,null))[_0xd780('0x27')](respondWithResult(_0x333859,null))[_0xd780('0x43')](handleError(_0x333859,null));};exports[_0xd780('0x49')]=function(_0x46734a,_0x371449){return db[_0xd780('0x3f')]['create'](_0x46734a[_0xd780('0x4a')],{})[_0xd780('0x27')](respondWithResult(_0x371449,0xc9))['catch'](handleError(_0x371449,null));};exports['update']=function(_0x254b44,_0x30f4d6){if(_0x254b44[_0xd780('0x4a')]['id']){delete _0x254b44['body']['id'];}return db[_0xd780('0x3f')][_0xd780('0x48')]({'where':{'id':_0x254b44[_0xd780('0x45')]['id']}})[_0xd780('0x27')](handleEntityNotFound(_0x30f4d6,null))[_0xd780('0x27')](saveUpdates(_0x254b44[_0xd780('0x4a')],null))['then'](respondWithResult(_0x30f4d6,null))[_0xd780('0x43')](handleError(_0x30f4d6,null));};exports[_0xd780('0x28')]=function(_0x5696ae,_0x12db16){return db[_0xd780('0x3f')][_0xd780('0x48')]({'where':{'id':_0x5696ae[_0xd780('0x45')]['id']}})[_0xd780('0x27')](handleEntityNotFound(_0x12db16,null))['then'](removeEntity(_0x12db16,null))['catch'](handleError(_0x12db16,null));};exports[_0xd780('0x4b')]=function(_0x234173,_0x5b9a31){return db[_0xd780('0x3f')]['describe']()[_0xd780('0x27')](respondWithResult(_0x5b9a31,null))[_0xd780('0x43')](handleError(_0x5b9a31,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index d5d9697..9b52d05 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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x971907,_0x1ee80e){var _0x93c3c5=function(_0xc106da){while(--_0xc106da){_0x971907['push'](_0x971907['shift']());}};_0x93c3c5(++_0x1ee80e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x29976,_0x35de12){var _0x5cd575=function(_0x5cfc4f){while(--_0x5cfc4f){_0x29976['push'](_0x29976['shift']());}};_0x5cd575(++_0x35de12);}(_0xe706,0xa3));var _0x6e70=function(_0x2fc69b,_0x55537d){_0x2fc69b=_0x2fc69b-0x0;var _0x25e3c9=_0xe706[_0x2fc69b];return _0x25e3c9;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index bf9343f..4bd0b4d 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 _0xd8d1=['SmsQueueReport','body','raw','catch','UpdateSmsQueueReport','options','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','CreateSmsQueueReport'];(function(_0x1a475d,_0x29ef7e){var _0x15b8de=function(_0x56d528){while(--_0x56d528){_0x1a475d['push'](_0x1a475d['shift']());}};_0x15b8de(++_0x29ef7e);}(_0xd8d1,0x111));var _0x1d8d=function(_0x49c78a,_0x1e1877){_0x49c78a=_0x49c78a-0x0;var _0x503efe=_0xd8d1[_0x49c78a];return _0x503efe;};'use strict';var _=require('lodash');var util=require(_0x1d8d('0x0'));var moment=require(_0x1d8d('0x1'));var BPromise=require(_0x1d8d('0x2'));var rs=require(_0x1d8d('0x3'));var fs=require('fs');var Redis=require(_0x1d8d('0x4'));var db=require(_0x1d8d('0x5'))['db'];var utils=require(_0x1d8d('0x6'));var logger=require(_0x1d8d('0x7'))(_0x1d8d('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d8d('0x9'));var client=jayson[_0x1d8d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1052df,_0x246a71,_0x162764){return new BPromise(function(_0x2e12e1,_0xbb7ba3){return client[_0x1d8d('0xb')](_0x1052df,_0x162764)[_0x1d8d('0xc')](function(_0xe9d893){logger[_0x1d8d('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x246a71,_0x1d8d('0xe'));logger[_0x1d8d('0xf')](_0x1d8d('0x10'),_0x246a71,'request\x20sent',JSON[_0x1d8d('0x11')](_0xe9d893));if(_0xe9d893[_0x1d8d('0x12')]){if(_0xe9d893[_0x1d8d('0x12')][_0x1d8d('0x13')]===0x1f4){logger[_0x1d8d('0x12')](_0x1d8d('0x14'),_0x246a71,_0xe9d893['error'][_0x1d8d('0x15')]);return _0xbb7ba3(_0xe9d893[_0x1d8d('0x12')][_0x1d8d('0x15')]);}logger[_0x1d8d('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x246a71,_0xe9d893[_0x1d8d('0x12')]['message']);return _0x2e12e1(_0xe9d893['error'][_0x1d8d('0x15')]);}else{logger[_0x1d8d('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x246a71,_0x1d8d('0xe'));_0x2e12e1(_0xe9d893[_0x1d8d('0x16')][_0x1d8d('0x15')]);}})['catch'](function(_0x4aa0dc){logger['error'](_0x1d8d('0x14'),_0x246a71,_0x4aa0dc);_0xbb7ba3(_0x4aa0dc);});});}exports[_0x1d8d('0x17')]=function(_0x5b3a5b){var _0xecb3c6=this;return new Promise(function(_0x2a9c92,_0x1573a6){return db[_0x1d8d('0x18')]['create'](_0x5b3a5b[_0x1d8d('0x19')],{'raw':_0x5b3a5b['options']?_0x5b3a5b['options'][_0x1d8d('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x341a81){logger[_0x1d8d('0xd')](_0x1d8d('0x17'),_0x5b3a5b);logger['debug']('CreateSmsQueueReport',_0x5b3a5b,JSON[_0x1d8d('0x11')](_0x341a81));_0x2a9c92(_0x341a81);})[_0x1d8d('0x1b')](function(_0x2e0643){logger[_0x1d8d('0x12')](_0x1d8d('0x17'),_0x2e0643[_0x1d8d('0x15')],_0x5b3a5b);_0x1573a6(_0xecb3c6[_0x1d8d('0x12')](0x1f4,_0x2e0643[_0x1d8d('0x15')]));});});};exports[_0x1d8d('0x1c')]=function(_0x51c4cd){var _0xe071fc=this;return new Promise(function(_0x5840d3,_0xfdf559){return db[_0x1d8d('0x18')]['update'](_0x51c4cd[_0x1d8d('0x19')],{'raw':_0x51c4cd[_0x1d8d('0x1d')]?_0x51c4cd[_0x1d8d('0x1d')][_0x1d8d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51c4cd[_0x1d8d('0x1d')]?_0x51c4cd[_0x1d8d('0x1d')][_0x1d8d('0x1e')]||null:null,'attributes':_0x51c4cd[_0x1d8d('0x1d')]?_0x51c4cd[_0x1d8d('0x1d')][_0x1d8d('0x1f')]||null:null,'limit':_0x51c4cd['options']?_0x51c4cd[_0x1d8d('0x1d')][_0x1d8d('0x20')]||null:null})[_0x1d8d('0xc')](function(_0x53792c){logger[_0x1d8d('0xd')](_0x1d8d('0x1c'),_0x51c4cd);logger[_0x1d8d('0xf')](_0x1d8d('0x1c'),_0x51c4cd,JSON['stringify'](_0x53792c));_0x5840d3(_0x53792c);})[_0x1d8d('0x1b')](function(_0xec69e8){logger[_0x1d8d('0x12')](_0x1d8d('0x1c'),_0xec69e8['message'],_0x51c4cd);_0xfdf559(_0xe071fc[_0x1d8d('0x12')](0x1f4,_0xec69e8[_0x1d8d('0x15')]));});});}; \ No newline at end of file +var _0xfaa2=['create','options','debug','UpdateSmsQueueReport','update','body','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0x12b859,_0x40804e){var _0x867976=function(_0x43246a){while(--_0x43246a){_0x12b859['push'](_0x12b859['shift']());}};_0x867976(++_0x40804e);}(_0xfaa2,0x8d));var _0x2faa=function(_0x286e3d,_0x9de1b){_0x286e3d=_0x286e3d-0x0;var _0xeecff4=_0xfaa2[_0x286e3d];return _0xeecff4;};'use strict';var _=require(_0x2faa('0x0'));var util=require(_0x2faa('0x1'));var moment=require(_0x2faa('0x2'));var BPromise=require(_0x2faa('0x3'));var rs=require(_0x2faa('0x4'));var fs=require('fs');var Redis=require(_0x2faa('0x5'));var db=require(_0x2faa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2faa('0x7'))('rpc');var config=require(_0x2faa('0x8'));var jayson=require(_0x2faa('0x9'));var client=jayson[_0x2faa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47585c,_0x24a01a,_0x40db7a){return new BPromise(function(_0x5abd79,_0x383fac){return client[_0x2faa('0xb')](_0x47585c,_0x40db7a)[_0x2faa('0xc')](function(_0x1a7e0c){logger[_0x2faa('0xd')](_0x2faa('0xe'),_0x24a01a,_0x2faa('0xf'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x24a01a,_0x2faa('0xf'),JSON[_0x2faa('0x10')](_0x1a7e0c));if(_0x1a7e0c[_0x2faa('0x11')]){if(_0x1a7e0c[_0x2faa('0x11')][_0x2faa('0x12')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x24a01a,_0x1a7e0c['error'][_0x2faa('0x13')]);return _0x383fac(_0x1a7e0c['error'][_0x2faa('0x13')]);}logger[_0x2faa('0x11')](_0x2faa('0xe'),_0x24a01a,_0x1a7e0c['error'][_0x2faa('0x13')]);return _0x5abd79(_0x1a7e0c[_0x2faa('0x11')][_0x2faa('0x13')]);}else{logger[_0x2faa('0xd')](_0x2faa('0xe'),_0x24a01a,_0x2faa('0xf'));_0x5abd79(_0x1a7e0c[_0x2faa('0x14')]['message']);}})[_0x2faa('0x15')](function(_0x29be10){logger[_0x2faa('0x11')](_0x2faa('0xe'),_0x24a01a,_0x29be10);_0x383fac(_0x29be10);});});}exports[_0x2faa('0x16')]=function(_0x4cf018){var _0x6cc777=this;return new Promise(function(_0x4a4c72,_0x145621){return db[_0x2faa('0x17')][_0x2faa('0x18')](_0x4cf018['body'],{'raw':_0x4cf018['options']?_0x4cf018[_0x2faa('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2faa('0xc')](function(_0x2a5028){logger['info'](_0x2faa('0x16'),_0x4cf018);logger[_0x2faa('0x1a')]('CreateSmsQueueReport',_0x4cf018,JSON[_0x2faa('0x10')](_0x2a5028));_0x4a4c72(_0x2a5028);})[_0x2faa('0x15')](function(_0x1222f9){logger[_0x2faa('0x11')](_0x2faa('0x16'),_0x1222f9[_0x2faa('0x13')],_0x4cf018);_0x145621(_0x6cc777[_0x2faa('0x11')](0x1f4,_0x1222f9[_0x2faa('0x13')]));});});};exports[_0x2faa('0x1b')]=function(_0x5eaac9){var _0x153cba=this;return new Promise(function(_0x33f2e7,_0x1c74f5){return db[_0x2faa('0x17')][_0x2faa('0x1c')](_0x5eaac9[_0x2faa('0x1d')],{'raw':_0x5eaac9['options']?_0x5eaac9[_0x2faa('0x19')][_0x2faa('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eaac9[_0x2faa('0x19')]?_0x5eaac9[_0x2faa('0x19')][_0x2faa('0x1f')]||null:null,'attributes':_0x5eaac9[_0x2faa('0x19')]?_0x5eaac9['options']['attributes']||null:null,'limit':_0x5eaac9[_0x2faa('0x19')]?_0x5eaac9[_0x2faa('0x19')][_0x2faa('0x20')]||null:null})[_0x2faa('0xc')](function(_0x1b19fc){logger[_0x2faa('0xd')](_0x2faa('0x1b'),_0x5eaac9);logger[_0x2faa('0x1a')]('UpdateSmsQueueReport',_0x5eaac9,JSON['stringify'](_0x1b19fc));_0x33f2e7(_0x1b19fc);})['catch'](function(_0x221149){logger[_0x2faa('0x11')](_0x2faa('0x1b'),_0x221149[_0x2faa('0x13')],_0x5eaac9);_0x1c74f5(_0x153cba[_0x2faa('0x11')](0x1f4,_0x221149['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 6966752..624d51c 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 _0x446c=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','describe','get','/:id','post','create','put','update','delete'];(function(_0x15ed93,_0x29136b){var _0x46b0c7=function(_0x24bcb2){while(--_0x24bcb2){_0x15ed93['push'](_0x15ed93['shift']());}};_0x46b0c7(++_0x29136b);}(_0x446c,0x156));var _0xc446=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0x446c[_0x1034ee];return _0x2922af;};'use strict';var multer=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var path=require(_0xc446('0x2'));var timeout=require(_0xc446('0x3'));var express=require('express');var router=express[_0xc446('0x4')]();var fs_extra=require(_0xc446('0x5'));var auth=require(_0xc446('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc446('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0xc446('0x8')](),controller[_0xc446('0x9')]);router['get']('/describe',auth[_0xc446('0x8')](),controller[_0xc446('0xa')]);router[_0xc446('0xb')](_0xc446('0xc'),auth[_0xc446('0x8')](),controller['show']);router[_0xc446('0xd')]('/',auth[_0xc446('0x8')](),controller[_0xc446('0xe')]);router[_0xc446('0xf')]('/:id',auth[_0xc446('0x8')](),controller[_0xc446('0x10')]);router[_0xc446('0x11')](_0xc446('0xc'),auth[_0xc446('0x8')](),controller[_0xc446('0x12')]);module[_0xc446('0x13')]=router; \ No newline at end of file +var _0xfd0f=['index','/describe','describe','/:id','show','post','put','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated'];(function(_0x4f2410,_0xb4aa3b){var _0x25409d=function(_0x914ae5){while(--_0x914ae5){_0x4f2410['push'](_0x4f2410['shift']());}};_0x25409d(++_0xb4aa3b);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x2ce645,_0x4051c0){_0x2ce645=_0x2ce645-0x0;var _0x5e9577=_0xfd0f[_0x2ce645];return _0x5e9577;};'use strict';var multer=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var path=require('path');var timeout=require(_0xffd0('0x2'));var express=require(_0xffd0('0x3'));var router=express[_0xffd0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xffd0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xffd0('0x6'));var controller=require(_0xffd0('0x7'));router[_0xffd0('0x8')]('/',auth[_0xffd0('0x9')](),controller[_0xffd0('0xa')]);router[_0xffd0('0x8')](_0xffd0('0xb'),auth[_0xffd0('0x9')](),controller[_0xffd0('0xc')]);router['get'](_0xffd0('0xd'),auth[_0xffd0('0x9')](),controller[_0xffd0('0xe')]);router[_0xffd0('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xffd0('0x10')](_0xffd0('0xd'),auth[_0xffd0('0x9')](),controller['update']);router['delete'](_0xffd0('0xd'),auth[_0xffd0('0x9')](),controller['destroy']);module[_0xffd0('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 16b8c7c..89c7e28 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x4bb93d,_0x1cda9a){var _0x106b4f=function(_0x4aa8d1){while(--_0x4aa8d1){_0x4bb93d['push'](_0x4bb93d['shift']());}};_0x106b4f(++_0x1cda9a);}(_0x34e8,0x12c));var _0x834e=function(_0x427455,_0x3b5a8e){_0x427455=_0x427455-0x0;var _0x1011ca=_0x34e8[_0x427455];return _0x1011ca;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x269262,_0x41abdc){var _0x4f2a36=function(_0xeea6c1){while(--_0xeea6c1){_0x269262['push'](_0x269262['shift']());}};_0x4f2a36(++_0x41abdc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0xcb91[_0x2ff762];return _0x158b02;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index a246ce3..77b3718 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 _0x50f5=['limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x55ff38,_0x5c783c){var _0xa17c2b=function(_0x1a7f76){while(--_0x1a7f76){_0x55ff38['push'](_0x55ff38['shift']());}};_0xa17c2b(++_0x5c783c);}(_0x50f5,0x168));var _0x550f=function(_0x46281c,_0x364880){_0x46281c=_0x46281c-0x0;var _0x15cd10=_0x50f5[_0x46281c];return _0x15cd10;};'use strict';var emlformat=require(_0x550f('0x0'));var rimraf=require(_0x550f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x550f('0x2'));var rp=require(_0x550f('0x3'));var moment=require(_0x550f('0x4'));var BPromise=require(_0x550f('0x5'));var Mustache=require(_0x550f('0x6'));var util=require(_0x550f('0x7'));var path=require(_0x550f('0x8'));var sox=require(_0x550f('0x9'));var csv=require(_0x550f('0xa'));var ejs=require(_0x550f('0xb'));var fs=require('fs');var fs_extra=require(_0x550f('0xc'));var _=require(_0x550f('0xd'));var squel=require(_0x550f('0xe'));var crypto=require(_0x550f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x550f('0x10'));var toCsv=require(_0x550f('0xa'));var querystring=require(_0x550f('0x11'));var Papa=require(_0x550f('0x12'));var Redis=require(_0x550f('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x550f('0x14'))(_0x550f('0x15'));var utils=require(_0x550f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x550f('0x17'));var db=require(_0x550f('0x18'))['db'];function respondWithStatusCode(_0x2752be,_0x1f978d){_0x1f978d=_0x1f978d||0xcc;return function(_0x12f514){if(_0x12f514){return _0x2752be[_0x550f('0x19')](_0x1f978d);}return _0x2752be[_0x550f('0x1a')](_0x1f978d)['end']();};}function respondWithResult(_0x2de4a1,_0x108591){_0x108591=_0x108591||0xc8;return function(_0x5af98f){if(_0x5af98f){return _0x2de4a1[_0x550f('0x1a')](_0x108591)[_0x550f('0x1b')](_0x5af98f);}};}function respondWithFilteredResult(_0x29a198,_0x172ff9){return function(_0x5b98e3){if(_0x5b98e3){var _0xd2964d=typeof _0x172ff9[_0x550f('0x1c')]===_0x550f('0x1d')&&typeof _0x172ff9[_0x550f('0x1e')]===_0x550f('0x1d');var _0x3ed0b4=_0x5b98e3['count'];var _0x1947aa=_0xd2964d?0x0:_0x172ff9[_0x550f('0x1c')];var _0x63349=_0xd2964d?_0x5b98e3['count']:_0x172ff9[_0x550f('0x1c')]+_0x172ff9[_0x550f('0x1e')];var _0x21af84;if(_0x63349>=_0x3ed0b4){_0x63349=_0x3ed0b4;_0x21af84=0xc8;}else{_0x21af84=0xce;}_0x29a198[_0x550f('0x1a')](_0x21af84);return _0x29a198[_0x550f('0x1f')](_0x550f('0x20'),_0x1947aa+'-'+_0x63349+'/'+_0x3ed0b4)[_0x550f('0x1b')](_0x5b98e3);}return null;};}function patchUpdates(_0x56ec0c){return function(_0x2cfafc){try{jsonpatch['apply'](_0x2cfafc,_0x56ec0c,!![]);}catch(_0x2fa0a9){return BPromise[_0x550f('0x21')](_0x2fa0a9);}return _0x2cfafc[_0x550f('0x22')]();};}function saveUpdates(_0x35a441,_0x46e135){return function(_0x2ddf32){if(_0x2ddf32){return _0x2ddf32[_0x550f('0x23')](_0x35a441)[_0x550f('0x24')](function(_0x5101f8){return _0x5101f8;});}return null;};}function removeEntity(_0x26672a,_0x112838){return function(_0x130832){if(_0x130832){return _0x130832[_0x550f('0x25')]()[_0x550f('0x24')](function(){_0x26672a[_0x550f('0x1a')](0xcc)[_0x550f('0x26')]();});}};}function handleEntityNotFound(_0x14d9ec,_0x4455a1){return function(_0x5b1651){if(!_0x5b1651){_0x14d9ec[_0x550f('0x19')](0x194);}return _0x5b1651;};}function handleError(_0x36dd1a,_0x5d9ff5){_0x5d9ff5=_0x5d9ff5||0x1f4;return function(_0x132763){logger[_0x550f('0x27')](_0x132763['stack']);if(_0x132763[_0x550f('0x28')]){delete _0x132763['name'];}_0x36dd1a[_0x550f('0x1a')](_0x5d9ff5)[_0x550f('0x29')](_0x132763);};}exports[_0x550f('0x2a')]=function(_0x4b84dc,_0xccbcd1){var _0x2563c9={},_0xb4e93={},_0x478c95={'count':0x0,'rows':[]};var _0x41d9a3=_[_0x550f('0x2b')](db[_0x550f('0x2c')][_0x550f('0x2d')],function(_0xb09fbf){return{'name':_0xb09fbf[_0x550f('0x2e')],'type':_0xb09fbf[_0x550f('0x2f')][_0x550f('0x30')]};});_0xb4e93[_0x550f('0x31')]=_[_0x550f('0x2b')](_0x41d9a3,_0x550f('0x28'));_0xb4e93[_0x550f('0x32')]=_[_0x550f('0x33')](_0x4b84dc[_0x550f('0x32')]);_0xb4e93[_0x550f('0x34')]=_[_0x550f('0x35')](_0xb4e93[_0x550f('0x31')],_0xb4e93[_0x550f('0x32')]);_0x2563c9[_0x550f('0x36')]=_[_0x550f('0x35')](_0xb4e93[_0x550f('0x31')],qs[_0x550f('0x37')](_0x4b84dc[_0x550f('0x32')]['fields']));_0x2563c9[_0x550f('0x36')]=_0x2563c9[_0x550f('0x36')]['length']?_0x2563c9[_0x550f('0x36')]:_0xb4e93[_0x550f('0x31')];if(!_0x4b84dc[_0x550f('0x32')][_0x550f('0x38')](_0x550f('0x39'))){_0x2563c9[_0x550f('0x1e')]=qs[_0x550f('0x1e')](_0x4b84dc[_0x550f('0x32')][_0x550f('0x1e')]);_0x2563c9['offset']=qs[_0x550f('0x1c')](_0x4b84dc['query'][_0x550f('0x1c')]);}_0x2563c9['order']=qs['sort'](_0x4b84dc[_0x550f('0x32')][_0x550f('0x3a')]);_0x2563c9[_0x550f('0x3b')]=qs[_0x550f('0x34')](_[_0x550f('0x3c')](_0x4b84dc['query'],_0xb4e93[_0x550f('0x34')]),_0x41d9a3);if(_0x4b84dc[_0x550f('0x32')]['filter']){_0x2563c9[_0x550f('0x3b')]=_[_0x550f('0x3d')](_0x2563c9[_0x550f('0x3b')],{'$or':_['map'](_0x41d9a3,function(_0x4ca3fe){if(_0x4ca3fe[_0x550f('0x2f')]!==_0x550f('0x3e')){var _0x9b0bf9={};_0x9b0bf9[_0x4ca3fe[_0x550f('0x28')]]={'$like':'%'+_0x4b84dc[_0x550f('0x32')][_0x550f('0x3f')]+'%'};return _0x9b0bf9;}})});}_0x2563c9=_[_0x550f('0x3d')]({},_0x2563c9,_0x4b84dc[_0x550f('0x40')]);var _0x1c5ea2={'where':_0x2563c9[_0x550f('0x3b')]};return db[_0x550f('0x2c')][_0x550f('0x41')](_0x1c5ea2)[_0x550f('0x24')](function(_0x50b946){_0x478c95['count']=_0x50b946;if(_0x4b84dc[_0x550f('0x32')][_0x550f('0x42')]){_0x2563c9[_0x550f('0x43')]=[{'all':!![]}];}return db[_0x550f('0x2c')][_0x550f('0x44')](_0x2563c9);})[_0x550f('0x24')](function(_0x41cf51){_0x478c95[_0x550f('0x45')]=_0x41cf51;return _0x478c95;})['then'](respondWithFilteredResult(_0xccbcd1,_0x2563c9))[_0x550f('0x46')](handleError(_0xccbcd1,null));};exports[_0x550f('0x47')]=function(_0x2cc1c1,_0x460128){var _0x33df62={'raw':!![],'where':{'id':_0x2cc1c1[_0x550f('0x48')]['id']}},_0x2ddf81={};_0x2ddf81[_0x550f('0x31')]=_[_0x550f('0x33')](db['SmsTransferReport'][_0x550f('0x2d')]);_0x2ddf81[_0x550f('0x32')]=_[_0x550f('0x33')](_0x2cc1c1['query']);_0x2ddf81[_0x550f('0x34')]=_[_0x550f('0x35')](_0x2ddf81['model'],_0x2ddf81['query']);_0x33df62['attributes']=_[_0x550f('0x35')](_0x2ddf81[_0x550f('0x31')],qs[_0x550f('0x37')](_0x2cc1c1[_0x550f('0x32')][_0x550f('0x37')]));_0x33df62['attributes']=_0x33df62['attributes'][_0x550f('0x49')]?_0x33df62[_0x550f('0x36')]:_0x2ddf81[_0x550f('0x31')];if(_0x2cc1c1['query'][_0x550f('0x42')]){_0x33df62[_0x550f('0x43')]=[{'all':!![]}];}_0x33df62=_[_0x550f('0x3d')]({},_0x33df62,_0x2cc1c1[_0x550f('0x40')]);return db[_0x550f('0x2c')][_0x550f('0x4a')](_0x33df62)['then'](handleEntityNotFound(_0x460128,null))[_0x550f('0x24')](respondWithResult(_0x460128,null))[_0x550f('0x46')](handleError(_0x460128,null));};exports[_0x550f('0x4b')]=function(_0x34ffe8,_0x91b230){return db[_0x550f('0x2c')]['create'](_0x34ffe8[_0x550f('0x4c')],{})['then'](respondWithResult(_0x91b230,0xc9))['catch'](handleError(_0x91b230,null));};exports[_0x550f('0x23')]=function(_0x3616cd,_0x3410d6){if(_0x3616cd[_0x550f('0x4c')]['id']){delete _0x3616cd[_0x550f('0x4c')]['id'];}return db['SmsTransferReport'][_0x550f('0x4a')]({'where':{'id':_0x3616cd[_0x550f('0x48')]['id']}})[_0x550f('0x24')](handleEntityNotFound(_0x3410d6,null))['then'](saveUpdates(_0x3616cd['body'],null))[_0x550f('0x24')](respondWithResult(_0x3410d6,null))[_0x550f('0x46')](handleError(_0x3410d6,null));};exports[_0x550f('0x25')]=function(_0x4f5e4e,_0x1c2d4e){return db[_0x550f('0x2c')][_0x550f('0x4a')]({'where':{'id':_0x4f5e4e[_0x550f('0x48')]['id']}})[_0x550f('0x24')](handleEntityNotFound(_0x1c2d4e,null))[_0x550f('0x24')](removeEntity(_0x1c2d4e,null))['catch'](handleError(_0x1c2d4e,null));};exports[_0x550f('0x4d')]=function(_0x464fe8,_0x27d386){return db[_0x550f('0x2c')][_0x550f('0x4d')]()[_0x550f('0x24')](respondWithResult(_0x27d386,null))[_0x550f('0x46')](handleError(_0x27d386,null));}; \ No newline at end of file +var _0x476f=['end','status','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','find','create','body','update','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2cc76e,_0x244f64){var _0x21bfbf=function(_0x4c6b6e){while(--_0x4c6b6e){_0x2cc76e['push'](_0x2cc76e['shift']());}};_0x21bfbf(++_0x244f64);}(_0x476f,0x80));var _0xf476=function(_0x2c172e,_0x24c34c){_0x2c172e=_0x2c172e-0x0;var _0x561062=_0x476f[_0x2c172e];return _0x561062;};'use strict';var emlformat=require(_0xf476('0x0'));var rimraf=require(_0xf476('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf476('0x2'));var rp=require(_0xf476('0x3'));var moment=require('moment');var BPromise=require(_0xf476('0x4'));var Mustache=require(_0xf476('0x5'));var util=require(_0xf476('0x6'));var path=require(_0xf476('0x7'));var sox=require('sox');var csv=require(_0xf476('0x8'));var ejs=require(_0xf476('0x9'));var fs=require('fs');var fs_extra=require(_0xf476('0xa'));var _=require(_0xf476('0xb'));var squel=require(_0xf476('0xc'));var crypto=require(_0xf476('0xd'));var jsforce=require(_0xf476('0xe'));var deskjs=require(_0xf476('0xf'));var toCsv=require(_0xf476('0x8'));var querystring=require(_0xf476('0x10'));var Papa=require(_0xf476('0x11'));var Redis=require(_0xf476('0x12'));var authService=require(_0xf476('0x13'));var qs=require(_0xf476('0x14'));var as=require(_0xf476('0x15'));var hardwareService=require(_0xf476('0x16'));var logger=require('../../config/logger')(_0xf476('0x17'));var utils=require(_0xf476('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf476('0x19'));var db=require(_0xf476('0x1a'))['db'];function respondWithStatusCode(_0x1e836b,_0x9a2e85){_0x9a2e85=_0x9a2e85||0xcc;return function(_0xe9623a){if(_0xe9623a){return _0x1e836b[_0xf476('0x1b')](_0x9a2e85);}return _0x1e836b['status'](_0x9a2e85)[_0xf476('0x1c')]();};}function respondWithResult(_0x43d627,_0x5f3b49){_0x5f3b49=_0x5f3b49||0xc8;return function(_0x29f399){if(_0x29f399){return _0x43d627[_0xf476('0x1d')](_0x5f3b49)['json'](_0x29f399);}};}function respondWithFilteredResult(_0xe70ca8,_0x2e4e79){return function(_0x38df24){if(_0x38df24){var _0x2ca729=typeof _0x2e4e79[_0xf476('0x1e')]===_0xf476('0x1f')&&typeof _0x2e4e79['limit']===_0xf476('0x1f');var _0x3f4949=_0x38df24[_0xf476('0x20')];var _0x40d0b3=_0x2ca729?0x0:_0x2e4e79['offset'];var _0x518aa8=_0x2ca729?_0x38df24['count']:_0x2e4e79[_0xf476('0x1e')]+_0x2e4e79['limit'];var _0x3c7c1c;if(_0x518aa8>=_0x3f4949){_0x518aa8=_0x3f4949;_0x3c7c1c=0xc8;}else{_0x3c7c1c=0xce;}_0xe70ca8[_0xf476('0x1d')](_0x3c7c1c);return _0xe70ca8[_0xf476('0x21')](_0xf476('0x22'),_0x40d0b3+'-'+_0x518aa8+'/'+_0x3f4949)['json'](_0x38df24);}return null;};}function patchUpdates(_0x326640){return function(_0x43e871){try{jsonpatch[_0xf476('0x23')](_0x43e871,_0x326640,!![]);}catch(_0x2e4ec7){return BPromise[_0xf476('0x24')](_0x2e4ec7);}return _0x43e871[_0xf476('0x25')]();};}function saveUpdates(_0xf6f45a,_0xa11d71){return function(_0x8d4bce){if(_0x8d4bce){return _0x8d4bce['update'](_0xf6f45a)[_0xf476('0x26')](function(_0x5366da){return _0x5366da;});}return null;};}function removeEntity(_0x2fdb88,_0xe3117c){return function(_0x575688){if(_0x575688){return _0x575688[_0xf476('0x27')]()[_0xf476('0x26')](function(){_0x2fdb88['status'](0xcc)[_0xf476('0x1c')]();});}};}function handleEntityNotFound(_0x4d2179,_0x5482bd){return function(_0x392c72){if(!_0x392c72){_0x4d2179['sendStatus'](0x194);}return _0x392c72;};}function handleError(_0x134b49,_0x280276){_0x280276=_0x280276||0x1f4;return function(_0x55b839){logger[_0xf476('0x28')](_0x55b839[_0xf476('0x29')]);if(_0x55b839[_0xf476('0x2a')]){delete _0x55b839[_0xf476('0x2a')];}_0x134b49[_0xf476('0x1d')](_0x280276)[_0xf476('0x2b')](_0x55b839);};}exports[_0xf476('0x2c')]=function(_0x5d7d66,_0x519d6f){var _0x4f7334={},_0x93cddb={},_0x309168={'count':0x0,'rows':[]};var _0x26ad47=_[_0xf476('0x2d')](db[_0xf476('0x2e')][_0xf476('0x2f')],function(_0x440d91){return{'name':_0x440d91[_0xf476('0x30')],'type':_0x440d91[_0xf476('0x31')]['key']};});_0x93cddb[_0xf476('0x32')]=_[_0xf476('0x2d')](_0x26ad47,_0xf476('0x2a'));_0x93cddb['query']=_['keys'](_0x5d7d66[_0xf476('0x33')]);_0x93cddb[_0xf476('0x34')]=_[_0xf476('0x35')](_0x93cddb[_0xf476('0x32')],_0x93cddb[_0xf476('0x33')]);_0x4f7334['attributes']=_['intersection'](_0x93cddb[_0xf476('0x32')],qs[_0xf476('0x36')](_0x5d7d66['query'][_0xf476('0x36')]));_0x4f7334['attributes']=_0x4f7334[_0xf476('0x37')][_0xf476('0x38')]?_0x4f7334[_0xf476('0x37')]:_0x93cddb[_0xf476('0x32')];if(!_0x5d7d66[_0xf476('0x33')][_0xf476('0x39')]('nolimit')){_0x4f7334[_0xf476('0x3a')]=qs[_0xf476('0x3a')](_0x5d7d66[_0xf476('0x33')][_0xf476('0x3a')]);_0x4f7334['offset']=qs[_0xf476('0x1e')](_0x5d7d66['query']['offset']);}_0x4f7334['order']=qs[_0xf476('0x3b')](_0x5d7d66[_0xf476('0x33')][_0xf476('0x3b')]);_0x4f7334[_0xf476('0x3c')]=qs[_0xf476('0x34')](_[_0xf476('0x3d')](_0x5d7d66['query'],_0x93cddb[_0xf476('0x34')]),_0x26ad47);if(_0x5d7d66[_0xf476('0x33')][_0xf476('0x3e')]){_0x4f7334[_0xf476('0x3c')]=_['merge'](_0x4f7334[_0xf476('0x3c')],{'$or':_[_0xf476('0x2d')](_0x26ad47,function(_0x11a694){if(_0x11a694[_0xf476('0x31')]!==_0xf476('0x3f')){var _0x230096={};_0x230096[_0x11a694[_0xf476('0x2a')]]={'$like':'%'+_0x5d7d66[_0xf476('0x33')]['filter']+'%'};return _0x230096;}})});}_0x4f7334=_[_0xf476('0x40')]({},_0x4f7334,_0x5d7d66[_0xf476('0x41')]);var _0x5dba46={'where':_0x4f7334[_0xf476('0x3c')]};return db[_0xf476('0x2e')][_0xf476('0x20')](_0x5dba46)['then'](function(_0x1169eb){_0x309168[_0xf476('0x20')]=_0x1169eb;if(_0x5d7d66['query'][_0xf476('0x42')]){_0x4f7334[_0xf476('0x43')]=[{'all':!![]}];}return db[_0xf476('0x2e')][_0xf476('0x44')](_0x4f7334);})['then'](function(_0x294425){_0x309168[_0xf476('0x45')]=_0x294425;return _0x309168;})['then'](respondWithFilteredResult(_0x519d6f,_0x4f7334))['catch'](handleError(_0x519d6f,null));};exports['show']=function(_0xac1f23,_0x198a33){var _0x4c5a73={'raw':!![],'where':{'id':_0xac1f23[_0xf476('0x46')]['id']}},_0x215f37={};_0x215f37[_0xf476('0x32')]=_[_0xf476('0x47')](db[_0xf476('0x2e')][_0xf476('0x2f')]);_0x215f37['query']=_[_0xf476('0x47')](_0xac1f23[_0xf476('0x33')]);_0x215f37[_0xf476('0x34')]=_[_0xf476('0x35')](_0x215f37[_0xf476('0x32')],_0x215f37[_0xf476('0x33')]);_0x4c5a73[_0xf476('0x37')]=_[_0xf476('0x35')](_0x215f37[_0xf476('0x32')],qs['fields'](_0xac1f23[_0xf476('0x33')][_0xf476('0x36')]));_0x4c5a73[_0xf476('0x37')]=_0x4c5a73[_0xf476('0x37')]['length']?_0x4c5a73[_0xf476('0x37')]:_0x215f37['model'];if(_0xac1f23[_0xf476('0x33')]['includeAll']){_0x4c5a73[_0xf476('0x43')]=[{'all':!![]}];}_0x4c5a73=_['merge']({},_0x4c5a73,_0xac1f23[_0xf476('0x41')]);return db['SmsTransferReport'][_0xf476('0x48')](_0x4c5a73)['then'](handleEntityNotFound(_0x198a33,null))['then'](respondWithResult(_0x198a33,null))['catch'](handleError(_0x198a33,null));};exports[_0xf476('0x49')]=function(_0x9fb58c,_0x2deb8e){return db[_0xf476('0x2e')][_0xf476('0x49')](_0x9fb58c[_0xf476('0x4a')],{})[_0xf476('0x26')](respondWithResult(_0x2deb8e,0xc9))['catch'](handleError(_0x2deb8e,null));};exports[_0xf476('0x4b')]=function(_0x2dbae1,_0x52648c){if(_0x2dbae1[_0xf476('0x4a')]['id']){delete _0x2dbae1['body']['id'];}return db[_0xf476('0x2e')][_0xf476('0x48')]({'where':{'id':_0x2dbae1['params']['id']}})['then'](handleEntityNotFound(_0x52648c,null))[_0xf476('0x26')](saveUpdates(_0x2dbae1[_0xf476('0x4a')],null))[_0xf476('0x26')](respondWithResult(_0x52648c,null))[_0xf476('0x4c')](handleError(_0x52648c,null));};exports[_0xf476('0x27')]=function(_0x161213,_0x25b381){return db[_0xf476('0x2e')][_0xf476('0x48')]({'where':{'id':_0x161213['params']['id']}})['then'](handleEntityNotFound(_0x25b381,null))[_0xf476('0x26')](removeEntity(_0x25b381,null))[_0xf476('0x4c')](handleError(_0x25b381,null));};exports[_0xf476('0x4d')]=function(_0x429964,_0x11cd4c){return db[_0xf476('0x2e')][_0xf476('0x4d')]()[_0xf476('0x26')](respondWithResult(_0x11cd4c,null))[_0xf476('0x4c')](handleError(_0x11cd4c,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 00b3b8d..7c086d2 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 _0xf541=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','../../config/logger','moment','bluebird','request-promise'];(function(_0x41bf29,_0x53f9ca){var _0xe2aa4a=function(_0x91108c){while(--_0x91108c){_0x41bf29['push'](_0x41bf29['shift']());}};_0xe2aa4a(++_0x53f9ca);}(_0xf541,0x1f4));var _0x1f54=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0xf541[_0xeff2c3];return _0x2cade6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f54('0x0'))('api');var moment=require(_0x1f54('0x1'));var BPromise=require(_0x1f54('0x2'));var rp=require(_0x1f54('0x3'));var fs=require('fs');var path=require(_0x1f54('0x4'));var rimraf=require(_0x1f54('0x5'));var config=require(_0x1f54('0x6'));var attributes=require(_0x1f54('0x7'));module[_0x1f54('0x8')]=function(_0x538b5f,_0x3d1766){return _0x538b5f[_0x1f54('0x9')](_0x1f54('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1f54('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36f1=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x73e90b,_0x50204f){var _0x57757a=function(_0x499ea2){while(--_0x499ea2){_0x73e90b['push'](_0x73e90b['shift']());}};_0x57757a(++_0x50204f);}(_0x36f1,0x19f));var _0x136f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36f1[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x136f('0x0'));var util=require(_0x136f('0x1'));var logger=require(_0x136f('0x2'))('api');var moment=require(_0x136f('0x3'));var BPromise=require(_0x136f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x136f('0x5'));var rimraf=require(_0x136f('0x6'));var config=require(_0x136f('0x7'));var attributes=require(_0x136f('0x8'));module[_0x136f('0x9')]=function(_0x4f8e5c,_0x11b000){return _0x4f8e5c['define']('SmsTransferReport',attributes,{'tableName':_0x136f('0xa'),'paranoid':![],'indexes':[{'name':_0x136f('0xb'),'fields':[_0x136f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index f3c0153..6d0cbe4 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 _0x7a2d=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x56a60a,_0xf4c330){var _0x5c4057=function(_0x5ed7f8){while(--_0x5ed7f8){_0x56a60a['push'](_0x56a60a['shift']());}};_0x5c4057(++_0xf4c330);}(_0x7a2d,0x142));var _0xd7a2=function(_0x5bb61b,_0x1493bb){_0x5bb61b=_0x5bb61b-0x0;var _0x541e33=_0x7a2d[_0x5bb61b];return _0x541e33;};'use strict';var _=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var moment=require(_0xd7a2('0x2'));var BPromise=require(_0xd7a2('0x3'));var rs=require(_0xd7a2('0x4'));var fs=require('fs');var Redis=require(_0xd7a2('0x5'));var db=require(_0xd7a2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd7a2('0x7'));var config=require(_0xd7a2('0x8'));var jayson=require(_0xd7a2('0x9'));var client=jayson[_0xd7a2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x210a06,_0x209189,_0x1e3fc8){return new BPromise(function(_0x69f732,_0x1ea591){return client[_0xd7a2('0xb')](_0x210a06,_0x1e3fc8)[_0xd7a2('0xc')](function(_0x1c0b49){logger[_0xd7a2('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x209189,_0xd7a2('0xe'));logger[_0xd7a2('0xf')](_0xd7a2('0x10'),_0x209189,_0xd7a2('0xe'),JSON[_0xd7a2('0x11')](_0x1c0b49));if(_0x1c0b49[_0xd7a2('0x12')]){if(_0x1c0b49[_0xd7a2('0x12')]['code']===0x1f4){logger['error'](_0xd7a2('0x13'),_0x209189,_0x1c0b49['error'][_0xd7a2('0x14')]);return _0x1ea591(_0x1c0b49[_0xd7a2('0x12')][_0xd7a2('0x14')]);}logger[_0xd7a2('0x12')](_0xd7a2('0x13'),_0x209189,_0x1c0b49[_0xd7a2('0x12')][_0xd7a2('0x14')]);return _0x69f732(_0x1c0b49[_0xd7a2('0x12')][_0xd7a2('0x14')]);}else{logger[_0xd7a2('0xd')](_0xd7a2('0x13'),_0x209189,'request\x20sent');_0x69f732(_0x1c0b49[_0xd7a2('0x15')]['message']);}})['catch'](function(_0x26763e){logger[_0xd7a2('0x12')](_0xd7a2('0x13'),_0x209189,_0x26763e);_0x1ea591(_0x26763e);});});} \ No newline at end of file +var _0xc978=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rs=require(_0x8c97('0x4'));var fs=require('fs');var Redis=require(_0x8c97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c97('0x6'));var logger=require(_0x8c97('0x7'))(_0x8c97('0x8'));var config=require(_0x8c97('0x9'));var jayson=require(_0x8c97('0xa'));var client=jayson[_0x8c97('0xb')][_0x8c97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x524196,_0x41a511,_0x1b5864){return new BPromise(function(_0x332cd1,_0x26ff40){return client[_0x8c97('0xd')](_0x524196,_0x1b5864)[_0x8c97('0xe')](function(_0x17aef0){logger['info'](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));logger[_0x8c97('0x11')](_0x8c97('0x12'),_0x41a511,_0x8c97('0x10'),JSON[_0x8c97('0x13')](_0x17aef0));if(_0x17aef0[_0x8c97('0x14')]){if(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x15')]===0x1f4){logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0[_0x8c97('0x14')]['message']);return _0x26ff40(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x16')]);}logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0['error']['message']);return _0x332cd1(_0x17aef0['error'][_0x8c97('0x16')]);}else{logger[_0x8c97('0x17')](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));_0x332cd1(_0x17aef0[_0x8c97('0x18')][_0x8c97('0x16')]);}})[_0x8c97('0x19')](function(_0xe3be1){logger[_0x8c97('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x41a511,_0xe3be1);_0x26ff40(_0xe3be1);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 39b387f..7490baa 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 _0x7bcf=['multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','post','file','put','update'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7bcf,0x6c));var _0xf7bc=function(_0x4dc59c,_0x416960){_0x4dc59c=_0x4dc59c-0x0;var _0x453aa7=_0x7bcf[_0x4dc59c];return _0x453aa7;};'use strict';var multer=require(_0xf7bc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf7bc('0x1'));var express=require(_0xf7bc('0x2'));var router=express['Router']();var fs_extra=require(_0xf7bc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf7bc('0x4'));var config=require(_0xf7bc('0x5'));var controller=require(_0xf7bc('0x6'));router[_0xf7bc('0x7')]('/',auth[_0xf7bc('0x8')](),controller[_0xf7bc('0x9')]);router['get'](_0xf7bc('0xa'),auth[_0xf7bc('0x8')](),controller[_0xf7bc('0xb')]);router[_0xf7bc('0x7')]('/:id/download',auth[_0xf7bc('0x8')](),controller[_0xf7bc('0xc')]);var upload=multer({'storage':multer[_0xf7bc('0xd')]({'destination':function(_0x53fe60,_0xfa661c,_0x11f50c){_0x11f50c(null,path[_0xf7bc('0xe')](config[_0xf7bc('0xf')],_0xf7bc('0x10')));},'filename':function(_0x19866f,_0x14fc8b,_0x4d0503){_0x14fc8b[_0xf7bc('0x11')]=_0x14fc8b[_0xf7bc('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d0503(null,util[_0xf7bc('0x12')](_0xf7bc('0x13'),path[_0xf7bc('0x14')](_0x14fc8b[_0xf7bc('0x11')],path[_0xf7bc('0x15')](_0x14fc8b[_0xf7bc('0x11')])),Date[_0xf7bc('0x16')](),path[_0xf7bc('0x15')](_0x14fc8b[_0xf7bc('0x11')])));}})});router[_0xf7bc('0x17')]('/',upload['single'](_0xf7bc('0x18')),controller['create']);router[_0xf7bc('0x19')]('/:id',auth[_0xf7bc('0x8')](),controller[_0xf7bc('0x1a')]);router['delete'](_0xf7bc('0xa'),auth[_0xf7bc('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xcf80=['%s-%s%s','basename','extname','update','delete','multer','util','path','express','Router','fs-extra','../../config/environment','./sound.controller','index','get','/:id','isAuthenticated','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format'];(function(_0x48c9b6,_0x2f1e05){var _0x1e4e00=function(_0x3501f7){while(--_0x3501f7){_0x48c9b6['push'](_0x48c9b6['shift']());}};_0x1e4e00(++_0x2f1e05);}(_0xcf80,0x1cd));var _0x0cf8=function(_0x392d32,_0x313d5e){_0x392d32=_0x392d32-0x0;var _0x2701ad=_0xcf80[_0x392d32];return _0x2701ad;};'use strict';var multer=require(_0x0cf8('0x0'));var util=require(_0x0cf8('0x1'));var path=require(_0x0cf8('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cf8('0x3'));var router=express[_0x0cf8('0x4')]();var fs_extra=require(_0x0cf8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0cf8('0x6'));var controller=require(_0x0cf8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0cf8('0x8')]);router[_0x0cf8('0x9')](_0x0cf8('0xa'),auth[_0x0cf8('0xb')](),controller['show']);router[_0x0cf8('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x0cf8('0xc')]);var upload=multer({'storage':multer[_0x0cf8('0xd')]({'destination':function(_0x35e681,_0x14022f,_0x21a350){_0x21a350(null,path[_0x0cf8('0xe')](config['root'],_0x0cf8('0xf')));},'filename':function(_0x1779a5,_0x7070ba,_0x3ba7c4){_0x7070ba[_0x0cf8('0x10')]=_0x7070ba[_0x0cf8('0x10')][_0x0cf8('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ba7c4(null,util[_0x0cf8('0x12')](_0x0cf8('0x13'),path[_0x0cf8('0x14')](_0x7070ba[_0x0cf8('0x10')],path[_0x0cf8('0x15')](_0x7070ba[_0x0cf8('0x10')])),Date['now'](),path[_0x0cf8('0x15')](_0x7070ba[_0x0cf8('0x10')])));}})});router['post']('/',upload['single']('file'),controller['create']);router['put'](_0x0cf8('0xa'),auth['isAuthenticated'](),controller[_0x0cf8('0x16')]);router[_0x0cf8('0x17')]('/:id',auth[_0x0cf8('0xb')](),controller[_0x0cf8('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 1b4a4a9..593bcf6 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 _0xfcb7=['INTEGER','BIGINT','STRING','FLOAT'];(function(_0x5dcf18,_0x31f1cc){var _0x4dc8f7=function(_0x40d0da){while(--_0x40d0da){_0x5dcf18['push'](_0x5dcf18['shift']());}};_0x4dc8f7(++_0x31f1cc);}(_0xfcb7,0x18a));var _0x7fcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7fcb('0x0')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x7fcb('0x0')]},'display_name':{'type':Sequelize[_0x7fcb('0x0')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x7fcb('0x1')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x7fcb('0x2')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x7fcb('0x1')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x7fcb('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x7fcb('0x2')]}}; \ No newline at end of file +var _0x7ca8=['STRING','name','FLOAT','BIGINT','INTEGER','exports'];(function(_0x31d02e,_0x3588bb){var _0x1da463=function(_0x1dc3fe){while(--_0x1dc3fe){_0x31d02e['push'](_0x31d02e['shift']());}};_0x1da463(++_0x3588bb);}(_0x7ca8,0xf5));var _0x87ca=function(_0x16962e,_0x27c427){_0x16962e=_0x16962e-0x0;var _0x30c231=_0x7ca8[_0x16962e];return _0x30c231;};'use strict';var Sequelize=require('sequelize');module[_0x87ca('0x0')]={'name':{'type':Sequelize[_0x87ca('0x1')],'unique':_0x87ca('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x87ca('0x1')]},'display_name':{'type':Sequelize[_0x87ca('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x87ca('0x1')]},'original_format':{'type':Sequelize[_0x87ca('0x1')]},'original_duration':{'type':Sequelize[_0x87ca('0x3')]},'original_sampleCount':{'type':Sequelize[_0x87ca('0x4')]},'original_channelCount':{'type':Sequelize[_0x87ca('0x5')]},'original_bitRate':{'type':Sequelize[_0x87ca('0x4')]},'original_sampleRate':{'type':Sequelize[_0x87ca('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x87ca('0x4')]},'converted_channelCount':{'type':Sequelize[_0x87ca('0x5')]},'converted_bitRate':{'type':Sequelize[_0x87ca('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x87ca('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index d7ecbba..aebb8e6 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 _0x6209=['original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','delete','server/files/sounds/original','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','Sounds','UserProfileResource','end','sendStatus','error','stack','send','index','map','Sound','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','hasOwnProperty','order','where','filter','merge','VIRTUAL','include','findAll','rows','catch','params','intersection','length','includeAll','options','download','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','extname','file','filename','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount'];(function(_0x1472f4,_0x202649){var _0xb0700=function(_0x3bddfa){while(--_0x3bddfa){_0x1472f4['push'](_0x1472f4['shift']());}};_0xb0700(++_0x202649);}(_0x6209,0x116));var _0x9620=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6209[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x9620('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9620('0x1'));var jsonpatch=require(_0x9620('0x2'));var rp=require(_0x9620('0x3'));var moment=require(_0x9620('0x4'));var BPromise=require(_0x9620('0x5'));var Mustache=require(_0x9620('0x6'));var util=require(_0x9620('0x7'));var path=require(_0x9620('0x8'));var sox=require(_0x9620('0x9'));var csv=require(_0x9620('0xa'));var ejs=require(_0x9620('0xb'));var fs=require('fs');var fs_extra=require(_0x9620('0xc'));var _=require(_0x9620('0xd'));var squel=require('squel');var crypto=require(_0x9620('0xe'));var jsforce=require(_0x9620('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9620('0xa'));var querystring=require(_0x9620('0x10'));var Papa=require(_0x9620('0x11'));var Redis=require(_0x9620('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9620('0x13'));var hardwareService=require(_0x9620('0x14'));var logger=require(_0x9620('0x15'))(_0x9620('0x16'));var utils=require(_0x9620('0x17'));var config=require(_0x9620('0x18'));var licenseUtil=require(_0x9620('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x65271c,_0x505508){_0x505508=_0x505508||0xcc;return function(_0x19f05b){if(_0x19f05b){return _0x65271c['sendStatus'](_0x505508);}return _0x65271c[_0x9620('0x1a')](_0x505508)['end']();};}function respondWithResult(_0x4d195a,_0x277f9a){_0x277f9a=_0x277f9a||0xc8;return function(_0x44c25a){if(_0x44c25a){return _0x4d195a[_0x9620('0x1a')](_0x277f9a)[_0x9620('0x1b')](_0x44c25a);}};}function respondWithFilteredResult(_0x2af8ab,_0x320c4b){return function(_0x5c49d9){if(_0x5c49d9){var _0x1313cc=typeof _0x320c4b[_0x9620('0x1c')]===_0x9620('0x1d')&&typeof _0x320c4b[_0x9620('0x1e')]===_0x9620('0x1d');var _0xb15398=_0x5c49d9[_0x9620('0x1f')];var _0x114038=_0x1313cc?0x0:_0x320c4b[_0x9620('0x1c')];var _0x3f24aa=_0x1313cc?_0x5c49d9[_0x9620('0x1f')]:_0x320c4b[_0x9620('0x1c')]+_0x320c4b[_0x9620('0x1e')];var _0x2f6c98;if(_0x3f24aa>=_0xb15398){_0x3f24aa=_0xb15398;_0x2f6c98=0xc8;}else{_0x2f6c98=0xce;}_0x2af8ab[_0x9620('0x1a')](_0x2f6c98);return _0x2af8ab['set'](_0x9620('0x20'),_0x114038+'-'+_0x3f24aa+'/'+_0xb15398)[_0x9620('0x1b')](_0x5c49d9);}return null;};}function patchUpdates(_0x6c6201){return function(_0x4a67b9){try{jsonpatch['apply'](_0x4a67b9,_0x6c6201,!![]);}catch(_0x414a7){return BPromise[_0x9620('0x21')](_0x414a7);}return _0x4a67b9[_0x9620('0x22')]();};}function saveUpdates(_0x43b1fc,_0x2ede90){return function(_0x2c4c46){if(_0x2c4c46){return _0x2c4c46[_0x9620('0x23')](_0x43b1fc)[_0x9620('0x24')](function(_0x47b72a){return _0x47b72a;});}return null;};}function removeEntity(_0x4c768a,_0x5e731e){return function(_0x20fa7d){if(_0x20fa7d){return _0x20fa7d[_0x9620('0x25')]()[_0x9620('0x24')](function(){var _0x575aa3=_0x20fa7d[_0x9620('0x26')]({'plain':!![]});var _0x530456=_0x9620('0x27');return db[_0x9620('0x28')][_0x9620('0x25')]({'where':{'type':_0x530456,'resourceId':_0x575aa3['id']}})[_0x9620('0x24')](function(){return _0x20fa7d;});})['then'](function(){_0x4c768a[_0x9620('0x1a')](0xcc)[_0x9620('0x29')]();});}};}function handleEntityNotFound(_0x48b86a,_0x223b67){return function(_0x4ae06b){if(!_0x4ae06b){_0x48b86a[_0x9620('0x2a')](0x194);}return _0x4ae06b;};}function handleError(_0x45e88f,_0x192545){_0x192545=_0x192545||0x1f4;return function(_0x2f0d18){logger[_0x9620('0x2b')](_0x2f0d18[_0x9620('0x2c')]);if(_0x2f0d18['name']){delete _0x2f0d18['name'];}_0x45e88f[_0x9620('0x1a')](_0x192545)[_0x9620('0x2d')](_0x2f0d18);};}exports[_0x9620('0x2e')]=function(_0x560d44,_0x1d6aa3){var _0x18266c={},_0x559853={},_0x5b9b8f={'count':0x0,'rows':[]};var _0x59bb82=_[_0x9620('0x2f')](db[_0x9620('0x30')][_0x9620('0x31')],function(_0x12b8cd){return{'name':_0x12b8cd[_0x9620('0x32')],'type':_0x12b8cd[_0x9620('0x33')][_0x9620('0x34')]};});_0x559853[_0x9620('0x35')]=_[_0x9620('0x2f')](_0x59bb82,_0x9620('0x36'));_0x559853[_0x9620('0x37')]=_[_0x9620('0x38')](_0x560d44[_0x9620('0x37')]);_0x559853[_0x9620('0x39')]=_['intersection'](_0x559853['model'],_0x559853['query']);_0x18266c[_0x9620('0x3a')]=_['intersection'](_0x559853[_0x9620('0x35')],qs[_0x9620('0x3b')](_0x560d44['query'][_0x9620('0x3b')]));_0x18266c[_0x9620('0x3a')]=_0x18266c['attributes']['length']?_0x18266c[_0x9620('0x3a')]:_0x559853[_0x9620('0x35')];if(!_0x560d44[_0x9620('0x37')][_0x9620('0x3c')]('nolimit')){_0x18266c['limit']=qs[_0x9620('0x1e')](_0x560d44[_0x9620('0x37')][_0x9620('0x1e')]);_0x18266c[_0x9620('0x1c')]=qs[_0x9620('0x1c')](_0x560d44['query'][_0x9620('0x1c')]);}_0x18266c[_0x9620('0x3d')]=qs['sort'](_0x560d44['query']['sort']);_0x18266c[_0x9620('0x3e')]=qs[_0x9620('0x39')](_['pick'](_0x560d44[_0x9620('0x37')],_0x559853[_0x9620('0x39')]),_0x59bb82);if(_0x560d44[_0x9620('0x37')][_0x9620('0x3f')]){_0x18266c[_0x9620('0x3e')]=_[_0x9620('0x40')](_0x18266c[_0x9620('0x3e')],{'$or':_[_0x9620('0x2f')](_0x59bb82,function(_0x1b9414){if(_0x1b9414[_0x9620('0x33')]!==_0x9620('0x41')){var _0xc772cc={};_0xc772cc[_0x1b9414['name']]={'$like':'%'+_0x560d44[_0x9620('0x37')][_0x9620('0x3f')]+'%'};return _0xc772cc;}})});}_0x18266c=_['merge']({},_0x18266c,_0x560d44['options']);var _0x310a43={'where':_0x18266c[_0x9620('0x3e')]};return db[_0x9620('0x30')]['count'](_0x310a43)[_0x9620('0x24')](function(_0x2aade6){_0x5b9b8f[_0x9620('0x1f')]=_0x2aade6;if(_0x560d44[_0x9620('0x37')]['includeAll']){_0x18266c[_0x9620('0x42')]=[{'all':!![]}];}return db[_0x9620('0x30')][_0x9620('0x43')](_0x18266c);})['then'](function(_0x13f635){_0x5b9b8f[_0x9620('0x44')]=_0x13f635;return _0x5b9b8f;})['then'](respondWithFilteredResult(_0x1d6aa3,_0x18266c))[_0x9620('0x45')](handleError(_0x1d6aa3,null));};exports['show']=function(_0x2e05db,_0x103c62){var _0x5e0fa5={'raw':!![],'where':{'id':_0x2e05db[_0x9620('0x46')]['id']}},_0xdf63c9={};_0xdf63c9[_0x9620('0x35')]=_['keys'](db[_0x9620('0x30')][_0x9620('0x31')]);_0xdf63c9[_0x9620('0x37')]=_[_0x9620('0x38')](_0x2e05db[_0x9620('0x37')]);_0xdf63c9[_0x9620('0x39')]=_[_0x9620('0x47')](_0xdf63c9[_0x9620('0x35')],_0xdf63c9[_0x9620('0x37')]);_0x5e0fa5[_0x9620('0x3a')]=_[_0x9620('0x47')](_0xdf63c9[_0x9620('0x35')],qs[_0x9620('0x3b')](_0x2e05db['query'][_0x9620('0x3b')]));_0x5e0fa5[_0x9620('0x3a')]=_0x5e0fa5[_0x9620('0x3a')][_0x9620('0x48')]?_0x5e0fa5[_0x9620('0x3a')]:_0xdf63c9[_0x9620('0x35')];if(_0x2e05db[_0x9620('0x37')][_0x9620('0x49')]){_0x5e0fa5['include']=[{'all':!![]}];}_0x5e0fa5=_[_0x9620('0x40')]({},_0x5e0fa5,_0x2e05db[_0x9620('0x4a')]);return db['Sound']['find'](_0x5e0fa5)[_0x9620('0x24')](handleEntityNotFound(_0x103c62,null))['then'](respondWithResult(_0x103c62,null))['catch'](handleError(_0x103c62,null));};exports[_0x9620('0x4b')]=function(_0x1d3c90,_0x102795,_0xd7aae2){return db[_0x9620('0x30')][_0x9620('0x4c')]({'where':{'id':_0x1d3c90['params']['id']},'attributes':[_0x9620('0x36'),_0x9620('0x4d'),_0x9620('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x102795,null))[_0x9620('0x24')](function(_0x1ce189){if(_0x1ce189){if(!fs[_0x9620('0x4f')](path[_0x9620('0x50')](config[_0x9620('0x51')],_0x9620('0x52'),_0x1ce189[_0x9620('0x4d')]+'.'+_0x1ce189[_0x9620('0x4e')]))){throw new db[(_0x9620('0x53'))][(_0x9620('0x54'))](_0x9620('0x55'));}return _0x102795['download'](path[_0x9620('0x50')](config[_0x9620('0x51')],_0x9620('0x52'),util[_0x9620('0x56')](_0x9620('0x57'),_0x1ce189['save_name'],_0x1ce189[_0x9620('0x4e')])),util[_0x9620('0x56')](_0x9620('0x57'),_0x1ce189[_0x9620('0x36')],_0x1ce189[_0x9620('0x4e')]));}return null;})['catch'](handleError(_0x102795,null));};exports[_0x9620('0x58')]=function(_0x23a918,_0x346006,_0x260a6f){var _0x47b56d={'name':path[_0x9620('0x59')](_0x23a918['file']['originalname'],path[_0x9620('0x5a')](_0x23a918[_0x9620('0x5b')]['originalname'])),'save_name':path[_0x9620('0x59')](_0x23a918[_0x9620('0x5b')][_0x9620('0x5c')],path[_0x9620('0x5a')](_0x23a918[_0x9620('0x5b')][_0x9620('0x5c')])),'original_format':path[_0x9620('0x5a')](_0x23a918[_0x9620('0x5b')]['originalname'])[_0x9620('0x5d')](0x1),'converted_format':'wav'};var _0x46a426=path[_0x9620('0x50')](config[_0x9620('0x51')],'server/files/sounds/original',_0x23a918[_0x9620('0x5b')][_0x9620('0x5c')]);var _0x55f868=path['join'](config[_0x9620('0x51')],_0x9620('0x52'),util[_0x9620('0x56')](_0x9620('0x57'),path[_0x9620('0x59')](_0x23a918[_0x9620('0x5b')][_0x9620('0x5c')],path[_0x9620('0x5a')](_0x23a918[_0x9620('0x5b')][_0x9620('0x5c')])),_0x47b56d[_0x9620('0x4e')]));logger[_0x9620('0x5e')](_0x9620('0x5f'),_0x46a426);logger['info'](_0x9620('0x60'),_0x55f868);try{fs[_0x9620('0x61')](_0x46a426,parseInt('0777',0x8));var _0x48bfda=sox[_0x9620('0x62')](_0x46a426,_0x55f868,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x48bfda['on'](_0x9620('0x2b'),function(_0x4da4f9){fs[_0x9620('0x63')](_0x46a426);_0x346006['status'](0x1f4)[_0x9620('0x2d')](_0x4da4f9);});_0x48bfda['on']('src',function(_0x36403a){_0x47b56d[_0x9620('0x64')]=isNaN(_0x36403a[_0x9620('0x65')])?null:_0x36403a['duration']*0x3e8;_0x47b56d[_0x9620('0x66')]=isNaN(_0x36403a[_0x9620('0x67')])?null:_0x36403a[_0x9620('0x67')];_0x47b56d[_0x9620('0x68')]=isNaN(_0x36403a[_0x9620('0x69')])?null:_0x36403a['channelCount'];_0x47b56d[_0x9620('0x6a')]=isNaN(_0x36403a['bitRate'])?null:_0x36403a[_0x9620('0x6b')];_0x47b56d[_0x9620('0x6c')]=isNaN(_0x36403a[_0x9620('0x6d')])?null:_0x36403a[_0x9620('0x6d')];});_0x48bfda['on'](_0x9620('0x6e'),function(_0x3c5462){_0x47b56d['converted_duration']=isNaN(_0x3c5462['duration'])?null:_0x3c5462[_0x9620('0x65')]*0x3e8;_0x47b56d[_0x9620('0x6f')]=isNaN(_0x3c5462['sampleCount'])?null:_0x3c5462['sampleCount'];_0x47b56d[_0x9620('0x70')]=isNaN(_0x3c5462[_0x9620('0x69')])?null:_0x3c5462[_0x9620('0x69')];_0x47b56d[_0x9620('0x71')]=isNaN(_0x3c5462[_0x9620('0x6b')])?null:_0x3c5462[_0x9620('0x6b')];_0x47b56d['converted_sampleRate']=isNaN(_0x3c5462[_0x9620('0x6d')])?null:_0x3c5462[_0x9620('0x6d')];});_0x48bfda['on'](_0x9620('0x29'),function(){fs['chmodSync'](_0x55f868,parseInt(_0x9620('0x72'),0x8));return db[_0x9620('0x30')][_0x9620('0x58')](_0x47b56d)[_0x9620('0x24')](function(_0x491e07){var _0x2f8df8={'role':_0x23a918['body']['role'],'userProfileId':_0x23a918[_0x9620('0x73')][_0x9620('0x74')]};if(!_0x2f8df8)throw new Error(_0x9620('0x75'));if(_0x2f8df8[_0x9620('0x76')]===_0x9620('0x77')){var _0x3f14fb=_0x491e07[_0x9620('0x26')]({'plain':!![]});return db[_0x9620('0x78')][_0x9620('0x4c')]({'where':{'name':'Sounds','userProfileId':_0x2f8df8['userProfileId']},'raw':!![]})[_0x9620('0x24')](function(_0x25168d){if(_0x25168d&&_0x25168d[_0x9620('0x79')]===0x0){return db[_0x9620('0x28')]['create']({'name':_0x3f14fb['name'],'resourceId':_0x3f14fb['id'],'type':_0x25168d['name'],'sectionId':_0x25168d['id']},{})[_0x9620('0x24')](function(){return _0x491e07;});}else{return _0x491e07;}})['catch'](function(_0x4f714a){logger[_0x9620('0x2b')](_0x9620('0x7a'),_0x4f714a);throw _0x4f714a;});}return _0x491e07;})[_0x9620('0x24')](respondWithResult(_0x346006,null))[_0x9620('0x45')](handleError(_0x346006,null));});_0x48bfda['start']();}catch(_0x5d25c5){_0x346006[_0x9620('0x1a')](0x1f4)[_0x9620('0x2d')](_0x5d25c5);}};exports['update']=function(_0x339d8a,_0x54eca9,_0xde5386){return db[_0x9620('0x30')][_0x9620('0x4c')]({'where':{'id':_0x339d8a[_0x9620('0x46')]['id']}})[_0x9620('0x24')](handleEntityNotFound(_0x54eca9,null))[_0x9620('0x24')](saveUpdates(_[_0x9620('0x7b')](_0x339d8a[_0x9620('0x73')],[_0x9620('0x36'),_0x9620('0x7c')]),null))[_0x9620('0x24')](respondWithResult(_0x54eca9,null))[_0x9620('0x45')](handleError(_0x54eca9,null));};exports[_0x9620('0x7d')]=function(_0x432ca8,_0x3d20d7,_0x4d2741){return db['Sound'][_0x9620('0x4c')]({'where':{'id':_0x432ca8[_0x9620('0x46')]['id']}})['then'](function(_0x31fdfc){if(_0x31fdfc){return _0x31fdfc[_0x9620('0x25')]();}})[_0x9620('0x24')](function(_0x2fcceb){var _0x2a505b=path[_0x9620('0x50')](config[_0x9620('0x51')],_0x9620('0x7e'),util[_0x9620('0x56')](_0x9620('0x57'),_0x2fcceb['save_name'],_0x2fcceb[_0x9620('0x7f')]));var _0x1e142=path[_0x9620('0x50')](config[_0x9620('0x51')],_0x9620('0x52'),util['format'](_0x9620('0x57'),_0x2fcceb[_0x9620('0x4d')],_0x2fcceb[_0x9620('0x4e')]));fs['unlinkSync'](_0x2a505b);fs['unlinkSync'](_0x1e142);return _0x2fcceb;})[_0x9620('0x24')](function(_0x27b0f3){if(_0x27b0f3){return _0x3d20d7[_0x9620('0x1a')](0xcc)['end']();}})[_0x9620('0x24')](handleEntityNotFound(_0x3d20d7,null))[_0x9620('0x45')](handleError(_0x3d20d7,null));}; \ No newline at end of file +var _0xc47b=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Sounds','destroy','error','name','send','index','map','Sound','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','find','catch','download','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','create','basename','originalname','file','filename','extname','substring','server/files/sounds/original','root','info','chmodSync','0777','wav','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','body','role','userProfileId','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0xc47b,0xe0));var _0xbc47=function(_0x18abd3,_0x549650){_0x18abd3=_0x18abd3-0x0;var _0x3e314b=_0xc47b[_0x18abd3];return _0x3e314b;};'use strict';var emlformat=require(_0xbc47('0x0'));var rimraf=require(_0xbc47('0x1'));var zipdir=require(_0xbc47('0x2'));var jsonpatch=require(_0xbc47('0x3'));var rp=require(_0xbc47('0x4'));var moment=require('moment');var BPromise=require(_0xbc47('0x5'));var Mustache=require(_0xbc47('0x6'));var util=require('util');var path=require(_0xbc47('0x7'));var sox=require(_0xbc47('0x8'));var csv=require(_0xbc47('0x9'));var ejs=require(_0xbc47('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc47('0xb'));var squel=require(_0xbc47('0xc'));var crypto=require(_0xbc47('0xd'));var jsforce=require(_0xbc47('0xe'));var deskjs=require(_0xbc47('0xf'));var toCsv=require(_0xbc47('0x9'));var querystring=require(_0xbc47('0x10'));var Papa=require(_0xbc47('0x11'));var Redis=require('ioredis');var authService=require(_0xbc47('0x12'));var qs=require(_0xbc47('0x13'));var as=require(_0xbc47('0x14'));var hardwareService=require(_0xbc47('0x15'));var logger=require(_0xbc47('0x16'))(_0xbc47('0x17'));var utils=require(_0xbc47('0x18'));var config=require(_0xbc47('0x19'));var licenseUtil=require(_0xbc47('0x1a'));var db=require(_0xbc47('0x1b'))['db'];function respondWithStatusCode(_0x18c809,_0x7b8a37){_0x7b8a37=_0x7b8a37||0xcc;return function(_0x306c9b){if(_0x306c9b){return _0x18c809[_0xbc47('0x1c')](_0x7b8a37);}return _0x18c809[_0xbc47('0x1d')](_0x7b8a37)[_0xbc47('0x1e')]();};}function respondWithResult(_0x3c62de,_0x266714){_0x266714=_0x266714||0xc8;return function(_0x555e62){if(_0x555e62){return _0x3c62de['status'](_0x266714)[_0xbc47('0x1f')](_0x555e62);}};}function respondWithFilteredResult(_0x2ca586,_0x25fa9b){return function(_0x30eecf){if(_0x30eecf){var _0x4f934b=typeof _0x25fa9b[_0xbc47('0x20')]===_0xbc47('0x21')&&typeof _0x25fa9b[_0xbc47('0x22')]===_0xbc47('0x21');var _0x16bdb1=_0x30eecf[_0xbc47('0x23')];var _0x571265=_0x4f934b?0x0:_0x25fa9b[_0xbc47('0x20')];var _0x536a34=_0x4f934b?_0x30eecf['count']:_0x25fa9b[_0xbc47('0x20')]+_0x25fa9b[_0xbc47('0x22')];var _0x2410d2;if(_0x536a34>=_0x16bdb1){_0x536a34=_0x16bdb1;_0x2410d2=0xc8;}else{_0x2410d2=0xce;}_0x2ca586[_0xbc47('0x1d')](_0x2410d2);return _0x2ca586[_0xbc47('0x24')](_0xbc47('0x25'),_0x571265+'-'+_0x536a34+'/'+_0x16bdb1)[_0xbc47('0x1f')](_0x30eecf);}return null;};}function patchUpdates(_0x26fed5){return function(_0x253e86){try{jsonpatch[_0xbc47('0x26')](_0x253e86,_0x26fed5,!![]);}catch(_0x24c6f9){return BPromise[_0xbc47('0x27')](_0x24c6f9);}return _0x253e86[_0xbc47('0x28')]();};}function saveUpdates(_0x5a88e3,_0x4f1419){return function(_0x1e17e3){if(_0x1e17e3){return _0x1e17e3[_0xbc47('0x29')](_0x5a88e3)[_0xbc47('0x2a')](function(_0x47ef20){return _0x47ef20;});}return null;};}function removeEntity(_0x2822be,_0x4b894f){return function(_0xd491a1){if(_0xd491a1){return _0xd491a1['destroy']()['then'](function(){var _0x2e63a7=_0xd491a1[_0xbc47('0x2b')]({'plain':!![]});var _0x5b05c6=_0xbc47('0x2c');return db['UserProfileResource'][_0xbc47('0x2d')]({'where':{'type':_0x5b05c6,'resourceId':_0x2e63a7['id']}})[_0xbc47('0x2a')](function(){return _0xd491a1;});})[_0xbc47('0x2a')](function(){_0x2822be[_0xbc47('0x1d')](0xcc)[_0xbc47('0x1e')]();});}};}function handleEntityNotFound(_0x53b985,_0xbdedfc){return function(_0x2dc333){if(!_0x2dc333){_0x53b985['sendStatus'](0x194);}return _0x2dc333;};}function handleError(_0x216537,_0xb45bc){_0xb45bc=_0xb45bc||0x1f4;return function(_0x1fbd75){logger[_0xbc47('0x2e')](_0x1fbd75['stack']);if(_0x1fbd75['name']){delete _0x1fbd75[_0xbc47('0x2f')];}_0x216537[_0xbc47('0x1d')](_0xb45bc)[_0xbc47('0x30')](_0x1fbd75);};}exports[_0xbc47('0x31')]=function(_0x4362fb,_0x1a4424){var _0x3e4ac1={},_0x5c50e3={},_0x2dce43={'count':0x0,'rows':[]};var _0x5e88d7=_[_0xbc47('0x32')](db[_0xbc47('0x33')][_0xbc47('0x34')],function(_0x32b911){return{'name':_0x32b911[_0xbc47('0x35')],'type':_0x32b911[_0xbc47('0x36')][_0xbc47('0x37')]};});_0x5c50e3['model']=_['map'](_0x5e88d7,_0xbc47('0x2f'));_0x5c50e3['query']=_[_0xbc47('0x38')](_0x4362fb[_0xbc47('0x39')]);_0x5c50e3[_0xbc47('0x3a')]=_[_0xbc47('0x3b')](_0x5c50e3[_0xbc47('0x3c')],_0x5c50e3[_0xbc47('0x39')]);_0x3e4ac1[_0xbc47('0x3d')]=_[_0xbc47('0x3b')](_0x5c50e3[_0xbc47('0x3c')],qs[_0xbc47('0x3e')](_0x4362fb[_0xbc47('0x39')][_0xbc47('0x3e')]));_0x3e4ac1[_0xbc47('0x3d')]=_0x3e4ac1[_0xbc47('0x3d')]['length']?_0x3e4ac1['attributes']:_0x5c50e3[_0xbc47('0x3c')];if(!_0x4362fb[_0xbc47('0x39')][_0xbc47('0x3f')](_0xbc47('0x40'))){_0x3e4ac1[_0xbc47('0x22')]=qs[_0xbc47('0x22')](_0x4362fb[_0xbc47('0x39')][_0xbc47('0x22')]);_0x3e4ac1['offset']=qs['offset'](_0x4362fb[_0xbc47('0x39')][_0xbc47('0x20')]);}_0x3e4ac1[_0xbc47('0x41')]=qs[_0xbc47('0x42')](_0x4362fb['query'][_0xbc47('0x42')]);_0x3e4ac1[_0xbc47('0x43')]=qs[_0xbc47('0x3a')](_[_0xbc47('0x44')](_0x4362fb[_0xbc47('0x39')],_0x5c50e3[_0xbc47('0x3a')]),_0x5e88d7);if(_0x4362fb[_0xbc47('0x39')][_0xbc47('0x45')]){_0x3e4ac1['where']=_[_0xbc47('0x46')](_0x3e4ac1['where'],{'$or':_[_0xbc47('0x32')](_0x5e88d7,function(_0x16a486){if(_0x16a486[_0xbc47('0x36')]!==_0xbc47('0x47')){var _0x4d40d7={};_0x4d40d7[_0x16a486['name']]={'$like':'%'+_0x4362fb[_0xbc47('0x39')][_0xbc47('0x45')]+'%'};return _0x4d40d7;}})});}_0x3e4ac1=_[_0xbc47('0x46')]({},_0x3e4ac1,_0x4362fb['options']);var _0x14db6e={'where':_0x3e4ac1[_0xbc47('0x43')]};return db[_0xbc47('0x33')][_0xbc47('0x23')](_0x14db6e)[_0xbc47('0x2a')](function(_0xe9f098){_0x2dce43[_0xbc47('0x23')]=_0xe9f098;if(_0x4362fb[_0xbc47('0x39')][_0xbc47('0x48')]){_0x3e4ac1[_0xbc47('0x49')]=[{'all':!![]}];}return db[_0xbc47('0x33')][_0xbc47('0x4a')](_0x3e4ac1);})[_0xbc47('0x2a')](function(_0x55774f){_0x2dce43[_0xbc47('0x4b')]=_0x55774f;return _0x2dce43;})[_0xbc47('0x2a')](respondWithFilteredResult(_0x1a4424,_0x3e4ac1))['catch'](handleError(_0x1a4424,null));};exports[_0xbc47('0x4c')]=function(_0x27abb7,_0xab9e47){var _0x3ac03a={'raw':!![],'where':{'id':_0x27abb7[_0xbc47('0x4d')]['id']}},_0x2b740f={};_0x2b740f[_0xbc47('0x3c')]=_[_0xbc47('0x38')](db[_0xbc47('0x33')]['rawAttributes']);_0x2b740f[_0xbc47('0x39')]=_['keys'](_0x27abb7[_0xbc47('0x39')]);_0x2b740f[_0xbc47('0x3a')]=_['intersection'](_0x2b740f[_0xbc47('0x3c')],_0x2b740f['query']);_0x3ac03a[_0xbc47('0x3d')]=_[_0xbc47('0x3b')](_0x2b740f[_0xbc47('0x3c')],qs[_0xbc47('0x3e')](_0x27abb7[_0xbc47('0x39')]['fields']));_0x3ac03a[_0xbc47('0x3d')]=_0x3ac03a[_0xbc47('0x3d')][_0xbc47('0x4e')]?_0x3ac03a[_0xbc47('0x3d')]:_0x2b740f[_0xbc47('0x3c')];if(_0x27abb7[_0xbc47('0x39')][_0xbc47('0x48')]){_0x3ac03a['include']=[{'all':!![]}];}_0x3ac03a=_['merge']({},_0x3ac03a,_0x27abb7['options']);return db[_0xbc47('0x33')][_0xbc47('0x4f')](_0x3ac03a)[_0xbc47('0x2a')](handleEntityNotFound(_0xab9e47,null))['then'](respondWithResult(_0xab9e47,null))[_0xbc47('0x50')](handleError(_0xab9e47,null));};exports[_0xbc47('0x51')]=function(_0xc452fe,_0x5c3db1,_0x15ee13){return db[_0xbc47('0x33')][_0xbc47('0x4f')]({'where':{'id':_0xc452fe['params']['id']},'attributes':[_0xbc47('0x2f'),_0xbc47('0x52'),_0xbc47('0x53')],'raw':!![]})[_0xbc47('0x2a')](handleEntityNotFound(_0x5c3db1,null))[_0xbc47('0x2a')](function(_0x546693){if(_0x546693){if(!fs[_0xbc47('0x54')](path['join'](config['root'],_0xbc47('0x55'),_0x546693[_0xbc47('0x52')]+'.'+_0x546693[_0xbc47('0x53')]))){throw new db[(_0xbc47('0x56'))][(_0xbc47('0x57'))](_0xbc47('0x58'));}return _0x5c3db1[_0xbc47('0x51')](path[_0xbc47('0x59')](config['root'],_0xbc47('0x55'),util[_0xbc47('0x5a')](_0xbc47('0x5b'),_0x546693[_0xbc47('0x52')],_0x546693['converted_format'])),util[_0xbc47('0x5a')](_0xbc47('0x5b'),_0x546693[_0xbc47('0x2f')],_0x546693[_0xbc47('0x53')]));}return null;})['catch'](handleError(_0x5c3db1,null));};exports[_0xbc47('0x5c')]=function(_0x10daab,_0x4fb89d,_0x554cb5){var _0x7cacb5={'name':path[_0xbc47('0x5d')](_0x10daab['file'][_0xbc47('0x5e')],path['extname'](_0x10daab[_0xbc47('0x5f')][_0xbc47('0x5e')])),'save_name':path[_0xbc47('0x5d')](_0x10daab[_0xbc47('0x5f')][_0xbc47('0x60')],path['extname'](_0x10daab[_0xbc47('0x5f')][_0xbc47('0x60')])),'original_format':path[_0xbc47('0x61')](_0x10daab['file'][_0xbc47('0x5e')])[_0xbc47('0x62')](0x1),'converted_format':'wav'};var _0x46c3b9=path['join'](config['root'],_0xbc47('0x63'),_0x10daab[_0xbc47('0x5f')]['filename']);var _0x2e1439=path['join'](config[_0xbc47('0x64')],_0xbc47('0x55'),util[_0xbc47('0x5a')](_0xbc47('0x5b'),path[_0xbc47('0x5d')](_0x10daab[_0xbc47('0x5f')][_0xbc47('0x60')],path[_0xbc47('0x61')](_0x10daab['file'][_0xbc47('0x60')])),_0x7cacb5[_0xbc47('0x53')]));logger[_0xbc47('0x65')]('Sound\x20upload\x20filepath:\x20%s',_0x46c3b9);logger[_0xbc47('0x65')]('Sound\x20upload\x20destination:\x20%s',_0x2e1439);try{fs[_0xbc47('0x66')](_0x46c3b9,parseInt(_0xbc47('0x67'),0x8));var _0x3c6cee=sox['transcode'](_0x46c3b9,_0x2e1439,{'sampleRate':0x1f40,'format':_0xbc47('0x68'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3c6cee['on'](_0xbc47('0x2e'),function(_0x17688c){fs[_0xbc47('0x69')](_0x46c3b9);_0x4fb89d['status'](0x1f4)[_0xbc47('0x30')](_0x17688c);});_0x3c6cee['on'](_0xbc47('0x6a'),function(_0x12c816){_0x7cacb5['original_duration']=isNaN(_0x12c816[_0xbc47('0x6b')])?null:_0x12c816['duration']*0x3e8;_0x7cacb5['original_sampleCount']=isNaN(_0x12c816[_0xbc47('0x6c')])?null:_0x12c816[_0xbc47('0x6c')];_0x7cacb5[_0xbc47('0x6d')]=isNaN(_0x12c816[_0xbc47('0x6e')])?null:_0x12c816[_0xbc47('0x6e')];_0x7cacb5[_0xbc47('0x6f')]=isNaN(_0x12c816[_0xbc47('0x70')])?null:_0x12c816[_0xbc47('0x70')];_0x7cacb5[_0xbc47('0x71')]=isNaN(_0x12c816[_0xbc47('0x72')])?null:_0x12c816[_0xbc47('0x72')];});_0x3c6cee['on'](_0xbc47('0x73'),function(_0xc60052){_0x7cacb5['converted_duration']=isNaN(_0xc60052[_0xbc47('0x6b')])?null:_0xc60052[_0xbc47('0x6b')]*0x3e8;_0x7cacb5[_0xbc47('0x74')]=isNaN(_0xc60052[_0xbc47('0x6c')])?null:_0xc60052[_0xbc47('0x6c')];_0x7cacb5[_0xbc47('0x75')]=isNaN(_0xc60052['channelCount'])?null:_0xc60052[_0xbc47('0x6e')];_0x7cacb5['converted_bitRate']=isNaN(_0xc60052[_0xbc47('0x70')])?null:_0xc60052['bitRate'];_0x7cacb5['converted_sampleRate']=isNaN(_0xc60052[_0xbc47('0x72')])?null:_0xc60052[_0xbc47('0x72')];});_0x3c6cee['on'](_0xbc47('0x1e'),function(){fs[_0xbc47('0x66')](_0x2e1439,parseInt(_0xbc47('0x67'),0x8));return db[_0xbc47('0x33')][_0xbc47('0x5c')](_0x7cacb5)[_0xbc47('0x2a')](function(_0x4d6b0b){var _0x35db58={'role':_0x10daab[_0xbc47('0x76')][_0xbc47('0x77')],'userProfileId':_0x10daab[_0xbc47('0x76')][_0xbc47('0x78')]};if(!_0x35db58)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35db58['role']===_0xbc47('0x79')){var _0xe2efbc=_0x4d6b0b[_0xbc47('0x2b')]({'plain':!![]});return db[_0xbc47('0x7a')][_0xbc47('0x4f')]({'where':{'name':_0xbc47('0x2c'),'userProfileId':_0x35db58['userProfileId']},'raw':!![]})['then'](function(_0x3e12ff){if(_0x3e12ff&&_0x3e12ff['autoAssociation']===0x0){return db[_0xbc47('0x7b')][_0xbc47('0x5c')]({'name':_0xe2efbc['name'],'resourceId':_0xe2efbc['id'],'type':_0x3e12ff[_0xbc47('0x2f')],'sectionId':_0x3e12ff['id']},{})[_0xbc47('0x2a')](function(){return _0x4d6b0b;});}else{return _0x4d6b0b;}})[_0xbc47('0x50')](function(_0x3e0a42){logger[_0xbc47('0x2e')](_0xbc47('0x7c'),_0x3e0a42);throw _0x3e0a42;});}return _0x4d6b0b;})[_0xbc47('0x2a')](respondWithResult(_0x4fb89d,null))[_0xbc47('0x50')](handleError(_0x4fb89d,null));});_0x3c6cee['start']();}catch(_0x558f82){_0x4fb89d[_0xbc47('0x1d')](0x1f4)[_0xbc47('0x30')](_0x558f82);}};exports[_0xbc47('0x29')]=function(_0x240e87,_0x1522aa,_0x2ce87c){return db['Sound'][_0xbc47('0x4f')]({'where':{'id':_0x240e87['params']['id']}})['then'](handleEntityNotFound(_0x1522aa,null))[_0xbc47('0x2a')](saveUpdates(_[_0xbc47('0x44')](_0x240e87['body'],['name',_0xbc47('0x7d')]),null))[_0xbc47('0x2a')](respondWithResult(_0x1522aa,null))[_0xbc47('0x50')](handleError(_0x1522aa,null));};exports['delete']=function(_0x5929c9,_0xaddea8,_0x22250e){return db['Sound'][_0xbc47('0x4f')]({'where':{'id':_0x5929c9[_0xbc47('0x4d')]['id']}})[_0xbc47('0x2a')](function(_0x5d9371){if(_0x5d9371){return _0x5d9371[_0xbc47('0x2d')]();}})[_0xbc47('0x2a')](function(_0x52261c){var _0x1020f9=path[_0xbc47('0x59')](config[_0xbc47('0x64')],_0xbc47('0x63'),util[_0xbc47('0x5a')](_0xbc47('0x5b'),_0x52261c['save_name'],_0x52261c['original_format']));var _0x857929=path[_0xbc47('0x59')](config[_0xbc47('0x64')],'server/files/sounds/converted',util[_0xbc47('0x5a')](_0xbc47('0x5b'),_0x52261c[_0xbc47('0x52')],_0x52261c[_0xbc47('0x53')]));fs[_0xbc47('0x69')](_0x1020f9);fs[_0xbc47('0x69')](_0x857929);return _0x52261c;})[_0xbc47('0x2a')](function(_0x2a1500){if(_0x2a1500){return _0xaddea8[_0xbc47('0x1d')](0xcc)[_0xbc47('0x1e')]();}})[_0xbc47('0x2a')](handleEntityNotFound(_0xaddea8,null))[_0xbc47('0x50')](handleError(_0xaddea8,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 02850f8..f145509 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 _0x08ed=['./sound.attributes','exports','define','Sound','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x77932a,_0x1d26d0){var _0x3e4533=function(_0x58bcff){while(--_0x58bcff){_0x77932a['push'](_0x77932a['shift']());}};_0x3e4533(++_0x1d26d0);}(_0x08ed,0x18a));var _0xd08e=function(_0x24087b,_0x10c09a){_0x24087b=_0x24087b-0x0;var _0x1ba8e4=_0x08ed[_0x24087b];return _0x1ba8e4;};'use strict';var _=require(_0xd08e('0x0'));var util=require(_0xd08e('0x1'));var logger=require(_0xd08e('0x2'))('api');var moment=require(_0xd08e('0x3'));var BPromise=require(_0xd08e('0x4'));var rp=require(_0xd08e('0x5'));var fs=require('fs');var path=require(_0xd08e('0x6'));var rimraf=require(_0xd08e('0x7'));var config=require(_0xd08e('0x8'));var attributes=require(_0xd08e('0x9'));module[_0xd08e('0xa')]=function(_0x4e5729,_0x3176a1){return _0x4e5729[_0xd08e('0xb')](_0xd08e('0xc'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44a5=['define','Sound','tools_sounds','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./sound.attributes'];(function(_0x4e9e63,_0x404777){var _0x4abb0b=function(_0x2c2d77){while(--_0x2c2d77){_0x4e9e63['push'](_0x4e9e63['shift']());}};_0x4abb0b(++_0x404777);}(_0x44a5,0x71));var _0x544a=function(_0x9dc8be,_0x1bab69){_0x9dc8be=_0x9dc8be-0x0;var _0x115701=_0x44a5[_0x9dc8be];return _0x115701;};'use strict';var _=require(_0x544a('0x0'));var util=require('util');var logger=require(_0x544a('0x1'))(_0x544a('0x2'));var moment=require(_0x544a('0x3'));var BPromise=require('bluebird');var rp=require(_0x544a('0x4'));var fs=require('fs');var path=require(_0x544a('0x5'));var rimraf=require('rimraf');var config=require(_0x544a('0x6'));var attributes=require(_0x544a('0x7'));module['exports']=function(_0x15e510,_0x448431){return _0x15e510[_0x544a('0x8')](_0x544a('0x9'),attributes,{'tableName':_0x544a('0xa'),'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 48d8340..8d6c43d 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 _0xd7b5=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','ShowSound','Sound','find','options','raw','where','include','map','model','attributes','lodash','moment','bluebird'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xd7b5,0x114));var _0x5d7b=function(_0xb7a264,_0x391e3c){_0xb7a264=_0xb7a264-0x0;var _0x101c1e=_0xd7b5[_0xb7a264];return _0x101c1e;};'use strict';var _=require(_0x5d7b('0x0'));var util=require('util');var moment=require(_0x5d7b('0x1'));var BPromise=require(_0x5d7b('0x2'));var rs=require(_0x5d7b('0x3'));var fs=require('fs');var Redis=require(_0x5d7b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d7b('0x5'));var logger=require('../../config/logger')(_0x5d7b('0x6'));var config=require(_0x5d7b('0x7'));var jayson=require(_0x5d7b('0x8'));var client=jayson[_0x5d7b('0x9')][_0x5d7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa280c8,_0x430217,_0x32d180){return new BPromise(function(_0x4555c9,_0x3e906b){return client[_0x5d7b('0xb')](_0xa280c8,_0x32d180)[_0x5d7b('0xc')](function(_0x3e41be){logger['info'](_0x5d7b('0xd'),_0x430217,_0x5d7b('0xe'));logger[_0x5d7b('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x430217,'request\x20sent',JSON[_0x5d7b('0x10')](_0x3e41be));if(_0x3e41be[_0x5d7b('0x11')]){if(_0x3e41be[_0x5d7b('0x11')]['code']===0x1f4){logger[_0x5d7b('0x11')](_0x5d7b('0xd'),_0x430217,_0x3e41be[_0x5d7b('0x11')][_0x5d7b('0x12')]);return _0x3e906b(_0x3e41be[_0x5d7b('0x11')][_0x5d7b('0x12')]);}logger[_0x5d7b('0x11')](_0x5d7b('0xd'),_0x430217,_0x3e41be[_0x5d7b('0x11')]['message']);return _0x4555c9(_0x3e41be[_0x5d7b('0x11')]['message']);}else{logger[_0x5d7b('0x13')](_0x5d7b('0xd'),_0x430217,_0x5d7b('0xe'));_0x4555c9(_0x3e41be['result']['message']);}})[_0x5d7b('0x14')](function(_0x50e763){logger[_0x5d7b('0x11')](_0x5d7b('0xd'),_0x430217,_0x50e763);_0x3e906b(_0x50e763);});});}exports[_0x5d7b('0x15')]=function(_0x3d2722){var _0x52d3ca=this;return new Promise(function(_0x511252,_0x1e9ec5){return db[_0x5d7b('0x16')][_0x5d7b('0x17')]({'raw':_0x3d2722[_0x5d7b('0x18')]?_0x3d2722[_0x5d7b('0x18')][_0x5d7b('0x19')]===undefined?!![]:![]:!![],'where':_0x3d2722[_0x5d7b('0x18')]?_0x3d2722[_0x5d7b('0x18')][_0x5d7b('0x1a')]||null:null,'attributes':_0x3d2722[_0x5d7b('0x18')]?_0x3d2722[_0x5d7b('0x18')]['attributes']||null:null,'include':_0x3d2722[_0x5d7b('0x18')]?_0x3d2722[_0x5d7b('0x18')][_0x5d7b('0x1b')]?_[_0x5d7b('0x1c')](_0x3d2722[_0x5d7b('0x18')][_0x5d7b('0x1b')],function(_0x520cc6){return{'model':db[_0x520cc6[_0x5d7b('0x1d')]],'as':_0x520cc6['as'],'attributes':_0x520cc6[_0x5d7b('0x1e')],'include':_0x520cc6[_0x5d7b('0x1b')]?_['map'](_0x520cc6[_0x5d7b('0x1b')],function(_0x3d7e63){return{'model':db[_0x3d7e63['model']],'as':_0x3d7e63['as'],'attributes':_0x3d7e63[_0x5d7b('0x1e')],'include':_0x3d7e63[_0x5d7b('0x1b')]?_[_0x5d7b('0x1c')](_0x3d7e63['include'],function(_0x5d3276){return{'model':db[_0x5d3276[_0x5d7b('0x1d')]],'as':_0x5d3276['as'],'attributes':_0x5d3276[_0x5d7b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5d7b('0xc')](function(_0x336eeb){logger['info'](_0x5d7b('0x15'),_0x3d2722);logger[_0x5d7b('0xf')]('ShowSound',_0x3d2722,JSON['stringify'](_0x336eeb));_0x511252(_0x336eeb);})[_0x5d7b('0x14')](function(_0x440df6){logger['error']('ShowSound',_0x440df6[_0x5d7b('0x12')],_0x3d2722);_0x1e9ec5(_0x52d3ca[_0x5d7b('0x11')](0x1f4,_0x440df6[_0x5d7b('0x12')]));});});}; \ No newline at end of file +var _0x870f=['../../config/logger','rpc','../../config/environment','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowSound','Sound','find','options','raw','where','include','model','attributes','map','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x870f,0x1ea));var _0xf870=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x870f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xf870('0x0'));var moment=require(_0xf870('0x1'));var BPromise=require(_0xf870('0x2'));var rs=require(_0xf870('0x3'));var fs=require('fs');var Redis=require(_0xf870('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf870('0x5'));var logger=require(_0xf870('0x6'))(_0xf870('0x7'));var config=require(_0xf870('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf870('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fcf17,_0x4092ae,_0x2b9bae){return new BPromise(function(_0x37ac6d,_0x43275f){return client[_0xf870('0xa')](_0x2fcf17,_0x2b9bae)[_0xf870('0xb')](function(_0xa06b93){logger[_0xf870('0xc')](_0xf870('0xd'),_0x4092ae,_0xf870('0xe'));logger[_0xf870('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x4092ae,_0xf870('0xe'),JSON[_0xf870('0x10')](_0xa06b93));if(_0xa06b93[_0xf870('0x11')]){if(_0xa06b93[_0xf870('0x11')]['code']===0x1f4){logger['error'](_0xf870('0xd'),_0x4092ae,_0xa06b93[_0xf870('0x11')][_0xf870('0x12')]);return _0x43275f(_0xa06b93[_0xf870('0x11')][_0xf870('0x12')]);}logger[_0xf870('0x11')](_0xf870('0xd'),_0x4092ae,_0xa06b93[_0xf870('0x11')][_0xf870('0x12')]);return _0x37ac6d(_0xa06b93['error'][_0xf870('0x12')]);}else{logger[_0xf870('0xc')]('Sound,\x20%s,\x20%s',_0x4092ae,_0xf870('0xe'));_0x37ac6d(_0xa06b93[_0xf870('0x13')][_0xf870('0x12')]);}})[_0xf870('0x14')](function(_0x158b87){logger[_0xf870('0x11')](_0xf870('0xd'),_0x4092ae,_0x158b87);_0x43275f(_0x158b87);});});}exports[_0xf870('0x15')]=function(_0x308fa0){var _0x5ed594=this;return new Promise(function(_0x150ffd,_0xa25f11){return db[_0xf870('0x16')][_0xf870('0x17')]({'raw':_0x308fa0[_0xf870('0x18')]?_0x308fa0['options'][_0xf870('0x19')]===undefined?!![]:![]:!![],'where':_0x308fa0[_0xf870('0x18')]?_0x308fa0[_0xf870('0x18')][_0xf870('0x1a')]||null:null,'attributes':_0x308fa0[_0xf870('0x18')]?_0x308fa0[_0xf870('0x18')]['attributes']||null:null,'include':_0x308fa0['options']?_0x308fa0[_0xf870('0x18')][_0xf870('0x1b')]?_['map'](_0x308fa0[_0xf870('0x18')][_0xf870('0x1b')],function(_0x34fbb7){return{'model':db[_0x34fbb7[_0xf870('0x1c')]],'as':_0x34fbb7['as'],'attributes':_0x34fbb7[_0xf870('0x1d')],'include':_0x34fbb7[_0xf870('0x1b')]?_[_0xf870('0x1e')](_0x34fbb7[_0xf870('0x1b')],function(_0x46650f){return{'model':db[_0x46650f[_0xf870('0x1c')]],'as':_0x46650f['as'],'attributes':_0x46650f[_0xf870('0x1d')],'include':_0x46650f[_0xf870('0x1b')]?_[_0xf870('0x1e')](_0x46650f[_0xf870('0x1b')],function(_0xef6093){return{'model':db[_0xef6093[_0xf870('0x1c')]],'as':_0xef6093['as'],'attributes':_0xef6093[_0xf870('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf870('0xb')](function(_0x1bba0e){logger[_0xf870('0xc')]('ShowSound',_0x308fa0);logger['debug']('ShowSound',_0x308fa0,JSON[_0xf870('0x10')](_0x1bba0e));_0x150ffd(_0x1bba0e);})[_0xf870('0x14')](function(_0x55fcac){logger[_0xf870('0x11')](_0xf870('0x15'),_0x55fcac[_0xf870('0x12')],_0x308fa0);_0xa25f11(_0x5ed594[_0xf870('0x11')](0x1f4,_0x55fcac['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d96ca79..2ef599a 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x728116,_0x486adc){var _0x3e7a25=function(_0x1de5ac){while(--_0x1de5ac){_0x728116['push'](_0x728116['shift']());}};_0x3e7a25(++_0x486adc);}(_0xac4a,0x13f));var _0xaac4=function(_0x457b08,_0x5881ed){_0x457b08=_0x457b08-0x0;var _0x4e4ee4=_0xac4a[_0x457b08];return _0x4e4ee4;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0xbb4b0a,_0x43b0b0){var _0x368223=function(_0x20b302){while(--_0x20b302){_0xbb4b0a['push'](_0xbb4b0a['shift']());}};_0x368223(++_0x43b0b0);}(_0xda3f,0xec));var _0xfda3=function(_0x47d228,_0x206c79){_0x47d228=_0x47d228-0x0;var _0x3de203=_0xda3f[_0x47d228];return _0x3de203;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 05b7db8..148f2c4 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 _0x3c41=['medium','ENUM','out','exports','STRING','TEXT'];(function(_0x4bcffc,_0x3938d0){var _0x51993f=function(_0xd325ad){while(--_0xd325ad){_0x4bcffc['push'](_0x4bcffc['shift']());}};_0x51993f(++_0x3938d0);}(_0x3c41,0x1c5));var _0x13c4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3c41[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x13c4('0x0')]={'uniqueid':{'type':Sequelize[_0x13c4('0x1')]},'body':{'type':Sequelize[_0x13c4('0x2')](_0x13c4('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x13c4('0x4')]('in',_0x13c4('0x5')),'defaultValue':_0x13c4('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x13c4('0x1')]},'providerResponse':{'type':Sequelize[_0x13c4('0x2')]}}; \ No newline at end of file +var _0xea86=['ENUM','out','TEXT','sequelize','exports','STRING','medium'];(function(_0x3b55ba,_0x3ce6aa){var _0x5087c4=function(_0x206bd9){while(--_0x206bd9){_0x3b55ba['push'](_0x3b55ba['shift']());}};_0x5087c4(++_0x3ce6aa);}(_0xea86,0x13e));var _0x6ea8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea86[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6ea8('0x0'));module[_0x6ea8('0x1')]={'uniqueid':{'type':Sequelize[_0x6ea8('0x2')]},'body':{'type':Sequelize['TEXT'](_0x6ea8('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x6ea8('0x4')]('in',_0x6ea8('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6ea8('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ab79a7e..90432ed 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 _0x02ce=['status','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','SquareMessage','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit'];(function(_0x2977f2,_0x21a601){var _0x53f5b5=function(_0x522f0b){while(--_0x522f0b){_0x2977f2['push'](_0x2977f2['shift']());}};_0x53f5b5(++_0x21a601);}(_0x02ce,0x1ac));var _0xe02c=function(_0x308448,_0x4dc5e2){_0x308448=_0x308448-0x0;var _0x445223=_0x02ce[_0x308448];return _0x445223;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefd882,_0x4411d8){return function(_0x3592ca){if(!_0x3592ca){_0xefd882[_0xe02c('0x1c')](0x194);}return _0x3592ca;};}function handleError(_0x16dfa3,_0x303d24){_0x303d24=_0x303d24||0x1f4;return function(_0x43dc78){logger[_0xe02c('0x2a')](_0x43dc78['stack']);if(_0x43dc78[_0xe02c('0x2b')]){delete _0x43dc78[_0xe02c('0x2b')];}_0x16dfa3[_0xe02c('0x22')](_0x303d24)['send'](_0x43dc78);};}exports[_0xe02c('0x2c')]=function(_0x2d1d98,_0x445421){var _0x287f7e={},_0x1e7eab={},_0x35a309={'count':0x0,'rows':[]};var _0x22a285=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x17d5b3){return{'name':_0x17d5b3['fieldName'],'type':_0x17d5b3[_0xe02c('0x30')][_0xe02c('0x31')]};});_0x1e7eab[_0xe02c('0x32')]=_[_0xe02c('0x2d')](_0x22a285,_0xe02c('0x2b'));_0x1e7eab[_0xe02c('0x33')]=_['keys'](_0x2d1d98[_0xe02c('0x33')]);_0x1e7eab[_0xe02c('0x34')]=_['intersection'](_0x1e7eab[_0xe02c('0x32')],_0x1e7eab[_0xe02c('0x33')]);_0x287f7e[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x1e7eab[_0xe02c('0x32')],qs['fields'](_0x2d1d98['query'][_0xe02c('0x37')]));_0x287f7e[_0xe02c('0x35')]=_0x287f7e['attributes'][_0xe02c('0x38')]?_0x287f7e['attributes']:_0x1e7eab[_0xe02c('0x32')];if(!_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x287f7e[_0xe02c('0x21')]=qs['limit'](_0x2d1d98[_0xe02c('0x33')]['limit']);_0x287f7e[_0xe02c('0x1e')]=qs[_0xe02c('0x1e')](_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x1e')]);}_0x287f7e[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x2d1d98['query'][_0xe02c('0x3c')]);_0x287f7e[_0xe02c('0x3d')]=qs['filters'](_[_0xe02c('0x3e')](_0x2d1d98[_0xe02c('0x33')],_0x1e7eab['filters']),_0x22a285);if(_0x2d1d98[_0xe02c('0x33')]['filter']){_0x287f7e[_0xe02c('0x3d')]=_[_0xe02c('0x3f')](_0x287f7e['where'],{'$or':_[_0xe02c('0x2d')](_0x22a285,function(_0x1eeddb){if(_0x1eeddb[_0xe02c('0x30')]!==_0xe02c('0x40')){var _0x3c4a65={};_0x3c4a65[_0x1eeddb[_0xe02c('0x2b')]]={'$like':'%'+_0x2d1d98['query'][_0xe02c('0x41')]+'%'};return _0x3c4a65;}})});}_0x287f7e=_['merge']({},_0x287f7e,_0x2d1d98['options']);var _0x3db057={'where':_0x287f7e[_0xe02c('0x3d')]};return db[_0xe02c('0x2e')][_0xe02c('0x20')](_0x3db057)['then'](function(_0x37e4fe){_0x35a309[_0xe02c('0x20')]=_0x37e4fe;if(_0x2d1d98[_0xe02c('0x33')]['includeAll']){_0x287f7e['include']=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x42')](_0x287f7e);})[_0xe02c('0x28')](function(_0x2313d2){_0x35a309[_0xe02c('0x43')]=_0x2313d2;return _0x35a309;})[_0xe02c('0x28')](respondWithFilteredResult(_0x445421,_0x287f7e))[_0xe02c('0x44')](handleError(_0x445421,null));};exports[_0xe02c('0x45')]=function(_0x21d66e,_0x53d123){var _0xc7e935={'raw':!![],'where':{'id':_0x21d66e['params']['id']}},_0x5ef4a1={};_0x5ef4a1[_0xe02c('0x32')]=_[_0xe02c('0x46')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x5ef4a1[_0xe02c('0x33')]=_[_0xe02c('0x46')](_0x21d66e[_0xe02c('0x33')]);_0x5ef4a1[_0xe02c('0x34')]=_['intersection'](_0x5ef4a1['model'],_0x5ef4a1[_0xe02c('0x33')]);_0xc7e935[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x5ef4a1['model'],qs[_0xe02c('0x37')](_0x21d66e[_0xe02c('0x33')][_0xe02c('0x37')]));_0xc7e935[_0xe02c('0x35')]=_0xc7e935[_0xe02c('0x35')][_0xe02c('0x38')]?_0xc7e935[_0xe02c('0x35')]:_0x5ef4a1[_0xe02c('0x32')];if(_0x21d66e[_0xe02c('0x33')][_0xe02c('0x47')]){_0xc7e935['include']=[{'all':!![]}];}_0xc7e935=_[_0xe02c('0x3f')]({},_0xc7e935,_0x21d66e[_0xe02c('0x48')]);return db[_0xe02c('0x2e')][_0xe02c('0x49')](_0xc7e935)[_0xe02c('0x28')](handleEntityNotFound(_0x53d123,null))[_0xe02c('0x28')](respondWithResult(_0x53d123,null))[_0xe02c('0x44')](handleError(_0x53d123,null));};exports[_0xe02c('0x4a')]=function(_0x30dc90,_0x1176c9){return db[_0xe02c('0x2e')][_0xe02c('0x4a')](_0x30dc90[_0xe02c('0x4b')],{})['then'](respondWithResult(_0x1176c9,0xc9))[_0xe02c('0x44')](handleError(_0x1176c9,null));};exports['update']=function(_0x15b05c,_0x324911){if(_0x15b05c[_0xe02c('0x4b')]['id']){delete _0x15b05c[_0xe02c('0x4b')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x49')]({'where':{'id':_0x15b05c[_0xe02c('0x4c')]['id']}})[_0xe02c('0x28')](handleEntityNotFound(_0x324911,null))[_0xe02c('0x28')](saveUpdates(_0x15b05c[_0xe02c('0x4b')],null))['then'](respondWithResult(_0x324911,null))[_0xe02c('0x44')](handleError(_0x324911,null));};exports[_0xe02c('0x29')]=function(_0xeb4214,_0x536cf7){return db[_0xe02c('0x2e')]['find']({'where':{'id':_0xeb4214[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x536cf7,null))['then'](removeEntity(_0x536cf7,null))['catch'](handleError(_0x536cf7,null));}; \ No newline at end of file +var _0xc4d8=['nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','name','index','map','SquareMessage','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','length','hasOwnProperty'];(function(_0x2cc51c,_0x310348){var _0x159187=function(_0x5d542c){while(--_0x5d542c){_0x2cc51c['push'](_0x2cc51c['shift']());}};_0x159187(++_0x310348);}(_0xc4d8,0xa6));var _0x8c4d=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xc4d8[_0x257642];return _0x3d813b;};'use strict';var emlformat=require(_0x8c4d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c4d('0x1'));var jsonpatch=require(_0x8c4d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8c4d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c4d('0x4'));var sox=require(_0x8c4d('0x5'));var csv=require(_0x8c4d('0x6'));var ejs=require(_0x8c4d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c4d('0x8'));var _=require(_0x8c4d('0x9'));var squel=require(_0x8c4d('0xa'));var crypto=require(_0x8c4d('0xb'));var jsforce=require(_0x8c4d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8c4d('0x6'));var querystring=require(_0x8c4d('0xd'));var Papa=require(_0x8c4d('0xe'));var Redis=require(_0x8c4d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8c4d('0x10'));var hardwareService=require(_0x8c4d('0x11'));var logger=require(_0x8c4d('0x12'))(_0x8c4d('0x13'));var utils=require(_0x8c4d('0x14'));var config=require(_0x8c4d('0x15'));var licenseUtil=require(_0x8c4d('0x16'));var db=require(_0x8c4d('0x17'))['db'];function respondWithStatusCode(_0x50de53,_0x21768d){_0x21768d=_0x21768d||0xcc;return function(_0x303bbc){if(_0x303bbc){return _0x50de53[_0x8c4d('0x18')](_0x21768d);}return _0x50de53[_0x8c4d('0x19')](_0x21768d)[_0x8c4d('0x1a')]();};}function respondWithResult(_0x207f67,_0x3d42f1){_0x3d42f1=_0x3d42f1||0xc8;return function(_0x220cfa){if(_0x220cfa){return _0x207f67['status'](_0x3d42f1)['json'](_0x220cfa);}};}function respondWithFilteredResult(_0x20ab4f,_0x1d410e){return function(_0x498e5d){if(_0x498e5d){var _0x355345=typeof _0x1d410e[_0x8c4d('0x1b')]===_0x8c4d('0x1c')&&typeof _0x1d410e['limit']===_0x8c4d('0x1c');var _0x3d082f=_0x498e5d[_0x8c4d('0x1d')];var _0x3a9321=_0x355345?0x0:_0x1d410e[_0x8c4d('0x1b')];var _0x59cc48=_0x355345?_0x498e5d[_0x8c4d('0x1d')]:_0x1d410e[_0x8c4d('0x1b')]+_0x1d410e['limit'];var _0x409568;if(_0x59cc48>=_0x3d082f){_0x59cc48=_0x3d082f;_0x409568=0xc8;}else{_0x409568=0xce;}_0x20ab4f[_0x8c4d('0x19')](_0x409568);return _0x20ab4f[_0x8c4d('0x1e')](_0x8c4d('0x1f'),_0x3a9321+'-'+_0x59cc48+'/'+_0x3d082f)[_0x8c4d('0x20')](_0x498e5d);}return null;};}function patchUpdates(_0x10ef16){return function(_0x17c206){try{jsonpatch[_0x8c4d('0x21')](_0x17c206,_0x10ef16,!![]);}catch(_0x17708c){return BPromise['reject'](_0x17708c);}return _0x17c206[_0x8c4d('0x22')]();};}function saveUpdates(_0x16ddc9,_0x33f0a2){return function(_0x663624){if(_0x663624){return _0x663624[_0x8c4d('0x23')](_0x16ddc9)[_0x8c4d('0x24')](function(_0x54d835){return _0x54d835;});}return null;};}function removeEntity(_0x3fd1e1,_0x10ea9b){return function(_0x52114f){if(_0x52114f){return _0x52114f[_0x8c4d('0x25')]()['then'](function(){_0x3fd1e1[_0x8c4d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a0d83,_0x292602){return function(_0x3f428b){if(!_0x3f428b){_0x2a0d83[_0x8c4d('0x18')](0x194);}return _0x3f428b;};}function handleError(_0x3dec4b,_0x10ed15){_0x10ed15=_0x10ed15||0x1f4;return function(_0x33d5f1){logger['error'](_0x33d5f1['stack']);if(_0x33d5f1[_0x8c4d('0x26')]){delete _0x33d5f1[_0x8c4d('0x26')];}_0x3dec4b[_0x8c4d('0x19')](_0x10ed15)['send'](_0x33d5f1);};}exports[_0x8c4d('0x27')]=function(_0x2c829b,_0x10ef81){var _0x5dfb6f={},_0x22f944={},_0x476266={'count':0x0,'rows':[]};var _0x2e4076=_[_0x8c4d('0x28')](db[_0x8c4d('0x29')][_0x8c4d('0x2a')],function(_0x5b35b6){return{'name':_0x5b35b6[_0x8c4d('0x2b')],'type':_0x5b35b6[_0x8c4d('0x2c')]['key']};});_0x22f944['model']=_['map'](_0x2e4076,_0x8c4d('0x26'));_0x22f944[_0x8c4d('0x2d')]=_[_0x8c4d('0x2e')](_0x2c829b[_0x8c4d('0x2d')]);_0x22f944[_0x8c4d('0x2f')]=_['intersection'](_0x22f944['model'],_0x22f944['query']);_0x5dfb6f[_0x8c4d('0x30')]=_[_0x8c4d('0x31')](_0x22f944[_0x8c4d('0x32')],qs['fields'](_0x2c829b[_0x8c4d('0x2d')]['fields']));_0x5dfb6f[_0x8c4d('0x30')]=_0x5dfb6f[_0x8c4d('0x30')][_0x8c4d('0x33')]?_0x5dfb6f[_0x8c4d('0x30')]:_0x22f944['model'];if(!_0x2c829b[_0x8c4d('0x2d')][_0x8c4d('0x34')](_0x8c4d('0x35'))){_0x5dfb6f[_0x8c4d('0x36')]=qs[_0x8c4d('0x36')](_0x2c829b[_0x8c4d('0x2d')][_0x8c4d('0x36')]);_0x5dfb6f[_0x8c4d('0x1b')]=qs['offset'](_0x2c829b[_0x8c4d('0x2d')]['offset']);}_0x5dfb6f[_0x8c4d('0x37')]=qs[_0x8c4d('0x38')](_0x2c829b[_0x8c4d('0x2d')][_0x8c4d('0x38')]);_0x5dfb6f[_0x8c4d('0x39')]=qs['filters'](_[_0x8c4d('0x3a')](_0x2c829b[_0x8c4d('0x2d')],_0x22f944[_0x8c4d('0x2f')]),_0x2e4076);if(_0x2c829b[_0x8c4d('0x2d')][_0x8c4d('0x3b')]){_0x5dfb6f[_0x8c4d('0x39')]=_[_0x8c4d('0x3c')](_0x5dfb6f[_0x8c4d('0x39')],{'$or':_[_0x8c4d('0x28')](_0x2e4076,function(_0x1b67b5){if(_0x1b67b5[_0x8c4d('0x2c')]!=='VIRTUAL'){var _0x3391d6={};_0x3391d6[_0x1b67b5[_0x8c4d('0x26')]]={'$like':'%'+_0x2c829b['query']['filter']+'%'};return _0x3391d6;}})});}_0x5dfb6f=_[_0x8c4d('0x3c')]({},_0x5dfb6f,_0x2c829b[_0x8c4d('0x3d')]);var _0x40d23c={'where':_0x5dfb6f[_0x8c4d('0x39')]};return db[_0x8c4d('0x29')][_0x8c4d('0x1d')](_0x40d23c)[_0x8c4d('0x24')](function(_0x1fa027){_0x476266['count']=_0x1fa027;if(_0x2c829b[_0x8c4d('0x2d')][_0x8c4d('0x3e')]){_0x5dfb6f[_0x8c4d('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0x8c4d('0x40')](_0x5dfb6f);})[_0x8c4d('0x24')](function(_0x5d930c){_0x476266[_0x8c4d('0x41')]=_0x5d930c;return _0x476266;})['then'](respondWithFilteredResult(_0x10ef81,_0x5dfb6f))[_0x8c4d('0x42')](handleError(_0x10ef81,null));};exports[_0x8c4d('0x43')]=function(_0xf30b0d,_0x22487e){var _0x5ed269={'raw':!![],'where':{'id':_0xf30b0d[_0x8c4d('0x44')]['id']}},_0x3d95fd={};_0x3d95fd[_0x8c4d('0x32')]=_[_0x8c4d('0x2e')](db['SquareMessage']['rawAttributes']);_0x3d95fd['query']=_[_0x8c4d('0x2e')](_0xf30b0d[_0x8c4d('0x2d')]);_0x3d95fd[_0x8c4d('0x2f')]=_['intersection'](_0x3d95fd['model'],_0x3d95fd[_0x8c4d('0x2d')]);_0x5ed269[_0x8c4d('0x30')]=_[_0x8c4d('0x31')](_0x3d95fd['model'],qs[_0x8c4d('0x45')](_0xf30b0d[_0x8c4d('0x2d')][_0x8c4d('0x45')]));_0x5ed269[_0x8c4d('0x30')]=_0x5ed269[_0x8c4d('0x30')]['length']?_0x5ed269[_0x8c4d('0x30')]:_0x3d95fd['model'];if(_0xf30b0d['query'][_0x8c4d('0x3e')]){_0x5ed269['include']=[{'all':!![]}];}_0x5ed269=_['merge']({},_0x5ed269,_0xf30b0d[_0x8c4d('0x3d')]);return db[_0x8c4d('0x29')][_0x8c4d('0x46')](_0x5ed269)[_0x8c4d('0x24')](handleEntityNotFound(_0x22487e,null))['then'](respondWithResult(_0x22487e,null))[_0x8c4d('0x42')](handleError(_0x22487e,null));};exports[_0x8c4d('0x47')]=function(_0x590c79,_0x44c0d8){return db[_0x8c4d('0x29')][_0x8c4d('0x47')](_0x590c79[_0x8c4d('0x48')],{})[_0x8c4d('0x24')](respondWithResult(_0x44c0d8,0xc9))['catch'](handleError(_0x44c0d8,null));};exports[_0x8c4d('0x23')]=function(_0x1b7801,_0x3018e2){if(_0x1b7801[_0x8c4d('0x48')]['id']){delete _0x1b7801['body']['id'];}return db[_0x8c4d('0x29')][_0x8c4d('0x46')]({'where':{'id':_0x1b7801[_0x8c4d('0x44')]['id']}})[_0x8c4d('0x24')](handleEntityNotFound(_0x3018e2,null))[_0x8c4d('0x24')](saveUpdates(_0x1b7801[_0x8c4d('0x48')],null))[_0x8c4d('0x24')](respondWithResult(_0x3018e2,null))[_0x8c4d('0x42')](handleError(_0x3018e2,null));};exports[_0x8c4d('0x25')]=function(_0xa4ec88,_0x396e8c){return db[_0x8c4d('0x29')][_0x8c4d('0x46')]({'where':{'id':_0xa4ec88[_0x8c4d('0x44')]['id']}})[_0x8c4d('0x24')](handleEntityNotFound(_0x396e8c,null))[_0x8c4d('0x24')](removeEntity(_0x396e8c,null))[_0x8c4d('0x42')](handleError(_0x396e8c,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 75300e8..b70ba40 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 _0xe803=['SquareMessage','square_messages','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0xbdf0bc,_0x31ed5b){var _0x368671=function(_0x150d8d){while(--_0x150d8d){_0xbdf0bc['push'](_0xbdf0bc['shift']());}};_0x368671(++_0x31ed5b);}(_0xe803,0xce));var _0x3e80=function(_0x57575c,_0xaab039){_0x57575c=_0x57575c-0x0;var _0xfe3c76=_0xe803[_0x57575c];return _0xfe3c76;};'use strict';var _=require('lodash');var util=require(_0x3e80('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3e80('0x1'));var BPromise=require(_0x3e80('0x2'));var rp=require(_0x3e80('0x3'));var fs=require('fs');var path=require(_0x3e80('0x4'));var rimraf=require(_0x3e80('0x5'));var config=require(_0x3e80('0x6'));var attributes=require(_0x3e80('0x7'));module[_0x3e80('0x8')]=function(_0xa4e7b9,_0x2143af){return _0xa4e7b9[_0x3e80('0x9')](_0x3e80('0xa'),attributes,{'tableName':_0x3e80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad4e=['square_messages','lodash','../../config/logger','bluebird','request-promise','path','exports','SquareMessage'];(function(_0x23c651,_0x143982){var _0xbe7bdb=function(_0x1979e2){while(--_0x1979e2){_0x23c651['push'](_0x23c651['shift']());}};_0xbe7bdb(++_0x143982);}(_0xad4e,0x171));var _0xead4=function(_0x478d8c,_0x3341c1){_0x478d8c=_0x478d8c-0x0;var _0x3f343a=_0xad4e[_0x478d8c];return _0x3f343a;};'use strict';var _=require(_0xead4('0x0'));var util=require('util');var logger=require(_0xead4('0x1'))('api');var moment=require('moment');var BPromise=require(_0xead4('0x2'));var rp=require(_0xead4('0x3'));var fs=require('fs');var path=require(_0xead4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0xead4('0x5')]=function(_0x224881,_0x183915){return _0x224881['define'](_0xead4('0x6'),attributes,{'tableName':_0xead4('0x7'),'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 474cbd6..2cf21a7 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 _0x04df=['rpc','../../config/environment','jayson/promise','client','http','request','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ab560,_0x5e8fe2){var _0xfe1853=function(_0x154fa7){while(--_0x154fa7){_0x4ab560['push'](_0x4ab560['shift']());}};_0xfe1853(++_0x5e8fe2);}(_0x04df,0x17f));var _0xf04d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x04df[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xf04d('0x0'));var util=require(_0xf04d('0x1'));var moment=require(_0xf04d('0x2'));var BPromise=require('bluebird');var rs=require(_0xf04d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf04d('0x4'))['db'];var utils=require(_0xf04d('0x5'));var logger=require(_0xf04d('0x6'))(_0xf04d('0x7'));var config=require(_0xf04d('0x8'));var jayson=require(_0xf04d('0x9'));var client=jayson[_0xf04d('0xa')][_0xf04d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8d76eb,_0x375a64,_0x16fc49){return new BPromise(function(_0x48ec42,_0x4363de){return client[_0xf04d('0xc')](_0x8d76eb,_0x16fc49)['then'](function(_0x2cd612){logger[_0xf04d('0xd')]('SquareMessage,\x20%s,\x20%s',_0x375a64,'request\x20sent');logger[_0xf04d('0xe')](_0xf04d('0xf'),_0x375a64,'request\x20sent',JSON['stringify'](_0x2cd612));if(_0x2cd612[_0xf04d('0x10')]){if(_0x2cd612['error'][_0xf04d('0x11')]===0x1f4){logger['error'](_0xf04d('0x12'),_0x375a64,_0x2cd612[_0xf04d('0x10')][_0xf04d('0x13')]);return _0x4363de(_0x2cd612[_0xf04d('0x10')][_0xf04d('0x13')]);}logger[_0xf04d('0x10')](_0xf04d('0x12'),_0x375a64,_0x2cd612[_0xf04d('0x10')][_0xf04d('0x13')]);return _0x48ec42(_0x2cd612[_0xf04d('0x10')][_0xf04d('0x13')]);}else{logger[_0xf04d('0xd')](_0xf04d('0x12'),_0x375a64,'request\x20sent');_0x48ec42(_0x2cd612[_0xf04d('0x14')][_0xf04d('0x13')]);}})[_0xf04d('0x15')](function(_0x5d3cab){logger[_0xf04d('0x10')](_0xf04d('0x12'),_0x375a64,_0x5d3cab);_0x4363de(_0x5d3cab);});});}exports[_0xf04d('0x16')]=function(_0xf0ca27){var _0x4668a1=this;return new Promise(function(_0x38f16c,_0x503578){return db[_0xf04d('0x17')][_0xf04d('0x18')](_0xf0ca27[_0xf04d('0x19')],{'raw':_0xf0ca27['options']?_0xf0ca27[_0xf04d('0x1a')][_0xf04d('0x1b')]===undefined?!![]:![]:!![]})[_0xf04d('0x1c')](function(_0x57b809){logger[_0xf04d('0xd')]('CreateSquareMessage',_0xf0ca27);logger[_0xf04d('0xe')](_0xf04d('0x16'),_0xf0ca27,JSON[_0xf04d('0x1d')](_0x57b809));_0x38f16c(_0x57b809);})[_0xf04d('0x15')](function(_0x2a4510){logger['error'](_0xf04d('0x16'),_0x2a4510[_0xf04d('0x13')],_0xf0ca27);_0x503578(_0x4668a1[_0xf04d('0x10')](0x1f4,_0x2a4510[_0xf04d('0x13')]));});});}; \ No newline at end of file +var _0x4835=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','moment','bluebird','randomstring'];(function(_0x569c36,_0x113fc3){var _0x451fa5=function(_0x33b4c9){while(--_0x33b4c9){_0x569c36['push'](_0x569c36['shift']());}};_0x451fa5(++_0x113fc3);}(_0x4835,0x128));var _0x5483=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4835[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x5483('0x0'));var util=require('util');var moment=require(_0x5483('0x1'));var BPromise=require(_0x5483('0x2'));var rs=require(_0x5483('0x3'));var fs=require('fs');var Redis=require(_0x5483('0x4'));var db=require(_0x5483('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5483('0x6'))(_0x5483('0x7'));var config=require(_0x5483('0x8'));var jayson=require(_0x5483('0x9'));var client=jayson[_0x5483('0xa')][_0x5483('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x180c84,_0x2a38a0,_0x5c9675){return new BPromise(function(_0x4083c0,_0x4628be){return client[_0x5483('0xc')](_0x180c84,_0x5c9675)[_0x5483('0xd')](function(_0x50ae18){logger[_0x5483('0xe')](_0x5483('0xf'),_0x2a38a0,_0x5483('0x10'));logger[_0x5483('0x11')](_0x5483('0x12'),_0x2a38a0,'request\x20sent',JSON[_0x5483('0x13')](_0x50ae18));if(_0x50ae18[_0x5483('0x14')]){if(_0x50ae18[_0x5483('0x14')][_0x5483('0x15')]===0x1f4){logger['error'](_0x5483('0xf'),_0x2a38a0,_0x50ae18[_0x5483('0x14')][_0x5483('0x16')]);return _0x4628be(_0x50ae18[_0x5483('0x14')][_0x5483('0x16')]);}logger[_0x5483('0x14')](_0x5483('0xf'),_0x2a38a0,_0x50ae18['error'][_0x5483('0x16')]);return _0x4083c0(_0x50ae18[_0x5483('0x14')][_0x5483('0x16')]);}else{logger[_0x5483('0xe')](_0x5483('0xf'),_0x2a38a0,'request\x20sent');_0x4083c0(_0x50ae18[_0x5483('0x17')]['message']);}})['catch'](function(_0x5d8c09){logger[_0x5483('0x14')](_0x5483('0xf'),_0x2a38a0,_0x5d8c09);_0x4628be(_0x5d8c09);});});}exports[_0x5483('0x18')]=function(_0x3978ca){var _0x106fca=this;return new Promise(function(_0x1239ab,_0xdc1848){return db[_0x5483('0x19')][_0x5483('0x1a')](_0x3978ca[_0x5483('0x1b')],{'raw':_0x3978ca[_0x5483('0x1c')]?_0x3978ca['options'][_0x5483('0x1d')]===undefined?!![]:![]:!![]})[_0x5483('0xd')](function(_0x171d62){logger['info']('CreateSquareMessage',_0x3978ca);logger[_0x5483('0x11')](_0x5483('0x18'),_0x3978ca,JSON[_0x5483('0x13')](_0x171d62));_0x1239ab(_0x171d62);})['catch'](function(_0x5b5469){logger[_0x5483('0x14')](_0x5483('0x18'),_0x5b5469['message'],_0x3978ca);_0xdc1848(_0x106fca[_0x5483('0x14')](0x1f4,_0x5b5469['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f0091ba..678c7be 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 _0xd314=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','get','/:id','show','/:id/test','post','create','put'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xd314,0x81));var _0x4d31=function(_0x23087b,_0x2ed164){_0x23087b=_0x23087b-0x0;var _0x4eedf5=_0xd314[_0x23087b];return _0x4eedf5;};'use strict';var multer=require(_0x4d31('0x0'));var util=require(_0x4d31('0x1'));var path=require(_0x4d31('0x2'));var timeout=require(_0x4d31('0x3'));var express=require('express');var router=express[_0x4d31('0x4')]();var fs_extra=require(_0x4d31('0x5'));var auth=require(_0x4d31('0x6'));var interaction=require(_0x4d31('0x7'));var config=require(_0x4d31('0x8'));var controller=require(_0x4d31('0x9'));router['get']('/',auth[_0x4d31('0xa')](),controller['index']);router[_0x4d31('0xb')](_0x4d31('0xc'),auth[_0x4d31('0xa')](),controller[_0x4d31('0xd')]);router[_0x4d31('0xb')](_0x4d31('0xe'),auth['isAuthenticated'](),timeout('15s'),controller['test']);router[_0x4d31('0xf')]('/',auth[_0x4d31('0xa')](),controller[_0x4d31('0x10')]);router[_0x4d31('0x11')](_0x4d31('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4d31('0x12')](_0x4d31('0xc'),auth['isAuthenticated'](),controller[_0x4d31('0x13')]);module[_0x4d31('0x14')]=router; \ No newline at end of file +var _0x7c1e=['update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','create','put'];(function(_0x42c18d,_0x6a7dc2){var _0x1bc775=function(_0x3d01f9){while(--_0x3d01f9){_0x42c18d['push'](_0x42c18d['shift']());}};_0x1bc775(++_0x6a7dc2);}(_0x7c1e,0x157));var _0xe7c1=function(_0x4ea4a6,_0x3fec1a){_0x4ea4a6=_0x4ea4a6-0x0;var _0x2bccd8=_0x7c1e[_0x4ea4a6];return _0x2bccd8;};'use strict';var multer=require(_0xe7c1('0x0'));var util=require('util');var path=require(_0xe7c1('0x1'));var timeout=require(_0xe7c1('0x2'));var express=require(_0xe7c1('0x3'));var router=express[_0xe7c1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe7c1('0x5'));var config=require(_0xe7c1('0x6'));var controller=require(_0xe7c1('0x7'));router[_0xe7c1('0x8')]('/',auth[_0xe7c1('0x9')](),controller['index']);router[_0xe7c1('0x8')](_0xe7c1('0xa'),auth[_0xe7c1('0x9')](),controller[_0xe7c1('0xb')]);router['get'](_0xe7c1('0xc'),auth[_0xe7c1('0x9')](),timeout(_0xe7c1('0xd')),controller[_0xe7c1('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe7c1('0xf')]);router[_0xe7c1('0x10')](_0xe7c1('0xa'),auth[_0xe7c1('0x9')](),controller[_0xe7c1('0x11')]);router[_0xe7c1('0x12')](_0xe7c1('0xa'),auth[_0xe7c1('0x9')](),controller[_0xe7c1('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0052d02..1877f0a 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 _0x8011=['exports','STRING','sequelize'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x8011,0xc8));var _0x1801=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x8011[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0x1801('0x0'));module[_0x1801('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x1801('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf4d=['STRING','sequelize','exports'];(function(_0x27b118,_0xd7cdcf){var _0x3152af=function(_0x4eec1e){while(--_0x4eec1e){_0x27b118['push'](_0x27b118['shift']());}};_0x3152af(++_0xd7cdcf);}(_0xbf4d,0x10c));var _0xdbf4=function(_0x197a7a,_0x4b9054){_0x197a7a=_0x197a7a-0x0;var _0x386cb6=_0xbf4d[_0x197a7a];return _0x386cb6;};'use strict';var Sequelize=require(_0xdbf4('0x0'));module[_0xdbf4('0x1')]={'name':{'type':Sequelize[_0xdbf4('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xdbf4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5dc0bb9..329ddab 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 _0x18d9=['apply','reject','then','ODBC','UserProfileResource','destroy','end','error','stack','name','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','SquareOdbc','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','odbc','openSync','closeSync','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json'];(function(_0xe04465,_0x4cffdf){var _0x1679c3=function(_0x30efe4){while(--_0x30efe4){_0xe04465['push'](_0xe04465['shift']());}};_0x1679c3(++_0x4cffdf);}(_0x18d9,0xd7));var _0x918d=function(_0xa5cd2f,_0x4e495e){_0xa5cd2f=_0xa5cd2f-0x0;var _0x151b0a=_0x18d9[_0xa5cd2f];return _0x151b0a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x918d('0x0'));var jsonpatch=require(_0x918d('0x1'));var rp=require('request-promise');var moment=require(_0x918d('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x918d('0x3'));var path=require(_0x918d('0x4'));var sox=require(_0x918d('0x5'));var csv=require(_0x918d('0x6'));var ejs=require(_0x918d('0x7'));var fs=require('fs');var fs_extra=require(_0x918d('0x8'));var _=require('lodash');var squel=require(_0x918d('0x9'));var crypto=require(_0x918d('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x918d('0x6'));var querystring=require(_0x918d('0xb'));var Papa=require(_0x918d('0xc'));var Redis=require(_0x918d('0xd'));var authService=require(_0x918d('0xe'));var qs=require(_0x918d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x918d('0x10'))(_0x918d('0x11'));var utils=require(_0x918d('0x12'));var config=require(_0x918d('0x13'));var licenseUtil=require(_0x918d('0x14'));var db=require(_0x918d('0x15'))['db'];function respondWithStatusCode(_0x5286a2,_0x2c657d){_0x2c657d=_0x2c657d||0xcc;return function(_0x42eded){if(_0x42eded){return _0x5286a2[_0x918d('0x16')](_0x2c657d);}return _0x5286a2[_0x918d('0x17')](_0x2c657d)['end']();};}function respondWithResult(_0x2442ed,_0x2754bb){_0x2754bb=_0x2754bb||0xc8;return function(_0x360812){if(_0x360812){return _0x2442ed[_0x918d('0x17')](_0x2754bb)['json'](_0x360812);}};}function respondWithFilteredResult(_0x3525c2,_0x48ffac){return function(_0x1c4407){if(_0x1c4407){var _0x561d4e=typeof _0x48ffac[_0x918d('0x18')]===_0x918d('0x19')&&typeof _0x48ffac['limit']===_0x918d('0x19');var _0x440202=_0x1c4407[_0x918d('0x1a')];var _0x3e58fa=_0x561d4e?0x0:_0x48ffac[_0x918d('0x18')];var _0x1efd68=_0x561d4e?_0x1c4407[_0x918d('0x1a')]:_0x48ffac[_0x918d('0x18')]+_0x48ffac[_0x918d('0x1b')];var _0x32e3a1;if(_0x1efd68>=_0x440202){_0x1efd68=_0x440202;_0x32e3a1=0xc8;}else{_0x32e3a1=0xce;}_0x3525c2[_0x918d('0x17')](_0x32e3a1);return _0x3525c2[_0x918d('0x1c')](_0x918d('0x1d'),_0x3e58fa+'-'+_0x1efd68+'/'+_0x440202)[_0x918d('0x1e')](_0x1c4407);}return null;};}function patchUpdates(_0x167274){return function(_0x8185e9){try{jsonpatch[_0x918d('0x1f')](_0x8185e9,_0x167274,!![]);}catch(_0xa0ce2a){return BPromise[_0x918d('0x20')](_0xa0ce2a);}return _0x8185e9['save']();};}function saveUpdates(_0x4d651c,_0x59f9e4){return function(_0x4583d9){if(_0x4583d9){return _0x4583d9['update'](_0x4d651c)[_0x918d('0x21')](function(_0x58ca94){return _0x58ca94;});}return null;};}function removeEntity(_0x43e626,_0x30b4b9){return function(_0x5d1fb3){if(_0x5d1fb3){return _0x5d1fb3['destroy']()[_0x918d('0x21')](function(){var _0x2a4081=_0x5d1fb3['get']({'plain':!![]});var _0x4475c5=_0x918d('0x22');return db[_0x918d('0x23')][_0x918d('0x24')]({'where':{'type':_0x4475c5,'resourceId':_0x2a4081['id']}})[_0x918d('0x21')](function(){return _0x5d1fb3;});})[_0x918d('0x21')](function(){_0x43e626[_0x918d('0x17')](0xcc)[_0x918d('0x25')]();});}};}function handleEntityNotFound(_0x4d8a46,_0x316d75){return function(_0x383c5e){if(!_0x383c5e){_0x4d8a46['sendStatus'](0x194);}return _0x383c5e;};}function handleError(_0x213b56,_0x4de12f){_0x4de12f=_0x4de12f||0x1f4;return function(_0x5021c1){logger[_0x918d('0x26')](_0x5021c1[_0x918d('0x27')]);if(_0x5021c1[_0x918d('0x28')]){delete _0x5021c1['name'];}_0x213b56[_0x918d('0x17')](_0x4de12f)['send'](_0x5021c1);};}exports[_0x918d('0x29')]=function(_0x51925b,_0x4a327c){var _0x13c3a9={},_0xf902d4={},_0x9528f3={'count':0x0,'rows':[]};var _0x2635b9=_['map'](db['SquareOdbc'][_0x918d('0x2a')],function(_0x52c55e){return{'name':_0x52c55e['fieldName'],'type':_0x52c55e[_0x918d('0x2b')][_0x918d('0x2c')]};});_0xf902d4[_0x918d('0x2d')]=_[_0x918d('0x2e')](_0x2635b9,_0x918d('0x28'));_0xf902d4[_0x918d('0x2f')]=_[_0x918d('0x30')](_0x51925b[_0x918d('0x2f')]);_0xf902d4[_0x918d('0x31')]=_[_0x918d('0x32')](_0xf902d4[_0x918d('0x2d')],_0xf902d4[_0x918d('0x2f')]);_0x13c3a9[_0x918d('0x33')]=_[_0x918d('0x32')](_0xf902d4[_0x918d('0x2d')],qs[_0x918d('0x34')](_0x51925b['query']['fields']));_0x13c3a9[_0x918d('0x33')]=_0x13c3a9[_0x918d('0x33')][_0x918d('0x35')]?_0x13c3a9[_0x918d('0x33')]:_0xf902d4[_0x918d('0x2d')];if(!_0x51925b[_0x918d('0x2f')]['hasOwnProperty']('nolimit')){_0x13c3a9[_0x918d('0x1b')]=qs['limit'](_0x51925b[_0x918d('0x2f')]['limit']);_0x13c3a9[_0x918d('0x18')]=qs[_0x918d('0x18')](_0x51925b['query'][_0x918d('0x18')]);}_0x13c3a9['order']=qs[_0x918d('0x36')](_0x51925b[_0x918d('0x2f')]['sort']);_0x13c3a9[_0x918d('0x37')]=qs[_0x918d('0x31')](_[_0x918d('0x38')](_0x51925b[_0x918d('0x2f')],_0xf902d4[_0x918d('0x31')]),_0x2635b9);if(_0x51925b[_0x918d('0x2f')][_0x918d('0x39')]){_0x13c3a9['where']=_[_0x918d('0x3a')](_0x13c3a9[_0x918d('0x37')],{'$or':_[_0x918d('0x2e')](_0x2635b9,function(_0x400e09){if(_0x400e09[_0x918d('0x2b')]!=='VIRTUAL'){var _0x239c22={};_0x239c22[_0x400e09[_0x918d('0x28')]]={'$like':'%'+_0x51925b[_0x918d('0x2f')][_0x918d('0x39')]+'%'};return _0x239c22;}})});}_0x13c3a9=_[_0x918d('0x3a')]({},_0x13c3a9,_0x51925b[_0x918d('0x3b')]);var _0x45679a={'where':_0x13c3a9['where']};return db[_0x918d('0x3c')][_0x918d('0x1a')](_0x45679a)[_0x918d('0x21')](function(_0x49e5d0){_0x9528f3['count']=_0x49e5d0;if(_0x51925b[_0x918d('0x2f')][_0x918d('0x3d')]){_0x13c3a9[_0x918d('0x3e')]=[{'all':!![]}];}return db[_0x918d('0x3c')][_0x918d('0x3f')](_0x13c3a9);})[_0x918d('0x21')](function(_0x4825b2){_0x9528f3[_0x918d('0x40')]=_0x4825b2;return _0x9528f3;})[_0x918d('0x21')](respondWithFilteredResult(_0x4a327c,_0x13c3a9))[_0x918d('0x41')](handleError(_0x4a327c,null));};exports['show']=function(_0x338a39,_0x467631){var _0x5f029a={'raw':!![],'where':{'id':_0x338a39[_0x918d('0x42')]['id']}},_0x1a0327={};_0x1a0327[_0x918d('0x2d')]=_[_0x918d('0x30')](db[_0x918d('0x3c')][_0x918d('0x2a')]);_0x1a0327[_0x918d('0x2f')]=_[_0x918d('0x30')](_0x338a39['query']);_0x1a0327[_0x918d('0x31')]=_[_0x918d('0x32')](_0x1a0327['model'],_0x1a0327[_0x918d('0x2f')]);_0x5f029a['attributes']=_[_0x918d('0x32')](_0x1a0327[_0x918d('0x2d')],qs[_0x918d('0x34')](_0x338a39[_0x918d('0x2f')]['fields']));_0x5f029a['attributes']=_0x5f029a['attributes'][_0x918d('0x35')]?_0x5f029a[_0x918d('0x33')]:_0x1a0327[_0x918d('0x2d')];if(_0x338a39[_0x918d('0x2f')][_0x918d('0x3d')]){_0x5f029a['include']=[{'all':!![]}];}_0x5f029a=_[_0x918d('0x3a')]({},_0x5f029a,_0x338a39[_0x918d('0x3b')]);return db[_0x918d('0x3c')][_0x918d('0x43')](_0x5f029a)[_0x918d('0x21')](handleEntityNotFound(_0x467631,null))[_0x918d('0x21')](respondWithResult(_0x467631,null))['catch'](handleError(_0x467631,null));};exports['create']=function(_0x2a8108,_0x42de11){return db[_0x918d('0x3c')][_0x918d('0x44')](_0x2a8108[_0x918d('0x45')],{})[_0x918d('0x21')](function(_0x4282fa){var _0x3922f0=_0x2a8108[_0x918d('0x46')][_0x918d('0x47')]({'plain':!![]});if(!_0x3922f0)throw new Error(_0x918d('0x48'));if(_0x3922f0['role']==='user'){var _0x25bac0=_0x4282fa['get']({'plain':!![]});var _0x3f2b69=_0x918d('0x22');return db[_0x918d('0x49')][_0x918d('0x43')]({'where':{'name':_0x3f2b69,'userProfileId':_0x3922f0['userProfileId']},'raw':!![]})[_0x918d('0x21')](function(_0x10fe9d){if(_0x10fe9d&&_0x10fe9d[_0x918d('0x4a')]===0x0){return db['UserProfileResource'][_0x918d('0x44')]({'name':_0x25bac0[_0x918d('0x28')],'resourceId':_0x25bac0['id'],'type':_0x10fe9d[_0x918d('0x28')],'sectionId':_0x10fe9d['id']},{})['then'](function(){return _0x4282fa;});}else{return _0x4282fa;}})[_0x918d('0x41')](function(_0x4b5ab7){logger[_0x918d('0x26')](_0x918d('0x4b'),_0x4b5ab7);throw _0x4b5ab7;});}return _0x4282fa;})[_0x918d('0x21')](respondWithResult(_0x42de11,0xc9))[_0x918d('0x41')](handleError(_0x42de11,null));};exports[_0x918d('0x4c')]=function(_0x23dea2,_0x29ea1d){if(_0x23dea2[_0x918d('0x45')]['id']){delete _0x23dea2[_0x918d('0x45')]['id'];}return db[_0x918d('0x3c')][_0x918d('0x43')]({'where':{'id':_0x23dea2['params']['id']}})[_0x918d('0x21')](handleEntityNotFound(_0x29ea1d,null))['then'](saveUpdates(_0x23dea2[_0x918d('0x45')],null))['then'](respondWithResult(_0x29ea1d,null))[_0x918d('0x41')](handleError(_0x29ea1d,null));};exports[_0x918d('0x24')]=function(_0x2ff166,_0x3b38de){return db[_0x918d('0x3c')][_0x918d('0x43')]({'where':{'id':_0x2ff166[_0x918d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b38de,null))['then'](removeEntity(_0x3b38de,null))[_0x918d('0x41')](handleError(_0x3b38de,null));};exports[_0x918d('0x4d')]=function(_0x5edec4,_0x1d143e,_0x26b88e){var _0x9f4861;return db[_0x918d('0x3c')][_0x918d('0x43')]({'where':{'id':_0x5edec4['params']['id']},'attributes':['id',_0x918d('0x4e')]})[_0x918d('0x21')](handleEntityNotFound(_0x1d143e,null))[_0x918d('0x21')](function(_0x2569c8){if(_0x2569c8){var _0x17f7cf=require(_0x918d('0x4f'))();_0x17f7cf[_0x918d('0x50')](_0x2569c8[_0x918d('0x4e')]);_0x17f7cf[_0x918d('0x51')]();return _0x2569c8;}})[_0x918d('0x21')](respondWithResult(_0x1d143e,null))[_0x918d('0x41')](handleError(_0x1d143e,null));}; \ No newline at end of file +var _0x1c2f=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','get','ODBC','UserProfileResource','error','stack','send','index','map','SquareOdbc','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','test','dsn','odbc','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x475767,_0x2ed5da){var _0x4f192e=function(_0x1e6e24){while(--_0x1e6e24){_0x475767['push'](_0x475767['shift']());}};_0x4f192e(++_0x2ed5da);}(_0x1c2f,0x1e3));var _0xf1c2=function(_0x19ee96,_0x48b7d5){_0x19ee96=_0x19ee96-0x0;var _0x57aaf0=_0x1c2f[_0x19ee96];return _0x57aaf0;};'use strict';var emlformat=require(_0xf1c2('0x0'));var rimraf=require(_0xf1c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf1c2('0x2'));var rp=require(_0xf1c2('0x3'));var moment=require(_0xf1c2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf1c2('0x5'));var path=require(_0xf1c2('0x6'));var sox=require('sox');var csv=require(_0xf1c2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf1c2('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf1c2('0x9'));var deskjs=require(_0xf1c2('0xa'));var toCsv=require(_0xf1c2('0x7'));var querystring=require(_0xf1c2('0xb'));var Papa=require(_0xf1c2('0xc'));var Redis=require(_0xf1c2('0xd'));var authService=require(_0xf1c2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf1c2('0xf'));var hardwareService=require(_0xf1c2('0x10'));var logger=require('../../config/logger')(_0xf1c2('0x11'));var utils=require(_0xf1c2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf1c2('0x13'));var db=require(_0xf1c2('0x14'))['db'];function respondWithStatusCode(_0x346dac,_0xcceb1){_0xcceb1=_0xcceb1||0xcc;return function(_0x4c8a24){if(_0x4c8a24){return _0x346dac[_0xf1c2('0x15')](_0xcceb1);}return _0x346dac[_0xf1c2('0x16')](_0xcceb1)[_0xf1c2('0x17')]();};}function respondWithResult(_0x35433e,_0x53b941){_0x53b941=_0x53b941||0xc8;return function(_0x3438d0){if(_0x3438d0){return _0x35433e[_0xf1c2('0x16')](_0x53b941)[_0xf1c2('0x18')](_0x3438d0);}};}function respondWithFilteredResult(_0x519d41,_0x55426c){return function(_0x3d4706){if(_0x3d4706){var _0x227ba0=typeof _0x55426c[_0xf1c2('0x19')]===_0xf1c2('0x1a')&&typeof _0x55426c['limit']===_0xf1c2('0x1a');var _0x15a3bd=_0x3d4706['count'];var _0xc44629=_0x227ba0?0x0:_0x55426c['offset'];var _0x4542fe=_0x227ba0?_0x3d4706[_0xf1c2('0x1b')]:_0x55426c[_0xf1c2('0x19')]+_0x55426c[_0xf1c2('0x1c')];var _0x1e2484;if(_0x4542fe>=_0x15a3bd){_0x4542fe=_0x15a3bd;_0x1e2484=0xc8;}else{_0x1e2484=0xce;}_0x519d41[_0xf1c2('0x16')](_0x1e2484);return _0x519d41[_0xf1c2('0x1d')](_0xf1c2('0x1e'),_0xc44629+'-'+_0x4542fe+'/'+_0x15a3bd)[_0xf1c2('0x18')](_0x3d4706);}return null;};}function patchUpdates(_0x47530e){return function(_0x3d5cbe){try{jsonpatch['apply'](_0x3d5cbe,_0x47530e,!![]);}catch(_0x6f58d2){return BPromise[_0xf1c2('0x1f')](_0x6f58d2);}return _0x3d5cbe[_0xf1c2('0x20')]();};}function saveUpdates(_0x1beae3,_0x37dafa){return function(_0x2b2b95){if(_0x2b2b95){return _0x2b2b95[_0xf1c2('0x21')](_0x1beae3)[_0xf1c2('0x22')](function(_0x3b3222){return _0x3b3222;});}return null;};}function removeEntity(_0x4ba87a,_0x20fdea){return function(_0x25f03a){if(_0x25f03a){return _0x25f03a['destroy']()[_0xf1c2('0x22')](function(){var _0x5c0136=_0x25f03a[_0xf1c2('0x23')]({'plain':!![]});var _0x2a79eb=_0xf1c2('0x24');return db[_0xf1c2('0x25')]['destroy']({'where':{'type':_0x2a79eb,'resourceId':_0x5c0136['id']}})[_0xf1c2('0x22')](function(){return _0x25f03a;});})[_0xf1c2('0x22')](function(){_0x4ba87a[_0xf1c2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5999b2,_0x202631){return function(_0x277df7){if(!_0x277df7){_0x5999b2['sendStatus'](0x194);}return _0x277df7;};}function handleError(_0x333808,_0x493cc0){_0x493cc0=_0x493cc0||0x1f4;return function(_0x4d7309){logger[_0xf1c2('0x26')](_0x4d7309[_0xf1c2('0x27')]);if(_0x4d7309['name']){delete _0x4d7309['name'];}_0x333808['status'](_0x493cc0)[_0xf1c2('0x28')](_0x4d7309);};}exports[_0xf1c2('0x29')]=function(_0x365a61,_0x2f86a3){var _0x73941d={},_0x13429d={},_0x157b25={'count':0x0,'rows':[]};var _0x1db2d5=_[_0xf1c2('0x2a')](db[_0xf1c2('0x2b')][_0xf1c2('0x2c')],function(_0x3c339e){return{'name':_0x3c339e['fieldName'],'type':_0x3c339e[_0xf1c2('0x2d')]['key']};});_0x13429d[_0xf1c2('0x2e')]=_[_0xf1c2('0x2a')](_0x1db2d5,'name');_0x13429d[_0xf1c2('0x2f')]=_[_0xf1c2('0x30')](_0x365a61[_0xf1c2('0x2f')]);_0x13429d[_0xf1c2('0x31')]=_['intersection'](_0x13429d[_0xf1c2('0x2e')],_0x13429d[_0xf1c2('0x2f')]);_0x73941d[_0xf1c2('0x32')]=_[_0xf1c2('0x33')](_0x13429d[_0xf1c2('0x2e')],qs[_0xf1c2('0x34')](_0x365a61['query'][_0xf1c2('0x34')]));_0x73941d['attributes']=_0x73941d['attributes'][_0xf1c2('0x35')]?_0x73941d[_0xf1c2('0x32')]:_0x13429d[_0xf1c2('0x2e')];if(!_0x365a61[_0xf1c2('0x2f')]['hasOwnProperty'](_0xf1c2('0x36'))){_0x73941d[_0xf1c2('0x1c')]=qs[_0xf1c2('0x1c')](_0x365a61['query'][_0xf1c2('0x1c')]);_0x73941d[_0xf1c2('0x19')]=qs['offset'](_0x365a61[_0xf1c2('0x2f')]['offset']);}_0x73941d[_0xf1c2('0x37')]=qs['sort'](_0x365a61[_0xf1c2('0x2f')][_0xf1c2('0x38')]);_0x73941d[_0xf1c2('0x39')]=qs[_0xf1c2('0x31')](_[_0xf1c2('0x3a')](_0x365a61[_0xf1c2('0x2f')],_0x13429d[_0xf1c2('0x31')]),_0x1db2d5);if(_0x365a61[_0xf1c2('0x2f')][_0xf1c2('0x3b')]){_0x73941d[_0xf1c2('0x39')]=_[_0xf1c2('0x3c')](_0x73941d[_0xf1c2('0x39')],{'$or':_[_0xf1c2('0x2a')](_0x1db2d5,function(_0x5c7d07){if(_0x5c7d07[_0xf1c2('0x2d')]!==_0xf1c2('0x3d')){var _0x2f2a15={};_0x2f2a15[_0x5c7d07[_0xf1c2('0x3e')]]={'$like':'%'+_0x365a61[_0xf1c2('0x2f')]['filter']+'%'};return _0x2f2a15;}})});}_0x73941d=_['merge']({},_0x73941d,_0x365a61[_0xf1c2('0x3f')]);var _0x2e12bb={'where':_0x73941d[_0xf1c2('0x39')]};return db[_0xf1c2('0x2b')][_0xf1c2('0x1b')](_0x2e12bb)[_0xf1c2('0x22')](function(_0x211ff8){_0x157b25[_0xf1c2('0x1b')]=_0x211ff8;if(_0x365a61[_0xf1c2('0x2f')][_0xf1c2('0x40')]){_0x73941d[_0xf1c2('0x41')]=[{'all':!![]}];}return db[_0xf1c2('0x2b')][_0xf1c2('0x42')](_0x73941d);})[_0xf1c2('0x22')](function(_0x4d3d1c){_0x157b25['rows']=_0x4d3d1c;return _0x157b25;})[_0xf1c2('0x22')](respondWithFilteredResult(_0x2f86a3,_0x73941d))[_0xf1c2('0x43')](handleError(_0x2f86a3,null));};exports[_0xf1c2('0x44')]=function(_0x336db7,_0x45c7a5){var _0x1429be={'raw':!![],'where':{'id':_0x336db7[_0xf1c2('0x45')]['id']}},_0x1d949e={};_0x1d949e[_0xf1c2('0x2e')]=_[_0xf1c2('0x30')](db[_0xf1c2('0x2b')][_0xf1c2('0x2c')]);_0x1d949e['query']=_[_0xf1c2('0x30')](_0x336db7[_0xf1c2('0x2f')]);_0x1d949e['filters']=_[_0xf1c2('0x33')](_0x1d949e['model'],_0x1d949e[_0xf1c2('0x2f')]);_0x1429be[_0xf1c2('0x32')]=_[_0xf1c2('0x33')](_0x1d949e[_0xf1c2('0x2e')],qs[_0xf1c2('0x34')](_0x336db7[_0xf1c2('0x2f')]['fields']));_0x1429be['attributes']=_0x1429be[_0xf1c2('0x32')][_0xf1c2('0x35')]?_0x1429be['attributes']:_0x1d949e['model'];if(_0x336db7[_0xf1c2('0x2f')]['includeAll']){_0x1429be[_0xf1c2('0x41')]=[{'all':!![]}];}_0x1429be=_['merge']({},_0x1429be,_0x336db7[_0xf1c2('0x3f')]);return db['SquareOdbc'][_0xf1c2('0x46')](_0x1429be)[_0xf1c2('0x22')](handleEntityNotFound(_0x45c7a5,null))[_0xf1c2('0x22')](respondWithResult(_0x45c7a5,null))[_0xf1c2('0x43')](handleError(_0x45c7a5,null));};exports[_0xf1c2('0x47')]=function(_0x1b3547,_0x5af434){return db['SquareOdbc'][_0xf1c2('0x47')](_0x1b3547['body'],{})[_0xf1c2('0x22')](function(_0x4b864b){var _0x248a0e=_0x1b3547['user'][_0xf1c2('0x23')]({'plain':!![]});if(!_0x248a0e)throw new Error(_0xf1c2('0x48'));if(_0x248a0e[_0xf1c2('0x49')]===_0xf1c2('0x4a')){var _0x2d4370=_0x4b864b[_0xf1c2('0x23')]({'plain':!![]});var _0x367a43=_0xf1c2('0x24');return db[_0xf1c2('0x4b')]['find']({'where':{'name':_0x367a43,'userProfileId':_0x248a0e[_0xf1c2('0x4c')]},'raw':!![]})[_0xf1c2('0x22')](function(_0x4d61a0){if(_0x4d61a0&&_0x4d61a0['autoAssociation']===0x0){return db[_0xf1c2('0x25')][_0xf1c2('0x47')]({'name':_0x2d4370['name'],'resourceId':_0x2d4370['id'],'type':_0x4d61a0[_0xf1c2('0x3e')],'sectionId':_0x4d61a0['id']},{})['then'](function(){return _0x4b864b;});}else{return _0x4b864b;}})[_0xf1c2('0x43')](function(_0x236bac){logger['error'](_0xf1c2('0x4d'),_0x236bac);throw _0x236bac;});}return _0x4b864b;})['then'](respondWithResult(_0x5af434,0xc9))['catch'](handleError(_0x5af434,null));};exports[_0xf1c2('0x21')]=function(_0x1890cc,_0x104819){if(_0x1890cc[_0xf1c2('0x4e')]['id']){delete _0x1890cc[_0xf1c2('0x4e')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x1890cc[_0xf1c2('0x45')]['id']}})['then'](handleEntityNotFound(_0x104819,null))[_0xf1c2('0x22')](saveUpdates(_0x1890cc['body'],null))[_0xf1c2('0x22')](respondWithResult(_0x104819,null))['catch'](handleError(_0x104819,null));};exports[_0xf1c2('0x4f')]=function(_0x506a01,_0x30ccfb){return db[_0xf1c2('0x2b')]['find']({'where':{'id':_0x506a01[_0xf1c2('0x45')]['id']}})['then'](handleEntityNotFound(_0x30ccfb,null))[_0xf1c2('0x22')](removeEntity(_0x30ccfb,null))[_0xf1c2('0x43')](handleError(_0x30ccfb,null));};exports[_0xf1c2('0x50')]=function(_0x386b5f,_0x12c302,_0x5e5f8b){var _0x2378f9;return db[_0xf1c2('0x2b')][_0xf1c2('0x46')]({'where':{'id':_0x386b5f[_0xf1c2('0x45')]['id']},'attributes':['id',_0xf1c2('0x51')]})['then'](handleEntityNotFound(_0x12c302,null))[_0xf1c2('0x22')](function(_0x439b17){if(_0x439b17){var _0x1621ce=require(_0xf1c2('0x52'))();_0x1621ce['openSync'](_0x439b17[_0xf1c2('0x51')]);_0x1621ce[_0xf1c2('0x53')]();return _0x439b17;}})[_0xf1c2('0x22')](respondWithResult(_0x12c302,null))[_0xf1c2('0x43')](handleError(_0x12c302,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b58a5fb..9e40d59 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 _0x836f=['bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment'];(function(_0x457bf8,_0x209a0a){var _0x919f94=function(_0x4fc50c){while(--_0x4fc50c){_0x457bf8['push'](_0x457bf8['shift']());}};_0x919f94(++_0x209a0a);}(_0x836f,0x91));var _0xf836=function(_0x4f6365,_0x15b25a){_0x4f6365=_0x4f6365-0x0;var _0x5cc7db=_0x836f[_0x4f6365];return _0x5cc7db;};'use strict';var _=require(_0xf836('0x0'));var util=require(_0xf836('0x1'));var logger=require(_0xf836('0x2'))(_0xf836('0x3'));var moment=require(_0xf836('0x4'));var BPromise=require(_0xf836('0x5'));var rp=require(_0xf836('0x6'));var fs=require('fs');var path=require(_0xf836('0x7'));var rimraf=require(_0xf836('0x8'));var config=require(_0xf836('0x9'));var attributes=require(_0xf836('0xa'));module[_0xf836('0xb')]=function(_0x5d46f9,_0x5701aa){return _0x5d46f9[_0xf836('0xc')](_0xf836('0xd'),attributes,{'tableName':_0xf836('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x989e=['bluebird','request-promise','exports','define','square_odbc','lodash','util','../../config/logger','api','moment'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x989e,0x69));var _0xe989=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x989e[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require(_0xe989('0x0'));var util=require(_0xe989('0x1'));var logger=require(_0xe989('0x2'))(_0xe989('0x3'));var moment=require(_0xe989('0x4'));var BPromise=require(_0xe989('0x5'));var rp=require(_0xe989('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xe989('0x7')]=function(_0x315348,_0x1ef501){return _0x315348[_0xe989('0x8')]('SquareOdbc',attributes,{'tableName':_0xe989('0x9'),'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 bb2a5c5..01cb74a 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 _0xdb64=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareOdbc','find','options','where','include','map','attributes','model','then','ShowSquareOdbc','catch','util'];(function(_0x272c23,_0x3ef6be){var _0x584283=function(_0x435173){while(--_0x435173){_0x272c23['push'](_0x272c23['shift']());}};_0x584283(++_0x3ef6be);}(_0xdb64,0x1ee));var _0x4db6=function(_0x3c8033,_0x18ad41){_0x3c8033=_0x3c8033-0x0;var _0x35f8f3=_0xdb64[_0x3c8033];return _0x35f8f3;};'use strict';var _=require('lodash');var util=require(_0x4db6('0x0'));var moment=require(_0x4db6('0x1'));var BPromise=require(_0x4db6('0x2'));var rs=require(_0x4db6('0x3'));var fs=require('fs');var Redis=require(_0x4db6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4db6('0x5'));var logger=require(_0x4db6('0x6'))(_0x4db6('0x7'));var config=require(_0x4db6('0x8'));var jayson=require(_0x4db6('0x9'));var client=jayson[_0x4db6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bf911,_0x1b2940,_0x42942f){return new BPromise(function(_0x58de42,_0x152180){return client[_0x4db6('0xb')](_0x1bf911,_0x42942f)['then'](function(_0x25b81a){logger[_0x4db6('0xc')](_0x4db6('0xd'),_0x1b2940,_0x4db6('0xe'));logger[_0x4db6('0xf')](_0x4db6('0x10'),_0x1b2940,_0x4db6('0xe'),JSON[_0x4db6('0x11')](_0x25b81a));if(_0x25b81a[_0x4db6('0x12')]){if(_0x25b81a[_0x4db6('0x12')][_0x4db6('0x13')]===0x1f4){logger[_0x4db6('0x12')](_0x4db6('0xd'),_0x1b2940,_0x25b81a['error'][_0x4db6('0x14')]);return _0x152180(_0x25b81a['error']['message']);}logger[_0x4db6('0x12')](_0x4db6('0xd'),_0x1b2940,_0x25b81a[_0x4db6('0x12')][_0x4db6('0x14')]);return _0x58de42(_0x25b81a['error'][_0x4db6('0x14')]);}else{logger[_0x4db6('0xc')](_0x4db6('0xd'),_0x1b2940,_0x4db6('0xe'));_0x58de42(_0x25b81a[_0x4db6('0x15')][_0x4db6('0x14')]);}})['catch'](function(_0x3cc164){logger[_0x4db6('0x12')](_0x4db6('0xd'),_0x1b2940,_0x3cc164);_0x152180(_0x3cc164);});});}exports['ShowSquareOdbc']=function(_0x58d0cd){var _0x3667e6=this;return new Promise(function(_0x51c415,_0x9c625b){return db[_0x4db6('0x16')][_0x4db6('0x17')]({'raw':_0x58d0cd[_0x4db6('0x18')]?_0x58d0cd[_0x4db6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x58d0cd[_0x4db6('0x18')]?_0x58d0cd[_0x4db6('0x18')][_0x4db6('0x19')]||null:null,'attributes':_0x58d0cd[_0x4db6('0x18')]?_0x58d0cd[_0x4db6('0x18')]['attributes']||null:null,'include':_0x58d0cd['options']?_0x58d0cd['options'][_0x4db6('0x1a')]?_[_0x4db6('0x1b')](_0x58d0cd['options']['include'],function(_0x277d81){return{'model':db[_0x277d81['model']],'as':_0x277d81['as'],'attributes':_0x277d81[_0x4db6('0x1c')],'include':_0x277d81[_0x4db6('0x1a')]?_['map'](_0x277d81[_0x4db6('0x1a')],function(_0x4d9897){return{'model':db[_0x4d9897['model']],'as':_0x4d9897['as'],'attributes':_0x4d9897[_0x4db6('0x1c')],'include':_0x4d9897['include']?_[_0x4db6('0x1b')](_0x4d9897[_0x4db6('0x1a')],function(_0x5d1b14){return{'model':db[_0x5d1b14[_0x4db6('0x1d')]],'as':_0x5d1b14['as'],'attributes':_0x5d1b14[_0x4db6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4db6('0x1e')](function(_0x3bfdba){logger['info'](_0x4db6('0x1f'),_0x58d0cd);logger[_0x4db6('0xf')](_0x4db6('0x1f'),_0x58d0cd,JSON['stringify'](_0x3bfdba));_0x51c415(_0x3bfdba);})[_0x4db6('0x20')](function(_0x27097d){logger[_0x4db6('0x12')](_0x4db6('0x1f'),_0x27097d['message'],_0x58d0cd);_0x9c625b(_0x3667e6[_0x4db6('0x12')](0x1f4,_0x27097d['message']));});});}; \ No newline at end of file +var _0xe0cf=['raw','where','attributes','include','map','model','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSquareOdbc','SquareOdbc','find','options'];(function(_0x1486f8,_0x427c48){var _0x4ba01d=function(_0xe63bff){while(--_0xe63bff){_0x1486f8['push'](_0x1486f8['shift']());}};_0x4ba01d(++_0x427c48);}(_0xe0cf,0x11d));var _0xfe0c=function(_0x488b85,_0x10ec23){_0x488b85=_0x488b85-0x0;var _0x59d07d=_0xe0cf[_0x488b85];return _0x59d07d;};'use strict';var _=require(_0xfe0c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfe0c('0x1'));var rs=require(_0xfe0c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe0c('0x3'))['db'];var utils=require(_0xfe0c('0x4'));var logger=require(_0xfe0c('0x5'))('rpc');var config=require(_0xfe0c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe0c('0x7')][_0xfe0c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3904c5,_0x5598f7,_0x177dae){return new BPromise(function(_0x265d74,_0x2da156){return client[_0xfe0c('0x9')](_0x3904c5,_0x177dae)[_0xfe0c('0xa')](function(_0x3714f6){logger[_0xfe0c('0xb')](_0xfe0c('0xc'),_0x5598f7,'request\x20sent');logger[_0xfe0c('0xd')](_0xfe0c('0xe'),_0x5598f7,_0xfe0c('0xf'),JSON[_0xfe0c('0x10')](_0x3714f6));if(_0x3714f6[_0xfe0c('0x11')]){if(_0x3714f6[_0xfe0c('0x11')][_0xfe0c('0x12')]===0x1f4){logger[_0xfe0c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x5598f7,_0x3714f6[_0xfe0c('0x11')][_0xfe0c('0x13')]);return _0x2da156(_0x3714f6['error']['message']);}logger[_0xfe0c('0x11')](_0xfe0c('0xc'),_0x5598f7,_0x3714f6['error']['message']);return _0x265d74(_0x3714f6['error'][_0xfe0c('0x13')]);}else{logger[_0xfe0c('0xb')](_0xfe0c('0xc'),_0x5598f7,'request\x20sent');_0x265d74(_0x3714f6['result'][_0xfe0c('0x13')]);}})[_0xfe0c('0x14')](function(_0x9f0a79){logger[_0xfe0c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x5598f7,_0x9f0a79);_0x2da156(_0x9f0a79);});});}exports[_0xfe0c('0x15')]=function(_0x11ef50){var _0x24b60e=this;return new Promise(function(_0xf02bc3,_0xbc6756){return db[_0xfe0c('0x16')][_0xfe0c('0x17')]({'raw':_0x11ef50['options']?_0x11ef50[_0xfe0c('0x18')][_0xfe0c('0x19')]===undefined?!![]:![]:!![],'where':_0x11ef50[_0xfe0c('0x18')]?_0x11ef50[_0xfe0c('0x18')][_0xfe0c('0x1a')]||null:null,'attributes':_0x11ef50[_0xfe0c('0x18')]?_0x11ef50['options'][_0xfe0c('0x1b')]||null:null,'include':_0x11ef50[_0xfe0c('0x18')]?_0x11ef50[_0xfe0c('0x18')][_0xfe0c('0x1c')]?_[_0xfe0c('0x1d')](_0x11ef50[_0xfe0c('0x18')][_0xfe0c('0x1c')],function(_0x28ef8f){return{'model':db[_0x28ef8f[_0xfe0c('0x1e')]],'as':_0x28ef8f['as'],'attributes':_0x28ef8f[_0xfe0c('0x1b')],'include':_0x28ef8f[_0xfe0c('0x1c')]?_[_0xfe0c('0x1d')](_0x28ef8f['include'],function(_0x3eefe2){return{'model':db[_0x3eefe2['model']],'as':_0x3eefe2['as'],'attributes':_0x3eefe2[_0xfe0c('0x1b')],'include':_0x3eefe2[_0xfe0c('0x1c')]?_[_0xfe0c('0x1d')](_0x3eefe2['include'],function(_0x5820f8){return{'model':db[_0x5820f8['model']],'as':_0x5820f8['as'],'attributes':_0x5820f8[_0xfe0c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfe0c('0xa')](function(_0x3c49e1){logger[_0xfe0c('0xb')](_0xfe0c('0x15'),_0x11ef50);logger[_0xfe0c('0xd')](_0xfe0c('0x15'),_0x11ef50,JSON['stringify'](_0x3c49e1));_0xf02bc3(_0x3c49e1);})['catch'](function(_0x1dc9b1){logger[_0xfe0c('0x11')]('ShowSquareOdbc',_0x1dc9b1[_0xfe0c('0x13')],_0x11ef50);_0xbc6756(_0x24b60e[_0xfe0c('0x11')](0x1f4,_0x1dc9b1[_0xfe0c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f39e580..a25f1f0 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 _0xccc9=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x5e5ce5,_0x120a28){var _0x587e12=function(_0x20313a){while(--_0x20313a){_0x5e5ce5['push'](_0x5e5ce5['shift']());}};_0x587e12(++_0x120a28);}(_0xccc9,0x77));var _0x9ccc=function(_0x13dc61,_0x36f6dc){_0x13dc61=_0x13dc61-0x0;var _0x29ed62=_0xccc9[_0x13dc61];return _0x29ed62;};'use strict';var multer=require(_0x9ccc('0x0'));var util=require(_0x9ccc('0x1'));var path=require(_0x9ccc('0x2'));var timeout=require(_0x9ccc('0x3'));var express=require(_0x9ccc('0x4'));var router=express['Router']();var fs_extra=require(_0x9ccc('0x5'));var auth=require(_0x9ccc('0x6'));var interaction=require(_0x9ccc('0x7'));var config=require('../../config/environment');var controller=require(_0x9ccc('0x8'));router[_0x9ccc('0x9')]('/',auth[_0x9ccc('0xa')](),controller[_0x9ccc('0xb')]);router[_0x9ccc('0x9')](_0x9ccc('0xc'),auth[_0x9ccc('0xa')](),controller[_0x9ccc('0xd')]);router[_0x9ccc('0xe')]('/',auth[_0x9ccc('0xa')](),controller[_0x9ccc('0xf')]);router[_0x9ccc('0x10')](_0x9ccc('0xc'),auth[_0x9ccc('0xa')](),controller[_0x9ccc('0x11')]);router[_0x9ccc('0x12')](_0x9ccc('0xc'),auth[_0x9ccc('0xa')](),controller[_0x9ccc('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb279=['Router','fs-extra','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x393507,_0x27facf){var _0x3b026e=function(_0x233987){while(--_0x233987){_0x393507['push'](_0x393507['shift']());}};_0x3b026e(++_0x27facf);}(_0xb279,0x18c));var _0x9b27=function(_0x17e123,_0x2d80f5){_0x17e123=_0x17e123-0x0;var _0x2b7d11=_0xb279[_0x17e123];return _0x2b7d11;};'use strict';var multer=require(_0x9b27('0x0'));var util=require(_0x9b27('0x1'));var path=require(_0x9b27('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9b27('0x3')]();var fs_extra=require(_0x9b27('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9b27('0x5'));var config=require('../../config/environment');var controller=require(_0x9b27('0x6'));router[_0x9b27('0x7')]('/',auth[_0x9b27('0x8')](),controller[_0x9b27('0x9')]);router[_0x9b27('0x7')](_0x9b27('0xa'),auth['isAuthenticated'](),controller[_0x9b27('0xb')]);router[_0x9b27('0xc')]('/',auth[_0x9b27('0x8')](),controller[_0x9b27('0xd')]);router[_0x9b27('0xe')](_0x9b27('0xa'),auth[_0x9b27('0x8')](),controller[_0x9b27('0xf')]);router[_0x9b27('0x10')](_0x9b27('0xa'),auth[_0x9b27('0x8')](),controller[_0x9b27('0x11')]);module[_0x9b27('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3b7be8a..ae6a168 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 _0x16a2=['DATE','sequelize','exports','STRING','BLOB','long','getDataValue','preproduction','production','utf8'];(function(_0x494a42,_0x1f2103){var _0x254792=function(_0x5f1c1d){while(--_0x5f1c1d){_0x494a42['push'](_0x494a42['shift']());}};_0x254792(++_0x1f2103);}(_0x16a2,0x105));var _0x216a=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x16a2[_0x1a21ff];return _0x25afc1;};'use strict';var Sequelize=require(_0x216a('0x0'));module[_0x216a('0x1')]={'name':{'type':Sequelize[_0x216a('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x216a('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x216a('0x3')](_0x216a('0x4')),'get':function(){if(this[_0x216a('0x5')]('preproduction')){return this['getDataValue'](_0x216a('0x6'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x216a('0x3')]('long'),'get':function(){if(this[_0x216a('0x5')](_0x216a('0x7'))){return this['getDataValue'](_0x216a('0x7'))['toString'](_0x216a('0x8'));}}},'savedAt':{'type':Sequelize[_0x216a('0x9')]},'publishedAt':{'type':Sequelize[_0x216a('0x9')]}}; \ No newline at end of file +var _0x86da=['exports','STRING','TEXT','long','getDataValue','preproduction','toString','BLOB','production','utf8','DATE','sequelize'];(function(_0x52bae2,_0x6e85a2){var _0x49cb78=function(_0x54b6a2){while(--_0x54b6a2){_0x52bae2['push'](_0x52bae2['shift']());}};_0x49cb78(++_0x6e85a2);}(_0x86da,0xfb));var _0xa86d=function(_0x70404,_0x507113){_0x70404=_0x70404-0x0;var _0x2da0b9=_0x86da[_0x70404];return _0x2da0b9;};'use strict';var Sequelize=require(_0xa86d('0x0'));module[_0xa86d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xa86d('0x2')]},'notes':{'type':Sequelize[_0xa86d('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xa86d('0x4')),'get':function(){if(this[_0xa86d('0x5')](_0xa86d('0x6'))){return this[_0xa86d('0x5')](_0xa86d('0x6'))[_0xa86d('0x7')]('utf8');}}},'production':{'type':Sequelize[_0xa86d('0x8')](_0xa86d('0x4')),'get':function(){if(this[_0xa86d('0x5')](_0xa86d('0x9'))){return this[_0xa86d('0x5')]('production')[_0xa86d('0x7')](_0xa86d('0xa'));}}},'savedAt':{'type':Sequelize[_0xa86d('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 44f5e33..d86bea3 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 _0xa2e5=['index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','SquareProject','length','find','create','body','user','get','SquareProjects','UserProfileSection','userProfileId','autoAssociation','update','production','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','status','json','undefined','limit','count','offset','destroy','then','UserProfileResource','publish','agi','stringify','sendStatus','error','stack','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2e5,0x167));var _0x5a2e=function(_0xa05669,_0x180503){_0xa05669=_0xa05669-0x0;var _0x9f8c4c=_0xa2e5[_0xa05669];return _0x9f8c4c;};'use strict';var _=require('lodash');var Redis=require(_0x5a2e('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x5a2e('0x1'))('api');var config=require(_0x5a2e('0x2'));var db=require(_0x5a2e('0x3'))['db'];config[_0x5a2e('0x4')]=_[_0x5a2e('0x5')](config[_0x5a2e('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x5a2e('0x6'))(new Redis(config[_0x5a2e('0x4')]));require(_0x5a2e('0x7'))['register'](socket);function respondWithResult(_0x11dfe7,_0x5c1b40){_0x5c1b40=_0x5c1b40||0xc8;return function(_0x12e2a6){if(_0x12e2a6){return _0x11dfe7[_0x5a2e('0x8')](_0x5c1b40)[_0x5a2e('0x9')](_0x12e2a6);}};}function respondWithFilteredResult(_0x1ae12b,_0x31d03d){return function(_0xcec4a7){if(_0xcec4a7){var _0x1efaa6=typeof _0x31d03d['offset']===_0x5a2e('0xa')&&typeof _0x31d03d[_0x5a2e('0xb')]===_0x5a2e('0xa');var _0x131a26=_0xcec4a7[_0x5a2e('0xc')];var _0x4cdce4=_0x1efaa6?0x0:_0x31d03d[_0x5a2e('0xd')];var _0x39c0ca=_0x1efaa6?_0xcec4a7[_0x5a2e('0xc')]:_0x31d03d['offset']+_0x31d03d[_0x5a2e('0xb')];var _0x37ec5e;if(_0x39c0ca>=_0x131a26){_0x39c0ca=_0x131a26;_0x37ec5e=0xc8;}else{_0x37ec5e=0xce;}_0x1ae12b[_0x5a2e('0x8')](_0x37ec5e);return _0x1ae12b['set']('Content-Range',_0x4cdce4+'-'+_0x39c0ca+'/'+_0x131a26)[_0x5a2e('0x9')](_0xcec4a7);}return null;};}function saveUpdates(_0x56a45e){return function(_0x2b2afe){if(_0x2b2afe){return _0x2b2afe['update'](_0x56a45e)['then'](function(_0x371fcc){return _0x371fcc;});}return null;};}function removeEntity(_0x9e175b){return function(_0x5e8189){if(_0x5e8189){return _0x5e8189[_0x5a2e('0xe')]()[_0x5a2e('0xf')](function(){var _0x38f6b3=_0x5e8189['get']({'plain':!![]});var _0x390b29='SquareProjects';return db[_0x5a2e('0x10')][_0x5a2e('0xe')]({'where':{'type':_0x390b29,'resourceId':_0x38f6b3['id']}})[_0x5a2e('0xf')](function(){return _0x5e8189;});})[_0x5a2e('0xf')](function(){var _0x3bfca5=new Redis(config[_0x5a2e('0x4')]);_0x3bfca5[_0x5a2e('0x11')](_0x5a2e('0x12'),JSON[_0x5a2e('0x13')]({'id':_0x5e8189['id'],'deleted':!![]}));})[_0x5a2e('0xf')](function(){_0x9e175b[_0x5a2e('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17da81){return function(_0x252f9a){if(!_0x252f9a){_0x17da81[_0x5a2e('0x14')](0x194);}return _0x252f9a;};}function handleError(_0x4aa116,_0x5f5cae){_0x5f5cae=_0x5f5cae||0x1f4;return function(_0x2ce86c){logger[_0x5a2e('0x15')](_0x2ce86c[_0x5a2e('0x16')]);if(_0x2ce86c[_0x5a2e('0x17')]){delete _0x2ce86c['name'];}_0x4aa116[_0x5a2e('0x8')](_0x5f5cae)[_0x5a2e('0x18')](_0x2ce86c);};}exports[_0x5a2e('0x19')]=function(_0x232aad,_0x376002){var _0x30ae6f={},_0x41d32a={},_0x8a835f={'count':0x0,'rows':[]};var _0x115ce6=_[_0x5a2e('0x1a')](db['SquareProject'][_0x5a2e('0x1b')],function(_0x196a12){return{'name':_0x196a12[_0x5a2e('0x1c')],'type':_0x196a12[_0x5a2e('0x1d')]['key']};});_0x41d32a[_0x5a2e('0x1e')]=_['map'](_0x115ce6,'name');_0x41d32a[_0x5a2e('0x1f')]=_[_0x5a2e('0x20')](_0x232aad[_0x5a2e('0x1f')]);_0x41d32a[_0x5a2e('0x21')]=_[_0x5a2e('0x22')](_0x41d32a['model'],_0x41d32a['query']);_0x30ae6f[_0x5a2e('0x23')]=_['intersection'](_0x41d32a[_0x5a2e('0x1e')],qs[_0x5a2e('0x24')](_0x232aad['query']['fields']));_0x30ae6f[_0x5a2e('0x23')]=_0x30ae6f[_0x5a2e('0x23')]['length']?_0x30ae6f[_0x5a2e('0x23')]:_0x41d32a[_0x5a2e('0x1e')];if(!_0x232aad['query']['hasOwnProperty'](_0x5a2e('0x25'))){_0x30ae6f[_0x5a2e('0xb')]=qs[_0x5a2e('0xb')](_0x232aad[_0x5a2e('0x1f')][_0x5a2e('0xb')]);_0x30ae6f[_0x5a2e('0xd')]=qs['offset'](_0x232aad[_0x5a2e('0x1f')][_0x5a2e('0xd')]);}_0x30ae6f[_0x5a2e('0x26')]=qs['sort'](_0x232aad['query'][_0x5a2e('0x27')]);_0x30ae6f[_0x5a2e('0x28')]=qs[_0x5a2e('0x21')](_[_0x5a2e('0x29')](_0x232aad[_0x5a2e('0x1f')],_0x41d32a[_0x5a2e('0x21')]),_0x115ce6);if(_0x232aad[_0x5a2e('0x1f')][_0x5a2e('0x2a')]){_0x30ae6f[_0x5a2e('0x28')]=_[_0x5a2e('0x2b')](_0x30ae6f[_0x5a2e('0x28')],{'$or':_[_0x5a2e('0x1a')](_0x115ce6,function(_0x478543){if(_0x478543['type']!==_0x5a2e('0x2c')){var _0x89e05a={};_0x89e05a[_0x478543[_0x5a2e('0x17')]]={'$like':'%'+_0x232aad[_0x5a2e('0x1f')][_0x5a2e('0x2a')]+'%'};return _0x89e05a;}})});}_0x30ae6f=_[_0x5a2e('0x2b')]({},_0x30ae6f,_0x232aad[_0x5a2e('0x2d')]);var _0x281df2={'where':_0x30ae6f['where']};return db['SquareProject'][_0x5a2e('0xc')](_0x281df2)['then'](function(_0x1f737a){_0x8a835f[_0x5a2e('0xc')]=_0x1f737a;if(_0x232aad[_0x5a2e('0x1f')][_0x5a2e('0x2e')]){_0x30ae6f['include']=[{'all':!![]}];}return db['SquareProject'][_0x5a2e('0x2f')](_0x30ae6f);})['then'](function(_0x54c70e){_0x8a835f[_0x5a2e('0x30')]=_0x54c70e;return _0x8a835f;})['then'](respondWithFilteredResult(_0x376002,_0x30ae6f))[_0x5a2e('0x31')](handleError(_0x376002,null));};exports['show']=function(_0x5e69ed,_0x528f19){var _0x3e287a={'raw':![],'where':{'id':_0x5e69ed[_0x5a2e('0x32')]['id']}},_0xc86bc2={};_0xc86bc2['model']=_[_0x5a2e('0x20')](db[_0x5a2e('0x33')][_0x5a2e('0x1b')]);_0xc86bc2[_0x5a2e('0x1f')]=_[_0x5a2e('0x20')](_0x5e69ed[_0x5a2e('0x1f')]);_0xc86bc2['filters']=_[_0x5a2e('0x22')](_0xc86bc2[_0x5a2e('0x1e')],_0xc86bc2[_0x5a2e('0x1f')]);_0x3e287a[_0x5a2e('0x23')]=_[_0x5a2e('0x22')](_0xc86bc2['model'],qs['fields'](_0x5e69ed['query'][_0x5a2e('0x24')]));_0x3e287a[_0x5a2e('0x23')]=_0x3e287a[_0x5a2e('0x23')][_0x5a2e('0x34')]?_0x3e287a[_0x5a2e('0x23')]:_0xc86bc2[_0x5a2e('0x1e')];if(_0x5e69ed[_0x5a2e('0x1f')]['includeAll']){_0x3e287a['include']=[{'all':!![]}];}_0x3e287a=_[_0x5a2e('0x2b')]({},_0x3e287a,_0x5e69ed['options']);return db['SquareProject'][_0x5a2e('0x35')](_0x3e287a)['then'](handleEntityNotFound(_0x528f19,null))['then'](respondWithResult(_0x528f19,null))['catch'](handleError(_0x528f19,null));};exports[_0x5a2e('0x36')]=function(_0x16c093,_0x58cfe1){return db['SquareProject'][_0x5a2e('0x36')](_0x16c093[_0x5a2e('0x37')],{})[_0x5a2e('0xf')](function(_0x167dbc){var _0x52a0a6=_0x16c093[_0x5a2e('0x38')][_0x5a2e('0x39')]({'plain':!![]});if(!_0x52a0a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52a0a6['role']===_0x5a2e('0x38')){var _0xf69c2e=_0x167dbc[_0x5a2e('0x39')]({'plain':!![]});var _0x909b6b=_0x5a2e('0x3a');return db[_0x5a2e('0x3b')]['find']({'where':{'name':_0x909b6b,'userProfileId':_0x52a0a6[_0x5a2e('0x3c')]},'raw':!![]})[_0x5a2e('0xf')](function(_0x4fe52c){if(_0x4fe52c&&_0x4fe52c[_0x5a2e('0x3d')]===0x0){return db[_0x5a2e('0x10')]['create']({'name':_0xf69c2e[_0x5a2e('0x17')],'resourceId':_0xf69c2e['id'],'type':_0x4fe52c[_0x5a2e('0x17')],'sectionId':_0x4fe52c['id']},{})[_0x5a2e('0xf')](function(){return _0x167dbc;});}else{return _0x167dbc;}})[_0x5a2e('0x31')](function(_0x51a84f){logger[_0x5a2e('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51a84f);throw _0x51a84f;});}return _0x167dbc;})[_0x5a2e('0xf')](respondWithResult(_0x58cfe1,0xc9))[_0x5a2e('0x31')](handleError(_0x58cfe1,null));};exports[_0x5a2e('0x3e')]=function(_0x423d7c,_0x440b42){if(_0x423d7c[_0x5a2e('0x37')]['id']){delete _0x423d7c['body']['id'];}return db[_0x5a2e('0x33')][_0x5a2e('0x35')]({'where':{'id':_0x423d7c[_0x5a2e('0x32')]['id']}})['then'](handleEntityNotFound(_0x440b42,null))[_0x5a2e('0xf')](saveUpdates(_0x423d7c[_0x5a2e('0x37')],null))[_0x5a2e('0xf')](function(_0x32bcd3){if(!_0x32bcd3)return;var _0xd4c6c2=_0x32bcd3[_0x5a2e('0x39')]({'plain':!![]});return _0xd4c6c2;})[_0x5a2e('0xf')](function(_0x394826){var _0x1a940b=new Redis(config['redis']);_0x1a940b[_0x5a2e('0x11')]('agi',JSON[_0x5a2e('0x13')](_['pick'](_0x394826,['id',_0x5a2e('0x17'),_0x5a2e('0x3f')])));return _0x394826;})[_0x5a2e('0xf')](respondWithResult(_0x440b42,null))[_0x5a2e('0x31')](handleError(_0x440b42,null));};exports['destroy']=function(_0x311a73,_0x20ee2c){return db[_0x5a2e('0x33')]['find']({'where':{'id':_0x311a73[_0x5a2e('0x32')]['id']}})[_0x5a2e('0xf')](handleEntityNotFound(_0x20ee2c,null))[_0x5a2e('0xf')](removeEntity(_0x20ee2c,null))[_0x5a2e('0x31')](handleError(_0x20ee2c,null));}; \ No newline at end of file +var _0xe9a6=['publish','agi','stringify','end','sendStatus','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','production','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','SquareProjects','UserProfileResource'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe9a6,0xc1));var _0x6e9a=function(_0x15e812,_0x44748d){_0x15e812=_0x15e812-0x0;var _0x264014=_0xe9a6[_0x15e812];return _0x264014;};'use strict';var _=require(_0x6e9a('0x0'));var Redis=require('ioredis');var qs=require(_0x6e9a('0x1'));var logger=require('../../config/logger')(_0x6e9a('0x2'));var config=require(_0x6e9a('0x3'));var db=require(_0x6e9a('0x4'))['db'];config[_0x6e9a('0x5')]=_['defaults'](config['redis'],{'host':_0x6e9a('0x6'),'port':0x18eb});var socket=require(_0x6e9a('0x7'))(new Redis(config[_0x6e9a('0x5')]));require(_0x6e9a('0x8'))[_0x6e9a('0x9')](socket);function respondWithResult(_0xbe118a,_0x1748f5){_0x1748f5=_0x1748f5||0xc8;return function(_0x272a31){if(_0x272a31){return _0xbe118a[_0x6e9a('0xa')](_0x1748f5)[_0x6e9a('0xb')](_0x272a31);}};}function respondWithFilteredResult(_0x32888,_0x5ece08){return function(_0x539c6d){if(_0x539c6d){var _0x5d72cd=typeof _0x5ece08[_0x6e9a('0xc')]===_0x6e9a('0xd')&&typeof _0x5ece08[_0x6e9a('0xe')]===_0x6e9a('0xd');var _0x381ffe=_0x539c6d[_0x6e9a('0xf')];var _0x4ff150=_0x5d72cd?0x0:_0x5ece08[_0x6e9a('0xc')];var _0x48528b=_0x5d72cd?_0x539c6d['count']:_0x5ece08['offset']+_0x5ece08[_0x6e9a('0xe')];var _0x5183ba;if(_0x48528b>=_0x381ffe){_0x48528b=_0x381ffe;_0x5183ba=0xc8;}else{_0x5183ba=0xce;}_0x32888[_0x6e9a('0xa')](_0x5183ba);return _0x32888[_0x6e9a('0x10')](_0x6e9a('0x11'),_0x4ff150+'-'+_0x48528b+'/'+_0x381ffe)['json'](_0x539c6d);}return null;};}function saveUpdates(_0x23f949){return function(_0x223554){if(_0x223554){return _0x223554[_0x6e9a('0x12')](_0x23f949)[_0x6e9a('0x13')](function(_0x4f40f7){return _0x4f40f7;});}return null;};}function removeEntity(_0x1c44d4){return function(_0x35b89e){if(_0x35b89e){return _0x35b89e[_0x6e9a('0x14')]()[_0x6e9a('0x13')](function(){var _0x47d474=_0x35b89e['get']({'plain':!![]});var _0xdb07ae=_0x6e9a('0x15');return db[_0x6e9a('0x16')][_0x6e9a('0x14')]({'where':{'type':_0xdb07ae,'resourceId':_0x47d474['id']}})[_0x6e9a('0x13')](function(){return _0x35b89e;});})[_0x6e9a('0x13')](function(){var _0x5a23c2=new Redis(config['redis']);_0x5a23c2[_0x6e9a('0x17')](_0x6e9a('0x18'),JSON[_0x6e9a('0x19')]({'id':_0x35b89e['id'],'deleted':!![]}));})[_0x6e9a('0x13')](function(){_0x1c44d4['status'](0xcc)[_0x6e9a('0x1a')]();});}};}function handleEntityNotFound(_0x2eb715){return function(_0x112f9f){if(!_0x112f9f){_0x2eb715[_0x6e9a('0x1b')](0x194);}return _0x112f9f;};}function handleError(_0x246964,_0x1611c3){_0x1611c3=_0x1611c3||0x1f4;return function(_0x237981){logger[_0x6e9a('0x1c')](_0x237981[_0x6e9a('0x1d')]);if(_0x237981['name']){delete _0x237981[_0x6e9a('0x1e')];}_0x246964[_0x6e9a('0xa')](_0x1611c3)['send'](_0x237981);};}exports[_0x6e9a('0x1f')]=function(_0x34ae30,_0x3e6f04){var _0x268544={},_0x20049b={},_0x35b853={'count':0x0,'rows':[]};var _0x3a7a9c=_[_0x6e9a('0x20')](db[_0x6e9a('0x21')][_0x6e9a('0x22')],function(_0x506d31){return{'name':_0x506d31[_0x6e9a('0x23')],'type':_0x506d31[_0x6e9a('0x24')]['key']};});_0x20049b[_0x6e9a('0x25')]=_['map'](_0x3a7a9c,_0x6e9a('0x1e'));_0x20049b[_0x6e9a('0x26')]=_[_0x6e9a('0x27')](_0x34ae30[_0x6e9a('0x26')]);_0x20049b[_0x6e9a('0x28')]=_[_0x6e9a('0x29')](_0x20049b[_0x6e9a('0x25')],_0x20049b[_0x6e9a('0x26')]);_0x268544[_0x6e9a('0x2a')]=_[_0x6e9a('0x29')](_0x20049b['model'],qs[_0x6e9a('0x2b')](_0x34ae30[_0x6e9a('0x26')][_0x6e9a('0x2b')]));_0x268544['attributes']=_0x268544[_0x6e9a('0x2a')][_0x6e9a('0x2c')]?_0x268544['attributes']:_0x20049b[_0x6e9a('0x25')];if(!_0x34ae30[_0x6e9a('0x26')][_0x6e9a('0x2d')](_0x6e9a('0x2e'))){_0x268544[_0x6e9a('0xe')]=qs[_0x6e9a('0xe')](_0x34ae30[_0x6e9a('0x26')][_0x6e9a('0xe')]);_0x268544[_0x6e9a('0xc')]=qs['offset'](_0x34ae30[_0x6e9a('0x26')][_0x6e9a('0xc')]);}_0x268544[_0x6e9a('0x2f')]=qs[_0x6e9a('0x30')](_0x34ae30[_0x6e9a('0x26')][_0x6e9a('0x30')]);_0x268544[_0x6e9a('0x31')]=qs['filters'](_[_0x6e9a('0x32')](_0x34ae30[_0x6e9a('0x26')],_0x20049b[_0x6e9a('0x28')]),_0x3a7a9c);if(_0x34ae30[_0x6e9a('0x26')][_0x6e9a('0x33')]){_0x268544[_0x6e9a('0x31')]=_[_0x6e9a('0x34')](_0x268544[_0x6e9a('0x31')],{'$or':_[_0x6e9a('0x20')](_0x3a7a9c,function(_0x53d776){if(_0x53d776[_0x6e9a('0x24')]!=='VIRTUAL'){var _0x558fe4={};_0x558fe4[_0x53d776[_0x6e9a('0x1e')]]={'$like':'%'+_0x34ae30['query'][_0x6e9a('0x33')]+'%'};return _0x558fe4;}})});}_0x268544=_[_0x6e9a('0x34')]({},_0x268544,_0x34ae30[_0x6e9a('0x35')]);var _0x1e87ca={'where':_0x268544[_0x6e9a('0x31')]};return db[_0x6e9a('0x21')][_0x6e9a('0xf')](_0x1e87ca)[_0x6e9a('0x13')](function(_0x419927){_0x35b853[_0x6e9a('0xf')]=_0x419927;if(_0x34ae30[_0x6e9a('0x26')][_0x6e9a('0x36')]){_0x268544['include']=[{'all':!![]}];}return db[_0x6e9a('0x21')]['findAll'](_0x268544);})[_0x6e9a('0x13')](function(_0x2600bf){_0x35b853[_0x6e9a('0x37')]=_0x2600bf;return _0x35b853;})[_0x6e9a('0x13')](respondWithFilteredResult(_0x3e6f04,_0x268544))[_0x6e9a('0x38')](handleError(_0x3e6f04,null));};exports[_0x6e9a('0x39')]=function(_0x468898,_0x9b66f8){var _0x5b6bb0={'raw':![],'where':{'id':_0x468898['params']['id']}},_0x13c106={};_0x13c106['model']=_['keys'](db[_0x6e9a('0x21')]['rawAttributes']);_0x13c106[_0x6e9a('0x26')]=_[_0x6e9a('0x27')](_0x468898[_0x6e9a('0x26')]);_0x13c106[_0x6e9a('0x28')]=_[_0x6e9a('0x29')](_0x13c106[_0x6e9a('0x25')],_0x13c106[_0x6e9a('0x26')]);_0x5b6bb0[_0x6e9a('0x2a')]=_[_0x6e9a('0x29')](_0x13c106[_0x6e9a('0x25')],qs[_0x6e9a('0x2b')](_0x468898[_0x6e9a('0x26')]['fields']));_0x5b6bb0['attributes']=_0x5b6bb0[_0x6e9a('0x2a')][_0x6e9a('0x2c')]?_0x5b6bb0[_0x6e9a('0x2a')]:_0x13c106[_0x6e9a('0x25')];if(_0x468898['query'][_0x6e9a('0x36')]){_0x5b6bb0[_0x6e9a('0x3a')]=[{'all':!![]}];}_0x5b6bb0=_[_0x6e9a('0x34')]({},_0x5b6bb0,_0x468898[_0x6e9a('0x35')]);return db[_0x6e9a('0x21')][_0x6e9a('0x3b')](_0x5b6bb0)[_0x6e9a('0x13')](handleEntityNotFound(_0x9b66f8,null))[_0x6e9a('0x13')](respondWithResult(_0x9b66f8,null))[_0x6e9a('0x38')](handleError(_0x9b66f8,null));};exports[_0x6e9a('0x3c')]=function(_0x26778a,_0x2a45a5){return db[_0x6e9a('0x21')][_0x6e9a('0x3c')](_0x26778a[_0x6e9a('0x3d')],{})[_0x6e9a('0x13')](function(_0x1750b6){var _0x3fd1d8=_0x26778a[_0x6e9a('0x3e')][_0x6e9a('0x3f')]({'plain':!![]});if(!_0x3fd1d8)throw new Error(_0x6e9a('0x40'));if(_0x3fd1d8[_0x6e9a('0x41')]===_0x6e9a('0x3e')){var _0xeece3b=_0x1750b6[_0x6e9a('0x3f')]({'plain':!![]});var _0x5e26fc=_0x6e9a('0x15');return db[_0x6e9a('0x42')][_0x6e9a('0x3b')]({'where':{'name':_0x5e26fc,'userProfileId':_0x3fd1d8[_0x6e9a('0x43')]},'raw':!![]})[_0x6e9a('0x13')](function(_0x45b220){if(_0x45b220&&_0x45b220[_0x6e9a('0x44')]===0x0){return db[_0x6e9a('0x16')][_0x6e9a('0x3c')]({'name':_0xeece3b[_0x6e9a('0x1e')],'resourceId':_0xeece3b['id'],'type':_0x45b220[_0x6e9a('0x1e')],'sectionId':_0x45b220['id']},{})['then'](function(){return _0x1750b6;});}else{return _0x1750b6;}})[_0x6e9a('0x38')](function(_0x20535a){logger[_0x6e9a('0x1c')](_0x6e9a('0x45'),_0x20535a);throw _0x20535a;});}return _0x1750b6;})[_0x6e9a('0x13')](respondWithResult(_0x2a45a5,0xc9))[_0x6e9a('0x38')](handleError(_0x2a45a5,null));};exports[_0x6e9a('0x12')]=function(_0x3606d5,_0x5b648c){if(_0x3606d5['body']['id']){delete _0x3606d5[_0x6e9a('0x3d')]['id'];}return db[_0x6e9a('0x21')][_0x6e9a('0x3b')]({'where':{'id':_0x3606d5[_0x6e9a('0x46')]['id']}})[_0x6e9a('0x13')](handleEntityNotFound(_0x5b648c,null))['then'](saveUpdates(_0x3606d5[_0x6e9a('0x3d')],null))[_0x6e9a('0x13')](function(_0x3887b0){if(!_0x3887b0)return;var _0x35e20d=_0x3887b0[_0x6e9a('0x3f')]({'plain':!![]});return _0x35e20d;})['then'](function(_0x335d16){var _0x11aec3=new Redis(config[_0x6e9a('0x5')]);_0x11aec3[_0x6e9a('0x17')](_0x6e9a('0x18'),JSON[_0x6e9a('0x19')](_['pick'](_0x335d16,['id',_0x6e9a('0x1e'),_0x6e9a('0x47')])));return _0x335d16;})['then'](respondWithResult(_0x5b648c,null))[_0x6e9a('0x38')](handleError(_0x5b648c,null));};exports[_0x6e9a('0x14')]=function(_0x290db2,_0x311946){return db['SquareProject'][_0x6e9a('0x3b')]({'where':{'id':_0x290db2[_0x6e9a('0x46')]['id']}})[_0x6e9a('0x13')](handleEntityNotFound(_0x311946,null))[_0x6e9a('0x13')](removeEntity(_0x311946,null))[_0x6e9a('0x38')](handleError(_0x311946,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3a22a68..5859cd6 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 _0x6285=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3cbe1a,_0x1c7820){var _0x2c5a98=function(_0x58c177){while(--_0x58c177){_0x3cbe1a['push'](_0x3cbe1a['shift']());}};_0x2c5a98(++_0x1c7820);}(_0x6285,0x1cf));var _0x5628=function(_0x459d99,_0x23f77a){_0x459d99=_0x459d99-0x0;var _0x149333=_0x6285[_0x459d99];return _0x149333;};'use strict';var EventEmitter=require(_0x5628('0x0'));var SquareProject=require(_0x5628('0x1'))['db'][_0x5628('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5628('0x3')](0x0);var events={'afterCreate':_0x5628('0x4'),'afterUpdate':_0x5628('0x5'),'afterDestroy':_0x5628('0x6')};function emitEvent(_0x18df21){return function(_0x3e1f8a,_0x553515,_0x3bb151){SquareProjectEvents[_0x5628('0x7')](_0x18df21+':'+_0x3e1f8a['id'],_0x3e1f8a);SquareProjectEvents[_0x5628('0x7')](_0x18df21,_0x3e1f8a);_0x3bb151(null);};}for(var e in events){if(events[_0x5628('0x8')](e)){var event=events[e];SquareProject[_0x5628('0x9')](e,emitEvent(event));}}module[_0x5628('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0xb2ce=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','update','remove'];(function(_0x88bee2,_0x20813b){var _0x38d3e5=function(_0x133071){while(--_0x133071){_0x88bee2['push'](_0x88bee2['shift']());}};_0x38d3e5(++_0x20813b);}(_0xb2ce,0x11c));var _0xeb2c=function(_0x3f0360,_0x104d4f){_0x3f0360=_0x3f0360-0x0;var _0x2177ba=_0xb2ce[_0x3f0360];return _0x2177ba;};'use strict';var EventEmitter=require(_0xeb2c('0x0'));var SquareProject=require(_0xeb2c('0x1'))['db'][_0xeb2c('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xeb2c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeb2c('0x4'),'afterDestroy':_0xeb2c('0x5')};function emitEvent(_0x8229aa){return function(_0x54d1ca,_0x1f8b86,_0x2ce014){SquareProjectEvents[_0xeb2c('0x6')](_0x8229aa+':'+_0x54d1ca['id'],_0x54d1ca);SquareProjectEvents[_0xeb2c('0x6')](_0x8229aa,_0x54d1ca);_0x2ce014(null);};}for(var e in events){if(events[_0xeb2c('0x7')](e)){var event=events[e];SquareProject[_0xeb2c('0x8')](e,emitEvent(event));}}module[_0xeb2c('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index af84024..b08f03d 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 _0x0347=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x0347,0xa0));var _0x7034=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0347[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7034('0x0'));var util=require(_0x7034('0x1'));var logger=require(_0x7034('0x2'))(_0x7034('0x3'));var moment=require('moment');var BPromise=require(_0x7034('0x4'));var rp=require(_0x7034('0x5'));var fs=require('fs');var path=require(_0x7034('0x6'));var rimraf=require(_0x7034('0x7'));var config=require(_0x7034('0x8'));var attributes=require('./squareProject.attributes');module[_0x7034('0x9')]=function(_0x1c58de,_0x1fb6a2){return _0x1c58de[_0x7034('0xa')](_0x7034('0xb'),attributes,{'tableName':_0x7034('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bc841,_0x56a365,_0x568c45){if(_0x1bc841[_0x7034('0xd')](_0x7034('0xe'))){_0x1bc841['savedAt']=moment()[_0x7034('0xf')](_0x7034('0x10'));}if(_0x1bc841[_0x7034('0xd')](_0x7034('0x11'))){_0x1bc841['publishedAt']=moment()['format'](_0x7034('0x10'));}_0x568c45(null,_0x1bc841);}}});}; \ No newline at end of file +var _0xca14=['preproduction','changed','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','square_projects'];(function(_0xd8b89f,_0x6312f4){var _0x3c6e90=function(_0x182d8a){while(--_0x182d8a){_0xd8b89f['push'](_0xd8b89f['shift']());}};_0x3c6e90(++_0x6312f4);}(_0xca14,0x95));var _0x4ca1=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0xca14[_0x557f5f];return _0x196eba;};'use strict';var _=require(_0x4ca1('0x0'));var util=require(_0x4ca1('0x1'));var logger=require(_0x4ca1('0x2'))(_0x4ca1('0x3'));var moment=require('moment');var BPromise=require(_0x4ca1('0x4'));var rp=require(_0x4ca1('0x5'));var fs=require('fs');var path=require(_0x4ca1('0x6'));var rimraf=require(_0x4ca1('0x7'));var config=require(_0x4ca1('0x8'));var attributes=require('./squareProject.attributes');module['exports']=function(_0xdae9cd,_0x3e7ca9){return _0xdae9cd[_0x4ca1('0x9')]('SquareProject',attributes,{'tableName':_0x4ca1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x540ffe,_0x2160bc,_0x399cdb){if(_0x540ffe['changed'](_0x4ca1('0xb'))){_0x540ffe['savedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x540ffe[_0x4ca1('0xc')]('production')){_0x540ffe[_0x4ca1('0xd')]=moment()[_0x4ca1('0xe')](_0x4ca1('0xf'));}_0x399cdb(null,_0x540ffe);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 72ef589..49dd46b 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 _0x7822=['info','debug','catch','message','error','ShowSquareProject','find','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x27527b,_0x1ea199){var _0x1f0a6f=function(_0x189565){while(--_0x189565){_0x27527b['push'](_0x27527b['shift']());}};_0x1f0a6f(++_0x1ea199);}(_0x7822,0xbb));var _0x2782=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7822[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2782('0x0'));var Redis=require(_0x2782('0x1'));var db=require(_0x2782('0x2'))['db'];var logger=require(_0x2782('0x3'))(_0x2782('0x4'));var config=require(_0x2782('0x5'));config[_0x2782('0x6')]=_[_0x2782('0x7')](config[_0x2782('0x6')],{'host':_0x2782('0x8'),'port':0x18eb});var socket=require(_0x2782('0x9'))(new Redis(config[_0x2782('0x6')]));require('./squareProject.socket')[_0x2782('0xa')](socket);exports[_0x2782('0xb')]=function(_0x49d147){var _0x586908=this;return new Promise(function(_0x2b93bc,_0x53de88){return db[_0x2782('0xc')][_0x2782('0xd')]({'raw':_0x49d147[_0x2782('0xe')]?_0x49d147[_0x2782('0xe')][_0x2782('0xf')]===undefined?!![]:![]:!![],'where':_0x49d147[_0x2782('0xe')]?_0x49d147[_0x2782('0xe')][_0x2782('0x10')]||null:null,'attributes':_0x49d147[_0x2782('0xe')]?_0x49d147['options'][_0x2782('0x11')]||null:null,'limit':_0x49d147[_0x2782('0xe')]?_0x49d147[_0x2782('0xe')][_0x2782('0x12')]||null:null,'include':_0x49d147[_0x2782('0xe')]?_0x49d147['options'][_0x2782('0x13')]?_[_0x2782('0x14')](_0x49d147[_0x2782('0xe')][_0x2782('0x13')],function(_0x428994){return{'model':db[_0x428994['model']],'as':_0x428994['as'],'attributes':_0x428994['attributes'],'include':_0x428994[_0x2782('0x13')]?_['map'](_0x428994[_0x2782('0x13')],function(_0x3f4066){return{'model':db[_0x3f4066['model']],'as':_0x3f4066['as'],'attributes':_0x3f4066['attributes'],'include':_0x3f4066[_0x2782('0x13')]?_[_0x2782('0x14')](_0x3f4066[_0x2782('0x13')],function(_0x18a168){return{'model':db[_0x18a168[_0x2782('0x15')]],'as':_0x18a168['as'],'attributes':_0x18a168[_0x2782('0x11')]};}):[]};}):[]};}):[]:[]})[_0x2782('0x16')](function(_0x4e3e3a){logger[_0x2782('0x17')](_0x2782('0xb'),_0x49d147);logger[_0x2782('0x18')]('GetSquareProjects',_0x49d147,JSON['stringify'](_0x4e3e3a));_0x2b93bc(_0x4e3e3a);})[_0x2782('0x19')](function(_0x295dd0){logger['error'](_0x2782('0xb'),_0x295dd0[_0x2782('0x1a')],_0x49d147);_0x53de88(_0x586908[_0x2782('0x1b')](0x1f4,_0x295dd0[_0x2782('0x1a')]));});});};exports[_0x2782('0x1c')]=function(_0x2b1415){var _0x55e765=this;return new Promise(function(_0x182f0d,_0x17ca5f){return db['SquareProject'][_0x2782('0x1d')]({'raw':_0x2b1415[_0x2782('0xe')]?_0x2b1415[_0x2782('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x2b1415[_0x2782('0xe')]?_0x2b1415['options']['where']||null:null,'attributes':_0x2b1415[_0x2782('0xe')]?_0x2b1415[_0x2782('0xe')][_0x2782('0x11')]||null:null,'include':_0x2b1415[_0x2782('0xe')]?_0x2b1415['options'][_0x2782('0x13')]?_[_0x2782('0x14')](_0x2b1415[_0x2782('0xe')][_0x2782('0x13')],function(_0x397ac4){return{'model':db[_0x397ac4['model']],'as':_0x397ac4['as'],'attributes':_0x397ac4['attributes'],'include':_0x397ac4[_0x2782('0x13')]?_[_0x2782('0x14')](_0x397ac4[_0x2782('0x13')],function(_0x27d4a6){return{'model':db[_0x27d4a6[_0x2782('0x15')]],'as':_0x27d4a6['as'],'attributes':_0x27d4a6['attributes'],'include':_0x27d4a6[_0x2782('0x13')]?_[_0x2782('0x14')](_0x27d4a6[_0x2782('0x13')],function(_0x2b5364){return{'model':db[_0x2b5364[_0x2782('0x15')]],'as':_0x2b5364['as'],'attributes':_0x2b5364[_0x2782('0x11')]};}):[]};}):[]};}):[]:[]})[_0x2782('0x16')](function(_0x904384){logger[_0x2782('0x17')](_0x2782('0x1c'),_0x2b1415);logger['debug'](_0x2782('0x1c'),_0x2b1415,JSON['stringify'](_0x904384));_0x182f0d(_0x904384);})[_0x2782('0x19')](function(_0x26448e){logger[_0x2782('0x1b')](_0x2782('0x1c'),_0x26448e[_0x2782('0x1a')],_0x2b1415);_0x17ca5f(_0x55e765['error'](0x1f4,_0x26448e['message']));});});}; \ No newline at end of file +var _0x6d4c=['defaults','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','include','map','model','info','debug','stringify','catch','error','message','ShowSquareProject','find','then','lodash','ioredis','../../mysqldb','rpc','redis'];(function(_0x39e76b,_0x10c387){var _0x313601=function(_0x4cd450){while(--_0x4cd450){_0x39e76b['push'](_0x39e76b['shift']());}};_0x313601(++_0x10c387);}(_0x6d4c,0x190));var _0xc6d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d4c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc6d4('0x0'));var Redis=require(_0xc6d4('0x1'));var db=require(_0xc6d4('0x2'))['db'];var logger=require('../../config/logger')(_0xc6d4('0x3'));var config=require('../../config/environment');config[_0xc6d4('0x4')]=_[_0xc6d4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc6d4('0x6'))(new Redis(config[_0xc6d4('0x4')]));require('./squareProject.socket')[_0xc6d4('0x7')](socket);exports[_0xc6d4('0x8')]=function(_0x5da4c6){var _0x27a989=this;return new Promise(function(_0x1673e5,_0x289389){return db[_0xc6d4('0x9')][_0xc6d4('0xa')]({'raw':_0x5da4c6[_0xc6d4('0xb')]?_0x5da4c6['options'][_0xc6d4('0xc')]===undefined?!![]:![]:!![],'where':_0x5da4c6[_0xc6d4('0xb')]?_0x5da4c6['options'][_0xc6d4('0xd')]||null:null,'attributes':_0x5da4c6['options']?_0x5da4c6[_0xc6d4('0xb')][_0xc6d4('0xe')]||null:null,'limit':_0x5da4c6['options']?_0x5da4c6[_0xc6d4('0xb')]['limit']||null:null,'include':_0x5da4c6['options']?_0x5da4c6['options'][_0xc6d4('0xf')]?_[_0xc6d4('0x10')](_0x5da4c6[_0xc6d4('0xb')][_0xc6d4('0xf')],function(_0x2da810){return{'model':db[_0x2da810['model']],'as':_0x2da810['as'],'attributes':_0x2da810[_0xc6d4('0xe')],'include':_0x2da810[_0xc6d4('0xf')]?_[_0xc6d4('0x10')](_0x2da810[_0xc6d4('0xf')],function(_0x46e1ba){return{'model':db[_0x46e1ba[_0xc6d4('0x11')]],'as':_0x46e1ba['as'],'attributes':_0x46e1ba[_0xc6d4('0xe')],'include':_0x46e1ba['include']?_['map'](_0x46e1ba[_0xc6d4('0xf')],function(_0x4edc3b){return{'model':db[_0x4edc3b['model']],'as':_0x4edc3b['as'],'attributes':_0x4edc3b[_0xc6d4('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50e5f7){logger[_0xc6d4('0x12')](_0xc6d4('0x8'),_0x5da4c6);logger[_0xc6d4('0x13')](_0xc6d4('0x8'),_0x5da4c6,JSON[_0xc6d4('0x14')](_0x50e5f7));_0x1673e5(_0x50e5f7);})[_0xc6d4('0x15')](function(_0x50a86b){logger[_0xc6d4('0x16')]('GetSquareProjects',_0x50a86b[_0xc6d4('0x17')],_0x5da4c6);_0x289389(_0x27a989[_0xc6d4('0x16')](0x1f4,_0x50a86b[_0xc6d4('0x17')]));});});};exports[_0xc6d4('0x18')]=function(_0x3ee3d8){var _0xa9ac56=this;return new Promise(function(_0x30dc18,_0x4b994f){return db['SquareProject'][_0xc6d4('0x19')]({'raw':_0x3ee3d8[_0xc6d4('0xb')]?_0x3ee3d8['options'][_0xc6d4('0xc')]===undefined?!![]:![]:!![],'where':_0x3ee3d8['options']?_0x3ee3d8[_0xc6d4('0xb')][_0xc6d4('0xd')]||null:null,'attributes':_0x3ee3d8[_0xc6d4('0xb')]?_0x3ee3d8[_0xc6d4('0xb')][_0xc6d4('0xe')]||null:null,'include':_0x3ee3d8[_0xc6d4('0xb')]?_0x3ee3d8[_0xc6d4('0xb')][_0xc6d4('0xf')]?_['map'](_0x3ee3d8[_0xc6d4('0xb')]['include'],function(_0x47369e){return{'model':db[_0x47369e[_0xc6d4('0x11')]],'as':_0x47369e['as'],'attributes':_0x47369e[_0xc6d4('0xe')],'include':_0x47369e[_0xc6d4('0xf')]?_[_0xc6d4('0x10')](_0x47369e[_0xc6d4('0xf')],function(_0x4c9b6b){return{'model':db[_0x4c9b6b['model']],'as':_0x4c9b6b['as'],'attributes':_0x4c9b6b['attributes'],'include':_0x4c9b6b[_0xc6d4('0xf')]?_[_0xc6d4('0x10')](_0x4c9b6b[_0xc6d4('0xf')],function(_0x3e2f9e){return{'model':db[_0x3e2f9e['model']],'as':_0x3e2f9e['as'],'attributes':_0x3e2f9e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6d4('0x1a')](function(_0x125e56){logger['info'](_0xc6d4('0x18'),_0x3ee3d8);logger[_0xc6d4('0x13')](_0xc6d4('0x18'),_0x3ee3d8,JSON[_0xc6d4('0x14')](_0x125e56));_0x30dc18(_0x125e56);})[_0xc6d4('0x15')](function(_0x432354){logger[_0xc6d4('0x16')](_0xc6d4('0x18'),_0x432354[_0xc6d4('0x17')],_0x3ee3d8);_0x4b994f(_0xa9ac56[_0xc6d4('0x16')](0x1f4,_0x432354['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9641f4f..d508bdd 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 _0x898a=['./squareProject.events','save','remove','update','removeListener','register','squareProject:'];(function(_0x2b64a3,_0x1971c5){var _0x3c95ba=function(_0x4bdbb0){while(--_0x4bdbb0){_0x2b64a3['push'](_0x2b64a3['shift']());}};_0x3c95ba(++_0x1971c5);}(_0x898a,0xc4));var _0xa898=function(_0x3b6179,_0xa6d6c){_0x3b6179=_0x3b6179-0x0;var _0x2d0c45=_0x898a[_0x3b6179];return _0x2d0c45;};'use strict';var SquareProjectEvents=require(_0xa898('0x0'));var events=[_0xa898('0x1'),_0xa898('0x2'),_0xa898('0x3')];function createListener(_0x1ae784,_0x293de0){return function(_0x3cb867){_0x293de0['emit'](_0x1ae784,_0x3cb867);};}function removeListener(_0xaca92b,_0x3e5f66){return function(){SquareProjectEvents[_0xa898('0x4')](_0xaca92b,_0x3e5f66);};}exports[_0xa898('0x5')]=function(_0x4a3994){for(var _0x6d35a4=0x0,_0x4f9700=events['length'];_0x6d35a4<_0x4f9700;_0x6d35a4++){var _0x594805=events[_0x6d35a4];var _0x5d2529=createListener(_0xa898('0x6')+_0x594805,_0x4a3994);SquareProjectEvents['on'](_0x594805,_0x5d2529);}}; \ No newline at end of file +var _0x233c=['removeListener','register','length','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x11c78b,_0x4a44d5){var _0x511289=function(_0x2ad79f){while(--_0x2ad79f){_0x11c78b['push'](_0x11c78b['shift']());}};_0x511289(++_0x4a44d5);}(_0x233c,0x175));var _0xc233=function(_0x422b8,_0x2a823e){_0x422b8=_0x422b8-0x0;var _0x531ebc=_0x233c[_0x422b8];return _0x531ebc;};'use strict';var SquareProjectEvents=require(_0xc233('0x0'));var events=[_0xc233('0x1'),_0xc233('0x2'),_0xc233('0x3')];function createListener(_0x2df6fc,_0x1e1636){return function(_0x395481){_0x1e1636[_0xc233('0x4')](_0x2df6fc,_0x395481);};}function removeListener(_0x137835,_0x121ebf){return function(){SquareProjectEvents[_0xc233('0x5')](_0x137835,_0x121ebf);};}exports[_0xc233('0x6')]=function(_0x96f00f){for(var _0x7137b7=0x0,_0x5226d6=events[_0xc233('0x7')];_0x7137b7<_0x5226d6;_0x7137b7++){var _0xf573c9=events[_0x7137b7];var _0x1b031a=createListener(_0xc233('0x8')+_0xf573c9,_0x96f00f);SquareProjectEvents['on'](_0xf573c9,_0x1b031a);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index a72df52..1d84074 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0xe87e7f,_0x168854){var _0x28065a=function(_0x30dfc4){while(--_0x30dfc4){_0xe87e7f['push'](_0xe87e7f['shift']());}};_0x28065a(++_0x168854);}(_0x326f,0xd1));var _0xf326=function(_0x58d431,_0x98c795){_0x58d431=_0x58d431-0x0;var _0x569d82=_0x326f[_0x58d431];return _0x569d82;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x317168,_0x2bffec){var _0x37120a=function(_0x5bf6ca){while(--_0x5bf6ca){_0x317168['push'](_0x317168['shift']());}};_0x37120a(++_0x2bffec);}(_0x326f,0xd1));var _0xf326=function(_0x2d2b9e,_0x8c6ba0){_0x2d2b9e=_0x2d2b9e-0x0;var _0x3dfc1f=_0x326f[_0x2d2b9e];return _0x3dfc1f;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index abd29e9..cd7ac12 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 _0xa41a=['exports','STRING','getDataValue','substring','lastIndexOf','sequelize'];(function(_0x42d070,_0x3344c5){var _0x32f38c=function(_0x719b5){while(--_0x719b5){_0x42d070['push'](_0x42d070['shift']());}};_0x32f38c(++_0x3344c5);}(_0xa41a,0x6b));var _0xaa41=function(_0x4bbb92,_0x3cf540){_0x4bbb92=_0x4bbb92-0x0;var _0x4cdf04=_0xa41a[_0x4bbb92];return _0x4cdf04;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'context':{'type':Sequelize[_0xaa41('0x2')]},'extension':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize[_0xaa41('0x2')]},'dnid':{'type':Sequelize[_0xaa41('0x2')]},'projectName':{'type':Sequelize[_0xaa41('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xaa41('0x2')]},'savePath':{'type':Sequelize[_0xaa41('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5b1fff='';var _0x179545=this[_0xaa41('0x3')]('savePath');if(_0x179545){_0x5b1fff=_0x179545[_0xaa41('0x4')](_0x179545[_0xaa41('0x5')]('.'));}return _0x5b1fff;}}}; \ No newline at end of file +var _0x98a8=['exports','STRING','VIRTUAL','savePath','substring','lastIndexOf','sequelize'];(function(_0x1945a5,_0x50de54){var _0x5817a5=function(_0x2a5a93){while(--_0x2a5a93){_0x1945a5['push'](_0x1945a5['shift']());}};_0x5817a5(++_0x50de54);}(_0x98a8,0x12c));var _0x898a=function(_0x3a3f17,_0x1ea3a6){_0x3a3f17=_0x3a3f17-0x0;var _0x3f1541=_0x98a8[_0x3a3f17];return _0x3f1541;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'uniqueid':{'type':Sequelize[_0x898a('0x2')]},'callerid':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'extension':{'type':Sequelize[_0x898a('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'dnid':{'type':Sequelize[_0x898a('0x2')]},'projectName':{'type':Sequelize[_0x898a('0x2')]},'saveName':{'type':Sequelize[_0x898a('0x2')]},'filename':{'type':Sequelize[_0x898a('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x898a('0x3')],'get':function(){var _0x564583='';var _0xfa8c50=this['getDataValue'](_0x898a('0x4'));if(_0xfa8c50){_0x564583=_0xfa8c50[_0x898a('0x5')](_0xfa8c50[_0x898a('0x6')]('.'));}return _0x564583;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 0a7c41f..e6a12fa 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 _0x67c2=['download','../../components/encryptor','uniqueid','savePath','filename','format','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','existsSync','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','filters','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','keys','intersection','fields','length','include','find','create','update','body','params'];(function(_0x3ab276,_0x3a8234){var _0x294be5=function(_0x16b124){while(--_0x16b124){_0x3ab276['push'](_0x3ab276['shift']());}};_0x294be5(++_0x3a8234);}(_0x67c2,0x1ac));var _0x267c=function(_0x423172,_0x56b443){_0x423172=_0x423172-0x0;var _0x3a263d=_0x67c2[_0x423172];return _0x3a263d;};'use strict';var emlformat=require(_0x267c('0x0'));var rimraf=require(_0x267c('0x1'));var zipdir=require(_0x267c('0x2'));var jsonpatch=require(_0x267c('0x3'));var rp=require(_0x267c('0x4'));var moment=require(_0x267c('0x5'));var BPromise=require(_0x267c('0x6'));var Mustache=require(_0x267c('0x7'));var util=require(_0x267c('0x8'));var path=require(_0x267c('0x9'));var sox=require(_0x267c('0xa'));var csv=require(_0x267c('0xb'));var ejs=require(_0x267c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x267c('0xd'));var squel=require('squel');var crypto=require(_0x267c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x267c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x267c('0x10'));var Papa=require(_0x267c('0x11'));var Redis=require(_0x267c('0x12'));var authService=require(_0x267c('0x13'));var qs=require(_0x267c('0x14'));var as=require(_0x267c('0x15'));var hardwareService=require(_0x267c('0x16'));var logger=require(_0x267c('0x17'))(_0x267c('0x18'));var utils=require(_0x267c('0x19'));var config=require(_0x267c('0x1a'));var licenseUtil=require(_0x267c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527395,_0x42b0f3){_0x42b0f3=_0x42b0f3||0xcc;return function(_0x527f02){if(_0x527f02){return _0x527395[_0x267c('0x1c')](_0x42b0f3);}return _0x527395[_0x267c('0x1d')](_0x42b0f3)[_0x267c('0x1e')]();};}function respondWithResult(_0x1a524a,_0x47075d){_0x47075d=_0x47075d||0xc8;return function(_0x45f6a8){if(_0x45f6a8){return _0x1a524a[_0x267c('0x1d')](_0x47075d)[_0x267c('0x1f')](_0x45f6a8);}};}function respondWithFilteredResult(_0x4ff08a,_0x262aca){return function(_0x5270b7){if(_0x5270b7){var _0x28f1bc=typeof _0x262aca[_0x267c('0x20')]===_0x267c('0x21')&&typeof _0x262aca[_0x267c('0x22')]===_0x267c('0x21');var _0x3a7885=_0x5270b7[_0x267c('0x23')];var _0x20924d=_0x28f1bc?0x0:_0x262aca[_0x267c('0x20')];var _0x1ab99e=_0x28f1bc?_0x5270b7[_0x267c('0x23')]:_0x262aca[_0x267c('0x20')]+_0x262aca[_0x267c('0x22')];var _0x333893;if(_0x1ab99e>=_0x3a7885){_0x1ab99e=_0x3a7885;_0x333893=0xc8;}else{_0x333893=0xce;}_0x4ff08a[_0x267c('0x1d')](_0x333893);return _0x4ff08a[_0x267c('0x24')](_0x267c('0x25'),_0x20924d+'-'+_0x1ab99e+'/'+_0x3a7885)[_0x267c('0x1f')](_0x5270b7);}return null;};}function patchUpdates(_0x55f419){return function(_0x4a8b73){try{jsonpatch[_0x267c('0x26')](_0x4a8b73,_0x55f419,!![]);}catch(_0x3caa0b){return BPromise['reject'](_0x3caa0b);}return _0x4a8b73[_0x267c('0x27')]();};}function saveUpdates(_0x5054c4,_0x70b3f0){return function(_0x53d407){if(_0x53d407){return _0x53d407['update'](_0x5054c4)[_0x267c('0x28')](function(_0x1c5212){return _0x1c5212;});}return null;};}function removeEntity(_0x170693,_0x56ba92){return function(_0x3c5c0b){if(_0x3c5c0b){return _0x3c5c0b[_0x267c('0x29')]()[_0x267c('0x28')](function(){_0x170693[_0x267c('0x1d')](0xcc)[_0x267c('0x1e')]();});}};}function handleEntityNotFound(_0x541f06,_0x5de11a){return function(_0x5c8bca){if(!_0x5c8bca){_0x541f06['sendStatus'](0x194);}return _0x5c8bca;};}function handleError(_0x3096ea,_0x4e03e4){_0x4e03e4=_0x4e03e4||0x1f4;return function(_0x3f8177){logger[_0x267c('0x2a')](_0x3f8177[_0x267c('0x2b')]);if(_0x3f8177[_0x267c('0x2c')]){delete _0x3f8177[_0x267c('0x2c')];}_0x3096ea[_0x267c('0x1d')](_0x4e03e4)[_0x267c('0x2d')](_0x3f8177);};}exports[_0x267c('0x2e')]=function(_0x13c7af,_0x4a60db){var _0x5659a9={},_0x141b1f={},_0x40461f={'count':0x0,'rows':[]};var _0x58328d=_[_0x267c('0x2f')](db[_0x267c('0x30')][_0x267c('0x31')],function(_0x47e46d){return{'name':_0x47e46d[_0x267c('0x32')],'type':_0x47e46d[_0x267c('0x33')]['key']};});_0x141b1f[_0x267c('0x34')]=_[_0x267c('0x2f')](_0x58328d,_0x267c('0x2c'));_0x141b1f[_0x267c('0x35')]=_['keys'](_0x13c7af[_0x267c('0x35')]);_0x141b1f[_0x267c('0x36')]=_['intersection'](_0x141b1f[_0x267c('0x34')],_0x141b1f[_0x267c('0x35')]);_0x5659a9[_0x267c('0x37')]=_['intersection'](_0x141b1f['model'],qs['fields'](_0x13c7af['query']['fields']));_0x5659a9[_0x267c('0x37')]=_0x5659a9['attributes']['length']?_0x5659a9[_0x267c('0x37')]:_0x141b1f[_0x267c('0x34')];if(!_0x13c7af[_0x267c('0x35')]['hasOwnProperty']('nolimit')){_0x5659a9[_0x267c('0x22')]=qs[_0x267c('0x22')](_0x13c7af[_0x267c('0x35')]['limit']);_0x5659a9[_0x267c('0x20')]=qs['offset'](_0x13c7af[_0x267c('0x35')]['offset']);}_0x5659a9[_0x267c('0x38')]=qs[_0x267c('0x39')](_0x13c7af[_0x267c('0x35')][_0x267c('0x39')]);_0x5659a9[_0x267c('0x3a')]=qs[_0x267c('0x36')](_[_0x267c('0x3b')](_0x13c7af[_0x267c('0x35')],_0x141b1f[_0x267c('0x36')]),_0x58328d);if(_0x13c7af[_0x267c('0x35')][_0x267c('0x3c')]){_0x5659a9[_0x267c('0x3a')]=_[_0x267c('0x3d')](_0x5659a9['where'],{'$or':_[_0x267c('0x2f')](_0x58328d,function(_0x2eb4b3){if(_0x2eb4b3[_0x267c('0x33')]!==_0x267c('0x3e')){var _0x2d6389={};_0x2d6389[_0x2eb4b3[_0x267c('0x2c')]]={'$like':'%'+_0x13c7af[_0x267c('0x35')][_0x267c('0x3c')]+'%'};return _0x2d6389;}})});}_0x5659a9=_[_0x267c('0x3d')]({},_0x5659a9,_0x13c7af[_0x267c('0x3f')]);var _0x1252d3={'where':_0x5659a9[_0x267c('0x3a')]};return db[_0x267c('0x30')][_0x267c('0x23')](_0x1252d3)[_0x267c('0x28')](function(_0x2d8426){_0x40461f['count']=_0x2d8426;if(_0x13c7af['query'][_0x267c('0x40')]){_0x5659a9['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x5659a9);})[_0x267c('0x28')](function(_0x30c9a5){_0x40461f['rows']=_0x30c9a5;return _0x40461f;})[_0x267c('0x28')](respondWithFilteredResult(_0x4a60db,_0x5659a9))[_0x267c('0x41')](handleError(_0x4a60db,null));};exports[_0x267c('0x42')]=function(_0x520d98,_0x38748f){var _0x2b8167={'raw':!![],'where':{'id':_0x520d98['params']['id']}},_0x4a7ce3={};_0x4a7ce3['model']=_[_0x267c('0x43')](db[_0x267c('0x30')][_0x267c('0x31')]);_0x4a7ce3[_0x267c('0x35')]=_[_0x267c('0x43')](_0x520d98['query']);_0x4a7ce3[_0x267c('0x36')]=_['intersection'](_0x4a7ce3[_0x267c('0x34')],_0x4a7ce3[_0x267c('0x35')]);_0x2b8167[_0x267c('0x37')]=_[_0x267c('0x44')](_0x4a7ce3['model'],qs[_0x267c('0x45')](_0x520d98[_0x267c('0x35')][_0x267c('0x45')]));_0x2b8167[_0x267c('0x37')]=_0x2b8167['attributes'][_0x267c('0x46')]?_0x2b8167[_0x267c('0x37')]:_0x4a7ce3[_0x267c('0x34')];if(_0x520d98[_0x267c('0x35')][_0x267c('0x40')]){_0x2b8167[_0x267c('0x47')]=[{'all':!![]}];}_0x2b8167=_[_0x267c('0x3d')]({},_0x2b8167,_0x520d98[_0x267c('0x3f')]);return db[_0x267c('0x30')][_0x267c('0x48')](_0x2b8167)[_0x267c('0x28')](handleEntityNotFound(_0x38748f,null))[_0x267c('0x28')](respondWithResult(_0x38748f,null))['catch'](handleError(_0x38748f,null));};exports[_0x267c('0x49')]=function(_0x58a984,_0x511034){return db['SquareRecording'][_0x267c('0x49')](_0x58a984['body'],{})['then'](respondWithResult(_0x511034,0xc9))[_0x267c('0x41')](handleError(_0x511034,null));};exports[_0x267c('0x4a')]=function(_0x2d4a59,_0x12ae3d){if(_0x2d4a59[_0x267c('0x4b')]['id']){delete _0x2d4a59[_0x267c('0x4b')]['id'];}return db[_0x267c('0x30')][_0x267c('0x48')]({'where':{'id':_0x2d4a59[_0x267c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x12ae3d,null))[_0x267c('0x28')](saveUpdates(_0x2d4a59[_0x267c('0x4b')],null))['then'](respondWithResult(_0x12ae3d,null))[_0x267c('0x41')](handleError(_0x12ae3d,null));};exports[_0x267c('0x4d')]=function(_0x517eaa,_0x578e84,_0x34e5b0){var _0x178d77=require(_0x267c('0x4e'));var _0x16f43b=![];var _0x1ef205={};if(_0x517eaa[_0x267c('0x35')][_0x267c('0x33')]&&_0x517eaa[_0x267c('0x35')][_0x267c('0x33')]==='uniqueid'){_0x1ef205[_0x267c('0x4f')]=_0x517eaa['params']['id'];}else{_0x1ef205['id']=_0x517eaa['params']['id'];}return db[_0x267c('0x30')]['find']({'where':_0x1ef205,'attributes':['id',_0x267c('0x50'),_0x267c('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x578e84,null))['then'](function(_0x1f268c){if(_0x1f268c){var _0x4ca437=_0x1f268c[_0x267c('0x50')];var _0x11e23e=util[_0x267c('0x52')]('%s.cypher',_0x4ca437);if(fs['existsSync'](_0x11e23e)){_0x16f43b=!![];return _0x178d77[_0x267c('0x53')](_0x11e23e,_0x4ca437,config[_0x267c('0x54')][_0x267c('0x55')])[_0x267c('0x28')](function(){return _0x1f268c;});}return _0x1f268c;}})[_0x267c('0x28')](function(_0x260530){if(_0x260530){var _0x4a68cc=_0x260530[_0x267c('0x50')];if(!fs['existsSync'](_0x4a68cc)){throw new db[(_0x267c('0x56'))][(_0x267c('0x57'))](_0x267c('0x58'));}if(_0x260530[_0x267c('0x51')]){return _0x578e84['download'](_0x4a68cc,_0x260530[_0x267c('0x51')]+path[_0x267c('0x59')](_0x4a68cc),function(){if(_0x16f43b){fs['unlink'](_0x4a68cc);}});}else{return _0x578e84[_0x267c('0x4d')](_0x4a68cc,function(_0x2a827e){if(_0x16f43b){fs[_0x267c('0x5a')](_0x4a68cc);}});}}})[_0x267c('0x41')](function(_0x1c9f70){if(_0x1c9f70[_0x267c('0x5b')]===_0x267c('0x58')){_0x578e84[_0x267c('0x1d')](0x194)[_0x267c('0x2d')]('Not\x20found');}else{return handleError(_0x578e84,null);}});};exports[_0x267c('0x29')]=function(_0x5e8981,_0x4ddf0d){return db['SquareRecording'][_0x267c('0x48')]({'where':{'id':_0x5e8981[_0x267c('0x4c')]['id']}})[_0x267c('0x28')](function(_0x3c5d40){if(_[_0x267c('0x5c')](_0x3c5d40)){throw new ReferenceError(_0x267c('0x5d'));}return _0x3c5d40;})[_0x267c('0x28')](function(_0x56300e){var _0x4cb43e=_0x56300e[_0x267c('0x50')];logger[_0x267c('0x5e')](_0x267c('0x5f'),_0x4cb43e);if(!_[_0x267c('0x5c')](_0x56300e[_0x267c('0x50')])&&fs['existsSync'](_0x4cb43e)){logger[_0x267c('0x5e')]('File:\x20\x22'+_0x4cb43e+_0x267c('0x60'));fs[_0x267c('0x61')](_0x4cb43e);}_0x4cb43e=_0x4cb43e+_0x267c('0x62');if(!_['isNil'](_0x56300e[_0x267c('0x50')])&&fs[_0x267c('0x63')](_0x4cb43e)){logger[_0x267c('0x5e')](_0x267c('0x64')+_0x4cb43e+_0x267c('0x60'));fs[_0x267c('0x61')](_0x4cb43e);}return _0x56300e;})['then'](function(_0x8ec62d){if(!_0x8ec62d)throw new InternalError();return _0x8ec62d[_0x267c('0x29')]();})[_0x267c('0x28')](function(){_0x4ddf0d['status'](0xcc)[_0x267c('0x1e')]();})['catch'](handleError(_0x4ddf0d,null));}; \ No newline at end of file +var _0xe731=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','catch','params','options','find','create','body','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','message','send','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format'];(function(_0xce7c01,_0x33efbe){var _0x4e48dd=function(_0x11fe87){while(--_0x11fe87){_0xce7c01['push'](_0xce7c01['shift']());}};_0x4e48dd(++_0x33efbe);}(_0xe731,0x1da));var _0x1e73=function(_0x4138f1,_0xfbcb0e){_0x4138f1=_0x4138f1-0x0;var _0x2e7002=_0xe731[_0x4138f1];return _0x2e7002;};'use strict';var emlformat=require(_0x1e73('0x0'));var rimraf=require(_0x1e73('0x1'));var zipdir=require(_0x1e73('0x2'));var jsonpatch=require(_0x1e73('0x3'));var rp=require(_0x1e73('0x4'));var moment=require(_0x1e73('0x5'));var BPromise=require(_0x1e73('0x6'));var Mustache=require('mustache');var util=require(_0x1e73('0x7'));var path=require(_0x1e73('0x8'));var sox=require(_0x1e73('0x9'));var csv=require('to-csv');var ejs=require(_0x1e73('0xa'));var fs=require('fs');var fs_extra=require(_0x1e73('0xb'));var _=require(_0x1e73('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e73('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1e73('0xe'));var Papa=require(_0x1e73('0xf'));var Redis=require(_0x1e73('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1e73('0x11'));var hardwareService=require(_0x1e73('0x12'));var logger=require(_0x1e73('0x13'))(_0x1e73('0x14'));var utils=require('../../config/utils');var config=require(_0x1e73('0x15'));var licenseUtil=require(_0x1e73('0x16'));var db=require(_0x1e73('0x17'))['db'];function respondWithStatusCode(_0x20f9ae,_0xbbb157){_0xbbb157=_0xbbb157||0xcc;return function(_0x1d002d){if(_0x1d002d){return _0x20f9ae[_0x1e73('0x18')](_0xbbb157);}return _0x20f9ae[_0x1e73('0x19')](_0xbbb157)[_0x1e73('0x1a')]();};}function respondWithResult(_0x58af3f,_0x48c2fb){_0x48c2fb=_0x48c2fb||0xc8;return function(_0x4e1f4e){if(_0x4e1f4e){return _0x58af3f[_0x1e73('0x19')](_0x48c2fb)[_0x1e73('0x1b')](_0x4e1f4e);}};}function respondWithFilteredResult(_0x39662a,_0xd41aa3){return function(_0x15b92f){if(_0x15b92f){var _0x4da18c=typeof _0xd41aa3[_0x1e73('0x1c')]===_0x1e73('0x1d')&&typeof _0xd41aa3['limit']===_0x1e73('0x1d');var _0x5e7036=_0x15b92f[_0x1e73('0x1e')];var _0x3958da=_0x4da18c?0x0:_0xd41aa3['offset'];var _0x684954=_0x4da18c?_0x15b92f['count']:_0xd41aa3[_0x1e73('0x1c')]+_0xd41aa3[_0x1e73('0x1f')];var _0x2a1ab9;if(_0x684954>=_0x5e7036){_0x684954=_0x5e7036;_0x2a1ab9=0xc8;}else{_0x2a1ab9=0xce;}_0x39662a[_0x1e73('0x19')](_0x2a1ab9);return _0x39662a[_0x1e73('0x20')](_0x1e73('0x21'),_0x3958da+'-'+_0x684954+'/'+_0x5e7036)[_0x1e73('0x1b')](_0x15b92f);}return null;};}function patchUpdates(_0x17b9d6){return function(_0x3d06e8){try{jsonpatch[_0x1e73('0x22')](_0x3d06e8,_0x17b9d6,!![]);}catch(_0x2c9de6){return BPromise['reject'](_0x2c9de6);}return _0x3d06e8['save']();};}function saveUpdates(_0x2895f0,_0x1be486){return function(_0x54c3a9){if(_0x54c3a9){return _0x54c3a9[_0x1e73('0x23')](_0x2895f0)[_0x1e73('0x24')](function(_0x477a7c){return _0x477a7c;});}return null;};}function removeEntity(_0x4410c3,_0x3b819e){return function(_0x39be2d){if(_0x39be2d){return _0x39be2d[_0x1e73('0x25')]()[_0x1e73('0x24')](function(){_0x4410c3[_0x1e73('0x19')](0xcc)[_0x1e73('0x1a')]();});}};}function handleEntityNotFound(_0x10c7c6,_0x132570){return function(_0x330418){if(!_0x330418){_0x10c7c6['sendStatus'](0x194);}return _0x330418;};}function handleError(_0x1e234b,_0x92f76f){_0x92f76f=_0x92f76f||0x1f4;return function(_0x20faec){logger[_0x1e73('0x26')](_0x20faec[_0x1e73('0x27')]);if(_0x20faec[_0x1e73('0x28')]){delete _0x20faec['name'];}_0x1e234b[_0x1e73('0x19')](_0x92f76f)['send'](_0x20faec);};}exports[_0x1e73('0x29')]=function(_0x231b2e,_0x428c93){var _0x5f2b95={},_0x320786={},_0x83ecd9={'count':0x0,'rows':[]};var _0x949223=_[_0x1e73('0x2a')](db[_0x1e73('0x2b')][_0x1e73('0x2c')],function(_0x551963){return{'name':_0x551963[_0x1e73('0x2d')],'type':_0x551963[_0x1e73('0x2e')][_0x1e73('0x2f')]};});_0x320786[_0x1e73('0x30')]=_['map'](_0x949223,'name');_0x320786[_0x1e73('0x31')]=_[_0x1e73('0x32')](_0x231b2e[_0x1e73('0x31')]);_0x320786['filters']=_[_0x1e73('0x33')](_0x320786[_0x1e73('0x30')],_0x320786[_0x1e73('0x31')]);_0x5f2b95['attributes']=_[_0x1e73('0x33')](_0x320786['model'],qs[_0x1e73('0x34')](_0x231b2e[_0x1e73('0x31')][_0x1e73('0x34')]));_0x5f2b95['attributes']=_0x5f2b95[_0x1e73('0x35')][_0x1e73('0x36')]?_0x5f2b95[_0x1e73('0x35')]:_0x320786['model'];if(!_0x231b2e[_0x1e73('0x31')][_0x1e73('0x37')](_0x1e73('0x38'))){_0x5f2b95[_0x1e73('0x1f')]=qs[_0x1e73('0x1f')](_0x231b2e[_0x1e73('0x31')][_0x1e73('0x1f')]);_0x5f2b95['offset']=qs['offset'](_0x231b2e[_0x1e73('0x31')][_0x1e73('0x1c')]);}_0x5f2b95[_0x1e73('0x39')]=qs[_0x1e73('0x3a')](_0x231b2e['query']['sort']);_0x5f2b95[_0x1e73('0x3b')]=qs['filters'](_['pick'](_0x231b2e['query'],_0x320786['filters']),_0x949223);if(_0x231b2e['query']['filter']){_0x5f2b95[_0x1e73('0x3b')]=_['merge'](_0x5f2b95['where'],{'$or':_[_0x1e73('0x2a')](_0x949223,function(_0x1ae545){if(_0x1ae545[_0x1e73('0x2e')]!==_0x1e73('0x3c')){var _0x2b8320={};_0x2b8320[_0x1ae545[_0x1e73('0x28')]]={'$like':'%'+_0x231b2e[_0x1e73('0x31')][_0x1e73('0x3d')]+'%'};return _0x2b8320;}})});}_0x5f2b95=_[_0x1e73('0x3e')]({},_0x5f2b95,_0x231b2e['options']);var _0x29ac0b={'where':_0x5f2b95['where']};return db[_0x1e73('0x2b')][_0x1e73('0x1e')](_0x29ac0b)[_0x1e73('0x24')](function(_0x5d274a){_0x83ecd9[_0x1e73('0x1e')]=_0x5d274a;if(_0x231b2e[_0x1e73('0x31')][_0x1e73('0x3f')]){_0x5f2b95[_0x1e73('0x40')]=[{'all':!![]}];}return db[_0x1e73('0x2b')]['findAll'](_0x5f2b95);})['then'](function(_0x1dc015){_0x83ecd9['rows']=_0x1dc015;return _0x83ecd9;})[_0x1e73('0x24')](respondWithFilteredResult(_0x428c93,_0x5f2b95))[_0x1e73('0x41')](handleError(_0x428c93,null));};exports['show']=function(_0x386ed4,_0x33489c){var _0x29002a={'raw':!![],'where':{'id':_0x386ed4[_0x1e73('0x42')]['id']}},_0x553108={};_0x553108[_0x1e73('0x30')]=_[_0x1e73('0x32')](db['SquareRecording'][_0x1e73('0x2c')]);_0x553108[_0x1e73('0x31')]=_[_0x1e73('0x32')](_0x386ed4[_0x1e73('0x31')]);_0x553108['filters']=_[_0x1e73('0x33')](_0x553108['model'],_0x553108[_0x1e73('0x31')]);_0x29002a[_0x1e73('0x35')]=_['intersection'](_0x553108[_0x1e73('0x30')],qs[_0x1e73('0x34')](_0x386ed4[_0x1e73('0x31')][_0x1e73('0x34')]));_0x29002a[_0x1e73('0x35')]=_0x29002a[_0x1e73('0x35')][_0x1e73('0x36')]?_0x29002a[_0x1e73('0x35')]:_0x553108[_0x1e73('0x30')];if(_0x386ed4['query'][_0x1e73('0x3f')]){_0x29002a[_0x1e73('0x40')]=[{'all':!![]}];}_0x29002a=_[_0x1e73('0x3e')]({},_0x29002a,_0x386ed4[_0x1e73('0x43')]);return db[_0x1e73('0x2b')][_0x1e73('0x44')](_0x29002a)['then'](handleEntityNotFound(_0x33489c,null))[_0x1e73('0x24')](respondWithResult(_0x33489c,null))[_0x1e73('0x41')](handleError(_0x33489c,null));};exports[_0x1e73('0x45')]=function(_0x31436b,_0x10803c){return db['SquareRecording'][_0x1e73('0x45')](_0x31436b['body'],{})[_0x1e73('0x24')](respondWithResult(_0x10803c,0xc9))[_0x1e73('0x41')](handleError(_0x10803c,null));};exports[_0x1e73('0x23')]=function(_0x591349,_0x3c83d7){if(_0x591349['body']['id']){delete _0x591349[_0x1e73('0x46')]['id'];}return db[_0x1e73('0x2b')][_0x1e73('0x44')]({'where':{'id':_0x591349[_0x1e73('0x42')]['id']}})[_0x1e73('0x24')](handleEntityNotFound(_0x3c83d7,null))[_0x1e73('0x24')](saveUpdates(_0x591349[_0x1e73('0x46')],null))[_0x1e73('0x24')](respondWithResult(_0x3c83d7,null))['catch'](handleError(_0x3c83d7,null));};exports[_0x1e73('0x47')]=function(_0x4f0531,_0x576cf2,_0x56a14b){var _0x36d956=require(_0x1e73('0x48'));var _0x1a88eb=![];var _0x130f59={};if(_0x4f0531[_0x1e73('0x31')]['type']&&_0x4f0531[_0x1e73('0x31')]['type']===_0x1e73('0x49')){_0x130f59[_0x1e73('0x49')]=_0x4f0531[_0x1e73('0x42')]['id'];}else{_0x130f59['id']=_0x4f0531[_0x1e73('0x42')]['id'];}return db['SquareRecording']['find']({'where':_0x130f59,'attributes':['id','savePath',_0x1e73('0x4a')],'raw':!![]})[_0x1e73('0x24')](handleEntityNotFound(_0x576cf2,null))[_0x1e73('0x24')](function(_0x9502d1){if(_0x9502d1){var _0x5173c0=_0x9502d1[_0x1e73('0x4b')];var _0x492331=util['format'](_0x1e73('0x4c'),_0x5173c0);if(fs[_0x1e73('0x4d')](_0x492331)){_0x1a88eb=!![];return _0x36d956[_0x1e73('0x4e')](_0x492331,_0x5173c0,config[_0x1e73('0x4f')][_0x1e73('0x50')])[_0x1e73('0x24')](function(){return _0x9502d1;});}return _0x9502d1;}})[_0x1e73('0x24')](function(_0x2ee4e4){if(_0x2ee4e4){var _0x4df21b=_0x2ee4e4[_0x1e73('0x4b')];if(!fs[_0x1e73('0x4d')](_0x4df21b)){throw new db[(_0x1e73('0x51'))][(_0x1e73('0x52'))]('SquareRecording\x20not\x20found');}if(_0x2ee4e4['filename']){return _0x576cf2[_0x1e73('0x47')](_0x4df21b,_0x2ee4e4[_0x1e73('0x4a')]+path[_0x1e73('0x53')](_0x4df21b),function(){if(_0x1a88eb){fs[_0x1e73('0x54')](_0x4df21b);}});}else{return _0x576cf2[_0x1e73('0x47')](_0x4df21b,function(_0x43fe8c){if(_0x1a88eb){fs['unlink'](_0x4df21b);}});}}})[_0x1e73('0x41')](function(_0x8335f9){if(_0x8335f9[_0x1e73('0x55')]==='SquareRecording\x20not\x20found'){_0x576cf2[_0x1e73('0x19')](0x194)[_0x1e73('0x56')]('Not\x20found');}else{return handleError(_0x576cf2,null);}});};exports[_0x1e73('0x25')]=function(_0x11acb5,_0x3b7d58){return db[_0x1e73('0x2b')][_0x1e73('0x44')]({'where':{'id':_0x11acb5[_0x1e73('0x42')]['id']}})[_0x1e73('0x24')](function(_0x49ec37){if(_[_0x1e73('0x57')](_0x49ec37)){throw new ReferenceError(_0x1e73('0x58'));}return _0x49ec37;})[_0x1e73('0x24')](function(_0x269b02){var _0x39eb49=_0x269b02[_0x1e73('0x4b')];logger['info'](_0x1e73('0x59'),_0x39eb49);if(!_['isNil'](_0x269b02[_0x1e73('0x4b')])&&fs[_0x1e73('0x4d')](_0x39eb49)){logger[_0x1e73('0x5a')](_0x1e73('0x5b')+_0x39eb49+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x39eb49);}_0x39eb49=_0x39eb49+_0x1e73('0x5c');if(!_[_0x1e73('0x57')](_0x269b02[_0x1e73('0x4b')])&&fs[_0x1e73('0x4d')](_0x39eb49)){logger[_0x1e73('0x5a')](_0x1e73('0x5b')+_0x39eb49+_0x1e73('0x5d'));fs[_0x1e73('0x5e')](_0x39eb49);}return _0x269b02;})[_0x1e73('0x24')](function(_0x72d8c){if(!_0x72d8c)throw new InternalError();return _0x72d8c['destroy']();})[_0x1e73('0x24')](function(){_0x3b7d58[_0x1e73('0x19')](0xcc)[_0x1e73('0x1a')]();})[_0x1e73('0x41')](handleError(_0x3b7d58,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 0909313..be46141 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 _0x99a0=['square_recordings','lodash','util','request-promise','path','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x99a0,0x121));var _0x099a=function(_0x1cc17e,_0x333eae){_0x1cc17e=_0x1cc17e-0x0;var _0x2b4cb8=_0x99a0[_0x1cc17e];return _0x2b4cb8;};'use strict';var _=require(_0x099a('0x0'));var util=require(_0x099a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x099a('0x2'));var fs=require('fs');var path=require(_0x099a('0x3'));var rimraf=require('rimraf');var config=require(_0x099a('0x4'));var attributes=require(_0x099a('0x5'));module[_0x099a('0x6')]=function(_0x215a07,_0x2f1aea){return _0x215a07[_0x099a('0x7')]('SquareRecording',attributes,{'tableName':_0x099a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc599=['../../config/environment','./squareRecording.attributes','exports','square_recordings','util','api','moment','bluebird','path','rimraf'];(function(_0x162404,_0x3903c7){var _0x1d7869=function(_0x430b43){while(--_0x430b43){_0x162404['push'](_0x162404['shift']());}};_0x1d7869(++_0x3903c7);}(_0xc599,0x1b2));var _0x9c59=function(_0x43bb57,_0x1bd572){_0x43bb57=_0x43bb57-0x0;var _0x260a1e=_0xc599[_0x43bb57];return _0x260a1e;};'use strict';var _=require('lodash');var util=require(_0x9c59('0x0'));var logger=require('../../config/logger')(_0x9c59('0x1'));var moment=require(_0x9c59('0x2'));var BPromise=require(_0x9c59('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c59('0x4'));var rimraf=require(_0x9c59('0x5'));var config=require(_0x9c59('0x6'));var attributes=require(_0x9c59('0x7'));module[_0x9c59('0x8')]=function(_0x143652,_0x470ec3){return _0x143652['define']('SquareRecording',attributes,{'tableName':_0x9c59('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 e3f44bc..5ccbed5 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 _0x9468=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateSquareRecording','create','body','options','catch','lodash','util','moment','bluebird'];(function(_0x516281,_0x1973f0){var _0x4124c0=function(_0x128512){while(--_0x128512){_0x516281['push'](_0x516281['shift']());}};_0x4124c0(++_0x1973f0);}(_0x9468,0x100));var _0x8946=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x9468[_0x2a67fe];return _0x57e726;};'use strict';var _=require(_0x8946('0x0'));var util=require(_0x8946('0x1'));var moment=require(_0x8946('0x2'));var BPromise=require(_0x8946('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8946('0x4'))['db'];var utils=require(_0x8946('0x5'));var logger=require(_0x8946('0x6'))(_0x8946('0x7'));var config=require(_0x8946('0x8'));var jayson=require(_0x8946('0x9'));var client=jayson['client'][_0x8946('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5858be,_0x5095a1,_0x2e15cd){return new BPromise(function(_0x3b72ec,_0x1711f7){return client[_0x8946('0xb')](_0x5858be,_0x2e15cd)[_0x8946('0xc')](function(_0xc0e7fb){logger[_0x8946('0xd')](_0x8946('0xe'),_0x5095a1,_0x8946('0xf'));logger[_0x8946('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5095a1,_0x8946('0xf'),JSON[_0x8946('0x11')](_0xc0e7fb));if(_0xc0e7fb[_0x8946('0x12')]){if(_0xc0e7fb[_0x8946('0x12')]['code']===0x1f4){logger[_0x8946('0x12')](_0x8946('0xe'),_0x5095a1,_0xc0e7fb[_0x8946('0x12')]['message']);return _0x1711f7(_0xc0e7fb[_0x8946('0x12')]['message']);}logger[_0x8946('0x12')]('SquareRecording,\x20%s,\x20%s',_0x5095a1,_0xc0e7fb['error'][_0x8946('0x13')]);return _0x3b72ec(_0xc0e7fb[_0x8946('0x12')][_0x8946('0x13')]);}else{logger[_0x8946('0xd')](_0x8946('0xe'),_0x5095a1,_0x8946('0xf'));_0x3b72ec(_0xc0e7fb[_0x8946('0x14')][_0x8946('0x13')]);}})['catch'](function(_0x10a571){logger[_0x8946('0x12')](_0x8946('0xe'),_0x5095a1,_0x10a571);_0x1711f7(_0x10a571);});});}exports[_0x8946('0x15')]=function(_0x436697){var _0x452a30=this;return new Promise(function(_0x245e8f,_0x2b82a0){return db['SquareRecording'][_0x8946('0x16')](_0x436697[_0x8946('0x17')],{'raw':_0x436697[_0x8946('0x18')]?_0x436697[_0x8946('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x27afee){logger['info']('CreateSquareRecording',_0x436697);logger['debug'](_0x8946('0x15'),_0x436697,JSON['stringify'](_0x27afee));_0x245e8f(_0x27afee);})[_0x8946('0x19')](function(_0x572b88){logger[_0x8946('0x12')](_0x8946('0x15'),_0x572b88[_0x8946('0x13')],_0x436697);_0x2b82a0(_0x452a30['error'](0x1f4,_0x572b88[_0x8946('0x13')]));});});}; \ No newline at end of file +var _0xca8c=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','body','options','raw','debug','lodash','util','moment'];(function(_0x420269,_0xd314bf){var _0x4b4cde=function(_0x242b83){while(--_0x242b83){_0x420269['push'](_0x420269['shift']());}};_0x4b4cde(++_0xd314bf);}(_0xca8c,0xc8));var _0xcca8=function(_0x3227af,_0x2e7883){_0x3227af=_0x3227af-0x0;var _0x13b4d8=_0xca8c[_0x3227af];return _0x13b4d8;};'use strict';var _=require(_0xcca8('0x0'));var util=require(_0xcca8('0x1'));var moment=require(_0xcca8('0x2'));var BPromise=require(_0xcca8('0x3'));var rs=require(_0xcca8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcca8('0x5'))['db'];var utils=require(_0xcca8('0x6'));var logger=require(_0xcca8('0x7'))(_0xcca8('0x8'));var config=require(_0xcca8('0x9'));var jayson=require(_0xcca8('0xa'));var client=jayson[_0xcca8('0xb')][_0xcca8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4286e9,_0x399f5f,_0x3ae2a9){return new BPromise(function(_0x24428d,_0x32855d){return client[_0xcca8('0xd')](_0x4286e9,_0x3ae2a9)[_0xcca8('0xe')](function(_0x3f779e){logger[_0xcca8('0xf')](_0xcca8('0x10'),_0x399f5f,'request\x20sent');logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x399f5f,_0xcca8('0x11'),JSON[_0xcca8('0x12')](_0x3f779e));if(_0x3f779e[_0xcca8('0x13')]){if(_0x3f779e[_0xcca8('0x13')][_0xcca8('0x14')]===0x1f4){logger['error'](_0xcca8('0x10'),_0x399f5f,_0x3f779e[_0xcca8('0x13')]['message']);return _0x32855d(_0x3f779e[_0xcca8('0x13')][_0xcca8('0x15')]);}logger[_0xcca8('0x13')]('SquareRecording,\x20%s,\x20%s',_0x399f5f,_0x3f779e[_0xcca8('0x13')][_0xcca8('0x15')]);return _0x24428d(_0x3f779e[_0xcca8('0x13')][_0xcca8('0x15')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x399f5f,_0xcca8('0x11'));_0x24428d(_0x3f779e['result'][_0xcca8('0x15')]);}})[_0xcca8('0x16')](function(_0x1ea800){logger[_0xcca8('0x13')](_0xcca8('0x10'),_0x399f5f,_0x1ea800);_0x32855d(_0x1ea800);});});}exports[_0xcca8('0x17')]=function(_0x360a6e){var _0x5ea889=this;return new Promise(function(_0x204e99,_0x295cf8){return db[_0xcca8('0x18')]['create'](_0x360a6e[_0xcca8('0x19')],{'raw':_0x360a6e[_0xcca8('0x1a')]?_0x360a6e[_0xcca8('0x1a')][_0xcca8('0x1b')]===undefined?!![]:![]:!![]})[_0xcca8('0xe')](function(_0x18e76f){logger[_0xcca8('0xf')]('CreateSquareRecording',_0x360a6e);logger[_0xcca8('0x1c')]('CreateSquareRecording',_0x360a6e,JSON[_0xcca8('0x12')](_0x18e76f));_0x204e99(_0x18e76f);})[_0xcca8('0x16')](function(_0x44fa44){logger[_0xcca8('0x13')](_0xcca8('0x17'),_0x44fa44['message'],_0x360a6e);_0x295cf8(_0x5ea889[_0xcca8('0x13')](0x1f4,_0x44fa44[_0xcca8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 3d93a83..3a9c982 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 _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(_0x39d6a8,_0xc9c91a){var _0x93f3db=function(_0x953b09){while(--_0x953b09){_0x39d6a8['push'](_0x39d6a8['shift']());}};_0x93f3db(++_0xc9c91a);}(_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('./squareReport.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','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x544e4a,_0x527d37){var _0xc36f65=function(_0x8544df){while(--_0x8544df){_0x544e4a['push'](_0x544e4a['shift']());}};_0xc36f65(++_0x527d37);}(_0xb10b,0x12a));var _0xbb10=function(_0x413f87,_0x12c5c0){_0x413f87=_0x413f87-0x0;var _0xb4ae8c=_0xb10b[_0x413f87];return _0xb4ae8c;};'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/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3b39fd7..f4bd898 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 _0x9643=['DATE','BOOLEAN','exports','STRING'];(function(_0x42da89,_0x5841bf){var _0x4ea5ec=function(_0xe3e823){while(--_0xe3e823){_0x42da89['push'](_0x42da89['shift']());}};_0x4ea5ec(++_0x5841bf);}(_0x9643,0x1da));var _0x3964=function(_0x1d6bff,_0x1ebe1f){_0x1d6bff=_0x1d6bff-0x0;var _0x12bedf=_0x9643[_0x1d6bff];return _0x12bedf;};'use strict';var Sequelize=require('sequelize');module[_0x3964('0x0')]={'network':{'type':Sequelize[_0x3964('0x1')]},'network_script':{'type':Sequelize[_0x3964('0x1')]},'request':{'type':Sequelize[_0x3964('0x1')]},'channel':{'type':Sequelize[_0x3964('0x1')]},'language':{'type':Sequelize[_0x3964('0x1')]},'type':{'type':Sequelize[_0x3964('0x1')]},'uniqueid':{'type':Sequelize[_0x3964('0x1')]},'version':{'type':Sequelize[_0x3964('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3964('0x1')]},'callingpres':{'type':Sequelize[_0x3964('0x1')]},'callingani2':{'type':Sequelize[_0x3964('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x3964('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x3964('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3964('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x3964('0x1')]},'accountcode':{'type':Sequelize[_0x3964('0x1')]},'threadid':{'type':Sequelize[_0x3964('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3964('0x2')]},'leaveAt':{'type':Sequelize[_0x3964('0x2')]},'bot':{'type':Sequelize[_0x3964('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf7e2=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2b6238,_0x1d9288){var _0x23d204=function(_0x3a3101){while(--_0x3a3101){_0x2b6238['push'](_0x2b6238['shift']());}};_0x23d204(++_0x1d9288);}(_0xf7e2,0x1bd));var _0x2f7e=function(_0x112d24,_0x215fd4){_0x112d24=_0x112d24-0x0;var _0x5df472=_0xf7e2[_0x112d24];return _0x5df472;};'use strict';var Sequelize=require(_0x2f7e('0x0'));module[_0x2f7e('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x2f7e('0x2')]},'request':{'type':Sequelize[_0x2f7e('0x2')]},'channel':{'type':Sequelize[_0x2f7e('0x2')]},'language':{'type':Sequelize[_0x2f7e('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2f7e('0x2')]},'version':{'type':Sequelize[_0x2f7e('0x2')]},'callerid':{'type':Sequelize[_0x2f7e('0x2')]},'calleridname':{'type':Sequelize[_0x2f7e('0x2')]},'callingpres':{'type':Sequelize[_0x2f7e('0x2')]},'callingani2':{'type':Sequelize[_0x2f7e('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x2f7e('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x2f7e('0x2')]},'context':{'type':Sequelize[_0x2f7e('0x2')]},'extension':{'type':Sequelize[_0x2f7e('0x2')]},'priority':{'type':Sequelize[_0x2f7e('0x2')]},'enhanced':{'type':Sequelize[_0x2f7e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x2f7e('0x2')]},'project_name':{'type':Sequelize[_0x2f7e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2f7e('0x3')]},'bot':{'type':Sequelize[_0x2f7e('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 5a6d9f2..c66b4ab 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 _0x4310=['json','apply','reject','save','update','then','sendStatus','name','SquareReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','params','length','include','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','set'];(function(_0x4c41b5,_0x316a7){var _0x4f57ef=function(_0x225c97){while(--_0x225c97){_0x4c41b5['push'](_0x4c41b5['shift']());}};_0x4f57ef(++_0x316a7);}(_0x4310,0x71));var _0x0431=function(_0x10cfc2,_0x88b59d){_0x10cfc2=_0x10cfc2-0x0;var _0x25b436=_0x4310[_0x10cfc2];return _0x25b436;};'use strict';var emlformat=require(_0x0431('0x0'));var rimraf=require(_0x0431('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0431('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0431('0x3'));var Mustache=require(_0x0431('0x4'));var util=require(_0x0431('0x5'));var path=require('path');var sox=require(_0x0431('0x6'));var csv=require(_0x0431('0x7'));var ejs=require(_0x0431('0x8'));var fs=require('fs');var fs_extra=require(_0x0431('0x9'));var _=require(_0x0431('0xa'));var squel=require(_0x0431('0xb'));var crypto=require('crypto');var jsforce=require(_0x0431('0xc'));var deskjs=require(_0x0431('0xd'));var toCsv=require(_0x0431('0x7'));var querystring=require(_0x0431('0xe'));var Papa=require(_0x0431('0xf'));var Redis=require(_0x0431('0x10'));var authService=require(_0x0431('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0431('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0431('0x13'));var utils=require(_0x0431('0x14'));var config=require(_0x0431('0x15'));var licenseUtil=require(_0x0431('0x16'));var db=require(_0x0431('0x17'))['db'];function respondWithStatusCode(_0x327cfb,_0xdf5eb1){_0xdf5eb1=_0xdf5eb1||0xcc;return function(_0x55ec1e){if(_0x55ec1e){return _0x327cfb['sendStatus'](_0xdf5eb1);}return _0x327cfb[_0x0431('0x18')](_0xdf5eb1)['end']();};}function respondWithResult(_0x2dc987,_0x29ef9e){_0x29ef9e=_0x29ef9e||0xc8;return function(_0x20456a){if(_0x20456a){return _0x2dc987[_0x0431('0x18')](_0x29ef9e)['json'](_0x20456a);}};}function respondWithFilteredResult(_0x572492,_0x47434a){return function(_0x4a6f36){if(_0x4a6f36){var _0x25b550=typeof _0x47434a['offset']===_0x0431('0x19')&&typeof _0x47434a['limit']===_0x0431('0x19');var _0x3fdb40=_0x4a6f36[_0x0431('0x1a')];var _0x32f4c3=_0x25b550?0x0:_0x47434a[_0x0431('0x1b')];var _0xd4a977=_0x25b550?_0x4a6f36[_0x0431('0x1a')]:_0x47434a[_0x0431('0x1b')]+_0x47434a['limit'];var _0x2bcf5b;if(_0xd4a977>=_0x3fdb40){_0xd4a977=_0x3fdb40;_0x2bcf5b=0xc8;}else{_0x2bcf5b=0xce;}_0x572492[_0x0431('0x18')](_0x2bcf5b);return _0x572492[_0x0431('0x1c')]('Content-Range',_0x32f4c3+'-'+_0xd4a977+'/'+_0x3fdb40)[_0x0431('0x1d')](_0x4a6f36);}return null;};}function patchUpdates(_0x29cd1a){return function(_0x416e7d){try{jsonpatch[_0x0431('0x1e')](_0x416e7d,_0x29cd1a,!![]);}catch(_0xfa2888){return BPromise[_0x0431('0x1f')](_0xfa2888);}return _0x416e7d[_0x0431('0x20')]();};}function saveUpdates(_0x251e99,_0x2bdd52){return function(_0x4ed079){if(_0x4ed079){return _0x4ed079[_0x0431('0x21')](_0x251e99)['then'](function(_0x38a377){return _0x38a377;});}return null;};}function removeEntity(_0x45b98a,_0x273734){return function(_0x48f221){if(_0x48f221){return _0x48f221['destroy']()[_0x0431('0x22')](function(){_0x45b98a[_0x0431('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df409,_0x5df77a){return function(_0x2d9c4d){if(!_0x2d9c4d){_0x3df409[_0x0431('0x23')](0x194);}return _0x2d9c4d;};}function handleError(_0x1dfedb,_0x32a8c8){_0x32a8c8=_0x32a8c8||0x1f4;return function(_0x31f4dd){logger['error'](_0x31f4dd['stack']);if(_0x31f4dd[_0x0431('0x24')]){delete _0x31f4dd['name'];}_0x1dfedb[_0x0431('0x18')](_0x32a8c8)['send'](_0x31f4dd);};}exports['index']=function(_0x4962e9,_0x5b06c9){var _0x3bc0b9={},_0xa38a8c={},_0x661154={'count':0x0,'rows':[]};var _0x2b1c8a=_['map'](db[_0x0431('0x25')][_0x0431('0x26')],function(_0x263df1){return{'name':_0x263df1[_0x0431('0x27')],'type':_0x263df1['type']['key']};});_0xa38a8c[_0x0431('0x28')]=_[_0x0431('0x29')](_0x2b1c8a,_0x0431('0x24'));_0xa38a8c[_0x0431('0x2a')]=_[_0x0431('0x2b')](_0x4962e9['query']);_0xa38a8c[_0x0431('0x2c')]=_[_0x0431('0x2d')](_0xa38a8c[_0x0431('0x28')],_0xa38a8c['query']);_0x3bc0b9[_0x0431('0x2e')]=_[_0x0431('0x2d')](_0xa38a8c[_0x0431('0x28')],qs[_0x0431('0x2f')](_0x4962e9[_0x0431('0x2a')]['fields']));_0x3bc0b9[_0x0431('0x2e')]=_0x3bc0b9[_0x0431('0x2e')]['length']?_0x3bc0b9['attributes']:_0xa38a8c['model'];if(!_0x4962e9[_0x0431('0x2a')][_0x0431('0x30')](_0x0431('0x31'))){_0x3bc0b9[_0x0431('0x32')]=qs[_0x0431('0x32')](_0x4962e9['query'][_0x0431('0x32')]);_0x3bc0b9['offset']=qs['offset'](_0x4962e9[_0x0431('0x2a')][_0x0431('0x1b')]);}_0x3bc0b9[_0x0431('0x33')]=qs[_0x0431('0x34')](_0x4962e9[_0x0431('0x2a')][_0x0431('0x34')]);_0x3bc0b9[_0x0431('0x35')]=qs['filters'](_[_0x0431('0x36')](_0x4962e9['query'],_0xa38a8c['filters']),_0x2b1c8a);if(_0x4962e9['query'][_0x0431('0x37')]){_0x3bc0b9[_0x0431('0x35')]=_[_0x0431('0x38')](_0x3bc0b9[_0x0431('0x35')],{'$or':_[_0x0431('0x29')](_0x2b1c8a,function(_0x493a23){if(_0x493a23[_0x0431('0x39')]!==_0x0431('0x3a')){var _0x30c162={};_0x30c162[_0x493a23['name']]={'$like':'%'+_0x4962e9[_0x0431('0x2a')][_0x0431('0x37')]+'%'};return _0x30c162;}})});}_0x3bc0b9=_['merge']({},_0x3bc0b9,_0x4962e9[_0x0431('0x3b')]);var _0x4948e1={'where':_0x3bc0b9[_0x0431('0x35')]};return db[_0x0431('0x25')][_0x0431('0x1a')](_0x4948e1)['then'](function(_0x57f040){_0x661154['count']=_0x57f040;if(_0x4962e9[_0x0431('0x2a')][_0x0431('0x3c')]){_0x3bc0b9['include']=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x3bc0b9);})[_0x0431('0x22')](function(_0x4efabf){_0x661154[_0x0431('0x3d')]=_0x4efabf;return _0x661154;})[_0x0431('0x22')](respondWithFilteredResult(_0x5b06c9,_0x3bc0b9))[_0x0431('0x3e')](handleError(_0x5b06c9,null));};exports['show']=function(_0x1de7bb,_0x13e833){var _0x165fcd={'raw':!![],'where':{'id':_0x1de7bb[_0x0431('0x3f')]['id']}},_0x5b5ce4={};_0x5b5ce4[_0x0431('0x28')]=_[_0x0431('0x2b')](db[_0x0431('0x25')][_0x0431('0x26')]);_0x5b5ce4[_0x0431('0x2a')]=_[_0x0431('0x2b')](_0x1de7bb['query']);_0x5b5ce4[_0x0431('0x2c')]=_[_0x0431('0x2d')](_0x5b5ce4['model'],_0x5b5ce4[_0x0431('0x2a')]);_0x165fcd[_0x0431('0x2e')]=_[_0x0431('0x2d')](_0x5b5ce4[_0x0431('0x28')],qs[_0x0431('0x2f')](_0x1de7bb[_0x0431('0x2a')][_0x0431('0x2f')]));_0x165fcd[_0x0431('0x2e')]=_0x165fcd[_0x0431('0x2e')][_0x0431('0x40')]?_0x165fcd['attributes']:_0x5b5ce4[_0x0431('0x28')];if(_0x1de7bb[_0x0431('0x2a')][_0x0431('0x3c')]){_0x165fcd[_0x0431('0x41')]=[{'all':!![]}];}_0x165fcd=_['merge']({},_0x165fcd,_0x1de7bb[_0x0431('0x3b')]);return db[_0x0431('0x25')][_0x0431('0x42')](_0x165fcd)['then'](handleEntityNotFound(_0x13e833,null))[_0x0431('0x22')](respondWithResult(_0x13e833,null))[_0x0431('0x3e')](handleError(_0x13e833,null));};exports[_0x0431('0x43')]=function(_0x190372,_0x47ca3a){return db[_0x0431('0x25')][_0x0431('0x43')](_0x190372['body'],{})[_0x0431('0x22')](respondWithResult(_0x47ca3a,0xc9))[_0x0431('0x3e')](handleError(_0x47ca3a,null));};exports[_0x0431('0x21')]=function(_0x9cc7d2,_0xa63acb){if(_0x9cc7d2[_0x0431('0x44')]['id']){delete _0x9cc7d2[_0x0431('0x44')]['id'];}return db[_0x0431('0x25')][_0x0431('0x42')]({'where':{'id':_0x9cc7d2['params']['id']}})[_0x0431('0x22')](handleEntityNotFound(_0xa63acb,null))[_0x0431('0x22')](saveUpdates(_0x9cc7d2['body'],null))[_0x0431('0x22')](respondWithResult(_0xa63acb,null))[_0x0431('0x3e')](handleError(_0xa63acb,null));};exports[_0x0431('0x45')]=function(_0x4bb5f8,_0x29f636){return db['SquareReport']['find']({'where':{'id':_0x4bb5f8[_0x0431('0x3f')]['id']}})[_0x0431('0x22')](handleEntityNotFound(_0x29f636,null))[_0x0431('0x22')](removeEntity(_0x29f636,null))[_0x0431('0x3e')](handleError(_0x29f636,null));};exports[_0x0431('0x46')]=function(_0x56b7aa,_0x47893a){return db[_0x0431('0x25')][_0x0431('0x46')]()[_0x0431('0x22')](respondWithResult(_0x47893a,null))[_0x0431('0x3e')](handleError(_0x47893a,null));}; \ No newline at end of file +var _0x6c06=['attributes','model','fields','nolimit','sort','pick','where','VIRTUAL','filter','options','SquareReport','include','rows','show','params','length','includeAll','merge','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','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','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x40292e,_0xaa2a7b){var _0x1ed986=function(_0x10dbef){while(--_0x10dbef){_0x40292e['push'](_0x40292e['shift']());}};_0x1ed986(++_0xaa2a7b);}(_0x6c06,0xb0));var _0x66c0=function(_0x496db3,_0x162c00){_0x496db3=_0x496db3-0x0;var _0x20064a=_0x6c06[_0x496db3];return _0x20064a;};'use strict';var emlformat=require(_0x66c0('0x0'));var rimraf=require(_0x66c0('0x1'));var zipdir=require(_0x66c0('0x2'));var jsonpatch=require(_0x66c0('0x3'));var rp=require('request-promise');var moment=require(_0x66c0('0x4'));var BPromise=require(_0x66c0('0x5'));var Mustache=require(_0x66c0('0x6'));var util=require(_0x66c0('0x7'));var path=require(_0x66c0('0x8'));var sox=require(_0x66c0('0x9'));var csv=require(_0x66c0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66c0('0xb'));var _=require(_0x66c0('0xc'));var squel=require(_0x66c0('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x66c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x66c0('0xf'));var Papa=require(_0x66c0('0x10'));var Redis=require(_0x66c0('0x11'));var authService=require(_0x66c0('0x12'));var qs=require(_0x66c0('0x13'));var as=require(_0x66c0('0x14'));var hardwareService=require(_0x66c0('0x15'));var logger=require(_0x66c0('0x16'))(_0x66c0('0x17'));var utils=require(_0x66c0('0x18'));var config=require(_0x66c0('0x19'));var licenseUtil=require(_0x66c0('0x1a'));var db=require(_0x66c0('0x1b'))['db'];function respondWithStatusCode(_0x5c6206,_0x33a11f){_0x33a11f=_0x33a11f||0xcc;return function(_0x18d115){if(_0x18d115){return _0x5c6206[_0x66c0('0x1c')](_0x33a11f);}return _0x5c6206['status'](_0x33a11f)['end']();};}function respondWithResult(_0x64020a,_0x251262){_0x251262=_0x251262||0xc8;return function(_0x5cfd15){if(_0x5cfd15){return _0x64020a[_0x66c0('0x1d')](_0x251262)[_0x66c0('0x1e')](_0x5cfd15);}};}function respondWithFilteredResult(_0x1de8d7,_0x23f1b7){return function(_0x26538e){if(_0x26538e){var _0x57a751=typeof _0x23f1b7['offset']===_0x66c0('0x1f')&&typeof _0x23f1b7[_0x66c0('0x20')]===_0x66c0('0x1f');var _0x26f90e=_0x26538e[_0x66c0('0x21')];var _0x8d4527=_0x57a751?0x0:_0x23f1b7[_0x66c0('0x22')];var _0x2c4161=_0x57a751?_0x26538e['count']:_0x23f1b7[_0x66c0('0x22')]+_0x23f1b7[_0x66c0('0x20')];var _0x472220;if(_0x2c4161>=_0x26f90e){_0x2c4161=_0x26f90e;_0x472220=0xc8;}else{_0x472220=0xce;}_0x1de8d7[_0x66c0('0x1d')](_0x472220);return _0x1de8d7['set'](_0x66c0('0x23'),_0x8d4527+'-'+_0x2c4161+'/'+_0x26f90e)['json'](_0x26538e);}return null;};}function patchUpdates(_0x59f5a1){return function(_0x488928){try{jsonpatch['apply'](_0x488928,_0x59f5a1,!![]);}catch(_0x2ab73a){return BPromise[_0x66c0('0x24')](_0x2ab73a);}return _0x488928['save']();};}function saveUpdates(_0x2fce28,_0x48df3c){return function(_0x5867f7){if(_0x5867f7){return _0x5867f7['update'](_0x2fce28)[_0x66c0('0x25')](function(_0x52dae3){return _0x52dae3;});}return null;};}function removeEntity(_0x10937f,_0x55c598){return function(_0x1f34f5){if(_0x1f34f5){return _0x1f34f5[_0x66c0('0x26')]()[_0x66c0('0x25')](function(){_0x10937f[_0x66c0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d0098,_0x44ba07){return function(_0x3733a2){if(!_0x3733a2){_0x4d0098[_0x66c0('0x1c')](0x194);}return _0x3733a2;};}function handleError(_0x2ae266,_0x2f77b3){_0x2f77b3=_0x2f77b3||0x1f4;return function(_0x4f4acd){logger['error'](_0x4f4acd[_0x66c0('0x27')]);if(_0x4f4acd[_0x66c0('0x28')]){delete _0x4f4acd[_0x66c0('0x28')];}_0x2ae266[_0x66c0('0x1d')](_0x2f77b3)[_0x66c0('0x29')](_0x4f4acd);};}exports[_0x66c0('0x2a')]=function(_0x5a8d6d,_0x540a53){var _0xba7b95={},_0x5b01ef={},_0x78924d={'count':0x0,'rows':[]};var _0x5869b4=_[_0x66c0('0x2b')](db['SquareReport'][_0x66c0('0x2c')],function(_0x69c0aa){return{'name':_0x69c0aa[_0x66c0('0x2d')],'type':_0x69c0aa[_0x66c0('0x2e')][_0x66c0('0x2f')]};});_0x5b01ef['model']=_['map'](_0x5869b4,'name');_0x5b01ef[_0x66c0('0x30')]=_[_0x66c0('0x31')](_0x5a8d6d[_0x66c0('0x30')]);_0x5b01ef[_0x66c0('0x32')]=_[_0x66c0('0x33')](_0x5b01ef['model'],_0x5b01ef['query']);_0xba7b95[_0x66c0('0x34')]=_[_0x66c0('0x33')](_0x5b01ef[_0x66c0('0x35')],qs[_0x66c0('0x36')](_0x5a8d6d['query'][_0x66c0('0x36')]));_0xba7b95[_0x66c0('0x34')]=_0xba7b95[_0x66c0('0x34')]['length']?_0xba7b95['attributes']:_0x5b01ef[_0x66c0('0x35')];if(!_0x5a8d6d[_0x66c0('0x30')]['hasOwnProperty'](_0x66c0('0x37'))){_0xba7b95['limit']=qs[_0x66c0('0x20')](_0x5a8d6d['query'][_0x66c0('0x20')]);_0xba7b95['offset']=qs[_0x66c0('0x22')](_0x5a8d6d[_0x66c0('0x30')][_0x66c0('0x22')]);}_0xba7b95['order']=qs[_0x66c0('0x38')](_0x5a8d6d[_0x66c0('0x30')]['sort']);_0xba7b95['where']=qs[_0x66c0('0x32')](_[_0x66c0('0x39')](_0x5a8d6d['query'],_0x5b01ef[_0x66c0('0x32')]),_0x5869b4);if(_0x5a8d6d[_0x66c0('0x30')]['filter']){_0xba7b95[_0x66c0('0x3a')]=_['merge'](_0xba7b95[_0x66c0('0x3a')],{'$or':_['map'](_0x5869b4,function(_0x3bd027){if(_0x3bd027[_0x66c0('0x2e')]!==_0x66c0('0x3b')){var _0x16d945={};_0x16d945[_0x3bd027[_0x66c0('0x28')]]={'$like':'%'+_0x5a8d6d['query'][_0x66c0('0x3c')]+'%'};return _0x16d945;}})});}_0xba7b95=_['merge']({},_0xba7b95,_0x5a8d6d[_0x66c0('0x3d')]);var _0x11fb1c={'where':_0xba7b95['where']};return db[_0x66c0('0x3e')]['count'](_0x11fb1c)[_0x66c0('0x25')](function(_0x4c0966){_0x78924d['count']=_0x4c0966;if(_0x5a8d6d[_0x66c0('0x30')]['includeAll']){_0xba7b95[_0x66c0('0x3f')]=[{'all':!![]}];}return db[_0x66c0('0x3e')]['findAll'](_0xba7b95);})[_0x66c0('0x25')](function(_0xabb84f){_0x78924d[_0x66c0('0x40')]=_0xabb84f;return _0x78924d;})[_0x66c0('0x25')](respondWithFilteredResult(_0x540a53,_0xba7b95))['catch'](handleError(_0x540a53,null));};exports[_0x66c0('0x41')]=function(_0x422180,_0x18ae24){var _0x1947cd={'raw':!![],'where':{'id':_0x422180[_0x66c0('0x42')]['id']}},_0x4aa55f={};_0x4aa55f[_0x66c0('0x35')]=_[_0x66c0('0x31')](db[_0x66c0('0x3e')][_0x66c0('0x2c')]);_0x4aa55f[_0x66c0('0x30')]=_[_0x66c0('0x31')](_0x422180[_0x66c0('0x30')]);_0x4aa55f[_0x66c0('0x32')]=_[_0x66c0('0x33')](_0x4aa55f['model'],_0x4aa55f[_0x66c0('0x30')]);_0x1947cd[_0x66c0('0x34')]=_['intersection'](_0x4aa55f[_0x66c0('0x35')],qs['fields'](_0x422180[_0x66c0('0x30')][_0x66c0('0x36')]));_0x1947cd[_0x66c0('0x34')]=_0x1947cd[_0x66c0('0x34')][_0x66c0('0x43')]?_0x1947cd['attributes']:_0x4aa55f[_0x66c0('0x35')];if(_0x422180[_0x66c0('0x30')][_0x66c0('0x44')]){_0x1947cd[_0x66c0('0x3f')]=[{'all':!![]}];}_0x1947cd=_[_0x66c0('0x45')]({},_0x1947cd,_0x422180[_0x66c0('0x3d')]);return db['SquareReport'][_0x66c0('0x46')](_0x1947cd)[_0x66c0('0x25')](handleEntityNotFound(_0x18ae24,null))['then'](respondWithResult(_0x18ae24,null))[_0x66c0('0x47')](handleError(_0x18ae24,null));};exports[_0x66c0('0x48')]=function(_0x3feade,_0x5c4bf5){return db[_0x66c0('0x3e')][_0x66c0('0x48')](_0x3feade[_0x66c0('0x49')],{})[_0x66c0('0x25')](respondWithResult(_0x5c4bf5,0xc9))[_0x66c0('0x47')](handleError(_0x5c4bf5,null));};exports[_0x66c0('0x4a')]=function(_0x443f28,_0x1e2381){if(_0x443f28[_0x66c0('0x49')]['id']){delete _0x443f28[_0x66c0('0x49')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x443f28[_0x66c0('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e2381,null))['then'](saveUpdates(_0x443f28['body'],null))[_0x66c0('0x25')](respondWithResult(_0x1e2381,null))[_0x66c0('0x47')](handleError(_0x1e2381,null));};exports[_0x66c0('0x26')]=function(_0x32268b,_0x290e54){return db[_0x66c0('0x3e')][_0x66c0('0x46')]({'where':{'id':_0x32268b[_0x66c0('0x42')]['id']}})[_0x66c0('0x25')](handleEntityNotFound(_0x290e54,null))[_0x66c0('0x25')](removeEntity(_0x290e54,null))[_0x66c0('0x47')](handleError(_0x290e54,null));};exports[_0x66c0('0x4b')]=function(_0x28f02d,_0x19ad70){return db['SquareReport'][_0x66c0('0x4b')]()[_0x66c0('0x25')](respondWithResult(_0x19ad70,null))[_0x66c0('0x47')](handleError(_0x19ad70,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c913c66..8002559 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 _0x0405=['path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x523358,_0x125271){var _0x27c3ec=function(_0xade4aa){while(--_0xade4aa){_0x523358['push'](_0x523358['shift']());}};_0x27c3ec(++_0x125271);}(_0x0405,0x1aa));var _0x5040=function(_0x291881,_0x15f6a8){_0x291881=_0x291881-0x0;var _0x319933=_0x0405[_0x291881];return _0x319933;};'use strict';var _=require('lodash');var util=require(_0x5040('0x0'));var logger=require(_0x5040('0x1'))(_0x5040('0x2'));var moment=require(_0x5040('0x3'));var BPromise=require(_0x5040('0x4'));var rp=require(_0x5040('0x5'));var fs=require('fs');var path=require(_0x5040('0x6'));var rimraf=require(_0x5040('0x7'));var config=require(_0x5040('0x8'));var attributes=require(_0x5040('0x9'));module['exports']=function(_0x260b44,_0x4339e1){return _0x260b44[_0x5040('0xa')](_0x5040('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x5040('0xc'),'fields':[_0x5040('0xd'),_0x5040('0xe')]},{'name':'leaveAt','fields':[_0x5040('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92d0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','uniqueid','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x92d0,0x84));var _0x092d=function(_0x4eb0b1,_0x1621ac){_0x4eb0b1=_0x4eb0b1-0x0;var _0x1b58bd=_0x92d0[_0x4eb0b1];return _0x1b58bd;};'use strict';var _=require(_0x092d('0x0'));var util=require(_0x092d('0x1'));var logger=require(_0x092d('0x2'))(_0x092d('0x3'));var moment=require(_0x092d('0x4'));var BPromise=require(_0x092d('0x5'));var rp=require(_0x092d('0x6'));var fs=require('fs');var path=require(_0x092d('0x7'));var rimraf=require(_0x092d('0x8'));var config=require(_0x092d('0x9'));var attributes=require(_0x092d('0xa'));module['exports']=function(_0x22154d,_0x356d3e){return _0x22154d[_0x092d('0xb')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x092d('0xc'),_0x092d('0xd')]},{'name':'leaveAt','fields':[_0x092d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 66c630a..8f1bb8e 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 _0x5e39=['SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport','SquareReport','body','options','raw','debug','UpdateSquareReport','update','where','attributes','limit','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','request\x20sent','stringify','error'];(function(_0x52552b,_0x2aef59){var _0x9c77b=function(_0x5e7a60){while(--_0x5e7a60){_0x52552b['push'](_0x52552b['shift']());}};_0x9c77b(++_0x2aef59);}(_0x5e39,0xde));var _0x95e3=function(_0x3996db,_0x2f6b26){_0x3996db=_0x3996db-0x0;var _0x173f2e=_0x5e39[_0x3996db];return _0x173f2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x95e3('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95e3('0x1'));var db=require(_0x95e3('0x2'))['db'];var utils=require(_0x95e3('0x3'));var logger=require(_0x95e3('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x95e3('0x5'));var client=jayson[_0x95e3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x321d79,_0x33d9bf,_0x4e7e1c){return new BPromise(function(_0x190ffd,_0x3d3276){return client['request'](_0x321d79,_0x4e7e1c)[_0x95e3('0x7')](function(_0x17e67c){logger[_0x95e3('0x8')]('SquareReport,\x20%s,\x20%s',_0x33d9bf,_0x95e3('0x9'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x33d9bf,_0x95e3('0x9'),JSON[_0x95e3('0xa')](_0x17e67c));if(_0x17e67c[_0x95e3('0xb')]){if(_0x17e67c[_0x95e3('0xb')]['code']===0x1f4){logger[_0x95e3('0xb')](_0x95e3('0xc'),_0x33d9bf,_0x17e67c[_0x95e3('0xb')]['message']);return _0x3d3276(_0x17e67c['error'][_0x95e3('0xd')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x33d9bf,_0x17e67c[_0x95e3('0xb')][_0x95e3('0xd')]);return _0x190ffd(_0x17e67c[_0x95e3('0xb')]['message']);}else{logger[_0x95e3('0x8')](_0x95e3('0xc'),_0x33d9bf,_0x95e3('0x9'));_0x190ffd(_0x17e67c[_0x95e3('0xe')][_0x95e3('0xd')]);}})['catch'](function(_0x20b7d9){logger[_0x95e3('0xb')]('SquareReport,\x20%s,\x20%s',_0x33d9bf,_0x20b7d9);_0x3d3276(_0x20b7d9);});});}exports[_0x95e3('0xf')]=function(_0x3c40b5){var _0x559206=this;return new Promise(function(_0x345cab,_0x25722b){return db[_0x95e3('0x10')]['create'](_0x3c40b5[_0x95e3('0x11')],{'raw':_0x3c40b5['options']?_0x3c40b5[_0x95e3('0x12')][_0x95e3('0x13')]===undefined?!![]:![]:!![]})[_0x95e3('0x7')](function(_0x12c136){logger['info'](_0x95e3('0xf'),_0x3c40b5);logger[_0x95e3('0x14')](_0x95e3('0xf'),_0x3c40b5,JSON[_0x95e3('0xa')](_0x12c136));_0x345cab(_0x12c136);})['catch'](function(_0x456964){logger['error']('CreateSquareReport',_0x456964[_0x95e3('0xd')],_0x3c40b5);_0x25722b(_0x559206[_0x95e3('0xb')](0x1f4,_0x456964['message']));});});};exports[_0x95e3('0x15')]=function(_0x483985){var _0x3a8acf=this;return new Promise(function(_0x2a4f5c,_0x512ec8){return db['SquareReport'][_0x95e3('0x16')](_0x483985[_0x95e3('0x11')],{'raw':_0x483985['options']?_0x483985[_0x95e3('0x12')][_0x95e3('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x483985[_0x95e3('0x12')]?_0x483985['options'][_0x95e3('0x17')]||null:null,'attributes':_0x483985[_0x95e3('0x12')]?_0x483985[_0x95e3('0x12')][_0x95e3('0x18')]||null:null,'limit':_0x483985[_0x95e3('0x12')]?_0x483985[_0x95e3('0x12')][_0x95e3('0x19')]||null:null})[_0x95e3('0x7')](function(_0x59fe21){logger[_0x95e3('0x8')](_0x95e3('0x15'),_0x483985);logger[_0x95e3('0x14')](_0x95e3('0x15'),_0x483985,JSON[_0x95e3('0xa')](_0x59fe21));_0x2a4f5c(_0x59fe21);})['catch'](function(_0x23c988){logger[_0x95e3('0xb')](_0x95e3('0x15'),_0x23c988[_0x95e3('0xd')],_0x483985);_0x512ec8(_0x3a8acf[_0x95e3('0xb')](0x1f4,_0x23c988[_0x95e3('0xd')]));});});}; \ No newline at end of file +var _0x4bd8=['body','where','limit','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport','SquareReport','options','raw','catch','UpdateSquareReport','update'];(function(_0x1c88f9,_0x211646){var _0x1779f7=function(_0x1dc48e){while(--_0x1dc48e){_0x1c88f9['push'](_0x1c88f9['shift']());}};_0x1779f7(++_0x211646);}(_0x4bd8,0x16f));var _0x84bd=function(_0x33b9a7,_0x218183){_0x33b9a7=_0x33b9a7-0x0;var _0x275e65=_0x4bd8[_0x33b9a7];return _0x275e65;};'use strict';var _=require(_0x84bd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84bd('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x84bd('0x2'));var logger=require(_0x84bd('0x3'))(_0x84bd('0x4'));var config=require(_0x84bd('0x5'));var jayson=require(_0x84bd('0x6'));var client=jayson[_0x84bd('0x7')][_0x84bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f7078,_0x1a666e,_0x23daee){return new BPromise(function(_0x14742c,_0x1ae0ed){return client[_0x84bd('0x9')](_0x1f7078,_0x23daee)[_0x84bd('0xa')](function(_0x37db16){logger[_0x84bd('0xb')]('SquareReport,\x20%s,\x20%s',_0x1a666e,_0x84bd('0xc'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x1a666e,_0x84bd('0xc'),JSON[_0x84bd('0xd')](_0x37db16));if(_0x37db16[_0x84bd('0xe')]){if(_0x37db16[_0x84bd('0xe')]['code']===0x1f4){logger[_0x84bd('0xe')](_0x84bd('0xf'),_0x1a666e,_0x37db16[_0x84bd('0xe')][_0x84bd('0x10')]);return _0x1ae0ed(_0x37db16[_0x84bd('0xe')][_0x84bd('0x10')]);}logger[_0x84bd('0xe')](_0x84bd('0xf'),_0x1a666e,_0x37db16['error'][_0x84bd('0x10')]);return _0x14742c(_0x37db16[_0x84bd('0xe')][_0x84bd('0x10')]);}else{logger[_0x84bd('0xb')](_0x84bd('0xf'),_0x1a666e,'request\x20sent');_0x14742c(_0x37db16[_0x84bd('0x11')][_0x84bd('0x10')]);}})['catch'](function(_0x56e9e4){logger[_0x84bd('0xe')]('SquareReport,\x20%s,\x20%s',_0x1a666e,_0x56e9e4);_0x1ae0ed(_0x56e9e4);});});}exports[_0x84bd('0x12')]=function(_0x408cdf){var _0x3d6463=this;return new Promise(function(_0x14f29d,_0xe6064e){return db[_0x84bd('0x13')]['create'](_0x408cdf['body'],{'raw':_0x408cdf[_0x84bd('0x14')]?_0x408cdf[_0x84bd('0x14')][_0x84bd('0x15')]===undefined?!![]:![]:!![]})[_0x84bd('0xa')](function(_0x57d041){logger['info'](_0x84bd('0x12'),_0x408cdf);logger['debug']('CreateSquareReport',_0x408cdf,JSON[_0x84bd('0xd')](_0x57d041));_0x14f29d(_0x57d041);})[_0x84bd('0x16')](function(_0x3dde92){logger[_0x84bd('0xe')](_0x84bd('0x12'),_0x3dde92[_0x84bd('0x10')],_0x408cdf);_0xe6064e(_0x3d6463[_0x84bd('0xe')](0x1f4,_0x3dde92[_0x84bd('0x10')]));});});};exports[_0x84bd('0x17')]=function(_0x58b223){var _0x20b200=this;return new Promise(function(_0xd11a9d,_0x5b2d10){return db[_0x84bd('0x13')][_0x84bd('0x18')](_0x58b223[_0x84bd('0x19')],{'raw':_0x58b223[_0x84bd('0x14')]?_0x58b223[_0x84bd('0x14')][_0x84bd('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58b223['options']?_0x58b223[_0x84bd('0x14')][_0x84bd('0x1a')]||null:null,'attributes':_0x58b223['options']?_0x58b223[_0x84bd('0x14')]['attributes']||null:null,'limit':_0x58b223[_0x84bd('0x14')]?_0x58b223[_0x84bd('0x14')][_0x84bd('0x1b')]||null:null})[_0x84bd('0xa')](function(_0x4f9450){logger[_0x84bd('0xb')](_0x84bd('0x17'),_0x58b223);logger['debug'](_0x84bd('0x17'),_0x58b223,JSON[_0x84bd('0xd')](_0x4f9450));_0xd11a9d(_0x4f9450);})['catch'](function(_0x53348b){logger[_0x84bd('0xe')](_0x84bd('0x17'),_0x53348b[_0x84bd('0x10')],_0x58b223);_0x5b2d10(_0x20b200['error'](0x1f4,_0x53348b[_0x84bd('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 28267ed..cd524e3 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 _0x511b=['create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','isAuthenticated','show','post'];(function(_0x3af958,_0xbc9596){var _0x317652=function(_0x4035e8){while(--_0x4035e8){_0x3af958['push'](_0x3af958['shift']());}};_0x317652(++_0xbc9596);}(_0x511b,0xdd));var _0xb511=function(_0x194adc,_0x29f075){_0x194adc=_0x194adc-0x0;var _0x549de0=_0x511b[_0x194adc];return _0x549de0;};'use strict';var multer=require(_0xb511('0x0'));var util=require(_0xb511('0x1'));var path=require(_0xb511('0x2'));var timeout=require(_0xb511('0x3'));var express=require(_0xb511('0x4'));var router=express[_0xb511('0x5')]();var fs_extra=require(_0xb511('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb511('0x7'));var controller=require('./squareReportDetail.controller');router[_0xb511('0x8')]('/',auth['isAuthenticated'](),controller[_0xb511('0x9')]);router[_0xb511('0x8')]('/describe',auth[_0xb511('0xa')](),controller['describe']);router['get']('/:id',auth[_0xb511('0xa')](),controller[_0xb511('0xb')]);router[_0xb511('0xc')]('/',auth[_0xb511('0xa')](),controller[_0xb511('0xd')]);router[_0xb511('0xe')](_0xb511('0xf'),auth[_0xb511('0xa')](),controller['update']);router[_0xb511('0x10')](_0xb511('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xb511('0x11')]=router; \ No newline at end of file +var _0x3d45=['get','/:id','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','/describe','describe'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3d45,0x80));var _0x53d4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3d45[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x53d4('0x0'));var util=require(_0x53d4('0x1'));var path=require(_0x53d4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x53d4('0x3')]();var fs_extra=require(_0x53d4('0x4'));var auth=require(_0x53d4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x53d4('0x6'));var controller=require(_0x53d4('0x7'));router['get']('/',auth[_0x53d4('0x8')](),controller[_0x53d4('0x9')]);router['get'](_0x53d4('0xa'),auth[_0x53d4('0x8')](),controller[_0x53d4('0xb')]);router[_0x53d4('0xc')](_0x53d4('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x53d4('0x8')](),controller[_0x53d4('0xe')]);router[_0x53d4('0xf')](_0x53d4('0xd'),auth[_0x53d4('0x8')](),controller[_0x53d4('0x10')]);router[_0x53d4('0x11')](_0x53d4('0xd'),auth[_0x53d4('0x8')](),controller[_0x53d4('0x12')]);module[_0x53d4('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 17b2788..f35140d 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 _0x5022=['STRING','TEXT','sequelize','exports'];(function(_0x21c1c7,_0x2ded8a){var _0x2d95bd=function(_0x34edab){while(--_0x34edab){_0x21c1c7['push'](_0x21c1c7['shift']());}};_0x2d95bd(++_0x2ded8a);}(_0x5022,0xce));var _0x2502=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5022[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0x2502('0x0'));module[_0x2502('0x1')]={'uniqueid':{'type':Sequelize[_0x2502('0x2')]},'node':{'type':Sequelize[_0x2502('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x2502('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2502('0x2')]}}; \ No newline at end of file +var _0x9145=['TEXT','sequelize','STRING'];(function(_0x4f32d2,_0x5dade7){var _0xb928c0=function(_0x582d3e){while(--_0x582d3e){_0x4f32d2['push'](_0x4f32d2['shift']());}};_0xb928c0(++_0x5dade7);}(_0x9145,0x16c));var _0x5914=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9145[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x5914('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5914('0x1')]},'node':{'type':Sequelize[_0x5914('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x5914('0x2')]},'project_name':{'type':Sequelize[_0x5914('0x1')]},'callerid':{'type':Sequelize[_0x5914('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 44afd15..6c2ed08 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 _0x4af9=['attributes','hasOwnProperty','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','fields','length','create','body','find','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','map','SquareDetailsReport','fieldName','type','key','model','query','keys','intersection'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4af9,0x1c7));var _0x94af=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4af9[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x94af('0x0'));var rimraf=require(_0x94af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x94af('0x2'));var moment=require(_0x94af('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x94af('0x4'));var util=require(_0x94af('0x5'));var path=require(_0x94af('0x6'));var sox=require('sox');var csv=require(_0x94af('0x7'));var ejs=require(_0x94af('0x8'));var fs=require('fs');var fs_extra=require(_0x94af('0x9'));var _=require(_0x94af('0xa'));var squel=require('squel');var crypto=require(_0x94af('0xb'));var jsforce=require(_0x94af('0xc'));var deskjs=require(_0x94af('0xd'));var toCsv=require(_0x94af('0x7'));var querystring=require('querystring');var Papa=require(_0x94af('0xe'));var Redis=require('ioredis');var authService=require(_0x94af('0xf'));var qs=require(_0x94af('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x94af('0x11'))(_0x94af('0x12'));var utils=require(_0x94af('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x94af('0x14'));var db=require(_0x94af('0x15'))['db'];function respondWithStatusCode(_0x3568d0,_0x574af5){_0x574af5=_0x574af5||0xcc;return function(_0x24d13b){if(_0x24d13b){return _0x3568d0[_0x94af('0x16')](_0x574af5);}return _0x3568d0[_0x94af('0x17')](_0x574af5)[_0x94af('0x18')]();};}function respondWithResult(_0x287b7d,_0x50b114){_0x50b114=_0x50b114||0xc8;return function(_0x4b1fc8){if(_0x4b1fc8){return _0x287b7d[_0x94af('0x17')](_0x50b114)[_0x94af('0x19')](_0x4b1fc8);}};}function respondWithFilteredResult(_0x50aed9,_0xc4dcd7){return function(_0x483c40){if(_0x483c40){var _0x26874d=typeof _0xc4dcd7[_0x94af('0x1a')]===_0x94af('0x1b')&&typeof _0xc4dcd7[_0x94af('0x1c')]===_0x94af('0x1b');var _0x27102c=_0x483c40[_0x94af('0x1d')];var _0x13d016=_0x26874d?0x0:_0xc4dcd7[_0x94af('0x1a')];var _0x37c264=_0x26874d?_0x483c40[_0x94af('0x1d')]:_0xc4dcd7[_0x94af('0x1a')]+_0xc4dcd7[_0x94af('0x1c')];var _0x414799;if(_0x37c264>=_0x27102c){_0x37c264=_0x27102c;_0x414799=0xc8;}else{_0x414799=0xce;}_0x50aed9['status'](_0x414799);return _0x50aed9[_0x94af('0x1e')](_0x94af('0x1f'),_0x13d016+'-'+_0x37c264+'/'+_0x27102c)[_0x94af('0x19')](_0x483c40);}return null;};}function patchUpdates(_0x451f83){return function(_0x3fb549){try{jsonpatch[_0x94af('0x20')](_0x3fb549,_0x451f83,!![]);}catch(_0x3e4317){return BPromise[_0x94af('0x21')](_0x3e4317);}return _0x3fb549['save']();};}function saveUpdates(_0x508702,_0x153a87){return function(_0x14ee40){if(_0x14ee40){return _0x14ee40[_0x94af('0x22')](_0x508702)['then'](function(_0x234a53){return _0x234a53;});}return null;};}function removeEntity(_0x24b695,_0x1cda1d){return function(_0x56800f){if(_0x56800f){return _0x56800f[_0x94af('0x23')]()[_0x94af('0x24')](function(){_0x24b695[_0x94af('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0600,_0xfefaaa){return function(_0x15c7bb){if(!_0x15c7bb){_0x4e0600[_0x94af('0x16')](0x194);}return _0x15c7bb;};}function handleError(_0x39853c,_0x723f5a){_0x723f5a=_0x723f5a||0x1f4;return function(_0x3c7a66){logger[_0x94af('0x25')](_0x3c7a66[_0x94af('0x26')]);if(_0x3c7a66[_0x94af('0x27')]){delete _0x3c7a66[_0x94af('0x27')];}_0x39853c[_0x94af('0x17')](_0x723f5a)['send'](_0x3c7a66);};}exports['index']=function(_0x1af544,_0x143d18){var _0x26ad09={},_0x5698d6={},_0x20e0ab={'count':0x0,'rows':[]};var _0x4b540a=_[_0x94af('0x28')](db[_0x94af('0x29')]['rawAttributes'],function(_0x385832){return{'name':_0x385832[_0x94af('0x2a')],'type':_0x385832[_0x94af('0x2b')][_0x94af('0x2c')]};});_0x5698d6[_0x94af('0x2d')]=_[_0x94af('0x28')](_0x4b540a,_0x94af('0x27'));_0x5698d6[_0x94af('0x2e')]=_[_0x94af('0x2f')](_0x1af544[_0x94af('0x2e')]);_0x5698d6['filters']=_[_0x94af('0x30')](_0x5698d6[_0x94af('0x2d')],_0x5698d6[_0x94af('0x2e')]);_0x26ad09[_0x94af('0x31')]=_[_0x94af('0x30')](_0x5698d6['model'],qs['fields'](_0x1af544[_0x94af('0x2e')]['fields']));_0x26ad09[_0x94af('0x31')]=_0x26ad09[_0x94af('0x31')]['length']?_0x26ad09['attributes']:_0x5698d6[_0x94af('0x2d')];if(!_0x1af544[_0x94af('0x2e')][_0x94af('0x32')]('nolimit')){_0x26ad09[_0x94af('0x1c')]=qs[_0x94af('0x1c')](_0x1af544[_0x94af('0x2e')][_0x94af('0x1c')]);_0x26ad09[_0x94af('0x1a')]=qs[_0x94af('0x1a')](_0x1af544['query'][_0x94af('0x1a')]);}_0x26ad09[_0x94af('0x33')]=qs[_0x94af('0x34')](_0x1af544[_0x94af('0x2e')][_0x94af('0x34')]);_0x26ad09['where']=qs['filters'](_[_0x94af('0x35')](_0x1af544[_0x94af('0x2e')],_0x5698d6[_0x94af('0x36')]),_0x4b540a);if(_0x1af544[_0x94af('0x2e')][_0x94af('0x37')]){_0x26ad09[_0x94af('0x38')]=_['merge'](_0x26ad09['where'],{'$or':_[_0x94af('0x28')](_0x4b540a,function(_0x3f515d){if(_0x3f515d[_0x94af('0x2b')]!==_0x94af('0x39')){var _0x1be40b={};_0x1be40b[_0x3f515d['name']]={'$like':'%'+_0x1af544['query'][_0x94af('0x37')]+'%'};return _0x1be40b;}})});}_0x26ad09=_[_0x94af('0x3a')]({},_0x26ad09,_0x1af544[_0x94af('0x3b')]);var _0x26dc08={'where':_0x26ad09[_0x94af('0x38')]};return db[_0x94af('0x29')][_0x94af('0x1d')](_0x26dc08)['then'](function(_0x5bf222){_0x20e0ab[_0x94af('0x1d')]=_0x5bf222;if(_0x1af544[_0x94af('0x2e')][_0x94af('0x3c')]){_0x26ad09[_0x94af('0x3d')]=[{'all':!![]}];}return db[_0x94af('0x29')][_0x94af('0x3e')](_0x26ad09);})[_0x94af('0x24')](function(_0x4426fc){_0x20e0ab[_0x94af('0x3f')]=_0x4426fc;return _0x20e0ab;})[_0x94af('0x24')](respondWithFilteredResult(_0x143d18,_0x26ad09))[_0x94af('0x40')](handleError(_0x143d18,null));};exports['show']=function(_0x44d404,_0x4b08b3){var _0x2317c0={'raw':!![],'where':{'id':_0x44d404['params']['id']}},_0x50ad66={};_0x50ad66[_0x94af('0x2d')]=_[_0x94af('0x2f')](db[_0x94af('0x29')][_0x94af('0x41')]);_0x50ad66['query']=_['keys'](_0x44d404[_0x94af('0x2e')]);_0x50ad66[_0x94af('0x36')]=_[_0x94af('0x30')](_0x50ad66[_0x94af('0x2d')],_0x50ad66[_0x94af('0x2e')]);_0x2317c0[_0x94af('0x31')]=_[_0x94af('0x30')](_0x50ad66[_0x94af('0x2d')],qs[_0x94af('0x42')](_0x44d404[_0x94af('0x2e')][_0x94af('0x42')]));_0x2317c0[_0x94af('0x31')]=_0x2317c0[_0x94af('0x31')][_0x94af('0x43')]?_0x2317c0[_0x94af('0x31')]:_0x50ad66[_0x94af('0x2d')];if(_0x44d404[_0x94af('0x2e')][_0x94af('0x3c')]){_0x2317c0[_0x94af('0x3d')]=[{'all':!![]}];}_0x2317c0=_[_0x94af('0x3a')]({},_0x2317c0,_0x44d404[_0x94af('0x3b')]);return db[_0x94af('0x29')]['find'](_0x2317c0)['then'](handleEntityNotFound(_0x4b08b3,null))[_0x94af('0x24')](respondWithResult(_0x4b08b3,null))['catch'](handleError(_0x4b08b3,null));};exports[_0x94af('0x44')]=function(_0x2aa98d,_0x3c9a7c){return db[_0x94af('0x29')][_0x94af('0x44')](_0x2aa98d['body'],{})[_0x94af('0x24')](respondWithResult(_0x3c9a7c,0xc9))[_0x94af('0x40')](handleError(_0x3c9a7c,null));};exports[_0x94af('0x22')]=function(_0x4d94c3,_0x3db1e6){if(_0x4d94c3[_0x94af('0x45')]['id']){delete _0x4d94c3['body']['id'];}return db[_0x94af('0x29')][_0x94af('0x46')]({'where':{'id':_0x4d94c3['params']['id']}})[_0x94af('0x24')](handleEntityNotFound(_0x3db1e6,null))[_0x94af('0x24')](saveUpdates(_0x4d94c3['body'],null))['then'](respondWithResult(_0x3db1e6,null))['catch'](handleError(_0x3db1e6,null));};exports['destroy']=function(_0x5a83fd,_0x4eeb08){return db[_0x94af('0x29')][_0x94af('0x46')]({'where':{'id':_0x5a83fd['params']['id']}})['then'](handleEntityNotFound(_0x4eeb08,null))[_0x94af('0x24')](removeEntity(_0x4eeb08,null))[_0x94af('0x40')](handleError(_0x4eeb08,null));};exports[_0x94af('0x47')]=function(_0x120cde,_0x5c1fd7){return db[_0x94af('0x29')][_0x94af('0x47')]()[_0x94af('0x24')](respondWithResult(_0x5c1fd7,null))[_0x94af('0x40')](handleError(_0x5c1fd7,null));}; \ No newline at end of file +var _0x1296=['where','pick','merge','filter','options','includeAll','include','findAll','params','catch','create','body','destroy','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1296,0x1e3));var _0x6129=function(_0x1a1d9f,_0x2f7fad){_0x1a1d9f=_0x1a1d9f-0x0;var _0x721881=_0x1296[_0x1a1d9f];return _0x721881;};'use strict';var emlformat=require(_0x6129('0x0'));var rimraf=require(_0x6129('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6129('0x2'));var moment=require('moment');var BPromise=require(_0x6129('0x3'));var Mustache=require(_0x6129('0x4'));var util=require(_0x6129('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6129('0x6'));var ejs=require(_0x6129('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6129('0x8'));var squel=require(_0x6129('0x9'));var crypto=require('crypto');var jsforce=require(_0x6129('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6129('0xb'));var Papa=require('papaparse');var Redis=require(_0x6129('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6129('0xd'));var as=require(_0x6129('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6129('0xf'));var config=require(_0x6129('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x6129('0x11'))['db'];function respondWithStatusCode(_0x481cb6,_0x497c0a){_0x497c0a=_0x497c0a||0xcc;return function(_0x34c49f){if(_0x34c49f){return _0x481cb6[_0x6129('0x12')](_0x497c0a);}return _0x481cb6[_0x6129('0x13')](_0x497c0a)['end']();};}function respondWithResult(_0x1269bd,_0x443db0){_0x443db0=_0x443db0||0xc8;return function(_0x2f3180){if(_0x2f3180){return _0x1269bd[_0x6129('0x13')](_0x443db0)['json'](_0x2f3180);}};}function respondWithFilteredResult(_0x103f12,_0x3059c9){return function(_0x168519){if(_0x168519){var _0xb0b3cf=typeof _0x3059c9[_0x6129('0x14')]===_0x6129('0x15')&&typeof _0x3059c9[_0x6129('0x16')]===_0x6129('0x15');var _0x34f6a2=_0x168519[_0x6129('0x17')];var _0x486eef=_0xb0b3cf?0x0:_0x3059c9['offset'];var _0x2f4d5c=_0xb0b3cf?_0x168519[_0x6129('0x17')]:_0x3059c9[_0x6129('0x14')]+_0x3059c9[_0x6129('0x16')];var _0x504313;if(_0x2f4d5c>=_0x34f6a2){_0x2f4d5c=_0x34f6a2;_0x504313=0xc8;}else{_0x504313=0xce;}_0x103f12[_0x6129('0x13')](_0x504313);return _0x103f12[_0x6129('0x18')](_0x6129('0x19'),_0x486eef+'-'+_0x2f4d5c+'/'+_0x34f6a2)[_0x6129('0x1a')](_0x168519);}return null;};}function patchUpdates(_0x5b1755){return function(_0x4f3514){try{jsonpatch[_0x6129('0x1b')](_0x4f3514,_0x5b1755,!![]);}catch(_0x4e3f77){return BPromise[_0x6129('0x1c')](_0x4e3f77);}return _0x4f3514[_0x6129('0x1d')]();};}function saveUpdates(_0x3eaefd,_0x18c6f0){return function(_0x3b5ff3){if(_0x3b5ff3){return _0x3b5ff3[_0x6129('0x1e')](_0x3eaefd)[_0x6129('0x1f')](function(_0x5ad990){return _0x5ad990;});}return null;};}function removeEntity(_0x5e9b0b,_0x53ebe8){return function(_0x716df7){if(_0x716df7){return _0x716df7['destroy']()[_0x6129('0x1f')](function(){_0x5e9b0b[_0x6129('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c7b7d,_0x5b06a3){return function(_0x48b007){if(!_0x48b007){_0x3c7b7d[_0x6129('0x12')](0x194);}return _0x48b007;};}function handleError(_0x1bea5a,_0x533a52){_0x533a52=_0x533a52||0x1f4;return function(_0x57f09b){logger[_0x6129('0x20')](_0x57f09b['stack']);if(_0x57f09b[_0x6129('0x21')]){delete _0x57f09b['name'];}_0x1bea5a['status'](_0x533a52)[_0x6129('0x22')](_0x57f09b);};}exports[_0x6129('0x23')]=function(_0x4f85d0,_0x3fd9c9){var _0x55afed={},_0x27f830={},_0x1efdc3={'count':0x0,'rows':[]};var _0x50b0e0=_[_0x6129('0x24')](db[_0x6129('0x25')][_0x6129('0x26')],function(_0x56c9d6){return{'name':_0x56c9d6[_0x6129('0x27')],'type':_0x56c9d6[_0x6129('0x28')][_0x6129('0x29')]};});_0x27f830[_0x6129('0x2a')]=_[_0x6129('0x24')](_0x50b0e0,_0x6129('0x21'));_0x27f830[_0x6129('0x2b')]=_[_0x6129('0x2c')](_0x4f85d0[_0x6129('0x2b')]);_0x27f830[_0x6129('0x2d')]=_[_0x6129('0x2e')](_0x27f830[_0x6129('0x2a')],_0x27f830[_0x6129('0x2b')]);_0x55afed[_0x6129('0x2f')]=_['intersection'](_0x27f830[_0x6129('0x2a')],qs[_0x6129('0x30')](_0x4f85d0[_0x6129('0x2b')][_0x6129('0x30')]));_0x55afed[_0x6129('0x2f')]=_0x55afed[_0x6129('0x2f')][_0x6129('0x31')]?_0x55afed[_0x6129('0x2f')]:_0x27f830[_0x6129('0x2a')];if(!_0x4f85d0[_0x6129('0x2b')]['hasOwnProperty'](_0x6129('0x32'))){_0x55afed[_0x6129('0x16')]=qs[_0x6129('0x16')](_0x4f85d0[_0x6129('0x2b')][_0x6129('0x16')]);_0x55afed[_0x6129('0x14')]=qs['offset'](_0x4f85d0['query'][_0x6129('0x14')]);}_0x55afed[_0x6129('0x33')]=qs[_0x6129('0x34')](_0x4f85d0[_0x6129('0x2b')][_0x6129('0x34')]);_0x55afed[_0x6129('0x35')]=qs['filters'](_[_0x6129('0x36')](_0x4f85d0[_0x6129('0x2b')],_0x27f830[_0x6129('0x2d')]),_0x50b0e0);if(_0x4f85d0['query']['filter']){_0x55afed[_0x6129('0x35')]=_[_0x6129('0x37')](_0x55afed['where'],{'$or':_[_0x6129('0x24')](_0x50b0e0,function(_0x9f6c6e){if(_0x9f6c6e[_0x6129('0x28')]!=='VIRTUAL'){var _0x256003={};_0x256003[_0x9f6c6e[_0x6129('0x21')]]={'$like':'%'+_0x4f85d0[_0x6129('0x2b')][_0x6129('0x38')]+'%'};return _0x256003;}})});}_0x55afed=_[_0x6129('0x37')]({},_0x55afed,_0x4f85d0[_0x6129('0x39')]);var _0x2d9bcc={'where':_0x55afed['where']};return db[_0x6129('0x25')][_0x6129('0x17')](_0x2d9bcc)[_0x6129('0x1f')](function(_0x5d9c80){_0x1efdc3[_0x6129('0x17')]=_0x5d9c80;if(_0x4f85d0[_0x6129('0x2b')][_0x6129('0x3a')]){_0x55afed[_0x6129('0x3b')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x6129('0x3c')](_0x55afed);})[_0x6129('0x1f')](function(_0x4f1ea0){_0x1efdc3['rows']=_0x4f1ea0;return _0x1efdc3;})['then'](respondWithFilteredResult(_0x3fd9c9,_0x55afed))['catch'](handleError(_0x3fd9c9,null));};exports['show']=function(_0x45af25,_0x1c4135){var _0x5c3fbd={'raw':!![],'where':{'id':_0x45af25[_0x6129('0x3d')]['id']}},_0x14bcba={};_0x14bcba['model']=_[_0x6129('0x2c')](db[_0x6129('0x25')][_0x6129('0x26')]);_0x14bcba[_0x6129('0x2b')]=_['keys'](_0x45af25[_0x6129('0x2b')]);_0x14bcba[_0x6129('0x2d')]=_[_0x6129('0x2e')](_0x14bcba[_0x6129('0x2a')],_0x14bcba[_0x6129('0x2b')]);_0x5c3fbd['attributes']=_[_0x6129('0x2e')](_0x14bcba[_0x6129('0x2a')],qs['fields'](_0x45af25[_0x6129('0x2b')]['fields']));_0x5c3fbd['attributes']=_0x5c3fbd[_0x6129('0x2f')]['length']?_0x5c3fbd[_0x6129('0x2f')]:_0x14bcba[_0x6129('0x2a')];if(_0x45af25[_0x6129('0x2b')][_0x6129('0x3a')]){_0x5c3fbd[_0x6129('0x3b')]=[{'all':!![]}];}_0x5c3fbd=_[_0x6129('0x37')]({},_0x5c3fbd,_0x45af25[_0x6129('0x39')]);return db[_0x6129('0x25')]['find'](_0x5c3fbd)['then'](handleEntityNotFound(_0x1c4135,null))['then'](respondWithResult(_0x1c4135,null))[_0x6129('0x3e')](handleError(_0x1c4135,null));};exports[_0x6129('0x3f')]=function(_0x13e64b,_0x2ea0e7){return db[_0x6129('0x25')][_0x6129('0x3f')](_0x13e64b[_0x6129('0x40')],{})[_0x6129('0x1f')](respondWithResult(_0x2ea0e7,0xc9))[_0x6129('0x3e')](handleError(_0x2ea0e7,null));};exports[_0x6129('0x1e')]=function(_0x2c07bb,_0x3579b0){if(_0x2c07bb[_0x6129('0x40')]['id']){delete _0x2c07bb[_0x6129('0x40')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x2c07bb[_0x6129('0x3d')]['id']}})[_0x6129('0x1f')](handleEntityNotFound(_0x3579b0,null))['then'](saveUpdates(_0x2c07bb[_0x6129('0x40')],null))['then'](respondWithResult(_0x3579b0,null))[_0x6129('0x3e')](handleError(_0x3579b0,null));};exports[_0x6129('0x41')]=function(_0x282150,_0xe1c348){return db[_0x6129('0x25')]['find']({'where':{'id':_0x282150[_0x6129('0x3d')]['id']}})[_0x6129('0x1f')](handleEntityNotFound(_0xe1c348,null))[_0x6129('0x1f')](removeEntity(_0xe1c348,null))[_0x6129('0x3e')](handleError(_0xe1c348,null));};exports[_0x6129('0x42')]=function(_0x50993a,_0x3a3e95){return db['SquareDetailsReport'][_0x6129('0x42')]()[_0x6129('0x1f')](respondWithResult(_0x3a3e95,null))[_0x6129('0x3e')](handleError(_0x3a3e95,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 6fb0214..d574cc3 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 _0x7905=['path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment','request-promise'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x7905,0x1e9));var _0x5790=function(_0x13ba89,_0x42fb58){_0x13ba89=_0x13ba89-0x0;var _0x56b6a5=_0x7905[_0x13ba89];return _0x56b6a5;};'use strict';var _=require('lodash');var util=require(_0x5790('0x0'));var logger=require(_0x5790('0x1'))(_0x5790('0x2'));var moment=require(_0x5790('0x3'));var BPromise=require('bluebird');var rp=require(_0x5790('0x4'));var fs=require('fs');var path=require(_0x5790('0x5'));var rimraf=require(_0x5790('0x6'));var config=require(_0x5790('0x7'));var attributes=require(_0x5790('0x8'));module[_0x5790('0x9')]=function(_0x401b5b,_0x11749d){return _0x401b5b[_0x5790('0xa')](_0x5790('0xb'),attributes,{'tableName':_0x5790('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d5d=['exports','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d5d,0xc2));var _0xd3d5=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x3d5d[_0x2962d5];return _0x273406;};'use strict';var _=require(_0xd3d5('0x0'));var util=require(_0xd3d5('0x1'));var logger=require(_0xd3d5('0x2'))(_0xd3d5('0x3'));var moment=require(_0xd3d5('0x4'));var BPromise=require(_0xd3d5('0x5'));var rp=require(_0xd3d5('0x6'));var fs=require('fs');var path=require(_0xd3d5('0x7'));var rimraf=require('rimraf');var config=require(_0xd3d5('0x8'));var attributes=require(_0xd3d5('0x9'));module[_0xd3d5('0xa')]=function(_0x314161,_0x125482){return _0x314161['define']('SquareDetailsReport',attributes,{'tableName':_0xd3d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 765032c..5d810c2 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 _0x1775=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4642c5,_0x13623d){var _0x36a8ac=function(_0x4dd22a){while(--_0x4dd22a){_0x4642c5['push'](_0x4642c5['shift']());}};_0x36a8ac(++_0x13623d);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['create'](_0x1b4102[_0x5177('0x1c')],{'raw':_0x1b4102['options']?_0x1b4102[_0x5177('0x1d')][_0x5177('0x1e')]===undefined?!![]:![]:!![]})[_0x5177('0xe')](function(_0x27b732){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON[_0x5177('0x13')](_0x27b732));_0x3e6944(_0x27b732);})[_0x5177('0x19')](function(_0x23dad2){logger[_0x5177('0x14')]('CreateSquareDetailsReport',_0x23dad2[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4['error'](0x1f4,_0x23dad2[_0x5177('0x17')]));});});}; \ No newline at end of file +var _0x087b=['debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','create','body','options','CreateSquareDetailsReport','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x1dd907,_0x49e59f){var _0x33c1ef=function(_0x35db3b){while(--_0x35db3b){_0x1dd907['push'](_0x1dd907['shift']());}};_0x33c1ef(++_0x49e59f);}(_0x087b,0x11a));var _0xb087=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x087b[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['CreateSquareDetailsReport']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['SquareDetailsReport'][_0xb087('0x16')](_0x330005[_0xb087('0x17')],{'raw':_0x330005[_0xb087('0x18')]?_0x330005[_0xb087('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5ea3dc){logger['info'](_0xb087('0x19'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x19'),_0x330005,JSON[_0xb087('0x11')](_0x5ea3dc));_0x17200d(_0x5ea3dc);})[_0xb087('0x1a')](function(_0x258b4c){logger[_0xb087('0x12')]('CreateSquareDetailsReport',_0x258b4c[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x258b4c[_0xb087('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 62fa7d0..eae0c22 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 _0x2876=['get','isAuthenticated','index','killProcess','exports','../../components/auth/service','./system.controller'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2876,0x178));var _0x6287=function(_0x1abafe,_0x572047){_0x1abafe=_0x1abafe-0x0;var _0x4fae5a=_0x2876[_0x1abafe];return _0x4fae5a;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x6287('0x0'));var controller=require(_0x6287('0x1'));router[_0x6287('0x2')]('/',auth[_0x6287('0x3')](),controller[_0x6287('0x4')]);router[_0x6287('0x2')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x6287('0x5')]);module[_0x6287('0x6')]=router; \ No newline at end of file +var _0xdff9=['index','exports','express','Router','./system.controller','get','isAuthenticated'];(function(_0x2510b3,_0x78ca81){var _0xfbe433=function(_0x1bd044){while(--_0x1bd044){_0x2510b3['push'](_0x2510b3['shift']());}};_0xfbe433(++_0x78ca81);}(_0xdff9,0xfe));var _0x9dff=function(_0x7c95e1,_0x373a2d){_0x7c95e1=_0x7c95e1-0x0;var _0x42819d=_0xdff9[_0x7c95e1];return _0x42819d;};'use strict';var express=require(_0x9dff('0x0'));var router=express[_0x9dff('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9dff('0x2'));router[_0x9dff('0x3')]('/',auth[_0x9dff('0x4')](),controller[_0x9dff('0x5')]);router[_0x9dff('0x3')]('/process/:pid/kill',auth['isAuthenticated'](),controller['killProcess']);module[_0x9dff('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 9d3baaf..710fe3f 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 _0x112c=['json','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','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','catch'];(function(_0x1f2f86,_0x57341c){var _0x43a6b3=function(_0x30430b){while(--_0x30430b){_0x1f2f86['push'](_0x1f2f86['shift']());}};_0x43a6b3(++_0x57341c);}(_0x112c,0x1dd));var _0xc112=function(_0x1c9152,_0x23ddfe){_0x1c9152=_0x1c9152-0x0;var _0x329d68=_0x112c[_0x1c9152];return _0x329d68;};'use strict';var info=require(_0xc112('0x0'));var exec=require(_0xc112('0x1'))[_0xc112('0x2')];var logger=require(_0xc112('0x3'))(_0xc112('0x4'));var util=require('util');var BPromise=require(_0xc112('0x5'));var _=require(_0xc112('0x6'));function handleError(_0x26bc67,_0x4a80c7,_0x51b26a){_0x4a80c7=_0x4a80c7||0x1f4;return function(_0xc2d975){logger[_0xc112('0x7')](_0xc112('0x8'),_0x51b26a,_0x4a80c7,util[_0xc112('0x9')](_0xc2d975,{'showHidden':![],'depth':null}));delete _0xc2d975[_0xc112('0xa')];_0x26bc67[_0xc112('0xb')](_0x4a80c7)[_0xc112('0xc')](_0xc2d975);};}exports[_0xc112('0xd')]=function(_0x356676,_0x3adaa9){return info['getAllData']()[_0xc112('0xe')](function(_0x2413b1){return _0x3adaa9[_0xc112('0xb')](0xc8)['json'](_0x2413b1);})[_0xc112('0xf')](function(_0x4c9255){return _0x3adaa9[_0xc112('0xb')](0x1f4)[_0xc112('0x10')](_0x4c9255);});};exports[_0xc112('0x11')]=function(_0x595e1c,_0xafc632){var _0x54b359=[_0xc112('0x12')];return new BPromise(function(_0x6bb028,_0x2aa00a){return exec(util[_0xc112('0x13')](_0xc112('0x14'),_0x595e1c[_0xc112('0x15')][_0xc112('0x16')]),function(_0x1f7f02,_0x25434f,_0x27f7e8){if(_0x1f7f02){return _0x2aa00a(_0x1f7f02);}return _0x6bb028(_0x25434f);});})[_0xc112('0xe')](function(_0x3aebd9){var _0x3fb196=![];var _0x13561a=_0x3aebd9[_0xc112('0x17')](/\n/);for(var _0x445deb=0x0,_0x4b54e4=_0x54b359[_0xc112('0x18')];_0x445deb<_0x4b54e4,_0x3fb196===![];_0x445deb+=0x1){if(_0x3aebd9[_0xc112('0x19')](_0x54b359[_0x445deb])>=0x0){_0x3fb196=!![];}}if(!_0x3fb196){throw new Error(util[_0xc112('0x13')](_0xc112('0x1a'),_0x595e1c[_0xc112('0x15')][_0xc112('0x16')]));}process[_0xc112('0x1b')](_0x595e1c[_0xc112('0x15')][_0xc112('0x16')],'SIGINT');return _0xafc632[_0xc112('0xb')](0xc8)[_0xc112('0x10')]({'message':util[_0xc112('0x13')](_0xc112('0x1c'),_0x595e1c[_0xc112('0x15')][_0xc112('0x16')])});})[_0xc112('0xf')](handleError(_0xafc632,null,'killProcess'));}; \ No newline at end of file +var _0xc77d=['kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process','exec','../../config/logger','api','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x3bed36,_0x3f8554){var _0x49d3a1=function(_0x1d6172){while(--_0x1d6172){_0x3bed36['push'](_0x3bed36['shift']());}};_0x49d3a1(++_0x3f8554);}(_0xc77d,0x161));var _0xdc77=function(_0x4b6bee,_0x23f984){_0x4b6bee=_0x4b6bee-0x0;var _0x167259=_0xc77d[_0x4b6bee];return _0x167259;};'use strict';var info=require('systeminformation');var exec=require(_0xdc77('0x0'))[_0xdc77('0x1')];var logger=require(_0xdc77('0x2'))(_0xdc77('0x3'));var util=require('util');var BPromise=require(_0xdc77('0x4'));var _=require('lodash');function handleError(_0x55a630,_0x433554,_0x57168d){_0x433554=_0x433554||0x1f4;return function(_0x26865a){logger['error'](_0xdc77('0x5'),_0x57168d,_0x433554,util[_0xdc77('0x6')](_0x26865a,{'showHidden':![],'depth':null}));delete _0x26865a[_0xdc77('0x7')];_0x55a630[_0xdc77('0x8')](_0x433554)[_0xdc77('0x9')](_0x26865a);};}exports[_0xdc77('0xa')]=function(_0x33875a,_0x4d65eb){return info[_0xdc77('0xb')]()[_0xdc77('0xc')](function(_0x10a5c9){return _0x4d65eb['status'](0xc8)[_0xdc77('0xd')](_0x10a5c9);})[_0xdc77('0xe')](function(_0x48d0a5){return _0x4d65eb[_0xdc77('0x8')](0x1f4)[_0xdc77('0xd')](_0x48d0a5);});};exports['killProcess']=function(_0x4b9978,_0x6e8491){var _0x4c9b96=[_0xdc77('0xf')];return new BPromise(function(_0x270c3a,_0x44d745){return exec(util[_0xdc77('0x10')](_0xdc77('0x11'),_0x4b9978[_0xdc77('0x12')][_0xdc77('0x13')]),function(_0x3e99bb,_0xcab816,_0x5d26d8){if(_0x3e99bb){return _0x44d745(_0x3e99bb);}return _0x270c3a(_0xcab816);});})[_0xdc77('0xc')](function(_0xaaa48){var _0x33f76a=![];var _0x3e9657=_0xaaa48['split'](/\n/);for(var _0x53696c=0x0,_0x474652=_0x4c9b96[_0xdc77('0x14')];_0x53696c<_0x474652,_0x33f76a===![];_0x53696c+=0x1){if(_0xaaa48['indexOf'](_0x4c9b96[_0x53696c])>=0x0){_0x33f76a=!![];}}if(!_0x33f76a){throw new Error(util[_0xdc77('0x10')](_0xdc77('0x15'),_0x4b9978[_0xdc77('0x12')]['pid']));}process[_0xdc77('0x16')](_0x4b9978[_0xdc77('0x12')][_0xdc77('0x13')],'SIGINT');return _0x6e8491[_0xdc77('0x8')](0xc8)[_0xdc77('0xd')]({'message':util[_0xdc77('0x10')](_0xdc77('0x17'),_0x4b9978['params'][_0xdc77('0x13')])});})[_0xdc77('0xe')](handleError(_0x6e8491,null,_0xdc77('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b053257..0c5cba1 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 _0xb43b=['../../components/interaction/service','../../config/environment','./tag.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3b4d69,_0x135805){var _0x15805d=function(_0x5a59f9){while(--_0x5a59f9){_0x3b4d69['push'](_0x3b4d69['shift']());}};_0x15805d(++_0x135805);}(_0xb43b,0x1b2));var _0xbb43=function(_0x383e28,_0x4169f1){_0x383e28=_0x383e28-0x0;var _0x560161=_0xb43b[_0x383e28];return _0x560161;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0x10')]('/',auth['isAuthenticated'](),controller[_0xbb43('0x11')]);router[_0xbb43('0x12')](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller[_0xbb43('0x13')]);router[_0xbb43('0x14')]('/:id',auth[_0xbb43('0xb')](),controller[_0xbb43('0x15')]);module['exports']=router; \ No newline at end of file +var _0xac31=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','post','create','put','/:id'];(function(_0x2ec353,_0x2c9a8b){var _0x1aa886=function(_0x16adef){while(--_0x16adef){_0x2ec353['push'](_0x2ec353['shift']());}};_0x1aa886(++_0x2c9a8b);}(_0xac31,0xca));var _0x1ac3=function(_0x2db9c4,_0xd295d7){_0x2db9c4=_0x2db9c4-0x0;var _0x3b520b=_0xac31[_0x2db9c4];return _0x3b520b;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var fs_extra=require(_0x1ac3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var controller=require('./tag.controller');router['get']('/',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xa')]);router[_0x1ac3('0xb')](_0x1ac3('0xc'),auth[_0x1ac3('0x9')](),controller['describe']);router[_0x1ac3('0xb')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xd')]);router[_0x1ac3('0xe')]('/',auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0x10')](_0x1ac3('0x11'),auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x12')]);router[_0x1ac3('0x13')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x14')]);module[_0x1ac3('0x15')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 6a7abef..3c560ae 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 _0x7fee=['name','#0091EA','sequelize','exports','STRING'];(function(_0x342981,_0xffb36b){var _0x321b9b=function(_0x189149){while(--_0x189149){_0x342981['push'](_0x342981['shift']());}};_0x321b9b(++_0xffb36b);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x7fee[_0x2dd390];return _0x3afe47;};'use strict';var Sequelize=require(_0xe7fe('0x0'));module[_0xe7fe('0x1')]={'name':{'type':Sequelize[_0xe7fe('0x2')],'unique':_0xe7fe('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe7fe('0x2')],'defaultValue':_0xe7fe('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2ec8=['name','#0091EA','sequelize','exports','STRING'];(function(_0x30b871,_0x163cc0){var _0x1539ca=function(_0x4689d7){while(--_0x4689d7){_0x30b871['push'](_0x30b871['shift']());}};_0x1539ca(++_0x163cc0);}(_0x2ec8,0x188));var _0x82ec=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2ec8[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x82ec('0x0'));module[_0x82ec('0x1')]={'name':{'type':Sequelize[_0x82ec('0x2')],'unique':_0x82ec('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x82ec('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 21186c9..3c5ce3f 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 _0xc359=['fast-json-patch','request-promise','moment','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rimraf'];(function(_0x21460b,_0x4169a3){var _0x134923=function(_0x3eb761){while(--_0x3eb761){_0x21460b['push'](_0x21460b['shift']());}};_0x134923(++_0x4169a3);}(_0xc359,0x1d9));var _0x9c35=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xc359[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c35('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c35('0x1'));var rp=require(_0x9c35('0x2'));var moment=require(_0x9c35('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9c35('0x4'));var util=require('util');var path=require(_0x9c35('0x5'));var sox=require('sox');var csv=require(_0x9c35('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c35('0x7'));var jsforce=require(_0x9c35('0x8'));var deskjs=require(_0x9c35('0x9'));var toCsv=require(_0x9c35('0x6'));var querystring=require(_0x9c35('0xa'));var Papa=require(_0x9c35('0xb'));var Redis=require('ioredis');var authService=require(_0x9c35('0xc'));var qs=require(_0x9c35('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c35('0xe'));var utils=require('../../config/utils');var config=require(_0x9c35('0xf'));var licenseUtil=require(_0x9c35('0x10'));var db=require(_0x9c35('0x11'))['db'];function respondWithStatusCode(_0x575589,_0x24210f){_0x24210f=_0x24210f||0xcc;return function(_0x7dd8f){if(_0x7dd8f){return _0x575589[_0x9c35('0x12')](_0x24210f);}return _0x575589[_0x9c35('0x13')](_0x24210f)[_0x9c35('0x14')]();};}function respondWithResult(_0x4cc2ca,_0x280758){_0x280758=_0x280758||0xc8;return function(_0x4470df){if(_0x4470df){return _0x4cc2ca[_0x9c35('0x13')](_0x280758)[_0x9c35('0x15')](_0x4470df);}};}function respondWithFilteredResult(_0x2af21e,_0x308392){return function(_0x9e7d2d){if(_0x9e7d2d){var _0x77588e=typeof _0x308392[_0x9c35('0x16')]===_0x9c35('0x17')&&typeof _0x308392[_0x9c35('0x18')]===_0x9c35('0x17');var _0x1ef1d8=_0x9e7d2d[_0x9c35('0x19')];var _0x26db4b=_0x77588e?0x0:_0x308392['offset'];var _0x1d0227=_0x77588e?_0x9e7d2d[_0x9c35('0x19')]:_0x308392[_0x9c35('0x16')]+_0x308392[_0x9c35('0x18')];var _0x4d606f;if(_0x1d0227>=_0x1ef1d8){_0x1d0227=_0x1ef1d8;_0x4d606f=0xc8;}else{_0x4d606f=0xce;}_0x2af21e[_0x9c35('0x13')](_0x4d606f);return _0x2af21e[_0x9c35('0x1a')](_0x9c35('0x1b'),_0x26db4b+'-'+_0x1d0227+'/'+_0x1ef1d8)[_0x9c35('0x15')](_0x9e7d2d);}return null;};}function patchUpdates(_0x69d118){return function(_0x4a84dd){try{jsonpatch[_0x9c35('0x1c')](_0x4a84dd,_0x69d118,!![]);}catch(_0x57ef15){return BPromise[_0x9c35('0x1d')](_0x57ef15);}return _0x4a84dd[_0x9c35('0x1e')]();};}function saveUpdates(_0x29f569,_0x8ffae5){return function(_0x3d2193){if(_0x3d2193){return _0x3d2193[_0x9c35('0x1f')](_0x29f569)[_0x9c35('0x20')](function(_0x52aa95){return _0x52aa95;});}return null;};}function removeEntity(_0x572b46,_0x1bc7e4){return function(_0x2997d3){if(_0x2997d3){return _0x2997d3[_0x9c35('0x21')]()[_0x9c35('0x20')](function(){var _0x50a509=_0x2997d3[_0x9c35('0x22')]({'plain':!![]});var _0x578e00=_0x9c35('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x578e00,'resourceId':_0x50a509['id']}})[_0x9c35('0x20')](function(){return _0x2997d3;});})[_0x9c35('0x20')](function(){_0x572b46[_0x9c35('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bfdfd,_0x55cd82){return function(_0x16cc31){if(!_0x16cc31){_0x3bfdfd[_0x9c35('0x12')](0x194);}return _0x16cc31;};}function handleError(_0x462f00,_0x3b9cae){_0x3b9cae=_0x3b9cae||0x1f4;return function(_0x4525c9){logger['error'](_0x4525c9[_0x9c35('0x24')]);if(_0x4525c9[_0x9c35('0x25')]){delete _0x4525c9['name'];}_0x462f00[_0x9c35('0x13')](_0x3b9cae)[_0x9c35('0x26')](_0x4525c9);};}exports[_0x9c35('0x27')]=function(_0x45766e,_0x345fbc){var _0x4cb625={},_0x37379c={},_0xd9c6b3={'count':0x0,'rows':[]};var _0x2a7412=_[_0x9c35('0x28')](db[_0x9c35('0x29')][_0x9c35('0x2a')],function(_0x5b28c5){return{'name':_0x5b28c5[_0x9c35('0x2b')],'type':_0x5b28c5['type'][_0x9c35('0x2c')]};});_0x37379c[_0x9c35('0x2d')]=_[_0x9c35('0x28')](_0x2a7412,_0x9c35('0x25'));_0x37379c[_0x9c35('0x2e')]=_['keys'](_0x45766e[_0x9c35('0x2e')]);_0x37379c[_0x9c35('0x2f')]=_['intersection'](_0x37379c['model'],_0x37379c[_0x9c35('0x2e')]);_0x4cb625['attributes']=_['intersection'](_0x37379c['model'],qs[_0x9c35('0x30')](_0x45766e[_0x9c35('0x2e')][_0x9c35('0x30')]));_0x4cb625[_0x9c35('0x31')]=_0x4cb625[_0x9c35('0x31')][_0x9c35('0x32')]?_0x4cb625['attributes']:_0x37379c[_0x9c35('0x2d')];if(!_0x45766e[_0x9c35('0x2e')][_0x9c35('0x33')](_0x9c35('0x34'))){_0x4cb625['limit']=qs[_0x9c35('0x18')](_0x45766e[_0x9c35('0x2e')][_0x9c35('0x18')]);_0x4cb625[_0x9c35('0x16')]=qs[_0x9c35('0x16')](_0x45766e[_0x9c35('0x2e')][_0x9c35('0x16')]);}_0x4cb625['order']=qs['sort'](_0x45766e['query'][_0x9c35('0x35')]);_0x4cb625['where']=qs[_0x9c35('0x2f')](_['pick'](_0x45766e['query'],_0x37379c[_0x9c35('0x2f')]),_0x2a7412);if(_0x45766e[_0x9c35('0x2e')][_0x9c35('0x36')]){_0x4cb625[_0x9c35('0x37')]=_[_0x9c35('0x38')](_0x4cb625[_0x9c35('0x37')],{'$or':_[_0x9c35('0x28')](_0x2a7412,function(_0x4a2002){if(_0x4a2002[_0x9c35('0x39')]!=='VIRTUAL'){var _0x12b586={};_0x12b586[_0x4a2002['name']]={'$like':'%'+_0x45766e['query']['filter']+'%'};return _0x12b586;}})});}_0x4cb625=_['merge']({},_0x4cb625,_0x45766e[_0x9c35('0x3a')]);var _0x46fbdf={'where':_0x4cb625[_0x9c35('0x37')]};return db[_0x9c35('0x29')]['count'](_0x46fbdf)[_0x9c35('0x20')](function(_0xff952f){_0xd9c6b3[_0x9c35('0x19')]=_0xff952f;if(_0x45766e['query'][_0x9c35('0x3b')]){_0x4cb625[_0x9c35('0x3c')]=[{'all':!![]}];}return db[_0x9c35('0x29')][_0x9c35('0x3d')](_0x4cb625);})[_0x9c35('0x20')](function(_0x45d102){_0xd9c6b3[_0x9c35('0x3e')]=_0x45d102;return _0xd9c6b3;})[_0x9c35('0x20')](respondWithFilteredResult(_0x345fbc,_0x4cb625))[_0x9c35('0x3f')](handleError(_0x345fbc,null));};exports[_0x9c35('0x40')]=function(_0x282bbd,_0x5a735c){var _0x3c3bd3={'raw':!![],'where':{'id':_0x282bbd[_0x9c35('0x41')]['id']}},_0x1f8afe={};_0x1f8afe[_0x9c35('0x2d')]=_[_0x9c35('0x42')](db[_0x9c35('0x29')][_0x9c35('0x2a')]);_0x1f8afe[_0x9c35('0x2e')]=_[_0x9c35('0x42')](_0x282bbd[_0x9c35('0x2e')]);_0x1f8afe[_0x9c35('0x2f')]=_[_0x9c35('0x43')](_0x1f8afe[_0x9c35('0x2d')],_0x1f8afe[_0x9c35('0x2e')]);_0x3c3bd3[_0x9c35('0x31')]=_[_0x9c35('0x43')](_0x1f8afe[_0x9c35('0x2d')],qs[_0x9c35('0x30')](_0x282bbd[_0x9c35('0x2e')][_0x9c35('0x30')]));_0x3c3bd3[_0x9c35('0x31')]=_0x3c3bd3[_0x9c35('0x31')]['length']?_0x3c3bd3[_0x9c35('0x31')]:_0x1f8afe['model'];if(_0x282bbd[_0x9c35('0x2e')][_0x9c35('0x3b')]){_0x3c3bd3[_0x9c35('0x3c')]=[{'all':!![]}];}_0x3c3bd3=_['merge']({},_0x3c3bd3,_0x282bbd[_0x9c35('0x3a')]);return db[_0x9c35('0x29')][_0x9c35('0x44')](_0x3c3bd3)['then'](handleEntityNotFound(_0x5a735c,null))[_0x9c35('0x20')](respondWithResult(_0x5a735c,null))[_0x9c35('0x3f')](handleError(_0x5a735c,null));};exports['create']=function(_0x1972dc,_0x4d6833){return db[_0x9c35('0x29')][_0x9c35('0x45')](_0x1972dc[_0x9c35('0x46')],{})[_0x9c35('0x20')](function(_0x35bc77){var _0x26d7f7=_0x1972dc[_0x9c35('0x47')][_0x9c35('0x22')]({'plain':!![]});if(!_0x26d7f7)throw new Error(_0x9c35('0x48'));if(_0x26d7f7['role']===_0x9c35('0x47')){var _0x257d9c=_0x35bc77[_0x9c35('0x22')]({'plain':!![]});var _0x4cac6b='Tags';return db[_0x9c35('0x49')][_0x9c35('0x44')]({'where':{'name':_0x4cac6b,'userProfileId':_0x26d7f7['userProfileId']},'raw':!![]})[_0x9c35('0x20')](function(_0x2bd32c){if(_0x2bd32c&&_0x2bd32c[_0x9c35('0x4a')]===0x0){return db[_0x9c35('0x4b')][_0x9c35('0x45')]({'name':_0x257d9c[_0x9c35('0x25')],'resourceId':_0x257d9c['id'],'type':_0x2bd32c['name'],'sectionId':_0x2bd32c['id']},{})[_0x9c35('0x20')](function(){return _0x35bc77;});}else{return _0x35bc77;}})['catch'](function(_0x2a0633){logger[_0x9c35('0x4c')](_0x9c35('0x4d'),_0x2a0633);throw _0x2a0633;});}return _0x35bc77;})['then'](respondWithResult(_0x4d6833,0xc9))[_0x9c35('0x3f')](handleError(_0x4d6833,null));};exports[_0x9c35('0x1f')]=function(_0x451716,_0x438964){if(_0x451716[_0x9c35('0x46')]['id']){delete _0x451716[_0x9c35('0x46')]['id'];}return db['Tag']['find']({'where':{'id':_0x451716[_0x9c35('0x41')]['id']}})[_0x9c35('0x20')](handleEntityNotFound(_0x438964,null))[_0x9c35('0x20')](saveUpdates(_0x451716['body'],null))[_0x9c35('0x20')](respondWithResult(_0x438964,null))[_0x9c35('0x3f')](handleError(_0x438964,null));};exports[_0x9c35('0x21')]=function(_0x3f8768,_0xdc129e){return db[_0x9c35('0x29')][_0x9c35('0x44')]({'where':{'id':_0x3f8768['params']['id']}})['then'](handleEntityNotFound(_0xdc129e,null))[_0x9c35('0x20')](removeEntity(_0xdc129e,null))[_0x9c35('0x3f')](handleError(_0xdc129e,null));};exports['describe']=function(_0x314799,_0x45a840){return db[_0x9c35('0x29')][_0x9c35('0x4e')]()[_0x9c35('0x20')](respondWithResult(_0x45a840,null))[_0x9c35('0x3f')](handleError(_0x45a840,null));}; \ No newline at end of file +var _0x053f=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Tag','findAll','rows','catch','params','keys','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','index','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order'];(function(_0x499836,_0x4d8a17){var _0x541a0a=function(_0x53e9be){while(--_0x53e9be){_0x499836['push'](_0x499836['shift']());}};_0x541a0a(++_0x4d8a17);}(_0x053f,0xbf));var _0xf053=function(_0x5a8a3d,_0x139ffb){_0x5a8a3d=_0x5a8a3d-0x0;var _0x49681e=_0x053f[_0x5a8a3d];return _0x49681e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf053('0x0'));var zipdir=require(_0xf053('0x1'));var jsonpatch=require(_0xf053('0x2'));var rp=require(_0xf053('0x3'));var moment=require(_0xf053('0x4'));var BPromise=require(_0xf053('0x5'));var Mustache=require(_0xf053('0x6'));var util=require(_0xf053('0x7'));var path=require(_0xf053('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf053('0x9'));var _=require('lodash');var squel=require(_0xf053('0xa'));var crypto=require(_0xf053('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf053('0xc'));var toCsv=require(_0xf053('0xd'));var querystring=require(_0xf053('0xe'));var Papa=require(_0xf053('0xf'));var Redis=require('ioredis');var authService=require(_0xf053('0x10'));var qs=require(_0xf053('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf053('0x12'));var logger=require('../../config/logger')(_0xf053('0x13'));var utils=require(_0xf053('0x14'));var config=require(_0xf053('0x15'));var licenseUtil=require(_0xf053('0x16'));var db=require(_0xf053('0x17'))['db'];function respondWithStatusCode(_0x1c1a63,_0x5a4fe8){_0x5a4fe8=_0x5a4fe8||0xcc;return function(_0x5a85a2){if(_0x5a85a2){return _0x1c1a63[_0xf053('0x18')](_0x5a4fe8);}return _0x1c1a63[_0xf053('0x19')](_0x5a4fe8)[_0xf053('0x1a')]();};}function respondWithResult(_0x5e76a5,_0x4f9d8a){_0x4f9d8a=_0x4f9d8a||0xc8;return function(_0x52491d){if(_0x52491d){return _0x5e76a5[_0xf053('0x19')](_0x4f9d8a)[_0xf053('0x1b')](_0x52491d);}};}function respondWithFilteredResult(_0x353239,_0x20b64f){return function(_0x13d8a2){if(_0x13d8a2){var _0x23cc1b=typeof _0x20b64f[_0xf053('0x1c')]==='undefined'&&typeof _0x20b64f[_0xf053('0x1d')]===_0xf053('0x1e');var _0x24086f=_0x13d8a2[_0xf053('0x1f')];var _0x28ef92=_0x23cc1b?0x0:_0x20b64f[_0xf053('0x1c')];var _0x117157=_0x23cc1b?_0x13d8a2[_0xf053('0x1f')]:_0x20b64f[_0xf053('0x1c')]+_0x20b64f[_0xf053('0x1d')];var _0xf82490;if(_0x117157>=_0x24086f){_0x117157=_0x24086f;_0xf82490=0xc8;}else{_0xf82490=0xce;}_0x353239[_0xf053('0x19')](_0xf82490);return _0x353239[_0xf053('0x20')](_0xf053('0x21'),_0x28ef92+'-'+_0x117157+'/'+_0x24086f)[_0xf053('0x1b')](_0x13d8a2);}return null;};}function patchUpdates(_0x3fe600){return function(_0x443e89){try{jsonpatch[_0xf053('0x22')](_0x443e89,_0x3fe600,!![]);}catch(_0x2fa887){return BPromise['reject'](_0x2fa887);}return _0x443e89['save']();};}function saveUpdates(_0x2bbe1e,_0x4ccff3){return function(_0x511caa){if(_0x511caa){return _0x511caa[_0xf053('0x23')](_0x2bbe1e)[_0xf053('0x24')](function(_0x5524b9){return _0x5524b9;});}return null;};}function removeEntity(_0x54920f,_0x5c4391){return function(_0x4a71e3){if(_0x4a71e3){return _0x4a71e3['destroy']()[_0xf053('0x24')](function(){var _0x55fe57=_0x4a71e3[_0xf053('0x25')]({'plain':!![]});var _0x9faca6=_0xf053('0x26');return db[_0xf053('0x27')][_0xf053('0x28')]({'where':{'type':_0x9faca6,'resourceId':_0x55fe57['id']}})[_0xf053('0x24')](function(){return _0x4a71e3;});})['then'](function(){_0x54920f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f07ed,_0x2a4af1){return function(_0x374853){if(!_0x374853){_0x2f07ed[_0xf053('0x18')](0x194);}return _0x374853;};}function handleError(_0x568afd,_0x567942){_0x567942=_0x567942||0x1f4;return function(_0x525e56){logger[_0xf053('0x29')](_0x525e56[_0xf053('0x2a')]);if(_0x525e56[_0xf053('0x2b')]){delete _0x525e56[_0xf053('0x2b')];}_0x568afd['status'](_0x567942)['send'](_0x525e56);};}exports[_0xf053('0x2c')]=function(_0x5234c5,_0x49b0ec){var _0x305c01={},_0x296871={},_0x1e4e21={'count':0x0,'rows':[]};var _0x54df92=_[_0xf053('0x2d')](db['Tag']['rawAttributes'],function(_0x1d8525){return{'name':_0x1d8525[_0xf053('0x2e')],'type':_0x1d8525[_0xf053('0x2f')][_0xf053('0x30')]};});_0x296871['model']=_[_0xf053('0x2d')](_0x54df92,'name');_0x296871[_0xf053('0x31')]=_['keys'](_0x5234c5['query']);_0x296871[_0xf053('0x32')]=_[_0xf053('0x33')](_0x296871[_0xf053('0x34')],_0x296871[_0xf053('0x31')]);_0x305c01[_0xf053('0x35')]=_[_0xf053('0x33')](_0x296871[_0xf053('0x34')],qs[_0xf053('0x36')](_0x5234c5[_0xf053('0x31')][_0xf053('0x36')]));_0x305c01[_0xf053('0x35')]=_0x305c01[_0xf053('0x35')][_0xf053('0x37')]?_0x305c01[_0xf053('0x35')]:_0x296871[_0xf053('0x34')];if(!_0x5234c5[_0xf053('0x31')]['hasOwnProperty'](_0xf053('0x38'))){_0x305c01['limit']=qs[_0xf053('0x1d')](_0x5234c5[_0xf053('0x31')][_0xf053('0x1d')]);_0x305c01[_0xf053('0x1c')]=qs['offset'](_0x5234c5[_0xf053('0x31')][_0xf053('0x1c')]);}_0x305c01[_0xf053('0x39')]=qs[_0xf053('0x3a')](_0x5234c5[_0xf053('0x31')]['sort']);_0x305c01[_0xf053('0x3b')]=qs['filters'](_[_0xf053('0x3c')](_0x5234c5[_0xf053('0x31')],_0x296871[_0xf053('0x32')]),_0x54df92);if(_0x5234c5[_0xf053('0x31')][_0xf053('0x3d')]){_0x305c01[_0xf053('0x3b')]=_[_0xf053('0x3e')](_0x305c01['where'],{'$or':_['map'](_0x54df92,function(_0x166d03){if(_0x166d03['type']!==_0xf053('0x3f')){var _0x27a315={};_0x27a315[_0x166d03[_0xf053('0x2b')]]={'$like':'%'+_0x5234c5[_0xf053('0x31')][_0xf053('0x3d')]+'%'};return _0x27a315;}})});}_0x305c01=_[_0xf053('0x3e')]({},_0x305c01,_0x5234c5[_0xf053('0x40')]);var _0x5ec3d8={'where':_0x305c01[_0xf053('0x3b')]};return db['Tag']['count'](_0x5ec3d8)['then'](function(_0xb73ae5){_0x1e4e21[_0xf053('0x1f')]=_0xb73ae5;if(_0x5234c5[_0xf053('0x31')][_0xf053('0x41')]){_0x305c01[_0xf053('0x42')]=[{'all':!![]}];}return db[_0xf053('0x43')][_0xf053('0x44')](_0x305c01);})[_0xf053('0x24')](function(_0x4129e1){_0x1e4e21[_0xf053('0x45')]=_0x4129e1;return _0x1e4e21;})['then'](respondWithFilteredResult(_0x49b0ec,_0x305c01))[_0xf053('0x46')](handleError(_0x49b0ec,null));};exports['show']=function(_0x3467b9,_0x497a56){var _0x346395={'raw':!![],'where':{'id':_0x3467b9[_0xf053('0x47')]['id']}},_0x3dbacf={};_0x3dbacf[_0xf053('0x34')]=_[_0xf053('0x48')](db[_0xf053('0x43')][_0xf053('0x49')]);_0x3dbacf[_0xf053('0x31')]=_['keys'](_0x3467b9[_0xf053('0x31')]);_0x3dbacf[_0xf053('0x32')]=_[_0xf053('0x33')](_0x3dbacf['model'],_0x3dbacf[_0xf053('0x31')]);_0x346395['attributes']=_[_0xf053('0x33')](_0x3dbacf[_0xf053('0x34')],qs['fields'](_0x3467b9[_0xf053('0x31')]['fields']));_0x346395[_0xf053('0x35')]=_0x346395[_0xf053('0x35')][_0xf053('0x37')]?_0x346395[_0xf053('0x35')]:_0x3dbacf['model'];if(_0x3467b9[_0xf053('0x31')][_0xf053('0x41')]){_0x346395[_0xf053('0x42')]=[{'all':!![]}];}_0x346395=_[_0xf053('0x3e')]({},_0x346395,_0x3467b9[_0xf053('0x40')]);return db[_0xf053('0x43')][_0xf053('0x4a')](_0x346395)['then'](handleEntityNotFound(_0x497a56,null))['then'](respondWithResult(_0x497a56,null))['catch'](handleError(_0x497a56,null));};exports['create']=function(_0x5b64f8,_0x42d8a4){return db['Tag']['create'](_0x5b64f8[_0xf053('0x4b')],{})[_0xf053('0x24')](function(_0x687dbb){var _0x370202=_0x5b64f8[_0xf053('0x4c')][_0xf053('0x25')]({'plain':!![]});if(!_0x370202)throw new Error(_0xf053('0x4d'));if(_0x370202[_0xf053('0x4e')]===_0xf053('0x4c')){var _0x5ab266=_0x687dbb[_0xf053('0x25')]({'plain':!![]});var _0x21efa8='Tags';return db['UserProfileSection']['find']({'where':{'name':_0x21efa8,'userProfileId':_0x370202[_0xf053('0x4f')]},'raw':!![]})['then'](function(_0x289c07){if(_0x289c07&&_0x289c07[_0xf053('0x50')]===0x0){return db[_0xf053('0x27')]['create']({'name':_0x5ab266[_0xf053('0x2b')],'resourceId':_0x5ab266['id'],'type':_0x289c07[_0xf053('0x2b')],'sectionId':_0x289c07['id']},{})[_0xf053('0x24')](function(){return _0x687dbb;});}else{return _0x687dbb;}})[_0xf053('0x46')](function(_0x57d32b){logger[_0xf053('0x29')](_0xf053('0x51'),_0x57d32b);throw _0x57d32b;});}return _0x687dbb;})[_0xf053('0x24')](respondWithResult(_0x42d8a4,0xc9))[_0xf053('0x46')](handleError(_0x42d8a4,null));};exports[_0xf053('0x23')]=function(_0x3d1972,_0xb100cf){if(_0x3d1972['body']['id']){delete _0x3d1972[_0xf053('0x4b')]['id'];}return db[_0xf053('0x43')][_0xf053('0x4a')]({'where':{'id':_0x3d1972[_0xf053('0x47')]['id']}})[_0xf053('0x24')](handleEntityNotFound(_0xb100cf,null))['then'](saveUpdates(_0x3d1972[_0xf053('0x4b')],null))[_0xf053('0x24')](respondWithResult(_0xb100cf,null))[_0xf053('0x46')](handleError(_0xb100cf,null));};exports[_0xf053('0x28')]=function(_0x583f05,_0x38a0c4){return db[_0xf053('0x43')][_0xf053('0x4a')]({'where':{'id':_0x583f05[_0xf053('0x47')]['id']}})['then'](handleEntityNotFound(_0x38a0c4,null))[_0xf053('0x24')](removeEntity(_0x38a0c4,null))['catch'](handleError(_0x38a0c4,null));};exports[_0xf053('0x52')]=function(_0x4a2f81,_0x93e14d){return db[_0xf053('0x43')][_0xf053('0x52')]()[_0xf053('0x24')](respondWithResult(_0x93e14d,null))[_0xf053('0x46')](handleError(_0x93e14d,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 3d1ca51..bbfe02a 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 _0xc61f=['define','Tag','tools_tags','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x4d4c1e,_0x510280){var _0x1faf47=function(_0x1988a6){while(--_0x1988a6){_0x4d4c1e['push'](_0x4d4c1e['shift']());}};_0x1faf47(++_0x510280);}(_0xc61f,0x65));var _0xfc61=function(_0x24cc6f,_0x197c5e){_0x24cc6f=_0x24cc6f-0x0;var _0xcd0f56=_0xc61f[_0x24cc6f];return _0xcd0f56;};'use strict';var _=require('lodash');var util=require(_0xfc61('0x0'));var logger=require(_0xfc61('0x1'))(_0xfc61('0x2'));var moment=require(_0xfc61('0x3'));var BPromise=require(_0xfc61('0x4'));var rp=require(_0xfc61('0x5'));var fs=require('fs');var path=require(_0xfc61('0x6'));var rimraf=require(_0xfc61('0x7'));var config=require(_0xfc61('0x8'));var attributes=require(_0xfc61('0x9'));module[_0xfc61('0xa')]=function(_0x4b7d26,_0x2e63de){return _0x4b7d26[_0xfc61('0xb')](_0xfc61('0xc'),attributes,{'tableName':_0xfc61('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa4=['tools_tags','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./tag.attributes','exports','define'];(function(_0x187214,_0x5229af){var _0x3c1f2c=function(_0x10fe13){while(--_0x10fe13){_0x187214['push'](_0x187214['shift']());}};_0x3c1f2c(++_0x5229af);}(_0x6aa4,0x1f0));var _0x46aa=function(_0x17235b,_0x4f6504){_0x17235b=_0x17235b-0x0;var _0x3dc694=_0x6aa4[_0x17235b];return _0x3dc694;};'use strict';var _=require(_0x46aa('0x0'));var util=require(_0x46aa('0x1'));var logger=require(_0x46aa('0x2'))(_0x46aa('0x3'));var moment=require('moment');var BPromise=require(_0x46aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46aa('0x5'));var rimraf=require('rimraf');var config=require(_0x46aa('0x6'));var attributes=require(_0x46aa('0x7'));module[_0x46aa('0x8')]=function(_0x388133,_0x1a654c){return _0x388133[_0x46aa('0x9')]('Tag',attributes,{'tableName':_0x46aa('0xa'),'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 0b31b94..4008f1d 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 _0x5636=['code','Tag,\x20%s,\x20%s','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5636,0x102));var _0x6563=function(_0x38ac17,_0x2e1c14){_0x38ac17=_0x38ac17-0x0;var _0x1b9c5f=_0x5636[_0x38ac17];return _0x1b9c5f;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x193942,_0x9884a9,_0x2d57d5){return new BPromise(function(_0x2d0d5b,_0x98fcd4){return client[_0x6563('0xa')](_0x193942,_0x2d57d5)[_0x6563('0xb')](function(_0x3ccb4e){logger['info']('Tag,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));logger[_0x6563('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x9884a9,'request\x20sent',JSON['stringify'](_0x3ccb4e));if(_0x3ccb4e[_0x6563('0xe')]){if(_0x3ccb4e[_0x6563('0xe')][_0x6563('0xf')]===0x1f4){logger[_0x6563('0xe')](_0x6563('0x10'),_0x9884a9,_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);return _0x98fcd4(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}logger['error'](_0x6563('0x10'),_0x9884a9,_0x3ccb4e['error'][_0x6563('0x11')]);return _0x2d0d5b(_0x3ccb4e[_0x6563('0xe')][_0x6563('0x11')]);}else{logger[_0x6563('0x12')]('Tag,\x20%s,\x20%s',_0x9884a9,_0x6563('0xc'));_0x2d0d5b(_0x3ccb4e[_0x6563('0x13')][_0x6563('0x11')]);}})[_0x6563('0x14')](function(_0x4e7282){logger[_0x6563('0xe')]('Tag,\x20%s,\x20%s',_0x9884a9,_0x4e7282);_0x98fcd4(_0x4e7282);});});} \ No newline at end of file +var _0xc6d8=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0xbb3618,_0x19b81d){var _0x4d3a73=function(_0x278c30){while(--_0x278c30){_0xbb3618['push'](_0xbb3618['shift']());}};_0x4d3a73(++_0x19b81d);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x468837,_0x5f0a68){_0x468837=_0x468837-0x0;var _0x7c161e=_0xc6d8[_0x468837];return _0x7c161e;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('Tag,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 551ba4f..fe2097e 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 47c1b6d..1004e2c 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 _0x0713=['STRING','name'];(function(_0x2362ae,_0x4f6e24){var _0x112edf=function(_0x2974f8){while(--_0x2974f8){_0x2362ae['push'](_0x2362ae['shift']());}};_0x112edf(++_0x4f6e24);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x10a344,_0x17d249){var _0x499b6c=function(_0x96cb7c){while(--_0x96cb7c){_0x10a344['push'](_0x10a344['shift']());}};_0x499b6c(++_0x17d249);}(_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 9ecbb3a..417a054 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 _0x418a=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','update','then','error','name','send','map','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','Team','includeAll','include','findAll','catch','params','rawAttributes','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','toLowerCase','Queue','order','capitalize','Queues','addQueues','add','ids','removeQueues','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','upsert','isNil','format','SIP/%s','all','TeamVoicePrefix','addAgents','spread','removeAgents','isArray','Queue:remove','UserVoiceQueueRt','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x565e3e,_0x44188f){var _0x3db788=function(_0xf1c412){while(--_0xf1c412){_0x565e3e['push'](_0x565e3e['shift']());}};_0x3db788(++_0x44188f);}(_0x418a,0x84));var _0xa418=function(_0x1dfd87,_0x2c73b3){_0x1dfd87=_0x1dfd87-0x0;var _0x4ef867=_0x418a[_0x1dfd87];return _0x4ef867;};'use strict';var emlformat=require(_0xa418('0x0'));var rimraf=require(_0xa418('0x1'));var zipdir=require(_0xa418('0x2'));var jsonpatch=require(_0xa418('0x3'));var rp=require(_0xa418('0x4'));var moment=require(_0xa418('0x5'));var BPromise=require(_0xa418('0x6'));var Mustache=require(_0xa418('0x7'));var util=require(_0xa418('0x8'));var path=require(_0xa418('0x9'));var sox=require('sox');var csv=require(_0xa418('0xa'));var ejs=require(_0xa418('0xb'));var fs=require('fs');var fs_extra=require(_0xa418('0xc'));var _=require(_0xa418('0xd'));var squel=require(_0xa418('0xe'));var crypto=require(_0xa418('0xf'));var jsforce=require(_0xa418('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa418('0x11'));var authService=require(_0xa418('0x12'));var qs=require(_0xa418('0x13'));var as=require(_0xa418('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa418('0x15'))('api');var utils=require(_0xa418('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa418('0x17'));var db=require(_0xa418('0x18'))['db'];config['redis']=_[_0xa418('0x19')](config[_0xa418('0x1a')],{'host':_0xa418('0x1b'),'port':0x18eb});var socket=require(_0xa418('0x1c'))(new Redis(config[_0xa418('0x1a')]));require('./team.socket')[_0xa418('0x1d')](socket);function respondWithStatusCode(_0x4295df,_0x1ea755){_0x1ea755=_0x1ea755||0xcc;return function(_0x257b3f){if(_0x257b3f){return _0x4295df[_0xa418('0x1e')](_0x1ea755);}return _0x4295df['status'](_0x1ea755)[_0xa418('0x1f')]();};}function respondWithResult(_0x575487,_0x9fc1ee){_0x9fc1ee=_0x9fc1ee||0xc8;return function(_0xf532ac){if(_0xf532ac){return _0x575487[_0xa418('0x20')](_0x9fc1ee)[_0xa418('0x21')](_0xf532ac);}};}function respondWithFilteredResult(_0x3a32de,_0x331c61){return function(_0x29aecd){if(_0x29aecd){var _0xbb494b=typeof _0x331c61['offset']===_0xa418('0x22')&&typeof _0x331c61[_0xa418('0x23')]===_0xa418('0x22');var _0x461c05=_0x29aecd[_0xa418('0x24')];var _0x4a48ce=_0xbb494b?0x0:_0x331c61[_0xa418('0x25')];var _0x1219ab=_0xbb494b?_0x29aecd[_0xa418('0x24')]:_0x331c61[_0xa418('0x25')]+_0x331c61[_0xa418('0x23')];var _0x196487;if(_0x1219ab>=_0x461c05){_0x1219ab=_0x461c05;_0x196487=0xc8;}else{_0x196487=0xce;}_0x3a32de[_0xa418('0x20')](_0x196487);return _0x3a32de[_0xa418('0x26')]('Content-Range',_0x4a48ce+'-'+_0x1219ab+'/'+_0x461c05)[_0xa418('0x21')](_0x29aecd);}return null;};}function patchUpdates(_0x30b9af){return function(_0x31f98f){try{jsonpatch['apply'](_0x31f98f,_0x30b9af,!![]);}catch(_0x34d0d0){return BPromise[_0xa418('0x27')](_0x34d0d0);}return _0x31f98f[_0xa418('0x28')]();};}function saveUpdates(_0x42400a,_0x5d5a11){return function(_0xae8bd7){if(_0xae8bd7){return _0xae8bd7[_0xa418('0x29')](_0x42400a)[_0xa418('0x2a')](function(_0x1b5f58){return _0x1b5f58;});}return null;};}function handleEntityNotFound(_0x61e309,_0x172825){return function(_0x505f9a){if(!_0x505f9a){_0x61e309['sendStatus'](0x194);}return _0x505f9a;};}function handleError(_0xe69cfe,_0xcc623){_0xcc623=_0xcc623||0x1f4;return function(_0x447392){logger[_0xa418('0x2b')](_0x447392['stack']);if(_0x447392[_0xa418('0x2c')]){delete _0x447392['name'];}_0xe69cfe['status'](_0xcc623)[_0xa418('0x2d')](_0x447392);};}exports['index']=function(_0x594511,_0x5c7b41){var _0x28a6b8={},_0x43a03e={},_0x3a347f={'count':0x0,'rows':[]};var _0x4100f0=_[_0xa418('0x2e')](db['Team']['rawAttributes'],function(_0x4c52d4){return{'name':_0x4c52d4[_0xa418('0x2f')],'type':_0x4c52d4[_0xa418('0x30')]['key']};});_0x43a03e[_0xa418('0x31')]=_['map'](_0x4100f0,_0xa418('0x2c'));_0x43a03e['query']=_[_0xa418('0x32')](_0x594511['query']);_0x43a03e[_0xa418('0x33')]=_[_0xa418('0x34')](_0x43a03e['model'],_0x43a03e[_0xa418('0x35')]);_0x28a6b8[_0xa418('0x36')]=_[_0xa418('0x34')](_0x43a03e[_0xa418('0x31')],qs[_0xa418('0x37')](_0x594511[_0xa418('0x35')][_0xa418('0x37')]));_0x28a6b8['attributes']=_0x28a6b8[_0xa418('0x36')][_0xa418('0x38')]?_0x28a6b8[_0xa418('0x36')]:_0x43a03e[_0xa418('0x31')];if(!_0x594511[_0xa418('0x35')][_0xa418('0x39')](_0xa418('0x3a'))){_0x28a6b8[_0xa418('0x23')]=qs[_0xa418('0x23')](_0x594511[_0xa418('0x35')][_0xa418('0x23')]);_0x28a6b8['offset']=qs[_0xa418('0x25')](_0x594511[_0xa418('0x35')]['offset']);}_0x28a6b8['order']=qs[_0xa418('0x3b')](_0x594511[_0xa418('0x35')][_0xa418('0x3b')]);_0x28a6b8[_0xa418('0x3c')]=qs['filters'](_[_0xa418('0x3d')](_0x594511[_0xa418('0x35')],_0x43a03e[_0xa418('0x33')]),_0x4100f0);if(_0x594511['query']['filter']){_0x28a6b8[_0xa418('0x3c')]=_[_0xa418('0x3e')](_0x28a6b8[_0xa418('0x3c')],{'$or':_[_0xa418('0x2e')](_0x4100f0,function(_0x214bd4){if(_0x214bd4[_0xa418('0x30')]!=='VIRTUAL'){var _0x38a178={};_0x38a178[_0x214bd4[_0xa418('0x2c')]]={'$like':'%'+_0x594511[_0xa418('0x35')][_0xa418('0x3f')]+'%'};return _0x38a178;}})});}_0x28a6b8=_[_0xa418('0x3e')]({},_0x28a6b8,_0x594511[_0xa418('0x40')]);var _0x328348={'where':_0x28a6b8[_0xa418('0x3c')]};return db[_0xa418('0x41')]['count'](_0x328348)[_0xa418('0x2a')](function(_0x3f8e60){_0x3a347f[_0xa418('0x24')]=_0x3f8e60;if(_0x594511['query'][_0xa418('0x42')]){_0x28a6b8[_0xa418('0x43')]=[{'all':!![]}];}return db[_0xa418('0x41')][_0xa418('0x44')](_0x28a6b8);})[_0xa418('0x2a')](function(_0x3b8a3c){_0x3a347f['rows']=_0x3b8a3c;return _0x3a347f;})[_0xa418('0x2a')](respondWithFilteredResult(_0x5c7b41,_0x28a6b8))[_0xa418('0x45')](handleError(_0x5c7b41,null));};exports['show']=function(_0x1f99d0,_0x1d418f){var _0x5054da={'raw':![],'where':{'id':_0x1f99d0[_0xa418('0x46')]['id']}},_0x47da4a={};_0x47da4a['model']=_[_0xa418('0x32')](db[_0xa418('0x41')][_0xa418('0x47')]);_0x47da4a[_0xa418('0x35')]=_['keys'](_0x1f99d0[_0xa418('0x35')]);_0x47da4a['filters']=_['intersection'](_0x47da4a[_0xa418('0x31')],_0x47da4a[_0xa418('0x35')]);_0x5054da[_0xa418('0x36')]=_[_0xa418('0x34')](_0x47da4a['model'],qs['fields'](_0x1f99d0[_0xa418('0x35')][_0xa418('0x37')]));_0x5054da[_0xa418('0x36')]=_0x5054da[_0xa418('0x36')][_0xa418('0x38')]?_0x5054da['attributes']:_0x47da4a[_0xa418('0x31')];if(_0x1f99d0['query'][_0xa418('0x42')]){_0x5054da[_0xa418('0x43')]=[{'all':!![]}];}_0x5054da=_[_0xa418('0x3e')]({},_0x5054da,_0x1f99d0[_0xa418('0x40')]);return db[_0xa418('0x41')][_0xa418('0x48')](_0x5054da)[_0xa418('0x2a')](handleEntityNotFound(_0x1d418f,null))[_0xa418('0x2a')](respondWithResult(_0x1d418f,null))['catch'](handleError(_0x1d418f,null));};exports[_0xa418('0x49')]=function(_0x5d8b0d,_0xb68a29){return db[_0xa418('0x41')]['create'](_0x5d8b0d['body'],{})[_0xa418('0x2a')](function(_0x3df7b3){var _0x5b99d3=_0x5d8b0d[_0xa418('0x4a')][_0xa418('0x4b')]({'plain':!![]});if(!_0x5b99d3)throw new Error(_0xa418('0x4c'));if(_0x5b99d3[_0xa418('0x4d')]===_0xa418('0x4a')){var _0x50e551=_0x3df7b3[_0xa418('0x4b')]({'plain':!![]});var _0x59175c=_0xa418('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x59175c,'userProfileId':_0x5b99d3['userProfileId']},'raw':!![]})['then'](function(_0x5c4b18){if(_0x5c4b18&&_0x5c4b18[_0xa418('0x4f')]===0x0){return db[_0xa418('0x50')][_0xa418('0x49')]({'name':_0x50e551[_0xa418('0x2c')],'resourceId':_0x50e551['id'],'type':_0x5c4b18[_0xa418('0x2c')],'sectionId':_0x5c4b18['id']},{})['then'](function(){return _0x3df7b3;});}else{return _0x3df7b3;}})[_0xa418('0x45')](function(_0x52ab6d){logger['error'](_0xa418('0x51'),_0x52ab6d);throw _0x52ab6d;});}return _0x3df7b3;})[_0xa418('0x2a')](respondWithResult(_0xb68a29,0xc9))[_0xa418('0x45')](handleError(_0xb68a29,null));};exports['update']=function(_0x20e4a8,_0x5e939e){if(_0x20e4a8[_0xa418('0x52')]['id']){delete _0x20e4a8[_0xa418('0x52')]['id'];}return db[_0xa418('0x41')][_0xa418('0x48')]({'where':{'id':_0x20e4a8[_0xa418('0x46')]['id']}})[_0xa418('0x2a')](handleEntityNotFound(_0x5e939e,null))[_0xa418('0x2a')](saveUpdates(_0x20e4a8[_0xa418('0x52')],null))[_0xa418('0x2a')](respondWithResult(_0x5e939e,null))[_0xa418('0x45')](handleError(_0x5e939e,null));};exports['destroy']=function(_0x432703,_0x30d99b){var _0x139beb=_0x432703[_0xa418('0x46')]['id'];var _0x3eb7b6=[];return db[_0xa418('0x53')]['transaction'](function(_0x4ce2bf){var _0x258877=_0xa418('0x54')+_0x139beb;return db[_0xa418('0x53')][_0xa418('0x35')](_0x258877,{'type':db[_0xa418('0x55')]['QueryTypes'][_0xa418('0x56')],'raw':!![],'transaction':_0x4ce2bf})[_0xa418('0x2a')](function(_0xa92a3c){_0x3eb7b6=_['map'](_0xa92a3c,function(_0x107d93){return Number(_0x107d93[_0xa418('0x57')]);});})[_0xa418('0x2a')](function(){var _0x9ae693=_0xa418('0x58')+_0x139beb;return db[_0xa418('0x53')][_0xa418('0x35')](_0x9ae693,{'type':db[_0xa418('0x55')]['QueryTypes'][_0xa418('0x56')],'raw':!![],'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(_0x3e63bf){var _0x2faa35=_[_0xa418('0x2e')](_0x3e63bf,function(_0x429412){return Number(_0x429412[_0xa418('0x59')]);});return db[_0xa418('0x5a')][_0xa418('0x5b')]({'where':{'UserId':{'$in':_0x3eb7b6},'VoiceQueueId':{'$in':_0x2faa35}},'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(){var _0x146686=_0xa418('0x5c')+_0x139beb;return db['sequelize']['query'](_0x146686,{'type':db[_0xa418('0x55')][_0xa418('0x5d')][_0xa418('0x56')],'raw':!![],'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(_0x3e498c){var _0x4307e5=_[_0xa418('0x2e')](_0x3e498c,function(_0x37362a){return Number(_0x37362a['MailQueueId']);});return db[_0xa418('0x5e')][_0xa418('0x5b')]({'where':{'UserId':{'$in':_0x3eb7b6},'MailQueueId':{'$in':_0x4307e5}},'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(){var _0x3cc1f6=_0xa418('0x5f')+_0x139beb;return db[_0xa418('0x53')][_0xa418('0x35')](_0x3cc1f6,{'type':db['Sequelize'][_0xa418('0x5d')]['SELECT'],'raw':!![],'transaction':_0x4ce2bf});})['then'](function(_0x2031df){var _0x5ebdb8=_[_0xa418('0x2e')](_0x2031df,function(_0xb85277){return Number(_0xb85277[_0xa418('0x60')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x3eb7b6},'SmsQueueId':{'$in':_0x5ebdb8}},'transaction':_0x4ce2bf});})['then'](function(){var _0x2db28f=_0xa418('0x61')+_0x139beb;return db[_0xa418('0x53')][_0xa418('0x35')](_0x2db28f,{'type':db['Sequelize'][_0xa418('0x5d')][_0xa418('0x56')],'raw':!![],'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(_0x1bc2da){var _0x45968f=_[_0xa418('0x2e')](_0x1bc2da,function(_0x27af65){return Number(_0x27af65[_0xa418('0x62')]);});return db[_0xa418('0x63')]['destroy']({'where':{'UserId':{'$in':_0x3eb7b6},'ChatQueueId':{'$in':_0x45968f}},'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(){var _0x82a791=_0xa418('0x64')+_0x139beb;return db[_0xa418('0x53')][_0xa418('0x35')](_0x82a791,{'type':db['Sequelize'][_0xa418('0x5d')]['SELECT'],'raw':!![],'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(_0x355f2a){var _0x19765c=_['map'](_0x355f2a,function(_0x57b8d0){return Number(_0x57b8d0[_0xa418('0x65')]);});return db[_0xa418('0x66')][_0xa418('0x5b')]({'where':{'UserId':{'$in':_0x3eb7b6},'FaxQueueId':{'$in':_0x19765c}},'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(){var _0x3d45c7=_0xa418('0x67')+_0x139beb;return db[_0xa418('0x53')][_0xa418('0x35')](_0x3d45c7,{'type':db[_0xa418('0x55')]['QueryTypes'][_0xa418('0x56')],'raw':!![],'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(_0x292e83){var _0x13462b=_[_0xa418('0x2e')](_0x292e83,function(_0xa79f89){return Number(_0xa79f89[_0xa418('0x68')]);});return db['UserOpenchannelQueue'][_0xa418('0x5b')]({'where':{'UserId':{'$in':_0x3eb7b6},'OpenchannelQueueId':{'$in':_0x13462b}},'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(){var _0x57ea0a=_0xa418('0x69')+_0x139beb;return db[_0xa418('0x53')][_0xa418('0x35')](_0x57ea0a,{'type':db[_0xa418('0x55')][_0xa418('0x5d')]['SELECT'],'raw':!![],'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(_0x5f08ac){var _0x46c2d9=_['map'](_0x5f08ac,function(_0x4e0e26){return Number(_0x4e0e26['WhatsappQueueId']);});return db[_0xa418('0x6a')][_0xa418('0x5b')]({'where':{'UserId':{'$in':_0x3eb7b6},'WhatsappQueueId':{'$in':_0x46c2d9}},'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(){return db['TeamVoicePrefix'][_0xa418('0x48')]({'where':{'TeamId':_0x139beb}});})[_0xa418('0x2a')](function(_0x38b1ff){if(_0x38b1ff===null){return;}return db[_0xa418('0x6b')][_0xa418('0x5b')]({'where':{'UserId':{'$in':_0x3eb7b6},'VoicePrefixId':_0x38b1ff[_0xa418('0x6c')]},'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(){return db[_0xa418('0x41')]['destroy']({'where':{'id':_0x139beb},'cascade':!![],'transaction':_0x4ce2bf});})[_0xa418('0x2a')](function(_0x508ea9){if(_0x508ea9===0x0){_0x30d99b[_0xa418('0x1e')](0x194);}else{return db[_0xa418('0x50')][_0xa418('0x5b')]({'where':{'type':'Teams','resourceId':_0x139beb},'cascade':!![],'transaction':_0x4ce2bf})[_0xa418('0x2a')](function(){_0x30d99b[_0xa418('0x20')](0xcc)[_0xa418('0x1f')]();});}})[_0xa418('0x45')](function(_0xb8bd3c){_0x30d99b[_0xa418('0x20')](0x1f4)[_0xa418('0x2d')](_0xb8bd3c);});});};exports[_0xa418('0x6d')]=function(_0x18027a,_0x10bf77,_0x144a3d){return db['Team'][_0xa418('0x6e')]({'where':{'id':_0x18027a[_0xa418('0x46')]['id']}})['then'](handleEntityNotFound(_0x10bf77,null))['then'](function(_0x5702a6){if(!_0x18027a[_0xa418('0x35')]['channel']||!utils[_0xa418('0x6f')](_0x18027a['query'][_0xa418('0x70')])){throw new db[(_0xa418('0x55'))][(_0xa418('0x71'))](_0xa418('0x72'));}var _0x22f549={};var _0x1ce04f={};_0x1ce04f['model']=_['keys'](db[_['capitalize'](_0x18027a['query']['channel'][_0xa418('0x73')]())+_0xa418('0x74')][_0xa418('0x47')]);_0x1ce04f['query']=_[_0xa418('0x32')](_0x18027a[_0xa418('0x35')]);_0x1ce04f['filters']=_[_0xa418('0x34')](_0x1ce04f[_0xa418('0x31')],_0x1ce04f[_0xa418('0x35')]);_0x22f549['attributes']=_[_0xa418('0x34')](_0x1ce04f['model'],qs[_0xa418('0x37')](_0x18027a[_0xa418('0x35')][_0xa418('0x37')]));_0x22f549[_0xa418('0x36')]=_0x22f549['attributes'][_0xa418('0x38')]?_0x22f549[_0xa418('0x36')]:_0x1ce04f['model'];_0x22f549[_0xa418('0x23')]=qs[_0xa418('0x23')](_0x18027a[_0xa418('0x35')][_0xa418('0x23')]);_0x22f549[_0xa418('0x25')]=qs[_0xa418('0x25')](_0x18027a['query'][_0xa418('0x25')]);_0x22f549[_0xa418('0x75')]=qs['sort'](_0x18027a[_0xa418('0x35')][_0xa418('0x3b')]);_0x22f549[_0xa418('0x3c')]=qs[_0xa418('0x33')](_[_0xa418('0x3d')](_0x18027a[_0xa418('0x35')],_0x1ce04f[_0xa418('0x33')]));_0x22f549=_['merge']({},_0x22f549,_0x18027a[_0xa418('0x40')]);return _0x5702a6[_0xa418('0x4b')+_[_0xa418('0x76')](_0x18027a[_0xa418('0x35')][_0xa418('0x70')][_0xa418('0x73')]())+_0xa418('0x77')](_0x22f549);})[_0xa418('0x2a')](respondWithResult(_0x10bf77,null))[_0xa418('0x45')](handleError(_0x10bf77,null));};exports[_0xa418('0x78')]=function(_0x91bebe,_0x4de813,_0x3ffb75){return db[_0xa418('0x41')][_0xa418('0x6e')]({'where':{'id':_0x91bebe[_0xa418('0x46')]['id']}})[_0xa418('0x2a')](function(_0x450dac){if(_0x450dac){if(!_0x91bebe[_0xa418('0x52')]['channel']||!utils[_0xa418('0x6f')](_0x91bebe[_0xa418('0x52')][_0xa418('0x70')])){throw new db[(_0xa418('0x55'))][(_0xa418('0x71'))](_0xa418('0x72'));}return _0x450dac[_0xa418('0x79')+_['capitalize'](_0x91bebe[_0xa418('0x52')][_0xa418('0x70')][_0xa418('0x73')]())+'Queues'](_0x91bebe[_0xa418('0x52')][_0xa418('0x7a')]);}return null;})['then'](handleEntityNotFound(_0x4de813,null))[_0xa418('0x2a')](respondWithStatusCode(_0x4de813,null))['catch'](handleError(_0x4de813,null));};exports[_0xa418('0x7b')]=function(_0x9c3069,_0x3047c3,_0x472c65){return db[_0xa418('0x41')][_0xa418('0x6e')]({'where':{'id':_0x9c3069[_0xa418('0x46')]['id']}})['then'](function(_0x58dc37){if(_0x58dc37){if(!_0x9c3069['query'][_0xa418('0x70')]||!utils[_0xa418('0x6f')](_0x9c3069[_0xa418('0x35')][_0xa418('0x70')])){throw new db[(_0xa418('0x55'))][(_0xa418('0x71'))](_0xa418('0x72'));}return _0x58dc37['remove'+_[_0xa418('0x76')](_0x9c3069['query'][_0xa418('0x70')][_0xa418('0x73')]())+_0xa418('0x77')](_0x9c3069['query'][_0xa418('0x7a')]);}return null;})[_0xa418('0x2a')](handleEntityNotFound(_0x3047c3,null))['then'](respondWithStatusCode(_0x3047c3,null))['catch'](handleError(_0x3047c3,null));};exports['addAgents']=function(_0x5be45d,_0x478889){var _0xc60652=_['isArray'](_0x5be45d[_0xa418('0x52')][_0xa418('0x7a')])?_0x5be45d['body'][_0xa418('0x7a')]:[_0x5be45d[_0xa418('0x52')]['ids']];var _0x360f9a=_0x5be45d[_0xa418('0x46')]['id'];return db[_0xa418('0x41')][_0xa418('0x48')]({'where':{'id':_0x360f9a}})['then'](handleEntityNotFound(_0x478889,null))['then'](function(_0x429626){if(_0x429626){var _0x3ee8fc=[_0xa418('0x7c'),_0xa418('0x7d'),_0xa418('0x7e'),_0xa418('0x7f'),_0xa418('0x80'),_0xa418('0x81'),_0xa418('0x82')];return db[_0xa418('0x53')][_0xa418('0x83')](function(_0x3e1285){var _0x4e537d=_[_0xa418('0x2e')](_0x3ee8fc,function(_0x3007a8){var _0x552d91={'attributes':['id',_0xa418('0x2c')]};if(_0x3007a8===_0xa418('0x7c')){_0x552d91[_0xa418('0x84')]={'attributes':[_0xa418('0x85')]};}return _0x429626[_0xa418('0x4b')+_0x3007a8+_0xa418('0x77')](_0x552d91)[_0xa418('0x2a')](function(_0x47a05c){var _0x36f5c5=_['map'](_0x47a05c,function(_0x3125b4){var _0x30e307=_['map'](_0xc60652,function(_0x7c5688){var _0x5c3520={'where':{'UserId':_0x7c5688,[_0x3007a8+_0xa418('0x86')]:_0x3125b4['id']},'transaction':_0x3e1285};if(_0x3007a8===_0xa418('0x7c')){_0x5c3520['defaults']={'penalty':_0x3125b4[_0xa418('0x87')][_0xa418('0x85')]};}return db[_0xa418('0x88')+_0x3007a8+'Queue'][_0xa418('0x89')](_0x5c3520)['then'](function(){socket[_0xa418('0x8a')](_0xa418('0x4a')+_0x3007a8+_0xa418('0x8b'),{'UserId':_0x7c5688,[_0x3007a8+_0xa418('0x86')]:_0x3125b4['id']});if(_0x3007a8!==_0xa418('0x7c')){return;}return db[_0xa418('0x88')][_0xa418('0x44')]({'where':{'id':_0xc60652,'online':0x1},'attributes':['id',_0xa418('0x2c'),_0xa418('0x8c'),_0xa418('0x8d'),_0xa418('0x8e')],'raw':!![]})[_0xa418('0x2a')](function(_0x1ce442){var _0xb5af60=_[_0xa418('0x2e')](_0x1ce442,function(_0x568e33){return db['UserVoiceQueueRt'][_0xa418('0x8f')]({'membername':_0x568e33['name'],'UserId':_0x568e33['id'],'queue_name':_0x3125b4['name'],'VoiceQueueId':_0x3125b4['id'],'interface':_[_0xa418('0x90')](_0x568e33[_0xa418('0x8e')])?util[_0xa418('0x91')](_0xa418('0x92'),_0x568e33[_0xa418('0x2c')]):_0x568e33['interface'],'paused':_0x568e33['voicePause']||![],'penalty':_0x3125b4[_0xa418('0x87')][_0xa418('0x85')]},{'transaction':_0x3e1285});});return Promise[_0xa418('0x93')](_0xb5af60);});});});return Promise[_0xa418('0x93')](_0x30e307);});return Promise[_0xa418('0x93')](_0x36f5c5);})['then'](function(){return db[_0xa418('0x94')][_0xa418('0x6e')]({'where':{'teamId':_0x360f9a}})['then'](function(_0xc0a476){if(_0xc0a476){var _0xbfcdd6=_[_0xa418('0x2e')](_0xc60652,function(_0xc9ff13){db[_0xa418('0x6b')][_0xa418('0x8f')]({'UserId':_0xc9ff13,'VoicePrefixId':_0xc0a476[_0xa418('0x6c')]});});return Promise[_0xa418('0x93')](_0xbfcdd6);}});});});return Promise['all'](_0x4e537d)['then'](function(){return _0x429626[_0xa418('0x95')](_0xc60652,{'transaction':_0x3e1285})[_0xa418('0x96')](function(_0x26ca34){return _0x26ca34;});});});}})['then'](respondWithResult(_0x478889,null))[_0xa418('0x45')](handleError(_0x478889,null));};exports[_0xa418('0x97')]=function(_0x36b35d,_0xc0fcb){var _0xc8c6e1=_[_0xa418('0x98')](_0x36b35d['query'][_0xa418('0x7a')])?_0x36b35d[_0xa418('0x35')]['ids']:[_0x36b35d[_0xa418('0x35')][_0xa418('0x7a')]];var _0x244a3e=_0x36b35d[_0xa418('0x46')]['id'];return db[_0xa418('0x41')][_0xa418('0x48')]({'where':{'id':_0x244a3e}})[_0xa418('0x2a')](handleEntityNotFound(_0xc0fcb,null))[_0xa418('0x2a')](function(_0x53ee6c){if(_0x53ee6c){var _0x44f595=['Voice',_0xa418('0x7d'),_0xa418('0x7e'),_0xa418('0x7f'),'Fax','Openchannel',_0xa418('0x82')];return db['sequelize'][_0xa418('0x83')](function(_0x441b49){var _0x32895a=_['map'](_0x44f595,function(_0x19a4a2){var _0x58db71={'attributes':['id',_0xa418('0x2c')]};return _0x53ee6c['get'+_0x19a4a2+_0xa418('0x77')](_0x58db71)[_0xa418('0x2a')](function(_0x5c47cc){var _0x58071d=_[_0xa418('0x2e')](_0x5c47cc,function(_0xafade3){return _0xafade3[_0xa418('0x97')](_0xc8c6e1,{'transaction':_0x441b49})[_0xa418('0x2a')](function(){var _0x3b3d61=_[_0xa418('0x2e')](_0xc8c6e1,function(_0x45fd41){socket[_0xa418('0x8a')](_0xa418('0x4a')+_0x19a4a2+_0xa418('0x99'),{'UserId':Number(_0x45fd41),[_0x19a4a2+_0xa418('0x86')]:_0xafade3['id']});if(_0x19a4a2!==_0xa418('0x7c')){return;}return db[_0xa418('0x9a')][_0xa418('0x5b')]({'where':{'VoiceQueueId':_0xafade3['id'],'UserId':_0x45fd41},'transaction':_0x441b49});});return Promise[_0xa418('0x93')](_0x3b3d61);});});return Promise[_0xa418('0x93')](_0x58071d);});});return Promise['all'](_0x32895a)['then'](function(){return _0x53ee6c['removeAgents'](_0xc8c6e1,{'transaction':_0x441b49});})[_0xa418('0x2a')](function(){return db[_0xa418('0x94')][_0xa418('0x6e')]({'where':{'teamId':_0x244a3e}})[_0xa418('0x2a')](function(_0x310a97){if(_0x310a97){var _0x569660=_[_0xa418('0x2e')](_0xc8c6e1,function(_0x5034c8){db[_0xa418('0x6b')][_0xa418('0x5b')]({'where':{'UserId':_0x5034c8,'VoicePrefixId':_0x310a97['VoicePrefixId']}});});return Promise[_0xa418('0x93')](_0x569660);}});});});}})[_0xa418('0x2a')](respondWithStatusCode(_0xc0fcb,null))[_0xa418('0x45')](handleError(_0xc0fcb,null));};exports[_0xa418('0x9b')]=function(_0x38fcf0,_0x1a6514,_0x328a4a){var _0xee21e7={};var _0x188895={};var _0x53281f;var _0x4f94a5;return db[_0xa418('0x41')]['findOne']({'where':{'id':_0x38fcf0[_0xa418('0x46')]['id']}})[_0xa418('0x2a')](handleEntityNotFound(_0x1a6514,null))['then'](function(_0x148312){if(_0x148312){_0x53281f=_0x148312;_0x188895['model']=_['keys'](db[_0xa418('0x88')]['rawAttributes']);_0x188895[_0xa418('0x35')]=_[_0xa418('0x32')](_0x38fcf0[_0xa418('0x35')]);_0x188895['filters']=_[_0xa418('0x34')](_0x188895[_0xa418('0x31')],_0x188895[_0xa418('0x35')]);_0xee21e7[_0xa418('0x36')]=_[_0xa418('0x34')](_0x188895['model'],qs[_0xa418('0x37')](_0x38fcf0[_0xa418('0x35')]['fields']));_0xee21e7['attributes']=_0xee21e7[_0xa418('0x36')][_0xa418('0x38')]?_0xee21e7[_0xa418('0x36')]:_0x188895[_0xa418('0x31')];_0xee21e7[_0xa418('0x75')]=qs[_0xa418('0x3b')](_0x38fcf0[_0xa418('0x35')][_0xa418('0x3b')]);_0xee21e7[_0xa418('0x3c')]=qs[_0xa418('0x33')](_[_0xa418('0x3d')](_0x38fcf0[_0xa418('0x35')],_0x188895['filters']));if(_0x38fcf0[_0xa418('0x35')][_0xa418('0x3f')]){_0xee21e7[_0xa418('0x3c')]=_[_0xa418('0x3e')](_0xee21e7[_0xa418('0x3c')],{'$or':_[_0xa418('0x2e')](_0xee21e7[_0xa418('0x36')],function(_0x58033a){var _0x1798cf={};_0x1798cf[_0x58033a]={'$like':'%'+_0x38fcf0['query']['filter']+'%'};return _0x1798cf;})});}_0xee21e7=_[_0xa418('0x3e')]({},_0xee21e7,_0x38fcf0[_0xa418('0x40')]);return _0x53281f[_0xa418('0x9b')](_0xee21e7);}})[_0xa418('0x2a')](function(_0x2a897f){if(_0x2a897f){_0x4f94a5=_0x2a897f[_0xa418('0x38')];if(!_0x38fcf0[_0xa418('0x35')][_0xa418('0x39')]('nolimit')){_0xee21e7[_0xa418('0x23')]=qs[_0xa418('0x23')](_0x38fcf0[_0xa418('0x35')][_0xa418('0x23')]);_0xee21e7[_0xa418('0x25')]=qs['offset'](_0x38fcf0[_0xa418('0x35')]['offset']);}return _0x53281f[_0xa418('0x9b')](_0xee21e7);}})[_0xa418('0x2a')](function(_0x7834b2){if(_0x7834b2){return _0x7834b2?{'count':_0x4f94a5,'rows':_0x7834b2}:null;}})[_0xa418('0x2a')](respondWithResult(_0x1a6514,null))['catch'](handleError(_0x1a6514,null));}; \ No newline at end of file +var _0x8401=['ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','UserProfileResource','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','addQueues','add','removeQueues','Queues','addAgents','isArray','ids','Mail','Sms','Fax','Openchannel','Whatsapp','Voice','QueueId','penalty','User','findOrCreate','emit','Queue:save','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','TeamVoiceQueue','all','TeamVoicePrefix','Chat','removeAgents','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','../../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','./team.socket','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','error','stack','name','send','map','Team','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','findAll','then','rows','show','params','keys','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserVoiceQueue','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'];(function(_0x49a9e8,_0x4c6f63){var _0x4a0d6c=function(_0x4a24f4){while(--_0x4a24f4){_0x49a9e8['push'](_0x49a9e8['shift']());}};_0x4a0d6c(++_0x4c6f63);}(_0x8401,0xca));var _0x1840=function(_0x134353,_0x599b37){_0x134353=_0x134353-0x0;var _0x3ef328=_0x8401[_0x134353];return _0x3ef328;};'use strict';var emlformat=require(_0x1840('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1840('0x1'));var jsonpatch=require(_0x1840('0x2'));var rp=require(_0x1840('0x3'));var moment=require(_0x1840('0x4'));var BPromise=require(_0x1840('0x5'));var Mustache=require(_0x1840('0x6'));var util=require(_0x1840('0x7'));var path=require('path');var sox=require(_0x1840('0x8'));var csv=require(_0x1840('0x9'));var ejs=require(_0x1840('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1840('0xb'));var jsforce=require(_0x1840('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1840('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1840('0xe'));var as=require(_0x1840('0xf'));var hardwareService=require(_0x1840('0x10'));var logger=require(_0x1840('0x11'))(_0x1840('0x12'));var utils=require(_0x1840('0x13'));var config=require(_0x1840('0x14'));var licenseUtil=require(_0x1840('0x15'));var db=require(_0x1840('0x16'))['db'];config[_0x1840('0x17')]=_[_0x1840('0x18')](config[_0x1840('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x1840('0x19'))(new Redis(config[_0x1840('0x17')]));require(_0x1840('0x1a'))[_0x1840('0x1b')](socket);function respondWithStatusCode(_0x457b27,_0x44dce7){_0x44dce7=_0x44dce7||0xcc;return function(_0x20b0a9){if(_0x20b0a9){return _0x457b27[_0x1840('0x1c')](_0x44dce7);}return _0x457b27[_0x1840('0x1d')](_0x44dce7)['end']();};}function respondWithResult(_0x3bea31,_0x112c82){_0x112c82=_0x112c82||0xc8;return function(_0x24ca73){if(_0x24ca73){return _0x3bea31[_0x1840('0x1d')](_0x112c82)[_0x1840('0x1e')](_0x24ca73);}};}function respondWithFilteredResult(_0x202d21,_0x515777){return function(_0x212694){if(_0x212694){var _0x212d22=typeof _0x515777[_0x1840('0x1f')]===_0x1840('0x20')&&typeof _0x515777['limit']===_0x1840('0x20');var _0x33cf07=_0x212694[_0x1840('0x21')];var _0x1a5807=_0x212d22?0x0:_0x515777[_0x1840('0x1f')];var _0x531017=_0x212d22?_0x212694['count']:_0x515777[_0x1840('0x1f')]+_0x515777[_0x1840('0x22')];var _0x51b8f3;if(_0x531017>=_0x33cf07){_0x531017=_0x33cf07;_0x51b8f3=0xc8;}else{_0x51b8f3=0xce;}_0x202d21[_0x1840('0x1d')](_0x51b8f3);return _0x202d21['set']('Content-Range',_0x1a5807+'-'+_0x531017+'/'+_0x33cf07)[_0x1840('0x1e')](_0x212694);}return null;};}function patchUpdates(_0x442162){return function(_0x50f340){try{jsonpatch[_0x1840('0x23')](_0x50f340,_0x442162,!![]);}catch(_0x1d986a){return BPromise[_0x1840('0x24')](_0x1d986a);}return _0x50f340[_0x1840('0x25')]();};}function saveUpdates(_0x1922f1,_0x1130cf){return function(_0x2a68c6){if(_0x2a68c6){return _0x2a68c6['update'](_0x1922f1)['then'](function(_0x544027){return _0x544027;});}return null;};}function handleEntityNotFound(_0x215e3f,_0x2b733d){return function(_0x4d0b36){if(!_0x4d0b36){_0x215e3f[_0x1840('0x1c')](0x194);}return _0x4d0b36;};}function handleError(_0x2b7753,_0x3de3b1){_0x3de3b1=_0x3de3b1||0x1f4;return function(_0x3e993e){logger[_0x1840('0x26')](_0x3e993e[_0x1840('0x27')]);if(_0x3e993e[_0x1840('0x28')]){delete _0x3e993e['name'];}_0x2b7753[_0x1840('0x1d')](_0x3de3b1)[_0x1840('0x29')](_0x3e993e);};}exports['index']=function(_0x5a0b36,_0x24613c){var _0x1ffa5b={},_0x2ce091={},_0x544c3a={'count':0x0,'rows':[]};var _0x3fbf51=_[_0x1840('0x2a')](db[_0x1840('0x2b')][_0x1840('0x2c')],function(_0x7e1793){return{'name':_0x7e1793['fieldName'],'type':_0x7e1793[_0x1840('0x2d')][_0x1840('0x2e')]};});_0x2ce091[_0x1840('0x2f')]=_[_0x1840('0x2a')](_0x3fbf51,_0x1840('0x28'));_0x2ce091[_0x1840('0x30')]=_['keys'](_0x5a0b36[_0x1840('0x30')]);_0x2ce091[_0x1840('0x31')]=_['intersection'](_0x2ce091[_0x1840('0x2f')],_0x2ce091[_0x1840('0x30')]);_0x1ffa5b['attributes']=_[_0x1840('0x32')](_0x2ce091[_0x1840('0x2f')],qs[_0x1840('0x33')](_0x5a0b36['query'][_0x1840('0x33')]));_0x1ffa5b[_0x1840('0x34')]=_0x1ffa5b['attributes'][_0x1840('0x35')]?_0x1ffa5b[_0x1840('0x34')]:_0x2ce091[_0x1840('0x2f')];if(!_0x5a0b36['query'][_0x1840('0x36')](_0x1840('0x37'))){_0x1ffa5b[_0x1840('0x22')]=qs[_0x1840('0x22')](_0x5a0b36[_0x1840('0x30')][_0x1840('0x22')]);_0x1ffa5b['offset']=qs['offset'](_0x5a0b36[_0x1840('0x30')][_0x1840('0x1f')]);}_0x1ffa5b[_0x1840('0x38')]=qs[_0x1840('0x39')](_0x5a0b36['query'][_0x1840('0x39')]);_0x1ffa5b['where']=qs[_0x1840('0x31')](_['pick'](_0x5a0b36[_0x1840('0x30')],_0x2ce091['filters']),_0x3fbf51);if(_0x5a0b36['query'][_0x1840('0x3a')]){_0x1ffa5b[_0x1840('0x3b')]=_['merge'](_0x1ffa5b[_0x1840('0x3b')],{'$or':_[_0x1840('0x2a')](_0x3fbf51,function(_0xb52fc7){if(_0xb52fc7['type']!==_0x1840('0x3c')){var _0x44f321={};_0x44f321[_0xb52fc7['name']]={'$like':'%'+_0x5a0b36['query'][_0x1840('0x3a')]+'%'};return _0x44f321;}})});}_0x1ffa5b=_[_0x1840('0x3d')]({},_0x1ffa5b,_0x5a0b36[_0x1840('0x3e')]);var _0x49306e={'where':_0x1ffa5b[_0x1840('0x3b')]};return db[_0x1840('0x2b')]['count'](_0x49306e)['then'](function(_0x1bf0c1){_0x544c3a[_0x1840('0x21')]=_0x1bf0c1;if(_0x5a0b36[_0x1840('0x30')][_0x1840('0x3f')]){_0x1ffa5b['include']=[{'all':!![]}];}return db[_0x1840('0x2b')][_0x1840('0x40')](_0x1ffa5b);})[_0x1840('0x41')](function(_0x393041){_0x544c3a[_0x1840('0x42')]=_0x393041;return _0x544c3a;})[_0x1840('0x41')](respondWithFilteredResult(_0x24613c,_0x1ffa5b))['catch'](handleError(_0x24613c,null));};exports[_0x1840('0x43')]=function(_0x4cf037,_0x431ed9){var _0x2f85ba={'raw':![],'where':{'id':_0x4cf037[_0x1840('0x44')]['id']}},_0x10261d={};_0x10261d['model']=_['keys'](db[_0x1840('0x2b')][_0x1840('0x2c')]);_0x10261d['query']=_[_0x1840('0x45')](_0x4cf037[_0x1840('0x30')]);_0x10261d[_0x1840('0x31')]=_[_0x1840('0x32')](_0x10261d['model'],_0x10261d['query']);_0x2f85ba[_0x1840('0x34')]=_[_0x1840('0x32')](_0x10261d[_0x1840('0x2f')],qs[_0x1840('0x33')](_0x4cf037[_0x1840('0x30')][_0x1840('0x33')]));_0x2f85ba[_0x1840('0x34')]=_0x2f85ba[_0x1840('0x34')][_0x1840('0x35')]?_0x2f85ba[_0x1840('0x34')]:_0x10261d[_0x1840('0x2f')];if(_0x4cf037[_0x1840('0x30')]['includeAll']){_0x2f85ba[_0x1840('0x46')]=[{'all':!![]}];}_0x2f85ba=_[_0x1840('0x3d')]({},_0x2f85ba,_0x4cf037['options']);return db[_0x1840('0x2b')]['find'](_0x2f85ba)[_0x1840('0x41')](handleEntityNotFound(_0x431ed9,null))[_0x1840('0x41')](respondWithResult(_0x431ed9,null))['catch'](handleError(_0x431ed9,null));};exports['create']=function(_0x15a046,_0x2ef03c){return db[_0x1840('0x2b')][_0x1840('0x47')](_0x15a046[_0x1840('0x48')],{})[_0x1840('0x41')](function(_0x48c86d){var _0x3da1fc=_0x15a046[_0x1840('0x49')][_0x1840('0x4a')]({'plain':!![]});if(!_0x3da1fc)throw new Error(_0x1840('0x4b'));if(_0x3da1fc[_0x1840('0x4c')]===_0x1840('0x49')){var _0x54f811=_0x48c86d[_0x1840('0x4a')]({'plain':!![]});var _0x32e760=_0x1840('0x4d');return db[_0x1840('0x4e')]['find']({'where':{'name':_0x32e760,'userProfileId':_0x3da1fc['userProfileId']},'raw':!![]})[_0x1840('0x41')](function(_0x15cc6c){if(_0x15cc6c&&_0x15cc6c[_0x1840('0x4f')]===0x0){return db['UserProfileResource'][_0x1840('0x47')]({'name':_0x54f811[_0x1840('0x28')],'resourceId':_0x54f811['id'],'type':_0x15cc6c[_0x1840('0x28')],'sectionId':_0x15cc6c['id']},{})[_0x1840('0x41')](function(){return _0x48c86d;});}else{return _0x48c86d;}})[_0x1840('0x50')](function(_0x58312b){logger[_0x1840('0x26')](_0x1840('0x51'),_0x58312b);throw _0x58312b;});}return _0x48c86d;})[_0x1840('0x41')](respondWithResult(_0x2ef03c,0xc9))['catch'](handleError(_0x2ef03c,null));};exports['update']=function(_0x4243c3,_0x134f27){if(_0x4243c3[_0x1840('0x48')]['id']){delete _0x4243c3[_0x1840('0x48')]['id'];}return db['Team'][_0x1840('0x52')]({'where':{'id':_0x4243c3[_0x1840('0x44')]['id']}})[_0x1840('0x41')](handleEntityNotFound(_0x134f27,null))[_0x1840('0x41')](saveUpdates(_0x4243c3['body'],null))[_0x1840('0x41')](respondWithResult(_0x134f27,null))[_0x1840('0x50')](handleError(_0x134f27,null));};exports[_0x1840('0x53')]=function(_0xc559da,_0x43e1bb){var _0x368478=_0xc559da[_0x1840('0x44')]['id'];var _0x56dbe4=[];return db[_0x1840('0x54')][_0x1840('0x55')](function(_0x1ab8da){var _0x3c6201=_0x1840('0x56')+_0x368478;return db[_0x1840('0x54')][_0x1840('0x30')](_0x3c6201,{'type':db['Sequelize'][_0x1840('0x57')][_0x1840('0x58')],'raw':!![],'transaction':_0x1ab8da})[_0x1840('0x41')](function(_0x2cea79){_0x56dbe4=_[_0x1840('0x2a')](_0x2cea79,function(_0x246aec){return Number(_0x246aec[_0x1840('0x59')]);});})[_0x1840('0x41')](function(){var _0x24a729=_0x1840('0x5a')+_0x368478;return db[_0x1840('0x54')][_0x1840('0x30')](_0x24a729,{'type':db[_0x1840('0x5b')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1ab8da});})[_0x1840('0x41')](function(_0x2f3566){var _0x543d4e=_[_0x1840('0x2a')](_0x2f3566,function(_0x19bfa2){return Number(_0x19bfa2['VoiceQueueId']);});return db[_0x1840('0x5c')][_0x1840('0x53')]({'where':{'UserId':{'$in':_0x56dbe4},'VoiceQueueId':{'$in':_0x543d4e}},'transaction':_0x1ab8da});})[_0x1840('0x41')](function(){var _0x48d15d=_0x1840('0x5d')+_0x368478;return db[_0x1840('0x54')][_0x1840('0x30')](_0x48d15d,{'type':db['Sequelize'][_0x1840('0x57')][_0x1840('0x58')],'raw':!![],'transaction':_0x1ab8da});})[_0x1840('0x41')](function(_0x39f9c1){var _0x46d7ea=_['map'](_0x39f9c1,function(_0x22d727){return Number(_0x22d727[_0x1840('0x5e')]);});return db[_0x1840('0x5f')][_0x1840('0x53')]({'where':{'UserId':{'$in':_0x56dbe4},'MailQueueId':{'$in':_0x46d7ea}},'transaction':_0x1ab8da});})[_0x1840('0x41')](function(){var _0x44e31f='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x368478;return db[_0x1840('0x54')]['query'](_0x44e31f,{'type':db[_0x1840('0x5b')][_0x1840('0x57')][_0x1840('0x58')],'raw':!![],'transaction':_0x1ab8da});})[_0x1840('0x41')](function(_0x56542b){var _0x27b75d=_['map'](_0x56542b,function(_0x385257){return Number(_0x385257[_0x1840('0x60')]);});return db['UserSmsQueue'][_0x1840('0x53')]({'where':{'UserId':{'$in':_0x56dbe4},'SmsQueueId':{'$in':_0x27b75d}},'transaction':_0x1ab8da});})['then'](function(){var _0x4b8767=_0x1840('0x61')+_0x368478;return db['sequelize'][_0x1840('0x30')](_0x4b8767,{'type':db['Sequelize'][_0x1840('0x57')][_0x1840('0x58')],'raw':!![],'transaction':_0x1ab8da});})['then'](function(_0x3b8cdd){var _0x1ca37f=_[_0x1840('0x2a')](_0x3b8cdd,function(_0x1a9f64){return Number(_0x1a9f64[_0x1840('0x62')]);});return db[_0x1840('0x63')]['destroy']({'where':{'UserId':{'$in':_0x56dbe4},'ChatQueueId':{'$in':_0x1ca37f}},'transaction':_0x1ab8da});})[_0x1840('0x41')](function(){var _0x383dbd=_0x1840('0x64')+_0x368478;return db[_0x1840('0x54')][_0x1840('0x30')](_0x383dbd,{'type':db['Sequelize'][_0x1840('0x57')][_0x1840('0x58')],'raw':!![],'transaction':_0x1ab8da});})[_0x1840('0x41')](function(_0x4c2147){var _0x203f6e=_[_0x1840('0x2a')](_0x4c2147,function(_0x3788cd){return Number(_0x3788cd[_0x1840('0x65')]);});return db['UserFaxQueue'][_0x1840('0x53')]({'where':{'UserId':{'$in':_0x56dbe4},'FaxQueueId':{'$in':_0x203f6e}},'transaction':_0x1ab8da});})[_0x1840('0x41')](function(){var _0xac12f4='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x368478;return db[_0x1840('0x54')][_0x1840('0x30')](_0xac12f4,{'type':db['Sequelize'][_0x1840('0x57')][_0x1840('0x58')],'raw':!![],'transaction':_0x1ab8da});})[_0x1840('0x41')](function(_0x1a4900){var _0xcd183e=_[_0x1840('0x2a')](_0x1a4900,function(_0x258349){return Number(_0x258349[_0x1840('0x66')]);});return db[_0x1840('0x67')][_0x1840('0x53')]({'where':{'UserId':{'$in':_0x56dbe4},'OpenchannelQueueId':{'$in':_0xcd183e}},'transaction':_0x1ab8da});})[_0x1840('0x41')](function(){var _0x3a9df2=_0x1840('0x68')+_0x368478;return db[_0x1840('0x54')][_0x1840('0x30')](_0x3a9df2,{'type':db[_0x1840('0x5b')][_0x1840('0x57')]['SELECT'],'raw':!![],'transaction':_0x1ab8da});})[_0x1840('0x41')](function(_0x5a4273){var _0x2b34bb=_[_0x1840('0x2a')](_0x5a4273,function(_0x2cdd12){return Number(_0x2cdd12[_0x1840('0x69')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x56dbe4},'WhatsappQueueId':{'$in':_0x2b34bb}},'transaction':_0x1ab8da});})[_0x1840('0x41')](function(){return db['TeamVoicePrefix'][_0x1840('0x52')]({'where':{'TeamId':_0x368478}});})['then'](function(_0xa3cf77){if(_0xa3cf77===null){return;}return db[_0x1840('0x6a')][_0x1840('0x53')]({'where':{'UserId':{'$in':_0x56dbe4},'VoicePrefixId':_0xa3cf77[_0x1840('0x6b')]},'transaction':_0x1ab8da});})[_0x1840('0x41')](function(){return db[_0x1840('0x2b')][_0x1840('0x53')]({'where':{'id':_0x368478},'cascade':!![],'transaction':_0x1ab8da});})[_0x1840('0x41')](function(_0x6693d2){if(_0x6693d2===0x0){_0x43e1bb[_0x1840('0x1c')](0x194);}else{return db[_0x1840('0x6c')][_0x1840('0x53')]({'where':{'type':_0x1840('0x4d'),'resourceId':_0x368478},'cascade':!![],'transaction':_0x1ab8da})['then'](function(){_0x43e1bb[_0x1840('0x1d')](0xcc)['end']();});}})['catch'](function(_0x5f2282){_0x43e1bb[_0x1840('0x1d')](0x1f4)[_0x1840('0x29')](_0x5f2282);});});};exports['getQueues']=function(_0x414bd6,_0x179cb5,_0x2650fa){return db[_0x1840('0x2b')][_0x1840('0x6d')]({'where':{'id':_0x414bd6['params']['id']}})[_0x1840('0x41')](handleEntityNotFound(_0x179cb5,null))['then'](function(_0x4754d3){if(!_0x414bd6[_0x1840('0x30')][_0x1840('0x6e')]||!utils[_0x1840('0x6f')](_0x414bd6[_0x1840('0x30')][_0x1840('0x6e')])){throw new db[(_0x1840('0x5b'))][(_0x1840('0x70'))](_0x1840('0x71'));}var _0x881b8a={};var _0x4b0bd3={};_0x4b0bd3[_0x1840('0x2f')]=_[_0x1840('0x45')](db[_[_0x1840('0x72')](_0x414bd6[_0x1840('0x30')]['channel'][_0x1840('0x73')]())+_0x1840('0x74')]['rawAttributes']);_0x4b0bd3[_0x1840('0x30')]=_['keys'](_0x414bd6[_0x1840('0x30')]);_0x4b0bd3['filters']=_[_0x1840('0x32')](_0x4b0bd3['model'],_0x4b0bd3[_0x1840('0x30')]);_0x881b8a[_0x1840('0x34')]=_[_0x1840('0x32')](_0x4b0bd3[_0x1840('0x2f')],qs[_0x1840('0x33')](_0x414bd6[_0x1840('0x30')][_0x1840('0x33')]));_0x881b8a[_0x1840('0x34')]=_0x881b8a['attributes'][_0x1840('0x35')]?_0x881b8a[_0x1840('0x34')]:_0x4b0bd3[_0x1840('0x2f')];_0x881b8a['limit']=qs[_0x1840('0x22')](_0x414bd6[_0x1840('0x30')][_0x1840('0x22')]);_0x881b8a['offset']=qs[_0x1840('0x1f')](_0x414bd6[_0x1840('0x30')][_0x1840('0x1f')]);_0x881b8a[_0x1840('0x38')]=qs[_0x1840('0x39')](_0x414bd6[_0x1840('0x30')][_0x1840('0x39')]);_0x881b8a[_0x1840('0x3b')]=qs['filters'](_[_0x1840('0x75')](_0x414bd6[_0x1840('0x30')],_0x4b0bd3[_0x1840('0x31')]));_0x881b8a=_[_0x1840('0x3d')]({},_0x881b8a,_0x414bd6[_0x1840('0x3e')]);return _0x4754d3[_0x1840('0x4a')+_[_0x1840('0x72')](_0x414bd6[_0x1840('0x30')]['channel']['toLowerCase']())+'Queues'](_0x881b8a);})[_0x1840('0x41')](respondWithResult(_0x179cb5,null))[_0x1840('0x50')](handleError(_0x179cb5,null));};exports[_0x1840('0x76')]=function(_0x28cecf,_0x4e0d44,_0x1bbee1){return db[_0x1840('0x2b')]['findOne']({'where':{'id':_0x28cecf[_0x1840('0x44')]['id']}})[_0x1840('0x41')](function(_0x3ac299){if(_0x3ac299){if(!_0x28cecf['body']['channel']||!utils[_0x1840('0x6f')](_0x28cecf[_0x1840('0x48')]['channel'])){throw new db['Sequelize'][(_0x1840('0x70'))](_0x1840('0x71'));}return _0x3ac299[_0x1840('0x77')+_[_0x1840('0x72')](_0x28cecf['body'][_0x1840('0x6e')][_0x1840('0x73')]())+'Queues'](_0x28cecf[_0x1840('0x48')]['ids']);}return null;})[_0x1840('0x41')](handleEntityNotFound(_0x4e0d44,null))['then'](respondWithStatusCode(_0x4e0d44,null))[_0x1840('0x50')](handleError(_0x4e0d44,null));};exports[_0x1840('0x78')]=function(_0x405e3c,_0x3cfa78,_0x124f7f){return db['Team']['findOne']({'where':{'id':_0x405e3c[_0x1840('0x44')]['id']}})[_0x1840('0x41')](function(_0x13be6d){if(_0x13be6d){if(!_0x405e3c[_0x1840('0x30')][_0x1840('0x6e')]||!utils['isValidChannel'](_0x405e3c['query'][_0x1840('0x6e')])){throw new db[(_0x1840('0x5b'))]['ValidationError'](_0x1840('0x71'));}return _0x13be6d['remove'+_['capitalize'](_0x405e3c['query'][_0x1840('0x6e')]['toLowerCase']())+_0x1840('0x79')](_0x405e3c[_0x1840('0x30')]['ids']);}return null;})[_0x1840('0x41')](handleEntityNotFound(_0x3cfa78,null))['then'](respondWithStatusCode(_0x3cfa78,null))[_0x1840('0x50')](handleError(_0x3cfa78,null));};exports[_0x1840('0x7a')]=function(_0x2bbb35,_0x5daca2){var _0x12a9e5=_[_0x1840('0x7b')](_0x2bbb35[_0x1840('0x48')][_0x1840('0x7c')])?_0x2bbb35[_0x1840('0x48')][_0x1840('0x7c')]:[_0x2bbb35[_0x1840('0x48')][_0x1840('0x7c')]];var _0x13e06a=_0x2bbb35[_0x1840('0x44')]['id'];return db[_0x1840('0x2b')][_0x1840('0x52')]({'where':{'id':_0x13e06a}})[_0x1840('0x41')](handleEntityNotFound(_0x5daca2,null))[_0x1840('0x41')](function(_0x54d0c8){if(_0x54d0c8){var _0x32bbaa=['Voice','Chat',_0x1840('0x7d'),_0x1840('0x7e'),_0x1840('0x7f'),_0x1840('0x80'),_0x1840('0x81')];return db['sequelize'][_0x1840('0x55')](function(_0x2b7388){var _0x315927=_[_0x1840('0x2a')](_0x32bbaa,function(_0x34f106){var _0x24002e={'attributes':['id',_0x1840('0x28')]};if(_0x34f106===_0x1840('0x82')){_0x24002e['through']={'attributes':['penalty']};}return _0x54d0c8['get'+_0x34f106+_0x1840('0x79')](_0x24002e)[_0x1840('0x41')](function(_0x43c6ce){var _0x55bb5a=_['map'](_0x43c6ce,function(_0x4c62a5){var _0x2d287d=_[_0x1840('0x2a')](_0x12a9e5,function(_0x4fc8ad){var _0x56d1ab={'where':{'UserId':_0x4fc8ad,[_0x34f106+_0x1840('0x83')]:_0x4c62a5['id']},'transaction':_0x2b7388};if(_0x34f106===_0x1840('0x82')){_0x56d1ab[_0x1840('0x18')]={'penalty':_0x4c62a5['TeamVoiceQueue'][_0x1840('0x84')]};}return db[_0x1840('0x85')+_0x34f106+_0x1840('0x74')][_0x1840('0x86')](_0x56d1ab)[_0x1840('0x41')](function(){socket[_0x1840('0x87')](_0x1840('0x49')+_0x34f106+_0x1840('0x88'),{'UserId':_0x4fc8ad,[_0x34f106+'QueueId']:_0x4c62a5['id']});if(_0x34f106!==_0x1840('0x82')){return;}return db[_0x1840('0x85')]['findAll']({'where':{'id':_0x12a9e5,'online':0x1},'attributes':['id','name','online',_0x1840('0x89'),_0x1840('0x8a')],'raw':!![]})['then'](function(_0x2c78b8){var _0xc278cc=_['map'](_0x2c78b8,function(_0x125d43){return db[_0x1840('0x8b')][_0x1840('0x8c')]({'membername':_0x125d43[_0x1840('0x28')],'UserId':_0x125d43['id'],'queue_name':_0x4c62a5['name'],'VoiceQueueId':_0x4c62a5['id'],'interface':_[_0x1840('0x8d')](_0x125d43['interface'])?util[_0x1840('0x8e')]('SIP/%s',_0x125d43[_0x1840('0x28')]):_0x125d43[_0x1840('0x8a')],'paused':_0x125d43[_0x1840('0x89')]||![],'penalty':_0x4c62a5[_0x1840('0x8f')][_0x1840('0x84')]},{'transaction':_0x2b7388});});return Promise[_0x1840('0x90')](_0xc278cc);});});});return Promise[_0x1840('0x90')](_0x2d287d);});return Promise[_0x1840('0x90')](_0x55bb5a);})[_0x1840('0x41')](function(){return db[_0x1840('0x91')][_0x1840('0x6d')]({'where':{'teamId':_0x13e06a}})['then'](function(_0x25d394){if(_0x25d394){var _0x21e54f=_[_0x1840('0x2a')](_0x12a9e5,function(_0x3c85bf){db[_0x1840('0x6a')][_0x1840('0x8c')]({'UserId':_0x3c85bf,'VoicePrefixId':_0x25d394[_0x1840('0x6b')]});});return Promise[_0x1840('0x90')](_0x21e54f);}});});});return Promise[_0x1840('0x90')](_0x315927)[_0x1840('0x41')](function(){return _0x54d0c8[_0x1840('0x7a')](_0x12a9e5,{'transaction':_0x2b7388})['spread'](function(_0x41de92){return _0x41de92;});});});}})[_0x1840('0x41')](respondWithResult(_0x5daca2,null))[_0x1840('0x50')](handleError(_0x5daca2,null));};exports['removeAgents']=function(_0x34f228,_0x2f0cb0){var _0x80bff3=_['isArray'](_0x34f228[_0x1840('0x30')][_0x1840('0x7c')])?_0x34f228[_0x1840('0x30')][_0x1840('0x7c')]:[_0x34f228[_0x1840('0x30')][_0x1840('0x7c')]];var _0x548a77=_0x34f228[_0x1840('0x44')]['id'];return db[_0x1840('0x2b')][_0x1840('0x52')]({'where':{'id':_0x548a77}})[_0x1840('0x41')](handleEntityNotFound(_0x2f0cb0,null))[_0x1840('0x41')](function(_0x3f5717){if(_0x3f5717){var _0x310310=['Voice',_0x1840('0x92'),_0x1840('0x7d'),_0x1840('0x7e'),'Fax','Openchannel',_0x1840('0x81')];return db['sequelize'][_0x1840('0x55')](function(_0x1e3e1a){var _0x32e9bc=_[_0x1840('0x2a')](_0x310310,function(_0x388f6c){var _0x5d4487={'attributes':['id',_0x1840('0x28')]};return _0x3f5717[_0x1840('0x4a')+_0x388f6c+_0x1840('0x79')](_0x5d4487)[_0x1840('0x41')](function(_0x2afce7){var _0x4e648f=_[_0x1840('0x2a')](_0x2afce7,function(_0x478e0f){return _0x478e0f[_0x1840('0x93')](_0x80bff3,{'transaction':_0x1e3e1a})[_0x1840('0x41')](function(){var _0x2e8f06=_[_0x1840('0x2a')](_0x80bff3,function(_0x22b639){socket[_0x1840('0x87')](_0x1840('0x49')+_0x388f6c+_0x1840('0x94'),{'UserId':Number(_0x22b639),[_0x388f6c+_0x1840('0x83')]:_0x478e0f['id']});if(_0x388f6c!==_0x1840('0x82')){return;}return db[_0x1840('0x8b')]['destroy']({'where':{'VoiceQueueId':_0x478e0f['id'],'UserId':_0x22b639},'transaction':_0x1e3e1a});});return Promise['all'](_0x2e8f06);});});return Promise[_0x1840('0x90')](_0x4e648f);});});return Promise['all'](_0x32e9bc)[_0x1840('0x41')](function(){return _0x3f5717['removeAgents'](_0x80bff3,{'transaction':_0x1e3e1a});})[_0x1840('0x41')](function(){return db[_0x1840('0x91')][_0x1840('0x6d')]({'where':{'teamId':_0x548a77}})[_0x1840('0x41')](function(_0x55926f){if(_0x55926f){var _0x551738=_[_0x1840('0x2a')](_0x80bff3,function(_0x777a9f){db['UserVoicePrefix'][_0x1840('0x53')]({'where':{'UserId':_0x777a9f,'VoicePrefixId':_0x55926f[_0x1840('0x6b')]}});});return Promise[_0x1840('0x90')](_0x551738);}});});});}})['then'](respondWithStatusCode(_0x2f0cb0,null))[_0x1840('0x50')](handleError(_0x2f0cb0,null));};exports[_0x1840('0x95')]=function(_0x4f8a9a,_0x5987a6,_0x46c3fe){var _0x44c269={};var _0xd6907b={};var _0x53ddbd;var _0x2c8515;return db[_0x1840('0x2b')][_0x1840('0x6d')]({'where':{'id':_0x4f8a9a[_0x1840('0x44')]['id']}})[_0x1840('0x41')](handleEntityNotFound(_0x5987a6,null))['then'](function(_0x1ec18e){if(_0x1ec18e){_0x53ddbd=_0x1ec18e;_0xd6907b[_0x1840('0x2f')]=_[_0x1840('0x45')](db[_0x1840('0x85')][_0x1840('0x2c')]);_0xd6907b[_0x1840('0x30')]=_[_0x1840('0x45')](_0x4f8a9a[_0x1840('0x30')]);_0xd6907b[_0x1840('0x31')]=_[_0x1840('0x32')](_0xd6907b[_0x1840('0x2f')],_0xd6907b[_0x1840('0x30')]);_0x44c269[_0x1840('0x34')]=_[_0x1840('0x32')](_0xd6907b[_0x1840('0x2f')],qs[_0x1840('0x33')](_0x4f8a9a[_0x1840('0x30')][_0x1840('0x33')]));_0x44c269[_0x1840('0x34')]=_0x44c269[_0x1840('0x34')][_0x1840('0x35')]?_0x44c269['attributes']:_0xd6907b[_0x1840('0x2f')];_0x44c269[_0x1840('0x38')]=qs[_0x1840('0x39')](_0x4f8a9a['query'][_0x1840('0x39')]);_0x44c269[_0x1840('0x3b')]=qs[_0x1840('0x31')](_['pick'](_0x4f8a9a[_0x1840('0x30')],_0xd6907b['filters']));if(_0x4f8a9a[_0x1840('0x30')][_0x1840('0x3a')]){_0x44c269[_0x1840('0x3b')]=_['merge'](_0x44c269[_0x1840('0x3b')],{'$or':_[_0x1840('0x2a')](_0x44c269[_0x1840('0x34')],function(_0x3084bd){var _0x63f51d={};_0x63f51d[_0x3084bd]={'$like':'%'+_0x4f8a9a[_0x1840('0x30')]['filter']+'%'};return _0x63f51d;})});}_0x44c269=_[_0x1840('0x3d')]({},_0x44c269,_0x4f8a9a['options']);return _0x53ddbd[_0x1840('0x95')](_0x44c269);}})[_0x1840('0x41')](function(_0x230f95){if(_0x230f95){_0x2c8515=_0x230f95[_0x1840('0x35')];if(!_0x4f8a9a[_0x1840('0x30')][_0x1840('0x36')](_0x1840('0x37'))){_0x44c269[_0x1840('0x22')]=qs[_0x1840('0x22')](_0x4f8a9a[_0x1840('0x30')][_0x1840('0x22')]);_0x44c269[_0x1840('0x1f')]=qs[_0x1840('0x1f')](_0x4f8a9a['query']['offset']);}return _0x53ddbd[_0x1840('0x95')](_0x44c269);}})[_0x1840('0x41')](function(_0x576292){if(_0x576292){return _0x576292?{'count':_0x2c8515,'rows':_0x576292}:null;}})[_0x1840('0x41')](respondWithResult(_0x5987a6,null))[_0x1840('0x50')](handleError(_0x5987a6,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 91c367f..49653be 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 _0x1622=['hook','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x157dc4,_0x15e4fc){var _0x2aeaca=function(_0x47ff5f){while(--_0x47ff5f){_0x157dc4['push'](_0x157dc4['shift']());}};_0x2aeaca(++_0x15e4fc);}(_0x1622,0x115));var _0x2162=function(_0x42fced,_0x55d428){_0x42fced=_0x42fced-0x0;var _0x12c61e=_0x1622[_0x42fced];return _0x12c61e;};'use strict';var EventEmitter=require(_0x2162('0x0'));var Team=require(_0x2162('0x1'))['db'][_0x2162('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x2162('0x3')](0x0);var events={'afterCreate':_0x2162('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2c37c0){return function(_0x2146ec,_0x2440f5,_0x4999bf){TeamEvents['emit'](_0x2c37c0+':'+_0x2146ec['id'],_0x2146ec);TeamEvents['emit'](_0x2c37c0,_0x2146ec);_0x4999bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x2162('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x1f70=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x36c988,_0x13919d){var _0x2390aa=function(_0x3e3a58){while(--_0x3e3a58){_0x36c988['push'](_0x36c988['shift']());}};_0x2390aa(++_0x13919d);}(_0x1f70,0x166));var _0x01f7=function(_0xd5c25a,_0x2afb4a){_0xd5c25a=_0xd5c25a-0x0;var _0x23219a=_0x1f70[_0xd5c25a];return _0x23219a;};'use strict';var EventEmitter=require('events');var Team=require(_0x01f7('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x01f7('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x01f7('0x2'),'afterDestroy':_0x01f7('0x3')};function emitEvent(_0x510da2){return function(_0x5e1646,_0x2e4f7e,_0xe745c7){TeamEvents['emit'](_0x510da2+':'+_0x5e1646['id'],_0x5e1646);TeamEvents[_0x01f7('0x4')](_0x510da2,_0x5e1646);_0xe745c7(null);};}for(var e in events){if(events[_0x01f7('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x01f7('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 0d6741f..de082f2 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 _0xd023=['then','setDataValue','channel','catch','exports','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','map','lodash','get','Queues'];(function(_0x1c8bd4,_0x21672c){var _0x576cf8=function(_0x24ffb8){while(--_0x24ffb8){_0x1c8bd4['push'](_0x1c8bd4['shift']());}};_0x576cf8(++_0x21672c);}(_0xd023,0xe1));var _0x3d02=function(_0x17c8a9,_0x531ca3){_0x17c8a9=_0x17c8a9-0x0;var _0x379aa6=_0xd023[_0x17c8a9];return _0x379aa6;};'use strict';var _=require(_0x3d02('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x3e0ebc,_0x3ab086){var _0x591923=_0x3d02('0x1')+_0x3ab086+_0x3d02('0x2');return _0x3e0ebc[_0x591923]()[_0x3d02('0x3')](function(_0x4179dd){return _['map'](_0x4179dd,function(_0x3813b7){_0x3813b7[_0x3d02('0x4')](_0x3d02('0x5'),_0x3ab086);return _0x3813b7;});})[_0x3d02('0x6')](function(_0x593f24){throw _0x593f24;});}module[_0x3d02('0x7')]=function(_0x3589b4){return _0x3589b4['define'](_0x3d02('0x8'),attributes,{'tableName':_0x3d02('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5089b8=this;var _0x42789f=[_0x3d02('0xa'),_0x3d02('0xb'),_0x3d02('0xc'),_0x3d02('0xd'),_0x3d02('0xe'),_0x3d02('0xf'),_0x3d02('0x10')];return Promise[_0x3d02('0x11')]()[_0x3d02('0x3')](function(){var _0x599c42=_[_0x3d02('0x12')](_0x42789f,function(_0x25e055){return getQueuesByChannel(_0x5089b8,_0x25e055);});return Promise['all'](_0x599c42);})[_0x3d02('0x6')](function(_0x2258ce){throw _0x2258ce;});}}});}; \ No newline at end of file +var _0x1d4d=['get','Queues','then','map','setDataValue','channel','catch','exports','define','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','all','./team.attributes'];(function(_0x43413d,_0xfa89eb){var _0x344ef5=function(_0x2e2bab){while(--_0x2e2bab){_0x43413d['push'](_0x43413d['shift']());}};_0x344ef5(++_0xfa89eb);}(_0x1d4d,0x1b4));var _0xd1d4=function(_0xfb7a5a,_0x2aa2a5){_0xfb7a5a=_0xfb7a5a-0x0;var _0x13b1d7=_0x1d4d[_0xfb7a5a];return _0x13b1d7;};'use strict';var _=require('lodash');var attributes=require(_0xd1d4('0x0'));function getQueuesByChannel(_0x1325f1,_0xf6f01e){var _0x378c57=_0xd1d4('0x1')+_0xf6f01e+_0xd1d4('0x2');return _0x1325f1[_0x378c57]()[_0xd1d4('0x3')](function(_0x1ed1a2){return _[_0xd1d4('0x4')](_0x1ed1a2,function(_0x2e14ab){_0x2e14ab[_0xd1d4('0x5')](_0xd1d4('0x6'),_0xf6f01e);return _0x2e14ab;});})[_0xd1d4('0x7')](function(_0x492183){throw _0x492183;});}module[_0xd1d4('0x8')]=function(_0xd825aa){return _0xd825aa[_0xd1d4('0x9')]('Team',attributes,{'tableName':_0xd1d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x59a4a5=this;var _0x5cb54f=[_0xd1d4('0xb'),_0xd1d4('0xc'),_0xd1d4('0xd'),_0xd1d4('0xe'),_0xd1d4('0xf'),_0xd1d4('0x10'),'Whatsapp'];return Promise[_0xd1d4('0x11')]()[_0xd1d4('0x3')](function(){var _0x9ceaec=_['map'](_0x5cb54f,function(_0x502d0d){return getQueuesByChannel(_0x59a4a5,_0x502d0d);});return Promise[_0xd1d4('0x12')](_0x9ceaec);})[_0xd1d4('0x7')](function(_0x2cfe6e){throw _0x2cfe6e;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 4d0895f..99d5e83 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 _0xfc5e=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch'];(function(_0x1ea727,_0x56c800){var _0x376c32=function(_0x111700){while(--_0x111700){_0x1ea727['push'](_0x1ea727['shift']());}};_0x376c32(++_0x56c800);}(_0xfc5e,0x186));var _0xefc5=function(_0x2bcdbe,_0x12cb5e){_0x2bcdbe=_0x2bcdbe-0x0;var _0x55d915=_0xfc5e[_0x2bcdbe];return _0x55d915;};'use strict';var _=require(_0xefc5('0x0'));var util=require('util');var moment=require(_0xefc5('0x1'));var BPromise=require(_0xefc5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xefc5('0x3'));var db=require(_0xefc5('0x4'))['db'];var utils=require(_0xefc5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xefc5('0x6'));var jayson=require(_0xefc5('0x7'));var client=jayson[_0xefc5('0x8')]['http']({'port':0x232a});config[_0xefc5('0x9')]=_['defaults'](config['redis'],{'host':_0xefc5('0xa'),'port':0x18eb});var socket=require(_0xefc5('0xb'))(new Redis(config[_0xefc5('0x9')]));require('./team.socket')[_0xefc5('0xc')](socket);function respondWithRpcPromise(_0x287e40,_0x44b23a,_0x3dbee5){return new BPromise(function(_0x3bb3b5,_0x41c3e2){return client[_0xefc5('0xd')](_0x287e40,_0x3dbee5)[_0xefc5('0xe')](function(_0x34f128){logger[_0xefc5('0xf')]('Team,\x20%s,\x20%s',_0x44b23a,'request\x20sent');logger[_0xefc5('0x10')](_0xefc5('0x11'),_0x44b23a,_0xefc5('0x12'),JSON[_0xefc5('0x13')](_0x34f128));if(_0x34f128[_0xefc5('0x14')]){if(_0x34f128[_0xefc5('0x14')][_0xefc5('0x15')]===0x1f4){logger[_0xefc5('0x14')](_0xefc5('0x16'),_0x44b23a,_0x34f128[_0xefc5('0x14')][_0xefc5('0x17')]);return _0x41c3e2(_0x34f128[_0xefc5('0x14')][_0xefc5('0x17')]);}logger[_0xefc5('0x14')]('Team,\x20%s,\x20%s',_0x44b23a,_0x34f128[_0xefc5('0x14')][_0xefc5('0x17')]);return _0x3bb3b5(_0x34f128[_0xefc5('0x14')][_0xefc5('0x17')]);}else{logger[_0xefc5('0xf')](_0xefc5('0x16'),_0x44b23a,_0xefc5('0x12'));_0x3bb3b5(_0x34f128[_0xefc5('0x18')][_0xefc5('0x17')]);}})[_0xefc5('0x19')](function(_0x5eb98f){logger[_0xefc5('0x14')](_0xefc5('0x16'),_0x44b23a,_0x5eb98f);_0x41c3e2(_0x5eb98f);});});} \ No newline at end of file +var _0x277c=['localhost','./team.socket','register','request','then','info','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis'];(function(_0x8a30cf,_0x40f19b){var _0x20f439=function(_0x157a5d){while(--_0x157a5d){_0x8a30cf['push'](_0x8a30cf['shift']());}};_0x20f439(++_0x40f19b);}(_0x277c,0x153));var _0xc277=function(_0x36108e,_0x4b4e0b){_0x36108e=_0x36108e-0x0;var _0x4f1fdf=_0x277c[_0x36108e];return _0x4f1fdf;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var moment=require(_0xc277('0x1'));var BPromise=require(_0xc277('0x2'));var rs=require(_0xc277('0x3'));var fs=require('fs');var Redis=require(_0xc277('0x4'));var db=require(_0xc277('0x5'))['db'];var utils=require(_0xc277('0x6'));var logger=require(_0xc277('0x7'))(_0xc277('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc277('0x9')]['http']({'port':0x232a});config[_0xc277('0xa')]=_['defaults'](config[_0xc277('0xa')],{'host':_0xc277('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc277('0xa')]));require(_0xc277('0xc'))[_0xc277('0xd')](socket);function respondWithRpcPromise(_0x1b1db0,_0x3f766f,_0x1e4087){return new BPromise(function(_0x4a4137,_0x58eb8b){return client[_0xc277('0xe')](_0x1b1db0,_0x1e4087)[_0xc277('0xf')](function(_0x2df373){logger[_0xc277('0x10')]('Team,\x20%s,\x20%s',_0x3f766f,_0xc277('0x11'));logger['debug'](_0xc277('0x12'),_0x3f766f,_0xc277('0x11'),JSON[_0xc277('0x13')](_0x2df373));if(_0x2df373[_0xc277('0x14')]){if(_0x2df373['error'][_0xc277('0x15')]===0x1f4){logger[_0xc277('0x14')](_0xc277('0x16'),_0x3f766f,_0x2df373['error']['message']);return _0x58eb8b(_0x2df373[_0xc277('0x14')]['message']);}logger[_0xc277('0x14')]('Team,\x20%s,\x20%s',_0x3f766f,_0x2df373[_0xc277('0x14')][_0xc277('0x17')]);return _0x4a4137(_0x2df373[_0xc277('0x14')]['message']);}else{logger['info'](_0xc277('0x16'),_0x3f766f,'request\x20sent');_0x4a4137(_0x2df373['result'][_0xc277('0x17')]);}})[_0xc277('0x18')](function(_0x3b247e){logger[_0xc277('0x14')](_0xc277('0x16'),_0x3f766f,_0x3b247e);_0x58eb8b(_0x3b247e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index c85a9e8..d40c632 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 _0xb92a=['./team.events','save','remove','update','emit','removeListener','length','team:'];(function(_0xc7f23c,_0x2be758){var _0x4b4def=function(_0x1b3aab){while(--_0x1b3aab){_0xc7f23c['push'](_0xc7f23c['shift']());}};_0x4b4def(++_0x2be758);}(_0xb92a,0xb0));var _0xab92=function(_0x1847b7,_0x3843cd){_0x1847b7=_0x1847b7-0x0;var _0x2186f1=_0xb92a[_0x1847b7];return _0x2186f1;};'use strict';var TeamEvents=require(_0xab92('0x0'));var events=[_0xab92('0x1'),_0xab92('0x2'),_0xab92('0x3')];function createListener(_0x1a39d2,_0x3b15dc){return function(_0x641866){_0x3b15dc[_0xab92('0x4')](_0x1a39d2,_0x641866);};}function removeListener(_0x2fa1bc,_0x5e4eaf){return function(){TeamEvents[_0xab92('0x5')](_0x2fa1bc,_0x5e4eaf);};}exports['register']=function(_0x1a6438){for(var _0x2ddbd8=0x0,_0x38f011=events[_0xab92('0x6')];_0x2ddbd8<_0x38f011;_0x2ddbd8++){var _0x5f39cb=events[_0x2ddbd8];var _0x6e2f01=createListener(_0xab92('0x7')+_0x5f39cb,_0x1a6438);TeamEvents['on'](_0x5f39cb,_0x6e2f01);}}; \ No newline at end of file +var _0x3ef9=['team:','./team.events','save','emit','removeListener','register','length'];(function(_0xad81fe,_0x15e345){var _0x36bb5a=function(_0x3c566e){while(--_0x3c566e){_0xad81fe['push'](_0xad81fe['shift']());}};_0x36bb5a(++_0x15e345);}(_0x3ef9,0x12e));var _0x93ef=function(_0x557f90,_0xb5b74){_0x557f90=_0x557f90-0x0;var _0x3d10f4=_0x3ef9[_0x557f90];return _0x3d10f4;};'use strict';var TeamEvents=require(_0x93ef('0x0'));var events=[_0x93ef('0x1'),'remove','update'];function createListener(_0x4793b0,_0x2fb405){return function(_0x368ed3){_0x2fb405[_0x93ef('0x2')](_0x4793b0,_0x368ed3);};}function removeListener(_0x3c3f6e,_0xa304a6){return function(){TeamEvents[_0x93ef('0x3')](_0x3c3f6e,_0xa304a6);};}exports[_0x93ef('0x4')]=function(_0x5c017a){for(var _0x5008d6=0x0,_0x265fb2=events[_0x93ef('0x5')];_0x5008d6<_0x265fb2;_0x5008d6++){var _0x300154=events[_0x5008d6];var _0x4b4620=createListener(_0x93ef('0x6')+_0x300154,_0x5c017a);TeamEvents['on'](_0x300154,_0x4b4620);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 9ae1985..0965625 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 _0x29a5=['sequelize','exports','INTEGER'];(function(_0x2636db,_0x22a6b8){var _0x366935=function(_0x31e4b6){while(--_0x31e4b6){_0x2636db['push'](_0x2636db['shift']());}};_0x366935(++_0x22a6b8);}(_0x29a5,0x1e0));var _0x529a=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x29a5[_0x5416db];return _0x243e35;};'use strict';var Sequelize=require(_0x529a('0x0'));module[_0x529a('0x1')]={'TeamId':{'type':Sequelize[_0x529a('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd976=['sequelize','exports','INTEGER'];(function(_0x3cde86,_0x5c56b1){var _0x510ba6=function(_0x256619){while(--_0x256619){_0x3cde86['push'](_0x3cde86['shift']());}};_0x510ba6(++_0x5c56b1);}(_0xd976,0x12f));var _0x6d97=function(_0x53b6c6,_0x2c0d26){_0x53b6c6=_0x53b6c6-0x0;var _0x2885d1=_0xd976[_0x53b6c6];return _0x2885d1;};'use strict';var Sequelize=require(_0x6d97('0x0'));module[_0x6d97('0x1')]={'TeamId':{'type':Sequelize[_0x6d97('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 38944d2..ab00af9 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 _0x8109=['TeamVoicePrefix','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define'];(function(_0x45b804,_0x22baa0){var _0x16ca23=function(_0xacbd4a){while(--_0xacbd4a){_0x45b804['push'](_0x45b804['shift']());}};_0x16ca23(++_0x22baa0);}(_0x8109,0xa9));var _0x9810=function(_0x359e5e,_0x404b89){_0x359e5e=_0x359e5e-0x0;var _0x14e68e=_0x8109[_0x359e5e];return _0x14e68e;};'use strict';var _=require(_0x9810('0x0'));var util=require('util');var logger=require(_0x9810('0x1'))(_0x9810('0x2'));var moment=require('moment');var BPromise=require(_0x9810('0x3'));var rp=require(_0x9810('0x4'));var fs=require('fs');var path=require(_0x9810('0x5'));var rimraf=require(_0x9810('0x6'));var config=require(_0x9810('0x7'));var attributes=require(_0x9810('0x8'));module[_0x9810('0x9')]=function(_0x24baaf,_0x440a10){return _0x24baaf[_0x9810('0xa')](_0x9810('0xb'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c66=['path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','api','moment','bluebird','request-promise'];(function(_0xe08c40,_0x7c364a){var _0x1e30bc=function(_0x47e655){while(--_0x47e655){_0xe08c40['push'](_0xe08c40['shift']());}};_0x1e30bc(++_0x7c364a);}(_0x3c66,0x8b));var _0x63c6=function(_0x46e44e,_0x304911){_0x46e44e=_0x46e44e-0x0;var _0x435258=_0x3c66[_0x46e44e];return _0x435258;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x63c6('0x0'));var moment=require(_0x63c6('0x1'));var BPromise=require(_0x63c6('0x2'));var rp=require(_0x63c6('0x3'));var fs=require('fs');var path=require(_0x63c6('0x4'));var rimraf=require(_0x63c6('0x5'));var config=require(_0x63c6('0x6'));var attributes=require(_0x63c6('0x7'));module[_0x63c6('0x8')]=function(_0x326a7b,_0x148dbc){return _0x326a7b[_0x63c6('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0x63c6('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 aba55d4..5d35f63 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2398b6,_0x31738d){var _0x16efaa=function(_0xabe8b2){while(--_0xabe8b2){_0x2398b6['push'](_0x2398b6['shift']());}};_0x16efaa(++_0x31738d);}(_0xe706,0xa3));var _0x6e70=function(_0x25dfe3,_0x8699a8){_0x25dfe3=_0x25dfe3-0x0;var _0xa2ea8b=_0xe706[_0x25dfe3];return _0xa2ea8b;};'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(_0x187e3c,_0x56d087){var _0x166a54=function(_0x4b00e4){while(--_0x4b00e4){_0x187e3c['push'](_0x187e3c['shift']());}};_0x166a54(++_0x56d087);}(_0xedd9,0xfc));var _0x9edd=function(_0x51801c,_0x825ea6){_0x51801c=_0x51801c-0x0;var _0x5376ed=_0xedd9[_0x51801c];return _0x5376ed;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 86ba2c1..914f06c 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 _0x23fc=['INTEGER','sequelize'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x23fc,0xa3));var _0xc23f=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x23fc[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require(_0xc23f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc23f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdd23=['sequelize'];(function(_0x56a307,_0x50672d){var _0xe508a6=function(_0x5cfe3e){while(--_0x5cfe3e){_0x56a307['push'](_0x56a307['shift']());}};_0xe508a6(++_0x50672d);}(_0xdd23,0x109));var _0x3dd2=function(_0x356780,_0x48ce70){_0x356780=_0x356780-0x0;var _0x2a0fec=_0xdd23[_0x356780];return _0x2a0fec;};'use strict';var Sequelize=require(_0x3dd2('0x0'));module['exports']={'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 4469ab7..37dfdac 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 _0x871e=['define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x3a2a7d,_0x105f0f){var _0x660313=function(_0x5f0669){while(--_0x5f0669){_0x3a2a7d['push'](_0x3a2a7d['shift']());}};_0x660313(++_0x105f0f);}(_0x871e,0x1b0));var _0xe871=function(_0x5d29bd,_0x3a4869){_0x5d29bd=_0x5d29bd-0x0;var _0x3cd4fc=_0x871e[_0x5d29bd];return _0x3cd4fc;};'use strict';var _=require(_0xe871('0x0'));var util=require('util');var logger=require(_0xe871('0x1'))(_0xe871('0x2'));var moment=require(_0xe871('0x3'));var BPromise=require(_0xe871('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe871('0x5'));var rimraf=require(_0xe871('0x6'));var config=require(_0xe871('0x7'));var attributes=require(_0xe871('0x8'));module[_0xe871('0x9')]=function(_0x2c0254,_0x1068cc){return _0x2c0254[_0xe871('0xa')](_0xe871('0xb'),attributes,{'tableName':_0xe871('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb377=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0xbb0ccf,_0x19e718){var _0x38d7b3=function(_0x3bc6ff){while(--_0x3bc6ff){_0xbb0ccf['push'](_0xbb0ccf['shift']());}};_0x38d7b3(++_0x19e718);}(_0xb377,0x1b6));var _0x7b37=function(_0x1277f2,_0x3842e0){_0x1277f2=_0x1277f2-0x0;var _0x4fdb32=_0xb377[_0x1277f2];return _0x4fdb32;};'use strict';var _=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var logger=require(_0x7b37('0x2'))(_0x7b37('0x3'));var moment=require(_0x7b37('0x4'));var BPromise=require(_0x7b37('0x5'));var rp=require(_0x7b37('0x6'));var fs=require('fs');var path=require(_0x7b37('0x7'));var rimraf=require(_0x7b37('0x8'));var config=require(_0x7b37('0x9'));var attributes=require(_0x7b37('0xa'));module[_0x7b37('0xb')]=function(_0x58edf9,_0x516b62){return _0x58edf9[_0x7b37('0xc')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index af31c11..e9f9ba3 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 _0x1d5c=['../../config/logger','../../config/environment','jayson/promise','http','then','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1d5c,0xeb));var _0xc1d5=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x1d5c[_0x4f431d];return _0x4f31e1;};'use strict';var _=require(_0xc1d5('0x0'));var util=require(_0xc1d5('0x1'));var moment=require(_0xc1d5('0x2'));var BPromise=require(_0xc1d5('0x3'));var rs=require(_0xc1d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc1d5('0x5'))('rpc');var config=require(_0xc1d5('0x6'));var jayson=require(_0xc1d5('0x7'));var client=jayson['client'][_0xc1d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40d36b,_0x37892d,_0x190478){return new BPromise(function(_0x254eb2,_0x4f83a9){return client['request'](_0x40d36b,_0x190478)[_0xc1d5('0x9')](function(_0x19f764){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x37892d,_0xc1d5('0xa'));logger[_0xc1d5('0xb')](_0xc1d5('0xc'),_0x37892d,_0xc1d5('0xa'),JSON[_0xc1d5('0xd')](_0x19f764));if(_0x19f764[_0xc1d5('0xe')]){if(_0x19f764[_0xc1d5('0xe')][_0xc1d5('0xf')]===0x1f4){logger[_0xc1d5('0xe')](_0xc1d5('0x10'),_0x37892d,_0x19f764['error'][_0xc1d5('0x11')]);return _0x4f83a9(_0x19f764[_0xc1d5('0xe')]['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x37892d,_0x19f764[_0xc1d5('0xe')][_0xc1d5('0x11')]);return _0x254eb2(_0x19f764['error']['message']);}else{logger['info'](_0xc1d5('0x10'),_0x37892d,_0xc1d5('0xa'));_0x254eb2(_0x19f764[_0xc1d5('0x12')][_0xc1d5('0x11')]);}})[_0xc1d5('0x13')](function(_0x50e2c4){logger['error'](_0xc1d5('0x10'),_0x37892d,_0x50e2c4);_0x4f83a9(_0x50e2c4);});});} \ No newline at end of file +var _0xb33e=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb33e,0x14b));var _0xeb33=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb33e[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0xeb33('0x0'));var moment=require(_0xeb33('0x1'));var BPromise=require(_0xeb33('0x2'));var rs=require(_0xeb33('0x3'));var fs=require('fs');var Redis=require(_0xeb33('0x4'));var db=require(_0xeb33('0x5'))['db'];var utils=require(_0xeb33('0x6'));var logger=require(_0xeb33('0x7'))(_0xeb33('0x8'));var config=require(_0xeb33('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeb33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xef874e,_0x200fe8,_0x37f5e9){return new BPromise(function(_0x2146be,_0x4b6d25){return client[_0xeb33('0xb')](_0xef874e,_0x37f5e9)[_0xeb33('0xc')](function(_0x165417){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x200fe8,_0xeb33('0xd'));logger[_0xeb33('0xe')](_0xeb33('0xf'),_0x200fe8,'request\x20sent',JSON[_0xeb33('0x10')](_0x165417));if(_0x165417[_0xeb33('0x11')]){if(_0x165417[_0xeb33('0x11')]['code']===0x1f4){logger[_0xeb33('0x11')](_0xeb33('0x12'),_0x200fe8,_0x165417[_0xeb33('0x11')][_0xeb33('0x13')]);return _0x4b6d25(_0x165417[_0xeb33('0x11')]['message']);}logger[_0xeb33('0x11')](_0xeb33('0x12'),_0x200fe8,_0x165417[_0xeb33('0x11')][_0xeb33('0x13')]);return _0x2146be(_0x165417[_0xeb33('0x11')][_0xeb33('0x13')]);}else{logger[_0xeb33('0x14')](_0xeb33('0x12'),_0x200fe8,_0xeb33('0xd'));_0x2146be(_0x165417[_0xeb33('0x15')][_0xeb33('0x13')]);}})[_0xeb33('0x16')](function(_0x5c1248){logger[_0xeb33('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x200fe8,_0x5c1248);_0x4b6d25(_0x5c1248);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ef048ae..180c3d5 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 _0x751c=['put','update','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x3ca829,_0xc55f17){var _0x3b416b=function(_0x592aae){while(--_0x592aae){_0x3ca829['push'](_0x3ca829['shift']());}};_0x3b416b(++_0xc55f17);}(_0x751c,0x69));var _0xc751=function(_0x2bf678,_0x443155){_0x2bf678=_0x2bf678-0x0;var _0x15238e=_0x751c[_0x2bf678];return _0x15238e;};'use strict';var multer=require(_0xc751('0x0'));var util=require(_0xc751('0x1'));var path=require(_0xc751('0x2'));var timeout=require('connect-timeout');var express=require(_0xc751('0x3'));var router=express['Router']();var fs_extra=require(_0xc751('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc751('0x5'));var config=require(_0xc751('0x6'));var controller=require(_0xc751('0x7'));router[_0xc751('0x8')]('/',auth[_0xc751('0x9')](),controller['index']);router[_0xc751('0x8')](_0xc751('0xa'),auth['isAuthenticated'](),controller[_0xc751('0xb')]);router[_0xc751('0xc')]('/',auth['isAuthenticated'](),controller[_0xc751('0xd')]);router[_0xc751('0xe')](_0xc751('0xa'),auth[_0xc751('0x9')](),controller[_0xc751('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc751('0x10')]);module['exports']=router; \ No newline at end of file +var _0xed03=['util','connect-timeout','fs-extra','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x3ee228,_0xc38f11){var _0x4816fd=function(_0xa8aa4){while(--_0xa8aa4){_0x3ee228['push'](_0x3ee228['shift']());}};_0x4816fd(++_0xc38f11);}(_0xed03,0xdc));var _0x3ed0=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xed03[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require(_0x3ed0('0x0'));var util=require(_0x3ed0('0x1'));var path=require('path');var timeout=require(_0x3ed0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3ed0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3ed0('0x4'));var config=require('../../config/environment');var controller=require(_0x3ed0('0x5'));router[_0x3ed0('0x6')]('/',auth[_0x3ed0('0x7')](),controller[_0x3ed0('0x8')]);router[_0x3ed0('0x6')](_0x3ed0('0x9'),auth[_0x3ed0('0x7')](),controller[_0x3ed0('0xa')]);router[_0x3ed0('0xb')]('/',auth[_0x3ed0('0x7')](),controller[_0x3ed0('0xc')]);router[_0x3ed0('0xd')](_0x3ed0('0x9'),auth[_0x3ed0('0x7')](),controller['update']);router[_0x3ed0('0xe')]('/:id',auth[_0x3ed0('0x7')](),controller[_0x3ed0('0xf')]);module[_0x3ed0('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 06f8dfb..f9788c0 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 _0x3e26=['exports','STRING','TEXT','sequelize'];(function(_0x4a6802,_0x3bc910){var _0x5e42d6=function(_0x332de1){while(--_0x332de1){_0x4a6802['push'](_0x4a6802['shift']());}};_0x5e42d6(++_0x3bc910);}(_0x3e26,0x127));var _0x63e2=function(_0x19cf71,_0x1e852a){_0x19cf71=_0x19cf71-0x0;var _0x5371c1=_0x3e26[_0x19cf71];return _0x5371c1;};'use strict';var Sequelize=require(_0x63e2('0x0'));module[_0x63e2('0x1')]={'name':{'type':Sequelize[_0x63e2('0x2')]},'description':{'type':Sequelize[_0x63e2('0x2')]},'html':{'type':Sequelize[_0x63e2('0x3')]}}; \ No newline at end of file +var _0xd013=['STRING','sequelize','exports'];(function(_0x483241,_0x480b60){var _0x5a6374=function(_0x103035){while(--_0x103035){_0x483241['push'](_0x483241['shift']());}};_0x5a6374(++_0x480b60);}(_0xd013,0x196));var _0x3d01=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0xd013[_0x9729d7];return _0x3c4ac6;};'use strict';var Sequelize=require(_0x3d01('0x0'));module[_0x3d01('0x1')]={'name':{'type':Sequelize[_0x3d01('0x2')]},'description':{'type':Sequelize[_0x3d01('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d51d9e6..0788d00 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 _0xde96=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Templates','error','name','send','index','map','Template','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','params','include','find','create','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xa4e1aa,_0x4abece){var _0x6759e6=function(_0x425d3d){while(--_0x425d3d){_0xa4e1aa['push'](_0xa4e1aa['shift']());}};_0x6759e6(++_0x4abece);}(_0xde96,0x8f));var _0x6de9=function(_0x362ac3,_0x29353f){_0x362ac3=_0x362ac3-0x0;var _0x136b60=_0xde96[_0x362ac3];return _0x136b60;};'use strict';var emlformat=require(_0x6de9('0x0'));var rimraf=require(_0x6de9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6de9('0x2'));var rp=require(_0x6de9('0x3'));var moment=require('moment');var BPromise=require(_0x6de9('0x4'));var Mustache=require(_0x6de9('0x5'));var util=require(_0x6de9('0x6'));var path=require('path');var sox=require(_0x6de9('0x7'));var csv=require(_0x6de9('0x8'));var ejs=require(_0x6de9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6de9('0xa'));var squel=require(_0x6de9('0xb'));var crypto=require(_0x6de9('0xc'));var jsforce=require(_0x6de9('0xd'));var deskjs=require(_0x6de9('0xe'));var toCsv=require(_0x6de9('0x8'));var querystring=require(_0x6de9('0xf'));var Papa=require(_0x6de9('0x10'));var Redis=require(_0x6de9('0x11'));var authService=require(_0x6de9('0x12'));var qs=require(_0x6de9('0x13'));var as=require(_0x6de9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6de9('0x15'))('api');var utils=require(_0x6de9('0x16'));var config=require(_0x6de9('0x17'));var licenseUtil=require(_0x6de9('0x18'));var db=require(_0x6de9('0x19'))['db'];function respondWithStatusCode(_0x5847a0,_0xdf9df8){_0xdf9df8=_0xdf9df8||0xcc;return function(_0x1c9a5b){if(_0x1c9a5b){return _0x5847a0[_0x6de9('0x1a')](_0xdf9df8);}return _0x5847a0[_0x6de9('0x1b')](_0xdf9df8)[_0x6de9('0x1c')]();};}function respondWithResult(_0x1772ee,_0x1bb926){_0x1bb926=_0x1bb926||0xc8;return function(_0x3ba62c){if(_0x3ba62c){return _0x1772ee[_0x6de9('0x1b')](_0x1bb926)[_0x6de9('0x1d')](_0x3ba62c);}};}function respondWithFilteredResult(_0x270932,_0x3c6c7a){return function(_0x3049dd){if(_0x3049dd){var _0x470bc1=typeof _0x3c6c7a[_0x6de9('0x1e')]===_0x6de9('0x1f')&&typeof _0x3c6c7a[_0x6de9('0x20')]==='undefined';var _0x46891a=_0x3049dd[_0x6de9('0x21')];var _0x3b0b2b=_0x470bc1?0x0:_0x3c6c7a[_0x6de9('0x1e')];var _0x4577d1=_0x470bc1?_0x3049dd[_0x6de9('0x21')]:_0x3c6c7a[_0x6de9('0x1e')]+_0x3c6c7a[_0x6de9('0x20')];var _0x1ab2e5;if(_0x4577d1>=_0x46891a){_0x4577d1=_0x46891a;_0x1ab2e5=0xc8;}else{_0x1ab2e5=0xce;}_0x270932[_0x6de9('0x1b')](_0x1ab2e5);return _0x270932[_0x6de9('0x22')](_0x6de9('0x23'),_0x3b0b2b+'-'+_0x4577d1+'/'+_0x46891a)[_0x6de9('0x1d')](_0x3049dd);}return null;};}function patchUpdates(_0x214d9b){return function(_0x4bbba6){try{jsonpatch[_0x6de9('0x24')](_0x4bbba6,_0x214d9b,!![]);}catch(_0x2fb9a5){return BPromise[_0x6de9('0x25')](_0x2fb9a5);}return _0x4bbba6[_0x6de9('0x26')]();};}function saveUpdates(_0x4cdfdc,_0x4599eb){return function(_0x18c9ef){if(_0x18c9ef){return _0x18c9ef[_0x6de9('0x27')](_0x4cdfdc)['then'](function(_0x4d87f8){return _0x4d87f8;});}return null;};}function removeEntity(_0x174455,_0x26c8ae){return function(_0x2ca917){if(_0x2ca917){return _0x2ca917[_0x6de9('0x28')]()[_0x6de9('0x29')](function(){var _0x470169=_0x2ca917[_0x6de9('0x2a')]({'plain':!![]});var _0x522a6d=_0x6de9('0x2b');return db['UserProfileResource'][_0x6de9('0x28')]({'where':{'type':_0x522a6d,'resourceId':_0x470169['id']}})[_0x6de9('0x29')](function(){return _0x2ca917;});})['then'](function(){_0x174455[_0x6de9('0x1b')](0xcc)[_0x6de9('0x1c')]();});}};}function handleEntityNotFound(_0x3cb3b0,_0xf12dc1){return function(_0x2192f6){if(!_0x2192f6){_0x3cb3b0[_0x6de9('0x1a')](0x194);}return _0x2192f6;};}function handleError(_0x1b986f,_0x1cfc60){_0x1cfc60=_0x1cfc60||0x1f4;return function(_0x3de06a){logger[_0x6de9('0x2c')](_0x3de06a['stack']);if(_0x3de06a[_0x6de9('0x2d')]){delete _0x3de06a[_0x6de9('0x2d')];}_0x1b986f[_0x6de9('0x1b')](_0x1cfc60)[_0x6de9('0x2e')](_0x3de06a);};}exports[_0x6de9('0x2f')]=function(_0x1aff29,_0x1256e5){var _0xc42274={},_0x5d4038={},_0x3e0f27={'count':0x0,'rows':[]};var _0x5521b6=_[_0x6de9('0x30')](db[_0x6de9('0x31')][_0x6de9('0x32')],function(_0xb9fe90){return{'name':_0xb9fe90[_0x6de9('0x33')],'type':_0xb9fe90[_0x6de9('0x34')]['key']};});_0x5d4038[_0x6de9('0x35')]=_[_0x6de9('0x30')](_0x5521b6,_0x6de9('0x2d'));_0x5d4038[_0x6de9('0x36')]=_[_0x6de9('0x37')](_0x1aff29[_0x6de9('0x36')]);_0x5d4038[_0x6de9('0x38')]=_['intersection'](_0x5d4038['model'],_0x5d4038[_0x6de9('0x36')]);_0xc42274['attributes']=_[_0x6de9('0x39')](_0x5d4038[_0x6de9('0x35')],qs[_0x6de9('0x3a')](_0x1aff29['query'][_0x6de9('0x3a')]));_0xc42274[_0x6de9('0x3b')]=_0xc42274[_0x6de9('0x3b')][_0x6de9('0x3c')]?_0xc42274['attributes']:_0x5d4038[_0x6de9('0x35')];if(!_0x1aff29[_0x6de9('0x36')][_0x6de9('0x3d')](_0x6de9('0x3e'))){_0xc42274[_0x6de9('0x20')]=qs[_0x6de9('0x20')](_0x1aff29[_0x6de9('0x36')]['limit']);_0xc42274[_0x6de9('0x1e')]=qs[_0x6de9('0x1e')](_0x1aff29['query'][_0x6de9('0x1e')]);}_0xc42274[_0x6de9('0x3f')]=qs[_0x6de9('0x40')](_0x1aff29[_0x6de9('0x36')]['sort']);_0xc42274[_0x6de9('0x41')]=qs[_0x6de9('0x38')](_[_0x6de9('0x42')](_0x1aff29[_0x6de9('0x36')],_0x5d4038[_0x6de9('0x38')]),_0x5521b6);if(_0x1aff29[_0x6de9('0x36')][_0x6de9('0x43')]){_0xc42274['where']=_[_0x6de9('0x44')](_0xc42274[_0x6de9('0x41')],{'$or':_['map'](_0x5521b6,function(_0x1f29b6){if(_0x1f29b6['type']!=='VIRTUAL'){var _0x46e56d={};_0x46e56d[_0x1f29b6['name']]={'$like':'%'+_0x1aff29[_0x6de9('0x36')]['filter']+'%'};return _0x46e56d;}})});}_0xc42274=_[_0x6de9('0x44')]({},_0xc42274,_0x1aff29[_0x6de9('0x45')]);var _0x48048d={'where':_0xc42274[_0x6de9('0x41')]};return db['Template'][_0x6de9('0x21')](_0x48048d)[_0x6de9('0x29')](function(_0x5b2885){_0x3e0f27['count']=_0x5b2885;if(_0x1aff29[_0x6de9('0x36')][_0x6de9('0x46')]){_0xc42274['include']=[{'all':!![]}];}return db[_0x6de9('0x31')][_0x6de9('0x47')](_0xc42274);})['then'](function(_0x44ea22){_0x3e0f27['rows']=_0x44ea22;return _0x3e0f27;})[_0x6de9('0x29')](respondWithFilteredResult(_0x1256e5,_0xc42274))[_0x6de9('0x48')](handleError(_0x1256e5,null));};exports['show']=function(_0x4cb5c2,_0xe59b09){var _0x505636={'raw':!![],'where':{'id':_0x4cb5c2[_0x6de9('0x49')]['id']}},_0x56b44f={};_0x56b44f[_0x6de9('0x35')]=_[_0x6de9('0x37')](db['Template'][_0x6de9('0x32')]);_0x56b44f[_0x6de9('0x36')]=_[_0x6de9('0x37')](_0x4cb5c2[_0x6de9('0x36')]);_0x56b44f[_0x6de9('0x38')]=_['intersection'](_0x56b44f['model'],_0x56b44f[_0x6de9('0x36')]);_0x505636[_0x6de9('0x3b')]=_[_0x6de9('0x39')](_0x56b44f[_0x6de9('0x35')],qs[_0x6de9('0x3a')](_0x4cb5c2[_0x6de9('0x36')][_0x6de9('0x3a')]));_0x505636[_0x6de9('0x3b')]=_0x505636['attributes'][_0x6de9('0x3c')]?_0x505636['attributes']:_0x56b44f[_0x6de9('0x35')];if(_0x4cb5c2['query'][_0x6de9('0x46')]){_0x505636[_0x6de9('0x4a')]=[{'all':!![]}];}_0x505636=_['merge']({},_0x505636,_0x4cb5c2[_0x6de9('0x45')]);return db['Template'][_0x6de9('0x4b')](_0x505636)[_0x6de9('0x29')](handleEntityNotFound(_0xe59b09,null))[_0x6de9('0x29')](respondWithResult(_0xe59b09,null))[_0x6de9('0x48')](handleError(_0xe59b09,null));};exports[_0x6de9('0x4c')]=function(_0x2efee1,_0x21a2e2){return db[_0x6de9('0x31')][_0x6de9('0x4c')](_0x2efee1['body'],{})['then'](function(_0x5beeb2){var _0x1bd694=_0x2efee1[_0x6de9('0x4d')][_0x6de9('0x2a')]({'plain':!![]});if(!_0x1bd694)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bd694['role']==='user'){var _0x1d2870=_0x5beeb2[_0x6de9('0x2a')]({'plain':!![]});var _0x2237f4=_0x6de9('0x2b');return db[_0x6de9('0x4e')][_0x6de9('0x4b')]({'where':{'name':_0x2237f4,'userProfileId':_0x1bd694['userProfileId']},'raw':!![]})[_0x6de9('0x29')](function(_0x260d35){if(_0x260d35&&_0x260d35['autoAssociation']===0x0){return db[_0x6de9('0x4f')][_0x6de9('0x4c')]({'name':_0x1d2870[_0x6de9('0x2d')],'resourceId':_0x1d2870['id'],'type':_0x260d35[_0x6de9('0x2d')],'sectionId':_0x260d35['id']},{})[_0x6de9('0x29')](function(){return _0x5beeb2;});}else{return _0x5beeb2;}})[_0x6de9('0x48')](function(_0x59fd74){logger[_0x6de9('0x2c')](_0x6de9('0x50'),_0x59fd74);throw _0x59fd74;});}return _0x5beeb2;})[_0x6de9('0x29')](respondWithResult(_0x21a2e2,0xc9))[_0x6de9('0x48')](handleError(_0x21a2e2,null));};exports[_0x6de9('0x27')]=function(_0x12daff,_0xe03f99){if(_0x12daff['body']['id']){delete _0x12daff[_0x6de9('0x51')]['id'];}return db[_0x6de9('0x31')][_0x6de9('0x4b')]({'where':{'id':_0x12daff[_0x6de9('0x49')]['id']}})[_0x6de9('0x29')](handleEntityNotFound(_0xe03f99,null))[_0x6de9('0x29')](saveUpdates(_0x12daff[_0x6de9('0x51')],null))['then'](respondWithResult(_0xe03f99,null))[_0x6de9('0x48')](handleError(_0xe03f99,null));};exports[_0x6de9('0x28')]=function(_0xe81c4f,_0x377df3){return db[_0x6de9('0x31')][_0x6de9('0x4b')]({'where':{'id':_0xe81c4f['params']['id']}})[_0x6de9('0x29')](handleEntityNotFound(_0x377df3,null))[_0x6de9('0x29')](removeEntity(_0x377df3,null))[_0x6de9('0x48')](handleError(_0x377df3,null));}; \ No newline at end of file +var _0x0bef=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','get','Templates','then','name','send','index','Template','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','error'];(function(_0x60b834,_0x3ccdda){var _0x832e5e=function(_0x422e31){while(--_0x422e31){_0x60b834['push'](_0x60b834['shift']());}};_0x832e5e(++_0x3ccdda);}(_0x0bef,0xef));var _0xf0be=function(_0x9e07ed,_0x18436b){_0x9e07ed=_0x9e07ed-0x0;var _0x53d4ae=_0x0bef[_0x9e07ed];return _0x53d4ae;};'use strict';var emlformat=require(_0xf0be('0x0'));var rimraf=require(_0xf0be('0x1'));var zipdir=require(_0xf0be('0x2'));var jsonpatch=require(_0xf0be('0x3'));var rp=require(_0xf0be('0x4'));var moment=require(_0xf0be('0x5'));var BPromise=require(_0xf0be('0x6'));var Mustache=require(_0xf0be('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf0be('0x8'));var csv=require(_0xf0be('0x9'));var ejs=require(_0xf0be('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf0be('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf0be('0x9'));var querystring=require(_0xf0be('0xc'));var Papa=require('papaparse');var Redis=require(_0xf0be('0xd'));var authService=require(_0xf0be('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf0be('0xf'));var hardwareService=require(_0xf0be('0x10'));var logger=require(_0xf0be('0x11'))('api');var utils=require(_0xf0be('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf0be('0x13'));var db=require(_0xf0be('0x14'))['db'];function respondWithStatusCode(_0x2938e1,_0x3bb355){_0x3bb355=_0x3bb355||0xcc;return function(_0x39400e){if(_0x39400e){return _0x2938e1[_0xf0be('0x15')](_0x3bb355);}return _0x2938e1['status'](_0x3bb355)[_0xf0be('0x16')]();};}function respondWithResult(_0x1e7244,_0x4f2614){_0x4f2614=_0x4f2614||0xc8;return function(_0x4eaf3a){if(_0x4eaf3a){return _0x1e7244[_0xf0be('0x17')](_0x4f2614)[_0xf0be('0x18')](_0x4eaf3a);}};}function respondWithFilteredResult(_0x46071a,_0x34f153){return function(_0x266dfa){if(_0x266dfa){var _0x47b05b=typeof _0x34f153['offset']===_0xf0be('0x19')&&typeof _0x34f153[_0xf0be('0x1a')]===_0xf0be('0x19');var _0x180a10=_0x266dfa[_0xf0be('0x1b')];var _0x3bf720=_0x47b05b?0x0:_0x34f153[_0xf0be('0x1c')];var _0x51f52f=_0x47b05b?_0x266dfa[_0xf0be('0x1b')]:_0x34f153[_0xf0be('0x1c')]+_0x34f153['limit'];var _0x6a605;if(_0x51f52f>=_0x180a10){_0x51f52f=_0x180a10;_0x6a605=0xc8;}else{_0x6a605=0xce;}_0x46071a[_0xf0be('0x17')](_0x6a605);return _0x46071a[_0xf0be('0x1d')](_0xf0be('0x1e'),_0x3bf720+'-'+_0x51f52f+'/'+_0x180a10)[_0xf0be('0x18')](_0x266dfa);}return null;};}function patchUpdates(_0x233acf){return function(_0x1f792e){try{jsonpatch[_0xf0be('0x1f')](_0x1f792e,_0x233acf,!![]);}catch(_0x235b56){return BPromise['reject'](_0x235b56);}return _0x1f792e[_0xf0be('0x20')]();};}function saveUpdates(_0x51bc1e,_0xa6cdd7){return function(_0x16a099){if(_0x16a099){return _0x16a099['update'](_0x51bc1e)['then'](function(_0x34c4f6){return _0x34c4f6;});}return null;};}function removeEntity(_0x4d3bae,_0x4da407){return function(_0x18def6){if(_0x18def6){return _0x18def6[_0xf0be('0x21')]()['then'](function(){var _0x4d07cf=_0x18def6[_0xf0be('0x22')]({'plain':!![]});var _0x1f2f55=_0xf0be('0x23');return db['UserProfileResource'][_0xf0be('0x21')]({'where':{'type':_0x1f2f55,'resourceId':_0x4d07cf['id']}})['then'](function(){return _0x18def6;});})[_0xf0be('0x24')](function(){_0x4d3bae[_0xf0be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ba59a,_0x4f5d91){return function(_0x17d209){if(!_0x17d209){_0x2ba59a[_0xf0be('0x15')](0x194);}return _0x17d209;};}function handleError(_0x217d1b,_0x101e53){_0x101e53=_0x101e53||0x1f4;return function(_0xa08594){logger['error'](_0xa08594['stack']);if(_0xa08594[_0xf0be('0x25')]){delete _0xa08594[_0xf0be('0x25')];}_0x217d1b[_0xf0be('0x17')](_0x101e53)[_0xf0be('0x26')](_0xa08594);};}exports[_0xf0be('0x27')]=function(_0x467410,_0x15a3d1){var _0x277b95={},_0x5b6e5d={},_0x44fc83={'count':0x0,'rows':[]};var _0x2c12ac=_['map'](db[_0xf0be('0x28')]['rawAttributes'],function(_0xb7a48a){return{'name':_0xb7a48a[_0xf0be('0x29')],'type':_0xb7a48a[_0xf0be('0x2a')][_0xf0be('0x2b')]};});_0x5b6e5d[_0xf0be('0x2c')]=_[_0xf0be('0x2d')](_0x2c12ac,_0xf0be('0x25'));_0x5b6e5d[_0xf0be('0x2e')]=_[_0xf0be('0x2f')](_0x467410['query']);_0x5b6e5d[_0xf0be('0x30')]=_[_0xf0be('0x31')](_0x5b6e5d['model'],_0x5b6e5d['query']);_0x277b95[_0xf0be('0x32')]=_[_0xf0be('0x31')](_0x5b6e5d['model'],qs['fields'](_0x467410['query'][_0xf0be('0x33')]));_0x277b95['attributes']=_0x277b95[_0xf0be('0x32')][_0xf0be('0x34')]?_0x277b95[_0xf0be('0x32')]:_0x5b6e5d[_0xf0be('0x2c')];if(!_0x467410[_0xf0be('0x2e')]['hasOwnProperty']('nolimit')){_0x277b95['limit']=qs[_0xf0be('0x1a')](_0x467410[_0xf0be('0x2e')][_0xf0be('0x1a')]);_0x277b95[_0xf0be('0x1c')]=qs[_0xf0be('0x1c')](_0x467410[_0xf0be('0x2e')][_0xf0be('0x1c')]);}_0x277b95[_0xf0be('0x35')]=qs[_0xf0be('0x36')](_0x467410[_0xf0be('0x2e')][_0xf0be('0x36')]);_0x277b95[_0xf0be('0x37')]=qs[_0xf0be('0x30')](_[_0xf0be('0x38')](_0x467410['query'],_0x5b6e5d[_0xf0be('0x30')]),_0x2c12ac);if(_0x467410[_0xf0be('0x2e')]['filter']){_0x277b95['where']=_['merge'](_0x277b95['where'],{'$or':_[_0xf0be('0x2d')](_0x2c12ac,function(_0x3f5069){if(_0x3f5069['type']!==_0xf0be('0x39')){var _0x4e716e={};_0x4e716e[_0x3f5069[_0xf0be('0x25')]]={'$like':'%'+_0x467410[_0xf0be('0x2e')][_0xf0be('0x3a')]+'%'};return _0x4e716e;}})});}_0x277b95=_[_0xf0be('0x3b')]({},_0x277b95,_0x467410[_0xf0be('0x3c')]);var _0x267fba={'where':_0x277b95[_0xf0be('0x37')]};return db[_0xf0be('0x28')][_0xf0be('0x1b')](_0x267fba)[_0xf0be('0x24')](function(_0x4b41c9){_0x44fc83[_0xf0be('0x1b')]=_0x4b41c9;if(_0x467410[_0xf0be('0x2e')]['includeAll']){_0x277b95[_0xf0be('0x3d')]=[{'all':!![]}];}return db[_0xf0be('0x28')][_0xf0be('0x3e')](_0x277b95);})[_0xf0be('0x24')](function(_0x2da29b){_0x44fc83[_0xf0be('0x3f')]=_0x2da29b;return _0x44fc83;})[_0xf0be('0x24')](respondWithFilteredResult(_0x15a3d1,_0x277b95))[_0xf0be('0x40')](handleError(_0x15a3d1,null));};exports['show']=function(_0x1add79,_0x41576b){var _0x30ea37={'raw':!![],'where':{'id':_0x1add79[_0xf0be('0x41')]['id']}},_0x902369={};_0x902369['model']=_[_0xf0be('0x2f')](db[_0xf0be('0x28')][_0xf0be('0x42')]);_0x902369[_0xf0be('0x2e')]=_[_0xf0be('0x2f')](_0x1add79[_0xf0be('0x2e')]);_0x902369[_0xf0be('0x30')]=_[_0xf0be('0x31')](_0x902369['model'],_0x902369['query']);_0x30ea37[_0xf0be('0x32')]=_[_0xf0be('0x31')](_0x902369[_0xf0be('0x2c')],qs['fields'](_0x1add79[_0xf0be('0x2e')][_0xf0be('0x33')]));_0x30ea37[_0xf0be('0x32')]=_0x30ea37[_0xf0be('0x32')][_0xf0be('0x34')]?_0x30ea37['attributes']:_0x902369['model'];if(_0x1add79[_0xf0be('0x2e')]['includeAll']){_0x30ea37['include']=[{'all':!![]}];}_0x30ea37=_[_0xf0be('0x3b')]({},_0x30ea37,_0x1add79[_0xf0be('0x3c')]);return db[_0xf0be('0x28')]['find'](_0x30ea37)[_0xf0be('0x24')](handleEntityNotFound(_0x41576b,null))['then'](respondWithResult(_0x41576b,null))['catch'](handleError(_0x41576b,null));};exports[_0xf0be('0x43')]=function(_0x238a63,_0x3a7e22){return db['Template'][_0xf0be('0x43')](_0x238a63[_0xf0be('0x44')],{})['then'](function(_0x4e09e0){var _0x4531a5=_0x238a63[_0xf0be('0x45')][_0xf0be('0x22')]({'plain':!![]});if(!_0x4531a5)throw new Error(_0xf0be('0x46'));if(_0x4531a5[_0xf0be('0x47')]==='user'){var _0x4d9a81=_0x4e09e0[_0xf0be('0x22')]({'plain':!![]});var _0x3e898d=_0xf0be('0x23');return db[_0xf0be('0x48')][_0xf0be('0x49')]({'where':{'name':_0x3e898d,'userProfileId':_0x4531a5[_0xf0be('0x4a')]},'raw':!![]})[_0xf0be('0x24')](function(_0x13f3b9){if(_0x13f3b9&&_0x13f3b9['autoAssociation']===0x0){return db[_0xf0be('0x4b')][_0xf0be('0x43')]({'name':_0x4d9a81[_0xf0be('0x25')],'resourceId':_0x4d9a81['id'],'type':_0x13f3b9['name'],'sectionId':_0x13f3b9['id']},{})[_0xf0be('0x24')](function(){return _0x4e09e0;});}else{return _0x4e09e0;}})[_0xf0be('0x40')](function(_0xe41472){logger[_0xf0be('0x4c')](_0xf0be('0x4d'),_0xe41472);throw _0xe41472;});}return _0x4e09e0;})[_0xf0be('0x24')](respondWithResult(_0x3a7e22,0xc9))['catch'](handleError(_0x3a7e22,null));};exports[_0xf0be('0x4e')]=function(_0xbe31bc,_0x2daa3b){if(_0xbe31bc[_0xf0be('0x44')]['id']){delete _0xbe31bc[_0xf0be('0x44')]['id'];}return db[_0xf0be('0x28')][_0xf0be('0x49')]({'where':{'id':_0xbe31bc[_0xf0be('0x41')]['id']}})[_0xf0be('0x24')](handleEntityNotFound(_0x2daa3b,null))[_0xf0be('0x24')](saveUpdates(_0xbe31bc['body'],null))[_0xf0be('0x24')](respondWithResult(_0x2daa3b,null))[_0xf0be('0x40')](handleError(_0x2daa3b,null));};exports[_0xf0be('0x21')]=function(_0x208292,_0x667259){return db[_0xf0be('0x28')][_0xf0be('0x49')]({'where':{'id':_0x208292[_0xf0be('0x41')]['id']}})[_0xf0be('0x24')](handleEntityNotFound(_0x667259,null))[_0xf0be('0x24')](removeEntity(_0x667259,null))[_0xf0be('0x40')](handleError(_0x667259,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 59b4b8d..c772c45 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 _0xc066=['moment','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','Template','lodash','util','../../config/logger','api'];(function(_0x52fe10,_0x117972){var _0x2638e3=function(_0x370eba){while(--_0x370eba){_0x52fe10['push'](_0x52fe10['shift']());}};_0x2638e3(++_0x117972);}(_0xc066,0xc8));var _0x6c06=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc066[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x6c06('0x0'));var util=require(_0x6c06('0x1'));var logger=require(_0x6c06('0x2'))(_0x6c06('0x3'));var moment=require(_0x6c06('0x4'));var BPromise=require(_0x6c06('0x5'));var rp=require(_0x6c06('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c06('0x7'));var config=require(_0x6c06('0x8'));var attributes=require(_0x6c06('0x9'));module[_0x6c06('0xa')]=function(_0x5ae9ac,_0x51e0f7){return _0x5ae9ac['define'](_0x6c06('0xb'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb69=['moment','request-promise','path','rimraf','./template.attributes','exports','Template','tools_templates','lodash','../../config/logger','api'];(function(_0x23e4e7,_0x4150d1){var _0x140744=function(_0x13f73e){while(--_0x13f73e){_0x23e4e7['push'](_0x23e4e7['shift']());}};_0x140744(++_0x4150d1);}(_0xbb69,0x147));var _0x9bb6=function(_0x17f41b,_0x34dfce){_0x17f41b=_0x17f41b-0x0;var _0x3ef877=_0xbb69[_0x17f41b];return _0x3ef877;};'use strict';var _=require(_0x9bb6('0x0'));var util=require('util');var logger=require(_0x9bb6('0x1'))(_0x9bb6('0x2'));var moment=require(_0x9bb6('0x3'));var BPromise=require('bluebird');var rp=require(_0x9bb6('0x4'));var fs=require('fs');var path=require(_0x9bb6('0x5'));var rimraf=require(_0x9bb6('0x6'));var config=require('../../config/environment');var attributes=require(_0x9bb6('0x7'));module[_0x9bb6('0x8')]=function(_0x56f8d8,_0x505acf){return _0x56f8d8['define'](_0x9bb6('0x9'),attributes,{'tableName':_0x9bb6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 2fa9f4d..f6c8658 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 _0xe3bd=['rpc','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetTemplate','Template','findAll','options','where','limit','include','map','model','attributes','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x30803d,_0x5841b0){var _0x4acfd6=function(_0x148bf6){while(--_0x148bf6){_0x30803d['push'](_0x30803d['shift']());}};_0x4acfd6(++_0x5841b0);}(_0xe3bd,0x126));var _0xde3b=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0xe3bd[_0x2df724];return _0x1b2504;};'use strict';var _=require('lodash');var util=require(_0xde3b('0x0'));var moment=require(_0xde3b('0x1'));var BPromise=require(_0xde3b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde3b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xde3b('0x4'));var logger=require(_0xde3b('0x5'))(_0xde3b('0x6'));var config=require('../../config/environment');var jayson=require(_0xde3b('0x7'));var client=jayson['client'][_0xde3b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47ad7f,_0x19a343,_0x29cdcc){return new BPromise(function(_0x202089,_0x2e0337){return client[_0xde3b('0x9')](_0x47ad7f,_0x29cdcc)[_0xde3b('0xa')](function(_0x5ab20e){logger[_0xde3b('0xb')](_0xde3b('0xc'),_0x19a343,_0xde3b('0xd'));logger[_0xde3b('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x19a343,_0xde3b('0xd'),JSON[_0xde3b('0xf')](_0x5ab20e));if(_0x5ab20e[_0xde3b('0x10')]){if(_0x5ab20e[_0xde3b('0x10')][_0xde3b('0x11')]===0x1f4){logger['error'](_0xde3b('0xc'),_0x19a343,_0x5ab20e[_0xde3b('0x10')][_0xde3b('0x12')]);return _0x2e0337(_0x5ab20e['error']['message']);}logger[_0xde3b('0x10')](_0xde3b('0xc'),_0x19a343,_0x5ab20e[_0xde3b('0x10')][_0xde3b('0x12')]);return _0x202089(_0x5ab20e[_0xde3b('0x10')][_0xde3b('0x12')]);}else{logger[_0xde3b('0xb')](_0xde3b('0xc'),_0x19a343,_0xde3b('0xd'));_0x202089(_0x5ab20e['result']['message']);}})['catch'](function(_0x36defd){logger['error']('Template,\x20%s,\x20%s',_0x19a343,_0x36defd);_0x2e0337(_0x36defd);});});}exports[_0xde3b('0x13')]=function(_0x1b6244){var _0x18479a=this;return new Promise(function(_0x1d5f53,_0x314026){return db[_0xde3b('0x14')][_0xde3b('0x15')]({'raw':_0x1b6244[_0xde3b('0x16')]?_0x1b6244[_0xde3b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1b6244[_0xde3b('0x16')]?_0x1b6244['options'][_0xde3b('0x17')]||null:null,'attributes':_0x1b6244[_0xde3b('0x16')]?_0x1b6244[_0xde3b('0x16')]['attributes']||null:null,'limit':_0x1b6244['options']?_0x1b6244[_0xde3b('0x16')][_0xde3b('0x18')]||null:null,'include':_0x1b6244[_0xde3b('0x16')]?_0x1b6244[_0xde3b('0x16')][_0xde3b('0x19')]?_[_0xde3b('0x1a')](_0x1b6244['options'][_0xde3b('0x19')],function(_0x2ba3b5){return{'model':db[_0x2ba3b5[_0xde3b('0x1b')]],'as':_0x2ba3b5['as'],'attributes':_0x2ba3b5[_0xde3b('0x1c')],'include':_0x2ba3b5[_0xde3b('0x19')]?_[_0xde3b('0x1a')](_0x2ba3b5[_0xde3b('0x19')],function(_0x1210be){return{'model':db[_0x1210be[_0xde3b('0x1b')]],'as':_0x1210be['as'],'attributes':_0x1210be[_0xde3b('0x1c')],'include':_0x1210be[_0xde3b('0x19')]?_['map'](_0x1210be[_0xde3b('0x19')],function(_0x50d34a){return{'model':db[_0x50d34a[_0xde3b('0x1b')]],'as':_0x50d34a['as'],'attributes':_0x50d34a[_0xde3b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xde3b('0xa')](function(_0x49a19c){logger['info'](_0xde3b('0x13'),_0x1b6244);logger[_0xde3b('0xe')](_0xde3b('0x13'),_0x1b6244,JSON[_0xde3b('0xf')](_0x49a19c));_0x1d5f53(_0x49a19c);})[_0xde3b('0x1d')](function(_0x372711){logger[_0xde3b('0x10')](_0xde3b('0x13'),_0x372711['message'],_0x1b6244);_0x314026(_0x18479a[_0xde3b('0x10')](0x1f4,_0x372711[_0xde3b('0x12')]));});});}; \ No newline at end of file +var _0xd840=['catch','Template','findAll','options','raw','where','limit','include','map','model','attributes','GetTemplate','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result'];(function(_0x23f705,_0x52e056){var _0x4ec9cc=function(_0x199f66){while(--_0x199f66){_0x23f705['push'](_0x23f705['shift']());}};_0x4ec9cc(++_0x52e056);}(_0xd840,0x16c));var _0x0d84=function(_0x312e38,_0x477bcb){_0x312e38=_0x312e38-0x0;var _0x2256c2=_0xd840[_0x312e38];return _0x2256c2;};'use strict';var _=require(_0x0d84('0x0'));var util=require(_0x0d84('0x1'));var moment=require(_0x0d84('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d84('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d84('0x4'))['db'];var utils=require(_0x0d84('0x5'));var logger=require(_0x0d84('0x6'))(_0x0d84('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d84('0x8'));var client=jayson[_0x0d84('0x9')][_0x0d84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x158d5e,_0x4ea997,_0x42bead){return new BPromise(function(_0x32be3f,_0x431cc9){return client['request'](_0x158d5e,_0x42bead)[_0x0d84('0xb')](function(_0x14b1f2){logger[_0x0d84('0xc')](_0x0d84('0xd'),_0x4ea997,'request\x20sent');logger[_0x0d84('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x4ea997,_0x0d84('0xf'),JSON['stringify'](_0x14b1f2));if(_0x14b1f2[_0x0d84('0x10')]){if(_0x14b1f2[_0x0d84('0x10')][_0x0d84('0x11')]===0x1f4){logger[_0x0d84('0x10')](_0x0d84('0xd'),_0x4ea997,_0x14b1f2[_0x0d84('0x10')][_0x0d84('0x12')]);return _0x431cc9(_0x14b1f2[_0x0d84('0x10')][_0x0d84('0x12')]);}logger['error'](_0x0d84('0xd'),_0x4ea997,_0x14b1f2[_0x0d84('0x10')][_0x0d84('0x12')]);return _0x32be3f(_0x14b1f2[_0x0d84('0x10')][_0x0d84('0x12')]);}else{logger[_0x0d84('0xc')](_0x0d84('0xd'),_0x4ea997,_0x0d84('0xf'));_0x32be3f(_0x14b1f2[_0x0d84('0x13')][_0x0d84('0x12')]);}})[_0x0d84('0x14')](function(_0x218dbd){logger[_0x0d84('0x10')]('Template,\x20%s,\x20%s',_0x4ea997,_0x218dbd);_0x431cc9(_0x218dbd);});});}exports['GetTemplate']=function(_0x23b01b){var _0x63c415=this;return new Promise(function(_0x107919,_0x34e8ae){return db[_0x0d84('0x15')][_0x0d84('0x16')]({'raw':_0x23b01b[_0x0d84('0x17')]?_0x23b01b[_0x0d84('0x17')][_0x0d84('0x18')]===undefined?!![]:![]:!![],'where':_0x23b01b[_0x0d84('0x17')]?_0x23b01b[_0x0d84('0x17')][_0x0d84('0x19')]||null:null,'attributes':_0x23b01b['options']?_0x23b01b['options']['attributes']||null:null,'limit':_0x23b01b[_0x0d84('0x17')]?_0x23b01b[_0x0d84('0x17')][_0x0d84('0x1a')]||null:null,'include':_0x23b01b[_0x0d84('0x17')]?_0x23b01b[_0x0d84('0x17')][_0x0d84('0x1b')]?_[_0x0d84('0x1c')](_0x23b01b[_0x0d84('0x17')]['include'],function(_0x42d22e){return{'model':db[_0x42d22e[_0x0d84('0x1d')]],'as':_0x42d22e['as'],'attributes':_0x42d22e['attributes'],'include':_0x42d22e[_0x0d84('0x1b')]?_[_0x0d84('0x1c')](_0x42d22e['include'],function(_0x536f35){return{'model':db[_0x536f35[_0x0d84('0x1d')]],'as':_0x536f35['as'],'attributes':_0x536f35['attributes'],'include':_0x536f35[_0x0d84('0x1b')]?_[_0x0d84('0x1c')](_0x536f35[_0x0d84('0x1b')],function(_0x400f75){return{'model':db[_0x400f75[_0x0d84('0x1d')]],'as':_0x400f75['as'],'attributes':_0x400f75[_0x0d84('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d84('0xb')](function(_0x5ce8db){logger[_0x0d84('0xc')]('GetTemplate',_0x23b01b);logger[_0x0d84('0xe')](_0x0d84('0x1f'),_0x23b01b,JSON['stringify'](_0x5ce8db));_0x107919(_0x5ce8db);})['catch'](function(_0x45e004){logger[_0x0d84('0x10')](_0x0d84('0x1f'),_0x45e004[_0x0d84('0x12')],_0x23b01b);_0x34e8ae(_0x63c415['error'](0x1f4,_0x45e004[_0x0d84('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 9815d19..8324819 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 _0xcdd6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','/:id/actions','addAction','put','delete','destroy','exports','multer','util'];(function(_0x49e756,_0x19265c){var _0x5de009=function(_0x64273b){while(--_0x64273b){_0x49e756['push'](_0x49e756['shift']());}};_0x5de009(++_0x19265c);}(_0xcdd6,0x177));var _0x6cdd=function(_0x2713b5,_0x4dbc28){_0x2713b5=_0x2713b5-0x0;var _0x4fb13f=_0xcdd6[_0x2713b5];return _0x4fb13f;};'use strict';var multer=require(_0x6cdd('0x0'));var util=require(_0x6cdd('0x1'));var path=require('path');var timeout=require(_0x6cdd('0x2'));var express=require(_0x6cdd('0x3'));var router=express[_0x6cdd('0x4')]();var fs_extra=require(_0x6cdd('0x5'));var auth=require(_0x6cdd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6cdd('0x7'));var controller=require(_0x6cdd('0x8'));router['get']('/',auth[_0x6cdd('0x9')](),controller[_0x6cdd('0xa')]);router[_0x6cdd('0xb')](_0x6cdd('0xc'),auth[_0x6cdd('0x9')](),controller[_0x6cdd('0xd')]);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x6cdd('0xe')]);router[_0x6cdd('0xb')](_0x6cdd('0xf'),auth[_0x6cdd('0x9')](),controller[_0x6cdd('0x10')]);router['get']('/:id/actions',auth[_0x6cdd('0x9')](),controller[_0x6cdd('0x11')]);router[_0x6cdd('0x12')]('/',auth[_0x6cdd('0x9')](),controller[_0x6cdd('0x13')]);router[_0x6cdd('0x12')](_0x6cdd('0x14'),auth['isAuthenticated'](),controller[_0x6cdd('0x15')]);router[_0x6cdd('0x12')](_0x6cdd('0xf'),auth[_0x6cdd('0x9')](),controller[_0x6cdd('0x16')]);router[_0x6cdd('0x12')](_0x6cdd('0x17'),auth[_0x6cdd('0x9')](),controller[_0x6cdd('0x18')]);router[_0x6cdd('0x19')](_0x6cdd('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6cdd('0x1a')](_0x6cdd('0xc'),auth[_0x6cdd('0x9')](),controller[_0x6cdd('0x1b')]);module[_0x6cdd('0x1c')]=router; \ No newline at end of file +var _0x9f17=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions'];(function(_0x438e12,_0x4995e5){var _0x341a23=function(_0x2f5207){while(--_0x2f5207){_0x438e12['push'](_0x438e12['shift']());}};_0x341a23(++_0x4995e5);}(_0x9f17,0x73));var _0x79f1=function(_0x1c739f,_0x3ac221){_0x1c739f=_0x1c739f-0x0;var _0xdb3df7=_0x9f17[_0x1c739f];return _0xdb3df7;};'use strict';var multer=require(_0x79f1('0x0'));var util=require('util');var path=require(_0x79f1('0x1'));var timeout=require(_0x79f1('0x2'));var express=require(_0x79f1('0x3'));var router=express[_0x79f1('0x4')]();var fs_extra=require(_0x79f1('0x5'));var auth=require(_0x79f1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x79f1('0x7'));var controller=require(_0x79f1('0x8'));router[_0x79f1('0x9')]('/',auth[_0x79f1('0xa')](),controller['index']);router[_0x79f1('0x9')](_0x79f1('0xb'),auth[_0x79f1('0xa')](),controller[_0x79f1('0xc')]);router[_0x79f1('0x9')](_0x79f1('0xd'),auth['isAuthenticated'](),controller[_0x79f1('0xe')]);router[_0x79f1('0x9')](_0x79f1('0xf'),auth['isAuthenticated'](),controller[_0x79f1('0x10')]);router['get'](_0x79f1('0x11'),auth[_0x79f1('0xa')](),controller[_0x79f1('0x12')]);router[_0x79f1('0x13')]('/',auth['isAuthenticated'](),controller[_0x79f1('0x14')]);router[_0x79f1('0x13')]('/:id/all_conditions',auth[_0x79f1('0xa')](),controller[_0x79f1('0x15')]);router[_0x79f1('0x13')](_0x79f1('0xf'),auth['isAuthenticated'](),controller[_0x79f1('0x16')]);router['post'](_0x79f1('0x11'),auth['isAuthenticated'](),controller['addAction']);router[_0x79f1('0x17')](_0x79f1('0xb'),auth[_0x79f1('0xa')](),controller[_0x79f1('0x18')]);router[_0x79f1('0x19')](_0x79f1('0xb'),auth[_0x79f1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index b3359a9..5dd4fc8 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 _0xd875=['exports','STRING'];(function(_0x151f45,_0x2d07fd){var _0x2e2550=function(_0x568596){while(--_0x568596){_0x151f45['push'](_0x151f45['shift']());}};_0x2e2550(++_0x2d07fd);}(_0xd875,0xe4));var _0x5d87=function(_0x309385,_0x3ab38f){_0x309385=_0x309385-0x0;var _0x45b0f5=_0xd875[_0x309385];return _0x45b0f5;};'use strict';var Sequelize=require('sequelize');module[_0x5d87('0x0')]={'name':{'type':Sequelize[_0x5d87('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5d87('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7232=['exports','STRING','BOOLEAN','sequelize'];(function(_0x324f5e,_0x1831f0){var _0x13c51f=function(_0x1dc8f3){while(--_0x1dc8f3){_0x324f5e['push'](_0x324f5e['shift']());}};_0x13c51f(++_0x1831f0);}(_0x7232,0x1b7));var _0x2723=function(_0x5235ba,_0x427fcd){_0x5235ba=_0x5235ba-0x0;var _0x36112e=_0x7232[_0x5235ba];return _0x36112e;};'use strict';var Sequelize=require(_0x2723('0x0'));module[_0x2723('0x1')]={'name':{'type':Sequelize[_0x2723('0x2')]},'channel':{'type':Sequelize[_0x2723('0x2')]},'description':{'type':Sequelize[_0x2723('0x2')]},'status':{'type':Sequelize[_0x2723('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 da5dda9..14aa322 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 _0x4e5d=['Content-Range','json','apply','reject','save','then','Triggers','UserProfileResource','destroy','error','stack','name','index','map','Trigger','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','Condition','sort','getAnyConditions','findOne','addAction','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x3bbfc3,_0x5673c7){var _0xdcf097=function(_0xc8af8e){while(--_0xc8af8e){_0x3bbfc3['push'](_0x3bbfc3['shift']());}};_0xdcf097(++_0x5673c7);}(_0x4e5d,0x9b));var _0xd4e5=function(_0x4ad0f7,_0x1920b0){_0x4ad0f7=_0x4ad0f7-0x0;var _0x30f5c8=_0x4e5d[_0x4ad0f7];return _0x30f5c8;};'use strict';var emlformat=require(_0xd4e5('0x0'));var rimraf=require(_0xd4e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4e5('0x2'));var rp=require(_0xd4e5('0x3'));var moment=require(_0xd4e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd4e5('0x5'));var util=require(_0xd4e5('0x6'));var path=require(_0xd4e5('0x7'));var sox=require(_0xd4e5('0x8'));var csv=require(_0xd4e5('0x9'));var ejs=require(_0xd4e5('0xa'));var fs=require('fs');var fs_extra=require(_0xd4e5('0xb'));var _=require(_0xd4e5('0xc'));var squel=require(_0xd4e5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd4e5('0xe'));var toCsv=require(_0xd4e5('0x9'));var querystring=require(_0xd4e5('0xf'));var Papa=require('papaparse');var Redis=require(_0xd4e5('0x10'));var authService=require(_0xd4e5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd4e5('0x12'));var hardwareService=require(_0xd4e5('0x13'));var logger=require(_0xd4e5('0x14'))(_0xd4e5('0x15'));var utils=require(_0xd4e5('0x16'));var config=require(_0xd4e5('0x17'));var licenseUtil=require(_0xd4e5('0x18'));var db=require(_0xd4e5('0x19'))['db'];function respondWithStatusCode(_0x403022,_0x4f84cb){_0x4f84cb=_0x4f84cb||0xcc;return function(_0x22dce5){if(_0x22dce5){return _0x403022[_0xd4e5('0x1a')](_0x4f84cb);}return _0x403022[_0xd4e5('0x1b')](_0x4f84cb)[_0xd4e5('0x1c')]();};}function respondWithResult(_0xb7ce9c,_0x34bb94){_0x34bb94=_0x34bb94||0xc8;return function(_0x3e1c4f){if(_0x3e1c4f){return _0xb7ce9c[_0xd4e5('0x1b')](_0x34bb94)['json'](_0x3e1c4f);}};}function respondWithFilteredResult(_0x4ba1d0,_0xc30ff8){return function(_0x3b6a32){if(_0x3b6a32){var _0xc0d13a=typeof _0xc30ff8['offset']===_0xd4e5('0x1d')&&typeof _0xc30ff8[_0xd4e5('0x1e')]==='undefined';var _0x5473db=_0x3b6a32[_0xd4e5('0x1f')];var _0x3539b1=_0xc0d13a?0x0:_0xc30ff8[_0xd4e5('0x20')];var _0x401462=_0xc0d13a?_0x3b6a32['count']:_0xc30ff8[_0xd4e5('0x20')]+_0xc30ff8[_0xd4e5('0x1e')];var _0x5e173f;if(_0x401462>=_0x5473db){_0x401462=_0x5473db;_0x5e173f=0xc8;}else{_0x5e173f=0xce;}_0x4ba1d0[_0xd4e5('0x1b')](_0x5e173f);return _0x4ba1d0['set'](_0xd4e5('0x21'),_0x3539b1+'-'+_0x401462+'/'+_0x5473db)[_0xd4e5('0x22')](_0x3b6a32);}return null;};}function patchUpdates(_0x7b1527){return function(_0x10f925){try{jsonpatch[_0xd4e5('0x23')](_0x10f925,_0x7b1527,!![]);}catch(_0x2f1319){return BPromise[_0xd4e5('0x24')](_0x2f1319);}return _0x10f925[_0xd4e5('0x25')]();};}function saveUpdates(_0x1c74e5,_0x3d0fc9){return function(_0x9cbbe){if(_0x9cbbe){return _0x9cbbe['update'](_0x1c74e5)[_0xd4e5('0x26')](function(_0x372016){return _0x372016;});}return null;};}function removeEntity(_0x56eefd,_0x90cb71){return function(_0x483757){if(_0x483757){return _0x483757['destroy']()['then'](function(){var _0x3d01c8=_0x483757['get']({'plain':!![]});var _0x1b7b3=_0xd4e5('0x27');return db[_0xd4e5('0x28')][_0xd4e5('0x29')]({'where':{'type':_0x1b7b3,'resourceId':_0x3d01c8['id']}})[_0xd4e5('0x26')](function(){return _0x483757;});})['then'](function(){_0x56eefd[_0xd4e5('0x1b')](0xcc)[_0xd4e5('0x1c')]();});}};}function handleEntityNotFound(_0x4f46df,_0x33e513){return function(_0x39c745){if(!_0x39c745){_0x4f46df[_0xd4e5('0x1a')](0x194);}return _0x39c745;};}function handleError(_0x2febd1,_0x1375d4){_0x1375d4=_0x1375d4||0x1f4;return function(_0x423ce6){logger[_0xd4e5('0x2a')](_0x423ce6[_0xd4e5('0x2b')]);if(_0x423ce6[_0xd4e5('0x2c')]){delete _0x423ce6[_0xd4e5('0x2c')];}_0x2febd1['status'](_0x1375d4)['send'](_0x423ce6);};}exports[_0xd4e5('0x2d')]=function(_0x4a6810,_0x2f5c17){var _0x18970b={},_0x3b3896={},_0xec7194={'count':0x0,'rows':[]};var _0x317c7f=_[_0xd4e5('0x2e')](db[_0xd4e5('0x2f')][_0xd4e5('0x30')],function(_0x577c29){return{'name':_0x577c29['fieldName'],'type':_0x577c29[_0xd4e5('0x31')][_0xd4e5('0x32')]};});_0x3b3896[_0xd4e5('0x33')]=_[_0xd4e5('0x2e')](_0x317c7f,_0xd4e5('0x2c'));_0x3b3896[_0xd4e5('0x34')]=_[_0xd4e5('0x35')](_0x4a6810[_0xd4e5('0x34')]);_0x3b3896['filters']=_[_0xd4e5('0x36')](_0x3b3896[_0xd4e5('0x33')],_0x3b3896[_0xd4e5('0x34')]);_0x18970b[_0xd4e5('0x37')]=_[_0xd4e5('0x36')](_0x3b3896[_0xd4e5('0x33')],qs[_0xd4e5('0x38')](_0x4a6810[_0xd4e5('0x34')]['fields']));_0x18970b[_0xd4e5('0x37')]=_0x18970b['attributes'][_0xd4e5('0x39')]?_0x18970b[_0xd4e5('0x37')]:_0x3b3896[_0xd4e5('0x33')];if(!_0x4a6810[_0xd4e5('0x34')][_0xd4e5('0x3a')](_0xd4e5('0x3b'))){_0x18970b[_0xd4e5('0x1e')]=qs['limit'](_0x4a6810['query']['limit']);_0x18970b['offset']=qs[_0xd4e5('0x20')](_0x4a6810[_0xd4e5('0x34')]['offset']);}_0x18970b[_0xd4e5('0x3c')]=qs['sort'](_0x4a6810[_0xd4e5('0x34')]['sort']);_0x18970b[_0xd4e5('0x3d')]=qs[_0xd4e5('0x3e')](_[_0xd4e5('0x3f')](_0x4a6810[_0xd4e5('0x34')],_0x3b3896[_0xd4e5('0x3e')]),_0x317c7f);if(_0x4a6810[_0xd4e5('0x34')][_0xd4e5('0x40')]){_0x18970b[_0xd4e5('0x3d')]=_[_0xd4e5('0x41')](_0x18970b[_0xd4e5('0x3d')],{'$or':_[_0xd4e5('0x2e')](_0x317c7f,function(_0x30c183){if(_0x30c183[_0xd4e5('0x31')]!==_0xd4e5('0x42')){var _0x54dc95={};_0x54dc95[_0x30c183[_0xd4e5('0x2c')]]={'$like':'%'+_0x4a6810['query']['filter']+'%'};return _0x54dc95;}})});}_0x18970b=_[_0xd4e5('0x41')]({},_0x18970b,_0x4a6810['options']);var _0x19d709={'where':_0x18970b[_0xd4e5('0x3d')]};return db[_0xd4e5('0x2f')][_0xd4e5('0x1f')](_0x19d709)['then'](function(_0x141334){_0xec7194[_0xd4e5('0x1f')]=_0x141334;if(_0x4a6810[_0xd4e5('0x34')][_0xd4e5('0x43')]){_0x18970b[_0xd4e5('0x44')]=[{'all':!![]}];}return db[_0xd4e5('0x2f')][_0xd4e5('0x45')](_0x18970b);})['then'](function(_0x4dae44){_0xec7194[_0xd4e5('0x46')]=_0x4dae44;return _0xec7194;})['then'](respondWithFilteredResult(_0x2f5c17,_0x18970b))[_0xd4e5('0x47')](handleError(_0x2f5c17,null));};exports[_0xd4e5('0x48')]=function(_0x4aba2b,_0x18e95a){var _0x213e21={'raw':![],'where':{'id':_0x4aba2b[_0xd4e5('0x49')]['id']}},_0x3362fa={};_0x3362fa[_0xd4e5('0x33')]=_[_0xd4e5('0x35')](db[_0xd4e5('0x2f')][_0xd4e5('0x30')]);_0x3362fa[_0xd4e5('0x34')]=_[_0xd4e5('0x35')](_0x4aba2b[_0xd4e5('0x34')]);_0x3362fa[_0xd4e5('0x3e')]=_[_0xd4e5('0x36')](_0x3362fa[_0xd4e5('0x33')],_0x3362fa[_0xd4e5('0x34')]);_0x213e21['attributes']=_[_0xd4e5('0x36')](_0x3362fa['model'],qs[_0xd4e5('0x38')](_0x4aba2b[_0xd4e5('0x34')]['fields']));_0x213e21['attributes']=_0x213e21[_0xd4e5('0x37')][_0xd4e5('0x39')]?_0x213e21['attributes']:_0x3362fa[_0xd4e5('0x33')];if(_0x4aba2b[_0xd4e5('0x34')]['includeAll']){_0x213e21[_0xd4e5('0x44')]=[{'all':!![]}];}_0x213e21=_['merge']({},_0x213e21,_0x4aba2b[_0xd4e5('0x4a')]);return db[_0xd4e5('0x2f')][_0xd4e5('0x4b')](_0x213e21)['then'](handleEntityNotFound(_0x18e95a,null))['then'](respondWithResult(_0x18e95a,null))['catch'](handleError(_0x18e95a,null));};exports[_0xd4e5('0x4c')]=function(_0x17618d,_0x456ee3){return db[_0xd4e5('0x2f')][_0xd4e5('0x4c')](_0x17618d[_0xd4e5('0x4d')],{})[_0xd4e5('0x26')](function(_0x35eb21){var _0x1e5b1a=_0x17618d[_0xd4e5('0x4e')]['get']({'plain':!![]});if(!_0x1e5b1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e5b1a[_0xd4e5('0x4f')]===_0xd4e5('0x4e')){var _0x5902dd=_0x35eb21[_0xd4e5('0x50')]({'plain':!![]});var _0xb87a57=_0xd4e5('0x27');return db[_0xd4e5('0x51')][_0xd4e5('0x4b')]({'where':{'name':_0xb87a57,'userProfileId':_0x1e5b1a[_0xd4e5('0x52')]},'raw':!![]})['then'](function(_0x220029){if(_0x220029&&_0x220029[_0xd4e5('0x53')]===0x0){return db[_0xd4e5('0x28')][_0xd4e5('0x4c')]({'name':_0x5902dd['name'],'resourceId':_0x5902dd['id'],'type':_0x220029[_0xd4e5('0x2c')],'sectionId':_0x220029['id']},{})[_0xd4e5('0x26')](function(){return _0x35eb21;});}else{return _0x35eb21;}})[_0xd4e5('0x47')](function(_0xbc0d72){logger['error'](_0xd4e5('0x54'),_0xbc0d72);throw _0xbc0d72;});}return _0x35eb21;})[_0xd4e5('0x26')](respondWithResult(_0x456ee3,0xc9))['catch'](handleError(_0x456ee3,null));};exports[_0xd4e5('0x55')]=function(_0xb44bfa,_0x1e1729){if(_0xb44bfa[_0xd4e5('0x4d')]['id']){delete _0xb44bfa[_0xd4e5('0x4d')]['id'];}return db[_0xd4e5('0x2f')][_0xd4e5('0x4b')]({'where':{'id':_0xb44bfa[_0xd4e5('0x49')]['id']}})[_0xd4e5('0x26')](handleEntityNotFound(_0x1e1729,null))[_0xd4e5('0x26')](saveUpdates(_0xb44bfa['body'],null))[_0xd4e5('0x26')](respondWithResult(_0x1e1729,null))[_0xd4e5('0x47')](handleError(_0x1e1729,null));};exports[_0xd4e5('0x29')]=function(_0x3a87c2,_0x2fc198){return db[_0xd4e5('0x2f')][_0xd4e5('0x4b')]({'where':{'id':_0x3a87c2[_0xd4e5('0x49')]['id']}})[_0xd4e5('0x26')](handleEntityNotFound(_0x2fc198,null))['then'](removeEntity(_0x2fc198,null))['catch'](handleError(_0x2fc198,null));};exports['addAllCondition']=function(_0x73e476,_0x4e10a4,_0x2f8bea){if(_0x73e476[_0xd4e5('0x4d')]['id']){delete _0x73e476[_0xd4e5('0x4d')]['id'];}return db[_0xd4e5('0x2f')][_0xd4e5('0x4b')]({'where':{'id':_0x73e476[_0xd4e5('0x49')]['id']}})[_0xd4e5('0x26')](handleEntityNotFound(_0x4e10a4,null))[_0xd4e5('0x26')](function(_0x327d97){if(_0x327d97){_0x73e476[_0xd4e5('0x4d')][_0xd4e5('0x56')]=_0x327d97['id'];return db[_0xd4e5('0x57')][_0xd4e5('0x4c')](_0x73e476[_0xd4e5('0x4d')]);}})[_0xd4e5('0x26')](respondWithResult(_0x4e10a4,null))[_0xd4e5('0x47')](handleError(_0x4e10a4,null));};exports['addAnyCondition']=function(_0x14c113,_0x4a37f7,_0x468006){if(_0x14c113[_0xd4e5('0x4d')]['id']){delete _0x14c113[_0xd4e5('0x4d')]['id'];}return db[_0xd4e5('0x2f')]['find']({'where':{'id':_0x14c113[_0xd4e5('0x49')]['id']}})[_0xd4e5('0x26')](handleEntityNotFound(_0x4a37f7,null))['then'](function(_0x503a13){if(_0x503a13){_0x14c113[_0xd4e5('0x4d')]['TriggerAnyId']=_0x503a13['id'];return db[_0xd4e5('0x57')]['create'](_0x14c113[_0xd4e5('0x4d')]);}})[_0xd4e5('0x26')](respondWithResult(_0x4a37f7,null))[_0xd4e5('0x47')](handleError(_0x4a37f7,null));};exports['getAllConditions']=function(_0x44e6ec,_0x456142,_0x315e2f){var _0x4ec576={};var _0x58eeed={};var _0x3f2e1a;var _0x3548a4;return db[_0xd4e5('0x2f')]['findOne']({'where':{'id':_0x44e6ec['params']['id']}})['then'](handleEntityNotFound(_0x456142,null))[_0xd4e5('0x26')](function(_0x20e7da){if(_0x20e7da){_0x3f2e1a=_0x20e7da;_0x58eeed['model']=_[_0xd4e5('0x35')](db['Condition']['rawAttributes']);_0x58eeed[_0xd4e5('0x34')]=_[_0xd4e5('0x35')](_0x44e6ec[_0xd4e5('0x34')]);_0x58eeed[_0xd4e5('0x3e')]=_[_0xd4e5('0x36')](_0x58eeed[_0xd4e5('0x33')],_0x58eeed['query']);_0x4ec576[_0xd4e5('0x37')]=_[_0xd4e5('0x36')](_0x58eeed[_0xd4e5('0x33')],qs[_0xd4e5('0x38')](_0x44e6ec[_0xd4e5('0x34')]['fields']));_0x4ec576[_0xd4e5('0x37')]=_0x4ec576[_0xd4e5('0x37')]['length']?_0x4ec576[_0xd4e5('0x37')]:_0x58eeed[_0xd4e5('0x33')];_0x4ec576[_0xd4e5('0x3c')]=qs[_0xd4e5('0x58')](_0x44e6ec[_0xd4e5('0x34')][_0xd4e5('0x58')]);_0x4ec576[_0xd4e5('0x3d')]=qs[_0xd4e5('0x3e')](_[_0xd4e5('0x3f')](_0x44e6ec[_0xd4e5('0x34')],_0x58eeed['filters']));if(_0x44e6ec[_0xd4e5('0x34')]['filter']){_0x4ec576['where']=_[_0xd4e5('0x41')](_0x4ec576[_0xd4e5('0x3d')],{'$or':_['map'](_0x4ec576['attributes'],function(_0x460ea7){var _0x2da460={};_0x2da460[_0x460ea7]={'$like':'%'+_0x44e6ec[_0xd4e5('0x34')]['filter']+'%'};return _0x2da460;})});}_0x4ec576=_[_0xd4e5('0x41')]({},_0x4ec576,_0x44e6ec['options']);return _0x3f2e1a['getAllConditions'](_0x4ec576);}})[_0xd4e5('0x26')](function(_0x54d399){if(_0x54d399){_0x3548a4=_0x54d399[_0xd4e5('0x39')];if(!_0x44e6ec[_0xd4e5('0x34')][_0xd4e5('0x3a')](_0xd4e5('0x3b'))){_0x4ec576[_0xd4e5('0x1e')]=qs[_0xd4e5('0x1e')](_0x44e6ec[_0xd4e5('0x34')][_0xd4e5('0x1e')]);_0x4ec576[_0xd4e5('0x20')]=qs[_0xd4e5('0x20')](_0x44e6ec[_0xd4e5('0x34')][_0xd4e5('0x20')]);}return _0x3f2e1a['getAllConditions'](_0x4ec576);}})['then'](function(_0x48a2e9){if(_0x48a2e9){return _0x48a2e9?{'count':_0x3548a4,'rows':_0x48a2e9}:null;}})[_0xd4e5('0x26')](respondWithResult(_0x456142,null))['catch'](handleError(_0x456142,null));};exports[_0xd4e5('0x59')]=function(_0x48a41a,_0x281af0,_0x3abf3a){var _0x43ed39={};var _0x1295d9={};var _0x333c20;var _0xfe53ef;return db[_0xd4e5('0x2f')][_0xd4e5('0x5a')]({'where':{'id':_0x48a41a[_0xd4e5('0x49')]['id']}})[_0xd4e5('0x26')](handleEntityNotFound(_0x281af0,null))[_0xd4e5('0x26')](function(_0x4ea5b7){if(_0x4ea5b7){_0x333c20=_0x4ea5b7;_0x1295d9[_0xd4e5('0x33')]=_['keys'](db[_0xd4e5('0x57')][_0xd4e5('0x30')]);_0x1295d9[_0xd4e5('0x34')]=_[_0xd4e5('0x35')](_0x48a41a['query']);_0x1295d9[_0xd4e5('0x3e')]=_[_0xd4e5('0x36')](_0x1295d9['model'],_0x1295d9[_0xd4e5('0x34')]);_0x43ed39[_0xd4e5('0x37')]=_['intersection'](_0x1295d9[_0xd4e5('0x33')],qs[_0xd4e5('0x38')](_0x48a41a[_0xd4e5('0x34')][_0xd4e5('0x38')]));_0x43ed39[_0xd4e5('0x37')]=_0x43ed39[_0xd4e5('0x37')][_0xd4e5('0x39')]?_0x43ed39['attributes']:_0x1295d9[_0xd4e5('0x33')];_0x43ed39[_0xd4e5('0x3c')]=qs['sort'](_0x48a41a[_0xd4e5('0x34')][_0xd4e5('0x58')]);_0x43ed39[_0xd4e5('0x3d')]=qs[_0xd4e5('0x3e')](_[_0xd4e5('0x3f')](_0x48a41a[_0xd4e5('0x34')],_0x1295d9[_0xd4e5('0x3e')]));if(_0x48a41a[_0xd4e5('0x34')][_0xd4e5('0x40')]){_0x43ed39['where']=_[_0xd4e5('0x41')](_0x43ed39[_0xd4e5('0x3d')],{'$or':_[_0xd4e5('0x2e')](_0x43ed39[_0xd4e5('0x37')],function(_0x4ee3be){var _0x1fda23={};_0x1fda23[_0x4ee3be]={'$like':'%'+_0x48a41a['query'][_0xd4e5('0x40')]+'%'};return _0x1fda23;})});}_0x43ed39=_['merge']({},_0x43ed39,_0x48a41a[_0xd4e5('0x4a')]);return _0x333c20[_0xd4e5('0x59')](_0x43ed39);}})[_0xd4e5('0x26')](function(_0x478156){if(_0x478156){_0xfe53ef=_0x478156[_0xd4e5('0x39')];if(!_0x48a41a[_0xd4e5('0x34')][_0xd4e5('0x3a')](_0xd4e5('0x3b'))){_0x43ed39[_0xd4e5('0x1e')]=qs['limit'](_0x48a41a[_0xd4e5('0x34')]['limit']);_0x43ed39[_0xd4e5('0x20')]=qs[_0xd4e5('0x20')](_0x48a41a[_0xd4e5('0x34')][_0xd4e5('0x20')]);}return _0x333c20[_0xd4e5('0x59')](_0x43ed39);}})[_0xd4e5('0x26')](function(_0x5c73cd){if(_0x5c73cd){return _0x5c73cd?{'count':_0xfe53ef,'rows':_0x5c73cd}:null;}})[_0xd4e5('0x26')](respondWithResult(_0x281af0,null))[_0xd4e5('0x47')](handleError(_0x281af0,null));};exports[_0xd4e5('0x5b')]=function(_0x3fa0d5,_0x2e10cf,_0xa71964){if(_0x3fa0d5[_0xd4e5('0x4d')]['id']){delete _0x3fa0d5[_0xd4e5('0x4d')]['id'];}return db[_0xd4e5('0x2f')][_0xd4e5('0x4b')]({'where':{'id':_0x3fa0d5[_0xd4e5('0x49')]['id']}})[_0xd4e5('0x26')](handleEntityNotFound(_0x2e10cf,null))[_0xd4e5('0x26')](function(_0x166ba8){if(_0x166ba8){_0x3fa0d5[_0xd4e5('0x4d')]['TriggerId']=_0x166ba8['id'];return db['Action'][_0xd4e5('0x4c')](_0x3fa0d5['body']);}})[_0xd4e5('0x26')](respondWithResult(_0x2e10cf,null))['catch'](handleError(_0x2e10cf,null));};exports['getActions']=function(_0x2e9491,_0x43af03,_0x2a1930){var _0x3d25b7={};var _0x552c70={};var _0x399661;var _0x364305;return db[_0xd4e5('0x2f')]['findOne']({'where':{'id':_0x2e9491['params']['id']}})['then'](handleEntityNotFound(_0x43af03,null))['then'](function(_0xadf17b){if(_0xadf17b){_0x399661=_0xadf17b;_0x552c70['model']=_[_0xd4e5('0x35')](db[_0xd4e5('0x5c')][_0xd4e5('0x30')]);_0x552c70[_0xd4e5('0x34')]=_[_0xd4e5('0x35')](_0x2e9491[_0xd4e5('0x34')]);_0x552c70[_0xd4e5('0x3e')]=_[_0xd4e5('0x36')](_0x552c70['model'],_0x552c70[_0xd4e5('0x34')]);_0x3d25b7[_0xd4e5('0x37')]=_[_0xd4e5('0x36')](_0x552c70['model'],qs['fields'](_0x2e9491[_0xd4e5('0x34')][_0xd4e5('0x38')]));_0x3d25b7[_0xd4e5('0x37')]=_0x3d25b7[_0xd4e5('0x37')][_0xd4e5('0x39')]?_0x3d25b7[_0xd4e5('0x37')]:_0x552c70[_0xd4e5('0x33')];_0x3d25b7['order']=qs[_0xd4e5('0x58')](_0x2e9491[_0xd4e5('0x34')]['sort']);_0x3d25b7['where']=qs['filters'](_['pick'](_0x2e9491['query'],_0x552c70[_0xd4e5('0x3e')]));if(_0x2e9491['query'][_0xd4e5('0x40')]){_0x3d25b7[_0xd4e5('0x3d')]=_[_0xd4e5('0x41')](_0x3d25b7[_0xd4e5('0x3d')],{'$or':_[_0xd4e5('0x2e')](_0x3d25b7['attributes'],function(_0x15ecb5){var _0x159552={};_0x159552[_0x15ecb5]={'$like':'%'+_0x2e9491[_0xd4e5('0x34')]['filter']+'%'};return _0x159552;})});}_0x3d25b7=_[_0xd4e5('0x41')]({},_0x3d25b7,_0x2e9491['options']);return _0x399661[_0xd4e5('0x5d')](_0x3d25b7);}})[_0xd4e5('0x26')](function(_0x162a56){if(_0x162a56){_0x364305=_0x162a56[_0xd4e5('0x39')];if(!_0x2e9491[_0xd4e5('0x34')]['hasOwnProperty'](_0xd4e5('0x3b'))){_0x3d25b7['limit']=qs[_0xd4e5('0x1e')](_0x2e9491[_0xd4e5('0x34')]['limit']);_0x3d25b7[_0xd4e5('0x20')]=qs['offset'](_0x2e9491[_0xd4e5('0x34')]['offset']);}return _0x399661[_0xd4e5('0x5d')](_0x3d25b7);}})[_0xd4e5('0x26')](function(_0x3c28af){if(_0x3c28af){return _0x3c28af?{'count':_0x364305,'rows':_0x3c28af}:null;}})['then'](respondWithResult(_0x43af03,null))[_0xd4e5('0x47')](handleError(_0x43af03,null));}; \ No newline at end of file +var _0x714d=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Trigger','includeAll','include','findAll','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','error','find','params','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','findOne','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','Triggers','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x3fe8a1,_0x49eb7a){var _0x1cf353=function(_0x120c3e){while(--_0x120c3e){_0x3fe8a1['push'](_0x3fe8a1['shift']());}};_0x1cf353(++_0x49eb7a);}(_0x714d,0x144));var _0xd714=function(_0x2718f9,_0x84b4e3){_0x2718f9=_0x2718f9-0x0;var _0xd7f510=_0x714d[_0x2718f9];return _0xd7f510;};'use strict';var emlformat=require(_0xd714('0x0'));var rimraf=require(_0xd714('0x1'));var zipdir=require(_0xd714('0x2'));var jsonpatch=require(_0xd714('0x3'));var rp=require(_0xd714('0x4'));var moment=require('moment');var BPromise=require(_0xd714('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd714('0x6'));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(_0xd714('0x7'));var squel=require(_0xd714('0x8'));var crypto=require(_0xd714('0x9'));var jsforce=require(_0xd714('0xa'));var deskjs=require(_0xd714('0xb'));var toCsv=require(_0xd714('0xc'));var querystring=require(_0xd714('0xd'));var Papa=require(_0xd714('0xe'));var Redis=require(_0xd714('0xf'));var authService=require(_0xd714('0x10'));var qs=require(_0xd714('0x11'));var as=require(_0xd714('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd714('0x13'))('api');var utils=require(_0xd714('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd714('0x15'))['db'];function respondWithStatusCode(_0x3cd2a7,_0x4320bd){_0x4320bd=_0x4320bd||0xcc;return function(_0x4c15b5){if(_0x4c15b5){return _0x3cd2a7[_0xd714('0x16')](_0x4320bd);}return _0x3cd2a7[_0xd714('0x17')](_0x4320bd)[_0xd714('0x18')]();};}function respondWithResult(_0xfd4c60,_0x55cf6a){_0x55cf6a=_0x55cf6a||0xc8;return function(_0x176e9a){if(_0x176e9a){return _0xfd4c60['status'](_0x55cf6a)[_0xd714('0x19')](_0x176e9a);}};}function respondWithFilteredResult(_0x1f27e5,_0x2ad40a){return function(_0x3eb8da){if(_0x3eb8da){var _0x524c72=typeof _0x2ad40a[_0xd714('0x1a')]===_0xd714('0x1b')&&typeof _0x2ad40a[_0xd714('0x1c')]==='undefined';var _0x246c8e=_0x3eb8da[_0xd714('0x1d')];var _0x34bd9f=_0x524c72?0x0:_0x2ad40a[_0xd714('0x1a')];var _0x2e8fdd=_0x524c72?_0x3eb8da[_0xd714('0x1d')]:_0x2ad40a['offset']+_0x2ad40a[_0xd714('0x1c')];var _0x498900;if(_0x2e8fdd>=_0x246c8e){_0x2e8fdd=_0x246c8e;_0x498900=0xc8;}else{_0x498900=0xce;}_0x1f27e5['status'](_0x498900);return _0x1f27e5[_0xd714('0x1e')]('Content-Range',_0x34bd9f+'-'+_0x2e8fdd+'/'+_0x246c8e)[_0xd714('0x19')](_0x3eb8da);}return null;};}function patchUpdates(_0x1e5a30){return function(_0xe43594){try{jsonpatch[_0xd714('0x1f')](_0xe43594,_0x1e5a30,!![]);}catch(_0x2276e7){return BPromise[_0xd714('0x20')](_0x2276e7);}return _0xe43594['save']();};}function saveUpdates(_0x458157,_0x374148){return function(_0x20e1c4){if(_0x20e1c4){return _0x20e1c4[_0xd714('0x21')](_0x458157)[_0xd714('0x22')](function(_0x1bb841){return _0x1bb841;});}return null;};}function removeEntity(_0x4c290c,_0x4d4f0c){return function(_0x3b0889){if(_0x3b0889){return _0x3b0889[_0xd714('0x23')]()[_0xd714('0x22')](function(){var _0xcf7d5d=_0x3b0889[_0xd714('0x24')]({'plain':!![]});var _0x5d4e44=_0xd714('0x25');return db['UserProfileResource'][_0xd714('0x23')]({'where':{'type':_0x5d4e44,'resourceId':_0xcf7d5d['id']}})[_0xd714('0x22')](function(){return _0x3b0889;});})[_0xd714('0x22')](function(){_0x4c290c[_0xd714('0x17')](0xcc)[_0xd714('0x18')]();});}};}function handleEntityNotFound(_0x425417,_0x10a9a5){return function(_0x28a849){if(!_0x28a849){_0x425417['sendStatus'](0x194);}return _0x28a849;};}function handleError(_0x458c9b,_0x4ca285){_0x4ca285=_0x4ca285||0x1f4;return function(_0x3aeba4){logger['error'](_0x3aeba4[_0xd714('0x26')]);if(_0x3aeba4[_0xd714('0x27')]){delete _0x3aeba4[_0xd714('0x27')];}_0x458c9b['status'](_0x4ca285)[_0xd714('0x28')](_0x3aeba4);};}exports[_0xd714('0x29')]=function(_0x1d2ce4,_0x36d2e7){var _0x117e69={},_0x44cafe={},_0x56d39f={'count':0x0,'rows':[]};var _0x51163c=_[_0xd714('0x2a')](db['Trigger'][_0xd714('0x2b')],function(_0x30e130){return{'name':_0x30e130[_0xd714('0x2c')],'type':_0x30e130[_0xd714('0x2d')][_0xd714('0x2e')]};});_0x44cafe[_0xd714('0x2f')]=_[_0xd714('0x2a')](_0x51163c,_0xd714('0x27'));_0x44cafe[_0xd714('0x30')]=_[_0xd714('0x31')](_0x1d2ce4[_0xd714('0x30')]);_0x44cafe[_0xd714('0x32')]=_[_0xd714('0x33')](_0x44cafe['model'],_0x44cafe[_0xd714('0x30')]);_0x117e69[_0xd714('0x34')]=_['intersection'](_0x44cafe[_0xd714('0x2f')],qs[_0xd714('0x35')](_0x1d2ce4['query'][_0xd714('0x35')]));_0x117e69[_0xd714('0x34')]=_0x117e69[_0xd714('0x34')][_0xd714('0x36')]?_0x117e69[_0xd714('0x34')]:_0x44cafe[_0xd714('0x2f')];if(!_0x1d2ce4[_0xd714('0x30')][_0xd714('0x37')](_0xd714('0x38'))){_0x117e69[_0xd714('0x1c')]=qs['limit'](_0x1d2ce4[_0xd714('0x30')][_0xd714('0x1c')]);_0x117e69[_0xd714('0x1a')]=qs[_0xd714('0x1a')](_0x1d2ce4['query'][_0xd714('0x1a')]);}_0x117e69[_0xd714('0x39')]=qs[_0xd714('0x3a')](_0x1d2ce4[_0xd714('0x30')][_0xd714('0x3a')]);_0x117e69['where']=qs[_0xd714('0x32')](_[_0xd714('0x3b')](_0x1d2ce4[_0xd714('0x30')],_0x44cafe[_0xd714('0x32')]),_0x51163c);if(_0x1d2ce4[_0xd714('0x30')][_0xd714('0x3c')]){_0x117e69[_0xd714('0x3d')]=_[_0xd714('0x3e')](_0x117e69[_0xd714('0x3d')],{'$or':_[_0xd714('0x2a')](_0x51163c,function(_0x38e516){if(_0x38e516[_0xd714('0x2d')]!==_0xd714('0x3f')){var _0x4a28dd={};_0x4a28dd[_0x38e516['name']]={'$like':'%'+_0x1d2ce4[_0xd714('0x30')][_0xd714('0x3c')]+'%'};return _0x4a28dd;}})});}_0x117e69=_[_0xd714('0x3e')]({},_0x117e69,_0x1d2ce4['options']);var _0x1fccc4={'where':_0x117e69[_0xd714('0x3d')]};return db[_0xd714('0x40')][_0xd714('0x1d')](_0x1fccc4)[_0xd714('0x22')](function(_0x1d3c94){_0x56d39f['count']=_0x1d3c94;if(_0x1d2ce4[_0xd714('0x30')][_0xd714('0x41')]){_0x117e69[_0xd714('0x42')]=[{'all':!![]}];}return db[_0xd714('0x40')][_0xd714('0x43')](_0x117e69);})[_0xd714('0x22')](function(_0x5ccbeb){_0x56d39f['rows']=_0x5ccbeb;return _0x56d39f;})[_0xd714('0x22')](respondWithFilteredResult(_0x36d2e7,_0x117e69))[_0xd714('0x44')](handleError(_0x36d2e7,null));};exports[_0xd714('0x45')]=function(_0xd6df08,_0x1e7811){var _0x466034={'raw':![],'where':{'id':_0xd6df08['params']['id']}},_0x133f3b={};_0x133f3b['model']=_[_0xd714('0x31')](db['Trigger'][_0xd714('0x2b')]);_0x133f3b['query']=_[_0xd714('0x31')](_0xd6df08[_0xd714('0x30')]);_0x133f3b[_0xd714('0x32')]=_['intersection'](_0x133f3b[_0xd714('0x2f')],_0x133f3b[_0xd714('0x30')]);_0x466034[_0xd714('0x34')]=_[_0xd714('0x33')](_0x133f3b[_0xd714('0x2f')],qs[_0xd714('0x35')](_0xd6df08['query'][_0xd714('0x35')]));_0x466034['attributes']=_0x466034[_0xd714('0x34')]['length']?_0x466034[_0xd714('0x34')]:_0x133f3b['model'];if(_0xd6df08[_0xd714('0x30')][_0xd714('0x41')]){_0x466034[_0xd714('0x42')]=[{'all':!![]}];}_0x466034=_[_0xd714('0x3e')]({},_0x466034,_0xd6df08[_0xd714('0x46')]);return db[_0xd714('0x40')]['find'](_0x466034)[_0xd714('0x22')](handleEntityNotFound(_0x1e7811,null))[_0xd714('0x22')](respondWithResult(_0x1e7811,null))[_0xd714('0x44')](handleError(_0x1e7811,null));};exports[_0xd714('0x47')]=function(_0x4d062b,_0x3fbaa8){return db['Trigger'][_0xd714('0x47')](_0x4d062b[_0xd714('0x48')],{})[_0xd714('0x22')](function(_0x173c48){var _0xdc0f74=_0x4d062b[_0xd714('0x49')][_0xd714('0x24')]({'plain':!![]});if(!_0xdc0f74)throw new Error(_0xd714('0x4a'));if(_0xdc0f74['role']==='user'){var _0x1e4219=_0x173c48[_0xd714('0x24')]({'plain':!![]});var _0x374606=_0xd714('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x374606,'userProfileId':_0xdc0f74[_0xd714('0x4b')]},'raw':!![]})[_0xd714('0x22')](function(_0x56843d){if(_0x56843d&&_0x56843d[_0xd714('0x4c')]===0x0){return db[_0xd714('0x4d')][_0xd714('0x47')]({'name':_0x1e4219['name'],'resourceId':_0x1e4219['id'],'type':_0x56843d[_0xd714('0x27')],'sectionId':_0x56843d['id']},{})[_0xd714('0x22')](function(){return _0x173c48;});}else{return _0x173c48;}})[_0xd714('0x44')](function(_0x48d7c2){logger[_0xd714('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48d7c2);throw _0x48d7c2;});}return _0x173c48;})[_0xd714('0x22')](respondWithResult(_0x3fbaa8,0xc9))[_0xd714('0x44')](handleError(_0x3fbaa8,null));};exports[_0xd714('0x21')]=function(_0x5c353e,_0x4311df){if(_0x5c353e[_0xd714('0x48')]['id']){delete _0x5c353e[_0xd714('0x48')]['id'];}return db[_0xd714('0x40')][_0xd714('0x4f')]({'where':{'id':_0x5c353e['params']['id']}})[_0xd714('0x22')](handleEntityNotFound(_0x4311df,null))[_0xd714('0x22')](saveUpdates(_0x5c353e[_0xd714('0x48')],null))[_0xd714('0x22')](respondWithResult(_0x4311df,null))['catch'](handleError(_0x4311df,null));};exports[_0xd714('0x23')]=function(_0x1bc7db,_0x6800b6){return db['Trigger'][_0xd714('0x4f')]({'where':{'id':_0x1bc7db[_0xd714('0x50')]['id']}})[_0xd714('0x22')](handleEntityNotFound(_0x6800b6,null))[_0xd714('0x22')](removeEntity(_0x6800b6,null))[_0xd714('0x44')](handleError(_0x6800b6,null));};exports[_0xd714('0x51')]=function(_0x3d28ec,_0x286975,_0x488722){if(_0x3d28ec[_0xd714('0x48')]['id']){delete _0x3d28ec[_0xd714('0x48')]['id'];}return db[_0xd714('0x40')][_0xd714('0x4f')]({'where':{'id':_0x3d28ec['params']['id']}})[_0xd714('0x22')](handleEntityNotFound(_0x286975,null))[_0xd714('0x22')](function(_0x4b9021){if(_0x4b9021){_0x3d28ec[_0xd714('0x48')][_0xd714('0x52')]=_0x4b9021['id'];return db['Condition'][_0xd714('0x47')](_0x3d28ec[_0xd714('0x48')]);}})[_0xd714('0x22')](respondWithResult(_0x286975,null))['catch'](handleError(_0x286975,null));};exports[_0xd714('0x53')]=function(_0x3ff45c,_0xb46f55,_0x36e65c){if(_0x3ff45c['body']['id']){delete _0x3ff45c[_0xd714('0x48')]['id'];}return db[_0xd714('0x40')][_0xd714('0x4f')]({'where':{'id':_0x3ff45c[_0xd714('0x50')]['id']}})[_0xd714('0x22')](handleEntityNotFound(_0xb46f55,null))[_0xd714('0x22')](function(_0x1a630c){if(_0x1a630c){_0x3ff45c[_0xd714('0x48')][_0xd714('0x54')]=_0x1a630c['id'];return db[_0xd714('0x55')][_0xd714('0x47')](_0x3ff45c['body']);}})[_0xd714('0x22')](respondWithResult(_0xb46f55,null))[_0xd714('0x44')](handleError(_0xb46f55,null));};exports[_0xd714('0x56')]=function(_0x4232df,_0x3f8ca7,_0x2817de){var _0x5f358f={};var _0x36d1c7={};var _0x9c42c9;var _0x4773f0;return db[_0xd714('0x40')]['findOne']({'where':{'id':_0x4232df[_0xd714('0x50')]['id']}})[_0xd714('0x22')](handleEntityNotFound(_0x3f8ca7,null))['then'](function(_0x498857){if(_0x498857){_0x9c42c9=_0x498857;_0x36d1c7[_0xd714('0x2f')]=_[_0xd714('0x31')](db['Condition'][_0xd714('0x2b')]);_0x36d1c7[_0xd714('0x30')]=_['keys'](_0x4232df['query']);_0x36d1c7[_0xd714('0x32')]=_[_0xd714('0x33')](_0x36d1c7[_0xd714('0x2f')],_0x36d1c7[_0xd714('0x30')]);_0x5f358f['attributes']=_[_0xd714('0x33')](_0x36d1c7[_0xd714('0x2f')],qs[_0xd714('0x35')](_0x4232df['query'][_0xd714('0x35')]));_0x5f358f[_0xd714('0x34')]=_0x5f358f['attributes'][_0xd714('0x36')]?_0x5f358f[_0xd714('0x34')]:_0x36d1c7[_0xd714('0x2f')];_0x5f358f[_0xd714('0x39')]=qs['sort'](_0x4232df['query'][_0xd714('0x3a')]);_0x5f358f[_0xd714('0x3d')]=qs[_0xd714('0x32')](_[_0xd714('0x3b')](_0x4232df[_0xd714('0x30')],_0x36d1c7['filters']));if(_0x4232df[_0xd714('0x30')]['filter']){_0x5f358f[_0xd714('0x3d')]=_[_0xd714('0x3e')](_0x5f358f[_0xd714('0x3d')],{'$or':_[_0xd714('0x2a')](_0x5f358f['attributes'],function(_0xb964f6){var _0x3ff64d={};_0x3ff64d[_0xb964f6]={'$like':'%'+_0x4232df[_0xd714('0x30')][_0xd714('0x3c')]+'%'};return _0x3ff64d;})});}_0x5f358f=_['merge']({},_0x5f358f,_0x4232df[_0xd714('0x46')]);return _0x9c42c9[_0xd714('0x56')](_0x5f358f);}})[_0xd714('0x22')](function(_0x5dacb9){if(_0x5dacb9){_0x4773f0=_0x5dacb9['length'];if(!_0x4232df[_0xd714('0x30')]['hasOwnProperty']('nolimit')){_0x5f358f[_0xd714('0x1c')]=qs['limit'](_0x4232df[_0xd714('0x30')][_0xd714('0x1c')]);_0x5f358f[_0xd714('0x1a')]=qs['offset'](_0x4232df[_0xd714('0x30')]['offset']);}return _0x9c42c9[_0xd714('0x56')](_0x5f358f);}})['then'](function(_0x5d81cd){if(_0x5d81cd){return _0x5d81cd?{'count':_0x4773f0,'rows':_0x5d81cd}:null;}})[_0xd714('0x22')](respondWithResult(_0x3f8ca7,null))[_0xd714('0x44')](handleError(_0x3f8ca7,null));};exports[_0xd714('0x57')]=function(_0x8f598e,_0x4dddfd,_0x52e3a5){var _0x209fe6={};var _0x46c135={};var _0x14b413;var _0x23a668;return db[_0xd714('0x40')]['findOne']({'where':{'id':_0x8f598e[_0xd714('0x50')]['id']}})[_0xd714('0x22')](handleEntityNotFound(_0x4dddfd,null))[_0xd714('0x22')](function(_0xb666b5){if(_0xb666b5){_0x14b413=_0xb666b5;_0x46c135[_0xd714('0x2f')]=_[_0xd714('0x31')](db['Condition'][_0xd714('0x2b')]);_0x46c135[_0xd714('0x30')]=_['keys'](_0x8f598e['query']);_0x46c135['filters']=_[_0xd714('0x33')](_0x46c135[_0xd714('0x2f')],_0x46c135['query']);_0x209fe6['attributes']=_[_0xd714('0x33')](_0x46c135[_0xd714('0x2f')],qs['fields'](_0x8f598e[_0xd714('0x30')]['fields']));_0x209fe6[_0xd714('0x34')]=_0x209fe6[_0xd714('0x34')][_0xd714('0x36')]?_0x209fe6[_0xd714('0x34')]:_0x46c135[_0xd714('0x2f')];_0x209fe6[_0xd714('0x39')]=qs[_0xd714('0x3a')](_0x8f598e[_0xd714('0x30')][_0xd714('0x3a')]);_0x209fe6['where']=qs[_0xd714('0x32')](_[_0xd714('0x3b')](_0x8f598e[_0xd714('0x30')],_0x46c135[_0xd714('0x32')]));if(_0x8f598e['query'][_0xd714('0x3c')]){_0x209fe6[_0xd714('0x3d')]=_[_0xd714('0x3e')](_0x209fe6[_0xd714('0x3d')],{'$or':_[_0xd714('0x2a')](_0x209fe6[_0xd714('0x34')],function(_0x1a1e2b){var _0x5572a6={};_0x5572a6[_0x1a1e2b]={'$like':'%'+_0x8f598e['query'][_0xd714('0x3c')]+'%'};return _0x5572a6;})});}_0x209fe6=_[_0xd714('0x3e')]({},_0x209fe6,_0x8f598e[_0xd714('0x46')]);return _0x14b413['getAnyConditions'](_0x209fe6);}})[_0xd714('0x22')](function(_0x305157){if(_0x305157){_0x23a668=_0x305157[_0xd714('0x36')];if(!_0x8f598e[_0xd714('0x30')]['hasOwnProperty']('nolimit')){_0x209fe6[_0xd714('0x1c')]=qs[_0xd714('0x1c')](_0x8f598e['query'][_0xd714('0x1c')]);_0x209fe6['offset']=qs['offset'](_0x8f598e[_0xd714('0x30')]['offset']);}return _0x14b413['getAnyConditions'](_0x209fe6);}})[_0xd714('0x22')](function(_0x37c602){if(_0x37c602){return _0x37c602?{'count':_0x23a668,'rows':_0x37c602}:null;}})[_0xd714('0x22')](respondWithResult(_0x4dddfd,null))[_0xd714('0x44')](handleError(_0x4dddfd,null));};exports[_0xd714('0x58')]=function(_0x9a638,_0x452615,_0x58bb37){if(_0x9a638[_0xd714('0x48')]['id']){delete _0x9a638['body']['id'];}return db[_0xd714('0x40')][_0xd714('0x4f')]({'where':{'id':_0x9a638['params']['id']}})[_0xd714('0x22')](handleEntityNotFound(_0x452615,null))[_0xd714('0x22')](function(_0x1decdd){if(_0x1decdd){_0x9a638['body'][_0xd714('0x59')]=_0x1decdd['id'];return db['Action'][_0xd714('0x47')](_0x9a638[_0xd714('0x48')]);}})[_0xd714('0x22')](respondWithResult(_0x452615,null))[_0xd714('0x44')](handleError(_0x452615,null));};exports[_0xd714('0x5a')]=function(_0x50249f,_0x3e407b,_0x22a84d){var _0x5b58f7={};var _0x359128={};var _0x4e63a5;var _0x50510a;return db[_0xd714('0x40')][_0xd714('0x5b')]({'where':{'id':_0x50249f[_0xd714('0x50')]['id']}})[_0xd714('0x22')](handleEntityNotFound(_0x3e407b,null))[_0xd714('0x22')](function(_0x43f548){if(_0x43f548){_0x4e63a5=_0x43f548;_0x359128['model']=_[_0xd714('0x31')](db[_0xd714('0x5c')][_0xd714('0x2b')]);_0x359128[_0xd714('0x30')]=_[_0xd714('0x31')](_0x50249f['query']);_0x359128[_0xd714('0x32')]=_[_0xd714('0x33')](_0x359128[_0xd714('0x2f')],_0x359128[_0xd714('0x30')]);_0x5b58f7[_0xd714('0x34')]=_[_0xd714('0x33')](_0x359128[_0xd714('0x2f')],qs['fields'](_0x50249f[_0xd714('0x30')]['fields']));_0x5b58f7[_0xd714('0x34')]=_0x5b58f7[_0xd714('0x34')][_0xd714('0x36')]?_0x5b58f7[_0xd714('0x34')]:_0x359128[_0xd714('0x2f')];_0x5b58f7[_0xd714('0x39')]=qs[_0xd714('0x3a')](_0x50249f['query'][_0xd714('0x3a')]);_0x5b58f7['where']=qs['filters'](_[_0xd714('0x3b')](_0x50249f['query'],_0x359128[_0xd714('0x32')]));if(_0x50249f['query'][_0xd714('0x3c')]){_0x5b58f7['where']=_[_0xd714('0x3e')](_0x5b58f7[_0xd714('0x3d')],{'$or':_[_0xd714('0x2a')](_0x5b58f7[_0xd714('0x34')],function(_0x145d71){var _0x2dd0eb={};_0x2dd0eb[_0x145d71]={'$like':'%'+_0x50249f['query'][_0xd714('0x3c')]+'%'};return _0x2dd0eb;})});}_0x5b58f7=_['merge']({},_0x5b58f7,_0x50249f[_0xd714('0x46')]);return _0x4e63a5['getActions'](_0x5b58f7);}})[_0xd714('0x22')](function(_0x582e2f){if(_0x582e2f){_0x50510a=_0x582e2f['length'];if(!_0x50249f['query'][_0xd714('0x37')](_0xd714('0x38'))){_0x5b58f7[_0xd714('0x1c')]=qs[_0xd714('0x1c')](_0x50249f['query'][_0xd714('0x1c')]);_0x5b58f7[_0xd714('0x1a')]=qs['offset'](_0x50249f[_0xd714('0x30')]['offset']);}return _0x4e63a5[_0xd714('0x5a')](_0x5b58f7);}})[_0xd714('0x22')](function(_0x443ae3){if(_0x443ae3){return _0x443ae3?{'count':_0x50510a,'rows':_0x443ae3}:null;}})[_0xd714('0x22')](respondWithResult(_0x3e407b,null))[_0xd714('0x44')](handleError(_0x3e407b,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 7fd6790..8302765 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 _0xb7a8=['request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','util','../../config/logger','moment','bluebird'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb7a8,0xec));var _0x8b7a=function(_0x9b5a46,_0xf5f09b){_0x9b5a46=_0x9b5a46-0x0;var _0x1024a6=_0xb7a8[_0x9b5a46];return _0x1024a6;};'use strict';var _=require('lodash');var util=require(_0x8b7a('0x0'));var logger=require(_0x8b7a('0x1'))('api');var moment=require(_0x8b7a('0x2'));var BPromise=require(_0x8b7a('0x3'));var rp=require(_0x8b7a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b7a('0x5'));var config=require(_0x8b7a('0x6'));var attributes=require(_0x8b7a('0x7'));module[_0x8b7a('0x8')]=function(_0x1d61f3,_0x42e4c1){return _0x1d61f3[_0x8b7a('0x9')](_0x8b7a('0xa'),attributes,{'tableName':_0x8b7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbb8=['../../config/environment','./trigger.attributes','exports','define','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x402d86,_0x570d2a){var _0x592d51=function(_0x161dc8){while(--_0x161dc8){_0x402d86['push'](_0x402d86['shift']());}};_0x592d51(++_0x570d2a);}(_0xbbb8,0x7d));var _0x8bbb=function(_0x51b6d6,_0x397c74){_0x51b6d6=_0x51b6d6-0x0;var _0xfcdd8e=_0xbbb8[_0x51b6d6];return _0xfcdd8e;};'use strict';var _=require(_0x8bbb('0x0'));var util=require(_0x8bbb('0x1'));var logger=require('../../config/logger')(_0x8bbb('0x2'));var moment=require(_0x8bbb('0x3'));var BPromise=require('bluebird');var rp=require(_0x8bbb('0x4'));var fs=require('fs');var path=require(_0x8bbb('0x5'));var rimraf=require(_0x8bbb('0x6'));var config=require(_0x8bbb('0x7'));var attributes=require(_0x8bbb('0x8'));module[_0x8bbb('0x9')]=function(_0x2608b6,_0x3424eb){return _0x2608b6[_0x8bbb('0xa')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index b2b422e..9abf067 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 _0xd35e=['model','attributes','ShowTrigger','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map'];(function(_0x3f9394,_0x36a6c9){var _0x5a9a2d=function(_0x418ae6){while(--_0x418ae6){_0x3f9394['push'](_0x3f9394['shift']());}};_0x5a9a2d(++_0x36a6c9);}(_0xd35e,0x19c));var _0xed35=function(_0x51160c,_0x374b59){_0x51160c=_0x51160c-0x0;var _0x15a3fb=_0xd35e[_0x51160c];return _0x15a3fb;};'use strict';var _=require(_0xed35('0x0'));var util=require(_0xed35('0x1'));var moment=require(_0xed35('0x2'));var BPromise=require(_0xed35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed35('0x4'))['db'];var utils=require(_0xed35('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xed35('0x6'));var client=jayson[_0xed35('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43bb59,_0x9c775,_0x4943f8){return new BPromise(function(_0x270f55,_0x3327d8){return client[_0xed35('0x8')](_0x43bb59,_0x4943f8)[_0xed35('0x9')](function(_0x419d80){logger[_0xed35('0xa')](_0xed35('0xb'),_0x9c775,_0xed35('0xc'));logger[_0xed35('0xd')](_0xed35('0xe'),_0x9c775,_0xed35('0xc'),JSON[_0xed35('0xf')](_0x419d80));if(_0x419d80[_0xed35('0x10')]){if(_0x419d80[_0xed35('0x10')][_0xed35('0x11')]===0x1f4){logger['error'](_0xed35('0xb'),_0x9c775,_0x419d80[_0xed35('0x10')][_0xed35('0x12')]);return _0x3327d8(_0x419d80['error'][_0xed35('0x12')]);}logger[_0xed35('0x10')]('Trigger,\x20%s,\x20%s',_0x9c775,_0x419d80['error'][_0xed35('0x12')]);return _0x270f55(_0x419d80[_0xed35('0x10')][_0xed35('0x12')]);}else{logger['info'](_0xed35('0xb'),_0x9c775,_0xed35('0xc'));_0x270f55(_0x419d80[_0xed35('0x13')]['message']);}})[_0xed35('0x14')](function(_0x1072df){logger[_0xed35('0x10')]('Trigger,\x20%s,\x20%s',_0x9c775,_0x1072df);_0x3327d8(_0x1072df);});});}exports[_0xed35('0x15')]=function(_0x4db730){var _0xd6bfd9=this;return new Promise(function(_0x3b33a2,_0x1ad41d){return db[_0xed35('0x16')][_0xed35('0x17')]({'raw':_0x4db730[_0xed35('0x18')]?_0x4db730['options'][_0xed35('0x19')]===undefined?!![]:![]:!![],'where':_0x4db730[_0xed35('0x18')]?_0x4db730[_0xed35('0x18')][_0xed35('0x1a')]||null:null,'attributes':_0x4db730[_0xed35('0x18')]?_0x4db730[_0xed35('0x18')]['attributes']||null:null,'limit':_0x4db730[_0xed35('0x18')]?_0x4db730[_0xed35('0x18')][_0xed35('0x1b')]||null:null,'include':_0x4db730['options']?_0x4db730[_0xed35('0x18')][_0xed35('0x1c')]?_[_0xed35('0x1d')](_0x4db730['options'][_0xed35('0x1c')],function(_0x352216){return{'model':db[_0x352216[_0xed35('0x1e')]],'as':_0x352216['as'],'attributes':_0x352216[_0xed35('0x1f')],'include':_0x352216[_0xed35('0x1c')]?_[_0xed35('0x1d')](_0x352216['include'],function(_0x25b3ee){return{'model':db[_0x25b3ee['model']],'as':_0x25b3ee['as'],'attributes':_0x25b3ee['attributes'],'include':_0x25b3ee['include']?_[_0xed35('0x1d')](_0x25b3ee[_0xed35('0x1c')],function(_0x3fa115){return{'model':db[_0x3fa115[_0xed35('0x1e')]],'as':_0x3fa115['as'],'attributes':_0x3fa115['attributes']};}):[]};}):[]};}):[]:[]})[_0xed35('0x9')](function(_0x34d8e4){logger[_0xed35('0xa')](_0xed35('0x15'),_0x4db730);logger['debug'](_0xed35('0x15'),_0x4db730,JSON[_0xed35('0xf')](_0x34d8e4));_0x3b33a2(_0x34d8e4);})[_0xed35('0x14')](function(_0x5de53e){logger[_0xed35('0x10')]('GetTrigger',_0x5de53e[_0xed35('0x12')],_0x4db730);_0x1ad41d(_0xd6bfd9[_0xed35('0x10')](0x1f4,_0x5de53e['message']));});});};exports[_0xed35('0x20')]=function(_0x3f8888){var _0xe37ccf=this;return new Promise(function(_0x56b7e5,_0x1703ae){return db[_0xed35('0x16')][_0xed35('0x21')]({'raw':_0x3f8888['options']?_0x3f8888[_0xed35('0x18')][_0xed35('0x19')]===undefined?!![]:![]:!![],'where':_0x3f8888[_0xed35('0x18')]?_0x3f8888[_0xed35('0x18')]['where']||null:null,'attributes':_0x3f8888[_0xed35('0x18')]?_0x3f8888['options']['attributes']||null:null,'include':_0x3f8888['options']?_0x3f8888[_0xed35('0x18')][_0xed35('0x1c')]?_[_0xed35('0x1d')](_0x3f8888[_0xed35('0x18')]['include'],function(_0x368661){return{'model':db[_0x368661[_0xed35('0x1e')]],'as':_0x368661['as'],'attributes':_0x368661[_0xed35('0x1f')],'include':_0x368661[_0xed35('0x1c')]?_['map'](_0x368661[_0xed35('0x1c')],function(_0x254d19){return{'model':db[_0x254d19[_0xed35('0x1e')]],'as':_0x254d19['as'],'attributes':_0x254d19[_0xed35('0x1f')],'include':_0x254d19[_0xed35('0x1c')]?_[_0xed35('0x1d')](_0x254d19[_0xed35('0x1c')],function(_0x1dec75){return{'model':db[_0x1dec75[_0xed35('0x1e')]],'as':_0x1dec75['as'],'attributes':_0x1dec75[_0xed35('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xed35('0x9')](function(_0x1af12f){logger[_0xed35('0xa')](_0xed35('0x20'),_0x3f8888);logger['debug'](_0xed35('0x20'),_0x3f8888,JSON['stringify'](_0x1af12f));_0x56b7e5(_0x1af12f);})['catch'](function(_0x154d85){logger[_0xed35('0x10')](_0xed35('0x20'),_0x154d85[_0xed35('0x12')],_0x3f8888);_0x1703ae(_0xe37ccf[_0xed35('0x10')](0x1f4,_0x154d85[_0xed35('0x12')]));});});}; \ No newline at end of file +var _0x7b78=['stringify','code','error','message','info','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x47fd20,_0x4bd229){var _0x142736=function(_0x3af2aa){while(--_0x3af2aa){_0x47fd20['push'](_0x47fd20['shift']());}};_0x142736(++_0x4bd229);}(_0x7b78,0x1e8));var _0x87b7=function(_0x24d266,_0x647d64){_0x24d266=_0x24d266-0x0;var _0x5e4214=_0x7b78[_0x24d266];return _0x5e4214;};'use strict';var _=require(_0x87b7('0x0'));var util=require(_0x87b7('0x1'));var moment=require(_0x87b7('0x2'));var BPromise=require(_0x87b7('0x3'));var rs=require(_0x87b7('0x4'));var fs=require('fs');var Redis=require(_0x87b7('0x5'));var db=require(_0x87b7('0x6'))['db'];var utils=require(_0x87b7('0x7'));var logger=require(_0x87b7('0x8'))(_0x87b7('0x9'));var config=require(_0x87b7('0xa'));var jayson=require(_0x87b7('0xb'));var client=jayson[_0x87b7('0xc')][_0x87b7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x551dbd,_0x19b55c,_0x5a5e4a){return new BPromise(function(_0x31c614,_0x1f20fa){return client[_0x87b7('0xe')](_0x551dbd,_0x5a5e4a)[_0x87b7('0xf')](function(_0x36a27f){logger['info'](_0x87b7('0x10'),_0x19b55c,_0x87b7('0x11'));logger['debug'](_0x87b7('0x12'),_0x19b55c,_0x87b7('0x11'),JSON[_0x87b7('0x13')](_0x36a27f));if(_0x36a27f['error']){if(_0x36a27f['error'][_0x87b7('0x14')]===0x1f4){logger[_0x87b7('0x15')](_0x87b7('0x10'),_0x19b55c,_0x36a27f[_0x87b7('0x15')][_0x87b7('0x16')]);return _0x1f20fa(_0x36a27f[_0x87b7('0x15')][_0x87b7('0x16')]);}logger[_0x87b7('0x15')](_0x87b7('0x10'),_0x19b55c,_0x36a27f['error'][_0x87b7('0x16')]);return _0x31c614(_0x36a27f['error'][_0x87b7('0x16')]);}else{logger[_0x87b7('0x17')](_0x87b7('0x10'),_0x19b55c,'request\x20sent');_0x31c614(_0x36a27f['result'][_0x87b7('0x16')]);}})[_0x87b7('0x18')](function(_0x242154){logger['error'](_0x87b7('0x10'),_0x19b55c,_0x242154);_0x1f20fa(_0x242154);});});}exports[_0x87b7('0x19')]=function(_0x5a747c){var _0x5d6209=this;return new Promise(function(_0x339d68,_0xb66cdd){return db[_0x87b7('0x1a')][_0x87b7('0x1b')]({'raw':_0x5a747c['options']?_0x5a747c[_0x87b7('0x1c')][_0x87b7('0x1d')]===undefined?!![]:![]:!![],'where':_0x5a747c[_0x87b7('0x1c')]?_0x5a747c[_0x87b7('0x1c')][_0x87b7('0x1e')]||null:null,'attributes':_0x5a747c['options']?_0x5a747c[_0x87b7('0x1c')][_0x87b7('0x1f')]||null:null,'limit':_0x5a747c['options']?_0x5a747c[_0x87b7('0x1c')][_0x87b7('0x20')]||null:null,'include':_0x5a747c[_0x87b7('0x1c')]?_0x5a747c[_0x87b7('0x1c')][_0x87b7('0x21')]?_[_0x87b7('0x22')](_0x5a747c[_0x87b7('0x1c')][_0x87b7('0x21')],function(_0x27059b){return{'model':db[_0x27059b[_0x87b7('0x23')]],'as':_0x27059b['as'],'attributes':_0x27059b[_0x87b7('0x1f')],'include':_0x27059b['include']?_[_0x87b7('0x22')](_0x27059b[_0x87b7('0x21')],function(_0x3db450){return{'model':db[_0x3db450['model']],'as':_0x3db450['as'],'attributes':_0x3db450['attributes'],'include':_0x3db450[_0x87b7('0x21')]?_[_0x87b7('0x22')](_0x3db450[_0x87b7('0x21')],function(_0x39c26b){return{'model':db[_0x39c26b['model']],'as':_0x39c26b['as'],'attributes':_0x39c26b[_0x87b7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x87b7('0xf')](function(_0x3714a1){logger[_0x87b7('0x17')](_0x87b7('0x19'),_0x5a747c);logger[_0x87b7('0x24')](_0x87b7('0x19'),_0x5a747c,JSON['stringify'](_0x3714a1));_0x339d68(_0x3714a1);})['catch'](function(_0x3a4ded){logger[_0x87b7('0x15')](_0x87b7('0x19'),_0x3a4ded[_0x87b7('0x16')],_0x5a747c);_0xb66cdd(_0x5d6209[_0x87b7('0x15')](0x1f4,_0x3a4ded[_0x87b7('0x16')]));});});};exports['ShowTrigger']=function(_0x1b8e5e){var _0x553bdf=this;return new Promise(function(_0x4ee4cc,_0x2b0e84){return db['Trigger'][_0x87b7('0x25')]({'raw':_0x1b8e5e[_0x87b7('0x1c')]?_0x1b8e5e[_0x87b7('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1b8e5e[_0x87b7('0x1c')]?_0x1b8e5e[_0x87b7('0x1c')][_0x87b7('0x1e')]||null:null,'attributes':_0x1b8e5e['options']?_0x1b8e5e['options'][_0x87b7('0x1f')]||null:null,'include':_0x1b8e5e[_0x87b7('0x1c')]?_0x1b8e5e[_0x87b7('0x1c')][_0x87b7('0x21')]?_[_0x87b7('0x22')](_0x1b8e5e[_0x87b7('0x1c')][_0x87b7('0x21')],function(_0x18b979){return{'model':db[_0x18b979[_0x87b7('0x23')]],'as':_0x18b979['as'],'attributes':_0x18b979['attributes'],'include':_0x18b979[_0x87b7('0x21')]?_[_0x87b7('0x22')](_0x18b979[_0x87b7('0x21')],function(_0x33fe81){return{'model':db[_0x33fe81[_0x87b7('0x23')]],'as':_0x33fe81['as'],'attributes':_0x33fe81[_0x87b7('0x1f')],'include':_0x33fe81['include']?_[_0x87b7('0x22')](_0x33fe81[_0x87b7('0x21')],function(_0xac0b67){return{'model':db[_0xac0b67[_0x87b7('0x23')]],'as':_0xac0b67['as'],'attributes':_0xac0b67[_0x87b7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x87b7('0xf')](function(_0x505ae4){logger[_0x87b7('0x17')]('ShowTrigger',_0x1b8e5e);logger[_0x87b7('0x24')](_0x87b7('0x26'),_0x1b8e5e,JSON['stringify'](_0x505ae4));_0x4ee4cc(_0x505ae4);})['catch'](function(_0x3b31a4){logger[_0x87b7('0x15')](_0x87b7('0x26'),_0x3b31a4[_0x87b7('0x16')],_0x1b8e5e);_0x2b0e84(_0x553bdf[_0x87b7('0x15')](0x1f4,_0x3b31a4['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c57f144..dcc8b06 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 _0xa83f=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports'];(function(_0x2d6ab8,_0x1b6b82){var _0x339c56=function(_0xe1741d){while(--_0xe1741d){_0x2d6ab8['push'](_0x2d6ab8['shift']());}};_0x339c56(++_0x1b6b82);}(_0xa83f,0xdc));var _0xfa83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa83f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfa83('0x0'));var util=require(_0xfa83('0x1'));var path=require(_0xfa83('0x2'));var timeout=require(_0xfa83('0x3'));var express=require('express');var router=express[_0xfa83('0x4')]();var fs_extra=require(_0xfa83('0x5'));var auth=require(_0xfa83('0x6'));var interaction=require(_0xfa83('0x7'));var config=require(_0xfa83('0x8'));var controller=require(_0xfa83('0x9'));router['get']('/',auth[_0xfa83('0xa')](),controller['index']);router[_0xfa83('0xb')](_0xfa83('0xc'),auth[_0xfa83('0xa')](),controller[_0xfa83('0xd')]);router[_0xfa83('0xe')]('/:id/clone',auth[_0xfa83('0xa')](),controller['clone']);router[_0xfa83('0xe')]('/',auth[_0xfa83('0xa')](),controller[_0xfa83('0xf')]);router[_0xfa83('0x10')](_0xfa83('0xc'),auth[_0xfa83('0xa')](),controller[_0xfa83('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfa83('0x12')]);module[_0xfa83('0x13')]=router; \ No newline at end of file +var _0x62f0=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','/:id/clone','post','put','delete','destroy'];(function(_0x3cf053,_0x7a9947){var _0x3b55a0=function(_0x2a99cc){while(--_0x2a99cc){_0x3cf053['push'](_0x3cf053['shift']());}};_0x3b55a0(++_0x7a9947);}(_0x62f0,0x65));var _0x062f=function(_0x8f4554,_0x97e1f8){_0x8f4554=_0x8f4554-0x0;var _0x2b7465=_0x62f0[_0x8f4554];return _0x2b7465;};'use strict';var multer=require(_0x062f('0x0'));var util=require(_0x062f('0x1'));var path=require('path');var timeout=require(_0x062f('0x2'));var express=require(_0x062f('0x3'));var router=express[_0x062f('0x4')]();var fs_extra=require(_0x062f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x062f('0x6'));var config=require(_0x062f('0x7'));var controller=require(_0x062f('0x8'));router[_0x062f('0x9')]('/',auth['isAuthenticated'](),controller[_0x062f('0xa')]);router['get'](_0x062f('0xb'),auth[_0x062f('0xc')](),controller[_0x062f('0xd')]);router['post'](_0x062f('0xe'),auth['isAuthenticated'](),controller['clone']);router[_0x062f('0xf')]('/',auth[_0x062f('0xc')](),controller['create']);router[_0x062f('0x10')](_0x062f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x062f('0x11')]('/:id',auth[_0x062f('0xc')](),controller[_0x062f('0x12')]);module[_0x062f('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 561af23..3f7a029 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 _0x6c32=['accept','refuse','originate','uac','fingerprint','certificate','actpass','dynamic','BOOLEAN','sequelize','exports','STRING','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0x6c32,0x6d));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x26c3('0x0'));module[_0x26c3('0x1')]={'name':{'type':Sequelize[_0x26c3('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x26c3('0x3'),'peer'),'allowNull':![],'defaultValue':_0x26c3('0x4')},'context':{'type':Sequelize[_0x26c3('0x2')],'allowNull':![],'defaultValue':_0x26c3('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x26c3('0x6'),_0x26c3('0x7'),_0x26c3('0x8'),_0x26c3('0x9'),_0x26c3('0xa'),'PROHIB_PASSED_SCREEN',_0x26c3('0xb'),_0x26c3('0xc'))},'deny':{'type':Sequelize[_0x26c3('0x2')]},'permit':{'type':Sequelize[_0x26c3('0x2')]},'secret':{'type':Sequelize[_0x26c3('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x26c3('0x2')]},'transport':{'type':Sequelize[_0x26c3('0x2')],'defaultValue':_0x26c3('0xd'),'set':function(_0x1c1bf9){this[_0x26c3('0xe')]('transport',_0x1c1bf9?_0x1c1bf9[_0x26c3('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x26c3('0x10'))?this[_0x26c3('0x11')](_0x26c3('0x10'))[_0x26c3('0x12')](','):null;},'comment':_0x26c3('0x13')},'dtmfmode':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x15'),_0x26c3('0x16'),'shortinfo',_0x26c3('0x17'),_0x26c3('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no',_0x26c3('0x1a'),_0x26c3('0x1b'),_0x26c3('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x26c3('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x26c3('0x2')]},'directmediadeny':{'type':Sequelize[_0x26c3('0x2')]},'nat':{'type':Sequelize[_0x26c3('0x2')],'defaultValue':_0x26c3('0x1d'),'set':function(_0x4bb917){this[_0x26c3('0xe')]('nat',_0x4bb917?_0x4bb917[_0x26c3('0xf')](','):null);},'get':function(){return this[_0x26c3('0x11')]('nat')?this[_0x26c3('0x11')](_0x26c3('0x1e'))[_0x26c3('0x12')](','):null;},'comment':_0x26c3('0x1f')},'callgroup':{'type':Sequelize[_0x26c3('0x2')]},'namedcallgroup':{'type':Sequelize[_0x26c3('0x2')]},'pickupgroup':{'type':Sequelize[_0x26c3('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x26c3('0x2')]},'language':{'type':Sequelize[_0x26c3('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x26c3('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x26c3('0x2')],'allowNull':![],'defaultValue':_0x26c3('0x20'),'set':function(_0x44ffb5){this[_0x26c3('0xe')](_0x26c3('0x21'),_0x44ffb5?_0x44ffb5[_0x26c3('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x26c3('0x11')](_0x26c3('0x21'))?this[_0x26c3('0x11')](_0x26c3('0x21'))[_0x26c3('0x12')](';'):null;},'comment':_0x26c3('0x22')},'autoframing':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no')},'insecure':{'type':Sequelize[_0x26c3('0x2')],'defaultValue':_0x26c3('0x23'),'set':function(_0xa0962b){this['setDataValue'](_0x26c3('0x24'),_0xa0962b?_0xa0962b[_0x26c3('0xf')](','):null);},'get':function(){return this[_0x26c3('0x11')](_0x26c3('0x24'))?this[_0x26c3('0x11')](_0x26c3('0x24'))[_0x26c3('0x12')](','):null;},'comment':_0x26c3('0x25')},'trustrpid':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no',_0x26c3('0x26'))},'promiscredir':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no')},'accountcode':{'type':Sequelize[_0x26c3('0x27')](0xb)},'setvar':{'type':Sequelize[_0x26c3('0x2')]},'callerid':{'type':Sequelize[_0x26c3('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x26c3('0x2')]},'callcounter':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x26c3('0x2')]},'template':{'type':Sequelize[_0x26c3('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x26c3('0x19'),'no',_0x26c3('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x26c3('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no')},'mailbox':{'type':Sequelize[_0x26c3('0x2')]},'session_timers':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x29'),_0x26c3('0x2a'),_0x26c3('0x2b'))},'session_expires':{'type':Sequelize[_0x26c3('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x26c3('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x2c'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x26c3('0x2')]},'regexten':{'type':Sequelize[_0x26c3('0x2')]},'fromdomain':{'type':Sequelize[_0x26c3('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x26c3('0x27')](0x5)},'qualify':{'type':Sequelize[_0x26c3('0x14')]('yes','no'),'defaultValue':_0x26c3('0x19')},'keepalive':{'type':Sequelize[_0x26c3('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x26c3('0x2')]},'rtptimeout':{'type':Sequelize[_0x26c3('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x26c3('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x26c3('0x27')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x26c3('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x26c3('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x26c3('0x27')](0xb)},'timerb':{'type':Sequelize[_0x26c3('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x26c3('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x26c3('0x2')]},'contactdeny':{'type':Sequelize[_0x26c3('0x2')]},'contactacl':{'type':Sequelize[_0x26c3('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x26c3('0x2')]},'use_q850_reason':{'type':Sequelize[_0x26c3('0x2')]},'maxforwards':{'type':Sequelize[_0x26c3('0x27')](0xb)},'encryption':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x26c3('0x14')]('yes','no')},'force_avp':{'type':Sequelize[_0x26c3('0x14')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x26c3('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no',_0x26c3('0x2d'),_0x26c3('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x26c3('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x26c3('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x26c3('0x2')]},'dtlscipher':{'type':Sequelize[_0x26c3('0x2')]},'dtlscafile':{'type':Sequelize[_0x26c3('0x2')]},'dtlscapath':{'type':Sequelize[_0x26c3('0x2')]},'dtlssetup':{'type':Sequelize[_0x26c3('0x14')]('active','passive',_0x26c3('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x26c3('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x26c3('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x26c3('0x14')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x26c3('0x14')]('yes','no')},'vmexten':{'type':Sequelize[_0x26c3('0x2')]},'mohinterpret':{'type':Sequelize[_0x26c3('0x2')]},'mohsuggest':{'type':Sequelize[_0x26c3('0x2')]},'parkinglot':{'type':Sequelize[_0x26c3('0x2')]},'description':{'type':Sequelize[_0x26c3('0x2')]},'host':{'type':Sequelize[_0x26c3('0x2')],'defaultValue':_0x26c3('0x30')},'canreinvite':{'type':Sequelize[_0x26c3('0x14')](_0x26c3('0x19'),'no',_0x26c3('0x1a'),_0x26c3('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x26c3('0x2')]},'otherFields':{'type':Sequelize[_0x26c3('0x2')]},'active':{'type':Sequelize[_0x26c3('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xfc8f=['fingerprint','active','passive','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','uac','uas','pai'];(function(_0x24b0c8,_0x2b3a62){var _0x861bbd=function(_0x216873){while(--_0x216873){_0x24b0c8['push'](_0x24b0c8['shift']());}};_0x861bbd(++_0x2b3a62);}(_0xfc8f,0x1e4));var _0xffc8=function(_0x4aa4bd,_0x598f65){_0x4aa4bd=_0x4aa4bd-0x0;var _0x5720d7=_0xfc8f[_0x4aa4bd];return _0x5720d7;};'use strict';var Sequelize=require(_0xffc8('0x0'));module[_0xffc8('0x1')]={'name':{'type':Sequelize[_0xffc8('0x2')],'allowNull':![],'unique':_0xffc8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x5'),_0xffc8('0x6'),_0xffc8('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xffc8('0x8')},'callingpres':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x9'),_0xffc8('0xa'),'ALLOWED_FAILED_SCREEN',_0xffc8('0xb'),_0xffc8('0xc'),_0xffc8('0xd'),_0xffc8('0xe'),_0xffc8('0xf'))},'deny':{'type':Sequelize[_0xffc8('0x2')]},'permit':{'type':Sequelize[_0xffc8('0x2')]},'secret':{'type':Sequelize[_0xffc8('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xffc8('0x2')]},'transport':{'type':Sequelize[_0xffc8('0x2')],'defaultValue':'udp','set':function(_0x13052f){this[_0xffc8('0x10')](_0xffc8('0x11'),_0x13052f?_0x13052f[_0xffc8('0x12')](','):null);},'get':function(){return this[_0xffc8('0x13')]('transport')?this[_0xffc8('0x13')](_0xffc8('0x11'))[_0xffc8('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x15'),_0xffc8('0x16'),_0xffc8('0x17'),_0xffc8('0x18'),_0xffc8('0x19')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no',_0xffc8('0x1b'),'update',_0xffc8('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xffc8('0x2')]},'directmediadeny':{'type':Sequelize[_0xffc8('0x2')]},'nat':{'type':Sequelize[_0xffc8('0x2')],'defaultValue':_0xffc8('0x1d'),'set':function(_0x189a29){this[_0xffc8('0x10')](_0xffc8('0x1e'),_0x189a29?_0x189a29[_0xffc8('0x12')](','):null);},'get':function(){return this[_0xffc8('0x13')](_0xffc8('0x1e'))?this[_0xffc8('0x13')](_0xffc8('0x1e'))[_0xffc8('0x14')](','):null;},'comment':_0xffc8('0x1f')},'callgroup':{'type':Sequelize[_0xffc8('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xffc8('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xffc8('0x2')]},'language':{'type':Sequelize[_0xffc8('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xffc8('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xffc8('0x2')],'defaultValue':_0xffc8('0x20')},'allow':{'type':Sequelize[_0xffc8('0x2')],'allowNull':![],'defaultValue':_0xffc8('0x21'),'set':function(_0x18f6f2){this[_0xffc8('0x10')](_0xffc8('0x22'),_0x18f6f2?_0x18f6f2[_0xffc8('0x12')](';'):_0xffc8('0x21'));},'get':function(){return this[_0xffc8('0x13')](_0xffc8('0x22'))?this[_0xffc8('0x13')](_0xffc8('0x22'))['split'](';'):null;},'comment':_0xffc8('0x23')},'autoframing':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x509fc8){this[_0xffc8('0x10')](_0xffc8('0x24'),_0x509fc8?_0x509fc8[_0xffc8('0x12')](','):null);},'get':function(){return this[_0xffc8('0x13')](_0xffc8('0x24'))?this[_0xffc8('0x13')]('insecure')[_0xffc8('0x14')](','):null;},'comment':_0xffc8('0x25')},'trustrpid':{'type':Sequelize['ENUM'](_0xffc8('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xffc8('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no',_0xffc8('0x26'))},'promiscredir':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xffc8('0x27')](0xb)},'setvar':{'type':Sequelize[_0xffc8('0x2')]},'callerid':{'type':Sequelize[_0xffc8('0x2')],'defaultValue':_0xffc8('0x28')},'amaflags':{'type':Sequelize[_0xffc8('0x2')]},'callcounter':{'type':Sequelize[_0xffc8('0x4')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xffc8('0x27')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xffc8('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0xffc8('0x2')]},'template':{'type':Sequelize[_0xffc8('0x2')]},'videosupport':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xffc8('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xffc8('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xffc8('0x2')]},'session_timers':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x29'),_0xffc8('0x2a'),'originate')},'session_expires':{'type':Sequelize[_0xffc8('0x27')](0xb)},'session_minse':{'type':Sequelize[_0xffc8('0x27')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xffc8('0x2b'),_0xffc8('0x2c')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xffc8('0x2')]},'regexten':{'type':Sequelize[_0xffc8('0x2')]},'fromdomain':{'type':Sequelize[_0xffc8('0x2')]},'fromuser':{'type':Sequelize[_0xffc8('0x2')]},'port':{'type':Sequelize[_0xffc8('0x27')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xffc8('0x1a'),'no'),'defaultValue':_0xffc8('0x1a')},'keepalive':{'type':Sequelize[_0xffc8('0x27')](0xb)},'defaultip':{'type':Sequelize[_0xffc8('0x2')]},'defaultuser':{'type':Sequelize[_0xffc8('0x2')]},'rtptimeout':{'type':Sequelize[_0xffc8('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xffc8('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xffc8('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no',_0xffc8('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xffc8('0x2')]},'timert1':{'type':Sequelize[_0xffc8('0x27')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xffc8('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0xffc8('0x2')]},'contactdeny':{'type':Sequelize[_0xffc8('0x2')]},'contactacl':{'type':Sequelize[_0xffc8('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xffc8('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xffc8('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xffc8('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no')},'icesupport':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no',_0xffc8('0x2e'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xffc8('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0xffc8('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xffc8('0x2')]},'dtlscipher':{'type':Sequelize[_0xffc8('0x2')]},'dtlscafile':{'type':Sequelize[_0xffc8('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0xffc8('0x2f'),_0xffc8('0x30'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xffc8('0x2')]},'usereqphone':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xffc8('0x2')]},'recordofffeature':{'type':Sequelize[_0xffc8('0x2')]},'call_limit':{'type':Sequelize[_0xffc8('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xffc8('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0xffc8('0x2')]},'mohinterpret':{'type':Sequelize[_0xffc8('0x2')]},'mohsuggest':{'type':Sequelize[_0xffc8('0x2')]},'parkinglot':{'type':Sequelize[_0xffc8('0x2')]},'description':{'type':Sequelize[_0xffc8('0x2')]},'host':{'type':Sequelize[_0xffc8('0x2')],'defaultValue':_0xffc8('0x31')},'canreinvite':{'type':Sequelize[_0xffc8('0x4')](_0xffc8('0x1a'),'no','nonat',_0xffc8('0x32'),_0xffc8('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xffc8('0x2')]},'otherFields':{'type':Sequelize[_0xffc8('0x2')]},'active':{'type':Sequelize[_0xffc8('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xffc8('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index e693c7c..9ea18d7 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 _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','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','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0xa4ddd,_0x15abe3){var _0x3a4ff0=function(_0x5cb0aa){while(--_0x5cb0aa){_0xa4ddd['push'](_0xa4ddd['shift']());}};_0x3a4ff0(++_0x15abe3);}(_0x55ca,0x126));var _0xa55c=function(_0x25402e,_0x1ab8f2){_0x25402e=_0x25402e-0x0;var _0x168dbb=_0x55ca[_0x25402e];return _0x168dbb;};'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'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file +var _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0x313ab1,_0x872b6e){var _0x5f3cfd=function(_0x4fb847){while(--_0x4fb847){_0x313ab1['push'](_0x313ab1['shift']());}};_0x5f3cfd(++_0x872b6e);}(_0x9a19,0x114));var _0x99a1=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9a19[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index e1b18f3..a238f1c 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 _0xc89f=['./trunk.attributes','exports','define','Trunk','lodash','util','moment','path','rimraf','../../config/environment'];(function(_0x3592cb,_0xdd7720){var _0x43091a=function(_0x24a8f5){while(--_0x24a8f5){_0x3592cb['push'](_0x3592cb['shift']());}};_0x43091a(++_0xdd7720);}(_0xc89f,0x90));var _0xfc89=function(_0x4a4603,_0x1e9e15){_0x4a4603=_0x4a4603-0x0;var _0x47ed45=_0xc89f[_0x4a4603];return _0x47ed45;};'use strict';var _=require(_0xfc89('0x0'));var util=require(_0xfc89('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfc89('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc89('0x3'));var rimraf=require(_0xfc89('0x4'));var config=require(_0xfc89('0x5'));var attributes=require(_0xfc89('0x6'));module[_0xfc89('0x7')]=function(_0x461657,_0x311cff){return _0x461657[_0xfc89('0x8')](_0xfc89('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9e2=['request-promise','rimraf','../../config/environment','./trunk.attributes','define','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x3bac2b,_0x137306){var _0xbadf45=function(_0xddb85a){while(--_0xddb85a){_0x3bac2b['push'](_0x3bac2b['shift']());}};_0xbadf45(++_0x137306);}(_0xd9e2,0x1c8));var _0x2d9e=function(_0x411e55,_0x500863){_0x411e55=_0x411e55-0x0;var _0x374330=_0xd9e2[_0x411e55];return _0x374330;};'use strict';var _=require(_0x2d9e('0x0'));var util=require(_0x2d9e('0x1'));var logger=require(_0x2d9e('0x2'))(_0x2d9e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d9e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d9e('0x5'));var config=require(_0x2d9e('0x6'));var attributes=require(_0x2d9e('0x7'));module['exports']=function(_0x312e53,_0x4f518b){return _0x312e53[_0x2d9e('0x8')]('Trunk',attributes,{'tableName':_0x2d9e('0x9'),'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 7352728..1406ec0 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 _0xcbbf=['code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','options','raw','attributes','limit','include','map','model','find','then','ShowTrunk','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','stringify','error'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0xcbbf,0x19e));var _0xfcbb=function(_0x2ef619,_0x261db){_0x2ef619=_0x2ef619-0x0;var _0x5f3e05=_0xcbbf[_0x2ef619];return _0x5f3e05;};'use strict';var _=require(_0xfcbb('0x0'));var util=require('util');var moment=require(_0xfcbb('0x1'));var BPromise=require(_0xfcbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcbb('0x3'));var db=require(_0xfcbb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcbb('0x5'))(_0xfcbb('0x6'));var config=require(_0xfcbb('0x7'));var jayson=require(_0xfcbb('0x8'));var client=jayson[_0xfcbb('0x9')][_0xfcbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eb70e,_0x698a2b,_0x5c3538){return new BPromise(function(_0x3e4fce,_0x59852e){return client['request'](_0x5eb70e,_0x5c3538)['then'](function(_0x11592f){logger['info']('Trunk,\x20%s,\x20%s',_0x698a2b,_0xfcbb('0xb'));logger[_0xfcbb('0xc')]('Trunk,\x20%s,\x20%s,\x20%s',_0x698a2b,_0xfcbb('0xb'),JSON[_0xfcbb('0xd')](_0x11592f));if(_0x11592f['error']){if(_0x11592f[_0xfcbb('0xe')][_0xfcbb('0xf')]===0x1f4){logger['error'](_0xfcbb('0x10'),_0x698a2b,_0x11592f['error'][_0xfcbb('0x11')]);return _0x59852e(_0x11592f[_0xfcbb('0xe')][_0xfcbb('0x11')]);}logger[_0xfcbb('0xe')](_0xfcbb('0x10'),_0x698a2b,_0x11592f[_0xfcbb('0xe')][_0xfcbb('0x11')]);return _0x3e4fce(_0x11592f[_0xfcbb('0xe')][_0xfcbb('0x11')]);}else{logger[_0xfcbb('0x12')]('Trunk,\x20%s,\x20%s',_0x698a2b,_0xfcbb('0xb'));_0x3e4fce(_0x11592f[_0xfcbb('0x13')]['message']);}})[_0xfcbb('0x14')](function(_0x16ff81){logger[_0xfcbb('0xe')]('Trunk,\x20%s,\x20%s',_0x698a2b,_0x16ff81);_0x59852e(_0x16ff81);});});}exports[_0xfcbb('0x15')]=function(_0x1dd7dc){var _0x58e095=this;return new Promise(function(_0x3ddb38,_0x5bdc6d){return db[_0xfcbb('0x16')]['findAll']({'raw':_0x1dd7dc[_0xfcbb('0x17')]?_0x1dd7dc[_0xfcbb('0x17')][_0xfcbb('0x18')]===undefined?!![]:![]:!![],'where':_0x1dd7dc['options']?_0x1dd7dc[_0xfcbb('0x17')]['where']||null:null,'attributes':_0x1dd7dc['options']?_0x1dd7dc[_0xfcbb('0x17')][_0xfcbb('0x19')]||null:null,'limit':_0x1dd7dc['options']?_0x1dd7dc[_0xfcbb('0x17')][_0xfcbb('0x1a')]||null:null,'include':_0x1dd7dc[_0xfcbb('0x17')]?_0x1dd7dc[_0xfcbb('0x17')][_0xfcbb('0x1b')]?_[_0xfcbb('0x1c')](_0x1dd7dc[_0xfcbb('0x17')][_0xfcbb('0x1b')],function(_0x565e9c){return{'model':db[_0x565e9c[_0xfcbb('0x1d')]],'as':_0x565e9c['as'],'attributes':_0x565e9c[_0xfcbb('0x19')],'include':_0x565e9c['include']?_[_0xfcbb('0x1c')](_0x565e9c[_0xfcbb('0x1b')],function(_0x230eaa){return{'model':db[_0x230eaa['model']],'as':_0x230eaa['as'],'attributes':_0x230eaa[_0xfcbb('0x19')],'include':_0x230eaa[_0xfcbb('0x1b')]?_[_0xfcbb('0x1c')](_0x230eaa[_0xfcbb('0x1b')],function(_0x2acd81){return{'model':db[_0x2acd81[_0xfcbb('0x1d')]],'as':_0x2acd81['as'],'attributes':_0x2acd81[_0xfcbb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x265b1e){logger[_0xfcbb('0x12')]('GetTrunk',_0x1dd7dc);logger[_0xfcbb('0xc')](_0xfcbb('0x15'),_0x1dd7dc,JSON['stringify'](_0x265b1e));_0x3ddb38(_0x265b1e);})['catch'](function(_0x2b17d0){logger['error'](_0xfcbb('0x15'),_0x2b17d0[_0xfcbb('0x11')],_0x1dd7dc);_0x5bdc6d(_0x58e095['error'](0x1f4,_0x2b17d0[_0xfcbb('0x11')]));});});};exports['ShowTrunk']=function(_0x1de42d){var _0x25807d=this;return new Promise(function(_0x113e65,_0x2194cf){return db[_0xfcbb('0x16')][_0xfcbb('0x1e')]({'raw':_0x1de42d[_0xfcbb('0x17')]?_0x1de42d[_0xfcbb('0x17')][_0xfcbb('0x18')]===undefined?!![]:![]:!![],'where':_0x1de42d[_0xfcbb('0x17')]?_0x1de42d[_0xfcbb('0x17')]['where']||null:null,'attributes':_0x1de42d[_0xfcbb('0x17')]?_0x1de42d[_0xfcbb('0x17')][_0xfcbb('0x19')]||null:null,'include':_0x1de42d[_0xfcbb('0x17')]?_0x1de42d['options']['include']?_['map'](_0x1de42d[_0xfcbb('0x17')][_0xfcbb('0x1b')],function(_0x43adca){return{'model':db[_0x43adca['model']],'as':_0x43adca['as'],'attributes':_0x43adca[_0xfcbb('0x19')],'include':_0x43adca[_0xfcbb('0x1b')]?_[_0xfcbb('0x1c')](_0x43adca[_0xfcbb('0x1b')],function(_0x4dd750){return{'model':db[_0x4dd750[_0xfcbb('0x1d')]],'as':_0x4dd750['as'],'attributes':_0x4dd750[_0xfcbb('0x19')],'include':_0x4dd750[_0xfcbb('0x1b')]?_[_0xfcbb('0x1c')](_0x4dd750[_0xfcbb('0x1b')],function(_0x10261f){return{'model':db[_0x10261f['model']],'as':_0x10261f['as'],'attributes':_0x10261f[_0xfcbb('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfcbb('0x1f')](function(_0x3c7035){logger[_0xfcbb('0x12')](_0xfcbb('0x20'),_0x1de42d);logger[_0xfcbb('0xc')](_0xfcbb('0x20'),_0x1de42d,JSON[_0xfcbb('0xd')](_0x3c7035));_0x113e65(_0x3c7035);})[_0xfcbb('0x14')](function(_0x24b11c){logger[_0xfcbb('0xe')](_0xfcbb('0x20'),_0x24b11c[_0xfcbb('0x11')],_0x1de42d);_0x2194cf(_0x25807d['error'](0x1f4,_0x24b11c[_0xfcbb('0x11')]));});});}; \ No newline at end of file +var _0x6a0f=['map','include','model','debug','find','ShowTrunk','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x57a9dc,_0xb5f9e1){var _0x40faf4=function(_0x3cd245){while(--_0x3cd245){_0x57a9dc['push'](_0x57a9dc['shift']());}};_0x40faf4(++_0xb5f9e1);}(_0x6a0f,0xb0));var _0xf6a0=function(_0x24329b,_0x4fdb95){_0x24329b=_0x24329b-0x0;var _0x152fbf=_0x6a0f[_0x24329b];return _0x152fbf;};'use strict';var _=require(_0xf6a0('0x0'));var util=require('util');var moment=require(_0xf6a0('0x1'));var BPromise=require(_0xf6a0('0x2'));var rs=require(_0xf6a0('0x3'));var fs=require('fs');var Redis=require(_0xf6a0('0x4'));var db=require(_0xf6a0('0x5'))['db'];var utils=require(_0xf6a0('0x6'));var logger=require(_0xf6a0('0x7'))('rpc');var config=require(_0xf6a0('0x8'));var jayson=require(_0xf6a0('0x9'));var client=jayson['client'][_0xf6a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2521b7,_0x410453,_0x4b7f85){return new BPromise(function(_0x422665,_0x7bbc43){return client[_0xf6a0('0xb')](_0x2521b7,_0x4b7f85)[_0xf6a0('0xc')](function(_0x10e349){logger['info'](_0xf6a0('0xd'),_0x410453,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x410453,_0xf6a0('0xe'),JSON[_0xf6a0('0xf')](_0x10e349));if(_0x10e349[_0xf6a0('0x10')]){if(_0x10e349[_0xf6a0('0x10')][_0xf6a0('0x11')]===0x1f4){logger['error'](_0xf6a0('0xd'),_0x410453,_0x10e349[_0xf6a0('0x10')][_0xf6a0('0x12')]);return _0x7bbc43(_0x10e349[_0xf6a0('0x10')][_0xf6a0('0x12')]);}logger[_0xf6a0('0x10')](_0xf6a0('0xd'),_0x410453,_0x10e349[_0xf6a0('0x10')][_0xf6a0('0x12')]);return _0x422665(_0x10e349[_0xf6a0('0x10')][_0xf6a0('0x12')]);}else{logger['info'](_0xf6a0('0xd'),_0x410453,_0xf6a0('0xe'));_0x422665(_0x10e349[_0xf6a0('0x13')][_0xf6a0('0x12')]);}})[_0xf6a0('0x14')](function(_0xe90eee){logger[_0xf6a0('0x10')](_0xf6a0('0xd'),_0x410453,_0xe90eee);_0x7bbc43(_0xe90eee);});});}exports[_0xf6a0('0x15')]=function(_0x3984de){var _0x4e571d=this;return new Promise(function(_0xe442d,_0x16c443){return db[_0xf6a0('0x16')][_0xf6a0('0x17')]({'raw':_0x3984de['options']?_0x3984de[_0xf6a0('0x18')][_0xf6a0('0x19')]===undefined?!![]:![]:!![],'where':_0x3984de['options']?_0x3984de[_0xf6a0('0x18')][_0xf6a0('0x1a')]||null:null,'attributes':_0x3984de[_0xf6a0('0x18')]?_0x3984de[_0xf6a0('0x18')][_0xf6a0('0x1b')]||null:null,'limit':_0x3984de[_0xf6a0('0x18')]?_0x3984de['options']['limit']||null:null,'include':_0x3984de[_0xf6a0('0x18')]?_0x3984de[_0xf6a0('0x18')]['include']?_[_0xf6a0('0x1c')](_0x3984de[_0xf6a0('0x18')][_0xf6a0('0x1d')],function(_0x789397){return{'model':db[_0x789397['model']],'as':_0x789397['as'],'attributes':_0x789397[_0xf6a0('0x1b')],'include':_0x789397['include']?_['map'](_0x789397[_0xf6a0('0x1d')],function(_0x1921af){return{'model':db[_0x1921af[_0xf6a0('0x1e')]],'as':_0x1921af['as'],'attributes':_0x1921af[_0xf6a0('0x1b')],'include':_0x1921af['include']?_[_0xf6a0('0x1c')](_0x1921af[_0xf6a0('0x1d')],function(_0x3fa5fc){return{'model':db[_0x3fa5fc[_0xf6a0('0x1e')]],'as':_0x3fa5fc['as'],'attributes':_0x3fa5fc[_0xf6a0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x379084){logger['info'](_0xf6a0('0x15'),_0x3984de);logger[_0xf6a0('0x1f')](_0xf6a0('0x15'),_0x3984de,JSON[_0xf6a0('0xf')](_0x379084));_0xe442d(_0x379084);})[_0xf6a0('0x14')](function(_0x5375a3){logger[_0xf6a0('0x10')](_0xf6a0('0x15'),_0x5375a3[_0xf6a0('0x12')],_0x3984de);_0x16c443(_0x4e571d[_0xf6a0('0x10')](0x1f4,_0x5375a3['message']));});});};exports['ShowTrunk']=function(_0x5158df){var _0x4406ba=this;return new Promise(function(_0x1e282a,_0x32c806){return db[_0xf6a0('0x16')][_0xf6a0('0x20')]({'raw':_0x5158df[_0xf6a0('0x18')]?_0x5158df[_0xf6a0('0x18')][_0xf6a0('0x19')]===undefined?!![]:![]:!![],'where':_0x5158df[_0xf6a0('0x18')]?_0x5158df['options'][_0xf6a0('0x1a')]||null:null,'attributes':_0x5158df[_0xf6a0('0x18')]?_0x5158df[_0xf6a0('0x18')][_0xf6a0('0x1b')]||null:null,'include':_0x5158df[_0xf6a0('0x18')]?_0x5158df[_0xf6a0('0x18')]['include']?_[_0xf6a0('0x1c')](_0x5158df[_0xf6a0('0x18')][_0xf6a0('0x1d')],function(_0x20a753){return{'model':db[_0x20a753['model']],'as':_0x20a753['as'],'attributes':_0x20a753[_0xf6a0('0x1b')],'include':_0x20a753[_0xf6a0('0x1d')]?_[_0xf6a0('0x1c')](_0x20a753[_0xf6a0('0x1d')],function(_0x183843){return{'model':db[_0x183843['model']],'as':_0x183843['as'],'attributes':_0x183843['attributes'],'include':_0x183843[_0xf6a0('0x1d')]?_[_0xf6a0('0x1c')](_0x183843[_0xf6a0('0x1d')],function(_0x51a804){return{'model':db[_0x51a804[_0xf6a0('0x1e')]],'as':_0x51a804['as'],'attributes':_0x51a804[_0xf6a0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf6a0('0xc')](function(_0x2f4959){logger['info'](_0xf6a0('0x21'),_0x5158df);logger['debug'](_0xf6a0('0x21'),_0x5158df,JSON[_0xf6a0('0xf')](_0x2f4959));_0x1e282a(_0x2f4959);})[_0xf6a0('0x14')](function(_0x43fb40){logger[_0xf6a0('0x10')]('ShowTrunk',_0x43fb40['message'],_0x5158df);_0x32c806(_0x4406ba[_0xf6a0('0x10')](0x1f4,_0x43fb40['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index eed04be..37c424b 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 _0x2ce1=['../../components/auth/service','isAuthenticated','update','express','Router'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x2ce1,0x134));var _0x12ce=function(_0x2f2888,_0x5e1403){_0x2f2888=_0x2f2888-0x0;var _0x22e2cd=_0x2ce1[_0x2f2888];return _0x22e2cd;};'use strict';var express=require(_0x12ce('0x0'));var router=express[_0x12ce('0x1')]();var auth=require(_0x12ce('0x2'));var controller=require('./user-setting.controller');router['put']('/:id',auth[_0x12ce('0x3')](),controller[_0x12ce('0x4')]);module['exports']=router; \ No newline at end of file +var _0xec6f=['express','Router','../../components/auth/service','put','/:id','update','exports'];(function(_0x5a293a,_0x306cba){var _0x442c69=function(_0x18dbba){while(--_0x18dbba){_0x5a293a['push'](_0x5a293a['shift']());}};_0x442c69(++_0x306cba);}(_0xec6f,0x9a));var _0xfec6=function(_0x179d19,_0x3f63fc){_0x179d19=_0x179d19-0x0;var _0x1ca47f=_0xec6f[_0x179d19];return _0x1ca47f;};'use strict';var express=require(_0xfec6('0x0'));var router=express[_0xfec6('0x1')]();var auth=require(_0xfec6('0x2'));var controller=require('./user-setting.controller');router[_0xfec6('0x3')](_0xfec6('0x4'),auth['isAuthenticated'](),controller[_0xfec6('0x5')]);module[_0xfec6('0x6')]=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 70744c8..c7136a2 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 _0x6c64=['sequelize','warning','info','exports','error','BOOLEAN','INTEGER','UserId'];(function(_0x5b9860,_0x6decaf){var _0x7906d7=function(_0x3a814c){while(--_0x3a814c){_0x5b9860['push'](_0x5b9860['shift']());}};_0x7906d7(++_0x6decaf);}(_0x6c64,0xd8));var _0x46c6=function(_0xa46c87,_0xe9cf35){_0xa46c87=_0xa46c87-0x0;var _0x8def7f=_0x6c64[_0xa46c87];return _0x8def7f;};'use strict';var Sequelize=require(_0x46c6('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x46c6('0x1'),_0x46c6('0x2'),'debug'];module[_0x46c6('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x46c6('0x4'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x46c6('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x46c6('0x6')],'unique':_0x46c6('0x7')}}; \ No newline at end of file +var _0x18ec=['error','info','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x43433c,_0x5dd0b2){var _0x3c7a36=function(_0x462442){while(--_0x462442){_0x43433c['push'](_0x43433c['shift']());}};_0x3c7a36(++_0x5dd0b2);}(_0x18ec,0x15c));var _0xc18e=function(_0x1bd876,_0x12086e){_0x1bd876=_0x1bd876-0x0;var _0x3f341e=_0x18ec[_0x1bd876];return _0x3f341e;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xc18e('0x0'),'warning',_0xc18e('0x1'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xc18e('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xc18e('0x2')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xc18e('0x3')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xc18e('0x4')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xc18e('0x5')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 1362556..45a1eba 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 _0x8c99=['localhost','json','update','then','sendStatus','error','stack','name','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults'];(function(_0x9b14ee,_0x574340){var _0xc3fa3c=function(_0x44476d){while(--_0x44476d){_0x9b14ee['push'](_0x9b14ee['shift']());}};_0xc3fa3c(++_0x574340);}(_0x8c99,0x1a8));var _0x98c9=function(_0x1a8ff0,_0x20788d){_0x1a8ff0=_0x1a8ff0-0x0;var _0x3588bf=_0x8c99[_0x1a8ff0];return _0x3588bf;};'use strict';var _=require(_0x98c9('0x0'));var Redis=require(_0x98c9('0x1'));var logger=require(_0x98c9('0x2'))(_0x98c9('0x3'));var config=require(_0x98c9('0x4'));var db=require(_0x98c9('0x5'))['db'];var socket=require(_0x98c9('0x6'))(new Redis(config[_0x98c9('0x7')]));require(_0x98c9('0x8'))[_0x98c9('0x9')](socket);config[_0x98c9('0x7')]=_[_0x98c9('0xa')](config['redis'],{'host':_0x98c9('0xb'),'port':0x18eb});function respondWithResult(_0x2ed2b6,_0x538465){_0x538465=_0x538465||0xc8;return function(_0x4af8a6){if(_0x4af8a6){return _0x2ed2b6['status'](_0x538465)[_0x98c9('0xc')](_0x4af8a6);}};}function saveUpdates(_0x132061){return function(_0x29f80a){if(_0x29f80a){return _0x29f80a[_0x98c9('0xd')](_0x132061)[_0x98c9('0xe')](function(_0x598a27){return _0x598a27;});}return null;};}function handleEntityNotFound(_0x2e5914){return function(_0xa4762){if(!_0xa4762){_0x2e5914[_0x98c9('0xf')](0x194);}return _0xa4762;};}function handleError(_0x14a6e6,_0x3e748c){_0x3e748c=_0x3e748c||0x1f4;return function(_0x4b05ea){logger[_0x98c9('0x10')](_0x4b05ea[_0x98c9('0x11')]);if(_0x4b05ea[_0x98c9('0x12')]){delete _0x4b05ea[_0x98c9('0x12')];}_0x14a6e6['status'](_0x3e748c)[_0x98c9('0x13')](_0x4b05ea);};}exports[_0x98c9('0xd')]=function(_0xcc9162,_0x107d0c){if(_0xcc9162[_0x98c9('0x14')]['role']!==_0x98c9('0x15'))throw new Error(_0x98c9('0x16'));if(isNaN(Number(_0xcc9162[_0x98c9('0x17')]['id'])))throw new Error(_0x98c9('0x18'));return db[_0x98c9('0x19')][_0x98c9('0x1a')]({'where':{'id':_0xcc9162[_0x98c9('0x17')]['id']}})[_0x98c9('0xe')](handleEntityNotFound(_0x107d0c,null))[_0x98c9('0xe')](saveUpdates(_0xcc9162[_0x98c9('0x1b')],null))[_0x98c9('0xe')](respondWithResult(_0x107d0c,null))[_0x98c9('0x1c')](handleError(_0x107d0c,null));}; \ No newline at end of file +var _0xfc65=['socket.io-emitter','redis','./user-setting.socket','defaults','localhost','json','then','sendStatus','error','stack','name','status','send','update','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x439f1c,_0x56545e){var _0x1b14ad=function(_0x40044a){while(--_0x40044a){_0x439f1c['push'](_0x439f1c['shift']());}};_0x1b14ad(++_0x56545e);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x522b0c,_0x252398){_0x522b0c=_0x522b0c-0x0;var _0x4d5229=_0xfc65[_0x522b0c];return _0x4d5229;};'use strict';var _=require(_0x5fc6('0x0'));var Redis=require(_0x5fc6('0x1'));var logger=require(_0x5fc6('0x2'))(_0x5fc6('0x3'));var config=require(_0x5fc6('0x4'));var db=require(_0x5fc6('0x5'))['db'];var socket=require(_0x5fc6('0x6'))(new Redis(config[_0x5fc6('0x7')]));require(_0x5fc6('0x8'))['register'](socket);config['redis']=_[_0x5fc6('0x9')](config[_0x5fc6('0x7')],{'host':_0x5fc6('0xa'),'port':0x18eb});function respondWithResult(_0x26d89e,_0x1360cb){_0x1360cb=_0x1360cb||0xc8;return function(_0x5c93f7){if(_0x5c93f7){return _0x26d89e['status'](_0x1360cb)[_0x5fc6('0xb')](_0x5c93f7);}};}function saveUpdates(_0x10c7d4){return function(_0x416963){if(_0x416963){return _0x416963['update'](_0x10c7d4)[_0x5fc6('0xc')](function(_0x4e5f13){return _0x4e5f13;});}return null;};}function handleEntityNotFound(_0x49a9c8){return function(_0x6daec){if(!_0x6daec){_0x49a9c8[_0x5fc6('0xd')](0x194);}return _0x6daec;};}function handleError(_0x55e62d,_0x5b2256){_0x5b2256=_0x5b2256||0x1f4;return function(_0x3caadc){logger[_0x5fc6('0xe')](_0x3caadc[_0x5fc6('0xf')]);if(_0x3caadc['name']){delete _0x3caadc[_0x5fc6('0x10')];}_0x55e62d[_0x5fc6('0x11')](_0x5b2256)[_0x5fc6('0x12')](_0x3caadc);};}exports[_0x5fc6('0x13')]=function(_0x102e6e,_0x1befdf){if(_0x102e6e['user'][_0x5fc6('0x14')]!=='admin')throw new Error(_0x5fc6('0x15'));if(isNaN(Number(_0x102e6e[_0x5fc6('0x16')]['id'])))throw new Error(_0x5fc6('0x17'));return db[_0x5fc6('0x18')]['find']({'where':{'id':_0x102e6e[_0x5fc6('0x16')]['id']}})['then'](handleEntityNotFound(_0x1befdf,null))[_0x5fc6('0xc')](saveUpdates(_0x102e6e['body'],null))['then'](respondWithResult(_0x1befdf,null))[_0x5fc6('0x19')](handleError(_0x1befdf,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 aecc88b..e346052 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 _0x0f15=['update','remove','emit','hasOwnProperty','hook','exports','save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0f15,0xd1));var _0x50f1=function(_0x2d099b,_0x435a6f){_0x2d099b=_0x2d099b-0x0;var _0x415093=_0x0f15[_0x2d099b];return _0x415093;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50f1('0x0'),'afterUpdate':_0x50f1('0x1'),'afterDestroy':_0x50f1('0x2')};function emitEvent(_0x261920){return function(_0x4d1c49,_0x4e61ba,_0x1d9c9d){UserSettingEvents[_0x50f1('0x3')](_0x261920+':'+_0x4d1c49['id'],_0x4d1c49);UserSettingEvents[_0x50f1('0x3')](_0x261920,_0x4d1c49);_0x1d9c9d(null);};}for(var e in events){if(events[_0x50f1('0x4')](e)){var event=events[e];UserSetting[_0x50f1('0x5')](e,emitEvent(event));}}module[_0x50f1('0x6')]=UserSettingEvents; \ No newline at end of file +var _0xb8c9=['update','hasOwnProperty','hook','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x478fc6,_0x2d8046){var _0x29630a=function(_0x2c2999){while(--_0x2c2999){_0x478fc6['push'](_0x478fc6['shift']());}};_0x29630a(++_0x2d8046);}(_0xb8c9,0x10d));var _0x9b8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8c9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9b8c('0x0'));var UserSetting=require(_0x9b8c('0x1'))['db'][_0x9b8c('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x9b8c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9b8c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x6a6b42){return function(_0x542995,_0x175598,_0x254852){UserSettingEvents['emit'](_0x6a6b42+':'+_0x542995['id'],_0x542995);UserSettingEvents['emit'](_0x6a6b42,_0x542995);_0x254852(null);};}for(var e in events){if(events[_0x9b8c('0x5')](e)){var event=events[e];UserSetting[_0x9b8c('0x6')](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 c0b7ad2..d58dbf1 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 _0x9d9b=['clientSideLoggingEnabledSince','exports','UserSetting','clientSideLoggingEnabled'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0xea8fba,_0x571889){_0xea8fba=_0xea8fba-0x0;var _0x2d05e2=_0x9d9b[_0xea8fba];return _0x2d05e2;};'use strict';var attributes=require('./user-setting.attributes');module[_0xb9d9('0x0')]=function(_0x2c6a23){return _0x2c6a23['define'](_0xb9d9('0x1'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29ac5b){if(!_0x29ac5b[_0xb9d9('0x2')])_0x29ac5b[_0xb9d9('0x3')]=null;else if(_0x29ac5b['clientSideLoggingEnabledSince']===null)_0x29ac5b[_0xb9d9('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x7d5a=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings'];(function(_0x298b02,_0x502aeb){var _0x3cd1f0=function(_0x307a78){while(--_0x307a78){_0x298b02['push'](_0x298b02['shift']());}};_0x3cd1f0(++_0x502aeb);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x432971,_0x44dd95){_0x432971=_0x432971-0x0;var _0x259af3=_0x7d5a[_0x432971];return _0x259af3;};'use strict';var attributes=require(_0xa7d5('0x0'));module[_0xa7d5('0x1')]=function(_0x125acd){return _0x125acd[_0xa7d5('0x2')](_0xa7d5('0x3'),attributes,{'tableName':_0xa7d5('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10df7a){if(!_0x10df7a['clientSideLoggingEnabled'])_0x10df7a['clientSideLoggingEnabledSince']=null;else if(_0x10df7a[_0xa7d5('0x5')]===null)_0x10df7a[_0xa7d5('0x5')]=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 54376eb..a9911db 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 _0xcef9=['register','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0xcef9,0x142));var _0x9cef=function(_0x59d19f,_0x185a4e){_0x59d19f=_0x59d19f-0x0;var _0x1bf090=_0xcef9[_0x59d19f];return _0x1bf090;};'use strict';var UserSettingEvents=require(_0x9cef('0x0'));var events=[_0x9cef('0x1'),_0x9cef('0x2'),_0x9cef('0x3')];function createListener(_0x265ddc,_0x4c19bf){return function(_0x54ce61){_0x4c19bf[_0x9cef('0x4')](_0x265ddc,_0x54ce61);if(_0x265ddc===_0x9cef('0x5')){_0x4c19bf['emit'](_0x9cef('0x6')+_0x54ce61[_0x9cef('0x7')],_0x54ce61);}};}exports[_0x9cef('0x8')]=function(_0x36e1c9){for(var _0xd91b79=0x0,_0x2c3101=events['length'];_0xd91b79<_0x2c3101;_0xd91b79++){var _0x2f1b85=events[_0xd91b79];var _0x29a2d3=createListener(_0x9cef('0x9')+_0x2f1b85,_0x36e1c9);UserSettingEvents['on'](_0x2f1b85,_0x29a2d3);}}; \ No newline at end of file +var _0xa55d=['update','emit','user-setting:update','user-setting:update:user-','UserId','./user-setting.events','save'];(function(_0x32d537,_0x580e46){var _0x2ec857=function(_0x38ff38){while(--_0x38ff38){_0x32d537['push'](_0x32d537['shift']());}};_0x2ec857(++_0x580e46);}(_0xa55d,0x147));var _0xda55=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa55d[_0x14add3];return _0x4a174f;};'use strict';var UserSettingEvents=require(_0xda55('0x0'));var events=[_0xda55('0x1'),'remove',_0xda55('0x2')];function createListener(_0x434fa1,_0x530a3e){return function(_0x44a206){_0x530a3e[_0xda55('0x3')](_0x434fa1,_0x44a206);if(_0x434fa1===_0xda55('0x4')){_0x530a3e[_0xda55('0x3')](_0xda55('0x5')+_0x44a206[_0xda55('0x6')],_0x44a206);}};}exports['register']=function(_0x189803){for(var _0x58240d=0x0,_0x9e9ca9=events['length'];_0x58240d<_0x9e9ca9;_0x58240d++){var _0x4acf94=events[_0x58240d];var _0x363a8b=createListener('user-setting:'+_0x4acf94,_0x189803);UserSettingEvents['on'](_0x4acf94,_0x363a8b);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 57bcb87..fecb334 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 _0x7795=['getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','single','file','addAvatar','/:id/login','login','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','put','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7795,0x149));var _0x5779=function(_0x209f14,_0x42ae5c){_0x209f14=_0x209f14-0x0;var _0x9a662d=_0x7795[_0x209f14];return _0x9a662d;};'use strict';var multer=require(_0x5779('0x0'));var util=require('util');var path=require(_0x5779('0x1'));var timeout=require(_0x5779('0x2'));var express=require(_0x5779('0x3'));var router=express[_0x5779('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5779('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5779('0x6'));var controller=require(_0x5779('0x7'));router[_0x5779('0x8')]('/',auth[_0x5779('0x9')](),controller[_0x5779('0xa')]);router[_0x5779('0x8')](_0x5779('0xb'),auth[_0x5779('0x9')](),controller[_0x5779('0xc')]);router[_0x5779('0x8')](_0x5779('0xd'),auth['isAuthenticated'](),controller[_0x5779('0xe')]);router['get'](_0x5779('0xf'),auth['isAuthenticated'](),controller[_0x5779('0x10')]);router[_0x5779('0x8')](_0x5779('0x11'),auth[_0x5779('0x9')](),controller[_0x5779('0x12')]);router[_0x5779('0x8')](_0x5779('0x13'),controller[_0x5779('0x14')]);router[_0x5779('0x8')](_0x5779('0x15'),auth[_0x5779('0x9')](),controller['getOpenTabs']);router[_0x5779('0x8')](_0x5779('0x16'),auth['isAuthenticated'](),controller[_0x5779('0x17')]);router[_0x5779('0x8')](_0x5779('0x18'),auth[_0x5779('0x9')](),controller[_0x5779('0x19')]);router[_0x5779('0x8')](_0x5779('0x1a'),auth[_0x5779('0x9')](),controller[_0x5779('0x1b')]);router[_0x5779('0x8')]('/:id/groups',auth[_0x5779('0x9')](),controller[_0x5779('0x1c')]);router['get'](_0x5779('0x1d'),auth[_0x5779('0x9')](),controller[_0x5779('0x1e')]);router['get']('/:id/screen_recordings',auth[_0x5779('0x9')](),controller[_0x5779('0x1f')]);router[_0x5779('0x8')](_0x5779('0x20'),auth['isAuthenticated'](),controller[_0x5779('0x21')]);router['get']('/:id/openchannel/interactions',auth[_0x5779('0x9')](),controller[_0x5779('0x22')]);router[_0x5779('0x8')](_0x5779('0x23'),auth['isAuthenticated'](),controller[_0x5779('0x24')]);router['get'](_0x5779('0x25'),auth[_0x5779('0x9')](),controller['getSmsInteractions']);router['get'](_0x5779('0x26'),auth[_0x5779('0x9')](),controller[_0x5779('0x27')]);router[_0x5779('0x8')](_0x5779('0x28'),auth[_0x5779('0x9')](),controller['getWhatsappInteractions']);router['get'](_0x5779('0x29'),auth['isAuthenticated'](),controller[_0x5779('0x2a')]);router['get'](_0x5779('0x2b'),auth[_0x5779('0x9')](),controller[_0x5779('0x2c')]);router['get'](_0x5779('0x2d'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0x5779('0x2e'),auth[_0x5779('0x9')](),controller['getVoicePrefixes']);router[_0x5779('0x8')](_0x5779('0x2f'),auth['isAuthenticated'](),controller[_0x5779('0x30')]);router[_0x5779('0x8')]('/:id/mail_accounts',auth[_0x5779('0x9')](),controller[_0x5779('0x31')]);router['get'](_0x5779('0x32'),auth[_0x5779('0x9')](),controller['getOpenchannelAccounts']);router[_0x5779('0x8')](_0x5779('0x33'),auth[_0x5779('0x9')](),controller[_0x5779('0x34')]);router['get'](_0x5779('0x35'),auth[_0x5779('0x9')](),controller[_0x5779('0x36')]);router[_0x5779('0x8')]('/:id/whatsapp_accounts',auth[_0x5779('0x9')](),controller[_0x5779('0x37')]);router['get']('/:id/scheduled_calls',auth[_0x5779('0x9')](),controller[_0x5779('0x38')]);router[_0x5779('0x8')](_0x5779('0x39'),auth['isAuthenticated'](),controller[_0x5779('0x3a')]);router[_0x5779('0x3b')](_0x5779('0x16'),auth[_0x5779('0x9')](),controller[_0x5779('0x3c')]);router[_0x5779('0x3b')]('/',auth['isAuthenticated'](),controller[_0x5779('0x3d')]);router[_0x5779('0x3b')](_0x5779('0x3e'),auth[_0x5779('0x9')](),controller[_0x5779('0x3f')]);router[_0x5779('0x3b')]('/:id/queues',auth['isAuthenticated'](),controller[_0x5779('0x40')]);var upload=multer({'storage':multer[_0x5779('0x41')]({'destination':function(_0x384401,_0x53ad9c,_0x151b1f){_0x151b1f(null,path[_0x5779('0x42')](config[_0x5779('0x43')],_0x5779('0x44')));},'filename':function(_0x2ee1b2,_0x448a58,_0x486a56){_0x486a56(null,util['format'](_0x5779('0x45'),Date[_0x5779('0x46')](),_0x448a58['originalname']));}})});router[_0x5779('0x3b')](_0x5779('0x13'),upload[_0x5779('0x47')](_0x5779('0x48')),controller[_0x5779('0x49')]);router['post'](_0x5779('0x4a'),auth[_0x5779('0x9')](),controller[_0x5779('0x4b')]);router[_0x5779('0x3b')]('/:id/logout',auth[_0x5779('0x9')](),controller['logout']);router[_0x5779('0x3b')](_0x5779('0x4c'),auth[_0x5779('0x9')](),controller[_0x5779('0x4d')]);router[_0x5779('0x3b')](_0x5779('0x4e'),auth[_0x5779('0x9')](),controller['unpause']);router[_0x5779('0x3b')]('/:id/teams',auth[_0x5779('0x9')](),controller[_0x5779('0x4f')]);router['post'](_0x5779('0x50'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x5779('0x3b')](_0x5779('0x51'),auth[_0x5779('0x9')](),controller[_0x5779('0x52')]);router[_0x5779('0x3b')]('/:id/fax_interactions',auth[_0x5779('0x9')](),controller[_0x5779('0x53')]);router[_0x5779('0x3b')](_0x5779('0x54'),auth[_0x5779('0x9')](),controller[_0x5779('0x55')]);router['post'](_0x5779('0x56'),auth[_0x5779('0x9')](),controller['addOpenchannelInteractions']);router[_0x5779('0x3b')](_0x5779('0x57'),auth[_0x5779('0x9')](),controller[_0x5779('0x58')]);router[_0x5779('0x3b')](_0x5779('0x2f'),auth[_0x5779('0x9')](),controller['addFaxAccounts']);router[_0x5779('0x3b')](_0x5779('0x59'),auth[_0x5779('0x9')](),controller[_0x5779('0x5a')]);router[_0x5779('0x3b')]('/:id/openchannel_accounts',auth[_0x5779('0x9')](),controller[_0x5779('0x5b')]);router[_0x5779('0x3b')](_0x5779('0x33'),auth[_0x5779('0x9')](),controller[_0x5779('0x5c')]);router['post'](_0x5779('0x35'),auth[_0x5779('0x9')](),controller[_0x5779('0x5d')]);router['post'](_0x5779('0x5e'),auth[_0x5779('0x9')](),controller[_0x5779('0x5f')]);router[_0x5779('0x3b')](_0x5779('0x39'),auth[_0x5779('0x9')](),controller['createApiKey']);router[_0x5779('0x60')](_0x5779('0x11'),auth[_0x5779('0x9')](),controller['update']);router['put']('/:id/password',auth[_0x5779('0x9')](),controller[_0x5779('0x61')]);router[_0x5779('0x62')](_0x5779('0x18'),auth['isAuthenticated'](),controller[_0x5779('0x63')]);router[_0x5779('0x62')](_0x5779('0x29'),auth['isAuthenticated'](),controller[_0x5779('0x64')]);router['delete'](_0x5779('0x11'),auth[_0x5779('0x9')](),controller['destroy']);router[_0x5779('0x62')](_0x5779('0x50'),auth['isAuthenticated'](),controller[_0x5779('0x65')]);router['delete']('/:id/mail_interactions',auth[_0x5779('0x9')](),controller[_0x5779('0x66')]);router['delete']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x5779('0x67')]);router['delete'](_0x5779('0x54'),auth[_0x5779('0x9')](),controller[_0x5779('0x68')]);router[_0x5779('0x62')](_0x5779('0x56'),auth[_0x5779('0x9')](),controller[_0x5779('0x69')]);router['delete'](_0x5779('0x57'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x5779('0x62')](_0x5779('0x2f'),auth['isAuthenticated'](),controller[_0x5779('0x6a')]);router[_0x5779('0x62')](_0x5779('0x59'),auth['isAuthenticated'](),controller[_0x5779('0x6b')]);router[_0x5779('0x62')]('/:id/openchannel_accounts',auth[_0x5779('0x9')](),controller[_0x5779('0x6c')]);router[_0x5779('0x62')](_0x5779('0x33'),auth[_0x5779('0x9')](),controller[_0x5779('0x6d')]);router[_0x5779('0x62')](_0x5779('0x35'),auth[_0x5779('0x9')](),controller[_0x5779('0x6e')]);router[_0x5779('0x62')]('/:id/whatsapp_accounts',auth[_0x5779('0x9')](),controller['removeWhatsappAccounts']);router[_0x5779('0x62')]('/:id/api_key',auth[_0x5779('0x9')](),controller[_0x5779('0x6f')]);router[_0x5779('0x3b')](_0x5779('0x70'),auth['isAuthenticated'](),controller[_0x5779('0x71')]);module[_0x5779('0x72')]=router; \ No newline at end of file +var _0xccde=['/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','now','originalname','single','addAvatar','/:id/login','login','logout','/:id/pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','put','update','/:id/password','delete','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions'];(function(_0x23649a,_0x3de6fc){var _0x14b278=function(_0x5b1229){while(--_0x5b1229){_0x23649a['push'](_0x23649a['shift']());}};_0x14b278(++_0x3de6fc);}(_0xccde,0x1e1));var _0xeccd=function(_0x4ab99,_0x219ed2){_0x4ab99=_0x4ab99-0x0;var _0x29e39c=_0xccde[_0x4ab99];return _0x29e39c;};'use strict';var multer=require(_0xeccd('0x0'));var util=require('util');var path=require(_0xeccd('0x1'));var timeout=require('connect-timeout');var express=require(_0xeccd('0x2'));var router=express[_0xeccd('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xeccd('0x4'));var config=require(_0xeccd('0x5'));var controller=require(_0xeccd('0x6'));router[_0xeccd('0x7')]('/',auth[_0xeccd('0x8')](),controller['index']);router[_0xeccd('0x7')](_0xeccd('0x9'),auth[_0xeccd('0x8')](),controller[_0xeccd('0xa')]);router['get'](_0xeccd('0xb'),auth[_0xeccd('0x8')](),controller[_0xeccd('0xc')]);router[_0xeccd('0x7')]('/presence',auth['isAuthenticated'](),controller['getPresence']);router['get'](_0xeccd('0xd'),auth[_0xeccd('0x8')](),controller[_0xeccd('0xe')]);router[_0xeccd('0x7')](_0xeccd('0xf'),controller['getAvatar']);router[_0xeccd('0x7')](_0xeccd('0x10'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x11')]);router[_0xeccd('0x7')](_0xeccd('0x12'),auth['isAuthenticated'](),controller['getContacts']);router[_0xeccd('0x7')](_0xeccd('0x13'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x14')]);router['get'](_0xeccd('0x15'),auth[_0xeccd('0x8')](),controller['getVoiceQueuesRt']);router['get'](_0xeccd('0x16'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x17')]);router[_0xeccd('0x7')](_0xeccd('0x18'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x19')]);router[_0xeccd('0x7')]('/:id/screen_recordings',auth[_0xeccd('0x8')](),controller[_0xeccd('0x1a')]);router[_0xeccd('0x7')](_0xeccd('0x1b'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x1c')]);router['get']('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0xeccd('0x1d')]);router['get'](_0xeccd('0x1e'),auth[_0xeccd('0x8')](),controller['getMailInteractions']);router[_0xeccd('0x7')]('/:id/sms/interactions',auth[_0xeccd('0x8')](),controller[_0xeccd('0x1f')]);router[_0xeccd('0x7')](_0xeccd('0x20'),auth[_0xeccd('0x8')](),controller['getFaxInteractions']);router[_0xeccd('0x7')]('/:id/whatsapp/interactions',auth[_0xeccd('0x8')](),controller[_0xeccd('0x21')]);router[_0xeccd('0x7')](_0xeccd('0x22'),auth['isAuthenticated'](),controller[_0xeccd('0x23')]);router[_0xeccd('0x7')](_0xeccd('0x24'),auth[_0xeccd('0x8')](),controller['getLists']);router[_0xeccd('0x7')](_0xeccd('0x25'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x26')]);router[_0xeccd('0x7')](_0xeccd('0x27'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x28')]);router[_0xeccd('0x7')]('/:id/fax_accounts',auth[_0xeccd('0x8')](),controller['getFaxAccounts']);router[_0xeccd('0x7')](_0xeccd('0x29'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x2a')]);router[_0xeccd('0x7')](_0xeccd('0x2b'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x2c')]);router[_0xeccd('0x7')](_0xeccd('0x2d'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x2e')]);router[_0xeccd('0x7')](_0xeccd('0x2f'),auth['isAuthenticated'](),controller[_0xeccd('0x30')]);router[_0xeccd('0x7')]('/:id/whatsapp_accounts',auth[_0xeccd('0x8')](),controller[_0xeccd('0x31')]);router['get'](_0xeccd('0x32'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x33')]);router[_0xeccd('0x7')](_0xeccd('0x34'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x35')]);router[_0xeccd('0x36')](_0xeccd('0x12'),auth['isAuthenticated'](),controller['addContacts']);router[_0xeccd('0x36')]('/',auth[_0xeccd('0x8')](),controller[_0xeccd('0x37')]);router[_0xeccd('0x36')](_0xeccd('0x38'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x39')]);router[_0xeccd('0x36')](_0xeccd('0x13'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x3a')]);var upload=multer({'storage':multer[_0xeccd('0x3b')]({'destination':function(_0x578332,_0x2d83d8,_0x5360d8){_0x5360d8(null,path[_0xeccd('0x3c')](config[_0xeccd('0x3d')],_0xeccd('0x3e')));},'filename':function(_0x55f5c3,_0x1bfebb,_0xcbd51d){_0xcbd51d(null,util['format']('%s-%s',Date[_0xeccd('0x3f')](),_0x1bfebb[_0xeccd('0x40')]));}})});router[_0xeccd('0x36')]('/:id/avatar',upload[_0xeccd('0x41')]('file'),controller[_0xeccd('0x42')]);router['post'](_0xeccd('0x43'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x44')]);router[_0xeccd('0x36')]('/:id/logout',auth['isAuthenticated'](),controller[_0xeccd('0x45')]);router['post'](_0xeccd('0x46'),auth[_0xeccd('0x8')](),controller['pause']);router['post'](_0xeccd('0x47'),auth[_0xeccd('0x8')](),controller['unpause']);router[_0xeccd('0x36')](_0xeccd('0x22'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x48')]);router[_0xeccd('0x36')](_0xeccd('0x49'),auth['isAuthenticated'](),controller[_0xeccd('0x4a')]);router['post'](_0xeccd('0x4b'),auth[_0xeccd('0x8')](),controller['addMailInteractions']);router[_0xeccd('0x36')]('/:id/fax_interactions',auth[_0xeccd('0x8')](),controller[_0xeccd('0x4c')]);router[_0xeccd('0x36')]('/:id/sms_interactions',auth[_0xeccd('0x8')](),controller[_0xeccd('0x4d')]);router[_0xeccd('0x36')](_0xeccd('0x4e'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xeccd('0x36')](_0xeccd('0x4f'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x50')]);router[_0xeccd('0x36')](_0xeccd('0x51'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x52')]);router[_0xeccd('0x36')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xeccd('0x53')]);router[_0xeccd('0x36')](_0xeccd('0x2b'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x54')]);router[_0xeccd('0x36')](_0xeccd('0x2d'),auth[_0xeccd('0x8')](),controller['addSmsAccounts']);router['post']('/:id/chat_websites',auth[_0xeccd('0x8')](),controller['addChatWebsites']);router[_0xeccd('0x36')](_0xeccd('0x55'),auth['isAuthenticated'](),controller[_0xeccd('0x56')]);router[_0xeccd('0x36')](_0xeccd('0x34'),auth[_0xeccd('0x8')](),controller['createApiKey']);router[_0xeccd('0x57')]('/:id',auth[_0xeccd('0x8')](),controller[_0xeccd('0x58')]);router[_0xeccd('0x57')](_0xeccd('0x59'),auth[_0xeccd('0x8')](),controller['changePassword']);router[_0xeccd('0x5a')](_0xeccd('0x13'),auth['isAuthenticated'](),controller['removeQueues']);router[_0xeccd('0x5a')]('/:id/teams',auth[_0xeccd('0x8')](),controller['removeTeams']);router[_0xeccd('0x5a')](_0xeccd('0xd'),auth[_0xeccd('0x8')](),controller['destroy']);router['delete'](_0xeccd('0x49'),auth['isAuthenticated'](),controller[_0xeccd('0x5b')]);router['delete']('/:id/mail_interactions',auth[_0xeccd('0x8')](),controller[_0xeccd('0x5c')]);router[_0xeccd('0x5a')]('/:id/fax_interactions',auth[_0xeccd('0x8')](),controller['removeFaxInteractions']);router[_0xeccd('0x5a')]('/:id/sms_interactions',auth[_0xeccd('0x8')](),controller[_0xeccd('0x5d')]);router['delete'](_0xeccd('0x4e'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x5e')]);router[_0xeccd('0x5a')](_0xeccd('0x4f'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x5f')]);router[_0xeccd('0x5a')](_0xeccd('0x51'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x60')]);router[_0xeccd('0x5a')](_0xeccd('0x29'),auth['isAuthenticated'](),controller[_0xeccd('0x61')]);router[_0xeccd('0x5a')](_0xeccd('0x2b'),auth[_0xeccd('0x8')](),controller[_0xeccd('0x62')]);router['delete'](_0xeccd('0x2d'),auth[_0xeccd('0x8')](),controller['removeSmsAccounts']);router[_0xeccd('0x5a')](_0xeccd('0x2f'),auth[_0xeccd('0x8')](),controller['removeChatWebsites']);router[_0xeccd('0x5a')](_0xeccd('0x55'),auth['isAuthenticated'](),controller[_0xeccd('0x63')]);router[_0xeccd('0x5a')](_0xeccd('0x34'),auth['isAuthenticated'](),controller[_0xeccd('0x64')]);router['post']('/:id/messengerSoundNotification',auth[_0xeccd('0x8')](),controller[_0xeccd('0x65')]);module[_0xeccd('0x66')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 757c4f6..a5128cd 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 _0xf09d=['udp','wss','encryption','avpf','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','rtcp_mux','dtlsverify','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','UNSIGNED','moment','util','lodash','exports','name','STRING','setDataValue','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','email','ENUM','admin','user','agent','local','accountcode','BOOLEAN','DATE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','nonat','update','outgoing','yes','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','actpass','TEXT','get','isArray'];(function(_0xd00314,_0x385db5){var _0x5baef2=function(_0x2e67ea){while(--_0x2e67ea){_0xd00314['push'](_0xd00314['shift']());}};_0x5baef2(++_0x385db5);}(_0xf09d,0x1c5));var _0xdf09=function(_0x5d5979,_0x3b4921){_0x5d5979=_0x5d5979-0x0;var _0x237182=_0xf09d[_0x5d5979];return _0x237182;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdf09('0x0'));var util=require(_0xdf09('0x1'));var _=require(_0xdf09('0x2'));module[_0xdf09('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x53e030){this['setDataValue'](_0xdf09('0x4'),_0x53e030);this['setDataValue']('defaultuser',_0x53e030);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xdf09('0x5')],'allowNull':![],'set':function(_0x19f0e1){this[_0xdf09('0x6')](_0xdf09('0x7'),_0x19f0e1);this['setDataValue'](_0xdf09('0x8'),util['format'](_0xdf09('0x9'),_0x19f0e1,this[_0xdf09('0xa')]('internal')));}},'alias':{'type':Sequelize[_0xdf09('0x5')]},'email':{'type':Sequelize[_0xdf09('0x5')],'allowNull':![],'unique':_0xdf09('0xb'),'validate':{'isEmail':!![]},'set':function(_0x227398){if(_0x227398){this[_0xdf09('0x6')](_0xdf09('0xb'),_0x227398['toLowerCase']());}}},'role':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0xd'),_0xdf09('0xe'),_0xdf09('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xdf09('0x5')],'defaultValue':_0xdf09('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x1000f7){this[_0xdf09('0x6')]('internal',_0x1000f7);this[_0xdf09('0x6')](_0xdf09('0x11'),_0x1000f7);this[_0xdf09('0x6')](_0xdf09('0x8'),util['format'](_0xdf09('0x9'),this[_0xdf09('0xa')](_0xdf09('0x7')),_0x1000f7));}},'salt':{'type':Sequelize[_0xdf09('0x5')]},'phone':{'type':Sequelize[_0xdf09('0x5')]},'mobile':{'type':Sequelize[_0xdf09('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xdf09('0x5')]},'userpic':{'type':Sequelize[_0xdf09('0x5')]},'city':{'type':Sequelize[_0xdf09('0x5')]},'country':{'type':Sequelize[_0xdf09('0x5')]},'online':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xdf09('0x13')]},'voicePause':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xdf09('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xdf09('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xdf09('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![],'defaultValue':_0xdf09('0x15')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xdf09('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xdf09('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x16'),'user',_0xdf09('0x17')),'allowNull':!![],'defaultValue':_0xdf09('0x16')},'context':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![],'defaultValue':_0xdf09('0x18')},'callingpres':{'type':Sequelize['ENUM'](_0xdf09('0x19'),_0xdf09('0x1a'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xdf09('0x1b'),_0xdf09('0x1c'),_0xdf09('0x1d'),_0xdf09('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x22af20){this[_0xdf09('0x6')](_0xdf09('0x1f'),_0x22af20?_0x22af20['join'](','):null);},'get':function(){return this[_0xdf09('0xa')](_0xdf09('0x1f'))?this[_0xdf09('0xa')](_0xdf09('0x1f'))[_0xdf09('0x20')](','):null;},'comment':_0xdf09('0x21')},'dtmfmode':{'type':Sequelize[_0xdf09('0xc')]('rfc2833',_0xdf09('0x22'),_0xdf09('0x23'),'inband',_0xdf09('0x24')),'allowNull':!![],'defaultValue':_0xdf09('0x25')},'directmedia':{'type':Sequelize[_0xdf09('0xc')]('yes','no',_0xdf09('0x26'),_0xdf09('0x27'),_0xdf09('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x3d7836){this['setDataValue'](_0xdf09('0x2a'),_0x3d7836?_0x3d7836[_0xdf09('0x2b')](','):null);},'get':function(){return this['getDataValue'](_0xdf09('0x2a'))?this[_0xdf09('0xa')]('nat')['split'](','):null;},'comment':_0xdf09('0x2c')},'callgroup':{'type':Sequelize[_0xdf09('0x5')]},'namedcallgroup':{'type':Sequelize[_0xdf09('0x5')]},'pickupgroup':{'type':Sequelize[_0xdf09('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xdf09('0x5')]},'language':{'type':Sequelize[_0xdf09('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdf09('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdf09('0x2d')},'allow':{'type':Sequelize[_0xdf09('0x5')],'allowNull':![],'defaultValue':_0xdf09('0x2e'),'set':function(_0x178d9d){this[_0xdf09('0x6')](_0xdf09('0x2f'),_0x178d9d?_0x178d9d[_0xdf09('0x2b')](';'):_0xdf09('0x2e'));},'get':function(){return this[_0xdf09('0xa')](_0xdf09('0x2f'))?this['getDataValue'](_0xdf09('0x2f'))[_0xdf09('0x20')](';'):null;},'comment':_0xdf09('0x30')},'autoframing':{'type':Sequelize['ENUM'](_0xdf09('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![],'set':function(_0x33445e){this[_0xdf09('0x6')]('insecure',_0x33445e?_0x33445e[_0xdf09('0x2b')](','):null);},'get':function(){return this['getDataValue'](_0xdf09('0x31'))?this['getDataValue'](_0xdf09('0x31'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no',_0xdf09('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xdf09('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![],'defaultValue':_0xdf09('0x33')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xdf09('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no',_0xdf09('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdf09('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xdf09('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x35'),_0xdf09('0x36'),_0xdf09('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xdf09('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x38'),_0xdf09('0x39')),'allowNull':!![],'defaultValue':_0xdf09('0x39')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xdf09('0x29'),'no'),'allowNull':!![],'defaultValue':_0xdf09('0x29')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xdf09('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xdf09('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xdf09('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xdf09('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xdf09('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xdf09('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xdf09('0xc')]('active','passive',_0xdf09('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xdf09('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xdf09('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no',_0xdf09('0x26'),_0xdf09('0x27'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xdf09('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xdf09('0x13')]},'passwordResetAt':{'type':Sequelize[_0xdf09('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xdf09('0x3c')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x1691f7){this[_0xdf09('0x6')]('showWebBar',_0x1691f7);var _0x37332c=this[_0xdf09('0x3d')]({'plain':!![]});switch(_0x1691f7){case 0x0:case 0x1:var _0x2e99cd=_0x37332c['transport']?_[_0xdf09('0x3e')](_0x37332c[_0xdf09('0x1f')])?_0x37332c['transport'][_0xdf09('0x2b')]():_0x37332c['transport']:_0xdf09('0x3f');if(_0x2e99cd===_0xdf09('0x40')){_0x2e99cd='udp';}this[_0xdf09('0x6')](_0xdf09('0x1f'),_0x2e99cd);this[_0xdf09('0x6')](_0xdf09('0x41'),'no');this['setDataValue'](_0xdf09('0x42'),null);this[_0xdf09('0x6')]('force_avp',null);this[_0xdf09('0x6')](_0xdf09('0x43'),null);this[_0xdf09('0x6')](_0xdf09('0x44'),null);this[_0xdf09('0x6')]('dtlsverify',null);this['setDataValue'](_0xdf09('0x45'),null);this['setDataValue']('dtlscertfile',null);this[_0xdf09('0x6')](_0xdf09('0x46'),null);this[_0xdf09('0x6')](_0xdf09('0x47'),'no');break;case 0x2:this[_0xdf09('0x6')]('transport',_0xdf09('0x40'));this[_0xdf09('0x6')](_0xdf09('0x41'),'yes');this[_0xdf09('0x6')](_0xdf09('0x42'),_0xdf09('0x29'));this[_0xdf09('0x6')]('force_avp','yes');this[_0xdf09('0x6')](_0xdf09('0x43'),_0xdf09('0x29'));this[_0xdf09('0x6')](_0xdf09('0x44'),_0xdf09('0x29'));this[_0xdf09('0x6')](_0xdf09('0x48'),'no');this['setDataValue']('dtlssetup',_0xdf09('0x3b'));this['setDataValue'](_0xdf09('0x49'),_0x37332c[_0xdf09('0x49')]||_0xdf09('0x4a'));this[_0xdf09('0x6')](_0xdf09('0x46'),_0x37332c[_0xdf09('0x46')]||_0xdf09('0x4b'));this['setDataValue']('rtcp_mux',_0xdf09('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0xdf09('0x3c')],'set':function(_0x3b1ea9){this[_0xdf09('0x6')](_0xdf09('0x4c'),_0x3b1ea9?_0x3b1ea9[_0xdf09('0x2b')](','):[]);},'get':function(){return this[_0xdf09('0xa')](_0xdf09('0x4c'))?_[_0xdf09('0x4d')](this[_0xdf09('0xa')](_0xdf09('0x4c'))['split'](','),function(_0x5efea4){return parseInt(_0x5efea4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xdf09('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xdf09('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xdf09('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xdf09('0xc')](_0xdf09('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xdf09('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xdf09('0x4e')],'get':function(){return this[_0xdf09('0xa')](_0xdf09('0x4f'))?this[_0xdf09('0xa')](_0xdf09('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xdf09('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![],'set':function(_0x504a3b){if(typeof _0x504a3b===_0xdf09('0x50')){var _0x26cc9c=_0x504a3b==='1'?!![]:_0x504a3b==='0'?![]:_0x504a3b===_0xdf09('0x51')?!![]:_0x504a3b==='false'?![]:![];this[_0xdf09('0x6')](_0xdf09('0x52'),_0x26cc9c);}else{this[_0xdf09('0x6')]('screenrecording',_0x504a3b);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x25d952){this[_0xdf09('0x6')](_0xdf09('0x53'),_0x25d952);if(_0x25d952===!![]){this['setDataValue'](_0xdf09('0x54'),moment());this[_0xdf09('0x6')]('loginAttempts',0x0);}else{this[_0xdf09('0x6')](_0xdf09('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0xdf09('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xdf09('0x14')](0x5)[_0xdf09('0x55')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xdf09('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xdf09('0x12')],'defaultValue':![]}}; \ No newline at end of file +var _0x0531=['DEFAULT\x20PAUSE','DATE','INTEGER','friend','user','from-sip','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','rfc2833','info','inband','yes','update','outgoing','nat','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','originate','uac','fingerprint','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','avpf','force_avp','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','moment','util','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','accountcode','format','getDataValue','BOOLEAN'];(function(_0x58928c,_0x1a10f2){var _0x171cad=function(_0x1e041c){while(--_0x1e041c){_0x58928c['push'](_0x58928c['shift']());}};_0x171cad(++_0x1a10f2);}(_0x0531,0x1dc));var _0x1053=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0x0531[_0x28c939];return _0x527fe9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1053('0x0'));var util=require(_0x1053('0x1'));var _=require('lodash');module[_0x1053('0x2')]={'name':{'type':Sequelize[_0x1053('0x3')],'allowNull':![],'unique':_0x1053('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x31ecbd){this[_0x1053('0x5')](_0x1053('0x4'),_0x31ecbd);this[_0x1053('0x5')](_0x1053('0x6'),_0x31ecbd);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1053('0x3')],'allowNull':![],'set':function(_0x2f876f){this[_0x1053('0x5')](_0x1053('0x7'),_0x2f876f);this[_0x1053('0x5')](_0x1053('0x8'),util['format'](_0x1053('0x9'),_0x2f876f,this['getDataValue'](_0x1053('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1053('0x3')],'allowNull':![],'unique':_0x1053('0xb'),'validate':{'isEmail':!![]},'set':function(_0x366135){if(_0x366135){this[_0x1053('0x5')](_0x1053('0xb'),_0x366135[_0x1053('0xc')]());}}},'role':{'type':Sequelize[_0x1053('0xd')](_0x1053('0xe'),'user',_0x1053('0xf'),_0x1053('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1053('0x3')],'defaultValue':_0x1053('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x1053('0xa'),'set':function(_0x3134c6){this[_0x1053('0x5')](_0x1053('0xa'),_0x3134c6);this[_0x1053('0x5')](_0x1053('0x12'),_0x3134c6);this[_0x1053('0x5')]('callerid',util[_0x1053('0x13')](_0x1053('0x9'),this[_0x1053('0x14')](_0x1053('0x7')),_0x3134c6));}},'salt':{'type':Sequelize[_0x1053('0x3')]},'phone':{'type':Sequelize[_0x1053('0x3')]},'mobile':{'type':Sequelize[_0x1053('0x3')]},'address':{'type':Sequelize[_0x1053('0x3')]},'zipcode':{'type':Sequelize[_0x1053('0x3')]},'userpic':{'type':Sequelize[_0x1053('0x3')]},'city':{'type':Sequelize[_0x1053('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1053('0x3')],'defaultValue':_0x1053('0x16')},'lastPauseAt':{'type':Sequelize[_0x1053('0x17')]},'chatCapacity':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x1053('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1053('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x1053('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x19'),_0x1053('0x1a'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![],'defaultValue':_0x1053('0x1b')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x1053('0x1c'),_0x1053('0x1d'),_0x1053('0x1e'),_0x1053('0x1f'),_0x1053('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![],'defaultValue':_0x1053('0x21'),'set':function(_0x255212){this[_0x1053('0x5')](_0x1053('0x22'),_0x255212?_0x255212[_0x1053('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x1053('0x22'))?this[_0x1053('0x14')](_0x1053('0x22'))[_0x1053('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x25'),_0x1053('0x26'),'shortinfo',_0x1053('0x27'),'auto'),'allowNull':!![],'defaultValue':_0x1053('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0x1053('0x28'),'no','nonat',_0x1053('0x29'),_0x1053('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x3f3f2c){this['setDataValue'](_0x1053('0x2b'),_0x3f3f2c?_0x3f3f2c[_0x1053('0x23')](','):null);},'get':function(){return this[_0x1053('0x14')](_0x1053('0x2b'))?this['getDataValue'](_0x1053('0x2b'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1053('0x3')]},'pickupgroup':{'type':Sequelize[_0x1053('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1053('0x3')]},'language':{'type':Sequelize[_0x1053('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1053('0x3')]},'disallow':{'type':Sequelize[_0x1053('0x3')],'allowNull':![],'defaultValue':_0x1053('0x2c')},'allow':{'type':Sequelize[_0x1053('0x3')],'allowNull':![],'defaultValue':_0x1053('0x2d'),'set':function(_0x2d4bf0){this[_0x1053('0x5')](_0x1053('0x2e'),_0x2d4bf0?_0x2d4bf0[_0x1053('0x23')](';'):_0x1053('0x2d'));},'get':function(){return this[_0x1053('0x14')](_0x1053('0x2e'))?this[_0x1053('0x14')]('allow')[_0x1053('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![],'set':function(_0x8c8f74){this[_0x1053('0x5')](_0x1053('0x2f'),_0x8c8f74?_0x8c8f74[_0x1053('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x1053('0x2f'))?this[_0x1053('0x14')](_0x1053('0x2f'))[_0x1053('0x24')](','):null;},'comment':_0x1053('0x30')},'trustrpid':{'type':Sequelize['ENUM'](_0x1053('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1053('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1053('0xd')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![],'defaultValue':_0x1053('0x31')},'amaflags':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x1053('0x28'),'no'),'allowNull':!![],'defaultValue':_0x1053('0x28')},'busylevel':{'type':Sequelize[_0x1053('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1053('0xd')]('yes','no',_0x1053('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1053('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1053('0xd')]('accept','refuse',_0x1053('0x33')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1053('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x34'),'uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1053('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1053('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x1053('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1053('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1053('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1053('0xd')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no',_0x1053('0x35'),_0x1053('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1053('0xd')]('active',_0x1053('0x37'),_0x1053('0x38')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1053('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no','nonat','update',_0x1053('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x1053('0x17')]},'passwordResetAt':{'type':Sequelize[_0x1053('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1053('0x3a')]},'showWebBar':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0,'set':function(_0x31194a){this[_0x1053('0x5')](_0x1053('0x3b'),_0x31194a);var _0x5bd2d8=this[_0x1053('0x3c')]({'plain':!![]});switch(_0x31194a){case 0x0:case 0x1:var _0x384d23=_0x5bd2d8['transport']?_[_0x1053('0x3d')](_0x5bd2d8[_0x1053('0x22')])?_0x5bd2d8[_0x1053('0x22')][_0x1053('0x23')]():_0x5bd2d8[_0x1053('0x22')]:'udp';if(_0x384d23===_0x1053('0x3e')){_0x384d23=_0x1053('0x21');}this['setDataValue'](_0x1053('0x22'),_0x384d23);this[_0x1053('0x5')]('encryption','no');this['setDataValue'](_0x1053('0x3f'),null);this['setDataValue'](_0x1053('0x40'),null);this[_0x1053('0x5')]('icesupport',null);this[_0x1053('0x5')](_0x1053('0x41'),null);this['setDataValue'](_0x1053('0x42'),null);this[_0x1053('0x5')]('dtlssetup',null);this[_0x1053('0x5')](_0x1053('0x43'),null);this[_0x1053('0x5')](_0x1053('0x44'),null);this[_0x1053('0x5')](_0x1053('0x45'),'no');break;case 0x2:this[_0x1053('0x5')](_0x1053('0x22'),_0x1053('0x3e'));this[_0x1053('0x5')](_0x1053('0x46'),_0x1053('0x28'));this[_0x1053('0x5')]('avpf',_0x1053('0x28'));this[_0x1053('0x5')]('force_avp',_0x1053('0x28'));this[_0x1053('0x5')]('icesupport',_0x1053('0x28'));this['setDataValue']('dtlsenable',_0x1053('0x28'));this['setDataValue']('dtlsverify','no');this[_0x1053('0x5')](_0x1053('0x47'),'actpass');this[_0x1053('0x5')](_0x1053('0x43'),_0x5bd2d8['dtlscertfile']||_0x1053('0x48'));this[_0x1053('0x5')](_0x1053('0x44'),_0x5bd2d8[_0x1053('0x44')]||_0x1053('0x49'));this['setDataValue'](_0x1053('0x45'),_0x1053('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x1053('0x3a')],'set':function(_0x43bf28){this[_0x1053('0x5')](_0x1053('0x4a'),_0x43bf28?_0x43bf28[_0x1053('0x23')](','):[]);},'get':function(){return this['getDataValue'](_0x1053('0x4a'))?_[_0x1053('0x4b')](this[_0x1053('0x14')](_0x1053('0x4a'))[_0x1053('0x24')](','),function(_0xa80a3d){return parseInt(_0xa80a3d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1053('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1053('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1053('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1053('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1053('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1053('0xd')](_0x1053('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1053('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1053('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1053('0x4c')],'get':function(){return this[_0x1053('0x14')](_0x1053('0x4d'))?this[_0x1053('0x14')](_0x1053('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1053('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3fdd99){if(typeof _0x3fdd99===_0x1053('0x4e')){var _0x203afa=_0x3fdd99==='1'?!![]:_0x3fdd99==='0'?![]:_0x3fdd99===_0x1053('0x4f')?!![]:_0x3fdd99===_0x1053('0x50')?![]:![];this[_0x1053('0x5')]('screenrecording',_0x203afa);}else{this['setDataValue'](_0x1053('0x51'),_0x3fdd99);}}},'blocked':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![],'set':function(_0x498498){this[_0x1053('0x5')](_0x1053('0x52'),_0x498498);if(_0x498498===!![]){this['setDataValue']('blockedAt',moment());this[_0x1053('0x5')]('loginAttempts',0x0);}else{this[_0x1053('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x1053('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1053('0x18')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1053('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1053('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1053('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1053('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x1053('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 0d30101..308b49a 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 _0x5364=['addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','getWhatsappAccounts','addWhatsappAccounts','$and','$or','$gt','$lt','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$overlap','$contains','$contained','$any','firstName','lastName','phone','Contact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','idle','unknown','ringing','teams','inbound','flatten','toString','lower','col','asc','desc','getRealtimeAgents','voiceStatus','unavailable','busy','charAt','toUpperCase','slice','select','field','InteractionId','ui.createdAt','OpenTabs','enabled','moment','path','lodash','squel','ioredis','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../errors/api','APIBadRequestError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','http','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','update','role','agent','emit','userNotification:recalc:','destroy','get','admin','Users','user','Agents','telephone','filter','ignore','map','value','find','stack','name','send','User','fieldName','type','key','salt','previousPasswords','resetPasswordToken','md5secret','index','getOptions','where','query','includeAll','userSetting','true','include','UserSetting','includes','attributes','push','rows','length','chat','dataValues','sms','fax','mail','openchannel','whatsapp','catch','show','params','options','openTabs','all','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','password','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','105','106','108','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','userProfileId','Telephones','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','findAll','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','enforcePasswordHistory','validatePasswordHistory','updatePasswordsHistory','channel','online','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','Queue:save','voice','VoiceQueue','interface','format','UserVoiceQueueRt','upsert','removeQueues','remove','Queues','isArray','Queue:remove','addAvatar','userpic','file','filename','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tags','color','tag','model','keys','Queue','filters','intersection','fields','order','sort','pick','merge','Unknown\x20role','nolimit','rawAttributes','getVoiceQueuesRt','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','loginInPause','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','transaction','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','Voice','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount'];(function(_0x292145,_0x299228){var _0x2e8147=function(_0x13aa43){while(--_0x13aa43){_0x292145['push'](_0x292145['shift']());}};_0x2e8147(++_0x299228);}(_0x5364,0x1d7));var _0x4536=function(_0x2c8972,_0x1aff63){_0x2c8972=_0x2c8972-0x0;var _0x5d1e22=_0x5364[_0x2c8972];return _0x5d1e22;};'use strict';var moment=require(_0x4536('0x0'));var util=require('util');var path=require(_0x4536('0x1'));var fs=require('fs');var _=require(_0x4536('0x2'));var squel=require(_0x4536('0x3'));var Redis=require(_0x4536('0x4'));var jayson=require(_0x4536('0x5'));var authService=require(_0x4536('0x6'));var contacts=require('../../components/contacts');var qs=require(_0x4536('0x7'));var rta=require(_0x4536('0x8'));var logger=require(_0x4536('0x9'))(_0x4536('0xa'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x4536('0xb'))[_0x4536('0xc')];var APINotFoundError=require(_0x4536('0xb'))['APINotFoundError'];var APIForbiddenError=require(_0x4536('0xb'))[_0x4536('0xd')];var APIHandleError=require(_0x4536('0xb'))[_0x4536('0xe')];var db=require(_0x4536('0xf'))['db'];var socket=require(_0x4536('0x10'))(new Redis(config[_0x4536('0x11')]));require('./user.socket')[_0x4536('0x12')](socket);config['redis']=_[_0x4536('0x13')](config[_0x4536('0x11')],{'host':_0x4536('0x14'),'port':0x18eb});var amiClient=jayson['client'][_0x4536('0x15')]({'port':0x232a});var values;function respondWithStatusCode(_0x29deaa,_0x45609e){_0x45609e=_0x45609e||0xcc;return function(_0x2fe808){if(_0x2fe808){return _0x29deaa[_0x4536('0x16')](_0x45609e);}return _0x29deaa[_0x4536('0x17')](_0x45609e)[_0x4536('0x18')]();};}function respondWithResult(_0x7c5577,_0x3b431b){_0x3b431b=_0x3b431b||0xc8;return function(_0x415b06){if(_0x415b06){return _0x7c5577[_0x4536('0x17')](_0x3b431b)[_0x4536('0x19')](_0x415b06);}};}function respondWithFilteredResult(_0x22b28f,_0x1e0d39){return function(_0x4de303){if(_0x4de303){var _0x5b4f8e=typeof _0x1e0d39['offset']===_0x4536('0x1a')&&typeof _0x1e0d39[_0x4536('0x1b')]===_0x4536('0x1a');var _0x901ebf=_0x4de303[_0x4536('0x1c')];var _0x316c87=_0x5b4f8e?0x0:_0x1e0d39['offset'];var _0x5eb51b=_0x5b4f8e?_0x4de303[_0x4536('0x1c')]:_0x1e0d39[_0x4536('0x1d')]+_0x1e0d39[_0x4536('0x1b')];var _0x462ece;if(_0x5eb51b>=_0x901ebf){_0x5eb51b=_0x901ebf;_0x462ece=0xc8;}else{_0x462ece=0xce;}_0x22b28f['status'](_0x462ece);return _0x22b28f['set'](_0x4536('0x1e'),_0x316c87+'-'+_0x5eb51b+'/'+_0x901ebf)[_0x4536('0x19')](_0x4de303);}return null;};}function respondWithRpcPromise(_0x5987f3,_0x34492c,_0x2967c8,_0x4380b4){return new Promise(function(_0x42802b,_0x50c388){var _0x1ffcbf=_0x4380b4||amiClient;return _0x1ffcbf[_0x4536('0x1f')](_0x5987f3,_0x2967c8)[_0x4536('0x20')](function(_0x44d769){logger[_0x4536('0x21')](_0x4536('0x22'),_0x34492c,_0x4536('0x23'));logger[_0x4536('0x24')](_0x4536('0x25'),_0x34492c,_0x4536('0x23'),JSON[_0x4536('0x26')](_0x44d769));if(_0x44d769[_0x4536('0x27')]){if(_0x44d769[_0x4536('0x27')]['code']===0x1f4){logger[_0x4536('0x27')](_0x4536('0x22'),_0x34492c,_0x44d769[_0x4536('0x27')][_0x4536('0x28')]);return _0x50c388(_0x44d769[_0x4536('0x27')][_0x4536('0x28')]);}logger['error'](_0x4536('0x22'),_0x34492c,_0x44d769[_0x4536('0x27')][_0x4536('0x28')]);return _0x42802b(_0x44d769['error'][_0x4536('0x28')]);}else{logger['info']('User,\x20%s,\x20%s',_0x34492c,_0x4536('0x23'));_0x42802b(_0x44d769['result'][_0x4536('0x28')]);}})['catch'](function(_0x28e986){logger['error']('User,\x20%s,\x20%s',_0x34492c,_0x28e986);_0x50c388(_0x28e986);});});}function saveUpdates(_0x356079){return function(_0x74d293){if(_0x74d293){return _0x74d293[_0x4536('0x29')](_0x356079)[_0x4536('0x20')](function(_0x18411e){if(_0x18411e[_0x4536('0x2a')]===_0x4536('0x2b')){socket[_0x4536('0x2c')](_0x4536('0x2d')+_0x18411e['id'],_0x18411e);}return _0x18411e;});}return null;};}function removeEntity(_0x48c0c9,_0x323339){return function(_0x55e212){if(_0x55e212){return _0x55e212[_0x4536('0x2e')]({'transaction':_0x323339})[_0x4536('0x20')](function(){var _0x50b5d0=_0x55e212[_0x4536('0x2f')]({'plain':!![]});if(_0x50b5d0[_0x4536('0x2a')]===_0x4536('0x30'))return;var _0x2088d6=[{'name':_0x4536('0x31'),'value':_0x4536('0x32'),'ignore':!![]},{'name':_0x4536('0x33'),'value':_0x4536('0x2b'),'ignore':![]},{'name':'Telephones','value':_0x4536('0x34'),'ignore':![]}];var _0x22f999=_(_0x2088d6)[_0x4536('0x35')](_0x4536('0x36'))[_0x4536('0x37')](_0x4536('0x38'))[_0x4536('0x38')]();if(_['includes'](_0x22f999,_0x50b5d0['role'])){return;}var _0x307066=_[_0x4536('0x39')](_0x2088d6,[_0x4536('0x38'),_0x50b5d0['role']])['name'];return db['UserProfileResource'][_0x4536('0x2e')]({'where':{'type':_0x307066,'resourceId':_0x50b5d0['id']},'transaction':_0x323339})[_0x4536('0x20')](function(){return _0x55e212;});})[_0x4536('0x20')](function(){_0x48c0c9[_0x4536('0x17')](0xcc)[_0x4536('0x18')]();});}};}function handleEntityNotFound(_0x4e5cad){return function(_0x593a1b){if(!_0x593a1b){_0x4e5cad['sendStatus'](0x194);}return _0x593a1b;};}function handleError(_0x5573f6,_0x9a0b44){_0x9a0b44=_0x9a0b44||0x1f4;return function(_0x455a75){logger['error'](_0x455a75[_0x4536('0x3a')]);if(_0x455a75[_0x4536('0x3b')]){delete _0x455a75[_0x4536('0x3b')];}_0x5573f6[_0x4536('0x17')](_0x9a0b44)[_0x4536('0x3c')](_0x455a75);};}function getUserAttributes(){return _(db[_0x4536('0x3d')]['rawAttributes'])[_0x4536('0x37')](function(_0x286b68){return{'name':_0x286b68[_0x4536('0x3e')],'type':_0x286b68[_0x4536('0x3f')][_0x4536('0x40')]};})[_0x4536('0x35')](function(_0x1c634e){return!['password',_0x4536('0x41'),_0x4536('0x42'),_0x4536('0x43'),'resetPasswordExpires',_0x4536('0x44')]['includes'](_0x1c634e['name']);})[_0x4536('0x38')]();}exports[_0x4536('0x45')]=function(_0x15a38a,_0x2e9202){var _0x620bfa={},_0x37596f={'count':0x0,'rows':[]};var _0x4222fd=getUserAttributes();_0x620bfa=qs[_0x4536('0x46')](_0x4222fd,_0x15a38a);var _0x3f798f={'where':_0x620bfa[_0x4536('0x47')]};return db[_0x4536('0x3d')][_0x4536('0x1c')](_0x3f798f)[_0x4536('0x20')](function(_0x49d77c){_0x37596f[_0x4536('0x1c')]=_0x49d77c;if(_0x15a38a[_0x4536('0x48')][_0x4536('0x49')]){_0x620bfa['include']=[{'all':!![]}];}if(_0x15a38a[_0x4536('0x48')][_0x4536('0x4a')]===_0x4536('0x4b')){_0x620bfa[_0x4536('0x4c')]=[{'model':db[_0x4536('0x4d')],'as':_0x4536('0x4a')}];}if(!_[_0x4536('0x4e')](_0x620bfa['attributes'],'id')){_0x620bfa[_0x4536('0x4f')][_0x4536('0x50')]('id');}return db[_0x4536('0x3d')]['findAll'](_0x620bfa);})[_0x4536('0x20')](function(_0x307425){_0x37596f[_0x4536('0x51')]=_0x307425;if(_0x15a38a[_0x4536('0x48')]['openTabs']===_0x4536('0x4b')){var _0x99b9f9=[];for(var _0x1b9cac=0x0;_0x1b9cac<_0x37596f[_0x4536('0x51')][_0x4536('0x52')];_0x1b9cac++){_0x99b9f9[_0x4536('0x50')](get_open_tabs(_0x4536('0x53'),_0x37596f[_0x4536('0x51')][_0x1b9cac][_0x4536('0x54')]));_0x99b9f9['push'](get_open_tabs(_0x4536('0x55'),_0x37596f[_0x4536('0x51')][_0x1b9cac][_0x4536('0x54')]));_0x99b9f9['push'](get_open_tabs(_0x4536('0x56'),_0x37596f[_0x4536('0x51')][_0x1b9cac][_0x4536('0x54')]));_0x99b9f9['push'](get_open_tabs(_0x4536('0x57'),_0x37596f[_0x4536('0x51')][_0x1b9cac][_0x4536('0x54')]));_0x99b9f9[_0x4536('0x50')](get_open_tabs(_0x4536('0x58'),_0x37596f[_0x4536('0x51')][_0x1b9cac][_0x4536('0x54')]));_0x99b9f9[_0x4536('0x50')](get_open_tabs(_0x4536('0x59'),_0x37596f[_0x4536('0x51')][_0x1b9cac]['dataValues']));}return Promise['all'](_0x99b9f9)['then'](function(){return _0x37596f;});}else{return _0x37596f;}})[_0x4536('0x20')](respondWithFilteredResult(_0x2e9202,_0x620bfa))[_0x4536('0x5a')](handleError(_0x2e9202,null));};exports[_0x4536('0x5b')]=function(_0x493f3d,_0x2a725d){var _0x158fe4=getUserAttributes();_0x493f3d[_0x4536('0x48')]['id']=_0x493f3d[_0x4536('0x5c')]['id'];var _0x218462=qs['getOptions'](_0x158fe4,_0x493f3d);if(_0x493f3d[_0x4536('0x48')][_0x4536('0x49')]){_0x218462[_0x4536('0x4c')]=[{'all':!![]}];}if(_0x493f3d['query']['userSetting']===_0x4536('0x4b')){_0x218462[_0x4536('0x4c')]=[{'model':db[_0x4536('0x4d')],'as':_0x4536('0x4a')}];}_0x218462=_['merge']({},_0x218462,_0x493f3d[_0x4536('0x5d')]);if(!_['includes'](_0x218462[_0x4536('0x4f')],'id')){_0x218462[_0x4536('0x4f')][_0x4536('0x50')]('id');}return db[_0x4536('0x3d')][_0x4536('0x39')](_0x218462)[_0x4536('0x20')](handleEntityNotFound(_0x2a725d,null))['then'](function(_0xf7a98c){var _0x2bf08b=[];values=_0xf7a98c;if(_0x493f3d[_0x4536('0x48')][_0x4536('0x5e')]===_0x4536('0x4b')){_0x2bf08b['push'](get_open_tabs(_0x4536('0x53'),_0xf7a98c[_0x4536('0x54')]));_0x2bf08b['push'](get_open_tabs(_0x4536('0x55'),_0xf7a98c[_0x4536('0x54')]));_0x2bf08b[_0x4536('0x50')](get_open_tabs(_0x4536('0x58'),_0xf7a98c[_0x4536('0x54')]));_0x2bf08b[_0x4536('0x50')](get_open_tabs(_0x4536('0x59'),_0xf7a98c['dataValues']));_0x2bf08b[_0x4536('0x50')](get_open_tabs('fax',_0xf7a98c[_0x4536('0x54')]));_0x2bf08b['push'](get_open_tabs(_0x4536('0x57'),_0xf7a98c['dataValues']));return Promise[_0x4536('0x5f')](_0x2bf08b);}else{return values;}})[_0x4536('0x20')](function(){return values;})[_0x4536('0x20')](respondWithResult(_0x2a725d,null))[_0x4536('0x5a')](handleError(_0x2a725d,null));};exports['update']=function(_0x128318,_0xb0bb8d){if(_0x128318['body']['id']){delete _0x128318[_0x4536('0x60')]['id'];}delete _0x128318[_0x4536('0x60')][_0x4536('0x2a')];return db[_0x4536('0x3d')][_0x4536('0x39')]({'where':{'id':_0x128318['params']['id']}})[_0x4536('0x20')](handleEntityNotFound(_0xb0bb8d,null))['then'](saveUpdates(_0x128318[_0x4536('0x60')],null))[_0x4536('0x20')](respondWithResult(_0xb0bb8d,null))[_0x4536('0x5a')](handleError(_0xb0bb8d,null));};exports[_0x4536('0x61')]=function(_0x4554a9,_0x29a7d4){return db[_0x4536('0x3d')][_0x4536('0x61')]()['then'](respondWithResult(_0x29a7d4,null))[_0x4536('0x5a')](handleError(_0x29a7d4,null));};exports['addContacts']=function(_0x158fea,_0x51d12d){return db[_0x4536('0x3d')][_0x4536('0x39')]({'where':{'id':_0x158fea[_0x4536('0x5c')]['id']}})[_0x4536('0x20')](handleEntityNotFound(_0x51d12d,null))[_0x4536('0x20')](function(_0x26f1dc){if(_0x26f1dc){return _0x26f1dc[_0x4536('0x62')](_0x158fea[_0x4536('0x60')][_0x4536('0x63')],_['omit'](_0x158fea[_0x4536('0x60')],[_0x4536('0x63'),'id'])||{});}})['then'](respondWithResult(_0x51d12d,null))[_0x4536('0x5a')](handleError(_0x51d12d,null));};function validateUser(_0x4b3602){return new Promise(function(_0x9ce78f,_0x30eaef){if(_0x4b3602[_0x4536('0x64')])return _0x9ce78f(_0x4b3602);return db[_0x4536('0x65')][_0x4536('0x66')](0x1)[_0x4536('0x20')](function(_0x1b2a0f){if(_0x1b2a0f[_0x4536('0x67')])authService[_0x4536('0x68')](_0x4b3602[_0x4536('0x69')]);db[_0x4536('0x3d')]['max'](_0x4536('0x64'))[_0x4536('0x20')](function(_0x44e406){if(_[_0x4536('0x6a')](_0x44e406)){_0x4b3602[_0x4536('0x64')]=_0x1b2a0f[_0x4536('0x6b')]||0x1;return;}if(_[_0x4536('0x6a')](_0x1b2a0f['min_internal'])||_0x1b2a0f[_0x4536('0x6b')]===_0x44e406){_0x4b3602['internal']=_0x44e406+0x1;return;}if(_0x1b2a0f[_0x4536('0x6b')]>_0x44e406){_0x4b3602[_0x4536('0x64')]=_0x1b2a0f['min_internal'];return;}return db[_0x4536('0x6c')][_0x4536('0x48')](_0x4536('0x6d'),{'type':db[_0x4536('0x6c')][_0x4536('0x6e')][_0x4536('0x6f')]})[_0x4536('0x20')](function(_0x16da8a){if(_0x16da8a&&_0x16da8a[_0x4536('0x52')]){for(var _0x1a567b=0x0,_0x1a4d17=_0x16da8a[_0x4536('0x52')];_0x1a567b<_0x1a4d17&&_[_0x4536('0x6a')](_0x4b3602['internal']);_0x1a567b++){if(_0x1b2a0f['min_internal']<=_0x16da8a[_0x1a567b][_0x4536('0x70')]){_0x4b3602[_0x4536('0x64')]=_0x16da8a[_0x1a567b][_0x4536('0x70')];}else if(_0x1b2a0f['min_internal']>_0x16da8a[_0x1a567b][_0x4536('0x70')]&&_0x1b2a0f[_0x4536('0x6b')]<=_0x16da8a[_0x1a567b]['to']){_0x4b3602[_0x4536('0x64')]=_0x1b2a0f['min_internal'];}}}if(_[_0x4536('0x6a')](_0x4b3602[_0x4536('0x64')])){_0x4b3602[_0x4536('0x64')]=_0x44e406+0x1;}return _0x9ce78f(_0x4b3602);});});})[_0x4536('0x5a')](function(_0x5efae9){_0x30eaef(_0x5efae9);});});}function updateUser(_0x5c274e){return new Promise(function(_0x4d4c43,_0x495087){try{if(_0x5c274e[_0x4536('0x71')]){_0x5c274e[_0x4536('0x72')]=_0x5c274e[_0x4536('0x64')];_0x5c274e[_0x4536('0x73')]={'mailbox':_0x5c274e[_0x4536('0x64')],'password':_0x5c274e[_0x4536('0x69')],'fullname':_0x5c274e[_0x4536('0x74')],'email':_0x5c274e[_0x4536('0x75')]};}if(_0x5c274e[_0x4536('0x2a')]===_0x4536('0x2b')){if(!_0x5c274e[_0x4536('0x76')])_0x5c274e[_0x4536('0x76')]=[_0x4536('0x77'),_0x4536('0x78'),_0x4536('0x79'),_0x4536('0x7a'),_0x4536('0x7b'),'104',_0x4536('0x7c'),_0x4536('0x7d'),'107',_0x4536('0x7e'),'109',_0x4536('0x7f'),_0x4536('0x80'),_0x4536('0x81'),_0x4536('0x82')];}_0x4d4c43(_0x5c274e);}catch(_0xe12c8f){_0x495087(_0xe12c8f);}});}exports[_0x4536('0x83')]=function(_0x12e617,_0x2219be){if(_0x12e617[_0x4536('0x32')][_0x4536('0x2a')]===_0x4536('0x2b'))throw new Error(_0x4536('0x84'));if(_0x12e617[_0x4536('0x60')][_0x4536('0x2a')]===_0x4536('0x32')&&_0x12e617['user']['role']!==_0x4536('0x30')){throw new Error(_0x4536('0x85'));}if(_0x12e617[_0x4536('0x60')][_0x4536('0x2a')]===_0x4536('0x30')&&_0x12e617['user'][_0x4536('0x2a')]!==_0x4536('0x30')){throw new Error(_0x4536('0x86'));}return licenseUtil[_0x4536('0x87')]([_0x12e617[_0x4536('0x60')]])[_0x4536('0x20')](function(){return validateUser(_0x12e617[_0x4536('0x60')]);})[_0x4536('0x20')](function(_0x117577){return updateUser(_0x117577)['then'](function(_0x134987){if(_0x134987[_0x4536('0x2a')]==='admin'){_0x134987['settingsEnabled']=_0x12e617[_0x4536('0x32')]['settingsEnabled'];delete _0x134987[_0x4536('0x88')];}return _0x134987;});})[_0x4536('0x20')](function(_0x3d1267){return db[_0x4536('0x3d')]['create'](_0x3d1267,{'include':[{'model':db[_0x4536('0x73')],'as':_0x4536('0x73')}]});})[_0x4536('0x20')](function(_0x99b075){if(_0x12e617[_0x4536('0x60')][_0x4536('0x2a')]===_0x4536('0x32'))return _0x99b075;if(_0x12e617[_0x4536('0x32')][_0x4536('0x2a')]!==_0x4536('0x32'))return _0x99b075;return db['UserProfileSection'][_0x4536('0x39')]({'where':{'name':_0x99b075['role']===_0x4536('0x2b')?_0x4536('0x33'):_0x4536('0x89'),'userProfileId':_0x12e617[_0x4536('0x32')][_0x4536('0x88')]},'raw':!![]})[_0x4536('0x20')](function(_0xba013){if(!_0xba013||_0xba013['autoAssociation']!=0x0)return _0x99b075;return db[_0x4536('0x8a')][_0x4536('0x83')]({'name':_0x99b075[_0x4536('0x3b')],'resourceId':_0x99b075['id'],'type':_0xba013['name'],'sectionId':_0xba013['id']},{})[_0x4536('0x20')](function(){return _0x99b075;});})['catch'](function(_0x5118e2){logger[_0x4536('0x27')](_0x4536('0x8b'),_0x5118e2);throw _0x5118e2;});})['then'](respondWithResult(_0x2219be,0xc9))['catch'](handleError(_0x2219be,null));};exports[_0x4536('0x8c')]=function(_0x5d1986,_0x2069dd){var _0x3888db=_0x5d1986[_0x4536('0x60')];var _0x55e433=[];if(_0x5d1986[_0x4536('0x32')][_0x4536('0x2a')]===_0x4536('0x2b'))throw new Error(_0x4536('0x84'));if(_[_0x4536('0x8d')](_0x3888db,[_0x4536('0x2a'),_0x4536('0x32')])&&_0x5d1986[_0x4536('0x32')][_0x4536('0x2a')]!==_0x4536('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x4536('0x8d')](_0x3888db,[_0x4536('0x2a'),'admin'])&&_0x5d1986[_0x4536('0x32')]['role']!==_0x4536('0x30')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x4536('0x87')](_0x3888db)[_0x4536('0x20')](function(){return validateUser(_0x3888db[0x0]);})[_0x4536('0x20')](function(){for(var _0x2f21a4=0x1;_0x2f21a4<_0x3888db[_0x4536('0x52')];_0x2f21a4++){var _0x1a0537=_0x3888db[_0x2f21a4-0x1][_0x4536('0x64')];if(!_0x3888db[_0x2f21a4][_0x4536('0x64')])_0x3888db[_0x2f21a4][_0x4536('0x64')]=_0x1a0537+0x1;_0x55e433['push'](validateUser(_0x3888db[_0x2f21a4]));}return Promise[_0x4536('0x5f')](_0x55e433);})['then'](function(){_0x55e433=[];for(var _0x265142=0x0;_0x265142<_0x3888db[_0x4536('0x52')];_0x265142++){_0x55e433['push'](updateUser(_0x3888db[_0x265142]));}return Promise['all'](_0x55e433);})['then'](function(){_0x55e433=_0x3888db['map'](function(_0x574c8a){return db[_0x4536('0x3d')][_0x4536('0x83')](_0x574c8a,{'include':[{'model':db[_0x4536('0x73')],'as':_0x4536('0x73')}]})['then'](function(_0x35c094){_0x574c8a['id']=_0x35c094['id'];return _0x574c8a;});});return Promise['all'](_0x55e433);})[_0x4536('0x20')](function(_0x45ac83){if(_0x5d1986[_0x4536('0x60')][_0x4536('0x2a')]===_0x4536('0x32'))return _0x45ac83;if(_0x5d1986[_0x4536('0x32')][_0x4536('0x2a')]!=='user')return _0x45ac83;var _0x4d48a8=_[_0x4536('0x8d')](_0x45ac83,function(_0x21574e){return _0x21574e[_0x4536('0x2a')]===_0x4536('0x2b')||_0x21574e[_0x4536('0x2a')]===_0x4536('0x34');});if(!_0x4d48a8)return _0x45ac83;return db['UserProfileSection'][_0x4536('0x8e')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x5d1986['user'][_0x4536('0x88')]},'raw':!![]})['then'](function(_0x5ac7de){if(_[_0x4536('0x8f')](_0x5ac7de)||!_['some'](_0x5ac7de,[_0x4536('0x90'),0x0]))return _0x45ac83;_0x55e433=[];var _0x16cf45=_(_0x5ac7de)[_0x4536('0x37')](function(_0x10b6aa){if(_0x10b6aa[_0x4536('0x90')]===0x1)return;return _0x10b6aa[_0x4536('0x3b')]==='Agents'?_0x4536('0x2b'):_0x4536('0x34');})[_0x4536('0x91')]()[_0x4536('0x38')]();for(var _0x585be6=0x0;_0x585be6<_0x45ac83[_0x4536('0x52')];_0x585be6++){if(!_[_0x4536('0x4e')](_0x16cf45,_0x45ac83[_0x585be6][_0x4536('0x2a')]))return;var _0x10ec78=_0x45ac83[_0x585be6]['role']===_0x4536('0x2b')?_0x4536('0x33'):_0x4536('0x89');_0x55e433['push'](db['UserProfileResource']['create']({'name':_0x45ac83[_0x585be6]['name'],'resourceId':_0x45ac83[_0x585be6]['id'],'type':_0x10ec78,'sectionId':_[_0x4536('0x39')](_0x5ac7de,[_0x4536('0x3b'),_0x10ec78])['id']},{}));}return Promise[_0x4536('0x5f')](_0x55e433);});})[_0x4536('0x20')](respondWithResult(_0x2069dd,0xc9))[_0x4536('0x5a')](handleError(_0x2069dd,null));};exports[_0x4536('0x92')]=function(_0x2df01f,_0x555b33){if(_0x2df01f[_0x4536('0x60')]['id']){delete _0x2df01f[_0x4536('0x60')]['id'];}return db[_0x4536('0x3d')]['find']({'where':{'id':_0x2df01f[_0x4536('0x5c')]['id']}})[_0x4536('0x20')](function(_0x1624a1){if(!_0x1624a1)return null;if(_0x1624a1['id']===_0x2df01f[_0x4536('0x32')]['id']){if(!_0x2df01f['body'][_0x4536('0x93')]||!_0x2df01f[_0x4536('0x60')][_0x4536('0x94')]){throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))](_0x4536('0x97'));}if(!_0x1624a1[_0x4536('0x98')](_0x2df01f[_0x4536('0x60')][_0x4536('0x93')])){throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))]('Wrong\x20credentials');}if(_0x2df01f[_0x4536('0x60')][_0x4536('0x93')]===_0x2df01f[_0x4536('0x60')][_0x4536('0x94')]){throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))](_0x4536('0x99'));}}else if(_0x2df01f[_0x4536('0x32')][_0x4536('0x2a')]===_0x4536('0x30')){if(!_0x2df01f[_0x4536('0x60')][_0x4536('0x94')]){throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))](_0x4536('0x9a'));}}else if(_0x2df01f[_0x4536('0x32')]['role']===_0x4536('0x32')){if(!_0x2df01f['body'][_0x4536('0x94')]){throw new db[(_0x4536('0x95'))]['ValidationError'](_0x4536('0x9a'));}if(_0x1624a1[_0x4536('0x2a')]!=='agent'){throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))](_0x4536('0x84'));}}else{throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))](_0x4536('0x84'));}return _0x1624a1;})[_0x4536('0x20')](handleEntityNotFound(_0x555b33,null))[_0x4536('0x20')](function(_0x2497c2){return db[_0x4536('0x65')][_0x4536('0x9b')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x4536('0x9c')]})[_0x4536('0x20')](function(_0x2db39f){if(_0x2db39f['securePassword'])authService[_0x4536('0x68')](_0x2df01f['body'][_0x4536('0x94')]);if(!_0x2db39f[_0x4536('0x9d')]||!_0x2497c2[_0x4536('0x42')])return _0x2497c2;authService[_0x4536('0x9e')](_0x2df01f[_0x4536('0x60')][_0x4536('0x94')],_0x2497c2[_0x4536('0x42')],_0x2db39f[_0x4536('0x9c')]);return _0x2497c2;})['then'](saveUpdates({'password':_0x2df01f[_0x4536('0x60')][_0x4536('0x94')],'passwordResetAt':_0x2df01f[_0x4536('0x32')]['id']==_0x2df01f['params']['id']?moment():null,'previousPasswords':authService[_0x4536('0x9f')](_0x2df01f['body'][_0x4536('0x94')],_0x2497c2[_0x4536('0x42')])},null));})[_0x4536('0x20')](respondWithResult(_0x555b33,null))[_0x4536('0x5a')](handleError(_0x555b33,null));};exports['addQueues']=function(_0xa2a7bc,_0x459623){var _0x113f1a=_0xa2a7bc[_0x4536('0x60')][_0x4536('0xa0')];return db[_0x4536('0x3d')]['find']({'where':{'id':_0xa2a7bc['params']['id']},'attributes':['id',_0x4536('0x3b'),_0x4536('0x2a'),_0x4536('0xa1'),'loginInPause',_0x4536('0xa2'),'interface']})[_0x4536('0x20')](handleEntityNotFound(_0x459623,null))[_0x4536('0x20')](function(_0x361bd9){if(_0x361bd9){if(!utils[_0x4536('0xa3')](_0x113f1a)){throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))](_0x4536('0xa4'));}return _0x361bd9[_0x4536('0xa5')+_[_0x4536('0xa6')](_0x113f1a[_0x4536('0xa7')]())+'Queues'](_0xa2a7bc[_0x4536('0x60')][_0x4536('0x63')],{'penalty':_0xa2a7bc[_0x4536('0x60')][_0x4536('0xa8')]||0x0})[_0x4536('0xa9')](function(_0x2eb3e9){for(var _0x1c2725=0x0;_0x1c2725<_0xa2a7bc[_0x4536('0x60')]['ids'][_0x4536('0x52')];_0x1c2725+=0x1){var _0x37c3d2={'UserId':Number(_0xa2a7bc[_0x4536('0x5c')]['id'])};_0x37c3d2[_[_0x4536('0xa6')](_0x113f1a[_0x4536('0xa7')]())+_0x4536('0xaa')]=Number(_0xa2a7bc['body']['ids'][_0x1c2725]);socket[_0x4536('0x2c')](_0x4536('0x32')+_[_0x4536('0xa6')](_0x113f1a['toLowerCase']())+_0x4536('0xab'),_0x37c3d2);}return _0x2eb3e9;})[_0x4536('0x20')](function(){if(_0x113f1a===_0x4536('0xac')){return db[_0x4536('0xad')][_0x4536('0x8e')]({'where':{'id':_0xa2a7bc[_0x4536('0x60')]['ids']||[]},'raw':!![],'attributes':['id',_0x4536('0x3b')]});}})[_0x4536('0x20')](function(_0x2ee749){var _0x5748ba=_0x361bd9[_0x4536('0x2f')]({'plain':!![]});var _0x286e98=[];if(_0x113f1a===_0x4536('0xac')&&_0x5748ba[_0x4536('0x2a')]===_0x4536('0x2b')&&_0x5748ba[_0x4536('0xa1')]){for(let _0x30d067=0x0;_0x30d067<_0x2ee749['length'];_0x30d067+=0x1){_0x286e98[_0x4536('0x50')]({'membername':_0x5748ba[_0x4536('0x3b')],'UserId':_0x5748ba['id'],'queue_name':_0x2ee749[_0x30d067][_0x4536('0x3b')],'VoiceQueueId':_0x2ee749[_0x30d067]['id'],'interface':_['isNil'](_0x5748ba[_0x4536('0xae')])?util[_0x4536('0xaf')]('SIP/%s',_0x5748ba[_0x4536('0x3b')]):_0x5748ba[_0x4536('0xae')],'paused':_0x5748ba[_0x4536('0xa2')]||![],'penalty':_0xa2a7bc[_0x4536('0x60')][_0x4536('0xa8')]||0x0});}return Promise[_0x4536('0x5f')](_0x286e98['map'](function(_0x5ebc47){return db[_0x4536('0xb0')][_0x4536('0xb1')](_0x5ebc47);}));}return _0x361bd9;});}})['then'](respondWithStatusCode(_0x459623,null))[_0x4536('0x5a')](handleError(_0x459623,null));};exports[_0x4536('0xb2')]=function(_0x35ef3c,_0x4e4847){var _0xc430c1,_0xd2f80d;return db['User'][_0x4536('0x39')]({'where':{'id':_0x35ef3c[_0x4536('0x5c')]['id']},'attributes':['id','name',_0x4536('0x2a')]})[_0x4536('0x20')](handleEntityNotFound(_0x4e4847,null))[_0x4536('0x20')](function(_0x3a116a){if(_0x3a116a){_0xc430c1=_0x3a116a;if(!_0x35ef3c['query']['channel']||!utils['isValidChannel'](_0x35ef3c['query'][_0x4536('0xa0')])){throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))](_0x4536('0xa4'));}return _0x3a116a[_0x4536('0xb3')+_['capitalize'](_0x35ef3c[_0x4536('0x48')][_0x4536('0xa0')]['toLowerCase']())+_0x4536('0xb4')](_0x35ef3c['query']['ids']);}})[_0x4536('0x20')](function(_0x5e70dd){if(_[_0x4536('0xb5')](_0x35ef3c['query'][_0x4536('0x63')])){for(var _0x27676d=0x0;_0x27676d<_0x35ef3c[_0x4536('0x48')][_0x4536('0x63')]['length'];_0x27676d+=0x1){_0xd2f80d={'UserId':Number(_0x35ef3c[_0x4536('0x5c')]['id'])};_0xd2f80d[_[_0x4536('0xa6')](_0x35ef3c[_0x4536('0x48')]['channel'][_0x4536('0xa7')]())+'QueueId']=Number(_0x35ef3c[_0x4536('0x48')]['ids'][_0x27676d]);socket[_0x4536('0x2c')](_0x4536('0x32')+_[_0x4536('0xa6')](_0x35ef3c[_0x4536('0x48')][_0x4536('0xa0')][_0x4536('0xa7')]())+_0x4536('0xb6'),_0xd2f80d);}}else{_0xd2f80d={'UserId':Number(_0x35ef3c[_0x4536('0x5c')]['id'])};_0xd2f80d[_[_0x4536('0xa6')](_0x35ef3c[_0x4536('0x48')][_0x4536('0xa0')]['toLowerCase']())+_0x4536('0xaa')]=Number(_0x35ef3c[_0x4536('0x48')][_0x4536('0x63')]);socket['emit'](_0x4536('0x32')+_[_0x4536('0xa6')](_0x35ef3c[_0x4536('0x48')][_0x4536('0xa0')]['toLowerCase']())+'Queue:remove',_0xd2f80d);}return _0x5e70dd;})[_0x4536('0x20')](function(){if(_0x35ef3c[_0x4536('0x48')][_0x4536('0xa0')]===_0x4536('0xac')){return db[_0x4536('0xb0')][_0x4536('0x2e')]({'where':{'UserId':_0x35ef3c[_0x4536('0x5c')]['id'],'VoiceQueueId':_0x35ef3c['query'][_0x4536('0x63')]},'individualHooks':!![]})['then'](function(){return _0xc430c1;});}return _0xc430c1;})[_0x4536('0x20')](respondWithStatusCode(_0x4e4847,null))[_0x4536('0x5a')](handleError(_0x4e4847,null));};exports[_0x4536('0xb7')]=function(_0xf454f5,_0x55bcc8){_0xf454f5['body'][_0x4536('0xb8')]=_0xf454f5[_0x4536('0xb9')][_0x4536('0xba')];return db['User']['find']({'where':{'id':_0xf454f5[_0x4536('0x5c')]['id']}})['then'](handleEntityNotFound(_0x55bcc8,null))[_0x4536('0x20')](saveUpdates(_0xf454f5['body'],null))[_0x4536('0x20')](respondWithResult(_0x55bcc8,null))['catch'](handleError(_0x55bcc8,null));};exports['getAvatar']=function(_0x3c5255,_0x84f10f){var _0x3d314b=path[_0x4536('0xbb')](config[_0x4536('0xbc')],_0x4536('0xbd'));return db['User'][_0x4536('0x39')]({'where':{'id':_0x3c5255[_0x4536('0x5c')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x4536('0x20')](handleEntityNotFound(_0x84f10f,null))[_0x4536('0x20')](function(_0x377fc1){if(_0x377fc1){if(_['isNil'](_0x377fc1[_0x4536('0xb8')])){return _0x84f10f[_0x4536('0xbe')](_0x3d314b);}else{if(!fs[_0x4536('0xbf')](path[_0x4536('0xbb')](config[_0x4536('0xbc')],'server/files/images/',_0x377fc1[_0x4536('0xb8')]))){return _0x84f10f['download'](_0x3d314b);}return _0x84f10f[_0x4536('0xbe')](path[_0x4536('0xbb')](config['root'],_0x4536('0xc0'),_0x377fc1['userpic']));}}})[_0x4536('0x5a')](handleError(_0x84f10f,null));};exports[_0x4536('0xc1')]=function(_0x3598ec,_0x3a1381){return db[_0x4536('0x3d')]['find']({'where':{'id':_0x3598ec[_0x4536('0x5c')]['id']},'attributes':['id']})[_0x4536('0x20')](handleEntityNotFound(_0x3a1381,null))[_0x4536('0x20')](function(_0x1bc817){var _0x1cbbc8=[];values=_0x1bc817[_0x4536('0x54')];_0x1cbbc8[_0x4536('0x50')](get_open_tabs(_0x4536('0x53'),_0x1bc817[_0x4536('0x54')]));_0x1cbbc8[_0x4536('0x50')](get_open_tabs(_0x4536('0x55'),_0x1bc817[_0x4536('0x54')]));_0x1cbbc8[_0x4536('0x50')](get_open_tabs(_0x4536('0x58'),_0x1bc817['dataValues']));_0x1cbbc8[_0x4536('0x50')](get_open_tabs(_0x4536('0x59'),_0x1bc817[_0x4536('0x54')]));_0x1cbbc8[_0x4536('0x50')](get_open_tabs(_0x4536('0x56'),_0x1bc817[_0x4536('0x54')]));_0x1cbbc8[_0x4536('0x50')](get_open_tabs(_0x4536('0x57'),_0x1bc817[_0x4536('0x54')]));return Promise[_0x4536('0x5f')](_0x1cbbc8);})['then'](function(_0x4b0841){if(_0x4b0841){var _0x3943e1=_[_0x4536('0x37')](values[_0x4536('0xc2')],function(_0x14ba02){return{'channel':_0x4536('0xc3'),'id':_0x14ba02['id'],'createdAt':_0x14ba02[_0x4536('0xc4')]};});var _0x5cc9c5=_['map'](values[_0x4536('0xc5')],function(_0x3a48da){return{'channel':_0x4536('0xc6'),'id':_0x3a48da['id'],'createdAt':_0x3a48da['createdAt']};});var _0x2b349d=_[_0x4536('0x37')](values[_0x4536('0xc7')],function(_0x31421d){return{'channel':'OPENCHANNEL','id':_0x31421d['id'],'createdAt':_0x31421d[_0x4536('0xc4')]};});var _0x38f07a=_[_0x4536('0x37')](values[_0x4536('0xc8')],function(_0x531746){return{'channel':_0x4536('0xc9'),'id':_0x531746['id'],'createdAt':_0x531746['createdAt']};});var _0x58e174=_[_0x4536('0x37')](values[_0x4536('0xca')],function(_0x68fc75){return{'channel':_0x4536('0xcb'),'id':_0x68fc75['id'],'createdAt':_0x68fc75['createdAt']};});var _0x2af5df=_[_0x4536('0x37')](values[_0x4536('0xcc')],function(_0x493c56){return{'channel':_0x4536('0xcd'),'id':_0x493c56['id'],'createdAt':_0x493c56[_0x4536('0xc4')]};});var _0x2e0672=_[_0x4536('0xce')](_0x3943e1,_0x5cc9c5,_0x2b349d,_0x38f07a,_0x58e174,_0x2af5df);var _0x2dd879={'count':_0x2e0672[_0x4536('0x52')],'rows':_0x2e0672};return _0x2dd879;}else return null;})[_0x4536('0x20')](respondWithResult(_0x3a1381,null))['catch'](handleError(_0x3a1381,null));};exports[_0x4536('0xcf')]=function(_0x40da16,_0x2f9703){var _0x237224={};return db[_0x4536('0x3d')][_0x4536('0x9b')]({'where':{'id':_0x40da16[_0x4536('0x5c')]['id']}})['then'](function(_0x1289cc){if(!_0x1289cc){throw new APINotFoundError(util[_0x4536('0xaf')](_0x4536('0xd0'),_0x40da16['params']['id']));}return contacts[_0x4536('0x61')]();})[_0x4536('0x20')](function(_0xd3a7a){_0x40da16['query'][_0x4536('0x3d')]=_0x40da16[_0x4536('0x5c')]['id'];_0x237224=qs[_0x4536('0x46')](_0xd3a7a,_0x40da16);if(_0x40da16[_0x4536('0x48')][_0x4536('0xd1')](_0x4536('0x49'))){_0x237224[_0x4536('0x4c')]=[{'model':db[_0x4536('0xd2')],'as':_0x4536('0xd3'),'required':![]},{'model':db['Tag'],'as':_0x4536('0xd4'),'attributes':['id','name',_0x4536('0xd5')],'where':_0x40da16[_0x4536('0x48')][_0x4536('0xd6')]?{'id':_0x40da16[_0x4536('0x48')]['tag']}:undefined,'required':_0x40da16['query'][_0x4536('0xd6')]?!![]:![]}];}return contacts[_0x4536('0x8e')](_0x40da16[_0x4536('0x48')],_0x40da16[_0x4536('0x32')],_0x237224,_0xd3a7a);})[_0x4536('0x20')](respondWithFilteredResult(_0x2f9703,_0x237224))[_0x4536('0x5a')](APIHandleError(_0x2f9703));};exports['getQueues']=function(_0x5984e7,_0x4f8971){var _0x4a30bf;var _0x583730={};var _0x3ad784;return db['User']['findOne']({'where':{'id':_0x5984e7[_0x4536('0x5c')]['id']},'attributes':['id',_0x4536('0x3b'),_0x4536('0x2a')]})[_0x4536('0x20')](handleEntityNotFound(_0x4f8971,null))[_0x4536('0x20')](function(_0x338462){if(!utils[_0x4536('0xa3')](_0x5984e7['query']['channel'])){throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))](_0x4536('0xa4'));}_0x4a30bf=_0x338462;var _0x3e3153={};_0x3e3153[_0x4536('0xd7')]=_[_0x4536('0xd8')](db[_[_0x4536('0xa6')](_0x5984e7[_0x4536('0x48')][_0x4536('0xa0')])+_0x4536('0xd9')]['rawAttributes']);_0x3e3153[_0x4536('0x48')]=_[_0x4536('0xd8')](_0x5984e7['query']);_0x3e3153[_0x4536('0xda')]=_[_0x4536('0xdb')](_0x3e3153['model'],_0x3e3153[_0x4536('0x48')]);_0x583730['attributes']=_[_0x4536('0xdb')](_0x3e3153[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0x5984e7[_0x4536('0x48')][_0x4536('0xdc')]));_0x583730['attributes']=_0x583730[_0x4536('0x4f')][_0x4536('0x52')]?_0x583730[_0x4536('0x4f')]:_0x3e3153[_0x4536('0xd7')];_0x583730[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0x5984e7[_0x4536('0x48')][_0x4536('0xde')]);_0x583730[_0x4536('0x47')]=qs[_0x4536('0xda')](_[_0x4536('0xdf')](_0x5984e7[_0x4536('0x48')],_0x3e3153[_0x4536('0xda')]));if(_0x5984e7[_0x4536('0x48')]['filter']){_0x583730[_0x4536('0x47')]=_[_0x4536('0xe0')](_0x583730[_0x4536('0x47')],{'$or':_[_0x4536('0x37')](_0x583730[_0x4536('0x4f')],function(_0x49838f){var _0x316295={};_0x316295[_0x49838f]={'$like':'%'+_0x5984e7[_0x4536('0x48')][_0x4536('0x35')]+'%'};return _0x316295;})});}_0x583730=_['merge']({},_0x583730,_0x5984e7[_0x4536('0x5d')]);switch(_0x4a30bf[_0x4536('0x2a')]){case _0x4536('0x30'):return db[_[_0x4536('0xa6')](_0x5984e7['query'][_0x4536('0xa0')])+_0x4536('0xd9')]['findAll'](_0x583730);case _0x4536('0x32'):case _0x4536('0x2b'):return _0x4a30bf[_0x4536('0x2f')+_[_0x4536('0xa6')](_0x5984e7[_0x4536('0x48')]['channel'])+_0x4536('0xb4')](_0x583730);default:throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))](_0x4536('0xe1'));}})[_0x4536('0x20')](function(_0x41e3d5){_0x3ad784=_0x41e3d5['length'];if(!_0x5984e7[_0x4536('0x48')][_0x4536('0xd1')](_0x4536('0xe2'))){_0x583730[_0x4536('0x1b')]=qs[_0x4536('0x1b')](_0x5984e7[_0x4536('0x48')][_0x4536('0x1b')]);_0x583730[_0x4536('0x1d')]=qs[_0x4536('0x1d')](_0x5984e7[_0x4536('0x48')][_0x4536('0x1d')]);}switch(_0x4a30bf[_0x4536('0x2a')]){case _0x4536('0x30'):return db[_['capitalize'](_0x5984e7['query']['channel'])+'Queue'][_0x4536('0x8e')](_0x583730);case _0x4536('0x32'):case _0x4536('0x2b'):return _0x4a30bf['get'+_['capitalize'](_0x5984e7[_0x4536('0x48')][_0x4536('0xa0')])+'Queues'](_0x583730);}})['then'](function(_0x305049){return{'count':_0x3ad784,'rows':_0x305049};})[_0x4536('0x20')](respondWithResult(_0x4f8971,null))['catch'](handleError(_0x4f8971,null));};exports['getVoiceQueuesRt']=function(_0x137102,_0xb6f907){var _0x4cab48={};var _0x18bf1f={};var _0x3f3a47;var _0x36e877;return db[_0x4536('0x3d')][_0x4536('0x9b')]({'where':{'id':_0x137102['params']['id']}})[_0x4536('0x20')](handleEntityNotFound(_0xb6f907,null))[_0x4536('0x20')](function(_0x4cdad4){if(_0x4cdad4){_0x3f3a47=_0x4cdad4;_0x18bf1f['model']=_['keys'](db[_0x4536('0xb0')][_0x4536('0xe3')]);_0x18bf1f[_0x4536('0x48')]=_['keys'](_0x137102['query']);_0x18bf1f[_0x4536('0xda')]=_[_0x4536('0xdb')](_0x18bf1f[_0x4536('0xd7')],_0x18bf1f[_0x4536('0x48')]);_0x4cab48[_0x4536('0x4f')]=_['intersection'](_0x18bf1f['model'],qs[_0x4536('0xdc')](_0x137102[_0x4536('0x48')]['fields']));_0x4cab48[_0x4536('0x4f')]=_0x4cab48[_0x4536('0x4f')][_0x4536('0x52')]?_0x4cab48[_0x4536('0x4f')]:_0x18bf1f['model'];_0x4cab48[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0x137102['query']['sort']);_0x4cab48[_0x4536('0x47')]=qs[_0x4536('0xda')](_[_0x4536('0xdf')](_0x137102['query'],_0x18bf1f[_0x4536('0xda')]));if(_0x137102[_0x4536('0x48')][_0x4536('0x35')]){_0x4cab48[_0x4536('0x47')]=_[_0x4536('0xe0')](_0x4cab48['where'],{'$or':_[_0x4536('0x37')](_0x4cab48[_0x4536('0x4f')],function(_0x588c97){var _0x54aff2={};_0x54aff2[_0x588c97]={'$like':'%'+_0x137102[_0x4536('0x48')][_0x4536('0x35')]+'%'};return _0x54aff2;})});}_0x4cab48=_[_0x4536('0xe0')]({},_0x4cab48,_0x137102[_0x4536('0x5d')]);return _0x3f3a47[_0x4536('0xe4')](_0x4cab48);}})[_0x4536('0x20')](function(_0x516ba1){if(_0x516ba1){_0x36e877=_0x516ba1[_0x4536('0x52')];if(!_0x137102[_0x4536('0x48')][_0x4536('0xd1')](_0x4536('0xe2'))){_0x4cab48[_0x4536('0x1b')]=qs['limit'](_0x137102['query'][_0x4536('0x1b')]);_0x4cab48[_0x4536('0x1d')]=qs['offset'](_0x137102[_0x4536('0x48')][_0x4536('0x1d')]);}return _0x3f3a47['getVoiceQueuesRt'](_0x4cab48);}})[_0x4536('0x20')](function(_0x41d014){if(_0x41d014){return _0x41d014?{'count':_0x36e877,'rows':_0x41d014}:null;}})['then'](respondWithResult(_0xb6f907,null))[_0x4536('0x5a')](handleError(_0xb6f907,null));};exports[_0x4536('0xe5')]=function(_0xe7acc4,_0x3598b8){var _0x451dee={};var _0x712b85={};var _0x190302;var _0x595689;return db[_0x4536('0x3d')][_0x4536('0x9b')]({'where':{'id':_0xe7acc4[_0x4536('0x5c')]['id']}})[_0x4536('0x20')](handleEntityNotFound(_0x3598b8,null))[_0x4536('0x20')](function(_0x59264e){if(_0x59264e){_0x190302=_0x59264e;_0x712b85[_0x4536('0xd7')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x712b85[_0x4536('0x48')]=_['keys'](_0xe7acc4[_0x4536('0x48')]);_0x712b85[_0x4536('0xda')]=_[_0x4536('0xdb')](_0x712b85[_0x4536('0xd7')],_0x712b85[_0x4536('0x48')]);_0x451dee[_0x4536('0x4f')]=_[_0x4536('0xdb')](_0x712b85[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0xe7acc4[_0x4536('0x48')]['fields']));_0x451dee[_0x4536('0x4f')]=_0x451dee['attributes'][_0x4536('0x52')]?_0x451dee[_0x4536('0x4f')]:_0x712b85[_0x4536('0xd7')];_0x451dee[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0xe7acc4['query'][_0x4536('0xde')]);_0x451dee['where']=qs[_0x4536('0xda')](_['pick'](_0xe7acc4['query'],_0x712b85['filters']));if(_0xe7acc4[_0x4536('0x48')][_0x4536('0x35')]){_0x451dee['where']=_[_0x4536('0xe0')](_0x451dee['where'],{'$or':_[_0x4536('0x37')](_0x451dee['attributes'],function(_0xacacc6){var _0x4c7150={};_0x4c7150[_0xacacc6]={'$like':'%'+_0xe7acc4[_0x4536('0x48')]['filter']+'%'};return _0x4c7150;})});}_0x451dee=_[_0x4536('0xe0')]({},_0x451dee,_0xe7acc4['options']);return _0x190302[_0x4536('0xe5')](_0x451dee);}})['then'](function(_0x44f85f){if(_0x44f85f){_0x595689=_0x44f85f['length'];if(!_0xe7acc4['query'][_0x4536('0xd1')](_0x4536('0xe2'))){_0x451dee['limit']=qs[_0x4536('0x1b')](_0xe7acc4[_0x4536('0x48')][_0x4536('0x1b')]);_0x451dee[_0x4536('0x1d')]=qs[_0x4536('0x1d')](_0xe7acc4[_0x4536('0x48')][_0x4536('0x1d')]);}return _0x190302['getGroups'](_0x451dee);}})['then'](function(_0x2f2f71){if(_0x2f2f71){return _0x2f2f71?{'count':_0x595689,'rows':_0x2f2f71}:null;}})[_0x4536('0x20')](respondWithResult(_0x3598b8,null))[_0x4536('0x5a')](handleError(_0x3598b8,null));};exports['getRecordings']=function(_0x8e63fd,_0x1d3e07){var _0x4e3f5c={'raw':!![],'where':{}};var _0x64ce74={};var _0x54fe89={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x8e63fd['params']['id']}})['then'](handleEntityNotFound(_0x1d3e07,null))[_0x4536('0x20')](function(_0x593010){if(_0x593010){_0x64ce74['model']=_[_0x4536('0xd8')](db[_0x4536('0xe6')][_0x4536('0xe3')]);_0x64ce74[_0x4536('0x48')]=_['keys'](_0x8e63fd[_0x4536('0x48')]);_0x64ce74['filters']=_['intersection'](_0x64ce74[_0x4536('0xd7')],_0x64ce74[_0x4536('0x48')]);_0x4e3f5c['attributes']=_[_0x4536('0xdb')](_0x64ce74[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0x8e63fd[_0x4536('0x48')]['fields']));_0x4e3f5c[_0x4536('0x4f')]=_0x4e3f5c['attributes']['length']?_0x4e3f5c[_0x4536('0x4f')]:_0x64ce74[_0x4536('0xd7')];if(!_0x8e63fd[_0x4536('0x48')][_0x4536('0xd1')]('nolimit')){_0x4e3f5c[_0x4536('0x1b')]=qs[_0x4536('0x1b')](_0x8e63fd['query'][_0x4536('0x1b')]);_0x4e3f5c[_0x4536('0x1d')]=qs[_0x4536('0x1d')](_0x8e63fd[_0x4536('0x48')][_0x4536('0x1d')]);}_0x4e3f5c[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0x8e63fd[_0x4536('0x48')][_0x4536('0xde')]);_0x4e3f5c[_0x4536('0x47')]=qs[_0x4536('0xda')](_['pick'](_0x8e63fd['query'],_0x64ce74[_0x4536('0xda')]));_0x4e3f5c[_0x4536('0x47')][_0x4536('0xe7')]=_0x593010['id'];if(_0x8e63fd[_0x4536('0x48')]['filter']){_0x4e3f5c[_0x4536('0x47')]=_[_0x4536('0xe0')](_0x4e3f5c[_0x4536('0x47')],{'$or':_[_0x4536('0x37')](_0x4e3f5c[_0x4536('0x4f')],function(_0x4789bc){var _0x9594f0={};_0x9594f0[_0x4789bc]={'$like':'%'+_0x8e63fd['query']['filter']+'%'};return _0x9594f0;})});}_0x4e3f5c=_[_0x4536('0xe0')]({},_0x4e3f5c,_0x8e63fd[_0x4536('0x5d')]);return db[_0x4536('0xe6')][_0x4536('0x1c')]({'where':_0x4e3f5c['where']})['then'](function(_0x5f38af){_0x54fe89['count']=_0x5f38af;if(_0x8e63fd['query'][_0x4536('0x49')]){_0x4e3f5c['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x4e3f5c);})['then'](function(_0x120dcd){_0x54fe89[_0x4536('0x51')]=_0x120dcd;return _0x54fe89;});}})[_0x4536('0x20')](respondWithFilteredResult(_0x1d3e07,_0x4e3f5c))[_0x4536('0x5a')](handleError(_0x1d3e07,null));};exports[_0x4536('0xe8')]=function(_0x2aaa84,_0x54af2d){var _0x4721e4={'raw':!![],'where':{}};var _0xceef2e={};var _0x25f413={'count':0x0,'rows':[]};return db[_0x4536('0x3d')][_0x4536('0x9b')]({'where':{'id':_0x2aaa84[_0x4536('0x5c')]['id']}})['then'](handleEntityNotFound(_0x54af2d,null))['then'](function(_0xeafd0f){if(_0xeafd0f){_0xceef2e[_0x4536('0xd7')]=_[_0x4536('0xd8')](db[_0x4536('0xe9')]['rawAttributes']);_0xceef2e[_0x4536('0x48')]=_[_0x4536('0xd8')](_0x2aaa84[_0x4536('0x48')]);_0xceef2e[_0x4536('0xda')]=_[_0x4536('0xdb')](_0xceef2e[_0x4536('0xd7')],_0xceef2e[_0x4536('0x48')]);_0x4721e4[_0x4536('0x4f')]=_['intersection'](_0xceef2e[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0x2aaa84[_0x4536('0x48')][_0x4536('0xdc')]));_0x4721e4[_0x4536('0x4f')]=_0x4721e4[_0x4536('0x4f')][_0x4536('0x52')]?_0x4721e4[_0x4536('0x4f')]:_0xceef2e[_0x4536('0xd7')];if(!_0x2aaa84[_0x4536('0x48')][_0x4536('0xd1')]('nolimit')){_0x4721e4['limit']=qs[_0x4536('0x1b')](_0x2aaa84['query'][_0x4536('0x1b')]);_0x4721e4[_0x4536('0x1d')]=qs[_0x4536('0x1d')](_0x2aaa84[_0x4536('0x48')][_0x4536('0x1d')]);}_0x4721e4['order']=qs[_0x4536('0xde')](_0x2aaa84[_0x4536('0x48')][_0x4536('0xde')]);_0x4721e4[_0x4536('0x47')]=qs[_0x4536('0xda')](_['pick'](_0x2aaa84[_0x4536('0x48')],_0xceef2e['filters']));_0x4721e4['where']['UserId']=_0xeafd0f['id'];if(_0x2aaa84[_0x4536('0x48')][_0x4536('0x35')]){_0x4721e4[_0x4536('0x47')]=_['merge'](_0x4721e4[_0x4536('0x47')],{'$or':_['map'](_0x4721e4[_0x4536('0x4f')],function(_0xd3eee8){var _0x574d6c={};_0x574d6c[_0xd3eee8]={'$like':'%'+_0x2aaa84['query'][_0x4536('0x35')]+'%'};return _0x574d6c;})});}_0x4721e4=_[_0x4536('0xe0')]({},_0x4721e4,_0x2aaa84[_0x4536('0x5d')]);return db['ScreenRecording'][_0x4536('0x1c')]({'where':_0x4721e4[_0x4536('0x47')]})[_0x4536('0x20')](function(_0x157ed5){_0x25f413[_0x4536('0x1c')]=_0x157ed5;if(_0x2aaa84[_0x4536('0x48')][_0x4536('0x49')]){_0x4721e4[_0x4536('0x4c')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4536('0x8e')](_0x4721e4);})[_0x4536('0x20')](function(_0x4a6cf4){_0x25f413[_0x4536('0x51')]=_0x4a6cf4;return _0x25f413;});}})[_0x4536('0x20')](respondWithFilteredResult(_0x54af2d,_0x4721e4))[_0x4536('0x5a')](handleError(_0x54af2d,null));};exports[_0x4536('0xea')]=function(_0x1f2a8d,_0x448ce2){var _0x226b19={};var _0x1e4f0d={};var _0x78f91f;var _0x4502aa;return db[_0x4536('0x3d')]['findOne']({'where':{'id':_0x1f2a8d[_0x4536('0x5c')]['id']}})[_0x4536('0x20')](handleEntityNotFound(_0x448ce2,null))[_0x4536('0x20')](function(_0x420bc6){if(_0x420bc6){_0x78f91f=_0x420bc6;_0x1e4f0d[_0x4536('0xd7')]=_[_0x4536('0xd8')](db[_0x4536('0xeb')][_0x4536('0xe3')]);_0x1e4f0d[_0x4536('0x48')]=_[_0x4536('0xd8')](_0x1f2a8d[_0x4536('0x48')]);_0x1e4f0d[_0x4536('0xda')]=_['intersection'](_0x1e4f0d['model'],_0x1e4f0d[_0x4536('0x48')]);_0x226b19[_0x4536('0x4f')]=_[_0x4536('0xdb')](_0x1e4f0d[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0x1f2a8d[_0x4536('0x48')][_0x4536('0xdc')]));_0x226b19[_0x4536('0x4f')]=_0x226b19['attributes'][_0x4536('0x52')]?_0x226b19['attributes']:_0x1e4f0d[_0x4536('0xd7')];_0x226b19[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0x1f2a8d[_0x4536('0x48')][_0x4536('0xde')]);_0x226b19[_0x4536('0x47')]=qs[_0x4536('0xda')](_[_0x4536('0xdf')](_0x1f2a8d['query'],_0x1e4f0d['filters']));if(_0x1f2a8d[_0x4536('0x48')][_0x4536('0x35')]){_0x226b19[_0x4536('0x47')]=_[_0x4536('0xe0')](_0x226b19[_0x4536('0x47')],{'$or':_['map'](_0x226b19[_0x4536('0x4f')],function(_0x3d817d){var _0x4abe70={};_0x4abe70[_0x3d817d]={'$like':'%'+_0x1f2a8d[_0x4536('0x48')][_0x4536('0x35')]+'%'};return _0x4abe70;})});}_0x226b19=_[_0x4536('0xe0')]({},_0x226b19,_0x1f2a8d[_0x4536('0x5d')]);return _0x78f91f['getChatInteractions'](_0x226b19);}})['then'](function(_0xf9942a){if(_0xf9942a){_0x4502aa=_0xf9942a[_0x4536('0x52')];if(!_0x1f2a8d[_0x4536('0x48')][_0x4536('0xd1')]('nolimit')){_0x226b19[_0x4536('0x1b')]=qs[_0x4536('0x1b')](_0x1f2a8d['query'][_0x4536('0x1b')]);_0x226b19[_0x4536('0x1d')]=qs[_0x4536('0x1d')](_0x1f2a8d[_0x4536('0x48')][_0x4536('0x1d')]);}return _0x78f91f[_0x4536('0xea')](_0x226b19);}})[_0x4536('0x20')](function(_0x4ee964){if(_0x4ee964){return _0x4ee964?{'count':_0x4502aa,'rows':_0x4ee964}:null;}})[_0x4536('0x20')](respondWithResult(_0x448ce2,null))[_0x4536('0x5a')](handleError(_0x448ce2,null));};exports[_0x4536('0xec')]=function(_0x405b5d,_0x5c13e1){var _0x335703={};var _0x27ef7e={};var _0x480c59;var _0x3570c8;return db[_0x4536('0x3d')][_0x4536('0x9b')]({'where':{'id':_0x405b5d[_0x4536('0x5c')]['id']}})[_0x4536('0x20')](handleEntityNotFound(_0x5c13e1,null))[_0x4536('0x20')](function(_0x388b6c){if(_0x388b6c){_0x480c59=_0x388b6c;_0x27ef7e[_0x4536('0xd7')]=_[_0x4536('0xd8')](db[_0x4536('0xed')][_0x4536('0xe3')]);_0x27ef7e[_0x4536('0x48')]=_[_0x4536('0xd8')](_0x405b5d[_0x4536('0x48')]);_0x27ef7e[_0x4536('0xda')]=_[_0x4536('0xdb')](_0x27ef7e[_0x4536('0xd7')],_0x27ef7e[_0x4536('0x48')]);_0x335703[_0x4536('0x4f')]=_['intersection'](_0x27ef7e[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0x405b5d['query'][_0x4536('0xdc')]));_0x335703[_0x4536('0x4f')]=_0x335703[_0x4536('0x4f')]['length']?_0x335703[_0x4536('0x4f')]:_0x27ef7e['model'];_0x335703[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0x405b5d['query'][_0x4536('0xde')]);_0x335703[_0x4536('0x47')]=qs[_0x4536('0xda')](_[_0x4536('0xdf')](_0x405b5d[_0x4536('0x48')],_0x27ef7e['filters']));if(_0x405b5d[_0x4536('0x48')][_0x4536('0x35')]){_0x335703[_0x4536('0x47')]=_[_0x4536('0xe0')](_0x335703[_0x4536('0x47')],{'$or':_[_0x4536('0x37')](_0x335703[_0x4536('0x4f')],function(_0x2b1242){var _0x11e87b={};_0x11e87b[_0x2b1242]={'$like':'%'+_0x405b5d[_0x4536('0x48')][_0x4536('0x35')]+'%'};return _0x11e87b;})});}_0x335703=_['merge']({},_0x335703,_0x405b5d['options']);return _0x480c59[_0x4536('0xec')](_0x335703);}})[_0x4536('0x20')](function(_0x27cde1){if(_0x27cde1){_0x3570c8=_0x27cde1[_0x4536('0x52')];if(!_0x405b5d[_0x4536('0x48')][_0x4536('0xd1')](_0x4536('0xe2'))){_0x335703[_0x4536('0x1b')]=qs[_0x4536('0x1b')](_0x405b5d[_0x4536('0x48')][_0x4536('0x1b')]);_0x335703['offset']=qs[_0x4536('0x1d')](_0x405b5d[_0x4536('0x48')][_0x4536('0x1d')]);}return _0x480c59['getOpenchannelInteractions'](_0x335703);}})['then'](function(_0x21fede){if(_0x21fede){return _0x21fede?{'count':_0x3570c8,'rows':_0x21fede}:null;}})[_0x4536('0x20')](respondWithResult(_0x5c13e1,null))[_0x4536('0x5a')](handleError(_0x5c13e1,null));};exports[_0x4536('0xee')]=function(_0x53be27,_0x5eceda){var _0x161859={'raw':!![],'where':{}};var _0x353b7c={};var _0x3dfa30={'count':0x0,'rows':[]};return db[_0x4536('0x3d')][_0x4536('0x9b')]({'where':{'id':_0x53be27[_0x4536('0x5c')]['id']}})[_0x4536('0x20')](handleEntityNotFound(_0x5eceda,null))[_0x4536('0x20')](function(_0x3dbe8b){if(_0x3dbe8b){_0x353b7c['model']=_[_0x4536('0xd8')](db[_0x4536('0xef')][_0x4536('0xe3')]);_0x353b7c[_0x4536('0x48')]=_[_0x4536('0xd8')](_0x53be27[_0x4536('0x48')]);_0x353b7c['filters']=_[_0x4536('0xdb')](_0x353b7c['model'],_0x353b7c['query']);_0x161859['attributes']=_[_0x4536('0xdb')](_0x353b7c[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0x53be27['query'][_0x4536('0xdc')]));_0x161859['attributes']=_0x161859[_0x4536('0x4f')][_0x4536('0x52')]?_0x161859[_0x4536('0x4f')]:_0x353b7c[_0x4536('0xd7')];if(!_0x53be27['query'][_0x4536('0xd1')](_0x4536('0xe2'))){_0x161859[_0x4536('0x1b')]=qs[_0x4536('0x1b')](_0x53be27[_0x4536('0x48')]['limit']);_0x161859[_0x4536('0x1d')]=qs[_0x4536('0x1d')](_0x53be27[_0x4536('0x48')]['offset']);}_0x161859[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0x53be27[_0x4536('0x48')][_0x4536('0xde')]);_0x161859['where']=qs[_0x4536('0xda')](_[_0x4536('0xdf')](_0x53be27['query'],_0x353b7c[_0x4536('0xda')]));_0x161859[_0x4536('0x47')][_0x4536('0xe7')]=_0x3dbe8b['id'];if(_0x53be27[_0x4536('0x48')][_0x4536('0x35')]){_0x161859[_0x4536('0x47')]=_[_0x4536('0xe0')](_0x161859[_0x4536('0x47')],{'$or':_[_0x4536('0x37')](_0x161859[_0x4536('0x4f')],function(_0x34832c){var _0x45aa87={};_0x45aa87[_0x34832c]={'$like':'%'+_0x53be27[_0x4536('0x48')][_0x4536('0x35')]+'%'};return _0x45aa87;})});}_0x161859=_[_0x4536('0xe0')]({},_0x161859,_0x53be27['options']);return db[_0x4536('0xef')][_0x4536('0x1c')]({'where':_0x161859[_0x4536('0x47')]})[_0x4536('0x20')](function(_0x39e661){_0x3dfa30['count']=_0x39e661;if(_0x53be27[_0x4536('0x48')]['includeAll']){_0x161859[_0x4536('0x4c')]=[{'all':!![]}];}return db[_0x4536('0xef')][_0x4536('0x8e')](_0x161859);})[_0x4536('0x20')](function(_0x991b85){_0x3dfa30[_0x4536('0x51')]=_0x991b85;return _0x3dfa30;});}})[_0x4536('0x20')](respondWithFilteredResult(_0x5eceda,_0x161859))['catch'](handleError(_0x5eceda,null));};exports['getSmsInteractions']=function(_0x1b8db8,_0x29c1d4){var _0x1b79bd={};var _0x109811={};var _0x4dbafd;var _0x3212b0;return db[_0x4536('0x3d')][_0x4536('0x9b')]({'where':{'id':_0x1b8db8[_0x4536('0x5c')]['id']}})[_0x4536('0x20')](handleEntityNotFound(_0x29c1d4,null))[_0x4536('0x20')](function(_0x62067b){if(_0x62067b){_0x4dbafd=_0x62067b;_0x109811['model']=_['keys'](db['SmsInteraction'][_0x4536('0xe3')]);_0x109811['query']=_[_0x4536('0xd8')](_0x1b8db8['query']);_0x109811[_0x4536('0xda')]=_[_0x4536('0xdb')](_0x109811[_0x4536('0xd7')],_0x109811['query']);_0x1b79bd[_0x4536('0x4f')]=_[_0x4536('0xdb')](_0x109811[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0x1b8db8[_0x4536('0x48')][_0x4536('0xdc')]));_0x1b79bd[_0x4536('0x4f')]=_0x1b79bd[_0x4536('0x4f')][_0x4536('0x52')]?_0x1b79bd['attributes']:_0x109811[_0x4536('0xd7')];_0x1b79bd[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0x1b8db8[_0x4536('0x48')][_0x4536('0xde')]);_0x1b79bd[_0x4536('0x47')]=qs[_0x4536('0xda')](_[_0x4536('0xdf')](_0x1b8db8[_0x4536('0x48')],_0x109811[_0x4536('0xda')]));if(_0x1b8db8[_0x4536('0x48')][_0x4536('0x35')]){_0x1b79bd[_0x4536('0x47')]=_[_0x4536('0xe0')](_0x1b79bd[_0x4536('0x47')],{'$or':_[_0x4536('0x37')](_0x1b79bd[_0x4536('0x4f')],function(_0x218b97){var _0xeffafc={};_0xeffafc[_0x218b97]={'$like':'%'+_0x1b8db8[_0x4536('0x48')][_0x4536('0x35')]+'%'};return _0xeffafc;})});}_0x1b79bd=_[_0x4536('0xe0')]({},_0x1b79bd,_0x1b8db8[_0x4536('0x5d')]);return _0x4dbafd['getSmsInteractions'](_0x1b79bd);}})[_0x4536('0x20')](function(_0x3bd162){if(_0x3bd162){_0x3212b0=_0x3bd162[_0x4536('0x52')];if(!_0x1b8db8[_0x4536('0x48')]['hasOwnProperty']('nolimit')){_0x1b79bd['limit']=qs['limit'](_0x1b8db8[_0x4536('0x48')][_0x4536('0x1b')]);_0x1b79bd[_0x4536('0x1d')]=qs['offset'](_0x1b8db8[_0x4536('0x48')]['offset']);}return _0x4dbafd[_0x4536('0xf0')](_0x1b79bd);}})['then'](function(_0x33c3ab){if(_0x33c3ab){return _0x33c3ab?{'count':_0x3212b0,'rows':_0x33c3ab}:null;}})['then'](respondWithResult(_0x29c1d4,null))['catch'](handleError(_0x29c1d4,null));};exports[_0x4536('0xf1')]=function(_0xd0d603,_0x64845b){var _0x4dc116={};var _0x22376e={};var _0x1e5863;var _0x1fca4f;return db[_0x4536('0x3d')]['findOne']({'where':{'id':_0xd0d603[_0x4536('0x5c')]['id']}})['then'](handleEntityNotFound(_0x64845b,null))[_0x4536('0x20')](function(_0x4cde64){if(_0x4cde64){_0x1e5863=_0x4cde64;_0x22376e['model']=_[_0x4536('0xd8')](db['FaxInteraction'][_0x4536('0xe3')]);_0x22376e[_0x4536('0x48')]=_[_0x4536('0xd8')](_0xd0d603[_0x4536('0x48')]);_0x22376e[_0x4536('0xda')]=_['intersection'](_0x22376e[_0x4536('0xd7')],_0x22376e[_0x4536('0x48')]);_0x4dc116[_0x4536('0x4f')]=_['intersection'](_0x22376e[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0xd0d603[_0x4536('0x48')][_0x4536('0xdc')]));_0x4dc116['attributes']=_0x4dc116[_0x4536('0x4f')][_0x4536('0x52')]?_0x4dc116[_0x4536('0x4f')]:_0x22376e['model'];_0x4dc116['order']=qs[_0x4536('0xde')](_0xd0d603[_0x4536('0x48')]['sort']);_0x4dc116[_0x4536('0x47')]=qs[_0x4536('0xda')](_[_0x4536('0xdf')](_0xd0d603[_0x4536('0x48')],_0x22376e[_0x4536('0xda')]));if(_0xd0d603[_0x4536('0x48')][_0x4536('0x35')]){_0x4dc116['where']=_[_0x4536('0xe0')](_0x4dc116[_0x4536('0x47')],{'$or':_[_0x4536('0x37')](_0x4dc116[_0x4536('0x4f')],function(_0x1db098){var _0x288d70={};_0x288d70[_0x1db098]={'$like':'%'+_0xd0d603[_0x4536('0x48')][_0x4536('0x35')]+'%'};return _0x288d70;})});}_0x4dc116=_[_0x4536('0xe0')]({},_0x4dc116,_0xd0d603['options']);return _0x1e5863['getFaxInteractions'](_0x4dc116);}})[_0x4536('0x20')](function(_0x177a1f){if(_0x177a1f){_0x1fca4f=_0x177a1f['length'];if(!_0xd0d603[_0x4536('0x48')][_0x4536('0xd1')](_0x4536('0xe2'))){_0x4dc116[_0x4536('0x1b')]=qs['limit'](_0xd0d603[_0x4536('0x48')][_0x4536('0x1b')]);_0x4dc116[_0x4536('0x1d')]=qs[_0x4536('0x1d')](_0xd0d603[_0x4536('0x48')]['offset']);}return _0x1e5863[_0x4536('0xf1')](_0x4dc116);}})[_0x4536('0x20')](function(_0x5e4915){if(_0x5e4915){return _0x5e4915?{'count':_0x1fca4f,'rows':_0x5e4915}:null;}})[_0x4536('0x20')](respondWithResult(_0x64845b,null))[_0x4536('0x5a')](handleError(_0x64845b,null));};exports[_0x4536('0xf2')]=function(_0x5dddf1,_0x50f9cf){var _0xa672fa={};var _0x4a8d9d={};var _0x4c907a;var _0x16332b;return db['User'][_0x4536('0x9b')]({'where':{'id':_0x5dddf1[_0x4536('0x5c')]['id']}})[_0x4536('0x20')](handleEntityNotFound(_0x50f9cf,null))['then'](function(_0x30af7f){if(_0x30af7f){_0x4c907a=_0x30af7f;_0x4a8d9d[_0x4536('0xd7')]=_['keys'](db[_0x4536('0xf3')]['rawAttributes']);_0x4a8d9d[_0x4536('0x48')]=_[_0x4536('0xd8')](_0x5dddf1[_0x4536('0x48')]);_0x4a8d9d[_0x4536('0xda')]=_[_0x4536('0xdb')](_0x4a8d9d[_0x4536('0xd7')],_0x4a8d9d[_0x4536('0x48')]);_0xa672fa[_0x4536('0x4f')]=_[_0x4536('0xdb')](_0x4a8d9d['model'],qs[_0x4536('0xdc')](_0x5dddf1[_0x4536('0x48')][_0x4536('0xdc')]));_0xa672fa[_0x4536('0x4f')]=_0xa672fa[_0x4536('0x4f')][_0x4536('0x52')]?_0xa672fa[_0x4536('0x4f')]:_0x4a8d9d['model'];_0xa672fa[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0x5dddf1[_0x4536('0x48')][_0x4536('0xde')]);_0xa672fa[_0x4536('0x47')]=qs[_0x4536('0xda')](_[_0x4536('0xdf')](_0x5dddf1[_0x4536('0x48')],_0x4a8d9d[_0x4536('0xda')]));if(_0x5dddf1['query'][_0x4536('0x35')]){_0xa672fa[_0x4536('0x47')]=_[_0x4536('0xe0')](_0xa672fa[_0x4536('0x47')],{'$or':_[_0x4536('0x37')](_0xa672fa[_0x4536('0x4f')],function(_0x3b5bed){var _0x11dee4={};_0x11dee4[_0x3b5bed]={'$like':'%'+_0x5dddf1['query'][_0x4536('0x35')]+'%'};return _0x11dee4;})});}_0xa672fa=_[_0x4536('0xe0')]({},_0xa672fa,_0x5dddf1[_0x4536('0x5d')]);return _0x4c907a[_0x4536('0xf2')](_0xa672fa);}})[_0x4536('0x20')](function(_0x133cde){if(_0x133cde){_0x16332b=_0x133cde[_0x4536('0x52')];if(!_0x5dddf1[_0x4536('0x48')]['hasOwnProperty']('nolimit')){_0xa672fa['limit']=qs[_0x4536('0x1b')](_0x5dddf1[_0x4536('0x48')][_0x4536('0x1b')]);_0xa672fa[_0x4536('0x1d')]=qs['offset'](_0x5dddf1[_0x4536('0x48')]['offset']);}return _0x4c907a[_0x4536('0xf2')](_0xa672fa);}})[_0x4536('0x20')](function(_0x19a09d){if(_0x19a09d){return _0x19a09d?{'count':_0x16332b,'rows':_0x19a09d}:null;}})['then'](respondWithResult(_0x50f9cf,null))['catch'](handleError(_0x50f9cf,null));};exports['login']=function(_0xdcf8ce,_0xc8aad7,_0x52a8b3){var _0x4b8bf5;var _0x1994c2;var _0x1e1533;var _0xd0558b=!_[_0x4536('0x6a')](_0xdcf8ce[_0x4536('0x5c')]['id'])?_0xdcf8ce['params']['id']:!_[_0x4536('0x6a')](_0xdcf8ce[_0x4536('0x32')]['id'])?_0xdcf8ce['user']['id']:null;return db['User'][_0x4536('0x39')]({'where':{'id':_0xd0558b,'role':{'$or':['admin',_0x4536('0x32'),_0x4536('0x2b')]}},'attributes':['id','name','phone','mobile','role','internal',_0x4536('0xf4')]})[_0x4536('0x20')](function(_0x2adf87){if(_0x2adf87){if(_0x2adf87['role']===_0x4536('0x2b')){_0x4b8bf5=_0x2adf87;if(_0xdcf8ce[_0x4536('0x60')][_0x4536('0xae')]){_0x1e1533=util['format'](_0x4536('0xf5'),_0x4b8bf5[_0xdcf8ce[_0x4536('0x60')][_0x4536('0xae')]]);}else if(_0xdcf8ce[_0x4536('0x60')][_0x4536('0xf6')]){_0x1e1533=util['format'](_0x4536('0xf7'),_0xdcf8ce[_0x4536('0x60')][_0x4536('0xf6')]);}else{_0x1e1533=util['format'](_0x4536('0xf7'),_0x4b8bf5[_0x4536('0x3b')]);}socket['to'](util[_0x4536('0xaf')](_0x4536('0xf8'),_0x4b8bf5[_0x4536('0x3b')]))[_0x4536('0x2c')]('user:forcelogout',{'user':{'id':_0x4b8bf5['id'],'name':_0x4b8bf5[_0x4536('0x3b')]},'ip':_0xdcf8ce[_0x4536('0xf9')][_0x4536('0xfa')]||_0xdcf8ce[_0x4536('0xfb')][_0x4536('0xfc')]||_0xdcf8ce[_0x4536('0xfd')][_0x4536('0xfc')]||_0xdcf8ce[_0x4536('0xfb')]['socket']['remoteAddress']});return new Promise(function(_0x363381,_0x11338d){db[_0x4536('0x6c')][_0x4536('0xfe')]()[_0x4536('0x20')](_0x51cc8f=>{db[_0x4536('0xb0')][_0x4536('0x2e')]({'where':{'membername':_0x4b8bf5[_0x4536('0x3b')]},'individualHooks':!![]},{'transaction':_0x51cc8f})[_0x4536('0x20')](function(){return _0x51cc8f[_0x4536('0xff')]();})[_0x4536('0x20')](_0x363381)[_0x4536('0x5a')](_0x11338d);});});}}else{throw new db[(_0x4536('0x95'))][(_0x4536('0x96'))](_0x4536('0x100'));}})[_0x4536('0x20')](function(){if(_0x4b8bf5){return _0x4b8bf5[_0x4536('0x101')]({'raw':!![]});}})[_0x4536('0x20')](function(_0x5192c9){if(_0x4b8bf5){if(_0x5192c9){_0x1994c2=_0x5192c9;if(_0x1994c2['length']){var _0x2f85ca=_0x1994c2['map'](function(_0x150336){return{'membername':_0x4b8bf5[_0x4536('0x3b')],'UserId':_0x4b8bf5['id'],'queue_name':_0x150336[_0x4536('0x3b')],'VoiceQueueId':_0x150336['id'],'interface':_0x1e1533,'paused':_0x4b8bf5[_0x4536('0xf4')]||![],'penalty':_0x150336[_0x4536('0x102')]||0x0};});return db[_0x4536('0xb0')][_0x4536('0x8c')](_0x2f85ca);}}}})[_0x4536('0x20')](function(){if(_0x4b8bf5){return db[_0x4536('0x103')][_0x4536('0x8e')]({'where':{'membername':_0x4b8bf5['name'],'exitAt':null}});}})[_0x4536('0x20')](function(_0x593e6b){if(_0x4b8bf5){var _0x32e38a=[];_0x593e6b['forEach'](function(_0x13d9a9){_0x32e38a[_0x4536('0x50')](_0x13d9a9[_0x4536('0x29')]({'exitAt':moment()[_0x4536('0xaf')](_0x4536('0x104'))}));});return Promise[_0x4536('0x5f')](_0x32e38a);}})[_0x4536('0x20')](function(){if(_0x4b8bf5){var _0xeb8755=[];var _0x564c41=[];var _0x1edecc=utils[_0x4536('0x105')]();var _0x858651={'membername':_0x4b8bf5[_0x4536('0x3b')],'interface':_0x1e1533,'enterAt':moment()['format'](_0x4536('0x104')),'role':_0x4b8bf5[_0x4536('0x2a')],'internal':_0x4b8bf5['internal']};_0x1edecc[_0x4536('0x106')](function(_0x1b35ed){_0xeb8755[_0x4536('0x50')](_[_0x4536('0xe0')]({'channel':_0x1b35ed,'type':_0x4536('0x107'),'data1':_0xdcf8ce[_0x4536('0x60')][_0x4536('0x108')],'data2':_0x1e1533},_0x858651));if(_0x4b8bf5[_0x4536('0xf4')]){_0x564c41['push'](_[_0x4536('0xe0')]({'channel':_0x1b35ed,'type':_0x4536('0x109'),'data1':'LOGININPAUSE'},_0x858651));}});return db[_0x4536('0x103')][_0x4536('0x8c')](_0xeb8755['concat'](_0x564c41),{'individualHooks':!![]});}})[_0x4536('0x20')](function(){if(_0x4b8bf5){return _0x4b8bf5['update']({'online':!![],'lastLoginAt':moment()['format'](_0x4536('0x104')),'voicePause':_0x4b8bf5['loginInPause']||![],'mailPause':_0x4b8bf5[_0x4536('0xf4')]||![],'chatPause':_0x4b8bf5[_0x4536('0xf4')]||![],'faxPause':_0x4b8bf5[_0x4536('0xf4')]||![],'smsPause':_0x4b8bf5[_0x4536('0xf4')]||![],'openchannelPause':_0x4b8bf5['loginInPause']||![],'whatsappPause':_0x4b8bf5[_0x4536('0xf4')]||![],'pauseType':_0x4b8bf5[_0x4536('0xf4')]?_0x4536('0x10a'):null,'interface':_0x1e1533,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x4536('0x20')](function(_0x23fb65){if(_0xdcf8ce[_0x4536('0x10b')]){return _0x52a8b3();}else{return Promise[_0x4536('0x10c')](_0x23fb65)['then'](respondWithResult(_0xc8aad7,null));}})[_0x4536('0x5a')](handleError(_0xc8aad7,null));};exports[_0x4536('0x10d')]=function(_0x1f55fe,_0x2817b9){var _0x543030;return db['User'][_0x4536('0x39')]({'where':{'id':_0x1f55fe['params']['id'],'role':_0x4536('0x2b')},'attributes':['id',_0x4536('0x3b'),'role']})[_0x4536('0x20')](handleEntityNotFound(_0x2817b9,null))['then'](function(_0x7ebd5e){if(_0x7ebd5e){_0x543030=_0x7ebd5e;return db[_0x4536('0xb0')]['destroy']({'where':{'membername':_0x543030[_0x4536('0x3b')]},'individualHooks':!![]});}})[_0x4536('0x20')](function(){return db[_0x4536('0x103')]['findAll']({'where':{'membername':_0x543030[_0x4536('0x3b')],'exitAt':null}});})['then'](function(_0x5d87f3){var _0x1d0a94=[];_0x5d87f3['forEach'](function(_0x2ab473){_0x1d0a94[_0x4536('0x50')](_0x2ab473['update']({'exitAt':moment()[_0x4536('0xaf')](_0x4536('0x104'))}));});return Promise[_0x4536('0x5f')](_0x1d0a94);})['then'](function(){return _0x543030[_0x4536('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4536('0x20')](respondWithResult(_0x2817b9,null))[_0x4536('0x5a')](handleError(_0x2817b9,null));};exports[_0x4536('0x10e')]=function(_0xd2a68d,_0x557cff){var _0x5ec308;return db[_0x4536('0xb0')]['update']({'paused':0x1},{'where':{'UserId':_0xd2a68d['params']['id']},'individualHooks':!![]})[_0x4536('0x20')](function(){return db['User'][_0x4536('0x39')]({'where':{'id':_0xd2a68d['params']['id'],'role':'agent'},'attributes':['id',_0x4536('0x3b'),'role',_0x4536('0x64'),_0x4536('0xae'),'online']});})['then'](handleEntityNotFound(_0x557cff,null))[_0x4536('0x20')](function(_0x1f4680){if(_0x1f4680){_0x5ec308=_0x1f4680;return respondWithRpcPromise(_0x4536('0x10f'),_0x4536('0x10e'),{'id':_0x5ec308['id'],'name':_0x5ec308[_0x4536('0x3b')],'pause':!![]});}})[_0x4536('0x20')](function(){if(_0x5ec308){return db[_0x4536('0x103')]['findAll']({'where':{'membername':_0x5ec308['name'],'type':_0x4536('0x109'),'exitAt':null}});}})['then'](function(_0x63038){if(_0x63038[_0x4536('0x52')]){var _0x4b78fd=moment()[_0x4536('0xaf')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5394c0=0x0,_0x51b302=_0x63038[_0x4536('0x52')];_0x5394c0<_0x51b302;_0x5394c0++){_0x63038[_0x5394c0]['updateAttributes']({'exitAt':_0x4b78fd});}}})[_0x4536('0x20')](function(){var _0x1354c9=[];var _0x1f5672=utils[_0x4536('0x105')]();_0x1f5672['forEach'](function(_0x470773){_0x1354c9['push']({'channel':_0x470773,'membername':_0x5ec308[_0x4536('0x3b')],'interface':_[_0x4536('0x6a')](_0x5ec308['interface'])?util[_0x4536('0xaf')]('SIP/%s',_0x5ec308[_0x4536('0x3b')]):_0x5ec308[_0x4536('0xae')],'type':'PAUSE','enterAt':moment()[_0x4536('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0xd2a68d[_0x4536('0x60')]['type']||_0x4536('0x110'),'role':_0x5ec308[_0x4536('0x2a')],'internal':_0x5ec308[_0x4536('0x64')]});});return db[_0x4536('0x103')]['bulkCreate'](_0x1354c9,{'individualHooks':!![]});})['then'](function(){return _0x5ec308[_0x4536('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xd2a68d[_0x4536('0x60')][_0x4536('0x3f')]||_0x4536('0x110'),'lastPauseAt':moment()[_0x4536('0xaf')](_0x4536('0x104'))});})[_0x4536('0x20')](respondWithResult(_0x557cff,null))['catch'](handleError(_0x557cff,null));};exports[_0x4536('0x111')]=function(_0x15448a,_0x224d99){if(_0x15448a[_0x4536('0x60')][_0x4536('0xa0')]&&!utils[_0x4536('0xa3')](_0x15448a['body'][_0x4536('0xa0')])){throw new APIBadRequestError(util[_0x4536('0xaf')](_0x4536('0x112'),_0x15448a[_0x4536('0x60')][_0x4536('0xa0')]));}return db[_0x4536('0x3d')][_0x4536('0x39')]({'where':{'id':_0x15448a[_0x4536('0x5c')]['id']},'attributes':['id',_0x4536('0x3b'),_0x4536('0x2a'),'internal','interface','online',_0x4536('0xa2'),'mailPause',_0x4536('0x113'),_0x4536('0x114'),'openchannelPause','smsPause',_0x4536('0x115'),_0x4536('0x116'),_0x4536('0x117')]})[_0x4536('0x20')](function(_0x50cb0b){if(!_0x50cb0b){throw new APINotFoundError(util['format'](_0x4536('0xd0'),_0x15448a[_0x4536('0x5c')]['id']));}return _0x50cb0b[_0x4536('0x111')](_0x15448a[_0x4536('0x60')][_0x4536('0xa0')]);})[_0x4536('0x20')](respondWithResult(_0x224d99,null))['catch'](APIHandleError(_0x224d99));};exports[_0x4536('0x118')]=function(_0xb58585,_0x1d090b){var _0x55e4db={};var _0x30f3b4={};var _0x235ca8;var _0x2db13c;return db[_0x4536('0x3d')][_0x4536('0x9b')]({'where':{'id':_0xb58585[_0x4536('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1d090b,null))[_0x4536('0x20')](function(_0x330025){if(_0x330025){_0x235ca8=_0x330025;_0x30f3b4['model']=_[_0x4536('0xd8')](db[_0x4536('0x119')][_0x4536('0xe3')]);_0x30f3b4[_0x4536('0x48')]=_['keys'](_0xb58585[_0x4536('0x48')]);_0x30f3b4['filters']=_[_0x4536('0xdb')](_0x30f3b4[_0x4536('0xd7')],_0x30f3b4['query']);_0x55e4db[_0x4536('0x4f')]=_[_0x4536('0xdb')](_0x30f3b4[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0xb58585[_0x4536('0x48')]['fields']));_0x55e4db[_0x4536('0x4f')]=_0x55e4db[_0x4536('0x4f')][_0x4536('0x52')]?_0x55e4db[_0x4536('0x4f')]:_0x30f3b4[_0x4536('0xd7')];_0x55e4db[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0xb58585[_0x4536('0x48')][_0x4536('0xde')]);_0x55e4db[_0x4536('0x47')]=qs['filters'](_[_0x4536('0xdf')](_0xb58585['query'],_0x30f3b4[_0x4536('0xda')]));if(_0xb58585[_0x4536('0x48')]['filter']){_0x55e4db['where']=_[_0x4536('0xe0')](_0x55e4db[_0x4536('0x47')],{'$or':_[_0x4536('0x37')](_0x55e4db['attributes'],function(_0x10880a){var _0xfc3a69={};_0xfc3a69[_0x10880a]={'$like':'%'+_0xb58585[_0x4536('0x48')][_0x4536('0x35')]+'%'};return _0xfc3a69;})});}_0x55e4db=_[_0x4536('0xe0')]({},_0x55e4db,_0xb58585[_0x4536('0x5d')]);return _0x235ca8['getTeams'](_0x55e4db);}})[_0x4536('0x20')](function(_0x576dc7){if(_0x576dc7){_0x2db13c=_0x576dc7[_0x4536('0x52')];if(!_0xb58585[_0x4536('0x48')][_0x4536('0xd1')](_0x4536('0xe2'))){_0x55e4db[_0x4536('0x1b')]=qs[_0x4536('0x1b')](_0xb58585['query'][_0x4536('0x1b')]);_0x55e4db[_0x4536('0x1d')]=qs[_0x4536('0x1d')](_0xb58585[_0x4536('0x48')][_0x4536('0x1d')]);}return _0x235ca8[_0x4536('0x118')](_0x55e4db);}})[_0x4536('0x20')](function(_0x3b40b1){if(_0x3b40b1){return _0x3b40b1?{'count':_0x2db13c,'rows':_0x3b40b1}:null;}})['then'](respondWithResult(_0x1d090b,null))['catch'](handleError(_0x1d090b,null));};exports[_0x4536('0x11a')]=function(_0x188bcf,_0x368c06){var _0x31b4b8=_0x188bcf['params']['id'];var _0x2e5cbc=_0x188bcf[_0x4536('0x60')]?_0x188bcf[_0x4536('0x60')][_0x4536('0x63')]:null;var _0x30a015=[];return Promise[_0x4536('0x10c')]()['then'](function(){if(!_0x2e5cbc)throw new APIBadRequestError(_0x4536('0x11b'));})[_0x4536('0x20')](function(){return db[_0x4536('0x3d')]['findOne']({'where':{'id':_0x31b4b8}});})[_0x4536('0x20')](function(_0x533fc9){if(!_0x533fc9)throw new APINotFoundError(util[_0x4536('0xaf')](_0x4536('0xd0'),_0x188bcf[_0x4536('0x5c')]['id']));return db[_0x4536('0x6c')][_0x4536('0xfe')](function(_0x135c29){return _0x533fc9[_0x4536('0x11a')](_0x2e5cbc,{'transaction':_0x135c29})[_0x4536('0x20')](function(){return db['Team'][_0x4536('0x8e')]({'where':{'id':{'$in':_0x2e5cbc}}});})[_0x4536('0x20')](function(_0x5e8f13){var _0x5e2aaa=_['map'](_0x5e8f13,function(_0xd592b){return _0xd592b[_0x4536('0x11c')]();});return Promise[_0x4536('0x5f')](_0x5e2aaa);})['then'](function(_0x48fd82){_0x30a015=_['flattenDeep'](_0x48fd82);var _0x4d19f1=_['map'](_0x30a015,function(_0x117630){return _0x117630[_0x4536('0x11d')](_0x533fc9['id'],{'transaction':_0x135c29});});return Promise[_0x4536('0x5f')](_0x4d19f1);})['then'](function(){if(!_0x533fc9['online'])return;var _0x1c3f12=_[_0x4536('0x35')](_0x30a015,function(_0x55ffe3){return _0x55ffe3[_0x4536('0x11e')](_0x4536('0xa0'))==='Voice';});var _0x5e4cf7=_[_0x4536('0x37')](_0x1c3f12,function(_0x2ab5d3){return db['UserVoiceQueueRt'][_0x4536('0xb1')]({'membername':_0x533fc9[_0x4536('0x3b')],'UserId':_0x533fc9['id'],'queue_name':_0x2ab5d3['name'],'VoiceQueueId':_0x2ab5d3['id'],'interface':_['isNil'](_0x533fc9['interface'])?util[_0x4536('0xaf')](_0x4536('0xf7'),_0x533fc9[_0x4536('0x3b')]):_0x533fc9['interface'],'paused':_0x533fc9[_0x4536('0xa2')]||![],'penalty':_0x533fc9['penalty']},{'transaction':_0x135c29});});return Promise[_0x4536('0x5f')](_0x5e4cf7);})[_0x4536('0x20')](function(){return db[_0x4536('0x11f')][_0x4536('0x8e')]({'where':{'teamId':{'$in':_0x2e5cbc}}});})[_0x4536('0x20')](function(_0x18d62e){var _0x1ec1a3=_[_0x4536('0x37')](_0x18d62e,function(_0x1e4439){return db[_0x4536('0x120')][_0x4536('0x83')]({'UserId':_0x533fc9['id'],'VoicePrefixId':_0x1e4439[_0x4536('0x121')]},{'transaction':_0x135c29});});return Promise[_0x4536('0x5f')](_0x1ec1a3);});});})[_0x4536('0x20')](function(){for(var _0x25e6a3=0x0;_0x25e6a3<_0x30a015[_0x4536('0x52')];_0x25e6a3++){var _0x5972f1=_0x30a015[_0x25e6a3][_0x4536('0x11e')](_0x4536('0xa0'));var _0x2f2c80=_0x5972f1+'QueueId';socket[_0x4536('0x2c')](_0x4536('0x32')+_0x5972f1+'Queue:save',{'UserId':_0x31b4b8,['queueField']:_0x30a015[_0x25e6a3]['id']});}})[_0x4536('0x20')](respondWithStatusCode(_0x368c06,null))['catch'](APIHandleError(_0x368c06));};exports[_0x4536('0x122')]=function(_0x8f02f1,_0x20c2d8){var _0x1c9750=_0x8f02f1[_0x4536('0x5c')]['id'];var _0x28e4d1=null;if(_0x8f02f1[_0x4536('0x48')][_0x4536('0x63')]){_0x28e4d1=_[_0x4536('0xb5')](_0x8f02f1['query'][_0x4536('0x63')])?_0x8f02f1[_0x4536('0x48')]['ids']:[_0x8f02f1[_0x4536('0x48')][_0x4536('0x63')]];}var _0x3c9e6d=[];return Promise['resolve']()['then'](function(){if(!_0x28e4d1)throw new APIBadRequestError(_0x4536('0x123'));})[_0x4536('0x20')](function(){return db[_0x4536('0x3d')][_0x4536('0x9b')]({'where':{'id':_0x1c9750}});})[_0x4536('0x20')](function(_0x386634){if(!_0x386634)throw new APINotFoundError(util[_0x4536('0xaf')](_0x4536('0xd0'),_0x8f02f1[_0x4536('0x5c')]['id']));return db[_0x4536('0x6c')][_0x4536('0xfe')](function(_0x2cb175){return _0x386634[_0x4536('0x122')](_0x28e4d1,{'transaction':_0x2cb175})[_0x4536('0x20')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x28e4d1}}});})['then'](function(_0x4b3cf8){var _0x39f3a6=_['map'](_0x4b3cf8,function(_0x3a2952){return _0x3a2952[_0x4536('0x11c')]();});return Promise['all'](_0x39f3a6);})[_0x4536('0x20')](function(_0x1e3834){_0x3c9e6d=_[_0x4536('0x124')](_0x1e3834);var _0x1d6e03=_[_0x4536('0x37')](_0x3c9e6d,function(_0x37060f){return _0x37060f['removeAgent'](_0x386634['id'],{'transaction':_0x2cb175});});return Promise[_0x4536('0x5f')](_0x1d6e03);})[_0x4536('0x20')](function(){if(!_0x386634['online'])return;var _0x5ac865=_['filter'](_0x3c9e6d,function(_0x3671a8){return _0x3671a8[_0x4536('0x11e')]('channel')===_0x4536('0x125');});var _0x1eeac7=_[_0x4536('0x37')](_0x5ac865,function(_0x3c25c9){return db[_0x4536('0xb0')][_0x4536('0x2e')]({'where':{'VoiceQueueId':_0x3c25c9['id'],'UserId':_0x386634['id']},'transaction':_0x2cb175});});return Promise[_0x4536('0x5f')](_0x1eeac7);})[_0x4536('0x20')](function(){return db[_0x4536('0x11f')][_0x4536('0x8e')]({'where':{'teamId':{'$in':_0x28e4d1}}});})[_0x4536('0x20')](function(_0x28207e){var _0x3e8a8b=_[_0x4536('0x37')](_0x28207e,function(_0x127cae){return db['UserVoicePrefix'][_0x4536('0x2e')]({'where':{'UserId':_0x386634['id'],'VoicePrefixId':_0x127cae[_0x4536('0x121')]}},{'transaction':_0x2cb175});});return Promise[_0x4536('0x5f')](_0x3e8a8b);});});})[_0x4536('0x20')](function(){for(var _0x190bbe=0x0;_0x190bbe<_0x3c9e6d['length'];_0x190bbe++){var _0x368af0=_0x3c9e6d[_0x190bbe]['getDataValue'](_0x4536('0xa0'));var _0xbcd8ef=_0x368af0+_0x4536('0xaa');socket[_0x4536('0x2c')](_0x4536('0x32')+_0x368af0+'Queue:remove',{'UserId':_0x1c9750,['queueField']:_0x3c9e6d[_0x190bbe]['id']});}})[_0x4536('0x20')](respondWithStatusCode(_0x20c2d8,null))['catch'](APIHandleError(_0x20c2d8));};exports['getLists']=function(_0x1233c7,_0x523682){var _0x4b96c9={};var _0x5cacc3={};var _0xc73a7d;var _0x30db64;return db[_0x4536('0x3d')][_0x4536('0x9b')]({'where':{'id':_0x1233c7['params']['id']}})[_0x4536('0x20')](handleEntityNotFound(_0x523682,null))[_0x4536('0x20')](function(_0x416d6d){if(_0x416d6d){_0xc73a7d=_0x416d6d;_0x5cacc3['model']=_[_0x4536('0xd8')](db[_0x4536('0xd2')]['rawAttributes']);_0x5cacc3[_0x4536('0x48')]=_[_0x4536('0xd8')](_0x1233c7['query']);_0x5cacc3[_0x4536('0xda')]=_[_0x4536('0xdb')](_0x5cacc3[_0x4536('0xd7')],_0x5cacc3[_0x4536('0x48')]);_0x4b96c9['attributes']=_[_0x4536('0xdb')](_0x5cacc3[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0x1233c7[_0x4536('0x48')][_0x4536('0xdc')]));_0x4b96c9[_0x4536('0x4f')]=_0x4b96c9[_0x4536('0x4f')][_0x4536('0x52')]?_0x4b96c9[_0x4536('0x4f')]:_0x5cacc3[_0x4536('0xd7')];_0x4b96c9[_0x4536('0xdd')]=qs[_0x4536('0xde')](_0x1233c7[_0x4536('0x48')][_0x4536('0xde')]);_0x4b96c9[_0x4536('0x47')]=qs[_0x4536('0xda')](_['pick'](_0x1233c7[_0x4536('0x48')],_0x5cacc3[_0x4536('0xda')]));if(_0x1233c7[_0x4536('0x48')][_0x4536('0x35')]){_0x4b96c9[_0x4536('0x47')]=_[_0x4536('0xe0')](_0x4b96c9[_0x4536('0x47')],{'$or':_[_0x4536('0x37')](_0x4b96c9[_0x4536('0x4f')],function(_0x8669f8){var _0x284bfd={};_0x284bfd[_0x8669f8]={'$like':'%'+_0x1233c7[_0x4536('0x48')][_0x4536('0x35')]+'%'};return _0x284bfd;})});}_0x4b96c9=_[_0x4536('0xe0')]({},_0x4b96c9,_0x1233c7['options']);return _0xc73a7d['getLists'](_0x4b96c9);}})['then'](function(_0x273348){if(_0x273348){_0x30db64=_0x273348[_0x4536('0x52')];if(!_0x1233c7[_0x4536('0x48')]['hasOwnProperty']('nolimit')){_0x4b96c9[_0x4536('0x1b')]=qs['limit'](_0x1233c7[_0x4536('0x48')]['limit']);_0x4b96c9['offset']=qs[_0x4536('0x1d')](_0x1233c7[_0x4536('0x48')][_0x4536('0x1d')]);}return _0xc73a7d[_0x4536('0x126')](_0x4b96c9);}})[_0x4536('0x20')](function(_0x110205){if(_0x110205){return _0x110205?{'count':_0x30db64,'rows':_0x110205}:null;}})['then'](respondWithResult(_0x523682,null))[_0x4536('0x5a')](handleError(_0x523682,null));};exports[_0x4536('0x127')]=function(_0x47e3d9,_0x416c64){var _0x414a81={};var _0x3c10ee={};var _0xe7707f;return db['User']['findOne']({'where':{'id':_0x47e3d9[_0x4536('0x5c')]['id']}})[_0x4536('0x20')](handleEntityNotFound(_0x416c64,null))[_0x4536('0x20')](function(_0x2741d2){if(_0x2741d2){_0xe7707f=_0x2741d2;_0x3c10ee[_0x4536('0xd7')]=_[_0x4536('0xd8')](db[_0x4536('0x3d')]['rawAttributes']);_0x3c10ee[_0x4536('0x48')]=_[_0x4536('0xd8')](_0x47e3d9[_0x4536('0x48')]);_0x3c10ee[_0x4536('0xda')]=_[_0x4536('0xdb')](_0x3c10ee[_0x4536('0xd7')],_0x3c10ee[_0x4536('0x48')]);_0x414a81['attributes']=_[_0x4536('0xdb')](_0x3c10ee[_0x4536('0xd7')],qs[_0x4536('0xdc')](_0x47e3d9[_0x4536('0x48')][_0x4536('0xdc')]));_0x414a81['attributes']=_0x414a81['attributes']['length']?_0x414a81[_0x4536('0x4f')]:_0x3c10ee[_0x4536('0xd7')];_0x414a81['order']=qs[_0x4536('0xde')](_0x47e3d9['query']['sort']);_0x414a81['where']=qs[_0x4536('0xda')](_['pick'](_0x47e3d9['query'],_0x3c10ee[_0x4536('0xda')]));if(_0x47e3d9['query']['filter']){_0x414a81[_0x4536('0x47')]=_['merge'](_0x414a81['where'],{'$or':_[_0x4536('0x37')](_0x414a81[_0x4536('0x4f')],function(_0x14d72d){var _0x51c5cf={};_0x51c5cf[_0x14d72d]={'$like':'%'+_0x47e3d9['query'][_0x4536('0x35')]+'%'};return _0x51c5cf;})});}_0x414a81['model']=db[_0x4536('0x3d')];_0x414a81['as']=_0x4536('0x33');_0x414a81=_[_0x4536('0xe0')]({},_0x414a81,_0x47e3d9[_0x4536('0x5d')]);return _0xe7707f[_0x4536('0x101')]({'include':[_0x414a81]});}})[_0x4536('0x20')](function(_0x52d9b6){if(_0x52d9b6){var _0x4977dd={},_0x37deb6=[];for(var _0x52a670=0x0;_0x52a670<_0x52d9b6['length'];_0x52a670+=0x1){for(var _0x46be20=0x0,_0xca69c1;_0x46be20<_0x52d9b6[_0x52a670][_0x4536('0x33')][_0x4536('0x52')];_0x46be20+=0x1){_0xca69c1=_0x52d9b6[_0x52a670][_0x4536('0x33')][_0x46be20]['get']({'plain':!![]});_0x4977dd[_0xca69c1['id']]=_0xca69c1;}}_0x4977dd=_[_0x4536('0x128')](_0x4977dd);for(var _0x4d41ce=qs[_0x4536('0x1d')](_0x47e3d9['query']['offset']);_0x4d41ce<_0x4977dd[_0x4536('0x52')]&&_0x37deb6[_0x4536('0x52')]=_0x392bda){_0x2e3ed9=_0x392bda;_0x5259aa=0xc8;}else{_0x5259aa=0xce;}_0x211b4a[_0x58c6('0x1a')](_0x5259aa);return _0x211b4a['set'](_0x58c6('0x20'),_0x455872+'-'+_0x2e3ed9+'/'+_0x392bda)['json'](_0x6bd163);}return null;};}function respondWithRpcPromise(_0x2ca0f3,_0x358957,_0x50b909,_0x28137d){return new Promise(function(_0x4bc8ed,_0x346a41){var _0x5e4737=_0x28137d||amiClient;return _0x5e4737[_0x58c6('0x21')](_0x2ca0f3,_0x50b909)['then'](function(_0xfd7398){logger[_0x58c6('0x22')](_0x58c6('0x23'),_0x358957,_0x58c6('0x24'));logger[_0x58c6('0x25')](_0x58c6('0x26'),_0x358957,_0x58c6('0x24'),JSON['stringify'](_0xfd7398));if(_0xfd7398['error']){if(_0xfd7398[_0x58c6('0x27')]['code']===0x1f4){logger[_0x58c6('0x27')]('User,\x20%s,\x20%s',_0x358957,_0xfd7398['error']['message']);return _0x346a41(_0xfd7398[_0x58c6('0x27')]['message']);}logger['error'](_0x58c6('0x23'),_0x358957,_0xfd7398[_0x58c6('0x27')]['message']);return _0x4bc8ed(_0xfd7398[_0x58c6('0x27')][_0x58c6('0x28')]);}else{logger[_0x58c6('0x22')](_0x58c6('0x23'),_0x358957,'request\x20sent');_0x4bc8ed(_0xfd7398['result'][_0x58c6('0x28')]);}})[_0x58c6('0x29')](function(_0x3b10db){logger[_0x58c6('0x27')](_0x58c6('0x23'),_0x358957,_0x3b10db);_0x346a41(_0x3b10db);});});}function saveUpdates(_0x508e52){return function(_0x2da013){if(_0x2da013){return _0x2da013[_0x58c6('0x2a')](_0x508e52)[_0x58c6('0x2b')](function(_0x23d8ff){if(_0x23d8ff[_0x58c6('0x2c')]===_0x58c6('0x2d')){socket['emit'](_0x58c6('0x2e')+_0x23d8ff['id'],_0x23d8ff);}return _0x23d8ff;});}return null;};}function removeEntity(_0x58b00c,_0x346f94){return function(_0x9fad9c){if(_0x9fad9c){return _0x9fad9c[_0x58c6('0x2f')]({'transaction':_0x346f94})[_0x58c6('0x2b')](function(){var _0x2246b8=_0x9fad9c[_0x58c6('0x30')]({'plain':!![]});if(_0x2246b8[_0x58c6('0x2c')]===_0x58c6('0x31'))return;var _0x254a4f=[{'name':_0x58c6('0x32'),'value':'user','ignore':!![]},{'name':_0x58c6('0x33'),'value':_0x58c6('0x2d'),'ignore':![]},{'name':_0x58c6('0x34'),'value':'telephone','ignore':![]}];var _0x106201=_(_0x254a4f)[_0x58c6('0x35')](_0x58c6('0x36'))[_0x58c6('0x37')]('value')[_0x58c6('0x38')]();if(_[_0x58c6('0x39')](_0x106201,_0x2246b8['role'])){return;}var _0x14c515=_['find'](_0x254a4f,['value',_0x2246b8[_0x58c6('0x2c')]])[_0x58c6('0x3a')];return db[_0x58c6('0x3b')][_0x58c6('0x2f')]({'where':{'type':_0x14c515,'resourceId':_0x2246b8['id']},'transaction':_0x346f94})[_0x58c6('0x2b')](function(){return _0x9fad9c;});})[_0x58c6('0x2b')](function(){_0x58b00c[_0x58c6('0x1a')](0xcc)[_0x58c6('0x3c')]();});}};}function handleEntityNotFound(_0x416d3c){return function(_0x29f379){if(!_0x29f379){_0x416d3c[_0x58c6('0x19')](0x194);}return _0x29f379;};}function handleError(_0x232ec5,_0x189036){_0x189036=_0x189036||0x1f4;return function(_0x373b5f){logger[_0x58c6('0x27')](_0x373b5f[_0x58c6('0x3d')]);if(_0x373b5f[_0x58c6('0x3a')]){delete _0x373b5f[_0x58c6('0x3a')];}_0x232ec5[_0x58c6('0x1a')](_0x189036)[_0x58c6('0x3e')](_0x373b5f);};}function getUserAttributes(){return _(db[_0x58c6('0x3f')]['rawAttributes'])[_0x58c6('0x37')](function(_0x21c7ee){return{'name':_0x21c7ee[_0x58c6('0x40')],'type':_0x21c7ee[_0x58c6('0x41')]['key']};})[_0x58c6('0x35')](function(_0x27a952){return![_0x58c6('0x42'),_0x58c6('0x43'),_0x58c6('0x44'),_0x58c6('0x45'),_0x58c6('0x46'),_0x58c6('0x47')][_0x58c6('0x39')](_0x27a952[_0x58c6('0x3a')]);})['value']();}exports[_0x58c6('0x48')]=function(_0x37317a,_0x1e0bd5){var _0x4a9353={},_0x104c7a={'count':0x0,'rows':[]};var _0x58998e=getUserAttributes();_0x4a9353=qs[_0x58c6('0x49')](_0x58998e,_0x37317a);var _0x3ff22e={'where':_0x4a9353[_0x58c6('0x4a')]};return db[_0x58c6('0x3f')][_0x58c6('0x1f')](_0x3ff22e)['then'](function(_0x1fed1f){_0x104c7a[_0x58c6('0x1f')]=_0x1fed1f;if(_0x37317a['query']['includeAll']){_0x4a9353[_0x58c6('0x4b')]=[{'all':!![]}];}if(_0x37317a[_0x58c6('0x4c')][_0x58c6('0x4d')]===_0x58c6('0x4e')){_0x4a9353[_0x58c6('0x4b')]=[{'model':db[_0x58c6('0x4f')],'as':'userSetting'}];}if(!_['includes'](_0x4a9353[_0x58c6('0x50')],'id')){_0x4a9353[_0x58c6('0x50')][_0x58c6('0x51')]('id');}return db[_0x58c6('0x3f')][_0x58c6('0x52')](_0x4a9353);})['then'](function(_0x35bf9e){_0x104c7a[_0x58c6('0x53')]=_0x35bf9e;if(_0x37317a[_0x58c6('0x4c')][_0x58c6('0x54')]==='true'){var _0x492b87=[];for(var _0x445a4d=0x0;_0x445a4d<_0x104c7a[_0x58c6('0x53')]['length'];_0x445a4d++){_0x492b87[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x55'),_0x104c7a[_0x58c6('0x53')][_0x445a4d][_0x58c6('0x56')]));_0x492b87[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x57'),_0x104c7a[_0x58c6('0x53')][_0x445a4d][_0x58c6('0x56')]));_0x492b87[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x58'),_0x104c7a[_0x58c6('0x53')][_0x445a4d][_0x58c6('0x56')]));_0x492b87['push'](get_open_tabs(_0x58c6('0x59'),_0x104c7a[_0x58c6('0x53')][_0x445a4d][_0x58c6('0x56')]));_0x492b87[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x5a'),_0x104c7a['rows'][_0x445a4d]['dataValues']));_0x492b87[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x5b'),_0x104c7a[_0x58c6('0x53')][_0x445a4d][_0x58c6('0x56')]));}return Promise[_0x58c6('0x5c')](_0x492b87)[_0x58c6('0x2b')](function(){return _0x104c7a;});}else{return _0x104c7a;}})['then'](respondWithFilteredResult(_0x1e0bd5,_0x4a9353))[_0x58c6('0x29')](handleError(_0x1e0bd5,null));};exports[_0x58c6('0x5d')]=function(_0x42bb32,_0x4d3ede){var _0x5af580=getUserAttributes();_0x42bb32[_0x58c6('0x4c')]['id']=_0x42bb32[_0x58c6('0x5e')]['id'];var _0x3ae2fd=qs['getOptions'](_0x5af580,_0x42bb32);if(_0x42bb32['query']['includeAll']){_0x3ae2fd[_0x58c6('0x4b')]=[{'all':!![]}];}if(_0x42bb32[_0x58c6('0x4c')][_0x58c6('0x4d')]===_0x58c6('0x4e')){_0x3ae2fd[_0x58c6('0x4b')]=[{'model':db['UserSetting'],'as':_0x58c6('0x4d')}];}_0x3ae2fd=_[_0x58c6('0x5f')]({},_0x3ae2fd,_0x42bb32['options']);if(!_['includes'](_0x3ae2fd['attributes'],'id')){_0x3ae2fd['attributes'][_0x58c6('0x51')]('id');}return db[_0x58c6('0x3f')]['find'](_0x3ae2fd)['then'](handleEntityNotFound(_0x4d3ede,null))[_0x58c6('0x2b')](function(_0x432e84){var _0x39a69e=[];values=_0x432e84;if(_0x42bb32[_0x58c6('0x4c')][_0x58c6('0x54')]==='true'){_0x39a69e[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x55'),_0x432e84[_0x58c6('0x56')]));_0x39a69e[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x57'),_0x432e84[_0x58c6('0x56')]));_0x39a69e[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x5a'),_0x432e84[_0x58c6('0x56')]));_0x39a69e[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x5b'),_0x432e84[_0x58c6('0x56')]));_0x39a69e[_0x58c6('0x51')](get_open_tabs('fax',_0x432e84[_0x58c6('0x56')]));_0x39a69e[_0x58c6('0x51')](get_open_tabs('mail',_0x432e84[_0x58c6('0x56')]));return Promise[_0x58c6('0x5c')](_0x39a69e);}else{return values;}})['then'](function(){return values;})[_0x58c6('0x2b')](respondWithResult(_0x4d3ede,null))[_0x58c6('0x29')](handleError(_0x4d3ede,null));};exports['update']=function(_0x35ab54,_0x5b4731){if(_0x35ab54[_0x58c6('0x60')]['id']){delete _0x35ab54[_0x58c6('0x60')]['id'];}delete _0x35ab54['body'][_0x58c6('0x2c')];return db[_0x58c6('0x3f')][_0x58c6('0x61')]({'where':{'id':_0x35ab54[_0x58c6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5b4731,null))[_0x58c6('0x2b')](saveUpdates(_0x35ab54['body'],null))[_0x58c6('0x2b')](respondWithResult(_0x5b4731,null))[_0x58c6('0x29')](handleError(_0x5b4731,null));};exports[_0x58c6('0x62')]=function(_0x4c2d90,_0x4610ff){return db[_0x58c6('0x3f')]['describe']()[_0x58c6('0x2b')](respondWithResult(_0x4610ff,null))['catch'](handleError(_0x4610ff,null));};exports[_0x58c6('0x63')]=function(_0x2ad972,_0x507964){return db[_0x58c6('0x3f')][_0x58c6('0x61')]({'where':{'id':_0x2ad972[_0x58c6('0x5e')]['id']}})[_0x58c6('0x2b')](handleEntityNotFound(_0x507964,null))['then'](function(_0xaa3e17){if(_0xaa3e17){return _0xaa3e17[_0x58c6('0x63')](_0x2ad972[_0x58c6('0x60')]['ids'],_[_0x58c6('0x64')](_0x2ad972[_0x58c6('0x60')],['ids','id'])||{});}})[_0x58c6('0x2b')](respondWithResult(_0x507964,null))[_0x58c6('0x29')](handleError(_0x507964,null));};function validateUser(_0x2b1a73){return new Promise(function(_0x3bd5d8,_0x5ebe6b){if(_0x2b1a73['internal'])return _0x3bd5d8(_0x2b1a73);return db[_0x58c6('0x65')][_0x58c6('0x66')](0x1)[_0x58c6('0x2b')](function(_0x49b619){if(_0x49b619[_0x58c6('0x67')])authService[_0x58c6('0x68')](_0x2b1a73[_0x58c6('0x42')]);db[_0x58c6('0x3f')]['max'](_0x58c6('0x69'))['then'](function(_0x3286f7){if(_['isNil'](_0x3286f7)){_0x2b1a73[_0x58c6('0x69')]=_0x49b619[_0x58c6('0x6a')]||0x1;return;}if(_[_0x58c6('0x6b')](_0x49b619['min_internal'])||_0x49b619[_0x58c6('0x6a')]===_0x3286f7){_0x2b1a73[_0x58c6('0x69')]=_0x3286f7+0x1;return;}if(_0x49b619[_0x58c6('0x6a')]>_0x3286f7){_0x2b1a73['internal']=_0x49b619[_0x58c6('0x6a')];return;}return db[_0x58c6('0x6c')][_0x58c6('0x4c')](_0x58c6('0x6d'),{'type':db[_0x58c6('0x6c')][_0x58c6('0x6e')]['SELECT']})[_0x58c6('0x2b')](function(_0x5da346){if(_0x5da346&&_0x5da346['length']){for(var _0x51d285=0x0,_0x5ef5b4=_0x5da346[_0x58c6('0x6f')];_0x51d285<_0x5ef5b4&&_[_0x58c6('0x6b')](_0x2b1a73[_0x58c6('0x69')]);_0x51d285++){if(_0x49b619['min_internal']<=_0x5da346[_0x51d285][_0x58c6('0x70')]){_0x2b1a73[_0x58c6('0x69')]=_0x5da346[_0x51d285][_0x58c6('0x70')];}else if(_0x49b619[_0x58c6('0x6a')]>_0x5da346[_0x51d285]['from']&&_0x49b619[_0x58c6('0x6a')]<=_0x5da346[_0x51d285]['to']){_0x2b1a73['internal']=_0x49b619[_0x58c6('0x6a')];}}}if(_[_0x58c6('0x6b')](_0x2b1a73[_0x58c6('0x69')])){_0x2b1a73[_0x58c6('0x69')]=_0x3286f7+0x1;}return _0x3bd5d8(_0x2b1a73);});});})[_0x58c6('0x29')](function(_0x5abb95){_0x5ebe6b(_0x5abb95);});});}function updateUser(_0x163343){return new Promise(function(_0x63f386,_0x43472f){try{if(_0x163343[_0x58c6('0x71')]){_0x163343[_0x58c6('0x72')]=_0x163343[_0x58c6('0x69')];_0x163343['VoiceMail']={'mailbox':_0x163343[_0x58c6('0x69')],'password':_0x163343[_0x58c6('0x42')],'fullname':_0x163343[_0x58c6('0x73')],'email':_0x163343[_0x58c6('0x74')]};}if(_0x163343[_0x58c6('0x2c')]==='agent'){if(!_0x163343[_0x58c6('0x75')])_0x163343[_0x58c6('0x75')]=[_0x58c6('0x76'),_0x58c6('0x77'),_0x58c6('0x78'),_0x58c6('0x79'),_0x58c6('0x7a'),_0x58c6('0x7b'),'105',_0x58c6('0x7c'),'107','108',_0x58c6('0x7d'),_0x58c6('0x7e'),_0x58c6('0x7f'),_0x58c6('0x80'),_0x58c6('0x81')];}_0x63f386(_0x163343);}catch(_0x4fdbb6){_0x43472f(_0x4fdbb6);}});}exports[_0x58c6('0x82')]=function(_0x2102d2,_0x2069ff){if(_0x2102d2[_0x58c6('0x83')][_0x58c6('0x2c')]===_0x58c6('0x2d'))throw new Error(_0x58c6('0x84'));if(_0x2102d2[_0x58c6('0x60')][_0x58c6('0x2c')]===_0x58c6('0x83')&&_0x2102d2[_0x58c6('0x83')][_0x58c6('0x2c')]!==_0x58c6('0x31')){throw new Error(_0x58c6('0x85'));}if(_0x2102d2[_0x58c6('0x60')][_0x58c6('0x2c')]==='admin'&&_0x2102d2[_0x58c6('0x83')][_0x58c6('0x2c')]!==_0x58c6('0x31')){throw new Error(_0x58c6('0x86'));}return licenseUtil[_0x58c6('0x87')]([_0x2102d2[_0x58c6('0x60')]])[_0x58c6('0x2b')](function(){return validateUser(_0x2102d2[_0x58c6('0x60')]);})[_0x58c6('0x2b')](function(_0x281284){return updateUser(_0x281284)[_0x58c6('0x2b')](function(_0x409f8b){if(_0x409f8b['role']===_0x58c6('0x31')){_0x409f8b[_0x58c6('0x88')]=_0x2102d2[_0x58c6('0x83')][_0x58c6('0x88')];delete _0x409f8b[_0x58c6('0x89')];}return _0x409f8b;});})[_0x58c6('0x2b')](function(_0x2a2048){return db[_0x58c6('0x3f')]['create'](_0x2a2048,{'include':[{'model':db[_0x58c6('0x8a')],'as':_0x58c6('0x8a')}]});})[_0x58c6('0x2b')](function(_0xc30ea9){if(_0x2102d2[_0x58c6('0x60')][_0x58c6('0x2c')]==='user')return _0xc30ea9;if(_0x2102d2[_0x58c6('0x83')][_0x58c6('0x2c')]!=='user')return _0xc30ea9;return db[_0x58c6('0x8b')][_0x58c6('0x61')]({'where':{'name':_0xc30ea9[_0x58c6('0x2c')]==='agent'?_0x58c6('0x33'):'Telephones','userProfileId':_0x2102d2[_0x58c6('0x83')][_0x58c6('0x89')]},'raw':!![]})[_0x58c6('0x2b')](function(_0xfcba10){if(!_0xfcba10||_0xfcba10[_0x58c6('0x8c')]!=0x0)return _0xc30ea9;return db[_0x58c6('0x3b')][_0x58c6('0x82')]({'name':_0xc30ea9[_0x58c6('0x3a')],'resourceId':_0xc30ea9['id'],'type':_0xfcba10['name'],'sectionId':_0xfcba10['id']},{})[_0x58c6('0x2b')](function(){return _0xc30ea9;});})[_0x58c6('0x29')](function(_0x6cb8e6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6cb8e6);throw _0x6cb8e6;});})['then'](respondWithResult(_0x2069ff,0xc9))['catch'](handleError(_0x2069ff,null));};exports['bulkCreate']=function(_0x27f035,_0x4bc733){var _0x19713e=_0x27f035[_0x58c6('0x60')];var _0x15468f=[];if(_0x27f035[_0x58c6('0x83')][_0x58c6('0x2c')]==='agent')throw new Error(_0x58c6('0x84'));if(_[_0x58c6('0x8d')](_0x19713e,[_0x58c6('0x2c'),'user'])&&_0x27f035[_0x58c6('0x83')][_0x58c6('0x2c')]!==_0x58c6('0x31')){throw new Error(_0x58c6('0x85'));}if(_[_0x58c6('0x8d')](_0x19713e,['role','admin'])&&_0x27f035['user'][_0x58c6('0x2c')]!==_0x58c6('0x31')){throw new Error(_0x58c6('0x8e'));}return licenseUtil[_0x58c6('0x87')](_0x19713e)[_0x58c6('0x2b')](function(){return validateUser(_0x19713e[0x0]);})['then'](function(){for(var _0x311393=0x1;_0x311393<_0x19713e[_0x58c6('0x6f')];_0x311393++){var _0x2cc5be=_0x19713e[_0x311393-0x1][_0x58c6('0x69')];if(!_0x19713e[_0x311393][_0x58c6('0x69')])_0x19713e[_0x311393]['internal']=_0x2cc5be+0x1;_0x15468f[_0x58c6('0x51')](validateUser(_0x19713e[_0x311393]));}return Promise[_0x58c6('0x5c')](_0x15468f);})[_0x58c6('0x2b')](function(){_0x15468f=[];for(var _0x195c90=0x0;_0x195c90<_0x19713e[_0x58c6('0x6f')];_0x195c90++){_0x15468f[_0x58c6('0x51')](updateUser(_0x19713e[_0x195c90]));}return Promise['all'](_0x15468f);})['then'](function(){_0x15468f=_0x19713e[_0x58c6('0x37')](function(_0x2dd966){return db['User'][_0x58c6('0x82')](_0x2dd966,{'include':[{'model':db[_0x58c6('0x8a')],'as':'VoiceMail'}]})[_0x58c6('0x2b')](function(_0x2cf4c9){_0x2dd966['id']=_0x2cf4c9['id'];return _0x2dd966;});});return Promise[_0x58c6('0x5c')](_0x15468f);})[_0x58c6('0x2b')](function(_0x493a2a){if(_0x27f035[_0x58c6('0x60')]['role']==='user')return _0x493a2a;if(_0x27f035[_0x58c6('0x83')][_0x58c6('0x2c')]!==_0x58c6('0x83'))return _0x493a2a;var _0x4c931c=_[_0x58c6('0x8d')](_0x493a2a,function(_0x1d9249){return _0x1d9249[_0x58c6('0x2c')]===_0x58c6('0x2d')||_0x1d9249[_0x58c6('0x2c')]==='telephone';});if(!_0x4c931c)return _0x493a2a;return db[_0x58c6('0x8b')][_0x58c6('0x52')]({'where':{'name':{'$or':[_0x58c6('0x33'),_0x58c6('0x34')]},'userProfileId':_0x27f035[_0x58c6('0x83')][_0x58c6('0x89')]},'raw':!![]})['then'](function(_0x596da4){if(_[_0x58c6('0x8f')](_0x596da4)||!_['some'](_0x596da4,['autoAssociation',0x0]))return _0x493a2a;_0x15468f=[];var _0x584e1f=_(_0x596da4)[_0x58c6('0x37')](function(_0x13e23b){if(_0x13e23b[_0x58c6('0x8c')]===0x1)return;return _0x13e23b[_0x58c6('0x3a')]===_0x58c6('0x33')?'agent':_0x58c6('0x90');})[_0x58c6('0x91')]()[_0x58c6('0x38')]();for(var _0x5a51c2=0x0;_0x5a51c2<_0x493a2a[_0x58c6('0x6f')];_0x5a51c2++){if(!_[_0x58c6('0x39')](_0x584e1f,_0x493a2a[_0x5a51c2]['role']))return;var _0x39f001=_0x493a2a[_0x5a51c2]['role']==='agent'?_0x58c6('0x33'):_0x58c6('0x34');_0x15468f[_0x58c6('0x51')](db[_0x58c6('0x3b')][_0x58c6('0x82')]({'name':_0x493a2a[_0x5a51c2][_0x58c6('0x3a')],'resourceId':_0x493a2a[_0x5a51c2]['id'],'type':_0x39f001,'sectionId':_[_0x58c6('0x61')](_0x596da4,[_0x58c6('0x3a'),_0x39f001])['id']},{}));}return Promise[_0x58c6('0x5c')](_0x15468f);});})[_0x58c6('0x2b')](respondWithResult(_0x4bc733,0xc9))[_0x58c6('0x29')](handleError(_0x4bc733,null));};exports['changePassword']=function(_0x16f940,_0x4a8b9e){if(_0x16f940[_0x58c6('0x60')]['id']){delete _0x16f940[_0x58c6('0x60')]['id'];}return db[_0x58c6('0x3f')]['find']({'where':{'id':_0x16f940[_0x58c6('0x5e')]['id']}})[_0x58c6('0x2b')](function(_0xff6099){if(!_0xff6099)return null;if(_0xff6099['id']===_0x16f940[_0x58c6('0x83')]['id']){if(!_0x16f940[_0x58c6('0x60')][_0x58c6('0x92')]||!_0x16f940['body'][_0x58c6('0x93')]){throw new db[(_0x58c6('0x94'))][(_0x58c6('0x95'))](_0x58c6('0x96'));}if(!_0xff6099[_0x58c6('0x97')](_0x16f940['body'][_0x58c6('0x92')])){throw new db[(_0x58c6('0x94'))][(_0x58c6('0x95'))](_0x58c6('0x98'));}if(_0x16f940[_0x58c6('0x60')][_0x58c6('0x92')]===_0x16f940[_0x58c6('0x60')]['newPassword']){throw new db[(_0x58c6('0x94'))][(_0x58c6('0x95'))](_0x58c6('0x99'));}}else if(_0x16f940[_0x58c6('0x83')]['role']===_0x58c6('0x31')){if(!_0x16f940['body'][_0x58c6('0x93')]){throw new db[(_0x58c6('0x94'))][(_0x58c6('0x95'))](_0x58c6('0x9a'));}}else if(_0x16f940[_0x58c6('0x83')][_0x58c6('0x2c')]===_0x58c6('0x83')){if(!_0x16f940[_0x58c6('0x60')][_0x58c6('0x93')]){throw new db[(_0x58c6('0x94'))][(_0x58c6('0x95'))](_0x58c6('0x9a'));}if(_0xff6099[_0x58c6('0x2c')]!==_0x58c6('0x2d')){throw new db[(_0x58c6('0x94'))]['ValidationError'](_0x58c6('0x84'));}}else{throw new db[(_0x58c6('0x94'))][(_0x58c6('0x95'))](_0x58c6('0x84'));}return _0xff6099;})[_0x58c6('0x2b')](handleEntityNotFound(_0x4a8b9e,null))[_0x58c6('0x2b')](function(_0x58538c){return db[_0x58c6('0x65')]['findOne']({'attributes':['id',_0x58c6('0x67'),_0x58c6('0x9b'),_0x58c6('0x9c')]})[_0x58c6('0x2b')](function(_0x1454ee){if(_0x1454ee[_0x58c6('0x67')])authService[_0x58c6('0x68')](_0x16f940[_0x58c6('0x60')][_0x58c6('0x93')]);if(!_0x1454ee[_0x58c6('0x9b')]||!_0x58538c['previousPasswords'])return _0x58538c;authService[_0x58c6('0x9d')](_0x16f940[_0x58c6('0x60')][_0x58c6('0x93')],_0x58538c[_0x58c6('0x44')],_0x1454ee[_0x58c6('0x9c')]);return _0x58538c;})[_0x58c6('0x2b')](saveUpdates({'password':_0x16f940[_0x58c6('0x60')][_0x58c6('0x93')],'passwordResetAt':_0x16f940[_0x58c6('0x83')]['id']==_0x16f940[_0x58c6('0x5e')]['id']?moment():null,'previousPasswords':authService[_0x58c6('0x9e')](_0x16f940[_0x58c6('0x60')][_0x58c6('0x93')],_0x58538c[_0x58c6('0x44')])},null));})['then'](respondWithResult(_0x4a8b9e,null))[_0x58c6('0x29')](handleError(_0x4a8b9e,null));};exports[_0x58c6('0x9f')]=function(_0x1c1f5a,_0x39a563){var _0x5bee9f=_0x1c1f5a[_0x58c6('0x60')][_0x58c6('0xa0')];return db[_0x58c6('0x3f')][_0x58c6('0x61')]({'where':{'id':_0x1c1f5a[_0x58c6('0x5e')]['id']},'attributes':['id',_0x58c6('0x3a'),'role',_0x58c6('0xa1'),_0x58c6('0xa2'),_0x58c6('0xa3'),_0x58c6('0xa4')]})['then'](handleEntityNotFound(_0x39a563,null))[_0x58c6('0x2b')](function(_0x26aba9){if(_0x26aba9){if(!utils[_0x58c6('0xa5')](_0x5bee9f)){throw new db['Sequelize']['ValidationError'](_0x58c6('0xa6'));}return _0x26aba9['add'+_[_0x58c6('0xa7')](_0x5bee9f[_0x58c6('0xa8')]())+_0x58c6('0xa9')](_0x1c1f5a[_0x58c6('0x60')]['ids'],{'penalty':_0x1c1f5a['body'][_0x58c6('0xaa')]||0x0})[_0x58c6('0xab')](function(_0x5cddc8){for(var _0x4f119c=0x0;_0x4f119c<_0x1c1f5a['body'][_0x58c6('0xac')]['length'];_0x4f119c+=0x1){var _0x1be375={'UserId':Number(_0x1c1f5a[_0x58c6('0x5e')]['id'])};_0x1be375[_['capitalize'](_0x5bee9f[_0x58c6('0xa8')]())+'QueueId']=Number(_0x1c1f5a[_0x58c6('0x60')][_0x58c6('0xac')][_0x4f119c]);socket[_0x58c6('0xad')]('user'+_[_0x58c6('0xa7')](_0x5bee9f[_0x58c6('0xa8')]())+'Queue:save',_0x1be375);}return _0x5cddc8;})['then'](function(){if(_0x5bee9f===_0x58c6('0xae')){return db[_0x58c6('0xaf')]['findAll']({'where':{'id':_0x1c1f5a[_0x58c6('0x60')]['ids']||[]},'raw':!![],'attributes':['id',_0x58c6('0x3a')]});}})[_0x58c6('0x2b')](function(_0x36f286){var _0x2f9e10=_0x26aba9[_0x58c6('0x30')]({'plain':!![]});var _0x43007b=[];if(_0x5bee9f===_0x58c6('0xae')&&_0x2f9e10[_0x58c6('0x2c')]===_0x58c6('0x2d')&&_0x2f9e10[_0x58c6('0xa1')]){for(let _0x42703f=0x0;_0x42703f<_0x36f286[_0x58c6('0x6f')];_0x42703f+=0x1){_0x43007b[_0x58c6('0x51')]({'membername':_0x2f9e10[_0x58c6('0x3a')],'UserId':_0x2f9e10['id'],'queue_name':_0x36f286[_0x42703f][_0x58c6('0x3a')],'VoiceQueueId':_0x36f286[_0x42703f]['id'],'interface':_[_0x58c6('0x6b')](_0x2f9e10[_0x58c6('0xa4')])?util['format'](_0x58c6('0xb0'),_0x2f9e10[_0x58c6('0x3a')]):_0x2f9e10[_0x58c6('0xa4')],'paused':_0x2f9e10[_0x58c6('0xa3')]||![],'penalty':_0x1c1f5a[_0x58c6('0x60')][_0x58c6('0xaa')]||0x0});}return Promise['all'](_0x43007b[_0x58c6('0x37')](function(_0x4e9e2b){return db['UserVoiceQueueRt'][_0x58c6('0xb1')](_0x4e9e2b);}));}return _0x26aba9;});}})['then'](respondWithStatusCode(_0x39a563,null))[_0x58c6('0x29')](handleError(_0x39a563,null));};exports[_0x58c6('0xb2')]=function(_0x2092b6,_0x28f206){var _0x498d4e,_0x4701b1;return db['User'][_0x58c6('0x61')]({'where':{'id':_0x2092b6[_0x58c6('0x5e')]['id']},'attributes':['id',_0x58c6('0x3a'),_0x58c6('0x2c')]})[_0x58c6('0x2b')](handleEntityNotFound(_0x28f206,null))[_0x58c6('0x2b')](function(_0x165a2e){if(_0x165a2e){_0x498d4e=_0x165a2e;if(!_0x2092b6['query'][_0x58c6('0xa0')]||!utils['isValidChannel'](_0x2092b6['query'][_0x58c6('0xa0')])){throw new db[(_0x58c6('0x94'))]['ValidationError'](_0x58c6('0xa6'));}return _0x165a2e[_0x58c6('0xb3')+_[_0x58c6('0xa7')](_0x2092b6[_0x58c6('0x4c')][_0x58c6('0xa0')][_0x58c6('0xa8')]())+'Queues'](_0x2092b6[_0x58c6('0x4c')][_0x58c6('0xac')]);}})[_0x58c6('0x2b')](function(_0x4f1327){if(_[_0x58c6('0xb4')](_0x2092b6[_0x58c6('0x4c')][_0x58c6('0xac')])){for(var _0x54ec55=0x0;_0x54ec55<_0x2092b6['query'][_0x58c6('0xac')][_0x58c6('0x6f')];_0x54ec55+=0x1){_0x4701b1={'UserId':Number(_0x2092b6['params']['id'])};_0x4701b1[_['capitalize'](_0x2092b6['query'][_0x58c6('0xa0')][_0x58c6('0xa8')]())+'QueueId']=Number(_0x2092b6['query'][_0x58c6('0xac')][_0x54ec55]);socket['emit'](_0x58c6('0x83')+_['capitalize'](_0x2092b6[_0x58c6('0x4c')][_0x58c6('0xa0')][_0x58c6('0xa8')]())+'Queue:remove',_0x4701b1);}}else{_0x4701b1={'UserId':Number(_0x2092b6[_0x58c6('0x5e')]['id'])};_0x4701b1[_[_0x58c6('0xa7')](_0x2092b6[_0x58c6('0x4c')][_0x58c6('0xa0')][_0x58c6('0xa8')]())+'QueueId']=Number(_0x2092b6[_0x58c6('0x4c')][_0x58c6('0xac')]);socket[_0x58c6('0xad')](_0x58c6('0x83')+_[_0x58c6('0xa7')](_0x2092b6[_0x58c6('0x4c')][_0x58c6('0xa0')]['toLowerCase']())+_0x58c6('0xb5'),_0x4701b1);}return _0x4f1327;})[_0x58c6('0x2b')](function(){if(_0x2092b6['query']['channel']===_0x58c6('0xae')){return db['UserVoiceQueueRt'][_0x58c6('0x2f')]({'where':{'UserId':_0x2092b6[_0x58c6('0x5e')]['id'],'VoiceQueueId':_0x2092b6[_0x58c6('0x4c')][_0x58c6('0xac')]},'individualHooks':!![]})[_0x58c6('0x2b')](function(){return _0x498d4e;});}return _0x498d4e;})[_0x58c6('0x2b')](respondWithStatusCode(_0x28f206,null))[_0x58c6('0x29')](handleError(_0x28f206,null));};exports[_0x58c6('0xb6')]=function(_0x1c5b3b,_0x9850f4){_0x1c5b3b[_0x58c6('0x60')][_0x58c6('0xb7')]=_0x1c5b3b[_0x58c6('0xb8')][_0x58c6('0xb9')];return db[_0x58c6('0x3f')][_0x58c6('0x61')]({'where':{'id':_0x1c5b3b['params']['id']}})[_0x58c6('0x2b')](handleEntityNotFound(_0x9850f4,null))[_0x58c6('0x2b')](saveUpdates(_0x1c5b3b[_0x58c6('0x60')],null))[_0x58c6('0x2b')](respondWithResult(_0x9850f4,null))[_0x58c6('0x29')](handleError(_0x9850f4,null));};exports[_0x58c6('0xba')]=function(_0x2abfbd,_0x52b898){var _0x9d5058=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0x58c6('0x3f')][_0x58c6('0x61')]({'where':{'id':_0x2abfbd[_0x58c6('0x5e')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x58c6('0x2b')](handleEntityNotFound(_0x52b898,null))['then'](function(_0x27c29e){if(_0x27c29e){if(_['isNil'](_0x27c29e['userpic'])){return _0x52b898['download'](_0x9d5058);}else{if(!fs[_0x58c6('0xbb')](path[_0x58c6('0xbc')](config[_0x58c6('0xbd')],_0x58c6('0xbe'),_0x27c29e[_0x58c6('0xb7')]))){return _0x52b898['download'](_0x9d5058);}return _0x52b898['download'](path[_0x58c6('0xbc')](config[_0x58c6('0xbd')],'server/files/images/',_0x27c29e['userpic']));}}})['catch'](handleError(_0x52b898,null));};exports[_0x58c6('0xbf')]=function(_0x418568,_0x3da2f8){return db['User'][_0x58c6('0x61')]({'where':{'id':_0x418568[_0x58c6('0x5e')]['id']},'attributes':['id']})[_0x58c6('0x2b')](handleEntityNotFound(_0x3da2f8,null))[_0x58c6('0x2b')](function(_0x5aaa8c){var _0x30306c=[];values=_0x5aaa8c[_0x58c6('0x56')];_0x30306c[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x55'),_0x5aaa8c[_0x58c6('0x56')]));_0x30306c[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x57'),_0x5aaa8c[_0x58c6('0x56')]));_0x30306c[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x5a'),_0x5aaa8c[_0x58c6('0x56')]));_0x30306c[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x5b'),_0x5aaa8c[_0x58c6('0x56')]));_0x30306c['push'](get_open_tabs(_0x58c6('0x58'),_0x5aaa8c[_0x58c6('0x56')]));_0x30306c[_0x58c6('0x51')](get_open_tabs(_0x58c6('0x59'),_0x5aaa8c[_0x58c6('0x56')]));return Promise['all'](_0x30306c);})[_0x58c6('0x2b')](function(_0x4ed0e9){if(_0x4ed0e9){var _0x4f5595=_[_0x58c6('0x37')](values[_0x58c6('0xc0')],function(_0x212be2){return{'channel':_0x58c6('0xc1'),'id':_0x212be2['id'],'createdAt':_0x212be2[_0x58c6('0xc2')]};});var _0x365fd6=_[_0x58c6('0x37')](values[_0x58c6('0xc3')],function(_0x543dd8){return{'channel':'FAX','id':_0x543dd8['id'],'createdAt':_0x543dd8[_0x58c6('0xc2')]};});var _0x37e5f1=_['map'](values['OpenchannelOpenTabs'],function(_0x4d5d52){return{'channel':'OPENCHANNEL','id':_0x4d5d52['id'],'createdAt':_0x4d5d52[_0x58c6('0xc2')]};});var _0xfcfcb7=_[_0x58c6('0x37')](values[_0x58c6('0xc4')],function(_0x4b1666){return{'channel':_0x58c6('0xc5'),'id':_0x4b1666['id'],'createdAt':_0x4b1666[_0x58c6('0xc2')]};});var _0x458ca7=_['map'](values['SmsOpenTabs'],function(_0x6896d5){return{'channel':_0x58c6('0xc6'),'id':_0x6896d5['id'],'createdAt':_0x6896d5[_0x58c6('0xc2')]};});var _0x231149=_[_0x58c6('0x37')](values[_0x58c6('0xc7')],function(_0x2fa69d){return{'channel':_0x58c6('0xc8'),'id':_0x2fa69d['id'],'createdAt':_0x2fa69d[_0x58c6('0xc2')]};});var _0x5247d9=_[_0x58c6('0xc9')](_0x4f5595,_0x365fd6,_0x37e5f1,_0xfcfcb7,_0x458ca7,_0x231149);var _0xb3891f={'count':_0x5247d9[_0x58c6('0x6f')],'rows':_0x5247d9};return _0xb3891f;}else return null;})[_0x58c6('0x2b')](respondWithResult(_0x3da2f8,null))[_0x58c6('0x29')](handleError(_0x3da2f8,null));};exports[_0x58c6('0xca')]=function(_0x26ed99,_0x488087){var _0x43831b={};return db['User'][_0x58c6('0xcb')]({'where':{'id':_0x26ed99[_0x58c6('0x5e')]['id']}})[_0x58c6('0x2b')](function(_0x1b094c){if(!_0x1b094c){throw new APINotFoundError(util['format'](_0x58c6('0xcc'),_0x26ed99[_0x58c6('0x5e')]['id']));}return contacts['describe']();})['then'](function(_0x44598c){_0x26ed99['query'][_0x58c6('0x3f')]=_0x26ed99[_0x58c6('0x5e')]['id'];_0x43831b=qs['getOptions'](_0x44598c,_0x26ed99);if(_0x26ed99[_0x58c6('0x4c')][_0x58c6('0xcd')](_0x58c6('0xce'))){_0x43831b[_0x58c6('0x4b')]=[{'model':db[_0x58c6('0xcf')],'as':_0x58c6('0xd0'),'required':![]},{'model':db[_0x58c6('0xd1')],'as':_0x58c6('0xd2'),'attributes':['id',_0x58c6('0x3a'),'color'],'where':_0x26ed99[_0x58c6('0x4c')][_0x58c6('0xd3')]?{'id':_0x26ed99[_0x58c6('0x4c')][_0x58c6('0xd3')]}:undefined,'required':_0x26ed99[_0x58c6('0x4c')]['tag']?!![]:![]}];}return contacts[_0x58c6('0x52')](_0x26ed99[_0x58c6('0x4c')],_0x26ed99[_0x58c6('0x83')],_0x43831b,_0x44598c);})['then'](respondWithFilteredResult(_0x488087,_0x43831b))[_0x58c6('0x29')](APIHandleError(_0x488087));};exports[_0x58c6('0xd4')]=function(_0x2d841a,_0x407e70){var _0x4de4fe;var _0x5d543f={};var _0x4067c6;return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0x2d841a['params']['id']},'attributes':['id',_0x58c6('0x3a'),_0x58c6('0x2c')]})[_0x58c6('0x2b')](handleEntityNotFound(_0x407e70,null))[_0x58c6('0x2b')](function(_0x446412){if(!utils[_0x58c6('0xa5')](_0x2d841a[_0x58c6('0x4c')]['channel'])){throw new db[(_0x58c6('0x94'))]['ValidationError']('Unknown\x20channel');}_0x4de4fe=_0x446412;var _0xb38ae5={};_0xb38ae5[_0x58c6('0xd5')]=_['keys'](db[_[_0x58c6('0xa7')](_0x2d841a[_0x58c6('0x4c')][_0x58c6('0xa0')])+_0x58c6('0xd6')]['rawAttributes']);_0xb38ae5['query']=_['keys'](_0x2d841a[_0x58c6('0x4c')]);_0xb38ae5['filters']=_[_0x58c6('0xd7')](_0xb38ae5[_0x58c6('0xd5')],_0xb38ae5[_0x58c6('0x4c')]);_0x5d543f[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0xb38ae5[_0x58c6('0xd5')],qs[_0x58c6('0xd8')](_0x2d841a[_0x58c6('0x4c')][_0x58c6('0xd8')]));_0x5d543f['attributes']=_0x5d543f['attributes'][_0x58c6('0x6f')]?_0x5d543f[_0x58c6('0x50')]:_0xb38ae5['model'];_0x5d543f[_0x58c6('0xd9')]=qs[_0x58c6('0xda')](_0x2d841a['query'][_0x58c6('0xda')]);_0x5d543f['where']=qs['filters'](_[_0x58c6('0xdb')](_0x2d841a['query'],_0xb38ae5['filters']));if(_0x2d841a[_0x58c6('0x4c')][_0x58c6('0x35')]){_0x5d543f[_0x58c6('0x4a')]=_[_0x58c6('0x5f')](_0x5d543f[_0x58c6('0x4a')],{'$or':_[_0x58c6('0x37')](_0x5d543f[_0x58c6('0x50')],function(_0x1011c4){var _0x190cff={};_0x190cff[_0x1011c4]={'$like':'%'+_0x2d841a[_0x58c6('0x4c')][_0x58c6('0x35')]+'%'};return _0x190cff;})});}_0x5d543f=_[_0x58c6('0x5f')]({},_0x5d543f,_0x2d841a['options']);switch(_0x4de4fe['role']){case _0x58c6('0x31'):return db[_['capitalize'](_0x2d841a[_0x58c6('0x4c')][_0x58c6('0xa0')])+_0x58c6('0xd6')][_0x58c6('0x52')](_0x5d543f);case _0x58c6('0x83'):case _0x58c6('0x2d'):return _0x4de4fe[_0x58c6('0x30')+_[_0x58c6('0xa7')](_0x2d841a[_0x58c6('0x4c')]['channel'])+_0x58c6('0xa9')](_0x5d543f);default:throw new db[(_0x58c6('0x94'))][(_0x58c6('0x95'))](_0x58c6('0xdc'));}})['then'](function(_0x46b0b1){_0x4067c6=_0x46b0b1[_0x58c6('0x6f')];if(!_0x2d841a[_0x58c6('0x4c')][_0x58c6('0xcd')](_0x58c6('0xdd'))){_0x5d543f[_0x58c6('0x1e')]=qs[_0x58c6('0x1e')](_0x2d841a[_0x58c6('0x4c')]['limit']);_0x5d543f[_0x58c6('0x1c')]=qs[_0x58c6('0x1c')](_0x2d841a[_0x58c6('0x4c')][_0x58c6('0x1c')]);}switch(_0x4de4fe[_0x58c6('0x2c')]){case _0x58c6('0x31'):return db[_[_0x58c6('0xa7')](_0x2d841a[_0x58c6('0x4c')][_0x58c6('0xa0')])+_0x58c6('0xd6')]['findAll'](_0x5d543f);case _0x58c6('0x83'):case _0x58c6('0x2d'):return _0x4de4fe[_0x58c6('0x30')+_[_0x58c6('0xa7')](_0x2d841a[_0x58c6('0x4c')][_0x58c6('0xa0')])+'Queues'](_0x5d543f);}})['then'](function(_0x351fa7){return{'count':_0x4067c6,'rows':_0x351fa7};})['then'](respondWithResult(_0x407e70,null))[_0x58c6('0x29')](handleError(_0x407e70,null));};exports[_0x58c6('0xde')]=function(_0x3fff78,_0x12bb37){var _0x18c8ab={};var _0x4c6552={};var _0xec8ceb;var _0x843393;return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0x3fff78['params']['id']}})['then'](handleEntityNotFound(_0x12bb37,null))[_0x58c6('0x2b')](function(_0x1d528b){if(_0x1d528b){_0xec8ceb=_0x1d528b;_0x4c6552[_0x58c6('0xd5')]=_[_0x58c6('0xdf')](db[_0x58c6('0xe0')][_0x58c6('0xe1')]);_0x4c6552[_0x58c6('0x4c')]=_[_0x58c6('0xdf')](_0x3fff78[_0x58c6('0x4c')]);_0x4c6552[_0x58c6('0xe2')]=_[_0x58c6('0xd7')](_0x4c6552[_0x58c6('0xd5')],_0x4c6552[_0x58c6('0x4c')]);_0x18c8ab[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0x4c6552['model'],qs['fields'](_0x3fff78[_0x58c6('0x4c')]['fields']));_0x18c8ab['attributes']=_0x18c8ab[_0x58c6('0x50')][_0x58c6('0x6f')]?_0x18c8ab[_0x58c6('0x50')]:_0x4c6552[_0x58c6('0xd5')];_0x18c8ab[_0x58c6('0xd9')]=qs[_0x58c6('0xda')](_0x3fff78['query'][_0x58c6('0xda')]);_0x18c8ab[_0x58c6('0x4a')]=qs[_0x58c6('0xe2')](_['pick'](_0x3fff78[_0x58c6('0x4c')],_0x4c6552[_0x58c6('0xe2')]));if(_0x3fff78[_0x58c6('0x4c')][_0x58c6('0x35')]){_0x18c8ab['where']=_['merge'](_0x18c8ab[_0x58c6('0x4a')],{'$or':_[_0x58c6('0x37')](_0x18c8ab[_0x58c6('0x50')],function(_0x2dcf22){var _0xcce251={};_0xcce251[_0x2dcf22]={'$like':'%'+_0x3fff78[_0x58c6('0x4c')][_0x58c6('0x35')]+'%'};return _0xcce251;})});}_0x18c8ab=_[_0x58c6('0x5f')]({},_0x18c8ab,_0x3fff78[_0x58c6('0xe3')]);return _0xec8ceb[_0x58c6('0xde')](_0x18c8ab);}})[_0x58c6('0x2b')](function(_0x1103d3){if(_0x1103d3){_0x843393=_0x1103d3[_0x58c6('0x6f')];if(!_0x3fff78['query'][_0x58c6('0xcd')]('nolimit')){_0x18c8ab['limit']=qs[_0x58c6('0x1e')](_0x3fff78[_0x58c6('0x4c')][_0x58c6('0x1e')]);_0x18c8ab[_0x58c6('0x1c')]=qs[_0x58c6('0x1c')](_0x3fff78[_0x58c6('0x4c')][_0x58c6('0x1c')]);}return _0xec8ceb['getVoiceQueuesRt'](_0x18c8ab);}})[_0x58c6('0x2b')](function(_0x46b73d){if(_0x46b73d){return _0x46b73d?{'count':_0x843393,'rows':_0x46b73d}:null;}})[_0x58c6('0x2b')](respondWithResult(_0x12bb37,null))[_0x58c6('0x29')](handleError(_0x12bb37,null));};exports[_0x58c6('0xe4')]=function(_0x1cd261,_0x3cf40b){var _0x21a000={};var _0x48dd53={};var _0x2ffb74;var _0x476ea8;return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0x1cd261[_0x58c6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3cf40b,null))[_0x58c6('0x2b')](function(_0x348a04){if(_0x348a04){_0x2ffb74=_0x348a04;_0x48dd53['model']=_[_0x58c6('0xdf')](db['ChatGroup'][_0x58c6('0xe1')]);_0x48dd53[_0x58c6('0x4c')]=_[_0x58c6('0xdf')](_0x1cd261[_0x58c6('0x4c')]);_0x48dd53[_0x58c6('0xe2')]=_[_0x58c6('0xd7')](_0x48dd53[_0x58c6('0xd5')],_0x48dd53['query']);_0x21a000[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0x48dd53[_0x58c6('0xd5')],qs['fields'](_0x1cd261[_0x58c6('0x4c')]['fields']));_0x21a000[_0x58c6('0x50')]=_0x21a000[_0x58c6('0x50')][_0x58c6('0x6f')]?_0x21a000[_0x58c6('0x50')]:_0x48dd53[_0x58c6('0xd5')];_0x21a000['order']=qs[_0x58c6('0xda')](_0x1cd261[_0x58c6('0x4c')][_0x58c6('0xda')]);_0x21a000[_0x58c6('0x4a')]=qs[_0x58c6('0xe2')](_[_0x58c6('0xdb')](_0x1cd261['query'],_0x48dd53['filters']));if(_0x1cd261['query'][_0x58c6('0x35')]){_0x21a000[_0x58c6('0x4a')]=_[_0x58c6('0x5f')](_0x21a000[_0x58c6('0x4a')],{'$or':_['map'](_0x21a000['attributes'],function(_0x6f406a){var _0xa30417={};_0xa30417[_0x6f406a]={'$like':'%'+_0x1cd261[_0x58c6('0x4c')][_0x58c6('0x35')]+'%'};return _0xa30417;})});}_0x21a000=_[_0x58c6('0x5f')]({},_0x21a000,_0x1cd261[_0x58c6('0xe3')]);return _0x2ffb74[_0x58c6('0xe4')](_0x21a000);}})[_0x58c6('0x2b')](function(_0xb1fb69){if(_0xb1fb69){_0x476ea8=_0xb1fb69[_0x58c6('0x6f')];if(!_0x1cd261[_0x58c6('0x4c')][_0x58c6('0xcd')](_0x58c6('0xdd'))){_0x21a000[_0x58c6('0x1e')]=qs[_0x58c6('0x1e')](_0x1cd261[_0x58c6('0x4c')][_0x58c6('0x1e')]);_0x21a000['offset']=qs[_0x58c6('0x1c')](_0x1cd261[_0x58c6('0x4c')]['offset']);}return _0x2ffb74[_0x58c6('0xe4')](_0x21a000);}})['then'](function(_0x40146e){if(_0x40146e){return _0x40146e?{'count':_0x476ea8,'rows':_0x40146e}:null;}})[_0x58c6('0x2b')](respondWithResult(_0x3cf40b,null))[_0x58c6('0x29')](handleError(_0x3cf40b,null));};exports[_0x58c6('0xe5')]=function(_0x39d227,_0x39754e){var _0x45ba6b={'raw':!![],'where':{}};var _0x1539eb={};var _0xdd1708={'count':0x0,'rows':[]};return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0x39d227['params']['id']}})[_0x58c6('0x2b')](handleEntityNotFound(_0x39754e,null))[_0x58c6('0x2b')](function(_0x4e9e14){if(_0x4e9e14){_0x1539eb[_0x58c6('0xd5')]=_[_0x58c6('0xdf')](db[_0x58c6('0xe6')][_0x58c6('0xe1')]);_0x1539eb[_0x58c6('0x4c')]=_['keys'](_0x39d227[_0x58c6('0x4c')]);_0x1539eb['filters']=_[_0x58c6('0xd7')](_0x1539eb[_0x58c6('0xd5')],_0x1539eb['query']);_0x45ba6b[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0x1539eb[_0x58c6('0xd5')],qs['fields'](_0x39d227[_0x58c6('0x4c')][_0x58c6('0xd8')]));_0x45ba6b['attributes']=_0x45ba6b[_0x58c6('0x50')]['length']?_0x45ba6b[_0x58c6('0x50')]:_0x1539eb[_0x58c6('0xd5')];if(!_0x39d227[_0x58c6('0x4c')]['hasOwnProperty'](_0x58c6('0xdd'))){_0x45ba6b['limit']=qs[_0x58c6('0x1e')](_0x39d227[_0x58c6('0x4c')][_0x58c6('0x1e')]);_0x45ba6b[_0x58c6('0x1c')]=qs[_0x58c6('0x1c')](_0x39d227[_0x58c6('0x4c')][_0x58c6('0x1c')]);}_0x45ba6b[_0x58c6('0xd9')]=qs[_0x58c6('0xda')](_0x39d227[_0x58c6('0x4c')][_0x58c6('0xda')]);_0x45ba6b[_0x58c6('0x4a')]=qs['filters'](_[_0x58c6('0xdb')](_0x39d227[_0x58c6('0x4c')],_0x1539eb[_0x58c6('0xe2')]));_0x45ba6b['where'][_0x58c6('0xe7')]=_0x4e9e14['id'];if(_0x39d227['query'][_0x58c6('0x35')]){_0x45ba6b[_0x58c6('0x4a')]=_[_0x58c6('0x5f')](_0x45ba6b['where'],{'$or':_['map'](_0x45ba6b['attributes'],function(_0x58014f){var _0x3ed4b0={};_0x3ed4b0[_0x58014f]={'$like':'%'+_0x39d227[_0x58c6('0x4c')][_0x58c6('0x35')]+'%'};return _0x3ed4b0;})});}_0x45ba6b=_[_0x58c6('0x5f')]({},_0x45ba6b,_0x39d227['options']);return db[_0x58c6('0xe6')]['count']({'where':_0x45ba6b[_0x58c6('0x4a')]})[_0x58c6('0x2b')](function(_0x57d40c){_0xdd1708['count']=_0x57d40c;if(_0x39d227[_0x58c6('0x4c')]['includeAll']){_0x45ba6b[_0x58c6('0x4b')]=[{'all':!![]}];}return db[_0x58c6('0xe6')][_0x58c6('0x52')](_0x45ba6b);})['then'](function(_0x3870c5){_0xdd1708[_0x58c6('0x53')]=_0x3870c5;return _0xdd1708;});}})[_0x58c6('0x2b')](respondWithFilteredResult(_0x39754e,_0x45ba6b))['catch'](handleError(_0x39754e,null));};exports[_0x58c6('0xe8')]=function(_0x3c63a6,_0x2bc1b2){var _0x57ba46={'raw':!![],'where':{}};var _0x48b9c3={};var _0x87a80e={'count':0x0,'rows':[]};return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0x3c63a6['params']['id']}})[_0x58c6('0x2b')](handleEntityNotFound(_0x2bc1b2,null))[_0x58c6('0x2b')](function(_0x49543a){if(_0x49543a){_0x48b9c3['model']=_['keys'](db[_0x58c6('0xe9')][_0x58c6('0xe1')]);_0x48b9c3[_0x58c6('0x4c')]=_[_0x58c6('0xdf')](_0x3c63a6['query']);_0x48b9c3[_0x58c6('0xe2')]=_[_0x58c6('0xd7')](_0x48b9c3[_0x58c6('0xd5')],_0x48b9c3[_0x58c6('0x4c')]);_0x57ba46[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0x48b9c3[_0x58c6('0xd5')],qs[_0x58c6('0xd8')](_0x3c63a6[_0x58c6('0x4c')]['fields']));_0x57ba46[_0x58c6('0x50')]=_0x57ba46['attributes'][_0x58c6('0x6f')]?_0x57ba46[_0x58c6('0x50')]:_0x48b9c3['model'];if(!_0x3c63a6[_0x58c6('0x4c')][_0x58c6('0xcd')](_0x58c6('0xdd'))){_0x57ba46[_0x58c6('0x1e')]=qs[_0x58c6('0x1e')](_0x3c63a6['query'][_0x58c6('0x1e')]);_0x57ba46[_0x58c6('0x1c')]=qs[_0x58c6('0x1c')](_0x3c63a6[_0x58c6('0x4c')]['offset']);}_0x57ba46[_0x58c6('0xd9')]=qs[_0x58c6('0xda')](_0x3c63a6[_0x58c6('0x4c')]['sort']);_0x57ba46[_0x58c6('0x4a')]=qs[_0x58c6('0xe2')](_['pick'](_0x3c63a6['query'],_0x48b9c3[_0x58c6('0xe2')]));_0x57ba46[_0x58c6('0x4a')][_0x58c6('0xe7')]=_0x49543a['id'];if(_0x3c63a6[_0x58c6('0x4c')][_0x58c6('0x35')]){_0x57ba46[_0x58c6('0x4a')]=_[_0x58c6('0x5f')](_0x57ba46[_0x58c6('0x4a')],{'$or':_['map'](_0x57ba46[_0x58c6('0x50')],function(_0x3bcdbf){var _0x4e924a={};_0x4e924a[_0x3bcdbf]={'$like':'%'+_0x3c63a6['query'][_0x58c6('0x35')]+'%'};return _0x4e924a;})});}_0x57ba46=_['merge']({},_0x57ba46,_0x3c63a6[_0x58c6('0xe3')]);return db[_0x58c6('0xe9')]['count']({'where':_0x57ba46['where']})['then'](function(_0x1ffbf1){_0x87a80e[_0x58c6('0x1f')]=_0x1ffbf1;if(_0x3c63a6['query'][_0x58c6('0xce')]){_0x57ba46[_0x58c6('0x4b')]=[{'all':!![]}];}return db['ScreenRecording'][_0x58c6('0x52')](_0x57ba46);})[_0x58c6('0x2b')](function(_0x4d2036){_0x87a80e[_0x58c6('0x53')]=_0x4d2036;return _0x87a80e;});}})[_0x58c6('0x2b')](respondWithFilteredResult(_0x2bc1b2,_0x57ba46))['catch'](handleError(_0x2bc1b2,null));};exports[_0x58c6('0xea')]=function(_0x597e63,_0x330c09){var _0x3176cb={};var _0x5edc46={};var _0x35baa4;var _0x3f6407;return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0x597e63[_0x58c6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x330c09,null))[_0x58c6('0x2b')](function(_0x22297e){if(_0x22297e){_0x35baa4=_0x22297e;_0x5edc46[_0x58c6('0xd5')]=_[_0x58c6('0xdf')](db[_0x58c6('0xeb')][_0x58c6('0xe1')]);_0x5edc46['query']=_[_0x58c6('0xdf')](_0x597e63[_0x58c6('0x4c')]);_0x5edc46[_0x58c6('0xe2')]=_[_0x58c6('0xd7')](_0x5edc46[_0x58c6('0xd5')],_0x5edc46[_0x58c6('0x4c')]);_0x3176cb[_0x58c6('0x50')]=_['intersection'](_0x5edc46[_0x58c6('0xd5')],qs[_0x58c6('0xd8')](_0x597e63[_0x58c6('0x4c')]['fields']));_0x3176cb[_0x58c6('0x50')]=_0x3176cb['attributes'][_0x58c6('0x6f')]?_0x3176cb['attributes']:_0x5edc46['model'];_0x3176cb[_0x58c6('0xd9')]=qs[_0x58c6('0xda')](_0x597e63['query']['sort']);_0x3176cb['where']=qs['filters'](_['pick'](_0x597e63[_0x58c6('0x4c')],_0x5edc46[_0x58c6('0xe2')]));if(_0x597e63[_0x58c6('0x4c')][_0x58c6('0x35')]){_0x3176cb['where']=_[_0x58c6('0x5f')](_0x3176cb[_0x58c6('0x4a')],{'$or':_[_0x58c6('0x37')](_0x3176cb['attributes'],function(_0x3b912e){var _0x2ba2a7={};_0x2ba2a7[_0x3b912e]={'$like':'%'+_0x597e63[_0x58c6('0x4c')][_0x58c6('0x35')]+'%'};return _0x2ba2a7;})});}_0x3176cb=_[_0x58c6('0x5f')]({},_0x3176cb,_0x597e63[_0x58c6('0xe3')]);return _0x35baa4[_0x58c6('0xea')](_0x3176cb);}})[_0x58c6('0x2b')](function(_0x22a62f){if(_0x22a62f){_0x3f6407=_0x22a62f[_0x58c6('0x6f')];if(!_0x597e63[_0x58c6('0x4c')][_0x58c6('0xcd')](_0x58c6('0xdd'))){_0x3176cb[_0x58c6('0x1e')]=qs[_0x58c6('0x1e')](_0x597e63[_0x58c6('0x4c')][_0x58c6('0x1e')]);_0x3176cb[_0x58c6('0x1c')]=qs['offset'](_0x597e63['query'][_0x58c6('0x1c')]);}return _0x35baa4[_0x58c6('0xea')](_0x3176cb);}})['then'](function(_0x293cef){if(_0x293cef){return _0x293cef?{'count':_0x3f6407,'rows':_0x293cef}:null;}})[_0x58c6('0x2b')](respondWithResult(_0x330c09,null))['catch'](handleError(_0x330c09,null));};exports[_0x58c6('0xec')]=function(_0x571779,_0x10ae01){var _0x3f0ae6={};var _0x19f1d2={};var _0x4de03f;var _0xc98106;return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0x571779[_0x58c6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x10ae01,null))[_0x58c6('0x2b')](function(_0x2e41ed){if(_0x2e41ed){_0x4de03f=_0x2e41ed;_0x19f1d2[_0x58c6('0xd5')]=_[_0x58c6('0xdf')](db['OpenchannelInteraction'][_0x58c6('0xe1')]);_0x19f1d2['query']=_[_0x58c6('0xdf')](_0x571779['query']);_0x19f1d2['filters']=_[_0x58c6('0xd7')](_0x19f1d2[_0x58c6('0xd5')],_0x19f1d2[_0x58c6('0x4c')]);_0x3f0ae6[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0x19f1d2['model'],qs['fields'](_0x571779[_0x58c6('0x4c')][_0x58c6('0xd8')]));_0x3f0ae6[_0x58c6('0x50')]=_0x3f0ae6['attributes'][_0x58c6('0x6f')]?_0x3f0ae6[_0x58c6('0x50')]:_0x19f1d2[_0x58c6('0xd5')];_0x3f0ae6[_0x58c6('0xd9')]=qs['sort'](_0x571779[_0x58c6('0x4c')][_0x58c6('0xda')]);_0x3f0ae6[_0x58c6('0x4a')]=qs[_0x58c6('0xe2')](_[_0x58c6('0xdb')](_0x571779[_0x58c6('0x4c')],_0x19f1d2['filters']));if(_0x571779[_0x58c6('0x4c')][_0x58c6('0x35')]){_0x3f0ae6[_0x58c6('0x4a')]=_[_0x58c6('0x5f')](_0x3f0ae6[_0x58c6('0x4a')],{'$or':_[_0x58c6('0x37')](_0x3f0ae6['attributes'],function(_0x53b3ad){var _0x1d7857={};_0x1d7857[_0x53b3ad]={'$like':'%'+_0x571779['query'][_0x58c6('0x35')]+'%'};return _0x1d7857;})});}_0x3f0ae6=_[_0x58c6('0x5f')]({},_0x3f0ae6,_0x571779[_0x58c6('0xe3')]);return _0x4de03f[_0x58c6('0xec')](_0x3f0ae6);}})[_0x58c6('0x2b')](function(_0x2f6259){if(_0x2f6259){_0xc98106=_0x2f6259[_0x58c6('0x6f')];if(!_0x571779[_0x58c6('0x4c')][_0x58c6('0xcd')](_0x58c6('0xdd'))){_0x3f0ae6[_0x58c6('0x1e')]=qs['limit'](_0x571779['query']['limit']);_0x3f0ae6[_0x58c6('0x1c')]=qs[_0x58c6('0x1c')](_0x571779[_0x58c6('0x4c')][_0x58c6('0x1c')]);}return _0x4de03f[_0x58c6('0xec')](_0x3f0ae6);}})[_0x58c6('0x2b')](function(_0x95cdb4){if(_0x95cdb4){return _0x95cdb4?{'count':_0xc98106,'rows':_0x95cdb4}:null;}})[_0x58c6('0x2b')](respondWithResult(_0x10ae01,null))[_0x58c6('0x29')](handleError(_0x10ae01,null));};exports[_0x58c6('0xed')]=function(_0xfa9e9b,_0x1a13d7){var _0x180c67={'raw':!![],'where':{}};var _0xcde267={};var _0x5526bf={'count':0x0,'rows':[]};return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0xfa9e9b[_0x58c6('0x5e')]['id']}})[_0x58c6('0x2b')](handleEntityNotFound(_0x1a13d7,null))[_0x58c6('0x2b')](function(_0x45a161){if(_0x45a161){_0xcde267['model']=_[_0x58c6('0xdf')](db[_0x58c6('0xee')]['rawAttributes']);_0xcde267[_0x58c6('0x4c')]=_[_0x58c6('0xdf')](_0xfa9e9b[_0x58c6('0x4c')]);_0xcde267[_0x58c6('0xe2')]=_[_0x58c6('0xd7')](_0xcde267[_0x58c6('0xd5')],_0xcde267[_0x58c6('0x4c')]);_0x180c67[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0xcde267[_0x58c6('0xd5')],qs[_0x58c6('0xd8')](_0xfa9e9b[_0x58c6('0x4c')][_0x58c6('0xd8')]));_0x180c67[_0x58c6('0x50')]=_0x180c67[_0x58c6('0x50')][_0x58c6('0x6f')]?_0x180c67[_0x58c6('0x50')]:_0xcde267['model'];if(!_0xfa9e9b[_0x58c6('0x4c')]['hasOwnProperty'](_0x58c6('0xdd'))){_0x180c67[_0x58c6('0x1e')]=qs[_0x58c6('0x1e')](_0xfa9e9b[_0x58c6('0x4c')][_0x58c6('0x1e')]);_0x180c67[_0x58c6('0x1c')]=qs['offset'](_0xfa9e9b[_0x58c6('0x4c')][_0x58c6('0x1c')]);}_0x180c67[_0x58c6('0xd9')]=qs[_0x58c6('0xda')](_0xfa9e9b['query']['sort']);_0x180c67['where']=qs[_0x58c6('0xe2')](_[_0x58c6('0xdb')](_0xfa9e9b[_0x58c6('0x4c')],_0xcde267[_0x58c6('0xe2')]));_0x180c67[_0x58c6('0x4a')]['UserId']=_0x45a161['id'];if(_0xfa9e9b[_0x58c6('0x4c')][_0x58c6('0x35')]){_0x180c67[_0x58c6('0x4a')]=_['merge'](_0x180c67['where'],{'$or':_[_0x58c6('0x37')](_0x180c67[_0x58c6('0x50')],function(_0x33e78d){var _0x222497={};_0x222497[_0x33e78d]={'$like':'%'+_0xfa9e9b[_0x58c6('0x4c')][_0x58c6('0x35')]+'%'};return _0x222497;})});}_0x180c67=_['merge']({},_0x180c67,_0xfa9e9b[_0x58c6('0xe3')]);return db[_0x58c6('0xee')]['count']({'where':_0x180c67['where']})[_0x58c6('0x2b')](function(_0x48366a){_0x5526bf['count']=_0x48366a;if(_0xfa9e9b[_0x58c6('0x4c')][_0x58c6('0xce')]){_0x180c67[_0x58c6('0x4b')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x180c67);})[_0x58c6('0x2b')](function(_0x10bc73){_0x5526bf[_0x58c6('0x53')]=_0x10bc73;return _0x5526bf;});}})['then'](respondWithFilteredResult(_0x1a13d7,_0x180c67))[_0x58c6('0x29')](handleError(_0x1a13d7,null));};exports[_0x58c6('0xef')]=function(_0x4cb1ad,_0x1b7951){var _0x282d19={};var _0x1b0cfe={};var _0x7e0558;var _0x427f3e;return db['User'][_0x58c6('0xcb')]({'where':{'id':_0x4cb1ad[_0x58c6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1b7951,null))['then'](function(_0x27f429){if(_0x27f429){_0x7e0558=_0x27f429;_0x1b0cfe[_0x58c6('0xd5')]=_[_0x58c6('0xdf')](db['SmsInteraction']['rawAttributes']);_0x1b0cfe[_0x58c6('0x4c')]=_[_0x58c6('0xdf')](_0x4cb1ad['query']);_0x1b0cfe[_0x58c6('0xe2')]=_[_0x58c6('0xd7')](_0x1b0cfe[_0x58c6('0xd5')],_0x1b0cfe['query']);_0x282d19[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0x1b0cfe[_0x58c6('0xd5')],qs[_0x58c6('0xd8')](_0x4cb1ad[_0x58c6('0x4c')]['fields']));_0x282d19[_0x58c6('0x50')]=_0x282d19[_0x58c6('0x50')][_0x58c6('0x6f')]?_0x282d19[_0x58c6('0x50')]:_0x1b0cfe['model'];_0x282d19[_0x58c6('0xd9')]=qs[_0x58c6('0xda')](_0x4cb1ad[_0x58c6('0x4c')][_0x58c6('0xda')]);_0x282d19[_0x58c6('0x4a')]=qs[_0x58c6('0xe2')](_[_0x58c6('0xdb')](_0x4cb1ad[_0x58c6('0x4c')],_0x1b0cfe[_0x58c6('0xe2')]));if(_0x4cb1ad['query'][_0x58c6('0x35')]){_0x282d19[_0x58c6('0x4a')]=_[_0x58c6('0x5f')](_0x282d19[_0x58c6('0x4a')],{'$or':_[_0x58c6('0x37')](_0x282d19['attributes'],function(_0x5e128d){var _0x4740d8={};_0x4740d8[_0x5e128d]={'$like':'%'+_0x4cb1ad['query'][_0x58c6('0x35')]+'%'};return _0x4740d8;})});}_0x282d19=_['merge']({},_0x282d19,_0x4cb1ad[_0x58c6('0xe3')]);return _0x7e0558[_0x58c6('0xef')](_0x282d19);}})['then'](function(_0x41a3ee){if(_0x41a3ee){_0x427f3e=_0x41a3ee[_0x58c6('0x6f')];if(!_0x4cb1ad[_0x58c6('0x4c')][_0x58c6('0xcd')](_0x58c6('0xdd'))){_0x282d19['limit']=qs[_0x58c6('0x1e')](_0x4cb1ad[_0x58c6('0x4c')][_0x58c6('0x1e')]);_0x282d19[_0x58c6('0x1c')]=qs[_0x58c6('0x1c')](_0x4cb1ad[_0x58c6('0x4c')][_0x58c6('0x1c')]);}return _0x7e0558['getSmsInteractions'](_0x282d19);}})[_0x58c6('0x2b')](function(_0x137baf){if(_0x137baf){return _0x137baf?{'count':_0x427f3e,'rows':_0x137baf}:null;}})[_0x58c6('0x2b')](respondWithResult(_0x1b7951,null))[_0x58c6('0x29')](handleError(_0x1b7951,null));};exports['getFaxInteractions']=function(_0x3682ce,_0x38e908){var _0x150fe4={};var _0x2cea40={};var _0x158b81;var _0x473cb5;return db['User'][_0x58c6('0xcb')]({'where':{'id':_0x3682ce['params']['id']}})['then'](handleEntityNotFound(_0x38e908,null))[_0x58c6('0x2b')](function(_0x4d71af){if(_0x4d71af){_0x158b81=_0x4d71af;_0x2cea40[_0x58c6('0xd5')]=_[_0x58c6('0xdf')](db['FaxInteraction']['rawAttributes']);_0x2cea40[_0x58c6('0x4c')]=_[_0x58c6('0xdf')](_0x3682ce[_0x58c6('0x4c')]);_0x2cea40['filters']=_[_0x58c6('0xd7')](_0x2cea40[_0x58c6('0xd5')],_0x2cea40[_0x58c6('0x4c')]);_0x150fe4[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0x2cea40[_0x58c6('0xd5')],qs[_0x58c6('0xd8')](_0x3682ce['query'][_0x58c6('0xd8')]));_0x150fe4[_0x58c6('0x50')]=_0x150fe4[_0x58c6('0x50')][_0x58c6('0x6f')]?_0x150fe4[_0x58c6('0x50')]:_0x2cea40['model'];_0x150fe4[_0x58c6('0xd9')]=qs['sort'](_0x3682ce[_0x58c6('0x4c')]['sort']);_0x150fe4[_0x58c6('0x4a')]=qs[_0x58c6('0xe2')](_['pick'](_0x3682ce[_0x58c6('0x4c')],_0x2cea40['filters']));if(_0x3682ce[_0x58c6('0x4c')]['filter']){_0x150fe4[_0x58c6('0x4a')]=_[_0x58c6('0x5f')](_0x150fe4[_0x58c6('0x4a')],{'$or':_['map'](_0x150fe4['attributes'],function(_0x2ba5c0){var _0x185045={};_0x185045[_0x2ba5c0]={'$like':'%'+_0x3682ce['query']['filter']+'%'};return _0x185045;})});}_0x150fe4=_['merge']({},_0x150fe4,_0x3682ce[_0x58c6('0xe3')]);return _0x158b81[_0x58c6('0xf0')](_0x150fe4);}})[_0x58c6('0x2b')](function(_0x3379dd){if(_0x3379dd){_0x473cb5=_0x3379dd[_0x58c6('0x6f')];if(!_0x3682ce[_0x58c6('0x4c')]['hasOwnProperty'](_0x58c6('0xdd'))){_0x150fe4[_0x58c6('0x1e')]=qs[_0x58c6('0x1e')](_0x3682ce[_0x58c6('0x4c')][_0x58c6('0x1e')]);_0x150fe4[_0x58c6('0x1c')]=qs['offset'](_0x3682ce[_0x58c6('0x4c')][_0x58c6('0x1c')]);}return _0x158b81[_0x58c6('0xf0')](_0x150fe4);}})[_0x58c6('0x2b')](function(_0x1d5222){if(_0x1d5222){return _0x1d5222?{'count':_0x473cb5,'rows':_0x1d5222}:null;}})['then'](respondWithResult(_0x38e908,null))['catch'](handleError(_0x38e908,null));};exports[_0x58c6('0xf1')]=function(_0x2fa8b9,_0xb759f){var _0x3479d7={};var _0x4f20e1={};var _0x4988e0;var _0x48a369;return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0x2fa8b9[_0x58c6('0x5e')]['id']}})['then'](handleEntityNotFound(_0xb759f,null))[_0x58c6('0x2b')](function(_0x21c9be){if(_0x21c9be){_0x4988e0=_0x21c9be;_0x4f20e1[_0x58c6('0xd5')]=_['keys'](db[_0x58c6('0xf2')][_0x58c6('0xe1')]);_0x4f20e1[_0x58c6('0x4c')]=_['keys'](_0x2fa8b9[_0x58c6('0x4c')]);_0x4f20e1[_0x58c6('0xe2')]=_[_0x58c6('0xd7')](_0x4f20e1[_0x58c6('0xd5')],_0x4f20e1[_0x58c6('0x4c')]);_0x3479d7[_0x58c6('0x50')]=_['intersection'](_0x4f20e1[_0x58c6('0xd5')],qs[_0x58c6('0xd8')](_0x2fa8b9[_0x58c6('0x4c')][_0x58c6('0xd8')]));_0x3479d7['attributes']=_0x3479d7[_0x58c6('0x50')]['length']?_0x3479d7['attributes']:_0x4f20e1['model'];_0x3479d7[_0x58c6('0xd9')]=qs[_0x58c6('0xda')](_0x2fa8b9[_0x58c6('0x4c')]['sort']);_0x3479d7[_0x58c6('0x4a')]=qs[_0x58c6('0xe2')](_[_0x58c6('0xdb')](_0x2fa8b9['query'],_0x4f20e1[_0x58c6('0xe2')]));if(_0x2fa8b9[_0x58c6('0x4c')]['filter']){_0x3479d7[_0x58c6('0x4a')]=_[_0x58c6('0x5f')](_0x3479d7[_0x58c6('0x4a')],{'$or':_[_0x58c6('0x37')](_0x3479d7[_0x58c6('0x50')],function(_0x42fc54){var _0x4be767={};_0x4be767[_0x42fc54]={'$like':'%'+_0x2fa8b9[_0x58c6('0x4c')][_0x58c6('0x35')]+'%'};return _0x4be767;})});}_0x3479d7=_[_0x58c6('0x5f')]({},_0x3479d7,_0x2fa8b9[_0x58c6('0xe3')]);return _0x4988e0['getWhatsappInteractions'](_0x3479d7);}})[_0x58c6('0x2b')](function(_0x41c036){if(_0x41c036){_0x48a369=_0x41c036[_0x58c6('0x6f')];if(!_0x2fa8b9[_0x58c6('0x4c')][_0x58c6('0xcd')]('nolimit')){_0x3479d7[_0x58c6('0x1e')]=qs[_0x58c6('0x1e')](_0x2fa8b9['query'][_0x58c6('0x1e')]);_0x3479d7[_0x58c6('0x1c')]=qs[_0x58c6('0x1c')](_0x2fa8b9[_0x58c6('0x4c')]['offset']);}return _0x4988e0['getWhatsappInteractions'](_0x3479d7);}})['then'](function(_0x3d9bfe){if(_0x3d9bfe){return _0x3d9bfe?{'count':_0x48a369,'rows':_0x3d9bfe}:null;}})[_0x58c6('0x2b')](respondWithResult(_0xb759f,null))[_0x58c6('0x29')](handleError(_0xb759f,null));};exports['login']=function(_0x474c6d,_0x4e0cd0,_0x1caef8){var _0xd7bb77;var _0x4269a0;var _0x4a4b6a;var _0x576220=!_[_0x58c6('0x6b')](_0x474c6d[_0x58c6('0x5e')]['id'])?_0x474c6d[_0x58c6('0x5e')]['id']:!_[_0x58c6('0x6b')](_0x474c6d[_0x58c6('0x83')]['id'])?_0x474c6d[_0x58c6('0x83')]['id']:null;return db[_0x58c6('0x3f')]['find']({'where':{'id':_0x576220,'role':{'$or':['admin','user','agent']}},'attributes':['id',_0x58c6('0x3a'),_0x58c6('0xf3'),_0x58c6('0xf4'),_0x58c6('0x2c'),_0x58c6('0x69'),'loginInPause']})[_0x58c6('0x2b')](function(_0x361755){if(_0x361755){if(_0x361755['role']===_0x58c6('0x2d')){_0xd7bb77=_0x361755;if(_0x474c6d['body']['interface']){_0x4a4b6a=util[_0x58c6('0xf5')](_0x58c6('0xf6'),_0xd7bb77[_0x474c6d['body'][_0x58c6('0xa4')]]);}else if(_0x474c6d[_0x58c6('0x60')]['intrf']){_0x4a4b6a=util['format'](_0x58c6('0xb0'),_0x474c6d[_0x58c6('0x60')]['intrf']);}else{_0x4a4b6a=util[_0x58c6('0xf5')](_0x58c6('0xb0'),_0xd7bb77['name']);}socket['to'](util[_0x58c6('0xf5')]('user:%s',_0xd7bb77['name']))['emit'](_0x58c6('0xf7'),{'user':{'id':_0xd7bb77['id'],'name':_0xd7bb77[_0x58c6('0x3a')]},'ip':_0x474c6d[_0x58c6('0xf8')][_0x58c6('0xf9')]||_0x474c6d[_0x58c6('0xfa')]['remoteAddress']||_0x474c6d[_0x58c6('0xfb')][_0x58c6('0xfc')]||_0x474c6d['connection'][_0x58c6('0xfb')]['remoteAddress']});return new Promise(function(_0x45142b,_0x52dc45){db[_0x58c6('0x6c')][_0x58c6('0xfd')]()[_0x58c6('0x2b')](_0x576613=>{db['UserVoiceQueueRt'][_0x58c6('0x2f')]({'where':{'membername':_0xd7bb77[_0x58c6('0x3a')]},'individualHooks':!![]},{'transaction':_0x576613})[_0x58c6('0x2b')](function(){return _0x576613[_0x58c6('0xfe')]();})[_0x58c6('0x2b')](_0x45142b)['catch'](_0x52dc45);});});}}else{throw new db[(_0x58c6('0x94'))]['ValidationError'](_0x58c6('0xff'));}})[_0x58c6('0x2b')](function(){if(_0xd7bb77){return _0xd7bb77[_0x58c6('0x100')]({'raw':!![]});}})[_0x58c6('0x2b')](function(_0x5eac07){if(_0xd7bb77){if(_0x5eac07){_0x4269a0=_0x5eac07;if(_0x4269a0[_0x58c6('0x6f')]){var _0x337f88=_0x4269a0[_0x58c6('0x37')](function(_0x17f4b7){return{'membername':_0xd7bb77['name'],'UserId':_0xd7bb77['id'],'queue_name':_0x17f4b7[_0x58c6('0x3a')],'VoiceQueueId':_0x17f4b7['id'],'interface':_0x4a4b6a,'paused':_0xd7bb77[_0x58c6('0xa2')]||![],'penalty':_0x17f4b7[_0x58c6('0x101')]||0x0};});return db[_0x58c6('0xe0')][_0x58c6('0x102')](_0x337f88);}}}})[_0x58c6('0x2b')](function(){if(_0xd7bb77){return db[_0x58c6('0x103')][_0x58c6('0x52')]({'where':{'membername':_0xd7bb77['name'],'exitAt':null}});}})[_0x58c6('0x2b')](function(_0x441e73){if(_0xd7bb77){var _0x1da599=[];_0x441e73['forEach'](function(_0xdc0fb4){_0x1da599['push'](_0xdc0fb4[_0x58c6('0x2a')]({'exitAt':moment()['format'](_0x58c6('0x104'))}));});return Promise[_0x58c6('0x5c')](_0x1da599);}})[_0x58c6('0x2b')](function(){if(_0xd7bb77){var _0x59ff0c=[];var _0x489ff4=[];var _0x2d970f=utils[_0x58c6('0x105')]();var _0x3213f3={'membername':_0xd7bb77['name'],'interface':_0x4a4b6a,'enterAt':moment()[_0x58c6('0xf5')](_0x58c6('0x104')),'role':_0xd7bb77[_0x58c6('0x2c')],'internal':_0xd7bb77['internal']};_0x2d970f['forEach'](function(_0x5639a6){_0x59ff0c['push'](_['merge']({'channel':_0x5639a6,'type':_0x58c6('0x106'),'data1':_0x474c6d[_0x58c6('0x60')][_0x58c6('0x107')],'data2':_0x4a4b6a},_0x3213f3));if(_0xd7bb77[_0x58c6('0xa2')]){_0x489ff4[_0x58c6('0x51')](_[_0x58c6('0x5f')]({'channel':_0x5639a6,'type':'PAUSE','data1':'LOGININPAUSE'},_0x3213f3));}});return db[_0x58c6('0x103')]['bulkCreate'](_0x59ff0c[_0x58c6('0xc9')](_0x489ff4),{'individualHooks':!![]});}})['then'](function(){if(_0xd7bb77){return _0xd7bb77[_0x58c6('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x58c6('0x104')),'voicePause':_0xd7bb77[_0x58c6('0xa2')]||![],'mailPause':_0xd7bb77[_0x58c6('0xa2')]||![],'chatPause':_0xd7bb77[_0x58c6('0xa2')]||![],'faxPause':_0xd7bb77[_0x58c6('0xa2')]||![],'smsPause':_0xd7bb77['loginInPause']||![],'openchannelPause':_0xd7bb77['loginInPause']||![],'whatsappPause':_0xd7bb77[_0x58c6('0xa2')]||![],'pauseType':_0xd7bb77[_0x58c6('0xa2')]?_0x58c6('0x108'):null,'interface':_0x4a4b6a,'lastPauseAt':moment()[_0x58c6('0xf5')](_0x58c6('0x104'))});}})['then'](function(_0x11463f){if(_0x474c6d[_0x58c6('0x109')]){return _0x1caef8();}else{return Promise['resolve'](_0x11463f)['then'](respondWithResult(_0x4e0cd0,null));}})['catch'](handleError(_0x4e0cd0,null));};exports[_0x58c6('0x10a')]=function(_0x51181a,_0x4360f6){var _0x1b3f1d;return db[_0x58c6('0x3f')][_0x58c6('0x61')]({'where':{'id':_0x51181a[_0x58c6('0x5e')]['id'],'role':_0x58c6('0x2d')},'attributes':['id',_0x58c6('0x3a'),_0x58c6('0x2c')]})[_0x58c6('0x2b')](handleEntityNotFound(_0x4360f6,null))[_0x58c6('0x2b')](function(_0x2cf876){if(_0x2cf876){_0x1b3f1d=_0x2cf876;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x1b3f1d[_0x58c6('0x3a')]},'individualHooks':!![]});}})[_0x58c6('0x2b')](function(){return db[_0x58c6('0x103')][_0x58c6('0x52')]({'where':{'membername':_0x1b3f1d[_0x58c6('0x3a')],'exitAt':null}});})[_0x58c6('0x2b')](function(_0xa4457){var _0x18e091=[];_0xa4457[_0x58c6('0x10b')](function(_0x1da870){_0x18e091['push'](_0x1da870[_0x58c6('0x2a')]({'exitAt':moment()[_0x58c6('0xf5')](_0x58c6('0x104'))}));});return Promise[_0x58c6('0x5c')](_0x18e091);})['then'](function(){return _0x1b3f1d[_0x58c6('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x58c6('0x2b')](respondWithResult(_0x4360f6,null))['catch'](handleError(_0x4360f6,null));};exports[_0x58c6('0x10c')]=function(_0x2ffce2,_0x435275){var _0x4c6b4a;return db[_0x58c6('0xe0')][_0x58c6('0x2a')]({'paused':0x1},{'where':{'UserId':_0x2ffce2[_0x58c6('0x5e')]['id']},'individualHooks':!![]})['then'](function(){return db['User'][_0x58c6('0x61')]({'where':{'id':_0x2ffce2[_0x58c6('0x5e')]['id'],'role':_0x58c6('0x2d')},'attributes':['id',_0x58c6('0x3a'),_0x58c6('0x2c'),_0x58c6('0x69'),_0x58c6('0xa4'),'online']});})[_0x58c6('0x2b')](handleEntityNotFound(_0x435275,null))[_0x58c6('0x2b')](function(_0x47c93a){if(_0x47c93a){_0x4c6b4a=_0x47c93a;return respondWithRpcPromise(_0x58c6('0x10d'),'pause',{'id':_0x4c6b4a['id'],'name':_0x4c6b4a[_0x58c6('0x3a')],'pause':!![]});}})[_0x58c6('0x2b')](function(){if(_0x4c6b4a){return db[_0x58c6('0x103')][_0x58c6('0x52')]({'where':{'membername':_0x4c6b4a[_0x58c6('0x3a')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x1945ef){if(_0x1945ef[_0x58c6('0x6f')]){var _0x16308f=moment()['format'](_0x58c6('0x104'));for(var _0x14af22=0x0,_0x43de09=_0x1945ef[_0x58c6('0x6f')];_0x14af22<_0x43de09;_0x14af22++){_0x1945ef[_0x14af22][_0x58c6('0x10e')]({'exitAt':_0x16308f});}}})['then'](function(){var _0xf44dc4=[];var _0x2429e5=utils[_0x58c6('0x105')]();_0x2429e5[_0x58c6('0x10b')](function(_0xfc5b4a){_0xf44dc4['push']({'channel':_0xfc5b4a,'membername':_0x4c6b4a[_0x58c6('0x3a')],'interface':_[_0x58c6('0x6b')](_0x4c6b4a[_0x58c6('0xa4')])?util['format']('SIP/%s',_0x4c6b4a[_0x58c6('0x3a')]):_0x4c6b4a[_0x58c6('0xa4')],'type':_0x58c6('0x10f'),'enterAt':moment()[_0x58c6('0xf5')](_0x58c6('0x104')),'data1':_0x2ffce2[_0x58c6('0x60')][_0x58c6('0x41')]||_0x58c6('0x110'),'role':_0x4c6b4a['role'],'internal':_0x4c6b4a[_0x58c6('0x69')]});});return db[_0x58c6('0x103')][_0x58c6('0x102')](_0xf44dc4,{'individualHooks':!![]});})[_0x58c6('0x2b')](function(){return _0x4c6b4a['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2ffce2[_0x58c6('0x60')][_0x58c6('0x41')]||_0x58c6('0x110'),'lastPauseAt':moment()['format'](_0x58c6('0x104'))});})[_0x58c6('0x2b')](respondWithResult(_0x435275,null))[_0x58c6('0x29')](handleError(_0x435275,null));};exports[_0x58c6('0x111')]=function(_0x91bfc4,_0x47e007){if(_0x91bfc4[_0x58c6('0x60')][_0x58c6('0xa0')]&&!utils[_0x58c6('0xa5')](_0x91bfc4[_0x58c6('0x60')][_0x58c6('0xa0')])){throw new APIBadRequestError(util[_0x58c6('0xf5')](_0x58c6('0x112'),_0x91bfc4[_0x58c6('0x60')]['channel']));}return db[_0x58c6('0x3f')][_0x58c6('0x61')]({'where':{'id':_0x91bfc4[_0x58c6('0x5e')]['id']},'attributes':['id',_0x58c6('0x3a'),'role',_0x58c6('0x69'),_0x58c6('0xa4'),'online',_0x58c6('0xa3'),'mailPause',_0x58c6('0x113'),_0x58c6('0x114'),_0x58c6('0x115'),_0x58c6('0x116'),'whatsappPause','pauseType','lastPauseAt']})[_0x58c6('0x2b')](function(_0x51f465){if(!_0x51f465){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x91bfc4[_0x58c6('0x5e')]['id']));}return _0x51f465['unpause'](_0x91bfc4['body'][_0x58c6('0xa0')]);})[_0x58c6('0x2b')](respondWithResult(_0x47e007,null))[_0x58c6('0x29')](APIHandleError(_0x47e007));};exports[_0x58c6('0x117')]=function(_0x42f5e6,_0x27f9a0){var _0x208529={};var _0xb1f637={};var _0x37bc4b;var _0x5c959f;return db['User']['findOne']({'where':{'id':_0x42f5e6[_0x58c6('0x5e')]['id']}})[_0x58c6('0x2b')](handleEntityNotFound(_0x27f9a0,null))['then'](function(_0x4a1821){if(_0x4a1821){_0x37bc4b=_0x4a1821;_0xb1f637[_0x58c6('0xd5')]=_[_0x58c6('0xdf')](db[_0x58c6('0x118')][_0x58c6('0xe1')]);_0xb1f637[_0x58c6('0x4c')]=_['keys'](_0x42f5e6['query']);_0xb1f637[_0x58c6('0xe2')]=_[_0x58c6('0xd7')](_0xb1f637[_0x58c6('0xd5')],_0xb1f637['query']);_0x208529[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0xb1f637[_0x58c6('0xd5')],qs[_0x58c6('0xd8')](_0x42f5e6[_0x58c6('0x4c')][_0x58c6('0xd8')]));_0x208529['attributes']=_0x208529[_0x58c6('0x50')]['length']?_0x208529[_0x58c6('0x50')]:_0xb1f637['model'];_0x208529['order']=qs[_0x58c6('0xda')](_0x42f5e6[_0x58c6('0x4c')]['sort']);_0x208529[_0x58c6('0x4a')]=qs['filters'](_[_0x58c6('0xdb')](_0x42f5e6[_0x58c6('0x4c')],_0xb1f637[_0x58c6('0xe2')]));if(_0x42f5e6['query'][_0x58c6('0x35')]){_0x208529[_0x58c6('0x4a')]=_[_0x58c6('0x5f')](_0x208529['where'],{'$or':_['map'](_0x208529['attributes'],function(_0x2d7155){var _0x5aab29={};_0x5aab29[_0x2d7155]={'$like':'%'+_0x42f5e6[_0x58c6('0x4c')][_0x58c6('0x35')]+'%'};return _0x5aab29;})});}_0x208529=_['merge']({},_0x208529,_0x42f5e6[_0x58c6('0xe3')]);return _0x37bc4b['getTeams'](_0x208529);}})[_0x58c6('0x2b')](function(_0x1119e8){if(_0x1119e8){_0x5c959f=_0x1119e8[_0x58c6('0x6f')];if(!_0x42f5e6[_0x58c6('0x4c')][_0x58c6('0xcd')](_0x58c6('0xdd'))){_0x208529[_0x58c6('0x1e')]=qs[_0x58c6('0x1e')](_0x42f5e6[_0x58c6('0x4c')][_0x58c6('0x1e')]);_0x208529[_0x58c6('0x1c')]=qs[_0x58c6('0x1c')](_0x42f5e6[_0x58c6('0x4c')]['offset']);}return _0x37bc4b[_0x58c6('0x117')](_0x208529);}})[_0x58c6('0x2b')](function(_0x546f77){if(_0x546f77){return _0x546f77?{'count':_0x5c959f,'rows':_0x546f77}:null;}})[_0x58c6('0x2b')](respondWithResult(_0x27f9a0,null))['catch'](handleError(_0x27f9a0,null));};exports['addTeams']=function(_0x185913,_0xbabf3b){var _0x51b79e=_0x185913[_0x58c6('0x5e')]['id'];var _0x4461c1=_0x185913[_0x58c6('0x60')]?_0x185913[_0x58c6('0x60')][_0x58c6('0xac')]:null;var _0x198ac9=[];return Promise['resolve']()[_0x58c6('0x2b')](function(){if(!_0x4461c1)throw new APIBadRequestError(_0x58c6('0x119'));})[_0x58c6('0x2b')](function(){return db['User'][_0x58c6('0xcb')]({'where':{'id':_0x51b79e}});})[_0x58c6('0x2b')](function(_0x1ee9ac){if(!_0x1ee9ac)throw new APINotFoundError(util['format'](_0x58c6('0xcc'),_0x185913['params']['id']));return db[_0x58c6('0x6c')][_0x58c6('0xfd')](function(_0x184de4){return _0x1ee9ac[_0x58c6('0x11a')](_0x4461c1,{'transaction':_0x184de4})[_0x58c6('0x2b')](function(){return db[_0x58c6('0x118')][_0x58c6('0x52')]({'where':{'id':{'$in':_0x4461c1}}});})[_0x58c6('0x2b')](function(_0x4ed200){var _0x2efd4e=_[_0x58c6('0x37')](_0x4ed200,function(_0x2814f9){return _0x2814f9['getAssociatedQueues']();});return Promise[_0x58c6('0x5c')](_0x2efd4e);})[_0x58c6('0x2b')](function(_0x1b0751){_0x198ac9=_['flattenDeep'](_0x1b0751);var _0x34a57c=_[_0x58c6('0x37')](_0x198ac9,function(_0x3150f2){return _0x3150f2[_0x58c6('0x11b')](_0x1ee9ac['id'],{'transaction':_0x184de4});});return Promise[_0x58c6('0x5c')](_0x34a57c);})['then'](function(){if(!_0x1ee9ac['online'])return;var _0xdbaa0=_[_0x58c6('0x35')](_0x198ac9,function(_0x13266c){return _0x13266c['getDataValue']('channel')===_0x58c6('0x11c');});var _0x11135e=_[_0x58c6('0x37')](_0xdbaa0,function(_0x1f12a3){return db[_0x58c6('0xe0')][_0x58c6('0xb1')]({'membername':_0x1ee9ac[_0x58c6('0x3a')],'UserId':_0x1ee9ac['id'],'queue_name':_0x1f12a3[_0x58c6('0x3a')],'VoiceQueueId':_0x1f12a3['id'],'interface':_['isNil'](_0x1ee9ac[_0x58c6('0xa4')])?util[_0x58c6('0xf5')]('SIP/%s',_0x1ee9ac['name']):_0x1ee9ac[_0x58c6('0xa4')],'paused':_0x1ee9ac[_0x58c6('0xa3')]||![],'penalty':_0x1ee9ac[_0x58c6('0xaa')]},{'transaction':_0x184de4});});return Promise[_0x58c6('0x5c')](_0x11135e);})[_0x58c6('0x2b')](function(){return db[_0x58c6('0x11d')][_0x58c6('0x52')]({'where':{'teamId':{'$in':_0x4461c1}}});})[_0x58c6('0x2b')](function(_0x23d360){var _0x59a13e=_[_0x58c6('0x37')](_0x23d360,function(_0x4935cd){return db[_0x58c6('0x11e')][_0x58c6('0x82')]({'UserId':_0x1ee9ac['id'],'VoicePrefixId':_0x4935cd[_0x58c6('0x11f')]},{'transaction':_0x184de4});});return Promise['all'](_0x59a13e);});});})[_0x58c6('0x2b')](function(){for(var _0x41c993=0x0;_0x41c993<_0x198ac9['length'];_0x41c993++){var _0x38eb6a=_0x198ac9[_0x41c993][_0x58c6('0x120')](_0x58c6('0xa0'));var _0xd1093b=_0x38eb6a+_0x58c6('0x121');socket[_0x58c6('0xad')]('user'+_0x38eb6a+'Queue:save',{'UserId':_0x51b79e,['queueField']:_0x198ac9[_0x41c993]['id']});}})[_0x58c6('0x2b')](respondWithStatusCode(_0xbabf3b,null))[_0x58c6('0x29')](APIHandleError(_0xbabf3b));};exports[_0x58c6('0x122')]=function(_0x51e343,_0x33d306){var _0x1095fe=_0x51e343[_0x58c6('0x5e')]['id'];var _0xbc31df=null;if(_0x51e343[_0x58c6('0x4c')][_0x58c6('0xac')]){_0xbc31df=_[_0x58c6('0xb4')](_0x51e343[_0x58c6('0x4c')][_0x58c6('0xac')])?_0x51e343['query'][_0x58c6('0xac')]:[_0x51e343['query']['ids']];}var _0x89d920=[];return Promise[_0x58c6('0x123')]()[_0x58c6('0x2b')](function(){if(!_0xbc31df)throw new APIBadRequestError(_0x58c6('0x124'));})['then'](function(){return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0x1095fe}});})[_0x58c6('0x2b')](function(_0x12da0c){if(!_0x12da0c)throw new APINotFoundError(util['format'](_0x58c6('0xcc'),_0x51e343[_0x58c6('0x5e')]['id']));return db[_0x58c6('0x6c')][_0x58c6('0xfd')](function(_0x27b04d){return _0x12da0c[_0x58c6('0x122')](_0xbc31df,{'transaction':_0x27b04d})[_0x58c6('0x2b')](function(){return db[_0x58c6('0x118')][_0x58c6('0x52')]({'where':{'id':{'$in':_0xbc31df}}});})[_0x58c6('0x2b')](function(_0x5ce99e){var _0x35b11d=_[_0x58c6('0x37')](_0x5ce99e,function(_0x30806e){return _0x30806e[_0x58c6('0x125')]();});return Promise[_0x58c6('0x5c')](_0x35b11d);})[_0x58c6('0x2b')](function(_0x488809){_0x89d920=_[_0x58c6('0x126')](_0x488809);var _0x84c75d=_[_0x58c6('0x37')](_0x89d920,function(_0x5aa673){return _0x5aa673[_0x58c6('0x127')](_0x12da0c['id'],{'transaction':_0x27b04d});});return Promise['all'](_0x84c75d);})[_0x58c6('0x2b')](function(){if(!_0x12da0c[_0x58c6('0xa1')])return;var _0x1425b1=_['filter'](_0x89d920,function(_0x429f40){return _0x429f40[_0x58c6('0x120')]('channel')==='Voice';});var _0x58b85c=_[_0x58c6('0x37')](_0x1425b1,function(_0x469ccc){return db[_0x58c6('0xe0')][_0x58c6('0x2f')]({'where':{'VoiceQueueId':_0x469ccc['id'],'UserId':_0x12da0c['id']},'transaction':_0x27b04d});});return Promise['all'](_0x58b85c);})[_0x58c6('0x2b')](function(){return db['TeamVoicePrefix'][_0x58c6('0x52')]({'where':{'teamId':{'$in':_0xbc31df}}});})[_0x58c6('0x2b')](function(_0x52cb4f){var _0x8c8cc3=_['map'](_0x52cb4f,function(_0x51e867){return db[_0x58c6('0x11e')][_0x58c6('0x2f')]({'where':{'UserId':_0x12da0c['id'],'VoicePrefixId':_0x51e867[_0x58c6('0x11f')]}},{'transaction':_0x27b04d});});return Promise[_0x58c6('0x5c')](_0x8c8cc3);});});})['then'](function(){for(var _0x26d8ce=0x0;_0x26d8ce<_0x89d920['length'];_0x26d8ce++){var _0x5297de=_0x89d920[_0x26d8ce][_0x58c6('0x120')](_0x58c6('0xa0'));var _0x21cd12=_0x5297de+'QueueId';socket[_0x58c6('0xad')](_0x58c6('0x83')+_0x5297de+_0x58c6('0xb5'),{'UserId':_0x1095fe,['queueField']:_0x89d920[_0x26d8ce]['id']});}})[_0x58c6('0x2b')](respondWithStatusCode(_0x33d306,null))['catch'](APIHandleError(_0x33d306));};exports['getLists']=function(_0x209a07,_0x2c80aa){var _0x3bace7={};var _0x1a7c52={};var _0x4ad992;var _0xc7bfa1;return db[_0x58c6('0x3f')][_0x58c6('0xcb')]({'where':{'id':_0x209a07['params']['id']}})[_0x58c6('0x2b')](handleEntityNotFound(_0x2c80aa,null))[_0x58c6('0x2b')](function(_0x2cf8b1){if(_0x2cf8b1){_0x4ad992=_0x2cf8b1;_0x1a7c52[_0x58c6('0xd5')]=_[_0x58c6('0xdf')](db[_0x58c6('0xcf')][_0x58c6('0xe1')]);_0x1a7c52[_0x58c6('0x4c')]=_[_0x58c6('0xdf')](_0x209a07[_0x58c6('0x4c')]);_0x1a7c52[_0x58c6('0xe2')]=_[_0x58c6('0xd7')](_0x1a7c52[_0x58c6('0xd5')],_0x1a7c52[_0x58c6('0x4c')]);_0x3bace7[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0x1a7c52[_0x58c6('0xd5')],qs[_0x58c6('0xd8')](_0x209a07[_0x58c6('0x4c')][_0x58c6('0xd8')]));_0x3bace7['attributes']=_0x3bace7[_0x58c6('0x50')]['length']?_0x3bace7[_0x58c6('0x50')]:_0x1a7c52[_0x58c6('0xd5')];_0x3bace7[_0x58c6('0xd9')]=qs['sort'](_0x209a07[_0x58c6('0x4c')][_0x58c6('0xda')]);_0x3bace7[_0x58c6('0x4a')]=qs['filters'](_[_0x58c6('0xdb')](_0x209a07[_0x58c6('0x4c')],_0x1a7c52[_0x58c6('0xe2')]));if(_0x209a07[_0x58c6('0x4c')]['filter']){_0x3bace7[_0x58c6('0x4a')]=_[_0x58c6('0x5f')](_0x3bace7[_0x58c6('0x4a')],{'$or':_[_0x58c6('0x37')](_0x3bace7[_0x58c6('0x50')],function(_0x32cf8e){var _0x20d2a9={};_0x20d2a9[_0x32cf8e]={'$like':'%'+_0x209a07['query'][_0x58c6('0x35')]+'%'};return _0x20d2a9;})});}_0x3bace7=_[_0x58c6('0x5f')]({},_0x3bace7,_0x209a07[_0x58c6('0xe3')]);return _0x4ad992['getLists'](_0x3bace7);}})[_0x58c6('0x2b')](function(_0x18c50b){if(_0x18c50b){_0xc7bfa1=_0x18c50b[_0x58c6('0x6f')];if(!_0x209a07[_0x58c6('0x4c')][_0x58c6('0xcd')](_0x58c6('0xdd'))){_0x3bace7[_0x58c6('0x1e')]=qs[_0x58c6('0x1e')](_0x209a07[_0x58c6('0x4c')][_0x58c6('0x1e')]);_0x3bace7[_0x58c6('0x1c')]=qs['offset'](_0x209a07[_0x58c6('0x4c')]['offset']);}return _0x4ad992[_0x58c6('0x128')](_0x3bace7);}})[_0x58c6('0x2b')](function(_0x3242f9){if(_0x3242f9){return _0x3242f9?{'count':_0xc7bfa1,'rows':_0x3242f9}:null;}})[_0x58c6('0x2b')](respondWithResult(_0x2c80aa,null))[_0x58c6('0x29')](handleError(_0x2c80aa,null));};exports[_0x58c6('0x129')]=function(_0x68489e,_0x223293){var _0x784b55={};var _0x3d7534={};var _0x3817ee;return db['User']['findOne']({'where':{'id':_0x68489e[_0x58c6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x223293,null))[_0x58c6('0x2b')](function(_0xef6cd4){if(_0xef6cd4){_0x3817ee=_0xef6cd4;_0x3d7534[_0x58c6('0xd5')]=_['keys'](db[_0x58c6('0x3f')]['rawAttributes']);_0x3d7534[_0x58c6('0x4c')]=_[_0x58c6('0xdf')](_0x68489e['query']);_0x3d7534['filters']=_[_0x58c6('0xd7')](_0x3d7534[_0x58c6('0xd5')],_0x3d7534[_0x58c6('0x4c')]);_0x784b55[_0x58c6('0x50')]=_[_0x58c6('0xd7')](_0x3d7534[_0x58c6('0xd5')],qs[_0x58c6('0xd8')](_0x68489e['query']['fields']));_0x784b55[_0x58c6('0x50')]=_0x784b55[_0x58c6('0x50')][_0x58c6('0x6f')]?_0x784b55[_0x58c6('0x50')]:_0x3d7534[_0x58c6('0xd5')];_0x784b55[_0x58c6('0xd9')]=qs['sort'](_0x68489e['query'][_0x58c6('0xda')]);_0x784b55['where']=qs[_0x58c6('0xe2')](_[_0x58c6('0xdb')](_0x68489e[_0x58c6('0x4c')],_0x3d7534[_0x58c6('0xe2')]));if(_0x68489e[_0x58c6('0x4c')][_0x58c6('0x35')]){_0x784b55['where']=_[_0x58c6('0x5f')](_0x784b55[_0x58c6('0x4a')],{'$or':_['map'](_0x784b55[_0x58c6('0x50')],function(_0x4af46c){var _0xf79820={};_0xf79820[_0x4af46c]={'$like':'%'+_0x68489e[_0x58c6('0x4c')][_0x58c6('0x35')]+'%'};return _0xf79820;})});}_0x784b55['model']=db[_0x58c6('0x3f')];_0x784b55['as']='Agents';_0x784b55=_[_0x58c6('0x5f')]({},_0x784b55,_0x68489e[_0x58c6('0xe3')]);return _0x3817ee[_0x58c6('0x100')]({'include':[_0x784b55]});}})[_0x58c6('0x2b')](function(_0xde1779){if(_0xde1779){var _0x501bd5={},_0x12d694=[];for(var _0x123228=0x0;_0x123228<_0xde1779['length'];_0x123228+=0x1){for(var _0x6a2722=0x0,_0x244364;_0x6a2722<_0xde1779[_0x123228]['Agents'][_0x58c6('0x6f')];_0x6a2722+=0x1){_0x244364=_0xde1779[_0x123228][_0x58c6('0x33')][_0x6a2722][_0x58c6('0x30')]({'plain':!![]});_0x501bd5[_0x244364['id']]=_0x244364;}}_0x501bd5=_[_0x58c6('0x12a')](_0x501bd5);for(var _0x52239b=qs[_0x58c6('0x1c')](_0x68489e['query'][_0x58c6('0x1c')]);_0x52239b<_0x501bd5['length']&&_0x12d694['length']=_0x4cc190[_0x625e('0x4b')]){throw new Error(_0x625e('0x4c'));}})['then'](function(){if(_0x44969a){return db[_0x625e('0x4d')][_0x625e('0x4e')]({'where':{'membername':_0x44969a['name']},'individualHooks':!![]});}})['then'](function(){if(_0x44969a){return _0x44969a[_0x625e('0x4f')]({'raw':!![]});}})['then'](function(_0xb2409d){if(_0x44969a){if(_0xb2409d){var _0xc47858=[];_0x462171=_0xb2409d;if(_0x462171[_0x625e('0x26')]){for(var _0x6671fc=0x0;_0x6671fc<_0x462171['length'];_0x6671fc++){_0xc47858[_0x625e('0x2a')](db[_0x625e('0x4d')]['upsert']({'membername':_0x44969a[_0x625e('0x1d')],'UserId':_0x44969a['id'],'queue_name':_0x462171[_0x6671fc][_0x625e('0x1d')],'VoiceQueueId':_0x462171[_0x6671fc]['id'],'interface':_0x16dcd3,'paused':_0x44969a[_0x625e('0x46')]||![],'penalty':_0x462171[_0x6671fc][_0x625e('0x50')]||0x0}));}return BPromise[_0x625e('0x51')](_0xc47858);}}}})[_0x625e('0x11')](function(){if(_0x44969a){return db[_0x625e('0x2f')][_0x625e('0x24')]({'where':{'membername':_0x44969a[_0x625e('0x1d')],'exitAt':null}});}})['then'](function(_0x4c568c){if(_0x44969a){if(_0x4c568c&&_0x4c568c[_0x625e('0x26')]){var _0x484ed5=[];_0x4c568c[_0x625e('0x42')](function(_0x15f73d){_0x484ed5['push'](_0x15f73d[_0x625e('0x31')]({'exitAt':moment()[_0x625e('0x21')](_0x625e('0x27'))}));});return BPromise[_0x625e('0x51')](_0x484ed5);}}})[_0x625e('0x11')](function(){if(_0x44969a){var _0x373881=[];var _0x3e3a58=[];var _0x320bbf=utils[_0x625e('0x29')]();var _0x4a369a={'membername':_0x44969a['name'],'interface':_0x16dcd3,'enterAt':moment()[_0x625e('0x21')](_0x625e('0x27')),'role':_0x44969a[_0x625e('0x1e')],'internal':_0x44969a[_0x625e('0x1f')]};_0x320bbf[_0x625e('0x42')](function(_0x55391d){_0x373881['push'](_[_0x625e('0x52')]({'channel':_0x55391d,'type':_0x625e('0x53'),'data1':_0x625e('0x54'),'data2':_0x16dcd3},_0x4a369a));if(_0x44969a[_0x625e('0x46')]){_0x3e3a58[_0x625e('0x2a')](_[_0x625e('0x52')]({'channel':_0x55391d,'type':_0x625e('0x25'),'data1':_0x625e('0x55')},_0x4a369a));}});return db[_0x625e('0x2f')][_0x625e('0x30')](_0x373881['concat'](_0x3e3a58),{'individualHooks':!![]});}})[_0x625e('0x11')](function(){if(_0x44969a){return _0x44969a[_0x625e('0x31')]({'online':!![],'lastLoginAt':moment()[_0x625e('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x44969a['loginInPause']||![],'mailPause':_0x44969a['loginInPause']||![],'chatPause':_0x44969a[_0x625e('0x46')]||![],'faxPause':_0x44969a[_0x625e('0x46')]||![],'smsPause':_0x44969a[_0x625e('0x46')]||![],'openchannelPause':_0x44969a[_0x625e('0x46')]||![],'pauseType':_0x44969a[_0x625e('0x46')]?_0x625e('0x55'):null,'lastPauseAt':moment()[_0x625e('0x21')](_0x625e('0x27')),'interface':_0x16dcd3});}})[_0x625e('0x11')](function(_0x1be004){_0x1046e5(_0x1be004);})['catch'](function(_0x2ee562){_0x2875ac(_0x1c421c[_0x625e('0x16')](0x1f4,_0x2ee562[_0x625e('0x17')]));});});}; \ No newline at end of file +var _0x7efa=['findOne','online','voicePause','mailPause','chatPause','faxPause','whatsappPause','pauseType','lastPauseAt','params','unpause','system','LogoutUser','all','LoginUser','mobile','phone','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','UserVoiceQueue.penalty','forEach','merge','callysquare','loginInPause','concat','LOGININPAUSE','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','./user.socket','register','GetUser','User','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','message','error','ShowUser','find','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','findAll','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','PAUSE','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','body','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x7efa,0x129));var _0xa7ef=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x7efa[_0x18b5e8];return _0x25baed;};'use strict';var _=require(_0xa7ef('0x0'));var util=require(_0xa7ef('0x1'));var moment=require('moment');var BPromise=require(_0xa7ef('0x2'));var Redis=require(_0xa7ef('0x3'));var db=require(_0xa7ef('0x4'))['db'];var utils=require(_0xa7ef('0x5'));var logger=require(_0xa7ef('0x6'))(_0xa7ef('0x7'));var config=require(_0xa7ef('0x8'));config[_0xa7ef('0x9')]=_[_0xa7ef('0xa')](config[_0xa7ef('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa7ef('0xb'))[_0xa7ef('0xc')](socket);exports[_0xa7ef('0xd')]=function(_0x2c7625){var _0x3716f3=this;return new Promise(function(_0x1966de,_0x4fcb06){return db[_0xa7ef('0xe')]['findAll']({'raw':_0x2c7625[_0xa7ef('0xf')]?_0x2c7625[_0xa7ef('0xf')][_0xa7ef('0x10')]===undefined?!![]:![]:!![],'where':_0x2c7625[_0xa7ef('0xf')]?_0x2c7625[_0xa7ef('0xf')][_0xa7ef('0x11')]||null:null,'attributes':_0x2c7625[_0xa7ef('0xf')]?_0x2c7625[_0xa7ef('0xf')][_0xa7ef('0x12')]||null:null,'limit':_0x2c7625[_0xa7ef('0xf')]?_0x2c7625['options'][_0xa7ef('0x13')]||null:null,'include':_0x2c7625[_0xa7ef('0xf')]?_0x2c7625['options'][_0xa7ef('0x14')]?_['map'](_0x2c7625['options'][_0xa7ef('0x14')],function(_0x45cb39){return{'model':db[_0x45cb39[_0xa7ef('0x15')]],'as':_0x45cb39['as'],'attributes':_0x45cb39[_0xa7ef('0x12')],'include':_0x45cb39[_0xa7ef('0x14')]?_[_0xa7ef('0x16')](_0x45cb39[_0xa7ef('0x14')],function(_0x259754){return{'model':db[_0x259754['model']],'as':_0x259754['as'],'attributes':_0x259754[_0xa7ef('0x12')],'include':_0x259754['include']?_[_0xa7ef('0x16')](_0x259754[_0xa7ef('0x14')],function(_0x56a1ee){return{'model':db[_0x56a1ee[_0xa7ef('0x15')]],'as':_0x56a1ee['as'],'attributes':_0x56a1ee[_0xa7ef('0x12')]};}):[]};}):[]};}):[]:[]})[_0xa7ef('0x17')](function(_0x22773e){logger[_0xa7ef('0x18')](_0xa7ef('0xd'),_0x2c7625);logger[_0xa7ef('0x19')](_0xa7ef('0xd'),_0x2c7625,JSON[_0xa7ef('0x1a')](_0x22773e));_0x1966de(_0x22773e);})[_0xa7ef('0x1b')](function(_0x3c1332){logger['error'](_0xa7ef('0xd'),_0x3c1332[_0xa7ef('0x1c')],_0x2c7625);_0x4fcb06(_0x3716f3[_0xa7ef('0x1d')](0x1f4,_0x3c1332[_0xa7ef('0x1c')]));});});};exports[_0xa7ef('0x1e')]=function(_0x2312d7){var _0x532775=this;return new Promise(function(_0x3551db,_0x458377){return db['User'][_0xa7ef('0x1f')]({'raw':_0x2312d7['options']?_0x2312d7['options'][_0xa7ef('0x10')]===undefined?!![]:![]:!![],'where':_0x2312d7[_0xa7ef('0xf')]?_0x2312d7[_0xa7ef('0xf')][_0xa7ef('0x11')]||null:null,'attributes':_0x2312d7['options']?_0x2312d7[_0xa7ef('0xf')][_0xa7ef('0x12')]||null:null,'include':_0x2312d7['options']?_0x2312d7[_0xa7ef('0xf')][_0xa7ef('0x14')]?_['map'](_0x2312d7[_0xa7ef('0xf')][_0xa7ef('0x14')],function(_0x356b49){return{'model':db[_0x356b49['model']],'as':_0x356b49['as'],'attributes':_0x356b49[_0xa7ef('0x12')],'include':_0x356b49[_0xa7ef('0x14')]?_[_0xa7ef('0x16')](_0x356b49[_0xa7ef('0x14')],function(_0x3df66b){return{'model':db[_0x3df66b[_0xa7ef('0x15')]],'as':_0x3df66b['as'],'attributes':_0x3df66b['attributes'],'include':_0x3df66b['include']?_[_0xa7ef('0x16')](_0x3df66b[_0xa7ef('0x14')],function(_0x6ef885){return{'model':db[_0x6ef885['model']],'as':_0x6ef885['as'],'attributes':_0x6ef885['attributes']};}):[]};}):[]};}):[]:[]})[_0xa7ef('0x17')](function(_0x3be7ec){logger[_0xa7ef('0x18')](_0xa7ef('0x1e'),_0x2312d7);logger[_0xa7ef('0x19')]('ShowUser',_0x2312d7,JSON[_0xa7ef('0x1a')](_0x3be7ec));_0x3551db(_0x3be7ec);})['catch'](function(_0x56f5ef){logger[_0xa7ef('0x1d')](_0xa7ef('0x1e'),_0x56f5ef[_0xa7ef('0x1c')],_0x2312d7);_0x458377(_0x532775['error'](0x1f4,_0x56f5ef[_0xa7ef('0x1c')]));});});};exports[_0xa7ef('0x20')]=function(_0x38e96){var _0x3f75a2;return db[_0xa7ef('0xe')][_0xa7ef('0x1f')]({'where':_0x38e96['options'][_0xa7ef('0x11')]||{},'attributes':['id',_0xa7ef('0x21'),_0xa7ef('0x22'),_0xa7ef('0x23'),_0xa7ef('0x24')]})[_0xa7ef('0x17')](function(_0x767218){if(!_0x767218){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x38e96['params']['id']));}_0x3f75a2=_0x767218;return db[_0xa7ef('0x25')][_0xa7ef('0x26')]({'paused':0x1},{'where':{'UserId':_0x3f75a2['id']},'individualHooks':!![]});})[_0xa7ef('0x17')](function(){return db[_0xa7ef('0x27')][_0xa7ef('0x28')]({'where':{'membername':_0x3f75a2[_0xa7ef('0x21')],'type':'PAUSE','exitAt':null}});})[_0xa7ef('0x17')](function(_0x4b3184){if(_0x4b3184&&_0x4b3184[_0xa7ef('0x29')]){var _0x47c10e=moment()['format'](_0xa7ef('0x2a'));for(var _0x238890=0x0,_0x452287=_0x4b3184[_0xa7ef('0x29')];_0x238890<_0x452287;_0x238890++){_0x4b3184[_0x238890][_0xa7ef('0x2b')]({'exitAt':_0x47c10e});}}})[_0xa7ef('0x17')](function(){var _0xfdd04b=[];var _0x2fa03b=utils[_0xa7ef('0x2c')]();_0x2fa03b['forEach'](function(_0x252045){_0xfdd04b[_0xa7ef('0x2d')]({'channel':_0x252045,'membername':_0x3f75a2['name'],'interface':_[_0xa7ef('0x2e')](_0x3f75a2[_0xa7ef('0x24')])?util['format'](_0xa7ef('0x2f'),_0x3f75a2[_0xa7ef('0x21')]):_0x3f75a2[_0xa7ef('0x24')],'type':_0xa7ef('0x30'),'enterAt':moment()['format'](_0xa7ef('0x2a')),'data1':_0x38e96['body'][_0xa7ef('0x31')]||_0xa7ef('0x32'),'role':_0x3f75a2['role'],'internal':_0x3f75a2['internal'],'uniqueid':_0x38e96['body'][_0xa7ef('0x33')]||null});});return db[_0xa7ef('0x27')][_0xa7ef('0x34')](_0xfdd04b,{'individualHooks':!![]});})[_0xa7ef('0x17')](function(){return _0x3f75a2['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x38e96[_0xa7ef('0x35')][_0xa7ef('0x31')]||_0xa7ef('0x32'),'lastPauseAt':moment()['format'](_0xa7ef('0x2a'))});})[_0xa7ef('0x1b')](function(_0x218f73){throw _0x218f73;});};exports['UnpauseUser']=function(_0x8203e6){return Promise[_0xa7ef('0x36')]()[_0xa7ef('0x17')](function(){if(_0x8203e6[_0xa7ef('0x35')][_0xa7ef('0x37')]&&!utils[_0xa7ef('0x38')](_0x8203e6['body'][_0xa7ef('0x37')])){throw new Error(util[_0xa7ef('0x39')](_0xa7ef('0x3a'),_0x8203e6['body'][_0xa7ef('0x37')]));}return db[_0xa7ef('0xe')][_0xa7ef('0x3b')]({'where':_0x8203e6[_0xa7ef('0xf')]['where']||{},'attributes':['id',_0xa7ef('0x21'),_0xa7ef('0x22'),_0xa7ef('0x23'),_0xa7ef('0x24'),_0xa7ef('0x3c'),_0xa7ef('0x3d'),_0xa7ef('0x3e'),_0xa7ef('0x3f'),_0xa7ef('0x40'),'openchannelPause','smsPause',_0xa7ef('0x41'),_0xa7ef('0x42'),_0xa7ef('0x43')]});})[_0xa7ef('0x17')](function(_0x357215){if(!_0x357215){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x8203e6[_0xa7ef('0x44')]['id']));}return _0x357215[_0xa7ef('0x45')](_0x8203e6[_0xa7ef('0x35')][_0xa7ef('0x37')],_0xa7ef('0x46'));})['catch'](function(_0x225739){throw _0x225739;});};exports[_0xa7ef('0x47')]=function(_0x959f63){var _0x6daea8=this;return new Promise(function(_0x304777,_0x2e60c6){var _0x4a038e;return db[_0xa7ef('0xe')][_0xa7ef('0x3b')]({'where':_0x959f63[_0xa7ef('0xf')][_0xa7ef('0x11')]||{},'attributes':['id','name']})[_0xa7ef('0x17')](function(_0x5c6e1f){if(_0x5c6e1f){_0x4a038e=_0x5c6e1f;return db[_0xa7ef('0x25')]['destroy']({'where':{'membername':_0x4a038e['name']},'individualHooks':!![]});}})[_0xa7ef('0x17')](function(){if(_0x4a038e){return db[_0xa7ef('0x27')][_0xa7ef('0x28')]({'where':{'membername':_0x4a038e[_0xa7ef('0x21')],'exitAt':null}});}})[_0xa7ef('0x17')](function(_0x52e160){if(_0x4a038e){if(_0x52e160&&_0x52e160[_0xa7ef('0x29')]){var _0x266eb6=[];_0x52e160['forEach'](function(_0x4f7c0d){_0x266eb6[_0xa7ef('0x2d')](_0x4f7c0d['update']({'exitAt':moment()[_0xa7ef('0x39')](_0xa7ef('0x2a'))}));});return BPromise[_0xa7ef('0x48')](_0x266eb6);}}})[_0xa7ef('0x17')](function(){if(_0x4a038e){return _0x4a038e['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x25cd93){_0x304777(_0x25cd93);})[_0xa7ef('0x1b')](function(_0x41bdef){_0x2e60c6(_0x6daea8[_0xa7ef('0x1d')](0x1f4,_0x41bdef[_0xa7ef('0x1c')]));});});};exports[_0xa7ef('0x49')]=function(_0x2940c0){var _0x475f8d=this;return new Promise(function(_0x5c99cd,_0x724e9e){var _0x4e5a60;var _0x342077;var _0x1a6385;var _0x383a91;return db[_0xa7ef('0xe')][_0xa7ef('0x3b')]({'where':_0x2940c0[_0xa7ef('0xf')]['where']||{},'attributes':['id',_0xa7ef('0x21'),_0xa7ef('0x22'),_0xa7ef('0x4a'),_0xa7ef('0x4b'),_0xa7ef('0x23'),'loginInPause',_0xa7ef('0x24')]})[_0xa7ef('0x17')](function(_0x3f8205){if(_0x3f8205){_0x4e5a60=_0x3f8205;_0x383a91=_0x2940c0['body'][_0xa7ef('0x24')]?_0x2940c0[_0xa7ef('0x35')][_0xa7ef('0x24')]:util[_0xa7ef('0x39')]('SIP/%s',_0x4e5a60[_0xa7ef('0x21')]);return db[_0xa7ef('0xe')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4e5a60['id']}}});}})[_0xa7ef('0x17')](function(_0x3855de){if(_0x3855de){_0x1a6385=_0x3855de;return require(_0xa7ef('0x4c'))[_0xa7ef('0x4d')]();}})['then'](function(_0xdb550a){if(_0xdb550a&&_0xdb550a['agents']&&_0x1a6385>=_0xdb550a[_0xa7ef('0x4e')]){throw new Error(_0xa7ef('0x4f'));}})[_0xa7ef('0x17')](function(){if(_0x4e5a60){return db[_0xa7ef('0x25')][_0xa7ef('0x50')]({'where':{'membername':_0x4e5a60['name']},'individualHooks':!![]});}})[_0xa7ef('0x17')](function(){if(_0x4e5a60){return _0x4e5a60[_0xa7ef('0x51')]({'raw':!![]});}})['then'](function(_0x815534){if(_0x4e5a60){if(_0x815534){var _0x1b4177=[];_0x342077=_0x815534;if(_0x342077[_0xa7ef('0x29')]){for(var _0x49c85e=0x0;_0x49c85e<_0x342077[_0xa7ef('0x29')];_0x49c85e++){_0x1b4177['push'](db[_0xa7ef('0x25')]['upsert']({'membername':_0x4e5a60[_0xa7ef('0x21')],'UserId':_0x4e5a60['id'],'queue_name':_0x342077[_0x49c85e]['name'],'VoiceQueueId':_0x342077[_0x49c85e]['id'],'interface':_0x383a91,'paused':_0x4e5a60['loginInPause']||![],'penalty':_0x342077[_0x49c85e][_0xa7ef('0x52')]||0x0}));}return BPromise[_0xa7ef('0x48')](_0x1b4177);}}}})[_0xa7ef('0x17')](function(){if(_0x4e5a60){return db[_0xa7ef('0x27')][_0xa7ef('0x28')]({'where':{'membername':_0x4e5a60[_0xa7ef('0x21')],'exitAt':null}});}})[_0xa7ef('0x17')](function(_0xea2a4d){if(_0x4e5a60){if(_0xea2a4d&&_0xea2a4d[_0xa7ef('0x29')]){var _0x470550=[];_0xea2a4d[_0xa7ef('0x53')](function(_0x40311a){_0x470550[_0xa7ef('0x2d')](_0x40311a[_0xa7ef('0x26')]({'exitAt':moment()[_0xa7ef('0x39')](_0xa7ef('0x2a'))}));});return BPromise['all'](_0x470550);}}})[_0xa7ef('0x17')](function(){if(_0x4e5a60){var _0x189127=[];var _0x56a96c=[];var _0x1198d2=utils[_0xa7ef('0x2c')]();var _0x34c047={'membername':_0x4e5a60[_0xa7ef('0x21')],'interface':_0x383a91,'enterAt':moment()[_0xa7ef('0x39')](_0xa7ef('0x2a')),'role':_0x4e5a60[_0xa7ef('0x22')],'internal':_0x4e5a60[_0xa7ef('0x23')]};_0x1198d2[_0xa7ef('0x53')](function(_0x352939){_0x189127[_0xa7ef('0x2d')](_[_0xa7ef('0x54')]({'channel':_0x352939,'type':'LOGIN','data1':_0xa7ef('0x55'),'data2':_0x383a91},_0x34c047));if(_0x4e5a60[_0xa7ef('0x56')]){_0x56a96c[_0xa7ef('0x2d')](_[_0xa7ef('0x54')]({'channel':_0x352939,'type':_0xa7ef('0x30'),'data1':'LOGININPAUSE'},_0x34c047));}});return db[_0xa7ef('0x27')][_0xa7ef('0x34')](_0x189127[_0xa7ef('0x57')](_0x56a96c),{'individualHooks':!![]});}})['then'](function(){if(_0x4e5a60){return _0x4e5a60['update']({'online':!![],'lastLoginAt':moment()[_0xa7ef('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4e5a60[_0xa7ef('0x56')]||![],'mailPause':_0x4e5a60['loginInPause']||![],'chatPause':_0x4e5a60[_0xa7ef('0x56')]||![],'faxPause':_0x4e5a60['loginInPause']||![],'smsPause':_0x4e5a60[_0xa7ef('0x56')]||![],'openchannelPause':_0x4e5a60[_0xa7ef('0x56')]||![],'pauseType':_0x4e5a60[_0xa7ef('0x56')]?_0xa7ef('0x58'):null,'lastPauseAt':moment()[_0xa7ef('0x39')](_0xa7ef('0x2a')),'interface':_0x383a91});}})['then'](function(_0x386eff){_0x5c99cd(_0x386eff);})[_0xa7ef('0x1b')](function(_0x36797f){_0x724e9e(_0x475f8d[_0xa7ef('0x1d')](0x1f4,_0x36797f['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 77fe72d..ef91794 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 _0x82cf=['emit','removeListener','register','length','./user.events'];(function(_0x57bde8,_0x2f25d2){var _0x259568=function(_0x4afcab){while(--_0x4afcab){_0x57bde8['push'](_0x57bde8['shift']());}};_0x259568(++_0x2f25d2);}(_0x82cf,0x1ee));var _0xf82c=function(_0x122d9f,_0x2c9e5b){_0x122d9f=_0x122d9f-0x0;var _0x41a09e=_0x82cf[_0x122d9f];return _0x41a09e;};'use strict';var UserEvents=require(_0xf82c('0x0'));var events=['save','remove','update'];function createListener(_0x7d5ca6,_0x249fe5){return function(_0x5f1fd2){_0x249fe5[_0xf82c('0x1')](_0x7d5ca6,_0x5f1fd2);};}function removeListener(_0x560ab0,_0x1111f4){return function(){UserEvents[_0xf82c('0x2')](_0x560ab0,_0x1111f4);};}exports[_0xf82c('0x3')]=function(_0x3fd702){for(var _0x42d8e7=0x0,_0x177e7b=events[_0xf82c('0x4')];_0x42d8e7<_0x177e7b;_0x42d8e7++){var _0x194f72=events[_0x42d8e7];var _0x1da88c=createListener('user:'+_0x194f72,_0x3fd702);UserEvents['on'](_0x194f72,_0x1da88c);}}; \ No newline at end of file +var _0x1a9c=['user:','./user.events','removeListener','register','length'];(function(_0x514efb,_0x46479e){var _0x31f747=function(_0x34230b){while(--_0x34230b){_0x514efb['push'](_0x514efb['shift']());}};_0x31f747(++_0x46479e);}(_0x1a9c,0x16e));var _0xc1a9=function(_0x31d4ea,_0x443bf8){_0x31d4ea=_0x31d4ea-0x0;var _0x4adca5=_0x1a9c[_0x31d4ea];return _0x4adca5;};'use strict';var UserEvents=require(_0xc1a9('0x0'));var events=['save','remove','update'];function createListener(_0x512336,_0x340373){return function(_0x3cabc0){_0x340373['emit'](_0x512336,_0x3cabc0);};}function removeListener(_0xd264e,_0x357d12){return function(){UserEvents[_0xc1a9('0x1')](_0xd264e,_0x357d12);};}exports[_0xc1a9('0x2')]=function(_0x4dfd3d){for(var _0x1c292d=0x0,_0x51ac4e=events[_0xc1a9('0x3')];_0x1c292d<_0x51ac4e;_0x1c292d++){var _0x234458=events[_0x1c292d];var _0x15cf4d=createListener(_0xc1a9('0x4')+_0x234458,_0x4dfd3d);UserEvents['on'](_0x234458,_0x15cf4d);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f9a1173..7016f64 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x33b880,_0xa71851){var _0x2390b0=function(_0x2cad49){while(--_0x2cad49){_0x33b880['push'](_0x33b880['shift']());}};_0x2390b0(++_0xa71851);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4a8cda,_0x34d5f5){var _0x1b25e1=function(_0x15a0c0){while(--_0x15a0c0){_0x4a8cda['push'](_0x4a8cda['shift']());}};_0x1b25e1(++_0x34d5f5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7f3c2ee..7a4f525 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 _0xea30=['INTEGER','exports'];(function(_0x4f8bf6,_0x3aecf8){var _0x3904a5=function(_0x2f2923){while(--_0x2f2923){_0x4f8bf6['push'](_0x4f8bf6['shift']());}};_0x3904a5(++_0x3aecf8);}(_0xea30,0x9f));var _0x0ea3=function(_0x30ba12,_0x10e416){_0x30ba12=_0x30ba12-0x0;var _0x57f8ac=_0xea30[_0x30ba12];return _0x57f8ac;};'use strict';var Sequelize=require('sequelize');module[_0x0ea3('0x0')]={'penalty':{'type':Sequelize[_0x0ea3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5dd1=['exports','sequelize'];(function(_0x2c2343,_0x4c215f){var _0x5a157f=function(_0x43d9b5){while(--_0x43d9b5){_0x2c2343['push'](_0x2c2343['shift']());}};_0x5a157f(++_0x4c215f);}(_0x5dd1,0xed));var _0x15dd=function(_0x507eea,_0x47f2de){_0x507eea=_0x507eea-0x0;var _0x4d6e1b=_0x5dd1[_0x507eea];return _0x4d6e1b;};'use strict';var Sequelize=require(_0x15dd('0x0'));module[_0x15dd('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 5fda43b..e225a07 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 _0xc4fd=['bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0xc4fd,0x140));var _0xdc4f=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0xc4fd[_0xf91841];return _0x4b9c44;};'use strict';var _=require(_0xdc4f('0x0'));var util=require(_0xdc4f('0x1'));var logger=require(_0xdc4f('0x2'))(_0xdc4f('0x3'));var moment=require('moment');var BPromise=require(_0xdc4f('0x4'));var rp=require(_0xdc4f('0x5'));var fs=require('fs');var path=require(_0xdc4f('0x6'));var rimraf=require(_0xdc4f('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc4f('0x8'));module[_0xdc4f('0x9')]=function(_0x586276,_0x3e9dc6){return _0x586276['define'](_0xdc4f('0xa'),attributes,{'tableName':_0xdc4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8ab=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues'];(function(_0x1b0d29,_0x1b80d5){var _0x50df9c=function(_0x51d0a3){while(--_0x51d0a3){_0x1b0d29['push'](_0x1b0d29['shift']());}};_0x50df9c(++_0x1b80d5);}(_0xb8ab,0xfc));var _0xbb8a=function(_0x10141a,_0x5988b9){_0x10141a=_0x10141a-0x0;var _0xd1f33d=_0xb8ab[_0x10141a];return _0xd1f33d;};'use strict';var _=require(_0xbb8a('0x0'));var util=require(_0xbb8a('0x1'));var logger=require('../../config/logger')(_0xbb8a('0x2'));var moment=require(_0xbb8a('0x3'));var BPromise=require(_0xbb8a('0x4'));var rp=require(_0xbb8a('0x5'));var fs=require('fs');var path=require(_0xbb8a('0x6'));var rimraf=require('rimraf');var config=require(_0xbb8a('0x7'));var attributes=require(_0xbb8a('0x8'));module[_0xbb8a('0x9')]=function(_0x431b9c,_0x104612){return _0x431b9c['define'](_0xbb8a('0xa'),attributes,{'tableName':_0xbb8a('0xb'),'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 69004d5..cb07d84 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 _0xecca=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1bc7db,_0x276abd){var _0x42086c=function(_0x4de634){while(--_0x4de634){_0x1bc7db['push'](_0x1bc7db['shift']());}};_0x42086c(++_0x276abd);}(_0xecca,0x1e9));var _0xaecc=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xecca[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xaecc('0x0'));var util=require(_0xaecc('0x1'));var moment=require(_0xaecc('0x2'));var BPromise=require(_0xaecc('0x3'));var rs=require(_0xaecc('0x4'));var fs=require('fs');var Redis=require(_0xaecc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaecc('0x6'));var logger=require('../../config/logger')(_0xaecc('0x7'));var config=require('../../config/environment');var jayson=require(_0xaecc('0x8'));var client=jayson[_0xaecc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5949b9,_0x5c7332,_0x2411e1){return new BPromise(function(_0x384356,_0x573c3c){return client[_0xaecc('0xa')](_0x5949b9,_0x2411e1)[_0xaecc('0xb')](function(_0x1267d8){logger[_0xaecc('0xc')](_0xaecc('0xd'),_0x5c7332,_0xaecc('0xe'));logger['debug'](_0xaecc('0xf'),_0x5c7332,_0xaecc('0xe'),JSON[_0xaecc('0x10')](_0x1267d8));if(_0x1267d8[_0xaecc('0x11')]){if(_0x1267d8[_0xaecc('0x11')][_0xaecc('0x12')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x5c7332,_0x1267d8['error'][_0xaecc('0x13')]);return _0x573c3c(_0x1267d8[_0xaecc('0x11')][_0xaecc('0x13')]);}logger[_0xaecc('0x11')](_0xaecc('0xd'),_0x5c7332,_0x1267d8[_0xaecc('0x11')][_0xaecc('0x13')]);return _0x384356(_0x1267d8['error'][_0xaecc('0x13')]);}else{logger['info'](_0xaecc('0xd'),_0x5c7332,_0xaecc('0xe'));_0x384356(_0x1267d8[_0xaecc('0x14')][_0xaecc('0x13')]);}})[_0xaecc('0x15')](function(_0x1251af){logger[_0xaecc('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x5c7332,_0x1251af);_0x573c3c(_0x1251af);});});} \ No newline at end of file +var _0xda86=['stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0xda86,0x1ea));var _0x6da8=function(_0x236aa9,_0x35ba98){_0x236aa9=_0x236aa9-0x0;var _0x24427a=_0xda86[_0x236aa9];return _0x24427a;};'use strict';var _=require('lodash');var util=require(_0x6da8('0x0'));var moment=require('moment');var BPromise=require(_0x6da8('0x1'));var rs=require(_0x6da8('0x2'));var fs=require('fs');var Redis=require(_0x6da8('0x3'));var db=require(_0x6da8('0x4'))['db'];var utils=require(_0x6da8('0x5'));var logger=require(_0x6da8('0x6'))(_0x6da8('0x7'));var config=require(_0x6da8('0x8'));var jayson=require(_0x6da8('0x9'));var client=jayson[_0x6da8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fdf15,_0x583379,_0x3c9e12){return new BPromise(function(_0x249659,_0x71aa82){return client[_0x6da8('0xb')](_0x3fdf15,_0x3c9e12)['then'](function(_0x58b4ab){logger[_0x6da8('0xc')](_0x6da8('0xd'),_0x583379,_0x6da8('0xe'));logger[_0x6da8('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x583379,_0x6da8('0xe'),JSON[_0x6da8('0x10')](_0x58b4ab));if(_0x58b4ab[_0x6da8('0x11')]){if(_0x58b4ab['error'][_0x6da8('0x12')]===0x1f4){logger['error'](_0x6da8('0xd'),_0x583379,_0x58b4ab[_0x6da8('0x11')][_0x6da8('0x13')]);return _0x71aa82(_0x58b4ab[_0x6da8('0x11')][_0x6da8('0x13')]);}logger[_0x6da8('0x11')](_0x6da8('0xd'),_0x583379,_0x58b4ab['error'][_0x6da8('0x13')]);return _0x249659(_0x58b4ab[_0x6da8('0x11')]['message']);}else{logger[_0x6da8('0xc')](_0x6da8('0xd'),_0x583379,_0x6da8('0xe'));_0x249659(_0x58b4ab[_0x6da8('0x14')][_0x6da8('0x13')]);}})[_0x6da8('0x15')](function(_0x4e055c){logger[_0x6da8('0x11')](_0x6da8('0xd'),_0x583379,_0x4e055c);_0x71aa82(_0x4e055c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8360ae3..fd7a42f 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(_0x1d2d2a,_0x1e0081){var _0x59c524=function(_0x2180d3){while(--_0x2180d3){_0x1d2d2a['push'](_0x1d2d2a['shift']());}};_0x59c524(++_0x1e0081);}(_0x70e0,0x17b));var _0x070e=function(_0x58ced2,_0x189c6d){_0x58ced2=_0x58ced2-0x0;var _0x1f2617=_0x70e0[_0x58ced2];return _0x1f2617;};'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(_0x4692a1,_0x41f54f){var _0x128700=function(_0x2661dc){while(--_0x2661dc){_0x4692a1['push'](_0x4692a1['shift']());}};_0x128700(++_0x41f54f);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 80a993b..029375c 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 _0xebaf=['sequelize','exports','INTEGER','STRING'];(function(_0x36c063,_0x233be3){var _0x1b6102=function(_0x2c88dd){while(--_0x2c88dd){_0x36c063['push'](_0x36c063['shift']());}};_0x1b6102(++_0x233be3);}(_0xebaf,0x188));var _0xfeba=function(_0x101cd0,_0x58008b){_0x101cd0=_0x101cd0-0x0;var _0x41897a=_0xebaf[_0x101cd0];return _0x41897a;};'use strict';var Sequelize=require(_0xfeba('0x0'));module[_0xfeba('0x1')]={'penalty':{'type':Sequelize[_0xfeba('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xfeba('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfeba('0x3')]}}; \ No newline at end of file +var _0xac9b=['exports','INTEGER','STRING','sequelize'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xac9b,0x163));var _0xbac9=function(_0x1e175d,_0x41ff45){_0x1e175d=_0x1e175d-0x0;var _0x3a3ce5=_0xac9b[_0x1e175d];return _0x3a3ce5;};'use strict';var Sequelize=require(_0xbac9('0x0'));module[_0xbac9('0x1')]={'penalty':{'type':Sequelize[_0xbac9('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbac9('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e63f295..9c8aaeb 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 _0x4d84=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0x4d84,0x147));var _0x44d8=function(_0x22add5,_0x346816){_0x22add5=_0x22add5-0x0;var _0x39c293=_0x4d84[_0x22add5];return _0x39c293;};'use strict';var _=require(_0x44d8('0x0'));var util=require(_0x44d8('0x1'));var logger=require(_0x44d8('0x2'))(_0x44d8('0x3'));var moment=require('moment');var BPromise=require(_0x44d8('0x4'));var rp=require(_0x44d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x44d8('0x6'));var attributes=require(_0x44d8('0x7'));module[_0x44d8('0x8')]=function(_0x16eb15,_0x23e845){return _0x16eb15[_0x44d8('0x9')](_0x44d8('0xa'),attributes,{'tableName':_0x44d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dcc=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues'];(function(_0x5a03a0,_0x5cc8cb){var _0x12ae40=function(_0x472774){while(--_0x472774){_0x5a03a0['push'](_0x5a03a0['shift']());}};_0x12ae40(++_0x5cc8cb);}(_0x4dcc,0xee));var _0xc4dc=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x4dcc[_0xea35d1];return _0x1d7a7c;};'use strict';var _=require(_0xc4dc('0x0'));var util=require(_0xc4dc('0x1'));var logger=require(_0xc4dc('0x2'))('api');var moment=require(_0xc4dc('0x3'));var BPromise=require(_0xc4dc('0x4'));var rp=require(_0xc4dc('0x5'));var fs=require('fs');var path=require(_0xc4dc('0x6'));var rimraf=require(_0xc4dc('0x7'));var config=require(_0xc4dc('0x8'));var attributes=require(_0xc4dc('0x9'));module[_0xc4dc('0xa')]=function(_0x2328fa,_0x2a0a3a){return _0x2328fa[_0xc4dc('0xb')](_0xc4dc('0xc'),attributes,{'tableName':_0xc4dc('0xd'),'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 7d0aae5..7a5979f 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 _0xd027=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UserFaxQueue,\x20%s,\x20%s','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3351af,_0xea5b24){var _0x4e4259=function(_0x316197){while(--_0x316197){_0x3351af['push'](_0x3351af['shift']());}};_0x4e4259(++_0xea5b24);}(_0xd027,0xec));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7d02('0x0'));var BPromise=require(_0x7d02('0x1'));var rs=require(_0x7d02('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d02('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d02('0x4'))(_0x7d02('0x5'));var config=require(_0x7d02('0x6'));var jayson=require(_0x7d02('0x7'));var client=jayson[_0x7d02('0x8')][_0x7d02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b2e77,_0xfbbf1d,_0x4adf06){return new BPromise(function(_0x8c8eef,_0x321b4d){return client['request'](_0x4b2e77,_0x4adf06)[_0x7d02('0xa')](function(_0x35cea4){logger[_0x7d02('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0xfbbf1d,'request\x20sent');logger['debug'](_0x7d02('0xc'),_0xfbbf1d,_0x7d02('0xd'),JSON[_0x7d02('0xe')](_0x35cea4));if(_0x35cea4[_0x7d02('0xf')]){if(_0x35cea4[_0x7d02('0xf')][_0x7d02('0x10')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0xfbbf1d,_0x35cea4['error'][_0x7d02('0x11')]);return _0x321b4d(_0x35cea4[_0x7d02('0xf')][_0x7d02('0x11')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0xfbbf1d,_0x35cea4[_0x7d02('0xf')][_0x7d02('0x11')]);return _0x8c8eef(_0x35cea4[_0x7d02('0xf')][_0x7d02('0x11')]);}else{logger[_0x7d02('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0xfbbf1d,'request\x20sent');_0x8c8eef(_0x35cea4['result']['message']);}})[_0x7d02('0x12')](function(_0x5ab35e){logger['error'](_0x7d02('0x13'),_0xfbbf1d,_0x5ab35e);_0x321b4d(_0x5ab35e);});});} \ No newline at end of file +var _0x5525=['then','info','debug','request\x20sent','stringify','code','UserFaxQueue,\x20%s,\x20%s','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request'];(function(_0x44b3f6,_0x2f0b79){var _0x4a6207=function(_0x5835fb){while(--_0x5835fb){_0x44b3f6['push'](_0x44b3f6['shift']());}};_0x4a6207(++_0x2f0b79);}(_0x5525,0x16f));var _0x5552=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5525[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x5552('0x0'));var moment=require(_0x5552('0x1'));var BPromise=require(_0x5552('0x2'));var rs=require(_0x5552('0x3'));var fs=require('fs');var Redis=require(_0x5552('0x4'));var db=require(_0x5552('0x5'))['db'];var utils=require(_0x5552('0x6'));var logger=require('../../config/logger')(_0x5552('0x7'));var config=require(_0x5552('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5552('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3504e1,_0x2a3f55,_0x51872a){return new BPromise(function(_0x8f0463,_0xe24a86){return client[_0x5552('0xa')](_0x3504e1,_0x51872a)[_0x5552('0xb')](function(_0x5581f7){logger[_0x5552('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x2a3f55,'request\x20sent');logger[_0x5552('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2a3f55,_0x5552('0xe'),JSON[_0x5552('0xf')](_0x5581f7));if(_0x5581f7['error']){if(_0x5581f7['error'][_0x5552('0x10')]===0x1f4){logger['error'](_0x5552('0x11'),_0x2a3f55,_0x5581f7[_0x5552('0x12')]['message']);return _0xe24a86(_0x5581f7[_0x5552('0x12')][_0x5552('0x13')]);}logger[_0x5552('0x12')](_0x5552('0x11'),_0x2a3f55,_0x5581f7[_0x5552('0x12')][_0x5552('0x13')]);return _0x8f0463(_0x5581f7[_0x5552('0x12')]['message']);}else{logger[_0x5552('0xc')](_0x5552('0x11'),_0x2a3f55,_0x5552('0xe'));_0x8f0463(_0x5581f7['result']['message']);}})[_0x5552('0x14')](function(_0xd33781){logger[_0x5552('0x12')](_0x5552('0x11'),_0x2a3f55,_0xd33781);_0xe24a86(_0xd33781);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 711a21d..6f9b19d 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x190765,_0x3ca3c1){var _0x1374f5=function(_0x19d2d2){while(--_0x19d2d2){_0x190765['push'](_0x190765['shift']());}};_0x1374f5(++_0x3ca3c1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0xcb91[_0x255ac0];return _0x437bf1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5dff5b,_0x600c5d){var _0x34dd83=function(_0x9830f8){while(--_0x9830f8){_0x5dff5b['push'](_0x5dff5b['shift']());}};_0x34dd83(++_0x600c5d);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ed40bac..678030e 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 _0x5859=['INTEGER','sequelize','exports'];(function(_0x4926af,_0x3b5543){var _0x2d7bc8=function(_0x5ac697){while(--_0x5ac697){_0x4926af['push'](_0x4926af['shift']());}};_0x2d7bc8(++_0x3b5543);}(_0x5859,0xc4));var _0x9585=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x5859[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require(_0x9585('0x0'));module[_0x9585('0x1')]={'penalty':{'type':Sequelize[_0x9585('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x58ea=['sequelize','exports','INTEGER'];(function(_0x4fe12b,_0x22a8ad){var _0x43957c=function(_0x666236){while(--_0x666236){_0x4fe12b['push'](_0x4fe12b['shift']());}};_0x43957c(++_0x22a8ad);}(_0x58ea,0x81));var _0xa58e=function(_0x53015d,_0x3d4f53){_0x53015d=_0x53015d-0x0;var _0x5c73f9=_0x58ea[_0x53015d];return _0x5c73f9;};'use strict';var Sequelize=require(_0xa58e('0x0'));module[_0xa58e('0x1')]={'penalty':{'type':Sequelize[_0xa58e('0x2')],'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 11d8f1a..1f4361d 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 _0x5de3=['rimraf','../../config/environment','exports','define','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2ba80b,_0x2032da){var _0x321192=function(_0x5df7ab){while(--_0x5df7ab){_0x2ba80b['push'](_0x2ba80b['shift']());}};_0x321192(++_0x2032da);}(_0x5de3,0x179));var _0x35de=function(_0x2cde2a,_0x4325c4){_0x2cde2a=_0x2cde2a-0x0;var _0x110f55=_0x5de3[_0x2cde2a];return _0x110f55;};'use strict';var _=require(_0x35de('0x0'));var util=require(_0x35de('0x1'));var logger=require(_0x35de('0x2'))(_0x35de('0x3'));var moment=require(_0x35de('0x4'));var BPromise=require(_0x35de('0x5'));var rp=require(_0x35de('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x35de('0x7'));var config=require(_0x35de('0x8'));var attributes=require('./userMailQueue.attributes');module[_0x35de('0x9')]=function(_0x4429a1,_0x297c6b){return _0x4429a1[_0x35de('0xa')]('UserMailQueue',attributes,{'tableName':_0x35de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84c9=['define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x1bd85d,_0xdc683f){var _0xd40669=function(_0x318648){while(--_0x318648){_0x1bd85d['push'](_0x1bd85d['shift']());}};_0xd40669(++_0xdc683f);}(_0x84c9,0x1a7));var _0x984c=function(_0x9f2862,_0x222aa2){_0x9f2862=_0x9f2862-0x0;var _0x28c48f=_0x84c9[_0x9f2862];return _0x28c48f;};'use strict';var _=require('lodash');var util=require(_0x984c('0x0'));var logger=require(_0x984c('0x1'))(_0x984c('0x2'));var moment=require(_0x984c('0x3'));var BPromise=require(_0x984c('0x4'));var rp=require(_0x984c('0x5'));var fs=require('fs');var path=require(_0x984c('0x6'));var rimraf=require(_0x984c('0x7'));var config=require(_0x984c('0x8'));var attributes=require(_0x984c('0x9'));module[_0x984c('0xa')]=function(_0x4cad19,_0x23e8d7){return _0x4cad19[_0x984c('0xb')](_0x984c('0xc'),attributes,{'tableName':_0x984c('0xd'),'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 50bb4b8..def8634 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1a541a,_0x290ba1){var _0x33068e=function(_0x478b96){while(--_0x478b96){_0x1a541a['push'](_0x1a541a['shift']());}};_0x33068e(++_0x290ba1);}(_0x34e8,0x12c));var _0x834e=function(_0x540f97,_0x455cfa){_0x540f97=_0x540f97-0x0;var _0x3dd85f=_0x34e8[_0x540f97];return _0x3dd85f;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5e66c4,_0x3ecef1){_0x5e66c4=_0x5e66c4-0x0;var _0xd2e04f=_0x1cb9[_0x5e66c4];return _0xd2e04f;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 153450c..0fecc32 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 _0xd29e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x117bee,_0x53dd69){var _0x2e4511=function(_0x5afffc){while(--_0x5afffc){_0x117bee['push'](_0x117bee['shift']());}};_0x2e4511(++_0x53dd69);}(_0xd29e,0x76));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xed29('0x0'));var util=require(_0xed29('0x1'));var path=require(_0xed29('0x2'));var timeout=require(_0xed29('0x3'));var express=require(_0xed29('0x4'));var router=express[_0xed29('0x5')]();var fs_extra=require(_0xed29('0x6'));var auth=require(_0xed29('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xed29('0x8'));router['post']('/',auth[_0xed29('0x9')](),controller[_0xed29('0xa')]);module[_0xed29('0xb')]=router; \ No newline at end of file +var _0xce60=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','exports'];(function(_0x36375a,_0x43ede3){var _0xe646d0=function(_0x4e9ea2){while(--_0x4e9ea2){_0x36375a['push'](_0x36375a['shift']());}};_0xe646d0(++_0x43ede3);}(_0xce60,0xbe));var _0x0ce6=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0xce60[_0x2abc3d];return _0x252745;};'use strict';var multer=require('multer');var util=require(_0x0ce6('0x0'));var path=require('path');var timeout=require(_0x0ce6('0x1'));var express=require(_0x0ce6('0x2'));var router=express[_0x0ce6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0ce6('0x4'));var interaction=require(_0x0ce6('0x5'));var config=require('../../config/environment');var controller=require(_0x0ce6('0x6'));router[_0x0ce6('0x7')]('/',auth[_0x0ce6('0x8')](),controller['sendUserNotification']);module[_0x0ce6('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 663dda3..5323918 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 _0xcee4=['exports','TEXT','STRING','BOOLEAN'];(function(_0x3052ce,_0x5e2200){var _0x13a27e=function(_0x3c9611){while(--_0x3c9611){_0x3052ce['push'](_0x3052ce['shift']());}};_0x13a27e(++_0x5e2200);}(_0xcee4,0xa4));var _0x4cee=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xcee4[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0x4cee('0x0')]={'body':{'type':Sequelize[_0x4cee('0x1')]},'senderName':{'type':Sequelize[_0x4cee('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x4cee('0x2')]},'beep':{'type':Sequelize[_0x4cee('0x3')]}}; \ No newline at end of file +var _0xd168=['TEXT','STRING','sequelize'];(function(_0x1898ea,_0x465e76){var _0x484b02=function(_0x64e72e){while(--_0x64e72e){_0x1898ea['push'](_0x1898ea['shift']());}};_0x484b02(++_0x465e76);}(_0xd168,0x8f));var _0x8d16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd168[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8d16('0x0'));module['exports']={'body':{'type':Sequelize[_0x8d16('0x1')]},'senderName':{'type':Sequelize[_0x8d16('0x2')]},'recipientsId':{'type':Sequelize[_0x8d16('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d482115..d7e7d02 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 _0xf810=['Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','replace','queue','push','all','flatten','catch','findOne','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','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','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','includes','model','toLowerCase','senderName','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xf810,0x142));var _0x0f81=function(_0x290e51,_0x108e58){_0x290e51=_0x290e51-0x0;var _0x1e901b=_0xf810[_0x290e51];return _0x1e901b;};'use strict';var emlformat=require(_0x0f81('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f81('0x1'));var jsonpatch=require(_0x0f81('0x2'));var rp=require(_0x0f81('0x3'));var moment=require(_0x0f81('0x4'));var BPromise=require(_0x0f81('0x5'));var Mustache=require(_0x0f81('0x6'));var util=require('util');var path=require(_0x0f81('0x7'));var sox=require(_0x0f81('0x8'));var csv=require('to-csv');var ejs=require(_0x0f81('0x9'));var fs=require('fs');var fs_extra=require(_0x0f81('0xa'));var _=require(_0x0f81('0xb'));var squel=require('squel');var crypto=require(_0x0f81('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0f81('0xd'));var toCsv=require(_0x0f81('0xe'));var querystring=require('querystring');var Papa=require(_0x0f81('0xf'));var Redis=require(_0x0f81('0x10'));var authService=require(_0x0f81('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0f81('0x12'));var hardwareService=require(_0x0f81('0x13'));var logger=require(_0x0f81('0x14'))(_0x0f81('0x15'));var utils=require(_0x0f81('0x16'));var config=require(_0x0f81('0x17'));var licenseUtil=require(_0x0f81('0x18'));var db=require(_0x0f81('0x19'))['db'];config[_0x0f81('0x1a')]=_[_0x0f81('0x1b')](config[_0x0f81('0x1a')],{'host':_0x0f81('0x1c'),'port':0x18eb});var socket=require(_0x0f81('0x1d'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x2f7c16,_0x3e26fd){_0x3e26fd=_0x3e26fd||0xcc;return function(_0xed9406){if(_0xed9406){return _0x2f7c16[_0x0f81('0x1e')](_0x3e26fd);}return _0x2f7c16[_0x0f81('0x1f')](_0x3e26fd)[_0x0f81('0x20')]();};}function respondWithResult(_0x1bebd3,_0x3a495e){_0x3a495e=_0x3a495e||0xc8;return function(_0x133226){if(_0x133226){return _0x1bebd3['status'](_0x3a495e)[_0x0f81('0x21')](_0x133226);}};}function respondWithFilteredResult(_0x531a22,_0x4966af){return function(_0x3dddf2){if(_0x3dddf2){var _0x2141a1=typeof _0x4966af[_0x0f81('0x22')]===_0x0f81('0x23')&&typeof _0x4966af['limit']==='undefined';var _0x31d4a8=_0x3dddf2[_0x0f81('0x24')];var _0x5d0545=_0x2141a1?0x0:_0x4966af['offset'];var _0x4a036b=_0x2141a1?_0x3dddf2['count']:_0x4966af[_0x0f81('0x22')]+_0x4966af[_0x0f81('0x25')];var _0x1da162;if(_0x4a036b>=_0x31d4a8){_0x4a036b=_0x31d4a8;_0x1da162=0xc8;}else{_0x1da162=0xce;}_0x531a22[_0x0f81('0x1f')](_0x1da162);return _0x531a22[_0x0f81('0x26')](_0x0f81('0x27'),_0x5d0545+'-'+_0x4a036b+'/'+_0x31d4a8)[_0x0f81('0x21')](_0x3dddf2);}return null;};}function patchUpdates(_0x361a4e){return function(_0x283616){try{jsonpatch[_0x0f81('0x28')](_0x283616,_0x361a4e,!![]);}catch(_0x421e9a){return BPromise[_0x0f81('0x29')](_0x421e9a);}return _0x283616[_0x0f81('0x2a')]();};}function saveUpdates(_0x3c4a0d,_0x1f67ae){return function(_0x44689a){if(_0x44689a){return _0x44689a[_0x0f81('0x2b')](_0x3c4a0d)['then'](function(_0x49c223){return _0x49c223;});}return null;};}function removeEntity(_0x4f60bf,_0x56b705){return function(_0x219560){if(_0x219560){return _0x219560['destroy']()[_0x0f81('0x2c')](function(){_0x4f60bf['status'](0xcc)[_0x0f81('0x20')]();});}};}function handleEntityNotFound(_0x446232,_0x3c9af0){return function(_0x2106b5){if(!_0x2106b5){_0x446232[_0x0f81('0x1e')](0x194);}return _0x2106b5;};}function handleError(_0x279d3e,_0x156fe9){_0x156fe9=_0x156fe9||0x1f4;return function(_0x1e2203){logger[_0x0f81('0x2d')](_0x1e2203[_0x0f81('0x2e')]);if(_0x1e2203[_0x0f81('0x2f')]){delete _0x1e2203[_0x0f81('0x2f')];}_0x279d3e[_0x0f81('0x1f')](_0x156fe9)[_0x0f81('0x30')](_0x1e2203);};}exports[_0x0f81('0x31')]=function(_0x51b641,_0xfd1ab,_0x187d83){if(!_0x51b641['body'][_0x0f81('0x32')](_0x0f81('0x33'))&&!_0x51b641[_0x0f81('0x34')]['hasOwnProperty'](_0x0f81('0x35'))){throw new db[(_0x0f81('0x36'))][(_0x0f81('0x37'))](_0x0f81('0x38'));}else{if(_0x51b641[_0x0f81('0x34')][_0x0f81('0x32')](_0x0f81('0x35'))&&!_0x51b641[_0x0f81('0x34')][_0x0f81('0x32')](_0x0f81('0x39'))){throw new db[(_0x0f81('0x36'))][(_0x0f81('0x37'))](_0x0f81('0x3a'));}if(!_0x51b641[_0x0f81('0x34')][_0x0f81('0x32')]('recipients')){throw new db['Sequelize'][(_0x0f81('0x37'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x58b8ed=JSON['parse'](_0x51b641[_0x0f81('0x34')][_0x0f81('0x3b')]);}catch(_0x4d15a9){logger[_0x0f81('0x2d')](_0x4d15a9);throw new db[(_0x0f81('0x36'))][(_0x0f81('0x37'))](_0x0f81('0x3c'));}var _0x30107e=[_0x0f81('0x3d'),_0x0f81('0x3e'),_0x0f81('0x3f'),_0x0f81('0x40'),_0x0f81('0x41'),_0x0f81('0x42'),'whatsappqueue','team',_0x0f81('0x43')];if(_['some'](_0x58b8ed,function(_0x45f179){return!_[_0x0f81('0x44')](_0x30107e,_0x45f179[_0x0f81('0x45')][_0x0f81('0x46')]());})){throw new db['Sequelize'][(_0x0f81('0x37'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x1e8f32={};_0x1e8f32[_0x0f81('0x47')]=_0x51b641[_0x0f81('0x34')][_0x0f81('0x32')](_0x0f81('0x47'))?_0x51b641[_0x0f81('0x34')][_0x0f81('0x47')]:_0x51b641['user']['fullname'];_0x1e8f32[_0x0f81('0x48')]=_['isEmpty'](_0x51b641[_0x0f81('0x34')][_0x0f81('0x48')])?null:_0x51b641[_0x0f81('0x34')]['recipientsDescription'];_0x1e8f32['beep']=_0x51b641['body'][_0x0f81('0x49')]||![];_0x1e8f32[_0x0f81('0x4a')]=_0x51b641['user']['id'];return getContent(_0x51b641['body'])[_0x0f81('0x2c')](function(_0x4e5e56){_0x1e8f32[_0x0f81('0x34')]=_0x4e5e56;return getRecipients(_0x58b8ed);})[_0x0f81('0x2c')](function(_0x15af8c){_0x1e8f32[_0x0f81('0x4b')]=_[_0x0f81('0x4c')](_0x15af8c)[_0x0f81('0x4d')](',');return db[_0x0f81('0x4e')][_0x0f81('0x4f')](function(_0x5558c0){return db[_0x0f81('0x50')][_0x0f81('0x51')](_0x1e8f32,{'raw':!![],'transaction':_0x5558c0})[_0x0f81('0x2c')](function(_0x1099e4){var _0x676e38={'sender':_0x1e8f32['senderName'],'description':_0x1e8f32[_0x0f81('0x48')],'content':_0x1e8f32[_0x0f81('0x34')],'beep':_0x1e8f32[_0x0f81('0x49')]};_0x15af8c[_0x0f81('0x52')](function(_0x2a83b6){_0x676e38[_0x0f81('0x53')]=_0x2a83b6;socket[_0x0f81('0x54')](_0x0f81('0x55'),_0x676e38);});return _0x1099e4;});});})['then'](respondWithResult(_0xfd1ab,0xc9))['catch'](handleError(_0xfd1ab,null));};function getContent(_0x243b5b){return new BPromise(function(_0x4743dd,_0x31d478){if(_0x243b5b[_0x0f81('0x33')]){_0x4743dd(_0x243b5b['text']);return;}return db[_0x0f81('0x56')]['findOne']({'attributes':[_0x0f81('0x57')],'where':{'id':_0x243b5b[_0x0f81('0x35')]},'raw':!![]})[_0x0f81('0x2c')](function(_0x2cea11){if(!_0x2cea11)throw new db['Sequelize'][(_0x0f81('0x37'))](_0x0f81('0x58'));var _0x193995=Mustache[_0x0f81('0x59')](_0x2cea11['html'],_0x243b5b['view']);_0x4743dd(_0x193995);})['catch'](function(_0x445d12){_0x31d478(_0x445d12);});});}function getRecipients(_0x257ed6){return new BPromise(function(_0x236cd2,_0x24b2cb){var _0xedb32f=[];var _0x3602f2=[];_0x257ed6[_0x0f81('0x52')](function(_0x316a6a){var _0x3bf857=_[_0x0f81('0x5a')](_0x316a6a['model']['toLowerCase']());if(_0x3bf857===_0x0f81('0x5b')){_0xedb32f=_[_0x0f81('0x5c')](_0xedb32f,_0x316a6a[_0x0f81('0x5d')]);}else{if(_['includes'](_0x3bf857,'queue'))_0x3bf857=_0x3bf857[_0x0f81('0x5e')](_0x0f81('0x5f'),'Queue');_0x316a6a[_0x0f81('0x5d')][_0x0f81('0x52')](function(_0x4e6427){_0x3602f2[_0x0f81('0x60')](getAgents(_0x3bf857,_0x4e6427));});}});return BPromise[_0x0f81('0x61')](_0x3602f2)[_0x0f81('0x2c')](function(_0x4f3171){_0xedb32f=_[_0x0f81('0x5c')](_0xedb32f,_[_0x0f81('0x62')](_0x4f3171));_0x236cd2(_0xedb32f);})[_0x0f81('0x63')](function(_0x3e6ea8){_0x24b2cb(_0x3e6ea8);});});}function getAgents(_0x6f3c89,_0x11a99c){return new BPromise(function(_0x280d3a,_0x4d498a){return db[_0x6f3c89][_0x0f81('0x64')]({'where':{'id':_0x11a99c}})['then'](function(_0x481176){return _0x481176[_0x0f81('0x65')]({'attributes':['id'],'raw':!![]})[_0x0f81('0x2c')](function(_0x24bb99){var _0x490a19=_['map'](_0x24bb99,'id');_0x280d3a(_0x490a19);});})[_0x0f81('0x63')](function(_0x392f22){_0x4d498a(_0x392f22);});});} \ No newline at end of file +var _0x28fc=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','name','sendUserNotification','text','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','faxqueue','openchannelqueue','voicequeue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','create','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','model','union','ids','queue','push','all','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x32ce61,_0x2ba733){var _0x28eded=function(_0x34db11){while(--_0x34db11){_0x32ce61['push'](_0x32ce61['shift']());}};_0x28eded(++_0x2ba733);}(_0x28fc,0x102));var _0xc28f=function(_0x54a573,_0x49c04d){_0x54a573=_0x54a573-0x0;var _0x2c45a9=_0x28fc[_0x54a573];return _0x2c45a9;};'use strict';var emlformat=require(_0xc28f('0x0'));var rimraf=require(_0xc28f('0x1'));var zipdir=require(_0xc28f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc28f('0x3'));var moment=require(_0xc28f('0x4'));var BPromise=require(_0xc28f('0x5'));var Mustache=require(_0xc28f('0x6'));var util=require(_0xc28f('0x7'));var path=require(_0xc28f('0x8'));var sox=require('sox');var csv=require(_0xc28f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc28f('0xa'));var _=require(_0xc28f('0xb'));var squel=require(_0xc28f('0xc'));var crypto=require(_0xc28f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc28f('0xe'));var toCsv=require(_0xc28f('0x9'));var querystring=require('querystring');var Papa=require(_0xc28f('0xf'));var Redis=require(_0xc28f('0x10'));var authService=require(_0xc28f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc28f('0x12'));var logger=require(_0xc28f('0x13'))('api');var utils=require(_0xc28f('0x14'));var config=require(_0xc28f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc28f('0x16'))['db'];config['redis']=_[_0xc28f('0x17')](config[_0xc28f('0x18')],{'host':_0xc28f('0x19'),'port':0x18eb});var socket=require(_0xc28f('0x1a'))(new Redis(config['redis']));require('./userNotification.socket')[_0xc28f('0x1b')](socket);function respondWithStatusCode(_0xa338bd,_0x4ad532){_0x4ad532=_0x4ad532||0xcc;return function(_0x2ee5c9){if(_0x2ee5c9){return _0xa338bd[_0xc28f('0x1c')](_0x4ad532);}return _0xa338bd[_0xc28f('0x1d')](_0x4ad532)[_0xc28f('0x1e')]();};}function respondWithResult(_0x10ebcc,_0x519a4c){_0x519a4c=_0x519a4c||0xc8;return function(_0x3af98f){if(_0x3af98f){return _0x10ebcc[_0xc28f('0x1d')](_0x519a4c)[_0xc28f('0x1f')](_0x3af98f);}};}function respondWithFilteredResult(_0x1dcf61,_0x17d9fb){return function(_0x31e803){if(_0x31e803){var _0x120c20=typeof _0x17d9fb[_0xc28f('0x20')]===_0xc28f('0x21')&&typeof _0x17d9fb['limit']===_0xc28f('0x21');var _0x8482b4=_0x31e803[_0xc28f('0x22')];var _0x4e1c62=_0x120c20?0x0:_0x17d9fb[_0xc28f('0x20')];var _0x32111c=_0x120c20?_0x31e803['count']:_0x17d9fb[_0xc28f('0x20')]+_0x17d9fb[_0xc28f('0x23')];var _0x570541;if(_0x32111c>=_0x8482b4){_0x32111c=_0x8482b4;_0x570541=0xc8;}else{_0x570541=0xce;}_0x1dcf61[_0xc28f('0x1d')](_0x570541);return _0x1dcf61['set'](_0xc28f('0x24'),_0x4e1c62+'-'+_0x32111c+'/'+_0x8482b4)[_0xc28f('0x1f')](_0x31e803);}return null;};}function patchUpdates(_0x3cc6d9){return function(_0x103213){try{jsonpatch['apply'](_0x103213,_0x3cc6d9,!![]);}catch(_0x53ea1c){return BPromise[_0xc28f('0x25')](_0x53ea1c);}return _0x103213[_0xc28f('0x26')]();};}function saveUpdates(_0x46f7eb,_0x347c11){return function(_0x17438c){if(_0x17438c){return _0x17438c[_0xc28f('0x27')](_0x46f7eb)[_0xc28f('0x28')](function(_0x3aac31){return _0x3aac31;});}return null;};}function removeEntity(_0x462b6d,_0x1bf59e){return function(_0x1a4fac){if(_0x1a4fac){return _0x1a4fac[_0xc28f('0x29')]()[_0xc28f('0x28')](function(){_0x462b6d[_0xc28f('0x1d')](0xcc)[_0xc28f('0x1e')]();});}};}function handleEntityNotFound(_0x22b126,_0x3b32b0){return function(_0x42c101){if(!_0x42c101){_0x22b126[_0xc28f('0x1c')](0x194);}return _0x42c101;};}function handleError(_0x3b2f45,_0x1881fa){_0x1881fa=_0x1881fa||0x1f4;return function(_0x405a4d){logger[_0xc28f('0x2a')](_0x405a4d['stack']);if(_0x405a4d[_0xc28f('0x2b')]){delete _0x405a4d[_0xc28f('0x2b')];}_0x3b2f45[_0xc28f('0x1d')](_0x1881fa)['send'](_0x405a4d);};}exports[_0xc28f('0x2c')]=function(_0x1f1d36,_0x9962b0,_0x2c9ad0){if(!_0x1f1d36['body']['hasOwnProperty'](_0xc28f('0x2d'))&&!_0x1f1d36['body'][_0xc28f('0x2e')]('TemplateId')){throw new db[(_0xc28f('0x2f'))][(_0xc28f('0x30'))](_0xc28f('0x31'));}else{if(_0x1f1d36[_0xc28f('0x32')][_0xc28f('0x2e')](_0xc28f('0x33'))&&!_0x1f1d36[_0xc28f('0x32')][_0xc28f('0x2e')](_0xc28f('0x34'))){throw new db[(_0xc28f('0x2f'))][(_0xc28f('0x30'))](_0xc28f('0x35'));}if(!_0x1f1d36[_0xc28f('0x32')][_0xc28f('0x2e')](_0xc28f('0x36'))){throw new db[(_0xc28f('0x2f'))][(_0xc28f('0x30'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x591d79=JSON['parse'](_0x1f1d36[_0xc28f('0x32')][_0xc28f('0x36')]);}catch(_0x15bf3f){logger[_0xc28f('0x2a')](_0x15bf3f);throw new db[(_0xc28f('0x2f'))][(_0xc28f('0x30'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x66288c=['chatqueue',_0xc28f('0x37'),'mailqueue',_0xc28f('0x38'),'smsqueue',_0xc28f('0x39'),'whatsappqueue',_0xc28f('0x3a'),_0xc28f('0x3b')];if(_[_0xc28f('0x3c')](_0x591d79,function(_0x3b041a){return!_[_0xc28f('0x3d')](_0x66288c,_0x3b041a['model'][_0xc28f('0x3e')]());})){throw new db[(_0xc28f('0x2f'))][(_0xc28f('0x30'))](_0xc28f('0x3f'));}}}var _0x3dc227={};_0x3dc227[_0xc28f('0x40')]=_0x1f1d36['body'][_0xc28f('0x2e')]('senderName')?_0x1f1d36[_0xc28f('0x32')][_0xc28f('0x40')]:_0x1f1d36[_0xc28f('0x3b')][_0xc28f('0x41')];_0x3dc227[_0xc28f('0x42')]=_[_0xc28f('0x43')](_0x1f1d36[_0xc28f('0x32')][_0xc28f('0x42')])?null:_0x1f1d36[_0xc28f('0x32')][_0xc28f('0x42')];_0x3dc227[_0xc28f('0x44')]=_0x1f1d36[_0xc28f('0x32')][_0xc28f('0x44')]||![];_0x3dc227[_0xc28f('0x45')]=_0x1f1d36[_0xc28f('0x3b')]['id'];return getContent(_0x1f1d36[_0xc28f('0x32')])[_0xc28f('0x28')](function(_0x47d0de){_0x3dc227[_0xc28f('0x32')]=_0x47d0de;return getRecipients(_0x591d79);})[_0xc28f('0x28')](function(_0x32e66a){_0x3dc227[_0xc28f('0x46')]=_['sortBy'](_0x32e66a)[_0xc28f('0x47')](',');return db[_0xc28f('0x48')][_0xc28f('0x49')](function(_0x5735cc){return db['UserNotification'][_0xc28f('0x4a')](_0x3dc227,{'raw':!![],'transaction':_0x5735cc})[_0xc28f('0x28')](function(_0x5c1642){var _0x303901={'sender':_0x3dc227[_0xc28f('0x40')],'description':_0x3dc227[_0xc28f('0x42')],'content':_0x3dc227[_0xc28f('0x32')],'beep':_0x3dc227[_0xc28f('0x44')]};_0x32e66a['forEach'](function(_0x5f1532){_0x303901['recipient']=_0x5f1532;socket['emit'](_0xc28f('0x4b'),_0x303901);});return _0x5c1642;});});})[_0xc28f('0x28')](respondWithResult(_0x9962b0,0xc9))[_0xc28f('0x4c')](handleError(_0x9962b0,null));};function getContent(_0x2e29e3){return new BPromise(function(_0x5408d0,_0x1f2553){if(_0x2e29e3['text']){_0x5408d0(_0x2e29e3['text']);return;}return db[_0xc28f('0x4d')][_0xc28f('0x4e')]({'attributes':[_0xc28f('0x4f')],'where':{'id':_0x2e29e3[_0xc28f('0x33')]},'raw':!![]})[_0xc28f('0x28')](function(_0x1a2626){if(!_0x1a2626)throw new db['Sequelize'][(_0xc28f('0x30'))](_0xc28f('0x50'));var _0x32c780=Mustache[_0xc28f('0x51')](_0x1a2626[_0xc28f('0x4f')],_0x2e29e3[_0xc28f('0x34')]);_0x5408d0(_0x32c780);})[_0xc28f('0x4c')](function(_0x54fefe){_0x1f2553(_0x54fefe);});});}function getRecipients(_0x360dea){return new BPromise(function(_0x326634,_0x18c853){var _0x3695c3=[];var _0x26f9ce=[];_0x360dea[_0xc28f('0x52')](function(_0x44f839){var _0x3df082=_['startCase'](_0x44f839[_0xc28f('0x53')][_0xc28f('0x3e')]());if(_0x3df082==='User'){_0x3695c3=_[_0xc28f('0x54')](_0x3695c3,_0x44f839[_0xc28f('0x55')]);}else{if(_[_0xc28f('0x3d')](_0x3df082,_0xc28f('0x56')))_0x3df082=_0x3df082['replace'](_0xc28f('0x56'),'Queue');_0x44f839[_0xc28f('0x55')][_0xc28f('0x52')](function(_0x5e8688){_0x26f9ce[_0xc28f('0x57')](getAgents(_0x3df082,_0x5e8688));});}});return BPromise[_0xc28f('0x58')](_0x26f9ce)['then'](function(_0x2717a7){_0x3695c3=_[_0xc28f('0x54')](_0x3695c3,_['flatten'](_0x2717a7));_0x326634(_0x3695c3);})['catch'](function(_0x4d0878){_0x18c853(_0x4d0878);});});}function getAgents(_0x2266ba,_0x481484){return new BPromise(function(_0x575a08,_0x29d997){return db[_0x2266ba]['findOne']({'where':{'id':_0x481484}})[_0xc28f('0x28')](function(_0x2b1fd3){return _0x2b1fd3[_0xc28f('0x59')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1243db){var _0x1c5210=_[_0xc28f('0x5a')](_0x1243db,'id');_0x575a08(_0x1c5210);});})[_0xc28f('0x4c')](function(_0x2063f9){_0x29d997(_0x2063f9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 2996032..9be24c9 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 _0xe3ff=['emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification','setMaxListeners','remove'];(function(_0x1b8a79,_0x23c172){var _0x5bb25b=function(_0x586a4d){while(--_0x586a4d){_0x1b8a79['push'](_0x1b8a79['shift']());}};_0x5bb25b(++_0x23c172);}(_0xe3ff,0x1eb));var _0xfe3f=function(_0x5b2e87,_0x520cf1){_0x5b2e87=_0x5b2e87-0x0;var _0x2196fb=_0xe3ff[_0x5b2e87];return _0x2196fb;};'use strict';var EventEmitter=require(_0xfe3f('0x0'));var UserNotification=require(_0xfe3f('0x1'))['db'][_0xfe3f('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfe3f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfe3f('0x4')};function emitEvent(_0x5a795e){return function(_0x34a122,_0x5072e1,_0x484ba4){UserNotificationEvents[_0xfe3f('0x5')](_0x5a795e+':'+_0x34a122['id'],_0x34a122);UserNotificationEvents['emit'](_0x5a795e,_0x34a122);_0x484ba4(null);};}for(var e in events){if(events[_0xfe3f('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xfe3f('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x0709=['emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners','save','remove'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x0709,0x1e9));var _0x9070=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x0709[_0x584291];return _0x4e7d08;};'use strict';var EventEmitter=require(_0x9070('0x0'));var UserNotification=require(_0x9070('0x1'))['db'][_0x9070('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9070('0x3')](0x0);var events={'afterCreate':_0x9070('0x4'),'afterUpdate':'update','afterDestroy':_0x9070('0x5')};function emitEvent(_0x246f88){return function(_0x301b24,_0x5d9125,_0x496dbb){UserNotificationEvents[_0x9070('0x6')](_0x246f88+':'+_0x301b24['id'],_0x301b24);UserNotificationEvents[_0x9070('0x6')](_0x246f88,_0x301b24);_0x496dbb(null);};}for(var e in events){if(events[_0x9070('0x7')](e)){var event=events[e];UserNotification[_0x9070('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 7fffeda..f477cbd 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 _0xd6c9=['moment','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4','util'];(function(_0x2f1c29,_0x24d53d){var _0x54cb11=function(_0x526900){while(--_0x526900){_0x2f1c29['push'](_0x2f1c29['shift']());}};_0x54cb11(++_0x24d53d);}(_0xd6c9,0x128));var _0x9d6c=function(_0x188905,_0x398fac){_0x188905=_0x188905-0x0;var _0x2bf735=_0xd6c9[_0x188905];return _0x2bf735;};'use strict';var _=require('lodash');var util=require(_0x9d6c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9d6c('0x1'));var BPromise=require('bluebird');var rp=require(_0x9d6c('0x2'));var fs=require('fs');var path=require(_0x9d6c('0x3'));var rimraf=require(_0x9d6c('0x4'));var config=require(_0x9d6c('0x5'));var attributes=require(_0x9d6c('0x6'));module[_0x9d6c('0x7')]=function(_0x5b795c,_0x1ac877){return _0x5b795c[_0x9d6c('0x8')]('UserNotification',attributes,{'tableName':_0x9d6c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9d6c('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x75e9=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserNotification','utf8mb4'];(function(_0x121ffc,_0x86b101){var _0x42bba9=function(_0x1b0bdf){while(--_0x1b0bdf){_0x121ffc['push'](_0x121ffc['shift']());}};_0x42bba9(++_0x86b101);}(_0x75e9,0x1c1));var _0x975e=function(_0x5ad6cb,_0x31dee2){_0x5ad6cb=_0x5ad6cb-0x0;var _0x53b144=_0x75e9[_0x5ad6cb];return _0x53b144;};'use strict';var _=require('lodash');var util=require(_0x975e('0x0'));var logger=require(_0x975e('0x1'))(_0x975e('0x2'));var moment=require(_0x975e('0x3'));var BPromise=require(_0x975e('0x4'));var rp=require(_0x975e('0x5'));var fs=require('fs');var path=require(_0x975e('0x6'));var rimraf=require(_0x975e('0x7'));var config=require(_0x975e('0x8'));var attributes=require('./userNotification.attributes');module[_0x975e('0x9')]=function(_0x1681b9,_0x1f7eac){return _0x1681b9[_0x975e('0xa')](_0x975e('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x975e('0xc'),'collate':_0x975e('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 7f28b04..5453bea 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 _0x800a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','UserNotification,\x20%s,\x20%s','message','request\x20sent','catch'];(function(_0x405239,_0x10dce7){var _0x347b35=function(_0x480b8e){while(--_0x480b8e){_0x405239['push'](_0x405239['shift']());}};_0x347b35(++_0x10dce7);}(_0x800a,0x1ee));var _0xa800=function(_0x443ad5,_0x7655b2){_0x443ad5=_0x443ad5-0x0;var _0x2c549c=_0x800a[_0x443ad5];return _0x2c549c;};'use strict';var _=require('lodash');var util=require(_0xa800('0x0'));var moment=require(_0xa800('0x1'));var BPromise=require(_0xa800('0x2'));var rs=require(_0xa800('0x3'));var fs=require('fs');var Redis=require(_0xa800('0x4'));var db=require(_0xa800('0x5'))['db'];var utils=require(_0xa800('0x6'));var logger=require('../../config/logger')(_0xa800('0x7'));var config=require(_0xa800('0x8'));var jayson=require(_0xa800('0x9'));var client=jayson[_0xa800('0xa')][_0xa800('0xb')]({'port':0x232a});config[_0xa800('0xc')]=_[_0xa800('0xd')](config[_0xa800('0xc')],{'host':_0xa800('0xe'),'port':0x18eb});var socket=require(_0xa800('0xf'))(new Redis(config[_0xa800('0xc')]));require(_0xa800('0x10'))['register'](socket);function respondWithRpcPromise(_0x5a7345,_0x167775,_0x3a8ba4){return new BPromise(function(_0x2e3e0a,_0x113cf6){return client[_0xa800('0x11')](_0x5a7345,_0x3a8ba4)['then'](function(_0x5e1873){logger['info']('UserNotification,\x20%s,\x20%s',_0x167775,'request\x20sent');logger['debug'](_0xa800('0x12'),_0x167775,'request\x20sent',JSON[_0xa800('0x13')](_0x5e1873));if(_0x5e1873['error']){if(_0x5e1873['error'][_0xa800('0x14')]===0x1f4){logger[_0xa800('0x15')](_0xa800('0x16'),_0x167775,_0x5e1873[_0xa800('0x15')][_0xa800('0x17')]);return _0x113cf6(_0x5e1873[_0xa800('0x15')][_0xa800('0x17')]);}logger[_0xa800('0x15')]('UserNotification,\x20%s,\x20%s',_0x167775,_0x5e1873[_0xa800('0x15')][_0xa800('0x17')]);return _0x2e3e0a(_0x5e1873['error'][_0xa800('0x17')]);}else{logger['info'](_0xa800('0x16'),_0x167775,_0xa800('0x18'));_0x2e3e0a(_0x5e1873['result']['message']);}})[_0xa800('0x19')](function(_0x3a84fd){logger['error']('UserNotification,\x20%s,\x20%s',_0x167775,_0x3a84fd);_0x113cf6(_0x3a84fd);});});} \ No newline at end of file +var _0xf45b=['request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x4cafb1,_0x2954df){var _0x5d0869=function(_0x43667a){while(--_0x43667a){_0x4cafb1['push'](_0x4cafb1['shift']());}};_0x5d0869(++_0x2954df);}(_0xf45b,0x1ed));var _0xbf45=function(_0x182394,_0xc13ead){_0x182394=_0x182394-0x0;var _0x23a459=_0xf45b[_0x182394];return _0x23a459;};'use strict';var _=require(_0xbf45('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf45('0x1'));var rs=require(_0xbf45('0x2'));var fs=require('fs');var Redis=require(_0xbf45('0x3'));var db=require(_0xbf45('0x4'))['db'];var utils=require(_0xbf45('0x5'));var logger=require(_0xbf45('0x6'))(_0xbf45('0x7'));var config=require(_0xbf45('0x8'));var jayson=require(_0xbf45('0x9'));var client=jayson[_0xbf45('0xa')][_0xbf45('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbf45('0xc')],{'host':_0xbf45('0xd'),'port':0x18eb});var socket=require(_0xbf45('0xe'))(new Redis(config[_0xbf45('0xc')]));require(_0xbf45('0xf'))['register'](socket);function respondWithRpcPromise(_0x1bdb04,_0x384512,_0x697586){return new BPromise(function(_0x245aa2,_0x106e13){return client['request'](_0x1bdb04,_0x697586)['then'](function(_0x288987){logger[_0xbf45('0x10')](_0xbf45('0x11'),_0x384512,'request\x20sent');logger[_0xbf45('0x12')](_0xbf45('0x13'),_0x384512,_0xbf45('0x14'),JSON[_0xbf45('0x15')](_0x288987));if(_0x288987[_0xbf45('0x16')]){if(_0x288987[_0xbf45('0x16')][_0xbf45('0x17')]===0x1f4){logger['error'](_0xbf45('0x11'),_0x384512,_0x288987[_0xbf45('0x16')][_0xbf45('0x18')]);return _0x106e13(_0x288987['error'][_0xbf45('0x18')]);}logger[_0xbf45('0x16')]('UserNotification,\x20%s,\x20%s',_0x384512,_0x288987[_0xbf45('0x16')][_0xbf45('0x18')]);return _0x245aa2(_0x288987['error'][_0xbf45('0x18')]);}else{logger[_0xbf45('0x10')]('UserNotification,\x20%s,\x20%s',_0x384512,'request\x20sent');_0x245aa2(_0x288987[_0xbf45('0x19')][_0xbf45('0x18')]);}})[_0xbf45('0x1a')](function(_0x412a36){logger[_0xbf45('0x16')](_0xbf45('0x11'),_0x384512,_0x412a36);_0x106e13(_0x412a36);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index dca5753..b011e9e 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 _0xca69=['update','emit','removeListener','length','userNotification:','save','remove'];(function(_0x41455e,_0x4f3623){var _0x5eb52e=function(_0xd90ec6){while(--_0xd90ec6){_0x41455e['push'](_0x41455e['shift']());}};_0x5eb52e(++_0x4f3623);}(_0xca69,0x91));var _0x9ca6=function(_0x5dbeea,_0x21a655){_0x5dbeea=_0x5dbeea-0x0;var _0x528ebd=_0xca69[_0x5dbeea];return _0x528ebd;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x9ca6('0x0'),_0x9ca6('0x1'),_0x9ca6('0x2')];function createListener(_0x2e069e,_0x52f74b){return function(_0x1b665a){_0x52f74b[_0x9ca6('0x3')](_0x2e069e,_0x1b665a);};}function removeListener(_0x59b985,_0x164f97){return function(){UserNotificationEvents[_0x9ca6('0x4')](_0x59b985,_0x164f97);};}exports['register']=function(_0x2c5792){for(var _0x5ddfc1=0x0,_0x2f36bf=events[_0x9ca6('0x5')];_0x5ddfc1<_0x2f36bf;_0x5ddfc1++){var _0x30f85e=events[_0x5ddfc1];var _0x2815b1=createListener(_0x9ca6('0x6')+_0x30f85e,_0x2c5792);UserNotificationEvents['on'](_0x30f85e,_0x2815b1);}}; \ No newline at end of file +var _0xdae7=['register','length','userNotification:','./userNotification.events','save','remove','emit'];(function(_0x245186,_0x1e1234){var _0x5a6874=function(_0x2807fc){while(--_0x2807fc){_0x245186['push'](_0x245186['shift']());}};_0x5a6874(++_0x1e1234);}(_0xdae7,0x16f));var _0x7dae=function(_0x3fb166,_0x4eb985){_0x3fb166=_0x3fb166-0x0;var _0x5e91be=_0xdae7[_0x3fb166];return _0x5e91be;};'use strict';var UserNotificationEvents=require(_0x7dae('0x0'));var events=[_0x7dae('0x1'),_0x7dae('0x2'),'update'];function createListener(_0x6279d,_0x217230){return function(_0x340f05){_0x217230[_0x7dae('0x3')](_0x6279d,_0x340f05);};}function removeListener(_0x3d948b,_0x4bb9aa){return function(){UserNotificationEvents['removeListener'](_0x3d948b,_0x4bb9aa);};}exports[_0x7dae('0x4')]=function(_0x4c63f4){for(var _0x26b120=0x0,_0x16a9c1=events[_0x7dae('0x5')];_0x26b120<_0x16a9c1;_0x26b120++){var _0x378aa0=events[_0x26b120];var _0x566c61=createListener(_0x7dae('0x6')+_0x378aa0,_0x4c63f4);UserNotificationEvents['on'](_0x378aa0,_0x566c61);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 7fe8167..cce3508 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x38f348,_0x48844e){var _0x682209=function(_0x905f1a){while(--_0x905f1a){_0x38f348['push'](_0x38f348['shift']());}};_0x682209(++_0x48844e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x459402,_0x77507b){var _0x5882ad=function(_0x116e92){while(--_0x116e92){_0x459402['push'](_0x459402['shift']());}};_0x5882ad(++_0x77507b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 4bd86bb..be21abb 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 _0x5db6=['sequelize'];(function(_0x4ebe02,_0xf8161e){var _0x4fd241=function(_0x56f69d){while(--_0x56f69d){_0x4ebe02['push'](_0x4ebe02['shift']());}};_0x4fd241(++_0xf8161e);}(_0x5db6,0x88));var _0x65db=function(_0x41dcdb,_0x4e1a2f){_0x41dcdb=_0x41dcdb-0x0;var _0xce4042=_0x5db6[_0x41dcdb];return _0xce4042;};'use strict';var Sequelize=require(_0x65db('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb1ae=['sequelize'];(function(_0x2e2dbf,_0x59fee7){var _0x54b426=function(_0x16ee3a){while(--_0x16ee3a){_0x2e2dbf['push'](_0x2e2dbf['shift']());}};_0x54b426(++_0x59fee7);}(_0xb1ae,0x1bc));var _0xeb1a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ae[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xeb1a('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 e7ae401..de9e5f7 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 _0x5cc3=['path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','../../config/logger','api','request-promise'];(function(_0x1c8c07,_0x2579af){var _0x4aa88f=function(_0x2ad13d){while(--_0x2ad13d){_0x1c8c07['push'](_0x1c8c07['shift']());}};_0x4aa88f(++_0x2579af);}(_0x5cc3,0x11e));var _0x35cc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5cc3[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x35cc('0x0'));var util=require('util');var logger=require(_0x35cc('0x1'))(_0x35cc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x35cc('0x3'));var fs=require('fs');var path=require(_0x35cc('0x4'));var rimraf=require('rimraf');var config=require(_0x35cc('0x5'));var attributes=require(_0x35cc('0x6'));module[_0x35cc('0x7')]=function(_0x375149,_0x76748a){return _0x375149[_0x35cc('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0x35cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4da=['moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x494758,_0x4c225e){var _0x3a8bc0=function(_0x19e83b){while(--_0x19e83b){_0x494758['push'](_0x494758['shift']());}};_0x3a8bc0(++_0x4c225e);}(_0xa4da,0x134));var _0xaa4d=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0xa4da[_0x519c88];return _0x4668d7;};'use strict';var _=require(_0xaa4d('0x0'));var util=require(_0xaa4d('0x1'));var logger=require(_0xaa4d('0x2'))(_0xaa4d('0x3'));var moment=require(_0xaa4d('0x4'));var BPromise=require(_0xaa4d('0x5'));var rp=require(_0xaa4d('0x6'));var fs=require('fs');var path=require(_0xaa4d('0x7'));var rimraf=require(_0xaa4d('0x8'));var config=require('../../config/environment');var attributes=require(_0xaa4d('0x9'));module['exports']=function(_0x21b01f,_0x373e0e){return _0x21b01f[_0xaa4d('0xa')](_0xaa4d('0xb'),attributes,{'tableName':_0xaa4d('0xc'),'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 6bc04ff..73dacac 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 _0x1ca1=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0xca847c,_0x1774c0){var _0x2274fe=function(_0x387170){while(--_0x387170){_0xca847c['push'](_0xca847c['shift']());}};_0x2274fe(++_0x1774c0);}(_0x1ca1,0x6a));var _0x11ca=function(_0x5dfde8,_0xa2f77d){_0x5dfde8=_0x5dfde8-0x0;var _0x2253fb=_0x1ca1[_0x5dfde8];return _0x2253fb;};'use strict';var _=require(_0x11ca('0x0'));var util=require(_0x11ca('0x1'));var moment=require(_0x11ca('0x2'));var BPromise=require(_0x11ca('0x3'));var rs=require(_0x11ca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x11ca('0x6'))(_0x11ca('0x7'));var config=require(_0x11ca('0x8'));var jayson=require(_0x11ca('0x9'));var client=jayson[_0x11ca('0xa')][_0x11ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52424b,_0x2887a6,_0x3ad762){return new BPromise(function(_0xe46fab,_0x4dd1c6){return client['request'](_0x52424b,_0x3ad762)['then'](function(_0x2a8913){logger['info'](_0x11ca('0xc'),_0x2887a6,_0x11ca('0xd'));logger['debug'](_0x11ca('0xe'),_0x2887a6,_0x11ca('0xd'),JSON['stringify'](_0x2a8913));if(_0x2a8913[_0x11ca('0xf')]){if(_0x2a8913[_0x11ca('0xf')][_0x11ca('0x10')]===0x1f4){logger[_0x11ca('0xf')](_0x11ca('0xc'),_0x2887a6,_0x2a8913[_0x11ca('0xf')][_0x11ca('0x11')]);return _0x4dd1c6(_0x2a8913[_0x11ca('0xf')][_0x11ca('0x11')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x2887a6,_0x2a8913[_0x11ca('0xf')][_0x11ca('0x11')]);return _0xe46fab(_0x2a8913[_0x11ca('0xf')][_0x11ca('0x11')]);}else{logger[_0x11ca('0x12')](_0x11ca('0xc'),_0x2887a6,_0x11ca('0xd'));_0xe46fab(_0x2a8913[_0x11ca('0x13')][_0x11ca('0x11')]);}})[_0x11ca('0x14')](function(_0x2633af){logger['error'](_0x11ca('0xc'),_0x2887a6,_0x2633af);_0x4dd1c6(_0x2633af);});});} \ No newline at end of file +var _0x43cd=['../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x43cd,0x79));var _0xd43c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x43cd[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xd43c('0x0'));var util=require(_0xd43c('0x1'));var moment=require(_0xd43c('0x2'));var BPromise=require('bluebird');var rs=require(_0xd43c('0x3'));var fs=require('fs');var Redis=require(_0xd43c('0x4'));var db=require(_0xd43c('0x5'))['db'];var utils=require(_0xd43c('0x6'));var logger=require('../../config/logger')(_0xd43c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd43c('0x8'));var client=jayson['client'][_0xd43c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bc8ed,_0x4d1c5d,_0x441c69){return new BPromise(function(_0x21ecf7,_0x201e45){return client['request'](_0x1bc8ed,_0x441c69)[_0xd43c('0xa')](function(_0xb41c6b){logger[_0xd43c('0xb')](_0xd43c('0xc'),_0x4d1c5d,'request\x20sent');logger[_0xd43c('0xd')](_0xd43c('0xe'),_0x4d1c5d,_0xd43c('0xf'),JSON[_0xd43c('0x10')](_0xb41c6b));if(_0xb41c6b[_0xd43c('0x11')]){if(_0xb41c6b[_0xd43c('0x11')][_0xd43c('0x12')]===0x1f4){logger[_0xd43c('0x11')](_0xd43c('0xc'),_0x4d1c5d,_0xb41c6b[_0xd43c('0x11')][_0xd43c('0x13')]);return _0x201e45(_0xb41c6b[_0xd43c('0x11')][_0xd43c('0x13')]);}logger[_0xd43c('0x11')](_0xd43c('0xc'),_0x4d1c5d,_0xb41c6b[_0xd43c('0x11')][_0xd43c('0x13')]);return _0x21ecf7(_0xb41c6b[_0xd43c('0x11')][_0xd43c('0x13')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4d1c5d,_0xd43c('0xf'));_0x21ecf7(_0xb41c6b[_0xd43c('0x14')]['message']);}})['catch'](function(_0x4caeda){logger['error'](_0xd43c('0xc'),_0x4d1c5d,_0x4caeda);_0x201e45(_0x4caeda);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 037d558..85d769e 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 _0xd272=['post','/:id/clone','addSections','addResources','update','/:id','destroy','delete','removeSections','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','isAuthenticated','describe','show','/:id/sections','getSections','/:id/resources','create'];(function(_0x133540,_0x89d728){var _0x2d1020=function(_0x3ec72d){while(--_0x3ec72d){_0x133540['push'](_0x133540['shift']());}};_0x2d1020(++_0x89d728);}(_0xd272,0x12c));var _0x2d27=function(_0x368ef0,_0x5b03a3){_0x368ef0=_0x368ef0-0x0;var _0x2966af=_0xd272[_0x368ef0];return _0x2966af;};'use strict';var multer=require(_0x2d27('0x0'));var util=require(_0x2d27('0x1'));var path=require(_0x2d27('0x2'));var timeout=require(_0x2d27('0x3'));var express=require(_0x2d27('0x4'));var router=express['Router']();var fs_extra=require(_0x2d27('0x5'));var auth=require(_0x2d27('0x6'));var interaction=require(_0x2d27('0x7'));var config=require(_0x2d27('0x8'));var controller=require(_0x2d27('0x9'));router[_0x2d27('0xa')]('/',auth['isAuthenticated'](),controller[_0x2d27('0xb')]);router['get']('/describe',auth[_0x2d27('0xc')](),controller[_0x2d27('0xd')]);router[_0x2d27('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x2d27('0xe')]);router[_0x2d27('0xa')](_0x2d27('0xf'),auth[_0x2d27('0xc')](),controller[_0x2d27('0x10')]);router[_0x2d27('0xa')](_0x2d27('0x11'),auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x2d27('0xc')](),controller[_0x2d27('0x12')]);router[_0x2d27('0x13')](_0x2d27('0x14'),auth['isAuthenticated'](),controller['clone']);router[_0x2d27('0x13')](_0x2d27('0xf'),auth[_0x2d27('0xc')](),controller[_0x2d27('0x15')]);router[_0x2d27('0x13')](_0x2d27('0x11'),auth['isAuthenticated'](),controller[_0x2d27('0x16')]);router['put']('/:id',auth[_0x2d27('0xc')](),controller[_0x2d27('0x17')]);router['delete'](_0x2d27('0x18'),auth['isAuthenticated'](),controller[_0x2d27('0x19')]);router[_0x2d27('0x1a')]('/:id/sections',auth[_0x2d27('0xc')](),controller[_0x2d27('0x1b')]);router[_0x2d27('0x1a')](_0x2d27('0x11'),auth[_0x2d27('0xc')](),controller['removeResources']);module[_0x2d27('0x1c')]=router; \ No newline at end of file +var _0xad9b=['describe','/:id','get','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','removeSections','removeResources','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfile.controller','isAuthenticated','/describe'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0xad9b,0x10e));var _0xbad9=function(_0x12f508,_0x5be23b){_0x12f508=_0x12f508-0x0;var _0x1f0a3e=_0xad9b[_0x12f508];return _0x1f0a3e;};'use strict';var multer=require(_0xbad9('0x0'));var util=require('util');var path=require(_0xbad9('0x1'));var timeout=require(_0xbad9('0x2'));var express=require(_0xbad9('0x3'));var router=express[_0xbad9('0x4')]();var fs_extra=require(_0xbad9('0x5'));var auth=require(_0xbad9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbad9('0x7'));router['get']('/',auth[_0xbad9('0x8')](),controller['index']);router['get'](_0xbad9('0x9'),auth[_0xbad9('0x8')](),controller[_0xbad9('0xa')]);router['get'](_0xbad9('0xb'),auth[_0xbad9('0x8')](),controller['show']);router[_0xbad9('0xc')](_0xbad9('0xd'),auth[_0xbad9('0x8')](),controller[_0xbad9('0xe')]);router[_0xbad9('0xc')](_0xbad9('0xf'),auth[_0xbad9('0x8')](),controller['getResources']);router[_0xbad9('0x10')]('/',auth[_0xbad9('0x8')](),controller[_0xbad9('0x11')]);router[_0xbad9('0x10')](_0xbad9('0x12'),auth[_0xbad9('0x8')](),controller[_0xbad9('0x13')]);router[_0xbad9('0x10')](_0xbad9('0xd'),auth['isAuthenticated'](),controller[_0xbad9('0x14')]);router[_0xbad9('0x10')](_0xbad9('0xf'),auth[_0xbad9('0x8')](),controller[_0xbad9('0x15')]);router[_0xbad9('0x16')]('/:id',auth[_0xbad9('0x8')](),controller[_0xbad9('0x17')]);router[_0xbad9('0x18')](_0xbad9('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xbad9('0x18')](_0xbad9('0xd'),auth[_0xbad9('0x8')](),controller[_0xbad9('0x19')]);router[_0xbad9('0x18')](_0xbad9('0xf'),auth[_0xbad9('0x8')](),controller[_0xbad9('0x1a')]);module[_0xbad9('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 843140e..90c4514 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 _0x58cc=['sequelize','STRING','setDataValue','crudPermissions','join','split','BOOLEAN'];(function(_0x3a7962,_0x3b3687){var _0x2b6fea=function(_0x51394b){while(--_0x51394b){_0x3a7962['push'](_0x3a7962['shift']());}};_0x2b6fea(++_0x3b3687);}(_0x58cc,0x111));var _0xc58c=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x58cc[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0xc58c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xc58c('0x1')],'set':function(_0x37bde1){this[_0xc58c('0x2')](_0xc58c('0x3'),_0x37bde1?_0x37bde1[_0xc58c('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue']('crudPermissions')[_0xc58c('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc58c('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc58c('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc58c('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xc58c('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc58c('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc58c('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xc58c('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc58c('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd48c=['sequelize','name','setDataValue','crudPermissions','join','getDataValue','split','STRING','BOOLEAN'];(function(_0x47058a,_0x45d60c){var _0x41dcab=function(_0x1b4119){while(--_0x1b4119){_0x47058a['push'](_0x47058a['shift']());}};_0x41dcab(++_0x45d60c);}(_0xd48c,0xfc));var _0xcd48=function(_0x122e9b,_0x391bf4){_0x122e9b=_0x122e9b-0x0;var _0x22c247=_0xd48c[_0x122e9b];return _0x22c247;};'use strict';var Sequelize=require(_0xcd48('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcd48('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x427e0a){this[_0xcd48('0x2')](_0xcd48('0x3'),_0x427e0a?_0x427e0a[_0xcd48('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xcd48('0x3'))?this[_0xcd48('0x5')](_0xcd48('0x3'))[_0xcd48('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xcd48('0x7')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xcd48('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcd48('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcd48('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xcd48('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcd48('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xcd48('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcd48('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 c4aa4a0..a07b316 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 _0x067b=['catch','show','params','find','create','body','clone','createdAt','crudPermissions','omit','updatedAt','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','addSections','push','ids','getSections','includes','enabled','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','stack','name','send','index','map','UserProfile','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x1733ed,_0xe2eee0){var _0x298b41=function(_0x2399e1){while(--_0x2399e1){_0x1733ed['push'](_0x1733ed['shift']());}};_0x298b41(++_0xe2eee0);}(_0x067b,0x179));var _0xb067=function(_0x3ba7cf,_0x52c0f9){_0x3ba7cf=_0x3ba7cf-0x0;var _0x5ea527=_0x067b[_0x3ba7cf];return _0x5ea527;};'use strict';var emlformat=require(_0xb067('0x0'));var rimraf=require(_0xb067('0x1'));var zipdir=require(_0xb067('0x2'));var jsonpatch=require(_0xb067('0x3'));var rp=require('request-promise');var moment=require(_0xb067('0x4'));var BPromise=require(_0xb067('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb067('0x6'));var csv=require(_0xb067('0x7'));var ejs=require(_0xb067('0x8'));var fs=require('fs');var fs_extra=require(_0xb067('0x9'));var _=require(_0xb067('0xa'));var squel=require('squel');var crypto=require(_0xb067('0xb'));var jsforce=require(_0xb067('0xc'));var deskjs=require(_0xb067('0xd'));var toCsv=require(_0xb067('0x7'));var querystring=require(_0xb067('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb067('0xf'));var qs=require(_0xb067('0x10'));var as=require(_0xb067('0x11'));var hardwareService=require(_0xb067('0x12'));var logger=require(_0xb067('0x13'))('api');var utils=require(_0xb067('0x14'));var config=require(_0xb067('0x15'));var licenseUtil=require(_0xb067('0x16'));var db=require('../../mysqldb')['db'];config[_0xb067('0x17')]=_[_0xb067('0x18')](config[_0xb067('0x17')],{'host':_0xb067('0x19'),'port':0x18eb});var socket=require(_0xb067('0x1a'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x3ea399,_0x77f7ba){_0x77f7ba=_0x77f7ba||0xcc;return function(_0x18af4d){if(_0x18af4d){return _0x3ea399[_0xb067('0x1b')](_0x77f7ba);}return _0x3ea399[_0xb067('0x1c')](_0x77f7ba)[_0xb067('0x1d')]();};}function respondWithResult(_0x3969a3,_0x30c39d){_0x30c39d=_0x30c39d||0xc8;return function(_0x18e8e9){if(_0x18e8e9){return _0x3969a3[_0xb067('0x1c')](_0x30c39d)[_0xb067('0x1e')](_0x18e8e9);}};}function respondWithFilteredResult(_0xa9d29,_0x54e6bf){return function(_0x53ff56){if(_0x53ff56){var _0xe0fbeb=typeof _0x54e6bf[_0xb067('0x1f')]===_0xb067('0x20')&&typeof _0x54e6bf[_0xb067('0x21')]===_0xb067('0x20');var _0x555481=_0x53ff56[_0xb067('0x22')];var _0x54125e=_0xe0fbeb?0x0:_0x54e6bf[_0xb067('0x1f')];var _0x167239=_0xe0fbeb?_0x53ff56[_0xb067('0x22')]:_0x54e6bf[_0xb067('0x1f')]+_0x54e6bf['limit'];var _0x1f5e78;if(_0x167239>=_0x555481){_0x167239=_0x555481;_0x1f5e78=0xc8;}else{_0x1f5e78=0xce;}_0xa9d29[_0xb067('0x1c')](_0x1f5e78);return _0xa9d29['set']('Content-Range',_0x54125e+'-'+_0x167239+'/'+_0x555481)[_0xb067('0x1e')](_0x53ff56);}return null;};}function patchUpdates(_0x5d3339){return function(_0x115b1c){try{jsonpatch[_0xb067('0x23')](_0x115b1c,_0x5d3339,!![]);}catch(_0x18b973){return BPromise[_0xb067('0x24')](_0x18b973);}return _0x115b1c[_0xb067('0x25')]();};}function saveUpdates(_0x369efc,_0x463bf2){return function(_0x1d4065){if(_0x1d4065){return _0x1d4065['update'](_0x369efc)[_0xb067('0x26')](function(_0x4f263d){return _0x4f263d;});}return null;};}function removeEntity(_0x50da7e,_0x2a7a3e){return function(_0x44153f){if(_0x44153f){return _0x44153f[_0xb067('0x27')]()['then'](function(){_0x50da7e[_0xb067('0x1c')](0xcc)[_0xb067('0x1d')]();});}};}function handleEntityNotFound(_0x510568,_0x50ae85){return function(_0xd4962c){if(!_0xd4962c){_0x510568[_0xb067('0x1b')](0x194);}return _0xd4962c;};}function handleError(_0x472b9e,_0x3789d1){_0x3789d1=_0x3789d1||0x1f4;return function(_0x502b62){logger['error'](_0x502b62[_0xb067('0x28')]);if(_0x502b62[_0xb067('0x29')]){delete _0x502b62[_0xb067('0x29')];}_0x472b9e[_0xb067('0x1c')](_0x3789d1)[_0xb067('0x2a')](_0x502b62);};}exports[_0xb067('0x2b')]=function(_0x2eebf0,_0x537e78){var _0x5055f3={},_0x9243b8={},_0x22b72c={'count':0x0,'rows':[]};var _0x3257ab=_[_0xb067('0x2c')](db[_0xb067('0x2d')][_0xb067('0x2e')],function(_0x11abf9){return{'name':_0x11abf9['fieldName'],'type':_0x11abf9[_0xb067('0x2f')][_0xb067('0x30')]};});_0x9243b8[_0xb067('0x31')]=_[_0xb067('0x2c')](_0x3257ab,_0xb067('0x29'));_0x9243b8[_0xb067('0x32')]=_[_0xb067('0x33')](_0x2eebf0[_0xb067('0x32')]);_0x9243b8['filters']=_[_0xb067('0x34')](_0x9243b8[_0xb067('0x31')],_0x9243b8[_0xb067('0x32')]);_0x5055f3[_0xb067('0x35')]=_[_0xb067('0x34')](_0x9243b8[_0xb067('0x31')],qs['fields'](_0x2eebf0[_0xb067('0x32')][_0xb067('0x36')]));_0x5055f3[_0xb067('0x35')]=_0x5055f3[_0xb067('0x35')][_0xb067('0x37')]?_0x5055f3[_0xb067('0x35')]:_0x9243b8[_0xb067('0x31')];if(!_0x2eebf0[_0xb067('0x32')][_0xb067('0x38')](_0xb067('0x39'))){_0x5055f3[_0xb067('0x21')]=qs[_0xb067('0x21')](_0x2eebf0[_0xb067('0x32')][_0xb067('0x21')]);_0x5055f3[_0xb067('0x1f')]=qs['offset'](_0x2eebf0[_0xb067('0x32')][_0xb067('0x1f')]);}_0x5055f3[_0xb067('0x3a')]=qs[_0xb067('0x3b')](_0x2eebf0[_0xb067('0x32')][_0xb067('0x3b')]);_0x5055f3['where']=qs[_0xb067('0x3c')](_[_0xb067('0x3d')](_0x2eebf0[_0xb067('0x32')],_0x9243b8['filters']),_0x3257ab);if(_0x2eebf0[_0xb067('0x32')][_0xb067('0x3e')]){_0x5055f3['where']=_[_0xb067('0x3f')](_0x5055f3[_0xb067('0x40')],{'$or':_[_0xb067('0x2c')](_0x3257ab,function(_0x2a6302){if(_0x2a6302[_0xb067('0x2f')]!==_0xb067('0x41')){var _0x11376a={};_0x11376a[_0x2a6302[_0xb067('0x29')]]={'$like':'%'+_0x2eebf0[_0xb067('0x32')][_0xb067('0x3e')]+'%'};return _0x11376a;}})});}_0x5055f3=_[_0xb067('0x3f')]({},_0x5055f3,_0x2eebf0[_0xb067('0x42')]);var _0x47e6e5={'where':_0x5055f3[_0xb067('0x40')]};return db[_0xb067('0x2d')]['count'](_0x47e6e5)[_0xb067('0x26')](function(_0x5797a5){_0x22b72c[_0xb067('0x22')]=_0x5797a5;if(_0x2eebf0[_0xb067('0x32')][_0xb067('0x43')]){_0x5055f3[_0xb067('0x44')]=[{'all':!![]}];}return db[_0xb067('0x2d')][_0xb067('0x45')](_0x5055f3);})[_0xb067('0x26')](function(_0x570c7c){_0x22b72c[_0xb067('0x46')]=_0x570c7c;return _0x22b72c;})[_0xb067('0x26')](respondWithFilteredResult(_0x537e78,_0x5055f3))[_0xb067('0x47')](handleError(_0x537e78,null));};exports[_0xb067('0x48')]=function(_0x4e462e,_0x220477){var _0x2baf6a={'raw':![],'where':{'id':_0x4e462e[_0xb067('0x49')]['id']}},_0x4157c6={};_0x4157c6[_0xb067('0x31')]=_[_0xb067('0x33')](db[_0xb067('0x2d')][_0xb067('0x2e')]);_0x4157c6['query']=_[_0xb067('0x33')](_0x4e462e[_0xb067('0x32')]);_0x4157c6['filters']=_[_0xb067('0x34')](_0x4157c6[_0xb067('0x31')],_0x4157c6[_0xb067('0x32')]);_0x2baf6a['attributes']=_['intersection'](_0x4157c6[_0xb067('0x31')],qs[_0xb067('0x36')](_0x4e462e['query'][_0xb067('0x36')]));_0x2baf6a[_0xb067('0x35')]=_0x2baf6a[_0xb067('0x35')][_0xb067('0x37')]?_0x2baf6a['attributes']:_0x4157c6[_0xb067('0x31')];if(_0x4e462e[_0xb067('0x32')][_0xb067('0x43')]){_0x2baf6a[_0xb067('0x44')]=[{'all':!![]}];}_0x2baf6a=_['merge']({},_0x2baf6a,_0x4e462e[_0xb067('0x42')]);return db[_0xb067('0x2d')][_0xb067('0x4a')](_0x2baf6a)['then'](handleEntityNotFound(_0x220477,null))[_0xb067('0x26')](respondWithResult(_0x220477,null))[_0xb067('0x47')](handleError(_0x220477,null));};exports[_0xb067('0x4b')]=function(_0x43b6f7,_0x2f3283){return db[_0xb067('0x2d')][_0xb067('0x4b')](_0x43b6f7[_0xb067('0x4c')],{})[_0xb067('0x26')](respondWithResult(_0x2f3283,0xc9))[_0xb067('0x47')](handleError(_0x2f3283,null));};exports[_0xb067('0x4d')]=function(_0x4a47b6,_0x48e7b6){var _0x299bbf={'where':{'id':_0x4a47b6['params']['id']}},_0x13faf0={};_0x13faf0[_0xb067('0x31')]=_[_0xb067('0x33')](db[_0xb067('0x2d')][_0xb067('0x2e')]);_0x299bbf[_0xb067('0x35')]=_[_0xb067('0x34')](_0x13faf0[_0xb067('0x31')],qs[_0xb067('0x36')](_0x4a47b6[_0xb067('0x32')][_0xb067('0x36')]));_0x299bbf[_0xb067('0x35')]=_0x299bbf['attributes']['length']?_0x299bbf[_0xb067('0x35')]:_0x13faf0['model'];if(_0x4a47b6[_0xb067('0x32')][_0xb067('0x43')]){_0x299bbf['include']=[{'all':!![]}];}_0x299bbf=_[_0xb067('0x3f')]({},_0x299bbf,_0x4a47b6['options']);return db[_0xb067('0x2d')][_0xb067('0x4a')](_0x299bbf)[_0xb067('0x26')](handleEntityNotFound(_0x48e7b6,null))[_0xb067('0x26')](function(_0x49eb9e){if(_0x49eb9e){var _0x363c61=_0x49eb9e['get']({'plain':!![]});_0x363c61=qs['omit'](_0x363c61,['id',_0xb067('0x4e'),'updatedAt',_0xb067('0x4f')]);_0x4a47b6[_0xb067('0x4c')]=_[_0xb067('0x50')](_0x4a47b6[_0xb067('0x4c')],['id',_0xb067('0x4e'),_0xb067('0x51')]);return db[_0xb067('0x52')][_0xb067('0x53')](function(_0x215930){return db[_0xb067('0x2d')]['create'](_[_0xb067('0x3f')](_0x363c61,_0x4a47b6[_0xb067('0x4c')]),{'include':_0x4a47b6['query'][_0xb067('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x215930})[_0xb067('0x26')](function(_0x460a36){var _0x3fef1e=_0x460a36[_0xb067('0x54')]({'plain':!![]});return db[_0xb067('0x55')][_0xb067('0x45')]({'where':{'userProfileId':_0x4a47b6[_0xb067('0x49')]['id']},'raw':!![]})[_0xb067('0x26')](function(_0x5781b4){if(_0x5781b4){return BPromise[_0xb067('0x56')](_0x5781b4,function(_0xd2e7f6){return new BPromise(function(_0x284f64,_0x564c59){if(_0xd2e7f6[_0xb067('0x57')]===null||_0xd2e7f6[_0xb067('0x57')]===0x1)_0x284f64(null);return db[_0xb067('0x58')][_0xb067('0x45')]({'where':{'sectionId':_0xd2e7f6['id']},'raw':!![]})['then'](function(_0x2e1a6c){var _0x33031b=_[_0xb067('0x2c')](_0x2e1a6c,function(_0x4886fd){return qs[_0xb067('0x50')](_0x4886fd,['id',_0xb067('0x4e'),_0xb067('0x51'),_0xb067('0x59')]);});_0x284f64(_0x33031b);})['catch'](function(_0x25ff9a){_0x564c59(_0x25ff9a);});})['then'](function(_0xd27c08){var _0x2654d1=qs[_0xb067('0x50')](_0xd2e7f6,['id','createdAt',_0xb067('0x51')]);_0x2654d1[_0xb067('0x5a')]=_0x3fef1e['id'];if(_0xd27c08)_0x2654d1[_0xb067('0x5b')]=_0xd27c08;return _0x2654d1;})[_0xb067('0x26')](function(_0x139cc9){return db['UserProfileSection'][_0xb067('0x4b')](_0x139cc9,{'include':[{'model':db[_0xb067('0x58')],'as':_0xb067('0x5b')}],'raw':!![],'transaction':_0x215930});});})[_0xb067('0x26')](function(){return _0x3fef1e;});}});});});}})['then'](respondWithResult(_0x48e7b6,0xc9))[_0xb067('0x47')](handleError(_0x48e7b6,null));};exports[_0xb067('0x5c')]=function(_0xfc60b,_0x58372d){if(_0xfc60b['body']['id']){delete _0xfc60b[_0xb067('0x4c')]['id'];}return db['UserProfile'][_0xb067('0x4a')]({'where':{'id':_0xfc60b[_0xb067('0x49')]['id']}})['then'](handleEntityNotFound(_0x58372d,null))[_0xb067('0x26')](saveUpdates(_0xfc60b[_0xb067('0x4c')],null))[_0xb067('0x26')](respondWithResult(_0x58372d,null))[_0xb067('0x47')](handleError(_0x58372d,null));};exports[_0xb067('0x27')]=function(_0x2e67a3,_0x452f38){return db[_0xb067('0x2d')][_0xb067('0x4a')]({'where':{'id':_0x2e67a3[_0xb067('0x49')]['id']}})['then'](handleEntityNotFound(_0x452f38,null))[_0xb067('0x26')](removeEntity(_0x452f38,null))[_0xb067('0x47')](handleError(_0x452f38,null));};exports[_0xb067('0x5d')]=function(_0xedc49,_0x44ab0c){return db[_0xb067('0x2d')][_0xb067('0x5d')]()[_0xb067('0x26')](respondWithResult(_0x44ab0c,null))[_0xb067('0x47')](handleError(_0x44ab0c,null));};exports[_0xb067('0x5e')]=function(_0x383d4a,_0xd93918){var _0x15a861=_0x383d4a[_0xb067('0x4c')];return db['UserProfile'][_0xb067('0x4a')]({'where':{'id':_0x383d4a['params']['id']}})[_0xb067('0x26')](handleEntityNotFound(_0xd93918,null))[_0xb067('0x26')](function(_0x137e6a){if(_0x137e6a){return db['sequelize'][_0xb067('0x53')](function(_0x15d4a7){return db[_0xb067('0x55')]['destroy']({'where':{'userProfileId':_0x383d4a[_0xb067('0x49')]['id'],'sectionId':_[_0xb067('0x2c')](_0x15a861,function(_0x5bf94a){return _0x5bf94a[_0xb067('0x59')];})},'transaction':_0x15d4a7})[_0xb067('0x26')](function(){var _0x311357=_[_0xb067('0x2c')](_0x15a861,function(_0x7a9655){_0x7a9655[_0xb067('0x5a')]=_0x383d4a['params']['id'];return _0x7a9655;});var _0x1b8874=[];return BPromise[_0xb067('0x56')](_0x311357,function(_0x297f0c){return db['UserProfileSection'][_0xb067('0x4b')](_0x297f0c,{'include':[{'model':db[_0xb067('0x58')],'as':_0xb067('0x5b')}],'raw':!![],'transaction':_0x15d4a7})[_0xb067('0x26')](function(_0x56042d){_0x1b8874[_0xb067('0x5f')](_0x56042d[_0xb067('0x54')]({'plain':!![]}));});})[_0xb067('0x26')](function(){return _0x1b8874;});});});}})['then'](function(_0x5408bd){return _0x5408bd;})[_0xb067('0x26')](respondWithResult(_0xd93918,null))[_0xb067('0x47')](handleError(_0xd93918,null));};exports['removeSections']=function(_0xdb1aa5,_0x354901){var _0x459b1a;return db[_0xb067('0x2d')][_0xb067('0x4a')]({'where':{'id':_0xdb1aa5[_0xb067('0x49')]['id']},'attributes':['id',_0xb067('0x29')]})[_0xb067('0x26')](handleEntityNotFound(_0x354901,null))['then'](function(_0x555c94){if(_0x555c94){_0x459b1a=_0x555c94;return db['UserProfileSection'][_0xb067('0x27')]({'where':{'userProfileId':_0xdb1aa5[_0xb067('0x49')]['id'],'sectionId':_0xdb1aa5['query'][_0xb067('0x60')]}});}})[_0xb067('0x26')](function(){return _0x459b1a;})[_0xb067('0x26')](respondWithStatusCode(_0x354901,null))[_0xb067('0x47')](handleError(_0x354901,null));};exports[_0xb067('0x61')]=function(_0x5dc518,_0x52cfa6){var _0x4b8343=[];var _0x173e4f=[];return db[_0xb067('0x55')][_0xb067('0x45')]({'where':{'userProfileId':_0x5dc518['params']['id']},'raw':!![]})[_0xb067('0x26')](function(_0x2116a6){_0x4b8343=_[_0xb067('0x3e')](_0x2116a6,function(_0x5538b7){return _0x5538b7['enabled']===0x1||_[_0xb067('0x62')]([0x3eb,0x709],_0x5538b7[_0xb067('0x59')]);});if(!_['isEmpty'](_0x4b8343)){return _[_0xb067('0x2c')](_0x4b8343,function(_0x1fc677){return _0x1fc677[_0xb067('0x59')];});}else{return;}})[_0xb067('0x26')](function(_0x47027b){if(_0x47027b)_0x173e4f=_0x47027b;if(_[_0xb067('0x62')](_0x173e4f,0x64)){var _0x22869e=_[_0xb067('0x4a')](_0x4b8343,{'sectionId':0x64});return hasDefaultDashboard(_0x22869e)['then'](function(_0x52b188){return _[_0xb067('0x2c')](_0x4b8343,function(_0x4f5785){if(_0x4f5785['sectionId']===0x64){_0x4f5785['subsections']=_0x52b188;}return _0x4f5785;});});}else{return;}})[_0xb067('0x26')](function(_0x520a34){if(_0x520a34)_0x4b8343=_0x520a34;if(_['includes'](_0x173e4f,0x3eb)){var _0xd0171c=_[_0xb067('0x4a')](_0x4b8343,{'sectionId':0x3eb});return getCustomDashboards(_0xd0171c)[_0xb067('0x26')](function(_0x17c0d2){return _[_0xb067('0x2c')](_0x4b8343,function(_0x2ef522){if(_0xd0171c[_0xb067('0x63')]){if(_0x2ef522[_0xb067('0x59')]===0x3eb){_0x2ef522[_0xb067('0x64')]=_0x17c0d2;}}else{if(_0x2ef522[_0xb067('0x59')]===0x64){if(!_0x2ef522['subsections']){_0x2ef522['subsections']=[];}_0x2ef522[_0xb067('0x64')]=_0x2ef522[_0xb067('0x64')]['concat'](_0x17c0d2);}}return _0x2ef522;});});}else{return;}})['then'](function(_0x38ed59){if(_0x38ed59)_0x4b8343=_0x38ed59;if(_[_0xb067('0x62')](_0x173e4f,0x709)){var _0x8ab9b4=_['find'](_0x4b8343,{'sectionId':0x709});return getPlugins(_0x8ab9b4)[_0xb067('0x26')](function(_0x2a6b0c){if(_0x8ab9b4[_0xb067('0x63')]){return _[_0xb067('0x2c')](_0x4b8343,function(_0xb80912){if(_0xb80912[_0xb067('0x59')]===0x709){_0xb80912[_0xb067('0x64')]=_0x2a6b0c;}return _0xb80912;});}else{var _0x11d514={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2a6b0c};var _0x2d039b=_[_0xb067('0x2c')](_0x4b8343);_0x2d039b[_0xb067('0x5f')](_0x11d514);return _0x2d039b;}});}else{return;}})[_0xb067('0x26')](function(_0x3d884d){if(_0x3d884d)_0x4b8343=_0x3d884d;return _['filter'](_0x4b8343,[_0xb067('0x63'),0x1]);})[_0xb067('0x26')](respondWithResult(_0x52cfa6,null))[_0xb067('0x47')](handleError(_0x52cfa6,null));};function hasDefaultDashboard(_0x43bbb8){var _0x271e22=[0x65];return new BPromise(function(_0x178142,_0x53d7ff){try{if(_0x43bbb8[_0xb067('0x57')]){_0x178142(_0x271e22);}else{return db[_0xb067('0x58')][_0xb067('0x65')]({'where':{'sectionId':_0x43bbb8['id']},'raw':!![]})[_0xb067('0x26')](function(_0x299ba5){_0x299ba5?_0x178142(_0x271e22):_0x178142();});}}catch(_0x3dd667){_0x53d7ff(_0x3dd667);}});}function getCustomDashboards(_0x1302c8){var _0x5ae630=[];return new BPromise(function(_0x10df89,_0x5798be){try{if(_0x1302c8['autoAssociation']){return db[_0xb067('0x66')]['findAll']({'raw':!![]})['then'](function(_0x5afc33){_0x5afc33[_0xb067('0x67')](function(_0x47dfc0){_0x5ae630[_0xb067('0x5f')](_0x47dfc0['id']+0x1869f);});_0x10df89(_0x5ae630);});}else{return db[_0xb067('0x58')][_0xb067('0x45')]({'where':{'sectionId':_0x1302c8['id']},'raw':!![]})[_0xb067('0x26')](function(_0x1e0e2b){_0x1e0e2b[_0xb067('0x67')](function(_0x71342e){_0x5ae630[_0xb067('0x5f')](_0x71342e[_0xb067('0x68')]+0x1869f);});_0x10df89(_0x5ae630);});}}catch(_0x5102bc){_0x5798be(_0x5102bc);}});}function getPlugins(_0x2f36f1){var _0x316f3e=[];return new BPromise(function(_0x1e9e5f,_0x3811b2){try{if(_0x2f36f1['autoAssociation']){return db[_0xb067('0x69')]['findAll']({'raw':!![]})[_0xb067('0x26')](function(_0x36f826){_0x36f826[_0xb067('0x67')](function(_0x9ff79){_0x316f3e[_0xb067('0x5f')](_0x9ff79['id']+0x15b38);});_0x1e9e5f(_0x316f3e);});}else{return db[_0xb067('0x58')]['findAll']({'where':{'sectionId':_0x2f36f1['id']},'raw':!![]})[_0xb067('0x26')](function(_0x2556a2){_0x2556a2[_0xb067('0x67')](function(_0x3bc470){_0x316f3e[_0xb067('0x5f')](_0x3bc470['resourceId']+0x15b38);});_0x1e9e5f(_0x316f3e);});}}catch(_0x5bf9a0){_0x3811b2(_0x5bf9a0);}});}exports[_0xb067('0x6a')]=function(_0x25cbe1,_0x19fc1a){return db['UserProfile'][_0xb067('0x4a')]({'where':{'id':_0x25cbe1[_0xb067('0x49')]['id']}})[_0xb067('0x26')](handleEntityNotFound(_0x19fc1a,null))[_0xb067('0x26')](function(_0x6f34f){if(_0x6f34f){return db[_0xb067('0x52')][_0xb067('0x53')](function(_0x10f409){return db[_0xb067('0x55')][_0xb067('0x45')]({'where':{'userProfileId':_0x25cbe1[_0xb067('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xb067('0x26')](function(_0xd43343){if(_0xd43343){return db[_0xb067('0x55')][_0xb067('0x27')]({'where':{'userProfileId':_0x25cbe1['params']['id'],'id':_[_0xb067('0x2c')](_0xd43343,function(_0x22f637){return _0x22f637['id'];})},'transaction':_0x10f409});}})[_0xb067('0x26')](function(_0x4bbe3e){var _0x20db01=_['map'](_0x25cbe1[_0xb067('0x4c')],function(_0x405ade){_0x405ade[_0xb067('0x5a')]=_0x25cbe1['params']['id'];return _0x405ade;});return db[_0xb067('0x55')][_0xb067('0x6b')](_0x20db01,{'raw':!![],'transaction':_0x10f409});})[_0xb067('0x26')](function(_0x592186){var _0x24ed2a=_[_0xb067('0x3e')](_['map'](_0x592186,function(_0x2f24e3){return _0x2f24e3[_0xb067('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x24ed2a){return db[_0xb067('0x55')][_0xb067('0x45')]({'where':{'userProfileId':_0x25cbe1[_0xb067('0x49')]['id'],'sectionId':_[_0xb067('0x2c')](_0x24ed2a,function(_0x12042a){return _0x12042a[_0xb067('0x59')];})},'attributes':['id',_0xb067('0x59')],'raw':!![]})[_0xb067('0x26')](function(_0x44bcea){var _0x494506=_['map'](_0x25cbe1['body'],function(_0x41f207){_0x41f207[_0xb067('0x5a')]=_0x25cbe1[_0xb067('0x49')]['id'];return _0x41f207;});return db['UserProfileResource'][_0xb067('0x6b')](_0x494506,{'raw':!![],'transaction':_0x10f409});});}})[_0xb067('0x47')](handleError(_0x19fc1a,null));});}})[_0xb067('0x26')](function(_0x13bd0c){var _0x5e7bba=_[_0xb067('0x2c')](_0x13bd0c,function(_0x40d54c){return _0x40d54c[_0xb067('0x54')]({'plain':!![]});});})['then'](respondWithResult(_0x19fc1a,null))[_0xb067('0x47')](handleError(_0x19fc1a,null));};exports[_0xb067('0x6c')]=function(_0x1bf353,_0x37e8b0,_0x322d03){return db['UserProfile'][_0xb067('0x4a')]({'where':{'id':_0x1bf353[_0xb067('0x49')]['id']}})[_0xb067('0x26')](handleEntityNotFound(_0x37e8b0,null))[_0xb067('0x26')](function(_0x565bcc){if(_0x565bcc){return _0x565bcc[_0xb067('0x6c')](_0x1bf353[_0xb067('0x32')][_0xb067('0x60')]);}})[_0xb067('0x26')](respondWithStatusCode(_0x37e8b0,null))[_0xb067('0x47')](handleError(_0x37e8b0,null));};exports[_0xb067('0x6d')]=function(_0x5b6548,_0x37c1f1){var _0x4104c8={};if(!_0x5b6548['query'][_0xb067('0x6e')])throw new Error('Missing\x20section\x20parameter');if(!_0x5b6548[_0xb067('0x32')][_0xb067('0x38')](_0xb067('0x39'))){_0x4104c8['limit']=qs[_0xb067('0x21')](_0x5b6548[_0xb067('0x32')][_0xb067('0x21')]);_0x4104c8[_0xb067('0x1f')]=qs[_0xb067('0x1f')](_0x5b6548[_0xb067('0x32')]['offset']);}return db[_0xb067('0x2d')]['find']({'where':{'id':_0x5b6548[_0xb067('0x49')]['id']}})[_0xb067('0x26')](function(_0x3e31d7){if(!_0x3e31d7)throw new Error(_0xb067('0x6f')+_0x5b6548['params']['id']);return db[_0xb067('0x2d')][_0xb067('0x6d')](_0x5b6548);})['then'](respondWithFilteredResult(_0x37c1f1,_0x4104c8))[_0xb067('0x47')](handleError(_0x37c1f1,null));}; \ No newline at end of file +var _0xfd23=['bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','offset','limit','count','set','Content-Range','apply','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','UserProfile','includeAll','include','rows','show','params','find','catch','create','omit','createdAt','crudPermissions','body','updatedAt','sequelize','autoAssociation','Resources','UserProfileSection','describe','addSections','sectionId','each','push','get','removeSections','ids','getSections','enabled','includes','subsections','UserProfileResource','findOne','Dashboard','findAll','forEach','resourceId','Plugin','userProfileId'];(function(_0x142cfb,_0x39b404){var _0x538a88=function(_0x136ec3){while(--_0x136ec3){_0x142cfb['push'](_0x142cfb['shift']());}};_0x538a88(++_0x39b404);}(_0xfd23,0x153));var _0x3fd2=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0xfd23[_0x30bd4d];return _0x306915;};'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(_0x3fd2('0x0'));var moment=require(_0x3fd2('0x1'));var BPromise=require(_0x3fd2('0x2'));var Mustache=require('mustache');var util=require(_0x3fd2('0x3'));var path=require(_0x3fd2('0x4'));var sox=require(_0x3fd2('0x5'));var csv=require('to-csv');var ejs=require(_0x3fd2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fd2('0x7'));var squel=require('squel');var crypto=require(_0x3fd2('0x8'));var jsforce=require(_0x3fd2('0x9'));var deskjs=require(_0x3fd2('0xa'));var toCsv=require(_0x3fd2('0xb'));var querystring=require(_0x3fd2('0xc'));var Papa=require(_0x3fd2('0xd'));var Redis=require(_0x3fd2('0xe'));var authService=require(_0x3fd2('0xf'));var qs=require(_0x3fd2('0x10'));var as=require(_0x3fd2('0x11'));var hardwareService=require(_0x3fd2('0x12'));var logger=require(_0x3fd2('0x13'))(_0x3fd2('0x14'));var utils=require(_0x3fd2('0x15'));var config=require(_0x3fd2('0x16'));var licenseUtil=require(_0x3fd2('0x17'));var db=require(_0x3fd2('0x18'))['db'];config[_0x3fd2('0x19')]=_[_0x3fd2('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3fd2('0x1b'))(new Redis(config['redis']));require('./userProfile.socket')[_0x3fd2('0x1c')](socket);function respondWithStatusCode(_0xd7bd23,_0x1ae2fb){_0x1ae2fb=_0x1ae2fb||0xcc;return function(_0x1c4bc6){if(_0x1c4bc6){return _0xd7bd23['sendStatus'](_0x1ae2fb);}return _0xd7bd23[_0x3fd2('0x1d')](_0x1ae2fb)['end']();};}function respondWithResult(_0x304e3f,_0x24d9a3){_0x24d9a3=_0x24d9a3||0xc8;return function(_0x15f4fa){if(_0x15f4fa){return _0x304e3f[_0x3fd2('0x1d')](_0x24d9a3)[_0x3fd2('0x1e')](_0x15f4fa);}};}function respondWithFilteredResult(_0x50a543,_0x5aa4b7){return function(_0x201d36){if(_0x201d36){var _0x24cd6c=typeof _0x5aa4b7[_0x3fd2('0x1f')]==='undefined'&&typeof _0x5aa4b7[_0x3fd2('0x20')]==='undefined';var _0x593b92=_0x201d36[_0x3fd2('0x21')];var _0x2539d7=_0x24cd6c?0x0:_0x5aa4b7['offset'];var _0x3f20c3=_0x24cd6c?_0x201d36[_0x3fd2('0x21')]:_0x5aa4b7['offset']+_0x5aa4b7[_0x3fd2('0x20')];var _0x56b634;if(_0x3f20c3>=_0x593b92){_0x3f20c3=_0x593b92;_0x56b634=0xc8;}else{_0x56b634=0xce;}_0x50a543['status'](_0x56b634);return _0x50a543[_0x3fd2('0x22')](_0x3fd2('0x23'),_0x2539d7+'-'+_0x3f20c3+'/'+_0x593b92)[_0x3fd2('0x1e')](_0x201d36);}return null;};}function patchUpdates(_0x468ae7){return function(_0x1bcb95){try{jsonpatch[_0x3fd2('0x24')](_0x1bcb95,_0x468ae7,!![]);}catch(_0x2a79de){return BPromise['reject'](_0x2a79de);}return _0x1bcb95['save']();};}function saveUpdates(_0x35ba03,_0x2ac58c){return function(_0x1b267b){if(_0x1b267b){return _0x1b267b['update'](_0x35ba03)[_0x3fd2('0x25')](function(_0x3756d7){return _0x3756d7;});}return null;};}function removeEntity(_0xce5d29,_0x2ba066){return function(_0x4312ce){if(_0x4312ce){return _0x4312ce[_0x3fd2('0x26')]()['then'](function(){_0xce5d29['status'](0xcc)[_0x3fd2('0x27')]();});}};}function handleEntityNotFound(_0x38373d,_0x58b44c){return function(_0x17cfc4){if(!_0x17cfc4){_0x38373d[_0x3fd2('0x28')](0x194);}return _0x17cfc4;};}function handleError(_0x175d37,_0x15af2c){_0x15af2c=_0x15af2c||0x1f4;return function(_0x234caf){logger[_0x3fd2('0x29')](_0x234caf[_0x3fd2('0x2a')]);if(_0x234caf[_0x3fd2('0x2b')]){delete _0x234caf[_0x3fd2('0x2b')];}_0x175d37[_0x3fd2('0x1d')](_0x15af2c)[_0x3fd2('0x2c')](_0x234caf);};}exports[_0x3fd2('0x2d')]=function(_0x4a63dc,_0x72f89){var _0x3164e7={},_0x5d3ce3={},_0x572caa={'count':0x0,'rows':[]};var _0x12c3e4=_['map'](db['UserProfile'][_0x3fd2('0x2e')],function(_0x4c55ba){return{'name':_0x4c55ba[_0x3fd2('0x2f')],'type':_0x4c55ba['type']['key']};});_0x5d3ce3[_0x3fd2('0x30')]=_[_0x3fd2('0x31')](_0x12c3e4,_0x3fd2('0x2b'));_0x5d3ce3['query']=_[_0x3fd2('0x32')](_0x4a63dc[_0x3fd2('0x33')]);_0x5d3ce3[_0x3fd2('0x34')]=_[_0x3fd2('0x35')](_0x5d3ce3[_0x3fd2('0x30')],_0x5d3ce3[_0x3fd2('0x33')]);_0x3164e7[_0x3fd2('0x36')]=_['intersection'](_0x5d3ce3[_0x3fd2('0x30')],qs['fields'](_0x4a63dc[_0x3fd2('0x33')][_0x3fd2('0x37')]));_0x3164e7[_0x3fd2('0x36')]=_0x3164e7[_0x3fd2('0x36')][_0x3fd2('0x38')]?_0x3164e7[_0x3fd2('0x36')]:_0x5d3ce3[_0x3fd2('0x30')];if(!_0x4a63dc[_0x3fd2('0x33')][_0x3fd2('0x39')](_0x3fd2('0x3a'))){_0x3164e7['limit']=qs[_0x3fd2('0x20')](_0x4a63dc[_0x3fd2('0x33')][_0x3fd2('0x20')]);_0x3164e7['offset']=qs['offset'](_0x4a63dc[_0x3fd2('0x33')]['offset']);}_0x3164e7['order']=qs['sort'](_0x4a63dc[_0x3fd2('0x33')][_0x3fd2('0x3b')]);_0x3164e7[_0x3fd2('0x3c')]=qs[_0x3fd2('0x34')](_[_0x3fd2('0x3d')](_0x4a63dc['query'],_0x5d3ce3[_0x3fd2('0x34')]),_0x12c3e4);if(_0x4a63dc[_0x3fd2('0x33')][_0x3fd2('0x3e')]){_0x3164e7['where']=_[_0x3fd2('0x3f')](_0x3164e7[_0x3fd2('0x3c')],{'$or':_[_0x3fd2('0x31')](_0x12c3e4,function(_0x2f3c99){if(_0x2f3c99[_0x3fd2('0x40')]!==_0x3fd2('0x41')){var _0x2d25c6={};_0x2d25c6[_0x2f3c99['name']]={'$like':'%'+_0x4a63dc[_0x3fd2('0x33')][_0x3fd2('0x3e')]+'%'};return _0x2d25c6;}})});}_0x3164e7=_[_0x3fd2('0x3f')]({},_0x3164e7,_0x4a63dc[_0x3fd2('0x42')]);var _0x906dd3={'where':_0x3164e7[_0x3fd2('0x3c')]};return db[_0x3fd2('0x43')]['count'](_0x906dd3)[_0x3fd2('0x25')](function(_0x1f651c){_0x572caa[_0x3fd2('0x21')]=_0x1f651c;if(_0x4a63dc[_0x3fd2('0x33')][_0x3fd2('0x44')]){_0x3164e7[_0x3fd2('0x45')]=[{'all':!![]}];}return db[_0x3fd2('0x43')]['findAll'](_0x3164e7);})[_0x3fd2('0x25')](function(_0x10d3ee){_0x572caa[_0x3fd2('0x46')]=_0x10d3ee;return _0x572caa;})[_0x3fd2('0x25')](respondWithFilteredResult(_0x72f89,_0x3164e7))['catch'](handleError(_0x72f89,null));};exports[_0x3fd2('0x47')]=function(_0x4c4ba7,_0x348fe4){var _0x4a722a={'raw':![],'where':{'id':_0x4c4ba7[_0x3fd2('0x48')]['id']}},_0x4c5558={};_0x4c5558[_0x3fd2('0x30')]=_['keys'](db[_0x3fd2('0x43')][_0x3fd2('0x2e')]);_0x4c5558[_0x3fd2('0x33')]=_[_0x3fd2('0x32')](_0x4c4ba7[_0x3fd2('0x33')]);_0x4c5558['filters']=_['intersection'](_0x4c5558[_0x3fd2('0x30')],_0x4c5558[_0x3fd2('0x33')]);_0x4a722a[_0x3fd2('0x36')]=_[_0x3fd2('0x35')](_0x4c5558[_0x3fd2('0x30')],qs[_0x3fd2('0x37')](_0x4c4ba7['query']['fields']));_0x4a722a[_0x3fd2('0x36')]=_0x4a722a[_0x3fd2('0x36')]['length']?_0x4a722a[_0x3fd2('0x36')]:_0x4c5558[_0x3fd2('0x30')];if(_0x4c4ba7['query']['includeAll']){_0x4a722a[_0x3fd2('0x45')]=[{'all':!![]}];}_0x4a722a=_[_0x3fd2('0x3f')]({},_0x4a722a,_0x4c4ba7['options']);return db[_0x3fd2('0x43')][_0x3fd2('0x49')](_0x4a722a)[_0x3fd2('0x25')](handleEntityNotFound(_0x348fe4,null))[_0x3fd2('0x25')](respondWithResult(_0x348fe4,null))[_0x3fd2('0x4a')](handleError(_0x348fe4,null));};exports[_0x3fd2('0x4b')]=function(_0x4d79f3,_0x433e46){return db[_0x3fd2('0x43')][_0x3fd2('0x4b')](_0x4d79f3['body'],{})[_0x3fd2('0x25')](respondWithResult(_0x433e46,0xc9))[_0x3fd2('0x4a')](handleError(_0x433e46,null));};exports['clone']=function(_0x1ede84,_0x4429af){var _0x4de7d2={'where':{'id':_0x1ede84[_0x3fd2('0x48')]['id']}},_0x5e9ca7={};_0x5e9ca7['model']=_[_0x3fd2('0x32')](db[_0x3fd2('0x43')][_0x3fd2('0x2e')]);_0x4de7d2[_0x3fd2('0x36')]=_[_0x3fd2('0x35')](_0x5e9ca7[_0x3fd2('0x30')],qs['fields'](_0x1ede84['query'][_0x3fd2('0x37')]));_0x4de7d2[_0x3fd2('0x36')]=_0x4de7d2[_0x3fd2('0x36')][_0x3fd2('0x38')]?_0x4de7d2[_0x3fd2('0x36')]:_0x5e9ca7[_0x3fd2('0x30')];if(_0x1ede84[_0x3fd2('0x33')]['includeAll']){_0x4de7d2[_0x3fd2('0x45')]=[{'all':!![]}];}_0x4de7d2=_[_0x3fd2('0x3f')]({},_0x4de7d2,_0x1ede84['options']);return db[_0x3fd2('0x43')][_0x3fd2('0x49')](_0x4de7d2)[_0x3fd2('0x25')](handleEntityNotFound(_0x4429af,null))[_0x3fd2('0x25')](function(_0x539140){if(_0x539140){var _0x579da1=_0x539140['get']({'plain':!![]});_0x579da1=qs[_0x3fd2('0x4c')](_0x579da1,['id',_0x3fd2('0x4d'),'updatedAt',_0x3fd2('0x4e')]);_0x1ede84[_0x3fd2('0x4f')]=_[_0x3fd2('0x4c')](_0x1ede84[_0x3fd2('0x4f')],['id',_0x3fd2('0x4d'),_0x3fd2('0x50')]);return db[_0x3fd2('0x51')]['transaction'](function(_0x54863e){return db[_0x3fd2('0x43')][_0x3fd2('0x4b')](_[_0x3fd2('0x3f')](_0x579da1,_0x1ede84[_0x3fd2('0x4f')]),{'include':_0x1ede84[_0x3fd2('0x33')][_0x3fd2('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x54863e})['then'](function(_0x58f19e){var _0x4375b4=_0x58f19e['get']({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x1ede84['params']['id']},'raw':!![]})[_0x3fd2('0x25')](function(_0x1e57a2){if(_0x1e57a2){return BPromise['each'](_0x1e57a2,function(_0xce9393){return new BPromise(function(_0x53bc54,_0x42c7a3){if(_0xce9393[_0x3fd2('0x52')]===null||_0xce9393[_0x3fd2('0x52')]===0x1)_0x53bc54(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0xce9393['id']},'raw':!![]})['then'](function(_0x304b07){var _0x17b656=_['map'](_0x304b07,function(_0x52a5c3){return qs[_0x3fd2('0x4c')](_0x52a5c3,['id','createdAt',_0x3fd2('0x50'),'sectionId']);});_0x53bc54(_0x17b656);})[_0x3fd2('0x4a')](function(_0x1cfd20){_0x42c7a3(_0x1cfd20);});})['then'](function(_0x24da75){var _0x4bf4d1=qs[_0x3fd2('0x4c')](_0xce9393,['id',_0x3fd2('0x4d'),'updatedAt']);_0x4bf4d1['userProfileId']=_0x4375b4['id'];if(_0x24da75)_0x4bf4d1[_0x3fd2('0x53')]=_0x24da75;return _0x4bf4d1;})[_0x3fd2('0x25')](function(_0x426734){return db[_0x3fd2('0x54')][_0x3fd2('0x4b')](_0x426734,{'include':[{'model':db['UserProfileResource'],'as':_0x3fd2('0x53')}],'raw':!![],'transaction':_0x54863e});});})[_0x3fd2('0x25')](function(){return _0x4375b4;});}});});});}})['then'](respondWithResult(_0x4429af,0xc9))[_0x3fd2('0x4a')](handleError(_0x4429af,null));};exports['update']=function(_0x3fb5f2,_0x5b7247){if(_0x3fb5f2['body']['id']){delete _0x3fb5f2[_0x3fd2('0x4f')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x3fb5f2[_0x3fd2('0x48')]['id']}})[_0x3fd2('0x25')](handleEntityNotFound(_0x5b7247,null))[_0x3fd2('0x25')](saveUpdates(_0x3fb5f2[_0x3fd2('0x4f')],null))[_0x3fd2('0x25')](respondWithResult(_0x5b7247,null))[_0x3fd2('0x4a')](handleError(_0x5b7247,null));};exports[_0x3fd2('0x26')]=function(_0x5461bd,_0x1d251a){return db[_0x3fd2('0x43')][_0x3fd2('0x49')]({'where':{'id':_0x5461bd[_0x3fd2('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d251a,null))['then'](removeEntity(_0x1d251a,null))[_0x3fd2('0x4a')](handleError(_0x1d251a,null));};exports['describe']=function(_0x59da96,_0x4cbb96){return db['UserProfile'][_0x3fd2('0x55')]()[_0x3fd2('0x25')](respondWithResult(_0x4cbb96,null))[_0x3fd2('0x4a')](handleError(_0x4cbb96,null));};exports[_0x3fd2('0x56')]=function(_0x3c32a9,_0x27dc52){var _0x2c3c89=_0x3c32a9[_0x3fd2('0x4f')];return db[_0x3fd2('0x43')][_0x3fd2('0x49')]({'where':{'id':_0x3c32a9['params']['id']}})[_0x3fd2('0x25')](handleEntityNotFound(_0x27dc52,null))[_0x3fd2('0x25')](function(_0x400522){if(_0x400522){return db[_0x3fd2('0x51')]['transaction'](function(_0x54013e){return db['UserProfileSection'][_0x3fd2('0x26')]({'where':{'userProfileId':_0x3c32a9[_0x3fd2('0x48')]['id'],'sectionId':_['map'](_0x2c3c89,function(_0x417e23){return _0x417e23[_0x3fd2('0x57')];})},'transaction':_0x54013e})[_0x3fd2('0x25')](function(){var _0xec6e15=_[_0x3fd2('0x31')](_0x2c3c89,function(_0x3ba529){_0x3ba529['userProfileId']=_0x3c32a9['params']['id'];return _0x3ba529;});var _0x3fe604=[];return BPromise[_0x3fd2('0x58')](_0xec6e15,function(_0x40d4f2){return db[_0x3fd2('0x54')][_0x3fd2('0x4b')](_0x40d4f2,{'include':[{'model':db['UserProfileResource'],'as':_0x3fd2('0x53')}],'raw':!![],'transaction':_0x54013e})[_0x3fd2('0x25')](function(_0x53e1c3){_0x3fe604[_0x3fd2('0x59')](_0x53e1c3[_0x3fd2('0x5a')]({'plain':!![]}));});})[_0x3fd2('0x25')](function(){return _0x3fe604;});});});}})['then'](function(_0x62fcac){return _0x62fcac;})[_0x3fd2('0x25')](respondWithResult(_0x27dc52,null))[_0x3fd2('0x4a')](handleError(_0x27dc52,null));};exports[_0x3fd2('0x5b')]=function(_0x324fad,_0x53a396){var _0x2a4ab1;return db['UserProfile'][_0x3fd2('0x49')]({'where':{'id':_0x324fad[_0x3fd2('0x48')]['id']},'attributes':['id',_0x3fd2('0x2b')]})[_0x3fd2('0x25')](handleEntityNotFound(_0x53a396,null))[_0x3fd2('0x25')](function(_0x4a3501){if(_0x4a3501){_0x2a4ab1=_0x4a3501;return db[_0x3fd2('0x54')][_0x3fd2('0x26')]({'where':{'userProfileId':_0x324fad['params']['id'],'sectionId':_0x324fad['query'][_0x3fd2('0x5c')]}});}})[_0x3fd2('0x25')](function(){return _0x2a4ab1;})['then'](respondWithStatusCode(_0x53a396,null))[_0x3fd2('0x4a')](handleError(_0x53a396,null));};exports[_0x3fd2('0x5d')]=function(_0x19e593,_0x2de946){var _0x39d6c8=[];var _0x387402=[];return db[_0x3fd2('0x54')]['findAll']({'where':{'userProfileId':_0x19e593[_0x3fd2('0x48')]['id']},'raw':!![]})['then'](function(_0x4f670b){_0x39d6c8=_['filter'](_0x4f670b,function(_0x3ff4b2){return _0x3ff4b2[_0x3fd2('0x5e')]===0x1||_[_0x3fd2('0x5f')]([0x3eb,0x709],_0x3ff4b2[_0x3fd2('0x57')]);});if(!_['isEmpty'](_0x39d6c8)){return _[_0x3fd2('0x31')](_0x39d6c8,function(_0x266576){return _0x266576['sectionId'];});}else{return;}})[_0x3fd2('0x25')](function(_0xb24df){if(_0xb24df)_0x387402=_0xb24df;if(_[_0x3fd2('0x5f')](_0x387402,0x64)){var _0x1ec24c=_[_0x3fd2('0x49')](_0x39d6c8,{'sectionId':0x64});return hasDefaultDashboard(_0x1ec24c)[_0x3fd2('0x25')](function(_0x3c70b4){return _[_0x3fd2('0x31')](_0x39d6c8,function(_0x2294fe){if(_0x2294fe[_0x3fd2('0x57')]===0x64){_0x2294fe['subsections']=_0x3c70b4;}return _0x2294fe;});});}else{return;}})[_0x3fd2('0x25')](function(_0x1ded99){if(_0x1ded99)_0x39d6c8=_0x1ded99;if(_['includes'](_0x387402,0x3eb)){var _0x2322ab=_[_0x3fd2('0x49')](_0x39d6c8,{'sectionId':0x3eb});return getCustomDashboards(_0x2322ab)['then'](function(_0x78a2d8){return _[_0x3fd2('0x31')](_0x39d6c8,function(_0x377e6e){if(_0x2322ab[_0x3fd2('0x5e')]){if(_0x377e6e['sectionId']===0x3eb){_0x377e6e[_0x3fd2('0x60')]=_0x78a2d8;}}else{if(_0x377e6e['sectionId']===0x64){if(!_0x377e6e[_0x3fd2('0x60')]){_0x377e6e[_0x3fd2('0x60')]=[];}_0x377e6e[_0x3fd2('0x60')]=_0x377e6e[_0x3fd2('0x60')]['concat'](_0x78a2d8);}}return _0x377e6e;});});}else{return;}})[_0x3fd2('0x25')](function(_0x5f10aa){if(_0x5f10aa)_0x39d6c8=_0x5f10aa;if(_['includes'](_0x387402,0x709)){var _0x58cf42=_[_0x3fd2('0x49')](_0x39d6c8,{'sectionId':0x709});return getPlugins(_0x58cf42)[_0x3fd2('0x25')](function(_0x10dff3){if(_0x58cf42[_0x3fd2('0x5e')]){return _[_0x3fd2('0x31')](_0x39d6c8,function(_0xd79d92){if(_0xd79d92[_0x3fd2('0x57')]===0x709){_0xd79d92[_0x3fd2('0x60')]=_0x10dff3;}return _0xd79d92;});}else{var _0x4745d7={'sectionId':0x76c,'enabled':0x1,'subsections':_0x10dff3};var _0x48c6b9=_['map'](_0x39d6c8);_0x48c6b9[_0x3fd2('0x59')](_0x4745d7);return _0x48c6b9;}});}else{return;}})[_0x3fd2('0x25')](function(_0x9ca57f){if(_0x9ca57f)_0x39d6c8=_0x9ca57f;return _['filter'](_0x39d6c8,['enabled',0x1]);})[_0x3fd2('0x25')](respondWithResult(_0x2de946,null))[_0x3fd2('0x4a')](handleError(_0x2de946,null));};function hasDefaultDashboard(_0x28a7f6){var _0x4fedae=[0x65];return new BPromise(function(_0xea32af,_0x25f16d){try{if(_0x28a7f6['autoAssociation']){_0xea32af(_0x4fedae);}else{return db[_0x3fd2('0x61')][_0x3fd2('0x62')]({'where':{'sectionId':_0x28a7f6['id']},'raw':!![]})[_0x3fd2('0x25')](function(_0x11161f){_0x11161f?_0xea32af(_0x4fedae):_0xea32af();});}}catch(_0x53eccd){_0x25f16d(_0x53eccd);}});}function getCustomDashboards(_0x55ae9c){var _0x109fff=[];return new BPromise(function(_0x2b63ee,_0x5d2e3c){try{if(_0x55ae9c[_0x3fd2('0x52')]){return db[_0x3fd2('0x63')][_0x3fd2('0x64')]({'raw':!![]})[_0x3fd2('0x25')](function(_0x5b164b){_0x5b164b[_0x3fd2('0x65')](function(_0x1a1b88){_0x109fff[_0x3fd2('0x59')](_0x1a1b88['id']+0x1869f);});_0x2b63ee(_0x109fff);});}else{return db[_0x3fd2('0x61')][_0x3fd2('0x64')]({'where':{'sectionId':_0x55ae9c['id']},'raw':!![]})['then'](function(_0x144039){_0x144039['forEach'](function(_0x5d86ac){_0x109fff[_0x3fd2('0x59')](_0x5d86ac[_0x3fd2('0x66')]+0x1869f);});_0x2b63ee(_0x109fff);});}}catch(_0x3241ee){_0x5d2e3c(_0x3241ee);}});}function getPlugins(_0x25bc7b){var _0x1b025=[];return new BPromise(function(_0x24015f,_0x25ba4f){try{if(_0x25bc7b['autoAssociation']){return db[_0x3fd2('0x67')]['findAll']({'raw':!![]})[_0x3fd2('0x25')](function(_0x4ada6d){_0x4ada6d[_0x3fd2('0x65')](function(_0x763984){_0x1b025['push'](_0x763984['id']+0x15b38);});_0x24015f(_0x1b025);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x25bc7b['id']},'raw':!![]})[_0x3fd2('0x25')](function(_0x38db87){_0x38db87[_0x3fd2('0x65')](function(_0x5814cd){_0x1b025[_0x3fd2('0x59')](_0x5814cd[_0x3fd2('0x66')]+0x15b38);});_0x24015f(_0x1b025);});}}catch(_0x372a62){_0x25ba4f(_0x372a62);}});}exports['addResources']=function(_0x43417f,_0x271489){return db[_0x3fd2('0x43')][_0x3fd2('0x49')]({'where':{'id':_0x43417f['params']['id']}})['then'](handleEntityNotFound(_0x271489,null))[_0x3fd2('0x25')](function(_0x1afed3){if(_0x1afed3){return db[_0x3fd2('0x51')]['transaction'](function(_0x488894){return db[_0x3fd2('0x54')][_0x3fd2('0x64')]({'where':{'userProfileId':_0x43417f[_0x3fd2('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x3fd2('0x25')](function(_0x58b324){if(_0x58b324){return db[_0x3fd2('0x54')][_0x3fd2('0x26')]({'where':{'userProfileId':_0x43417f['params']['id'],'id':_[_0x3fd2('0x31')](_0x58b324,function(_0x3176aa){return _0x3176aa['id'];})},'transaction':_0x488894});}})['then'](function(_0x5a6d14){var _0x1fcc12=_['map'](_0x43417f['body'],function(_0x338cae){_0x338cae[_0x3fd2('0x68')]=_0x43417f[_0x3fd2('0x48')]['id'];return _0x338cae;});return db[_0x3fd2('0x54')]['bulkCreate'](_0x1fcc12,{'raw':!![],'transaction':_0x488894});})[_0x3fd2('0x25')](function(_0x641f8e){var _0xf19f9b=_[_0x3fd2('0x3e')](_['map'](_0x641f8e,function(_0x4744be){return _0x4744be['get']({'plain':!![]});}),{'includeAll':![]});if(_0xf19f9b){return db[_0x3fd2('0x54')][_0x3fd2('0x64')]({'where':{'userProfileId':_0x43417f['params']['id'],'sectionId':_['map'](_0xf19f9b,function(_0x1112a9){return _0x1112a9[_0x3fd2('0x57')];})},'attributes':['id',_0x3fd2('0x57')],'raw':!![]})[_0x3fd2('0x25')](function(_0xd9855d){var _0x4b5d8b=_['map'](_0x43417f['body'],function(_0x11ed31){_0x11ed31['userProfileId']=_0x43417f[_0x3fd2('0x48')]['id'];return _0x11ed31;});return db[_0x3fd2('0x61')][_0x3fd2('0x69')](_0x4b5d8b,{'raw':!![],'transaction':_0x488894});});}})[_0x3fd2('0x4a')](handleError(_0x271489,null));});}})[_0x3fd2('0x25')](function(_0x455f71){var _0x522877=_[_0x3fd2('0x31')](_0x455f71,function(_0x475982){return _0x475982[_0x3fd2('0x5a')]({'plain':!![]});});})[_0x3fd2('0x25')](respondWithResult(_0x271489,null))[_0x3fd2('0x4a')](handleError(_0x271489,null));};exports[_0x3fd2('0x6a')]=function(_0x3d4512,_0x30c52a,_0x1f3cb8){return db[_0x3fd2('0x43')]['find']({'where':{'id':_0x3d4512[_0x3fd2('0x48')]['id']}})[_0x3fd2('0x25')](handleEntityNotFound(_0x30c52a,null))[_0x3fd2('0x25')](function(_0x4febca){if(_0x4febca){return _0x4febca[_0x3fd2('0x6a')](_0x3d4512[_0x3fd2('0x33')][_0x3fd2('0x5c')]);}})[_0x3fd2('0x25')](respondWithStatusCode(_0x30c52a,null))[_0x3fd2('0x4a')](handleError(_0x30c52a,null));};exports['getResources']=function(_0x59a36a,_0x5e9341){var _0x26b840={};if(!_0x59a36a['query'][_0x3fd2('0x6b')])throw new Error(_0x3fd2('0x6c'));if(!_0x59a36a[_0x3fd2('0x33')][_0x3fd2('0x39')](_0x3fd2('0x3a'))){_0x26b840[_0x3fd2('0x20')]=qs[_0x3fd2('0x20')](_0x59a36a[_0x3fd2('0x33')][_0x3fd2('0x20')]);_0x26b840[_0x3fd2('0x1f')]=qs[_0x3fd2('0x1f')](_0x59a36a[_0x3fd2('0x33')]['offset']);}return db[_0x3fd2('0x43')][_0x3fd2('0x49')]({'where':{'id':_0x59a36a[_0x3fd2('0x48')]['id']}})[_0x3fd2('0x25')](function(_0x13dc4c){if(!_0x13dc4c)throw new Error(_0x3fd2('0x6d')+_0x59a36a[_0x3fd2('0x48')]['id']);return db[_0x3fd2('0x43')][_0x3fd2('0x6e')](_0x59a36a);})[_0x3fd2('0x25')](respondWithFilteredResult(_0x5e9341,_0x26b840))[_0x3fd2('0x4a')](handleError(_0x5e9341,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 80c0fb8..93eab32 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 _0x8ace=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update'];(function(_0x229f67,_0x42b7a8){var _0x41d321=function(_0x770ade){while(--_0x770ade){_0x229f67['push'](_0x229f67['shift']());}};_0x41d321(++_0x42b7a8);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x4b418f,_0x3b6a96){_0x4b418f=_0x4b418f-0x0;var _0x2ed208=_0x8ace[_0x4b418f];return _0x2ed208;};'use strict';var EventEmitter=require(_0xe8ac('0x0'));var UserProfile=require(_0xe8ac('0x1'))['db'][_0xe8ac('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe8ac('0x3')](0x0);var events={'afterCreate':_0xe8ac('0x4'),'afterUpdate':_0xe8ac('0x5'),'afterDestroy':_0xe8ac('0x6')};function emitEvent(_0x274d7d){return function(_0x114351,_0xf6af00,_0x199794){UserProfileEvents[_0xe8ac('0x7')](_0x274d7d+':'+_0x114351['id'],_0x114351);UserProfileEvents[_0xe8ac('0x7')](_0x274d7d,_0x114351);_0x199794(null);};}for(var e in events){if(events[_0xe8ac('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xe8ac('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x781d=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x781d,0x14a));var _0xd781=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x781d[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xd781('0x0'));var UserProfile=require(_0xd781('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd781('0x2'),'afterUpdate':_0xd781('0x3'),'afterDestroy':_0xd781('0x4')};function emitEvent(_0x1a9f94){return function(_0xfd915d,_0x42258e,_0x446534){UserProfileEvents[_0xd781('0x5')](_0x1a9f94+':'+_0xfd915d['id'],_0xfd915d);UserProfileEvents[_0xd781('0x5')](_0x1a9f94,_0xfd915d);_0x446534(null);};}for(var e in events){if(events[_0xd781('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd781('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 051d4ac..67df279 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 _0x25a6=['dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','map','catch','model','associatedResources','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','name','projects','contacts','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','User','role','agent','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','teams','voicequeues','queuecampaigns','users','agents','telephones','Users','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Reports','reportId','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','union','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','foreignKey','forEach','merge','options','includeAll','include','default','DefaultReports','custom','CustomReports','customSorting','extraQueryConditions','count','Tag','Tags','color','tag','ThroughTags','rows','openTabs','true','chat'];(function(_0x14c9b8,_0x41af73){var _0x561b7f=function(_0x179c65){while(--_0x179c65){_0x14c9b8['push'](_0x14c9b8['shift']());}};_0x561b7f(++_0x41af73);}(_0x25a6,0x183));var _0x625a=function(_0x5a6525,_0x5a9f66){_0x5a6525=_0x5a6525-0x0;var _0x15e886=_0x25a6[_0x5a6525];return _0x15e886;};'use strict';var _=require(_0x625a('0x0'));var attributes=require(_0x625a('0x1'));var squel=require(_0x625a('0x2'));module[_0x625a('0x3')]=function(_0x34a2f2){var _0x1f0cc5=_0x34a2f2[_0x625a('0x4')];function _0x494c44(_0x1cac4e,_0x5953bd){return new Promise(function(_0xb0287b,_0x519d83){if(!_0x5953bd)return _0xb0287b(null);var _0x1b5f27=_0x5953bd[_0x625a('0x5')]?{[_0x5953bd[_0x625a('0x5')][_0x625a('0x6')]]:_0x5953bd[_0x625a('0x5')][_0x625a('0x7')]}:undefined;return _0x1f0cc5[_0x1cac4e][_0x625a('0x8')]({'where':_0x1b5f27,'raw':!![]})[_0x625a('0x9')](function(_0x5d1a2d){_0x5953bd['associatedResources']=_[_0x625a('0xa')](_0x5d1a2d,'id');_0xb0287b(_0x5953bd);})[_0x625a('0xb')](function(_0x1146eb){_0x519d83(_0x1146eb);});});}function _0xa6cd96(_0x31b1dc,_0x11b86e){return new Promise(function(_0x35f8cd,_0x387ec1){var _0x1785e9=_0x31b1dc[_0x625a('0x5')]?{[_0x31b1dc[_0x625a('0x5')][_0x625a('0x6')]]:_0x31b1dc[_0x625a('0x5')][_0x625a('0x7')]}:undefined;return _0x1f0cc5[_0x31b1dc[_0x625a('0xc')]][_0x625a('0x8')]({'where':_0x1785e9,'raw':!![]})[_0x625a('0x9')](function(_0x4b5ae9){_0x11b86e[_0x625a('0xd')]=_[_0x625a('0xa')](_0x4b5ae9,function(_0x4077ce){return _0x4077ce['name'];});_0x35f8cd(_0x11b86e);})[_0x625a('0xb')](function(_0x1f6dc1){_0x387ec1(_0x1f6dc1);});});}function _0x1ba432(_0x50b4d9,_0x575169,_0x33b78f){if(!_0x575169)return Promise['resolve'](null);return new Promise(function(_0x3593b2,_0x52c2ca){return _0x1f0cc5['UserProfileResource'][_0x625a('0x8')]({'where':{'sectionId':_0x575169['id']},'raw':!![]})[_0x625a('0x9')](function(_0xfd55b0){if(_0x50b4d9[_0x625a('0x6')]&&_0x50b4d9['field']!=='id'){_0x575169[_0x625a('0xd')]=_[_0x625a('0xa')](_0xfd55b0,function(_0x182ac2){return _0x182ac2[_0x50b4d9['field']];});}else{if(_0x33b78f===_0x625a('0xe')){_0x575169[_0x625a('0xd')]=_[_0x625a('0xa')](_0xfd55b0,function(_0x526ad8){return{'id':_0x526ad8[_0x625a('0xf')],'type':_0x526ad8[_0x625a('0x10')]};});}else{_0x575169[_0x625a('0xd')]=_['map'](_0xfd55b0,function(_0x1c327c){return _0x1c327c[_0x625a('0xf')];});}}_0x3593b2(_0x575169);})[_0x625a('0xb')](function(_0x96bd37){_0x52c2ca(_0x96bd37);});});}function _0x55b4de(_0x53183f,_0x3d36cd){var _0x40507e={'parentSections':[]};switch(_0x53183f[_0x625a('0x11')]()){case'squareprojects':_0x40507e[_0x625a('0x12')]=_0x625a('0x13');break;case _0x625a('0x14'):_0x40507e[_0x625a('0x12')]=_0x625a('0x15');break;case'squarerecordings':_0x40507e[_0x625a('0x12')]=_0x625a('0x16');_0x40507e[_0x625a('0x17')]=[{'name':_0x625a('0x18'),'field':_0x625a('0x19'),'foreignKey':'projectName'}];break;case _0x625a('0x1a'):_0x40507e[_0x625a('0x12')]='JscriptyProject';break;case _0x625a('0x1b'):_0x40507e[_0x625a('0x12')]='CmContact';_0x40507e[_0x625a('0x17')]=[{'name':_0x625a('0x1c'),'field':'id','foreignKey':_0x625a('0x1d')}];break;case _0x625a('0x1e'):_0x40507e[_0x625a('0x12')]=_0x625a('0x1f');break;case'companies':_0x40507e[_0x625a('0x12')]=_0x625a('0x20');break;case _0x625a('0x21'):_0x40507e[_0x625a('0x12')]=_0x625a('0x22');break;case'chatqueues':_0x40507e[_0x625a('0x12')]='ChatQueue';break;case _0x625a('0x23'):_0x40507e[_0x625a('0x12')]=_0x625a('0x24');break;case _0x625a('0x25'):_0x40507e[_0x625a('0x12')]=_0x625a('0x26');break;case _0x625a('0x27'):_0x40507e[_0x625a('0x12')]=_0x625a('0x28');break;case'inboundroutes':case _0x625a('0x29'):case _0x625a('0x2a'):_0x40507e['childModel']=_0x625a('0x2b');break;case _0x625a('0x2c'):_0x40507e[_0x625a('0x12')]=_0x625a('0x2d');break;case _0x625a('0x2e'):_0x40507e['childModel']='VoiceMail';break;case'voicerecordings':_0x40507e[_0x625a('0x12')]=_0x625a('0x2f');_0x40507e[_0x625a('0x17')]=[{'name':_0x625a('0x30'),'field':_0x625a('0x19'),'foreignKey':_0x625a('0x31'),'model':_0x625a('0x32'),'filter':{'field':_0x625a('0x33'),'value':[_0x625a('0x34')]}},{'name':'Telephones','field':_0x625a('0x19'),'foreignKey':'membername','model':_0x625a('0x32'),'filter':{'field':_0x625a('0x33'),'value':[_0x625a('0x35')]}},{'name':_0x625a('0x36'),'field':'name','foreignKey':_0x625a('0x37'),'model':_0x625a('0x38'),'filter':{'field':_0x625a('0x10'),'value':[_0x625a('0x39')]}},{'name':_0x625a('0x3a'),'field':_0x625a('0x19'),'foreignKey':_0x625a('0x37'),'model':'VoiceQueue','filter':{'field':_0x625a('0x10'),'value':['outbound']}}];break;case _0x625a('0x3b'):_0x40507e['childModel']=_0x625a('0x3c');break;case _0x625a('0x3d'):_0x40507e['childModel']=_0x625a('0x3e');break;case _0x625a('0x3f'):_0x40507e[_0x625a('0x12')]=_0x625a('0x40');break;case _0x625a('0x41'):_0x40507e['childModel']=_0x625a('0x42');break;case'mailqueues':_0x40507e[_0x625a('0x12')]=_0x625a('0x43');break;case'mailaccounts':_0x40507e[_0x625a('0x12')]=_0x625a('0x44');break;case _0x625a('0x45'):_0x40507e['childModel']=_0x625a('0x46');break;case'openchannelqueues':_0x40507e[_0x625a('0x12')]='OpenchannelQueue';break;case _0x625a('0x47'):_0x40507e[_0x625a('0x12')]=_0x625a('0x48');break;case'smsqueues':_0x40507e[_0x625a('0x12')]=_0x625a('0x49');break;case _0x625a('0x4a'):_0x40507e[_0x625a('0x12')]=_0x625a('0x4b');break;case'whatsappqueues':_0x40507e['childModel']=_0x625a('0x4c');break;case'whatsappaccounts':_0x40507e['childModel']='WhatsappAccount';break;case _0x625a('0x4d'):_0x40507e[_0x625a('0x12')]='Team';break;case _0x625a('0x4e'):case _0x625a('0x4f'):_0x40507e[_0x625a('0x12')]=_0x625a('0x38');if(_0x3d36cd){_0x40507e['parentSections']=[{'name':_0x625a('0x36')},{'name':'QueueCampaigns'}];}break;case _0x625a('0x50'):case _0x625a('0x51'):case _0x625a('0x52'):_0x40507e[_0x625a('0x12')]=_0x625a('0x32');if(_0x3d36cd){_0x40507e[_0x625a('0x17')]=[{'name':_0x625a('0x53'),'filter':{'field':_0x625a('0x33'),'value':['admin',_0x625a('0x54')]},'ignore':!![]},{'name':_0x625a('0x30')},{'name':_0x625a('0x55')}];}break;case _0x625a('0x56'):_0x40507e[_0x625a('0x12')]=_0x625a('0x57');break;case _0x625a('0x58'):_0x40507e[_0x625a('0x12')]=_0x625a('0x59');break;case _0x625a('0x5a'):_0x40507e['childModel']=_0x625a('0x5b');break;case _0x625a('0x5c'):_0x40507e[_0x625a('0x12')]=_0x625a('0x5d');break;case _0x625a('0x5e'):_0x40507e[_0x625a('0x12')]=_0x625a('0x5f');break;case'zohoaccounts':_0x40507e[_0x625a('0x12')]=_0x625a('0x60');break;case'vtigeraccounts':_0x40507e[_0x625a('0x12')]=_0x625a('0x32');break;case _0x625a('0x61'):_0x40507e[_0x625a('0x12')]='CannedAnswer';break;case _0x625a('0x62'):_0x40507e[_0x625a('0x12')]=_0x625a('0x63');break;case _0x625a('0x64'):_0x40507e[_0x625a('0x12')]=_0x625a('0x65');break;case'intervals':_0x40507e[_0x625a('0x12')]='Interval';break;case'pauses':_0x40507e[_0x625a('0x12')]=_0x625a('0x66');break;case _0x625a('0x67'):_0x40507e['childModel']=_0x625a('0x68');break;case _0x625a('0x69'):_0x40507e['childModel']=_0x625a('0x6a');break;case _0x625a('0x6b'):_0x40507e['childModel']='Tag';break;case _0x625a('0x6c'):_0x40507e['childModel']=_0x625a('0x6d');break;case _0x625a('0x6e'):_0x40507e['childModel']=_0x625a('0x6f');break;case _0x625a('0x70'):_0x40507e[_0x625a('0x12')]=_0x625a('0x71');break;case _0x625a('0x72'):_0x40507e[_0x625a('0x12')]=_0x625a('0x73');break;case _0x625a('0x74'):_0x40507e[_0x625a('0x12')]='Plugin';break;case'extractedreports':_0x40507e['childModel']=_0x625a('0xe');_0x40507e['parentSections']=[{'name':_0x625a('0x75'),'field':'id','foreignKey':_0x625a('0x76')}];break;case'metrics':_0x40507e['childModel']=_0x625a('0x77');break;}return _0x40507e;}function _0x5ea10d(_0x15c8fc,_0x1bbf5d){var _0x437868=_0x15c8fc[_0x625a('0x78')](0x0)['toUpperCase']()+_0x15c8fc[_0x625a('0x79')](0x1);var _0x13a5e2={'type':_0x1f0cc5[_0x625a('0x7a')][_0x625a('0x7b')][_0x625a('0x7c')],'raw':!![]};return new Promise(function(_0x28a9f4,_0x483e03){var _0x1c5307=squel[_0x625a('0x7d')]()[_0x625a('0x6')](_0x625a('0x7e')+_0x437868+'InteractionId','id')[_0x625a('0x6')](_0x625a('0x7f'))[_0x625a('0x80')](_0x625a('0x81')+_0x15c8fc+_0x625a('0x82'),'ui')['where'](_0x625a('0x83'),_0x1bbf5d['id']);return _0x1f0cc5[_0x625a('0x84')][_0x625a('0x85')](_0x1c5307[_0x625a('0x86')](),_0x13a5e2)['then'](function(_0x376b5f){_0x1bbf5d[_0x437868+_0x625a('0x87')]=_0x376b5f;_0x28a9f4(_0x376b5f);})[_0x625a('0xb')](function(_0x224a42){_0x483e03(_0x224a42);});});}return _0x34a2f2[_0x625a('0x88')](_0x625a('0x89'),attributes,{'tableName':_0x625a('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1f1ad4){var _0x62e28e=require(_0x625a('0x8b'));var _0x506508={'raw':_0x1f1ad4[_0x625a('0x85')][_0x625a('0x8c')],'where':{}};var _0x2c8c1e={};var _0x19df1f={'count':0x0,'rows':[]};var _0x480ca1=_0x1f1ad4[_0x625a('0x85')][_0x625a('0x8d')];var _0x5e3034=_0x1f1ad4[_0x625a('0x85')]['mergeResources']||![];var _0x1cdfd7=_0x55b4de(_0x480ca1,_0x5e3034);if(!_0x1cdfd7[_0x625a('0x12')])throw new Error(_0x625a('0x8e')+_0x480ca1+'\x27');var _0x31e6b7=[{'name':_0x480ca1}];if(!_[_0x625a('0x8f')](_0x1cdfd7[_0x625a('0x17')]))_0x31e6b7=_0x1cdfd7[_0x625a('0x17')];var _0x5ef3ac=[];for(var _0x129b42=0x0;_0x129b42<_0x31e6b7[_0x625a('0x90')];_0x129b42++){_0x5ef3ac[_0x625a('0x91')](_0x1f0cc5[_0x625a('0x92')][_0x625a('0x93')]({'where':{'userProfileId':_0x1f1ad4['params']['id'],'name':_0x31e6b7[_0x129b42][_0x625a('0x19')]},'raw':!![]}));}return Promise[_0x625a('0x94')](_0x5ef3ac)[_0x625a('0x9')](function(_0x99b527){var _0x3d64b6=_[_0x625a('0x5')](_0x99b527,function(_0x5b8244){return _0x5b8244?_0x5b8244:undefined;});var _0x57433a=_['filter'](_0x31e6b7,['ignore',!![]]);var _0x4476e=_[_0x625a('0x8f')](_0x3d64b6)&&_[_0x625a('0x8f')](_0x57433a)?null:_[_0x625a('0x95')](_0x57433a,_0x3d64b6);if(!_0x4476e)return null;var _0x34726e=[];for(var _0xc567b=0x0;_0xc567b<_0x4476e[_0x625a('0x90')];_0xc567b++){var _0x3f33c7=_[_0x625a('0x93')](_0x31e6b7,function(_0x96f3ec){return _0x4476e[_0xc567b]?_0x96f3ec[_0x625a('0x19')]===_0x4476e[_0xc567b][_0x625a('0x19')]:null;});if(_0x3f33c7){if(_0x4476e[_0xc567b]['ignore']){_0x34726e[_0x625a('0x91')](_0x494c44(_0x1cdfd7[_0x625a('0x12')],_0x4476e[_0xc567b]));}else{if(!_0x4476e[_0xc567b][_0x625a('0x96')]){_0x34726e[_0x625a('0x91')](_0x1ba432(_0x3f33c7,_0x4476e[_0xc567b],_0x1cdfd7[_0x625a('0x12')]));}else{if(_0x3f33c7[_0x625a('0xc')]){_0x34726e[_0x625a('0x91')](_0xa6cd96(_0x3f33c7,_0x4476e[_0xc567b]));}}}}}return Promise[_0x625a('0x94')](_0x34726e);})[_0x625a('0x9')](function(_0x1f5d4b){var _0x2ddaec=_0x1f5d4b;var _0x58132c=null;if(_0x2ddaec){_0x58132c=_0x2ddaec['length']===0x1?_0x2ddaec[0x0]:null;}if(!_0x58132c&&!_0x2ddaec)return _0x19df1f;var _0x449a62=_0x1f0cc5[_0x1cdfd7['childModel']][_0x625a('0x97')];_0x2c8c1e[_0x625a('0xc')]=_[_0x625a('0x98')](_0x449a62);_0x2c8c1e['query']=_[_0x625a('0x98')](_0x1f1ad4[_0x625a('0x85')]);_0x2c8c1e['filters']=_[_0x625a('0x99')](_0x2c8c1e['model'],_0x2c8c1e[_0x625a('0x85')]);_0x506508[_0x625a('0x9a')]=_[_0x625a('0x99')](_0x2c8c1e[_0x625a('0xc')],_0x62e28e['fields'](_0x1f1ad4['query'][_0x625a('0x9b')]));_0x506508[_0x625a('0x9a')]=_0x506508['attributes']['length']?_0x506508[_0x625a('0x9a')]:_0x2c8c1e[_0x625a('0xc')];if(!_0x1f1ad4['query'][_0x625a('0x9c')](_0x625a('0x9d'))){_0x506508[_0x625a('0x9e')]=_0x62e28e[_0x625a('0x9e')](_0x1f1ad4[_0x625a('0x85')][_0x625a('0x9e')]);_0x506508[_0x625a('0x9f')]=_0x62e28e[_0x625a('0x9f')](_0x1f1ad4[_0x625a('0x85')][_0x625a('0x9f')]);}_0x506508[_0x625a('0xa0')]=_0x62e28e[_0x625a('0xa1')](_0x1f1ad4[_0x625a('0x85')][_0x625a('0xa1')]);_0x506508[_0x625a('0xa2')]=_0x62e28e[_0x625a('0xa3')](_['pick'](_0x1f1ad4[_0x625a('0x85')],_0x2c8c1e[_0x625a('0xa3')]));if(_0x1f1ad4[_0x625a('0x85')][_0x625a('0x5')]){_0x506508[_0x625a('0xa2')]=_['merge'](_0x506508['where'],{'$or':_[_0x625a('0xa')](_0x449a62,function(_0x3adc39){if(_0x3adc39[_0x625a('0x10')]['key']!=='VIRTUAL'){var _0x44f398={};_0x44f398[_0x3adc39['field']]={'$like':'%'+_0x1f1ad4['query'][_0x625a('0x5')]+'%'};return _0x44f398;}})});}var _0x323e9f=[];var _0x202cf4=null;var _0x2e9ae0={};if(_0x58132c){_0x202cf4=_[_0x625a('0x93')](_0x31e6b7,['name',_0x58132c[_0x625a('0x19')]]);if(_0x202cf4[_0x625a('0x6')]){_0x2e9ae0={};if(_0x1cdfd7['childModel']===_0x625a('0xe')){_0x2e9ae0[_0x202cf4['foreignKey']]=_[_0x625a('0xa')](_0x58132c[_0x625a('0xd')],'id');}else{_0x2e9ae0[_0x202cf4[_0x625a('0xa4')]]=_0x58132c[_0x625a('0xd')];}_0x323e9f[_0x625a('0x91')](_0x2e9ae0);}else{_0x506508[_0x625a('0xa2')]['id']=_0x58132c['associatedResources'];}}else{for(var _0x23a66c=0x0;_0x23a66c<_0x2ddaec[_0x625a('0x90')];_0x23a66c++){_0x202cf4=_['find'](_0x31e6b7,[_0x625a('0x19'),_0x2ddaec[_0x23a66c][_0x625a('0x19')]]);if(_0x202cf4[_0x625a('0x6')]){_0x2e9ae0={};_0x2e9ae0[_0x202cf4['foreignKey']]=_0x2ddaec[_0x23a66c][_0x625a('0xd')];_0x323e9f[_0x625a('0x91')](_0x2e9ae0);}else{if(!_0x506508[_0x625a('0xa2')]['id'])_0x506508[_0x625a('0xa2')]['id']=[];_0x2ddaec[_0x23a66c]['associatedResources'][_0x625a('0xa5')](function(_0x187ad6){_0x506508[_0x625a('0xa2')]['id'][_0x625a('0x91')](_0x187ad6);});}}}if(!_[_0x625a('0x8f')](_0x323e9f)){_0x506508['where']=_[_0x625a('0xa6')](_0x506508[_0x625a('0xa2')],{'$and':{'$or':_0x323e9f}});}_0x506508=_['merge']({},_0x506508,_0x1f1ad4[_0x625a('0xa7')]);if(_0x58132c&&!_0x58132c[_0x625a('0x96')]&&_0x1cdfd7[_0x625a('0x12')]==='AnalyticExtractedReport'){if(_0x1f1ad4[_0x625a('0x85')][_0x625a('0xa8')]){_0x506508[_0x625a('0xa9')]=[{'all':!![]}];}return _0x1f0cc5[_0x1cdfd7['childModel']]['findAll'](_0x506508)[_0x625a('0x9')](function(_0x51abc1){var _0x4459d0=[];_0x51abc1[_0x625a('0xa5')](function(_0x4cca1e){var _0x510faa;switch(_0x4cca1e['reportType']){case _0x625a('0xaa'):_0x510faa=_[_0x625a('0x93')](_0x58132c[_0x625a('0xd')],function(_0x43a401){return _0x43a401['id']===_0x4cca1e[_0x625a('0x76')]&&_0x43a401['type']===_0x625a('0xab');});break;case _0x625a('0xac'):_0x510faa=_[_0x625a('0x93')](_0x58132c[_0x625a('0xd')],function(_0x23e921){return _0x23e921['id']===_0x4cca1e[_0x625a('0x76')]&&_0x23e921['type']===_0x625a('0xad');});break;}if(_0x510faa)_0x4459d0[_0x625a('0x91')](_0x4cca1e);});_0x19df1f['count']=_0x4459d0[_0x625a('0x90')];_0x19df1f['rows']=_0x4459d0;return _0x19df1f;});}else{if(!_[_0x625a('0x8f')](_0x1f1ad4['query']['ids'])){_0x506508[_0x625a('0xa2')]['id']=_0x506508[_0x625a('0xa2')]['id']?_[_0x625a('0x99')](_0x506508['where']['id'],_0x1f1ad4[_0x625a('0x85')]['ids']):_0x1f1ad4[_0x625a('0x85')]['ids'];if(_0x1f1ad4['query'][_0x625a('0xae')]){_0x506508['order']=_0x1f1ad4[_0x625a('0x85')][_0x625a('0xae')];}}if(_0x1f1ad4['query'][_0x625a('0xaf')]){_0x506508['where']=_[_0x625a('0xa6')](_0x506508['where'],{'$and':_0x1f1ad4['query'][_0x625a('0xaf')]});}return _0x1f0cc5[_0x1cdfd7['childModel']][_0x625a('0xb0')]({'where':_0x506508[_0x625a('0xa2')]})['then'](function(_0x41f286){_0x19df1f[_0x625a('0xb0')]=_0x41f286;if(_0x1f1ad4[_0x625a('0x85')]['includeAll']){if(_0x1cdfd7[_0x625a('0x12')]==='CmContact'){_0x506508[_0x625a('0xa9')]=[{'model':_0x1f0cc5[_0x625a('0xb1')],'as':_0x625a('0xb2'),'attributes':['id',_0x625a('0x19'),_0x625a('0xb3')],'required':_0x1f1ad4['query'][_0x625a('0xb4')]?!![]:![]},{'model':_0x1f0cc5['Tag'],'as':_0x625a('0xb5'),'attributes':['id','name',_0x625a('0xb3')],'through':_0x1f1ad4[_0x625a('0x85')]['tag']?{'attributes':[],'where':{'TagId':_0x1f1ad4['query']['tag']||undefined}}:{},'required':_0x1f1ad4[_0x625a('0x85')][_0x625a('0xb4')]?!![]:![]}];}else{_0x506508['include']=[{'all':!![]}];}}return _0x1f0cc5[_0x1cdfd7['childModel']][_0x625a('0x8')](_0x506508);})[_0x625a('0x9')](function(_0x125e0f){_0x19df1f[_0x625a('0xb6')]=_0x125e0f;if(_0x480ca1===_0x625a('0x30')&&_0x1f1ad4['query'][_0x625a('0xb7')]===_0x625a('0xb8')){var _0x33d8c3=[];for(var _0xbf4db8=0x0;_0xbf4db8<_0x19df1f[_0x625a('0xb6')][_0x625a('0x90')];_0xbf4db8++){_0x33d8c3[_0x625a('0x91')](_0x5ea10d(_0x625a('0xb9'),_0x19df1f[_0x625a('0xb6')][_0xbf4db8][_0x625a('0xba')]));_0x33d8c3[_0x625a('0x91')](_0x5ea10d('sms',_0x19df1f[_0x625a('0xb6')][_0xbf4db8][_0x625a('0xba')]));_0x33d8c3['push'](_0x5ea10d(_0x625a('0xbb'),_0x19df1f['rows'][_0xbf4db8][_0x625a('0xba')]));_0x33d8c3[_0x625a('0x91')](_0x5ea10d(_0x625a('0xbc'),_0x19df1f['rows'][_0xbf4db8][_0x625a('0xba')]));_0x33d8c3[_0x625a('0x91')](_0x5ea10d(_0x625a('0xbd'),_0x19df1f[_0x625a('0xb6')][_0xbf4db8][_0x625a('0xba')]));_0x33d8c3['push'](_0x5ea10d(_0x625a('0xbe'),_0x19df1f[_0x625a('0xb6')][_0xbf4db8][_0x625a('0xba')]));}return Promise[_0x625a('0x94')](_0x33d8c3)[_0x625a('0x9')](function(){return _0x19df1f;});}return _0x19df1f;});}});}}});}; \ No newline at end of file +var _0xc410=['freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','Interval','pauses','Pause','scheduler','tags','Tag','templates','triggers','Trigger','trunks','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','ignore','autoAssociation','model','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','options','include','forEach','reportType','default','DefaultReports','CustomReports','count','ids','customSorting','extraQueryConditions','includeAll','Tags','color','tag','rows','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','SquareProject','SquareOdbc','childModel','SquareRecording','parentSections','SquareProjects','projectName','projects','CmContact','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','role','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','user','ZendeskAccount'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc410,0x11c));var _0x0c41=function(_0x58010d,_0x49b16a){_0x58010d=_0x58010d-0x0;var _0x4f93db=_0xc410[_0x58010d];return _0x4f93db;};'use strict';var _=require('lodash');var attributes=require(_0x0c41('0x0'));var squel=require(_0x0c41('0x1'));module[_0x0c41('0x2')]=function(_0x441c7d){var _0x17a1d4=_0x441c7d[_0x0c41('0x3')];function _0x2a216c(_0x51d1ef,_0x50af27){return new Promise(function(_0x428f67,_0x3d0ce4){if(!_0x50af27)return _0x428f67(null);var _0x5ac3d0=_0x50af27[_0x0c41('0x4')]?{[_0x50af27[_0x0c41('0x4')][_0x0c41('0x5')]]:_0x50af27[_0x0c41('0x4')][_0x0c41('0x6')]}:undefined;return _0x17a1d4[_0x51d1ef][_0x0c41('0x7')]({'where':_0x5ac3d0,'raw':!![]})[_0x0c41('0x8')](function(_0x4660a8){_0x50af27[_0x0c41('0x9')]=_[_0x0c41('0xa')](_0x4660a8,'id');_0x428f67(_0x50af27);})[_0x0c41('0xb')](function(_0xdf6131){_0x3d0ce4(_0xdf6131);});});}function _0x20893b(_0x454e92,_0x33c036){return new Promise(function(_0x339631,_0x10a4c4){var _0xd168e7=_0x454e92[_0x0c41('0x4')]?{[_0x454e92[_0x0c41('0x4')][_0x0c41('0x5')]]:_0x454e92[_0x0c41('0x4')][_0x0c41('0x6')]}:undefined;return _0x17a1d4[_0x454e92['model']][_0x0c41('0x7')]({'where':_0xd168e7,'raw':!![]})['then'](function(_0x168479){_0x33c036[_0x0c41('0x9')]=_[_0x0c41('0xa')](_0x168479,function(_0x2fa0b1){return _0x2fa0b1[_0x0c41('0xc')];});_0x339631(_0x33c036);})[_0x0c41('0xb')](function(_0x23f6b8){_0x10a4c4(_0x23f6b8);});});}function _0x3360ee(_0x3b1def,_0x7df0e1,_0x198a02){if(!_0x7df0e1)return Promise[_0x0c41('0xd')](null);return new Promise(function(_0x29c374,_0xc84c97){return _0x17a1d4['UserProfileResource']['findAll']({'where':{'sectionId':_0x7df0e1['id']},'raw':!![]})[_0x0c41('0x8')](function(_0x2397ac){if(_0x3b1def['field']&&_0x3b1def[_0x0c41('0x5')]!=='id'){_0x7df0e1[_0x0c41('0x9')]=_[_0x0c41('0xa')](_0x2397ac,function(_0x43fa58){return _0x43fa58[_0x3b1def[_0x0c41('0x5')]];});}else{if(_0x198a02===_0x0c41('0xe')){_0x7df0e1[_0x0c41('0x9')]=_['map'](_0x2397ac,function(_0x251b47){return{'id':_0x251b47['resourceId'],'type':_0x251b47[_0x0c41('0xf')]};});}else{_0x7df0e1[_0x0c41('0x9')]=_[_0x0c41('0xa')](_0x2397ac,function(_0x1a65ab){return _0x1a65ab[_0x0c41('0x10')];});}}_0x29c374(_0x7df0e1);})[_0x0c41('0xb')](function(_0x43cdec){_0xc84c97(_0x43cdec);});});}function _0x5578ea(_0x234611,_0x8c0358){var _0x3060d0={'parentSections':[]};switch(_0x234611[_0x0c41('0x11')]()){case _0x0c41('0x12'):_0x3060d0['childModel']=_0x0c41('0x13');break;case'odbc':_0x3060d0['childModel']=_0x0c41('0x14');break;case'squarerecordings':_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x16');_0x3060d0[_0x0c41('0x17')]=[{'name':_0x0c41('0x18'),'field':_0x0c41('0xc'),'foreignKey':_0x0c41('0x19')}];break;case _0x0c41('0x1a'):_0x3060d0[_0x0c41('0x15')]='JscriptyProject';break;case'contacts':_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x1b');_0x3060d0[_0x0c41('0x17')]=[{'name':'Lists','field':'id','foreignKey':_0x0c41('0x1c')}];break;case'lists':_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x1d');break;case _0x0c41('0x1e'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x1f');break;case _0x0c41('0x20'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x21');break;case _0x0c41('0x22'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x23');break;case'chatwebsites':_0x3060d0[_0x0c41('0x15')]='ChatWebsite';break;case _0x0c41('0x24'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x25');break;case _0x0c41('0x26'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x27');break;case'inboundroutes':case _0x0c41('0x28'):case'outboundroutes':_0x3060d0['childModel']=_0x0c41('0x29');break;case _0x0c41('0x2a'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x2b');break;case _0x0c41('0x2c'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x2d');break;case _0x0c41('0x2e'):_0x3060d0[_0x0c41('0x15')]='VoiceRecording';_0x3060d0[_0x0c41('0x17')]=[{'name':_0x0c41('0x2f'),'field':_0x0c41('0xc'),'foreignKey':_0x0c41('0x30'),'model':_0x0c41('0x31'),'filter':{'field':'role','value':[_0x0c41('0x32')]}},{'name':_0x0c41('0x33'),'field':_0x0c41('0xc'),'foreignKey':_0x0c41('0x30'),'model':_0x0c41('0x31'),'filter':{'field':_0x0c41('0x34'),'value':['telephone']}},{'name':_0x0c41('0x35'),'field':_0x0c41('0xc'),'foreignKey':'queue','model':_0x0c41('0x36'),'filter':{'field':_0x0c41('0xf'),'value':[_0x0c41('0x37')]}},{'name':_0x0c41('0x38'),'field':_0x0c41('0xc'),'foreignKey':_0x0c41('0x39'),'model':_0x0c41('0x36'),'filter':{'field':_0x0c41('0xf'),'value':['outbound']}}];break;case _0x0c41('0x3a'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x3b');break;case _0x0c41('0x3c'):_0x3060d0[_0x0c41('0x15')]='VoiceChanSpy';break;case _0x0c41('0x3d'):_0x3060d0['childModel']='VoicePrefix';break;case _0x0c41('0x3e'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x3f');break;case _0x0c41('0x40'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x41');break;case _0x0c41('0x42'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x43');break;case _0x0c41('0x44'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x45');break;case _0x0c41('0x46'):_0x3060d0['childModel']=_0x0c41('0x47');break;case'openchannelaccounts':_0x3060d0['childModel']=_0x0c41('0x48');break;case _0x0c41('0x49'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x4a');break;case _0x0c41('0x4b'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x4c');break;case'whatsappqueues':_0x3060d0['childModel']='WhatsappQueue';break;case _0x0c41('0x4d'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x4e');break;case _0x0c41('0x4f'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x50');break;case _0x0c41('0x51'):case'queuecampaigns':_0x3060d0['childModel']=_0x0c41('0x36');if(_0x8c0358){_0x3060d0[_0x0c41('0x17')]=[{'name':_0x0c41('0x35')},{'name':_0x0c41('0x38')}];}break;case _0x0c41('0x52'):case _0x0c41('0x53'):case _0x0c41('0x54'):_0x3060d0['childModel']='User';if(_0x8c0358){_0x3060d0[_0x0c41('0x17')]=[{'name':_0x0c41('0x55'),'filter':{'field':'role','value':['admin',_0x0c41('0x56')]},'ignore':!![]},{'name':_0x0c41('0x2f')},{'name':_0x0c41('0x33')}];}break;case'zendeskaccounts':_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x57');break;case'salesforceaccounts':_0x3060d0['childModel']='SalesforceAccount';break;case _0x0c41('0x58'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x59');break;case _0x0c41('0x5a'):_0x3060d0[_0x0c41('0x15')]='SugarcrmAccount';break;case _0x0c41('0x5b'):_0x3060d0['childModel']='DeskAccount';break;case _0x0c41('0x5c'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x5d');break;case'vtigeraccounts':_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x31');break;case _0x0c41('0x5e'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x5f');break;case _0x0c41('0x60'):_0x3060d0[_0x0c41('0x15')]='Disposition';break;case _0x0c41('0x61'):_0x3060d0[_0x0c41('0x15')]='Dashboard';break;case'intervals':_0x3060d0['childModel']=_0x0c41('0x62');break;case _0x0c41('0x63'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x64');break;case _0x0c41('0x65'):_0x3060d0[_0x0c41('0x15')]='Schedule';break;case'sounds':_0x3060d0[_0x0c41('0x15')]='Sound';break;case _0x0c41('0x66'):_0x3060d0['childModel']=_0x0c41('0x67');break;case _0x0c41('0x68'):_0x3060d0['childModel']='Template';break;case _0x0c41('0x69'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x6a');break;case _0x0c41('0x6b'):_0x3060d0[_0x0c41('0x15')]='Trunk';break;case'variables':_0x3060d0['childModel']=_0x0c41('0x6c');break;case _0x0c41('0x6d'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0x6e');break;case _0x0c41('0x6f'):_0x3060d0[_0x0c41('0x15')]=_0x0c41('0xe');_0x3060d0[_0x0c41('0x17')]=[{'name':_0x0c41('0x70'),'field':'id','foreignKey':_0x0c41('0x71')}];break;case _0x0c41('0x72'):_0x3060d0[_0x0c41('0x15')]='AnalyticMetric';break;}return _0x3060d0;}function _0x3ae05f(_0x5de7af,_0x3e3330){var _0x5d9c36=_0x5de7af[_0x0c41('0x73')](0x0)[_0x0c41('0x74')]()+_0x5de7af[_0x0c41('0x75')](0x1);var _0x1bb893={'type':_0x17a1d4[_0x0c41('0x76')][_0x0c41('0x77')][_0x0c41('0x78')],'raw':!![]};return new Promise(function(_0x2ad1c,_0x27f130){var _0x186dab=squel[_0x0c41('0x79')]()[_0x0c41('0x5')](_0x0c41('0x7a')+_0x5d9c36+_0x0c41('0x7b'),'id')[_0x0c41('0x5')](_0x0c41('0x7c'))['from'](_0x0c41('0x7d')+_0x5de7af+'_interactions','ui')[_0x0c41('0x7e')](_0x0c41('0x7f'),_0x3e3330['id']);return _0x17a1d4[_0x0c41('0x80')][_0x0c41('0x81')](_0x186dab[_0x0c41('0x82')](),_0x1bb893)[_0x0c41('0x8')](function(_0x25ca50){_0x3e3330[_0x5d9c36+_0x0c41('0x83')]=_0x25ca50;_0x2ad1c(_0x25ca50);})[_0x0c41('0xb')](function(_0x2a0b12){_0x27f130(_0x2a0b12);});});}return _0x441c7d['define']('UserProfile',attributes,{'tableName':_0x0c41('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x9901cc){var _0x5c102e=require(_0x0c41('0x85'));var _0x51a391={'raw':_0x9901cc[_0x0c41('0x81')][_0x0c41('0x86')],'where':{}};var _0x5afd6b={};var _0x9d009a={'count':0x0,'rows':[]};var _0x2ce47f=_0x9901cc[_0x0c41('0x81')][_0x0c41('0x87')];var _0x4ba7a0=_0x9901cc[_0x0c41('0x81')][_0x0c41('0x88')]||![];var _0x178ef4=_0x5578ea(_0x2ce47f,_0x4ba7a0);if(!_0x178ef4['childModel'])throw new Error(_0x0c41('0x89')+_0x2ce47f+'\x27');var _0x22507a=[{'name':_0x2ce47f}];if(!_[_0x0c41('0x8a')](_0x178ef4[_0x0c41('0x17')]))_0x22507a=_0x178ef4[_0x0c41('0x17')];var _0x431303=[];for(var _0x3c1631=0x0;_0x3c1631<_0x22507a[_0x0c41('0x8b')];_0x3c1631++){_0x431303[_0x0c41('0x8c')](_0x17a1d4[_0x0c41('0x8d')]['find']({'where':{'userProfileId':_0x9901cc['params']['id'],'name':_0x22507a[_0x3c1631][_0x0c41('0xc')]},'raw':!![]}));}return Promise['all'](_0x431303)['then'](function(_0x125e90){var _0x35b6a0=_[_0x0c41('0x4')](_0x125e90,function(_0x526c95){return _0x526c95?_0x526c95:undefined;});var _0x20f88b=_['filter'](_0x22507a,['ignore',!![]]);var _0x567721=_[_0x0c41('0x8a')](_0x35b6a0)&&_[_0x0c41('0x8a')](_0x20f88b)?null:_['union'](_0x20f88b,_0x35b6a0);if(!_0x567721)return null;var _0x29ea37=[];for(var _0x52cbae=0x0;_0x52cbae<_0x567721[_0x0c41('0x8b')];_0x52cbae++){var _0x423837=_[_0x0c41('0x8e')](_0x22507a,function(_0x53a452){return _0x567721[_0x52cbae]?_0x53a452[_0x0c41('0xc')]===_0x567721[_0x52cbae][_0x0c41('0xc')]:null;});if(_0x423837){if(_0x567721[_0x52cbae][_0x0c41('0x8f')]){_0x29ea37['push'](_0x2a216c(_0x178ef4['childModel'],_0x567721[_0x52cbae]));}else{if(!_0x567721[_0x52cbae][_0x0c41('0x90')]){_0x29ea37[_0x0c41('0x8c')](_0x3360ee(_0x423837,_0x567721[_0x52cbae],_0x178ef4[_0x0c41('0x15')]));}else{if(_0x423837[_0x0c41('0x91')]){_0x29ea37['push'](_0x20893b(_0x423837,_0x567721[_0x52cbae]));}}}}}return Promise[_0x0c41('0x92')](_0x29ea37);})['then'](function(_0x137331){var _0x47c077=_0x137331;var _0x59bd12=null;if(_0x47c077){_0x59bd12=_0x47c077[_0x0c41('0x8b')]===0x1?_0x47c077[0x0]:null;}if(!_0x59bd12&&!_0x47c077)return _0x9d009a;var _0x2e0b14=_0x17a1d4[_0x178ef4['childModel']][_0x0c41('0x93')];_0x5afd6b['model']=_[_0x0c41('0x94')](_0x2e0b14);_0x5afd6b[_0x0c41('0x81')]=_[_0x0c41('0x94')](_0x9901cc[_0x0c41('0x81')]);_0x5afd6b[_0x0c41('0x95')]=_[_0x0c41('0x96')](_0x5afd6b['model'],_0x5afd6b['query']);_0x51a391[_0x0c41('0x97')]=_[_0x0c41('0x96')](_0x5afd6b[_0x0c41('0x91')],_0x5c102e[_0x0c41('0x98')](_0x9901cc[_0x0c41('0x81')]['fields']));_0x51a391['attributes']=_0x51a391[_0x0c41('0x97')][_0x0c41('0x8b')]?_0x51a391['attributes']:_0x5afd6b[_0x0c41('0x91')];if(!_0x9901cc[_0x0c41('0x81')][_0x0c41('0x99')]('nolimit')){_0x51a391['limit']=_0x5c102e['limit'](_0x9901cc['query'][_0x0c41('0x9a')]);_0x51a391[_0x0c41('0x9b')]=_0x5c102e[_0x0c41('0x9b')](_0x9901cc[_0x0c41('0x81')][_0x0c41('0x9b')]);}_0x51a391[_0x0c41('0x9c')]=_0x5c102e[_0x0c41('0x9d')](_0x9901cc[_0x0c41('0x81')][_0x0c41('0x9d')]);_0x51a391['where']=_0x5c102e[_0x0c41('0x95')](_['pick'](_0x9901cc[_0x0c41('0x81')],_0x5afd6b['filters']));if(_0x9901cc['query'][_0x0c41('0x4')]){_0x51a391[_0x0c41('0x7e')]=_[_0x0c41('0x9e')](_0x51a391['where'],{'$or':_['map'](_0x2e0b14,function(_0x2949e9){if(_0x2949e9['type'][_0x0c41('0x9f')]!==_0x0c41('0xa0')){var _0x72ae79={};_0x72ae79[_0x2949e9[_0x0c41('0x5')]]={'$like':'%'+_0x9901cc[_0x0c41('0x81')][_0x0c41('0x4')]+'%'};return _0x72ae79;}})});}var _0x2ffbfe=[];var _0x5c2786=null;var _0xbe19e={};if(_0x59bd12){_0x5c2786=_[_0x0c41('0x8e')](_0x22507a,[_0x0c41('0xc'),_0x59bd12[_0x0c41('0xc')]]);if(_0x5c2786[_0x0c41('0x5')]){_0xbe19e={};if(_0x178ef4['childModel']===_0x0c41('0xe')){_0xbe19e[_0x5c2786[_0x0c41('0xa1')]]=_[_0x0c41('0xa')](_0x59bd12['associatedResources'],'id');}else{_0xbe19e[_0x5c2786[_0x0c41('0xa1')]]=_0x59bd12[_0x0c41('0x9')];}_0x2ffbfe[_0x0c41('0x8c')](_0xbe19e);}else{_0x51a391[_0x0c41('0x7e')]['id']=_0x59bd12['associatedResources'];}}else{for(var _0xa2e249=0x0;_0xa2e249<_0x47c077[_0x0c41('0x8b')];_0xa2e249++){_0x5c2786=_[_0x0c41('0x8e')](_0x22507a,[_0x0c41('0xc'),_0x47c077[_0xa2e249][_0x0c41('0xc')]]);if(_0x5c2786[_0x0c41('0x5')]){_0xbe19e={};_0xbe19e[_0x5c2786['foreignKey']]=_0x47c077[_0xa2e249]['associatedResources'];_0x2ffbfe['push'](_0xbe19e);}else{if(!_0x51a391[_0x0c41('0x7e')]['id'])_0x51a391['where']['id']=[];_0x47c077[_0xa2e249][_0x0c41('0x9')]['forEach'](function(_0x3b662d){_0x51a391[_0x0c41('0x7e')]['id'][_0x0c41('0x8c')](_0x3b662d);});}}}if(!_[_0x0c41('0x8a')](_0x2ffbfe)){_0x51a391['where']=_[_0x0c41('0x9e')](_0x51a391[_0x0c41('0x7e')],{'$and':{'$or':_0x2ffbfe}});}_0x51a391=_[_0x0c41('0x9e')]({},_0x51a391,_0x9901cc[_0x0c41('0xa2')]);if(_0x59bd12&&!_0x59bd12[_0x0c41('0x90')]&&_0x178ef4[_0x0c41('0x15')]===_0x0c41('0xe')){if(_0x9901cc['query']['includeAll']){_0x51a391[_0x0c41('0xa3')]=[{'all':!![]}];}return _0x17a1d4[_0x178ef4[_0x0c41('0x15')]][_0x0c41('0x7')](_0x51a391)[_0x0c41('0x8')](function(_0xfbd234){var _0x5af6c5=[];_0xfbd234[_0x0c41('0xa4')](function(_0x32c63){var _0x59778e;switch(_0x32c63[_0x0c41('0xa5')]){case _0x0c41('0xa6'):_0x59778e=_['find'](_0x59bd12[_0x0c41('0x9')],function(_0x7e2ca6){return _0x7e2ca6['id']===_0x32c63[_0x0c41('0x71')]&&_0x7e2ca6[_0x0c41('0xf')]===_0x0c41('0xa7');});break;case'custom':_0x59778e=_[_0x0c41('0x8e')](_0x59bd12[_0x0c41('0x9')],function(_0x1ac7db){return _0x1ac7db['id']===_0x32c63[_0x0c41('0x71')]&&_0x1ac7db[_0x0c41('0xf')]===_0x0c41('0xa8');});break;}if(_0x59778e)_0x5af6c5[_0x0c41('0x8c')](_0x32c63);});_0x9d009a[_0x0c41('0xa9')]=_0x5af6c5[_0x0c41('0x8b')];_0x9d009a['rows']=_0x5af6c5;return _0x9d009a;});}else{if(!_['isEmpty'](_0x9901cc['query'][_0x0c41('0xaa')])){_0x51a391['where']['id']=_0x51a391['where']['id']?_[_0x0c41('0x96')](_0x51a391[_0x0c41('0x7e')]['id'],_0x9901cc[_0x0c41('0x81')][_0x0c41('0xaa')]):_0x9901cc[_0x0c41('0x81')]['ids'];if(_0x9901cc[_0x0c41('0x81')][_0x0c41('0xab')]){_0x51a391[_0x0c41('0x9c')]=_0x9901cc[_0x0c41('0x81')][_0x0c41('0xab')];}}if(_0x9901cc[_0x0c41('0x81')][_0x0c41('0xac')]){_0x51a391[_0x0c41('0x7e')]=_[_0x0c41('0x9e')](_0x51a391[_0x0c41('0x7e')],{'$and':_0x9901cc['query'][_0x0c41('0xac')]});}return _0x17a1d4[_0x178ef4['childModel']][_0x0c41('0xa9')]({'where':_0x51a391[_0x0c41('0x7e')]})[_0x0c41('0x8')](function(_0x294d34){_0x9d009a[_0x0c41('0xa9')]=_0x294d34;if(_0x9901cc[_0x0c41('0x81')][_0x0c41('0xad')]){if(_0x178ef4['childModel']===_0x0c41('0x1b')){_0x51a391[_0x0c41('0xa3')]=[{'model':_0x17a1d4[_0x0c41('0x67')],'as':_0x0c41('0xae'),'attributes':['id',_0x0c41('0xc'),_0x0c41('0xaf')],'required':_0x9901cc['query']['tag']?!![]:![]},{'model':_0x17a1d4[_0x0c41('0x67')],'as':'ThroughTags','attributes':['id',_0x0c41('0xc'),_0x0c41('0xaf')],'through':_0x9901cc[_0x0c41('0x81')][_0x0c41('0xb0')]?{'attributes':[],'where':{'TagId':_0x9901cc[_0x0c41('0x81')]['tag']||undefined}}:{},'required':_0x9901cc[_0x0c41('0x81')][_0x0c41('0xb0')]?!![]:![]}];}else{_0x51a391[_0x0c41('0xa3')]=[{'all':!![]}];}}return _0x17a1d4[_0x178ef4['childModel']][_0x0c41('0x7')](_0x51a391);})[_0x0c41('0x8')](function(_0x5b13de){_0x9d009a[_0x0c41('0xb1')]=_0x5b13de;if(_0x2ce47f===_0x0c41('0x2f')&&_0x9901cc['query'][_0x0c41('0xb2')]===_0x0c41('0xb3')){var _0x40d702=[];for(var _0x3804a4=0x0;_0x3804a4<_0x9d009a[_0x0c41('0xb1')]['length'];_0x3804a4++){_0x40d702[_0x0c41('0x8c')](_0x3ae05f(_0x0c41('0xb4'),_0x9d009a[_0x0c41('0xb1')][_0x3804a4][_0x0c41('0xb5')]));_0x40d702[_0x0c41('0x8c')](_0x3ae05f('sms',_0x9d009a[_0x0c41('0xb1')][_0x3804a4][_0x0c41('0xb5')]));_0x40d702[_0x0c41('0x8c')](_0x3ae05f(_0x0c41('0xb6'),_0x9d009a[_0x0c41('0xb1')][_0x3804a4]['dataValues']));_0x40d702[_0x0c41('0x8c')](_0x3ae05f(_0x0c41('0xb7'),_0x9d009a['rows'][_0x3804a4][_0x0c41('0xb5')]));_0x40d702[_0x0c41('0x8c')](_0x3ae05f(_0x0c41('0xb8'),_0x9d009a[_0x0c41('0xb1')][_0x3804a4]['dataValues']));_0x40d702[_0x0c41('0x8c')](_0x3ae05f(_0x0c41('0xb9'),_0x9d009a[_0x0c41('0xb1')][_0x3804a4][_0x0c41('0xb5')]));}return Promise[_0x0c41('0x92')](_0x40d702)[_0x0c41('0x8')](function(){return _0x9d009a;});}return _0x9d009a;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 6edd9c0..9e70412 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 _0xd959=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x158194,_0x5e0742){var _0x20e23d=function(_0x2662de){while(--_0x2662de){_0x158194['push'](_0x158194['shift']());}};_0x20e23d(++_0x5e0742);}(_0xd959,0x94));var _0x9d95=function(_0x47ebd1,_0x31e4c4){_0x47ebd1=_0x47ebd1-0x0;var _0x193d0e=_0xd959[_0x47ebd1];return _0x193d0e;};'use strict';var _=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var moment=require(_0x9d95('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d95('0x3'));var fs=require('fs');var Redis=require(_0x9d95('0x4'));var db=require(_0x9d95('0x5'))['db'];var utils=require(_0x9d95('0x6'));var logger=require(_0x9d95('0x7'))('rpc');var config=require(_0x9d95('0x8'));var jayson=require(_0x9d95('0x9'));var client=jayson[_0x9d95('0xa')][_0x9d95('0xb')]({'port':0x232a});config['redis']=_[_0x9d95('0xc')](config[_0x9d95('0xd')],{'host':_0x9d95('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d95('0xd')]));require('./userProfile.socket')[_0x9d95('0xf')](socket);function respondWithRpcPromise(_0x1825b5,_0x4fa7d0,_0x18e15f){return new BPromise(function(_0x2d2e0a,_0x554f40){return client[_0x9d95('0x10')](_0x1825b5,_0x18e15f)[_0x9d95('0x11')](function(_0x4f462e){logger[_0x9d95('0x12')](_0x9d95('0x13'),_0x4fa7d0,'request\x20sent');logger[_0x9d95('0x14')](_0x9d95('0x15'),_0x4fa7d0,_0x9d95('0x16'),JSON[_0x9d95('0x17')](_0x4f462e));if(_0x4f462e['error']){if(_0x4f462e[_0x9d95('0x18')][_0x9d95('0x19')]===0x1f4){logger['error'](_0x9d95('0x13'),_0x4fa7d0,_0x4f462e[_0x9d95('0x18')][_0x9d95('0x1a')]);return _0x554f40(_0x4f462e['error'][_0x9d95('0x1a')]);}logger['error'](_0x9d95('0x13'),_0x4fa7d0,_0x4f462e[_0x9d95('0x18')][_0x9d95('0x1a')]);return _0x2d2e0a(_0x4f462e['error'][_0x9d95('0x1a')]);}else{logger['info'](_0x9d95('0x13'),_0x4fa7d0,_0x9d95('0x16'));_0x2d2e0a(_0x4f462e[_0x9d95('0x1b')][_0x9d95('0x1a')]);}})[_0x9d95('0x1c')](function(_0x5a2a22){logger[_0x9d95('0x18')]('UserProfile,\x20%s,\x20%s',_0x4fa7d0,_0x5a2a22);_0x554f40(_0x5a2a22);});});} \ No newline at end of file +var _0x63d4=['../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63d4,0x117));var _0x463d=function(_0xcd3023,_0x43dd27){_0xcd3023=_0xcd3023-0x0;var _0x149e1e=_0x63d4[_0xcd3023];return _0x149e1e;};'use strict';var _=require(_0x463d('0x0'));var util=require(_0x463d('0x1'));var moment=require(_0x463d('0x2'));var BPromise=require('bluebird');var rs=require(_0x463d('0x3'));var fs=require('fs');var Redis=require(_0x463d('0x4'));var db=require(_0x463d('0x5'))['db'];var utils=require(_0x463d('0x6'));var logger=require(_0x463d('0x7'))('rpc');var config=require(_0x463d('0x8'));var jayson=require(_0x463d('0x9'));var client=jayson['client'][_0x463d('0xa')]({'port':0x232a});config[_0x463d('0xb')]=_[_0x463d('0xc')](config[_0x463d('0xb')],{'host':_0x463d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x463d('0xb')]));require('./userProfile.socket')[_0x463d('0xe')](socket);function respondWithRpcPromise(_0x2d714b,_0x1f5d4a,_0xecad46){return new BPromise(function(_0x4c7bcc,_0x4c7afd){return client[_0x463d('0xf')](_0x2d714b,_0xecad46)['then'](function(_0x39d97c){logger[_0x463d('0x10')](_0x463d('0x11'),_0x1f5d4a,_0x463d('0x12'));logger[_0x463d('0x13')](_0x463d('0x14'),_0x1f5d4a,_0x463d('0x12'),JSON['stringify'](_0x39d97c));if(_0x39d97c[_0x463d('0x15')]){if(_0x39d97c[_0x463d('0x15')][_0x463d('0x16')]===0x1f4){logger['error'](_0x463d('0x11'),_0x1f5d4a,_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);return _0x4c7afd(_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);}logger[_0x463d('0x15')]('UserProfile,\x20%s,\x20%s',_0x1f5d4a,_0x39d97c[_0x463d('0x15')]['message']);return _0x4c7bcc(_0x39d97c[_0x463d('0x15')][_0x463d('0x17')]);}else{logger[_0x463d('0x10')](_0x463d('0x11'),_0x1f5d4a,_0x463d('0x12'));_0x4c7bcc(_0x39d97c[_0x463d('0x18')]['message']);}})[_0x463d('0x19')](function(_0x1091ac){logger[_0x463d('0x15')](_0x463d('0x11'),_0x1f5d4a,_0x1091ac);_0x4c7afd(_0x1091ac);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 91ec428..3a8984e 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 _0x2088=['update','emit','removeListener','register','length','userProfile:','./userProfile.events','save','remove'];(function(_0x255e96,_0x347006){var _0x524913=function(_0x57142e){while(--_0x57142e){_0x255e96['push'](_0x255e96['shift']());}};_0x524913(++_0x347006);}(_0x2088,0x8d));var _0x8208=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0x2088[_0x4e55a9];return _0x4a9b67;};'use strict';var UserProfileEvents=require(_0x8208('0x0'));var events=[_0x8208('0x1'),_0x8208('0x2'),_0x8208('0x3')];function createListener(_0x5ef6f5,_0x3dc0ff){return function(_0x3dec72){_0x3dc0ff[_0x8208('0x4')](_0x5ef6f5,_0x3dec72);};}function removeListener(_0x1005e4,_0x5a7d8d){return function(){UserProfileEvents[_0x8208('0x5')](_0x1005e4,_0x5a7d8d);};}exports[_0x8208('0x6')]=function(_0x142b4a){for(var _0x537fbe=0x0,_0x5621cd=events[_0x8208('0x7')];_0x537fbe<_0x5621cd;_0x537fbe++){var _0x20ee4a=events[_0x537fbe];var _0x574fc2=createListener(_0x8208('0x8')+_0x20ee4a,_0x142b4a);UserProfileEvents['on'](_0x20ee4a,_0x574fc2);}}; \ No newline at end of file +var _0x70ee=['save','update','removeListener','register','userProfile:','./userProfile.events'];(function(_0x344887,_0x10da81){var _0x15304c=function(_0x482442){while(--_0x482442){_0x344887['push'](_0x344887['shift']());}};_0x15304c(++_0x10da81);}(_0x70ee,0x119));var _0xe70e=function(_0x5dd703,_0x7fe88c){_0x5dd703=_0x5dd703-0x0;var _0x557f8e=_0x70ee[_0x5dd703];return _0x557f8e;};'use strict';var UserProfileEvents=require(_0xe70e('0x0'));var events=[_0xe70e('0x1'),'remove',_0xe70e('0x2')];function createListener(_0x4e6e82,_0x22e0f5){return function(_0x5b00fb){_0x22e0f5['emit'](_0x4e6e82,_0x5b00fb);};}function removeListener(_0x13f0e5,_0x1efc2e){return function(){UserProfileEvents[_0xe70e('0x3')](_0x13f0e5,_0x1efc2e);};}exports[_0xe70e('0x4')]=function(_0x5c867d){for(var _0x582da6=0x0,_0x49f5e0=events['length'];_0x582da6<_0x49f5e0;_0x582da6++){var _0x9a458=events[_0x582da6];var _0xf7c47a=createListener(_0xe70e('0x5')+_0x9a458,_0x5c867d);UserProfileEvents['on'](_0x9a458,_0xf7c47a);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 1955baa..7cb82e3 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 _0x762a=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x34823e,_0x15fae7){var _0x154587=function(_0x399166){while(--_0x399166){_0x34823e['push'](_0x34823e['shift']());}};_0x154587(++_0x15fae7);}(_0x762a,0x103));var _0xa762=function(_0x102f8a,_0xf93ccc){_0x102f8a=_0x102f8a-0x0;var _0x1c4db4=_0x762a[_0x102f8a];return _0x1c4db4;};'use strict';var multer=require(_0xa762('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa762('0x1'));var express=require(_0xa762('0x2'));var router=express[_0xa762('0x3')]();var fs_extra=require(_0xa762('0x4'));var auth=require(_0xa762('0x5'));var interaction=require(_0xa762('0x6'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xa762('0x7')]('/',auth[_0xa762('0x8')](),controller[_0xa762('0x9')]);router[_0xa762('0x7')](_0xa762('0xa'),auth[_0xa762('0x8')](),controller[_0xa762('0xb')]);router[_0xa762('0x7')](_0xa762('0xc'),auth['isAuthenticated'](),controller[_0xa762('0xd')]);router['post']('/',auth[_0xa762('0x8')](),controller[_0xa762('0xe')]);router[_0xa762('0xf')](_0xa762('0xc'),auth[_0xa762('0x8')](),controller['update']);router[_0xa762('0x10')]('/:id',auth[_0xa762('0x8')](),controller[_0xa762('0x11')]);module[_0xa762('0x12')]=router; \ No newline at end of file +var _0x3a26=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x317d4c,_0x391e9d){var _0x433884=function(_0x366dd4){while(--_0x366dd4){_0x317d4c['push'](_0x317d4c['shift']());}};_0x433884(++_0x391e9d);}(_0x3a26,0xe6));var _0x63a2=function(_0x446f94,_0x38f850){_0x446f94=_0x446f94-0x0;var _0x5a8521=_0x3a26[_0x446f94];return _0x5a8521;};'use strict';var multer=require(_0x63a2('0x0'));var util=require(_0x63a2('0x1'));var path=require(_0x63a2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x63a2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x63a2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x63a2('0x5'));var controller=require(_0x63a2('0x6'));router[_0x63a2('0x7')]('/',auth['isAuthenticated'](),controller[_0x63a2('0x8')]);router[_0x63a2('0x7')](_0x63a2('0x9'),auth[_0x63a2('0xa')](),controller[_0x63a2('0xb')]);router[_0x63a2('0x7')](_0x63a2('0xc'),auth[_0x63a2('0xa')](),controller[_0x63a2('0xd')]);router[_0x63a2('0xe')]('/',auth[_0x63a2('0xa')](),controller['create']);router[_0x63a2('0xf')](_0x63a2('0xc'),auth[_0x63a2('0xa')](),controller[_0x63a2('0x10')]);router['delete']('/:id',auth[_0x63a2('0xa')](),controller[_0x63a2('0x11')]);module[_0x63a2('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 0a361fe..c47db3d 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 _0x35ab=['STRING','sequelize','exports','INTEGER'];(function(_0x499210,_0x325b29){var _0x2e153d=function(_0x951263){while(--_0x951263){_0x499210['push'](_0x499210['shift']());}};_0x2e153d(++_0x325b29);}(_0x35ab,0xf9));var _0xb35a=function(_0x1481ad,_0x2d3888){_0x1481ad=_0x1481ad-0x0;var _0x5ef3cb=_0x35ab[_0x1481ad];return _0x5ef3cb;};'use strict';var Sequelize=require(_0xb35a('0x0'));module[_0xb35a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb35a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb35a('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x03e9=['exports','STRING','INTEGER'];(function(_0x3c714b,_0x1b1d23){var _0x95c9bf=function(_0x134d28){while(--_0x134d28){_0x3c714b['push'](_0x3c714b['shift']());}};_0x95c9bf(++_0x1b1d23);}(_0x03e9,0x78));var _0x903e=function(_0x394541,_0x54cf03){_0x394541=_0x394541-0x0;var _0x3e7037=_0x03e9[_0x394541];return _0x3e7037;};'use strict';var Sequelize=require('sequelize');module[_0x903e('0x0')]={'name':{'type':Sequelize[_0x903e('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x903e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x903e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index d9fe452..07a2f13 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 _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileResource','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0xd9e7cf,_0x5abb52){var _0x28d02d=function(_0x367d16){while(--_0x367d16){_0xd9e7cf['push'](_0xd9e7cf['shift']());}};_0x28d02d(++_0x5abb52);}(_0xef0f,0x168));var _0xfef0=function(_0x10d767,_0x110bca){_0x10d767=_0x10d767-0x0;var _0x28c5a5=_0xef0f[_0x10d767];return _0x28c5a5;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['UserProfileResource']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file +var _0x66fa=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','UserProfileResource','findAll','rows','catch','merge','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x66fa,0x117));var _0xa66f=function(_0x34f867,_0x33b604){_0x34f867=_0x34f867-0x0;var _0x372b96=_0x66fa[_0x34f867];return _0x372b96;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['UserProfileResource'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['UserProfileResource'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['UserProfileResource'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['UserProfileResource'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));};exports[_0xa66f('0x4a')]=function(_0x5d77d1,_0x389b9a){return db['UserProfileResource'][_0xa66f('0x4a')]()['then'](respondWithResult(_0x389b9a,null))['catch'](handleError(_0x389b9a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index bafa651..43b52b4 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 _0x764d=['UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','api','moment','bluebird','../../config/environment','./userProfileResource.attributes','define'];(function(_0x460358,_0x45d45e){var _0x2e6a60=function(_0xc3135a){while(--_0xc3135a){_0x460358['push'](_0x460358['shift']());}};_0x2e6a60(++_0x45d45e);}(_0x764d,0xef));var _0xd764=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0x764d[_0x2b0bc2];return _0x56e5b9;};'use strict';var _=require(_0xd764('0x0'));var util=require(_0xd764('0x1'));var logger=require('../../config/logger')(_0xd764('0x2'));var moment=require(_0xd764('0x3'));var BPromise=require(_0xd764('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd764('0x5'));var attributes=require(_0xd764('0x6'));module['exports']=function(_0x13214a,_0x2c9b50){return _0x13214a[_0xd764('0x7')](_0xd764('0x8'),attributes,{'tableName':_0xd764('0x9'),'paranoid':![],'indexes':[{'name':_0xd764('0xa'),'fields':[_0xd764('0xb'),_0xd764('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb78=['bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','moment'];(function(_0x44980e,_0x121d83){var _0x4c8fae=function(_0x295bb6){while(--_0x295bb6){_0x44980e['push'](_0x44980e['shift']());}};_0x4c8fae(++_0x121d83);}(_0xeb78,0x1bf));var _0x8eb7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeb78[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8eb7('0x0'));var logger=require(_0x8eb7('0x1'))('api');var moment=require(_0x8eb7('0x2'));var BPromise=require(_0x8eb7('0x3'));var rp=require(_0x8eb7('0x4'));var fs=require('fs');var path=require(_0x8eb7('0x5'));var rimraf=require(_0x8eb7('0x6'));var config=require('../../config/environment');var attributes=require(_0x8eb7('0x7'));module[_0x8eb7('0x8')]=function(_0x1e8aed,_0x54bd09){return _0x1e8aed[_0x8eb7('0x9')](_0x8eb7('0xa'),attributes,{'tableName':_0x8eb7('0xb'),'paranoid':![],'indexes':[{'name':_0x8eb7('0xc'),'fields':[_0x8eb7('0xd'),_0x8eb7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 9540a46..a6a707c 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 _0x7d6f=['UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserProfileResource,\x20%s,\x20%s','debug'];(function(_0x4f2806,_0x52841f){var _0x45419a=function(_0x3ebb28){while(--_0x3ebb28){_0x4f2806['push'](_0x4f2806['shift']());}};_0x45419a(++_0x52841f);}(_0x7d6f,0xf9));var _0xf7d6=function(_0x12d6e6,_0x1ea259){_0x12d6e6=_0x12d6e6-0x0;var _0x540065=_0x7d6f[_0x12d6e6];return _0x540065;};'use strict';var _=require(_0xf7d6('0x0'));var util=require('util');var moment=require(_0xf7d6('0x1'));var BPromise=require(_0xf7d6('0x2'));var rs=require(_0xf7d6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7d6('0x4'))['db'];var utils=require(_0xf7d6('0x5'));var logger=require(_0xf7d6('0x6'))(_0xf7d6('0x7'));var config=require(_0xf7d6('0x8'));var jayson=require(_0xf7d6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1173d8,_0x1198c3,_0x2f7ff0){return new BPromise(function(_0x57ee65,_0x3bb1f6){return client[_0xf7d6('0xa')](_0x1173d8,_0x2f7ff0)[_0xf7d6('0xb')](function(_0x320f14){logger[_0xf7d6('0xc')](_0xf7d6('0xd'),_0x1198c3,'request\x20sent');logger[_0xf7d6('0xe')](_0xf7d6('0xf'),_0x1198c3,_0xf7d6('0x10'),JSON[_0xf7d6('0x11')](_0x320f14));if(_0x320f14['error']){if(_0x320f14[_0xf7d6('0x12')]['code']===0x1f4){logger[_0xf7d6('0x12')](_0xf7d6('0xd'),_0x1198c3,_0x320f14['error'][_0xf7d6('0x13')]);return _0x3bb1f6(_0x320f14['error'][_0xf7d6('0x13')]);}logger[_0xf7d6('0x12')](_0xf7d6('0xd'),_0x1198c3,_0x320f14[_0xf7d6('0x12')]['message']);return _0x57ee65(_0x320f14[_0xf7d6('0x12')][_0xf7d6('0x13')]);}else{logger[_0xf7d6('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x1198c3,_0xf7d6('0x10'));_0x57ee65(_0x320f14[_0xf7d6('0x14')]['message']);}})[_0xf7d6('0x15')](function(_0x390604){logger['error'](_0xf7d6('0xd'),_0x1198c3,_0x390604);_0x3bb1f6(_0x390604);});});} \ No newline at end of file +var _0x3436=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x593b33,_0x1ea034){var _0x2f17a2=function(_0x2dbb16){while(--_0x2dbb16){_0x593b33['push'](_0x593b33['shift']());}};_0x2f17a2(++_0x1ea034);}(_0x3436,0x19a));var _0x6343=function(_0x3ff6e1,_0x51a8d6){_0x3ff6e1=_0x3ff6e1-0x0;var _0x5da9c0=_0x3436[_0x3ff6e1];return _0x5da9c0;};'use strict';var _=require(_0x6343('0x0'));var util=require(_0x6343('0x1'));var moment=require(_0x6343('0x2'));var BPromise=require(_0x6343('0x3'));var rs=require(_0x6343('0x4'));var fs=require('fs');var Redis=require(_0x6343('0x5'));var db=require(_0x6343('0x6'))['db'];var utils=require(_0x6343('0x7'));var logger=require(_0x6343('0x8'))(_0x6343('0x9'));var config=require('../../config/environment');var jayson=require(_0x6343('0xa'));var client=jayson['client'][_0x6343('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c04df,_0xaa5fa9,_0x3c09b4){return new BPromise(function(_0x15d11f,_0xbf9db6){return client[_0x6343('0xc')](_0x3c04df,_0x3c09b4)['then'](function(_0x23ae12){logger[_0x6343('0xd')](_0x6343('0xe'),_0xaa5fa9,'request\x20sent');logger[_0x6343('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0xaa5fa9,_0x6343('0x10'),JSON[_0x6343('0x11')](_0x23ae12));if(_0x23ae12[_0x6343('0x12')]){if(_0x23ae12['error'][_0x6343('0x13')]===0x1f4){logger['error'](_0x6343('0xe'),_0xaa5fa9,_0x23ae12[_0x6343('0x12')]['message']);return _0xbf9db6(_0x23ae12[_0x6343('0x12')][_0x6343('0x14')]);}logger[_0x6343('0x12')]('UserProfileResource,\x20%s,\x20%s',_0xaa5fa9,_0x23ae12[_0x6343('0x12')][_0x6343('0x14')]);return _0x15d11f(_0x23ae12[_0x6343('0x12')][_0x6343('0x14')]);}else{logger[_0x6343('0xd')](_0x6343('0xe'),_0xaa5fa9,_0x6343('0x10'));_0x15d11f(_0x23ae12[_0x6343('0x15')][_0x6343('0x14')]);}})[_0x6343('0x16')](function(_0x1572c5){logger['error'](_0x6343('0xe'),_0xaa5fa9,_0x1572c5);_0xbf9db6(_0x1572c5);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8d42212..a3d8dd2 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 _0x98c8=['/describe','describe','/:id','create','update','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0x98c8,0x1e3));var _0x898c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x98c8[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x898c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x898c('0x1'));var router=express[_0x898c('0x2')]();var fs_extra=require(_0x898c('0x3'));var auth=require(_0x898c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x898c('0x5'));var controller=require(_0x898c('0x6'));router[_0x898c('0x7')]('/',auth[_0x898c('0x8')](),controller[_0x898c('0x9')]);router['get'](_0x898c('0xa'),auth['isAuthenticated'](),controller[_0x898c('0xb')]);router['get'](_0x898c('0xc'),auth[_0x898c('0x8')](),controller['show']);router['post']('/',auth[_0x898c('0x8')](),controller[_0x898c('0xd')]);router['put'](_0x898c('0xc'),auth[_0x898c('0x8')](),controller[_0x898c('0xe')]);router['delete'](_0x898c('0xc'),auth[_0x898c('0x8')](),controller[_0x898c('0xf')]);module[_0x898c('0x10')]=router; \ No newline at end of file +var _0x7e8f=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','post','put'];(function(_0xb01321,_0x5c6674){var _0x16bb75=function(_0x34644f){while(--_0x34644f){_0xb01321['push'](_0xb01321['shift']());}};_0x16bb75(++_0x5c6674);}(_0x7e8f,0x18f));var _0xf7e8=function(_0x30e085,_0x29c806){_0x30e085=_0x30e085-0x0;var _0x459d25=_0x7e8f[_0x30e085];return _0x459d25;};'use strict';var multer=require(_0xf7e8('0x0'));var util=require(_0xf7e8('0x1'));var path=require(_0xf7e8('0x2'));var timeout=require(_0xf7e8('0x3'));var express=require(_0xf7e8('0x4'));var router=express[_0xf7e8('0x5')]();var fs_extra=require(_0xf7e8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf7e8('0x7'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xf7e8('0x8')]('/',auth[_0xf7e8('0x9')](),controller['index']);router[_0xf7e8('0x8')](_0xf7e8('0xa'),auth[_0xf7e8('0x9')](),controller[_0xf7e8('0xb')]);router[_0xf7e8('0x8')](_0xf7e8('0xc'),auth[_0xf7e8('0x9')](),controller['show']);router[_0xf7e8('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf7e8('0xe')](_0xf7e8('0xc'),auth[_0xf7e8('0x9')](),controller['update']);router[_0xf7e8('0xf')](_0xf7e8('0xc'),auth[_0xf7e8('0x9')](),controller[_0xf7e8('0x10')]);module[_0xf7e8('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 7083988..1fbac39 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 _0x3266=['getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','crudPermissions'];(function(_0x59a0f0,_0x2e37ae){var _0x184a22=function(_0x2cac42){while(--_0x2cac42){_0x59a0f0['push'](_0x59a0f0['shift']());}};_0x184a22(++_0x2e37ae);}(_0x3266,0x6a));var _0x6326=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x3266[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'name':{'type':Sequelize[_0x6326('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x6326('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x6326('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x6326('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x6326('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x6326('0x2')],'set':function(_0x265264){this['setDataValue'](_0x6326('0x5'),_0x265264?_0x265264['join'](''):[]);},'get':function(){return this[_0x6326('0x6')](_0x6326('0x5'))?this[_0x6326('0x6')]('crudPermissions')[_0x6326('0x7')](''):[];}}}; \ No newline at end of file +var _0xb10b=['split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xb10b,0x12a));var _0xbb10=function(_0x487d56,_0x1d4a80){_0x487d56=_0x487d56-0x0;var _0x3f409f=_0xb10b[_0x487d56];return _0x3f409f;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbb10('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbb10('0x1')],'set':function(_0x460981){this[_0xbb10('0x4')](_0xbb10('0x5'),_0x460981?_0x460981[_0xbb10('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xbb10('0x5'))?this[_0xbb10('0x7')]('crudPermissions')[_0xbb10('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 886abbc..11468d2 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 _0xf7f8=['map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','send','index','UserProfileSection','rawAttributes','fieldName','key','model'];(function(_0x127bf0,_0x30342c){var _0x4d87e8=function(_0x429f79){while(--_0x429f79){_0x127bf0['push'](_0x127bf0['shift']());}};_0x4d87e8(++_0x30342c);}(_0xf7f8,0xbe));var _0x8f7f=function(_0x2b94c6,_0x31e77b){_0x2b94c6=_0x2b94c6-0x0;var _0x1f368c=_0xf7f8[_0x2b94c6];return _0x1f368c;};'use strict';var emlformat=require(_0x8f7f('0x0'));var rimraf=require(_0x8f7f('0x1'));var zipdir=require(_0x8f7f('0x2'));var jsonpatch=require(_0x8f7f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8f7f('0x4'));var Mustache=require(_0x8f7f('0x5'));var util=require(_0x8f7f('0x6'));var path=require(_0x8f7f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8f7f('0x8'));var fs=require('fs');var fs_extra=require(_0x8f7f('0x9'));var _=require(_0x8f7f('0xa'));var squel=require(_0x8f7f('0xb'));var crypto=require(_0x8f7f('0xc'));var jsforce=require(_0x8f7f('0xd'));var deskjs=require(_0x8f7f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8f7f('0xf'));var Papa=require('papaparse');var Redis=require(_0x8f7f('0x10'));var authService=require(_0x8f7f('0x11'));var qs=require(_0x8f7f('0x12'));var as=require(_0x8f7f('0x13'));var hardwareService=require(_0x8f7f('0x14'));var logger=require(_0x8f7f('0x15'))(_0x8f7f('0x16'));var utils=require(_0x8f7f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8f7f('0x18'));var db=require(_0x8f7f('0x19'))['db'];function respondWithStatusCode(_0x598387,_0x3e3511){_0x3e3511=_0x3e3511||0xcc;return function(_0x100456){if(_0x100456){return _0x598387[_0x8f7f('0x1a')](_0x3e3511);}return _0x598387[_0x8f7f('0x1b')](_0x3e3511)['end']();};}function respondWithResult(_0x3bfb06,_0x22165c){_0x22165c=_0x22165c||0xc8;return function(_0x4e15a0){if(_0x4e15a0){return _0x3bfb06[_0x8f7f('0x1b')](_0x22165c)[_0x8f7f('0x1c')](_0x4e15a0);}};}function respondWithFilteredResult(_0x16c8db,_0x3a5bc0){return function(_0x3e02a8){if(_0x3e02a8){var _0x1e52bd=typeof _0x3a5bc0[_0x8f7f('0x1d')]===_0x8f7f('0x1e')&&typeof _0x3a5bc0[_0x8f7f('0x1f')]===_0x8f7f('0x1e');var _0x18e8bc=_0x3e02a8[_0x8f7f('0x20')];var _0x86647d=_0x1e52bd?0x0:_0x3a5bc0[_0x8f7f('0x1d')];var _0xa56b67=_0x1e52bd?_0x3e02a8[_0x8f7f('0x20')]:_0x3a5bc0[_0x8f7f('0x1d')]+_0x3a5bc0['limit'];var _0x1f5916;if(_0xa56b67>=_0x18e8bc){_0xa56b67=_0x18e8bc;_0x1f5916=0xc8;}else{_0x1f5916=0xce;}_0x16c8db['status'](_0x1f5916);return _0x16c8db[_0x8f7f('0x21')](_0x8f7f('0x22'),_0x86647d+'-'+_0xa56b67+'/'+_0x18e8bc)[_0x8f7f('0x1c')](_0x3e02a8);}return null;};}function patchUpdates(_0x4db8cd){return function(_0x46cd34){try{jsonpatch[_0x8f7f('0x23')](_0x46cd34,_0x4db8cd,!![]);}catch(_0x3fab4d){return BPromise[_0x8f7f('0x24')](_0x3fab4d);}return _0x46cd34['save']();};}function saveUpdates(_0x2d029f,_0x5a334d){return function(_0xce968a){if(_0xce968a){return _0xce968a[_0x8f7f('0x25')](_0x2d029f)[_0x8f7f('0x26')](function(_0x4543a3){return _0x4543a3;});}return null;};}function removeEntity(_0x2572c7,_0x2cf4f9){return function(_0x47ceaa){if(_0x47ceaa){return _0x47ceaa[_0x8f7f('0x27')]()['then'](function(){_0x2572c7[_0x8f7f('0x1b')](0xcc)[_0x8f7f('0x28')]();});}};}function handleEntityNotFound(_0x16bf11,_0x4a2c3c){return function(_0xfd3322){if(!_0xfd3322){_0x16bf11[_0x8f7f('0x1a')](0x194);}return _0xfd3322;};}function handleError(_0x1ab561,_0x28c341){_0x28c341=_0x28c341||0x1f4;return function(_0x4462db){logger[_0x8f7f('0x29')](_0x4462db[_0x8f7f('0x2a')]);if(_0x4462db['name']){delete _0x4462db['name'];}_0x1ab561[_0x8f7f('0x1b')](_0x28c341)[_0x8f7f('0x2b')](_0x4462db);};}exports[_0x8f7f('0x2c')]=function(_0x232d90,_0x3e547d){var _0x20ce05={},_0x424184={},_0x5586d5={'count':0x0,'rows':[]};var _0x20b10a=_['map'](db[_0x8f7f('0x2d')][_0x8f7f('0x2e')],function(_0x47fff2){return{'name':_0x47fff2[_0x8f7f('0x2f')],'type':_0x47fff2['type'][_0x8f7f('0x30')]};});_0x424184[_0x8f7f('0x31')]=_[_0x8f7f('0x32')](_0x20b10a,_0x8f7f('0x33'));_0x424184[_0x8f7f('0x34')]=_[_0x8f7f('0x35')](_0x232d90[_0x8f7f('0x34')]);_0x424184[_0x8f7f('0x36')]=_[_0x8f7f('0x37')](_0x424184[_0x8f7f('0x31')],_0x424184[_0x8f7f('0x34')]);_0x20ce05[_0x8f7f('0x38')]=_['intersection'](_0x424184[_0x8f7f('0x31')],qs[_0x8f7f('0x39')](_0x232d90['query'][_0x8f7f('0x39')]));_0x20ce05[_0x8f7f('0x38')]=_0x20ce05[_0x8f7f('0x38')][_0x8f7f('0x3a')]?_0x20ce05[_0x8f7f('0x38')]:_0x424184['model'];if(!_0x232d90['query'][_0x8f7f('0x3b')](_0x8f7f('0x3c'))){_0x20ce05[_0x8f7f('0x1f')]=qs[_0x8f7f('0x1f')](_0x232d90['query'][_0x8f7f('0x1f')]);_0x20ce05[_0x8f7f('0x1d')]=qs['offset'](_0x232d90[_0x8f7f('0x34')][_0x8f7f('0x1d')]);}_0x20ce05['order']=qs[_0x8f7f('0x3d')](_0x232d90[_0x8f7f('0x34')][_0x8f7f('0x3d')]);_0x20ce05[_0x8f7f('0x3e')]=qs['filters'](_[_0x8f7f('0x3f')](_0x232d90['query'],_0x424184[_0x8f7f('0x36')]),_0x20b10a);if(_0x232d90[_0x8f7f('0x34')][_0x8f7f('0x40')]){_0x20ce05[_0x8f7f('0x3e')]=_['merge'](_0x20ce05[_0x8f7f('0x3e')],{'$or':_[_0x8f7f('0x32')](_0x20b10a,function(_0x3f950f){if(_0x3f950f[_0x8f7f('0x41')]!==_0x8f7f('0x42')){var _0x4e0b9a={};_0x4e0b9a[_0x3f950f[_0x8f7f('0x33')]]={'$like':'%'+_0x232d90[_0x8f7f('0x34')][_0x8f7f('0x40')]+'%'};return _0x4e0b9a;}})});}_0x20ce05=_[_0x8f7f('0x43')]({},_0x20ce05,_0x232d90[_0x8f7f('0x44')]);var _0x2ba908={'where':_0x20ce05['where']};return db[_0x8f7f('0x2d')][_0x8f7f('0x20')](_0x2ba908)['then'](function(_0x57fd9d){_0x5586d5[_0x8f7f('0x20')]=_0x57fd9d;if(_0x232d90['query'][_0x8f7f('0x45')]){_0x20ce05[_0x8f7f('0x46')]=[{'all':!![]}];}return db[_0x8f7f('0x2d')][_0x8f7f('0x47')](_0x20ce05);})['then'](function(_0x40706f){_0x5586d5[_0x8f7f('0x48')]=_0x40706f;return _0x5586d5;})[_0x8f7f('0x26')](respondWithFilteredResult(_0x3e547d,_0x20ce05))[_0x8f7f('0x49')](handleError(_0x3e547d,null));};exports[_0x8f7f('0x4a')]=function(_0x21467c,_0x41f4e6){var _0x59202c={'raw':![],'where':{'id':_0x21467c[_0x8f7f('0x4b')]['id']}},_0x5abc34={};_0x5abc34[_0x8f7f('0x31')]=_[_0x8f7f('0x35')](db[_0x8f7f('0x2d')]['rawAttributes']);_0x5abc34['query']=_[_0x8f7f('0x35')](_0x21467c['query']);_0x5abc34['filters']=_['intersection'](_0x5abc34[_0x8f7f('0x31')],_0x5abc34['query']);_0x59202c[_0x8f7f('0x38')]=_[_0x8f7f('0x37')](_0x5abc34[_0x8f7f('0x31')],qs['fields'](_0x21467c['query'][_0x8f7f('0x39')]));_0x59202c[_0x8f7f('0x38')]=_0x59202c['attributes'][_0x8f7f('0x3a')]?_0x59202c[_0x8f7f('0x38')]:_0x5abc34['model'];if(_0x21467c['query']['includeAll']){_0x59202c[_0x8f7f('0x46')]=[{'all':!![]}];}_0x59202c=_[_0x8f7f('0x43')]({},_0x59202c,_0x21467c[_0x8f7f('0x44')]);return db[_0x8f7f('0x2d')][_0x8f7f('0x4c')](_0x59202c)[_0x8f7f('0x26')](handleEntityNotFound(_0x41f4e6,null))[_0x8f7f('0x26')](respondWithResult(_0x41f4e6,null))['catch'](handleError(_0x41f4e6,null));};exports[_0x8f7f('0x4d')]=function(_0x361faf,_0x3ff97d){return db[_0x8f7f('0x2d')][_0x8f7f('0x4d')](_0x361faf[_0x8f7f('0x4e')],{})['then'](respondWithResult(_0x3ff97d,0xc9))[_0x8f7f('0x49')](handleError(_0x3ff97d,null));};exports[_0x8f7f('0x25')]=function(_0x2f9506,_0x577783){if(_0x2f9506[_0x8f7f('0x4e')]['id']){delete _0x2f9506[_0x8f7f('0x4e')]['id'];}return db[_0x8f7f('0x2d')][_0x8f7f('0x4c')]({'where':{'id':_0x2f9506['params']['id']}})['then'](handleEntityNotFound(_0x577783,null))[_0x8f7f('0x26')](saveUpdates(_0x2f9506[_0x8f7f('0x4e')],null))[_0x8f7f('0x26')](respondWithResult(_0x577783,null))[_0x8f7f('0x49')](handleError(_0x577783,null));};exports[_0x8f7f('0x27')]=function(_0x574d42,_0x2821c0){return db['UserProfileSection'][_0x8f7f('0x4c')]({'where':{'id':_0x574d42[_0x8f7f('0x4b')]['id']}})[_0x8f7f('0x26')](handleEntityNotFound(_0x2821c0,null))[_0x8f7f('0x26')](removeEntity(_0x2821c0,null))[_0x8f7f('0x49')](handleError(_0x2821c0,null));};exports['describe']=function(_0xb71346,_0x1085a2){return db['UserProfileSection'][_0x8f7f('0x4f')]()[_0x8f7f('0x26')](respondWithResult(_0x1085a2,null))['catch'](handleError(_0x1085a2,null));}; \ No newline at end of file +var _0x61b5=['find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','sendStatus','error','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','params','includeAll','include'];(function(_0x5dd5c6,_0x3e1a94){var _0x34b9e2=function(_0x2a96a6){while(--_0x2a96a6){_0x5dd5c6['push'](_0x5dd5c6['shift']());}};_0x34b9e2(++_0x3e1a94);}(_0x61b5,0x9c));var _0x561b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61b5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x561b('0x0'));var rimraf=require(_0x561b('0x1'));var zipdir=require(_0x561b('0x2'));var jsonpatch=require(_0x561b('0x3'));var rp=require(_0x561b('0x4'));var moment=require(_0x561b('0x5'));var BPromise=require(_0x561b('0x6'));var Mustache=require(_0x561b('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x561b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x561b('0x9'));var _=require(_0x561b('0xa'));var squel=require(_0x561b('0xb'));var crypto=require(_0x561b('0xc'));var jsforce=require(_0x561b('0xd'));var deskjs=require(_0x561b('0xe'));var toCsv=require(_0x561b('0x8'));var querystring=require(_0x561b('0xf'));var Papa=require(_0x561b('0x10'));var Redis=require(_0x561b('0x11'));var authService=require(_0x561b('0x12'));var qs=require(_0x561b('0x13'));var as=require(_0x561b('0x14'));var hardwareService=require(_0x561b('0x15'));var logger=require(_0x561b('0x16'))(_0x561b('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x561b('0x18'));var db=require(_0x561b('0x19'))['db'];function respondWithStatusCode(_0x34a3c4,_0x3dd655){_0x3dd655=_0x3dd655||0xcc;return function(_0x54e558){if(_0x54e558){return _0x34a3c4['sendStatus'](_0x3dd655);}return _0x34a3c4['status'](_0x3dd655)['end']();};}function respondWithResult(_0x486b62,_0x395ce0){_0x395ce0=_0x395ce0||0xc8;return function(_0x21ec21){if(_0x21ec21){return _0x486b62[_0x561b('0x1a')](_0x395ce0)[_0x561b('0x1b')](_0x21ec21);}};}function respondWithFilteredResult(_0x2f4759,_0x4d7717){return function(_0xa93483){if(_0xa93483){var _0x52e19c=typeof _0x4d7717[_0x561b('0x1c')]==='undefined'&&typeof _0x4d7717[_0x561b('0x1d')]===_0x561b('0x1e');var _0x5c91db=_0xa93483[_0x561b('0x1f')];var _0x489bdb=_0x52e19c?0x0:_0x4d7717['offset'];var _0x106c6d=_0x52e19c?_0xa93483[_0x561b('0x1f')]:_0x4d7717['offset']+_0x4d7717[_0x561b('0x1d')];var _0x325e29;if(_0x106c6d>=_0x5c91db){_0x106c6d=_0x5c91db;_0x325e29=0xc8;}else{_0x325e29=0xce;}_0x2f4759['status'](_0x325e29);return _0x2f4759[_0x561b('0x20')](_0x561b('0x21'),_0x489bdb+'-'+_0x106c6d+'/'+_0x5c91db)[_0x561b('0x1b')](_0xa93483);}return null;};}function patchUpdates(_0x54e778){return function(_0x457df4){try{jsonpatch['apply'](_0x457df4,_0x54e778,!![]);}catch(_0x38a86b){return BPromise[_0x561b('0x22')](_0x38a86b);}return _0x457df4['save']();};}function saveUpdates(_0x1b4a21,_0x4d528a){return function(_0x1b0a05){if(_0x1b0a05){return _0x1b0a05[_0x561b('0x23')](_0x1b4a21)[_0x561b('0x24')](function(_0x34d916){return _0x34d916;});}return null;};}function removeEntity(_0x48b3fd,_0x5bea6f){return function(_0x45c05c){if(_0x45c05c){return _0x45c05c[_0x561b('0x25')]()[_0x561b('0x24')](function(){_0x48b3fd[_0x561b('0x1a')](0xcc)[_0x561b('0x26')]();});}};}function handleEntityNotFound(_0x262acc,_0x29394c){return function(_0x100d12){if(!_0x100d12){_0x262acc[_0x561b('0x27')](0x194);}return _0x100d12;};}function handleError(_0x58065c,_0x2ae43e){_0x2ae43e=_0x2ae43e||0x1f4;return function(_0x5d702b){logger[_0x561b('0x28')](_0x5d702b['stack']);if(_0x5d702b['name']){delete _0x5d702b['name'];}_0x58065c[_0x561b('0x1a')](_0x2ae43e)[_0x561b('0x29')](_0x5d702b);};}exports[_0x561b('0x2a')]=function(_0xf31bbe,_0x52eb34){var _0x1a99a1={},_0x3481d9={},_0x595d15={'count':0x0,'rows':[]};var _0x4891de=_[_0x561b('0x2b')](db[_0x561b('0x2c')][_0x561b('0x2d')],function(_0xde90b0){return{'name':_0xde90b0[_0x561b('0x2e')],'type':_0xde90b0[_0x561b('0x2f')][_0x561b('0x30')]};});_0x3481d9[_0x561b('0x31')]=_['map'](_0x4891de,_0x561b('0x32'));_0x3481d9[_0x561b('0x33')]=_[_0x561b('0x34')](_0xf31bbe['query']);_0x3481d9[_0x561b('0x35')]=_['intersection'](_0x3481d9['model'],_0x3481d9[_0x561b('0x33')]);_0x1a99a1[_0x561b('0x36')]=_[_0x561b('0x37')](_0x3481d9['model'],qs[_0x561b('0x38')](_0xf31bbe[_0x561b('0x33')][_0x561b('0x38')]));_0x1a99a1[_0x561b('0x36')]=_0x1a99a1[_0x561b('0x36')][_0x561b('0x39')]?_0x1a99a1['attributes']:_0x3481d9[_0x561b('0x31')];if(!_0xf31bbe[_0x561b('0x33')]['hasOwnProperty'](_0x561b('0x3a'))){_0x1a99a1[_0x561b('0x1d')]=qs[_0x561b('0x1d')](_0xf31bbe[_0x561b('0x33')]['limit']);_0x1a99a1[_0x561b('0x1c')]=qs[_0x561b('0x1c')](_0xf31bbe[_0x561b('0x33')][_0x561b('0x1c')]);}_0x1a99a1[_0x561b('0x3b')]=qs[_0x561b('0x3c')](_0xf31bbe['query'][_0x561b('0x3c')]);_0x1a99a1[_0x561b('0x3d')]=qs[_0x561b('0x35')](_[_0x561b('0x3e')](_0xf31bbe[_0x561b('0x33')],_0x3481d9[_0x561b('0x35')]),_0x4891de);if(_0xf31bbe[_0x561b('0x33')][_0x561b('0x3f')]){_0x1a99a1['where']=_[_0x561b('0x40')](_0x1a99a1[_0x561b('0x3d')],{'$or':_[_0x561b('0x2b')](_0x4891de,function(_0x3f9b2f){if(_0x3f9b2f['type']!==_0x561b('0x41')){var _0x3da60b={};_0x3da60b[_0x3f9b2f[_0x561b('0x32')]]={'$like':'%'+_0xf31bbe[_0x561b('0x33')]['filter']+'%'};return _0x3da60b;}})});}_0x1a99a1=_[_0x561b('0x40')]({},_0x1a99a1,_0xf31bbe[_0x561b('0x42')]);var _0x18762d={'where':_0x1a99a1['where']};return db[_0x561b('0x2c')]['count'](_0x18762d)[_0x561b('0x24')](function(_0x1ccb4c){_0x595d15[_0x561b('0x1f')]=_0x1ccb4c;if(_0xf31bbe[_0x561b('0x33')]['includeAll']){_0x1a99a1['include']=[{'all':!![]}];}return db[_0x561b('0x2c')][_0x561b('0x43')](_0x1a99a1);})[_0x561b('0x24')](function(_0x5299be){_0x595d15['rows']=_0x5299be;return _0x595d15;})[_0x561b('0x24')](respondWithFilteredResult(_0x52eb34,_0x1a99a1))[_0x561b('0x44')](handleError(_0x52eb34,null));};exports['show']=function(_0x54e865,_0x508274){var _0x1d8223={'raw':![],'where':{'id':_0x54e865[_0x561b('0x45')]['id']}},_0x6a444f={};_0x6a444f[_0x561b('0x31')]=_['keys'](db[_0x561b('0x2c')][_0x561b('0x2d')]);_0x6a444f[_0x561b('0x33')]=_['keys'](_0x54e865['query']);_0x6a444f['filters']=_[_0x561b('0x37')](_0x6a444f['model'],_0x6a444f[_0x561b('0x33')]);_0x1d8223[_0x561b('0x36')]=_[_0x561b('0x37')](_0x6a444f['model'],qs[_0x561b('0x38')](_0x54e865[_0x561b('0x33')][_0x561b('0x38')]));_0x1d8223[_0x561b('0x36')]=_0x1d8223[_0x561b('0x36')][_0x561b('0x39')]?_0x1d8223[_0x561b('0x36')]:_0x6a444f['model'];if(_0x54e865['query'][_0x561b('0x46')]){_0x1d8223[_0x561b('0x47')]=[{'all':!![]}];}_0x1d8223=_[_0x561b('0x40')]({},_0x1d8223,_0x54e865[_0x561b('0x42')]);return db[_0x561b('0x2c')][_0x561b('0x48')](_0x1d8223)[_0x561b('0x24')](handleEntityNotFound(_0x508274,null))['then'](respondWithResult(_0x508274,null))['catch'](handleError(_0x508274,null));};exports['create']=function(_0x4cb4c5,_0x5e262f){return db[_0x561b('0x2c')][_0x561b('0x49')](_0x4cb4c5[_0x561b('0x4a')],{})[_0x561b('0x24')](respondWithResult(_0x5e262f,0xc9))['catch'](handleError(_0x5e262f,null));};exports[_0x561b('0x23')]=function(_0x33c463,_0x5e7710){if(_0x33c463['body']['id']){delete _0x33c463[_0x561b('0x4a')]['id'];}return db[_0x561b('0x2c')][_0x561b('0x48')]({'where':{'id':_0x33c463['params']['id']}})['then'](handleEntityNotFound(_0x5e7710,null))[_0x561b('0x24')](saveUpdates(_0x33c463[_0x561b('0x4a')],null))[_0x561b('0x24')](respondWithResult(_0x5e7710,null))[_0x561b('0x44')](handleError(_0x5e7710,null));};exports['destroy']=function(_0xcd6544,_0x33520e){return db[_0x561b('0x2c')]['find']({'where':{'id':_0xcd6544[_0x561b('0x45')]['id']}})[_0x561b('0x24')](handleEntityNotFound(_0x33520e,null))[_0x561b('0x24')](removeEntity(_0x33520e,null))[_0x561b('0x44')](handleError(_0x33520e,null));};exports[_0x561b('0x4b')]=function(_0x1c2c22,_0x2ccc6d){return db[_0x561b('0x2c')][_0x561b('0x4b')]()['then'](respondWithResult(_0x2ccc6d,null))[_0x561b('0x44')](handleError(_0x2ccc6d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index f4ffdc0..3eea0ca 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 _0x41e9=['bluebird','request-promise','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','util','../../config/logger','api','moment'];(function(_0x49d280,_0x33d68f){var _0x25274a=function(_0x8ace90){while(--_0x8ace90){_0x49d280['push'](_0x49d280['shift']());}};_0x25274a(++_0x33d68f);}(_0x41e9,0x19c));var _0x941e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x41e9[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x941e('0x0'));var logger=require(_0x941e('0x1'))(_0x941e('0x2'));var moment=require(_0x941e('0x3'));var BPromise=require(_0x941e('0x4'));var rp=require(_0x941e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x941e('0x6'));var attributes=require(_0x941e('0x7'));module['exports']=function(_0x2bdf19,_0x57f477){return _0x2bdf19[_0x941e('0x8')](_0x941e('0x9'),attributes,{'tableName':_0x941e('0xa'),'paranoid':![],'indexes':[{'name':_0x941e('0xb'),'fields':['sectionId',_0x941e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x568a=['moment','rimraf','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api'];(function(_0x926cd7,_0x3227f9){var _0x23f1fa=function(_0x25ccae){while(--_0x25ccae){_0x926cd7['push'](_0x926cd7['shift']());}};_0x23f1fa(++_0x3227f9);}(_0x568a,0xcd));var _0xa568=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x568a[_0x2f3848];return _0x102668;};'use strict';var _=require(_0xa568('0x0'));var util=require(_0xa568('0x1'));var logger=require(_0xa568('0x2'))(_0xa568('0x3'));var moment=require(_0xa568('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa568('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0xc67cad,_0x35d561){return _0xc67cad[_0xa568('0x6')](_0xa568('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xa568('0x8'),'fields':[_0xa568('0x9'),_0xa568('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 77924a8..190315c 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 _0xa901=['request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x50765a,_0x142de3){var _0x2f5ced=function(_0x1a743c){while(--_0x1a743c){_0x50765a['push'](_0x50765a['shift']());}};_0x2f5ced(++_0x142de3);}(_0xa901,0x189));var _0x1a90=function(_0x33582b,_0xba0941){_0x33582b=_0x33582b-0x0;var _0x1551fa=_0xa901[_0x33582b];return _0x1551fa;};'use strict';var _=require(_0x1a90('0x0'));var util=require(_0x1a90('0x1'));var moment=require(_0x1a90('0x2'));var BPromise=require(_0x1a90('0x3'));var rs=require(_0x1a90('0x4'));var fs=require('fs');var Redis=require(_0x1a90('0x5'));var db=require(_0x1a90('0x6'))['db'];var utils=require(_0x1a90('0x7'));var logger=require(_0x1a90('0x8'))(_0x1a90('0x9'));var config=require(_0x1a90('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1a90('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a31d2,_0xd8643b,_0x5365f0){return new BPromise(function(_0xcf090d,_0x2b8c2d){return client[_0x1a90('0xc')](_0x5a31d2,_0x5365f0)[_0x1a90('0xd')](function(_0xd51fe1){logger[_0x1a90('0xe')]('UserProfileSection,\x20%s,\x20%s',_0xd8643b,_0x1a90('0xf'));logger['debug'](_0x1a90('0x10'),_0xd8643b,'request\x20sent',JSON[_0x1a90('0x11')](_0xd51fe1));if(_0xd51fe1[_0x1a90('0x12')]){if(_0xd51fe1['error'][_0x1a90('0x13')]===0x1f4){logger[_0x1a90('0x12')](_0x1a90('0x14'),_0xd8643b,_0xd51fe1[_0x1a90('0x12')][_0x1a90('0x15')]);return _0x2b8c2d(_0xd51fe1[_0x1a90('0x12')][_0x1a90('0x15')]);}logger[_0x1a90('0x12')](_0x1a90('0x14'),_0xd8643b,_0xd51fe1['error'][_0x1a90('0x15')]);return _0xcf090d(_0xd51fe1[_0x1a90('0x12')]['message']);}else{logger[_0x1a90('0xe')](_0x1a90('0x14'),_0xd8643b,_0x1a90('0xf'));_0xcf090d(_0xd51fe1[_0x1a90('0x16')][_0x1a90('0x15')]);}})[_0x1a90('0x17')](function(_0x1f000a){logger['error']('UserProfileSection,\x20%s,\x20%s',_0xd8643b,_0x1f000a);_0x2b8c2d(_0x1f000a);});});} \ No newline at end of file +var _0x4475=['moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x4475,0x6c));var _0x5447=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4475[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5447('0x0'));var util=require(_0x5447('0x1'));var moment=require(_0x5447('0x2'));var BPromise=require('bluebird');var rs=require(_0x5447('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5447('0x4'))['db'];var utils=require(_0x5447('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5447('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5447('0x7')][_0x5447('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2aff2b,_0x400ffd,_0x3d17b4){return new BPromise(function(_0x16c41e,_0x541f78){return client[_0x5447('0x9')](_0x2aff2b,_0x3d17b4)[_0x5447('0xa')](function(_0x42aa9a){logger[_0x5447('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x400ffd,_0x5447('0xc'));logger[_0x5447('0xd')](_0x5447('0xe'),_0x400ffd,_0x5447('0xc'),JSON[_0x5447('0xf')](_0x42aa9a));if(_0x42aa9a[_0x5447('0x10')]){if(_0x42aa9a[_0x5447('0x10')][_0x5447('0x11')]===0x1f4){logger[_0x5447('0x10')](_0x5447('0x12'),_0x400ffd,_0x42aa9a['error'][_0x5447('0x13')]);return _0x541f78(_0x42aa9a['error']['message']);}logger['error'](_0x5447('0x12'),_0x400ffd,_0x42aa9a[_0x5447('0x10')]['message']);return _0x16c41e(_0x42aa9a[_0x5447('0x10')][_0x5447('0x13')]);}else{logger[_0x5447('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x400ffd,'request\x20sent');_0x16c41e(_0x42aa9a[_0x5447('0x14')][_0x5447('0x13')]);}})[_0x5447('0x15')](function(_0xd83c26){logger['error'](_0x5447('0x12'),_0x400ffd,_0xd83c26);_0x541f78(_0xd83c26);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 8e555a6..b184e5c 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x10c68d,_0x1daf6d){var _0x428efa=function(_0x153e00){while(--_0x153e00){_0x10c68d['push'](_0x10c68d['shift']());}};_0x428efa(++_0x1daf6d);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3ac5e3,_0x559a6d){var _0x1e5fee=function(_0x37aa46){while(--_0x37aa46){_0x3ac5e3['push'](_0x3ac5e3['shift']());}};_0x1e5fee(++_0x559a6d);}(_0xe706,0xa3));var _0x6e70=function(_0x2aa733,_0xcde568){_0x2aa733=_0x2aa733-0x0;var _0x2bcf85=_0xe706[_0x2aa733];return _0x2bcf85;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7dde783..525e58d 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 _0xe10c=['sequelize','exports'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0xe10c,0x1f0));var _0xce10=function(_0x484697,_0x394dc0){_0x484697=_0x484697-0x0;var _0x1886a2=_0xe10c[_0x484697];return _0x1886a2;};'use strict';var Sequelize=require(_0xce10('0x0'));module[_0xce10('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6c18=['sequelize','exports','INTEGER'];(function(_0x2f26a2,_0x3debdf){var _0x42e320=function(_0x587e56){while(--_0x587e56){_0x2f26a2['push'](_0x2f26a2['shift']());}};_0x42e320(++_0x3debdf);}(_0x6c18,0x195));var _0x86c1=function(_0x49e42a,_0x454cb6){_0x49e42a=_0x49e42a-0x0;var _0x1bbefb=_0x6c18[_0x49e42a];return _0x1bbefb;};'use strict';var Sequelize=require(_0x86c1('0x0'));module[_0x86c1('0x1')]={'penalty':{'type':Sequelize[_0x86c1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 3d669f9..7ae71d3 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 _0x958a=['bluebird','request-promise','path','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','api','moment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x958a,0x128));var _0xa958=function(_0x4e8b5d,_0x30b579){_0x4e8b5d=_0x4e8b5d-0x0;var _0x39dfb8=_0x958a[_0x4e8b5d];return _0x39dfb8;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require('../../config/logger')(_0xa958('0x2'));var moment=require(_0xa958('0x3'));var BPromise=require(_0xa958('0x4'));var rp=require(_0xa958('0x5'));var fs=require('fs');var path=require(_0xa958('0x6'));var rimraf=require('rimraf');var config=require(_0xa958('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xa958('0x8')]=function(_0x9b7d9e,_0x2692d6){return _0x9b7d9e[_0xa958('0x9')](_0xa958('0xa'),attributes,{'tableName':_0xa958('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2c7=['rimraf','exports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3758e7,_0x35e114){var _0x6ad4cf=function(_0x2b22d8){while(--_0x2b22d8){_0x3758e7['push'](_0x3758e7['shift']());}};_0x6ad4cf(++_0x35e114);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3fcfe5,_0x2cadaa){_0x3fcfe5=_0x3fcfe5-0x0;var _0x3e3445=_0xc2c7[_0x3fcfe5];return _0x3e3445;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var logger=require(_0x7c2c('0x1'))(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var rp=require(_0x7c2c('0x5'));var fs=require('fs');var path=require(_0x7c2c('0x6'));var rimraf=require(_0x7c2c('0x7'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0x7c2c('0x8')]=function(_0x42ecc9,_0x23c038){return _0x42ecc9['define']('UserSmsQueue',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 6e8de88..da755bb 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 _0xcc71=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','request\x20sent','catch'];(function(_0x16bd44,_0x3c91ba){var _0x368a61=function(_0x1c68ab){while(--_0x1c68ab){_0x16bd44['push'](_0x16bd44['shift']());}};_0x368a61(++_0x3c91ba);}(_0xcc71,0x160));var _0x1cc7=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xcc71[_0x20589d];return _0x422de9;};'use strict';var _=require(_0x1cc7('0x0'));var util=require(_0x1cc7('0x1'));var moment=require(_0x1cc7('0x2'));var BPromise=require(_0x1cc7('0x3'));var rs=require(_0x1cc7('0x4'));var fs=require('fs');var Redis=require(_0x1cc7('0x5'));var db=require(_0x1cc7('0x6'))['db'];var utils=require(_0x1cc7('0x7'));var logger=require('../../config/logger')(_0x1cc7('0x8'));var config=require('../../config/environment');var jayson=require(_0x1cc7('0x9'));var client=jayson[_0x1cc7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36d2a8,_0x4199af,_0x50276c){return new BPromise(function(_0x47550e,_0x220f72){return client[_0x1cc7('0xb')](_0x36d2a8,_0x50276c)[_0x1cc7('0xc')](function(_0x438f73){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x4199af,'request\x20sent');logger['debug'](_0x1cc7('0xd'),_0x4199af,'request\x20sent',JSON[_0x1cc7('0xe')](_0x438f73));if(_0x438f73[_0x1cc7('0xf')]){if(_0x438f73[_0x1cc7('0xf')][_0x1cc7('0x10')]===0x1f4){logger[_0x1cc7('0xf')](_0x1cc7('0x11'),_0x4199af,_0x438f73['error'][_0x1cc7('0x12')]);return _0x220f72(_0x438f73[_0x1cc7('0xf')]['message']);}logger['error'](_0x1cc7('0x11'),_0x4199af,_0x438f73[_0x1cc7('0xf')][_0x1cc7('0x12')]);return _0x47550e(_0x438f73[_0x1cc7('0xf')][_0x1cc7('0x12')]);}else{logger[_0x1cc7('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x4199af,_0x1cc7('0x14'));_0x47550e(_0x438f73['result']['message']);}})[_0x1cc7('0x15')](function(_0x26e1c3){logger[_0x1cc7('0xf')](_0x1cc7('0x11'),_0x4199af,_0x26e1c3);_0x220f72(_0x26e1c3);});});} \ No newline at end of file +var _0xad65=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2a4639,_0x35d81c){var _0x44dd2b=function(_0x241d38){while(--_0x241d38){_0x2a4639['push'](_0x2a4639['shift']());}};_0x44dd2b(++_0x35d81c);}(_0xad65,0x1df));var _0x5ad6=function(_0x26c01d,_0x36774d){_0x26c01d=_0x26c01d-0x0;var _0x370ba4=_0xad65[_0x26c01d];return _0x370ba4;};'use strict';var _=require('lodash');var util=require(_0x5ad6('0x0'));var moment=require(_0x5ad6('0x1'));var BPromise=require(_0x5ad6('0x2'));var rs=require(_0x5ad6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ad6('0x4'))['db'];var utils=require(_0x5ad6('0x5'));var logger=require(_0x5ad6('0x6'))(_0x5ad6('0x7'));var config=require(_0x5ad6('0x8'));var jayson=require(_0x5ad6('0x9'));var client=jayson[_0x5ad6('0xa')][_0x5ad6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b25c4,_0x445999,_0x47f168){return new BPromise(function(_0x492974,_0x338f76){return client[_0x5ad6('0xc')](_0x2b25c4,_0x47f168)[_0x5ad6('0xd')](function(_0x5b9975){logger[_0x5ad6('0xe')](_0x5ad6('0xf'),_0x445999,_0x5ad6('0x10'));logger[_0x5ad6('0x11')](_0x5ad6('0x12'),_0x445999,'request\x20sent',JSON[_0x5ad6('0x13')](_0x5b9975));if(_0x5b9975[_0x5ad6('0x14')]){if(_0x5b9975[_0x5ad6('0x14')][_0x5ad6('0x15')]===0x1f4){logger[_0x5ad6('0x14')](_0x5ad6('0xf'),_0x445999,_0x5b9975[_0x5ad6('0x14')][_0x5ad6('0x16')]);return _0x338f76(_0x5b9975[_0x5ad6('0x14')][_0x5ad6('0x16')]);}logger[_0x5ad6('0x14')](_0x5ad6('0xf'),_0x445999,_0x5b9975[_0x5ad6('0x14')][_0x5ad6('0x16')]);return _0x492974(_0x5b9975[_0x5ad6('0x14')]['message']);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x445999,'request\x20sent');_0x492974(_0x5b9975[_0x5ad6('0x17')][_0x5ad6('0x16')]);}})[_0x5ad6('0x18')](function(_0x1b9b6b){logger['error'](_0x5ad6('0xf'),_0x445999,_0x1b9b6b);_0x338f76(_0x1b9b6b);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 0886396..7288c1f 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 _0x67c6=['exports','INTEGER','sequelize'];(function(_0x542936,_0x6af06f){var _0x4ba2ee=function(_0x3ddb4e){while(--_0x3ddb4e){_0x542936['push'](_0x542936['shift']());}};_0x4ba2ee(++_0x6af06f);}(_0x67c6,0x6e));var _0x667c=function(_0x1bba7a,_0x60b190){_0x1bba7a=_0x1bba7a-0x0;var _0x2e39c3=_0x67c6[_0x1bba7a];return _0x2e39c3;};'use strict';var Sequelize=require(_0x667c('0x0'));module[_0x667c('0x1')]={'UserId':{'type':Sequelize[_0x667c('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x53ff=['exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x53ff,0x1ec));var _0xf53f=function(_0x3971fa,_0x5a3d4e){_0x3971fa=_0x3971fa-0x0;var _0x3c140c=_0x53ff[_0x3971fa];return _0x3c140c;};'use strict';var Sequelize=require('sequelize');module[_0xf53f('0x0')]={'UserId':{'type':Sequelize[_0xf53f('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xf53f('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index e8f66ab..816021f 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(_0x346659,_0xee25fa){var _0xd88bec=function(_0x228104){while(--_0x228104){_0x346659['push'](_0x346659['shift']());}};_0xd88bec(++_0xee25fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3eb54a,_0x2c80e0){var _0x42f965=function(_0x138cfc){while(--_0x138cfc){_0x3eb54a['push'](_0x3eb54a['shift']());}};_0x42f965(++_0x2c80e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 8399ac0..06be1e1 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x24bcd8,_0x54f8d6){var _0x2cabab=function(_0x18bb81){while(--_0x18bb81){_0x24bcd8['push'](_0x24bcd8['shift']());}};_0x2cabab(++_0x54f8d6);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x41a852,_0x527ce6){var _0x383b90=function(_0x3af7fd){while(--_0x3af7fd){_0x41a852['push'](_0x41a852['shift']());}};_0x383b90(++_0x527ce6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0xcb91[_0x2bcb75];return _0x175345;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 3198c17..b7df390 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 _0x54c7=['INTEGER','sequelize'];(function(_0x479383,_0xb6d18f){var _0x317fe4=function(_0x254107){while(--_0x254107){_0x479383['push'](_0x479383['shift']());}};_0x317fe4(++_0xb6d18f);}(_0x54c7,0x161));var _0x754c=function(_0x908074,_0x33416e){_0x908074=_0x908074-0x0;var _0x2e29e0=_0x54c7[_0x908074];return _0x2e29e0;};'use strict';var Sequelize=require(_0x754c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x754c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x836d=['sequelize','exports','INTEGER'];(function(_0x59bbf9,_0x1ebc1c){var _0x360f86=function(_0x5e355a){while(--_0x5e355a){_0x59bbf9['push'](_0x59bbf9['shift']());}};_0x360f86(++_0x1ebc1c);}(_0x836d,0x126));var _0xd836=function(_0x141589,_0x589fa8){_0x141589=_0x141589-0x0;var _0x381d60=_0x836d[_0x141589];return _0x381d60;};'use strict';var Sequelize=require(_0xd836('0x0'));module[_0xd836('0x1')]={'penalty':{'type':Sequelize[_0xd836('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 e1c4eb2..dc18e4f 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 _0xbc44=['exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4b06ad,_0x1c8583){var _0x24f38e=function(_0x545fdc){while(--_0x545fdc){_0x4b06ad['push'](_0x4b06ad['shift']());}};_0x24f38e(++_0x1c8583);}(_0xbc44,0x122));var _0x4bc4=function(_0x5b55d3,_0x156e96){_0x5b55d3=_0x5b55d3-0x0;var _0x265e76=_0xbc44[_0x5b55d3];return _0x265e76;};'use strict';var _=require(_0x4bc4('0x0'));var util=require(_0x4bc4('0x1'));var logger=require(_0x4bc4('0x2'))(_0x4bc4('0x3'));var moment=require(_0x4bc4('0x4'));var BPromise=require(_0x4bc4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bc4('0x6'));var rimraf=require(_0x4bc4('0x7'));var config=require(_0x4bc4('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x4bc4('0x9')]=function(_0x1d2d35,_0x4cb37c){return _0x1d2d35[_0x4bc4('0xa')](_0x4bc4('0xb'),attributes,{'tableName':_0x4bc4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cfc=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0xd724a0,_0x34eb63){var _0x52954e=function(_0x2e8f73){while(--_0x2e8f73){_0xd724a0['push'](_0xd724a0['shift']());}};_0x52954e(++_0x34eb63);}(_0x5cfc,0x6b));var _0xc5cf=function(_0x592df4,_0x4e719b){_0x592df4=_0x592df4-0x0;var _0x3b4fe4=_0x5cfc[_0x592df4];return _0x3b4fe4;};'use strict';var _=require(_0xc5cf('0x0'));var util=require(_0xc5cf('0x1'));var logger=require('../../config/logger')(_0xc5cf('0x2'));var moment=require(_0xc5cf('0x3'));var BPromise=require(_0xc5cf('0x4'));var rp=require(_0xc5cf('0x5'));var fs=require('fs');var path=require(_0xc5cf('0x6'));var rimraf=require(_0xc5cf('0x7'));var config=require(_0xc5cf('0x8'));var attributes=require(_0xc5cf('0x9'));module['exports']=function(_0xf72288,_0x3d834b){return _0xf72288[_0xc5cf('0xa')](_0xc5cf('0xb'),attributes,{'tableName':_0xc5cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 43c97a6..181ccf2 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 _0x43b2=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x43b2,0x189));var _0x243b=function(_0x38a698,_0x1a1b4a){_0x38a698=_0x38a698-0x0;var _0x2dbb01=_0x43b2[_0x38a698];return _0x2dbb01;};'use strict';var _=require(_0x243b('0x0'));var util=require(_0x243b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x243b('0x2'));var fs=require('fs');var Redis=require(_0x243b('0x3'));var db=require(_0x243b('0x4'))['db'];var utils=require(_0x243b('0x5'));var logger=require('../../config/logger')(_0x243b('0x6'));var config=require('../../config/environment');var jayson=require(_0x243b('0x7'));var client=jayson[_0x243b('0x8')][_0x243b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ace21,_0x3ca3d2,_0x1a7cd0){return new BPromise(function(_0x216db6,_0x3091f0){return client[_0x243b('0xa')](_0x2ace21,_0x1a7cd0)[_0x243b('0xb')](function(_0x11ac3a){logger['info'](_0x243b('0xc'),_0x3ca3d2,_0x243b('0xd'));logger[_0x243b('0xe')](_0x243b('0xf'),_0x3ca3d2,_0x243b('0xd'),JSON[_0x243b('0x10')](_0x11ac3a));if(_0x11ac3a[_0x243b('0x11')]){if(_0x11ac3a[_0x243b('0x11')][_0x243b('0x12')]===0x1f4){logger[_0x243b('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x3ca3d2,_0x11ac3a['error'][_0x243b('0x13')]);return _0x3091f0(_0x11ac3a[_0x243b('0x11')][_0x243b('0x13')]);}logger[_0x243b('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x3ca3d2,_0x11ac3a[_0x243b('0x11')][_0x243b('0x13')]);return _0x216db6(_0x11ac3a[_0x243b('0x11')][_0x243b('0x13')]);}else{logger[_0x243b('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x3ca3d2,_0x243b('0xd'));_0x216db6(_0x11ac3a[_0x243b('0x15')]['message']);}})['catch'](function(_0xf86df){logger[_0x243b('0x11')](_0x243b('0xc'),_0x3ca3d2,_0xf86df);_0x3091f0(_0xf86df);});});} \ No newline at end of file +var _0x70e3=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53bc12,_0x47fdfa){var _0x150816=function(_0x45ddd5){while(--_0x45ddd5){_0x53bc12['push'](_0x53bc12['shift']());}};_0x150816(++_0x47fdfa);}(_0x70e3,0x14e));var _0x370e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x70e3[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var util=require(_0x370e('0x0'));var moment=require(_0x370e('0x1'));var BPromise=require(_0x370e('0x2'));var rs=require(_0x370e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x370e('0x4'))['db'];var utils=require(_0x370e('0x5'));var logger=require(_0x370e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x370e('0x7'));var client=jayson[_0x370e('0x8')][_0x370e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ace04,_0x7ac614,_0x3c9a72){return new BPromise(function(_0x695cfa,_0x292de5){return client[_0x370e('0xa')](_0x1ace04,_0x3c9a72)['then'](function(_0x2eb3fd){logger[_0x370e('0xb')](_0x370e('0xc'),_0x7ac614,_0x370e('0xd'));logger[_0x370e('0xe')](_0x370e('0xf'),_0x7ac614,_0x370e('0xd'),JSON[_0x370e('0x10')](_0x2eb3fd));if(_0x2eb3fd[_0x370e('0x11')]){if(_0x2eb3fd[_0x370e('0x11')][_0x370e('0x12')]===0x1f4){logger[_0x370e('0x11')](_0x370e('0xc'),_0x7ac614,_0x2eb3fd[_0x370e('0x11')][_0x370e('0x13')]);return _0x292de5(_0x2eb3fd[_0x370e('0x11')][_0x370e('0x13')]);}logger[_0x370e('0x11')](_0x370e('0xc'),_0x7ac614,_0x2eb3fd[_0x370e('0x11')][_0x370e('0x13')]);return _0x695cfa(_0x2eb3fd[_0x370e('0x11')][_0x370e('0x13')]);}else{logger[_0x370e('0xb')](_0x370e('0xc'),_0x7ac614,_0x370e('0xd'));_0x695cfa(_0x2eb3fd[_0x370e('0x14')][_0x370e('0x13')]);}})[_0x370e('0x15')](function(_0x1ad6ba){logger['error'](_0x370e('0xc'),_0x7ac614,_0x1ad6ba);_0x292de5(_0x1ad6ba);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e361ef7..a001327 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x198d6a,_0x2bbc1b){var _0x1520f4=function(_0x494f6c){while(--_0x494f6c){_0x198d6a['push'](_0x198d6a['shift']());}};_0x1520f4(++_0x2bbc1b);}(_0xe706,0xa3));var _0x6e70=function(_0x608e20,_0x2c546d){_0x608e20=_0x608e20-0x0;var _0x5f498a=_0xe706[_0x608e20];return _0x5f498a;};'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(_0x4cdecc,_0x321d1a){var _0x3948a9=function(_0x2a247d){while(--_0x2a247d){_0x4cdecc['push'](_0x4cdecc['shift']());}};_0x3948a9(++_0x321d1a);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5f14ea5..2e312f1 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 _0xae09=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x5759ef,_0x917f72){var _0x4c42bd=function(_0x53a41d){while(--_0x53a41d){_0x5759ef['push'](_0x5759ef['shift']());}};_0x4c42bd(++_0x917f72);}(_0xae09,0x1e6));var _0x9ae0=function(_0x378aa2,_0x2d33d8){_0x378aa2=_0x378aa2-0x0;var _0x3508b8=_0xae09[_0x378aa2];return _0x3508b8;};'use strict';var Sequelize=require('sequelize');module[_0x9ae0('0x0')]={'uniqueid':{'type':Sequelize[_0x9ae0('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x9ae0('0x2')},'UserId':{'type':Sequelize[_0x9ae0('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9ae0('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x9ae0('0x2')},'VoiceQueueId':{'type':Sequelize[_0x9ae0('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x9ae0('0x3')],'allowNull':![],'unique':_0x9ae0('0x4'),'comment':_0x9ae0('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x9ae0('0x2')},'paused':{'type':Sequelize[_0x9ae0('0x1')](0xb),'defaultValue':0x0,'comment':_0x9ae0('0x2')}}; \ No newline at end of file +var _0x8d29=['exports','Required\x20by\x20Asterisk','INTEGER','STRING','queue_interface','sequelize'];(function(_0x5f461a,_0x3c17c1){var _0x3589cb=function(_0x5a5d31){while(--_0x5a5d31){_0x5f461a['push'](_0x5f461a['shift']());}};_0x3589cb(++_0x3c17c1);}(_0x8d29,0x101));var _0x98d2=function(_0x46ff7a,_0xa3ce7c){_0x46ff7a=_0x46ff7a-0x0;var _0x45002=_0x8d29[_0x46ff7a];return _0x45002;};'use strict';var Sequelize=require(_0x98d2('0x0'));module[_0x98d2('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x98d2('0x2')},'UserId':{'type':Sequelize[_0x98d2('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x98d2('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x98d2('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x98d2('0x4')],'allowNull':![],'unique':_0x98d2('0x5'),'comment':_0x98d2('0x2')},'penalty':{'type':Sequelize[_0x98d2('0x3')](0xb),'defaultValue':0x0,'comment':_0x98d2('0x2')},'paused':{'type':Sequelize[_0x98d2('0x3')](0xb),'defaultValue':0x0,'comment':_0x98d2('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 7e6dc80..5a1ede9 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 _0x4123=['setMaxListeners','update','remove','emit','hook','events','../../mysqldb','UserVoiceQueueRt'];(function(_0x4e7980,_0x37cae5){var _0x413754=function(_0x5c0b76){while(--_0x5c0b76){_0x4e7980['push'](_0x4e7980['shift']());}};_0x413754(++_0x37cae5);}(_0x4123,0x8d));var _0x3412=function(_0x4cafb1,_0x2954df){_0x4cafb1=_0x4cafb1-0x0;var _0x5d0869=_0x4123[_0x4cafb1];return _0x5d0869;};'use strict';var EventEmitter=require(_0x3412('0x0'));var UserVoiceQueueRt=require(_0x3412('0x1'))['db'][_0x3412('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3412('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3412('0x4'),'afterDestroy':_0x3412('0x5')};function emitEvent(_0x349995){return function(_0x1e9c9b,_0x23988c,_0x317834){UserVoiceQueueRtEvents[_0x3412('0x6')](_0x349995+':'+_0x1e9c9b['id'],_0x1e9c9b);UserVoiceQueueRtEvents['emit'](_0x349995,_0x1e9c9b);_0x317834(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x3412('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x4679=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x20ab89,_0x148aab){var _0x231601=function(_0x2e13c1){while(--_0x2e13c1){_0x20ab89['push'](_0x20ab89['shift']());}};_0x231601(++_0x148aab);}(_0x4679,0x168));var _0x9467=function(_0xd223ca,_0x55542e){_0xd223ca=_0xd223ca-0x0;var _0x6a7809=_0x4679[_0xd223ca];return _0x6a7809;};'use strict';var EventEmitter=require(_0x9467('0x0'));var UserVoiceQueueRt=require(_0x9467('0x1'))['db'][_0x9467('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9467('0x3')](0x0);var events={'afterCreate':_0x9467('0x4'),'afterUpdate':_0x9467('0x5'),'afterDestroy':'remove'};function emitEvent(_0x50cec1){return function(_0x514778,_0x4baed1,_0x387a0d){UserVoiceQueueRtEvents['emit'](_0x50cec1+':'+_0x514778['id'],_0x514778);UserVoiceQueueRtEvents[_0x9467('0x6')](_0x50cec1,_0x514778);_0x387a0d(null);};}for(var e in events){if(events[_0x9467('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x9467('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 9a0d173..4ace60d 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 _0x8554=['bluebird','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','../../config/logger','api'];(function(_0x27f0aa,_0x5d7dc6){var _0x3e7acd=function(_0x4fd2a2){while(--_0x4fd2a2){_0x27f0aa['push'](_0x27f0aa['shift']());}};_0x3e7acd(++_0x5d7dc6);}(_0x8554,0x126));var _0x4855=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8554[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4855('0x0'))(_0x4855('0x1'));var moment=require('moment');var BPromise=require(_0x4855('0x2'));var rp=require(_0x4855('0x3'));var fs=require('fs');var path=require(_0x4855('0x4'));var rimraf=require('rimraf');var config=require(_0x4855('0x5'));var attributes=require(_0x4855('0x6'));module['exports']=function(_0x3d92b0,_0x57c91a){return _0x3d92b0['define'](_0x4855('0x7'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x339f=['path','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x339f,0xf0));var _0xf339=function(_0x6b369f,_0x5337fe){_0x6b369f=_0x6b369f-0x0;var _0x5618d3=_0x339f[_0x6b369f];return _0x5618d3;};'use strict';var _=require(_0xf339('0x0'));var util=require(_0xf339('0x1'));var logger=require(_0xf339('0x2'))(_0xf339('0x3'));var moment=require(_0xf339('0x4'));var BPromise=require(_0xf339('0x5'));var rp=require(_0xf339('0x6'));var fs=require('fs');var path=require(_0xf339('0x7'));var rimraf=require(_0xf339('0x8'));var config=require('../../config/environment');var attributes=require(_0xf339('0x9'));module['exports']=function(_0x2cf603,_0x87e8c4){return _0x2cf603[_0xf339('0xa')](_0xf339('0xb'),attributes,{'tableName':_0xf339('0xc'),'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 b0d6f8e..8d6a569 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 _0xc058=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2532aa,_0x10386d){var _0x4bf076=function(_0x2ae7ca){while(--_0x2ae7ca){_0x2532aa['push'](_0x2532aa['shift']());}};_0x4bf076(++_0x10386d);}(_0xc058,0x11a));var _0x8c05=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xc058[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x8c05('0x0'));var moment=require(_0x8c05('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c05('0x2'));var fs=require('fs');var Redis=require(_0x8c05('0x3'));var db=require(_0x8c05('0x4'))['db'];var utils=require(_0x8c05('0x5'));var logger=require('../../config/logger')(_0x8c05('0x6'));var config=require(_0x8c05('0x7'));var jayson=require(_0x8c05('0x8'));var client=jayson[_0x8c05('0x9')][_0x8c05('0xa')]({'port':0x232a});config[_0x8c05('0xb')]=_['defaults'](config[_0x8c05('0xb')],{'host':_0x8c05('0xc'),'port':0x18eb});var socket=require(_0x8c05('0xd'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x8c05('0xe')](socket);function respondWithRpcPromise(_0x461572,_0x268aff,_0x1421c4){return new BPromise(function(_0x56e4fb,_0x5b70ef){return client[_0x8c05('0xf')](_0x461572,_0x1421c4)[_0x8c05('0x10')](function(_0x55d99c){logger[_0x8c05('0x11')](_0x8c05('0x12'),_0x268aff,'request\x20sent');logger[_0x8c05('0x13')](_0x8c05('0x14'),_0x268aff,_0x8c05('0x15'),JSON[_0x8c05('0x16')](_0x55d99c));if(_0x55d99c[_0x8c05('0x17')]){if(_0x55d99c['error'][_0x8c05('0x18')]===0x1f4){logger[_0x8c05('0x17')](_0x8c05('0x12'),_0x268aff,_0x55d99c[_0x8c05('0x17')][_0x8c05('0x19')]);return _0x5b70ef(_0x55d99c[_0x8c05('0x17')][_0x8c05('0x19')]);}logger[_0x8c05('0x17')](_0x8c05('0x12'),_0x268aff,_0x55d99c[_0x8c05('0x17')]['message']);return _0x56e4fb(_0x55d99c[_0x8c05('0x17')][_0x8c05('0x19')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x268aff,_0x8c05('0x15'));_0x56e4fb(_0x55d99c[_0x8c05('0x1a')][_0x8c05('0x19')]);}})[_0x8c05('0x1b')](function(_0x2b98af){logger[_0x8c05('0x17')](_0x8c05('0x12'),_0x268aff,_0x2b98af);_0x5b70ef(_0x2b98af);});});}exports[_0x8c05('0x1c')]=function(_0x3e9666){var _0x5e944d=this;return new Promise(function(_0x145d08,_0x226f03){return db[_0x8c05('0x1d')][_0x8c05('0x1e')]({'raw':_0x3e9666['options']?_0x3e9666[_0x8c05('0x1f')][_0x8c05('0x20')]===undefined?!![]:![]:!![],'where':_0x3e9666[_0x8c05('0x1f')]?_0x3e9666[_0x8c05('0x1f')]['where']||null:null,'attributes':[[db[_0x8c05('0x21')]['fn']('COUNT',db[_0x8c05('0x21')]['fn']('IF',db[_0x8c05('0x21')][_0x8c05('0x22')](_0x8c05('0x23')))),'outboundQueuePauses']]})[_0x8c05('0x10')](function(_0x577135){logger[_0x8c05('0x11')](_0x8c05('0x1c'),_0x3e9666);logger['debug']('GetVoiceQueueRtPauses',_0x3e9666,JSON[_0x8c05('0x16')](_0x577135));_0x145d08(_0x577135);})[_0x8c05('0x1b')](function(_0x247863){logger[_0x8c05('0x17')](_0x8c05('0x1c'),_0x247863[_0x8c05('0x19')],_0x3e9666);_0x226f03(_0x5e944d[_0x8c05('0x17')](0x1f4,_0x247863[_0x8c05('0x19')]));});});}; \ No newline at end of file +var _0x8d0a=['GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x18e403,_0x12d080){var _0x11ef3c=function(_0x442e1a){while(--_0x442e1a){_0x18e403['push'](_0x18e403['shift']());}};_0x11ef3c(++_0x12d080);}(_0x8d0a,0x1ea));var _0xa8d0=function(_0x1b2bad,_0x56a173){_0x1b2bad=_0x1b2bad-0x0;var _0x48e5b7=_0x8d0a[_0x1b2bad];return _0x48e5b7;};'use strict';var _=require(_0xa8d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa8d0('0x1'));var rs=require(_0xa8d0('0x2'));var fs=require('fs');var Redis=require(_0xa8d0('0x3'));var db=require(_0xa8d0('0x4'))['db'];var utils=require(_0xa8d0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8d0('0x6'));var jayson=require(_0xa8d0('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xa8d0('0x8')]=_[_0xa8d0('0x9')](config[_0xa8d0('0x8')],{'host':_0xa8d0('0xa'),'port':0x18eb});var socket=require(_0xa8d0('0xb'))(new Redis(config[_0xa8d0('0x8')]));require(_0xa8d0('0xc'))[_0xa8d0('0xd')](socket);function respondWithRpcPromise(_0xcc8aa4,_0x46f87d,_0x30f5c1){return new BPromise(function(_0x575ee3,_0x3571db){return client['request'](_0xcc8aa4,_0x30f5c1)[_0xa8d0('0xe')](function(_0x398896){logger[_0xa8d0('0xf')](_0xa8d0('0x10'),_0x46f87d,'request\x20sent');logger['debug'](_0xa8d0('0x11'),_0x46f87d,_0xa8d0('0x12'),JSON[_0xa8d0('0x13')](_0x398896));if(_0x398896[_0xa8d0('0x14')]){if(_0x398896[_0xa8d0('0x14')]['code']===0x1f4){logger[_0xa8d0('0x14')](_0xa8d0('0x10'),_0x46f87d,_0x398896['error']['message']);return _0x3571db(_0x398896[_0xa8d0('0x14')][_0xa8d0('0x15')]);}logger[_0xa8d0('0x14')](_0xa8d0('0x10'),_0x46f87d,_0x398896[_0xa8d0('0x14')][_0xa8d0('0x15')]);return _0x575ee3(_0x398896[_0xa8d0('0x14')]['message']);}else{logger['info'](_0xa8d0('0x10'),_0x46f87d,_0xa8d0('0x12'));_0x575ee3(_0x398896['result']['message']);}})['catch'](function(_0x266b59){logger['error'](_0xa8d0('0x10'),_0x46f87d,_0x266b59);_0x3571db(_0x266b59);});});}exports[_0xa8d0('0x16')]=function(_0x336c1f){var _0x587220=this;return new Promise(function(_0x49c7d7,_0x3761d8){return db[_0xa8d0('0x17')][_0xa8d0('0x18')]({'raw':_0x336c1f[_0xa8d0('0x19')]?_0x336c1f['options']['raw']===undefined?!![]:![]:!![],'where':_0x336c1f[_0xa8d0('0x19')]?_0x336c1f[_0xa8d0('0x19')][_0xa8d0('0x1a')]||null:null,'attributes':[[db[_0xa8d0('0x1b')]['fn'](_0xa8d0('0x1c'),db[_0xa8d0('0x1b')]['fn']('IF',db['sequelize'][_0xa8d0('0x1d')](_0xa8d0('0x1e')))),_0xa8d0('0x1f')]]})[_0xa8d0('0xe')](function(_0xcc47ba){logger[_0xa8d0('0xf')](_0xa8d0('0x16'),_0x336c1f);logger['debug'](_0xa8d0('0x16'),_0x336c1f,JSON[_0xa8d0('0x13')](_0xcc47ba));_0x49c7d7(_0xcc47ba);})['catch'](function(_0x5133d6){logger['error'](_0xa8d0('0x16'),_0x5133d6[_0xa8d0('0x15')],_0x336c1f);_0x3761d8(_0x587220[_0xa8d0('0x14')](0x1f4,_0x5133d6['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 06f25b8..89b634d 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 _0xfa45=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','removeListener'];(function(_0x1ee5ef,_0x38d42b){var _0x448ab8=function(_0x508932){while(--_0x508932){_0x1ee5ef['push'](_0x1ee5ef['shift']());}};_0x448ab8(++_0x38d42b);}(_0xfa45,0x11b));var _0x5fa4=function(_0x12276e,_0x8cf71a){_0x12276e=_0x12276e-0x0;var _0x19ea45=_0xfa45[_0x12276e];return _0x19ea45;};'use strict';var UserVoiceQueueRtEvents=require(_0x5fa4('0x0'));var events=[_0x5fa4('0x1'),_0x5fa4('0x2'),_0x5fa4('0x3')];function createListener(_0x46c739,_0x2d966c){return function(_0x1e88c8){_0x2d966c['emit'](_0x46c739,_0x1e88c8);};}function removeListener(_0x2b3824,_0x4b7365){return function(){UserVoiceQueueRtEvents[_0x5fa4('0x4')](_0x2b3824,_0x4b7365);};}exports[_0x5fa4('0x5')]=function(_0x1121f8){for(var _0x260b0d=0x0,_0x28a266=events[_0x5fa4('0x6')];_0x260b0d<_0x28a266;_0x260b0d++){var _0x298dce=events[_0x260b0d];var _0x108de1=createListener(_0x5fa4('0x7')+_0x298dce,_0x1121f8);UserVoiceQueueRtEvents['on'](_0x298dce,_0x108de1);}}; \ No newline at end of file +var _0xbf07=['save','remove','update','removeListener','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0xe6ed4e,_0x23e9c0){var _0x215d24=function(_0x510f80){while(--_0x510f80){_0xe6ed4e['push'](_0xe6ed4e['shift']());}};_0x215d24(++_0x23e9c0);}(_0xbf07,0x77));var _0x7bf0=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0xbf07[_0x3815c2];return _0x271f88;};'use strict';var UserVoiceQueueRtEvents=require(_0x7bf0('0x0'));var events=[_0x7bf0('0x1'),_0x7bf0('0x2'),_0x7bf0('0x3')];function createListener(_0x59f0c3,_0x1e2f22){return function(_0x34b2f2){_0x1e2f22['emit'](_0x59f0c3,_0x34b2f2);};}function removeListener(_0x4dbbc4,_0x5c956a){return function(){UserVoiceQueueRtEvents[_0x7bf0('0x4')](_0x4dbbc4,_0x5c956a);};}exports['register']=function(_0x5d2b76){for(var _0x4a925d=0x0,_0x44f656=events['length'];_0x4a925d<_0x44f656;_0x4a925d++){var _0x263964=events[_0x4a925d];var _0x536214=createListener(_0x7bf0('0x5')+_0x263964,_0x5d2b76);UserVoiceQueueRtEvents['on'](_0x263964,_0x536214);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 931d5f8..38cda67 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2714a5,_0x25345e){var _0x137d43=function(_0x35adc7){while(--_0x35adc7){_0x2714a5['push'](_0x2714a5['shift']());}};_0x137d43(++_0x25345e);}(_0xedd9,0xfc));var _0x9edd=function(_0x320d8c,_0x5c9a4f){_0x320d8c=_0x320d8c-0x0;var _0x52dc01=_0xedd9[_0x320d8c];return _0x52dc01;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9006424..688bdb9 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8b11=['INTEGER','exports'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0x8b11,0xa1));var _0x18b1=function(_0x110e42,_0x134a3e){_0x110e42=_0x110e42-0x0;var _0x343f58=_0x8b11[_0x110e42];return _0x343f58;};'use strict';var Sequelize=require('sequelize');module[_0x18b1('0x0')]={'penalty':{'type':Sequelize[_0x18b1('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 63c048b..0ce3990 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 _0x9947=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x215df0,_0xbc113a){var _0x5777c2=function(_0x2aecb5){while(--_0x2aecb5){_0x215df0['push'](_0x215df0['shift']());}};_0x5777c2(++_0xbc113a);}(_0x9947,0x103));var _0x7994=function(_0x31c0e5,_0x472b48){_0x31c0e5=_0x31c0e5-0x0;var _0x16dce4=_0x9947[_0x31c0e5];return _0x16dce4;};'use strict';var _=require(_0x7994('0x0'));var util=require(_0x7994('0x1'));var logger=require('../../config/logger')(_0x7994('0x2'));var moment=require(_0x7994('0x3'));var BPromise=require(_0x7994('0x4'));var rp=require(_0x7994('0x5'));var fs=require('fs');var path=require(_0x7994('0x6'));var rimraf=require(_0x7994('0x7'));var config=require(_0x7994('0x8'));var attributes=require(_0x7994('0x9'));module[_0x7994('0xa')]=function(_0x3dbd97,_0xccd5e7){return _0x3dbd97[_0x7994('0xb')](_0x7994('0xc'),attributes,{'tableName':_0x7994('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb52a=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','api','rimraf'];(function(_0xfa018d,_0x26480e){var _0x5b29aa=function(_0x23f0f9){while(--_0x23f0f9){_0xfa018d['push'](_0xfa018d['shift']());}};_0x5b29aa(++_0x26480e);}(_0xb52a,0x153));var _0xab52=function(_0x25cd2c,_0x57498e){_0x25cd2c=_0x25cd2c-0x0;var _0x1e364c=_0xb52a[_0x25cd2c];return _0x1e364c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab52('0x0'))(_0xab52('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab52('0x2'));var config=require(_0xab52('0x3'));var attributes=require(_0xab52('0x4'));module[_0xab52('0x5')]=function(_0x37d12a,_0x95b0ef){return _0x37d12a[_0xab52('0x6')](_0xab52('0x7'),attributes,{'tableName':_0xab52('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index d5dc88b..1cc65f4 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 _0x7961=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7961,0xcb));var _0x1796=function(_0x2f7205,_0x363b0b){_0x2f7205=_0x2f7205-0x0;var _0xcfba17=_0x7961[_0x2f7205];return _0xcfba17;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1796('0x0'));var BPromise=require(_0x1796('0x1'));var rs=require(_0x1796('0x2'));var fs=require('fs');var Redis=require(_0x1796('0x3'));var db=require(_0x1796('0x4'))['db'];var utils=require(_0x1796('0x5'));var logger=require(_0x1796('0x6'))(_0x1796('0x7'));var config=require(_0x1796('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1796('0x9')][_0x1796('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d4e81,_0x16a4c8,_0x13e5ad){return new BPromise(function(_0x40f685,_0x34dc5f){return client[_0x1796('0xb')](_0x2d4e81,_0x13e5ad)[_0x1796('0xc')](function(_0x327b91){logger[_0x1796('0xd')](_0x1796('0xe'),_0x16a4c8,_0x1796('0xf'));logger['debug'](_0x1796('0x10'),_0x16a4c8,_0x1796('0xf'),JSON[_0x1796('0x11')](_0x327b91));if(_0x327b91[_0x1796('0x12')]){if(_0x327b91[_0x1796('0x12')][_0x1796('0x13')]===0x1f4){logger[_0x1796('0x12')](_0x1796('0xe'),_0x16a4c8,_0x327b91[_0x1796('0x12')][_0x1796('0x14')]);return _0x34dc5f(_0x327b91[_0x1796('0x12')]['message']);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x16a4c8,_0x327b91[_0x1796('0x12')]['message']);return _0x40f685(_0x327b91['error']['message']);}else{logger[_0x1796('0xd')](_0x1796('0xe'),_0x16a4c8,_0x1796('0xf'));_0x40f685(_0x327b91[_0x1796('0x15')][_0x1796('0x14')]);}})[_0x1796('0x16')](function(_0xc1419d){logger['error'](_0x1796('0xe'),_0x16a4c8,_0xc1419d);_0x34dc5f(_0xc1419d);});});} \ No newline at end of file +var _0xdff2=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xdff2,0x8e));var _0x2dff=function(_0x2d5f5b,_0x2bd639){_0x2d5f5b=_0x2d5f5b-0x0;var _0x4e6496=_0xdff2[_0x2d5f5b];return _0x4e6496;};'use strict';var _=require(_0x2dff('0x0'));var util=require('util');var moment=require(_0x2dff('0x1'));var BPromise=require('bluebird');var rs=require(_0x2dff('0x2'));var fs=require('fs');var Redis=require(_0x2dff('0x3'));var db=require(_0x2dff('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2dff('0x5'))(_0x2dff('0x6'));var config=require('../../config/environment');var jayson=require(_0x2dff('0x7'));var client=jayson[_0x2dff('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1016b6,_0x130815,_0x473ff1){return new BPromise(function(_0xbd0fcb,_0xe6ca48){return client[_0x2dff('0x9')](_0x1016b6,_0x473ff1)[_0x2dff('0xa')](function(_0x5ca57d){logger[_0x2dff('0xb')](_0x2dff('0xc'),_0x130815,_0x2dff('0xd'));logger[_0x2dff('0xe')](_0x2dff('0xf'),_0x130815,_0x2dff('0xd'),JSON[_0x2dff('0x10')](_0x5ca57d));if(_0x5ca57d[_0x2dff('0x11')]){if(_0x5ca57d[_0x2dff('0x11')][_0x2dff('0x12')]===0x1f4){logger[_0x2dff('0x11')](_0x2dff('0xc'),_0x130815,_0x5ca57d[_0x2dff('0x11')][_0x2dff('0x13')]);return _0xe6ca48(_0x5ca57d[_0x2dff('0x11')][_0x2dff('0x13')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x130815,_0x5ca57d[_0x2dff('0x11')][_0x2dff('0x13')]);return _0xbd0fcb(_0x5ca57d[_0x2dff('0x11')][_0x2dff('0x13')]);}else{logger['info'](_0x2dff('0xc'),_0x130815,_0x2dff('0xd'));_0xbd0fcb(_0x5ca57d[_0x2dff('0x14')][_0x2dff('0x13')]);}})[_0x2dff('0x15')](function(_0x409162){logger[_0x2dff('0x11')](_0x2dff('0xc'),_0x130815,_0x409162);_0xe6ca48(_0x409162);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 5b0c9ef..e3716b0 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 _0x2ce1=['post','put','update','destroy','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2ce1,0x8b));var _0x12ce=function(_0xc7c844,_0x364264){_0xc7c844=_0xc7c844-0x0;var _0x40281c=_0x2ce1[_0xc7c844];return _0x40281c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x12ce('0x0'));var express=require(_0x12ce('0x1'));var router=express[_0x12ce('0x2')]();var fs_extra=require(_0x12ce('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x12ce('0x4'));var config=require(_0x12ce('0x5'));var controller=require('./variable.controller');router[_0x12ce('0x6')]('/',auth[_0x12ce('0x7')](),controller[_0x12ce('0x8')]);router['get'](_0x12ce('0x9'),auth['isAuthenticated'](),controller[_0x12ce('0xa')]);router[_0x12ce('0xb')]('/',auth[_0x12ce('0x7')](),controller['create']);router[_0x12ce('0xc')](_0x12ce('0x9'),auth[_0x12ce('0x7')](),controller[_0x12ce('0xd')]);router['delete'](_0x12ce('0x9'),auth['isAuthenticated'](),controller[_0x12ce('0xe')]);module['exports']=router; \ No newline at end of file +var _0x383a=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','delete','exports','util','path','Router'];(function(_0x41382c,_0xc3ffd1){var _0x4da35b=function(_0x5d56b8){while(--_0x5d56b8){_0x41382c['push'](_0x41382c['shift']());}};_0x4da35b(++_0xc3ffd1);}(_0x383a,0x1ad));var _0xa383=function(_0x27e86e,_0x49d030){_0x27e86e=_0x27e86e-0x0;var _0x57d83e=_0x383a[_0x27e86e];return _0x57d83e;};'use strict';var multer=require('multer');var util=require(_0xa383('0x0'));var path=require(_0xa383('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa383('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa383('0x3'));var interaction=require(_0xa383('0x4'));var config=require(_0xa383('0x5'));var controller=require('./variable.controller');router['get']('/',auth[_0xa383('0x6')](),controller[_0xa383('0x7')]);router[_0xa383('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa383('0x6')](),controller['create']);router['put'](_0xa383('0x9'),auth[_0xa383('0x6')](),controller['update']);router[_0xa383('0xa')](_0xa383('0x9'),auth[_0xa383('0x6')](),controller['destroy']);module[_0xa383('0xb')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index ba3882a..5155edd 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 _0xb08b=['name','exports','STRING'];(function(_0x95675b,_0x88d868){var _0x2279e0=function(_0x155a3a){while(--_0x155a3a){_0x95675b['push'](_0x95675b['shift']());}};_0x2279e0(++_0x88d868);}(_0xb08b,0x181));var _0xbb08=function(_0x5dfdac,_0x5baf53){_0x5dfdac=_0x5dfdac-0x0;var _0x1a1559=_0xb08b[_0x5dfdac];return _0x1a1559;};'use strict';var Sequelize=require('sequelize');module[_0xbb08('0x0')]={'name':{'type':Sequelize[_0xbb08('0x1')],'unique':_0xbb08('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbb08('0x1')]}}; \ No newline at end of file +var _0x60b8=['STRING','sequelize','name'];(function(_0x168829,_0x59271c){var _0x5a5a4f=function(_0x255827){while(--_0x255827){_0x168829['push'](_0x168829['shift']());}};_0x5a5a4f(++_0x59271c);}(_0x60b8,0x1e4));var _0x860b=function(_0x143483,_0x1b3b00){_0x143483=_0x143483-0x0;var _0x2442de=_0x60b8[_0x143483];return _0x2442de;};'use strict';var Sequelize=require(_0x860b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x860b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x860b('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 80bca6e..07eab79 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 _0x0507=['type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','keys','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','eml-format','request-promise','mustache','util','path','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','json','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Variable','fieldName'];(function(_0x16eb19,_0x58cea4){var _0x312a25=function(_0x343702){while(--_0x343702){_0x16eb19['push'](_0x16eb19['shift']());}};_0x312a25(++_0x58cea4);}(_0x0507,0xf4));var _0x7050=function(_0x2e617a,_0x492591){_0x2e617a=_0x2e617a-0x0;var _0x31d1b9=_0x0507[_0x2e617a];return _0x31d1b9;};'use strict';var emlformat=require(_0x7050('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7050('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7050('0x2'));var util=require(_0x7050('0x3'));var path=require(_0x7050('0x4'));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(_0x7050('0x5'));var squel=require(_0x7050('0x6'));var crypto=require(_0x7050('0x7'));var jsforce=require(_0x7050('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x7050('0x9'));var querystring=require(_0x7050('0xa'));var Papa=require('papaparse');var Redis=require(_0x7050('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x7050('0xc'));var as=require(_0x7050('0xd'));var hardwareService=require(_0x7050('0xe'));var logger=require(_0x7050('0xf'))(_0x7050('0x10'));var utils=require('../../config/utils');var config=require(_0x7050('0x11'));var licenseUtil=require(_0x7050('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x414e6b,_0x24784b){_0x24784b=_0x24784b||0xcc;return function(_0xba1aca){if(_0xba1aca){return _0x414e6b[_0x7050('0x13')](_0x24784b);}return _0x414e6b[_0x7050('0x14')](_0x24784b)[_0x7050('0x15')]();};}function respondWithResult(_0x35775b,_0x58fb93){_0x58fb93=_0x58fb93||0xc8;return function(_0x2c4eee){if(_0x2c4eee){return _0x35775b[_0x7050('0x14')](_0x58fb93)['json'](_0x2c4eee);}};}function respondWithFilteredResult(_0x20fd31,_0x13b4e6){return function(_0x14c690){if(_0x14c690){var _0x36b0c3=typeof _0x13b4e6[_0x7050('0x16')]==='undefined'&&typeof _0x13b4e6[_0x7050('0x17')]==='undefined';var _0x443e2a=_0x14c690[_0x7050('0x18')];var _0xae2b53=_0x36b0c3?0x0:_0x13b4e6['offset'];var _0x5333e7=_0x36b0c3?_0x14c690[_0x7050('0x18')]:_0x13b4e6[_0x7050('0x16')]+_0x13b4e6[_0x7050('0x17')];var _0x392f44;if(_0x5333e7>=_0x443e2a){_0x5333e7=_0x443e2a;_0x392f44=0xc8;}else{_0x392f44=0xce;}_0x20fd31['status'](_0x392f44);return _0x20fd31['set']('Content-Range',_0xae2b53+'-'+_0x5333e7+'/'+_0x443e2a)[_0x7050('0x19')](_0x14c690);}return null;};}function patchUpdates(_0x547ce2){return function(_0x5f2c14){try{jsonpatch['apply'](_0x5f2c14,_0x547ce2,!![]);}catch(_0x3b94a5){return BPromise[_0x7050('0x1a')](_0x3b94a5);}return _0x5f2c14['save']();};}function saveUpdates(_0x11b34a,_0xf8335c){return function(_0x359a8e){if(_0x359a8e){return _0x359a8e[_0x7050('0x1b')](_0x11b34a)[_0x7050('0x1c')](function(_0x39d1f9){return _0x39d1f9;});}return null;};}function removeEntity(_0x175640,_0x390a4a){return function(_0x47efac){if(_0x47efac){return _0x47efac['destroy']()[_0x7050('0x1c')](function(){var _0x13af97=_0x47efac[_0x7050('0x1d')]({'plain':!![]});var _0x5c2089='Variables';return db[_0x7050('0x1e')][_0x7050('0x1f')]({'where':{'type':_0x5c2089,'resourceId':_0x13af97['id']}})[_0x7050('0x1c')](function(){return _0x47efac;});})['then'](function(){_0x175640['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f4924,_0x16bdbd){return function(_0x17a6c8){if(!_0x17a6c8){_0x5f4924[_0x7050('0x13')](0x194);}return _0x17a6c8;};}function handleError(_0x2afa20,_0x1b212d){_0x1b212d=_0x1b212d||0x1f4;return function(_0x470948){logger[_0x7050('0x20')](_0x470948[_0x7050('0x21')]);if(_0x470948[_0x7050('0x22')]){delete _0x470948[_0x7050('0x22')];}_0x2afa20[_0x7050('0x14')](_0x1b212d)[_0x7050('0x23')](_0x470948);};}exports[_0x7050('0x24')]=function(_0x1b0d19,_0x46a0d7){var _0x3fee31={},_0x37b111={},_0x266350={'count':0x0,'rows':[]};var _0x3e0db6=_[_0x7050('0x25')](db[_0x7050('0x26')]['rawAttributes'],function(_0xa5963a){return{'name':_0xa5963a[_0x7050('0x27')],'type':_0xa5963a[_0x7050('0x28')][_0x7050('0x29')]};});_0x37b111['model']=_[_0x7050('0x25')](_0x3e0db6,_0x7050('0x22'));_0x37b111[_0x7050('0x2a')]=_['keys'](_0x1b0d19[_0x7050('0x2a')]);_0x37b111['filters']=_[_0x7050('0x2b')](_0x37b111[_0x7050('0x2c')],_0x37b111[_0x7050('0x2a')]);_0x3fee31[_0x7050('0x2d')]=_[_0x7050('0x2b')](_0x37b111[_0x7050('0x2c')],qs[_0x7050('0x2e')](_0x1b0d19[_0x7050('0x2a')][_0x7050('0x2e')]));_0x3fee31['attributes']=_0x3fee31['attributes']['length']?_0x3fee31[_0x7050('0x2d')]:_0x37b111[_0x7050('0x2c')];if(!_0x1b0d19[_0x7050('0x2a')][_0x7050('0x2f')]('nolimit')){_0x3fee31[_0x7050('0x17')]=qs['limit'](_0x1b0d19[_0x7050('0x2a')][_0x7050('0x17')]);_0x3fee31[_0x7050('0x16')]=qs[_0x7050('0x16')](_0x1b0d19[_0x7050('0x2a')][_0x7050('0x16')]);}_0x3fee31[_0x7050('0x30')]=qs['sort'](_0x1b0d19[_0x7050('0x2a')][_0x7050('0x31')]);_0x3fee31[_0x7050('0x32')]=qs[_0x7050('0x33')](_[_0x7050('0x34')](_0x1b0d19[_0x7050('0x2a')],_0x37b111[_0x7050('0x33')]),_0x3e0db6);if(_0x1b0d19['query'][_0x7050('0x35')]){_0x3fee31[_0x7050('0x32')]=_[_0x7050('0x36')](_0x3fee31[_0x7050('0x32')],{'$or':_[_0x7050('0x25')](_0x3e0db6,function(_0x54c531){if(_0x54c531[_0x7050('0x28')]!=='VIRTUAL'){var _0x16a6b0={};_0x16a6b0[_0x54c531[_0x7050('0x22')]]={'$like':'%'+_0x1b0d19[_0x7050('0x2a')]['filter']+'%'};return _0x16a6b0;}})});}_0x3fee31=_[_0x7050('0x36')]({},_0x3fee31,_0x1b0d19[_0x7050('0x37')]);var _0x124fc5={'where':_0x3fee31['where']};return db[_0x7050('0x26')][_0x7050('0x18')](_0x124fc5)['then'](function(_0x54d8d3){_0x266350[_0x7050('0x18')]=_0x54d8d3;if(_0x1b0d19[_0x7050('0x2a')][_0x7050('0x38')]){_0x3fee31[_0x7050('0x39')]=[{'all':!![]}];}return db[_0x7050('0x26')]['findAll'](_0x3fee31);})['then'](function(_0x9cc1db){_0x266350[_0x7050('0x3a')]=_0x9cc1db;return _0x266350;})[_0x7050('0x1c')](respondWithFilteredResult(_0x46a0d7,_0x3fee31))['catch'](handleError(_0x46a0d7,null));};exports[_0x7050('0x3b')]=function(_0xea0d49,_0x3e969c){var _0xccfde={'raw':!![],'where':{'id':_0xea0d49[_0x7050('0x3c')]['id']}},_0xb90ed6={};_0xb90ed6['model']=_[_0x7050('0x3d')](db['Variable'][_0x7050('0x3e')]);_0xb90ed6[_0x7050('0x2a')]=_['keys'](_0xea0d49[_0x7050('0x2a')]);_0xb90ed6[_0x7050('0x33')]=_[_0x7050('0x2b')](_0xb90ed6[_0x7050('0x2c')],_0xb90ed6['query']);_0xccfde[_0x7050('0x2d')]=_['intersection'](_0xb90ed6['model'],qs['fields'](_0xea0d49[_0x7050('0x2a')][_0x7050('0x2e')]));_0xccfde[_0x7050('0x2d')]=_0xccfde[_0x7050('0x2d')]['length']?_0xccfde[_0x7050('0x2d')]:_0xb90ed6[_0x7050('0x2c')];if(_0xea0d49[_0x7050('0x2a')]['includeAll']){_0xccfde[_0x7050('0x39')]=[{'all':!![]}];}_0xccfde=_[_0x7050('0x36')]({},_0xccfde,_0xea0d49[_0x7050('0x37')]);return db['Variable'][_0x7050('0x3f')](_0xccfde)[_0x7050('0x1c')](handleEntityNotFound(_0x3e969c,null))[_0x7050('0x1c')](respondWithResult(_0x3e969c,null))[_0x7050('0x40')](handleError(_0x3e969c,null));};exports[_0x7050('0x41')]=function(_0x15bd0a,_0x19843d){return db[_0x7050('0x26')][_0x7050('0x41')](_0x15bd0a[_0x7050('0x42')],{})[_0x7050('0x1c')](function(_0x12dc18){var _0xd512b7=_0x15bd0a[_0x7050('0x43')]['get']({'plain':!![]});if(!_0xd512b7)throw new Error(_0x7050('0x44'));if(_0xd512b7[_0x7050('0x45')]===_0x7050('0x43')){var _0x3d1111=_0x12dc18[_0x7050('0x1d')]({'plain':!![]});var _0x1ede87='Variables';return db['UserProfileSection']['find']({'where':{'name':_0x1ede87,'userProfileId':_0xd512b7[_0x7050('0x46')]},'raw':!![]})['then'](function(_0x297661){if(_0x297661&&_0x297661['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3d1111['name'],'resourceId':_0x3d1111['id'],'type':_0x297661[_0x7050('0x22')],'sectionId':_0x297661['id']},{})[_0x7050('0x1c')](function(){return _0x12dc18;});}else{return _0x12dc18;}})[_0x7050('0x40')](function(_0x157682){logger[_0x7050('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x157682);throw _0x157682;});}return _0x12dc18;})['then'](respondWithResult(_0x19843d,0xc9))[_0x7050('0x40')](handleError(_0x19843d,null));};exports[_0x7050('0x1b')]=function(_0x5dce44,_0x2ec510){if(_0x5dce44[_0x7050('0x42')]['id']){delete _0x5dce44['body']['id'];}return db[_0x7050('0x26')][_0x7050('0x3f')]({'where':{'id':_0x5dce44[_0x7050('0x3c')]['id']}})[_0x7050('0x1c')](handleEntityNotFound(_0x2ec510,null))[_0x7050('0x1c')](saveUpdates(_0x5dce44[_0x7050('0x42')],null))[_0x7050('0x1c')](respondWithResult(_0x2ec510,null))[_0x7050('0x40')](handleError(_0x2ec510,null));};exports['destroy']=function(_0x2b295a,_0x26c113){return db['Variable']['find']({'where':{'id':_0x2b295a[_0x7050('0x3c')]['id']}})['then'](handleEntityNotFound(_0x26c113,null))[_0x7050('0x1c')](removeEntity(_0x26c113,null))['catch'](handleError(_0x26c113,null));}; \ No newline at end of file +var _0xec27=['offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','get','Variables','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x28fca4,_0x11e78b){var _0x42fd01=function(_0x33a97e){while(--_0x33a97e){_0x28fca4['push'](_0x28fca4['shift']());}};_0x42fd01(++_0x11e78b);}(_0xec27,0x1d7));var _0x7ec2=function(_0x352dc1,_0x18af1e){_0x352dc1=_0x352dc1-0x0;var _0x581c3f=_0xec27[_0x352dc1];return _0x581c3f;};'use strict';var emlformat=require(_0x7ec2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7ec2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ec2('0x2'));var moment=require(_0x7ec2('0x3'));var BPromise=require(_0x7ec2('0x4'));var Mustache=require('mustache');var util=require(_0x7ec2('0x5'));var path=require(_0x7ec2('0x6'));var sox=require(_0x7ec2('0x7'));var csv=require(_0x7ec2('0x8'));var ejs=require(_0x7ec2('0x9'));var fs=require('fs');var fs_extra=require(_0x7ec2('0xa'));var _=require(_0x7ec2('0xb'));var squel=require(_0x7ec2('0xc'));var crypto=require(_0x7ec2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7ec2('0xe'));var toCsv=require(_0x7ec2('0x8'));var querystring=require(_0x7ec2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7ec2('0x10'));var qs=require(_0x7ec2('0x11'));var as=require(_0x7ec2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ec2('0x13'))('api');var utils=require(_0x7ec2('0x14'));var config=require(_0x7ec2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ec2('0x16'))['db'];function respondWithStatusCode(_0x57dd9c,_0x193e4c){_0x193e4c=_0x193e4c||0xcc;return function(_0x28387d){if(_0x28387d){return _0x57dd9c[_0x7ec2('0x17')](_0x193e4c);}return _0x57dd9c[_0x7ec2('0x18')](_0x193e4c)[_0x7ec2('0x19')]();};}function respondWithResult(_0x452938,_0x4609c2){_0x4609c2=_0x4609c2||0xc8;return function(_0x286b18){if(_0x286b18){return _0x452938[_0x7ec2('0x18')](_0x4609c2)[_0x7ec2('0x1a')](_0x286b18);}};}function respondWithFilteredResult(_0x743506,_0x4fae41){return function(_0x2f7725){if(_0x2f7725){var _0x265450=typeof _0x4fae41[_0x7ec2('0x1b')]==='undefined'&&typeof _0x4fae41['limit']===_0x7ec2('0x1c');var _0x20327b=_0x2f7725[_0x7ec2('0x1d')];var _0x3df892=_0x265450?0x0:_0x4fae41[_0x7ec2('0x1b')];var _0x3c3340=_0x265450?_0x2f7725[_0x7ec2('0x1d')]:_0x4fae41['offset']+_0x4fae41[_0x7ec2('0x1e')];var _0x479161;if(_0x3c3340>=_0x20327b){_0x3c3340=_0x20327b;_0x479161=0xc8;}else{_0x479161=0xce;}_0x743506[_0x7ec2('0x18')](_0x479161);return _0x743506[_0x7ec2('0x1f')](_0x7ec2('0x20'),_0x3df892+'-'+_0x3c3340+'/'+_0x20327b)[_0x7ec2('0x1a')](_0x2f7725);}return null;};}function patchUpdates(_0x1214ec){return function(_0x389bb6){try{jsonpatch[_0x7ec2('0x21')](_0x389bb6,_0x1214ec,!![]);}catch(_0x24b864){return BPromise['reject'](_0x24b864);}return _0x389bb6[_0x7ec2('0x22')]();};}function saveUpdates(_0x47e0c3,_0x56aa72){return function(_0x8bd7bd){if(_0x8bd7bd){return _0x8bd7bd[_0x7ec2('0x23')](_0x47e0c3)['then'](function(_0x34bf1f){return _0x34bf1f;});}return null;};}function removeEntity(_0x5f2efd,_0x40c962){return function(_0x4f1ac5){if(_0x4f1ac5){return _0x4f1ac5[_0x7ec2('0x24')]()[_0x7ec2('0x25')](function(){var _0x312f43=_0x4f1ac5[_0x7ec2('0x26')]({'plain':!![]});var _0xc4452c=_0x7ec2('0x27');return db['UserProfileResource'][_0x7ec2('0x24')]({'where':{'type':_0xc4452c,'resourceId':_0x312f43['id']}})[_0x7ec2('0x25')](function(){return _0x4f1ac5;});})[_0x7ec2('0x25')](function(){_0x5f2efd[_0x7ec2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0298,_0x343c67){return function(_0x219205){if(!_0x219205){_0x1d0298[_0x7ec2('0x17')](0x194);}return _0x219205;};}function handleError(_0x44c94e,_0x4898d7){_0x4898d7=_0x4898d7||0x1f4;return function(_0x40181d){logger[_0x7ec2('0x28')](_0x40181d[_0x7ec2('0x29')]);if(_0x40181d[_0x7ec2('0x2a')]){delete _0x40181d['name'];}_0x44c94e[_0x7ec2('0x18')](_0x4898d7)['send'](_0x40181d);};}exports[_0x7ec2('0x2b')]=function(_0x1fe9cf,_0x20bcb3){var _0x52caf8={},_0x35d15d={},_0x136fb9={'count':0x0,'rows':[]};var _0x1a8b7e=_[_0x7ec2('0x2c')](db[_0x7ec2('0x2d')][_0x7ec2('0x2e')],function(_0x2deb93){return{'name':_0x2deb93[_0x7ec2('0x2f')],'type':_0x2deb93[_0x7ec2('0x30')][_0x7ec2('0x31')]};});_0x35d15d[_0x7ec2('0x32')]=_[_0x7ec2('0x2c')](_0x1a8b7e,_0x7ec2('0x2a'));_0x35d15d[_0x7ec2('0x33')]=_[_0x7ec2('0x34')](_0x1fe9cf['query']);_0x35d15d[_0x7ec2('0x35')]=_['intersection'](_0x35d15d['model'],_0x35d15d[_0x7ec2('0x33')]);_0x52caf8[_0x7ec2('0x36')]=_['intersection'](_0x35d15d[_0x7ec2('0x32')],qs['fields'](_0x1fe9cf[_0x7ec2('0x33')]['fields']));_0x52caf8['attributes']=_0x52caf8[_0x7ec2('0x36')][_0x7ec2('0x37')]?_0x52caf8[_0x7ec2('0x36')]:_0x35d15d[_0x7ec2('0x32')];if(!_0x1fe9cf[_0x7ec2('0x33')][_0x7ec2('0x38')](_0x7ec2('0x39'))){_0x52caf8[_0x7ec2('0x1e')]=qs['limit'](_0x1fe9cf[_0x7ec2('0x33')][_0x7ec2('0x1e')]);_0x52caf8[_0x7ec2('0x1b')]=qs[_0x7ec2('0x1b')](_0x1fe9cf[_0x7ec2('0x33')][_0x7ec2('0x1b')]);}_0x52caf8[_0x7ec2('0x3a')]=qs[_0x7ec2('0x3b')](_0x1fe9cf[_0x7ec2('0x33')][_0x7ec2('0x3b')]);_0x52caf8[_0x7ec2('0x3c')]=qs[_0x7ec2('0x35')](_[_0x7ec2('0x3d')](_0x1fe9cf[_0x7ec2('0x33')],_0x35d15d[_0x7ec2('0x35')]),_0x1a8b7e);if(_0x1fe9cf[_0x7ec2('0x33')][_0x7ec2('0x3e')]){_0x52caf8[_0x7ec2('0x3c')]=_['merge'](_0x52caf8[_0x7ec2('0x3c')],{'$or':_['map'](_0x1a8b7e,function(_0x464fa3){if(_0x464fa3[_0x7ec2('0x30')]!==_0x7ec2('0x3f')){var _0x42ce9e={};_0x42ce9e[_0x464fa3[_0x7ec2('0x2a')]]={'$like':'%'+_0x1fe9cf['query'][_0x7ec2('0x3e')]+'%'};return _0x42ce9e;}})});}_0x52caf8=_['merge']({},_0x52caf8,_0x1fe9cf[_0x7ec2('0x40')]);var _0x877236={'where':_0x52caf8['where']};return db[_0x7ec2('0x2d')][_0x7ec2('0x1d')](_0x877236)[_0x7ec2('0x25')](function(_0x4fa131){_0x136fb9[_0x7ec2('0x1d')]=_0x4fa131;if(_0x1fe9cf['query']['includeAll']){_0x52caf8[_0x7ec2('0x41')]=[{'all':!![]}];}return db[_0x7ec2('0x2d')][_0x7ec2('0x42')](_0x52caf8);})[_0x7ec2('0x25')](function(_0x4631c7){_0x136fb9['rows']=_0x4631c7;return _0x136fb9;})['then'](respondWithFilteredResult(_0x20bcb3,_0x52caf8))[_0x7ec2('0x43')](handleError(_0x20bcb3,null));};exports[_0x7ec2('0x44')]=function(_0x41c110,_0x10bf07){var _0x3fc847={'raw':!![],'where':{'id':_0x41c110[_0x7ec2('0x45')]['id']}},_0x42c00b={};_0x42c00b[_0x7ec2('0x32')]=_['keys'](db['Variable'][_0x7ec2('0x2e')]);_0x42c00b[_0x7ec2('0x33')]=_[_0x7ec2('0x34')](_0x41c110['query']);_0x42c00b['filters']=_['intersection'](_0x42c00b['model'],_0x42c00b[_0x7ec2('0x33')]);_0x3fc847[_0x7ec2('0x36')]=_[_0x7ec2('0x46')](_0x42c00b[_0x7ec2('0x32')],qs['fields'](_0x41c110['query']['fields']));_0x3fc847[_0x7ec2('0x36')]=_0x3fc847[_0x7ec2('0x36')][_0x7ec2('0x37')]?_0x3fc847[_0x7ec2('0x36')]:_0x42c00b[_0x7ec2('0x32')];if(_0x41c110[_0x7ec2('0x33')][_0x7ec2('0x47')]){_0x3fc847[_0x7ec2('0x41')]=[{'all':!![]}];}_0x3fc847=_[_0x7ec2('0x48')]({},_0x3fc847,_0x41c110[_0x7ec2('0x40')]);return db['Variable'][_0x7ec2('0x49')](_0x3fc847)['then'](handleEntityNotFound(_0x10bf07,null))[_0x7ec2('0x25')](respondWithResult(_0x10bf07,null))[_0x7ec2('0x43')](handleError(_0x10bf07,null));};exports[_0x7ec2('0x4a')]=function(_0x366adc,_0x18ee1e){return db['Variable'][_0x7ec2('0x4a')](_0x366adc[_0x7ec2('0x4b')],{})[_0x7ec2('0x25')](function(_0x59f127){var _0x59a429=_0x366adc['user'][_0x7ec2('0x26')]({'plain':!![]});if(!_0x59a429)throw new Error(_0x7ec2('0x4c'));if(_0x59a429[_0x7ec2('0x4d')]===_0x7ec2('0x4e')){var _0xf719a7=_0x59f127[_0x7ec2('0x26')]({'plain':!![]});var _0x39a6fd=_0x7ec2('0x27');return db['UserProfileSection'][_0x7ec2('0x49')]({'where':{'name':_0x39a6fd,'userProfileId':_0x59a429[_0x7ec2('0x4f')]},'raw':!![]})[_0x7ec2('0x25')](function(_0x2997a7){if(_0x2997a7&&_0x2997a7[_0x7ec2('0x50')]===0x0){return db[_0x7ec2('0x51')][_0x7ec2('0x4a')]({'name':_0xf719a7[_0x7ec2('0x2a')],'resourceId':_0xf719a7['id'],'type':_0x2997a7[_0x7ec2('0x2a')],'sectionId':_0x2997a7['id']},{})[_0x7ec2('0x25')](function(){return _0x59f127;});}else{return _0x59f127;}})[_0x7ec2('0x43')](function(_0x42920a){logger[_0x7ec2('0x28')](_0x7ec2('0x52'),_0x42920a);throw _0x42920a;});}return _0x59f127;})[_0x7ec2('0x25')](respondWithResult(_0x18ee1e,0xc9))[_0x7ec2('0x43')](handleError(_0x18ee1e,null));};exports[_0x7ec2('0x23')]=function(_0x486305,_0x2f1f62){if(_0x486305['body']['id']){delete _0x486305[_0x7ec2('0x4b')]['id'];}return db[_0x7ec2('0x2d')][_0x7ec2('0x49')]({'where':{'id':_0x486305[_0x7ec2('0x45')]['id']}})[_0x7ec2('0x25')](handleEntityNotFound(_0x2f1f62,null))[_0x7ec2('0x25')](saveUpdates(_0x486305[_0x7ec2('0x4b')],null))['then'](respondWithResult(_0x2f1f62,null))[_0x7ec2('0x43')](handleError(_0x2f1f62,null));};exports[_0x7ec2('0x24')]=function(_0x1748b9,_0x68ed09){return db[_0x7ec2('0x2d')]['find']({'where':{'id':_0x1748b9[_0x7ec2('0x45')]['id']}})['then'](handleEntityNotFound(_0x68ed09,null))[_0x7ec2('0x25')](removeEntity(_0x68ed09,null))['catch'](handleError(_0x68ed09,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 9423f97..e071551 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 _0x88d2=['request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash','util','../../config/logger','moment','bluebird'];(function(_0x480fc8,_0xa2c287){var _0x16686d=function(_0x1c666d){while(--_0x1c666d){_0x480fc8['push'](_0x480fc8['shift']());}};_0x16686d(++_0xa2c287);}(_0x88d2,0x1db));var _0x288d=function(_0x310800,_0xcebc26){_0x310800=_0x310800-0x0;var _0x56aa0a=_0x88d2[_0x310800];return _0x56aa0a;};'use strict';var _=require(_0x288d('0x0'));var util=require(_0x288d('0x1'));var logger=require(_0x288d('0x2'))('api');var moment=require(_0x288d('0x3'));var BPromise=require(_0x288d('0x4'));var rp=require(_0x288d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x288d('0x6'));var config=require(_0x288d('0x7'));var attributes=require(_0x288d('0x8'));module[_0x288d('0x9')]=function(_0x564987,_0x2defab){return _0x564987[_0x288d('0xa')](_0x288d('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0560=['define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes'];(function(_0x587e9d,_0x1702b7){var _0x81a2e1=function(_0x43d871){while(--_0x43d871){_0x587e9d['push'](_0x587e9d['shift']());}};_0x81a2e1(++_0x1702b7);}(_0x0560,0xab));var _0x0056=function(_0x42f162,_0x3536ed){_0x42f162=_0x42f162-0x0;var _0x30f077=_0x0560[_0x42f162];return _0x30f077;};'use strict';var _=require(_0x0056('0x0'));var util=require(_0x0056('0x1'));var logger=require(_0x0056('0x2'))(_0x0056('0x3'));var moment=require(_0x0056('0x4'));var BPromise=require(_0x0056('0x5'));var rp=require(_0x0056('0x6'));var fs=require('fs');var path=require(_0x0056('0x7'));var rimraf=require(_0x0056('0x8'));var config=require(_0x0056('0x9'));var attributes=require(_0x0056('0xa'));module['exports']=function(_0x434ac7,_0x4eb07e){return _0x434ac7[_0x0056('0xb')](_0x0056('0xc'),attributes,{'tableName':_0x0056('0xd'),'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 eec4595..6fb9158 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0xc0921a,_0x1f107f){var _0x3f6189=function(_0x5cd2fe){while(--_0x5cd2fe){_0xc0921a['push'](_0xc0921a['shift']());}};_0x3f6189(++_0x1f107f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0x5fc3[_0x29e35f];return _0x266b74;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +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(_0x1cde38,_0x4b85b9){var _0x42af72=function(_0x516e45){while(--_0x516e45){_0x1cde38['push'](_0x1cde38['shift']());}};_0x42af72(++_0x4b85b9);}(_0x3e74,0x175));var _0x43e7=function(_0x211fe2,_0x29e1e8){_0x211fe2=_0x211fe2-0x0;var _0x287ff5=_0x3e74[_0x211fe2];return _0x287ff5;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index fc1792d..ac4cb04 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 _0xb0e0=['/migrations','migrations','exports','Router','index','get','/fetch','isAuthenticated','canUpdate','reset','restart'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0xb0e0,0xa8));var _0x0b0e=function(_0x1f43a6,_0x257d2f){_0x1f43a6=_0x1f43a6-0x0;var _0x5eed9e=_0xb0e0[_0x1f43a6];return _0x5eed9e;};'use strict';var express=require('express');var router=express[_0x0b0e('0x0')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router['get']('/',controller[_0x0b0e('0x1')]);router[_0x0b0e('0x2')](_0x0b0e('0x3'),auth[_0x0b0e('0x4')](),auth[_0x0b0e('0x5')](),controller['fetch']);router[_0x0b0e('0x2')]('/reset',auth[_0x0b0e('0x4')](),auth[_0x0b0e('0x5')](),controller[_0x0b0e('0x6')]);router[_0x0b0e('0x2')]('/pull',auth[_0x0b0e('0x4')](),auth['canUpdate'](),controller['pull']);router['get']('/restart',auth[_0x0b0e('0x4')](),controller[_0x0b0e('0x7')]);router[_0x0b0e('0x2')](_0x0b0e('0x8'),controller[_0x0b0e('0x9')]);module[_0x0b0e('0xa')]=router; \ No newline at end of file +var _0xb153=['/pull','pull','/restart','restart','migrations','express','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset'];(function(_0x2d7cc4,_0x59c621){var _0x1d1410=function(_0x335444){while(--_0x335444){_0x2d7cc4['push'](_0x2d7cc4['shift']());}};_0x1d1410(++_0x59c621);}(_0xb153,0x12b));var _0x3b15=function(_0x356ac6,_0x27bbf0){_0x356ac6=_0x356ac6-0x0;var _0x332cd3=_0xb153[_0x356ac6];return _0x332cd3;};'use strict';var express=require(_0x3b15('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x3b15('0x1'));router[_0x3b15('0x2')]('/',controller['index']);router['get'](_0x3b15('0x3'),auth[_0x3b15('0x4')](),auth[_0x3b15('0x5')](),controller[_0x3b15('0x6')]);router[_0x3b15('0x2')](_0x3b15('0x7'),auth['isAuthenticated'](),auth[_0x3b15('0x5')](),controller[_0x3b15('0x8')]);router[_0x3b15('0x2')](_0x3b15('0x9'),auth['isAuthenticated'](),auth[_0x3b15('0x5')](),controller[_0x3b15('0xa')]);router[_0x3b15('0x2')](_0x3b15('0xb'),auth[_0x3b15('0x4')](),controller[_0x3b15('0xc')]);router[_0x3b15('0x2')]('/migrations',controller[_0x3b15('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 355e9c3..757868c 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 _0x84f8=['child_process','exec','../../mysqldb','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','tags','status','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','json','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x84f8,0xcf));var _0x884f=function(_0x5ec206,_0x554d38){_0x5ec206=_0x5ec206-0x0;var _0x366f25=_0x84f8[_0x5ec206];return _0x366f25;};'use strict';var Umzug=require(_0x884f('0x0'));var path=require(_0x884f('0x1'));var fs=require('fs');var _=require(_0x884f('0x2'));var pkginfo=require('pkginfo')(module,_0x884f('0x3'));var compareVersions=require(_0x884f('0x4'));var exec=require(_0x884f('0x5'))[_0x884f('0x6')];var db=require(_0x884f('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x884f('0x8'));var logger=require('../../config/logger')(_0x884f('0x9'));var git=require(_0x884f('0xa'))(config[_0x884f('0xb')]);exports[_0x884f('0xc')]=function(_0x3d31cb,_0x28dd5c){var _0x4a6521={'current':module[_0x884f('0xd')][_0x884f('0x3')],'phonebar':0x2};if(_0x3d31cb[_0x884f('0xe')]&&_0x3d31cb[_0x884f('0xe')][_0x884f('0xf')]){return git[_0x884f('0x10')]()[_0x884f('0x11')](function(_0xd44f9f,_0x3f4897){_0x4a6521[_0x884f('0xf')]=(_0xd44f9f?module[_0x884f('0xd')]['version']:_0x3f4897[_0x884f('0xf')])||'2.0.0';return _0x28dd5c[_0x884f('0x12')](0xc8)['json'](_0x4a6521);});}else{return _0x28dd5c[_0x884f('0x12')](0xc8)['json'](_0x4a6521);}};exports[_0x884f('0x10')]=function(_0x154d58,_0xae3d5a){return git[_0x884f('0x10')]([_0x884f('0x13'),'master'],function(_0x34de86){if(_0x34de86){logger[_0x884f('0x14')](_0x34de86);return _0xae3d5a[_0x884f('0x12')](0x1f4)['json'](_0x34de86);}logger[_0x884f('0x15')](_0x884f('0x16'));return _0xae3d5a[_0x884f('0x12')](0xc8)['json']({'output':_0x884f('0x17')});});};exports['reset']=function(_0x2b3a77,_0x22b14a){return git[_0x884f('0x18')]([_0x884f('0x19'),_0x884f('0x1a')],function(_0x438e6c){if(_0x438e6c){logger[_0x884f('0x14')](_0x438e6c);return _0x22b14a[_0x884f('0x12')](0x1f4)[_0x884f('0x1b')](_0x438e6c);}logger[_0x884f('0x15')](_0x884f('0x1c'));return _0x22b14a['status'](0xc8)[_0x884f('0x1b')]({'output':_0x884f('0x1d')});});};exports[_0x884f('0x1e')]=function(_0x4b4088,_0x14a16a){exec('npm\x20install\x20--production',function(_0x249465,_0x4312a0,_0x41ebc0){logger[_0x884f('0x15')](_0x4312a0);logger[_0x884f('0x15')](_0x41ebc0);if(_0x249465){logger[_0x884f('0x14')](_0x249465);return _0x14a16a[_0x884f('0x12')](0x1f4)[_0x884f('0x1b')](_0x249465);}return _0x14a16a['status'](0xc8)[_0x884f('0x1b')]({'output':_0x4312a0});});};exports[_0x884f('0x1f')]=function(_0x8e1318,_0x209d01){return pm2[_0x884f('0x1f')](_0x884f('0x20'))[_0x884f('0x21')](function(_0x5bf54c){logger['info'](_0x884f('0x22'),_0x5bf54c);return _0x209d01[_0x884f('0x12')](0xc8)[_0x884f('0x1b')]({'output':_0x884f('0x23')});})[_0x884f('0x24')](function(_0x24bc35){logger['error'](_0x24bc35);return _0x209d01['status'](0x1f4)[_0x884f('0x1b')](_0x24bc35);});};exports[_0x884f('0x25')]=function(_0x3ee7bc,_0x15cb87){var _0x9aaa95=fs['readdirSync'](path[_0x884f('0x26')](config[_0x884f('0xb')],_0x884f('0x27'),_0x884f('0x25')));var _0x6f1860=[];for(var _0x390f34=0x0;_0x390f34<_0x9aaa95[_0x884f('0x28')];_0x390f34++){var _0x1727f3=_0x9aaa95[_0x390f34]['replace'](_0x884f('0x29'),'');if(compareVersions(module[_0x884f('0xd')][_0x884f('0x3')],_0x1727f3)===-0x1){_0x6f1860[_0x884f('0x2a')](_0x1727f3);}}if(_0x6f1860[_0x884f('0x28')]){var _0x3de848=_0x6f1860[_0x884f('0x2b')](compareVersions);var _0x25dbf0=new Umzug({'storage':_0x884f('0x2c'),'storageOptions':{'model':db[_0x884f('0x2d')],'modelName':_0x884f('0x2d'),'columnName':_0x884f('0x3')},'migrations':{'params':[db['sequelize'][_0x884f('0x2e')](),db[_0x884f('0x2c')][_0x884f('0x2f')],function(){throw new Error(_0x884f('0x30'));}],'path':path[_0x884f('0x26')](config[_0x884f('0xb')],'server',_0x884f('0x25')),'pattern':/\.js$/}});_0x25dbf0['up']({'migrations':_[_0x884f('0x31')](_0x3de848,function(_0x222e2d){return _0x222e2d+'.js';})})[_0x884f('0x21')](function(){return _0x15cb87[_0x884f('0x12')](0xc8)['json']({'output':_0x884f('0x32')+module['exports'][_0x884f('0x3')]+'\x20to\x20'+_['last'](_0x3de848),'migrations':_[_0x884f('0x26')](_0x3de848)});})[_0x884f('0x24')](function(_0x51cb52){if(_0x51cb52 instanceof db[_0x884f('0x2c')][_0x884f('0x33')]){return _0x15cb87[_0x884f('0x12')](0xc8)[_0x884f('0x1b')]({'output':_0x884f('0x34')});}else{return _0x15cb87[_0x884f('0x12')](0x1f4)[_0x884f('0x1b')](_0x51cb52);}});}else{return _0x15cb87[_0x884f('0x12')](0xc8)['json']({'output':_0x884f('0x34')});}}; \ No newline at end of file +var _0x5149=['pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','root','server','migrations','length','replace','.js','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','index','exports','query','latest','tags','2.0.0','status','json','fetch','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard'];(function(_0xddfe05,_0x57b987){var _0x42b95e=function(_0x30699b){while(--_0x30699b){_0xddfe05['push'](_0xddfe05['shift']());}};_0x42b95e(++_0x57b987);}(_0x5149,0x12d));var _0x9514=function(_0x3c3864,_0x463067){_0x3c3864=_0x3c3864-0x0;var _0x3bc205=_0x5149[_0x3c3864];return _0x3bc205;};'use strict';var Umzug=require(_0x9514('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x9514('0x1'))(module,_0x9514('0x2'));var compareVersions=require(_0x9514('0x3'));var exec=require(_0x9514('0x4'))[_0x9514('0x5')];var db=require(_0x9514('0x6'))['db'];var config=require(_0x9514('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x9514('0x8'))(_0x9514('0x9'));var git=require(_0x9514('0xa'))(config['root']);exports[_0x9514('0xb')]=function(_0x35bbff,_0x38bf94){var _0x5325c3={'current':module[_0x9514('0xc')][_0x9514('0x2')],'phonebar':0x2};if(_0x35bbff[_0x9514('0xd')]&&_0x35bbff[_0x9514('0xd')][_0x9514('0xe')]){return git['fetch']()[_0x9514('0xf')](function(_0x37344b,_0x2c4efe){_0x5325c3['latest']=(_0x37344b?module[_0x9514('0xc')][_0x9514('0x2')]:_0x2c4efe['latest'])||_0x9514('0x10');return _0x38bf94[_0x9514('0x11')](0xc8)[_0x9514('0x12')](_0x5325c3);});}else{return _0x38bf94[_0x9514('0x11')](0xc8)[_0x9514('0x12')](_0x5325c3);}};exports[_0x9514('0x13')]=function(_0x5c51da,_0x575216){return git['fetch']([_0x9514('0x14'),'master'],function(_0x43f029){if(_0x43f029){logger[_0x9514('0x15')](_0x43f029);return _0x575216[_0x9514('0x11')](0x1f4)[_0x9514('0x12')](_0x43f029);}logger[_0x9514('0x16')](_0x9514('0x17'));return _0x575216['status'](0xc8)[_0x9514('0x12')]({'output':_0x9514('0x18')});});};exports['reset']=function(_0x10669d,_0x12ec42){return git[_0x9514('0x19')]([_0x9514('0x1a'),_0x9514('0x1b')],function(_0x3bcf2e){if(_0x3bcf2e){logger[_0x9514('0x15')](_0x3bcf2e);return _0x12ec42[_0x9514('0x11')](0x1f4)[_0x9514('0x12')](_0x3bcf2e);}logger[_0x9514('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x12ec42[_0x9514('0x11')](0xc8)['json']({'output':_0x9514('0x1c')});});};exports[_0x9514('0x1d')]=function(_0x1fce46,_0x5788cc){exec(_0x9514('0x1e'),function(_0xb09474,_0x450a5e,_0x40869e){logger[_0x9514('0x16')](_0x450a5e);logger[_0x9514('0x16')](_0x40869e);if(_0xb09474){logger[_0x9514('0x15')](_0xb09474);return _0x5788cc[_0x9514('0x11')](0x1f4)[_0x9514('0x12')](_0xb09474);}return _0x5788cc[_0x9514('0x11')](0xc8)['json']({'output':_0x450a5e});});};exports['restart']=function(_0x5723b6,_0x28e96e){return pm2[_0x9514('0x1f')](_0x9514('0x20'))[_0x9514('0x21')](function(_0x43f195){logger[_0x9514('0x16')](_0x9514('0x22'),_0x43f195);return _0x28e96e[_0x9514('0x11')](0xc8)[_0x9514('0x12')]({'output':_0x9514('0x23')});})[_0x9514('0x24')](function(_0xb220ac){logger['error'](_0xb220ac);return _0x28e96e['status'](0x1f4)[_0x9514('0x12')](_0xb220ac);});};exports['migrations']=function(_0x1dc6e2,_0x5bdb85){var _0x48caec=fs[_0x9514('0x25')](path[_0x9514('0x26')](config[_0x9514('0x27')],_0x9514('0x28'),_0x9514('0x29')));var _0x5cc51a=[];for(var _0x18af5a=0x0;_0x18af5a<_0x48caec[_0x9514('0x2a')];_0x18af5a++){var _0x3889d6=_0x48caec[_0x18af5a][_0x9514('0x2b')](_0x9514('0x2c'),'');if(compareVersions(module[_0x9514('0xc')]['version'],_0x3889d6)===-0x1){_0x5cc51a['push'](_0x3889d6);}}if(_0x5cc51a['length']){var _0x685f91=_0x5cc51a[_0x9514('0x2d')](compareVersions);var _0x12e15f=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x9514('0x2e')],'modelName':_0x9514('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0x9514('0x2f')][_0x9514('0x30')](),db[_0x9514('0x2f')]['constructor'],function(){throw new Error(_0x9514('0x31'));}],'path':path[_0x9514('0x26')](config['root'],_0x9514('0x28'),_0x9514('0x29')),'pattern':/\.js$/}});_0x12e15f['up']({'migrations':_['map'](_0x685f91,function(_0x45e149){return _0x45e149+_0x9514('0x2c');})})[_0x9514('0x21')](function(){return _0x5bdb85['status'](0xc8)[_0x9514('0x12')]({'output':_0x9514('0x32')+module['exports']['version']+_0x9514('0x33')+_[_0x9514('0x34')](_0x685f91),'migrations':_[_0x9514('0x26')](_0x685f91)});})[_0x9514('0x24')](function(_0x2bed66){if(_0x2bed66 instanceof db[_0x9514('0x2f')][_0x9514('0x35')]){return _0x5bdb85[_0x9514('0x11')](0xc8)[_0x9514('0x12')]({'output':_0x9514('0x36')});}else{return _0x5bdb85[_0x9514('0x11')](0x1f4)[_0x9514('0x12')](_0x2bed66);}});}else{return _0x5bdb85[_0x9514('0x11')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 89d90ff..720ae6b 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 _0xb43b=['../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2143ed,_0x5aeb8d){var _0x43bff5=function(_0x195497){while(--_0x195497){_0x2143ed['push'](_0x2143ed['shift']());}};_0x43bff5(++_0x5aeb8d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x374f35,_0x1d71b3){_0x374f35=_0x374f35-0x0;var _0x53369a=_0xb43b[_0x374f35];return _0x53369a;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0x10')]('/',auth['isAuthenticated'](),controller[_0xbb43('0x11')]);router[_0xbb43('0x12')](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller[_0xbb43('0x13')]);router[_0xbb43('0x14')]('/:id',auth[_0xbb43('0xb')](),controller[_0xbb43('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9eb7=['Router','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x9eb7,0x106));var _0x79eb=function(_0x423e80,_0x28bb0a){_0x423e80=_0x423e80-0x0;var _0xbd0e1c=_0x9eb7[_0x423e80];return _0xbd0e1c;};'use strict';var multer=require(_0x79eb('0x0'));var util=require(_0x79eb('0x1'));var path=require(_0x79eb('0x2'));var timeout=require(_0x79eb('0x3'));var express=require('express');var router=express[_0x79eb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x79eb('0x5'));var controller=require(_0x79eb('0x6'));router[_0x79eb('0x7')]('/',auth['isAuthenticated'](),controller[_0x79eb('0x8')]);router[_0x79eb('0x7')](_0x79eb('0x9'),auth[_0x79eb('0xa')](),controller[_0x79eb('0xb')]);router[_0x79eb('0x7')](_0x79eb('0xc'),auth[_0x79eb('0xa')](),controller[_0x79eb('0xd')]);router[_0x79eb('0xe')]('/',auth[_0x79eb('0xa')](),controller[_0x79eb('0xf')]);router['put'](_0x79eb('0xc'),auth[_0x79eb('0xa')](),controller['update']);router[_0x79eb('0x10')]('/:id',auth[_0x79eb('0xa')](),controller[_0x79eb('0x11')]);module[_0x79eb('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index c9ddb23..6111005 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 _0x42f4=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x496c30,_0x4f32cf){var _0x168fbb=function(_0x26a112){while(--_0x26a112){_0x496c30['push'](_0x496c30['shift']());}};_0x168fbb(++_0x4f32cf);}(_0x42f4,0x19d));var _0x442f=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x42f4[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require(_0x442f('0x0'));module['exports']={'type':{'type':Sequelize[_0x442f('0x1')]},'uniqueid':{'type':Sequelize[_0x442f('0x1')]},'calleridnum':{'type':Sequelize[_0x442f('0x1')]},'calleridname':{'type':Sequelize[_0x442f('0x1')]},'queue':{'type':Sequelize[_0x442f('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x442f('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x442f('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x442f('0x2')]},'holdtime':{'type':Sequelize[_0x442f('0x3')]},'agentcomplete':{'type':Sequelize[_0x442f('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x442f('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x442f('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x442f('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x442f('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x442f('0x3')]},'channelstatedesc':{'type':Sequelize[_0x442f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x442f('0x1')]},'connectedlinename':{'type':Sequelize[_0x442f('0x1')]},'language':{'type':Sequelize[_0x442f('0x1')]},'accountcode':{'type':Sequelize[_0x442f('0x1')]},'context':{'type':Sequelize[_0x442f('0x1')]},'exten':{'type':Sequelize[_0x442f('0x1')]},'priority':{'type':Sequelize[_0x442f('0x1')]},'destchannel':{'type':Sequelize[_0x442f('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x442f('0x1')]},'destcalleridnum':{'type':Sequelize[_0x442f('0x1')]},'destcalleridname':{'type':Sequelize[_0x442f('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x442f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x442f('0x1')]},'destlanguage':{'type':Sequelize[_0x442f('0x1')]},'destaccountcode':{'type':Sequelize[_0x442f('0x1')]},'destcontext':{'type':Sequelize[_0x442f('0x1')]},'destexten':{'type':Sequelize[_0x442f('0x1')]},'destpriority':{'type':Sequelize[_0x442f('0x1')]},'destuniqueid':{'type':Sequelize[_0x442f('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x442f('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x442f('0x1')]},'transfer':{'type':Sequelize[_0x442f('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x442f('0x1')],'comment':_0x442f('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x442f('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x958a=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x958a,0x128));var _0xa958=function(_0x3a9235,_0x30d726){_0x3a9235=_0x3a9235-0x0;var _0x1e966c=_0x958a[_0x3a9235];return _0x1e966c;};'use strict';var Sequelize=require(_0xa958('0x0'));module[_0xa958('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa958('0x2')]},'calleridnum':{'type':Sequelize[_0xa958('0x2')]},'calleridname':{'type':Sequelize[_0xa958('0x2')]},'queue':{'type':Sequelize[_0xa958('0x2')]},'interface':{'type':Sequelize[_0xa958('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xa958('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xa958('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xa958('0x3')]},'agentdumpAt':{'type':Sequelize[_0xa958('0x3')]},'holdtime':{'type':Sequelize[_0xa958('0x4')]},'agentcomplete':{'type':Sequelize[_0xa958('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa958('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa958('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa958('0x4')]},'reason':{'type':Sequelize[_0xa958('0x2')]},'lastevent':{'type':Sequelize[_0xa958('0x2')]},'channel':{'type':Sequelize[_0xa958('0x2')]},'channelstate':{'type':Sequelize[_0xa958('0x4')]},'channelstatedesc':{'type':Sequelize[_0xa958('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa958('0x2')]},'connectedlinename':{'type':Sequelize[_0xa958('0x2')]},'language':{'type':Sequelize[_0xa958('0x2')]},'accountcode':{'type':Sequelize[_0xa958('0x2')]},'context':{'type':Sequelize[_0xa958('0x2')]},'exten':{'type':Sequelize[_0xa958('0x2')]},'priority':{'type':Sequelize[_0xa958('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa958('0x2')]},'destcalleridname':{'type':Sequelize[_0xa958('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa958('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xa958('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa958('0x2')]},'destuniqueid':{'type':Sequelize[_0xa958('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa958('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xa958('0x2')]},'transfer':{'type':Sequelize[_0xa958('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa958('0x2')],'comment':_0xa958('0x6')},'transferexten':{'type':Sequelize[_0xa958('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xa958('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 74ef4aa..1d2ad52 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(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 6e0fae6..8d4f301 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 _0x7d55=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x2d4958,_0x46806d){var _0x2cd107=function(_0x1c3db2){while(--_0x1c3db2){_0x2d4958['push'](_0x2d4958['shift']());}};_0x2cd107(++_0x46806d);}(_0x7d55,0x1bc));var _0x57d5=function(_0x49934d,_0x20b155){_0x49934d=_0x49934d-0x0;var _0x569fa7=_0x7d55[_0x49934d];return _0x569fa7;};'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':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d2=['rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','api','moment','request-promise'];(function(_0xe7766a,_0x23f53e){var _0x25edf9=function(_0x36a16c){while(--_0x36a16c){_0xe7766a['push'](_0xe7766a['shift']());}};_0x25edf9(++_0x23f53e);}(_0xd6d2,0xcb));var _0x2d6d=function(_0xccce09,_0x1e998c){_0xccce09=_0xccce09-0x0;var _0x535c91=_0xd6d2[_0xccce09];return _0x535c91;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var logger=require('../../config/logger')(_0x2d6d('0x2'));var moment=require(_0x2d6d('0x3'));var BPromise=require('bluebird');var rp=require(_0x2d6d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d6d('0x5'));var config=require(_0x2d6d('0x6'));var attributes=require(_0x2d6d('0x7'));module['exports']=function(_0xfcdb1d,_0x132361){return _0xfcdb1d[_0x2d6d('0x8')](_0x2d6d('0x9'),attributes,{'tableName':_0x2d6d('0xa'),'paranoid':![],'indexes':[{'fields':[_0x2d6d('0xb'),_0x2d6d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 552a4bc..9c56b8b 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 _0x4e27=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','catch','UpdateVoiceAgentReport','update','where','attributes','lodash'];(function(_0x389d7d,_0x578d00){var _0x418cfd=function(_0x2cca30){while(--_0x2cca30){_0x389d7d['push'](_0x389d7d['shift']());}};_0x418cfd(++_0x578d00);}(_0x4e27,0x1cd));var _0x74e2=function(_0x425b5a,_0x1dd2fa){_0x425b5a=_0x425b5a-0x0;var _0x176938=_0x4e27[_0x425b5a];return _0x176938;};'use strict';var _=require(_0x74e2('0x0'));var util=require(_0x74e2('0x1'));var moment=require('moment');var BPromise=require(_0x74e2('0x2'));var rs=require(_0x74e2('0x3'));var fs=require('fs');var Redis=require(_0x74e2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74e2('0x5'));var logger=require(_0x74e2('0x6'))(_0x74e2('0x7'));var config=require(_0x74e2('0x8'));var jayson=require(_0x74e2('0x9'));var client=jayson[_0x74e2('0xa')][_0x74e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a98f6,_0x5c70d1,_0x35c44b){return new BPromise(function(_0x5bef7f,_0x44091a){return client[_0x74e2('0xc')](_0x5a98f6,_0x35c44b)[_0x74e2('0xd')](function(_0x627704){logger['info'](_0x74e2('0xe'),_0x5c70d1,_0x74e2('0xf'));logger[_0x74e2('0x10')](_0x74e2('0x11'),_0x5c70d1,_0x74e2('0xf'),JSON[_0x74e2('0x12')](_0x627704));if(_0x627704[_0x74e2('0x13')]){if(_0x627704[_0x74e2('0x13')]['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x5c70d1,_0x627704['error'][_0x74e2('0x14')]);return _0x44091a(_0x627704[_0x74e2('0x13')][_0x74e2('0x14')]);}logger[_0x74e2('0x13')](_0x74e2('0xe'),_0x5c70d1,_0x627704['error'][_0x74e2('0x14')]);return _0x5bef7f(_0x627704['error'][_0x74e2('0x14')]);}else{logger[_0x74e2('0x15')](_0x74e2('0xe'),_0x5c70d1,'request\x20sent');_0x5bef7f(_0x627704['result']['message']);}})['catch'](function(_0x12fab1){logger['error'](_0x74e2('0xe'),_0x5c70d1,_0x12fab1);_0x44091a(_0x12fab1);});});}exports[_0x74e2('0x16')]=function(_0x52300d){var _0x234630=this;return new Promise(function(_0x902d8a,_0xc05dc1){return db[_0x74e2('0x17')][_0x74e2('0x18')](_0x52300d[_0x74e2('0x19')],{'raw':_0x52300d[_0x74e2('0x1a')]?_0x52300d[_0x74e2('0x1a')][_0x74e2('0x1b')]===undefined?!![]:![]:!![]})[_0x74e2('0xd')](function(_0x5c2e29){logger[_0x74e2('0x15')](_0x74e2('0x16'),_0x52300d);logger[_0x74e2('0x10')](_0x74e2('0x16'),_0x52300d,JSON[_0x74e2('0x12')](_0x5c2e29));_0x902d8a(_0x5c2e29);})[_0x74e2('0x1c')](function(_0x37a8f4){logger[_0x74e2('0x13')](_0x74e2('0x16'),_0x37a8f4[_0x74e2('0x14')],_0x52300d);_0xc05dc1(_0x234630[_0x74e2('0x13')](0x1f4,_0x37a8f4['message']));});});};exports[_0x74e2('0x1d')]=function(_0x38f9c7){var _0x6f4d79=this;return new Promise(function(_0xdcea9c,_0x1a31a6){return db[_0x74e2('0x17')][_0x74e2('0x1e')](_0x38f9c7['body'],{'raw':_0x38f9c7[_0x74e2('0x1a')]?_0x38f9c7[_0x74e2('0x1a')][_0x74e2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38f9c7[_0x74e2('0x1a')]?_0x38f9c7[_0x74e2('0x1a')][_0x74e2('0x1f')]||null:null,'attributes':_0x38f9c7['options']?_0x38f9c7['options'][_0x74e2('0x20')]||null:null,'limit':_0x38f9c7[_0x74e2('0x1a')]?_0x38f9c7[_0x74e2('0x1a')]['limit']||null:null})[_0x74e2('0xd')](function(_0x24d176){logger[_0x74e2('0x15')]('UpdateVoiceAgentReport',_0x38f9c7);logger['debug'](_0x74e2('0x1d'),_0x38f9c7,JSON['stringify'](_0x24d176));_0xdcea9c(_0x24d176);})['catch'](function(_0x5cfbb7){logger[_0x74e2('0x13')]('UpdateVoiceAgentReport',_0x5cfbb7[_0x74e2('0x14')],_0x38f9c7);_0x1a31a6(_0x6f4d79[_0x74e2('0x13')](0x1f4,_0x5cfbb7[_0x74e2('0x14')]));});});}; \ No newline at end of file +var _0xada9=['code','message','VoiceAgentReport,\x20%s,\x20%s','catch','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','limit','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x1d3c0e,_0x146084){var _0x571395=function(_0x5b55bf){while(--_0x5b55bf){_0x1d3c0e['push'](_0x1d3c0e['shift']());}};_0x571395(++_0x146084);}(_0xada9,0x177));var _0x9ada=function(_0x268ba2,_0x4faf08){_0x268ba2=_0x268ba2-0x0;var _0x50e328=_0xada9[_0x268ba2];return _0x50e328;};'use strict';var _=require(_0x9ada('0x0'));var util=require(_0x9ada('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ada('0x2'));var db=require(_0x9ada('0x3'))['db'];var utils=require(_0x9ada('0x4'));var logger=require(_0x9ada('0x5'))(_0x9ada('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9ada('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x131f39,_0x4ad740,_0x10a15b){return new BPromise(function(_0x57a33b,_0x41b7bf){return client[_0x9ada('0x8')](_0x131f39,_0x10a15b)[_0x9ada('0x9')](function(_0x4e7c76){logger[_0x9ada('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x4ad740,_0x9ada('0xb'));logger[_0x9ada('0xc')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4ad740,_0x9ada('0xb'),JSON[_0x9ada('0xd')](_0x4e7c76));if(_0x4e7c76[_0x9ada('0xe')]){if(_0x4e7c76['error'][_0x9ada('0xf')]===0x1f4){logger[_0x9ada('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4ad740,_0x4e7c76[_0x9ada('0xe')]['message']);return _0x41b7bf(_0x4e7c76[_0x9ada('0xe')][_0x9ada('0x10')]);}logger[_0x9ada('0xe')](_0x9ada('0x11'),_0x4ad740,_0x4e7c76[_0x9ada('0xe')][_0x9ada('0x10')]);return _0x57a33b(_0x4e7c76['error'][_0x9ada('0x10')]);}else{logger[_0x9ada('0xa')](_0x9ada('0x11'),_0x4ad740,_0x9ada('0xb'));_0x57a33b(_0x4e7c76['result']['message']);}})[_0x9ada('0x12')](function(_0x3970b6){logger[_0x9ada('0xe')](_0x9ada('0x11'),_0x4ad740,_0x3970b6);_0x41b7bf(_0x3970b6);});});}exports['CreateVoiceAgentReport']=function(_0x70d098){var _0x2306c8=this;return new Promise(function(_0x4e9d1f,_0x10b7b4){return db[_0x9ada('0x13')][_0x9ada('0x14')](_0x70d098[_0x9ada('0x15')],{'raw':_0x70d098['options']?_0x70d098[_0x9ada('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x9ada('0x9')](function(_0x948fc7){logger[_0x9ada('0xa')](_0x9ada('0x17'),_0x70d098);logger['debug'](_0x9ada('0x17'),_0x70d098,JSON[_0x9ada('0xd')](_0x948fc7));_0x4e9d1f(_0x948fc7);})[_0x9ada('0x12')](function(_0x16f664){logger[_0x9ada('0xe')](_0x9ada('0x17'),_0x16f664[_0x9ada('0x10')],_0x70d098);_0x10b7b4(_0x2306c8['error'](0x1f4,_0x16f664['message']));});});};exports[_0x9ada('0x18')]=function(_0x23c2c9){var _0x262627=this;return new Promise(function(_0x329a95,_0x2d64dd){return db[_0x9ada('0x13')][_0x9ada('0x19')](_0x23c2c9[_0x9ada('0x15')],{'raw':_0x23c2c9[_0x9ada('0x16')]?_0x23c2c9[_0x9ada('0x16')][_0x9ada('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c2c9[_0x9ada('0x16')]?_0x23c2c9[_0x9ada('0x16')][_0x9ada('0x1b')]||null:null,'attributes':_0x23c2c9['options']?_0x23c2c9[_0x9ada('0x16')][_0x9ada('0x1c')]||null:null,'limit':_0x23c2c9['options']?_0x23c2c9[_0x9ada('0x16')][_0x9ada('0x1d')]||null:null})[_0x9ada('0x9')](function(_0x47c3be){logger[_0x9ada('0xa')](_0x9ada('0x18'),_0x23c2c9);logger[_0x9ada('0xc')](_0x9ada('0x18'),_0x23c2c9,JSON[_0x9ada('0xd')](_0x47c3be));_0x329a95(_0x47c3be);})['catch'](function(_0x2b64eb){logger[_0x9ada('0xe')]('UpdateVoiceAgentReport',_0x2b64eb[_0x9ada('0x10')],_0x23c2c9);_0x2d64dd(_0x262627['error'](0x1f4,_0x2b64eb[_0x9ada('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 45ace9f..05cf0cb 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 _0x50c3=['/:id','post','create','put','/with-retry/:id','delete','destroy','Router','get','isAuthenticated','index','/describe'];(function(_0x21f774,_0x134e5c){var _0x4082f0=function(_0x349efa){while(--_0x349efa){_0x21f774['push'](_0x21f774['shift']());}};_0x4082f0(++_0x134e5c);}(_0x50c3,0x1b7));var _0x350c=function(_0x3811b1,_0x1c7fe2){_0x3811b1=_0x3811b1-0x0;var _0x5717ad=_0x50c3[_0x3811b1];return _0x5717ad;};'use strict';var express=require('express');var router=express[_0x350c('0x0')]();var auth=require('../../components/auth/service');var controller=require('./voiceCallReport.controller');router[_0x350c('0x1')]('/',auth[_0x350c('0x2')](),controller[_0x350c('0x3')]);router['get'](_0x350c('0x4'),auth[_0x350c('0x2')](),controller['describe']);router['get'](_0x350c('0x5'),auth[_0x350c('0x2')](),controller['show']);router[_0x350c('0x6')]('/',auth['isAuthenticated'](),controller[_0x350c('0x7')]);router[_0x350c('0x8')](_0x350c('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x350c('0x8')](_0x350c('0x9'),auth[_0x350c('0x2')](),controller['updateWithRetry']);router[_0x350c('0xa')](_0x350c('0x5'),auth[_0x350c('0x2')](),controller[_0x350c('0xb')]);module['exports']=router; \ No newline at end of file +var _0x152b=['Router','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','/with-retry/:id','updateWithRetry','destroy','exports','express'];(function(_0x98a877,_0x19902e){var _0x538f07=function(_0x14cf1c){while(--_0x14cf1c){_0x98a877['push'](_0x98a877['shift']());}};_0x538f07(++_0x19902e);}(_0x152b,0x18b));var _0xb152=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x152b[_0x1d1d09];return _0x8827e;};'use strict';var express=require(_0xb152('0x0'));var router=express[_0xb152('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xb152('0x2'));router[_0xb152('0x3')]('/',auth[_0xb152('0x4')](),controller[_0xb152('0x5')]);router['get'](_0xb152('0x6'),auth['isAuthenticated'](),controller[_0xb152('0x7')]);router[_0xb152('0x3')](_0xb152('0x8'),auth[_0xb152('0x4')](),controller[_0xb152('0x9')]);router[_0xb152('0xa')]('/',auth['isAuthenticated'](),controller[_0xb152('0xb')]);router[_0xb152('0xc')](_0xb152('0x8'),auth[_0xb152('0x4')](),controller[_0xb152('0xd')]);router[_0xb152('0xc')](_0xb152('0xe'),auth['isAuthenticated'](),controller[_0xb152('0xf')]);router['delete'](_0xb152('0x8'),auth[_0xb152('0x4')](),controller[_0xb152('0x10')]);module[_0xb152('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 2619818..c901b1d 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 _0x5480=['STRING','internal','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x33030e,_0x5bee59){var _0x13bfbd=function(_0x3e0a14){while(--_0x3e0a14){_0x33030e['push'](_0x33030e['shift']());}};_0x13bfbd(++_0x5bee59);}(_0x5480,0x18a));var _0x0548=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x5480[_0x16629d];return _0x56ccee;};'use strict';var Sequelize=require(_0x0548('0x0'));module[_0x0548('0x1')]={'uniqueid':{'type':Sequelize[_0x0548('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0548('0x3'),'outbound',_0x0548('0x4'),_0x0548('0x5'),'dialer')},'tag':{'type':Sequelize[_0x0548('0x2')]},'accountcode':{'type':Sequelize[_0x0548('0x2')]},'source':{'type':Sequelize[_0x0548('0x2')]},'destination':{'type':Sequelize[_0x0548('0x2')]},'destinationcontext':{'type':Sequelize[_0x0548('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x0548('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x0548('0x6')]},'starttime':{'type':Sequelize[_0x0548('0x7')]},'systemanswertime':{'type':Sequelize[_0x0548('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0548('0x7')]},'duration':{'type':Sequelize[_0x0548('0x8')]},'billableseconds':{'type':Sequelize[_0x0548('0x8')]},'mohtime':{'type':Sequelize[_0x0548('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0548('0x2')]},'amaflags':{'type':Sequelize[_0x0548('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x0548('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x0548('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x0548('0x2')]},'note':{'type':Sequelize[_0x0548('0x2')]},'prefix':{'type':Sequelize[_0x0548('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc00b=['dialer','STRING','TEXT','DATE','INTEGER','sequelize','inbound','outbound','inbound-fax','outbound-fax'];(function(_0x2b80fe,_0x66994e){var _0x4874b4=function(_0x45457a){while(--_0x45457a){_0x2b80fe['push'](_0x2b80fe['shift']());}};_0x4874b4(++_0x66994e);}(_0xc00b,0x1e5));var _0xbc00=function(_0x20c205,_0x39bc5e){_0x20c205=_0x20c205-0x0;var _0x3d6cf2=_0xc00b[_0x20c205];return _0x3d6cf2;};'use strict';var Sequelize=require(_0xbc00('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xbc00('0x1'),'internal',_0xbc00('0x2'),_0xbc00('0x3'),_0xbc00('0x4'),_0xbc00('0x5'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbc00('0x6')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xbc00('0x6')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xbc00('0x6')]},'channel':{'type':Sequelize[_0xbc00('0x6')]},'destinationchannel':{'type':Sequelize[_0xbc00('0x6')]},'lastapplication':{'type':Sequelize[_0xbc00('0x6')]},'lastdata':{'type':Sequelize[_0xbc00('0x7')]},'starttime':{'type':Sequelize[_0xbc00('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xbc00('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xbc00('0x9')]},'billableseconds':{'type':Sequelize[_0xbc00('0x9')]},'mohtime':{'type':Sequelize[_0xbc00('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xbc00('0x6')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xbc00('0x6')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xbc00('0x6')]},'note':{'type':Sequelize[_0xbc00('0x6')]},'prefix':{'type':Sequelize[_0xbc00('0x6')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xbc00('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 66fd85b..25ce5b2 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 _0x81c6=['update','../../components/parsers/qs','promise-retry','status','json','offset','undefined','count','limit','then','destroy','end','error','stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','fullname','alias','findAll','rows','show','params','length','include','options','find','catch','create','body','describe','uniqueid','No\x20such\x20report'];(function(_0x2c0964,_0x504d2f){var _0x3c6616=function(_0x2914d0){while(--_0x2914d0){_0x2c0964['push'](_0x2c0964['shift']());}};_0x3c6616(++_0x504d2f);}(_0x81c6,0x1d5));var _0x681c=function(_0x5edd05,_0x8ac1d3){_0x5edd05=_0x5edd05-0x0;var _0x19b62e=_0x81c6[_0x5edd05];return _0x19b62e;};'use strict';var _=require('lodash');var qs=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x681c('0x1'));function respondWithResult(_0x2d0fc0,_0x7a556b){_0x7a556b=_0x7a556b||0xc8;return function(_0x5566e5){if(_0x5566e5){return _0x2d0fc0[_0x681c('0x2')](_0x7a556b)[_0x681c('0x3')](_0x5566e5);}};}function respondWithFilteredResult(_0x1f2032,_0x1d31c8){return function(_0x4ea522){if(_0x4ea522){var _0x45331=typeof _0x1d31c8[_0x681c('0x4')]==='undefined'&&typeof _0x1d31c8['limit']===_0x681c('0x5');var _0x3fac39=_0x4ea522[_0x681c('0x6')];var _0x5de78e=_0x45331?0x0:_0x1d31c8['offset'];var _0x3e3770=_0x45331?_0x4ea522['count']:_0x1d31c8[_0x681c('0x4')]+_0x1d31c8[_0x681c('0x7')];var _0x2ac84d;if(_0x3e3770>=_0x3fac39){_0x3e3770=_0x3fac39;_0x2ac84d=0xc8;}else{_0x2ac84d=0xce;}_0x1f2032[_0x681c('0x2')](_0x2ac84d);return _0x1f2032['set']('Content-Range',_0x5de78e+'-'+_0x3e3770+'/'+_0x3fac39)[_0x681c('0x3')](_0x4ea522);}return null;};}function saveUpdates(_0x1d1d5d){return function(_0x2d379b){if(_0x2d379b){return _0x2d379b['update'](_0x1d1d5d)[_0x681c('0x8')](function(_0x5263cd){return _0x5263cd;});}return null;};}function removeEntity(_0x3cf828){return function(_0x4c3a91){if(_0x4c3a91){return _0x4c3a91[_0x681c('0x9')]()[_0x681c('0x8')](function(){_0x3cf828[_0x681c('0x2')](0xcc)[_0x681c('0xa')]();});}};}function handleEntityNotFound(_0x402aa2){return function(_0x2bc3fb){if(!_0x2bc3fb){_0x402aa2['sendStatus'](0x194);}return _0x2bc3fb;};}function handleError(_0x2b0939,_0x1135c9){_0x1135c9=_0x1135c9||0x1f4;return function(_0x435a4c){logger[_0x681c('0xb')](_0x435a4c[_0x681c('0xc')]);if(_0x435a4c[_0x681c('0xd')]){delete _0x435a4c['name'];}_0x2b0939[_0x681c('0x2')](_0x1135c9)[_0x681c('0xe')](_0x435a4c);};}exports[_0x681c('0xf')]=function(_0x42304f,_0x5b03fd){var _0x22e608={},_0x24a0ce={},_0x54d27f={'count':0x0,'rows':[]};var _0x161948=_['map'](db[_0x681c('0x10')][_0x681c('0x11')],function(_0x11d68d){return{'name':_0x11d68d[_0x681c('0x12')],'type':_0x11d68d[_0x681c('0x13')]['key']};});_0x24a0ce['model']=_['map'](_0x161948,_0x681c('0xd'));_0x24a0ce[_0x681c('0x14')]=_[_0x681c('0x15')](_0x42304f[_0x681c('0x14')]);_0x24a0ce[_0x681c('0x16')]=_[_0x681c('0x17')](_0x24a0ce[_0x681c('0x18')],_0x24a0ce[_0x681c('0x14')]);_0x22e608[_0x681c('0x19')]=_[_0x681c('0x17')](_0x24a0ce[_0x681c('0x18')],qs[_0x681c('0x1a')](_0x42304f[_0x681c('0x14')][_0x681c('0x1a')]));_0x22e608[_0x681c('0x19')]=_0x22e608[_0x681c('0x19')]['length']?_0x22e608[_0x681c('0x19')]:_0x24a0ce['model'];if(!_0x42304f[_0x681c('0x14')]['hasOwnProperty']('nolimit')){_0x22e608[_0x681c('0x7')]=qs[_0x681c('0x7')](_0x42304f[_0x681c('0x14')][_0x681c('0x7')]);_0x22e608['offset']=qs[_0x681c('0x4')](_0x42304f[_0x681c('0x14')][_0x681c('0x4')]);}_0x22e608[_0x681c('0x1b')]=qs[_0x681c('0x1c')](_0x42304f[_0x681c('0x14')][_0x681c('0x1c')]);_0x22e608['where']=qs[_0x681c('0x16')](_[_0x681c('0x1d')](_0x42304f[_0x681c('0x14')],_0x24a0ce['filters']),_0x161948);if(_0x42304f[_0x681c('0x14')][_0x681c('0x1e')]){_0x22e608[_0x681c('0x1f')]=_['merge'](_0x22e608[_0x681c('0x1f')],{'$or':_['map'](_0x161948,function(_0x4b682d){if(_0x4b682d[_0x681c('0x13')]!==_0x681c('0x20')){var _0x16277f={};_0x16277f[_0x4b682d['name']]={'$like':'%'+_0x42304f[_0x681c('0x14')]['filter']+'%'};return _0x16277f;}})});}_0x22e608=_[_0x681c('0x21')]({},_0x22e608,_0x42304f['options']);var _0x5ad9b6={'where':_0x22e608['where']};return db[_0x681c('0x10')][_0x681c('0x6')](_0x5ad9b6)['then'](function(_0x27f28f){_0x54d27f['count']=_0x27f28f;if(_0x42304f['query'][_0x681c('0x22')]){_0x22e608['include']=[{'attributes':['id',_0x681c('0xd'),_0x681c('0x23'),_0x681c('0x24')],'model':db['User'],'as':'User'}];}return db[_0x681c('0x10')][_0x681c('0x25')](_0x22e608);})['then'](function(_0xdb4f56){_0x54d27f[_0x681c('0x26')]=_0xdb4f56;return _0x54d27f;})[_0x681c('0x8')](respondWithFilteredResult(_0x5b03fd,_0x22e608))['catch'](handleError(_0x5b03fd,null));};exports[_0x681c('0x27')]=function(_0x147729,_0x5ef8a7){var _0x355a48={'raw':!![],'where':{'id':_0x147729[_0x681c('0x28')]['id']}},_0x3c6851={};_0x3c6851[_0x681c('0x18')]=_[_0x681c('0x15')](db['VoiceCallReport']['rawAttributes']);_0x3c6851[_0x681c('0x14')]=_[_0x681c('0x15')](_0x147729['query']);_0x3c6851[_0x681c('0x16')]=_[_0x681c('0x17')](_0x3c6851['model'],_0x3c6851[_0x681c('0x14')]);_0x355a48[_0x681c('0x19')]=_[_0x681c('0x17')](_0x3c6851[_0x681c('0x18')],qs[_0x681c('0x1a')](_0x147729[_0x681c('0x14')][_0x681c('0x1a')]));_0x355a48[_0x681c('0x19')]=_0x355a48[_0x681c('0x19')][_0x681c('0x29')]?_0x355a48['attributes']:_0x3c6851[_0x681c('0x18')];if(_0x147729[_0x681c('0x14')][_0x681c('0x22')]){_0x355a48[_0x681c('0x2a')]=[{'all':!![]}];}_0x355a48=_[_0x681c('0x21')]({},_0x355a48,_0x147729[_0x681c('0x2b')]);return db[_0x681c('0x10')][_0x681c('0x2c')](_0x355a48)[_0x681c('0x8')](handleEntityNotFound(_0x5ef8a7,null))[_0x681c('0x8')](respondWithResult(_0x5ef8a7,null))[_0x681c('0x2d')](handleError(_0x5ef8a7,null));};exports[_0x681c('0x2e')]=function(_0x5dd2f4,_0x2143a9){return db['VoiceCallReport']['create'](_0x5dd2f4[_0x681c('0x2f')],{})[_0x681c('0x8')](respondWithResult(_0x2143a9,0xc9))[_0x681c('0x2d')](handleError(_0x2143a9,null));};exports[_0x681c('0x9')]=function(_0x4d0630,_0x2397eb){return db['VoiceCallReport']['find']({'where':{'id':_0x4d0630[_0x681c('0x28')]['id']}})[_0x681c('0x8')](handleEntityNotFound(_0x2397eb,null))[_0x681c('0x8')](removeEntity(_0x2397eb,null))[_0x681c('0x2d')](handleError(_0x2397eb,null));};exports[_0x681c('0x30')]=function(_0x364d9b,_0x4a58a1){return db[_0x681c('0x10')][_0x681c('0x30')]()['then'](respondWithResult(_0x4a58a1,null))['catch'](handleError(_0x4a58a1,null));};function findForUpdate(_0x75da91){return db['VoiceCallReport'][_0x681c('0x2c')]({'where':{'uniqueid':_0x75da91['params']['id'],'UserId':{'$or':[null,_0x75da91['user']['id']]}}});}exports['update']=function(_0x28d62d,_0x41f2a2){if(_0x28d62d[_0x681c('0x2f')]['uniqueid']){delete _0x28d62d[_0x681c('0x2f')][_0x681c('0x31')];}return findForUpdate(_0x28d62d)['then'](handleEntityNotFound(_0x41f2a2,null))[_0x681c('0x8')](saveUpdates(_0x28d62d[_0x681c('0x2f')],null))[_0x681c('0x8')](respondWithResult(_0x41f2a2,null))[_0x681c('0x2d')](handleError(_0x41f2a2,null));};exports['updateWithRetry']=function(_0x3b9fd1,_0x598e95,_0x1b3c07){if(_0x3b9fd1[_0x681c('0x2f')][_0x681c('0x31')]){delete _0x3b9fd1['body'][_0x681c('0x31')];}promiseRetry(function(_0x1b1937){return findForUpdate(_0x3b9fd1)[_0x681c('0x8')](function(_0x89ef9d){if(_0x89ef9d!==null){return _0x89ef9d;}else{_0x1b1937(new Error(_0x681c('0x32')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x681c('0x8')](function(_0xdccaac){if(!_0xdccaac){return new Promise(function(_0x474a29){_0x474a29(handleEntityNotFound(_0x598e95)());});}else{return _0xdccaac[_0x681c('0x33')](_0x3b9fd1[_0x681c('0x2f')])[_0x681c('0x8')](function(_0x37bdf6){return respondWithResult(_0x598e95)(_0x37bdf6);});}},function(){handleEntityNotFound(_0x598e95)();});}; \ No newline at end of file +var _0x0598=['fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','VoiceCallReport','includeAll','User','rows','show','include','find','catch','create','body','params','describe','user','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','api','offset','undefined','limit','count','status','set','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes'];(function(_0x23d230,_0x88caa1){var _0x20598c=function(_0x9f0493){while(--_0x9f0493){_0x23d230['push'](_0x23d230['shift']());}};_0x20598c(++_0x88caa1);}(_0x0598,0x92));var _0x8059=function(_0x436d68,_0x124153){_0x436d68=_0x436d68-0x0;var _0x4c6283=_0x0598[_0x436d68];return _0x4c6283;};'use strict';var _=require(_0x8059('0x0'));var qs=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var db=require('../../mysqldb')['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x14109c,_0x236234){_0x236234=_0x236234||0xc8;return function(_0x54b9a2){if(_0x54b9a2){return _0x14109c['status'](_0x236234)['json'](_0x54b9a2);}};}function respondWithFilteredResult(_0x467206,_0xa7d7c1){return function(_0x512c0f){if(_0x512c0f){var _0x5996d7=typeof _0xa7d7c1[_0x8059('0x3')]===_0x8059('0x4')&&typeof _0xa7d7c1[_0x8059('0x5')]===_0x8059('0x4');var _0x5df268=_0x512c0f['count'];var _0x89dda1=_0x5996d7?0x0:_0xa7d7c1[_0x8059('0x3')];var _0x336f85=_0x5996d7?_0x512c0f[_0x8059('0x6')]:_0xa7d7c1[_0x8059('0x3')]+_0xa7d7c1['limit'];var _0x551d9e;if(_0x336f85>=_0x5df268){_0x336f85=_0x5df268;_0x551d9e=0xc8;}else{_0x551d9e=0xce;}_0x467206[_0x8059('0x7')](_0x551d9e);return _0x467206[_0x8059('0x8')]('Content-Range',_0x89dda1+'-'+_0x336f85+'/'+_0x5df268)['json'](_0x512c0f);}return null;};}function saveUpdates(_0x4f98b8){return function(_0x1ead10){if(_0x1ead10){return _0x1ead10[_0x8059('0x9')](_0x4f98b8)[_0x8059('0xa')](function(_0x12d6ce){return _0x12d6ce;});}return null;};}function removeEntity(_0x35c1f3){return function(_0x4eb4c5){if(_0x4eb4c5){return _0x4eb4c5[_0x8059('0xb')]()['then'](function(){_0x35c1f3[_0x8059('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4f08){return function(_0x13bf07){if(!_0x13bf07){_0x3e4f08[_0x8059('0xc')](0x194);}return _0x13bf07;};}function handleError(_0x4d3873,_0x516c1f){_0x516c1f=_0x516c1f||0x1f4;return function(_0x5cda43){logger[_0x8059('0xd')](_0x5cda43[_0x8059('0xe')]);if(_0x5cda43[_0x8059('0xf')]){delete _0x5cda43[_0x8059('0xf')];}_0x4d3873[_0x8059('0x7')](_0x516c1f)['send'](_0x5cda43);};}exports[_0x8059('0x10')]=function(_0x2bb670,_0x37e926){var _0x1c4566={},_0x58675f={},_0x5456a9={'count':0x0,'rows':[]};var _0x4f2eb3=_[_0x8059('0x11')](db['VoiceCallReport'][_0x8059('0x12')],function(_0x56d794){return{'name':_0x56d794[_0x8059('0x13')],'type':_0x56d794[_0x8059('0x14')][_0x8059('0x15')]};});_0x58675f['model']=_['map'](_0x4f2eb3,_0x8059('0xf'));_0x58675f[_0x8059('0x16')]=_[_0x8059('0x17')](_0x2bb670[_0x8059('0x16')]);_0x58675f['filters']=_[_0x8059('0x18')](_0x58675f[_0x8059('0x19')],_0x58675f[_0x8059('0x16')]);_0x1c4566['attributes']=_[_0x8059('0x18')](_0x58675f[_0x8059('0x19')],qs[_0x8059('0x1a')](_0x2bb670[_0x8059('0x16')]['fields']));_0x1c4566[_0x8059('0x1b')]=_0x1c4566[_0x8059('0x1b')][_0x8059('0x1c')]?_0x1c4566[_0x8059('0x1b')]:_0x58675f[_0x8059('0x19')];if(!_0x2bb670['query'][_0x8059('0x1d')](_0x8059('0x1e'))){_0x1c4566[_0x8059('0x5')]=qs['limit'](_0x2bb670['query']['limit']);_0x1c4566[_0x8059('0x3')]=qs[_0x8059('0x3')](_0x2bb670[_0x8059('0x16')][_0x8059('0x3')]);}_0x1c4566['order']=qs[_0x8059('0x1f')](_0x2bb670['query'][_0x8059('0x1f')]);_0x1c4566[_0x8059('0x20')]=qs['filters'](_[_0x8059('0x21')](_0x2bb670[_0x8059('0x16')],_0x58675f[_0x8059('0x22')]),_0x4f2eb3);if(_0x2bb670[_0x8059('0x16')][_0x8059('0x23')]){_0x1c4566[_0x8059('0x20')]=_[_0x8059('0x24')](_0x1c4566[_0x8059('0x20')],{'$or':_['map'](_0x4f2eb3,function(_0xb3c36e){if(_0xb3c36e[_0x8059('0x14')]!==_0x8059('0x25')){var _0x15f843={};_0x15f843[_0xb3c36e[_0x8059('0xf')]]={'$like':'%'+_0x2bb670['query'][_0x8059('0x23')]+'%'};return _0x15f843;}})});}_0x1c4566=_[_0x8059('0x24')]({},_0x1c4566,_0x2bb670[_0x8059('0x26')]);var _0x15160a={'where':_0x1c4566[_0x8059('0x20')]};return db[_0x8059('0x27')][_0x8059('0x6')](_0x15160a)[_0x8059('0xa')](function(_0x3ac01e){_0x5456a9[_0x8059('0x6')]=_0x3ac01e;if(_0x2bb670['query'][_0x8059('0x28')]){_0x1c4566['include']=[{'attributes':['id',_0x8059('0xf'),'fullname','alias'],'model':db[_0x8059('0x29')],'as':'User'}];}return db[_0x8059('0x27')]['findAll'](_0x1c4566);})[_0x8059('0xa')](function(_0x55ddda){_0x5456a9[_0x8059('0x2a')]=_0x55ddda;return _0x5456a9;})[_0x8059('0xa')](respondWithFilteredResult(_0x37e926,_0x1c4566))['catch'](handleError(_0x37e926,null));};exports[_0x8059('0x2b')]=function(_0x7961af,_0x3e5fd3){var _0x483058={'raw':!![],'where':{'id':_0x7961af['params']['id']}},_0x241403={};_0x241403[_0x8059('0x19')]=_['keys'](db[_0x8059('0x27')][_0x8059('0x12')]);_0x241403[_0x8059('0x16')]=_[_0x8059('0x17')](_0x7961af['query']);_0x241403[_0x8059('0x22')]=_['intersection'](_0x241403['model'],_0x241403[_0x8059('0x16')]);_0x483058[_0x8059('0x1b')]=_[_0x8059('0x18')](_0x241403[_0x8059('0x19')],qs[_0x8059('0x1a')](_0x7961af['query']['fields']));_0x483058['attributes']=_0x483058['attributes'][_0x8059('0x1c')]?_0x483058[_0x8059('0x1b')]:_0x241403[_0x8059('0x19')];if(_0x7961af['query'][_0x8059('0x28')]){_0x483058[_0x8059('0x2c')]=[{'all':!![]}];}_0x483058=_['merge']({},_0x483058,_0x7961af[_0x8059('0x26')]);return db[_0x8059('0x27')][_0x8059('0x2d')](_0x483058)['then'](handleEntityNotFound(_0x3e5fd3,null))[_0x8059('0xa')](respondWithResult(_0x3e5fd3,null))[_0x8059('0x2e')](handleError(_0x3e5fd3,null));};exports['create']=function(_0x338493,_0x280047){return db[_0x8059('0x27')][_0x8059('0x2f')](_0x338493[_0x8059('0x30')],{})[_0x8059('0xa')](respondWithResult(_0x280047,0xc9))[_0x8059('0x2e')](handleError(_0x280047,null));};exports[_0x8059('0xb')]=function(_0x3687a0,_0x3b7a28){return db[_0x8059('0x27')][_0x8059('0x2d')]({'where':{'id':_0x3687a0[_0x8059('0x31')]['id']}})[_0x8059('0xa')](handleEntityNotFound(_0x3b7a28,null))[_0x8059('0xa')](removeEntity(_0x3b7a28,null))[_0x8059('0x2e')](handleError(_0x3b7a28,null));};exports[_0x8059('0x32')]=function(_0x25f542,_0x1b613f){return db[_0x8059('0x27')][_0x8059('0x32')]()[_0x8059('0xa')](respondWithResult(_0x1b613f,null))[_0x8059('0x2e')](handleError(_0x1b613f,null));};function findForUpdate(_0x4ecb27){return db[_0x8059('0x27')]['find']({'where':{'uniqueid':_0x4ecb27['params']['id'],'UserId':{'$or':[null,_0x4ecb27[_0x8059('0x33')]['id']]}}});}exports['update']=function(_0x3dc221,_0x5e5c2c){if(_0x3dc221[_0x8059('0x30')][_0x8059('0x34')]){delete _0x3dc221[_0x8059('0x30')][_0x8059('0x34')];}return findForUpdate(_0x3dc221)[_0x8059('0xa')](handleEntityNotFound(_0x5e5c2c,null))[_0x8059('0xa')](saveUpdates(_0x3dc221['body'],null))[_0x8059('0xa')](respondWithResult(_0x5e5c2c,null))['catch'](handleError(_0x5e5c2c,null));};exports[_0x8059('0x35')]=function(_0x2d6902,_0x3b954e,_0x52656f){if(_0x2d6902[_0x8059('0x30')][_0x8059('0x34')]){delete _0x2d6902[_0x8059('0x30')][_0x8059('0x34')];}promiseRetry(function(_0x584e13){return findForUpdate(_0x2d6902)[_0x8059('0xa')](function(_0x2c0108){if(_0x2c0108!==null){return _0x2c0108;}else{_0x584e13(new Error(_0x8059('0x36')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x2ba3f1){if(!_0x2ba3f1){return new Promise(function(_0x5d9458){_0x5d9458(handleEntityNotFound(_0x3b954e)());});}else{return _0x2ba3f1['update'](_0x2d6902[_0x8059('0x30')])['then'](function(_0x20caa3){return respondWithResult(_0x3b954e)(_0x20caa3);});}},function(){handleEntityNotFound(_0x3b954e)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 203a624..a036417 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 _0xf451=['define','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf451,0x161));var _0x1f45=function(_0x5efa00,_0x596e45){_0x5efa00=_0x5efa00-0x0;var _0x14ed0a=_0xf451[_0x5efa00];return _0x14ed0a;};'use strict';var _=require(_0x1f45('0x0'));var util=require(_0x1f45('0x1'));var logger=require(_0x1f45('0x2'))(_0x1f45('0x3'));var moment=require('moment');var BPromise=require(_0x1f45('0x4'));var rp=require(_0x1f45('0x5'));var fs=require('fs');var path=require(_0x1f45('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x4a3c60,_0x3436b8){return _0x4a3c60[_0x1f45('0x7')]('VoiceCallReport',attributes,{'tableName':_0x1f45('0x8'),'paranoid':![],'indexes':[{'fields':[_0x1f45('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf1cc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','VoiceCallReport','report_call','uniqueid','util','../../config/logger'];(function(_0x4bf9aa,_0xafa1ec){var _0x1db38a=function(_0x44540e){while(--_0x44540e){_0x4bf9aa['push'](_0x4bf9aa['shift']());}};_0x1db38a(++_0xafa1ec);}(_0xf1cc,0x1ae));var _0xcf1c=function(_0x5cac12,_0xe7c994){_0x5cac12=_0x5cac12-0x0;var _0x489f57=_0xf1cc[_0x5cac12];return _0x489f57;};'use strict';var _=require('lodash');var util=require(_0xcf1c('0x0'));var logger=require(_0xcf1c('0x1'))(_0xcf1c('0x2'));var moment=require(_0xcf1c('0x3'));var BPromise=require(_0xcf1c('0x4'));var rp=require(_0xcf1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf1c('0x6'));var config=require(_0xcf1c('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xcf1c('0x8')]=function(_0x49c86a,_0x3cb7fc){return _0x49c86a['define'](_0xcf1c('0x9'),attributes,{'tableName':_0xcf1c('0xa'),'paranoid':![],'indexes':[{'fields':[_0xcf1c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index d55a360..0345187 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 _0xa09b=['message','result','catch','GetVoiceCallReport','findAll','options','where','limit','include','map','attributes','model','CreateVoiceCallReport','VoiceCallReport','raw','then','UpdateVoiceCallReport','update','body','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x320839,_0x3a18a5){var _0x29387e=function(_0x4f52ad){while(--_0x4f52ad){_0x320839['push'](_0x320839['shift']());}};_0x29387e(++_0x3a18a5);}(_0xa09b,0x10f));var _0xba09=function(_0x51e11c,_0xc806f9){_0x51e11c=_0x51e11c-0x0;var _0x55436b=_0xa09b[_0x51e11c];return _0x55436b;};'use strict';var _=require(_0xba09('0x0'));var util=require(_0xba09('0x1'));var moment=require('moment');var BPromise=require(_0xba09('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba09('0x3'));var db=require(_0xba09('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xba09('0x5'));var config=require(_0xba09('0x6'));var jayson=require(_0xba09('0x7'));var client=jayson[_0xba09('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb0ce40,_0x2b996f,_0x4581af){return new BPromise(function(_0x6f8817,_0xf2a488){return client[_0xba09('0x9')](_0xb0ce40,_0x4581af)['then'](function(_0x325f04){logger[_0xba09('0xa')](_0xba09('0xb'),_0x2b996f,_0xba09('0xc'));logger[_0xba09('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x2b996f,_0xba09('0xc'),JSON[_0xba09('0xe')](_0x325f04));if(_0x325f04[_0xba09('0xf')]){if(_0x325f04[_0xba09('0xf')][_0xba09('0x10')]===0x1f4){logger[_0xba09('0xf')](_0xba09('0xb'),_0x2b996f,_0x325f04['error'][_0xba09('0x11')]);return _0xf2a488(_0x325f04[_0xba09('0xf')]['message']);}logger[_0xba09('0xf')](_0xba09('0xb'),_0x2b996f,_0x325f04[_0xba09('0xf')][_0xba09('0x11')]);return _0x6f8817(_0x325f04[_0xba09('0xf')][_0xba09('0x11')]);}else{logger[_0xba09('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x2b996f,_0xba09('0xc'));_0x6f8817(_0x325f04[_0xba09('0x12')][_0xba09('0x11')]);}})[_0xba09('0x13')](function(_0x1d85e9){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2b996f,_0x1d85e9);_0xf2a488(_0x1d85e9);});});}exports[_0xba09('0x14')]=function(_0x4226b2){var _0x42455b=this;return new Promise(function(_0x24bb39,_0x112923){return db['VoiceCallReport'][_0xba09('0x15')]({'raw':_0x4226b2[_0xba09('0x16')]?_0x4226b2[_0xba09('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4226b2['options']?_0x4226b2[_0xba09('0x16')][_0xba09('0x17')]||null:null,'attributes':_0x4226b2[_0xba09('0x16')]?_0x4226b2[_0xba09('0x16')]['attributes']||null:null,'limit':_0x4226b2[_0xba09('0x16')]?_0x4226b2[_0xba09('0x16')][_0xba09('0x18')]||null:null,'include':_0x4226b2['options']?_0x4226b2[_0xba09('0x16')][_0xba09('0x19')]?_[_0xba09('0x1a')](_0x4226b2['options'][_0xba09('0x19')],function(_0x41aa21){return{'model':db[_0x41aa21['model']],'as':_0x41aa21['as'],'attributes':_0x41aa21[_0xba09('0x1b')],'include':_0x41aa21['include']?_[_0xba09('0x1a')](_0x41aa21[_0xba09('0x19')],function(_0x302c4d){return{'model':db[_0x302c4d['model']],'as':_0x302c4d['as'],'attributes':_0x302c4d['attributes'],'include':_0x302c4d['include']?_['map'](_0x302c4d['include'],function(_0x558e9b){return{'model':db[_0x558e9b[_0xba09('0x1c')]],'as':_0x558e9b['as'],'attributes':_0x558e9b[_0xba09('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f096f){logger[_0xba09('0xa')](_0xba09('0x14'),_0x4226b2);logger[_0xba09('0xd')]('GetVoiceCallReport',_0x4226b2,JSON[_0xba09('0xe')](_0x5f096f));_0x24bb39(_0x5f096f);})[_0xba09('0x13')](function(_0x5ed934){logger[_0xba09('0xf')]('GetVoiceCallReport',_0x5ed934[_0xba09('0x11')],_0x4226b2);_0x112923(_0x42455b['error'](0x1f4,_0x5ed934[_0xba09('0x11')]));});});};exports[_0xba09('0x1d')]=function(_0xb40c12){var _0x2729de=this;return new Promise(function(_0x5cf420,_0x3a20ce){return db[_0xba09('0x1e')]['create'](_0xb40c12['body'],{'raw':_0xb40c12['options']?_0xb40c12['options'][_0xba09('0x1f')]===undefined?!![]:![]:!![]})[_0xba09('0x20')](function(_0x529d1d){logger[_0xba09('0xa')](_0xba09('0x1d'),_0xb40c12);logger[_0xba09('0xd')](_0xba09('0x1d'),_0xb40c12,JSON[_0xba09('0xe')](_0x529d1d));_0x5cf420(_0x529d1d);})[_0xba09('0x13')](function(_0x4963d7){logger[_0xba09('0xf')]('CreateVoiceCallReport',_0x4963d7[_0xba09('0x11')],_0xb40c12);_0x3a20ce(_0x2729de[_0xba09('0xf')](0x1f4,_0x4963d7[_0xba09('0x11')]));});});};exports[_0xba09('0x21')]=function(_0x10e9c7){var _0x8134d=this;return new Promise(function(_0x355bdf,_0x1f5776){return db[_0xba09('0x1e')][_0xba09('0x22')](_0x10e9c7[_0xba09('0x23')],{'raw':_0x10e9c7[_0xba09('0x16')]?_0x10e9c7['options'][_0xba09('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10e9c7[_0xba09('0x16')]?_0x10e9c7[_0xba09('0x16')][_0xba09('0x17')]||null:null,'attributes':_0x10e9c7[_0xba09('0x16')]?_0x10e9c7[_0xba09('0x16')][_0xba09('0x1b')]||null:null,'limit':_0x10e9c7[_0xba09('0x16')]?_0x10e9c7['options']['limit']||null:null})[_0xba09('0x20')](function(_0x492dd7){logger[_0xba09('0xa')](_0xba09('0x21'),_0x10e9c7);logger[_0xba09('0xd')](_0xba09('0x21'),_0x10e9c7,JSON[_0xba09('0xe')](_0x492dd7));_0x355bdf(_0x492dd7);})[_0xba09('0x13')](function(_0x2c8e7e){logger[_0xba09('0xf')]('UpdateVoiceCallReport',_0x2c8e7e['message'],_0x10e9c7);_0x1f5776(_0x8134d[_0xba09('0xf')](0x1f4,_0x2c8e7e[_0xba09('0x11')]));});});}; \ No newline at end of file +var _0x1556=['jayson/promise','client','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','include','map','attributes','model','then','info','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x22748b,_0x34ff19){var _0x6c6ab2=function(_0x33a222){while(--_0x33a222){_0x22748b['push'](_0x22748b['shift']());}};_0x6c6ab2(++_0x34ff19);}(_0x1556,0x14e));var _0x6155=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1556[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x6155('0x0'));var util=require(_0x6155('0x1'));var moment=require(_0x6155('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6155('0x3'))['db'];var utils=require(_0x6155('0x4'));var logger=require(_0x6155('0x5'))(_0x6155('0x6'));var config=require(_0x6155('0x7'));var jayson=require(_0x6155('0x8'));var client=jayson[_0x6155('0x9')][_0x6155('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45dc18,_0x4225e9,_0x31beb5){return new BPromise(function(_0xe18855,_0x2fdd2a){return client[_0x6155('0xb')](_0x45dc18,_0x31beb5)['then'](function(_0x129ea5){logger['info'](_0x6155('0xc'),_0x4225e9,_0x6155('0xd'));logger[_0x6155('0xe')](_0x6155('0xf'),_0x4225e9,'request\x20sent',JSON['stringify'](_0x129ea5));if(_0x129ea5[_0x6155('0x10')]){if(_0x129ea5[_0x6155('0x10')]['code']===0x1f4){logger['error'](_0x6155('0xc'),_0x4225e9,_0x129ea5[_0x6155('0x10')][_0x6155('0x11')]);return _0x2fdd2a(_0x129ea5[_0x6155('0x10')][_0x6155('0x11')]);}logger[_0x6155('0x10')](_0x6155('0xc'),_0x4225e9,_0x129ea5[_0x6155('0x10')][_0x6155('0x11')]);return _0xe18855(_0x129ea5['error']['message']);}else{logger['info'](_0x6155('0xc'),_0x4225e9,'request\x20sent');_0xe18855(_0x129ea5['result'][_0x6155('0x11')]);}})[_0x6155('0x12')](function(_0x52b4bb){logger[_0x6155('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x4225e9,_0x52b4bb);_0x2fdd2a(_0x52b4bb);});});}exports[_0x6155('0x13')]=function(_0x499890){var _0x1ec1ee=this;return new Promise(function(_0xf5199c,_0x386da8){return db[_0x6155('0x14')][_0x6155('0x15')]({'raw':_0x499890[_0x6155('0x16')]?_0x499890['options'][_0x6155('0x17')]===undefined?!![]:![]:!![],'where':_0x499890[_0x6155('0x16')]?_0x499890[_0x6155('0x16')][_0x6155('0x18')]||null:null,'attributes':_0x499890['options']?_0x499890['options']['attributes']||null:null,'limit':_0x499890['options']?_0x499890[_0x6155('0x16')][_0x6155('0x19')]||null:null,'include':_0x499890[_0x6155('0x16')]?_0x499890[_0x6155('0x16')][_0x6155('0x1a')]?_[_0x6155('0x1b')](_0x499890[_0x6155('0x16')][_0x6155('0x1a')],function(_0x57807a){return{'model':db[_0x57807a['model']],'as':_0x57807a['as'],'attributes':_0x57807a[_0x6155('0x1c')],'include':_0x57807a['include']?_['map'](_0x57807a['include'],function(_0x57eb27){return{'model':db[_0x57eb27[_0x6155('0x1d')]],'as':_0x57eb27['as'],'attributes':_0x57eb27['attributes'],'include':_0x57eb27[_0x6155('0x1a')]?_[_0x6155('0x1b')](_0x57eb27[_0x6155('0x1a')],function(_0x8f8dc0){return{'model':db[_0x8f8dc0[_0x6155('0x1d')]],'as':_0x8f8dc0['as'],'attributes':_0x8f8dc0['attributes']};}):[]};}):[]};}):[]:[]})[_0x6155('0x1e')](function(_0x1be632){logger[_0x6155('0x1f')](_0x6155('0x13'),_0x499890);logger[_0x6155('0xe')]('GetVoiceCallReport',_0x499890,JSON[_0x6155('0x20')](_0x1be632));_0xf5199c(_0x1be632);})['catch'](function(_0x4a0134){logger['error'](_0x6155('0x13'),_0x4a0134['message'],_0x499890);_0x386da8(_0x1ec1ee[_0x6155('0x10')](0x1f4,_0x4a0134[_0x6155('0x11')]));});});};exports[_0x6155('0x21')]=function(_0x693cea){var _0x3b1803=this;return new Promise(function(_0x531ebf,_0x33d7fa){return db[_0x6155('0x14')][_0x6155('0x22')](_0x693cea[_0x6155('0x23')],{'raw':_0x693cea[_0x6155('0x16')]?_0x693cea[_0x6155('0x16')][_0x6155('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xf0d0f0){logger['info'](_0x6155('0x21'),_0x693cea);logger[_0x6155('0xe')]('CreateVoiceCallReport',_0x693cea,JSON[_0x6155('0x20')](_0xf0d0f0));_0x531ebf(_0xf0d0f0);})[_0x6155('0x12')](function(_0x17cb9c){logger[_0x6155('0x10')]('CreateVoiceCallReport',_0x17cb9c[_0x6155('0x11')],_0x693cea);_0x33d7fa(_0x3b1803[_0x6155('0x10')](0x1f4,_0x17cb9c['message']));});});};exports[_0x6155('0x24')]=function(_0x4afd07){var _0x4e0e18=this;return new Promise(function(_0x36cc94,_0x147a15){return db[_0x6155('0x14')][_0x6155('0x25')](_0x4afd07[_0x6155('0x23')],{'raw':_0x4afd07[_0x6155('0x16')]?_0x4afd07['options'][_0x6155('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4afd07[_0x6155('0x16')]?_0x4afd07['options']['where']||null:null,'attributes':_0x4afd07['options']?_0x4afd07['options'][_0x6155('0x1c')]||null:null,'limit':_0x4afd07[_0x6155('0x16')]?_0x4afd07['options']['limit']||null:null})[_0x6155('0x1e')](function(_0x18d139){logger[_0x6155('0x1f')]('UpdateVoiceCallReport',_0x4afd07);logger['debug'](_0x6155('0x24'),_0x4afd07,JSON[_0x6155('0x20')](_0x18d139));_0x36cc94(_0x18d139);})[_0x6155('0x12')](function(_0x770bf1){logger['error'](_0x6155('0x24'),_0x770bf1[_0x6155('0x11')],_0x4afd07);_0x147a15(_0x4e0e18[_0x6155('0x10')](0x1f4,_0x770bf1[_0x6155('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index df3d12f..2dd7c6d 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 _0x7dc1=['delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','update'];(function(_0x189887,_0x1d92e5){var _0x38d2c4=function(_0x211174){while(--_0x211174){_0x189887['push'](_0x189887['shift']());}};_0x38d2c4(++_0x1d92e5);}(_0x7dc1,0x16b));var _0x17dc=function(_0x4678f9,_0x57b28f){_0x4678f9=_0x4678f9-0x0;var _0x4c7956=_0x7dc1[_0x4678f9];return _0x4c7956;};'use strict';var multer=require(_0x17dc('0x0'));var util=require(_0x17dc('0x1'));var path=require('path');var timeout=require(_0x17dc('0x2'));var express=require(_0x17dc('0x3'));var router=express['Router']();var fs_extra=require(_0x17dc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x17dc('0x5'));var config=require(_0x17dc('0x6'));var controller=require(_0x17dc('0x7'));router[_0x17dc('0x8')]('/',auth[_0x17dc('0x9')](),controller[_0x17dc('0xa')]);router[_0x17dc('0x8')](_0x17dc('0xb'),auth[_0x17dc('0x9')](),controller[_0x17dc('0xc')]);router['post']('/',auth[_0x17dc('0x9')](),controller[_0x17dc('0xd')]);router['put']('/:id',auth[_0x17dc('0x9')](),controller[_0x17dc('0xe')]);router[_0x17dc('0xf')](_0x17dc('0xb'),auth[_0x17dc('0x9')](),controller[_0x17dc('0x10')]);module[_0x17dc('0x11')]=router; \ No newline at end of file +var _0xd639=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xd639,0x181));var _0x9d63=function(_0x349a1e,_0x395477){_0x349a1e=_0x349a1e-0x0;var _0x1cfaff=_0xd639[_0x349a1e];return _0x1cfaff;};'use strict';var multer=require(_0x9d63('0x0'));var util=require(_0x9d63('0x1'));var path=require(_0x9d63('0x2'));var timeout=require(_0x9d63('0x3'));var express=require(_0x9d63('0x4'));var router=express[_0x9d63('0x5')]();var fs_extra=require(_0x9d63('0x6'));var auth=require(_0x9d63('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9d63('0x8'));var controller=require(_0x9d63('0x9'));router[_0x9d63('0xa')]('/',auth[_0x9d63('0xb')](),controller[_0x9d63('0xc')]);router[_0x9d63('0xa')]('/:id',auth[_0x9d63('0xb')](),controller[_0x9d63('0xd')]);router['post']('/',auth[_0x9d63('0xb')](),controller[_0x9d63('0xe')]);router[_0x9d63('0xf')]('/:id',auth[_0x9d63('0xb')](),controller[_0x9d63('0x10')]);router[_0x9d63('0x11')]('/:id',auth[_0x9d63('0xb')](),controller[_0x9d63('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 5bf9003..22cba64 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 _0x754d=['exports','STRING','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0xfeec3c,_0x14387b){var _0x15a4a4=function(_0x4f6500){while(--_0x4f6500){_0xfeec3c['push'](_0xfeec3c['shift']());}};_0x15a4a4(++_0x14387b);}(_0x754d,0x92));var _0xd754=function(_0xffb368,_0x3dab56){_0xffb368=_0xffb368-0x0;var _0x55cc41=_0x754d[_0xffb368];return _0x55cc41;};'use strict';var Sequelize=require(_0xd754('0x0'));module[_0xd754('0x1')]={'name':{'type':Sequelize[_0xd754('0x2')]},'prefix':{'type':Sequelize[_0xd754('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xd754('0x2')],'set':function(_0x51847c){this['setDataValue']('options',_0x51847c?_0x51847c['join'](''):[]);},'get':function(){return this[_0xd754('0x3')](_0xd754('0x4'))?this[_0xd754('0x3')](_0xd754('0x4'))[_0xd754('0x5')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xd754('0x2')]},'record':{'type':Sequelize[_0xd754('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd754('0x2')]}}; \ No newline at end of file +var _0x0130=['name','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x5a54d2,_0x14a5c9){var _0x9aa3b0=function(_0x5b4884){while(--_0x5b4884){_0x5a54d2['push'](_0x5a54d2['shift']());}};_0x9aa3b0(++_0x14a5c9);}(_0x0130,0xb1));var _0x0013=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x0130[_0xa3463d];return _0x50fd67;};'use strict';var Sequelize=require(_0x0013('0x0'));module[_0x0013('0x1')]={'name':{'type':Sequelize[_0x0013('0x2')]},'prefix':{'type':Sequelize[_0x0013('0x2')],'unique':_0x0013('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x0013('0x2')],'set':function(_0x17099a){this['setDataValue'](_0x0013('0x4'),_0x17099a?_0x17099a[_0x0013('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x0013('0x4'))?this[_0x0013('0x6')](_0x0013('0x4'))[_0x0013('0x7')](''):[];}},'auth':{'type':Sequelize[_0x0013('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x0013('0x2')]},'record':{'type':Sequelize[_0x0013('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0013('0x2')]},'description':{'type':Sequelize[_0x0013('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8734d7d..79f1f11 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 _0x1a9e=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','map','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','intersection'];(function(_0x37e850,_0x5d92cb){var _0x18c21f=function(_0xc54570){while(--_0xc54570){_0x37e850['push'](_0x37e850['shift']());}};_0x18c21f(++_0x5d92cb);}(_0x1a9e,0x122));var _0xe1a9=function(_0x5ad4f1,_0x16a190){_0x5ad4f1=_0x5ad4f1-0x0;var _0x3fcba6=_0x1a9e[_0x5ad4f1];return _0x3fcba6;};'use strict';var emlformat=require(_0xe1a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe1a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1a9('0x2'));var moment=require(_0xe1a9('0x3'));var BPromise=require(_0xe1a9('0x4'));var Mustache=require(_0xe1a9('0x5'));var util=require(_0xe1a9('0x6'));var path=require('path');var sox=require(_0xe1a9('0x7'));var csv=require(_0xe1a9('0x8'));var ejs=require(_0xe1a9('0x9'));var fs=require('fs');var fs_extra=require(_0xe1a9('0xa'));var _=require(_0xe1a9('0xb'));var squel=require(_0xe1a9('0xc'));var crypto=require('crypto');var jsforce=require(_0xe1a9('0xd'));var deskjs=require(_0xe1a9('0xe'));var toCsv=require(_0xe1a9('0x8'));var querystring=require(_0xe1a9('0xf'));var Papa=require(_0xe1a9('0x10'));var Redis=require(_0xe1a9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1a9('0x12'))(_0xe1a9('0x13'));var utils=require(_0xe1a9('0x14'));var config=require(_0xe1a9('0x15'));var licenseUtil=require(_0xe1a9('0x16'));var db=require(_0xe1a9('0x17'))['db'];function respondWithStatusCode(_0x2bfa6b,_0x3e6fe8){_0x3e6fe8=_0x3e6fe8||0xcc;return function(_0x29c33d){if(_0x29c33d){return _0x2bfa6b['sendStatus'](_0x3e6fe8);}return _0x2bfa6b[_0xe1a9('0x18')](_0x3e6fe8)[_0xe1a9('0x19')]();};}function respondWithResult(_0x2a7b73,_0x52401d){_0x52401d=_0x52401d||0xc8;return function(_0x54cb9e){if(_0x54cb9e){return _0x2a7b73[_0xe1a9('0x18')](_0x52401d)['json'](_0x54cb9e);}};}function respondWithFilteredResult(_0x5c1d4b,_0x5c2be4){return function(_0x164f8b){if(_0x164f8b){var _0x26d99d=typeof _0x5c2be4[_0xe1a9('0x1a')]===_0xe1a9('0x1b')&&typeof _0x5c2be4[_0xe1a9('0x1c')]===_0xe1a9('0x1b');var _0x592a69=_0x164f8b[_0xe1a9('0x1d')];var _0x17dc26=_0x26d99d?0x0:_0x5c2be4[_0xe1a9('0x1a')];var _0x2f0074=_0x26d99d?_0x164f8b[_0xe1a9('0x1d')]:_0x5c2be4['offset']+_0x5c2be4['limit'];var _0x3cdb61;if(_0x2f0074>=_0x592a69){_0x2f0074=_0x592a69;_0x3cdb61=0xc8;}else{_0x3cdb61=0xce;}_0x5c1d4b[_0xe1a9('0x18')](_0x3cdb61);return _0x5c1d4b[_0xe1a9('0x1e')](_0xe1a9('0x1f'),_0x17dc26+'-'+_0x2f0074+'/'+_0x592a69)[_0xe1a9('0x20')](_0x164f8b);}return null;};}function patchUpdates(_0x20e4b3){return function(_0x4cd350){try{jsonpatch['apply'](_0x4cd350,_0x20e4b3,!![]);}catch(_0x7eff2f){return BPromise[_0xe1a9('0x21')](_0x7eff2f);}return _0x4cd350[_0xe1a9('0x22')]();};}function saveUpdates(_0x59e777,_0x485d39){return function(_0x368ee3){if(_0x368ee3){return _0x368ee3[_0xe1a9('0x23')](_0x59e777)['then'](function(_0x51ec13){return _0x51ec13;});}return null;};}function removeEntity(_0x110264,_0x18be9d){return function(_0x1db8f7){if(_0x1db8f7){return _0x1db8f7[_0xe1a9('0x24')]()[_0xe1a9('0x25')](function(){var _0x33a8f2=_0x1db8f7[_0xe1a9('0x26')]({'plain':!![]});var _0x1e0da3='ChanSpies';return db[_0xe1a9('0x27')][_0xe1a9('0x24')]({'where':{'type':_0x1e0da3,'resourceId':_0x33a8f2['id']}})[_0xe1a9('0x25')](function(){return _0x1db8f7;});})['then'](function(){_0x110264[_0xe1a9('0x18')](0xcc)[_0xe1a9('0x19')]();});}};}function handleEntityNotFound(_0x3b72a3,_0x2916b4){return function(_0x2e396a){if(!_0x2e396a){_0x3b72a3['sendStatus'](0x194);}return _0x2e396a;};}function handleError(_0x4ab251,_0x3669a6){_0x3669a6=_0x3669a6||0x1f4;return function(_0x15cc75){logger[_0xe1a9('0x28')](_0x15cc75[_0xe1a9('0x29')]);if(_0x15cc75['name']){delete _0x15cc75[_0xe1a9('0x2a')];}_0x4ab251[_0xe1a9('0x18')](_0x3669a6)[_0xe1a9('0x2b')](_0x15cc75);};}exports[_0xe1a9('0x2c')]=function(_0xae0ed,_0x48c089){var _0x5b0914={},_0x3b2130={},_0x40f1f6={'count':0x0,'rows':[]};var _0x3f9831=_['map'](db[_0xe1a9('0x2d')][_0xe1a9('0x2e')],function(_0x4e7390){return{'name':_0x4e7390[_0xe1a9('0x2f')],'type':_0x4e7390[_0xe1a9('0x30')][_0xe1a9('0x31')]};});_0x3b2130[_0xe1a9('0x32')]=_['map'](_0x3f9831,'name');_0x3b2130[_0xe1a9('0x33')]=_[_0xe1a9('0x34')](_0xae0ed[_0xe1a9('0x33')]);_0x3b2130['filters']=_[_0xe1a9('0x35')](_0x3b2130[_0xe1a9('0x32')],_0x3b2130[_0xe1a9('0x33')]);_0x5b0914[_0xe1a9('0x36')]=_['intersection'](_0x3b2130[_0xe1a9('0x32')],qs[_0xe1a9('0x37')](_0xae0ed[_0xe1a9('0x33')]['fields']));_0x5b0914[_0xe1a9('0x36')]=_0x5b0914['attributes'][_0xe1a9('0x38')]?_0x5b0914[_0xe1a9('0x36')]:_0x3b2130['model'];if(!_0xae0ed['query'][_0xe1a9('0x39')](_0xe1a9('0x3a'))){_0x5b0914[_0xe1a9('0x1c')]=qs[_0xe1a9('0x1c')](_0xae0ed[_0xe1a9('0x33')][_0xe1a9('0x1c')]);_0x5b0914['offset']=qs[_0xe1a9('0x1a')](_0xae0ed[_0xe1a9('0x33')][_0xe1a9('0x1a')]);}_0x5b0914['order']=qs[_0xe1a9('0x3b')](_0xae0ed[_0xe1a9('0x33')][_0xe1a9('0x3b')]);_0x5b0914[_0xe1a9('0x3c')]=qs[_0xe1a9('0x3d')](_[_0xe1a9('0x3e')](_0xae0ed[_0xe1a9('0x33')],_0x3b2130[_0xe1a9('0x3d')]),_0x3f9831);if(_0xae0ed['query']['filter']){_0x5b0914[_0xe1a9('0x3c')]=_[_0xe1a9('0x3f')](_0x5b0914[_0xe1a9('0x3c')],{'$or':_[_0xe1a9('0x40')](_0x3f9831,function(_0x5b7fa6){if(_0x5b7fa6[_0xe1a9('0x30')]!==_0xe1a9('0x41')){var _0x294b81={};_0x294b81[_0x5b7fa6[_0xe1a9('0x2a')]]={'$like':'%'+_0xae0ed[_0xe1a9('0x33')][_0xe1a9('0x42')]+'%'};return _0x294b81;}})});}_0x5b0914=_[_0xe1a9('0x3f')]({},_0x5b0914,_0xae0ed['options']);var _0x4c517d={'where':_0x5b0914[_0xe1a9('0x3c')]};return db[_0xe1a9('0x2d')][_0xe1a9('0x1d')](_0x4c517d)[_0xe1a9('0x25')](function(_0x28ac01){_0x40f1f6[_0xe1a9('0x1d')]=_0x28ac01;if(_0xae0ed['query'][_0xe1a9('0x43')]){_0x5b0914[_0xe1a9('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xe1a9('0x45')](_0x5b0914);})[_0xe1a9('0x25')](function(_0x1ef7b1){_0x40f1f6[_0xe1a9('0x46')]=_0x1ef7b1;return _0x40f1f6;})[_0xe1a9('0x25')](respondWithFilteredResult(_0x48c089,_0x5b0914))[_0xe1a9('0x47')](handleError(_0x48c089,null));};exports[_0xe1a9('0x48')]=function(_0x2cc4c5,_0x430caf){var _0x20d858={'raw':![],'where':{'id':_0x2cc4c5[_0xe1a9('0x49')]['id']}},_0x25bd31={};_0x25bd31[_0xe1a9('0x32')]=_[_0xe1a9('0x34')](db[_0xe1a9('0x2d')][_0xe1a9('0x2e')]);_0x25bd31[_0xe1a9('0x33')]=_[_0xe1a9('0x34')](_0x2cc4c5[_0xe1a9('0x33')]);_0x25bd31[_0xe1a9('0x3d')]=_[_0xe1a9('0x35')](_0x25bd31['model'],_0x25bd31[_0xe1a9('0x33')]);_0x20d858[_0xe1a9('0x36')]=_[_0xe1a9('0x35')](_0x25bd31[_0xe1a9('0x32')],qs['fields'](_0x2cc4c5[_0xe1a9('0x33')]['fields']));_0x20d858['attributes']=_0x20d858['attributes'][_0xe1a9('0x38')]?_0x20d858[_0xe1a9('0x36')]:_0x25bd31[_0xe1a9('0x32')];if(_0x2cc4c5[_0xe1a9('0x33')]['includeAll']){_0x20d858[_0xe1a9('0x44')]=[{'all':!![]}];}_0x20d858=_[_0xe1a9('0x3f')]({},_0x20d858,_0x2cc4c5[_0xe1a9('0x4a')]);return db['VoiceChanSpy']['find'](_0x20d858)[_0xe1a9('0x25')](handleEntityNotFound(_0x430caf,null))[_0xe1a9('0x25')](respondWithResult(_0x430caf,null))[_0xe1a9('0x47')](handleError(_0x430caf,null));};exports[_0xe1a9('0x4b')]=function(_0x377370,_0x58b9a4){return db[_0xe1a9('0x2d')]['create'](_0x377370[_0xe1a9('0x4c')],{})[_0xe1a9('0x25')](function(_0x199390){var _0x20ff0d=_0x377370[_0xe1a9('0x4d')][_0xe1a9('0x26')]({'plain':!![]});if(!_0x20ff0d)throw new Error(_0xe1a9('0x4e'));if(_0x20ff0d[_0xe1a9('0x4f')]===_0xe1a9('0x4d')){var _0x424ed8=_0x199390[_0xe1a9('0x26')]({'plain':!![]});var _0x47e6b8=_0xe1a9('0x50');return db[_0xe1a9('0x51')][_0xe1a9('0x52')]({'where':{'name':_0x47e6b8,'userProfileId':_0x20ff0d[_0xe1a9('0x53')]},'raw':!![]})[_0xe1a9('0x25')](function(_0x5d58f5){if(_0x5d58f5&&_0x5d58f5[_0xe1a9('0x54')]===0x0){return db[_0xe1a9('0x27')][_0xe1a9('0x4b')]({'name':_0x424ed8[_0xe1a9('0x2a')],'resourceId':_0x424ed8['id'],'type':_0x5d58f5[_0xe1a9('0x2a')],'sectionId':_0x5d58f5['id']},{})[_0xe1a9('0x25')](function(){return _0x199390;});}else{return _0x199390;}})[_0xe1a9('0x47')](function(_0x466537){logger[_0xe1a9('0x28')](_0xe1a9('0x55'),_0x466537);throw _0x466537;});}return _0x199390;})[_0xe1a9('0x25')](respondWithResult(_0x58b9a4,0xc9))[_0xe1a9('0x47')](handleError(_0x58b9a4,null));};exports[_0xe1a9('0x23')]=function(_0x5be8a4,_0x1fc3fe){if(_0x5be8a4[_0xe1a9('0x4c')]['id']){delete _0x5be8a4[_0xe1a9('0x4c')]['id'];}return db[_0xe1a9('0x2d')][_0xe1a9('0x52')]({'where':{'id':_0x5be8a4[_0xe1a9('0x49')]['id']}})[_0xe1a9('0x25')](handleEntityNotFound(_0x1fc3fe,null))['then'](saveUpdates(_0x5be8a4['body'],null))[_0xe1a9('0x25')](respondWithResult(_0x1fc3fe,null))['catch'](handleError(_0x1fc3fe,null));};exports['destroy']=function(_0x8b6853,_0x303117){return db[_0xe1a9('0x2d')][_0xe1a9('0x52')]({'where':{'id':_0x8b6853[_0xe1a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x303117,null))[_0xe1a9('0x25')](removeEntity(_0x303117,null))[_0xe1a9('0x47')](handleError(_0x303117,null));}; \ No newline at end of file +var _0x345e=['filter','VIRTUAL','merge','options','VoiceChanSpy','includeAll','include','findAll','rows','show','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','ChanSpies','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick'];(function(_0x5b4e39,_0xd41c6c){var _0x3931f7=function(_0x10f1d5){while(--_0x10f1d5){_0x5b4e39['push'](_0x5b4e39['shift']());}};_0x3931f7(++_0xd41c6c);}(_0x345e,0x168));var _0xe345=function(_0xf1081a,_0xfe4f04){_0xf1081a=_0xf1081a-0x0;var _0x311841=_0x345e[_0xf1081a];return _0x311841;};'use strict';var emlformat=require(_0xe345('0x0'));var rimraf=require(_0xe345('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe345('0x2'));var rp=require(_0xe345('0x3'));var moment=require(_0xe345('0x4'));var BPromise=require(_0xe345('0x5'));var Mustache=require(_0xe345('0x6'));var util=require(_0xe345('0x7'));var path=require(_0xe345('0x8'));var sox=require(_0xe345('0x9'));var csv=require(_0xe345('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe345('0xb'));var _=require(_0xe345('0xc'));var squel=require(_0xe345('0xd'));var crypto=require(_0xe345('0xe'));var jsforce=require(_0xe345('0xf'));var deskjs=require(_0xe345('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe345('0x11'));var Redis=require(_0xe345('0x12'));var authService=require(_0xe345('0x13'));var qs=require(_0xe345('0x14'));var as=require(_0xe345('0x15'));var hardwareService=require(_0xe345('0x16'));var logger=require(_0xe345('0x17'))(_0xe345('0x18'));var utils=require(_0xe345('0x19'));var config=require(_0xe345('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe345('0x1b'))['db'];function respondWithStatusCode(_0x1a8ced,_0x5a5df4){_0x5a5df4=_0x5a5df4||0xcc;return function(_0x5d9379){if(_0x5d9379){return _0x1a8ced[_0xe345('0x1c')](_0x5a5df4);}return _0x1a8ced['status'](_0x5a5df4)[_0xe345('0x1d')]();};}function respondWithResult(_0x4ee2e9,_0x510923){_0x510923=_0x510923||0xc8;return function(_0x28af76){if(_0x28af76){return _0x4ee2e9[_0xe345('0x1e')](_0x510923)[_0xe345('0x1f')](_0x28af76);}};}function respondWithFilteredResult(_0x60ee31,_0x263ee0){return function(_0x1ce318){if(_0x1ce318){var _0x1d3717=typeof _0x263ee0[_0xe345('0x20')]===_0xe345('0x21')&&typeof _0x263ee0[_0xe345('0x22')]==='undefined';var _0x4f3887=_0x1ce318[_0xe345('0x23')];var _0x21f20a=_0x1d3717?0x0:_0x263ee0[_0xe345('0x20')];var _0x11332c=_0x1d3717?_0x1ce318[_0xe345('0x23')]:_0x263ee0['offset']+_0x263ee0[_0xe345('0x22')];var _0x143856;if(_0x11332c>=_0x4f3887){_0x11332c=_0x4f3887;_0x143856=0xc8;}else{_0x143856=0xce;}_0x60ee31['status'](_0x143856);return _0x60ee31[_0xe345('0x24')](_0xe345('0x25'),_0x21f20a+'-'+_0x11332c+'/'+_0x4f3887)[_0xe345('0x1f')](_0x1ce318);}return null;};}function patchUpdates(_0x6ea93d){return function(_0xe94a03){try{jsonpatch[_0xe345('0x26')](_0xe94a03,_0x6ea93d,!![]);}catch(_0x5a8c9b){return BPromise[_0xe345('0x27')](_0x5a8c9b);}return _0xe94a03['save']();};}function saveUpdates(_0x176e04,_0x5e3308){return function(_0x2d77ff){if(_0x2d77ff){return _0x2d77ff[_0xe345('0x28')](_0x176e04)[_0xe345('0x29')](function(_0x442811){return _0x442811;});}return null;};}function removeEntity(_0x47cb89,_0x5f2641){return function(_0x46f64d){if(_0x46f64d){return _0x46f64d[_0xe345('0x2a')]()['then'](function(){var _0x575c9a=_0x46f64d['get']({'plain':!![]});var _0x3dac93=_0xe345('0x2b');return db[_0xe345('0x2c')]['destroy']({'where':{'type':_0x3dac93,'resourceId':_0x575c9a['id']}})['then'](function(){return _0x46f64d;});})[_0xe345('0x29')](function(){_0x47cb89['status'](0xcc)[_0xe345('0x1d')]();});}};}function handleEntityNotFound(_0x76b74c,_0x4cd00e){return function(_0x517ffa){if(!_0x517ffa){_0x76b74c[_0xe345('0x1c')](0x194);}return _0x517ffa;};}function handleError(_0x5b527a,_0xa1c821){_0xa1c821=_0xa1c821||0x1f4;return function(_0x4aee1f){logger[_0xe345('0x2d')](_0x4aee1f['stack']);if(_0x4aee1f['name']){delete _0x4aee1f[_0xe345('0x2e')];}_0x5b527a[_0xe345('0x1e')](_0xa1c821)[_0xe345('0x2f')](_0x4aee1f);};}exports[_0xe345('0x30')]=function(_0x256585,_0x4c650a){var _0x13a4d4={},_0x34ec29={},_0x246a91={'count':0x0,'rows':[]};var _0x1bb9f7=_[_0xe345('0x31')](db['VoiceChanSpy'][_0xe345('0x32')],function(_0x374349){return{'name':_0x374349['fieldName'],'type':_0x374349[_0xe345('0x33')][_0xe345('0x34')]};});_0x34ec29[_0xe345('0x35')]=_['map'](_0x1bb9f7,'name');_0x34ec29[_0xe345('0x36')]=_[_0xe345('0x37')](_0x256585['query']);_0x34ec29[_0xe345('0x38')]=_[_0xe345('0x39')](_0x34ec29[_0xe345('0x35')],_0x34ec29[_0xe345('0x36')]);_0x13a4d4[_0xe345('0x3a')]=_[_0xe345('0x39')](_0x34ec29[_0xe345('0x35')],qs[_0xe345('0x3b')](_0x256585[_0xe345('0x36')]['fields']));_0x13a4d4[_0xe345('0x3a')]=_0x13a4d4[_0xe345('0x3a')][_0xe345('0x3c')]?_0x13a4d4[_0xe345('0x3a')]:_0x34ec29[_0xe345('0x35')];if(!_0x256585[_0xe345('0x36')]['hasOwnProperty']('nolimit')){_0x13a4d4['limit']=qs[_0xe345('0x22')](_0x256585['query'][_0xe345('0x22')]);_0x13a4d4[_0xe345('0x20')]=qs[_0xe345('0x20')](_0x256585[_0xe345('0x36')]['offset']);}_0x13a4d4[_0xe345('0x3d')]=qs[_0xe345('0x3e')](_0x256585[_0xe345('0x36')]['sort']);_0x13a4d4[_0xe345('0x3f')]=qs[_0xe345('0x38')](_[_0xe345('0x40')](_0x256585['query'],_0x34ec29['filters']),_0x1bb9f7);if(_0x256585[_0xe345('0x36')][_0xe345('0x41')]){_0x13a4d4[_0xe345('0x3f')]=_['merge'](_0x13a4d4['where'],{'$or':_[_0xe345('0x31')](_0x1bb9f7,function(_0x20007e){if(_0x20007e[_0xe345('0x33')]!==_0xe345('0x42')){var _0x3452f9={};_0x3452f9[_0x20007e[_0xe345('0x2e')]]={'$like':'%'+_0x256585[_0xe345('0x36')][_0xe345('0x41')]+'%'};return _0x3452f9;}})});}_0x13a4d4=_[_0xe345('0x43')]({},_0x13a4d4,_0x256585[_0xe345('0x44')]);var _0x4dfb17={'where':_0x13a4d4[_0xe345('0x3f')]};return db[_0xe345('0x45')][_0xe345('0x23')](_0x4dfb17)[_0xe345('0x29')](function(_0x52b848){_0x246a91['count']=_0x52b848;if(_0x256585['query'][_0xe345('0x46')]){_0x13a4d4[_0xe345('0x47')]=[{'all':!![]}];}return db[_0xe345('0x45')][_0xe345('0x48')](_0x13a4d4);})[_0xe345('0x29')](function(_0x7ce549){_0x246a91[_0xe345('0x49')]=_0x7ce549;return _0x246a91;})[_0xe345('0x29')](respondWithFilteredResult(_0x4c650a,_0x13a4d4))['catch'](handleError(_0x4c650a,null));};exports[_0xe345('0x4a')]=function(_0x4704ba,_0x4e8cac){var _0x53dbc7={'raw':![],'where':{'id':_0x4704ba[_0xe345('0x4b')]['id']}},_0x3fa377={};_0x3fa377[_0xe345('0x35')]=_['keys'](db[_0xe345('0x45')][_0xe345('0x32')]);_0x3fa377['query']=_['keys'](_0x4704ba[_0xe345('0x36')]);_0x3fa377[_0xe345('0x38')]=_['intersection'](_0x3fa377['model'],_0x3fa377[_0xe345('0x36')]);_0x53dbc7['attributes']=_[_0xe345('0x39')](_0x3fa377['model'],qs['fields'](_0x4704ba[_0xe345('0x36')][_0xe345('0x3b')]));_0x53dbc7[_0xe345('0x3a')]=_0x53dbc7[_0xe345('0x3a')][_0xe345('0x3c')]?_0x53dbc7[_0xe345('0x3a')]:_0x3fa377[_0xe345('0x35')];if(_0x4704ba[_0xe345('0x36')][_0xe345('0x46')]){_0x53dbc7['include']=[{'all':!![]}];}_0x53dbc7=_['merge']({},_0x53dbc7,_0x4704ba[_0xe345('0x44')]);return db[_0xe345('0x45')][_0xe345('0x4c')](_0x53dbc7)['then'](handleEntityNotFound(_0x4e8cac,null))[_0xe345('0x29')](respondWithResult(_0x4e8cac,null))[_0xe345('0x4d')](handleError(_0x4e8cac,null));};exports[_0xe345('0x4e')]=function(_0x22d1fe,_0x45ef35){return db['VoiceChanSpy']['create'](_0x22d1fe['body'],{})[_0xe345('0x29')](function(_0x1d924e){var _0x6f3a55=_0x22d1fe[_0xe345('0x4f')][_0xe345('0x50')]({'plain':!![]});if(!_0x6f3a55)throw new Error(_0xe345('0x51'));if(_0x6f3a55['role']===_0xe345('0x4f')){var _0x4a9b7f=_0x1d924e[_0xe345('0x50')]({'plain':!![]});var _0x2cac09=_0xe345('0x2b');return db['UserProfileSection'][_0xe345('0x4c')]({'where':{'name':_0x2cac09,'userProfileId':_0x6f3a55[_0xe345('0x52')]},'raw':!![]})['then'](function(_0x349c72){if(_0x349c72&&_0x349c72[_0xe345('0x53')]===0x0){return db[_0xe345('0x2c')]['create']({'name':_0x4a9b7f[_0xe345('0x2e')],'resourceId':_0x4a9b7f['id'],'type':_0x349c72['name'],'sectionId':_0x349c72['id']},{})[_0xe345('0x29')](function(){return _0x1d924e;});}else{return _0x1d924e;}})[_0xe345('0x4d')](function(_0x4e9b9f){logger[_0xe345('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e9b9f);throw _0x4e9b9f;});}return _0x1d924e;})['then'](respondWithResult(_0x45ef35,0xc9))[_0xe345('0x4d')](handleError(_0x45ef35,null));};exports[_0xe345('0x28')]=function(_0x3388d3,_0x5b8e1f){if(_0x3388d3['body']['id']){delete _0x3388d3['body']['id'];}return db[_0xe345('0x45')][_0xe345('0x4c')]({'where':{'id':_0x3388d3['params']['id']}})[_0xe345('0x29')](handleEntityNotFound(_0x5b8e1f,null))[_0xe345('0x29')](saveUpdates(_0x3388d3[_0xe345('0x54')],null))[_0xe345('0x29')](respondWithResult(_0x5b8e1f,null))['catch'](handleError(_0x5b8e1f,null));};exports[_0xe345('0x2a')]=function(_0x2663e7,_0x2333c0){return db['VoiceChanSpy'][_0xe345('0x4c')]({'where':{'id':_0x2663e7[_0xe345('0x4b')]['id']}})[_0xe345('0x29')](handleEntityNotFound(_0x2333c0,null))[_0xe345('0x29')](removeEntity(_0x2333c0,null))[_0xe345('0x4d')](handleError(_0x2333c0,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a82c6be..495d655 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 _0xa3f0=['password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate'];(function(_0x3e2e99,_0xad339){var _0x52ceef=function(_0x55c192){while(--_0x55c192){_0x3e2e99['push'](_0x3e2e99['shift']());}};_0x52ceef(++_0xad339);}(_0xa3f0,0xb5));var _0x0a3f=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0xa3f0[_0x3c6dce];return _0x1450e9;};'use strict';var _=require(_0x0a3f('0x0'));var util=require(_0x0a3f('0x1'));var BPromise=require(_0x0a3f('0x2'));var attributes=require(_0x0a3f('0x3'));var getUserApplications=function(_0x40f9ae,_0x4fe048,_0x9e6eb9){var _0x5a63db=0x1;var _0x1d672b=[];var _0x38c218={'context':_0x4fe048[_0x0a3f('0x4')]||_0x0a3f('0x5'),'exten':util['format']('%s%s',_0x40f9ae[_0x0a3f('0x6')],_0x9e6eb9),'type':_0x0a3f('0x7'),'isApp':![],'ChanSpyId':_0x40f9ae['id'],'UserId':_0x4fe048['id']};_0x1d672b[_0x0a3f('0x8')](_[_0x0a3f('0x9')]({'app':_0x0a3f('0xa'),'appdata':util[_0x0a3f('0xb')](_0x0a3f('0xc'),_0x0a3f('0xd')),'priority':_0x5a63db++},_0x38c218));if(_0x40f9ae[_0x0a3f('0xe')]){_0x1d672b[_0x0a3f('0x8')](_[_0x0a3f('0x9')]({'app':_0x0a3f('0xf'),'appdata':util['format'](_0x0a3f('0x10'),_0x40f9ae[_0x0a3f('0x11')]),'priority':_0x5a63db++},_0x38c218));}if(_0x40f9ae['auth']){_0x1d672b[_0x0a3f('0x8')](_[_0x0a3f('0x9')]({'app':_0x0a3f('0x12'),'appdata':_0x40f9ae[_0x0a3f('0x13')],'priority':_0x5a63db++},_0x38c218));}_0x1d672b[_0x0a3f('0x8')](_[_0x0a3f('0x9')]({'app':_0x0a3f('0x14'),'appdata':util[_0x0a3f('0xb')](_0x0a3f('0x15'),_0x4fe048[_0x0a3f('0x16')],_0x40f9ae['options']?_0x40f9ae[_0x0a3f('0x17')][_0x0a3f('0x18')](''):''),'priority':_0x5a63db++},_0x38c218));if(_0x40f9ae[_0x0a3f('0xe')]){_0x1d672b['push'](_[_0x0a3f('0x9')]({'app':_0x0a3f('0x19'),'priority':_0x5a63db++},_0x38c218));}return _0x1d672b;};var getChanSpyApplications=function(_0x40ce11,_0x5818e1){var _0x4b4ce2=[];for(var _0x970106=0x0,_0x476eb8=0x1;_0x970106<_0x5818e1[_0x0a3f('0x1a')];_0x970106++,_0x476eb8=0x1){_0x4b4ce2=_0x4b4ce2[_0x0a3f('0x1b')](getUserApplications(_0x40ce11,_0x5818e1[_0x970106],_0x5818e1[_0x970106]['internal']));if(_0x5818e1[_0x970106][_0x0a3f('0x1c')]!=_0x5818e1[_0x970106][_0x0a3f('0x16')]){_0x4b4ce2=_0x4b4ce2['concat'](getUserApplications(_0x40ce11,_0x5818e1[_0x970106],_0x5818e1[_0x970106][_0x0a3f('0x16')]));}}return _0x4b4ce2;};var getChanSpyPromise=function(_0x15b70a,_0x2fe328){return new BPromise(function(_0x263fa0,_0x43e798){return _0x15b70a['User'][_0x0a3f('0x1d')]({'attributes':['id',_0x0a3f('0x16'),_0x0a3f('0x1c')],'where':{'role':_0x0a3f('0x1e'),'chanspy':!![]},'raw':!![]})[_0x0a3f('0x1f')](function(_0x1828e0){if(_0x1828e0){return _0x263fa0(getChanSpyApplications(_0x2fe328,_0x1828e0));}return _0x263fa0([]);})[_0x0a3f('0x20')](function(_0x3094d2){_0x43e798(_0x3094d2);});});};module[_0x0a3f('0x21')]=function(_0x30677e,_0x3e0e06){var _0x33b20c=_0x30677e[_0x0a3f('0x22')];return _0x30677e[_0x0a3f('0x23')](_0x0a3f('0x24'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x50676d,_0x81249e,_0x20eae1){return getChanSpyPromise(_0x33b20c,_0x50676d)[_0x0a3f('0x1f')](function(_0x40ef4d){if(_0x40ef4d&&_0x40ef4d['length']){return _0x33b20c[_0x0a3f('0x25')][_0x0a3f('0x26')](_0x40ef4d);}})['then'](function(){_0x20eae1();})['catch'](function(_0x278f53){_0x20eae1(_0x278f53);});},'afterUpdate':function(_0xf2e7dd,_0x1f0f8b,_0x339de8){return _0x33b20c[_0x0a3f('0x25')][_0x0a3f('0x27')]({'where':{'ChanSpyId':_0xf2e7dd['id']}})['then'](function(){return getChanSpyPromise(_0x33b20c,_0xf2e7dd);})['then'](function(_0x4141c3){if(_0x4141c3&&_0x4141c3[_0x0a3f('0x1a')]){return _0x33b20c[_0x0a3f('0x25')]['bulkCreate'](_0x4141c3);}})[_0x0a3f('0x1f')](function(){_0x339de8();})[_0x0a3f('0x20')](function(_0x47dd3b){_0x339de8(_0x47dd3b);});},'afterDestroy':function(_0x25d1ea,_0x391414,_0x540ff3){return _0x33b20c['VoiceExtension'][_0x0a3f('0x27')]({'where':{'ChanSpyId':_0x25d1ea['id']}})['then'](function(){_0x540ff3();})['catch'](function(_0x256ccf){_0x540ff3(_0x256ccf);});}}});}; \ No newline at end of file +var _0x4539=['voice_chanspy','bulkCreate','catch','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','system','push','Set','format','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','exports','models','define'];(function(_0x3cb43a,_0x58b75c){var _0x46bf22=function(_0x38cc00){while(--_0x38cc00){_0x3cb43a['push'](_0x3cb43a['shift']());}};_0x46bf22(++_0x58b75c);}(_0x4539,0x164));var _0x9453=function(_0x4029c9,_0x426ffa){_0x4029c9=_0x4029c9-0x0;var _0x5baf73=_0x4539[_0x4029c9];return _0x5baf73;};'use strict';var _=require(_0x9453('0x0'));var util=require('util');var BPromise=require(_0x9453('0x1'));var attributes=require(_0x9453('0x2'));var getUserApplications=function(_0xa44350,_0x5ee830,_0x2fff4e){var _0x1dfe80=0x1;var _0x510d14=[];var _0x4bea18={'context':_0x5ee830[_0x9453('0x3')]||_0x9453('0x4'),'exten':util['format'](_0x9453('0x5'),_0xa44350['prefix'],_0x2fff4e),'type':_0x9453('0x6'),'isApp':![],'ChanSpyId':_0xa44350['id'],'UserId':_0x5ee830['id']};_0x510d14[_0x9453('0x7')](_['merge']({'app':_0x9453('0x8'),'appdata':util[_0x9453('0x9')](_0x9453('0xa'),_0x9453('0xb')),'priority':_0x1dfe80++},_0x4bea18));if(_0xa44350[_0x9453('0xc')]){_0x510d14[_0x9453('0x7')](_[_0x9453('0xd')]({'app':_0x9453('0xe'),'appdata':util[_0x9453('0x9')](_0x9453('0xf'),_0xa44350[_0x9453('0x10')]),'priority':_0x1dfe80++},_0x4bea18));}if(_0xa44350[_0x9453('0x11')]){_0x510d14[_0x9453('0x7')](_['merge']({'app':'Authenticate','appdata':_0xa44350[_0x9453('0x12')],'priority':_0x1dfe80++},_0x4bea18));}_0x510d14[_0x9453('0x7')](_['merge']({'app':'ChanSpy','appdata':util['format'](_0x9453('0x13'),_0x5ee830[_0x9453('0x14')],_0xa44350['options']?_0xa44350[_0x9453('0x15')][_0x9453('0x16')](''):''),'priority':_0x1dfe80++},_0x4bea18));if(_0xa44350[_0x9453('0xc')]){_0x510d14[_0x9453('0x7')](_[_0x9453('0xd')]({'app':_0x9453('0x17'),'priority':_0x1dfe80++},_0x4bea18));}return _0x510d14;};var getChanSpyApplications=function(_0x52904c,_0x9994dc){var _0x22f246=[];for(var _0x263431=0x0,_0x287764=0x1;_0x263431<_0x9994dc[_0x9453('0x18')];_0x263431++,_0x287764=0x1){_0x22f246=_0x22f246[_0x9453('0x19')](getUserApplications(_0x52904c,_0x9994dc[_0x263431],_0x9994dc[_0x263431][_0x9453('0x1a')]));if(_0x9994dc[_0x263431][_0x9453('0x1a')]!=_0x9994dc[_0x263431][_0x9453('0x14')]){_0x22f246=_0x22f246[_0x9453('0x19')](getUserApplications(_0x52904c,_0x9994dc[_0x263431],_0x9994dc[_0x263431]['name']));}}return _0x22f246;};var getChanSpyPromise=function(_0x5ca827,_0x298ec8){return new BPromise(function(_0x274535,_0x1bed75){return _0x5ca827[_0x9453('0x1b')][_0x9453('0x1c')]({'attributes':['id','name',_0x9453('0x1a')],'where':{'role':_0x9453('0x1d'),'chanspy':!![]},'raw':!![]})[_0x9453('0x1e')](function(_0x3e293c){if(_0x3e293c){return _0x274535(getChanSpyApplications(_0x298ec8,_0x3e293c));}return _0x274535([]);})['catch'](function(_0x2db4c0){_0x1bed75(_0x2db4c0);});});};module[_0x9453('0x1f')]=function(_0x475730,_0x4574be){var _0x548013=_0x475730[_0x9453('0x20')];return _0x475730[_0x9453('0x21')]('VoiceChanSpy',attributes,{'tableName':_0x9453('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x35f4a,_0x4befbd,_0x15b293){return getChanSpyPromise(_0x548013,_0x35f4a)[_0x9453('0x1e')](function(_0x23c6f5){if(_0x23c6f5&&_0x23c6f5[_0x9453('0x18')]){return _0x548013['VoiceExtension'][_0x9453('0x23')](_0x23c6f5);}})[_0x9453('0x1e')](function(){_0x15b293();})[_0x9453('0x24')](function(_0x55faec){_0x15b293(_0x55faec);});},'afterUpdate':function(_0x449f5e,_0x19e004,_0xe89d1a){return _0x548013[_0x9453('0x25')][_0x9453('0x26')]({'where':{'ChanSpyId':_0x449f5e['id']}})[_0x9453('0x1e')](function(){return getChanSpyPromise(_0x548013,_0x449f5e);})[_0x9453('0x1e')](function(_0x3ce114){if(_0x3ce114&&_0x3ce114[_0x9453('0x18')]){return _0x548013['VoiceExtension'][_0x9453('0x23')](_0x3ce114);}})[_0x9453('0x1e')](function(){_0xe89d1a();})[_0x9453('0x24')](function(_0x2e92d1){_0xe89d1a(_0x2e92d1);});},'afterDestroy':function(_0x464b8f,_0x492f34,_0x19d3a3){return _0x548013[_0x9453('0x25')][_0x9453('0x26')]({'where':{'ChanSpyId':_0x464b8f['id']}})[_0x9453('0x1e')](function(){_0x19d3a3();})[_0x9453('0x24')](function(_0x1a6812){_0x19d3a3(_0x1a6812);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 9eaae70..4d6a171 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 _0x1bca=['result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2d2322,_0x4a7b80){var _0x273ddf=function(_0x1ca41e){while(--_0x1ca41e){_0x2d2322['push'](_0x2d2322['shift']());}};_0x273ddf(++_0x4a7b80);}(_0x1bca,0xb6));var _0xa1bc=function(_0x7d0795,_0x48af73){_0x7d0795=_0x7d0795-0x0;var _0x5709c4=_0x1bca[_0x7d0795];return _0x5709c4;};'use strict';var _=require('lodash');var util=require(_0xa1bc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa1bc('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1bc('0x2'))['db'];var utils=require(_0xa1bc('0x3'));var logger=require(_0xa1bc('0x4'))('rpc');var config=require(_0xa1bc('0x5'));var jayson=require(_0xa1bc('0x6'));var client=jayson[_0xa1bc('0x7')][_0xa1bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54bffb,_0x43a67,_0x432b65){return new BPromise(function(_0xea5ec8,_0x378061){return client[_0xa1bc('0x9')](_0x54bffb,_0x432b65)[_0xa1bc('0xa')](function(_0x2db364){logger['info'](_0xa1bc('0xb'),_0x43a67,_0xa1bc('0xc'));logger[_0xa1bc('0xd')](_0xa1bc('0xe'),_0x43a67,_0xa1bc('0xc'),JSON[_0xa1bc('0xf')](_0x2db364));if(_0x2db364[_0xa1bc('0x10')]){if(_0x2db364[_0xa1bc('0x10')]['code']===0x1f4){logger['error'](_0xa1bc('0xb'),_0x43a67,_0x2db364[_0xa1bc('0x10')][_0xa1bc('0x11')]);return _0x378061(_0x2db364[_0xa1bc('0x10')][_0xa1bc('0x11')]);}logger[_0xa1bc('0x10')](_0xa1bc('0xb'),_0x43a67,_0x2db364[_0xa1bc('0x10')][_0xa1bc('0x11')]);return _0xea5ec8(_0x2db364[_0xa1bc('0x10')][_0xa1bc('0x11')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x43a67,_0xa1bc('0xc'));_0xea5ec8(_0x2db364[_0xa1bc('0x12')][_0xa1bc('0x11')]);}})[_0xa1bc('0x13')](function(_0x2a0438){logger[_0xa1bc('0x10')](_0xa1bc('0xb'),_0x43a67,_0x2a0438);_0x378061(_0x2a0438);});});} \ No newline at end of file +var _0xb921=['info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x275c2f,_0x22e84c){var _0x353548=function(_0x3406ae){while(--_0x3406ae){_0x275c2f['push'](_0x275c2f['shift']());}};_0x353548(++_0x22e84c);}(_0xb921,0x16a));var _0x1b92=function(_0x6d8c8e,_0x52b57c){_0x6d8c8e=_0x6d8c8e-0x0;var _0x32ad6f=_0xb921[_0x6d8c8e];return _0x32ad6f;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a6282,_0x7973df,_0x352406){return new BPromise(function(_0x1545f9,_0x64a3ed){return client[_0x1b92('0xc')](_0x8a6282,_0x352406)[_0x1b92('0xd')](function(_0x4567ab){logger['info'](_0x1b92('0xe'),_0x7973df,_0x1b92('0xf'));logger[_0x1b92('0x10')](_0x1b92('0x11'),_0x7973df,_0x1b92('0xf'),JSON[_0x1b92('0x12')](_0x4567ab));if(_0x4567ab[_0x1b92('0x13')]){if(_0x4567ab['error'][_0x1b92('0x14')]===0x1f4){logger[_0x1b92('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x7973df,_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);return _0x64a3ed(_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);}logger[_0x1b92('0x13')](_0x1b92('0xe'),_0x7973df,_0x4567ab[_0x1b92('0x13')]['message']);return _0x1545f9(_0x4567ab[_0x1b92('0x13')]['message']);}else{logger[_0x1b92('0x16')]('VoiceChanSpy,\x20%s,\x20%s',_0x7973df,_0x1b92('0xf'));_0x1545f9(_0x4567ab['result'][_0x1b92('0x15')]);}})[_0x1b92('0x17')](function(_0x688aef){logger['error'](_0x1b92('0xe'),_0x7973df,_0x688aef);_0x64a3ed(_0x688aef);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c64305b..637b553 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 _0x8680=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x1cc35b,_0x4f3d97){var _0xe61ee2=function(_0x3279e4){while(--_0x3279e4){_0x1cc35b['push'](_0x1cc35b['shift']());}};_0xe61ee2(++_0x4f3d97);}(_0x8680,0x18d));var _0x0868=function(_0x255088,_0x3df640){_0x255088=_0x255088-0x0;var _0x4c01d9=_0x8680[_0x255088];return _0x4c01d9;};'use strict';var multer=require(_0x0868('0x0'));var util=require(_0x0868('0x1'));var path=require(_0x0868('0x2'));var timeout=require(_0x0868('0x3'));var express=require(_0x0868('0x4'));var router=express['Router']();var fs_extra=require(_0x0868('0x5'));var auth=require(_0x0868('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0868('0x7'));var controller=require('./voiceContext.controller');router[_0x0868('0x8')]('/',auth[_0x0868('0x9')](),controller[_0x0868('0xa')]);router['get'](_0x0868('0xb'),auth['isAuthenticated'](),controller[_0x0868('0xc')]);router[_0x0868('0xd')]('/',auth['isAuthenticated'](),controller[_0x0868('0xe')]);router[_0x0868('0xf')](_0x0868('0xb'),auth['isAuthenticated'](),controller[_0x0868('0x10')]);router[_0x0868('0x11')](_0x0868('0xb'),auth[_0x0868('0x9')](),controller['destroy']);module[_0x0868('0x12')]=router; \ No newline at end of file +var _0x89cd=['/:id','show','post','create','put','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xb7e28a,_0x5cf4be){var _0x369be6=function(_0x3a3e69){while(--_0x3a3e69){_0xb7e28a['push'](_0xb7e28a['shift']());}};_0x369be6(++_0x5cf4be);}(_0x89cd,0x16f));var _0xd89c=function(_0x212126,_0x5d832a){_0x212126=_0x212126-0x0;var _0x137158=_0x89cd[_0x212126];return _0x137158;};'use strict';var multer=require(_0xd89c('0x0'));var util=require(_0xd89c('0x1'));var path=require(_0xd89c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd89c('0x3')]();var fs_extra=require(_0xd89c('0x4'));var auth=require(_0xd89c('0x5'));var interaction=require(_0xd89c('0x6'));var config=require(_0xd89c('0x7'));var controller=require('./voiceContext.controller');router[_0xd89c('0x8')]('/',auth[_0xd89c('0x9')](),controller[_0xd89c('0xa')]);router[_0xd89c('0x8')](_0xd89c('0xb'),auth[_0xd89c('0x9')](),controller[_0xd89c('0xc')]);router[_0xd89c('0xd')]('/',auth[_0xd89c('0x9')](),controller[_0xd89c('0xe')]);router[_0xd89c('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xd89c('0xb'),auth['isAuthenticated'](),controller[_0xd89c('0x10')]);module[_0xd89c('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index ab21b71..1094eaa 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 _0x1277=['exports','STRING','name','BOOLEAN'];(function(_0x1771dd,_0x407846){var _0x3e7655=function(_0x24e1e2){while(--_0x24e1e2){_0x1771dd['push'](_0x1771dd['shift']());}};_0x3e7655(++_0x407846);}(_0x1277,0x194));var _0x7127=function(_0x254d5f,_0x4b8638){_0x254d5f=_0x254d5f-0x0;var _0x20fb5e=_0x1277[_0x254d5f];return _0x20fb5e;};'use strict';var Sequelize=require('sequelize');module[_0x7127('0x0')]={'name':{'type':Sequelize[_0x7127('0x1')],'unique':_0x7127('0x2')},'description':{'type':Sequelize[_0x7127('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7127('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8698=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x3430fc,_0x35669f){var _0x4d3989=function(_0x2d6624){while(--_0x2d6624){_0x3430fc['push'](_0x3430fc['shift']());}};_0x4d3989(++_0x35669f);}(_0x8698,0x17f));var _0x8869=function(_0x1c0805,_0x268fdf){_0x1c0805=_0x1c0805-0x0;var _0x1e7e2c=_0x8698[_0x1c0805];return _0x1e7e2c;};'use strict';var Sequelize=require(_0x8869('0x0'));module[_0x8869('0x1')]={'name':{'type':Sequelize[_0x8869('0x2')],'unique':_0x8869('0x3')},'description':{'type':Sequelize[_0x8869('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x8869('0x4')],'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 ee5f863..b4ae876 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 _0xe226=['Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','root','readFileSync','writeFileSync','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','count','set','reject','save','get','UserProfileResource','destroy','stack','index','map','VoiceContext','rawAttributes','key','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','body','join','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf'];(function(_0x1089f5,_0xf89c6f){var _0x2dc391=function(_0x438d65){while(--_0x438d65){_0x1089f5['push'](_0x1089f5['shift']());}};_0x2dc391(++_0xf89c6f);}(_0xe226,0x14a));var _0x6e22=function(_0x15a120,_0x51e500){_0x15a120=_0x15a120-0x0;var _0x1c8ec2=_0xe226[_0x15a120];return _0x1c8ec2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e22('0x0'));var zipdir=require(_0x6e22('0x1'));var jsonpatch=require(_0x6e22('0x2'));var rp=require('request-promise');var moment=require(_0x6e22('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6e22('0x4'));var util=require(_0x6e22('0x5'));var path=require(_0x6e22('0x6'));var sox=require(_0x6e22('0x7'));var csv=require(_0x6e22('0x8'));var ejs=require(_0x6e22('0x9'));var fs=require('fs');var fs_extra=require(_0x6e22('0xa'));var _=require(_0x6e22('0xb'));var squel=require(_0x6e22('0xc'));var crypto=require(_0x6e22('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6e22('0xe'));var toCsv=require(_0x6e22('0x8'));var querystring=require(_0x6e22('0xf'));var Papa=require(_0x6e22('0x10'));var Redis=require(_0x6e22('0x11'));var authService=require(_0x6e22('0x12'));var qs=require(_0x6e22('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e22('0x14'));var logger=require(_0x6e22('0x15'))('api');var utils=require(_0x6e22('0x16'));var config=require(_0x6e22('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6e22('0x18')][_0x6e22('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x370847,_0x965239,_0x1caafb,_0x3d94a8){return new BPromise(function(_0x973662,_0x5974b1){var _0x2e7d29=_0x3d94a8||client;return _0x2e7d29[_0x6e22('0x1a')](_0x370847,_0x1caafb)[_0x6e22('0x1b')](function(_0x370b59){logger[_0x6e22('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x965239,_0x6e22('0x1d'));logger[_0x6e22('0x1e')](_0x6e22('0x1f'),_0x965239,'request\x20sent',JSON[_0x6e22('0x20')](_0x370b59));if(_0x370b59[_0x6e22('0x21')]){if(_0x370b59['error'][_0x6e22('0x22')]===0x1f4){logger[_0x6e22('0x21')](_0x6e22('0x23'),_0x965239,_0x370b59[_0x6e22('0x21')]['message']);return _0x5974b1(_0x370b59[_0x6e22('0x21')][_0x6e22('0x24')]);}logger[_0x6e22('0x21')](_0x6e22('0x23'),_0x965239,_0x370b59['error'][_0x6e22('0x24')]);return _0x973662(_0x370b59[_0x6e22('0x21')]['message']);}else{logger[_0x6e22('0x1c')](_0x6e22('0x23'),_0x965239,_0x6e22('0x1d'));_0x973662(_0x370b59[_0x6e22('0x25')][_0x6e22('0x24')]);}})['catch'](function(_0xf9bba8){logger[_0x6e22('0x21')](_0x6e22('0x23'),_0x965239,_0xf9bba8);_0x5974b1(_0xf9bba8);});});}function respondWithStatusCode(_0x412241,_0x20c02f){_0x20c02f=_0x20c02f||0xcc;return function(_0x86fe08){if(_0x86fe08){return _0x412241[_0x6e22('0x26')](_0x20c02f);}return _0x412241[_0x6e22('0x27')](_0x20c02f)[_0x6e22('0x28')]();};}function respondWithResult(_0x3859f3,_0x5a5b73){_0x5a5b73=_0x5a5b73||0xc8;return function(_0x141781){if(_0x141781){return _0x3859f3[_0x6e22('0x27')](_0x5a5b73)[_0x6e22('0x29')](_0x141781);}};}function respondWithFilteredResult(_0x4f45e4,_0x44403c){return function(_0x43e0c0){if(_0x43e0c0){var _0x39bc58=typeof _0x44403c[_0x6e22('0x2a')]==='undefined'&&typeof _0x44403c[_0x6e22('0x2b')]==='undefined';var _0xc12add=_0x43e0c0[_0x6e22('0x2c')];var _0x1a3d68=_0x39bc58?0x0:_0x44403c['offset'];var _0x70f781=_0x39bc58?_0x43e0c0[_0x6e22('0x2c')]:_0x44403c['offset']+_0x44403c['limit'];var _0x3aa35b;if(_0x70f781>=_0xc12add){_0x70f781=_0xc12add;_0x3aa35b=0xc8;}else{_0x3aa35b=0xce;}_0x4f45e4[_0x6e22('0x27')](_0x3aa35b);return _0x4f45e4[_0x6e22('0x2d')]('Content-Range',_0x1a3d68+'-'+_0x70f781+'/'+_0xc12add)['json'](_0x43e0c0);}return null;};}function patchUpdates(_0x446916){return function(_0xd76e57){try{jsonpatch['apply'](_0xd76e57,_0x446916,!![]);}catch(_0x289179){return BPromise[_0x6e22('0x2e')](_0x289179);}return _0xd76e57[_0x6e22('0x2f')]();};}function saveUpdates(_0x1a8d19,_0x541cd6){return function(_0x5069ff){if(_0x5069ff){return _0x5069ff['update'](_0x1a8d19)[_0x6e22('0x1b')](function(_0x2027d2){return _0x2027d2;});}return null;};}function removeEntity(_0x1f3458,_0xecf4b8){return function(_0x47c055){if(_0x47c055){return _0x47c055['destroy']()[_0x6e22('0x1b')](function(){var _0x294102=_0x47c055[_0x6e22('0x30')]({'plain':!![]});var _0x1eea70='Contexts';return db[_0x6e22('0x31')][_0x6e22('0x32')]({'where':{'type':_0x1eea70,'resourceId':_0x294102['id']}})[_0x6e22('0x1b')](function(){return _0x47c055;});})[_0x6e22('0x1b')](function(){_0x1f3458['status'](0xcc)[_0x6e22('0x28')]();});}};}function handleEntityNotFound(_0x5dbd07,_0x48b335){return function(_0x5bde3c){if(!_0x5bde3c){_0x5dbd07[_0x6e22('0x26')](0x194);}return _0x5bde3c;};}function handleError(_0x43887e,_0x2caf1a){_0x2caf1a=_0x2caf1a||0x1f4;return function(_0x34c7ce){logger['error'](_0x34c7ce[_0x6e22('0x33')]);if(_0x34c7ce['name']){delete _0x34c7ce['name'];}_0x43887e['status'](_0x2caf1a)['send'](_0x34c7ce);};}exports[_0x6e22('0x34')]=function(_0x555e09,_0x3a34a2){var _0x2917c2={},_0x428590={},_0x160877={'count':0x0,'rows':[]};var _0x2970f6=_[_0x6e22('0x35')](db[_0x6e22('0x36')][_0x6e22('0x37')],function(_0x1f7ea2){return{'name':_0x1f7ea2['fieldName'],'type':_0x1f7ea2['type'][_0x6e22('0x38')]};});_0x428590['model']=_[_0x6e22('0x35')](_0x2970f6,_0x6e22('0x39'));_0x428590[_0x6e22('0x3a')]=_[_0x6e22('0x3b')](_0x555e09[_0x6e22('0x3a')]);_0x428590[_0x6e22('0x3c')]=_[_0x6e22('0x3d')](_0x428590['model'],_0x428590[_0x6e22('0x3a')]);_0x2917c2[_0x6e22('0x3e')]=_[_0x6e22('0x3d')](_0x428590[_0x6e22('0x3f')],qs[_0x6e22('0x40')](_0x555e09['query'][_0x6e22('0x40')]));_0x2917c2['attributes']=_0x2917c2[_0x6e22('0x3e')][_0x6e22('0x41')]?_0x2917c2[_0x6e22('0x3e')]:_0x428590[_0x6e22('0x3f')];if(!_0x555e09[_0x6e22('0x3a')][_0x6e22('0x42')](_0x6e22('0x43'))){_0x2917c2[_0x6e22('0x2b')]=qs[_0x6e22('0x2b')](_0x555e09[_0x6e22('0x3a')]['limit']);_0x2917c2['offset']=qs[_0x6e22('0x2a')](_0x555e09['query'][_0x6e22('0x2a')]);}_0x2917c2[_0x6e22('0x44')]=qs[_0x6e22('0x45')](_0x555e09[_0x6e22('0x3a')][_0x6e22('0x45')]);_0x2917c2[_0x6e22('0x46')]=qs[_0x6e22('0x3c')](_[_0x6e22('0x47')](_0x555e09[_0x6e22('0x3a')],_0x428590[_0x6e22('0x3c')]),_0x2970f6);if(_0x555e09[_0x6e22('0x3a')]['filter']){_0x2917c2[_0x6e22('0x46')]=_[_0x6e22('0x48')](_0x2917c2['where'],{'$or':_[_0x6e22('0x35')](_0x2970f6,function(_0x11f502){if(_0x11f502[_0x6e22('0x49')]!==_0x6e22('0x4a')){var _0x1b6768={};_0x1b6768[_0x11f502[_0x6e22('0x39')]]={'$like':'%'+_0x555e09['query'][_0x6e22('0x4b')]+'%'};return _0x1b6768;}})});}_0x2917c2=_['merge']({},_0x2917c2,_0x555e09[_0x6e22('0x4c')]);var _0x586c9c={'where':_0x2917c2[_0x6e22('0x46')]};return db['VoiceContext']['count'](_0x586c9c)['then'](function(_0x2c3de3){_0x160877['count']=_0x2c3de3;if(_0x555e09['query'][_0x6e22('0x4d')]){_0x2917c2[_0x6e22('0x4e')]=[{'all':!![]}];}return db['VoiceContext'][_0x6e22('0x4f')](_0x2917c2);})[_0x6e22('0x1b')](function(_0x2fe301){_0x160877['rows']=_0x2fe301;return _0x160877;})[_0x6e22('0x1b')](respondWithFilteredResult(_0x3a34a2,_0x2917c2))[_0x6e22('0x50')](handleError(_0x3a34a2,null));};exports[_0x6e22('0x51')]=function(_0x286b73,_0x45933c){var _0x21c594={'raw':![],'where':{'id':_0x286b73['params']['id']}},_0x24fd1e={};_0x24fd1e[_0x6e22('0x3f')]=_['keys'](db[_0x6e22('0x36')][_0x6e22('0x37')]);_0x24fd1e[_0x6e22('0x3a')]=_[_0x6e22('0x3b')](_0x286b73[_0x6e22('0x3a')]);_0x24fd1e[_0x6e22('0x3c')]=_[_0x6e22('0x3d')](_0x24fd1e[_0x6e22('0x3f')],_0x24fd1e[_0x6e22('0x3a')]);_0x21c594[_0x6e22('0x3e')]=_[_0x6e22('0x3d')](_0x24fd1e[_0x6e22('0x3f')],qs['fields'](_0x286b73[_0x6e22('0x3a')][_0x6e22('0x40')]));_0x21c594[_0x6e22('0x3e')]=_0x21c594['attributes'][_0x6e22('0x41')]?_0x21c594[_0x6e22('0x3e')]:_0x24fd1e[_0x6e22('0x3f')];if(_0x286b73[_0x6e22('0x3a')][_0x6e22('0x4d')]){_0x21c594[_0x6e22('0x4e')]=[{'all':!![]}];}_0x21c594=_[_0x6e22('0x48')]({},_0x21c594,_0x286b73[_0x6e22('0x4c')]);return db[_0x6e22('0x36')][_0x6e22('0x52')](_0x21c594)[_0x6e22('0x1b')](handleEntityNotFound(_0x45933c,null))[_0x6e22('0x1b')](respondWithResult(_0x45933c,null))[_0x6e22('0x50')](handleError(_0x45933c,null));};exports[_0x6e22('0x53')]=function(_0x531f07,_0x19d5d2,_0x40058f){var _0x3fc36a;return db[_0x6e22('0x36')][_0x6e22('0x53')](_0x531f07[_0x6e22('0x54')],{'raw':!![]})[_0x6e22('0x1b')](function(_0x51b347){_0x3fc36a=_0x51b347;return db['VoiceContext'][_0x6e22('0x4f')]({'raw':!![]});})['then'](function(_0x1ac362){var _0x1e1bf7=fs['readFileSync'](path[_0x6e22('0x55')](config['root'],_0x6e22('0x56')),_0x6e22('0x57'));var _0x37415d=ejs[_0x6e22('0x58')](_0x1e1bf7,{'contexts':_0x1ac362||[]});fs['writeFileSync'](_0x6e22('0x59'),_0x37415d);})['then'](function(){return respondWithRpcPromise(_0x6e22('0x5a'),'create',{'module':_0x6e22('0x5b')});})['then'](function(){var _0x4fd8c8=_0x531f07[_0x6e22('0x5c')]['get']({'plain':!![]});if(!_0x4fd8c8)throw new Error(_0x6e22('0x5d'));if(_0x4fd8c8[_0x6e22('0x5e')]===_0x6e22('0x5c')){var _0x50ea2e=_0x3fc36a[_0x6e22('0x30')]({'plain':!![]});return db[_0x6e22('0x5f')][_0x6e22('0x52')]({'where':{'name':_0x6e22('0x60'),'userProfileId':_0x4fd8c8[_0x6e22('0x61')]},'raw':!![]})['then'](function(_0xdbb6d8){if(_0xdbb6d8&&_0xdbb6d8[_0x6e22('0x62')]===0x0){return db[_0x6e22('0x31')]['create']({'name':_0x50ea2e['name'],'resourceId':_0x50ea2e['id'],'type':_0xdbb6d8[_0x6e22('0x39')],'sectionId':_0xdbb6d8['id']},{})[_0x6e22('0x1b')](function(){return _0x3fc36a;});}else{return _0x3fc36a;}})['catch'](function(_0x5a9d51){logger['error'](_0x6e22('0x63'),_0x5a9d51);throw _0x5a9d51;});}return _0x3fc36a;})[_0x6e22('0x1b')](respondWithResult(_0x19d5d2,0xc9))[_0x6e22('0x50')](handleError(_0x19d5d2,null));};exports[_0x6e22('0x64')]=function(_0x1eda35,_0x19d23f,_0x5ab3e1){var _0x3e2907;return db[_0x6e22('0x36')][_0x6e22('0x52')]({'where':{'id':_0x1eda35[_0x6e22('0x65')]['id']}})['then'](handleEntityNotFound(_0x19d23f,null))[_0x6e22('0x1b')](saveUpdates(_0x1eda35[_0x6e22('0x54')],null))[_0x6e22('0x1b')](function(_0x2a9ed6){if(_0x2a9ed6){_0x3e2907=_0x2a9ed6;return db[_0x6e22('0x36')][_0x6e22('0x4f')]({'raw':!![]});}})[_0x6e22('0x1b')](function(_0x53adcc){var _0x4dc688=fs['readFileSync'](path[_0x6e22('0x55')](config[_0x6e22('0x66')],_0x6e22('0x56')),'utf8');var _0x90f348=ejs[_0x6e22('0x58')](_0x4dc688,{'contexts':_0x53adcc||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x90f348);})['then'](function(){return respondWithRpcPromise('Reload','update',{'module':_0x6e22('0x5b')});})[_0x6e22('0x1b')](function(){return _0x3e2907;})[_0x6e22('0x1b')](respondWithResult(_0x19d23f,null))[_0x6e22('0x50')](handleError(_0x19d23f,null));};exports['destroy']=function(_0x23ce83,_0x2d3e69,_0x12b0f3){var _0x3da4bb;return db[_0x6e22('0x36')][_0x6e22('0x52')]({'where':{'id':_0x23ce83[_0x6e22('0x65')]['id']}})['then'](handleEntityNotFound(_0x2d3e69,null))[_0x6e22('0x1b')](removeEntity(_0x2d3e69,null))['then'](function(){return db[_0x6e22('0x36')]['findAll']({'raw':!![]});})[_0x6e22('0x1b')](function(_0x334785){var _0x885aa3=fs[_0x6e22('0x67')](path[_0x6e22('0x55')](config[_0x6e22('0x66')],_0x6e22('0x56')),_0x6e22('0x57'));var _0x1f6fb6=ejs[_0x6e22('0x58')](_0x885aa3,{'contexts':_0x334785});fs[_0x6e22('0x68')](_0x6e22('0x59'),_0x1f6fb6);return respondWithRpcPromise('Reload',_0x6e22('0x32'),{'module':_0x6e22('0x5b')});})[_0x6e22('0x50')](handleError(_0x2d3e69,null));}; \ No newline at end of file +var _0xbecf=['utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','get','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','readFileSync','server/files/templates/context.ejs','render','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','Contexts','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','options','VoiceContext','includeAll','findAll','show','params','find','create','body','root'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0xbecf,0xd9));var _0xfbec=function(_0x547bb5,_0x5d7711){_0x547bb5=_0x547bb5-0x0;var _0x563412=_0xbecf[_0x547bb5];return _0x563412;};'use strict';var emlformat=require(_0xfbec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbec('0x1'));var jsonpatch=require(_0xfbec('0x2'));var rp=require(_0xfbec('0x3'));var moment=require(_0xfbec('0x4'));var BPromise=require(_0xfbec('0x5'));var Mustache=require(_0xfbec('0x6'));var util=require(_0xfbec('0x7'));var path=require(_0xfbec('0x8'));var sox=require(_0xfbec('0x9'));var csv=require('to-csv');var ejs=require(_0xfbec('0xa'));var fs=require('fs');var fs_extra=require(_0xfbec('0xb'));var _=require(_0xfbec('0xc'));var squel=require('squel');var crypto=require(_0xfbec('0xd'));var jsforce=require(_0xfbec('0xe'));var deskjs=require(_0xfbec('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfbec('0x10'));var Papa=require(_0xfbec('0x11'));var Redis=require('ioredis');var authService=require(_0xfbec('0x12'));var qs=require(_0xfbec('0x13'));var as=require(_0xfbec('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbec('0x15'))('api');var utils=require(_0xfbec('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfbec('0x17'));var db=require(_0xfbec('0x18'))['db'];var jayson=require(_0xfbec('0x19'));var client=jayson[_0xfbec('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x336ce3,_0x3816be,_0x30ca7f,_0x2e3c81){return new BPromise(function(_0x417260,_0x547d4f){var _0x2ee375=_0x2e3c81||client;return _0x2ee375[_0xfbec('0x1b')](_0x336ce3,_0x30ca7f)[_0xfbec('0x1c')](function(_0x4eba9d){logger[_0xfbec('0x1d')](_0xfbec('0x1e'),_0x3816be,_0xfbec('0x1f'));logger[_0xfbec('0x20')](_0xfbec('0x21'),_0x3816be,_0xfbec('0x1f'),JSON[_0xfbec('0x22')](_0x4eba9d));if(_0x4eba9d[_0xfbec('0x23')]){if(_0x4eba9d[_0xfbec('0x23')][_0xfbec('0x24')]===0x1f4){logger[_0xfbec('0x23')](_0xfbec('0x1e'),_0x3816be,_0x4eba9d[_0xfbec('0x23')]['message']);return _0x547d4f(_0x4eba9d[_0xfbec('0x23')][_0xfbec('0x25')]);}logger[_0xfbec('0x23')]('VoiceContext,\x20%s,\x20%s',_0x3816be,_0x4eba9d[_0xfbec('0x23')][_0xfbec('0x25')]);return _0x417260(_0x4eba9d[_0xfbec('0x23')][_0xfbec('0x25')]);}else{logger[_0xfbec('0x1d')](_0xfbec('0x1e'),_0x3816be,'request\x20sent');_0x417260(_0x4eba9d[_0xfbec('0x26')]['message']);}})[_0xfbec('0x27')](function(_0x21cb2b){logger[_0xfbec('0x23')]('VoiceContext,\x20%s,\x20%s',_0x3816be,_0x21cb2b);_0x547d4f(_0x21cb2b);});});}function respondWithStatusCode(_0x33e3b0,_0x7256ff){_0x7256ff=_0x7256ff||0xcc;return function(_0x51ff9b){if(_0x51ff9b){return _0x33e3b0[_0xfbec('0x28')](_0x7256ff);}return _0x33e3b0[_0xfbec('0x29')](_0x7256ff)[_0xfbec('0x2a')]();};}function respondWithResult(_0x5cc205,_0xe1a508){_0xe1a508=_0xe1a508||0xc8;return function(_0x1cb1dc){if(_0x1cb1dc){return _0x5cc205['status'](_0xe1a508)[_0xfbec('0x2b')](_0x1cb1dc);}};}function respondWithFilteredResult(_0x82518b,_0x3745e4){return function(_0x38d29c){if(_0x38d29c){var _0x2adf98=typeof _0x3745e4[_0xfbec('0x2c')]==='undefined'&&typeof _0x3745e4[_0xfbec('0x2d')]===_0xfbec('0x2e');var _0x24f387=_0x38d29c[_0xfbec('0x2f')];var _0x3110c7=_0x2adf98?0x0:_0x3745e4[_0xfbec('0x2c')];var _0x5d529f=_0x2adf98?_0x38d29c[_0xfbec('0x2f')]:_0x3745e4[_0xfbec('0x2c')]+_0x3745e4[_0xfbec('0x2d')];var _0x4d48fc;if(_0x5d529f>=_0x24f387){_0x5d529f=_0x24f387;_0x4d48fc=0xc8;}else{_0x4d48fc=0xce;}_0x82518b['status'](_0x4d48fc);return _0x82518b[_0xfbec('0x30')]('Content-Range',_0x3110c7+'-'+_0x5d529f+'/'+_0x24f387)[_0xfbec('0x2b')](_0x38d29c);}return null;};}function patchUpdates(_0x1fb5c4){return function(_0x501cda){try{jsonpatch[_0xfbec('0x31')](_0x501cda,_0x1fb5c4,!![]);}catch(_0x9ae059){return BPromise[_0xfbec('0x32')](_0x9ae059);}return _0x501cda[_0xfbec('0x33')]();};}function saveUpdates(_0x526932,_0x10ab10){return function(_0x1161ee){if(_0x1161ee){return _0x1161ee['update'](_0x526932)[_0xfbec('0x1c')](function(_0x5f1ddd){return _0x5f1ddd;});}return null;};}function removeEntity(_0x4ff3e6,_0x3d0c18){return function(_0x2bbcf7){if(_0x2bbcf7){return _0x2bbcf7[_0xfbec('0x34')]()['then'](function(){var _0x21d0e2=_0x2bbcf7['get']({'plain':!![]});var _0x35c1b9=_0xfbec('0x35');return db[_0xfbec('0x36')]['destroy']({'where':{'type':_0x35c1b9,'resourceId':_0x21d0e2['id']}})['then'](function(){return _0x2bbcf7;});})[_0xfbec('0x1c')](function(){_0x4ff3e6[_0xfbec('0x29')](0xcc)[_0xfbec('0x2a')]();});}};}function handleEntityNotFound(_0x4ed240,_0x98f6c0){return function(_0x2b7cfe){if(!_0x2b7cfe){_0x4ed240['sendStatus'](0x194);}return _0x2b7cfe;};}function handleError(_0x3421e1,_0x181843){_0x181843=_0x181843||0x1f4;return function(_0x53e795){logger['error'](_0x53e795[_0xfbec('0x37')]);if(_0x53e795[_0xfbec('0x38')]){delete _0x53e795[_0xfbec('0x38')];}_0x3421e1['status'](_0x181843)[_0xfbec('0x39')](_0x53e795);};}exports[_0xfbec('0x3a')]=function(_0x1b1fe6,_0x4a1cdc){var _0x1095d7={},_0x9ebc8e={},_0x27cbcc={'count':0x0,'rows':[]};var _0x10e9be=_[_0xfbec('0x3b')](db['VoiceContext'][_0xfbec('0x3c')],function(_0x4ae055){return{'name':_0x4ae055[_0xfbec('0x3d')],'type':_0x4ae055[_0xfbec('0x3e')][_0xfbec('0x3f')]};});_0x9ebc8e['model']=_[_0xfbec('0x3b')](_0x10e9be,_0xfbec('0x38'));_0x9ebc8e[_0xfbec('0x40')]=_[_0xfbec('0x41')](_0x1b1fe6[_0xfbec('0x40')]);_0x9ebc8e[_0xfbec('0x42')]=_[_0xfbec('0x43')](_0x9ebc8e['model'],_0x9ebc8e[_0xfbec('0x40')]);_0x1095d7[_0xfbec('0x44')]=_[_0xfbec('0x43')](_0x9ebc8e[_0xfbec('0x45')],qs[_0xfbec('0x46')](_0x1b1fe6['query'][_0xfbec('0x46')]));_0x1095d7[_0xfbec('0x44')]=_0x1095d7[_0xfbec('0x44')][_0xfbec('0x47')]?_0x1095d7[_0xfbec('0x44')]:_0x9ebc8e[_0xfbec('0x45')];if(!_0x1b1fe6[_0xfbec('0x40')]['hasOwnProperty'](_0xfbec('0x48'))){_0x1095d7['limit']=qs[_0xfbec('0x2d')](_0x1b1fe6[_0xfbec('0x40')][_0xfbec('0x2d')]);_0x1095d7[_0xfbec('0x2c')]=qs[_0xfbec('0x2c')](_0x1b1fe6[_0xfbec('0x40')][_0xfbec('0x2c')]);}_0x1095d7[_0xfbec('0x49')]=qs[_0xfbec('0x4a')](_0x1b1fe6[_0xfbec('0x40')][_0xfbec('0x4a')]);_0x1095d7[_0xfbec('0x4b')]=qs[_0xfbec('0x42')](_[_0xfbec('0x4c')](_0x1b1fe6[_0xfbec('0x40')],_0x9ebc8e[_0xfbec('0x42')]),_0x10e9be);if(_0x1b1fe6[_0xfbec('0x40')][_0xfbec('0x4d')]){_0x1095d7[_0xfbec('0x4b')]=_[_0xfbec('0x4e')](_0x1095d7[_0xfbec('0x4b')],{'$or':_[_0xfbec('0x3b')](_0x10e9be,function(_0x4ffad9){if(_0x4ffad9['type']!=='VIRTUAL'){var _0x2b8d43={};_0x2b8d43[_0x4ffad9[_0xfbec('0x38')]]={'$like':'%'+_0x1b1fe6[_0xfbec('0x40')]['filter']+'%'};return _0x2b8d43;}})});}_0x1095d7=_[_0xfbec('0x4e')]({},_0x1095d7,_0x1b1fe6[_0xfbec('0x4f')]);var _0x4d7815={'where':_0x1095d7['where']};return db[_0xfbec('0x50')][_0xfbec('0x2f')](_0x4d7815)['then'](function(_0x5ca103){_0x27cbcc[_0xfbec('0x2f')]=_0x5ca103;if(_0x1b1fe6[_0xfbec('0x40')][_0xfbec('0x51')]){_0x1095d7['include']=[{'all':!![]}];}return db['VoiceContext'][_0xfbec('0x52')](_0x1095d7);})[_0xfbec('0x1c')](function(_0x4346f1){_0x27cbcc['rows']=_0x4346f1;return _0x27cbcc;})[_0xfbec('0x1c')](respondWithFilteredResult(_0x4a1cdc,_0x1095d7))[_0xfbec('0x27')](handleError(_0x4a1cdc,null));};exports[_0xfbec('0x53')]=function(_0x103240,_0x131f33){var _0x53296c={'raw':![],'where':{'id':_0x103240[_0xfbec('0x54')]['id']}},_0x2eebe2={};_0x2eebe2[_0xfbec('0x45')]=_[_0xfbec('0x41')](db[_0xfbec('0x50')][_0xfbec('0x3c')]);_0x2eebe2[_0xfbec('0x40')]=_[_0xfbec('0x41')](_0x103240[_0xfbec('0x40')]);_0x2eebe2[_0xfbec('0x42')]=_[_0xfbec('0x43')](_0x2eebe2[_0xfbec('0x45')],_0x2eebe2[_0xfbec('0x40')]);_0x53296c[_0xfbec('0x44')]=_['intersection'](_0x2eebe2['model'],qs[_0xfbec('0x46')](_0x103240['query'][_0xfbec('0x46')]));_0x53296c[_0xfbec('0x44')]=_0x53296c[_0xfbec('0x44')][_0xfbec('0x47')]?_0x53296c[_0xfbec('0x44')]:_0x2eebe2[_0xfbec('0x45')];if(_0x103240[_0xfbec('0x40')][_0xfbec('0x51')]){_0x53296c['include']=[{'all':!![]}];}_0x53296c=_[_0xfbec('0x4e')]({},_0x53296c,_0x103240[_0xfbec('0x4f')]);return db['VoiceContext'][_0xfbec('0x55')](_0x53296c)[_0xfbec('0x1c')](handleEntityNotFound(_0x131f33,null))[_0xfbec('0x1c')](respondWithResult(_0x131f33,null))[_0xfbec('0x27')](handleError(_0x131f33,null));};exports['create']=function(_0x3c33fa,_0x5c6b0d,_0x5bafa2){var _0x4c0ef3;return db[_0xfbec('0x50')][_0xfbec('0x56')](_0x3c33fa[_0xfbec('0x57')],{'raw':!![]})[_0xfbec('0x1c')](function(_0x158c59){_0x4c0ef3=_0x158c59;return db[_0xfbec('0x50')][_0xfbec('0x52')]({'raw':!![]});})[_0xfbec('0x1c')](function(_0x5e4d21){var _0x4afe3b=fs['readFileSync'](path['join'](config[_0xfbec('0x58')],'server/files/templates/context.ejs'),_0xfbec('0x59'));var _0x486b7f=ejs['render'](_0x4afe3b,{'contexts':_0x5e4d21||[]});fs['writeFileSync'](_0xfbec('0x5a'),_0x486b7f);})[_0xfbec('0x1c')](function(){return respondWithRpcPromise(_0xfbec('0x5b'),'create',{'module':_0xfbec('0x5c')});})['then'](function(){var _0x1a8da2=_0x3c33fa['user'][_0xfbec('0x5d')]({'plain':!![]});if(!_0x1a8da2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a8da2['role']===_0xfbec('0x5e')){var _0x10166c=_0x4c0ef3[_0xfbec('0x5d')]({'plain':!![]});return db['UserProfileSection'][_0xfbec('0x55')]({'where':{'name':_0xfbec('0x35'),'userProfileId':_0x1a8da2[_0xfbec('0x5f')]},'raw':!![]})[_0xfbec('0x1c')](function(_0x1a0081){if(_0x1a0081&&_0x1a0081[_0xfbec('0x60')]===0x0){return db['UserProfileResource'][_0xfbec('0x56')]({'name':_0x10166c[_0xfbec('0x38')],'resourceId':_0x10166c['id'],'type':_0x1a0081[_0xfbec('0x38')],'sectionId':_0x1a0081['id']},{})[_0xfbec('0x1c')](function(){return _0x4c0ef3;});}else{return _0x4c0ef3;}})[_0xfbec('0x27')](function(_0x5475f6){logger[_0xfbec('0x23')](_0xfbec('0x61'),_0x5475f6);throw _0x5475f6;});}return _0x4c0ef3;})[_0xfbec('0x1c')](respondWithResult(_0x5c6b0d,0xc9))[_0xfbec('0x27')](handleError(_0x5c6b0d,null));};exports[_0xfbec('0x62')]=function(_0x3594b4,_0x23a87e,_0x1e41ca){var _0x3850c7;return db[_0xfbec('0x50')][_0xfbec('0x55')]({'where':{'id':_0x3594b4['params']['id']}})[_0xfbec('0x1c')](handleEntityNotFound(_0x23a87e,null))['then'](saveUpdates(_0x3594b4['body'],null))[_0xfbec('0x1c')](function(_0x22e728){if(_0x22e728){_0x3850c7=_0x22e728;return db['VoiceContext'][_0xfbec('0x52')]({'raw':!![]});}})[_0xfbec('0x1c')](function(_0x4ca726){var _0x2341bb=fs[_0xfbec('0x63')](path['join'](config[_0xfbec('0x58')],_0xfbec('0x64')),_0xfbec('0x59'));var _0xceb7e4=ejs[_0xfbec('0x65')](_0x2341bb,{'contexts':_0x4ca726||[]});fs['writeFileSync'](_0xfbec('0x5a'),_0xceb7e4);})[_0xfbec('0x1c')](function(){return respondWithRpcPromise(_0xfbec('0x5b'),_0xfbec('0x62'),{'module':'chan_sip.so'});})['then'](function(){return _0x3850c7;})[_0xfbec('0x1c')](respondWithResult(_0x23a87e,null))['catch'](handleError(_0x23a87e,null));};exports['destroy']=function(_0x588a4d,_0x3cdb5c,_0x1cf43b){var _0x51fa5c;return db[_0xfbec('0x50')][_0xfbec('0x55')]({'where':{'id':_0x588a4d[_0xfbec('0x54')]['id']}})[_0xfbec('0x1c')](handleEntityNotFound(_0x3cdb5c,null))[_0xfbec('0x1c')](removeEntity(_0x3cdb5c,null))[_0xfbec('0x1c')](function(){return db[_0xfbec('0x50')][_0xfbec('0x52')]({'raw':!![]});})[_0xfbec('0x1c')](function(_0x142ab8){var _0x4316ea=fs['readFileSync'](path['join'](config[_0xfbec('0x58')],_0xfbec('0x64')),_0xfbec('0x59'));var _0x5331b3=ejs[_0xfbec('0x65')](_0x4316ea,{'contexts':_0x142ab8});fs['writeFileSync'](_0xfbec('0x5a'),_0x5331b3);return respondWithRpcPromise(_0xfbec('0x5b'),_0xfbec('0x34'),{'module':_0xfbec('0x5c')});})[_0xfbec('0x27')](handleError(_0x3cdb5c,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c0cae0b..b36a9fc 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 _0x27de=['path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4c6373,_0x47cb5d){var _0x8ed848=function(_0x23d513){while(--_0x23d513){_0x4c6373['push'](_0x4c6373['shift']());}};_0x8ed848(++_0x47cb5d);}(_0x27de,0x111));var _0xe27d=function(_0x8b3bcf,_0x298509){_0x8b3bcf=_0x8b3bcf-0x0;var _0x1698cb=_0x27de[_0x8b3bcf];return _0x1698cb;};'use strict';var _=require(_0xe27d('0x0'));var util=require(_0xe27d('0x1'));var logger=require(_0xe27d('0x2'))(_0xe27d('0x3'));var moment=require(_0xe27d('0x4'));var BPromise=require(_0xe27d('0x5'));var rp=require(_0xe27d('0x6'));var fs=require('fs');var path=require(_0xe27d('0x7'));var rimraf=require(_0xe27d('0x8'));var config=require('../../config/environment');var attributes=require(_0xe27d('0x9'));module[_0xe27d('0xa')]=function(_0xcdcc89,_0x41ae0f){return _0xcdcc89[_0xe27d('0xb')](_0xe27d('0xc'),attributes,{'tableName':_0xe27d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8001=['bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports','voice_contexts','lodash','util','../../config/logger','api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8001,0xac));var _0x1800=function(_0x207884,_0x352b64){_0x207884=_0x207884-0x0;var _0x23a420=_0x8001[_0x207884];return _0x23a420;};'use strict';var _=require(_0x1800('0x0'));var util=require(_0x1800('0x1'));var logger=require(_0x1800('0x2'))(_0x1800('0x3'));var moment=require('moment');var BPromise=require(_0x1800('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1800('0x5'));var rimraf=require(_0x1800('0x6'));var config=require(_0x1800('0x7'));var attributes=require(_0x1800('0x8'));module[_0x1800('0x9')]=function(_0x422a85,_0x41c61e){return _0x422a85['define']('VoiceContext',attributes,{'tableName':_0x1800('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 07e5a84..71a8917 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 _0x98ef=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','result','lodash'];(function(_0x2f4e66,_0x14f20a){var _0x334522=function(_0x227841){while(--_0x227841){_0x2f4e66['push'](_0x2f4e66['shift']());}};_0x334522(++_0x14f20a);}(_0x98ef,0x197));var _0xf98e=function(_0x10a04e,_0xf85eba){_0x10a04e=_0x10a04e-0x0;var _0x31b79a=_0x98ef[_0x10a04e];return _0x31b79a;};'use strict';var _=require(_0xf98e('0x0'));var util=require(_0xf98e('0x1'));var moment=require(_0xf98e('0x2'));var BPromise=require(_0xf98e('0x3'));var rs=require(_0xf98e('0x4'));var fs=require('fs');var Redis=require(_0xf98e('0x5'));var db=require(_0xf98e('0x6'))['db'];var utils=require(_0xf98e('0x7'));var logger=require(_0xf98e('0x8'))(_0xf98e('0x9'));var config=require(_0xf98e('0xa'));var jayson=require(_0xf98e('0xb'));var client=jayson[_0xf98e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8573,_0xa223b9,_0x55f71d){return new BPromise(function(_0x161912,_0x2c6598){return client[_0xf98e('0xd')](_0x3e8573,_0x55f71d)[_0xf98e('0xe')](function(_0xb2d232){logger[_0xf98e('0xf')]('VoiceContext,\x20%s,\x20%s',_0xa223b9,_0xf98e('0x10'));logger[_0xf98e('0x11')](_0xf98e('0x12'),_0xa223b9,_0xf98e('0x10'),JSON['stringify'](_0xb2d232));if(_0xb2d232[_0xf98e('0x13')]){if(_0xb2d232['error'][_0xf98e('0x14')]===0x1f4){logger[_0xf98e('0x13')]('VoiceContext,\x20%s,\x20%s',_0xa223b9,_0xb2d232['error'][_0xf98e('0x15')]);return _0x2c6598(_0xb2d232[_0xf98e('0x13')][_0xf98e('0x15')]);}logger[_0xf98e('0x13')]('VoiceContext,\x20%s,\x20%s',_0xa223b9,_0xb2d232[_0xf98e('0x13')][_0xf98e('0x15')]);return _0x161912(_0xb2d232[_0xf98e('0x13')][_0xf98e('0x15')]);}else{logger[_0xf98e('0xf')](_0xf98e('0x16'),_0xa223b9,_0xf98e('0x10'));_0x161912(_0xb2d232[_0xf98e('0x17')][_0xf98e('0x15')]);}})['catch'](function(_0x14f93f){logger[_0xf98e('0x13')](_0xf98e('0x16'),_0xa223b9,_0x14f93f);_0x2c6598(_0x14f93f);});});} \ No newline at end of file +var _0x7d98=['then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request'];(function(_0x48ea26,_0xd70222){var _0xb895f9=function(_0x954a82){while(--_0x954a82){_0x48ea26['push'](_0x48ea26['shift']());}};_0xb895f9(++_0xd70222);}(_0x7d98,0xe7));var _0x87d9=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0x7d98[_0x1e6659];return _0x4d16e4;};'use strict';var _=require(_0x87d9('0x0'));var util=require('util');var moment=require(_0x87d9('0x1'));var BPromise=require(_0x87d9('0x2'));var rs=require(_0x87d9('0x3'));var fs=require('fs');var Redis=require(_0x87d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x87d9('0x5'));var logger=require(_0x87d9('0x6'))('rpc');var config=require(_0x87d9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe56d,_0x24c05f,_0x2dc542){return new BPromise(function(_0x5f2693,_0x2aa885){return client[_0x87d9('0x8')](_0x3fe56d,_0x2dc542)[_0x87d9('0x9')](function(_0x545f4f){logger[_0x87d9('0xa')](_0x87d9('0xb'),_0x24c05f,_0x87d9('0xc'));logger[_0x87d9('0xd')](_0x87d9('0xe'),_0x24c05f,_0x87d9('0xc'),JSON[_0x87d9('0xf')](_0x545f4f));if(_0x545f4f[_0x87d9('0x10')]){if(_0x545f4f[_0x87d9('0x10')][_0x87d9('0x11')]===0x1f4){logger[_0x87d9('0x10')](_0x87d9('0xb'),_0x24c05f,_0x545f4f[_0x87d9('0x10')][_0x87d9('0x12')]);return _0x2aa885(_0x545f4f[_0x87d9('0x10')][_0x87d9('0x12')]);}logger[_0x87d9('0x10')](_0x87d9('0xb'),_0x24c05f,_0x545f4f[_0x87d9('0x10')][_0x87d9('0x12')]);return _0x5f2693(_0x545f4f['error']['message']);}else{logger[_0x87d9('0xa')](_0x87d9('0xb'),_0x24c05f,_0x87d9('0xc'));_0x5f2693(_0x545f4f['result']['message']);}})[_0x87d9('0x13')](function(_0x109d61){logger[_0x87d9('0x10')](_0x87d9('0xb'),_0x24c05f,_0x109d61);_0x2aa885(_0x109d61);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 3f229b3..c8a4ef1 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 _0x29e1=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','delete','multer'];(function(_0x4f9883,_0x3114a8){var _0x39d724=function(_0x3775aa){while(--_0x3775aa){_0x4f9883['push'](_0x4f9883['shift']());}};_0x39d724(++_0x3114a8);}(_0x29e1,0x142));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x129e('0x0'));var util=require(_0x129e('0x1'));var path=require(_0x129e('0x2'));var timeout=require(_0x129e('0x3'));var express=require('express');var router=express[_0x129e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x129e('0x5'));var interaction=require(_0x129e('0x6'));var config=require(_0x129e('0x7'));var controller=require(_0x129e('0x8'));router[_0x129e('0x9')]('/',auth[_0x129e('0xa')](),controller['index']);router[_0x129e('0x9')](_0x129e('0xb'),auth[_0x129e('0xa')](),controller['describe']);router[_0x129e('0x9')](_0x129e('0xc'),auth[_0x129e('0xa')](),controller[_0x129e('0xd')]);router[_0x129e('0xe')]('/',auth[_0x129e('0xa')](),controller[_0x129e('0xf')]);router['put']('/:id',auth[_0x129e('0xa')](),controller['update']);router[_0x129e('0x10')]('/:id',auth[_0x129e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6da3=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3c74c4,_0x25474f){var _0x3c4e83=function(_0xfae207){while(--_0xfae207){_0x3c74c4['push'](_0x3c74c4['shift']());}};_0x3c4e83(++_0x25474f);}(_0x6da3,0xf9));var _0x36da=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6da3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x36da('0x0'));var util=require(_0x36da('0x1'));var path=require(_0x36da('0x2'));var timeout=require('connect-timeout');var express=require(_0x36da('0x3'));var router=express[_0x36da('0x4')]();var fs_extra=require(_0x36da('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x36da('0x6'));var controller=require('./voiceDialReport.controller');router[_0x36da('0x7')]('/',auth[_0x36da('0x8')](),controller[_0x36da('0x9')]);router[_0x36da('0x7')](_0x36da('0xa'),auth[_0x36da('0x8')](),controller[_0x36da('0xb')]);router[_0x36da('0x7')](_0x36da('0xc'),auth['isAuthenticated'](),controller[_0x36da('0xd')]);router[_0x36da('0xe')]('/',auth[_0x36da('0x8')](),controller[_0x36da('0xf')]);router[_0x36da('0x10')](_0x36da('0xc'),auth[_0x36da('0x8')](),controller[_0x36da('0x11')]);router[_0x36da('0x12')](_0x36da('0xc'),auth['isAuthenticated'](),controller[_0x36da('0x13')]);module[_0x36da('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 4d70a47..a65ef8a 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 _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x44178d,_0x3b4695){var _0x2556de=function(_0x1adb01){while(--_0x1adb01){_0x44178d['push'](_0x44178d['shift']());}};_0x2556de(++_0x3b4695);}(_0x4b84,0x1cc));var _0x44b8=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x4b84[_0x11a55c];return _0x26c390;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x323310,_0x52f57e){var _0x52fd4e=function(_0x4b3357){while(--_0x4b3357){_0x323310['push'](_0x323310['shift']());}};_0x52fd4e(++_0x52f57e);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x24ca[_0x5dfc2a];return _0x3f1a71;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index fba43ad..4162b12 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 _0xffb2=['ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','then','destroy','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1428e5,_0x1e6d08){var _0x809de9=function(_0x4fa4eb){while(--_0x4fa4eb){_0x1428e5['push'](_0x1428e5['shift']());}};_0x809de9(++_0x1e6d08);}(_0xffb2,0x1c3));var _0x2ffb=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0xffb2[_0x55c00d];return _0x254a8f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ffb('0x0'));var zipdir=require(_0x2ffb('0x1'));var jsonpatch=require(_0x2ffb('0x2'));var rp=require(_0x2ffb('0x3'));var moment=require(_0x2ffb('0x4'));var BPromise=require(_0x2ffb('0x5'));var Mustache=require(_0x2ffb('0x6'));var util=require(_0x2ffb('0x7'));var path=require(_0x2ffb('0x8'));var sox=require(_0x2ffb('0x9'));var csv=require(_0x2ffb('0xa'));var ejs=require(_0x2ffb('0xb'));var fs=require('fs');var fs_extra=require(_0x2ffb('0xc'));var _=require(_0x2ffb('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2ffb('0xe'));var deskjs=require(_0x2ffb('0xf'));var toCsv=require(_0x2ffb('0xa'));var querystring=require(_0x2ffb('0x10'));var Papa=require('papaparse');var Redis=require(_0x2ffb('0x11'));var authService=require(_0x2ffb('0x12'));var qs=require(_0x2ffb('0x13'));var as=require(_0x2ffb('0x14'));var hardwareService=require(_0x2ffb('0x15'));var logger=require(_0x2ffb('0x16'))('api');var utils=require(_0x2ffb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2ffb('0x18'));var db=require(_0x2ffb('0x19'))['db'];function respondWithStatusCode(_0x1c330e,_0x38e188){_0x38e188=_0x38e188||0xcc;return function(_0x4b1ea5){if(_0x4b1ea5){return _0x1c330e[_0x2ffb('0x1a')](_0x38e188);}return _0x1c330e[_0x2ffb('0x1b')](_0x38e188)[_0x2ffb('0x1c')]();};}function respondWithResult(_0x373f06,_0xcaf94a){_0xcaf94a=_0xcaf94a||0xc8;return function(_0x5d54d3){if(_0x5d54d3){return _0x373f06[_0x2ffb('0x1b')](_0xcaf94a)['json'](_0x5d54d3);}};}function respondWithFilteredResult(_0x5100dd,_0x2e449c){return function(_0x4c8104){if(_0x4c8104){var _0x4addcd=typeof _0x2e449c[_0x2ffb('0x1d')]===_0x2ffb('0x1e')&&typeof _0x2e449c['limit']==='undefined';var _0x1c0c4f=_0x4c8104[_0x2ffb('0x1f')];var _0x8934e9=_0x4addcd?0x0:_0x2e449c['offset'];var _0x2300cc=_0x4addcd?_0x4c8104[_0x2ffb('0x1f')]:_0x2e449c['offset']+_0x2e449c[_0x2ffb('0x20')];var _0x4fd544;if(_0x2300cc>=_0x1c0c4f){_0x2300cc=_0x1c0c4f;_0x4fd544=0xc8;}else{_0x4fd544=0xce;}_0x5100dd[_0x2ffb('0x1b')](_0x4fd544);return _0x5100dd['set'](_0x2ffb('0x21'),_0x8934e9+'-'+_0x2300cc+'/'+_0x1c0c4f)[_0x2ffb('0x22')](_0x4c8104);}return null;};}function patchUpdates(_0x191025){return function(_0x214e66){try{jsonpatch[_0x2ffb('0x23')](_0x214e66,_0x191025,!![]);}catch(_0xdd1147){return BPromise[_0x2ffb('0x24')](_0xdd1147);}return _0x214e66[_0x2ffb('0x25')]();};}function saveUpdates(_0x171f6d,_0x389494){return function(_0xa988a5){if(_0xa988a5){return _0xa988a5['update'](_0x171f6d)[_0x2ffb('0x26')](function(_0x17f8c5){return _0x17f8c5;});}return null;};}function removeEntity(_0x5e7391,_0x309ca8){return function(_0x108e5a){if(_0x108e5a){return _0x108e5a[_0x2ffb('0x27')]()[_0x2ffb('0x26')](function(){_0x5e7391[_0x2ffb('0x1b')](0xcc)[_0x2ffb('0x1c')]();});}};}function handleEntityNotFound(_0x1dbe85,_0x1a1237){return function(_0x5c9d3a){if(!_0x5c9d3a){_0x1dbe85['sendStatus'](0x194);}return _0x5c9d3a;};}function handleError(_0x305d4b,_0x1656d6){_0x1656d6=_0x1656d6||0x1f4;return function(_0x5b0f1c){logger['error'](_0x5b0f1c[_0x2ffb('0x28')]);if(_0x5b0f1c[_0x2ffb('0x29')]){delete _0x5b0f1c[_0x2ffb('0x29')];}_0x305d4b[_0x2ffb('0x1b')](_0x1656d6)['send'](_0x5b0f1c);};}exports[_0x2ffb('0x2a')]=function(_0x4d563d,_0x476ee1){var _0x5b74dc={},_0x9b7ed4={},_0xfd8ba0={'count':0x0,'rows':[]};var _0x3c1504=_[_0x2ffb('0x2b')](db[_0x2ffb('0x2c')][_0x2ffb('0x2d')],function(_0x16a31f){return{'name':_0x16a31f[_0x2ffb('0x2e')],'type':_0x16a31f[_0x2ffb('0x2f')][_0x2ffb('0x30')]};});_0x9b7ed4[_0x2ffb('0x31')]=_[_0x2ffb('0x2b')](_0x3c1504,'name');_0x9b7ed4['query']=_['keys'](_0x4d563d[_0x2ffb('0x32')]);_0x9b7ed4[_0x2ffb('0x33')]=_['intersection'](_0x9b7ed4[_0x2ffb('0x31')],_0x9b7ed4['query']);_0x5b74dc[_0x2ffb('0x34')]=_[_0x2ffb('0x35')](_0x9b7ed4[_0x2ffb('0x31')],qs[_0x2ffb('0x36')](_0x4d563d[_0x2ffb('0x32')]['fields']));_0x5b74dc[_0x2ffb('0x34')]=_0x5b74dc[_0x2ffb('0x34')][_0x2ffb('0x37')]?_0x5b74dc[_0x2ffb('0x34')]:_0x9b7ed4['model'];if(!_0x4d563d[_0x2ffb('0x32')]['hasOwnProperty']('nolimit')){_0x5b74dc[_0x2ffb('0x20')]=qs[_0x2ffb('0x20')](_0x4d563d[_0x2ffb('0x32')]['limit']);_0x5b74dc[_0x2ffb('0x1d')]=qs[_0x2ffb('0x1d')](_0x4d563d['query'][_0x2ffb('0x1d')]);}_0x5b74dc[_0x2ffb('0x38')]=qs[_0x2ffb('0x39')](_0x4d563d[_0x2ffb('0x32')][_0x2ffb('0x39')]);_0x5b74dc['where']=qs[_0x2ffb('0x33')](_[_0x2ffb('0x3a')](_0x4d563d[_0x2ffb('0x32')],_0x9b7ed4[_0x2ffb('0x33')]),_0x3c1504);if(_0x4d563d[_0x2ffb('0x32')]['filter']){_0x5b74dc[_0x2ffb('0x3b')]=_[_0x2ffb('0x3c')](_0x5b74dc[_0x2ffb('0x3b')],{'$or':_[_0x2ffb('0x2b')](_0x3c1504,function(_0x2d87d6){if(_0x2d87d6[_0x2ffb('0x2f')]!==_0x2ffb('0x3d')){var _0x174237={};_0x174237[_0x2d87d6[_0x2ffb('0x29')]]={'$like':'%'+_0x4d563d['query'][_0x2ffb('0x3e')]+'%'};return _0x174237;}})});}_0x5b74dc=_[_0x2ffb('0x3c')]({},_0x5b74dc,_0x4d563d[_0x2ffb('0x3f')]);var _0x207f19={'where':_0x5b74dc[_0x2ffb('0x3b')]};return db[_0x2ffb('0x2c')]['count'](_0x207f19)[_0x2ffb('0x26')](function(_0x1c24b8){_0xfd8ba0[_0x2ffb('0x1f')]=_0x1c24b8;if(_0x4d563d[_0x2ffb('0x32')][_0x2ffb('0x40')]){_0x5b74dc[_0x2ffb('0x41')]=[{'all':!![]}];}return db[_0x2ffb('0x2c')][_0x2ffb('0x42')](_0x5b74dc);})[_0x2ffb('0x26')](function(_0x246757){_0xfd8ba0[_0x2ffb('0x43')]=_0x246757;return _0xfd8ba0;})[_0x2ffb('0x26')](respondWithFilteredResult(_0x476ee1,_0x5b74dc))['catch'](handleError(_0x476ee1,null));};exports[_0x2ffb('0x44')]=function(_0x3fda5f,_0x574e48){var _0x3116e9={'raw':!![],'where':{'id':_0x3fda5f[_0x2ffb('0x45')]['id']}},_0x4ec474={};_0x4ec474[_0x2ffb('0x31')]=_[_0x2ffb('0x46')](db[_0x2ffb('0x2c')]['rawAttributes']);_0x4ec474[_0x2ffb('0x32')]=_['keys'](_0x3fda5f[_0x2ffb('0x32')]);_0x4ec474[_0x2ffb('0x33')]=_[_0x2ffb('0x35')](_0x4ec474['model'],_0x4ec474[_0x2ffb('0x32')]);_0x3116e9[_0x2ffb('0x34')]=_['intersection'](_0x4ec474[_0x2ffb('0x31')],qs[_0x2ffb('0x36')](_0x3fda5f['query'][_0x2ffb('0x36')]));_0x3116e9['attributes']=_0x3116e9[_0x2ffb('0x34')]['length']?_0x3116e9[_0x2ffb('0x34')]:_0x4ec474[_0x2ffb('0x31')];if(_0x3fda5f[_0x2ffb('0x32')]['includeAll']){_0x3116e9[_0x2ffb('0x41')]=[{'all':!![]}];}_0x3116e9=_[_0x2ffb('0x3c')]({},_0x3116e9,_0x3fda5f['options']);return db['VoiceDialReport'][_0x2ffb('0x47')](_0x3116e9)[_0x2ffb('0x26')](handleEntityNotFound(_0x574e48,null))[_0x2ffb('0x26')](respondWithResult(_0x574e48,null))[_0x2ffb('0x48')](handleError(_0x574e48,null));};exports[_0x2ffb('0x49')]=function(_0x4e8c3f,_0x4b46e0){return db['VoiceDialReport'][_0x2ffb('0x49')](_0x4e8c3f[_0x2ffb('0x4a')],{})[_0x2ffb('0x26')](respondWithResult(_0x4b46e0,0xc9))[_0x2ffb('0x48')](handleError(_0x4b46e0,null));};exports[_0x2ffb('0x4b')]=function(_0x548967,_0x3a9459){if(_0x548967[_0x2ffb('0x4a')]['id']){delete _0x548967[_0x2ffb('0x4a')]['id'];}return db[_0x2ffb('0x2c')][_0x2ffb('0x47')]({'where':{'id':_0x548967['params']['id']}})[_0x2ffb('0x26')](handleEntityNotFound(_0x3a9459,null))[_0x2ffb('0x26')](saveUpdates(_0x548967['body'],null))[_0x2ffb('0x26')](respondWithResult(_0x3a9459,null))[_0x2ffb('0x48')](handleError(_0x3a9459,null));};exports[_0x2ffb('0x27')]=function(_0x253bba,_0x56c4ad){return db[_0x2ffb('0x2c')][_0x2ffb('0x47')]({'where':{'id':_0x253bba[_0x2ffb('0x45')]['id']}})[_0x2ffb('0x26')](handleEntityNotFound(_0x56c4ad,null))[_0x2ffb('0x26')](removeEntity(_0x56c4ad,null))[_0x2ffb('0x48')](handleError(_0x56c4ad,null));};exports[_0x2ffb('0x4c')]=function(_0x3f1207,_0x3fdafd){return db[_0x2ffb('0x2c')][_0x2ffb('0x4c')]()[_0x2ffb('0x26')](respondWithResult(_0x3fdafd,null))[_0x2ffb('0x48')](handleError(_0x3fdafd,null));}; \ No newline at end of file +var _0x1b53=['key','model','query','keys','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','show','params','intersection','merge','catch','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type'];(function(_0x11fc0a,_0x2f7720){var _0x4e99ae=function(_0x3db856){while(--_0x3db856){_0x11fc0a['push'](_0x11fc0a['shift']());}};_0x4e99ae(++_0x2f7720);}(_0x1b53,0x1d7));var _0x31b5=function(_0x10853a,_0x3190b4){_0x10853a=_0x10853a-0x0;var _0x2a7992=_0x1b53[_0x10853a];return _0x2a7992;};'use strict';var emlformat=require(_0x31b5('0x0'));var rimraf=require(_0x31b5('0x1'));var zipdir=require(_0x31b5('0x2'));var jsonpatch=require(_0x31b5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x31b5('0x4'));var Mustache=require(_0x31b5('0x5'));var util=require(_0x31b5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x31b5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31b5('0x8'));var squel=require('squel');var crypto=require(_0x31b5('0x9'));var jsforce=require(_0x31b5('0xa'));var deskjs=require(_0x31b5('0xb'));var toCsv=require(_0x31b5('0x7'));var querystring=require(_0x31b5('0xc'));var Papa=require(_0x31b5('0xd'));var Redis=require(_0x31b5('0xe'));var authService=require(_0x31b5('0xf'));var qs=require(_0x31b5('0x10'));var as=require(_0x31b5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31b5('0x12'))('api');var utils=require(_0x31b5('0x13'));var config=require(_0x31b5('0x14'));var licenseUtil=require(_0x31b5('0x15'));var db=require(_0x31b5('0x16'))['db'];function respondWithStatusCode(_0x5f14db,_0x556949){_0x556949=_0x556949||0xcc;return function(_0x4d4e43){if(_0x4d4e43){return _0x5f14db[_0x31b5('0x17')](_0x556949);}return _0x5f14db[_0x31b5('0x18')](_0x556949)[_0x31b5('0x19')]();};}function respondWithResult(_0xf6a02b,_0x467694){_0x467694=_0x467694||0xc8;return function(_0x567a78){if(_0x567a78){return _0xf6a02b[_0x31b5('0x18')](_0x467694)[_0x31b5('0x1a')](_0x567a78);}};}function respondWithFilteredResult(_0x51eb59,_0x29ce73){return function(_0x3ea42b){if(_0x3ea42b){var _0x298ed4=typeof _0x29ce73['offset']==='undefined'&&typeof _0x29ce73[_0x31b5('0x1b')]===_0x31b5('0x1c');var _0x3cdc20=_0x3ea42b[_0x31b5('0x1d')];var _0x4c9124=_0x298ed4?0x0:_0x29ce73['offset'];var _0x128977=_0x298ed4?_0x3ea42b[_0x31b5('0x1d')]:_0x29ce73[_0x31b5('0x1e')]+_0x29ce73[_0x31b5('0x1b')];var _0x244c50;if(_0x128977>=_0x3cdc20){_0x128977=_0x3cdc20;_0x244c50=0xc8;}else{_0x244c50=0xce;}_0x51eb59['status'](_0x244c50);return _0x51eb59[_0x31b5('0x1f')](_0x31b5('0x20'),_0x4c9124+'-'+_0x128977+'/'+_0x3cdc20)['json'](_0x3ea42b);}return null;};}function patchUpdates(_0x4f765f){return function(_0x104669){try{jsonpatch[_0x31b5('0x21')](_0x104669,_0x4f765f,!![]);}catch(_0x582793){return BPromise[_0x31b5('0x22')](_0x582793);}return _0x104669[_0x31b5('0x23')]();};}function saveUpdates(_0x9058b4,_0x1ed0ba){return function(_0x165c30){if(_0x165c30){return _0x165c30['update'](_0x9058b4)[_0x31b5('0x24')](function(_0x26bd39){return _0x26bd39;});}return null;};}function removeEntity(_0x30efec,_0x1a172a){return function(_0x584180){if(_0x584180){return _0x584180[_0x31b5('0x25')]()['then'](function(){_0x30efec[_0x31b5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a39c4,_0x17e28c){return function(_0x189f40){if(!_0x189f40){_0x7a39c4[_0x31b5('0x17')](0x194);}return _0x189f40;};}function handleError(_0x8ac5f0,_0x1a0611){_0x1a0611=_0x1a0611||0x1f4;return function(_0x4e8db2){logger[_0x31b5('0x26')](_0x4e8db2[_0x31b5('0x27')]);if(_0x4e8db2[_0x31b5('0x28')]){delete _0x4e8db2['name'];}_0x8ac5f0[_0x31b5('0x18')](_0x1a0611)[_0x31b5('0x29')](_0x4e8db2);};}exports[_0x31b5('0x2a')]=function(_0x3ff138,_0xb898cc){var _0x47ac20={},_0x54b52e={},_0xb33062={'count':0x0,'rows':[]};var _0x4edb72=_[_0x31b5('0x2b')](db[_0x31b5('0x2c')][_0x31b5('0x2d')],function(_0x12ac06){return{'name':_0x12ac06['fieldName'],'type':_0x12ac06[_0x31b5('0x2e')][_0x31b5('0x2f')]};});_0x54b52e[_0x31b5('0x30')]=_[_0x31b5('0x2b')](_0x4edb72,_0x31b5('0x28'));_0x54b52e[_0x31b5('0x31')]=_[_0x31b5('0x32')](_0x3ff138['query']);_0x54b52e['filters']=_['intersection'](_0x54b52e[_0x31b5('0x30')],_0x54b52e[_0x31b5('0x31')]);_0x47ac20[_0x31b5('0x33')]=_['intersection'](_0x54b52e[_0x31b5('0x30')],qs[_0x31b5('0x34')](_0x3ff138[_0x31b5('0x31')]['fields']));_0x47ac20['attributes']=_0x47ac20[_0x31b5('0x33')][_0x31b5('0x35')]?_0x47ac20['attributes']:_0x54b52e['model'];if(!_0x3ff138[_0x31b5('0x31')]['hasOwnProperty']('nolimit')){_0x47ac20[_0x31b5('0x1b')]=qs[_0x31b5('0x1b')](_0x3ff138[_0x31b5('0x31')][_0x31b5('0x1b')]);_0x47ac20['offset']=qs['offset'](_0x3ff138[_0x31b5('0x31')]['offset']);}_0x47ac20[_0x31b5('0x36')]=qs[_0x31b5('0x37')](_0x3ff138[_0x31b5('0x31')][_0x31b5('0x37')]);_0x47ac20[_0x31b5('0x38')]=qs[_0x31b5('0x39')](_[_0x31b5('0x3a')](_0x3ff138[_0x31b5('0x31')],_0x54b52e[_0x31b5('0x39')]),_0x4edb72);if(_0x3ff138[_0x31b5('0x31')][_0x31b5('0x3b')]){_0x47ac20[_0x31b5('0x38')]=_['merge'](_0x47ac20[_0x31b5('0x38')],{'$or':_['map'](_0x4edb72,function(_0x33e7ae){if(_0x33e7ae['type']!==_0x31b5('0x3c')){var _0x1fd461={};_0x1fd461[_0x33e7ae[_0x31b5('0x28')]]={'$like':'%'+_0x3ff138[_0x31b5('0x31')][_0x31b5('0x3b')]+'%'};return _0x1fd461;}})});}_0x47ac20=_['merge']({},_0x47ac20,_0x3ff138[_0x31b5('0x3d')]);var _0x2f7891={'where':_0x47ac20['where']};return db['VoiceDialReport']['count'](_0x2f7891)['then'](function(_0x4e7e09){_0xb33062[_0x31b5('0x1d')]=_0x4e7e09;if(_0x3ff138[_0x31b5('0x31')][_0x31b5('0x3e')]){_0x47ac20[_0x31b5('0x3f')]=[{'all':!![]}];}return db[_0x31b5('0x2c')]['findAll'](_0x47ac20);})[_0x31b5('0x24')](function(_0x8acfae){_0xb33062['rows']=_0x8acfae;return _0xb33062;})[_0x31b5('0x24')](respondWithFilteredResult(_0xb898cc,_0x47ac20))['catch'](handleError(_0xb898cc,null));};exports[_0x31b5('0x40')]=function(_0x31b1a5,_0x5589bf){var _0xfd3a39={'raw':!![],'where':{'id':_0x31b1a5[_0x31b5('0x41')]['id']}},_0x40d437={};_0x40d437[_0x31b5('0x30')]=_[_0x31b5('0x32')](db[_0x31b5('0x2c')]['rawAttributes']);_0x40d437[_0x31b5('0x31')]=_['keys'](_0x31b1a5[_0x31b5('0x31')]);_0x40d437[_0x31b5('0x39')]=_['intersection'](_0x40d437['model'],_0x40d437['query']);_0xfd3a39[_0x31b5('0x33')]=_[_0x31b5('0x42')](_0x40d437[_0x31b5('0x30')],qs[_0x31b5('0x34')](_0x31b1a5[_0x31b5('0x31')][_0x31b5('0x34')]));_0xfd3a39[_0x31b5('0x33')]=_0xfd3a39[_0x31b5('0x33')][_0x31b5('0x35')]?_0xfd3a39[_0x31b5('0x33')]:_0x40d437['model'];if(_0x31b1a5[_0x31b5('0x31')][_0x31b5('0x3e')]){_0xfd3a39['include']=[{'all':!![]}];}_0xfd3a39=_[_0x31b5('0x43')]({},_0xfd3a39,_0x31b1a5[_0x31b5('0x3d')]);return db[_0x31b5('0x2c')]['find'](_0xfd3a39)[_0x31b5('0x24')](handleEntityNotFound(_0x5589bf,null))[_0x31b5('0x24')](respondWithResult(_0x5589bf,null))[_0x31b5('0x44')](handleError(_0x5589bf,null));};exports[_0x31b5('0x45')]=function(_0x262d4d,_0x1eee3e){return db[_0x31b5('0x2c')][_0x31b5('0x45')](_0x262d4d['body'],{})[_0x31b5('0x24')](respondWithResult(_0x1eee3e,0xc9))[_0x31b5('0x44')](handleError(_0x1eee3e,null));};exports[_0x31b5('0x46')]=function(_0xbc0341,_0x42e29d){if(_0xbc0341[_0x31b5('0x47')]['id']){delete _0xbc0341['body']['id'];}return db[_0x31b5('0x2c')][_0x31b5('0x48')]({'where':{'id':_0xbc0341[_0x31b5('0x41')]['id']}})[_0x31b5('0x24')](handleEntityNotFound(_0x42e29d,null))[_0x31b5('0x24')](saveUpdates(_0xbc0341[_0x31b5('0x47')],null))[_0x31b5('0x24')](respondWithResult(_0x42e29d,null))['catch'](handleError(_0x42e29d,null));};exports[_0x31b5('0x25')]=function(_0x4a8fdd,_0x3a2b45){return db[_0x31b5('0x2c')][_0x31b5('0x48')]({'where':{'id':_0x4a8fdd[_0x31b5('0x41')]['id']}})[_0x31b5('0x24')](handleEntityNotFound(_0x3a2b45,null))['then'](removeEntity(_0x3a2b45,null))[_0x31b5('0x44')](handleError(_0x3a2b45,null));};exports[_0x31b5('0x49')]=function(_0x21bfe8,_0x23399c){return db['VoiceDialReport'][_0x31b5('0x49')]()[_0x31b5('0x24')](respondWithResult(_0x23399c,null))['catch'](handleError(_0x23399c,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 287ebc1..aa54e16 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 _0x044c=['define','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x564e04,_0x3d1bf5){var _0x589e51=function(_0x42b990){while(--_0x42b990){_0x564e04['push'](_0x564e04['shift']());}};_0x589e51(++_0x3d1bf5);}(_0x044c,0x1d1));var _0xc044=function(_0x2153aa,_0x1f47d2){_0x2153aa=_0x2153aa-0x0;var _0x442e12=_0x044c[_0x2153aa];return _0x442e12;};'use strict';var _=require(_0xc044('0x0'));var util=require(_0xc044('0x1'));var logger=require(_0xc044('0x2'))(_0xc044('0x3'));var moment=require(_0xc044('0x4'));var BPromise=require(_0xc044('0x5'));var rp=require(_0xc044('0x6'));var fs=require('fs');var path=require(_0xc044('0x7'));var rimraf=require(_0xc044('0x8'));var config=require(_0xc044('0x9'));var attributes=require(_0xc044('0xa'));module['exports']=function(_0x3f84fc,_0x8a4f6){return _0x3f84fc[_0xc044('0xb')]('VoiceDialReport',attributes,{'tableName':_0xc044('0xc'),'paranoid':![],'indexes':[{'fields':[_0xc044('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbcbb=['moment','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger'];(function(_0x8c909b,_0x13c0e4){var _0x19f86c=function(_0x48922c){while(--_0x48922c){_0x8c909b['push'](_0x8c909b['shift']());}};_0x19f86c(++_0x13c0e4);}(_0xbcbb,0x14d));var _0xbbcb=function(_0x5496ff,_0x104d17){_0x5496ff=_0x5496ff-0x0;var _0x36881c=_0xbcbb[_0x5496ff];return _0x36881c;};'use strict';var _=require(_0xbbcb('0x0'));var util=require(_0xbbcb('0x1'));var logger=require(_0xbbcb('0x2'))('api');var moment=require(_0xbbcb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbcb('0x4'));var rimraf=require(_0xbbcb('0x5'));var config=require('../../config/environment');var attributes=require(_0xbbcb('0x6'));module[_0xbbcb('0x7')]=function(_0x452b31,_0x227e83){return _0x452b31[_0xbbcb('0x8')](_0xbbcb('0x9'),attributes,{'tableName':_0xbbcb('0xa'),'paranoid':![],'indexes':[{'fields':[_0xbbcb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 92e09b5..d9c81c9 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 _0x51e7=['update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','debug','UpdateVoiceDialReport'];(function(_0x1baf54,_0x2ce8fb){var _0x58bb2f=function(_0x4286c5){while(--_0x4286c5){_0x1baf54['push'](_0x1baf54['shift']());}};_0x58bb2f(++_0x2ce8fb);}(_0x51e7,0x135));var _0x751e=function(_0x18df38,_0x25ada0){_0x18df38=_0x18df38-0x0;var _0x170006=_0x51e7[_0x18df38];return _0x170006;};'use strict';var _=require(_0x751e('0x0'));var util=require(_0x751e('0x1'));var moment=require(_0x751e('0x2'));var BPromise=require(_0x751e('0x3'));var rs=require(_0x751e('0x4'));var fs=require('fs');var Redis=require(_0x751e('0x5'));var db=require(_0x751e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x751e('0x7'))(_0x751e('0x8'));var config=require(_0x751e('0x9'));var jayson=require(_0x751e('0xa'));var client=jayson['client'][_0x751e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45ee59,_0x475933,_0x41c211){return new BPromise(function(_0x37ffbf,_0x575e4b){return client[_0x751e('0xc')](_0x45ee59,_0x41c211)[_0x751e('0xd')](function(_0x5145b2){logger[_0x751e('0xe')](_0x751e('0xf'),_0x475933,_0x751e('0x10'));logger['debug'](_0x751e('0x11'),_0x475933,_0x751e('0x10'),JSON[_0x751e('0x12')](_0x5145b2));if(_0x5145b2[_0x751e('0x13')]){if(_0x5145b2[_0x751e('0x13')][_0x751e('0x14')]===0x1f4){logger[_0x751e('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x475933,_0x5145b2[_0x751e('0x13')][_0x751e('0x15')]);return _0x575e4b(_0x5145b2[_0x751e('0x13')][_0x751e('0x15')]);}logger['error'](_0x751e('0xf'),_0x475933,_0x5145b2[_0x751e('0x13')][_0x751e('0x15')]);return _0x37ffbf(_0x5145b2[_0x751e('0x13')][_0x751e('0x15')]);}else{logger[_0x751e('0xe')](_0x751e('0xf'),_0x475933,_0x751e('0x10'));_0x37ffbf(_0x5145b2[_0x751e('0x16')][_0x751e('0x15')]);}})[_0x751e('0x17')](function(_0x247ab1){logger[_0x751e('0x13')](_0x751e('0xf'),_0x475933,_0x247ab1);_0x575e4b(_0x247ab1);});});}exports[_0x751e('0x18')]=function(_0x4a1d0c){var _0x42155c=this;return new Promise(function(_0x2daae6,_0x19a023){return db[_0x751e('0x19')]['create'](_0x4a1d0c[_0x751e('0x1a')],{'raw':_0x4a1d0c[_0x751e('0x1b')]?_0x4a1d0c[_0x751e('0x1b')][_0x751e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1fc043){logger[_0x751e('0xe')]('CreateVoiceDialReport',_0x4a1d0c);logger[_0x751e('0x1d')](_0x751e('0x18'),_0x4a1d0c,JSON[_0x751e('0x12')](_0x1fc043));_0x2daae6(_0x1fc043);})[_0x751e('0x17')](function(_0x11dae3){logger[_0x751e('0x13')]('CreateVoiceDialReport',_0x11dae3['message'],_0x4a1d0c);_0x19a023(_0x42155c[_0x751e('0x13')](0x1f4,_0x11dae3[_0x751e('0x15')]));});});};exports[_0x751e('0x1e')]=function(_0x547e65){var _0x43b4cd=this;return new Promise(function(_0xfa9810,_0x32d2b9){return db[_0x751e('0x19')][_0x751e('0x1f')](_0x547e65[_0x751e('0x1a')],{'raw':_0x547e65['options']?_0x547e65['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x547e65[_0x751e('0x1b')]?_0x547e65[_0x751e('0x1b')][_0x751e('0x20')]||null:null,'attributes':_0x547e65[_0x751e('0x1b')]?_0x547e65['options']['attributes']||null:null,'limit':_0x547e65[_0x751e('0x1b')]?_0x547e65[_0x751e('0x1b')][_0x751e('0x21')]||null:null})[_0x751e('0xd')](function(_0x2f01eb){logger['info'](_0x751e('0x1e'),_0x547e65);logger[_0x751e('0x1d')](_0x751e('0x1e'),_0x547e65,JSON[_0x751e('0x12')](_0x2f01eb));_0xfa9810(_0x2f01eb);})['catch'](function(_0x572e09){logger[_0x751e('0x13')](_0x751e('0x1e'),_0x572e09[_0x751e('0x15')],_0x547e65);_0x32d2b9(_0x43b4cd[_0x751e('0x13')](0x1f4,_0x572e09[_0x751e('0x15')]));});});}; \ No newline at end of file +var _0xdb6e=['info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','debug','UpdateVoiceDialReport','update','where','attributes','lodash','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then'];(function(_0x10bf17,_0x5819a1){var _0x28c6ee=function(_0x4eebc8){while(--_0x4eebc8){_0x10bf17['push'](_0x10bf17['shift']());}};_0x28c6ee(++_0x5819a1);}(_0xdb6e,0x170));var _0xedb6=function(_0x3150db,_0x406c5e){_0x3150db=_0x3150db-0x0;var _0x1ebbf4=_0xdb6e[_0x3150db];return _0x1ebbf4;};'use strict';var _=require(_0xedb6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xedb6('0x1'));var fs=require('fs');var Redis=require(_0xedb6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xedb6('0x3'));var logger=require(_0xedb6('0x4'))('rpc');var config=require(_0xedb6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xedb6('0x6')][_0xedb6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a51bc,_0x491563,_0x44fff3){return new BPromise(function(_0x399973,_0x18ca06){return client['request'](_0x4a51bc,_0x44fff3)[_0xedb6('0x8')](function(_0x424772){logger[_0xedb6('0x9')](_0xedb6('0xa'),_0x491563,_0xedb6('0xb'));logger['debug'](_0xedb6('0xc'),_0x491563,_0xedb6('0xb'),JSON[_0xedb6('0xd')](_0x424772));if(_0x424772[_0xedb6('0xe')]){if(_0x424772['error'][_0xedb6('0xf')]===0x1f4){logger['error'](_0xedb6('0xa'),_0x491563,_0x424772[_0xedb6('0xe')][_0xedb6('0x10')]);return _0x18ca06(_0x424772[_0xedb6('0xe')][_0xedb6('0x10')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x491563,_0x424772[_0xedb6('0xe')][_0xedb6('0x10')]);return _0x399973(_0x424772[_0xedb6('0xe')][_0xedb6('0x10')]);}else{logger['info'](_0xedb6('0xa'),_0x491563,'request\x20sent');_0x399973(_0x424772['result'][_0xedb6('0x10')]);}})[_0xedb6('0x11')](function(_0x31cd3c){logger[_0xedb6('0xe')](_0xedb6('0xa'),_0x491563,_0x31cd3c);_0x18ca06(_0x31cd3c);});});}exports[_0xedb6('0x12')]=function(_0xce1358){var _0x53da00=this;return new Promise(function(_0x3d1b44,_0x76a38c){return db[_0xedb6('0x13')][_0xedb6('0x14')](_0xce1358[_0xedb6('0x15')],{'raw':_0xce1358['options']?_0xce1358[_0xedb6('0x16')][_0xedb6('0x17')]===undefined?!![]:![]:!![]})[_0xedb6('0x8')](function(_0x53b783){logger[_0xedb6('0x9')](_0xedb6('0x12'),_0xce1358);logger[_0xedb6('0x18')](_0xedb6('0x12'),_0xce1358,JSON[_0xedb6('0xd')](_0x53b783));_0x3d1b44(_0x53b783);})[_0xedb6('0x11')](function(_0x51d7ab){logger[_0xedb6('0xe')](_0xedb6('0x12'),_0x51d7ab[_0xedb6('0x10')],_0xce1358);_0x76a38c(_0x53da00[_0xedb6('0xe')](0x1f4,_0x51d7ab['message']));});});};exports[_0xedb6('0x19')]=function(_0x1f0ded){var _0x5e6907=this;return new Promise(function(_0x121de2,_0x1745a2){return db['VoiceDialReport'][_0xedb6('0x1a')](_0x1f0ded['body'],{'raw':_0x1f0ded['options']?_0x1f0ded[_0xedb6('0x16')][_0xedb6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0ded[_0xedb6('0x16')]?_0x1f0ded[_0xedb6('0x16')][_0xedb6('0x1b')]||null:null,'attributes':_0x1f0ded[_0xedb6('0x16')]?_0x1f0ded[_0xedb6('0x16')][_0xedb6('0x1c')]||null:null,'limit':_0x1f0ded[_0xedb6('0x16')]?_0x1f0ded[_0xedb6('0x16')]['limit']||null:null})['then'](function(_0x40138e){logger[_0xedb6('0x9')]('UpdateVoiceDialReport',_0x1f0ded);logger[_0xedb6('0x18')](_0xedb6('0x19'),_0x1f0ded,JSON[_0xedb6('0xd')](_0x40138e));_0x121de2(_0x40138e);})[_0xedb6('0x11')](function(_0x301ef4){logger[_0xedb6('0xe')](_0xedb6('0x19'),_0x301ef4[_0xedb6('0x10')],_0x1f0ded);_0x1745a2(_0x5e6907[_0xedb6('0xe')](0x1f4,_0x301ef4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index fd09e23..c314894 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 _0x932a=['destroy','util','connect-timeout','express','Router','fs-extra','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','addApplications','put','update','delete'];(function(_0x14473b,_0x6b07f8){var _0x5d1491=function(_0x4a9571){while(--_0x4a9571){_0x14473b['push'](_0x14473b['shift']());}};_0x5d1491(++_0x6b07f8);}(_0x932a,0x1dd));var _0xa932=function(_0x36338d,_0x4eb4a6){_0x36338d=_0x36338d-0x0;var _0x2f5aa8=_0x932a[_0x36338d];return _0x2f5aa8;};'use strict';var multer=require('multer');var util=require(_0xa932('0x0'));var path=require('path');var timeout=require(_0xa932('0x1'));var express=require(_0xa932('0x2'));var router=express[_0xa932('0x3')]();var fs_extra=require(_0xa932('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa932('0x5'));router[_0xa932('0x6')]('/',auth[_0xa932('0x7')](),controller['index']);router[_0xa932('0x6')](_0xa932('0x8'),auth[_0xa932('0x7')](),controller[_0xa932('0x9')]);router[_0xa932('0xa')]('/',auth[_0xa932('0x7')](),controller[_0xa932('0xb')]);router['post']('/:id/applications',auth[_0xa932('0x7')](),controller[_0xa932('0xc')]);router[_0xa932('0xd')](_0xa932('0x8'),auth[_0xa932('0x7')](),controller[_0xa932('0xe')]);router[_0xa932('0xf')](_0xa932('0x8'),auth['isAuthenticated'](),controller[_0xa932('0x10')]);module['exports']=router; \ No newline at end of file +var _0x72a2=['./voiceExtension.controller','get','isAuthenticated','post','create','/:id/applications','addApplications','put','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72a2,0x14c));var _0x272a=function(_0x297048,_0x4f2dd0){_0x297048=_0x297048-0x0;var _0x8d7b98=_0x72a2[_0x297048];return _0x8d7b98;};'use strict';var multer=require(_0x272a('0x0'));var util=require(_0x272a('0x1'));var path=require(_0x272a('0x2'));var timeout=require('connect-timeout');var express=require(_0x272a('0x3'));var router=express[_0x272a('0x4')]();var fs_extra=require(_0x272a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x272a('0x6'));var config=require(_0x272a('0x7'));var controller=require(_0x272a('0x8'));router[_0x272a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x272a('0x9')]('/:id',auth[_0x272a('0xa')](),controller['show']);router[_0x272a('0xb')]('/',auth['isAuthenticated'](),controller[_0x272a('0xc')]);router[_0x272a('0xb')](_0x272a('0xd'),auth['isAuthenticated'](),controller[_0x272a('0xe')]);router[_0x272a('0xf')](_0x272a('0x10'),auth[_0x272a('0xa')](),controller[_0x272a('0x11')]);router[_0x272a('0x12')](_0x272a('0x10'),auth[_0x272a('0xa')](),controller[_0x272a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 17e5940..7135c6e 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x2d5d81,_0xf8fe84){var _0x559b49=function(_0x4682f8){while(--_0x4682f8){_0x2d5d81['push'](_0x2d5d81['shift']());}};_0x559b49(++_0xf8fe84);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xb7e7[_0x39d544];return _0x5a5ff2;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'context':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x3'),_0x7b7e('0x4'),_0x7b7e('0x5'),'inbound-fax',_0x7b7e('0x6'),_0x7b7e('0x7'),_0x7b7e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x7b7e('0x1')]},'interval':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x9')},'IntervalId':{'type':Sequelize[_0x7b7e('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7b7e('0xa')]},'recordingFormat':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0xc')},'answer':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7b7e('0xd')],'get':function(){return this[_0x7b7e('0xe')]('exten');}}}; \ No newline at end of file +var _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 8aa4263..36753e6 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 _0x2ad0=['filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','UserProfileResource','then','end','error','stack','name','send','index','VoiceExtension','rawAttributes','key','model','query'];(function(_0x161757,_0x2f29af){var _0x4a6adc=function(_0xdd7a56){while(--_0xdd7a56){_0x161757['push'](_0x161757['shift']());}};_0x4a6adc(++_0x2f29af);}(_0x2ad0,0x82));var _0x02ad=function(_0x4c6cf0,_0x826f70){_0x4c6cf0=_0x4c6cf0-0x0;var _0x108145=_0x2ad0[_0x4c6cf0];return _0x108145;};'use strict';var _=require(_0x02ad('0x0'));var Redis=require(_0x02ad('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x02ad('0x2'))('api');var config=require('../../config/environment');var db=require(_0x02ad('0x3'))['db'];config[_0x02ad('0x4')]=_['defaults'](config[_0x02ad('0x4')],{'host':_0x02ad('0x5'),'port':0x18eb});var socket=require(_0x02ad('0x6'))(new Redis(config[_0x02ad('0x4')]));require(_0x02ad('0x7'))['register'](socket);function respondWithStatusCode(_0x299135,_0x3a3e17){_0x3a3e17=_0x3a3e17||0xcc;return function(_0xf46c2){if(_0xf46c2){return _0x299135[_0x02ad('0x8')](_0x3a3e17);}return _0x299135[_0x02ad('0x9')](_0x3a3e17)['end']();};}function respondWithResult(_0x131873,_0x25e4ea){_0x25e4ea=_0x25e4ea||0xc8;return function(_0x55f675){if(_0x55f675){return _0x131873[_0x02ad('0x9')](_0x25e4ea)['json'](_0x55f675);}};}function respondWithFilteredResult(_0x20c86b,_0x1aecbd){return function(_0x1d647b){if(_0x1d647b){var _0x2ecfb7=typeof _0x1aecbd[_0x02ad('0xa')]===_0x02ad('0xb')&&typeof _0x1aecbd['limit']===_0x02ad('0xb');var _0xa39277=_0x1d647b[_0x02ad('0xc')];var _0x381d4e=_0x2ecfb7?0x0:_0x1aecbd['offset'];var _0x3c2f15=_0x2ecfb7?_0x1d647b[_0x02ad('0xc')]:_0x1aecbd[_0x02ad('0xa')]+_0x1aecbd[_0x02ad('0xd')];var _0x5146ae;if(_0x3c2f15>=_0xa39277){_0x3c2f15=_0xa39277;_0x5146ae=0xc8;}else{_0x5146ae=0xce;}_0x20c86b[_0x02ad('0x9')](_0x5146ae);return _0x20c86b[_0x02ad('0xe')](_0x02ad('0xf'),_0x381d4e+'-'+_0x3c2f15+'/'+_0xa39277)[_0x02ad('0x10')](_0x1d647b);}return null;};}function removeEntity(_0xb7ac62){return function(_0x2e136d){if(_0x2e136d){return _0x2e136d[_0x02ad('0x11')]()['then'](function(){var _0x432725=_0x2e136d[_0x02ad('0x12')]({'plain':!![]});var _0x2692b6=[{'name':_0x02ad('0x13'),'value':_0x02ad('0x14'),'ignore':![]},{'name':_0x02ad('0x15'),'value':_0x02ad('0x16'),'ignore':![]},{'name':_0x02ad('0x17'),'value':_0x02ad('0x18'),'ignore':![]}];var _0x464d3a=_(_0x2692b6)[_0x02ad('0x19')](_0x02ad('0x1a'))[_0x02ad('0x1b')](_0x02ad('0x1c'))[_0x02ad('0x1c')]();if(_['includes'](_0x464d3a,_0x432725[_0x02ad('0x1d')])){return;}var _0x2b270c=_[_0x02ad('0x1e')](_0x2692b6,[_0x02ad('0x1c'),_0x432725[_0x02ad('0x1d')]])['name'];return db[_0x02ad('0x1f')][_0x02ad('0x11')]({'where':{'type':_0x2b270c,'resourceId':_0x432725['id']}})['then'](function(){return _0x2e136d;});})[_0x02ad('0x20')](function(){_0xb7ac62[_0x02ad('0x9')](0xcc)[_0x02ad('0x21')]();});}};}function handleEntityNotFound(_0x560e7b){return function(_0x53fb96){if(!_0x53fb96){_0x560e7b[_0x02ad('0x8')](0x194);}return _0x53fb96;};}function handleError(_0x528de9,_0xd0e22e){_0xd0e22e=_0xd0e22e||0x1f4;return function(_0x560e2a){logger[_0x02ad('0x22')](_0x560e2a[_0x02ad('0x23')]);if(_0x560e2a['name']){delete _0x560e2a[_0x02ad('0x24')];}_0x528de9[_0x02ad('0x9')](_0xd0e22e)[_0x02ad('0x25')](_0x560e2a);};}exports[_0x02ad('0x26')]=function(_0x6dd6c8,_0xe51753){var _0x31dfe3={},_0x6aed1b={},_0x1c4aea={'count':0x0,'rows':[]};var _0x4c4bd0=_[_0x02ad('0x1b')](db[_0x02ad('0x27')][_0x02ad('0x28')],function(_0x20a1f9){return{'name':_0x20a1f9['fieldName'],'type':_0x20a1f9['type'][_0x02ad('0x29')]};});_0x6aed1b[_0x02ad('0x2a')]=_[_0x02ad('0x1b')](_0x4c4bd0,_0x02ad('0x24'));_0x6aed1b[_0x02ad('0x2b')]=_['keys'](_0x6dd6c8[_0x02ad('0x2b')]);_0x6aed1b[_0x02ad('0x2c')]=_[_0x02ad('0x2d')](_0x6aed1b[_0x02ad('0x2a')],_0x6aed1b[_0x02ad('0x2b')]);_0x31dfe3[_0x02ad('0x2e')]=_[_0x02ad('0x2d')](_0x6aed1b['model'],qs[_0x02ad('0x2f')](_0x6dd6c8[_0x02ad('0x2b')][_0x02ad('0x2f')]));_0x31dfe3[_0x02ad('0x2e')]=_0x31dfe3[_0x02ad('0x2e')]['length']?_0x31dfe3['attributes']:_0x6aed1b[_0x02ad('0x2a')];if(!_0x6dd6c8[_0x02ad('0x2b')]['hasOwnProperty'](_0x02ad('0x30'))){_0x31dfe3[_0x02ad('0xd')]=qs[_0x02ad('0xd')](_0x6dd6c8[_0x02ad('0x2b')]['limit']);_0x31dfe3[_0x02ad('0xa')]=qs[_0x02ad('0xa')](_0x6dd6c8[_0x02ad('0x2b')]['offset']);}_0x31dfe3[_0x02ad('0x31')]=qs[_0x02ad('0x32')](_0x6dd6c8[_0x02ad('0x2b')][_0x02ad('0x32')]);_0x31dfe3[_0x02ad('0x33')]=qs[_0x02ad('0x2c')](_[_0x02ad('0x34')](_0x6dd6c8[_0x02ad('0x2b')],_0x6aed1b['filters']),_0x4c4bd0);if(_0x6dd6c8[_0x02ad('0x2b')]['filter']){_0x31dfe3[_0x02ad('0x33')]=_[_0x02ad('0x35')](_0x31dfe3[_0x02ad('0x33')],{'$or':_['map'](_0x4c4bd0,function(_0x5b136b){if(_0x5b136b[_0x02ad('0x1d')]!==_0x02ad('0x36')){var _0x5b40d0={};_0x5b40d0[_0x5b136b[_0x02ad('0x24')]]={'$like':'%'+_0x6dd6c8[_0x02ad('0x2b')][_0x02ad('0x19')]+'%'};return _0x5b40d0;}})});}_0x31dfe3=_[_0x02ad('0x35')]({},_0x31dfe3,_0x6dd6c8[_0x02ad('0x37')]);var _0x136a40={'where':_0x31dfe3[_0x02ad('0x33')]};return db[_0x02ad('0x27')][_0x02ad('0xc')](_0x136a40)['then'](function(_0xafd3c7){_0x1c4aea[_0x02ad('0xc')]=_0xafd3c7;if(_0x6dd6c8[_0x02ad('0x2b')][_0x02ad('0x38')]){_0x31dfe3['include']=[{'all':!![]}];}return db[_0x02ad('0x27')][_0x02ad('0x39')](_0x31dfe3);})[_0x02ad('0x20')](function(_0xbabb02){_0x1c4aea[_0x02ad('0x3a')]=_0xbabb02;return _0x1c4aea;})['then'](respondWithFilteredResult(_0xe51753,_0x31dfe3))[_0x02ad('0x3b')](handleError(_0xe51753,null));};exports[_0x02ad('0x3c')]=function(_0x1066d6,_0xfca9b5){var _0x2084b4={'raw':![],'where':{'id':_0x1066d6[_0x02ad('0x3d')]['id']}},_0x16b3eb={};_0x16b3eb[_0x02ad('0x2a')]=_['keys'](db['VoiceExtension'][_0x02ad('0x28')]);_0x16b3eb['query']=_[_0x02ad('0x3e')](_0x1066d6['query']);_0x16b3eb[_0x02ad('0x2c')]=_['intersection'](_0x16b3eb[_0x02ad('0x2a')],_0x16b3eb[_0x02ad('0x2b')]);_0x2084b4[_0x02ad('0x2e')]=_['intersection'](_0x16b3eb[_0x02ad('0x2a')],qs[_0x02ad('0x2f')](_0x1066d6[_0x02ad('0x2b')][_0x02ad('0x2f')]));_0x2084b4[_0x02ad('0x2e')]=_0x2084b4[_0x02ad('0x2e')]['length']?_0x2084b4['attributes']:_0x16b3eb[_0x02ad('0x2a')];if(_0x1066d6['query'][_0x02ad('0x38')]){_0x2084b4[_0x02ad('0x3f')]=[{'all':!![]}];}_0x2084b4=_[_0x02ad('0x35')]({},_0x2084b4,_0x1066d6['options']);return db[_0x02ad('0x27')][_0x02ad('0x1e')](_0x2084b4)['then'](handleEntityNotFound(_0xfca9b5,null))['then'](respondWithResult(_0xfca9b5,null))[_0x02ad('0x3b')](handleError(_0xfca9b5,null));};exports[_0x02ad('0x11')]=function(_0x4eb344,_0x37e019){return db[_0x02ad('0x27')][_0x02ad('0x1e')]({'where':{'id':_0x4eb344['params']['id']}})[_0x02ad('0x20')](handleEntityNotFound(_0x37e019,null))['then'](removeEntity(_0x37e019,null))[_0x02ad('0x3b')](handleError(_0x37e019,null));};exports[_0x02ad('0x40')]=function(_0x36b87e,_0x1b7206){if(_0x36b87e[_0x02ad('0x41')]['type']===_0x02ad('0x16')&&!_['startsWith'](_0x36b87e[_0x02ad('0x41')][_0x02ad('0x42')],'_')){_0x36b87e[_0x02ad('0x41')][_0x02ad('0x42')]='_'['concat'](_0x36b87e[_0x02ad('0x41')][_0x02ad('0x42')]);}return db[_0x02ad('0x27')][_0x02ad('0x40')](_0x36b87e['body'],{'raw':![]})['then'](function(_0xf13b4a){var _0x53a967=_0x36b87e[_0x02ad('0x43')]['get']({'plain':!![]});if(!_0x53a967)throw new Error(_0x02ad('0x44'));if(_0x53a967['role']===_0x02ad('0x43')){var _0x2598a1=_0xf13b4a[_0x02ad('0x12')]({'plain':!![]});var _0x2068ca=[{'name':_0x02ad('0x13'),'value':_0x02ad('0x14')},{'name':_0x02ad('0x15'),'value':'outbound'},{'name':_0x02ad('0x17'),'value':_0x02ad('0x18')}];var _0xe2522f=_[_0x02ad('0x1e')](_0x2068ca,['value',_0x2598a1[_0x02ad('0x1d')]])[_0x02ad('0x24')];return db[_0x02ad('0x45')]['find']({'where':{'name':_0xe2522f,'userProfileId':_0x53a967[_0x02ad('0x46')]},'raw':!![]})[_0x02ad('0x20')](function(_0x3a3cff){if(_0x3a3cff&&_0x3a3cff[_0x02ad('0x47')]===0x0){return db[_0x02ad('0x1f')][_0x02ad('0x40')]({'name':_0x2598a1[_0x02ad('0x24')],'resourceId':_0x2598a1['id'],'type':_0x3a3cff['name'],'sectionId':_0x3a3cff['id']},{})[_0x02ad('0x20')](function(){return _0xf13b4a;});}else{return _0xf13b4a;}})[_0x02ad('0x3b')](function(_0x74aea){logger[_0x02ad('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x74aea);throw _0x74aea;});}return _0xf13b4a;})[_0x02ad('0x20')](respondWithResult(_0x1b7206,0xc9))['catch'](handleError(_0x1b7206,null));};exports['update']=function(_0xb7af6b,_0x8f7f29){if(_0xb7af6b[_0x02ad('0x41')]['id']){delete _0xb7af6b[_0x02ad('0x41')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0xb7af6b[_0x02ad('0x3d')]['id']}})[_0x02ad('0x20')](handleEntityNotFound(_0x8f7f29,null))[_0x02ad('0x20')](function(_0x25660b){if(_0x25660b){return db[_0x02ad('0x27')][_0x02ad('0x48')](_[_0x02ad('0x34')](_0xb7af6b[_0x02ad('0x41')],[_0x02ad('0x42'),_0x02ad('0x49'),_0x02ad('0x4a'),'recordingFormat',_0x02ad('0x4b'),_0x02ad('0x4c'),_0x02ad('0x4d')]),{'where':{'context':_0x25660b['context'],'exten':_0x25660b['exten']},'individualHooks':!![]})[_0x02ad('0x20')](function(_0x1a9adc){return _0x1a9adc;});}return null;})[_0x02ad('0x20')](respondWithStatusCode(_0x8f7f29,null))[_0x02ad('0x3b')](handleError(_0x8f7f29,null));};exports[_0x02ad('0x4e')]=function(_0x1909db,_0x1fca1b){var _0x240ced=_0x1909db[_0x02ad('0x3d')]['id'];var _0x13af8c=_0x1909db['body'];var _0x50b109=0xc8;var _0x48c984=null;return db[_0x02ad('0x4f')]['transaction']({'isolationLevel':db[_0x02ad('0x4f')][_0x02ad('0x50')][_0x02ad('0x51')]['READ_COMMITTED']},function(_0x235576){return db[_0x02ad('0x27')][_0x02ad('0x52')]({'where':{'id':_0x240ced},'transaction':_0x235576})['then'](function(_0x6240d6){if(_0x6240d6){return db[_0x02ad('0x27')][_0x02ad('0x11')]({'where':{'VoiceExtensionId':_0x240ced},'transaction':_0x235576})[_0x02ad('0x20')](function(){var _0x5f580f=_['map'](_0x13af8c,function(_0xe17044){_0xe17044[_0x02ad('0x53')]=_0x240ced;_0xe17044['isApp']=!![];return _0xe17044;});return _0x6240d6['createRouting'](_0x5f580f);})[_0x02ad('0x20')](function(_0x38f812){return db[_0x02ad('0x27')][_0x02ad('0x54')](_0x38f812,{'transaction':_0x235576});});}else{_0x50b109=0x194;_0x48c984=[];}});})[_0x02ad('0x20')](function(){if(_0x50b109!==0x194){return db[_0x02ad('0x27')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x240ced},'order':_0x02ad('0x55')})['then'](function(_0x38a017){_0x48c984=_0x38a017;});}})[_0x02ad('0x3b')](function(_0x485048){_0x50b109=0x1f4;logger[_0x02ad('0x22')](_0x485048[_0x02ad('0x23')]);if(_0x485048[_0x02ad('0x24')]){delete _0x485048[_0x02ad('0x24')];}_0x48c984=_0x485048;})[_0x02ad('0x56')](function(){if(_0x48c984===null){_0x1fca1b[_0x02ad('0x8')](_0x50b109);}else{if(_0x50b109===0x1f4){_0x1fca1b[_0x02ad('0x9')](_0x50b109)[_0x02ad('0x25')](_0x48c984);}else{_0x1fca1b['status'](_0x50b109)[_0x02ad('0x10')](_0x48c984);}}});}; \ No newline at end of file +var _0xf511=['cutdigits','mandatoryDisposition','alias','context','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','api','../../mysqldb','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','get','InboundRoutes','OutboundRoutes','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','InternalRoutes','internal','UserProfileSection','userProfileId','update','pick','description','recordingFormat'];(function(_0x531c11,_0xebb84){var _0x258c49=function(_0x3e472b){while(--_0x3e472b){_0x531c11['push'](_0x531c11['shift']());}};_0x258c49(++_0xebb84);}(_0xf511,0x123));var _0x1f51=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xf511[_0x585133];return _0x18254a;};'use strict';var _=require('lodash');var Redis=require(_0x1f51('0x0'));var qs=require(_0x1f51('0x1'));var logger=require('../../config/logger')(_0x1f51('0x2'));var config=require('../../config/environment');var db=require(_0x1f51('0x3'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1f51('0x4'),'port':0x18eb});var socket=require(_0x1f51('0x5'))(new Redis(config['redis']));require(_0x1f51('0x6'))[_0x1f51('0x7')](socket);function respondWithStatusCode(_0x103154,_0x445ad5){_0x445ad5=_0x445ad5||0xcc;return function(_0x58caaa){if(_0x58caaa){return _0x103154[_0x1f51('0x8')](_0x445ad5);}return _0x103154[_0x1f51('0x9')](_0x445ad5)[_0x1f51('0xa')]();};}function respondWithResult(_0x1e31d7,_0x4d81c6){_0x4d81c6=_0x4d81c6||0xc8;return function(_0x295175){if(_0x295175){return _0x1e31d7[_0x1f51('0x9')](_0x4d81c6)[_0x1f51('0xb')](_0x295175);}};}function respondWithFilteredResult(_0x27606b,_0xce593e){return function(_0x79dc33){if(_0x79dc33){var _0x316399=typeof _0xce593e[_0x1f51('0xc')]===_0x1f51('0xd')&&typeof _0xce593e[_0x1f51('0xe')]==='undefined';var _0x4debdc=_0x79dc33[_0x1f51('0xf')];var _0x1399b6=_0x316399?0x0:_0xce593e[_0x1f51('0xc')];var _0x4d9962=_0x316399?_0x79dc33[_0x1f51('0xf')]:_0xce593e[_0x1f51('0xc')]+_0xce593e[_0x1f51('0xe')];var _0x5ecf86;if(_0x4d9962>=_0x4debdc){_0x4d9962=_0x4debdc;_0x5ecf86=0xc8;}else{_0x5ecf86=0xce;}_0x27606b[_0x1f51('0x9')](_0x5ecf86);return _0x27606b[_0x1f51('0x10')]('Content-Range',_0x1399b6+'-'+_0x4d9962+'/'+_0x4debdc)[_0x1f51('0xb')](_0x79dc33);}return null;};}function removeEntity(_0x5243f2){return function(_0x304341){if(_0x304341){return _0x304341[_0x1f51('0x11')]()['then'](function(){var _0x557738=_0x304341[_0x1f51('0x12')]({'plain':!![]});var _0x4e9191=[{'name':_0x1f51('0x13'),'value':'inbound','ignore':![]},{'name':_0x1f51('0x14'),'value':_0x1f51('0x15'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x928a61=_(_0x4e9191)[_0x1f51('0x16')](_0x1f51('0x17'))[_0x1f51('0x18')]('value')[_0x1f51('0x19')]();if(_[_0x1f51('0x1a')](_0x928a61,_0x557738[_0x1f51('0x1b')])){return;}var _0x28f329=_[_0x1f51('0x1c')](_0x4e9191,[_0x1f51('0x19'),_0x557738['type']])[_0x1f51('0x1d')];return db[_0x1f51('0x1e')][_0x1f51('0x11')]({'where':{'type':_0x28f329,'resourceId':_0x557738['id']}})[_0x1f51('0x1f')](function(){return _0x304341;});})['then'](function(){_0x5243f2[_0x1f51('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c93f0){return function(_0x4c2979){if(!_0x4c2979){_0x1c93f0[_0x1f51('0x8')](0x194);}return _0x4c2979;};}function handleError(_0x3afe03,_0x341c2e){_0x341c2e=_0x341c2e||0x1f4;return function(_0x1ad95b){logger[_0x1f51('0x20')](_0x1ad95b[_0x1f51('0x21')]);if(_0x1ad95b[_0x1f51('0x1d')]){delete _0x1ad95b[_0x1f51('0x1d')];}_0x3afe03[_0x1f51('0x9')](_0x341c2e)[_0x1f51('0x22')](_0x1ad95b);};}exports[_0x1f51('0x23')]=function(_0x3ba6b3,_0x7a4c6){var _0x4b3cd7={},_0xb94dc6={},_0x5739fb={'count':0x0,'rows':[]};var _0x78c4be=_[_0x1f51('0x18')](db[_0x1f51('0x24')][_0x1f51('0x25')],function(_0x230e1d){return{'name':_0x230e1d[_0x1f51('0x26')],'type':_0x230e1d[_0x1f51('0x1b')][_0x1f51('0x27')]};});_0xb94dc6[_0x1f51('0x28')]=_['map'](_0x78c4be,_0x1f51('0x1d'));_0xb94dc6[_0x1f51('0x29')]=_[_0x1f51('0x2a')](_0x3ba6b3[_0x1f51('0x29')]);_0xb94dc6[_0x1f51('0x2b')]=_[_0x1f51('0x2c')](_0xb94dc6['model'],_0xb94dc6[_0x1f51('0x29')]);_0x4b3cd7[_0x1f51('0x2d')]=_['intersection'](_0xb94dc6['model'],qs[_0x1f51('0x2e')](_0x3ba6b3[_0x1f51('0x29')][_0x1f51('0x2e')]));_0x4b3cd7[_0x1f51('0x2d')]=_0x4b3cd7[_0x1f51('0x2d')][_0x1f51('0x2f')]?_0x4b3cd7[_0x1f51('0x2d')]:_0xb94dc6[_0x1f51('0x28')];if(!_0x3ba6b3[_0x1f51('0x29')][_0x1f51('0x30')]('nolimit')){_0x4b3cd7[_0x1f51('0xe')]=qs[_0x1f51('0xe')](_0x3ba6b3[_0x1f51('0x29')][_0x1f51('0xe')]);_0x4b3cd7[_0x1f51('0xc')]=qs[_0x1f51('0xc')](_0x3ba6b3[_0x1f51('0x29')][_0x1f51('0xc')]);}_0x4b3cd7[_0x1f51('0x31')]=qs['sort'](_0x3ba6b3['query'][_0x1f51('0x32')]);_0x4b3cd7[_0x1f51('0x33')]=qs[_0x1f51('0x2b')](_['pick'](_0x3ba6b3['query'],_0xb94dc6[_0x1f51('0x2b')]),_0x78c4be);if(_0x3ba6b3[_0x1f51('0x29')][_0x1f51('0x16')]){_0x4b3cd7[_0x1f51('0x33')]=_[_0x1f51('0x34')](_0x4b3cd7[_0x1f51('0x33')],{'$or':_[_0x1f51('0x18')](_0x78c4be,function(_0x4fbf73){if(_0x4fbf73['type']!==_0x1f51('0x35')){var _0x54c520={};_0x54c520[_0x4fbf73[_0x1f51('0x1d')]]={'$like':'%'+_0x3ba6b3[_0x1f51('0x29')][_0x1f51('0x16')]+'%'};return _0x54c520;}})});}_0x4b3cd7=_['merge']({},_0x4b3cd7,_0x3ba6b3[_0x1f51('0x36')]);var _0x2c08af={'where':_0x4b3cd7[_0x1f51('0x33')]};return db[_0x1f51('0x24')][_0x1f51('0xf')](_0x2c08af)[_0x1f51('0x1f')](function(_0xddde10){_0x5739fb[_0x1f51('0xf')]=_0xddde10;if(_0x3ba6b3[_0x1f51('0x29')][_0x1f51('0x37')]){_0x4b3cd7[_0x1f51('0x38')]=[{'all':!![]}];}return db[_0x1f51('0x24')][_0x1f51('0x39')](_0x4b3cd7);})[_0x1f51('0x1f')](function(_0x2ac746){_0x5739fb['rows']=_0x2ac746;return _0x5739fb;})[_0x1f51('0x1f')](respondWithFilteredResult(_0x7a4c6,_0x4b3cd7))[_0x1f51('0x3a')](handleError(_0x7a4c6,null));};exports[_0x1f51('0x3b')]=function(_0xe43d17,_0x312ebb){var _0x5d3967={'raw':![],'where':{'id':_0xe43d17[_0x1f51('0x3c')]['id']}},_0x26b00c={};_0x26b00c[_0x1f51('0x28')]=_[_0x1f51('0x2a')](db[_0x1f51('0x24')]['rawAttributes']);_0x26b00c['query']=_['keys'](_0xe43d17[_0x1f51('0x29')]);_0x26b00c['filters']=_[_0x1f51('0x2c')](_0x26b00c[_0x1f51('0x28')],_0x26b00c[_0x1f51('0x29')]);_0x5d3967['attributes']=_[_0x1f51('0x2c')](_0x26b00c[_0x1f51('0x28')],qs[_0x1f51('0x2e')](_0xe43d17[_0x1f51('0x29')][_0x1f51('0x2e')]));_0x5d3967[_0x1f51('0x2d')]=_0x5d3967[_0x1f51('0x2d')][_0x1f51('0x2f')]?_0x5d3967[_0x1f51('0x2d')]:_0x26b00c[_0x1f51('0x28')];if(_0xe43d17[_0x1f51('0x29')]['includeAll']){_0x5d3967[_0x1f51('0x38')]=[{'all':!![]}];}_0x5d3967=_[_0x1f51('0x34')]({},_0x5d3967,_0xe43d17['options']);return db[_0x1f51('0x24')][_0x1f51('0x1c')](_0x5d3967)[_0x1f51('0x1f')](handleEntityNotFound(_0x312ebb,null))[_0x1f51('0x1f')](respondWithResult(_0x312ebb,null))['catch'](handleError(_0x312ebb,null));};exports['destroy']=function(_0x506195,_0x13e977){return db[_0x1f51('0x24')][_0x1f51('0x1c')]({'where':{'id':_0x506195[_0x1f51('0x3c')]['id']}})[_0x1f51('0x1f')](handleEntityNotFound(_0x13e977,null))[_0x1f51('0x1f')](removeEntity(_0x13e977,null))[_0x1f51('0x3a')](handleError(_0x13e977,null));};exports[_0x1f51('0x3d')]=function(_0x5d88fe,_0x4ac150){if(_0x5d88fe[_0x1f51('0x3e')][_0x1f51('0x1b')]==='outbound'&&!_['startsWith'](_0x5d88fe['body'][_0x1f51('0x3f')],'_')){_0x5d88fe[_0x1f51('0x3e')]['exten']='_'[_0x1f51('0x40')](_0x5d88fe['body'][_0x1f51('0x3f')]);}return db['VoiceExtension'][_0x1f51('0x3d')](_0x5d88fe['body'],{'raw':![]})[_0x1f51('0x1f')](function(_0x34786e){var _0x366997=_0x5d88fe[_0x1f51('0x41')][_0x1f51('0x12')]({'plain':!![]});if(!_0x366997)throw new Error(_0x1f51('0x42'));if(_0x366997[_0x1f51('0x43')]==='user'){var _0x4764b6=_0x34786e[_0x1f51('0x12')]({'plain':!![]});var _0x3fa348=[{'name':_0x1f51('0x13'),'value':_0x1f51('0x44')},{'name':_0x1f51('0x14'),'value':_0x1f51('0x15')},{'name':_0x1f51('0x45'),'value':_0x1f51('0x46')}];var _0x137f35=_['find'](_0x3fa348,[_0x1f51('0x19'),_0x4764b6[_0x1f51('0x1b')]])[_0x1f51('0x1d')];return db[_0x1f51('0x47')][_0x1f51('0x1c')]({'where':{'name':_0x137f35,'userProfileId':_0x366997[_0x1f51('0x48')]},'raw':!![]})[_0x1f51('0x1f')](function(_0x5a715e){if(_0x5a715e&&_0x5a715e['autoAssociation']===0x0){return db[_0x1f51('0x1e')][_0x1f51('0x3d')]({'name':_0x4764b6['name'],'resourceId':_0x4764b6['id'],'type':_0x5a715e[_0x1f51('0x1d')],'sectionId':_0x5a715e['id']},{})[_0x1f51('0x1f')](function(){return _0x34786e;});}else{return _0x34786e;}})[_0x1f51('0x3a')](function(_0x2c9190){logger[_0x1f51('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c9190);throw _0x2c9190;});}return _0x34786e;})[_0x1f51('0x1f')](respondWithResult(_0x4ac150,0xc9))[_0x1f51('0x3a')](handleError(_0x4ac150,null));};exports['update']=function(_0x48739e,_0x366687){if(_0x48739e['body']['id']){delete _0x48739e[_0x1f51('0x3e')]['id'];}return db[_0x1f51('0x24')][_0x1f51('0x1c')]({'where':{'id':_0x48739e[_0x1f51('0x3c')]['id']}})[_0x1f51('0x1f')](handleEntityNotFound(_0x366687,null))['then'](function(_0x5ac21a){if(_0x5ac21a){return db['VoiceExtension'][_0x1f51('0x49')](_[_0x1f51('0x4a')](_0x48739e[_0x1f51('0x3e')],['exten','context',_0x1f51('0x4b'),_0x1f51('0x4c'),_0x1f51('0x4d'),_0x1f51('0x4e'),_0x1f51('0x4f')]),{'where':{'context':_0x5ac21a[_0x1f51('0x50')],'exten':_0x5ac21a['exten']},'individualHooks':!![]})[_0x1f51('0x1f')](function(_0x3fad50){return _0x3fad50;});}return null;})[_0x1f51('0x1f')](respondWithStatusCode(_0x366687,null))[_0x1f51('0x3a')](handleError(_0x366687,null));};exports['addApplications']=function(_0x6e3c76,_0x1a8dec){var _0x3ad23f=_0x6e3c76[_0x1f51('0x3c')]['id'];var _0x2e7430=_0x6e3c76[_0x1f51('0x3e')];var _0x5a4a6a=0xc8;var _0x54e3e9=null;return db[_0x1f51('0x51')][_0x1f51('0x52')]({'isolationLevel':db[_0x1f51('0x51')][_0x1f51('0x53')][_0x1f51('0x54')]['READ_COMMITTED']},function(_0x5b046f){return db[_0x1f51('0x24')][_0x1f51('0x55')]({'where':{'id':_0x3ad23f},'transaction':_0x5b046f})[_0x1f51('0x1f')](function(_0x49e4c1){if(_0x49e4c1){return db[_0x1f51('0x24')][_0x1f51('0x11')]({'where':{'VoiceExtensionId':_0x3ad23f},'transaction':_0x5b046f})['then'](function(){var _0x152f70=_[_0x1f51('0x18')](_0x2e7430,function(_0x107ee8){_0x107ee8['VoiceExtensionId']=_0x3ad23f;_0x107ee8[_0x1f51('0x56')]=!![];return _0x107ee8;});return _0x49e4c1[_0x1f51('0x57')](_0x152f70);})['then'](function(_0x5a3ff8){return db[_0x1f51('0x24')][_0x1f51('0x58')](_0x5a3ff8,{'transaction':_0x5b046f});});}else{_0x5a4a6a=0x194;_0x54e3e9=[];}});})[_0x1f51('0x1f')](function(){if(_0x5a4a6a!==0x194){return db[_0x1f51('0x24')][_0x1f51('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3ad23f},'order':_0x1f51('0x5a')})['then'](function(_0x441a91){_0x54e3e9=_0x441a91;});}})[_0x1f51('0x3a')](function(_0x186299){_0x5a4a6a=0x1f4;logger[_0x1f51('0x20')](_0x186299['stack']);if(_0x186299[_0x1f51('0x1d')]){delete _0x186299[_0x1f51('0x1d')];}_0x54e3e9=_0x186299;})[_0x1f51('0x5b')](function(){if(_0x54e3e9===null){_0x1a8dec['sendStatus'](_0x5a4a6a);}else{if(_0x5a4a6a===0x1f4){_0x1a8dec['status'](_0x5a4a6a)[_0x1f51('0x22')](_0x54e3e9);}else{_0x1a8dec[_0x1f51('0x9')](_0x5a4a6a)[_0x1f51('0xb')](_0x54e3e9);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f1359d5..bfb0021 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 _0xa73e=['emit','hasOwnProperty','exports','events','../../mysqldb','update','remove'];(function(_0x501292,_0x17e179){var _0x41c024=function(_0x2d433f){while(--_0x2d433f){_0x501292['push'](_0x501292['shift']());}};_0x41c024(++_0x17e179);}(_0xa73e,0x8f));var _0xea73=function(_0x18e8b5,_0x2548d5){_0x18e8b5=_0x18e8b5-0x0;var _0x90eb46=_0xa73e[_0x18e8b5];return _0x90eb46;};'use strict';var EventEmitter=require(_0xea73('0x0'));var VoiceExtension=require(_0xea73('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xea73('0x2'),'afterDestroy':_0xea73('0x3')};function emitEvent(_0x875da5){return function(_0x5dafb4,_0x126437,_0x202471){VoiceExtensionEvents[_0xea73('0x4')](_0x875da5+':'+_0x5dafb4['id'],_0x5dafb4);VoiceExtensionEvents[_0xea73('0x4')](_0x875da5,_0x5dafb4);_0x202471(null);};}for(var e in events){if(events[_0xea73('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xea73('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x5c3b=['../../mysqldb','VoiceExtension','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x43cdc5,_0x2f19ba){var _0x2da6c5=function(_0x1bf4f7){while(--_0x1bf4f7){_0x43cdc5['push'](_0x43cdc5['shift']());}};_0x2da6c5(++_0x2f19ba);}(_0x5c3b,0x6d));var _0xb5c3=function(_0x1e88eb,_0x4d031e){_0x1e88eb=_0x1e88eb-0x0;var _0x23fe01=_0x5c3b[_0x1e88eb];return _0x23fe01;};'use strict';var EventEmitter=require(_0xb5c3('0x0'));var VoiceExtension=require(_0xb5c3('0x1'))['db'][_0xb5c3('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb5c3('0x3'),'afterUpdate':_0xb5c3('0x4'),'afterDestroy':_0xb5c3('0x5')};function emitEvent(_0x894f23){return function(_0x2ca2ac,_0x53465b,_0x38a30f){VoiceExtensionEvents[_0xb5c3('0x6')](_0x894f23+':'+_0x2ca2ac['id'],_0x2ca2ac);VoiceExtensionEvents[_0xb5c3('0x6')](_0x894f23,_0x2ca2ac);_0x38a30f(null);};}for(var e in events){if(events[_0xb5c3('0x7')](e)){var event=events[e];VoiceExtension[_0xb5c3('0x8')](e,emitEvent(event));}}module[_0xb5c3('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 28e7ee0..462861b 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 _0x02f5=['tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','hasOwnProperty','answer','playback','includes','app','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','then','*,*,*,*','intervals','IntervalId','filter'];(function(_0x32901c,_0x53738c){var _0x34fa0f=function(_0x1df29b){while(--_0x1df29b){_0x32901c['push'](_0x32901c['shift']());}};_0x34fa0f(++_0x53738c);}(_0x02f5,0x103));var _0x502f=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x02f5[_0xaa6a4];return _0xdc31a4;};'use strict';var _=require(_0x502f('0x0'));var attributes=require(_0x502f('0x1'));module[_0x502f('0x2')]=function(_0x11d2b2){var _0x5b1676=_0x11d2b2[_0x502f('0x3')];function _0x11db11(_0x4f0ce9){var _0x1c3b96=0x2;var _0x11587e=[{'type':_0x4f0ce9[_0x502f('0x4')],'app':_0x502f('0x5'),'appdata':_0x502f('0x6')+_0x4f0ce9[_0x502f('0x4')],'context':_0x4f0ce9[_0x502f('0x7')],'exten':_0x4f0ce9[_0x502f('0x8')],'priority':_0x1c3b96++,'VoiceExtensionId':_0x4f0ce9['id']}];if(_0x4f0ce9[_0x502f('0x4')]==='inbound'){_0x11587e[_0x502f('0x9')]({'type':'inbound','app':_0x502f('0x5'),'appdata':_0x502f('0xa')+_0x4f0ce9['id'],'context':_0x4f0ce9['context'],'exten':_0x4f0ce9[_0x502f('0x8')],'priority':_0x1c3b96++,'VoiceExtensionId':_0x4f0ce9['id']});}_0x11587e[_0x502f('0x9')]({'type':_0x4f0ce9[_0x502f('0x4')],'app':_0x502f('0x5'),'appdata':_0x502f('0xb'),'context':_0x4f0ce9[_0x502f('0x7')],'exten':_0x4f0ce9[_0x502f('0x8')],'priority':_0x1c3b96++,'VoiceExtensionId':_0x4f0ce9['id']},{'type':_0x4f0ce9[_0x502f('0x4')],'app':'Set','appdata':_0x502f('0xc'),'context':_0x4f0ce9['context'],'exten':_0x4f0ce9[_0x502f('0x8')],'priority':_0x1c3b96++,'VoiceExtensionId':_0x4f0ce9['id']},{'type':_0x4f0ce9[_0x502f('0x4')],'app':_0x502f('0x5'),'appdata':_0x502f('0xd'),'context':_0x4f0ce9[_0x502f('0x7')],'exten':_0x4f0ce9[_0x502f('0x8')],'priority':_0x1c3b96++,'VoiceExtensionId':_0x4f0ce9['id']});return _0x11587e;}function _0x546961(_0x249a6f){var _0x3805a1=0x2;var _0x22e97b=[{'type':'outbound','app':_0x502f('0x5'),'appdata':_0x502f('0xe'),'context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f['exten'],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']},{'type':_0x502f('0xf'),'app':_0x502f('0x5'),'appdata':_0x502f('0x10')+(_0x249a6f[_0x502f('0x11')]?_0x502f('0x12')+_0x249a6f[_0x502f('0x11')]+'}':_0x502f('0x13')),'context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f['exten'],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']},{'type':_0x502f('0xf'),'app':_0x502f('0x5'),'appdata':_0x502f('0xa')+_0x249a6f['id'],'context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f[_0x502f('0x8')],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']},{'type':_0x502f('0xf'),'app':_0x502f('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3805a1+0x2)+_0x502f('0x15')+(_0x3805a1+0x1)+')','context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f['exten'],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']},{'type':_0x502f('0xf'),'app':_0x502f('0x5'),'appdata':_0x249a6f['cutdigits']?_0x502f('0x16')+_0x249a6f['cutdigits']+'}':_0x502f('0x17'),'context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f[_0x502f('0x8')],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']},{'type':_0x502f('0xf'),'app':_0x502f('0x5'),'appdata':_0x502f('0xb'),'context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f[_0x502f('0x8')],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']},{'type':_0x502f('0xf'),'app':'Set','appdata':_0x502f('0xc'),'context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f[_0x502f('0x8')],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']},{'type':_0x502f('0xf'),'app':_0x502f('0x5'),'appdata':_0x502f('0xd'),'context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f['exten'],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']},{'type':_0x502f('0xf'),'app':'Set','appdata':_0x502f('0x18')+_0x249a6f['id'],'context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f['exten'],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']}];if(_0x249a6f['hasOwnProperty']('recordingFormat')&&_0x249a6f[_0x502f('0x19')]!=='none'){_0x22e97b[_0x502f('0x9')]({'type':_0x502f('0xf'),'app':_0x502f('0x5'),'appdata':_0x502f('0x1a'),'context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f[_0x502f('0x8')],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']},{'type':_0x502f('0xf'),'app':_0x502f('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x249a6f[_0x502f('0x19')]||'wav','context':_0x249a6f[_0x502f('0x7')],'exten':_0x249a6f[_0x502f('0x8')],'priority':_0x3805a1++,'VoiceExtensionId':_0x249a6f['id']});}return _0x22e97b;}function _0x12695f(_0x3c5b03,_0x569787){var _0x11d390=[{'name':_0x502f('0x1b'),'param':0x0},{'name':_0x502f('0x1c'),'param':0x1},{'name':_0x502f('0x1d'),'param':0x2},{'name':_0x502f('0x1e'),'param':0x3}];var _0x2b1158={};var _0x41085a=_0x569787[_0x502f('0x1f')](',');var _0x207e0c=[];for(var _0x3319d5=0x0;_0x3319d5<_0x11d390[_0x502f('0x20')];_0x3319d5++){switch(_0x11d390[_0x3319d5][_0x502f('0x21')]){case _0x502f('0x1b'):_0x2b1158[_0x502f('0x1b')]=_0x41085a[_0x11d390[_0x3319d5][_0x502f('0x22')]]['split']('/')[0x1];_0x2b1158[_0x502f('0x23')]=_0x41085a[_0x11d390[_0x3319d5][_0x502f('0x22')]][_0x502f('0x1f')]('/')[0x2];_0x2b1158[_0x502f('0x24')]=_0x2b1158[_0x502f('0x23')]?_0x2b1158[_0x502f('0x23')][_0x502f('0x1f')]('$')[0x0]:undefined;_0x2b1158[_0x502f('0x23')]=_0x3c5b03[_0x502f('0x11')]?(_0x2b1158['prefix']||'')+_0x502f('0x12')+_0x3c5b03['cutdigits']+'}':(_0x2b1158[_0x502f('0x24')]||'')+_0x502f('0x13');_0x207e0c[_0x11d390[_0x3319d5][_0x502f('0x22')]]=[_0x502f('0x25'),_0x2b1158['trunk'],_0x2b1158[_0x502f('0x23')]][_0x502f('0x26')]('/');break;case'options':_0x2b1158['options']=_0x41085a[_0x11d390[_0x3319d5][_0x502f('0x22')]];if(_0x3c5b03[_0x502f('0x19')]!=='none'){if(_0x2b1158[_0x502f('0x1d')]['indexOf'](_0x502f('0x27'))<0x0){_0x2b1158[_0x502f('0x1d')]+='U(xcally-mixmonitor-context)';}}else{_0x2b1158[_0x502f('0x1d')]=_0x2b1158[_0x502f('0x1d')][_0x502f('0x28')](_0x502f('0x27'),'');}_0x207e0c[_0x11d390[_0x3319d5][_0x502f('0x22')]]=_0x2b1158[_0x502f('0x1d')];break;default:_0x207e0c[_0x11d390[_0x3319d5]['param']]=_0x41085a[_0x11d390[_0x3319d5][_0x502f('0x22')]];}}return _0x207e0c[_0x502f('0x26')](',');}function _0x4b2bda(_0x276aea,_0x4cfc78,_0x1ff421){return new Promise(function(_0x49921e,_0x218cb1){var _0xa8239b=[];if(_[_0x502f('0x29')](_0x4cfc78))return _0x49921e(_0xa8239b);_0x5b1676['Interval'][_0x502f('0x2a')]({'attributes':['id',_0x502f('0x2b'),'IntervalId'],'raw':!![]})[_0x502f('0x2c')](function(_0x3f3f2b){for(var _0x144d2f=0x0,_0x24607b=0x0;_0x144d2f<_0x4cfc78[_0x502f('0x20')];_0x144d2f++,_0x24607b=0x0){var _0x1acdeb=_0x4cfc78[_0x144d2f];var _0x4ffc1b=[];var _0x56e9b9=[];delete _0x1acdeb['id'];if(_0x1acdeb['interval']!==_0x502f('0x2d')){_0x1acdeb[_0x502f('0x2e')]=[_0x1acdeb['interval']];}else{_0x1acdeb[_0x502f('0x2e')]=_0x1acdeb[_0x502f('0x2f')]?_['map'](_[_0x502f('0x30')](_0x3f3f2b,{'IntervalId':_0x1acdeb[_0x502f('0x2f')]}),_0x502f('0x2b')):[];}_0x1acdeb[_0x502f('0x7')]=_0x276aea[_0x502f('0x7')];_0x1acdeb[_0x502f('0x8')]=_0x276aea['exten'];if(_0x1acdeb[_0x502f('0x4')])_0x1acdeb[_0x502f('0x4')]=_0x1acdeb[_0x502f('0x4')]['toLowerCase']();if(_0x276aea[_0x502f('0x4')]==='outbound'){if(_0x1acdeb['hasOwnProperty']('tag')&&_0x1acdeb[_0x502f('0x31')]&&_0x1acdeb[_0x502f('0x31')]!=='--'){_0x4ffc1b[_0x502f('0x9')]({'type':_0x1acdeb[_0x502f('0x4')]['toLowerCase'](),'app':'Set','appdata':_0x502f('0x32')+_0x1acdeb[_0x502f('0x31')],'context':_0x276aea[_0x502f('0x7')],'exten':_0x276aea[_0x502f('0x8')],'priority':_0x1acdeb[_0x502f('0x2e')]['length']+_0x1ff421+_0x24607b++,'VoiceExtensionId':_0x276aea['id']});}_0x4ffc1b[_0x502f('0x9')]({'type':_0x1acdeb[_0x502f('0x4')][_0x502f('0x33')](),'app':_0x502f('0x14'),'appdata':_0x502f('0x34')+(_0x1acdeb[_0x502f('0x35')]?_0x502f('0x36')+_0x1acdeb[_0x502f('0x35')]+')':'NoOp(No\x20number\x20available)'),'context':_0x276aea[_0x502f('0x7')],'exten':_0x276aea[_0x502f('0x8')],'priority':_0x1acdeb[_0x502f('0x2e')][_0x502f('0x20')]+_0x1ff421+_0x24607b++,'VoiceExtensionId':_0x276aea['id']});}else{if(_0x1acdeb[_0x502f('0x37')](_0x502f('0x38'))){if(['queue',_0x502f('0x39')][_0x502f('0x3a')](_0x1acdeb[_0x502f('0x3b')][_0x502f('0x33')]())&&_0x1acdeb['appType']!=='custom'){if(_0x1acdeb['answer']){_0x4ffc1b[_0x502f('0x9')]({'type':_0x1acdeb[_0x502f('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x276aea[_0x502f('0x7')],'exten':_0x276aea[_0x502f('0x8')],'priority':_0x1acdeb[_0x502f('0x2e')][_0x502f('0x20')]+_0x1ff421+_0x24607b++,'VoiceExtensionId':_0x276aea['id']});_0x4ffc1b[_0x502f('0x9')]({'type':_0x1acdeb[_0x502f('0x4')][_0x502f('0x33')](),'app':_0x502f('0x5'),'appdata':_0x502f('0x3c'),'context':_0x276aea[_0x502f('0x7')],'exten':_0x276aea[_0x502f('0x8')],'priority':_0x1acdeb[_0x502f('0x2e')][_0x502f('0x20')]+_0x1ff421+_0x24607b++,'VoiceExtensionId':_0x276aea['id']});}else{_0x4ffc1b[_0x502f('0x9')]({'type':_0x1acdeb[_0x502f('0x4')][_0x502f('0x33')](),'app':_0x502f('0x14'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x276aea[_0x502f('0x7')],'exten':_0x276aea['exten'],'priority':_0x1acdeb[_0x502f('0x2e')]['length']+_0x1ff421+_0x24607b++,'VoiceExtensionId':_0x276aea['id']});_0x4ffc1b['push']({'type':_0x1acdeb[_0x502f('0x4')][_0x502f('0x33')](),'app':_0x502f('0x5'),'appdata':_0x502f('0x3d'),'context':_0x276aea['context'],'exten':_0x276aea[_0x502f('0x8')],'priority':_0x1acdeb[_0x502f('0x2e')][_0x502f('0x20')]+_0x1ff421+_0x24607b++,'VoiceExtensionId':_0x276aea['id']});}}}}for(var _0x55bc03=0x0;_0x55bc03<_0x1acdeb[_0x502f('0x2e')]['length'];_0x55bc03++){var _0x2fe9be=_0x1ff421+_0x1acdeb[_0x502f('0x2e')]['length'];var _0x3e34b8=_0x55bc03===_0x1acdeb[_0x502f('0x2e')][_0x502f('0x20')]-0x1?_0x1ff421+_0x4ffc1b['length']+_0x56e9b9[_0x502f('0x20')]+0x2:_0x1ff421+_0x55bc03+0x1;_0x4ffc1b[_0x502f('0x3e')](_0x55bc03,0x0,{'type':_0x276aea[_0x502f('0x4')],'app':'GotoIfTime','appdata':_0x1acdeb[_0x502f('0x2e')][_0x55bc03]+'?'+_0x276aea[_0x502f('0x7')]+_0x502f('0x3f')+_0x2fe9be+':'+_0x276aea[_0x502f('0x7')]+_0x502f('0x3f')+_0x3e34b8,'exten':_0x276aea['exten'],'context':_0x276aea[_0x502f('0x7')],'priority':_0x1ff421+_0x55bc03,'VoiceExtensionId':_0x276aea['id']});}if(_0x1acdeb[_0x502f('0x40')]===_0x502f('0x41')){_0x1acdeb['appdata']=_0x12695f(_0x276aea,_0x1acdeb[_0x502f('0x42')]);}if(_0x1acdeb[_0x502f('0x40')]===_0x502f('0x43')){_0x4ffc1b[_0x502f('0x9')]({'type':_0x1acdeb[_0x502f('0x4')][_0x502f('0x33')](),'app':_0x502f('0x5'),'appdata':_0x502f('0x44'),'context':_0x276aea[_0x502f('0x7')],'exten':_0x276aea[_0x502f('0x8')],'priority':_0x1acdeb['intervals'][_0x502f('0x20')]+_0x1ff421+_0x24607b++,'VoiceExtensionId':_0x276aea['id']});}_0x1acdeb['priority']=_0x4ffc1b['length']?_['last'](_0x4ffc1b)[_0x502f('0x45')]+0x1:_0x1ff421;_0xa8239b=_[_0x502f('0x46')](_0xa8239b,_0x4ffc1b,[_0x1acdeb],_0x56e9b9);_0x1ff421=_[_0x502f('0x47')](_0xa8239b)[_0x502f('0x45')]+0x1;}return _0x49921e(_0xa8239b);})[_0x502f('0x48')](function(_0x10a7b3){_0x218cb1(_0x10a7b3);});});}return _0x11d2b2['define'](_0x502f('0x49'),attributes,{'tableName':_0x502f('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x574f4a){var _0x4faf1f=this[_0x502f('0x4b')]({'plain':!![]});var _0x1d7fc9=_0x4faf1f['type']===_0x502f('0xf')?_0x546961(_0x4faf1f):_0x11db11(_0x4faf1f);return _0x4b2bda(_0x4faf1f,_0x574f4a,_[_0x502f('0x47')](_0x1d7fc9)['priority']+0x1)[_0x502f('0x2c')](function(_0x59cb57){var _0x80eeb1=_[_0x502f('0x46')](_0x1d7fc9,_0x59cb57);_0x80eeb1[_0x502f('0x9')]({'type':_0x4faf1f[_0x502f('0x4')],'app':_0x502f('0x4c'),'exten':_0x4faf1f['exten'],'context':_0x4faf1f[_0x502f('0x7')],'priority':_[_0x502f('0x47')](_0x80eeb1)[_0x502f('0x45')]+0x1,'VoiceExtensionId':_0x4faf1f['id']});return _0x80eeb1;});}}});}; \ No newline at end of file +var _0x5396=['length','name','phone','param','${EXTEN:','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','hasOwnProperty','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','queue','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice',',${EXTEN},','outboundDial','appdata','agi','priority','last','concat','catch','VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','models','type','Set','context','exten','push','inbound','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split'];(function(_0x37e307,_0x378e6c){var _0x44a38c=function(_0x278dce){while(--_0x278dce){_0x37e307['push'](_0x37e307['shift']());}};_0x44a38c(++_0x378e6c);}(_0x5396,0x11c));var _0x6539=function(_0x495fe6,_0x172ac2){_0x495fe6=_0x495fe6-0x0;var _0x119d2f=_0x5396[_0x495fe6];return _0x119d2f;};'use strict';var _=require(_0x6539('0x0'));var attributes=require(_0x6539('0x1'));module['exports']=function(_0x193002){var _0x4fa948=_0x193002[_0x6539('0x2')];function _0x1cf5e0(_0x1bc643){var _0x1fcac2=0x2;var _0x5df06e=[{'type':_0x1bc643[_0x6539('0x3')],'app':_0x6539('0x4'),'appdata':'CDR(type)='+_0x1bc643[_0x6539('0x3')],'context':_0x1bc643[_0x6539('0x5')],'exten':_0x1bc643[_0x6539('0x6')],'priority':_0x1fcac2++,'VoiceExtensionId':_0x1bc643['id']}];if(_0x1bc643['type']==='inbound'){_0x5df06e[_0x6539('0x7')]({'type':_0x6539('0x8'),'app':'Set','appdata':'CDR(routeid)='+_0x1bc643['id'],'context':_0x1bc643[_0x6539('0x5')],'exten':_0x1bc643['exten'],'priority':_0x1fcac2++,'VoiceExtensionId':_0x1bc643['id']});}_0x5df06e['push']({'type':_0x1bc643[_0x6539('0x3')],'app':_0x6539('0x4'),'appdata':_0x6539('0x9'),'context':_0x1bc643[_0x6539('0x5')],'exten':_0x1bc643[_0x6539('0x6')],'priority':_0x1fcac2++,'VoiceExtensionId':_0x1bc643['id']},{'type':_0x1bc643[_0x6539('0x3')],'app':_0x6539('0x4'),'appdata':_0x6539('0xa'),'context':_0x1bc643['context'],'exten':_0x1bc643[_0x6539('0x6')],'priority':_0x1fcac2++,'VoiceExtensionId':_0x1bc643['id']},{'type':_0x1bc643[_0x6539('0x3')],'app':_0x6539('0x4'),'appdata':_0x6539('0xb'),'context':_0x1bc643[_0x6539('0x5')],'exten':_0x1bc643['exten'],'priority':_0x1fcac2++,'VoiceExtensionId':_0x1bc643['id']});return _0x5df06e;}function _0x139c62(_0x1a4cca){var _0x3609e5=0x2;var _0x13fae1=[{'type':_0x6539('0xc'),'app':'Set','appdata':_0x6539('0xd'),'context':_0x1a4cca[_0x6539('0x5')],'exten':_0x1a4cca['exten'],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']},{'type':_0x6539('0xc'),'app':_0x6539('0x4'),'appdata':_0x6539('0xe')+(_0x1a4cca['cutdigits']?'${EXTEN:'+_0x1a4cca[_0x6539('0xf')]+'}':'${EXTEN}'),'context':_0x1a4cca[_0x6539('0x5')],'exten':_0x1a4cca[_0x6539('0x6')],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']},{'type':_0x6539('0xc'),'app':_0x6539('0x4'),'appdata':_0x6539('0x10')+_0x1a4cca['id'],'context':_0x1a4cca[_0x6539('0x5')],'exten':_0x1a4cca[_0x6539('0x6')],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']},{'type':_0x6539('0xc'),'app':_0x6539('0x11'),'appdata':_0x6539('0x12')+(_0x3609e5+0x2)+'):Goto('+(_0x3609e5+0x1)+')','context':_0x1a4cca[_0x6539('0x5')],'exten':_0x1a4cca[_0x6539('0x6')],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']},{'type':_0x6539('0xc'),'app':_0x6539('0x4'),'appdata':_0x1a4cca['cutdigits']?_0x6539('0x13')+_0x1a4cca['cutdigits']+'}':_0x6539('0x14'),'context':_0x1a4cca['context'],'exten':_0x1a4cca[_0x6539('0x6')],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']},{'type':_0x6539('0xc'),'app':_0x6539('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1a4cca[_0x6539('0x5')],'exten':_0x1a4cca[_0x6539('0x6')],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']},{'type':_0x6539('0xc'),'app':'Set','appdata':_0x6539('0xa'),'context':_0x1a4cca[_0x6539('0x5')],'exten':_0x1a4cca['exten'],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']},{'type':_0x6539('0xc'),'app':_0x6539('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1a4cca['context'],'exten':_0x1a4cca['exten'],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']},{'type':_0x6539('0xc'),'app':_0x6539('0x4'),'appdata':_0x6539('0x15')+_0x1a4cca['id'],'context':_0x1a4cca['context'],'exten':_0x1a4cca['exten'],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']}];if(_0x1a4cca['hasOwnProperty']('recordingFormat')&&_0x1a4cca[_0x6539('0x16')]!==_0x6539('0x17')){_0x13fae1[_0x6539('0x7')]({'type':_0x6539('0xc'),'app':_0x6539('0x4'),'appdata':_0x6539('0x18'),'context':_0x1a4cca[_0x6539('0x5')],'exten':_0x1a4cca[_0x6539('0x6')],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']},{'type':'outbound','app':_0x6539('0x4'),'appdata':_0x6539('0x19')+_0x1a4cca['recordingFormat']||_0x6539('0x1a'),'context':_0x1a4cca[_0x6539('0x5')],'exten':_0x1a4cca['exten'],'priority':_0x3609e5++,'VoiceExtensionId':_0x1a4cca['id']});}return _0x13fae1;}function _0xcdccbc(_0x2409c8,_0x16d2b6){var _0x6cd385=[{'name':_0x6539('0x1b'),'param':0x0},{'name':_0x6539('0x1c'),'param':0x1},{'name':_0x6539('0x1d'),'param':0x2},{'name':_0x6539('0x1e'),'param':0x3}];var _0x5cdcf4={};var _0x15f6b8=_0x16d2b6[_0x6539('0x1f')](',');var _0xc5c137=[];for(var _0x64bc4=0x0;_0x64bc4<_0x6cd385[_0x6539('0x20')];_0x64bc4++){switch(_0x6cd385[_0x64bc4][_0x6539('0x21')]){case'trunk':_0x5cdcf4['trunk']=_0x15f6b8[_0x6cd385[_0x64bc4]['param']][_0x6539('0x1f')]('/')[0x1];_0x5cdcf4[_0x6539('0x22')]=_0x15f6b8[_0x6cd385[_0x64bc4][_0x6539('0x23')]]['split']('/')[0x2];_0x5cdcf4['prefix']=_0x5cdcf4['phone']?_0x5cdcf4['phone'][_0x6539('0x1f')]('$')[0x0]:undefined;_0x5cdcf4[_0x6539('0x22')]=_0x2409c8['cutdigits']?(_0x5cdcf4['prefix']||'')+_0x6539('0x24')+_0x2409c8[_0x6539('0xf')]+'}':(_0x5cdcf4[_0x6539('0x25')]||'')+'${EXTEN}';_0xc5c137[_0x6cd385[_0x64bc4][_0x6539('0x23')]]=['SIP',_0x5cdcf4[_0x6539('0x1b')],_0x5cdcf4[_0x6539('0x22')]][_0x6539('0x26')]('/');break;case _0x6539('0x1d'):_0x5cdcf4[_0x6539('0x1d')]=_0x15f6b8[_0x6cd385[_0x64bc4][_0x6539('0x23')]];if(_0x2409c8[_0x6539('0x16')]!==_0x6539('0x17')){if(_0x5cdcf4[_0x6539('0x1d')][_0x6539('0x27')](_0x6539('0x28'))<0x0){_0x5cdcf4[_0x6539('0x1d')]+='U(xcally-mixmonitor-context)';}}else{_0x5cdcf4['options']=_0x5cdcf4[_0x6539('0x1d')][_0x6539('0x29')]('U(xcally-mixmonitor-context)','');}_0xc5c137[_0x6cd385[_0x64bc4]['param']]=_0x5cdcf4[_0x6539('0x1d')];break;default:_0xc5c137[_0x6cd385[_0x64bc4]['param']]=_0x15f6b8[_0x6cd385[_0x64bc4][_0x6539('0x23')]];}}return _0xc5c137['join'](',');}function _0x36dd34(_0xf8ed64,_0x1cd801,_0x161bfe){return new Promise(function(_0x1ac950,_0x1db649){var _0x54f804=[];if(_[_0x6539('0x2a')](_0x1cd801))return _0x1ac950(_0x54f804);_0x4fa948[_0x6539('0x2b')][_0x6539('0x2c')]({'attributes':['id',_0x6539('0x2d'),_0x6539('0x2e')],'raw':!![]})[_0x6539('0x2f')](function(_0x1586be){for(var _0x181d9b=0x0,_0x566db5=0x0;_0x181d9b<_0x1cd801[_0x6539('0x20')];_0x181d9b++,_0x566db5=0x0){var _0x52b83b=_0x1cd801[_0x181d9b];var _0x12227a=[];var _0x3e6435=[];delete _0x52b83b['id'];if(_0x52b83b[_0x6539('0x2d')]!==_0x6539('0x30')){_0x52b83b[_0x6539('0x31')]=[_0x52b83b[_0x6539('0x2d')]];}else{_0x52b83b[_0x6539('0x31')]=_0x52b83b[_0x6539('0x2e')]?_[_0x6539('0x32')](_[_0x6539('0x33')](_0x1586be,{'IntervalId':_0x52b83b[_0x6539('0x2e')]}),_0x6539('0x2d')):[];}_0x52b83b['context']=_0xf8ed64[_0x6539('0x5')];_0x52b83b[_0x6539('0x6')]=_0xf8ed64[_0x6539('0x6')];if(_0x52b83b['type'])_0x52b83b[_0x6539('0x3')]=_0x52b83b[_0x6539('0x3')]['toLowerCase']();if(_0xf8ed64[_0x6539('0x3')]===_0x6539('0xc')){if(_0x52b83b[_0x6539('0x34')]('tag')&&_0x52b83b['tag']&&_0x52b83b[_0x6539('0x35')]!=='--'){_0x12227a[_0x6539('0x7')]({'type':_0x52b83b['type'][_0x6539('0x36')](),'app':'Set','appdata':_0x6539('0x37')+_0x52b83b[_0x6539('0x35')],'context':_0xf8ed64['context'],'exten':_0xf8ed64['exten'],'priority':_0x52b83b[_0x6539('0x31')]['length']+_0x161bfe+_0x566db5++,'VoiceExtensionId':_0xf8ed64['id']});}_0x12227a[_0x6539('0x7')]({'type':_0x52b83b[_0x6539('0x3')][_0x6539('0x36')](),'app':_0x6539('0x11'),'appdata':_0x6539('0x38')+(_0x52b83b[_0x6539('0x39')]?'Set(CALLERID(all)='+_0x52b83b[_0x6539('0x39')]+')':_0x6539('0x3a')),'context':_0xf8ed64[_0x6539('0x5')],'exten':_0xf8ed64['exten'],'priority':_0x52b83b['intervals']['length']+_0x161bfe+_0x566db5++,'VoiceExtensionId':_0xf8ed64['id']});}else{if(_0x52b83b['hasOwnProperty']('answer')){if([_0x6539('0x3b'),'playback'][_0x6539('0x3c')](_0x52b83b[_0x6539('0x3d')][_0x6539('0x36')]())&&_0x52b83b[_0x6539('0x3e')]!==_0x6539('0x3f')){if(_0x52b83b[_0x6539('0x40')]){_0x12227a[_0x6539('0x7')]({'type':_0x52b83b[_0x6539('0x3')]['toLowerCase'](),'app':_0x6539('0x11'),'appdata':_0x6539('0x41'),'context':_0xf8ed64[_0x6539('0x5')],'exten':_0xf8ed64[_0x6539('0x6')],'priority':_0x52b83b[_0x6539('0x31')][_0x6539('0x20')]+_0x161bfe+_0x566db5++,'VoiceExtensionId':_0xf8ed64['id']});_0x12227a['push']({'type':_0x52b83b[_0x6539('0x3')][_0x6539('0x36')](),'app':_0x6539('0x4'),'appdata':_0x6539('0x42'),'context':_0xf8ed64[_0x6539('0x5')],'exten':_0xf8ed64[_0x6539('0x6')],'priority':_0x52b83b[_0x6539('0x31')]['length']+_0x161bfe+_0x566db5++,'VoiceExtensionId':_0xf8ed64['id']});}else{_0x12227a[_0x6539('0x7')]({'type':_0x52b83b[_0x6539('0x3')]['toLowerCase'](),'app':_0x6539('0x11'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xf8ed64['context'],'exten':_0xf8ed64[_0x6539('0x6')],'priority':_0x52b83b[_0x6539('0x31')][_0x6539('0x20')]+_0x161bfe+_0x566db5++,'VoiceExtensionId':_0xf8ed64['id']});_0x12227a[_0x6539('0x7')]({'type':_0x52b83b[_0x6539('0x3')][_0x6539('0x36')](),'app':_0x6539('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0xf8ed64[_0x6539('0x5')],'exten':_0xf8ed64[_0x6539('0x6')],'priority':_0x52b83b[_0x6539('0x31')][_0x6539('0x20')]+_0x161bfe+_0x566db5++,'VoiceExtensionId':_0xf8ed64['id']});}}}}for(var _0x268020=0x0;_0x268020<_0x52b83b[_0x6539('0x31')]['length'];_0x268020++){var _0x29f94d=_0x161bfe+_0x52b83b['intervals']['length'];var _0x2d9fd5=_0x268020===_0x52b83b[_0x6539('0x31')][_0x6539('0x20')]-0x1?_0x161bfe+_0x12227a['length']+_0x3e6435[_0x6539('0x20')]+0x2:_0x161bfe+_0x268020+0x1;_0x12227a[_0x6539('0x43')](_0x268020,0x0,{'type':_0xf8ed64[_0x6539('0x3')],'app':'GotoIfTime','appdata':_0x52b83b['intervals'][_0x268020]+'?'+_0xf8ed64[_0x6539('0x5')]+_0x6539('0x44')+_0x29f94d+':'+_0xf8ed64['context']+_0x6539('0x44')+_0x2d9fd5,'exten':_0xf8ed64[_0x6539('0x6')],'context':_0xf8ed64[_0x6539('0x5')],'priority':_0x161bfe+_0x268020,'VoiceExtensionId':_0xf8ed64['id']});}if(_0x52b83b[_0x6539('0x3e')]===_0x6539('0x45')){_0x52b83b[_0x6539('0x46')]=_0xcdccbc(_0xf8ed64,_0x52b83b[_0x6539('0x46')]);}if(_0x52b83b[_0x6539('0x3e')]===_0x6539('0x47')){_0x12227a[_0x6539('0x7')]({'type':_0x52b83b[_0x6539('0x3')]['toLowerCase'](),'app':_0x6539('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0xf8ed64[_0x6539('0x5')],'exten':_0xf8ed64[_0x6539('0x6')],'priority':_0x52b83b[_0x6539('0x31')][_0x6539('0x20')]+_0x161bfe+_0x566db5++,'VoiceExtensionId':_0xf8ed64['id']});}_0x52b83b[_0x6539('0x48')]=_0x12227a[_0x6539('0x20')]?_[_0x6539('0x49')](_0x12227a)[_0x6539('0x48')]+0x1:_0x161bfe;_0x54f804=_[_0x6539('0x4a')](_0x54f804,_0x12227a,[_0x52b83b],_0x3e6435);_0x161bfe=_[_0x6539('0x49')](_0x54f804)[_0x6539('0x48')]+0x1;}return _0x1ac950(_0x54f804);})[_0x6539('0x4b')](function(_0x2706e5){_0x1db649(_0x2706e5);});});}return _0x193002['define'](_0x6539('0x4c'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x17dbc3){var _0x31dbf=this[_0x6539('0x4d')]({'plain':!![]});var _0x354eab=_0x31dbf[_0x6539('0x3')]===_0x6539('0xc')?_0x139c62(_0x31dbf):_0x1cf5e0(_0x31dbf);return _0x36dd34(_0x31dbf,_0x17dbc3,_[_0x6539('0x49')](_0x354eab)[_0x6539('0x48')]+0x1)[_0x6539('0x2f')](function(_0x2a739a){var _0x4650a7=_[_0x6539('0x4a')](_0x354eab,_0x2a739a);_0x4650a7['push']({'type':_0x31dbf[_0x6539('0x3')],'app':_0x6539('0x4e'),'exten':_0x31dbf[_0x6539('0x6')],'context':_0x31dbf[_0x6539('0x5')],'priority':_[_0x6539('0x49')](_0x4650a7)[_0x6539('0x48')]+0x1,'VoiceExtensionId':_0x31dbf['id']});return _0x4650a7;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d13a9bf..2d83b44 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 _0x6bac=['defaults','localhost','./voiceExtension.socket','request','then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceExtension,\x20%s,\x20%s','message','result','GetVoiceExtension','findAll','options','raw','where','attributes','limit','map','include','model','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','redis'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x6bac,0xa5));var _0xc6ba=function(_0x275b0c,_0x36c43d){_0x275b0c=_0x275b0c-0x0;var _0x327812=_0x6bac[_0x275b0c];return _0x327812;};'use strict';var _=require(_0xc6ba('0x0'));var util=require('util');var moment=require(_0xc6ba('0x1'));var BPromise=require(_0xc6ba('0x2'));var rs=require(_0xc6ba('0x3'));var fs=require('fs');var Redis=require(_0xc6ba('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc6ba('0x5'));var config=require(_0xc6ba('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc6ba('0x7')][_0xc6ba('0x8')]({'port':0x232a});config[_0xc6ba('0x9')]=_[_0xc6ba('0xa')](config[_0xc6ba('0x9')],{'host':_0xc6ba('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc6ba('0xc'))['register'](socket);function respondWithRpcPromise(_0x508603,_0x4b62bd,_0x530397){return new BPromise(function(_0x58adfc,_0x45d797){return client[_0xc6ba('0xd')](_0x508603,_0x530397)[_0xc6ba('0xe')](function(_0x43dac8){logger[_0xc6ba('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x4b62bd,'request\x20sent');logger[_0xc6ba('0x10')](_0xc6ba('0x11'),_0x4b62bd,_0xc6ba('0x12'),JSON[_0xc6ba('0x13')](_0x43dac8));if(_0x43dac8[_0xc6ba('0x14')]){if(_0x43dac8['error']['code']===0x1f4){logger['error'](_0xc6ba('0x15'),_0x4b62bd,_0x43dac8[_0xc6ba('0x14')][_0xc6ba('0x16')]);return _0x45d797(_0x43dac8[_0xc6ba('0x14')][_0xc6ba('0x16')]);}logger[_0xc6ba('0x14')](_0xc6ba('0x15'),_0x4b62bd,_0x43dac8[_0xc6ba('0x14')]['message']);return _0x58adfc(_0x43dac8['error']['message']);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x4b62bd,'request\x20sent');_0x58adfc(_0x43dac8[_0xc6ba('0x17')][_0xc6ba('0x16')]);}})['catch'](function(_0x485086){logger[_0xc6ba('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x4b62bd,_0x485086);_0x45d797(_0x485086);});});}exports[_0xc6ba('0x18')]=function(_0x2b2a0f){var _0x560c40=this;return new Promise(function(_0x3936e2,_0x362f68){return db['VoiceExtension'][_0xc6ba('0x19')]({'raw':_0x2b2a0f[_0xc6ba('0x1a')]?_0x2b2a0f[_0xc6ba('0x1a')][_0xc6ba('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b2a0f[_0xc6ba('0x1a')]?_0x2b2a0f[_0xc6ba('0x1a')][_0xc6ba('0x1c')]||null:null,'attributes':_0x2b2a0f[_0xc6ba('0x1a')]?_0x2b2a0f[_0xc6ba('0x1a')][_0xc6ba('0x1d')]||null:null,'limit':_0x2b2a0f[_0xc6ba('0x1a')]?_0x2b2a0f[_0xc6ba('0x1a')][_0xc6ba('0x1e')]||null:null,'include':_0x2b2a0f[_0xc6ba('0x1a')]?_0x2b2a0f[_0xc6ba('0x1a')]['include']?_[_0xc6ba('0x1f')](_0x2b2a0f[_0xc6ba('0x1a')][_0xc6ba('0x20')],function(_0xcfb503){return{'model':db[_0xcfb503[_0xc6ba('0x21')]],'as':_0xcfb503['as'],'attributes':_0xcfb503[_0xc6ba('0x1d')],'include':_0xcfb503['include']?_[_0xc6ba('0x1f')](_0xcfb503[_0xc6ba('0x20')],function(_0x5ad498){return{'model':db[_0x5ad498[_0xc6ba('0x21')]],'as':_0x5ad498['as'],'attributes':_0x5ad498[_0xc6ba('0x1d')],'include':_0x5ad498['include']?_[_0xc6ba('0x1f')](_0x5ad498['include'],function(_0x3fea76){return{'model':db[_0x3fea76[_0xc6ba('0x21')]],'as':_0x3fea76['as'],'attributes':_0x3fea76[_0xc6ba('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc6ba('0xe')](function(_0x5ac5dd){logger['info'](_0xc6ba('0x18'),_0x2b2a0f);logger['debug'](_0xc6ba('0x18'),_0x2b2a0f,JSON['stringify'](_0x5ac5dd));_0x3936e2(_0x5ac5dd);})[_0xc6ba('0x22')](function(_0x1181ca){logger['error'](_0xc6ba('0x18'),_0x1181ca[_0xc6ba('0x16')],_0x2b2a0f);_0x362f68(_0x560c40[_0xc6ba('0x14')](0x1f4,_0x1181ca[_0xc6ba('0x16')]));});});}; \ No newline at end of file +var _0xbac8=['../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','GetVoiceExtension','stringify','lodash','util','randomstring','ioredis'];(function(_0x184d62,_0x2520b1){var _0x179678=function(_0xb50d8a){while(--_0xb50d8a){_0x184d62['push'](_0x184d62['shift']());}};_0x179678(++_0x2520b1);}(_0xbac8,0x140));var _0x8bac=function(_0x15064d,_0x34da2b){_0x15064d=_0x15064d-0x0;var _0x23fb34=_0xbac8[_0x15064d];return _0x23fb34;};'use strict';var _=require(_0x8bac('0x0'));var util=require(_0x8bac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8bac('0x2'));var fs=require('fs');var Redis=require(_0x8bac('0x3'));var db=require(_0x8bac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bac('0x5'))(_0x8bac('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8bac('0x7')][_0x8bac('0x8')]({'port':0x232a});config[_0x8bac('0x9')]=_[_0x8bac('0xa')](config[_0x8bac('0x9')],{'host':_0x8bac('0xb'),'port':0x18eb});var socket=require(_0x8bac('0xc'))(new Redis(config[_0x8bac('0x9')]));require(_0x8bac('0xd'))['register'](socket);function respondWithRpcPromise(_0x11596d,_0x39b869,_0x16ebdb){return new BPromise(function(_0x4d1a27,_0x31e977){return client['request'](_0x11596d,_0x16ebdb)[_0x8bac('0xe')](function(_0x4620a2){logger['info'](_0x8bac('0xf'),_0x39b869,_0x8bac('0x10'));logger[_0x8bac('0x11')](_0x8bac('0x12'),_0x39b869,_0x8bac('0x10'),JSON['stringify'](_0x4620a2));if(_0x4620a2['error']){if(_0x4620a2[_0x8bac('0x13')][_0x8bac('0x14')]===0x1f4){logger['error'](_0x8bac('0xf'),_0x39b869,_0x4620a2['error']['message']);return _0x31e977(_0x4620a2[_0x8bac('0x13')][_0x8bac('0x15')]);}logger[_0x8bac('0x13')](_0x8bac('0xf'),_0x39b869,_0x4620a2[_0x8bac('0x13')][_0x8bac('0x15')]);return _0x4d1a27(_0x4620a2['error']['message']);}else{logger[_0x8bac('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x39b869,'request\x20sent');_0x4d1a27(_0x4620a2[_0x8bac('0x17')][_0x8bac('0x15')]);}})[_0x8bac('0x18')](function(_0x362ec8){logger[_0x8bac('0x13')](_0x8bac('0xf'),_0x39b869,_0x362ec8);_0x31e977(_0x362ec8);});});}exports['GetVoiceExtension']=function(_0x21c13){var _0x24dbea=this;return new Promise(function(_0x26c7b5,_0x193ac5){return db[_0x8bac('0x19')][_0x8bac('0x1a')]({'raw':_0x21c13[_0x8bac('0x1b')]?_0x21c13[_0x8bac('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x21c13[_0x8bac('0x1b')]?_0x21c13['options'][_0x8bac('0x1c')]||null:null,'attributes':_0x21c13[_0x8bac('0x1b')]?_0x21c13[_0x8bac('0x1b')][_0x8bac('0x1d')]||null:null,'limit':_0x21c13['options']?_0x21c13[_0x8bac('0x1b')][_0x8bac('0x1e')]||null:null,'include':_0x21c13[_0x8bac('0x1b')]?_0x21c13['options'][_0x8bac('0x1f')]?_[_0x8bac('0x20')](_0x21c13[_0x8bac('0x1b')]['include'],function(_0x5a5e64){return{'model':db[_0x5a5e64['model']],'as':_0x5a5e64['as'],'attributes':_0x5a5e64[_0x8bac('0x1d')],'include':_0x5a5e64[_0x8bac('0x1f')]?_[_0x8bac('0x20')](_0x5a5e64[_0x8bac('0x1f')],function(_0x3a002d){return{'model':db[_0x3a002d[_0x8bac('0x21')]],'as':_0x3a002d['as'],'attributes':_0x3a002d['attributes'],'include':_0x3a002d[_0x8bac('0x1f')]?_[_0x8bac('0x20')](_0x3a002d['include'],function(_0x3c9fd3){return{'model':db[_0x3c9fd3[_0x8bac('0x21')]],'as':_0x3c9fd3['as'],'attributes':_0x3c9fd3[_0x8bac('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc94572){logger[_0x8bac('0x16')](_0x8bac('0x22'),_0x21c13);logger[_0x8bac('0x11')]('GetVoiceExtension',_0x21c13,JSON[_0x8bac('0x23')](_0xc94572));_0x26c7b5(_0xc94572);})[_0x8bac('0x18')](function(_0x5795d1){logger['error'](_0x8bac('0x22'),_0x5795d1['message'],_0x21c13);_0x193ac5(_0x24dbea['error'](0x1f4,_0x5795d1[_0x8bac('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ee50198..edcdcce 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x30c3b8,_0x533aa7){var _0x13354b=function(_0x445b9e){while(--_0x445b9e){_0x30c3b8['push'](_0x30c3b8['shift']());}};_0x13354b(++_0x533aa7);}(_0x53ec,0x192));var _0xc53e=function(_0x4a1315,_0x58b7d5){_0x4a1315=_0x4a1315-0x0;var _0x16125a=_0x53ec[_0x4a1315];return _0x16125a;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x3740eb,_0x54a269){var _0x54742c=function(_0x25770b){while(--_0x25770b){_0x3740eb['push'](_0x3740eb['shift']());}};_0x54742c(++_0x54a269);}(_0x326f,0xd1));var _0xf326=function(_0xd380c9,_0x57c37b){_0xd380c9=_0xd380c9-0x0;var _0x5339a2=_0x326f[_0xd380c9];return _0x5339a2;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index cf31472..b8dd985 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 _0x3e24=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','create','destroy','exports','multer'];(function(_0x4c060b,_0x4c5e75){var _0x5b9790=function(_0x32e525){while(--_0x32e525){_0x4c060b['push'](_0x4c060b['shift']());}};_0x5b9790(++_0x4c5e75);}(_0x3e24,0x167));var _0x43e2=function(_0xddf2eb,_0x4bc8ab){_0xddf2eb=_0xddf2eb-0x0;var _0x39948f=_0x3e24[_0xddf2eb];return _0x39948f;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require(_0x43e2('0x3'));var express=require(_0x43e2('0x4'));var router=express['Router']();var fs_extra=require(_0x43e2('0x5'));var auth=require(_0x43e2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x43e2('0x7'));var controller=require(_0x43e2('0x8'));router[_0x43e2('0x9')]('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0xb')]);router[_0x43e2('0x9')](_0x43e2('0xc'),auth['isAuthenticated'](),controller[_0x43e2('0xd')]);router[_0x43e2('0x9')]('/:id/messages',auth[_0x43e2('0xa')](),controller[_0x43e2('0xe')]);router['post']('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0xf')]);router['put'](_0x43e2('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x43e2('0xc'),auth[_0x43e2('0xa')](),controller[_0x43e2('0x10')]);module[_0x43e2('0x11')]=router; \ No newline at end of file +var _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','show','/:id/messages','isAuthenticated','getMessages','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x3286b0,_0x26bc2d){var _0x4bf209=function(_0x4b61a3){while(--_0x4b61a3){_0x3286b0['push'](_0x3286b0['shift']());}};_0x4bf209(++_0x26bc2d);}(_0x524e,0x15e));var _0xe524=function(_0xb6fe22,_0x4f69ab){_0xb6fe22=_0xb6fe22-0x0;var _0x210b59=_0x524e[_0xb6fe22];return _0x210b59;};'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('0xb'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xb'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 45d5248..406a1c4 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 _0x322c=['exports','STRING','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','fullname','\x20-\x20','getDataValue','sequelize'];(function(_0x325611,_0x152c92){var _0xbfbed1=function(_0x877d3b){while(--_0x877d3b){_0x325611['push'](_0x325611['shift']());}};_0xbfbed1(++_0x152c92);}(_0x322c,0x1af));var _0xc322=function(_0x4ac378,_0x26b39d){_0x4ac378=_0x4ac378-0x0;var _0x17f863=_0x322c[_0x4ac378];return _0x17f863;};'use strict';var Sequelize=require(_0xc322('0x0'));module[_0xc322('0x1')]={'customer_id':{'type':Sequelize[_0xc322('0x2')]},'context':{'type':Sequelize[_0xc322('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xc322('0x2')],'defaultValue':'','allowNull':![],'unique':_0xc322('0x3')},'password':{'type':Sequelize[_0xc322('0x2')]},'fullname':{'type':Sequelize[_0xc322('0x2')]},'email':{'type':Sequelize[_0xc322('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1edfee){this[_0xc322('0x4')](_0xc322('0x5'),typeof _0x1edfee==='string'&&_0x1edfee[_0xc322('0x6')]()?_0x1edfee[_0xc322('0x6')]():null);}},'pager':{'type':Sequelize[_0xc322('0x2')]},'tz':{'type':Sequelize[_0xc322('0x2')],'defaultValue':_0xc322('0x7')},'attach':{'type':Sequelize[_0xc322('0x8')]('yes','no'),'defaultValue':_0xc322('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc322('0x8')](_0xc322('0x9'),'no'),'defaultValue':_0xc322('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc322('0x2')]},'callback':{'type':Sequelize[_0xc322('0x2')]},'review':{'type':Sequelize[_0xc322('0x8')](_0xc322('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc322('0x8')](_0xc322('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc322('0x8')](_0xc322('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc322('0x8')](_0xc322('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc322('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xc322('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc322('0x8')](_0xc322('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xc322('0x9'),'no'),'defaultValue':_0xc322('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc322('0x8')](_0xc322('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc322('0x8')](_0xc322('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xc322('0x8')](_0xc322('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xc322('0xb')},'emailsubject':{'type':Sequelize[_0xc322('0x2')]},'emailbody':{'type':Sequelize[_0xc322('0x2')]},'maxsecs':{'type':Sequelize[_0xc322('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc322('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xc322('0xd'))+_0xc322('0xe')+this[_0xc322('0xf')]('mailbox');}}}; \ No newline at end of file +var _0xead3=['TIMESTAMP','INTEGER','getDataValue','\x20-\x20','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x14197e,_0x53a22a){var _0xe12c1=function(_0x5070f6){while(--_0x5070f6){_0x14197e['push'](_0x14197e['shift']());}};_0xe12c1(++_0x53a22a);}(_0xead3,0x1e4));var _0x3ead=function(_0x446832,_0x12964a){_0x446832=_0x446832-0x0;var _0x2002bd=_0xead3[_0x446832];return _0x2002bd;};'use strict';var Sequelize=require('sequelize');module[_0x3ead('0x0')]={'customer_id':{'type':Sequelize[_0x3ead('0x1')]},'context':{'type':Sequelize[_0x3ead('0x1')],'defaultValue':_0x3ead('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3ead('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3ead('0x3')},'password':{'type':Sequelize[_0x3ead('0x1')]},'fullname':{'type':Sequelize[_0x3ead('0x1')]},'email':{'type':Sequelize[_0x3ead('0x1')],'validate':{'isEmail':!![]},'set':function(_0x10b264){this[_0x3ead('0x4')](_0x3ead('0x5'),typeof _0x10b264===_0x3ead('0x6')&&_0x10b264['trim']()?_0x10b264[_0x3ead('0x7')]():null);}},'pager':{'type':Sequelize[_0x3ead('0x1')]},'tz':{'type':Sequelize[_0x3ead('0x1')],'defaultValue':_0x3ead('0x8')},'attach':{'type':Sequelize[_0x3ead('0x9')](_0x3ead('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x3ead('0x9')](_0x3ead('0xa'),'no'),'defaultValue':_0x3ead('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x3ead('0x1')]},'review':{'type':Sequelize[_0x3ead('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3ead('0x9')](_0x3ead('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3ead('0x9')](_0x3ead('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3ead('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3ead('0x9')](_0x3ead('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3ead('0x9')](_0x3ead('0xa'),'no'),'defaultValue':_0x3ead('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3ead('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x3ead('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3ead('0x9')](_0x3ead('0xa'),'no'),'defaultValue':_0x3ead('0xa'),'allowNull':![]},'stamp':{'type':_0x3ead('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x3ead('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3ead('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3ead('0xe')]('fullname')+_0x3ead('0xf')+this[_0x3ead('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 3c41f7a..b4dc916 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 _0xea28=['undefined','limit','count','reject','update','then','get','Voicemails','sendStatus','stack','name','send','index','map','VoiceMail','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','getMessages','VoiceMailMessage','rawAttributes','order','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x14a2ed,_0xbc4169){var _0x44f258=function(_0x38a7c2){while(--_0x38a7c2){_0x14a2ed['push'](_0x14a2ed['shift']());}};_0x44f258(++_0xbc4169);}(_0xea28,0x13a));var _0x8ea2=function(_0x28b36b,_0x18ecc8){_0x28b36b=_0x28b36b-0x0;var _0x2c8f25=_0xea28[_0x28b36b];return _0x2c8f25;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['VoiceMail']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))[_0x8ea2('0x42')](handleError(_0x58674d,null));};exports[_0x8ea2('0x51')]=function(_0x3836c3,_0x36fda3,_0x5265e7){return db['VoiceMail']['findOne']({'where':{'id':_0x3836c3[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x36fda3,null))[_0x8ea2('0x23')](function(_0x2bbec0){var _0x57720d;var _0x11824e={},_0x2b8662={};_0x2b8662['model']=_[_0x8ea2('0x31')](db[_0x8ea2('0x52')][_0x8ea2('0x53')]);_0x2b8662[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x3836c3['query']);_0x2b8662['filters']=_['intersection'](_0x2b8662[_0x8ea2('0x2f')],_0x2b8662[_0x8ea2('0x30')]);_0x11824e[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x2b8662[_0x8ea2('0x2f')],qs['fields'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x11824e[_0x8ea2('0x32')]=_0x11824e[_0x8ea2('0x32')]['length']?_0x11824e[_0x8ea2('0x32')]:_0x2b8662['model'];if(!_0x3836c3[_0x8ea2('0x30')]['hasOwnProperty'](_0x8ea2('0x36'))){_0x11824e[_0x8ea2('0x1f')]=qs['limit'](_0x3836c3['query'][_0x8ea2('0x1f')]);_0x11824e['offset']=qs[_0x8ea2('0x1d')](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x11824e[_0x8ea2('0x54')]=qs['sort'](_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x37')]);_0x11824e[_0x8ea2('0x38')]=qs[_0x8ea2('0x3a')](_[_0x8ea2('0x39')](_0x3836c3[_0x8ea2('0x30')],_0x2b8662[_0x8ea2('0x3a')]));if(_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'$or':_['map'](_0x11824e[_0x8ea2('0x32')],function(_0x2d130a){var _0x4de6ba={};_0x4de6ba[_0x2d130a]={'$like':'%'+_0x3836c3[_0x8ea2('0x30')][_0x8ea2('0x3b')]+'%'};return _0x4de6ba;})});}_0x11824e[_0x8ea2('0x38')]=_[_0x8ea2('0x3c')](_0x11824e[_0x8ea2('0x38')],{'mailboxuser':_0x2bbec0[_0x8ea2('0x55')]});_0x11824e=_[_0x8ea2('0x3c')]({},_0x11824e,_0x3836c3[_0x8ea2('0x3f')]);return db[_0x8ea2('0x52')]['findAndCountAll'](_0x11824e)[_0x8ea2('0x23')](respondWithFilteredResult(_0x36fda3,_0x11824e));})[_0x8ea2('0x42')](handleError(_0x36fda3,null));}; \ No newline at end of file +var _0xf290=['UserProfileResource','error','stack','name','send','map','key','keys','query','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','type','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getMessages','VoiceMailMessage','hasOwnProperty','nolimit','order','pick','mailbox','findAndCountAll','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','Voicemails'];(function(_0x3d75da,_0x372212){var _0x1bd83f=function(_0x3908dd){while(--_0x3908dd){_0x3d75da['push'](_0x3d75da['shift']());}};_0x1bd83f(++_0x372212);}(_0xf290,0xde));var _0x0f29=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xf290[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f29('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f29('0x1'));var rp=require('request-promise');var moment=require(_0x0f29('0x2'));var BPromise=require(_0x0f29('0x3'));var Mustache=require(_0x0f29('0x4'));var util=require(_0x0f29('0x5'));var path=require(_0x0f29('0x6'));var sox=require('sox');var csv=require(_0x0f29('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f29('0x8'));var _=require(_0x0f29('0x9'));var squel=require(_0x0f29('0xa'));var crypto=require(_0x0f29('0xb'));var jsforce=require(_0x0f29('0xc'));var deskjs=require(_0x0f29('0xd'));var toCsv=require(_0x0f29('0x7'));var querystring=require(_0x0f29('0xe'));var Papa=require(_0x0f29('0xf'));var Redis=require(_0x0f29('0x10'));var authService=require(_0x0f29('0x11'));var qs=require(_0x0f29('0x12'));var as=require(_0x0f29('0x13'));var hardwareService=require(_0x0f29('0x14'));var logger=require(_0x0f29('0x15'))('api');var utils=require(_0x0f29('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0f29('0x17'));var db=require(_0x0f29('0x18'))['db'];function respondWithStatusCode(_0x26bbec,_0x222c42){_0x222c42=_0x222c42||0xcc;return function(_0x195424){if(_0x195424){return _0x26bbec[_0x0f29('0x19')](_0x222c42);}return _0x26bbec['status'](_0x222c42)[_0x0f29('0x1a')]();};}function respondWithResult(_0x39961f,_0x2bb7b8){_0x2bb7b8=_0x2bb7b8||0xc8;return function(_0x368984){if(_0x368984){return _0x39961f[_0x0f29('0x1b')](_0x2bb7b8)[_0x0f29('0x1c')](_0x368984);}};}function respondWithFilteredResult(_0x1c518,_0x69df36){return function(_0x547404){if(_0x547404){var _0x4ac37d=typeof _0x69df36[_0x0f29('0x1d')]===_0x0f29('0x1e')&&typeof _0x69df36[_0x0f29('0x1f')]===_0x0f29('0x1e');var _0x4b3f0b=_0x547404[_0x0f29('0x20')];var _0x5d72a5=_0x4ac37d?0x0:_0x69df36[_0x0f29('0x1d')];var _0x4ca5e8=_0x4ac37d?_0x547404['count']:_0x69df36['offset']+_0x69df36[_0x0f29('0x1f')];var _0x8fc03f;if(_0x4ca5e8>=_0x4b3f0b){_0x4ca5e8=_0x4b3f0b;_0x8fc03f=0xc8;}else{_0x8fc03f=0xce;}_0x1c518[_0x0f29('0x1b')](_0x8fc03f);return _0x1c518[_0x0f29('0x21')](_0x0f29('0x22'),_0x5d72a5+'-'+_0x4ca5e8+'/'+_0x4b3f0b)[_0x0f29('0x1c')](_0x547404);}return null;};}function patchUpdates(_0x150271){return function(_0x4888b6){try{jsonpatch[_0x0f29('0x23')](_0x4888b6,_0x150271,!![]);}catch(_0x5a5a03){return BPromise['reject'](_0x5a5a03);}return _0x4888b6['save']();};}function saveUpdates(_0x5d94b9,_0x38a1ce){return function(_0x4a9dd8){if(_0x4a9dd8){return _0x4a9dd8['update'](_0x5d94b9)[_0x0f29('0x24')](function(_0x1840e0){return _0x1840e0;});}return null;};}function removeEntity(_0x346db8,_0x3402dc){return function(_0x29ca73){if(_0x29ca73){return _0x29ca73['destroy']()[_0x0f29('0x24')](function(){var _0x5a440f=_0x29ca73[_0x0f29('0x25')]({'plain':!![]});var _0x26f46f=_0x0f29('0x26');return db[_0x0f29('0x27')]['destroy']({'where':{'type':_0x26f46f,'resourceId':_0x5a440f['id']}})[_0x0f29('0x24')](function(){return _0x29ca73;});})['then'](function(){_0x346db8['status'](0xcc)[_0x0f29('0x1a')]();});}};}function handleEntityNotFound(_0x5c0202,_0x5bfcac){return function(_0x57dcc7){if(!_0x57dcc7){_0x5c0202['sendStatus'](0x194);}return _0x57dcc7;};}function handleError(_0x3c6ce9,_0x1f4ad2){_0x1f4ad2=_0x1f4ad2||0x1f4;return function(_0x4cc5a0){logger[_0x0f29('0x28')](_0x4cc5a0[_0x0f29('0x29')]);if(_0x4cc5a0[_0x0f29('0x2a')]){delete _0x4cc5a0['name'];}_0x3c6ce9['status'](_0x1f4ad2)[_0x0f29('0x2b')](_0x4cc5a0);};}exports['index']=function(_0x36b65c,_0x561c31){var _0x526364={},_0x7b10f={},_0x409b19={'count':0x0,'rows':[]};var _0xf59431=_[_0x0f29('0x2c')](db['VoiceMail']['rawAttributes'],function(_0x3bb3c8){return{'name':_0x3bb3c8['fieldName'],'type':_0x3bb3c8['type'][_0x0f29('0x2d')]};});_0x7b10f['model']=_[_0x0f29('0x2c')](_0xf59431,'name');_0x7b10f['query']=_[_0x0f29('0x2e')](_0x36b65c[_0x0f29('0x2f')]);_0x7b10f[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x7b10f[_0x0f29('0x32')],_0x7b10f['query']);_0x526364[_0x0f29('0x33')]=_['intersection'](_0x7b10f[_0x0f29('0x32')],qs[_0x0f29('0x34')](_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x34')]));_0x526364['attributes']=_0x526364[_0x0f29('0x33')][_0x0f29('0x35')]?_0x526364['attributes']:_0x7b10f[_0x0f29('0x32')];if(!_0x36b65c[_0x0f29('0x2f')]['hasOwnProperty']('nolimit')){_0x526364[_0x0f29('0x1f')]=qs[_0x0f29('0x1f')](_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x1f')]);_0x526364[_0x0f29('0x1d')]=qs[_0x0f29('0x1d')](_0x36b65c['query'][_0x0f29('0x1d')]);}_0x526364['order']=qs[_0x0f29('0x36')](_0x36b65c['query'][_0x0f29('0x36')]);_0x526364[_0x0f29('0x37')]=qs[_0x0f29('0x30')](_['pick'](_0x36b65c['query'],_0x7b10f[_0x0f29('0x30')]),_0xf59431);if(_0x36b65c['query'][_0x0f29('0x38')]){_0x526364[_0x0f29('0x37')]=_[_0x0f29('0x39')](_0x526364[_0x0f29('0x37')],{'$or':_[_0x0f29('0x2c')](_0xf59431,function(_0x5afbb8){if(_0x5afbb8[_0x0f29('0x3a')]!==_0x0f29('0x3b')){var _0x42872b={};_0x42872b[_0x5afbb8[_0x0f29('0x2a')]]={'$like':'%'+_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x38')]+'%'};return _0x42872b;}})});}_0x526364=_[_0x0f29('0x39')]({},_0x526364,_0x36b65c[_0x0f29('0x3c')]);var _0x250b20={'where':_0x526364['where']};return db[_0x0f29('0x3d')][_0x0f29('0x20')](_0x250b20)[_0x0f29('0x24')](function(_0x11b1dc){_0x409b19['count']=_0x11b1dc;if(_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x3e')]){_0x526364[_0x0f29('0x3f')]=[{'all':!![]}];}return db[_0x0f29('0x3d')][_0x0f29('0x40')](_0x526364);})['then'](function(_0x410c59){_0x409b19[_0x0f29('0x41')]=_0x410c59;return _0x409b19;})[_0x0f29('0x24')](respondWithFilteredResult(_0x561c31,_0x526364))['catch'](handleError(_0x561c31,null));};exports[_0x0f29('0x42')]=function(_0x284279,_0x3a6479){var _0x338412={'raw':!![],'where':{'id':_0x284279[_0x0f29('0x43')]['id']}},_0x35f753={};_0x35f753[_0x0f29('0x32')]=_[_0x0f29('0x2e')](db['VoiceMail']['rawAttributes']);_0x35f753['query']=_[_0x0f29('0x2e')](_0x284279[_0x0f29('0x2f')]);_0x35f753[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x35f753[_0x0f29('0x32')],_0x35f753[_0x0f29('0x2f')]);_0x338412['attributes']=_[_0x0f29('0x31')](_0x35f753['model'],qs[_0x0f29('0x34')](_0x284279['query'][_0x0f29('0x34')]));_0x338412[_0x0f29('0x33')]=_0x338412[_0x0f29('0x33')][_0x0f29('0x35')]?_0x338412[_0x0f29('0x33')]:_0x35f753['model'];if(_0x284279[_0x0f29('0x2f')][_0x0f29('0x3e')]){_0x338412[_0x0f29('0x3f')]=[{'all':!![]}];}_0x338412=_['merge']({},_0x338412,_0x284279[_0x0f29('0x3c')]);return db['VoiceMail']['find'](_0x338412)[_0x0f29('0x24')](handleEntityNotFound(_0x3a6479,null))[_0x0f29('0x24')](respondWithResult(_0x3a6479,null))[_0x0f29('0x44')](handleError(_0x3a6479,null));};exports[_0x0f29('0x45')]=function(_0x20aa53,_0x335435){return db['VoiceMail'][_0x0f29('0x45')](_0x20aa53[_0x0f29('0x46')],{})[_0x0f29('0x24')](function(_0x857564){var _0x2455d2=_0x20aa53[_0x0f29('0x47')][_0x0f29('0x25')]({'plain':!![]});if(!_0x2455d2)throw new Error(_0x0f29('0x48'));if(_0x2455d2[_0x0f29('0x49')]===_0x0f29('0x47')){var _0x5cd4a9=_0x857564['get']({'plain':!![]});var _0xa6231e=_0x0f29('0x26');return db[_0x0f29('0x4a')][_0x0f29('0x4b')]({'where':{'name':_0xa6231e,'userProfileId':_0x2455d2['userProfileId']},'raw':!![]})[_0x0f29('0x24')](function(_0xd624ad){if(_0xd624ad&&_0xd624ad[_0x0f29('0x4c')]===0x0){return db[_0x0f29('0x27')][_0x0f29('0x45')]({'name':_0x5cd4a9[_0x0f29('0x2a')],'resourceId':_0x5cd4a9['id'],'type':_0xd624ad[_0x0f29('0x2a')],'sectionId':_0xd624ad['id']},{})['then'](function(){return _0x857564;});}else{return _0x857564;}})[_0x0f29('0x44')](function(_0x6c1800){logger[_0x0f29('0x28')](_0x0f29('0x4d'),_0x6c1800);throw _0x6c1800;});}return _0x857564;})[_0x0f29('0x24')](respondWithResult(_0x335435,0xc9))[_0x0f29('0x44')](handleError(_0x335435,null));};exports['update']=function(_0x8c9780,_0x45d87c){if(_0x8c9780[_0x0f29('0x46')]['id']){delete _0x8c9780['body']['id'];}return db[_0x0f29('0x3d')]['find']({'where':{'id':_0x8c9780[_0x0f29('0x43')]['id']}})['then'](handleEntityNotFound(_0x45d87c,null))[_0x0f29('0x24')](saveUpdates(_0x8c9780[_0x0f29('0x46')],null))['then'](respondWithResult(_0x45d87c,null))[_0x0f29('0x44')](handleError(_0x45d87c,null));};exports[_0x0f29('0x4e')]=function(_0x4ae30,_0x4a2c08){return db[_0x0f29('0x3d')]['find']({'where':{'id':_0x4ae30[_0x0f29('0x43')]['id']}})[_0x0f29('0x24')](handleEntityNotFound(_0x4a2c08,null))['then'](removeEntity(_0x4a2c08,null))[_0x0f29('0x44')](handleError(_0x4a2c08,null));};exports[_0x0f29('0x4f')]=function(_0x4f2da6,_0xbe013b,_0x4fa132){return db[_0x0f29('0x3d')]['findOne']({'where':{'id':_0x4f2da6[_0x0f29('0x43')]['id']}})[_0x0f29('0x24')](handleEntityNotFound(_0xbe013b,null))[_0x0f29('0x24')](function(_0x4ba5c3){var _0x36e714;var _0x3824f4={},_0x3dc97f={};_0x3dc97f[_0x0f29('0x32')]=_['keys'](db[_0x0f29('0x50')]['rawAttributes']);_0x3dc97f[_0x0f29('0x2f')]=_['keys'](_0x4f2da6[_0x0f29('0x2f')]);_0x3dc97f[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x3dc97f[_0x0f29('0x32')],_0x3dc97f[_0x0f29('0x2f')]);_0x3824f4[_0x0f29('0x33')]=_[_0x0f29('0x31')](_0x3dc97f['model'],qs[_0x0f29('0x34')](_0x4f2da6['query'][_0x0f29('0x34')]));_0x3824f4[_0x0f29('0x33')]=_0x3824f4[_0x0f29('0x33')]['length']?_0x3824f4[_0x0f29('0x33')]:_0x3dc97f[_0x0f29('0x32')];if(!_0x4f2da6[_0x0f29('0x2f')][_0x0f29('0x51')](_0x0f29('0x52'))){_0x3824f4['limit']=qs['limit'](_0x4f2da6[_0x0f29('0x2f')][_0x0f29('0x1f')]);_0x3824f4[_0x0f29('0x1d')]=qs['offset'](_0x4f2da6['query'][_0x0f29('0x1d')]);}_0x3824f4[_0x0f29('0x53')]=qs[_0x0f29('0x36')](_0x4f2da6['query']['sort']);_0x3824f4['where']=qs[_0x0f29('0x30')](_[_0x0f29('0x54')](_0x4f2da6['query'],_0x3dc97f[_0x0f29('0x30')]));if(_0x4f2da6[_0x0f29('0x2f')]['filter']){_0x3824f4[_0x0f29('0x37')]=_['merge'](_0x3824f4[_0x0f29('0x37')],{'$or':_[_0x0f29('0x2c')](_0x3824f4['attributes'],function(_0x2e423a){var _0x83015c={};_0x83015c[_0x2e423a]={'$like':'%'+_0x4f2da6[_0x0f29('0x2f')][_0x0f29('0x38')]+'%'};return _0x83015c;})});}_0x3824f4[_0x0f29('0x37')]=_[_0x0f29('0x39')](_0x3824f4['where'],{'mailboxuser':_0x4ba5c3[_0x0f29('0x55')]});_0x3824f4=_[_0x0f29('0x39')]({},_0x3824f4,_0x4f2da6[_0x0f29('0x3c')]);return db['VoiceMailMessage'][_0x0f29('0x56')](_0x3824f4)[_0x0f29('0x24')](respondWithFilteredResult(_0xbe013b,_0x3824f4));})['catch'](handleError(_0xbe013b,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 0a52dd4..19710d6 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 _0x42be=['mailbox_context','mailbox','context','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','define','voice_voicemail'];(function(_0x1e319a,_0xe827a0){var _0x47015d=function(_0x340417){while(--_0x340417){_0x1e319a['push'](_0x1e319a['shift']());}};_0x47015d(++_0xe827a0);}(_0x42be,0x137));var _0xe42b=function(_0x529f97,_0x295d7c){_0x529f97=_0x529f97-0x0;var _0x4da2b5=_0x42be[_0x529f97];return _0x4da2b5;};'use strict';var _=require(_0xe42b('0x0'));var util=require(_0xe42b('0x1'));var logger=require(_0xe42b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe42b('0x3'));var rp=require(_0xe42b('0x4'));var fs=require('fs');var path=require(_0xe42b('0x5'));var rimraf=require(_0xe42b('0x6'));var config=require(_0xe42b('0x7'));var attributes=require(_0xe42b('0x8'));module['exports']=function(_0x1af2b0,_0x22dd9b){return _0x1af2b0[_0xe42b('0x9')]('VoiceMail',attributes,{'tableName':_0xe42b('0xa'),'paranoid':![],'indexes':[{'name':_0xe42b('0xb'),'fields':[_0xe42b('0xc'),_0xe42b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c60=['./voiceMail.attributes','exports','VoiceMail','mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xce310e,_0x44c1f1){var _0x39a16b=function(_0x10b325){while(--_0x10b325){_0xce310e['push'](_0xce310e['shift']());}};_0x39a16b(++_0x44c1f1);}(_0x5c60,0x19c));var _0x05c6=function(_0x45410e,_0x7b85a8){_0x45410e=_0x45410e-0x0;var _0x43601d=_0x5c60[_0x45410e];return _0x43601d;};'use strict';var _=require('lodash');var util=require(_0x05c6('0x0'));var logger=require(_0x05c6('0x1'))(_0x05c6('0x2'));var moment=require(_0x05c6('0x3'));var BPromise=require(_0x05c6('0x4'));var rp=require(_0x05c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05c6('0x6'));var config=require(_0x05c6('0x7'));var attributes=require(_0x05c6('0x8'));module[_0x05c6('0x9')]=function(_0x5d2c25,_0x4f2e2b){return _0x5d2c25['define'](_0x05c6('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x05c6('0xb'),'fields':[_0x05c6('0xc'),_0x05c6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1597cae..c2553c7 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 _0xb060=['request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x36bd39,_0x2be595){var _0x14ea11=function(_0x1b99bb){while(--_0x1b99bb){_0x36bd39['push'](_0x36bd39['shift']());}};_0x14ea11(++_0x2be595);}(_0xb060,0x6c));var _0x0b06=function(_0x5040fe,_0x4e8c4f){_0x5040fe=_0x5040fe-0x0;var _0x97b997=_0xb060[_0x5040fe];return _0x97b997;};'use strict';var _=require(_0x0b06('0x0'));var util=require(_0x0b06('0x1'));var moment=require(_0x0b06('0x2'));var BPromise=require('bluebird');var rs=require(_0x0b06('0x3'));var fs=require('fs');var Redis=require(_0x0b06('0x4'));var db=require(_0x0b06('0x5'))['db'];var utils=require(_0x0b06('0x6'));var logger=require(_0x0b06('0x7'))('rpc');var config=require(_0x0b06('0x8'));var jayson=require(_0x0b06('0x9'));var client=jayson[_0x0b06('0xa')][_0x0b06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x565fc1,_0x2f4fa4,_0x2ad643){return new BPromise(function(_0x32fe16,_0x18b7b5){return client[_0x0b06('0xc')](_0x565fc1,_0x2ad643)[_0x0b06('0xd')](function(_0x58182a){logger[_0x0b06('0xe')]('VoiceMail,\x20%s,\x20%s',_0x2f4fa4,_0x0b06('0xf'));logger[_0x0b06('0x10')](_0x0b06('0x11'),_0x2f4fa4,_0x0b06('0xf'),JSON[_0x0b06('0x12')](_0x58182a));if(_0x58182a[_0x0b06('0x13')]){if(_0x58182a[_0x0b06('0x13')][_0x0b06('0x14')]===0x1f4){logger[_0x0b06('0x13')](_0x0b06('0x15'),_0x2f4fa4,_0x58182a[_0x0b06('0x13')][_0x0b06('0x16')]);return _0x18b7b5(_0x58182a['error'][_0x0b06('0x16')]);}logger[_0x0b06('0x13')]('VoiceMail,\x20%s,\x20%s',_0x2f4fa4,_0x58182a[_0x0b06('0x13')][_0x0b06('0x16')]);return _0x32fe16(_0x58182a[_0x0b06('0x13')][_0x0b06('0x16')]);}else{logger[_0x0b06('0xe')](_0x0b06('0x15'),_0x2f4fa4,_0x0b06('0xf'));_0x32fe16(_0x58182a['result'][_0x0b06('0x16')]);}})[_0x0b06('0x17')](function(_0x2662fb){logger['error'](_0x0b06('0x15'),_0x2f4fa4,_0x2662fb);_0x18b7b5(_0x2662fb);});});} \ No newline at end of file +var _0x5bfe=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5bfe,0xd0));var _0xe5bf=function(_0x1a6e20,_0x1f6fbc){_0x1a6e20=_0x1a6e20-0x0;var _0x550b88=_0x5bfe[_0x1a6e20];return _0x550b88;};'use strict';var _=require('lodash');var util=require(_0xe5bf('0x0'));var moment=require(_0xe5bf('0x1'));var BPromise=require('bluebird');var rs=require(_0xe5bf('0x2'));var fs=require('fs');var Redis=require(_0xe5bf('0x3'));var db=require(_0xe5bf('0x4'))['db'];var utils=require(_0xe5bf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe5bf('0x6'));var jayson=require(_0xe5bf('0x7'));var client=jayson[_0xe5bf('0x8')][_0xe5bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40cf23,_0xdad20a,_0x6cdc07){return new BPromise(function(_0x4e8f48,_0x54b708){return client[_0xe5bf('0xa')](_0x40cf23,_0x6cdc07)['then'](function(_0x4d4b2c){logger[_0xe5bf('0xb')](_0xe5bf('0xc'),_0xdad20a,_0xe5bf('0xd'));logger[_0xe5bf('0xe')](_0xe5bf('0xf'),_0xdad20a,_0xe5bf('0xd'),JSON[_0xe5bf('0x10')](_0x4d4b2c));if(_0x4d4b2c[_0xe5bf('0x11')]){if(_0x4d4b2c[_0xe5bf('0x11')][_0xe5bf('0x12')]===0x1f4){logger[_0xe5bf('0x11')]('VoiceMail,\x20%s,\x20%s',_0xdad20a,_0x4d4b2c[_0xe5bf('0x11')][_0xe5bf('0x13')]);return _0x54b708(_0x4d4b2c[_0xe5bf('0x11')][_0xe5bf('0x13')]);}logger[_0xe5bf('0x11')](_0xe5bf('0xc'),_0xdad20a,_0x4d4b2c[_0xe5bf('0x11')][_0xe5bf('0x13')]);return _0x4e8f48(_0x4d4b2c[_0xe5bf('0x11')][_0xe5bf('0x13')]);}else{logger[_0xe5bf('0xb')](_0xe5bf('0xc'),_0xdad20a,_0xe5bf('0xd'));_0x4e8f48(_0x4d4b2c['result']['message']);}})[_0xe5bf('0x14')](function(_0x4c606d){logger[_0xe5bf('0x11')](_0xe5bf('0xc'),_0xdad20a,_0x4c606d);_0x54b708(_0x4c606d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index c382ffd..ad28c9f 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 _0x725b=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','create','put','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x725b,0x1ef));var _0xb725=function(_0x842f30,_0x5a3981){_0x842f30=_0x842f30-0x0;var _0x24caa8=_0x725b[_0x842f30];return _0x24caa8;};'use strict';var multer=require('multer');var util=require(_0xb725('0x0'));var path=require(_0xb725('0x1'));var timeout=require(_0xb725('0x2'));var express=require(_0xb725('0x3'));var router=express[_0xb725('0x4')]();var fs_extra=require(_0xb725('0x5'));var auth=require(_0xb725('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb725('0x7'));var controller=require(_0xb725('0x8'));router[_0xb725('0x9')]('/',auth[_0xb725('0xa')](),controller[_0xb725('0xb')]);router[_0xb725('0x9')](_0xb725('0xc'),auth[_0xb725('0xa')](),controller[_0xb725('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xb725('0xe')]);router['post']('/',auth[_0xb725('0xa')](),controller[_0xb725('0xf')]);router[_0xb725('0x10')](_0xb725('0xc'),auth[_0xb725('0xa')](),controller['update']);router[_0xb725('0x11')](_0xb725('0xc'),auth[_0xb725('0xa')](),controller['destroy']);module[_0xb725('0x12')]=router; \ No newline at end of file +var _0xcd5e=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports'];(function(_0xd27f14,_0x2daf1){var _0x57da32=function(_0x29d6f2){while(--_0x29d6f2){_0xd27f14['push'](_0xd27f14['shift']());}};_0x57da32(++_0x2daf1);}(_0xcd5e,0x1b5));var _0xecd5=function(_0x2d9ab9,_0x5745fb){_0x2d9ab9=_0x2d9ab9-0x0;var _0x236a7f=_0xcd5e[_0x2d9ab9];return _0x236a7f;};'use strict';var multer=require(_0xecd5('0x0'));var util=require('util');var path=require(_0xecd5('0x1'));var timeout=require(_0xecd5('0x2'));var express=require(_0xecd5('0x3'));var router=express[_0xecd5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xecd5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xecd5('0x6'));var controller=require('./voiceMailMessage.controller');router[_0xecd5('0x7')]('/',auth[_0xecd5('0x8')](),controller['index']);router['get'](_0xecd5('0x9'),auth[_0xecd5('0x8')](),controller['show']);router['get'](_0xecd5('0xa'),auth[_0xecd5('0x8')](),controller[_0xecd5('0xb')]);router[_0xecd5('0xc')]('/',auth[_0xecd5('0x8')](),controller[_0xecd5('0xd')]);router[_0xecd5('0xe')](_0xecd5('0x9'),auth['isAuthenticated'](),controller[_0xecd5('0xf')]);router[_0xecd5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xecd5('0x11')]);module[_0xecd5('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 8764dc9..929e5cb 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 _0x8d8b=['TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x1cf6ae,_0x272e0f){var _0x51ec49=function(_0x1e1c54){while(--_0x1e1c54){_0x1cf6ae['push'](_0x1cf6ae['shift']());}};_0x51ec49(++_0x272e0f);}(_0x8d8b,0xad));var _0xb8d8=function(_0x17898e,_0x179f2a){_0x17898e=_0x17898e-0x0;var _0x48308c=_0x8d8b[_0x17898e];return _0x48308c;};'use strict';var Sequelize=require(_0xb8d8('0x0'));module[_0xb8d8('0x1')]={'name':{'type':Sequelize[_0xb8d8('0x2')],'get':function(_0x475da4){return this[_0xb8d8('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xb8d8('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb8d8('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xb8d8('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb8d8('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xb8d8('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xb8d8('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb8d8('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb8d8('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xb8d8('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xb8d8('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb8d8('0x5')],'defaultValue':''},'stamp':{'type':_0xb8d8('0x7'),'defaultValue':Sequelize['literal'](_0xb8d8('0x8'))}}; \ No newline at end of file +var _0x5e14=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x5e14,0x1e9));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x45e1('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5c70f8){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x45e1('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x45e1('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x45e1('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x45e1('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x45e1('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x45e1('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x45e1('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x45e1('0x3')](_0x45e1('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x45e1('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x45e1('0x2')],'defaultValue':''},'stamp':{'type':_0x45e1('0x5'),'defaultValue':Sequelize[_0x45e1('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d7fa2f0..93f537c 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 _0x26e9=['reject','update','then','sendStatus','error','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','destroy','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','set','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x5b6cf1,_0x32fdcd){var _0x46278c=function(_0x53fd9b){while(--_0x53fd9b){_0x5b6cf1['push'](_0x5b6cf1['shift']());}};_0x46278c(++_0x32fdcd);}(_0x26e9,0xe9));var _0x926e=function(_0x280a2e,_0x244c6f){_0x280a2e=_0x280a2e-0x0;var _0x286f67=_0x26e9[_0x280a2e];return _0x286f67;};'use strict';var emlformat=require(_0x926e('0x0'));var rimraf=require(_0x926e('0x1'));var zipdir=require(_0x926e('0x2'));var jsonpatch=require(_0x926e('0x3'));var rp=require(_0x926e('0x4'));var moment=require(_0x926e('0x5'));var BPromise=require(_0x926e('0x6'));var Mustache=require(_0x926e('0x7'));var util=require(_0x926e('0x8'));var path=require('path');var sox=require(_0x926e('0x9'));var csv=require(_0x926e('0xa'));var ejs=require(_0x926e('0xb'));var fs=require('fs');var fs_extra=require(_0x926e('0xc'));var _=require('lodash');var squel=require(_0x926e('0xd'));var crypto=require(_0x926e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x926e('0xf'));var toCsv=require(_0x926e('0xa'));var querystring=require(_0x926e('0x10'));var Papa=require(_0x926e('0x11'));var Redis=require(_0x926e('0x12'));var authService=require(_0x926e('0x13'));var qs=require(_0x926e('0x14'));var as=require(_0x926e('0x15'));var hardwareService=require(_0x926e('0x16'));var logger=require(_0x926e('0x17'))(_0x926e('0x18'));var utils=require(_0x926e('0x19'));var config=require(_0x926e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x926e('0x1b'))['db'];function respondWithStatusCode(_0x5913a2,_0x3765fa){_0x3765fa=_0x3765fa||0xcc;return function(_0x2cb4bf){if(_0x2cb4bf){return _0x5913a2['sendStatus'](_0x3765fa);}return _0x5913a2[_0x926e('0x1c')](_0x3765fa)[_0x926e('0x1d')]();};}function respondWithResult(_0x4246a2,_0x36abba){_0x36abba=_0x36abba||0xc8;return function(_0x5737bd){if(_0x5737bd){return _0x4246a2[_0x926e('0x1c')](_0x36abba)['json'](_0x5737bd);}};}function respondWithFilteredResult(_0x42eec2,_0x3739e3){return function(_0xfe19e9){if(_0xfe19e9){var _0xb35fa9=typeof _0x3739e3[_0x926e('0x1e')]===_0x926e('0x1f')&&typeof _0x3739e3[_0x926e('0x20')]===_0x926e('0x1f');var _0x409862=_0xfe19e9[_0x926e('0x21')];var _0x1d3171=_0xb35fa9?0x0:_0x3739e3['offset'];var _0x1c569f=_0xb35fa9?_0xfe19e9[_0x926e('0x21')]:_0x3739e3[_0x926e('0x1e')]+_0x3739e3[_0x926e('0x20')];var _0x51cde4;if(_0x1c569f>=_0x409862){_0x1c569f=_0x409862;_0x51cde4=0xc8;}else{_0x51cde4=0xce;}_0x42eec2[_0x926e('0x1c')](_0x51cde4);return _0x42eec2['set'](_0x926e('0x22'),_0x1d3171+'-'+_0x1c569f+'/'+_0x409862)[_0x926e('0x23')](_0xfe19e9);}return null;};}function patchUpdates(_0x1e6269){return function(_0x14a8d5){try{jsonpatch[_0x926e('0x24')](_0x14a8d5,_0x1e6269,!![]);}catch(_0x20e604){return BPromise[_0x926e('0x25')](_0x20e604);}return _0x14a8d5['save']();};}function saveUpdates(_0x4b5ab5,_0x6e0348){return function(_0x309353){if(_0x309353){return _0x309353[_0x926e('0x26')](_0x4b5ab5)[_0x926e('0x27')](function(_0x4fda15){return _0x4fda15;});}return null;};}function removeEntity(_0x4330da,_0x1a2272){return function(_0x7f1899){if(_0x7f1899){return _0x7f1899['destroy']()[_0x926e('0x27')](function(){_0x4330da[_0x926e('0x1c')](0xcc)[_0x926e('0x1d')]();});}};}function handleEntityNotFound(_0x532541,_0x1f7a30){return function(_0xb78ed1){if(!_0xb78ed1){_0x532541[_0x926e('0x28')](0x194);}return _0xb78ed1;};}function handleError(_0x5ac13d,_0x32b9e6){_0x32b9e6=_0x32b9e6||0x1f4;return function(_0x45e267){logger[_0x926e('0x29')](_0x45e267['stack']);if(_0x45e267[_0x926e('0x2a')]){delete _0x45e267[_0x926e('0x2a')];}_0x5ac13d[_0x926e('0x1c')](_0x32b9e6)['send'](_0x45e267);};}exports[_0x926e('0x2b')]=function(_0x4a7d2a,_0x4942ca){var _0x3c8d20={},_0xc9ef71={},_0x27fce3={'count':0x0,'rows':[]};var _0x16cebd=_[_0x926e('0x2c')](db[_0x926e('0x2d')][_0x926e('0x2e')],function(_0xf42b92){return{'name':_0xf42b92[_0x926e('0x2f')],'type':_0xf42b92[_0x926e('0x30')][_0x926e('0x31')]};});_0xc9ef71['model']=_[_0x926e('0x32')](_['map'](_0x16cebd,_0x926e('0x2a')),['name']);_0xc9ef71[_0x926e('0x33')]=_['keys'](_0x4a7d2a[_0x926e('0x33')]);_0xc9ef71['filters']=_[_0x926e('0x34')](_0xc9ef71[_0x926e('0x35')],_0xc9ef71[_0x926e('0x33')]);_0x3c8d20['attributes']=_['intersection'](_0xc9ef71[_0x926e('0x35')],qs[_0x926e('0x36')](_0x4a7d2a['query'][_0x926e('0x36')]));_0x3c8d20[_0x926e('0x37')]=_0x3c8d20['attributes'][_0x926e('0x38')]?_0x3c8d20[_0x926e('0x37')]:_0xc9ef71[_0x926e('0x35')];if(!_0x4a7d2a[_0x926e('0x33')][_0x926e('0x39')](_0x926e('0x3a'))){_0x3c8d20['limit']=qs['limit'](_0x4a7d2a['query'][_0x926e('0x20')]);_0x3c8d20['offset']=qs[_0x926e('0x1e')](_0x4a7d2a[_0x926e('0x33')][_0x926e('0x1e')]);}_0x3c8d20[_0x926e('0x3b')]=qs[_0x926e('0x3c')](_0x4a7d2a[_0x926e('0x33')][_0x926e('0x3c')]);_0x3c8d20[_0x926e('0x3d')]=qs['filters'](_[_0x926e('0x3e')](_0x4a7d2a[_0x926e('0x33')],_0xc9ef71[_0x926e('0x3f')]),_0x16cebd);if(_0x4a7d2a['query'][_0x926e('0x40')]){_0x3c8d20['where']=_[_0x926e('0x41')](_0x3c8d20[_0x926e('0x3d')],{'$or':_[_0x926e('0x2c')](_0x16cebd,function(_0x432cc8){if(_0x432cc8[_0x926e('0x30')]!==_0x926e('0x42')){var _0xcd9135={};_0xcd9135[_0x432cc8[_0x926e('0x2a')]]={'$like':'%'+_0x4a7d2a[_0x926e('0x33')][_0x926e('0x40')]+'%'};return _0xcd9135;}})});}_0x3c8d20=_[_0x926e('0x41')]({},_0x3c8d20,_0x4a7d2a['options']);var _0x57d565={'where':_0x3c8d20[_0x926e('0x3d')]};return db[_0x926e('0x2d')][_0x926e('0x21')](_0x57d565)['then'](function(_0x2f6d49){_0x27fce3[_0x926e('0x21')]=_0x2f6d49;if(_0x4a7d2a[_0x926e('0x33')]['includeAll']){_0x3c8d20[_0x926e('0x43')]=[{'all':!![]}];}return db[_0x926e('0x2d')][_0x926e('0x44')](_0x3c8d20);})['then'](function(_0x28bf6c){_0x27fce3[_0x926e('0x45')]=_0x28bf6c;return _0x27fce3;})[_0x926e('0x27')](respondWithFilteredResult(_0x4942ca,_0x3c8d20))[_0x926e('0x46')](handleError(_0x4942ca,null));};exports[_0x926e('0x47')]=function(_0x30577c,_0x56283d){var _0x369cac={'raw':!![],'where':{'id':_0x30577c[_0x926e('0x48')]['id']}},_0x391621={};_0x391621[_0x926e('0x35')]=_[_0x926e('0x49')](db[_0x926e('0x2d')][_0x926e('0x2e')]);_0x391621[_0x926e('0x33')]=_['keys'](_0x30577c[_0x926e('0x33')]);_0x391621['filters']=_['intersection'](_0x391621[_0x926e('0x35')],_0x391621[_0x926e('0x33')]);_0x369cac[_0x926e('0x37')]=_['intersection'](_0x391621['model'],qs[_0x926e('0x36')](_0x30577c[_0x926e('0x33')][_0x926e('0x36')]));_0x369cac[_0x926e('0x37')]=_0x369cac[_0x926e('0x37')]['length']?_0x369cac[_0x926e('0x37')]:_0x391621[_0x926e('0x35')];if(_0x30577c[_0x926e('0x33')][_0x926e('0x4a')]){_0x369cac[_0x926e('0x43')]=[{'all':!![]}];}_0x369cac=_['merge']({},_0x369cac,_0x30577c[_0x926e('0x4b')]);return db[_0x926e('0x2d')][_0x926e('0x4c')](_0x369cac)['then'](handleEntityNotFound(_0x56283d,null))['then'](respondWithResult(_0x56283d,null))[_0x926e('0x46')](handleError(_0x56283d,null));};exports[_0x926e('0x4d')]=function(_0x14b952,_0x12f9f2){return db[_0x926e('0x2d')]['create'](_0x14b952[_0x926e('0x4e')],{})[_0x926e('0x27')](respondWithResult(_0x12f9f2,0xc9))[_0x926e('0x46')](handleError(_0x12f9f2,null));};exports[_0x926e('0x26')]=function(_0x24719e,_0x174fae){if(_0x24719e[_0x926e('0x4e')]['id']){delete _0x24719e[_0x926e('0x4e')]['id'];}return db[_0x926e('0x2d')][_0x926e('0x4c')]({'where':{'id':_0x24719e['params']['id']}})[_0x926e('0x27')](handleEntityNotFound(_0x174fae,null))['then'](saveUpdates(_0x24719e[_0x926e('0x4e')],null))[_0x926e('0x27')](respondWithResult(_0x174fae,null))[_0x926e('0x46')](handleError(_0x174fae,null));};exports[_0x926e('0x4f')]=function(_0x224ea2,_0x1fee11){return db['VoiceMailMessage'][_0x926e('0x4c')]({'where':{'id':_0x224ea2[_0x926e('0x48')]['id']}})[_0x926e('0x27')](handleEntityNotFound(_0x1fee11,null))[_0x926e('0x27')](removeEntity(_0x1fee11,null))[_0x926e('0x46')](handleError(_0x1fee11,null));};exports[_0x926e('0x50')]=function(_0x305a73,_0x49ed7c,_0x8ddedd){return db[_0x926e('0x2d')][_0x926e('0x4c')]({'where':{'id':_0x305a73[_0x926e('0x48')]['id']},'attributes':['id',_0x926e('0x51'),_0x926e('0x52')]})[_0x926e('0x27')](handleEntityNotFound(_0x49ed7c,null))['then'](function(_0x3b5b5d){if(_0x3b5b5d){if(!_0x3b5b5d[_0x926e('0x51')]){throw new db[(_0x926e('0x53'))]['ValidationError'](_0x926e('0x54'));}var _0x467dcc={'Content-Type':_0x926e('0x55'),'Content-Disposition':_0x926e('0x56')};if(_0x3b5b5d['msg_id']){_0x467dcc[_0x926e('0x57')]='attachment;\x20filename=\x22'+_0x3b5b5d[_0x926e('0x52')]+'.wav\x22';}_0x49ed7c[_0x926e('0x58')](_0x467dcc);return _0x49ed7c[_0x926e('0x59')](new Buffer(_0x3b5b5d['recording']));}})[_0x926e('0x46')](handleError(_0x49ed7c,null));}; \ No newline at end of file +var _0x7668=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','update','destroy','then','error','name','index','map','VoiceMailMessage','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','length','create','body','find','params','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','msg_id','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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'];(function(_0x53d3b0,_0x62aa42){var _0x44f608=function(_0x47f276){while(--_0x47f276){_0x53d3b0['push'](_0x53d3b0['shift']());}};_0x44f608(++_0x62aa42);}(_0x7668,0x18f));var _0x8766=function(_0x4aa340,_0xe56178){_0x4aa340=_0x4aa340-0x0;var _0x2bcd6f=_0x7668[_0x4aa340];return _0x2bcd6f;};'use strict';var emlformat=require(_0x8766('0x0'));var rimraf=require(_0x8766('0x1'));var zipdir=require(_0x8766('0x2'));var jsonpatch=require(_0x8766('0x3'));var rp=require(_0x8766('0x4'));var moment=require(_0x8766('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8766('0x6'));var path=require(_0x8766('0x7'));var sox=require(_0x8766('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8766('0x9'));var _=require('lodash');var squel=require(_0x8766('0xa'));var crypto=require(_0x8766('0xb'));var jsforce=require(_0x8766('0xc'));var deskjs=require(_0x8766('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8766('0xe'));var Papa=require(_0x8766('0xf'));var Redis=require(_0x8766('0x10'));var authService=require(_0x8766('0x11'));var qs=require(_0x8766('0x12'));var as=require(_0x8766('0x13'));var hardwareService=require(_0x8766('0x14'));var logger=require(_0x8766('0x15'))(_0x8766('0x16'));var utils=require('../../config/utils');var config=require(_0x8766('0x17'));var licenseUtil=require(_0x8766('0x18'));var db=require(_0x8766('0x19'))['db'];function respondWithStatusCode(_0x2bef80,_0x305aaa){_0x305aaa=_0x305aaa||0xcc;return function(_0x59d990){if(_0x59d990){return _0x2bef80[_0x8766('0x1a')](_0x305aaa);}return _0x2bef80[_0x8766('0x1b')](_0x305aaa)[_0x8766('0x1c')]();};}function respondWithResult(_0x23af74,_0x4d0331){_0x4d0331=_0x4d0331||0xc8;return function(_0x1a4837){if(_0x1a4837){return _0x23af74['status'](_0x4d0331)['json'](_0x1a4837);}};}function respondWithFilteredResult(_0x1721f9,_0x579c3f){return function(_0x39be90){if(_0x39be90){var _0x4db616=typeof _0x579c3f['offset']===_0x8766('0x1d')&&typeof _0x579c3f[_0x8766('0x1e')]===_0x8766('0x1d');var _0x58dbbc=_0x39be90[_0x8766('0x1f')];var _0x1faa6b=_0x4db616?0x0:_0x579c3f[_0x8766('0x20')];var _0x5b2e77=_0x4db616?_0x39be90[_0x8766('0x1f')]:_0x579c3f[_0x8766('0x20')]+_0x579c3f['limit'];var _0x71a083;if(_0x5b2e77>=_0x58dbbc){_0x5b2e77=_0x58dbbc;_0x71a083=0xc8;}else{_0x71a083=0xce;}_0x1721f9[_0x8766('0x1b')](_0x71a083);return _0x1721f9['set']('Content-Range',_0x1faa6b+'-'+_0x5b2e77+'/'+_0x58dbbc)[_0x8766('0x21')](_0x39be90);}return null;};}function patchUpdates(_0x2c5ae1){return function(_0x51c35a){try{jsonpatch[_0x8766('0x22')](_0x51c35a,_0x2c5ae1,!![]);}catch(_0x1e9d4b){return BPromise[_0x8766('0x23')](_0x1e9d4b);}return _0x51c35a[_0x8766('0x24')]();};}function saveUpdates(_0x12d328,_0x328338){return function(_0x2c7fda){if(_0x2c7fda){return _0x2c7fda[_0x8766('0x25')](_0x12d328)['then'](function(_0x192452){return _0x192452;});}return null;};}function removeEntity(_0x194eb1,_0x1e9d7e){return function(_0x41a74f){if(_0x41a74f){return _0x41a74f[_0x8766('0x26')]()[_0x8766('0x27')](function(){_0x194eb1[_0x8766('0x1b')](0xcc)[_0x8766('0x1c')]();});}};}function handleEntityNotFound(_0x1e1796,_0x34b059){return function(_0x1bf0cf){if(!_0x1bf0cf){_0x1e1796[_0x8766('0x1a')](0x194);}return _0x1bf0cf;};}function handleError(_0x37509d,_0x39ac7f){_0x39ac7f=_0x39ac7f||0x1f4;return function(_0x3333bc){logger[_0x8766('0x28')](_0x3333bc['stack']);if(_0x3333bc['name']){delete _0x3333bc[_0x8766('0x29')];}_0x37509d[_0x8766('0x1b')](_0x39ac7f)['send'](_0x3333bc);};}exports[_0x8766('0x2a')]=function(_0x31a3aa,_0x58be70){var _0x3b03c5={},_0xa8a832={},_0x36f4eb={'count':0x0,'rows':[]};var _0x122859=_[_0x8766('0x2b')](db[_0x8766('0x2c')][_0x8766('0x2d')],function(_0x4f61a6){return{'name':_0x4f61a6['fieldName'],'type':_0x4f61a6[_0x8766('0x2e')]['key']};});_0xa8a832[_0x8766('0x2f')]=_['differenceBy'](_[_0x8766('0x2b')](_0x122859,'name'),[_0x8766('0x29')]);_0xa8a832['query']=_[_0x8766('0x30')](_0x31a3aa['query']);_0xa8a832[_0x8766('0x31')]=_[_0x8766('0x32')](_0xa8a832[_0x8766('0x2f')],_0xa8a832[_0x8766('0x33')]);_0x3b03c5[_0x8766('0x34')]=_[_0x8766('0x32')](_0xa8a832[_0x8766('0x2f')],qs['fields'](_0x31a3aa[_0x8766('0x33')][_0x8766('0x35')]));_0x3b03c5[_0x8766('0x34')]=_0x3b03c5[_0x8766('0x34')]['length']?_0x3b03c5['attributes']:_0xa8a832[_0x8766('0x2f')];if(!_0x31a3aa[_0x8766('0x33')][_0x8766('0x36')](_0x8766('0x37'))){_0x3b03c5[_0x8766('0x1e')]=qs['limit'](_0x31a3aa[_0x8766('0x33')][_0x8766('0x1e')]);_0x3b03c5[_0x8766('0x20')]=qs[_0x8766('0x20')](_0x31a3aa['query']['offset']);}_0x3b03c5[_0x8766('0x38')]=qs['sort'](_0x31a3aa[_0x8766('0x33')][_0x8766('0x39')]);_0x3b03c5['where']=qs[_0x8766('0x31')](_['pick'](_0x31a3aa['query'],_0xa8a832[_0x8766('0x31')]),_0x122859);if(_0x31a3aa[_0x8766('0x33')][_0x8766('0x3a')]){_0x3b03c5[_0x8766('0x3b')]=_[_0x8766('0x3c')](_0x3b03c5['where'],{'$or':_[_0x8766('0x2b')](_0x122859,function(_0x3b520a){if(_0x3b520a[_0x8766('0x2e')]!==_0x8766('0x3d')){var _0x4817cd={};_0x4817cd[_0x3b520a['name']]={'$like':'%'+_0x31a3aa['query'][_0x8766('0x3a')]+'%'};return _0x4817cd;}})});}_0x3b03c5=_[_0x8766('0x3c')]({},_0x3b03c5,_0x31a3aa[_0x8766('0x3e')]);var _0x4e76be={'where':_0x3b03c5[_0x8766('0x3b')]};return db[_0x8766('0x2c')][_0x8766('0x1f')](_0x4e76be)[_0x8766('0x27')](function(_0x1ab976){_0x36f4eb[_0x8766('0x1f')]=_0x1ab976;if(_0x31a3aa[_0x8766('0x33')][_0x8766('0x3f')]){_0x3b03c5[_0x8766('0x40')]=[{'all':!![]}];}return db[_0x8766('0x2c')][_0x8766('0x41')](_0x3b03c5);})['then'](function(_0x5cc416){_0x36f4eb[_0x8766('0x42')]=_0x5cc416;return _0x36f4eb;})[_0x8766('0x27')](respondWithFilteredResult(_0x58be70,_0x3b03c5))[_0x8766('0x43')](handleError(_0x58be70,null));};exports['show']=function(_0xceeda4,_0x2f7404){var _0x222051={'raw':!![],'where':{'id':_0xceeda4['params']['id']}},_0x3343e2={};_0x3343e2[_0x8766('0x2f')]=_[_0x8766('0x30')](db[_0x8766('0x2c')]['rawAttributes']);_0x3343e2[_0x8766('0x33')]=_['keys'](_0xceeda4['query']);_0x3343e2[_0x8766('0x31')]=_[_0x8766('0x32')](_0x3343e2[_0x8766('0x2f')],_0x3343e2[_0x8766('0x33')]);_0x222051['attributes']=_[_0x8766('0x32')](_0x3343e2['model'],qs[_0x8766('0x35')](_0xceeda4[_0x8766('0x33')][_0x8766('0x35')]));_0x222051['attributes']=_0x222051['attributes'][_0x8766('0x44')]?_0x222051['attributes']:_0x3343e2[_0x8766('0x2f')];if(_0xceeda4[_0x8766('0x33')]['includeAll']){_0x222051['include']=[{'all':!![]}];}_0x222051=_['merge']({},_0x222051,_0xceeda4[_0x8766('0x3e')]);return db['VoiceMailMessage']['find'](_0x222051)[_0x8766('0x27')](handleEntityNotFound(_0x2f7404,null))[_0x8766('0x27')](respondWithResult(_0x2f7404,null))[_0x8766('0x43')](handleError(_0x2f7404,null));};exports[_0x8766('0x45')]=function(_0x368bf4,_0x387634){return db[_0x8766('0x2c')][_0x8766('0x45')](_0x368bf4['body'],{})[_0x8766('0x27')](respondWithResult(_0x387634,0xc9))['catch'](handleError(_0x387634,null));};exports['update']=function(_0x2b59e6,_0x30b71f){if(_0x2b59e6[_0x8766('0x46')]['id']){delete _0x2b59e6[_0x8766('0x46')]['id'];}return db[_0x8766('0x2c')][_0x8766('0x47')]({'where':{'id':_0x2b59e6['params']['id']}})[_0x8766('0x27')](handleEntityNotFound(_0x30b71f,null))[_0x8766('0x27')](saveUpdates(_0x2b59e6[_0x8766('0x46')],null))[_0x8766('0x27')](respondWithResult(_0x30b71f,null))[_0x8766('0x43')](handleError(_0x30b71f,null));};exports['destroy']=function(_0x3180ac,_0x34784c){return db[_0x8766('0x2c')][_0x8766('0x47')]({'where':{'id':_0x3180ac[_0x8766('0x48')]['id']}})[_0x8766('0x27')](handleEntityNotFound(_0x34784c,null))['then'](removeEntity(_0x34784c,null))[_0x8766('0x43')](handleError(_0x34784c,null));};exports[_0x8766('0x49')]=function(_0x449f02,_0x316179,_0x166719){return db[_0x8766('0x2c')][_0x8766('0x47')]({'where':{'id':_0x449f02[_0x8766('0x48')]['id']},'attributes':['id','recording','msg_id']})[_0x8766('0x27')](handleEntityNotFound(_0x316179,null))['then'](function(_0x2f6f0c){if(_0x2f6f0c){if(!_0x2f6f0c[_0x8766('0x4a')]){throw new db[(_0x8766('0x4b'))][(_0x8766('0x4c'))](_0x8766('0x4d'));}var _0x30ec88={'Content-Type':_0x8766('0x4e'),'Content-Disposition':_0x8766('0x4f')};if(_0x2f6f0c['msg_id']){_0x30ec88[_0x8766('0x50')]=_0x8766('0x51')+_0x2f6f0c[_0x8766('0x52')]+_0x8766('0x53');}_0x316179['set'](_0x30ec88);return _0x316179['send'](new Buffer(_0x2f6f0c[_0x8766('0x4a')]));}})[_0x8766('0x43')](handleError(_0x316179,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index dcf13f5..4738d09 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 _0x4a29=['path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x764397,_0x13654c){var _0x138255=function(_0x4d75d0){while(--_0x4d75d0){_0x764397['push'](_0x764397['shift']());}};_0x138255(++_0x13654c);}(_0x4a29,0x132));var _0x94a2=function(_0x281e09,_0x1b01dc){_0x281e09=_0x281e09-0x0;var _0x3b1c9b=_0x4a29[_0x281e09];return _0x3b1c9b;};'use strict';var _=require(_0x94a2('0x0'));var util=require('util');var logger=require(_0x94a2('0x1'))(_0x94a2('0x2'));var moment=require(_0x94a2('0x3'));var BPromise=require(_0x94a2('0x4'));var rp=require(_0x94a2('0x5'));var fs=require('fs');var path=require(_0x94a2('0x6'));var rimraf=require(_0x94a2('0x7'));var config=require(_0x94a2('0x8'));var attributes=require(_0x94a2('0x9'));module[_0x94a2('0xa')]=function(_0x57016e,_0xcfebca){return _0x57016e['define']('VoiceMailMessage',attributes,{'tableName':_0x94a2('0xb'),'paranoid':![],'indexes':[{'name':_0x94a2('0xc'),'fields':[_0x94a2('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x12fb=['bluebird','request-promise','path','voice_voicemail_messages','lodash','util','../../config/logger','moment'];(function(_0x9e5458,_0x110d88){var _0x5f22dd=function(_0x54ca33){while(--_0x54ca33){_0x9e5458['push'](_0x9e5458['shift']());}};_0x5f22dd(++_0x110d88);}(_0x12fb,0x10c));var _0xb12f=function(_0x2deed4,_0x2793e8){_0x2deed4=_0x2deed4-0x0;var _0xfb91f4=_0x12fb[_0x2deed4];return _0xfb91f4;};'use strict';var _=require(_0xb12f('0x0'));var util=require(_0xb12f('0x1'));var logger=require(_0xb12f('0x2'))('api');var moment=require(_0xb12f('0x3'));var BPromise=require(_0xb12f('0x4'));var rp=require(_0xb12f('0x5'));var fs=require('fs');var path=require(_0xb12f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x2ad54d,_0x2914d3){return _0x2ad54d['define']('VoiceMailMessage',attributes,{'tableName':_0xb12f('0x7'),'paranoid':![],'indexes':[{'name':'dir','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 3cb996c..0fc6fcc 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 _0xc182=['randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird'];(function(_0x53a805,_0x28ed28){var _0x51dd42=function(_0x52c95f){while(--_0x52c95f){_0x53a805['push'](_0x53a805['shift']());}};_0x51dd42(++_0x28ed28);}(_0xc182,0x166));var _0x2c18=function(_0x40b09f,_0x58a43b){_0x40b09f=_0x40b09f-0x0;var _0x3b6c0d=_0xc182[_0x40b09f];return _0x3b6c0d;};'use strict';var _=require(_0x2c18('0x0'));var util=require(_0x2c18('0x1'));var moment=require('moment');var BPromise=require(_0x2c18('0x2'));var rs=require(_0x2c18('0x3'));var fs=require('fs');var Redis=require(_0x2c18('0x4'));var db=require(_0x2c18('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c18('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c18('0x7'));var client=jayson[_0x2c18('0x8')][_0x2c18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f3aca,_0x4a2e65,_0x52ad49){return new BPromise(function(_0x2b54b3,_0x41be95){return client[_0x2c18('0xa')](_0x1f3aca,_0x52ad49)['then'](function(_0xdc9c40){logger[_0x2c18('0xb')](_0x2c18('0xc'),_0x4a2e65,_0x2c18('0xd'));logger['debug'](_0x2c18('0xe'),_0x4a2e65,'request\x20sent',JSON[_0x2c18('0xf')](_0xdc9c40));if(_0xdc9c40[_0x2c18('0x10')]){if(_0xdc9c40['error'][_0x2c18('0x11')]===0x1f4){logger[_0x2c18('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x4a2e65,_0xdc9c40[_0x2c18('0x10')]['message']);return _0x41be95(_0xdc9c40[_0x2c18('0x10')]['message']);}logger[_0x2c18('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x4a2e65,_0xdc9c40[_0x2c18('0x10')]['message']);return _0x2b54b3(_0xdc9c40[_0x2c18('0x10')][_0x2c18('0x12')]);}else{logger[_0x2c18('0xb')](_0x2c18('0xc'),_0x4a2e65,_0x2c18('0xd'));_0x2b54b3(_0xdc9c40['result']['message']);}})['catch'](function(_0x27f6a7){logger[_0x2c18('0x10')](_0x2c18('0xc'),_0x4a2e65,_0x27f6a7);_0x41be95(_0x27f6a7);});});} \ No newline at end of file +var _0x3e16=['rpc','../../config/environment','jayson/promise','client','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x521441,_0x6588cf){var _0x3fa2f8=function(_0x92050b){while(--_0x92050b){_0x521441['push'](_0x521441['shift']());}};_0x3fa2f8(++_0x6588cf);}(_0x3e16,0x1c6));var _0x63e1=function(_0x5e9b53,_0x4b8fdc){_0x5e9b53=_0x5e9b53-0x0;var _0x12df57=_0x3e16[_0x5e9b53];return _0x12df57;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x63e1('0x0'));var BPromise=require(_0x63e1('0x1'));var rs=require(_0x63e1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63e1('0x3'))['db'];var utils=require(_0x63e1('0x4'));var logger=require(_0x63e1('0x5'))(_0x63e1('0x6'));var config=require(_0x63e1('0x7'));var jayson=require(_0x63e1('0x8'));var client=jayson[_0x63e1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x348284,_0x350243,_0x1cb4c6){return new BPromise(function(_0x42f62e,_0x3ed19c){return client['request'](_0x348284,_0x1cb4c6)[_0x63e1('0xa')](function(_0x122a38){logger[_0x63e1('0xb')](_0x63e1('0xc'),_0x350243,_0x63e1('0xd'));logger['debug'](_0x63e1('0xe'),_0x350243,_0x63e1('0xd'),JSON[_0x63e1('0xf')](_0x122a38));if(_0x122a38[_0x63e1('0x10')]){if(_0x122a38[_0x63e1('0x10')]['code']===0x1f4){logger[_0x63e1('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x350243,_0x122a38['error'][_0x63e1('0x11')]);return _0x3ed19c(_0x122a38[_0x63e1('0x10')][_0x63e1('0x11')]);}logger[_0x63e1('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x350243,_0x122a38[_0x63e1('0x10')][_0x63e1('0x11')]);return _0x42f62e(_0x122a38[_0x63e1('0x10')][_0x63e1('0x11')]);}else{logger[_0x63e1('0xb')](_0x63e1('0xc'),_0x350243,_0x63e1('0xd'));_0x42f62e(_0x122a38[_0x63e1('0x12')][_0x63e1('0x11')]);}})[_0x63e1('0x13')](function(_0x1d82c2){logger['error'](_0x63e1('0xc'),_0x350243,_0x1d82c2);_0x3ed19c(_0x1d82c2);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1b837ad..2629fcc 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 _0x1187=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x1187,0xdb));var _0x7118=function(_0xe066a5,_0x39ce57){_0xe066a5=_0xe066a5-0x0;var _0x4299f5=_0x1187[_0xe066a5];return _0x4299f5;};'use strict';var multer=require('multer');var util=require(_0x7118('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7118('0x1')]();var fs_extra=require(_0x7118('0x2'));var auth=require(_0x7118('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7118('0x4'));var controller=require(_0x7118('0x5'));router[_0x7118('0x6')]('/',auth[_0x7118('0x7')](),controller['index']);router['get'](_0x7118('0x8'),auth[_0x7118('0x7')](),controller[_0x7118('0x9')]);router['get'](_0x7118('0xa'),auth[_0x7118('0x7')](),controller[_0x7118('0xb')]);router[_0x7118('0xc')]('/',auth[_0x7118('0x7')](),controller[_0x7118('0xd')]);router[_0x7118('0xc')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x7118('0xe')]);router[_0x7118('0xf')](_0x7118('0x8'),auth['isAuthenticated'](),controller[_0x7118('0x10')]);router[_0x7118('0x11')]('/:id',auth[_0x7118('0x7')](),controller[_0x7118('0x12')]);router[_0x7118('0x11')](_0x7118('0x13'),auth[_0x7118('0x7')](),controller[_0x7118('0x14')]);module[_0x7118('0x15')]=router; \ No newline at end of file +var _0x8fb4=['update','delete','destroy','removeSound','exports','multer','util','path','express','Router','../../config/environment','get','isAuthenticated','index','/:id','/:id/sounds','getSounds'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x8fb4,0x148));var _0x48fb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8fb4[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x48fb('0x0'));var util=require(_0x48fb('0x1'));var path=require(_0x48fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x48fb('0x3'));var router=express[_0x48fb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x48fb('0x5'));var controller=require('./voiceMusicOnHold.controller');router[_0x48fb('0x6')]('/',auth[_0x48fb('0x7')](),controller[_0x48fb('0x8')]);router[_0x48fb('0x6')](_0x48fb('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x48fb('0xa'),auth[_0x48fb('0x7')](),controller[_0x48fb('0xb')]);router['post']('/',auth[_0x48fb('0x7')](),controller['create']);router['post'](_0x48fb('0xa'),auth[_0x48fb('0x7')](),controller['addSound']);router['put'](_0x48fb('0x9'),auth[_0x48fb('0x7')](),controller[_0x48fb('0xc')]);router[_0x48fb('0xd')](_0x48fb('0x9'),auth[_0x48fb('0x7')](),controller[_0x48fb('0xe')]);router[_0x48fb('0xd')]('/:id/sounds/:id2',auth[_0x48fb('0x7')](),controller[_0x48fb('0xf')]);module[_0x48fb('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c072942..c24a92d 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 _0x58d5=['quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','custom','files','mp3nb','quietmp3nb'];(function(_0x1935bf,_0xcb8cc9){var _0x149166=function(_0x10db00){while(--_0x10db00){_0x1935bf['push'](_0x1935bf['shift']());}};_0x149166(++_0xcb8cc9);}(_0x58d5,0x1d9));var _0x558d=function(_0x56b81a,_0x289618){_0x56b81a=_0x56b81a-0x0;var _0x1b48cb=_0x58d5[_0x56b81a];return _0x1b48cb;};'use strict';var Sequelize=require(_0x558d('0x0'));module[_0x558d('0x1')]={'name':{'type':Sequelize[_0x558d('0x2')],'allowNull':![],'unique':_0x558d('0x3')},'mode':{'type':Sequelize['ENUM'](_0x558d('0x4'),_0x558d('0x5'),_0x558d('0x6'),_0x558d('0x7'),_0x558d('0x8'),_0x558d('0x9')),'allowNull':!![],'defaultValue':_0x558d('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x558d('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x558d('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x558d('0x2')],'allowNull':!![],'defaultValue':_0x558d('0xa')},'format':{'type':Sequelize[_0x558d('0x2')],'allowNull':!![]},'stamp':{'type':_0x558d('0xb')},'defaultEntry':{'type':Sequelize[_0x558d('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xca35=['STRING','alpha','sequelize','ENUM','custom','files','mp3nb','quietmp3'];(function(_0x3111f3,_0x329f8d){var _0x11c573=function(_0x5304d4){while(--_0x5304d4){_0x3111f3['push'](_0x3111f3['shift']());}};_0x11c573(++_0x329f8d);}(_0xca35,0x19a));var _0x5ca3=function(_0x4da690,_0x12d136){_0x4da690=_0x4da690-0x0;var _0x263c53=_0xca35[_0x4da690];return _0x263c53;};'use strict';var Sequelize=require(_0x5ca3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x5ca3('0x1')](_0x5ca3('0x2'),_0x5ca3('0x3'),_0x5ca3('0x4'),'quietmp3nb',_0x5ca3('0x5'),'mp3'),'allowNull':!![],'defaultValue':_0x5ca3('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x5ca3('0x6')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5ca3('0x6')],'allowNull':!![],'defaultValue':_0x5ca3('0x7')},'format':{'type':Sequelize[_0x5ca3('0x6')],'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 9e855ac..203ad70 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 _0xf82f=['server/files/sounds/converted','format','%s.%s','basename','extname','root','symlinkSync','removeSound','Sound','order','pick','getSounds','hasOwnProperty','rimraf','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','show','find','body','params','files','directory','join','server/files/moh','create','mode','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','sequelize','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt'];(function(_0x17803c,_0x453f7){var _0x371242=function(_0x3e5755){while(--_0x3e5755){_0x17803c['push'](_0x17803c['shift']());}};_0x371242(++_0x453f7);}(_0xf82f,0x15a));var _0xff82=function(_0x32fae7,_0x190f59){_0x32fae7=_0x32fae7-0x0;var _0x32c99c=_0xf82f[_0x32fae7];return _0x32c99c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff82('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff82('0x1'));var Mustache=require(_0xff82('0x2'));var util=require(_0xff82('0x3'));var path=require(_0xff82('0x4'));var sox=require(_0xff82('0x5'));var csv=require('to-csv');var ejs=require(_0xff82('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff82('0x7'));var squel=require(_0xff82('0x8'));var crypto=require(_0xff82('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xff82('0xa'));var toCsv=require(_0xff82('0xb'));var querystring=require(_0xff82('0xc'));var Papa=require(_0xff82('0xd'));var Redis=require(_0xff82('0xe'));var authService=require(_0xff82('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xff82('0x10'));var hardwareService=require(_0xff82('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xff82('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xff82('0x13'));var db=require(_0xff82('0x14'))['db'];function respondWithStatusCode(_0x430d36,_0xd6ed7c){_0xd6ed7c=_0xd6ed7c||0xcc;return function(_0x2f1d2c){if(_0x2f1d2c){return _0x430d36[_0xff82('0x15')](_0xd6ed7c);}return _0x430d36['status'](_0xd6ed7c)[_0xff82('0x16')]();};}function respondWithResult(_0x3f6932,_0x16705b){_0x16705b=_0x16705b||0xc8;return function(_0x4b22d8){if(_0x4b22d8){return _0x3f6932[_0xff82('0x17')](_0x16705b)[_0xff82('0x18')](_0x4b22d8);}};}function respondWithFilteredResult(_0x5bd637,_0x58ddf8){return function(_0x49ee4a){if(_0x49ee4a){var _0x631847=typeof _0x58ddf8[_0xff82('0x19')]===_0xff82('0x1a')&&typeof _0x58ddf8[_0xff82('0x1b')]===_0xff82('0x1a');var _0x53bb68=_0x49ee4a['count'];var _0x1d599a=_0x631847?0x0:_0x58ddf8[_0xff82('0x19')];var _0xa06246=_0x631847?_0x49ee4a['count']:_0x58ddf8[_0xff82('0x19')]+_0x58ddf8[_0xff82('0x1b')];var _0x165835;if(_0xa06246>=_0x53bb68){_0xa06246=_0x53bb68;_0x165835=0xc8;}else{_0x165835=0xce;}_0x5bd637[_0xff82('0x17')](_0x165835);return _0x5bd637[_0xff82('0x1c')]('Content-Range',_0x1d599a+'-'+_0xa06246+'/'+_0x53bb68)[_0xff82('0x18')](_0x49ee4a);}return null;};}function patchUpdates(_0x53e672){return function(_0x22b6ff){try{jsonpatch[_0xff82('0x1d')](_0x22b6ff,_0x53e672,!![]);}catch(_0x2a0bbd){return BPromise[_0xff82('0x1e')](_0x2a0bbd);}return _0x22b6ff[_0xff82('0x1f')]();};}function saveUpdates(_0x194e03,_0x2260d0){return function(_0x14dc0b){if(_0x14dc0b){return _0x14dc0b[_0xff82('0x20')](_0x194e03)[_0xff82('0x21')](function(_0x5c431e){return _0x5c431e;});}return null;};}function removeEntity(_0x4031eb,_0x57682f){return function(_0x1b13e0){if(_0x1b13e0){return _0x1b13e0[_0xff82('0x22')]()[_0xff82('0x21')](function(){var _0x39f66b=_0x1b13e0[_0xff82('0x23')]({'plain':!![]});var _0x367881=_0xff82('0x24');return db['UserProfileResource'][_0xff82('0x22')]({'where':{'type':_0x367881,'resourceId':_0x39f66b['id']}})[_0xff82('0x21')](function(){return _0x1b13e0;});})['then'](function(){_0x4031eb[_0xff82('0x17')](0xcc)[_0xff82('0x16')]();});}};}function handleEntityNotFound(_0x325694,_0x205c71){return function(_0x44ec93){if(!_0x44ec93){_0x325694[_0xff82('0x15')](0x194);}return _0x44ec93;};}function handleError(_0x4d1f48,_0x1e1e10){_0x1e1e10=_0x1e1e10||0x1f4;return function(_0x2a0814){logger[_0xff82('0x25')](_0x2a0814[_0xff82('0x26')]);if(_0x2a0814[_0xff82('0x27')]){delete _0x2a0814[_0xff82('0x27')];}_0x4d1f48[_0xff82('0x17')](_0x1e1e10)[_0xff82('0x28')](_0x2a0814);};}exports[_0xff82('0x29')]=function(_0x5d7582,_0x42aab4){var _0x2af48e={},_0x236955={},_0x4bfca0={'count':0x0,'rows':[]};var _0x393406=_['map'](db[_0xff82('0x2a')][_0xff82('0x2b')],function(_0x2399aa){return{'name':_0x2399aa[_0xff82('0x2c')],'type':_0x2399aa[_0xff82('0x2d')]['key']};});_0x236955['model']=_[_0xff82('0x2e')](_0x393406,_0xff82('0x27'));_0x236955[_0xff82('0x2f')]=_[_0xff82('0x30')](_0x5d7582[_0xff82('0x2f')]);_0x236955[_0xff82('0x31')]=_[_0xff82('0x32')](_0x236955[_0xff82('0x33')],_0x236955[_0xff82('0x2f')]);_0x2af48e[_0xff82('0x34')]=_['intersection'](_0x236955[_0xff82('0x33')],qs['fields'](_0x5d7582[_0xff82('0x2f')][_0xff82('0x35')]));_0x2af48e['attributes']=_0x2af48e[_0xff82('0x34')][_0xff82('0x36')]?_0x2af48e[_0xff82('0x34')]:_0x236955['model'];if(!_0x5d7582[_0xff82('0x2f')]['hasOwnProperty'](_0xff82('0x37'))){_0x2af48e[_0xff82('0x1b')]=qs[_0xff82('0x1b')](_0x5d7582[_0xff82('0x2f')][_0xff82('0x1b')]);_0x2af48e[_0xff82('0x19')]=qs['offset'](_0x5d7582[_0xff82('0x2f')][_0xff82('0x19')]);}_0x2af48e['order']=qs['sort'](_0x5d7582['query'][_0xff82('0x38')]);delete _0x5d7582[_0xff82('0x2f')][_0xff82('0x38')];_0x2af48e[_0xff82('0x39')]=qs[_0xff82('0x31')](_['pick'](_0x5d7582['query'],_0x236955[_0xff82('0x31')]),_0x393406);if(_0x5d7582[_0xff82('0x2f')][_0xff82('0x3a')]){_0x2af48e['where']=_[_0xff82('0x3b')](_0x2af48e[_0xff82('0x39')],{'$or':_[_0xff82('0x2e')](_0x393406,function(_0x32b440){if(_0x32b440['type']!=='VIRTUAL'){var _0x41a171={};_0x41a171[_0x32b440[_0xff82('0x27')]]={'$like':'%'+_0x5d7582[_0xff82('0x2f')][_0xff82('0x3a')]+'%'};return _0x41a171;}})});}_0x2af48e=_[_0xff82('0x3b')]({},_0x2af48e,_0x5d7582[_0xff82('0x3c')]);var _0x539b69={'where':_0x2af48e[_0xff82('0x39')]};return db[_0xff82('0x2a')]['count'](_0x539b69)[_0xff82('0x21')](function(_0x519dcb){_0x4bfca0[_0xff82('0x3d')]=_0x519dcb;if(_0x5d7582[_0xff82('0x2f')][_0xff82('0x3e')]){_0x2af48e[_0xff82('0x3f')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xff82('0x40')](_0x2af48e);})[_0xff82('0x21')](function(_0x505616){_0x4bfca0[_0xff82('0x41')]=_0x505616;return _0x4bfca0;})[_0xff82('0x21')](respondWithFilteredResult(_0x42aab4,_0x2af48e))['catch'](handleError(_0x42aab4,null));};exports[_0xff82('0x42')]=function(_0x4718c6,_0x38d7aa){var _0x14cb42={'raw':![],'where':{'id':_0x4718c6['params']['id']}},_0x2ae171={};_0x2ae171[_0xff82('0x33')]=_[_0xff82('0x30')](db['VoiceMusicOnHold']['rawAttributes']);_0x2ae171['query']=_[_0xff82('0x30')](_0x4718c6['query']);_0x2ae171[_0xff82('0x31')]=_[_0xff82('0x32')](_0x2ae171['model'],_0x2ae171[_0xff82('0x2f')]);_0x14cb42['attributes']=_['intersection'](_0x2ae171[_0xff82('0x33')],qs[_0xff82('0x35')](_0x4718c6[_0xff82('0x2f')]['fields']));_0x14cb42[_0xff82('0x34')]=_0x14cb42[_0xff82('0x34')][_0xff82('0x36')]?_0x14cb42['attributes']:_0x2ae171[_0xff82('0x33')];if(_0x4718c6[_0xff82('0x2f')][_0xff82('0x3e')]){_0x14cb42[_0xff82('0x3f')]=[{'all':!![]}];}_0x14cb42=_[_0xff82('0x3b')]({},_0x14cb42,_0x4718c6[_0xff82('0x3c')]);return db[_0xff82('0x2a')][_0xff82('0x43')](_0x14cb42)[_0xff82('0x21')](handleEntityNotFound(_0x38d7aa,null))[_0xff82('0x21')](respondWithResult(_0x38d7aa,null))['catch'](handleError(_0x38d7aa,null));};exports[_0xff82('0x20')]=function(_0x8a21c1,_0x290a98){if(_0x8a21c1[_0xff82('0x44')]['id']){delete _0x8a21c1[_0xff82('0x44')]['id'];}return db[_0xff82('0x2a')][_0xff82('0x43')]({'where':{'id':_0x8a21c1[_0xff82('0x45')]['id']}})[_0xff82('0x21')](handleEntityNotFound(_0x290a98,null))[_0xff82('0x21')](saveUpdates(_0x8a21c1[_0xff82('0x44')],null))[_0xff82('0x21')](respondWithResult(_0x290a98,null))['catch'](handleError(_0x290a98,null));};exports['create']=function(_0x3cf284,_0x432d2a,_0x573462){return db['sequelize']['transaction'](function(_0x2a9ba){if(_0x3cf284[_0xff82('0x44')]['mode']===_0xff82('0x46')){_0x3cf284[_0xff82('0x44')][_0xff82('0x47')]=path[_0xff82('0x48')](config['root'],_0xff82('0x49'),_0x3cf284[_0xff82('0x44')][_0xff82('0x27')]);}return db[_0xff82('0x2a')][_0xff82('0x4a')](_0x3cf284['body'],{'transaction':_0x2a9ba})[_0xff82('0x21')](function(_0x4e2c11){if(_0x3cf284[_0xff82('0x44')][_0xff82('0x4b')]===_0xff82('0x46')){fs[_0xff82('0x4c')](_0x4e2c11[_0xff82('0x47')],parseInt('0777',0x8));}var _0x533ff1=_0x3cf284[_0xff82('0x4d')][_0xff82('0x23')]({'plain':!![]});if(!_0x533ff1)throw new Error(_0xff82('0x4e'));if(_0x533ff1['role']===_0xff82('0x4d')){var _0x154899=_0x4e2c11[_0xff82('0x23')]({'plain':!![]});return db[_0xff82('0x4f')][_0xff82('0x43')]({'where':{'name':_0xff82('0x24'),'userProfileId':_0x533ff1[_0xff82('0x50')]},'raw':!![]})['then'](function(_0x151be6){if(_0x151be6&&_0x151be6[_0xff82('0x51')]===0x0){return db[_0xff82('0x52')][_0xff82('0x4a')]({'name':_0x154899[_0xff82('0x27')],'resourceId':_0x154899['id'],'type':_0x151be6[_0xff82('0x27')],'sectionId':_0x151be6['id']},{})['then'](function(){return _0x4e2c11;});}else{return _0x4e2c11;}})['catch'](function(_0xb65441){logger[_0xff82('0x25')](_0xff82('0x53'),_0xb65441);});}return _0x4e2c11;});})[_0xff82('0x21')](respondWithResult(_0x432d2a,0xc9))[_0xff82('0x54')](handleError(_0x432d2a,null));};exports[_0xff82('0x22')]=function(_0x1d65b5,_0x50b60d,_0x5151d5){var _0x5bb251;return db[_0xff82('0x2a')]['find']({'where':{'id':_0x1d65b5[_0xff82('0x45')]['id']}})[_0xff82('0x21')](function(_0x208419){if(_0x208419){return db[_0xff82('0x55')]['transaction'](function(_0x4eba3e){return _0x208419[_0xff82('0x22')]({'transaction':_0x4eba3e,'raw':!![]})['then'](function(_0x36ea69){if(_0x36ea69[_0xff82('0x47')]){fs[_0xff82('0x56')](_0x36ea69['directory'])[_0xff82('0x57')](function(_0x3671a2){fs[_0xff82('0x58')](path['join'](_0x36ea69[_0xff82('0x47')],_0x3671a2));});fs[_0xff82('0x59')](_0x36ea69[_0xff82('0x47')]);}return _0x36ea69;});})[_0xff82('0x54')](function(_0x39831a){throw new db[(_0xff82('0x5a'))][(_0xff82('0x5b'))](_0x39831a[_0xff82('0x5c')]);});}})[_0xff82('0x21')](handleEntityNotFound(_0x50b60d,null))[_0xff82('0x21')](removeEntity(_0x50b60d,null))[_0xff82('0x54')](handleError(_0x50b60d,null));};exports[_0xff82('0x5d')]=function(_0x26c75c,_0x50e6f8,_0x451472){return db[_0xff82('0x55')]['transaction'](function(_0x1842bb){var _0x361ad1;return db['VoiceMusicOnHold'][_0xff82('0x43')]({'where':{'id':_0x26c75c[_0xff82('0x45')]['id']}})[_0xff82('0x21')](function(_0x43540b){if(_0x43540b){_0x361ad1=_0x43540b;return _0x43540b['addSound'](_0x26c75c[_0xff82('0x44')]['id'],{'transaction':_0x1842bb});}})[_0xff82('0x21')](function(_0x117e6d){if(_0x117e6d){return db['Sound'][_0xff82('0x5e')]({'where':{'id':_0x26c75c['body']['id']},'attributes':['id',_0xff82('0x27'),_0xff82('0x5f'),_0xff82('0x60'),_0xff82('0x61')],'raw':!![]});}})[_0xff82('0x21')](function(_0x4d9cb8){if(_0x4d9cb8){var _0x78114c=path[_0xff82('0x48')](config['root'],_0xff82('0x62'),util[_0xff82('0x63')](_0xff82('0x64'),path[_0xff82('0x65')](_0x4d9cb8[_0xff82('0x5f')],path[_0xff82('0x66')](_0x4d9cb8['save_name'])),_0x4d9cb8['converted_format']));var _0x2ca6f4=path['join'](config[_0xff82('0x67')],_0xff82('0x49'),_0x361ad1[_0xff82('0x27')],util[_0xff82('0x63')](_0xff82('0x64'),_0x4d9cb8[_0xff82('0x27')],_0x4d9cb8[_0xff82('0x60')]));fs[_0xff82('0x68')](_0x78114c,_0x2ca6f4);return _0x4d9cb8;}})[_0xff82('0x54')](function(_0x41d54c){throw new db[(_0xff82('0x5a'))][(_0xff82('0x5b'))](_0x41d54c[_0xff82('0x5c')]);});})[_0xff82('0x21')](handleEntityNotFound(_0x50e6f8,null))[_0xff82('0x21')](respondWithResult(_0x50e6f8,0xc9))[_0xff82('0x54')](handleError(_0x50e6f8,null));};exports[_0xff82('0x69')]=function(_0x10a044,_0x1ee913,_0x1b49c1){return db[_0xff82('0x55')]['transaction'](function(_0x55907e){var _0x45e051;return db[_0xff82('0x2a')][_0xff82('0x5e')]({'where':{'id':_0x10a044[_0xff82('0x45')]['id']}})[_0xff82('0x21')](handleEntityNotFound(_0x1ee913,null))[_0xff82('0x21')](function(_0x14f901){if(_0x14f901){_0x45e051=_0x14f901;return _0x14f901[_0xff82('0x69')](_0x10a044[_0xff82('0x45')]['id2']);}})['then'](function(_0x1b98fc){if(_0x1b98fc){return db[_0xff82('0x6a')][_0xff82('0x5e')]({'where':{'id':_0x10a044[_0xff82('0x45')]['id2']},'attributes':['id',_0xff82('0x27'),_0xff82('0x5f'),_0xff82('0x60'),_0xff82('0x61')],'raw':!![]});}})[_0xff82('0x21')](function(_0x594e23){if(_0x594e23){fs[_0xff82('0x58')](path[_0xff82('0x48')](_0x45e051[_0xff82('0x47')],util['format']('%s.%s',_0x594e23[_0xff82('0x27')],_0x594e23[_0xff82('0x60')])));return _0x594e23;}})[_0xff82('0x54')](function(_0x2a30e5){throw new db['Sequelize'][(_0xff82('0x5b'))](_0x2a30e5['message']);});})['then'](handleEntityNotFound(_0x1ee913,null))[_0xff82('0x21')](respondWithStatusCode(_0x1ee913,0xcc))[_0xff82('0x54')](handleError(_0x1ee913,null));};exports['getSounds']=function(_0x48bc07,_0xdac0c3,_0x3bc3dd){var _0x8d41b7={};var _0x2d19f0={};var _0x537d47;var _0x459186;return db[_0xff82('0x2a')][_0xff82('0x5e')]({'where':{'id':_0x48bc07[_0xff82('0x45')]['id']}})[_0xff82('0x21')](handleEntityNotFound(_0xdac0c3,null))[_0xff82('0x21')](function(_0x9782e9){if(_0x9782e9){_0x537d47=_0x9782e9;_0x2d19f0[_0xff82('0x33')]=_[_0xff82('0x30')](db[_0xff82('0x6a')][_0xff82('0x2b')]);_0x2d19f0['query']=_[_0xff82('0x30')](_0x48bc07[_0xff82('0x2f')]);_0x2d19f0[_0xff82('0x31')]=_['intersection'](_0x2d19f0[_0xff82('0x33')],_0x2d19f0['query']);_0x8d41b7[_0xff82('0x34')]=_[_0xff82('0x32')](_0x2d19f0[_0xff82('0x33')],qs[_0xff82('0x35')](_0x48bc07[_0xff82('0x2f')][_0xff82('0x35')]));_0x8d41b7[_0xff82('0x34')]=_0x8d41b7[_0xff82('0x34')][_0xff82('0x36')]?_0x8d41b7[_0xff82('0x34')]:_0x2d19f0[_0xff82('0x33')];_0x8d41b7[_0xff82('0x6b')]=qs[_0xff82('0x38')](_0x48bc07[_0xff82('0x2f')][_0xff82('0x38')]);_0x8d41b7['where']=qs[_0xff82('0x31')](_[_0xff82('0x6c')](_0x48bc07[_0xff82('0x2f')],_0x2d19f0[_0xff82('0x31')]));if(_0x48bc07[_0xff82('0x2f')][_0xff82('0x3a')]){_0x8d41b7[_0xff82('0x39')]=_['merge'](_0x8d41b7['where'],{'$or':_[_0xff82('0x2e')](_0x8d41b7['attributes'],function(_0x2bf689){var _0x290624={};_0x290624[_0x2bf689]={'$like':'%'+_0x48bc07[_0xff82('0x2f')][_0xff82('0x3a')]+'%'};return _0x290624;})});}_0x8d41b7=_[_0xff82('0x3b')]({},_0x8d41b7,_0x48bc07[_0xff82('0x3c')]);return _0x537d47[_0xff82('0x6d')](_0x8d41b7);}})[_0xff82('0x21')](function(_0x35dd86){if(_0x35dd86){_0x459186=_0x35dd86[_0xff82('0x36')];if(!_0x48bc07['query'][_0xff82('0x6e')](_0xff82('0x37'))){_0x8d41b7[_0xff82('0x1b')]=qs['limit'](_0x48bc07[_0xff82('0x2f')]['limit']);_0x8d41b7[_0xff82('0x19')]=qs[_0xff82('0x19')](_0x48bc07[_0xff82('0x2f')][_0xff82('0x19')]);}return _0x537d47[_0xff82('0x6d')](_0x8d41b7);}})['then'](function(_0x5c2ef8){if(_0x5c2ef8){return _0x5c2ef8?{'count':_0x459186,'rows':_0x5c2ef8}:null;}})['then'](respondWithResult(_0xdac0c3,null))[_0xff82('0x54')](handleError(_0xdac0c3,null));}; \ No newline at end of file +var _0x86ae=['format','%s.%s','extname','symlinkSync','nolimit','getSounds','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','MusicOnHolds','UserProfileResource','destroy','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','key','model','keys','query','intersection','attributes','length','hasOwnProperty','sort','where','pick','filters','filter','merge','type','VIRTUAL','include','findAll','rows','catch','params','fields','options','find','body','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted'];(function(_0xa287c,_0x2de3e8){var _0x49fc90=function(_0x5ae00e){while(--_0x5ae00e){_0xa287c['push'](_0xa287c['shift']());}};_0x49fc90(++_0x2de3e8);}(_0x86ae,0x1b2));var _0xe86a=function(_0x492837,_0x514e8e){_0x492837=_0x492837-0x0;var _0x44f215=_0x86ae[_0x492837];return _0x44f215;};'use strict';var emlformat=require(_0xe86a('0x0'));var rimraf=require(_0xe86a('0x1'));var zipdir=require(_0xe86a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe86a('0x3'));var moment=require(_0xe86a('0x4'));var BPromise=require(_0xe86a('0x5'));var Mustache=require('mustache');var util=require(_0xe86a('0x6'));var path=require('path');var sox=require(_0xe86a('0x7'));var csv=require(_0xe86a('0x8'));var ejs=require(_0xe86a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe86a('0xa'));var squel=require(_0xe86a('0xb'));var crypto=require(_0xe86a('0xc'));var jsforce=require(_0xe86a('0xd'));var deskjs=require(_0xe86a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe86a('0xf'));var Papa=require('papaparse');var Redis=require(_0xe86a('0x10'));var authService=require(_0xe86a('0x11'));var qs=require(_0xe86a('0x12'));var as=require(_0xe86a('0x13'));var hardwareService=require(_0xe86a('0x14'));var logger=require(_0xe86a('0x15'))(_0xe86a('0x16'));var utils=require(_0xe86a('0x17'));var config=require(_0xe86a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe86a('0x19'))['db'];function respondWithStatusCode(_0x191173,_0x5a10c5){_0x5a10c5=_0x5a10c5||0xcc;return function(_0x5bb629){if(_0x5bb629){return _0x191173[_0xe86a('0x1a')](_0x5a10c5);}return _0x191173[_0xe86a('0x1b')](_0x5a10c5)[_0xe86a('0x1c')]();};}function respondWithResult(_0x10f911,_0x1aa6df){_0x1aa6df=_0x1aa6df||0xc8;return function(_0x66f28c){if(_0x66f28c){return _0x10f911['status'](_0x1aa6df)[_0xe86a('0x1d')](_0x66f28c);}};}function respondWithFilteredResult(_0x3f2697,_0x2291a1){return function(_0x19ed1e){if(_0x19ed1e){var _0xdfb97e=typeof _0x2291a1[_0xe86a('0x1e')]===_0xe86a('0x1f')&&typeof _0x2291a1[_0xe86a('0x20')]===_0xe86a('0x1f');var _0x3b69f5=_0x19ed1e[_0xe86a('0x21')];var _0x3deca6=_0xdfb97e?0x0:_0x2291a1['offset'];var _0x2c4229=_0xdfb97e?_0x19ed1e[_0xe86a('0x21')]:_0x2291a1['offset']+_0x2291a1['limit'];var _0x4b8518;if(_0x2c4229>=_0x3b69f5){_0x2c4229=_0x3b69f5;_0x4b8518=0xc8;}else{_0x4b8518=0xce;}_0x3f2697[_0xe86a('0x1b')](_0x4b8518);return _0x3f2697[_0xe86a('0x22')](_0xe86a('0x23'),_0x3deca6+'-'+_0x2c4229+'/'+_0x3b69f5)['json'](_0x19ed1e);}return null;};}function patchUpdates(_0x179b99){return function(_0x2a1e55){try{jsonpatch[_0xe86a('0x24')](_0x2a1e55,_0x179b99,!![]);}catch(_0x1e8835){return BPromise['reject'](_0x1e8835);}return _0x2a1e55[_0xe86a('0x25')]();};}function saveUpdates(_0x342467,_0x11cfc7){return function(_0x5efc46){if(_0x5efc46){return _0x5efc46[_0xe86a('0x26')](_0x342467)[_0xe86a('0x27')](function(_0x2d85b6){return _0x2d85b6;});}return null;};}function removeEntity(_0x3a2020,_0x534825){return function(_0x4ad4db){if(_0x4ad4db){return _0x4ad4db['destroy']()[_0xe86a('0x27')](function(){var _0xe300bf=_0x4ad4db['get']({'plain':!![]});var _0x44ec8f=_0xe86a('0x28');return db[_0xe86a('0x29')][_0xe86a('0x2a')]({'where':{'type':_0x44ec8f,'resourceId':_0xe300bf['id']}})[_0xe86a('0x27')](function(){return _0x4ad4db;});})[_0xe86a('0x27')](function(){_0x3a2020[_0xe86a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x624fcb,_0x5e408c){return function(_0x35494b){if(!_0x35494b){_0x624fcb[_0xe86a('0x1a')](0x194);}return _0x35494b;};}function handleError(_0x575c26,_0x379912){_0x379912=_0x379912||0x1f4;return function(_0x435aaa){logger[_0xe86a('0x2b')](_0x435aaa[_0xe86a('0x2c')]);if(_0x435aaa[_0xe86a('0x2d')]){delete _0x435aaa[_0xe86a('0x2d')];}_0x575c26['status'](_0x379912)['send'](_0x435aaa);};}exports[_0xe86a('0x2e')]=function(_0x49a0e4,_0x1a866a){var _0x2b017f={},_0x4246d6={},_0x510114={'count':0x0,'rows':[]};var _0x586173=_[_0xe86a('0x2f')](db[_0xe86a('0x30')][_0xe86a('0x31')],function(_0x103bb2){return{'name':_0x103bb2['fieldName'],'type':_0x103bb2['type'][_0xe86a('0x32')]};});_0x4246d6[_0xe86a('0x33')]=_[_0xe86a('0x2f')](_0x586173,'name');_0x4246d6['query']=_[_0xe86a('0x34')](_0x49a0e4[_0xe86a('0x35')]);_0x4246d6['filters']=_[_0xe86a('0x36')](_0x4246d6[_0xe86a('0x33')],_0x4246d6[_0xe86a('0x35')]);_0x2b017f[_0xe86a('0x37')]=_[_0xe86a('0x36')](_0x4246d6[_0xe86a('0x33')],qs['fields'](_0x49a0e4['query']['fields']));_0x2b017f['attributes']=_0x2b017f[_0xe86a('0x37')][_0xe86a('0x38')]?_0x2b017f['attributes']:_0x4246d6[_0xe86a('0x33')];if(!_0x49a0e4[_0xe86a('0x35')][_0xe86a('0x39')]('nolimit')){_0x2b017f[_0xe86a('0x20')]=qs[_0xe86a('0x20')](_0x49a0e4[_0xe86a('0x35')][_0xe86a('0x20')]);_0x2b017f[_0xe86a('0x1e')]=qs['offset'](_0x49a0e4[_0xe86a('0x35')][_0xe86a('0x1e')]);}_0x2b017f['order']=qs[_0xe86a('0x3a')](_0x49a0e4[_0xe86a('0x35')][_0xe86a('0x3a')]);delete _0x49a0e4[_0xe86a('0x35')][_0xe86a('0x3a')];_0x2b017f[_0xe86a('0x3b')]=qs['filters'](_[_0xe86a('0x3c')](_0x49a0e4[_0xe86a('0x35')],_0x4246d6[_0xe86a('0x3d')]),_0x586173);if(_0x49a0e4[_0xe86a('0x35')][_0xe86a('0x3e')]){_0x2b017f['where']=_[_0xe86a('0x3f')](_0x2b017f[_0xe86a('0x3b')],{'$or':_[_0xe86a('0x2f')](_0x586173,function(_0x5ee9ad){if(_0x5ee9ad[_0xe86a('0x40')]!==_0xe86a('0x41')){var _0x3876c6={};_0x3876c6[_0x5ee9ad[_0xe86a('0x2d')]]={'$like':'%'+_0x49a0e4['query'][_0xe86a('0x3e')]+'%'};return _0x3876c6;}})});}_0x2b017f=_[_0xe86a('0x3f')]({},_0x2b017f,_0x49a0e4['options']);var _0x55c904={'where':_0x2b017f[_0xe86a('0x3b')]};return db[_0xe86a('0x30')][_0xe86a('0x21')](_0x55c904)[_0xe86a('0x27')](function(_0xc76d49){_0x510114['count']=_0xc76d49;if(_0x49a0e4[_0xe86a('0x35')]['includeAll']){_0x2b017f[_0xe86a('0x42')]=[{'all':!![]}];}return db[_0xe86a('0x30')][_0xe86a('0x43')](_0x2b017f);})[_0xe86a('0x27')](function(_0x57cc01){_0x510114[_0xe86a('0x44')]=_0x57cc01;return _0x510114;})[_0xe86a('0x27')](respondWithFilteredResult(_0x1a866a,_0x2b017f))[_0xe86a('0x45')](handleError(_0x1a866a,null));};exports['show']=function(_0x2fad07,_0x2b5337){var _0x295c91={'raw':![],'where':{'id':_0x2fad07[_0xe86a('0x46')]['id']}},_0x6072d1={};_0x6072d1['model']=_[_0xe86a('0x34')](db['VoiceMusicOnHold'][_0xe86a('0x31')]);_0x6072d1['query']=_[_0xe86a('0x34')](_0x2fad07[_0xe86a('0x35')]);_0x6072d1['filters']=_[_0xe86a('0x36')](_0x6072d1['model'],_0x6072d1[_0xe86a('0x35')]);_0x295c91[_0xe86a('0x37')]=_[_0xe86a('0x36')](_0x6072d1[_0xe86a('0x33')],qs[_0xe86a('0x47')](_0x2fad07[_0xe86a('0x35')][_0xe86a('0x47')]));_0x295c91[_0xe86a('0x37')]=_0x295c91[_0xe86a('0x37')][_0xe86a('0x38')]?_0x295c91[_0xe86a('0x37')]:_0x6072d1[_0xe86a('0x33')];if(_0x2fad07[_0xe86a('0x35')]['includeAll']){_0x295c91[_0xe86a('0x42')]=[{'all':!![]}];}_0x295c91=_[_0xe86a('0x3f')]({},_0x295c91,_0x2fad07[_0xe86a('0x48')]);return db['VoiceMusicOnHold'][_0xe86a('0x49')](_0x295c91)[_0xe86a('0x27')](handleEntityNotFound(_0x2b5337,null))['then'](respondWithResult(_0x2b5337,null))['catch'](handleError(_0x2b5337,null));};exports[_0xe86a('0x26')]=function(_0x5a5c2c,_0x5c5f21){if(_0x5a5c2c[_0xe86a('0x4a')]['id']){delete _0x5a5c2c[_0xe86a('0x4a')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5a5c2c['params']['id']}})[_0xe86a('0x27')](handleEntityNotFound(_0x5c5f21,null))[_0xe86a('0x27')](saveUpdates(_0x5a5c2c['body'],null))[_0xe86a('0x27')](respondWithResult(_0x5c5f21,null))['catch'](handleError(_0x5c5f21,null));};exports[_0xe86a('0x4b')]=function(_0x40720d,_0x317e20,_0x5cd85e){return db['sequelize'][_0xe86a('0x4c')](function(_0x247b0a){if(_0x40720d[_0xe86a('0x4a')][_0xe86a('0x4d')]===_0xe86a('0x4e')){_0x40720d[_0xe86a('0x4a')][_0xe86a('0x4f')]=path[_0xe86a('0x50')](config[_0xe86a('0x51')],_0xe86a('0x52'),_0x40720d[_0xe86a('0x4a')][_0xe86a('0x2d')]);}return db['VoiceMusicOnHold'][_0xe86a('0x4b')](_0x40720d[_0xe86a('0x4a')],{'transaction':_0x247b0a})[_0xe86a('0x27')](function(_0x438e03){if(_0x40720d[_0xe86a('0x4a')][_0xe86a('0x4d')]===_0xe86a('0x4e')){fs[_0xe86a('0x53')](_0x438e03[_0xe86a('0x4f')],parseInt(_0xe86a('0x54'),0x8));}var _0x14bea8=_0x40720d['user'][_0xe86a('0x55')]({'plain':!![]});if(!_0x14bea8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14bea8['role']==='user'){var _0xdb18d6=_0x438e03['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xe86a('0x28'),'userProfileId':_0x14bea8['userProfileId']},'raw':!![]})['then'](function(_0x464171){if(_0x464171&&_0x464171[_0xe86a('0x56')]===0x0){return db[_0xe86a('0x29')][_0xe86a('0x4b')]({'name':_0xdb18d6[_0xe86a('0x2d')],'resourceId':_0xdb18d6['id'],'type':_0x464171[_0xe86a('0x2d')],'sectionId':_0x464171['id']},{})[_0xe86a('0x27')](function(){return _0x438e03;});}else{return _0x438e03;}})[_0xe86a('0x45')](function(_0x3f1f1c){logger[_0xe86a('0x2b')](_0xe86a('0x57'),_0x3f1f1c);});}return _0x438e03;});})[_0xe86a('0x27')](respondWithResult(_0x317e20,0xc9))[_0xe86a('0x45')](handleError(_0x317e20,null));};exports[_0xe86a('0x2a')]=function(_0x3bfe57,_0x29bae2,_0x490417){var _0x3dc98c;return db[_0xe86a('0x30')][_0xe86a('0x49')]({'where':{'id':_0x3bfe57[_0xe86a('0x46')]['id']}})[_0xe86a('0x27')](function(_0x5a6754){if(_0x5a6754){return db[_0xe86a('0x58')]['transaction'](function(_0x126f54){return _0x5a6754[_0xe86a('0x2a')]({'transaction':_0x126f54,'raw':!![]})[_0xe86a('0x27')](function(_0x3652b8){if(_0x3652b8[_0xe86a('0x4f')]){fs['readdirSync'](_0x3652b8[_0xe86a('0x4f')])[_0xe86a('0x59')](function(_0x2b08e5){fs[_0xe86a('0x5a')](path[_0xe86a('0x50')](_0x3652b8[_0xe86a('0x4f')],_0x2b08e5));});fs['rmdirSync'](_0x3652b8[_0xe86a('0x4f')]);}return _0x3652b8;});})[_0xe86a('0x45')](function(_0x240d5b){throw new db[(_0xe86a('0x5b'))][(_0xe86a('0x5c'))](_0x240d5b[_0xe86a('0x5d')]);});}})['then'](handleEntityNotFound(_0x29bae2,null))[_0xe86a('0x27')](removeEntity(_0x29bae2,null))[_0xe86a('0x45')](handleError(_0x29bae2,null));};exports['addSound']=function(_0x57a5ac,_0x36eacb,_0x9f1fcf){return db[_0xe86a('0x58')][_0xe86a('0x4c')](function(_0xdaa54b){var _0x29f005;return db[_0xe86a('0x30')][_0xe86a('0x49')]({'where':{'id':_0x57a5ac[_0xe86a('0x46')]['id']}})[_0xe86a('0x27')](function(_0x8db9b0){if(_0x8db9b0){_0x29f005=_0x8db9b0;return _0x8db9b0[_0xe86a('0x5e')](_0x57a5ac[_0xe86a('0x4a')]['id'],{'transaction':_0xdaa54b});}})['then'](function(_0x12a20d){if(_0x12a20d){return db[_0xe86a('0x5f')][_0xe86a('0x60')]({'where':{'id':_0x57a5ac[_0xe86a('0x4a')]['id']},'attributes':['id',_0xe86a('0x2d'),_0xe86a('0x61'),_0xe86a('0x62'),_0xe86a('0x63')],'raw':!![]});}})['then'](function(_0x45703d){if(_0x45703d){var _0x56f9e6=path[_0xe86a('0x50')](config[_0xe86a('0x51')],_0xe86a('0x64'),util[_0xe86a('0x65')](_0xe86a('0x66'),path['basename'](_0x45703d[_0xe86a('0x61')],path[_0xe86a('0x67')](_0x45703d[_0xe86a('0x61')])),_0x45703d['converted_format']));var _0x356273=path[_0xe86a('0x50')](config[_0xe86a('0x51')],_0xe86a('0x52'),_0x29f005[_0xe86a('0x2d')],util['format'](_0xe86a('0x66'),_0x45703d[_0xe86a('0x2d')],_0x45703d[_0xe86a('0x62')]));fs[_0xe86a('0x68')](_0x56f9e6,_0x356273);return _0x45703d;}})[_0xe86a('0x45')](function(_0x344b0d){throw new db['Sequelize'][(_0xe86a('0x5c'))](_0x344b0d['message']);});})[_0xe86a('0x27')](handleEntityNotFound(_0x36eacb,null))[_0xe86a('0x27')](respondWithResult(_0x36eacb,0xc9))[_0xe86a('0x45')](handleError(_0x36eacb,null));};exports['removeSound']=function(_0x2de936,_0x204327,_0x92c388){return db['sequelize'][_0xe86a('0x4c')](function(_0x36c8d5){var _0x5148d7;return db[_0xe86a('0x30')][_0xe86a('0x60')]({'where':{'id':_0x2de936[_0xe86a('0x46')]['id']}})['then'](handleEntityNotFound(_0x204327,null))['then'](function(_0x28278e){if(_0x28278e){_0x5148d7=_0x28278e;return _0x28278e['removeSound'](_0x2de936[_0xe86a('0x46')]['id2']);}})[_0xe86a('0x27')](function(_0x189b38){if(_0x189b38){return db[_0xe86a('0x5f')]['findOne']({'where':{'id':_0x2de936[_0xe86a('0x46')]['id2']},'attributes':['id',_0xe86a('0x2d'),_0xe86a('0x61'),_0xe86a('0x62'),_0xe86a('0x63')],'raw':!![]});}})[_0xe86a('0x27')](function(_0x900f99){if(_0x900f99){fs[_0xe86a('0x5a')](path[_0xe86a('0x50')](_0x5148d7[_0xe86a('0x4f')],util[_0xe86a('0x65')]('%s.%s',_0x900f99[_0xe86a('0x2d')],_0x900f99['converted_format'])));return _0x900f99;}})[_0xe86a('0x45')](function(_0x4051ba){throw new db[(_0xe86a('0x5b'))][(_0xe86a('0x5c'))](_0x4051ba['message']);});})[_0xe86a('0x27')](handleEntityNotFound(_0x204327,null))['then'](respondWithStatusCode(_0x204327,0xcc))['catch'](handleError(_0x204327,null));};exports['getSounds']=function(_0x1e56ea,_0x15513a,_0x135ed0){var _0x5c1a93={};var _0x5b2a3e={};var _0x44fd18;var _0x7bca9a;return db[_0xe86a('0x30')]['findOne']({'where':{'id':_0x1e56ea[_0xe86a('0x46')]['id']}})['then'](handleEntityNotFound(_0x15513a,null))[_0xe86a('0x27')](function(_0x298ec9){if(_0x298ec9){_0x44fd18=_0x298ec9;_0x5b2a3e[_0xe86a('0x33')]=_[_0xe86a('0x34')](db[_0xe86a('0x5f')][_0xe86a('0x31')]);_0x5b2a3e[_0xe86a('0x35')]=_[_0xe86a('0x34')](_0x1e56ea['query']);_0x5b2a3e[_0xe86a('0x3d')]=_[_0xe86a('0x36')](_0x5b2a3e['model'],_0x5b2a3e[_0xe86a('0x35')]);_0x5c1a93[_0xe86a('0x37')]=_[_0xe86a('0x36')](_0x5b2a3e[_0xe86a('0x33')],qs['fields'](_0x1e56ea['query'][_0xe86a('0x47')]));_0x5c1a93[_0xe86a('0x37')]=_0x5c1a93[_0xe86a('0x37')][_0xe86a('0x38')]?_0x5c1a93[_0xe86a('0x37')]:_0x5b2a3e[_0xe86a('0x33')];_0x5c1a93['order']=qs[_0xe86a('0x3a')](_0x1e56ea['query'][_0xe86a('0x3a')]);_0x5c1a93[_0xe86a('0x3b')]=qs['filters'](_['pick'](_0x1e56ea[_0xe86a('0x35')],_0x5b2a3e['filters']));if(_0x1e56ea[_0xe86a('0x35')][_0xe86a('0x3e')]){_0x5c1a93[_0xe86a('0x3b')]=_[_0xe86a('0x3f')](_0x5c1a93[_0xe86a('0x3b')],{'$or':_[_0xe86a('0x2f')](_0x5c1a93['attributes'],function(_0x2e3f46){var _0x356c5f={};_0x356c5f[_0x2e3f46]={'$like':'%'+_0x1e56ea[_0xe86a('0x35')][_0xe86a('0x3e')]+'%'};return _0x356c5f;})});}_0x5c1a93=_[_0xe86a('0x3f')]({},_0x5c1a93,_0x1e56ea[_0xe86a('0x48')]);return _0x44fd18['getSounds'](_0x5c1a93);}})[_0xe86a('0x27')](function(_0x3192c6){if(_0x3192c6){_0x7bca9a=_0x3192c6[_0xe86a('0x38')];if(!_0x1e56ea['query'][_0xe86a('0x39')](_0xe86a('0x69'))){_0x5c1a93[_0xe86a('0x20')]=qs[_0xe86a('0x20')](_0x1e56ea[_0xe86a('0x35')]['limit']);_0x5c1a93[_0xe86a('0x1e')]=qs['offset'](_0x1e56ea[_0xe86a('0x35')][_0xe86a('0x1e')]);}return _0x44fd18[_0xe86a('0x6a')](_0x5c1a93);}})[_0xe86a('0x27')](function(_0x2e7324){if(_0x2e7324){return _0x2e7324?{'count':_0x7bca9a,'rows':_0x2e7324}:null;}})[_0xe86a('0x27')](respondWithResult(_0x15513a,null))[_0xe86a('0x45')](handleError(_0x15513a,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 6d8d62a..fc6a933 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 _0x47fb=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0x47fb,0x14f));var _0xb47f=function(_0x2cf2d9,_0x404eeb){_0x2cf2d9=_0x2cf2d9-0x0;var _0x45da3a=_0x47fb[_0x2cf2d9];return _0x45da3a;};'use strict';var _=require(_0xb47f('0x0'));var util=require(_0xb47f('0x1'));var logger=require(_0xb47f('0x2'))('api');var moment=require(_0xb47f('0x3'));var BPromise=require(_0xb47f('0x4'));var rp=require(_0xb47f('0x5'));var fs=require('fs');var path=require(_0xb47f('0x6'));var rimraf=require(_0xb47f('0x7'));var config=require(_0xb47f('0x8'));var attributes=require(_0xb47f('0x9'));module['exports']=function(_0x62fec6,_0x5ad810){return _0x62fec6[_0xb47f('0xa')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe94a=['VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','bluebird','rimraf','./voiceMusicOnHold.attributes','define'];(function(_0x311d14,_0x5765de){var _0x531f34=function(_0x133284){while(--_0x133284){_0x311d14['push'](_0x311d14['shift']());}};_0x531f34(++_0x5765de);}(_0xe94a,0x1b0));var _0xae94=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0xe94a[_0x3074f3];return _0x53f112;};'use strict';var _=require('lodash');var util=require(_0xae94('0x0'));var logger=require(_0xae94('0x1'))(_0xae94('0x2'));var moment=require(_0xae94('0x3'));var BPromise=require(_0xae94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xae94('0x5'));var config=require('../../config/environment');var attributes=require(_0xae94('0x6'));module['exports']=function(_0x10fb63,_0x181039){return _0x10fb63[_0xae94('0x7')](_0xae94('0x8'),attributes,{'tableName':_0xae94('0x9'),'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 e6a2fe0..c2e4f29 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3bbb77,_0x354e05){var _0x25fa9e=function(_0x1f0e42){while(--_0x1f0e42){_0x3bbb77['push'](_0x3bbb77['shift']());}};_0x25fa9e(++_0x354e05);}(_0xe706,0xa3));var _0x6e70=function(_0x173e65,_0x24a8bf){_0x173e65=_0x173e65-0x0;var _0x37d496=_0xe706[_0x173e65];return _0x37d496;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _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(_0x12bff1,_0x44144d){var _0x4790bb=function(_0x1bfdbd){while(--_0x1bfdbd){_0x12bff1['push'](_0x12bff1['shift']());}};_0x4790bb(++_0x44144d);}(_0xedd9,0xfc));var _0x9edd=function(_0x97bfd3,_0x3ee179){_0x97bfd3=_0x97bfd3-0x0;var _0xfb69e6=_0xedd9[_0x97bfd3];return _0xfb69e6;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 2de5c7a..7915e93 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 _0x1af5=['isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','put','update','destroy','removeAgents','delete','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get'];(function(_0x2dc1bf,_0x2ab2bb){var _0x17b430=function(_0x216da0){while(--_0x216da0){_0x2dc1bf['push'](_0x2dc1bf['shift']());}};_0x17b430(++_0x2ab2bb);}(_0x1af5,0x17d));var _0x51af=function(_0x91f464,_0x12f8e8){_0x91f464=_0x91f464-0x0;var _0x4dcf04=_0x1af5[_0x91f464];return _0x4dcf04;};'use strict';var multer=require(_0x51af('0x0'));var util=require('util');var path=require(_0x51af('0x1'));var timeout=require(_0x51af('0x2'));var express=require(_0x51af('0x3'));var router=express[_0x51af('0x4')]();var fs_extra=require(_0x51af('0x5'));var auth=require(_0x51af('0x6'));var interaction=require(_0x51af('0x7'));var config=require(_0x51af('0x8'));var controller=require(_0x51af('0x9'));router[_0x51af('0xa')]('/',auth[_0x51af('0xb')](),controller[_0x51af('0xc')]);router[_0x51af('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x51af('0xd')]);router['get'](_0x51af('0xe'),auth[_0x51af('0xb')](),controller[_0x51af('0xf')]);router[_0x51af('0xa')](_0x51af('0x10'),auth[_0x51af('0xb')](),controller[_0x51af('0x11')]);router['get'](_0x51af('0x12'),auth[_0x51af('0xb')](),controller[_0x51af('0x13')]);router[_0x51af('0x14')]('/',auth[_0x51af('0xb')](),controller['create']);router[_0x51af('0x14')]('/:id/users',auth[_0x51af('0xb')](),controller['addAgents']);router[_0x51af('0x14')](_0x51af('0x12'),auth[_0x51af('0xb')](),controller['addTeams']);router[_0x51af('0x15')](_0x51af('0xe'),auth[_0x51af('0xb')](),controller[_0x51af('0x16')]);router['delete'](_0x51af('0xe'),auth[_0x51af('0xb')](),controller[_0x51af('0x17')]);router['delete']('/:id/users',auth[_0x51af('0xb')](),controller[_0x51af('0x18')]);router[_0x51af('0x19')]('/:id/teams',auth[_0x51af('0xb')](),controller[_0x51af('0x1a')]);module[_0x51af('0x1b')]=router; \ No newline at end of file +var _0x2123=['isAuthenticated','show','getAgents','/:id/teams','getTeams','post','create','/:id/users','addAgents','addTeams','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','describe','/:id'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2123,0x190));var _0x3212=function(_0x1ed284,_0x338e71){_0x1ed284=_0x1ed284-0x0;var _0x3dd3df=_0x2123[_0x1ed284];return _0x3dd3df;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),auth['isAuthenticated'](),controller[_0x3212('0xe')]);router['get'](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x11')]);router[_0x3212('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0x3212('0x12')]);router[_0x3212('0xb')](_0x3212('0x13'),auth[_0x3212('0x10')](),controller[_0x3212('0x14')]);router[_0x3212('0x15')]('/',auth[_0x3212('0x10')](),controller[_0x3212('0x16')]);router[_0x3212('0x15')](_0x3212('0x17'),auth[_0x3212('0x10')](),controller[_0x3212('0x18')]);router[_0x3212('0x15')](_0x3212('0x13'),auth[_0x3212('0x10')](),controller[_0x3212('0x19')]);router[_0x3212('0x1a')](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x1b')]);router[_0x3212('0x1c')](_0x3212('0xf'),auth['isAuthenticated'](),controller[_0x3212('0x1d')]);router[_0x3212('0x1c')](_0x3212('0x17'),auth[_0x3212('0x10')](),controller[_0x3212('0x1e')]);router[_0x3212('0x1c')](_0x3212('0x13'),auth['isAuthenticated'](),controller['removeTeams']);module[_0x3212('0x1f')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index af8fc66..f391877 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 _0xe15b=['sequelize','exports','STRING','name','VIRTUAL','getDataValue','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe15b,0x188));var _0xbe15=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xe15b[_0x238671];return _0x474844;};'use strict';var Sequelize=require(_0xbe15('0x0'));module[_0xbe15('0x1')]={'name':{'type':Sequelize[_0xbe15('0x2')],'allowNull':![],'unique':_0xbe15('0x3')},'prefix':{'type':Sequelize[_0xbe15('0x4')],'get':function(_0x3e25ec){return'system-'+this[_0xbe15('0x5')](_0xbe15('0x3'))+'-';}},'description':{'type':Sequelize[_0xbe15('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xbe15('0x6')]}}; \ No newline at end of file +var _0xc129=['name','VIRTUAL','system-','getDataValue','STRING','INTEGER','exports'];(function(_0x5c1a30,_0x7ff5e0){var _0x41fe6b=function(_0x43de64){while(--_0x43de64){_0x5c1a30['push'](_0x5c1a30['shift']());}};_0x41fe6b(++_0x7ff5e0);}(_0xc129,0x19c));var _0x9c12=function(_0x4932a6,_0x530e29){_0x4932a6=_0x4932a6-0x0;var _0x3b45b9=_0xc129[_0x4932a6];return _0x3b45b9;};'use strict';var Sequelize=require('sequelize');module[_0x9c12('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9c12('0x1')},'prefix':{'type':Sequelize[_0x9c12('0x2')],'get':function(_0x380765){return _0x9c12('0x3')+this[_0x9c12('0x4')](_0x9c12('0x1'))+'-';}},'description':{'type':Sequelize[_0x9c12('0x5')]},'callerIdAll':{'type':Sequelize[_0x9c12('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x9c12('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 15a46cc..eb5abb3 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 _0xb44a=['../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','destroy','end','error','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','description','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','prefix','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','getTeams','nolimit','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_voice_prefixes','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','every','includes','all','union','removeTeams','isEmpty','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x38fb8b,_0x70dd0a){var _0x1ec681=function(_0x58f130){while(--_0x58f130){_0x38fb8b['push'](_0x38fb8b['shift']());}};_0x1ec681(++_0x70dd0a);}(_0xb44a,0x1c2));var _0xab44=function(_0x44c742,_0x5d69a4){_0x44c742=_0x44c742-0x0;var _0x40fcf0=_0xb44a[_0x44c742];return _0x40fcf0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab44('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab44('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab44('0x2'));var util=require('util');var path=require(_0xab44('0x3'));var sox=require(_0xab44('0x4'));var csv=require(_0xab44('0x5'));var ejs=require(_0xab44('0x6'));var fs=require('fs');var fs_extra=require(_0xab44('0x7'));var _=require(_0xab44('0x8'));var squel=require(_0xab44('0x9'));var crypto=require(_0xab44('0xa'));var jsforce=require(_0xab44('0xb'));var deskjs=require(_0xab44('0xc'));var toCsv=require(_0xab44('0x5'));var querystring=require(_0xab44('0xd'));var Papa=require(_0xab44('0xe'));var Redis=require('ioredis');var authService=require(_0xab44('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab44('0x11'));var utils=require(_0xab44('0x12'));var config=require(_0xab44('0x13'));var licenseUtil=require(_0xab44('0x14'));var db=require(_0xab44('0x15'))['db'];config[_0xab44('0x16')]=_['defaults'](config['redis'],{'host':_0xab44('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab44('0x16')]));require('./voicePrefix.socket')[_0xab44('0x18')](socket);function respondWithStatusCode(_0x15b98a,_0x344e6b){_0x344e6b=_0x344e6b||0xcc;return function(_0x384f02){if(_0x384f02){return _0x15b98a[_0xab44('0x19')](_0x344e6b);}return _0x15b98a[_0xab44('0x1a')](_0x344e6b)['end']();};}function respondWithResult(_0x51251b,_0x44c85e){_0x44c85e=_0x44c85e||0xc8;return function(_0x272a5b){if(_0x272a5b){return _0x51251b[_0xab44('0x1a')](_0x44c85e)[_0xab44('0x1b')](_0x272a5b);}};}function respondWithFilteredResult(_0xffdfbc,_0x5fd6a1){return function(_0x354b09){if(_0x354b09){var _0x44fa43=typeof _0x5fd6a1[_0xab44('0x1c')]===_0xab44('0x1d')&&typeof _0x5fd6a1[_0xab44('0x1e')]==='undefined';var _0xb779bb=_0x354b09[_0xab44('0x1f')];var _0x101a1b=_0x44fa43?0x0:_0x5fd6a1[_0xab44('0x1c')];var _0x29bb73=_0x44fa43?_0x354b09['count']:_0x5fd6a1[_0xab44('0x1c')]+_0x5fd6a1['limit'];var _0x1f7311;if(_0x29bb73>=_0xb779bb){_0x29bb73=_0xb779bb;_0x1f7311=0xc8;}else{_0x1f7311=0xce;}_0xffdfbc[_0xab44('0x1a')](_0x1f7311);return _0xffdfbc[_0xab44('0x20')](_0xab44('0x21'),_0x101a1b+'-'+_0x29bb73+'/'+_0xb779bb)['json'](_0x354b09);}return null;};}function patchUpdates(_0x3a2b1d){return function(_0x26fc03){try{jsonpatch[_0xab44('0x22')](_0x26fc03,_0x3a2b1d,!![]);}catch(_0x3b17d5){return BPromise[_0xab44('0x23')](_0x3b17d5);}return _0x26fc03[_0xab44('0x24')]();};}function saveUpdates(_0x43f1c6,_0x554955){return function(_0x595761){if(_0x595761){return _0x595761[_0xab44('0x25')](_0x43f1c6)['then'](function(_0x2439f3){return _0x2439f3;});}return null;};}function removeEntity(_0x5a7269,_0x2a1bbc){return function(_0x5ac42f){if(_0x5ac42f){return _0x5ac42f['destroy']()[_0xab44('0x26')](function(){var _0x25287b=_0x5ac42f[_0xab44('0x27')]({'plain':!![]});var _0x4620ed=_0xab44('0x28');return db['UserProfileResource'][_0xab44('0x29')]({'where':{'type':_0x4620ed,'resourceId':_0x25287b['id']}})[_0xab44('0x26')](function(){return _0x5ac42f;});})['then'](function(){_0x5a7269[_0xab44('0x1a')](0xcc)[_0xab44('0x2a')]();});}};}function handleEntityNotFound(_0x21131e,_0x1cd486){return function(_0x4550c8){if(!_0x4550c8){_0x21131e[_0xab44('0x19')](0x194);}return _0x4550c8;};}function handleError(_0x59f844,_0x22f28e){_0x22f28e=_0x22f28e||0x1f4;return function(_0x43a42d){logger[_0xab44('0x2b')](_0x43a42d['stack']);if(_0x43a42d['name']){delete _0x43a42d[_0xab44('0x2c')];}_0x59f844['status'](_0x22f28e)['send'](_0x43a42d);};}exports[_0xab44('0x2d')]=function(_0x2f8a1d,_0x160177){var _0x1e9715={},_0x1192a8={},_0x475f09={'count':0x0,'rows':[]};var _0x17e4ea=_[_0xab44('0x2e')](db[_0xab44('0x2f')][_0xab44('0x30')],function(_0x43aa7f){return{'name':_0x43aa7f[_0xab44('0x31')],'type':_0x43aa7f[_0xab44('0x32')][_0xab44('0x33')]};});_0x1192a8['model']=_['map'](_0x17e4ea,_0xab44('0x2c'));_0x1192a8[_0xab44('0x34')]=_['keys'](_0x2f8a1d[_0xab44('0x34')]);_0x1192a8[_0xab44('0x35')]=_[_0xab44('0x36')](_0x1192a8[_0xab44('0x37')],_0x1192a8[_0xab44('0x34')]);_0x1e9715[_0xab44('0x38')]=_[_0xab44('0x36')](_0x1192a8[_0xab44('0x37')],qs[_0xab44('0x39')](_0x2f8a1d[_0xab44('0x34')][_0xab44('0x39')]));_0x1e9715[_0xab44('0x38')]=_0x1e9715[_0xab44('0x38')][_0xab44('0x3a')]?_0x1e9715[_0xab44('0x38')]:_0x1192a8[_0xab44('0x37')];if(!_0x2f8a1d[_0xab44('0x34')][_0xab44('0x3b')]('nolimit')){_0x1e9715[_0xab44('0x1e')]=qs[_0xab44('0x1e')](_0x2f8a1d[_0xab44('0x34')][_0xab44('0x1e')]);_0x1e9715['offset']=qs[_0xab44('0x1c')](_0x2f8a1d[_0xab44('0x34')][_0xab44('0x1c')]);}_0x1e9715[_0xab44('0x3c')]=qs[_0xab44('0x3d')](_0x2f8a1d['query'][_0xab44('0x3d')]);_0x1e9715[_0xab44('0x3e')]=qs[_0xab44('0x35')](_['pick'](_0x2f8a1d[_0xab44('0x34')],_0x1192a8[_0xab44('0x35')]),_0x17e4ea);if(_0x2f8a1d[_0xab44('0x34')][_0xab44('0x3f')]){_0x1e9715[_0xab44('0x3e')]=_['merge'](_0x1e9715[_0xab44('0x3e')],{'$or':_['map'](_0x17e4ea,function(_0x8b55da){if(_0x8b55da['type']!=='VIRTUAL'){var _0x5aa438={};_0x5aa438[_0x8b55da['name']]={'$like':'%'+_0x2f8a1d['query'][_0xab44('0x3f')]+'%'};return _0x5aa438;}})});}_0x1e9715=_[_0xab44('0x40')]({},_0x1e9715,_0x2f8a1d[_0xab44('0x41')]);var _0x1aec00={'where':_0x1e9715[_0xab44('0x3e')]};return db[_0xab44('0x2f')][_0xab44('0x1f')](_0x1aec00)[_0xab44('0x26')](function(_0x4429e6){_0x475f09[_0xab44('0x1f')]=_0x4429e6;if(_0x2f8a1d['query'][_0xab44('0x42')]){_0x1e9715[_0xab44('0x43')]=[{'all':!![]}];}return db[_0xab44('0x2f')][_0xab44('0x44')](_0x1e9715);})['then'](function(_0x3e9a79){_0x475f09[_0xab44('0x45')]=_0x3e9a79;return _0x475f09;})[_0xab44('0x26')](respondWithFilteredResult(_0x160177,_0x1e9715))[_0xab44('0x46')](handleError(_0x160177,null));};exports[_0xab44('0x47')]=function(_0x436cd8,_0x4d4421){var _0x5bb256={'raw':![],'where':{'id':_0x436cd8[_0xab44('0x48')]['id']}},_0x2dd6f8={};_0x2dd6f8[_0xab44('0x37')]=_[_0xab44('0x49')](db[_0xab44('0x2f')]['rawAttributes']);_0x2dd6f8[_0xab44('0x34')]=_[_0xab44('0x49')](_0x436cd8[_0xab44('0x34')]);_0x2dd6f8[_0xab44('0x35')]=_['intersection'](_0x2dd6f8[_0xab44('0x37')],_0x2dd6f8[_0xab44('0x34')]);_0x5bb256[_0xab44('0x38')]=_['intersection'](_0x2dd6f8[_0xab44('0x37')],qs[_0xab44('0x39')](_0x436cd8[_0xab44('0x34')][_0xab44('0x39')]));_0x5bb256['attributes']=_0x5bb256[_0xab44('0x38')]['length']?_0x5bb256[_0xab44('0x38')]:_0x2dd6f8[_0xab44('0x37')];if(_0x436cd8[_0xab44('0x34')][_0xab44('0x42')]){_0x5bb256['include']=[{'all':!![]}];}_0x5bb256=_[_0xab44('0x40')]({},_0x5bb256,_0x436cd8['options']);return db[_0xab44('0x2f')][_0xab44('0x4a')](_0x5bb256)[_0xab44('0x26')](handleEntityNotFound(_0x4d4421,null))[_0xab44('0x26')](respondWithResult(_0x4d4421,null))[_0xab44('0x46')](handleError(_0x4d4421,null));};exports['destroy']=function(_0x4736fd,_0x53ef06){return db[_0xab44('0x2f')][_0xab44('0x4a')]({'where':{'id':_0x4736fd[_0xab44('0x48')]['id']}})['then'](handleEntityNotFound(_0x53ef06,null))[_0xab44('0x26')](removeEntity(_0x53ef06,null))[_0xab44('0x46')](handleError(_0x53ef06,null));};exports[_0xab44('0x4b')]=function(_0x160232,_0x41f946){return db['VoicePrefix']['describe']()[_0xab44('0x26')](respondWithResult(_0x41f946,null))[_0xab44('0x46')](handleError(_0x41f946,null));};exports[_0xab44('0x4c')]=function(_0x51ee03,_0x11bcd9){var _0x1bf44b;return db[_0xab44('0x4d')][_0xab44('0x4e')](function(_0x4eb2eb){return db['VoicePrefix'][_0xab44('0x4c')](_0x51ee03[_0xab44('0x4f')],{'transaction':_0x4eb2eb})[_0xab44('0x26')](function(_0x1e5731){_0x1bf44b=_0x1e5731[_0xab44('0x27')]({'plain':!![]});return db[_0xab44('0x50')][_0xab44('0x4a')]({'where':{'id':_0x1bf44b[_0xab44('0x51')]},'raw':!![]})['then'](function(_0x496e6d){return createVoicePrefixExtensions(_0x1bf44b,_0x496e6d,_0x4eb2eb);});});})[_0xab44('0x26')](function(){var _0x39bc1b=_0x51ee03[_0xab44('0x52')][_0xab44('0x27')]({'plain':!![]});if(!_0x39bc1b)throw new Error(_0xab44('0x53'));if(_0x39bc1b[_0xab44('0x54')]===_0xab44('0x52')){var _0x411bac=_0x1bf44b;return db[_0xab44('0x55')]['find']({'where':{'name':_0xab44('0x28'),'userProfileId':_0x39bc1b[_0xab44('0x56')]},'raw':!![]})[_0xab44('0x26')](function(_0xf8edd8){if(_0xf8edd8&&_0xf8edd8[_0xab44('0x57')]===0x0){return db[_0xab44('0x58')][_0xab44('0x4c')]({'name':_0x411bac[_0xab44('0x2c')],'resourceId':_0x411bac['id'],'type':_0xf8edd8['name'],'sectionId':_0xf8edd8['id']},{})['then'](function(){return _0x1bf44b;});}else{return _0x1bf44b;}})[_0xab44('0x46')](function(_0x35b4bc){logger[_0xab44('0x2b')](_0xab44('0x59'),_0x35b4bc);throw _0x35b4bc;});}return _0x1bf44b;})[_0xab44('0x26')](respondWithResult(_0x11bcd9,null))[_0xab44('0x46')](handleError(_0x11bcd9,null));};function Extension(_0x29fdb2,_0x41c4aa,_0x5b238d,_0x4d6a68){this['context']='from-sip';this[_0xab44('0x5a')]=_0x29fdb2;this[_0xab44('0x5b')]=_0x5b238d;this[_0xab44('0x32')]=_0xab44('0x5c');this[_0xab44('0x5d')]='Voice\x20Prefix\x20Extension';this[_0xab44('0x5e')]=_0x41c4aa;this[_0xab44('0x5f')]=_0x4d6a68;}function createVoicePrefixExtensions(_0x1e32d9,_0x32f92e,_0x1ef3af){return new BPromise(function(_0x255ec7,_0x205168){var _0x3a982b=new Extension(formatPrefixName(_0x1e32d9['prefix']),0x1,_0xab44('0x60'),_0xab44('0x61'));_0x3a982b[_0xab44('0x62')]=_0x1e32d9['id'];return db[_0xab44('0x50')]['create'](_0x3a982b,{'transaction':_0x1ef3af})[_0xab44('0x26')](function(_0x56401c){var _0x47ecdc=_0x56401c[_0xab44('0x27')]({'plain':!![]});var _0x5718fc=_['map'](addVoicePrefixExtensions(_0x1e32d9,_0x32f92e),function(_0x1daf6c){_0x1daf6c[_0xab44('0x51')]=_0x47ecdc['id'];_0x1daf6c[_0xab44('0x62')]=_0x1e32d9['id'];return _0x1daf6c;});return db[_0xab44('0x50')][_0xab44('0x63')](_0x5718fc,{'transaction':_0x1ef3af})['then'](function(_0x242795){if(!_0x242795){return _0x205168(_0xab44('0x64'));}else{return _0x255ec7(_0x242795);}})[_0xab44('0x46')](function(_0x3ad244){return _0x205168(_0x3ad244);});});;});};function addVoicePrefixExtensions(_0x45a9b4,_0x81b522){var _0x50558d=[];var _0x5ecf43=formatPrefixName(_0x45a9b4['prefix']);_0x50558d[_0xab44('0x65')](new Extension(_0x5ecf43,0x2,_0xab44('0x66'),'CDR(prefix)='+_0x45a9b4[_0xab44('0x2c')]));if(_0x45a9b4[_0xab44('0x67')]){_0x50558d[_0xab44('0x65')](new Extension(_0x5ecf43,0x3,_0xab44('0x66'),_0xab44('0x68')+_0x45a9b4[_0xab44('0x67')]));}else{_0x50558d[_0xab44('0x65')](new Extension(_0x5ecf43,0x3,_0xab44('0x60'),_0xab44('0x69')));}_0x50558d[_0xab44('0x65')](new Extension(_0x5ecf43,0x4,_0xab44('0x6a'),_0x81b522[_0xab44('0x6b')]+','+_0xab44('0x6c')+(0x8+_0x45a9b4[_0xab44('0x2c')][_0xab44('0x3a')])+'}'+','+0x1));return _0x50558d;}function formatPrefixName(_0x3f0eb0){var _0x445555='_';for(var _0x3c0668=0x0;_0x3c0668<_0x3f0eb0[_0xab44('0x3a')];_0x3c0668++){if(_0x3f0eb0[_0xab44('0x6d')](_0x3c0668)=='-'){_0x445555+=_0x3f0eb0[_0xab44('0x6d')](_0x3c0668);}else{_0x445555+='['+_0x3f0eb0[_0xab44('0x6d')](_0x3c0668)+']';}}_0x445555+='.';return _0x445555;}exports[_0xab44('0x25')]=function(_0x24055f,_0x315b00,_0x15dd86){var _0xd8a908=_0x24055f['body'];_0xd8a908[_0xab44('0x6e')]='system-'+_0xd8a908[_0xab44('0x2c')]+'-';return db[_0xab44('0x4d')][_0xab44('0x4e')](function(_0x169139){return db[_0xab44('0x2f')][_0xab44('0x25')](_0xd8a908,{'where':{'id':_0xd8a908['id']},'transaction':_0x169139})[_0xab44('0x26')](function(){return db[_0xab44('0x50')][_0xab44('0x29')]({'where':{'VoicePrefixId':_0xd8a908['id']},'transaction':_0x169139})[_0xab44('0x26')](function(){return db[_0xab44('0x50')]['find']({'where':{'id':_0xd8a908[_0xab44('0x51')]},'raw':!![]})[_0xab44('0x26')](function(_0x4e8352){return createVoicePrefixExtensions(_0xd8a908,_0x4e8352,_0x169139);});});});})[_0xab44('0x26')](function(){return db['VoicePrefix'][_0xab44('0x6f')](_0xd8a908['id']);})[_0xab44('0x26')](respondWithResult(_0x315b00,null))[_0xab44('0x46')](handleError(_0x315b00,null));};exports[_0xab44('0x70')]=function(_0x2f523f,_0x9115d9,_0x114499){return db['VoicePrefix'][_0xab44('0x4a')]({'where':{'id':_0x2f523f['params']['id']}})[_0xab44('0x26')](handleEntityNotFound(_0x9115d9,null))['then'](function(_0x1078ff){if(_0x1078ff){return _0x1078ff[_0xab44('0x70')](_0x2f523f[_0xab44('0x4f')][_0xab44('0x71')],_[_0xab44('0x72')](_0x2f523f[_0xab44('0x4f')],[_0xab44('0x71'),'id'])||{})['spread'](function(_0x5ab4b5){for(var _0x4baedb=0x0;_0x4baedb<_0x2f523f[_0xab44('0x4f')]['ids'][_0xab44('0x3a')];_0x4baedb+=0x1){socket[_0xab44('0x73')](_0xab44('0x74'),{'UserId':Number(_0x2f523f[_0xab44('0x4f')][_0xab44('0x71')][_0x4baedb]),'VoicePrefixId':Number(_0x2f523f['params']['id'])});}return _0x5ab4b5;});}})[_0xab44('0x26')](respondWithResult(_0x9115d9,null))[_0xab44('0x46')](handleError(_0x9115d9,null));};exports[_0xab44('0x75')]=function(_0x5387d5,_0xa7bbeb,_0x4ac1a2){return db[_0xab44('0x2f')][_0xab44('0x4a')]({'where':{'id':_0x5387d5[_0xab44('0x48')]['id']}})[_0xab44('0x26')](handleEntityNotFound(_0xa7bbeb,null))[_0xab44('0x26')](function(_0x690755){if(_0x690755){return _0x690755[_0xab44('0x75')](_0x5387d5[_0xab44('0x34')][_0xab44('0x71')])[_0xab44('0x26')](function(){if(_[_0xab44('0x76')](_0x5387d5[_0xab44('0x34')][_0xab44('0x71')])){for(var _0x491112=0x0;_0x491112<_0x5387d5['query'][_0xab44('0x71')][_0xab44('0x3a')];_0x491112+=0x1){socket['emit'](_0xab44('0x77'),{'UserId':Number(_0x5387d5[_0xab44('0x34')][_0xab44('0x71')][_0x491112]),'VoicePrefixId':Number(_0x5387d5[_0xab44('0x48')]['id'])});}}else{socket[_0xab44('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x5387d5[_0xab44('0x34')][_0xab44('0x71')]),'VoicePrefixId':Number(_0x5387d5['params']['id'])});}});}})['then'](respondWithStatusCode(_0xa7bbeb,null))['catch'](handleError(_0xa7bbeb,null));};exports['getAgents']=function(_0x3846d7,_0x13b63b,_0x630390){var _0x345c5e={};var _0x43c787={};var _0x4338dd;var _0x4fc173;return db[_0xab44('0x2f')][_0xab44('0x78')]({'where':{'id':_0x3846d7['params']['id']}})['then'](handleEntityNotFound(_0x13b63b,null))[_0xab44('0x26')](function(_0x1814ea){if(_0x1814ea){_0x4338dd=_0x1814ea;_0x43c787['model']=_[_0xab44('0x49')](db[_0xab44('0x79')][_0xab44('0x30')]);_0x43c787['query']=_[_0xab44('0x49')](_0x3846d7[_0xab44('0x34')]);_0x43c787[_0xab44('0x35')]=_[_0xab44('0x36')](_0x43c787[_0xab44('0x37')],_0x43c787[_0xab44('0x34')]);_0x345c5e[_0xab44('0x38')]=_['intersection'](_0x43c787['model'],qs[_0xab44('0x39')](_0x3846d7[_0xab44('0x34')][_0xab44('0x39')]));_0x345c5e[_0xab44('0x38')]=_0x345c5e[_0xab44('0x38')]['length']?_0x345c5e[_0xab44('0x38')]:_0x43c787[_0xab44('0x37')];_0x345c5e['order']=qs['sort'](_0x3846d7[_0xab44('0x34')][_0xab44('0x3d')]);_0x345c5e[_0xab44('0x3e')]=qs[_0xab44('0x35')](_[_0xab44('0x7a')](_0x3846d7['query'],_0x43c787[_0xab44('0x35')]));if(_0x3846d7[_0xab44('0x34')][_0xab44('0x3f')]){_0x345c5e[_0xab44('0x3e')]=_[_0xab44('0x40')](_0x345c5e['where'],{'$or':_[_0xab44('0x2e')](_0x345c5e[_0xab44('0x38')],function(_0x493533){var _0x3bee2e={};_0x3bee2e[_0x493533]={'$like':'%'+_0x3846d7[_0xab44('0x34')][_0xab44('0x3f')]+'%'};return _0x3bee2e;})});}_0x345c5e=_['merge']({},_0x345c5e,_0x3846d7[_0xab44('0x41')]);return _0x4338dd[_0xab44('0x7b')](_0x345c5e);}})[_0xab44('0x26')](function(_0x685026){if(_0x685026){_0x4fc173=_0x685026[_0xab44('0x3a')];if(!_0x3846d7[_0xab44('0x34')][_0xab44('0x3b')]('nolimit')){_0x345c5e[_0xab44('0x1e')]=qs[_0xab44('0x1e')](_0x3846d7['query'][_0xab44('0x1e')]);_0x345c5e[_0xab44('0x1c')]=qs[_0xab44('0x1c')](_0x3846d7[_0xab44('0x34')][_0xab44('0x1c')]);}return _0x4338dd[_0xab44('0x7b')](_0x345c5e);}})[_0xab44('0x26')](function(_0x40ee04){if(_0x40ee04){return _0x40ee04?{'count':_0x4fc173,'rows':_0x40ee04}:null;}})[_0xab44('0x26')](respondWithResult(_0x13b63b,null))[_0xab44('0x46')](handleError(_0x13b63b,null));};exports[_0xab44('0x7c')]=function(_0x1c96ef,_0xa5033e,_0x5e8820){var _0x41b30b={};var _0x5e93de={};var _0x476957;var _0x594482;return db[_0xab44('0x2f')][_0xab44('0x78')]({'where':{'id':_0x1c96ef[_0xab44('0x48')]['id']}})[_0xab44('0x26')](handleEntityNotFound(_0xa5033e,null))[_0xab44('0x26')](function(_0x1a25cd){if(_0x1a25cd){_0x476957=_0x1a25cd;_0x5e93de[_0xab44('0x37')]=_[_0xab44('0x49')](db['Team']['rawAttributes']);_0x5e93de['query']=_['keys'](_0x1c96ef[_0xab44('0x34')]);_0x5e93de[_0xab44('0x35')]=_[_0xab44('0x36')](_0x5e93de['model'],_0x5e93de['query']);_0x41b30b['attributes']=_['intersection'](_0x5e93de[_0xab44('0x37')],qs[_0xab44('0x39')](_0x1c96ef[_0xab44('0x34')][_0xab44('0x39')]));_0x41b30b['attributes']=_0x41b30b[_0xab44('0x38')][_0xab44('0x3a')]?_0x41b30b[_0xab44('0x38')]:_0x5e93de['model'];_0x41b30b[_0xab44('0x3c')]=qs[_0xab44('0x3d')](_0x1c96ef[_0xab44('0x34')][_0xab44('0x3d')]);_0x41b30b[_0xab44('0x3e')]=qs[_0xab44('0x35')](_['pick'](_0x1c96ef[_0xab44('0x34')],_0x5e93de[_0xab44('0x35')]));if(_0x1c96ef[_0xab44('0x34')]['filter']){_0x41b30b[_0xab44('0x3e')]=_['merge'](_0x41b30b[_0xab44('0x3e')],{'$or':_[_0xab44('0x2e')](_0x41b30b[_0xab44('0x38')],function(_0x1798c7){var _0x5e44d0={};_0x5e44d0[_0x1798c7]={'$like':'%'+_0x1c96ef[_0xab44('0x34')]['filter']+'%'};return _0x5e44d0;})});}_0x41b30b=_[_0xab44('0x40')]({},_0x41b30b,_0x1c96ef[_0xab44('0x41')]);return _0x476957[_0xab44('0x7c')](_0x41b30b);}})[_0xab44('0x26')](function(_0x41a7bc){if(_0x41a7bc){_0x594482=_0x41a7bc[_0xab44('0x3a')];if(!_0x1c96ef[_0xab44('0x34')][_0xab44('0x3b')](_0xab44('0x7d'))){_0x41b30b[_0xab44('0x1e')]=qs[_0xab44('0x1e')](_0x1c96ef['query'][_0xab44('0x1e')]);_0x41b30b[_0xab44('0x1c')]=qs[_0xab44('0x1c')](_0x1c96ef['query'][_0xab44('0x1c')]);}return _0x476957[_0xab44('0x7c')](_0x41b30b);}})[_0xab44('0x26')](function(_0x4c8a45){if(_0x4c8a45){return _0x4c8a45?{'count':_0x594482,'rows':_0x4c8a45}:null;}})[_0xab44('0x26')](respondWithResult(_0xa5033e,null))[_0xab44('0x46')](handleError(_0xa5033e,null));};exports[_0xab44('0x7e')]=function(_0x5d0a30,_0x545819,_0x2b71dc){var _0x3d56cb=_0x5d0a30['body']['ids'];var _0x1033a;return db[_0xab44('0x7f')][_0xab44('0x44')]({'where':{'id':_0x3d56cb},'attributes':['id'],'include':[{'model':db[_0xab44('0x79')],'as':_0xab44('0x80'),'attributes':['id','name',_0xab44('0x81'),_0xab44('0x82'),_0xab44('0x83')],'raw':!![]}]})[_0xab44('0x26')](function(_0x4bdb57){if(_0x4bdb57){_0x1033a=_0x4bdb57;var _0x101332=_[_0xab44('0x84')](_0x4bdb57,function(_0x5802ff){var _0x286dbf=_0x5802ff[_0xab44('0x27')]({'plain':!![]});return _0x286dbf[_0xab44('0x80')];});return db[_0xab44('0x2f')][_0xab44('0x4a')]({'where':{'id':_0x5d0a30['params']['id']}})[_0xab44('0x26')](function(_0x37bfc1){return db[_0xab44('0x4d')][_0xab44('0x4e')](function(_0x2271d4){return _0x37bfc1['addTeams'](_0x3d56cb,{'transaction':_0x2271d4})[_0xab44('0x26')](function(){return BPromise[_0xab44('0x85')](_0x1033a,function(_0x2f00b7){return db[_0xab44('0x86')][_0xab44('0x87')]({'TeamId':_0x2f00b7['id'],'VoicePrefixId':_0x5d0a30['params']['id']},{'transaction':_0x2271d4});});})[_0xab44('0x26')](function(){return BPromise['each'](_0x101332,function(_0x1aa45c){return db[_0xab44('0x88')][_0xab44('0x89')]({'where':{'UserId':_0x1aa45c['id'],'VoicePrefixId':_0x5d0a30['params']['id']},'transaction':_0x2271d4});});})['then'](function(){_0x101332[_0xab44('0x8a')](function(_0x114e4e){socket['emit'](_0xab44('0x74'),{'UserId':_0x114e4e['id'],'VoicePrefixId':_0x37bfc1['id']});});});});});}})[_0xab44('0x26')](respondWithStatusCode(_0x545819,null))[_0xab44('0x46')](handleError(_0x545819,null));};exports['removeTeams']=function(_0x528b00,_0xa0e3ff,_0x460778){return db[_0xab44('0x7f')][_0xab44('0x44')]({'where':{'id':_0x528b00['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xab44('0x79')],'as':_0xab44('0x80'),'attributes':['id'],'raw':!![]}]})[_0xab44('0x26')](handleEntityNotFound(_0xa0e3ff,null))[_0xab44('0x26')](function(_0x4c299f){var _0x4e7857=_[_0xab44('0x2e')](_0x4c299f,'id');var _0x322cff=[];var _0x1525ad=[];var _0xe27f2c=squel[_0xab44('0x8b')]();_0xe27f2c[_0xab44('0x8c')](_0xab44('0x8d'))[_0xab44('0x8e')](_0xab44('0x8f'),'tq')['join']('user_has_teams','ut',_0xab44('0x90'))[_0xab44('0x3e')]('VoicePrefixId\x20=\x20?',_0x528b00[_0xab44('0x48')]['id']);for(var _0x544b82=0x0;_0x544b82<_0x4c299f[_0xab44('0x3a')];_0x544b82+=0x1){let _0x495ef4=_0x4c299f[_0x544b82];for(var _0x471790=0x0;_0x471790<_0x495ef4[_0xab44('0x80')][_0xab44('0x3a')];_0x471790+=0x1){let _0x5c77ed=_0x495ef4['Agents'][_0x471790];var _0x21fbb5=_0xe27f2c[_0xab44('0x91')]();_0x21fbb5['where'](_0xab44('0x92'),_0x5c77ed['id']);_0x1525ad['push'](db[_0xab44('0x4d')][_0xab44('0x34')](_0x21fbb5[_0xab44('0x93')](),{'type':db[_0xab44('0x4d')]['QueryTypes'][_0xab44('0x94')]})[_0xab44('0x26')](function(_0x48b47c){if(_0x48b47c[_0xab44('0x3a')]===0x1){return _0x5c77ed['id'];}else{var _0x4696f3=_[_0xab44('0x95')](_[_0xab44('0x2e')](_0x48b47c,'TeamId'),function(_0x3bbb88){return _[_0xab44('0x96')](_0x4e7857,_0x3bbb88);});if(_0x4696f3){return _0x5c77ed['id'];}}}));}}return BPromise[_0xab44('0x97')](_0x1525ad)['then'](function(_0x415556){_0x322cff=_(_0x322cff)[_0xab44('0x98')](_0x415556)['compact']()['value']();return db['VoicePrefix'][_0xab44('0x4a')]({'where':{'id':_0x528b00[_0xab44('0x48')]['id']}})[_0xab44('0x26')](function(_0x54a64f){return db['sequelize'][_0xab44('0x4e')](function(_0x1988bc){return _0x54a64f[_0xab44('0x99')](_0x528b00[_0xab44('0x34')][_0xab44('0x71')],{'transaction':_0x1988bc})[_0xab44('0x26')](function(){if(!_[_0xab44('0x9a')](_0x322cff)){return _0x54a64f[_0xab44('0x75')](_0x322cff,{'transaction':_0x1988bc});}})['then'](function(){_0x322cff['forEach'](function(_0xb093c4){socket[_0xab44('0x73')](_0xab44('0x77'),{'UserId':_0xb093c4,'VoicePrefixId':_0x54a64f['id']});});});});});});})['then'](respondWithStatusCode(_0xa0e3ff,null))[_0xab44('0x46')](handleError(_0xa0e3ff,null));}; \ No newline at end of file +var _0x58a4=['addAgents','omit','ids','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','getTeams','Team','User','Agents','online','voicePause','interface','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','describe','create','sequelize','transaction','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','body','system-','findById'];(function(_0x3e7b39,_0x2c2110){var _0x4ad001=function(_0x3fd134){while(--_0x3fd134){_0x3e7b39['push'](_0x3e7b39['shift']());}};_0x4ad001(++_0x2c2110);}(_0x58a4,0xbf));var _0x458a=function(_0x4670df,_0x433288){_0x4670df=_0x4670df-0x0;var _0x326082=_0x58a4[_0x4670df];return _0x326082;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];config[_0x458a('0x1a')]=_[_0x458a('0x1b')](config[_0x458a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x458a('0x1a')]));require('./voicePrefix.socket')[_0x458a('0x1c')](socket);function respondWithStatusCode(_0x44f683,_0x10133b){_0x10133b=_0x10133b||0xcc;return function(_0x3b74f9){if(_0x3b74f9){return _0x44f683[_0x458a('0x1d')](_0x10133b);}return _0x44f683[_0x458a('0x1e')](_0x10133b)['end']();};}function respondWithResult(_0x4b26be,_0x5c7993){_0x5c7993=_0x5c7993||0xc8;return function(_0x2faf6a){if(_0x2faf6a){return _0x4b26be[_0x458a('0x1e')](_0x5c7993)[_0x458a('0x1f')](_0x2faf6a);}};}function respondWithFilteredResult(_0x5c5b41,_0x310569){return function(_0x260c87){if(_0x260c87){var _0x18504d=typeof _0x310569[_0x458a('0x20')]===_0x458a('0x21')&&typeof _0x310569['limit']==='undefined';var _0x178db9=_0x260c87['count'];var _0x3302b7=_0x18504d?0x0:_0x310569[_0x458a('0x20')];var _0x47a202=_0x18504d?_0x260c87[_0x458a('0x22')]:_0x310569['offset']+_0x310569[_0x458a('0x23')];var _0x1c79cb;if(_0x47a202>=_0x178db9){_0x47a202=_0x178db9;_0x1c79cb=0xc8;}else{_0x1c79cb=0xce;}_0x5c5b41['status'](_0x1c79cb);return _0x5c5b41[_0x458a('0x24')](_0x458a('0x25'),_0x3302b7+'-'+_0x47a202+'/'+_0x178db9)['json'](_0x260c87);}return null;};}function patchUpdates(_0xa6b8ff){return function(_0x5ad95a){try{jsonpatch[_0x458a('0x26')](_0x5ad95a,_0xa6b8ff,!![]);}catch(_0x5bca42){return BPromise[_0x458a('0x27')](_0x5bca42);}return _0x5ad95a['save']();};}function saveUpdates(_0x36b08e,_0x911eaf){return function(_0xcb0756){if(_0xcb0756){return _0xcb0756[_0x458a('0x28')](_0x36b08e)[_0x458a('0x29')](function(_0x19bd5){return _0x19bd5;});}return null;};}function removeEntity(_0x340375,_0x3012c7){return function(_0x1f2d0){if(_0x1f2d0){return _0x1f2d0[_0x458a('0x2a')]()[_0x458a('0x29')](function(){var _0x327fcb=_0x1f2d0[_0x458a('0x2b')]({'plain':!![]});var _0x5a55b7=_0x458a('0x2c');return db[_0x458a('0x2d')]['destroy']({'where':{'type':_0x5a55b7,'resourceId':_0x327fcb['id']}})['then'](function(){return _0x1f2d0;});})[_0x458a('0x29')](function(){_0x340375['status'](0xcc)[_0x458a('0x2e')]();});}};}function handleEntityNotFound(_0x29f9b5,_0x223f73){return function(_0x4a49e4){if(!_0x4a49e4){_0x29f9b5[_0x458a('0x1d')](0x194);}return _0x4a49e4;};}function handleError(_0x2531f7,_0x1426a8){_0x1426a8=_0x1426a8||0x1f4;return function(_0x562c36){logger['error'](_0x562c36[_0x458a('0x2f')]);if(_0x562c36['name']){delete _0x562c36[_0x458a('0x30')];}_0x2531f7['status'](_0x1426a8)[_0x458a('0x31')](_0x562c36);};}exports[_0x458a('0x32')]=function(_0x492843,_0x309a6a){var _0x269f53={},_0x625ae3={},_0x525caf={'count':0x0,'rows':[]};var _0x3371c3=_[_0x458a('0x33')](db[_0x458a('0x34')][_0x458a('0x35')],function(_0x5267fe){return{'name':_0x5267fe['fieldName'],'type':_0x5267fe[_0x458a('0x36')][_0x458a('0x37')]};});_0x625ae3[_0x458a('0x38')]=_[_0x458a('0x33')](_0x3371c3,_0x458a('0x30'));_0x625ae3[_0x458a('0x39')]=_['keys'](_0x492843[_0x458a('0x39')]);_0x625ae3[_0x458a('0x3a')]=_[_0x458a('0x3b')](_0x625ae3[_0x458a('0x38')],_0x625ae3[_0x458a('0x39')]);_0x269f53[_0x458a('0x3c')]=_[_0x458a('0x3b')](_0x625ae3[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x492843['query'][_0x458a('0x3d')]));_0x269f53[_0x458a('0x3c')]=_0x269f53[_0x458a('0x3c')][_0x458a('0x3e')]?_0x269f53[_0x458a('0x3c')]:_0x625ae3[_0x458a('0x38')];if(!_0x492843[_0x458a('0x39')][_0x458a('0x3f')](_0x458a('0x40'))){_0x269f53[_0x458a('0x23')]=qs[_0x458a('0x23')](_0x492843[_0x458a('0x39')][_0x458a('0x23')]);_0x269f53[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x492843['query'][_0x458a('0x20')]);}_0x269f53[_0x458a('0x41')]=qs[_0x458a('0x42')](_0x492843[_0x458a('0x39')][_0x458a('0x42')]);_0x269f53[_0x458a('0x43')]=qs[_0x458a('0x3a')](_[_0x458a('0x44')](_0x492843[_0x458a('0x39')],_0x625ae3[_0x458a('0x3a')]),_0x3371c3);if(_0x492843[_0x458a('0x39')]['filter']){_0x269f53[_0x458a('0x43')]=_[_0x458a('0x45')](_0x269f53['where'],{'$or':_[_0x458a('0x33')](_0x3371c3,function(_0x422b45){if(_0x422b45[_0x458a('0x36')]!=='VIRTUAL'){var _0x406312={};_0x406312[_0x422b45[_0x458a('0x30')]]={'$like':'%'+_0x492843[_0x458a('0x39')][_0x458a('0x46')]+'%'};return _0x406312;}})});}_0x269f53=_[_0x458a('0x45')]({},_0x269f53,_0x492843[_0x458a('0x47')]);var _0x21d2d4={'where':_0x269f53[_0x458a('0x43')]};return db['VoicePrefix'][_0x458a('0x22')](_0x21d2d4)[_0x458a('0x29')](function(_0x2b9030){_0x525caf['count']=_0x2b9030;if(_0x492843[_0x458a('0x39')][_0x458a('0x48')]){_0x269f53['include']=[{'all':!![]}];}return db[_0x458a('0x34')][_0x458a('0x49')](_0x269f53);})[_0x458a('0x29')](function(_0x36c391){_0x525caf[_0x458a('0x4a')]=_0x36c391;return _0x525caf;})['then'](respondWithFilteredResult(_0x309a6a,_0x269f53))['catch'](handleError(_0x309a6a,null));};exports[_0x458a('0x4b')]=function(_0x301e61,_0x33a31d){var _0x18e4e2={'raw':![],'where':{'id':_0x301e61[_0x458a('0x4c')]['id']}},_0x5afd24={};_0x5afd24[_0x458a('0x38')]=_['keys'](db[_0x458a('0x34')]['rawAttributes']);_0x5afd24[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x301e61[_0x458a('0x39')]);_0x5afd24['filters']=_[_0x458a('0x3b')](_0x5afd24[_0x458a('0x38')],_0x5afd24[_0x458a('0x39')]);_0x18e4e2['attributes']=_['intersection'](_0x5afd24[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x301e61[_0x458a('0x39')]['fields']));_0x18e4e2['attributes']=_0x18e4e2[_0x458a('0x3c')][_0x458a('0x3e')]?_0x18e4e2[_0x458a('0x3c')]:_0x5afd24[_0x458a('0x38')];if(_0x301e61[_0x458a('0x39')][_0x458a('0x48')]){_0x18e4e2[_0x458a('0x4e')]=[{'all':!![]}];}_0x18e4e2=_[_0x458a('0x45')]({},_0x18e4e2,_0x301e61[_0x458a('0x47')]);return db[_0x458a('0x34')][_0x458a('0x4f')](_0x18e4e2)[_0x458a('0x29')](handleEntityNotFound(_0x33a31d,null))[_0x458a('0x29')](respondWithResult(_0x33a31d,null))[_0x458a('0x50')](handleError(_0x33a31d,null));};exports[_0x458a('0x2a')]=function(_0x25b44c,_0x51669b){return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x25b44c[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x51669b,null))[_0x458a('0x29')](removeEntity(_0x51669b,null))['catch'](handleError(_0x51669b,null));};exports['describe']=function(_0x514d82,_0x2abf75){return db['VoicePrefix'][_0x458a('0x51')]()[_0x458a('0x29')](respondWithResult(_0x2abf75,null))[_0x458a('0x50')](handleError(_0x2abf75,null));};exports[_0x458a('0x52')]=function(_0xfa6e65,_0x5f0151){var _0x48f68e;return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x2587a1){return db[_0x458a('0x34')][_0x458a('0x52')](_0xfa6e65['body'],{'transaction':_0x2587a1})[_0x458a('0x29')](function(_0x4eed01){_0x48f68e=_0x4eed01[_0x458a('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x458a('0x4f')]({'where':{'id':_0x48f68e['VoiceExtensionId']},'raw':!![]})['then'](function(_0x4b9928){return createVoicePrefixExtensions(_0x48f68e,_0x4b9928,_0x2587a1);});});})[_0x458a('0x29')](function(){var _0x3eb267=_0xfa6e65['user'][_0x458a('0x2b')]({'plain':!![]});if(!_0x3eb267)throw new Error(_0x458a('0x55'));if(_0x3eb267[_0x458a('0x56')]==='user'){var _0x2c1230=_0x48f68e;return db[_0x458a('0x57')][_0x458a('0x4f')]({'where':{'name':_0x458a('0x2c'),'userProfileId':_0x3eb267[_0x458a('0x58')]},'raw':!![]})[_0x458a('0x29')](function(_0x597e74){if(_0x597e74&&_0x597e74[_0x458a('0x59')]===0x0){return db[_0x458a('0x2d')][_0x458a('0x52')]({'name':_0x2c1230[_0x458a('0x30')],'resourceId':_0x2c1230['id'],'type':_0x597e74[_0x458a('0x30')],'sectionId':_0x597e74['id']},{})[_0x458a('0x29')](function(){return _0x48f68e;});}else{return _0x48f68e;}})[_0x458a('0x50')](function(_0x3b6cf9){logger['error'](_0x458a('0x5a'),_0x3b6cf9);throw _0x3b6cf9;});}return _0x48f68e;})['then'](respondWithResult(_0x5f0151,null))[_0x458a('0x50')](handleError(_0x5f0151,null));};function Extension(_0x2921ba,_0x222aa4,_0x42b748,_0x4da240){this['context']=_0x458a('0x5b');this[_0x458a('0x5c')]=_0x2921ba;this[_0x458a('0x5d')]=_0x42b748;this[_0x458a('0x36')]=_0x458a('0x5e');this[_0x458a('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x458a('0x60')]=_0x222aa4;this[_0x458a('0x61')]=_0x4da240;}function createVoicePrefixExtensions(_0x4f6913,_0x18d83a,_0x47b334){return new BPromise(function(_0x425a0f,_0x338127){var _0xa37d44=new Extension(formatPrefixName(_0x4f6913[_0x458a('0x62')]),0x1,_0x458a('0x63'),_0x458a('0x64'));_0xa37d44[_0x458a('0x65')]=_0x4f6913['id'];return db[_0x458a('0x66')]['create'](_0xa37d44,{'transaction':_0x47b334})[_0x458a('0x29')](function(_0x3ed05d){var _0x5d41a2=_0x3ed05d[_0x458a('0x2b')]({'plain':!![]});var _0x3da617=_['map'](addVoicePrefixExtensions(_0x4f6913,_0x18d83a),function(_0xaf7b50){_0xaf7b50[_0x458a('0x67')]=_0x5d41a2['id'];_0xaf7b50['VoicePrefixId']=_0x4f6913['id'];return _0xaf7b50;});return db[_0x458a('0x66')][_0x458a('0x68')](_0x3da617,{'transaction':_0x47b334})['then'](function(_0x16f82f){if(!_0x16f82f){return _0x338127(_0x458a('0x69'));}else{return _0x425a0f(_0x16f82f);}})[_0x458a('0x50')](function(_0x404d93){return _0x338127(_0x404d93);});});;});};function addVoicePrefixExtensions(_0x541375,_0x27d1f2){var _0x4199a7=[];var _0x397595=formatPrefixName(_0x541375['prefix']);_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x2,_0x458a('0x6b'),_0x458a('0x6c')+_0x541375[_0x458a('0x30')]));if(_0x541375[_0x458a('0x6d')]){_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x3,_0x458a('0x6b'),_0x458a('0x6e')+_0x541375[_0x458a('0x6d')]));}else{_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x3,'NoOp',_0x458a('0x6f')));}_0x4199a7['push'](new Extension(_0x397595,0x4,_0x458a('0x70'),_0x27d1f2[_0x458a('0x71')]+','+_0x458a('0x72')+(0x8+_0x541375[_0x458a('0x30')][_0x458a('0x3e')])+'}'+','+0x1));return _0x4199a7;}function formatPrefixName(_0x3d1d37){var _0x2c6a00='_';for(var _0x3745d5=0x0;_0x3745d5<_0x3d1d37[_0x458a('0x3e')];_0x3745d5++){if(_0x3d1d37[_0x458a('0x73')](_0x3745d5)=='-'){_0x2c6a00+=_0x3d1d37[_0x458a('0x73')](_0x3745d5);}else{_0x2c6a00+='['+_0x3d1d37[_0x458a('0x73')](_0x3745d5)+']';}}_0x2c6a00+='.';return _0x2c6a00;}exports[_0x458a('0x28')]=function(_0x435884,_0x3948aa,_0x2c131b){var _0x4c426a=_0x435884[_0x458a('0x74')];_0x4c426a['prefix']=_0x458a('0x75')+_0x4c426a[_0x458a('0x30')]+'-';return db['sequelize'][_0x458a('0x54')](function(_0xb028b3){return db[_0x458a('0x34')]['update'](_0x4c426a,{'where':{'id':_0x4c426a['id']},'transaction':_0xb028b3})[_0x458a('0x29')](function(){return db[_0x458a('0x66')][_0x458a('0x2a')]({'where':{'VoicePrefixId':_0x4c426a['id']},'transaction':_0xb028b3})[_0x458a('0x29')](function(){return db[_0x458a('0x66')][_0x458a('0x4f')]({'where':{'id':_0x4c426a['VoiceExtensionId']},'raw':!![]})[_0x458a('0x29')](function(_0x54abb1){return createVoicePrefixExtensions(_0x4c426a,_0x54abb1,_0xb028b3);});});});})['then'](function(){return db[_0x458a('0x34')][_0x458a('0x76')](_0x4c426a['id']);})[_0x458a('0x29')](respondWithResult(_0x3948aa,null))[_0x458a('0x50')](handleError(_0x3948aa,null));};exports[_0x458a('0x77')]=function(_0x434d04,_0x42eae7,_0x5aee0d){return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x434d04[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x42eae7,null))[_0x458a('0x29')](function(_0x17398f){if(_0x17398f){return _0x17398f['addAgents'](_0x434d04['body']['ids'],_[_0x458a('0x78')](_0x434d04['body'],[_0x458a('0x79'),'id'])||{})[_0x458a('0x7a')](function(_0x46ef02){for(var _0x3d73d1=0x0;_0x3d73d1<_0x434d04[_0x458a('0x74')][_0x458a('0x79')][_0x458a('0x3e')];_0x3d73d1+=0x1){socket['emit'](_0x458a('0x7b'),{'UserId':Number(_0x434d04[_0x458a('0x74')]['ids'][_0x3d73d1]),'VoicePrefixId':Number(_0x434d04[_0x458a('0x4c')]['id'])});}return _0x46ef02;});}})['then'](respondWithResult(_0x42eae7,null))[_0x458a('0x50')](handleError(_0x42eae7,null));};exports['removeAgents']=function(_0x26b3f7,_0x177457,_0xce45b5){return db[_0x458a('0x34')]['find']({'where':{'id':_0x26b3f7[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x177457,null))[_0x458a('0x29')](function(_0x239e2f){if(_0x239e2f){return _0x239e2f[_0x458a('0x7c')](_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')])[_0x458a('0x29')](function(){if(_['isArray'](_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')])){for(var _0x12e367=0x0;_0x12e367<_0x26b3f7[_0x458a('0x39')]['ids'][_0x458a('0x3e')];_0x12e367+=0x1){socket[_0x458a('0x7d')]('userVoicePrefix:remove',{'UserId':Number(_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')][_0x12e367]),'VoicePrefixId':Number(_0x26b3f7[_0x458a('0x4c')]['id'])});}}else{socket[_0x458a('0x7d')](_0x458a('0x7e'),{'UserId':Number(_0x26b3f7['query'][_0x458a('0x79')]),'VoicePrefixId':Number(_0x26b3f7[_0x458a('0x4c')]['id'])});}});}})[_0x458a('0x29')](respondWithStatusCode(_0x177457,null))[_0x458a('0x50')](handleError(_0x177457,null));};exports[_0x458a('0x7f')]=function(_0x46ac5c,_0x2eecf0,_0x573f46){var _0x1f9925={};var _0x4d3790={};var _0x396af9;var _0x36e650;return db[_0x458a('0x34')]['findOne']({'where':{'id':_0x46ac5c[_0x458a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2eecf0,null))['then'](function(_0x2574a3){if(_0x2574a3){_0x396af9=_0x2574a3;_0x4d3790[_0x458a('0x38')]=_['keys'](db['User'][_0x458a('0x35')]);_0x4d3790[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x46ac5c[_0x458a('0x39')]);_0x4d3790[_0x458a('0x3a')]=_['intersection'](_0x4d3790[_0x458a('0x38')],_0x4d3790['query']);_0x1f9925[_0x458a('0x3c')]=_[_0x458a('0x3b')](_0x4d3790[_0x458a('0x38')],qs['fields'](_0x46ac5c[_0x458a('0x39')][_0x458a('0x3d')]));_0x1f9925['attributes']=_0x1f9925[_0x458a('0x3c')]['length']?_0x1f9925[_0x458a('0x3c')]:_0x4d3790[_0x458a('0x38')];_0x1f9925[_0x458a('0x41')]=qs[_0x458a('0x42')](_0x46ac5c['query'][_0x458a('0x42')]);_0x1f9925['where']=qs['filters'](_[_0x458a('0x44')](_0x46ac5c[_0x458a('0x39')],_0x4d3790[_0x458a('0x3a')]));if(_0x46ac5c[_0x458a('0x39')][_0x458a('0x46')]){_0x1f9925[_0x458a('0x43')]=_['merge'](_0x1f9925[_0x458a('0x43')],{'$or':_[_0x458a('0x33')](_0x1f9925[_0x458a('0x3c')],function(_0x222dcb){var _0x17099e={};_0x17099e[_0x222dcb]={'$like':'%'+_0x46ac5c[_0x458a('0x39')]['filter']+'%'};return _0x17099e;})});}_0x1f9925=_[_0x458a('0x45')]({},_0x1f9925,_0x46ac5c[_0x458a('0x47')]);return _0x396af9[_0x458a('0x7f')](_0x1f9925);}})['then'](function(_0x2903c2){if(_0x2903c2){_0x36e650=_0x2903c2[_0x458a('0x3e')];if(!_0x46ac5c[_0x458a('0x39')]['hasOwnProperty']('nolimit')){_0x1f9925[_0x458a('0x23')]=qs['limit'](_0x46ac5c['query']['limit']);_0x1f9925['offset']=qs['offset'](_0x46ac5c[_0x458a('0x39')]['offset']);}return _0x396af9[_0x458a('0x7f')](_0x1f9925);}})[_0x458a('0x29')](function(_0x2adefe){if(_0x2adefe){return _0x2adefe?{'count':_0x36e650,'rows':_0x2adefe}:null;}})[_0x458a('0x29')](respondWithResult(_0x2eecf0,null))[_0x458a('0x50')](handleError(_0x2eecf0,null));};exports[_0x458a('0x80')]=function(_0x555190,_0x11ebe7,_0x59ad9c){var _0x24b1ee={};var _0x4e1d44={};var _0x23428c;var _0x333d74;return db['VoicePrefix']['findOne']({'where':{'id':_0x555190['params']['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x11ebe7,null))[_0x458a('0x29')](function(_0x21d8a9){if(_0x21d8a9){_0x23428c=_0x21d8a9;_0x4e1d44[_0x458a('0x38')]=_[_0x458a('0x4d')](db['Team'][_0x458a('0x35')]);_0x4e1d44[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x555190[_0x458a('0x39')]);_0x4e1d44[_0x458a('0x3a')]=_[_0x458a('0x3b')](_0x4e1d44[_0x458a('0x38')],_0x4e1d44[_0x458a('0x39')]);_0x24b1ee['attributes']=_[_0x458a('0x3b')](_0x4e1d44[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x555190[_0x458a('0x39')][_0x458a('0x3d')]));_0x24b1ee[_0x458a('0x3c')]=_0x24b1ee[_0x458a('0x3c')]['length']?_0x24b1ee['attributes']:_0x4e1d44['model'];_0x24b1ee['order']=qs[_0x458a('0x42')](_0x555190[_0x458a('0x39')][_0x458a('0x42')]);_0x24b1ee[_0x458a('0x43')]=qs['filters'](_[_0x458a('0x44')](_0x555190[_0x458a('0x39')],_0x4e1d44[_0x458a('0x3a')]));if(_0x555190[_0x458a('0x39')]['filter']){_0x24b1ee['where']=_[_0x458a('0x45')](_0x24b1ee[_0x458a('0x43')],{'$or':_[_0x458a('0x33')](_0x24b1ee[_0x458a('0x3c')],function(_0x4ff826){var _0xbb80ab={};_0xbb80ab[_0x4ff826]={'$like':'%'+_0x555190[_0x458a('0x39')][_0x458a('0x46')]+'%'};return _0xbb80ab;})});}_0x24b1ee=_[_0x458a('0x45')]({},_0x24b1ee,_0x555190[_0x458a('0x47')]);return _0x23428c[_0x458a('0x80')](_0x24b1ee);}})[_0x458a('0x29')](function(_0xd05241){if(_0xd05241){_0x333d74=_0xd05241[_0x458a('0x3e')];if(!_0x555190[_0x458a('0x39')]['hasOwnProperty']('nolimit')){_0x24b1ee[_0x458a('0x23')]=qs[_0x458a('0x23')](_0x555190[_0x458a('0x39')][_0x458a('0x23')]);_0x24b1ee[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x555190[_0x458a('0x39')]['offset']);}return _0x23428c[_0x458a('0x80')](_0x24b1ee);}})['then'](function(_0x165b0d){if(_0x165b0d){return _0x165b0d?{'count':_0x333d74,'rows':_0x165b0d}:null;}})[_0x458a('0x29')](respondWithResult(_0x11ebe7,null))[_0x458a('0x50')](handleError(_0x11ebe7,null));};exports['addTeams']=function(_0x589496,_0x4ee34,_0x1c9f4c){var _0x241c72=_0x589496[_0x458a('0x74')][_0x458a('0x79')];var _0x53d065;return db[_0x458a('0x81')][_0x458a('0x49')]({'where':{'id':_0x241c72},'attributes':['id'],'include':[{'model':db[_0x458a('0x82')],'as':_0x458a('0x83'),'attributes':['id',_0x458a('0x30'),_0x458a('0x84'),_0x458a('0x85'),_0x458a('0x86')],'raw':!![]}]})[_0x458a('0x29')](function(_0x52b844){if(_0x52b844){_0x53d065=_0x52b844;var _0x3051d2=_['flatMap'](_0x52b844,function(_0x2e496b){var _0x442b4a=_0x2e496b[_0x458a('0x2b')]({'plain':!![]});return _0x442b4a['Agents'];});return db['VoicePrefix'][_0x458a('0x4f')]({'where':{'id':_0x589496['params']['id']}})[_0x458a('0x29')](function(_0x5d97cc){return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x1b8558){return _0x5d97cc['addTeams'](_0x241c72,{'transaction':_0x1b8558})[_0x458a('0x29')](function(){return BPromise[_0x458a('0x87')](_0x53d065,function(_0x5dbeed){return db[_0x458a('0x88')]['upsert']({'TeamId':_0x5dbeed['id'],'VoicePrefixId':_0x589496[_0x458a('0x4c')]['id']},{'transaction':_0x1b8558});});})[_0x458a('0x29')](function(){return BPromise[_0x458a('0x87')](_0x3051d2,function(_0x49bdfc){return db[_0x458a('0x89')][_0x458a('0x8a')]({'where':{'UserId':_0x49bdfc['id'],'VoicePrefixId':_0x589496[_0x458a('0x4c')]['id']},'transaction':_0x1b8558});});})[_0x458a('0x29')](function(){_0x3051d2[_0x458a('0x8b')](function(_0x477402){socket['emit'](_0x458a('0x7b'),{'UserId':_0x477402['id'],'VoicePrefixId':_0x5d97cc['id']});});});});});}})[_0x458a('0x29')](respondWithStatusCode(_0x4ee34,null))['catch'](handleError(_0x4ee34,null));};exports[_0x458a('0x8c')]=function(_0x187bc8,_0x197858,_0x48622f){return db[_0x458a('0x81')][_0x458a('0x49')]({'where':{'id':_0x187bc8[_0x458a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x458a('0x82')],'as':_0x458a('0x83'),'attributes':['id'],'raw':!![]}]})[_0x458a('0x29')](handleEntityNotFound(_0x197858,null))[_0x458a('0x29')](function(_0x2334f3){var _0x46bfc7=_[_0x458a('0x33')](_0x2334f3,'id');var _0x43cb92=[];var _0x5c42a4=[];var _0x3c3c7b=squel['select']();_0x3c3c7b['field'](_0x458a('0x8d'))[_0x458a('0x8e')]('team_has_voice_prefixes','tq')[_0x458a('0x8f')]('user_has_teams','ut',_0x458a('0x90'))['where'](_0x458a('0x91'),_0x187bc8[_0x458a('0x4c')]['id']);for(var _0x20ad0b=0x0;_0x20ad0b<_0x2334f3[_0x458a('0x3e')];_0x20ad0b+=0x1){let _0x55eab3=_0x2334f3[_0x20ad0b];for(var _0x4677a6=0x0;_0x4677a6<_0x55eab3[_0x458a('0x83')][_0x458a('0x3e')];_0x4677a6+=0x1){let _0x4df0b4=_0x55eab3[_0x458a('0x83')][_0x4677a6];var _0xfd1b68=_0x3c3c7b[_0x458a('0x92')]();_0xfd1b68[_0x458a('0x43')]('ut.UserId\x20=\x20?',_0x4df0b4['id']);_0x5c42a4[_0x458a('0x6a')](db['sequelize']['query'](_0xfd1b68['toString'](),{'type':db[_0x458a('0x53')][_0x458a('0x93')]['SELECT']})[_0x458a('0x29')](function(_0x49297c){if(_0x49297c[_0x458a('0x3e')]===0x1){return _0x4df0b4['id'];}else{var _0x4bfd6b=_[_0x458a('0x94')](_['map'](_0x49297c,_0x458a('0x95')),function(_0x3c9685){return _[_0x458a('0x96')](_0x46bfc7,_0x3c9685);});if(_0x4bfd6b){return _0x4df0b4['id'];}}}));}}return BPromise[_0x458a('0x97')](_0x5c42a4)[_0x458a('0x29')](function(_0x2e24aa){_0x43cb92=_(_0x43cb92)[_0x458a('0x98')](_0x2e24aa)['compact']()[_0x458a('0x99')]();return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x187bc8['params']['id']}})['then'](function(_0x334129){return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x330330){return _0x334129[_0x458a('0x8c')](_0x187bc8['query'][_0x458a('0x79')],{'transaction':_0x330330})[_0x458a('0x29')](function(){if(!_[_0x458a('0x9a')](_0x43cb92)){return _0x334129[_0x458a('0x7c')](_0x43cb92,{'transaction':_0x330330});}})[_0x458a('0x29')](function(){_0x43cb92['forEach'](function(_0x16a747){socket[_0x458a('0x7d')](_0x458a('0x7e'),{'UserId':_0x16a747,'VoicePrefixId':_0x334129['id']});});});});});});})[_0x458a('0x29')](respondWithStatusCode(_0x197858,null))[_0x458a('0x50')](handleError(_0x197858,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 2197b94..3497502 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 _0x67f8=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x33ed3f,_0x321c07){var _0x1dbb32=function(_0x9a3918){while(--_0x9a3918){_0x33ed3f['push'](_0x33ed3f['shift']());}};_0x1dbb32(++_0x321c07);}(_0x67f8,0x1a9));var _0x867f=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x67f8[_0x38a7ac];return _0x53061a;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x867f('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x867f('0x1')](0x0);var events={'afterCreate':_0x867f('0x2'),'afterUpdate':_0x867f('0x3'),'afterDestroy':_0x867f('0x4')};function emitEvent(_0x598487){return function(_0x147cdc,_0x4dbf37,_0x7d86d2){VoicePrefixEvents[_0x867f('0x5')](_0x598487+':'+_0x147cdc['id'],_0x147cdc);VoicePrefixEvents[_0x867f('0x5')](_0x598487,_0x147cdc);_0x7d86d2(null);};}for(var e in events){if(events[_0x867f('0x6')](e)){var event=events[e];VoicePrefix[_0x867f('0x7')](e,emitEvent(event));}}module[_0x867f('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x7f7e=['VoicePrefix','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7f7e,0x142));var _0xe7f7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7f7e[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xe7f7('0x0'));var VoicePrefix=require(_0xe7f7('0x1'))['db'][_0xe7f7('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe7f7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe7f7('0x4'),'afterDestroy':_0xe7f7('0x5')};function emitEvent(_0xa0cf1b){return function(_0x11ccca,_0x16c6bb,_0x5d98ea){VoicePrefixEvents[_0xe7f7('0x6')](_0xa0cf1b+':'+_0x11ccca['id'],_0x11ccca);VoicePrefixEvents[_0xe7f7('0x6')](_0xa0cf1b,_0x11ccca);_0x5d98ea(null);};}for(var e in events){if(events[_0xe7f7('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xe7f7('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index f740e31..01628be 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 _0xcc2d=['../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api','bluebird','path','rimraf'];(function(_0x2d5cb6,_0x393fdd){var _0x23ffc0=function(_0x620bf3){while(--_0x620bf3){_0x2d5cb6['push'](_0x2d5cb6['shift']());}};_0x23ffc0(++_0x393fdd);}(_0xcc2d,0x1c2));var _0xdcc2=function(_0x4a1a23,_0x4bff93){_0x4a1a23=_0x4a1a23-0x0;var _0x1af69e=_0xcc2d[_0x4a1a23];return _0x1af69e;};'use strict';var _=require(_0xdcc2('0x0'));var util=require(_0xdcc2('0x1'));var logger=require('../../config/logger')(_0xdcc2('0x2'));var moment=require('moment');var BPromise=require(_0xdcc2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcc2('0x4'));var rimraf=require(_0xdcc2('0x5'));var config=require(_0xdcc2('0x6'));var attributes=require(_0xdcc2('0x7'));module[_0xdcc2('0x8')]=function(_0x3373cd,_0x575367){return _0x3373cd[_0xdcc2('0x9')](_0xdcc2('0xa'),attributes,{'tableName':_0xdcc2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a78=['exports','define','voice_prefixes','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./voicePrefix.attributes'];(function(_0x5ae47b,_0x56ce0b){var _0x59b7a3=function(_0x180e65){while(--_0x180e65){_0x5ae47b['push'](_0x5ae47b['shift']());}};_0x59b7a3(++_0x56ce0b);}(_0x6a78,0x1dc));var _0x86a7=function(_0x44a769,_0x4cc357){_0x44a769=_0x44a769-0x0;var _0x4c47de=_0x6a78[_0x44a769];return _0x4c47de;};'use strict';var _=require(_0x86a7('0x0'));var util=require('util');var logger=require(_0x86a7('0x1'))(_0x86a7('0x2'));var moment=require(_0x86a7('0x3'));var BPromise=require('bluebird');var rp=require(_0x86a7('0x4'));var fs=require('fs');var path=require(_0x86a7('0x5'));var rimraf=require('rimraf');var config=require(_0x86a7('0x6'));var attributes=require(_0x86a7('0x7'));module[_0x86a7('0x8')]=function(_0x437607,_0x21bda3){return _0x437607[_0x86a7('0x9')]('VoicePrefix',attributes,{'tableName':_0x86a7('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 40381f7..dcb8ba5 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 _0xd481=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment'];(function(_0xe36738,_0x2c8bc4){var _0x457ee6=function(_0x442e5e){while(--_0x442e5e){_0xe36738['push'](_0xe36738['shift']());}};_0x457ee6(++_0x2c8bc4);}(_0xd481,0x1e4));var _0x1d48=function(_0x55dfe4,_0x1bbbcd){_0x55dfe4=_0x55dfe4-0x0;var _0x3b555c=_0xd481[_0x55dfe4];return _0x3b555c;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var moment=require(_0x1d48('0x1'));var BPromise=require(_0x1d48('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d48('0x3'));var db=require(_0x1d48('0x4'))['db'];var utils=require(_0x1d48('0x5'));var logger=require('../../config/logger')(_0x1d48('0x6'));var config=require('../../config/environment');var jayson=require(_0x1d48('0x7'));var client=jayson[_0x1d48('0x8')]['http']({'port':0x232a});config[_0x1d48('0x9')]=_[_0x1d48('0xa')](config[_0x1d48('0x9')],{'host':_0x1d48('0xb'),'port':0x18eb});var socket=require(_0x1d48('0xc'))(new Redis(config[_0x1d48('0x9')]));require(_0x1d48('0xd'))[_0x1d48('0xe')](socket);function respondWithRpcPromise(_0x2bf9c6,_0x21a801,_0x37ff69){return new BPromise(function(_0x2f2f6c,_0x4dd9d3){return client[_0x1d48('0xf')](_0x2bf9c6,_0x37ff69)[_0x1d48('0x10')](function(_0xf54674){logger[_0x1d48('0x11')](_0x1d48('0x12'),_0x21a801,_0x1d48('0x13'));logger[_0x1d48('0x14')](_0x1d48('0x15'),_0x21a801,_0x1d48('0x13'),JSON[_0x1d48('0x16')](_0xf54674));if(_0xf54674['error']){if(_0xf54674[_0x1d48('0x17')]['code']===0x1f4){logger[_0x1d48('0x17')](_0x1d48('0x12'),_0x21a801,_0xf54674[_0x1d48('0x17')][_0x1d48('0x18')]);return _0x4dd9d3(_0xf54674['error'][_0x1d48('0x18')]);}logger[_0x1d48('0x17')](_0x1d48('0x12'),_0x21a801,_0xf54674['error'][_0x1d48('0x18')]);return _0x2f2f6c(_0xf54674[_0x1d48('0x17')][_0x1d48('0x18')]);}else{logger[_0x1d48('0x11')](_0x1d48('0x12'),_0x21a801,_0x1d48('0x13'));_0x2f2f6c(_0xf54674[_0x1d48('0x19')][_0x1d48('0x18')]);}})[_0x1d48('0x1a')](function(_0x544426){logger['error'](_0x1d48('0x12'),_0x21a801,_0x544426);_0x4dd9d3(_0x544426);});});} \ No newline at end of file +var _0xa6b0=['socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x318df6,_0xd4d12f){var _0x27f88f=function(_0x152c67){while(--_0x152c67){_0x318df6['push'](_0x318df6['shift']());}};_0x27f88f(++_0xd4d12f);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x556013,_0x1b4315){_0x556013=_0x556013-0x0;var _0x3118a3=_0xa6b0[_0x556013];return _0x3118a3;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a6b('0x2'));var fs=require('fs');var Redis=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));var client=jayson[_0x0a6b('0x9')][_0x0a6b('0xa')]({'port':0x232a});config[_0x0a6b('0xb')]=_[_0x0a6b('0xc')](config[_0x0a6b('0xb')],{'host':_0x0a6b('0xd'),'port':0x18eb});var socket=require(_0x0a6b('0xe'))(new Redis(config[_0x0a6b('0xb')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x25b93d,_0x100da8,_0xbdb0d0){return new BPromise(function(_0x25ad47,_0x81a412){return client[_0x0a6b('0xf')](_0x25b93d,_0xbdb0d0)[_0x0a6b('0x10')](function(_0x405046){logger[_0x0a6b('0x11')](_0x0a6b('0x12'),_0x100da8,_0x0a6b('0x13'));logger[_0x0a6b('0x14')](_0x0a6b('0x15'),_0x100da8,_0x0a6b('0x13'),JSON['stringify'](_0x405046));if(_0x405046['error']){if(_0x405046[_0x0a6b('0x16')][_0x0a6b('0x17')]===0x1f4){logger[_0x0a6b('0x16')](_0x0a6b('0x12'),_0x100da8,_0x405046[_0x0a6b('0x16')][_0x0a6b('0x18')]);return _0x81a412(_0x405046[_0x0a6b('0x16')][_0x0a6b('0x18')]);}logger[_0x0a6b('0x16')](_0x0a6b('0x12'),_0x100da8,_0x405046['error'][_0x0a6b('0x18')]);return _0x25ad47(_0x405046[_0x0a6b('0x16')]['message']);}else{logger[_0x0a6b('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x100da8,_0x0a6b('0x13'));_0x25ad47(_0x405046[_0x0a6b('0x19')][_0x0a6b('0x18')]);}})[_0x0a6b('0x1a')](function(_0x5c512a){logger[_0x0a6b('0x16')](_0x0a6b('0x12'),_0x100da8,_0x5c512a);_0x81a412(_0x5c512a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index fbeb4cf..ef9fcee 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 _0x2060=['update','emit','removeListener','length','voicePrefix:','./voicePrefix.events','remove'];(function(_0xd9f8a3,_0x3c078d){var _0x490cfb=function(_0x2395ed){while(--_0x2395ed){_0xd9f8a3['push'](_0xd9f8a3['shift']());}};_0x490cfb(++_0x3c078d);}(_0x2060,0x1be));var _0x0206=function(_0x2645c8,_0x5ac081){_0x2645c8=_0x2645c8-0x0;var _0x57d97a=_0x2060[_0x2645c8];return _0x57d97a;};'use strict';var VoicePrefixEvents=require(_0x0206('0x0'));var events=['save',_0x0206('0x1'),_0x0206('0x2')];function createListener(_0x3bbe73,_0x1df0f){return function(_0x538889){_0x1df0f[_0x0206('0x3')](_0x3bbe73,_0x538889);};}function removeListener(_0x1c9e2d,_0x4f7ab8){return function(){VoicePrefixEvents[_0x0206('0x4')](_0x1c9e2d,_0x4f7ab8);};}exports['register']=function(_0x26a2c8){for(var _0x2fb72e=0x0,_0x529d59=events[_0x0206('0x5')];_0x2fb72e<_0x529d59;_0x2fb72e++){var _0x5c8dbb=events[_0x2fb72e];var _0x4ffb51=createListener(_0x0206('0x6')+_0x5c8dbb,_0x26a2c8);VoicePrefixEvents['on'](_0x5c8dbb,_0x4ffb51);}}; \ No newline at end of file +var _0xb98f=['removeListener','register','./voicePrefix.events','save','remove','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb98f,0xce));var _0xfb98=function(_0x1a9e8a,_0x5dc29b){_0x1a9e8a=_0x1a9e8a-0x0;var _0x29e34c=_0xb98f[_0x1a9e8a];return _0x29e34c;};'use strict';var VoicePrefixEvents=require(_0xfb98('0x0'));var events=[_0xfb98('0x1'),_0xfb98('0x2'),_0xfb98('0x3')];function createListener(_0x14e29f,_0x4f16b2){return function(_0x5570ce){_0x4f16b2['emit'](_0x14e29f,_0x5570ce);};}function removeListener(_0x29600d,_0x201ab9){return function(){VoicePrefixEvents[_0xfb98('0x4')](_0x29600d,_0x201ab9);};}exports[_0xfb98('0x5')]=function(_0x544b6d){for(var _0x49ecaa=0x0,_0x4a6af9=events['length'];_0x49ecaa<_0x4a6af9;_0x49ecaa++){var _0x27b394=events[_0x49ecaa];var _0x4d06fc=createListener('voicePrefix:'+_0x27b394,_0x544b6d);VoicePrefixEvents['on'](_0x27b394,_0x4d06fc);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 41d663c..6ddaea8 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 _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(_0x17b1e6,_0x56d2db){var _0x3400c3=function(_0xa16efe){while(--_0xa16efe){_0x17b1e6['push'](_0x17b1e6['shift']());}};_0x3400c3(++_0x56d2db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 +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(_0x156dba,_0x4e513e){var _0xa401c=function(_0x2fcb8c){while(--_0x2fcb8c){_0x156dba['push'](_0x156dba['shift']());}};_0xa401c(++_0x4e513e);}(_0xb10b,0x12a));var _0xbb10=function(_0x290781,_0x53d542){_0x290781=_0x290781-0x0;var _0x1ef41f=_0xb10b[_0x290781];return _0x1ef41f;};'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 diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 65cccb0..fa07101 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 _0xea3a=['STRING','default','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','dialMethod','getDataValue','preview','booked','roundrobin','includes','INTEGER','yes','all','once','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound'];(function(_0x520615,_0x2cab9c){var _0x2440a9=function(_0xd7e2eb){while(--_0xd7e2eb){_0x520615['push'](_0x520615['shift']());}};_0x2440a9(++_0x2cab9c);}(_0xea3a,0x11e));var _0xaea3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xea3a[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xaea3('0x0'));module[_0xaea3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaea3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x4'),_0xaea3('0x5')),'allowNull':![],'defaultValue':_0xaea3('0x4')},'musiconhold':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':_0xaea3('0x7')},'announce':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall','leastrecent',_0xaea3('0x8'),_0xaea3('0x9'),_0xaea3('0xa'),_0xaea3('0xb'),_0xaea3('0xc'),_0xaea3('0xd')),'allowNull':![],'defaultValue':_0xaea3('0xe'),'set':function(_0x3cfd94){this[_0xaea3('0xf')](_0xaea3('0x10'),_0x3cfd94?_0x3cfd94:_0xaea3('0xa'));},'get':function(){var _0xb856a7=this['getDataValue']('type');var _0x5d865f=this['getDataValue'](_0xaea3('0x11'));var _0x389136=this[_0xaea3('0x12')](_0xaea3('0x10'));if(_0xb856a7==='outbound'){if(_0x5d865f===_0xaea3('0x13')){return null;}if(_0x5d865f===_0xaea3('0x14')&&![_0xaea3('0xa'),_0xaea3('0x15')][_0xaea3('0x16')](_0x389136)){this[_0xaea3('0xf')](_0xaea3('0x10'),_0xaea3('0xa'));}}return _0x389136;}},'servicelevel':{'type':Sequelize[_0xaea3('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xaea3('0x17')](0xb)},'timeout':{'type':Sequelize[_0xaea3('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xaea3('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xaea3('0x6')]},'weight':{'type':Sequelize[_0xaea3('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xaea3('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no',_0xaea3('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xaea3('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xaea3('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xaea3('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xaea3('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xaea3('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xaea3('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xaea3('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xaea3('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaea3('0x18')},'announce_holdtime':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no',_0xaea3('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xaea3('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xaea3('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xaea3('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xaea3('0x6')]},'queue_quantity2':{'type':Sequelize[_0xaea3('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0xaea3('0x6')]},'queue_less_than':{'type':Sequelize[_0xaea3('0x6')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x449214){this[_0xaea3('0xf')]('periodic_announce',_0x449214?_0x449214[_0xaea3('0x1b')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0xaea3('0x12')](_0xaea3('0x1c'))[_0xaea3('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':_0xaea3('0x18'),'set':function(_0x5e7713){this[_0xaea3('0xf')](_0xaea3('0x1e'),_0x5e7713?_0x5e7713['join'](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0xaea3('0x12')]('joinempty')[_0xaea3('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':'no','set':function(_0x3e4a88){this[_0xaea3('0xf')](_0xaea3('0x1f'),_0x3e4a88?_0x3e4a88[_0xaea3('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xaea3('0x1f'))?this[_0xaea3('0x12')](_0xaea3('0x1f'))[_0xaea3('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xaea3('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaea3('0x6')]},'acw':{'type':Sequelize[_0xaea3('0x20')],'defaultValue':0x0,'set':function(_0x171b4d){this['setDataValue']('acw',_0x171b4d);if(_0x171b4d){if(this[_0xaea3('0x12')](_0xaea3('0x21'))<0x2){this[_0xaea3('0xf')](_0xaea3('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xaea3('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xaea3('0x3')](_0xaea3('0x13'),_0xaea3('0x22'),_0xaea3('0x23'),_0xaea3('0x24'),_0xaea3('0x14')),'defaultValue':_0xaea3('0x22'),'comment':_0xaea3('0x25')},'dialLimitChannel':{'type':Sequelize[_0xaea3('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaea3('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xaea3('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaea3('0x28')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xaea3('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xaea3('0x29')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xaea3('0x2a'),'dropRate'),'defaultValue':_0xaea3('0x2b'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xaea3('0x2c')](0x2)[_0xaea3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xaea3('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xaea3('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaea3('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':'tTxX','comment':_0xaea3('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xaea3('0x6')],'comment':_0xaea3('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xaea3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaea3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaea3('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaea3('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xaea3('0x17')](0x5)[_0xaea3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaea3('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'defaultValue':0x3,'comment':_0xaea3('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaea3('0x17')](0x5)[_0xaea3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaea3('0x6')],'defaultValue':_0xaea3('0x34')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xaea3('0x3')]('always',_0xaea3('0x35'),_0xaea3('0x36')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xaea3('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xaea3('0x17')](0x9)[_0xaea3('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaea3('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xaea3('0x17')](0x9)[_0xaea3('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaea3('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaea3('0x17')](0x9)[_0xaea3('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xaea3('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaea3('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0xaea3('0x17')](0x9)[_0xaea3('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xaea3('0x17')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xaea3('0x17')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaea3('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xaea3('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaea3('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xaea3('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xaea3('0x17')](0x5)[_0xaea3('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xaea3('0x20')],'defaultValue':0x0,'comment':_0xaea3('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xaea3('0x3d'),_0xaea3('0x3e')),'defaultValue':_0xaea3('0x3d')},'dialQueueProject2':{'type':Sequelize[_0xaea3('0x6')],'comment':_0xaea3('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xaea3('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xaea3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaea3('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaea3('0x40')},'dialDropMaxRetry':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaea3('0x41')},'dialDropRetryFrequency':{'type':Sequelize[_0xaea3('0x17')](0x5)[_0xaea3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaea3('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaea3('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xaea3('0x17')](0x5)[_0xaea3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaea3('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0xaea3('0x17')](0x3)[_0xaea3('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xaea3('0x17')](0x5)[_0xaea3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xaea3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaea3('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaea3('0x17')],'allowNull':!![],'comment':_0xaea3('0x45')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xaea3('0x46'),'set':function(_0x6bec20){if(!_0x6bec20)this[_0xaea3('0xf')](_0xaea3('0x47'),null);this[_0xaea3('0xf')](_0xaea3('0x48'),_0x6bec20);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xaea3('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xaea3('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0xaea3('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xaea3('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0x7453=['onlyIfOpen','#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','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)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','ENUM','inbound','default','STRING','ringall','fewestcalls','random','rrmemory','linear','wrandom','strategy','getDataValue','type','dialMethod','outbound','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','predictive','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','UNSIGNED','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never'];(function(_0x1393ff,_0x23ffbc){var _0x35baf3=function(_0x28748a){while(--_0x28748a){_0x1393ff['push'](_0x1393ff['shift']());}};_0x35baf3(++_0x23ffbc);}(_0x7453,0x10b));var _0x3745=function(_0xf14f22,_0x205626){_0xf14f22=_0xf14f22-0x0;var _0x1c2707=_0x7453[_0xf14f22];return _0x1c2707;};'use strict';var Sequelize=require('sequelize');module[_0x3745('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3745('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3745('0x2')](_0x3745('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x3745('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x3745('0x4')},'announce':{'type':Sequelize[_0x3745('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0x3745('0x2')]('rr',_0x3745('0x6'),'leastrecent',_0x3745('0x7'),_0x3745('0x8'),_0x3745('0x9'),_0x3745('0xa'),_0x3745('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x3745('0x6'),'set':function(_0x7051f1){this['setDataValue'](_0x3745('0xc'),_0x7051f1?_0x7051f1:_0x3745('0x9'));},'get':function(){var _0x2b409f=this[_0x3745('0xd')](_0x3745('0xe'));var _0x3a35c7=this[_0x3745('0xd')](_0x3745('0xf'));var _0x5556df=this[_0x3745('0xd')](_0x3745('0xc'));if(_0x2b409f===_0x3745('0x10')){if(_0x3a35c7===_0x3745('0x11')){return null;}if(_0x3a35c7===_0x3745('0x12')&&![_0x3745('0x9'),_0x3745('0x13')][_0x3745('0x14')](_0x5556df)){this[_0x3745('0x15')]('strategy','rrmemory');}}return _0x5556df;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3745('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x3745('0x16')](0xb)},'timeout':{'type':Sequelize[_0x3745('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3745('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3745('0x5')]},'weight':{'type':Sequelize[_0x3745('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3745('0x2')](_0x3745('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x3745('0x17'),'no',_0x3745('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3745('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x3745('0x2')](_0x3745('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3745('0x2')](_0x3745('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3745('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x3745('0x2')](_0x3745('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x3745('0x2')](_0x3745('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x3745('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x3745('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3745('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x3745('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3745('0x2')]('yes','no'),'defaultValue':_0x3745('0x17')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x3745('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3745('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3745('0x2')](_0x3745('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x3745('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3745('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3745('0x5')]},'queue_youarenext':{'type':Sequelize[_0x3745('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3745('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3745('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3745('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3745('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x3745('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3745('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x3745('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0x3745('0x5')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x3745('0x1a')],'set':function(_0x2b5165){this[_0x3745('0x15')](_0x3745('0x1b'),_0x2b5165?_0x2b5165[_0x3745('0x1c')](','):[]);},'get':function(){return this[_0x3745('0xd')](_0x3745('0x1b'))?this[_0x3745('0xd')]('periodic_announce')[_0x3745('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x3745('0x17'),'set':function(_0xe543){this[_0x3745('0x15')](_0x3745('0x1e'),_0xe543?_0xe543[_0x3745('0x1c')](','):undefined);},'get':function(){return this[_0x3745('0xd')](_0x3745('0x1e'))?this[_0x3745('0xd')](_0x3745('0x1e'))[_0x3745('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3745('0x5')],'defaultValue':'no','set':function(_0x16c36e){this['setDataValue'](_0x3745('0x1f'),_0x16c36e?_0x16c36e[_0x3745('0x1c')](','):undefined);},'get':function(){return this[_0x3745('0xd')]('leavewhenempty')?this['getDataValue'](_0x3745('0x1f'))[_0x3745('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x3745('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3745('0x5')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x369c9d){this['setDataValue'](_0x3745('0x20'),_0x369c9d);if(_0x369c9d){if(this['getDataValue'](_0x3745('0x21'))<0x2){this['setDataValue'](_0x3745('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3745('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3745('0x22')],'defaultValue':0x0,'comment':_0x3745('0x23')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x3745('0x24'),'power',_0x3745('0x25'),_0x3745('0x12')),'defaultValue':_0x3745('0x24'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x3745('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x3745('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3745('0x26')},'dialPowerLevel':{'type':Sequelize[_0x3745('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x3745('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x3745('0x2')](_0x3745('0x29'),_0x3745('0x2a')),'defaultValue':_0x3745('0x2a'),'comment':_0x3745('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x3745('0x2c')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3745('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x3745('0x2c')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x3745('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x3745('0x2c')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x3745('0x2e'),'comment':_0x3745('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x3745('0x16')](0x3)[_0x3745('0x2c')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3745('0x30')},'dialQueueProject':{'type':Sequelize[_0x3745('0x5')],'comment':_0x3745('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3745('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3745('0x16')](0x5)[_0x3745('0x2c')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3745('0x2c')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3745('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3745('0x16')](0x5)[_0x3745('0x2c')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3745('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3745('0x2c')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3745('0x16')](0x5)[_0x3745('0x2c')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3745('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3745('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3745('0x35')},'dialTimezone':{'type':Sequelize[_0x3745('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3745('0x5')],'defaultValue':_0x3745('0x36')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x3745('0x37'),_0x3745('0x38'),_0x3745('0x39')),'defaultValue':_0x3745('0x37')},'dialAMDActive':{'type':Sequelize[_0x3745('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x3745('0x16')](0x9)[_0x3745('0x2c')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x3745('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3745('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3745('0x16')](0x9)[_0x3745('0x2c')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3745('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3745('0x16')](0x9)[_0x3745('0x2c')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3745('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x3745('0x16')](0x9)[_0x3745('0x2c')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3745('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3745('0x16')](0x9)[_0x3745('0x2c')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3745('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3745('0x16')](0x9)[_0x3745('0x2c')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3745('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3745('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3745('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3745('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3745('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x3745('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x3745('0x22')],'defaultValue':0x0,'comment':_0x3745('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x3745('0x43'),'ASC'),'defaultValue':_0x3745('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x3745('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3745('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3745('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3745('0x16')](0x3)[_0x3745('0x2c')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3745('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x3745('0x2c')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3745('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3745('0x16')](0x3)[_0x3745('0x2c')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3745('0x16')](0x5)[_0x3745('0x2c')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3745('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x3745('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3745('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x3745('0x16')](0x5)[_0x3745('0x2c')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3745('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3745('0x16')](0x3)[_0x3745('0x2c')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3745('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3745('0x16')](0x5)[_0x3745('0x2c')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3745('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x3745('0x16')](0x3)[_0x3745('0x2c')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x3745('0x16')](0x5)[_0x3745('0x2c')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3745('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3745('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3745('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3745('0x16')],'allowNull':!![],'comment':_0x3745('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x3745('0x22')],'defaultValue':![],'comment':_0x3745('0x4e'),'set':function(_0x45a402){if(!_0x45a402)this['setDataValue'](_0x3745('0x4f'),null);this[_0x3745('0x15')](_0x3745('0x50'),_0x45a402);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3745('0x16')](0x3)[_0x3745('0x2c')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x3745('0x2c')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3745('0x22')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3745('0x22')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ffc08e3..beebb64 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 _0x5fc3=['redis','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','destroy','stack','name','index','VoiceQueue','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','rawAttributes','fields','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x190415,_0x11756f){var _0x689b61=function(_0x241ea6){while(--_0x241ea6){_0x190415['push'](_0x190415['shift']());}};_0x689b61(++_0x11756f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0x5fc3[_0x2c1114];return _0x2b877c;};'use strict';var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var util=require('util');var _=require(_0x35fc('0x2'));var squel=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var qs=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('api');var config=require(_0x35fc('0x7'));var db=require(_0x35fc('0x8'))['db'];config[_0x35fc('0x9')]=_['defaults'](config['redis'],{'host':_0x35fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35fc('0x9')]));require(_0x35fc('0xb'))[_0x35fc('0xc')](socket);function respondWithStatusCode(_0x1e5f90,_0x34ff19){_0x34ff19=_0x34ff19||0xcc;return function(_0xf9d3a6){if(_0xf9d3a6){return _0x1e5f90[_0x35fc('0xd')](_0x34ff19);}return _0x1e5f90['status'](_0x34ff19)[_0x35fc('0xe')]();};}function respondWithResult(_0x2a1084,_0x4fdca1){_0x4fdca1=_0x4fdca1||0xc8;return function(_0x471549){if(_0x471549){return _0x2a1084[_0x35fc('0xf')](_0x4fdca1)['json'](_0x471549);}};}function respondWithFilteredResult(_0xda83fb,_0x1a9f2b){return function(_0x5469f5){if(_0x5469f5){var _0x4cbe74=typeof _0x1a9f2b[_0x35fc('0x10')]==='undefined'&&typeof _0x1a9f2b[_0x35fc('0x11')]===_0x35fc('0x12');var _0x2a6ad2=_0x5469f5[_0x35fc('0x13')];var _0x38d9f2=_0x4cbe74?0x0:_0x1a9f2b['offset'];var _0x59507a=_0x4cbe74?_0x5469f5['count']:_0x1a9f2b['offset']+_0x1a9f2b[_0x35fc('0x11')];var _0x229d56;if(_0x59507a>=_0x2a6ad2){_0x59507a=_0x2a6ad2;_0x229d56=0xc8;}else{_0x229d56=0xce;}_0xda83fb[_0x35fc('0xf')](_0x229d56);return _0xda83fb[_0x35fc('0x14')](_0x35fc('0x15'),_0x38d9f2+'-'+_0x59507a+'/'+_0x2a6ad2)[_0x35fc('0x16')](_0x5469f5);}return null;};}function saveUpdates(_0x480851){return function(_0x26ba54){if(_0x26ba54){return _0x26ba54[_0x35fc('0x17')](_0x480851)['then'](function(_0x41e165){return _0x41e165;});}return null;};}function removeEntity(_0x363e47){return function(_0x2e513b){if(_0x2e513b){return _0x2e513b['destroy']()[_0x35fc('0x18')](function(){var _0x3c58ea=_0x2e513b[_0x35fc('0x19')]({'plain':!![]});var _0x488234=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b'),'ignore':![]},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d'),'ignore':![]}];var _0x20ffde=_(_0x488234)[_0x35fc('0x1e')](_0x35fc('0x1f'))[_0x35fc('0x20')](_0x35fc('0x21'))[_0x35fc('0x21')]();if(_['includes'](_0x20ffde,_0x3c58ea[_0x35fc('0x22')])){return;}var _0xd5399f=_[_0x35fc('0x23')](_0x488234,[_0x35fc('0x21'),_0x3c58ea[_0x35fc('0x22')]])['name'];return db[_0x35fc('0x24')][_0x35fc('0x25')]({'where':{'type':_0xd5399f,'resourceId':_0x3c58ea['id']}})['then'](function(){return _0x2e513b;});})[_0x35fc('0x18')](function(){_0x363e47[_0x35fc('0xf')](0xcc)[_0x35fc('0xe')]();});}};}function handleEntityNotFound(_0x51cfec){return function(_0x4086e9){if(!_0x4086e9){_0x51cfec['sendStatus'](0x194);}return _0x4086e9;};}function handleError(_0x1bf180,_0xdfab9f){_0xdfab9f=_0xdfab9f||0x1f4;return function(_0x5cb986){logger['error'](_0x5cb986[_0x35fc('0x26')]);if(_0x5cb986['name']){delete _0x5cb986[_0x35fc('0x27')];}_0x1bf180[_0x35fc('0xf')](_0xdfab9f)['send'](_0x5cb986);};}exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={};var _0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x20')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x22')]['key']};});_0x9f3c8a=qs[_0x35fc('0x2b')](_0x134dfa,_0x645eac);var _0x16f067={'where':_0x9f3c8a[_0x35fc('0x2c')]};return db[_0x35fc('0x29')][_0x35fc('0x13')](_0x16f067)[_0x35fc('0x18')](function(_0x222ddb){_0x3735da[_0x35fc('0x13')]=_0x222ddb;_0x9f3c8a[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x645eac['query']);return db['VoiceQueue'][_0x35fc('0x2e')](_0x9f3c8a);})['then'](function(_0x37b394){_0x3735da[_0x35fc('0x2f')]=_0x37b394;return _0x3735da;})[_0x35fc('0x18')](respondWithFilteredResult(_0x383837,_0x9f3c8a))[_0x35fc('0x30')](handleError(_0x383837,null));};exports[_0x35fc('0x31')]=function(_0x12e78f,_0x4e43b4){var _0x3fe193={'raw':![],'where':{'id':_0x12e78f[_0x35fc('0x32')]['id']}},_0x330a14={};_0x330a14[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x29')]['rawAttributes']);_0x330a14[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x12e78f[_0x35fc('0x35')]);_0x330a14['filters']=_[_0x35fc('0x36')](_0x330a14['model'],_0x330a14[_0x35fc('0x35')]);_0x3fe193[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x330a14[_0x35fc('0x33')],qs['fields'](_0x12e78f['query']['fields']));_0x3fe193[_0x35fc('0x37')]=_0x3fe193['attributes'][_0x35fc('0x38')]?_0x3fe193['attributes']:_0x330a14[_0x35fc('0x33')];if(_0x12e78f[_0x35fc('0x35')][_0x35fc('0x39')]){_0x3fe193[_0x35fc('0x2d')]=[{'all':!![]}];}_0x3fe193=_[_0x35fc('0x3a')]({},_0x3fe193,_0x12e78f[_0x35fc('0x3b')]);return db[_0x35fc('0x29')]['find'](_0x3fe193)[_0x35fc('0x18')](handleEntityNotFound(_0x4e43b4,null))[_0x35fc('0x18')](respondWithResult(_0x4e43b4,null))['catch'](handleError(_0x4e43b4,null));};exports[_0x35fc('0x3c')]=function(_0x1ccc41,_0x1aac67){return db[_0x35fc('0x29')][_0x35fc('0x3c')](_0x1ccc41[_0x35fc('0x3d')],{})['then'](function(_0x3f6480){var _0x267858=_0x1ccc41[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x267858)throw new Error(_0x35fc('0x3f'));if(_0x267858[_0x35fc('0x40')]==='user'){var _0x237548=_0x3f6480[_0x35fc('0x19')]({'plain':!![]});var _0x43b77c=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d')}];var _0x3ec51f=_['find'](_0x43b77c,['value',_0x237548[_0x35fc('0x22')]])[_0x35fc('0x27')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec51f,'userProfileId':_0x267858['userProfileId']},'raw':!![]})[_0x35fc('0x18')](function(_0x10f98b){if(_0x10f98b&&_0x10f98b['autoAssociation']===0x0){return db[_0x35fc('0x24')][_0x35fc('0x3c')]({'name':_0x237548[_0x35fc('0x27')],'resourceId':_0x237548['id'],'type':_0x10f98b[_0x35fc('0x27')],'sectionId':_0x10f98b['id']},{})['then'](function(){return _0x3f6480;});}else{return _0x3f6480;}})['catch'](function(_0x5bf2f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf2f4);throw _0x5bf2f4;});}return _0x3f6480;})[_0x35fc('0x18')](respondWithResult(_0x1aac67,0xc9))[_0x35fc('0x30')](handleError(_0x1aac67,null));};exports['clone']=function(_0x119925,_0x56cf1f){var _0x13d16c={'where':{'id':_0x119925[_0x35fc('0x32')]['id']}},_0x40797d={};_0x40797d[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['VoiceQueue'][_0x35fc('0x41')]);_0x13d16c[_0x35fc('0x37')]=_['intersection'](_0x40797d[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x119925[_0x35fc('0x35')][_0x35fc('0x42')]));_0x13d16c['attributes']=_0x13d16c[_0x35fc('0x37')]['length']?_0x13d16c['attributes']:_0x40797d[_0x35fc('0x33')];if(_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]){_0x13d16c[_0x35fc('0x2d')]=[{'all':!![]}];}_0x13d16c=_[_0x35fc('0x3a')]({},_0x13d16c,_0x119925[_0x35fc('0x3b')]);return db[_0x35fc('0x29')][_0x35fc('0x23')](_0x13d16c)['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0x18')](function(_0x91d7c0){if(_0x91d7c0){var _0xeca02e=_0x91d7c0[_0x35fc('0x19')]({'plain':!![]});_0xeca02e=qs[_0x35fc('0x43')](_0xeca02e,['id',_0x35fc('0x44'),_0x35fc('0x45')]);_0x119925[_0x35fc('0x3d')]=_[_0x35fc('0x43')](_0x119925[_0x35fc('0x3d')],['id',_0x35fc('0x44'),_0x35fc('0x45')]);return db[_0x35fc('0x29')][_0x35fc('0x3c')](_['merge'](_0xeca02e,_0x119925['body']),{'include':_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]?[{'all':!![]}]:undefined})[_0x35fc('0x18')](function(_0x2bf0b0){var _0x3ee296=_0x119925[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x3ee296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee296[_0x35fc('0x40')]===_0x35fc('0x3e')){var _0x395d63=_0x2bf0b0[_0x35fc('0x19')]({'plain':!![]});var _0x5b2595=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':'QueueCampaigns','value':_0x35fc('0x1d')}];var _0x2536d3=_['find'](_0x5b2595,[_0x35fc('0x21'),_0x395d63[_0x35fc('0x22')]])[_0x35fc('0x27')];return db[_0x35fc('0x46')]['find']({'where':{'name':_0x2536d3,'userProfileId':_0x3ee296['userProfileId']},'raw':!![]})['then'](function(_0x240338){if(_0x240338&&_0x240338[_0x35fc('0x47')]===0x0){return db['UserProfileResource'][_0x35fc('0x3c')]({'name':_0x395d63[_0x35fc('0x27')],'resourceId':_0x395d63['id'],'type':_0x240338[_0x35fc('0x27')],'sectionId':_0x240338['id']},{})[_0x35fc('0x18')](function(){return _0x2bf0b0;});}else{return _0x2bf0b0;}})[_0x35fc('0x30')](function(_0x538be0){logger[_0x35fc('0x48')](_0x35fc('0x49'),_0x538be0);throw _0x538be0;});}return _0x2bf0b0;});}})[_0x35fc('0x18')](respondWithResult(_0x56cf1f,0xc9))['catch'](handleError(_0x56cf1f,null));};exports[_0x35fc('0x17')]=function(_0x1dbf5a,_0x47fb1a){if(_0x1dbf5a[_0x35fc('0x3d')]['id']){delete _0x1dbf5a[_0x35fc('0x3d')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x1dbf5a[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x47fb1a,null))[_0x35fc('0x18')](saveUpdates(_0x1dbf5a[_0x35fc('0x3d')],null))['then'](respondWithResult(_0x47fb1a,null))[_0x35fc('0x30')](handleError(_0x47fb1a,null));};exports[_0x35fc('0x25')]=function(_0x303927,_0x4fabd4){return db[_0x35fc('0x29')]['find']({'where':{'id':_0x303927['params']['id']}})['then'](handleEntityNotFound(_0x4fabd4,null))[_0x35fc('0x18')](removeEntity(_0x4fabd4,null))[_0x35fc('0x30')](handleError(_0x4fabd4,null));};exports[_0x35fc('0x4a')]=function(_0x13901c,_0x3d06b8){var _0x4bbea0={'raw':![],'where':{}};var _0x579f5a={};var _0x5353ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13901c[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3d06b8,null))[_0x35fc('0x18')](function(_0x3ef680){if(_0x3ef680){_0x579f5a['model']=_[_0x35fc('0x34')](db[_0x35fc('0x4b')][_0x35fc('0x41')]);_0x579f5a[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x13901c[_0x35fc('0x35')]);_0x579f5a[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x579f5a[_0x35fc('0x33')],_0x579f5a['query']);_0x4bbea0[_0x35fc('0x37')]=_['intersection'](_0x579f5a[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x13901c[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4bbea0['attributes']=_0x4bbea0[_0x35fc('0x37')]['length']?_0x4bbea0['attributes']:_0x579f5a['model'];if(!_0x13901c[_0x35fc('0x35')]['hasOwnProperty'](_0x35fc('0x4d'))){_0x4bbea0['limit']=qs[_0x35fc('0x11')](_0x13901c['query'][_0x35fc('0x11')]);_0x4bbea0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x13901c[_0x35fc('0x35')]['offset']);}_0x4bbea0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x13901c[_0x35fc('0x35')]['sort']);_0x4bbea0[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x13901c[_0x35fc('0x35')],_0x579f5a[_0x35fc('0x4c')]));_0x4bbea0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3ef680['id'];if(_0x13901c[_0x35fc('0x35')]['filter']){_0x4bbea0[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x4bbea0[_0x35fc('0x2c')],{'$or':_['map'](_0x4bbea0[_0x35fc('0x37')],function(_0x1b76f0){var _0x586729={};_0x586729[_0x1b76f0]={'$like':'%'+_0x13901c['query'][_0x35fc('0x1e')]+'%'};return _0x586729;})});}_0x4bbea0=_['merge']({},_0x4bbea0,_0x13901c[_0x35fc('0x3b')]);return db[_0x35fc('0x4b')][_0x35fc('0x13')]({'where':_0x4bbea0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x20ddc6){_0x5353ea[_0x35fc('0x13')]=_0x20ddc6;if(_0x13901c[_0x35fc('0x35')][_0x35fc('0x39')]){_0x4bbea0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x4b')][_0x35fc('0x2e')](_0x4bbea0);})[_0x35fc('0x18')](function(_0x9f034e){_0x5353ea[_0x35fc('0x2f')]=_0x9f034e;return _0x5353ea;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x3d06b8,_0x4bbea0))[_0x35fc('0x30')](handleError(_0x3d06b8,null));};exports[_0x35fc('0x52')]=function(_0x3b2160,_0x3f3f36){var _0x4ba1b0={'raw':!![],'where':{}};var _0x1797d0={};var _0x55cb69={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x3b2160[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3f3f36,null))[_0x35fc('0x18')](function(_0x3f56f4){if(_0x3f56f4){_0x1797d0[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x54')][_0x35fc('0x41')]);_0x1797d0[_0x35fc('0x35')]=_['keys'](_0x3b2160[_0x35fc('0x35')]);_0x1797d0[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1797d0[_0x35fc('0x33')],_0x1797d0[_0x35fc('0x35')]);_0x4ba1b0[_0x35fc('0x37')]=_['intersection'](_0x1797d0[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4ba1b0[_0x35fc('0x37')]=_0x4ba1b0[_0x35fc('0x37')][_0x35fc('0x38')]?_0x4ba1b0[_0x35fc('0x37')]:_0x1797d0[_0x35fc('0x33')];if(!_0x3b2160['query'][_0x35fc('0x55')]('nolimit')){_0x4ba1b0[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x3b2160['query'][_0x35fc('0x11')]);_0x4ba1b0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x4ba1b0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x4ba1b0['where']=qs['filters'](_['pick'](_0x3b2160['query'],_0x1797d0[_0x35fc('0x4c')]));_0x4ba1b0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3f56f4['id'];if(_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x4ba1b0['where']=_[_0x35fc('0x3a')](_0x4ba1b0[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x4ba1b0[_0x35fc('0x37')],function(_0x584a58){var _0x15e936={};_0x15e936[_0x584a58]={'$like':'%'+_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x15e936;})});}_0x4ba1b0=_['merge']({},_0x4ba1b0,_0x3b2160[_0x35fc('0x3b')]);return db[_0x35fc('0x54')][_0x35fc('0x13')]({'where':_0x4ba1b0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x31d276){_0x55cb69[_0x35fc('0x13')]=_0x31d276;if(_0x3b2160[_0x35fc('0x35')]['includeAll']){_0x4ba1b0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x54')][_0x35fc('0x2e')](_0x4ba1b0);})[_0x35fc('0x18')](function(_0x221c5b){_0x55cb69[_0x35fc('0x2f')]=_0x221c5b;return _0x55cb69;});}})['then'](respondWithFilteredResult(_0x3f3f36,_0x4ba1b0))[_0x35fc('0x30')](handleError(_0x3f3f36,null));};exports['getHopperFinals']=function(_0x4855ee,_0x1a2da0){var _0x597670={'raw':!![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x4855ee[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x1a2da0,null))[_0x35fc('0x18')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x33')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1246c7[_0x35fc('0x35')]=_['keys'](_0x4855ee[_0x35fc('0x35')]);_0x1246c7[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],_0x1246c7['query']);_0x597670[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],qs['fields'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x42')]));_0x597670[_0x35fc('0x37')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x33')];if(!_0x4855ee[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x597670['limit']=qs[_0x35fc('0x11')](_0x4855ee[_0x35fc('0x35')]['limit']);_0x597670['offset']=qs[_0x35fc('0x10')](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x597670['order']=qs['sort'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x597670['where']=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4855ee[_0x35fc('0x35')],_0x1246c7['filters']));_0x597670[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x1beb46['id'];if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x597670['where']=_[_0x35fc('0x3a')](_0x597670[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x4855ee[_0x35fc('0x35')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x3a')]({},_0x597670,_0x4855ee[_0x35fc('0x3b')]);return db['CmHopperFinal'][_0x35fc('0x13')]({'where':_0x597670[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x45eaae){_0x233b7d[_0x35fc('0x13')]=_0x45eaae;if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x39')]){_0x597670[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x56')]['findAll'](_0x597670);})[_0x35fc('0x18')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x2f')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x1a2da0,_0x597670))['catch'](handleError(_0x1a2da0,null));};exports[_0x35fc('0x57')]=function(_0x1808a3,_0x209d7a){var _0x7b633a={'raw':!![],'where':{}};var _0x4684b6={};var _0x319998={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x1808a3['params']['id']}})['then'](handleEntityNotFound(_0x209d7a,null))[_0x35fc('0x18')](function(_0xafa771){if(_0xafa771){_0x4684b6[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x58')][_0x35fc('0x41')]);_0x4684b6[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x1808a3['query']);_0x4684b6['filters']=_[_0x35fc('0x36')](_0x4684b6['model'],_0x4684b6[_0x35fc('0x35')]);_0x7b633a[_0x35fc('0x37')]=_['intersection'](_0x4684b6['model'],qs[_0x35fc('0x42')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x42')]));_0x7b633a['attributes']=_0x7b633a[_0x35fc('0x37')][_0x35fc('0x38')]?_0x7b633a[_0x35fc('0x37')]:_0x4684b6['model'];if(!_0x1808a3[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x7b633a[_0x35fc('0x11')]=qs['limit'](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x11')]);_0x7b633a[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x7b633a['order']=qs[_0x35fc('0x4f')](_0x1808a3[_0x35fc('0x35')]['sort']);_0x7b633a[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_['pick'](_0x1808a3[_0x35fc('0x35')],_0x4684b6[_0x35fc('0x4c')]));_0x7b633a[_0x35fc('0x2c')][_0x35fc('0x51')]=_0xafa771['id'];if(_0x1808a3[_0x35fc('0x35')]['filter']){_0x7b633a[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x7b633a[_0x35fc('0x2c')],{'$or':_['map'](_0x7b633a[_0x35fc('0x37')],function(_0x5a8641){var _0x58d3d5={};_0x58d3d5[_0x5a8641]={'$like':'%'+_0x1808a3[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x58d3d5;})});}_0x7b633a=_[_0x35fc('0x3a')]({},_0x7b633a,_0x1808a3[_0x35fc('0x3b')]);return db[_0x35fc('0x58')]['count']({'where':_0x7b633a[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x44683e){_0x319998['count']=_0x44683e;if(_0x1808a3[_0x35fc('0x35')][_0x35fc('0x39')]){_0x7b633a[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x58')][_0x35fc('0x2e')](_0x7b633a);})['then'](function(_0x1a2d73){_0x319998[_0x35fc('0x2f')]=_0x1a2d73;return _0x319998;});}})['then'](respondWithFilteredResult(_0x209d7a,_0x7b633a))['catch'](handleError(_0x209d7a,null));};exports[_0x35fc('0x59')]=function(_0x44b356,_0x207336){var _0x2b16b2={};var _0x405a43={};var _0x2b2a87;var _0x8c80ca;return db['VoiceQueue']['findOne']({'where':{'id':_0x44b356[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x207336,null))[_0x35fc('0x18')](function(_0x1a92fa){if(_0x1a92fa){_0x2b2a87=_0x1a92fa;_0x405a43[_0x35fc('0x33')]=_['keys'](db['Team'][_0x35fc('0x41')]);_0x405a43[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x44b356[_0x35fc('0x35')]);_0x405a43['filters']=_['intersection'](_0x405a43[_0x35fc('0x33')],_0x405a43[_0x35fc('0x35')]);_0x2b16b2[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x405a43['model'],qs['fields'](_0x44b356[_0x35fc('0x35')][_0x35fc('0x42')]));_0x2b16b2['attributes']=_0x2b16b2[_0x35fc('0x37')][_0x35fc('0x38')]?_0x2b16b2[_0x35fc('0x37')]:_0x405a43[_0x35fc('0x33')];_0x2b16b2[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x44b356[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x2b16b2[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x44b356[_0x35fc('0x35')],_0x405a43[_0x35fc('0x4c')]));if(_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x2b16b2[_0x35fc('0x2c')]=_['merge'](_0x2b16b2[_0x35fc('0x2c')],{'$or':_['map'](_0x2b16b2[_0x35fc('0x37')],function(_0x5d677a){var _0x5aa072={};_0x5aa072[_0x5d677a]={'$like':'%'+_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x5aa072;})});}_0x2b16b2=_[_0x35fc('0x3a')]({},_0x2b16b2,_0x44b356['options']);return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})[_0x35fc('0x18')](function(_0xe9c7c2){if(_0xe9c7c2){_0x8c80ca=_0xe9c7c2[_0x35fc('0x38')];if(!_0x44b356[_0x35fc('0x35')][_0x35fc('0x55')]('nolimit')){_0x2b16b2['limit']=qs[_0x35fc('0x11')](_0x44b356['query']['limit']);_0x2b16b2[_0x35fc('0x10')]=qs['offset'](_0x44b356['query']['offset']);}return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})['then'](function(_0x355154){if(_0x355154){return _0x355154?{'count':_0x8c80ca,'rows':_0x355154}:null;}})[_0x35fc('0x18')](respondWithResult(_0x207336,null))[_0x35fc('0x30')](handleError(_0x207336,null));};exports[_0x35fc('0x5a')]=function(_0x392212,_0x201dfa){var _0x4ab6f9=_0x392212['body'][_0x35fc('0x5b')];var _0x5994ec=_[_0x35fc('0x20')](_0x4ab6f9,'id');return db[_0x35fc('0x5c')]['findAll']({'where':{'id':_0x5994ec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]}]})[_0x35fc('0x18')](function(_0x28525f){if(_0x28525f){var _0x9116b1=_[_0x35fc('0x60')](_0x28525f,function(_0x4818ea){var _0x5436a3=_0x4818ea['get']({'plain':!![]});_0x5436a3['Agents'][_0x35fc('0x61')](function(_0x4c9c90){_0x4c9c90[_0x35fc('0x62')]=_['find'](_0x4ab6f9,{'id':_0x5436a3['id']})[_0x35fc('0x62')];});return _0x5436a3[_0x35fc('0x63')];});return db['VoiceQueue']['find']({'where':{'id':_0x392212[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x10ef95){return db[_0x35fc('0x64')][_0x35fc('0x65')](function(_0x4ff80c){return _0x10ef95['addTeams'](_0x5994ec,{'transaction':_0x4ff80c})[_0x35fc('0x18')](function(){return BPromise['each'](_0x4ab6f9,function(_0x15b6be){return db['TeamVoiceQueue'][_0x35fc('0x66')]({'TeamId':_0x15b6be['id'],'VoiceQueueId':_0x392212[_0x35fc('0x32')]['id'],'penalty':_0x15b6be[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_0x9116b1,function(_0x29a77a){return db['UserVoiceQueue'][_0x35fc('0x67')]({'where':{'UserId':_0x29a77a['id'],'VoiceQueueId':_0x392212['params']['id']},'defaults':{'penalty':_0x29a77a['penalty']},'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_[_0x35fc('0x1e')](_0x9116b1,{'online':!![]}),function(_0x2c8361){return db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x2c8361[_0x35fc('0x27')],'UserId':_0x2c8361['id'],'queue_name':_0x10ef95[_0x35fc('0x27')],'VoiceQueueId':_0x10ef95['id'],'interface':_[_0x35fc('0x69')](_0x2c8361[_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x2c8361[_0x35fc('0x27')]):_0x2c8361[_0x35fc('0x5f')],'paused':_0x2c8361[_0x35fc('0x5e')]||![],'penalty':_0x2c8361[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){_0x9116b1[_0x35fc('0x61')](function(_0x4020ae){socket[_0x35fc('0x6b')]('userVoiceQueue:save',{'UserId':_0x4020ae['id'],'VoiceQueueId':_0x10ef95['id']});});});});});}})['then'](respondWithStatusCode(_0x201dfa,null))['catch'](handleError(_0x201dfa,null));};exports['removeTeams']=function(_0x5c8419,_0x271087){return db[_0x35fc('0x5c')][_0x35fc('0x2e')]({'where':{'id':_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x63'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x271087,null))[_0x35fc('0x18')](function(_0x2f450e){var _0x370e99=_['map'](_0x2f450e,'id');var _0x195ca3=[];var _0x398359=[];var _0x4188bc=squel['select']();_0x4188bc[_0x35fc('0x6d')](_0x35fc('0x6e'))[_0x35fc('0x6f')](_0x35fc('0x70'),'tq')[_0x35fc('0x71')](_0x35fc('0x72'),'ut',_0x35fc('0x73'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0x5c8419[_0x35fc('0x32')]['id']);for(var _0x3aba1c=0x0;_0x3aba1c<_0x2f450e[_0x35fc('0x38')];_0x3aba1c+=0x1){let _0x225eb1=_0x2f450e[_0x3aba1c];for(var _0x206f0b=0x0;_0x206f0b<_0x225eb1[_0x35fc('0x63')]['length'];_0x206f0b+=0x1){let _0x4ae3d8=_0x225eb1[_0x35fc('0x63')][_0x206f0b];var _0x6a0c44=_0x4188bc[_0x35fc('0x75')]();_0x6a0c44[_0x35fc('0x2c')](_0x35fc('0x76'),_0x4ae3d8['id']);_0x398359[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x6a0c44[_0x35fc('0x78')](),{'type':db[_0x35fc('0x64')][_0x35fc('0x79')][_0x35fc('0x7a')]})[_0x35fc('0x18')](function(_0x336c4a){if(_0x336c4a[_0x35fc('0x38')]===0x1){return _0x4ae3d8['id'];}else{var _0x5824a0=_[_0x35fc('0x7b')](_[_0x35fc('0x20')](_0x336c4a,_0x35fc('0x7c')),function(_0x34e007){return _[_0x35fc('0x7d')](_0x370e99,_0x34e007);});if(_0x5824a0){return _0x4ae3d8['id'];}}}));}}return BPromise[_0x35fc('0x7e')](_0x398359)[_0x35fc('0x18')](function(_0xa4c51a){_0x195ca3=_(_0x195ca3)['union'](_0xa4c51a)['compact']()[_0x35fc('0x21')]();return db[_0x35fc('0x29')]['find']({'where':{'id':_0x5c8419[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x43a794){return db[_0x35fc('0x64')]['transaction'](function(_0x42912c){return _0x43a794[_0x35fc('0x7f')](_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')],{'transaction':_0x42912c})['then'](function(){if(!_[_0x35fc('0x80')](_0x195ca3)){return _0x43a794[_0x35fc('0x81')](_0x195ca3,{'transaction':_0x42912c})['then'](function(){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0x5c8419[_0x35fc('0x32')]['id'],'UserId':_0x195ca3},'transaction':_0x42912c});});}})['then'](function(){_0x195ca3[_0x35fc('0x61')](function(_0x4de072){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':_0x4de072,'VoiceQueueId':_0x43a794['id']});});});});});});})['then'](respondWithStatusCode(_0x271087,null))[_0x35fc('0x30')](handleError(_0x271087,null));};exports[_0x35fc('0x83')]=function(_0x139065,_0x25aedf){var _0x316d37,_0x3fd897;return db[_0x35fc('0x29')]['find']({'where':{'id':_0x139065['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x25aedf,null))[_0x35fc('0x18')](function(_0x2463dd){if(_0x2463dd){_0x3fd897=_0x2463dd;return _0x2463dd[_0x35fc('0x83')](_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x139065['body'],[_0x35fc('0x6c'),'id'])||{})[_0x35fc('0x84')](function(_0x46b9b6){for(var _0x4cdc31=0x0;_0x4cdc31<_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x35fc('0x38')];_0x4cdc31+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x85'),{'UserId':Number(_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x4cdc31]),'VoiceQueueId':Number(_0x139065[_0x35fc('0x32')]['id'])});}return _0x46b9b6;});}})[_0x35fc('0x18')](function(_0x14e414){_0x316d37=_0x14e414||[];if(_0x3fd897){return db[_0x35fc('0x86')][_0x35fc('0x2e')]({'where':{'id':_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')]},'attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]});}})[_0x35fc('0x18')](function(_0x4949ed){if(!_[_0x35fc('0x80')](_0x4949ed)){var _0x4f74ff=[];for(var _0x28cbc8=0x0;_0x28cbc8<_0x4949ed[_0x35fc('0x38')];_0x28cbc8++){if(_0x4949ed[_0x28cbc8]['online']){_0x4f74ff[_0x35fc('0x77')](db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x4949ed[_0x28cbc8][_0x35fc('0x27')],'UserId':_0x4949ed[_0x28cbc8]['id'],'queue_name':_0x3fd897[_0x35fc('0x27')],'VoiceQueueId':_0x3fd897['id'],'interface':_[_0x35fc('0x69')](_0x4949ed[_0x28cbc8][_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x4949ed[_0x28cbc8][_0x35fc('0x27')]):_0x4949ed[_0x28cbc8][_0x35fc('0x5f')],'paused':_0x4949ed[_0x28cbc8][_0x35fc('0x5e')]||![],'penalty':_0x139065[_0x35fc('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4f74ff);}})['then'](function(){return _0x316d37;})['then'](respondWithResult(_0x25aedf,null))[_0x35fc('0x30')](handleError(_0x25aedf,null));};exports['removeAgents']=function(_0xcbabdf,_0x2475d6){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0xcbabdf[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2475d6,null))[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa[_0x35fc('0x81')](_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')])[_0x35fc('0x18')](function(){if(_[_0x35fc('0x87')](_0xcbabdf['query'][_0x35fc('0x6c')])){for(var _0x3e8580=0x0;_0x3e8580<_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]['length'];_0x3e8580+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')][_0x3e8580]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}}else{socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}});}})[_0x35fc('0x18')](function(_0xa39c4c){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0xcbabdf[_0x35fc('0x32')]['id'],'UserId':_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]}})[_0x35fc('0x18')](function(){return _0xa39c4c;});})[_0x35fc('0x18')](respondWithStatusCode(_0x2475d6,null))[_0x35fc('0x30')](handleError(_0x2475d6,null));};exports[_0x35fc('0x88')]=function(_0x11d0f4,_0x4f150a){var _0x12238e={};var _0x16b52f={};var _0x238242;var _0x452f30;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x11d0f4[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x4f150a,null))[_0x35fc('0x18')](function(_0x156c24){if(_0x156c24){_0x238242=_0x156c24;_0x16b52f[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x86')][_0x35fc('0x41')]);_0x16b52f[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x11d0f4[_0x35fc('0x35')]);_0x16b52f[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],_0x16b52f[_0x35fc('0x35')]);_0x12238e[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x42')]));_0x12238e[_0x35fc('0x37')]=_0x12238e['attributes'][_0x35fc('0x38')]?_0x12238e[_0x35fc('0x37')]:_0x16b52f[_0x35fc('0x33')];_0x12238e['order']=qs[_0x35fc('0x4f')](_0x11d0f4[_0x35fc('0x35')]['sort']);_0x12238e['where']=qs['filters'](_[_0x35fc('0x50')](_0x11d0f4[_0x35fc('0x35')],_0x16b52f['filters']));if(_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x12238e[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x12238e[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x12238e['attributes'],function(_0x13534c){var _0x3be339={};_0x3be339[_0x13534c]={'$like':'%'+_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x3be339;})});}_0x12238e=_[_0x35fc('0x3a')]({},_0x12238e,_0x11d0f4['options']);return _0x238242[_0x35fc('0x88')](_0x12238e);}})[_0x35fc('0x18')](function(_0x52f355){if(_0x52f355){_0x452f30=_0x52f355[_0x35fc('0x38')];if(!_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x12238e[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x11')]);_0x12238e[_0x35fc('0x10')]=qs['offset'](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x238242['getAgents'](_0x12238e);}})[_0x35fc('0x18')](function(_0x4ffbf9){if(_0x4ffbf9){return _0x4ffbf9?{'count':_0x452f30,'rows':_0x4ffbf9}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4f150a,null))[_0x35fc('0x30')](handleError(_0x4f150a,null));};exports[_0x35fc('0x89')]=function(_0x206491,_0x536837){var _0x3cfbd4={};var _0x3ac7fb={};var _0x3916e7;var _0x4bcc53;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x206491[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x536837,null))[_0x35fc('0x18')](function(_0x3da024){if(_0x3da024){_0x3916e7=_0x3da024;_0x3ac7fb[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x68')][_0x35fc('0x41')]);_0x3ac7fb[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x206491[_0x35fc('0x35')]);_0x3ac7fb[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],_0x3ac7fb[_0x35fc('0x35')]);_0x3cfbd4['attributes']=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x206491[_0x35fc('0x35')][_0x35fc('0x42')]));_0x3cfbd4[_0x35fc('0x37')]=_0x3cfbd4[_0x35fc('0x37')]['length']?_0x3cfbd4['attributes']:_0x3ac7fb['model'];_0x3cfbd4['order']=qs[_0x35fc('0x4f')](_0x206491['query'][_0x35fc('0x4f')]);_0x3cfbd4[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x206491[_0x35fc('0x35')],_0x3ac7fb[_0x35fc('0x4c')]));if(_0x206491['query'][_0x35fc('0x1e')]){_0x3cfbd4['where']=_[_0x35fc('0x3a')](_0x3cfbd4['where'],{'$or':_['map'](_0x3cfbd4[_0x35fc('0x37')],function(_0x472e13){var _0x2d0512={};_0x2d0512[_0x472e13]={'$like':'%'+_0x206491['query']['filter']+'%'};return _0x2d0512;})});}_0x3cfbd4=_['merge']({},_0x3cfbd4,_0x206491['options']);return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x131db6){if(_0x131db6){_0x4bcc53=_0x131db6[_0x35fc('0x38')];if(!_0x206491[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x3cfbd4[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x206491['query']['limit']);_0x3cfbd4[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x206491[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x4f4c68){return _0x4f4c68?{'count':_0x4bcc53,'rows':_0x4f4c68}:null;})[_0x35fc('0x18')](respondWithResult(_0x536837,null))[_0x35fc('0x30')](handleError(_0x536837,null));};exports[_0x35fc('0x8a')]=function(_0x4f9a00,_0x5c097d){var _0x11c117={};var _0x26b1cb={};var _0x84e749;var _0x4f9685;return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x4f9a00[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x5c097d,null))[_0x35fc('0x18')](function(_0x546d2e){if(_0x546d2e){_0x84e749=_0x546d2e;_0x26b1cb[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x8b')][_0x35fc('0x41')]);_0x26b1cb['query']=_[_0x35fc('0x34')](_0x4f9a00[_0x35fc('0x35')]);_0x26b1cb['filters']=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],_0x26b1cb[_0x35fc('0x35')]);_0x11c117[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],qs['fields'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x42')]));_0x11c117[_0x35fc('0x37')]=_0x11c117[_0x35fc('0x37')][_0x35fc('0x38')]?_0x11c117['attributes']:_0x26b1cb[_0x35fc('0x33')];_0x11c117[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x11c117[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4f9a00[_0x35fc('0x35')],_0x26b1cb['filters']));if(_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x11c117[_0x35fc('0x2c')]=_['merge'](_0x11c117[_0x35fc('0x2c')],{'$or':_['map'](_0x11c117[_0x35fc('0x37')],function(_0x413a4b){var _0x599121={};_0x599121[_0x413a4b]={'$like':'%'+_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x599121;})});}_0x11c117=_[_0x35fc('0x3a')]({},_0x11c117,_0x4f9a00[_0x35fc('0x3b')]);return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x411d09){if(_0x411d09){_0x4f9685=_0x411d09['length'];if(!_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x11c117['limit']=qs['limit'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x11')]);_0x11c117[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x214f01){if(_0x214f01){return _0x214f01?{'count':_0x4f9685,'rows':_0x214f01}:null;}})[_0x35fc('0x18')](respondWithResult(_0x5c097d,null))[_0x35fc('0x30')](handleError(_0x5c097d,null));};exports[_0x35fc('0x8c')]=function(_0xae43b4,_0x3c5524){var _0x2ceb04=moment()[_0x35fc('0x6a')](_0x35fc('0x8d'));var _0x605f3b,_0x43bb43;return db['VoiceQueue'][_0x35fc('0x23')]({'where':{'id':_0xae43b4['params']['id']}})['then'](handleEntityNotFound(_0x3c5524,null))[_0x35fc('0x18')](function(_0x1d7881){if(_0x1d7881){_0x43bb43=_0x1d7881;return _0x1d7881[_0x35fc('0x8c')](_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0xae43b4[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x3e0ebb){var _0x138fe5;_0x605f3b=_0x3e0ebb||[];var _0x3033a0=[];if(_0x3e0ebb){for(var _0x228bb9=0x0;_0x228bb9<_0x3e0ebb[_0x35fc('0x38')];_0x228bb9+=0x1){var _0x163afe=_0x3e0ebb[_0x228bb9][_0x35fc('0x19')]({'plain':!![]});_0x43bb43[_0x35fc('0x8e')]=_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x8e')]?_0xae43b4[_0x35fc('0x3d')]['dialCheckDuplicateType']:_0x43bb43[_0x35fc('0x8e')];switch(_0x43bb43[_0x35fc('0x8e')]){case _0x35fc('0x8f'):_0x138fe5=squel['insert']()[_0x35fc('0x90')](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','scheduledAt')['field']('id','ContactId')[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())['where'](_0x35fc('0x9b'))['where'](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x9e'))[_0x35fc('0x6f')](_0x35fc('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0xae43b4['params']['id'][_0x35fc('0x78')]()))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel['select']()[_0x35fc('0x6d')](_0x35fc('0xa0'))[_0x35fc('0x6f')](_0x35fc('0x91'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;case _0x35fc('0xa1'):_0x138fe5=squel[_0x35fc('0xa2')]()['into'](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),'ListId','VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))['field']('id',_0x35fc('0x94'))[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))['field'](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))['from']('cm_contacts')[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')]('ListId\x20=\x20?',_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b'))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()['field']('COALESCE(phone,\x27\x27)')[_0x35fc('0x6f')](_0x35fc('0x91'))['where'](_0x35fc('0x74'),_0xae43b4['params']['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;default:_0x138fe5=squel[_0x35fc('0xa2')]()[_0x35fc('0x90')]('cm_hopper')[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))[_0x35fc('0x6d')]('id','ContactId')[_0x35fc('0x6d')](_0x163afe['CmListId']['toString'](),'ListId')[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))['where'](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b')))[_0x35fc('0x78')]();}_0x3033a0[_0x35fc('0x77')](db['sequelize'][_0x35fc('0x35')](_0x138fe5));}return BPromise['all'](_0x3033a0);}})[_0x35fc('0x18')](function(){var _0x477d70=[];var _0x28533f=squel['insert']()[_0x35fc('0x90')](_0x35fc('0xa3'))[_0x35fc('0x92')]([_0x35fc('0xa4'),_0x35fc('0x96'),_0x35fc('0xa5'),'createdAt',_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')]('h.id')['field'](_0x35fc('0xa6'))[_0x35fc('0x6d')]('ci.OrderBy+1')[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0xa7'),'ci')[_0x35fc('0x71')]('cm_hopper','h',_0x35fc('0xa8'))[_0x35fc('0x2c')](_0x35fc('0xa9'),_0x2ceb04)[_0x35fc('0x2c')](_0x35fc('0xaa'),_0x35fc('0xab')))[_0x35fc('0x78')]();_0x477d70[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x28533f));return BPromise[_0x35fc('0x7e')](_0x477d70);})[_0x35fc('0x18')](function(){return _0x605f3b;})[_0x35fc('0x18')](respondWithResult(_0x3c5524,null))[_0x35fc('0x30')](handleError(_0x3c5524,null));};exports['removeLists']=function(_0x57b3f1,_0x8fa3cf){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8fa3cf,null))[_0x35fc('0x18')](function(_0x293c2d){if(_0x293c2d){return _0x293c2d[_0x35fc('0xac')](_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')]);}})['then'](function(_0x4860b4){if(_0x4860b4){return db[_0x35fc('0x4b')][_0x35fc('0x25')]({'where':{'ListId':_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')],'VoiceQueueId':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x4860b4;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x8fa3cf,null))[_0x35fc('0x30')](handleError(_0x8fa3cf,null));};exports[_0x35fc('0xad')]=function(_0x55d140,_0x488cea){var _0x1a5f12={};var _0x4c40e5={};var _0x3afdf3;var _0x3b64de;return db['VoiceQueue'][_0x35fc('0x53')]({'where':{'id':_0x55d140['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x488cea,null))[_0x35fc('0x18')](function(_0xa46452){if(_0xa46452){_0x3afdf3=_0xa46452;_0x4c40e5[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['CmList'][_0x35fc('0x41')]);_0x4c40e5[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x55d140['query']);_0x4c40e5[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],_0x4c40e5['query']);_0x1a5f12[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x42')]));_0x1a5f12[_0x35fc('0x37')]=_0x1a5f12[_0x35fc('0x37')][_0x35fc('0x38')]?_0x1a5f12[_0x35fc('0x37')]:_0x4c40e5[_0x35fc('0x33')];_0x1a5f12[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x1a5f12[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x55d140[_0x35fc('0x35')],_0x4c40e5[_0x35fc('0x4c')]));if(_0x55d140['query'][_0x35fc('0x1e')]){_0x1a5f12[_0x35fc('0x2c')]=_['merge'](_0x1a5f12[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x1a5f12[_0x35fc('0x37')],function(_0x55c126){var _0x9e7561={};_0x9e7561[_0x55c126]={'$like':'%'+_0x55d140[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x9e7561;})});}_0x1a5f12=_[_0x35fc('0x3a')]({},_0x1a5f12,_0x55d140[_0x35fc('0x3b')]);return _0x3afdf3[_0x35fc('0xad')](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x5545e9){if(_0x5545e9){_0x3b64de=_0x5545e9[_0x35fc('0x38')];if(!_0x55d140[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x1a5f12[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x11')]);_0x1a5f12['offset']=qs['offset'](_0x55d140[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3afdf3['getBlackLists'](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x2c1181){if(_0x2c1181){return _0x2c1181?{'count':_0x3b64de,'rows':_0x2c1181}:null;}})[_0x35fc('0x18')](respondWithResult(_0x488cea,null))[_0x35fc('0x30')](handleError(_0x488cea,null));};exports[_0x35fc('0xae')]=function(_0x3f7fd7,_0x5e16f1){var _0xa46ffd;return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x3f7fd7[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5e16f1,null))[_0x35fc('0x18')](function(_0x4abeb5){if(_0x4abeb5){return _0x4abeb5[_0x35fc('0xae')](_0x3f7fd7[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x3f7fd7[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x4007f9){var _0x58d0b1;_0xa46ffd=_0x4007f9||[];var _0x4bf83e=[];if(_0x4007f9){for(var _0x1afe94=0x0;_0x1afe94<_0x4007f9[_0x35fc('0x38')];_0x1afe94+=0x1){var _0x108366=_0x4007f9[_0x1afe94][_0x35fc('0x19')]({'plain':!![]});_0x58d0b1=squel['insert']()[_0x35fc('0x90')]('cm_hopper_black')['fromQuery']([_0x35fc('0x96'),_0x35fc('0x94'),_0x35fc('0x95'),_0x35fc('0x51'),_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()['field'](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('id',_0x35fc('0x94'))['field'](_0x108366[_0x35fc('0x97')][_0x35fc('0x78')](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0x3f7fd7[_0x35fc('0x32')]['id']['toString'](),_0x35fc('0x51'))[_0x35fc('0x6d')](_0x35fc('0xaf'),_0x35fc('0x44'))[_0x35fc('0x6d')]('NOW()','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x108366[_0x35fc('0x97')]['toString']())[_0x35fc('0x2c')](_0x35fc('0x9b')))['toString']();_0x4bf83e[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x58d0b1));}return BPromise[_0x35fc('0x7e')](_0x4bf83e);}})[_0x35fc('0x18')](function(){return _0xa46ffd;})[_0x35fc('0x18')](respondWithResult(_0x5e16f1,null))[_0x35fc('0x30')](handleError(_0x5e16f1,null));};exports[_0x35fc('0xb0')]=function(_0x4fd3d4,_0x2dff64){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x4fd3d4['params']['id']}})['then'](handleEntityNotFound(_0x2dff64,null))[_0x35fc('0x18')](function(_0x409a32){if(_0x409a32){return _0x409a32['removeBlackLists'](_0x4fd3d4[_0x35fc('0x35')][_0x35fc('0x6c')]);}})[_0x35fc('0x18')](function(_0x2c0bf5){if(_0x2c0bf5){return db['CmHopperBlack'][_0x35fc('0x25')]({'where':{'ListId':_0x4fd3d4['query']['ids'],'VoiceQueueId':_0x4fd3d4[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x2c0bf5;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x2dff64,null))[_0x35fc('0x30')](handleError(_0x2dff64,null));}; \ No newline at end of file +var _0x9957=['includes','find','type','name','UserProfileResource','destroy','stack','send','fieldName','key','getOptions','include','query','findAll','catch','show','params','model','rawAttributes','filters','attributes','intersection','fields','includeAll','merge','VoiceQueue','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','error','clone','length','options','omit','updatedAt','user','role','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','keys','order','sort','where','pick','CmHopper','rows','getHopperHistories','CmHopperHistory','hasOwnProperty','VoiceQueueId','getHopperFinals','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','Agents','voicePause','interface','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','all','union','compact','removeTeams','isEmpty','userVoiceQueue:remove','addAgents','online','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','createdAt','select','ContactId','CmListId','ListId','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','VoiceQueues','QueueCampaigns','filter','ignore','map','value'];(function(_0x3a5066,_0x4ec243){var _0x36a6ba=function(_0x432862){while(--_0x432862){_0x3a5066['push'](_0x3a5066['shift']());}};_0x36a6ba(++_0x4ec243);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var moment=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var _=require(_0x7995('0x3'));var squel=require('squel');var Redis=require(_0x7995('0x4'));var qs=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var db=require(_0x7995('0x8'))['db'];config[_0x7995('0x9')]=_[_0x7995('0xa')](config[_0x7995('0x9')],{'host':_0x7995('0xb'),'port':0x18eb});var socket=require(_0x7995('0xc'))(new Redis(config['redis']));require(_0x7995('0xd'))[_0x7995('0xe')](socket);function respondWithStatusCode(_0x4a64f7,_0xa2e5f0){_0xa2e5f0=_0xa2e5f0||0xcc;return function(_0x3116fb){if(_0x3116fb){return _0x4a64f7[_0x7995('0xf')](_0xa2e5f0);}return _0x4a64f7[_0x7995('0x10')](_0xa2e5f0)[_0x7995('0x11')]();};}function respondWithResult(_0x1e400a,_0x341672){_0x341672=_0x341672||0xc8;return function(_0x524f7b){if(_0x524f7b){return _0x1e400a[_0x7995('0x10')](_0x341672)[_0x7995('0x12')](_0x524f7b);}};}function respondWithFilteredResult(_0x581f22,_0xb0c872){return function(_0x2cb37a){if(_0x2cb37a){var _0x19a27e=typeof _0xb0c872[_0x7995('0x13')]===_0x7995('0x14')&&typeof _0xb0c872[_0x7995('0x15')]===_0x7995('0x14');var _0x4cc004=_0x2cb37a['count'];var _0x2b4e94=_0x19a27e?0x0:_0xb0c872[_0x7995('0x13')];var _0x24b5bb=_0x19a27e?_0x2cb37a[_0x7995('0x16')]:_0xb0c872[_0x7995('0x13')]+_0xb0c872[_0x7995('0x15')];var _0x2202ce;if(_0x24b5bb>=_0x4cc004){_0x24b5bb=_0x4cc004;_0x2202ce=0xc8;}else{_0x2202ce=0xce;}_0x581f22[_0x7995('0x10')](_0x2202ce);return _0x581f22['set'](_0x7995('0x17'),_0x2b4e94+'-'+_0x24b5bb+'/'+_0x4cc004)['json'](_0x2cb37a);}return null;};}function saveUpdates(_0x2f832e){return function(_0x37f297){if(_0x37f297){return _0x37f297[_0x7995('0x18')](_0x2f832e)[_0x7995('0x19')](function(_0x1e1415){return _0x1e1415;});}return null;};}function removeEntity(_0x37a7d4){return function(_0x4faa60){if(_0x4faa60){return _0x4faa60['destroy']()[_0x7995('0x19')](function(){var _0x5e6f90=_0x4faa60['get']({'plain':!![]});var _0x3ec178=[{'name':_0x7995('0x1a'),'value':'inbound','ignore':![]},{'name':_0x7995('0x1b'),'value':'outbound','ignore':![]}];var _0x4b1a8e=_(_0x3ec178)[_0x7995('0x1c')](_0x7995('0x1d'))[_0x7995('0x1e')](_0x7995('0x1f'))[_0x7995('0x1f')]();if(_[_0x7995('0x20')](_0x4b1a8e,_0x5e6f90['type'])){return;}var _0x32a09a=_[_0x7995('0x21')](_0x3ec178,[_0x7995('0x1f'),_0x5e6f90[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x24')][_0x7995('0x25')]({'where':{'type':_0x32a09a,'resourceId':_0x5e6f90['id']}})[_0x7995('0x19')](function(){return _0x4faa60;});})['then'](function(){_0x37a7d4[_0x7995('0x10')](0xcc)[_0x7995('0x11')]();});}};}function handleEntityNotFound(_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x401dc3[_0x7995('0xf')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x26')]);if(_0x47625f[_0x7995('0x23')]){delete _0x47625f[_0x7995('0x23')];}_0x2a307e[_0x7995('0x10')](_0x56691a)[_0x7995('0x27')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={};var _0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['VoiceQueue']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x28')],'type':_0x3573be[_0x7995('0x22')][_0x7995('0x29')]};});_0x456a28=qs[_0x7995('0x2a')](_0x4253e5,_0x9b2a15);var _0x1ca460={'where':_0x456a28['where']};return db['VoiceQueue'][_0x7995('0x16')](_0x1ca460)['then'](function(_0x553671){_0x3250e0[_0x7995('0x16')]=_0x553671;_0x456a28[_0x7995('0x2b')]=qs[_0x7995('0x2b')](_0x9b2a15[_0x7995('0x2c')]);return db['VoiceQueue'][_0x7995('0x2d')](_0x456a28);})[_0x7995('0x19')](function(_0x5dd802){_0x3250e0['rows']=_0x5dd802;return _0x3250e0;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x2e')](handleError(_0x514445,null));};exports[_0x7995('0x2f')]=function(_0x4a176f,_0x3e7020){var _0x51b95d={'raw':![],'where':{'id':_0x4a176f[_0x7995('0x30')]['id']}},_0x37917b={};_0x37917b[_0x7995('0x31')]=_['keys'](db['VoiceQueue'][_0x7995('0x32')]);_0x37917b['query']=_['keys'](_0x4a176f[_0x7995('0x2c')]);_0x37917b[_0x7995('0x33')]=_['intersection'](_0x37917b[_0x7995('0x31')],_0x37917b[_0x7995('0x2c')]);_0x51b95d[_0x7995('0x34')]=_[_0x7995('0x35')](_0x37917b[_0x7995('0x31')],qs['fields'](_0x4a176f[_0x7995('0x2c')][_0x7995('0x36')]));_0x51b95d[_0x7995('0x34')]=_0x51b95d[_0x7995('0x34')]['length']?_0x51b95d[_0x7995('0x34')]:_0x37917b[_0x7995('0x31')];if(_0x4a176f[_0x7995('0x2c')][_0x7995('0x37')]){_0x51b95d[_0x7995('0x2b')]=[{'all':!![]}];}_0x51b95d=_[_0x7995('0x38')]({},_0x51b95d,_0x4a176f['options']);return db[_0x7995('0x39')][_0x7995('0x21')](_0x51b95d)[_0x7995('0x19')](handleEntityNotFound(_0x3e7020,null))[_0x7995('0x19')](respondWithResult(_0x3e7020,null))[_0x7995('0x2e')](handleError(_0x3e7020,null));};exports[_0x7995('0x3a')]=function(_0x14d638,_0x270c0e){return db[_0x7995('0x39')][_0x7995('0x3a')](_0x14d638[_0x7995('0x3b')],{})[_0x7995('0x19')](function(_0x7b4e67){var _0x53cda2=_0x14d638['user'][_0x7995('0x3c')]({'plain':!![]});if(!_0x53cda2)throw new Error(_0x7995('0x3d'));if(_0x53cda2['role']==='user'){var _0x3f8522=_0x7b4e67['get']({'plain':!![]});var _0x504a33=[{'name':_0x7995('0x1a'),'value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':'outbound'}];var _0x46ac4f=_['find'](_0x504a33,[_0x7995('0x1f'),_0x3f8522['type']])['name'];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x46ac4f,'userProfileId':_0x53cda2[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x599ecb){if(_0x599ecb&&_0x599ecb[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x3f8522[_0x7995('0x23')],'resourceId':_0x3f8522['id'],'type':_0x599ecb['name'],'sectionId':_0x599ecb['id']},{})['then'](function(){return _0x7b4e67;});}else{return _0x7b4e67;}})[_0x7995('0x2e')](function(_0x55791b){logger[_0x7995('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55791b);throw _0x55791b;});}return _0x7b4e67;})[_0x7995('0x19')](respondWithResult(_0x270c0e,0xc9))['catch'](handleError(_0x270c0e,null));};exports[_0x7995('0x43')]=function(_0x1b0373,_0x4d9245){var _0x3e9e62={'where':{'id':_0x1b0373[_0x7995('0x30')]['id']}},_0x336ff2={};_0x336ff2[_0x7995('0x31')]=_['keys'](db[_0x7995('0x39')][_0x7995('0x32')]);_0x3e9e62[_0x7995('0x34')]=_['intersection'](_0x336ff2[_0x7995('0x31')],qs[_0x7995('0x36')](_0x1b0373[_0x7995('0x2c')][_0x7995('0x36')]));_0x3e9e62[_0x7995('0x34')]=_0x3e9e62['attributes'][_0x7995('0x44')]?_0x3e9e62[_0x7995('0x34')]:_0x336ff2['model'];if(_0x1b0373[_0x7995('0x2c')]['includeAll']){_0x3e9e62[_0x7995('0x2b')]=[{'all':!![]}];}_0x3e9e62=_[_0x7995('0x38')]({},_0x3e9e62,_0x1b0373[_0x7995('0x45')]);return db[_0x7995('0x39')][_0x7995('0x21')](_0x3e9e62)[_0x7995('0x19')](handleEntityNotFound(_0x4d9245,null))[_0x7995('0x19')](function(_0x4d46bc){if(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x3c')]({'plain':!![]});_0x427dcf=qs[_0x7995('0x46')](_0x427dcf,['id','createdAt',_0x7995('0x47')]);_0x1b0373[_0x7995('0x3b')]=_[_0x7995('0x46')](_0x1b0373['body'],['id','createdAt','updatedAt']);return db[_0x7995('0x39')][_0x7995('0x3a')](_['merge'](_0x427dcf,_0x1b0373[_0x7995('0x3b')]),{'include':_0x1b0373[_0x7995('0x2c')][_0x7995('0x37')]?[{'all':!![]}]:undefined})[_0x7995('0x19')](function(_0xc04004){var _0x528c8e=_0x1b0373[_0x7995('0x48')]['get']({'plain':!![]});if(!_0x528c8e)throw new Error(_0x7995('0x3d'));if(_0x528c8e[_0x7995('0x49')]===_0x7995('0x48')){var _0x50c7b5=_0xc04004['get']({'plain':!![]});var _0x54e2b1=[{'name':'VoiceQueues','value':_0x7995('0x3e')},{'name':_0x7995('0x1b'),'value':_0x7995('0x4a')}];var _0x150261=_[_0x7995('0x21')](_0x54e2b1,[_0x7995('0x1f'),_0x50c7b5[_0x7995('0x22')]])[_0x7995('0x23')];return db[_0x7995('0x3f')][_0x7995('0x21')]({'where':{'name':_0x150261,'userProfileId':_0x528c8e[_0x7995('0x40')]},'raw':!![]})[_0x7995('0x19')](function(_0x3da72b){if(_0x3da72b&&_0x3da72b[_0x7995('0x41')]===0x0){return db[_0x7995('0x24')][_0x7995('0x3a')]({'name':_0x50c7b5[_0x7995('0x23')],'resourceId':_0x50c7b5['id'],'type':_0x3da72b[_0x7995('0x23')],'sectionId':_0x3da72b['id']},{})[_0x7995('0x19')](function(){return _0xc04004;});}else{return _0xc04004;}})['catch'](function(_0x56a374){logger[_0x7995('0x42')](_0x7995('0x4b'),_0x56a374);throw _0x56a374;});}return _0xc04004;});}})[_0x7995('0x19')](respondWithResult(_0x4d9245,0xc9))['catch'](handleError(_0x4d9245,null));};exports['update']=function(_0x402fa0,_0x197b52){if(_0x402fa0[_0x7995('0x3b')]['id']){delete _0x402fa0[_0x7995('0x3b')]['id'];}return db['VoiceQueue'][_0x7995('0x21')]({'where':{'id':_0x402fa0[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x197b52,null))[_0x7995('0x19')](saveUpdates(_0x402fa0['body'],null))['then'](respondWithResult(_0x197b52,null))[_0x7995('0x2e')](handleError(_0x197b52,null));};exports[_0x7995('0x25')]=function(_0x6c0221,_0x1d69ce){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x6c0221[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1d69ce,null))[_0x7995('0x19')](removeEntity(_0x1d69ce,null))['catch'](handleError(_0x1d69ce,null));};exports[_0x7995('0x4c')]=function(_0x3ec5a8,_0xdf9e38){var _0x1ecfdb={'raw':![],'where':{}};var _0x59c5aa={};var _0x51bf6a={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3ec5a8['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0xdf9e38,null))[_0x7995('0x19')](function(_0x2e3421){if(_0x2e3421){_0x59c5aa[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopper'][_0x7995('0x32')]);_0x59c5aa['query']=_[_0x7995('0x4e')](_0x3ec5a8[_0x7995('0x2c')]);_0x59c5aa[_0x7995('0x33')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],_0x59c5aa[_0x7995('0x2c')]);_0x1ecfdb[_0x7995('0x34')]=_[_0x7995('0x35')](_0x59c5aa[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x36')]));_0x1ecfdb['attributes']=_0x1ecfdb[_0x7995('0x34')][_0x7995('0x44')]?_0x1ecfdb[_0x7995('0x34')]:_0x59c5aa[_0x7995('0x31')];if(!_0x3ec5a8[_0x7995('0x2c')]['hasOwnProperty']('nolimit')){_0x1ecfdb[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x15')]);_0x1ecfdb['offset']=qs[_0x7995('0x13')](_0x3ec5a8['query']['offset']);}_0x1ecfdb[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x50')]);_0x1ecfdb[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x3ec5a8[_0x7995('0x2c')],_0x59c5aa[_0x7995('0x33')]));_0x1ecfdb[_0x7995('0x51')]['VoiceQueueId']=_0x2e3421['id'];if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]){_0x1ecfdb[_0x7995('0x51')]=_['merge'](_0x1ecfdb[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x1ecfdb[_0x7995('0x34')],function(_0x3a7d9d){var _0x3b0d30={};_0x3b0d30[_0x3a7d9d]={'$like':'%'+_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x3b0d30;})});}_0x1ecfdb=_[_0x7995('0x38')]({},_0x1ecfdb,_0x3ec5a8[_0x7995('0x45')]);return db[_0x7995('0x53')][_0x7995('0x16')]({'where':_0x1ecfdb['where']})['then'](function(_0xd07c1c){_0x51bf6a[_0x7995('0x16')]=_0xd07c1c;if(_0x3ec5a8[_0x7995('0x2c')][_0x7995('0x37')]){_0x1ecfdb['include']=[{'all':!![]}];}return db[_0x7995('0x53')][_0x7995('0x2d')](_0x1ecfdb);})['then'](function(_0x480fdb){_0x51bf6a[_0x7995('0x54')]=_0x480fdb;return _0x51bf6a;});}})[_0x7995('0x19')](respondWithFilteredResult(_0xdf9e38,_0x1ecfdb))['catch'](handleError(_0xdf9e38,null));};exports[_0x7995('0x55')]=function(_0x5b1cba,_0x3758f9){var _0xea9aba={'raw':!![],'where':{}};var _0x4ff9ff={};var _0x5d9d33={'count':0x0,'rows':[]};return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x5b1cba[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3758f9,null))[_0x7995('0x19')](function(_0x45bd8a){if(_0x45bd8a){_0x4ff9ff[_0x7995('0x31')]=_[_0x7995('0x4e')](db[_0x7995('0x56')][_0x7995('0x32')]);_0x4ff9ff[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x5b1cba[_0x7995('0x2c')]);_0x4ff9ff[_0x7995('0x33')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],_0x4ff9ff[_0x7995('0x2c')]);_0xea9aba[_0x7995('0x34')]=_[_0x7995('0x35')](_0x4ff9ff[_0x7995('0x31')],qs[_0x7995('0x36')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x36')]));_0xea9aba[_0x7995('0x34')]=_0xea9aba[_0x7995('0x34')][_0x7995('0x44')]?_0xea9aba[_0x7995('0x34')]:_0x4ff9ff[_0x7995('0x31')];if(!_0x5b1cba[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0xea9aba[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x5b1cba['query']['limit']);_0xea9aba[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5b1cba[_0x7995('0x2c')][_0x7995('0x13')]);}_0xea9aba[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x5b1cba['query'][_0x7995('0x50')]);_0xea9aba[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5b1cba[_0x7995('0x2c')],_0x4ff9ff[_0x7995('0x33')]));_0xea9aba[_0x7995('0x51')][_0x7995('0x58')]=_0x45bd8a['id'];if(_0x5b1cba['query'][_0x7995('0x1c')]){_0xea9aba[_0x7995('0x51')]=_['merge'](_0xea9aba['where'],{'$or':_[_0x7995('0x1e')](_0xea9aba[_0x7995('0x34')],function(_0x18e1a2){var _0x3db7a9={};_0x3db7a9[_0x18e1a2]={'$like':'%'+_0x5b1cba[_0x7995('0x2c')]['filter']+'%'};return _0x3db7a9;})});}_0xea9aba=_[_0x7995('0x38')]({},_0xea9aba,_0x5b1cba[_0x7995('0x45')]);return db['CmHopperHistory'][_0x7995('0x16')]({'where':_0xea9aba[_0x7995('0x51')]})['then'](function(_0x1535a3){_0x5d9d33['count']=_0x1535a3;if(_0x5b1cba[_0x7995('0x2c')][_0x7995('0x37')]){_0xea9aba[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x56')][_0x7995('0x2d')](_0xea9aba);})['then'](function(_0x1f0506){_0x5d9d33[_0x7995('0x54')]=_0x1f0506;return _0x5d9d33;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x3758f9,_0xea9aba))['catch'](handleError(_0x3758f9,null));};exports[_0x7995('0x59')]=function(_0x3f3434,_0x350ed3){var _0x308a26={'raw':!![],'where':{}};var _0x5d7018={};var _0x3356fd={'count':0x0,'rows':[]};return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x3f3434['params']['id']}})['then'](handleEntityNotFound(_0x350ed3,null))[_0x7995('0x19')](function(_0x333379){if(_0x333379){_0x5d7018['model']=_['keys'](db[_0x7995('0x5a')][_0x7995('0x32')]);_0x5d7018[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x3f3434[_0x7995('0x2c')]);_0x5d7018['filters']=_['intersection'](_0x5d7018[_0x7995('0x31')],_0x5d7018['query']);_0x308a26['attributes']=_[_0x7995('0x35')](_0x5d7018[_0x7995('0x31')],qs[_0x7995('0x36')](_0x3f3434['query'][_0x7995('0x36')]));_0x308a26[_0x7995('0x34')]=_0x308a26[_0x7995('0x34')][_0x7995('0x44')]?_0x308a26[_0x7995('0x34')]:_0x5d7018['model'];if(!_0x3f3434[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x308a26[_0x7995('0x15')]=qs['limit'](_0x3f3434[_0x7995('0x2c')][_0x7995('0x15')]);_0x308a26['offset']=qs[_0x7995('0x13')](_0x3f3434[_0x7995('0x2c')]['offset']);}_0x308a26[_0x7995('0x4f')]=qs['sort'](_0x3f3434[_0x7995('0x2c')]['sort']);_0x308a26[_0x7995('0x51')]=qs['filters'](_[_0x7995('0x52')](_0x3f3434[_0x7995('0x2c')],_0x5d7018['filters']));_0x308a26[_0x7995('0x51')]['VoiceQueueId']=_0x333379['id'];if(_0x3f3434['query'][_0x7995('0x1c')]){_0x308a26[_0x7995('0x51')]=_[_0x7995('0x38')](_0x308a26[_0x7995('0x51')],{'$or':_['map'](_0x308a26[_0x7995('0x34')],function(_0x35044a){var _0x4bd29f={};_0x4bd29f[_0x35044a]={'$like':'%'+_0x3f3434['query'][_0x7995('0x1c')]+'%'};return _0x4bd29f;})});}_0x308a26=_['merge']({},_0x308a26,_0x3f3434[_0x7995('0x45')]);return db[_0x7995('0x5a')][_0x7995('0x16')]({'where':_0x308a26['where']})['then'](function(_0x2b7852){_0x3356fd['count']=_0x2b7852;if(_0x3f3434[_0x7995('0x2c')][_0x7995('0x37')]){_0x308a26[_0x7995('0x2b')]=[{'all':!![]}];}return db[_0x7995('0x5a')]['findAll'](_0x308a26);})['then'](function(_0x50f880){_0x3356fd[_0x7995('0x54')]=_0x50f880;return _0x3356fd;});}})[_0x7995('0x19')](respondWithFilteredResult(_0x350ed3,_0x308a26))[_0x7995('0x2e')](handleError(_0x350ed3,null));};exports[_0x7995('0x5c')]=function(_0x265f07,_0x168e7f){var _0x59a793={'raw':!![],'where':{}};var _0x53cbec={};var _0x1a2902={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x265f07[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x168e7f,null))['then'](function(_0x35c3f3){if(_0x35c3f3){_0x53cbec[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmHopperBlack'][_0x7995('0x32')]);_0x53cbec[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x265f07[_0x7995('0x2c')]);_0x53cbec[_0x7995('0x33')]=_[_0x7995('0x35')](_0x53cbec[_0x7995('0x31')],_0x53cbec[_0x7995('0x2c')]);_0x59a793[_0x7995('0x34')]=_['intersection'](_0x53cbec[_0x7995('0x31')],qs[_0x7995('0x36')](_0x265f07[_0x7995('0x2c')][_0x7995('0x36')]));_0x59a793[_0x7995('0x34')]=_0x59a793['attributes'][_0x7995('0x44')]?_0x59a793[_0x7995('0x34')]:_0x53cbec[_0x7995('0x31')];if(!_0x265f07['query']['hasOwnProperty']('nolimit')){_0x59a793[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x265f07[_0x7995('0x2c')][_0x7995('0x15')]);_0x59a793[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x265f07['query'][_0x7995('0x13')]);}_0x59a793['order']=qs[_0x7995('0x50')](_0x265f07[_0x7995('0x2c')][_0x7995('0x50')]);_0x59a793[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x265f07[_0x7995('0x2c')],_0x53cbec[_0x7995('0x33')]));_0x59a793[_0x7995('0x51')][_0x7995('0x58')]=_0x35c3f3['id'];if(_0x265f07[_0x7995('0x2c')]['filter']){_0x59a793[_0x7995('0x51')]=_['merge'](_0x59a793[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x59a793['attributes'],function(_0x493e74){var _0x2a25eb={};_0x2a25eb[_0x493e74]={'$like':'%'+_0x265f07[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x2a25eb;})});}_0x59a793=_[_0x7995('0x38')]({},_0x59a793,_0x265f07[_0x7995('0x45')]);return db[_0x7995('0x5d')][_0x7995('0x16')]({'where':_0x59a793[_0x7995('0x51')]})[_0x7995('0x19')](function(_0x3c9b3c){_0x1a2902[_0x7995('0x16')]=_0x3c9b3c;if(_0x265f07[_0x7995('0x2c')]['includeAll']){_0x59a793['include']=[{'all':!![]}];}return db[_0x7995('0x5d')][_0x7995('0x2d')](_0x59a793);})[_0x7995('0x19')](function(_0x1531a9){_0x1a2902[_0x7995('0x54')]=_0x1531a9;return _0x1a2902;});}})['then'](respondWithFilteredResult(_0x168e7f,_0x59a793))[_0x7995('0x2e')](handleError(_0x168e7f,null));};exports[_0x7995('0x5e')]=function(_0x5ebf5e,_0x46fc1c){var _0x53d693={};var _0x37416c={};var _0x30cda5;var _0x234a40;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x5ebf5e[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x46fc1c,null))[_0x7995('0x19')](function(_0x11f9fb){if(_0x11f9fb){_0x30cda5=_0x11f9fb;_0x37416c[_0x7995('0x31')]=_[_0x7995('0x4e')](db['Team']['rawAttributes']);_0x37416c['query']=_[_0x7995('0x4e')](_0x5ebf5e[_0x7995('0x2c')]);_0x37416c['filters']=_['intersection'](_0x37416c[_0x7995('0x31')],_0x37416c[_0x7995('0x2c')]);_0x53d693['attributes']=_['intersection'](_0x37416c['model'],qs['fields'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x36')]));_0x53d693[_0x7995('0x34')]=_0x53d693[_0x7995('0x34')]['length']?_0x53d693[_0x7995('0x34')]:_0x37416c[_0x7995('0x31')];_0x53d693['order']=qs[_0x7995('0x50')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x50')]);_0x53d693['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x5ebf5e['query'],_0x37416c[_0x7995('0x33')]));if(_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]){_0x53d693[_0x7995('0x51')]=_[_0x7995('0x38')](_0x53d693[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x53d693[_0x7995('0x34')],function(_0x4254de){var _0x278004={};_0x278004[_0x4254de]={'$like':'%'+_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x278004;})});}_0x53d693=_[_0x7995('0x38')]({},_0x53d693,_0x5ebf5e['options']);return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})[_0x7995('0x19')](function(_0x3603e8){if(_0x3603e8){_0x234a40=_0x3603e8[_0x7995('0x44')];if(!_0x5ebf5e['query'][_0x7995('0x57')](_0x7995('0x5b'))){_0x53d693[_0x7995('0x15')]=qs['limit'](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x15')]);_0x53d693[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x5ebf5e[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x30cda5[_0x7995('0x5e')](_0x53d693);}})['then'](function(_0x35dbd7){if(_0x35dbd7){return _0x35dbd7?{'count':_0x234a40,'rows':_0x35dbd7}:null;}})['then'](respondWithResult(_0x46fc1c,null))[_0x7995('0x2e')](handleError(_0x46fc1c,null));};exports[_0x7995('0x5f')]=function(_0x2190d1,_0x4cae1c){var _0xd012b9=_0x2190d1['body']['teams'];var _0x4ee5ee=_['map'](_0xd012b9,'id');return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x4ee5ee},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7995('0x61'),'attributes':['id',_0x7995('0x23'),'online',_0x7995('0x62'),_0x7995('0x63')],'raw':!![]}]})[_0x7995('0x19')](function(_0x45a479){if(_0x45a479){var _0x443863=_['flatMap'](_0x45a479,function(_0x38ea3e){var _0x1df81d=_0x38ea3e[_0x7995('0x3c')]({'plain':!![]});_0x1df81d[_0x7995('0x61')]['forEach'](function(_0x428d5a){_0x428d5a[_0x7995('0x64')]=_[_0x7995('0x21')](_0xd012b9,{'id':_0x1df81d['id']})[_0x7995('0x64')];});return _0x1df81d[_0x7995('0x61')];});return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2190d1[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x1fda95){return db['sequelize'][_0x7995('0x65')](function(_0x521712){return _0x1fda95[_0x7995('0x5f')](_0x4ee5ee,{'transaction':_0x521712})[_0x7995('0x19')](function(){return BPromise[_0x7995('0x66')](_0xd012b9,function(_0x50eb5e){return db['TeamVoiceQueue'][_0x7995('0x67')]({'TeamId':_0x50eb5e['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id'],'penalty':_0x50eb5e['penalty']},{'transaction':_0x521712});});})[_0x7995('0x19')](function(){return BPromise['each'](_0x443863,function(_0x43de18){return db[_0x7995('0x68')][_0x7995('0x69')]({'where':{'UserId':_0x43de18['id'],'VoiceQueueId':_0x2190d1[_0x7995('0x30')]['id']},'defaults':{'penalty':_0x43de18['penalty']},'transaction':_0x521712});});})['then'](function(){return BPromise[_0x7995('0x66')](_[_0x7995('0x1c')](_0x443863,{'online':!![]}),function(_0x365318){return db[_0x7995('0x6a')]['upsert']({'membername':_0x365318[_0x7995('0x23')],'UserId':_0x365318['id'],'queue_name':_0x1fda95[_0x7995('0x23')],'VoiceQueueId':_0x1fda95['id'],'interface':_[_0x7995('0x6b')](_0x365318[_0x7995('0x63')])?util[_0x7995('0x6c')]('SIP/%s',_0x365318['name']):_0x365318['interface'],'paused':_0x365318[_0x7995('0x62')]||![],'penalty':_0x365318[_0x7995('0x64')]},{'transaction':_0x521712});});})['then'](function(){_0x443863[_0x7995('0x6d')](function(_0x5635d6){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':_0x5635d6['id'],'VoiceQueueId':_0x1fda95['id']});});});});});}})[_0x7995('0x19')](respondWithStatusCode(_0x4cae1c,null))[_0x7995('0x2e')](handleError(_0x4cae1c,null));};exports['removeTeams']=function(_0x3fbafb,_0x2caacd){return db[_0x7995('0x60')][_0x7995('0x2d')]({'where':{'id':_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7995('0x71')],'as':_0x7995('0x61'),'attributes':['id'],'raw':!![]}]})[_0x7995('0x19')](handleEntityNotFound(_0x2caacd,null))[_0x7995('0x19')](function(_0x30893a){var _0x2b8d90=_[_0x7995('0x1e')](_0x30893a,'id');var _0x2122af=[];var _0x4ff0b6=[];var _0x764245=squel['select']();_0x764245[_0x7995('0x72')](_0x7995('0x73'))['from'](_0x7995('0x74'),'tq')['join'](_0x7995('0x75'),'ut',_0x7995('0x76'))['where']('VoiceQueueId\x20=\x20?',_0x3fbafb['params']['id']);for(var _0x8f5ecd=0x0;_0x8f5ecd<_0x30893a[_0x7995('0x44')];_0x8f5ecd+=0x1){let _0x139f76=_0x30893a[_0x8f5ecd];for(var _0x2b7bc2=0x0;_0x2b7bc2<_0x139f76['Agents'][_0x7995('0x44')];_0x2b7bc2+=0x1){let _0x2b2814=_0x139f76[_0x7995('0x61')][_0x2b7bc2];var _0x2de960=_0x764245[_0x7995('0x43')]();_0x2de960[_0x7995('0x51')](_0x7995('0x77'),_0x2b2814['id']);_0x4ff0b6[_0x7995('0x78')](db['sequelize'][_0x7995('0x2c')](_0x2de960[_0x7995('0x79')](),{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT']})[_0x7995('0x19')](function(_0x3a2958){if(_0x3a2958[_0x7995('0x44')]===0x1){return _0x2b2814['id'];}else{var _0x339e6b=_[_0x7995('0x7c')](_[_0x7995('0x1e')](_0x3a2958,'TeamId'),function(_0x1bc617){return _[_0x7995('0x20')](_0x2b8d90,_0x1bc617);});if(_0x339e6b){return _0x2b2814['id'];}}}));}}return BPromise[_0x7995('0x7d')](_0x4ff0b6)[_0x7995('0x19')](function(_0x3fcc49){_0x2122af=_(_0x2122af)[_0x7995('0x7e')](_0x3fcc49)[_0x7995('0x7f')]()[_0x7995('0x1f')]();return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3fbafb[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(_0x64a62d){return db[_0x7995('0x7a')][_0x7995('0x65')](function(_0x370984){return _0x64a62d[_0x7995('0x80')](_0x3fbafb[_0x7995('0x2c')][_0x7995('0x70')],{'transaction':_0x370984})[_0x7995('0x19')](function(){if(!_[_0x7995('0x81')](_0x2122af)){return _0x64a62d['removeAgents'](_0x2122af,{'transaction':_0x370984})['then'](function(){return db[_0x7995('0x6a')][_0x7995('0x25')]({'where':{'VoiceQueueId':_0x3fbafb['params']['id'],'UserId':_0x2122af},'transaction':_0x370984});});}})[_0x7995('0x19')](function(){_0x2122af['forEach'](function(_0x2ce103){socket['emit'](_0x7995('0x82'),{'UserId':_0x2ce103,'VoiceQueueId':_0x64a62d['id']});});});});});});})[_0x7995('0x19')](respondWithStatusCode(_0x2caacd,null))[_0x7995('0x2e')](handleError(_0x2caacd,null));};exports[_0x7995('0x83')]=function(_0x3aa676,_0x1df2a2){var _0xd82313,_0x1fa59d;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3aa676['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1df2a2,null))[_0x7995('0x19')](function(_0x1d0481){if(_0x1d0481){_0x1fa59d=_0x1d0481;return _0x1d0481[_0x7995('0x83')](_0x3aa676['body'][_0x7995('0x70')],_[_0x7995('0x46')](_0x3aa676[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{})['spread'](function(_0x32c550){for(var _0x37e647=0x0;_0x37e647<_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x7995('0x44')];_0x37e647+=0x1){socket[_0x7995('0x6e')](_0x7995('0x6f'),{'UserId':Number(_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')][_0x37e647]),'VoiceQueueId':Number(_0x3aa676['params']['id'])});}return _0x32c550;});}})[_0x7995('0x19')](function(_0x5f5496){_0xd82313=_0x5f5496||[];if(_0x1fa59d){return db[_0x7995('0x71')][_0x7995('0x2d')]({'where':{'id':_0x3aa676[_0x7995('0x3b')][_0x7995('0x70')]},'attributes':['id','name',_0x7995('0x84'),_0x7995('0x62'),_0x7995('0x63')],'raw':!![]});}})[_0x7995('0x19')](function(_0x2c715){if(!_[_0x7995('0x81')](_0x2c715)){var _0x3661ab=[];for(var _0x408692=0x0;_0x408692<_0x2c715[_0x7995('0x44')];_0x408692++){if(_0x2c715[_0x408692][_0x7995('0x84')]){_0x3661ab[_0x7995('0x78')](db[_0x7995('0x6a')][_0x7995('0x67')]({'membername':_0x2c715[_0x408692][_0x7995('0x23')],'UserId':_0x2c715[_0x408692]['id'],'queue_name':_0x1fa59d['name'],'VoiceQueueId':_0x1fa59d['id'],'interface':_['isNil'](_0x2c715[_0x408692][_0x7995('0x63')])?util[_0x7995('0x6c')](_0x7995('0x85'),_0x2c715[_0x408692]['name']):_0x2c715[_0x408692][_0x7995('0x63')],'paused':_0x2c715[_0x408692][_0x7995('0x62')]||![],'penalty':_0x3aa676[_0x7995('0x3b')]['penalty']||0x0}));}}return BPromise[_0x7995('0x7d')](_0x3661ab);}})[_0x7995('0x19')](function(){return _0xd82313;})[_0x7995('0x19')](respondWithResult(_0x1df2a2,null))[_0x7995('0x2e')](handleError(_0x1df2a2,null));};exports[_0x7995('0x86')]=function(_0x3d42a3,_0x29fb77){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x3d42a3[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x29fb77,null))['then'](function(_0x580571){if(_0x580571){return _0x580571[_0x7995('0x86')](_0x3d42a3['query'][_0x7995('0x70')])[_0x7995('0x19')](function(){if(_[_0x7995('0x87')](_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')])){for(var _0x4eebf4=0x0;_0x4eebf4<_0x3d42a3['query'][_0x7995('0x70')][_0x7995('0x44')];_0x4eebf4+=0x1){socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')][_0x7995('0x70')][_0x4eebf4]),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}}else{socket[_0x7995('0x6e')](_0x7995('0x82'),{'UserId':Number(_0x3d42a3[_0x7995('0x2c')]['ids']),'VoiceQueueId':Number(_0x3d42a3[_0x7995('0x30')]['id'])});}});}})[_0x7995('0x19')](function(_0x38e67a){return db[_0x7995('0x6a')]['destroy']({'where':{'VoiceQueueId':_0x3d42a3['params']['id'],'UserId':_0x3d42a3['query']['ids']}})['then'](function(){return _0x38e67a;});})[_0x7995('0x19')](respondWithStatusCode(_0x29fb77,null))['catch'](handleError(_0x29fb77,null));};exports['getAgents']=function(_0x32f19d,_0x44dbb8){var _0x181ed6={};var _0x48b807={};var _0xba00af;var _0x4f008a;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x32f19d[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x44dbb8,null))[_0x7995('0x19')](function(_0x14be06){if(_0x14be06){_0xba00af=_0x14be06;_0x48b807[_0x7995('0x31')]=_['keys'](db[_0x7995('0x71')][_0x7995('0x32')]);_0x48b807[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x32f19d[_0x7995('0x2c')]);_0x48b807['filters']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],_0x48b807[_0x7995('0x2c')]);_0x181ed6['attributes']=_[_0x7995('0x35')](_0x48b807[_0x7995('0x31')],qs[_0x7995('0x36')](_0x32f19d[_0x7995('0x2c')][_0x7995('0x36')]));_0x181ed6['attributes']=_0x181ed6[_0x7995('0x34')][_0x7995('0x44')]?_0x181ed6[_0x7995('0x34')]:_0x48b807[_0x7995('0x31')];_0x181ed6[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x32f19d[_0x7995('0x2c')]['sort']);_0x181ed6['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x32f19d['query'],_0x48b807['filters']));if(_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]){_0x181ed6[_0x7995('0x51')]=_[_0x7995('0x38')](_0x181ed6[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x181ed6[_0x7995('0x34')],function(_0x4dca11){var _0xf90cd8={};_0xf90cd8[_0x4dca11]={'$like':'%'+_0x32f19d[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0xf90cd8;})});}_0x181ed6=_[_0x7995('0x38')]({},_0x181ed6,_0x32f19d[_0x7995('0x45')]);return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x1d7c33){if(_0x1d7c33){_0x4f008a=_0x1d7c33[_0x7995('0x44')];if(!_0x32f19d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x181ed6[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x32f19d['query'][_0x7995('0x15')]);_0x181ed6[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x32f19d[_0x7995('0x2c')]['offset']);}return _0xba00af[_0x7995('0x88')](_0x181ed6);}})['then'](function(_0x21ba9b){if(_0x21ba9b){return _0x21ba9b?{'count':_0x4f008a,'rows':_0x21ba9b}:null;}})[_0x7995('0x19')](respondWithResult(_0x44dbb8,null))['catch'](handleError(_0x44dbb8,null));};exports['getMembers']=function(_0x478c12,_0x3b22ec){var _0xf503d5={};var _0x7d2ccf={};var _0x18a3dc;var _0x503b32;return db[_0x7995('0x39')][_0x7995('0x4d')]({'where':{'id':_0x478c12[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x3b22ec,null))[_0x7995('0x19')](function(_0x1fa484){if(_0x1fa484){_0x18a3dc=_0x1fa484;_0x7d2ccf[_0x7995('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x7995('0x32')]);_0x7d2ccf['query']=_['keys'](_0x478c12[_0x7995('0x2c')]);_0x7d2ccf[_0x7995('0x33')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],_0x7d2ccf[_0x7995('0x2c')]);_0xf503d5[_0x7995('0x34')]=_[_0x7995('0x35')](_0x7d2ccf[_0x7995('0x31')],qs[_0x7995('0x36')](_0x478c12[_0x7995('0x2c')][_0x7995('0x36')]));_0xf503d5[_0x7995('0x34')]=_0xf503d5['attributes'][_0x7995('0x44')]?_0xf503d5[_0x7995('0x34')]:_0x7d2ccf[_0x7995('0x31')];_0xf503d5[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x478c12[_0x7995('0x2c')][_0x7995('0x50')]);_0xf503d5['where']=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x478c12[_0x7995('0x2c')],_0x7d2ccf[_0x7995('0x33')]));if(_0x478c12[_0x7995('0x2c')]['filter']){_0xf503d5[_0x7995('0x51')]=_['merge'](_0xf503d5[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0xf503d5[_0x7995('0x34')],function(_0x5150aa){var _0x260e84={};_0x260e84[_0x5150aa]={'$like':'%'+_0x478c12[_0x7995('0x2c')][_0x7995('0x1c')]+'%'};return _0x260e84;})});}_0xf503d5=_[_0x7995('0x38')]({},_0xf503d5,_0x478c12[_0x7995('0x45')]);return _0x18a3dc[_0x7995('0x89')](_0xf503d5);}})[_0x7995('0x19')](function(_0x4fb899){if(_0x4fb899){_0x503b32=_0x4fb899['length'];if(!_0x478c12[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0xf503d5[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x478c12[_0x7995('0x2c')]['limit']);_0xf503d5[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x478c12[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x18a3dc['getMembers'](_0xf503d5);}})['then'](function(_0x5b93e6){return _0x5b93e6?{'count':_0x503b32,'rows':_0x5b93e6}:null;})[_0x7995('0x19')](respondWithResult(_0x3b22ec,null))['catch'](handleError(_0x3b22ec,null));};exports[_0x7995('0x8a')]=function(_0x1b6411,_0x54e348){var _0x390bd3={};var _0x3f0a01={};var _0x45d8a2;var _0x26ab59;return db[_0x7995('0x39')]['findOne']({'where':{'id':_0x1b6411['params']['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x54e348,null))[_0x7995('0x19')](function(_0x2cfa1d){if(_0x2cfa1d){_0x45d8a2=_0x2cfa1d;_0x3f0a01[_0x7995('0x31')]=_[_0x7995('0x4e')](db['CmList'][_0x7995('0x32')]);_0x3f0a01[_0x7995('0x2c')]=_[_0x7995('0x4e')](_0x1b6411[_0x7995('0x2c')]);_0x3f0a01[_0x7995('0x33')]=_['intersection'](_0x3f0a01['model'],_0x3f0a01['query']);_0x390bd3['attributes']=_[_0x7995('0x35')](_0x3f0a01[_0x7995('0x31')],qs['fields'](_0x1b6411[_0x7995('0x2c')][_0x7995('0x36')]));_0x390bd3['attributes']=_0x390bd3['attributes'][_0x7995('0x44')]?_0x390bd3[_0x7995('0x34')]:_0x3f0a01[_0x7995('0x31')];_0x390bd3[_0x7995('0x4f')]=qs[_0x7995('0x50')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x50')]);_0x390bd3['where']=qs['filters'](_[_0x7995('0x52')](_0x1b6411[_0x7995('0x2c')],_0x3f0a01[_0x7995('0x33')]));if(_0x1b6411['query'][_0x7995('0x1c')]){_0x390bd3[_0x7995('0x51')]=_[_0x7995('0x38')](_0x390bd3[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x390bd3[_0x7995('0x34')],function(_0x28ac7c){var _0x1b4cab={};_0x1b4cab[_0x28ac7c]={'$like':'%'+_0x1b6411[_0x7995('0x2c')]['filter']+'%'};return _0x1b4cab;})});}_0x390bd3=_['merge']({},_0x390bd3,_0x1b6411[_0x7995('0x45')]);return _0x45d8a2['getLists'](_0x390bd3);}})[_0x7995('0x19')](function(_0x5953d1){if(_0x5953d1){_0x26ab59=_0x5953d1[_0x7995('0x44')];if(!_0x1b6411[_0x7995('0x2c')][_0x7995('0x57')]('nolimit')){_0x390bd3['limit']=qs[_0x7995('0x15')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x15')]);_0x390bd3[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x1b6411[_0x7995('0x2c')][_0x7995('0x13')]);}return _0x45d8a2[_0x7995('0x8a')](_0x390bd3);}})[_0x7995('0x19')](function(_0x35403c){if(_0x35403c){return _0x35403c?{'count':_0x26ab59,'rows':_0x35403c}:null;}})[_0x7995('0x19')](respondWithResult(_0x54e348,null))['catch'](handleError(_0x54e348,null));};exports[_0x7995('0x8b')]=function(_0xe43c99,_0x1b7e44){var _0x442c6d=moment()[_0x7995('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3b5edf,_0x44068f;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xe43c99[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x1b7e44,null))[_0x7995('0x19')](function(_0x2b812f){if(_0x2b812f){_0x44068f=_0x2b812f;return _0x2b812f[_0x7995('0x8b')](_0xe43c99['body']['ids'],_[_0x7995('0x46')](_0xe43c99[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})[_0x7995('0x8c')](function(_0x17fd98){var _0x498d7c;_0x3b5edf=_0x17fd98||[];var _0x341024=[];if(_0x17fd98){for(var _0x2bcbc6=0x0;_0x2bcbc6<_0x17fd98[_0x7995('0x44')];_0x2bcbc6+=0x1){var _0x2dd6c7=_0x17fd98[_0x2bcbc6][_0x7995('0x3c')]({'plain':!![]});_0x44068f[_0x7995('0x8d')]=_0xe43c99[_0x7995('0x3b')][_0x7995('0x8d')]?_0xe43c99[_0x7995('0x3b')]['dialCheckDuplicateType']:_0x44068f['dialCheckDuplicateType'];switch(_0x44068f[_0x7995('0x8d')]){case _0x7995('0x8e'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),_0x7995('0x94'),'ContactId','ListId',_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),'VoiceQueueId')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')]('cm_contacts')[_0x7995('0x51')]('deletedAt\x20IS\x20NULL')[_0x7995('0x51')](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x9e'))['from']('cm_hopper_final')[_0x7995('0x51')](_0x7995('0x9f'),_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]()))['where'](_0x7995('0x9d'),squel[_0x7995('0x96')]()[_0x7995('0x72')]('COALESCE(phone,\x27\x27)')[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))[_0x7995('0x79')]();break;case _0x7995('0xa0'):_0x498d7c=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt',_0x7995('0x97'),_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),'updatedAt'],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id',_0x7995('0x97'))[_0x7995('0x72')](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))['field'](_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x95'))['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))['from'](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where']('ListId\x20=\x20?',_0x2dd6c7['CmListId'][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c'))[_0x7995('0x51')](_0x7995('0x9d'),squel[_0x7995('0x96')]()['field'](_0x7995('0xa3'))[_0x7995('0x9a')](_0x7995('0x91'))[_0x7995('0x51')]('VoiceQueueId\x20=\x20?',_0xe43c99[_0x7995('0x30')]['id'][_0x7995('0x79')]())))['toString']();break;default:_0x498d7c=squel[_0x7995('0x8f')]()['into'](_0x7995('0x91'))[_0x7995('0x92')]([_0x7995('0x93'),'scheduledAt','ContactId',_0x7995('0x99'),_0x7995('0x58'),_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()[_0x7995('0x72')](_0x7995('0x93'),_0x7995('0x93'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x94'))[_0x7995('0x72')]('id','ContactId')['field'](_0x2dd6c7[_0x7995('0x98')][_0x7995('0x79')](),_0x7995('0x99'))[_0x7995('0x72')](_0xe43c99['params']['id']['toString'](),_0x7995('0x58'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')['field']('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))['where'](_0x7995('0x9b'),_0x2dd6c7[_0x7995('0x98')]['toString']())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();}_0x341024['push'](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x498d7c));}return BPromise[_0x7995('0x7d')](_0x341024);}})[_0x7995('0x19')](function(){var _0x113e03=[];var _0x5348b1=squel['insert']()[_0x7995('0x90')]('cm_hopper_additional_phones')[_0x7995('0x92')](['CmHopperId',_0x7995('0x93'),_0x7995('0xa4'),_0x7995('0x95'),'updatedAt'],squel['select']()['field'](_0x7995('0xa5'))[_0x7995('0x72')](_0x7995('0xa6'))['field'](_0x7995('0xa7'))[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27','createdAt')[_0x7995('0x72')]('\x27'+_0x442c6d+'\x27',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa8'),'ci')[_0x7995('0xa9')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x7995('0x51')](_0x7995('0xaa'),_0x442c6d)[_0x7995('0x51')](_0x7995('0xab'),_0x7995('0xac')))[_0x7995('0x79')]();_0x113e03[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x5348b1));return BPromise[_0x7995('0x7d')](_0x113e03);})['then'](function(){return _0x3b5edf;})[_0x7995('0x19')](respondWithResult(_0x1b7e44,null))[_0x7995('0x2e')](handleError(_0x1b7e44,null));};exports[_0x7995('0xad')]=function(_0xff759b,_0x39ee00){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0xff759b['params']['id']}})['then'](handleEntityNotFound(_0x39ee00,null))[_0x7995('0x19')](function(_0x2aec8d){if(_0x2aec8d){return _0x2aec8d[_0x7995('0xad')](_0xff759b[_0x7995('0x2c')]['ids']);}})['then'](function(_0x4b477a){if(_0x4b477a){return db[_0x7995('0x53')][_0x7995('0x25')]({'where':{'ListId':_0xff759b['query'][_0x7995('0x70')],'VoiceQueueId':_0xff759b[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x4b477a;});}})[_0x7995('0x19')](respondWithStatusCode(_0x39ee00,null))[_0x7995('0x2e')](handleError(_0x39ee00,null));};exports[_0x7995('0xae')]=function(_0x35229d,_0x22d392){var _0x57438e={};var _0x463c25={};var _0x13d525;var _0x37b7e7;return db['VoiceQueue'][_0x7995('0x4d')]({'where':{'id':_0x35229d['params']['id']}})['then'](handleEntityNotFound(_0x22d392,null))['then'](function(_0x507bf3){if(_0x507bf3){_0x13d525=_0x507bf3;_0x463c25[_0x7995('0x31')]=_['keys'](db[_0x7995('0xaf')][_0x7995('0x32')]);_0x463c25['query']=_[_0x7995('0x4e')](_0x35229d[_0x7995('0x2c')]);_0x463c25[_0x7995('0x33')]=_[_0x7995('0x35')](_0x463c25['model'],_0x463c25[_0x7995('0x2c')]);_0x57438e['attributes']=_[_0x7995('0x35')](_0x463c25[_0x7995('0x31')],qs[_0x7995('0x36')](_0x35229d[_0x7995('0x2c')][_0x7995('0x36')]));_0x57438e[_0x7995('0x34')]=_0x57438e[_0x7995('0x34')][_0x7995('0x44')]?_0x57438e[_0x7995('0x34')]:_0x463c25[_0x7995('0x31')];_0x57438e['order']=qs[_0x7995('0x50')](_0x35229d[_0x7995('0x2c')]['sort']);_0x57438e[_0x7995('0x51')]=qs[_0x7995('0x33')](_[_0x7995('0x52')](_0x35229d[_0x7995('0x2c')],_0x463c25[_0x7995('0x33')]));if(_0x35229d[_0x7995('0x2c')]['filter']){_0x57438e[_0x7995('0x51')]=_['merge'](_0x57438e[_0x7995('0x51')],{'$or':_[_0x7995('0x1e')](_0x57438e[_0x7995('0x34')],function(_0xb79b0b){var _0x259bf2={};_0x259bf2[_0xb79b0b]={'$like':'%'+_0x35229d[_0x7995('0x2c')]['filter']+'%'};return _0x259bf2;})});}_0x57438e=_[_0x7995('0x38')]({},_0x57438e,_0x35229d[_0x7995('0x45')]);return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x1176cd){if(_0x1176cd){_0x37b7e7=_0x1176cd[_0x7995('0x44')];if(!_0x35229d[_0x7995('0x2c')][_0x7995('0x57')](_0x7995('0x5b'))){_0x57438e[_0x7995('0x15')]=qs[_0x7995('0x15')](_0x35229d[_0x7995('0x2c')][_0x7995('0x15')]);_0x57438e[_0x7995('0x13')]=qs[_0x7995('0x13')](_0x35229d['query'][_0x7995('0x13')]);}return _0x13d525[_0x7995('0xae')](_0x57438e);}})['then'](function(_0x3098ef){if(_0x3098ef){return _0x3098ef?{'count':_0x37b7e7,'rows':_0x3098ef}:null;}})[_0x7995('0x19')](respondWithResult(_0x22d392,null))[_0x7995('0x2e')](handleError(_0x22d392,null));};exports[_0x7995('0xb0')]=function(_0x258f87,_0x5a5cc4){var _0x37af6b;return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x258f87[_0x7995('0x30')]['id']}})[_0x7995('0x19')](handleEntityNotFound(_0x5a5cc4,null))[_0x7995('0x19')](function(_0x120bef){if(_0x120bef){return _0x120bef[_0x7995('0xb0')](_0x258f87[_0x7995('0x3b')][_0x7995('0x70')],_[_0x7995('0x46')](_0x258f87[_0x7995('0x3b')],[_0x7995('0x70'),'id'])||{});}return null;})['spread'](function(_0x247b71){var _0x1ecb6f;_0x37af6b=_0x247b71||[];var _0x225a37=[];if(_0x247b71){for(var _0x1a9f59=0x0;_0x1a9f59<_0x247b71['length'];_0x1a9f59+=0x1){var _0x92a561=_0x247b71[_0x1a9f59][_0x7995('0x3c')]({'plain':!![]});_0x1ecb6f=squel[_0x7995('0x8f')]()[_0x7995('0x90')](_0x7995('0xb1'))[_0x7995('0x92')]([_0x7995('0x93'),'ContactId',_0x7995('0x99'),'VoiceQueueId',_0x7995('0x95'),_0x7995('0x47')],squel[_0x7995('0x96')]()['field']('phone',_0x7995('0x93'))[_0x7995('0x72')]('id',_0x7995('0x97'))['field'](_0x92a561[_0x7995('0x98')]['toString'](),_0x7995('0x99'))[_0x7995('0x72')](_0x258f87[_0x7995('0x30')]['id'][_0x7995('0x79')](),_0x7995('0x58'))[_0x7995('0x72')]('NOW()',_0x7995('0x95'))[_0x7995('0x72')]('NOW()',_0x7995('0x47'))[_0x7995('0x9a')](_0x7995('0xa1'))[_0x7995('0x51')](_0x7995('0xa2'))[_0x7995('0x51')](_0x7995('0x9b'),_0x92a561[_0x7995('0x98')][_0x7995('0x79')]())[_0x7995('0x51')](_0x7995('0x9c')))[_0x7995('0x79')]();_0x225a37[_0x7995('0x78')](db[_0x7995('0x7a')][_0x7995('0x2c')](_0x1ecb6f));}return BPromise[_0x7995('0x7d')](_0x225a37);}})[_0x7995('0x19')](function(){return _0x37af6b;})['then'](respondWithResult(_0x5a5cc4,null))['catch'](handleError(_0x5a5cc4,null));};exports[_0x7995('0xb2')]=function(_0x2f3c17,_0x4fe5eb){return db[_0x7995('0x39')][_0x7995('0x21')]({'where':{'id':_0x2f3c17['params']['id']}})['then'](handleEntityNotFound(_0x4fe5eb,null))[_0x7995('0x19')](function(_0x31a3d6){if(_0x31a3d6){return _0x31a3d6[_0x7995('0xb2')](_0x2f3c17[_0x7995('0x2c')][_0x7995('0x70')]);}})[_0x7995('0x19')](function(_0x1b3920){if(_0x1b3920){return db[_0x7995('0x5d')][_0x7995('0x25')]({'where':{'ListId':_0x2f3c17[_0x7995('0x2c')]['ids'],'VoiceQueueId':_0x2f3c17[_0x7995('0x30')]['id']}})[_0x7995('0x19')](function(){return _0x1b3920;});}})[_0x7995('0x19')](respondWithStatusCode(_0x4fe5eb,null))[_0x7995('0x2e')](handleError(_0x4fe5eb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2b54fef..da32cd5 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 _0xa09e=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3e1c36,_0x19936d){var _0x243168=function(_0x494fb8){while(--_0x494fb8){_0x3e1c36['push'](_0x3e1c36['shift']());}};_0x243168(++_0x19936d);}(_0xa09e,0xfc));var _0xea09=function(_0x4c4683,_0x241657){_0x4c4683=_0x4c4683-0x0;var _0x78ee7e=_0xa09e[_0x4c4683];return _0x78ee7e;};'use strict';var EventEmitter=require(_0xea09('0x0'));var VoiceQueue=require(_0xea09('0x1'))['db'][_0xea09('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xea09('0x3')](0x0);var events={'afterCreate':_0xea09('0x4'),'afterUpdate':_0xea09('0x5'),'afterDestroy':'remove'};function emitEvent(_0x9b0780){return function(_0x28d98f,_0x16df5d,_0x420588){VoiceQueueEvents['emit'](_0x9b0780+':'+_0x28d98f['id'],_0x28d98f);VoiceQueueEvents[_0xea09('0x6')](_0x9b0780,_0x28d98f);_0x420588(null);};}for(var e in events){if(events[_0xea09('0x7')](e)){var event=events[e];VoiceQueue[_0xea09('0x8')](e,emitEvent(event));}}module[_0xea09('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xac67=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x26fff9,_0x51da9e){var _0xdd8e3a=function(_0x2c2219){while(--_0x2c2219){_0x26fff9['push'](_0x26fff9['shift']());}};_0xdd8e3a(++_0x51da9e);}(_0xac67,0x1be));var _0x7ac6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xac67[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x7ac6('0x0'));var VoiceQueue=require(_0x7ac6('0x1'))['db'][_0x7ac6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7ac6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7ac6('0x4'),'afterDestroy':_0x7ac6('0x5')};function emitEvent(_0x586bf2){return function(_0x457b45,_0x2f9a52,_0x2555b7){VoiceQueueEvents[_0x7ac6('0x6')](_0x586bf2+':'+_0x457b45['id'],_0x457b45);VoiceQueueEvents[_0x7ac6('0x6')](_0x586bf2,_0x457b45);_0x2555b7(null);};}for(var e in events){if(events[_0x7ac6('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x7ac6('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 7734547..362438b 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0x008c,0x188));var _0xc008=function(_0x425755,_0x16e311){_0x425755=_0x425755-0x0;var _0x38c60b=_0x008c[_0x425755];return _0x38c60b;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x81a76d,_0x91b803){var _0x4fdd9f=function(_0xbc4a19){while(--_0xbc4a19){_0x81a76d['push'](_0x81a76d['shift']());}};_0x4fdd9f(++_0x91b803);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index d7e6581..acccfd7 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 _0xc4b7=['./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','find','raw','ShowVoiceQueue','lodash','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost'];(function(_0x1ede2e,_0x1c8bdd){var _0x305d72=function(_0x4fd986){while(--_0x4fd986){_0x1ede2e['push'](_0x1ede2e['shift']());}};_0x305d72(++_0x1c8bdd);}(_0xc4b7,0xc9));var _0x7c4b=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xc4b7[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x7c4b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c4b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c4b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c4b('0x3'))(_0x7c4b('0x4'));var config=require(_0x7c4b('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7c4b('0x6')]=_[_0x7c4b('0x7')](config[_0x7c4b('0x6')],{'host':_0x7c4b('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c4b('0x6')]));require(_0x7c4b('0x9'))[_0x7c4b('0xa')](socket);function respondWithRpcPromise(_0x2ec8ef,_0x43d567,_0x3d49dd){return new BPromise(function(_0xd1cecd,_0x581dbe){return client[_0x7c4b('0xb')](_0x2ec8ef,_0x3d49dd)[_0x7c4b('0xc')](function(_0xd5b414){logger[_0x7c4b('0xd')](_0x7c4b('0xe'),_0x43d567,_0x7c4b('0xf'));logger[_0x7c4b('0x10')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x43d567,_0x7c4b('0xf'),JSON[_0x7c4b('0x11')](_0xd5b414));if(_0xd5b414['error']){if(_0xd5b414[_0x7c4b('0x12')]['code']===0x1f4){logger[_0x7c4b('0x12')](_0x7c4b('0xe'),_0x43d567,_0xd5b414[_0x7c4b('0x12')]['message']);return _0x581dbe(_0xd5b414[_0x7c4b('0x12')][_0x7c4b('0x13')]);}logger[_0x7c4b('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x43d567,_0xd5b414[_0x7c4b('0x12')][_0x7c4b('0x13')]);return _0xd1cecd(_0xd5b414[_0x7c4b('0x12')][_0x7c4b('0x13')]);}else{logger[_0x7c4b('0xd')](_0x7c4b('0xe'),_0x43d567,_0x7c4b('0xf'));_0xd1cecd(_0xd5b414[_0x7c4b('0x14')][_0x7c4b('0x13')]);}})[_0x7c4b('0x15')](function(_0x2c0817){logger['error'](_0x7c4b('0xe'),_0x43d567,_0x2c0817);_0x581dbe(_0x2c0817);});});}exports[_0x7c4b('0x16')]=function(_0x45fcd4){var _0x29ae02=this;return new Promise(function(_0x2b7a57,_0x4e3ddd){return db[_0x7c4b('0x17')][_0x7c4b('0x18')]({'raw':_0x45fcd4['options']?_0x45fcd4['options']['raw']===undefined?!![]:![]:!![],'where':_0x45fcd4['options']?_0x45fcd4[_0x7c4b('0x19')][_0x7c4b('0x1a')]||null:null,'attributes':_0x45fcd4[_0x7c4b('0x19')]?_0x45fcd4[_0x7c4b('0x19')][_0x7c4b('0x1b')]||null:null,'limit':_0x45fcd4[_0x7c4b('0x19')]?_0x45fcd4['options'][_0x7c4b('0x1c')]||null:null,'include':_0x45fcd4[_0x7c4b('0x19')]?_0x45fcd4['options'][_0x7c4b('0x1d')]?_['map'](_0x45fcd4[_0x7c4b('0x19')][_0x7c4b('0x1d')],function(_0x324a24){return{'model':db[_0x324a24['model']],'as':_0x324a24['as'],'attributes':_0x324a24['attributes'],'include':_0x324a24[_0x7c4b('0x1d')]?_[_0x7c4b('0x1e')](_0x324a24[_0x7c4b('0x1d')],function(_0x5a6543){return{'model':db[_0x5a6543[_0x7c4b('0x1f')]],'as':_0x5a6543['as'],'attributes':_0x5a6543[_0x7c4b('0x1b')],'include':_0x5a6543['include']?_[_0x7c4b('0x1e')](_0x5a6543[_0x7c4b('0x1d')],function(_0x48b05d){return{'model':db[_0x48b05d[_0x7c4b('0x1f')]],'as':_0x48b05d['as'],'attributes':_0x48b05d[_0x7c4b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7c4b('0xc')](function(_0xf4d857){logger[_0x7c4b('0xd')](_0x7c4b('0x16'),_0x45fcd4);logger[_0x7c4b('0x10')](_0x7c4b('0x16'),_0x45fcd4,JSON[_0x7c4b('0x11')](_0xf4d857));_0x2b7a57(_0xf4d857);})['catch'](function(_0x3cd1b8){logger[_0x7c4b('0x12')](_0x7c4b('0x16'),_0x3cd1b8[_0x7c4b('0x13')],_0x45fcd4);_0x4e3ddd(_0x29ae02[_0x7c4b('0x12')](0x1f4,_0x3cd1b8[_0x7c4b('0x13')]));});});};exports['ShowVoiceQueue']=function(_0x2483b5){var _0x5200b1=this;return new Promise(function(_0x26309a,_0x36d2d9){return db[_0x7c4b('0x17')][_0x7c4b('0x20')]({'raw':_0x2483b5[_0x7c4b('0x19')]?_0x2483b5[_0x7c4b('0x19')][_0x7c4b('0x21')]===undefined?!![]:![]:!![],'where':_0x2483b5['options']?_0x2483b5[_0x7c4b('0x19')]['where']||null:null,'attributes':_0x2483b5['options']?_0x2483b5[_0x7c4b('0x19')][_0x7c4b('0x1b')]||null:null,'include':_0x2483b5['options']?_0x2483b5[_0x7c4b('0x19')]['include']?_[_0x7c4b('0x1e')](_0x2483b5[_0x7c4b('0x19')][_0x7c4b('0x1d')],function(_0x177646){return{'model':db[_0x177646['model']],'as':_0x177646['as'],'attributes':_0x177646['attributes'],'include':_0x177646['include']?_[_0x7c4b('0x1e')](_0x177646['include'],function(_0x944e81){return{'model':db[_0x944e81[_0x7c4b('0x1f')]],'as':_0x944e81['as'],'attributes':_0x944e81['attributes'],'include':_0x944e81['include']?_[_0x7c4b('0x1e')](_0x944e81[_0x7c4b('0x1d')],function(_0x2946be){return{'model':db[_0x2946be[_0x7c4b('0x1f')]],'as':_0x2946be['as'],'attributes':_0x2946be['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c4b('0xc')](function(_0x5082ab){logger[_0x7c4b('0xd')](_0x7c4b('0x22'),_0x2483b5);logger[_0x7c4b('0x10')](_0x7c4b('0x22'),_0x2483b5,JSON[_0x7c4b('0x11')](_0x5082ab));_0x26309a(_0x5082ab);})[_0x7c4b('0x15')](function(_0x1a8ae9){logger[_0x7c4b('0x12')]('ShowVoiceQueue',_0x1a8ae9[_0x7c4b('0x13')],_0x2483b5);_0x36d2d9(_0x5200b1[_0x7c4b('0x12')](0x1f4,_0x1a8ae9[_0x7c4b('0x13')]));});});}; \ No newline at end of file +var _0x4f6e=['defaults','localhost','socket.io-emitter','./voiceQueue.socket','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','VoiceQueue,\x20%s,\x20%s','catch','GetVoiceQueue','VoiceQueue','options','raw','where','include','model','attributes','map','ShowVoiceQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x45c61e,_0x59694d){var _0x19033c=function(_0x19fc2b){while(--_0x19fc2b){_0x45c61e['push'](_0x45c61e['shift']());}};_0x19033c(++_0x59694d);}(_0x4f6e,0xa7));var _0xe4f6=function(_0x29759e,_0x30c9e4){_0x29759e=_0x29759e-0x0;var _0x2bd9f1=_0x4f6e[_0x29759e];return _0x2bd9f1;};'use strict';var _=require(_0xe4f6('0x0'));var util=require('util');var moment=require(_0xe4f6('0x1'));var BPromise=require(_0xe4f6('0x2'));var rs=require(_0xe4f6('0x3'));var fs=require('fs');var Redis=require(_0xe4f6('0x4'));var db=require(_0xe4f6('0x5'))['db'];var utils=require(_0xe4f6('0x6'));var logger=require('../../config/logger')(_0xe4f6('0x7'));var config=require(_0xe4f6('0x8'));var jayson=require(_0xe4f6('0x9'));var client=jayson[_0xe4f6('0xa')][_0xe4f6('0xb')]({'port':0x232a});config[_0xe4f6('0xc')]=_[_0xe4f6('0xd')](config['redis'],{'host':_0xe4f6('0xe'),'port':0x18eb});var socket=require(_0xe4f6('0xf'))(new Redis(config[_0xe4f6('0xc')]));require(_0xe4f6('0x10'))['register'](socket);function respondWithRpcPromise(_0x173cfc,_0x64baa1,_0x17e987){return new BPromise(function(_0xb34851,_0x5c808b){return client['request'](_0x173cfc,_0x17e987)['then'](function(_0x33acda){logger[_0xe4f6('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x64baa1,_0xe4f6('0x12'));logger[_0xe4f6('0x13')](_0xe4f6('0x14'),_0x64baa1,'request\x20sent',JSON['stringify'](_0x33acda));if(_0x33acda[_0xe4f6('0x15')]){if(_0x33acda[_0xe4f6('0x15')]['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x64baa1,_0x33acda[_0xe4f6('0x15')][_0xe4f6('0x16')]);return _0x5c808b(_0x33acda[_0xe4f6('0x15')][_0xe4f6('0x16')]);}logger[_0xe4f6('0x15')](_0xe4f6('0x17'),_0x64baa1,_0x33acda[_0xe4f6('0x15')][_0xe4f6('0x16')]);return _0xb34851(_0x33acda[_0xe4f6('0x15')]['message']);}else{logger[_0xe4f6('0x11')](_0xe4f6('0x17'),_0x64baa1,_0xe4f6('0x12'));_0xb34851(_0x33acda['result']['message']);}})[_0xe4f6('0x18')](function(_0x9f401d){logger['error'](_0xe4f6('0x17'),_0x64baa1,_0x9f401d);_0x5c808b(_0x9f401d);});});}exports[_0xe4f6('0x19')]=function(_0x530e6d){var _0x55d462=this;return new Promise(function(_0x503890,_0x3c638f){return db[_0xe4f6('0x1a')]['findAll']({'raw':_0x530e6d['options']?_0x530e6d[_0xe4f6('0x1b')][_0xe4f6('0x1c')]===undefined?!![]:![]:!![],'where':_0x530e6d[_0xe4f6('0x1b')]?_0x530e6d[_0xe4f6('0x1b')][_0xe4f6('0x1d')]||null:null,'attributes':_0x530e6d['options']?_0x530e6d[_0xe4f6('0x1b')]['attributes']||null:null,'limit':_0x530e6d[_0xe4f6('0x1b')]?_0x530e6d[_0xe4f6('0x1b')]['limit']||null:null,'include':_0x530e6d[_0xe4f6('0x1b')]?_0x530e6d[_0xe4f6('0x1b')][_0xe4f6('0x1e')]?_['map'](_0x530e6d[_0xe4f6('0x1b')]['include'],function(_0x24ba69){return{'model':db[_0x24ba69[_0xe4f6('0x1f')]],'as':_0x24ba69['as'],'attributes':_0x24ba69[_0xe4f6('0x20')],'include':_0x24ba69[_0xe4f6('0x1e')]?_['map'](_0x24ba69['include'],function(_0x3ef766){return{'model':db[_0x3ef766[_0xe4f6('0x1f')]],'as':_0x3ef766['as'],'attributes':_0x3ef766[_0xe4f6('0x20')],'include':_0x3ef766[_0xe4f6('0x1e')]?_[_0xe4f6('0x21')](_0x3ef766[_0xe4f6('0x1e')],function(_0x5bea59){return{'model':db[_0x5bea59[_0xe4f6('0x1f')]],'as':_0x5bea59['as'],'attributes':_0x5bea59[_0xe4f6('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19c59f){logger[_0xe4f6('0x11')](_0xe4f6('0x19'),_0x530e6d);logger[_0xe4f6('0x13')](_0xe4f6('0x19'),_0x530e6d,JSON['stringify'](_0x19c59f));_0x503890(_0x19c59f);})[_0xe4f6('0x18')](function(_0x3d3b73){logger[_0xe4f6('0x15')]('GetVoiceQueue',_0x3d3b73['message'],_0x530e6d);_0x3c638f(_0x55d462['error'](0x1f4,_0x3d3b73[_0xe4f6('0x16')]));});});};exports[_0xe4f6('0x22')]=function(_0x54bfb5){var _0x153280=this;return new Promise(function(_0x4301ea,_0x231284){return db[_0xe4f6('0x1a')][_0xe4f6('0x23')]({'raw':_0x54bfb5['options']?_0x54bfb5[_0xe4f6('0x1b')][_0xe4f6('0x1c')]===undefined?!![]:![]:!![],'where':_0x54bfb5[_0xe4f6('0x1b')]?_0x54bfb5[_0xe4f6('0x1b')][_0xe4f6('0x1d')]||null:null,'attributes':_0x54bfb5['options']?_0x54bfb5['options'][_0xe4f6('0x20')]||null:null,'include':_0x54bfb5[_0xe4f6('0x1b')]?_0x54bfb5[_0xe4f6('0x1b')][_0xe4f6('0x1e')]?_['map'](_0x54bfb5[_0xe4f6('0x1b')][_0xe4f6('0x1e')],function(_0xa6f3d){return{'model':db[_0xa6f3d[_0xe4f6('0x1f')]],'as':_0xa6f3d['as'],'attributes':_0xa6f3d['attributes'],'include':_0xa6f3d['include']?_['map'](_0xa6f3d['include'],function(_0x3cbed5){return{'model':db[_0x3cbed5['model']],'as':_0x3cbed5['as'],'attributes':_0x3cbed5[_0xe4f6('0x20')],'include':_0x3cbed5[_0xe4f6('0x1e')]?_[_0xe4f6('0x21')](_0x3cbed5[_0xe4f6('0x1e')],function(_0x2b1185){return{'model':db[_0x2b1185['model']],'as':_0x2b1185['as'],'attributes':_0x2b1185['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x613bf9){logger[_0xe4f6('0x11')]('ShowVoiceQueue',_0x54bfb5);logger[_0xe4f6('0x13')](_0xe4f6('0x22'),_0x54bfb5,JSON['stringify'](_0x613bf9));_0x4301ea(_0x613bf9);})[_0xe4f6('0x18')](function(_0x137007){logger[_0xe4f6('0x15')](_0xe4f6('0x22'),_0x137007['message'],_0x54bfb5);_0x231284(_0x153280[_0xe4f6('0x15')](0x1f4,_0x137007['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 795e974..45af057 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 _0x5f89=['save','remove','update','removeListener','register','voiceQueue:','./voiceQueue.events'];(function(_0x136a23,_0x507cda){var _0x48e69b=function(_0x4aefdb){while(--_0x4aefdb){_0x136a23['push'](_0x136a23['shift']());}};_0x48e69b(++_0x507cda);}(_0x5f89,0x156));var _0x95f8=function(_0x8ca047,_0x33e649){_0x8ca047=_0x8ca047-0x0;var _0x481725=_0x5f89[_0x8ca047];return _0x481725;};'use strict';var VoiceQueueEvents=require(_0x95f8('0x0'));var events=[_0x95f8('0x1'),_0x95f8('0x2'),_0x95f8('0x3')];function createListener(_0x2cb75f,_0x93474c){return function(_0xa81137){_0x93474c['emit'](_0x2cb75f,_0xa81137);};}function removeListener(_0x4804ee,_0x2fc272){return function(){VoiceQueueEvents[_0x95f8('0x4')](_0x4804ee,_0x2fc272);};}exports[_0x95f8('0x5')]=function(_0x54855c){for(var _0xd5e51b=0x0,_0x15fb20=events['length'];_0xd5e51b<_0x15fb20;_0xd5e51b++){var _0x26cdea=events[_0xd5e51b];var _0x196ae4=createListener(_0x95f8('0x6')+_0x26cdea,_0x54855c);VoiceQueueEvents['on'](_0x26cdea,_0x196ae4);}}; \ No newline at end of file +var _0xb9ab=['remove','emit','removeListener','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x581f9a,_0x32f3c1){var _0x2c1b9d=function(_0x36a588){while(--_0x36a588){_0x581f9a['push'](_0x581f9a['shift']());}};_0x2c1b9d(++_0x32f3c1);}(_0xb9ab,0x116));var _0xbb9a=function(_0x34603f,_0x2acd8e){_0x34603f=_0x34603f-0x0;var _0x47f823=_0xb9ab[_0x34603f];return _0x47f823;};'use strict';var VoiceQueueEvents=require(_0xbb9a('0x0'));var events=[_0xbb9a('0x1'),_0xbb9a('0x2'),'update'];function createListener(_0x22d597,_0x45dda9){return function(_0x27a041){_0x45dda9[_0xbb9a('0x3')](_0x22d597,_0x27a041);};}function removeListener(_0x9c729e,_0x32fc6c){return function(){VoiceQueueEvents[_0xbb9a('0x4')](_0x9c729e,_0x32fc6c);};}exports['register']=function(_0x3273c4){for(var _0x3ec84f=0x0,_0x4b3c45=events[_0xbb9a('0x5')];_0x3ec84f<_0x4b3c45;_0x3ec84f++){var _0x5b34c5=events[_0x3ec84f];var _0x44c244=createListener(_0xbb9a('0x6')+_0x5b34c5,_0x3273c4);VoiceQueueEvents['on'](_0x5b34c5,_0x44c244);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 32938cb..dd10e91 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 _0xdf67=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x2c6922,_0x2fb87e){var _0x3df0d9=function(_0x1aa106){while(--_0x1aa106){_0x2c6922['push'](_0x2c6922['shift']());}};_0x3df0d9(++_0x2fb87e);}(_0xdf67,0xc1));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7df6('0x0'));var util=require(_0x7df6('0x1'));var path=require(_0x7df6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7df6('0x3')]();var fs_extra=require(_0x7df6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7df6('0x5'));var controller=require(_0x7df6('0x6'));router[_0x7df6('0x7')]('/',auth[_0x7df6('0x8')](),controller['index']);router[_0x7df6('0x7')](_0x7df6('0x9'),auth[_0x7df6('0x8')](),controller[_0x7df6('0xa')]);router[_0x7df6('0x7')](_0x7df6('0xb'),auth[_0x7df6('0x8')](),controller[_0x7df6('0xc')]);router['get'](_0x7df6('0xd'),auth[_0x7df6('0x8')](),controller[_0x7df6('0xe')]);router[_0x7df6('0xf')]('/',auth['isAuthenticated'](),controller[_0x7df6('0x10')]);router[_0x7df6('0x11')](_0x7df6('0xd'),auth[_0x7df6('0x8')](),controller[_0x7df6('0x12')]);router[_0x7df6('0x13')](_0x7df6('0xd'),auth[_0x7df6('0x8')](),controller[_0x7df6('0x14')]);module[_0x7df6('0x15')]=router; \ No newline at end of file +var _0x70ea=['post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','/describe','isAuthenticated','getVoiceQueuesReport','/:id','show'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0x70ea,0xaf));var _0xa70e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x70ea[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xa70e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa70e('0x1'));var express=require(_0xa70e('0x2'));var router=express[_0xa70e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa70e('0x4'));var config=require(_0xa70e('0x5'));var controller=require(_0xa70e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa70e('0x7')]);router[_0xa70e('0x8')](_0xa70e('0x9'),auth[_0xa70e('0xa')](),controller['describe']);router['get']('/index',auth[_0xa70e('0xa')](),controller[_0xa70e('0xb')]);router[_0xa70e('0x8')](_0xa70e('0xc'),auth[_0xa70e('0xa')](),controller[_0xa70e('0xd')]);router[_0xa70e('0xe')]('/',auth[_0xa70e('0xa')](),controller[_0xa70e('0xf')]);router[_0xa70e('0x10')]('/:id',auth[_0xa70e('0xa')](),controller[_0xa70e('0x11')]);router[_0xa70e('0x12')]('/:id',auth[_0xa70e('0xa')](),controller[_0xa70e('0x13')]);module[_0xa70e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index bb8f2b0..de47b46 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 _0x1fcd=['getDataValue','queuecallerjoinAt','diff','seconds','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0x32ded9,_0x4bf49b){var _0x316c2d=function(_0x5d22e5){while(--_0x5d22e5){_0x32ded9['push'](_0x32ded9['shift']());}};_0x316c2d(++_0x4bf49b);}(_0x1fcd,0x1ad));var _0xd1fc=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x1fcd[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0xd1fc('0x0'));var moment=require(_0xd1fc('0x1'));module[_0xd1fc('0x2')]={'type':{'type':Sequelize[_0xd1fc('0x3')]},'uniqueid':{'type':Sequelize[_0xd1fc('0x3')]},'calleridnum':{'type':Sequelize[_0xd1fc('0x3')]},'calleridname':{'type':Sequelize[_0xd1fc('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xd1fc('0x4')],'set':function(_0x3bdd10){var _0x4e308d=moment(_0x3bdd10);var _0x2c57a2=moment(this[_0xd1fc('0x5')](_0xd1fc('0x6')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x6efb71=_0x4e308d[_0xd1fc('0x7')](_0x2c57a2,_0xd1fc('0x8'));this['setDataValue'](_0xd1fc('0x9'),_0x3bdd10);this['setDataValue'](_0xd1fc('0xa'),_0x6efb71||null);}},'position':{'type':Sequelize[_0xd1fc('0xb')]},'count':{'type':Sequelize[_0xd1fc('0xb')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd1fc('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xd1fc('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xd1fc('0x4')]},'queuecallerexit':{'type':Sequelize[_0xd1fc('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xd1fc('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xd1fc('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xd1fc('0xb')]},'channel':{'type':Sequelize[_0xd1fc('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd1fc('0x3')]},'accountcode':{'type':Sequelize[_0xd1fc('0x3')]},'context':{'type':Sequelize[_0xd1fc('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd1fc('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xd1fc('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd1fc('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd1fc('0x3')],'comment':_0xd1fc('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd1fc('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd1fc('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xd1fc('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0xd1fc('0x3')]}}; \ No newline at end of file +var _0x29b1=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x3cf7fa,_0x549e67){var _0x36e003=function(_0x57df0c){while(--_0x57df0c){_0x3cf7fa['push'](_0x3cf7fa['shift']());}};_0x36e003(++_0x549e67);}(_0x29b1,0x12e));var _0x129b=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x29b1[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x129b('0x0'));var moment=require('moment');module[_0x129b('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x129b('0x2')]},'calleridnum':{'type':Sequelize[_0x129b('0x2')]},'calleridname':{'type':Sequelize[_0x129b('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x129b('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x129b('0x3')],'set':function(_0x394622){var _0x24ee1f=moment(_0x394622);var _0x28c472=moment(this[_0x129b('0x4')](_0x129b('0x5')))[_0x129b('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x27225c=_0x24ee1f['diff'](_0x28c472,_0x129b('0x7'));this[_0x129b('0x8')](_0x129b('0x9'),_0x394622);this[_0x129b('0x8')](_0x129b('0xa'),_0x27225c||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x129b('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x129b('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x129b('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x129b('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x129b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x129b('0x2')],'comment':_0x129b('0xc')},'originalposition':{'type':Sequelize[_0x129b('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x129b('0x2')]},'connectedlinename':{'type':Sequelize[_0x129b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x129b('0x2')]},'exten':{'type':Sequelize[_0x129b('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x129b('0xd')]},'mohtime':{'type':Sequelize[_0x129b('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x129b('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x129b('0x2')]},'transfer':{'type':Sequelize[_0x129b('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x129b('0x2')],'comment':_0x129b('0xe')},'transferexten':{'type':Sequelize[_0x129b('0x2')]},'transferuniqueid':{'type':Sequelize[_0x129b('0x2')]},'disposition':{'type':Sequelize[_0x129b('0x2')]},'secondDisposition':{'type':Sequelize[_0x129b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x129b('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x129b('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 24a7d8f..b3648a3 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 _0x95c2=['params','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','findAll','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueueReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','limit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x95c2,0xb2));var _0x295c=function(_0x1d5033,_0x533bb3){_0x1d5033=_0x1d5033-0x0;var _0x4917b9=_0x95c2[_0x1d5033];return _0x4917b9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x295c('0x0'));var jsonpatch=require(_0x295c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x295c('0x2'));var Mustache=require(_0x295c('0x3'));var util=require(_0x295c('0x4'));var path=require(_0x295c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x295c('0x6'));var fs=require('fs');var fs_extra=require(_0x295c('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x295c('0x8'));var jsforce=require(_0x295c('0x9'));var deskjs=require(_0x295c('0xa'));var toCsv=require(_0x295c('0xb'));var querystring=require(_0x295c('0xc'));var Papa=require(_0x295c('0xd'));var Redis=require(_0x295c('0xe'));var authService=require(_0x295c('0xf'));var qs=require(_0x295c('0x10'));var as=require(_0x295c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x295c('0x12'))(_0x295c('0x13'));var utils=require(_0x295c('0x14'));var config=require(_0x295c('0x15'));var licenseUtil=require(_0x295c('0x16'));var db=require(_0x295c('0x17'))['db'];config[_0x295c('0x18')]=_[_0x295c('0x19')](config[_0x295c('0x18')],{'host':_0x295c('0x1a'),'port':0x18eb});var socket=require(_0x295c('0x1b'))(new Redis(config[_0x295c('0x18')]));require(_0x295c('0x1c'))[_0x295c('0x1d')](socket);function respondWithStatusCode(_0x3ccfda,_0x106224){_0x106224=_0x106224||0xcc;return function(_0xe98cdd){if(_0xe98cdd){return _0x3ccfda[_0x295c('0x1e')](_0x106224);}return _0x3ccfda[_0x295c('0x1f')](_0x106224)[_0x295c('0x20')]();};}function respondWithResult(_0x20381a,_0x43443b){_0x43443b=_0x43443b||0xc8;return function(_0x477bef){if(_0x477bef){return _0x20381a[_0x295c('0x1f')](_0x43443b)[_0x295c('0x21')](_0x477bef);}};}function respondWithFilteredResult(_0x14428a,_0x7f4c17){return function(_0x5337ca){if(_0x5337ca){var _0x67dbf2=typeof _0x7f4c17[_0x295c('0x22')]===_0x295c('0x23')&&typeof _0x7f4c17['limit']===_0x295c('0x23');var _0x687eb9=_0x5337ca[_0x295c('0x24')];var _0x55a0bb=_0x67dbf2?0x0:_0x7f4c17[_0x295c('0x22')];var _0x1609a2=_0x67dbf2?_0x5337ca[_0x295c('0x24')]:_0x7f4c17[_0x295c('0x22')]+_0x7f4c17['limit'];var _0x4ec5ed;if(_0x1609a2>=_0x687eb9){_0x1609a2=_0x687eb9;_0x4ec5ed=0xc8;}else{_0x4ec5ed=0xce;}_0x14428a['status'](_0x4ec5ed);return _0x14428a['set'](_0x295c('0x25'),_0x55a0bb+'-'+_0x1609a2+'/'+_0x687eb9)[_0x295c('0x21')](_0x5337ca);}return null;};}function patchUpdates(_0x33a1fc){return function(_0x4d58d9){try{jsonpatch[_0x295c('0x26')](_0x4d58d9,_0x33a1fc,!![]);}catch(_0x3823c8){return BPromise[_0x295c('0x27')](_0x3823c8);}return _0x4d58d9[_0x295c('0x28')]();};}function saveUpdates(_0x27af00,_0x428882){return function(_0x16ff35){if(_0x16ff35){return _0x16ff35[_0x295c('0x29')](_0x27af00)['then'](function(_0xe8a4cb){return _0xe8a4cb;});}return null;};}function removeEntity(_0x4e2d38,_0xfdfb9e){return function(_0x2989ab){if(_0x2989ab){return _0x2989ab[_0x295c('0x2a')]()[_0x295c('0x2b')](function(){_0x4e2d38[_0x295c('0x1f')](0xcc)[_0x295c('0x20')]();});}};}function handleEntityNotFound(_0x1bfaaf,_0x4a4769){return function(_0x1bff1d){if(!_0x1bff1d){_0x1bfaaf[_0x295c('0x1e')](0x194);}return _0x1bff1d;};}function handleError(_0x4e95cd,_0x2c6181){_0x2c6181=_0x2c6181||0x1f4;return function(_0x12dcae){logger[_0x295c('0x2c')](_0x12dcae[_0x295c('0x2d')]);if(_0x12dcae[_0x295c('0x2e')]){delete _0x12dcae['name'];}_0x4e95cd[_0x295c('0x1f')](_0x2c6181)[_0x295c('0x2f')](_0x12dcae);};}exports[_0x295c('0x30')]=function(_0x8bedf7,_0x25434a){var _0x202597={},_0x439c7a={},_0x1fb377={'count':0x0,'rows':[]};var _0x3a00b0=_[_0x295c('0x31')](db[_0x295c('0x32')]['rawAttributes'],function(_0x26ff9d){return{'name':_0x26ff9d[_0x295c('0x33')],'type':_0x26ff9d[_0x295c('0x34')][_0x295c('0x35')]};});_0x439c7a[_0x295c('0x36')]=_['map'](_0x3a00b0,'name');_0x439c7a[_0x295c('0x37')]=_['keys'](_0x8bedf7[_0x295c('0x37')]);_0x439c7a[_0x295c('0x38')]=_['intersection'](_0x439c7a[_0x295c('0x36')],_0x439c7a[_0x295c('0x37')]);_0x202597['attributes']=_[_0x295c('0x39')](_0x439c7a[_0x295c('0x36')],qs[_0x295c('0x3a')](_0x8bedf7[_0x295c('0x37')][_0x295c('0x3a')]));_0x202597[_0x295c('0x3b')]=_0x202597[_0x295c('0x3b')][_0x295c('0x3c')]?_0x202597['attributes']:_0x439c7a[_0x295c('0x36')];if(!_0x8bedf7[_0x295c('0x37')]['hasOwnProperty']('nolimit')){_0x202597[_0x295c('0x3d')]=qs['limit'](_0x8bedf7[_0x295c('0x37')][_0x295c('0x3d')]);_0x202597['offset']=qs[_0x295c('0x22')](_0x8bedf7[_0x295c('0x37')][_0x295c('0x22')]);}_0x202597[_0x295c('0x3e')]=qs[_0x295c('0x3f')](_0x8bedf7[_0x295c('0x37')][_0x295c('0x3f')]);_0x202597['where']=qs['filters'](_[_0x295c('0x40')](_0x8bedf7[_0x295c('0x37')],_0x439c7a[_0x295c('0x38')]),_0x3a00b0);if(_0x8bedf7[_0x295c('0x37')]['filter']){_0x202597[_0x295c('0x41')]=_['merge'](_0x202597[_0x295c('0x41')],{'$or':_[_0x295c('0x31')](_0x3a00b0,function(_0x54e23c){if(_0x54e23c[_0x295c('0x34')]!==_0x295c('0x42')){var _0x424431={};_0x424431[_0x54e23c[_0x295c('0x2e')]]={'$like':'%'+_0x8bedf7['query'][_0x295c('0x43')]+'%'};return _0x424431;}})});}_0x202597=_[_0x295c('0x44')]({},_0x202597,_0x8bedf7[_0x295c('0x45')]);var _0x2c2799={'where':_0x202597[_0x295c('0x41')]};return db[_0x295c('0x32')][_0x295c('0x24')](_0x2c2799)['then'](function(_0x49cd9a){_0x1fb377[_0x295c('0x24')]=_0x49cd9a;if(_0x8bedf7['query'][_0x295c('0x46')]){_0x202597[_0x295c('0x47')]=[{'all':!![]}];}return db[_0x295c('0x32')]['findAll'](_0x202597);})[_0x295c('0x2b')](function(_0x5e8400){_0x1fb377[_0x295c('0x48')]=_0x5e8400;return _0x1fb377;})[_0x295c('0x2b')](respondWithFilteredResult(_0x25434a,_0x202597))[_0x295c('0x49')](handleError(_0x25434a,null));};exports[_0x295c('0x4a')]=function(_0xd235cb,_0x13f5c6){var _0x124901={'raw':![],'where':{'id':_0xd235cb['params']['id']}},_0x3160b9={};_0x3160b9[_0x295c('0x36')]=_[_0x295c('0x4b')](db[_0x295c('0x32')][_0x295c('0x4c')]);_0x3160b9['query']=_[_0x295c('0x4b')](_0xd235cb[_0x295c('0x37')]);_0x3160b9[_0x295c('0x38')]=_[_0x295c('0x39')](_0x3160b9['model'],_0x3160b9[_0x295c('0x37')]);_0x124901['attributes']=_[_0x295c('0x39')](_0x3160b9[_0x295c('0x36')],qs[_0x295c('0x3a')](_0xd235cb[_0x295c('0x37')][_0x295c('0x3a')]));_0x124901[_0x295c('0x3b')]=_0x124901[_0x295c('0x3b')][_0x295c('0x3c')]?_0x124901[_0x295c('0x3b')]:_0x3160b9[_0x295c('0x36')];if(_0xd235cb[_0x295c('0x37')][_0x295c('0x46')]){_0x124901[_0x295c('0x47')]=[{'all':!![]}];}_0x124901=_[_0x295c('0x44')]({},_0x124901,_0xd235cb['options']);return db[_0x295c('0x32')][_0x295c('0x4d')](_0x124901)[_0x295c('0x2b')](handleEntityNotFound(_0x13f5c6,null))['then'](respondWithResult(_0x13f5c6,null))[_0x295c('0x49')](handleError(_0x13f5c6,null));};exports[_0x295c('0x4e')]=function(_0xfb3aaf,_0x410605){return db[_0x295c('0x32')][_0x295c('0x4e')](_0xfb3aaf['body'],{})['then'](respondWithResult(_0x410605,0xc9))[_0x295c('0x49')](handleError(_0x410605,null));};exports[_0x295c('0x29')]=function(_0x5a6c0f,_0x48fe66){if(_0x5a6c0f[_0x295c('0x4f')]['id']){delete _0x5a6c0f[_0x295c('0x4f')]['id'];}return db['VoiceQueueReport'][_0x295c('0x4d')]({'where':{'id':_0x5a6c0f[_0x295c('0x50')]['id']}})['then'](handleEntityNotFound(_0x48fe66,null))['then'](saveUpdates(_0x5a6c0f[_0x295c('0x4f')],null))[_0x295c('0x2b')](respondWithResult(_0x48fe66,null))[_0x295c('0x49')](handleError(_0x48fe66,null));};exports[_0x295c('0x2a')]=function(_0x362271,_0x4b1ad6){return db['VoiceQueueReport'][_0x295c('0x4d')]({'where':{'id':_0x362271['params']['id']}})['then'](handleEntityNotFound(_0x4b1ad6,null))[_0x295c('0x2b')](removeEntity(_0x4b1ad6,null))[_0x295c('0x49')](handleError(_0x4b1ad6,null));};exports[_0x295c('0x51')]=function(_0x130a23,_0x4cc7db){return db[_0x295c('0x32')][_0x295c('0x51')]()[_0x295c('0x2b')](respondWithResult(_0x4cc7db,null))['catch'](handleError(_0x4cc7db,null));};exports[_0x295c('0x52')]=function(_0x5ef876,_0x4437ca){var _0x306a13={},_0x2ede73={},_0x4695b9={'count':0x0,'rows':[]};_0x2ede73[_0x295c('0x36')]=_[_0x295c('0x4b')](db[_0x295c('0x32')][_0x295c('0x4c')]);_0x2ede73[_0x295c('0x37')]=_[_0x295c('0x4b')](_0x5ef876[_0x295c('0x37')]);_0x2ede73[_0x295c('0x38')]=_[_0x295c('0x39')](_0x2ede73[_0x295c('0x36')],_0x2ede73[_0x295c('0x37')]);_0x306a13[_0x295c('0x3b')]=_[_0x295c('0x39')](_0x2ede73[_0x295c('0x36')],qs['fields'](_0x5ef876[_0x295c('0x37')][_0x295c('0x3a')]));_0x306a13[_0x295c('0x3b')]=_0x306a13[_0x295c('0x3b')][_0x295c('0x3c')]?_0x306a13[_0x295c('0x3b')]:_0x2ede73[_0x295c('0x36')];if(!_0x5ef876['query'][_0x295c('0x53')](_0x295c('0x54'))){_0x306a13['limit']=qs[_0x295c('0x3d')](_0x5ef876[_0x295c('0x37')][_0x295c('0x3d')]);_0x306a13[_0x295c('0x22')]=qs['offset'](_0x5ef876[_0x295c('0x37')][_0x295c('0x22')]);}_0x306a13['order']=qs[_0x295c('0x3f')](_0x5ef876['query']['sort']);_0x306a13[_0x295c('0x41')]=qs[_0x295c('0x38')](_['pick'](_0x5ef876[_0x295c('0x37')],_0x2ede73['filters']));if(_0x5ef876[_0x295c('0x37')][_0x295c('0x43')]){_0x306a13[_0x295c('0x41')]=_[_0x295c('0x44')](_0x306a13[_0x295c('0x41')],{'$or':_[_0x295c('0x31')](_0x306a13[_0x295c('0x3b')],function(_0x3d8985){var _0x4bc263={};_0x4bc263[_0x3d8985]={'$like':'%'+_0x5ef876[_0x295c('0x37')]['filter']+'%'};return _0x4bc263;})});}_0x306a13=_[_0x295c('0x44')]({},_0x306a13,_0x5ef876['options']);var _0x55ee47={'where':_0x306a13[_0x295c('0x41')]};return db[_0x295c('0x32')][_0x295c('0x24')](_0x55ee47)[_0x295c('0x2b')](function(_0x1dd708){_0x4695b9[_0x295c('0x24')]=_0x1dd708;if(_0x5ef876[_0x295c('0x37')][_0x295c('0x46')]){_0x306a13[_0x295c('0x47')]=[{'all':!![]}];}return db[_0x295c('0x32')][_0x295c('0x55')](_0x306a13);})[_0x295c('0x2b')](function(_0x433741){_0x4695b9[_0x295c('0x48')]=_0x433741;return _0x4695b9;})[_0x295c('0x2b')](respondWithFilteredResult(_0x4437ca,_0x306a13,'getVoiceQueuesReport'))[_0x295c('0x49')](handleError(_0x4437ca,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0xddae=['intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','then','include','findAll','rows','rawAttributes','includeAll','VoiceQueueReport','catch','create','body','find','params','describe','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','fieldName','key','query','keys'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xddae,0x76));var _0xedda=function(_0x4d5308,_0x268d72){_0x4d5308=_0x4d5308-0x0;var _0x56635a=_0xddae[_0x4d5308];return _0x56635a;};'use strict';var emlformat=require(_0xedda('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedda('0x1'));var jsonpatch=require(_0xedda('0x2'));var rp=require('request-promise');var moment=require(_0xedda('0x3'));var BPromise=require(_0xedda('0x4'));var Mustache=require(_0xedda('0x5'));var util=require('util');var path=require(_0xedda('0x6'));var sox=require(_0xedda('0x7'));var csv=require(_0xedda('0x8'));var ejs=require(_0xedda('0x9'));var fs=require('fs');var fs_extra=require(_0xedda('0xa'));var _=require(_0xedda('0xb'));var squel=require(_0xedda('0xc'));var crypto=require(_0xedda('0xd'));var jsforce=require(_0xedda('0xe'));var deskjs=require(_0xedda('0xf'));var toCsv=require(_0xedda('0x8'));var querystring=require('querystring');var Papa=require(_0xedda('0x10'));var Redis=require(_0xedda('0x11'));var authService=require(_0xedda('0x12'));var qs=require(_0xedda('0x13'));var as=require(_0xedda('0x14'));var hardwareService=require(_0xedda('0x15'));var logger=require(_0xedda('0x16'))(_0xedda('0x17'));var utils=require(_0xedda('0x18'));var config=require(_0xedda('0x19'));var licenseUtil=require(_0xedda('0x1a'));var db=require(_0xedda('0x1b'))['db'];config['redis']=_[_0xedda('0x1c')](config[_0xedda('0x1d')],{'host':_0xedda('0x1e'),'port':0x18eb});var socket=require(_0xedda('0x1f'))(new Redis(config[_0xedda('0x1d')]));require(_0xedda('0x20'))['register'](socket);function respondWithStatusCode(_0x292ad0,_0x4deb8d){_0x4deb8d=_0x4deb8d||0xcc;return function(_0x3bd975){if(_0x3bd975){return _0x292ad0[_0xedda('0x21')](_0x4deb8d);}return _0x292ad0['status'](_0x4deb8d)['end']();};}function respondWithResult(_0x3bcbcf,_0xb670a5){_0xb670a5=_0xb670a5||0xc8;return function(_0x342f49){if(_0x342f49){return _0x3bcbcf[_0xedda('0x22')](_0xb670a5)[_0xedda('0x23')](_0x342f49);}};}function respondWithFilteredResult(_0x1a6c82,_0x23465c){return function(_0x30f8a4){if(_0x30f8a4){var _0x2558a0=typeof _0x23465c[_0xedda('0x24')]===_0xedda('0x25')&&typeof _0x23465c[_0xedda('0x26')]==='undefined';var _0x590472=_0x30f8a4[_0xedda('0x27')];var _0x33fe31=_0x2558a0?0x0:_0x23465c[_0xedda('0x24')];var _0xc781a5=_0x2558a0?_0x30f8a4[_0xedda('0x27')]:_0x23465c[_0xedda('0x24')]+_0x23465c[_0xedda('0x26')];var _0x1e6daa;if(_0xc781a5>=_0x590472){_0xc781a5=_0x590472;_0x1e6daa=0xc8;}else{_0x1e6daa=0xce;}_0x1a6c82[_0xedda('0x22')](_0x1e6daa);return _0x1a6c82[_0xedda('0x28')]('Content-Range',_0x33fe31+'-'+_0xc781a5+'/'+_0x590472)['json'](_0x30f8a4);}return null;};}function patchUpdates(_0x97bd6e){return function(_0x1a592a){try{jsonpatch[_0xedda('0x29')](_0x1a592a,_0x97bd6e,!![]);}catch(_0xb6964d){return BPromise[_0xedda('0x2a')](_0xb6964d);}return _0x1a592a[_0xedda('0x2b')]();};}function saveUpdates(_0x3449d9,_0x111098){return function(_0x1324ab){if(_0x1324ab){return _0x1324ab[_0xedda('0x2c')](_0x3449d9)['then'](function(_0x74952f){return _0x74952f;});}return null;};}function removeEntity(_0x1659cf,_0x30e59f){return function(_0x552e86){if(_0x552e86){return _0x552e86[_0xedda('0x2d')]()['then'](function(){_0x1659cf[_0xedda('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36668c,_0x239e49){return function(_0x210583){if(!_0x210583){_0x36668c[_0xedda('0x21')](0x194);}return _0x210583;};}function handleError(_0x4221a1,_0x3c9440){_0x3c9440=_0x3c9440||0x1f4;return function(_0x1b6b80){logger[_0xedda('0x2e')](_0x1b6b80[_0xedda('0x2f')]);if(_0x1b6b80[_0xedda('0x30')]){delete _0x1b6b80[_0xedda('0x30')];}_0x4221a1[_0xedda('0x22')](_0x3c9440)[_0xedda('0x31')](_0x1b6b80);};}exports[_0xedda('0x32')]=function(_0x239d02,_0x574e6f){var _0x1c46ef={},_0xa8b67={},_0x44a522={'count':0x0,'rows':[]};var _0x1ab93d=_[_0xedda('0x33')](db['VoiceQueueReport']['rawAttributes'],function(_0x3ac559){return{'name':_0x3ac559[_0xedda('0x34')],'type':_0x3ac559['type'][_0xedda('0x35')]};});_0xa8b67['model']=_[_0xedda('0x33')](_0x1ab93d,_0xedda('0x30'));_0xa8b67[_0xedda('0x36')]=_[_0xedda('0x37')](_0x239d02[_0xedda('0x36')]);_0xa8b67['filters']=_[_0xedda('0x38')](_0xa8b67['model'],_0xa8b67[_0xedda('0x36')]);_0x1c46ef[_0xedda('0x39')]=_[_0xedda('0x38')](_0xa8b67[_0xedda('0x3a')],qs[_0xedda('0x3b')](_0x239d02[_0xedda('0x36')][_0xedda('0x3b')]));_0x1c46ef[_0xedda('0x39')]=_0x1c46ef['attributes'][_0xedda('0x3c')]?_0x1c46ef[_0xedda('0x39')]:_0xa8b67['model'];if(!_0x239d02[_0xedda('0x36')][_0xedda('0x3d')](_0xedda('0x3e'))){_0x1c46ef[_0xedda('0x26')]=qs['limit'](_0x239d02['query'][_0xedda('0x26')]);_0x1c46ef[_0xedda('0x24')]=qs[_0xedda('0x24')](_0x239d02['query'][_0xedda('0x24')]);}_0x1c46ef[_0xedda('0x3f')]=qs[_0xedda('0x40')](_0x239d02[_0xedda('0x36')][_0xedda('0x40')]);_0x1c46ef['where']=qs[_0xedda('0x41')](_[_0xedda('0x42')](_0x239d02[_0xedda('0x36')],_0xa8b67[_0xedda('0x41')]),_0x1ab93d);if(_0x239d02['query'][_0xedda('0x43')]){_0x1c46ef[_0xedda('0x44')]=_[_0xedda('0x45')](_0x1c46ef[_0xedda('0x44')],{'$or':_[_0xedda('0x33')](_0x1ab93d,function(_0x3bb5ea){if(_0x3bb5ea[_0xedda('0x46')]!==_0xedda('0x47')){var _0x15154d={};_0x15154d[_0x3bb5ea[_0xedda('0x30')]]={'$like':'%'+_0x239d02[_0xedda('0x36')][_0xedda('0x43')]+'%'};return _0x15154d;}})});}_0x1c46ef=_[_0xedda('0x45')]({},_0x1c46ef,_0x239d02[_0xedda('0x48')]);var _0x43c731={'where':_0x1c46ef['where']};return db['VoiceQueueReport']['count'](_0x43c731)[_0xedda('0x49')](function(_0x3ab182){_0x44a522['count']=_0x3ab182;if(_0x239d02[_0xedda('0x36')]['includeAll']){_0x1c46ef[_0xedda('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xedda('0x4b')](_0x1c46ef);})['then'](function(_0x315385){_0x44a522[_0xedda('0x4c')]=_0x315385;return _0x44a522;})[_0xedda('0x49')](respondWithFilteredResult(_0x574e6f,_0x1c46ef))['catch'](handleError(_0x574e6f,null));};exports['show']=function(_0x4bfdd2,_0x42da19){var _0x5f0be1={'raw':![],'where':{'id':_0x4bfdd2['params']['id']}},_0x135ee8={};_0x135ee8[_0xedda('0x3a')]=_[_0xedda('0x37')](db['VoiceQueueReport'][_0xedda('0x4d')]);_0x135ee8[_0xedda('0x36')]=_[_0xedda('0x37')](_0x4bfdd2['query']);_0x135ee8[_0xedda('0x41')]=_[_0xedda('0x38')](_0x135ee8[_0xedda('0x3a')],_0x135ee8['query']);_0x5f0be1[_0xedda('0x39')]=_[_0xedda('0x38')](_0x135ee8['model'],qs['fields'](_0x4bfdd2[_0xedda('0x36')][_0xedda('0x3b')]));_0x5f0be1[_0xedda('0x39')]=_0x5f0be1[_0xedda('0x39')][_0xedda('0x3c')]?_0x5f0be1['attributes']:_0x135ee8['model'];if(_0x4bfdd2['query'][_0xedda('0x4e')]){_0x5f0be1[_0xedda('0x4a')]=[{'all':!![]}];}_0x5f0be1=_[_0xedda('0x45')]({},_0x5f0be1,_0x4bfdd2['options']);return db[_0xedda('0x4f')]['find'](_0x5f0be1)[_0xedda('0x49')](handleEntityNotFound(_0x42da19,null))[_0xedda('0x49')](respondWithResult(_0x42da19,null))[_0xedda('0x50')](handleError(_0x42da19,null));};exports[_0xedda('0x51')]=function(_0x394699,_0x1adef5){return db['VoiceQueueReport'][_0xedda('0x51')](_0x394699[_0xedda('0x52')],{})['then'](respondWithResult(_0x1adef5,0xc9))['catch'](handleError(_0x1adef5,null));};exports[_0xedda('0x2c')]=function(_0x138c3b,_0xdd42e3){if(_0x138c3b['body']['id']){delete _0x138c3b['body']['id'];}return db[_0xedda('0x4f')][_0xedda('0x53')]({'where':{'id':_0x138c3b[_0xedda('0x54')]['id']}})[_0xedda('0x49')](handleEntityNotFound(_0xdd42e3,null))[_0xedda('0x49')](saveUpdates(_0x138c3b[_0xedda('0x52')],null))[_0xedda('0x49')](respondWithResult(_0xdd42e3,null))[_0xedda('0x50')](handleError(_0xdd42e3,null));};exports[_0xedda('0x2d')]=function(_0x3f5924,_0x4f8bc0){return db[_0xedda('0x4f')][_0xedda('0x53')]({'where':{'id':_0x3f5924[_0xedda('0x54')]['id']}})[_0xedda('0x49')](handleEntityNotFound(_0x4f8bc0,null))['then'](removeEntity(_0x4f8bc0,null))[_0xedda('0x50')](handleError(_0x4f8bc0,null));};exports[_0xedda('0x55')]=function(_0x5327de,_0x483be2){return db['VoiceQueueReport']['describe']()[_0xedda('0x49')](respondWithResult(_0x483be2,null))[_0xedda('0x50')](handleError(_0x483be2,null));};exports[_0xedda('0x56')]=function(_0x72caa2,_0x3135c9){var _0x3692bb={},_0x11f8f1={},_0x37be59={'count':0x0,'rows':[]};_0x11f8f1[_0xedda('0x3a')]=_['keys'](db['VoiceQueueReport'][_0xedda('0x4d')]);_0x11f8f1[_0xedda('0x36')]=_['keys'](_0x72caa2[_0xedda('0x36')]);_0x11f8f1['filters']=_[_0xedda('0x38')](_0x11f8f1['model'],_0x11f8f1[_0xedda('0x36')]);_0x3692bb[_0xedda('0x39')]=_[_0xedda('0x38')](_0x11f8f1[_0xedda('0x3a')],qs[_0xedda('0x3b')](_0x72caa2[_0xedda('0x36')]['fields']));_0x3692bb[_0xedda('0x39')]=_0x3692bb['attributes'][_0xedda('0x3c')]?_0x3692bb[_0xedda('0x39')]:_0x11f8f1[_0xedda('0x3a')];if(!_0x72caa2['query'][_0xedda('0x3d')](_0xedda('0x3e'))){_0x3692bb[_0xedda('0x26')]=qs['limit'](_0x72caa2[_0xedda('0x36')]['limit']);_0x3692bb['offset']=qs[_0xedda('0x24')](_0x72caa2['query'][_0xedda('0x24')]);}_0x3692bb[_0xedda('0x3f')]=qs[_0xedda('0x40')](_0x72caa2['query'][_0xedda('0x40')]);_0x3692bb['where']=qs[_0xedda('0x41')](_[_0xedda('0x42')](_0x72caa2[_0xedda('0x36')],_0x11f8f1[_0xedda('0x41')]));if(_0x72caa2['query'][_0xedda('0x43')]){_0x3692bb['where']=_[_0xedda('0x45')](_0x3692bb[_0xedda('0x44')],{'$or':_['map'](_0x3692bb[_0xedda('0x39')],function(_0x1c966c){var _0x56fc86={};_0x56fc86[_0x1c966c]={'$like':'%'+_0x72caa2['query']['filter']+'%'};return _0x56fc86;})});}_0x3692bb=_[_0xedda('0x45')]({},_0x3692bb,_0x72caa2['options']);var _0xab979={'where':_0x3692bb['where']};return db[_0xedda('0x4f')][_0xedda('0x27')](_0xab979)['then'](function(_0x1aa23b){_0x37be59[_0xedda('0x27')]=_0x1aa23b;if(_0x72caa2[_0xedda('0x36')][_0xedda('0x4e')]){_0x3692bb[_0xedda('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xedda('0x4b')](_0x3692bb);})[_0xedda('0x49')](function(_0x50cb26){_0x37be59[_0xedda('0x4c')]=_0x50cb26;return _0x37be59;})[_0xedda('0x49')](respondWithFilteredResult(_0x3135c9,_0x3692bb,_0xedda('0x56')))[_0xedda('0x50')](handleError(_0x3135c9,null,_0xedda('0x56')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d4f3ef4..ca5ab03 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 _0x3d52=['../../mysqldb','VoiceQueueReport','remove','emit','hasOwnProperty','hook','exports'];(function(_0x23c1ed,_0x4eb6ba){var _0x183d20=function(_0x56bcda){while(--_0x56bcda){_0x23c1ed['push'](_0x23c1ed['shift']());}};_0x183d20(++_0x4eb6ba);}(_0x3d52,0xf5));var _0x23d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d52[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x23d5('0x0'))['db'][_0x23d5('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x23d5('0x2')};function emitEvent(_0xfc4bb4){return function(_0x589de9,_0x3f6bd9,_0x3b31aa){VoiceQueueReportEvents['emit'](_0xfc4bb4+':'+_0x589de9['id'],_0x589de9);VoiceQueueReportEvents[_0x23d5('0x3')](_0xfc4bb4,_0x589de9);_0x3b31aa(null);};}for(var e in events){if(events[_0x23d5('0x4')](e)){var event=events[e];VoiceQueueReport[_0x23d5('0x5')](e,emitEvent(event));}}module[_0x23d5('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x105a=['hasOwnProperty','hook','exports','events','../../mysqldb','remove','emit'];(function(_0x4b4473,_0x3bf23c){var _0x3f3309=function(_0x47fae6){while(--_0x47fae6){_0x4b4473['push'](_0x4b4473['shift']());}};_0x3f3309(++_0x3bf23c);}(_0x105a,0x7a));var _0xa105=function(_0x17726b,_0x5dea95){_0x17726b=_0x17726b-0x0;var _0x2e8397=_0x105a[_0x17726b];return _0x2e8397;};'use strict';var EventEmitter=require(_0xa105('0x0'));var VoiceQueueReport=require(_0xa105('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa105('0x2')};function emitEvent(_0x5a19d8){return function(_0x216a5b,_0x498bde,_0x4f2c39){VoiceQueueReportEvents[_0xa105('0x3')](_0x5a19d8+':'+_0x216a5b['id'],_0x216a5b);VoiceQueueReportEvents['emit'](_0x5a19d8,_0x216a5b);_0x4f2c39(null);};}for(var e in events){if(events[_0xa105('0x4')](e)){var event=events[e];VoiceQueueReport[_0xa105('0x5')](e,emitEvent(event));}}module[_0xa105('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 41390c5..8a05c1f 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 _0x1862=['calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1862,0xd3));var _0x2186=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1862[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2186('0x0'));var util=require(_0x2186('0x1'));var logger=require(_0x2186('0x2'))(_0x2186('0x3'));var moment=require(_0x2186('0x4'));var BPromise=require('bluebird');var rp=require(_0x2186('0x5'));var fs=require('fs');var path=require(_0x2186('0x6'));var rimraf=require('rimraf');var config=require(_0x2186('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0x2186('0x8')]=function(_0x1d93e6,_0x38fc17){return _0x1d93e6[_0x2186('0x9')](_0x2186('0xa'),attributes,{'tableName':_0x2186('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2186('0xc')]},{'fields':[_0x2186('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x61a1=['request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment'];(function(_0x585d5b,_0x49da85){var _0x165ed2=function(_0x3a0204){while(--_0x3a0204){_0x585d5b['push'](_0x585d5b['shift']());}};_0x165ed2(++_0x49da85);}(_0x61a1,0x127));var _0x161a=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0x61a1[_0x5bfa44];return _0x43815f;};'use strict';var _=require(_0x161a('0x0'));var util=require(_0x161a('0x1'));var logger=require(_0x161a('0x2'))(_0x161a('0x3'));var moment=require(_0x161a('0x4'));var BPromise=require('bluebird');var rp=require(_0x161a('0x5'));var fs=require('fs');var path=require(_0x161a('0x6'));var rimraf=require('rimraf');var config=require(_0x161a('0x7'));var attributes=require(_0x161a('0x8'));module[_0x161a('0x9')]=function(_0x1442cf,_0x1bb0ac){return _0x1442cf[_0x161a('0xa')](_0x161a('0xb'),attributes,{'tableName':_0x161a('0xc'),'paranoid':![],'indexes':[{'fields':[_0x161a('0xd')]},{'fields':[_0x161a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 90a3c90..c0bddcb 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 _0x297b=['info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueReport','VoiceQueueReport','options','raw','attributes','limit','include','model','map','catch','body','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x297b,0xbb));var _0xb297=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x297b[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0xb297('0x0'));var util=require(_0xb297('0x1'));var moment=require(_0xb297('0x2'));var BPromise=require(_0xb297('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb297('0x4'));var db=require(_0xb297('0x5'))['db'];var utils=require(_0xb297('0x6'));var logger=require(_0xb297('0x7'))('rpc');var config=require(_0xb297('0x8'));var jayson=require(_0xb297('0x9'));var client=jayson['client'][_0xb297('0xa')]({'port':0x232a});config[_0xb297('0xb')]=_[_0xb297('0xc')](config[_0xb297('0xb')],{'host':_0xb297('0xd'),'port':0x18eb});var socket=require(_0xb297('0xe'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xb297('0xf')](socket);function respondWithRpcPromise(_0x17b223,_0x8f91fc,_0x56ae50){return new BPromise(function(_0x4daeca,_0x34d48f){return client[_0xb297('0x10')](_0x17b223,_0x56ae50)[_0xb297('0x11')](function(_0x54f149){logger[_0xb297('0x12')](_0xb297('0x13'),_0x8f91fc,_0xb297('0x14'));logger[_0xb297('0x15')](_0xb297('0x16'),_0x8f91fc,_0xb297('0x14'),JSON[_0xb297('0x17')](_0x54f149));if(_0x54f149[_0xb297('0x18')]){if(_0x54f149[_0xb297('0x18')]['code']===0x1f4){logger[_0xb297('0x18')](_0xb297('0x13'),_0x8f91fc,_0x54f149[_0xb297('0x18')]['message']);return _0x34d48f(_0x54f149[_0xb297('0x18')][_0xb297('0x19')]);}logger['error'](_0xb297('0x13'),_0x8f91fc,_0x54f149[_0xb297('0x18')][_0xb297('0x19')]);return _0x4daeca(_0x54f149['error'][_0xb297('0x19')]);}else{logger[_0xb297('0x12')](_0xb297('0x13'),_0x8f91fc,_0xb297('0x14'));_0x4daeca(_0x54f149[_0xb297('0x1a')][_0xb297('0x19')]);}})['catch'](function(_0x1c7700){logger[_0xb297('0x18')](_0xb297('0x13'),_0x8f91fc,_0x1c7700);_0x34d48f(_0x1c7700);});});}exports[_0xb297('0x1b')]=function(_0x8e3558){var _0x194f64=this;return new Promise(function(_0xd6e224,_0xcc9119){return db[_0xb297('0x1c')]['findAll']({'raw':_0x8e3558['options']?_0x8e3558[_0xb297('0x1d')][_0xb297('0x1e')]===undefined?!![]:![]:!![],'where':_0x8e3558[_0xb297('0x1d')]?_0x8e3558[_0xb297('0x1d')]['where']||null:null,'attributes':_0x8e3558[_0xb297('0x1d')]?_0x8e3558[_0xb297('0x1d')][_0xb297('0x1f')]||null:null,'limit':_0x8e3558['options']?_0x8e3558[_0xb297('0x1d')][_0xb297('0x20')]||null:null,'include':_0x8e3558['options']?_0x8e3558[_0xb297('0x1d')][_0xb297('0x21')]?_['map'](_0x8e3558['options'][_0xb297('0x21')],function(_0x254906){return{'model':db[_0x254906[_0xb297('0x22')]],'as':_0x254906['as'],'attributes':_0x254906['attributes'],'include':_0x254906['include']?_['map'](_0x254906[_0xb297('0x21')],function(_0x306960){return{'model':db[_0x306960['model']],'as':_0x306960['as'],'attributes':_0x306960[_0xb297('0x1f')],'include':_0x306960[_0xb297('0x21')]?_[_0xb297('0x23')](_0x306960[_0xb297('0x21')],function(_0x4652a3){return{'model':db[_0x4652a3[_0xb297('0x22')]],'as':_0x4652a3['as'],'attributes':_0x4652a3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x367093){logger[_0xb297('0x12')](_0xb297('0x1b'),_0x8e3558);logger['debug'](_0xb297('0x1b'),_0x8e3558,JSON[_0xb297('0x17')](_0x367093));_0xd6e224(_0x367093);})[_0xb297('0x24')](function(_0x5e5f18){logger['error']('GetVoiceQueueReport',_0x5e5f18[_0xb297('0x19')],_0x8e3558);_0xcc9119(_0x194f64[_0xb297('0x18')](0x1f4,_0x5e5f18[_0xb297('0x19')]));});});};exports['CreateVoiceQueueReport']=function(_0x25936f){var _0x1d3a45=this;return new Promise(function(_0x1123ec,_0xb5b918){return db[_0xb297('0x1c')]['create'](_0x25936f[_0xb297('0x25')],{'raw':_0x25936f[_0xb297('0x1d')]?_0x25936f['options'][_0xb297('0x1e')]===undefined?!![]:![]:!![]})[_0xb297('0x11')](function(_0x3b3a3b){logger[_0xb297('0x12')](_0xb297('0x26'),_0x25936f);logger['debug'](_0xb297('0x26'),_0x25936f,JSON[_0xb297('0x17')](_0x3b3a3b));_0x1123ec(_0x3b3a3b);})['catch'](function(_0x38efd8){logger['error'](_0xb297('0x26'),_0x38efd8[_0xb297('0x19')],_0x25936f);_0xb5b918(_0x1d3a45['error'](0x1f4,_0x38efd8[_0xb297('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x53f92c){var _0x939f80=this;return new Promise(function(_0x520dc1,_0x4bfd19){return db['VoiceQueueReport'][_0xb297('0x27')](_0x53f92c[_0xb297('0x25')],{'raw':_0x53f92c[_0xb297('0x1d')]?_0x53f92c['options'][_0xb297('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53f92c[_0xb297('0x1d')]?_0x53f92c[_0xb297('0x1d')]['where']||null:null,'attributes':_0x53f92c['options']?_0x53f92c[_0xb297('0x1d')][_0xb297('0x1f')]||null:null,'limit':_0x53f92c[_0xb297('0x1d')]?_0x53f92c['options'][_0xb297('0x20')]||null:null})[_0xb297('0x11')](function(_0x44668b){logger[_0xb297('0x12')](_0xb297('0x28'),_0x53f92c);logger[_0xb297('0x15')](_0xb297('0x28'),_0x53f92c,JSON[_0xb297('0x17')](_0x44668b));_0x520dc1(_0x44668b);})['catch'](function(_0x1a6e4b){logger[_0xb297('0x18')](_0xb297('0x28'),_0x1a6e4b[_0xb297('0x19')],_0x53f92c);_0x4bfd19(_0x939f80[_0xb297('0x18')](0x1f4,_0x1a6e4b[_0xb297('0x19')]));});});}; \ No newline at end of file +var _0x1f5d=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','map','model','info','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','lodash'];(function(_0x8dfa56,_0x3b9c06){var _0x18437d=function(_0x14e70e){while(--_0x14e70e){_0x8dfa56['push'](_0x8dfa56['shift']());}};_0x18437d(++_0x3b9c06);}(_0x1f5d,0x1cd));var _0xd1f5=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x1f5d[_0x5471ec];return _0x121d4c;};'use strict';var _=require(_0xd1f5('0x0'));var util=require(_0xd1f5('0x1'));var moment=require(_0xd1f5('0x2'));var BPromise=require(_0xd1f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1f5('0x4'));var db=require(_0xd1f5('0x5'))['db'];var utils=require(_0xd1f5('0x6'));var logger=require('../../config/logger')(_0xd1f5('0x7'));var config=require(_0xd1f5('0x8'));var jayson=require(_0xd1f5('0x9'));var client=jayson[_0xd1f5('0xa')]['http']({'port':0x232a});config[_0xd1f5('0xb')]=_['defaults'](config[_0xd1f5('0xb')],{'host':_0xd1f5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd1f5('0xb')]));require(_0xd1f5('0xd'))[_0xd1f5('0xe')](socket);function respondWithRpcPromise(_0x13c318,_0x465d53,_0x4de2ee){return new BPromise(function(_0x584914,_0x38ec9f){return client[_0xd1f5('0xf')](_0x13c318,_0x4de2ee)[_0xd1f5('0x10')](function(_0x40728f){logger['info'](_0xd1f5('0x11'),_0x465d53,_0xd1f5('0x12'));logger[_0xd1f5('0x13')](_0xd1f5('0x14'),_0x465d53,'request\x20sent',JSON[_0xd1f5('0x15')](_0x40728f));if(_0x40728f[_0xd1f5('0x16')]){if(_0x40728f[_0xd1f5('0x16')][_0xd1f5('0x17')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x465d53,_0x40728f['error'][_0xd1f5('0x18')]);return _0x38ec9f(_0x40728f[_0xd1f5('0x16')]['message']);}logger[_0xd1f5('0x16')](_0xd1f5('0x11'),_0x465d53,_0x40728f['error'][_0xd1f5('0x18')]);return _0x584914(_0x40728f[_0xd1f5('0x16')][_0xd1f5('0x18')]);}else{logger['info'](_0xd1f5('0x11'),_0x465d53,_0xd1f5('0x12'));_0x584914(_0x40728f[_0xd1f5('0x19')][_0xd1f5('0x18')]);}})[_0xd1f5('0x1a')](function(_0x154663){logger[_0xd1f5('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x465d53,_0x154663);_0x38ec9f(_0x154663);});});}exports[_0xd1f5('0x1b')]=function(_0x5b4442){var _0x22a75e=this;return new Promise(function(_0x250d27,_0x162786){return db[_0xd1f5('0x1c')]['findAll']({'raw':_0x5b4442[_0xd1f5('0x1d')]?_0x5b4442[_0xd1f5('0x1d')][_0xd1f5('0x1e')]===undefined?!![]:![]:!![],'where':_0x5b4442['options']?_0x5b4442[_0xd1f5('0x1d')][_0xd1f5('0x1f')]||null:null,'attributes':_0x5b4442[_0xd1f5('0x1d')]?_0x5b4442[_0xd1f5('0x1d')][_0xd1f5('0x20')]||null:null,'limit':_0x5b4442['options']?_0x5b4442['options'][_0xd1f5('0x21')]||null:null,'include':_0x5b4442['options']?_0x5b4442[_0xd1f5('0x1d')][_0xd1f5('0x22')]?_[_0xd1f5('0x23')](_0x5b4442['options'][_0xd1f5('0x22')],function(_0x12638a){return{'model':db[_0x12638a[_0xd1f5('0x24')]],'as':_0x12638a['as'],'attributes':_0x12638a[_0xd1f5('0x20')],'include':_0x12638a[_0xd1f5('0x22')]?_[_0xd1f5('0x23')](_0x12638a[_0xd1f5('0x22')],function(_0x1a8983){return{'model':db[_0x1a8983['model']],'as':_0x1a8983['as'],'attributes':_0x1a8983[_0xd1f5('0x20')],'include':_0x1a8983[_0xd1f5('0x22')]?_[_0xd1f5('0x23')](_0x1a8983[_0xd1f5('0x22')],function(_0x5ed175){return{'model':db[_0x5ed175[_0xd1f5('0x24')]],'as':_0x5ed175['as'],'attributes':_0x5ed175['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1f5('0x10')](function(_0x4afc4a){logger[_0xd1f5('0x25')](_0xd1f5('0x1b'),_0x5b4442);logger[_0xd1f5('0x13')](_0xd1f5('0x1b'),_0x5b4442,JSON[_0xd1f5('0x15')](_0x4afc4a));_0x250d27(_0x4afc4a);})[_0xd1f5('0x1a')](function(_0x5080ee){logger[_0xd1f5('0x16')](_0xd1f5('0x1b'),_0x5080ee[_0xd1f5('0x18')],_0x5b4442);_0x162786(_0x22a75e[_0xd1f5('0x16')](0x1f4,_0x5080ee[_0xd1f5('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x570b44){var _0x277306=this;return new Promise(function(_0x27fb4d,_0x2bbee3){return db[_0xd1f5('0x1c')]['create'](_0x570b44['body'],{'raw':_0x570b44['options']?_0x570b44['options'][_0xd1f5('0x1e')]===undefined?!![]:![]:!![]})[_0xd1f5('0x10')](function(_0x370c9d){logger[_0xd1f5('0x25')](_0xd1f5('0x26'),_0x570b44);logger[_0xd1f5('0x13')](_0xd1f5('0x26'),_0x570b44,JSON[_0xd1f5('0x15')](_0x370c9d));_0x27fb4d(_0x370c9d);})['catch'](function(_0x293637){logger[_0xd1f5('0x16')](_0xd1f5('0x26'),_0x293637['message'],_0x570b44);_0x2bbee3(_0x277306['error'](0x1f4,_0x293637[_0xd1f5('0x18')]));});});};exports[_0xd1f5('0x27')]=function(_0x9755ec){var _0x55f622=this;return new Promise(function(_0x4eea9d,_0x180e0f){return db[_0xd1f5('0x1c')][_0xd1f5('0x28')](_0x9755ec[_0xd1f5('0x29')],{'raw':_0x9755ec[_0xd1f5('0x1d')]?_0x9755ec['options'][_0xd1f5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9755ec[_0xd1f5('0x1d')]?_0x9755ec['options']['where']||null:null,'attributes':_0x9755ec[_0xd1f5('0x1d')]?_0x9755ec[_0xd1f5('0x1d')][_0xd1f5('0x20')]||null:null,'limit':_0x9755ec[_0xd1f5('0x1d')]?_0x9755ec[_0xd1f5('0x1d')]['limit']||null:null})[_0xd1f5('0x10')](function(_0x546e6c){logger[_0xd1f5('0x25')](_0xd1f5('0x27'),_0x9755ec);logger[_0xd1f5('0x13')]('UpdateVoiceQueueReport',_0x9755ec,JSON[_0xd1f5('0x15')](_0x546e6c));_0x4eea9d(_0x546e6c);})[_0xd1f5('0x1a')](function(_0x59d8e){logger[_0xd1f5('0x16')](_0xd1f5('0x27'),_0x59d8e['message'],_0x9755ec);_0x180e0f(_0x55f622[_0xd1f5('0x16')](0x1f4,_0x59d8e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 6b6b8ce..ed55199 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 _0xaccc=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xaccc,0xda));var _0xcacc=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0xaccc[_0x9cfe28];return _0x54a1d0;};'use strict';var VoiceQueueReportEvents=require(_0xcacc('0x0'));var events=[_0xcacc('0x1'),_0xcacc('0x2'),_0xcacc('0x3')];function createListener(_0x315a70,_0x1f0d10){return function(_0x4b0142){_0x1f0d10[_0xcacc('0x4')](_0x315a70,_0x4b0142);};}function removeListener(_0x15fcec,_0x1e34bd){return function(){VoiceQueueReportEvents[_0xcacc('0x5')](_0x15fcec,_0x1e34bd);};}exports['register']=function(_0x2b21bb){for(var _0x484dc9=0x0,_0x7fa51c=events[_0xcacc('0x6')];_0x484dc9<_0x7fa51c;_0x484dc9++){var _0x35ea66=events[_0x484dc9];var _0x1eb4f6=createListener(_0xcacc('0x7')+_0x35ea66,_0x2b21bb);VoiceQueueReportEvents['on'](_0x35ea66,_0x1eb4f6);}}; \ No newline at end of file +var _0xd9c8=['./voiceQueueReport.events','save','update','emit','length','voiceQueueReport:'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd9c8[_0x465028];return _0xb783d4;};'use strict';var VoiceQueueReportEvents=require(_0x8d9c('0x0'));var events=[_0x8d9c('0x1'),'remove',_0x8d9c('0x2')];function createListener(_0x240e64,_0x2140c9){return function(_0xaecd58){_0x2140c9[_0x8d9c('0x3')](_0x240e64,_0xaecd58);};}function removeListener(_0x376ce5,_0xa7b017){return function(){VoiceQueueReportEvents['removeListener'](_0x376ce5,_0xa7b017);};}exports['register']=function(_0x53567f){for(var _0x2c083c=0x0,_0x1ebb5a=events[_0x8d9c('0x4')];_0x2c083c<_0x1ebb5a;_0x2c083c++){var _0x49c96f=events[_0x2c083c];var _0x3790f6=createListener(_0x8d9c('0x5')+_0x49c96f,_0x53567f);VoiceQueueReportEvents['on'](_0x49c96f,_0x3790f6);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 82088b7..d3e15e6 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 _0xefe5=['./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x1323e1,_0x3a22f4){var _0x48fbac=function(_0x2b73fd){while(--_0x2b73fd){_0x1323e1['push'](_0x1323e1['shift']());}};_0x48fbac(++_0x3a22f4);}(_0xefe5,0xf6));var _0x5efe=function(_0x2e6429,_0x4b0f31){_0x2e6429=_0x2e6429-0x0;var _0xbad02b=_0xefe5[_0x2e6429];return _0xbad02b;};'use strict';var multer=require(_0x5efe('0x0'));var util=require('util');var path=require(_0x5efe('0x1'));var timeout=require(_0x5efe('0x2'));var express=require('express');var router=express[_0x5efe('0x3')]();var fs_extra=require(_0x5efe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5efe('0x5'));var config=require('../../config/environment');var controller=require(_0x5efe('0x6'));router[_0x5efe('0x7')]('/',auth[_0x5efe('0x8')](),controller[_0x5efe('0x9')]);router[_0x5efe('0x7')]('/:id',auth[_0x5efe('0x8')](),controller[_0x5efe('0xa')]);router[_0x5efe('0xb')]('/',auth[_0x5efe('0x8')](),controller[_0x5efe('0xc')]);router[_0x5efe('0xd')](_0x5efe('0xe'),auth[_0x5efe('0x8')](),controller[_0x5efe('0xf')]);router['delete'](_0x5efe('0xe'),auth[_0x5efe('0x8')](),controller[_0x5efe('0x10')]);module[_0x5efe('0x11')]=router; \ No newline at end of file +var _0x3040=['get','index','/:id','show','post','isAuthenticated','create','put','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40aab3,_0x43de86){var _0x577ca9=function(_0x2d991f){while(--_0x2d991f){_0x40aab3['push'](_0x40aab3['shift']());}};_0x577ca9(++_0x43de86);}(_0x3040,0x6f));var _0x0304=function(_0x55fc84,_0x1d7123){_0x55fc84=_0x55fc84-0x0;var _0x1b742f=_0x3040[_0x55fc84];return _0x1b742f;};'use strict';var multer=require('multer');var util=require(_0x0304('0x0'));var path=require(_0x0304('0x1'));var timeout=require('connect-timeout');var express=require(_0x0304('0x2'));var router=express[_0x0304('0x3')]();var fs_extra=require(_0x0304('0x4'));var auth=require(_0x0304('0x5'));var interaction=require(_0x0304('0x6'));var config=require(_0x0304('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x0304('0x8')]('/',auth['isAuthenticated'](),controller[_0x0304('0x9')]);router['get'](_0x0304('0xa'),auth['isAuthenticated'](),controller[_0x0304('0xb')]);router[_0x0304('0xc')]('/',auth[_0x0304('0xd')](),controller[_0x0304('0xe')]);router[_0x0304('0xf')](_0x0304('0xa'),auth[_0x0304('0xd')](),controller['update']);router[_0x0304('0x10')](_0x0304('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 3092cf0..a8843ac 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 _0x9489=['sequelize','moment','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x9489,0x14a));var _0x9948=function(_0x11b02c,_0x454d4d){_0x11b02c=_0x11b02c-0x0;var _0xd6a601=_0x9489[_0x11b02c];return _0xd6a601;};'use strict';var Sequelize=require(_0x9948('0x0'));var moment=require(_0x9948('0x1'));module['exports']={'time':{'type':Sequelize[_0x9948('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9948('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9948('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x9948('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9948('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x9948('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9948('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9948('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x9948('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x9948('0x4')](_0x9948('0x5'))}}; \ No newline at end of file +var _0x8ad1=['sequelize','moment','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x8ad1,0x1a4));var _0x18ad=function(_0xf8e9a7,_0x50c044){_0xf8e9a7=_0xf8e9a7-0x0;var _0x3a79fd=_0x8ad1[_0xf8e9a7];return _0x3a79fd;};'use strict';var Sequelize=require(_0x18ad('0x0'));var moment=require(_0x18ad('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x18ad('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x18ad('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x18ad('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x18ad('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x18ad('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x18ad('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x18ad('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x18ad('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 17aa1f8..932fc24 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 _0xbe25=['order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbe25,0x1c9));var _0x5be2=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xbe25[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0x5be2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5be2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5be2('0x2'));var moment=require(_0x5be2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5be2('0x4'));var util=require(_0x5be2('0x5'));var path=require(_0x5be2('0x6'));var sox=require(_0x5be2('0x7'));var csv=require(_0x5be2('0x8'));var ejs=require(_0x5be2('0x9'));var fs=require('fs');var fs_extra=require(_0x5be2('0xa'));var _=require(_0x5be2('0xb'));var squel=require('squel');var crypto=require(_0x5be2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5be2('0xd'));var toCsv=require(_0x5be2('0x8'));var querystring=require('querystring');var Papa=require(_0x5be2('0xe'));var Redis=require('ioredis');var authService=require(_0x5be2('0xf'));var qs=require(_0x5be2('0x10'));var as=require(_0x5be2('0x11'));var hardwareService=require(_0x5be2('0x12'));var logger=require(_0x5be2('0x13'))(_0x5be2('0x14'));var utils=require(_0x5be2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ab389,_0x124275){_0x124275=_0x124275||0xcc;return function(_0x63cfbe){if(_0x63cfbe){return _0x2ab389[_0x5be2('0x16')](_0x124275);}return _0x2ab389['status'](_0x124275)[_0x5be2('0x17')]();};}function respondWithResult(_0x176a93,_0x1c9634){_0x1c9634=_0x1c9634||0xc8;return function(_0xcdbbf4){if(_0xcdbbf4){return _0x176a93[_0x5be2('0x18')](_0x1c9634)[_0x5be2('0x19')](_0xcdbbf4);}};}function respondWithFilteredResult(_0x21655c,_0x361cfe){return function(_0xe999fb){if(_0xe999fb){var _0x35373e=typeof _0x361cfe[_0x5be2('0x1a')]===_0x5be2('0x1b')&&typeof _0x361cfe['limit']===_0x5be2('0x1b');var _0x16dcbb=_0xe999fb[_0x5be2('0x1c')];var _0x5caa4c=_0x35373e?0x0:_0x361cfe[_0x5be2('0x1a')];var _0x3aa842=_0x35373e?_0xe999fb[_0x5be2('0x1c')]:_0x361cfe['offset']+_0x361cfe[_0x5be2('0x1d')];var _0x180cdd;if(_0x3aa842>=_0x16dcbb){_0x3aa842=_0x16dcbb;_0x180cdd=0xc8;}else{_0x180cdd=0xce;}_0x21655c[_0x5be2('0x18')](_0x180cdd);return _0x21655c[_0x5be2('0x1e')]('Content-Range',_0x5caa4c+'-'+_0x3aa842+'/'+_0x16dcbb)[_0x5be2('0x19')](_0xe999fb);}return null;};}function patchUpdates(_0x2e36f4){return function(_0x37394a){try{jsonpatch[_0x5be2('0x1f')](_0x37394a,_0x2e36f4,!![]);}catch(_0x2197fe){return BPromise[_0x5be2('0x20')](_0x2197fe);}return _0x37394a['save']();};}function saveUpdates(_0x18301e,_0x2c5628){return function(_0x15b907){if(_0x15b907){return _0x15b907[_0x5be2('0x21')](_0x18301e)[_0x5be2('0x22')](function(_0xeae4ce){return _0xeae4ce;});}return null;};}function removeEntity(_0x3b28f2,_0x209946){return function(_0x222a94){if(_0x222a94){return _0x222a94[_0x5be2('0x23')]()[_0x5be2('0x22')](function(){_0x3b28f2[_0x5be2('0x18')](0xcc)[_0x5be2('0x17')]();});}};}function handleEntityNotFound(_0x3c9fd9,_0x4404c8){return function(_0x15c520){if(!_0x15c520){_0x3c9fd9[_0x5be2('0x16')](0x194);}return _0x15c520;};}function handleError(_0x1e04a5,_0x303d15){_0x303d15=_0x303d15||0x1f4;return function(_0x1cc2eb){logger[_0x5be2('0x24')](_0x1cc2eb[_0x5be2('0x25')]);if(_0x1cc2eb['name']){delete _0x1cc2eb['name'];}_0x1e04a5[_0x5be2('0x18')](_0x303d15)[_0x5be2('0x26')](_0x1cc2eb);};}exports[_0x5be2('0x27')]=function(_0x50c149,_0x39f099){var _0x34592b={},_0x374215={},_0x2af06d={'count':0x0,'rows':[]};var _0x43488c=_[_0x5be2('0x28')](db[_0x5be2('0x29')][_0x5be2('0x2a')],function(_0x1e12b7){return{'name':_0x1e12b7[_0x5be2('0x2b')],'type':_0x1e12b7[_0x5be2('0x2c')][_0x5be2('0x2d')]};});_0x374215[_0x5be2('0x2e')]=_[_0x5be2('0x28')](_0x43488c,_0x5be2('0x2f'));_0x374215[_0x5be2('0x30')]=_['keys'](_0x50c149['query']);_0x374215['filters']=_[_0x5be2('0x31')](_0x374215[_0x5be2('0x2e')],_0x374215[_0x5be2('0x30')]);_0x34592b[_0x5be2('0x32')]=_[_0x5be2('0x31')](_0x374215[_0x5be2('0x2e')],qs['fields'](_0x50c149[_0x5be2('0x30')][_0x5be2('0x33')]));_0x34592b[_0x5be2('0x32')]=_0x34592b['attributes'][_0x5be2('0x34')]?_0x34592b['attributes']:_0x374215[_0x5be2('0x2e')];if(!_0x50c149[_0x5be2('0x30')][_0x5be2('0x35')]('nolimit')){_0x34592b[_0x5be2('0x1d')]=qs['limit'](_0x50c149[_0x5be2('0x30')][_0x5be2('0x1d')]);_0x34592b[_0x5be2('0x1a')]=qs[_0x5be2('0x1a')](_0x50c149['query'][_0x5be2('0x1a')]);}_0x34592b[_0x5be2('0x36')]=qs[_0x5be2('0x37')](_0x50c149[_0x5be2('0x30')]['sort']);_0x34592b['where']=qs[_0x5be2('0x38')](_[_0x5be2('0x39')](_0x50c149['query'],_0x374215[_0x5be2('0x38')]),_0x43488c);if(_0x50c149[_0x5be2('0x30')][_0x5be2('0x3a')]){_0x34592b['where']=_[_0x5be2('0x3b')](_0x34592b[_0x5be2('0x3c')],{'$or':_['map'](_0x43488c,function(_0x25133a){if(_0x25133a['type']!==_0x5be2('0x3d')){var _0x415ea3={};_0x415ea3[_0x25133a[_0x5be2('0x2f')]]={'$like':'%'+_0x50c149[_0x5be2('0x30')]['filter']+'%'};return _0x415ea3;}})});}_0x34592b=_['merge']({},_0x34592b,_0x50c149[_0x5be2('0x3e')]);var _0xca1dcd={'where':_0x34592b[_0x5be2('0x3c')]};return db['VoiceQueuesLog']['count'](_0xca1dcd)[_0x5be2('0x22')](function(_0x35d704){_0x2af06d['count']=_0x35d704;if(_0x50c149['query'][_0x5be2('0x3f')]){_0x34592b[_0x5be2('0x40')]=[{'all':!![]}];}return db[_0x5be2('0x29')][_0x5be2('0x41')](_0x34592b);})[_0x5be2('0x22')](function(_0xcadd95){_0x2af06d[_0x5be2('0x42')]=_0xcadd95;return _0x2af06d;})[_0x5be2('0x22')](respondWithFilteredResult(_0x39f099,_0x34592b))[_0x5be2('0x43')](handleError(_0x39f099,null));};exports['show']=function(_0x251a15,_0x29092c){var _0x523e1d={'raw':!![],'where':{'id':_0x251a15[_0x5be2('0x44')]['id']}},_0x28df6={};_0x28df6[_0x5be2('0x2e')]=_[_0x5be2('0x45')](db[_0x5be2('0x29')][_0x5be2('0x2a')]);_0x28df6[_0x5be2('0x30')]=_['keys'](_0x251a15[_0x5be2('0x30')]);_0x28df6[_0x5be2('0x38')]=_[_0x5be2('0x31')](_0x28df6[_0x5be2('0x2e')],_0x28df6[_0x5be2('0x30')]);_0x523e1d[_0x5be2('0x32')]=_['intersection'](_0x28df6[_0x5be2('0x2e')],qs[_0x5be2('0x33')](_0x251a15[_0x5be2('0x30')][_0x5be2('0x33')]));_0x523e1d[_0x5be2('0x32')]=_0x523e1d['attributes'][_0x5be2('0x34')]?_0x523e1d[_0x5be2('0x32')]:_0x28df6[_0x5be2('0x2e')];if(_0x251a15[_0x5be2('0x30')][_0x5be2('0x3f')]){_0x523e1d['include']=[{'all':!![]}];}_0x523e1d=_[_0x5be2('0x3b')]({},_0x523e1d,_0x251a15['options']);return db[_0x5be2('0x29')][_0x5be2('0x46')](_0x523e1d)[_0x5be2('0x22')](handleEntityNotFound(_0x29092c,null))[_0x5be2('0x22')](respondWithResult(_0x29092c,null))[_0x5be2('0x43')](handleError(_0x29092c,null));};exports[_0x5be2('0x47')]=function(_0x45c9ae,_0x56378a){return db['VoiceQueuesLog'][_0x5be2('0x47')](_0x45c9ae[_0x5be2('0x48')],{})['then'](respondWithResult(_0x56378a,0xc9))[_0x5be2('0x43')](handleError(_0x56378a,null));};exports[_0x5be2('0x21')]=function(_0x3e4a48,_0x1dc4b2){if(_0x3e4a48['body']['id']){delete _0x3e4a48[_0x5be2('0x48')]['id'];}return db[_0x5be2('0x29')]['find']({'where':{'id':_0x3e4a48['params']['id']}})[_0x5be2('0x22')](handleEntityNotFound(_0x1dc4b2,null))[_0x5be2('0x22')](saveUpdates(_0x3e4a48[_0x5be2('0x48')],null))[_0x5be2('0x22')](respondWithResult(_0x1dc4b2,null))[_0x5be2('0x43')](handleError(_0x1dc4b2,null));};exports[_0x5be2('0x23')]=function(_0x7da408,_0x17193d){return db[_0x5be2('0x29')][_0x5be2('0x46')]({'where':{'id':_0x7da408['params']['id']}})[_0x5be2('0x22')](handleEntityNotFound(_0x17193d,null))[_0x5be2('0x22')](removeEntity(_0x17193d,null))['catch'](handleError(_0x17193d,null));}; \ No newline at end of file +var _0x82af=['stack','name','send','index','map','VoiceQueuesLog','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','error'];(function(_0x879b14,_0x329349){var _0x14268a=function(_0x5c2910){while(--_0x5c2910){_0x879b14['push'](_0x879b14['shift']());}};_0x14268a(++_0x329349);}(_0x82af,0x1d3));var _0xf82a=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0x82af[_0x1139d0];return _0xcc01a6;};'use strict';var emlformat=require(_0xf82a('0x0'));var rimraf=require(_0xf82a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf82a('0x2'));var rp=require(_0xf82a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf82a('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf82a('0x5'));var csv=require(_0xf82a('0x6'));var ejs=require(_0xf82a('0x7'));var fs=require('fs');var fs_extra=require(_0xf82a('0x8'));var _=require(_0xf82a('0x9'));var squel=require(_0xf82a('0xa'));var crypto=require(_0xf82a('0xb'));var jsforce=require(_0xf82a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf82a('0x6'));var querystring=require(_0xf82a('0xd'));var Papa=require(_0xf82a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf82a('0xf'));var hardwareService=require(_0xf82a('0x10'));var logger=require('../../config/logger')(_0xf82a('0x11'));var utils=require(_0xf82a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf82a('0x13'));var db=require(_0xf82a('0x14'))['db'];function respondWithStatusCode(_0x5f2fc2,_0x2f17d2){_0x2f17d2=_0x2f17d2||0xcc;return function(_0x1ad290){if(_0x1ad290){return _0x5f2fc2[_0xf82a('0x15')](_0x2f17d2);}return _0x5f2fc2['status'](_0x2f17d2)[_0xf82a('0x16')]();};}function respondWithResult(_0x19b438,_0x36d152){_0x36d152=_0x36d152||0xc8;return function(_0x15b719){if(_0x15b719){return _0x19b438[_0xf82a('0x17')](_0x36d152)['json'](_0x15b719);}};}function respondWithFilteredResult(_0x2ee0b0,_0x1f9966){return function(_0x10d301){if(_0x10d301){var _0x4e1222=typeof _0x1f9966[_0xf82a('0x18')]===_0xf82a('0x19')&&typeof _0x1f9966[_0xf82a('0x1a')]==='undefined';var _0x38de62=_0x10d301[_0xf82a('0x1b')];var _0x42bed6=_0x4e1222?0x0:_0x1f9966['offset'];var _0x11cdf1=_0x4e1222?_0x10d301[_0xf82a('0x1b')]:_0x1f9966[_0xf82a('0x18')]+_0x1f9966[_0xf82a('0x1a')];var _0x18e41c;if(_0x11cdf1>=_0x38de62){_0x11cdf1=_0x38de62;_0x18e41c=0xc8;}else{_0x18e41c=0xce;}_0x2ee0b0[_0xf82a('0x17')](_0x18e41c);return _0x2ee0b0[_0xf82a('0x1c')](_0xf82a('0x1d'),_0x42bed6+'-'+_0x11cdf1+'/'+_0x38de62)[_0xf82a('0x1e')](_0x10d301);}return null;};}function patchUpdates(_0x2520dc){return function(_0x184f90){try{jsonpatch[_0xf82a('0x1f')](_0x184f90,_0x2520dc,!![]);}catch(_0x198e86){return BPromise['reject'](_0x198e86);}return _0x184f90[_0xf82a('0x20')]();};}function saveUpdates(_0x530800,_0x3f0e88){return function(_0x11ae09){if(_0x11ae09){return _0x11ae09[_0xf82a('0x21')](_0x530800)['then'](function(_0x269c64){return _0x269c64;});}return null;};}function removeEntity(_0x18e246,_0x46db5){return function(_0x1551ec){if(_0x1551ec){return _0x1551ec[_0xf82a('0x22')]()[_0xf82a('0x23')](function(){_0x18e246[_0xf82a('0x17')](0xcc)[_0xf82a('0x16')]();});}};}function handleEntityNotFound(_0x1cd2ea,_0x5209b1){return function(_0x2af1aa){if(!_0x2af1aa){_0x1cd2ea[_0xf82a('0x15')](0x194);}return _0x2af1aa;};}function handleError(_0x40872d,_0x476395){_0x476395=_0x476395||0x1f4;return function(_0x34bf53){logger[_0xf82a('0x24')](_0x34bf53[_0xf82a('0x25')]);if(_0x34bf53[_0xf82a('0x26')]){delete _0x34bf53['name'];}_0x40872d['status'](_0x476395)[_0xf82a('0x27')](_0x34bf53);};}exports[_0xf82a('0x28')]=function(_0x28a95d,_0x5bb5be){var _0xa0b02f={},_0x8c8e1={},_0x1f9a70={'count':0x0,'rows':[]};var _0x44221c=_[_0xf82a('0x29')](db[_0xf82a('0x2a')]['rawAttributes'],function(_0x29dc74){return{'name':_0x29dc74[_0xf82a('0x2b')],'type':_0x29dc74[_0xf82a('0x2c')][_0xf82a('0x2d')]};});_0x8c8e1[_0xf82a('0x2e')]=_[_0xf82a('0x29')](_0x44221c,_0xf82a('0x26'));_0x8c8e1[_0xf82a('0x2f')]=_['keys'](_0x28a95d['query']);_0x8c8e1[_0xf82a('0x30')]=_[_0xf82a('0x31')](_0x8c8e1['model'],_0x8c8e1[_0xf82a('0x2f')]);_0xa0b02f[_0xf82a('0x32')]=_[_0xf82a('0x31')](_0x8c8e1[_0xf82a('0x2e')],qs[_0xf82a('0x33')](_0x28a95d[_0xf82a('0x2f')][_0xf82a('0x33')]));_0xa0b02f[_0xf82a('0x32')]=_0xa0b02f[_0xf82a('0x32')][_0xf82a('0x34')]?_0xa0b02f[_0xf82a('0x32')]:_0x8c8e1[_0xf82a('0x2e')];if(!_0x28a95d[_0xf82a('0x2f')][_0xf82a('0x35')](_0xf82a('0x36'))){_0xa0b02f[_0xf82a('0x1a')]=qs[_0xf82a('0x1a')](_0x28a95d[_0xf82a('0x2f')][_0xf82a('0x1a')]);_0xa0b02f[_0xf82a('0x18')]=qs[_0xf82a('0x18')](_0x28a95d[_0xf82a('0x2f')][_0xf82a('0x18')]);}_0xa0b02f['order']=qs['sort'](_0x28a95d[_0xf82a('0x2f')][_0xf82a('0x37')]);_0xa0b02f[_0xf82a('0x38')]=qs[_0xf82a('0x30')](_['pick'](_0x28a95d[_0xf82a('0x2f')],_0x8c8e1[_0xf82a('0x30')]),_0x44221c);if(_0x28a95d['query'][_0xf82a('0x39')]){_0xa0b02f[_0xf82a('0x38')]=_[_0xf82a('0x3a')](_0xa0b02f[_0xf82a('0x38')],{'$or':_[_0xf82a('0x29')](_0x44221c,function(_0x1ea771){if(_0x1ea771[_0xf82a('0x2c')]!==_0xf82a('0x3b')){var _0xeac3b1={};_0xeac3b1[_0x1ea771[_0xf82a('0x26')]]={'$like':'%'+_0x28a95d['query']['filter']+'%'};return _0xeac3b1;}})});}_0xa0b02f=_[_0xf82a('0x3a')]({},_0xa0b02f,_0x28a95d[_0xf82a('0x3c')]);var _0x8d3923={'where':_0xa0b02f[_0xf82a('0x38')]};return db[_0xf82a('0x2a')][_0xf82a('0x1b')](_0x8d3923)[_0xf82a('0x23')](function(_0x2aa145){_0x1f9a70[_0xf82a('0x1b')]=_0x2aa145;if(_0x28a95d[_0xf82a('0x2f')][_0xf82a('0x3d')]){_0xa0b02f[_0xf82a('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xf82a('0x3f')](_0xa0b02f);})[_0xf82a('0x23')](function(_0x54660c){_0x1f9a70[_0xf82a('0x40')]=_0x54660c;return _0x1f9a70;})[_0xf82a('0x23')](respondWithFilteredResult(_0x5bb5be,_0xa0b02f))[_0xf82a('0x41')](handleError(_0x5bb5be,null));};exports[_0xf82a('0x42')]=function(_0x2888f0,_0x4baec5){var _0x3eeb53={'raw':!![],'where':{'id':_0x2888f0[_0xf82a('0x43')]['id']}},_0x4a2064={};_0x4a2064[_0xf82a('0x2e')]=_['keys'](db[_0xf82a('0x2a')]['rawAttributes']);_0x4a2064[_0xf82a('0x2f')]=_[_0xf82a('0x44')](_0x2888f0['query']);_0x4a2064[_0xf82a('0x30')]=_['intersection'](_0x4a2064['model'],_0x4a2064[_0xf82a('0x2f')]);_0x3eeb53[_0xf82a('0x32')]=_[_0xf82a('0x31')](_0x4a2064[_0xf82a('0x2e')],qs[_0xf82a('0x33')](_0x2888f0[_0xf82a('0x2f')]['fields']));_0x3eeb53[_0xf82a('0x32')]=_0x3eeb53[_0xf82a('0x32')][_0xf82a('0x34')]?_0x3eeb53[_0xf82a('0x32')]:_0x4a2064[_0xf82a('0x2e')];if(_0x2888f0[_0xf82a('0x2f')][_0xf82a('0x3d')]){_0x3eeb53[_0xf82a('0x3e')]=[{'all':!![]}];}_0x3eeb53=_[_0xf82a('0x3a')]({},_0x3eeb53,_0x2888f0[_0xf82a('0x3c')]);return db[_0xf82a('0x2a')][_0xf82a('0x45')](_0x3eeb53)[_0xf82a('0x23')](handleEntityNotFound(_0x4baec5,null))[_0xf82a('0x23')](respondWithResult(_0x4baec5,null))[_0xf82a('0x41')](handleError(_0x4baec5,null));};exports['create']=function(_0x5b471b,_0x173b76){return db['VoiceQueuesLog'][_0xf82a('0x46')](_0x5b471b['body'],{})[_0xf82a('0x23')](respondWithResult(_0x173b76,0xc9))[_0xf82a('0x41')](handleError(_0x173b76,null));};exports[_0xf82a('0x21')]=function(_0x104957,_0xf72f9a){if(_0x104957[_0xf82a('0x47')]['id']){delete _0x104957[_0xf82a('0x47')]['id'];}return db[_0xf82a('0x2a')][_0xf82a('0x45')]({'where':{'id':_0x104957[_0xf82a('0x43')]['id']}})[_0xf82a('0x23')](handleEntityNotFound(_0xf72f9a,null))[_0xf82a('0x23')](saveUpdates(_0x104957[_0xf82a('0x47')],null))[_0xf82a('0x23')](respondWithResult(_0xf72f9a,null))[_0xf82a('0x41')](handleError(_0xf72f9a,null));};exports['destroy']=function(_0x11bf8d,_0x4d5553){return db[_0xf82a('0x2a')][_0xf82a('0x45')]({'where':{'id':_0x11bf8d['params']['id']}})['then'](handleEntityNotFound(_0x4d5553,null))[_0xf82a('0x23')](removeEntity(_0x4d5553,null))[_0xf82a('0x41')](handleError(_0x4d5553,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 65cb14d..cadac19 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 _0x20a2=['moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event','dtm','lodash','api'];(function(_0x168fa7,_0x3666fd){var _0xcf46e2=function(_0x4e62e1){while(--_0x4e62e1){_0x168fa7['push'](_0x168fa7['shift']());}};_0xcf46e2(++_0x3666fd);}(_0x20a2,0x102));var _0x220a=function(_0x3ed1c1,_0x45fe0a){_0x3ed1c1=_0x3ed1c1-0x0;var _0x11797d=_0x20a2[_0x3ed1c1];return _0x11797d;};'use strict';var _=require(_0x220a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x220a('0x1'));var moment=require(_0x220a('0x2'));var BPromise=require(_0x220a('0x3'));var rp=require(_0x220a('0x4'));var fs=require('fs');var path=require(_0x220a('0x5'));var rimraf=require(_0x220a('0x6'));var config=require('../../config/environment');var attributes=require(_0x220a('0x7'));module[_0x220a('0x8')]=function(_0x1ccdf4,_0x1a69f8){return _0x1ccdf4[_0x220a('0x9')](_0x220a('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x220a('0xb'),_0x220a('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x482f=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','util'];(function(_0x2bf5bd,_0x120787){var _0xc810c0=function(_0xba9dd3){while(--_0xba9dd3){_0x2bf5bd['push'](_0x2bf5bd['shift']());}};_0xc810c0(++_0x120787);}(_0x482f,0x144));var _0xf482=function(_0x265db4,_0x509dc7){_0x265db4=_0x265db4-0x0;var _0x4286dc=_0x482f[_0x265db4];return _0x4286dc;};'use strict';var _=require('lodash');var util=require(_0xf482('0x0'));var logger=require(_0xf482('0x1'))(_0xf482('0x2'));var moment=require('moment');var BPromise=require(_0xf482('0x3'));var rp=require(_0xf482('0x4'));var fs=require('fs');var path=require(_0xf482('0x5'));var rimraf=require('rimraf');var config=require(_0xf482('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0xf482('0x7')]=function(_0x51df38,_0x3d6b8a){return _0x51df38[_0xf482('0x8')](_0xf482('0x9'),attributes,{'tableName':_0xf482('0xa'),'paranoid':![],'indexes':[{'name':_0xf482('0xb'),'fields':[_0xf482('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 305aec6..0a750b0 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 _0xaf1b=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x58048b,_0x1a4a5b){var _0x33b1b4=function(_0x49946a){while(--_0x49946a){_0x58048b['push'](_0x58048b['shift']());}};_0x33b1b4(++_0x1a4a5b);}(_0xaf1b,0x182));var _0xbaf1=function(_0x1ba677,_0x5acc8b){_0x1ba677=_0x1ba677-0x0;var _0x3041be=_0xaf1b[_0x1ba677];return _0x3041be;};'use strict';var _=require(_0xbaf1('0x0'));var util=require('util');var moment=require(_0xbaf1('0x1'));var BPromise=require(_0xbaf1('0x2'));var rs=require(_0xbaf1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbaf1('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbaf1('0x5'));var client=jayson[_0xbaf1('0x6')][_0xbaf1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e4e19,_0x26a29c,_0x3a3acb){return new BPromise(function(_0x1f59b9,_0x8f5788){return client['request'](_0x5e4e19,_0x3a3acb)[_0xbaf1('0x8')](function(_0x4e8020){logger[_0xbaf1('0x9')](_0xbaf1('0xa'),_0x26a29c,_0xbaf1('0xb'));logger[_0xbaf1('0xc')](_0xbaf1('0xd'),_0x26a29c,_0xbaf1('0xb'),JSON['stringify'](_0x4e8020));if(_0x4e8020[_0xbaf1('0xe')]){if(_0x4e8020[_0xbaf1('0xe')][_0xbaf1('0xf')]===0x1f4){logger[_0xbaf1('0xe')](_0xbaf1('0xa'),_0x26a29c,_0x4e8020[_0xbaf1('0xe')][_0xbaf1('0x10')]);return _0x8f5788(_0x4e8020[_0xbaf1('0xe')][_0xbaf1('0x10')]);}logger[_0xbaf1('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x26a29c,_0x4e8020[_0xbaf1('0xe')][_0xbaf1('0x10')]);return _0x1f59b9(_0x4e8020[_0xbaf1('0xe')][_0xbaf1('0x10')]);}else{logger[_0xbaf1('0x9')]('VoiceQueuesLog,\x20%s,\x20%s',_0x26a29c,_0xbaf1('0xb'));_0x1f59b9(_0x4e8020[_0xbaf1('0x11')][_0xbaf1('0x10')]);}})[_0xbaf1('0x12')](function(_0xa5c15c){logger[_0xbaf1('0xe')](_0xbaf1('0xa'),_0x26a29c,_0xa5c15c);_0x8f5788(_0xa5c15c);});});} \ No newline at end of file +var _0xa88d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xa88d,0x12c));var _0xda88=function(_0x4ce6f9,_0x38f6fe){_0x4ce6f9=_0x4ce6f9-0x0;var _0x5503a2=_0xa88d[_0x4ce6f9];return _0x5503a2;};'use strict';var _=require(_0xda88('0x0'));var util=require(_0xda88('0x1'));var moment=require(_0xda88('0x2'));var BPromise=require(_0xda88('0x3'));var rs=require(_0xda88('0x4'));var fs=require('fs');var Redis=require(_0xda88('0x5'));var db=require(_0xda88('0x6'))['db'];var utils=require(_0xda88('0x7'));var logger=require(_0xda88('0x8'))(_0xda88('0x9'));var config=require(_0xda88('0xa'));var jayson=require(_0xda88('0xb'));var client=jayson[_0xda88('0xc')][_0xda88('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2dce01,_0x3a300a,_0x26648a){return new BPromise(function(_0x4ca150,_0x433781){return client[_0xda88('0xe')](_0x2dce01,_0x26648a)[_0xda88('0xf')](function(_0x171521){logger[_0xda88('0x10')](_0xda88('0x11'),_0x3a300a,_0xda88('0x12'));logger[_0xda88('0x13')](_0xda88('0x14'),_0x3a300a,_0xda88('0x12'),JSON[_0xda88('0x15')](_0x171521));if(_0x171521['error']){if(_0x171521[_0xda88('0x16')][_0xda88('0x17')]===0x1f4){logger[_0xda88('0x16')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3a300a,_0x171521[_0xda88('0x16')][_0xda88('0x18')]);return _0x433781(_0x171521['error']['message']);}logger[_0xda88('0x16')](_0xda88('0x11'),_0x3a300a,_0x171521['error'][_0xda88('0x18')]);return _0x4ca150(_0x171521[_0xda88('0x16')][_0xda88('0x18')]);}else{logger[_0xda88('0x10')](_0xda88('0x11'),_0x3a300a,_0xda88('0x12'));_0x4ca150(_0x171521[_0xda88('0x19')]['message']);}})[_0xda88('0x1a')](function(_0xcbeed4){logger[_0xda88('0x16')](_0xda88('0x11'),_0x3a300a,_0xcbeed4);_0x433781(_0xcbeed4);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 08d019b..a7bbcc9 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 _0x6c90=['isAuthenticated','describe','/:id','/:id/download','download','downloads','post','create','runTranscribe','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1cc8e5,_0x473844){var _0x54ef01=function(_0x4b19f0){while(--_0x4b19f0){_0x1cc8e5['push'](_0x1cc8e5['shift']());}};_0x54ef01(++_0x473844);}(_0x6c90,0xaf));var _0x06c9=function(_0x39feaa,_0xda2a9){_0x39feaa=_0x39feaa-0x0;var _0x40b438=_0x6c90[_0x39feaa];return _0x40b438;};'use strict';var multer=require('multer');var util=require(_0x06c9('0x0'));var path=require(_0x06c9('0x1'));var timeout=require(_0x06c9('0x2'));var express=require(_0x06c9('0x3'));var router=express[_0x06c9('0x4')]();var fs_extra=require(_0x06c9('0x5'));var auth=require(_0x06c9('0x6'));var interaction=require(_0x06c9('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x06c9('0x8')]('/',auth[_0x06c9('0x9')](),controller['index']);router[_0x06c9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x06c9('0xa')]);router[_0x06c9('0x8')](_0x06c9('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x06c9('0xc'),auth[_0x06c9('0x9')](),controller[_0x06c9('0xd')]);router['get']('/:id/downloads',controller[_0x06c9('0xe')]);router['get']('/:id/transcribe',auth[_0x06c9('0x9')](),controller['downloadTranscribe']);router[_0x06c9('0xf')]('/',auth[_0x06c9('0x9')](),controller[_0x06c9('0x10')]);router[_0x06c9('0xf')]('/:id/transcribe',auth[_0x06c9('0x9')](),controller[_0x06c9('0x11')]);router[_0x06c9('0x12')](_0x06c9('0xb'),auth[_0x06c9('0x9')](),controller[_0x06c9('0x13')]);router[_0x06c9('0x14')](_0x06c9('0xb'),auth[_0x06c9('0x9')](),controller[_0x06c9('0x15')]);module[_0x06c9('0x16')]=router; \ No newline at end of file +var _0xc296=['post','create','runTranscribe','update','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','/:id','show','/:id/download','download','get','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe'];(function(_0x13e5c0,_0x1fc3e6){var _0x5af9a8=function(_0x2be9b2){while(--_0x2be9b2){_0x13e5c0['push'](_0x13e5c0['shift']());}};_0x5af9a8(++_0x1fc3e6);}(_0xc296,0x10d));var _0x6c29=function(_0x49ed48,_0x4cb3ef){_0x49ed48=_0x49ed48-0x0;var _0x57a669=_0xc296[_0x49ed48];return _0x57a669;};'use strict';var multer=require(_0x6c29('0x0'));var util=require(_0x6c29('0x1'));var path=require(_0x6c29('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c29('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6c29('0x4'));var config=require(_0x6c29('0x5'));var controller=require(_0x6c29('0x6'));router['get']('/',auth[_0x6c29('0x7')](),controller[_0x6c29('0x8')]);router['get'](_0x6c29('0x9'),auth[_0x6c29('0x7')](),controller['describe']);router['get'](_0x6c29('0xa'),auth[_0x6c29('0x7')](),controller[_0x6c29('0xb')]);router['get'](_0x6c29('0xc'),auth['isAuthenticated'](),controller[_0x6c29('0xd')]);router[_0x6c29('0xe')](_0x6c29('0xf'),controller[_0x6c29('0x10')]);router[_0x6c29('0xe')](_0x6c29('0x11'),auth['isAuthenticated'](),controller[_0x6c29('0x12')]);router[_0x6c29('0x13')]('/',auth['isAuthenticated'](),controller[_0x6c29('0x14')]);router[_0x6c29('0x13')](_0x6c29('0x11'),auth['isAuthenticated'](),controller[_0x6c29('0x15')]);router['put'](_0x6c29('0xa'),auth['isAuthenticated'](),controller[_0x6c29('0x16')]);router['delete']('/:id',auth[_0x6c29('0x7')](),controller['destroy']);module[_0x6c29('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 1c73e07..87e903f 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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 73e6304..d907147 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 _0xb882=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','error','stack','name','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceRecording','includeAll','include','rows','catch','show','params','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','downloads','sequelize','MD5','token','$and','push','decryptFile','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','destroy','upload','TranscribeService','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service'];(function(_0x494f4d,_0x2807fa){var _0x3e7dfc=function(_0x14f2d2){while(--_0x14f2d2){_0x494f4d['push'](_0x494f4d['shift']());}};_0x3e7dfc(++_0x2807fa);}(_0xb882,0x114));var _0x2b88=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xb882[_0x50007c];return _0x5c1ec7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b88('0x0'));var zipdir=require(_0x2b88('0x1'));var jsonpatch=require(_0x2b88('0x2'));var rp=require(_0x2b88('0x3'));var moment=require(_0x2b88('0x4'));var BPromise=require(_0x2b88('0x5'));var Mustache=require('mustache');var util=require(_0x2b88('0x6'));var path=require('path');var sox=require(_0x2b88('0x7'));var csv=require(_0x2b88('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b88('0x9'));var squel=require(_0x2b88('0xa'));var crypto=require('crypto');var jsforce=require(_0x2b88('0xb'));var deskjs=require(_0x2b88('0xc'));var toCsv=require(_0x2b88('0x8'));var querystring=require(_0x2b88('0xd'));var Papa=require(_0x2b88('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0x2b88('0xf'));var Redis=require(_0x2b88('0x10'));var authService=require(_0x2b88('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b88('0x12'));var hardwareService=require(_0x2b88('0x13'));var logger=require(_0x2b88('0x14'))(_0x2b88('0x15'));var utils=require(_0x2b88('0x16'));var config=require(_0x2b88('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b88('0x18'))['db'];function respondWithStatusCode(_0x10559b,_0x417dde){_0x417dde=_0x417dde||0xcc;return function(_0x37e21d){if(_0x37e21d){return _0x10559b[_0x2b88('0x19')](_0x417dde);}return _0x10559b[_0x2b88('0x1a')](_0x417dde)[_0x2b88('0x1b')]();};}function respondWithResult(_0x25c0bf,_0x2f59de){_0x2f59de=_0x2f59de||0xc8;return function(_0x385895){if(_0x385895){return _0x25c0bf['status'](_0x2f59de)[_0x2b88('0x1c')](_0x385895);}};}function respondWithFilteredResult(_0x41d9f2,_0x2c34fd){return function(_0x5ca334){if(_0x5ca334){var _0x39bab9=typeof _0x2c34fd[_0x2b88('0x1d')]==='undefined'&&typeof _0x2c34fd[_0x2b88('0x1e')]===_0x2b88('0x1f');var _0x4f32a5=_0x5ca334['count'];var _0x55afa9=_0x39bab9?0x0:_0x2c34fd['offset'];var _0xda6f26=_0x39bab9?_0x5ca334[_0x2b88('0x20')]:_0x2c34fd[_0x2b88('0x1d')]+_0x2c34fd['limit'];var _0x377bfa;if(_0xda6f26>=_0x4f32a5){_0xda6f26=_0x4f32a5;_0x377bfa=0xc8;}else{_0x377bfa=0xce;}_0x41d9f2[_0x2b88('0x1a')](_0x377bfa);return _0x41d9f2[_0x2b88('0x21')](_0x2b88('0x22'),_0x55afa9+'-'+_0xda6f26+'/'+_0x4f32a5)[_0x2b88('0x1c')](_0x5ca334);}return null;};}function patchUpdates(_0x198ba7){return function(_0x237ef0){try{jsonpatch['apply'](_0x237ef0,_0x198ba7,!![]);}catch(_0x2c19df){return BPromise['reject'](_0x2c19df);}return _0x237ef0[_0x2b88('0x23')]();};}function saveUpdates(_0x4e6382,_0x5043a4){return function(_0x3dfe8d){if(_0x3dfe8d){return _0x3dfe8d[_0x2b88('0x24')](_0x4e6382)['then'](function(_0x1a111c){return _0x1a111c;});}return null;};}function removeEntity(_0x1cd6a2,_0x3d1d61){return function(_0x1f27ea){if(_0x1f27ea){return _0x1f27ea['destroy']()[_0x2b88('0x25')](function(){_0x1cd6a2[_0x2b88('0x1a')](0xcc)[_0x2b88('0x1b')]();});}};}function handleEntityNotFound(_0x173f96,_0x4faf54){return function(_0x22ebd3){if(!_0x22ebd3){_0x173f96[_0x2b88('0x19')](0x194);}return _0x22ebd3;};}function handleError(_0x257efa,_0x941598){_0x941598=_0x941598||0x1f4;return function(_0x23a807){logger[_0x2b88('0x26')](_0x23a807[_0x2b88('0x27')]);if(_0x23a807[_0x2b88('0x28')]){delete _0x23a807['name'];}_0x257efa['status'](_0x941598)['send'](_0x23a807);};}exports[_0x2b88('0x29')]=function(_0x51e570,_0x4a42e0){var _0x41f37e={},_0x1164e4={},_0x46d7f5={'count':0x0,'rows':[]};var _0x3e9b93=_[_0x2b88('0x2a')](db['VoiceRecording'][_0x2b88('0x2b')],function(_0x193d72){return{'name':_0x193d72['fieldName'],'type':_0x193d72['type']['key']};});_0x1164e4[_0x2b88('0x2c')]=_['differenceBy'](_['map'](_0x3e9b93,_0x2b88('0x28')),['format']);_0x1164e4[_0x2b88('0x2d')]=_[_0x2b88('0x2e')](_0x51e570[_0x2b88('0x2d')]);_0x1164e4[_0x2b88('0x2f')]=_[_0x2b88('0x30')](_0x1164e4[_0x2b88('0x2c')],_0x1164e4[_0x2b88('0x2d')]);_0x41f37e[_0x2b88('0x31')]=_['intersection'](_0x1164e4[_0x2b88('0x2c')],qs[_0x2b88('0x32')](_0x51e570[_0x2b88('0x2d')]['fields']));_0x41f37e['attributes']=_0x41f37e['attributes']['length']?_0x41f37e[_0x2b88('0x31')]:_0x1164e4['model'];if(!_0x51e570[_0x2b88('0x2d')][_0x2b88('0x33')](_0x2b88('0x34'))){_0x41f37e['limit']=qs[_0x2b88('0x1e')](_0x51e570[_0x2b88('0x2d')][_0x2b88('0x1e')]);_0x41f37e[_0x2b88('0x1d')]=qs[_0x2b88('0x1d')](_0x51e570[_0x2b88('0x2d')][_0x2b88('0x1d')]);}_0x41f37e[_0x2b88('0x35')]=qs['sort'](_0x51e570[_0x2b88('0x2d')][_0x2b88('0x36')]);_0x41f37e[_0x2b88('0x37')]=qs[_0x2b88('0x2f')](_[_0x2b88('0x38')](_0x51e570[_0x2b88('0x2d')],_0x1164e4[_0x2b88('0x2f')]),_0x3e9b93);if(_0x51e570[_0x2b88('0x2d')][_0x2b88('0x39')]){_0x41f37e[_0x2b88('0x37')]=_[_0x2b88('0x3a')](_0x41f37e[_0x2b88('0x37')],{'$or':_[_0x2b88('0x2a')](_0x3e9b93,function(_0x51a82b){if(_0x51a82b[_0x2b88('0x3b')]!==_0x2b88('0x3c')){var _0x27a060={};_0x27a060[_0x51a82b['name']]={'$like':'%'+_0x51e570[_0x2b88('0x2d')]['filter']+'%'};return _0x27a060;}})});}_0x41f37e=_[_0x2b88('0x3a')]({},_0x41f37e,_0x51e570['options']);var _0x42cdb4={'where':_0x41f37e['where']};return db[_0x2b88('0x3d')][_0x2b88('0x20')](_0x42cdb4)['then'](function(_0x2ad666){_0x46d7f5[_0x2b88('0x20')]=_0x2ad666;if(_0x51e570[_0x2b88('0x2d')][_0x2b88('0x3e')]){_0x41f37e[_0x2b88('0x3f')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x41f37e);})[_0x2b88('0x25')](function(_0x4a833c){_0x46d7f5[_0x2b88('0x40')]=_0x4a833c;return _0x46d7f5;})[_0x2b88('0x25')](respondWithFilteredResult(_0x4a42e0,_0x41f37e))[_0x2b88('0x41')](handleError(_0x4a42e0,null));};exports[_0x2b88('0x42')]=function(_0x363b3c,_0x689cf8){var _0x4517ca={'raw':![],'where':{'id':_0x363b3c[_0x2b88('0x43')]['id']}},_0x4d5f23={};_0x4d5f23[_0x2b88('0x2c')]=_[_0x2b88('0x2e')](db[_0x2b88('0x3d')][_0x2b88('0x2b')]);_0x4d5f23[_0x2b88('0x2d')]=_['keys'](_0x363b3c[_0x2b88('0x2d')]);_0x4d5f23[_0x2b88('0x2f')]=_[_0x2b88('0x30')](_0x4d5f23[_0x2b88('0x2c')],_0x4d5f23[_0x2b88('0x2d')]);_0x4517ca[_0x2b88('0x31')]=_[_0x2b88('0x30')](_0x4d5f23['model'],qs[_0x2b88('0x32')](_0x363b3c[_0x2b88('0x2d')]['fields']));_0x4517ca[_0x2b88('0x31')]=_0x4517ca[_0x2b88('0x31')]['length']?_0x4517ca[_0x2b88('0x31')]:_0x4d5f23['model'];if(_0x363b3c[_0x2b88('0x2d')][_0x2b88('0x3e')]){_0x4517ca[_0x2b88('0x3f')]=[{'all':!![]}];}_0x4517ca=_[_0x2b88('0x3a')]({},_0x4517ca,_0x363b3c[_0x2b88('0x44')]);return db[_0x2b88('0x3d')][_0x2b88('0x45')](_0x4517ca)['then'](handleEntityNotFound(_0x689cf8,null))[_0x2b88('0x25')](respondWithResult(_0x689cf8,null))[_0x2b88('0x41')](handleError(_0x689cf8,null));};exports[_0x2b88('0x46')]=function(_0x2d8c4c,_0x2cdd1f){return db[_0x2b88('0x3d')][_0x2b88('0x46')](_0x2d8c4c['body'],{})[_0x2b88('0x25')](respondWithResult(_0x2cdd1f,0xc9))[_0x2b88('0x41')](handleError(_0x2cdd1f,null));};exports[_0x2b88('0x24')]=function(_0xacad22,_0x3eab76){if(_0xacad22[_0x2b88('0x47')]['id']){delete _0xacad22[_0x2b88('0x47')]['id'];}return db[_0x2b88('0x3d')][_0x2b88('0x45')]({'where':{'id':_0xacad22['params']['id']}})[_0x2b88('0x25')](handleEntityNotFound(_0x3eab76,null))[_0x2b88('0x25')](saveUpdates(_0xacad22[_0x2b88('0x47')],null))[_0x2b88('0x25')](respondWithResult(_0x3eab76,null))[_0x2b88('0x41')](handleError(_0x3eab76,null));};exports[_0x2b88('0x48')]=function(_0x34770f,_0x149022){return db[_0x2b88('0x3d')]['describe']()[_0x2b88('0x25')](respondWithResult(_0x149022,null))['catch'](handleError(_0x149022,null));};exports[_0x2b88('0x49')]=function(_0x4428f1,_0x1839b3,_0x409ad5){var _0x3c31e6=require(_0x2b88('0x4a'));var _0x48ce39=![];var _0x563349={};if(_0x4428f1[_0x2b88('0x2d')][_0x2b88('0x3b')]&&_0x4428f1['query'][_0x2b88('0x3b')]===_0x2b88('0x4b')){_0x563349[_0x2b88('0x4b')]=_0x4428f1['params']['id'];}else{_0x563349['id']=_0x4428f1[_0x2b88('0x43')]['id'];}return db[_0x2b88('0x3d')]['find']({'where':_0x563349,'attributes':['id',_0x2b88('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x1839b3,null))[_0x2b88('0x25')](function(_0x5232ab){if(_0x5232ab){var _0x5ee2d3=_0x5232ab[_0x2b88('0x4c')];var _0x3c241c=util[_0x2b88('0x4d')](_0x2b88('0x4e'),_0x5ee2d3);if(fs[_0x2b88('0x4f')](_0x3c241c)){_0x48ce39=!![];return _0x3c31e6['decryptFile'](_0x3c241c,_0x5ee2d3,config[_0x2b88('0x50')][_0x2b88('0x51')])[_0x2b88('0x25')](function(){return _0x5232ab;});}return _0x5232ab;}})['then'](function(_0x4a0de0){if(_0x4a0de0){var _0x4105a1=_0x4a0de0['value'];if(!fs[_0x2b88('0x4f')](_0x4105a1)){throw new db[(_0x2b88('0x52'))][(_0x2b88('0x53'))](_0x2b88('0x54'));}if(_0x4a0de0[_0x2b88('0x55')]){return _0x1839b3[_0x2b88('0x49')](_0x4105a1,_0x4a0de0[_0x2b88('0x55')]+path[_0x2b88('0x56')](_0x4105a1),function(){if(_0x48ce39){fs['unlink'](_0x4105a1);}});}else{return _0x1839b3['download'](_0x4105a1,function(_0x30c968){if(_0x48ce39){fs[_0x2b88('0x57')](_0x4105a1);}});}}})[_0x2b88('0x41')](function(_0x8452c3){if(_0x8452c3[_0x2b88('0x58')]==='VoiceRecording\x20not\x20found'){_0x1839b3['status'](0x194)[_0x2b88('0x59')]('Not\x20found');}else{return handleError(_0x1839b3,null);}});};exports[_0x2b88('0x5a')]=function(_0x288379,_0x4e424a,_0x53429b){var _0x582c9e=require(_0x2b88('0x4a'));var _0x129c72=![];var _0x5e8f7e={'$and':[db[_0x2b88('0x5b')][_0x2b88('0x37')](db[_0x2b88('0x5b')]['fn'](_0x2b88('0x5c'),db[_0x2b88('0x5b')]['col']('uniqueid')),_0x288379[_0x2b88('0x2d')][_0x2b88('0x5d')])]};if(_0x288379[_0x2b88('0x2d')][_0x2b88('0x3b')]&&_0x288379[_0x2b88('0x2d')][_0x2b88('0x3b')]===_0x2b88('0x4b')){_0x5e8f7e[_0x2b88('0x5e')][_0x2b88('0x5f')]({'uniqueid':_0x288379[_0x2b88('0x43')]['id']});}else{_0x5e8f7e[_0x2b88('0x5e')][_0x2b88('0x5f')]({'id':_0x288379['params']['id']});}return db[_0x2b88('0x3d')][_0x2b88('0x45')]({'where':_0x5e8f7e,'attributes':['id',_0x2b88('0x4c')],'raw':!![]})[_0x2b88('0x25')](handleEntityNotFound(_0x4e424a,null))[_0x2b88('0x25')](function(_0x5ad701){if(_0x5ad701){var _0x1d8d56=util['format'](_0x2b88('0x4e'),_0x5ad701[_0x2b88('0x4c')]);if(fs[_0x2b88('0x4f')](_0x1d8d56)){_0x129c72=!![];return _0x582c9e[_0x2b88('0x60')](_0x1d8d56,_0x5ad701['value'],config['secrets'][_0x2b88('0x51')])['then'](function(){return _0x5ad701;});}return _0x5ad701;}})[_0x2b88('0x25')](function(_0x29280b){if(_0x29280b){if(!fs[_0x2b88('0x4f')](_0x29280b['value'])){throw new db[(_0x2b88('0x52'))][(_0x2b88('0x53'))](_0x2b88('0x54'));}if(_0x29280b[_0x2b88('0x55')]){return _0x4e424a[_0x2b88('0x49')](_0x29280b[_0x2b88('0x4c')],_0x29280b[_0x2b88('0x55')]+path['extname'](_0x29280b[_0x2b88('0x4c')]),function(){if(_0x129c72){fs[_0x2b88('0x57')](_0x29280b[_0x2b88('0x4c')]);}});}else{return _0x4e424a['download'](_0x29280b['value'],function(_0x50fff4){if(_0x129c72){fs[_0x2b88('0x57')](_0x29280b[_0x2b88('0x4c')]);}});}}})[_0x2b88('0x41')](handleError(_0x4e424a,null));};exports['destroy']=function(_0x25d65f,_0x227bab){return db[_0x2b88('0x3d')]['find']({'where':{'id':_0x25d65f[_0x2b88('0x43')]['id']}})[_0x2b88('0x25')](function(_0x2ffe96){if(_[_0x2b88('0x61')](_0x2ffe96)){throw new ReferenceError(_0x2b88('0x62'));}return _0x2ffe96;})[_0x2b88('0x25')](function(_0x243a22){var _0xd17d81=_0x243a22[_0x2b88('0x4c')];logger['info'](_0x2b88('0x63'),_0xd17d81);if(!_[_0x2b88('0x61')](_0x243a22[_0x2b88('0x4c')])&&fs[_0x2b88('0x4f')](_0xd17d81)){logger['info'](_0x2b88('0x64')+_0xd17d81+_0x2b88('0x65'));fs[_0x2b88('0x66')](_0xd17d81);}_0xd17d81=_0xd17d81+_0x2b88('0x67');if(!_[_0x2b88('0x61')](_0x243a22[_0x2b88('0x4c')])&&fs[_0x2b88('0x4f')](_0xd17d81)){logger[_0x2b88('0x68')](_0x2b88('0x64')+_0xd17d81+_0x2b88('0x65'));fs[_0x2b88('0x66')](_0xd17d81);}return _0x243a22;})[_0x2b88('0x25')](function(_0x2911f0){if(!_0x2911f0)throw new InternalError();return _0x2911f0[_0x2b88('0x69')]();})[_0x2b88('0x25')](function(){_0x227bab[_0x2b88('0x1a')](0xcc)[_0x2b88('0x1b')]();})[_0x2b88('0x41')](handleError(_0x227bab,null));};function getBucketslist(_0x356128,_0x140c37,_0x3f4cb0){return new Promise(function(_0x3b2298,_0x16cfa1){var _0x58e3e3=new AWS['S3']({'accessKeyId':_0x140c37,'secretAccessKey':_0x356128,'region':_0x3f4cb0});_0x58e3e3['listBuckets']({},function(_0x3416d4,_0x12f58d){if(_0x3416d4){return _0x16cfa1(_0x3416d4);}else{return _0x3b2298(_0x12f58d);}});});}function createBucket(_0x444ad8,_0x413cca,_0x5b8927,_0x8bb389){return new Promise(function(_0x37196e,_0x38493d){var _0x238594=new AWS['S3']({'accessKeyId':_0x413cca,'secretAccessKey':_0x444ad8,'region':_0x5b8927});_0x238594['createBucket']({'Bucket':_0x8bb389},function(_0x36888f,_0x34fc4c){if(_0x36888f){return _0x38493d(_0x36888f);}else{return _0x37196e(_0x34fc4c);}});});}function uploadFile(_0x39fbfa,_0x2dea5c,_0x14c522,_0x3aeb82,_0x42d9f7,_0x20932e){return new Promise(function(_0x1c0442,_0xcbcad8){var _0x32a31a=new AWS['S3']({'accessKeyId':_0x2dea5c,'secretAccessKey':_0x39fbfa,'region':_0x14c522});_0x32a31a[_0x2b88('0x6a')]({'Bucket':_0x3aeb82,'Key':_0x42d9f7,'Body':_0x20932e},function(_0x76109a,_0x4e628f){if(_0x76109a){return _0xcbcad8(_0x76109a);}else{return _0x1c0442(_0x4e628f);}});});}function startTranscribe(_0x4c3141,_0x31fe34,_0x2b3981,_0x295960,_0x5bebcf,_0x210e0c){return new Promise(function(_0x587a87,_0x2aa95d){var _0x1f8a54=new AWS[(_0x2b88('0x6b'))]({'accessKeyId':_0x31fe34,'secretAccessKey':_0x4c3141,'region':_0x2b3981});_0x1f8a54['startTranscriptionJob']({'TranscriptionJobName':_0x295960,'LanguageCode':_0x5bebcf,'Media':{'MediaFileUri':_0x210e0c}},function(_0x21c7d0,_0x35b860){if(_0x21c7d0){return _0x2aa95d(_0x21c7d0);}else{return _0x587a87(_0x35b860);}});});}function transcribe(_0x1d28d3,_0x5808bf,_0x436289,_0x226937,_0x456f34,_0x29d21c,_0x4683bc){return new Promise(function(_0x40fb78,_0x33abe1){var _0x4cfa95={};logger[_0x2b88('0x68')](util[_0x2b88('0x4d')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1d28d3,_0x456f34));return uploadFile(_0x5808bf,_0x436289,_0x226937,_0x456f34,path[_0x2b88('0x6c')](_0x29d21c),fs['readFileSync'](_0x29d21c))[_0x2b88('0x25')](function(_0x2fb259){logger[_0x2b88('0x68')](util[_0x2b88('0x4d')](_0x2b88('0x6d'),_0x1d28d3,_0x456f34,_0x2fb259['Location']));_0x4cfa95['bucket']=_0x2fb259[_0x2b88('0x6e')];_0x4cfa95['location']=_0x2fb259[_0x2b88('0x6f')];logger['info'](util['format'](_0x2b88('0x70'),_0x1d28d3));return startTranscribe(_0x5808bf,_0x436289,_0x226937,uuidv4(),_0x4683bc,_0x2fb259[_0x2b88('0x6f')]);})[_0x2b88('0x25')](function(_0x6a6146){logger[_0x2b88('0x68')](util[_0x2b88('0x4d')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1d28d3,_0x6a6146['TranscriptionJob'][_0x2b88('0x71')]));_0x4cfa95['transcribeName']=_0x6a6146['TranscriptionJob'][_0x2b88('0x71')];_0x4cfa95[_0x2b88('0x72')]=_0x6a6146[_0x2b88('0x73')][_0x2b88('0x74')];return _0x40fb78(_0x4cfa95);})[_0x2b88('0x41')](function(_0x5b0887){return _0x33abe1(_0x5b0887);});});}exports[_0x2b88('0x75')]=function(_0x4ae38f,_0xe2620d,_0x892de6){var _0x473137;var _0x937f89;var _0xbd3ece;var _0x4a3a1a=require(_0x2b88('0x4a'));return db['VoiceRecording']['findOne']({'where':{'id':_0x4ae38f[_0x2b88('0x43')]['id']}})['then'](function(_0x1ce3ba){if(_0x1ce3ba){var _0x5b6736=util['format'](_0x2b88('0x4e'),_0x1ce3ba[_0x2b88('0x4c')]);if(fs[_0x2b88('0x4f')](_0x5b6736)){cypher=!![];return _0x4a3a1a[_0x2b88('0x60')](_0x5b6736,_0x1ce3ba['value'],config[_0x2b88('0x50')][_0x2b88('0x51')])['then'](function(){return _0x1ce3ba;});}return _0x1ce3ba;}})[_0x2b88('0x25')](function(_0x2600cd){if(!_0x2600cd){throw new db[(_0x2b88('0x52'))][(_0x2b88('0x53'))](_0x2b88('0x76'));}_0x937f89=_0x2600cd;return db[_0x2b88('0x77')][_0x2b88('0x78')]({'where':{'id':0x1}});})[_0x2b88('0x25')](handleEntityNotFound(_0xe2620d,null))[_0x2b88('0x25')](function(_0x4e383b){if(_0x4e383b){_0x473137=_0x4e383b;if(!_0x473137[_0x2b88('0x79')]||!_0x473137['transcribeAccountId']||!_0x473137[_0x2b88('0x7a')]||!_0x473137[_0x2b88('0x7b')]||!_0x473137[_0x2b88('0x7c')]){throw new db[(_0x2b88('0x52'))]['ValidationError'](_0x2b88('0x7d'));}if(_0x4ae38f[_0x2b88('0x47')][_0x2b88('0x7e')]&&(!_0x473137[_0x2b88('0x7f')]||!_0x473137['sentimentAccountId']||!_0x473137[_0x2b88('0x80')]||!_0x473137[_0x2b88('0x7b')]||!_0x473137[_0x2b88('0x7c')])){throw new db['Sequelize'][(_0x2b88('0x53'))](_0x2b88('0x81'));}return db[_0x2b88('0x82')][_0x2b88('0x78')]({'where':{'id':_0x473137[_0x2b88('0x83')]}});}})['then'](function(_0x139fb2){if(!_0x139fb2){throw new db['Sequelize']['ValidationError'](_0x2b88('0x84'));}if(!_0x139fb2[_0x2b88('0x85')]||!_0x139fb2[_0x2b88('0x86')]){throw new db[(_0x2b88('0x52'))][(_0x2b88('0x53'))]('Cloud\x20Provider\x20not\x20configured');}_0xbd3ece=_0x139fb2;return getBucketslist(_0xbd3ece[_0x2b88('0x85')],_0xbd3ece['data2'],_0x473137[_0x2b88('0x7a')]);})['then'](function(_0x83aebc){if(_0x83aebc&&_0x83aebc[_0x2b88('0x87')]){var _0x307ccc=_[_0x2b88('0x45')](_0x83aebc['Buckets'],function(_0x1721e4){return _0x1721e4[_0x2b88('0x88')]===_0x473137[_0x2b88('0x7c')];});if(!_0x307ccc){logger[_0x2b88('0x68')](util[_0x2b88('0x4d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4ae38f[_0x2b88('0x43')]['id'],_0x473137[_0x2b88('0x7c')]));return createBucket(_0xbd3ece[_0x2b88('0x85')],_0xbd3ece[_0x2b88('0x86')],_0x473137[_0x2b88('0x7a')],_0x473137[_0x2b88('0x7c')]);}logger[_0x2b88('0x68')](util[_0x2b88('0x4d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4ae38f[_0x2b88('0x43')]['id'],_0x473137[_0x2b88('0x7c')]));return;}})[_0x2b88('0x25')](function(_0x950c23){if(_0x937f89[_0x2b88('0x72')]===_0x2b88('0x89')){return transcribe(_0x4ae38f[_0x2b88('0x43')]['id'],_0xbd3ece[_0x2b88('0x85')],_0xbd3ece[_0x2b88('0x86')],_0x473137[_0x2b88('0x7a')],_0x473137[_0x2b88('0x7c')],_0x937f89[_0x2b88('0x4c')],_0x473137[_0x2b88('0x7b')]);}else{logger[_0x2b88('0x68')](util[_0x2b88('0x4d')](_0x2b88('0x8a'),_0x4ae38f[_0x2b88('0x43')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x4c9284){if(_0x4c9284){_0x4c9284[_0x2b88('0x8b')]=_0x4ae38f[_0x2b88('0x47')][_0x2b88('0x7e')];return _0x937f89[_0x2b88('0x8c')](_0x4c9284);}})[_0x2b88('0x25')](respondWithResult(_0xe2620d,null))[_0x2b88('0x41')](handleError(_0xe2620d,null));};function writeFile(_0x135985,_0x108d06){return new Promise(function(_0x2de8a4,_0x1675b0){fs[_0x2b88('0x8d')](_0x108d06,_0x135985,function(_0x5a1974,_0x4bbc5c){if(_0x5a1974){return _0x1675b0(_0x5a1974);}else{return _0x2de8a4(_0x4bbc5c);}});});}exports[_0x2b88('0x8e')]=function(_0xfdf67d,_0x32e3ec,_0xddfb2c){return db['VoiceRecording'][_0x2b88('0x78')]({'where':{'id':_0xfdf67d[_0x2b88('0x43')]['id']}})[_0x2b88('0x25')](handleEntityNotFound(_0x32e3ec))[_0x2b88('0x25')](function(_0x393534){if(_0x393534&&_0x393534[_0x2b88('0x8f')]){var _0x2c7513=_0x393534[_0x2b88('0x8f')];var _0x13353f=config[_0x2b88('0x90')]+_0x2b88('0x91')+_0x393534['id']+'.txt';if(fs[_0x2b88('0x4f')](_0x13353f)){return _0x13353f;}return writeFile(_0x2c7513,_0x13353f)[_0x2b88('0x25')](function(){return _0x13353f;});}else{throw new db[(_0x2b88('0x52'))][(_0x2b88('0x53'))](_0x2b88('0x92'));}})[_0x2b88('0x25')](function(_0x4682b8){return _0x32e3ec['download'](_0x4682b8);})[_0x2b88('0x41')](handleError(_0x32e3ec));}; \ No newline at end of file +var _0xa7fb=['to-csv','lodash','crypto','jsforce','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','findAll','catch','params','rawAttributes','includeAll','include','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','send','Not\x20found','downloads','sequelize','col','token','push','ValidationError','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','basename','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x58ff19,_0x44d2a7){var _0x44d15f=function(_0x4c96a2){while(--_0x4c96a2){_0x58ff19['push'](_0x58ff19['shift']());}};_0x44d15f(++_0x44d2a7);}(_0xa7fb,0x1b6));var _0xba7f=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa7fb[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba7f('0x0'));var zipdir=require(_0xba7f('0x1'));var jsonpatch=require(_0xba7f('0x2'));var rp=require('request-promise');var moment=require(_0xba7f('0x3'));var BPromise=require(_0xba7f('0x4'));var Mustache=require(_0xba7f('0x5'));var util=require(_0xba7f('0x6'));var path=require(_0xba7f('0x7'));var sox=require(_0xba7f('0x8'));var csv=require(_0xba7f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba7f('0xa'));var squel=require('squel');var crypto=require(_0xba7f('0xb'));var jsforce=require(_0xba7f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba7f('0xd'));var AWS=require(_0xba7f('0xe'));var uuidv4=require(_0xba7f('0xf'));var Redis=require(_0xba7f('0x10'));var authService=require(_0xba7f('0x11'));var qs=require(_0xba7f('0x12'));var as=require(_0xba7f('0x13'));var hardwareService=require(_0xba7f('0x14'));var logger=require(_0xba7f('0x15'))(_0xba7f('0x16'));var utils=require('../../config/utils');var config=require(_0xba7f('0x17'));var licenseUtil=require(_0xba7f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305ae7,_0x52598a){_0x52598a=_0x52598a||0xcc;return function(_0x2c1391){if(_0x2c1391){return _0x305ae7['sendStatus'](_0x52598a);}return _0x305ae7['status'](_0x52598a)['end']();};}function respondWithResult(_0x460ced,_0x21c21a){_0x21c21a=_0x21c21a||0xc8;return function(_0x2a4b91){if(_0x2a4b91){return _0x460ced[_0xba7f('0x19')](_0x21c21a)[_0xba7f('0x1a')](_0x2a4b91);}};}function respondWithFilteredResult(_0x1fb116,_0x2a1a1a){return function(_0x1b2a02){if(_0x1b2a02){var _0x207aa4=typeof _0x2a1a1a[_0xba7f('0x1b')]===_0xba7f('0x1c')&&typeof _0x2a1a1a[_0xba7f('0x1d')]===_0xba7f('0x1c');var _0x258a43=_0x1b2a02[_0xba7f('0x1e')];var _0x3f42f7=_0x207aa4?0x0:_0x2a1a1a[_0xba7f('0x1b')];var _0x10747f=_0x207aa4?_0x1b2a02[_0xba7f('0x1e')]:_0x2a1a1a[_0xba7f('0x1b')]+_0x2a1a1a[_0xba7f('0x1d')];var _0x5b7ec7;if(_0x10747f>=_0x258a43){_0x10747f=_0x258a43;_0x5b7ec7=0xc8;}else{_0x5b7ec7=0xce;}_0x1fb116[_0xba7f('0x19')](_0x5b7ec7);return _0x1fb116[_0xba7f('0x1f')](_0xba7f('0x20'),_0x3f42f7+'-'+_0x10747f+'/'+_0x258a43)[_0xba7f('0x1a')](_0x1b2a02);}return null;};}function patchUpdates(_0x391d1f){return function(_0x5e0ed8){try{jsonpatch[_0xba7f('0x21')](_0x5e0ed8,_0x391d1f,!![]);}catch(_0x2bca2f){return BPromise[_0xba7f('0x22')](_0x2bca2f);}return _0x5e0ed8[_0xba7f('0x23')]();};}function saveUpdates(_0x38a650,_0x58c9fa){return function(_0x40205d){if(_0x40205d){return _0x40205d[_0xba7f('0x24')](_0x38a650)[_0xba7f('0x25')](function(_0x4f438a){return _0x4f438a;});}return null;};}function removeEntity(_0x53d7e2,_0x4f5077){return function(_0x482467){if(_0x482467){return _0x482467[_0xba7f('0x26')]()[_0xba7f('0x25')](function(){_0x53d7e2['status'](0xcc)[_0xba7f('0x27')]();});}};}function handleEntityNotFound(_0x113700,_0x458dc9){return function(_0x305ff5){if(!_0x305ff5){_0x113700[_0xba7f('0x28')](0x194);}return _0x305ff5;};}function handleError(_0x5d59ac,_0x586661){_0x586661=_0x586661||0x1f4;return function(_0x32715e){logger[_0xba7f('0x29')](_0x32715e[_0xba7f('0x2a')]);if(_0x32715e[_0xba7f('0x2b')]){delete _0x32715e['name'];}_0x5d59ac[_0xba7f('0x19')](_0x586661)['send'](_0x32715e);};}exports['index']=function(_0x2b8bdb,_0x307ab9){var _0x5e14fc={},_0x2a4c8c={},_0x270ce8={'count':0x0,'rows':[]};var _0x37c2b5=_[_0xba7f('0x2c')](db[_0xba7f('0x2d')]['rawAttributes'],function(_0x285584){return{'name':_0x285584[_0xba7f('0x2e')],'type':_0x285584[_0xba7f('0x2f')][_0xba7f('0x30')]};});_0x2a4c8c[_0xba7f('0x31')]=_[_0xba7f('0x32')](_[_0xba7f('0x2c')](_0x37c2b5,_0xba7f('0x2b')),[_0xba7f('0x33')]);_0x2a4c8c[_0xba7f('0x34')]=_[_0xba7f('0x35')](_0x2b8bdb[_0xba7f('0x34')]);_0x2a4c8c['filters']=_['intersection'](_0x2a4c8c[_0xba7f('0x31')],_0x2a4c8c['query']);_0x5e14fc[_0xba7f('0x36')]=_[_0xba7f('0x37')](_0x2a4c8c[_0xba7f('0x31')],qs[_0xba7f('0x38')](_0x2b8bdb[_0xba7f('0x34')][_0xba7f('0x38')]));_0x5e14fc['attributes']=_0x5e14fc[_0xba7f('0x36')][_0xba7f('0x39')]?_0x5e14fc[_0xba7f('0x36')]:_0x2a4c8c[_0xba7f('0x31')];if(!_0x2b8bdb[_0xba7f('0x34')][_0xba7f('0x3a')](_0xba7f('0x3b'))){_0x5e14fc[_0xba7f('0x1d')]=qs[_0xba7f('0x1d')](_0x2b8bdb['query'][_0xba7f('0x1d')]);_0x5e14fc[_0xba7f('0x1b')]=qs['offset'](_0x2b8bdb[_0xba7f('0x34')]['offset']);}_0x5e14fc[_0xba7f('0x3c')]=qs[_0xba7f('0x3d')](_0x2b8bdb[_0xba7f('0x34')][_0xba7f('0x3d')]);_0x5e14fc[_0xba7f('0x3e')]=qs[_0xba7f('0x3f')](_['pick'](_0x2b8bdb[_0xba7f('0x34')],_0x2a4c8c[_0xba7f('0x3f')]),_0x37c2b5);if(_0x2b8bdb[_0xba7f('0x34')][_0xba7f('0x40')]){_0x5e14fc[_0xba7f('0x3e')]=_[_0xba7f('0x41')](_0x5e14fc[_0xba7f('0x3e')],{'$or':_[_0xba7f('0x2c')](_0x37c2b5,function(_0x424fd5){if(_0x424fd5[_0xba7f('0x2f')]!==_0xba7f('0x42')){var _0x3d9933={};_0x3d9933[_0x424fd5[_0xba7f('0x2b')]]={'$like':'%'+_0x2b8bdb[_0xba7f('0x34')][_0xba7f('0x40')]+'%'};return _0x3d9933;}})});}_0x5e14fc=_[_0xba7f('0x41')]({},_0x5e14fc,_0x2b8bdb['options']);var _0x5248cb={'where':_0x5e14fc[_0xba7f('0x3e')]};return db[_0xba7f('0x2d')][_0xba7f('0x1e')](_0x5248cb)[_0xba7f('0x25')](function(_0x25e0c3){_0x270ce8[_0xba7f('0x1e')]=_0x25e0c3;if(_0x2b8bdb[_0xba7f('0x34')]['includeAll']){_0x5e14fc['include']=[{'all':!![]}];}return db['VoiceRecording'][_0xba7f('0x43')](_0x5e14fc);})[_0xba7f('0x25')](function(_0x1117c1){_0x270ce8['rows']=_0x1117c1;return _0x270ce8;})['then'](respondWithFilteredResult(_0x307ab9,_0x5e14fc))[_0xba7f('0x44')](handleError(_0x307ab9,null));};exports['show']=function(_0x3dc8b0,_0x15d638){var _0x285e9b={'raw':![],'where':{'id':_0x3dc8b0[_0xba7f('0x45')]['id']}},_0x38939e={};_0x38939e['model']=_['keys'](db[_0xba7f('0x2d')][_0xba7f('0x46')]);_0x38939e[_0xba7f('0x34')]=_[_0xba7f('0x35')](_0x3dc8b0[_0xba7f('0x34')]);_0x38939e[_0xba7f('0x3f')]=_[_0xba7f('0x37')](_0x38939e['model'],_0x38939e['query']);_0x285e9b[_0xba7f('0x36')]=_['intersection'](_0x38939e['model'],qs[_0xba7f('0x38')](_0x3dc8b0[_0xba7f('0x34')]['fields']));_0x285e9b[_0xba7f('0x36')]=_0x285e9b[_0xba7f('0x36')][_0xba7f('0x39')]?_0x285e9b[_0xba7f('0x36')]:_0x38939e['model'];if(_0x3dc8b0[_0xba7f('0x34')][_0xba7f('0x47')]){_0x285e9b[_0xba7f('0x48')]=[{'all':!![]}];}_0x285e9b=_[_0xba7f('0x41')]({},_0x285e9b,_0x3dc8b0[_0xba7f('0x49')]);return db[_0xba7f('0x2d')][_0xba7f('0x4a')](_0x285e9b)[_0xba7f('0x25')](handleEntityNotFound(_0x15d638,null))[_0xba7f('0x25')](respondWithResult(_0x15d638,null))['catch'](handleError(_0x15d638,null));};exports[_0xba7f('0x4b')]=function(_0x1574e1,_0x51baf2){return db[_0xba7f('0x2d')][_0xba7f('0x4b')](_0x1574e1[_0xba7f('0x4c')],{})[_0xba7f('0x25')](respondWithResult(_0x51baf2,0xc9))[_0xba7f('0x44')](handleError(_0x51baf2,null));};exports[_0xba7f('0x24')]=function(_0x38407a,_0x1c382a){if(_0x38407a[_0xba7f('0x4c')]['id']){delete _0x38407a[_0xba7f('0x4c')]['id'];}return db['VoiceRecording'][_0xba7f('0x4a')]({'where':{'id':_0x38407a[_0xba7f('0x45')]['id']}})[_0xba7f('0x25')](handleEntityNotFound(_0x1c382a,null))['then'](saveUpdates(_0x38407a[_0xba7f('0x4c')],null))[_0xba7f('0x25')](respondWithResult(_0x1c382a,null))[_0xba7f('0x44')](handleError(_0x1c382a,null));};exports['describe']=function(_0x2a30ef,_0x5d3154){return db[_0xba7f('0x2d')][_0xba7f('0x4d')]()[_0xba7f('0x25')](respondWithResult(_0x5d3154,null))['catch'](handleError(_0x5d3154,null));};exports[_0xba7f('0x4e')]=function(_0x16cc08,_0x40bafd,_0x5c3184){var _0x3a0795=require(_0xba7f('0x4f'));var _0x42a97e=![];var _0x37a04f={};if(_0x16cc08[_0xba7f('0x34')][_0xba7f('0x2f')]&&_0x16cc08[_0xba7f('0x34')][_0xba7f('0x2f')]===_0xba7f('0x50')){_0x37a04f['uniqueid']=_0x16cc08[_0xba7f('0x45')]['id'];}else{_0x37a04f['id']=_0x16cc08[_0xba7f('0x45')]['id'];}return db['VoiceRecording']['find']({'where':_0x37a04f,'attributes':['id',_0xba7f('0x51')],'raw':!![]})[_0xba7f('0x25')](handleEntityNotFound(_0x40bafd,null))[_0xba7f('0x25')](function(_0x514e8a){if(_0x514e8a){var _0x525172=_0x514e8a[_0xba7f('0x51')];var _0xb3c744=util[_0xba7f('0x33')](_0xba7f('0x52'),_0x525172);if(fs[_0xba7f('0x53')](_0xb3c744)){_0x42a97e=!![];return _0x3a0795[_0xba7f('0x54')](_0xb3c744,_0x525172,config[_0xba7f('0x55')][_0xba7f('0x56')])['then'](function(){return _0x514e8a;});}return _0x514e8a;}})[_0xba7f('0x25')](function(_0x559845){if(_0x559845){var _0x2a6356=_0x559845['value'];if(!fs[_0xba7f('0x53')](_0x2a6356)){throw new db[(_0xba7f('0x57'))]['ValidationError'](_0xba7f('0x58'));}if(_0x559845[_0xba7f('0x59')]){return _0x40bafd[_0xba7f('0x4e')](_0x2a6356,_0x559845[_0xba7f('0x59')]+path['extname'](_0x2a6356),function(){if(_0x42a97e){fs[_0xba7f('0x5a')](_0x2a6356);}});}else{return _0x40bafd['download'](_0x2a6356,function(_0x49366b){if(_0x42a97e){fs['unlink'](_0x2a6356);}});}}})[_0xba7f('0x44')](function(_0xd7b6cb){if(_0xd7b6cb[_0xba7f('0x5b')]===_0xba7f('0x58')){_0x40bafd['status'](0x194)[_0xba7f('0x5c')](_0xba7f('0x5d'));}else{return handleError(_0x40bafd,null);}});};exports[_0xba7f('0x5e')]=function(_0x519636,_0x2e6f7f,_0x33b990){var _0x22c3ba=require(_0xba7f('0x4f'));var _0x799e22=![];var _0x2fc014={'$and':[db['sequelize']['where'](db[_0xba7f('0x5f')]['fn']('MD5',db[_0xba7f('0x5f')][_0xba7f('0x60')](_0xba7f('0x50'))),_0x519636[_0xba7f('0x34')][_0xba7f('0x61')])]};if(_0x519636[_0xba7f('0x34')]['type']&&_0x519636[_0xba7f('0x34')][_0xba7f('0x2f')]==='uniqueid'){_0x2fc014['$and'][_0xba7f('0x62')]({'uniqueid':_0x519636[_0xba7f('0x45')]['id']});}else{_0x2fc014['$and'][_0xba7f('0x62')]({'id':_0x519636[_0xba7f('0x45')]['id']});}return db['VoiceRecording'][_0xba7f('0x4a')]({'where':_0x2fc014,'attributes':['id',_0xba7f('0x51')],'raw':!![]})[_0xba7f('0x25')](handleEntityNotFound(_0x2e6f7f,null))[_0xba7f('0x25')](function(_0x786068){if(_0x786068){var _0xe19a2a=util[_0xba7f('0x33')]('%s.cypher',_0x786068[_0xba7f('0x51')]);if(fs[_0xba7f('0x53')](_0xe19a2a)){_0x799e22=!![];return _0x22c3ba[_0xba7f('0x54')](_0xe19a2a,_0x786068[_0xba7f('0x51')],config[_0xba7f('0x55')]['recording'])[_0xba7f('0x25')](function(){return _0x786068;});}return _0x786068;}})['then'](function(_0x14e456){if(_0x14e456){if(!fs[_0xba7f('0x53')](_0x14e456[_0xba7f('0x51')])){throw new db[(_0xba7f('0x57'))][(_0xba7f('0x63'))](_0xba7f('0x58'));}if(_0x14e456[_0xba7f('0x59')]){return _0x2e6f7f[_0xba7f('0x4e')](_0x14e456['value'],_0x14e456[_0xba7f('0x59')]+path['extname'](_0x14e456['value']),function(){if(_0x799e22){fs['unlink'](_0x14e456[_0xba7f('0x51')]);}});}else{return _0x2e6f7f[_0xba7f('0x4e')](_0x14e456[_0xba7f('0x51')],function(_0x3b5fd1){if(_0x799e22){fs[_0xba7f('0x5a')](_0x14e456[_0xba7f('0x51')]);}});}}})[_0xba7f('0x44')](handleError(_0x2e6f7f,null));};exports['destroy']=function(_0x3dfec2,_0x2ee712){return db['VoiceRecording'][_0xba7f('0x4a')]({'where':{'id':_0x3dfec2[_0xba7f('0x45')]['id']}})['then'](function(_0x431c2a){if(_[_0xba7f('0x64')](_0x431c2a)){throw new ReferenceError('Entity\x20not\x20found');}return _0x431c2a;})[_0xba7f('0x25')](function(_0xc7ba52){var _0x17b7bc=_0xc7ba52['value'];logger[_0xba7f('0x65')](_0xba7f('0x66'),_0x17b7bc);if(!_[_0xba7f('0x64')](_0xc7ba52['value'])&&fs['existsSync'](_0x17b7bc)){logger[_0xba7f('0x65')](_0xba7f('0x67')+_0x17b7bc+_0xba7f('0x68'));fs[_0xba7f('0x69')](_0x17b7bc);}_0x17b7bc=_0x17b7bc+_0xba7f('0x6a');if(!_['isNil'](_0xc7ba52[_0xba7f('0x51')])&&fs[_0xba7f('0x53')](_0x17b7bc)){logger[_0xba7f('0x65')](_0xba7f('0x67')+_0x17b7bc+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xba7f('0x69')](_0x17b7bc);}return _0xc7ba52;})['then'](function(_0x15e87c){if(!_0x15e87c)throw new InternalError();return _0x15e87c[_0xba7f('0x26')]();})['then'](function(){_0x2ee712[_0xba7f('0x19')](0xcc)['end']();})[_0xba7f('0x44')](handleError(_0x2ee712,null));};function getBucketslist(_0x39022,_0x44a5e2,_0x315f0c){return new Promise(function(_0x5c951d,_0x437e4b){var _0x580959=new AWS['S3']({'accessKeyId':_0x44a5e2,'secretAccessKey':_0x39022,'region':_0x315f0c});_0x580959[_0xba7f('0x6b')]({},function(_0x4a9333,_0x1962af){if(_0x4a9333){return _0x437e4b(_0x4a9333);}else{return _0x5c951d(_0x1962af);}});});}function createBucket(_0x170e7a,_0x54ea56,_0x587f0a,_0x246d1f){return new Promise(function(_0x42b56f,_0x4d33a3){var _0x162d3b=new AWS['S3']({'accessKeyId':_0x54ea56,'secretAccessKey':_0x170e7a,'region':_0x587f0a});_0x162d3b[_0xba7f('0x6c')]({'Bucket':_0x246d1f},function(_0x56a81c,_0x9cd4f1){if(_0x56a81c){return _0x4d33a3(_0x56a81c);}else{return _0x42b56f(_0x9cd4f1);}});});}function uploadFile(_0x1cb5d0,_0x443322,_0x1fdb62,_0x23b76a,_0x16185,_0x3f0798){return new Promise(function(_0x4f97ec,_0x5174c9){var _0xc24e7=new AWS['S3']({'accessKeyId':_0x443322,'secretAccessKey':_0x1cb5d0,'region':_0x1fdb62});_0xc24e7['upload']({'Bucket':_0x23b76a,'Key':_0x16185,'Body':_0x3f0798},function(_0x4e2011,_0x269e56){if(_0x4e2011){return _0x5174c9(_0x4e2011);}else{return _0x4f97ec(_0x269e56);}});});}function startTranscribe(_0x492517,_0x4231d2,_0x532710,_0x572296,_0x52118e,_0x23a657){return new Promise(function(_0x19fc43,_0x45ea7f){var _0x565713=new AWS[(_0xba7f('0x6d'))]({'accessKeyId':_0x4231d2,'secretAccessKey':_0x492517,'region':_0x532710});_0x565713[_0xba7f('0x6e')]({'TranscriptionJobName':_0x572296,'LanguageCode':_0x52118e,'Media':{'MediaFileUri':_0x23a657}},function(_0x163015,_0x96e025){if(_0x163015){return _0x45ea7f(_0x163015);}else{return _0x19fc43(_0x96e025);}});});}function transcribe(_0x19624c,_0x190a7b,_0x3e4e72,_0x3600b7,_0x2667c7,_0x1de3e1,_0x79d5fc){return new Promise(function(_0x279f86,_0x50c6bd){var _0x168d44={};logger[_0xba7f('0x65')](util[_0xba7f('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x19624c,_0x2667c7));return uploadFile(_0x190a7b,_0x3e4e72,_0x3600b7,_0x2667c7,path[_0xba7f('0x6f')](_0x1de3e1),fs['readFileSync'](_0x1de3e1))[_0xba7f('0x25')](function(_0x455242){logger[_0xba7f('0x65')](util[_0xba7f('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x19624c,_0x2667c7,_0x455242['Location']));_0x168d44[_0xba7f('0x70')]=_0x455242[_0xba7f('0x71')];_0x168d44[_0xba7f('0x72')]=_0x455242[_0xba7f('0x73')];logger[_0xba7f('0x65')](util[_0xba7f('0x33')](_0xba7f('0x74'),_0x19624c));return startTranscribe(_0x190a7b,_0x3e4e72,_0x3600b7,uuidv4(),_0x79d5fc,_0x455242[_0xba7f('0x73')]);})[_0xba7f('0x25')](function(_0x27cee7){logger[_0xba7f('0x65')](util[_0xba7f('0x33')](_0xba7f('0x75'),_0x19624c,_0x27cee7['TranscriptionJob']['TranscriptionJobName']));_0x168d44[_0xba7f('0x76')]=_0x27cee7[_0xba7f('0x77')][_0xba7f('0x78')];_0x168d44[_0xba7f('0x79')]=_0x27cee7[_0xba7f('0x77')][_0xba7f('0x7a')];return _0x279f86(_0x168d44);})[_0xba7f('0x44')](function(_0x82540c){return _0x50c6bd(_0x82540c);});});}exports['runTranscribe']=function(_0x5268f3,_0x20eafe,_0x553360){var _0x27f0b1;var _0x184c76;var _0xea140d;var _0x185c25=require(_0xba7f('0x4f'));return db[_0xba7f('0x2d')][_0xba7f('0x7b')]({'where':{'id':_0x5268f3['params']['id']}})['then'](function(_0x59add0){if(_0x59add0){var _0x2d9104=util[_0xba7f('0x33')]('%s.cypher',_0x59add0[_0xba7f('0x51')]);if(fs[_0xba7f('0x53')](_0x2d9104)){cypher=!![];return _0x185c25[_0xba7f('0x54')](_0x2d9104,_0x59add0[_0xba7f('0x51')],config['secrets']['recording'])[_0xba7f('0x25')](function(){return _0x59add0;});}return _0x59add0;}})['then'](function(_0x440b7c){if(!_0x440b7c){throw new db[(_0xba7f('0x57'))][(_0xba7f('0x63'))](_0xba7f('0x7c'));}_0x184c76=_0x440b7c;return db[_0xba7f('0x7d')][_0xba7f('0x7b')]({'where':{'id':0x1}});})[_0xba7f('0x25')](handleEntityNotFound(_0x20eafe,null))[_0xba7f('0x25')](function(_0x46499f){if(_0x46499f){_0x27f0b1=_0x46499f;if(!_0x27f0b1[_0xba7f('0x7e')]||!_0x27f0b1[_0xba7f('0x7f')]||!_0x27f0b1[_0xba7f('0x80')]||!_0x27f0b1[_0xba7f('0x81')]||!_0x27f0b1[_0xba7f('0x70')]){throw new db['Sequelize'][(_0xba7f('0x63'))](_0xba7f('0x82'));}if(_0x5268f3[_0xba7f('0x4c')][_0xba7f('0x83')]&&(!_0x27f0b1[_0xba7f('0x84')]||!_0x27f0b1['sentimentAccountId']||!_0x27f0b1[_0xba7f('0x85')]||!_0x27f0b1[_0xba7f('0x81')]||!_0x27f0b1[_0xba7f('0x70')])){throw new db[(_0xba7f('0x57'))][(_0xba7f('0x63'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xba7f('0x86')][_0xba7f('0x7b')]({'where':{'id':_0x27f0b1['transcribeAccountId']}});}})[_0xba7f('0x25')](function(_0x3ed61b){if(!_0x3ed61b){throw new db[(_0xba7f('0x57'))]['ValidationError'](_0xba7f('0x87'));}if(!_0x3ed61b['data1']||!_0x3ed61b['data2']){throw new db[(_0xba7f('0x57'))][(_0xba7f('0x63'))](_0xba7f('0x88'));}_0xea140d=_0x3ed61b;return getBucketslist(_0xea140d[_0xba7f('0x89')],_0xea140d[_0xba7f('0x8a')],_0x27f0b1['transcribeRegion']);})[_0xba7f('0x25')](function(_0x19a3d1){if(_0x19a3d1&&_0x19a3d1[_0xba7f('0x8b')]){var _0x1433de=_[_0xba7f('0x4a')](_0x19a3d1[_0xba7f('0x8b')],function(_0x3a20cc){return _0x3a20cc[_0xba7f('0x8c')]===_0x27f0b1[_0xba7f('0x70')];});if(!_0x1433de){logger[_0xba7f('0x65')](util[_0xba7f('0x33')](_0xba7f('0x8d'),_0x5268f3[_0xba7f('0x45')]['id'],_0x27f0b1[_0xba7f('0x70')]));return createBucket(_0xea140d[_0xba7f('0x89')],_0xea140d[_0xba7f('0x8a')],_0x27f0b1['transcribeRegion'],_0x27f0b1[_0xba7f('0x70')]);}logger[_0xba7f('0x65')](util[_0xba7f('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x5268f3[_0xba7f('0x45')]['id'],_0x27f0b1[_0xba7f('0x70')]));return;}})[_0xba7f('0x25')](function(_0x5281f9){if(_0x184c76[_0xba7f('0x79')]===_0xba7f('0x8e')){return transcribe(_0x5268f3['params']['id'],_0xea140d[_0xba7f('0x89')],_0xea140d[_0xba7f('0x8a')],_0x27f0b1[_0xba7f('0x80')],_0x27f0b1['bucket'],_0x184c76[_0xba7f('0x51')],_0x27f0b1['language']);}else{logger['info'](util[_0xba7f('0x33')](_0xba7f('0x8f'),_0x5268f3[_0xba7f('0x45')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xba7f('0x25')](function(_0x8ab51e){if(_0x8ab51e){_0x8ab51e[_0xba7f('0x90')]=_0x5268f3['body'][_0xba7f('0x83')];return _0x184c76[_0xba7f('0x91')](_0x8ab51e);}})[_0xba7f('0x25')](respondWithResult(_0x20eafe,null))[_0xba7f('0x44')](handleError(_0x20eafe,null));};function writeFile(_0x52e478,_0x351fec){return new Promise(function(_0x3b96dc,_0x2b2606){fs['writeFile'](_0x351fec,_0x52e478,function(_0x1f8370,_0x1280f9){if(_0x1f8370){return _0x2b2606(_0x1f8370);}else{return _0x3b96dc(_0x1280f9);}});});}exports['downloadTranscribe']=function(_0x20f809,_0x3a0ada,_0x5c09ef){return db['VoiceRecording'][_0xba7f('0x7b')]({'where':{'id':_0x20f809[_0xba7f('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a0ada))['then'](function(_0x2c2af9){if(_0x2c2af9&&_0x2c2af9['fileText']){var _0x4a5f03=_0x2c2af9['fileText'];var _0x49a964=config[_0xba7f('0x92')]+_0xba7f('0x93')+_0x2c2af9['id']+'.txt';if(fs[_0xba7f('0x53')](_0x49a964)){return _0x49a964;}return writeFile(_0x4a5f03,_0x49a964)[_0xba7f('0x25')](function(){return _0x49a964;});}else{throw new db[(_0xba7f('0x57'))][(_0xba7f('0x63'))](_0xba7f('0x94'));}})['then'](function(_0x44f8db){return _0x3a0ada['download'](_0x44f8db);})[_0xba7f('0x44')](handleError(_0x3a0ada));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 3cd31cc..d08f65f 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 _0xb4e6=['uniqueid','transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','voice_recordings'];(function(_0x30469d,_0x1b551c){var _0x56de06=function(_0x4a6e3d){while(--_0x4a6e3d){_0x30469d['push'](_0x30469d['shift']());}};_0x56de06(++_0x1b551c);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0xb4e6[_0x15942a];return _0x36a9fb;};'use strict';var attributes=require(_0x6b4e('0x0'));module['exports']=function(_0x2708ca,_0x1afd20){return _0x2708ca[_0x6b4e('0x1')](_0x6b4e('0x2'),attributes,{'tableName':_0x6b4e('0x3'),'paranoid':![],'indexes':[{'name':_0x6b4e('0x4'),'fields':[_0x6b4e('0x4')]},{'name':'transcribeStatus','fields':[_0x6b4e('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ff3=['transcribeStatus','exports','VoiceRecording','voice_recordings','uniqueid'];(function(_0x2111d8,_0x195186){var _0x1a7c67=function(_0x482d5){while(--_0x482d5){_0x2111d8['push'](_0x2111d8['shift']());}};_0x1a7c67(++_0x195186);}(_0x5ff3,0x17d));var _0x35ff=function(_0x135fc8,_0x458a9a){_0x135fc8=_0x135fc8-0x0;var _0x335fd8=_0x5ff3[_0x135fc8];return _0x335fd8;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x35ff('0x0')]=function(_0x48cbf7,_0x1763a){return _0x48cbf7['define'](_0x35ff('0x1'),attributes,{'tableName':_0x35ff('0x2'),'paranoid':![],'indexes':[{'name':_0x35ff('0x3'),'fields':[_0x35ff('0x3')]},{'name':'transcribeStatus','fields':[_0x35ff('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 8bb8687..d0f951d 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 _0x1a37=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateVoiceRecording','update','body','options','raw','where','attributes','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted'];(function(_0x155fd0,_0x4cad51){var _0x47c6b6=function(_0x2697d5){while(--_0x2697d5){_0x155fd0['push'](_0x155fd0['shift']());}};_0x47c6b6(++_0x4cad51);}(_0x1a37,0xb4));var _0x71a3=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x1a37[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45050a,_0x231ea7,_0x2bb6a2){return new BPromise(function(_0x4a9ab2,_0x53b893){return client['request'](_0x45050a,_0x2bb6a2)['then'](function(_0x89da86){logger[_0x71a3('0xc')](_0x71a3('0xd'),_0x231ea7,_0x71a3('0xe'));logger[_0x71a3('0xf')](_0x71a3('0x10'),_0x231ea7,_0x71a3('0xe'),JSON[_0x71a3('0x11')](_0x89da86));if(_0x89da86['error']){if(_0x89da86['error']['code']===0x1f4){logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);return _0x53b893(_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);}logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0x89da86[_0x71a3('0x12')][_0x71a3('0x13')]);return _0x4a9ab2(_0x89da86[_0x71a3('0x12')]['message']);}else{logger[_0x71a3('0xc')](_0x71a3('0xd'),_0x231ea7,'request\x20sent');_0x4a9ab2(_0x89da86['result'][_0x71a3('0x13')]);}})[_0x71a3('0x14')](function(_0xee797f){logger[_0x71a3('0x12')](_0x71a3('0xd'),_0x231ea7,_0xee797f);_0x53b893(_0xee797f);});});}exports[_0x71a3('0x15')]=function(_0x5d4dee){var _0x656cd2=this;return new Promise(function(_0x27bfb4,_0x5b955a){return db['VoiceRecording'][_0x71a3('0x16')](_0x5d4dee[_0x71a3('0x17')],{'raw':_0x5d4dee[_0x71a3('0x18')]?_0x5d4dee[_0x71a3('0x18')][_0x71a3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d4dee['options']?_0x5d4dee[_0x71a3('0x18')][_0x71a3('0x1a')]||null:null,'attributes':_0x5d4dee[_0x71a3('0x18')]?_0x5d4dee[_0x71a3('0x18')][_0x71a3('0x1b')]||null:null,'limit':_0x5d4dee['options']?_0x5d4dee[_0x71a3('0x18')]['limit']||null:null})[_0x71a3('0x1c')](function(_0x35d1d4){logger[_0x71a3('0xc')](_0x71a3('0x15'),_0x5d4dee);logger[_0x71a3('0xf')](_0x71a3('0x15'),_0x5d4dee,JSON['stringify'](_0x35d1d4));_0x27bfb4(_0x35d1d4);})[_0x71a3('0x14')](function(_0x299d1d){logger[_0x71a3('0x12')](_0x71a3('0x15'),_0x299d1d[_0x71a3('0x13')],_0x5d4dee);_0x5b955a(_0x656cd2['error'](0x1f4,_0x299d1d[_0x71a3('0x13')]));});});};exports[_0x71a3('0x1d')]=function(_0x4c1a3d){var _0x412746=this;return new Promise(function(_0x515519,_0x46f1ff){var _0x2fd3b6=require(_0x71a3('0x1e'));var _0x35b5c7;return db[_0x71a3('0x1f')][_0x71a3('0x20')]({'attributes':['id',_0x71a3('0x21')],'where':{'id':0x1},'raw':!![]})[_0x71a3('0x1c')](function(_0x305eb1){_0x35b5c7=_0x305eb1;return db[_0x71a3('0x22')][_0x71a3('0x23')](_0x4c1a3d[_0x71a3('0x17')]);})['then'](function(_0x26fd9f){if(_0x35b5c7[_0x71a3('0x21')]&&fs[_0x71a3('0x24')](_0x26fd9f[_0x71a3('0x25')])){var _0x4a750c=util[_0x71a3('0x26')](_0x71a3('0x27'),_0x26fd9f[_0x71a3('0x25')]);return _0x2fd3b6[_0x71a3('0x28')](_0x26fd9f[_0x71a3('0x25')],_0x4a750c,config[_0x71a3('0x29')][_0x71a3('0x2a')])['then'](function(){fs[_0x71a3('0x2b')](_0x26fd9f[_0x71a3('0x25')]);logger[_0x71a3('0xc')](_0x71a3('0x2c'));return _0x26fd9f;});}return _0x26fd9f;})[_0x71a3('0x1c')](function(_0x73c8e7){logger[_0x71a3('0xc')](_0x71a3('0x1d'),_0x4c1a3d);logger[_0x71a3('0xf')](_0x71a3('0x1d'),_0x4c1a3d,JSON[_0x71a3('0x11')](_0x73c8e7));_0x515519(_0x73c8e7);})[_0x71a3('0x14')](function(_0x447b14){logger['error']('CreateVoiceRecording',_0x447b14[_0x71a3('0x13')],_0x4c1a3d);_0x46f1ff(_0x412746[_0x71a3('0x12')](0x1f4,_0x447b14['message']));});});}; \ No newline at end of file +var _0xe5af=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','raw','options','where','limit','debug','../../components/encryptor','Setting','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0xe5af,0x9c));var _0xfe5a=function(_0x528ac2,_0x49467f){_0x528ac2=_0x528ac2-0x0;var _0x1d91f4=_0xe5af[_0x528ac2];return _0x1d91f4;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eea2e,_0x356c69,_0x106492){return new BPromise(function(_0xfb4357,_0x3e683c){return client['request'](_0x5eea2e,_0x106492)[_0xfe5a('0x8')](function(_0x5a48ff){logger['info'](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));logger['debug'](_0xfe5a('0xb'),_0x356c69,_0xfe5a('0xa'),JSON[_0xfe5a('0xc')](_0x5a48ff));if(_0x5a48ff[_0xfe5a('0xd')]){if(_0x5a48ff[_0xfe5a('0xd')]['code']===0x1f4){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0x3e683c(_0x5a48ff[_0xfe5a('0xd')]['message']);}logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0xfb4357(_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));_0xfb4357(_0x5a48ff[_0xfe5a('0x10')][_0xfe5a('0xe')]);}})[_0xfe5a('0x11')](function(_0x22afa7){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x22afa7);_0x3e683c(_0x22afa7);});});}exports[_0xfe5a('0x12')]=function(_0x5bf597){var _0x20620b=this;return new Promise(function(_0x456707,_0x54d5fb){return db[_0xfe5a('0x13')][_0xfe5a('0x14')](_0x5bf597[_0xfe5a('0x15')],{'raw':_0x5bf597['options']?_0x5bf597['options'][_0xfe5a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bf597[_0xfe5a('0x17')]?_0x5bf597[_0xfe5a('0x17')][_0xfe5a('0x18')]||null:null,'attributes':_0x5bf597[_0xfe5a('0x17')]?_0x5bf597[_0xfe5a('0x17')]['attributes']||null:null,'limit':_0x5bf597[_0xfe5a('0x17')]?_0x5bf597['options'][_0xfe5a('0x19')]||null:null})[_0xfe5a('0x8')](function(_0x1fbde5){logger['info']('UpdateVoiceRecording',_0x5bf597);logger[_0xfe5a('0x1a')](_0xfe5a('0x12'),_0x5bf597,JSON['stringify'](_0x1fbde5));_0x456707(_0x1fbde5);})[_0xfe5a('0x11')](function(_0x26f744){logger['error'](_0xfe5a('0x12'),_0x26f744[_0xfe5a('0xe')],_0x5bf597);_0x54d5fb(_0x20620b[_0xfe5a('0xd')](0x1f4,_0x26f744[_0xfe5a('0xe')]));});});};exports['CreateVoiceRecording']=function(_0x42136e){var _0x2f5d04=this;return new Promise(function(_0x24481f,_0x1cd531){var _0x36bf20=require(_0xfe5a('0x1b'));var _0xdbf1e0;return db[_0xfe5a('0x1c')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xfe5a('0x8')](function(_0x485f9d){_0xdbf1e0=_0x485f9d;return db[_0xfe5a('0x13')][_0xfe5a('0x1d')](_0x42136e[_0xfe5a('0x15')]);})['then'](function(_0x48a061){if(_0xdbf1e0['callRecordingEncryption']&&fs[_0xfe5a('0x1e')](_0x48a061['value'])){var _0x51d1f4=util['format'](_0xfe5a('0x1f'),_0x48a061[_0xfe5a('0x20')]);return _0x36bf20[_0xfe5a('0x21')](_0x48a061[_0xfe5a('0x20')],_0x51d1f4,config[_0xfe5a('0x22')][_0xfe5a('0x23')])[_0xfe5a('0x8')](function(){fs[_0xfe5a('0x24')](_0x48a061[_0xfe5a('0x20')]);logger[_0xfe5a('0xf')](_0xfe5a('0x25'));return _0x48a061;});}return _0x48a061;})['then'](function(_0x1f0c86){logger[_0xfe5a('0xf')]('CreateVoiceRecording',_0x42136e);logger[_0xfe5a('0x1a')](_0xfe5a('0x26'),_0x42136e,JSON[_0xfe5a('0xc')](_0x1f0c86));_0x24481f(_0x1f0c86);})[_0xfe5a('0x11')](function(_0xe5a992){logger['error']('CreateVoiceRecording',_0xe5a992[_0xfe5a('0xe')],_0x42136e);_0x1cd531(_0x2f5d04['error'](0x1f4,_0xe5a992[_0xfe5a('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 2a5a30c..6d066d1 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 _0xa5f3=['multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','describe','/:id','create','put','update','delete','destroy','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa5f3,0x98));var _0x3a5f=function(_0x194e93,_0x4fb8b9){_0x194e93=_0x194e93-0x0;var _0x1b885b=_0xa5f3[_0x194e93];return _0x1b885b;};'use strict';var multer=require(_0x3a5f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3a5f('0x1'));var express=require('express');var router=express[_0x3a5f('0x2')]();var fs_extra=require(_0x3a5f('0x3'));var auth=require(_0x3a5f('0x4'));var interaction=require(_0x3a5f('0x5'));var config=require(_0x3a5f('0x6'));var controller=require(_0x3a5f('0x7'));router['get']('/',auth[_0x3a5f('0x8')](),controller[_0x3a5f('0x9')]);router[_0x3a5f('0xa')]('/describe',auth[_0x3a5f('0x8')](),controller[_0x3a5f('0xb')]);router[_0x3a5f('0xa')](_0x3a5f('0xc'),auth[_0x3a5f('0x8')](),controller['show']);router['post']('/',auth[_0x3a5f('0x8')](),controller[_0x3a5f('0xd')]);router[_0x3a5f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3a5f('0xf')]);router[_0x3a5f('0x10')](_0x3a5f('0xc'),auth[_0x3a5f('0x8')](),controller[_0x3a5f('0x11')]);module[_0x3a5f('0x12')]=router; \ No newline at end of file +var _0x3aeb=['get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3aeb,0x182));var _0xb3ae=function(_0x120f67,_0x3728e5){_0x120f67=_0x120f67-0x0;var _0x24c26b=_0x3aeb[_0x120f67];return _0x24c26b;};'use strict';var multer=require(_0xb3ae('0x0'));var util=require(_0xb3ae('0x1'));var path=require(_0xb3ae('0x2'));var timeout=require(_0xb3ae('0x3'));var express=require(_0xb3ae('0x4'));var router=express['Router']();var fs_extra=require(_0xb3ae('0x5'));var auth=require(_0xb3ae('0x6'));var interaction=require(_0xb3ae('0x7'));var config=require(_0xb3ae('0x8'));var controller=require(_0xb3ae('0x9'));router[_0xb3ae('0xa')]('/',auth[_0xb3ae('0xb')](),controller[_0xb3ae('0xc')]);router[_0xb3ae('0xa')](_0xb3ae('0xd'),auth[_0xb3ae('0xb')](),controller['describe']);router[_0xb3ae('0xa')](_0xb3ae('0xe'),auth[_0xb3ae('0xb')](),controller[_0xb3ae('0xf')]);router[_0xb3ae('0x10')]('/',auth['isAuthenticated'](),controller[_0xb3ae('0x11')]);router[_0xb3ae('0x12')]('/:id',auth[_0xb3ae('0xb')](),controller[_0xb3ae('0x13')]);router['delete']('/:id',auth[_0xb3ae('0xb')](),controller[_0xb3ae('0x14')]);module[_0xb3ae('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 382db6b..299a589 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 _0x4431=['STRING','Yes','sequelize','exports','ENUM','blind','attended'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4431,0x1b4));var _0x1443=function(_0x1c2979,_0x6a2d76){_0x1c2979=_0x1c2979-0x0;var _0x3e6cb1=_0x4431[_0x1c2979];return _0x3e6cb1;};'use strict';var Sequelize=require(_0x1443('0x0'));var moment=require('moment');module[_0x1443('0x1')]={'type':{'type':Sequelize[_0x1443('0x2')](_0x1443('0x3'),_0x1443('0x4'))},'result':{'type':Sequelize[_0x1443('0x5')]},'transfererchannel':{'type':Sequelize[_0x1443('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x1443('0x5')]},'transferercalleridname':{'type':Sequelize[_0x1443('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1443('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x1443('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x1443('0x5')]},'transfererexten':{'type':Sequelize[_0x1443('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x1443('0x5')]},'transfereechannel':{'type':Sequelize[_0x1443('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x1443('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x1443('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1443('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1443('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x1443('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1443('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x1443('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x1443('0x6'),'No')},'context':{'type':Sequelize[_0x1443('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd495=['attended','STRING','Yes','sequelize','moment','ENUM'];(function(_0x4a6e87,_0x5cb305){var _0x5cbe52=function(_0x3ee6c0){while(--_0x3ee6c0){_0x4a6e87['push'](_0x4a6e87['shift']());}};_0x5cbe52(++_0x5cb305);}(_0xd495,0xe1));var _0x5d49=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0xd495[_0x49beea];return _0x27693a;};'use strict';var Sequelize=require(_0x5d49('0x0'));var moment=require(_0x5d49('0x1'));module['exports']={'type':{'type':Sequelize[_0x5d49('0x2')]('blind',_0x5d49('0x3'))},'result':{'type':Sequelize[_0x5d49('0x4')]},'transfererchannel':{'type':Sequelize[_0x5d49('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x5d49('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5d49('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x5d49('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x5d49('0x4')]},'transferercontext':{'type':Sequelize[_0x5d49('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x5d49('0x4')]},'transfereechannel':{'type':Sequelize[_0x5d49('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x5d49('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5d49('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x5d49('0x4')]},'transfereecontext':{'type':Sequelize[_0x5d49('0x4')]},'transfereeexten':{'type':Sequelize[_0x5d49('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x5d49('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x5d49('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5d49('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index d4a5d5a..e72d61c 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 _0x012b=['keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','map','VoiceTransferReport','rawAttributes','fieldName','model','query'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0x012b,0x187));var _0xb012=function(_0x674145,_0x36a97d){_0x674145=_0x674145-0x0;var _0x1e3b4c=_0x012b[_0x674145];return _0x1e3b4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb012('0x0'));var zipdir=require(_0xb012('0x1'));var jsonpatch=require(_0xb012('0x2'));var rp=require(_0xb012('0x3'));var moment=require(_0xb012('0x4'));var BPromise=require(_0xb012('0x5'));var Mustache=require(_0xb012('0x6'));var util=require(_0xb012('0x7'));var path=require(_0xb012('0x8'));var sox=require(_0xb012('0x9'));var csv=require(_0xb012('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb012('0xb'));var crypto=require(_0xb012('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb012('0xa'));var querystring=require(_0xb012('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb012('0xe'));var qs=require(_0xb012('0xf'));var as=require(_0xb012('0x10'));var hardwareService=require(_0xb012('0x11'));var logger=require(_0xb012('0x12'))(_0xb012('0x13'));var utils=require(_0xb012('0x14'));var config=require(_0xb012('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c34ac,_0x290012){_0x290012=_0x290012||0xcc;return function(_0x5ca5c4){if(_0x5ca5c4){return _0x1c34ac[_0xb012('0x16')](_0x290012);}return _0x1c34ac[_0xb012('0x17')](_0x290012)[_0xb012('0x18')]();};}function respondWithResult(_0x167da8,_0x4fd77e){_0x4fd77e=_0x4fd77e||0xc8;return function(_0x453d38){if(_0x453d38){return _0x167da8['status'](_0x4fd77e)[_0xb012('0x19')](_0x453d38);}};}function respondWithFilteredResult(_0x403d81,_0x749be9){return function(_0x410eb2){if(_0x410eb2){var _0x2cdba2=typeof _0x749be9[_0xb012('0x1a')]===_0xb012('0x1b')&&typeof _0x749be9[_0xb012('0x1c')]===_0xb012('0x1b');var _0x1d6241=_0x410eb2[_0xb012('0x1d')];var _0x5c42eb=_0x2cdba2?0x0:_0x749be9['offset'];var _0x1dd902=_0x2cdba2?_0x410eb2[_0xb012('0x1d')]:_0x749be9[_0xb012('0x1a')]+_0x749be9[_0xb012('0x1c')];var _0x25e48c;if(_0x1dd902>=_0x1d6241){_0x1dd902=_0x1d6241;_0x25e48c=0xc8;}else{_0x25e48c=0xce;}_0x403d81[_0xb012('0x17')](_0x25e48c);return _0x403d81[_0xb012('0x1e')](_0xb012('0x1f'),_0x5c42eb+'-'+_0x1dd902+'/'+_0x1d6241)[_0xb012('0x19')](_0x410eb2);}return null;};}function patchUpdates(_0x531090){return function(_0x472c31){try{jsonpatch[_0xb012('0x20')](_0x472c31,_0x531090,!![]);}catch(_0x573872){return BPromise[_0xb012('0x21')](_0x573872);}return _0x472c31[_0xb012('0x22')]();};}function saveUpdates(_0x454564,_0x5b5952){return function(_0x51bd2f){if(_0x51bd2f){return _0x51bd2f[_0xb012('0x23')](_0x454564)['then'](function(_0x23e835){return _0x23e835;});}return null;};}function removeEntity(_0x368dbb,_0x5d61af){return function(_0x41fe2a){if(_0x41fe2a){return _0x41fe2a[_0xb012('0x24')]()[_0xb012('0x25')](function(){_0x368dbb['status'](0xcc)[_0xb012('0x18')]();});}};}function handleEntityNotFound(_0xe32527,_0x148002){return function(_0x308918){if(!_0x308918){_0xe32527[_0xb012('0x16')](0x194);}return _0x308918;};}function handleError(_0x394398,_0x16e061){_0x16e061=_0x16e061||0x1f4;return function(_0x58f0ee){logger[_0xb012('0x26')](_0x58f0ee[_0xb012('0x27')]);if(_0x58f0ee[_0xb012('0x28')]){delete _0x58f0ee[_0xb012('0x28')];}_0x394398[_0xb012('0x17')](_0x16e061)['send'](_0x58f0ee);};}exports['index']=function(_0x1f6103,_0x4ba91b){var _0x1cae5f={},_0x1bf79e={},_0x29d7d7={'count':0x0,'rows':[]};var _0x734347=_[_0xb012('0x29')](db[_0xb012('0x2a')][_0xb012('0x2b')],function(_0x3ab507){return{'name':_0x3ab507[_0xb012('0x2c')],'type':_0x3ab507['type']['key']};});_0x1bf79e[_0xb012('0x2d')]=_['map'](_0x734347,'name');_0x1bf79e[_0xb012('0x2e')]=_[_0xb012('0x2f')](_0x1f6103[_0xb012('0x2e')]);_0x1bf79e['filters']=_['intersection'](_0x1bf79e[_0xb012('0x2d')],_0x1bf79e['query']);_0x1cae5f[_0xb012('0x30')]=_['intersection'](_0x1bf79e[_0xb012('0x2d')],qs[_0xb012('0x31')](_0x1f6103[_0xb012('0x2e')]['fields']));_0x1cae5f[_0xb012('0x30')]=_0x1cae5f[_0xb012('0x30')][_0xb012('0x32')]?_0x1cae5f['attributes']:_0x1bf79e[_0xb012('0x2d')];if(!_0x1f6103[_0xb012('0x2e')][_0xb012('0x33')](_0xb012('0x34'))){_0x1cae5f[_0xb012('0x1c')]=qs[_0xb012('0x1c')](_0x1f6103[_0xb012('0x2e')]['limit']);_0x1cae5f[_0xb012('0x1a')]=qs[_0xb012('0x1a')](_0x1f6103[_0xb012('0x2e')][_0xb012('0x1a')]);}_0x1cae5f[_0xb012('0x35')]=qs['sort'](_0x1f6103[_0xb012('0x2e')][_0xb012('0x36')]);_0x1cae5f[_0xb012('0x37')]=qs[_0xb012('0x38')](_['pick'](_0x1f6103['query'],_0x1bf79e['filters']),_0x734347);if(_0x1f6103[_0xb012('0x2e')][_0xb012('0x39')]){_0x1cae5f['where']=_[_0xb012('0x3a')](_0x1cae5f[_0xb012('0x37')],{'$or':_[_0xb012('0x29')](_0x734347,function(_0x17f511){if(_0x17f511[_0xb012('0x3b')]!=='VIRTUAL'){var _0x5df8f7={};_0x5df8f7[_0x17f511[_0xb012('0x28')]]={'$like':'%'+_0x1f6103['query'][_0xb012('0x39')]+'%'};return _0x5df8f7;}})});}_0x1cae5f=_[_0xb012('0x3a')]({},_0x1cae5f,_0x1f6103[_0xb012('0x3c')]);var _0x363d74={'where':_0x1cae5f[_0xb012('0x37')]};return db[_0xb012('0x2a')][_0xb012('0x1d')](_0x363d74)[_0xb012('0x25')](function(_0x5d1a7a){_0x29d7d7['count']=_0x5d1a7a;if(_0x1f6103['query'][_0xb012('0x3d')]){_0x1cae5f['include']=[{'all':!![]}];}return db[_0xb012('0x2a')][_0xb012('0x3e')](_0x1cae5f);})[_0xb012('0x25')](function(_0x5a1704){_0x29d7d7[_0xb012('0x3f')]=_0x5a1704;return _0x29d7d7;})['then'](respondWithFilteredResult(_0x4ba91b,_0x1cae5f))[_0xb012('0x40')](handleError(_0x4ba91b,null));};exports[_0xb012('0x41')]=function(_0x74d6b3,_0x26f424){var _0x394796={'raw':!![],'where':{'id':_0x74d6b3[_0xb012('0x42')]['id']}},_0x169b12={};_0x169b12[_0xb012('0x2d')]=_[_0xb012('0x2f')](db[_0xb012('0x2a')][_0xb012('0x2b')]);_0x169b12[_0xb012('0x2e')]=_[_0xb012('0x2f')](_0x74d6b3[_0xb012('0x2e')]);_0x169b12['filters']=_['intersection'](_0x169b12[_0xb012('0x2d')],_0x169b12[_0xb012('0x2e')]);_0x394796[_0xb012('0x30')]=_[_0xb012('0x43')](_0x169b12[_0xb012('0x2d')],qs[_0xb012('0x31')](_0x74d6b3[_0xb012('0x2e')][_0xb012('0x31')]));_0x394796['attributes']=_0x394796[_0xb012('0x30')][_0xb012('0x32')]?_0x394796[_0xb012('0x30')]:_0x169b12['model'];if(_0x74d6b3[_0xb012('0x2e')][_0xb012('0x3d')]){_0x394796[_0xb012('0x44')]=[{'all':!![]}];}_0x394796=_['merge']({},_0x394796,_0x74d6b3['options']);return db[_0xb012('0x2a')][_0xb012('0x45')](_0x394796)[_0xb012('0x25')](handleEntityNotFound(_0x26f424,null))[_0xb012('0x25')](respondWithResult(_0x26f424,null))[_0xb012('0x40')](handleError(_0x26f424,null));};exports[_0xb012('0x46')]=function(_0x102877,_0x4ff22b){return db['VoiceTransferReport'][_0xb012('0x46')](_0x102877['body'],{})['then'](respondWithResult(_0x4ff22b,0xc9))['catch'](handleError(_0x4ff22b,null));};exports[_0xb012('0x23')]=function(_0x4607d7,_0x33f13a){if(_0x4607d7[_0xb012('0x47')]['id']){delete _0x4607d7[_0xb012('0x47')]['id'];}return db[_0xb012('0x2a')][_0xb012('0x45')]({'where':{'id':_0x4607d7[_0xb012('0x42')]['id']}})[_0xb012('0x25')](handleEntityNotFound(_0x33f13a,null))[_0xb012('0x25')](saveUpdates(_0x4607d7[_0xb012('0x47')],null))[_0xb012('0x25')](respondWithResult(_0x33f13a,null))['catch'](handleError(_0x33f13a,null));};exports[_0xb012('0x24')]=function(_0x1b945e,_0x57059f){return db[_0xb012('0x2a')][_0xb012('0x45')]({'where':{'id':_0x1b945e[_0xb012('0x42')]['id']}})[_0xb012('0x25')](handleEntityNotFound(_0x57059f,null))['then'](removeEntity(_0x57059f,null))['catch'](handleError(_0x57059f,null));};exports[_0xb012('0x48')]=function(_0x118bae,_0x1d1efb){return db['VoiceTransferReport']['describe']()[_0xb012('0x25')](respondWithResult(_0x1d1efb,null))[_0xb012('0x40')](handleError(_0x1d1efb,null));}; \ No newline at end of file +var _0x39ad=['attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','merge','type','includeAll','include','rows','catch','show','params','keys','length','options','find','create','body','destroy','describe','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','VoiceTransferReport','rawAttributes','model','map','query','intersection'];(function(_0x57d963,_0x2a5bd2){var _0x419d7f=function(_0x377579){while(--_0x377579){_0x57d963['push'](_0x57d963['shift']());}};_0x419d7f(++_0x2a5bd2);}(_0x39ad,0x17b));var _0xd39a=function(_0xd770c4,_0x3f99dc){_0xd770c4=_0xd770c4-0x0;var _0xf8c9ae=_0x39ad[_0xd770c4];return _0xf8c9ae;};'use strict';var emlformat=require(_0xd39a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd39a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd39a('0x2'));var BPromise=require(_0xd39a('0x3'));var Mustache=require(_0xd39a('0x4'));var util=require('util');var path=require(_0xd39a('0x5'));var sox=require(_0xd39a('0x6'));var csv=require(_0xd39a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd39a('0x8'));var squel=require('squel');var crypto=require(_0xd39a('0x9'));var jsforce=require(_0xd39a('0xa'));var deskjs=require(_0xd39a('0xb'));var toCsv=require(_0xd39a('0x7'));var querystring=require(_0xd39a('0xc'));var Papa=require(_0xd39a('0xd'));var Redis=require('ioredis');var authService=require(_0xd39a('0xe'));var qs=require(_0xd39a('0xf'));var as=require(_0xd39a('0x10'));var hardwareService=require(_0xd39a('0x11'));var logger=require(_0xd39a('0x12'))(_0xd39a('0x13'));var utils=require('../../config/utils');var config=require(_0xd39a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd39a('0x15'))['db'];function respondWithStatusCode(_0x82f312,_0x4ed9fb){_0x4ed9fb=_0x4ed9fb||0xcc;return function(_0x4bf18f){if(_0x4bf18f){return _0x82f312[_0xd39a('0x16')](_0x4ed9fb);}return _0x82f312['status'](_0x4ed9fb)[_0xd39a('0x17')]();};}function respondWithResult(_0xc7eb6b,_0x3ddbe5){_0x3ddbe5=_0x3ddbe5||0xc8;return function(_0x3efedb){if(_0x3efedb){return _0xc7eb6b[_0xd39a('0x18')](_0x3ddbe5)[_0xd39a('0x19')](_0x3efedb);}};}function respondWithFilteredResult(_0x23c6ea,_0x3d9f41){return function(_0x93fc66){if(_0x93fc66){var _0x5b2864=typeof _0x3d9f41[_0xd39a('0x1a')]===_0xd39a('0x1b')&&typeof _0x3d9f41[_0xd39a('0x1c')]===_0xd39a('0x1b');var _0x5730b3=_0x93fc66[_0xd39a('0x1d')];var _0x13a152=_0x5b2864?0x0:_0x3d9f41[_0xd39a('0x1a')];var _0x2d416d=_0x5b2864?_0x93fc66[_0xd39a('0x1d')]:_0x3d9f41[_0xd39a('0x1a')]+_0x3d9f41[_0xd39a('0x1c')];var _0x2395b0;if(_0x2d416d>=_0x5730b3){_0x2d416d=_0x5730b3;_0x2395b0=0xc8;}else{_0x2395b0=0xce;}_0x23c6ea[_0xd39a('0x18')](_0x2395b0);return _0x23c6ea[_0xd39a('0x1e')](_0xd39a('0x1f'),_0x13a152+'-'+_0x2d416d+'/'+_0x5730b3)[_0xd39a('0x19')](_0x93fc66);}return null;};}function patchUpdates(_0x2fddf7){return function(_0x182c67){try{jsonpatch['apply'](_0x182c67,_0x2fddf7,!![]);}catch(_0x457ddf){return BPromise[_0xd39a('0x20')](_0x457ddf);}return _0x182c67[_0xd39a('0x21')]();};}function saveUpdates(_0x2712e4,_0x4c51bb){return function(_0x4826af){if(_0x4826af){return _0x4826af[_0xd39a('0x22')](_0x2712e4)[_0xd39a('0x23')](function(_0x27ff88){return _0x27ff88;});}return null;};}function removeEntity(_0x59dac8,_0x45f980){return function(_0x264739){if(_0x264739){return _0x264739['destroy']()[_0xd39a('0x23')](function(){_0x59dac8[_0xd39a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9ca1,_0x512459){return function(_0x277af4){if(!_0x277af4){_0x5b9ca1['sendStatus'](0x194);}return _0x277af4;};}function handleError(_0x28646d,_0xb3880b){_0xb3880b=_0xb3880b||0x1f4;return function(_0xbf76fd){logger[_0xd39a('0x24')](_0xbf76fd[_0xd39a('0x25')]);if(_0xbf76fd[_0xd39a('0x26')]){delete _0xbf76fd['name'];}_0x28646d[_0xd39a('0x18')](_0xb3880b)[_0xd39a('0x27')](_0xbf76fd);};}exports[_0xd39a('0x28')]=function(_0x33e96c,_0x16a24d){var _0x4d1d97={},_0x49f012={},_0x2027e6={'count':0x0,'rows':[]};var _0x49fe78=_['map'](db[_0xd39a('0x29')][_0xd39a('0x2a')],function(_0x45705e){return{'name':_0x45705e['fieldName'],'type':_0x45705e['type']['key']};});_0x49f012[_0xd39a('0x2b')]=_[_0xd39a('0x2c')](_0x49fe78,_0xd39a('0x26'));_0x49f012[_0xd39a('0x2d')]=_['keys'](_0x33e96c[_0xd39a('0x2d')]);_0x49f012['filters']=_[_0xd39a('0x2e')](_0x49f012[_0xd39a('0x2b')],_0x49f012['query']);_0x4d1d97[_0xd39a('0x2f')]=_[_0xd39a('0x2e')](_0x49f012[_0xd39a('0x2b')],qs[_0xd39a('0x30')](_0x33e96c[_0xd39a('0x2d')][_0xd39a('0x30')]));_0x4d1d97[_0xd39a('0x2f')]=_0x4d1d97[_0xd39a('0x2f')]['length']?_0x4d1d97[_0xd39a('0x2f')]:_0x49f012[_0xd39a('0x2b')];if(!_0x33e96c['query'][_0xd39a('0x31')]('nolimit')){_0x4d1d97['limit']=qs[_0xd39a('0x1c')](_0x33e96c['query']['limit']);_0x4d1d97[_0xd39a('0x1a')]=qs[_0xd39a('0x1a')](_0x33e96c['query'][_0xd39a('0x1a')]);}_0x4d1d97['order']=qs[_0xd39a('0x32')](_0x33e96c[_0xd39a('0x2d')]['sort']);_0x4d1d97['where']=qs[_0xd39a('0x33')](_[_0xd39a('0x34')](_0x33e96c[_0xd39a('0x2d')],_0x49f012['filters']),_0x49fe78);if(_0x33e96c[_0xd39a('0x2d')][_0xd39a('0x35')]){_0x4d1d97[_0xd39a('0x36')]=_[_0xd39a('0x37')](_0x4d1d97[_0xd39a('0x36')],{'$or':_[_0xd39a('0x2c')](_0x49fe78,function(_0x26bea2){if(_0x26bea2[_0xd39a('0x38')]!=='VIRTUAL'){var _0x1ec8b5={};_0x1ec8b5[_0x26bea2[_0xd39a('0x26')]]={'$like':'%'+_0x33e96c[_0xd39a('0x2d')]['filter']+'%'};return _0x1ec8b5;}})});}_0x4d1d97=_['merge']({},_0x4d1d97,_0x33e96c['options']);var _0x203714={'where':_0x4d1d97['where']};return db[_0xd39a('0x29')][_0xd39a('0x1d')](_0x203714)['then'](function(_0x347271){_0x2027e6[_0xd39a('0x1d')]=_0x347271;if(_0x33e96c[_0xd39a('0x2d')][_0xd39a('0x39')]){_0x4d1d97[_0xd39a('0x3a')]=[{'all':!![]}];}return db[_0xd39a('0x29')]['findAll'](_0x4d1d97);})[_0xd39a('0x23')](function(_0x4d8792){_0x2027e6[_0xd39a('0x3b')]=_0x4d8792;return _0x2027e6;})['then'](respondWithFilteredResult(_0x16a24d,_0x4d1d97))[_0xd39a('0x3c')](handleError(_0x16a24d,null));};exports[_0xd39a('0x3d')]=function(_0xe9222f,_0x339a74){var _0x331285={'raw':!![],'where':{'id':_0xe9222f[_0xd39a('0x3e')]['id']}},_0x4dadf5={};_0x4dadf5[_0xd39a('0x2b')]=_[_0xd39a('0x3f')](db[_0xd39a('0x29')][_0xd39a('0x2a')]);_0x4dadf5[_0xd39a('0x2d')]=_[_0xd39a('0x3f')](_0xe9222f[_0xd39a('0x2d')]);_0x4dadf5[_0xd39a('0x33')]=_[_0xd39a('0x2e')](_0x4dadf5[_0xd39a('0x2b')],_0x4dadf5[_0xd39a('0x2d')]);_0x331285['attributes']=_[_0xd39a('0x2e')](_0x4dadf5['model'],qs['fields'](_0xe9222f[_0xd39a('0x2d')][_0xd39a('0x30')]));_0x331285[_0xd39a('0x2f')]=_0x331285[_0xd39a('0x2f')][_0xd39a('0x40')]?_0x331285[_0xd39a('0x2f')]:_0x4dadf5[_0xd39a('0x2b')];if(_0xe9222f[_0xd39a('0x2d')][_0xd39a('0x39')]){_0x331285[_0xd39a('0x3a')]=[{'all':!![]}];}_0x331285=_[_0xd39a('0x37')]({},_0x331285,_0xe9222f[_0xd39a('0x41')]);return db[_0xd39a('0x29')][_0xd39a('0x42')](_0x331285)[_0xd39a('0x23')](handleEntityNotFound(_0x339a74,null))[_0xd39a('0x23')](respondWithResult(_0x339a74,null))[_0xd39a('0x3c')](handleError(_0x339a74,null));};exports[_0xd39a('0x43')]=function(_0xf33d56,_0x1748d8){return db[_0xd39a('0x29')]['create'](_0xf33d56[_0xd39a('0x44')],{})[_0xd39a('0x23')](respondWithResult(_0x1748d8,0xc9))[_0xd39a('0x3c')](handleError(_0x1748d8,null));};exports[_0xd39a('0x22')]=function(_0x2364e5,_0x3485e2){if(_0x2364e5[_0xd39a('0x44')]['id']){delete _0x2364e5[_0xd39a('0x44')]['id'];}return db[_0xd39a('0x29')]['find']({'where':{'id':_0x2364e5[_0xd39a('0x3e')]['id']}})[_0xd39a('0x23')](handleEntityNotFound(_0x3485e2,null))['then'](saveUpdates(_0x2364e5[_0xd39a('0x44')],null))['then'](respondWithResult(_0x3485e2,null))[_0xd39a('0x3c')](handleError(_0x3485e2,null));};exports[_0xd39a('0x45')]=function(_0x5cb5bd,_0x5d02b4){return db[_0xd39a('0x29')][_0xd39a('0x42')]({'where':{'id':_0x5cb5bd[_0xd39a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5d02b4,null))[_0xd39a('0x23')](removeEntity(_0x5d02b4,null))['catch'](handleError(_0x5d02b4,null));};exports[_0xd39a('0x46')]=function(_0x5af901,_0x512154){return db[_0xd39a('0x29')][_0xd39a('0x46')]()[_0xd39a('0x23')](respondWithResult(_0x512154,null))['catch'](handleError(_0x512154,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ca09999..8a526de 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 _0xfc25=['rimraf','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x597026,_0x32586f){var _0x23b571=function(_0x2ece51){while(--_0x2ece51){_0x597026['push'](_0x597026['shift']());}};_0x23b571(++_0x32586f);}(_0xfc25,0x88));var _0x5fc2=function(_0x5c386e,_0x21856b){_0x5c386e=_0x5c386e-0x0;var _0x28cfa0=_0xfc25[_0x5c386e];return _0x28cfa0;};'use strict';var _=require(_0x5fc2('0x0'));var util=require('util');var logger=require(_0x5fc2('0x1'))(_0x5fc2('0x2'));var moment=require(_0x5fc2('0x3'));var BPromise=require(_0x5fc2('0x4'));var rp=require(_0x5fc2('0x5'));var fs=require('fs');var path=require(_0x5fc2('0x6'));var rimraf=require(_0x5fc2('0x7'));var config=require(_0x5fc2('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0x5fc2('0x9')]=function(_0x2aba0f,_0x55d701){return _0x2aba0f[_0x5fc2('0xa')](_0x5fc2('0xb'),attributes,{'tableName':_0x5fc2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec6=['../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbec6,0x1e4));var _0x6bec=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0xbec6[_0x4c9380];return _0x49a523;};'use strict';var _=require('lodash');var util=require(_0x6bec('0x0'));var logger=require(_0x6bec('0x1'))(_0x6bec('0x2'));var moment=require(_0x6bec('0x3'));var BPromise=require(_0x6bec('0x4'));var rp=require(_0x6bec('0x5'));var fs=require('fs');var path=require(_0x6bec('0x6'));var rimraf=require(_0x6bec('0x7'));var config=require(_0x6bec('0x8'));var attributes=require(_0x6bec('0x9'));module[_0x6bec('0xa')]=function(_0xa6491d,_0x4a3aed){return _0xa6491d['define']('VoiceTransferReport',attributes,{'tableName':_0x6bec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 56f9a27..db246c0 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 _0x6fc3=['client','request','then','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport','create','body','options','debug','stringify','CreateVoiceTransferReport','util','randomstring','ioredis','rpc','../../config/environment'];(function(_0x389674,_0x3d5c69){var _0x24dd7f=function(_0x2b6404){while(--_0x2b6404){_0x389674['push'](_0x389674['shift']());}};_0x24dd7f(++_0x3d5c69);}(_0x6fc3,0x182));var _0x36fc=function(_0x11b33c,_0x29d381){_0x11b33c=_0x11b33c-0x0;var _0x3ff3dd=_0x6fc3[_0x11b33c];return _0x3ff3dd;};'use strict';var _=require('lodash');var util=require(_0x36fc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x36fc('0x1'));var fs=require('fs');var Redis=require(_0x36fc('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36fc('0x3'));var config=require(_0x36fc('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x36fc('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c92e0,_0x11e561,_0x54a4a5){return new BPromise(function(_0x43f68f,_0x3a898f){return client[_0x36fc('0x6')](_0x5c92e0,_0x54a4a5)[_0x36fc('0x7')](function(_0x5c8e51){logger[_0x36fc('0x8')]('VoiceTransferReport,\x20%s,\x20%s',_0x11e561,_0x36fc('0x9'));logger['debug'](_0x36fc('0xa'),_0x11e561,'request\x20sent',JSON['stringify'](_0x5c8e51));if(_0x5c8e51[_0x36fc('0xb')]){if(_0x5c8e51[_0x36fc('0xb')]['code']===0x1f4){logger[_0x36fc('0xb')](_0x36fc('0xc'),_0x11e561,_0x5c8e51[_0x36fc('0xb')][_0x36fc('0xd')]);return _0x3a898f(_0x5c8e51[_0x36fc('0xb')]['message']);}logger[_0x36fc('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x11e561,_0x5c8e51[_0x36fc('0xb')][_0x36fc('0xd')]);return _0x43f68f(_0x5c8e51[_0x36fc('0xb')]['message']);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x11e561,_0x36fc('0x9'));_0x43f68f(_0x5c8e51[_0x36fc('0xe')][_0x36fc('0xd')]);}})[_0x36fc('0xf')](function(_0x11f196){logger[_0x36fc('0xb')](_0x36fc('0xc'),_0x11e561,_0x11f196);_0x3a898f(_0x11f196);});});}exports['CreateVoiceTransferReport']=function(_0x33fe3f){var _0x3d8e63=this;return new Promise(function(_0x2de419,_0x445098){return db[_0x36fc('0x10')][_0x36fc('0x11')](_0x33fe3f[_0x36fc('0x12')],{'raw':_0x33fe3f[_0x36fc('0x13')]?_0x33fe3f['options']['raw']===undefined?!![]:![]:!![]})[_0x36fc('0x7')](function(_0x3000d8){logger[_0x36fc('0x8')]('CreateVoiceTransferReport',_0x33fe3f);logger[_0x36fc('0x14')]('CreateVoiceTransferReport',_0x33fe3f,JSON[_0x36fc('0x15')](_0x3000d8));_0x2de419(_0x3000d8);})['catch'](function(_0xdf3bb4){logger[_0x36fc('0xb')](_0x36fc('0x16'),_0xdf3bb4[_0x36fc('0xd')],_0x33fe3f);_0x445098(_0x3d8e63[_0x36fc('0xb')](0x1f4,_0xdf3bb4[_0x36fc('0xd')]));});});}; \ No newline at end of file +var _0xce03=['http','request','request\x20sent','debug','error','code','VoiceTransferReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x45bba7,_0x2206f4){var _0xc0383f=function(_0x107088){while(--_0x107088){_0x45bba7['push'](_0x45bba7['shift']());}};_0xc0383f(++_0x2206f4);}(_0xce03,0x6f));var _0x3ce0=function(_0x3676ec,_0x1c4dc8){_0x3676ec=_0x3676ec-0x0;var _0x541d4e=_0xce03[_0x3676ec];return _0x541d4e;};'use strict';var _=require(_0x3ce0('0x0'));var util=require(_0x3ce0('0x1'));var moment=require(_0x3ce0('0x2'));var BPromise=require(_0x3ce0('0x3'));var rs=require(_0x3ce0('0x4'));var fs=require('fs');var Redis=require(_0x3ce0('0x5'));var db=require(_0x3ce0('0x6'))['db'];var utils=require(_0x3ce0('0x7'));var logger=require(_0x3ce0('0x8'))(_0x3ce0('0x9'));var config=require(_0x3ce0('0xa'));var jayson=require(_0x3ce0('0xb'));var client=jayson[_0x3ce0('0xc')][_0x3ce0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x43a3b3,_0x1c0d7d,_0x24f0ca){return new BPromise(function(_0x25d1f2,_0x1c9b11){return client[_0x3ce0('0xe')](_0x43a3b3,_0x24f0ca)['then'](function(_0x4865c0){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x1c0d7d,_0x3ce0('0xf'));logger[_0x3ce0('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1c0d7d,_0x3ce0('0xf'),JSON['stringify'](_0x4865c0));if(_0x4865c0[_0x3ce0('0x11')]){if(_0x4865c0['error'][_0x3ce0('0x12')]===0x1f4){logger[_0x3ce0('0x11')](_0x3ce0('0x13'),_0x1c0d7d,_0x4865c0[_0x3ce0('0x11')][_0x3ce0('0x14')]);return _0x1c9b11(_0x4865c0[_0x3ce0('0x11')][_0x3ce0('0x14')]);}logger[_0x3ce0('0x11')](_0x3ce0('0x13'),_0x1c0d7d,_0x4865c0['error'][_0x3ce0('0x14')]);return _0x25d1f2(_0x4865c0['error'][_0x3ce0('0x14')]);}else{logger[_0x3ce0('0x15')](_0x3ce0('0x13'),_0x1c0d7d,'request\x20sent');_0x25d1f2(_0x4865c0[_0x3ce0('0x16')][_0x3ce0('0x14')]);}})[_0x3ce0('0x17')](function(_0x2cd5bb){logger['error'](_0x3ce0('0x13'),_0x1c0d7d,_0x2cd5bb);_0x1c9b11(_0x2cd5bb);});});}exports[_0x3ce0('0x18')]=function(_0x4f977c){var _0x4436a1=this;return new Promise(function(_0x366a95,_0x1a51fc){return db[_0x3ce0('0x19')][_0x3ce0('0x1a')](_0x4f977c[_0x3ce0('0x1b')],{'raw':_0x4f977c[_0x3ce0('0x1c')]?_0x4f977c['options']['raw']===undefined?!![]:![]:!![]})[_0x3ce0('0x1d')](function(_0x2ee011){logger[_0x3ce0('0x15')](_0x3ce0('0x18'),_0x4f977c);logger[_0x3ce0('0x10')](_0x3ce0('0x18'),_0x4f977c,JSON[_0x3ce0('0x1e')](_0x2ee011));_0x366a95(_0x2ee011);})[_0x3ce0('0x17')](function(_0x308284){logger[_0x3ce0('0x11')](_0x3ce0('0x18'),_0x308284[_0x3ce0('0x14')],_0x4f977c);_0x1a51fc(_0x4436a1[_0x3ce0('0x11')](0x1f4,_0x308284[_0x3ce0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 1fe6350..d1f3129 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 _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x3c82d0,_0x456c34){var _0x4376bf=function(_0x5514bc){while(--_0x5514bc){_0x3c82d0['push'](_0x3c82d0['shift']());}};_0x4376bf(++_0x456c34);}(_0xf109,0xce));var _0x9f10=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xf109[_0x5a95fa];return _0x1a61b8;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0bb5=['unhold','/calls','calls','/transfer','exports','express','Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','/unhold'];(function(_0x399c91,_0x5a2677){var _0x1075a8=function(_0x567f0b){while(--_0x567f0b){_0x399c91['push'](_0x399c91['shift']());}};_0x1075a8(++_0x5a2677);}(_0x0bb5,0x148));var _0x50bb=function(_0x19e7c2,_0x59ab98){_0x19e7c2=_0x19e7c2-0x0;var _0x994217=_0x0bb5[_0x19e7c2];return _0x994217;};'use strict';var express=require(_0x50bb('0x0'));var router=express[_0x50bb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0x50bb('0x2')](_0x50bb('0x3'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0x6')]);router[_0x50bb('0x2')](_0x50bb('0x7'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller['hangup']);router[_0x50bb('0x2')](_0x50bb('0x8'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['answer']);router['post'](_0x50bb('0x9'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xa')]);router['post'](_0x50bb('0xb'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xc')]);router[_0x50bb('0x2')](_0x50bb('0xd'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller[_0x50bb('0xe')]);router['post'](_0x50bb('0xf'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['transfer']);module[_0x50bb('0x10')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index c4690b5..2b0f89e 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 _0xd3f1=['length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','user:%s','webbar:hangup','hangup\x20executed!','answer','sessionId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','unhold','unhold\x20fired:','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','http','defaults','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','stringify','log','handleError:','error','name','status','NotFound','request','then','message','catch','User','agent','VoiceChannels','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','validate'];(function(_0x4ad6fb,_0x5d1b7b){var _0x458bbf=function(_0x440b98){while(--_0x440b98){_0x4ad6fb['push'](_0x4ad6fb['shift']());}};_0x458bbf(++_0x5d1b7b);}(_0xd3f1,0xb6));var _0x1d3f=function(_0x4c3e78,_0x3fb14a){_0x4c3e78=_0x4c3e78-0x0;var _0x1e1c0c=_0xd3f1[_0x4c3e78];return _0x1e1c0c;};'use strict';var path=require(_0x1d3f('0x0'));var fs=require('fs');var _=require(_0x1d3f('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x1d3f('0x2'));var util=require(_0x1d3f('0x3'));var BPromise=require(_0x1d3f('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x1d3f('0x5')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require('ioredis');config['redis']=_[_0x1d3f('0x6')](config[_0x1d3f('0x7')],{'host':_0x1d3f('0x8'),'port':0x18eb});var io=require(_0x1d3f('0x9'))(new Redis(config[_0x1d3f('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x1d3f('0xa'),'required':[!![],_0x1d3f('0xb')]},'callNumber':{'type':_0x1d3f('0xc'),'required':[!![],_0x1d3f('0xd')]},'callerId':{'type':_0x1d3f('0xc')},'callbackUrl':{'type':_0x1d3f('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1d3f('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1d3f('0xa'),'required':[!![],_0x1d3f('0xb')]},'sessionId':{'type':_0x1d3f('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1d3f('0xb')]},'sessionId':{'type':'string','required':[!![],_0x1d3f('0xe')]},'transferNumber':{'type':_0x1d3f('0xc'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x1d3f('0xa'),'required':[!![],_0x1d3f('0xb')]},'sessionId':{'type':_0x1d3f('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1d3f('0xa'),'required':[!![],_0x1d3f('0xb')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1d3f('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x4a00f4,_0x10a3d4,_0xba0664){logger['info'](_0x4a00f4,_0x10a3d4,JSON[_0x1d3f('0xf')](_0xba0664));io['to'](_0x4a00f4)['emit'](_0x10a3d4,_0xba0664);}function handleError(_0x3381af){return function(_0x11e5bd){console[_0x1d3f('0x10')](_0x1d3f('0x11'),_0x11e5bd,_0x11e5bd instanceof RangeError);logger[_0x1d3f('0x12')](_0x11e5bd['stack']);if(_0x11e5bd instanceof RangeError){if(_0x11e5bd[_0x1d3f('0x13')]){delete _0x11e5bd[_0x1d3f('0x13')];}_0x3381af[_0x1d3f('0x14')](0x194)['send'](_0x11e5bd);}else{if(_0x11e5bd[_0x1d3f('0x13')]){delete _0x11e5bd['name'];}_0x3381af['status'](0x1f4)['send'](_0x11e5bd);}};}function checkError(){return function(_0x40a863){if(!_0x40a863){throw new RangeError(_0x1d3f('0x15'));}return _0x40a863;};}function respondWithRpcPromise(_0x42c6fa,_0xdd0d){return new BPromise(function(_0x159d0c,_0x191ce7){var _0x4d0e15=amiClient;return _0x4d0e15[_0x1d3f('0x16')](_0x42c6fa,_0xdd0d)[_0x1d3f('0x17')](function(_0x51b254){if(_0x51b254['error']){if(_0x51b254[_0x1d3f('0x12')]['code']===0x1f4){return _0x191ce7(_0x51b254['error'][_0x1d3f('0x18')]);}return _0x159d0c(_0x51b254[_0x1d3f('0x12')][_0x1d3f('0x18')]);}else{_0x159d0c(_0x51b254['result']);}})[_0x1d3f('0x19')](function(_0x5e1f87){_0x191ce7(_0x5e1f87);});});}function getAgent(_0x5349da){return db[_0x1d3f('0x1a')]['findOne']({'where':{'id':_0x5349da,'role':_0x1d3f('0x1b')}})[_0x1d3f('0x17')](checkError());}function getAgentCheckSession(_0x1a7951,_0x2ec78e){return new BPromise(function(_0x2f8f17,_0x2fa2e3){var _0x1c6984=respondWithRpcPromise(_0x1d3f('0x1c'));var _0x22529a=getAgent(_0x1a7951);Promise[_0x1d3f('0x1d')]([_0x1c6984,_0x22529a])[_0x1d3f('0x17')](function(_0x577577){var _0x5c4898=_0x577577[0x0];var _0x411cb0=_0x577577[0x1];var _0x3a3c21=_[_0x1d3f('0x1e')](_0x5c4898[_0x1d3f('0x1f')],function(_0x163a0e){return _0x163a0e[_0x1d3f('0x20')]==_0x411cb0['id']&&_0x163a0e['sessionId']==_0x2ec78e;});if(_0x3a3c21['length']==0x1){_0x2f8f17(_0x411cb0);}else{_0x2fa2e3(new RangeError(_0x1d3f('0x21')+_0x2ec78e+_0x1d3f('0x22')));}});});}exports[_0x1d3f('0x23')]=function(_0x2776ec,_0x29d39b){logger[_0x1d3f('0x24')](_0x1d3f('0x25'),_0x2776ec[_0x1d3f('0x26')]);var _0x9cf779=originateValidation[_0x1d3f('0x27')](_0x2776ec['body']);if(_0x9cf779[_0x1d3f('0x28')]>0x0){return _0x29d39b['status'](0x190)[_0x1d3f('0x29')](_0x9cf779);}var _0x480761=_0x2776ec[_0x1d3f('0x26')][_0x1d3f('0x2a')];var _0xaf7e72=_0x2776ec['body'][_0x1d3f('0x2b')];var _0x93d78d=_0x2776ec[_0x1d3f('0x26')][_0x1d3f('0x2c')];var _0x3900fa=_0x2776ec[_0x1d3f('0x26')][_0x1d3f('0x2d')];return getAgent(_0x480761)['then'](function(_0x5b4d98){logger['info'](_0x1d3f('0x2e'),_0x5b4d98[_0x1d3f('0x13')]);emit(util[_0x1d3f('0x2f')]('user:%s',_0x5b4d98[_0x1d3f('0x13')]),_0x1d3f('0x30'),{'callNumber':_0xaf7e72,'callerId':_0x93d78d,'callbackUrl':_0x3900fa});return _0x29d39b[_0x1d3f('0x14')](0xc8)[_0x1d3f('0x29')]({'error':![],'message':_0x1d3f('0x31')});})['catch'](handleError(_0x29d39b));};exports[_0x1d3f('0x32')]=function(_0x522573,_0x693c24){logger[_0x1d3f('0x24')](_0x1d3f('0x33'),_0x522573['body']);var _0x2ddc70=hangupValidation[_0x1d3f('0x27')](_0x522573[_0x1d3f('0x26')]);if(_0x2ddc70[_0x1d3f('0x28')]>0x0){return _0x693c24[_0x1d3f('0x14')](0x190)[_0x1d3f('0x29')](_0x2ddc70);}var _0x2eee54=_0x522573[_0x1d3f('0x26')][_0x1d3f('0x2a')];var _0x317697=_0x522573['body']['sessionId'];return getAgent(_0x2eee54)[_0x1d3f('0x17')](function(_0x1702be){logger[_0x1d3f('0x24')](_0x1d3f('0x2e'),_0x1702be[_0x1d3f('0x13')]);emit(util['format'](_0x1d3f('0x34'),_0x1702be[_0x1d3f('0x13')]),_0x1d3f('0x35'),{'sessionId':_0x317697});return _0x693c24[_0x1d3f('0x14')](0xc8)['json']({'error':![],'message':_0x1d3f('0x36')});})[_0x1d3f('0x19')](handleError(_0x693c24));};exports[_0x1d3f('0x37')]=function(_0x1fe6c4,_0x202550){logger[_0x1d3f('0x24')]('answer\x20fired:',_0x1fe6c4['body']);var _0x21ffde=answerValidation['validate'](_0x1fe6c4['body']);if(_0x21ffde[_0x1d3f('0x28')]>0x0){return _0x202550[_0x1d3f('0x14')](0x190)[_0x1d3f('0x29')](_0x21ffde);}var _0x1f7ef6=_0x1fe6c4[_0x1d3f('0x26')][_0x1d3f('0x2a')];var _0x18e7f1=_0x1fe6c4[_0x1d3f('0x26')][_0x1d3f('0x38')];return getAgent(_0x1f7ef6)['then'](function(_0x443cfc){logger[_0x1d3f('0x24')](_0x1d3f('0x2e'),_0x443cfc[_0x1d3f('0x13')]);emit(util[_0x1d3f('0x2f')](_0x1d3f('0x34'),_0x443cfc[_0x1d3f('0x13')]),_0x1d3f('0x39'),{'sessionId':_0x18e7f1});return _0x202550[_0x1d3f('0x14')](0xc8)[_0x1d3f('0x29')]({'error':![],'message':_0x1d3f('0x3a')});})[_0x1d3f('0x19')](handleError(_0x202550));};exports[_0x1d3f('0x3b')]=function(_0x3bcdb3,_0xdf1572){logger[_0x1d3f('0x24')](_0x1d3f('0x3c'),_0x3bcdb3[_0x1d3f('0x26')]);var _0x5ce8cd=holdValidation[_0x1d3f('0x27')](_0x3bcdb3['body']);if(_0x5ce8cd[_0x1d3f('0x28')]>0x0){return _0xdf1572[_0x1d3f('0x14')](0x190)['json'](_0x5ce8cd);}var _0x40b37a=_0x3bcdb3[_0x1d3f('0x26')]['userId'];var _0x39f174=_0x3bcdb3['body'][_0x1d3f('0x38')];return getAgent(_0x40b37a)[_0x1d3f('0x17')](function(_0x44aaf2){logger[_0x1d3f('0x24')](_0x1d3f('0x2e'),_0x44aaf2[_0x1d3f('0x13')]);emit(util[_0x1d3f('0x2f')](_0x1d3f('0x34'),_0x44aaf2[_0x1d3f('0x13')]),'webbar:hold',{'sessionId':_0x39f174});return _0xdf1572[_0x1d3f('0x14')](0xc8)[_0x1d3f('0x29')]({'error':![],'message':'hold\x20executed!'});})[_0x1d3f('0x19')](handleError(_0xdf1572));};exports[_0x1d3f('0x3d')]=function(_0xc75bea,_0x20e543){logger[_0x1d3f('0x24')](_0x1d3f('0x3e'),_0xc75bea[_0x1d3f('0x26')]);var _0x6b6c4a=unholdValidation[_0x1d3f('0x27')](_0xc75bea[_0x1d3f('0x26')]);if(_0x6b6c4a[_0x1d3f('0x28')]>0x0){return _0x20e543[_0x1d3f('0x14')](0x190)[_0x1d3f('0x29')](_0x6b6c4a);}var _0x3e3fd3=_0xc75bea[_0x1d3f('0x26')][_0x1d3f('0x2a')];var _0x439301=_0xc75bea['body'][_0x1d3f('0x38')];return getAgent(_0x3e3fd3)[_0x1d3f('0x17')](function(_0x535351){logger[_0x1d3f('0x24')](_0x1d3f('0x2e'),_0x535351[_0x1d3f('0x13')]);emit(util['format'](_0x1d3f('0x34'),_0x535351['name']),'webbar:unhold',{'sessionId':_0x439301});return _0x20e543['status'](0xc8)[_0x1d3f('0x29')]({'error':![],'message':_0x1d3f('0x3f')});})[_0x1d3f('0x19')](handleError(_0x20e543));};exports[_0x1d3f('0x40')]=function(_0x3ed5ce,_0x44c57f){logger[_0x1d3f('0x24')]('calls\x20fired:',_0x44c57f['body']);var _0x3c167c=callsValidation[_0x1d3f('0x27')](_0x3ed5ce[_0x1d3f('0x26')]);if(_0x3c167c[_0x1d3f('0x28')]>0x0){return _0x44c57f[_0x1d3f('0x14')](0x190)[_0x1d3f('0x29')](_0x3c167c);}var _0x262ec5=_0x3ed5ce[_0x1d3f('0x26')][_0x1d3f('0x2a')];var _0xb1b152=respondWithRpcPromise(_0x1d3f('0x1c'));var _0x3a5f26=getAgent(_0x262ec5);return Promise[_0x1d3f('0x1d')]([_0xb1b152,_0x3a5f26])[_0x1d3f('0x17')](function(_0x4dd17b){var _0xae9e3f=_0x4dd17b[0x0];var _0x20c682=_0x4dd17b[0x1];var _0x3f4fbe=_[_0x1d3f('0x1e')](_0xae9e3f[_0x1d3f('0x1f')],function(_0x5e63d7){return _0x5e63d7[_0x1d3f('0x20')]==_0x20c682['id'];});return _0x44c57f[_0x1d3f('0x14')](0xc8)[_0x1d3f('0x29')]({'count':_0x3f4fbe[_0x1d3f('0x28')],'rows':_0x3f4fbe});})[_0x1d3f('0x19')](handleError(_0x44c57f));};exports[_0x1d3f('0x41')]=function(_0x28fc15,_0x569312){logger[_0x1d3f('0x24')](_0x1d3f('0x42'),_0x28fc15['body']);var _0x5d0131=conferenceValidation[_0x1d3f('0x27')](_0x28fc15[_0x1d3f('0x26')]);if(_0x5d0131[_0x1d3f('0x28')]>0x0){return _0x569312[_0x1d3f('0x14')](0x190)[_0x1d3f('0x29')](_0x5d0131);}var _0x108c46=_0x28fc15[_0x1d3f('0x26')][_0x1d3f('0x2a')];return getAgent(_0x108c46)[_0x1d3f('0x17')](function(_0x1d8fca){logger['info'](_0x1d3f('0x2e'),_0x1d8fca[_0x1d3f('0x13')]);emit(util[_0x1d3f('0x2f')](_0x1d3f('0x34'),_0x1d8fca['name']),_0x1d3f('0x43'));return _0x569312[_0x1d3f('0x14')](0xc8)['json']({'error':![],'message':_0x1d3f('0x44')});})[_0x1d3f('0x19')](handleError(_0x569312));};exports[_0x1d3f('0x45')]=function(_0x4b0550,_0x223f7b){logger['info'](_0x1d3f('0x46'),_0x4b0550[_0x1d3f('0x26')]);var _0x4aaf57=transferValidation[_0x1d3f('0x27')](_0x4b0550[_0x1d3f('0x26')]);if(_0x4aaf57[_0x1d3f('0x28')]>0x0){return _0x223f7b['status'](0x190)[_0x1d3f('0x29')](_0x4aaf57);}var _0x29eba0=_0x4b0550[_0x1d3f('0x26')]['userId'];var _0x3ef1f8=_0x4b0550[_0x1d3f('0x26')]['sessionId'];var _0x389e62=_0x4b0550[_0x1d3f('0x26')][_0x1d3f('0x47')];return getAgent(_0x29eba0)['then'](function(_0x4335d7){logger[_0x1d3f('0x24')](_0x1d3f('0x2e'),_0x4335d7[_0x1d3f('0x13')]);emit(util[_0x1d3f('0x2f')](_0x1d3f('0x34'),_0x4335d7[_0x1d3f('0x13')]),_0x1d3f('0x48'),{'sessionId':_0x3ef1f8,'transferNumber':_0x389e62});return _0x223f7b['status'](0xc8)[_0x1d3f('0x29')]({'error':![],'message':_0x1d3f('0x49')});})[_0x1d3f('0x19')](handleError(_0x223f7b));}; \ No newline at end of file +var _0x7341=['answer\x20fired:','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','calls','calls\x20fired:','all','rows','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','status','name','NotFound','request','then','code','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer'];(function(_0x2893d0,_0x13b569){var _0x38f8df=function(_0x162c87){while(--_0x162c87){_0x2893d0['push'](_0x2893d0['shift']());}};_0x38f8df(++_0x13b569);}(_0x7341,0xe4));var _0x1734=function(_0x532bad,_0x3a3425){_0x532bad=_0x532bad-0x0;var _0xfa01d3=_0x7341[_0x532bad];return _0xfa01d3;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x1734('0x0'))['db'];var config=require('../../config/environment');var util=require(_0x1734('0x1'));var BPromise=require(_0x1734('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1734('0x3')][_0x1734('0x4')]({'port':0x232a});var logger=require(_0x1734('0x5'))(_0x1734('0x6'));var Redis=require(_0x1734('0x7'));config[_0x1734('0x8')]=_[_0x1734('0x9')](config['redis'],{'host':_0x1734('0xa'),'port':0x18eb});var io=require(_0x1734('0xb'))(new Redis(config[_0x1734('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x1734('0xd')]},'callerId':{'type':_0x1734('0xe')},'callbackUrl':{'type':_0x1734('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x10')]},'transferNumber':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});function emit(_0x3989a6,_0x24bbf3,_0x2b375d){logger[_0x1734('0x12')](_0x3989a6,_0x24bbf3,JSON[_0x1734('0x13')](_0x2b375d));io['to'](_0x3989a6)['emit'](_0x24bbf3,_0x2b375d);}function handleError(_0x5ab895){return function(_0x1fa9c0){console[_0x1734('0x14')]('handleError:',_0x1fa9c0,_0x1fa9c0 instanceof RangeError);logger[_0x1734('0x15')](_0x1fa9c0['stack']);if(_0x1fa9c0 instanceof RangeError){if(_0x1fa9c0['name']){delete _0x1fa9c0['name'];}_0x5ab895[_0x1734('0x16')](0x194)['send'](_0x1fa9c0);}else{if(_0x1fa9c0[_0x1734('0x17')]){delete _0x1fa9c0[_0x1734('0x17')];}_0x5ab895['status'](0x1f4)['send'](_0x1fa9c0);}};}function checkError(){return function(_0x4bd526){if(!_0x4bd526){throw new RangeError(_0x1734('0x18'));}return _0x4bd526;};}function respondWithRpcPromise(_0x53f13d,_0x183f7a){return new BPromise(function(_0x5ad801,_0x215ae4){var _0x42485f=amiClient;return _0x42485f[_0x1734('0x19')](_0x53f13d,_0x183f7a)[_0x1734('0x1a')](function(_0x29bb2c){if(_0x29bb2c[_0x1734('0x15')]){if(_0x29bb2c[_0x1734('0x15')][_0x1734('0x1b')]===0x1f4){return _0x215ae4(_0x29bb2c[_0x1734('0x15')]['message']);}return _0x5ad801(_0x29bb2c[_0x1734('0x15')]['message']);}else{_0x5ad801(_0x29bb2c['result']);}})[_0x1734('0x1c')](function(_0x46b2fa){_0x215ae4(_0x46b2fa);});});}function getAgent(_0x309d3f){return db[_0x1734('0x1d')][_0x1734('0x1e')]({'where':{'id':_0x309d3f,'role':_0x1734('0x1f')}})[_0x1734('0x1a')](checkError());}function getAgentCheckSession(_0x27d6e5,_0x4a670a){return new BPromise(function(_0x381960,_0x52eaf5){var _0x17e068=respondWithRpcPromise(_0x1734('0x20'));var _0xfca2ad=getAgent(_0x27d6e5);Promise['all']([_0x17e068,_0xfca2ad])[_0x1734('0x1a')](function(_0x3f9abe){var _0xf2d136=_0x3f9abe[0x0];var _0x50efce=_0x3f9abe[0x1];var _0x2b1352=_[_0x1734('0x21')](_0xf2d136['rows'],function(_0x1bd659){return _0x1bd659[_0x1734('0x22')]==_0x50efce['id']&&_0x1bd659[_0x1734('0x23')]==_0x4a670a;});if(_0x2b1352[_0x1734('0x24')]==0x1){_0x381960(_0x50efce);}else{_0x52eaf5(new RangeError('sessionId\x20'+_0x4a670a+_0x1734('0x25')));}});});}exports[_0x1734('0x26')]=function(_0x546a94,_0x4dd04a){logger[_0x1734('0x12')](_0x1734('0x27'),_0x546a94[_0x1734('0x28')]);var _0x3903a7=originateValidation[_0x1734('0x29')](_0x546a94[_0x1734('0x28')]);if(_0x3903a7[_0x1734('0x24')]>0x0){return _0x4dd04a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x3903a7);}var _0x2921c8=_0x546a94[_0x1734('0x28')][_0x1734('0x2b')];var _0x18a0c7=_0x546a94[_0x1734('0x28')][_0x1734('0x2c')];var _0x29ccc3=_0x546a94[_0x1734('0x28')]['callerId'];var _0x1e7134=_0x546a94['body'][_0x1734('0x2d')];return getAgent(_0x2921c8)[_0x1734('0x1a')](function(_0x1f8446){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x1f8446[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x1f8446['name']),_0x1734('0x31'),{'callNumber':_0x18a0c7,'callerId':_0x29ccc3,'callbackUrl':_0x1e7134});return _0x4dd04a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x32')});})[_0x1734('0x1c')](handleError(_0x4dd04a));};exports[_0x1734('0x33')]=function(_0x26072f,_0x4db10d){logger[_0x1734('0x12')](_0x1734('0x34'),_0x26072f[_0x1734('0x28')]);var _0x3a9bcd=hangupValidation[_0x1734('0x29')](_0x26072f[_0x1734('0x28')]);if(_0x3a9bcd[_0x1734('0x24')]>0x0){return _0x4db10d[_0x1734('0x16')](0x190)['json'](_0x3a9bcd);}var _0x1f5cc6=_0x26072f['body'][_0x1734('0x2b')];var _0x2d9873=_0x26072f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1f5cc6)[_0x1734('0x1a')](function(_0x169db8){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x169db8[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x169db8['name']),_0x1734('0x35'),{'sessionId':_0x2d9873});return _0x4db10d[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x36')});})['catch'](handleError(_0x4db10d));};exports[_0x1734('0x37')]=function(_0x562be1,_0x539270){logger[_0x1734('0x12')](_0x1734('0x38'),_0x562be1[_0x1734('0x28')]);var _0x71f9c1=answerValidation['validate'](_0x562be1[_0x1734('0x28')]);if(_0x71f9c1[_0x1734('0x24')]>0x0){return _0x539270['status'](0x190)[_0x1734('0x2a')](_0x71f9c1);}var _0x1b104a=_0x562be1['body'][_0x1734('0x2b')];var _0x4bfc67=_0x562be1[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1b104a)[_0x1734('0x1a')](function(_0x400a1f){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x400a1f[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x400a1f[_0x1734('0x17')]),'webbar:answer',{'sessionId':_0x4bfc67});return _0x539270[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x39')});})[_0x1734('0x1c')](handleError(_0x539270));};exports['hold']=function(_0x6f821f,_0x70fd09){logger[_0x1734('0x12')]('hold\x20fired:',_0x6f821f[_0x1734('0x28')]);var _0x245420=holdValidation[_0x1734('0x29')](_0x6f821f[_0x1734('0x28')]);if(_0x245420[_0x1734('0x24')]>0x0){return _0x70fd09[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x245420);}var _0x8bfed7=_0x6f821f[_0x1734('0x28')][_0x1734('0x2b')];var _0x1ef5d6=_0x6f821f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x8bfed7)[_0x1734('0x1a')](function(_0x470110){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x470110[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x470110['name']),_0x1734('0x3a'),{'sessionId':_0x1ef5d6});return _0x70fd09[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x3b')});})['catch'](handleError(_0x70fd09));};exports['unhold']=function(_0x294097,_0xe86f1f){logger['info'](_0x1734('0x3c'),_0x294097[_0x1734('0x28')]);var _0x2a71cf=unholdValidation[_0x1734('0x29')](_0x294097[_0x1734('0x28')]);if(_0x2a71cf[_0x1734('0x24')]>0x0){return _0xe86f1f[_0x1734('0x16')](0x190)['json'](_0x2a71cf);}var _0x141f68=_0x294097[_0x1734('0x28')][_0x1734('0x2b')];var _0x47cd87=_0x294097[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x141f68)[_0x1734('0x1a')](function(_0x441c62){logger['info'](_0x1734('0x2e'),_0x441c62[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x441c62[_0x1734('0x17')]),'webbar:unhold',{'sessionId':_0x47cd87});return _0xe86f1f[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x1734('0x1c')](handleError(_0xe86f1f));};exports[_0x1734('0x3d')]=function(_0x4ae49c,_0x4ff6a9){logger[_0x1734('0x12')](_0x1734('0x3e'),_0x4ff6a9['body']);var _0x515e39=callsValidation['validate'](_0x4ae49c[_0x1734('0x28')]);if(_0x515e39[_0x1734('0x24')]>0x0){return _0x4ff6a9[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x515e39);}var _0x54ef53=_0x4ae49c['body'][_0x1734('0x2b')];var _0x7872f5=respondWithRpcPromise('VoiceChannels');var _0x349b6a=getAgent(_0x54ef53);return Promise[_0x1734('0x3f')]([_0x7872f5,_0x349b6a])[_0x1734('0x1a')](function(_0x553daf){var _0xfcc609=_0x553daf[0x0];var _0x371a48=_0x553daf[0x1];var _0x28c467=_[_0x1734('0x21')](_0xfcc609[_0x1734('0x40')],function(_0x41469e){return _0x41469e[_0x1734('0x22')]==_0x371a48['id'];});return _0x4ff6a9[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'count':_0x28c467['length'],'rows':_0x28c467});})[_0x1734('0x1c')](handleError(_0x4ff6a9));};exports[_0x1734('0x41')]=function(_0x16bea9,_0x3a4d5b){logger[_0x1734('0x12')](_0x1734('0x42'),_0x16bea9[_0x1734('0x28')]);var _0x30848e=conferenceValidation[_0x1734('0x29')](_0x16bea9[_0x1734('0x28')]);if(_0x30848e[_0x1734('0x24')]>0x0){return _0x3a4d5b['status'](0x190)[_0x1734('0x2a')](_0x30848e);}var _0x25f2fd=_0x16bea9[_0x1734('0x28')][_0x1734('0x2b')];return getAgent(_0x25f2fd)[_0x1734('0x1a')](function(_0xa43585){logger[_0x1734('0x12')]('entityFound:',_0xa43585[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0xa43585[_0x1734('0x17')]),_0x1734('0x43'));return _0x3a4d5b[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x1734('0x1c')](handleError(_0x3a4d5b));};exports['transfer']=function(_0x41fdf2,_0xc91e7a){logger[_0x1734('0x12')](_0x1734('0x44'),_0x41fdf2['body']);var _0x586418=transferValidation['validate'](_0x41fdf2[_0x1734('0x28')]);if(_0x586418[_0x1734('0x24')]>0x0){return _0xc91e7a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x586418);}var _0x387aac=_0x41fdf2[_0x1734('0x28')][_0x1734('0x2b')];var _0x2d3a75=_0x41fdf2['body'][_0x1734('0x23')];var _0x4fd501=_0x41fdf2['body'][_0x1734('0x45')];return getAgent(_0x387aac)[_0x1734('0x1a')](function(_0x31ec5b){logger['info'](_0x1734('0x2e'),_0x31ec5b[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x31ec5b[_0x1734('0x17')]),_0x1734('0x46'),{'sessionId':_0x2d3a75,'transferNumber':_0x4fd501});return _0xc91e7a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc91e7a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 4ef45a0..1513527 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 _0x87f1=['./whatsappAccount.controller','get','isAuthenticated','index','/describe','show','getDispositions','getAnswers','/:id/users','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','send','/:id','delete','destroy','removeDispositions','removeAnswers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2dea50,_0x5b097a){var _0x570e04=function(_0x3c08b0){while(--_0x3c08b0){_0x2dea50['push'](_0x2dea50['shift']());}};_0x570e04(++_0x5b097a);}(_0x87f1,0x7c));var _0x187f=function(_0x381e6b,_0x4f566d){_0x381e6b=_0x381e6b-0x0;var _0x1bbe8f=_0x87f1[_0x381e6b];return _0x1bbe8f;};'use strict';var multer=require(_0x187f('0x0'));var util=require('util');var path=require(_0x187f('0x1'));var timeout=require(_0x187f('0x2'));var express=require(_0x187f('0x3'));var router=express[_0x187f('0x4')]();var fs_extra=require(_0x187f('0x5'));var auth=require(_0x187f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x187f('0x7'));var controller=require(_0x187f('0x8'));router[_0x187f('0x9')]('/',auth[_0x187f('0xa')](),controller[_0x187f('0xb')]);router[_0x187f('0x9')](_0x187f('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x187f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x187f('0xd')]);router[_0x187f('0x9')]('/:id/dispositions',auth[_0x187f('0xa')](),controller[_0x187f('0xe')]);router['get']('/:id/canned_answers',auth[_0x187f('0xa')](),controller[_0x187f('0xf')]);router[_0x187f('0x9')](_0x187f('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x187f('0x9')](_0x187f('0x11'),auth[_0x187f('0xa')](),controller[_0x187f('0x12')]);router[_0x187f('0x13')]('/',auth[_0x187f('0xa')](),controller[_0x187f('0x14')]);router['post'](_0x187f('0x15'),auth[_0x187f('0xa')](),controller[_0x187f('0x16')]);router[_0x187f('0x13')](_0x187f('0x17'),auth[_0x187f('0xa')](),controller[_0x187f('0x18')]);router[_0x187f('0x13')](_0x187f('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x187f('0x13')](_0x187f('0x11'),auth['isAuthenticated'](),controller['addApplications']);router[_0x187f('0x13')](_0x187f('0x19'),controller['notify']);router[_0x187f('0x13')]('/:id/send',auth[_0x187f('0xa')](),controller[_0x187f('0x1a')]);router['put'](_0x187f('0x1b'),auth['isAuthenticated'](),controller['update']);router[_0x187f('0x1c')](_0x187f('0x1b'),auth[_0x187f('0xa')](),controller[_0x187f('0x1d')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x187f('0x1e')]);router[_0x187f('0x1c')](_0x187f('0x17'),auth['isAuthenticated'](),controller[_0x187f('0x1f')]);router[_0x187f('0x1c')](_0x187f('0x10'),auth[_0x187f('0xa')](),controller['removeAgents']);module[_0x187f('0x20')]=router; \ No newline at end of file +var _0x93d7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','get','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/users','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x93d7,0x124));var _0x793d=function(_0x27dc30,_0x34ca38){_0x27dc30=_0x27dc30-0x0;var _0x5c3294=_0x93d7[_0x27dc30];return _0x5c3294;};'use strict';var multer=require(_0x793d('0x0'));var util=require(_0x793d('0x1'));var path=require('path');var timeout=require(_0x793d('0x2'));var express=require(_0x793d('0x3'));var router=express[_0x793d('0x4')]();var fs_extra=require(_0x793d('0x5'));var auth=require(_0x793d('0x6'));var interaction=require(_0x793d('0x7'));var config=require('../../config/environment');var controller=require(_0x793d('0x8'));router['get']('/',auth[_0x793d('0x9')](),controller[_0x793d('0xa')]);router['get']('/describe',auth[_0x793d('0x9')](),controller['describe']);router['get'](_0x793d('0xb'),auth['isAuthenticated'](),controller[_0x793d('0xc')]);router['get'](_0x793d('0xd'),auth[_0x793d('0x9')](),controller[_0x793d('0xe')]);router[_0x793d('0xf')](_0x793d('0x10'),auth[_0x793d('0x9')](),controller[_0x793d('0x11')]);router[_0x793d('0xf')]('/:id/users',auth[_0x793d('0x9')](),controller[_0x793d('0x12')]);router[_0x793d('0xf')](_0x793d('0x13'),auth[_0x793d('0x9')](),controller[_0x793d('0x14')]);router[_0x793d('0x15')]('/',auth[_0x793d('0x9')](),controller[_0x793d('0x16')]);router[_0x793d('0x15')]('/:id/dispositions',auth[_0x793d('0x9')](),controller[_0x793d('0x17')]);router[_0x793d('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x793d('0x15')](_0x793d('0x18'),auth[_0x793d('0x9')](),controller['addAgents']);router[_0x793d('0x15')]('/:id/applications',auth[_0x793d('0x9')](),controller[_0x793d('0x19')]);router['post'](_0x793d('0x1a'),controller[_0x793d('0x1b')]);router[_0x793d('0x15')](_0x793d('0x1c'),auth['isAuthenticated'](),controller[_0x793d('0x1d')]);router[_0x793d('0x1e')](_0x793d('0xb'),auth[_0x793d('0x9')](),controller[_0x793d('0x1f')]);router[_0x793d('0x20')]('/:id',auth[_0x793d('0x9')](),controller['destroy']);router[_0x793d('0x20')](_0x793d('0xd'),auth[_0x793d('0x9')](),controller[_0x793d('0x21')]);router['delete'](_0x793d('0x10'),auth[_0x793d('0x9')](),controller[_0x793d('0x22')]);router[_0x793d('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0x793d('0x23')]);module[_0x793d('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 48bf8b7..ec9b4de 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 _0x3c4b=['STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x4937be,_0x4b1982){var _0x3f46b6=function(_0x1f5095){while(--_0x1f5095){_0x4937be['push'](_0x4937be['shift']());}};_0x3f46b6(++_0x4b1982);}(_0x3c4b,0x151));var _0xb3c4=function(_0x39246e,_0x18e34c){_0x39246e=_0x39246e-0x0;var _0x4c0f75=_0x3c4b[_0x39246e];return _0x4c0f75;};'use strict';var Sequelize=require(_0xb3c4('0x0'));var rs=require(_0xb3c4('0x1'));module[_0xb3c4('0x2')]={'name':{'type':Sequelize[_0xb3c4('0x3')],'unique':_0xb3c4('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb3c4('0x3')],'defaultValue':function(){return rs[_0xb3c4('0x5')]();}},'phone':{'type':Sequelize[_0xb3c4('0x3')]},'type':{'type':Sequelize[_0xb3c4('0x6')](_0xb3c4('0x7'),_0xb3c4('0x8'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xb3c4('0x3')]},'authToken':{'type':Sequelize[_0xb3c4('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb3c4('0x9')],'defaultValue':function(){return _0xb3c4('0xa');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb3c4('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb3c4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb3c4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb3c4('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb3c4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb3c4('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb3c4('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb3c4('0xd')},'mandatoryDisposition':{'type':Sequelize[_0xb3c4('0xb')],'defaultValue':![],'comment':_0xb3c4('0xe'),'set':function(_0x22234d){if(!_0x22234d){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0xb3c4('0xf')](_0xb3c4('0x10'),_0x22234d);}},'description':{'type':Sequelize[_0xb3c4('0x3')]}}; \ No newline at end of file +var _0x529c=['name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','randomstring','exports','STRING'];(function(_0x53758c,_0x5664af){var _0x425eff=function(_0x3d0c89){while(--_0x3d0c89){_0x53758c['push'](_0x53758c['shift']());}};_0x425eff(++_0x5664af);}(_0x529c,0x164));var _0xc529=function(_0x42e394,_0x4392e3){_0x42e394=_0x42e394-0x0;var _0x1fd797=_0x529c[_0x42e394];return _0x1fd797;};'use strict';var Sequelize=require(_0xc529('0x0'));var rs=require(_0xc529('0x1'));module[_0xc529('0x2')]={'name':{'type':Sequelize[_0xc529('0x3')],'unique':_0xc529('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xc529('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xc529('0x3')],'defaultValue':function(){return rs[_0xc529('0x5')]();}},'phone':{'type':Sequelize[_0xc529('0x3')]},'type':{'type':Sequelize[_0xc529('0x6')](_0xc529('0x7'),_0xc529('0x8'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xc529('0x3')]},'authToken':{'type':Sequelize[_0xc529('0x3')]},'notificationTemplate':{'type':Sequelize[_0xc529('0x9')],'defaultValue':function(){return _0xc529('0xa');}},'notificationSound':{'type':Sequelize[_0xc529('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc529('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc529('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc529('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc529('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc529('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc529('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xc529('0xd')},'mandatoryDisposition':{'type':Sequelize[_0xc529('0xb')],'defaultValue':![],'comment':_0xc529('0xe'),'set':function(_0xf51641){if(!_0xf51641){this['setDataValue']('mandatoryDispositionPauseId',null);}this['setDataValue']('mandatoryDisposition',_0xf51641);}},'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 300895a..6f57a0f 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 _0xb4af=['userWhatsappAccount:remove','getAgents','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','CmContact','contact','WhatsappInteraction','interaction','created','push','unmanaged','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','map','WhatsappAccount','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','includeAll','include','rows','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','describe','Disposition','getDispositions','WhatsappAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','options','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents'];(function(_0x6cb701,_0x6e56db){var _0x28259e=function(_0x556354){while(--_0x556354){_0x6cb701['push'](_0x6cb701['shift']());}};_0x28259e(++_0x6e56db);}(_0xb4af,0x114));var _0xfb4a=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xb4af[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0xfb4a('0x0'));var rimraf=require(_0xfb4a('0x1'));var zipdir=require(_0xfb4a('0x2'));var jsonpatch=require(_0xfb4a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfb4a('0x4'));var Mustache=require('mustache');var util=require(_0xfb4a('0x5'));var path=require(_0xfb4a('0x6'));var sox=require(_0xfb4a('0x7'));var csv=require(_0xfb4a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb4a('0x9'));var _=require(_0xfb4a('0xa'));var squel=require(_0xfb4a('0xb'));var crypto=require(_0xfb4a('0xc'));var jsforce=require(_0xfb4a('0xd'));var deskjs=require(_0xfb4a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfb4a('0xf'));var Papa=require(_0xfb4a('0x10'));var Redis=require('ioredis');var authService=require(_0xfb4a('0x11'));var qs=require(_0xfb4a('0x12'));var as=require(_0xfb4a('0x13'));var hardwareService=require(_0xfb4a('0x14'));var logger=require(_0xfb4a('0x15'))(_0xfb4a('0x16'));var utils=require('../../config/utils');var config=require(_0xfb4a('0x17'));var licenseUtil=require(_0xfb4a('0x18'));var db=require(_0xfb4a('0x19'))['db'];config[_0xfb4a('0x1a')]=_[_0xfb4a('0x1b')](config[_0xfb4a('0x1a')],{'host':_0xfb4a('0x1c'),'port':0x18eb});var socket=require(_0xfb4a('0x1d'))(new Redis(config[_0xfb4a('0x1a')]));require(_0xfb4a('0x1e'))[_0xfb4a('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x58993c,_0x541f6b,_0x396712,_0x325dbf){return new BPromise(function(_0x5aa526,_0x14f583){var _0x422988=_0x325dbf||client;return _0x422988[_0xfb4a('0x20')](_0x58993c,_0x396712)['then'](function(_0x1105cd){logger['info'](_0xfb4a('0x21'),_0x541f6b,_0xfb4a('0x22'));logger[_0xfb4a('0x23')](_0xfb4a('0x24'),_0x541f6b,_0xfb4a('0x22'),JSON[_0xfb4a('0x25')](_0x1105cd));if(_0x1105cd[_0xfb4a('0x26')]){if(_0x1105cd['error']['code']===0x1f4){logger[_0xfb4a('0x26')](_0xfb4a('0x21'),_0x541f6b,_0x1105cd[_0xfb4a('0x26')]['message']);return _0x14f583(_0x1105cd[_0xfb4a('0x26')][_0xfb4a('0x27')]);}logger['error'](_0xfb4a('0x21'),_0x541f6b,_0x1105cd[_0xfb4a('0x26')]['message']);return _0x5aa526(_0x1105cd['error']['message']);}else{logger[_0xfb4a('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x541f6b,_0xfb4a('0x22'));_0x5aa526(_0x1105cd[_0xfb4a('0x29')][_0xfb4a('0x27')]);}})[_0xfb4a('0x2a')](function(_0x5999ee){logger[_0xfb4a('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x541f6b,_0x5999ee);_0x14f583(_0x5999ee);});});}function respondWithStatusCode(_0x426790,_0x21cd01){_0x21cd01=_0x21cd01||0xcc;return function(_0x1bc326){if(_0x1bc326){return _0x426790[_0xfb4a('0x2b')](_0x21cd01);}return _0x426790[_0xfb4a('0x2c')](_0x21cd01)[_0xfb4a('0x2d')]();};}function respondWithResult(_0x3e9639,_0x2791f8){_0x2791f8=_0x2791f8||0xc8;return function(_0x3dbe06){if(_0x3dbe06){return _0x3e9639['status'](_0x2791f8)[_0xfb4a('0x2e')](_0x3dbe06);}};}function respondWithFilteredResult(_0x338b78,_0x1927d1){return function(_0x99fb58){if(_0x99fb58){var _0xe01003=typeof _0x1927d1[_0xfb4a('0x2f')]===_0xfb4a('0x30')&&typeof _0x1927d1[_0xfb4a('0x31')]===_0xfb4a('0x30');var _0x4d8ec6=_0x99fb58['count'];var _0x47e926=_0xe01003?0x0:_0x1927d1['offset'];var _0x33409d=_0xe01003?_0x99fb58[_0xfb4a('0x32')]:_0x1927d1['offset']+_0x1927d1['limit'];var _0x210dde;if(_0x33409d>=_0x4d8ec6){_0x33409d=_0x4d8ec6;_0x210dde=0xc8;}else{_0x210dde=0xce;}_0x338b78['status'](_0x210dde);return _0x338b78[_0xfb4a('0x33')](_0xfb4a('0x34'),_0x47e926+'-'+_0x33409d+'/'+_0x4d8ec6)['json'](_0x99fb58);}return null;};}function patchUpdates(_0x4e25c7){return function(_0xd26ee2){try{jsonpatch['apply'](_0xd26ee2,_0x4e25c7,!![]);}catch(_0x59e465){return BPromise[_0xfb4a('0x35')](_0x59e465);}return _0xd26ee2[_0xfb4a('0x36')]();};}function saveUpdates(_0x56c206,_0x4fe8d6){return function(_0x1b7c46){if(_0x1b7c46){return _0x1b7c46[_0xfb4a('0x37')](_0x56c206)[_0xfb4a('0x38')](function(_0x24bebf){return _0x24bebf;});}return null;};}function removeEntity(_0x4f215a,_0x252602){return function(_0x2f96c0){if(_0x2f96c0){return _0x2f96c0[_0xfb4a('0x39')]()[_0xfb4a('0x38')](function(){var _0x4d8077=_0x2f96c0[_0xfb4a('0x3a')]({'plain':!![]});var _0x2d1286=_0xfb4a('0x3b');return db[_0xfb4a('0x3c')]['destroy']({'where':{'type':_0x2d1286,'resourceId':_0x4d8077['id']}})[_0xfb4a('0x38')](function(){return _0x2f96c0;});})[_0xfb4a('0x38')](function(){_0x4f215a[_0xfb4a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8f4253,_0x505ef8){return function(_0x5bcb44){if(!_0x5bcb44){_0x8f4253[_0xfb4a('0x2b')](0x194);}return _0x5bcb44;};}function handleError(_0x34af19,_0x4c606d){_0x4c606d=_0x4c606d||0x1f4;return function(_0xe3b68a){logger[_0xfb4a('0x26')](_0xe3b68a[_0xfb4a('0x3d')]);if(_0xe3b68a[_0xfb4a('0x3e')]){delete _0xe3b68a[_0xfb4a('0x3e')];}_0x34af19[_0xfb4a('0x2c')](_0x4c606d)[_0xfb4a('0x3f')](_0xe3b68a);};}exports[_0xfb4a('0x40')]=function(_0x1f1cec,_0x3d6164){var _0x354a32={'include':[{'model':db[_0xfb4a('0x41')],'as':'mandatoryDispositionPause'}]},_0x4d3491={},_0x2cc511={'count':0x0,'rows':[]};var _0x454ef9=_[_0xfb4a('0x42')](db[_0xfb4a('0x43')]['rawAttributes'],function(_0x185f09){return{'name':_0x185f09[_0xfb4a('0x44')],'type':_0x185f09['type'][_0xfb4a('0x45')]};});_0x4d3491[_0xfb4a('0x46')]=_[_0xfb4a('0x42')](_0x454ef9,_0xfb4a('0x3e'));_0x4d3491[_0xfb4a('0x47')]=_[_0xfb4a('0x48')](_0x1f1cec[_0xfb4a('0x47')]);_0x4d3491['filters']=_[_0xfb4a('0x49')](_0x4d3491[_0xfb4a('0x46')],_0x4d3491['query']);_0x354a32[_0xfb4a('0x4a')]=_[_0xfb4a('0x49')](_0x4d3491[_0xfb4a('0x46')],qs[_0xfb4a('0x4b')](_0x1f1cec[_0xfb4a('0x47')][_0xfb4a('0x4b')]));_0x354a32[_0xfb4a('0x4a')]=_0x354a32[_0xfb4a('0x4a')][_0xfb4a('0x4c')]?_0x354a32[_0xfb4a('0x4a')]:_0x4d3491['model'];if(!_0x1f1cec[_0xfb4a('0x47')][_0xfb4a('0x4d')](_0xfb4a('0x4e'))){_0x354a32[_0xfb4a('0x31')]=qs[_0xfb4a('0x31')](_0x1f1cec[_0xfb4a('0x47')][_0xfb4a('0x31')]);_0x354a32[_0xfb4a('0x2f')]=qs[_0xfb4a('0x2f')](_0x1f1cec[_0xfb4a('0x47')][_0xfb4a('0x2f')]);}_0x354a32[_0xfb4a('0x4f')]=qs[_0xfb4a('0x50')](_0x1f1cec[_0xfb4a('0x47')][_0xfb4a('0x50')]);_0x354a32['where']=qs[_0xfb4a('0x51')](_[_0xfb4a('0x52')](_0x1f1cec[_0xfb4a('0x47')],_0x4d3491['filters']),_0x454ef9);if(_0x1f1cec['query'][_0xfb4a('0x53')]){_0x354a32['where']=_['merge'](_0x354a32[_0xfb4a('0x54')],{'$or':_[_0xfb4a('0x42')](_0x454ef9,function(_0x398674){if(_0x398674[_0xfb4a('0x55')]!==_0xfb4a('0x56')){var _0xdd1b70={};_0xdd1b70[_0x398674[_0xfb4a('0x3e')]]={'$like':'%'+_0x1f1cec[_0xfb4a('0x47')][_0xfb4a('0x53')]+'%'};return _0xdd1b70;}})});}_0x354a32=_[_0xfb4a('0x57')]({},_0x354a32,_0x1f1cec['options']);var _0x48934d={'where':_0x354a32[_0xfb4a('0x54')]};return db[_0xfb4a('0x43')][_0xfb4a('0x32')](_0x48934d)['then'](function(_0x523600){_0x2cc511[_0xfb4a('0x32')]=_0x523600;if(_0x1f1cec['query'][_0xfb4a('0x58')]){_0x354a32[_0xfb4a('0x59')]=[{'all':!![]}];}return db[_0xfb4a('0x43')]['findAll'](_0x354a32);})[_0xfb4a('0x38')](function(_0x1dcce2){_0x2cc511[_0xfb4a('0x5a')]=_0x1dcce2;return _0x2cc511;})[_0xfb4a('0x38')](respondWithFilteredResult(_0x3d6164,_0x354a32))['catch'](handleError(_0x3d6164,null));};exports[_0xfb4a('0x5b')]=function(_0x493c29,_0x49b1e8){var _0x4d254a={'raw':![],'where':{'id':_0x493c29[_0xfb4a('0x5c')]['id']},'include':[{'model':db[_0xfb4a('0x41')],'as':'mandatoryDispositionPause'}]},_0x515647={};_0x515647['model']=_[_0xfb4a('0x48')](db['WhatsappAccount'][_0xfb4a('0x5d')]);_0x515647[_0xfb4a('0x47')]=_[_0xfb4a('0x48')](_0x493c29[_0xfb4a('0x47')]);_0x515647[_0xfb4a('0x51')]=_['intersection'](_0x515647[_0xfb4a('0x46')],_0x515647[_0xfb4a('0x47')]);_0x4d254a[_0xfb4a('0x4a')]=_[_0xfb4a('0x49')](_0x515647[_0xfb4a('0x46')],qs[_0xfb4a('0x4b')](_0x493c29['query'][_0xfb4a('0x4b')]));_0x4d254a[_0xfb4a('0x4a')]=_0x4d254a[_0xfb4a('0x4a')][_0xfb4a('0x4c')]?_0x4d254a[_0xfb4a('0x4a')]:_0x515647[_0xfb4a('0x46')];if(_0x493c29[_0xfb4a('0x47')][_0xfb4a('0x58')]){_0x4d254a[_0xfb4a('0x59')]=[{'all':!![]}];}_0x4d254a=_[_0xfb4a('0x57')]({},_0x4d254a,_0x493c29['options']);return db[_0xfb4a('0x43')][_0xfb4a('0x5e')](_0x4d254a)['then'](handleEntityNotFound(_0x49b1e8,null))[_0xfb4a('0x38')](respondWithResult(_0x49b1e8,null))[_0xfb4a('0x2a')](handleError(_0x49b1e8,null));};exports[_0xfb4a('0x5f')]=function(_0x2dce55,_0x256797){return db[_0xfb4a('0x43')][_0xfb4a('0x5f')](_0x2dce55['body'],{})[_0xfb4a('0x38')](function(_0x303fe7){var _0x151abc=_0x2dce55[_0xfb4a('0x60')][_0xfb4a('0x3a')]({'plain':!![]});if(!_0x151abc)throw new Error(_0xfb4a('0x61'));if(_0x151abc[_0xfb4a('0x62')]==='user'){var _0x3726a9=_0x303fe7[_0xfb4a('0x3a')]({'plain':!![]});var _0x266055=_0xfb4a('0x3b');return db['UserProfileSection'][_0xfb4a('0x5e')]({'where':{'name':_0x266055,'userProfileId':_0x151abc[_0xfb4a('0x63')]},'raw':!![]})[_0xfb4a('0x38')](function(_0xa79539){if(_0xa79539&&_0xa79539[_0xfb4a('0x64')]===0x0){return db[_0xfb4a('0x3c')][_0xfb4a('0x5f')]({'name':_0x3726a9[_0xfb4a('0x3e')],'resourceId':_0x3726a9['id'],'type':_0xa79539['name'],'sectionId':_0xa79539['id']},{})[_0xfb4a('0x38')](function(){return _0x303fe7;});}else{return _0x303fe7;}})[_0xfb4a('0x2a')](function(_0x58f45b){logger[_0xfb4a('0x26')](_0xfb4a('0x65'),_0x58f45b);throw _0x58f45b;});}return _0x303fe7;})['then'](respondWithResult(_0x256797,0xc9))[_0xfb4a('0x2a')](handleError(_0x256797,null));};exports['update']=function(_0x52d745,_0x1d721d){if(_0x52d745['body']['id']){delete _0x52d745[_0xfb4a('0x66')]['id'];}return db['WhatsappAccount'][_0xfb4a('0x5e')]({'where':{'id':_0x52d745['params']['id']},'include':[{'model':db[_0xfb4a('0x41')],'as':_0xfb4a('0x67')}]})['then'](handleEntityNotFound(_0x1d721d,null))[_0xfb4a('0x38')](saveUpdates(_0x52d745[_0xfb4a('0x66')],null))[_0xfb4a('0x38')](respondWithResult(_0x1d721d,null))[_0xfb4a('0x2a')](handleError(_0x1d721d,null));};exports[_0xfb4a('0x39')]=function(_0x45e6bb,_0x5c9f8d){return db[_0xfb4a('0x43')][_0xfb4a('0x5e')]({'where':{'id':_0x45e6bb[_0xfb4a('0x5c')]['id']}})[_0xfb4a('0x38')](handleEntityNotFound(_0x5c9f8d,null))[_0xfb4a('0x38')](removeEntity(_0x5c9f8d,null))[_0xfb4a('0x2a')](handleError(_0x5c9f8d,null));};exports['describe']=function(_0x2e5cbc,_0x4a1316){return db['WhatsappAccount'][_0xfb4a('0x68')]()[_0xfb4a('0x38')](respondWithResult(_0x4a1316,null))[_0xfb4a('0x2a')](handleError(_0x4a1316,null));};exports['addDisposition']=function(_0x4a566c,_0x382cad,_0x13bff6){if(_0x4a566c[_0xfb4a('0x66')]['id']){delete _0x4a566c['body']['id'];}return db[_0xfb4a('0x43')][_0xfb4a('0x5e')]({'where':{'id':_0x4a566c[_0xfb4a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x382cad,null))[_0xfb4a('0x38')](function(_0x3df0ef){if(_0x3df0ef){_0x4a566c[_0xfb4a('0x66')]['WhatsappAccountId']=_0x3df0ef['id'];return db[_0xfb4a('0x69')][_0xfb4a('0x5f')](_0x4a566c['body']);}})[_0xfb4a('0x38')](respondWithResult(_0x382cad,null))[_0xfb4a('0x2a')](handleError(_0x382cad,null));};exports[_0xfb4a('0x6a')]=function(_0x21d4c5,_0x23ed18,_0x3747d2){var _0x50095b={'raw':![],'where':{}};var _0x84509d={};var _0x4fd831={'count':0x0,'rows':[]};return db[_0xfb4a('0x43')]['findOne']({'where':{'id':_0x21d4c5[_0xfb4a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x23ed18,null))[_0xfb4a('0x38')](function(_0x2bd2f3){if(_0x2bd2f3){_0x84509d[_0xfb4a('0x46')]=_[_0xfb4a('0x48')](db['Disposition']['rawAttributes']);_0x84509d['query']=_[_0xfb4a('0x48')](_0x21d4c5['query']);_0x84509d[_0xfb4a('0x51')]=_[_0xfb4a('0x49')](_0x84509d[_0xfb4a('0x46')],_0x84509d[_0xfb4a('0x47')]);_0x50095b[_0xfb4a('0x4a')]=_['intersection'](_0x84509d[_0xfb4a('0x46')],qs[_0xfb4a('0x4b')](_0x21d4c5[_0xfb4a('0x47')][_0xfb4a('0x4b')]));_0x50095b[_0xfb4a('0x4a')]=_0x50095b[_0xfb4a('0x4a')][_0xfb4a('0x4c')]?_0x50095b[_0xfb4a('0x4a')]:_0x84509d[_0xfb4a('0x46')];if(!_0x21d4c5[_0xfb4a('0x47')]['hasOwnProperty'](_0xfb4a('0x4e'))){_0x50095b[_0xfb4a('0x31')]=qs['limit'](_0x21d4c5[_0xfb4a('0x47')][_0xfb4a('0x31')]);_0x50095b[_0xfb4a('0x2f')]=qs[_0xfb4a('0x2f')](_0x21d4c5[_0xfb4a('0x47')][_0xfb4a('0x2f')]);}_0x50095b[_0xfb4a('0x4f')]=qs[_0xfb4a('0x50')](_0x21d4c5[_0xfb4a('0x47')][_0xfb4a('0x50')]);_0x50095b[_0xfb4a('0x54')]=qs['filters'](_[_0xfb4a('0x52')](_0x21d4c5['query'],_0x84509d[_0xfb4a('0x51')]));_0x50095b[_0xfb4a('0x54')][_0xfb4a('0x6b')]=_0x2bd2f3['id'];if(_0x21d4c5[_0xfb4a('0x47')][_0xfb4a('0x53')]){_0x50095b[_0xfb4a('0x54')]=_[_0xfb4a('0x57')](_0x50095b[_0xfb4a('0x54')],{'$or':_[_0xfb4a('0x42')](_0x50095b[_0xfb4a('0x4a')],function(_0xba5bdc){var _0xe84c1c={};_0xe84c1c[_0xba5bdc]={'$like':'%'+_0x21d4c5[_0xfb4a('0x47')][_0xfb4a('0x53')]+'%'};return _0xe84c1c;})});}_0x50095b=_['merge']({},_0x50095b,_0x21d4c5['options']);return db[_0xfb4a('0x69')]['count']({'where':_0x50095b[_0xfb4a('0x54')]})[_0xfb4a('0x38')](function(_0x10bd97){_0x4fd831[_0xfb4a('0x32')]=_0x10bd97;if(_0x21d4c5[_0xfb4a('0x47')][_0xfb4a('0x58')]){_0x50095b[_0xfb4a('0x59')]=[{'all':!![]}];}return db[_0xfb4a('0x69')][_0xfb4a('0x6c')](_0x50095b);})['then'](function(_0x260355){_0x4fd831[_0xfb4a('0x5a')]=_0x260355;return _0x4fd831;});}})[_0xfb4a('0x38')](respondWithFilteredResult(_0x23ed18,_0x50095b))[_0xfb4a('0x2a')](handleError(_0x23ed18,null));};exports[_0xfb4a('0x6d')]=function(_0x57b8b9,_0xa2bbe8,_0x3ff209){return db[_0xfb4a('0x43')][_0xfb4a('0x5e')]({'where':{'id':_0x57b8b9[_0xfb4a('0x5c')]['id']}})[_0xfb4a('0x38')](handleEntityNotFound(_0xa2bbe8,null))[_0xfb4a('0x38')](function(_0x239dfe){if(_0x239dfe){return _0x239dfe['removeDispositions'](_0x57b8b9[_0xfb4a('0x47')][_0xfb4a('0x6e')]);}})[_0xfb4a('0x38')](respondWithStatusCode(_0xa2bbe8,null))[_0xfb4a('0x2a')](handleError(_0xa2bbe8,null));};exports[_0xfb4a('0x6f')]=function(_0x1fc51a,_0x518ca0,_0x1d9360){if(_0x1fc51a[_0xfb4a('0x66')]['id']){delete _0x1fc51a[_0xfb4a('0x66')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x1fc51a[_0xfb4a('0x5c')]['id']}})[_0xfb4a('0x38')](handleEntityNotFound(_0x518ca0,null))[_0xfb4a('0x38')](function(_0x13736f){if(_0x13736f){_0x1fc51a[_0xfb4a('0x66')][_0xfb4a('0x6b')]=_0x13736f['id'];return db[_0xfb4a('0x70')][_0xfb4a('0x5f')](_0x1fc51a[_0xfb4a('0x66')]);}})[_0xfb4a('0x38')](respondWithResult(_0x518ca0,null))[_0xfb4a('0x2a')](handleError(_0x518ca0,null));};exports['getAnswers']=function(_0x1a1850,_0xc4c437,_0x163ab5){var _0x388ab1={'raw':![],'where':{}};var _0x41a077={};var _0x4ae562={'count':0x0,'rows':[]};return db[_0xfb4a('0x43')][_0xfb4a('0x71')]({'where':{'id':_0x1a1850[_0xfb4a('0x5c')]['id']}})[_0xfb4a('0x38')](handleEntityNotFound(_0xc4c437,null))[_0xfb4a('0x38')](function(_0x28ea30){if(_0x28ea30){_0x41a077['model']=_[_0xfb4a('0x48')](db[_0xfb4a('0x70')][_0xfb4a('0x5d')]);_0x41a077[_0xfb4a('0x47')]=_[_0xfb4a('0x48')](_0x1a1850['query']);_0x41a077['filters']=_[_0xfb4a('0x49')](_0x41a077[_0xfb4a('0x46')],_0x41a077[_0xfb4a('0x47')]);_0x388ab1[_0xfb4a('0x4a')]=_['intersection'](_0x41a077[_0xfb4a('0x46')],qs['fields'](_0x1a1850[_0xfb4a('0x47')][_0xfb4a('0x4b')]));_0x388ab1[_0xfb4a('0x4a')]=_0x388ab1[_0xfb4a('0x4a')][_0xfb4a('0x4c')]?_0x388ab1[_0xfb4a('0x4a')]:_0x41a077[_0xfb4a('0x46')];if(!_0x1a1850[_0xfb4a('0x47')][_0xfb4a('0x4d')](_0xfb4a('0x4e'))){_0x388ab1[_0xfb4a('0x31')]=qs['limit'](_0x1a1850[_0xfb4a('0x47')][_0xfb4a('0x31')]);_0x388ab1['offset']=qs[_0xfb4a('0x2f')](_0x1a1850['query']['offset']);}_0x388ab1[_0xfb4a('0x4f')]=qs[_0xfb4a('0x50')](_0x1a1850[_0xfb4a('0x47')]['sort']);_0x388ab1[_0xfb4a('0x54')]=qs['filters'](_['pick'](_0x1a1850['query'],_0x41a077['filters']));_0x388ab1[_0xfb4a('0x54')][_0xfb4a('0x6b')]=_0x28ea30['id'];if(_0x1a1850[_0xfb4a('0x47')][_0xfb4a('0x53')]){_0x388ab1[_0xfb4a('0x54')]=_[_0xfb4a('0x57')](_0x388ab1[_0xfb4a('0x54')],{'$or':_[_0xfb4a('0x42')](_0x388ab1['attributes'],function(_0xf6ee92){var _0x33fc68={};_0x33fc68[_0xf6ee92]={'$like':'%'+_0x1a1850[_0xfb4a('0x47')][_0xfb4a('0x53')]+'%'};return _0x33fc68;})});}_0x388ab1=_[_0xfb4a('0x57')]({},_0x388ab1,_0x1a1850[_0xfb4a('0x72')]);return db[_0xfb4a('0x70')]['count']({'where':_0x388ab1['where']})['then'](function(_0xfe8b61){_0x4ae562[_0xfb4a('0x32')]=_0xfe8b61;if(_0x1a1850[_0xfb4a('0x47')][_0xfb4a('0x58')]){_0x388ab1['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xfb4a('0x6c')](_0x388ab1);})[_0xfb4a('0x38')](function(_0x322f2d){_0x4ae562['rows']=_0x322f2d;return _0x4ae562;});}})[_0xfb4a('0x38')](respondWithFilteredResult(_0xc4c437,_0x388ab1))['catch'](handleError(_0xc4c437,null));};exports[_0xfb4a('0x73')]=function(_0xb744c5,_0x3b7da7,_0x4fe1e7){return db[_0xfb4a('0x43')]['find']({'where':{'id':_0xb744c5[_0xfb4a('0x5c')]['id']}})[_0xfb4a('0x38')](handleEntityNotFound(_0x3b7da7,null))[_0xfb4a('0x38')](function(_0x125652){if(_0x125652){return _0x125652[_0xfb4a('0x73')](_0xb744c5[_0xfb4a('0x47')][_0xfb4a('0x6e')]);}})['then'](respondWithStatusCode(_0x3b7da7,null))[_0xfb4a('0x2a')](handleError(_0x3b7da7,null));};exports[_0xfb4a('0x74')]=function(_0xacc416,_0x22b523,_0x51d14b){return db[_0xfb4a('0x43')]['find']({'where':{'id':_0xacc416[_0xfb4a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x22b523,null))['then'](function(_0x2b6158){if(_0x2b6158){return _0x2b6158[_0xfb4a('0x74')](_0xacc416['body'][_0xfb4a('0x6e')],_[_0xfb4a('0x75')](_0xacc416[_0xfb4a('0x66')],[_0xfb4a('0x6e'),'id'])||{})[_0xfb4a('0x76')](function(_0x1a4637){for(var _0x4e7b4c=0x0;_0x4e7b4c<_0xacc416[_0xfb4a('0x66')]['ids'][_0xfb4a('0x4c')];_0x4e7b4c+=0x1){socket[_0xfb4a('0x77')](_0xfb4a('0x78'),{'UserId':Number(_0xacc416['body'][_0xfb4a('0x6e')][_0x4e7b4c]),'WhatsappAccountId':Number(_0xacc416['params']['id'])});}return _0x1a4637;});}})[_0xfb4a('0x38')](respondWithResult(_0x22b523,null))[_0xfb4a('0x2a')](handleError(_0x22b523,null));};exports['removeAgents']=function(_0x2a1d16,_0x9fed80,_0x5ae091){return db[_0xfb4a('0x43')][_0xfb4a('0x5e')]({'where':{'id':_0x2a1d16['params']['id']}})[_0xfb4a('0x38')](handleEntityNotFound(_0x9fed80,null))[_0xfb4a('0x38')](function(_0x3ccc78){if(_0x3ccc78){return _0x3ccc78[_0xfb4a('0x79')](_0x2a1d16[_0xfb4a('0x47')][_0xfb4a('0x6e')])[_0xfb4a('0x38')](function(){if(_['isArray'](_0x2a1d16['query'][_0xfb4a('0x6e')])){for(var _0x5deb13=0x0;_0x5deb13<_0x2a1d16[_0xfb4a('0x47')][_0xfb4a('0x6e')][_0xfb4a('0x4c')];_0x5deb13+=0x1){socket[_0xfb4a('0x77')](_0xfb4a('0x7a'),{'UserId':Number(_0x2a1d16[_0xfb4a('0x47')][_0xfb4a('0x6e')][_0x5deb13]),'WhatsappAccountId':Number(_0x2a1d16['params']['id'])});}}else{socket[_0xfb4a('0x77')](_0xfb4a('0x7a'),{'UserId':Number(_0x2a1d16[_0xfb4a('0x47')][_0xfb4a('0x6e')]),'WhatsappAccountId':Number(_0x2a1d16['params']['id'])});}});}})[_0xfb4a('0x38')](respondWithStatusCode(_0x9fed80,null))[_0xfb4a('0x2a')](handleError(_0x9fed80,null));};exports['getAgents']=function(_0x21d666,_0x483151,_0x262211){var _0x4769c1={};var _0x447b90={};var _0x161f24;var _0x160578;return db[_0xfb4a('0x43')]['findOne']({'where':{'id':_0x21d666[_0xfb4a('0x5c')]['id']}})[_0xfb4a('0x38')](handleEntityNotFound(_0x483151,null))[_0xfb4a('0x38')](function(_0x349c00){if(_0x349c00){_0x161f24=_0x349c00;_0x447b90['model']=_[_0xfb4a('0x48')](db['User']['rawAttributes']);_0x447b90[_0xfb4a('0x47')]=_['keys'](_0x21d666[_0xfb4a('0x47')]);_0x447b90[_0xfb4a('0x51')]=_[_0xfb4a('0x49')](_0x447b90[_0xfb4a('0x46')],_0x447b90[_0xfb4a('0x47')]);_0x4769c1['attributes']=_[_0xfb4a('0x49')](_0x447b90[_0xfb4a('0x46')],qs[_0xfb4a('0x4b')](_0x21d666[_0xfb4a('0x47')]['fields']));_0x4769c1[_0xfb4a('0x4a')]=_0x4769c1[_0xfb4a('0x4a')][_0xfb4a('0x4c')]?_0x4769c1[_0xfb4a('0x4a')]:_0x447b90['model'];_0x4769c1[_0xfb4a('0x4f')]=qs['sort'](_0x21d666['query'][_0xfb4a('0x50')]);_0x4769c1[_0xfb4a('0x54')]=qs[_0xfb4a('0x51')](_[_0xfb4a('0x52')](_0x21d666['query'],_0x447b90['filters']));if(_0x21d666[_0xfb4a('0x47')][_0xfb4a('0x53')]){_0x4769c1[_0xfb4a('0x54')]=_[_0xfb4a('0x57')](_0x4769c1['where'],{'$or':_[_0xfb4a('0x42')](_0x4769c1[_0xfb4a('0x4a')],function(_0x348e9f){var _0x80ec67={};_0x80ec67[_0x348e9f]={'$like':'%'+_0x21d666[_0xfb4a('0x47')]['filter']+'%'};return _0x80ec67;})});}_0x4769c1=_[_0xfb4a('0x57')]({},_0x4769c1,_0x21d666[_0xfb4a('0x72')]);return _0x161f24[_0xfb4a('0x7b')](_0x4769c1);}})[_0xfb4a('0x38')](function(_0x3b0e0b){if(_0x3b0e0b){_0x160578=_0x3b0e0b['length'];if(!_0x21d666[_0xfb4a('0x47')][_0xfb4a('0x4d')]('nolimit')){_0x4769c1[_0xfb4a('0x31')]=qs[_0xfb4a('0x31')](_0x21d666[_0xfb4a('0x47')][_0xfb4a('0x31')]);_0x4769c1['offset']=qs['offset'](_0x21d666['query'][_0xfb4a('0x2f')]);}return _0x161f24[_0xfb4a('0x7b')](_0x4769c1);}})['then'](function(_0x48cbaa){if(_0x48cbaa){return _0x48cbaa?{'count':_0x160578,'rows':_0x48cbaa}:null;}})[_0xfb4a('0x38')](respondWithResult(_0x483151,null))[_0xfb4a('0x2a')](handleError(_0x483151,null));};exports['addApplications']=function(_0xeeed41,_0x10ccde){var _0x1f87e1=_0xeeed41[_0xfb4a('0x5c')]['id'];var _0x3085db=_0xeeed41[_0xfb4a('0x66')];var _0x1c86a3=0xc8;var _0xd36e4b=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xfb4a('0x7c')][_0xfb4a('0x7d')][_0xfb4a('0x7e')][_0xfb4a('0x7f')]},function(_0x4b2609){return db[_0xfb4a('0x43')][_0xfb4a('0x71')]({'where':{'id':_0x1f87e1},'transaction':_0x4b2609})['then'](function(_0x262a20){if(_0x262a20){return db[_0xfb4a('0x80')][_0xfb4a('0x39')]({'where':{'WhatsappAccountId':_0x1f87e1},'transaction':_0x4b2609})[_0xfb4a('0x38')](function(){var _0x51f888=_[_0xfb4a('0x42')](_0x3085db,function(_0x310e90){_0x310e90[_0xfb4a('0x6b')]=_0x1f87e1;return _0x310e90;});return db[_0xfb4a('0x80')][_0xfb4a('0x81')](_0x51f888,{'transaction':_0x4b2609});});}else{_0x1c86a3=0x194;_0xd36e4b=[];}});})[_0xfb4a('0x38')](function(){if(_0x1c86a3!==0x194){return db[_0xfb4a('0x80')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x1f87e1},'order':_0xfb4a('0x82')})[_0xfb4a('0x38')](function(_0x57894b){_0xd36e4b=_0x57894b;});}})[_0xfb4a('0x2a')](function(_0x584ae6){_0x1c86a3=0x1f4;logger[_0xfb4a('0x26')](_0x584ae6[_0xfb4a('0x3d')]);if(_0x584ae6[_0xfb4a('0x3e')]){delete _0x584ae6[_0xfb4a('0x3e')];}_0xd36e4b=_0x584ae6;})['finally'](function(){if(_0xd36e4b===null){_0x10ccde[_0xfb4a('0x2b')](_0x1c86a3);}else{if(_0x1c86a3===0x1f4){_0x10ccde[_0xfb4a('0x2c')](_0x1c86a3)[_0xfb4a('0x3f')](_0xd36e4b);}else{_0x10ccde['status'](_0x1c86a3)['json'](_0xd36e4b);}}});};exports['getApplications']=function(_0x4d438c,_0x479f00,_0x5196d5){var _0x4121e3={};var _0x1db36c={};var _0x5acd4d;var _0x38fa30;return db[_0xfb4a('0x43')][_0xfb4a('0x71')]({'where':{'id':_0x4d438c[_0xfb4a('0x5c')]['id']}})[_0xfb4a('0x38')](handleEntityNotFound(_0x479f00,null))[_0xfb4a('0x38')](function(_0x4f4730){if(_0x4f4730){_0x5acd4d=_0x4f4730;_0x1db36c[_0xfb4a('0x46')]=_['keys'](db['WhatsappApplication'][_0xfb4a('0x5d')]);_0x1db36c[_0xfb4a('0x47')]=_[_0xfb4a('0x48')](_0x4d438c[_0xfb4a('0x47')]);_0x1db36c[_0xfb4a('0x51')]=_['intersection'](_0x1db36c[_0xfb4a('0x46')],_0x1db36c[_0xfb4a('0x47')]);_0x4121e3['attributes']=_['intersection'](_0x1db36c['model'],qs['fields'](_0x4d438c['query'][_0xfb4a('0x4b')]));_0x4121e3[_0xfb4a('0x4a')]=_0x4121e3[_0xfb4a('0x4a')][_0xfb4a('0x4c')]?_0x4121e3[_0xfb4a('0x4a')]:_0x1db36c['model'];_0x4121e3[_0xfb4a('0x4f')]=qs['sort'](_0x4d438c[_0xfb4a('0x47')][_0xfb4a('0x50')]);_0x4121e3[_0xfb4a('0x54')]=qs[_0xfb4a('0x51')](_[_0xfb4a('0x52')](_0x4d438c[_0xfb4a('0x47')],_0x1db36c['filters']));if(_0x4d438c['query']['filter']){_0x4121e3[_0xfb4a('0x54')]=_[_0xfb4a('0x57')](_0x4121e3[_0xfb4a('0x54')],{'$or':_['map'](_0x4121e3[_0xfb4a('0x4a')],function(_0x17598a){var _0x59d43={};_0x59d43[_0x17598a]={'$like':'%'+_0x4d438c[_0xfb4a('0x47')]['filter']+'%'};return _0x59d43;})});}_0x4121e3=_[_0xfb4a('0x57')]({},_0x4121e3,_0x4d438c[_0xfb4a('0x72')]);return _0x5acd4d[_0xfb4a('0x83')](_0x4121e3);}})[_0xfb4a('0x38')](function(_0x29c642){if(_0x29c642){_0x38fa30=_0x29c642[_0xfb4a('0x4c')];if(!_0x4d438c[_0xfb4a('0x47')][_0xfb4a('0x4d')](_0xfb4a('0x4e'))){_0x4121e3[_0xfb4a('0x31')]=qs[_0xfb4a('0x31')](_0x4d438c[_0xfb4a('0x47')]['limit']);_0x4121e3[_0xfb4a('0x2f')]=qs[_0xfb4a('0x2f')](_0x4d438c[_0xfb4a('0x47')]['offset']);}return _0x5acd4d['getApplications'](_0x4121e3);}})['then'](function(_0x171b6e){if(_0x171b6e){return _0x171b6e?{'count':_0x38fa30,'rows':_0x171b6e}:null;}})[_0xfb4a('0x38')](respondWithResult(_0x479f00,null))[_0xfb4a('0x2a')](handleError(_0x479f00,null));};exports[_0xfb4a('0x84')]=function(_0x21306a,_0x18fcb1,_0x5a67d3){var _0x26cc26={'channel':_0xfb4a('0x85')};var _0x18d1a0=[];var _0x50774c=[];var _0x22db29={};return db[_0xfb4a('0x43')][_0xfb4a('0x5e')]({'where':{'id':_0x21306a[_0xfb4a('0x5c')]['id']},'include':[{'model':db[_0xfb4a('0x80')],'as':_0xfb4a('0x86')}]})[_0xfb4a('0x38')](handleEntityNotFound(_0x18fcb1,null))[_0xfb4a('0x38')](function(_0xa94035){_0x26cc26[_0xfb4a('0x87')]=_0xa94035;if(_0x26cc26[_0xfb4a('0x87')]&&_0x26cc26[_0xfb4a('0x87')][_0xfb4a('0x55')]===_0xfb4a('0x88')&&_0x21306a['body']['statuses']){if(_0x21306a[_0xfb4a('0x66')][_0xfb4a('0x89')][_0xfb4a('0x4c')]===0x0)return;if(_0x21306a[_0xfb4a('0x66')][_0xfb4a('0x89')][0x0][_0xfb4a('0x8a')]!==_0xfb4a('0x8b'))return;return db[_0xfb4a('0x8c')][_0xfb4a('0x37')]({'read':!![],'readAt':_0x21306a[_0xfb4a('0x66')][_0xfb4a('0x89')][0x0][_0xfb4a('0x8d')]},{'where':{'messageId':_0x21306a[_0xfb4a('0x66')][_0xfb4a('0x89')][0x0][_0xfb4a('0x8e')]},'individualHooks':!![]})[_0xfb4a('0x38')](function(_0x9214c){return _0x18fcb1[_0xfb4a('0x2c')](0xc8)['json'](_0x9214c);});}_0x26cc26[_0xfb4a('0x8f')]=_[_0xfb4a('0x90')](_0xa94035['Applications'],['priority'],[_0xfb4a('0x91')]);if(_0x26cc26['account'][_0xfb4a('0x86')]){delete _0x26cc26[_0xfb4a('0x87')]['Applications'];}return db['CmContact'][_0xfb4a('0x68')]()['then'](function(_0x5cf74f){if(!_0x5cf74f){throw new db['Sequelize'][(_0xfb4a('0x92'))](_0xfb4a('0x93'));}_0x18d1a0=_[_0xfb4a('0x94')](_[_0xfb4a('0x48')](_0x5cf74f),[_0xfb4a('0x95'),_0xfb4a('0x96')]);_0x50774c=_[_0xfb4a('0x94')](_[_0xfb4a('0x48')](_0x5cf74f),[_0xfb4a('0x95'),'updatedAt','CompanyId',_0xfb4a('0x97')]);_0x26cc26[_0xfb4a('0x66')]={'mapKey':_0xfb4a('0x98')};if(_0x26cc26['account']&&_0x26cc26['account'][_0xfb4a('0x55')]===_0xfb4a('0x99')){_0x26cc26['body'][_0xfb4a('0x9a')]=_0x21306a[_0xfb4a('0x66')][_0xfb4a('0x9b')][_0xfb4a('0x9c')](_0xfb4a('0x9d'),'');_0x26cc26['body'][_0xfb4a('0x66')]=_0x21306a[_0xfb4a('0x66')][_0xfb4a('0x9e')];_0x26cc26['body'][_0xfb4a('0x9f')]=_0x21306a['body']['MessageSid'];}if(_0x26cc26[_0xfb4a('0x87')]&&_0x26cc26[_0xfb4a('0x87')]['type']===_0xfb4a('0x88')){_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0x9a')]=_0x21306a[_0xfb4a('0x66')][_0xfb4a('0xa0')][0x0][_0xfb4a('0x9a')];_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0x66')]=_0x21306a[_0xfb4a('0x66')][_0xfb4a('0xa0')][0x0][_0xfb4a('0x27')]['body'];_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0x9f')]=_0x21306a[_0xfb4a('0x66')][_0xfb4a('0xa0')][0x0][_0xfb4a('0x8e')];}if(_0x26cc26[_0xfb4a('0x66')]['id']){delete _0x26cc26[_0xfb4a('0x66')]['id'];}if(_[_0xfb4a('0xa1')](_0x26cc26['body']['from'])){throw new db[(_0xfb4a('0xa2'))][(_0xfb4a('0x92'))](_0xfb4a('0xa3'));}if(_[_0xfb4a('0xa1')](_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0x66')])||_0x26cc26[_0xfb4a('0x66')]['body']===''){throw new db[(_0xfb4a('0xa2'))]['ValidationError'](_0xfb4a('0xa4'));}if(_['isNil'](_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0xa5')])){throw new db['Sequelize'][(_0xfb4a('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x50774c);}if(!_['includes'](_0x50774c,_0x26cc26['body'][_0xfb4a('0xa5')])){throw new db[(_0xfb4a('0xa2'))][(_0xfb4a('0x92'))](_0xfb4a('0xa6')+_0x50774c);}_0x22db29[_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0xa5')]]=_0x26cc26['body'][_0xfb4a('0x9a')];return db[_0xfb4a('0xa7')][_0xfb4a('0x5e')]({'where':{'id':_0x26cc26[_0xfb4a('0x87')][_0xfb4a('0x97')]},'include':[{'model':db['CmContact'],'as':_0xfb4a('0xa8'),'where':_0x22db29,'limit':0x1,'order':[['updatedAt',_0xfb4a('0xa9')]]}]});})[_0xfb4a('0x38')](handleEntityNotFound(_0x18fcb1,null))[_0xfb4a('0x38')](function(_0x150d5f){if(_0x150d5f){_0x26cc26[_0xfb4a('0xaa')]=_[_0xfb4a('0x75')](_0x150d5f,[_0xfb4a('0xa8')]);if(_0x150d5f[_0xfb4a('0xa8')]['length']){return _0x150d5f['Contacts'][0x0];}var _0x36eb28=_['defaults'](_0x26cc26[_0xfb4a('0x66')],{'firstName':_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0x9a')],'ListId':_0x150d5f['id']});_0x36eb28[_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0xa5')]]=_0x26cc26['body'][_0xfb4a('0x9a')];return db[_0xfb4a('0xab')][_0xfb4a('0x5f')](_0x36eb28,{'fields':_0x18d1a0,'raw':!![]});}})[_0xfb4a('0x38')](handleEntityNotFound(_0x18fcb1,null))[_0xfb4a('0x38')](function(_0x1e1451){if(_0x1e1451){_0x26cc26[_0xfb4a('0xac')]=_0x1e1451;var _0x2c37c8={'ContactId':_0x1e1451['id'],'phone':_0x26cc26['body'][_0xfb4a('0x9a')],'WhatsappAccountId':_0x21306a['params']['id']};var _0x3d7150={'ContactId':_0x1e1451['id'],'WhatsappAccountId':_0x21306a[_0xfb4a('0x5c')]['id'],'closed':![]};return db[_0xfb4a('0xad')][_0xfb4a('0x5e')]({'where':_0x3d7150})[_0xfb4a('0x38')](function(_0x2060a9){if(_0x2060a9){return[_0x2060a9,![]];}return db['WhatsappInteraction'][_0xfb4a('0x5f')](_0x2c37c8)[_0xfb4a('0x38')](function(_0x4103ed){return[_0x4103ed,!![]];});});}})[_0xfb4a('0x76')](function(_0x51e26e,_0x3d0ac2){_0x26cc26[_0xfb4a('0xae')]=_0x51e26e[_0xfb4a('0x3a')]({'plain':!![]});_0x26cc26[_0xfb4a('0xae')][_0xfb4a('0xaf')]=![];if(_0x3d0ac2){if(_0x26cc26[_0xfb4a('0x87')]['autoclose']){_0x26cc26[_0xfb4a('0x8f')][_0xfb4a('0xb0')]({'id':0x0,'priority':_0x26cc26[_0xfb4a('0x8f')]['length']+0x1,'app':'close','appdata':_0xfb4a('0xb1'),'interval':'*,*,*,*'});}_0x26cc26['interaction'][_0xfb4a('0xaf')]=!![];}return db[_0xfb4a('0x8c')][_0xfb4a('0x5f')]({'phone':_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0x9a')],'messageId':_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0x9f')],'body':_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0x66')],'WhatsappAccountId':_0x21306a['params']['id'],'WhatsappInteractionId':_0x51e26e['id'],'direction':'in','ContactId':_0x51e26e[_0xfb4a('0xb2')],'AttachmentId':_0x26cc26[_0xfb4a('0x66')][_0xfb4a('0xb3')]});})[_0xfb4a('0x38')](function(_0x30de88){_0x26cc26[_0xfb4a('0x27')]=_0x30de88;if(!_0x26cc26[_0xfb4a('0xae')][_0xfb4a('0xb4')])return;return db[_0xfb4a('0xb5')][_0xfb4a('0x5e')]({'attributes':['id',_0xfb4a('0x3e')],'where':{'id':_0x26cc26['interaction'][_0xfb4a('0xb4')]}});})[_0xfb4a('0x38')](function(_0x478e96){if(_0x478e96){_0x26cc26[_0xfb4a('0x8f')][_0xfb4a('0xb6')]({'id':0x0,'priority':0x0,'app':_0xfb4a('0xb7'),'appdata':_0x478e96[_0xfb4a('0x3e')]+','+(_0x26cc26[_0xfb4a('0x87')][_0xfb4a('0xb8')]||0xa),'interval':_0xfb4a('0xb9')});}if(!_0x26cc26['interaction'][_0xfb4a('0xba')])return;return db['WhatsappQueue']['find']({'attributes':['id',_0xfb4a('0x3e')],'where':{'id':_0x26cc26[_0xfb4a('0xae')][_0xfb4a('0xba')]}});})[_0xfb4a('0x38')](function(_0x43dbfa){if(_0x43dbfa){_0x26cc26[_0xfb4a('0x8f')][_0xfb4a('0xb6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x43dbfa[_0xfb4a('0x3e')]+','+(_0x26cc26['account'][_0xfb4a('0xbb')]||0x12c),'interval':_0xfb4a('0xb9')});}return respondWithRpcPromise(_0xfb4a('0xbc'),_0xfb4a('0xbd'),_0x26cc26);})['then'](function(_0x2531df){if(_0x2531df){var _0x21d0c1=0xc8;var _0x1a8373=_0xfb4a('0xbe');logger['info'](_0xfb4a('0x24'),_0x1a8373,_0x21d0c1,_0xfb4a('0xbf'));logger[_0xfb4a('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a8373,_0x21d0c1,'entity\x20found',JSON['stringify'](_0x2531df));if(_0x26cc26['account']['type']===_0xfb4a('0x99')){return _0x18fcb1['status'](_0x21d0c1)[_0xfb4a('0x33')](_0xfb4a('0xc0'),_0xfb4a('0xc1'))[_0xfb4a('0x3f')](_0xfb4a('0xc2'));}else{return _0x18fcb1[_0xfb4a('0x2c')](_0x21d0c1)[_0xfb4a('0x2e')](_0x2531df);}}});})['catch'](handleError(_0x18fcb1,null));};exports[_0xfb4a('0x3f')]=function(_0x355c57,_0x4328aa,_0x345990){var _0x54383f,_0x2988a5,_0x219f73;if(_[_0xfb4a('0xa1')](_0x355c57[_0xfb4a('0x66')][_0xfb4a('0x66')])||_0x355c57[_0xfb4a('0x66')][_0xfb4a('0x66')]===''){throw new db[(_0xfb4a('0xa2'))][(_0xfb4a('0x92'))](_0xfb4a('0xa4'));}if(_[_0xfb4a('0xa1')](_0x355c57[_0xfb4a('0x66')]['to'])){throw new db[(_0xfb4a('0xa2'))][(_0xfb4a('0x92'))](_0xfb4a('0xc3'));}_0x54383f=_0x355c57[_0xfb4a('0x66')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x355c57['params']['id']},'include':[{'model':db[_0xfb4a('0xa7')],'as':_0xfb4a('0xc4'),'include':[{'model':db[_0xfb4a('0xab')],'as':_0xfb4a('0xa8'),'where':{'mobile':_0x54383f},'limit':0x1,'order':[['updatedAt',_0xfb4a('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x4328aa,null))[_0xfb4a('0x38')](function(_0x2463eb){if(_0x2463eb&&_0x2463eb[_0xfb4a('0xc4')]){_0x2988a5=_0x2463eb[_0xfb4a('0x3a')]({'plain':!![]});if(_0x2988a5['List']&&_0x2988a5[_0xfb4a('0xc4')][_0xfb4a('0xa8')][_0xfb4a('0x4c')]){return _0x2988a5[_0xfb4a('0xc4')][_0xfb4a('0xa8')][0x0];}return db[_0xfb4a('0xab')][_0xfb4a('0x5f')](_[_0xfb4a('0x1b')](_0x355c57['body'],{'firstName':_0x54383f,'mobile':_0x54383f,'phone':_0x54383f,'ListId':_0x2988a5[_0xfb4a('0x97')]}));}})['then'](handleEntityNotFound(_0x4328aa,null))[_0xfb4a('0x38')](function(_0x3190e8){if(_0x3190e8){_0x219f73=_0x3190e8;return db[_0xfb4a('0xad')][_0xfb4a('0x5e')]({'where':{'ContactId':_0x219f73['id'],'closed':![],'WhatsappAccountId':_0x2988a5['id']}})['then'](function(_0x4aacac){if(_0x4aacac){return[_0x4aacac,![]];}return db[_0xfb4a('0xad')]['create']({'UserId':_0x355c57[_0xfb4a('0x60')]['id'],'ContactId':_0x219f73['id'],'WhatsappAccountId':_0x2988a5['id'],'phone':_0x54383f,'firstMsgDirection':_0xfb4a('0xc5'),'Messages':[_[_0xfb4a('0x57')](_0x355c57[_0xfb4a('0x66')],{'read':![],'body':_0x355c57[_0xfb4a('0x66')]['body'],'phone':_0x54383f,'WhatsappAccountId':_0x2988a5['id'],'UserId':_0x355c57[_0xfb4a('0x60')]['id'],'ContactId':_0x219f73['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0xfb4a('0x38')](function(_0x197c8b){return[_0x197c8b,!![]];});});}})[_0xfb4a('0x76')](function(_0x42504c,_0x51a5d1){if(_0x51a5d1){return _0x42504c;}return db['WhatsappMessage']['create'](_[_0xfb4a('0x57')](_0x355c57[_0xfb4a('0x66')],{'read':![],'body':_0x355c57[_0xfb4a('0x66')][_0xfb4a('0x66')],'phone':_0x54383f,'WhatsappAccountId':_0x2988a5['id'],'WhatsappInteractionId':_0x42504c['id'],'UserId':_0x355c57['user']['id'],'ContactId':_0x219f73['id']}))[_0xfb4a('0x38')](function(_0x2678c3){_0x42504c[_0xfb4a('0xc6')]['Messages']=[];_0x42504c['dataValues']['Messages'][_0xfb4a('0xb0')](_0x2678c3[_0xfb4a('0xc6')]);return _0x42504c;});})[_0xfb4a('0x38')](respondWithResult(_0x4328aa,null))[_0xfb4a('0x2a')](handleError(_0x4328aa,null));}; \ No newline at end of file +var _0xf88a=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','isArray','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','getApplications','notify','account','type','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','Applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','From','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','end','stack','name','index','map','WhatsappAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','Pause','mandatoryDispositionPause','includeAll','find','create','body'];(function(_0x2d3fa8,_0x4b7655){var _0x25b2c9=function(_0x1a96e2){while(--_0x1a96e2){_0x2d3fa8['push'](_0x2d3fa8['shift']());}};_0x25b2c9(++_0x4b7655);}(_0xf88a,0x1e8));var _0xaf88=function(_0x221ebf,_0x5aacde){_0x221ebf=_0x221ebf-0x0;var _0x218db2=_0xf88a[_0x221ebf];return _0x218db2;};'use strict';var emlformat=require(_0xaf88('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf88('0x1'));var rp=require(_0xaf88('0x2'));var moment=require('moment');var BPromise=require(_0xaf88('0x3'));var Mustache=require('mustache');var util=require(_0xaf88('0x4'));var path=require(_0xaf88('0x5'));var sox=require(_0xaf88('0x6'));var csv=require(_0xaf88('0x7'));var ejs=require(_0xaf88('0x8'));var fs=require('fs');var fs_extra=require(_0xaf88('0x9'));var _=require(_0xaf88('0xa'));var squel=require(_0xaf88('0xb'));var crypto=require(_0xaf88('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaf88('0xd'));var toCsv=require(_0xaf88('0x7'));var querystring=require(_0xaf88('0xe'));var Papa=require(_0xaf88('0xf'));var Redis=require('ioredis');var authService=require(_0xaf88('0x10'));var qs=require(_0xaf88('0x11'));var as=require(_0xaf88('0x12'));var hardwareService=require(_0xaf88('0x13'));var logger=require('../../config/logger')(_0xaf88('0x14'));var utils=require(_0xaf88('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xaf88('0x16'));var db=require(_0xaf88('0x17'))['db'];config[_0xaf88('0x18')]=_[_0xaf88('0x19')](config['redis'],{'host':_0xaf88('0x1a'),'port':0x18eb});var socket=require(_0xaf88('0x1b'))(new Redis(config['redis']));require(_0xaf88('0x1c'))[_0xaf88('0x1d')](socket);var jayson=require(_0xaf88('0x1e'));var client=jayson['client'][_0xaf88('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x2b11c4,_0xf43537,_0x53ea6e,_0x3472ab){return new BPromise(function(_0x44255e,_0xdc6a2f){var _0x4e456b=_0x3472ab||client;return _0x4e456b[_0xaf88('0x20')](_0x2b11c4,_0x53ea6e)[_0xaf88('0x21')](function(_0x194157){logger[_0xaf88('0x22')](_0xaf88('0x23'),_0xf43537,_0xaf88('0x24'));logger[_0xaf88('0x25')](_0xaf88('0x26'),_0xf43537,_0xaf88('0x24'),JSON[_0xaf88('0x27')](_0x194157));if(_0x194157['error']){if(_0x194157[_0xaf88('0x28')][_0xaf88('0x29')]===0x1f4){logger['error'](_0xaf88('0x23'),_0xf43537,_0x194157[_0xaf88('0x28')][_0xaf88('0x2a')]);return _0xdc6a2f(_0x194157[_0xaf88('0x28')][_0xaf88('0x2a')]);}logger[_0xaf88('0x28')](_0xaf88('0x23'),_0xf43537,_0x194157['error'][_0xaf88('0x2a')]);return _0x44255e(_0x194157['error'][_0xaf88('0x2a')]);}else{logger['info'](_0xaf88('0x23'),_0xf43537,_0xaf88('0x24'));_0x44255e(_0x194157[_0xaf88('0x2b')][_0xaf88('0x2a')]);}})['catch'](function(_0x44d695){logger[_0xaf88('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0xf43537,_0x44d695);_0xdc6a2f(_0x44d695);});});}function respondWithStatusCode(_0x187229,_0x16a325){_0x16a325=_0x16a325||0xcc;return function(_0x191a9e){if(_0x191a9e){return _0x187229[_0xaf88('0x2c')](_0x16a325);}return _0x187229[_0xaf88('0x2d')](_0x16a325)['end']();};}function respondWithResult(_0x5372c2,_0x1471e5){_0x1471e5=_0x1471e5||0xc8;return function(_0x5e4a66){if(_0x5e4a66){return _0x5372c2[_0xaf88('0x2d')](_0x1471e5)[_0xaf88('0x2e')](_0x5e4a66);}};}function respondWithFilteredResult(_0x36b76a,_0x52c966){return function(_0x5d930e){if(_0x5d930e){var _0x440257=typeof _0x52c966[_0xaf88('0x2f')]===_0xaf88('0x30')&&typeof _0x52c966[_0xaf88('0x31')]===_0xaf88('0x30');var _0x285d6b=_0x5d930e[_0xaf88('0x32')];var _0x573c23=_0x440257?0x0:_0x52c966[_0xaf88('0x2f')];var _0x4acf26=_0x440257?_0x5d930e['count']:_0x52c966[_0xaf88('0x2f')]+_0x52c966[_0xaf88('0x31')];var _0x297e96;if(_0x4acf26>=_0x285d6b){_0x4acf26=_0x285d6b;_0x297e96=0xc8;}else{_0x297e96=0xce;}_0x36b76a['status'](_0x297e96);return _0x36b76a[_0xaf88('0x33')](_0xaf88('0x34'),_0x573c23+'-'+_0x4acf26+'/'+_0x285d6b)[_0xaf88('0x2e')](_0x5d930e);}return null;};}function patchUpdates(_0x454e98){return function(_0x9ad5bb){try{jsonpatch[_0xaf88('0x35')](_0x9ad5bb,_0x454e98,!![]);}catch(_0x3f94c9){return BPromise[_0xaf88('0x36')](_0x3f94c9);}return _0x9ad5bb['save']();};}function saveUpdates(_0x3fc439,_0x4d0075){return function(_0x56f483){if(_0x56f483){return _0x56f483[_0xaf88('0x37')](_0x3fc439)[_0xaf88('0x21')](function(_0x498cfb){return _0x498cfb;});}return null;};}function removeEntity(_0x389949,_0x349145){return function(_0x32d17e){if(_0x32d17e){return _0x32d17e[_0xaf88('0x38')]()[_0xaf88('0x21')](function(){var _0x14436d=_0x32d17e[_0xaf88('0x39')]({'plain':!![]});var _0x502248='WhatsappAccounts';return db['UserProfileResource'][_0xaf88('0x38')]({'where':{'type':_0x502248,'resourceId':_0x14436d['id']}})[_0xaf88('0x21')](function(){return _0x32d17e;});})[_0xaf88('0x21')](function(){_0x389949[_0xaf88('0x2d')](0xcc)[_0xaf88('0x3a')]();});}};}function handleEntityNotFound(_0x545adb,_0x17a0ed){return function(_0x39c3ce){if(!_0x39c3ce){_0x545adb[_0xaf88('0x2c')](0x194);}return _0x39c3ce;};}function handleError(_0x4b3529,_0x781d57){_0x781d57=_0x781d57||0x1f4;return function(_0x58c410){logger[_0xaf88('0x28')](_0x58c410[_0xaf88('0x3b')]);if(_0x58c410[_0xaf88('0x3c')]){delete _0x58c410[_0xaf88('0x3c')];}_0x4b3529['status'](_0x781d57)['send'](_0x58c410);};}exports[_0xaf88('0x3d')]=function(_0x272107,_0x10c7e8){var _0x165c27={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x173828={},_0x5b0bb3={'count':0x0,'rows':[]};var _0x3a2dd9=_[_0xaf88('0x3e')](db[_0xaf88('0x3f')][_0xaf88('0x40')],function(_0x4b3fd7){return{'name':_0x4b3fd7[_0xaf88('0x41')],'type':_0x4b3fd7['type'][_0xaf88('0x42')]};});_0x173828['model']=_[_0xaf88('0x3e')](_0x3a2dd9,_0xaf88('0x3c'));_0x173828[_0xaf88('0x43')]=_[_0xaf88('0x44')](_0x272107[_0xaf88('0x43')]);_0x173828[_0xaf88('0x45')]=_[_0xaf88('0x46')](_0x173828[_0xaf88('0x47')],_0x173828[_0xaf88('0x43')]);_0x165c27[_0xaf88('0x48')]=_['intersection'](_0x173828[_0xaf88('0x47')],qs[_0xaf88('0x49')](_0x272107[_0xaf88('0x43')][_0xaf88('0x49')]));_0x165c27[_0xaf88('0x48')]=_0x165c27['attributes'][_0xaf88('0x4a')]?_0x165c27[_0xaf88('0x48')]:_0x173828[_0xaf88('0x47')];if(!_0x272107[_0xaf88('0x43')][_0xaf88('0x4b')](_0xaf88('0x4c'))){_0x165c27[_0xaf88('0x31')]=qs['limit'](_0x272107[_0xaf88('0x43')][_0xaf88('0x31')]);_0x165c27[_0xaf88('0x2f')]=qs[_0xaf88('0x2f')](_0x272107[_0xaf88('0x43')][_0xaf88('0x2f')]);}_0x165c27[_0xaf88('0x4d')]=qs[_0xaf88('0x4e')](_0x272107[_0xaf88('0x43')][_0xaf88('0x4e')]);_0x165c27[_0xaf88('0x4f')]=qs[_0xaf88('0x45')](_[_0xaf88('0x50')](_0x272107['query'],_0x173828[_0xaf88('0x45')]),_0x3a2dd9);if(_0x272107[_0xaf88('0x43')][_0xaf88('0x51')]){_0x165c27[_0xaf88('0x4f')]=_[_0xaf88('0x52')](_0x165c27[_0xaf88('0x4f')],{'$or':_[_0xaf88('0x3e')](_0x3a2dd9,function(_0x174a99){if(_0x174a99['type']!==_0xaf88('0x53')){var _0x2caaa3={};_0x2caaa3[_0x174a99[_0xaf88('0x3c')]]={'$like':'%'+_0x272107[_0xaf88('0x43')][_0xaf88('0x51')]+'%'};return _0x2caaa3;}})});}_0x165c27=_[_0xaf88('0x52')]({},_0x165c27,_0x272107[_0xaf88('0x54')]);var _0x1ec8c2={'where':_0x165c27['where']};return db[_0xaf88('0x3f')]['count'](_0x1ec8c2)[_0xaf88('0x21')](function(_0x7a4d28){_0x5b0bb3['count']=_0x7a4d28;if(_0x272107[_0xaf88('0x43')]['includeAll']){_0x165c27[_0xaf88('0x55')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xaf88('0x56')](_0x165c27);})[_0xaf88('0x21')](function(_0x1446f2){_0x5b0bb3[_0xaf88('0x57')]=_0x1446f2;return _0x5b0bb3;})[_0xaf88('0x21')](respondWithFilteredResult(_0x10c7e8,_0x165c27))[_0xaf88('0x58')](handleError(_0x10c7e8,null));};exports[_0xaf88('0x59')]=function(_0x562c4e,_0x29ad8b){var _0x3a7da0={'raw':![],'where':{'id':_0x562c4e[_0xaf88('0x5a')]['id']},'include':[{'model':db[_0xaf88('0x5b')],'as':_0xaf88('0x5c')}]},_0x115258={};_0x115258['model']=_['keys'](db['WhatsappAccount'][_0xaf88('0x40')]);_0x115258['query']=_['keys'](_0x562c4e[_0xaf88('0x43')]);_0x115258[_0xaf88('0x45')]=_[_0xaf88('0x46')](_0x115258['model'],_0x115258[_0xaf88('0x43')]);_0x3a7da0[_0xaf88('0x48')]=_[_0xaf88('0x46')](_0x115258[_0xaf88('0x47')],qs[_0xaf88('0x49')](_0x562c4e[_0xaf88('0x43')]['fields']));_0x3a7da0[_0xaf88('0x48')]=_0x3a7da0[_0xaf88('0x48')]['length']?_0x3a7da0[_0xaf88('0x48')]:_0x115258['model'];if(_0x562c4e[_0xaf88('0x43')][_0xaf88('0x5d')]){_0x3a7da0['include']=[{'all':!![]}];}_0x3a7da0=_[_0xaf88('0x52')]({},_0x3a7da0,_0x562c4e[_0xaf88('0x54')]);return db[_0xaf88('0x3f')][_0xaf88('0x5e')](_0x3a7da0)['then'](handleEntityNotFound(_0x29ad8b,null))['then'](respondWithResult(_0x29ad8b,null))[_0xaf88('0x58')](handleError(_0x29ad8b,null));};exports[_0xaf88('0x5f')]=function(_0x3ba7d0,_0x2c3ff1){return db['WhatsappAccount'][_0xaf88('0x5f')](_0x3ba7d0[_0xaf88('0x60')],{})[_0xaf88('0x21')](function(_0x1c97c4){var _0x2081e5=_0x3ba7d0[_0xaf88('0x61')][_0xaf88('0x39')]({'plain':!![]});if(!_0x2081e5)throw new Error(_0xaf88('0x62'));if(_0x2081e5[_0xaf88('0x63')]===_0xaf88('0x61')){var _0x5813ef=_0x1c97c4[_0xaf88('0x39')]({'plain':!![]});var _0x85e676='WhatsappAccounts';return db['UserProfileSection'][_0xaf88('0x5e')]({'where':{'name':_0x85e676,'userProfileId':_0x2081e5[_0xaf88('0x64')]},'raw':!![]})[_0xaf88('0x21')](function(_0x471e9e){if(_0x471e9e&&_0x471e9e[_0xaf88('0x65')]===0x0){return db['UserProfileResource'][_0xaf88('0x5f')]({'name':_0x5813ef['name'],'resourceId':_0x5813ef['id'],'type':_0x471e9e[_0xaf88('0x3c')],'sectionId':_0x471e9e['id']},{})[_0xaf88('0x21')](function(){return _0x1c97c4;});}else{return _0x1c97c4;}})[_0xaf88('0x58')](function(_0x364552){logger['error'](_0xaf88('0x66'),_0x364552);throw _0x364552;});}return _0x1c97c4;})[_0xaf88('0x21')](respondWithResult(_0x2c3ff1,0xc9))[_0xaf88('0x58')](handleError(_0x2c3ff1,null));};exports['update']=function(_0x12509b,_0x95983a){if(_0x12509b[_0xaf88('0x60')]['id']){delete _0x12509b[_0xaf88('0x60')]['id'];}return db[_0xaf88('0x3f')][_0xaf88('0x5e')]({'where':{'id':_0x12509b['params']['id']},'include':[{'model':db[_0xaf88('0x5b')],'as':_0xaf88('0x5c')}]})[_0xaf88('0x21')](handleEntityNotFound(_0x95983a,null))[_0xaf88('0x21')](saveUpdates(_0x12509b[_0xaf88('0x60')],null))[_0xaf88('0x21')](respondWithResult(_0x95983a,null))[_0xaf88('0x58')](handleError(_0x95983a,null));};exports[_0xaf88('0x38')]=function(_0x2b7891,_0x35e8d4){return db[_0xaf88('0x3f')][_0xaf88('0x5e')]({'where':{'id':_0x2b7891[_0xaf88('0x5a')]['id']}})[_0xaf88('0x21')](handleEntityNotFound(_0x35e8d4,null))[_0xaf88('0x21')](removeEntity(_0x35e8d4,null))['catch'](handleError(_0x35e8d4,null));};exports[_0xaf88('0x67')]=function(_0x333cdc,_0x158f4e){return db[_0xaf88('0x3f')][_0xaf88('0x67')]()[_0xaf88('0x21')](respondWithResult(_0x158f4e,null))['catch'](handleError(_0x158f4e,null));};exports['addDisposition']=function(_0x468324,_0x1598db,_0x4cc5ac){if(_0x468324[_0xaf88('0x60')]['id']){delete _0x468324[_0xaf88('0x60')]['id'];}return db[_0xaf88('0x3f')][_0xaf88('0x5e')]({'where':{'id':_0x468324[_0xaf88('0x5a')]['id']}})[_0xaf88('0x21')](handleEntityNotFound(_0x1598db,null))[_0xaf88('0x21')](function(_0x58ea32){if(_0x58ea32){_0x468324[_0xaf88('0x60')][_0xaf88('0x68')]=_0x58ea32['id'];return db[_0xaf88('0x69')][_0xaf88('0x5f')](_0x468324[_0xaf88('0x60')]);}})[_0xaf88('0x21')](respondWithResult(_0x1598db,null))['catch'](handleError(_0x1598db,null));};exports['getDispositions']=function(_0x1d2c02,_0x53f6df,_0x463157){var _0x117379={'raw':![],'where':{}};var _0x138860={};var _0xc2ae13={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x1d2c02['params']['id']}})['then'](handleEntityNotFound(_0x53f6df,null))[_0xaf88('0x21')](function(_0x51c740){if(_0x51c740){_0x138860[_0xaf88('0x47')]=_['keys'](db['Disposition'][_0xaf88('0x40')]);_0x138860[_0xaf88('0x43')]=_[_0xaf88('0x44')](_0x1d2c02[_0xaf88('0x43')]);_0x138860[_0xaf88('0x45')]=_[_0xaf88('0x46')](_0x138860[_0xaf88('0x47')],_0x138860[_0xaf88('0x43')]);_0x117379[_0xaf88('0x48')]=_[_0xaf88('0x46')](_0x138860[_0xaf88('0x47')],qs[_0xaf88('0x49')](_0x1d2c02['query'][_0xaf88('0x49')]));_0x117379[_0xaf88('0x48')]=_0x117379[_0xaf88('0x48')][_0xaf88('0x4a')]?_0x117379['attributes']:_0x138860[_0xaf88('0x47')];if(!_0x1d2c02[_0xaf88('0x43')][_0xaf88('0x4b')](_0xaf88('0x4c'))){_0x117379[_0xaf88('0x31')]=qs['limit'](_0x1d2c02['query'][_0xaf88('0x31')]);_0x117379['offset']=qs[_0xaf88('0x2f')](_0x1d2c02['query'][_0xaf88('0x2f')]);}_0x117379['order']=qs[_0xaf88('0x4e')](_0x1d2c02[_0xaf88('0x43')][_0xaf88('0x4e')]);_0x117379[_0xaf88('0x4f')]=qs[_0xaf88('0x45')](_[_0xaf88('0x50')](_0x1d2c02['query'],_0x138860[_0xaf88('0x45')]));_0x117379['where'][_0xaf88('0x68')]=_0x51c740['id'];if(_0x1d2c02[_0xaf88('0x43')]['filter']){_0x117379[_0xaf88('0x4f')]=_[_0xaf88('0x52')](_0x117379['where'],{'$or':_[_0xaf88('0x3e')](_0x117379[_0xaf88('0x48')],function(_0x12f38d){var _0x173a35={};_0x173a35[_0x12f38d]={'$like':'%'+_0x1d2c02['query']['filter']+'%'};return _0x173a35;})});}_0x117379=_[_0xaf88('0x52')]({},_0x117379,_0x1d2c02[_0xaf88('0x54')]);return db[_0xaf88('0x69')]['count']({'where':_0x117379[_0xaf88('0x4f')]})[_0xaf88('0x21')](function(_0x32e3f9){_0xc2ae13[_0xaf88('0x32')]=_0x32e3f9;if(_0x1d2c02['query'][_0xaf88('0x5d')]){_0x117379[_0xaf88('0x55')]=[{'all':!![]}];}return db[_0xaf88('0x69')][_0xaf88('0x56')](_0x117379);})[_0xaf88('0x21')](function(_0x3f8d97){_0xc2ae13['rows']=_0x3f8d97;return _0xc2ae13;});}})[_0xaf88('0x21')](respondWithFilteredResult(_0x53f6df,_0x117379))[_0xaf88('0x58')](handleError(_0x53f6df,null));};exports['removeDispositions']=function(_0x56bd29,_0xebfb68,_0x27ee08){return db[_0xaf88('0x3f')][_0xaf88('0x5e')]({'where':{'id':_0x56bd29[_0xaf88('0x5a')]['id']}})[_0xaf88('0x21')](handleEntityNotFound(_0xebfb68,null))[_0xaf88('0x21')](function(_0xbeccb6){if(_0xbeccb6){return _0xbeccb6[_0xaf88('0x6a')](_0x56bd29[_0xaf88('0x43')][_0xaf88('0x6b')]);}})[_0xaf88('0x21')](respondWithStatusCode(_0xebfb68,null))[_0xaf88('0x58')](handleError(_0xebfb68,null));};exports[_0xaf88('0x6c')]=function(_0x14d3f2,_0x1a1234,_0x3c4441){if(_0x14d3f2['body']['id']){delete _0x14d3f2['body']['id'];}return db['WhatsappAccount'][_0xaf88('0x5e')]({'where':{'id':_0x14d3f2[_0xaf88('0x5a')]['id']}})[_0xaf88('0x21')](handleEntityNotFound(_0x1a1234,null))['then'](function(_0x3ee10f){if(_0x3ee10f){_0x14d3f2[_0xaf88('0x60')][_0xaf88('0x68')]=_0x3ee10f['id'];return db[_0xaf88('0x6d')]['create'](_0x14d3f2['body']);}})['then'](respondWithResult(_0x1a1234,null))[_0xaf88('0x58')](handleError(_0x1a1234,null));};exports[_0xaf88('0x6e')]=function(_0x4b3ace,_0x4d7a59,_0x19dabb){var _0x53441d={'raw':![],'where':{}};var _0x39032a={};var _0x278e47={'count':0x0,'rows':[]};return db[_0xaf88('0x3f')][_0xaf88('0x6f')]({'where':{'id':_0x4b3ace[_0xaf88('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4d7a59,null))[_0xaf88('0x21')](function(_0x4c4190){if(_0x4c4190){_0x39032a[_0xaf88('0x47')]=_[_0xaf88('0x44')](db['CannedAnswer'][_0xaf88('0x40')]);_0x39032a[_0xaf88('0x43')]=_['keys'](_0x4b3ace[_0xaf88('0x43')]);_0x39032a[_0xaf88('0x45')]=_[_0xaf88('0x46')](_0x39032a[_0xaf88('0x47')],_0x39032a['query']);_0x53441d[_0xaf88('0x48')]=_['intersection'](_0x39032a[_0xaf88('0x47')],qs[_0xaf88('0x49')](_0x4b3ace[_0xaf88('0x43')][_0xaf88('0x49')]));_0x53441d[_0xaf88('0x48')]=_0x53441d[_0xaf88('0x48')]['length']?_0x53441d[_0xaf88('0x48')]:_0x39032a['model'];if(!_0x4b3ace[_0xaf88('0x43')][_0xaf88('0x4b')]('nolimit')){_0x53441d[_0xaf88('0x31')]=qs['limit'](_0x4b3ace[_0xaf88('0x43')][_0xaf88('0x31')]);_0x53441d[_0xaf88('0x2f')]=qs[_0xaf88('0x2f')](_0x4b3ace['query'][_0xaf88('0x2f')]);}_0x53441d[_0xaf88('0x4d')]=qs[_0xaf88('0x4e')](_0x4b3ace[_0xaf88('0x43')][_0xaf88('0x4e')]);_0x53441d[_0xaf88('0x4f')]=qs['filters'](_[_0xaf88('0x50')](_0x4b3ace[_0xaf88('0x43')],_0x39032a[_0xaf88('0x45')]));_0x53441d[_0xaf88('0x4f')][_0xaf88('0x68')]=_0x4c4190['id'];if(_0x4b3ace['query'][_0xaf88('0x51')]){_0x53441d[_0xaf88('0x4f')]=_[_0xaf88('0x52')](_0x53441d[_0xaf88('0x4f')],{'$or':_['map'](_0x53441d[_0xaf88('0x48')],function(_0x4e8e14){var _0x4a640c={};_0x4a640c[_0x4e8e14]={'$like':'%'+_0x4b3ace['query'][_0xaf88('0x51')]+'%'};return _0x4a640c;})});}_0x53441d=_[_0xaf88('0x52')]({},_0x53441d,_0x4b3ace[_0xaf88('0x54')]);return db[_0xaf88('0x6d')][_0xaf88('0x32')]({'where':_0x53441d['where']})[_0xaf88('0x21')](function(_0x185910){_0x278e47[_0xaf88('0x32')]=_0x185910;if(_0x4b3ace[_0xaf88('0x43')][_0xaf88('0x5d')]){_0x53441d[_0xaf88('0x55')]=[{'all':!![]}];}return db[_0xaf88('0x6d')][_0xaf88('0x56')](_0x53441d);})[_0xaf88('0x21')](function(_0x43bf1b){_0x278e47['rows']=_0x43bf1b;return _0x278e47;});}})['then'](respondWithFilteredResult(_0x4d7a59,_0x53441d))['catch'](handleError(_0x4d7a59,null));};exports[_0xaf88('0x70')]=function(_0x13355a,_0x232201,_0x538713){return db['WhatsappAccount'][_0xaf88('0x5e')]({'where':{'id':_0x13355a[_0xaf88('0x5a')]['id']}})['then'](handleEntityNotFound(_0x232201,null))['then'](function(_0x2b03d3){if(_0x2b03d3){return _0x2b03d3[_0xaf88('0x70')](_0x13355a['query'][_0xaf88('0x6b')]);}})[_0xaf88('0x21')](respondWithStatusCode(_0x232201,null))[_0xaf88('0x58')](handleError(_0x232201,null));};exports[_0xaf88('0x71')]=function(_0x3afe6d,_0x520eee,_0x3c2c15){return db[_0xaf88('0x3f')][_0xaf88('0x5e')]({'where':{'id':_0x3afe6d[_0xaf88('0x5a')]['id']}})['then'](handleEntityNotFound(_0x520eee,null))[_0xaf88('0x21')](function(_0x27dd41){if(_0x27dd41){return _0x27dd41[_0xaf88('0x71')](_0x3afe6d[_0xaf88('0x60')][_0xaf88('0x6b')],_[_0xaf88('0x72')](_0x3afe6d[_0xaf88('0x60')],[_0xaf88('0x6b'),'id'])||{})[_0xaf88('0x73')](function(_0xaa8173){for(var _0x21de76=0x0;_0x21de76<_0x3afe6d[_0xaf88('0x60')][_0xaf88('0x6b')]['length'];_0x21de76+=0x1){socket[_0xaf88('0x74')](_0xaf88('0x75'),{'UserId':Number(_0x3afe6d[_0xaf88('0x60')][_0xaf88('0x6b')][_0x21de76]),'WhatsappAccountId':Number(_0x3afe6d[_0xaf88('0x5a')]['id'])});}return _0xaa8173;});}})[_0xaf88('0x21')](respondWithResult(_0x520eee,null))[_0xaf88('0x58')](handleError(_0x520eee,null));};exports['removeAgents']=function(_0x5c2617,_0x555ede,_0x42702c){return db[_0xaf88('0x3f')][_0xaf88('0x5e')]({'where':{'id':_0x5c2617['params']['id']}})['then'](handleEntityNotFound(_0x555ede,null))[_0xaf88('0x21')](function(_0xefbd6a){if(_0xefbd6a){return _0xefbd6a['removeAgents'](_0x5c2617[_0xaf88('0x43')][_0xaf88('0x6b')])[_0xaf88('0x21')](function(){if(_[_0xaf88('0x76')](_0x5c2617[_0xaf88('0x43')][_0xaf88('0x6b')])){for(var _0x58db77=0x0;_0x58db77<_0x5c2617['query'][_0xaf88('0x6b')][_0xaf88('0x4a')];_0x58db77+=0x1){socket[_0xaf88('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x5c2617[_0xaf88('0x43')][_0xaf88('0x6b')][_0x58db77]),'WhatsappAccountId':Number(_0x5c2617[_0xaf88('0x5a')]['id'])});}}else{socket[_0xaf88('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x5c2617[_0xaf88('0x43')][_0xaf88('0x6b')]),'WhatsappAccountId':Number(_0x5c2617[_0xaf88('0x5a')]['id'])});}});}})[_0xaf88('0x21')](respondWithStatusCode(_0x555ede,null))['catch'](handleError(_0x555ede,null));};exports['getAgents']=function(_0x2ce1a0,_0x2a8c83,_0x561de0){var _0x3ddf4a={};var _0x2a037a={};var _0x29f1b0;var _0x1712ba;return db[_0xaf88('0x3f')][_0xaf88('0x6f')]({'where':{'id':_0x2ce1a0['params']['id']}})['then'](handleEntityNotFound(_0x2a8c83,null))['then'](function(_0x36f883){if(_0x36f883){_0x29f1b0=_0x36f883;_0x2a037a[_0xaf88('0x47')]=_[_0xaf88('0x44')](db[_0xaf88('0x77')][_0xaf88('0x40')]);_0x2a037a['query']=_['keys'](_0x2ce1a0[_0xaf88('0x43')]);_0x2a037a[_0xaf88('0x45')]=_[_0xaf88('0x46')](_0x2a037a[_0xaf88('0x47')],_0x2a037a['query']);_0x3ddf4a[_0xaf88('0x48')]=_[_0xaf88('0x46')](_0x2a037a[_0xaf88('0x47')],qs[_0xaf88('0x49')](_0x2ce1a0[_0xaf88('0x43')][_0xaf88('0x49')]));_0x3ddf4a['attributes']=_0x3ddf4a['attributes']['length']?_0x3ddf4a[_0xaf88('0x48')]:_0x2a037a[_0xaf88('0x47')];_0x3ddf4a[_0xaf88('0x4d')]=qs[_0xaf88('0x4e')](_0x2ce1a0[_0xaf88('0x43')][_0xaf88('0x4e')]);_0x3ddf4a[_0xaf88('0x4f')]=qs['filters'](_[_0xaf88('0x50')](_0x2ce1a0['query'],_0x2a037a[_0xaf88('0x45')]));if(_0x2ce1a0['query']['filter']){_0x3ddf4a[_0xaf88('0x4f')]=_[_0xaf88('0x52')](_0x3ddf4a[_0xaf88('0x4f')],{'$or':_[_0xaf88('0x3e')](_0x3ddf4a[_0xaf88('0x48')],function(_0x3d252a){var _0x2b1fcd={};_0x2b1fcd[_0x3d252a]={'$like':'%'+_0x2ce1a0[_0xaf88('0x43')][_0xaf88('0x51')]+'%'};return _0x2b1fcd;})});}_0x3ddf4a=_['merge']({},_0x3ddf4a,_0x2ce1a0['options']);return _0x29f1b0[_0xaf88('0x78')](_0x3ddf4a);}})['then'](function(_0x599a23){if(_0x599a23){_0x1712ba=_0x599a23[_0xaf88('0x4a')];if(!_0x2ce1a0[_0xaf88('0x43')][_0xaf88('0x4b')](_0xaf88('0x4c'))){_0x3ddf4a['limit']=qs[_0xaf88('0x31')](_0x2ce1a0['query']['limit']);_0x3ddf4a['offset']=qs[_0xaf88('0x2f')](_0x2ce1a0['query'][_0xaf88('0x2f')]);}return _0x29f1b0[_0xaf88('0x78')](_0x3ddf4a);}})[_0xaf88('0x21')](function(_0x4fa1a8){if(_0x4fa1a8){return _0x4fa1a8?{'count':_0x1712ba,'rows':_0x4fa1a8}:null;}})['then'](respondWithResult(_0x2a8c83,null))[_0xaf88('0x58')](handleError(_0x2a8c83,null));};exports[_0xaf88('0x79')]=function(_0x53dae4,_0x46ea67){var _0x229077=_0x53dae4[_0xaf88('0x5a')]['id'];var _0x58d97c=_0x53dae4['body'];var _0x4d757f=0xc8;var _0x49d5db=null;return db[_0xaf88('0x7a')][_0xaf88('0x7b')]({'isolationLevel':db[_0xaf88('0x7a')][_0xaf88('0x7c')][_0xaf88('0x7d')][_0xaf88('0x7e')]},function(_0x551a0b){return db['WhatsappAccount'][_0xaf88('0x6f')]({'where':{'id':_0x229077},'transaction':_0x551a0b})[_0xaf88('0x21')](function(_0x3f1ec7){if(_0x3f1ec7){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x229077},'transaction':_0x551a0b})[_0xaf88('0x21')](function(){var _0x97278f=_['map'](_0x58d97c,function(_0x335c70){_0x335c70[_0xaf88('0x68')]=_0x229077;return _0x335c70;});return db[_0xaf88('0x7f')][_0xaf88('0x80')](_0x97278f,{'transaction':_0x551a0b});});}else{_0x4d757f=0x194;_0x49d5db=[];}});})[_0xaf88('0x21')](function(){if(_0x4d757f!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x229077},'order':_0xaf88('0x81')})['then'](function(_0x5d6b47){_0x49d5db=_0x5d6b47;});}})[_0xaf88('0x58')](function(_0x1ea934){_0x4d757f=0x1f4;logger[_0xaf88('0x28')](_0x1ea934[_0xaf88('0x3b')]);if(_0x1ea934[_0xaf88('0x3c')]){delete _0x1ea934['name'];}_0x49d5db=_0x1ea934;})[_0xaf88('0x82')](function(){if(_0x49d5db===null){_0x46ea67[_0xaf88('0x2c')](_0x4d757f);}else{if(_0x4d757f===0x1f4){_0x46ea67[_0xaf88('0x2d')](_0x4d757f)['send'](_0x49d5db);}else{_0x46ea67[_0xaf88('0x2d')](_0x4d757f)['json'](_0x49d5db);}}});};exports[_0xaf88('0x83')]=function(_0x158f2b,_0x19923b,_0x3b2aa1){var _0x32080f={};var _0x35caf6={};var _0x2159b2;var _0xdb1d4a;return db[_0xaf88('0x3f')][_0xaf88('0x6f')]({'where':{'id':_0x158f2b[_0xaf88('0x5a')]['id']}})[_0xaf88('0x21')](handleEntityNotFound(_0x19923b,null))[_0xaf88('0x21')](function(_0x24c2dd){if(_0x24c2dd){_0x2159b2=_0x24c2dd;_0x35caf6['model']=_[_0xaf88('0x44')](db[_0xaf88('0x7f')][_0xaf88('0x40')]);_0x35caf6[_0xaf88('0x43')]=_[_0xaf88('0x44')](_0x158f2b[_0xaf88('0x43')]);_0x35caf6[_0xaf88('0x45')]=_[_0xaf88('0x46')](_0x35caf6['model'],_0x35caf6[_0xaf88('0x43')]);_0x32080f[_0xaf88('0x48')]=_['intersection'](_0x35caf6[_0xaf88('0x47')],qs[_0xaf88('0x49')](_0x158f2b[_0xaf88('0x43')][_0xaf88('0x49')]));_0x32080f[_0xaf88('0x48')]=_0x32080f['attributes'][_0xaf88('0x4a')]?_0x32080f[_0xaf88('0x48')]:_0x35caf6[_0xaf88('0x47')];_0x32080f['order']=qs[_0xaf88('0x4e')](_0x158f2b[_0xaf88('0x43')][_0xaf88('0x4e')]);_0x32080f[_0xaf88('0x4f')]=qs['filters'](_[_0xaf88('0x50')](_0x158f2b[_0xaf88('0x43')],_0x35caf6[_0xaf88('0x45')]));if(_0x158f2b[_0xaf88('0x43')]['filter']){_0x32080f[_0xaf88('0x4f')]=_[_0xaf88('0x52')](_0x32080f['where'],{'$or':_[_0xaf88('0x3e')](_0x32080f[_0xaf88('0x48')],function(_0xadbc98){var _0x5568aa={};_0x5568aa[_0xadbc98]={'$like':'%'+_0x158f2b[_0xaf88('0x43')][_0xaf88('0x51')]+'%'};return _0x5568aa;})});}_0x32080f=_[_0xaf88('0x52')]({},_0x32080f,_0x158f2b[_0xaf88('0x54')]);return _0x2159b2[_0xaf88('0x83')](_0x32080f);}})[_0xaf88('0x21')](function(_0x452f32){if(_0x452f32){_0xdb1d4a=_0x452f32[_0xaf88('0x4a')];if(!_0x158f2b[_0xaf88('0x43')][_0xaf88('0x4b')]('nolimit')){_0x32080f[_0xaf88('0x31')]=qs[_0xaf88('0x31')](_0x158f2b[_0xaf88('0x43')][_0xaf88('0x31')]);_0x32080f['offset']=qs[_0xaf88('0x2f')](_0x158f2b[_0xaf88('0x43')][_0xaf88('0x2f')]);}return _0x2159b2['getApplications'](_0x32080f);}})[_0xaf88('0x21')](function(_0x359d2e){if(_0x359d2e){return _0x359d2e?{'count':_0xdb1d4a,'rows':_0x359d2e}:null;}})[_0xaf88('0x21')](respondWithResult(_0x19923b,null))[_0xaf88('0x58')](handleError(_0x19923b,null));};exports[_0xaf88('0x84')]=function(_0x302bf1,_0x2e4a66,_0x576363){var _0x44c205={'channel':'whatsapp'};var _0x60fbc1=[];var _0x4151c6=[];var _0x302161={};return db['WhatsappAccount'][_0xaf88('0x5e')]({'where':{'id':_0x302bf1[_0xaf88('0x5a')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0xaf88('0x21')](handleEntityNotFound(_0x2e4a66,null))[_0xaf88('0x21')](function(_0x3720a2){_0x44c205[_0xaf88('0x85')]=_0x3720a2;if(_0x44c205[_0xaf88('0x85')]&&_0x44c205[_0xaf88('0x85')][_0xaf88('0x86')]===_0xaf88('0x87')&&_0x302bf1['body'][_0xaf88('0x88')]){if(_0x302bf1[_0xaf88('0x60')][_0xaf88('0x88')][_0xaf88('0x4a')]===0x0)return;if(_0x302bf1[_0xaf88('0x60')]['statuses'][0x0][_0xaf88('0x89')]!==_0xaf88('0x8a'))return;return db[_0xaf88('0x8b')]['update']({'read':!![],'readAt':_0x302bf1[_0xaf88('0x60')]['statuses'][0x0][_0xaf88('0x8c')]},{'where':{'messageId':_0x302bf1[_0xaf88('0x60')][_0xaf88('0x88')][0x0][_0xaf88('0x8d')]},'individualHooks':!![]})[_0xaf88('0x21')](function(_0x1f26f4){return _0x2e4a66[_0xaf88('0x2d')](0xc8)[_0xaf88('0x2e')](_0x1f26f4);});}_0x44c205[_0xaf88('0x8e')]=_['orderBy'](_0x3720a2[_0xaf88('0x8f')],['priority'],[_0xaf88('0x90')]);if(_0x44c205[_0xaf88('0x85')][_0xaf88('0x8f')]){delete _0x44c205[_0xaf88('0x85')][_0xaf88('0x8f')];}return db['CmContact'][_0xaf88('0x67')]()[_0xaf88('0x21')](function(_0x2d6d85){if(!_0x2d6d85){throw new db[(_0xaf88('0x91'))][(_0xaf88('0x92'))](_0xaf88('0x93'));}_0x60fbc1=_[_0xaf88('0x94')](_[_0xaf88('0x44')](_0x2d6d85),[_0xaf88('0x95'),_0xaf88('0x96')]);_0x4151c6=_[_0xaf88('0x94')](_[_0xaf88('0x44')](_0x2d6d85),[_0xaf88('0x95'),_0xaf88('0x96'),'CompanyId',_0xaf88('0x97')]);_0x44c205[_0xaf88('0x60')]={'mapKey':'mobile'};if(_0x44c205['account']&&_0x44c205[_0xaf88('0x85')]['type']===_0xaf88('0x98')){_0x44c205['body'][_0xaf88('0x99')]=_0x302bf1[_0xaf88('0x60')][_0xaf88('0x9a')]['replace']('whatsapp:','');_0x44c205['body'][_0xaf88('0x60')]=_0x302bf1[_0xaf88('0x60')][_0xaf88('0x9b')];_0x44c205[_0xaf88('0x60')][_0xaf88('0x9c')]=_0x302bf1[_0xaf88('0x60')][_0xaf88('0x9d')];}if(_0x44c205['account']&&_0x44c205[_0xaf88('0x85')][_0xaf88('0x86')]===_0xaf88('0x87')){_0x44c205[_0xaf88('0x60')][_0xaf88('0x99')]=_0x302bf1[_0xaf88('0x60')]['notifications'][0x0]['from'];_0x44c205['body'][_0xaf88('0x60')]=_0x302bf1[_0xaf88('0x60')]['notifications'][0x0][_0xaf88('0x2a')]['body'];_0x44c205[_0xaf88('0x60')]['messageId']=_0x302bf1[_0xaf88('0x60')]['notifications'][0x0][_0xaf88('0x8d')];}if(_0x44c205[_0xaf88('0x60')]['id']){delete _0x44c205[_0xaf88('0x60')]['id'];}if(_[_0xaf88('0x9e')](_0x44c205[_0xaf88('0x60')][_0xaf88('0x99')])){throw new db[(_0xaf88('0x91'))][(_0xaf88('0x92'))](_0xaf88('0x9f'));}if(_[_0xaf88('0x9e')](_0x44c205[_0xaf88('0x60')]['body'])||_0x44c205[_0xaf88('0x60')]['body']===''){throw new db[(_0xaf88('0x91'))][(_0xaf88('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaf88('0x9e')](_0x44c205['body'][_0xaf88('0xa0')])){throw new db['Sequelize']['ValidationError'](_0xaf88('0xa1')+_0x4151c6);}if(!_[_0xaf88('0xa2')](_0x4151c6,_0x44c205[_0xaf88('0x60')][_0xaf88('0xa0')])){throw new db[(_0xaf88('0x91'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4151c6);}_0x302161[_0x44c205[_0xaf88('0x60')][_0xaf88('0xa0')]]=_0x44c205[_0xaf88('0x60')][_0xaf88('0x99')];return db[_0xaf88('0xa3')]['find']({'where':{'id':_0x44c205[_0xaf88('0x85')][_0xaf88('0x97')]},'include':[{'model':db[_0xaf88('0xa4')],'as':'Contacts','where':_0x302161,'limit':0x1,'order':[[_0xaf88('0x96'),_0xaf88('0xa5')]]}]});})[_0xaf88('0x21')](handleEntityNotFound(_0x2e4a66,null))[_0xaf88('0x21')](function(_0x949146){if(_0x949146){_0x44c205[_0xaf88('0xa6')]=_['omit'](_0x949146,['Contacts']);if(_0x949146[_0xaf88('0xa7')][_0xaf88('0x4a')]){return _0x949146[_0xaf88('0xa7')][0x0];}var _0x10fdd9=_[_0xaf88('0x19')](_0x44c205[_0xaf88('0x60')],{'firstName':_0x44c205[_0xaf88('0x60')][_0xaf88('0x99')],'ListId':_0x949146['id']});_0x10fdd9[_0x44c205[_0xaf88('0x60')]['mapKey']]=_0x44c205[_0xaf88('0x60')][_0xaf88('0x99')];return db['CmContact'][_0xaf88('0x5f')](_0x10fdd9,{'fields':_0x60fbc1,'raw':!![]});}})[_0xaf88('0x21')](handleEntityNotFound(_0x2e4a66,null))[_0xaf88('0x21')](function(_0x47bdcf){if(_0x47bdcf){_0x44c205[_0xaf88('0xa8')]=_0x47bdcf;var _0x163981={'ContactId':_0x47bdcf['id'],'phone':_0x44c205[_0xaf88('0x60')][_0xaf88('0x99')],'WhatsappAccountId':_0x302bf1['params']['id']};var _0x298e08={'ContactId':_0x47bdcf['id'],'WhatsappAccountId':_0x302bf1[_0xaf88('0x5a')]['id'],'closed':![]};return db[_0xaf88('0xa9')][_0xaf88('0x5e')]({'where':_0x298e08})[_0xaf88('0x21')](function(_0x2a4543){if(_0x2a4543){return[_0x2a4543,![]];}return db[_0xaf88('0xa9')][_0xaf88('0x5f')](_0x163981)[_0xaf88('0x21')](function(_0x4f2442){return[_0x4f2442,!![]];});});}})['spread'](function(_0x445c80,_0x3f8a5a){_0x44c205[_0xaf88('0xaa')]=_0x445c80[_0xaf88('0x39')]({'plain':!![]});_0x44c205[_0xaf88('0xaa')][_0xaf88('0xab')]=![];if(_0x3f8a5a){if(_0x44c205['account'][_0xaf88('0xac')]){_0x44c205['applications'][_0xaf88('0xad')]({'id':0x0,'priority':_0x44c205['applications'][_0xaf88('0x4a')]+0x1,'app':_0xaf88('0xae'),'appdata':_0xaf88('0xaf'),'interval':_0xaf88('0xb0')});}_0x44c205[_0xaf88('0xaa')][_0xaf88('0xab')]=!![];}return db['WhatsappMessage'][_0xaf88('0x5f')]({'phone':_0x44c205[_0xaf88('0x60')][_0xaf88('0x99')],'messageId':_0x44c205[_0xaf88('0x60')]['messageId'],'body':_0x44c205[_0xaf88('0x60')]['body'],'WhatsappAccountId':_0x302bf1[_0xaf88('0x5a')]['id'],'WhatsappInteractionId':_0x445c80['id'],'direction':'in','ContactId':_0x445c80[_0xaf88('0xb1')],'AttachmentId':_0x44c205[_0xaf88('0x60')][_0xaf88('0xb2')]});})[_0xaf88('0x21')](function(_0x3769d8){_0x44c205['message']=_0x3769d8;if(!_0x44c205[_0xaf88('0xaa')][_0xaf88('0xb3')])return;return db[_0xaf88('0x77')][_0xaf88('0x5e')]({'attributes':['id','name'],'where':{'id':_0x44c205[_0xaf88('0xaa')][_0xaf88('0xb3')]}});})['then'](function(_0x443557){if(_0x443557){_0x44c205[_0xaf88('0x8e')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x443557[_0xaf88('0x3c')]+','+(_0x44c205[_0xaf88('0x85')][_0xaf88('0xb4')]||0xa),'interval':_0xaf88('0xb0')});}if(!_0x44c205['interaction'][_0xaf88('0xb5')])return;return db['WhatsappQueue'][_0xaf88('0x5e')]({'attributes':['id',_0xaf88('0x3c')],'where':{'id':_0x44c205[_0xaf88('0xaa')][_0xaf88('0xb5')]}});})[_0xaf88('0x21')](function(_0x12d5ce){if(_0x12d5ce){_0x44c205[_0xaf88('0x8e')][_0xaf88('0xb6')]({'id':0x0,'priority':0x1,'app':_0xaf88('0xb7'),'appdata':_0x12d5ce[_0xaf88('0x3c')]+','+(_0x44c205[_0xaf88('0x85')][_0xaf88('0xb8')]||0x12c),'interval':_0xaf88('0xb0')});}return respondWithRpcPromise(_0xaf88('0xb9'),'startRouting',_0x44c205);})[_0xaf88('0x21')](function(_0x4a47b8){if(_0x4a47b8){var _0x40deb7=0xc8;var _0x5ce516='receiveMessage';logger[_0xaf88('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5ce516,_0x40deb7,_0xaf88('0xba'));logger[_0xaf88('0x25')](_0xaf88('0xbb'),_0x5ce516,_0x40deb7,_0xaf88('0xba'),JSON['stringify'](_0x4a47b8));if(_0x44c205[_0xaf88('0x85')]['type']===_0xaf88('0x98')){return _0x2e4a66[_0xaf88('0x2d')](_0x40deb7)[_0xaf88('0x33')](_0xaf88('0xbc'),'text/xml')[_0xaf88('0xbd')]('\x0a');}else{return _0x2e4a66[_0xaf88('0x2d')](_0x40deb7)['json'](_0x4a47b8);}}});})['catch'](handleError(_0x2e4a66,null));};exports[_0xaf88('0xbd')]=function(_0x55217a,_0x54212b,_0x4cb52b){var _0x3e48a1,_0x224812,_0x33e64b;if(_[_0xaf88('0x9e')](_0x55217a[_0xaf88('0x60')][_0xaf88('0x60')])||_0x55217a[_0xaf88('0x60')][_0xaf88('0x60')]===''){throw new db[(_0xaf88('0x91'))][(_0xaf88('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaf88('0x9e')](_0x55217a[_0xaf88('0x60')]['to'])){throw new db[(_0xaf88('0x91'))]['ValidationError'](_0xaf88('0xbe'));}_0x3e48a1=_0x55217a['body']['to'];return db[_0xaf88('0x3f')][_0xaf88('0x5e')]({'where':{'id':_0x55217a[_0xaf88('0x5a')]['id']},'include':[{'model':db[_0xaf88('0xa3')],'as':_0xaf88('0xbf'),'include':[{'model':db['CmContact'],'as':_0xaf88('0xa7'),'where':{'mobile':_0x3e48a1},'limit':0x1,'order':[[_0xaf88('0x96'),_0xaf88('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x54212b,null))[_0xaf88('0x21')](function(_0x1928c9){if(_0x1928c9&&_0x1928c9['List']){_0x224812=_0x1928c9[_0xaf88('0x39')]({'plain':!![]});if(_0x224812[_0xaf88('0xbf')]&&_0x224812[_0xaf88('0xbf')]['Contacts'][_0xaf88('0x4a')]){return _0x224812['List'][_0xaf88('0xa7')][0x0];}return db['CmContact'][_0xaf88('0x5f')](_[_0xaf88('0x19')](_0x55217a[_0xaf88('0x60')],{'firstName':_0x3e48a1,'mobile':_0x3e48a1,'phone':_0x3e48a1,'ListId':_0x224812[_0xaf88('0x97')]}));}})[_0xaf88('0x21')](handleEntityNotFound(_0x54212b,null))['then'](function(_0x227693){if(_0x227693){_0x33e64b=_0x227693;return db[_0xaf88('0xa9')][_0xaf88('0x5e')]({'where':{'ContactId':_0x33e64b['id'],'closed':![],'WhatsappAccountId':_0x224812['id']}})[_0xaf88('0x21')](function(_0x12bb94){if(_0x12bb94){return[_0x12bb94,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x55217a[_0xaf88('0x61')]['id'],'ContactId':_0x33e64b['id'],'WhatsappAccountId':_0x224812['id'],'phone':_0x3e48a1,'firstMsgDirection':_0xaf88('0xc0'),'Messages':[_[_0xaf88('0x52')](_0x55217a[_0xaf88('0x60')],{'read':![],'body':_0x55217a[_0xaf88('0x60')][_0xaf88('0x60')],'phone':_0x3e48a1,'WhatsappAccountId':_0x224812['id'],'UserId':_0x55217a[_0xaf88('0x61')]['id'],'ContactId':_0x33e64b['id']})]},{'include':[{'model':db[_0xaf88('0x8b')],'as':_0xaf88('0xc1')}]})[_0xaf88('0x21')](function(_0x2734c3){return[_0x2734c3,!![]];});});}})['spread'](function(_0x33ec62,_0x3e5387){if(_0x3e5387){return _0x33ec62;}return db['WhatsappMessage'][_0xaf88('0x5f')](_[_0xaf88('0x52')](_0x55217a[_0xaf88('0x60')],{'read':![],'body':_0x55217a[_0xaf88('0x60')][_0xaf88('0x60')],'phone':_0x3e48a1,'WhatsappAccountId':_0x224812['id'],'WhatsappInteractionId':_0x33ec62['id'],'UserId':_0x55217a[_0xaf88('0x61')]['id'],'ContactId':_0x33e64b['id']}))[_0xaf88('0x21')](function(_0x54e1d7){_0x33ec62['dataValues'][_0xaf88('0xc1')]=[];_0x33ec62[_0xaf88('0xc2')][_0xaf88('0xc1')][_0xaf88('0xad')](_0x54e1d7[_0xaf88('0xc2')]);return _0x33ec62;});})[_0xaf88('0x21')](respondWithResult(_0x54212b,null))[_0xaf88('0x58')](handleError(_0x54212b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e8c549f..936742b 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 _0xfc9d=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x3e021c,_0x10e5be){var _0x5445ed=function(_0x84280d){while(--_0x84280d){_0x3e021c['push'](_0x3e021c['shift']());}};_0x5445ed(++_0x10e5be);}(_0xfc9d,0x194));var _0xdfc9=function(_0x4e11fc,_0x2602e){_0x4e11fc=_0x4e11fc-0x0;var _0x398c4f=_0xfc9d[_0x4e11fc];return _0x398c4f;};'use strict';var EventEmitter=require(_0xdfc9('0x0'));var WhatsappAccount=require(_0xdfc9('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdfc9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdfc9('0x3'),'afterDestroy':_0xdfc9('0x4')};function emitEvent(_0x3962cf){return function(_0x168132,_0x4fba6d,_0x4e0e35){WhatsappAccountEvents[_0xdfc9('0x5')](_0x3962cf+':'+_0x168132['id'],_0x168132);WhatsappAccountEvents[_0xdfc9('0x5')](_0x3962cf,_0x168132);_0x4e0e35(null);};}for(var e in events){if(events[_0xdfc9('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x804e=['emit','hasOwnProperty','hook','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x2b13bc,_0x45b308){var _0x48275b=function(_0x21d34a){while(--_0x21d34a){_0x2b13bc['push'](_0x2b13bc['shift']());}};_0x48275b(++_0x45b308);}(_0x804e,0xc9));var _0xe804=function(_0x1d3e6d,_0x8efaa0){_0x1d3e6d=_0x1d3e6d-0x0;var _0x57bd6c=_0x804e[_0x1d3e6d];return _0x57bd6c;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xe804('0x0'))['db'][_0xe804('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe804('0x2')](0x0);var events={'afterCreate':_0xe804('0x3'),'afterUpdate':_0xe804('0x4'),'afterDestroy':_0xe804('0x5')};function emitEvent(_0x57329){return function(_0xc2f4f3,_0x2f92a8,_0x55954b){WhatsappAccountEvents[_0xe804('0x6')](_0x57329+':'+_0xc2f4f3['id'],_0xc2f4f3);WhatsappAccountEvents['emit'](_0x57329,_0xc2f4f3);_0x55954b(null);};}for(var e in events){if(events[_0xe804('0x7')](e)){var event=events[e];WhatsappAccount[_0xe804('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 54e6c18..1187680 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 _0xdc13=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','util','api'];(function(_0x5dfc42,_0x456c5c){var _0x320fd9=function(_0x14c25a){while(--_0x14c25a){_0x5dfc42['push'](_0x5dfc42['shift']());}};_0x320fd9(++_0x456c5c);}(_0xdc13,0xb2));var _0x3dc1=function(_0x8e4f92,_0x41d992){_0x8e4f92=_0x8e4f92-0x0;var _0x108dd0=_0xdc13[_0x8e4f92];return _0x108dd0;};'use strict';var _=require('lodash');var util=require(_0x3dc1('0x0'));var logger=require('../../config/logger')(_0x3dc1('0x1'));var moment=require(_0x3dc1('0x2'));var BPromise=require(_0x3dc1('0x3'));var rp=require(_0x3dc1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3dc1('0x5'));var config=require(_0x3dc1('0x6'));var attributes=require(_0x3dc1('0x7'));module[_0x3dc1('0x8')]=function(_0x22a663,_0x13902e){return _0x22a663[_0x3dc1('0x9')](_0x3dc1('0xa'),attributes,{'tableName':_0x3dc1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfad=['moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x3167b1,_0x5ad266){var _0x362152=function(_0xc49d4a){while(--_0xc49d4a){_0x3167b1['push'](_0x3167b1['shift']());}};_0x362152(++_0x5ad266);}(_0xdfad,0xf4));var _0xddfa=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0xdfad[_0x52ea08];return _0x28d546;};'use strict';var _=require(_0xddfa('0x0'));var util=require(_0xddfa('0x1'));var logger=require(_0xddfa('0x2'))('api');var moment=require(_0xddfa('0x3'));var BPromise=require(_0xddfa('0x4'));var rp=require(_0xddfa('0x5'));var fs=require('fs');var path=require(_0xddfa('0x6'));var rimraf=require(_0xddfa('0x7'));var config=require('../../config/environment');var attributes=require(_0xddfa('0x8'));module[_0xddfa('0x9')]=function(_0xa57852,_0x234b54){return _0xa57852[_0xddfa('0xa')](_0xddfa('0xb'),attributes,{'tableName':_0xddfa('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 c47a22b..cca025e 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 _0x357d=['map','model','include','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','find','options','raw','where','attributes'];(function(_0xeb7bd2,_0x3e2814){var _0x4db43d=function(_0x400846){while(--_0x400846){_0xeb7bd2['push'](_0xeb7bd2['shift']());}};_0x4db43d(++_0x3e2814);}(_0x357d,0x17a));var _0xd357=function(_0x526944,_0x2a2c50){_0x526944=_0x526944-0x0;var _0x3fa769=_0x357d[_0x526944];return _0x3fa769;};'use strict';var _=require(_0xd357('0x0'));var util=require(_0xd357('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd357('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd357('0x3'));var logger=require(_0xd357('0x4'))(_0xd357('0x5'));var config=require(_0xd357('0x6'));var jayson=require(_0xd357('0x7'));var client=jayson['client'][_0xd357('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd357('0x9')],{'host':_0xd357('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xd357('0xb')](socket);function respondWithRpcPromise(_0x30e16c,_0x48be92,_0x2ec9bb){return new BPromise(function(_0x285b3d,_0x32c94f){return client[_0xd357('0xc')](_0x30e16c,_0x2ec9bb)[_0xd357('0xd')](function(_0x3bad5d){logger[_0xd357('0xe')](_0xd357('0xf'),_0x48be92,_0xd357('0x10'));logger[_0xd357('0x11')](_0xd357('0x12'),_0x48be92,_0xd357('0x10'),JSON[_0xd357('0x13')](_0x3bad5d));if(_0x3bad5d['error']){if(_0x3bad5d[_0xd357('0x14')][_0xd357('0x15')]===0x1f4){logger[_0xd357('0x14')](_0xd357('0xf'),_0x48be92,_0x3bad5d['error']['message']);return _0x32c94f(_0x3bad5d[_0xd357('0x14')][_0xd357('0x16')]);}logger[_0xd357('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x48be92,_0x3bad5d[_0xd357('0x14')]['message']);return _0x285b3d(_0x3bad5d[_0xd357('0x14')][_0xd357('0x16')]);}else{logger[_0xd357('0xe')](_0xd357('0xf'),_0x48be92,_0xd357('0x10'));_0x285b3d(_0x3bad5d[_0xd357('0x17')][_0xd357('0x16')]);}})['catch'](function(_0x4f01af){logger[_0xd357('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x48be92,_0x4f01af);_0x32c94f(_0x4f01af);});});}exports[_0xd357('0x18')]=function(_0x5f24f1){var _0x258bb3=this;return new Promise(function(_0x348d8e,_0x55e797){return db['WhatsappAccount'][_0xd357('0x19')]({'raw':_0x5f24f1['options']?_0x5f24f1[_0xd357('0x1a')][_0xd357('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f24f1[_0xd357('0x1a')]?_0x5f24f1[_0xd357('0x1a')][_0xd357('0x1c')]||null:null,'attributes':_0x5f24f1[_0xd357('0x1a')]?_0x5f24f1[_0xd357('0x1a')][_0xd357('0x1d')]||null:null,'include':_0x5f24f1['options']?_0x5f24f1['options']['include']?_[_0xd357('0x1e')](_0x5f24f1[_0xd357('0x1a')]['include'],function(_0x1adb97){return{'model':db[_0x1adb97[_0xd357('0x1f')]],'as':_0x1adb97['as'],'attributes':_0x1adb97[_0xd357('0x1d')],'include':_0x1adb97['include']?_[_0xd357('0x1e')](_0x1adb97[_0xd357('0x20')],function(_0x179144){return{'model':db[_0x179144[_0xd357('0x1f')]],'as':_0x179144['as'],'attributes':_0x179144[_0xd357('0x1d')],'include':_0x179144['include']?_['map'](_0x179144['include'],function(_0xcff9d3){return{'model':db[_0xcff9d3['model']],'as':_0xcff9d3['as'],'attributes':_0xcff9d3[_0xd357('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd357('0xd')](function(_0x4790d6){logger[_0xd357('0xe')](_0xd357('0x18'),_0x5f24f1);logger[_0xd357('0x11')]('ShowWhatsappAccount',_0x5f24f1,JSON['stringify'](_0x4790d6));_0x348d8e(_0x4790d6);})[_0xd357('0x21')](function(_0x3ce27a){logger[_0xd357('0x14')](_0xd357('0x18'),_0x3ce27a['message'],_0x5f24f1);_0x55e797(_0x258bb3['error'](0x1f4,_0x3ce27a[_0xd357('0x16')]));});});}; \ No newline at end of file +var _0x54e4=['ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','model','map','then','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x4583f5,_0x48986e){var _0x16513b=function(_0x324230){while(--_0x324230){_0x4583f5['push'](_0x4583f5['shift']());}};_0x16513b(++_0x48986e);}(_0x54e4,0x169));var _0x454e=function(_0x5dca40,_0x3958d9){_0x5dca40=_0x5dca40-0x0;var _0xe6d885=_0x54e4[_0x5dca40];return _0xe6d885;};'use strict';var _=require(_0x454e('0x0'));var util=require('util');var moment=require(_0x454e('0x1'));var BPromise=require('bluebird');var rs=require(_0x454e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x454e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x454e('0x4'))(_0x454e('0x5'));var config=require(_0x454e('0x6'));var jayson=require(_0x454e('0x7'));var client=jayson['client'][_0x454e('0x8')]({'port':0x232a});config[_0x454e('0x9')]=_[_0x454e('0xa')](config[_0x454e('0x9')],{'host':_0x454e('0xb'),'port':0x18eb});var socket=require(_0x454e('0xc'))(new Redis(config[_0x454e('0x9')]));require('./whatsappAccount.socket')[_0x454e('0xd')](socket);function respondWithRpcPromise(_0x3eddb0,_0x1a84e1,_0x3d7f21){return new BPromise(function(_0x52a8e1,_0x295ad4){return client[_0x454e('0xe')](_0x3eddb0,_0x3d7f21)['then'](function(_0x1a2ee5){logger[_0x454e('0xf')](_0x454e('0x10'),_0x1a84e1,'request\x20sent');logger[_0x454e('0x11')](_0x454e('0x12'),_0x1a84e1,_0x454e('0x13'),JSON[_0x454e('0x14')](_0x1a2ee5));if(_0x1a2ee5[_0x454e('0x15')]){if(_0x1a2ee5[_0x454e('0x15')]['code']===0x1f4){logger[_0x454e('0x15')](_0x454e('0x10'),_0x1a84e1,_0x1a2ee5['error'][_0x454e('0x16')]);return _0x295ad4(_0x1a2ee5['error']['message']);}logger[_0x454e('0x15')](_0x454e('0x10'),_0x1a84e1,_0x1a2ee5['error'][_0x454e('0x16')]);return _0x52a8e1(_0x1a2ee5[_0x454e('0x15')][_0x454e('0x16')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1a84e1,_0x454e('0x13'));_0x52a8e1(_0x1a2ee5[_0x454e('0x17')][_0x454e('0x16')]);}})['catch'](function(_0x17cf38){logger['error'](_0x454e('0x10'),_0x1a84e1,_0x17cf38);_0x295ad4(_0x17cf38);});});}exports[_0x454e('0x18')]=function(_0x3ed225){var _0x3da663=this;return new Promise(function(_0x1e21cc,_0x30e5a3){return db[_0x454e('0x19')][_0x454e('0x1a')]({'raw':_0x3ed225[_0x454e('0x1b')]?_0x3ed225['options']['raw']===undefined?!![]:![]:!![],'where':_0x3ed225['options']?_0x3ed225[_0x454e('0x1b')][_0x454e('0x1c')]||null:null,'attributes':_0x3ed225[_0x454e('0x1b')]?_0x3ed225[_0x454e('0x1b')][_0x454e('0x1d')]||null:null,'include':_0x3ed225[_0x454e('0x1b')]?_0x3ed225[_0x454e('0x1b')][_0x454e('0x1e')]?_['map'](_0x3ed225['options'][_0x454e('0x1e')],function(_0x57134f){return{'model':db[_0x57134f[_0x454e('0x1f')]],'as':_0x57134f['as'],'attributes':_0x57134f['attributes'],'include':_0x57134f[_0x454e('0x1e')]?_['map'](_0x57134f['include'],function(_0x5ee039){return{'model':db[_0x5ee039['model']],'as':_0x5ee039['as'],'attributes':_0x5ee039[_0x454e('0x1d')],'include':_0x5ee039['include']?_[_0x454e('0x20')](_0x5ee039['include'],function(_0x343c4d){return{'model':db[_0x343c4d[_0x454e('0x1f')]],'as':_0x343c4d['as'],'attributes':_0x343c4d[_0x454e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x454e('0x21')](function(_0x4fa0ca){logger[_0x454e('0xf')](_0x454e('0x18'),_0x3ed225);logger[_0x454e('0x11')](_0x454e('0x18'),_0x3ed225,JSON[_0x454e('0x14')](_0x4fa0ca));_0x1e21cc(_0x4fa0ca);})[_0x454e('0x22')](function(_0x5c0af6){logger['error'](_0x454e('0x18'),_0x5c0af6[_0x454e('0x16')],_0x3ed225);_0x30e5a3(_0x3da663['error'](0x1f4,_0x5c0af6['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7a85ffd..7eba681 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 _0x3d3e=['save','remove','update','emit','length','whatsappAccount:'];(function(_0x5318d5,_0x1ce467){var _0x49db7b=function(_0x255971){while(--_0x255971){_0x5318d5['push'](_0x5318d5['shift']());}};_0x49db7b(++_0x1ce467);}(_0x3d3e,0x1b0));var _0xe3d3=function(_0x32b8c9,_0x48f300){_0x32b8c9=_0x32b8c9-0x0;var _0x30a3b9=_0x3d3e[_0x32b8c9];return _0x30a3b9;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xe3d3('0x0'),_0xe3d3('0x1'),_0xe3d3('0x2')];function createListener(_0x562fe7,_0xd3510d){return function(_0x3dc770){_0xd3510d[_0xe3d3('0x3')](_0x562fe7,_0x3dc770);};}function removeListener(_0x1ede89,_0x2f12b3){return function(){WhatsappAccountEvents['removeListener'](_0x1ede89,_0x2f12b3);};}exports['register']=function(_0x3fe30b){for(var _0x10dd6f=0x0,_0x5ac26d=events[_0xe3d3('0x4')];_0x10dd6f<_0x5ac26d;_0x10dd6f++){var _0x11ece8=events[_0x10dd6f];var _0x102967=createListener(_0xe3d3('0x5')+_0x11ece8,_0x3fe30b);WhatsappAccountEvents['on'](_0x11ece8,_0x102967);}}; \ No newline at end of file +var _0x406d=['whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x406d,0x71));var _0xd406=function(_0x4f7d6b,_0x44c6e6){_0x4f7d6b=_0x4f7d6b-0x0;var _0x134cf8=_0x406d[_0x4f7d6b];return _0x134cf8;};'use strict';var WhatsappAccountEvents=require(_0xd406('0x0'));var events=[_0xd406('0x1'),_0xd406('0x2'),'update'];function createListener(_0x2c84d1,_0x4596f2){return function(_0x5e22b3){_0x4596f2[_0xd406('0x3')](_0x2c84d1,_0x5e22b3);};}function removeListener(_0x3eb077,_0xedf67b){return function(){WhatsappAccountEvents[_0xd406('0x4')](_0x3eb077,_0xedf67b);};}exports['register']=function(_0x1f7bd9){for(var _0x4674c4=0x0,_0x319685=events[_0xd406('0x5')];_0x4674c4<_0x319685;_0x4674c4++){var _0x498db2=events[_0x4674c4];var _0x5b456a=createListener(_0xd406('0x6')+_0x498db2,_0x1f7bd9);WhatsappAccountEvents['on'](_0x498db2,_0x5b456a);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 03d72ab..5960bfb 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 _0x3cbd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','/:id','isAuthenticated','post','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x2aac71,_0x299ab5){var _0x1077b4=function(_0x1f1a40){while(--_0x1f1a40){_0x2aac71['push'](_0x2aac71['shift']());}};_0x1077b4(++_0x299ab5);}(_0x3cbd,0x1d0));var _0xd3cb=function(_0x32d1b3,_0x2dcb60){_0x32d1b3=_0x32d1b3-0x0;var _0x1f0b74=_0x3cbd[_0x32d1b3];return _0x1f0b74;};'use strict';var multer=require('multer');var util=require(_0xd3cb('0x0'));var path=require(_0xd3cb('0x1'));var timeout=require(_0xd3cb('0x2'));var express=require(_0xd3cb('0x3'));var router=express[_0xd3cb('0x4')]();var fs_extra=require(_0xd3cb('0x5'));var auth=require(_0xd3cb('0x6'));var interaction=require(_0xd3cb('0x7'));var config=require('../../config/environment');var controller=require(_0xd3cb('0x8'));router[_0xd3cb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd3cb('0x9')](_0xd3cb('0xa'),auth[_0xd3cb('0xb')](),controller['show']);router[_0xd3cb('0xc')]('/',auth['isAuthenticated'](),controller[_0xd3cb('0xd')]);router[_0xd3cb('0xe')](_0xd3cb('0xa'),auth['isAuthenticated'](),controller[_0xd3cb('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd3cb('0x10')]);module[_0xd3cb('0x11')]=router; \ No newline at end of file +var _0x86f8=['/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index'];(function(_0x317bdc,_0x27b5e6){var _0x529e7f=function(_0x551f2e){while(--_0x551f2e){_0x317bdc['push'](_0x317bdc['shift']());}};_0x529e7f(++_0x27b5e6);}(_0x86f8,0x84));var _0x886f=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x86f8[_0xb1cf84];return _0x4bad2e;};'use strict';var multer=require('multer');var util=require(_0x886f('0x0'));var path=require(_0x886f('0x1'));var timeout=require(_0x886f('0x2'));var express=require(_0x886f('0x3'));var router=express[_0x886f('0x4')]();var fs_extra=require(_0x886f('0x5'));var auth=require(_0x886f('0x6'));var interaction=require(_0x886f('0x7'));var config=require(_0x886f('0x8'));var controller=require(_0x886f('0x9'));router[_0x886f('0xa')]('/',auth['isAuthenticated'](),controller[_0x886f('0xb')]);router[_0x886f('0xa')](_0x886f('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x886f('0xc'),auth[_0x886f('0xd')](),controller[_0x886f('0xe')]);router[_0x886f('0xf')](_0x886f('0xc'),auth[_0x886f('0xd')](),controller[_0x886f('0x10')]);module[_0x886f('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f7ab893..55e0391 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 _0x80c1=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x38e61d,_0x4e9a42){var _0x33ba21=function(_0x5e45b8){while(--_0x5e45b8){_0x38e61d['push'](_0x38e61d['shift']());}};_0x33ba21(++_0x4e9a42);}(_0x80c1,0x186));var _0x180c=function(_0x458436,_0x4bd6ed){_0x458436=_0x458436-0x0;var _0x5d4f78=_0x80c1[_0x458436];return _0x5d4f78;};'use strict';var Sequelize=require(_0x180c('0x0'));module[_0x180c('0x1')]={'priority':{'type':Sequelize[_0x180c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x180c('0x3')],'allowNull':![],'defaultValue':_0x180c('0x4')},'appdata':{'type':Sequelize[_0x180c('0x5')]()},'description':{'type':Sequelize[_0x180c('0x3')]},'interval':{'type':Sequelize[_0x180c('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb923=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0xb923,0x1a0));var _0x3b92=function(_0x61b92d,_0xd4358c){_0x61b92d=_0x61b92d-0x0;var _0x99d65d=_0xb923[_0x61b92d];return _0x99d65d;};'use strict';var Sequelize=require(_0x3b92('0x0'));module[_0x3b92('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3b92('0x2')],'allowNull':![],'defaultValue':_0x3b92('0x3')},'appdata':{'type':Sequelize[_0x3b92('0x4')]()},'description':{'type':Sequelize[_0x3b92('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3b92('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 66d713e..ee92556 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 _0x323f=['send','index','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','rows','catch','show','params','keys','create','body','find','rimraf','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name'];(function(_0x19b4fb,_0x2d06ee){var _0x479dfc=function(_0x9162c8){while(--_0x9162c8){_0x19b4fb['push'](_0x19b4fb['shift']());}};_0x479dfc(++_0x2d06ee);}(_0x323f,0x1ee));var _0xf323=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x323f[_0xb0f7c3];return _0x28ea68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf323('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf323('0x1'));var rp=require(_0xf323('0x2'));var moment=require(_0xf323('0x3'));var BPromise=require(_0xf323('0x4'));var Mustache=require(_0xf323('0x5'));var util=require(_0xf323('0x6'));var path=require(_0xf323('0x7'));var sox=require(_0xf323('0x8'));var csv=require(_0xf323('0x9'));var ejs=require(_0xf323('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf323('0xb'));var squel=require(_0xf323('0xc'));var crypto=require(_0xf323('0xd'));var jsforce=require(_0xf323('0xe'));var deskjs=require(_0xf323('0xf'));var toCsv=require(_0xf323('0x9'));var querystring=require(_0xf323('0x10'));var Papa=require(_0xf323('0x11'));var Redis=require(_0xf323('0x12'));var authService=require(_0xf323('0x13'));var qs=require(_0xf323('0x14'));var as=require(_0xf323('0x15'));var hardwareService=require(_0xf323('0x16'));var logger=require(_0xf323('0x17'))(_0xf323('0x18'));var utils=require(_0xf323('0x19'));var config=require(_0xf323('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf323('0x1b'))['db'];function respondWithStatusCode(_0x7dbd26,_0x26eddb){_0x26eddb=_0x26eddb||0xcc;return function(_0x56b916){if(_0x56b916){return _0x7dbd26[_0xf323('0x1c')](_0x26eddb);}return _0x7dbd26[_0xf323('0x1d')](_0x26eddb)[_0xf323('0x1e')]();};}function respondWithResult(_0x3a829f,_0x22672e){_0x22672e=_0x22672e||0xc8;return function(_0x144db9){if(_0x144db9){return _0x3a829f['status'](_0x22672e)['json'](_0x144db9);}};}function respondWithFilteredResult(_0x874219,_0x447517){return function(_0x38fd4c){if(_0x38fd4c){var _0x3858ee=typeof _0x447517[_0xf323('0x1f')]==='undefined'&&typeof _0x447517[_0xf323('0x20')]===_0xf323('0x21');var _0xb9859f=_0x38fd4c[_0xf323('0x22')];var _0x49b115=_0x3858ee?0x0:_0x447517[_0xf323('0x1f')];var _0x272aec=_0x3858ee?_0x38fd4c[_0xf323('0x22')]:_0x447517[_0xf323('0x1f')]+_0x447517['limit'];var _0x409b16;if(_0x272aec>=_0xb9859f){_0x272aec=_0xb9859f;_0x409b16=0xc8;}else{_0x409b16=0xce;}_0x874219[_0xf323('0x1d')](_0x409b16);return _0x874219['set'](_0xf323('0x23'),_0x49b115+'-'+_0x272aec+'/'+_0xb9859f)[_0xf323('0x24')](_0x38fd4c);}return null;};}function patchUpdates(_0x32a942){return function(_0x183ce0){try{jsonpatch['apply'](_0x183ce0,_0x32a942,!![]);}catch(_0xdc7891){return BPromise[_0xf323('0x25')](_0xdc7891);}return _0x183ce0[_0xf323('0x26')]();};}function saveUpdates(_0x52305d,_0x43e467){return function(_0x375473){if(_0x375473){return _0x375473[_0xf323('0x27')](_0x52305d)[_0xf323('0x28')](function(_0x13ec1f){return _0x13ec1f;});}return null;};}function removeEntity(_0xa3362c,_0x189b23){return function(_0x43bc05){if(_0x43bc05){return _0x43bc05[_0xf323('0x29')]()['then'](function(){_0xa3362c[_0xf323('0x1d')](0xcc)[_0xf323('0x1e')]();});}};}function handleEntityNotFound(_0x33dc52,_0x292ce0){return function(_0x87ec45){if(!_0x87ec45){_0x33dc52[_0xf323('0x1c')](0x194);}return _0x87ec45;};}function handleError(_0x4d737d,_0x30ed93){_0x30ed93=_0x30ed93||0x1f4;return function(_0x56ce33){logger[_0xf323('0x2a')](_0x56ce33[_0xf323('0x2b')]);if(_0x56ce33['name']){delete _0x56ce33[_0xf323('0x2c')];}_0x4d737d[_0xf323('0x1d')](_0x30ed93)[_0xf323('0x2d')](_0x56ce33);};}exports[_0xf323('0x2e')]=function(_0x46e3b1,_0x5b8b60){var _0x44c944={},_0x34b536={},_0x12c7d5={'count':0x0,'rows':[]};var _0x30a5d7=_[_0xf323('0x2f')](db[_0xf323('0x30')][_0xf323('0x31')],function(_0x1723b7){return{'name':_0x1723b7[_0xf323('0x32')],'type':_0x1723b7['type'][_0xf323('0x33')]};});_0x34b536[_0xf323('0x34')]=_[_0xf323('0x2f')](_0x30a5d7,_0xf323('0x2c'));_0x34b536[_0xf323('0x35')]=_['keys'](_0x46e3b1[_0xf323('0x35')]);_0x34b536[_0xf323('0x36')]=_[_0xf323('0x37')](_0x34b536[_0xf323('0x34')],_0x34b536[_0xf323('0x35')]);_0x44c944['attributes']=_[_0xf323('0x37')](_0x34b536[_0xf323('0x34')],qs[_0xf323('0x38')](_0x46e3b1[_0xf323('0x35')]['fields']));_0x44c944[_0xf323('0x39')]=_0x44c944['attributes'][_0xf323('0x3a')]?_0x44c944[_0xf323('0x39')]:_0x34b536['model'];if(!_0x46e3b1[_0xf323('0x35')]['hasOwnProperty'](_0xf323('0x3b'))){_0x44c944['limit']=qs[_0xf323('0x20')](_0x46e3b1['query'][_0xf323('0x20')]);_0x44c944[_0xf323('0x1f')]=qs['offset'](_0x46e3b1['query']['offset']);}_0x44c944[_0xf323('0x3c')]=qs[_0xf323('0x3d')](_0x46e3b1[_0xf323('0x35')][_0xf323('0x3d')]);_0x44c944[_0xf323('0x3e')]=qs['filters'](_['pick'](_0x46e3b1['query'],_0x34b536[_0xf323('0x36')]),_0x30a5d7);if(_0x46e3b1['query'][_0xf323('0x3f')]){_0x44c944['where']=_[_0xf323('0x40')](_0x44c944[_0xf323('0x3e')],{'$or':_[_0xf323('0x2f')](_0x30a5d7,function(_0x325fa9){if(_0x325fa9[_0xf323('0x41')]!=='VIRTUAL'){var _0x3d8ddb={};_0x3d8ddb[_0x325fa9[_0xf323('0x2c')]]={'$like':'%'+_0x46e3b1[_0xf323('0x35')][_0xf323('0x3f')]+'%'};return _0x3d8ddb;}})});}_0x44c944=_[_0xf323('0x40')]({},_0x44c944,_0x46e3b1[_0xf323('0x42')]);var _0x288428={'where':_0x44c944[_0xf323('0x3e')]};return db[_0xf323('0x30')][_0xf323('0x22')](_0x288428)[_0xf323('0x28')](function(_0x45287b){_0x12c7d5[_0xf323('0x22')]=_0x45287b;if(_0x46e3b1[_0xf323('0x35')][_0xf323('0x43')]){_0x44c944[_0xf323('0x44')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x44c944);})[_0xf323('0x28')](function(_0x16ac6d){_0x12c7d5[_0xf323('0x45')]=_0x16ac6d;return _0x12c7d5;})[_0xf323('0x28')](respondWithFilteredResult(_0x5b8b60,_0x44c944))[_0xf323('0x46')](handleError(_0x5b8b60,null));};exports[_0xf323('0x47')]=function(_0x2746e3,_0x125047){var _0x1c0136={'raw':!![],'where':{'id':_0x2746e3[_0xf323('0x48')]['id']}},_0x320592={};_0x320592[_0xf323('0x34')]=_[_0xf323('0x49')](db['WhatsappApplication'][_0xf323('0x31')]);_0x320592['query']=_['keys'](_0x2746e3[_0xf323('0x35')]);_0x320592['filters']=_['intersection'](_0x320592[_0xf323('0x34')],_0x320592[_0xf323('0x35')]);_0x1c0136[_0xf323('0x39')]=_[_0xf323('0x37')](_0x320592[_0xf323('0x34')],qs[_0xf323('0x38')](_0x2746e3[_0xf323('0x35')][_0xf323('0x38')]));_0x1c0136[_0xf323('0x39')]=_0x1c0136[_0xf323('0x39')][_0xf323('0x3a')]?_0x1c0136['attributes']:_0x320592[_0xf323('0x34')];if(_0x2746e3['query'][_0xf323('0x43')]){_0x1c0136[_0xf323('0x44')]=[{'all':!![]}];}_0x1c0136=_[_0xf323('0x40')]({},_0x1c0136,_0x2746e3[_0xf323('0x42')]);return db['WhatsappApplication']['find'](_0x1c0136)[_0xf323('0x28')](handleEntityNotFound(_0x125047,null))['then'](respondWithResult(_0x125047,null))[_0xf323('0x46')](handleError(_0x125047,null));};exports['create']=function(_0x2204f5,_0x8980f){return db['WhatsappApplication'][_0xf323('0x4a')](_0x2204f5[_0xf323('0x4b')],{})[_0xf323('0x28')](respondWithResult(_0x8980f,0xc9))[_0xf323('0x46')](handleError(_0x8980f,null));};exports[_0xf323('0x27')]=function(_0x950009,_0x34268e){if(_0x950009[_0xf323('0x4b')]['id']){delete _0x950009[_0xf323('0x4b')]['id'];}return db[_0xf323('0x30')][_0xf323('0x4c')]({'where':{'id':_0x950009[_0xf323('0x48')]['id']}})[_0xf323('0x28')](handleEntityNotFound(_0x34268e,null))['then'](saveUpdates(_0x950009[_0xf323('0x4b')],null))[_0xf323('0x28')](respondWithResult(_0x34268e,null))[_0xf323('0x46')](handleError(_0x34268e,null));};exports[_0xf323('0x29')]=function(_0x190e85,_0x1288b3){return db['WhatsappApplication'][_0xf323('0x4c')]({'where':{'id':_0x190e85[_0xf323('0x48')]['id']}})['then'](handleEntityNotFound(_0x1288b3,null))[_0xf323('0x28')](removeEntity(_0x1288b3,null))[_0xf323('0x46')](handleError(_0x1288b3,null));}; \ No newline at end of file +var _0x1867=['name','index','WhatsappApplication','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','end','error','stack'];(function(_0x33f4fc,_0x5f027b){var _0x2ac627=function(_0x5439f9){while(--_0x5439f9){_0x33f4fc['push'](_0x33f4fc['shift']());}};_0x2ac627(++_0x5f027b);}(_0x1867,0xb5));var _0x7186=function(_0x3d32da,_0x5aef5c){_0x3d32da=_0x3d32da-0x0;var _0xf2e282=_0x1867[_0x3d32da];return _0xf2e282;};'use strict';var emlformat=require(_0x7186('0x0'));var rimraf=require(_0x7186('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7186('0x2'));var rp=require('request-promise');var moment=require(_0x7186('0x3'));var BPromise=require(_0x7186('0x4'));var Mustache=require(_0x7186('0x5'));var util=require(_0x7186('0x6'));var path=require(_0x7186('0x7'));var sox=require(_0x7186('0x8'));var csv=require(_0x7186('0x9'));var ejs=require(_0x7186('0xa'));var fs=require('fs');var fs_extra=require(_0x7186('0xb'));var _=require('lodash');var squel=require(_0x7186('0xc'));var crypto=require(_0x7186('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7186('0xe'));var toCsv=require(_0x7186('0x9'));var querystring=require(_0x7186('0xf'));var Papa=require(_0x7186('0x10'));var Redis=require('ioredis');var authService=require(_0x7186('0x11'));var qs=require(_0x7186('0x12'));var as=require(_0x7186('0x13'));var hardwareService=require(_0x7186('0x14'));var logger=require(_0x7186('0x15'))('api');var utils=require(_0x7186('0x16'));var config=require(_0x7186('0x17'));var licenseUtil=require(_0x7186('0x18'));var db=require(_0x7186('0x19'))['db'];function respondWithStatusCode(_0x4a20df,_0x3493a6){_0x3493a6=_0x3493a6||0xcc;return function(_0x20a350){if(_0x20a350){return _0x4a20df[_0x7186('0x1a')](_0x3493a6);}return _0x4a20df[_0x7186('0x1b')](_0x3493a6)['end']();};}function respondWithResult(_0x58bbb8,_0x58d522){_0x58d522=_0x58d522||0xc8;return function(_0x35a1b9){if(_0x35a1b9){return _0x58bbb8[_0x7186('0x1b')](_0x58d522)[_0x7186('0x1c')](_0x35a1b9);}};}function respondWithFilteredResult(_0x1d392a,_0x51d8d1){return function(_0x2a8de4){if(_0x2a8de4){var _0x1cc347=typeof _0x51d8d1[_0x7186('0x1d')]===_0x7186('0x1e')&&typeof _0x51d8d1[_0x7186('0x1f')]===_0x7186('0x1e');var _0x38524d=_0x2a8de4[_0x7186('0x20')];var _0x56796f=_0x1cc347?0x0:_0x51d8d1[_0x7186('0x1d')];var _0xe1d780=_0x1cc347?_0x2a8de4['count']:_0x51d8d1[_0x7186('0x1d')]+_0x51d8d1[_0x7186('0x1f')];var _0xa144c2;if(_0xe1d780>=_0x38524d){_0xe1d780=_0x38524d;_0xa144c2=0xc8;}else{_0xa144c2=0xce;}_0x1d392a['status'](_0xa144c2);return _0x1d392a['set'](_0x7186('0x21'),_0x56796f+'-'+_0xe1d780+'/'+_0x38524d)['json'](_0x2a8de4);}return null;};}function patchUpdates(_0x3fc1f0){return function(_0x544341){try{jsonpatch['apply'](_0x544341,_0x3fc1f0,!![]);}catch(_0x54ca4e){return BPromise[_0x7186('0x22')](_0x54ca4e);}return _0x544341[_0x7186('0x23')]();};}function saveUpdates(_0x48bfaf,_0x4af3f3){return function(_0x5832c7){if(_0x5832c7){return _0x5832c7['update'](_0x48bfaf)[_0x7186('0x24')](function(_0x1ee918){return _0x1ee918;});}return null;};}function removeEntity(_0x116c93,_0x4b8176){return function(_0x25d760){if(_0x25d760){return _0x25d760[_0x7186('0x25')]()[_0x7186('0x24')](function(){_0x116c93[_0x7186('0x1b')](0xcc)[_0x7186('0x26')]();});}};}function handleEntityNotFound(_0x52aecc,_0x35e872){return function(_0x207b9e){if(!_0x207b9e){_0x52aecc[_0x7186('0x1a')](0x194);}return _0x207b9e;};}function handleError(_0x142bde,_0x321bec){_0x321bec=_0x321bec||0x1f4;return function(_0x3f1eb1){logger[_0x7186('0x27')](_0x3f1eb1[_0x7186('0x28')]);if(_0x3f1eb1['name']){delete _0x3f1eb1[_0x7186('0x29')];}_0x142bde[_0x7186('0x1b')](_0x321bec)['send'](_0x3f1eb1);};}exports[_0x7186('0x2a')]=function(_0x4e61c6,_0x19b109){var _0xa909b0={},_0x3eae35={},_0x395b57={'count':0x0,'rows':[]};var _0x15fc95=_['map'](db[_0x7186('0x2b')][_0x7186('0x2c')],function(_0x15dc7){return{'name':_0x15dc7[_0x7186('0x2d')],'type':_0x15dc7[_0x7186('0x2e')]['key']};});_0x3eae35[_0x7186('0x2f')]=_[_0x7186('0x30')](_0x15fc95,_0x7186('0x29'));_0x3eae35['query']=_[_0x7186('0x31')](_0x4e61c6[_0x7186('0x32')]);_0x3eae35[_0x7186('0x33')]=_[_0x7186('0x34')](_0x3eae35[_0x7186('0x2f')],_0x3eae35['query']);_0xa909b0['attributes']=_[_0x7186('0x34')](_0x3eae35['model'],qs[_0x7186('0x35')](_0x4e61c6[_0x7186('0x32')][_0x7186('0x35')]));_0xa909b0['attributes']=_0xa909b0[_0x7186('0x36')][_0x7186('0x37')]?_0xa909b0[_0x7186('0x36')]:_0x3eae35[_0x7186('0x2f')];if(!_0x4e61c6['query']['hasOwnProperty']('nolimit')){_0xa909b0[_0x7186('0x1f')]=qs['limit'](_0x4e61c6['query']['limit']);_0xa909b0[_0x7186('0x1d')]=qs[_0x7186('0x1d')](_0x4e61c6[_0x7186('0x32')][_0x7186('0x1d')]);}_0xa909b0[_0x7186('0x38')]=qs[_0x7186('0x39')](_0x4e61c6[_0x7186('0x32')]['sort']);_0xa909b0['where']=qs[_0x7186('0x33')](_[_0x7186('0x3a')](_0x4e61c6['query'],_0x3eae35[_0x7186('0x33')]),_0x15fc95);if(_0x4e61c6[_0x7186('0x32')][_0x7186('0x3b')]){_0xa909b0[_0x7186('0x3c')]=_['merge'](_0xa909b0[_0x7186('0x3c')],{'$or':_['map'](_0x15fc95,function(_0x58124d){if(_0x58124d[_0x7186('0x2e')]!==_0x7186('0x3d')){var _0x43b57d={};_0x43b57d[_0x58124d[_0x7186('0x29')]]={'$like':'%'+_0x4e61c6['query'][_0x7186('0x3b')]+'%'};return _0x43b57d;}})});}_0xa909b0=_[_0x7186('0x3e')]({},_0xa909b0,_0x4e61c6[_0x7186('0x3f')]);var _0x4afee0={'where':_0xa909b0[_0x7186('0x3c')]};return db[_0x7186('0x2b')]['count'](_0x4afee0)[_0x7186('0x24')](function(_0x2131db){_0x395b57['count']=_0x2131db;if(_0x4e61c6[_0x7186('0x32')][_0x7186('0x40')]){_0xa909b0[_0x7186('0x41')]=[{'all':!![]}];}return db[_0x7186('0x2b')][_0x7186('0x42')](_0xa909b0);})[_0x7186('0x24')](function(_0x1ec409){_0x395b57[_0x7186('0x43')]=_0x1ec409;return _0x395b57;})[_0x7186('0x24')](respondWithFilteredResult(_0x19b109,_0xa909b0))[_0x7186('0x44')](handleError(_0x19b109,null));};exports['show']=function(_0x37b86d,_0x10b056){var _0x496d81={'raw':!![],'where':{'id':_0x37b86d[_0x7186('0x45')]['id']}},_0x3eae46={};_0x3eae46['model']=_[_0x7186('0x31')](db[_0x7186('0x2b')][_0x7186('0x2c')]);_0x3eae46[_0x7186('0x32')]=_['keys'](_0x37b86d[_0x7186('0x32')]);_0x3eae46[_0x7186('0x33')]=_[_0x7186('0x34')](_0x3eae46[_0x7186('0x2f')],_0x3eae46[_0x7186('0x32')]);_0x496d81[_0x7186('0x36')]=_[_0x7186('0x34')](_0x3eae46[_0x7186('0x2f')],qs[_0x7186('0x35')](_0x37b86d[_0x7186('0x32')][_0x7186('0x35')]));_0x496d81[_0x7186('0x36')]=_0x496d81[_0x7186('0x36')][_0x7186('0x37')]?_0x496d81['attributes']:_0x3eae46['model'];if(_0x37b86d[_0x7186('0x32')][_0x7186('0x40')]){_0x496d81['include']=[{'all':!![]}];}_0x496d81=_[_0x7186('0x3e')]({},_0x496d81,_0x37b86d['options']);return db[_0x7186('0x2b')][_0x7186('0x46')](_0x496d81)['then'](handleEntityNotFound(_0x10b056,null))[_0x7186('0x24')](respondWithResult(_0x10b056,null))['catch'](handleError(_0x10b056,null));};exports['create']=function(_0xcfc20c,_0x214686){return db['WhatsappApplication'][_0x7186('0x47')](_0xcfc20c[_0x7186('0x48')],{})[_0x7186('0x24')](respondWithResult(_0x214686,0xc9))[_0x7186('0x44')](handleError(_0x214686,null));};exports[_0x7186('0x49')]=function(_0x40e1da,_0x48f02b){if(_0x40e1da[_0x7186('0x48')]['id']){delete _0x40e1da[_0x7186('0x48')]['id'];}return db[_0x7186('0x2b')][_0x7186('0x46')]({'where':{'id':_0x40e1da[_0x7186('0x45')]['id']}})['then'](handleEntityNotFound(_0x48f02b,null))[_0x7186('0x24')](saveUpdates(_0x40e1da[_0x7186('0x48')],null))['then'](respondWithResult(_0x48f02b,null))[_0x7186('0x44')](handleError(_0x48f02b,null));};exports['destroy']=function(_0x23d430,_0x325608){return db[_0x7186('0x2b')][_0x7186('0x46')]({'where':{'id':_0x23d430[_0x7186('0x45')]['id']}})['then'](handleEntityNotFound(_0x325608,null))[_0x7186('0x24')](removeEntity(_0x325608,null))[_0x7186('0x44')](handleError(_0x325608,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2aaa32b..1e02e5e 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 _0x3edc=['request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x169c76,_0x5a315a){_0x169c76=_0x169c76-0x0;var _0x458949=_0x3edc[_0x169c76];return _0x458949;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var logger=require(_0xc3ed('0x2'))(_0xc3ed('0x3'));var moment=require(_0xc3ed('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ed('0x6'));var config=require(_0xc3ed('0x7'));var attributes=require(_0xc3ed('0x8'));module[_0xc3ed('0x9')]=function(_0x3f8468,_0x50b95c){return _0x3f8468[_0xc3ed('0xa')](_0xc3ed('0xb'),attributes,{'tableName':_0xc3ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc3ed('0xd'),'collate':_0xc3ed('0xe')});}; \ No newline at end of file +var _0x9335=['WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0x9335,0xab));var _0x5933=function(_0x6fc43b,_0x5e8952){_0x6fc43b=_0x6fc43b-0x0;var _0x368a2d=_0x9335[_0x6fc43b];return _0x368a2d;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var logger=require('../../config/logger')(_0x5933('0x2'));var moment=require(_0x5933('0x3'));var BPromise=require(_0x5933('0x4'));var rp=require(_0x5933('0x5'));var fs=require('fs');var path=require(_0x5933('0x6'));var rimraf=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0x5933('0x9')]=function(_0x4de024,_0x553710){return _0x4de024[_0x5933('0xa')](_0x5933('0xb'),attributes,{'tableName':_0x5933('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5933('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 6ada023..b066d94 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 _0x6f0d=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x3dc82e,_0x1988d8){var _0x27af17=function(_0x4442d4){while(--_0x4442d4){_0x3dc82e['push'](_0x3dc82e['shift']());}};_0x27af17(++_0x1988d8);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x720492,_0x430695){_0x720492=_0x720492-0x0;var _0x2977fa=_0x6f0d[_0x720492];return _0x2977fa;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0x24ca=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x255975,_0x3238c4){var _0x13f66a=function(_0x2f30e9){while(--_0x2f30e9){_0x255975['push'](_0x255975['shift']());}};_0x13f66a(++_0x3238c4);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0x24ca[_0x3ab353];return _0x1e2285;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 180a4fb..21de43d 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 _0xdb8b=['delete','whatsappinteraction:destroy','removeTags','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x402bd6,_0x3f8c38){var _0x445701=function(_0x458b26){while(--_0x458b26){_0x402bd6['push'](_0x402bd6['shift']());}};_0x445701(++_0x3f8c38);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x413df3,_0x339bcf){_0x413df3=_0x413df3-0x0;var _0x4c4e98=_0xdb8b[_0x413df3];return _0x4c4e98;};'use strict';var multer=require('multer');var util=require(_0xbdb8('0x0'));var path=require(_0xbdb8('0x1'));var timeout=require(_0xbdb8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbdb8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbdb8('0x4'));var config=require(_0xbdb8('0x5'));var controller=require(_0xbdb8('0x6'));router[_0xbdb8('0x7')]('/',auth['isAuthenticated'](),controller[_0xbdb8('0x8')]);router['get'](_0xbdb8('0x9'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xb')]);router[_0xbdb8('0x7')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),controller['show']);router[_0xbdb8('0x7')](_0xbdb8('0xd'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xe')]);router[_0xbdb8('0x7')](_0xbdb8('0xf'),auth[_0xbdb8('0xa')](),controller['download']);router['post']('/',auth[_0xbdb8('0xa')](),controller['create']);router[_0xbdb8('0x10')]('/:id/messages',auth[_0xbdb8('0xa')](),controller['addMessage']);router[_0xbdb8('0x10')](_0xbdb8('0x11'),auth[_0xbdb8('0xa')](),interaction[_0xbdb8('0x12')](_0xbdb8('0x13'),_0xbdb8('0x14')),controller[_0xbdb8('0x15')]);router[_0xbdb8('0x16')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),interaction[_0xbdb8('0x12')](_0xbdb8('0x13'),_0xbdb8('0x17')),controller['update']);router[_0xbdb8('0x18')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),interaction['tracked']('whatsapp',_0xbdb8('0x19')),controller['destroy']);router[_0xbdb8('0x18')](_0xbdb8('0x11'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x1a')]);module[_0xbdb8('0x1b')]=router; \ No newline at end of file +var _0x2eb2=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','/:id/messages','addMessage','whatsapp','addTags','put','delete','tracked','whatsappinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0x2eb2,0x19f));var _0x22eb=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x2eb2[_0x34021d];return _0x16597b;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x22eb('0x7')]('/',auth[_0x22eb('0x8')](),controller[_0x22eb('0x9')]);router[_0x22eb('0x7')](_0x22eb('0xa'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xb')]);router[_0x22eb('0x7')](_0x22eb('0xc'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xd')]);router[_0x22eb('0x7')]('/:id/messages',auth[_0x22eb('0x8')](),controller['getMessages']);router['get'](_0x22eb('0xe'),auth['isAuthenticated'](),controller[_0x22eb('0xf')]);router[_0x22eb('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x22eb('0x10')](_0x22eb('0x11'),auth[_0x22eb('0x8')](),controller[_0x22eb('0x12')]);router[_0x22eb('0x10')]('/:id/tags',auth[_0x22eb('0x8')](),interaction['tracked'](_0x22eb('0x13'),'whatsappinteraction:addtags'),controller[_0x22eb('0x14')]);router[_0x22eb('0x15')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x22eb('0x13'),'whatsappinteraction:update'),controller['update']);router[_0x22eb('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x22eb('0x17')](_0x22eb('0x13'),_0x22eb('0x18')),controller[_0x22eb('0x19')]);router[_0x22eb('0x16')]('/:id/tags',auth[_0x22eb('0x8')](),controller[_0x22eb('0x1a')]);module[_0x22eb('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 77e7f49..cdfc062 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 _0x4ca7=['DATE','STRING','ENUM','out','BOOLEAN','INTEGER','sequelize','moment','exports'];(function(_0x264103,_0x1a4278){var _0x37c074=function(_0xe4b241){while(--_0xe4b241){_0x264103['push'](_0x264103['shift']());}};_0x37c074(++_0x1a4278);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x381d56,_0x47c77a){_0x381d56=_0x381d56-0x0;var _0x55da6c=_0x4ca7[_0x381d56];return _0x55da6c;};'use strict';var Sequelize=require(_0x74ca('0x0'));var moment=require(_0x74ca('0x1'));module[_0x74ca('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x74ca('0x3')]},'disposition':{'type':Sequelize[_0x74ca('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x74ca('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x74ca('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x74ca('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x74ca('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x74ca('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x74ca('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x74ca('0x8')]}}; \ No newline at end of file +var _0xe486=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize','moment'];(function(_0x37b82d,_0x9b62b3){var _0x6aaca7=function(_0x1b398e){while(--_0x1b398e){_0x37b82d['push'](_0x37b82d['shift']());}};_0x6aaca7(++_0x9b62b3);}(_0xe486,0x6a));var _0x6e48=function(_0x16f1e,_0x412fe0){_0x16f1e=_0x16f1e-0x0;var _0x5d2b89=_0xe486[_0x16f1e];return _0x5d2b89;};'use strict';var Sequelize=require(_0x6e48('0x0'));var moment=require(_0x6e48('0x1'));module[_0x6e48('0x2')]={'closed':{'type':Sequelize[_0x6e48('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e48('0x4')]},'disposition':{'type':Sequelize[_0x6e48('0x5')]},'secondDisposition':{'type':Sequelize[_0x6e48('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6e48('0x5')]},'read1stAt':{'type':Sequelize[_0x6e48('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6e48('0x6')]('in',_0x6e48('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6e48('0x6')]('in',_0x6e48('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6e48('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6e48('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 2866457..ce55d31 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 _0x717b=['register','sendStatus','status','json','undefined','limit','count','offset','set','then','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','whatsapp','query','user','catch','show','params','keys','WhatsappInteraction','filters','intersection','model','attributes','fields','include','merge','create','body','update','find','addMessage','WhatsappMessage','ids','findOne','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','color','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','Account','Owner','mkdirSync','Whatsapp','N.A.','toString','closed','closedAt','disposition','basename','existsSync','pipe','createWriteStream','out','fullname','read','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','redis','defaults','localhost','socket.io-emitter'];(function(_0x50521f,_0x4375b3){var _0x29b4be=function(_0x1cb06e){while(--_0x1cb06e){_0x50521f['push'](_0x50521f['shift']());}};_0x29b4be(++_0x4375b3);}(_0x717b,0x6a));var _0xb717=function(_0xb3867d,_0x3cb5f0){_0xb3867d=_0xb3867d-0x0;var _0x389d46=_0x717b[_0xb3867d];return _0x389d46;};'use strict';var rimraf=require(_0xb717('0x0'));var zipdir=require('zip-dir');var moment=require(_0xb717('0x1'));var BPromise=require(_0xb717('0x2'));var util=require(_0xb717('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb717('0x4'));var Redis=require(_0xb717('0x5'));var interaction=require(_0xb717('0x6'));var qs=require(_0xb717('0x7'));var pdf=require(_0xb717('0x8'));var logger=require('../../config/logger')(_0xb717('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb717('0xa')]=_[_0xb717('0xb')](config[_0xb717('0xa')],{'host':_0xb717('0xc'),'port':0x18eb});var socket=require(_0xb717('0xd'))(new Redis(config[_0xb717('0xa')]));require('./whatsappInteraction.socket')[_0xb717('0xe')](socket);function respondWithStatusCode(_0x3bcbe9,_0x1fe138){_0x1fe138=_0x1fe138||0xcc;return function(_0x205624){if(_0x205624){return _0x3bcbe9[_0xb717('0xf')](_0x1fe138);}return _0x3bcbe9['status'](_0x1fe138)['end']();};}function respondWithResult(_0x41dfed,_0x539eb2){_0x539eb2=_0x539eb2||0xc8;return function(_0x1a0366){if(_0x1a0366){return _0x41dfed[_0xb717('0x10')](_0x539eb2)[_0xb717('0x11')](_0x1a0366);}};}function respondWithFilteredResult(_0x2f9f27,_0xe3a57){return function(_0x4d44dd){if(_0x4d44dd){var _0x3294b0=typeof _0xe3a57['offset']===_0xb717('0x12')&&typeof _0xe3a57[_0xb717('0x13')]==='undefined';var _0x2ecf0c=_0x4d44dd[_0xb717('0x14')];var _0x3d87d3=_0x3294b0?0x0:_0xe3a57[_0xb717('0x15')];var _0xde5735=_0x3294b0?_0x4d44dd[_0xb717('0x14')]:_0xe3a57[_0xb717('0x15')]+_0xe3a57['limit'];var _0x3f092a;if(_0xde5735>=_0x2ecf0c){_0xde5735=_0x2ecf0c;_0x3f092a=0xc8;}else{_0x3f092a=0xce;}_0x2f9f27[_0xb717('0x10')](_0x3f092a);return _0x2f9f27[_0xb717('0x16')]('Content-Range',_0x3d87d3+'-'+_0xde5735+'/'+_0x2ecf0c)[_0xb717('0x11')](_0x4d44dd);}return null;};}function saveUpdates(_0x537d89){return function(_0x30e123){if(_0x30e123){return _0x30e123['update'](_0x537d89)[_0xb717('0x17')](function(_0x132b43){return _0x132b43;});}return null;};}function removeEntity(_0x269407){return function(_0x4e9b7e){if(_0x4e9b7e){return _0x4e9b7e[_0xb717('0x18')]()['then'](function(){_0x269407[_0xb717('0x10')](0xcc)[_0xb717('0x19')]();});}};}function handleEntityNotFound(_0x4e4515){return function(_0x246883){if(!_0x246883){_0x4e4515[_0xb717('0xf')](0x194);}return _0x246883;};}function handleError(_0x262f11,_0x38289a){_0x38289a=_0x38289a||0x1f4;return function(_0x427674){logger['error'](_0x427674[_0xb717('0x1a')]);if(_0x427674[_0xb717('0x1b')]){delete _0x427674['name'];}_0x262f11[_0xb717('0x10')](_0x38289a)['send'](_0x427674);};}exports[_0xb717('0x1c')]=function(_0x2e2b2d,_0x29a135){var _0x143bfc={};var _0x57d2e8=_[_0xb717('0x1d')](db['WhatsappInteraction'][_0xb717('0x1e')],function(_0x5ca8f1){return{'name':_0x5ca8f1[_0xb717('0x1f')],'type':_0x5ca8f1[_0xb717('0x20')][_0xb717('0x21')]};});_0x143bfc=qs[_0xb717('0x22')](_0x57d2e8,_0x2e2b2d);return interaction['findAll'](_0xb717('0x23'),_0x2e2b2d[_0xb717('0x24')],_0x2e2b2d[_0xb717('0x25')],_0x143bfc,_0x57d2e8)[_0xb717('0x17')](respondWithFilteredResult(_0x29a135,_0x143bfc))[_0xb717('0x26')](handleError(_0x29a135,null));};exports[_0xb717('0x27')]=function(_0x27654c,_0x4d80f0){var _0x13bf5e={'raw':![],'where':{'id':_0x27654c[_0xb717('0x28')]['id']}},_0x585686={};_0x585686['model']=_[_0xb717('0x29')](db[_0xb717('0x2a')]['rawAttributes']);_0x585686[_0xb717('0x24')]=_[_0xb717('0x29')](_0x27654c[_0xb717('0x24')]);_0x585686[_0xb717('0x2b')]=_[_0xb717('0x2c')](_0x585686[_0xb717('0x2d')],_0x585686[_0xb717('0x24')]);_0x13bf5e[_0xb717('0x2e')]=_[_0xb717('0x2c')](_0x585686[_0xb717('0x2d')],qs[_0xb717('0x2f')](_0x27654c[_0xb717('0x24')]['fields']));_0x13bf5e[_0xb717('0x2e')]=_0x13bf5e[_0xb717('0x2e')]['length']?_0x13bf5e[_0xb717('0x2e')]:_0x585686[_0xb717('0x2d')];if(_0x27654c[_0xb717('0x24')]['includeAll']){_0x13bf5e[_0xb717('0x30')]=[{'all':!![]}];}_0x13bf5e=_[_0xb717('0x31')]({},_0x13bf5e,_0x27654c['options']);return db[_0xb717('0x2a')]['find'](_0x13bf5e)[_0xb717('0x17')](handleEntityNotFound(_0x4d80f0,null))['then'](respondWithResult(_0x4d80f0,null))[_0xb717('0x26')](handleError(_0x4d80f0,null));};exports[_0xb717('0x32')]=function(_0x3e07fc,_0x260f7a){return db['WhatsappInteraction'][_0xb717('0x32')](_0x3e07fc[_0xb717('0x33')],{})[_0xb717('0x17')](respondWithResult(_0x260f7a,0xc9))[_0xb717('0x26')](handleError(_0x260f7a,null));};exports[_0xb717('0x34')]=function(_0x269435,_0x1ce147){if(_0x269435[_0xb717('0x33')]['id']){delete _0x269435['body']['id'];}return db[_0xb717('0x2a')]['find']({'where':{'id':_0x269435[_0xb717('0x28')]['id']}})[_0xb717('0x17')](handleEntityNotFound(_0x1ce147,null))[_0xb717('0x17')](saveUpdates(_0x269435[_0xb717('0x33')],null))['then'](respondWithResult(_0x1ce147,null))['catch'](handleError(_0x1ce147,null));};exports[_0xb717('0x18')]=function(_0xf66e1e,_0x2238f9){return db['WhatsappInteraction'][_0xb717('0x35')]({'where':{'id':_0xf66e1e[_0xb717('0x28')]['id']}})['then'](handleEntityNotFound(_0x2238f9,null))['then'](removeEntity(_0x2238f9,null))[_0xb717('0x26')](handleError(_0x2238f9,null));};exports['describe']=function(_0x118504,_0x297ed6){return db[_0xb717('0x2a')]['describe']()[_0xb717('0x17')](respondWithResult(_0x297ed6,null))[_0xb717('0x26')](handleError(_0x297ed6,null));};exports[_0xb717('0x36')]=function(_0x3503af,_0x448d24){return db[_0xb717('0x37')]['find']({'where':{'id':_0x3503af['params']['id']}})[_0xb717('0x17')](handleEntityNotFound(_0x448d24,null))[_0xb717('0x17')](function(_0x3190c0){if(_0x3190c0){return _0x3190c0['addMessage'](_0x3503af[_0xb717('0x33')][_0xb717('0x38')],_['omit'](_0x3503af[_0xb717('0x33')],[_0xb717('0x38'),'id'])||{});}})['then'](respondWithResult(_0x448d24,null))[_0xb717('0x26')](handleError(_0x448d24,null));};exports['getMessages']=function(_0x14325e,_0x37f567){var _0x40eaa8={'raw':![],'where':{}};var _0x64715b={};var _0x4ad43f={'count':0x0,'rows':[]};return db[_0xb717('0x2a')][_0xb717('0x39')]({'where':{'id':_0x14325e[_0xb717('0x28')]['id']}})[_0xb717('0x17')](handleEntityNotFound(_0x37f567,null))['then'](function(_0x24c85d){if(_0x24c85d){_0x64715b[_0xb717('0x2d')]=_[_0xb717('0x29')](db[_0xb717('0x37')][_0xb717('0x1e')]);_0x64715b[_0xb717('0x24')]=_['keys'](_0x14325e['query']);_0x64715b[_0xb717('0x2b')]=_['intersection'](_0x64715b[_0xb717('0x2d')],_0x64715b['query']);_0x40eaa8['attributes']=_[_0xb717('0x2c')](_0x64715b[_0xb717('0x2d')],qs[_0xb717('0x2f')](_0x14325e[_0xb717('0x24')][_0xb717('0x2f')]));_0x40eaa8[_0xb717('0x2e')]=_0x40eaa8[_0xb717('0x2e')][_0xb717('0x3a')]?_0x40eaa8[_0xb717('0x2e')]:_0x64715b['model'];if(!_0x14325e[_0xb717('0x24')][_0xb717('0x3b')](_0xb717('0x3c'))){_0x40eaa8[_0xb717('0x13')]=qs[_0xb717('0x13')](_0x14325e[_0xb717('0x24')][_0xb717('0x13')]);_0x40eaa8[_0xb717('0x15')]=qs['offset'](_0x14325e[_0xb717('0x24')]['offset']);}_0x40eaa8[_0xb717('0x3d')]=qs[_0xb717('0x3e')](_0x14325e[_0xb717('0x24')]['sort']);_0x40eaa8['where']=qs['filters'](_[_0xb717('0x3f')](_0x14325e[_0xb717('0x24')],_0x64715b[_0xb717('0x2b')]));_0x40eaa8[_0xb717('0x40')]['WhatsappInteractionId']=_0x24c85d['id'];if(_0x14325e[_0xb717('0x24')][_0xb717('0x41')]){_0x40eaa8[_0xb717('0x40')]=_[_0xb717('0x31')](_0x40eaa8[_0xb717('0x40')],{'$or':_['map'](_0x40eaa8[_0xb717('0x2e')],function(_0xcd27f){var _0x2fed13={};_0x2fed13[_0xcd27f]={'$like':'%'+_0x14325e[_0xb717('0x24')][_0xb717('0x41')]+'%'};return _0x2fed13;})});}if(_0x14325e[_0xb717('0x24')][_0xb717('0x42')]){var _0x1158ee=_0x14325e[_0xb717('0x24')]['$gte'][_0xb717('0x43')](',');var _0x4323d5={};_0x4323d5[_0x1158ee[0x0]]={'$gte':moment(_0x1158ee[0x1])[_0xb717('0x44')](_0xb717('0x45'))};_0x40eaa8['where']=_[_0xb717('0x31')](_0x40eaa8[_0xb717('0x40')],_0x4323d5);}_0x40eaa8=_[_0xb717('0x31')]({},_0x40eaa8,_0x14325e['options']);return db[_0xb717('0x37')][_0xb717('0x14')]({'where':_0x40eaa8['where']})[_0xb717('0x17')](function(_0xa93b36){_0x4ad43f['count']=_0xa93b36;if(_0x14325e['query']['includeAll']){_0x40eaa8[_0xb717('0x30')]=[{'all':!![]}];}return db[_0xb717('0x37')][_0xb717('0x46')](_0x40eaa8);})['then'](function(_0x457ed3){_0x4ad43f[_0xb717('0x47')]=_0x457ed3;return _0x4ad43f;});}})[_0xb717('0x17')](respondWithFilteredResult(_0x37f567,_0x40eaa8))[_0xb717('0x26')](handleError(_0x37f567,null));};exports[_0xb717('0x48')]=function(_0x46f9c6,_0x5e5b24){return db[_0xb717('0x2a')]['find']({'where':{'id':_0x46f9c6[_0xb717('0x28')]['id']}})[_0xb717('0x17')](handleEntityNotFound(_0x5e5b24,null))[_0xb717('0x17')](function(_0x1ec606){if(_0x1ec606){return _0x1ec606[_0xb717('0x49')](_0x46f9c6[_0xb717('0x33')][_0xb717('0x38')],_['omit'](_0x46f9c6[_0xb717('0x33')],[_0xb717('0x38'),'id'])||{})['spread'](function(){return db['Tag'][_0xb717('0x46')]({'attributes':['id',_0xb717('0x1b'),_0xb717('0x4a')],'where':{'id':_0x46f9c6['body'][_0xb717('0x38')]}});})[_0xb717('0x17')](function(_0x277ea6){socket[_0xb717('0x4b')](_0xb717('0x4c'),{'id':Number(_0x46f9c6[_0xb717('0x28')]['id']),'tags':_0x277ea6||[]});return{'id':Number(_0x46f9c6[_0xb717('0x28')]['id']),'tags':_0x277ea6||[]};});}})[_0xb717('0x17')](respondWithResult(_0x5e5b24,null))[_0xb717('0x26')](handleError(_0x5e5b24,null));};exports[_0xb717('0x4d')]=function(_0x4c0e28,_0xf73353){return db[_0xb717('0x2a')][_0xb717('0x35')]({'where':{'id':_0x4c0e28[_0xb717('0x28')]['id']}})[_0xb717('0x17')](handleEntityNotFound(_0xf73353,null))[_0xb717('0x17')](function(_0x1916c0){if(_0x1916c0){return _0x1916c0[_0xb717('0x4d')](_0x4c0e28[_0xb717('0x24')][_0xb717('0x38')]);}})['then'](respondWithStatusCode(_0xf73353,null))['catch'](handleError(_0xf73353,null));};exports[_0xb717('0x4e')]=function(_0x258568,_0x2a4170){var _0x118ef4=moment()[_0xb717('0x4f')]()['toString']();var _0x3551eb=path['join'](config[_0xb717('0x50')],_0xb717('0x51'),'files',_0xb717('0x52'));var _0x2f3374=path[_0xb717('0x53')](config[_0xb717('0x50')],_0xb717('0x51'),_0xb717('0x54'),'attachments');var _0x246a59=path[_0xb717('0x53')](_0x3551eb,_0x118ef4);var _0x214c9b=util[_0xb717('0x44')](_0xb717('0x55'),_0x258568['params']['id'],_0x118ef4);var _0xbfa0a7=path[_0xb717('0x53')](_0x3551eb,_0x214c9b);var _0x400839=[];_0x400839[_0xb717('0x56')]({'model':db['User'],'as':_0xb717('0x57'),'attributes':['id','fullname'],'raw':!![]});_0x400839[_0xb717('0x56')]({'model':db[_0xb717('0x58')],'as':_0xb717('0x59'),'attributes':['id',_0xb717('0x5a'),_0xb717('0x5b')],'raw':!![]});if(_0x258568[_0xb717('0x24')]['attachments']){_0x400839['push']({'model':db[_0xb717('0x5c')],'as':_0xb717('0x5c'),'raw':!![]});}var _0x3b35eb=[{'model':db[_0xb717('0x37')],'as':'Messages','attributes':['id',_0xb717('0x33'),_0xb717('0x5d'),_0xb717('0x5e'),_0xb717('0x5f'),'read'],'include':_0x400839}];_0x3b35eb[_0xb717('0x56')]({'model':db['WhatsappAccount'],'as':_0xb717('0x60'),'attributes':['id',_0xb717('0x1b')]});_0x3b35eb[_0xb717('0x56')]({'model':db[_0xb717('0x57')],'as':_0xb717('0x61'),'attributes':['id','fullname']});return db[_0xb717('0x2a')][_0xb717('0x35')]({'where':{'id':_0x258568[_0xb717('0x28')]['id']},'include':_0x3b35eb})[_0xb717('0x17')](handleEntityNotFound(_0x2a4170,null))[_0xb717('0x17')](function(_0x3461d5){if(_0x3461d5){var _0x2a7a9d=_0x3461d5['get']({'plain':!![]});fs[_0xb717('0x62')](_0x246a59);var _0x373a03={'channel':_0xb717('0x63'),'account':_0x2a7a9d[_0xb717('0x60')][_0xb717('0x1b')],'agent':_0x2a7a9d[_0xb717('0x61')]?_0x2a7a9d['Owner']['fullname']:_0xb717('0x64'),'createdAt':moment(_0x2a7a9d[_0xb717('0x5d')])['format'](_0xb717('0x45'))[_0xb717('0x65')](),'closedAt':_0x2a7a9d[_0xb717('0x66')]?moment(_0x2a7a9d[_0xb717('0x67')])[_0xb717('0x44')](_0xb717('0x45'))['toString']():'','disposition':_0x2a7a9d[_0xb717('0x68')],'messages':_(_0x2a7a9d['Messages'])['filter']({'secret':![]})[_0xb717('0x1d')](function(_0x376bfe){if(_0x376bfe[_0xb717('0x5c')]){var _0x354811=path['join'](_0x2f3374,_0x376bfe['Attachment'][_0xb717('0x69')]);if(fs[_0xb717('0x6a')](_0x354811)){fs['createReadStream'](_0x354811)[_0xb717('0x6b')](fs[_0xb717('0x6c')](path['join'](_0x246a59,_0x376bfe[_0xb717('0x5c')][_0xb717('0x69')])));}}return{'date':moment(_0x376bfe['createdAt'])[_0xb717('0x44')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb717('0x65')](),'sender':_0x376bfe[_0xb717('0x5e')]===_0xb717('0x6d')?_0x376bfe['User']?_0x376bfe[_0xb717('0x57')][_0xb717('0x6e')]:'System':_0x376bfe[_0xb717('0x59')]['firstName']+(_0x376bfe['Contact']['lastName']?'\x20'+_0x376bfe[_0xb717('0x59')][_0xb717('0x5b')]:''),'body':_0x376bfe[_0xb717('0x5c')]?_0x376bfe['Attachment'][_0xb717('0x69')]:_0x376bfe[_0xb717('0x33')],'direction':_0x376bfe['direction']===_0xb717('0x6d')?'A':'C','secret':_0x376bfe[_0xb717('0x5f')],'read':_0x376bfe[_0xb717('0x6f')],'attachment':_0x376bfe['Attachment']};})[_0xb717('0x70')]()};return ejs[_0xb717('0x71')](path[_0xb717('0x53')](config[_0xb717('0x50')],_0xb717('0x51'),_0xb717('0x72'),'downloadInteraction.ejs'),{'interaction':_0x373a03})[_0xb717('0x17')](function(_0x33bcc0){var _0x129e2d=path[_0xb717('0x53')](_0x246a59,_0xb717('0x73')+_0x2a7a9d['id']+'-'+_0x118ef4+_0xb717('0x74'));var _0x3593f4={'path':_0x129e2d,'channel':_0xb717('0x63'),'interactionId':_0x2a7a9d['id']};return pdf[_0xb717('0x75')](_0x33bcc0,_0x3593f4);})[_0xb717('0x17')](function(){return new BPromise(function(_0x59f6fb,_0x2873b2){zipdir(_0x246a59,{'saveTo':_0xbfa0a7},function(_0x5d10e6,_0x30f4e1){if(_0x5d10e6)return _0x2873b2(_0x5d10e6);return _0x59f6fb(_0x30f4e1);});})[_0xb717('0x17')](function(){return new BPromise(function(_0x38bc4f,_0x3df5cd){rimraf(_0x246a59,function(_0x257856){if(_0x257856)_0x3df5cd(_0x257856);return _0x38bc4f();});});})['then'](function(){return _0x2a4170['download'](_0xbfa0a7,_0x214c9b,function(_0x1c35bc){if(_0x1c35bc){console[_0xb717('0x76')](_0xb717('0x77'),_0x1c35bc);}else{fs['unlinkSync'](_0xbfa0a7);}});});});}else{return _0x2a4170[_0xb717('0xf')](0xc8);}})[_0xb717('0x26')](handleError(_0x2a4170,null));}; \ No newline at end of file +var _0x6cb7=['find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','intersection','length','hasOwnProperty','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','push','Contact','firstName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','fullname','get','mkdirSync','Owner','N.A.','createdAt','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','out','System','lastName','value','views','transcript-','.pdf','Whatsapp','createPdfFromHTML','download','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','findAll','whatsapp','query','catch','show','params','model','keys','filters','attributes','fields','includeAll','options','create','body'];(function(_0x38a927,_0x1396c6){var _0x1a4baf=function(_0x1de509){while(--_0x1de509){_0x38a927['push'](_0x38a927['shift']());}};_0x1a4baf(++_0x1396c6);}(_0x6cb7,0x1bf));var _0x76cb=function(_0x44868d,_0x45dbf7){_0x44868d=_0x44868d-0x0;var _0x5be789=_0x6cb7[_0x44868d];return _0x5be789;};'use strict';var rimraf=require(_0x76cb('0x0'));var zipdir=require(_0x76cb('0x1'));var moment=require('moment');var BPromise=require(_0x76cb('0x2'));var util=require(_0x76cb('0x3'));var path=require(_0x76cb('0x4'));var ejs=require(_0x76cb('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x76cb('0x6'));var interaction=require(_0x76cb('0x7'));var qs=require(_0x76cb('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x76cb('0x9'));var config=require('../../config/environment');var db=require(_0x76cb('0xa'))['db'];config[_0x76cb('0xb')]=_['defaults'](config[_0x76cb('0xb')],{'host':_0x76cb('0xc'),'port':0x18eb});var socket=require(_0x76cb('0xd'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x76cb('0xe')](socket);function respondWithStatusCode(_0x7390b4,_0x43ef5e){_0x43ef5e=_0x43ef5e||0xcc;return function(_0xcdc096){if(_0xcdc096){return _0x7390b4[_0x76cb('0xf')](_0x43ef5e);}return _0x7390b4[_0x76cb('0x10')](_0x43ef5e)[_0x76cb('0x11')]();};}function respondWithResult(_0x5eefdf,_0x3d1373){_0x3d1373=_0x3d1373||0xc8;return function(_0xb8e95e){if(_0xb8e95e){return _0x5eefdf[_0x76cb('0x10')](_0x3d1373)[_0x76cb('0x12')](_0xb8e95e);}};}function respondWithFilteredResult(_0x13b682,_0x5d40d5){return function(_0x3db5b2){if(_0x3db5b2){var _0x4b4cee=typeof _0x5d40d5[_0x76cb('0x13')]===_0x76cb('0x14')&&typeof _0x5d40d5[_0x76cb('0x15')]===_0x76cb('0x14');var _0x1da150=_0x3db5b2[_0x76cb('0x16')];var _0x5ace36=_0x4b4cee?0x0:_0x5d40d5[_0x76cb('0x13')];var _0x23466e=_0x4b4cee?_0x3db5b2[_0x76cb('0x16')]:_0x5d40d5[_0x76cb('0x13')]+_0x5d40d5['limit'];var _0x4d94db;if(_0x23466e>=_0x1da150){_0x23466e=_0x1da150;_0x4d94db=0xc8;}else{_0x4d94db=0xce;}_0x13b682[_0x76cb('0x10')](_0x4d94db);return _0x13b682[_0x76cb('0x17')]('Content-Range',_0x5ace36+'-'+_0x23466e+'/'+_0x1da150)[_0x76cb('0x12')](_0x3db5b2);}return null;};}function saveUpdates(_0x3ffea5){return function(_0x393a77){if(_0x393a77){return _0x393a77[_0x76cb('0x18')](_0x3ffea5)['then'](function(_0x5991fb){return _0x5991fb;});}return null;};}function removeEntity(_0x33164c){return function(_0x2f7951){if(_0x2f7951){return _0x2f7951[_0x76cb('0x19')]()[_0x76cb('0x1a')](function(){_0x33164c[_0x76cb('0x10')](0xcc)[_0x76cb('0x11')]();});}};}function handleEntityNotFound(_0x2d1578){return function(_0x332c1c){if(!_0x332c1c){_0x2d1578[_0x76cb('0xf')](0x194);}return _0x332c1c;};}function handleError(_0x144aed,_0x5ad624){_0x5ad624=_0x5ad624||0x1f4;return function(_0x220727){logger[_0x76cb('0x1b')](_0x220727[_0x76cb('0x1c')]);if(_0x220727[_0x76cb('0x1d')]){delete _0x220727[_0x76cb('0x1d')];}_0x144aed[_0x76cb('0x10')](_0x5ad624)[_0x76cb('0x1e')](_0x220727);};}exports[_0x76cb('0x1f')]=function(_0x27ddd5,_0xae7f1d){var _0x4ac57d={};var _0x3297f3=_[_0x76cb('0x20')](db[_0x76cb('0x21')][_0x76cb('0x22')],function(_0x1c2c21){return{'name':_0x1c2c21[_0x76cb('0x23')],'type':_0x1c2c21[_0x76cb('0x24')][_0x76cb('0x25')]};});_0x4ac57d=qs['getOptions'](_0x3297f3,_0x27ddd5);return interaction[_0x76cb('0x26')](_0x76cb('0x27'),_0x27ddd5[_0x76cb('0x28')],_0x27ddd5['user'],_0x4ac57d,_0x3297f3)[_0x76cb('0x1a')](respondWithFilteredResult(_0xae7f1d,_0x4ac57d))[_0x76cb('0x29')](handleError(_0xae7f1d,null));};exports[_0x76cb('0x2a')]=function(_0x337b97,_0x639465){var _0x436f2a={'raw':![],'where':{'id':_0x337b97[_0x76cb('0x2b')]['id']}},_0x5cd1d6={};_0x5cd1d6[_0x76cb('0x2c')]=_[_0x76cb('0x2d')](db['WhatsappInteraction']['rawAttributes']);_0x5cd1d6['query']=_[_0x76cb('0x2d')](_0x337b97[_0x76cb('0x28')]);_0x5cd1d6[_0x76cb('0x2e')]=_['intersection'](_0x5cd1d6['model'],_0x5cd1d6[_0x76cb('0x28')]);_0x436f2a[_0x76cb('0x2f')]=_['intersection'](_0x5cd1d6[_0x76cb('0x2c')],qs['fields'](_0x337b97[_0x76cb('0x28')][_0x76cb('0x30')]));_0x436f2a[_0x76cb('0x2f')]=_0x436f2a['attributes']['length']?_0x436f2a[_0x76cb('0x2f')]:_0x5cd1d6[_0x76cb('0x2c')];if(_0x337b97[_0x76cb('0x28')][_0x76cb('0x31')]){_0x436f2a['include']=[{'all':!![]}];}_0x436f2a=_['merge']({},_0x436f2a,_0x337b97[_0x76cb('0x32')]);return db[_0x76cb('0x21')]['find'](_0x436f2a)[_0x76cb('0x1a')](handleEntityNotFound(_0x639465,null))['then'](respondWithResult(_0x639465,null))[_0x76cb('0x29')](handleError(_0x639465,null));};exports[_0x76cb('0x33')]=function(_0x407d07,_0x57fe81){return db['WhatsappInteraction'][_0x76cb('0x33')](_0x407d07[_0x76cb('0x34')],{})['then'](respondWithResult(_0x57fe81,0xc9))[_0x76cb('0x29')](handleError(_0x57fe81,null));};exports[_0x76cb('0x18')]=function(_0x302a5f,_0x1b3323){if(_0x302a5f[_0x76cb('0x34')]['id']){delete _0x302a5f[_0x76cb('0x34')]['id'];}return db[_0x76cb('0x21')]['find']({'where':{'id':_0x302a5f['params']['id']}})[_0x76cb('0x1a')](handleEntityNotFound(_0x1b3323,null))[_0x76cb('0x1a')](saveUpdates(_0x302a5f[_0x76cb('0x34')],null))[_0x76cb('0x1a')](respondWithResult(_0x1b3323,null))[_0x76cb('0x29')](handleError(_0x1b3323,null));};exports[_0x76cb('0x19')]=function(_0x5d9bd3,_0x3745b9){return db[_0x76cb('0x21')][_0x76cb('0x35')]({'where':{'id':_0x5d9bd3[_0x76cb('0x2b')]['id']}})[_0x76cb('0x1a')](handleEntityNotFound(_0x3745b9,null))['then'](removeEntity(_0x3745b9,null))[_0x76cb('0x29')](handleError(_0x3745b9,null));};exports[_0x76cb('0x36')]=function(_0x4fa45e,_0x3310da){return db[_0x76cb('0x21')][_0x76cb('0x36')]()[_0x76cb('0x1a')](respondWithResult(_0x3310da,null))[_0x76cb('0x29')](handleError(_0x3310da,null));};exports[_0x76cb('0x37')]=function(_0x37a066,_0x3a2c26){return db[_0x76cb('0x38')][_0x76cb('0x35')]({'where':{'id':_0x37a066[_0x76cb('0x2b')]['id']}})[_0x76cb('0x1a')](handleEntityNotFound(_0x3a2c26,null))['then'](function(_0x3e4665){if(_0x3e4665){return _0x3e4665['addMessage'](_0x37a066[_0x76cb('0x34')][_0x76cb('0x39')],_[_0x76cb('0x3a')](_0x37a066[_0x76cb('0x34')],['ids','id'])||{});}})[_0x76cb('0x1a')](respondWithResult(_0x3a2c26,null))[_0x76cb('0x29')](handleError(_0x3a2c26,null));};exports[_0x76cb('0x3b')]=function(_0x33aac2,_0x49bad0){var _0x15fbbf={'raw':![],'where':{}};var _0x6d5137={};var _0xb39dd9={'count':0x0,'rows':[]};return db[_0x76cb('0x21')]['findOne']({'where':{'id':_0x33aac2[_0x76cb('0x2b')]['id']}})[_0x76cb('0x1a')](handleEntityNotFound(_0x49bad0,null))[_0x76cb('0x1a')](function(_0x2569d2){if(_0x2569d2){_0x6d5137[_0x76cb('0x2c')]=_[_0x76cb('0x2d')](db[_0x76cb('0x38')][_0x76cb('0x22')]);_0x6d5137[_0x76cb('0x28')]=_[_0x76cb('0x2d')](_0x33aac2[_0x76cb('0x28')]);_0x6d5137[_0x76cb('0x2e')]=_[_0x76cb('0x3c')](_0x6d5137[_0x76cb('0x2c')],_0x6d5137['query']);_0x15fbbf[_0x76cb('0x2f')]=_[_0x76cb('0x3c')](_0x6d5137[_0x76cb('0x2c')],qs[_0x76cb('0x30')](_0x33aac2[_0x76cb('0x28')][_0x76cb('0x30')]));_0x15fbbf['attributes']=_0x15fbbf['attributes'][_0x76cb('0x3d')]?_0x15fbbf[_0x76cb('0x2f')]:_0x6d5137[_0x76cb('0x2c')];if(!_0x33aac2[_0x76cb('0x28')][_0x76cb('0x3e')]('nolimit')){_0x15fbbf['limit']=qs[_0x76cb('0x15')](_0x33aac2[_0x76cb('0x28')]['limit']);_0x15fbbf[_0x76cb('0x13')]=qs['offset'](_0x33aac2[_0x76cb('0x28')]['offset']);}_0x15fbbf[_0x76cb('0x3f')]=qs[_0x76cb('0x40')](_0x33aac2[_0x76cb('0x28')][_0x76cb('0x40')]);_0x15fbbf[_0x76cb('0x41')]=qs[_0x76cb('0x2e')](_[_0x76cb('0x42')](_0x33aac2['query'],_0x6d5137[_0x76cb('0x2e')]));_0x15fbbf[_0x76cb('0x41')]['WhatsappInteractionId']=_0x2569d2['id'];if(_0x33aac2[_0x76cb('0x28')][_0x76cb('0x43')]){_0x15fbbf['where']=_['merge'](_0x15fbbf[_0x76cb('0x41')],{'$or':_['map'](_0x15fbbf[_0x76cb('0x2f')],function(_0x1a7578){var _0x23c322={};_0x23c322[_0x1a7578]={'$like':'%'+_0x33aac2[_0x76cb('0x28')][_0x76cb('0x43')]+'%'};return _0x23c322;})});}if(_0x33aac2[_0x76cb('0x28')][_0x76cb('0x44')]){var _0x2f03ab=_0x33aac2[_0x76cb('0x28')]['$gte'][_0x76cb('0x45')](',');var _0x7a5f2d={};_0x7a5f2d[_0x2f03ab[0x0]]={'$gte':moment(_0x2f03ab[0x1])[_0x76cb('0x46')](_0x76cb('0x47'))};_0x15fbbf[_0x76cb('0x41')]=_['merge'](_0x15fbbf[_0x76cb('0x41')],_0x7a5f2d);}_0x15fbbf=_[_0x76cb('0x48')]({},_0x15fbbf,_0x33aac2[_0x76cb('0x32')]);return db[_0x76cb('0x38')][_0x76cb('0x16')]({'where':_0x15fbbf[_0x76cb('0x41')]})[_0x76cb('0x1a')](function(_0x4b08ce){_0xb39dd9['count']=_0x4b08ce;if(_0x33aac2[_0x76cb('0x28')]['includeAll']){_0x15fbbf['include']=[{'all':!![]}];}return db[_0x76cb('0x38')][_0x76cb('0x26')](_0x15fbbf);})[_0x76cb('0x1a')](function(_0x416aea){_0xb39dd9[_0x76cb('0x49')]=_0x416aea;return _0xb39dd9;});}})[_0x76cb('0x1a')](respondWithFilteredResult(_0x49bad0,_0x15fbbf))[_0x76cb('0x29')](handleError(_0x49bad0,null));};exports[_0x76cb('0x4a')]=function(_0x5bf017,_0x580225){return db[_0x76cb('0x21')][_0x76cb('0x35')]({'where':{'id':_0x5bf017[_0x76cb('0x2b')]['id']}})['then'](handleEntityNotFound(_0x580225,null))[_0x76cb('0x1a')](function(_0x50fe53){if(_0x50fe53){return _0x50fe53[_0x76cb('0x4b')](_0x5bf017[_0x76cb('0x34')]['ids'],_['omit'](_0x5bf017['body'],['ids','id'])||{})[_0x76cb('0x4c')](function(){return db['Tag']['findAll']({'attributes':['id',_0x76cb('0x1d'),_0x76cb('0x4d')],'where':{'id':_0x5bf017[_0x76cb('0x34')][_0x76cb('0x39')]}});})[_0x76cb('0x1a')](function(_0x4ec484){socket[_0x76cb('0x4e')](_0x76cb('0x4f'),{'id':Number(_0x5bf017[_0x76cb('0x2b')]['id']),'tags':_0x4ec484||[]});return{'id':Number(_0x5bf017[_0x76cb('0x2b')]['id']),'tags':_0x4ec484||[]};});}})[_0x76cb('0x1a')](respondWithResult(_0x580225,null))[_0x76cb('0x29')](handleError(_0x580225,null));};exports['removeTags']=function(_0x15c0b2,_0x3f127e){return db['WhatsappInteraction'][_0x76cb('0x35')]({'where':{'id':_0x15c0b2['params']['id']}})[_0x76cb('0x1a')](handleEntityNotFound(_0x3f127e,null))[_0x76cb('0x1a')](function(_0x56394d){if(_0x56394d){return _0x56394d[_0x76cb('0x50')](_0x15c0b2[_0x76cb('0x28')]['ids']);}})['then'](respondWithStatusCode(_0x3f127e,null))[_0x76cb('0x29')](handleError(_0x3f127e,null));};exports['download']=function(_0xd6cfbd,_0x1b6f81){var _0x53ad32=moment()['unix']()[_0x76cb('0x51')]();var _0x90a324=path[_0x76cb('0x52')](config[_0x76cb('0x53')],'server',_0x76cb('0x54'),_0x76cb('0x55'));var _0x3dd4d4=path[_0x76cb('0x52')](config[_0x76cb('0x53')],_0x76cb('0x56'),_0x76cb('0x54'),_0x76cb('0x57'));var _0x11522e=path[_0x76cb('0x52')](_0x90a324,_0x53ad32);var _0xb96b55=util['format'](_0x76cb('0x58'),_0xd6cfbd[_0x76cb('0x2b')]['id'],_0x53ad32);var _0x3ca202=path[_0x76cb('0x52')](_0x90a324,_0xb96b55);var _0x2d3b04=[];_0x2d3b04['push']({'model':db[_0x76cb('0x59')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x2d3b04[_0x76cb('0x5a')]({'model':db['CmContact'],'as':_0x76cb('0x5b'),'attributes':['id',_0x76cb('0x5c'),'lastName'],'raw':!![]});if(_0xd6cfbd['query']['attachments']){_0x2d3b04[_0x76cb('0x5a')]({'model':db[_0x76cb('0x5d')],'as':_0x76cb('0x5d'),'raw':!![]});}var _0x5168f5=[{'model':db[_0x76cb('0x38')],'as':_0x76cb('0x5e'),'attributes':['id','body','createdAt',_0x76cb('0x5f'),_0x76cb('0x60'),_0x76cb('0x61')],'include':_0x2d3b04}];_0x5168f5[_0x76cb('0x5a')]({'model':db[_0x76cb('0x62')],'as':_0x76cb('0x63'),'attributes':['id','name']});_0x5168f5[_0x76cb('0x5a')]({'model':db[_0x76cb('0x59')],'as':'Owner','attributes':['id',_0x76cb('0x64')]});return db['WhatsappInteraction'][_0x76cb('0x35')]({'where':{'id':_0xd6cfbd[_0x76cb('0x2b')]['id']},'include':_0x5168f5})[_0x76cb('0x1a')](handleEntityNotFound(_0x1b6f81,null))[_0x76cb('0x1a')](function(_0x1ddc99){if(_0x1ddc99){var _0x541c9c=_0x1ddc99[_0x76cb('0x65')]({'plain':!![]});fs[_0x76cb('0x66')](_0x11522e);var _0x2b660f={'channel':'Whatsapp','account':_0x541c9c[_0x76cb('0x63')][_0x76cb('0x1d')],'agent':_0x541c9c['Owner']?_0x541c9c[_0x76cb('0x67')][_0x76cb('0x64')]:_0x76cb('0x68'),'createdAt':moment(_0x541c9c[_0x76cb('0x69')])[_0x76cb('0x46')](_0x76cb('0x47'))[_0x76cb('0x51')](),'closedAt':_0x541c9c[_0x76cb('0x6a')]?moment(_0x541c9c[_0x76cb('0x6b')])[_0x76cb('0x46')](_0x76cb('0x47'))[_0x76cb('0x51')]():'','disposition':_0x541c9c[_0x76cb('0x6c')],'messages':_(_0x541c9c[_0x76cb('0x5e')])['filter']({'secret':![]})[_0x76cb('0x20')](function(_0x13b28b){if(_0x13b28b[_0x76cb('0x5d')]){var _0x5c1a4b=path[_0x76cb('0x52')](_0x3dd4d4,_0x13b28b[_0x76cb('0x5d')][_0x76cb('0x6d')]);if(fs['existsSync'](_0x5c1a4b)){fs[_0x76cb('0x6e')](_0x5c1a4b)[_0x76cb('0x6f')](fs[_0x76cb('0x70')](path[_0x76cb('0x52')](_0x11522e,_0x13b28b[_0x76cb('0x5d')]['basename'])));}}return{'date':moment(_0x13b28b[_0x76cb('0x69')])[_0x76cb('0x46')](_0x76cb('0x47'))[_0x76cb('0x51')](),'sender':_0x13b28b[_0x76cb('0x5f')]===_0x76cb('0x71')?_0x13b28b[_0x76cb('0x59')]?_0x13b28b[_0x76cb('0x59')][_0x76cb('0x64')]:_0x76cb('0x72'):_0x13b28b[_0x76cb('0x5b')]['firstName']+(_0x13b28b[_0x76cb('0x5b')]['lastName']?'\x20'+_0x13b28b['Contact'][_0x76cb('0x73')]:''),'body':_0x13b28b[_0x76cb('0x5d')]?_0x13b28b[_0x76cb('0x5d')][_0x76cb('0x6d')]:_0x13b28b[_0x76cb('0x34')],'direction':_0x13b28b[_0x76cb('0x5f')]===_0x76cb('0x71')?'A':'C','secret':_0x13b28b[_0x76cb('0x60')],'read':_0x13b28b[_0x76cb('0x61')],'attachment':_0x13b28b[_0x76cb('0x5d')]};})[_0x76cb('0x74')]()};return ejs['renderFile'](path['join'](config[_0x76cb('0x53')],_0x76cb('0x56'),_0x76cb('0x75'),'downloadInteraction.ejs'),{'interaction':_0x2b660f})['then'](function(_0x5ae414){var _0x33ee14=path['join'](_0x11522e,_0x76cb('0x76')+_0x541c9c['id']+'-'+_0x53ad32+_0x76cb('0x77'));var _0x2183c0={'path':_0x33ee14,'channel':_0x76cb('0x78'),'interactionId':_0x541c9c['id']};return pdf[_0x76cb('0x79')](_0x5ae414,_0x2183c0);})['then'](function(){return new BPromise(function(_0x331996,_0x7de324){zipdir(_0x11522e,{'saveTo':_0x3ca202},function(_0xda554c,_0x55b7f2){if(_0xda554c)return _0x7de324(_0xda554c);return _0x331996(_0x55b7f2);});})[_0x76cb('0x1a')](function(){return new BPromise(function(_0x20d2f8,_0x53201f){rimraf(_0x11522e,function(_0x2c560d){if(_0x2c560d)_0x53201f(_0x2c560d);return _0x20d2f8();});});})[_0x76cb('0x1a')](function(){return _0x1b6f81[_0x76cb('0x7a')](_0x3ca202,_0xb96b55,function(_0x18a57f){if(_0x18a57f){console['log'](_0x76cb('0x7b'),_0x18a57f);}else{fs[_0x76cb('0x7c')](_0x3ca202);}});});});}else{return _0x1b6f81[_0x76cb('0xf')](0xc8);}})[_0x76cb('0x29')](handleError(_0x1b6f81,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index bb77766..98e0838 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 _0xd957=['emit','hook','exports','events','../../mysqldb','WhatsappMessage','save','update','remove','then','Users','map','findAll','setDataValue','unreadMessages','length'];(function(_0x3153f0,_0x3a22bc){var _0x18ffc9=function(_0x1b61db){while(--_0x1b61db){_0x3153f0['push'](_0x3153f0['shift']());}};_0x18ffc9(++_0x3a22bc);}(_0xd957,0x153));var _0x7d95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd957[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x7d95('0x0'));var WhatsappInteraction=require(_0x7d95('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x7d95('0x1'))['db'][_0x7d95('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7d95('0x3'),'afterUpdate':_0x7d95('0x4'),'afterDestroy':_0x7d95('0x5')};function emitEvent(_0x9750e1){return function(_0x24d0a6,_0x225179,_0x2de581){_0x24d0a6['getUsers']({'attributes':['id'],'raw':!![]})[_0x7d95('0x6')](function(_0x11bb29){_0x24d0a6['setDataValue'](_0x7d95('0x7'),_0x11bb29[_0x7d95('0x8')](function(_0xf2770a){return{'id':_0xf2770a['id']};}));return WhatsappMessage[_0x7d95('0x9')]({'where':{'WhatsappInteractionId':_0x24d0a6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7d95('0x6')](function(_0x572e5f){_0x24d0a6[_0x7d95('0xa')](_0x7d95('0xb'),_0x572e5f[_0x7d95('0xc')]);WhatsappInteractionEvents[_0x7d95('0xd')](_0x9750e1+':'+_0x24d0a6['id'],_0x24d0a6);WhatsappInteractionEvents[_0x7d95('0xd')](_0x9750e1,_0x24d0a6);_0x2de581(null);})['catch'](_0x2de581(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x7d95('0xe')](e,emitEvent(event));}}module[_0x7d95('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x9755=['Users','findAll','emit','catch','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','remove','getUsers','then','setDataValue'];(function(_0xcf69e4,_0x22359f){var _0x3ae183=function(_0x34d0fc){while(--_0x34d0fc){_0xcf69e4['push'](_0xcf69e4['shift']());}};_0x3ae183(++_0x22359f);}(_0x9755,0x1c6));var _0x5975=function(_0xdf5fc5,_0x37255b){_0xdf5fc5=_0xdf5fc5-0x0;var _0x52f5a5=_0x9755[_0xdf5fc5];return _0x52f5a5;};'use strict';var EventEmitter=require(_0x5975('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x5975('0x1')];var WhatsappMessage=require(_0x5975('0x2'))['db'][_0x5975('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5975('0x4')};function emitEvent(_0x453917){return function(_0x2b7c96,_0x1a201e,_0x414e54){_0x2b7c96[_0x5975('0x5')]({'attributes':['id'],'raw':!![]})[_0x5975('0x6')](function(_0x56fc2e){_0x2b7c96[_0x5975('0x7')](_0x5975('0x8'),_0x56fc2e['map'](function(_0x3485fa){return{'id':_0x3485fa['id']};}));return WhatsappMessage[_0x5975('0x9')]({'where':{'WhatsappInteractionId':_0x2b7c96['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5975('0x6')](function(_0x5701dd){_0x2b7c96[_0x5975('0x7')]('unreadMessages',_0x5701dd['length']);WhatsappInteractionEvents[_0x5975('0xa')](_0x453917+':'+_0x2b7c96['id'],_0x2b7c96);WhatsappInteractionEvents[_0x5975('0xa')](_0x453917,_0x2b7c96);_0x414e54(null);})[_0x5975('0xb')](_0x414e54(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x5975('0xc')](e,emitEvent(event));}}module[_0x5975('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 8159c88..700fe52 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 _0xe43b=['define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0xf7d134,_0x95e37e){var _0x515c15=function(_0x7f0b8b){while(--_0x7f0b8b){_0xf7d134['push'](_0xf7d134['shift']());}};_0x515c15(++_0x95e37e);}(_0xe43b,0x157));var _0xbe43=function(_0x226879,_0x30a56b){_0x226879=_0x226879-0x0;var _0x20964c=_0xe43b[_0x226879];return _0x20964c;};'use strict';var _=require('lodash');var util=require(_0xbe43('0x0'));var logger=require(_0xbe43('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbe43('0x2'));var rp=require(_0xbe43('0x3'));var fs=require('fs');var path=require(_0xbe43('0x4'));var rimraf=require(_0xbe43('0x5'));var config=require(_0xbe43('0x6'));var attributes=require(_0xbe43('0x7'));module[_0xbe43('0x8')]=function(_0xc1b590,_0x33433f){return _0xc1b590[_0xbe43('0x9')](_0xbe43('0xa'),attributes,{'tableName':_0xbe43('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34c1b6,_0x102858,_0x37751f){if(_0x34c1b6['changed'](_0xbe43('0xc'))){_0x34c1b6[_0xbe43('0xd')]=moment()[_0xbe43('0xe')](_0xbe43('0xf'));}_0x37751f(null,_0x34c1b6);}}});}; \ No newline at end of file +var _0x2087=['util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x1389ae,_0x1caf91){var _0x1514d4=function(_0x41bb97){while(--_0x41bb97){_0x1389ae['push'](_0x1389ae['shift']());}};_0x1514d4(++_0x1caf91);}(_0x2087,0x9f));var _0x7208=function(_0x336cb2,_0x436438){_0x336cb2=_0x336cb2-0x0;var _0x1eaadb=_0x2087[_0x336cb2];return _0x1eaadb;};'use strict';var _=require(_0x7208('0x0'));var util=require(_0x7208('0x1'));var logger=require(_0x7208('0x2'))(_0x7208('0x3'));var moment=require(_0x7208('0x4'));var BPromise=require(_0x7208('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7208('0x6'));var rimraf=require(_0x7208('0x7'));var config=require('../../config/environment');var attributes=require(_0x7208('0x8'));module[_0x7208('0x9')]=function(_0x5afdee,_0x398e4d){return _0x5afdee['define'](_0x7208('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x295c1d,_0x1053d5,_0x2e5766){if(_0x295c1d[_0x7208('0xb')](_0x7208('0xc'))){_0x295c1d[_0x7208('0xd')]=moment()[_0x7208('0xe')](_0x7208('0xf'));}_0x2e5766(null,_0x295c1d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d10b3e4..71e57fc 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 _0x05f7=['stringify','code','error','message','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','catch','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x05f7,0xb9));var _0x705f=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0x05f7[_0x35b195];return _0x2433bf;};'use strict';var _=require(_0x705f('0x0'));var util=require(_0x705f('0x1'));var moment=require(_0x705f('0x2'));var BPromise=require(_0x705f('0x3'));var rs=require(_0x705f('0x4'));var fs=require('fs');var Redis=require(_0x705f('0x5'));var db=require(_0x705f('0x6'))['db'];var utils=require(_0x705f('0x7'));var logger=require('../../config/logger')(_0x705f('0x8'));var config=require(_0x705f('0x9'));var jayson=require(_0x705f('0xa'));var client=jayson[_0x705f('0xb')][_0x705f('0xc')]({'port':0x232a});config['redis']=_[_0x705f('0xd')](config[_0x705f('0xe')],{'host':_0x705f('0xf'),'port':0x18eb});var socket=require(_0x705f('0x10'))(new Redis(config[_0x705f('0xe')]));require('./whatsappInteraction.socket')[_0x705f('0x11')](socket);function respondWithRpcPromise(_0x3cb9f,_0x23f7b0,_0x214d89){return new BPromise(function(_0x5eb807,_0x5e4d25){return client[_0x705f('0x12')](_0x3cb9f,_0x214d89)[_0x705f('0x13')](function(_0x4f9f52){logger[_0x705f('0x14')](_0x705f('0x15'),_0x23f7b0,'request\x20sent');logger[_0x705f('0x16')](_0x705f('0x17'),_0x23f7b0,_0x705f('0x18'),JSON[_0x705f('0x19')](_0x4f9f52));if(_0x4f9f52['error']){if(_0x4f9f52['error'][_0x705f('0x1a')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x23f7b0,_0x4f9f52[_0x705f('0x1b')][_0x705f('0x1c')]);return _0x5e4d25(_0x4f9f52['error'][_0x705f('0x1c')]);}logger[_0x705f('0x1b')](_0x705f('0x15'),_0x23f7b0,_0x4f9f52[_0x705f('0x1b')][_0x705f('0x1c')]);return _0x5eb807(_0x4f9f52['error']['message']);}else{logger[_0x705f('0x14')](_0x705f('0x15'),_0x23f7b0,_0x705f('0x18'));_0x5eb807(_0x4f9f52['result'][_0x705f('0x1c')]);}})['catch'](function(_0x258fd0){logger[_0x705f('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x23f7b0,_0x258fd0);_0x5e4d25(_0x258fd0);});});}exports[_0x705f('0x1d')]=function(_0x2c9a36){var _0x3cc931=this;return new Promise(function(_0x117bf0,_0x514918){return db[_0x705f('0x1e')]['update'](_0x2c9a36[_0x705f('0x1f')],{'raw':_0x2c9a36[_0x705f('0x20')]?_0x2c9a36[_0x705f('0x20')][_0x705f('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c9a36['options']?_0x2c9a36[_0x705f('0x20')][_0x705f('0x22')]||null:null,'attributes':_0x2c9a36[_0x705f('0x20')]?_0x2c9a36['options'][_0x705f('0x23')]||null:null,'limit':_0x2c9a36[_0x705f('0x20')]?_0x2c9a36[_0x705f('0x20')][_0x705f('0x24')]||null:null})['then'](function(_0x2f34a7){logger['info'](_0x705f('0x1d'),_0x2c9a36);logger['debug'](_0x705f('0x1d'),_0x2c9a36,JSON['stringify'](_0x2f34a7));_0x117bf0(_0x2f34a7);})[_0x705f('0x25')](function(_0xa04c09){logger['error'](_0x705f('0x1d'),_0xa04c09[_0x705f('0x1c')],_0x2c9a36);_0x514918(_0x3cc931['error'](0x1f4,_0xa04c09[_0x705f('0x1c')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x12452a){return new Promise(function(_0x28b61b,_0x23ae4d){return db[_0x705f('0x1e')]['find']({'where':_0x12452a['options']?_0x12452a['options'][_0x705f('0x22')]||null:null})[_0x705f('0x13')](function(_0x163947){if(_0x163947){return _0x163947['addTags'](_0x12452a[_0x705f('0x1f')][_0x705f('0x26')],_[_0x705f('0x27')](_0x12452a[_0x705f('0x1f')],[_0x705f('0x26'),'id'])||{});}})[_0x705f('0x28')](function(_0x27e01a){logger[_0x705f('0x14')](_0x705f('0x29'),_0x12452a);logger[_0x705f('0x16')](_0x705f('0x29'),_0x12452a,JSON[_0x705f('0x19')](_0x27e01a));_0x28b61b(_0x27e01a);})[_0x705f('0x25')](function(_0xbab535){logger['error'](_0x705f('0x29'),_0xbab535[_0x705f('0x1c')],_0x12452a);_0x23ae4d(_this[_0x705f('0x1b')](0x1f4,_0xbab535[_0x705f('0x1c')]));});});}; \ No newline at end of file +var _0x4f3a=['redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','WhatsappInteraction','update','options','raw','where','attributes','limit','info','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','find','addTags','ids','omit','body','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x2c24f7,_0x2375ec){var _0x2eaef5=function(_0x10305e){while(--_0x10305e){_0x2c24f7['push'](_0x2c24f7['shift']());}};_0x2eaef5(++_0x2375ec);}(_0x4f3a,0x121));var _0xa4f3=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x4f3a[_0x9d14e3];return _0x19bf32;};'use strict';var _=require(_0xa4f3('0x0'));var util=require('util');var moment=require(_0xa4f3('0x1'));var BPromise=require(_0xa4f3('0x2'));var rs=require(_0xa4f3('0x3'));var fs=require('fs');var Redis=require(_0xa4f3('0x4'));var db=require(_0xa4f3('0x5'))['db'];var utils=require(_0xa4f3('0x6'));var logger=require(_0xa4f3('0x7'))('rpc');var config=require(_0xa4f3('0x8'));var jayson=require(_0xa4f3('0x9'));var client=jayson[_0xa4f3('0xa')][_0xa4f3('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa4f3('0xc')],{'host':_0xa4f3('0xd'),'port':0x18eb});var socket=require(_0xa4f3('0xe'))(new Redis(config['redis']));require(_0xa4f3('0xf'))[_0xa4f3('0x10')](socket);function respondWithRpcPromise(_0x25f958,_0x407924,_0x24f0ab){return new BPromise(function(_0x4e8f7a,_0x49debd){return client[_0xa4f3('0x11')](_0x25f958,_0x24f0ab)[_0xa4f3('0x12')](function(_0x2fe62c){logger['info'](_0xa4f3('0x13'),_0x407924,_0xa4f3('0x14'));logger['debug'](_0xa4f3('0x15'),_0x407924,_0xa4f3('0x14'),JSON[_0xa4f3('0x16')](_0x2fe62c));if(_0x2fe62c[_0xa4f3('0x17')]){if(_0x2fe62c['error']['code']===0x1f4){logger[_0xa4f3('0x17')](_0xa4f3('0x13'),_0x407924,_0x2fe62c['error']['message']);return _0x49debd(_0x2fe62c['error'][_0xa4f3('0x18')]);}logger['error'](_0xa4f3('0x13'),_0x407924,_0x2fe62c[_0xa4f3('0x17')][_0xa4f3('0x18')]);return _0x4e8f7a(_0x2fe62c[_0xa4f3('0x17')][_0xa4f3('0x18')]);}else{logger['info'](_0xa4f3('0x13'),_0x407924,'request\x20sent');_0x4e8f7a(_0x2fe62c['result'][_0xa4f3('0x18')]);}})[_0xa4f3('0x19')](function(_0x2bed59){logger[_0xa4f3('0x17')](_0xa4f3('0x13'),_0x407924,_0x2bed59);_0x49debd(_0x2bed59);});});}exports['UpdateWhatsappInteraction']=function(_0x23fb3b){var _0x1767d4=this;return new Promise(function(_0x46a331,_0x5eacde){return db[_0xa4f3('0x1a')][_0xa4f3('0x1b')](_0x23fb3b['body'],{'raw':_0x23fb3b[_0xa4f3('0x1c')]?_0x23fb3b[_0xa4f3('0x1c')][_0xa4f3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23fb3b[_0xa4f3('0x1c')]?_0x23fb3b['options'][_0xa4f3('0x1e')]||null:null,'attributes':_0x23fb3b['options']?_0x23fb3b[_0xa4f3('0x1c')][_0xa4f3('0x1f')]||null:null,'limit':_0x23fb3b[_0xa4f3('0x1c')]?_0x23fb3b[_0xa4f3('0x1c')][_0xa4f3('0x20')]||null:null})['then'](function(_0x27e68a){logger[_0xa4f3('0x21')](_0xa4f3('0x22'),_0x23fb3b);logger[_0xa4f3('0x23')](_0xa4f3('0x22'),_0x23fb3b,JSON[_0xa4f3('0x16')](_0x27e68a));_0x46a331(_0x27e68a);})[_0xa4f3('0x19')](function(_0x30cc88){logger[_0xa4f3('0x17')](_0xa4f3('0x22'),_0x30cc88[_0xa4f3('0x18')],_0x23fb3b);_0x5eacde(_0x1767d4['error'](0x1f4,_0x30cc88[_0xa4f3('0x18')]));});});};exports[_0xa4f3('0x24')]=function(_0x4f16a2){return new Promise(function(_0xa2f3a,_0x19516f){return db[_0xa4f3('0x1a')][_0xa4f3('0x25')]({'where':_0x4f16a2['options']?_0x4f16a2['options'][_0xa4f3('0x1e')]||null:null})[_0xa4f3('0x12')](function(_0x81fa86){if(_0x81fa86){return _0x81fa86[_0xa4f3('0x26')](_0x4f16a2['body'][_0xa4f3('0x27')],_[_0xa4f3('0x28')](_0x4f16a2[_0xa4f3('0x29')],[_0xa4f3('0x27'),'id'])||{});}})['spread'](function(_0x535a87){logger['info']('AddTags',_0x4f16a2);logger[_0xa4f3('0x23')](_0xa4f3('0x2a'),_0x4f16a2,JSON[_0xa4f3('0x16')](_0x535a87));_0xa2f3a(_0x535a87);})[_0xa4f3('0x19')](function(_0x54e732){logger[_0xa4f3('0x17')](_0xa4f3('0x2a'),_0x54e732[_0xa4f3('0x18')],_0x4f16a2);_0x19516f(_this[_0xa4f3('0x17')](0x1f4,_0x54e732[_0xa4f3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5650957..475b1f9 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 _0xf954=['./whatsappInteraction.events','save','remove','update','emit','removeListener','length','whatsappInteraction:'];(function(_0x5ecff9,_0x473070){var _0x5e1415=function(_0x3c34a1){while(--_0x3c34a1){_0x5ecff9['push'](_0x5ecff9['shift']());}};_0x5e1415(++_0x473070);}(_0xf954,0x118));var _0x4f95=function(_0xbe31a4,_0x11ba89){_0xbe31a4=_0xbe31a4-0x0;var _0x15ec28=_0xf954[_0xbe31a4];return _0x15ec28;};'use strict';var WhatsappInteractionEvents=require(_0x4f95('0x0'));var events=[_0x4f95('0x1'),_0x4f95('0x2'),_0x4f95('0x3')];function createListener(_0x185c6f,_0x513dad){return function(_0x3e2671){_0x513dad[_0x4f95('0x4')](_0x185c6f,_0x3e2671);};}function removeListener(_0x42097a,_0x3bc48a){return function(){WhatsappInteractionEvents[_0x4f95('0x5')](_0x42097a,_0x3bc48a);};}exports['register']=function(_0x7096e9){for(var _0x67b3ad=0x0,_0x2dabc7=events[_0x4f95('0x6')];_0x67b3ad<_0x2dabc7;_0x67b3ad++){var _0x84cd59=events[_0x67b3ad];var _0x241e29=createListener(_0x4f95('0x7')+_0x84cd59,_0x7096e9);WhatsappInteractionEvents['on'](_0x84cd59,_0x241e29);}}; \ No newline at end of file +var _0xe080=['removeListener','register','length','whatsappInteraction:','save','remove','emit'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0xe080,0x13f));var _0x0e08=function(_0x3669d4,_0x3aa68d){_0x3669d4=_0x3669d4-0x0;var _0x139f04=_0xe080[_0x3669d4];return _0x139f04;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x0e08('0x0'),_0x0e08('0x1'),'update'];function createListener(_0x10aaa6,_0x429004){return function(_0x2b2848){_0x429004[_0x0e08('0x2')](_0x10aaa6,_0x2b2848);};}function removeListener(_0x2e2614,_0xa6c298){return function(){WhatsappInteractionEvents[_0x0e08('0x3')](_0x2e2614,_0xa6c298);};}exports[_0x0e08('0x4')]=function(_0xbd3989){for(var _0x3c0d4f=0x0,_0x455154=events[_0x0e08('0x5')];_0x3c0d4f<_0x455154;_0x3c0d4f++){var _0x3abc5f=events[_0x3c0d4f];var _0x18b9f6=createListener(_0x0e08('0x6')+_0x3abc5f,_0xbd3989);WhatsappInteractionEvents['on'](_0x3abc5f,_0x18b9f6);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b7e1dbc..132e706 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 _0xb233=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','/:id/status','status','update','/:id/accept','accept','destroy'];(function(_0x238b75,_0x185e8d){var _0x7b0fe4=function(_0x2e571b){while(--_0x2e571b){_0x238b75['push'](_0x238b75['shift']());}};_0x7b0fe4(++_0x185e8d);}(_0xb233,0x1ee));var _0x3b23=function(_0x22011a,_0x1a9609){_0x22011a=_0x22011a-0x0;var _0x2cc3ec=_0xb233[_0x22011a];return _0x2cc3ec;};'use strict';var multer=require(_0x3b23('0x0'));var util=require(_0x3b23('0x1'));var path=require('path');var timeout=require(_0x3b23('0x2'));var express=require(_0x3b23('0x3'));var router=express[_0x3b23('0x4')]();var fs_extra=require(_0x3b23('0x5'));var auth=require(_0x3b23('0x6'));var interaction=require(_0x3b23('0x7'));var config=require(_0x3b23('0x8'));var controller=require(_0x3b23('0x9'));router[_0x3b23('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b23('0xb')]);router[_0x3b23('0xa')](_0x3b23('0xc'),auth[_0x3b23('0xd')](),controller[_0x3b23('0xe')]);router[_0x3b23('0xa')](_0x3b23('0xf'),auth[_0x3b23('0xd')](),controller[_0x3b23('0x10')]);router[_0x3b23('0x11')]('/',auth[_0x3b23('0xd')](),interaction[_0x3b23('0x12')](_0x3b23('0x13'),'whatsappmessage:create'),controller['create']);router[_0x3b23('0x11')](_0x3b23('0x14'),controller[_0x3b23('0x15')]);router['put']('/:id',auth[_0x3b23('0xd')](),controller[_0x3b23('0x16')]);router['put'](_0x3b23('0x17'),auth[_0x3b23('0xd')](),controller[_0x3b23('0x18')]);router['put']('/:id/reject',auth[_0x3b23('0xd')](),controller['reject']);router['delete']('/:id',auth[_0x3b23('0xd')](),controller[_0x3b23('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6c88=['whatsappmessage:create','/:id/status','status','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp'];(function(_0x2ae6cf,_0x433230){var _0x5ec0a0=function(_0x499421){while(--_0x499421){_0x2ae6cf['push'](_0x2ae6cf['shift']());}};_0x5ec0a0(++_0x433230);}(_0x6c88,0x107));var _0x86c8=function(_0xaf8267,_0x33968b){_0xaf8267=_0xaf8267-0x0;var _0x20798b=_0x6c88[_0xaf8267];return _0x20798b;};'use strict';var multer=require(_0x86c8('0x0'));var util=require('util');var path=require(_0x86c8('0x1'));var timeout=require(_0x86c8('0x2'));var express=require(_0x86c8('0x3'));var router=express[_0x86c8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x86c8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x86c8('0x6'));var controller=require(_0x86c8('0x7'));router[_0x86c8('0x8')]('/',auth[_0x86c8('0x9')](),controller[_0x86c8('0xa')]);router[_0x86c8('0x8')](_0x86c8('0xb'),auth['isAuthenticated'](),controller[_0x86c8('0xc')]);router[_0x86c8('0x8')](_0x86c8('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x86c8('0xe')]('/',auth[_0x86c8('0x9')](),interaction[_0x86c8('0xf')](_0x86c8('0x10'),_0x86c8('0x11')),controller['create']);router[_0x86c8('0xe')](_0x86c8('0x12'),controller[_0x86c8('0x13')]);router['put'](_0x86c8('0xd'),auth[_0x86c8('0x9')](),controller[_0x86c8('0x14')]);router['put'](_0x86c8('0x15'),auth[_0x86c8('0x9')](),controller[_0x86c8('0x16')]);router['put'](_0x86c8('0x17'),auth['isAuthenticated'](),controller[_0x86c8('0x18')]);router[_0x86c8('0x19')](_0x86c8('0xd'),auth[_0x86c8('0x9')](),controller[_0x86c8('0x1a')]);module[_0x86c8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b1d3bd9..0497495 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 _0xffcc=['BOOLEAN','STRING','DATE','TEXT','exports','medium'];(function(_0x114057,_0xf56f79){var _0x16c00c=function(_0x25c8de){while(--_0x25c8de){_0x114057['push'](_0x114057['shift']());}};_0x16c00c(++_0xf56f79);}(_0xffcc,0x112));var _0xcffc=function(_0x40b479,_0x359ce6){_0x40b479=_0x40b479-0x0;var _0x15c34b=_0xffcc[_0x40b479];return _0x15c34b;};'use strict';var Sequelize=require('sequelize');module[_0xcffc('0x0')]={'body':{'type':Sequelize['TEXT'](_0xcffc('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xcffc('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xcffc('0x3')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xcffc('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcffc('0x3')]},'providerResponse':{'type':Sequelize[_0xcffc('0x5')]}}; \ No newline at end of file +var _0x38ec=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x581b89,_0x287cad){var _0x2a70e1=function(_0xc3dffb){while(--_0xc3dffb){_0x581b89['push'](_0x581b89['shift']());}};_0x2a70e1(++_0x287cad);}(_0x38ec,0xfa));var _0xc38e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38ec[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xc38e('0x0'));module[_0xc38e('0x1')]={'body':{'type':Sequelize[_0xc38e('0x2')](_0xc38e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc38e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc38e('0x5')]('in',_0xc38e('0x6')),'defaultValue':_0xc38e('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc38e('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xc38e('0x8')]},'secret':{'type':Sequelize[_0xc38e('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc38e('0x7')]},'providerResponse':{'type':Sequelize[_0xc38e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index d1654a5..6d5b7bd 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 _0xaab7=['map','WhatsappMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','whatsapp','acceptMessage','reject','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','format','channel','event','EventManager','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','undefined','limit','count','offset','Content-Range','json','then','destroy','sendStatus','stack','name'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xaab7,0x1eb));var _0x7aab=function(_0x502b79,_0x3dcc22){_0x502b79=_0x502b79-0x0;var _0x1e2797=_0xaab7[_0x502b79];return _0x1e2797;};'use strict';var util=require(_0x7aab('0x0'));var _=require('lodash');var Redis=require('ioredis');var interactionService=require(_0x7aab('0x1'));var qs=require(_0x7aab('0x2'));var logger=require('../../config/logger')(_0x7aab('0x3'));var config=require(_0x7aab('0x4'));var db=require(_0x7aab('0x5'))['db'];config[_0x7aab('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7aab('0x7'))(new Redis(config[_0x7aab('0x6')]));require(_0x7aab('0x8'))['register'](socket);var jayson=require(_0x7aab('0x9'));var client=jayson[_0x7aab('0xa')]['http']({'port':0x232c});var client9002=jayson[_0x7aab('0xa')][_0x7aab('0xb')]({'port':0x232a});var interaction_log=require('../../config/logger')('whatsapp-interactions');function respondWithRpcPromise(_0xdac0a5,_0x1e0640,_0x53be22,_0x375f2d){return new Promise(function(_0x1731b5,_0x5c28ad){var _0x1c2152=_0x375f2d||client;return _0x1c2152[_0x7aab('0xc')](_0xdac0a5,_0x53be22)['then'](function(_0x46cc00){logger[_0x7aab('0xd')](_0x7aab('0xe'),_0x1e0640,_0x7aab('0xf'));logger[_0x7aab('0x10')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1e0640,_0x7aab('0xf'),JSON[_0x7aab('0x11')](_0x46cc00));if(_0x46cc00[_0x7aab('0x12')]){if(_0x46cc00['error']['code']===0x1f4){logger['error'](_0x7aab('0xe'),_0x1e0640,_0x46cc00[_0x7aab('0x12')][_0x7aab('0x13')]);return _0x5c28ad(_0x46cc00[_0x7aab('0x12')][_0x7aab('0x13')]);}logger[_0x7aab('0x12')](_0x7aab('0xe'),_0x1e0640,_0x46cc00[_0x7aab('0x12')][_0x7aab('0x13')]);return _0x1731b5(_0x46cc00[_0x7aab('0x12')]['message']);}else{logger[_0x7aab('0xd')]('WhatsappMessage,\x20%s,\x20%s',_0x1e0640,'request\x20sent');_0x1731b5(_0x46cc00[_0x7aab('0x14')]['message']);}})[_0x7aab('0x15')](function(_0x4dfc42){logger[_0x7aab('0x12')](_0x7aab('0xe'),_0x1e0640,_0x4dfc42);_0x5c28ad(_0x4dfc42);});});}function respondWithResult(_0x1e1358,_0x3cb3b5){_0x3cb3b5=_0x3cb3b5||0xc8;return function(_0x1c38af){if(_0x1c38af){return _0x1e1358[_0x7aab('0x16')](_0x3cb3b5)['json'](_0x1c38af);}};}function respondWithFilteredResult(_0x108c65,_0x15964e){return function(_0xf4e4a1){if(_0xf4e4a1){var _0x3bebf5=typeof _0x15964e['offset']===_0x7aab('0x17')&&typeof _0x15964e[_0x7aab('0x18')]===_0x7aab('0x17');var _0x262a8b=_0xf4e4a1[_0x7aab('0x19')];var _0x1ff171=_0x3bebf5?0x0:_0x15964e[_0x7aab('0x1a')];var _0x8c79d7=_0x3bebf5?_0xf4e4a1['count']:_0x15964e['offset']+_0x15964e['limit'];var _0x76623c;if(_0x8c79d7>=_0x262a8b){_0x8c79d7=_0x262a8b;_0x76623c=0xc8;}else{_0x76623c=0xce;}_0x108c65['status'](_0x76623c);return _0x108c65['set'](_0x7aab('0x1b'),_0x1ff171+'-'+_0x8c79d7+'/'+_0x262a8b)[_0x7aab('0x1c')](_0xf4e4a1);}return null;};}function saveUpdates(_0x3a6c7a){return function(_0x51d32b){if(_0x51d32b){return _0x51d32b['update'](_0x3a6c7a)[_0x7aab('0x1d')](function(_0x26908c){return _0x26908c;});}return null;};}function removeEntity(_0x1b4db0){return function(_0x5e7ac5){if(_0x5e7ac5){return _0x5e7ac5[_0x7aab('0x1e')]()[_0x7aab('0x1d')](function(){_0x1b4db0[_0x7aab('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd40db7){return function(_0xe62b5b){if(!_0xe62b5b){_0xd40db7[_0x7aab('0x1f')](0x194);}return _0xe62b5b;};}function handleError(_0x4dadb9,_0x2baec5){_0x2baec5=_0x2baec5||0x1f4;return function(_0x353679){logger[_0x7aab('0x12')](_0x353679[_0x7aab('0x20')]);if(_0x353679[_0x7aab('0x21')]){delete _0x353679['name'];}_0x4dadb9['status'](_0x2baec5)['send'](_0x353679);};}exports['index']=function(_0xed7855,_0x311636){var _0x40aa32={},_0x34e252={},_0x110c01={'count':0x0,'rows':[]};var _0x4d3bbb=_[_0x7aab('0x22')](db[_0x7aab('0x23')][_0x7aab('0x24')],function(_0x38f235){return{'name':_0x38f235[_0x7aab('0x25')],'type':_0x38f235['type'][_0x7aab('0x26')]};});_0x34e252[_0x7aab('0x27')]=_[_0x7aab('0x22')](_0x4d3bbb,'name');_0x34e252['query']=_[_0x7aab('0x28')](_0xed7855[_0x7aab('0x29')]);_0x34e252[_0x7aab('0x2a')]=_[_0x7aab('0x2b')](_0x34e252[_0x7aab('0x27')],_0x34e252['query']);_0x40aa32[_0x7aab('0x2c')]=_['intersection'](_0x34e252[_0x7aab('0x27')],qs[_0x7aab('0x2d')](_0xed7855[_0x7aab('0x29')][_0x7aab('0x2d')]));_0x40aa32[_0x7aab('0x2c')]=_0x40aa32['attributes'][_0x7aab('0x2e')]?_0x40aa32[_0x7aab('0x2c')]:_0x34e252[_0x7aab('0x27')];if(!_0xed7855[_0x7aab('0x29')][_0x7aab('0x2f')]('nolimit')){_0x40aa32['limit']=qs[_0x7aab('0x18')](_0xed7855[_0x7aab('0x29')]['limit']);_0x40aa32[_0x7aab('0x1a')]=qs[_0x7aab('0x1a')](_0xed7855[_0x7aab('0x29')][_0x7aab('0x1a')]);}_0x40aa32[_0x7aab('0x30')]=qs[_0x7aab('0x31')](_0xed7855[_0x7aab('0x29')][_0x7aab('0x31')]);_0x40aa32['where']=qs[_0x7aab('0x2a')](_['pick'](_0xed7855[_0x7aab('0x29')],_0x34e252['filters']),_0x4d3bbb);if(_0xed7855['query'][_0x7aab('0x32')]){_0x40aa32['where']=_['merge'](_0x40aa32[_0x7aab('0x33')],{'$or':_[_0x7aab('0x22')](_0x4d3bbb,function(_0x32548){if(_0x32548[_0x7aab('0x34')]!==_0x7aab('0x35')){var _0x58fe81={};_0x58fe81[_0x32548[_0x7aab('0x21')]]={'$like':'%'+_0xed7855[_0x7aab('0x29')]['filter']+'%'};return _0x58fe81;}})});}_0x40aa32=_[_0x7aab('0x36')]({},_0x40aa32,_0xed7855[_0x7aab('0x37')]);var _0x316d7e={'where':_0x40aa32[_0x7aab('0x33')]};return db[_0x7aab('0x23')][_0x7aab('0x19')](_0x316d7e)['then'](function(_0x141dd6){_0x110c01[_0x7aab('0x19')]=_0x141dd6;if(_0xed7855['query'][_0x7aab('0x38')]){_0x40aa32[_0x7aab('0x39')]=[{'all':!![]}];}return db[_0x7aab('0x23')][_0x7aab('0x3a')](_0x40aa32);})[_0x7aab('0x1d')](function(_0x1c898f){_0x110c01[_0x7aab('0x3b')]=_0x1c898f;return _0x110c01;})[_0x7aab('0x1d')](respondWithFilteredResult(_0x311636,_0x40aa32))[_0x7aab('0x15')](handleError(_0x311636,null));};exports[_0x7aab('0x3c')]=function(_0x56c8b0,_0x48f18b){var _0x569fdb={'raw':!![],'where':{'id':_0x56c8b0[_0x7aab('0x3d')]['id']}},_0x1f5b16={};_0x1f5b16[_0x7aab('0x27')]=_[_0x7aab('0x28')](db[_0x7aab('0x23')][_0x7aab('0x24')]);_0x1f5b16[_0x7aab('0x29')]=_[_0x7aab('0x28')](_0x56c8b0['query']);_0x1f5b16[_0x7aab('0x2a')]=_[_0x7aab('0x2b')](_0x1f5b16['model'],_0x1f5b16[_0x7aab('0x29')]);_0x569fdb[_0x7aab('0x2c')]=_[_0x7aab('0x2b')](_0x1f5b16['model'],qs[_0x7aab('0x2d')](_0x56c8b0[_0x7aab('0x29')][_0x7aab('0x2d')]));_0x569fdb['attributes']=_0x569fdb[_0x7aab('0x2c')][_0x7aab('0x2e')]?_0x569fdb[_0x7aab('0x2c')]:_0x1f5b16[_0x7aab('0x27')];if(_0x56c8b0[_0x7aab('0x29')][_0x7aab('0x38')]){_0x569fdb[_0x7aab('0x39')]=[{'all':!![]}];}_0x569fdb=_[_0x7aab('0x36')]({},_0x569fdb,_0x56c8b0[_0x7aab('0x37')]);return db['WhatsappMessage'][_0x7aab('0x3e')](_0x569fdb)[_0x7aab('0x1d')](handleEntityNotFound(_0x48f18b,null))[_0x7aab('0x1d')](respondWithResult(_0x48f18b,null))['catch'](handleError(_0x48f18b,null));};exports[_0x7aab('0x3f')]=function(_0x5dd10e,_0x387582){return db[_0x7aab('0x23')][_0x7aab('0x3f')](_0x5dd10e[_0x7aab('0x40')],{})[_0x7aab('0x1d')](respondWithResult(_0x387582,0xc9))[_0x7aab('0x15')](handleError(_0x387582,null));};exports[_0x7aab('0x41')]=function(_0x3bd953,_0x6edfe5){if(_0x3bd953['body']['id']){delete _0x3bd953[_0x7aab('0x40')]['id'];}return db['WhatsappMessage'][_0x7aab('0x3e')]({'where':{'id':_0x3bd953['params']['id']}})[_0x7aab('0x1d')](handleEntityNotFound(_0x6edfe5,null))['then'](saveUpdates(_0x3bd953[_0x7aab('0x40')],null))[_0x7aab('0x1d')](respondWithResult(_0x6edfe5,null))[_0x7aab('0x15')](handleError(_0x6edfe5,null));};exports['destroy']=function(_0x4b2a22,_0x119de9){return db[_0x7aab('0x23')]['find']({'where':{'id':_0x4b2a22[_0x7aab('0x3d')]['id']}})[_0x7aab('0x1d')](handleEntityNotFound(_0x119de9,null))['then'](removeEntity(_0x119de9,null))[_0x7aab('0x15')](handleError(_0x119de9,null));};exports[_0x7aab('0x42')]=function(_0x21ca56,_0x1157a2){return db[_0x7aab('0x23')][_0x7aab('0x42')]()[_0x7aab('0x1d')](respondWithResult(_0x1157a2,null))[_0x7aab('0x15')](handleError(_0x1157a2,null));};exports['accept']=function(_0x31656e,_0x2f7e29){var _0x524bbb=_0x7aab('0x43');return interactionService[_0x7aab('0x44')](_0x31656e,_0x524bbb)[_0x7aab('0x1d')](respondWithResult(_0x2f7e29,null))[_0x7aab('0x15')](handleError(_0x2f7e29,null));};exports[_0x7aab('0x45')]=function(_0x267466,_0x298300){var _0x128381={'agent':{},'channel':_0x7aab('0x43')};if(_0x267466[_0x7aab('0x40')]['id']){delete _0x267466[_0x7aab('0x40')]['id'];}_0x267466[_0x7aab('0x40')][_0x7aab('0x46')]=_0x267466['body']['UserId']||_0x267466[_0x7aab('0x47')]['id'];_0x128381[_0x7aab('0x48')]['id']=_0x267466[_0x7aab('0x40')][_0x7aab('0x46')];return db[_0x7aab('0x23')][_0x7aab('0x3e')]({'where':{'id':_0x267466[_0x7aab('0x3d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x298300,null))[_0x7aab('0x1d')](function(_0x3d9b65){if(_0x3d9b65){_0x128381[_0x7aab('0x13')]=_0x3d9b65[_0x7aab('0x49')]({'plain':!![]});return db[_0x7aab('0x4a')][_0x7aab('0x3e')]({'where':{'id':_0x3d9b65[_0x7aab('0x4b')]}});}return null;})[_0x7aab('0x1d')](handleEntityNotFound(_0x298300,null))[_0x7aab('0x1d')](function(_0x1c5b64){if(_0x1c5b64){_0x128381[_0x7aab('0x4c')]=_0x1c5b64[_0x7aab('0x49')]({'plain':!![]});interaction_log['info'](_0x7aab('0x4d'),_0x267466[_0x7aab('0x47')]['id'],_0x267466[_0x7aab('0x47')][_0x7aab('0x21')],_0x267466[_0x7aab('0x47')]['role'],_0x128381[_0x7aab('0x4c')]['id'],_0x267466[_0x7aab('0x40')]?JSON[_0x7aab('0x11')](_0x267466[_0x7aab('0x40')]):_0x7aab('0x4e'));return respondWithRpcPromise(_0x7aab('0x4f'),_0x7aab('0x50'),_0x128381);}return null;})[_0x7aab('0x1d')](function(_0x35b32d){var _0x3ae481=_0x7aab('0x51')+_0x35b32d[_0x7aab('0x13')]['ContactId'];return db[_0x7aab('0x52')][_0x7aab('0x29')](_0x3ae481,{'type':db[_0x7aab('0x53')][_0x7aab('0x54')][_0x7aab('0x55')],'raw':!![]})[_0x7aab('0x1d')](function(_0x43f47d){return _0x43f47d;});})['then'](function(_0x411118){if(_0x411118){_0x128381[_0x7aab('0x13')][_0x7aab('0x56')]=_0x411118[0x0];if(!_0x267466['body'][_0x7aab('0x46')])return;return db[_0x7aab('0x57')]['find']({'where':{'id':_0x267466['body'][_0x7aab('0x46')],'role':_0x7aab('0x48')},'attributes':['id',_0x7aab('0x21'),_0x7aab('0x58'),_0x7aab('0x59'),_0x7aab('0x5a')],'raw':!![]});}return null;})[_0x7aab('0x1d')](function(_0x202d5c){if(!_0x202d5c)return null;_0x128381['message'][_0x7aab('0x48')]=_0x202d5c;return _0x128381;})[_0x7aab('0x1d')](function(_0x584ea8){if(_0x584ea8){_0x584ea8[_0x7aab('0x13')]['interface']=util[_0x7aab('0x5b')]('SIP/%s',_0x267466[_0x7aab('0x47')][_0x7aab('0x21')]);_0x584ea8['message'][_0x7aab('0x5c')]=_0x128381[_0x7aab('0x5c')];_0x584ea8[_0x7aab('0x13')]['motionChannel']=_0x128381[_0x7aab('0x5c')];_0x584ea8[_0x7aab('0x13')][_0x7aab('0x5d')]=_0x7aab('0x45');respondWithRpcPromise(_0x7aab('0x5e'),_0x7aab('0x5e'),{'event':_0x7aab('0x5f'),'message':_0x584ea8[_0x7aab('0x13')]},client9002);return _0x128381;}return null;})['then'](respondWithResult(_0x298300,null))[_0x7aab('0x15')](handleError(_0x298300,null));};exports[_0x7aab('0x16')]=function(_0x3c83e9,_0x1cdb97){if(_0x3c83e9[_0x7aab('0x40')]['id']){delete _0x3c83e9[_0x7aab('0x40')]['id'];}var _0x11e095;return db[_0x7aab('0x23')]['find']({'where':{'id':_0x3c83e9['params']['id']}})[_0x7aab('0x1d')](handleEntityNotFound(_0x1cdb97,null))[_0x7aab('0x1d')](function(_0x1454d8){if(_0x1454d8){_0x11e095=_0x1454d8;return db['WhatsappAccount'][_0x7aab('0x3e')]({'where':{'id':_0x1454d8['WhatsappAccountId']}});}})[_0x7aab('0x1d')](handleEntityNotFound(_0x1cdb97,null))['then'](function(_0x54fa72){if(_0x54fa72){logger[_0x7aab('0x10')](_0x7aab('0x60'),_0x7aab('0x16'),_0x7aab('0x61'),_0x54fa72[_0x7aab('0x34')],util[_0x7aab('0x62')](_0x3c83e9['body'],{'showHidden':![],'depth':null}));switch(_0x54fa72[_0x7aab('0x34')]){case _0x7aab('0x63'):if(_0x3c83e9[_0x7aab('0x40')][_0x7aab('0x64')]&&_0x3c83e9[_0x7aab('0x40')][_0x7aab('0x64')]===_0x11e095[_0x7aab('0x65')]&&_0x3c83e9[_0x7aab('0x40')][_0x7aab('0x66')]&&_0x3c83e9['body']['MessageStatus']===_0x7aab('0x67')){return _0x11e095['update']({'read':!![]});}else{logger[_0x7aab('0x12')](_0x7aab('0x68'),_0x7aab('0x16'),_0x7aab('0x63'),util[_0x7aab('0x62')](_0x3c83e9[_0x7aab('0x40')],{'showHidden':![],'depth':null}));}break;}return _0x11e095;}})['then'](respondWithResult(_0x1cdb97,null))[_0x7aab('0x15')](handleError(_0x1cdb97,null));}; \ No newline at end of file +var _0xbddc=['MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','util','lodash','ioredis','../../components/interaction/service','api','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','../../config/logger','whatsapp-interactions','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','undefined','count','offset','set','end','sendStatus','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','update','describe','accept','whatsapp','acceptMessage','reject','UserId','user','WhatsappInteraction','interaction','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xbddc,0x1d2));var _0xcbdd=function(_0x30c282,_0x30f601){_0x30c282=_0x30c282-0x0;var _0x120e5c=_0xbddc[_0x30c282];return _0x120e5c;};'use strict';var util=require(_0xcbdd('0x0'));var _=require(_0xcbdd('0x1'));var Redis=require(_0xcbdd('0x2'));var interactionService=require(_0xcbdd('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xcbdd('0x4'));var config=require('../../config/environment');var db=require(_0xcbdd('0x5'))['db'];config[_0xcbdd('0x6')]=_[_0xcbdd('0x7')](config[_0xcbdd('0x6')],{'host':_0xcbdd('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbdd('0x6')]));require(_0xcbdd('0x9'))[_0xcbdd('0xa')](socket);var jayson=require(_0xcbdd('0xb'));var client=jayson[_0xcbdd('0xc')][_0xcbdd('0xd')]({'port':0x232c});var client9002=jayson[_0xcbdd('0xc')][_0xcbdd('0xd')]({'port':0x232a});var interaction_log=require(_0xcbdd('0xe'))(_0xcbdd('0xf'));function respondWithRpcPromise(_0x2555af,_0x4dedda,_0x392b7e,_0xd59182){return new Promise(function(_0x192e95,_0x4de8ff){var _0x3ac7d3=_0xd59182||client;return _0x3ac7d3[_0xcbdd('0x10')](_0x2555af,_0x392b7e)[_0xcbdd('0x11')](function(_0x4189be){logger[_0xcbdd('0x12')](_0xcbdd('0x13'),_0x4dedda,_0xcbdd('0x14'));logger['debug'](_0xcbdd('0x15'),_0x4dedda,'request\x20sent',JSON['stringify'](_0x4189be));if(_0x4189be['error']){if(_0x4189be[_0xcbdd('0x16')][_0xcbdd('0x17')]===0x1f4){logger[_0xcbdd('0x16')](_0xcbdd('0x13'),_0x4dedda,_0x4189be[_0xcbdd('0x16')][_0xcbdd('0x18')]);return _0x4de8ff(_0x4189be['error'][_0xcbdd('0x18')]);}logger[_0xcbdd('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x4dedda,_0x4189be[_0xcbdd('0x16')][_0xcbdd('0x18')]);return _0x192e95(_0x4189be[_0xcbdd('0x16')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4dedda,_0xcbdd('0x14'));_0x192e95(_0x4189be[_0xcbdd('0x19')][_0xcbdd('0x18')]);}})[_0xcbdd('0x1a')](function(_0x32e7af){logger[_0xcbdd('0x16')](_0xcbdd('0x13'),_0x4dedda,_0x32e7af);_0x4de8ff(_0x32e7af);});});}function respondWithResult(_0x2181e4,_0x5901e7){_0x5901e7=_0x5901e7||0xc8;return function(_0x3175af){if(_0x3175af){return _0x2181e4[_0xcbdd('0x1b')](_0x5901e7)[_0xcbdd('0x1c')](_0x3175af);}};}function respondWithFilteredResult(_0x10687d,_0x4bdc0c){return function(_0x2b4fa1){if(_0x2b4fa1){var _0x35b22d=typeof _0x4bdc0c['offset']===_0xcbdd('0x1d')&&typeof _0x4bdc0c['limit']===_0xcbdd('0x1d');var _0x266636=_0x2b4fa1[_0xcbdd('0x1e')];var _0x2693b1=_0x35b22d?0x0:_0x4bdc0c['offset'];var _0x564aa7=_0x35b22d?_0x2b4fa1['count']:_0x4bdc0c[_0xcbdd('0x1f')]+_0x4bdc0c['limit'];var _0x4e50d6;if(_0x564aa7>=_0x266636){_0x564aa7=_0x266636;_0x4e50d6=0xc8;}else{_0x4e50d6=0xce;}_0x10687d[_0xcbdd('0x1b')](_0x4e50d6);return _0x10687d[_0xcbdd('0x20')]('Content-Range',_0x2693b1+'-'+_0x564aa7+'/'+_0x266636)['json'](_0x2b4fa1);}return null;};}function saveUpdates(_0x202cfb){return function(_0x5d8b65){if(_0x5d8b65){return _0x5d8b65['update'](_0x202cfb)['then'](function(_0x871ce4){return _0x871ce4;});}return null;};}function removeEntity(_0x579a7d){return function(_0x3799d5){if(_0x3799d5){return _0x3799d5['destroy']()[_0xcbdd('0x11')](function(){_0x579a7d['status'](0xcc)[_0xcbdd('0x21')]();});}};}function handleEntityNotFound(_0x270104){return function(_0xc867c2){if(!_0xc867c2){_0x270104[_0xcbdd('0x22')](0x194);}return _0xc867c2;};}function handleError(_0x198c4e,_0x2d090d){_0x2d090d=_0x2d090d||0x1f4;return function(_0x5f3d9b){logger[_0xcbdd('0x16')](_0x5f3d9b[_0xcbdd('0x23')]);if(_0x5f3d9b[_0xcbdd('0x24')]){delete _0x5f3d9b[_0xcbdd('0x24')];}_0x198c4e[_0xcbdd('0x1b')](_0x2d090d)[_0xcbdd('0x25')](_0x5f3d9b);};}exports['index']=function(_0x414e1d,_0x816f46){var _0x96f255={},_0x2a5fcb={},_0xe43190={'count':0x0,'rows':[]};var _0x145923=_[_0xcbdd('0x26')](db[_0xcbdd('0x27')][_0xcbdd('0x28')],function(_0x2905b7){return{'name':_0x2905b7[_0xcbdd('0x29')],'type':_0x2905b7[_0xcbdd('0x2a')][_0xcbdd('0x2b')]};});_0x2a5fcb[_0xcbdd('0x2c')]=_[_0xcbdd('0x26')](_0x145923,_0xcbdd('0x24'));_0x2a5fcb[_0xcbdd('0x2d')]=_[_0xcbdd('0x2e')](_0x414e1d['query']);_0x2a5fcb['filters']=_['intersection'](_0x2a5fcb[_0xcbdd('0x2c')],_0x2a5fcb['query']);_0x96f255[_0xcbdd('0x2f')]=_[_0xcbdd('0x30')](_0x2a5fcb[_0xcbdd('0x2c')],qs[_0xcbdd('0x31')](_0x414e1d[_0xcbdd('0x2d')]['fields']));_0x96f255[_0xcbdd('0x2f')]=_0x96f255[_0xcbdd('0x2f')][_0xcbdd('0x32')]?_0x96f255[_0xcbdd('0x2f')]:_0x2a5fcb['model'];if(!_0x414e1d[_0xcbdd('0x2d')][_0xcbdd('0x33')]('nolimit')){_0x96f255[_0xcbdd('0x34')]=qs[_0xcbdd('0x34')](_0x414e1d[_0xcbdd('0x2d')][_0xcbdd('0x34')]);_0x96f255['offset']=qs[_0xcbdd('0x1f')](_0x414e1d['query']['offset']);}_0x96f255[_0xcbdd('0x35')]=qs[_0xcbdd('0x36')](_0x414e1d[_0xcbdd('0x2d')]['sort']);_0x96f255[_0xcbdd('0x37')]=qs[_0xcbdd('0x38')](_[_0xcbdd('0x39')](_0x414e1d[_0xcbdd('0x2d')],_0x2a5fcb[_0xcbdd('0x38')]),_0x145923);if(_0x414e1d[_0xcbdd('0x2d')][_0xcbdd('0x3a')]){_0x96f255[_0xcbdd('0x37')]=_[_0xcbdd('0x3b')](_0x96f255[_0xcbdd('0x37')],{'$or':_[_0xcbdd('0x26')](_0x145923,function(_0x12039d){if(_0x12039d['type']!==_0xcbdd('0x3c')){var _0x115a57={};_0x115a57[_0x12039d['name']]={'$like':'%'+_0x414e1d[_0xcbdd('0x2d')]['filter']+'%'};return _0x115a57;}})});}_0x96f255=_[_0xcbdd('0x3b')]({},_0x96f255,_0x414e1d[_0xcbdd('0x3d')]);var _0x419dce={'where':_0x96f255[_0xcbdd('0x37')]};return db[_0xcbdd('0x27')][_0xcbdd('0x1e')](_0x419dce)[_0xcbdd('0x11')](function(_0x5597ca){_0xe43190[_0xcbdd('0x1e')]=_0x5597ca;if(_0x414e1d[_0xcbdd('0x2d')][_0xcbdd('0x3e')]){_0x96f255[_0xcbdd('0x3f')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xcbdd('0x40')](_0x96f255);})[_0xcbdd('0x11')](function(_0x14971a){_0xe43190['rows']=_0x14971a;return _0xe43190;})[_0xcbdd('0x11')](respondWithFilteredResult(_0x816f46,_0x96f255))[_0xcbdd('0x1a')](handleError(_0x816f46,null));};exports[_0xcbdd('0x41')]=function(_0x223582,_0x3a93c6){var _0x47ce5d={'raw':!![],'where':{'id':_0x223582[_0xcbdd('0x42')]['id']}},_0x1d6449={};_0x1d6449['model']=_[_0xcbdd('0x2e')](db[_0xcbdd('0x27')][_0xcbdd('0x28')]);_0x1d6449[_0xcbdd('0x2d')]=_[_0xcbdd('0x2e')](_0x223582['query']);_0x1d6449[_0xcbdd('0x38')]=_[_0xcbdd('0x30')](_0x1d6449['model'],_0x1d6449[_0xcbdd('0x2d')]);_0x47ce5d[_0xcbdd('0x2f')]=_[_0xcbdd('0x30')](_0x1d6449[_0xcbdd('0x2c')],qs['fields'](_0x223582[_0xcbdd('0x2d')][_0xcbdd('0x31')]));_0x47ce5d['attributes']=_0x47ce5d['attributes'][_0xcbdd('0x32')]?_0x47ce5d[_0xcbdd('0x2f')]:_0x1d6449[_0xcbdd('0x2c')];if(_0x223582[_0xcbdd('0x2d')][_0xcbdd('0x3e')]){_0x47ce5d[_0xcbdd('0x3f')]=[{'all':!![]}];}_0x47ce5d=_[_0xcbdd('0x3b')]({},_0x47ce5d,_0x223582[_0xcbdd('0x3d')]);return db[_0xcbdd('0x27')][_0xcbdd('0x43')](_0x47ce5d)[_0xcbdd('0x11')](handleEntityNotFound(_0x3a93c6,null))['then'](respondWithResult(_0x3a93c6,null))[_0xcbdd('0x1a')](handleError(_0x3a93c6,null));};exports[_0xcbdd('0x44')]=function(_0x144337,_0x207605){return db['WhatsappMessage']['create'](_0x144337[_0xcbdd('0x45')],{})['then'](respondWithResult(_0x207605,0xc9))[_0xcbdd('0x1a')](handleError(_0x207605,null));};exports[_0xcbdd('0x46')]=function(_0x4e58f8,_0x376502){if(_0x4e58f8[_0xcbdd('0x45')]['id']){delete _0x4e58f8[_0xcbdd('0x45')]['id'];}return db[_0xcbdd('0x27')][_0xcbdd('0x43')]({'where':{'id':_0x4e58f8[_0xcbdd('0x42')]['id']}})[_0xcbdd('0x11')](handleEntityNotFound(_0x376502,null))['then'](saveUpdates(_0x4e58f8[_0xcbdd('0x45')],null))[_0xcbdd('0x11')](respondWithResult(_0x376502,null))[_0xcbdd('0x1a')](handleError(_0x376502,null));};exports['destroy']=function(_0x15997c,_0x22180d){return db[_0xcbdd('0x27')][_0xcbdd('0x43')]({'where':{'id':_0x15997c[_0xcbdd('0x42')]['id']}})[_0xcbdd('0x11')](handleEntityNotFound(_0x22180d,null))[_0xcbdd('0x11')](removeEntity(_0x22180d,null))[_0xcbdd('0x1a')](handleError(_0x22180d,null));};exports[_0xcbdd('0x47')]=function(_0x44cf07,_0x122ba3){return db['WhatsappMessage'][_0xcbdd('0x47')]()[_0xcbdd('0x11')](respondWithResult(_0x122ba3,null))[_0xcbdd('0x1a')](handleError(_0x122ba3,null));};exports[_0xcbdd('0x48')]=function(_0x5cd9f1,_0x17f918){var _0x5362f4=_0xcbdd('0x49');return interactionService[_0xcbdd('0x4a')](_0x5cd9f1,_0x5362f4)[_0xcbdd('0x11')](respondWithResult(_0x17f918,null))[_0xcbdd('0x1a')](handleError(_0x17f918,null));};exports[_0xcbdd('0x4b')]=function(_0x34251f,_0x28f4a5){var _0x38a453={'agent':{},'channel':_0xcbdd('0x49')};if(_0x34251f[_0xcbdd('0x45')]['id']){delete _0x34251f[_0xcbdd('0x45')]['id'];}_0x34251f[_0xcbdd('0x45')]['UserId']=_0x34251f[_0xcbdd('0x45')][_0xcbdd('0x4c')]||_0x34251f[_0xcbdd('0x4d')]['id'];_0x38a453['agent']['id']=_0x34251f['body'][_0xcbdd('0x4c')];return db['WhatsappMessage'][_0xcbdd('0x43')]({'where':{'id':_0x34251f['params']['id'],'UserId':null}})[_0xcbdd('0x11')](handleEntityNotFound(_0x28f4a5,null))[_0xcbdd('0x11')](function(_0x1ed404){if(_0x1ed404){_0x38a453[_0xcbdd('0x18')]=_0x1ed404['get']({'plain':!![]});return db[_0xcbdd('0x4e')][_0xcbdd('0x43')]({'where':{'id':_0x1ed404['WhatsappInteractionId']}});}return null;})[_0xcbdd('0x11')](handleEntityNotFound(_0x28f4a5,null))[_0xcbdd('0x11')](function(_0x57f3dd){if(_0x57f3dd){_0x38a453[_0xcbdd('0x4f')]=_0x57f3dd[_0xcbdd('0x50')]({'plain':!![]});interaction_log['info'](_0xcbdd('0x51'),_0x34251f[_0xcbdd('0x4d')]['id'],_0x34251f['user'][_0xcbdd('0x24')],_0x34251f[_0xcbdd('0x4d')][_0xcbdd('0x52')],_0x38a453[_0xcbdd('0x4f')]['id'],_0x34251f[_0xcbdd('0x45')]?JSON[_0xcbdd('0x53')](_0x34251f[_0xcbdd('0x45')]):_0xcbdd('0x54'));return respondWithRpcPromise(_0xcbdd('0x55'),_0xcbdd('0x56'),_0x38a453);}return null;})[_0xcbdd('0x11')](function(_0x1d768a){var _0x104ca7=_0xcbdd('0x57')+_0x1d768a[_0xcbdd('0x18')][_0xcbdd('0x58')];return db['sequelize'][_0xcbdd('0x2d')](_0x104ca7,{'type':db[_0xcbdd('0x59')][_0xcbdd('0x5a')][_0xcbdd('0x5b')],'raw':!![]})[_0xcbdd('0x11')](function(_0x2714d5){return _0x2714d5;});})[_0xcbdd('0x11')](function(_0x27505b){if(_0x27505b){_0x38a453[_0xcbdd('0x18')][_0xcbdd('0x5c')]=_0x27505b[0x0];if(!_0x34251f[_0xcbdd('0x45')][_0xcbdd('0x4c')])return;return db[_0xcbdd('0x5d')]['find']({'where':{'id':_0x34251f[_0xcbdd('0x45')][_0xcbdd('0x4c')],'role':_0xcbdd('0x5e')},'attributes':['id',_0xcbdd('0x24'),_0xcbdd('0x5f'),'email',_0xcbdd('0x60')],'raw':!![]});}return null;})[_0xcbdd('0x11')](function(_0x4713fc){if(!_0x4713fc)return null;_0x38a453[_0xcbdd('0x18')][_0xcbdd('0x5e')]=_0x4713fc;return _0x38a453;})[_0xcbdd('0x11')](function(_0x57e7ff){if(_0x57e7ff){_0x57e7ff[_0xcbdd('0x18')][_0xcbdd('0x61')]=util[_0xcbdd('0x62')](_0xcbdd('0x63'),_0x34251f[_0xcbdd('0x4d')][_0xcbdd('0x24')]);_0x57e7ff['message'][_0xcbdd('0x64')]=_0x38a453['channel'];_0x57e7ff[_0xcbdd('0x18')][_0xcbdd('0x65')]=_0x38a453[_0xcbdd('0x64')];_0x57e7ff[_0xcbdd('0x18')][_0xcbdd('0x66')]=_0xcbdd('0x4b');respondWithRpcPromise(_0xcbdd('0x67'),_0xcbdd('0x67'),{'event':_0xcbdd('0x68'),'message':_0x57e7ff[_0xcbdd('0x18')]},client9002);return _0x38a453;}return null;})[_0xcbdd('0x11')](respondWithResult(_0x28f4a5,null))[_0xcbdd('0x1a')](handleError(_0x28f4a5,null));};exports[_0xcbdd('0x1b')]=function(_0x314f13,_0x4eda5c){if(_0x314f13['body']['id']){delete _0x314f13[_0xcbdd('0x45')]['id'];}var _0x1df4b3;return db['WhatsappMessage'][_0xcbdd('0x43')]({'where':{'id':_0x314f13['params']['id']}})['then'](handleEntityNotFound(_0x4eda5c,null))[_0xcbdd('0x11')](function(_0x39a482){if(_0x39a482){_0x1df4b3=_0x39a482;return db[_0xcbdd('0x69')][_0xcbdd('0x43')]({'where':{'id':_0x39a482[_0xcbdd('0x6a')]}});}})['then'](handleEntityNotFound(_0x4eda5c,null))[_0xcbdd('0x11')](function(_0xd49016){if(_0xd49016){logger[_0xcbdd('0x6b')](_0xcbdd('0x6c'),'status',_0xcbdd('0x6d'),_0xd49016[_0xcbdd('0x2a')],util[_0xcbdd('0x6e')](_0x314f13[_0xcbdd('0x45')],{'showHidden':![],'depth':null}));switch(_0xd49016[_0xcbdd('0x2a')]){case _0xcbdd('0x6f'):if(_0x314f13[_0xcbdd('0x45')][_0xcbdd('0x70')]&&_0x314f13[_0xcbdd('0x45')]['MessageSid']===_0x1df4b3[_0xcbdd('0x71')]&&_0x314f13[_0xcbdd('0x45')][_0xcbdd('0x72')]&&_0x314f13['body'][_0xcbdd('0x72')]==='read'){return _0x1df4b3['update']({'read':!![]});}else{logger[_0xcbdd('0x16')](_0xcbdd('0x73'),_0xcbdd('0x1b'),_0xcbdd('0x6f'),util[_0xcbdd('0x6e')](_0x314f13[_0xcbdd('0x45')],{'showHidden':![],'depth':null}));}break;}return _0x1df4b3;}})[_0xcbdd('0x11')](respondWithResult(_0x4eda5c,null))[_0xcbdd('0x1a')](handleError(_0x4eda5c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b4f72a5..d962410 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 _0xed3c=['WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x334892,_0x17ddff){var _0x3bf7b1=function(_0x388077){while(--_0x388077){_0x334892['push'](_0x334892['shift']());}};_0x3bf7b1(++_0x17ddff);}(_0xed3c,0x1a6));var _0xced3=function(_0x24b78f,_0x22d90a){_0x24b78f=_0x24b78f-0x0;var _0x450887=_0xed3c[_0x24b78f];return _0x450887;};'use strict';var EventEmitter=require(_0xced3('0x0'));var WhatsappMessage=require(_0xced3('0x1'))['db'][_0xced3('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xced3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xced3('0x4'),'afterDestroy':_0xced3('0x5')};function emitEvent(_0x14488e){return function(_0x5f03e0,_0x51e500,_0x3d3aa0){WhatsappMessageEvents[_0xced3('0x6')](_0x14488e+':'+_0x5f03e0['id'],_0x5f03e0);WhatsappMessageEvents[_0xced3('0x6')](_0x14488e,_0x5f03e0);_0x3d3aa0(null);};}for(var e in events){if(events[_0xced3('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x2884=['exports','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x4c528a,_0x17f69d){var _0x31f8d7=function(_0x3a628d){while(--_0x3a628d){_0x4c528a['push'](_0x4c528a['shift']());}};_0x31f8d7(++_0x17f69d);}(_0x2884,0x1eb));var _0x4288=function(_0x19a5d8,_0x347207){_0x19a5d8=_0x19a5d8-0x0;var _0x30104a=_0x2884[_0x19a5d8];return _0x30104a;};'use strict';var EventEmitter=require(_0x4288('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x4288('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4288('0x2')](0x0);var events={'afterCreate':_0x4288('0x3'),'afterUpdate':'update','afterDestroy':_0x4288('0x4')};function emitEvent(_0x28ee27){return function(_0x50417e,_0x4b2323,_0x1ac6e7){WhatsappMessageEvents[_0x4288('0x5')](_0x28ee27+':'+_0x50417e['id'],_0x50417e);WhatsappMessageEvents[_0x4288('0x5')](_0x28ee27,_0x50417e);_0x1ac6e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x4288('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 2053af5..1a6fb0c 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 _0x8a30=['authToken','phone','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','/whatsapp/v1/','/messages/','text','application/json','statuses','message_id','catch','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','error','secret','WhatsappAccountId','type','twilio','accountSid'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8a30,0x1a1));var _0x08a3=function(_0x3f581f,_0x385fc8){_0x3f581f=_0x3f581f-0x0;var _0x96714c=_0x8a30[_0x3f581f];return _0x96714c;};'use strict';var _=require(_0x08a3('0x0'));var util=require(_0x08a3('0x1'));var logger=require('../../config/logger')(_0x08a3('0x2'));var moment=require(_0x08a3('0x3'));var BPromise=require(_0x08a3('0x4'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x08a3('0x5'));var rimraf=require(_0x08a3('0x6'));var config=require(_0x08a3('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x08a3('0x8')]=function(_0x5d969b,_0x472399){return _0x5d969b[_0x08a3('0x9')]('WhatsappMessage',attributes,{'tableName':_0x08a3('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x08a3('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0x08a3('0xc')],'type':_0x08a3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x13c6ed,_0x53eb13,_0x19e12b){var _0x2ec9bd=_0x5d969b[_0x08a3('0xe')];var _0x3a83cd=_0x13c6ed[_0x08a3('0xf')]({'plain':!![]});if(_0x3a83cd[_0x08a3('0x10')]['toLowerCase']()==='in'||_0x3a83cd['direction'][_0x08a3('0x11')]()==='out'&&!_0x3a83cd['secret']&&!_[_0x08a3('0x12')](_0x3a83cd[_0x08a3('0x13')])){_0x2ec9bd['WhatsappInteraction'][_0x08a3('0x14')]({'where':{'id':_0x3a83cd[_0x08a3('0x15')]}})[_0x08a3('0x16')](function(_0x39fad7){if(_0x39fad7){_0x39fad7[_0x08a3('0x17')]({'lastMsgAt':_0x3a83cd[_0x08a3('0x18')],'lastMsgDirection':_0x3a83cd[_0x08a3('0x10')][_0x08a3('0x11')]()});}})['catch'](function(_0x4074a0){console[_0x08a3('0x19')](_0x4074a0);});}if(_0x3a83cd[_0x08a3('0x10')]==='out'&&!_0x3a83cd[_0x08a3('0x1a')]){var _0x1ed571;_0x2ec9bd['WhatsappAccount']['find']({'where':{'id':_0x3a83cd[_0x08a3('0x1b')]},'raw':!![]})['then'](function(_0x30f960){_0x1ed571=_0x30f960;if(_0x1ed571&&_0x1ed571[_0x08a3('0x1c')]){switch(_0x1ed571[_0x08a3('0x1c')]){case _0x08a3('0x1d'):var _0x13b284=require(_0x08a3('0x1d'));if(_0x1ed571[_0x08a3('0x1e')]&&_0x1ed571[_0x08a3('0x1f')]&&_0x1ed571[_0x08a3('0x20')]){var _0x7c4e8b=new _0x13b284(_0x1ed571[_0x08a3('0x1e')],_0x1ed571[_0x08a3('0x1f')]);_0x7c4e8b['messages']['create']({'body':_0x3a83cd[_0x08a3('0xc')],'to':'whatsapp:'+_0x3a83cd['phone'],'from':_0x08a3('0x21')+_0x1ed571[_0x08a3('0x20')],'statusCallback':_0x1ed571[_0x08a3('0x22')]+_0x08a3('0x23')+_0x3a83cd['id']+_0x08a3('0x24')+_0x1ed571[_0x08a3('0x25')]})[_0x08a3('0x16')](function(_0xefac81){if(_0xefac81[_0x08a3('0x26')]){return _0x13c6ed[_0x08a3('0x17')]({'messageId':_0xefac81[_0x08a3('0x26')]});}})['catch'](function(_0x42931c){logger[_0x08a3('0x19')](_0x08a3('0x27'),_0x08a3('0x28'),'twilio',util[_0x08a3('0x29')](_0x42931c,{'showHidden':![],'depth':null}));});}else{logger[_0x08a3('0x19')](_0x08a3('0x27'),_0x08a3('0x28'),'twilio',_0x08a3('0x2a'));}break;case _0x08a3('0x2b'):var _0x2e88cd=_0x1ed571['accountSid'];var _0x350dab=_0x1ed571[_0x08a3('0x1f')];var _0x40099c=_0x1ed571[_0x08a3('0x2c')]+_0x08a3('0x2d')+_0x2e88cd+_0x08a3('0x2e');var _0x317f0e={'to':[_0x3a83cd[_0x08a3('0x20')]],'message':{'type':_0x08a3('0x2f'),'text':_0x3a83cd[_0x08a3('0xc')]}};var _0x459882={'method':'POST','uri':_0x40099c,'headers':{'Authorization':'Bearer\x20'+_0x350dab,'Content-Type':_0x08a3('0x30')},'body':_0x317f0e,'json':!![]};rp(_0x459882)[_0x08a3('0x16')](function(_0x5f4aa3){if(_0x5f4aa3[_0x08a3('0x31')][0x0][_0x08a3('0x32')]){return _0x13c6ed[_0x08a3('0x17')]({'messageId':_0x5f4aa3[_0x08a3('0x31')][0x0][_0x08a3('0x32')]});}})[_0x08a3('0x33')](function(_0xb2cb0d){logger[_0x08a3('0x34')](_0x08a3('0x35'),_0xb2cb0d);});break;}}})['finally'](function(){_0x19e12b();});}else{_0x19e12b();}}},'charset':_0x08a3('0x36'),'collate':_0x08a3('0x37')});}; \ No newline at end of file +var _0x3d25=['messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','lodash','util','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','models','direction','toLowerCase','secret','isNil','UserId','findOne','WhatsappInteractionId','update','createdAt','catch','out','WhatsappAccount','find','WhatsappAccountId','then','type','accountSid','authToken','phone'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x3d25,0xff));var _0x53d2=function(_0x11ced7,_0x29a8b0){_0x11ced7=_0x11ced7-0x0;var _0x4bed14=_0x3d25[_0x11ced7];return _0x4bed14;};'use strict';var _=require(_0x53d2('0x0'));var util=require(_0x53d2('0x1'));var logger=require('../../config/logger')(_0x53d2('0x2'));var moment=require(_0x53d2('0x3'));var BPromise=require('bluebird');var rp=require(_0x53d2('0x4'));var fetch=require(_0x53d2('0x5'));var fs=require('fs');var path=require(_0x53d2('0x6'));var rimraf=require(_0x53d2('0x7'));var config=require(_0x53d2('0x8'));var attributes=require(_0x53d2('0x9'));module['exports']=function(_0x7da5dc,_0x5cb333){return _0x7da5dc[_0x53d2('0xa')](_0x53d2('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x53d2('0xc'),'fields':[_0x53d2('0xc')]},{'name':_0x53d2('0xd'),'fields':[_0x53d2('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa30583,_0xcf414a,_0x520195){var _0xe6dab6=_0x7da5dc[_0x53d2('0xf')];var _0x3910cf=_0xa30583['get']({'plain':!![]});if(_0x3910cf[_0x53d2('0x10')]['toLowerCase']()==='in'||_0x3910cf[_0x53d2('0x10')][_0x53d2('0x11')]()==='out'&&!_0x3910cf[_0x53d2('0x12')]&&!_[_0x53d2('0x13')](_0x3910cf[_0x53d2('0x14')])){_0xe6dab6['WhatsappInteraction'][_0x53d2('0x15')]({'where':{'id':_0x3910cf[_0x53d2('0x16')]}})['then'](function(_0xd68e4b){if(_0xd68e4b){_0xd68e4b[_0x53d2('0x17')]({'lastMsgAt':_0x3910cf[_0x53d2('0x18')],'lastMsgDirection':_0x3910cf['direction'][_0x53d2('0x11')]()});}})[_0x53d2('0x19')](function(_0x1d3904){console['error'](_0x1d3904);});}if(_0x3910cf[_0x53d2('0x10')]===_0x53d2('0x1a')&&!_0x3910cf[_0x53d2('0x12')]){var _0x5d4fb2;_0xe6dab6[_0x53d2('0x1b')][_0x53d2('0x1c')]({'where':{'id':_0x3910cf[_0x53d2('0x1d')]},'raw':!![]})[_0x53d2('0x1e')](function(_0xc3df9c){_0x5d4fb2=_0xc3df9c;if(_0x5d4fb2&&_0x5d4fb2[_0x53d2('0x1f')]){switch(_0x5d4fb2[_0x53d2('0x1f')]){case'twilio':var _0x4a0109=require('twilio');if(_0x5d4fb2[_0x53d2('0x20')]&&_0x5d4fb2[_0x53d2('0x21')]&&_0x5d4fb2[_0x53d2('0x22')]){var _0x46e8c7=new _0x4a0109(_0x5d4fb2['accountSid'],_0x5d4fb2[_0x53d2('0x21')]);_0x46e8c7[_0x53d2('0x23')][_0x53d2('0x24')]({'body':_0x3910cf['body'],'to':_0x53d2('0x25')+_0x3910cf[_0x53d2('0x22')],'from':_0x53d2('0x25')+_0x5d4fb2['phone'],'statusCallback':_0x5d4fb2[_0x53d2('0x26')]+_0x53d2('0x27')+_0x3910cf['id']+_0x53d2('0x28')+_0x5d4fb2['token']})[_0x53d2('0x1e')](function(_0x4e8399){if(_0x4e8399[_0x53d2('0x29')]){return _0xa30583[_0x53d2('0x17')]({'messageId':_0x4e8399[_0x53d2('0x29')]});}})['catch'](function(_0x1d4860){logger[_0x53d2('0x2a')](_0x53d2('0x2b'),_0x53d2('0x2c'),_0x53d2('0x2d'),util[_0x53d2('0x2e')](_0x1d4860,{'showHidden':![],'depth':null}));});}else{logger[_0x53d2('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x53d2('0x2f'):var _0x4bd5b5=_0x5d4fb2[_0x53d2('0x20')];var _0x3e04b3=_0x5d4fb2['authToken'];var _0x428023=_0x5d4fb2[_0x53d2('0x30')]+_0x53d2('0x31')+_0x4bd5b5+_0x53d2('0x32');var _0x232a2a={'to':[_0x3910cf[_0x53d2('0x22')]],'message':{'type':'text','text':_0x3910cf[_0x53d2('0xe')]}};var _0x574170={'method':_0x53d2('0x33'),'uri':_0x428023,'headers':{'Authorization':'Bearer\x20'+_0x3e04b3,'Content-Type':_0x53d2('0x34')},'body':_0x232a2a,'json':!![]};rp(_0x574170)[_0x53d2('0x1e')](function(_0x4cce2f){if(_0x4cce2f[_0x53d2('0x35')][0x0]['message_id']){return _0xa30583['update']({'messageId':_0x4cce2f['statuses'][0x0][_0x53d2('0x36')]});}})[_0x53d2('0x19')](function(_0x594f71){logger[_0x53d2('0x37')](_0x53d2('0x38'),_0x594f71);});break;}}})[_0x53d2('0x39')](function(){_0x520195();});}else{_0x520195();}}},'charset':'utf8mb4','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 e7dbc28..e063a03 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 _0xaff0=['./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','options','raw','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x55ba18,_0x572a1a){var _0x325b07=function(_0x1c02b2){while(--_0x1c02b2){_0x55ba18['push'](_0x55ba18['shift']());}};_0x325b07(++_0x572a1a);}(_0xaff0,0x75));var _0x0aff=function(_0x3a20d4,_0x52ec2b){_0x3a20d4=_0x3a20d4-0x0;var _0x2d7941=_0xaff0[_0x3a20d4];return _0x2d7941;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0aff('0x0'));var BPromise=require(_0x0aff('0x1'));var rs=require(_0x0aff('0x2'));var fs=require('fs');var Redis=require(_0x0aff('0x3'));var db=require(_0x0aff('0x4'))['db'];var utils=require(_0x0aff('0x5'));var logger=require('../../config/logger')(_0x0aff('0x6'));var config=require(_0x0aff('0x7'));var jayson=require(_0x0aff('0x8'));var client=jayson[_0x0aff('0x9')][_0x0aff('0xa')]({'port':0x232a});config['redis']=_[_0x0aff('0xb')](config[_0x0aff('0xc')],{'host':_0x0aff('0xd'),'port':0x18eb});var socket=require(_0x0aff('0xe'))(new Redis(config[_0x0aff('0xc')]));require(_0x0aff('0xf'))[_0x0aff('0x10')](socket);function respondWithRpcPromise(_0x5a3373,_0x35ff1d,_0x43ab5b){return new BPromise(function(_0x440ca6,_0x39e0f8){return client[_0x0aff('0x11')](_0x5a3373,_0x43ab5b)[_0x0aff('0x12')](function(_0x23a456){logger[_0x0aff('0x13')](_0x0aff('0x14'),_0x35ff1d,_0x0aff('0x15'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x35ff1d,_0x0aff('0x15'),JSON[_0x0aff('0x16')](_0x23a456));if(_0x23a456[_0x0aff('0x17')]){if(_0x23a456[_0x0aff('0x17')][_0x0aff('0x18')]===0x1f4){logger[_0x0aff('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x35ff1d,_0x23a456[_0x0aff('0x17')][_0x0aff('0x19')]);return _0x39e0f8(_0x23a456[_0x0aff('0x17')][_0x0aff('0x19')]);}logger['error'](_0x0aff('0x14'),_0x35ff1d,_0x23a456['error'][_0x0aff('0x19')]);return _0x440ca6(_0x23a456[_0x0aff('0x17')][_0x0aff('0x19')]);}else{logger[_0x0aff('0x13')](_0x0aff('0x14'),_0x35ff1d,'request\x20sent');_0x440ca6(_0x23a456[_0x0aff('0x1a')][_0x0aff('0x19')]);}})[_0x0aff('0x1b')](function(_0x187343){logger[_0x0aff('0x17')](_0x0aff('0x14'),_0x35ff1d,_0x187343);_0x39e0f8(_0x187343);});});}exports[_0x0aff('0x1c')]=function(_0x50da9a){var _0xb184ba=this;return new Promise(function(_0x4d4885,_0x23b517){return db['WhatsappMessage'][_0x0aff('0x1d')](_0x50da9a['body'],{'raw':_0x50da9a[_0x0aff('0x1e')]?_0x50da9a[_0x0aff('0x1e')][_0x0aff('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x331c6f){logger['info'](_0x0aff('0x1c'),_0x50da9a);logger[_0x0aff('0x20')](_0x0aff('0x1c'),_0x50da9a,JSON[_0x0aff('0x16')](_0x331c6f));_0x4d4885(_0x331c6f);})['catch'](function(_0x522951){logger[_0x0aff('0x17')]('CreateWhatsappMessage',_0x522951[_0x0aff('0x19')],_0x50da9a);_0x23b517(_0xb184ba[_0x0aff('0x17')](0x1f4,_0x522951[_0x0aff('0x19')]));});});}; \ No newline at end of file +var _0xd449=['socket.io-emitter','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','lodash','util','bluebird','randomstring','../../config/logger','rpc','http','redis','defaults'];(function(_0x2dd615,_0x18099c){var _0x5255a4=function(_0x3f4c54){while(--_0x3f4c54){_0x2dd615['push'](_0x2dd615['shift']());}};_0x5255a4(++_0x18099c);}(_0xd449,0xbb));var _0x9d44=function(_0x32b3c2,_0xe56fd){_0x32b3c2=_0x32b3c2-0x0;var _0x40a313=_0xd449[_0x32b3c2];return _0x40a313;};'use strict';var _=require(_0x9d44('0x0'));var util=require(_0x9d44('0x1'));var moment=require('moment');var BPromise=require(_0x9d44('0x2'));var rs=require(_0x9d44('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9d44('0x4'))(_0x9d44('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9d44('0x6')]({'port':0x232a});config[_0x9d44('0x7')]=_[_0x9d44('0x8')](config[_0x9d44('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d44('0x9'))(new Redis(config[_0x9d44('0x7')]));require('./whatsappMessage.socket')[_0x9d44('0xa')](socket);function respondWithRpcPromise(_0x4cdfb0,_0x5b3c61,_0x5e6053){return new BPromise(function(_0x6ddbb9,_0x2af143){return client[_0x9d44('0xb')](_0x4cdfb0,_0x5e6053)['then'](function(_0x1d10bc){logger[_0x9d44('0xc')](_0x9d44('0xd'),_0x5b3c61,_0x9d44('0xe'));logger[_0x9d44('0xf')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5b3c61,_0x9d44('0xe'),JSON[_0x9d44('0x10')](_0x1d10bc));if(_0x1d10bc['error']){if(_0x1d10bc[_0x9d44('0x11')][_0x9d44('0x12')]===0x1f4){logger[_0x9d44('0x11')](_0x9d44('0xd'),_0x5b3c61,_0x1d10bc[_0x9d44('0x11')][_0x9d44('0x13')]);return _0x2af143(_0x1d10bc[_0x9d44('0x11')][_0x9d44('0x13')]);}logger[_0x9d44('0x11')](_0x9d44('0xd'),_0x5b3c61,_0x1d10bc[_0x9d44('0x11')]['message']);return _0x6ddbb9(_0x1d10bc[_0x9d44('0x11')][_0x9d44('0x13')]);}else{logger[_0x9d44('0xc')](_0x9d44('0xd'),_0x5b3c61,_0x9d44('0xe'));_0x6ddbb9(_0x1d10bc['result'][_0x9d44('0x13')]);}})[_0x9d44('0x14')](function(_0x106d08){logger['error'](_0x9d44('0xd'),_0x5b3c61,_0x106d08);_0x2af143(_0x106d08);});});}exports[_0x9d44('0x15')]=function(_0x3cf24c){var _0x5c322d=this;return new Promise(function(_0x545b40,_0x714166){return db[_0x9d44('0x16')][_0x9d44('0x17')](_0x3cf24c[_0x9d44('0x18')],{'raw':_0x3cf24c['options']?_0x3cf24c[_0x9d44('0x19')][_0x9d44('0x1a')]===undefined?!![]:![]:!![]})[_0x9d44('0x1b')](function(_0x3dc260){logger[_0x9d44('0xc')](_0x9d44('0x15'),_0x3cf24c);logger[_0x9d44('0xf')](_0x9d44('0x15'),_0x3cf24c,JSON[_0x9d44('0x10')](_0x3dc260));_0x545b40(_0x3dc260);})[_0x9d44('0x14')](function(_0x2accb9){logger[_0x9d44('0x11')](_0x9d44('0x15'),_0x2accb9[_0x9d44('0x13')],_0x3cf24c);_0x714166(_0x5c322d[_0x9d44('0x11')](0x1f4,_0x2accb9[_0x9d44('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index a2362d5..81b5bd8 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 _0x2729=['length','whatsappMessage:','./whatsappMessage.events','save','emit','removeListener','register'];(function(_0x37ad86,_0x64ac8d){var _0x287317=function(_0x38af35){while(--_0x38af35){_0x37ad86['push'](_0x37ad86['shift']());}};_0x287317(++_0x64ac8d);}(_0x2729,0xfe));var _0x9272=function(_0x568bc3,_0x237408){_0x568bc3=_0x568bc3-0x0;var _0x408c8c=_0x2729[_0x568bc3];return _0x408c8c;};'use strict';var WhatsappMessageEvents=require(_0x9272('0x0'));var events=[_0x9272('0x1'),'remove','update'];function createListener(_0x24cb6a,_0x2698d7){return function(_0x1f3fe2){_0x2698d7[_0x9272('0x2')](_0x24cb6a,_0x1f3fe2);};}function removeListener(_0x38cf4b,_0x8006b){return function(){WhatsappMessageEvents[_0x9272('0x3')](_0x38cf4b,_0x8006b);};}exports[_0x9272('0x4')]=function(_0x12195){for(var _0x4729ae=0x0,_0xc84fd7=events[_0x9272('0x5')];_0x4729ae<_0xc84fd7;_0x4729ae++){var _0x3f5fce=events[_0x4729ae];var _0x335887=createListener(_0x9272('0x6')+_0x3f5fce,_0x12195);WhatsappMessageEvents['on'](_0x3f5fce,_0x335887);}}; \ No newline at end of file +var _0x4540=['update','emit','removeListener','length','whatsappMessage:','save'];(function(_0x310cc8,_0x45f38c){var _0x956bb7=function(_0x4f3098){while(--_0x4f3098){_0x310cc8['push'](_0x310cc8['shift']());}};_0x956bb7(++_0x45f38c);}(_0x4540,0x107));var _0x0454=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4540[_0x14add3];return _0x4a174f;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x0454('0x0'),'remove',_0x0454('0x1')];function createListener(_0x2f3974,_0x36583d){return function(_0x34b400){_0x36583d[_0x0454('0x2')](_0x2f3974,_0x34b400);};}function removeListener(_0x290210,_0x34cf4a){return function(){WhatsappMessageEvents[_0x0454('0x3')](_0x290210,_0x34cf4a);};}exports['register']=function(_0x4dfd89){for(var _0x4322aa=0x0,_0x5a6fc5=events[_0x0454('0x4')];_0x4322aa<_0x5a6fc5;_0x4322aa++){var _0x4b322b=events[_0x4322aa];var _0x51f308=createListener(_0x0454('0x5')+_0x4b322b,_0x4dfd89);WhatsappMessageEvents['on'](_0x4b322b,_0x51f308);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 052cfeb..c166212 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 _0x9e1a=['describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3abcf2,_0xdcae2e){var _0x461740=function(_0x2ef96e){while(--_0x2ef96e){_0x3abcf2['push'](_0x3abcf2['shift']());}};_0x461740(++_0xdcae2e);}(_0x9e1a,0x120));var _0xa9e1=function(_0x2ffa83,_0x42905e){_0x2ffa83=_0x2ffa83-0x0;var _0x36127a=_0x9e1a[_0x2ffa83];return _0x36127a;};'use strict';var multer=require(_0xa9e1('0x0'));var util=require(_0xa9e1('0x1'));var path=require(_0xa9e1('0x2'));var timeout=require(_0xa9e1('0x3'));var express=require(_0xa9e1('0x4'));var router=express[_0xa9e1('0x5')]();var fs_extra=require(_0xa9e1('0x6'));var auth=require(_0xa9e1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa9e1('0x8'));var controller=require('./whatsappQueue.controller');router[_0xa9e1('0x9')]('/',auth[_0xa9e1('0xa')](),controller[_0xa9e1('0xb')]);router[_0xa9e1('0x9')]('/describe',auth[_0xa9e1('0xa')](),controller[_0xa9e1('0xc')]);router[_0xa9e1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa9e1('0xd')]);router['get'](_0xa9e1('0xe'),auth['isAuthenticated'](),controller[_0xa9e1('0xf')]);router[_0xa9e1('0x9')](_0xa9e1('0x10'),auth[_0xa9e1('0xa')](),controller[_0xa9e1('0x11')]);router[_0xa9e1('0x9')](_0xa9e1('0x12'),auth['isAuthenticated'](),controller[_0xa9e1('0x13')]);router['post']('/',auth[_0xa9e1('0xa')](),controller['create']);router[_0xa9e1('0x14')](_0xa9e1('0x10'),auth['isAuthenticated'](),controller[_0xa9e1('0x15')]);router['post']('/:id/users',auth[_0xa9e1('0xa')](),controller[_0xa9e1('0x16')]);router[_0xa9e1('0x17')](_0xa9e1('0x18'),auth[_0xa9e1('0xa')](),controller[_0xa9e1('0x19')]);router[_0xa9e1('0x1a')](_0xa9e1('0x18'),auth[_0xa9e1('0xa')](),controller[_0xa9e1('0x1b')]);router[_0xa9e1('0x1a')](_0xa9e1('0x10'),auth[_0xa9e1('0xa')](),controller[_0xa9e1('0x1c')]);router[_0xa9e1('0x1a')](_0xa9e1('0x12'),auth[_0xa9e1('0xa')](),controller['removeAgents']);module[_0xa9e1('0x1d')]=router; \ No newline at end of file +var _0x5078=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x31b357,_0x95b19){var _0x385eda=function(_0x4c668c){while(--_0x4c668c){_0x31b357['push'](_0x31b357['shift']());}};_0x385eda(++_0x95b19);}(_0x5078,0x148));var _0x8507=function(_0x2137c7,_0x1c2b5a){_0x2137c7=_0x2137c7-0x0;var _0x466a90=_0x5078[_0x2137c7];return _0x466a90;};'use strict';var multer=require(_0x8507('0x0'));var util=require(_0x8507('0x1'));var path=require(_0x8507('0x2'));var timeout=require(_0x8507('0x3'));var express=require(_0x8507('0x4'));var router=express[_0x8507('0x5')]();var fs_extra=require(_0x8507('0x6'));var auth=require(_0x8507('0x7'));var interaction=require(_0x8507('0x8'));var config=require(_0x8507('0x9'));var controller=require(_0x8507('0xa'));router[_0x8507('0xb')]('/',auth[_0x8507('0xc')](),controller[_0x8507('0xd')]);router[_0x8507('0xb')](_0x8507('0xe'),auth['isAuthenticated'](),controller[_0x8507('0xf')]);router[_0x8507('0xb')](_0x8507('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x8507('0xb')](_0x8507('0x11'),auth[_0x8507('0xc')](),controller[_0x8507('0x12')]);router[_0x8507('0xb')](_0x8507('0x13'),auth[_0x8507('0xc')](),controller['getTeams']);router[_0x8507('0xb')](_0x8507('0x14'),auth[_0x8507('0xc')](),controller[_0x8507('0x15')]);router[_0x8507('0x16')]('/',auth[_0x8507('0xc')](),controller['create']);router[_0x8507('0x16')](_0x8507('0x13'),auth[_0x8507('0xc')](),controller[_0x8507('0x17')]);router[_0x8507('0x16')](_0x8507('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0x8507('0x18')](_0x8507('0x10'),auth[_0x8507('0xc')](),controller['update']);router[_0x8507('0x19')](_0x8507('0x10'),auth[_0x8507('0xc')](),controller[_0x8507('0x1a')]);router[_0x8507('0x19')](_0x8507('0x13'),auth[_0x8507('0xc')](),controller[_0x8507('0x1b')]);router['delete']('/:id/users',auth[_0x8507('0xc')](),controller[_0x8507('0x1c')]);module[_0x8507('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 0ae0b3a..54781d0 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 _0x4876=['STRING','ENUM','beepall','roundrobin'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6487('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6487('0x1')]('rrmemory',_0x6487('0x2'),_0x6487('0x3'))},'description':{'type':Sequelize[_0x6487('0x0')]}}; \ No newline at end of file +var _0x0fec=['beepall','roundrobin','sequelize','exports','STRING','ENUM'];(function(_0x22ec12,_0x34135d){var _0x17affd=function(_0x40d4f5){while(--_0x40d4f5){_0x22ec12['push'](_0x22ec12['shift']());}};_0x17affd(++_0x34135d);}(_0x0fec,0x1ca));var _0xc0fe=function(_0xe59ef4,_0xecf768){_0xe59ef4=_0xe59ef4-0x0;var _0x19f66e=_0x0fec[_0xe59ef4];return _0x19f66e;};'use strict';var Sequelize=require(_0xc0fe('0x0'));module[_0xc0fe('0x1')]={'name':{'type':Sequelize[_0xc0fe('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc0fe('0x3')]('rrmemory',_0xc0fe('0x4'),_0xc0fe('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index d71f328..2b20c66 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 _0x391c=['findAll','rows','catch','show','params','model','rawAttributes','keys','filters','intersection','attributes','fields','length','merge','options','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappQueueId','filter','findAndCountAll','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','all','union','value','removeTeams','addAgents','omit','spread','removeAgents','isArray','userWhatsappQueue:remove','getAgents','findOne','bluebird','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','update','destroy','then','get','WhatsappQueues','UserProfileResource','end','error','name','map','WhatsappQueue','fieldName','type','key','getOptions','include','query'];(function(_0x2b3f42,_0x2af03f){var _0xe4ed76=function(_0x1b5965){while(--_0x1b5965){_0x2b3f42['push'](_0x2b3f42['shift']());}};_0xe4ed76(++_0x2af03f);}(_0x391c,0x13f));var _0xc391=function(_0x431601,_0x67380f){_0x431601=_0x431601-0x0;var _0x3fc609=_0x391c[_0x431601];return _0x3fc609;};'use strict';var BPromise=require(_0xc391('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xc391('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xc391('0x2'))('api');var config=require(_0xc391('0x3'));var db=require(_0xc391('0x4'))['db'];config[_0xc391('0x5')]=_[_0xc391('0x6')](config['redis'],{'host':_0xc391('0x7'),'port':0x18eb});var socket=require(_0xc391('0x8'))(new Redis(config[_0xc391('0x5')]));require(_0xc391('0x9'))[_0xc391('0xa')](socket);function respondWithStatusCode(_0x16f50c,_0x280269){_0x280269=_0x280269||0xcc;return function(_0x16f624){if(_0x16f624){return _0x16f50c[_0xc391('0xb')](_0x280269);}return _0x16f50c[_0xc391('0xc')](_0x280269)['end']();};}function respondWithResult(_0x2fcf69,_0x28c1b4){_0x28c1b4=_0x28c1b4||0xc8;return function(_0x14be7c){if(_0x14be7c){return _0x2fcf69[_0xc391('0xc')](_0x28c1b4)[_0xc391('0xd')](_0x14be7c);}};}function respondWithFilteredResult(_0x1251bf,_0x3a1b2a){return function(_0x2ce2d2){if(_0x2ce2d2){var _0x441e16=typeof _0x3a1b2a['offset']===_0xc391('0xe')&&typeof _0x3a1b2a[_0xc391('0xf')]==='undefined';var _0x2bc64a=_0x2ce2d2[_0xc391('0x10')];var _0x3b7ecd=_0x441e16?0x0:_0x3a1b2a[_0xc391('0x11')];var _0x4c4e5a=_0x441e16?_0x2ce2d2[_0xc391('0x10')]:_0x3a1b2a[_0xc391('0x11')]+_0x3a1b2a[_0xc391('0xf')];var _0x1db129;if(_0x4c4e5a>=_0x2bc64a){_0x4c4e5a=_0x2bc64a;_0x1db129=0xc8;}else{_0x1db129=0xce;}_0x1251bf[_0xc391('0xc')](_0x1db129);return _0x1251bf['set']('Content-Range',_0x3b7ecd+'-'+_0x4c4e5a+'/'+_0x2bc64a)[_0xc391('0xd')](_0x2ce2d2);}return null;};}function saveUpdates(_0x263344){return function(_0xaa2142){if(_0xaa2142){return _0xaa2142[_0xc391('0x12')](_0x263344)['then'](function(_0x10207b){return _0x10207b;});}return null;};}function removeEntity(_0x378443){return function(_0x433c3f){if(_0x433c3f){return _0x433c3f[_0xc391('0x13')]()[_0xc391('0x14')](function(){var _0x4c25d0=_0x433c3f[_0xc391('0x15')]({'plain':!![]});var _0x4198bb=_0xc391('0x16');return db[_0xc391('0x17')]['destroy']({'where':{'type':_0x4198bb,'resourceId':_0x4c25d0['id']}})['then'](function(){return _0x433c3f;});})[_0xc391('0x14')](function(){_0x378443[_0xc391('0xc')](0xcc)[_0xc391('0x18')]();});}};}function handleEntityNotFound(_0x408a0f){return function(_0x21c66f){if(!_0x21c66f){_0x408a0f[_0xc391('0xb')](0x194);}return _0x21c66f;};}function handleError(_0x3b1971,_0x44ff28){_0x44ff28=_0x44ff28||0x1f4;return function(_0x569ea7){logger[_0xc391('0x19')](_0x569ea7['stack']);if(_0x569ea7['name']){delete _0x569ea7[_0xc391('0x1a')];}_0x3b1971[_0xc391('0xc')](_0x44ff28)['send'](_0x569ea7);};}exports['index']=function(_0x17d7bb,_0x2f31a1){var _0x2a78ed={};var _0x3e45ff={'count':0x0,'rows':[]};var _0x1627c9=_[_0xc391('0x1b')](db[_0xc391('0x1c')]['rawAttributes'],function(_0x1817a6){return{'name':_0x1817a6[_0xc391('0x1d')],'type':_0x1817a6[_0xc391('0x1e')][_0xc391('0x1f')]};});_0x2a78ed=qs[_0xc391('0x20')](_0x1627c9,_0x17d7bb);var _0x30f21c={'where':_0x2a78ed['where']};return db['WhatsappQueue'][_0xc391('0x10')](_0x30f21c)[_0xc391('0x14')](function(_0x4ea2b6){_0x3e45ff['count']=_0x4ea2b6;_0x2a78ed['include']=qs[_0xc391('0x21')](_0x17d7bb[_0xc391('0x22')]);return db[_0xc391('0x1c')][_0xc391('0x23')](_0x2a78ed);})['then'](function(_0x3fca79){_0x3e45ff[_0xc391('0x24')]=_0x3fca79;return _0x3e45ff;})['then'](respondWithFilteredResult(_0x2f31a1,_0x2a78ed))[_0xc391('0x25')](handleError(_0x2f31a1,null));};exports[_0xc391('0x26')]=function(_0x44c15c,_0xb56ae4){var _0x2aceae={'raw':!![],'where':{'id':_0x44c15c[_0xc391('0x27')]['id']}},_0x3ec8ea={};_0x3ec8ea[_0xc391('0x28')]=_['keys'](db['WhatsappQueue'][_0xc391('0x29')]);_0x3ec8ea['query']=_[_0xc391('0x2a')](_0x44c15c[_0xc391('0x22')]);_0x3ec8ea[_0xc391('0x2b')]=_[_0xc391('0x2c')](_0x3ec8ea[_0xc391('0x28')],_0x3ec8ea[_0xc391('0x22')]);_0x2aceae[_0xc391('0x2d')]=_['intersection'](_0x3ec8ea[_0xc391('0x28')],qs[_0xc391('0x2e')](_0x44c15c[_0xc391('0x22')]['fields']));_0x2aceae['attributes']=_0x2aceae[_0xc391('0x2d')][_0xc391('0x2f')]?_0x2aceae['attributes']:_0x3ec8ea[_0xc391('0x28')];if(_0x44c15c[_0xc391('0x22')]['includeAll']){_0x2aceae[_0xc391('0x21')]=[{'all':!![]}];}_0x2aceae=_[_0xc391('0x30')]({},_0x2aceae,_0x44c15c[_0xc391('0x31')]);return db[_0xc391('0x1c')][_0xc391('0x32')](_0x2aceae)[_0xc391('0x14')](handleEntityNotFound(_0xb56ae4,null))[_0xc391('0x14')](respondWithResult(_0xb56ae4,null))[_0xc391('0x25')](handleError(_0xb56ae4,null));};exports['create']=function(_0x359799,_0x489b35){return db['WhatsappQueue']['create'](_0x359799['body'],{})['then'](function(_0x543734){var _0x5e31ad=_0x359799['user'][_0xc391('0x15')]({'plain':!![]});if(!_0x5e31ad)throw new Error(_0xc391('0x33'));if(_0x5e31ad[_0xc391('0x34')]==='user'){var _0x58e780=_0x543734['get']({'plain':!![]});var _0x2793c3='WhatsappQueues';return db[_0xc391('0x35')][_0xc391('0x32')]({'where':{'name':_0x2793c3,'userProfileId':_0x5e31ad[_0xc391('0x36')]},'raw':!![]})[_0xc391('0x14')](function(_0x511ce2){if(_0x511ce2&&_0x511ce2[_0xc391('0x37')]===0x0){return db[_0xc391('0x17')][_0xc391('0x38')]({'name':_0x58e780['name'],'resourceId':_0x58e780['id'],'type':_0x511ce2[_0xc391('0x1a')],'sectionId':_0x511ce2['id']},{})[_0xc391('0x14')](function(){return _0x543734;});}else{return _0x543734;}})[_0xc391('0x25')](function(_0x1dcc82){logger[_0xc391('0x19')](_0xc391('0x39'),_0x1dcc82);throw _0x1dcc82;});}return _0x543734;})[_0xc391('0x14')](respondWithResult(_0x489b35,0xc9))[_0xc391('0x25')](handleError(_0x489b35,null));};exports[_0xc391('0x12')]=function(_0x29f249,_0x1bbeaa){if(_0x29f249['body']['id']){delete _0x29f249[_0xc391('0x3a')]['id'];}return db[_0xc391('0x1c')][_0xc391('0x32')]({'where':{'id':_0x29f249['params']['id']}})[_0xc391('0x14')](handleEntityNotFound(_0x1bbeaa,null))[_0xc391('0x14')](saveUpdates(_0x29f249['body'],null))[_0xc391('0x14')](respondWithResult(_0x1bbeaa,null))[_0xc391('0x25')](handleError(_0x1bbeaa,null));};exports[_0xc391('0x13')]=function(_0x307aa7,_0x2a9ac1){return db[_0xc391('0x1c')][_0xc391('0x32')]({'where':{'id':_0x307aa7[_0xc391('0x27')]['id']}})[_0xc391('0x14')](handleEntityNotFound(_0x2a9ac1,null))[_0xc391('0x14')](removeEntity(_0x2a9ac1,null))[_0xc391('0x25')](handleError(_0x2a9ac1,null));};exports[_0xc391('0x3b')]=function(_0xea012,_0x474706){return db[_0xc391('0x1c')][_0xc391('0x3b')]()[_0xc391('0x14')](respondWithResult(_0x474706,null))['catch'](handleError(_0x474706,null));};exports['getMembers']=function(_0xb9f737,_0x2be7e6){var _0x32433c={'raw':!![],'where':{}},_0x4575f8={},_0x141d30;return db[_0xc391('0x1c')]['findOne']({'where':{'id':_0xb9f737[_0xc391('0x27')]['id']}})[_0xc391('0x14')](handleEntityNotFound(_0x2be7e6,null))[_0xc391('0x14')](function(_0x4a0a9a){if(_0x4a0a9a){_0x141d30=_0x4a0a9a[_0xc391('0x15')]({'plain':!![]});_0x4575f8['model']=_[_0xc391('0x2a')](db[_0xc391('0x3c')]['rawAttributes']);_0x4575f8[_0xc391('0x22')]=_[_0xc391('0x2a')](_0xb9f737[_0xc391('0x22')]);_0x4575f8[_0xc391('0x2b')]=_['intersection'](_0x4575f8['model'],_0x4575f8[_0xc391('0x22')]);_0x32433c[_0xc391('0x2d')]=_[_0xc391('0x2c')](_0x4575f8['model'],qs[_0xc391('0x2e')](_0xb9f737[_0xc391('0x22')][_0xc391('0x2e')]));_0x32433c[_0xc391('0x2d')]=_0x32433c[_0xc391('0x2d')]['length']?_0x32433c[_0xc391('0x2d')]:_0x4575f8[_0xc391('0x28')];if(!_0xb9f737[_0xc391('0x22')][_0xc391('0x3d')](_0xc391('0x3e'))){_0x32433c[_0xc391('0xf')]=qs[_0xc391('0xf')](_0xb9f737[_0xc391('0x22')][_0xc391('0xf')]);_0x32433c['offset']=qs[_0xc391('0x11')](_0xb9f737[_0xc391('0x22')][_0xc391('0x11')]);}_0x32433c[_0xc391('0x3f')]=qs[_0xc391('0x40')](_0xb9f737[_0xc391('0x22')][_0xc391('0x40')]);_0x32433c[_0xc391('0x41')]=qs['filters'](_[_0xc391('0x42')](_0xb9f737['query'],_0x4575f8['filters']));_0x32433c['where'][_0xc391('0x43')]=_0x4a0a9a['id'];if(_0xb9f737[_0xc391('0x22')][_0xc391('0x44')]){_0x32433c['where']=_[_0xc391('0x30')](_0x32433c[_0xc391('0x41')],{'$or':_[_0xc391('0x1b')](_0x32433c[_0xc391('0x2d')],function(_0x42362b){var _0x132067={};_0x132067[_0x42362b]={'$like':'%'+_0xb9f737[_0xc391('0x22')][_0xc391('0x44')]+'%'};return _0x132067;})});}_0x32433c=_['merge']({},_0x32433c,_0xb9f737[_0xc391('0x31')]);return db[_0xc391('0x3c')][_0xc391('0x23')](_0x32433c);}})['then'](function(_0x3c63db){if(_0x3c63db){return db['User'][_0xc391('0x45')]({'where':{'id':_[_0xc391('0x1b')](_0x3c63db,'UserId'),'role':_0xc391('0x46')},'attributes':['id',_0xc391('0x1a'),_0xc391('0x47'),_0xc391('0x48'),'createdAt']});}})[_0xc391('0x14')](function(_0x6c1c33){if(_0x6c1c33){return{'count':_0x6c1c33[_0xc391('0x10')],'rows':_[_0xc391('0x1b')](_0x6c1c33[_0xc391('0x24')],function(_0x2fb519){return{'membername':_0x2fb519[_0xc391('0x1a')],'UserId':_0x2fb519['id'],'queue_name':_0x141d30[_0xc391('0x1a')],'WhatsappQueueId':_0x141d30['id'],'interface':util[_0xc391('0x49')](_0xc391('0x4a'),_0xc391('0x4b'),_0x2fb519['name']),'penalty':0x0,'paused':_0x2fb519[_0xc391('0x47')],'createdAt':_0x2fb519[_0xc391('0x4c')],'updatedAt':_0x2fb519[_0xc391('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc391('0x14')](respondWithFilteredResult(_0x2be7e6,_0x32433c))['catch'](handleError(_0x2be7e6,null));};exports[_0xc391('0x4d')]=function(_0x418260,_0x76f163){var _0x495833={};var _0x494068={};var _0x68b90b;var _0x4a90fb;return db[_0xc391('0x1c')]['findOne']({'where':{'id':_0x418260['params']['id']}})[_0xc391('0x14')](handleEntityNotFound(_0x76f163,null))[_0xc391('0x14')](function(_0x5aef88){if(_0x5aef88){_0x68b90b=_0x5aef88;_0x494068['model']=_[_0xc391('0x2a')](db[_0xc391('0x4e')][_0xc391('0x29')]);_0x494068[_0xc391('0x22')]=_[_0xc391('0x2a')](_0x418260[_0xc391('0x22')]);_0x494068[_0xc391('0x2b')]=_[_0xc391('0x2c')](_0x494068[_0xc391('0x28')],_0x494068['query']);_0x495833[_0xc391('0x2d')]=_[_0xc391('0x2c')](_0x494068['model'],qs[_0xc391('0x2e')](_0x418260[_0xc391('0x22')][_0xc391('0x2e')]));_0x495833[_0xc391('0x2d')]=_0x495833[_0xc391('0x2d')][_0xc391('0x2f')]?_0x495833[_0xc391('0x2d')]:_0x494068[_0xc391('0x28')];_0x495833['order']=qs['sort'](_0x418260[_0xc391('0x22')][_0xc391('0x40')]);_0x495833['where']=qs['filters'](_[_0xc391('0x42')](_0x418260[_0xc391('0x22')],_0x494068[_0xc391('0x2b')]));if(_0x418260[_0xc391('0x22')][_0xc391('0x44')]){_0x495833[_0xc391('0x41')]=_[_0xc391('0x30')](_0x495833[_0xc391('0x41')],{'$or':_['map'](_0x495833['attributes'],function(_0x55bae7){var _0xf52fb={};_0xf52fb[_0x55bae7]={'$like':'%'+_0x418260[_0xc391('0x22')][_0xc391('0x44')]+'%'};return _0xf52fb;})});}_0x495833=_[_0xc391('0x30')]({},_0x495833,_0x418260['options']);return _0x68b90b[_0xc391('0x4d')](_0x495833);}})[_0xc391('0x14')](function(_0x1a309e){if(_0x1a309e){_0x4a90fb=_0x1a309e['length'];if(!_0x418260['query'][_0xc391('0x3d')](_0xc391('0x3e'))){_0x495833[_0xc391('0xf')]=qs[_0xc391('0xf')](_0x418260[_0xc391('0x22')][_0xc391('0xf')]);_0x495833[_0xc391('0x11')]=qs[_0xc391('0x11')](_0x418260[_0xc391('0x22')][_0xc391('0x11')]);}return _0x68b90b[_0xc391('0x4d')](_0x495833);}})[_0xc391('0x14')](function(_0x4a4fac){if(_0x4a4fac){return _0x4a4fac?{'count':_0x4a90fb,'rows':_0x4a4fac}:null;}})['then'](respondWithResult(_0x76f163,null))[_0xc391('0x25')](handleError(_0x76f163,null));};exports[_0xc391('0x4f')]=function(_0x4acd57,_0x4d4da1){var _0x3a2991=_0x4acd57[_0xc391('0x3a')][_0xc391('0x50')];return db[_0xc391('0x4e')]['findAll']({'where':{'id':_0x3a2991},'attributes':['id'],'include':[{'model':db[_0xc391('0x51')],'as':_0xc391('0x52'),'attributes':['id',_0xc391('0x1a'),_0xc391('0x53'),_0xc391('0x54'),'interface'],'raw':!![]}]})[_0xc391('0x14')](function(_0xf5275d){if(_0xf5275d){var _0x52b9f6=_[_0xc391('0x55')](_0xf5275d,function(_0x5055fb){var _0x9eacf5=_0x5055fb[_0xc391('0x15')]({'plain':!![]});return _0x9eacf5[_0xc391('0x52')];});return db[_0xc391('0x1c')]['find']({'where':{'id':_0x4acd57[_0xc391('0x27')]['id']}})['then'](function(_0x4e5c46){return db[_0xc391('0x56')][_0xc391('0x57')](function(_0x2b1ef9){return _0x4e5c46['addTeams'](_0x3a2991,{'transaction':_0x2b1ef9})['then'](function(){return BPromise[_0xc391('0x58')](_0x52b9f6,function(_0xaf1185){return db[_0xc391('0x3c')][_0xc391('0x59')]({'where':{'UserId':_0xaf1185['id'],'WhatsappQueueId':_0x4acd57[_0xc391('0x27')]['id']},'transaction':_0x2b1ef9});});})['then'](function(){_0x52b9f6[_0xc391('0x5a')](function(_0x45f6a2){socket[_0xc391('0x5b')](_0xc391('0x5c'),{'UserId':_0x45f6a2['id'],'WhatsappQueueId':_0x4e5c46['id']});});});});});}})[_0xc391('0x14')](respondWithStatusCode(_0x4d4da1,null))[_0xc391('0x25')](handleError(_0x4d4da1,null));};exports['removeTeams']=function(_0x972b7e,_0x2f9559){return db['Team']['findAll']({'where':{'id':_0x972b7e[_0xc391('0x22')][_0xc391('0x50')]},'attributes':['id'],'include':[{'model':db[_0xc391('0x51')],'as':_0xc391('0x52'),'attributes':['id'],'raw':!![]}]})[_0xc391('0x14')](handleEntityNotFound(_0x2f9559,null))[_0xc391('0x14')](function(_0x2c4ae3){var _0x1e2484=_['map'](_0x2c4ae3,'id');var _0x2f64b2=[];var _0x30ca0e=[];var _0x57780a=squel['select']();_0x57780a[_0xc391('0x5d')](_0xc391('0x5e'))['from'](_0xc391('0x5f'),'tq')[_0xc391('0x60')](_0xc391('0x61'),'ut',_0xc391('0x62'))[_0xc391('0x41')](_0xc391('0x63'),_0x972b7e[_0xc391('0x27')]['id']);for(var _0x49a66e=0x0;_0x49a66e<_0x2c4ae3[_0xc391('0x2f')];_0x49a66e+=0x1){let _0x5e55dc=_0x2c4ae3[_0x49a66e];for(var _0x2deb4e=0x0;_0x2deb4e<_0x5e55dc['Agents'][_0xc391('0x2f')];_0x2deb4e+=0x1){let _0x241f29=_0x5e55dc[_0xc391('0x52')][_0x2deb4e];var _0x837b1=_0x57780a[_0xc391('0x64')]();_0x837b1[_0xc391('0x41')](_0xc391('0x65'),_0x241f29['id']);_0x30ca0e['push'](db[_0xc391('0x56')]['query'](_0x837b1[_0xc391('0x66')](),{'type':db[_0xc391('0x56')][_0xc391('0x67')][_0xc391('0x68')]})[_0xc391('0x14')](function(_0x2dfc2f){if(_0x2dfc2f['length']===0x1){return _0x241f29['id'];}else{var _0x5cde2b=_[_0xc391('0x69')](_[_0xc391('0x1b')](_0x2dfc2f,'TeamId'),function(_0x1d43a7){return _['includes'](_0x1e2484,_0x1d43a7);});if(_0x5cde2b){return _0x241f29['id'];}}}));}}return BPromise[_0xc391('0x6a')](_0x30ca0e)['then'](function(_0x2a2157){_0x2f64b2=_(_0x2f64b2)[_0xc391('0x6b')](_0x2a2157)['compact']()[_0xc391('0x6c')]();return db[_0xc391('0x1c')]['find']({'where':{'id':_0x972b7e[_0xc391('0x27')]['id']}})[_0xc391('0x14')](function(_0x210b5e){return db[_0xc391('0x56')]['transaction'](function(_0x3039d4){return _0x210b5e[_0xc391('0x6d')](_0x972b7e[_0xc391('0x22')]['ids'],{'transaction':_0x3039d4})[_0xc391('0x14')](function(){if(!_['isEmpty'](_0x2f64b2)){return _0x210b5e['removeAgents'](_0x2f64b2,{'transaction':_0x3039d4});}})[_0xc391('0x14')](function(){_0x2f64b2[_0xc391('0x5a')](function(_0xe17db7){socket['emit']('userWhatsappQueue:remove',{'UserId':_0xe17db7,'WhatsappQueueId':_0x210b5e['id']});});});});});});})[_0xc391('0x14')](respondWithStatusCode(_0x2f9559,null))[_0xc391('0x25')](handleError(_0x2f9559,null));};exports[_0xc391('0x6e')]=function(_0x533188,_0x4dbaf5){return db[_0xc391('0x1c')][_0xc391('0x32')]({'where':{'id':_0x533188[_0xc391('0x27')]['id']}})[_0xc391('0x14')](handleEntityNotFound(_0x4dbaf5,null))[_0xc391('0x14')](function(_0x518b88){if(_0x518b88){return _0x518b88[_0xc391('0x6e')](_0x533188[_0xc391('0x3a')][_0xc391('0x50')],_[_0xc391('0x6f')](_0x533188['body'],[_0xc391('0x50'),'id'])||{})[_0xc391('0x70')](function(_0x1816af){for(var _0x120e91=0x0;_0x120e91<_0x533188[_0xc391('0x3a')][_0xc391('0x50')][_0xc391('0x2f')];_0x120e91+=0x1){socket[_0xc391('0x5b')]('userWhatsappQueue:save',{'UserId':Number(_0x533188[_0xc391('0x3a')][_0xc391('0x50')][_0x120e91]),'WhatsappQueueId':Number(_0x533188[_0xc391('0x27')]['id'])});}return _0x1816af;});}})[_0xc391('0x14')](respondWithResult(_0x4dbaf5,null))[_0xc391('0x25')](handleError(_0x4dbaf5,null));};exports[_0xc391('0x71')]=function(_0x3f6728,_0x1f783e){return db[_0xc391('0x1c')][_0xc391('0x32')]({'where':{'id':_0x3f6728['params']['id']}})[_0xc391('0x14')](handleEntityNotFound(_0x1f783e,null))[_0xc391('0x14')](function(_0x4e2384){if(_0x4e2384){return _0x4e2384[_0xc391('0x71')](_0x3f6728[_0xc391('0x22')][_0xc391('0x50')])[_0xc391('0x14')](function(){if(_[_0xc391('0x72')](_0x3f6728[_0xc391('0x22')][_0xc391('0x50')])){for(var _0x522cca=0x0;_0x522cca<_0x3f6728['query'][_0xc391('0x50')][_0xc391('0x2f')];_0x522cca+=0x1){socket[_0xc391('0x5b')]('userWhatsappQueue:remove',{'UserId':Number(_0x3f6728['query'][_0xc391('0x50')][_0x522cca]),'WhatsappQueueId':Number(_0x3f6728['params']['id'])});}}else{socket['emit'](_0xc391('0x73'),{'UserId':Number(_0x3f6728[_0xc391('0x22')][_0xc391('0x50')]),'WhatsappQueueId':Number(_0x3f6728['params']['id'])});}});}})[_0xc391('0x14')](respondWithStatusCode(_0x1f783e,null))['catch'](handleError(_0x1f783e,null));};exports[_0xc391('0x74')]=function(_0x20d966,_0xe621c5){var _0x50baf4={};var _0x95603={};var _0x5ad5c6;var _0x4b0261;return db[_0xc391('0x1c')][_0xc391('0x75')]({'where':{'id':_0x20d966[_0xc391('0x27')]['id']}})[_0xc391('0x14')](handleEntityNotFound(_0xe621c5,null))[_0xc391('0x14')](function(_0x314891){if(_0x314891){_0x5ad5c6=_0x314891;_0x95603[_0xc391('0x28')]=_['keys'](db[_0xc391('0x51')][_0xc391('0x29')]);_0x95603[_0xc391('0x22')]=_[_0xc391('0x2a')](_0x20d966[_0xc391('0x22')]);_0x95603[_0xc391('0x2b')]=_['intersection'](_0x95603[_0xc391('0x28')],_0x95603[_0xc391('0x22')]);_0x50baf4[_0xc391('0x2d')]=_[_0xc391('0x2c')](_0x95603[_0xc391('0x28')],qs[_0xc391('0x2e')](_0x20d966[_0xc391('0x22')][_0xc391('0x2e')]));_0x50baf4[_0xc391('0x2d')]=_0x50baf4[_0xc391('0x2d')][_0xc391('0x2f')]?_0x50baf4[_0xc391('0x2d')]:_0x95603[_0xc391('0x28')];_0x50baf4[_0xc391('0x3f')]=qs[_0xc391('0x40')](_0x20d966[_0xc391('0x22')][_0xc391('0x40')]);_0x50baf4[_0xc391('0x41')]=qs[_0xc391('0x2b')](_[_0xc391('0x42')](_0x20d966[_0xc391('0x22')],_0x95603[_0xc391('0x2b')]));if(_0x20d966[_0xc391('0x22')]['filter']){_0x50baf4[_0xc391('0x41')]=_['merge'](_0x50baf4[_0xc391('0x41')],{'$or':_[_0xc391('0x1b')](_0x50baf4[_0xc391('0x2d')],function(_0x15563b){var _0x53988c={};_0x53988c[_0x15563b]={'$like':'%'+_0x20d966[_0xc391('0x22')][_0xc391('0x44')]+'%'};return _0x53988c;})});}_0x50baf4=_['merge']({},_0x50baf4,_0x20d966['options']);return _0x5ad5c6[_0xc391('0x74')](_0x50baf4);}})[_0xc391('0x14')](function(_0x4061b9){if(_0x4061b9){_0x4b0261=_0x4061b9[_0xc391('0x2f')];if(!_0x20d966[_0xc391('0x22')][_0xc391('0x3d')](_0xc391('0x3e'))){_0x50baf4[_0xc391('0xf')]=qs[_0xc391('0xf')](_0x20d966[_0xc391('0x22')]['limit']);_0x50baf4[_0xc391('0x11')]=qs[_0xc391('0x11')](_0x20d966[_0xc391('0x22')]['offset']);}return _0x5ad5c6[_0xc391('0x74')](_0x50baf4);}})[_0xc391('0x14')](function(_0x504711){if(_0x504711){return _0x504711?{'count':_0x4b0261,'rows':_0x504711}:null;}})[_0xc391('0x14')](respondWithResult(_0xe621c5,null))[_0xc391('0x25')](handleError(_0xe621c5,null));}; \ No newline at end of file +var _0x246b=['fields','includeAll','merge','options','find','create','body','user','role','WhatsappQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserWhatsappQueue','nolimit','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','length','order','addTeams','ids','Team','Agents','online','flatMap','transaction','each','findOrCreate','userWhatsappQueue:save','select','field','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','includes','all','value','removeTeams','isEmpty','removeAgents','forEach','emit','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','key','getOptions','where','WhatsappQueue','include','findAll','rows','catch','show','keys','query','filters','intersection','model','attributes'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x246b,0xbf));var _0xb246=function(_0x5d4bdf,_0x23bf04){_0x5d4bdf=_0x5d4bdf-0x0;var _0x1c25f7=_0x246b[_0x5d4bdf];return _0x1c25f7;};'use strict';var BPromise=require(_0xb246('0x0'));var util=require(_0xb246('0x1'));var _=require(_0xb246('0x2'));var squel=require(_0xb246('0x3'));var Redis=require(_0xb246('0x4'));var qs=require(_0xb246('0x5'));var logger=require(_0xb246('0x6'))(_0xb246('0x7'));var config=require(_0xb246('0x8'));var db=require(_0xb246('0x9'))['db'];config['redis']=_[_0xb246('0xa')](config[_0xb246('0xb')],{'host':_0xb246('0xc'),'port':0x18eb});var socket=require(_0xb246('0xd'))(new Redis(config[_0xb246('0xb')]));require(_0xb246('0xe'))[_0xb246('0xf')](socket);function respondWithStatusCode(_0x1f832f,_0x4254e3){_0x4254e3=_0x4254e3||0xcc;return function(_0x318869){if(_0x318869){return _0x1f832f[_0xb246('0x10')](_0x4254e3);}return _0x1f832f[_0xb246('0x11')](_0x4254e3)['end']();};}function respondWithResult(_0x1b261b,_0x395e73){_0x395e73=_0x395e73||0xc8;return function(_0x25abb2){if(_0x25abb2){return _0x1b261b[_0xb246('0x11')](_0x395e73)[_0xb246('0x12')](_0x25abb2);}};}function respondWithFilteredResult(_0x127704,_0x68523a){return function(_0x106c64){if(_0x106c64){var _0x4884f1=typeof _0x68523a[_0xb246('0x13')]==='undefined'&&typeof _0x68523a[_0xb246('0x14')]===_0xb246('0x15');var _0x616df4=_0x106c64[_0xb246('0x16')];var _0x2d68d0=_0x4884f1?0x0:_0x68523a[_0xb246('0x13')];var _0x3c761c=_0x4884f1?_0x106c64['count']:_0x68523a[_0xb246('0x13')]+_0x68523a[_0xb246('0x14')];var _0x1016e9;if(_0x3c761c>=_0x616df4){_0x3c761c=_0x616df4;_0x1016e9=0xc8;}else{_0x1016e9=0xce;}_0x127704['status'](_0x1016e9);return _0x127704['set']('Content-Range',_0x2d68d0+'-'+_0x3c761c+'/'+_0x616df4)[_0xb246('0x12')](_0x106c64);}return null;};}function saveUpdates(_0x41fa54){return function(_0x4dbdfd){if(_0x4dbdfd){return _0x4dbdfd[_0xb246('0x17')](_0x41fa54)[_0xb246('0x18')](function(_0x12bf2a){return _0x12bf2a;});}return null;};}function removeEntity(_0x13a7b2){return function(_0x115987){if(_0x115987){return _0x115987[_0xb246('0x19')]()[_0xb246('0x18')](function(){var _0x22057c=_0x115987[_0xb246('0x1a')]({'plain':!![]});var _0x3f13bb='WhatsappQueues';return db[_0xb246('0x1b')][_0xb246('0x19')]({'where':{'type':_0x3f13bb,'resourceId':_0x22057c['id']}})['then'](function(){return _0x115987;});})['then'](function(){_0x13a7b2[_0xb246('0x11')](0xcc)[_0xb246('0x1c')]();});}};}function handleEntityNotFound(_0x58f49e){return function(_0x24cdb4){if(!_0x24cdb4){_0x58f49e[_0xb246('0x10')](0x194);}return _0x24cdb4;};}function handleError(_0x2c7cef,_0x7444b8){_0x7444b8=_0x7444b8||0x1f4;return function(_0x9d81b2){logger[_0xb246('0x1d')](_0x9d81b2['stack']);if(_0x9d81b2[_0xb246('0x1e')]){delete _0x9d81b2['name'];}_0x2c7cef[_0xb246('0x11')](_0x7444b8)[_0xb246('0x1f')](_0x9d81b2);};}exports[_0xb246('0x20')]=function(_0x303789,_0x13324d){var _0x2ac56c={};var _0x5b0120={'count':0x0,'rows':[]};var _0x37f8de=_[_0xb246('0x21')](db['WhatsappQueue'][_0xb246('0x22')],function(_0x205be2){return{'name':_0x205be2[_0xb246('0x23')],'type':_0x205be2['type'][_0xb246('0x24')]};});_0x2ac56c=qs[_0xb246('0x25')](_0x37f8de,_0x303789);var _0x3bf7e4={'where':_0x2ac56c[_0xb246('0x26')]};return db[_0xb246('0x27')][_0xb246('0x16')](_0x3bf7e4)[_0xb246('0x18')](function(_0x3c9adc){_0x5b0120[_0xb246('0x16')]=_0x3c9adc;_0x2ac56c[_0xb246('0x28')]=qs[_0xb246('0x28')](_0x303789['query']);return db[_0xb246('0x27')][_0xb246('0x29')](_0x2ac56c);})[_0xb246('0x18')](function(_0x303266){_0x5b0120[_0xb246('0x2a')]=_0x303266;return _0x5b0120;})[_0xb246('0x18')](respondWithFilteredResult(_0x13324d,_0x2ac56c))[_0xb246('0x2b')](handleError(_0x13324d,null));};exports[_0xb246('0x2c')]=function(_0x207a68,_0x18efc6){var _0x22b8c0={'raw':!![],'where':{'id':_0x207a68['params']['id']}},_0xec4951={};_0xec4951['model']=_[_0xb246('0x2d')](db[_0xb246('0x27')][_0xb246('0x22')]);_0xec4951[_0xb246('0x2e')]=_[_0xb246('0x2d')](_0x207a68['query']);_0xec4951[_0xb246('0x2f')]=_[_0xb246('0x30')](_0xec4951[_0xb246('0x31')],_0xec4951[_0xb246('0x2e')]);_0x22b8c0[_0xb246('0x32')]=_[_0xb246('0x30')](_0xec4951[_0xb246('0x31')],qs[_0xb246('0x33')](_0x207a68['query']['fields']));_0x22b8c0[_0xb246('0x32')]=_0x22b8c0[_0xb246('0x32')]['length']?_0x22b8c0['attributes']:_0xec4951[_0xb246('0x31')];if(_0x207a68[_0xb246('0x2e')][_0xb246('0x34')]){_0x22b8c0[_0xb246('0x28')]=[{'all':!![]}];}_0x22b8c0=_[_0xb246('0x35')]({},_0x22b8c0,_0x207a68[_0xb246('0x36')]);return db[_0xb246('0x27')][_0xb246('0x37')](_0x22b8c0)[_0xb246('0x18')](handleEntityNotFound(_0x18efc6,null))[_0xb246('0x18')](respondWithResult(_0x18efc6,null))[_0xb246('0x2b')](handleError(_0x18efc6,null));};exports[_0xb246('0x38')]=function(_0x4ef137,_0xac31b9){return db['WhatsappQueue'][_0xb246('0x38')](_0x4ef137[_0xb246('0x39')],{})['then'](function(_0xfb0155){var _0x6241b5=_0x4ef137[_0xb246('0x3a')][_0xb246('0x1a')]({'plain':!![]});if(!_0x6241b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6241b5[_0xb246('0x3b')]===_0xb246('0x3a')){var _0x16799f=_0xfb0155[_0xb246('0x1a')]({'plain':!![]});var _0x39eeaa=_0xb246('0x3c');return db[_0xb246('0x3d')][_0xb246('0x37')]({'where':{'name':_0x39eeaa,'userProfileId':_0x6241b5[_0xb246('0x3e')]},'raw':!![]})[_0xb246('0x18')](function(_0x2b0452){if(_0x2b0452&&_0x2b0452['autoAssociation']===0x0){return db[_0xb246('0x1b')]['create']({'name':_0x16799f[_0xb246('0x1e')],'resourceId':_0x16799f['id'],'type':_0x2b0452[_0xb246('0x1e')],'sectionId':_0x2b0452['id']},{})[_0xb246('0x18')](function(){return _0xfb0155;});}else{return _0xfb0155;}})[_0xb246('0x2b')](function(_0x218d7b){logger[_0xb246('0x1d')](_0xb246('0x3f'),_0x218d7b);throw _0x218d7b;});}return _0xfb0155;})[_0xb246('0x18')](respondWithResult(_0xac31b9,0xc9))[_0xb246('0x2b')](handleError(_0xac31b9,null));};exports[_0xb246('0x17')]=function(_0x111301,_0x370e8f){if(_0x111301[_0xb246('0x39')]['id']){delete _0x111301['body']['id'];}return db[_0xb246('0x27')][_0xb246('0x37')]({'where':{'id':_0x111301[_0xb246('0x40')]['id']}})[_0xb246('0x18')](handleEntityNotFound(_0x370e8f,null))[_0xb246('0x18')](saveUpdates(_0x111301[_0xb246('0x39')],null))[_0xb246('0x18')](respondWithResult(_0x370e8f,null))[_0xb246('0x2b')](handleError(_0x370e8f,null));};exports[_0xb246('0x19')]=function(_0x297315,_0x1ccdaa){return db[_0xb246('0x27')][_0xb246('0x37')]({'where':{'id':_0x297315[_0xb246('0x40')]['id']}})[_0xb246('0x18')](handleEntityNotFound(_0x1ccdaa,null))[_0xb246('0x18')](removeEntity(_0x1ccdaa,null))['catch'](handleError(_0x1ccdaa,null));};exports[_0xb246('0x41')]=function(_0x53e2ef,_0x1b7c86){return db[_0xb246('0x27')][_0xb246('0x41')]()[_0xb246('0x18')](respondWithResult(_0x1b7c86,null))[_0xb246('0x2b')](handleError(_0x1b7c86,null));};exports['getMembers']=function(_0x335936,_0x59480b){var _0x3d07b6={'raw':!![],'where':{}},_0x52e715={},_0x4e2fd3;return db[_0xb246('0x27')][_0xb246('0x42')]({'where':{'id':_0x335936['params']['id']}})[_0xb246('0x18')](handleEntityNotFound(_0x59480b,null))[_0xb246('0x18')](function(_0x3eb2d8){if(_0x3eb2d8){_0x4e2fd3=_0x3eb2d8[_0xb246('0x1a')]({'plain':!![]});_0x52e715[_0xb246('0x31')]=_[_0xb246('0x2d')](db[_0xb246('0x43')][_0xb246('0x22')]);_0x52e715['query']=_[_0xb246('0x2d')](_0x335936['query']);_0x52e715[_0xb246('0x2f')]=_[_0xb246('0x30')](_0x52e715[_0xb246('0x31')],_0x52e715[_0xb246('0x2e')]);_0x3d07b6[_0xb246('0x32')]=_[_0xb246('0x30')](_0x52e715[_0xb246('0x31')],qs[_0xb246('0x33')](_0x335936[_0xb246('0x2e')][_0xb246('0x33')]));_0x3d07b6[_0xb246('0x32')]=_0x3d07b6[_0xb246('0x32')]['length']?_0x3d07b6['attributes']:_0x52e715[_0xb246('0x31')];if(!_0x335936['query']['hasOwnProperty'](_0xb246('0x44'))){_0x3d07b6[_0xb246('0x14')]=qs[_0xb246('0x14')](_0x335936['query'][_0xb246('0x14')]);_0x3d07b6[_0xb246('0x13')]=qs['offset'](_0x335936['query']['offset']);}_0x3d07b6['order']=qs[_0xb246('0x45')](_0x335936[_0xb246('0x2e')][_0xb246('0x45')]);_0x3d07b6[_0xb246('0x26')]=qs['filters'](_[_0xb246('0x46')](_0x335936['query'],_0x52e715[_0xb246('0x2f')]));_0x3d07b6['where'][_0xb246('0x47')]=_0x3eb2d8['id'];if(_0x335936[_0xb246('0x2e')]['filter']){_0x3d07b6[_0xb246('0x26')]=_[_0xb246('0x35')](_0x3d07b6[_0xb246('0x26')],{'$or':_['map'](_0x3d07b6['attributes'],function(_0x4d4cf4){var _0x5bb795={};_0x5bb795[_0x4d4cf4]={'$like':'%'+_0x335936[_0xb246('0x2e')][_0xb246('0x48')]+'%'};return _0x5bb795;})});}_0x3d07b6=_[_0xb246('0x35')]({},_0x3d07b6,_0x335936['options']);return db[_0xb246('0x43')][_0xb246('0x29')](_0x3d07b6);}})[_0xb246('0x18')](function(_0x25846f){if(_0x25846f){return db[_0xb246('0x49')][_0xb246('0x4a')]({'where':{'id':_['map'](_0x25846f,_0xb246('0x4b')),'role':_0xb246('0x4c')},'attributes':['id',_0xb246('0x1e'),_0xb246('0x4d'),'updatedAt',_0xb246('0x4e')]});}})['then'](function(_0x56cdcb){if(_0x56cdcb){return{'count':_0x56cdcb[_0xb246('0x16')],'rows':_['map'](_0x56cdcb[_0xb246('0x2a')],function(_0x55392a){return{'membername':_0x55392a[_0xb246('0x1e')],'UserId':_0x55392a['id'],'queue_name':_0x4e2fd3[_0xb246('0x1e')],'WhatsappQueueId':_0x4e2fd3['id'],'interface':util[_0xb246('0x4f')](_0xb246('0x50'),_0xb246('0x51'),_0x55392a[_0xb246('0x1e')]),'penalty':0x0,'paused':_0x55392a['whatsappPause'],'createdAt':_0x55392a[_0xb246('0x4e')],'updatedAt':_0x55392a[_0xb246('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x59480b,_0x3d07b6))[_0xb246('0x2b')](handleError(_0x59480b,null));};exports[_0xb246('0x53')]=function(_0x4e2493,_0x4941d2){var _0x5bc84d={};var _0x104876={};var _0x2bd57d;var _0x381e4c;return db[_0xb246('0x27')][_0xb246('0x42')]({'where':{'id':_0x4e2493[_0xb246('0x40')]['id']}})[_0xb246('0x18')](handleEntityNotFound(_0x4941d2,null))['then'](function(_0xb16a44){if(_0xb16a44){_0x2bd57d=_0xb16a44;_0x104876[_0xb246('0x31')]=_[_0xb246('0x2d')](db['Team']['rawAttributes']);_0x104876['query']=_[_0xb246('0x2d')](_0x4e2493[_0xb246('0x2e')]);_0x104876['filters']=_[_0xb246('0x30')](_0x104876['model'],_0x104876['query']);_0x5bc84d['attributes']=_['intersection'](_0x104876[_0xb246('0x31')],qs[_0xb246('0x33')](_0x4e2493[_0xb246('0x2e')][_0xb246('0x33')]));_0x5bc84d[_0xb246('0x32')]=_0x5bc84d[_0xb246('0x32')][_0xb246('0x54')]?_0x5bc84d[_0xb246('0x32')]:_0x104876[_0xb246('0x31')];_0x5bc84d[_0xb246('0x55')]=qs[_0xb246('0x45')](_0x4e2493[_0xb246('0x2e')]['sort']);_0x5bc84d[_0xb246('0x26')]=qs[_0xb246('0x2f')](_[_0xb246('0x46')](_0x4e2493[_0xb246('0x2e')],_0x104876[_0xb246('0x2f')]));if(_0x4e2493[_0xb246('0x2e')][_0xb246('0x48')]){_0x5bc84d['where']=_['merge'](_0x5bc84d[_0xb246('0x26')],{'$or':_[_0xb246('0x21')](_0x5bc84d['attributes'],function(_0x364be7){var _0x1a2995={};_0x1a2995[_0x364be7]={'$like':'%'+_0x4e2493[_0xb246('0x2e')]['filter']+'%'};return _0x1a2995;})});}_0x5bc84d=_[_0xb246('0x35')]({},_0x5bc84d,_0x4e2493[_0xb246('0x36')]);return _0x2bd57d[_0xb246('0x53')](_0x5bc84d);}})['then'](function(_0x390d61){if(_0x390d61){_0x381e4c=_0x390d61[_0xb246('0x54')];if(!_0x4e2493['query']['hasOwnProperty']('nolimit')){_0x5bc84d['limit']=qs[_0xb246('0x14')](_0x4e2493[_0xb246('0x2e')][_0xb246('0x14')]);_0x5bc84d[_0xb246('0x13')]=qs['offset'](_0x4e2493['query']['offset']);}return _0x2bd57d[_0xb246('0x53')](_0x5bc84d);}})[_0xb246('0x18')](function(_0x5aad3a){if(_0x5aad3a){return _0x5aad3a?{'count':_0x381e4c,'rows':_0x5aad3a}:null;}})[_0xb246('0x18')](respondWithResult(_0x4941d2,null))[_0xb246('0x2b')](handleError(_0x4941d2,null));};exports[_0xb246('0x56')]=function(_0xd353dc,_0x42505f){var _0x3d26c2=_0xd353dc[_0xb246('0x39')][_0xb246('0x57')];return db[_0xb246('0x58')][_0xb246('0x29')]({'where':{'id':_0x3d26c2},'attributes':['id'],'include':[{'model':db[_0xb246('0x49')],'as':_0xb246('0x59'),'attributes':['id','name',_0xb246('0x5a'),'voicePause','interface'],'raw':!![]}]})[_0xb246('0x18')](function(_0x4253ab){if(_0x4253ab){var _0xa474fa=_[_0xb246('0x5b')](_0x4253ab,function(_0x502a95){var _0x299b9b=_0x502a95[_0xb246('0x1a')]({'plain':!![]});return _0x299b9b[_0xb246('0x59')];});return db[_0xb246('0x27')]['find']({'where':{'id':_0xd353dc[_0xb246('0x40')]['id']}})[_0xb246('0x18')](function(_0x549f43){return db['sequelize'][_0xb246('0x5c')](function(_0x4e66a6){return _0x549f43['addTeams'](_0x3d26c2,{'transaction':_0x4e66a6})[_0xb246('0x18')](function(){return BPromise[_0xb246('0x5d')](_0xa474fa,function(_0x1b7f9a){return db[_0xb246('0x43')][_0xb246('0x5e')]({'where':{'UserId':_0x1b7f9a['id'],'WhatsappQueueId':_0xd353dc['params']['id']},'transaction':_0x4e66a6});});})['then'](function(){_0xa474fa['forEach'](function(_0x4f9f87){socket['emit'](_0xb246('0x5f'),{'UserId':_0x4f9f87['id'],'WhatsappQueueId':_0x549f43['id']});});});});});}})[_0xb246('0x18')](respondWithStatusCode(_0x42505f,null))['catch'](handleError(_0x42505f,null));};exports['removeTeams']=function(_0x4c733c,_0xa2c5a8){return db[_0xb246('0x58')][_0xb246('0x29')]({'where':{'id':_0x4c733c[_0xb246('0x2e')][_0xb246('0x57')]},'attributes':['id'],'include':[{'model':db[_0xb246('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb246('0x18')](handleEntityNotFound(_0xa2c5a8,null))[_0xb246('0x18')](function(_0x236183){var _0x5389fd=_[_0xb246('0x21')](_0x236183,'id');var _0x27ed89=[];var _0x15809a=[];var _0x3c18e6=squel[_0xb246('0x60')]();_0x3c18e6[_0xb246('0x61')]('tq.TeamId')['from']('team_has_whatsapp_queues','tq')[_0xb246('0x62')](_0xb246('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb246('0x26')](_0xb246('0x64'),_0x4c733c[_0xb246('0x40')]['id']);for(var _0x8b5631=0x0;_0x8b5631<_0x236183[_0xb246('0x54')];_0x8b5631+=0x1){let _0x55ea1f=_0x236183[_0x8b5631];for(var _0x4b216b=0x0;_0x4b216b<_0x55ea1f[_0xb246('0x59')][_0xb246('0x54')];_0x4b216b+=0x1){let _0x5d9e44=_0x55ea1f[_0xb246('0x59')][_0x4b216b];var _0xb99e8d=_0x3c18e6[_0xb246('0x65')]();_0xb99e8d[_0xb246('0x26')](_0xb246('0x66'),_0x5d9e44['id']);_0x15809a['push'](db[_0xb246('0x67')][_0xb246('0x2e')](_0xb99e8d[_0xb246('0x68')](),{'type':db[_0xb246('0x67')][_0xb246('0x69')][_0xb246('0x6a')]})[_0xb246('0x18')](function(_0x4e355c){if(_0x4e355c[_0xb246('0x54')]===0x1){return _0x5d9e44['id'];}else{var _0x111abe=_['every'](_[_0xb246('0x21')](_0x4e355c,'TeamId'),function(_0x223817){return _[_0xb246('0x6b')](_0x5389fd,_0x223817);});if(_0x111abe){return _0x5d9e44['id'];}}}));}}return BPromise[_0xb246('0x6c')](_0x15809a)[_0xb246('0x18')](function(_0x122439){_0x27ed89=_(_0x27ed89)['union'](_0x122439)['compact']()[_0xb246('0x6d')]();return db[_0xb246('0x27')]['find']({'where':{'id':_0x4c733c[_0xb246('0x40')]['id']}})['then'](function(_0x533c69){return db[_0xb246('0x67')][_0xb246('0x5c')](function(_0x3ad3c2){return _0x533c69[_0xb246('0x6e')](_0x4c733c['query']['ids'],{'transaction':_0x3ad3c2})[_0xb246('0x18')](function(){if(!_[_0xb246('0x6f')](_0x27ed89)){return _0x533c69[_0xb246('0x70')](_0x27ed89,{'transaction':_0x3ad3c2});}})['then'](function(){_0x27ed89[_0xb246('0x71')](function(_0x5eddda){socket[_0xb246('0x72')]('userWhatsappQueue:remove',{'UserId':_0x5eddda,'WhatsappQueueId':_0x533c69['id']});});});});});});})[_0xb246('0x18')](respondWithStatusCode(_0xa2c5a8,null))[_0xb246('0x2b')](handleError(_0xa2c5a8,null));};exports['addAgents']=function(_0x19d798,_0x145fe7){return db[_0xb246('0x27')][_0xb246('0x37')]({'where':{'id':_0x19d798[_0xb246('0x40')]['id']}})[_0xb246('0x18')](handleEntityNotFound(_0x145fe7,null))[_0xb246('0x18')](function(_0x19a175){if(_0x19a175){return _0x19a175[_0xb246('0x73')](_0x19d798['body']['ids'],_[_0xb246('0x74')](_0x19d798[_0xb246('0x39')],[_0xb246('0x57'),'id'])||{})[_0xb246('0x75')](function(_0xfc77d3){for(var _0x3d90d2=0x0;_0x3d90d2<_0x19d798[_0xb246('0x39')][_0xb246('0x57')][_0xb246('0x54')];_0x3d90d2+=0x1){socket[_0xb246('0x72')](_0xb246('0x5f'),{'UserId':Number(_0x19d798[_0xb246('0x39')][_0xb246('0x57')][_0x3d90d2]),'WhatsappQueueId':Number(_0x19d798[_0xb246('0x40')]['id'])});}return _0xfc77d3;});}})['then'](respondWithResult(_0x145fe7,null))[_0xb246('0x2b')](handleError(_0x145fe7,null));};exports[_0xb246('0x70')]=function(_0x55d6b6,_0x4e2ce2){return db['WhatsappQueue'][_0xb246('0x37')]({'where':{'id':_0x55d6b6[_0xb246('0x40')]['id']}})['then'](handleEntityNotFound(_0x4e2ce2,null))[_0xb246('0x18')](function(_0x1c0f25){if(_0x1c0f25){return _0x1c0f25['removeAgents'](_0x55d6b6[_0xb246('0x2e')][_0xb246('0x57')])['then'](function(){if(_[_0xb246('0x76')](_0x55d6b6[_0xb246('0x2e')]['ids'])){for(var _0x4ad383=0x0;_0x4ad383<_0x55d6b6['query'][_0xb246('0x57')][_0xb246('0x54')];_0x4ad383+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x55d6b6[_0xb246('0x2e')][_0xb246('0x57')][_0x4ad383]),'WhatsappQueueId':Number(_0x55d6b6[_0xb246('0x40')]['id'])});}}else{socket[_0xb246('0x72')](_0xb246('0x77'),{'UserId':Number(_0x55d6b6['query'][_0xb246('0x57')]),'WhatsappQueueId':Number(_0x55d6b6[_0xb246('0x40')]['id'])});}});}})[_0xb246('0x18')](respondWithStatusCode(_0x4e2ce2,null))[_0xb246('0x2b')](handleError(_0x4e2ce2,null));};exports[_0xb246('0x78')]=function(_0x229161,_0x5281f5){var _0x41b6bd={};var _0x47706a={};var _0x2144fa;var _0x4db0d6;return db[_0xb246('0x27')][_0xb246('0x42')]({'where':{'id':_0x229161[_0xb246('0x40')]['id']}})[_0xb246('0x18')](handleEntityNotFound(_0x5281f5,null))['then'](function(_0x1fbc57){if(_0x1fbc57){_0x2144fa=_0x1fbc57;_0x47706a[_0xb246('0x31')]=_[_0xb246('0x2d')](db[_0xb246('0x49')][_0xb246('0x22')]);_0x47706a[_0xb246('0x2e')]=_[_0xb246('0x2d')](_0x229161[_0xb246('0x2e')]);_0x47706a['filters']=_[_0xb246('0x30')](_0x47706a[_0xb246('0x31')],_0x47706a['query']);_0x41b6bd[_0xb246('0x32')]=_[_0xb246('0x30')](_0x47706a['model'],qs['fields'](_0x229161['query'][_0xb246('0x33')]));_0x41b6bd[_0xb246('0x32')]=_0x41b6bd['attributes'][_0xb246('0x54')]?_0x41b6bd['attributes']:_0x47706a[_0xb246('0x31')];_0x41b6bd[_0xb246('0x55')]=qs[_0xb246('0x45')](_0x229161[_0xb246('0x2e')][_0xb246('0x45')]);_0x41b6bd[_0xb246('0x26')]=qs[_0xb246('0x2f')](_[_0xb246('0x46')](_0x229161[_0xb246('0x2e')],_0x47706a[_0xb246('0x2f')]));if(_0x229161['query'][_0xb246('0x48')]){_0x41b6bd[_0xb246('0x26')]=_['merge'](_0x41b6bd['where'],{'$or':_[_0xb246('0x21')](_0x41b6bd[_0xb246('0x32')],function(_0x497ead){var _0xf95175={};_0xf95175[_0x497ead]={'$like':'%'+_0x229161['query'][_0xb246('0x48')]+'%'};return _0xf95175;})});}_0x41b6bd=_['merge']({},_0x41b6bd,_0x229161[_0xb246('0x36')]);return _0x2144fa['getAgents'](_0x41b6bd);}})[_0xb246('0x18')](function(_0x3ab4d0){if(_0x3ab4d0){_0x4db0d6=_0x3ab4d0[_0xb246('0x54')];if(!_0x229161[_0xb246('0x2e')]['hasOwnProperty']('nolimit')){_0x41b6bd[_0xb246('0x14')]=qs[_0xb246('0x14')](_0x229161[_0xb246('0x2e')][_0xb246('0x14')]);_0x41b6bd[_0xb246('0x13')]=qs[_0xb246('0x13')](_0x229161['query']['offset']);}return _0x2144fa[_0xb246('0x78')](_0x41b6bd);}})[_0xb246('0x18')](function(_0x2669b2){if(_0x2669b2){return _0x2669b2?{'count':_0x4db0d6,'rows':_0x2669b2}:null;}})[_0xb246('0x18')](respondWithResult(_0x5281f5,null))[_0xb246('0x2b')](handleError(_0x5281f5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 909b5a4..1cd41fe 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 _0xdae2=['remove','emit','hasOwnProperty','events','../../mysqldb','save','update'];(function(_0x268951,_0x153fac){var _0x4b3487=function(_0x534b3e){while(--_0x534b3e){_0x268951['push'](_0x268951['shift']());}};_0x4b3487(++_0x153fac);}(_0xdae2,0xab));var _0x2dae=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xdae2[_0x1b6186];return _0x186121;};'use strict';var EventEmitter=require(_0x2dae('0x0'));var WhatsappQueue=require(_0x2dae('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2dae('0x2'),'afterUpdate':_0x2dae('0x3'),'afterDestroy':_0x2dae('0x4')};function emitEvent(_0x45eebb){return function(_0x4116ea,_0x3ac2c0,_0x6f7333){WhatsappQueueEvents[_0x2dae('0x5')](_0x45eebb+':'+_0x4116ea['id'],_0x4116ea);WhatsappQueueEvents[_0x2dae('0x5')](_0x45eebb,_0x4116ea);_0x6f7333(null);};}for(var e in events){if(events[_0x2dae('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xa091=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','WhatsappQueue'];(function(_0x2c722f,_0x54f1bd){var _0x2f2207=function(_0x480eb7){while(--_0x480eb7){_0x2c722f['push'](_0x2c722f['shift']());}};_0x2f2207(++_0x54f1bd);}(_0xa091,0x1ae));var _0x1a09=function(_0x2d01be,_0x4027a6){_0x2d01be=_0x2d01be-0x0;var _0x62af0b=_0xa091[_0x2d01be];return _0x62af0b;};'use strict';var EventEmitter=require(_0x1a09('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x1a09('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1a09('0x2')](0x0);var events={'afterCreate':_0x1a09('0x3'),'afterUpdate':'update','afterDestroy':_0x1a09('0x4')};function emitEvent(_0x26da55){return function(_0x166c43,_0x5e986c,_0xd59e32){WhatsappQueueEvents[_0x1a09('0x5')](_0x26da55+':'+_0x166c43['id'],_0x166c43);WhatsappQueueEvents[_0x1a09('0x5')](_0x26da55,_0x166c43);_0xd59e32(null);};}for(var e in events){if(events[_0x1a09('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x1a09('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index d7aed1b..9f20107 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 _0xf261=['../../config/environment','exports','WhatsappQueue','whatsapp_queues','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x26ec85,_0x1b1357){var _0x32a90e=function(_0x3cac61){while(--_0x3cac61){_0x26ec85['push'](_0x26ec85['shift']());}};_0x32a90e(++_0x1b1357);}(_0xf261,0x68));var _0x1f26=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf261[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x1f26('0x0'));var util=require(_0x1f26('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1f26('0x2'));var rp=require(_0x1f26('0x3'));var fs=require('fs');var path=require(_0x1f26('0x4'));var rimraf=require(_0x1f26('0x5'));var config=require(_0x1f26('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x1f26('0x7')]=function(_0x432587,_0x3fc4e0){return _0x432587['define'](_0x1f26('0x8'),attributes,{'tableName':_0x1f26('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c76=['api','moment','bluebird','path','rimraf','exports','define','WhatsappQueue','lodash','util','../../config/logger'];(function(_0xfae2c2,_0x2eafd2){var _0x59410e=function(_0x5326ef){while(--_0x5326ef){_0xfae2c2['push'](_0xfae2c2['shift']());}};_0x59410e(++_0x2eafd2);}(_0x1c76,0x6b));var _0x61c7=function(_0x15db6d,_0x1297cd){_0x15db6d=_0x15db6d-0x0;var _0x278fb7=_0x1c76[_0x15db6d];return _0x278fb7;};'use strict';var _=require(_0x61c7('0x0'));var util=require(_0x61c7('0x1'));var logger=require(_0x61c7('0x2'))(_0x61c7('0x3'));var moment=require(_0x61c7('0x4'));var BPromise=require(_0x61c7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61c7('0x6'));var rimraf=require(_0x61c7('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x61c7('0x8')]=function(_0x5163cc,_0x28188e){return _0x5163cc[_0x61c7('0x9')](_0x61c7('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index dc3ea81..98dce78 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 _0x6e15=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','map','include','model','then','ShowWhatsappQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xabe145,_0x2ef96d){var _0x433e19=function(_0x3eca1a){while(--_0x3eca1a){_0xabe145['push'](_0xabe145['shift']());}};_0x433e19(++_0x2ef96d);}(_0x6e15,0xb5));var _0x56e1=function(_0x18c529,_0x32c0cb){_0x18c529=_0x18c529-0x0;var _0x2af43b=_0x6e15[_0x18c529];return _0x2af43b;};'use strict';var _=require(_0x56e1('0x0'));var util=require(_0x56e1('0x1'));var moment=require('moment');var BPromise=require(_0x56e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56e1('0x3'));var db=require(_0x56e1('0x4'))['db'];var utils=require(_0x56e1('0x5'));var logger=require(_0x56e1('0x6'))(_0x56e1('0x7'));var config=require(_0x56e1('0x8'));var jayson=require(_0x56e1('0x9'));var client=jayson[_0x56e1('0xa')]['http']({'port':0x232a});config[_0x56e1('0xb')]=_[_0x56e1('0xc')](config[_0x56e1('0xb')],{'host':_0x56e1('0xd'),'port':0x18eb});var socket=require(_0x56e1('0xe'))(new Redis(config[_0x56e1('0xb')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5ade34,_0x28a868,_0x116894){return new BPromise(function(_0x68edaa,_0x17e337){return client[_0x56e1('0xf')](_0x5ade34,_0x116894)['then'](function(_0x14fc62){logger[_0x56e1('0x10')](_0x56e1('0x11'),_0x28a868,_0x56e1('0x12'));logger[_0x56e1('0x13')](_0x56e1('0x14'),_0x28a868,_0x56e1('0x12'),JSON[_0x56e1('0x15')](_0x14fc62));if(_0x14fc62[_0x56e1('0x16')]){if(_0x14fc62['error'][_0x56e1('0x17')]===0x1f4){logger[_0x56e1('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x28a868,_0x14fc62[_0x56e1('0x16')][_0x56e1('0x18')]);return _0x17e337(_0x14fc62[_0x56e1('0x16')][_0x56e1('0x18')]);}logger[_0x56e1('0x16')](_0x56e1('0x11'),_0x28a868,_0x14fc62[_0x56e1('0x16')][_0x56e1('0x18')]);return _0x68edaa(_0x14fc62['error'][_0x56e1('0x18')]);}else{logger[_0x56e1('0x10')](_0x56e1('0x11'),_0x28a868,_0x56e1('0x12'));_0x68edaa(_0x14fc62['result'][_0x56e1('0x18')]);}})[_0x56e1('0x19')](function(_0x419947){logger[_0x56e1('0x16')](_0x56e1('0x11'),_0x28a868,_0x419947);_0x17e337(_0x419947);});});}exports[_0x56e1('0x1a')]=function(_0x464be6){var _0x3e2d73=this;return new Promise(function(_0x4bdf90,_0x1a85fa){return db[_0x56e1('0x1b')]['findAll']({'raw':_0x464be6['options']?_0x464be6[_0x56e1('0x1c')][_0x56e1('0x1d')]===undefined?!![]:![]:!![],'where':_0x464be6[_0x56e1('0x1c')]?_0x464be6['options'][_0x56e1('0x1e')]||null:null,'attributes':_0x464be6[_0x56e1('0x1c')]?_0x464be6[_0x56e1('0x1c')][_0x56e1('0x1f')]||null:null,'limit':_0x464be6[_0x56e1('0x1c')]?_0x464be6[_0x56e1('0x1c')]['limit']||null:null,'include':_0x464be6[_0x56e1('0x1c')]?_0x464be6[_0x56e1('0x1c')]['include']?_[_0x56e1('0x20')](_0x464be6[_0x56e1('0x1c')][_0x56e1('0x21')],function(_0xce0d59){return{'model':db[_0xce0d59[_0x56e1('0x22')]],'as':_0xce0d59['as'],'attributes':_0xce0d59[_0x56e1('0x1f')],'include':_0xce0d59[_0x56e1('0x21')]?_[_0x56e1('0x20')](_0xce0d59[_0x56e1('0x21')],function(_0x4ab377){return{'model':db[_0x4ab377[_0x56e1('0x22')]],'as':_0x4ab377['as'],'attributes':_0x4ab377[_0x56e1('0x1f')],'include':_0x4ab377[_0x56e1('0x21')]?_[_0x56e1('0x20')](_0x4ab377[_0x56e1('0x21')],function(_0x15d176){return{'model':db[_0x15d176[_0x56e1('0x22')]],'as':_0x15d176['as'],'attributes':_0x15d176[_0x56e1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x56e1('0x23')](function(_0x4b01d0){logger[_0x56e1('0x10')]('GetWhatsappQueue',_0x464be6);logger[_0x56e1('0x13')](_0x56e1('0x1a'),_0x464be6,JSON[_0x56e1('0x15')](_0x4b01d0));_0x4bdf90(_0x4b01d0);})['catch'](function(_0xd34853){logger[_0x56e1('0x16')]('GetWhatsappQueue',_0xd34853[_0x56e1('0x18')],_0x464be6);_0x1a85fa(_0x3e2d73[_0x56e1('0x16')](0x1f4,_0xd34853[_0x56e1('0x18')]));});});};exports[_0x56e1('0x24')]=function(_0x290367){var _0xdffcae=this;return new Promise(function(_0x2840d1,_0x411d0a){return db['WhatsappQueue'][_0x56e1('0x25')]({'raw':_0x290367[_0x56e1('0x1c')]?_0x290367[_0x56e1('0x1c')][_0x56e1('0x1d')]===undefined?!![]:![]:!![],'where':_0x290367[_0x56e1('0x1c')]?_0x290367[_0x56e1('0x1c')]['where']||null:null,'attributes':_0x290367[_0x56e1('0x1c')]?_0x290367[_0x56e1('0x1c')][_0x56e1('0x1f')]||null:null,'include':_0x290367['options']?_0x290367[_0x56e1('0x1c')]['include']?_['map'](_0x290367[_0x56e1('0x1c')][_0x56e1('0x21')],function(_0xaf0824){return{'model':db[_0xaf0824[_0x56e1('0x22')]],'as':_0xaf0824['as'],'attributes':_0xaf0824['attributes'],'include':_0xaf0824[_0x56e1('0x21')]?_[_0x56e1('0x20')](_0xaf0824['include'],function(_0x1d8dff){return{'model':db[_0x1d8dff[_0x56e1('0x22')]],'as':_0x1d8dff['as'],'attributes':_0x1d8dff[_0x56e1('0x1f')],'include':_0x1d8dff['include']?_[_0x56e1('0x20')](_0x1d8dff['include'],function(_0x2e2984){return{'model':db[_0x2e2984['model']],'as':_0x2e2984['as'],'attributes':_0x2e2984[_0x56e1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x56e1('0x23')](function(_0x54eccf){logger['info'](_0x56e1('0x24'),_0x290367);logger[_0x56e1('0x13')](_0x56e1('0x24'),_0x290367,JSON[_0x56e1('0x15')](_0x54eccf));_0x2840d1(_0x54eccf);})['catch'](function(_0x5526f4){logger['error'](_0x56e1('0x24'),_0x5526f4[_0x56e1('0x18')],_0x290367);_0x411d0a(_0xdffcae[_0x56e1('0x16')](0x1f4,_0x5526f4[_0x56e1('0x18')]));});});}; \ No newline at end of file +var _0x15c4=['request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','catch','ShowWhatsappQueue','find','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappQueue,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x15c4,0xd8));var _0x415c=function(_0x370e71,_0x3b7996){_0x370e71=_0x370e71-0x0;var _0x4589a2=_0x15c4[_0x370e71];return _0x4589a2;};'use strict';var _=require(_0x415c('0x0'));var util=require('util');var moment=require(_0x415c('0x1'));var BPromise=require(_0x415c('0x2'));var rs=require(_0x415c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x415c('0x4'));var logger=require(_0x415c('0x5'))(_0x415c('0x6'));var config=require(_0x415c('0x7'));var jayson=require(_0x415c('0x8'));var client=jayson['client'][_0x415c('0x9')]({'port':0x232a});config[_0x415c('0xa')]=_[_0x415c('0xb')](config[_0x415c('0xa')],{'host':_0x415c('0xc'),'port':0x18eb});var socket=require(_0x415c('0xd'))(new Redis(config[_0x415c('0xa')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5f188f,_0xe21c0d,_0x11c6db){return new BPromise(function(_0x1e259f,_0x1670a2){return client[_0x415c('0xe')](_0x5f188f,_0x11c6db)[_0x415c('0xf')](function(_0x4f3d07){logger[_0x415c('0x10')](_0x415c('0x11'),_0xe21c0d,_0x415c('0x12'));logger[_0x415c('0x13')](_0x415c('0x14'),_0xe21c0d,'request\x20sent',JSON[_0x415c('0x15')](_0x4f3d07));if(_0x4f3d07[_0x415c('0x16')]){if(_0x4f3d07[_0x415c('0x16')][_0x415c('0x17')]===0x1f4){logger[_0x415c('0x16')](_0x415c('0x11'),_0xe21c0d,_0x4f3d07[_0x415c('0x16')][_0x415c('0x18')]);return _0x1670a2(_0x4f3d07['error'][_0x415c('0x18')]);}logger[_0x415c('0x16')](_0x415c('0x11'),_0xe21c0d,_0x4f3d07[_0x415c('0x16')][_0x415c('0x18')]);return _0x1e259f(_0x4f3d07[_0x415c('0x16')]['message']);}else{logger[_0x415c('0x10')](_0x415c('0x11'),_0xe21c0d,_0x415c('0x12'));_0x1e259f(_0x4f3d07[_0x415c('0x19')][_0x415c('0x18')]);}})['catch'](function(_0x199c02){logger['error'](_0x415c('0x11'),_0xe21c0d,_0x199c02);_0x1670a2(_0x199c02);});});}exports[_0x415c('0x1a')]=function(_0x131910){var _0x4a62a3=this;return new Promise(function(_0x5dfd06,_0x443062){return db[_0x415c('0x1b')][_0x415c('0x1c')]({'raw':_0x131910['options']?_0x131910[_0x415c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x131910['options']?_0x131910[_0x415c('0x1d')][_0x415c('0x1e')]||null:null,'attributes':_0x131910[_0x415c('0x1d')]?_0x131910[_0x415c('0x1d')][_0x415c('0x1f')]||null:null,'limit':_0x131910[_0x415c('0x1d')]?_0x131910['options'][_0x415c('0x20')]||null:null,'include':_0x131910['options']?_0x131910[_0x415c('0x1d')][_0x415c('0x21')]?_[_0x415c('0x22')](_0x131910['options'][_0x415c('0x21')],function(_0x1c8e8a){return{'model':db[_0x1c8e8a['model']],'as':_0x1c8e8a['as'],'attributes':_0x1c8e8a[_0x415c('0x1f')],'include':_0x1c8e8a[_0x415c('0x21')]?_[_0x415c('0x22')](_0x1c8e8a['include'],function(_0x546c61){return{'model':db[_0x546c61[_0x415c('0x23')]],'as':_0x546c61['as'],'attributes':_0x546c61[_0x415c('0x1f')],'include':_0x546c61[_0x415c('0x21')]?_[_0x415c('0x22')](_0x546c61[_0x415c('0x21')],function(_0x58da3d){return{'model':db[_0x58da3d[_0x415c('0x23')]],'as':_0x58da3d['as'],'attributes':_0x58da3d[_0x415c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x202c89){logger[_0x415c('0x10')](_0x415c('0x1a'),_0x131910);logger[_0x415c('0x13')](_0x415c('0x1a'),_0x131910,JSON[_0x415c('0x15')](_0x202c89));_0x5dfd06(_0x202c89);})[_0x415c('0x24')](function(_0x2deb58){logger[_0x415c('0x16')](_0x415c('0x1a'),_0x2deb58[_0x415c('0x18')],_0x131910);_0x443062(_0x4a62a3['error'](0x1f4,_0x2deb58['message']));});});};exports[_0x415c('0x25')]=function(_0x37d961){var _0x34cc78=this;return new Promise(function(_0x104d79,_0x1498e0){return db['WhatsappQueue'][_0x415c('0x26')]({'raw':_0x37d961[_0x415c('0x1d')]?_0x37d961['options']['raw']===undefined?!![]:![]:!![],'where':_0x37d961[_0x415c('0x1d')]?_0x37d961['options'][_0x415c('0x1e')]||null:null,'attributes':_0x37d961[_0x415c('0x1d')]?_0x37d961[_0x415c('0x1d')][_0x415c('0x1f')]||null:null,'include':_0x37d961[_0x415c('0x1d')]?_0x37d961[_0x415c('0x1d')][_0x415c('0x21')]?_[_0x415c('0x22')](_0x37d961[_0x415c('0x1d')][_0x415c('0x21')],function(_0x39d72d){return{'model':db[_0x39d72d['model']],'as':_0x39d72d['as'],'attributes':_0x39d72d[_0x415c('0x1f')],'include':_0x39d72d[_0x415c('0x21')]?_[_0x415c('0x22')](_0x39d72d[_0x415c('0x21')],function(_0x54bdaf){return{'model':db[_0x54bdaf[_0x415c('0x23')]],'as':_0x54bdaf['as'],'attributes':_0x54bdaf[_0x415c('0x1f')],'include':_0x54bdaf['include']?_[_0x415c('0x22')](_0x54bdaf[_0x415c('0x21')],function(_0x21092c){return{'model':db[_0x21092c[_0x415c('0x23')]],'as':_0x21092c['as'],'attributes':_0x21092c['attributes']};}):[]};}):[]};}):[]:[]})[_0x415c('0xf')](function(_0x38ca77){logger[_0x415c('0x10')](_0x415c('0x25'),_0x37d961);logger['debug'](_0x415c('0x25'),_0x37d961,JSON[_0x415c('0x15')](_0x38ca77));_0x104d79(_0x38ca77);})[_0x415c('0x24')](function(_0x28202e){logger[_0x415c('0x16')](_0x415c('0x25'),_0x28202e[_0x415c('0x18')],_0x37d961);_0x1498e0(_0x34cc78[_0x415c('0x16')](0x1f4,_0x28202e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ccb0b3d..d365ecb 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 _0x982e=['save','remove','update','emit','removeListener','register','whatsappQueue:','./whatsappQueue.events'];(function(_0x5c9d60,_0x251a5d){var _0x4b6111=function(_0x3227f4){while(--_0x3227f4){_0x5c9d60['push'](_0x5c9d60['shift']());}};_0x4b6111(++_0x251a5d);}(_0x982e,0x1df));var _0xe982=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x982e[_0x42cae2];return _0x5f256f;};'use strict';var WhatsappQueueEvents=require(_0xe982('0x0'));var events=[_0xe982('0x1'),_0xe982('0x2'),_0xe982('0x3')];function createListener(_0x13035e,_0x43873e){return function(_0x195b17){_0x43873e[_0xe982('0x4')](_0x13035e,_0x195b17);};}function removeListener(_0x55db52,_0x8f1946){return function(){WhatsappQueueEvents[_0xe982('0x5')](_0x55db52,_0x8f1946);};}exports[_0xe982('0x6')]=function(_0x9cb794){for(var _0x282800=0x0,_0x174793=events['length'];_0x282800<_0x174793;_0x282800++){var _0x57d950=events[_0x282800];var _0x2b32aa=createListener(_0xe982('0x7')+_0x57d950,_0x9cb794);WhatsappQueueEvents['on'](_0x57d950,_0x2b32aa);}}; \ No newline at end of file +var _0x4d3b=['update','emit','register','length','whatsappQueue:','./whatsappQueue.events','remove'];(function(_0x463183,_0x56bd4e){var _0xd5fe56=function(_0x55cb29){while(--_0x55cb29){_0x463183['push'](_0x463183['shift']());}};_0xd5fe56(++_0x56bd4e);}(_0x4d3b,0x155));var _0xb4d3=function(_0x5e630f,_0x178fbb){_0x5e630f=_0x5e630f-0x0;var _0xff30da=_0x4d3b[_0x5e630f];return _0xff30da;};'use strict';var WhatsappQueueEvents=require(_0xb4d3('0x0'));var events=['save',_0xb4d3('0x1'),_0xb4d3('0x2')];function createListener(_0x5254c7,_0x40cacc){return function(_0x18f154){_0x40cacc[_0xb4d3('0x3')](_0x5254c7,_0x18f154);};}function removeListener(_0x356c39,_0x4050c6){return function(){WhatsappQueueEvents['removeListener'](_0x356c39,_0x4050c6);};}exports[_0xb4d3('0x4')]=function(_0x4d6ac6){for(var _0x3b7b20=0x0,_0x2f69d5=events[_0xb4d3('0x5')];_0x3b7b20<_0x2f69d5;_0x3b7b20++){var _0x18e41c=events[_0x3b7b20];var _0xce17=createListener(_0xb4d3('0x6')+_0x18e41c,_0x4d6ac6);WhatsappQueueEvents['on'](_0x18e41c,_0xce17);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 73be581..4e59e43 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 _0x7819=['get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x18afc1,_0x34a25d){var _0x5bb3bf=function(_0x2e119b){while(--_0x2e119b){_0x18afc1['push'](_0x18afc1['shift']());}};_0x5bb3bf(++_0x34a25d);}(_0x7819,0x10e));var _0x9781=function(_0x54d3c0,_0xd0bd49){_0x54d3c0=_0x54d3c0-0x0;var _0x460669=_0x7819[_0x54d3c0];return _0x460669;};'use strict';var multer=require(_0x9781('0x0'));var util=require(_0x9781('0x1'));var path=require(_0x9781('0x2'));var timeout=require(_0x9781('0x3'));var express=require(_0x9781('0x4'));var router=express[_0x9781('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9781('0x6'));var interaction=require(_0x9781('0x7'));var config=require(_0x9781('0x8'));var controller=require(_0x9781('0x9'));router[_0x9781('0xa')]('/',auth[_0x9781('0xb')](),controller[_0x9781('0xc')]);router[_0x9781('0xa')](_0x9781('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x9781('0xa')](_0x9781('0xe'),auth[_0x9781('0xb')](),controller[_0x9781('0xf')]);router[_0x9781('0x10')]('/',auth['isAuthenticated'](),controller[_0x9781('0x11')]);router[_0x9781('0x12')](_0x9781('0xe'),auth[_0x9781('0xb')](),controller['update']);router[_0x9781('0x13')]('/:id',auth[_0x9781('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x44b3=['multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports'];(function(_0x1f1cac,_0x9da26c){var _0x28693f=function(_0x2bdf31){while(--_0x2bdf31){_0x1f1cac['push'](_0x1f1cac['shift']());}};_0x28693f(++_0x9da26c);}(_0x44b3,0x154));var _0x344b=function(_0x52b26f,_0x3fa6ab){_0x52b26f=_0x52b26f-0x0;var _0xfac1d3=_0x44b3[_0x52b26f];return _0xfac1d3;};'use strict';var multer=require(_0x344b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x344b('0x1'));var express=require(_0x344b('0x2'));var router=express['Router']();var fs_extra=require(_0x344b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x344b('0x4'));var config=require(_0x344b('0x5'));var controller=require(_0x344b('0x6'));router[_0x344b('0x7')]('/',auth[_0x344b('0x8')](),controller[_0x344b('0x9')]);router[_0x344b('0x7')](_0x344b('0xa'),auth[_0x344b('0x8')](),controller[_0x344b('0xb')]);router['get'](_0x344b('0xc'),auth[_0x344b('0x8')](),controller[_0x344b('0xd')]);router[_0x344b('0xe')]('/',auth[_0x344b('0x8')](),controller[_0x344b('0xf')]);router[_0x344b('0x10')](_0x344b('0xc'),auth['isAuthenticated'](),controller[_0x344b('0x11')]);router[_0x344b('0x12')](_0x344b('0xc'),auth[_0x344b('0x8')](),controller['destroy']);module[_0x344b('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index bdd8a86..d79ec07 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x244442,_0x5b8c1f){var _0x4fa2f5=function(_0x48371a){while(--_0x48371a){_0x244442['push'](_0x244442['shift']());}};_0x4fa2f5(++_0x5b8c1f);}(_0x7a54,0x106));var _0x47a5=function(_0x53f6fd,_0x4486b8){_0x53f6fd=_0x53f6fd-0x0;var _0x2ad6d5=_0x7a54[_0x53f6fd];return _0x2ad6d5;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0xfeff61,_0x4c54fb){var _0x513eac=function(_0x160651){while(--_0x160651){_0xfeff61['push'](_0xfeff61['shift']());}};_0x513eac(++_0x4c54fb);}(_0x7a54,0x106));var _0x47a5=function(_0x25fdb7,_0x1ecaa1){_0x25fdb7=_0x25fdb7-0x0;var _0x4e6c19=_0x7a54[_0x25fdb7];return _0x4e6c19;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 717ebbb..a253340 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 _0x5eb8=['rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','catch','show','params','keys','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','WhatsappQueueReport'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0x5eb8,0xb0));var _0x85eb=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x5eb8[_0x284807];return _0x50c774;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];function respondWithStatusCode(_0x784583,_0x2f42ba){_0x2f42ba=_0x2f42ba||0xcc;return function(_0x259f72){if(_0x259f72){return _0x784583['sendStatus'](_0x2f42ba);}return _0x784583['status'](_0x2f42ba)[_0x85eb('0x19')]();};}function respondWithResult(_0x5c760a,_0x18ca53){_0x18ca53=_0x18ca53||0xc8;return function(_0x23a82a){if(_0x23a82a){return _0x5c760a[_0x85eb('0x1a')](_0x18ca53)[_0x85eb('0x1b')](_0x23a82a);}};}function respondWithFilteredResult(_0x183b0c,_0x49efdf){return function(_0x2e5c0a){if(_0x2e5c0a){var _0x59237b=typeof _0x49efdf[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x49efdf[_0x85eb('0x1e')]===_0x85eb('0x1d');var _0x5dbeda=_0x2e5c0a['count'];var _0x50d2a8=_0x59237b?0x0:_0x49efdf[_0x85eb('0x1c')];var _0x39ca96=_0x59237b?_0x2e5c0a[_0x85eb('0x1f')]:_0x49efdf[_0x85eb('0x1c')]+_0x49efdf[_0x85eb('0x1e')];var _0x34f875;if(_0x39ca96>=_0x5dbeda){_0x39ca96=_0x5dbeda;_0x34f875=0xc8;}else{_0x34f875=0xce;}_0x183b0c['status'](_0x34f875);return _0x183b0c[_0x85eb('0x20')](_0x85eb('0x21'),_0x50d2a8+'-'+_0x39ca96+'/'+_0x5dbeda)[_0x85eb('0x1b')](_0x2e5c0a);}return null;};}function patchUpdates(_0x4e8041){return function(_0x4b4b38){try{jsonpatch['apply'](_0x4b4b38,_0x4e8041,!![]);}catch(_0x55b9e4){return BPromise[_0x85eb('0x22')](_0x55b9e4);}return _0x4b4b38[_0x85eb('0x23')]();};}function saveUpdates(_0x329fc5,_0x255ca7){return function(_0x465c74){if(_0x465c74){return _0x465c74[_0x85eb('0x24')](_0x329fc5)['then'](function(_0x5491d5){return _0x5491d5;});}return null;};}function removeEntity(_0x5b48d9,_0x298e84){return function(_0x1426c8){if(_0x1426c8){return _0x1426c8[_0x85eb('0x25')]()[_0x85eb('0x26')](function(){_0x5b48d9[_0x85eb('0x1a')](0xcc)[_0x85eb('0x19')]();});}};}function handleEntityNotFound(_0x5dfc96,_0x39d3fe){return function(_0x3453cd){if(!_0x3453cd){_0x5dfc96[_0x85eb('0x27')](0x194);}return _0x3453cd;};}function handleError(_0x30e766,_0x3e2326){_0x3e2326=_0x3e2326||0x1f4;return function(_0x57a03c){logger[_0x85eb('0x28')](_0x57a03c[_0x85eb('0x29')]);if(_0x57a03c[_0x85eb('0x2a')]){delete _0x57a03c[_0x85eb('0x2a')];}_0x30e766[_0x85eb('0x1a')](_0x3e2326)[_0x85eb('0x2b')](_0x57a03c);};}exports['index']=function(_0x562792,_0x37515c){var _0x585f2a={},_0xa9b14f={},_0x5255eb={'count':0x0,'rows':[]};var _0x4229e9=_[_0x85eb('0x2c')](db[_0x85eb('0x2d')][_0x85eb('0x2e')],function(_0xa67e1c){return{'name':_0xa67e1c[_0x85eb('0x2f')],'type':_0xa67e1c[_0x85eb('0x30')]['key']};});_0xa9b14f[_0x85eb('0x31')]=_[_0x85eb('0x2c')](_0x4229e9,'name');_0xa9b14f[_0x85eb('0x32')]=_['keys'](_0x562792['query']);_0xa9b14f[_0x85eb('0x33')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],_0xa9b14f[_0x85eb('0x32')]);_0x585f2a[_0x85eb('0x35')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x562792[_0x85eb('0x32')][_0x85eb('0x36')]));_0x585f2a['attributes']=_0x585f2a[_0x85eb('0x35')][_0x85eb('0x37')]?_0x585f2a['attributes']:_0xa9b14f['model'];if(!_0x562792[_0x85eb('0x32')][_0x85eb('0x38')](_0x85eb('0x39'))){_0x585f2a[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1e')]);_0x585f2a[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1c')]);}_0x585f2a[_0x85eb('0x3a')]=qs[_0x85eb('0x3b')](_0x562792[_0x85eb('0x32')]['sort']);_0x585f2a[_0x85eb('0x3c')]=qs[_0x85eb('0x33')](_['pick'](_0x562792['query'],_0xa9b14f[_0x85eb('0x33')]),_0x4229e9);if(_0x562792[_0x85eb('0x32')]['filter']){_0x585f2a[_0x85eb('0x3c')]=_['merge'](_0x585f2a[_0x85eb('0x3c')],{'$or':_['map'](_0x4229e9,function(_0xaa27ca){if(_0xaa27ca['type']!==_0x85eb('0x3d')){var _0x5c618a={};_0x5c618a[_0xaa27ca[_0x85eb('0x2a')]]={'$like':'%'+_0x562792[_0x85eb('0x32')]['filter']+'%'};return _0x5c618a;}})});}_0x585f2a=_[_0x85eb('0x3e')]({},_0x585f2a,_0x562792['options']);var _0x2a6baa={'where':_0x585f2a[_0x85eb('0x3c')]};return db['WhatsappQueueReport'][_0x85eb('0x1f')](_0x2a6baa)['then'](function(_0x5495cf){_0x5255eb[_0x85eb('0x1f')]=_0x5495cf;if(_0x562792['query'][_0x85eb('0x3f')]){_0x585f2a[_0x85eb('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x585f2a);})[_0x85eb('0x26')](function(_0x422ec3){_0x5255eb['rows']=_0x422ec3;return _0x5255eb;})['then'](respondWithFilteredResult(_0x37515c,_0x585f2a))[_0x85eb('0x41')](handleError(_0x37515c,null));};exports[_0x85eb('0x42')]=function(_0x2211f9,_0x202681){var _0x3be961={'raw':!![],'where':{'id':_0x2211f9[_0x85eb('0x43')]['id']}},_0x5b7411={};_0x5b7411[_0x85eb('0x31')]=_[_0x85eb('0x44')](db[_0x85eb('0x2d')][_0x85eb('0x2e')]);_0x5b7411[_0x85eb('0x32')]=_[_0x85eb('0x44')](_0x2211f9[_0x85eb('0x32')]);_0x5b7411[_0x85eb('0x33')]=_['intersection'](_0x5b7411[_0x85eb('0x31')],_0x5b7411[_0x85eb('0x32')]);_0x3be961['attributes']=_[_0x85eb('0x34')](_0x5b7411[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x2211f9[_0x85eb('0x32')][_0x85eb('0x36')]));_0x3be961[_0x85eb('0x35')]=_0x3be961['attributes'][_0x85eb('0x37')]?_0x3be961[_0x85eb('0x35')]:_0x5b7411[_0x85eb('0x31')];if(_0x2211f9[_0x85eb('0x32')][_0x85eb('0x3f')]){_0x3be961[_0x85eb('0x40')]=[{'all':!![]}];}_0x3be961=_[_0x85eb('0x3e')]({},_0x3be961,_0x2211f9[_0x85eb('0x45')]);return db['WhatsappQueueReport'][_0x85eb('0x46')](_0x3be961)[_0x85eb('0x26')](handleEntityNotFound(_0x202681,null))[_0x85eb('0x26')](respondWithResult(_0x202681,null))[_0x85eb('0x41')](handleError(_0x202681,null));};exports[_0x85eb('0x47')]=function(_0x1a19c2,_0x3c387a){return db[_0x85eb('0x2d')][_0x85eb('0x47')](_0x1a19c2[_0x85eb('0x48')],{})[_0x85eb('0x26')](respondWithResult(_0x3c387a,0xc9))[_0x85eb('0x41')](handleError(_0x3c387a,null));};exports['update']=function(_0x11da79,_0x2c951b){if(_0x11da79[_0x85eb('0x48')]['id']){delete _0x11da79['body']['id'];}return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x11da79[_0x85eb('0x43')]['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x2c951b,null))[_0x85eb('0x26')](saveUpdates(_0x11da79['body'],null))[_0x85eb('0x26')](respondWithResult(_0x2c951b,null))[_0x85eb('0x41')](handleError(_0x2c951b,null));};exports[_0x85eb('0x25')]=function(_0x50e264,_0xc5cb43){return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x50e264['params']['id']}})['then'](handleEntityNotFound(_0xc5cb43,null))[_0x85eb('0x26')](removeEntity(_0xc5cb43,null))['catch'](handleError(_0xc5cb43,null));};exports['describe']=function(_0x3f0b0c,_0x593723){return db[_0x85eb('0x2d')][_0x85eb('0x49')]()['then'](respondWithResult(_0x593723,null))['catch'](handleError(_0x593723,null));}; \ No newline at end of file +var _0xbaf0=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x47e618,_0x2339d8){var _0x5af93e=function(_0x59b005){while(--_0x59b005){_0x47e618['push'](_0x47e618['shift']());}};_0x5af93e(++_0x2339d8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xcc;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0x1b')](_0xe4378c);}return _0x465dd7['status'](_0xe4378c)[_0x0baf('0x1c')]();};}function respondWithResult(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0xc8;return function(_0x1f50c3){if(_0x1f50c3){return _0x49e44b[_0x0baf('0x1d')](_0x1c76a8)[_0x0baf('0x1e')](_0x1f50c3);}};}function respondWithFilteredResult(_0xb8339e,_0x469599){return function(_0x4f80a8){if(_0x4f80a8){var _0x4cd79d=typeof _0x469599[_0x0baf('0x1f')]===_0x0baf('0x20')&&typeof _0x469599[_0x0baf('0x21')]===_0x0baf('0x20');var _0x2cf7da=_0x4f80a8[_0x0baf('0x22')];var _0x53c338=_0x4cd79d?0x0:_0x469599[_0x0baf('0x1f')];var _0xfbecec=_0x4cd79d?_0x4f80a8[_0x0baf('0x22')]:_0x469599[_0x0baf('0x1f')]+_0x469599[_0x0baf('0x21')];var _0x42b7f2;if(_0xfbecec>=_0x2cf7da){_0xfbecec=_0x2cf7da;_0x42b7f2=0xc8;}else{_0x42b7f2=0xce;}_0xb8339e['status'](_0x42b7f2);return _0xb8339e['set'](_0x0baf('0x23'),_0x53c338+'-'+_0xfbecec+'/'+_0x2cf7da)[_0x0baf('0x1e')](_0x4f80a8);}return null;};}function patchUpdates(_0x32e839){return function(_0x1848e8){try{jsonpatch[_0x0baf('0x24')](_0x1848e8,_0x32e839,!![]);}catch(_0x3e3e20){return BPromise[_0x0baf('0x25')](_0x3e3e20);}return _0x1848e8[_0x0baf('0x26')]();};}function saveUpdates(_0x2c42e2,_0x15a2c3){return function(_0x54f2fa){if(_0x54f2fa){return _0x54f2fa[_0x0baf('0x27')](_0x2c42e2)['then'](function(_0xf6c158){return _0xf6c158;});}return null;};}function removeEntity(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(_0x2ef0aa){return _0x2ef0aa['destroy']()['then'](function(){_0x5dbf00[_0x0baf('0x1d')](0xcc)[_0x0baf('0x1c')]();});}};}function handleEntityNotFound(_0x34e264,_0x19d9fd){return function(_0x3a1ba1){if(!_0x3a1ba1){_0x34e264['sendStatus'](0x194);}return _0x3a1ba1;};}function handleError(_0x448617,_0x4681c5){_0x4681c5=_0x4681c5||0x1f4;return function(_0x1ca35a){logger[_0x0baf('0x28')](_0x1ca35a[_0x0baf('0x29')]);if(_0x1ca35a[_0x0baf('0x2a')]){delete _0x1ca35a[_0x0baf('0x2a')];}_0x448617['status'](_0x4681c5)[_0x0baf('0x2b')](_0x1ca35a);};}exports[_0x0baf('0x2c')]=function(_0xcaf13d,_0x265915){var _0x55c715={},_0x29dbdf={},_0x34a58a={'count':0x0,'rows':[]};var _0x5d9d7f=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0xb4dbb1){return{'name':_0xb4dbb1[_0x0baf('0x30')],'type':_0xb4dbb1[_0x0baf('0x31')][_0x0baf('0x32')]};});_0x29dbdf['model']=_[_0x0baf('0x2d')](_0x5d9d7f,_0x0baf('0x2a'));_0x29dbdf[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0xcaf13d[_0x0baf('0x33')]);_0x29dbdf[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x29dbdf[_0x0baf('0x37')],_0x29dbdf[_0x0baf('0x33')]);_0x55c715[_0x0baf('0x38')]=_[_0x0baf('0x36')](_0x29dbdf[_0x0baf('0x37')],qs[_0x0baf('0x39')](_0xcaf13d[_0x0baf('0x33')]['fields']));_0x55c715[_0x0baf('0x38')]=_0x55c715['attributes'][_0x0baf('0x3a')]?_0x55c715[_0x0baf('0x38')]:_0x29dbdf[_0x0baf('0x37')];if(!_0xcaf13d[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3b'))){_0x55c715[_0x0baf('0x21')]=qs['limit'](_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x21')]);_0x55c715[_0x0baf('0x1f')]=qs[_0x0baf('0x1f')](_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x55c715[_0x0baf('0x3c')]=qs[_0x0baf('0x3d')](_0xcaf13d['query'][_0x0baf('0x3d')]);_0x55c715[_0x0baf('0x3e')]=qs['filters'](_[_0x0baf('0x3f')](_0xcaf13d['query'],_0x29dbdf['filters']),_0x5d9d7f);if(_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x40')]){_0x55c715['where']=_['merge'](_0x55c715[_0x0baf('0x3e')],{'$or':_[_0x0baf('0x2d')](_0x5d9d7f,function(_0x3412bc){if(_0x3412bc[_0x0baf('0x31')]!==_0x0baf('0x41')){var _0x2028ad={};_0x2028ad[_0x3412bc[_0x0baf('0x2a')]]={'$like':'%'+_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x40')]+'%'};return _0x2028ad;}})});}_0x55c715=_[_0x0baf('0x42')]({},_0x55c715,_0xcaf13d[_0x0baf('0x43')]);var _0x148540={'where':_0x55c715[_0x0baf('0x3e')]};return db[_0x0baf('0x2e')]['count'](_0x148540)[_0x0baf('0x44')](function(_0x1435d5){_0x34a58a['count']=_0x1435d5;if(_0xcaf13d[_0x0baf('0x33')][_0x0baf('0x45')]){_0x55c715[_0x0baf('0x46')]=[{'all':!![]}];}return db[_0x0baf('0x2e')][_0x0baf('0x47')](_0x55c715);})[_0x0baf('0x44')](function(_0x57b581){_0x34a58a[_0x0baf('0x48')]=_0x57b581;return _0x34a58a;})[_0x0baf('0x44')](respondWithFilteredResult(_0x265915,_0x55c715))['catch'](handleError(_0x265915,null));};exports[_0x0baf('0x49')]=function(_0x412e6f,_0x45c6aa){var _0x57903e={'raw':!![],'where':{'id':_0x412e6f[_0x0baf('0x4a')]['id']}},_0x504031={};_0x504031[_0x0baf('0x37')]=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x504031[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x412e6f[_0x0baf('0x33')]);_0x504031[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x504031['model'],_0x504031[_0x0baf('0x33')]);_0x57903e[_0x0baf('0x38')]=_[_0x0baf('0x36')](_0x504031[_0x0baf('0x37')],qs[_0x0baf('0x39')](_0x412e6f['query'][_0x0baf('0x39')]));_0x57903e[_0x0baf('0x38')]=_0x57903e[_0x0baf('0x38')][_0x0baf('0x3a')]?_0x57903e[_0x0baf('0x38')]:_0x504031['model'];if(_0x412e6f[_0x0baf('0x33')][_0x0baf('0x45')]){_0x57903e[_0x0baf('0x46')]=[{'all':!![]}];}_0x57903e=_[_0x0baf('0x42')]({},_0x57903e,_0x412e6f[_0x0baf('0x43')]);return db[_0x0baf('0x2e')][_0x0baf('0x4b')](_0x57903e)['then'](handleEntityNotFound(_0x45c6aa,null))[_0x0baf('0x44')](respondWithResult(_0x45c6aa,null))[_0x0baf('0x4c')](handleError(_0x45c6aa,null));};exports[_0x0baf('0x4d')]=function(_0x57008f,_0x3c9de3){return db[_0x0baf('0x2e')][_0x0baf('0x4d')](_0x57008f[_0x0baf('0x4e')],{})[_0x0baf('0x44')](respondWithResult(_0x3c9de3,0xc9))[_0x0baf('0x4c')](handleError(_0x3c9de3,null));};exports[_0x0baf('0x27')]=function(_0x5a54bb,_0x22c451){if(_0x5a54bb[_0x0baf('0x4e')]['id']){delete _0x5a54bb[_0x0baf('0x4e')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x5a54bb[_0x0baf('0x4a')]['id']}})[_0x0baf('0x44')](handleEntityNotFound(_0x22c451,null))[_0x0baf('0x44')](saveUpdates(_0x5a54bb[_0x0baf('0x4e')],null))[_0x0baf('0x44')](respondWithResult(_0x22c451,null))[_0x0baf('0x4c')](handleError(_0x22c451,null));};exports['destroy']=function(_0x528ff6,_0x354329){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x528ff6[_0x0baf('0x4a')]['id']}})[_0x0baf('0x44')](handleEntityNotFound(_0x354329,null))[_0x0baf('0x44')](removeEntity(_0x354329,null))[_0x0baf('0x4c')](handleError(_0x354329,null));};exports['describe']=function(_0x3fe534,_0x2ef4c1){return db[_0x0baf('0x2e')][_0x0baf('0x4f')]()[_0x0baf('0x44')](respondWithResult(_0x2ef4c1,null))[_0x0baf('0x4c')](handleError(_0x2ef4c1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index eabbc24..8396b9f 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 _0x82a2=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','report_whatsapp_queue','uniqueid','lodash'];(function(_0xd3b923,_0x55ba1f){var _0x5a308d=function(_0x2fc94d){while(--_0x2fc94d){_0xd3b923['push'](_0xd3b923['shift']());}};_0x5a308d(++_0x55ba1f);}(_0x82a2,0x112));var _0x282a=function(_0xda6336,_0x3ddd7d){_0xda6336=_0xda6336-0x0;var _0x1cdc97=_0x82a2[_0xda6336];return _0x1cdc97;};'use strict';var _=require(_0x282a('0x0'));var util=require('util');var logger=require(_0x282a('0x1'))(_0x282a('0x2'));var moment=require('moment');var BPromise=require(_0x282a('0x3'));var rp=require(_0x282a('0x4'));var fs=require('fs');var path=require(_0x282a('0x5'));var rimraf=require(_0x282a('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x282a('0x7')]=function(_0x294dd7,_0x16052c){return _0x294dd7[_0x282a('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x282a('0x9'),'paranoid':![],'indexes':[{'name':_0x282a('0xa'),'fields':[_0x282a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d80=['path','../../config/environment','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x22133a,_0x21dfc2){var _0xffab4c=function(_0x47896a){while(--_0x47896a){_0x22133a['push'](_0x22133a['shift']());}};_0xffab4c(++_0x21dfc2);}(_0x8d80,0x67));var _0x08d8=function(_0x4605c8,_0x51fb77){_0x4605c8=_0x4605c8-0x0;var _0x74025a=_0x8d80[_0x4605c8];return _0x74025a;};'use strict';var _=require(_0x08d8('0x0'));var util=require(_0x08d8('0x1'));var logger=require(_0x08d8('0x2'))(_0x08d8('0x3'));var moment=require(_0x08d8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x08d8('0x5'));var rimraf=require('rimraf');var config=require(_0x08d8('0x6'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x5bdc91,_0x478719){return _0x5bdc91['define']('WhatsappQueueReport',attributes,{'tableName':_0x08d8('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x08d8('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7c260bd..88f9702 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 _0x8b36=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','catch','UpdateWhatsappQueueReport','update','body','where','attributes','limit','util','moment','ioredis'];(function(_0x52b5c4,_0x775f3b){var _0x463ea8=function(_0x239477){while(--_0x239477){_0x52b5c4['push'](_0x52b5c4['shift']());}};_0x463ea8(++_0x775f3b);}(_0x8b36,0xf5));var _0x68b3=function(_0x323131,_0x56326f){_0x323131=_0x323131-0x0;var _0x3b0da7=_0x8b36[_0x323131];return _0x3b0da7;};'use strict';var _=require('lodash');var util=require(_0x68b3('0x0'));var moment=require(_0x68b3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68b3('0x2'));var db=require(_0x68b3('0x3'))['db'];var utils=require(_0x68b3('0x4'));var logger=require(_0x68b3('0x5'))(_0x68b3('0x6'));var config=require(_0x68b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x68b3('0x8')][_0x68b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1283b6,_0xbaf316,_0x2b10e1){return new BPromise(function(_0x3e48d4,_0x5b17ee){return client[_0x68b3('0xa')](_0x1283b6,_0x2b10e1)[_0x68b3('0xb')](function(_0x1e8dc6){logger[_0x68b3('0xc')](_0x68b3('0xd'),_0xbaf316,'request\x20sent');logger[_0x68b3('0xe')](_0x68b3('0xf'),_0xbaf316,_0x68b3('0x10'),JSON[_0x68b3('0x11')](_0x1e8dc6));if(_0x1e8dc6[_0x68b3('0x12')]){if(_0x1e8dc6[_0x68b3('0x12')]['code']===0x1f4){logger[_0x68b3('0x12')](_0x68b3('0xd'),_0xbaf316,_0x1e8dc6[_0x68b3('0x12')][_0x68b3('0x13')]);return _0x5b17ee(_0x1e8dc6[_0x68b3('0x12')][_0x68b3('0x13')]);}logger[_0x68b3('0x12')](_0x68b3('0xd'),_0xbaf316,_0x1e8dc6[_0x68b3('0x12')][_0x68b3('0x13')]);return _0x3e48d4(_0x1e8dc6['error'][_0x68b3('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0xbaf316,'request\x20sent');_0x3e48d4(_0x1e8dc6['result'][_0x68b3('0x13')]);}})['catch'](function(_0x17ee8f){logger[_0x68b3('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0xbaf316,_0x17ee8f);_0x5b17ee(_0x17ee8f);});});}exports[_0x68b3('0x14')]=function(_0x14513f){var _0x493e41=this;return new Promise(function(_0x31836f,_0x398c3f){return db[_0x68b3('0x15')]['create'](_0x14513f['body'],{'raw':_0x14513f['options']?_0x14513f[_0x68b3('0x16')][_0x68b3('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x284af9){logger[_0x68b3('0xc')](_0x68b3('0x14'),_0x14513f);logger['debug'](_0x68b3('0x14'),_0x14513f,JSON[_0x68b3('0x11')](_0x284af9));_0x31836f(_0x284af9);})[_0x68b3('0x18')](function(_0x473bf1){logger[_0x68b3('0x12')](_0x68b3('0x14'),_0x473bf1['message'],_0x14513f);_0x398c3f(_0x493e41[_0x68b3('0x12')](0x1f4,_0x473bf1[_0x68b3('0x13')]));});});};exports[_0x68b3('0x19')]=function(_0x1d1658){var _0x3fbc71=this;return new Promise(function(_0x1a535c,_0x2c667b){return db['WhatsappQueueReport'][_0x68b3('0x1a')](_0x1d1658[_0x68b3('0x1b')],{'raw':_0x1d1658[_0x68b3('0x16')]?_0x1d1658[_0x68b3('0x16')][_0x68b3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d1658[_0x68b3('0x16')]?_0x1d1658[_0x68b3('0x16')][_0x68b3('0x1c')]||null:null,'attributes':_0x1d1658[_0x68b3('0x16')]?_0x1d1658['options'][_0x68b3('0x1d')]||null:null,'limit':_0x1d1658[_0x68b3('0x16')]?_0x1d1658[_0x68b3('0x16')][_0x68b3('0x1e')]||null:null})[_0x68b3('0xb')](function(_0x9e04f6){logger[_0x68b3('0xc')](_0x68b3('0x19'),_0x1d1658);logger[_0x68b3('0xe')](_0x68b3('0x19'),_0x1d1658,JSON[_0x68b3('0x11')](_0x9e04f6));_0x1a535c(_0x9e04f6);})[_0x68b3('0x18')](function(_0x2ebaf4){logger[_0x68b3('0x12')]('UpdateWhatsappQueueReport',_0x2ebaf4[_0x68b3('0x13')],_0x1d1658);_0x2c667b(_0x3fbc71['error'](0x1f4,_0x2ebaf4[_0x68b3('0x13')]));});});}; \ No newline at end of file +var _0x2d9a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueueReport','create','body','options','raw','debug','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','where','attributes','limit','catch','util','moment','randomstring','ioredis'];(function(_0x327b21,_0x593479){var _0xa8de9e=function(_0x105dd1){while(--_0x105dd1){_0x327b21['push'](_0x327b21['shift']());}};_0xa8de9e(++_0x593479);}(_0x2d9a,0x194));var _0xa2d9=function(_0x4030d4,_0x336ab2){_0x4030d4=_0x4030d4-0x0;var _0x342e02=_0x2d9a[_0x4030d4];return _0x342e02;};'use strict';var _=require('lodash');var util=require(_0xa2d9('0x0'));var moment=require(_0xa2d9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa2d9('0x2'));var fs=require('fs');var Redis=require(_0xa2d9('0x3'));var db=require(_0xa2d9('0x4'))['db'];var utils=require(_0xa2d9('0x5'));var logger=require(_0xa2d9('0x6'))(_0xa2d9('0x7'));var config=require(_0xa2d9('0x8'));var jayson=require(_0xa2d9('0x9'));var client=jayson[_0xa2d9('0xa')][_0xa2d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d72a0,_0x5af6ea,_0x56d2c3){return new BPromise(function(_0x38a6d8,_0x237355){return client[_0xa2d9('0xc')](_0x1d72a0,_0x56d2c3)[_0xa2d9('0xd')](function(_0xcc55d9){logger[_0xa2d9('0xe')](_0xa2d9('0xf'),_0x5af6ea,_0xa2d9('0x10'));logger['debug'](_0xa2d9('0x11'),_0x5af6ea,_0xa2d9('0x10'),JSON[_0xa2d9('0x12')](_0xcc55d9));if(_0xcc55d9['error']){if(_0xcc55d9[_0xa2d9('0x13')][_0xa2d9('0x14')]===0x1f4){logger[_0xa2d9('0x13')](_0xa2d9('0xf'),_0x5af6ea,_0xcc55d9[_0xa2d9('0x13')][_0xa2d9('0x15')]);return _0x237355(_0xcc55d9['error'][_0xa2d9('0x15')]);}logger[_0xa2d9('0x13')](_0xa2d9('0xf'),_0x5af6ea,_0xcc55d9[_0xa2d9('0x13')][_0xa2d9('0x15')]);return _0x38a6d8(_0xcc55d9[_0xa2d9('0x13')][_0xa2d9('0x15')]);}else{logger[_0xa2d9('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5af6ea,_0xa2d9('0x10'));_0x38a6d8(_0xcc55d9['result'][_0xa2d9('0x15')]);}})['catch'](function(_0x548ec0){logger[_0xa2d9('0x13')](_0xa2d9('0xf'),_0x5af6ea,_0x548ec0);_0x237355(_0x548ec0);});});}exports['CreateWhatsappQueueReport']=function(_0x16c408){var _0x32918f=this;return new Promise(function(_0x4dfc4a,_0x5dd8f2){return db[_0xa2d9('0x16')][_0xa2d9('0x17')](_0x16c408[_0xa2d9('0x18')],{'raw':_0x16c408[_0xa2d9('0x19')]?_0x16c408[_0xa2d9('0x19')][_0xa2d9('0x1a')]===undefined?!![]:![]:!![]})[_0xa2d9('0xd')](function(_0x568819){logger[_0xa2d9('0xe')]('CreateWhatsappQueueReport',_0x16c408);logger[_0xa2d9('0x1b')]('CreateWhatsappQueueReport',_0x16c408,JSON[_0xa2d9('0x12')](_0x568819));_0x4dfc4a(_0x568819);})['catch'](function(_0x1f12e8){logger[_0xa2d9('0x13')](_0xa2d9('0x1c'),_0x1f12e8[_0xa2d9('0x15')],_0x16c408);_0x5dd8f2(_0x32918f[_0xa2d9('0x13')](0x1f4,_0x1f12e8['message']));});});};exports[_0xa2d9('0x1d')]=function(_0x254c96){var _0x561aa0=this;return new Promise(function(_0x281184,_0x3ac823){return db[_0xa2d9('0x16')]['update'](_0x254c96[_0xa2d9('0x18')],{'raw':_0x254c96['options']?_0x254c96[_0xa2d9('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x254c96[_0xa2d9('0x19')]?_0x254c96[_0xa2d9('0x19')][_0xa2d9('0x1e')]||null:null,'attributes':_0x254c96[_0xa2d9('0x19')]?_0x254c96[_0xa2d9('0x19')][_0xa2d9('0x1f')]||null:null,'limit':_0x254c96[_0xa2d9('0x19')]?_0x254c96[_0xa2d9('0x19')][_0xa2d9('0x20')]||null:null})[_0xa2d9('0xd')](function(_0x23d2c4){logger[_0xa2d9('0xe')](_0xa2d9('0x1d'),_0x254c96);logger[_0xa2d9('0x1b')]('UpdateWhatsappQueueReport',_0x254c96,JSON[_0xa2d9('0x12')](_0x23d2c4));_0x281184(_0x23d2c4);})[_0xa2d9('0x21')](function(_0x152518){logger[_0xa2d9('0x13')]('UpdateWhatsappQueueReport',_0x152518['message'],_0x254c96);_0x3ac823(_0x561aa0[_0xa2d9('0x13')](0x1f4,_0x152518[_0xa2d9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 15a1eed..52562ba 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 _0x1240=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','exports'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x1240,0x190));var _0x0124=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x1240[_0x819464];return _0x49dcc0;};'use strict';var multer=require(_0x0124('0x0'));var util=require(_0x0124('0x1'));var path=require(_0x0124('0x2'));var timeout=require(_0x0124('0x3'));var express=require('express');var router=express[_0x0124('0x4')]();var fs_extra=require(_0x0124('0x5'));var auth=require(_0x0124('0x6'));var interaction=require(_0x0124('0x7'));var config=require(_0x0124('0x8'));var controller=require(_0x0124('0x9'));router[_0x0124('0xa')]('/',auth[_0x0124('0xb')](),controller['index']);router[_0x0124('0xa')]('/describe',auth[_0x0124('0xb')](),controller[_0x0124('0xc')]);router['get'](_0x0124('0xd'),auth[_0x0124('0xb')](),controller[_0x0124('0xe')]);router['post']('/',auth[_0x0124('0xb')](),controller[_0x0124('0xf')]);router[_0x0124('0x10')](_0x0124('0xd'),auth['isAuthenticated'](),controller[_0x0124('0x11')]);router[_0x0124('0x12')](_0x0124('0xd'),auth[_0x0124('0xb')](),controller['destroy']);module[_0x0124('0x13')]=router; \ No newline at end of file +var _0xdc17=['index','/describe','isAuthenticated','/:id','show','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get'];(function(_0x386fd5,_0x1fb1c1){var _0x3cca3b=function(_0x5dcdc0){while(--_0x5dcdc0){_0x386fd5['push'](_0x386fd5['shift']());}};_0x3cca3b(++_0x1fb1c1);}(_0xdc17,0x105));var _0x7dc1=function(_0x4e1672,_0x492490){_0x4e1672=_0x4e1672-0x0;var _0x42bc9a=_0xdc17[_0x4e1672];return _0x42bc9a;};'use strict';var multer=require(_0x7dc1('0x0'));var util=require('util');var path=require(_0x7dc1('0x1'));var timeout=require(_0x7dc1('0x2'));var express=require('express');var router=express[_0x7dc1('0x3')]();var fs_extra=require(_0x7dc1('0x4'));var auth=require(_0x7dc1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7dc1('0x6'));var controller=require(_0x7dc1('0x7'));router[_0x7dc1('0x8')]('/',auth['isAuthenticated'](),controller[_0x7dc1('0x9')]);router['get'](_0x7dc1('0xa'),auth[_0x7dc1('0xb')](),controller['describe']);router[_0x7dc1('0x8')](_0x7dc1('0xc'),auth[_0x7dc1('0xb')](),controller[_0x7dc1('0xd')]);router['post']('/',auth[_0x7dc1('0xb')](),controller['create']);router[_0x7dc1('0xe')](_0x7dc1('0xc'),auth[_0x7dc1('0xb')](),controller[_0x7dc1('0xf')]);router['delete'](_0x7dc1('0xc'),auth['isAuthenticated'](),controller[_0x7dc1('0x10')]);module[_0x7dc1('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 524c2f3..7143d5b 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 _0x566f=['account','agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x2077c2,_0x5f57a3){var _0x34bb69=function(_0xaa8099){while(--_0xaa8099){_0x2077c2['push'](_0x2077c2['shift']());}};_0x34bb69(++_0x5f57a3);}(_0x566f,0x124));var _0xf566=function(_0x3fbb76,_0x486d88){_0x3fbb76=_0x3fbb76-0x0;var _0x28692f=_0x566f[_0x3fbb76];return _0x28692f;};'use strict';var Sequelize=require(_0xf566('0x0'));module[_0xf566('0x1')]={'uniqueid':{'type':Sequelize[_0xf566('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf566('0x3')](_0xf566('0x4'),_0xf566('0x5'),_0xf566('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf566('0x7')]}}; \ No newline at end of file +var _0x8ff9=['STRING','ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x1419ce,_0x247f9f){var _0x43bafc=function(_0xeb529e){while(--_0xeb529e){_0x1419ce['push'](_0x1419ce['shift']());}};_0x43bafc(++_0x247f9f);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x3afe4b,_0x1ccc0c){_0x3afe4b=_0x3afe4b-0x0;var _0x5896c7=_0x8ff9[_0x3afe4b];return _0x5896c7;};'use strict';var Sequelize=require(_0x98ff('0x0'));module[_0x98ff('0x1')]={'uniqueid':{'type':Sequelize[_0x98ff('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x98ff('0x3')](_0x98ff('0x4'),_0x98ff('0x5'),_0x98ff('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x98ff('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 44a8d46..5aa6808 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 _0x28f2=['where','pick','filter','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','merge','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x28f2,0x193));var _0x228f=function(_0x38fc04,_0x4a6f58){_0x38fc04=_0x38fc04-0x0;var _0x1b3cee=_0x28f2[_0x38fc04];return _0x1b3cee;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];function respondWithStatusCode(_0x24f69c,_0x14073a){_0x14073a=_0x14073a||0xcc;return function(_0x2e1a43){if(_0x2e1a43){return _0x24f69c[_0x228f('0x1a')](_0x14073a);}return _0x24f69c[_0x228f('0x1b')](_0x14073a)[_0x228f('0x1c')]();};}function respondWithResult(_0x572535,_0x2fab95){_0x2fab95=_0x2fab95||0xc8;return function(_0xfb6aff){if(_0xfb6aff){return _0x572535[_0x228f('0x1b')](_0x2fab95)[_0x228f('0x1d')](_0xfb6aff);}};}function respondWithFilteredResult(_0x2a4d87,_0x21a913){return function(_0x272723){if(_0x272723){var _0x5b5abb=typeof _0x21a913[_0x228f('0x1e')]==='undefined'&&typeof _0x21a913[_0x228f('0x1f')]===_0x228f('0x20');var _0x195e65=_0x272723['count'];var _0x2d4819=_0x5b5abb?0x0:_0x21a913['offset'];var _0x33e32e=_0x5b5abb?_0x272723['count']:_0x21a913[_0x228f('0x1e')]+_0x21a913['limit'];var _0x5aa203;if(_0x33e32e>=_0x195e65){_0x33e32e=_0x195e65;_0x5aa203=0xc8;}else{_0x5aa203=0xce;}_0x2a4d87[_0x228f('0x1b')](_0x5aa203);return _0x2a4d87['set'](_0x228f('0x21'),_0x2d4819+'-'+_0x33e32e+'/'+_0x195e65)[_0x228f('0x1d')](_0x272723);}return null;};}function patchUpdates(_0x1294a8){return function(_0x3a623a){try{jsonpatch[_0x228f('0x22')](_0x3a623a,_0x1294a8,!![]);}catch(_0x313cf2){return BPromise[_0x228f('0x23')](_0x313cf2);}return _0x3a623a[_0x228f('0x24')]();};}function saveUpdates(_0x15d54f,_0x4ee0c9){return function(_0x1e96d4){if(_0x1e96d4){return _0x1e96d4[_0x228f('0x25')](_0x15d54f)[_0x228f('0x26')](function(_0x3c00ad){return _0x3c00ad;});}return null;};}function removeEntity(_0x1dad27,_0x194d1a){return function(_0x33e882){if(_0x33e882){return _0x33e882[_0x228f('0x27')]()[_0x228f('0x26')](function(){_0x1dad27['status'](0xcc)[_0x228f('0x1c')]();});}};}function handleEntityNotFound(_0x306928,_0x2b3553){return function(_0x272c7d){if(!_0x272c7d){_0x306928[_0x228f('0x1a')](0x194);}return _0x272c7d;};}function handleError(_0x539faa,_0xe8aac){_0xe8aac=_0xe8aac||0x1f4;return function(_0x49efe9){logger[_0x228f('0x28')](_0x49efe9['stack']);if(_0x49efe9['name']){delete _0x49efe9[_0x228f('0x29')];}_0x539faa[_0x228f('0x1b')](_0xe8aac)[_0x228f('0x2a')](_0x49efe9);};}exports[_0x228f('0x2b')]=function(_0x34c735,_0x2c964e){var _0x2eaf4f={},_0x2511e5={},_0xe67c83={'count':0x0,'rows':[]};var _0x2f13d9=_[_0x228f('0x2c')](db[_0x228f('0x2d')][_0x228f('0x2e')],function(_0xc6921f){return{'name':_0xc6921f[_0x228f('0x2f')],'type':_0xc6921f['type'][_0x228f('0x30')]};});_0x2511e5[_0x228f('0x31')]=_[_0x228f('0x2c')](_0x2f13d9,'name');_0x2511e5[_0x228f('0x32')]=_[_0x228f('0x33')](_0x34c735['query']);_0x2511e5[_0x228f('0x34')]=_[_0x228f('0x35')](_0x2511e5[_0x228f('0x31')],_0x2511e5[_0x228f('0x32')]);_0x2eaf4f['attributes']=_[_0x228f('0x35')](_0x2511e5['model'],qs[_0x228f('0x36')](_0x34c735[_0x228f('0x32')][_0x228f('0x36')]));_0x2eaf4f[_0x228f('0x37')]=_0x2eaf4f['attributes'][_0x228f('0x38')]?_0x2eaf4f[_0x228f('0x37')]:_0x2511e5['model'];if(!_0x34c735['query']['hasOwnProperty'](_0x228f('0x39'))){_0x2eaf4f[_0x228f('0x1f')]=qs[_0x228f('0x1f')](_0x34c735[_0x228f('0x32')][_0x228f('0x1f')]);_0x2eaf4f[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0x34c735[_0x228f('0x32')][_0x228f('0x1e')]);}_0x2eaf4f['order']=qs['sort'](_0x34c735[_0x228f('0x32')][_0x228f('0x3a')]);_0x2eaf4f[_0x228f('0x3b')]=qs[_0x228f('0x34')](_[_0x228f('0x3c')](_0x34c735[_0x228f('0x32')],_0x2511e5[_0x228f('0x34')]),_0x2f13d9);if(_0x34c735[_0x228f('0x32')][_0x228f('0x3d')]){_0x2eaf4f[_0x228f('0x3b')]=_['merge'](_0x2eaf4f['where'],{'$or':_[_0x228f('0x2c')](_0x2f13d9,function(_0x29a250){if(_0x29a250[_0x228f('0x3e')]!==_0x228f('0x3f')){var _0x5b7b44={};_0x5b7b44[_0x29a250[_0x228f('0x29')]]={'$like':'%'+_0x34c735[_0x228f('0x32')]['filter']+'%'};return _0x5b7b44;}})});}_0x2eaf4f=_['merge']({},_0x2eaf4f,_0x34c735[_0x228f('0x40')]);var _0x2f6f54={'where':_0x2eaf4f['where']};return db[_0x228f('0x2d')][_0x228f('0x41')](_0x2f6f54)['then'](function(_0x536166){_0xe67c83[_0x228f('0x41')]=_0x536166;if(_0x34c735['query'][_0x228f('0x42')]){_0x2eaf4f[_0x228f('0x43')]=[{'all':!![]}];}return db[_0x228f('0x2d')][_0x228f('0x44')](_0x2eaf4f);})[_0x228f('0x26')](function(_0x20c178){_0xe67c83['rows']=_0x20c178;return _0xe67c83;})[_0x228f('0x26')](respondWithFilteredResult(_0x2c964e,_0x2eaf4f))['catch'](handleError(_0x2c964e,null));};exports[_0x228f('0x45')]=function(_0xc59d9b,_0x285af1){var _0x96126c={'raw':!![],'where':{'id':_0xc59d9b[_0x228f('0x46')]['id']}},_0x41cba5={};_0x41cba5[_0x228f('0x31')]=_[_0x228f('0x33')](db[_0x228f('0x2d')][_0x228f('0x2e')]);_0x41cba5[_0x228f('0x32')]=_[_0x228f('0x33')](_0xc59d9b[_0x228f('0x32')]);_0x41cba5['filters']=_['intersection'](_0x41cba5[_0x228f('0x31')],_0x41cba5[_0x228f('0x32')]);_0x96126c[_0x228f('0x37')]=_[_0x228f('0x35')](_0x41cba5[_0x228f('0x31')],qs[_0x228f('0x36')](_0xc59d9b[_0x228f('0x32')][_0x228f('0x36')]));_0x96126c[_0x228f('0x37')]=_0x96126c[_0x228f('0x37')]['length']?_0x96126c[_0x228f('0x37')]:_0x41cba5[_0x228f('0x31')];if(_0xc59d9b['query'][_0x228f('0x42')]){_0x96126c['include']=[{'all':!![]}];}_0x96126c=_[_0x228f('0x47')]({},_0x96126c,_0xc59d9b['options']);return db[_0x228f('0x2d')]['find'](_0x96126c)[_0x228f('0x26')](handleEntityNotFound(_0x285af1,null))[_0x228f('0x26')](respondWithResult(_0x285af1,null))[_0x228f('0x48')](handleError(_0x285af1,null));};exports[_0x228f('0x49')]=function(_0x3dea4e,_0x2e0054){return db[_0x228f('0x2d')][_0x228f('0x49')](_0x3dea4e[_0x228f('0x4a')],{})[_0x228f('0x26')](respondWithResult(_0x2e0054,0xc9))[_0x228f('0x48')](handleError(_0x2e0054,null));};exports[_0x228f('0x25')]=function(_0x4099d4,_0x250345){if(_0x4099d4[_0x228f('0x4a')]['id']){delete _0x4099d4[_0x228f('0x4a')]['id'];}return db[_0x228f('0x2d')][_0x228f('0x4b')]({'where':{'id':_0x4099d4[_0x228f('0x46')]['id']}})['then'](handleEntityNotFound(_0x250345,null))['then'](saveUpdates(_0x4099d4[_0x228f('0x4a')],null))[_0x228f('0x26')](respondWithResult(_0x250345,null))[_0x228f('0x48')](handleError(_0x250345,null));};exports['destroy']=function(_0x17bcd9,_0x9750ca){return db[_0x228f('0x2d')]['find']({'where':{'id':_0x17bcd9['params']['id']}})['then'](handleEntityNotFound(_0x9750ca,null))[_0x228f('0x26')](removeEntity(_0x9750ca,null))[_0x228f('0x48')](handleError(_0x9750ca,null));};exports[_0x228f('0x4c')]=function(_0x466a2b,_0x42036c){return db[_0x228f('0x2d')][_0x228f('0x4c')]()[_0x228f('0x26')](respondWithResult(_0x42036c,null))[_0x228f('0x48')](handleError(_0x42036c,null));}; \ No newline at end of file +var _0x8ae0=['request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','WhatsappTransferReport','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0x8ae0,0x169));var _0x08ae=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8ae0[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x08ae('0x0'));var rimraf=require(_0x08ae('0x1'));var zipdir=require(_0x08ae('0x2'));var jsonpatch=require(_0x08ae('0x3'));var rp=require(_0x08ae('0x4'));var moment=require(_0x08ae('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x08ae('0x6'));var path=require(_0x08ae('0x7'));var sox=require('sox');var csv=require(_0x08ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08ae('0x9'));var _=require(_0x08ae('0xa'));var squel=require(_0x08ae('0xb'));var crypto=require(_0x08ae('0xc'));var jsforce=require(_0x08ae('0xd'));var deskjs=require(_0x08ae('0xe'));var toCsv=require(_0x08ae('0x8'));var querystring=require('querystring');var Papa=require(_0x08ae('0xf'));var Redis=require(_0x08ae('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08ae('0x11'));var logger=require(_0x08ae('0x12'))(_0x08ae('0x13'));var utils=require(_0x08ae('0x14'));var config=require(_0x08ae('0x15'));var licenseUtil=require(_0x08ae('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d0946,_0x56a5a9){_0x56a5a9=_0x56a5a9||0xcc;return function(_0x38ff87){if(_0x38ff87){return _0x5d0946[_0x08ae('0x17')](_0x56a5a9);}return _0x5d0946[_0x08ae('0x18')](_0x56a5a9)['end']();};}function respondWithResult(_0x4c4d3c,_0x1308ac){_0x1308ac=_0x1308ac||0xc8;return function(_0x48a00d){if(_0x48a00d){return _0x4c4d3c[_0x08ae('0x18')](_0x1308ac)[_0x08ae('0x19')](_0x48a00d);}};}function respondWithFilteredResult(_0x203f2c,_0x20e265){return function(_0x333a72){if(_0x333a72){var _0x2a6d0a=typeof _0x20e265[_0x08ae('0x1a')]===_0x08ae('0x1b')&&typeof _0x20e265[_0x08ae('0x1c')]==='undefined';var _0x532b73=_0x333a72['count'];var _0x3d99e3=_0x2a6d0a?0x0:_0x20e265[_0x08ae('0x1a')];var _0x2360e6=_0x2a6d0a?_0x333a72[_0x08ae('0x1d')]:_0x20e265[_0x08ae('0x1a')]+_0x20e265['limit'];var _0x17eb93;if(_0x2360e6>=_0x532b73){_0x2360e6=_0x532b73;_0x17eb93=0xc8;}else{_0x17eb93=0xce;}_0x203f2c[_0x08ae('0x18')](_0x17eb93);return _0x203f2c['set'](_0x08ae('0x1e'),_0x3d99e3+'-'+_0x2360e6+'/'+_0x532b73)[_0x08ae('0x19')](_0x333a72);}return null;};}function patchUpdates(_0x188477){return function(_0x5a6f1a){try{jsonpatch[_0x08ae('0x1f')](_0x5a6f1a,_0x188477,!![]);}catch(_0xa972e4){return BPromise[_0x08ae('0x20')](_0xa972e4);}return _0x5a6f1a['save']();};}function saveUpdates(_0x41ab69,_0x2a84ba){return function(_0x35d0d0){if(_0x35d0d0){return _0x35d0d0[_0x08ae('0x21')](_0x41ab69)[_0x08ae('0x22')](function(_0x408f2c){return _0x408f2c;});}return null;};}function removeEntity(_0x2e493d,_0x1ca296){return function(_0xa442e0){if(_0xa442e0){return _0xa442e0[_0x08ae('0x23')]()[_0x08ae('0x22')](function(){_0x2e493d[_0x08ae('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ad251,_0x1e8943){return function(_0x34dc53){if(!_0x34dc53){_0x3ad251[_0x08ae('0x17')](0x194);}return _0x34dc53;};}function handleError(_0x465695,_0x17e877){_0x17e877=_0x17e877||0x1f4;return function(_0x4739b0){logger[_0x08ae('0x24')](_0x4739b0[_0x08ae('0x25')]);if(_0x4739b0[_0x08ae('0x26')]){delete _0x4739b0['name'];}_0x465695[_0x08ae('0x18')](_0x17e877)[_0x08ae('0x27')](_0x4739b0);};}exports[_0x08ae('0x28')]=function(_0x1cd98d,_0x5a18f9){var _0x42e4a8={},_0x370293={},_0x47fb41={'count':0x0,'rows':[]};var _0x29f289=_[_0x08ae('0x29')](db['WhatsappTransferReport'][_0x08ae('0x2a')],function(_0x36872d){return{'name':_0x36872d['fieldName'],'type':_0x36872d[_0x08ae('0x2b')][_0x08ae('0x2c')]};});_0x370293[_0x08ae('0x2d')]=_['map'](_0x29f289,_0x08ae('0x26'));_0x370293[_0x08ae('0x2e')]=_['keys'](_0x1cd98d[_0x08ae('0x2e')]);_0x370293[_0x08ae('0x2f')]=_[_0x08ae('0x30')](_0x370293[_0x08ae('0x2d')],_0x370293[_0x08ae('0x2e')]);_0x42e4a8['attributes']=_[_0x08ae('0x30')](_0x370293[_0x08ae('0x2d')],qs[_0x08ae('0x31')](_0x1cd98d[_0x08ae('0x2e')][_0x08ae('0x31')]));_0x42e4a8[_0x08ae('0x32')]=_0x42e4a8[_0x08ae('0x32')][_0x08ae('0x33')]?_0x42e4a8[_0x08ae('0x32')]:_0x370293[_0x08ae('0x2d')];if(!_0x1cd98d[_0x08ae('0x2e')][_0x08ae('0x34')](_0x08ae('0x35'))){_0x42e4a8['limit']=qs['limit'](_0x1cd98d['query'][_0x08ae('0x1c')]);_0x42e4a8[_0x08ae('0x1a')]=qs[_0x08ae('0x1a')](_0x1cd98d[_0x08ae('0x2e')]['offset']);}_0x42e4a8[_0x08ae('0x36')]=qs[_0x08ae('0x37')](_0x1cd98d['query']['sort']);_0x42e4a8[_0x08ae('0x38')]=qs[_0x08ae('0x2f')](_['pick'](_0x1cd98d['query'],_0x370293[_0x08ae('0x2f')]),_0x29f289);if(_0x1cd98d['query']['filter']){_0x42e4a8[_0x08ae('0x38')]=_[_0x08ae('0x39')](_0x42e4a8[_0x08ae('0x38')],{'$or':_[_0x08ae('0x29')](_0x29f289,function(_0x2d71fc){if(_0x2d71fc[_0x08ae('0x2b')]!=='VIRTUAL'){var _0x356509={};_0x356509[_0x2d71fc[_0x08ae('0x26')]]={'$like':'%'+_0x1cd98d['query'][_0x08ae('0x3a')]+'%'};return _0x356509;}})});}_0x42e4a8=_['merge']({},_0x42e4a8,_0x1cd98d[_0x08ae('0x3b')]);var _0x5c7d86={'where':_0x42e4a8[_0x08ae('0x38')]};return db[_0x08ae('0x3c')][_0x08ae('0x1d')](_0x5c7d86)[_0x08ae('0x22')](function(_0x5e9ce6){_0x47fb41[_0x08ae('0x1d')]=_0x5e9ce6;if(_0x1cd98d[_0x08ae('0x2e')]['includeAll']){_0x42e4a8[_0x08ae('0x3d')]=[{'all':!![]}];}return db[_0x08ae('0x3c')][_0x08ae('0x3e')](_0x42e4a8);})[_0x08ae('0x22')](function(_0x3af92d){_0x47fb41[_0x08ae('0x3f')]=_0x3af92d;return _0x47fb41;})['then'](respondWithFilteredResult(_0x5a18f9,_0x42e4a8))[_0x08ae('0x40')](handleError(_0x5a18f9,null));};exports[_0x08ae('0x41')]=function(_0x574216,_0x14c4fe){var _0x3b4915={'raw':!![],'where':{'id':_0x574216[_0x08ae('0x42')]['id']}},_0xcde6ee={};_0xcde6ee['model']=_[_0x08ae('0x43')](db['WhatsappTransferReport']['rawAttributes']);_0xcde6ee[_0x08ae('0x2e')]=_[_0x08ae('0x43')](_0x574216[_0x08ae('0x2e')]);_0xcde6ee[_0x08ae('0x2f')]=_[_0x08ae('0x30')](_0xcde6ee[_0x08ae('0x2d')],_0xcde6ee['query']);_0x3b4915[_0x08ae('0x32')]=_[_0x08ae('0x30')](_0xcde6ee[_0x08ae('0x2d')],qs[_0x08ae('0x31')](_0x574216[_0x08ae('0x2e')][_0x08ae('0x31')]));_0x3b4915['attributes']=_0x3b4915[_0x08ae('0x32')]['length']?_0x3b4915[_0x08ae('0x32')]:_0xcde6ee[_0x08ae('0x2d')];if(_0x574216['query'][_0x08ae('0x44')]){_0x3b4915['include']=[{'all':!![]}];}_0x3b4915=_['merge']({},_0x3b4915,_0x574216[_0x08ae('0x3b')]);return db['WhatsappTransferReport']['find'](_0x3b4915)[_0x08ae('0x22')](handleEntityNotFound(_0x14c4fe,null))['then'](respondWithResult(_0x14c4fe,null))[_0x08ae('0x40')](handleError(_0x14c4fe,null));};exports['create']=function(_0x1e5be1,_0x1e072d){return db[_0x08ae('0x3c')][_0x08ae('0x45')](_0x1e5be1[_0x08ae('0x46')],{})[_0x08ae('0x22')](respondWithResult(_0x1e072d,0xc9))[_0x08ae('0x40')](handleError(_0x1e072d,null));};exports[_0x08ae('0x21')]=function(_0x594517,_0x2ef109){if(_0x594517[_0x08ae('0x46')]['id']){delete _0x594517[_0x08ae('0x46')]['id'];}return db[_0x08ae('0x3c')][_0x08ae('0x47')]({'where':{'id':_0x594517[_0x08ae('0x42')]['id']}})[_0x08ae('0x22')](handleEntityNotFound(_0x2ef109,null))[_0x08ae('0x22')](saveUpdates(_0x594517[_0x08ae('0x46')],null))[_0x08ae('0x22')](respondWithResult(_0x2ef109,null))[_0x08ae('0x40')](handleError(_0x2ef109,null));};exports[_0x08ae('0x23')]=function(_0x3236a0,_0x23eac7){return db[_0x08ae('0x3c')]['find']({'where':{'id':_0x3236a0['params']['id']}})['then'](handleEntityNotFound(_0x23eac7,null))[_0x08ae('0x22')](removeEntity(_0x23eac7,null))['catch'](handleError(_0x23eac7,null));};exports['describe']=function(_0x56c021,_0x149c4a){return db[_0x08ae('0x3c')][_0x08ae('0x48')]()[_0x08ae('0x22')](respondWithResult(_0x149c4a,null))[_0x08ae('0x40')](handleError(_0x149c4a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 61cd3bd..d638f7f 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 _0x7a9e=['lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a9e,0xc0));var _0xe7a9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7a9e[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xe7a9('0x0'));var util=require('util');var logger=require(_0xe7a9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe7a9('0x2'));var rp=require(_0xe7a9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7a9('0x4'));var config=require(_0xe7a9('0x5'));var attributes=require(_0xe7a9('0x6'));module[_0xe7a9('0x7')]=function(_0x173778,_0x14e915){return _0x173778[_0xe7a9('0x8')](_0xe7a9('0x9'),attributes,{'tableName':_0xe7a9('0xa'),'paranoid':![],'indexes':[{'name':_0xe7a9('0xb'),'fields':[_0xe7a9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x646d=['WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x646d,0x71));var _0xd646=function(_0x124f73,_0x148b82){_0x124f73=_0x124f73-0x0;var _0x4d42d3=_0x646d[_0x124f73];return _0x4d42d3;};'use strict';var _=require('lodash');var util=require(_0xd646('0x0'));var logger=require(_0xd646('0x1'))(_0xd646('0x2'));var moment=require('moment');var BPromise=require(_0xd646('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd646('0x4'));var config=require(_0xd646('0x5'));var attributes=require(_0xd646('0x6'));module[_0xd646('0x7')]=function(_0x26c305,_0x17a317){return _0x26c305['define'](_0xd646('0x8'),attributes,{'tableName':_0xd646('0x9'),'paranoid':![],'indexes':[{'name':_0xd646('0xa'),'fields':[_0xd646('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 0851973..6ef0b39 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 _0x15a3=['then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x292716,_0x96d32){var _0x34cb57=function(_0x1d0cde){while(--_0x1d0cde){_0x292716['push'](_0x292716['shift']());}};_0x34cb57(++_0x96d32);}(_0x15a3,0x18c));var _0x315a=function(_0x18f82b,_0x3ea7a0){_0x18f82b=_0x18f82b-0x0;var _0x5d8128=_0x15a3[_0x18f82b];return _0x5d8128;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x315a('0x0'));var BPromise=require(_0x315a('0x1'));var rs=require(_0x315a('0x2'));var fs=require('fs');var Redis=require(_0x315a('0x3'));var db=require(_0x315a('0x4'))['db'];var utils=require(_0x315a('0x5'));var logger=require('../../config/logger')(_0x315a('0x6'));var config=require(_0x315a('0x7'));var jayson=require(_0x315a('0x8'));var client=jayson[_0x315a('0x9')][_0x315a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x193d57,_0x299c50,_0x180434){return new BPromise(function(_0x2679b7,_0x55a60e){return client[_0x315a('0xb')](_0x193d57,_0x180434)[_0x315a('0xc')](function(_0x41b9ff){logger[_0x315a('0xd')](_0x315a('0xe'),_0x299c50,_0x315a('0xf'));logger[_0x315a('0x10')](_0x315a('0x11'),_0x299c50,_0x315a('0xf'),JSON[_0x315a('0x12')](_0x41b9ff));if(_0x41b9ff[_0x315a('0x13')]){if(_0x41b9ff[_0x315a('0x13')][_0x315a('0x14')]===0x1f4){logger[_0x315a('0x13')](_0x315a('0xe'),_0x299c50,_0x41b9ff['error'][_0x315a('0x15')]);return _0x55a60e(_0x41b9ff[_0x315a('0x13')][_0x315a('0x15')]);}logger[_0x315a('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x299c50,_0x41b9ff['error']['message']);return _0x2679b7(_0x41b9ff[_0x315a('0x13')][_0x315a('0x15')]);}else{logger['info'](_0x315a('0xe'),_0x299c50,'request\x20sent');_0x2679b7(_0x41b9ff[_0x315a('0x16')]['message']);}})[_0x315a('0x17')](function(_0x565877){logger[_0x315a('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x299c50,_0x565877);_0x55a60e(_0x565877);});});} \ No newline at end of file +var _0x516a=['error','code','message','request\x20sent','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x27b341,_0x2fa117){var _0x377b2a=function(_0x1ac69e){while(--_0x1ac69e){_0x27b341['push'](_0x27b341['shift']());}};_0x377b2a(++_0x2fa117);}(_0x516a,0xe2));var _0xa516=function(_0x1d2730,_0x3f983c){_0x1d2730=_0x1d2730-0x0;var _0x33df87=_0x516a[_0x1d2730];return _0x33df87;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa516('0x0'));var BPromise=require('bluebird');var rs=require(_0xa516('0x1'));var fs=require('fs');var Redis=require(_0xa516('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa516('0x3'));var logger=require(_0xa516('0x4'))(_0xa516('0x5'));var config=require('../../config/environment');var jayson=require(_0xa516('0x6'));var client=jayson[_0xa516('0x7')][_0xa516('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18b544,_0x2b5bcb,_0x460754){return new BPromise(function(_0xd07947,_0xd10d1e){return client[_0xa516('0x9')](_0x18b544,_0x460754)[_0xa516('0xa')](function(_0x3db63c){logger[_0xa516('0xb')](_0xa516('0xc'),_0x2b5bcb,'request\x20sent');logger[_0xa516('0xd')](_0xa516('0xe'),_0x2b5bcb,'request\x20sent',JSON[_0xa516('0xf')](_0x3db63c));if(_0x3db63c[_0xa516('0x10')]){if(_0x3db63c[_0xa516('0x10')][_0xa516('0x11')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x2b5bcb,_0x3db63c[_0xa516('0x10')][_0xa516('0x12')]);return _0xd10d1e(_0x3db63c[_0xa516('0x10')][_0xa516('0x12')]);}logger['error'](_0xa516('0xc'),_0x2b5bcb,_0x3db63c[_0xa516('0x10')][_0xa516('0x12')]);return _0xd07947(_0x3db63c['error'][_0xa516('0x12')]);}else{logger[_0xa516('0xb')](_0xa516('0xc'),_0x2b5bcb,_0xa516('0x13'));_0xd07947(_0x3db63c[_0xa516('0x14')][_0xa516('0x12')]);}})[_0xa516('0x15')](function(_0x3707f0){logger['error'](_0xa516('0xc'),_0x2b5bcb,_0x3707f0);_0xd10d1e(_0x3707f0);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index f7404e7..31c6437 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5aaa=['sync','default','then','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','map','online','Offline\x20apps:','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize'];(function(_0x5ae0e4,_0x2d4de5){var _0x422e8b=function(_0x507e65){while(--_0x507e65){_0x5ae0e4['push'](_0x5ae0e4['shift']());}};_0x422e8b(++_0x2d4de5);}(_0x5aaa,0xff));var _0xa5aa=function(_0x1dd404,_0x56ff97){_0x1dd404=_0x1dd404-0x0;var _0x5af874=_0x5aaa[_0x1dd404];return _0x5af874;};'use strict';var _=require(_0xa5aa('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xa5aa('0x1'))(_0xa5aa('0x2'));var pm2=require(_0xa5aa('0x3'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xa5aa('0x4'));var chat=require(_0xa5aa('0x5'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xa5aa('0x6'));var provider=require(_0xa5aa('0x7'));function main(){return db[_0xa5aa('0x8')][_0xa5aa('0x9')]()['then'](function(){if(config['seedDB']){return seedDb[_0xa5aa('0xa')]();}})[_0xa5aa('0xb')](function(){return checkLicense[_0xa5aa('0xa')]();})['then'](function(){return rpc['listen']();})['then'](function(_0x119692){logger['info'](_0x119692);return chat[_0xa5aa('0xc')]();})[_0xa5aa('0xb')](function(){return whatsapp[_0xa5aa('0xc')]();})[_0xa5aa('0xb')](function(){return schedule[_0xa5aa('0xc')]();})['then'](function(){return transcribe[_0xa5aa('0xc')]();})[_0xa5aa('0xb')](function(){return provider[_0xa5aa('0xc')]();})[_0xa5aa('0xb')](function(_0x4d317e){logger[_0xa5aa('0xd')](_0x4d317e);return pm2[_0xa5aa('0xc')](pm2Config);})[_0xa5aa('0xb')](function(_0x4c42c7){var _0x190608=_0x4c42c7[_0xa5aa('0xe')](function(_0x42bed9){return typeof _0x42bed9[_0xa5aa('0xf')]===_0xa5aa('0x10')&&_0x42bed9[_0xa5aa('0xf')]>=0x0;});if(_0x190608[_0xa5aa('0x11')]>0x0){throw new Error(_0x190608['length']+_0xa5aa('0x12')+_['map'](_0x190608,function(_0x5bb59d){return'\x22'+_0x5bb59d[_0xa5aa('0x13')][_0xa5aa('0x14')]+'\x22';}));}logger[_0xa5aa('0xd')](_0xa5aa('0x15'),_[_0xa5aa('0x16')](_[_0xa5aa('0xe')](_0x4c42c7,{'status':_0xa5aa('0x17')}),_0xa5aa('0x14'))['join']());logger[_0xa5aa('0xd')](_0xa5aa('0x18'),_['map'](_[_0xa5aa('0xe')](_0x4c42c7,function(_0xafd25b){return _0xafd25b['status']!==_0xa5aa('0x17');}),_0xa5aa('0x14'))[_0xa5aa('0x19')]()||_0xa5aa('0x1a'));console[_0xa5aa('0x1b')](_0xa5aa('0x1c'));})[_0xa5aa('0x1d')](function(_0x3a926b){console[_0xa5aa('0x1b')](_0xa5aa('0x1e'),_0x3a926b);logger['error'](_0xa5aa('0x1f'),_0x3a926b);process[_0xa5aa('0x20')](0x1);});}main(); \ No newline at end of file +var _0xb4c7=['info','start','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','listen'];(function(_0x1a5687,_0xc2188f){var _0x257d5c=function(_0x4a1783){while(--_0x4a1783){_0x1a5687['push'](_0x1a5687['shift']());}};_0x257d5c(++_0xc2188f);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x22477d,_0x4f535b){_0x22477d=_0x22477d-0x0;var _0x2d19f3=_0xb4c7[_0x22477d];return _0x2d19f3;};'use strict';var _=require(_0x7b4c('0x0'));var db=require(_0x7b4c('0x1'))['db'];var seedDb=require(_0x7b4c('0x2'));var checkLicense=require(_0x7b4c('0x3'));var rpc=require(_0x7b4c('0x4'));var config=require('./config/environment');var logger=require(_0x7b4c('0x5'))(_0x7b4c('0x6'));var pm2=require(_0x7b4c('0x7'));var pm2Config=require(_0x7b4c('0x8'));var schedule=require(_0x7b4c('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x7b4c('0xa'));var transcribe=require(_0x7b4c('0xb'));var provider=require(_0x7b4c('0xc'));function main(){return db['sequelize'][_0x7b4c('0xd')]()[_0x7b4c('0xe')](function(){if(config['seedDB']){return seedDb[_0x7b4c('0xf')]();}})[_0x7b4c('0xe')](function(){return checkLicense[_0x7b4c('0xf')]();})[_0x7b4c('0xe')](function(){return rpc[_0x7b4c('0x10')]();})[_0x7b4c('0xe')](function(_0x1a996f){logger[_0x7b4c('0x11')](_0x1a996f);return chat[_0x7b4c('0x12')]();})[_0x7b4c('0xe')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0x7b4c('0x12')]();})[_0x7b4c('0xe')](function(){return transcribe[_0x7b4c('0x12')]();})[_0x7b4c('0xe')](function(){return provider[_0x7b4c('0x12')]();})[_0x7b4c('0xe')](function(_0x3ea0da){logger[_0x7b4c('0x11')](_0x3ea0da);return pm2[_0x7b4c('0x12')](pm2Config);})[_0x7b4c('0xe')](function(_0x593a19){var _0x2edb77=_0x593a19[_0x7b4c('0x13')](function(_0xdc71cd){return typeof _0xdc71cd[_0x7b4c('0x14')]===_0x7b4c('0x15')&&_0xdc71cd[_0x7b4c('0x14')]>=0x0;});if(_0x2edb77[_0x7b4c('0x16')]>0x0){throw new Error(_0x2edb77[_0x7b4c('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x7b4c('0x17')](_0x2edb77,function(_0xe71d88){return'\x22'+_0xe71d88[_0x7b4c('0x18')][_0x7b4c('0x19')]+'\x22';}));}logger['info'](_0x7b4c('0x1a'),_[_0x7b4c('0x17')](_[_0x7b4c('0x13')](_0x593a19,{'status':_0x7b4c('0x1b')}),_0x7b4c('0x19'))[_0x7b4c('0x1c')]());logger[_0x7b4c('0x11')](_0x7b4c('0x1d'),_[_0x7b4c('0x17')](_['filter'](_0x593a19,function(_0x1f06ec){return _0x1f06ec[_0x7b4c('0x1e')]!==_0x7b4c('0x1b');}),_0x7b4c('0x19'))[_0x7b4c('0x1c')]()||_0x7b4c('0x1f'));console[_0x7b4c('0x20')](_0x7b4c('0x21'));})[_0x7b4c('0x22')](function(_0x2c267c){console['log'](_0x7b4c('0x23'),_0x2c267c);logger[_0x7b4c('0x24')](_0x7b4c('0x25'),_0x2c267c);process[_0x7b4c('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ac625be..f195314 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 _0xdf48=['lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','util','secrets','session','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','findOne','params','closed','then','query','forceDownload','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','authorization','headers','Basic','User','find','name','authenticate','pass','Wrong\x20credentials.','startsWith','Bearer','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','Unknown\x20authorization\x20format','User\x20not\x20found.','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','/dashboards/general','retrieveApiKey','isNil','generateApiKey','regenerateApiKey','apiKeyIat','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','unshift','encryptString','promisify','secret','payload','options','verify','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xdf48,0x199));var _0x8df4=function(_0x492734,_0x5c145b){_0x492734=_0x492734-0x0;var _0x668cd9=_0xdf48[_0x492734];return _0x668cd9;};'use strict';var db=require(_0x8df4('0x0'))['db'];var config=require(_0x8df4('0x1'));var hardwareConf=require(_0x8df4('0x2'));var licenseUtil=require(_0x8df4('0x3'));var encryptor=require(_0x8df4('0x4'));var _=require(_0x8df4('0x5'));var jwt=require(_0x8df4('0x6'));var expressJwt=require(_0x8df4('0x7'));var compose=require(_0x8df4('0x8'));var basicAuth=require('basic-auth');var crypto=require(_0x8df4('0x9'));var BPromise=require(_0x8df4('0xa'));var util=require(_0x8df4('0xb'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x8df4('0xc')][_0x8df4('0xd')]});var userAttributes=['id',_0x8df4('0xe'),_0x8df4('0xf'),'name',_0x8df4('0x10'),_0x8df4('0x11'),_0x8df4('0x12'),_0x8df4('0x13'),_0x8df4('0x14'),_0x8df4('0x15'),_0x8df4('0x16'),_0x8df4('0x17'),_0x8df4('0x18'),_0x8df4('0x19'),_0x8df4('0x1a'),_0x8df4('0x1b'),_0x8df4('0x1c'),'lastLoginAt','lastPauseAt',_0x8df4('0x1d'),_0x8df4('0x1e'),_0x8df4('0x1f'),_0x8df4('0x20'),_0x8df4('0x21'),'phoneBarAutoAnswerDelay',_0x8df4('0x22'),'phoneBarEnableRecording',_0x8df4('0x23'),_0x8df4('0x24'),'phoneBarExpires',_0x8df4('0x25'),'phoneBarRemoteControl',_0x8df4('0x26'),_0x8df4('0x27'),_0x8df4('0x28'),_0x8df4('0x29'),_0x8df4('0x2a'),_0x8df4('0x2b'),_0x8df4('0x2c'),_0x8df4('0x2d'),_0x8df4('0x2e'),_0x8df4('0x2f'),_0x8df4('0x30'),'selectRecallMeCampaign',_0x8df4('0x31'),_0x8df4('0x32'),_0x8df4('0x33'),_0x8df4('0x34'),_0x8df4('0x35'),'smsAutoanswerDelay',_0x8df4('0x36'),'openchannelAutoanswerDelay','faxAutoanswer',_0x8df4('0x37'),'whatsappAutoanswer',_0x8df4('0x38'),'messengerSoundNotification'];exports[_0x8df4('0x39')]=function(){return this['isAuthenticated'](!![])[_0x8df4('0x3a')](function(_0x2163aa,_0x482ba9,_0x2e41ed){if(_0x2163aa[_0x8df4('0x3b')]){_0x2e41ed();}else{return db['ChatInteraction'][_0x8df4('0x3c')]({'where':{'id':_0x2163aa[_0x8df4('0x3d')]['id']},'attributes':['id',_0x8df4('0x3e'),'disposition'],'raw':!![]})[_0x8df4('0x3f')](function(_0x22aa66){if(_0x22aa66&&_0x22aa66[_0x8df4('0x3e')]&&!_0x2163aa[_0x8df4('0x40')][_0x8df4('0x41')]){return _0x482ba9[_0x8df4('0x42')](_0x22aa66[_0x8df4('0x43')]===_0x8df4('0x44')?0x195:0x193)[_0x8df4('0x45')]({'message':_0x22aa66[_0x8df4('0x43')]===_0x8df4('0x44')?_0x8df4('0x46'):_0x8df4('0x47')});}else{_0x2e41ed();}})[_0x8df4('0x48')](function(_0x47db07){_0x2e41ed(_0x47db07);});}});};exports[_0x8df4('0x49')]=function isAuthenticated(_0x50e29a){return compose()['use'](function(_0x2a3aa6,_0x5384bd,_0x2af25b){var _0x6450b4;if(_0x2a3aa6['headers'][_0x8df4('0x4a')]){if(_['startsWith'](_0x2a3aa6[_0x8df4('0x4b')][_0x8df4('0x4a')],_0x8df4('0x4c'))){var _0x4310fa=basicAuth(_0x2a3aa6);db[_0x8df4('0x4d')][_0x8df4('0x4e')]({'where':{'name':_0x4310fa[_0x8df4('0x4f')]}})[_0x8df4('0x3f')](function(_0x5d8df3){if(!_0x5d8df3||!_0x5d8df3[_0x8df4('0x50')](_0x4310fa[_0x8df4('0x51')])){return _0x5384bd['status'](0x191)[_0x8df4('0x45')]({'message':_0x8df4('0x52')});}_0x2a3aa6[_0x8df4('0x3b')]={'id':_0x5d8df3['id']};_0x2af25b();})[_0x8df4('0x48')](function(_0x24047d){_0x2af25b(_0x24047d);});}else if(_[_0x8df4('0x53')](_0x2a3aa6[_0x8df4('0x4b')]['authorization'],_0x8df4('0x54'))){validateJwt(_0x2a3aa6,_0x5384bd,_0x2af25b);}else{if(_0x50e29a){_0x2af25b();}else{return _0x5384bd['status'](0x193)[_0x8df4('0x45')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x2a3aa6[_0x8df4('0x40')][_0x8df4('0x55')]){try{var _0x41ee53={'audience':hardwareConf[_0x8df4('0x56')](),'issuer':hardwareConf[_0x8df4('0x56')]()};verifyJwt(_0x2a3aa6[_0x8df4('0x40')][_0x8df4('0x55')],_0x41ee53)[_0x8df4('0x3f')](function(_0x4fbdcf){return db[_0x8df4('0x4d')][_0x8df4('0x4e')]({'where':{'id':_0x4fbdcf[_0x8df4('0x57')]}})['then'](function(_0x4554aa){_0x6450b4=_0x4554aa;return db[_0x8df4('0x58')][_0x8df4('0x3c')]({'where':{'id':0x1},'attributes':[_0x8df4('0x59'),_0x8df4('0x5a')],'raw':!![]});})[_0x8df4('0x3f')](function(_0x1dc68e){if(!_0x6450b4||!_[_0x8df4('0x5b')](_0x6450b4[_0x8df4('0x5c')],_0x4fbdcf[_0x8df4('0x5d')])){return _0x5384bd['status'](0x191)[_0x8df4('0x45')]({'message':_0x8df4('0x5e')});}if(_0x6450b4[_0x8df4('0x5f')]){return _0x5384bd['status'](0x191)[_0x8df4('0x45')]({'message':_0x8df4('0x60')});}if(_0x6450b4['blocked']){if(_0x1dc68e[_0x8df4('0x5a')]>0x0){if(moment(_0x6450b4[_0x8df4('0x61')])[_0x8df4('0x62')](_0x1dc68e[_0x8df4('0x5a')],'minutes')>moment()){return _0x5384bd[_0x8df4('0x42')](0x191)['json']({'message':_0x8df4('0x60')});}}else{return _0x5384bd[_0x8df4('0x42')](0x191)['json']({'message':_0x8df4('0x60')});}}_0x2a3aa6[_0x8df4('0x3b')]={'id':_0x6450b4['id']};_0x2af25b();});})[_0x8df4('0x48')](function(){return _0x5384bd[_0x8df4('0x42')](0x191)[_0x8df4('0x45')]({'message':_0x8df4('0x60')});});}catch(_0x4b699a){_0x2af25b(_0x4b699a);}}else if(_0x50e29a){_0x2af25b();}else{return _0x5384bd['status'](0x193)[_0x8df4('0x45')]({'message':_0x8df4('0x63')});}})[_0x8df4('0x3a')](function(_0x48445f,_0x3ebe69,_0x5a9fcf){if(_0x48445f[_0x8df4('0x3b')]){db[_0x8df4('0x4d')][_0x8df4('0x4e')]({'where':{'id':_0x48445f[_0x8df4('0x3b')]['id']},'attributes':userAttributes})[_0x8df4('0x3f')](function(_0x7ea5d4){if(!_0x7ea5d4){return _0x3ebe69['status'](0x194)[_0x8df4('0x45')]({'message':_0x8df4('0x64')});}_0x48445f['user']=_0x7ea5d4;_0x5a9fcf();})[_0x8df4('0x48')](function(_0x2ab8d4){_0x5a9fcf(_0x2ab8d4);});}else if(_0x50e29a){_0x5a9fcf();}else{return _0x3ebe69[_0x8df4('0x42')](0x194)[_0x8df4('0x45')]({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x8df4('0x3a')](function(_0x3b52d3,_0x2e3fb5,_0x40b5c1){return licenseUtil[_0x8df4('0x65')]()['then'](function(_0x4d83c8){if(_0x4d83c8[_0x8df4('0x66')]){_0x40b5c1();}else{return _0x2e3fb5[_0x8df4('0x42')](0x193)[_0x8df4('0x45')]({'message':_0x8df4('0x67')});}})['catch'](function(_0x2b1cae){_0x40b5c1(_0x2b1cae);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x8df4('0x3a')](function(_0x2234ec,_0x2dc0e8,_0x4d4f99){return licenseUtil[_0x8df4('0x65')]()[_0x8df4('0x3f')](function(_0x11fc09){if(_0x11fc09[_0x8df4('0x68')]){_0x4d4f99();}else{return _0x2dc0e8[_0x8df4('0x42')](0x193)[_0x8df4('0x45')]({'message':'Forbidden'});}})[_0x8df4('0x48')](function(_0x3dfe78){_0x4d4f99(_0x3dfe78);});});};exports[_0x8df4('0x69')]=function(_0x191b5e,_0x5c6c65,_0xf98c9d){_0x191b5e['isMiddleware']=!![];return _0xf98c9d();};exports[_0x8df4('0x6a')]=function signToken(_0xde1670){return signJwt(_0xde1670);};exports[_0x8df4('0x6b')]=function(_0x16f104,_0x51a058){if(!_0x16f104[_0x8df4('0x3b')]){return _0x51a058[_0x8df4('0x42')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x21a0af={'payload':{'id':_0x16f104[_0x8df4('0x3b')]['id'],'role':_0x16f104[_0x8df4('0x3b')][_0x8df4('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x21a0af)[_0x8df4('0x3f')](function(_0x3a13f7){_0x51a058[_0x8df4('0x6c')](_0x8df4('0x6d'),_0x3a13f7);_0x51a058['redirect'](_0x8df4('0x6e'));})[_0x8df4('0x48')](function(_0x267d99){return _0x51a058['status'](0x1f4)['send'](_0x267d99);});};exports[_0x8df4('0x6f')]=function(_0x19fa4b){if(_[_0x8df4('0x70')](_0x19fa4b['apiKeyNonce'])||_['isNil'](_0x19fa4b['apiKeyIat'])){return null;}else{return createJwt(_0x19fa4b);}};exports[_0x8df4('0x71')]=function(_0x245b2d){_0x245b2d['apiKeyNonce']=generateNonce();_0x245b2d['apiKeyIat']=generateIssuedAt();return createJwt(_0x245b2d);};exports[_0x8df4('0x72')]=function(_0x51c6b8,_0x515621){var _0x3372c4=_0x51c6b8[_0x8df4('0x40')]['apikey'];if(_0x3372c4){var _0x290c57={'nonce':_0x515621[_0x8df4('0x5c')],'iat':_0x515621[_0x8df4('0x73')],'audience':hardwareConf[_0x8df4('0x56')](),'issuer':hardwareConf[_0x8df4('0x56')]()};return verifyJwt(_0x3372c4,_0x290c57)[_0x8df4('0x3f')](function(){return generateApiKey(_0x515621);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x8df4('0x74')]=function(_0x160beb){var _0x28cd3c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x28cd3c['test'](_0x160beb))throw new db[(_0x8df4('0x75'))][(_0x8df4('0x76'))](_0x8df4('0x77'));return;};exports[_0x8df4('0x78')]=function(_0x129ac2,_0x32999b,_0x230f79){var _0x524168=encryptor['decryptString'](_0x32999b)['split'](',');for(var _0x1f1078=0x0;_0x1f1078<_0x230f79;_0x1f1078++){if(!_0x524168[_0x1f1078])break;if(_0x129ac2[_0x8df4('0x79')]()===_0x524168[_0x1f1078][_0x8df4('0x79')]()){var _0xf09e75=util['format'](_0x8df4('0x7a'),_0x230f79);if(_0x230f79===0x1){_0xf09e75=_0x8df4('0x7b');}throw new db[(_0x8df4('0x75'))]['ValidationError'](_0xf09e75);}}return;};exports[_0x8df4('0x7c')]=function(_0x284bb0,_0x266274){var _0x5096f5=_0x266274?encryptor['decryptString'](_0x266274)[_0x8df4('0x7d')](','):[];if(_0x5096f5[_0x8df4('0x7e')]===0x5){_0x5096f5['splice'](-0x1,0x1);}_0x5096f5[_0x8df4('0x7f')](_0x284bb0);return encryptor[_0x8df4('0x80')](_0x5096f5['join'](','));};function signJwt(_0x318494){var _0x4bd7ef=BPromise[_0x8df4('0x81')](jwt['sign'],{'context':jwt});var _0x37fb30=_0x318494[_0x8df4('0x82')]||config[_0x8df4('0xc')]['session'];return new BPromise(function(_0x2d7f0c,_0x1d2302){_0x4bd7ef(_0x318494[_0x8df4('0x83')],_0x37fb30,_0x318494[_0x8df4('0x84')])[_0x8df4('0x3f')](function(_0x2bd2b){_0x2d7f0c(_0x2bd2b);})[_0x8df4('0x48')](function(_0x33d3e7){_0x1d2302(_0x33d3e7);});});}function verifyJwt(_0x2a70bf,_0x54179b,_0x3a475c){var _0x397571=BPromise[_0x8df4('0x81')](jwt[_0x8df4('0x85')],{'context':jwt});var _0x50bf3f=_0x3a475c||config[_0x8df4('0xc')][_0x8df4('0xd')];return new BPromise(function(_0x4a4adf,_0x28fcca){_0x397571(_0x2a70bf,_0x50bf3f,_0x54179b)[_0x8df4('0x3f')](function(_0x4f563d){_0x4a4adf(_0x4f563d);})[_0x8df4('0x48')](function(_0x5a1a9b){_0x28fcca(_0x5a1a9b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x8df4('0x86')](_0x8df4('0x87'));}function generateIssuedAt(){return Math[_0x8df4('0x88')](Date['now']()/0x3e8)[_0x8df4('0x86')]();}function createJwt(_0x16086c){var _0x1eb7b0={'payload':{'iat':_0x16086c[_0x8df4('0x73')],'nonce':_0x16086c[_0x8df4('0x5c')]},'options':{'algorithm':_0x8df4('0x89'),'subject':_0x16086c['id']['toString'](),'issuer':hardwareConf[_0x8df4('0x56')](),'audience':hardwareConf[_0x8df4('0x56')]()}};return signJwt(_0x1eb7b0)[_0x8df4('0x3f')](function(_0x561b37){return{'iat':_0x16086c['apiKeyIat'],'nonce':_0x16086c[_0x8df4('0x5c')],'token':_0x561b37};});} \ No newline at end of file +var _0x4a20=['Forbidden.','catch','authorization','startsWith','headers','Basic','User','authenticate','Bearer','query','apikey','getUuid','find','sub','Setting','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','add','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','send','retrieveApiKey','isNil','apiKeyNonce','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','session','payload','options','verify','randomBytes','toString','hex','HS512','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','util','moment','secrets','role','fullname','name','internal','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','forceDownload','status','unmanaged','json'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x4a20,0x1d3));var _0x04a2=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x4a20[_0x5a776b];return _0xbbef59;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x04a2('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x04a2('0x1'));var encryptor=require(_0x04a2('0x2'));var _=require(_0x04a2('0x3'));var jwt=require(_0x04a2('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x04a2('0x5'));var basicAuth=require(_0x04a2('0x6'));var crypto=require(_0x04a2('0x7'));var BPromise=require('bluebird');var util=require(_0x04a2('0x8'));var moment=require(_0x04a2('0x9'));var validateJwt=expressJwt({'secret':config[_0x04a2('0xa')]['session']});var userAttributes=['id',_0x04a2('0xb'),_0x04a2('0xc'),_0x04a2('0xd'),_0x04a2('0xe'),_0x04a2('0xf'),_0x04a2('0x10'),'permissions',_0x04a2('0x11'),_0x04a2('0x12'),_0x04a2('0x13'),_0x04a2('0x14'),_0x04a2('0x15'),_0x04a2('0x16'),_0x04a2('0x17'),'pauseType',_0x04a2('0x18'),_0x04a2('0x19'),_0x04a2('0x1a'),'crudPermissions','allowmessenger','passwordResetAt',_0x04a2('0x1b'),_0x04a2('0x1c'),_0x04a2('0x1d'),_0x04a2('0x1e'),_0x04a2('0x1f'),'phoneBarEnableDtmfTone',_0x04a2('0x20'),_0x04a2('0x21'),_0x04a2('0x22'),'phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface',_0x04a2('0x23'),_0x04a2('0x24'),_0x04a2('0x25'),_0x04a2('0x26'),'downloadVoiceRecordings',_0x04a2('0x27'),'downloadAttachments',_0x04a2('0x28'),'selectRecallMeCampaign',_0x04a2('0x29'),'chatAutoanswerDelay','emailAutoanswer',_0x04a2('0x2a'),_0x04a2('0x2b'),_0x04a2('0x2c'),_0x04a2('0x2d'),_0x04a2('0x2e'),_0x04a2('0x2f'),_0x04a2('0x30'),'whatsappAutoanswer',_0x04a2('0x31'),_0x04a2('0x32')];exports[_0x04a2('0x33')]=function(){return this[_0x04a2('0x34')](!![])[_0x04a2('0x35')](function(_0xbb70a4,_0x38c0e7,_0x3a0372){if(_0xbb70a4[_0x04a2('0x36')]){_0x3a0372();}else{return db[_0x04a2('0x37')][_0x04a2('0x38')]({'where':{'id':_0xbb70a4[_0x04a2('0x39')]['id']},'attributes':['id',_0x04a2('0x3a'),_0x04a2('0x3b')],'raw':!![]})[_0x04a2('0x3c')](function(_0x399f7b){if(_0x399f7b&&_0x399f7b[_0x04a2('0x3a')]&&!_0xbb70a4['query'][_0x04a2('0x3d')]){return _0x38c0e7[_0x04a2('0x3e')](_0x399f7b[_0x04a2('0x3b')]===_0x04a2('0x3f')?0x195:0x193)[_0x04a2('0x40')]({'message':_0x399f7b[_0x04a2('0x3b')]===_0x04a2('0x3f')?'Unmanaged.':_0x04a2('0x41')});}else{_0x3a0372();}})[_0x04a2('0x42')](function(_0x5d2847){_0x3a0372(_0x5d2847);});}});};exports[_0x04a2('0x34')]=function isAuthenticated(_0x31bfd1){return compose()[_0x04a2('0x35')](function(_0x2582a2,_0x46b1a7,_0x37f73e){var _0x3c2b6e;if(_0x2582a2['headers'][_0x04a2('0x43')]){if(_[_0x04a2('0x44')](_0x2582a2[_0x04a2('0x45')][_0x04a2('0x43')],_0x04a2('0x46'))){var _0x26b27b=basicAuth(_0x2582a2);db[_0x04a2('0x47')]['find']({'where':{'name':_0x26b27b['name']}})[_0x04a2('0x3c')](function(_0x154f6c){if(!_0x154f6c||!_0x154f6c[_0x04a2('0x48')](_0x26b27b['pass'])){return _0x46b1a7[_0x04a2('0x3e')](0x191)[_0x04a2('0x40')]({'message':'Wrong\x20credentials.'});}_0x2582a2[_0x04a2('0x36')]={'id':_0x154f6c['id']};_0x37f73e();})[_0x04a2('0x42')](function(_0x494af5){_0x37f73e(_0x494af5);});}else if(_[_0x04a2('0x44')](_0x2582a2['headers'][_0x04a2('0x43')],_0x04a2('0x49'))){validateJwt(_0x2582a2,_0x46b1a7,_0x37f73e);}else{if(_0x31bfd1){_0x37f73e();}else{return _0x46b1a7['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x2582a2[_0x04a2('0x4a')][_0x04a2('0x4b')]){try{var _0xbacfa6={'audience':hardwareConf[_0x04a2('0x4c')](),'issuer':hardwareConf[_0x04a2('0x4c')]()};verifyJwt(_0x2582a2[_0x04a2('0x4a')][_0x04a2('0x4b')],_0xbacfa6)[_0x04a2('0x3c')](function(_0x2906ac){return db[_0x04a2('0x47')][_0x04a2('0x4d')]({'where':{'id':_0x2906ac[_0x04a2('0x4e')]}})[_0x04a2('0x3c')](function(_0x3364bb){_0x3c2b6e=_0x3364bb;return db[_0x04a2('0x4f')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x04a2('0x3c')](function(_0x1dd219){if(!_0x3c2b6e||!_[_0x04a2('0x50')](_0x3c2b6e['apiKeyNonce'],_0x2906ac[_0x04a2('0x51')])){return _0x46b1a7[_0x04a2('0x3e')](0x191)[_0x04a2('0x40')]({'message':_0x04a2('0x52')});}if(_0x3c2b6e[_0x04a2('0x53')]){return _0x46b1a7[_0x04a2('0x3e')](0x191)[_0x04a2('0x40')]({'message':_0x04a2('0x54')});}if(_0x3c2b6e[_0x04a2('0x55')]){if(_0x1dd219[_0x04a2('0x56')]>0x0){if(moment(_0x3c2b6e['blockedAt'])[_0x04a2('0x57')](_0x1dd219[_0x04a2('0x56')],'minutes')>moment()){return _0x46b1a7[_0x04a2('0x3e')](0x191)[_0x04a2('0x40')]({'message':_0x04a2('0x54')});}}else{return _0x46b1a7[_0x04a2('0x3e')](0x191)[_0x04a2('0x40')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x2582a2[_0x04a2('0x36')]={'id':_0x3c2b6e['id']};_0x37f73e();});})['catch'](function(){return _0x46b1a7['status'](0x191)['json']({'message':_0x04a2('0x54')});});}catch(_0x1f0a5e){_0x37f73e(_0x1f0a5e);}}else if(_0x31bfd1){_0x37f73e();}else{return _0x46b1a7[_0x04a2('0x3e')](0x193)['json']({'message':_0x04a2('0x58')});}})[_0x04a2('0x35')](function(_0x124f2a,_0x3cd899,_0x15f837){if(_0x124f2a['user']){db[_0x04a2('0x47')]['find']({'where':{'id':_0x124f2a[_0x04a2('0x36')]['id']},'attributes':userAttributes})[_0x04a2('0x3c')](function(_0x341c30){if(!_0x341c30){return _0x3cd899[_0x04a2('0x3e')](0x194)[_0x04a2('0x40')]({'message':_0x04a2('0x59')});}_0x124f2a[_0x04a2('0x36')]=_0x341c30;_0x15f837();})[_0x04a2('0x42')](function(_0x194c34){_0x15f837(_0x194c34);});}else if(_0x31bfd1){_0x15f837();}else{return _0x3cd899[_0x04a2('0x3e')](0x194)['json']({'message':_0x04a2('0x5a')});}});};exports[_0x04a2('0x5b')]=function canUpdate(){return compose()[_0x04a2('0x35')](function(_0x43a18b,_0x20f63f,_0x2e1970){return licenseUtil[_0x04a2('0x5c')]()[_0x04a2('0x3c')](function(_0x5eb5ef){if(_0x5eb5ef[_0x04a2('0x5d')]){_0x2e1970();}else{return _0x20f63f[_0x04a2('0x3e')](0x193)['json']({'message':'Forbidden'});}})[_0x04a2('0x42')](function(_0x24c93f){_0x2e1970(_0x24c93f);});});};exports[_0x04a2('0x5e')]=function isWebrtcLicence(){return compose()[_0x04a2('0x35')](function(_0x1f9f59,_0x720e9c,_0x45f30d){return licenseUtil['getLicense']()[_0x04a2('0x3c')](function(_0x10de04){if(_0x10de04['webrtc']){_0x45f30d();}else{return _0x720e9c[_0x04a2('0x3e')](0x193)[_0x04a2('0x40')]({'message':'Forbidden'});}})[_0x04a2('0x42')](function(_0x231e12){_0x45f30d(_0x231e12);});});};exports[_0x04a2('0x5f')]=function(_0x5237a8,_0x2a5b14,_0x47b6a0){_0x5237a8['isMiddleware']=!![];return _0x47b6a0();};exports[_0x04a2('0x60')]=function signToken(_0x54c160){return signJwt(_0x54c160);};exports['setTokenCookie']=function(_0x582fa2,_0x19155d){if(!_0x582fa2[_0x04a2('0x36')]){return _0x19155d[_0x04a2('0x3e')](0x194)['json']({'message':_0x04a2('0x61')});}var _0x4ba6f5={'payload':{'id':_0x582fa2[_0x04a2('0x36')]['id'],'role':_0x582fa2['user'][_0x04a2('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4ba6f5)['then'](function(_0x57f361){_0x19155d[_0x04a2('0x62')]('motion.token',_0x57f361);_0x19155d[_0x04a2('0x63')]('/dashboards/general');})['catch'](function(_0xfee9d1){return _0x19155d[_0x04a2('0x3e')](0x1f4)[_0x04a2('0x64')](_0xfee9d1);});};exports[_0x04a2('0x65')]=function(_0x23c3c4){if(_[_0x04a2('0x66')](_0x23c3c4[_0x04a2('0x67')])||_[_0x04a2('0x66')](_0x23c3c4['apiKeyIat'])){return null;}else{return createJwt(_0x23c3c4);}};exports['generateApiKey']=function(_0x5d6b67){_0x5d6b67[_0x04a2('0x67')]=generateNonce();_0x5d6b67['apiKeyIat']=generateIssuedAt();return createJwt(_0x5d6b67);};exports[_0x04a2('0x68')]=function(_0x5d246c,_0x2e0682){var _0xf6c18a=_0x5d246c['query'][_0x04a2('0x4b')];if(_0xf6c18a){var _0x4ce808={'nonce':_0x2e0682[_0x04a2('0x67')],'iat':_0x2e0682[_0x04a2('0x69')],'audience':hardwareConf[_0x04a2('0x4c')](),'issuer':hardwareConf[_0x04a2('0x4c')]()};return verifyJwt(_0xf6c18a,_0x4ce808)[_0x04a2('0x3c')](function(){return generateApiKey(_0x2e0682);});}else{throw{'message':_0x04a2('0x6a')};}};exports[_0x04a2('0x6b')]=function(_0x3f5dc8){var _0x1220d7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1220d7[_0x04a2('0x6c')](_0x3f5dc8))throw new db[(_0x04a2('0x6d'))][(_0x04a2('0x6e'))](_0x04a2('0x6f'));return;};exports[_0x04a2('0x70')]=function(_0x2c9e4d,_0x1abab0,_0x9103b1){var _0x4f72f4=encryptor[_0x04a2('0x71')](_0x1abab0)['split'](',');for(var _0xaa75e4=0x0;_0xaa75e4<_0x9103b1;_0xaa75e4++){if(!_0x4f72f4[_0xaa75e4])break;if(_0x2c9e4d[_0x04a2('0x72')]()===_0x4f72f4[_0xaa75e4][_0x04a2('0x72')]()){var _0x2e80cf=util[_0x04a2('0x73')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x9103b1);if(_0x9103b1===0x1){_0x2e80cf=_0x04a2('0x74');}throw new db[(_0x04a2('0x6d'))][(_0x04a2('0x6e'))](_0x2e80cf);}}return;};exports[_0x04a2('0x75')]=function(_0x24daca,_0xfecaa9){var _0x3510e6=_0xfecaa9?encryptor['decryptString'](_0xfecaa9)['split'](','):[];if(_0x3510e6[_0x04a2('0x76')]===0x5){_0x3510e6[_0x04a2('0x77')](-0x1,0x1);}_0x3510e6[_0x04a2('0x78')](_0x24daca);return encryptor[_0x04a2('0x79')](_0x3510e6[_0x04a2('0x7a')](','));};function signJwt(_0x1ffd59){var _0x304e9e=BPromise['promisify'](jwt[_0x04a2('0x7b')],{'context':jwt});var _0x5f24fb=_0x1ffd59[_0x04a2('0x7c')]||config[_0x04a2('0xa')][_0x04a2('0x7d')];return new BPromise(function(_0x431766,_0xa3cc8e){_0x304e9e(_0x1ffd59[_0x04a2('0x7e')],_0x5f24fb,_0x1ffd59[_0x04a2('0x7f')])['then'](function(_0x5d3352){_0x431766(_0x5d3352);})['catch'](function(_0x102ce1){_0xa3cc8e(_0x102ce1);});});}function verifyJwt(_0x4d4fa9,_0x3ca896,_0x18949){var _0x14c44f=BPromise['promisify'](jwt[_0x04a2('0x80')],{'context':jwt});var _0x4213a7=_0x18949||config[_0x04a2('0xa')]['session'];return new BPromise(function(_0x3c5325,_0x3f8ac1){_0x14c44f(_0x4d4fa9,_0x4213a7,_0x3ca896)['then'](function(_0x16a708){_0x3c5325(_0x16a708);})[_0x04a2('0x42')](function(_0x269d88){_0x3f8ac1(_0x269d88);});});}function generateNonce(){return crypto[_0x04a2('0x81')](0x10)[_0x04a2('0x82')](_0x04a2('0x83'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x04a2('0x82')]();}function createJwt(_0x4dfed0){var _0x2284a0={'payload':{'iat':_0x4dfed0[_0x04a2('0x69')],'nonce':_0x4dfed0[_0x04a2('0x67')]},'options':{'algorithm':_0x04a2('0x84'),'subject':_0x4dfed0['id'][_0x04a2('0x82')](),'issuer':hardwareConf[_0x04a2('0x4c')](),'audience':hardwareConf[_0x04a2('0x4c')]()}};return signJwt(_0x2284a0)['then'](function(_0x4939d4){return{'iat':_0x4dfed0[_0x04a2('0x69')],'nonce':_0x4dfed0[_0x04a2('0x67')],'token':_0x4939d4};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 2735a06..99013dc 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 _0xc01e=['slice','all','cf_','map','keys','type','./sql-utils','findAll','skipContactsQuery','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','where','default','fields','user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','startsWith','findOne'];(function(_0x2c3042,_0xd02c31){var _0x19844b=function(_0x1e55c8){while(--_0x1e55c8){_0x2c3042['push'](_0x2c3042['shift']());}};_0x19844b(++_0xd02c31);}(_0xc01e,0x164));var _0xec01=function(_0x492c06,_0xfe75d0){_0x492c06=_0x492c06-0x0;var _0x22a680=_0xc01e[_0x492c06];return _0x22a680;};'use strict';var _=require('lodash');var sqlUtils=require(_0xec01('0x0'));var db=require('../../mysqldb')['db'];exports[_0xec01('0x1')]=function(_0xb4dea6,_0x206600,_0x79b1a7,_0xfa91f0){var _0x77331a={'count':0x0,'rows':[]};var _0x2e391e=sqlUtils[_0xec01('0x2')](_0x206600,_0xb4dea6);if(_0x2e391e){return Promise['resolve'](_0x77331a);}var _0x4ea755=sqlUtils[_0xec01('0x3')]();var _0x9153b={};var _0x63b976=![];var _0x1d4987=![];return Promise[_0xec01('0x4')]()[_0xec01('0x5')](function(){if(_0xb4dea6[_0xec01('0x6')]){return sqlUtils[_0xec01('0x7')](_0xb4dea6[_0xec01('0x6')],_0xfa91f0);}else{return sqlUtils['parseQueryParameters'](_0xb4dea6,_0xfa91f0);}})['then'](function(_0x361067){_0x4ea755[_0xec01('0x8')](_0x361067[_0xec01('0x9')]);_0x4ea755['where'](_0x361067[_0xec01('0xa')]);_0x4ea755[_0xec01('0x8')](_0x361067['filter']);_0x4ea755[_0xec01('0x8')](_0x361067[_0xec01('0xb')][_0xec01('0xc')]);_0x9153b=_0x361067[_0xec01('0xd')];_0x1d4987=_0x361067[_0xec01('0xb')][_0xec01('0xe')];return sqlUtils[_0xec01('0xf')](_0x206600,_0xb4dea6,_0x1d4987);})[_0xec01('0x5')](function(_0x13a946){_0x4ea755['where'](_0x13a946);var _0x132474=_0xb4dea6[_0xec01('0x6')]?_0x9153b[_0xec01('0x10')]:_0xb4dea6[_0xec01('0x11')];_0x63b976=_0x132474?!![]:![];return sqlUtils[_0xec01('0x12')](_0x4ea755,_0x132474);})[_0xec01('0x5')](function(_0x46575c){_0x77331a[_0xec01('0x13')]=_0x46575c;if(_0x77331a[_0xec01('0x13')]===0x0){return;}if(_0xb4dea6[_0xec01('0x14')]){_0x1d4987=!![];}return sqlUtils[_0xec01('0x15')](_0x4ea755,_0xb4dea6['fields'],_0x79b1a7,_0x63b976,_0x9153b[_0xec01('0xc')],_0x1d4987);})[_0xec01('0x5')](function(_0x1f8ebc){if(!_0x1f8ebc){return[];}return sqlUtils[_0xec01('0x16')](_0x1f8ebc,_0xb4dea6,_0x79b1a7);})[_0xec01('0x5')](function(_0x8c37a4){_0x77331a[_0xec01('0x17')]=_0x8c37a4;return _0x77331a;})[_0xec01('0x18')](function(_0x484412){throw _0x484412;});};exports[_0xec01('0x19')]=function(){var _0x4bbfd2={};var _0x2f411b=[];return db[_0xec01('0x1a')][_0xec01('0x19')]()[_0xec01('0x5')](function(_0x3c6157){_0x4bbfd2=_0x3c6157;var _0x331027=Object['keys'](_0x4bbfd2)['filter'](function(_0xc9d737){return _[_0xec01('0x1b')](_0xc9d737,'cf_')?_0xc9d737:undefined;});var _0x1e0a5e=_0x331027['map'](function(_0x5a9cba){return db['CmCustomField'][_0xec01('0x1c')]({'where':{'id':_0x5a9cba[_0xec01('0x1d')](0x3)},'raw':!![]});});return Promise[_0xec01('0x1e')](_0x1e0a5e);})['then'](function(_0x286653){for(var _0x330e89=0x0;_0x330e89<_0x286653['length'];_0x330e89++){if(_0x286653[_0x330e89]){var _0x152ddb=_0xec01('0x1f')+_0x286653[_0x330e89]['id'];_0x4bbfd2[_0x152ddb]['fieldType']=_0x286653[_0x330e89]['type'];}}_0x2f411b=_[_0xec01('0x20')](Object[_0xec01('0x21')](_0x4bbfd2),function(_0x13156e){return{'name':_0x13156e,'type':_0x4bbfd2[_0x13156e][_0xec01('0x22')]};});return _0x2f411b;})[_0xec01('0x18')](function(_0xa919b7){throw _0xa919b7;});}; \ No newline at end of file +var _0xe58e=['all','length','type','lodash','../../mysqldb','skipContactsQuery','getContactsSubquery','resolve','then','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','search','ids','tag','count','getFilteredContacts','rows','catch','describe','CmContact','keys','cf_','map','CmCustomField','findOne'];(function(_0x438bcc,_0xc17fa1){var _0x3ad39b=function(_0x57e6cf){while(--_0x57e6cf){_0x438bcc['push'](_0x438bcc['shift']());}};_0x3ad39b(++_0xc17fa1);}(_0xe58e,0xad));var _0xee58=function(_0x2ad43e,_0x22e2b){_0x2ad43e=_0x2ad43e-0x0;var _0xfd5d21=_0xe58e[_0x2ad43e];return _0xfd5d21;};'use strict';var _=require(_0xee58('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xee58('0x1'))['db'];exports['findAll']=function(_0x279fab,_0x36dada,_0x465763,_0x3485b3){var _0x1b331e={'count':0x0,'rows':[]};var _0xed5c79=sqlUtils[_0xee58('0x2')](_0x36dada,_0x279fab);if(_0xed5c79){return Promise['resolve'](_0x1b331e);}var _0x343568=sqlUtils[_0xee58('0x3')]();var _0x3bde9c={};var _0x1c0eb3=![];var _0x1bd5d0=![];return Promise[_0xee58('0x4')]()[_0xee58('0x5')](function(){if(_0x279fab['search']){return sqlUtils[_0xee58('0x6')](_0x279fab['search'],_0x3485b3);}else{return sqlUtils[_0xee58('0x7')](_0x279fab,_0x3485b3);}})[_0xee58('0x5')](function(_0x145d30){_0x343568[_0xee58('0x8')](_0x145d30[_0xee58('0x9')]);_0x343568['where'](_0x145d30[_0xee58('0xa')]);_0x343568[_0xee58('0x8')](_0x145d30[_0xee58('0xb')]);_0x343568['where'](_0x145d30[_0xee58('0xc')][_0xee58('0xd')]);_0x3bde9c=_0x145d30[_0xee58('0xe')];_0x1bd5d0=_0x145d30[_0xee58('0xc')][_0xee58('0xf')];return sqlUtils[_0xee58('0x10')](_0x36dada,_0x279fab,_0x1bd5d0);})[_0xee58('0x5')](function(_0x35dcc2){_0x343568[_0xee58('0x8')](_0x35dcc2);var _0x3198ac=_0x279fab[_0xee58('0x11')]?_0x3bde9c[_0xee58('0x12')]:_0x279fab[_0xee58('0x13')];_0x1c0eb3=_0x3198ac?!![]:![];return sqlUtils['countFilteredContacts'](_0x343568,_0x3198ac);})[_0xee58('0x5')](function(_0x5b2240){_0x1b331e[_0xee58('0x14')]=_0x5b2240;if(_0x1b331e[_0xee58('0x14')]===0x0){return;}if(_0x279fab['User']){_0x1bd5d0=!![];}return sqlUtils['buildContactsQuery'](_0x343568,_0x279fab['fields'],_0x465763,_0x1c0eb3,_0x3bde9c[_0xee58('0xd')],_0x1bd5d0);})[_0xee58('0x5')](function(_0x3aced0){if(!_0x3aced0){return[];}return sqlUtils[_0xee58('0x15')](_0x3aced0,_0x279fab,_0x465763);})[_0xee58('0x5')](function(_0x4c6f82){_0x1b331e[_0xee58('0x16')]=_0x4c6f82;return _0x1b331e;})[_0xee58('0x17')](function(_0x2723be){throw _0x2723be;});};exports[_0xee58('0x18')]=function(){var _0x2416d1={};var _0xbf5e8a=[];return db[_0xee58('0x19')][_0xee58('0x18')]()[_0xee58('0x5')](function(_0x30929d){_0x2416d1=_0x30929d;var _0x5035bb=Object[_0xee58('0x1a')](_0x2416d1)[_0xee58('0xb')](function(_0x2f2716){return _['startsWith'](_0x2f2716,_0xee58('0x1b'))?_0x2f2716:undefined;});var _0x6e432c=_0x5035bb[_0xee58('0x1c')](function(_0x34e637){return db[_0xee58('0x1d')][_0xee58('0x1e')]({'where':{'id':_0x34e637['slice'](0x3)},'raw':!![]});});return Promise[_0xee58('0x1f')](_0x6e432c);})[_0xee58('0x5')](function(_0x697f3c){for(var _0x2bec41=0x0;_0x2bec41<_0x697f3c[_0xee58('0x20')];_0x2bec41++){if(_0x697f3c[_0x2bec41]){var _0x1c1502='cf_'+_0x697f3c[_0x2bec41]['id'];_0x2416d1[_0x1c1502]['fieldType']=_0x697f3c[_0x2bec41][_0xee58('0x21')];}}_0xbf5e8a=_[_0xee58('0x1c')](Object['keys'](_0x2416d1),function(_0x2411ed){return{'name':_0x2411ed,'type':_0x2416d1[_0x2411ed][_0xee58('0x21')]};});return _0xbf5e8a;})[_0xee58('0x17')](function(_0x201c45){throw _0x201c45;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 46d3e24..0e138fc 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 _0xa954=['map','some','compact','Contact','resolve','then','fields','tag','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','limit','offset','group','subqry.id','having','order','DESC','subqry.','from','findAll','keyBy','QueryTypes','SELECT','sequelize','query','toString','Tags','clone','COUNT(*)','c.id','isEmpty','Sequelize','exports','squel','../parsers/advancedSearch','../../mysqldb','role','agent','search','ListId','select','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','escapeLIKESpecialChars','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','DATE','type','default','text','value','Tag','tags','clause','and','User','user','uc.UserId\x20=\x20?','keys'];(function(_0x3b3c3b,_0x251b1c){var _0x1ee0ae=function(_0x2408a0){while(--_0x2408a0){_0x3b3c3b['push'](_0x3b3c3b['shift']());}};_0x1ee0ae(++_0x251b1c);}(_0xa954,0x158));var _0x4a95=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0xa954[_0x13342f];return _0x2fc1fc;};'use strict';var _=require('lodash');var squel=require(_0x4a95('0x0'));var as=require(_0x4a95('0x1'));var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0x4a95('0x2'))['db'];function skipContactsQuery(_0x23a324,_0x24548f){var _0x11ea78=![];if(_0x23a324[_0x4a95('0x3')]===_0x4a95('0x4')&&!_0x24548f[_0x4a95('0x5')]&&!_0x24548f[_0x4a95('0x6')]&&_0x24548f['autocomplete']!=='true'){_0x11ea78=!![];}return _0x11ea78;}function getContactsSubquery(){return squel[_0x4a95('0x7')]()['from']('cm_contacts','c')[_0x4a95('0x8')](_0x4a95('0x9'));}function applyJoinClauses(_0x12a8e0,_0x252e87){var _0x2dbdd1=_0x252e87?'c':_0x4a95('0xa');_0x12a8e0['left_join'](_0x4a95('0xb'),'uc',_0x4a95('0xc')+_0x2dbdd1+_0x4a95('0xd'))[_0x4a95('0xe')](_0x4a95('0xf'),'ct','ct.CmContactId\x20=\x20'+_0x2dbdd1+_0x4a95('0xd'))[_0x4a95('0xe')](_0x4a95('0x10'),'t',_0x4a95('0x11'));return _0x12a8e0;}function addFieldsToQuery(_0x4b0b3a,_0x6142a3,_0xda6158,_0x3e7438,_0x2abbb8){var _0x44c55c=_0x2abbb8?'c':_0x4a95('0xa');if(!_0x6142a3){_0x6142a3=['id',_0x4a95('0x12'),_0x4a95('0x13'),'phone',_0x4a95('0x14'),_0x4a95('0x15'),_0x4a95('0x16'),'ListId',_0x4a95('0x17'),_0x4a95('0x18'),_0x4a95('0x19'),_0x4a95('0x1a'),_0x4a95('0x1b')];}else if(!_0x6142a3[_0x4a95('0x1c')]('id')){_0x6142a3[_0x4a95('0x1d')]('id');}var _0x3e037e=_0xda6158&&_0x2abbb8||!_0xda6158&&!_0x2abbb8;if(_0x3e7438){_0x3e037e=_0x3e7438&&_0x2abbb8||!_0x3e7438&&!_0x2abbb8;}_0x6142a3[_0x4a95('0x1e')](function(_0x20c33a){if(_0x20c33a===_0x4a95('0x1b')){if(_0x3e037e){_0x4b0b3a[_0x4a95('0x1f')](_0x4a95('0x20'),_0x20c33a);}else if(_0xda6158||_0x3e7438){_0x4b0b3a[_0x4a95('0x1f')](_0x44c55c+'.'+_0x20c33a);}}else{_0x4b0b3a[_0x4a95('0x1f')](_0x44c55c+'.'+_0x20c33a);}});return _0x4b0b3a;}function getSqlClauses(){var _0x105d69={'default':squel[_0x4a95('0x21')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0x4a95('0x21')](),'ids':null},'user':{'clause':squel[_0x4a95('0x21')](),'skip':![]}};return _0x105d69;}function parseTagParameter(_0x4eb9c5){var _0xa2b886=squel[_0x4a95('0x21')]();if(_0x4eb9c5){var _0xc16a49=utils[_0x4a95('0x22')](_0x4eb9c5);_0xc16a49['forEach'](function(_0x4fc6ee){_0xa2b886['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4fc6ee+',%');});}return _0xa2b886;}function parseSearchFilter(_0x4fae8c){var _0x1d3a41=squel[_0x4a95('0x21')]();if(_0x4fae8c){var _0x59e012=_0x4fae8c[_0x4a95('0x23')]('\x5c','\x5c\x5c')[_0x4a95('0x23')](/'/g,'\x27\x27');var _0x5024ee=qs[_0x4a95('0x24')](_0x59e012);if(_0x59e012['split']('\x20')[_0x4a95('0x25')]>0x1){_0x1d3a41['or'](_0x4a95('0x26'),qs[_0x4a95('0x27')](_0x59e012,!![]),null);}else{if(qs['isNumeric'](_0x59e012)){_0x1d3a41['or'](_0x4a95('0x28'),_0x5024ee+'%');_0x1d3a41['or'](_0x4a95('0x29'),_0x5024ee+'%');_0x1d3a41['or'](_0x4a95('0x2a'),_0x5024ee+'%');_0x1d3a41['or'](_0x4a95('0x2b'),_0x5024ee+'%');}else if(qs['isEmail'](_0x59e012)){_0x1d3a41['or'](_0x4a95('0x2c'),_0x5024ee+'%');}else{_0x1d3a41['or'](_0x4a95('0x2d'),'%'+_0x5024ee+'%');_0x1d3a41['or'](_0x4a95('0x2e'),'%'+_0x5024ee+'%');_0x1d3a41['or']('c.email\x20LIKE\x20?','%'+_0x5024ee+'%');}}}return _0x1d3a41;}function parseAdvancedSearchFilter(_0x3cd290,_0x3b4451){var _0x512ceb=getSqlClauses();var _0x3a33f1=as[_0x4a95('0x2f')](_0x3cd290);var _0x355ea4=_0x3a33f1[_0x4a95('0x30')];for(var _0x679d4a=0x0;_0x679d4a<_0x3a33f1['conditions'][_0x4a95('0x25')];_0x679d4a++){var _0x3dd0e4=_0x3a33f1[_0x4a95('0x31')][_0x679d4a];var _0x1f2d25='c';var _0x3d79aa=_[_0x4a95('0x32')](_0x3b4451,[_0x4a95('0x33'),_0x3dd0e4[_0x4a95('0x1f')]]);if(_0x3d79aa){if(_0x3dd0e4[_0x4a95('0x1f')]===_0x4a95('0x34')||_0x3d79aa['fieldType']===_0x4a95('0x35')){_0x3dd0e4[_0x4a95('0x36')]=_0x4a95('0x37');}var _0xbbd91e=as['buildExpression'](_0x1f2d25,_0x3d79aa[_0x4a95('0x38')],_0x3dd0e4);_0x512ceb[_0x4a95('0x39')][_0x355ea4](_0xbbd91e[_0x4a95('0x3a')],_0xbbd91e[_0x4a95('0x3b')]['start'],_0xbbd91e[_0x4a95('0x3b')]['end']);}else{if(_0x3dd0e4['field']===_0x4a95('0x3c')){var _0x43b9f7=_0x3dd0e4['value']['split'](',')['map'](function(_0x3df620){return Number(_0x3df620);});var _0x251fe3=parseTagParameter(_0x43b9f7);_0x512ceb[_0x4a95('0x3d')][_0x4a95('0x3e')][_0x4a95('0x3f')](_0x251fe3);_0x512ceb[_0x4a95('0x3d')]['ids']=_0x43b9f7;}else if(_0x3dd0e4[_0x4a95('0x1f')]===_0x4a95('0x40')){_0x512ceb[_0x4a95('0x41')]['clause']['and'](_0x4a95('0x42'),_0x3dd0e4[_0x4a95('0x3b')]);_0x512ceb[_0x4a95('0x41')]['skip']=!![];}}}return _0x512ceb;}function parseModelFields(_0x237fe1,_0x14ce71){var _0x7ecc84=squel['expr']();var _0xecd2f9=_(_0x237fe1)[_0x4a95('0x43')]()[_0x4a95('0x44')](function(_0x11321d){return _[_0x4a95('0x45')](_0x14ce71,[_0x4a95('0x33'),_0x11321d])?_0x11321d:undefined;})[_0x4a95('0x46')]()[_0x4a95('0x3b')]();if(_0x237fe1[_0x4a95('0x47')]){_0xecd2f9[_0x4a95('0x1d')](_0x4a95('0x47'));}if(_0x237fe1[_0x4a95('0x40')]){_0xecd2f9[_0x4a95('0x1d')](_0x4a95('0x40'));}if(_0xecd2f9['length']>0x0){_0xecd2f9[_0x4a95('0x1e')](function(_0x73b06b){if(_0x73b06b===_0x4a95('0x6')){_0x7ecc84[_0x4a95('0x3f')]('c.ListId\x20IN\x20?',[]['concat'](_0x237fe1[_0x73b06b]));}else if(_0x73b06b===_0x4a95('0x47')){var _0x3d8924='%'+_0x237fe1[_0x73b06b]+'%';_0x7ecc84[_0x4a95('0x3f')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x3d8924);}else if(_0x73b06b===_0x4a95('0x40')){_0x7ecc84[_0x4a95('0x3f')](_0x4a95('0x42'),_0x237fe1[_0x73b06b]);}else{_0x7ecc84['and']('c.'+_0x73b06b+'\x20=\x20?',_0x237fe1[_0x73b06b]);}});}return _0x7ecc84;}function parseQueryParameters(_0x368b1f,_0x2e9e07){var _0x27da1b=getSqlClauses();return Promise[_0x4a95('0x48')]()[_0x4a95('0x49')](function(){return parseModelFields(_0x368b1f,_0x2e9e07);})[_0x4a95('0x49')](function(_0x3faaea){_0x27da1b[_0x4a95('0x4a')][_0x4a95('0x3f')](_0x3faaea);return parseTagParameter(_0x368b1f[_0x4a95('0x4b')]);})['then'](function(_0x20ff2b){_0x27da1b[_0x4a95('0x3d')][_0x4a95('0x3e')][_0x4a95('0x3f')](_0x20ff2b);return parseSearchFilter(_0x368b1f['filter']);})['then'](function(_0x4909a6){_0x27da1b['filter']=_0x4909a6;return _0x27da1b;});}function checkListsRestrictions(_0x961886,_0x4f89a5,_0x1b5705){var _0x37da12=squel[_0x4a95('0x21')]();return Promise[_0x4a95('0x48')]()[_0x4a95('0x49')](function(){if(_0x4f89a5[_0x4a95('0x5')]&&_0x961886[_0x4a95('0x3')]===_0x4a95('0x4')&&!_0x1b5705){return _0x961886[_0x4a95('0x4c')]({'attributes':['id'],'raw':!![]});}})[_0x4a95('0x49')](function(_0x492585){if(_0x492585){if(_0x492585[_0x4a95('0x25')]===0x0){_0x37da12['and'](_0x4a95('0x4d'));}else{_0x37da12[_0x4a95('0x3f')](_0x4a95('0x4e'),_[_0x4a95('0x44')](_0x492585,'id'));}}})[_0x4a95('0x49')](function(){return _0x37da12;});}function buildContactsQuery(_0x1ca7b5,_0x2688cc,_0x5f0f2d,_0x10f3f9,_0x4811dc,_0x5ba7c8){if(_0x2688cc){_0x2688cc=_0x5f0f2d[_0x4a95('0x4f')];}_0x1ca7b5=addFieldsToQuery(_0x1ca7b5,_0x2688cc,_0x10f3f9,_0x5ba7c8,!![]);var _0x404ef0=squel[_0x4a95('0x7')]();_0x404ef0=addFieldsToQuery(_0x404ef0,_0x2688cc,_0x10f3f9,_0x5ba7c8,![]);if(_0x10f3f9||_0x5ba7c8){_0x1ca7b5=applyJoinClauses(_0x1ca7b5,!![]);_0x1ca7b5['group']('c.id');if(_0x5f0f2d[_0x4a95('0x50')]){_0x404ef0[_0x4a95('0x50')](_0x5f0f2d['limit']);}if(_0x5f0f2d[_0x4a95('0x51')]){_0x404ef0['offset'](_0x5f0f2d['offset']);}}else{_0x404ef0=applyJoinClauses(_0x404ef0,![]);_0x404ef0[_0x4a95('0x52')](_0x4a95('0x53'));if(_0x5f0f2d['limit']){_0x1ca7b5[_0x4a95('0x50')](_0x5f0f2d[_0x4a95('0x50')]);}if(_0x5f0f2d['offset']){_0x1ca7b5['offset'](_0x5f0f2d[_0x4a95('0x51')]);}}_0x404ef0[_0x4a95('0x54')](_0x4811dc);if(_0x5f0f2d[_0x4a95('0x55')]){_0x5f0f2d['order'][_0x4a95('0x1e')](function(_0x1fa51b){_0x1ca7b5[_0x4a95('0x55')]('c.'+_0x1fa51b[0x0],_0x1fa51b[0x1]===_0x4a95('0x56')?![]:!![]);_0x404ef0[_0x4a95('0x55')](_0x4a95('0x57')+_0x1fa51b[0x0],_0x1fa51b[0x1]===_0x4a95('0x56')?![]:!![]);});}_0x404ef0[_0x4a95('0x58')](_0x1ca7b5,'subqry');return _0x404ef0;}function getFilteredContacts(_0x4d3eaf){var _0x4b9d90=[];return db[_0x4a95('0x3c')][_0x4a95('0x59')]({'attributes':['id',_0x4a95('0x33'),'color'],'raw':!![]})['then'](function(_0x107145){_0x4b9d90=_[_0x4a95('0x5a')](_0x107145,'id');var _0x4ff4ca={'type':db['Sequelize'][_0x4a95('0x5b')][_0x4a95('0x5c')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x4a95('0x5d')][_0x4a95('0x5e')](_0x4d3eaf[_0x4a95('0x5f')](),_0x4ff4ca);})['then'](function(_0x41172f){_0x41172f['forEach'](function(_0x17202c){if(_0x17202c[_0x4a95('0x1b')]){_0x17202c[_0x4a95('0x60')]=[];_0x17202c[_0x4a95('0x1b')]['split'](',')[_0x4a95('0x1e')](function(_0x4fb266){_0x17202c[_0x4a95('0x60')][_0x4a95('0x1d')](_0x4b9d90[_0x4fb266]);});}delete _0x17202c[_0x4a95('0x1b')];});return _0x41172f;});}function countFilteredContacts(_0x1b9c6b,_0x792c89){var _0x4afab2=_0x1b9c6b[_0x4a95('0x61')]();_0x4afab2[_0x4a95('0x1f')](_0x4a95('0x62'));_0x4afab2=applyJoinClauses(_0x4afab2,!![]);_0x1b9c6b[_0x4a95('0x52')](_0x4a95('0x63'));var _0x5e083b=utils[_0x4a95('0x22')](_0x792c89);if(!_[_0x4a95('0x64')](_0x5e083b)){_0x4afab2[_0x4a95('0x8')]('t.id\x20IN\x20?',_0x5e083b);}var _0x1c1951={'type':db[_0x4a95('0x65')][_0x4a95('0x5b')][_0x4a95('0x5c')],'raw':!![]};return db[_0x4a95('0x5d')][_0x4a95('0x5e')](_0x4afab2[_0x4a95('0x5f')](),_0x1c1951)[_0x4a95('0x49')](function(_0x36c49c){return _0x36c49c[0x0][_0x4a95('0x62')];});}module[_0x4a95('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x4a07=['clause','and','tags','User','user','uc.UserId\x20=\x20?','skip','keys','map','some','compact','c.ListId\x20IN\x20?','Contact','resolve','then','fields','tag','filter','role','getLists','attributes','select','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','query','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','agent','search','ListId','autocomplete','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','mobile','email','CompanyId','createdAt','updatedAt','deletedAt','includes','push','forEach','TagIds','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','length','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','buildExpression','type','text','value','start','end'];(function(_0x61d131,_0x3307ac){var _0x428a2c=function(_0xfa3be){while(--_0xfa3be){_0x61d131['push'](_0x61d131['shift']());}};_0x428a2c(++_0x3307ac);}(_0x4a07,0x103));var _0x74a0=function(_0x569ff8,_0x579ae1){_0x569ff8=_0x569ff8-0x0;var _0x5d74e2=_0x4a07[_0x569ff8];return _0x5d74e2;};'use strict';var _=require(_0x74a0('0x0'));var squel=require(_0x74a0('0x1'));var as=require(_0x74a0('0x2'));var qs=require('../parsers/qs');var utils=require(_0x74a0('0x3'));var db=require(_0x74a0('0x4'))['db'];function skipContactsQuery(_0x38117e,_0x33c52f){var _0x5ec3d6=![];if(_0x38117e['role']===_0x74a0('0x5')&&!_0x33c52f[_0x74a0('0x6')]&&!_0x33c52f[_0x74a0('0x7')]&&_0x33c52f[_0x74a0('0x8')]!=='true'){_0x5ec3d6=!![];}return _0x5ec3d6;}function getContactsSubquery(){return squel['select']()['from'](_0x74a0('0x9'),'c')[_0x74a0('0xa')](_0x74a0('0xb'));}function applyJoinClauses(_0x58463f,_0x1d26df){var _0x352a00=_0x1d26df?'c':'subqry';_0x58463f[_0x74a0('0xc')]('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0x352a00+_0x74a0('0xd'))[_0x74a0('0xc')]('cm_contact_has_tags','ct',_0x74a0('0xe')+_0x352a00+'.id')[_0x74a0('0xc')](_0x74a0('0xf'),'t',_0x74a0('0x10'));return _0x58463f;}function addFieldsToQuery(_0x3af0cb,_0x50c9bc,_0x52f5a0,_0x3639c5,_0x6ae7b){var _0x47ff03=_0x6ae7b?'c':_0x74a0('0x11');if(!_0x50c9bc){_0x50c9bc=['id',_0x74a0('0x12'),_0x74a0('0x13'),'phone',_0x74a0('0x14'),'fax',_0x74a0('0x15'),_0x74a0('0x7'),_0x74a0('0x16'),_0x74a0('0x17'),_0x74a0('0x18'),_0x74a0('0x19'),'TagIds'];}else if(!_0x50c9bc[_0x74a0('0x1a')]('id')){_0x50c9bc[_0x74a0('0x1b')]('id');}var _0x22205e=_0x52f5a0&&_0x6ae7b||!_0x52f5a0&&!_0x6ae7b;if(_0x3639c5){_0x22205e=_0x3639c5&&_0x6ae7b||!_0x3639c5&&!_0x6ae7b;}_0x50c9bc[_0x74a0('0x1c')](function(_0x4718aa){if(_0x4718aa===_0x74a0('0x1d')){if(_0x22205e){_0x3af0cb['field'](_0x74a0('0x1e'),_0x4718aa);}else if(_0x52f5a0||_0x3639c5){_0x3af0cb[_0x74a0('0x1f')](_0x47ff03+'.'+_0x4718aa);}}else{_0x3af0cb[_0x74a0('0x1f')](_0x47ff03+'.'+_0x4718aa);}});return _0x3af0cb;}function getSqlClauses(){var _0x58ab3b={'default':squel[_0x74a0('0x20')](),'fields':squel[_0x74a0('0x20')](),'filter':squel[_0x74a0('0x20')](),'tags':{'clause':squel[_0x74a0('0x20')](),'ids':null},'user':{'clause':squel[_0x74a0('0x20')](),'skip':![]}};return _0x58ab3b;}function parseTagParameter(_0x8b2711){var _0x532890=squel[_0x74a0('0x20')]();if(_0x8b2711){var _0x3dfb1a=utils[_0x74a0('0x21')](_0x8b2711);_0x3dfb1a[_0x74a0('0x1c')](function(_0x275a82){_0x532890['or'](_0x74a0('0x22'),'%,'+_0x275a82+',%');});}return _0x532890;}function parseSearchFilter(_0x3aadc5){var _0x8da47b=squel[_0x74a0('0x20')]();if(_0x3aadc5){var _0x57c49c=_0x3aadc5[_0x74a0('0x23')]('\x5c','\x5c\x5c')[_0x74a0('0x23')](/'/g,'\x27\x27');var _0x2ab2bd=qs[_0x74a0('0x24')](_0x57c49c);if(_0x57c49c[_0x74a0('0x25')]('\x20')[_0x74a0('0x26')]>0x1){_0x8da47b['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x57c49c,!![]),null);}else{if(qs['isNumeric'](_0x57c49c)){_0x8da47b['or'](_0x74a0('0x27'),_0x2ab2bd+'%');_0x8da47b['or'](_0x74a0('0x28'),_0x2ab2bd+'%');_0x8da47b['or']('c.mobile\x20LIKE\x20?',_0x2ab2bd+'%');_0x8da47b['or'](_0x74a0('0x29'),_0x2ab2bd+'%');}else if(qs['isEmail'](_0x57c49c)){_0x8da47b['or'](_0x74a0('0x2a'),_0x2ab2bd+'%');}else{_0x8da47b['or'](_0x74a0('0x2b'),'%'+_0x2ab2bd+'%');_0x8da47b['or'](_0x74a0('0x2c'),'%'+_0x2ab2bd+'%');_0x8da47b['or'](_0x74a0('0x2a'),'%'+_0x2ab2bd+'%');}}}return _0x8da47b;}function parseAdvancedSearchFilter(_0x131aa8,_0x3703bc){var _0x2f7d40=getSqlClauses();var _0x335132=as[_0x74a0('0x2d')](_0x131aa8);var _0x34280d=_0x335132['sqlOperator'];for(var _0x52cd77=0x0;_0x52cd77<_0x335132[_0x74a0('0x2e')][_0x74a0('0x26')];_0x52cd77++){var _0x578173=_0x335132[_0x74a0('0x2e')][_0x52cd77];var _0xefc7de='c';var _0x2144b6=_[_0x74a0('0x2f')](_0x3703bc,[_0x74a0('0x30'),_0x578173[_0x74a0('0x1f')]]);if(_0x2144b6){if(_0x578173[_0x74a0('0x1f')]===_0x74a0('0x31')||_0x2144b6[_0x74a0('0x32')]===_0x74a0('0x33')){_0x578173['castTo']=_0x74a0('0x34');}var _0x19329f=as[_0x74a0('0x35')](_0xefc7de,_0x2144b6[_0x74a0('0x36')],_0x578173);_0x2f7d40['default'][_0x34280d](_0x19329f[_0x74a0('0x37')],_0x19329f[_0x74a0('0x38')][_0x74a0('0x39')],_0x19329f[_0x74a0('0x38')][_0x74a0('0x3a')]);}else{if(_0x578173[_0x74a0('0x1f')]==='Tag'){var _0x311831=_0x578173[_0x74a0('0x38')][_0x74a0('0x25')](',')['map'](function(_0x36f17e){return Number(_0x36f17e);});var _0x3fba93=parseTagParameter(_0x311831);_0x2f7d40['tags'][_0x74a0('0x3b')][_0x74a0('0x3c')](_0x3fba93);_0x2f7d40[_0x74a0('0x3d')]['ids']=_0x311831;}else if(_0x578173[_0x74a0('0x1f')]===_0x74a0('0x3e')){_0x2f7d40[_0x74a0('0x3f')][_0x74a0('0x3b')][_0x74a0('0x3c')](_0x74a0('0x40'),_0x578173['value']);_0x2f7d40[_0x74a0('0x3f')][_0x74a0('0x41')]=!![];}}}return _0x2f7d40;}function parseModelFields(_0x48106b,_0x56d74d){var _0x41bf4e=squel[_0x74a0('0x20')]();var _0x4c2b5e=_(_0x48106b)[_0x74a0('0x42')]()[_0x74a0('0x43')](function(_0x420ed1){return _[_0x74a0('0x44')](_0x56d74d,[_0x74a0('0x30'),_0x420ed1])?_0x420ed1:undefined;})[_0x74a0('0x45')]()[_0x74a0('0x38')]();if(_0x48106b['Contact']){_0x4c2b5e[_0x74a0('0x1b')]('Contact');}if(_0x48106b[_0x74a0('0x3e')]){_0x4c2b5e[_0x74a0('0x1b')]('User');}if(_0x4c2b5e[_0x74a0('0x26')]>0x0){_0x4c2b5e[_0x74a0('0x1c')](function(_0x4c188b){if(_0x4c188b===_0x74a0('0x7')){_0x41bf4e['and'](_0x74a0('0x46'),[]['concat'](_0x48106b[_0x4c188b]));}else if(_0x4c188b===_0x74a0('0x47')){var _0x537dd5='%'+_0x48106b[_0x4c188b]+'%';_0x41bf4e['and']('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x537dd5);}else if(_0x4c188b===_0x74a0('0x3e')){_0x41bf4e[_0x74a0('0x3c')](_0x74a0('0x40'),_0x48106b[_0x4c188b]);}else{_0x41bf4e[_0x74a0('0x3c')]('c.'+_0x4c188b+'\x20=\x20?',_0x48106b[_0x4c188b]);}});}return _0x41bf4e;}function parseQueryParameters(_0x351989,_0x2b5f13){var _0x2cf3d9=getSqlClauses();return Promise[_0x74a0('0x48')]()['then'](function(){return parseModelFields(_0x351989,_0x2b5f13);})[_0x74a0('0x49')](function(_0x4f9aae){_0x2cf3d9[_0x74a0('0x4a')][_0x74a0('0x3c')](_0x4f9aae);return parseTagParameter(_0x351989[_0x74a0('0x4b')]);})[_0x74a0('0x49')](function(_0x45b9d8){_0x2cf3d9['tags'][_0x74a0('0x3b')][_0x74a0('0x3c')](_0x45b9d8);return parseSearchFilter(_0x351989[_0x74a0('0x4c')]);})[_0x74a0('0x49')](function(_0x29ae99){_0x2cf3d9[_0x74a0('0x4c')]=_0x29ae99;return _0x2cf3d9;});}function checkListsRestrictions(_0x2dcfc2,_0x1483d7,_0x291343){var _0x24f08b=squel[_0x74a0('0x20')]();return Promise[_0x74a0('0x48')]()['then'](function(){if(_0x1483d7[_0x74a0('0x6')]&&_0x2dcfc2[_0x74a0('0x4d')]==='agent'&&!_0x291343){return _0x2dcfc2[_0x74a0('0x4e')]({'attributes':['id'],'raw':!![]});}})[_0x74a0('0x49')](function(_0x1fd4df){if(_0x1fd4df){if(_0x1fd4df[_0x74a0('0x26')]===0x0){_0x24f08b['and']('c.ListId\x20IS\x20NULL');}else{_0x24f08b['and'](_0x74a0('0x46'),_[_0x74a0('0x43')](_0x1fd4df,'id'));}}})[_0x74a0('0x49')](function(){return _0x24f08b;});}function buildContactsQuery(_0x2c7dad,_0x1ba6a9,_0x28e90a,_0x1aa2cf,_0x233e7a,_0x53717c){if(_0x1ba6a9){_0x1ba6a9=_0x28e90a[_0x74a0('0x4f')];}_0x2c7dad=addFieldsToQuery(_0x2c7dad,_0x1ba6a9,_0x1aa2cf,_0x53717c,!![]);var _0x29937e=squel[_0x74a0('0x50')]();_0x29937e=addFieldsToQuery(_0x29937e,_0x1ba6a9,_0x1aa2cf,_0x53717c,![]);if(_0x1aa2cf||_0x53717c){_0x2c7dad=applyJoinClauses(_0x2c7dad,!![]);_0x2c7dad[_0x74a0('0x51')](_0x74a0('0x52'));if(_0x28e90a['limit']){_0x29937e[_0x74a0('0x53')](_0x28e90a[_0x74a0('0x53')]);}if(_0x28e90a['offset']){_0x29937e[_0x74a0('0x54')](_0x28e90a[_0x74a0('0x54')]);}}else{_0x29937e=applyJoinClauses(_0x29937e,![]);_0x29937e['group'](_0x74a0('0x55'));if(_0x28e90a['limit']){_0x2c7dad[_0x74a0('0x53')](_0x28e90a[_0x74a0('0x53')]);}if(_0x28e90a[_0x74a0('0x54')]){_0x2c7dad['offset'](_0x28e90a[_0x74a0('0x54')]);}}_0x29937e[_0x74a0('0x56')](_0x233e7a);if(_0x28e90a[_0x74a0('0x57')]){_0x28e90a[_0x74a0('0x57')][_0x74a0('0x1c')](function(_0x8ba8c6){_0x2c7dad[_0x74a0('0x57')]('c.'+_0x8ba8c6[0x0],_0x8ba8c6[0x1]===_0x74a0('0x58')?![]:!![]);_0x29937e[_0x74a0('0x57')](_0x74a0('0x59')+_0x8ba8c6[0x0],_0x8ba8c6[0x1]===_0x74a0('0x58')?![]:!![]);});}_0x29937e[_0x74a0('0x5a')](_0x2c7dad,'subqry');return _0x29937e;}function getFilteredContacts(_0x993bb9){var _0x141726=[];return db['Tag'][_0x74a0('0x5b')]({'attributes':['id',_0x74a0('0x30'),_0x74a0('0x5c')],'raw':!![]})[_0x74a0('0x49')](function(_0x4f9514){_0x141726=_[_0x74a0('0x5d')](_0x4f9514,'id');var _0x271695={'type':db[_0x74a0('0x5e')][_0x74a0('0x5f')][_0x74a0('0x60')],'model':db[_0x74a0('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x74a0('0x62')]['query'](_0x993bb9[_0x74a0('0x63')](),_0x271695);})[_0x74a0('0x49')](function(_0x58be79){_0x58be79[_0x74a0('0x1c')](function(_0x2fee0c){if(_0x2fee0c[_0x74a0('0x1d')]){_0x2fee0c[_0x74a0('0x64')]=[];_0x2fee0c[_0x74a0('0x1d')][_0x74a0('0x25')](',')[_0x74a0('0x1c')](function(_0x3eb501){_0x2fee0c[_0x74a0('0x64')][_0x74a0('0x1b')](_0x141726[_0x3eb501]);});}delete _0x2fee0c[_0x74a0('0x1d')];});return _0x58be79;});}function countFilteredContacts(_0x20bc7e,_0x3a76ab){var _0x316ba1=_0x20bc7e[_0x74a0('0x65')]();_0x316ba1[_0x74a0('0x1f')](_0x74a0('0x66'));_0x316ba1=applyJoinClauses(_0x316ba1,!![]);_0x20bc7e['group']('c.id');var _0x7d5aae=utils[_0x74a0('0x21')](_0x3a76ab);if(!_[_0x74a0('0x67')](_0x7d5aae)){_0x316ba1[_0x74a0('0xa')](_0x74a0('0x68'),_0x7d5aae);}var _0x2a184e={'type':db[_0x74a0('0x5e')][_0x74a0('0x5f')]['SELECT'],'raw':!![]};return db[_0x74a0('0x62')][_0x74a0('0x69')](_0x316ba1[_0x74a0('0x63')](),_0x2a184e)[_0x74a0('0x49')](function(_0xf427c4){return _0xf427c4[0x0][_0x74a0('0x66')];});}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 68d454b..23d1d79 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 _0x3736=['binary','write','end','decryptFile','update','close','unlink','utf8','base64','final','decryptString','secret','createDecipher','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data'];(function(_0x37eda6,_0x1189bc){var _0x20d4e3=function(_0x152526){while(--_0x152526){_0x37eda6['push'](_0x37eda6['shift']());}};_0x20d4e3(++_0x1189bc);}(_0x3736,0x76));var _0x6373=function(_0x407565,_0x4c4d59){_0x407565=_0x407565-0x0;var _0x543a7c=_0x3736[_0x407565];return _0x543a7c;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x6373('0x0'));var _=require(_0x6373('0x1'));var config=require(_0x6373('0x2'));var logger=require('../../config/logger')(_0x6373('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6373('0x4')][_0x6373('0x5')],'algorithm':_0x6373('0x6')};const fileOptions={'algorithm':_0x6373('0x7')};if(config[_0x6373('0x8')]&&config[_0x6373('0x8')][_0x6373('0x9')]){var isSupported=isAlgorithmSupported(config[_0x6373('0x8')][_0x6373('0x9')]);if(isSupported){fileOptions[_0x6373('0x9')]=config[_0x6373('0x8')][_0x6373('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6373('0xa')](',\x20');logger[_0x6373('0xb')](config['encrypt'][_0x6373('0x9')],_0x6373('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x3399f5){return AES_SUPPORTED_RX[_0x6373('0xd')](_0x3399f5);}function getSupportedCiphers(){return crypto[_0x6373('0xe')]()[_0x6373('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x26ce5c){return getSupportedCiphers()[_0x6373('0x10')](_0x26ce5c)>-0x1;}function combineOptions(_0x5cd44f){var _0x5d3290={};for(var _0x439605 in fileOptions){if(fileOptions[_0x6373('0x11')](_0x439605)){_0x5d3290[_0x439605]=fileOptions[_0x439605];}}if(_0x5cd44f){for(var _0x122932 in _0x5cd44f){if(_0x5cd44f[_0x6373('0x11')](_0x122932)){_0x5d3290[_0x122932]=_0x5cd44f[_0x122932];}}}return _0x5d3290;}exports[_0x6373('0x12')]=function(_0x46f5c2,_0x178b58,_0x288889,_0x3769e6){return new BPromise(function(_0x1a970c,_0x17d15b){_0x3769e6=combineOptions(_0x3769e6);var _0x299d68=new Buffer(_0x288889);var _0x49cca4=fs[_0x6373('0x13')](_0x46f5c2);var _0xae2336=fs['createWriteStream'](_0x178b58);var _0x484191=crypto[_0x6373('0x14')](_0x3769e6[_0x6373('0x9')],_0x299d68);_0x49cca4['on'](_0x6373('0x15'),function(_0xb90d52){var _0x208ff8=new Buffer(_0x484191['update'](_0xb90d52),_0x6373('0x16'));_0xae2336[_0x6373('0x17')](_0x208ff8);});_0x49cca4['on'](_0x6373('0x18'),function(){try{var _0x28cb7e=new Buffer(_0x484191['final']('binary'),_0x6373('0x16'));_0xae2336[_0x6373('0x17')](_0x28cb7e);_0xae2336[_0x6373('0x18')]();_0xae2336['on']('close',function(){return _0x1a970c(_0x178b58);});}catch(_0x5bb938){fs['unlink'](_0x178b58);return _0x17d15b(_0x5bb938);}});});};exports[_0x6373('0x19')]=function(_0x679ae1,_0x21fdfc,_0x5ac2d0,_0xd11417){return new BPromise(function(_0x460a7e,_0x49efdf){_0xd11417=combineOptions(_0xd11417);var _0x58a9e5=new Buffer(_0x5ac2d0);var _0x153622=fs['createReadStream'](_0x679ae1);var _0xc1c84e=fs['createWriteStream'](_0x21fdfc);var _0x20c146=crypto['createDecipher'](_0xd11417[_0x6373('0x9')],_0x58a9e5);_0x153622['on'](_0x6373('0x15'),function(_0x4e7fc3){var _0x4ac1a1=new Buffer(_0x20c146[_0x6373('0x1a')](_0x4e7fc3),_0x6373('0x16'));_0xc1c84e[_0x6373('0x17')](_0x4ac1a1);});_0x153622['on'](_0x6373('0x18'),function(){try{var _0x54242b=new Buffer(_0x20c146['final']('binary'),_0x6373('0x16'));_0xc1c84e['write'](_0x54242b);_0xc1c84e[_0x6373('0x18')]();_0xc1c84e['on'](_0x6373('0x1b'),function(){return _0x460a7e(_0x21fdfc);});}catch(_0x5b94e7){fs[_0x6373('0x1c')](_0x21fdfc);return _0x49efdf(_0x5b94e7);}});});};exports['encryptString']=function(_0xa40ade,_0x28c067,_0x3b89a8){var _0x5c24bf=_0x3b89a8||stringOptions[_0x6373('0x9')];var _0x18106f=_0x28c067||stringOptions['secret'];var _0x13c9e4=crypto['createCipher'](_0x5c24bf,_0x18106f);var _0xb4bdad=_0x13c9e4[_0x6373('0x1a')](_0xa40ade,_0x6373('0x1d'),_0x6373('0x1e'));_0xb4bdad+=_0x13c9e4[_0x6373('0x1f')](_0x6373('0x1e'));return _0xb4bdad;};exports[_0x6373('0x20')]=function(_0x24a1eb,_0x9a930b,_0x334c85){var _0x42b9bb=_0x334c85||stringOptions['algorithm'];var _0x5eded1=_0x9a930b||stringOptions[_0x6373('0x21')];var _0x3b8231=crypto[_0x6373('0x22')](_0x42b9bb,_0x5eded1);var _0xf4b537=_0x3b8231[_0x6373('0x1a')](_0x24a1eb,_0x6373('0x1e'),_0x6373('0x1d'));_0xf4b537+=_0x3b8231['final'](_0x6373('0x1d'));return _0xf4b537;}; \ No newline at end of file +var _0xd2c0=['getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','data','update','binary','write','end','final','close','decryptFile','createWriteStream','createDecipher','unlink','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','lodash','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0xfbe06e,_0x2fb7ab){var _0x24e5b6=function(_0x48569f){while(--_0x48569f){_0xfbe06e['push'](_0xfbe06e['shift']());}};_0x24e5b6(++_0x2fb7ab);}(_0xd2c0,0x10c));var _0x0d2c=function(_0xa2d152,_0x5555e6){_0xa2d152=_0xa2d152-0x0;var _0x3e973a=_0xd2c0[_0xa2d152];return _0x3e973a;};'use strict';var crypto=require(_0x0d2c('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x0d2c('0x1'));var config=require('../../config/environment');var logger=require(_0x0d2c('0x2'))(_0x0d2c('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0d2c('0x4')][_0x0d2c('0x5')],'algorithm':_0x0d2c('0x6')};const fileOptions={'algorithm':_0x0d2c('0x7')};if(config[_0x0d2c('0x8')]&&config[_0x0d2c('0x8')][_0x0d2c('0x9')]){var isSupported=isAlgorithmSupported(config[_0x0d2c('0x8')][_0x0d2c('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x0d2c('0x8')][_0x0d2c('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0d2c('0xa')](',\x20');logger['error'](config[_0x0d2c('0x8')][_0x0d2c('0x9')],_0x0d2c('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x191424){return AES_SUPPORTED_RX['test'](_0x191424);}function getSupportedCiphers(){return crypto[_0x0d2c('0xc')]()[_0x0d2c('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x6be5bc){return getSupportedCiphers()[_0x0d2c('0xe')](_0x6be5bc)>-0x1;}function combineOptions(_0x13cb72){var _0x1826d8={};for(var _0x41e47c in fileOptions){if(fileOptions['hasOwnProperty'](_0x41e47c)){_0x1826d8[_0x41e47c]=fileOptions[_0x41e47c];}}if(_0x13cb72){for(var _0x2355da in _0x13cb72){if(_0x13cb72[_0x0d2c('0xf')](_0x2355da)){_0x1826d8[_0x2355da]=_0x13cb72[_0x2355da];}}}return _0x1826d8;}exports[_0x0d2c('0x10')]=function(_0x305afe,_0x55d639,_0x447b2d,_0x158d7f){return new BPromise(function(_0x322569,_0x1630bb){_0x158d7f=combineOptions(_0x158d7f);var _0x1cdbdf=new Buffer(_0x447b2d);var _0x447679=fs[_0x0d2c('0x11')](_0x305afe);var _0x38ab61=fs['createWriteStream'](_0x55d639);var _0xb98a9e=crypto['createCipher'](_0x158d7f[_0x0d2c('0x9')],_0x1cdbdf);_0x447679['on'](_0x0d2c('0x12'),function(_0xfef01d){var _0x199c45=new Buffer(_0xb98a9e[_0x0d2c('0x13')](_0xfef01d),_0x0d2c('0x14'));_0x38ab61[_0x0d2c('0x15')](_0x199c45);});_0x447679['on'](_0x0d2c('0x16'),function(){try{var _0x1e5f80=new Buffer(_0xb98a9e[_0x0d2c('0x17')]('binary'),_0x0d2c('0x14'));_0x38ab61[_0x0d2c('0x15')](_0x1e5f80);_0x38ab61[_0x0d2c('0x16')]();_0x38ab61['on'](_0x0d2c('0x18'),function(){return _0x322569(_0x55d639);});}catch(_0x16286f){fs['unlink'](_0x55d639);return _0x1630bb(_0x16286f);}});});};exports[_0x0d2c('0x19')]=function(_0x3dcfe9,_0x1dc932,_0x10ade0,_0x2bc496){return new BPromise(function(_0x1b789b,_0x15d398){_0x2bc496=combineOptions(_0x2bc496);var _0x217feb=new Buffer(_0x10ade0);var _0x22c723=fs[_0x0d2c('0x11')](_0x3dcfe9);var _0x59cced=fs[_0x0d2c('0x1a')](_0x1dc932);var _0x39aba1=crypto[_0x0d2c('0x1b')](_0x2bc496[_0x0d2c('0x9')],_0x217feb);_0x22c723['on'](_0x0d2c('0x12'),function(_0x22b048){var _0x4c4444=new Buffer(_0x39aba1[_0x0d2c('0x13')](_0x22b048),_0x0d2c('0x14'));_0x59cced[_0x0d2c('0x15')](_0x4c4444);});_0x22c723['on'](_0x0d2c('0x16'),function(){try{var _0x233f17=new Buffer(_0x39aba1[_0x0d2c('0x17')](_0x0d2c('0x14')),'binary');_0x59cced[_0x0d2c('0x15')](_0x233f17);_0x59cced[_0x0d2c('0x16')]();_0x59cced['on'](_0x0d2c('0x18'),function(){return _0x1b789b(_0x1dc932);});}catch(_0x56ea2f){fs[_0x0d2c('0x1c')](_0x1dc932);return _0x15d398(_0x56ea2f);}});});};exports[_0x0d2c('0x1d')]=function(_0x1732fa,_0x525473,_0x211c72){var _0x5f4cf4=_0x211c72||stringOptions['algorithm'];var _0x4fee28=_0x525473||stringOptions[_0x0d2c('0x1e')];var _0x4a63c4=crypto[_0x0d2c('0x1f')](_0x5f4cf4,_0x4fee28);var _0x538d7a=_0x4a63c4['update'](_0x1732fa,_0x0d2c('0x20'),_0x0d2c('0x21'));_0x538d7a+=_0x4a63c4[_0x0d2c('0x17')](_0x0d2c('0x21'));return _0x538d7a;};exports[_0x0d2c('0x22')]=function(_0x7f86d5,_0x23ac41,_0x4d629b){var _0x1e96d3=_0x4d629b||stringOptions[_0x0d2c('0x9')];var _0x5adbbe=_0x23ac41||stringOptions[_0x0d2c('0x1e')];var _0x406c75=crypto[_0x0d2c('0x1b')](_0x1e96d3,_0x5adbbe);var _0x440047=_0x406c75[_0x0d2c('0x13')](_0x7f86d5,'base64',_0x0d2c('0x20'));_0x440047+=_0x406c75[_0x0d2c('0x17')](_0x0d2c('0x20'));return _0x440047;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 272acea..cb4de2f 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 _0xb4d4=['length','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','inspect','exit','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty'];(function(_0x29c084,_0x4fdbd7){var _0x2c3639=function(_0x4f4e03){while(--_0x4f4e03){_0x29c084['push'](_0x29c084['shift']());}};_0x2c3639(++_0x4fdbd7);}(_0xb4d4,0x148));var _0x4b4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb4d4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var path=require('path');var _=require(_0x4b4d('0x0'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x4b4d('0x1'));var zipdir=require(_0x4b4d('0x2'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x4b4d('0x3'))[_0x4b4d('0x4')];var logger=require(_0x4b4d('0x5'))(_0x4b4d('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4b4d('0x7')][0x3];var PATH=process[_0x4b4d('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2aed1b,_0x26f761){var _0x4cf682={'status':_0x2aed1b};var _0x4daaad={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x26f761){_0x4cf682[_0x4b4d('0x8')]=_0x26f761;}return db['AnalyticExtractedReport'][_0x4b4d('0x9')](_0x4cf682,_0x4daaad);}function main(){var _0x36c010=0x1388;var _0x4f7e62;logger[_0x4b4d('0xa')](util[_0x4b4d('0xb')](_0x4b4d('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x4b4d('0xd')][_0x4b4d('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4b4d('0xf'),'splitSizeCsv']})['then'](function(_0x286ea6){if(_0x286ea6){_0x4f7e62=_0x286ea6;_0x36c010=_0x4f7e62[_0x4b4d('0x10')]||0x1388;}})[_0x4b4d('0x11')](function(){return dbH[_0x4b4d('0x12')][_0x4b4d('0x13')](util['format'](_0x4b4d('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x4b4d('0x15')]});})[_0x4b4d('0x11')](function(_0x5d50d7){if(!_0x5d50d7[0x0][_0x4b4d('0x16')]){return analyticExtractedReport(_0x4b4d('0x17'));}var _0x260ab7=[];var _0x20c4ac=0x0;if(_0x4f7e62[_0x4b4d('0xf')]){if(_0x5d50d7&&_0x5d50d7[_0x4b4d('0x18')]){var _0x4aae02=_[_0x4b4d('0x19')](_0x5d50d7[0x0][_0x4b4d('0x16')]/_0x36c010);var _0x32cee5=Number['isInteger'](_0x5d50d7[0x0]['num']/_0x36c010)?_0x5d50d7[0x0][_0x4b4d('0x16')]%_0x36c010:0x0;_0x4aae02['forEach'](function(_0x165472){if(_0x165472>0x0){_0x20c4ac+=_0x36c010;}_0x260ab7[_0x4b4d('0x1a')](dbH[_0x4b4d('0x12')][_0x4b4d('0x13')](util[_0x4b4d('0xb')](_0x4b4d('0x1b'),QUERY,_0x36c010,_0x20c4ac),{'type':dbH[_0x4b4d('0x12')]['QueryTypes']['SELECT']}));});if(_0x32cee5>0x0){_0x20c4ac+=_0x36c010;_0x260ab7[_0x4b4d('0x1a')](dbH['sequelize'][_0x4b4d('0x13')](util['format'](_0x4b4d('0x1b'),QUERY,_0x32cee5,_0x20c4ac),{'type':dbH[_0x4b4d('0x12')][_0x4b4d('0x1c')][_0x4b4d('0x15')]}));}}}else{_0x260ab7['push'](dbH['sequelize'][_0x4b4d('0x13')](QUERY,{'type':dbH[_0x4b4d('0x12')]['QueryTypes']['SELECT']}));}var _0x31fc6a=path[_0x4b4d('0x1d')](PATH);var _0x5853cb=path[_0x4b4d('0x1e')](PATH,'.csv');var _0x41d3c1=_0x4f7e62['split']&&_0x260ab7[_0x4b4d('0x18')]>0x1;var _0x30b4e6=[];if(!fs[_0x4b4d('0x1f')](path[_0x4b4d('0x20')](_0x31fc6a,_0x5853cb))&&_0x41d3c1){fs[_0x4b4d('0x21')](path['join'](_0x31fc6a,_0x5853cb));}return BPromise[_0x4b4d('0x22')](_0x260ab7,function(_0x54c630){_0x30b4e6[_0x4b4d('0x1a')](_0x54c630);})[_0x4b4d('0x11')](function(){for(var _0x50506b=0x0;_0x50506b<_0x30b4e6['length'];_0x50506b+=0x1){var _0x28844d;var _0x389948=_0x30b4e6[_0x50506b];if(_0x41d3c1){_0x28844d=path[_0x4b4d('0x20')](_0x31fc6a,_0x5853cb,util[_0x4b4d('0xb')](_0x4b4d('0x23'),_0x5853cb,_0x50506b,_0x4b4d('0x24')));}else{_0x28844d=path[_0x4b4d('0x20')](_0x31fc6a,util[_0x4b4d('0xb')](_0x4b4d('0x25'),_0x5853cb,_0x4b4d('0x24')));}fs['writeFileSync'](_0x28844d,csv(_0x389948));}})[_0x4b4d('0x11')](function(){if(_0x41d3c1){return new Promise(function(_0x661565){zipdir(path[_0x4b4d('0x20')](_0x31fc6a,_0x5853cb),{'saveTo':path[_0x4b4d('0x20')](_0x31fc6a,util[_0x4b4d('0xb')]('%s.%s',_0x5853cb,_0x4b4d('0x26')))},function(_0x32f53b,_0x4fefd1){rimraf(path[_0x4b4d('0x20')](_0x31fc6a,_0x5853cb),function(){});_0x661565('zip\x20finished');});});}})[_0x4b4d('0x11')](function(){logger['info'](util['format'](_0x4b4d('0x27'),EXTRACTED_REPORT_ID,_0x4b4d('0x28')));return analyticExtractedReport('Completed',_0x41d3c1?util[_0x4b4d('0xb')](_0x4b4d('0x25'),_0x5853cb,_0x41d3c1?'zip':_0x4b4d('0x24')):null);});})[_0x4b4d('0x29')](function(_0x4f77ba){logger[_0x4b4d('0xa')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4b4d('0x28')),util[_0x4b4d('0x2a')](_0x4f77ba,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x4b4d('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5d5d=['join','csv','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','sequelize','num','length','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','existsSync','mkdirSync'];(function(_0xed574d,_0x242c08){var _0x32bbd7=function(_0x372c4f){while(--_0x372c4f){_0xed574d['push'](_0xed574d['shift']());}};_0x32bbd7(++_0x242c08);}(_0x5d5d,0xf5));var _0xd5d5=function(_0x2fdea0,_0x35dbe3){_0x2fdea0=_0x2fdea0-0x0;var _0x19db1e=_0x5d5d[_0x2fdea0];return _0x19db1e;};'use strict';var util=require(_0xd5d5('0x0'));var path=require('path');var _=require(_0xd5d5('0x1'));var csv=require(_0xd5d5('0x2'));var fs=require('fs');var BPromise=require(_0xd5d5('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xd5d5('0x4'))['db'];var dbH=require(_0xd5d5('0x4'))[_0xd5d5('0x5')];var logger=require(_0xd5d5('0x6'))(_0xd5d5('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd5d5('0x8')][0x3];var PATH=process[_0xd5d5('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4b75d8,_0x16431d){var _0x1fd131={'status':_0x4b75d8};var _0x285efd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16431d){_0x1fd131['savename']=_0x16431d;}return db['AnalyticExtractedReport'][_0xd5d5('0x9')](_0x1fd131,_0x285efd);}function main(){var _0x377589=0x1388;var _0x54b0be;logger['info'](util[_0xd5d5('0xa')](_0xd5d5('0xb'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0xd5d5('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd5d5('0xd'),'splitSizeCsv']})['then'](function(_0x5179b5){if(_0x5179b5){_0x54b0be=_0x5179b5;_0x377589=_0x54b0be[_0xd5d5('0xe')]||0x1388;}})[_0xd5d5('0xf')](function(){return dbH[_0xd5d5('0x10')]['query'](util[_0xd5d5('0xa')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd5d5('0x10')]['QueryTypes']['SELECT']});})['then'](function(_0x3c4b66){if(!_0x3c4b66[0x0][_0xd5d5('0x11')]){return analyticExtractedReport('Empty');}var _0x2ad8cb=[];var _0x465e4b=0x0;if(_0x54b0be[_0xd5d5('0xd')]){if(_0x3c4b66&&_0x3c4b66[_0xd5d5('0x12')]){var _0x11f6a4=_['range'](_0x3c4b66[0x0][_0xd5d5('0x11')]/_0x377589);var _0xc2922=Number['isInteger'](_0x3c4b66[0x0][_0xd5d5('0x11')]/_0x377589)?_0x3c4b66[0x0][_0xd5d5('0x11')]%_0x377589:0x0;_0x11f6a4[_0xd5d5('0x13')](function(_0x989af7){if(_0x989af7>0x0){_0x465e4b+=_0x377589;}_0x2ad8cb[_0xd5d5('0x14')](dbH[_0xd5d5('0x10')][_0xd5d5('0x15')](util['format'](_0xd5d5('0x16'),QUERY,_0x377589,_0x465e4b),{'type':dbH['sequelize'][_0xd5d5('0x17')][_0xd5d5('0x18')]}));});if(_0xc2922>0x0){_0x465e4b+=_0x377589;_0x2ad8cb[_0xd5d5('0x14')](dbH[_0xd5d5('0x10')][_0xd5d5('0x15')](util[_0xd5d5('0xa')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xc2922,_0x465e4b),{'type':dbH[_0xd5d5('0x10')][_0xd5d5('0x17')][_0xd5d5('0x18')]}));}}}else{_0x2ad8cb[_0xd5d5('0x14')](dbH['sequelize'][_0xd5d5('0x15')](QUERY,{'type':dbH['sequelize'][_0xd5d5('0x17')][_0xd5d5('0x18')]}));}var _0x3c25c2=path['dirname'](PATH);var _0x3225ed=path[_0xd5d5('0x19')](PATH,'.csv');var _0x1d6e38=_0x54b0be['split']&&_0x2ad8cb[_0xd5d5('0x12')]>0x1;var _0x41a1a2=[];if(!fs[_0xd5d5('0x1a')](path['join'](_0x3c25c2,_0x3225ed))&&_0x1d6e38){fs[_0xd5d5('0x1b')](path[_0xd5d5('0x1c')](_0x3c25c2,_0x3225ed));}return BPromise['each'](_0x2ad8cb,function(_0xc5c36e){_0x41a1a2['push'](_0xc5c36e);})[_0xd5d5('0xf')](function(){for(var _0x188375=0x0;_0x188375<_0x41a1a2[_0xd5d5('0x12')];_0x188375+=0x1){var _0x34e727;var _0xa0405d=_0x41a1a2[_0x188375];if(_0x1d6e38){_0x34e727=path[_0xd5d5('0x1c')](_0x3c25c2,_0x3225ed,util[_0xd5d5('0xa')]('%s%d.%s',_0x3225ed,_0x188375,_0xd5d5('0x1d')));}else{_0x34e727=path[_0xd5d5('0x1c')](_0x3c25c2,util['format'](_0xd5d5('0x1e'),_0x3225ed,_0xd5d5('0x1d')));}fs['writeFileSync'](_0x34e727,csv(_0xa0405d));}})[_0xd5d5('0xf')](function(){if(_0x1d6e38){return new Promise(function(_0x3270db){zipdir(path[_0xd5d5('0x1c')](_0x3c25c2,_0x3225ed),{'saveTo':path[_0xd5d5('0x1c')](_0x3c25c2,util[_0xd5d5('0xa')](_0xd5d5('0x1e'),_0x3225ed,'zip'))},function(_0x52959d,_0x350e35){rimraf(path[_0xd5d5('0x1c')](_0x3c25c2,_0x3225ed),function(){});_0x3270db('zip\x20finished');});});}})[_0xd5d5('0xf')](function(){logger['info'](util[_0xd5d5('0xa')](_0xd5d5('0x1f'),EXTRACTED_REPORT_ID,_0xd5d5('0x20')));return analyticExtractedReport(_0xd5d5('0x21'),_0x1d6e38?util['format'](_0xd5d5('0x1e'),_0x3225ed,_0x1d6e38?_0xd5d5('0x22'):'csv'):null);});})['catch'](function(_0x446774){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd5d5('0x20')),util[_0xd5d5('0x23')](_0x446774,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd5d5('0x24'));})[_0xd5d5('0x25')](function(){process[_0xd5d5('0x26')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index b5ae2bb..3970b7e 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 _0x81d9=['query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','join','mkdirSync','flatten','%s%d.%s','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','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','createPdfFromHTML','createPdfKitDocument','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','fill','length','body','push','concat','keys','forEach','name','startDate','format','header','pageBreak','before','landscape','Arial','black','right','Empty','Setting','find','splitSizePdf','then','split','range','num','isInteger','sequelize','QueryTypes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81d9,0x84));var _0x981d=function(_0x3a805c,_0x282353){_0x3a805c=_0x3a805c-0x0;var _0x3c8364=_0x81d9[_0x3a805c];return _0x3c8364;};'use strict';var _=require(_0x981d('0x0'));var fs=require('fs');var util=require(_0x981d('0x1'));var path=require(_0x981d('0x2'));var moment=require(_0x981d('0x3'));var htmlToPdfmake=require(_0x981d('0x4'));var PdfPrinter=require(_0x981d('0x5'));var zipdir=require(_0x981d('0x6'));var rimraf=require(_0x981d('0x7'));var JSDOM=require(_0x981d('0x8'))[_0x981d('0x9')];var window=new JSDOM('')['window'];var BPromise=require(_0x981d('0xa'));var db=require(_0x981d('0xb'))['db'];var dbH=require(_0x981d('0xb'))[_0x981d('0xc')];var logger=require(_0x981d('0xd'))(_0x981d('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x981d('0xf')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x981d('0xf')][0x5];var FORMAT=_0x981d('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2bdad5,_0x2aa03d){var _0x2f3923={'status':_0x2bdad5};var _0x27089a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2aa03d){_0x2f3923[_0x981d('0x11')]=_0x2aa03d;}return db[_0x981d('0x12')][_0x981d('0x13')](_0x2f3923,_0x27089a);}function getHeaders(_0x360c76){return _[_0x981d('0x14')](_0x360c76,function(_0x177c6c){return{'text':_0x177c6c,'style':_0x981d('0x15')};});}function getRows(_0x2c8fff,_0x8b4810){return _[_0x981d('0x14')](_0x8b4810,function(_0x249829){return _(_0x249829)[_0x981d('0x16')](_0x2c8fff)[_0x981d('0x14')](function(_0xc7f2ac){return _0xc7f2ac?_[_0x981d('0x17')](_0xc7f2ac):'';})['value']();});}function createTable(_0x3e2b82,_0x368b70){var _0x11373e={'widths':_[_0x981d('0x18')](Array(_0x3e2b82[_0x981d('0x19')]),0x91),'heights':function(_0x5aa5dd){return _0x5aa5dd===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xdbc731=getHeaders(_0x3e2b82);_0x11373e[_0x981d('0x1a')][_0x981d('0x1b')](_0xdbc731);var _0x289317=getRows(_0x3e2b82,_0x368b70);_0x11373e[_0x981d('0x1a')]=_0x11373e[_0x981d('0x1a')][_0x981d('0x1c')](_0x289317);return _0x11373e;}function createTables(_0x1aa81c){var _0x222b3f=[];var _0x4bf99e=_['chunk'](Object[_0x981d('0x1d')](_0x1aa81c[0x0]),0x5);_0x4bf99e[_0x981d('0x1e')](function(_0x3d4c30){_0x222b3f[_0x981d('0x1b')](createTable(_0x3d4c30,_0x1aa81c));});return _0x222b3f;}function getPDFDocDefinition(_0x301859){var _0x92d09f=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x981d('0x1f')],moment(EXTRACTED_REPORT[_0x981d('0x20')])[_0x981d('0x21')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x846b85=[];for(var _0x155b91=0x0;_0x155b91<_0x301859[_0x981d('0x19')];_0x155b91++){var _0x5f0160=[];if(_0x155b91===0x0){_0x5f0160['push']({'text':_0x92d09f,'style':_0x981d('0x22')});}var _0x1c51b4={'table':_0x301859[_0x155b91]};if(_0x155b91>0x0){_0x1c51b4[_0x981d('0x23')]=_0x981d('0x24');_0x1c51b4['margin']=[0x0,0x46,0x0,0x0];}_0x5f0160['push'](_0x1c51b4);_0x846b85['push'](_0x5f0160);}return{'pageSize':'A4','pageOrientation':_0x981d('0x25'),'content':_0x846b85,'footer':function(_0xbee0e4,_0x380b36){return{'text':_0xbee0e4[_0x981d('0x17')]()+'\x20/\x20'+_0x380b36,'style':'footer'};},'defaultStyle':{'font':_0x981d('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x981d('0x27')},'footer':{'alignment':_0x981d('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x34e6c8){var _0x4690ae=0x1388;var _0x2cfb02;if(!_0x34e6c8[0x0]['num']){return analyticExtractedReport(_0x981d('0x29'));}return db[_0x981d('0x2a')][_0x981d('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x981d('0x2c')]})[_0x981d('0x2d')](function(_0x175c61){if(_0x175c61){_0x2cfb02=_0x175c61;_0x4690ae=_0x2cfb02['splitSizePdf']||0x3e8;}})[_0x981d('0x2d')](function(){var _0x251db7=[];var _0x36a853=0x0;if(_0x2cfb02[_0x981d('0x2e')]){if(_0x34e6c8&&_0x34e6c8[_0x981d('0x19')]){var _0x4e5db4=_[_0x981d('0x2f')](_0x34e6c8[0x0][_0x981d('0x30')]/_0x4690ae);var _0x18d89a=Number[_0x981d('0x31')](_0x34e6c8[0x0]['num']/_0x4690ae)?_0x34e6c8[0x0]['num']%_0x4690ae:0x0;_0x4e5db4[_0x981d('0x1e')](function(_0x1e0b8d){if(_0x1e0b8d>0x0){_0x36a853+=_0x4690ae;}_0x251db7[_0x981d('0x1b')](dbH[_0x981d('0x32')]['query'](util[_0x981d('0x21')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4690ae,_0x36a853),{'type':dbH['sequelize'][_0x981d('0x33')]['SELECT']}));});if(_0x18d89a>0x0){_0x36a853+=_0x4690ae;_0x251db7[_0x981d('0x1b')](dbH[_0x981d('0x32')][_0x981d('0x34')](util['format'](_0x981d('0x35'),QUERY,_0x18d89a,_0x36a853),{'type':dbH[_0x981d('0x32')]['QueryTypes'][_0x981d('0x36')]}));}}}else{_0x251db7[_0x981d('0x1b')](dbH['sequelize'][_0x981d('0x34')](QUERY,{'type':dbH['sequelize'][_0x981d('0x33')][_0x981d('0x36')]}));}var _0x17f852=path[_0x981d('0x37')](PATH);var _0x447a41=path[_0x981d('0x38')](PATH,'.pdf');var _0x17b937=_0x2cfb02['split']&&_0x251db7['length']>0x1;var _0x4b66cc=[];if(!fs['existsSync'](path[_0x981d('0x39')](_0x17f852,_0x447a41))&&_0x17b937){fs[_0x981d('0x3a')](path['join'](_0x17f852,_0x447a41));}return BPromise['each'](_0x251db7,function(_0xe57b61){_0x4b66cc[_0x981d('0x1b')](_0xe57b61);})['then'](function(){var _0x10e7b4=[];for(var _0x199caa=0x0;_0x199caa<_0x4b66cc[_0x981d('0x19')];_0x199caa+=0x1){var _0x474a99=_0x4b66cc[_0x199caa];var _0x2386f2=createTables(_[_0x981d('0x3b')](_0x474a99));var _0x16761a;var _0x2fcb72=getPDFDocDefinition(_0x2386f2);var _0x5c937f=getPDFPrinter();var _0x1d00ac=_0x5c937f['createPdfKitDocument'](_0x2fcb72);if(_0x17b937){_0x16761a=path['join'](_0x17f852,_0x447a41,util[_0x981d('0x21')](_0x981d('0x3c'),_0x447a41,_0x199caa,_0x981d('0x3d')));}else{_0x16761a=path['join'](_0x17f852,util[_0x981d('0x21')](_0x981d('0x3e'),_0x447a41,_0x981d('0x3d')));}_0x10e7b4['push'](writePDFDocument(_0x1d00ac,_0x16761a));}return Promise[_0x981d('0x3f')](_0x10e7b4);})[_0x981d('0x2d')](function(){if(_0x17b937){return new Promise(function(_0x23a883){zipdir(path[_0x981d('0x39')](_0x17f852,_0x447a41),{'saveTo':path['join'](_0x17f852,util['format'](_0x981d('0x3e'),_0x447a41,_0x981d('0x40')))},function(){rimraf(path[_0x981d('0x39')](_0x17f852,_0x447a41),function(){});_0x23a883('zip\x20finished');});});}})[_0x981d('0x2d')](function(){if(!_0x17b937)return;rimraf(path['join'](_0x17f852,_0x447a41),function(){});})[_0x981d('0x2d')](function(){logger[_0x981d('0x41')](util[_0x981d('0x21')](_0x981d('0x42'),EXTRACTED_REPORT_ID,_0x981d('0x43')));return analyticExtractedReport(_0x981d('0x44'),_0x17b937?util[_0x981d('0x21')](_0x981d('0x3e'),_0x447a41,_0x17b937?'zip':_0x981d('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x981d('0x21')](_0x981d('0x45'),EXTRACTED_REPORT_ID,_0x981d('0x43')));return db[_0x981d('0x12')][_0x981d('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x981d('0x2d')](function(_0x1c19a5){EXTRACTED_REPORT=_0x1c19a5;return dbH[_0x981d('0x32')][_0x981d('0x34')](util[_0x981d('0x21')](_0x981d('0x47'),QUERY),{'type':dbH[_0x981d('0x32')][_0x981d('0x33')]['SELECT']});})['then'](extractReport)['catch'](function(_0x22f9a0){logger[_0x981d('0x41')](util[_0x981d('0x21')](_0x981d('0x48'),EXTRACTED_REPORT_ID,_0x981d('0x43')),util[_0x981d('0x49')](_0x22f9a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x981d('0x4a')](function(){process[_0x981d('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x327636=new PdfPrinter({'Arial':{'normal':__dirname+_0x981d('0x4c'),'bold':__dirname+_0x981d('0x4d'),'italics':__dirname+_0x981d('0x4e'),'bolditalics':__dirname+_0x981d('0x4f')}});return _0x327636;}function getPDFDocDefinitionFromHTML(_0x309211,_0x144dd8){var _0x1af8cc=util[_0x981d('0x21')]('%s\x20#%d',_0x144dd8['channel'],_0x144dd8[_0x981d('0x50')]);var _0x3ac692=moment()[_0x981d('0x21')](_0x981d('0x51'))[_0x981d('0x17')]();var _0x25e231=htmlToPdfmake(_0x309211,{'window':window,'tableAutoSize':!![]});return{'content':[_0x25e231],'defaultStyle':{'font':_0x981d('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x981d('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x981d('0x52')}},'header':function(){return[{'text':_0x981d('0x53'),'style':_0x981d('0x22')}];},'footer':function(_0x26eef1,_0x98c894){return[{'text':util[_0x981d('0x21')](_0x981d('0x54'),_0x1af8cc,_0x26eef1,_0x98c894,_0x3ac692),'style':'footer'}];}};}function writePDFDocument(_0x52927d,_0x4037d8){return new Promise(function(_0x285062,_0x88513f){var _0xf13bc8=_0x52927d[_0x981d('0x55')](fs[_0x981d('0x56')](_0x4037d8));_0xf13bc8['on']('finish',function(){_0x285062(_0x981d('0x57'));});_0xf13bc8['on'](_0x981d('0x58'),function(_0x222058){_0x88513f(_0x222058);});_0x52927d['end']();});}exports[_0x981d('0x59')]=function(_0x16b481,_0x3937ac){var _0x1440ea=getPDFPrinter();var _0x286f6b=getPDFDocDefinitionFromHTML(_0x16b481,_0x3937ac);var _0x51d032=_0x1440ea[_0x981d('0x5a')](_0x286f6b);return writePDFDocument(_0x51d032,_0x3937ac['path'])[_0x981d('0x5b')](function(_0x302a9d){throw _0x302a9d;});}; \ No newline at end of file +var _0x483d=['footer','Arial','black','right','num','Empty','Setting','find','split','then','splitSizePdf','range','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','join','each','flatten','createPdfKitDocument','pdf','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','interactionId','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','lodash','path','pdfmake/src/printer','jsdom','JSDOM','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','length','push','body','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header','pageBreak','margin','landscape','\x20/\x20'];(function(_0x2a49d6,_0xbdca4d){var _0x45760b=function(_0x442f1d){while(--_0x442f1d){_0x2a49d6['push'](_0x2a49d6['shift']());}};_0x45760b(++_0xbdca4d);}(_0x483d,0x1ba));var _0xd483=function(_0x45e684,_0x33a27d){_0x45e684=_0x45e684-0x0;var _0x31a0f2=_0x483d[_0x45e684];return _0x31a0f2;};'use strict';var _=require(_0xd483('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xd483('0x1'));var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xd483('0x2'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0xd483('0x3'))[_0xd483('0x4')];var window=new JSDOM('')[_0xd483('0x5')];var BPromise=require('bluebird');var db=require(_0xd483('0x6'))['db'];var dbH=require(_0xd483('0x6'))[_0xd483('0x7')];var logger=require('../../config/logger')(_0xd483('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xd483('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xd483('0x9')][0x5];var FORMAT=_0xd483('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d2e88,_0x2b37bb){var _0x461752={'status':_0x4d2e88};var _0x144819={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b37bb){_0x461752[_0xd483('0xb')]=_0x2b37bb;}return db[_0xd483('0xc')][_0xd483('0xd')](_0x461752,_0x144819);}function getHeaders(_0xbefb7b){return _[_0xd483('0xe')](_0xbefb7b,function(_0x1cb371){return{'text':_0x1cb371,'style':_0xd483('0xf')};});}function getRows(_0x21836c,_0x1704ef){return _[_0xd483('0xe')](_0x1704ef,function(_0x2ca692){return _(_0x2ca692)['pick'](_0x21836c)[_0xd483('0xe')](function(_0x49451b){return _0x49451b?_[_0xd483('0x10')](_0x49451b):'';})[_0xd483('0x11')]();});}function createTable(_0x216b2b,_0x58fb99){var _0xeaeed2={'widths':_['fill'](Array(_0x216b2b[_0xd483('0x12')]),0x91),'heights':function(_0x3c90f0){return _0x3c90f0===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4d8b0b=getHeaders(_0x216b2b);_0xeaeed2['body'][_0xd483('0x13')](_0x4d8b0b);var _0x3beed1=getRows(_0x216b2b,_0x58fb99);_0xeaeed2[_0xd483('0x14')]=_0xeaeed2[_0xd483('0x14')][_0xd483('0x15')](_0x3beed1);return _0xeaeed2;}function createTables(_0x50f8db){var _0x15a632=[];var _0x2b9caa=_['chunk'](Object[_0xd483('0x16')](_0x50f8db[0x0]),0x5);_0x2b9caa[_0xd483('0x17')](function(_0x50323a){_0x15a632[_0xd483('0x13')](createTable(_0x50323a,_0x50f8db));});return _0x15a632;}function getPDFDocDefinition(_0x55a3c3){var _0x2344be=util[_0xd483('0x18')](_0xd483('0x19'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xd483('0x1a')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xd483('0x18')](FORMAT));var _0x42b5d6=[];for(var _0x1a5d46=0x0;_0x1a5d46<_0x55a3c3[_0xd483('0x12')];_0x1a5d46++){var _0x1cdcee=[];if(_0x1a5d46===0x0){_0x1cdcee[_0xd483('0x13')]({'text':_0x2344be,'style':_0xd483('0x1b')});}var _0x30f52f={'table':_0x55a3c3[_0x1a5d46]};if(_0x1a5d46>0x0){_0x30f52f[_0xd483('0x1c')]='before';_0x30f52f[_0xd483('0x1d')]=[0x0,0x46,0x0,0x0];}_0x1cdcee['push'](_0x30f52f);_0x42b5d6[_0xd483('0x13')](_0x1cdcee);}return{'pageSize':'A4','pageOrientation':_0xd483('0x1e'),'content':_0x42b5d6,'footer':function(_0x4441cf,_0xf2cd48){return{'text':_0x4441cf[_0xd483('0x10')]()+_0xd483('0x1f')+_0xf2cd48,'style':_0xd483('0x20')};},'defaultStyle':{'font':_0xd483('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd483('0x22')},'footer':{'alignment':_0xd483('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2e8d64){var _0x58dfa8=0x1388;var _0x4da321;if(!_0x2e8d64[0x0][_0xd483('0x24')]){return analyticExtractedReport(_0xd483('0x25'));}return db[_0xd483('0x26')][_0xd483('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd483('0x28'),'splitSizePdf']})[_0xd483('0x29')](function(_0x1b9b5f){if(_0x1b9b5f){_0x4da321=_0x1b9b5f;_0x58dfa8=_0x4da321[_0xd483('0x2a')]||0x3e8;}})['then'](function(){var _0xe5e987=[];var _0x296ecd=0x0;if(_0x4da321[_0xd483('0x28')]){if(_0x2e8d64&&_0x2e8d64['length']){var _0x3d2144=_[_0xd483('0x2b')](_0x2e8d64[0x0][_0xd483('0x24')]/_0x58dfa8);var _0x4960b3=Number['isInteger'](_0x2e8d64[0x0][_0xd483('0x24')]/_0x58dfa8)?_0x2e8d64[0x0][_0xd483('0x24')]%_0x58dfa8:0x0;_0x3d2144['forEach'](function(_0x474f85){if(_0x474f85>0x0){_0x296ecd+=_0x58dfa8;}_0xe5e987[_0xd483('0x13')](dbH[_0xd483('0x2c')]['query'](util[_0xd483('0x18')](_0xd483('0x2d'),QUERY,_0x58dfa8,_0x296ecd),{'type':dbH[_0xd483('0x2c')][_0xd483('0x2e')][_0xd483('0x2f')]}));});if(_0x4960b3>0x0){_0x296ecd+=_0x58dfa8;_0xe5e987[_0xd483('0x13')](dbH[_0xd483('0x2c')][_0xd483('0x30')](util[_0xd483('0x18')](_0xd483('0x2d'),QUERY,_0x4960b3,_0x296ecd),{'type':dbH[_0xd483('0x2c')][_0xd483('0x2e')][_0xd483('0x2f')]}));}}}else{_0xe5e987['push'](dbH['sequelize'][_0xd483('0x30')](QUERY,{'type':dbH[_0xd483('0x2c')][_0xd483('0x2e')]['SELECT']}));}var _0x80eb3a=path[_0xd483('0x31')](PATH);var _0x3acd0f=path['basename'](PATH,'.pdf');var _0x4e3d2d=_0x4da321[_0xd483('0x28')]&&_0xe5e987[_0xd483('0x12')]>0x1;var _0x1baba4=[];if(!fs['existsSync'](path[_0xd483('0x32')](_0x80eb3a,_0x3acd0f))&&_0x4e3d2d){fs['mkdirSync'](path[_0xd483('0x32')](_0x80eb3a,_0x3acd0f));}return BPromise[_0xd483('0x33')](_0xe5e987,function(_0x1c52df){_0x1baba4[_0xd483('0x13')](_0x1c52df);})[_0xd483('0x29')](function(){var _0x5c25ea=[];for(var _0x3c17b9=0x0;_0x3c17b9<_0x1baba4[_0xd483('0x12')];_0x3c17b9+=0x1){var _0x10d413=_0x1baba4[_0x3c17b9];var _0xead1bc=createTables(_[_0xd483('0x34')](_0x10d413));var _0x33a25a;var _0x3367f6=getPDFDocDefinition(_0xead1bc);var _0x417bb7=getPDFPrinter();var _0x589cdf=_0x417bb7[_0xd483('0x35')](_0x3367f6);if(_0x4e3d2d){_0x33a25a=path[_0xd483('0x32')](_0x80eb3a,_0x3acd0f,util['format']('%s%d.%s',_0x3acd0f,_0x3c17b9,_0xd483('0x36')));}else{_0x33a25a=path[_0xd483('0x32')](_0x80eb3a,util[_0xd483('0x18')](_0xd483('0x37'),_0x3acd0f,'pdf'));}_0x5c25ea['push'](writePDFDocument(_0x589cdf,_0x33a25a));}return Promise['all'](_0x5c25ea);})[_0xd483('0x29')](function(){if(_0x4e3d2d){return new Promise(function(_0x233b36){zipdir(path['join'](_0x80eb3a,_0x3acd0f),{'saveTo':path['join'](_0x80eb3a,util[_0xd483('0x18')]('%s.%s',_0x3acd0f,'zip'))},function(){rimraf(path[_0xd483('0x32')](_0x80eb3a,_0x3acd0f),function(){});_0x233b36('zip\x20finished');});});}})['then'](function(){if(!_0x4e3d2d)return;rimraf(path[_0xd483('0x32')](_0x80eb3a,_0x3acd0f),function(){});})[_0xd483('0x29')](function(){logger[_0xd483('0x38')](util[_0xd483('0x18')](_0xd483('0x39'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xd483('0x3a'),_0x4e3d2d?util['format'](_0xd483('0x37'),_0x3acd0f,_0x4e3d2d?_0xd483('0x3b'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd483('0x38')](util[_0xd483('0x18')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd483('0x3c')));return db[_0xd483('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd483('0x29')](function(_0x106e8a){EXTRACTED_REPORT=_0x106e8a;return dbH[_0xd483('0x2c')][_0xd483('0x30')](util[_0xd483('0x18')](_0xd483('0x3d'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})['then'](extractReport)[_0xd483('0x3e')](function(_0x4c118d){logger[_0xd483('0x38')](util[_0xd483('0x18')](_0xd483('0x3f'),EXTRACTED_REPORT_ID,_0xd483('0x3c')),util[_0xd483('0x40')](_0x4c118d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd483('0x41'));})['finally'](function(){process[_0xd483('0x42')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4dc645=new PdfPrinter({'Arial':{'normal':__dirname+_0xd483('0x43'),'bold':__dirname+_0xd483('0x44'),'italics':__dirname+_0xd483('0x45'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x4dc645;}function getPDFDocDefinitionFromHTML(_0x415012,_0x53a913){var _0x3cc990=util[_0xd483('0x18')](_0xd483('0x46'),_0x53a913['channel'],_0x53a913[_0xd483('0x47')]);var _0x50f7ec=moment()['format']('YYYY-MM-DD')['toString']();var _0x30d792=htmlToPdfmake(_0x415012,{'window':window,'tableAutoSize':!![]});return{'content':[_0x30d792],'defaultStyle':{'font':_0xd483('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd483('0x48'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd483('0x48'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xd483('0x49'),'style':'header'}];},'footer':function(_0x2002a7,_0xdd4b9e){return[{'text':util[_0xd483('0x18')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x3cc990,_0x2002a7,_0xdd4b9e,_0x50f7ec),'style':_0xd483('0x20')}];}};}function writePDFDocument(_0x506fda,_0x5113d6){return new Promise(function(_0x494039,_0x4661e0){var _0x4af05f=_0x506fda[_0xd483('0x4a')](fs[_0xd483('0x4b')](_0x5113d6));_0x4af05f['on']('finish',function(){_0x494039(_0xd483('0x4c'));});_0x4af05f['on'](_0xd483('0x4d'),function(_0x29f493){_0x4661e0(_0x29f493);});_0x506fda[_0xd483('0x4e')]();});}exports['createPdfFromHTML']=function(_0x6a6f85,_0x2f78f9){var _0xf0b381=getPDFPrinter();var _0x571bd4=getPDFDocDefinitionFromHTML(_0x6a6f85,_0x2f78f9);var _0x5d2c68=_0xf0b381['createPdfKitDocument'](_0x571bd4);return writePDFDocument(_0x5d2c68,_0x2f78f9[_0xd483('0x1')])['catch'](function(_0x30bcaf){throw _0x30bcaf;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index f141eca..cd2c6e2 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 _0x2431=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','xlsx','%s.%s','writeFileSync','binary','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x2431,0xbe));var _0x1243=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2431[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x1243('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x1243('0x1'));var zipdir=require(_0x1243('0x2'));var rimraf=require('rimraf');var db=require(_0x1243('0x3'))['db'];var dbH=require(_0x1243('0x3'))[_0x1243('0x4')];var logger=require(_0x1243('0x5'))(_0x1243('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x1243('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1243('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2abea9,_0x3553ff){var _0x1822b3={'status':_0x2abea9};var _0x5571aa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3553ff){_0x1822b3['savename']=_0x3553ff;}return db[_0x1243('0x8')]['update'](_0x1822b3,_0x5571aa);}function main(){var _0x4095f6=0x1388;var _0x22ec7a;logger['info'](util[_0x1243('0x9')](_0x1243('0xa'),EXTRACTED_REPORT_ID,_0x1243('0xb')));return db[_0x1243('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1243('0xd'),_0x1243('0xe')]})['then'](function(_0x5c6da2){if(_0x5c6da2){_0x22ec7a=_0x5c6da2;_0x4095f6=_0x22ec7a[_0x1243('0xe')]||0x1388;}})[_0x1243('0xf')](function(){return dbH[_0x1243('0x10')][_0x1243('0x11')](util[_0x1243('0x9')](_0x1243('0x12'),QUERY),{'type':dbH[_0x1243('0x10')][_0x1243('0x13')][_0x1243('0x14')]});})[_0x1243('0xf')](function(_0x40eaa2){if(!_0x40eaa2[0x0][_0x1243('0x15')]){return analyticExtractedReport(_0x1243('0x16'));}var _0x6434d8=[];var _0x3ba151=0x0;if(_0x22ec7a['split']){if(_0x40eaa2&&_0x40eaa2[_0x1243('0x17')]){var _0x433ef9=_[_0x1243('0x18')](_0x40eaa2[0x0][_0x1243('0x15')]/_0x4095f6);var _0x656810=Number[_0x1243('0x19')](_0x40eaa2[0x0][_0x1243('0x15')]/_0x4095f6)?_0x40eaa2[0x0][_0x1243('0x15')]%_0x4095f6:0x0;_0x433ef9['forEach'](function(_0x1c01e7){if(_0x1c01e7>0x0){_0x3ba151+=_0x4095f6;}_0x6434d8[_0x1243('0x1a')](dbH[_0x1243('0x10')][_0x1243('0x11')](util[_0x1243('0x9')](_0x1243('0x1b'),QUERY,_0x4095f6,_0x3ba151),{'type':dbH[_0x1243('0x10')]['QueryTypes'][_0x1243('0x14')]}));});if(_0x656810>0x0){_0x3ba151+=_0x4095f6;_0x6434d8[_0x1243('0x1a')](dbH[_0x1243('0x10')][_0x1243('0x11')](util['format'](_0x1243('0x1b'),QUERY,_0x656810,_0x3ba151),{'type':dbH[_0x1243('0x10')][_0x1243('0x13')]['SELECT']}));}}}else{_0x6434d8[_0x1243('0x1a')](dbH[_0x1243('0x10')][_0x1243('0x11')](QUERY,{'type':dbH[_0x1243('0x10')][_0x1243('0x13')][_0x1243('0x14')]}));}var _0x591554=path['dirname'](PATH);var _0x19a7be=path[_0x1243('0x1c')](PATH,_0x1243('0x1d'));var _0x2f88ac=_0x22ec7a[_0x1243('0xd')]&&_0x6434d8[_0x1243('0x17')]>0x1;var _0x4a78d2=[];if(!fs[_0x1243('0x1e')](path[_0x1243('0x1f')](_0x591554,_0x19a7be))&&_0x2f88ac){fs[_0x1243('0x20')](path[_0x1243('0x1f')](_0x591554,_0x19a7be));}return BPromise['each'](_0x6434d8,function(_0x277dba){_0x4a78d2[_0x1243('0x1a')](_0x277dba);})[_0x1243('0xf')](function(){for(var _0x39788a=0x0;_0x39788a<_0x4a78d2[_0x1243('0x17')];_0x39788a+=0x1){var _0xd85e86;var _0x15319c=_0x4a78d2[_0x39788a];if(_0x2f88ac){_0xd85e86=path['join'](_0x591554,_0x19a7be,util[_0x1243('0x9')]('%s%d.%s',_0x19a7be,_0x39788a,_0x1243('0x21')));}else{_0xd85e86=path[_0x1243('0x1f')](_0x591554,util[_0x1243('0x9')](_0x1243('0x22'),_0x19a7be,_0x1243('0x21')));}fs[_0x1243('0x23')](_0xd85e86,json2xls(_0x15319c),_0x1243('0x24'));}})[_0x1243('0xf')](function(){if(_0x2f88ac){return new Promise(function(_0x1d0d20){zipdir(path[_0x1243('0x1f')](_0x591554,_0x19a7be),{'saveTo':path[_0x1243('0x1f')](_0x591554,util[_0x1243('0x9')](_0x1243('0x22'),_0x19a7be,_0x1243('0x25')))},function(_0x2ec643,_0x9e9698){rimraf(path['join'](_0x591554,_0x19a7be),function(){});_0x1d0d20('zip\x20finished');});});}})['then'](function(){logger[_0x1243('0x26')](util['format'](_0x1243('0x27'),EXTRACTED_REPORT_ID,_0x1243('0xb')));return analyticExtractedReport(_0x1243('0x28'),_0x2f88ac?util[_0x1243('0x9')](_0x1243('0x22'),_0x19a7be,_0x2f88ac?_0x1243('0x25'):'xlsx'):null);});})[_0x1243('0x29')](function(_0x466483){logger[_0x1243('0x26')](util['format'](_0x1243('0x2a'),EXTRACTED_REPORT_ID,_0x1243('0xb')),util[_0x1243('0x2b')](_0x466483,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1243('0x2c'));})['finally'](function(){process[_0x1243('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xde1e=['lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','range','isInteger','forEach','push','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path'];(function(_0x5cd253,_0x4162da){var _0x36e179=function(_0x597977){while(--_0x597977){_0x5cd253['push'](_0x5cd253['shift']());}};_0x36e179(++_0x4162da);}(_0xde1e,0x9d));var _0xede1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde1e[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xede1('0x0'));var path=require(_0xede1('0x1'));var _=require(_0xede1('0x2'));var fs=require('fs');var json2xls=require(_0xede1('0x3'));var BPromise=require(_0xede1('0x4'));var zipdir=require(_0xede1('0x5'));var rimraf=require('rimraf');var db=require(_0xede1('0x6'))['db'];var dbH=require(_0xede1('0x6'))[_0xede1('0x7')];var logger=require(_0xede1('0x8'))(_0xede1('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xede1('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xede1('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xeeec58,_0x1722c9){var _0x452e74={'status':_0xeeec58};var _0x29fe67={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1722c9){_0x452e74[_0xede1('0xb')]=_0x1722c9;}return db['AnalyticExtractedReport'][_0xede1('0xc')](_0x452e74,_0x29fe67);}function main(){var _0x4bc1f1=0x1388;var _0x5828f7;logger[_0xede1('0xd')](util[_0xede1('0xe')](_0xede1('0xf'),EXTRACTED_REPORT_ID,_0xede1('0x10')));return db[_0xede1('0x11')][_0xede1('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xede1('0x13')]})[_0xede1('0x14')](function(_0x21fe95){if(_0x21fe95){_0x5828f7=_0x21fe95;_0x4bc1f1=_0x5828f7['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0xede1('0x15')][_0xede1('0x16')](util[_0xede1('0xe')](_0xede1('0x17'),QUERY),{'type':dbH[_0xede1('0x15')]['QueryTypes'][_0xede1('0x18')]});})[_0xede1('0x14')](function(_0x176828){if(!_0x176828[0x0][_0xede1('0x19')]){return analyticExtractedReport(_0xede1('0x1a'));}var _0x1600ec=[];var _0x225d07=0x0;if(_0x5828f7[_0xede1('0x1b')]){if(_0x176828&&_0x176828['length']){var _0x32048a=_[_0xede1('0x1c')](_0x176828[0x0][_0xede1('0x19')]/_0x4bc1f1);var _0x24f860=Number[_0xede1('0x1d')](_0x176828[0x0][_0xede1('0x19')]/_0x4bc1f1)?_0x176828[0x0][_0xede1('0x19')]%_0x4bc1f1:0x0;_0x32048a[_0xede1('0x1e')](function(_0x131540){if(_0x131540>0x0){_0x225d07+=_0x4bc1f1;}_0x1600ec[_0xede1('0x1f')](dbH[_0xede1('0x15')]['query'](util[_0xede1('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4bc1f1,_0x225d07),{'type':dbH['sequelize'][_0xede1('0x20')][_0xede1('0x18')]}));});if(_0x24f860>0x0){_0x225d07+=_0x4bc1f1;_0x1600ec[_0xede1('0x1f')](dbH[_0xede1('0x15')][_0xede1('0x16')](util[_0xede1('0xe')](_0xede1('0x21'),QUERY,_0x24f860,_0x225d07),{'type':dbH[_0xede1('0x15')]['QueryTypes'][_0xede1('0x18')]}));}}}else{_0x1600ec[_0xede1('0x1f')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xede1('0x15')][_0xede1('0x20')]['SELECT']}));}var _0x50bc2f=path['dirname'](PATH);var _0x12149f=path[_0xede1('0x22')](PATH,_0xede1('0x23'));var _0x1a5569=_0x5828f7[_0xede1('0x1b')]&&_0x1600ec[_0xede1('0x24')]>0x1;var _0x2a8ebb=[];if(!fs[_0xede1('0x25')](path[_0xede1('0x26')](_0x50bc2f,_0x12149f))&&_0x1a5569){fs[_0xede1('0x27')](path[_0xede1('0x26')](_0x50bc2f,_0x12149f));}return BPromise[_0xede1('0x28')](_0x1600ec,function(_0x4bd927){_0x2a8ebb[_0xede1('0x1f')](_0x4bd927);})[_0xede1('0x14')](function(){for(var _0x4ef352=0x0;_0x4ef352<_0x2a8ebb[_0xede1('0x24')];_0x4ef352+=0x1){var _0x20e647;var _0xbf0a98=_0x2a8ebb[_0x4ef352];if(_0x1a5569){_0x20e647=path[_0xede1('0x26')](_0x50bc2f,_0x12149f,util[_0xede1('0xe')](_0xede1('0x29'),_0x12149f,_0x4ef352,_0xede1('0x2a')));}else{_0x20e647=path[_0xede1('0x26')](_0x50bc2f,util[_0xede1('0xe')]('%s.%s',_0x12149f,'xlsx'));}fs[_0xede1('0x2b')](_0x20e647,json2xls(_0xbf0a98),'binary');}})[_0xede1('0x14')](function(){if(_0x1a5569){return new Promise(function(_0x27ab56){zipdir(path[_0xede1('0x26')](_0x50bc2f,_0x12149f),{'saveTo':path[_0xede1('0x26')](_0x50bc2f,util[_0xede1('0xe')](_0xede1('0x2c'),_0x12149f,_0xede1('0x2d')))},function(_0x37237a,_0x3596a1){rimraf(path['join'](_0x50bc2f,_0x12149f),function(){});_0x27ab56(_0xede1('0x2e'));});});}})['then'](function(){logger[_0xede1('0xd')](util['format'](_0xede1('0x2f'),EXTRACTED_REPORT_ID,_0xede1('0x10')));return analyticExtractedReport(_0xede1('0x30'),_0x1a5569?util[_0xede1('0xe')](_0xede1('0x2c'),_0x12149f,_0x1a5569?'zip':_0xede1('0x2a')):null);});})['catch'](function(_0x14967c){logger[_0xede1('0xd')](util[_0xede1('0xe')](_0xede1('0x31'),EXTRACTED_REPORT_ID,_0xede1('0x10')),util['inspect'](_0x14967c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xede1('0x32'));})[_0xede1('0x33')](function(){process[_0xede1('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 5f2d6e3..ee39009 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 _0x13c4=['util','then','intervals','models','findAll','IntervalId','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','hasOwnProperty','extensions','extension','find','push','Set','CDR(type)=%s','type','inbound','CDR(routeid)=','VoiceExtensionId','context','priority','outbound','CDR(destination)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch'];(function(_0x404c9f,_0x531085){var _0x30f52f=function(_0x158edc){while(--_0x158edc){_0x404c9f['push'](_0x404c9f['shift']());}};_0x30f52f(++_0x531085);}(_0x13c4,0x1dc));var _0x413c=function(_0xa7f75c,_0x3a0077){_0xa7f75c=_0xa7f75c-0x0;var _0x44a7b9=_0x13c4[_0xa7f75c];return _0x44a7b9;};'use strict';var _=require('lodash');var util=require(_0x413c('0x0'));function rewrite(_0x2446a1,_0x37a26e){var _0x57f553=this;return _0x2446a1['models']['Interval']['findAll']({'raw':!![]})[_0x413c('0x1')](function(_0x430a14){_0x57f553[_0x413c('0x2')]=_0x430a14;return _0x2446a1[_0x413c('0x3')]['VoiceExtension'][_0x413c('0x4')]({'where':{'IntervalId':_0x37a26e[_0x413c('0x5')]},'raw':!![]});})['then'](function(_0x199734){return _0x2446a1[_0x413c('0x3')][_0x413c('0x6')][_0x413c('0x4')]({'where':{'exten':{'$in':_[_0x413c('0x7')](_[_0x413c('0x8')](_0x199734,'exten'))}},'order':[{'raw':_0x413c('0x9')}],'raw':!![]});})[_0x413c('0x1')](function(_0xb6f8b3){var _0x2c9515=_[_0x413c('0xa')](_0xb6f8b3,{'priority':'1'});var _0x575a39=_['filter'](_0xb6f8b3,{'isApp':0x1});var _0x3a37f4=_[_0x413c('0xb')](_0x575a39,_0x413c('0xc'));var _0x3231d0=[_0x413c('0xd'),'playback'];var _0x48b396=[];var _0x5d41bc=[];for(var _0x543e97 in _0x3a37f4){if(_0x3a37f4[_0x413c('0xe')](_0x543e97)){_0x57f553['priority']=0x2;_0x57f553[_0x413c('0xf')]=[];_0x57f553[_0x413c('0x10')]=_[_0x413c('0x11')](_0x2c9515,{'exten':_0x3a37f4[_0x543e97][0x0]['exten']});_0x57f553[_0x413c('0xf')][_0x413c('0x12')]({'type':_0x3a37f4[_0x543e97][0x0]['type'],'app':_0x413c('0x13'),'appdata':util['format'](_0x413c('0x14'),_0x3a37f4[_0x543e97][0x0][_0x413c('0x15')]),'context':_0x3a37f4[_0x543e97][0x0]['context'],'exten':_0x3a37f4[_0x543e97][0x0][_0x413c('0xc')],'priority':_0x57f553['priority']++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0]['VoiceExtensionId']});if(_0x3a37f4[_0x543e97][0x0][_0x413c('0x15')]===_0x413c('0x16')){_0x57f553[_0x413c('0xf')][_0x413c('0x12')]({'type':_0x3a37f4[_0x543e97][0x0]['type'],'app':'Set','appdata':_0x413c('0x17')+_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')],'context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'exten':_0x3a37f4[_0x543e97][0x0][_0x413c('0xc')],'priority':_0x57f553[_0x413c('0x1a')]++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0]['VoiceExtensionId']});}else if(_0x3a37f4[_0x543e97][0x0][_0x413c('0x15')]===_0x413c('0x1b')){if(_0x57f553[_0x413c('0x10')]){_0x57f553[_0x413c('0xf')]['push']({'type':_0x3a37f4[_0x543e97][0x0]['type'],'app':'Set','appdata':_0x413c('0x1c')+(_0x57f553['extension']['cutdigits']?'${EXTEN:'+_0x57f553['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'exten':_0x3a37f4[_0x543e97][0x0][_0x413c('0xc')],'priority':_0x57f553[_0x413c('0x1a')]++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')]});}_0x57f553['extensions'][_0x413c('0x12')]({'type':_0x3a37f4[_0x543e97][0x0]['type'],'app':_0x413c('0x13'),'appdata':_0x413c('0x17')+_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')],'context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'exten':_0x3a37f4[_0x543e97][0x0][_0x413c('0xc')],'priority':_0x57f553[_0x413c('0x1a')]++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')]});var _0x2f07c3=_0x57f553[_0x413c('0x1a')]++;_0x57f553[_0x413c('0xf')]['push']({'type':_0x3a37f4[_0x543e97][0x0][_0x413c('0x15')],'app':_0x413c('0x1d'),'appdata':_0x413c('0x1e')+(_0x2f07c3+0x2)+'):Goto('+(_0x2f07c3+0x1)+')','context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'exten':_0x3a37f4[_0x543e97][0x0]['exten'],'priority':_0x2f07c3,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')]});if(_0x57f553[_0x413c('0x10')]){_0x57f553['extensions']['push']({'type':_0x3a37f4[_0x543e97][0x0][_0x413c('0x15')],'app':_0x413c('0x13'),'appdata':_0x57f553[_0x413c('0x10')][_0x413c('0x1f')]?_0x413c('0x20')+_0x57f553[_0x413c('0x10')]['cutdigits']+'}':_0x413c('0x21'),'context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'exten':_0x3a37f4[_0x543e97][0x0][_0x413c('0xc')],'priority':_0x57f553[_0x413c('0x1a')]++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0]['VoiceExtensionId']});}_0x57f553[_0x413c('0xf')][_0x413c('0x12')]({'type':_0x3a37f4[_0x543e97][0x0][_0x413c('0x15')],'app':_0x413c('0x13'),'appdata':_0x413c('0x22')+_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')],'context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'exten':_0x3a37f4[_0x543e97][0x0]['exten'],'priority':_0x57f553[_0x413c('0x1a')]++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')]});if(_0x57f553[_0x413c('0x10')]&&_0x57f553[_0x413c('0x10')][_0x413c('0xe')]('recordingFormat')&&_0x57f553[_0x413c('0x10')][_0x413c('0x23')]!==_0x413c('0x24')){_0x57f553['extensions'][_0x413c('0x12')]({'type':_0x3a37f4[_0x543e97][0x0][_0x413c('0x15')],'app':_0x413c('0x13'),'appdata':_0x413c('0x25'),'context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'exten':_0x3a37f4[_0x543e97][0x0][_0x413c('0xc')],'priority':_0x57f553[_0x413c('0x1a')]++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')]});_0x57f553[_0x413c('0xf')]['push']({'type':_0x3a37f4[_0x543e97][0x0]['type'],'app':_0x413c('0x13'),'appdata':_0x413c('0x26')+_0x57f553[_0x413c('0x10')]['recordingFormat']||'wav','context':_0x3a37f4[_0x543e97][0x0]['context'],'exten':_0x3a37f4[_0x543e97][0x0][_0x413c('0xc')],'priority':_0x57f553[_0x413c('0x1a')]++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0]['VoiceExtensionId']});}}_0x57f553[_0x413c('0xf')]['push']({'type':_0x3a37f4[_0x543e97][0x0][_0x413c('0x15')],'app':_0x413c('0x13'),'appdata':_0x413c('0x27'),'context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'exten':_0x3a37f4[_0x543e97][0x0][_0x413c('0xc')],'priority':_0x57f553[_0x413c('0x1a')]++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0]['VoiceExtensionId']});_0x57f553[_0x413c('0xf')][_0x413c('0x12')]({'type':_0x3a37f4[_0x543e97][0x0]['type'],'app':_0x413c('0x13'),'appdata':_0x413c('0x28'),'context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'exten':_0x3a37f4[_0x543e97][0x0]['exten'],'priority':_0x57f553[_0x413c('0x1a')]++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')]});_0x57f553[_0x413c('0xf')]['push']({'type':_0x3a37f4[_0x543e97][0x0]['type'],'app':_0x413c('0x13'),'appdata':_0x413c('0x29'),'context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'exten':_0x3a37f4[_0x543e97][0x0][_0x413c('0xc')],'priority':_0x57f553[_0x413c('0x1a')]++,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0]['VoiceExtensionId']});for(var _0x3d5515=0x0,_0x4ca028=0x0;_0x3d5515<_0x3a37f4[_0x543e97][_0x413c('0x2a')];_0x3d5515+=0x1,_0x4ca028=0x0){var _0x4f3919=_0x3a37f4[_0x543e97][_0x3d5515];if(_0x4f3919['type']){_0x4f3919['type']=_0x4f3919[_0x413c('0x15')][_0x413c('0x2b')]();}var _0x10668b=[];var _0x4ec764=[];delete _0x4f3919['id'];delete _0x4f3919[_0x413c('0x2c')];delete _0x4f3919[_0x413c('0x2d')];var _0x313230=_0x4f3919[_0x413c('0x2e')]!=='*,*,*,*'?[_0x4f3919[_0x413c('0x2e')]]:_0x4f3919[_0x413c('0x5')]?_[_0x413c('0x8')](_[_0x413c('0xa')](_0x57f553['intervals'],{'IntervalId':_0x4f3919[_0x413c('0x5')]}),_0x413c('0x2e')):[];if(_0x4f3919[_0x413c('0xe')](_0x413c('0x2f'))){if(_0x4f3919[_0x413c('0x2f')]&&_0x4f3919[_0x413c('0x2f')]!=='--'){_0x10668b[_0x413c('0x12')]({'type':_0x4f3919[_0x413c('0x15')],'app':'Set','appdata':_0x413c('0x30')+_0x4f3919[_0x413c('0x2f')],'context':_0x4f3919[_0x413c('0x19')],'exten':_0x4f3919['exten'],'priority':_0x313230[_0x413c('0x2a')]+_0x57f553['priority']+_0x4ca028++,'VoiceExtensionId':_0x4f3919[_0x413c('0x18')]});}}if(_0x4f3919[_0x413c('0x15')]==='outbound'&&_0x4f3919[_0x413c('0xe')](_0x413c('0x31'))){if(_0x4f3919['callerID']){_0x10668b['push']({'type':_0x4f3919[_0x413c('0x15')],'app':_0x413c('0x1d'),'appdata':_0x413c('0x32')+_0x4f3919['callerID']+')','context':_0x4f3919[_0x413c('0x19')],'exten':_0x4f3919[_0x413c('0xc')],'priority':_0x313230[_0x413c('0x2a')]+_0x57f553[_0x413c('0x1a')]+_0x4ca028++,'VoiceExtensionId':_0x4f3919['VoiceExtensionId']});}else{_0x10668b[_0x413c('0x12')]({'type':_0x4f3919[_0x413c('0x15')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x4f3919[_0x413c('0x19')],'exten':_0x4f3919['exten'],'priority':_0x313230['length']+_0x57f553['priority']+_0x4ca028++,'VoiceExtensionId':_0x4f3919[_0x413c('0x18')]});}}if(_0x4f3919[_0x413c('0xe')](_0x413c('0x33'))){if(_0x3231d0['indexOf'](_0x4f3919[_0x413c('0x34')][_0x413c('0x2b')]())>=0x0&&_0x4f3919[_0x413c('0x35')]!==_0x413c('0x36')){if(_0x4f3919[_0x413c('0x33')]){_0x10668b[_0x413c('0x12')]({'type':_0x4f3919['type'],'app':_0x413c('0x1d'),'appdata':_0x413c('0x37'),'context':_0x4f3919[_0x413c('0x19')],'exten':_0x4f3919[_0x413c('0xc')],'priority':_0x313230['length']+_0x57f553[_0x413c('0x1a')]+_0x4ca028++,'VoiceExtensionId':_0x4f3919['VoiceExtensionId']});_0x10668b[_0x413c('0x12')]({'type':_0x4f3919[_0x413c('0x15')],'app':_0x413c('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4f3919[_0x413c('0x19')],'exten':_0x4f3919[_0x413c('0xc')],'priority':_0x313230['length']+_0x57f553[_0x413c('0x1a')]+_0x4ca028++,'VoiceExtensionId':_0x4f3919[_0x413c('0x18')]});}else{_0x10668b[_0x413c('0x12')]({'type':_0x4f3919[_0x413c('0x15')],'app':_0x413c('0x1d'),'appdata':_0x413c('0x38'),'context':_0x4f3919[_0x413c('0x19')],'exten':_0x4f3919[_0x413c('0xc')],'priority':_0x313230['length']+_0x57f553['priority']+_0x4ca028++,'VoiceExtensionId':_0x4f3919[_0x413c('0x18')]});_0x10668b[_0x413c('0x12')]({'type':_0x4f3919[_0x413c('0x15')],'app':_0x413c('0x13'),'appdata':_0x413c('0x39'),'context':_0x4f3919[_0x413c('0x19')],'exten':_0x4f3919[_0x413c('0xc')],'priority':_0x313230['length']+_0x57f553['priority']+_0x4ca028++,'VoiceExtensionId':_0x4f3919[_0x413c('0x18')]});}}}for(var _0x1ddd6a=0x0;_0x1ddd6a<_0x313230[_0x413c('0x2a')];_0x1ddd6a+=0x1){var _0xfbc390=_0x57f553[_0x413c('0x1a')]+_0x313230['length'];var _0x5d3264=_0x1ddd6a===_0x313230[_0x413c('0x2a')]-0x1?_0x57f553['priority']+_0x10668b[_0x413c('0x2a')]+_0x4ec764[_0x413c('0x2a')]+0x2:_0x57f553[_0x413c('0x1a')]+_0x1ddd6a+0x1;_0x10668b['splice'](_0x1ddd6a,0x0,{'type':_0x4f3919['type'],'app':_0x413c('0x3a'),'appdata':_0x313230[_0x1ddd6a]+'?'+_0x4f3919[_0x413c('0x19')]+_0x413c('0x3b')+_0xfbc390+':'+_0x4f3919['context']+_0x413c('0x3b')+_0x5d3264,'exten':_0x4f3919['exten'],'context':_0x4f3919['context'],'priority':_0x57f553[_0x413c('0x1a')]+_0x1ddd6a,'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')]});}_0x4f3919[_0x413c('0x1a')]=_0x10668b[_0x413c('0x2a')]?_[_0x413c('0x3c')](_0x10668b)['priority']+0x1:_0x57f553[_0x413c('0x1a')];_0x57f553[_0x413c('0x1a')]=(_0x4ec764[_0x413c('0x2a')]?_['last'](_0x4ec764)[_0x413c('0x1a')]:_0x4f3919['priority'])+0x1;_0x57f553[_0x413c('0xf')]=_[_0x413c('0x3d')](_0x57f553[_0x413c('0xf')],_0x10668b,[_0x4f3919],_0x4ec764);}_0x57f553[_0x413c('0xf')][_0x413c('0x12')]({'type':_0x3a37f4[_0x543e97][0x0][_0x413c('0x15')],'app':_0x413c('0x3e'),'exten':_0x3a37f4[_0x543e97][0x0][_0x413c('0xc')],'context':_0x3a37f4[_0x543e97][0x0][_0x413c('0x19')],'priority':_0x57f553['priority'],'VoiceExtensionId':_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')]});_0x48b396['push'](_0x3a37f4[_0x543e97][0x0][_0x413c('0x18')]);_0x5d41bc=_[_0x413c('0x3d')](_0x5d41bc,_0x57f553[_0x413c('0xf')]);}}return _0x2446a1[_0x413c('0x3f')](function(_0x55b799){return _0x2446a1[_0x413c('0x3')][_0x413c('0x6')][_0x413c('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x48b396}},'transaction':_0x55b799})[_0x413c('0x1')](function(_0x32d96c){return _0x2446a1[_0x413c('0x3')][_0x413c('0x6')][_0x413c('0x41')](_[_0x413c('0x42')](_0x5d41bc,_0x413c('0x1a')),{'transaction':_0x55b799});});});})[_0x413c('0x43')](function(_0xe11a19){console['error'](_0xe11a19);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x8087=['intervals','tag','CDR(tag)=','outbound','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','lodash','util','models','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','extensions','extension','find','push','type','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','CDR(destination)=','${EXTEN:','Set','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval'];(function(_0x441fc5,_0x56b0ce){var _0x27bc38=function(_0x4858dc){while(--_0x4858dc){_0x441fc5['push'](_0x441fc5['shift']());}};_0x27bc38(++_0x56b0ce);}(_0x8087,0x1c2));var _0x7808=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x8087[_0x10004e];return _0x5af990;};'use strict';var _=require(_0x7808('0x0'));var util=require(_0x7808('0x1'));function rewrite(_0x46b4ad,_0x276e9e){var _0x7bdc60=this;return _0x46b4ad[_0x7808('0x2')]['Interval'][_0x7808('0x3')]({'raw':!![]})[_0x7808('0x4')](function(_0x10b874){_0x7bdc60['intervals']=_0x10b874;return _0x46b4ad[_0x7808('0x2')][_0x7808('0x5')][_0x7808('0x3')]({'where':{'IntervalId':_0x276e9e[_0x7808('0x6')]},'raw':!![]});})[_0x7808('0x4')](function(_0x107934){return _0x46b4ad[_0x7808('0x2')][_0x7808('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x7808('0x7')](_[_0x7808('0x8')](_0x107934,_0x7808('0x9')))}},'order':[{'raw':_0x7808('0xa')}],'raw':!![]});})['then'](function(_0x91a5a2){var _0x44411b=_[_0x7808('0xb')](_0x91a5a2,{'priority':'1'});var _0x46e613=_['filter'](_0x91a5a2,{'isApp':0x1});var _0xcb3cf4=_[_0x7808('0xc')](_0x46e613,_0x7808('0x9'));var _0x17713e=[_0x7808('0xd'),_0x7808('0xe')];var _0xd7fc91=[];var _0x4c2a49=[];for(var _0x26261d in _0xcb3cf4){if(_0xcb3cf4['hasOwnProperty'](_0x26261d)){_0x7bdc60['priority']=0x2;_0x7bdc60[_0x7808('0xf')]=[];_0x7bdc60[_0x7808('0x10')]=_[_0x7808('0x11')](_0x44411b,{'exten':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x9')]});_0x7bdc60[_0x7808('0xf')][_0x7808('0x12')]({'type':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x13')],'app':'Set','appdata':util['format']('CDR(type)=%s',_0xcb3cf4[_0x26261d][0x0]['type']),'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x9')],'priority':_0x7bdc60[_0x7808('0x15')]++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});if(_0xcb3cf4[_0x26261d][0x0]['type']===_0x7808('0x17')){_0x7bdc60['extensions'][_0x7808('0x12')]({'type':_0xcb3cf4[_0x26261d][0x0]['type'],'app':'Set','appdata':_0x7808('0x18')+_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')],'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x9')],'priority':_0x7bdc60[_0x7808('0x15')]++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});}else if(_0xcb3cf4[_0x26261d][0x0][_0x7808('0x13')]==='outbound'){if(_0x7bdc60[_0x7808('0x10')]){_0x7bdc60[_0x7808('0xf')][_0x7808('0x12')]({'type':_0xcb3cf4[_0x26261d][0x0]['type'],'app':'Set','appdata':_0x7808('0x19')+(_0x7bdc60[_0x7808('0x10')]['cutdigits']?_0x7808('0x1a')+_0x7bdc60['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0]['exten'],'priority':_0x7bdc60['priority']++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});}_0x7bdc60[_0x7808('0xf')][_0x7808('0x12')]({'type':_0xcb3cf4[_0x26261d][0x0]['type'],'app':_0x7808('0x1b'),'appdata':_0x7808('0x18')+_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')],'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x9')],'priority':_0x7bdc60[_0x7808('0x15')]++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});var _0xc0d3e1=_0x7bdc60['priority']++;_0x7bdc60[_0x7808('0xf')][_0x7808('0x12')]({'type':_0xcb3cf4[_0x26261d][0x0]['type'],'app':'ExecIf','appdata':_0x7808('0x1c')+(_0xc0d3e1+0x2)+_0x7808('0x1d')+(_0xc0d3e1+0x1)+')','context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0]['exten'],'priority':_0xc0d3e1,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});if(_0x7bdc60[_0x7808('0x10')]){_0x7bdc60['extensions']['push']({'type':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x13')],'app':_0x7808('0x1b'),'appdata':_0x7bdc60[_0x7808('0x10')][_0x7808('0x1e')]?_0x7808('0x1f')+_0x7bdc60[_0x7808('0x10')][_0x7808('0x1e')]+'}':_0x7808('0x20'),'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x9')],'priority':_0x7bdc60[_0x7808('0x15')]++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});}_0x7bdc60[_0x7808('0xf')]['push']({'type':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x13')],'app':'Set','appdata':_0x7808('0x21')+_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')],'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0]['exten'],'priority':_0x7bdc60[_0x7808('0x15')]++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});if(_0x7bdc60[_0x7808('0x10')]&&_0x7bdc60[_0x7808('0x10')][_0x7808('0x22')](_0x7808('0x23'))&&_0x7bdc60[_0x7808('0x10')][_0x7808('0x23')]!==_0x7808('0x24')){_0x7bdc60[_0x7808('0xf')][_0x7808('0x12')]({'type':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x13')],'app':_0x7808('0x1b'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x9')],'priority':_0x7bdc60[_0x7808('0x15')]++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});_0x7bdc60[_0x7808('0xf')][_0x7808('0x12')]({'type':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x13')],'app':'Set','appdata':_0x7808('0x25')+_0x7bdc60['extension'][_0x7808('0x23')]||_0x7808('0x26'),'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x9')],'priority':_0x7bdc60[_0x7808('0x15')]++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0]['VoiceExtensionId']});}}_0x7bdc60['extensions']['push']({'type':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x13')],'app':_0x7808('0x1b'),'appdata':_0x7808('0x27'),'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x9')],'priority':_0x7bdc60[_0x7808('0x15')]++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0]['VoiceExtensionId']});_0x7bdc60[_0x7808('0xf')][_0x7808('0x12')]({'type':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x13')],'app':_0x7808('0x1b'),'appdata':_0x7808('0x28'),'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x9')],'priority':_0x7bdc60[_0x7808('0x15')]++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});_0x7bdc60[_0x7808('0xf')][_0x7808('0x12')]({'type':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x13')],'app':_0x7808('0x1b'),'appdata':_0x7808('0x29'),'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'exten':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x9')],'priority':_0x7bdc60[_0x7808('0x15')]++,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});for(var _0x30510b=0x0,_0x33a7b8=0x0;_0x30510b<_0xcb3cf4[_0x26261d][_0x7808('0x2a')];_0x30510b+=0x1,_0x33a7b8=0x0){var _0x409c16=_0xcb3cf4[_0x26261d][_0x30510b];if(_0x409c16['type']){_0x409c16[_0x7808('0x13')]=_0x409c16[_0x7808('0x13')][_0x7808('0x2b')]();}var _0x423df6=[];var _0x115e76=[];delete _0x409c16['id'];delete _0x409c16[_0x7808('0x2c')];delete _0x409c16[_0x7808('0x2d')];var _0x407ac7=_0x409c16[_0x7808('0x2e')]!=='*,*,*,*'?[_0x409c16[_0x7808('0x2e')]]:_0x409c16[_0x7808('0x6')]?_['map'](_[_0x7808('0xb')](_0x7bdc60[_0x7808('0x2f')],{'IntervalId':_0x409c16[_0x7808('0x6')]}),_0x7808('0x2e')):[];if(_0x409c16['hasOwnProperty'](_0x7808('0x30'))){if(_0x409c16[_0x7808('0x30')]&&_0x409c16[_0x7808('0x30')]!=='--'){_0x423df6['push']({'type':_0x409c16[_0x7808('0x13')],'app':_0x7808('0x1b'),'appdata':_0x7808('0x31')+_0x409c16[_0x7808('0x30')],'context':_0x409c16[_0x7808('0x14')],'exten':_0x409c16[_0x7808('0x9')],'priority':_0x407ac7[_0x7808('0x2a')]+_0x7bdc60[_0x7808('0x15')]+_0x33a7b8++,'VoiceExtensionId':_0x409c16[_0x7808('0x16')]});}}if(_0x409c16['type']===_0x7808('0x32')&&_0x409c16[_0x7808('0x22')](_0x7808('0x33'))){if(_0x409c16[_0x7808('0x33')]){_0x423df6[_0x7808('0x12')]({'type':_0x409c16[_0x7808('0x13')],'app':_0x7808('0x34'),'appdata':_0x7808('0x35')+_0x409c16[_0x7808('0x33')]+')','context':_0x409c16['context'],'exten':_0x409c16['exten'],'priority':_0x407ac7[_0x7808('0x2a')]+_0x7bdc60['priority']+_0x33a7b8++,'VoiceExtensionId':_0x409c16[_0x7808('0x16')]});}else{_0x423df6[_0x7808('0x12')]({'type':_0x409c16[_0x7808('0x13')],'app':_0x7808('0x34'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x409c16['context'],'exten':_0x409c16[_0x7808('0x9')],'priority':_0x407ac7[_0x7808('0x2a')]+_0x7bdc60[_0x7808('0x15')]+_0x33a7b8++,'VoiceExtensionId':_0x409c16[_0x7808('0x16')]});}}if(_0x409c16['hasOwnProperty'](_0x7808('0x36'))){if(_0x17713e[_0x7808('0x37')](_0x409c16['app']['toLowerCase']())>=0x0&&_0x409c16[_0x7808('0x38')]!==_0x7808('0x39')){if(_0x409c16['answer']){_0x423df6['push']({'type':_0x409c16[_0x7808('0x13')],'app':_0x7808('0x34'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x409c16[_0x7808('0x14')],'exten':_0x409c16[_0x7808('0x9')],'priority':_0x407ac7[_0x7808('0x2a')]+_0x7bdc60[_0x7808('0x15')]+_0x33a7b8++,'VoiceExtensionId':_0x409c16[_0x7808('0x16')]});_0x423df6['push']({'type':_0x409c16[_0x7808('0x13')],'app':_0x7808('0x1b'),'appdata':_0x7808('0x3a'),'context':_0x409c16[_0x7808('0x14')],'exten':_0x409c16[_0x7808('0x9')],'priority':_0x407ac7['length']+_0x7bdc60['priority']+_0x33a7b8++,'VoiceExtensionId':_0x409c16[_0x7808('0x16')]});}else{_0x423df6[_0x7808('0x12')]({'type':_0x409c16['type'],'app':'ExecIf','appdata':_0x7808('0x3b'),'context':_0x409c16[_0x7808('0x14')],'exten':_0x409c16[_0x7808('0x9')],'priority':_0x407ac7[_0x7808('0x2a')]+_0x7bdc60[_0x7808('0x15')]+_0x33a7b8++,'VoiceExtensionId':_0x409c16[_0x7808('0x16')]});_0x423df6[_0x7808('0x12')]({'type':_0x409c16[_0x7808('0x13')],'app':_0x7808('0x1b'),'appdata':_0x7808('0x3c'),'context':_0x409c16[_0x7808('0x14')],'exten':_0x409c16[_0x7808('0x9')],'priority':_0x407ac7[_0x7808('0x2a')]+_0x7bdc60[_0x7808('0x15')]+_0x33a7b8++,'VoiceExtensionId':_0x409c16['VoiceExtensionId']});}}}for(var _0x5eda0b=0x0;_0x5eda0b<_0x407ac7[_0x7808('0x2a')];_0x5eda0b+=0x1){var _0x394f82=_0x7bdc60['priority']+_0x407ac7[_0x7808('0x2a')];var _0x52a7f1=_0x5eda0b===_0x407ac7[_0x7808('0x2a')]-0x1?_0x7bdc60[_0x7808('0x15')]+_0x423df6[_0x7808('0x2a')]+_0x115e76[_0x7808('0x2a')]+0x2:_0x7bdc60[_0x7808('0x15')]+_0x5eda0b+0x1;_0x423df6[_0x7808('0x3d')](_0x5eda0b,0x0,{'type':_0x409c16['type'],'app':_0x7808('0x3e'),'appdata':_0x407ac7[_0x5eda0b]+'?'+_0x409c16[_0x7808('0x14')]+',${EXTEN},'+_0x394f82+':'+_0x409c16['context']+_0x7808('0x3f')+_0x52a7f1,'exten':_0x409c16['exten'],'context':_0x409c16['context'],'priority':_0x7bdc60[_0x7808('0x15')]+_0x5eda0b,'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]});}_0x409c16[_0x7808('0x15')]=_0x423df6[_0x7808('0x2a')]?_[_0x7808('0x40')](_0x423df6)[_0x7808('0x15')]+0x1:_0x7bdc60['priority'];_0x7bdc60['priority']=(_0x115e76[_0x7808('0x2a')]?_[_0x7808('0x40')](_0x115e76)[_0x7808('0x15')]:_0x409c16[_0x7808('0x15')])+0x1;_0x7bdc60[_0x7808('0xf')]=_[_0x7808('0x41')](_0x7bdc60[_0x7808('0xf')],_0x423df6,[_0x409c16],_0x115e76);}_0x7bdc60[_0x7808('0xf')][_0x7808('0x12')]({'type':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x13')],'app':_0x7808('0x42'),'exten':_0xcb3cf4[_0x26261d][0x0]['exten'],'context':_0xcb3cf4[_0x26261d][0x0][_0x7808('0x14')],'priority':_0x7bdc60[_0x7808('0x15')],'VoiceExtensionId':_0xcb3cf4[_0x26261d][0x0]['VoiceExtensionId']});_0xd7fc91[_0x7808('0x12')](_0xcb3cf4[_0x26261d][0x0][_0x7808('0x16')]);_0x4c2a49=_[_0x7808('0x41')](_0x4c2a49,_0x7bdc60[_0x7808('0xf')]);}}return _0x46b4ad[_0x7808('0x43')](function(_0x4114f8){return _0x46b4ad[_0x7808('0x2')]['VoiceExtension'][_0x7808('0x44')]({'where':{'VoiceExtensionId':{'$in':_0xd7fc91}},'transaction':_0x4114f8})[_0x7808('0x4')](function(_0x36de6){return _0x46b4ad['models']['VoiceExtension']['bulkCreate'](_[_0x7808('0x45')](_0x4c2a49,_0x7808('0x15')),{'transaction':_0x4114f8});});});})[_0x7808('0x46')](function(_0x4f647e){console['error'](_0x4f647e);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index fca4d42..00c4b48 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 _0x9aa5=['VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','find','duplicate','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','phone','ListId','field','NOW()','scheduledAt','toString','createdAt','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','ContactId','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','query'];(function(_0x4f0292,_0x28ec9e){var _0x2d6834=function(_0x124b20){while(--_0x124b20){_0x4f0292['push'](_0x4f0292['shift']());}};_0x2d6834(++_0x28ec9e);}(_0x9aa5,0xf6));var _0x59aa=function(_0x2a3f7a,_0x43ebfe){_0x2a3f7a=_0x2a3f7a-0x0;var _0x487795=_0x9aa5[_0x2a3f7a];return _0x487795;};'use strict';var BPromise=require(_0x59aa('0x0'));var util=require(_0x59aa('0x1'));var _=require(_0x59aa('0x2'));var fs=require('fs');var squel=require(_0x59aa('0x3'));var Papa=require(_0x59aa('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x59aa('0x5'));var logger=require(_0x59aa('0x6'))(_0x59aa('0x7'));config[_0x59aa('0x8')]=_[_0x59aa('0x9')](config[_0x59aa('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x59aa('0xa'))(new Redis(config[_0x59aa('0x8')]));require(_0x59aa('0xb'))['register'](socket);try{if(!process[_0x59aa('0xc')][0x2]||process[_0x59aa('0xc')][0x2]===_0x59aa('0xd')||process[_0x59aa('0xc')][0x2]===_0x59aa('0xe')){throw new Error(_0x59aa('0xf'));}var FILEPATH=process[_0x59aa('0xc')][0x2];if(!process[_0x59aa('0xc')][0x3]||process[_0x59aa('0xc')][0x3]==='undefined'||process[_0x59aa('0xc')][0x3]===_0x59aa('0xe')||!process[_0x59aa('0xc')][0x4]||process[_0x59aa('0xc')][0x4]===_0x59aa('0xd')||process[_0x59aa('0xc')][0x4]===_0x59aa('0xe')){throw new Error(_0x59aa('0x10'));}var FIELDS=_['zipObject'](process[_0x59aa('0xc')][0x3][_0x59aa('0x11')](','),process['argv'][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x59aa('0xd')||process[_0x59aa('0xc')][0x5]==='null'){throw new Error(_0x59aa('0x12'));}var LISTID=process[_0x59aa('0xc')][0x5];var COMPANYID=process[_0x59aa('0xc')][0x6]&&process[_0x59aa('0xc')][0x6]!==_0x59aa('0xd')&&process[_0x59aa('0xc')][0x6]!==_0x59aa('0xe')?process[_0x59aa('0xc')][0x6]:null;var DUPLICATES=process[_0x59aa('0xc')][0x7]&&process[_0x59aa('0xc')][0x7]!=='undefined'&&process[_0x59aa('0xc')][0x7]!==_0x59aa('0xe')?process[_0x59aa('0xc')][0x7]:null;if(!process[_0x59aa('0xc')][0x8]||process[_0x59aa('0xc')][0x8]==='undefined'||process[_0x59aa('0xc')][0x8]===_0x59aa('0xe')){throw new Error(_0x59aa('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0xafb638){logger[_0x59aa('0x14')](_0xafb638);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(_0x33a75b,_0xdc68,_0x52b349,_0x3bd674){var _0x37b4ab={'message':_0xdc68};_0x37b4ab[_0x33a75b]=!![];if(_0x52b349){_0x37b4ab[_0x59aa('0x15')]=_0x52b349;}if(_0x3bd674){_0x37b4ab[_0x59aa('0x16')]=_0x3bd674;}return _0x37b4ab;}function isEmail(_0x23ce82){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'](_0x23ce82);}function checkRow(_0x435a2f,_0x966e40,_0x5e6869){return new BPromise(function(_0x54ee45,_0x3c963c){if(_[_0x59aa('0x17')](_0x435a2f)){return _0x3c963c(handleCheckRowError(_0x59aa('0x14'),_0x59aa('0x18'),null,_0x5e6869));}if(_0x435a2f[_0x59aa('0x19')]&&_0x435a2f[_0x59aa('0x19')][_0x59aa('0x1a')]){var _0x8b04ef=_[_0x59aa('0x1b')](_0x435a2f['errors'],'message')[_0x59aa('0x1c')](';');return _0x3c963c(handleCheckRowError('error',_0x8b04ef,null,_0x5e6869));}var _0x146b24={};for(var _0x4984b3 in FIELDS){if(FIELDS[_0x59aa('0x1d')](_0x4984b3)&&FIELDS[_0x4984b3]){_0x146b24[_0x4984b3]=_0x435a2f['data'][0x0][FIELDS[_0x4984b3]]||_0x435a2f[_0x59aa('0x1e')][0x0]['\ufeff'+FIELDS[_0x4984b3]];}}if(!_0x146b24[_0x59aa('0x1f')]){return _0x3c963c(handleCheckRowError('error',_0x59aa('0x20'),null,_0x5e6869));}if(!_0x146b24['phone']){return _0x3c963c(handleCheckRowError(_0x59aa('0x14'),_0x59aa('0x21'),null,_0x5e6869));}if(_0x146b24[_0x59aa('0x22')]){var _0x29aa85=moment(_0x146b24[_0x59aa('0x22')],'YYYY-MM-DD');if(!_0x29aa85[_0x59aa('0x23')]()){return _0x3c963c(handleCheckRowError(_0x59aa('0x14'),_0x59aa('0x24'),null,_0x5e6869));}}if(_0x146b24[_0x59aa('0x25')]){if(!isEmail(_0x146b24['email'])){return _0x3c963c(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x5e6869));}}_0x146b24['ListId']=LISTID;_0x146b24['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x966e40){var _0x57368d={};for(var _0x5ca364=0x0,_0x3a05ab=DUPLICATES[_0x59aa('0x1a')];_0x5ca364<_0x3a05ab;_0x5ca364+=0x1){_0x57368d[DUPLICATES[_0x5ca364]]=_0x146b24[DUPLICATES[_0x5ca364]];}var _0x22d175=_[_0x59aa('0x26')](_0x966e40,_0x57368d);if(_0x22d175){return _0x3c963c(handleCheckRowError(_0x59aa('0x27'),'Duplicate\x20Contact',_0x22d175,_0x5e6869));}}return db[_0x59aa('0x28')][_0x59aa('0x29')](_0x146b24,{'raw':!![],'hooks':![],'fields':_['keys'](_0x146b24)})[_0x59aa('0x2a')](function(_0x44972e){if(DUPLICATES&&DUPLICATES[_0x59aa('0x1a')]&&_0x966e40){_0x966e40[_0x59aa('0x2b')](_[_0x59aa('0x2c')](_0x146b24,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x44972e['id'];return _0x54ee45();})[_0x59aa('0x2d')](function(_0x1a4ee0){return _0x3c963c(handleCheckRowError(_0x59aa('0x14'),_0x59aa('0x2e')+(_0x1a4ee0['message']||JSON[_0x59aa('0x2f')](_0x1a4ee0)),null,_0x5e6869));});});}function checkHopper(){function _0x5d62eb(){return function(_0x39d100){logger[_0x59aa('0x14')](_0x59aa('0x30'),_0x59aa('0x31'),util[_0x59aa('0x32')](_0x39d100,{'showHidden':![],'depth':null}));};}var _0x27df26=function(_0x7a7432,_0x1545a3){var _0x494a7c=squel[_0x59aa('0x33')]()[_0x59aa('0x34')](_0x59aa('0x35'))[_0x59aa('0x36')]([_0x59aa('0x37'),'scheduledAt','ContactId',_0x59aa('0x38'),_0x1545a3,'createdAt','updatedAt'],squel['select']()[_0x59aa('0x39')](_0x59aa('0x37'),'phone')[_0x59aa('0x39')](_0x59aa('0x3a'),_0x59aa('0x3b'))['field']('id','ContactId')[_0x59aa('0x39')](LISTID[_0x59aa('0x3c')](),_0x59aa('0x38'))['field'](_0x7a7432['id'][_0x59aa('0x3c')](),_0x1545a3)[_0x59aa('0x39')](_0x59aa('0x3a'),_0x59aa('0x3d'))[_0x59aa('0x39')](_0x59aa('0x3a'),_0x59aa('0x3e'))[_0x59aa('0x3f')](_0x59aa('0x40'))[_0x59aa('0x41')](_0x59aa('0x42'))[_0x59aa('0x41')](_0x59aa('0x43'),LISTID[_0x59aa('0x3c')]())[_0x59aa('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0x59aa('0x41')](_0x59aa('0x44'),squel[_0x59aa('0x45')]()[_0x59aa('0x39')]('phone')[_0x59aa('0x3f')](_0x59aa('0x35'))[_0x59aa('0x41')](_0x1545a3+_0x59aa('0x46'),_0x7a7432['id']['toString']())))[_0x59aa('0x3c')]();return _0x494a7c;};var _0x2c5bd3=function(_0x4883cc,_0x26f3a1){var _0x51cc16=squel[_0x59aa('0x33')]()[_0x59aa('0x34')](_0x59aa('0x35'))['fromQuery']([_0x59aa('0x37'),'scheduledAt','ContactId',_0x59aa('0x38'),_0x26f3a1,_0x59aa('0x3d'),'updatedAt'],squel[_0x59aa('0x45')]()[_0x59aa('0x39')](_0x59aa('0x37'),_0x59aa('0x37'))[_0x59aa('0x39')]('NOW()',_0x59aa('0x3b'))[_0x59aa('0x39')]('id','ContactId')[_0x59aa('0x39')](LISTID[_0x59aa('0x3c')](),_0x59aa('0x38'))[_0x59aa('0x39')](_0x4883cc['id'][_0x59aa('0x3c')](),_0x26f3a1)[_0x59aa('0x39')](_0x59aa('0x3a'),'createdAt')['field'](_0x59aa('0x3a'),'updatedAt')['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x59aa('0x41')](_0x59aa('0x43'),LISTID[_0x59aa('0x3c')]())[_0x59aa('0x41')]('id\x20IN\x20?',squel[_0x59aa('0x47')](hopperContacts))['where'](_0x59aa('0x48'))[_0x59aa('0x41')](_0x59aa('0x44'),squel[_0x59aa('0x45')]()['field'](_0x59aa('0x49'))['from']('cm_hopper_final')[_0x59aa('0x41')](_0x26f3a1+_0x59aa('0x46'),_0x4883cc['id'][_0x59aa('0x3c')]()))[_0x59aa('0x41')](_0x59aa('0x44'),squel[_0x59aa('0x45')]()[_0x59aa('0x39')](_0x59aa('0x37'))[_0x59aa('0x3f')](_0x59aa('0x35'))[_0x59aa('0x41')](_0x26f3a1+_0x59aa('0x46'),_0x4883cc['id']['toString']())))[_0x59aa('0x3c')]();return _0x51cc16;};function _0x4c1d36(_0x29dcbf,_0x5a5446){var _0x33992a=squel[_0x59aa('0x33')]()[_0x59aa('0x34')]('cm_hopper')[_0x59aa('0x36')]([_0x59aa('0x37'),'scheduledAt',_0x59aa('0x4a'),_0x59aa('0x38'),_0x5a5446,_0x59aa('0x3d'),_0x59aa('0x3e')],squel[_0x59aa('0x45')]()[_0x59aa('0x39')](_0x59aa('0x37'),_0x59aa('0x37'))['field']('NOW()','scheduledAt')['field']('id',_0x59aa('0x4a'))[_0x59aa('0x39')](LISTID[_0x59aa('0x3c')](),_0x59aa('0x38'))[_0x59aa('0x39')](_0x29dcbf['id'][_0x59aa('0x3c')](),_0x5a5446)[_0x59aa('0x39')](_0x59aa('0x3a'),_0x59aa('0x3d'))['field'](_0x59aa('0x3a'),'updatedAt')[_0x59aa('0x3f')](_0x59aa('0x40'))['where'](_0x59aa('0x42'))['where'](_0x59aa('0x43'),LISTID['toString']())[_0x59aa('0x41')]('id\x20IN\x20?',squel[_0x59aa('0x47')](hopperContacts))['where'](_0x59aa('0x48')))[_0x59aa('0x3c')]();return _0x33992a;}function _0x4f8515(_0x1fca6e,_0x1ebd18){var _0xd0750a=squel[_0x59aa('0x33')]()[_0x59aa('0x34')](_0x59aa('0x4b'))[_0x59aa('0x36')]([_0x59aa('0x37'),_0x59aa('0x4a'),'ListId',_0x1ebd18,_0x59aa('0x3d'),_0x59aa('0x3e')],squel[_0x59aa('0x45')]()['field'](_0x59aa('0x37'),_0x59aa('0x37'))[_0x59aa('0x39')]('id',_0x59aa('0x4a'))[_0x59aa('0x39')](LISTID[_0x59aa('0x3c')](),_0x59aa('0x38'))[_0x59aa('0x39')](_0x1fca6e['id']['toString'](),_0x1ebd18)[_0x59aa('0x39')](_0x59aa('0x3a'),_0x59aa('0x3d'))[_0x59aa('0x39')](_0x59aa('0x3a'),_0x59aa('0x3e'))['from'](_0x59aa('0x40'))[_0x59aa('0x41')](_0x59aa('0x42'))[_0x59aa('0x41')]('ListId\x20=\x20?',LISTID[_0x59aa('0x3c')]())[_0x59aa('0x41')]('id\x20IN\x20?',squel[_0x59aa('0x47')](hopperContacts))[_0x59aa('0x41')](_0x59aa('0x48')))[_0x59aa('0x3c')]();return _0xd0750a;}return db[_0x59aa('0x4c')][_0x59aa('0x4d')]({'where':{'type':_0x59aa('0x4e')},'attributes':['id',_0x59aa('0x4f')],'include':[{'model':db[_0x59aa('0x50')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x3617c7){var _0x51b951=[];if(_0x3617c7){var _0x1c4cc9;for(var _0x5ea5c7=0x0,_0x2010f7;_0x5ea5c7<_0x3617c7['length'];_0x5ea5c7+=0x1){_0x2010f7=_0x3617c7[_0x5ea5c7][_0x59aa('0x51')]({'plain':!![]});switch(_0x2010f7[_0x59aa('0x4f')]){case _0x59aa('0x52'):_0x51b951[_0x59aa('0x2b')](db['sequelize'][_0x59aa('0x53')](_0x2c5bd3(_0x2010f7,_0x59aa('0x54')))['then'](function(){})[_0x59aa('0x2d')](_0x5d62eb()));break;case _0x59aa('0x55'):_0x51b951[_0x59aa('0x2b')](db[_0x59aa('0x56')][_0x59aa('0x53')](_0x27df26(_0x2010f7,_0x59aa('0x54')))[_0x59aa('0x2a')](function(){})[_0x59aa('0x2d')](_0x5d62eb()));break;default:_0x51b951[_0x59aa('0x2b')](db[_0x59aa('0x56')][_0x59aa('0x53')](_0x4c1d36(_0x2010f7,_0x59aa('0x54')))[_0x59aa('0x2a')](function(){})[_0x59aa('0x2d')](_0x5d62eb()));}}}return _0x51b951;})[_0x59aa('0x57')]()[_0x59aa('0x2a')](function(){return db[_0x59aa('0x4c')][_0x59aa('0x4d')]({'where':{'type':_0x59aa('0x4e')},'attributes':['id'],'include':[{'model':db[_0x59aa('0x50')],'as':_0x59aa('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x1fbb87){var _0x537678=[];if(_0x1fbb87){var _0xbcca63;for(var _0x3a9b97=0x0,_0x535d06;_0x3a9b97<_0x1fbb87['length'];_0x3a9b97+=0x1){_0x535d06=_0x1fbb87[_0x3a9b97][_0x59aa('0x51')]({'plain':!![]});_0x537678['push'](db[_0x59aa('0x56')]['query'](_0x4f8515(_0x535d06,'VoiceQueueId'))['then'](function(){})[_0x59aa('0x2d')](_0x5d62eb()));}}return _0x537678;})[_0x59aa('0x57')]();})[_0x59aa('0x2a')](function(){return db[_0x59aa('0x59')][_0x59aa('0x4d')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x59aa('0x50')],'as':_0x59aa('0x5a'),'where':{'id':LISTID}}]})[_0x59aa('0x2a')](function(_0x314ab7){var _0x1f5122=[];if(_0x314ab7){for(var _0x296b54=0x0,_0x342b06;_0x296b54<_0x314ab7[_0x59aa('0x1a')];_0x296b54+=0x1){_0x342b06=_0x314ab7[_0x296b54]['get']({'plain':!![]});switch(_0x342b06[_0x59aa('0x4f')]){case _0x59aa('0x52'):_0x1f5122[_0x59aa('0x2b')](db[_0x59aa('0x56')]['query'](_0x2c5bd3(_0x342b06,_0x59aa('0x5b')))[_0x59aa('0x2a')](function(){})[_0x59aa('0x2d')](_0x5d62eb()));break;case _0x59aa('0x55'):_0x1f5122[_0x59aa('0x2b')](db['sequelize'][_0x59aa('0x53')](_0x27df26(_0x342b06,_0x59aa('0x5b')))[_0x59aa('0x2a')](function(){})[_0x59aa('0x2d')](_0x5d62eb()));break;default:_0x1f5122[_0x59aa('0x2b')](db[_0x59aa('0x56')]['query'](_0x4c1d36(_0x342b06,'CampaignId'))[_0x59aa('0x2a')](function(){})[_0x59aa('0x2d')](_0x5d62eb()));}}}return _0x1f5122;})['all']();})['then'](function(){return db['Campaign'][_0x59aa('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x59aa('0x50')],'as':_0x59aa('0x58'),'where':{'id':LISTID}}]})[_0x59aa('0x2a')](function(_0x122de0){var _0x3dbb38=[];if(_0x122de0){for(var _0x3c22c7=0x0,_0x4dff81;_0x3c22c7<_0x122de0['length'];_0x3c22c7+=0x1){_0x4dff81=_0x122de0[_0x3c22c7][_0x59aa('0x51')]({'plain':!![]});_0x3dbb38[_0x59aa('0x2b')](db['sequelize']['query'](_0x4f8515(_0x4dff81,_0x59aa('0x5b')))[_0x59aa('0x2a')](function(){})['catch'](_0x5d62eb()));}}return _0x3dbb38;})[_0x59aa('0x57')]();})['catch'](function(_0x38d8f4){logger[_0x59aa('0x14')](_0x59aa('0x5c'),_0x59aa('0x5d'),_0x38d8f4[_0x59aa('0x5e')]);});}var processPromises=function(_0x2dae51){return BPromise['all'](promises)[_0x59aa('0x2a')](function(_0x11be9f){})[_0x59aa('0x2d')](function(_0x269242){logger[_0x59aa('0x14')](_0x59aa('0x5f'),JSON[_0x59aa('0x2f')](_0x269242));})[_0x59aa('0x60')](function(){socket[_0x59aa('0x61')](_0x59aa('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dae51){return _0x2dae51['resume']();}});};var endCsv=function(){return BPromise[_0x59aa('0x63')]()[_0x59aa('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x59aa('0x2a')](function(){socket[_0x59aa('0x61')](_0x59aa('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x59aa('0x64')](FILEPATH);}catch(_0x700fd8){logger[_0x59aa('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x59aa('0x2f')](_0x700fd8));}finally{process[_0x59aa('0x65')](0x0);}});};process['on'](_0x59aa('0x66'),function(){logger[_0x59aa('0x67')](_0x59aa('0x68'));endCsv();});function main(){return BPromise[_0x59aa('0x63')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x59aa('0x2a')](function(_0xca1657){var _0x2abe04=fs[_0x59aa('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2abe04,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1a14f0,_0x28e47f){total+=0x1;var _0x207eec=total;promises[_0x59aa('0x2b')](checkRow(_0x1a14f0,_0xca1657,_0x207eec)[_0x59aa('0x2a')](function(){success+=0x1;})['catch'](function(_0x2764e2){if(_0x2764e2[_0x59aa('0x14')]){errors+=0x1;delete _0x2764e2[_0x59aa('0x14')];}else if(_0x2764e2[_0x59aa('0x27')]){duplicates+=0x1;delete _0x2764e2[_0x59aa('0x27')];}rows['push'](_0x2764e2);}));if(total%0xc8===0x0){_0x28e47f[_0x59aa('0x6a')]();return processPromises(_0x28e47f);}},'complete':function(){return processPromises()[_0x59aa('0x2a')](function(){logger[_0x59aa('0x67')](_0x59aa('0x6b'));endCsv();});},'error':function(_0x583e2a,_0x52b807){logger['info'](_0x59aa('0x6c'),JSON[_0x59aa('0x2f')](_0x583e2a));endCsv();}});})[_0x59aa('0x2d')](function(_0x17a74e){logger['error'](_0x59aa('0x6d'),JSON['stringify'](_0x17a74e));});}main(); \ No newline at end of file +var _0xc353=['pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','firstName','phone\x20not\x20specified!','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','phone','ContactId','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','createdAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','VoiceQueueId','query','all','BlackLists','get','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc353,0x78));var _0x3c35=function(_0x392f09,_0x492263){_0x392f09=_0x392f09-0x0;var _0xdad228=_0xc353[_0x392f09];return _0xdad228;};'use strict';var BPromise=require(_0x3c35('0x0'));var util=require(_0x3c35('0x1'));var _=require(_0x3c35('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x3c35('0x3'));var Redis=require(_0x3c35('0x4'));var db=require(_0x3c35('0x5'))['db'];var config=require(_0x3c35('0x6'));var logger=require(_0x3c35('0x7'))(_0x3c35('0x8'));config[_0x3c35('0x9')]=_[_0x3c35('0xa')](config[_0x3c35('0x9')],{'host':_0x3c35('0xb'),'port':0x18eb});var socket=require(_0x3c35('0xc'))(new Redis(config[_0x3c35('0x9')]));require(_0x3c35('0xd'))[_0x3c35('0xe')](socket);try{if(!process[_0x3c35('0xf')][0x2]||process[_0x3c35('0xf')][0x2]===_0x3c35('0x10')||process['argv'][0x2]===_0x3c35('0x11')){throw new Error(_0x3c35('0x12'));}var FILEPATH=process[_0x3c35('0xf')][0x2];if(!process[_0x3c35('0xf')][0x3]||process['argv'][0x3]===_0x3c35('0x10')||process['argv'][0x3]===_0x3c35('0x11')||!process[_0x3c35('0xf')][0x4]||process[_0x3c35('0xf')][0x4]===_0x3c35('0x10')||process[_0x3c35('0xf')][0x4]===_0x3c35('0x11')){throw new Error(_0x3c35('0x13'));}var FIELDS=_['zipObject'](process['argv'][0x3]['split'](','),process['argv'][0x4][_0x3c35('0x14')](','));if(!process[_0x3c35('0xf')][0x5]||process[_0x3c35('0xf')][0x5]===_0x3c35('0x10')||process['argv'][0x5]===_0x3c35('0x11')){throw new Error(_0x3c35('0x15'));}var LISTID=process[_0x3c35('0xf')][0x5];var COMPANYID=process[_0x3c35('0xf')][0x6]&&process['argv'][0x6]!==_0x3c35('0x10')&&process[_0x3c35('0xf')][0x6]!=='null'?process[_0x3c35('0xf')][0x6]:null;var DUPLICATES=process[_0x3c35('0xf')][0x7]&&process['argv'][0x7]!==_0x3c35('0x10')&&process[_0x3c35('0xf')][0x7]!==_0x3c35('0x11')?process['argv'][0x7]:null;if(!process[_0x3c35('0xf')][0x8]||process['argv'][0x8]===_0x3c35('0x10')||process[_0x3c35('0xf')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3c35('0xf')][0x8];}catch(_0x295716){logger[_0x3c35('0x16')](_0x295716);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(_0x23c4c3,_0x62153b,_0x48a75d,_0x1651f5){var _0x50e245={'message':_0x62153b};_0x50e245[_0x23c4c3]=!![];if(_0x48a75d){_0x50e245[_0x3c35('0x17')]=_0x48a75d;}if(_0x1651f5){_0x50e245[_0x3c35('0x18')]=_0x1651f5;}return _0x50e245;}function isEmail(_0x191d99){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))*$/[_0x3c35('0x19')](_0x191d99);}function checkRow(_0x57ba21,_0x1d96f9,_0x406f26){return new BPromise(function(_0x3e85fa,_0x160849){if(_[_0x3c35('0x1a')](_0x57ba21)){return _0x160849(handleCheckRowError('error',_0x3c35('0x1b'),null,_0x406f26));}if(_0x57ba21[_0x3c35('0x1c')]&&_0x57ba21[_0x3c35('0x1c')]['length']){var _0x41fa15=_[_0x3c35('0x1d')](_0x57ba21[_0x3c35('0x1c')],'message')[_0x3c35('0x1e')](';');return _0x160849(handleCheckRowError(_0x3c35('0x16'),_0x41fa15,null,_0x406f26));}var _0x256784={};for(var _0x156b5a in FIELDS){if(FIELDS[_0x3c35('0x1f')](_0x156b5a)&&FIELDS[_0x156b5a]){_0x256784[_0x156b5a]=_0x57ba21['data'][0x0][FIELDS[_0x156b5a]]||_0x57ba21['data'][0x0]['\ufeff'+FIELDS[_0x156b5a]];}}if(!_0x256784[_0x3c35('0x20')]){return _0x160849(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x406f26));}if(!_0x256784['phone']){return _0x160849(handleCheckRowError(_0x3c35('0x16'),_0x3c35('0x21'),null,_0x406f26));}if(_0x256784['birthDate']){var _0x1d90c=moment(_0x256784['birthDate'],'YYYY-MM-DD');if(!_0x1d90c[_0x3c35('0x22')]()){return _0x160849(handleCheckRowError(_0x3c35('0x16'),_0x3c35('0x23'),null,_0x406f26));}}if(_0x256784[_0x3c35('0x24')]){if(!isEmail(_0x256784['email'])){return _0x160849(handleCheckRowError(_0x3c35('0x16'),'email\x20format\x20is\x20not\x20valid!',null,_0x406f26));}}_0x256784[_0x3c35('0x25')]=LISTID;_0x256784[_0x3c35('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3c35('0x27')]&&_0x1d96f9){var _0x2d58f6={};for(var _0x594466=0x0,_0x18ad90=DUPLICATES[_0x3c35('0x27')];_0x594466<_0x18ad90;_0x594466+=0x1){_0x2d58f6[DUPLICATES[_0x594466]]=_0x256784[DUPLICATES[_0x594466]];}var _0x5107b3=_[_0x3c35('0x28')](_0x1d96f9,_0x2d58f6);if(_0x5107b3){return _0x160849(handleCheckRowError(_0x3c35('0x29'),_0x3c35('0x2a'),_0x5107b3,_0x406f26));}}return db[_0x3c35('0x2b')][_0x3c35('0x2c')](_0x256784,{'raw':!![],'hooks':![],'fields':_[_0x3c35('0x2d')](_0x256784)})[_0x3c35('0x2e')](function(_0xbee683){if(DUPLICATES&&DUPLICATES[_0x3c35('0x27')]&&_0x1d96f9){_0x1d96f9[_0x3c35('0x2f')](_[_0x3c35('0x30')](_0x256784,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xbee683['id'];return _0x3e85fa();})[_0x3c35('0x31')](function(_0x5dbff4){return _0x160849(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x5dbff4[_0x3c35('0x32')]||JSON[_0x3c35('0x33')](_0x5dbff4)),null,_0x406f26));});});}function checkHopper(){function _0x1a15a4(){return function(_0x5c330e){logger[_0x3c35('0x16')](_0x3c35('0x34'),_0x3c35('0x35'),util[_0x3c35('0x36')](_0x5c330e,{'showHidden':![],'depth':null}));};}var _0x1d07b3=function(_0x1eac94,_0x52c9e1){var _0xf349d3=squel[_0x3c35('0x37')]()[_0x3c35('0x38')](_0x3c35('0x39'))[_0x3c35('0x3a')]([_0x3c35('0x3b'),'scheduledAt',_0x3c35('0x3c'),_0x3c35('0x25'),_0x52c9e1,'createdAt',_0x3c35('0x3d')],squel[_0x3c35('0x3e')]()[_0x3c35('0x3f')]('phone',_0x3c35('0x3b'))[_0x3c35('0x3f')](_0x3c35('0x40'),_0x3c35('0x41'))[_0x3c35('0x3f')]('id',_0x3c35('0x3c'))[_0x3c35('0x3f')](LISTID[_0x3c35('0x42')](),_0x3c35('0x25'))[_0x3c35('0x3f')](_0x1eac94['id'][_0x3c35('0x42')](),_0x52c9e1)[_0x3c35('0x3f')]('NOW()','createdAt')[_0x3c35('0x3f')](_0x3c35('0x40'),_0x3c35('0x3d'))[_0x3c35('0x43')](_0x3c35('0x44'))[_0x3c35('0x45')](_0x3c35('0x46'))[_0x3c35('0x45')](_0x3c35('0x47'),LISTID['toString']())[_0x3c35('0x45')](_0x3c35('0x48'))[_0x3c35('0x45')](_0x3c35('0x49'),squel[_0x3c35('0x3e')]()[_0x3c35('0x3f')](_0x3c35('0x3b'))[_0x3c35('0x43')](_0x3c35('0x39'))[_0x3c35('0x45')](_0x52c9e1+_0x3c35('0x4a'),_0x1eac94['id'][_0x3c35('0x42')]())))[_0x3c35('0x42')]();return _0xf349d3;};var _0x406ec1=function(_0x57edf8,_0x4823d1){var _0x1ec965=squel['insert']()[_0x3c35('0x38')](_0x3c35('0x39'))['fromQuery']([_0x3c35('0x3b'),'scheduledAt',_0x3c35('0x3c'),'ListId',_0x4823d1,_0x3c35('0x4b'),_0x3c35('0x3d')],squel[_0x3c35('0x3e')]()['field'](_0x3c35('0x3b'),_0x3c35('0x3b'))[_0x3c35('0x3f')](_0x3c35('0x40'),'scheduledAt')['field']('id',_0x3c35('0x3c'))[_0x3c35('0x3f')](LISTID['toString'](),_0x3c35('0x25'))[_0x3c35('0x3f')](_0x57edf8['id']['toString'](),_0x4823d1)[_0x3c35('0x3f')](_0x3c35('0x40'),'createdAt')[_0x3c35('0x3f')](_0x3c35('0x40'),_0x3c35('0x3d'))[_0x3c35('0x43')](_0x3c35('0x44'))[_0x3c35('0x45')](_0x3c35('0x46'))[_0x3c35('0x45')](_0x3c35('0x47'),LISTID[_0x3c35('0x42')]())[_0x3c35('0x45')](_0x3c35('0x4c'),squel[_0x3c35('0x4d')](hopperContacts))['where'](_0x3c35('0x48'))[_0x3c35('0x45')](_0x3c35('0x49'),squel[_0x3c35('0x3e')]()['field'](_0x3c35('0x4e'))[_0x3c35('0x43')](_0x3c35('0x4f'))[_0x3c35('0x45')](_0x4823d1+_0x3c35('0x4a'),_0x57edf8['id'][_0x3c35('0x42')]()))[_0x3c35('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3c35('0x3e')]()[_0x3c35('0x3f')]('phone')[_0x3c35('0x43')](_0x3c35('0x39'))['where'](_0x4823d1+_0x3c35('0x4a'),_0x57edf8['id'][_0x3c35('0x42')]())))[_0x3c35('0x42')]();return _0x1ec965;};function _0x1da345(_0x430695,_0x4c496a){var _0x49886c=squel[_0x3c35('0x37')]()[_0x3c35('0x38')](_0x3c35('0x39'))[_0x3c35('0x3a')]([_0x3c35('0x3b'),_0x3c35('0x41'),_0x3c35('0x3c'),_0x3c35('0x25'),_0x4c496a,_0x3c35('0x4b'),_0x3c35('0x3d')],squel[_0x3c35('0x3e')]()['field'](_0x3c35('0x3b'),_0x3c35('0x3b'))[_0x3c35('0x3f')](_0x3c35('0x40'),'scheduledAt')[_0x3c35('0x3f')]('id',_0x3c35('0x3c'))['field'](LISTID[_0x3c35('0x42')](),_0x3c35('0x25'))[_0x3c35('0x3f')](_0x430695['id'][_0x3c35('0x42')](),_0x4c496a)[_0x3c35('0x3f')](_0x3c35('0x40'),_0x3c35('0x4b'))[_0x3c35('0x3f')](_0x3c35('0x40'),_0x3c35('0x3d'))[_0x3c35('0x43')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x3c35('0x45')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x3c35('0x4c'),squel['str'](hopperContacts))[_0x3c35('0x45')](_0x3c35('0x48')))[_0x3c35('0x42')]();return _0x49886c;}function _0x2a9082(_0x8d30db,_0x5453a2){var _0x2e17d2=squel[_0x3c35('0x37')]()[_0x3c35('0x38')](_0x3c35('0x50'))['fromQuery']([_0x3c35('0x3b'),_0x3c35('0x3c'),_0x3c35('0x25'),_0x5453a2,'createdAt','updatedAt'],squel[_0x3c35('0x3e')]()[_0x3c35('0x3f')](_0x3c35('0x3b'),'phone')[_0x3c35('0x3f')]('id',_0x3c35('0x3c'))['field'](LISTID[_0x3c35('0x42')](),_0x3c35('0x25'))[_0x3c35('0x3f')](_0x8d30db['id'][_0x3c35('0x42')](),_0x5453a2)['field'](_0x3c35('0x40'),_0x3c35('0x4b'))[_0x3c35('0x3f')](_0x3c35('0x40'),'updatedAt')[_0x3c35('0x43')]('cm_contacts')[_0x3c35('0x45')](_0x3c35('0x46'))['where']('ListId\x20=\x20?',LISTID[_0x3c35('0x42')]())[_0x3c35('0x45')](_0x3c35('0x4c'),squel[_0x3c35('0x4d')](hopperContacts))['where'](_0x3c35('0x48')))[_0x3c35('0x42')]();return _0x2e17d2;}return db[_0x3c35('0x51')][_0x3c35('0x52')]({'where':{'type':_0x3c35('0x53')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3c35('0x54')],'as':_0x3c35('0x55'),'where':{'id':LISTID}}]})[_0x3c35('0x2e')](function(_0x25b4b6){var _0x2a1712=[];if(_0x25b4b6){var _0x38a2d9;for(var _0x56612c=0x0,_0xa3ef5a;_0x56612c<_0x25b4b6[_0x3c35('0x27')];_0x56612c+=0x1){_0xa3ef5a=_0x25b4b6[_0x56612c]['get']({'plain':!![]});switch(_0xa3ef5a[_0x3c35('0x56')]){case _0x3c35('0x57'):_0x2a1712[_0x3c35('0x2f')](db[_0x3c35('0x58')]['query'](_0x406ec1(_0xa3ef5a,_0x3c35('0x59')))[_0x3c35('0x2e')](function(){})[_0x3c35('0x31')](_0x1a15a4()));break;case'onlyIfOpen':_0x2a1712[_0x3c35('0x2f')](db[_0x3c35('0x58')][_0x3c35('0x5a')](_0x1d07b3(_0xa3ef5a,_0x3c35('0x59')))[_0x3c35('0x2e')](function(){})[_0x3c35('0x31')](_0x1a15a4()));break;default:_0x2a1712[_0x3c35('0x2f')](db['sequelize'][_0x3c35('0x5a')](_0x1da345(_0xa3ef5a,_0x3c35('0x59')))[_0x3c35('0x2e')](function(){})['catch'](_0x1a15a4()));}}}return _0x2a1712;})[_0x3c35('0x5b')]()['then'](function(){return db[_0x3c35('0x51')]['findAll']({'where':{'type':_0x3c35('0x53')},'attributes':['id'],'include':[{'model':db[_0x3c35('0x54')],'as':_0x3c35('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2176fd){var _0x3bb0b1=[];if(_0x2176fd){var _0x133234;for(var _0x37f857=0x0,_0x31d897;_0x37f857<_0x2176fd[_0x3c35('0x27')];_0x37f857+=0x1){_0x31d897=_0x2176fd[_0x37f857][_0x3c35('0x5d')]({'plain':!![]});_0x3bb0b1[_0x3c35('0x2f')](db[_0x3c35('0x58')]['query'](_0x2a9082(_0x31d897,'VoiceQueueId'))[_0x3c35('0x2e')](function(){})[_0x3c35('0x31')](_0x1a15a4()));}}return _0x3bb0b1;})[_0x3c35('0x5b')]();})[_0x3c35('0x2e')](function(){return db[_0x3c35('0x5e')][_0x3c35('0x52')]({'attributes':['id',_0x3c35('0x56')],'include':[{'model':db[_0x3c35('0x54')],'as':'Lists','where':{'id':LISTID}}]})[_0x3c35('0x2e')](function(_0x4e0529){var _0x3238eb=[];if(_0x4e0529){for(var _0x47d44b=0x0,_0x382dc1;_0x47d44b<_0x4e0529[_0x3c35('0x27')];_0x47d44b+=0x1){_0x382dc1=_0x4e0529[_0x47d44b][_0x3c35('0x5d')]({'plain':!![]});switch(_0x382dc1[_0x3c35('0x56')]){case _0x3c35('0x57'):_0x3238eb[_0x3c35('0x2f')](db[_0x3c35('0x58')][_0x3c35('0x5a')](_0x406ec1(_0x382dc1,_0x3c35('0x5f')))[_0x3c35('0x2e')](function(){})['catch'](_0x1a15a4()));break;case _0x3c35('0x60'):_0x3238eb[_0x3c35('0x2f')](db[_0x3c35('0x58')][_0x3c35('0x5a')](_0x1d07b3(_0x382dc1,_0x3c35('0x5f')))[_0x3c35('0x2e')](function(){})[_0x3c35('0x31')](_0x1a15a4()));break;default:_0x3238eb[_0x3c35('0x2f')](db['sequelize'][_0x3c35('0x5a')](_0x1da345(_0x382dc1,_0x3c35('0x5f')))[_0x3c35('0x2e')](function(){})['catch'](_0x1a15a4()));}}}return _0x3238eb;})['all']();})[_0x3c35('0x2e')](function(){return db[_0x3c35('0x5e')][_0x3c35('0x52')]({'attributes':['id'],'include':[{'model':db[_0x3c35('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3c35('0x2e')](function(_0x546428){var _0x58292b=[];if(_0x546428){for(var _0x263167=0x0,_0x33ffdd;_0x263167<_0x546428[_0x3c35('0x27')];_0x263167+=0x1){_0x33ffdd=_0x546428[_0x263167]['get']({'plain':!![]});_0x58292b['push'](db['sequelize'][_0x3c35('0x5a')](_0x2a9082(_0x33ffdd,'CampaignId'))[_0x3c35('0x2e')](function(){})[_0x3c35('0x31')](_0x1a15a4()));}}return _0x58292b;})[_0x3c35('0x5b')]();})['catch'](function(_0x5e4107){logger[_0x3c35('0x16')](_0x3c35('0x61'),_0x3c35('0x62'),_0x5e4107['message']);});}var processPromises=function(_0x141d52){return BPromise[_0x3c35('0x5b')](promises)[_0x3c35('0x2e')](function(_0x3f1111){})[_0x3c35('0x31')](function(_0x3090e9){logger[_0x3c35('0x16')](_0x3c35('0x63'),JSON[_0x3c35('0x33')](_0x3090e9));})[_0x3c35('0x64')](function(){socket['emit'](_0x3c35('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x141d52){return _0x141d52['resume']();}});};var endCsv=function(){return BPromise[_0x3c35('0x66')]()[_0x3c35('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x3c35('0x2e')](function(){socket[_0x3c35('0x67')](_0x3c35('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3c35('0x68')](FILEPATH);}catch(_0x5374f7){logger[_0x3c35('0x16')](_0x3c35('0x69'),JSON[_0x3c35('0x33')](_0x5374f7));}finally{process[_0x3c35('0x6a')](0x0);}});};process['on'](_0x3c35('0x6b'),function(){logger[_0x3c35('0x6c')](_0x3c35('0x6d'));endCsv();});function main(){return BPromise[_0x3c35('0x66')]()[_0x3c35('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3c35('0x14')](',');return db['CmContact'][_0x3c35('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3c35('0x2e')](function(_0x2de1d2){var _0x42b0fb=fs[_0x3c35('0x6e')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3c35('0x6f')](_0x42b0fb,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255b88,_0x163e1d){total+=0x1;var _0x391ac1=total;promises[_0x3c35('0x2f')](checkRow(_0x255b88,_0x2de1d2,_0x391ac1)[_0x3c35('0x2e')](function(){success+=0x1;})[_0x3c35('0x31')](function(_0x15934f){if(_0x15934f[_0x3c35('0x16')]){errors+=0x1;delete _0x15934f[_0x3c35('0x16')];}else if(_0x15934f[_0x3c35('0x29')]){duplicates+=0x1;delete _0x15934f[_0x3c35('0x29')];}rows[_0x3c35('0x2f')](_0x15934f);}));if(total%0xc8===0x0){_0x163e1d[_0x3c35('0x70')]();return processPromises(_0x163e1d);}},'complete':function(){return processPromises()[_0x3c35('0x2e')](function(){logger[_0x3c35('0x6c')](_0x3c35('0x71'));endCsv();});},'error':function(_0xfc8eea,_0xc694da){logger[_0x3c35('0x6c')](_0x3c35('0x72'),JSON[_0x3c35('0x33')](_0xfc8eea));endCsv();}});})['catch'](function(_0x26fb4b){logger[_0x3c35('0x16')](_0x3c35('0x73'),JSON[_0x3c35('0x33')](_0x26fb4b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 773e319..d12e08d 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 _0xe978=['fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.phone','cm_hopper_black','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','recallme','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.id','ListId\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','info','Received\x20SIGINT','error','exit','errors','code','message','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','main','send','start','clone','.csv','includes','header','ContactItemType','findAll','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','isValid','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','format','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','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','argv','arguments\x20\x20\x20','root','server/files/tmp','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','CmContact','then','length','push','all','AdditionalPhones','isNil','filter','split','CmContactHasItem','update','updated','inserted','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0xe978,0x134));var _0x8e97=function(_0x173298,_0x43eb11){_0x173298=_0x173298-0x0;var _0x41ed39=_0xe978[_0x173298];return _0x41ed39;};'use strict';var fs=require('fs');var path=require(_0x8e97('0x0'));var _=require('lodash');var Papa=require(_0x8e97('0x1'));var util=require(_0x8e97('0x2'));var BPromise=require(_0x8e97('0x3'));var moment=require('moment');var squel=require(_0x8e97('0x4'));var Redis=require('ioredis');var db=require(_0x8e97('0x5'))['db'];var config=require(_0x8e97('0x6'));var shared=require(_0x8e97('0x7'));var logger=require(_0x8e97('0x8'))(_0x8e97('0x9'));config[_0x8e97('0xa')]=_['defaults'](config[_0x8e97('0xa')],{'host':_0x8e97('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e97('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x8e97('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x8e97('0xc'));function isEmail(_0x74a33){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))*$/[_0x8e97('0xd')](_0x74a33);}function selectNotIn(_0x397db6,_0x166bf7,_0x32c72f,_0xfecd92,_0x11544d){return squel[_0x8e97('0xe')]()[_0x8e97('0xf')](_0x8e97('0x10'))[_0x8e97('0x11')](_0xfecd92)[_0x8e97('0x12')](_0x166bf7,null,_0x166bf7+_0x8e97('0x13')+_0xfecd92+'.'+_0x32c72f)[_0x8e97('0x14')](_0xfecd92+'.'+_0x32c72f+_0x8e97('0x15')+_0x397db6+'.'+_0x32c72f)['where'](_0x166bf7+'.dialCheckDuplicateType\x20IN\x20('+_0x11544d[_0x8e97('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2fa1a9,_0x4e3d5d){promisesAdditionalPhones=[];return db[_0x8e97('0x16')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x8e97('0x17')](function(_0x1fef57){if(_0x1fef57!==null){var _0x1219ec=[];for(var _0x49863b=0x0;_0x49863b<_0x1fef57[_0x8e97('0x18')];_0x49863b++){var _0x5eb5fa=_0x1fef57[_0x49863b];_0x1219ec[_0x8e97('0x19')](insertAdditionalPhones(_0x5eb5fa));}}Promise[_0x8e97('0x1a')](_0x1219ec)[_0x8e97('0x17')](function(){_0x2fa1a9({'val':0x1});});});});}function insertAdditionalPhones(_0x316d49){return new Promise(function(_0x1d7664,_0x4a5fd9){var _0x4b5eb8=_0x316d49[_0x8e97('0x1b')];var _0x1fc606=_0x4b5eb8['split'](';');var _0x44b814=[];orderBy=0x0;for(var _0x1e8f6e=0x0;_0x1e8f6e<_0x1fc606['length'];_0x1e8f6e++){_0x44b814[_0x8e97('0x19')](splitAdditionalPhone(_0x316d49['id'],_0x1fc606[_0x1e8f6e]));}Promise[_0x8e97('0x1a')](_0x44b814)['then'](function(){_0x1d7664({'val':_0x1fc606[_0x8e97('0x18')]});});});}function splitAdditionalPhone(_0x3c24bd,_0x231e51){return new Promise(function(_0x1d7cd2,_0x455409){var _0x4131d5=_0x231e51['split'](':');var _0x11af36=_0x4131d5[0x0];var _0x263e2a=_0x4131d5[0x1];if(!_[_0x8e97('0x1c')](_0x263e2a)){var _0x58f5cd=_0x263e2a['split']('|');var _0x4fdff1=[];for(var _0x4312af=0x0;_0x4312af<_0x58f5cd[_0x8e97('0x18')];_0x4312af++){if(_0x58f5cd[_0x4312af]!==''){var _0x572fd6=_[_0x8e97('0x1d')](promisesAdditionalPhones,{'contactId':_0x3c24bd,'phone':_0x58f5cd[_0x4312af]});if(_0x572fd6[_0x8e97('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x8e97('0x19')]({'contactId':_0x3c24bd,'contactTypeId':_0x11af36,'phone':_0x58f5cd[_0x4312af],'orderBy':orderBy});}}}_0x1d7cd2({'ok':0x1});}else _0x1d7cd2({'res':0x0});});}function createAdditionalPhone(_0x552078,_0x103c1c,_0x551a58,_0x55046e){var _0x386275='';var _0x5701f2='';var _0x304927=_0x551a58[_0x8e97('0x1e')]('§');_0x386275=_0x304927[0x0];if(_0x304927[_0x8e97('0x18')]==0x2)_0x5701f2=_0x304927[0x1];return new Promise(function(_0x5a68c2,_0x5175b9){return db[_0x8e97('0x1f')]['findOne']({'where':{'CmContactId':_0x552078,'item':_0x386275}})['then'](function(_0x58787b){if(_0x58787b){return db['CmContactHasItem'][_0x8e97('0x20')]({'ItemTypeId':_0x103c1c,'description':_0x5701f2,'OrderBy':_0x55046e},{'where':{'CmContactId':_0x552078,'item':_0x386275}})[_0x8e97('0x17')](function(_0x5c1d25){_0x5a68c2({'res':_0x8e97('0x21')});});}else{return db[_0x8e97('0x1f')]['create']({'CmContactId':_0x552078,'item':_0x386275,'description':_0x5701f2,'ItemTypeId':_0x103c1c,'OrderBy':_0x55046e,'ItemClass':'PHONE'})[_0x8e97('0x17')](function(_0x5a7a85){_0x5a68c2({'res':_0x8e97('0x22')});});}});});}function insertCmHopper(_0x266612,_0x59a7b8,_0x2fd134,_0x1e83dd,_0x9e9e7){var _0x3dc47d=['cm_contacts.phone',_0x8e97('0x23'),'cm_contacts.id',_0x8e97('0x24'),_0x59a7b8+'.'+_0x1e83dd,_0x8e97('0x25'),_0x8e97('0x26'),_0x8e97('0x27'),_0x8e97('0x28'),'\x22'+_0x9e9e7+'\x22'];return squel[_0x8e97('0x29')]()[_0x8e97('0x2a')](_0x8e97('0x2b'))[_0x8e97('0x2c')]([_0x8e97('0x10'),_0x8e97('0x2d'),_0x8e97('0x2e'),_0x8e97('0x2f'),_0x1e83dd,_0x8e97('0x30'),_0x8e97('0x31'),_0x8e97('0x32'),_0x8e97('0x33'),'recallme'],squel['select']()[_0x8e97('0x34')](_0x3dc47d)['from'](_0x59a7b8)['join'](_0x8e97('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x59a7b8+_0x8e97('0x36'))['join'](_0x2fd134,null,_0x2fd134+_0x8e97('0x13')+_0x59a7b8+'.'+_0x1e83dd)[_0x8e97('0x14')](_0x59a7b8+_0x8e97('0x37'),_0x266612)[_0x8e97('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x59a7b8,_0x2fd134,_0x1e83dd,'cm_hopper',[_0x8e97('0x38'),_0x8e97('0x39')]))['where'](_0x8e97('0x3a'),selectNotIn(_0x59a7b8,_0x2fd134,_0x1e83dd,_0x8e97('0x2b'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x22b139,_0x2e1ac0,_0x2c5245,_0x1a32eb){var _0x2b1f32=[_0x8e97('0x3b'),'cm_contacts.id',_0x8e97('0x24'),_0x2e1ac0+'.'+_0x1a32eb,_0x8e97('0x25'),'cm_contacts.updatedAt'];return squel['insert']()[_0x8e97('0x2a')](_0x8e97('0x3c'))[_0x8e97('0x2c')]([_0x8e97('0x10'),_0x8e97('0x2e'),_0x8e97('0x2f'),_0x1a32eb,_0x8e97('0x30'),_0x8e97('0x31')],squel[_0x8e97('0xe')]()[_0x8e97('0x34')](_0x2b1f32)['from'](_0x2e1ac0)[_0x8e97('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x2e1ac0+_0x8e97('0x36'))['join'](_0x2c5245,null,_0x2c5245+_0x8e97('0x13')+_0x2e1ac0+'.'+_0x1a32eb)['where'](_0x2e1ac0+_0x8e97('0x37'),_0x22b139)[_0x8e97('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8e97('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8e97('0xe')]()['field'](_0x8e97('0x10'))[_0x8e97('0x11')](_0x8e97('0x3c'))[_0x8e97('0x14')]('ListId\x20=\x20?',_0x22b139)[_0x8e97('0x14')](_0x1a32eb+_0x8e97('0x15')+_0x2e1ac0+'.'+_0x1a32eb)))[_0x8e97('0x3d')]();}function insertTzCmHopper(_0x31957c,_0xff59e,_0x5a4661,_0xfc91e7,_0x2ab27b,_0x3c39e0){var _0x4a51f3=[_0x8e97('0x3b'),_0x8e97('0x3e')+_0x3c39e0+_0x8e97('0x3f'),'cm_contacts.id','cm_contacts.ListId',_0xff59e+'.'+_0xfc91e7,_0x8e97('0x25'),_0x8e97('0x26'),_0x8e97('0x27'),_0x8e97('0x28'),'\x22'+_0x2ab27b+'\x22'];var _0x423354=squel[_0x8e97('0x29')]()['into'](_0x8e97('0x2b'))['fromQuery'](['phone',_0x8e97('0x2d'),_0x8e97('0x2e'),_0x8e97('0x2f'),_0xfc91e7,'createdAt',_0x8e97('0x31'),_0x8e97('0x32'),_0x8e97('0x33'),_0x8e97('0x40')],squel[_0x8e97('0xe')]()[_0x8e97('0x34')](_0x4a51f3)[_0x8e97('0x11')](_0xff59e)[_0x8e97('0x12')](_0x8e97('0x35'),null,_0x8e97('0x41')+_0xff59e+_0x8e97('0x36'))[_0x8e97('0x12')](_0x5a4661,null,_0x5a4661+'.id\x20=\x20'+_0xff59e+'.'+_0xfc91e7)['join'](_0x3c39e0,null,_0x3c39e0+_0x8e97('0x13')+_0xff59e+'.'+_0xfc91e7)[_0x8e97('0x14')](_0xff59e+_0x8e97('0x37'),_0x31957c)['where'](_0x8e97('0x42'),NOW)['where'](_0x8e97('0x3a'),selectNotIn(_0xff59e,_0x5a4661,_0xfc91e7,_0x8e97('0x2b'),[_0x8e97('0x38'),'\x22onlyIfOpen\x22']))[_0x8e97('0x14')](_0x8e97('0x3a'),selectNotIn(_0xff59e,_0x5a4661,_0xfc91e7,_0x8e97('0x2b'),[_0x8e97('0x38')])))[_0x8e97('0x3d')]();return _0x423354;}function insertTzCmHopperBlack(_0x5a5026,_0x28ef30,_0x3a6b37,_0x45ce0e){var _0x313075=['cm_contacts.phone',_0x8e97('0x43'),_0x8e97('0x24'),_0x28ef30+'.'+_0x45ce0e,_0x8e97('0x25'),_0x8e97('0x26')];return squel[_0x8e97('0x29')]()[_0x8e97('0x2a')]('cm_hopper_black')[_0x8e97('0x2c')]([_0x8e97('0x10'),'ContactId',_0x8e97('0x2f'),_0x45ce0e,_0x8e97('0x30'),_0x8e97('0x31')],squel[_0x8e97('0xe')]()['fields'](_0x313075)[_0x8e97('0x11')](_0x28ef30)[_0x8e97('0x12')](_0x8e97('0x35'),null,_0x8e97('0x41')+_0x28ef30+_0x8e97('0x36'))[_0x8e97('0x12')](_0x3a6b37,null,_0x3a6b37+_0x8e97('0x13')+_0x28ef30+'.'+_0x45ce0e)[_0x8e97('0x14')](_0x28ef30+'.CmListId\x20=\x20?',_0x5a5026)[_0x8e97('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x8e97('0x3a'),squel['select']()['field'](_0x8e97('0x10'))[_0x8e97('0x11')](_0x8e97('0x3c'))[_0x8e97('0x14')](_0x8e97('0x44'),_0x5a5026)[_0x8e97('0x14')](_0x45ce0e+'\x20=\x20'+_0x28ef30+'.'+_0x45ce0e)))[_0x8e97('0x3d')]();}function insertCmHopperAdditionalPhones(_0x4eb7b4){var _0x182d39=['cm_hopper.id',_0x8e97('0x45'),'cm_contact_has_items.OrderBy',_0x8e97('0x46'),_0x8e97('0x47')];return squel['insert']()[_0x8e97('0x2a')](_0x8e97('0x48'))[_0x8e97('0x2c')]([_0x8e97('0x49'),'phone',_0x8e97('0x4a'),_0x8e97('0x30'),_0x8e97('0x31')],squel[_0x8e97('0xe')]()['fields'](_0x182d39)[_0x8e97('0x11')](_0x8e97('0x2b'))['join']('cm_contacts',null,_0x8e97('0x4b'))['join'](_0x8e97('0x4c'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x8e97('0x14')](_0x8e97('0x4d'),_0x4eb7b4)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x8e97('0x3d')]();}function insertCmContact(_0x152bc3,_0x452384,_0x4c165d,_0x5c7fe8){var _0x2c5d4e=_[_0x8e97('0x4e')](_[_0x8e97('0x4f')](_0x5c7fe8),[_0x8e97('0x2f'),_0x8e97('0x50'),_0x8e97('0x30'),_0x8e97('0x31'),_0x8e97('0x51')]);return squel[_0x8e97('0x29')]()[_0x8e97('0x2a')](_0x8e97('0x35'))[_0x8e97('0x2c')](_0x2c5d4e,squel[_0x8e97('0xe')]()[_0x8e97('0x34')](_0x2c5d4e)['from'](_0x452384)[_0x8e97('0x14')]('('+_0x4c165d['join'](',')+_0x8e97('0x52'),squel[_0x8e97('0xe')]()[_0x8e97('0x34')](_0x4c165d)[_0x8e97('0x11')](_0x8e97('0x35'))[_0x8e97('0x14')]('ListId\x20=\x20?',_0x152bc3)['where'](_0x8e97('0x53')))[_0x8e97('0x14')]('id\x20IN\x20?',squel[_0x8e97('0xe')]()['field'](_0x8e97('0x54'),_0x8e97('0x55'))[_0x8e97('0x11')](_0x452384)['group'](_0x4c165d[_0x8e97('0x12')](','))))[_0x8e97('0x3d')]();}function handleStop(){logger[_0x8e97('0x56')](_0x8e97('0x57'));stopped=!![];}function handleUncaughtException(_0x54c4ac){logger[_0x8e97('0x58')](_0x54c4ac['message']);process[_0x8e97('0x59')](0x1);}function handleError(_0x3a6fea,_0x22ae2a){stats[_0x8e97('0x5a')][_0x8e97('0x19')]({'name':_0x22ae2a[_0x8e97('0x5b')],'message':_0x22ae2a[_0x8e97('0x5c')],'row':_0x3a6fea});}function handleQuery(_0x8a108e){logger[_0x8e97('0x56')](_0x8a108e);return db['sequelize'][_0x8e97('0x5d')](_0x8a108e)[_0x8e97('0x5e')](function(_0x3e492f){results[_0x8e97('0x19')](_0x3e492f);})[_0x8e97('0x5f')](function(_0x57c38e){logger[_0x8e97('0x58')](_0x57c38e['message']);});}function updateTzCampaigns(_0x2586e4){return new Promise(function(_0x51b40b,_0x4e0c6f){var _0x2b9688=squel[_0x8e97('0xe')]()['fields']([_0x8e97('0x60'),_0x8e97('0x61')])[_0x8e97('0x11')](_0x8e97('0x62'))[_0x8e97('0x12')](_0x8e97('0x63'),null,_0x8e97('0x64'))[_0x8e97('0x14')](_0x8e97('0x65')+_0x2586e4);db[_0x8e97('0x66')][_0x8e97('0x5d')](_0x2b9688[_0x8e97('0x3d')]())[_0x8e97('0x5e')](function(_0xd8c9b8){var _0x239a8e=[];for(var _0x29e9cb=0x0;_0x29e9cb<_0xd8c9b8[_0x8e97('0x18')];_0x29e9cb++){_0x239a8e[_0x8e97('0x19')](getTimezoneData(_0xd8c9b8[_0x29e9cb],tmp_campaigns));}BPromise[_0x8e97('0x1a')](_0x239a8e)[_0x8e97('0x17')](function(){_0x51b40b({'val':0x1});});})[_0x8e97('0x5f')](function(_0x4e0005){logger['error'](_0x4e0005[_0x8e97('0x5c')]);_0x51b40b({'val':0x0});});});}function updateTzVoiceQueues(_0x1226cb){return new Promise(function(_0x3328e9,_0x14f56c){var _0x17a12f=squel[_0x8e97('0xe')]()[_0x8e97('0x34')]([_0x8e97('0x67'),_0x8e97('0x68')])['from'](_0x8e97('0x69'))[_0x8e97('0x12')](_0x8e97('0x6a'),null,_0x8e97('0x6b'))[_0x8e97('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x1226cb);db[_0x8e97('0x66')][_0x8e97('0x5d')](_0x17a12f[_0x8e97('0x3d')]())[_0x8e97('0x5e')](function(_0x4a0008){var _0x482991=[];for(var _0x2f7769=0x0;_0x2f7769<_0x4a0008[_0x8e97('0x18')];_0x2f7769++){_0x482991[_0x8e97('0x19')](getTimezoneData(_0x4a0008[_0x2f7769],tmp_voice_queues));}BPromise['all'](_0x482991)[_0x8e97('0x17')](function(){_0x3328e9({'val':0x1});});})[_0x8e97('0x5f')](function(_0x53228e){logger['error'](_0x53228e['message']);_0x3328e9({'val':0x0});});});}function getTimezoneData(_0x348a64,_0x456adb){return new Promise(function(_0x2232a4,_0x4a31cb){var _0x451aba=shared[_0x8e97('0x6c')];var _0x376121=_0x451aba[_0x348a64[_0x8e97('0x6d')]];if(_['isNil'](_0x376121)){_0x2232a4({'ret':0x1});}else{var _0x3bc169=_0x376121[_0x8e97('0x6e')];var _0x5dfc20=squel['insert']()['into'](_0x456adb)[_0x8e97('0x6f')]('id',_0x348a64['id'])[_0x8e97('0x6f')]('offset',_0x3bc169)['set'](_0x8e97('0x6d'),_0x348a64[_0x8e97('0x6d')])['toString']();return db[_0x8e97('0x66')][_0x8e97('0x5d')](_0x5dfc20)[_0x8e97('0x5e')](function(_0x203e21){_0x2232a4({'ret':0x1});})['catch'](function(_0x5ae3d5){logger['error'](_0x5ae3d5[_0x8e97('0x5c')]);_0x4a31cb({'ret':0x1});});}});}function handleTZQuery(_0x24d61d){logger[_0x8e97('0x56')](_0x24d61d);return db['sequelize']['query'](_0x24d61d)[_0x8e97('0x5e')](function(_0x3fbc0b){})[_0x8e97('0x5f')](function(_0x4a03e){logger[_0x8e97('0x58')](_0x4a03e[_0x8e97('0x5c')]);});}function main(_0x277598,_0x281dba,_0x27a84,_0x4bec42){logger[_0x8e97('0x56')](_0x8e97('0x70'),_0x277598,JSON['stringify'](_0x281dba));process[_0x8e97('0x71')](_0x8e97('0x72'));var _0x353063=_0x281dba['binding'];var _0x44355e=_[_0x8e97('0x73')](_0x353063);var _0x45ee2a=_0x281dba['socket_timestamp'];var _0x36485c=path['join'](config['root'],'server/files/tmp',_0x45ee2a+_0x8e97('0x74'));hasTZ=_[_0x8e97('0x4f')](_0x353063)[_0x8e97('0x75')](_0x8e97('0x6d'));var _0x137f5b=_[_0x8e97('0x4f')](_0x353063)['join']();logger[_0x8e97('0x56')](_0x8e97('0x76'),_0x137f5b);db[_0x8e97('0x77')][_0x8e97('0x78')]({'raw':!![],'attributes':['id',_0x8e97('0x79')]})[_0x8e97('0x17')](function(_0x26cb28){for(var _0x189f6e=0x0;_0x189f6e<_0x26cb28[_0x8e97('0x18')];_0x189f6e++){if(_0x26cb28[_0x189f6e][_0x8e97('0x79')]in _0x353063){contactItemTypes[_0x8e97('0x19')](_0x26cb28[_0x189f6e]);delete _0x44355e[_0x26cb28[_0x189f6e][_0x8e97('0x79')]];hasAdditionalPhones=!![];}for(var _0x49b1a3 in _0x353063){if(_0x26cb28[_0x189f6e][_0x8e97('0x79')]+_0x8e97('0x7a')===_0x49b1a3){phoneDescriptions[_0x8e97('0x19')]({'itemTypeId':_0x26cb28[_0x189f6e]['id'],'description':_0x49b1a3});delete _0x44355e[_0x49b1a3];}}}if(hasAdditionalPhones)_0x44355e[_0x8e97('0x1b')]='';var _0x12cbf4=_[_0x8e97('0x4f')](_0x44355e)[_0x8e97('0x12')]();logger['info'](_0x8e97('0x76'),_0x12cbf4);fs[_0x8e97('0x7b')](_0x36485c,_0x12cbf4+'\x0a');Papa[_0x8e97('0x7c')](fs[_0x8e97('0x7d')](_0x277598),{'header':!![],'skipEmptyLines':!![],'step':function(_0x439e54,_0xbdc0c7){try{for(var _0x46df75=0x0,_0x2a8a3f=[];_0x46df75<_0x439e54[_0x8e97('0x7e')]['length'];_0x46df75++){stats[_0x8e97('0x7f')]+=0x1;if(_0x439e54['errors'][_0x46df75]){handleError(_0x439e54[_0x8e97('0x7e')][_0x46df75],_0x439e54[_0x8e97('0x5a')][_0x46df75]);}else{var _0x4ecb96=[];var _0x202d3b=[];var _0x441084={};for(var _0x938eb in _0x353063){let _0x4041c6=contactItemTypes[_0x8e97('0x80')](_0x1c6e4b=>_0x1c6e4b[_0x8e97('0x79')]===_0x938eb);let _0x3d0669=contactItemTypes[_0x8e97('0x80')](_0x4e064b=>_0x4e064b[_0x8e97('0x79')]+_0x8e97('0x7a')===_0x938eb);if(_[_0x8e97('0x1c')](_0x4041c6)&&_[_0x8e97('0x1c')](_0x3d0669)){if(_0x353063[_0x8e97('0x81')](_0x938eb)){if(_0x439e54[_0x8e97('0x7e')][_0x46df75][_0x353063[_0x938eb]]){var _0x1b2bf5=_[_0x8e97('0x82')](_0x439e54[_0x8e97('0x7e')][_0x46df75][_0x353063[_0x938eb]]['replace'](/"/g,'\x27'));switch(_0x938eb){case _0x8e97('0x2d'):var _0x3b22b9=moment(_0x1b2bf5,_0x8e97('0xc'),!![]);if(_0x3b22b9['isValid']()){_0x2a8a3f[_0x8e97('0x19')]('\x22'+_0x1b2bf5+'\x22');}else{_0x4ecb96['push'](_0x8e97('0x83'));}break;case'priority':var _0x4cbca4=parseInt(_0x1b2bf5);_0x1b2bf5=_[_0x8e97('0x84')](_0x4cbca4)||_0x4cbca4<0x0||_0x4cbca4>0x4?_0x4bec42?0x3:0x2:_0x4cbca4;_0x2a8a3f[_0x8e97('0x19')]('\x22'+_0x1b2bf5+'\x22');break;case _0x8e97('0x33'):var _0x4eaa70=parseInt(_0x1b2bf5);if(_[_0x8e97('0x85')](_0x4eaa70)&&_[_0x8e97('0x75')](_0x27a84,_0x4eaa70)){_0x2a8a3f[_0x8e97('0x19')]('\x22'+_0x4eaa70+'\x22');}else{_0x4ecb96[_0x8e97('0x19')](_0x8e97('0x86'));}break;case _0x8e97('0x87'):if(isEmail(_0x1b2bf5)){_0x2a8a3f['push']('\x22'+_0x1b2bf5+'\x22');}else{_0x4ecb96[_0x8e97('0x19')](_0x8e97('0x88'));}break;case'dateOfBirth':var _0x423b31=moment(_0x1b2bf5,'YYYY-MM-DD',!![]);if(_0x423b31[_0x8e97('0x89')]()){_0x2a8a3f[_0x8e97('0x19')]('\x22'+_0x1b2bf5+'\x22');}else{_0x4ecb96[_0x8e97('0x19')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x8e97('0x6d'):var _0x208192=shared['timezones'];var _0x22b47d=_0x208192[_0x1b2bf5];if(!_[_0x8e97('0x1c')](_0x22b47d)){var _0x263085=_0x22b47d[_0x8e97('0x6e')];_0x2a8a3f[_0x8e97('0x19')]('\x22'+_0x1b2bf5+'\x22');_0x2a8a3f[_0x8e97('0x19')]('\x22'+_0x263085+'\x22');}break;default:_0x2a8a3f[_0x8e97('0x19')]('\x22'+_0x1b2bf5+'\x22');}}else{switch(_0x938eb){case'firstName':case _0x8e97('0x10'):_0x4ecb96[_0x8e97('0x19')](_0x938eb+_0x8e97('0x8a'));break;default:_0x2a8a3f[_0x8e97('0x19')]('\x22\x22');}}}}else{var _0x2585f7='';if(!_[_0x8e97('0x1c')](_0x4041c6)){if(!_0x441084[_0x8e97('0x81')](_0x4041c6['id'])){if(!_[_0x8e97('0x1c')](_0x439e54[_0x8e97('0x7e')][_0x46df75][_0x353063[_0x938eb]])){var _0x1b2bf5=_['trim'](_0x439e54[_0x8e97('0x7e')][_0x46df75][_0x353063[_0x938eb]][_0x8e97('0x8b')](/"/g,'\x27'));var _0x32cca8=phoneDescriptions['find'](_0x5929d2=>_0x5929d2[_0x8e97('0x8c')]===_0x4041c6['id']);if(!_[_0x8e97('0x1c')](_0x32cca8)){var _0x502cbe=_[_0x8e97('0x82')](_0x439e54[_0x8e97('0x7e')][_0x46df75][_0x353063[_0x32cca8[_0x8e97('0x8d')]]][_0x8e97('0x8b')](/"/g,'\x27'));if(!_[_0x8e97('0x1c')](_0x502cbe))_0x1b2bf5=_0x1b2bf5+'§'+_0x502cbe;}if(_0x2585f7=='')_0x2585f7=_0x1b2bf5;else _0x2585f7+='|'+_0x1b2bf5;}_0x202d3b['push'](_0x4041c6['id']+':'+_0x2585f7);_0x441084[_0x4041c6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2a8a3f['push']('\x22'+_0x202d3b[_0x8e97('0x12')](';')+'\x22');}if(_0x4ecb96[_0x8e97('0x18')]){handleError(_0x439e54[_0x8e97('0x7e')][_0x46df75],{'code':_0x8e97('0x8e'),'message':_0x4ecb96[_0x8e97('0x12')]()});}else{fs[_0x8e97('0x8f')](_0x36485c,_0x2a8a3f[_0x8e97('0x12')]()+'\x0a');}_0x2a8a3f=[];}if(!(stats[_0x8e97('0x7f')]%0xc8)){socket[_0x8e97('0x90')](_0x8e97('0x91')+_0x45ee2a,stats);stats[_0x8e97('0x5a')]=[];}}if(stopped){logger[_0x8e97('0x56')]('Abort\x20parser');_0xbdc0c7[_0x8e97('0x92')]();}}catch(_0x44011a){handleError(_0x439e54[_0x8e97('0x7e')][_0x46df75],{'code':'SystemError','message':_0x44011a[_0x8e97('0x5c')]});logger[_0x8e97('0x58')](_0x8e97('0x93'),_0x44011a[_0x8e97('0x5c')]);}},'complete':function(){try{var _0x198335=[];var _0x172e1a=[];var _0x4dbdbd=_0x8e97('0x35');if(_0x281dba[_0x8e97('0x94')]&&_0x281dba[_0x8e97('0x94')][_0x8e97('0x18')]){_0x4dbdbd=_0x8e97('0x95')+_0x45ee2a;_0x198335[_0x8e97('0x19')](_0x8e97('0x96')+_0x4dbdbd+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x45ee2a;tmp_voice_queues=_0x8e97('0x97')+_0x45ee2a;_0x172e1a[_0x8e97('0x19')](_0x8e97('0x96')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x172e1a[_0x8e97('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x8e97('0x98'));BPromise[_0x8e97('0x99')](_0x172e1a,handleTZQuery)[_0x8e97('0x17')](function(_0x33b77f){updateTzCampaigns(_0x281dba[_0x8e97('0x2f')])[_0x8e97('0x17')](function(_0x1dca5e){updateTzVoiceQueues(_0x281dba['ListId'])[_0x8e97('0x17')](function(_0x301aa6){if(hasTZ)_0x12cbf4=_0x12cbf4[_0x8e97('0x8b')](_0x8e97('0x6d'),_0x8e97('0x9a'));var _0x30d4e2=util[_0x8e97('0x9b')](_0x8e97('0x9c'),_0x36485c,_0x4dbdbd,_0x12cbf4,_0x281dba['ListId'],_0x281dba['CompanyId']||null,NOW,NOW);if(_[_0x8e97('0x1c')](_0x353063[_0x8e97('0x2d')])){_0x30d4e2+=_0x8e97('0x9d');}_0x198335[_0x8e97('0x19')](_0x30d4e2);if(_0x281dba[_0x8e97('0x94')]&&_0x281dba[_0x8e97('0x94')][_0x8e97('0x18')]){_0x198335['push'](insertCmContact(_0x281dba['ListId'],_0x4dbdbd,_0x281dba[_0x8e97('0x94')],_0x353063));_0x198335[_0x8e97('0x19')](_0x8e97('0x9e')+_0x4dbdbd+';');}BPromise[_0x8e97('0x99')](_0x198335,handleQuery)[_0x8e97('0x17')](function(_0x5f40fb){BPromise[_0x8e97('0x1a')]([handleAdditionalPhones()])[_0x8e97('0x17')](function(){_0x198335=[];for(var _0x5e1c04=0x0;_0x5e1c04\x20\x20','root','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','update','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','fields','cm_contacts','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','toString','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','insert','priority','UserId','cm_hopper_black','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','message','exit','errors','code','info','sequelize','query','spread','catch','error','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0xb8a9,0xf4));var _0x9b8a=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xb8a9[_0x4017b0];return _0x5ed4f7;};'use strict';var fs=require('fs');var path=require(_0x9b8a('0x0'));var _=require('lodash');var Papa=require(_0x9b8a('0x1'));var util=require('util');var BPromise=require(_0x9b8a('0x2'));var moment=require(_0x9b8a('0x3'));var squel=require(_0x9b8a('0x4'));var Redis=require(_0x9b8a('0x5'));var db=require(_0x9b8a('0x6'))['db'];var config=require(_0x9b8a('0x7'));var shared=require(_0x9b8a('0x8'));var logger=require(_0x9b8a('0x9'))('import');config[_0x9b8a('0xa')]=_[_0x9b8a('0xb')](config['redis'],{'host':_0x9b8a('0xc'),'port':0x18eb});var socket=require(_0x9b8a('0xd'))(new Redis(config[_0x9b8a('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x9b8a('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x9b8a('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x55eaf9){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))*$/[_0x9b8a('0x10')](_0x55eaf9);}function selectNotIn(_0x166048,_0x4867d4,_0x200fa7,_0x3b88a0,_0x10a452){return squel[_0x9b8a('0x11')]()['field'](_0x9b8a('0x12'))[_0x9b8a('0x13')](_0x3b88a0)[_0x9b8a('0x14')](_0x4867d4,null,_0x4867d4+_0x9b8a('0x15')+_0x3b88a0+'.'+_0x200fa7)['where'](_0x3b88a0+'.'+_0x200fa7+_0x9b8a('0x16')+_0x166048+'.'+_0x200fa7)[_0x9b8a('0x17')](_0x4867d4+_0x9b8a('0x18')+_0x10a452[_0x9b8a('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5308e0,_0x3d9e66){promisesAdditionalPhones=[];return db['CmContact'][_0x9b8a('0x19')]({'raw':!![],'attributes':['id',_0x9b8a('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x9b8a('0x1b')](function(_0x2e98d5){if(_0x2e98d5!==null){var _0x20278d=[];for(var _0x342607=0x0;_0x342607<_0x2e98d5[_0x9b8a('0x1c')];_0x342607++){var _0x1be32f=_0x2e98d5[_0x342607];_0x20278d[_0x9b8a('0x1d')](insertAdditionalPhones(_0x1be32f));}}Promise[_0x9b8a('0x1e')](_0x20278d)[_0x9b8a('0x1b')](function(){_0x5308e0({'val':0x1});});});});}function insertAdditionalPhones(_0x5274cc){return new Promise(function(_0x202250,_0x2e4987){var _0x38f710=_0x5274cc[_0x9b8a('0x1a')];var _0x2b5ff0=_0x38f710[_0x9b8a('0x1f')](';');var _0x379932=[];orderBy=0x0;for(var _0x433c0a=0x0;_0x433c0a<_0x2b5ff0[_0x9b8a('0x1c')];_0x433c0a++){_0x379932[_0x9b8a('0x1d')](splitAdditionalPhone(_0x5274cc['id'],_0x2b5ff0[_0x433c0a]));}Promise[_0x9b8a('0x1e')](_0x379932)[_0x9b8a('0x1b')](function(){_0x202250({'val':_0x2b5ff0['length']});});});}function splitAdditionalPhone(_0x42d8cb,_0x4c9c55){return new Promise(function(_0x30fadf,_0x207004){var _0x3f7780=_0x4c9c55[_0x9b8a('0x1f')](':');var _0x327729=_0x3f7780[0x0];var _0x42c6e1=_0x3f7780[0x1];if(!_[_0x9b8a('0x20')](_0x42c6e1)){var _0xfa66c5=_0x42c6e1[_0x9b8a('0x1f')]('|');var _0x21d89d=[];for(var _0xaf1fc2=0x0;_0xaf1fc2<_0xfa66c5['length'];_0xaf1fc2++){if(_0xfa66c5[_0xaf1fc2]!==''){var _0x44b97f=_[_0x9b8a('0x21')](promisesAdditionalPhones,{'contactId':_0x42d8cb,'phone':_0xfa66c5[_0xaf1fc2]});if(_0x44b97f[_0x9b8a('0x1c')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x42d8cb,'contactTypeId':_0x327729,'phone':_0xfa66c5[_0xaf1fc2],'orderBy':orderBy});}}}_0x30fadf({'ok':0x1});}else _0x30fadf({'res':0x0});});}function createAdditionalPhone(_0x35bd21,_0x1e0d24,_0x1d6da8,_0x40595f){var _0xf3042f='';var _0x3505fe='';var _0x430c7c=_0x1d6da8[_0x9b8a('0x1f')]('§');_0xf3042f=_0x430c7c[0x0];if(_0x430c7c[_0x9b8a('0x1c')]==0x2)_0x3505fe=_0x430c7c[0x1];return new Promise(function(_0x278281,_0x1204c8){return db[_0x9b8a('0x22')]['findOne']({'where':{'CmContactId':_0x35bd21,'item':_0xf3042f}})[_0x9b8a('0x1b')](function(_0x123366){if(_0x123366){return db['CmContactHasItem'][_0x9b8a('0x23')]({'ItemTypeId':_0x1e0d24,'description':_0x3505fe,'OrderBy':_0x40595f},{'where':{'CmContactId':_0x35bd21,'item':_0xf3042f}})[_0x9b8a('0x1b')](function(_0x40e67b){_0x278281({'res':'updated'});});}else{return db[_0x9b8a('0x22')]['create']({'CmContactId':_0x35bd21,'item':_0xf3042f,'description':_0x3505fe,'ItemTypeId':_0x1e0d24,'OrderBy':_0x40595f,'ItemClass':_0x9b8a('0x24')})[_0x9b8a('0x1b')](function(_0x16816b){_0x278281({'res':'inserted'});});}});});}function insertCmHopper(_0x2ba734,_0x559b37,_0x4138f6,_0x4fe4e2,_0x3f4803){var _0x2755bf=[_0x9b8a('0x25'),_0x9b8a('0x26'),_0x9b8a('0x27'),'cm_contacts.ListId',_0x559b37+'.'+_0x4fe4e2,'cm_contacts.createdAt',_0x9b8a('0x28'),_0x9b8a('0x29'),_0x9b8a('0x2a'),'\x22'+_0x3f4803+'\x22'];return squel['insert']()[_0x9b8a('0x2b')]('cm_hopper')[_0x9b8a('0x2c')]([_0x9b8a('0x12'),_0x9b8a('0x2d'),_0x9b8a('0x2e'),_0x9b8a('0x2f'),_0x4fe4e2,_0x9b8a('0x30'),_0x9b8a('0x31'),'priority','UserId','recallme'],squel[_0x9b8a('0x11')]()[_0x9b8a('0x32')](_0x2755bf)['from'](_0x559b37)['join'](_0x9b8a('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x559b37+'.CmListId')[_0x9b8a('0x14')](_0x4138f6,null,_0x4138f6+'.id\x20=\x20'+_0x559b37+'.'+_0x4fe4e2)[_0x9b8a('0x17')](_0x559b37+_0x9b8a('0x34'),_0x2ba734)[_0x9b8a('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9b8a('0x17')](_0x9b8a('0x35'),selectNotIn(_0x559b37,_0x4138f6,_0x4fe4e2,'cm_hopper',[_0x9b8a('0x36'),_0x9b8a('0x37')]))[_0x9b8a('0x17')](_0x9b8a('0x35'),selectNotIn(_0x559b37,_0x4138f6,_0x4fe4e2,_0x9b8a('0x38'),[_0x9b8a('0x36')])))[_0x9b8a('0x39')]();}function insertCmHopperBlack(_0x29fb0c,_0x582c54,_0x574b07,_0x1e3a51){var _0x2549d2=[_0x9b8a('0x25'),'cm_contacts.id',_0x9b8a('0x3a'),_0x582c54+'.'+_0x1e3a51,_0x9b8a('0x3b'),_0x9b8a('0x28')];return squel['insert']()[_0x9b8a('0x2b')]('cm_hopper_black')[_0x9b8a('0x2c')]([_0x9b8a('0x12'),_0x9b8a('0x2e'),'ListId',_0x1e3a51,_0x9b8a('0x30'),_0x9b8a('0x31')],squel['select']()[_0x9b8a('0x32')](_0x2549d2)[_0x9b8a('0x13')](_0x582c54)[_0x9b8a('0x14')](_0x9b8a('0x33'),null,_0x9b8a('0x3c')+_0x582c54+_0x9b8a('0x3d'))[_0x9b8a('0x14')](_0x574b07,null,_0x574b07+_0x9b8a('0x15')+_0x582c54+'.'+_0x1e3a51)[_0x9b8a('0x17')](_0x582c54+_0x9b8a('0x34'),_0x29fb0c)['where'](_0x9b8a('0x3e'),NOW)[_0x9b8a('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x9b8a('0x3f')](_0x9b8a('0x12'))[_0x9b8a('0x13')]('cm_hopper_black')[_0x9b8a('0x17')](_0x9b8a('0x40'),_0x29fb0c)['where'](_0x1e3a51+_0x9b8a('0x16')+_0x582c54+'.'+_0x1e3a51)))['toString']();}function insertTzCmHopper(_0x145d5c,_0x22f49a,_0x110042,_0x18a923,_0x4092b5,_0x1a340d){var _0x41c9b7=[_0x9b8a('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x1a340d+'.offset-cm_contacts.utcOffset\x20minute)',_0x9b8a('0x27'),_0x9b8a('0x3a'),_0x22f49a+'.'+_0x18a923,_0x9b8a('0x3b'),_0x9b8a('0x28'),'cm_contacts.priority',_0x9b8a('0x2a'),'\x22'+_0x4092b5+'\x22'];var _0x193fae=squel[_0x9b8a('0x41')]()[_0x9b8a('0x2b')](_0x9b8a('0x38'))[_0x9b8a('0x2c')]([_0x9b8a('0x12'),_0x9b8a('0x2d'),_0x9b8a('0x2e'),'ListId',_0x18a923,'createdAt',_0x9b8a('0x31'),_0x9b8a('0x42'),_0x9b8a('0x43'),'recallme'],squel[_0x9b8a('0x11')]()[_0x9b8a('0x32')](_0x41c9b7)[_0x9b8a('0x13')](_0x22f49a)[_0x9b8a('0x14')](_0x9b8a('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x22f49a+_0x9b8a('0x3d'))['join'](_0x110042,null,_0x110042+_0x9b8a('0x15')+_0x22f49a+'.'+_0x18a923)[_0x9b8a('0x14')](_0x1a340d,null,_0x1a340d+_0x9b8a('0x15')+_0x22f49a+'.'+_0x18a923)[_0x9b8a('0x17')](_0x22f49a+_0x9b8a('0x34'),_0x145d5c)['where'](_0x9b8a('0x3e'),NOW)[_0x9b8a('0x17')](_0x9b8a('0x35'),selectNotIn(_0x22f49a,_0x110042,_0x18a923,_0x9b8a('0x38'),[_0x9b8a('0x36'),_0x9b8a('0x37')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x22f49a,_0x110042,_0x18a923,'cm_hopper',['\x22always\x22'])))[_0x9b8a('0x39')]();return _0x193fae;}function insertTzCmHopperBlack(_0x577243,_0xcfa9ee,_0x2d25b3,_0x204969){var _0x569334=[_0x9b8a('0x25'),_0x9b8a('0x27'),_0x9b8a('0x3a'),_0xcfa9ee+'.'+_0x204969,_0x9b8a('0x3b'),_0x9b8a('0x28')];return squel[_0x9b8a('0x41')]()[_0x9b8a('0x2b')](_0x9b8a('0x44'))['fromQuery']([_0x9b8a('0x12'),_0x9b8a('0x2e'),_0x9b8a('0x2f'),_0x204969,_0x9b8a('0x30'),'updatedAt'],squel[_0x9b8a('0x11')]()[_0x9b8a('0x32')](_0x569334)['from'](_0xcfa9ee)['join']('cm_contacts',null,_0x9b8a('0x3c')+_0xcfa9ee+'.CmListId')[_0x9b8a('0x14')](_0x2d25b3,null,_0x2d25b3+_0x9b8a('0x15')+_0xcfa9ee+'.'+_0x204969)[_0x9b8a('0x17')](_0xcfa9ee+_0x9b8a('0x34'),_0x577243)[_0x9b8a('0x17')](_0x9b8a('0x3e'),NOW)[_0x9b8a('0x17')](_0x9b8a('0x35'),squel[_0x9b8a('0x11')]()[_0x9b8a('0x3f')](_0x9b8a('0x12'))['from']('cm_hopper_black')['where']('ListId\x20=\x20?',_0x577243)[_0x9b8a('0x17')](_0x204969+_0x9b8a('0x16')+_0xcfa9ee+'.'+_0x204969)))['toString']();}function insertCmHopperAdditionalPhones(_0x1a21b0){var _0x1787e7=['cm_hopper.id',_0x9b8a('0x45'),_0x9b8a('0x46'),_0x9b8a('0x47'),'cm_contact_has_items.updatedAt'];return squel['insert']()['into'](_0x9b8a('0x48'))['fromQuery']([_0x9b8a('0x49'),'phone',_0x9b8a('0x4a'),_0x9b8a('0x30'),_0x9b8a('0x31')],squel[_0x9b8a('0x11')]()[_0x9b8a('0x32')](_0x1787e7)[_0x9b8a('0x13')](_0x9b8a('0x38'))[_0x9b8a('0x14')](_0x9b8a('0x33'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x9b8a('0x14')](_0x9b8a('0x4b'),null,_0x9b8a('0x4c'))[_0x9b8a('0x17')](_0x9b8a('0x4d'),_0x1a21b0)[_0x9b8a('0x17')](_0x9b8a('0x3e'),NOW))[_0x9b8a('0x39')]();}function insertCmContact(_0x138778,_0x28eb37,_0x2cb37b,_0xc81f16){var _0x5ca46a=_['concat'](_[_0x9b8a('0x4e')](_0xc81f16),[_0x9b8a('0x2f'),_0x9b8a('0x4f'),_0x9b8a('0x30'),_0x9b8a('0x31'),_0x9b8a('0x50')]);return squel['insert']()['into'](_0x9b8a('0x33'))['fromQuery'](_0x5ca46a,squel[_0x9b8a('0x11')]()[_0x9b8a('0x32')](_0x5ca46a)['from'](_0x28eb37)[_0x9b8a('0x17')]('('+_0x2cb37b[_0x9b8a('0x14')](',')+_0x9b8a('0x51'),squel[_0x9b8a('0x11')]()[_0x9b8a('0x32')](_0x2cb37b)[_0x9b8a('0x13')](_0x9b8a('0x33'))[_0x9b8a('0x17')]('ListId\x20=\x20?',_0x138778)[_0x9b8a('0x17')](_0x9b8a('0x52')))['where'](_0x9b8a('0x53'),squel[_0x9b8a('0x11')]()['field'](_0x9b8a('0x54'),_0x9b8a('0x55'))['from'](_0x28eb37)[_0x9b8a('0x56')](_0x2cb37b['join'](','))))[_0x9b8a('0x39')]();}function handleStop(){logger['info'](_0x9b8a('0x57'));stopped=!![];}function handleUncaughtException(_0x1fbdbe){logger['error'](_0x1fbdbe[_0x9b8a('0x58')]);process[_0x9b8a('0x59')](0x1);}function handleError(_0x74b8a4,_0x3a7d38){stats[_0x9b8a('0x5a')][_0x9b8a('0x1d')]({'name':_0x3a7d38[_0x9b8a('0x5b')],'message':_0x3a7d38['message'],'row':_0x74b8a4});}function handleQuery(_0x390508){logger[_0x9b8a('0x5c')](_0x390508);return db[_0x9b8a('0x5d')][_0x9b8a('0x5e')](_0x390508)[_0x9b8a('0x5f')](function(_0x58cffd){results['push'](_0x58cffd);})[_0x9b8a('0x60')](function(_0xbdb867){logger[_0x9b8a('0x61')](_0xbdb867[_0x9b8a('0x58')]);});}function updateTzCampaigns(_0x1f50c5){return new Promise(function(_0x57e07b,_0x4f0826){var _0x178f12=squel[_0x9b8a('0x11')]()[_0x9b8a('0x32')](['campaigns.id',_0x9b8a('0x62')])[_0x9b8a('0x13')](_0x9b8a('0x63'))[_0x9b8a('0x14')](_0x9b8a('0x64'),null,_0x9b8a('0x65'))[_0x9b8a('0x17')]('campaigns_has_cm_lists.CmListId='+_0x1f50c5);db[_0x9b8a('0x5d')][_0x9b8a('0x5e')](_0x178f12['toString']())['spread'](function(_0x42e9c9){var _0x2bfb52=[];for(var _0x56fdf2=0x0;_0x56fdf2<_0x42e9c9['length'];_0x56fdf2++){_0x2bfb52[_0x9b8a('0x1d')](getTimezoneData(_0x42e9c9[_0x56fdf2],tmp_campaigns));}BPromise['all'](_0x2bfb52)['then'](function(){_0x57e07b({'val':0x1});});})[_0x9b8a('0x60')](function(_0x264661){logger[_0x9b8a('0x61')](_0x264661[_0x9b8a('0x58')]);_0x57e07b({'val':0x0});});});}function updateTzVoiceQueues(_0x26821){return new Promise(function(_0x24308f,_0x5a1584){var _0x18b767=squel[_0x9b8a('0x11')]()[_0x9b8a('0x32')]([_0x9b8a('0x66'),_0x9b8a('0x67')])[_0x9b8a('0x13')]('voice_queues')[_0x9b8a('0x14')](_0x9b8a('0x68'),null,_0x9b8a('0x69'))[_0x9b8a('0x17')]('voice_queues_has_cm_lists.CmListId='+_0x26821);db[_0x9b8a('0x5d')][_0x9b8a('0x5e')](_0x18b767[_0x9b8a('0x39')]())[_0x9b8a('0x5f')](function(_0x156cdf){var _0x4ffa48=[];for(var _0x1f9af4=0x0;_0x1f9af4<_0x156cdf['length'];_0x1f9af4++){_0x4ffa48[_0x9b8a('0x1d')](getTimezoneData(_0x156cdf[_0x1f9af4],tmp_voice_queues));}BPromise[_0x9b8a('0x1e')](_0x4ffa48)['then'](function(){_0x24308f({'val':0x1});});})[_0x9b8a('0x60')](function(_0x584ce3){logger[_0x9b8a('0x61')](_0x584ce3[_0x9b8a('0x58')]);_0x24308f({'val':0x0});});});}function getTimezoneData(_0x48e6cc,_0x4b6488){return new Promise(function(_0x3b2c96,_0x4d43ff){var _0x237883=shared[_0x9b8a('0x6a')];var _0x58634f=_0x237883[_0x48e6cc[_0x9b8a('0x6b')]];if(_[_0x9b8a('0x20')](_0x58634f)){_0x3b2c96({'ret':0x1});}else{var _0xbc109=_0x58634f['utcOffset'];var _0x19b3ea=squel[_0x9b8a('0x41')]()[_0x9b8a('0x2b')](_0x4b6488)['set']('id',_0x48e6cc['id'])['set'](_0x9b8a('0x6c'),_0xbc109)[_0x9b8a('0x6d')](_0x9b8a('0x6b'),_0x48e6cc[_0x9b8a('0x6b')])[_0x9b8a('0x39')]();return db[_0x9b8a('0x5d')][_0x9b8a('0x5e')](_0x19b3ea)['spread'](function(_0x4d021c){_0x3b2c96({'ret':0x1});})['catch'](function(_0x1b7ee8){logger[_0x9b8a('0x61')](_0x1b7ee8[_0x9b8a('0x58')]);_0x4d43ff({'ret':0x1});});}});}function handleTZQuery(_0x4d54a4){logger[_0x9b8a('0x5c')](_0x4d54a4);return db[_0x9b8a('0x5d')][_0x9b8a('0x5e')](_0x4d54a4)[_0x9b8a('0x5f')](function(_0x1fe767){})[_0x9b8a('0x60')](function(_0x5b5230){logger['error'](_0x5b5230[_0x9b8a('0x58')]);});}function main(_0x34aee0,_0x35e265,_0x177429,_0x4857a1){logger[_0x9b8a('0x5c')]('main',_0x34aee0,JSON[_0x9b8a('0x6e')](_0x35e265));process['send']('start');var _0x214715=_0x35e265[_0x9b8a('0x6f')];var _0x12bb0e=_[_0x9b8a('0x70')](_0x214715);var _0x50db0b=_0x35e265['socket_timestamp'];var _0x4780c4=path[_0x9b8a('0x14')](config['root'],'server/files/tmp',_0x50db0b+_0x9b8a('0x71'));hasTZ=_[_0x9b8a('0x4e')](_0x214715)[_0x9b8a('0x72')]('dialTimezone');var _0x41519d=_['keys'](_0x214715)[_0x9b8a('0x14')]();logger[_0x9b8a('0x5c')](_0x9b8a('0x73'),_0x41519d);db[_0x9b8a('0x74')][_0x9b8a('0x19')]({'raw':!![],'attributes':['id',_0x9b8a('0x75')]})[_0x9b8a('0x1b')](function(_0x2e6d59){for(var _0x5407ad=0x0;_0x5407ad<_0x2e6d59[_0x9b8a('0x1c')];_0x5407ad++){if(_0x2e6d59[_0x5407ad][_0x9b8a('0x75')]in _0x214715){contactItemTypes[_0x9b8a('0x1d')](_0x2e6d59[_0x5407ad]);delete _0x12bb0e[_0x2e6d59[_0x5407ad][_0x9b8a('0x75')]];hasAdditionalPhones=!![];}for(var _0x3f4c3c in _0x214715){if(_0x2e6d59[_0x5407ad][_0x9b8a('0x75')]+'_description'===_0x3f4c3c){phoneDescriptions[_0x9b8a('0x1d')]({'itemTypeId':_0x2e6d59[_0x5407ad]['id'],'description':_0x3f4c3c});delete _0x12bb0e[_0x3f4c3c];}}}if(hasAdditionalPhones)_0x12bb0e[_0x9b8a('0x1a')]='';var _0x4d6883=_[_0x9b8a('0x4e')](_0x12bb0e)[_0x9b8a('0x14')]();logger[_0x9b8a('0x5c')](_0x9b8a('0x73'),_0x4d6883);fs[_0x9b8a('0x76')](_0x4780c4,_0x4d6883+'\x0a');Papa['parse'](fs[_0x9b8a('0x77')](_0x34aee0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e5962,_0x38d1d6){try{for(var _0x5dc7a9=0x0,_0x15f8b4=[];_0x5dc7a9<_0x1e5962[_0x9b8a('0x78')][_0x9b8a('0x1c')];_0x5dc7a9++){stats['rows']+=0x1;if(_0x1e5962[_0x9b8a('0x5a')][_0x5dc7a9]){handleError(_0x1e5962[_0x9b8a('0x78')][_0x5dc7a9],_0x1e5962[_0x9b8a('0x5a')][_0x5dc7a9]);}else{var _0x18606a=[];var _0x2be4d6=[];var _0x22ad00={};for(var _0x32aa3c in _0x214715){let _0x74f511=contactItemTypes['find'](_0x368e2a=>_0x368e2a[_0x9b8a('0x75')]===_0x32aa3c);let _0x2a3756=contactItemTypes[_0x9b8a('0x79')](_0x410a48=>_0x410a48['name']+_0x9b8a('0x7a')===_0x32aa3c);if(_[_0x9b8a('0x20')](_0x74f511)&&_['isNil'](_0x2a3756)){if(_0x214715[_0x9b8a('0x7b')](_0x32aa3c)){if(_0x1e5962[_0x9b8a('0x78')][_0x5dc7a9][_0x214715[_0x32aa3c]]){var _0x2e6c27=_[_0x9b8a('0x7c')](_0x1e5962['data'][_0x5dc7a9][_0x214715[_0x32aa3c]][_0x9b8a('0x7d')](/"/g,'\x27'));switch(_0x32aa3c){case'scheduledat':var _0x57848e=moment(_0x2e6c27,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x57848e[_0x9b8a('0x7e')]()){_0x15f8b4[_0x9b8a('0x1d')]('\x22'+_0x2e6c27+'\x22');}else{_0x18606a[_0x9b8a('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x476069=parseInt(_0x2e6c27);_0x2e6c27=_[_0x9b8a('0x7f')](_0x476069)||_0x476069<0x0||_0x476069>0x4?_0x4857a1?0x3:0x2:_0x476069;_0x15f8b4[_0x9b8a('0x1d')]('\x22'+_0x2e6c27+'\x22');break;case'UserId':var _0x5a4209=parseInt(_0x2e6c27);if(_['isNumber'](_0x5a4209)&&_[_0x9b8a('0x72')](_0x177429,_0x5a4209)){_0x15f8b4[_0x9b8a('0x1d')]('\x22'+_0x5a4209+'\x22');}else{_0x18606a['push'](_0x9b8a('0x80'));}break;case'email':if(isEmail(_0x2e6c27)){_0x15f8b4[_0x9b8a('0x1d')]('\x22'+_0x2e6c27+'\x22');}else{_0x18606a['push']('email\x20wrong\x20format');}break;case _0x9b8a('0x81'):var _0xc9167b=moment(_0x2e6c27,_0x9b8a('0x82'),!![]);if(_0xc9167b['isValid']()){_0x15f8b4['push']('\x22'+_0x2e6c27+'\x22');}else{_0x18606a[_0x9b8a('0x1d')](_0x9b8a('0x83'));}break;case _0x9b8a('0x6b'):var _0x51abfc=shared[_0x9b8a('0x6a')];var _0x593f91=_0x51abfc[_0x2e6c27];if(!_[_0x9b8a('0x20')](_0x593f91)){var _0x12d5e3=_0x593f91['utcOffset'];_0x15f8b4[_0x9b8a('0x1d')]('\x22'+_0x2e6c27+'\x22');_0x15f8b4[_0x9b8a('0x1d')]('\x22'+_0x12d5e3+'\x22');}break;default:_0x15f8b4['push']('\x22'+_0x2e6c27+'\x22');}}else{switch(_0x32aa3c){case _0x9b8a('0x84'):case'phone':_0x18606a[_0x9b8a('0x1d')](_0x32aa3c+_0x9b8a('0x85'));break;default:_0x15f8b4[_0x9b8a('0x1d')]('\x22\x22');}}}}else{var _0x305944='';if(!_[_0x9b8a('0x20')](_0x74f511)){if(!_0x22ad00['hasOwnProperty'](_0x74f511['id'])){if(!_[_0x9b8a('0x20')](_0x1e5962[_0x9b8a('0x78')][_0x5dc7a9][_0x214715[_0x32aa3c]])){var _0x2e6c27=_[_0x9b8a('0x7c')](_0x1e5962[_0x9b8a('0x78')][_0x5dc7a9][_0x214715[_0x32aa3c]]['replace'](/"/g,'\x27'));var _0x4894ae=phoneDescriptions[_0x9b8a('0x79')](_0x2489c9=>_0x2489c9['itemTypeId']===_0x74f511['id']);if(!_['isNil'](_0x4894ae)){var _0x8a6294=_[_0x9b8a('0x7c')](_0x1e5962['data'][_0x5dc7a9][_0x214715[_0x4894ae[_0x9b8a('0x86')]]]['replace'](/"/g,'\x27'));if(!_[_0x9b8a('0x20')](_0x8a6294))_0x2e6c27=_0x2e6c27+'§'+_0x8a6294;}if(_0x305944=='')_0x305944=_0x2e6c27;else _0x305944+='|'+_0x2e6c27;}_0x2be4d6[_0x9b8a('0x1d')](_0x74f511['id']+':'+_0x305944);_0x22ad00[_0x74f511['id']]=0x1;}}}}if(hasAdditionalPhones){_0x15f8b4[_0x9b8a('0x1d')]('\x22'+_0x2be4d6[_0x9b8a('0x14')](';')+'\x22');}if(_0x18606a[_0x9b8a('0x1c')]){handleError(_0x1e5962[_0x9b8a('0x78')][_0x5dc7a9],{'code':_0x9b8a('0x87'),'message':_0x18606a[_0x9b8a('0x14')]()});}else{fs[_0x9b8a('0x88')](_0x4780c4,_0x15f8b4[_0x9b8a('0x14')]()+'\x0a');}_0x15f8b4=[];}if(!(stats[_0x9b8a('0x89')]%0xc8)){socket[_0x9b8a('0x8a')](_0x9b8a('0x8b')+_0x50db0b,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x9b8a('0x8c'));_0x38d1d6[_0x9b8a('0x8d')]();}}catch(_0xdcb1f2){handleError(_0x1e5962[_0x9b8a('0x78')][_0x5dc7a9],{'code':_0x9b8a('0x8e'),'message':_0xdcb1f2[_0x9b8a('0x58')]});logger['error']('step',_0xdcb1f2[_0x9b8a('0x58')]);}},'complete':function(){try{var _0x2e21af=[];var _0x55d331=[];var _0x5ad4ba='cm_contacts';if(_0x35e265[_0x9b8a('0x8f')]&&_0x35e265['duplicates'][_0x9b8a('0x1c')]){_0x5ad4ba='cm_contacts_'+_0x50db0b;_0x2e21af[_0x9b8a('0x1d')](_0x9b8a('0x90')+_0x5ad4ba+_0x9b8a('0x91'));}tmp_campaigns='campaigns_'+_0x50db0b;tmp_voice_queues=_0x9b8a('0x92')+_0x50db0b;_0x55d331[_0x9b8a('0x1d')](_0x9b8a('0x90')+tmp_campaigns+_0x9b8a('0x93'));_0x55d331[_0x9b8a('0x1d')](_0x9b8a('0x90')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x9b8a('0x94')](_0x55d331,handleTZQuery)[_0x9b8a('0x1b')](function(_0xfe0d3b){updateTzCampaigns(_0x35e265[_0x9b8a('0x2f')])[_0x9b8a('0x1b')](function(_0x51b444){updateTzVoiceQueues(_0x35e265[_0x9b8a('0x2f')])[_0x9b8a('0x1b')](function(_0x30e869){if(hasTZ)_0x4d6883=_0x4d6883[_0x9b8a('0x7d')](_0x9b8a('0x6b'),_0x9b8a('0x95'));var _0x47abf=util[_0x9b8a('0xf')](_0x9b8a('0x96'),_0x4780c4,_0x5ad4ba,_0x4d6883,_0x35e265[_0x9b8a('0x2f')],_0x35e265[_0x9b8a('0x4f')]||null,NOW,NOW);if(_[_0x9b8a('0x20')](_0x214715[_0x9b8a('0x2d')])){_0x47abf+=',\x20scheduledAt\x20=\x20NOW()';}_0x2e21af[_0x9b8a('0x1d')](_0x47abf);if(_0x35e265[_0x9b8a('0x8f')]&&_0x35e265[_0x9b8a('0x8f')][_0x9b8a('0x1c')]){_0x2e21af[_0x9b8a('0x1d')](insertCmContact(_0x35e265[_0x9b8a('0x2f')],_0x5ad4ba,_0x35e265[_0x9b8a('0x8f')],_0x214715));_0x2e21af[_0x9b8a('0x1d')](_0x9b8a('0x97')+_0x5ad4ba+';');}BPromise[_0x9b8a('0x94')](_0x2e21af,handleQuery)[_0x9b8a('0x1b')](function(_0x381336){BPromise['all']([handleAdditionalPhones()])[_0x9b8a('0x1b')](function(){_0x2e21af=[];for(var _0x127d29=0x0;_0x127d29_0x59e1f0[_0xa0cf('0x6a')]===_0x45980);let _0x462f07=contactItemTypes[_0xa0cf('0x73')](_0x2fb8e2=>_0x2fb8e2['name']+_0xa0cf('0x6b')===_0x45980);if(_[_0xa0cf('0x1e')](_0x3d2fb6)&&_[_0xa0cf('0x1e')](_0x462f07)){if(_0x3454bb[_0xa0cf('0x74')](_0x45980)){if(_0x2ef41b[_0xa0cf('0x70')][_0xc4da93][_0x3454bb[_0x45980]]){var _0x29a0f4=_[_0xa0cf('0x75')](_0x2ef41b[_0xa0cf('0x70')][_0xc4da93][_0x3454bb[_0x45980]][_0xa0cf('0x76')](/"/g,'\x27'));switch(_0x45980){case _0xa0cf('0x37'):var _0x34e1e0=moment(_0x29a0f4,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x34e1e0[_0xa0cf('0x77')]()){_0x1a7820['push']('\x22'+_0x29a0f4+'\x22');}else{_0x30eafa[_0xa0cf('0x1f')](_0xa0cf('0x78'));}break;case _0xa0cf('0x3c'):var _0x57ac25=parseInt(_0x29a0f4);_0x29a0f4=_[_0xa0cf('0x79')](_0x57ac25)||_0x57ac25<0x0||_0x57ac25>0x4?_0x1c0425?0x3:0x2:_0x57ac25;_0x1a7820['push']('\x22'+_0x29a0f4+'\x22');break;case _0xa0cf('0x3d'):var _0x2b1187=parseInt(_0x29a0f4);if(_[_0xa0cf('0x7a')](_0x2b1187)&&_[_0xa0cf('0x7b')](_0x2bad37,_0x2b1187)){_0x1a7820[_0xa0cf('0x1f')]('\x22'+_0x2b1187+'\x22');}else{_0x30eafa[_0xa0cf('0x1f')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x29a0f4)){_0x1a7820[_0xa0cf('0x1f')]('\x22'+_0x29a0f4+'\x22');}else{_0x30eafa['push'](_0xa0cf('0x7c'));}break;case _0xa0cf('0x7d'):var _0x2b6031=moment(_0x29a0f4,'YYYY-MM-DD',!![]);if(_0x2b6031[_0xa0cf('0x77')]()){_0x1a7820['push']('\x22'+_0x29a0f4+'\x22');}else{_0x30eafa[_0xa0cf('0x1f')](_0xa0cf('0x7e'));}break;default:_0x1a7820[_0xa0cf('0x1f')]('\x22'+_0x29a0f4+'\x22');}}else{switch(_0x45980){case _0xa0cf('0x7f'):case _0xa0cf('0x14'):_0x30eafa[_0xa0cf('0x1f')](_0x45980+_0xa0cf('0x80'));break;default:_0x1a7820[_0xa0cf('0x1f')]('\x22\x22');}}}}else{var _0x109438='';if(!_[_0xa0cf('0x1e')](_0x3d2fb6)){if(!_0x4f5ac8[_0xa0cf('0x74')](_0x3d2fb6['id'])){for(var _0x27a7d7=0x0;_0x27a7d7<_0x3454bb[_0x45980][_0xa0cf('0x26')];_0x27a7d7++){var _0x29a0f4=_['trim'](_0x2ef41b[_0xa0cf('0x70')][_0xc4da93][_0x3454bb[_0x45980][_0x27a7d7]][_0xa0cf('0x76')](/"/g,'\x27'));var _0x23117a=phoneDescriptions['find'](_0x311684=>_0x311684['itemTypeId']===_0x3d2fb6['id']);if(!_[_0xa0cf('0x1e')](_0x23117a)){var _0x559ce8=_[_0xa0cf('0x75')](_0x2ef41b[_0xa0cf('0x70')][_0xc4da93][_0x3454bb[_0x23117a[_0xa0cf('0x81')]][0x0]][_0xa0cf('0x76')](/"/g,'\x27'));if(!_[_0xa0cf('0x1e')](_0x559ce8))_0x29a0f4=_0x29a0f4+'§'+_0x559ce8;}if(_0x109438=='')_0x109438=_0x29a0f4;else _0x109438+='|'+_0x29a0f4;}_0x14f429['push'](_0x3d2fb6['id']+':'+_0x109438);_0x4f5ac8[_0x3d2fb6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1a7820[_0xa0cf('0x1f')]('\x22'+_0x14f429[_0xa0cf('0x16')](';')+'\x22');}if(_0x30eafa[_0xa0cf('0x26')]){handleError(_0x2ef41b[_0xa0cf('0x70')][_0xc4da93],{'code':'SystemRow','message':_0x30eafa[_0xa0cf('0x16')]()});}else{fs[_0xa0cf('0x82')](_0x518ea0,_0x1a7820['join']()+'\x0a');}_0x1a7820=[];}if(!(stats['rows']%0xc8)){socket[_0xa0cf('0x83')](_0xa0cf('0x84')+_0x267b7c,stats);stats[_0xa0cf('0x72')]=[];}}if(stopped){logger[_0xa0cf('0x5b')](_0xa0cf('0x85'));_0x6a6a8d[_0xa0cf('0x86')]();}}catch(_0x8cbd4f){handleError(_0x2ef41b[_0xa0cf('0x70')][_0xc4da93],{'code':_0xa0cf('0x87'),'message':_0x8cbd4f[_0xa0cf('0x24')]});logger['error'](_0xa0cf('0x88'),_0x8cbd4f[_0xa0cf('0x24')]);}},'complete':function(){try{var _0x3bc607=[];var _0x345c78=tempTableName;_0x3bc607[_0xa0cf('0x1f')](_0xa0cf('0x89')+_0x345c78+'\x20LIKE\x20cm_contacts;');logger['info'](_0xa0cf('0x8a'),contactItemTypes[_0xa0cf('0x26')]);var _0x4bb51e=util[_0xa0cf('0xe')](_0xa0cf('0x8b'),_0x518ea0,_0x345c78,_0x2023be,_0xf6a1ea[_0xa0cf('0x39')],_0xf6a1ea[_0xa0cf('0x57')]||null,NOW,NOW);if(_[_0xa0cf('0x1e')](_0x3454bb[_0xa0cf('0x37')])){_0x4bb51e+=_0xa0cf('0x8c');}_0x3bc607[_0xa0cf('0x1f')](_0x4bb51e);BPromise['each'](_0x3bc607,handleQuery)[_0xa0cf('0x21')](function(_0x16ba8d){BPromise[_0xa0cf('0x20')]([handleAdditionalPhones()])['then'](function(){_0x3bc607=[];for(var _0x11e590=0x0;_0x11e590\x20\x20');}var _0x3a4db1=path['join'](config[_0xa0cf('0x66')],_0xa0cf('0x96'),process[_0xa0cf('0x95')][0x2]);if(!fs['existsSync'](_0x3a4db1)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x53b73c={};try{_0x53b73c=JSON[_0xa0cf('0x6e')](process[_0xa0cf('0x95')][0x3]);if(!_0x53b73c[_0xa0cf('0x63')]){throw new Error(_0xa0cf('0x97'));}var _0x42da20=0x0;if(_0x53b73c[_0xa0cf('0x63')][_0xa0cf('0x3d')]){_0x42da20=0x1;}if(!_0x53b73c[_0xa0cf('0x39')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x39db8b){throw new Error('body\x20id\x20mandatory');}var _0x379d3b=[];try{_0x379d3b=_[_0xa0cf('0x98')](JSON['parse'](process[_0xa0cf('0x95')][0x4]),'id');}catch(_0x2ea0b5){logger[_0xa0cf('0x5b')](_0xa0cf('0x99'));}main(_0x3a4db1,_0x53b73c,_0x379d3b,_0x42da20);}validate();process['on'](_0xa0cf('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xce2f=['CmHopperId','OrderBy','createdAt','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?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','code','info','query','main','send','binding','clone','socket_timestamp','root','server/files/tmp','body','ContactItemType','findAll','name','_description','header','parse','createReadStream','data','rows','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','trim','description','appendFileSync','contact:import:','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','split','filter','CmContactHasItem','findOne','update','updated','create','CmContact','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','insert','into','cm_hopper','fromQuery','scheduledat','ListId','updatedAt','priority','UserId','recallme','from','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_hopper_black','ContactId','fields','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt'];(function(_0x302439,_0x51989b){var _0x19a15d=function(_0x4d2b67){while(--_0x4d2b67){_0x302439['push'](_0x302439['shift']());}};_0x19a15d(++_0x51989b);}(_0xce2f,0x18a));var _0xfce2=function(_0x2822a8,_0x33f05a){_0x2822a8=_0x2822a8-0x0;var _0x103c80=_0xce2f[_0x2822a8];return _0x103c80;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xfce2('0x0'));var Papa=require(_0xfce2('0x1'));var util=require(_0xfce2('0x2'));var BPromise=require(_0xfce2('0x3'));var moment=require(_0xfce2('0x4'));var squel=require(_0xfce2('0x5'));var Redis=require('ioredis');var db=require(_0xfce2('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xfce2('0x7'))('import');config[_0xfce2('0x8')]=_[_0xfce2('0x9')](config[_0xfce2('0x8')],{'host':_0xfce2('0xa'),'port':0x18eb});var socket=require(_0xfce2('0xb'))(new Redis(config[_0xfce2('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xfce2('0xc')](_0xfce2('0xd'));var tempTableName='cm_contacts_temp_'+moment()['format'](_0xfce2('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x512cc4){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))*$/[_0xfce2('0xf')](_0x512cc4);}function selectNotIn(_0x4b2866,_0x441666,_0x511899,_0x27d7cb,_0xd76e83){return squel[_0xfce2('0x10')]()['field'](_0xfce2('0x11'))['from'](_0x27d7cb)[_0xfce2('0x12')](_0x441666,null,_0x441666+_0xfce2('0x13')+_0x27d7cb+'.'+_0x511899)[_0xfce2('0x14')](_0x27d7cb+'.'+_0x511899+_0xfce2('0x15')+_0x4b2866+'.'+_0x511899)[_0xfce2('0x14')](_0x441666+_0xfce2('0x16')+_0xd76e83[_0xfce2('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4fdcc2,_0x408eee){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfce2('0x17')]['query'](_0xfce2('0x18')+tempTableName)[_0xfce2('0x19')](function(_0x5781fe){if(_0x5781fe!==null){var _0x49ead9=[];for(var _0x3dfa24=0x0;_0x3dfa24<_0x5781fe[_0xfce2('0x1a')];_0x3dfa24++){var _0x59abfd=_0x5781fe[_0x3dfa24];if(!_[_0xfce2('0x1b')](_0x59abfd[_0xfce2('0x11')])){if(!_[_0xfce2('0x1b')](_0x59abfd[_0xfce2('0x1c')]))_0x49ead9[_0xfce2('0x1d')](insertAdditionalPhones(_0x59abfd));promisesContact[_0xfce2('0x1d')]({'contact':_0x59abfd});}}}Promise[_0xfce2('0x1e')](_0x49ead9)[_0xfce2('0x1f')](function(){_0x4fdcc2({'val':0x1});});})[_0xfce2('0x20')](function(_0x1f3b1d){logger['error'](_0x1f3b1d['message']);});});}function insertAdditionalPhones(_0x3c4f1f){return new Promise(function(_0x3ea07b,_0x312c10){var _0x24a13e=_0x3c4f1f[_0xfce2('0x1c')];if(_[_0xfce2('0x1b')](_0x24a13e))_0x312c10({'val':0x0});else{var _0x1d4795=_0x24a13e[_0xfce2('0x21')](';');var _0x4c239b=[];orderBy=0x0;for(var _0x4088c7=0x0;_0x4088c7<_0x1d4795[_0xfce2('0x1a')];_0x4088c7++){_0x4c239b[_0xfce2('0x1d')](splitAdditionalPhone(_0x3c4f1f['id'],_0x1d4795[_0x4088c7]));}Promise['all'](_0x4c239b)['then'](function(){_0x3ea07b({'val':_0x1d4795[_0xfce2('0x1a')]});});}});}function splitAdditionalPhone(_0x208903,_0x29df3a){return new Promise(function(_0x1cebb2,_0x57d743){var _0x416f14=_0x29df3a[_0xfce2('0x21')](':');var _0x992b0f=_0x416f14[0x0];var _0x47ed7f=_0x416f14[0x1];if(_0x47ed7f!==''){var _0x20af10=_0x47ed7f[_0xfce2('0x21')]('|');var _0x25cf46=[];for(var _0x4c63ea=0x0;_0x4c63ea<_0x20af10[_0xfce2('0x1a')];_0x4c63ea++){if(_0x20af10[_0x4c63ea]!==''){var _0x2358dc=_[_0xfce2('0x22')](promisesAdditionalPhones,{'contactId':_0x208903,'phone':_0x20af10[_0x4c63ea]});if(_0x2358dc[_0xfce2('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x208903,'contactTypeId':_0x992b0f,'phone':_0x20af10[_0x4c63ea],'orderBy':orderBy});}}}_0x1cebb2({'ok':0x1});}else _0x1cebb2({'res':0x0});});}function createAdditionalPhone(_0x6c8a47,_0xef1b38,_0x58022e,_0x31649e){var _0x440144='';var _0x3f8909='';var _0x1f48ba=_0x58022e['split']('§');_0x440144=_0x1f48ba[0x0];if(_0x1f48ba[_0xfce2('0x1a')]==0x2)_0x3f8909=_0x1f48ba[0x1];return new Promise(function(_0x4f3dd2,_0x1b211c){return db[_0xfce2('0x23')][_0xfce2('0x24')]({'where':{'CmContactId':_0x6c8a47,'item':_0x440144}})[_0xfce2('0x1f')](function(_0x1882cd){if(_0x1882cd){return db[_0xfce2('0x23')][_0xfce2('0x25')]({'ItemTypeId':_0xef1b38,'description':_0x3f8909,'OrderBy':_0x31649e},{'where':{'CmContactId':_0x6c8a47,'item':_0x440144}})[_0xfce2('0x1f')](function(_0x4831de){_0x4f3dd2({'res':_0xfce2('0x26')});});}else{return db[_0xfce2('0x23')][_0xfce2('0x27')]({'CmContactId':_0x6c8a47,'item':_0x440144,'ItemTypeId':_0xef1b38,'description':_0x3f8909,'OrderBy':_0x31649e,'ItemClass':'PHONE'})[_0xfce2('0x1f')](function(_0x4c08d3){_0x4f3dd2({'res':'inserted'});});}});});}function updateContact(_0x42b3d0){return new Promise(function(_0x4fd253,_0x1d17de){var _0x155d84=_0x42b3d0['id'];delete _0x42b3d0['id'];return db[_0xfce2('0x28')][_0xfce2('0x25')](_0x42b3d0,{'where':{'id':_0x155d84}})['then'](function(_0x5cf091){updatedRows+=0x1;return db['CmHopper'][_0xfce2('0x25')]({'phone':_0x42b3d0[_0xfce2('0x11')]},{'where':{'ContactId':_0x155d84}})[_0xfce2('0x1f')](function(_0x3c7305){_0x4fd253({'ret':'OK'});});});});}function insertCmHopper(_0x1272e3,_0x511509,_0x4afa63,_0x241072,_0xe0206e){var _0x226d7c=['cm_contacts.phone',_0xfce2('0x29'),'cm_contacts.id',_0xfce2('0x2a'),_0x511509+'.'+_0x241072,_0xfce2('0x2b'),_0xfce2('0x2c'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0xe0206e+'\x22'];return squel[_0xfce2('0x2d')]()[_0xfce2('0x2e')](_0xfce2('0x2f'))[_0xfce2('0x30')](['phone',_0xfce2('0x31'),'ContactId',_0xfce2('0x32'),_0x241072,'createdAt',_0xfce2('0x33'),_0xfce2('0x34'),_0xfce2('0x35'),_0xfce2('0x36')],squel[_0xfce2('0x10')]()['fields'](_0x226d7c)[_0xfce2('0x37')](_0x511509)[_0xfce2('0x12')]('cm_contacts',null,_0xfce2('0x38')+_0x511509+_0xfce2('0x39'))[_0xfce2('0x12')](_0x4afa63,null,_0x4afa63+_0xfce2('0x13')+_0x511509+'.'+_0x241072)[_0xfce2('0x14')](_0x511509+'.CmListId\x20=\x20?',_0x1272e3)[_0xfce2('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfce2('0x14')](_0xfce2('0x3a'),selectNotIn(_0x511509,_0x4afa63,_0x241072,_0xfce2('0x2f'),[_0xfce2('0x3b'),_0xfce2('0x3c')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x511509,_0x4afa63,_0x241072,_0xfce2('0x2f'),[_0xfce2('0x3b')])))[_0xfce2('0x3d')]();}function insertCmHopperBlack(_0x534a80,_0x574d5e,_0x490647,_0x3fcd0e){var _0x187ee6=['cm_contacts.phone',_0xfce2('0x3e'),_0xfce2('0x2a'),_0x574d5e+'.'+_0x3fcd0e,'cm_contacts.createdAt',_0xfce2('0x2c')];return squel[_0xfce2('0x2d')]()['into'](_0xfce2('0x3f'))[_0xfce2('0x30')]([_0xfce2('0x11'),_0xfce2('0x40'),_0xfce2('0x32'),_0x3fcd0e,'createdAt','updatedAt'],squel[_0xfce2('0x10')]()[_0xfce2('0x41')](_0x187ee6)['from'](_0x574d5e)['join'](_0xfce2('0x42'),null,_0xfce2('0x38')+_0x574d5e+_0xfce2('0x39'))[_0xfce2('0x12')](_0x490647,null,_0x490647+'.id\x20=\x20'+_0x574d5e+'.'+_0x3fcd0e)[_0xfce2('0x14')](_0x574d5e+_0xfce2('0x43'),_0x534a80)['where'](_0xfce2('0x44'),NOW)['where'](_0xfce2('0x3a'),squel[_0xfce2('0x10')]()[_0xfce2('0x45')](_0xfce2('0x11'))[_0xfce2('0x37')]('cm_hopper_black')[_0xfce2('0x14')](_0xfce2('0x46'),_0x534a80)[_0xfce2('0x14')](_0x3fcd0e+'\x20=\x20?',_0x574d5e+'.'+_0x3fcd0e)))[_0xfce2('0x3d')]();}function insertCmHopperAdditionalPhones(_0x2c2610){var _0x530da3=[_0xfce2('0x47'),_0xfce2('0x48'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0xfce2('0x49')];return squel[_0xfce2('0x2d')]()[_0xfce2('0x2e')]('cm_hopper_additional_phones')[_0xfce2('0x30')]([_0xfce2('0x4a'),'phone',_0xfce2('0x4b'),_0xfce2('0x4c'),_0xfce2('0x33')],squel[_0xfce2('0x10')]()[_0xfce2('0x41')](_0x530da3)[_0xfce2('0x37')]('cm_hopper')[_0xfce2('0x12')](_0xfce2('0x42'),null,_0xfce2('0x4d'))[_0xfce2('0x12')](_0xfce2('0x4e'),null,_0xfce2('0x4f'))[_0xfce2('0x14')](_0xfce2('0x50'),_0x2c2610)[_0xfce2('0x14')](_0xfce2('0x44'),NOW))[_0xfce2('0x3d')]();}function insertCmContact(_0x4f8a2f,_0x239f1c,_0x751a6c,_0x4e9e9a){var _0x5adf6c=_[_0xfce2('0x51')](_[_0xfce2('0x52')](_0x4e9e9a),['ListId',_0xfce2('0x53'),_0xfce2('0x4c'),'updatedAt']);return squel[_0xfce2('0x2d')]()[_0xfce2('0x2e')](_0xfce2('0x42'))[_0xfce2('0x30')](_0x5adf6c,squel[_0xfce2('0x10')]()[_0xfce2('0x41')](_0x5adf6c)[_0xfce2('0x37')](_0x239f1c)['where']('('+_0x751a6c[_0xfce2('0x12')](',')+_0xfce2('0x54'),squel[_0xfce2('0x10')]()[_0xfce2('0x41')](_0x751a6c)['from'](_0xfce2('0x42'))[_0xfce2('0x14')](_0xfce2('0x46'),_0x4f8a2f))['where'](_0xfce2('0x55'),squel['select']()[_0xfce2('0x45')](_0xfce2('0x56'),_0xfce2('0x57'))['from'](_0x239f1c)[_0xfce2('0x58')](_0x751a6c[_0xfce2('0x12')](','))))[_0xfce2('0x3d')]();}function handleStop(){logger['info'](_0xfce2('0x59'));stopped=!![];}function handleUncaughtException(_0xc9c252){logger[_0xfce2('0x5a')](_0xc9c252[_0xfce2('0x5b')]);process[_0xfce2('0x5c')](0x1);}function handleError(_0x31c872,_0x500ab9){stats[_0xfce2('0x5d')][_0xfce2('0x1d')]({'name':_0x500ab9[_0xfce2('0x5e')],'message':_0x500ab9['message'],'row':_0x31c872});}function handleQuery(_0xee726b){logger[_0xfce2('0x5f')](_0xee726b);return db[_0xfce2('0x17')][_0xfce2('0x60')](_0xee726b)[_0xfce2('0x19')](function(_0x27ca29){results[_0xfce2('0x1d')](_0x27ca29);})[_0xfce2('0x20')](function(_0x1c591c){logger[_0xfce2('0x5a')](_0x1c591c[_0xfce2('0x5b')]);});}function main(_0x2a8691,_0x381031,_0xcaf8c2,_0x38b432){logger[_0xfce2('0x5f')](_0xfce2('0x61'),_0x2a8691,JSON['stringify'](_0x381031));process[_0xfce2('0x62')]('start');var _0x4e2898=_0x381031[_0xfce2('0x63')];var _0x36e422=_[_0xfce2('0x64')](_0x4e2898);var _0x3a9c77=_0x381031[_0xfce2('0x65')];var _0x1ce729=path['join'](config[_0xfce2('0x66')],_0xfce2('0x67'),_0x3a9c77+'.csv');logger[_0xfce2('0x5f')](_0xfce2('0x68'),_0x381031);db[_0xfce2('0x69')][_0xfce2('0x6a')]({'raw':!![],'attributes':['id',_0xfce2('0x6b')]})['then'](function(_0x1b790e){for(var _0x5567f7=0x0;_0x5567f7<_0x1b790e['length'];_0x5567f7++){if(_0x1b790e[_0x5567f7]['name']in _0x4e2898){contactItemTypes[_0xfce2('0x1d')](_0x1b790e[_0x5567f7]);delete _0x36e422[_0x1b790e[_0x5567f7]['name']];hasAdditionalPhones=!![];}for(var _0xc408d5 in _0x4e2898){if(_0x1b790e[_0x5567f7][_0xfce2('0x6b')]+_0xfce2('0x6c')===_0xc408d5){phoneDescriptions[_0xfce2('0x1d')]({'itemTypeId':_0x1b790e[_0x5567f7]['id'],'description':_0xc408d5});delete _0x36e422[_0xc408d5];}}}if(hasAdditionalPhones)_0x36e422['AdditionalPhones']='';var _0x5c6112=_[_0xfce2('0x52')](_0x36e422)[_0xfce2('0x12')]();logger['info'](_0xfce2('0x6d'),_0x5c6112);fs['writeFileSync'](_0x1ce729,_0x5c6112+'\x0a');Papa[_0xfce2('0x6e')](fs[_0xfce2('0x6f')](_0x2a8691),{'header':!![],'skipEmptyLines':!![],'step':function(_0x52605b,_0x457ca4){try{for(var _0xf55475=0x0,_0x2960c8=[];_0xf55475<_0x52605b[_0xfce2('0x70')][_0xfce2('0x1a')];_0xf55475++){stats[_0xfce2('0x71')]+=0x1;if(_0x52605b[_0xfce2('0x5d')][_0xf55475]){handleError(_0x52605b[_0xfce2('0x70')][_0xf55475],_0x52605b[_0xfce2('0x5d')][_0xf55475]);}else{var _0x5abd7b=[];var _0x3a966a=[];var _0x11aafc={};for(var _0xe46417 in _0x4e2898){let _0x50f73e=contactItemTypes[_0xfce2('0x72')](_0x2d109b=>_0x2d109b[_0xfce2('0x6b')]===_0xe46417);let _0xba10cd=contactItemTypes[_0xfce2('0x72')](_0xcefdef=>_0xcefdef[_0xfce2('0x6b')]+_0xfce2('0x6c')===_0xe46417);if(_[_0xfce2('0x1b')](_0x50f73e)&&_[_0xfce2('0x1b')](_0xba10cd)){if(_0x4e2898[_0xfce2('0x73')](_0xe46417)){if(_0x52605b[_0xfce2('0x70')][_0xf55475][_0x4e2898[_0xe46417]]){var _0x2a5dac=_['trim'](_0x52605b[_0xfce2('0x70')][_0xf55475][_0x4e2898[_0xe46417]][_0xfce2('0x74')](/"/g,'\x27'));switch(_0xe46417){case _0xfce2('0x31'):var _0x1440db=moment(_0x2a5dac,_0xfce2('0xd'),!![]);if(_0x1440db[_0xfce2('0x75')]()){_0x2960c8['push']('\x22'+_0x2a5dac+'\x22');}else{_0x5abd7b[_0xfce2('0x1d')](_0xfce2('0x76'));}break;case _0xfce2('0x34'):var _0x24ccae=parseInt(_0x2a5dac);_0x2a5dac=_[_0xfce2('0x77')](_0x24ccae)||_0x24ccae<0x0||_0x24ccae>0x4?_0x38b432?0x3:0x2:_0x24ccae;_0x2960c8['push']('\x22'+_0x2a5dac+'\x22');break;case _0xfce2('0x35'):var _0x46a64c=parseInt(_0x2a5dac);if(_[_0xfce2('0x78')](_0x46a64c)&&_[_0xfce2('0x79')](_0xcaf8c2,_0x46a64c)){_0x2960c8[_0xfce2('0x1d')]('\x22'+_0x46a64c+'\x22');}else{_0x5abd7b[_0xfce2('0x1d')](_0xfce2('0x7a'));}break;case _0xfce2('0x7b'):if(isEmail(_0x2a5dac)){_0x2960c8['push']('\x22'+_0x2a5dac+'\x22');}else{_0x5abd7b['push'](_0xfce2('0x7c'));}break;case _0xfce2('0x7d'):var _0x2020db=moment(_0x2a5dac,_0xfce2('0x7e'),!![]);if(_0x2020db[_0xfce2('0x75')]()){_0x2960c8[_0xfce2('0x1d')]('\x22'+_0x2a5dac+'\x22');}else{_0x5abd7b[_0xfce2('0x1d')](_0xfce2('0x7f'));}break;default:_0x2960c8[_0xfce2('0x1d')]('\x22'+_0x2a5dac+'\x22');}}else{switch(_0xe46417){case _0xfce2('0x80'):case'phone':_0x5abd7b[_0xfce2('0x1d')](_0xe46417+'\x20not\x20specified');break;default:_0x2960c8['push']('\x22\x22');}}}}else{var _0x5e6992='';if(!_[_0xfce2('0x1b')](_0x50f73e)){if(!_0x11aafc[_0xfce2('0x73')](_0x50f73e['id'])){for(var _0x37363e=0x0;_0x37363e<_0x4e2898[_0xe46417][_0xfce2('0x1a')];_0x37363e++){var _0x2a5dac=_[_0xfce2('0x81')](_0x52605b[_0xfce2('0x70')][_0xf55475][_0x4e2898[_0xe46417][_0x37363e]][_0xfce2('0x74')](/"/g,'\x27'));var _0x18fd16=phoneDescriptions[_0xfce2('0x72')](_0x52bb2e=>_0x52bb2e['itemTypeId']===_0x50f73e['id']);if(!_['isNil'](_0x18fd16)){var _0x18fb08=_['trim'](_0x52605b[_0xfce2('0x70')][_0xf55475][_0x4e2898[_0x18fd16[_0xfce2('0x82')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xfce2('0x1b')](_0x18fb08))_0x2a5dac=_0x2a5dac+'§'+_0x18fb08;}if(_0x5e6992=='')_0x5e6992=_0x2a5dac;else _0x5e6992+='|'+_0x2a5dac;}_0x3a966a[_0xfce2('0x1d')](_0x50f73e['id']+':'+_0x5e6992);_0x11aafc[_0x50f73e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2960c8['push']('\x22'+_0x3a966a[_0xfce2('0x12')](';')+'\x22');}if(_0x5abd7b[_0xfce2('0x1a')]){handleError(_0x52605b[_0xfce2('0x70')][_0xf55475],{'code':'SystemRow','message':_0x5abd7b['join']()});}else{fs[_0xfce2('0x83')](_0x1ce729,_0x2960c8['join']()+'\x0a');}_0x2960c8=[];}if(!(stats[_0xfce2('0x71')]%0xc8)){socket['emit'](_0xfce2('0x84')+_0x3a9c77,stats);stats['errors']=[];}}if(stopped){logger[_0xfce2('0x5f')]('Abort\x20parser');_0x457ca4[_0xfce2('0x85')]();}}catch(_0x3284ca){handleError(_0x52605b[_0xfce2('0x70')][_0xf55475],{'code':_0xfce2('0x86'),'message':_0x3284ca[_0xfce2('0x5b')]});logger[_0xfce2('0x5a')](_0xfce2('0x87'),_0x3284ca[_0xfce2('0x5b')]);}},'complete':function(){try{var _0x5b2dc4=[];var _0x332b0b=tempTableName;_0x5b2dc4[_0xfce2('0x1d')](_0xfce2('0x88')+_0x332b0b+_0xfce2('0x89'));logger[_0xfce2('0x5f')](_0xfce2('0x8a'),contactItemTypes[_0xfce2('0x1a')]);var _0x2d5852=util['format'](_0xfce2('0x8b'),_0x1ce729,_0x332b0b,_0x5c6112,_0x381031['ListId'],_0x381031[_0xfce2('0x53')]||null,NOW,NOW);if(_['isNil'](_0x4e2898[_0xfce2('0x31')])){_0x2d5852+=_0xfce2('0x8c');}_0x5b2dc4['push'](_0x2d5852);BPromise[_0xfce2('0x8d')](_0x5b2dc4,handleQuery)['then'](function(_0xe1db91){BPromise['all']([handleAdditionalPhones()])[_0xfce2('0x1f')](function(){_0x5b2dc4=[];for(var _0x4ddd8d=0x0;_0x4ddd8d\x20\x20');}var _0x168f40=path[_0xfce2('0x12')](config['root'],_0xfce2('0x67'),process[_0xfce2('0x94')][0x2]);if(!fs[_0xfce2('0x95')](_0x168f40)){throw new Error(_0xfce2('0x96'));}var _0x5524de={};try{_0x5524de=JSON['parse'](process[_0xfce2('0x94')][0x3]);if(!_0x5524de[_0xfce2('0x63')]){throw new Error(_0xfce2('0x97'));}var _0x3d44c4=0x0;if(_0x5524de['binding'][_0xfce2('0x35')]){_0x3d44c4=0x1;}if(!_0x5524de['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0xb30178){throw new Error(_0xfce2('0x98'));}var _0x448b27=[];try{_0x448b27=_[_0xfce2('0x99')](JSON[_0xfce2('0x6e')](process[_0xfce2('0x94')][0x4]),'id');}catch(_0x1bd0cd){logger[_0xfce2('0x5f')](_0xfce2('0x9a'));}main(_0x168f40,_0x5524de,_0x448b27,_0x3d44c4);}validate();process['on'](_0xfce2('0x9b'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 6410e68..b6aeadc 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc501=['Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','calleridnum','string','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','Queue','queue','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Ring','agentcalledAt','agentconnectAt','Hold\x20Time','talktime','Called\x20Number','UniqueId','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime'];(function(_0x3e93c7,_0x9d5904){var _0xdba5b6=function(_0x3aadaa){while(--_0x3aadaa){_0x3e93c7['push'](_0x3e93c7['shift']());}};_0xdba5b6(++_0x9d5904);}(_0xc501,0xa1));var _0x1c50=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0xc501[_0x390a19];return _0x5d8230;};'use strict';exports[_0x1c50('0x0')]=function(_0x5446d5,_0x2d1f93){var _0x2d44c9=[{'type':'string','content':_0x1c50('0x1'),'variableName':null}];switch(_0x5446d5[_0x1c50('0x2')]()){case'voice':switch(_0x2d1f93[_0x1c50('0x2')]()){case _0x1c50('0x3'):_0x2d44c9[_0x1c50('0x4')]({'type':_0x1c50('0x5'),'content':'','variableName':'queue'});_0x2d44c9[_0x1c50('0x4')]({'type':_0x1c50('0x5'),'content':'','variableName':_0x1c50('0x6')});break;case'outbound':_0x2d44c9['push']({'type':_0x1c50('0x7'),'content':_0x1c50('0x8'),'variableName':null});_0x2d44c9[_0x1c50('0x4')]({'type':_0x1c50('0x5'),'content':'','variableName':_0x1c50('0x9')});break;}}return _0x2d44c9;};exports[_0x1c50('0xa')]=function(_0x54e8b7,_0x43a31c){var _0x52225a=[];switch(_0x54e8b7[_0x1c50('0x2')]()){case'voice':switch(_0x43a31c[_0x1c50('0x2')]()){case _0x1c50('0x3'):_0x52225a=[{'type':_0x1c50('0x7'),'content':_0x1c50('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x1c50('0xc'),'content':'','key':_0x1c50('0xd'),'keyType':'variable','variableName':_0x1c50('0x6')},{'type':_0x1c50('0xc'),'content':'','key':_0x1c50('0xe'),'keyType':'variable','variableName':_0x1c50('0xf')},{'type':'keyValue','content':'','key':_0x1c50('0x10'),'keyType':_0x1c50('0x5'),'variableName':'destexten'},{'type':_0x1c50('0xc'),'content':'','key':_0x1c50('0x11'),'keyType':_0x1c50('0x5'),'variableName':_0x1c50('0x12')},{'type':_0x1c50('0xc'),'content':'','key':'UniqueId','keyType':_0x1c50('0x5'),'variableName':_0x1c50('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0x1c50('0x5'),'variableName':'agentcalledAt'},{'type':_0x1c50('0x7'),'content':_0x1c50('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x1c50('0xc'),'content':'','key':_0x1c50('0x15'),'keyType':_0x1c50('0x5'),'variableName':_0x1c50('0x16')},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':_0x1c50('0x5'),'variableName':_0x1c50('0x9')},{'type':_0x1c50('0x7'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x1c50('0xc'),'content':'','key':_0x1c50('0x17'),'keyType':_0x1c50('0x5'),'variableName':_0x1c50('0x18')},{'type':_0x1c50('0xc'),'content':'','key':'Agent\x20Connect','keyType':_0x1c50('0x5'),'variableName':_0x1c50('0x19')},{'type':_0x1c50('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0x1c50('0x5'),'variableName':'agentcompleteAt'},{'type':_0x1c50('0xc'),'content':'','key':_0x1c50('0x1a'),'keyType':_0x1c50('0x5'),'variableName':'holdtime'},{'type':_0x1c50('0xc'),'content':'','key':'Talk\x20Time','keyType':_0x1c50('0x5'),'variableName':_0x1c50('0x1b')}];break;case'outbound':_0x52225a=[{'type':_0x1c50('0x7'),'content':_0x1c50('0xb'),'variableName':null},{'type':'keyValue','content':'','key':_0x1c50('0x1c'),'keyType':_0x1c50('0x5'),'keyContent':'','variableName':_0x1c50('0x9')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0x1c50('0x5'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0x1c50('0x1d'),'keyType':_0x1c50('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x1c50('0x5'),'keyContent':'','variableName':_0x1c50('0x1e')},{'type':_0x1c50('0x7'),'content':_0x1c50('0x1f')},{'type':_0x1c50('0xc'),'content':'','key':_0x1c50('0x20'),'keyType':_0x1c50('0x5'),'keyContent':'','variableName':_0x1c50('0x21')},{'type':_0x1c50('0xc'),'content':'','key':_0x1c50('0x22'),'keyType':_0x1c50('0x5'),'keyContent':'','variableName':_0x1c50('0x23')},{'type':_0x1c50('0xc'),'content':'','key':_0x1c50('0x24'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0x1c50('0xc'),'content':'','key':_0x1c50('0x25'),'keyType':_0x1c50('0x5'),'keyContent':'','variableName':_0x1c50('0x26')}];break;}}return _0x52225a;}; \ No newline at end of file +var _0x90e0=['billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','membername','Answer\x20Time','answertime','endtime','Duration'];(function(_0x5766eb,_0xcdbc28){var _0x385ab6=function(_0x5704ec){while(--_0x5704ec){_0x5766eb['push'](_0x5766eb['shift']());}};_0x385ab6(++_0xcdbc28);}(_0x90e0,0xad));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0x090e('0x0')]=function(_0x20772c,_0x1e2372){var _0x4aeeae=[{'type':'string','content':_0x090e('0x1'),'variableName':null}];switch(_0x20772c[_0x090e('0x2')]()){case _0x090e('0x3'):switch(_0x1e2372[_0x090e('0x2')]()){case _0x090e('0x4'):_0x4aeeae[_0x090e('0x5')]({'type':'variable','content':'','variableName':'queue'});_0x4aeeae['push']({'type':_0x090e('0x6'),'content':'','variableName':_0x090e('0x7')});break;case _0x090e('0x8'):_0x4aeeae['push']({'type':_0x090e('0x9'),'content':_0x090e('0xa'),'variableName':null});_0x4aeeae[_0x090e('0x5')]({'type':'variable','content':'','variableName':_0x090e('0xb')});break;}}return _0x4aeeae;};exports[_0x090e('0xc')]=function(_0x20bd30,_0x2ef3da){var _0x58933b=[];switch(_0x20bd30[_0x090e('0x2')]()){case _0x090e('0x3'):switch(_0x2ef3da[_0x090e('0x2')]()){case'inbound':_0x58933b=[{'type':_0x090e('0x9'),'content':_0x090e('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0xf'),'keyType':_0x090e('0x6'),'variableName':_0x090e('0x7')},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x10'),'keyType':_0x090e('0x6'),'variableName':_0x090e('0x11')},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x12'),'keyType':_0x090e('0x6'),'variableName':_0x090e('0x13')},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x14'),'keyType':_0x090e('0x6'),'variableName':_0x090e('0x15')},{'type':_0x090e('0xe'),'content':'','key':'UniqueId','keyType':_0x090e('0x6'),'variableName':_0x090e('0x16')},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x17'),'keyType':_0x090e('0x6'),'variableName':_0x090e('0x18')},{'type':_0x090e('0x9'),'content':_0x090e('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x1a'),'keyType':'variable','variableName':_0x090e('0x1b')},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x1c'),'keyType':_0x090e('0x6'),'variableName':_0x090e('0xb')},{'type':_0x090e('0x9'),'content':_0x090e('0x1d'),'key':null,'keyType':null,'variableName':null},{'type':_0x090e('0xe'),'content':'','key':'Agent\x20Ring','keyType':_0x090e('0x6'),'variableName':_0x090e('0x18')},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x1e'),'keyType':_0x090e('0x6'),'variableName':_0x090e('0x1f')},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x20'),'keyType':_0x090e('0x6'),'variableName':_0x090e('0x21')},{'type':_0x090e('0xe'),'content':'','key':'Hold\x20Time','keyType':_0x090e('0x6'),'variableName':_0x090e('0x22')},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x23'),'keyType':_0x090e('0x6'),'variableName':_0x090e('0x24')}];break;case _0x090e('0x8'):_0x58933b=[{'type':_0x090e('0x9'),'content':_0x090e('0xd'),'variableName':null},{'type':_0x090e('0xe'),'content':'','key':'Called\x20Number','keyType':_0x090e('0x6'),'keyContent':'','variableName':_0x090e('0xb')},{'type':_0x090e('0xe'),'content':'','key':'Member\x20Name','keyType':_0x090e('0x6'),'keyContent':'','variableName':_0x090e('0x25')},{'type':_0x090e('0xe'),'content':'','key':'UniqueId','keyType':_0x090e('0x6'),'keyContent':'','variableName':_0x090e('0x16')},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x17'),'keyType':_0x090e('0x6'),'keyContent':'','variableName':'starttime'},{'type':_0x090e('0x9'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x090e('0xe'),'content':'','key':_0x090e('0x26'),'keyType':_0x090e('0x6'),'keyContent':'','variableName':_0x090e('0x27')},{'type':_0x090e('0xe'),'content':'','key':'Complete\x20Time','keyType':_0x090e('0x6'),'keyContent':'','variableName':_0x090e('0x28')},{'type':'keyValue','content':'','key':_0x090e('0x29'),'keyType':_0x090e('0x6'),'keyContent':'','variableName':'duration'},{'type':_0x090e('0xe'),'content':'','key':'Billable\x20Time','keyType':_0x090e('0x6'),'keyContent':'','variableName':_0x090e('0x2a')}];break;}}return _0x58933b;}; \ No newline at end of file diff --git a/server/components/interaction/accept-message.js b/server/components/interaction/accept-message.js index e2e39c0..e619d4b 100644 --- a/server/components/interaction/accept-message.js +++ b/server/components/interaction/accept-message.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2706=['Interaction\x20with\x20id\x20','\x20not\x20found','updateInteractionById','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','SELECT','length','Contact\x20with\x20id\x20','findContactById','User','agent','name','email','findAgentById','min','col','isNewInteraction','assign','parse','formData','EventManager','acceptmessage','sendAmiAcceptEvent','AcceptMessage','newinteraction','opened','moment','jayson/promise','../../mysqldb','../../errors/api','../../config/logger','api','client','http','request','then','info','%s,\x20%s,\x20%s','debug','%s,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','user','get','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','getAcceptParams','capitalize','Message','findOne','Message\x20with\x20id\x20','update','updateMessageById'];(function(_0x553b7f,_0x504bc6){var _0x5d1074=function(_0x4c99b2){while(--_0x4c99b2){_0x553b7f['push'](_0x553b7f['shift']());}};_0x5d1074(++_0x504bc6);}(_0x2706,0x107));var _0x6270=function(_0xde9a97,_0x4f8908){_0xde9a97=_0xde9a97-0x0;var _0x20db26=_0x2706[_0xde9a97];return _0x20db26;};'use strict';var _=require('lodash');var moment=require(_0x6270('0x0'));var jayson=require(_0x6270('0x1'));var db=require(_0x6270('0x2'))['db'];var APINotFoundError=require(_0x6270('0x3'))['APINotFoundError'];var logger=require(_0x6270('0x4'))(_0x6270('0x5'));var rpcAmiClient=jayson[_0x6270('0x6')][_0x6270('0x7')]({'port':0x232a});var rpcRoutingClient=jayson[_0x6270('0x6')][_0x6270('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1e770e,_0x43e34d,_0x4fac3f,_0x4f700e,_0x2e6a1b){return new Promise(function(_0x585bc1,_0x35a6e3){return _0x2e6a1b[_0x6270('0x8')](_0x43e34d,_0x4f700e)[_0x6270('0x9')](function(_0xea69a0){logger[_0x6270('0xa')](_0x6270('0xb'),_0x1e770e,_0x4fac3f,'request\x20sent');logger[_0x6270('0xc')](_0x6270('0xd'),_0x1e770e,_0x4fac3f,_0x6270('0xe'),JSON[_0x6270('0xf')](_0xea69a0));if(_0xea69a0[_0x6270('0x10')]){if(_0xea69a0['error']['code']===0x1f4){logger[_0x6270('0x10')](_0x6270('0xb'),_0x1e770e,_0x4fac3f,_0xea69a0['error']['message']);return _0x35a6e3(_0xea69a0['error'][_0x6270('0x11')]);}logger['error'](_0x6270('0xb'),_0x1e770e,_0x4fac3f,_0xea69a0['error']['message']);return _0x585bc1(_0xea69a0['error'][_0x6270('0x11')]);}else{logger[_0x6270('0xa')](_0x6270('0xb'),_0x1e770e,_0x4fac3f,'request\x20sent');_0x585bc1(_0xea69a0['result'][_0x6270('0x11')]);}})['catch'](function(_0x26ceb9){logger[_0x6270('0x10')](_0x6270('0xb'),_0x1e770e,_0x4fac3f,_0x26ceb9);_0x35a6e3(_0x26ceb9);});});}function getAcceptParams(_0xcec42c){var _0x2c87c9=_0xcec42c['params']['id'];var _0x3ba0f4=_0xcec42c['body'];delete _0x3ba0f4['id'];var _0x273478=_0xcec42c[_0x6270('0x12')][_0x6270('0x13')]({'plain':!![]});_0x3ba0f4[_0x6270('0x14')]=!![];_0x3ba0f4[_0x6270('0x15')]=moment()[_0x6270('0x16')](_0x6270('0x17'));_0x3ba0f4[_0x6270('0x18')]=_0x3ba0f4[_0x6270('0x18')]||_0x273478['id'];return{'messageId':_0x2c87c9,'payload':_0x3ba0f4,'user':_0x273478};}exports[_0x6270('0x19')]=getAcceptParams;function updateMessageById(_0x1be58e,_0x476657,_0x575851){var _0x2db609=_[_0x6270('0x1a')](_0x1be58e)+_0x6270('0x1b');return db[_0x2db609][_0x6270('0x1c')]({'where':{'id':_0x476657,'UserId':null}})[_0x6270('0x9')](function(_0x1b9b20){if(!_0x1b9b20){throw new APINotFoundError(_0x6270('0x1d')+_0x476657+'\x20not\x20found');}return _0x1b9b20[_0x6270('0x1e')](_0x575851);})[_0x6270('0x9')](function(_0xb21fc){return _0xb21fc['get']({'plain':!![]});});}exports[_0x6270('0x1f')]=updateMessageById;function updateInteractionById(_0x4099d6,_0x40f0c5,_0x42267c){var _0x12ee8d=_[_0x6270('0x1a')](_0x4099d6)+'Interaction';return db[_0x12ee8d][_0x6270('0x1c')]({'where':{'id':_0x40f0c5}})[_0x6270('0x9')](function(_0x247a4d){if(!_0x247a4d){throw new APINotFoundError(_0x6270('0x20')+_0x40f0c5+_0x6270('0x21'));}var _0x542a9d=_0x247a4d['read1stAt']||moment()[_0x6270('0x16')]('YYYY-MM-DD\x20HH:mm:ss');return _0x247a4d[_0x6270('0x1e')]({'UserId':_0x42267c,'read1stAt':_0x542a9d});})[_0x6270('0x9')](function(_0x5b027b){return _0x5b027b['get']({'plain':!![]});});}exports[_0x6270('0x22')]=updateInteractionById;function findContactById(_0x4fb49d){var _0x3be344=_0x6270('0x23')+_0x4fb49d;return db[_0x6270('0x24')][_0x6270('0x25')](_0x3be344,{'type':db[_0x6270('0x24')]['QueryTypes'][_0x6270('0x26')],'raw':!![]})[_0x6270('0x9')](function(_0x36f64a){if(_0x36f64a[_0x6270('0x27')]===0x0){throw new APINotFoundError(_0x6270('0x28')+_0x4fb49d+_0x6270('0x21'));}return _0x36f64a[0x0];});}exports[_0x6270('0x29')]=findContactById;function findAgentById(_0x76b030){return db[_0x6270('0x2a')]['findOne']({'where':{'id':_0x76b030,'role':_0x6270('0x2b')},'attributes':['id',_0x6270('0x2c'),'fullname',_0x6270('0x2d'),'internal'],'raw':!![]});}exports[_0x6270('0x2e')]=findAgentById;function isNewInteraction(_0x2d5067,_0x44aa27,_0x3796c3){var _0x41f42a=_[_0x6270('0x1a')](_0x2d5067)+_0x6270('0x1b');var _0x11182c=_['capitalize'](_0x2d5067)+'InteractionId';return db[_0x41f42a][_0x6270('0x1c')]({'where':{['field']:_0x44aa27},'attributes':[[db[_0x6270('0x24')]['fn'](_0x6270('0x2f'),db[_0x6270('0x24')][_0x6270('0x30')]('id')),'id']],'raw':!![]})['then'](function(_0x30b86d){return _0x3796c3===_0x30b86d['id'];});}exports[_0x6270('0x31')]=isNewInteraction;function sendAmiAcceptEvent(_0x28d910,_0x5967bd){var _0x483220=_['capitalize'](_0x28d910)+_0x6270('0x1b');var _0x3344f5=_0x5967bd[_0x6270('0x11')];if(_0x28d910==='chat'){Object[_0x6270('0x32')](_0x3344f5,JSON[_0x6270('0x33')](_0x5967bd['interaction'][_0x6270('0x34')]));}return respondWithRpcPromise(_0x483220,_0x6270('0x35'),'EventManager',{'event':_0x6270('0x36'),'message':_0x3344f5},rpcAmiClient);}exports[_0x6270('0x37')]=sendAmiAcceptEvent;function sendRoutingAcceptEvent(_0x59476c,_0x59dada){var _0x4785b5=_[_0x6270('0x1a')](_0x59476c)+_0x6270('0x1b');return respondWithRpcPromise(_0x4785b5,_0x6270('0x38'),'acceptMessage',_0x59dada,rpcRoutingClient);}exports['sendRoutingAcceptEvent']=sendRoutingAcceptEvent;function sendInteractionOpenedEvent(_0x880598,_0x53cda7){var _0x47f756=_[_0x6270('0x1a')](_0x880598)+'Message';return respondWithRpcPromise(_0x47f756,_0x6270('0x35'),'EventManager',{'event':_0x6270('0x39'),'message':Object[_0x6270('0x32')]({},_0x53cda7,{'event':_0x6270('0x3a')})},rpcAmiClient);}exports['sendInteractionOpenedEvent']=sendInteractionOpenedEvent; \ No newline at end of file +var _0x7f51=['InteractionId','min','col','isNewInteraction','chat','parse','interaction','formData','EventManager','acceptmessage','sendAmiAcceptEvent','AcceptMessage','acceptMessage','sendRoutingAcceptEvent','assign','opened','../../mysqldb','APINotFoundError','api','client','http','then','info','debug','request\x20sent','stringify','error','%s,\x20%s,\x20%s','message','result','catch','body','user','get','read','format','UserId','getAcceptParams','Message','findOne','Message\x20with\x20id\x20','update','capitalize','Interaction\x20with\x20id\x20','\x20not\x20found','read1stAt','YYYY-MM-DD\x20HH:mm:ss','query','sequelize','QueryTypes','SELECT','length','Contact\x20with\x20id\x20','findContactById','User','fullname','email','internal','findAgentById'];(function(_0x10983d,_0x4a87df){var _0x30aaab=function(_0x34381e){while(--_0x34381e){_0x10983d['push'](_0x10983d['shift']());}};_0x30aaab(++_0x4a87df);}(_0x7f51,0xfc));var _0x17f5=function(_0x462f83,_0x48a126){_0x462f83=_0x462f83-0x0;var _0x55d857=_0x7f51[_0x462f83];return _0x55d857;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require('jayson/promise');var db=require(_0x17f5('0x0'))['db'];var APINotFoundError=require('../../errors/api')[_0x17f5('0x1')];var logger=require('../../config/logger')(_0x17f5('0x2'));var rpcAmiClient=jayson[_0x17f5('0x3')][_0x17f5('0x4')]({'port':0x232a});var rpcRoutingClient=jayson[_0x17f5('0x3')]['http']({'port':0x232c});function respondWithRpcPromise(_0x321f2a,_0x1740ed,_0x51738f,_0x707a29,_0x1b6a8a){return new Promise(function(_0x2e7cf4,_0x557a7c){return _0x1b6a8a['request'](_0x1740ed,_0x707a29)[_0x17f5('0x5')](function(_0x4bf5f1){logger[_0x17f5('0x6')]('%s,\x20%s,\x20%s',_0x321f2a,_0x51738f,'request\x20sent');logger[_0x17f5('0x7')]('%s,\x20%s,\x20%s,\x20%s',_0x321f2a,_0x51738f,_0x17f5('0x8'),JSON[_0x17f5('0x9')](_0x4bf5f1));if(_0x4bf5f1[_0x17f5('0xa')]){if(_0x4bf5f1['error']['code']===0x1f4){logger[_0x17f5('0xa')](_0x17f5('0xb'),_0x321f2a,_0x51738f,_0x4bf5f1['error'][_0x17f5('0xc')]);return _0x557a7c(_0x4bf5f1['error'][_0x17f5('0xc')]);}logger[_0x17f5('0xa')](_0x17f5('0xb'),_0x321f2a,_0x51738f,_0x4bf5f1[_0x17f5('0xa')][_0x17f5('0xc')]);return _0x2e7cf4(_0x4bf5f1[_0x17f5('0xa')][_0x17f5('0xc')]);}else{logger[_0x17f5('0x6')](_0x17f5('0xb'),_0x321f2a,_0x51738f,_0x17f5('0x8'));_0x2e7cf4(_0x4bf5f1[_0x17f5('0xd')]['message']);}})[_0x17f5('0xe')](function(_0x1cc799){logger[_0x17f5('0xa')](_0x17f5('0xb'),_0x321f2a,_0x51738f,_0x1cc799);_0x557a7c(_0x1cc799);});});}function getAcceptParams(_0x4aa3f9){var _0x28adaf=_0x4aa3f9['params']['id'];var _0x5b125f=_0x4aa3f9[_0x17f5('0xf')];delete _0x5b125f['id'];var _0x4e0f3c=_0x4aa3f9[_0x17f5('0x10')][_0x17f5('0x11')]({'plain':!![]});_0x5b125f[_0x17f5('0x12')]=!![];_0x5b125f['readAt']=moment()[_0x17f5('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b125f[_0x17f5('0x14')]=_0x5b125f['UserId']||_0x4e0f3c['id'];return{'messageId':_0x28adaf,'payload':_0x5b125f,'user':_0x4e0f3c};}exports[_0x17f5('0x15')]=getAcceptParams;function updateMessageById(_0x291d36,_0x2c649a,_0x460eb2){var _0x3da710=_['capitalize'](_0x291d36)+_0x17f5('0x16');return db[_0x3da710][_0x17f5('0x17')]({'where':{'id':_0x2c649a,'UserId':null}})['then'](function(_0x386eb8){if(!_0x386eb8){throw new APINotFoundError(_0x17f5('0x18')+_0x2c649a+'\x20not\x20found');}return _0x386eb8[_0x17f5('0x19')](_0x460eb2);})['then'](function(_0x53e4b6){return _0x53e4b6[_0x17f5('0x11')]({'plain':!![]});});}exports['updateMessageById']=updateMessageById;function updateInteractionById(_0x34baf7,_0x1972f8,_0x301f13){var _0x3d2ce3=_[_0x17f5('0x1a')](_0x34baf7)+'Interaction';return db[_0x3d2ce3]['findOne']({'where':{'id':_0x1972f8}})[_0x17f5('0x5')](function(_0x3003a1){if(!_0x3003a1){throw new APINotFoundError(_0x17f5('0x1b')+_0x1972f8+_0x17f5('0x1c'));}var _0x18d7bb=_0x3003a1[_0x17f5('0x1d')]||moment()['format'](_0x17f5('0x1e'));return _0x3003a1[_0x17f5('0x19')]({'UserId':_0x301f13,'read1stAt':_0x18d7bb});})[_0x17f5('0x5')](function(_0x2de2c6){return _0x2de2c6['get']({'plain':!![]});});}exports['updateInteractionById']=updateInteractionById;function findContactById(_0x47e873){var _0xfa120d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x47e873;return db['sequelize'][_0x17f5('0x1f')](_0xfa120d,{'type':db[_0x17f5('0x20')][_0x17f5('0x21')][_0x17f5('0x22')],'raw':!![]})[_0x17f5('0x5')](function(_0x5c8a48){if(_0x5c8a48[_0x17f5('0x23')]===0x0){throw new APINotFoundError(_0x17f5('0x24')+_0x47e873+'\x20not\x20found');}return _0x5c8a48[0x0];});}exports[_0x17f5('0x25')]=findContactById;function findAgentById(_0x549d3e){return db[_0x17f5('0x26')][_0x17f5('0x17')]({'where':{'id':_0x549d3e,'role':'agent'},'attributes':['id','name',_0x17f5('0x27'),_0x17f5('0x28'),_0x17f5('0x29')],'raw':!![]});}exports[_0x17f5('0x2a')]=findAgentById;function isNewInteraction(_0x424585,_0x286a22,_0x37c07f){var _0x31e013=_[_0x17f5('0x1a')](_0x424585)+_0x17f5('0x16');var _0x4f843f=_[_0x17f5('0x1a')](_0x424585)+_0x17f5('0x2b');var _0x158f64={['field']:_0x286a22};return db[_0x31e013]['findOne']({'where':_0x158f64,'attributes':[[db[_0x17f5('0x20')]['fn'](_0x17f5('0x2c'),db[_0x17f5('0x20')][_0x17f5('0x2d')]('id')),'id']],'raw':!![]})['then'](function(_0x1f8c18){return _0x37c07f===_0x1f8c18['id'];});}exports[_0x17f5('0x2e')]=isNewInteraction;function sendAmiAcceptEvent(_0x5cda60,_0x34df0e){var _0x40b51c=_[_0x17f5('0x1a')](_0x5cda60)+_0x17f5('0x16');var _0x42d103=_0x34df0e[_0x17f5('0xc')];if(_0x5cda60===_0x17f5('0x2f')){Object['assign'](_0x42d103,JSON[_0x17f5('0x30')](_0x34df0e[_0x17f5('0x31')][_0x17f5('0x32')]));}return respondWithRpcPromise(_0x40b51c,'EventManager',_0x17f5('0x33'),{'event':_0x17f5('0x34'),'message':_0x42d103},rpcAmiClient);}exports[_0x17f5('0x35')]=sendAmiAcceptEvent;function sendRoutingAcceptEvent(_0x1c6ab2,_0x5daf56){var _0x32fa07=_[_0x17f5('0x1a')](_0x1c6ab2)+_0x17f5('0x16');return respondWithRpcPromise(_0x32fa07,_0x17f5('0x36'),_0x17f5('0x37'),_0x5daf56,rpcRoutingClient);}exports[_0x17f5('0x38')]=sendRoutingAcceptEvent;function sendInteractionOpenedEvent(_0x567cda,_0x5c5877){var _0x53b2ff=_[_0x17f5('0x1a')](_0x567cda)+_0x17f5('0x16');return respondWithRpcPromise(_0x53b2ff,_0x17f5('0x33'),_0x17f5('0x33'),{'event':'newinteraction','message':Object[_0x17f5('0x39')]({},_0x5c5877,{'event':_0x17f5('0x3a')})},rpcAmiClient);}exports['sendInteractionOpenedEvent']=sendInteractionOpenedEvent; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index b35aa76..1db3c23 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x507f=['agent','UserId','updateMessageById','message','capitalize','sendRoutingAcceptEvent','findContactById','ContactId','findAgentById','manual','SIP/','name','isNewInteraction','interaction','assign','accept','sendAmiAcceptEvent','lodash','./accept-message','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseQueryParameters','where','body','contact','default','fields','filter','user','having','tags','checkAccountsRestrictions','group','ids','tag','countFilteredInteractions','count','clause','order','forEach','contactName','DESC','closed','getFilteredInteractions','catch','tracked','query','omit','html','phone','fax','mobile','updateUser','messageId'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x507f,0x1f1));var _0xf507=function(_0x599a0f,_0x4ce2d9){_0x599a0f=_0x599a0f-0x0;var _0x392039=_0x507f[_0x599a0f];return _0x392039;};'use strict';var _=require(_0xf507('0x0'));var acceptUtils=require(_0xf507('0x1'));var sqlUtils=require(_0xf507('0x2'));var utils=require(_0xf507('0x3'));exports[_0xf507('0x4')]=function(_0xcd88c2,_0x533ebd,_0x15fb86,_0x3a9572,_0x4b712a){var _0xd0d199={'count':0x0,'rows':[]};var _0x581b7b=sqlUtils[_0xf507('0x5')](_0xcd88c2,_0x15fb86,_0x533ebd);if(_0x581b7b){return Promise[_0xf507('0x6')](_0xd0d199);}var _0x1eaf2c=sqlUtils[_0xf507('0x7')](_0xcd88c2);var _0x1a872b={};return Promise[_0xf507('0x6')]()[_0xf507('0x8')](function(){if(_0x533ebd['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x533ebd[_0xf507('0x9')],_0x4b712a);}else{return sqlUtils[_0xf507('0xa')](_0xcd88c2,_0x533ebd,_0x4b712a);}})[_0xf507('0x8')](function(_0x5f1ccf){_0x1eaf2c[_0xf507('0xb')](_0x5f1ccf[_0xf507('0xc')]);_0x1eaf2c[_0xf507('0xb')](_0x5f1ccf[_0xf507('0xd')]);_0x1eaf2c[_0xf507('0xb')](_0x5f1ccf[_0xf507('0xe')]);_0x1eaf2c['where'](_0x5f1ccf[_0xf507('0xf')]);_0x1eaf2c[_0xf507('0xb')](_0x5f1ccf[_0xf507('0x10')]);_0x1eaf2c[_0xf507('0xb')](_0x5f1ccf[_0xf507('0x11')]);_0x1eaf2c[_0xf507('0x12')](_0x5f1ccf['read']);_0x1a872b=_0x5f1ccf[_0xf507('0x13')];return sqlUtils[_0xf507('0x14')](_0xcd88c2,_0x15fb86,_0x533ebd);})[_0xf507('0x8')](function(_0x33ff3c){_0x1eaf2c[_0xf507('0xb')](_0x33ff3c);_0x1eaf2c[_0xf507('0x15')]('i.id');var _0x3e5405=_0x533ebd[_0xf507('0x9')]?_0x1a872b[_0xf507('0x16')]:_0x533ebd[_0xf507('0x17')];return sqlUtils[_0xf507('0x18')](_0x1eaf2c,_0x3e5405);})[_0xf507('0x8')](function(_0x297aee){_0xd0d199[_0xf507('0x19')]=_0x297aee['length'];if(_0xd0d199[_0xf507('0x19')]===0x0){return[];}_0x1eaf2c[_0xf507('0x12')](_0x1a872b[_0xf507('0x1a')]);if(_0x3a9572[_0xf507('0x1b')]){_0x3a9572[_0xf507('0x1b')][_0xf507('0x1c')](function(_0x2f44b9){var _0x310a36=_0x2f44b9[0x0]===_0xf507('0x1d')?_0x2f44b9[0x0]:'i.'+_0x2f44b9[0x0];_0x1eaf2c[_0xf507('0x1b')](_0x310a36,_0x2f44b9[0x1]===_0xf507('0x1e')?![]:!![]);if(_0x2f44b9[0x0]===_0xf507('0x1f')){var _0x5025b0=sqlUtils['getClosedOrderClause'](_0xcd88c2,_0x533ebd);_0x1eaf2c[_0xf507('0x1b')](_0x5025b0,_0x2f44b9[0x1]===_0xf507('0x1e')?![]:!![]);}});}return sqlUtils[_0xf507('0x20')](_0xcd88c2,_0x1eaf2c,_0x533ebd,_0x3a9572);})[_0xf507('0x8')](function(_0xcc1c7d){_0xd0d199['rows']=_0xcc1c7d;return _0xd0d199;})[_0xf507('0x21')](function(_0x722720){throw _0x722720;});};exports[_0xf507('0x22')]=function(_0x761b6e,_0x1eb38d){return function(_0x1fe540,_0x387577,_0x34f7fe){var _0x5a0896=_0x1fe540[_0xf507('0x11')];var _0x41b8a1={};var _0x13452e=_0x1fe540[_0xf507('0x23')];if(_0x41b8a1){_0x41b8a1=_['clone'](_0x1fe540[_0xf507('0xc')]);_0x41b8a1=_[_0xf507('0x24')](_0x41b8a1,[_0xf507('0xc'),_0xf507('0x25'),_0xf507('0x26'),_0xf507('0x27'),_0xf507('0x28')]);}utils[_0xf507('0x29')](_0x5a0896,_0x41b8a1,_0x13452e,_0x761b6e,_0x1eb38d);_0x34f7fe(null);};};function acceptMessage(_0x45c0b9,_0x2e7b80){var _0xc2931e={'agent':{},'channel':_0x2e7b80};var _0x2d5c08=acceptUtils['getAcceptParams'](_0x45c0b9);var _0x1174a5=_0x2d5c08[_0xf507('0x2a')];var _0x52c405=_0x2d5c08['payload'];var _0x1942df=_0x2d5c08[_0xf507('0x11')];_0xc2931e[_0xf507('0x2b')]['id']=_0x52c405[_0xf507('0x2c')];return acceptUtils[_0xf507('0x2d')](_0x2e7b80,_0x1174a5,_0x52c405)[_0xf507('0x8')](function(_0x4d89ab){_0xc2931e[_0xf507('0x2e')]=_0x4d89ab;return acceptUtils['updateInteractionById'](_0x2e7b80,_0x4d89ab[_[_0xf507('0x2f')](_0x2e7b80)+'InteractionId'],_0x52c405[_0xf507('0x2c')]);})[_0xf507('0x8')](function(_0x19ea7a){_0xc2931e['interaction']=_0x19ea7a;utils['logAcceptMessage'](_0x2e7b80,_0x1942df,_0x19ea7a['id'],_0x52c405);return acceptUtils[_0xf507('0x30')](_0x2e7b80,_0xc2931e);})[_0xf507('0x8')](function(_0x288047){return acceptUtils[_0xf507('0x31')](_0x288047[_0xf507('0x2e')][_0xf507('0x32')]);})['then'](function(_0x2e859d){_0xc2931e[_0xf507('0x2e')][_0xf507('0xd')]=_0x2e859d;return _0x52c405['UserId']?acceptUtils[_0xf507('0x33')](_0x52c405[_0xf507('0x2c')]):null;})[_0xf507('0x8')](function(_0x124fe6){_0xc2931e[_0xf507('0x2e')][_0xf507('0x2b')]=_0x124fe6;if(_0x52c405[_0xf507('0x34')]){var _0x57c4ab={'interface':_0xf507('0x35')+_0x1942df[_0xf507('0x36')],'channel':_0x2e7b80,'motionChannel':_0x2e7b80};return acceptUtils[_0xf507('0x37')](_0x2e7b80,_0xc2931e[_0xf507('0x38')]['id'],_0xc2931e[_0xf507('0x2e')]['id'])[_0xf507('0x8')](function(_0x289c7d){if(_0x289c7d){var _0x88c33b=Object['assign']({},_0xc2931e[_0xf507('0x38')],_0x57c4ab,{'contact':_0xc2931e[_0xf507('0x2e')][_0xf507('0xd')]});return acceptUtils['sendInteractionOpenedEvent'](_0x2e7b80,_0x88c33b);}})[_0xf507('0x8')](function(){Object[_0xf507('0x39')](_0xc2931e[_0xf507('0x2e')],_0x57c4ab,{'event':_0xf507('0x3a')});return acceptUtils[_0xf507('0x3b')](_0x2e7b80,_0xc2931e);});}})[_0xf507('0x8')](function(){return _0xc2931e;});}exports['acceptMessage']=acceptMessage; \ No newline at end of file +var _0xe3d1=['having','read','tags','checkAccountsRestrictions','group','i.id','tag','length','count','clause','contactName','order','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','query','clone','omit','html','phone','mobile','updateUser','messageId','payload','agent','updateMessageById','message','capitalize','UserId','interaction','findContactById','ContactId','contact','manual','SIP/','name','sendInteractionOpenedEvent','assign','accept','sendAmiAcceptEvent','acceptMessage','lodash','./accept-message','./sql-utils','./utils','findAll','getInteractionsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','body','user'];(function(_0x2d0d2b,_0x22414a){var _0x2fdb1d=function(_0x54f41b){while(--_0x54f41b){_0x2d0d2b['push'](_0x2d0d2b['shift']());}};_0x2fdb1d(++_0x22414a);}(_0xe3d1,0x114));var _0x1e3d=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xe3d1[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x1e3d('0x0'));var acceptUtils=require(_0x1e3d('0x1'));var sqlUtils=require(_0x1e3d('0x2'));var utils=require(_0x1e3d('0x3'));exports[_0x1e3d('0x4')]=function(_0x35eb14,_0x583c71,_0x2ee855,_0x1e31e9,_0x2ee43c){var _0x716ed7={'count':0x0,'rows':[]};var _0x3271a6=sqlUtils['skipInteractionsQuery'](_0x35eb14,_0x2ee855,_0x583c71);if(_0x3271a6){return Promise['resolve'](_0x716ed7);}var _0x4069f5=sqlUtils[_0x1e3d('0x5')](_0x35eb14);var _0x52148a={};return Promise[_0x1e3d('0x6')]()[_0x1e3d('0x7')](function(){if(_0x583c71[_0x1e3d('0x8')]){return sqlUtils[_0x1e3d('0x9')](_0x583c71['search'],_0x2ee43c);}else{return sqlUtils[_0x1e3d('0xa')](_0x35eb14,_0x583c71,_0x2ee43c);}})[_0x1e3d('0x7')](function(_0x1cb216){_0x4069f5[_0x1e3d('0xb')](_0x1cb216[_0x1e3d('0xc')]);_0x4069f5['where'](_0x1cb216['contact']);_0x4069f5[_0x1e3d('0xb')](_0x1cb216['default']);_0x4069f5['where'](_0x1cb216['fields']);_0x4069f5[_0x1e3d('0xb')](_0x1cb216['filter']);_0x4069f5[_0x1e3d('0xb')](_0x1cb216[_0x1e3d('0xd')]);_0x4069f5[_0x1e3d('0xe')](_0x1cb216[_0x1e3d('0xf')]);_0x52148a=_0x1cb216[_0x1e3d('0x10')];return sqlUtils[_0x1e3d('0x11')](_0x35eb14,_0x2ee855,_0x583c71);})[_0x1e3d('0x7')](function(_0x45b540){_0x4069f5[_0x1e3d('0xb')](_0x45b540);_0x4069f5[_0x1e3d('0x12')](_0x1e3d('0x13'));var _0x27da5d=_0x583c71[_0x1e3d('0x8')]?_0x52148a['ids']:_0x583c71[_0x1e3d('0x14')];return sqlUtils['countFilteredInteractions'](_0x4069f5,_0x27da5d);})[_0x1e3d('0x7')](function(_0x5768f2){_0x716ed7['count']=_0x5768f2[_0x1e3d('0x15')];if(_0x716ed7[_0x1e3d('0x16')]===0x0){return[];}_0x4069f5[_0x1e3d('0xe')](_0x52148a[_0x1e3d('0x17')]);if(_0x1e31e9['order']){_0x1e31e9['order']['forEach'](function(_0x3d5758){var _0x3a0e61=_0x3d5758[0x0]===_0x1e3d('0x18')?_0x3d5758[0x0]:'i.'+_0x3d5758[0x0];_0x4069f5[_0x1e3d('0x19')](_0x3a0e61,_0x3d5758[0x1]==='DESC'?![]:!![]);if(_0x3d5758[0x0]===_0x1e3d('0x1a')){var _0x56381f=sqlUtils[_0x1e3d('0x1b')](_0x35eb14,_0x583c71);_0x4069f5[_0x1e3d('0x19')](_0x56381f,_0x3d5758[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0x1e3d('0x1c')](_0x35eb14,_0x4069f5,_0x583c71,_0x1e31e9);})['then'](function(_0x567614){_0x716ed7[_0x1e3d('0x1d')]=_0x567614;return _0x716ed7;})[_0x1e3d('0x1e')](function(_0x2b9c07){throw _0x2b9c07;});};exports[_0x1e3d('0x1f')]=function(_0x1a2879,_0x308ac6){return function(_0x3501af,_0x1ff937,_0xc1081a){var _0x2c24a1=_0x3501af[_0x1e3d('0xd')];var _0x385a8f={};var _0x1e1265=_0x3501af[_0x1e3d('0x20')];if(_0x385a8f){_0x385a8f=_[_0x1e3d('0x21')](_0x3501af['body']);_0x385a8f=_[_0x1e3d('0x22')](_0x385a8f,['body',_0x1e3d('0x23'),_0x1e3d('0x24'),'fax',_0x1e3d('0x25')]);}utils[_0x1e3d('0x26')](_0x2c24a1,_0x385a8f,_0x1e1265,_0x1a2879,_0x308ac6);_0xc1081a(null);};};function acceptMessage(_0xec1a11,_0x97e540){var _0x15b3a0={'agent':{},'channel':_0x97e540};var _0x218138=acceptUtils['getAcceptParams'](_0xec1a11);var _0x353105=_0x218138[_0x1e3d('0x27')];var _0x3208ab=_0x218138[_0x1e3d('0x28')];var _0x49f5c1=_0x218138[_0x1e3d('0xd')];_0x15b3a0[_0x1e3d('0x29')]['id']=_0x3208ab['UserId'];return acceptUtils[_0x1e3d('0x2a')](_0x97e540,_0x353105,_0x3208ab)[_0x1e3d('0x7')](function(_0x1a9e3b){_0x15b3a0[_0x1e3d('0x2b')]=_0x1a9e3b;return acceptUtils['updateInteractionById'](_0x97e540,_0x1a9e3b[_[_0x1e3d('0x2c')](_0x97e540)+'InteractionId'],_0x3208ab[_0x1e3d('0x2d')]);})[_0x1e3d('0x7')](function(_0x5ae504){_0x15b3a0[_0x1e3d('0x2e')]=_0x5ae504;utils['logAcceptMessage'](_0x97e540,_0x49f5c1,_0x5ae504['id'],_0x3208ab);return acceptUtils['sendRoutingAcceptEvent'](_0x97e540,_0x15b3a0);})['then'](function(_0x1d3c24){return acceptUtils[_0x1e3d('0x2f')](_0x1d3c24[_0x1e3d('0x2b')][_0x1e3d('0x30')]);})[_0x1e3d('0x7')](function(_0x1cb360){_0x15b3a0[_0x1e3d('0x2b')][_0x1e3d('0x31')]=_0x1cb360;return _0x3208ab['UserId']?acceptUtils['findAgentById'](_0x3208ab[_0x1e3d('0x2d')]):null;})[_0x1e3d('0x7')](function(_0x1e0ebc){_0x15b3a0[_0x1e3d('0x2b')][_0x1e3d('0x29')]=_0x1e0ebc;if(_0x3208ab[_0x1e3d('0x32')]){var _0x2d2eee={'interface':_0x1e3d('0x33')+_0x49f5c1[_0x1e3d('0x34')],'channel':_0x97e540,'motionChannel':_0x97e540};return acceptUtils['isNewInteraction'](_0x97e540,_0x15b3a0[_0x1e3d('0x2e')]['id'],_0x15b3a0['message']['id'])['then'](function(_0x45eee6){if(_0x45eee6){var _0x44a3e5=Object['assign']({},_0x15b3a0[_0x1e3d('0x2e')],_0x2d2eee,{'contact':_0x15b3a0['message'][_0x1e3d('0x31')]});return acceptUtils[_0x1e3d('0x35')](_0x97e540,_0x44a3e5);}})[_0x1e3d('0x7')](function(){Object[_0x1e3d('0x36')](_0x15b3a0['message'],_0x2d2eee,{'event':_0x1e3d('0x37')});return acceptUtils[_0x1e3d('0x38')](_0x97e540,_0x15b3a0);});}})[_0x1e3d('0x7')](function(){return _0x15b3a0;});}exports[_0x1e3d('0x39')]=acceptMessage; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 8aaea79..85be419 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06a6=['Contact','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','Tag','clause','tags','ids','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','keys','some','compact','and','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','read','filter','capitalize','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','closed','i.substatus','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','i.id','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgDirection','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.fax','o.internal','limit','offset','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','u.id','u.fullname','ui.','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','whatsapp','includes','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','default','text','value','start','end'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x06a6,0xfd));var _0x606a=function(_0x1151fa,_0x2784a7){_0x1151fa=_0x1151fa-0x0;var _0x49da2b=_0x06a6[_0x1151fa];return _0x49da2b;};'use strict';var _=require('lodash');var squel=require(_0x606a('0x0'));var as=require(_0x606a('0x1'));var qs=require(_0x606a('0x2'));var updateInteraction=require('./update-interaction')[_0x606a('0x3')];var utils=require(_0x606a('0x4'));var db=require(_0x606a('0x5'))['db'];function skipInteractionsQuery(_0x21d20d,_0x4654b7,_0x2c0c58){var _0x246296=![];var _0x37b7ca=utils[_0x606a('0x6')](_0x21d20d);if(_0x4654b7[_0x606a('0x7')]===_0x606a('0x8')&&!_0x2c0c58[_0x606a('0x9')]&&!_0x2c0c58[_0x37b7ca]){_0x246296=!![];}return _0x246296;}function getTagsQuery(){return squel[_0x606a('0xa')]()[_0x606a('0xb')]('id')[_0x606a('0xb')](_0x606a('0xc'))[_0x606a('0xb')](_0x606a('0xd'))[_0x606a('0xe')](_0x606a('0xf'));}function getUsersQuery(_0x416b3b,_0x52f7d6){var _0x300f05=utils[_0x606a('0x10')](_0x416b3b);var _0xfd7472=_0x606a('0x11')+_0x416b3b+'_interactions';var _0x3ab565=squel[_0x606a('0xa')]()[_0x606a('0xb')](_0x606a('0x12'))['field'](_0x606a('0x13'))[_0x606a('0xb')](_0x606a('0x14')+_0x300f05)[_0x606a('0xe')](_0xfd7472,'ui')['left_join']('users','u',_0x606a('0x15'));if(_0x52f7d6[_0x606a('0x16')]>0x0){_0x3ab565[_0x606a('0x17')](_0x606a('0x14')+_0x300f05+_0x606a('0x18'),_[_0x606a('0x19')](_0x52f7d6,'id'));}return _0x3ab565;}function getInteractionsQuery(_0x2ed020){var _0x2f122f=utils[_0x606a('0x1a')](_0x2ed020);var _0x579da3=utils[_0x606a('0x6')](_0x2ed020);var _0x2a8d5a=utils[_0x606a('0x10')](_0x2ed020);return squel['select']()[_0x606a('0xe')](_0x2f122f[_0x606a('0x1b')],'i')[_0x606a('0x1c')](_0x606a('0x1d'),'c',_0x606a('0x1e'))[_0x606a('0x1c')](_0x606a('0x1f'),'o',_0x606a('0x20'))[_0x606a('0x1c')](_0x2f122f[_0x606a('0x21')],'a','a.id\x20=\x20i.'+_0x579da3)[_0x606a('0x1c')](_0x2f122f[_0x606a('0x22')],'me',_0x606a('0x23')+_0x2a8d5a+_0x606a('0x24'))['left_join'](_0x2f122f[_0x606a('0x25')],'it',_0x606a('0x26')+_0x2a8d5a+_0x606a('0x24'))[_0x606a('0x1c')]('tools_tags','t',_0x606a('0x27'));}function getSqlClauses(){var _0x4dc77={'body':squel[_0x606a('0x28')](),'contact':squel[_0x606a('0x28')](),'default':squel[_0x606a('0x28')](),'fields':squel[_0x606a('0x28')](),'filter':squel['expr'](),'read':squel[_0x606a('0x28')](),'tags':{'clause':squel[_0x606a('0x28')](),'ids':null},'user':squel[_0x606a('0x28')]()};return _0x4dc77;}function parseTagParameter(_0x34b026){var _0x5d74ef=squel[_0x606a('0x28')]();if(_0x34b026){var _0x4a8cc3=utils[_0x606a('0x29')](_0x34b026);_0x4a8cc3['forEach'](function(_0x14e70c){_0x5d74ef['or'](_0x606a('0x2a'),'%,'+_0x14e70c+',%');});}return _0x5d74ef;}function parseReadParameter(_0x53f742){var _0x3d06f4='';if(_0x53f742){_0x3d06f4='unreadMessages\x20{OPERATOR}\x200';if(_0x53f742==='1'){_0x3d06f4=_0x3d06f4['replace']('{OPERATOR}','=');}else{_0x3d06f4=_0x3d06f4[_0x606a('0x2b')](_0x606a('0x2c'),'>');}}return _0x3d06f4;}function parseSearchFilter(_0x58a9cd,_0x546f82){var _0x385439=squel[_0x606a('0x28')]();if(_0x546f82){var _0x5ed55c=_0x546f82[_0x606a('0x2b')]('\x5c','\x5c\x5c')[_0x606a('0x2b')](/'/g,'\x27\x27');var _0x3c198c=qs[_0x606a('0x2d')](_0x5ed55c);if(qs[_0x606a('0x2e')](_0x5ed55c)){_0x385439['or'](_0x606a('0x2f'),_0x3c198c+'%');if(['sms',_0x606a('0x30')][_0x606a('0x31')](_0x58a9cd)){_0x385439['or']('i.phone\x20LIKE\x20?',_0x3c198c+'%');}else if(_0x58a9cd===_0x606a('0x32')){_0x385439['or']('i.fax\x20LIKE\x20?',_0x3c198c+'%');}else if(_0x58a9cd===_0x606a('0x33')){_0x385439['or'](_0x606a('0x34'),_0x3c198c+'%');}}else if(_0x58a9cd===_0x606a('0x35')&&qs[_0x606a('0x36')](_0x5ed55c)){_0x385439['or'](_0x606a('0x37'),_0x3c198c+'%');}else{if(_0x58a9cd===_0x606a('0x35')){_0x385439['or'](_0x606a('0x38'),qs[_0x606a('0x39')](_0x5ed55c,!![]))['or'](_0x606a('0x3a'),qs[_0x606a('0x39')](_0x5ed55c));}else if(_0x58a9cd!=='fax'){_0x385439['or'](_0x606a('0x3b'),qs[_0x606a('0x39')](_0x5ed55c));}_0x385439['or'](_0x606a('0x3c'),qs[_0x606a('0x39')](_0x5ed55c,!![]),null);}}return _0x385439;}function parseAdvancedSearchFilter(_0x4e95bd,_0x260bb8){var _0xc5f6b4=getSqlClauses();var _0x5d1073=as[_0x606a('0x3d')](_0x4e95bd);var _0x58ee68=_0x5d1073[_0x606a('0x3e')];for(var _0x2ed8fd=0x0;_0x2ed8fd<_0x5d1073[_0x606a('0x3f')]['length'];_0x2ed8fd++){var _0x58e7cc=_0x5d1073['conditions'][_0x2ed8fd];var _0x5dbf4f='i';var _0x471c34=_[_0x606a('0x40')](_0x260bb8,[_0x606a('0xc'),_0x58e7cc[_0x606a('0xb')]]);if(_0x471c34){var _0xba73d3=as[_0x606a('0x41')](_0x5dbf4f,_0x471c34['type'],_0x58e7cc);_0xc5f6b4[_0x606a('0x42')][_0x58ee68](_0xba73d3[_0x606a('0x43')],_0xba73d3[_0x606a('0x44')][_0x606a('0x45')],_0xba73d3[_0x606a('0x44')][_0x606a('0x46')]);}else{switch(_0x58e7cc[_0x606a('0xb')]){case'unreadMessages':var _0x485769=parseReadParameter(_0x58e7cc[_0x606a('0x44')]);_0xc5f6b4['read']['and'](_0x485769);break;case _0x606a('0x47'):if(_0x58e7cc['operator']===_0x606a('0x48')){if(_0x58e7cc[_0x606a('0x44')][_0x606a('0x49')]('\x20')[_0x606a('0x16')]>0x1){_0xc5f6b4[_0x606a('0x4a')][_0x58ee68]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x606a('0x39')](_0x58e7cc[_0x606a('0x44')],!![]),null);}else{var _0x222bd4='%'+_0x58e7cc[_0x606a('0x44')]+'%';_0xc5f6b4[_0x606a('0x4a')][_0x58ee68](_0x606a('0x4b'),_0x222bd4,_0x222bd4,_0x222bd4);}}else{_0x471c34=_[_0x606a('0x40')](_0x260bb8,[_0x606a('0xc'),_0x606a('0x4c')]);_0x58e7cc[_0x606a('0xb')]=_0x606a('0x4c');_0xba73d3=as[_0x606a('0x41')](_0x5dbf4f,_0x471c34[_0x606a('0x4d')],_0x58e7cc);_0xc5f6b4['contact'][_0x58ee68](_0xba73d3['text'],_0xba73d3[_0x606a('0x44')][_0x606a('0x45')],_0xba73d3[_0x606a('0x44')][_0x606a('0x46')]);}break;case _0x606a('0x4e'):var _0x302644=_0x58e7cc[_0x606a('0x44')][_0x606a('0x49')](',')['map'](function(_0x47f09b){return Number(_0x47f09b);});var _0x321014=parseTagParameter(_0x302644);_0xc5f6b4['tags'][_0x606a('0x4f')]['and'](_0x321014);_0xc5f6b4[_0x606a('0x50')][_0x606a('0x51')]=_0x302644;break;case'User':if(_0x58e7cc[_0x606a('0x52')]===_0x606a('0x48')){_0xc5f6b4[_0x606a('0x53')][_0x58ee68](_0x606a('0x54'),'%'+_0x58e7cc['value']+'%',null);}else{_0x471c34=_[_0x606a('0x40')](_0x260bb8,['name',_0x606a('0x55')]);_0x58e7cc[_0x606a('0xb')]=_0x606a('0x55');_0xba73d3=as[_0x606a('0x41')](_0x5dbf4f,_0x471c34[_0x606a('0x4d')],_0x58e7cc);_0xc5f6b4[_0x606a('0x53')][_0x58ee68](_0xba73d3[_0x606a('0x43')],_0xba73d3[_0x606a('0x44')][_0x606a('0x45')],_0xba73d3[_0x606a('0x44')][_0x606a('0x46')]);}break;case _0x606a('0x56'):case'plainBody':_0xba73d3=as[_0x606a('0x41')]('me',null,_0x58e7cc);_0xc5f6b4[_0x606a('0x56')][_0x58ee68](_0xba73d3[_0x606a('0x43')],_0xba73d3[_0x606a('0x44')]['start'],_0xba73d3['value']['end']);break;}}}return _0xc5f6b4;}function parseModelFields(_0x47378b,_0x3da069,_0x5e7702){var _0x3704a9=utils['getAccountFK'](_0x47378b);var _0x25c8e8=squel[_0x606a('0x28')]();var _0x404d5b=_(_0x3da069)[_0x606a('0x57')]()[_0x606a('0x19')](function(_0xd7ee03){return _[_0x606a('0x58')](_0x5e7702,[_0x606a('0xc'),_0xd7ee03])?_0xd7ee03:undefined;})[_0x606a('0x59')]()['value']();if(_0x404d5b[_0x606a('0x16')]>0x0){_0x404d5b['forEach'](function(_0x2039dd){if(_0x2039dd===_0x3704a9){_0x25c8e8[_0x606a('0x5a')]('i.'+_0x3704a9+'\x20IN\x20?',[][_0x606a('0x5b')](_0x3da069[_0x2039dd]));}else if(_0x2039dd==='createdAt'){var _0xd20552=JSON[_0x606a('0x5c')](_0x3da069[_0x2039dd])[_0x606a('0x5d')];var _0x36c315=JSON[_0x606a('0x5c')](_0x3da069[_0x2039dd])[_0x606a('0x5e')];_0x25c8e8['and'](_0x606a('0x5f'),_0xd20552,_0x36c315);}else{if(_0x3da069[_0x2039dd]===_0x606a('0x60')){_0x25c8e8[_0x606a('0x5a')]('i.'+_0x2039dd+_0x606a('0x61'));}else{_0x25c8e8[_0x606a('0x5a')]('i.'+_0x2039dd+_0x606a('0x62'),_0x3da069[_0x2039dd]);}}});}return _0x25c8e8;}function parseQueryParameters(_0x21dfca,_0x54e6af,_0x1d6028){var _0x3e3537=getSqlClauses();return Promise[_0x606a('0x63')]()[_0x606a('0x64')](function(){return parseModelFields(_0x21dfca,_0x54e6af,_0x1d6028);})['then'](function(_0xa9b989){_0x3e3537['fields'][_0x606a('0x5a')](_0xa9b989);return parseReadParameter(_0x54e6af[_0x606a('0x65')]);})[_0x606a('0x64')](function(_0x101186){_0x3e3537[_0x606a('0x65')][_0x606a('0x5a')](_0x101186);return parseTagParameter(_0x54e6af['tag']);})[_0x606a('0x64')](function(_0x1237ad){_0x3e3537[_0x606a('0x50')]['clause'][_0x606a('0x5a')](_0x1237ad);return parseSearchFilter(_0x21dfca,_0x54e6af[_0x606a('0x66')]);})[_0x606a('0x64')](function(_0x10c435){_0x3e3537[_0x606a('0x66')]=_0x10c435;return _0x3e3537;});}function checkAccountsRestrictions(_0x3feb3f,_0xc681d1,_0x8da1f){var _0xbed7f4=utils[_0x606a('0x6')](_0x3feb3f);var _0x191cbf='get'+_[_0x606a('0x67')](_0x3feb3f)+(_0x3feb3f==='chat'?_0x606a('0x68'):_0x606a('0x69'));var _0x302d99=squel[_0x606a('0x28')]();return Promise[_0x606a('0x63')]()[_0x606a('0x64')](function(){if(_0x8da1f[_0x606a('0x9')]&&_0xc681d1[_0x606a('0x7')]==='agent'){return _0xc681d1[_0x191cbf]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x46a81b){if(_0x46a81b){if(_0x46a81b[_0x606a('0x16')]===0x0){_0x302d99['and']('i.'+_0xbed7f4+_0x606a('0x61'));}else{_0x302d99['and']('i.'+_0xbed7f4+_0x606a('0x18'),_['map'](_0x46a81b,'id'));}}else if(!_0x8da1f[_0xbed7f4]){_0x302d99[_0x606a('0x5a')]('i.'+_0xbed7f4+_0x606a('0x6a'));}})[_0x606a('0x64')](function(){return _0x302d99;});}function getClosedOrderClause(_0xbf6bb1,_0x21ef3f){var _0x80333f='';var _0x3ba694=[_0x606a('0x6b'),'i.secondDisposition',_0x606a('0x6c')];if(_0xbf6bb1==='mail'){_0x3ba694[_0x606a('0x6d')]('i.substatus');}if(_0x21ef3f[_0x606a('0x6e')]==='0'&&_0xbf6bb1===_0x606a('0x35')){_0x80333f=_0x606a('0x6f');}else{if(_0x21ef3f[_0x606a('0x6e')]==='1'){_0x3ba694['shift']();}_0x80333f=_0x606a('0x70')+_0x3ba694[_0x606a('0x71')](',\x20')+')';}return _0x80333f;}function getFilteredInteractions(_0x4058e8,_0x3e02e2,_0x2527cb,_0x4602d6){var _0x25ad55=utils[_0x606a('0x10')](_0x4058e8);var _0x3309f7=_['capitalize'](_0x4058e8)+_0x606a('0x72');var _0x4e28a3=[];var _0x5dfcbb=getTagsQuery();var _0x2fa95f={'type':db[_0x606a('0x73')][_0x606a('0x74')][_0x606a('0x75')],'raw':!![]};var _0x53e893=[];var _0x2bb3b8=[];return db[_0x606a('0x76')][_0x606a('0x77')](_0x5dfcbb[_0x606a('0x78')](),_0x2fa95f)[_0x606a('0x64')](function(_0x35e5f2){_0x4e28a3=_[_0x606a('0x79')](_0x35e5f2,'id');_0x2fa95f=_[_0x606a('0x7a')](_0x2fa95f,{'model':db[_0x3309f7],'mapToModel':!![],'nest':!![]});if(_0x2527cb[_0x606a('0x7b')]){_0x4602d6[_0x606a('0x7c')]['forEach'](function(_0x298648){_0x3e02e2[_0x606a('0xb')]('i.'+_0x298648);});}else{_0x3e02e2[_0x606a('0xb')](_0x606a('0x7d'),_0x606a('0x7e'));_0x3e02e2[_0x606a('0xb')]('a.key',_0x606a('0x7f'));_0x3e02e2[_0x606a('0xb')](_0x606a('0x80'),_0x606a('0x81'));if(_0x4058e8==='mail'){_0x3e02e2[_0x606a('0xb')](_0x606a('0x82'),_0x606a('0x83'));_0x3e02e2['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x3e02e2['field'](_0x606a('0x84'));_0x3e02e2[_0x606a('0xb')](_0x606a('0x85'));_0x3e02e2[_0x606a('0xb')](_0x606a('0x86'));_0x3e02e2['field'](_0x606a('0x87'));_0x3e02e2[_0x606a('0xb')]('i.closedAt');_0x3e02e2[_0x606a('0xb')](_0x606a('0x88'));_0x3e02e2[_0x606a('0xb')]('i.lastMsgAt');_0x3e02e2[_0x606a('0xb')](_0x606a('0x89'));_0x3e02e2[_0x606a('0xb')]('i.subject');_0x3e02e2['field']('i.disposition');_0x3e02e2['field']('i.secondDisposition');_0x3e02e2['field'](_0x606a('0x6b'));_0x3e02e2[_0x606a('0xb')]('i.substatus');_0x3e02e2[_0x606a('0xb')](_0x606a('0x8a'));_0x3e02e2[_0x606a('0xb')](_0x606a('0x8b'));_0x3e02e2[_0x606a('0xb')]('i.MailAccountId');_0x3e02e2['field'](_0x606a('0x8c'));}else if(_0x4058e8==='openchannel'){_0x3e02e2['field'](_0x606a('0x8d'),'contactName');}else{_0x3e02e2['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x606a('0x8e'));}if(_0x4058e8!==_0x606a('0x35')){_0x3e02e2[_0x606a('0xb')]('i.*');}_0x3e02e2[_0x606a('0xb')](_0x606a('0x8f'),'Contact.firstName');_0x3e02e2[_0x606a('0xb')](_0x606a('0x90'),_0x606a('0x91'));_0x3e02e2[_0x606a('0xb')](_0x606a('0x92'),_0x606a('0x93'));_0x3e02e2[_0x606a('0xb')](_0x606a('0x94'),'Contact.phone');_0x3e02e2['field']('c.mobile','Contact.mobile');_0x3e02e2[_0x606a('0xb')](_0x606a('0x95'),'Contact.fax');_0x3e02e2[_0x606a('0xb')]('o.fullname','Owner.fullname');_0x3e02e2[_0x606a('0xb')](_0x606a('0x96'),'Owner.internal');_0x3e02e2[_0x606a('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4602d6[_0x606a('0x97')]){_0x3e02e2[_0x606a('0x97')](_0x4602d6[_0x606a('0x97')]);}if(_0x4602d6[_0x606a('0x98')]){_0x3e02e2[_0x606a('0x98')](_0x4602d6['offset']);}return db['sequelize']['query'](_0x3e02e2['toString'](),_0x2fa95f);})['then'](function(_0x47e1e2){_0x53e893=_0x47e1e2;var _0x230669=getUsersQuery(_0x4058e8,_0x53e893);return db[_0x606a('0x76')][_0x606a('0x77')](_0x230669[_0x606a('0x78')](),_0x2fa95f);})['then'](function(_0x4d2765){_0x2bb3b8=_['groupBy'](_0x4d2765,_0x25ad55);if(_0x4058e8==='mail'){return db[_0x606a('0x99')][_0x606a('0x9a')]({'attributes':[_0x606a('0x9b')],'raw':!![]});}})[_0x606a('0x64')](function(_0x25d51a){var _0x22e68c=_0x25d51a?_0x25d51a['enableEmailPreview']:undefined;var _0x1d6815=_0x53e893[_0x606a('0x19')](function(_0x2f2218){return updateInteraction(_0x2f2218,_0x4e28a3,_0x2bb3b8,_0x22e68c);});return Promise[_0x606a('0x9c')](_0x1d6815);});}function countFilteredInteractions(_0x5998dc,_0x4e12e5){var _0x3002a0=_0x5998dc[_0x606a('0x9d')]();_0x3002a0[_0x606a('0xb')](_0x606a('0x9e'));_0x3002a0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x606a('0x7e'));var _0x495bad=utils[_0x606a('0x29')](_0x4e12e5);if(!_[_0x606a('0x9f')](_0x495bad)){_0x3002a0[_0x606a('0x17')](_0x606a('0xa0'),_0x495bad);}var _0x362ad1={'type':db[_0x606a('0x73')][_0x606a('0x74')][_0x606a('0x75')],'raw':!![]};return db[_0x606a('0x76')][_0x606a('0x77')](_0x3002a0[_0x606a('0x78')](),_0x362ad1);}module[_0x606a('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x8a3c=['merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closedAt','i.lastMsgDirection','i.thirdDisposition','i.ContactId','i.MailAccountId','i.UserId','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.email','c.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','sequelize','toString','findOne','enableEmailPreview','clone','COUNT(*)','getSelectedTags','where','t.id\x20IN\x20?','SELECT','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','agent','search','field','name','color','from','tools_tags','_interactions','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','ui.','getInteractionsTables','getAccountFK','getInteractionFK','select','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','i.id\x20LIKE\x20?','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','length','find','buildExpression','type','default','text','value','start','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','map','tags','ids','user','UserId','body','keys','some','compact','\x20IN\x20?','createdAt','parse','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','clause','capitalize','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','query','keyBy'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8a3c,0xcb));var _0xc8a3=function(_0x3a0614,_0x4b6627){_0x3a0614=_0x3a0614-0x0;var _0x12bba7=_0x8a3c[_0x3a0614];return _0x12bba7;};'use strict';var _=require(_0xc8a3('0x0'));var squel=require('squel');var as=require(_0xc8a3('0x1'));var qs=require(_0xc8a3('0x2'));var updateInteraction=require(_0xc8a3('0x3'))[_0xc8a3('0x4')];var utils=require(_0xc8a3('0x5'));var db=require(_0xc8a3('0x6'))['db'];function skipInteractionsQuery(_0x2a17d8,_0x1f4c7d,_0x5b62ee){var _0x163024=![];var _0x931874=utils['getAccountFK'](_0x2a17d8);if(_0x1f4c7d['role']===_0xc8a3('0x7')&&!_0x5b62ee[_0xc8a3('0x8')]&&!_0x5b62ee[_0x931874]){_0x163024=!![];}return _0x163024;}function getTagsQuery(){return squel['select']()[_0xc8a3('0x9')]('id')[_0xc8a3('0x9')](_0xc8a3('0xa'))['field'](_0xc8a3('0xb'))[_0xc8a3('0xc')](_0xc8a3('0xd'));}function getUsersQuery(_0x134d4f,_0x13704f){var _0x39b679=utils['getInteractionFK'](_0x134d4f);var _0x5410fc='user_has_'+_0x134d4f+_0xc8a3('0xe');var _0x105a7b=squel['select']()[_0xc8a3('0x9')](_0xc8a3('0xf'))['field'](_0xc8a3('0x10'))['field']('ui.'+_0x39b679)[_0xc8a3('0xc')](_0x5410fc,'ui')[_0xc8a3('0x11')](_0xc8a3('0x12'),'u',_0xc8a3('0x13'));if(_0x13704f['length']>0x0){_0x105a7b['where'](_0xc8a3('0x14')+_0x39b679+'\x20IN\x20?',_['map'](_0x13704f,'id'));}return _0x105a7b;}function getInteractionsQuery(_0x3feddd){var _0x124f3a=utils[_0xc8a3('0x15')](_0x3feddd);var _0x573f66=utils[_0xc8a3('0x16')](_0x3feddd);var _0x515afe=utils[_0xc8a3('0x17')](_0x3feddd);return squel[_0xc8a3('0x18')]()[_0xc8a3('0xc')](_0x124f3a[_0xc8a3('0x19')],'i')['left_join'](_0xc8a3('0x1a'),'c',_0xc8a3('0x1b'))['left_join'](_0xc8a3('0x12'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x124f3a[_0xc8a3('0x1c')],'a',_0xc8a3('0x1d')+_0x573f66)[_0xc8a3('0x11')](_0x124f3a['messages'],'me',_0xc8a3('0x1e')+_0x515afe+_0xc8a3('0x1f'))['left_join'](_0x124f3a[_0xc8a3('0x20')],'it',_0xc8a3('0x21')+_0x515afe+_0xc8a3('0x1f'))['left_join'](_0xc8a3('0xd'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x2d132f={'body':squel[_0xc8a3('0x22')](),'contact':squel[_0xc8a3('0x22')](),'default':squel[_0xc8a3('0x22')](),'fields':squel['expr'](),'filter':squel[_0xc8a3('0x22')](),'read':squel[_0xc8a3('0x22')](),'tags':{'clause':squel[_0xc8a3('0x22')](),'ids':null},'user':squel[_0xc8a3('0x22')]()};return _0x2d132f;}function parseTagParameter(_0x4231f3){var _0x3e6650=squel['expr']();if(_0x4231f3){var _0x49849f=utils['getSelectedTags'](_0x4231f3);_0x49849f[_0xc8a3('0x23')](function(_0x39f6d3){_0x3e6650['or'](_0xc8a3('0x24'),'%,'+_0x39f6d3+',%');});}return _0x3e6650;}function parseReadParameter(_0xa25341){var _0x536182='';if(_0xa25341){_0x536182=_0xc8a3('0x25');if(_0xa25341==='1'){_0x536182=_0x536182[_0xc8a3('0x26')](_0xc8a3('0x27'),'=');}else{_0x536182=_0x536182[_0xc8a3('0x26')](_0xc8a3('0x27'),'>');}}return _0x536182;}function parseSearchFilter(_0x83af6b,_0x47a6f3){var _0x46a046=squel['expr']();if(_0x47a6f3){var _0x167195=_0x47a6f3[_0xc8a3('0x26')]('\x5c','\x5c\x5c')[_0xc8a3('0x26')](/'/g,'\x27\x27');var _0x5a982c=qs[_0xc8a3('0x28')](_0x167195);if(qs['isNumeric'](_0x167195)){_0x46a046['or'](_0xc8a3('0x29'),_0x5a982c+'%');if(['sms',_0xc8a3('0x2a')][_0xc8a3('0x2b')](_0x83af6b)){_0x46a046['or'](_0xc8a3('0x2c'),_0x5a982c+'%');}else if(_0x83af6b===_0xc8a3('0x2d')){_0x46a046['or']('i.fax\x20LIKE\x20?',_0x5a982c+'%');}else if(_0x83af6b==='openchannel'){_0x46a046['or'](_0xc8a3('0x2e'),_0x5a982c+'%');}}else if(_0x83af6b===_0xc8a3('0x2f')&&qs['isEmail'](_0x167195)){_0x46a046['or'](_0xc8a3('0x30'),_0x5a982c+'%');}else{if(_0x83af6b==='mail'){_0x46a046['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc8a3('0x31')](_0x167195,!![]))['or'](_0xc8a3('0x32'),qs[_0xc8a3('0x31')](_0x167195));}else if(_0x83af6b!==_0xc8a3('0x2d')){_0x46a046['or'](_0xc8a3('0x33'),qs[_0xc8a3('0x31')](_0x167195));}_0x46a046['or'](_0xc8a3('0x34'),qs[_0xc8a3('0x31')](_0x167195,!![]),null);}}return _0x46a046;}function parseAdvancedSearchFilter(_0x5cd4ec,_0x5dbc67){var _0x349d76=getSqlClauses();var _0x989711=as['parseSearch'](_0x5cd4ec);var _0x3d0af6=_0x989711[_0xc8a3('0x35')];for(var _0x4ee1bf=0x0;_0x4ee1bf<_0x989711[_0xc8a3('0x36')][_0xc8a3('0x37')];_0x4ee1bf++){var _0x479d3f=_0x989711[_0xc8a3('0x36')][_0x4ee1bf];var _0x2147dd='i';var _0x4e8765=_[_0xc8a3('0x38')](_0x5dbc67,[_0xc8a3('0xa'),_0x479d3f[_0xc8a3('0x9')]]);if(_0x4e8765){var _0x59ffa9=as[_0xc8a3('0x39')](_0x2147dd,_0x4e8765[_0xc8a3('0x3a')],_0x479d3f);_0x349d76[_0xc8a3('0x3b')][_0x3d0af6](_0x59ffa9[_0xc8a3('0x3c')],_0x59ffa9[_0xc8a3('0x3d')][_0xc8a3('0x3e')],_0x59ffa9['value'][_0xc8a3('0x3f')]);}else{switch(_0x479d3f[_0xc8a3('0x9')]){case _0xc8a3('0x40'):var _0x5cfab2=parseReadParameter(_0x479d3f[_0xc8a3('0x3d')]);_0x349d76[_0xc8a3('0x41')][_0xc8a3('0x42')](_0x5cfab2);break;case _0xc8a3('0x43'):if(_0x479d3f[_0xc8a3('0x44')]===_0xc8a3('0x45')){if(_0x479d3f[_0xc8a3('0x3d')][_0xc8a3('0x46')]('\x20')[_0xc8a3('0x37')]>0x1){_0x349d76[_0xc8a3('0x47')][_0x3d0af6](_0xc8a3('0x34'),qs[_0xc8a3('0x31')](_0x479d3f[_0xc8a3('0x3d')],!![]),null);}else{var _0x42029b='%'+_0x479d3f['value']+'%';_0x349d76[_0xc8a3('0x47')][_0x3d0af6](_0xc8a3('0x48'),_0x42029b,_0x42029b,_0x42029b);}}else{_0x4e8765=_['find'](_0x5dbc67,['name',_0xc8a3('0x49')]);_0x479d3f[_0xc8a3('0x9')]=_0xc8a3('0x49');_0x59ffa9=as[_0xc8a3('0x39')](_0x2147dd,_0x4e8765['type'],_0x479d3f);_0x349d76[_0xc8a3('0x47')][_0x3d0af6](_0x59ffa9[_0xc8a3('0x3c')],_0x59ffa9[_0xc8a3('0x3d')]['start'],_0x59ffa9['value'][_0xc8a3('0x3f')]);}break;case'Tag':var _0x260ca5=_0x479d3f[_0xc8a3('0x3d')][_0xc8a3('0x46')](',')[_0xc8a3('0x4a')](function(_0x3b6429){return Number(_0x3b6429);});var _0xe10187=parseTagParameter(_0x260ca5);_0x349d76['tags']['clause'][_0xc8a3('0x42')](_0xe10187);_0x349d76[_0xc8a3('0x4b')][_0xc8a3('0x4c')]=_0x260ca5;break;case'User':if(_0x479d3f[_0xc8a3('0x44')]===_0xc8a3('0x45')){_0x349d76[_0xc8a3('0x4d')][_0x3d0af6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x479d3f[_0xc8a3('0x3d')]+'%',null);}else{_0x4e8765=_[_0xc8a3('0x38')](_0x5dbc67,[_0xc8a3('0xa'),'UserId']);_0x479d3f['field']=_0xc8a3('0x4e');_0x59ffa9=as[_0xc8a3('0x39')](_0x2147dd,_0x4e8765[_0xc8a3('0x3a')],_0x479d3f);_0x349d76[_0xc8a3('0x4d')][_0x3d0af6](_0x59ffa9[_0xc8a3('0x3c')],_0x59ffa9[_0xc8a3('0x3d')][_0xc8a3('0x3e')],_0x59ffa9[_0xc8a3('0x3d')][_0xc8a3('0x3f')]);}break;case _0xc8a3('0x4f'):case'plainBody':_0x59ffa9=as[_0xc8a3('0x39')]('me',null,_0x479d3f);_0x349d76[_0xc8a3('0x4f')][_0x3d0af6](_0x59ffa9[_0xc8a3('0x3c')],_0x59ffa9['value'][_0xc8a3('0x3e')],_0x59ffa9[_0xc8a3('0x3d')]['end']);break;}}}return _0x349d76;}function parseModelFields(_0x176b24,_0x3c4c35,_0x14bf77){var _0x202314=utils['getAccountFK'](_0x176b24);var _0x248898=squel[_0xc8a3('0x22')]();var _0x48a270=_(_0x3c4c35)[_0xc8a3('0x50')]()[_0xc8a3('0x4a')](function(_0x958cbb){return _[_0xc8a3('0x51')](_0x14bf77,[_0xc8a3('0xa'),_0x958cbb])?_0x958cbb:undefined;})[_0xc8a3('0x52')]()[_0xc8a3('0x3d')]();if(_0x48a270[_0xc8a3('0x37')]>0x0){_0x48a270[_0xc8a3('0x23')](function(_0x3e7579){if(_0x3e7579===_0x202314){_0x248898[_0xc8a3('0x42')]('i.'+_0x202314+_0xc8a3('0x53'),[]['concat'](_0x3c4c35[_0x3e7579]));}else if(_0x3e7579===_0xc8a3('0x54')){var _0x1d42d2=JSON['parse'](_0x3c4c35[_0x3e7579])['$gte'];var _0x5f5e18=JSON[_0xc8a3('0x55')](_0x3c4c35[_0x3e7579])['$lte'];_0x248898[_0xc8a3('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1d42d2,_0x5f5e18);}else{if(_0x3c4c35[_0x3e7579]===_0xc8a3('0x56')){_0x248898['and']('i.'+_0x3e7579+_0xc8a3('0x57'));}else{_0x248898[_0xc8a3('0x42')]('i.'+_0x3e7579+_0xc8a3('0x58'),_0x3c4c35[_0x3e7579]);}}});}return _0x248898;}function parseQueryParameters(_0x107798,_0x44c04c,_0x34e556){var _0x1fc2e8=getSqlClauses();return Promise[_0xc8a3('0x59')]()[_0xc8a3('0x5a')](function(){return parseModelFields(_0x107798,_0x44c04c,_0x34e556);})[_0xc8a3('0x5a')](function(_0x18df54){_0x1fc2e8[_0xc8a3('0x5b')][_0xc8a3('0x42')](_0x18df54);return parseReadParameter(_0x44c04c[_0xc8a3('0x41')]);})[_0xc8a3('0x5a')](function(_0x12a22a){_0x1fc2e8[_0xc8a3('0x41')][_0xc8a3('0x42')](_0x12a22a);return parseTagParameter(_0x44c04c[_0xc8a3('0x5c')]);})[_0xc8a3('0x5a')](function(_0x317a4f){_0x1fc2e8[_0xc8a3('0x4b')][_0xc8a3('0x5d')][_0xc8a3('0x42')](_0x317a4f);return parseSearchFilter(_0x107798,_0x44c04c['filter']);})[_0xc8a3('0x5a')](function(_0x3850c3){_0x1fc2e8['filter']=_0x3850c3;return _0x1fc2e8;});}function checkAccountsRestrictions(_0x256912,_0xff7e12,_0x199160){var _0x27cfa2=utils[_0xc8a3('0x16')](_0x256912);var _0x128875='get'+_[_0xc8a3('0x5e')](_0x256912)+(_0x256912===_0xc8a3('0x5f')?_0xc8a3('0x60'):_0xc8a3('0x61'));var _0x273136=squel['expr']();return Promise[_0xc8a3('0x59')]()['then'](function(){if(_0x199160[_0xc8a3('0x8')]&&_0xff7e12['role']===_0xc8a3('0x7')){return _0xff7e12[_0x128875]({'attributes':['id'],'raw':!![]});}})[_0xc8a3('0x5a')](function(_0x2e738a){if(_0x2e738a){if(_0x2e738a[_0xc8a3('0x37')]===0x0){_0x273136[_0xc8a3('0x42')]('i.'+_0x27cfa2+'\x20IS\x20NULL');}else{_0x273136[_0xc8a3('0x42')]('i.'+_0x27cfa2+_0xc8a3('0x53'),_[_0xc8a3('0x4a')](_0x2e738a,'id'));}}else if(!_0x199160[_0x27cfa2]){_0x273136[_0xc8a3('0x42')]('i.'+_0x27cfa2+_0xc8a3('0x62'));}})[_0xc8a3('0x5a')](function(){return _0x273136;});}function getClosedOrderClause(_0xfaaf80,_0x5aacad){var _0x5eb1d1='';var _0x3c931e=['i.thirdDisposition',_0xc8a3('0x63'),_0xc8a3('0x64')];if(_0xfaaf80===_0xc8a3('0x2f')){_0x3c931e[_0xc8a3('0x65')]('i.substatus');}if(_0x5aacad['closed']==='0'&&_0xfaaf80==='mail'){_0x5eb1d1='i.substatus';}else{if(_0x5aacad[_0xc8a3('0x66')]==='1'){_0x3c931e[_0xc8a3('0x67')]();}_0x5eb1d1=_0xc8a3('0x68')+_0x3c931e[_0xc8a3('0x69')](',\x20')+')';}return _0x5eb1d1;}function getFilteredInteractions(_0x525d06,_0x3741be,_0x26e53a,_0x394164){var _0x208887=utils[_0xc8a3('0x17')](_0x525d06);var _0x3a9f84=_[_0xc8a3('0x5e')](_0x525d06)+_0xc8a3('0x6a');var _0xdc6112=[];var _0x28e604=getTagsQuery();var _0xaaebc9={'type':db[_0xc8a3('0x6b')][_0xc8a3('0x6c')]['SELECT'],'raw':!![]};var _0x56e759=[];var _0x429c46=[];return db['sequelize'][_0xc8a3('0x6d')](_0x28e604['toString'](),_0xaaebc9)['then'](function(_0x478eab){_0xdc6112=_[_0xc8a3('0x6e')](_0x478eab,'id');_0xaaebc9=_[_0xc8a3('0x6f')](_0xaaebc9,{'model':db[_0x3a9f84],'mapToModel':!![],'nest':!![]});if(_0x26e53a[_0xc8a3('0x5b')]){_0x394164[_0xc8a3('0x70')]['forEach'](function(_0x42ecb3){_0x3741be[_0xc8a3('0x9')]('i.'+_0x42ecb3);});}else{_0x3741be['field'](_0xc8a3('0x71'),_0xc8a3('0x40'));_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x72'),_0xc8a3('0x73'));_0x3741be['field']('a.mandatoryDisposition',_0xc8a3('0x74'));if(_0x525d06===_0xc8a3('0x2f')){_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x75'),_0xc8a3('0x76'));_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x77'),_0xc8a3('0x78'));_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x79'));_0x3741be['field'](_0xc8a3('0x7a'));_0x3741be['field'](_0xc8a3('0x7b'));_0x3741be[_0xc8a3('0x9')]('i.closed');_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x7c'));_0x3741be['field']('i.attach');_0x3741be['field']('i.lastMsgAt');_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x7d'));_0x3741be[_0xc8a3('0x9')]('i.subject');_0x3741be[_0xc8a3('0x9')]('i.disposition');_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x63'));_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x7e'));_0x3741be[_0xc8a3('0x9')]('i.substatus');_0x3741be[_0xc8a3('0x9')]('i.to');_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x7f'));_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x80'));_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x81'));}else if(_0x525d06==='openchannel'){_0x3741be[_0xc8a3('0x9')]('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',_0xc8a3('0x78'));}else{_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x82'),_0xc8a3('0x78'));}if(_0x525d06!==_0xc8a3('0x2f')){_0x3741be[_0xc8a3('0x9')]('i.*');}_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x83'),_0xc8a3('0x84'));_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x85'),_0xc8a3('0x86'));_0x3741be['field'](_0xc8a3('0x87'),'Contact.email');_0x3741be['field'](_0xc8a3('0x88'),'Contact.phone');_0x3741be['field']('c.mobile',_0xc8a3('0x89'));_0x3741be['field'](_0xc8a3('0x8a'),_0xc8a3('0x8b'));_0x3741be[_0xc8a3('0x9')]('o.fullname',_0xc8a3('0x8c'));_0x3741be[_0xc8a3('0x9')](_0xc8a3('0x8d'),_0xc8a3('0x8e'));_0x3741be['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc8a3('0x8f'));}if(_0x394164[_0xc8a3('0x90')]){_0x3741be[_0xc8a3('0x90')](_0x394164[_0xc8a3('0x90')]);}if(_0x394164[_0xc8a3('0x91')]){_0x3741be['offset'](_0x394164['offset']);}return db[_0xc8a3('0x92')][_0xc8a3('0x6d')](_0x3741be[_0xc8a3('0x93')](),_0xaaebc9);})[_0xc8a3('0x5a')](function(_0x319444){_0x56e759=_0x319444;var _0x42dd8c=getUsersQuery(_0x525d06,_0x56e759);return db[_0xc8a3('0x92')]['query'](_0x42dd8c[_0xc8a3('0x93')](),_0xaaebc9);})['then'](function(_0x4c2ca9){_0x429c46=_['groupBy'](_0x4c2ca9,_0x208887);if(_0x525d06===_0xc8a3('0x2f')){return db['Setting'][_0xc8a3('0x94')]({'attributes':[_0xc8a3('0x95')],'raw':!![]});}})['then'](function(_0x4a887d){var _0x2323ba=_0x4a887d?_0x4a887d[_0xc8a3('0x95')]:undefined;var _0x2242f0=_0x56e759[_0xc8a3('0x4a')](function(_0xd761f5){return updateInteraction(_0xd761f5,_0xdc6112,_0x429c46,_0x2323ba);});return Promise['all'](_0x2242f0);});}function countFilteredInteractions(_0x4359a0,_0x1ce813){var _0x1704ad=_0x4359a0[_0xc8a3('0x96')]();_0x1704ad[_0xc8a3('0x9')](_0xc8a3('0x97'));_0x1704ad['field'](_0xc8a3('0x71'),_0xc8a3('0x40'));var _0x25477e=utils[_0xc8a3('0x98')](_0x1ce813);if(!_['isEmpty'](_0x25477e)){_0x1704ad[_0xc8a3('0x99')](_0xc8a3('0x9a'),_0x25477e);}var _0x5d7877={'type':db[_0xc8a3('0x6b')][_0xc8a3('0x6c')][_0xc8a3('0x9b')],'raw':!![]};return db[_0xc8a3('0x92')][_0xc8a3('0x6d')](_0x1704ad[_0xc8a3('0x93')](),_0x5d7877);}module[_0xc8a3('0x9c')]={'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 b8f7164..dbc66ea 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 _0xfd3b=['findOne','plainBody','then','lastMsgText','catch','Users','TagIds','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','closed','disposition','UserId','total','MailMessage'];(function(_0x306af6,_0x46411e){var _0x48010b=function(_0x455d42){while(--_0x455d42){_0x306af6['push'](_0x306af6['shift']());}};_0x48010b(++_0x46411e);}(_0xfd3b,0x127));var _0xbfd3=function(_0x5a5bf9,_0x1179f1){_0x5a5bf9=_0x5a5bf9-0x0;var _0x221813=_0xfd3b[_0x5a5bf9];return _0x221813;};'use strict';var _=require(_0xbfd3('0x0'));var db=require(_0xbfd3('0x1'))['db'];function getInteractionUsers(_0x2df456,_0x5529ae){return new Promise(function(_0x2c4505,_0x5a2a31){try{var _0x427250=[];if(_0x5529ae[_0x2df456]){_0x427250=_0x5529ae[_0x2df456][_0xbfd3('0x2')](function(_0x5d58b3){return{'id':_0x5d58b3['id'],'fullname':_0x5d58b3[_0xbfd3('0x3')]};});}return _0x2c4505(_0x427250);}catch(_0x2d7bcd){_0x5a2a31(_0x2d7bcd);}});}function getInteractionTags(_0x35f91a,_0x45c8c0){var _0x585265=[];if(_0x35f91a){_0x35f91a[_0xbfd3('0x4')](',')[_0xbfd3('0x5')](function(_0x25b36d){_0x585265[_0xbfd3('0x6')](_0x45c8c0[_0x25b36d]);});}return _0x585265;}function updateWaitingCounter(_0x471b26){if(_0x471b26['waiting']){_0x471b26[_0xbfd3('0x7')]-=0x1;}}function updateInteractionCounters(_0x15861d){_0x15861d[_0xbfd3('0x7')]=0x0;_0x15861d[_0xbfd3('0x8')]=0x0;_0x15861d[_0xbfd3('0x9')]=0x0;_0x15861d[_0xbfd3('0xa')]=0x0;_0x15861d[_0xbfd3('0xb')]=0x0;_0x15861d['total']=0x0;if(_0x15861d[_0xbfd3('0xc')]){if(_0x15861d[_0xbfd3('0xd')]==='abandoned'){_0x15861d[_0xbfd3('0xb')]+=0x1;updateWaitingCounter(_0x15861d);}if(_0x15861d['UserId']){_0x15861d[_0xbfd3('0x9')]+=0x1;if(_0x15861d['talking']){_0x15861d[_0xbfd3('0x8')]-=0x1;}}else{if(_0x15861d['disposition']){_0x15861d[_0xbfd3('0xa')]+=0x1;updateWaitingCounter(_0x15861d);}}}else{if(!_0x15861d['UserId']){_0x15861d[_0xbfd3('0x7')]+=0x1;}if(_0x15861d[_0xbfd3('0xe')]){_0x15861d[_0xbfd3('0x8')]+=0x1;updateWaitingCounter(_0x15861d);}}_0x15861d[_0xbfd3('0xf')]+=0x1;return _0x15861d;}function getLastMessageText(_0x284d3a){return db[_0xbfd3('0x10')][_0xbfd3('0x11')]({'where':{'$and':[{'MailInteractionId':_0x284d3a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xbfd3('0x12')],'order':'-id','raw':!![]})[_0xbfd3('0x13')](function(_0x166531){if(_0x166531&&_0x166531[_0xbfd3('0x12')]){_0x284d3a[_0xbfd3('0x14')]=_['trimStart'](_0x166531[_0xbfd3('0x12')]);}return _0x284d3a;})[_0xbfd3('0x15')](function(_0x39405b){throw _0x39405b;});}exports['updateInteraction']=function(_0x4a59ac,_0xf64bbb,_0x28a5a5,_0x181d64){return new Promise(function(_0x547335,_0x2be498){return getInteractionUsers(_0x4a59ac['id'],_0x28a5a5)[_0xbfd3('0x13')](function(_0x3621e4){_0x4a59ac[_0xbfd3('0x16')]=_0x3621e4;return getInteractionTags(_0x4a59ac[_0xbfd3('0x17')],_0xf64bbb);})[_0xbfd3('0x13')](function(_0x4b3971){_0x4a59ac['Tags']=_0x4b3971;delete _0x4a59ac[_0xbfd3('0x17')];return updateInteractionCounters(_0x4a59ac);})[_0xbfd3('0x13')](function(_0x58846b){if(_0x181d64){return getLastMessageText(_0x58846b);}else{return _0x58846b;}})[_0xbfd3('0x13')](function(_0x585c0c){_0x547335(_0x585c0c);})[_0xbfd3('0x15')](function(_0x1170a8){_0x2be498(_0x1170a8);});});}; \ No newline at end of file +var _0x9470=['disposition','UserId','MailMessage','findOne','plainBody','then','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','TagIds','lodash','../../mysqldb','map','fullname','split','push','waiting','talking','answered','abandoned','total','closed'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x9470,0x71));var _0x0947=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0x9470[_0x47df54];return _0x261b87;};'use strict';var _=require(_0x0947('0x0'));var db=require(_0x0947('0x1'))['db'];function getInteractionUsers(_0x1a272e,_0x4163e6){return new Promise(function(_0x574eb1,_0x929811){try{var _0x15d1c0=[];if(_0x4163e6[_0x1a272e]){_0x15d1c0=_0x4163e6[_0x1a272e][_0x0947('0x2')](function(_0x84c5b8){return{'id':_0x84c5b8['id'],'fullname':_0x84c5b8[_0x0947('0x3')]};});}return _0x574eb1(_0x15d1c0);}catch(_0x6b2092){_0x929811(_0x6b2092);}});}function getInteractionTags(_0x37f603,_0x2d736d){var _0x3d0b2c=[];if(_0x37f603){_0x37f603[_0x0947('0x4')](',')['forEach'](function(_0x569fb0){_0x3d0b2c[_0x0947('0x5')](_0x2d736d[_0x569fb0]);});}return _0x3d0b2c;}function updateWaitingCounter(_0x20989b){if(_0x20989b[_0x0947('0x6')]){_0x20989b['waiting']-=0x1;}}function updateInteractionCounters(_0x1ec994){_0x1ec994['waiting']=0x0;_0x1ec994[_0x0947('0x7')]=0x0;_0x1ec994[_0x0947('0x8')]=0x0;_0x1ec994['unmanaged']=0x0;_0x1ec994[_0x0947('0x9')]=0x0;_0x1ec994[_0x0947('0xa')]=0x0;if(_0x1ec994[_0x0947('0xb')]){if(_0x1ec994[_0x0947('0xc')]===_0x0947('0x9')){_0x1ec994['abandoned']+=0x1;updateWaitingCounter(_0x1ec994);}if(_0x1ec994[_0x0947('0xd')]){_0x1ec994['answered']+=0x1;if(_0x1ec994[_0x0947('0x7')]){_0x1ec994[_0x0947('0x7')]-=0x1;}}else{if(_0x1ec994[_0x0947('0xc')]){_0x1ec994['unmanaged']+=0x1;updateWaitingCounter(_0x1ec994);}}}else{if(!_0x1ec994[_0x0947('0xd')]){_0x1ec994[_0x0947('0x6')]+=0x1;}if(_0x1ec994[_0x0947('0xd')]){_0x1ec994[_0x0947('0x7')]+=0x1;updateWaitingCounter(_0x1ec994);}}_0x1ec994[_0x0947('0xa')]+=0x1;return _0x1ec994;}function getLastMessageText(_0x232d7d){return db[_0x0947('0xe')][_0x0947('0xf')]({'where':{'$and':[{'MailInteractionId':_0x232d7d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0947('0x10')],'order':'-id','raw':!![]})[_0x0947('0x11')](function(_0x1f2be1){if(_0x1f2be1&&_0x1f2be1[_0x0947('0x10')]){_0x232d7d[_0x0947('0x12')]=_[_0x0947('0x13')](_0x1f2be1['plainBody']);}return _0x232d7d;})[_0x0947('0x14')](function(_0x4d6261){throw _0x4d6261;});}exports[_0x0947('0x15')]=function(_0x58e932,_0x50288b,_0x3b9c82,_0x25c6eb){return new Promise(function(_0x319040,_0x21afc6){return getInteractionUsers(_0x58e932['id'],_0x3b9c82)[_0x0947('0x11')](function(_0x48fe30){_0x58e932[_0x0947('0x16')]=_0x48fe30;return getInteractionTags(_0x58e932['TagIds'],_0x50288b);})['then'](function(_0x2a5a68){_0x58e932[_0x0947('0x17')]=_0x2a5a68;delete _0x58e932[_0x0947('0x18')];return updateInteractionCounters(_0x58e932);})[_0x0947('0x11')](function(_0x34c9e6){if(_0x25c6eb){return getLastMessageText(_0x34c9e6);}else{return _0x34c9e6;}})[_0x0947('0x11')](function(_0x142cfd){_0x319040(_0x142cfd);})[_0x0947('0x14')](function(_0x54fddc){_0x21afc6(_0x54fddc);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 44db35b..e66263a 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 _0xab9e=['fax-interactions','sms-interactions','chat-interactions','capitalize','chat','Account','InteractionId','upperFirst','unknown','accounts','_interaction_has_tags','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','info','catch','\x20name=','\x20interaction=','\x20body=','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0xe36206,_0x2cc107){var _0x44e619=function(_0x3021a8){while(--_0x3021a8){_0xe36206['push'](_0xe36206['shift']());}};_0x44e619(++_0x2cc107);}(_0xab9e,0x104));var _0xeab9=function(_0x595647,_0x11e406){_0x595647=_0x595647-0x0;var _0x15e36e=_0xab9e[_0x595647];return _0x15e36e;};'use strict';var _=require('lodash');var db=require(_0xeab9('0x0'))['db'];var loggers={'openchannel':require(_0xeab9('0x1'))(_0xeab9('0x2')),'mail':require('../../config/logger')(_0xeab9('0x3')),'fax':require(_0xeab9('0x1'))(_0xeab9('0x4')),'sms':require(_0xeab9('0x1'))(_0xeab9('0x5')),'chat':require('../../config/logger')(_0xeab9('0x6')),'whatsapp':require(_0xeab9('0x1'))('whatsapp-interactions')};function getAccountFK(_0x5f394e){return _[_0xeab9('0x7')](_0x5f394e)+(_0x5f394e===_0xeab9('0x8')?'Website':_0xeab9('0x9'))+'Id';}function getInteractionFK(_0x18d9e6){return _[_0xeab9('0x7')](_0x18d9e6)+_0xeab9('0xa');}function getInteractionId(_0x199071,_0x139d4a,_0x4d3c2c){if(_0x199071&&_0x199071[_['upperFirst'](_0x4d3c2c)+_0xeab9('0xa')]){return _0x199071[_[_0xeab9('0xb')](_0x4d3c2c)+_0xeab9('0xa')];}else if(_0x199071&&_0x199071['id']){return _0x199071['id'];}else if(_0x139d4a&&_0x139d4a['id']){return _0x139d4a['id'];}else{return _0xeab9('0xc');}}function getInteractionsTables(_0x1b1605){return{'accounts':_0x1b1605+'_'+(_0x1b1605===_0xeab9('0x8')?'websites':_0xeab9('0xd')),'interactions':_0x1b1605+'_interactions','interactionsTags':_0x1b1605+_0xeab9('0xe'),'messages':_0x1b1605+'_messages','userInteractions':'user_has_'+_0x1b1605+_0xeab9('0xf')};}function getSelectedTags(_0x1260bf){var _0x18af32=[];if(_0x1260bf){_0x18af32=Array[_0xeab9('0x10')](_0x1260bf)?_0x1260bf:[_0x1260bf];}return _0x18af32;}function log(_0x3a25a3,_0x3a5d04,_0x57c36a,_0x2828c4,_0x2f3cc6,_0xfab400){loggers[_0x2f3cc6[_0xeab9('0x11')]()][_0x3a25a3](_0xeab9('0x12'),_0xfab400[_0xeab9('0x13')](),_0x3a5d04?_0x3a5d04['id']:null,_0x3a5d04?_0x3a5d04[_0xeab9('0x14')]:null,_0x3a5d04?_0x3a5d04[_0xeab9('0x15')]:null,getInteractionId(_0x57c36a,_0x2828c4,_0x2f3cc6),_0x57c36a?JSON[_0xeab9('0x16')](_0x57c36a):_0xeab9('0x17'));}function updateUser(_0x31dbda,_0x25d737,_0x1b06ab,_0x20b9e0,_0x1acc02){db[_[_0xeab9('0xb')](_0x20b9e0)+_0xeab9('0x18')][_0xeab9('0x19')]({'where':{'id':getInteractionId(_0x25d737,_0x1b06ab,_0x20b9e0)}})[_0xeab9('0x1a')](function(_0x4a6c34){if(_0x4a6c34){return _0x4a6c34['update']({'UserId':_0x31dbda?_0x31dbda['id']:null});}})[_0xeab9('0x1a')](function(_0x1d7c2a){if(_0x1d7c2a){log(_0xeab9('0x1b'),_0x31dbda,_0x25d737,_0x1b06ab,_0x20b9e0,_0x1acc02);}})[_0xeab9('0x1c')](function(){log('error',_0x31dbda,_0x25d737,_0x1b06ab,_0x20b9e0,_0x1acc02);});}function logAcceptMessage(_0x5bd1c2,_0x1e3413,_0x14687f,_0x1c7dcb){var _0x4fd84d=loggers[_0x5bd1c2[_0xeab9('0x11')]()];var _0x5b5c23=_0x1e3413['id'];var _0x5303f9=_0x1e3413[_0xeab9('0x14')];var _0x312420=_0x1e3413[_0xeab9('0x15')];var _0x4a453b=JSON['stringify'](_0x1c7dcb||null);_0x4fd84d[_0xeab9('0x1b')]('['+_0x5bd1c2[_0xeab9('0x13')]()+'MESSAGE:ACCEPT]\x20id='+_0x5b5c23+_0xeab9('0x1d')+_0x5303f9+'\x20role='+_0x312420+_0xeab9('0x1e')+_0x14687f+_0xeab9('0x1f')+_0x4a453b);}module[_0xeab9('0x20')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0xc0b7=['\x20interaction=','\x20body=','lodash','../../mysqldb','../../config/logger','fax-interactions','sms-interactions','chat-interactions','capitalize','Website','InteractionId','upperFirst','unknown','chat','accounts','_interactions','_messages','user_has_','isArray','toLowerCase','stringify','null','Interaction','findOne','then','info','catch','error','name','role','MESSAGE:ACCEPT]\x20id=','\x20name=','\x20role='];(function(_0x3df517,_0x373364){var _0x25ddd5=function(_0xdd2381){while(--_0xdd2381){_0x3df517['push'](_0x3df517['shift']());}};_0x25ddd5(++_0x373364);}(_0xc0b7,0xe9));var _0x7c0b=function(_0x1b4e96,_0xf5d62e){_0x1b4e96=_0x1b4e96-0x0;var _0x4c80f5=_0xc0b7[_0x1b4e96];return _0x4c80f5;};'use strict';var _=require(_0x7c0b('0x0'));var db=require(_0x7c0b('0x1'))['db'];var loggers={'openchannel':require(_0x7c0b('0x2'))('openchannel-interactions'),'mail':require(_0x7c0b('0x2'))('mail-interactions'),'fax':require(_0x7c0b('0x2'))(_0x7c0b('0x3')),'sms':require(_0x7c0b('0x2'))(_0x7c0b('0x4')),'chat':require(_0x7c0b('0x2'))(_0x7c0b('0x5')),'whatsapp':require(_0x7c0b('0x2'))('whatsapp-interactions')};function getAccountFK(_0x1c477c){return _[_0x7c0b('0x6')](_0x1c477c)+(_0x1c477c==='chat'?_0x7c0b('0x7'):'Account')+'Id';}function getInteractionFK(_0x3698fe){return _[_0x7c0b('0x6')](_0x3698fe)+_0x7c0b('0x8');}function getInteractionId(_0x42badd,_0x5ba657,_0x358d8e){if(_0x42badd&&_0x42badd[_[_0x7c0b('0x9')](_0x358d8e)+_0x7c0b('0x8')]){return _0x42badd[_['upperFirst'](_0x358d8e)+_0x7c0b('0x8')];}else if(_0x42badd&&_0x42badd['id']){return _0x42badd['id'];}else if(_0x5ba657&&_0x5ba657['id']){return _0x5ba657['id'];}else{return _0x7c0b('0xa');}}function getInteractionsTables(_0x306a6a){return{'accounts':_0x306a6a+'_'+(_0x306a6a===_0x7c0b('0xb')?'websites':_0x7c0b('0xc')),'interactions':_0x306a6a+_0x7c0b('0xd'),'interactionsTags':_0x306a6a+'_interaction_has_tags','messages':_0x306a6a+_0x7c0b('0xe'),'userInteractions':_0x7c0b('0xf')+_0x306a6a+_0x7c0b('0xd')};}function getSelectedTags(_0x3fa0d0){var _0x304656=[];if(_0x3fa0d0){_0x304656=Array[_0x7c0b('0x10')](_0x3fa0d0)?_0x3fa0d0:[_0x3fa0d0];}return _0x304656;}function log(_0x3d857d,_0x30abbb,_0x1db905,_0x14e351,_0x16fcf5,_0x676b83){loggers[_0x16fcf5[_0x7c0b('0x11')]()][_0x3d857d]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x676b83['toUpperCase'](),_0x30abbb?_0x30abbb['id']:null,_0x30abbb?_0x30abbb['name']:null,_0x30abbb?_0x30abbb['role']:null,getInteractionId(_0x1db905,_0x14e351,_0x16fcf5),_0x1db905?JSON[_0x7c0b('0x12')](_0x1db905):_0x7c0b('0x13'));}function updateUser(_0x35f2c1,_0x3e81ff,_0x4ef5b9,_0x552e98,_0x1e131d){db[_[_0x7c0b('0x9')](_0x552e98)+_0x7c0b('0x14')][_0x7c0b('0x15')]({'where':{'id':getInteractionId(_0x3e81ff,_0x4ef5b9,_0x552e98)}})[_0x7c0b('0x16')](function(_0x22f0f1){if(_0x22f0f1){return _0x22f0f1['update']({'UserId':_0x35f2c1?_0x35f2c1['id']:null});}})[_0x7c0b('0x16')](function(_0x3893d2){if(_0x3893d2){log(_0x7c0b('0x17'),_0x35f2c1,_0x3e81ff,_0x4ef5b9,_0x552e98,_0x1e131d);}})[_0x7c0b('0x18')](function(){log(_0x7c0b('0x19'),_0x35f2c1,_0x3e81ff,_0x4ef5b9,_0x552e98,_0x1e131d);});}function logAcceptMessage(_0x10c1b8,_0x5ae738,_0x5041ce,_0x46796b){var _0x446c04=loggers[_0x10c1b8[_0x7c0b('0x11')]()];var _0x349b3d=_0x5ae738['id'];var _0xd1e7fb=_0x5ae738[_0x7c0b('0x1a')];var _0x513bbd=_0x5ae738[_0x7c0b('0x1b')];var _0x140448=JSON['stringify'](_0x46796b||null);_0x446c04['info']('['+_0x10c1b8['toUpperCase']()+_0x7c0b('0x1c')+_0x349b3d+_0x7c0b('0x1d')+_0xd1e7fb+_0x7c0b('0x1e')+_0x513bbd+_0x7c0b('0x1f')+_0x5041ce+_0x7c0b('0x20')+_0x140448);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index ff2cf49..2d53b1b 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 _0x6be3=['crypto','util','composable-middleware','../../config/environment','license','data1','split','aes-256-ctr','format','update','final','parse','hasOwnProperty','use','findOne','then','count','status','json','catch','users','User','user','isUserLimit'];(function(_0x21807e,_0x5c0cec){var _0x2fbe16=function(_0xbf92da){while(--_0xbf92da){_0x21807e['push'](_0x21807e['shift']());}};_0x2fbe16(++_0x5c0cec);}(_0x6be3,0x1e0));var _0x36be=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x6be3[_0x2d982d];return _0x4f36b0;};'use strict';var crypto=require(_0x36be('0x0'));var util=require(_0x36be('0x1'));var compose=require(_0x36be('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x36be('0x3'));function getValueFromLicense(_0x9beb34,_0x2ac973){if(_0x9beb34&&_0x2ac973){if(_0x2ac973['data1']&&_0x2ac973[_0x36be('0x4')]){var _0x361b03=_0x2ac973[_0x36be('0x5')];var _0x3df869=_0x2ac973[_0x36be('0x4')];var _0x35d9ad=_0x361b03['split']('-')[0x4];var _0xd0c029=_0x361b03[_0x36be('0x6')]('-')[0x0];var _0xb1f7e7=crypto['createDecipher'](_0x36be('0x7'),util[_0x36be('0x8')]('%s:%s:%s',_0x35d9ad,_0x361b03,_0xd0c029));var _0x36f2af=_0xb1f7e7[_0x36be('0x9')](_0x3df869,'base64','utf8');_0x36f2af+=_0xb1f7e7[_0x36be('0xa')]('utf8');var _0x1cb791=JSON[_0x36be('0xb')](_0x36f2af);return _0x1cb791[_0x36be('0xc')](_0x9beb34)?_0x1cb791[_0x9beb34]:null;}}return null;}function isLimit(_0x317b13,_0xfa1e9f,_0x11931c,_0x36aef1){var _0x19d573=_0xfa1e9f;return compose()[_0x36be('0xd')](function(_0x5cf9ae,_0x4c62f1,_0x404bb8){return db['License'][_0x36be('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x36be('0xf')](function(_0x19bea8){var _0x4a7040=getValueFromLicense(_0x317b13,_0x19bea8);return _0x4a7040?_0x4a7040:_0x19d573;})['then'](function(_0x250c50){_0x19d573=_0x250c50;return _0x11931c[_0x36be('0x10')](_0x36aef1);})[_0x36be('0xf')](function(_0xbf0d9d){if(_0xbf0d9d>=_0x19d573){return _0x4c62f1[_0x36be('0x11')](0x193)[_0x36be('0x12')]({'message':util[_0x36be('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x317b13)});}_0x404bb8();})[_0x36be('0x13')](function(_0x4dfa32){_0x404bb8(_0x4dfa32);});});}function isUserLimit(){return isLimit(_0x36be('0x14'),0x1,db[_0x36be('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x36be('0x16')}]}});}exports[_0x36be('0x17')]=isUserLimit; \ No newline at end of file +var _0xbdd7=['License','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','update','final','utf8','hasOwnProperty'];(function(_0x433358,_0x3c0082){var _0x65c03c=function(_0x4b93d0){while(--_0x4b93d0){_0x433358['push'](_0x433358['shift']());}};_0x65c03c(++_0x3c0082);}(_0xbdd7,0x7d));var _0x7bdd=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbdd7[_0x2f5ac5];return _0x37c9a8;};'use strict';var crypto=require(_0x7bdd('0x0'));var util=require(_0x7bdd('0x1'));var compose=require('composable-middleware');var db=require(_0x7bdd('0x2'))['db'];var config=require(_0x7bdd('0x3'));function getValueFromLicense(_0x1d9694,_0x59580a){if(_0x1d9694&&_0x59580a){if(_0x59580a[_0x7bdd('0x4')]&&_0x59580a[_0x7bdd('0x5')]){var _0x318091=_0x59580a[_0x7bdd('0x4')];var _0x193454=_0x59580a['license'];var _0x41fe76=_0x318091[_0x7bdd('0x6')]('-')[0x4];var _0x6c2e3=_0x318091[_0x7bdd('0x6')]('-')[0x0];var _0x5405ca=crypto[_0x7bdd('0x7')](_0x7bdd('0x8'),util['format']('%s:%s:%s',_0x41fe76,_0x318091,_0x6c2e3));var _0x98ff68=_0x5405ca[_0x7bdd('0x9')](_0x193454,'base64','utf8');_0x98ff68+=_0x5405ca[_0x7bdd('0xa')](_0x7bdd('0xb'));var _0x36b6b1=JSON['parse'](_0x98ff68);return _0x36b6b1[_0x7bdd('0xc')](_0x1d9694)?_0x36b6b1[_0x1d9694]:null;}}return null;}function isLimit(_0x31c456,_0x610423,_0x219785,_0x539267){var _0xc74d0a=_0x610423;return compose()['use'](function(_0xf9b2e,_0x2fe0bc,_0x47b905){return db[_0x7bdd('0xd')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x7bdd('0xe')](function(_0x2f6156){var _0x413eae=getValueFromLicense(_0x31c456,_0x2f6156);return _0x413eae?_0x413eae:_0xc74d0a;})[_0x7bdd('0xe')](function(_0x27a0e1){_0xc74d0a=_0x27a0e1;return _0x219785[_0x7bdd('0xf')](_0x539267);})['then'](function(_0x17c8e4){if(_0x17c8e4>=_0xc74d0a){return _0x2fe0bc[_0x7bdd('0x10')](0x193)['json']({'message':util['format'](_0x7bdd('0x11'),_0x31c456)});}_0x47b905();})['catch'](function(_0x2aca34){_0x47b905(_0x2aca34);});});}function isUserLimit(){return isLimit(_0x7bdd('0x12'),0x1,db[_0x7bdd('0x13')],{'where':{'$or':[{'role':_0x7bdd('0x14')},{'role':_0x7bdd('0x15')}]}});}exports[_0x7bdd('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 518f137..30fee4e 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 _0xb9b4=['$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','hours','add','minutes','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','split','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','operator','$eq','value','includes','$gt'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb9b4,0x102));var _0x4b9b=function(_0x56fe0a,_0x35741e){_0x56fe0a=_0x56fe0a-0x0;var _0x475329=_0xb9b4[_0x56fe0a];return _0x475329;};'use strict';var _=require(_0x4b9b('0x0'));var moment=require(_0x4b9b('0x1'));exports[_0x4b9b('0x2')]=function(_0xb888c){var _0x5934c4={'conditions':[]};_0x5934c4[_0x4b9b('0x3')]=_['startsWith'](_0xb888c,_0x4b9b('0x4'))?'or':_0x4b9b('0x5');var _0x362ef6=_0xb888c[_0x4b9b('0x6')]('[$and]','')[_0x4b9b('0x6')]('[$or]','')['split']('||');for(var _0xfd1ca3=0x0;_0xfd1ca3<_0x362ef6['length'];_0xfd1ca3++){var _0x27bdff=_0x362ef6[_0xfd1ca3][_0x4b9b('0x7')](':=');var _0xa11f27=_0x27bdff[0x0];var _0xe45962=_0x27bdff['slice'](0x1);_0xe45962[_0x4b9b('0x8')](function(_0x33d2e4){var _0x1976b3=_0x33d2e4[_0x4b9b('0x7')]('[')[_0x4b9b('0x9')]();var _0x35d8c5=_0x33d2e4[_0x4b9b('0xa')](/\[(.*?)\]/g);_0x35d8c5[_0x4b9b('0x8')](function(_0x3a84f4){var _0x345529=_0x3a84f4['split']('[')[_0x4b9b('0xb')](function(_0x295b5e){return _0x295b5e[_0x4b9b('0xc')](']')>-0x1;})[_0x4b9b('0xd')](function(_0x4189d4){return _0x4189d4[_0x4b9b('0x7')](']')[0x0];})[0x0];_0x5934c4[_0x4b9b('0xe')][_0x4b9b('0xf')]({'field':_0xa11f27,'operator':_0x1976b3,'value':_0x345529});});});}return _0x5934c4;};exports[_0x4b9b('0x10')]=function(_0x2c46bd,_0x564282,_0x39895c){var _0x76a812={};if(_0x564282==='DATE'){if(_0x39895c[_0x4b9b('0x11')]===_0x4b9b('0x12')){_0x39895c[_0x4b9b('0x11')]='$between';_0x39895c['value']+=','+_0x39895c[_0x4b9b('0x13')];}else if(_[_0x4b9b('0x14')]([_0x4b9b('0x15'),_0x4b9b('0x16')],_0x39895c['operator'])){_0x39895c[_0x4b9b('0x13')]=moment(_0x39895c[_0x4b9b('0x13')])['add'](0x1,_0x4b9b('0x17'))[_0x4b9b('0x18')](_0x4b9b('0x19'));}}if(_0x39895c['castTo']){_0x564282=_0x39895c[_0x4b9b('0x1a')];_0x76a812[_0x4b9b('0x1b')]=_0x4b9b('0x1c')+_0x2c46bd+'.'+_0x39895c['field']+_0x4b9b('0x1d')+_0x39895c['castTo']+')\x20'+parseOperator(_0x39895c[_0x4b9b('0x11')]);}else{_0x76a812[_0x4b9b('0x1b')]=_0x2c46bd+'.'+_0x39895c[_0x4b9b('0x1e')]+'\x20'+parseOperator(_0x39895c[_0x4b9b('0x11')]);}if(_[_0x4b9b('0x14')](['$ne','$notIn'],_0x39895c[_0x4b9b('0x11')]))_0x76a812[_0x4b9b('0x1b')]='('+_0x76a812[_0x4b9b('0x1b')]+_0x4b9b('0x1f')+_0x2c46bd+'.'+_0x39895c[_0x4b9b('0x1e')]+_0x4b9b('0x20');_0x76a812['value']=parseValue(_0x564282,_0x39895c[_0x4b9b('0x11')],_0x39895c['value']);return _0x76a812;};function parseOperator(_0x212b79){var _0x33b8b1;switch(_0x212b79){case _0x4b9b('0x21'):_0x33b8b1=_0x4b9b('0x22');break;case _0x4b9b('0x23'):_0x33b8b1='NOT\x20IN\x20?';break;case _0x4b9b('0x12'):_0x33b8b1=_0x4b9b('0x24');break;case _0x4b9b('0x25'):_0x33b8b1=_0x4b9b('0x26');break;case _0x4b9b('0x27'):case _0x4b9b('0x28'):case _0x4b9b('0x29'):_0x33b8b1=_0x4b9b('0x2a');break;case _0x4b9b('0x2b'):_0x33b8b1=_0x4b9b('0x2c');break;case'$gt':_0x33b8b1='>\x20?';break;case _0x4b9b('0x16'):_0x33b8b1=_0x4b9b('0x2d');break;case'$gte':_0x33b8b1=_0x4b9b('0x2e');break;case _0x4b9b('0x2f'):_0x33b8b1=_0x4b9b('0x30');break;}return _0x33b8b1;}function parseValue(_0x28b8e0,_0x1af12d,_0x172e00){var _0xd8352c={'start':undefined,'end':undefined};switch(_0x1af12d){case _0x4b9b('0x21'):case _0x4b9b('0x23'):_0xd8352c[_0x4b9b('0x31')]=_0x172e00[_0x4b9b('0x7')](',');break;case _0x4b9b('0x27'):_0xd8352c[_0x4b9b('0x31')]='%'+_0x172e00+'%';break;case _0x4b9b('0x28'):_0xd8352c[_0x4b9b('0x31')]=_0x172e00+'%';break;case _0x4b9b('0x29'):_0xd8352c['start']='%'+_0x172e00;break;case _0x4b9b('0x2f'):var _0x35ed0a=_0x172e00[_0x4b9b('0x7')](',');var _0x172e00=_0x35ed0a[_0x4b9b('0x9')]();var _0x45f83d=_0x35ed0a[_0x4b9b('0x32')]();if(_0x28b8e0===_0x4b9b('0x33')){_0x172e00=moment(_0x172e00)[_0x4b9b('0x34')](0x0,!![])[_0x4b9b('0x18')]();_0x45f83d=moment(_0x45f83d)[_0x4b9b('0x34')](0x0,!![])['add'](0x17,_0x4b9b('0x35'))[_0x4b9b('0x36')](0x3b,_0x4b9b('0x37'))[_0x4b9b('0x36')](0x3b,'seconds')[_0x4b9b('0x18')]();}_0xd8352c={'start':_0x172e00,'end':_0x45f83d};break;default:_0xd8352c[_0x4b9b('0x31')]=_0x172e00;break;}return _0xd8352c;} \ No newline at end of file +var _0xccd0=['$endsWith','shift','pop','utcOffset','add','hours','minutes','seconds','sqlOperator','startsWith','and','replace','[$and]','[$or]','split','slice','forEach','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$substring','$startsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start'];(function(_0x356c85,_0x22b9c7){var _0x4d6fa1=function(_0x41277b){while(--_0x41277b){_0x356c85['push'](_0x356c85['shift']());}};_0x4d6fa1(++_0x22b9c7);}(_0xccd0,0x1b0));var _0x0ccd=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xccd0[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x45a8fd){var _0x5b8c23={'conditions':[]};_0x5b8c23[_0x0ccd('0x0')]=_[_0x0ccd('0x1')](_0x45a8fd,'[$or]')?'or':_0x0ccd('0x2');var _0x1df57b=_0x45a8fd[_0x0ccd('0x3')](_0x0ccd('0x4'),'')['replace'](_0x0ccd('0x5'),'')[_0x0ccd('0x6')]('||');for(var _0x3558e8=0x0;_0x3558e8<_0x1df57b['length'];_0x3558e8++){var _0x5b3e74=_0x1df57b[_0x3558e8]['split'](':=');var _0x9a92e2=_0x5b3e74[0x0];var _0x5d8b76=_0x5b3e74[_0x0ccd('0x7')](0x1);_0x5d8b76[_0x0ccd('0x8')](function(_0xf22d98){var _0x213470=_0xf22d98['split']('[')['shift']();var _0x9a2a5e=_0xf22d98[_0x0ccd('0x9')](/\[(.*?)\]/g);_0x9a2a5e[_0x0ccd('0x8')](function(_0x1dba61){var _0x35d028=_0x1dba61['split']('[')[_0x0ccd('0xa')](function(_0x48ab9e){return _0x48ab9e[_0x0ccd('0xb')](']')>-0x1;})['map'](function(_0x4a7c07){return _0x4a7c07[_0x0ccd('0x6')](']')[0x0];})[0x0];_0x5b8c23[_0x0ccd('0xc')][_0x0ccd('0xd')]({'field':_0x9a92e2,'operator':_0x213470,'value':_0x35d028});});});}return _0x5b8c23;};exports[_0x0ccd('0xe')]=function(_0x3a4bef,_0x59e48a,_0x4ad6ab){var _0x934cc={};if(_0x59e48a===_0x0ccd('0xf')){if(_0x4ad6ab[_0x0ccd('0x10')]===_0x0ccd('0x11')){_0x4ad6ab['operator']=_0x0ccd('0x12');_0x4ad6ab[_0x0ccd('0x13')]+=','+_0x4ad6ab[_0x0ccd('0x13')];}else if(_[_0x0ccd('0x14')](['$gt',_0x0ccd('0x15')],_0x4ad6ab[_0x0ccd('0x10')])){_0x4ad6ab[_0x0ccd('0x13')]=moment(_0x4ad6ab[_0x0ccd('0x13')])['add'](0x1,_0x0ccd('0x16'))[_0x0ccd('0x17')](_0x0ccd('0x18'));}}if(_0x4ad6ab['castTo']){_0x59e48a=_0x4ad6ab[_0x0ccd('0x19')];_0x934cc[_0x0ccd('0x1a')]=_0x0ccd('0x1b')+_0x3a4bef+'.'+_0x4ad6ab[_0x0ccd('0x1c')]+'\x20AS\x20'+_0x4ad6ab[_0x0ccd('0x19')]+')\x20'+parseOperator(_0x4ad6ab['operator']);}else{_0x934cc[_0x0ccd('0x1a')]=_0x3a4bef+'.'+_0x4ad6ab['field']+'\x20'+parseOperator(_0x4ad6ab['operator']);}if(_[_0x0ccd('0x14')]([_0x0ccd('0x1d'),'$notIn'],_0x4ad6ab[_0x0ccd('0x10')]))_0x934cc[_0x0ccd('0x1a')]='('+_0x934cc['text']+'\x20OR\x20'+_0x3a4bef+'.'+_0x4ad6ab['field']+_0x0ccd('0x1e');_0x934cc[_0x0ccd('0x13')]=parseValue(_0x59e48a,_0x4ad6ab[_0x0ccd('0x10')],_0x4ad6ab[_0x0ccd('0x13')]);return _0x934cc;};function parseOperator(_0x47a6ff){var _0x22895e;switch(_0x47a6ff){case _0x0ccd('0x1f'):_0x22895e=_0x0ccd('0x20');break;case _0x0ccd('0x21'):_0x22895e=_0x0ccd('0x22');break;case _0x0ccd('0x11'):_0x22895e='=\x20?';break;case'$ne':_0x22895e='<>\x20?';break;case _0x0ccd('0x23'):case _0x0ccd('0x24'):case'$endsWith':_0x22895e=_0x0ccd('0x25');break;case'$lt':_0x22895e=_0x0ccd('0x26');break;case'$gt':_0x22895e=_0x0ccd('0x27');break;case _0x0ccd('0x15'):_0x22895e=_0x0ccd('0x28');break;case _0x0ccd('0x29'):_0x22895e=_0x0ccd('0x2a');break;case _0x0ccd('0x12'):_0x22895e=_0x0ccd('0x2b');break;}return _0x22895e;}function parseValue(_0x3031fd,_0x33b7da,_0x55bdad){var _0x263191={'start':undefined,'end':undefined};switch(_0x33b7da){case'$in':case _0x0ccd('0x21'):_0x263191[_0x0ccd('0x2c')]=_0x55bdad[_0x0ccd('0x6')](',');break;case _0x0ccd('0x23'):_0x263191[_0x0ccd('0x2c')]='%'+_0x55bdad+'%';break;case _0x0ccd('0x24'):_0x263191[_0x0ccd('0x2c')]=_0x55bdad+'%';break;case _0x0ccd('0x2d'):_0x263191[_0x0ccd('0x2c')]='%'+_0x55bdad;break;case _0x0ccd('0x12'):var _0xfbe970=_0x55bdad['split'](',');var _0x55bdad=_0xfbe970[_0x0ccd('0x2e')]();var _0x17be7b=_0xfbe970[_0x0ccd('0x2f')]();if(_0x3031fd===_0x0ccd('0xf')){_0x55bdad=moment(_0x55bdad)['utcOffset'](0x0,!![])['format']();_0x17be7b=moment(_0x17be7b)[_0x0ccd('0x30')](0x0,!![])[_0x0ccd('0x31')](0x17,_0x0ccd('0x32'))[_0x0ccd('0x31')](0x3b,_0x0ccd('0x33'))[_0x0ccd('0x31')](0x3b,_0x0ccd('0x34'))['format']();}_0x263191={'start':_0x55bdad,'end':_0x17be7b};break;default:_0x263191[_0x0ccd('0x2c')]=_0x55bdad;break;}return _0x263191;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ef059d7..6c82e42 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 _0x2c3a=['lower','includeAll','push','include','escapeLIKESpecialChars','lodash','sequelize','moment','parse','includes','model','alias','fields','raw','split','filters','forOwn','type','DATE','isPlainObject','$gte','format','utc','$lte','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','isEmpty','length','omit','isObject','isString','hasOwnProperty','isNumeric','^[+]?[0-9]*$','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','trim','forEach','join','query','$id','keys','attributes','intersection','nolimit','order','where','pick','filter','object','columns','value','merge'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x2c3a,0x154));var _0xa2c3=function(_0x2bc89b,_0x5a578f){_0x2bc89b=_0x2bc89b-0x0;var _0x751450=_0x2c3a[_0x2bc89b];return _0x751450;};'use strict';var _=require(_0xa2c3('0x0'));var sequelize=require(_0xa2c3('0x1'));var moment=require(_0xa2c3('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x38cc23){var _0x417403=['ne'];try{var _0x4595be=JSON[_0xa2c3('0x3')](_0x38cc23);var _0x5808f1=Object['keys'](_0x4595be)[0x0];return _0x417403[_0xa2c3('0x4')](_0x5808f1);}catch(_0x2ea4fa){return![];}}function getOperatorValue(_0x4d9f08){var _0x1ed6a4=JSON[_0xa2c3('0x3')](_0x4d9f08);var _0x548719=Object['keys'](_0x1ed6a4)[0x0];var _0x3325e6=_0x1ed6a4[_0x548719];return{['$'+_0x548719]:_0x3325e6};}function parseIncludeModel(_0x449562){var _0x215980=JSON['parse'](_0x449562);return{'model':db[_0x215980[_0xa2c3('0x5')]],'as':_0x215980[_0xa2c3('0x6')],'attributes':_0x215980[_0xa2c3('0x7')],'raw':_0x215980[_0xa2c3('0x8')]};}exports[_0xa2c3('0x7')]=function(_0x335317){var _0x3b86d0=null;if(_0x335317){_0x3b86d0=_0x335317[_0xa2c3('0x9')](',');}return _0x3b86d0;};exports[_0xa2c3('0xa')]=function(_0xf11fa4,_0x3509e3){var _0xc441b1={};if(!_['isEmpty'](_0xf11fa4)){_[_0xa2c3('0xb')](_0xf11fa4,function(_0x600341,_0x464c22){try{if(_0x3509e3){var _0x38cdcc=_['find'](_0x3509e3,{'name':_0x464c22})||{};if(hasSequelizeOperator(_0x600341)){_0xc441b1[_0x464c22]=getOperatorValue(_0x600341);}else if(_0x38cdcc[_0xa2c3('0xc')]===_0xa2c3('0xd')&&_[_0xa2c3('0xe')](_0x600341)){var _0x48c438=JSON['parse'](_0x600341);var _0x2a9e29={'$gte':moment(moment(_0x48c438[_0xa2c3('0xf')])[_0xa2c3('0x10')]('YYYY-MM-DD'))[_0xa2c3('0x11')]()['format'](),'$lte':moment(moment(_0x48c438[_0xa2c3('0x12')])['format']('YYYY-MM-DD'))[_0xa2c3('0x11')]()[_0xa2c3('0x13')](0x1,'s')[_0xa2c3('0x10')]()};_0xc441b1[_0x464c22]=_0x2a9e29;}else if(_0x38cdcc[_0xa2c3('0x14')]==='uniqueid'){_0xc441b1[_0x464c22]=_0x600341;}else{_0xc441b1[_0x464c22]=_[_0xa2c3('0x15')](_0x600341)?_0x600341:JSON['parse'](_0x600341);}}else{_0xc441b1[_0x464c22]=_['isArray'](_0x600341)?_0x600341:JSON['parse'](_0x600341);}}catch(_0xe4fae6){_0xc441b1[_0x464c22]=_0x600341[_0xa2c3('0x9')](',');}});}return _0xc441b1;};exports[_0xa2c3('0x16')]=function(_0x383560){_0x383560=parseInt(_0x383560,0xa);if(!_0x383560||_0x383560<0x0){_0x383560=LIMIT_VALUE;}return _0x383560;};exports[_0xa2c3('0x17')]=function(_0x3e350f){_0x3e350f=parseInt(_0x3e350f,0xa);if(!_0x3e350f||_0x3e350f<0x0){_0x3e350f=0x0;}return _0x3e350f;};exports[_0xa2c3('0x18')]=function(_0x1b20b6){var _0x424dbe,_0x3147d6=null;if(_0x1b20b6){_0x424dbe=_0x1b20b6['split'](',');_0x3147d6=_[_0xa2c3('0x19')](_0x424dbe,function(_0x86270f){if(_0x86270f[_0xa2c3('0x1a')]('-')===0x0){return[_0x86270f===_0xa2c3('0x1b')?sequelize['cast'](sequelize[_0xa2c3('0x1c')](_0xa2c3('0x1b')),_0xa2c3('0x1d')):_0x86270f[_0xa2c3('0x1e')](0x1),_0xa2c3('0x1f')];}else{return[_0x86270f===_0xa2c3('0x1b')?sequelize['cast'](sequelize[_0xa2c3('0x1c')](_0xa2c3('0x1b')),_0xa2c3('0x1d')):_0x86270f,'ASC'];}});}return _0x3147d6;};exports['omit']=function(_0x49f211,_0x46a3ee){if(_[_0xa2c3('0x20')](_0x49f211)){return _0x49f211;}if(_['isArray'](_0x49f211)){for(var _0x26a6b9=0x0;_0x26a6b9<_0x49f211[_0xa2c3('0x21')];_0x26a6b9+=0x1){_0x49f211[_0x26a6b9]=this[_0xa2c3('0x22')](_0x49f211[_0x26a6b9],_0x46a3ee);}return _0x49f211;}if(!_[_0xa2c3('0x23')](_0x49f211)){return _0x49f211;}if(_[_0xa2c3('0x24')](_0x46a3ee)){_0x46a3ee=[_0x46a3ee];}if(!_['isArray'](_0x46a3ee)){return _0x49f211;}for(var _0x48db51=0x0;_0x48db51<_0x46a3ee['length'];_0x48db51+=0x1){_['unset'](_0x49f211,_0x46a3ee[_0x48db51]);}for(var _0x51ea35 in _0x49f211){if(_0x49f211[_0xa2c3('0x25')](_0x51ea35)){_0x49f211[_0x51ea35]=this[_0xa2c3('0x22')](_0x49f211[_0x51ea35],_0x46a3ee);}}return _0x49f211;};exports[_0xa2c3('0x26')]=function(_0x3459f4){return _0x3459f4['match'](RegExp(_0xa2c3('0x27')))?!![]:![];};exports['isEmail']=function(_0x521d58){return _0x521d58[_0xa2c3('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0xa2c3('0x29')]=function(_0x3eb85e,_0x4a97fd){var _0x2bd7a6=[];var _0x2f8088=/([^:]")"+/g;var _0x371a58=/[*<>~@-]/g;var _0x50e51f=/[ `!@#$%^&*()_\-?~<>]/;var _0x37192c=/[ ,]+/;var _0x3f850b=_0x4a97fd?_0xa2c3('0x2a'):_0xa2c3('0x2b');if(_0x4a97fd){_0x3eb85e=_0x3eb85e[_0xa2c3('0x2c')](_0x371a58,'\x20')[_0xa2c3('0x2d')]();}_0x3eb85e[_0xa2c3('0x9')](_0x37192c)[_0xa2c3('0x2e')](function(_0x244605){_0x244605=_0x244605[_0xa2c3('0x2c')](_0x2f8088,'$1');_0x244605='+'+_0x244605+'*';var _0x18a6e5=_0x244605[_0xa2c3('0x28')](_0x50e51f);if(_0x18a6e5){_0x244605='\x22'+_0x244605+'\x22';}_0x2bd7a6['push'](_0x244605);});_0x3f850b=_0x3f850b[_0xa2c3('0x2c')](_0xa2c3('0x2b'),_0x2bd7a6[_0xa2c3('0x2f')]('\x20'));return _0x3f850b;};exports['getOptions']=function(_0x45b7fc,_0x21b622,_0x465229){var _0x12dfd0={},_0x1e9b87={};if(_0x21b622[_0xa2c3('0x30')]['$id']){_0x21b622[_0xa2c3('0x30')]['id']=_0x21b622['query'][_0xa2c3('0x31')];delete _0x21b622[_0xa2c3('0x30')][_0xa2c3('0x31')];}_0x12dfd0[_0xa2c3('0x5')]=_[_0xa2c3('0x19')](_0x45b7fc,_0xa2c3('0x14'));_0x12dfd0[_0xa2c3('0x30')]=_[_0xa2c3('0x32')](_0x21b622[_0xa2c3('0x30')]);_0x12dfd0[_0xa2c3('0xa')]=_['intersection'](_0x12dfd0[_0xa2c3('0x5')],_0x12dfd0[_0xa2c3('0x30')]);_0x1e9b87[_0xa2c3('0x33')]=_[_0xa2c3('0x34')](_0x12dfd0[_0xa2c3('0x5')],this['fields'](_0x21b622[_0xa2c3('0x30')]['fields']));_0x1e9b87[_0xa2c3('0x33')]=_0x1e9b87[_0xa2c3('0x33')][_0xa2c3('0x21')]?_0x1e9b87[_0xa2c3('0x33')]:_0x12dfd0[_0xa2c3('0x5')];if(!_0x21b622['query']['hasOwnProperty'](_0xa2c3('0x35'))){_0x1e9b87['limit']=this[_0xa2c3('0x16')](_0x21b622['query'][_0xa2c3('0x16')]);_0x1e9b87['offset']=this[_0xa2c3('0x17')](_0x21b622[_0xa2c3('0x30')][_0xa2c3('0x17')]);}_0x1e9b87[_0xa2c3('0x36')]=this[_0xa2c3('0x18')](_0x21b622[_0xa2c3('0x30')][_0xa2c3('0x18')]);_0x1e9b87[_0xa2c3('0x37')]=this[_0xa2c3('0xa')](_[_0xa2c3('0x38')](_0x21b622['query'],_0x12dfd0[_0xa2c3('0xa')]),_0x45b7fc);if(_0x21b622[_0xa2c3('0x30')]['filter']){var _0x3e8dae=_0x45b7fc;var _0x204376=_0x21b622[_0xa2c3('0x30')][_0xa2c3('0x39')];if(typeof _0x204376===_0xa2c3('0x3a')){_0x3e8dae=_[_0xa2c3('0x39')](_0x45b7fc,function(_0x43204b){return _[_0xa2c3('0x4')](_0x204376[_0xa2c3('0x3b')],_0x43204b[_0xa2c3('0x14')]);});_0x204376=_0x204376[_0xa2c3('0x3c')];}_0x1e9b87[_0xa2c3('0x37')]=_[_0xa2c3('0x3d')](_0x1e9b87['where'],{'$or':_[_0xa2c3('0x19')](_0x3e8dae,function(_0x4c21fb){if(_0x4c21fb[_0xa2c3('0xc')]!=='VIRTUAL'){if(_0x465229){return sequelize[_0xa2c3('0x37')](sequelize['fn'](_0xa2c3('0x3e'),sequelize[_0xa2c3('0x1c')](_0x4c21fb[_0xa2c3('0x14')])),{'$like':sequelize['fn'](_0xa2c3('0x3e'),'%'+_0x21b622[_0xa2c3('0x30')][_0xa2c3('0x39')]+'%')});}else{var _0x4291bf={};_0x4291bf[_0x4c21fb['name']]={'$like':'%'+_0x21b622[_0xa2c3('0x30')]['filter']+'%'};return _0x4291bf;}}})});}_0x1e9b87=_[_0xa2c3('0x3d')]({},_0x1e9b87,_0x21b622['options']);return _0x1e9b87;};exports['include']=function(_0x4a3bd1){var _0x41e18e=[];if(_0x4a3bd1[_0xa2c3('0x3f')]){_0x41e18e[_0xa2c3('0x40')]({'all':!![]});}else if(_0x4a3bd1['include']){if(Array['isArray'](_0x4a3bd1[_0xa2c3('0x41')])){_0x41e18e=Object[_0xa2c3('0x32')](_0x4a3bd1[_0xa2c3('0x41')])[_0xa2c3('0x19')](function(_0x41eb97){return parseIncludeModel(_0x4a3bd1[_0xa2c3('0x41')][_0x41eb97]);});}else{var _0x5b2800=parseIncludeModel(_0x4a3bd1[_0xa2c3('0x41')]);_0x41e18e['push'](_0x5b2800);}}return _0x41e18e;};exports[_0xa2c3('0x42')]=function(_0x4fb058){return _0x4fb058[_0xa2c3('0x2c')](/[%_^-]/g,function(_0x5a1c7f){return'\x5c'+_0x5a1c7f;});}; \ No newline at end of file +var _0x5c73=['forEach','push','{EXPR}','join','getOptions','query','$id','intersection','attributes','offset','order','where','pick','filter','object','columns','value','lower','merge','options','include','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','replace'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x5c73,0x136));var _0x35c7=function(_0x5aaecd,_0x26c921){_0x5aaecd=_0x5aaecd-0x0;var _0x398dc6=_0x5c73[_0x5aaecd];return _0x398dc6;};'use strict';var _=require(_0x35c7('0x0'));var sequelize=require(_0x35c7('0x1'));var moment=require(_0x35c7('0x2'));var db=require(_0x35c7('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b5970){var _0x464f9a=['ne'];try{var _0x475df8=JSON[_0x35c7('0x4')](_0x1b5970);var _0x34cb8a=Object[_0x35c7('0x5')](_0x475df8)[0x0];return _0x464f9a[_0x35c7('0x6')](_0x34cb8a);}catch(_0x1b0fe0){return![];}}function getOperatorValue(_0x525ec8){var _0x5a157f=JSON[_0x35c7('0x4')](_0x525ec8);var _0x4e50cd=Object[_0x35c7('0x5')](_0x5a157f)[0x0];var _0x440102=_0x5a157f[_0x4e50cd];return{['$'+_0x4e50cd]:_0x440102};}function parseIncludeModel(_0x3bccbc){var _0x261b58=JSON[_0x35c7('0x4')](_0x3bccbc);return{'model':db[_0x261b58[_0x35c7('0x7')]],'as':_0x261b58[_0x35c7('0x8')],'attributes':_0x261b58[_0x35c7('0x9')],'raw':_0x261b58[_0x35c7('0xa')]};}exports[_0x35c7('0x9')]=function(_0x39785f){var _0x3cca69=null;if(_0x39785f){_0x3cca69=_0x39785f[_0x35c7('0xb')](',');}return _0x3cca69;};exports[_0x35c7('0xc')]=function(_0x384631,_0x21d07c){var _0x2f7c69={};if(!_[_0x35c7('0xd')](_0x384631)){_[_0x35c7('0xe')](_0x384631,function(_0x57324d,_0x4fd5d8){try{if(_0x21d07c){var _0x184495=_[_0x35c7('0xf')](_0x21d07c,{'name':_0x4fd5d8})||{};if(hasSequelizeOperator(_0x57324d)){_0x2f7c69[_0x4fd5d8]=getOperatorValue(_0x57324d);}else if(_0x184495[_0x35c7('0x10')]===_0x35c7('0x11')&&_['isPlainObject'](_0x57324d)){var _0x170498=JSON[_0x35c7('0x4')](_0x57324d);var _0x345968={'$gte':moment(moment(_0x170498[_0x35c7('0x12')])[_0x35c7('0x13')](_0x35c7('0x14')))[_0x35c7('0x15')]()['format'](),'$lte':moment(moment(_0x170498[_0x35c7('0x16')])[_0x35c7('0x13')](_0x35c7('0x14')))['utc']()[_0x35c7('0x17')](0x1,'s')[_0x35c7('0x13')]()};_0x2f7c69[_0x4fd5d8]=_0x345968;}else if(_0x184495[_0x35c7('0x18')]===_0x35c7('0x19')){_0x2f7c69[_0x4fd5d8]=_0x57324d;}else{_0x2f7c69[_0x4fd5d8]=_[_0x35c7('0x1a')](_0x57324d)?_0x57324d:JSON[_0x35c7('0x4')](_0x57324d);}}else{_0x2f7c69[_0x4fd5d8]=_['isArray'](_0x57324d)?_0x57324d:JSON[_0x35c7('0x4')](_0x57324d);}}catch(_0x203da7){_0x2f7c69[_0x4fd5d8]=_0x57324d[_0x35c7('0xb')](',');}});}return _0x2f7c69;};exports[_0x35c7('0x1b')]=function(_0xecdec3){_0xecdec3=parseInt(_0xecdec3,0xa);if(!_0xecdec3||_0xecdec3<0x0){_0xecdec3=LIMIT_VALUE;}return _0xecdec3;};exports['offset']=function(_0x102499){_0x102499=parseInt(_0x102499,0xa);if(!_0x102499||_0x102499<0x0){_0x102499=0x0;}return _0x102499;};exports[_0x35c7('0x1c')]=function(_0x32ac76){var _0x1a0540,_0x47d6a5=null;if(_0x32ac76){_0x1a0540=_0x32ac76['split'](',');_0x47d6a5=_[_0x35c7('0x1d')](_0x1a0540,function(_0x1fea53){if(_0x1fea53[_0x35c7('0x1e')]('-')===0x0){return[_0x1fea53===_0x35c7('0x1f')?sequelize[_0x35c7('0x20')](sequelize[_0x35c7('0x21')](_0x35c7('0x1f')),_0x35c7('0x22')):_0x1fea53[_0x35c7('0x23')](0x1),'DESC'];}else{return[_0x1fea53==='priority'?sequelize['cast'](sequelize[_0x35c7('0x21')](_0x35c7('0x1f')),'unsigned'):_0x1fea53,_0x35c7('0x24')];}});}return _0x47d6a5;};exports[_0x35c7('0x25')]=function(_0x364c95,_0x23059f){if(_[_0x35c7('0xd')](_0x364c95)){return _0x364c95;}if(_[_0x35c7('0x1a')](_0x364c95)){for(var _0x282401=0x0;_0x282401<_0x364c95[_0x35c7('0x26')];_0x282401+=0x1){_0x364c95[_0x282401]=this[_0x35c7('0x25')](_0x364c95[_0x282401],_0x23059f);}return _0x364c95;}if(!_[_0x35c7('0x27')](_0x364c95)){return _0x364c95;}if(_[_0x35c7('0x28')](_0x23059f)){_0x23059f=[_0x23059f];}if(!_[_0x35c7('0x1a')](_0x23059f)){return _0x364c95;}for(var _0x36304c=0x0;_0x36304c<_0x23059f[_0x35c7('0x26')];_0x36304c+=0x1){_[_0x35c7('0x29')](_0x364c95,_0x23059f[_0x36304c]);}for(var _0x15ce69 in _0x364c95){if(_0x364c95[_0x35c7('0x2a')](_0x15ce69)){_0x364c95[_0x15ce69]=this['omit'](_0x364c95[_0x15ce69],_0x23059f);}}return _0x364c95;};exports[_0x35c7('0x2b')]=function(_0x1c7b1f){return _0x1c7b1f[_0x35c7('0x2c')](RegExp(_0x35c7('0x2d')))?!![]:![];};exports[_0x35c7('0x2e')]=function(_0x99f1ce){return _0x99f1ce[_0x35c7('0x2c')](/^\S+@\S+$/)?!![]:![];};exports[_0x35c7('0x2f')]=function(_0x2bba3a,_0x127230){var _0x5dd4e7=[];var _0x35eb57=/([^:]")"+/g;var _0x3e53c2=/[*<>~@-]/g;var _0x1a07d0=/[ `!@#$%^&*()_\-?~<>]/;var _0x5c7ec4=/[ ,]+/;var _0x2c2afa=_0x127230?_0x35c7('0x30'):'{EXPR}';if(_0x127230){_0x2bba3a=_0x2bba3a[_0x35c7('0x31')](_0x3e53c2,'\x20')['trim']();}_0x2bba3a[_0x35c7('0xb')](_0x5c7ec4)[_0x35c7('0x32')](function(_0x536633){_0x536633=_0x536633['replace'](_0x35eb57,'$1');_0x536633='+'+_0x536633+'*';var _0x5766e3=_0x536633['match'](_0x1a07d0);if(_0x5766e3){_0x536633='\x22'+_0x536633+'\x22';}_0x5dd4e7[_0x35c7('0x33')](_0x536633);});_0x2c2afa=_0x2c2afa['replace'](_0x35c7('0x34'),_0x5dd4e7[_0x35c7('0x35')]('\x20'));return _0x2c2afa;};exports[_0x35c7('0x36')]=function(_0x5859d2,_0xfd25eb,_0x2ed99f){var _0x287913={},_0x56c048={};if(_0xfd25eb[_0x35c7('0x37')][_0x35c7('0x38')]){_0xfd25eb[_0x35c7('0x37')]['id']=_0xfd25eb[_0x35c7('0x37')][_0x35c7('0x38')];delete _0xfd25eb[_0x35c7('0x37')][_0x35c7('0x38')];}_0x287913['model']=_[_0x35c7('0x1d')](_0x5859d2,_0x35c7('0x18'));_0x287913[_0x35c7('0x37')]=_['keys'](_0xfd25eb[_0x35c7('0x37')]);_0x287913['filters']=_[_0x35c7('0x39')](_0x287913[_0x35c7('0x7')],_0x287913[_0x35c7('0x37')]);_0x56c048[_0x35c7('0x3a')]=_[_0x35c7('0x39')](_0x287913[_0x35c7('0x7')],this[_0x35c7('0x9')](_0xfd25eb[_0x35c7('0x37')][_0x35c7('0x9')]));_0x56c048['attributes']=_0x56c048[_0x35c7('0x3a')]['length']?_0x56c048[_0x35c7('0x3a')]:_0x287913[_0x35c7('0x7')];if(!_0xfd25eb[_0x35c7('0x37')][_0x35c7('0x2a')]('nolimit')){_0x56c048[_0x35c7('0x1b')]=this[_0x35c7('0x1b')](_0xfd25eb['query'][_0x35c7('0x1b')]);_0x56c048[_0x35c7('0x3b')]=this[_0x35c7('0x3b')](_0xfd25eb[_0x35c7('0x37')][_0x35c7('0x3b')]);}_0x56c048[_0x35c7('0x3c')]=this[_0x35c7('0x1c')](_0xfd25eb[_0x35c7('0x37')][_0x35c7('0x1c')]);_0x56c048[_0x35c7('0x3d')]=this[_0x35c7('0xc')](_[_0x35c7('0x3e')](_0xfd25eb[_0x35c7('0x37')],_0x287913[_0x35c7('0xc')]),_0x5859d2);if(_0xfd25eb[_0x35c7('0x37')][_0x35c7('0x3f')]){var _0xf56e5c=_0x5859d2;var _0x484def=_0xfd25eb[_0x35c7('0x37')][_0x35c7('0x3f')];if(typeof _0x484def===_0x35c7('0x40')){_0xf56e5c=_[_0x35c7('0x3f')](_0x5859d2,function(_0x5a4b6b){return _[_0x35c7('0x6')](_0x484def[_0x35c7('0x41')],_0x5a4b6b[_0x35c7('0x18')]);});_0x484def=_0x484def[_0x35c7('0x42')];}_0x56c048[_0x35c7('0x3d')]=_['merge'](_0x56c048[_0x35c7('0x3d')],{'$or':_[_0x35c7('0x1d')](_0xf56e5c,function(_0x37a383){if(_0x37a383['type']!=='VIRTUAL'){if(_0x2ed99f){return sequelize['where'](sequelize['fn']('lower',sequelize[_0x35c7('0x21')](_0x37a383[_0x35c7('0x18')])),{'$like':sequelize['fn'](_0x35c7('0x43'),'%'+_0xfd25eb[_0x35c7('0x37')]['filter']+'%')});}else{var _0x46d5b0={};_0x46d5b0[_0x37a383[_0x35c7('0x18')]]={'$like':'%'+_0xfd25eb['query']['filter']+'%'};return _0x46d5b0;}}})});}_0x56c048=_[_0x35c7('0x44')]({},_0x56c048,_0xfd25eb[_0x35c7('0x45')]);return _0x56c048;};exports['include']=function(_0x3b5183){var _0x4c51a0=[];if(_0x3b5183['includeAll']){_0x4c51a0[_0x35c7('0x33')]({'all':!![]});}else if(_0x3b5183['include']){if(Array[_0x35c7('0x1a')](_0x3b5183[_0x35c7('0x46')])){_0x4c51a0=Object[_0x35c7('0x5')](_0x3b5183[_0x35c7('0x46')])[_0x35c7('0x1d')](function(_0x47317c){return parseIncludeModel(_0x3b5183[_0x35c7('0x46')][_0x47317c]);});}else{var _0x49f0ec=parseIncludeModel(_0x3b5183[_0x35c7('0x46')]);_0x4c51a0[_0x35c7('0x33')](_0x49f0ec);}}return _0x4c51a0;};exports[_0x35c7('0x47')]=function(_0x4c2dcf){return _0x4c2dcf['replace'](/[%_^-]/g,function(_0x2d62d9){return'\x5c'+_0x2d62d9;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index e5c0f92..14512ea 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 _0x659c=['faxCapacity','chatCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','role','chatStatusTime','mailCapacity','openchannelCurrentCapacity','smsCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','getRealtimeAgents','busy','getAgentStatus','isArray','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','filter','getAgentIdsByStatus','resolve','User','findAll','fullname','whatsappPause','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','DESC','fullname,internal','internal','substring','indexOf','validateSortParameter','pause','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity'];(function(_0xe11cf9,_0x588758){var _0x5e674f=function(_0x175cdf){while(--_0x175cdf){_0xe11cf9['push'](_0xe11cf9['shift']());}};_0x5e674f(++_0x588758);}(_0x659c,0x1aa));var _0xc659=function(_0x6a2228,_0x4a1d8b){_0x6a2228=_0x6a2228-0x0;var _0x2d7c81=_0x659c[_0x6a2228];return _0x2d7c81;};'use strict';var _=require(_0xc659('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xc659('0x1')][_0xc659('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0xc659('0x2')]({'port':0x232c});function isAgentPaused(_0x3c4438,_0x4b3258){var _0x5464e2=[_0x3c4438[_0xc659('0x3')],_0x3c4438[_0xc659('0x4')],_0x3c4438[_0xc659('0x5')],_0x3c4438[_0xc659('0x6')],_0x3c4438[_0xc659('0x7')],_0x3c4438[_0xc659('0x8')],_0x3c4438['whatsappPause']];if(!_0x4b3258)return _['every'](_0x5464e2);var _0x2cc93d=_['filter'](_0x5464e2);return _0x2cc93d['length']>0x0&&_0x2cc93d['length']<_0x5464e2[_0xc659('0x9')]?!![]:![];}function isIdle(_0x2ea975){return _0x2ea975===_0xc659('0xa')||_0x2ea975===_0xc659('0xb')||_0x2ea975===_0xc659('0xc')||_0x2ea975===_0xc659('0xd')||_[_0xc659('0xe')](_0x2ea975);}function isAgentIdle(_0x4267f3){if(_0x4267f3['voiceStatus']!==_0xc659('0xa')&&_0x4267f3[_0xc659('0x8')]){_0x4267f3[_0xc659('0xf')]='pause';return![];}return _['every']([_0x4267f3[_0xc659('0x10')],_0x4267f3[_0xc659('0x11')],_0x4267f3['mailStatus'],_0x4267f3[_0xc659('0x12')],_0x4267f3[_0xc659('0x13')],_0x4267f3[_0xc659('0xf')],_0x4267f3[_0xc659('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xc659('0x15')](_0xc659('0x16'),{})[_0xc659('0x17')](function(_0x10b98a){if(_0x10b98a[_0xc659('0x18')]){throw new Error(_0xc659('0x19'));}var _0x57ec09=_0x10b98a[_0xc659('0x1a')];return routingClient[_0xc659('0x15')](_0xc659('0x16'),{})[_0xc659('0x17')](function(_0x28ad0d){if(_0x28ad0d[_0xc659('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x2e421a=_0x28ad0d[_0xc659('0x1a')];return _[_0xc659('0x1b')]({},_0x57ec09,_0x2e421a);});})['catch'](function(_0x485da2){throw _0x485da2;});}exports[_0xc659('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x6af6f9){var _0x48be52=_0xc659('0xb');if(isAgentPaused(_0x6af6f9))_0x48be52='pause';else if(isAgentPaused(_0x6af6f9,!![]))_0x48be52='*pause';else if(isAgentIdle(_0x6af6f9))_0x48be52='idle';else _0x48be52=_0xc659('0x1d');return _0x48be52;}exports[_0xc659('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x3b3d95,_0x21374d){var _0x364f1f=_[_0xc659('0x1f')](_0x3b3d95)?_0x3b3d95:[_0x3b3d95];var _0x5971bb=_['startCase'](_0x21374d)+'Queue';var _0x14233e=_[_0xc659('0x20')](_0x364f1f,function(_0x4c0fb7){return db[_0x5971bb][_0xc659('0x21')]({'where':{'id':_0x4c0fb7}})['then'](function(_0x1b19c7){if(!_0x1b19c7)return[];return _0x1b19c7[_0xc659('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xc659('0x23')](_0x14233e)[_0xc659('0x17')](function(_0x34aefc){var _0x22ec27=_(_0x34aefc)[_0xc659('0x24')]()[_0xc659('0x20')]('id')[_0xc659('0x25')]()[_0xc659('0x26')]();return _0x22ec27;});}exports[_0xc659('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x72ff75,_0x4a0a69,_0x271e8f){try{if(_0x4a0a69[_0xc659('0x9')]>0x0){_0x72ff75=_0x72ff75['filter'](function(_0x4962c7){return _0x4a0a69[_0xc659('0x28')](_0x4962c7['id']);});}var _0x29c5ea=_0x72ff75[_0xc659('0x29')](function(_0x3e6267){var _0x5bfbe4=_0xc659('0x1d');if(isAgentIdle(_0x3e6267)){_0x5bfbe4=_0xc659('0xa');}return _0x5bfbe4===_0x271e8f;});return _[_0xc659('0x20')](_0x29c5ea,'id');}catch(_0x4d5018){throw _0x4d5018;}}exports[_0xc659('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3dbc44,_0x492f57,_0x510b3e){return Promise[_0xc659('0x2b')]()['then'](function(){if(_0x492f57[_0xc659('0x9')]>0x0){_0x3dbc44=_0x3dbc44[_0xc659('0x29')](function(_0x55dca5){return _0x492f57[_0xc659('0x28')](_0x55dca5['id']);});}return _0x3dbc44;})[_0xc659('0x17')](function(){return db[_0xc659('0x2c')][_0xc659('0x2d')]({'attributes':['id','name',_0xc659('0x2e'),_0xc659('0x3'),'faxPause',_0xc659('0x5'),'openchannelPause',_0xc659('0x7'),'voicePause',_0xc659('0x2f'),'pauseType'],'where':{'id':{'$in':_[_0xc659('0x20')](_0x3dbc44,'id')}},'raw':!![]});})[_0xc659('0x17')](function(_0x3725d4){return _0x3725d4[_0xc659('0x20')](function(_0x105475){var _0x2596f1=_[_0xc659('0x30')](_0x3dbc44,['id',_0x105475['id']]);var _0x343b94=filterAgentAttributes(_0x2596f1);_[_0xc659('0x1b')](_0x105475,_0x343b94);_0x105475[_0xc659('0x31')]=getAgentStatus(_0x105475);return _0x105475;});})['then'](function(_0x54b04c){var _0x41b2a2=sortAgentsByStatus(_0x54b04c,_0x510b3e);return _[_0xc659('0x20')](_0x41b2a2,'id');})[_0xc659('0x32')](function(_0x5b6386){throw _0x5b6386;});}exports[_0xc659('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x20d36d){var _0x13c7c0={'fields':[],'order':null};var _0x143e5a=_0x20d36d[_0xc659('0x34')](',');_0x13c7c0[_0xc659('0x35')]=_['filter'](_0x143e5a,function(_0x536b69){if(!_0x536b69[_0xc659('0x28')](_0xc659('0x31'))){return!![];}_0x13c7c0[_0xc659('0x36')]=_['startsWith'](_0x536b69,'-')?_0xc659('0x37'):'ASC';return![];});return _0x13c7c0;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x2c793f){if(!_0x2c793f){_0x2c793f=_0xc659('0x38');}if(_0x2c793f[_0xc659('0x28')](_0xc659('0x2e'))&&!_0x2c793f[_0xc659('0x28')](_0xc659('0x39'))){var _0x5f4fbd=_0x2c793f[_0xc659('0x3a')](0x0,_0x2c793f[_0xc659('0x3b')](_0xc659('0x2e')));_0x2c793f+=','+_0x5f4fbd+_0xc659('0x39');}return _0x2c793f;}exports[_0xc659('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x54677e,_0x39b0d1){var _0x1e7f26=_0x54677e['sort'](function(_0x43a8b4,_0x4b71c3){if(_0x43a8b4['globalStatus']===_0x4b71c3[_0xc659('0x31')]){if(_0x43a8b4['globalStatus']===_0xc659('0x3d')){if(_0x39b0d1===_0xc659('0x37')){return(_0x43a8b4[_0xc659('0x3e')]||'')<(_0x4b71c3[_0xc659('0x3e')]||'')||_0x43a8b4[_0xc659('0x2e')]['toLowerCase']()>_0x4b71c3[_0xc659('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x43a8b4['pauseType']||'')<(_0x4b71c3['pauseType']||'')||_0x43a8b4[_0xc659('0x2e')][_0xc659('0x3f')]()>_0x4b71c3[_0xc659('0x2e')][_0xc659('0x3f')]()?-0x1:0x1;}}else{if(_0x39b0d1===_0xc659('0x37')){return _0x43a8b4[_0xc659('0x2e')]['toLowerCase']()<_0x4b71c3[_0xc659('0x2e')][_0xc659('0x3f')]()?0x1:-0x1;}else{return _0x43a8b4[_0xc659('0x2e')]['toLowerCase']()<_0x4b71c3[_0xc659('0x2e')][_0xc659('0x3f')]()?-0x1:0x1;}}}else{if(_0x39b0d1===_0xc659('0x37')){return _0x43a8b4['globalStatus']<_0x4b71c3[_0xc659('0x31')]?0x1:-0x1;}else{return _0x43a8b4[_0xc659('0x31')]<_0x4b71c3[_0xc659('0x31')]?-0x1:0x1;}}});return _0x1e7f26;}exports[_0xc659('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x4c7d51){var _0xfbb4d3=[_0xc659('0x41'),_0xc659('0x42'),_0xc659('0x43'),_0xc659('0x44'),_0xc659('0x3e'),_0xc659('0x44'),_0xc659('0x39'),_0xc659('0x45'),_0xc659('0x3'),'openchannelPause','mailPause',_0xc659('0x7'),_0xc659('0x2f'),_0xc659('0x4'),_0xc659('0x8'),_0xc659('0x46'),_0xc659('0x47'),'mailCapacity',_0xc659('0x48'),_0xc659('0x49'),_0xc659('0x4a'),_0xc659('0x4b'),'openchannelCurrentCapacity',_0xc659('0x4c'),'smsCurrentCapacity',_0xc659('0x4d'),_0xc659('0x4e'),_0xc659('0x10'),_0xc659('0x12'),_0xc659('0x4f'),_0xc659('0x13'),_0xc659('0x14'),_0xc659('0x11'),_0xc659('0xf'),'chatStatusTime',_0xc659('0x50'),_0xc659('0x51'),_0xc659('0x52'),'whatsappStatusTime',_0xc659('0x53'),_0xc659('0x54'),_0xc659('0x55'),_0xc659('0x56'),_0xc659('0x57'),_0xc659('0x58'),_0xc659('0x59')];var _0x3849da=[_0xc659('0x3'),'openchannelPause',_0xc659('0x5'),'smsPause',_0xc659('0x2f'),_0xc659('0x4'),_0xc659('0x8'),_0xc659('0x42')];var _0x27908c=_(_0x4c7d51)[_0xc659('0x5a')](_0x3849da)[_0xc659('0x5b')](_0xfbb4d3)[_0xc659('0x26')]();return _0x27908c;}exports[_0xc659('0x5c')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0xc659('0x2e'),_0xc659('0x5d'),_0xc659('0x39'),_0xc659('0x42'),_0xc659('0x31'),_0xc659('0x41'),_0xc659('0x43'),_0xc659('0x3e'),_0xc659('0x44'),_0xc659('0x4'),_0xc659('0x3'),_0xc659('0x5'),'openchannelPause',_0xc659('0x7'),_0xc659('0x8'),'whatsappPause',_0xc659('0x10'),_0xc659('0x11'),_0xc659('0x4f'),_0xc659('0x12'),_0xc659('0x13'),_0xc659('0xf'),_0xc659('0x14'),_0xc659('0x5e'),_0xc659('0x53'),'mailStatusTime',_0xc659('0x50'),_0xc659('0x52'),_0xc659('0x54'),'whatsappStatusTime',_0xc659('0x46'),_0xc659('0x4a'),_0xc659('0x5f'),_0xc659('0x47'),_0xc659('0x48'),_0xc659('0x49'),_0xc659('0x4b'),'faxCurrentCapacity',_0xc659('0x4c'),_0xc659('0x60'),_0xc659('0x61'),'whatsappCurrentCapacity',_0xc659('0x58'),_0xc659('0x59'),_0xc659('0x56'),_0xc659('0x62'),_0xc659('0x55'),'screenrecording'];}exports[_0xc659('0x63')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xf811=['voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick','filterAgentAttributes','role','smsStatus','chatStatusTime','whatsappStatusTime','chatCurrentCapacity','faxCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','error','merge','catch','*pause','getAgentStatus','Queue','getAgents','all','flatten','map','uniq','value','getAgentIdsByQueues','includes','busy','getAgentIdsByStatus','resolve','findAll','name','fullname','smsPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','fullname,internal','internal','indexOf','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatusTime','smsStatusTime','faxStatusTime'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf811,0x6f));var _0x1f81=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xf811[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x1f81('0x0'));var jayson=require(_0x1f81('0x1'));var db=require(_0x1f81('0x2'))['db'];var amiClient=jayson[_0x1f81('0x3')][_0x1f81('0x4')]({'port':0x232a});var routingClient=jayson[_0x1f81('0x3')][_0x1f81('0x4')]({'port':0x232c});function isAgentPaused(_0x1650f4,_0x18f178){var _0x4281c3=[_0x1650f4[_0x1f81('0x5')],_0x1650f4[_0x1f81('0x6')],_0x1650f4[_0x1f81('0x7')],_0x1650f4[_0x1f81('0x8')],_0x1650f4['smsPause'],_0x1650f4[_0x1f81('0x9')],_0x1650f4[_0x1f81('0xa')]];if(!_0x18f178)return _[_0x1f81('0xb')](_0x4281c3);var _0x5e6256=_[_0x1f81('0xc')](_0x4281c3);return _0x5e6256[_0x1f81('0xd')]>0x0&&_0x5e6256['length']<_0x4281c3[_0x1f81('0xd')]?!![]:![];}function isIdle(_0x56b05d){return _0x56b05d===_0x1f81('0xe')||_0x56b05d===_0x1f81('0xf')||_0x56b05d===_0x1f81('0x10')||_0x56b05d===_0x1f81('0x11')||_[_0x1f81('0x12')](_0x56b05d);}function isAgentIdle(_0x36ccd8){if(_0x36ccd8[_0x1f81('0x13')]!==_0x1f81('0xe')&&_0x36ccd8[_0x1f81('0x9')]){_0x36ccd8[_0x1f81('0x13')]=_0x1f81('0x14');return![];}return _[_0x1f81('0xb')]([_0x36ccd8[_0x1f81('0x15')],_0x36ccd8[_0x1f81('0x16')],_0x36ccd8[_0x1f81('0x17')],_0x36ccd8[_0x1f81('0x18')],_0x36ccd8['smsStatus'],_0x36ccd8[_0x1f81('0x13')],_0x36ccd8[_0x1f81('0x19')]],isIdle);}function getRealtimeAgents(){return amiClient['request']('Agents',{})[_0x1f81('0x1a')](function(_0x1a781d){if(_0x1a781d['error']){throw new Error(_0x1f81('0x1b'));}var _0x558761=_0x1a781d[_0x1f81('0x1c')];return routingClient[_0x1f81('0x1d')]('Agents',{})['then'](function(_0x13bf61){if(_0x13bf61[_0x1f81('0x1e')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x2f01ac=_0x13bf61['result'];return _[_0x1f81('0x1f')]({},_0x558761,_0x2f01ac);});})[_0x1f81('0x20')](function(_0x38bd05){throw _0x38bd05;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x275138){var _0x3f0de8=_0x1f81('0xf');if(isAgentPaused(_0x275138))_0x3f0de8=_0x1f81('0x14');else if(isAgentPaused(_0x275138,!![]))_0x3f0de8=_0x1f81('0x21');else if(isAgentIdle(_0x275138))_0x3f0de8=_0x1f81('0xe');else _0x3f0de8='busy';return _0x3f0de8;}exports[_0x1f81('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x37b6ff,_0x3751d4){var _0x4ecfa9=_['isArray'](_0x37b6ff)?_0x37b6ff:[_0x37b6ff];var _0xf8e167=_['startCase'](_0x3751d4)+_0x1f81('0x23');var _0x4f714a=_['map'](_0x4ecfa9,function(_0x34cdbc){return db[_0xf8e167]['findOne']({'where':{'id':_0x34cdbc}})[_0x1f81('0x1a')](function(_0x599b8f){if(!_0x599b8f)return[];return _0x599b8f[_0x1f81('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x1f81('0x25')](_0x4f714a)[_0x1f81('0x1a')](function(_0x17129b){var _0x19dab0=_(_0x17129b)[_0x1f81('0x26')]()[_0x1f81('0x27')]('id')[_0x1f81('0x28')]()[_0x1f81('0x29')]();return _0x19dab0;});}exports[_0x1f81('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x587636,_0x292758,_0x5413a1){try{if(_0x292758[_0x1f81('0xd')]>0x0){_0x587636=_0x587636[_0x1f81('0xc')](function(_0x537166){return _0x292758[_0x1f81('0x2b')](_0x537166['id']);});}var _0x186e42=_0x587636[_0x1f81('0xc')](function(_0x232750){var _0x973f6b=_0x1f81('0x2c');if(isAgentIdle(_0x232750)){_0x973f6b=_0x1f81('0xe');}return _0x973f6b===_0x5413a1;});return _[_0x1f81('0x27')](_0x186e42,'id');}catch(_0x5c70ac){throw _0x5c70ac;}}exports[_0x1f81('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x21666b,_0x2e8701,_0x4521ee){return Promise[_0x1f81('0x2e')]()[_0x1f81('0x1a')](function(){if(_0x2e8701[_0x1f81('0xd')]>0x0){_0x21666b=_0x21666b[_0x1f81('0xc')](function(_0x1068c9){return _0x2e8701[_0x1f81('0x2b')](_0x1068c9['id']);});}return _0x21666b;})[_0x1f81('0x1a')](function(){return db['User'][_0x1f81('0x2f')]({'attributes':['id',_0x1f81('0x30'),_0x1f81('0x31'),_0x1f81('0x5'),'faxPause',_0x1f81('0x7'),_0x1f81('0x8'),_0x1f81('0x32'),'voicePause','whatsappPause',_0x1f81('0x33')],'where':{'id':{'$in':_['map'](_0x21666b,'id')}},'raw':!![]});})[_0x1f81('0x1a')](function(_0x5735aa){return _0x5735aa[_0x1f81('0x27')](function(_0x172e0d){var _0x276e90=_[_0x1f81('0x34')](_0x21666b,['id',_0x172e0d['id']]);var _0x299592=filterAgentAttributes(_0x276e90);_[_0x1f81('0x1f')](_0x172e0d,_0x299592);_0x172e0d[_0x1f81('0x35')]=getAgentStatus(_0x172e0d);return _0x172e0d;});})['then'](function(_0x3ed523){var _0x47ccd5=sortAgentsByStatus(_0x3ed523,_0x4521ee);return _[_0x1f81('0x27')](_0x47ccd5,'id');})[_0x1f81('0x20')](function(_0x4fcc7f){throw _0x4fcc7f;});}exports[_0x1f81('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x41af1c){var _0x436c8e={'fields':[],'order':null};var _0x47f78f=_0x41af1c[_0x1f81('0x37')](',');_0x436c8e[_0x1f81('0x38')]=_[_0x1f81('0xc')](_0x47f78f,function(_0x2e46dc){if(!_0x2e46dc[_0x1f81('0x2b')]('globalStatus')){return!![];}_0x436c8e[_0x1f81('0x39')]=_[_0x1f81('0x3a')](_0x2e46dc,'-')?'DESC':'ASC';return![];});return _0x436c8e;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x178f5c){if(!_0x178f5c){_0x178f5c=_0x1f81('0x3b');}if(_0x178f5c['includes']('fullname')&&!_0x178f5c['includes'](_0x1f81('0x3c'))){var _0x87d158=_0x178f5c['substring'](0x0,_0x178f5c[_0x1f81('0x3d')](_0x1f81('0x31')));_0x178f5c+=','+_0x87d158+_0x1f81('0x3c');}return _0x178f5c;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x1bf0d0,_0x1dcbcd){var _0x139974=_0x1bf0d0[_0x1f81('0x3e')](function(_0x2f2d11,_0xb0d536){if(_0x2f2d11['globalStatus']===_0xb0d536[_0x1f81('0x35')]){if(_0x2f2d11[_0x1f81('0x35')]===_0x1f81('0x14')){if(_0x1dcbcd===_0x1f81('0x3f')){return(_0x2f2d11['pauseType']||'')<(_0xb0d536[_0x1f81('0x33')]||'')||_0x2f2d11[_0x1f81('0x31')]['toLowerCase']()>_0xb0d536[_0x1f81('0x31')]['toLowerCase']()?0x1:-0x1;}else{return(_0x2f2d11[_0x1f81('0x33')]||'')<(_0xb0d536['pauseType']||'')||_0x2f2d11[_0x1f81('0x31')]['toLowerCase']()>_0xb0d536[_0x1f81('0x31')][_0x1f81('0x40')]()?-0x1:0x1;}}else{if(_0x1dcbcd===_0x1f81('0x3f')){return _0x2f2d11['fullname'][_0x1f81('0x40')]()<_0xb0d536[_0x1f81('0x31')]['toLowerCase']()?0x1:-0x1;}else{return _0x2f2d11[_0x1f81('0x31')][_0x1f81('0x40')]()<_0xb0d536[_0x1f81('0x31')][_0x1f81('0x40')]()?-0x1:0x1;}}}else{if(_0x1dcbcd===_0x1f81('0x3f')){return _0x2f2d11[_0x1f81('0x35')]<_0xb0d536[_0x1f81('0x35')]?0x1:-0x1;}else{return _0x2f2d11['globalStatus']<_0xb0d536[_0x1f81('0x35')]?-0x1:0x1;}}});return _0x139974;}exports[_0x1f81('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x56bb39){var _0x133acf=[_0x1f81('0x42'),_0x1f81('0x43'),'lastLoginAt',_0x1f81('0x44'),_0x1f81('0x33'),'lastPauseAt',_0x1f81('0x3c'),'address','chatPause',_0x1f81('0x8'),_0x1f81('0x7'),_0x1f81('0x32'),'whatsappPause','faxPause',_0x1f81('0x9'),'chatCapacity',_0x1f81('0x45'),_0x1f81('0x46'),_0x1f81('0x47'),_0x1f81('0x48'),_0x1f81('0x49'),'chatCurrentCapacity',_0x1f81('0x4a'),_0x1f81('0x4b'),_0x1f81('0x4c'),_0x1f81('0x4d'),'faxCurrentCapacity','chatStatus',_0x1f81('0x18'),_0x1f81('0x17'),'smsStatus',_0x1f81('0x19'),'faxStatus',_0x1f81('0x13'),'chatStatusTime',_0x1f81('0x4e'),'mailStatusTime',_0x1f81('0x4f'),'whatsappStatusTime',_0x1f81('0x50'),_0x1f81('0x51'),_0x1f81('0x52'),'destconnectedlinenum',_0x1f81('0x53'),_0x1f81('0x54'),_0x1f81('0x55')];var _0x376732=['chatPause','openchannelPause',_0x1f81('0x7'),_0x1f81('0x32'),_0x1f81('0xa'),'faxPause',_0x1f81('0x9'),'online'];var _0x1734ff=_(_0x56bb39)['omit'](_0x376732)[_0x1f81('0x56')](_0x133acf)[_0x1f81('0x29')]();return _0x1734ff;}exports[_0x1f81('0x57')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x1f81('0x30'),_0x1f81('0x31'),_0x1f81('0x58'),_0x1f81('0x3c'),'online','globalStatus',_0x1f81('0x42'),'lastLoginAt',_0x1f81('0x33'),_0x1f81('0x44'),'faxPause','chatPause','mailPause','openchannelPause','smsPause','voicePause',_0x1f81('0xa'),'chatStatus',_0x1f81('0x16'),'mailStatus',_0x1f81('0x18'),_0x1f81('0x59'),_0x1f81('0x13'),_0x1f81('0x19'),_0x1f81('0x5a'),'faxStatusTime','mailStatusTime','openchannelStatusTime',_0x1f81('0x4f'),'voiceStatusTime',_0x1f81('0x5b'),'chatCapacity','faxCapacity','mailCapacity','openchannelCapacity',_0x1f81('0x47'),'whatsappCapacity',_0x1f81('0x5c'),_0x1f81('0x5d'),_0x1f81('0x4b'),'openchannelCurrentCapacity',_0x1f81('0x4c'),_0x1f81('0x4d'),_0x1f81('0x54'),_0x1f81('0x55'),'destconnectedlinenum',_0x1f81('0x5e'),_0x1f81('0x52'),_0x1f81('0x53')];}exports[_0x1f81('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index cf7db87..7b4171d 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 _0xe3a5=['waiting','invalid','onHold','ringing','ringInUse','talking','unavailable','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','outbound','loggedInDb','available','busy','merge','pick','initializeQueues','util','client','http','loggedIn','paused'];(function(_0x2fbe94,_0x15281a){var _0x2f3338=function(_0x277f6e){while(--_0x277f6e){_0x2fbe94['push'](_0x2fbe94['shift']());}};_0x2f3338(++_0x15281a);}(_0xe3a5,0x17b));var _0x5e3a=function(_0x49135c,_0x26020f){_0x49135c=_0x49135c-0x0;var _0x483fb2=_0xe3a5[_0x49135c];return _0x483fb2;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var util=require(_0x5e3a('0x0'));var amiClient=jayson[_0x5e3a('0x1')][_0x5e3a('0x2')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x5e3a('0x3'),_0x5e3a('0x4'),_0x5e3a('0x5')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x5e3a('0x6'),'loggedInDb','notInUse',_0x5e3a('0x7'),_0x5e3a('0x8'),_0x5e3a('0x9'),_0x5e3a('0xa'),_0x5e3a('0xb'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x5e3a('0xc'),_0x5e3a('0xd'),_0x5e3a('0xe'),_0x5e3a('0xf'),_0x5e3a('0x10'),_0x5e3a('0x11'),'Trunk',_0x5e3a('0x12'),_0x5e3a('0x13'),_0x5e3a('0x14'),_0x5e3a('0x15'),_0x5e3a('0x16'),_0x5e3a('0x17'),'dialPredictiveInterval',_0x5e3a('0x18'),_0x5e3a('0x19'),_0x5e3a('0x1a'),_0x5e3a('0x1b'),_0x5e3a('0x1c'),_0x5e3a('0x1d'),_0x5e3a('0x1e'),'predictiveIntervalAvgHoldtime',_0x5e3a('0x1f')];function getRealtimeQueues(_0x284fef,_0x7e34b4){var _0x262202=_0x7e34b4===_0x5e3a('0x20')?amiClient:routingClient;return _0x262202['request'](_['startCase'](_0x7e34b4)+'Queues',_0x284fef)[_0x5e3a('0x21')](function(_0x373984){if(_0x373984[_0x5e3a('0x22')])throw new Error(util[_0x5e3a('0x23')](_0x5e3a('0x24'),_0x7e34b4));return _0x373984[_0x5e3a('0x25')];})[_0x5e3a('0x26')](function(_0x3deeaf){throw _0x3deeaf;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x5375a9,_0x343ecd,_0x1a6e93,_0x190100){var _0x28f5df=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1a6e93===_0x5e3a('0x20')){if(_0x190100===_0x5e3a('0x27')){_0x28f5df=_0x28f5df[_0x5e3a('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x190100===_0x5e3a('0x29')){_0x28f5df=_0x28f5df['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x5375a9['map'](function(_0x3dd2c7){var _0x4cd31e=_0x3dd2c7['get']({'plain':!![]});_0x4cd31e['paused']=0x0;_0x4cd31e[_0x5e3a('0x2a')]=0x0;_0x4cd31e['loggedIn']=0x0;_0x4cd31e[_0x5e3a('0x2b')]=0x0;_0x4cd31e['waiting']=0x0;if(_0x1a6e93===_0x5e3a('0x20')){_0x4cd31e[_0x5e3a('0xa')]=0x0;_0x4cd31e[_0x5e3a('0x2c')]=0x0;if(_0x190100===_0x5e3a('0x29')){_0x4cd31e[_0x5e3a('0xc')]=0x0;_0x4cd31e[_0x5e3a('0xd')]=0x0;}}var _0x29176e=_['find'](_0x343ecd,['id',_0x4cd31e['id']]);if(_0x29176e){_[_0x5e3a('0x2d')](_0x4cd31e,_[_0x5e3a('0x2e')](_0x29176e,_0x28f5df));}return _0x4cd31e;});}exports[_0x5e3a('0x2f')]=initializeQueues; \ No newline at end of file +var _0x0feb=['pTalking','find','merge','pick','initializeQueues','lodash','jayson/promise','client','http','available','loggedIn','waiting','busy','inUse','loggedInDb','notInUse','ringInUse','talking','unavailable','unknown','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','concat','outbound','map','get','paused'];(function(_0x31e616,_0x22e300){var _0x1d6759=function(_0x216ed4){while(--_0x216ed4){_0x31e616['push'](_0x31e616['shift']());}};_0x1d6759(++_0x22e300);}(_0x0feb,0x195));var _0xb0fe=function(_0x2b2819,_0x4e64ba){_0x2b2819=_0x2b2819-0x0;var _0x359f2b=_0x0feb[_0x2b2819];return _0x359f2b;};'use strict';var _=require(_0xb0fe('0x0'));var jayson=require(_0xb0fe('0x1'));var util=require('util');var amiClient=jayson[_0xb0fe('0x2')][_0xb0fe('0x3')]({'port':0x232a});var routingClient=jayson[_0xb0fe('0x2')][_0xb0fe('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xb0fe('0x4'),_0xb0fe('0x5'),'paused',_0xb0fe('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xb0fe('0x7'),_0xb0fe('0x8'),'invalid',_0xb0fe('0x9'),_0xb0fe('0xa'),'onHold','ringing',_0xb0fe('0xb'),_0xb0fe('0xc'),_0xb0fe('0xd'),_0xb0fe('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xb0fe('0xf'),_0xb0fe('0x10'),'statusMessage',_0xb0fe('0x11'),_0xb0fe('0x12'),_0xb0fe('0x13'),_0xb0fe('0x14'),_0xb0fe('0x15'),'erlangCalls',_0xb0fe('0x16'),_0xb0fe('0x17'),_0xb0fe('0x18'),_0xb0fe('0x19'),_0xb0fe('0x1a'),_0xb0fe('0x1b'),'predictiveIntervalAvailable',_0xb0fe('0x1c'),_0xb0fe('0x1d'),'predictiveIntervalDroppedCallsTimeout',_0xb0fe('0x1e'),_0xb0fe('0x1f'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x58da00,_0x414a05){var _0x59330c=_0x414a05===_0xb0fe('0x20')?amiClient:routingClient;return _0x59330c['request'](_['startCase'](_0x414a05)+_0xb0fe('0x21'),_0x58da00)[_0xb0fe('0x22')](function(_0x547abd){if(_0x547abd['error'])throw new Error(util[_0xb0fe('0x23')](_0xb0fe('0x24'),_0x414a05));return _0x547abd[_0xb0fe('0x25')];})[_0xb0fe('0x26')](function(_0x434f5b){throw _0x434f5b;});}exports[_0xb0fe('0x27')]=getRealtimeQueues;function initializeQueues(_0x1867c4,_0x3319ea,_0x132ef5,_0x84789){var _0x1ac51a=DEFAULT_QUEUE_ATTRIBUTES;if(_0x132ef5===_0xb0fe('0x20')){if(_0x84789==='inbound'){_0x1ac51a=_0x1ac51a[_0xb0fe('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x84789===_0xb0fe('0x29')){_0x1ac51a=_0x1ac51a['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1867c4[_0xb0fe('0x2a')](function(_0x52f9c8){var _0xe468a9=_0x52f9c8[_0xb0fe('0x2b')]({'plain':!![]});_0xe468a9[_0xb0fe('0x2c')]=0x0;_0xe468a9[_0xb0fe('0x9')]=0x0;_0xe468a9['loggedIn']=0x0;_0xe468a9[_0xb0fe('0x4')]=0x0;_0xe468a9['waiting']=0x0;if(_0x132ef5===_0xb0fe('0x20')){_0xe468a9[_0xb0fe('0xc')]=0x0;_0xe468a9[_0xb0fe('0x7')]=0x0;if(_0x84789===_0xb0fe('0x29')){_0xe468a9[_0xb0fe('0x2d')]=0x0;_0xe468a9[_0xb0fe('0xf')]=0x0;}}var _0xb3a935=_[_0xb0fe('0x2e')](_0x3319ea,['id',_0xe468a9['id']]);if(_0xb3a935){_[_0xb0fe('0x2f')](_0xe468a9,_[_0xb0fe('0x30')](_0xb3a935,_0x1ac51a));}return _0xe468a9;});}exports[_0xb0fe('0x31')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index ca15480..9d9e715 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(_0x37d76d,_0x14ab7e){var _0x486c89=function(_0xb25ab6){while(--_0xb25ab6){_0x37d76d['push'](_0x37d76d['shift']());}};_0x486c89(++_0x14ab7e);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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(_0x29a4fb,_0x537211){var _0x20d5cf=function(_0x4efb3a){while(--_0x4efb3a){_0x29a4fb['push'](_0x29a4fb['shift']());}};_0x20d5cf(++_0x537211);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 50cbe87..dbd3ed4 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 _0xafcf=['test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','execSync','../environment','networkInterfaces','keys','length','filter','IPv4','head','mac','address','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','licenseToken'];(function(_0x4ae3ef,_0x1f882f){var _0x537c99=function(_0x2a5dde){while(--_0x2a5dde){_0x4ae3ef['push'](_0x4ae3ef['shift']());}};_0x537c99(++_0x1f882f);}(_0xafcf,0x152));var _0xfafc=function(_0x2860ab,_0x27440f){_0x2860ab=_0x2860ab-0x0;var _0x3037c4=_0xafcf[_0x2860ab];return _0x3037c4;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xfafc('0x0')];var config=require(_0xfafc('0x1'));function getInterfaces(){var _0xe4a11f=[];var _0x9042a0=os[_0xfafc('0x2')]();var _0x2e2a4e=_['orderBy'](_[_0xfafc('0x3')](_0x9042a0));for(var _0x3c5e8a=0x0;_0x3c5e8a<_0x2e2a4e[_0xfafc('0x4')];_0x3c5e8a++){var _0x472d94=_0x9042a0[_0x2e2a4e[_0x3c5e8a]][_0xfafc('0x5')](function(_0xa6b778){return _0xa6b778['family']===_0xfafc('0x6')&&_0xa6b778['internal']===![];});_0xe4a11f=_0xe4a11f['concat'](_0x472d94);}return _0xe4a11f;}function getFirstInterface(){var _0x565da0=_[_0xfafc('0x7')](getInterfaces());return{'macAddress':_0x565da0&&_0x565da0[_0xfafc('0x8')]?_0x565da0[_0xfafc('0x8')]:'00:00:00:00:00:00','ipAddress':_0x565da0&&_0x565da0[_0xfafc('0x9')]?_0x565da0[_0xfafc('0x9')]:'127.0.0.1'};}exports[_0xfafc('0xa')]=getFirstInterface;function getCPUhash(){var _0x53799e=_['orderBy'](os[_0xfafc('0xb')]()[_0xfafc('0xc')](function(_0x1eabf2){return _0x1eabf2[_0xfafc('0xd')];}))[_0xfafc('0xe')](':');return crypto[_0xfafc('0xf')](_0xfafc('0x10'))[_0xfafc('0x11')](_0x53799e)[_0xfafc('0x12')](_0xfafc('0x13'));}exports[_0xfafc('0x14')]=function(){var _0x8ff780=os['platform']();var _0x5ad29f=/[0-9a-f-]{36}/;if(config[_0xfafc('0x15')]&&_0x5ad29f[_0xfafc('0x16')](config[_0xfafc('0x15')])){return config[_0xfafc('0x15')];}else if(_0x8ff780==='win32'){return exec(_0xfafc('0x17'),{'encoding':_0xfafc('0x18')})[_0xfafc('0x19')]('\x0d\x0a','');}else{var _0x465d88=getFirstInterface();var _0x3d13ac=getCPUhash();var _0x2f4bb0=_0x3d13ac+'|'+os[_0xfafc('0x1a')]()+'|'+_0x465d88[_0xfafc('0x1b')]+'|'+_0x465d88[_0xfafc('0x1c')];var _0x53548e=crypto[_0xfafc('0xf')](_0xfafc('0x10'))[_0xfafc('0x11')](_0x2f4bb0)[_0xfafc('0x12')](_0xfafc('0x13'));return _0x53548e[_0xfafc('0x1d')](0x0,0x8)+'-'+_0x53548e[_0xfafc('0x1d')](0x8,0xc)+'-'+_0x53548e[_0xfafc('0x1d')](0xc,0x10)+'-'+_0x53548e[_0xfafc('0x1d')](0x10,0x14)+'-'+_0x53548e[_0xfafc('0x1d')](0x14);}}; \ No newline at end of file +var _0x4fe1=['networkInterfaces','orderBy','length','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','md5','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment'];(function(_0x4f1511,_0x1c4a71){var _0x5cfacb=function(_0x331001){while(--_0x331001){_0x4f1511['push'](_0x4f1511['shift']());}};_0x5cfacb(++_0x1c4a71);}(_0x4fe1,0xb3));var _0x14fe=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x4fe1[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x14fe('0x0'));var os=require('os');var crypto=require(_0x14fe('0x1'));var machine=require(_0x14fe('0x2'));var exec=require(_0x14fe('0x3'))[_0x14fe('0x4')];var config=require(_0x14fe('0x5'));function getInterfaces(){var _0x501d3c=[];var _0x193c37=os[_0x14fe('0x6')]();var _0x412bc8=_[_0x14fe('0x7')](_['keys'](_0x193c37));for(var _0x766f51=0x0;_0x766f51<_0x412bc8[_0x14fe('0x8')];_0x766f51++){var _0x251978=_0x193c37[_0x412bc8[_0x766f51]][_0x14fe('0x9')](function(_0x2dba7e){return _0x2dba7e[_0x14fe('0xa')]===_0x14fe('0xb')&&_0x2dba7e['internal']===![];});_0x501d3c=_0x501d3c[_0x14fe('0xc')](_0x251978);}return _0x501d3c;}function getFirstInterface(){var _0x1513da=_[_0x14fe('0xd')](getInterfaces());return{'macAddress':_0x1513da&&_0x1513da[_0x14fe('0xe')]?_0x1513da[_0x14fe('0xe')]:_0x14fe('0xf'),'ipAddress':_0x1513da&&_0x1513da['address']?_0x1513da[_0x14fe('0x10')]:_0x14fe('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x8c4759=_[_0x14fe('0x7')](os[_0x14fe('0x12')]()[_0x14fe('0x13')](function(_0x29b3cc){return _0x29b3cc[_0x14fe('0x14')];}))[_0x14fe('0x15')](':');return crypto['createHash'](_0x14fe('0x16'))['update'](_0x8c4759)[_0x14fe('0x17')](_0x14fe('0x18'));}exports[_0x14fe('0x19')]=function(){var _0x2dd8c5=os[_0x14fe('0x1a')]();var _0x26408c=/[0-9a-f-]{36}/;if(config[_0x14fe('0x1b')]&&_0x26408c[_0x14fe('0x1c')](config[_0x14fe('0x1b')])){return config[_0x14fe('0x1b')];}else if(_0x2dd8c5===_0x14fe('0x1d')){return exec(_0x14fe('0x1e'),{'encoding':_0x14fe('0x1f')})[_0x14fe('0x20')]('\x0d\x0a','');}else{var _0x5be74f=getFirstInterface();var _0x5d6703=getCPUhash();var _0x570e7e=_0x5d6703+'|'+os[_0x14fe('0x21')]()+'|'+_0x5be74f[_0x14fe('0x22')]+'|'+_0x5be74f[_0x14fe('0x23')];var _0x22781a=crypto['createHash'](_0x14fe('0x16'))['update'](_0x570e7e)['digest'](_0x14fe('0x18'));return _0x22781a[_0x14fe('0x24')](0x0,0x8)+'-'+_0x22781a['substring'](0x8,0xc)+'-'+_0x22781a[_0x14fe('0x24')](0xc,0x10)+'-'+_0x22781a[_0x14fe('0x24')](0x10,0x14)+'-'+_0x22781a[_0x14fe('0x24')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index bad323a..901d7f3 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 _0xa91a=['%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version'];(function(_0x34173c,_0x1ca995){var _0x596f37=function(_0x3ce53f){while(--_0x3ce53f){_0x34173c['push'](_0x34173c['shift']());}};_0x596f37(++_0x1ca995);}(_0xa91a,0x1ac));var _0xaa91=function(_0x10f87b,_0x4e6db5){_0x10f87b=_0x10f87b-0x0;var _0x32c506=_0xa91a[_0x10f87b];return _0x32c506;};'use strict';var util=require('util');var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xaa91('0x0'));var pkginfo=require(_0xaa91('0x1'))(module,'version');var db=require(_0xaa91('0x2'))['db'];var encryptor=require(_0xaa91('0x3'));var hardware=require(_0xaa91('0x4'));var logger=require(_0xaa91('0x5'))(_0xaa91('0x6'));var HOST=_0xaa91('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4b344f){return new BPromise(function(_0x401944,_0x1918fd){var _0x5db64b=util[_0xaa91('0x8')](_0xaa91('0x9'),HOST,_0x4b344f,module[_0xaa91('0xa')][_0xaa91('0xb')]);if(oldToken){_0x5db64b=util[_0xaa91('0x8')](_0xaa91('0xc'),HOST,_0x4b344f,module[_0xaa91('0xa')][_0xaa91('0xb')],oldToken);}var _0xd7df4e={'uri':_0x5db64b,'method':_0xaa91('0xd'),'timeout':0xea60,'json':!![]};return rp(_0xd7df4e)[_0xaa91('0xe')](function(_0x5bc4f4){_0x401944(_0x5bc4f4);})['catch'](function(_0x1d58b0){_0x1918fd(_0x1d58b0);});});}function manageLicense(_0x4c2614,_0x43afc5){var _0xf87b9d=_0x43afc5['get']({'plain':!![]});if(!isOldTokenSent&&_0xf87b9d[_0xaa91('0xf')]!==_0x4c2614&&!_0xf87b9d[_0xaa91('0x10')]){oldToken=_0xf87b9d[_0xaa91('0xf')];}httpRequest(_0x4c2614)[_0xaa91('0xe')](function(_0x2f54b3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2f54b3[_0xaa91('0x11')]){isOldTokenSent=![];if(!_0xf87b9d[_0xaa91('0x6')]&&_0xf87b9d[_0xaa91('0x6')]!=_0x2f54b3[_0xaa91('0x6')]||_0xf87b9d[_0xaa91('0x6')]&&_0xf87b9d[_0xaa91('0x10')]){logger[_0xaa91('0x12')](_0xaa91('0x13'));}if(_0xf87b9d[_0xaa91('0x6')]&&!_0xf87b9d[_0xaa91('0x10')]&&_0xf87b9d[_0xaa91('0x6')]!=_0x2f54b3['license']){logger[_0xaa91('0x12')](_0xaa91('0x14'));}if(_0xf87b9d['license']&&!_0xf87b9d[_0xaa91('0x10')]&&_0xf87b9d[_0xaa91('0x6')]==_0x2f54b3[_0xaa91('0x6')]){return _0x43afc5;}return _0x43afc5[_0xaa91('0x15')]({'data1':_0x4c2614,'data2':null,'license':_0x2f54b3[_0xaa91('0x6')]});}else{if(_0x2f54b3['license']||_0xf87b9d[_0xaa91('0x6')]){if(!_0xf87b9d[_0xaa91('0x10')]){if(_0xf87b9d['data1']==_0x4c2614){GRAY_PERIOD_REASON=_0xaa91('0x16');logger[_0xaa91('0x12')](_0xaa91('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xaa91('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xf87b9d[_0xaa91('0xf')],_0x4c2614);}logger['info'](_0xaa91('0x18'),GRAY_PERIOD_REASON[_0xaa91('0x19')](),moment()[_0xaa91('0x8')](_0xaa91('0x1a')));return _0x43afc5['update']({'data2':encryptor['encryptString'](moment()[_0xaa91('0x8')](_0xaa91('0x1a')))});}else{if(moment()[_0xaa91('0x1b')](encryptor[_0xaa91('0x1c')](_0xf87b9d[_0xaa91('0x10')]),_0xaa91('0x1d'))>DAYS){logger[_0xaa91('0x12')](_0xaa91('0x1e'),moment()[_0xaa91('0x8')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x43afc5[_0xaa91('0x15')]({'data1':_0x4c2614,'data2':null,'license':null});}}}else{if(_0xf87b9d[_0xaa91('0xf')]!=_0x4c2614){logger[_0xaa91('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xf87b9d[_0xaa91('0xf')],_0x4c2614);return _0x43afc5[_0xaa91('0x15')]({'data1':_0x4c2614,'data2':null,'license':null});}}}return _0x43afc5;})[_0xaa91('0xe')](function(_0x2f11fe){_0x43afc5=_0x2f11fe;})[_0xaa91('0x1f')](function(_0x3fec94){logger[_0xaa91('0x20')](_0x3fec94['message']);})[_0xaa91('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xaa91('0x22')](),_0x43afc5);},TIME);});}function defaultLicense(){var _0x2aaec4=hardware[_0xaa91('0x22')]();if(_0x2aaec4){return db[_0xaa91('0x23')][_0xaa91('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x2aaec4}})[_0xaa91('0x25')](function(_0x992847,_0x5492bb){logger[_0xaa91('0x12')](_0xaa91('0x26'),_0x2aaec4);manageLicense(_0x2aaec4,_0x992847);})[_0xaa91('0x1f')](function(_0x2e37f5){logger[_0xaa91('0x20')](_0x2e37f5[_0xaa91('0x27')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x1ec9=['catch','get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','format','error','message','getUuid','License','findOrCreate','spread','util','request-promise','bluebird','pkginfo','version','./hardware','https://www.xcallymotion.com','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then'];(function(_0x261ba2,_0x3fedad){var _0x3af319=function(_0x54dabd){while(--_0x54dabd){_0x261ba2['push'](_0x261ba2['shift']());}};_0x3af319(++_0x3fedad);}(_0x1ec9,0xeb));var _0x91ec=function(_0x14b7b0,_0x3de0aa){_0x14b7b0=_0x14b7b0-0x0;var _0x55eba5=_0x1ec9[_0x14b7b0];return _0x55eba5;};'use strict';var util=require(_0x91ec('0x0'));var moment=require('moment');var rp=require(_0x91ec('0x1'));var BPromise=require(_0x91ec('0x2'));var pkginfo=require(_0x91ec('0x3'))(module,_0x91ec('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x91ec('0x5'));var logger=require('../logger')('license');var HOST=_0x91ec('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xe297be){return new BPromise(function(_0x34c72f,_0x103e25){var _0x2cec2a=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0xe297be,module[_0x91ec('0x7')]['version']);if(oldToken){_0x2cec2a=util['format'](_0x91ec('0x8'),HOST,_0xe297be,module[_0x91ec('0x7')][_0x91ec('0x4')],oldToken);}var _0x127212={'uri':_0x2cec2a,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x127212)[_0x91ec('0x9')](function(_0x3fb805){_0x34c72f(_0x3fb805);})[_0x91ec('0xa')](function(_0x39ff3d){_0x103e25(_0x39ff3d);});});}function manageLicense(_0x5c6ae5,_0x248e2e){var _0x54a0fd=_0x248e2e[_0x91ec('0xb')]({'plain':!![]});if(!isOldTokenSent&&_0x54a0fd[_0x91ec('0xc')]!==_0x5c6ae5&&!_0x54a0fd[_0x91ec('0xd')]){oldToken=_0x54a0fd[_0x91ec('0xc')];}httpRequest(_0x5c6ae5)[_0x91ec('0x9')](function(_0x4cf90b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4cf90b[_0x91ec('0xe')]){isOldTokenSent=![];if(!_0x54a0fd[_0x91ec('0xf')]&&_0x54a0fd[_0x91ec('0xf')]!=_0x4cf90b[_0x91ec('0xf')]||_0x54a0fd[_0x91ec('0xf')]&&_0x54a0fd[_0x91ec('0xd')]){logger[_0x91ec('0x10')](_0x91ec('0x11'));}if(_0x54a0fd[_0x91ec('0xf')]&&!_0x54a0fd[_0x91ec('0xd')]&&_0x54a0fd[_0x91ec('0xf')]!=_0x4cf90b['license']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x54a0fd[_0x91ec('0xf')]&&!_0x54a0fd['data2']&&_0x54a0fd[_0x91ec('0xf')]==_0x4cf90b['license']){return _0x248e2e;}return _0x248e2e[_0x91ec('0x12')]({'data1':_0x5c6ae5,'data2':null,'license':_0x4cf90b['license']});}else{if(_0x4cf90b['license']||_0x54a0fd[_0x91ec('0xf')]){if(!_0x54a0fd['data2']){if(_0x54a0fd[_0x91ec('0xc')]==_0x5c6ae5){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x91ec('0x13'));}else{GRAY_PERIOD_REASON=_0x91ec('0x14');logger[_0x91ec('0x10')](_0x91ec('0x15'),_0x54a0fd['data1'],_0x5c6ae5);}logger[_0x91ec('0x10')](_0x91ec('0x16'),GRAY_PERIOD_REASON[_0x91ec('0x17')](),moment()['format'](_0x91ec('0x18')));return _0x248e2e[_0x91ec('0x12')]({'data2':encryptor['encryptString'](moment()['format'](_0x91ec('0x18')))});}else{if(moment()[_0x91ec('0x19')](encryptor[_0x91ec('0x1a')](_0x54a0fd[_0x91ec('0xd')]),'days')>DAYS){logger[_0x91ec('0x10')](_0x91ec('0x1b'),moment()[_0x91ec('0x1c')](_0x91ec('0x18')));isOldTokenSent=![];return _0x248e2e['update']({'data1':_0x5c6ae5,'data2':null,'license':null});}}}else{if(_0x54a0fd[_0x91ec('0xc')]!=_0x5c6ae5){logger[_0x91ec('0x10')](_0x91ec('0x15'),_0x54a0fd[_0x91ec('0xc')],_0x5c6ae5);return _0x248e2e[_0x91ec('0x12')]({'data1':_0x5c6ae5,'data2':null,'license':null});}}}return _0x248e2e;})['then'](function(_0x520960){_0x248e2e=_0x520960;})[_0x91ec('0xa')](function(_0xf7b89d){logger[_0x91ec('0x1d')](_0xf7b89d[_0x91ec('0x1e')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x91ec('0x1f')](),_0x248e2e);},TIME);});}function defaultLicense(){var _0x15234b=hardware['getUuid']();if(_0x15234b){return db[_0x91ec('0x20')][_0x91ec('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x15234b}})[_0x91ec('0x22')](function(_0x3ebf4b,_0x581da6){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x15234b);manageLicense(_0x15234b,_0x3ebf4b);})[_0x91ec('0xa')](function(_0x2778cd){logger[_0x91ec('0x1d')](_0x2778cd['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 8461516..0305beb 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 _0xab05=['catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','uuid','machineUuid','decryptString','gray','deadline','days','grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','col','count','role','admin','user','users','telephones','forEach','pick','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then'];(function(_0x24aafe,_0x4e3c17){var _0x224a60=function(_0x16b05f){while(--_0x16b05f){_0x24aafe['push'](_0x24aafe['shift']());}};_0x224a60(++_0x4e3c17);}(_0xab05,0xbe));var _0x5ab0=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xab05[_0x2d7f0e];return _0x110b07;};'use strict';var util=require(_0x5ab0('0x0'));var _=require(_0x5ab0('0x1'));var moment=require(_0x5ab0('0x2'));var BPromise=require(_0x5ab0('0x3'));var hardware=require('./hardware');var encryptor=require(_0x5ab0('0x4'));var db=require(_0x5ab0('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':_0x5ab0('0x6'),'machineUuid':hardware[_0x5ab0('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5ab0('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5ab0('0x9'),'machineUuid':hardware[_0x5ab0('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x154e30){return new BPromise(function(_0xc4e34e,_0x3415a5){return db[_0x5ab0('0xa')][_0x5ab0('0xb')](_[_0x5ab0('0xc')](_0x154e30,{'raw':!![],'where':{'id':0x1}}))[_0x5ab0('0xd')](function(_0x4e93ef){return checkLicense(_0x4e93ef,null);})['then'](function(_0x1d7e06){_0xc4e34e(_0x1d7e06);return;})[_0x5ab0('0xe')](function(_0x108aa1){_0x3415a5(_0x108aa1);});});}function checkLicense(_0x5892d4,_0x7ee784){if(!_0x5892d4){demoLicense['uuid']=_0x5892d4[_0x5ab0('0xf')];return demoLicense;}try{var _0x291e8a=_0x7ee784||_0x5892d4[_0x5ab0('0x10')];if(_[_0x5ab0('0x11')](_0x291e8a)){throw new Error(_0x5ab0('0x12'));}var _0x40cb0b=_0x5892d4[_0x5ab0('0xf')];var _0x240c28=_0x5892d4[_0x5ab0('0x13')];var _0x17aeaf=_0x40cb0b[_0x5ab0('0x14')]('-')[0x4];var _0x1b8fc6=_0x40cb0b['split']('-')[0x0];var _0x3dd5a9=encryptor['decryptString'](_0x291e8a,util[_0x5ab0('0x15')](_0x5ab0('0x16'),_0x17aeaf,_0x40cb0b,_0x1b8fc6));var _0x2a6d91=JSON[_0x5ab0('0x17')](_0x3dd5a9);_0x2a6d91[_0x5ab0('0x18')]=![];_0x2a6d91[_0x5ab0('0x19')]=_0x40cb0b;_0x2a6d91[_0x5ab0('0x1a')]=hardware[_0x5ab0('0x7')]();if(_0x240c28){var _0x277742=encryptor[_0x5ab0('0x1b')](_0x240c28);_0x2a6d91[_0x5ab0('0x1c')]=_0x277742;_0x2a6d91[_0x5ab0('0x1d')]=moment(_0x277742)['add'](0x7,_0x5ab0('0x1e'))[_0x5ab0('0x15')]();_0x2a6d91[_0x5ab0('0x1f')]=_0x2a6d91[_0x5ab0('0x19')]!=_0x2a6d91[_0x5ab0('0x1a')]?_0x5ab0('0x20'):_0x5ab0('0x21');}return _0x2a6d91;}catch(_0x486b05){breakingLicense[_0x5ab0('0x19')]=_0x5892d4['data1'];breakingLicense[_0x5ab0('0x22')]=_0x486b05['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3ccd6f,_0x155e02){getLicense()['then'](function(_0x30beea){return db[_0x5ab0('0x23')][_0x5ab0('0x24')]({'attributes':['role',[db[_0x5ab0('0x25')]['fn'](_0x5ab0('0x26'),db['sequelize'][_0x5ab0('0x27')]('role')),_0x5ab0('0x28')]],'group':_0x5ab0('0x29'),'where':{'role':{'$or':[_0x5ab0('0x2a'),_0x5ab0('0x2b'),'telephone']}},'raw':!![]})[_0x5ab0('0xd')](function(_0x1ec2ec){var _0xc4d38a={'user':_0x30beea[_0x5ab0('0x2c')]||0x0,'telephone':_0x30beea[_0x5ab0('0x2d')]||0x0};_0x1ec2ec[_0x5ab0('0x2e')](function(_0x360506){var _0x3eb97b=_0x360506[_0x5ab0('0x29')]===_0x5ab0('0x2a')?_0x5ab0('0x2b'):_0x360506[_0x5ab0('0x29')];_0xc4d38a[_0x3eb97b]-=_0x360506[_0x5ab0('0x28')];if(_0xc4d38a[_0x3eb97b]<0x0)_0xc4d38a[_0x3eb97b]=0x0;});_0x3ccd6f(_0xc4d38a);return;});})[_0x5ab0('0xe')](function(_0x4e95d1){_0x155e02(_0x4e95d1);});});}function checkUserLimits(_0x44f5b2){return new BPromise(function(_0x32454f,_0x429cdf){getLimits()[_0x5ab0('0xd')](function(_0x2ad8fb){var _0x52417a=_[_0x5ab0('0x2f')](_['countBy'](_0x44f5b2,_0x5ab0('0x29')),['admin','user',_0x5ab0('0x30')]);var _0x3e2654=(_0x52417a[_0x5ab0('0x2a')]||0x0)+(_0x52417a[_0x5ab0('0x2b')]||0x0);var _0x411bb9=_0x52417a[_0x5ab0('0x30')]||0x0;if(_0x3e2654>_0x2ad8fb[_0x5ab0('0x2b')])return _0x429cdf(_0x5ab0('0x31'));if(_0x411bb9>_0x2ad8fb[_0x5ab0('0x30')])return _0x429cdf(_0x5ab0('0x32'));return _0x32454f();})[_0x5ab0('0xe')](function(_0x1c3dad){_0x429cdf(_0x1c3dad);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x1a93=['changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user','forEach','countBy','telephone','License\x20limit\x20reached\x20for\x20users','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','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','demo','machineUuid','gray','deadline','add','days','format','grayReason'];(function(_0x3651f1,_0xfea7d){var _0x18290e=function(_0x5bcc93){while(--_0x5bcc93){_0x3651f1['push'](_0x3651f1['shift']());}};_0x18290e(++_0xfea7d);}(_0x1a93,0x188));var _0x31a9=function(_0x5835f2,_0x4acc25){_0x5835f2=_0x5835f2-0x0;var _0x2c3bce=_0x1a93[_0x5835f2];return _0x2c3bce;};'use strict';var util=require(_0x31a9('0x0'));var _=require(_0x31a9('0x1'));var moment=require(_0x31a9('0x2'));var BPromise=require(_0x31a9('0x3'));var hardware=require(_0x31a9('0x4'));var encryptor=require(_0x31a9('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x31a9('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x31a9('0x7'),'machineUuid':hardware[_0x31a9('0x8')](),'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':_0x31a9('0x9'),'machineUuid':hardware[_0x31a9('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4d53f0){return new BPromise(function(_0x34794d,_0x119356){return db[_0x31a9('0xa')][_0x31a9('0xb')](_[_0x31a9('0xc')](_0x4d53f0,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x2ae86e){return checkLicense(_0x2ae86e,null);})[_0x31a9('0xd')](function(_0x586483){_0x34794d(_0x586483);return;})[_0x31a9('0xe')](function(_0x2b7b8f){_0x119356(_0x2b7b8f);});});}function checkLicense(_0x59bf9b,_0x3c15c4){if(!_0x59bf9b){demoLicense[_0x31a9('0xf')]=_0x59bf9b[_0x31a9('0x10')];return demoLicense;}try{var _0x19e534=_0x3c15c4||_0x59bf9b['license'];if(_[_0x31a9('0x11')](_0x19e534)){throw new Error(_0x31a9('0x12'));}var _0x279f14=_0x59bf9b[_0x31a9('0x10')];var _0x73fbd9=_0x59bf9b[_0x31a9('0x13')];var _0x4a5159=_0x279f14[_0x31a9('0x14')]('-')[0x4];var _0x3077de=_0x279f14[_0x31a9('0x14')]('-')[0x0];var _0x1531ff=encryptor[_0x31a9('0x15')](_0x19e534,util['format'](_0x31a9('0x16'),_0x4a5159,_0x279f14,_0x3077de));var _0x1921da=JSON['parse'](_0x1531ff);_0x1921da[_0x31a9('0x17')]=![];_0x1921da[_0x31a9('0xf')]=_0x279f14;_0x1921da[_0x31a9('0x18')]=hardware['getUuid']();if(_0x73fbd9){var _0x1b4256=encryptor['decryptString'](_0x73fbd9);_0x1921da[_0x31a9('0x19')]=_0x1b4256;_0x1921da[_0x31a9('0x1a')]=moment(_0x1b4256)[_0x31a9('0x1b')](0x7,_0x31a9('0x1c'))[_0x31a9('0x1d')]();_0x1921da[_0x31a9('0x1e')]=_0x1921da['uuid']!=_0x1921da[_0x31a9('0x18')]?_0x31a9('0x1f'):_0x31a9('0x20');}return _0x1921da;}catch(_0x4c99f1){breakingLicense[_0x31a9('0xf')]=_0x59bf9b['data1'];breakingLicense[_0x31a9('0x21')]=_0x4c99f1[_0x31a9('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x202b4b,_0x535126){getLicense()[_0x31a9('0xd')](function(_0x168b11){return db[_0x31a9('0x22')][_0x31a9('0x23')]({'attributes':[_0x31a9('0x24'),[db[_0x31a9('0x25')]['fn'](_0x31a9('0x26'),db[_0x31a9('0x25')]['col'](_0x31a9('0x24'))),_0x31a9('0x27')]],'group':'role','where':{'role':{'$or':[_0x31a9('0x28'),_0x31a9('0x29'),'telephone']}},'raw':!![]})[_0x31a9('0xd')](function(_0xddab4f){var _0x38d746={'user':_0x168b11['users']||0x0,'telephone':_0x168b11['telephones']||0x0};_0xddab4f[_0x31a9('0x2a')](function(_0x3257c0){var _0x3ffc94=_0x3257c0['role']===_0x31a9('0x28')?'user':_0x3257c0[_0x31a9('0x24')];_0x38d746[_0x3ffc94]-=_0x3257c0[_0x31a9('0x27')];if(_0x38d746[_0x3ffc94]<0x0)_0x38d746[_0x3ffc94]=0x0;});_0x202b4b(_0x38d746);return;});})[_0x31a9('0xe')](function(_0x3102e4){_0x535126(_0x3102e4);});});}function checkUserLimits(_0x210c3d){return new BPromise(function(_0x5051d3,_0x87fba6){getLimits()['then'](function(_0x10a5d8){var _0x2c0365=_['pick'](_[_0x31a9('0x2b')](_0x210c3d,_0x31a9('0x24')),['admin',_0x31a9('0x29'),_0x31a9('0x2c')]);var _0x5cefc2=(_0x2c0365[_0x31a9('0x28')]||0x0)+(_0x2c0365[_0x31a9('0x29')]||0x0);var _0x41813=_0x2c0365['telephone']||0x0;if(_0x5cefc2>_0x10a5d8[_0x31a9('0x29')])return _0x87fba6(_0x31a9('0x2d'));if(_0x41813>_0x10a5d8[_0x31a9('0x2c')])return _0x87fba6('License\x20limit\x20reached\x20for\x20telephones');return _0x5051d3();})[_0x31a9('0xe')](function(_0x4ed407){_0x87fba6(_0x4ed407);});});}module[_0x31a9('0x2e')]={'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 ebf4f4f..928eeee 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 _0xc900=['app-id','secret','myappanuglar-secret'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xc900,0xb3));var _0x0c90=function(_0x35f68f,_0x27c0cf){_0x35f68f=_0x35f68f-0x0;var _0x314a47=_0xc900[_0x35f68f];return _0x314a47;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x0c90('0x0'),'GOOGLE_ID':_0x0c90('0x1'),'GOOGLE_SECRET':_0x0c90('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x5204=['http://localhost:9000','app-id','secret','exports'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0x5204,0xdf));var _0x4520=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x5204[_0x2e3107];return _0x833d69;};'use strict';module[_0x4520('0x0')]={'DOMAIN':_0x4520('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4520('0x2'),'GOOGLE_SECRET':_0x4520('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index b7018bc..15afc02 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bd3=['exports'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0x4bd3,0x1ee));var _0x34bd=function(_0x418631,_0x12a68f){_0x418631=_0x418631-0x0;var _0x3e010f=_0x4bd3[_0x418631];return _0x3e010f;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0x34bd('0x0')]=fileLogger; \ No newline at end of file +var _0x981d=['fileLogger','../utils/loggers'];(function(_0x46d63a,_0x44522b){var _0x1f1c12=function(_0x18c370){while(--_0x18c370){_0x46d63a['push'](_0x46d63a['shift']());}};_0x1f1c12(++_0x44522b);}(_0x981d,0x167));var _0xd981=function(_0x34db1a,_0x42fbef){_0x34db1a=_0x34db1a-0x0;var _0x1de2df=_0x981d[_0x34db1a];return _0x1de2df;};'use strict';var fileLogger=require(_0xd981('0x0'))[_0xd981('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3da815a..c0b35a2 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 _0x9674=['../../services/xdr/index.js','exports','path','../../config/environment','resolve','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','join','../../services/agi/index.js','email','xdr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9674,0x192));var _0x4967=function(_0x559cd9,_0x161f8a){_0x559cd9=_0x559cd9-0x0;var _0x40ca25=_0x9674[_0x559cd9];return _0x40ca25;};'use strict';var path=require(_0x4967('0x0'));var cfg=require(_0x4967('0x1'));var env={'NODE_PATH':path[_0x4967('0x2')](path['join'](cfg[_0x4967('0x3')],_0x4967('0x4')))};var pm2config={'apps':[{'name':_0x4967('0x5'),'script':path['join'](__dirname,_0x4967('0x6')),'env':env},{'name':_0x4967('0x7'),'script':path['join'](__dirname,_0x4967('0x8')),'env':env},{'name':_0x4967('0x9'),'script':path[_0x4967('0xa')](__dirname,_0x4967('0xb')),'env':env},{'name':_0x4967('0xc'),'script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0x4967('0xa')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x4967('0xd'),'script':path[_0x4967('0xa')](__dirname,_0x4967('0xe')),'env':env}]};module[_0x4967('0xf')]=pm2config; \ No newline at end of file +var _0xe530=['exports','path','../../config/environment','resolve','join','root','legacy-libs','express','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js'];(function(_0x1b2667,_0x279eb1){var _0x179ae8=function(_0x119262){while(--_0x119262){_0x1b2667['push'](_0x1b2667['shift']());}};_0x179ae8(++_0x279eb1);}(_0xe530,0x1c1));var _0x0e53=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe530[_0xa464c9];return _0x3d73c4;};'use strict';var path=require(_0x0e53('0x0'));var cfg=require(_0x0e53('0x1'));var env={'NODE_PATH':path[_0x0e53('0x2')](path[_0x0e53('0x3')](cfg[_0x0e53('0x4')],_0x0e53('0x5')))};var pm2config={'apps':[{'name':_0x0e53('0x6'),'script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x0e53('0x7'),'script':path[_0x0e53('0x3')](__dirname,_0x0e53('0x8')),'env':env},{'name':'agi','script':path['join'](__dirname,_0x0e53('0x9')),'env':env},{'name':_0x0e53('0xa'),'script':path['join'](__dirname,_0x0e53('0xb')),'env':env},{'name':_0x0e53('0xc'),'script':path[_0x0e53('0x3')](__dirname,_0x0e53('0xd')),'env':env},{'name':'xdr','script':path['join'](__dirname,_0x0e53('0xe')),'env':env}]};module[_0x0e53('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b2c71fe..56fb7fd 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 _0x713e=['then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','connect','connected','start'];(function(_0x3a6c58,_0xf360e2){var _0x3c9853=function(_0x4ad1cf){while(--_0x4ad1cf){_0x3a6c58['push'](_0x3a6c58['shift']());}};_0x3c9853(++_0xf360e2);}(_0x713e,0x12f));var _0xe713=function(_0x5c0979,_0x287854){_0x5c0979=_0x5c0979-0x0;var _0x309972=_0x713e[_0x5c0979];return _0x309972;};'use strict';var pm2=require(_0xe713('0x0'));var BPromise=require(_0xe713('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x2238c6,_0x55884e){return pm2[_0xe713('0x2')](function(_0xdca46e){if(_0xdca46e){return _0x55884e(_0xdca46e);}return _0x2238c6(_0xe713('0x3'));});});};exports[_0xe713('0x4')]=function(_0x350ab4){return connect()[_0xe713('0x5')](function(){return new BPromise(function(_0x3cac03,_0x4529c2){return pm2[_0xe713('0x4')](_0x350ab4,function(_0x54f60a,_0x30a069){if(_0x54f60a){return _0x4529c2(_0x54f60a);}pm2[_0xe713('0x6')]();return _0x3cac03(_0x30a069);});});});};exports['stop']=function(_0x547bde){return connect()[_0xe713('0x5')](function(){return new BPromise(function(_0x2274c2,_0x1d07bf){return pm2[_0xe713('0x7')](_0x547bde,function(_0x19d796,_0x594d6d){if(_0x19d796){return _0x1d07bf(_0x19d796);}pm2[_0xe713('0x6')]();return _0x2274c2(_0x594d6d);});});});};exports['restart']=function(_0x427f27){return connect()['then'](function(){return new BPromise(function(_0xb4e92,_0xc593a1){return pm2[_0xe713('0x8')](_0x427f27,function(_0x13ed1b,_0x5164ef){if(_0x13ed1b){return _0xc593a1(_0x13ed1b);}pm2[_0xe713('0x6')]();return _0xb4e92(_0x5164ef);});});});};exports[_0xe713('0x9')]=function(){return connect()[_0xe713('0x5')](function(){return new BPromise(function(_0x440164,_0x2c1edf){return pm2[_0xe713('0x9')](function(_0x36cc8f,_0x5520c2){if(_0x36cc8f){return _0x2c1edf(_0x36cc8f);}pm2['disconnect']();return _0x440164(_0x5520c2);});});});};exports[_0xe713('0xa')]=function(_0x38509f){return connect()['then'](function(){return new BPromise(function(_0x453832,_0x2bf702){return pm2[_0xe713('0xa')](_0x38509f,function(_0x55317a,_0x1ef055){if(_0x55317a){return _0x2bf702(_0x55317a);}pm2[_0xe713('0x6')]();return _0x453832(_0x1ef055);});});});};exports[_0xe713('0xb')]=function(_0x224b8e){return connect()[_0xe713('0x5')](function(){return new BPromise(function(_0x300659,_0x1178e6){return pm2[_0xe713('0xb')](_0x224b8e,function(_0x35daee,_0x5318bb){if(_0x35daee){return _0x1178e6(_0x35daee);}pm2['disconnect']();return _0x300659(_0x5318bb);});});});};exports[_0xe713('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4eaf15,_0x30777c){return pm2[_0xe713('0xc')](function(_0x8c79a2){if(_0x8c79a2){return _0x30777c(_0x8c79a2);}return _0x4eaf15(_0xe713('0xd'));});});});}; \ No newline at end of file +var _0xaecc=['stop','then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','start','disconnect'];(function(_0x21c9a1,_0x5118d0){var _0x5f2f80=function(_0x4e5023){while(--_0x4e5023){_0x21c9a1['push'](_0x21c9a1['shift']());}};_0x5f2f80(++_0x5118d0);}(_0xaecc,0xf2));var _0xcaec=function(_0x23f19e,_0x4d583b){_0x23f19e=_0x23f19e-0x0;var _0x2a95d4=_0xaecc[_0x23f19e];return _0x2a95d4;};'use strict';var pm2=require(_0xcaec('0x0'));var BPromise=require(_0xcaec('0x1'));var config=require(_0xcaec('0x2'));function connect(){return new BPromise(function(_0x18b689,_0x38a5ea){return pm2['connect'](function(_0xaf2fd){if(_0xaf2fd){return _0x38a5ea(_0xaf2fd);}return _0x18b689('connected');});});};exports[_0xcaec('0x3')]=function(_0x54a550){return connect()['then'](function(){return new BPromise(function(_0x4d7bba,_0x155703){return pm2[_0xcaec('0x3')](_0x54a550,function(_0x431027,_0x3342c9){if(_0x431027){return _0x155703(_0x431027);}pm2[_0xcaec('0x4')]();return _0x4d7bba(_0x3342c9);});});});};exports[_0xcaec('0x5')]=function(_0x1d51d7){return connect()[_0xcaec('0x6')](function(){return new BPromise(function(_0x4b438b,_0x4d3bbf){return pm2['stop'](_0x1d51d7,function(_0xa19d7a,_0x3a62a1){if(_0xa19d7a){return _0x4d3bbf(_0xa19d7a);}pm2[_0xcaec('0x4')]();return _0x4b438b(_0x3a62a1);});});});};exports[_0xcaec('0x7')]=function(_0x13c6fb){return connect()[_0xcaec('0x6')](function(){return new BPromise(function(_0x1a0440,_0x2f575f){return pm2[_0xcaec('0x7')](_0x13c6fb,function(_0x328996,_0x2865bc){if(_0x328996){return _0x2f575f(_0x328996);}pm2[_0xcaec('0x4')]();return _0x1a0440(_0x2865bc);});});});};exports[_0xcaec('0x8')]=function(){return connect()[_0xcaec('0x6')](function(){return new BPromise(function(_0x3f4378,_0x33e50b){return pm2['list'](function(_0x109ea9,_0x1d2a0d){if(_0x109ea9){return _0x33e50b(_0x109ea9);}pm2[_0xcaec('0x4')]();return _0x3f4378(_0x1d2a0d);});});});};exports[_0xcaec('0x9')]=function(_0x4bbcbd){return connect()['then'](function(){return new BPromise(function(_0x5bd7bd,_0x174eac){return pm2[_0xcaec('0x9')](_0x4bbcbd,function(_0x4dd2da,_0xf7ce3c){if(_0x4dd2da){return _0x174eac(_0x4dd2da);}pm2[_0xcaec('0x4')]();return _0x5bd7bd(_0xf7ce3c);});});});};exports[_0xcaec('0xa')]=function(_0xa27788){return connect()['then'](function(){return new BPromise(function(_0x179587,_0x5b13f7){return pm2[_0xcaec('0xa')](_0xa27788,function(_0x290762,_0x1fab01){if(_0x290762){return _0x5b13f7(_0x290762);}pm2['disconnect']();return _0x179587(_0x1fab01);});});});};exports[_0xcaec('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x214ce9,_0x3fbd76){return pm2['dump'](function(_0x5a80d7){if(_0x5a80d7){return _0x3fbd76(_0x5a80d7);}return _0x214ce9(_0xcaec('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 63b19e1..9baa43a 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 _0x5973=['socket.io-emitter','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults'];(function(_0x3b34c7,_0x539a28){var _0x664756=function(_0x13a797){while(--_0x13a797){_0x3b34c7['push'](_0x3b34c7['shift']());}};_0x664756(++_0x539a28);}(_0x5973,0x1a4));var _0x3597=function(_0x5aa17c,_0x5892b1){_0x5aa17c=_0x5aa17c-0x0;var _0x1d886b=_0x5973[_0x5aa17c];return _0x1d886b;};'use strict';var _=require(_0x3597('0x0'));var moment=require(_0x3597('0x1'));var Redis=require(_0x3597('0x2'));var util=require(_0x3597('0x3'));var config=require('../../config/environment');var db=require(_0x3597('0x4'))['db'];var logger=require(_0x3597('0x5'))(_0x3597('0x6'));config[_0x3597('0x7')]=_[_0x3597('0x8')](config[_0x3597('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x3597('0x9'))(new Redis(config[_0x3597('0x7')]));function closeInteractions(){var _0x1cdb20=0x0;var _0x1a4770=[];return db['Setting'][_0x3597('0xa')]({'raw':!![],'attributes':['id',_0x3597('0xb')],'where':{'id':0x1}})[_0x3597('0xc')](function(_0x1f1d15){_0x1cdb20=_0x1f1d15['chatTimeout'];if(_0x1cdb20){return db[_0x3597('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x3597('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3597('0xf')](_0x1f1d15[_0x3597('0xb')],_0x3597('0x10'))}}});}else{return[];}})['then'](function(_0x2bb83f){if(_0x2bb83f&&_0x2bb83f['length']){_0x1a4770=_[_0x3597('0x11')](_0x2bb83f||[],'id');logger[_0x3597('0x12')](_0x3597('0x13'),_0x1a4770[_0x3597('0x14')]());return db[_0x3597('0xd')][_0x3597('0x15')]({'closeReason':_0x3597('0x16'),'disposition':_0x3597('0x17'),'closed':!![],'closedAt':moment()['format'](_0x3597('0x18'))},{'where':{'id':_0x1a4770}});}})[_0x3597('0xc')](function(){if(_0x1a4770&&_0x1a4770[_0x3597('0x19')]){logger[_0x3597('0x12')](_0x3597('0x1a'),_0x1a4770[_0x3597('0x14')]());for(var _0x44c7d8=0x0;_0x44c7d8<_0x1a4770[_0x3597('0x19')];_0x44c7d8++){io[_0x3597('0x1b')](_0x3597('0x1c'),{'id':_0x1a4770[_0x44c7d8],'closed':!![]});}}})[_0x3597('0x1d')](function(_0x3d0fa4){logger['error'](_0x3597('0x1e'),_0x3d0fa4?util[_0x3597('0x1f')](_0x3d0fa4,{'showHidden':![],'depth':null}):'');});}exports[_0x3597('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6706=['start','lodash','../../config/environment','../../mysqldb','schedule','defaults','redis','localhost','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error'];(function(_0x556c8e,_0x523f91){var _0x2f9d4c=function(_0x164d22){while(--_0x164d22){_0x556c8e['push'](_0x556c8e['shift']());}};_0x2f9d4c(++_0x523f91);}(_0x6706,0x17a));var _0x6670=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6706[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6670('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require('util');var config=require(_0x6670('0x1'));var db=require(_0x6670('0x2'))['db'];var logger=require('../logger')(_0x6670('0x3'));config['redis']=_[_0x6670('0x4')](config[_0x6670('0x5')],{'host':_0x6670('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x2f3614=0x0;var _0x4b1520=[];return db[_0x6670('0x7')][_0x6670('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x6670('0x9')](function(_0x156a89){_0x2f3614=_0x156a89[_0x6670('0xa')];if(_0x2f3614){return db[_0x6670('0xb')][_0x6670('0xc')]({'raw':!![],'attributes':['id',_0x6670('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x156a89[_0x6670('0xa')],_0x6670('0xe'))}}});}else{return[];}})[_0x6670('0x9')](function(_0x117278){if(_0x117278&&_0x117278[_0x6670('0xf')]){_0x4b1520=_[_0x6670('0x10')](_0x117278||[],'id');logger['info'](_0x6670('0x11'),_0x4b1520[_0x6670('0x12')]());return db[_0x6670('0xb')][_0x6670('0x13')]({'closeReason':_0x6670('0x14'),'disposition':_0x6670('0x15'),'closed':!![],'closedAt':moment()[_0x6670('0x16')](_0x6670('0x17'))},{'where':{'id':_0x4b1520}});}})[_0x6670('0x9')](function(){if(_0x4b1520&&_0x4b1520[_0x6670('0xf')]){logger['info'](_0x6670('0x18'),_0x4b1520[_0x6670('0x12')]());for(var _0x2d7fd6=0x0;_0x2d7fd6<_0x4b1520['length'];_0x2d7fd6++){io[_0x6670('0x19')]('chatInteraction:update',{'id':_0x4b1520[_0x2d7fd6],'closed':!![]});}}})[_0x6670('0x1a')](function(_0x262da0){logger[_0x6670('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x262da0?util['inspect'](_0x262da0,{'showHidden':![],'depth':null}):'');});}exports[_0x6670('0x1c')]=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 4104a2a..815da26 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 _0x7ec2=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0xe2ec9b,_0x3e9e2a){var _0x2e2399=function(_0x207de7){while(--_0x207de7){_0xe2ec9b['push'](_0xe2ec9b['shift']());}};_0x2e2399(++_0x3e9e2a);}(_0x7ec2,0x1e5));var _0x27ec=function(_0x3c0b7f,_0x9ce4f6){_0x3c0b7f=_0x3c0b7f-0x0;var _0x1a1d78=_0x7ec2[_0x3c0b7f];return _0x1a1d78;};'use strict';function start(){var _0x23419f=require(_0x27ec('0x0'));return _0x23419f[_0x27ec('0x1')]();}module[_0x27ec('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xafe2=['startAllRefreshIntervals','exports'];(function(_0x1ecac6,_0x123728){var _0x113af5=function(_0xfb5df7){while(--_0xfb5df7){_0x1ecac6['push'](_0x1ecac6['shift']());}};_0x113af5(++_0x123728);}(_0xafe2,0x1aa));var _0x2afe=function(_0x41e4ef,_0x3b6d9d){_0x41e4ef=_0x41e4ef-0x0;var _0x59516d=_0xafe2[_0x41e4ef];return _0x59516d;};'use strict';function start(){var _0x2fec1c=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x2fec1c[_0x2afe('0x0')]();}module[_0x2afe('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index b8d2d4b..5abdc50 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 _0xd6de=['keyBy','difference','intersection','length','exists','deleteJob','toRun','resolve','run\x20job','cron','active','isBetween','endAt','start','add\x20cron','stop\x20cron','startAt','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','../logger','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','findOne','then','info','email','MailAccount','getSmtpOptions','format','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error','error\x20mail','stringify','email\x20sent','catch','currentAttempt','retries','data','stop','operation','still\x20loading','case\x20completed','job','case\x20empty','case\x20failed','entity','dataValues','attempt','Job\x20ID\x20','report\x20status:','sendMail','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString'];(function(_0x77fc7e,_0x1f0e9b){var _0x3fef51=function(_0x6b8381){while(--_0x6b8381){_0x77fc7e['push'](_0x77fc7e['shift']());}};_0x3fef51(++_0x1f0e9b);}(_0xd6de,0x1c0));var _0xed6d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd6de[_0x19950b];return _0x3c6b41;};'use strict';var fs=require('fs');var util=require(_0xed6d('0x0'));var path=require(_0xed6d('0x1'));var _=require(_0xed6d('0x2'));var moment=require(_0xed6d('0x3'));var CronJobManager=require(_0xed6d('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0xed6d('0x5'));var logger=require(_0xed6d('0x6'))('schedule');var db=require('../../mysqldb')['db'];const retry=require(_0xed6d('0x7'));var analyticCustomReportController=require(_0xed6d('0x8'));var analyticDefaultReportController=require(_0xed6d('0x9'));var client=jayson['client'][_0xed6d('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x9dfb04){const _0x297de2={};if(typeof _0x9dfb04===_0xed6d('0xb')){_0x297de2['id']=_0x9dfb04;}return db['AnalyticExtractedReport'][_0xed6d('0xc')]({'where':_0x297de2})[_0xed6d('0xd')](function(_0x1b94de){return _0x1b94de;})['catch'](function(_0x6f668){logger['error'](_0x6f668);});}function handleSendEmail(_0x20691c,_0x3de5d9){logger[_0xed6d('0xe')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x20691c[_0xed6d('0xf')]);var _0x5f59a4=!![];var _0x27ba3f=_0x20691c[_0xed6d('0x10')][_0xed6d('0x11')]();var _0x363e9b={'account':_0x27ba3f,'message':{'from':util[_0xed6d('0x12')]('\x22%s\x22\x20<%s>',_0x20691c['MailAccount'][_0xed6d('0x13')],_0x20691c['MailAccount'][_0xed6d('0xf')]||_0x20691c[_0xed6d('0x10')][_0xed6d('0x14')][_0xed6d('0x15')]),'to':_0x20691c[_0xed6d('0xf')],'cc':_0x20691c['cc'],'bcc':_0x20691c[_0xed6d('0x16')],'subject':util['format'](_0xed6d('0x17'),_0x3de5d9[_0xed6d('0x13')],_0x20691c[_0xed6d('0x18')],_0x20691c[_0xed6d('0x19')])}};var _0xa1075e=path[_0xed6d('0x1a')](__dirname,_0xed6d('0x1b'));var _0x273c6c=_0x3de5d9[_0xed6d('0x1c')];var _0x50839c=util[_0xed6d('0x12')](_0xed6d('0x1d'),path['basename'](_0x3de5d9['savename'],path[_0xed6d('0x1e')](_0x3de5d9[_0xed6d('0x1c')])),_0xed6d('0x1f'));var _0x4b3914=path['join'](_0xa1075e,_0x273c6c);var _0x4392ab=path['join'](_0xa1075e,_0x50839c);if(fs[_0xed6d('0x20')](_0x4b3914)){_0x3de5d9['status']=_0xed6d('0x21');_0x363e9b[_0xed6d('0x22')][_0xed6d('0x23')]=[{'filename':_0x273c6c,'path':_0x4b3914}];_0x363e9b['message'][_0xed6d('0x24')]=util[_0xed6d('0x12')](_0xed6d('0x25'),JSON['stringify'](_0x3de5d9,null,0x2));}else if(fs[_0xed6d('0x20')](_0x4392ab)){_0x3de5d9[_0xed6d('0x26')]=_0xed6d('0x21');_0x363e9b[_0xed6d('0x22')][_0xed6d('0x23')]=[{'filename':_0x50839c,'path':_0x4392ab}];}else{if(_0x3de5d9['status']===_0xed6d('0x27')){_0x363e9b[_0xed6d('0x22')][_0xed6d('0x24')]=_0xed6d('0x28');if(!_0x20691c[_0xed6d('0x29')]){_0x5f59a4=![];logger[_0xed6d('0xe')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x3de5d9[_0xed6d('0x26')]===_0xed6d('0x2a')){_0x363e9b[_0xed6d('0x22')][_0xed6d('0x24')]=_0xed6d('0x2b');}else if(_0x3de5d9['status']==='Completed'){_0x363e9b[_0xed6d('0x22')][_0xed6d('0x24')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x3de5d9['status']===_0xed6d('0x2c')){_0x363e9b[_0xed6d('0x22')][_0xed6d('0x24')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger['error'](_0xed6d('0x2d'),_0x3de5d9[_0xed6d('0x26')]);}}if(_0x5f59a4){return client[_0xed6d('0x2e')](_0xed6d('0x2f'),_0x363e9b)[_0xed6d('0xd')](function(_0xf8b840){if(_0xf8b840[_0xed6d('0x30')]){return logger[_0xed6d('0x30')](_0xed6d('0x31'),JSON[_0xed6d('0x32')](_0xf8b840));}return logger[_0xed6d('0xe')](_0xed6d('0x33'));})[_0xed6d('0x34')](function(_0x41d2bd){return logger['error']('error\x20mail',JSON[_0xed6d('0x32')](_0x41d2bd));});}}function handleError(){return function(_0x42c23d){return logger[_0xed6d('0x30')](JSON[_0xed6d('0x32')](_0x42c23d));};}function loading(_0x5f4a08){logger[_0xed6d('0xe')]('case\x20loading');if(_0x5f4a08[_0xed6d('0x35')]===_0x5f4a08['retryOptions'][_0xed6d('0x36')]){handleSendEmail(_0x5f4a08['job'],_0x5f4a08[_0xed6d('0x37')]);_0x5f4a08['operation'][_0xed6d('0x38')]();}else{_0x5f4a08[_0xed6d('0x39')][_0xed6d('0x7')](_0xed6d('0x3a'));}}function completed(_0x21ee17){logger[_0xed6d('0xe')](_0xed6d('0x3b'));handleSendEmail(_0x21ee17[_0xed6d('0x3c')],_0x21ee17['data']);_0x21ee17[_0xed6d('0x39')]['stop']();}function empty(_0x3d2ebd){logger[_0xed6d('0xe')](_0xed6d('0x3d'));handleSendEmail(_0x3d2ebd['job'],_0x3d2ebd['data']);_0x3d2ebd[_0xed6d('0x39')][_0xed6d('0x38')]();}function failed(_0x89e5ce){logger[_0xed6d('0xe')](_0xed6d('0x3e'));handleSendEmail(_0x89e5ce['job'],_0x89e5ce[_0xed6d('0x37')]);_0x89e5ce['operation']['stop']();}function urecognized(_0xead577){logger[_0xed6d('0x30')]('Unrecognized\x20status:',_0xead577[_0xed6d('0x3f')][_0xed6d('0x40')][_0xed6d('0x26')]);_0xead577['operation']['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x56dbf6,_0x56399e){const _0x4fc2fb={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0xf161e=retry[_0xed6d('0x39')](_0x4fc2fb);_0xf161e[_0xed6d('0x41')](_0x35655a=>{logger[_0xed6d('0xe')](_0xed6d('0x42')+_0x56dbf6['id']+'\x20Attempt\x20#:'+_0x35655a);try{getReportData(_0x56399e['id'])[_0xed6d('0xd')](function(_0xa26c76){_0x56399e=_0xa26c76;logger['info'](_0xed6d('0x43'),_0xa26c76[_0xed6d('0x40')][_0xed6d('0x26')]);if(!reportStatusStrategies[_0xa26c76[_0xed6d('0x40')][_0xed6d('0x26')]]){logger[_0xed6d('0x30')](_0xed6d('0x43'),_0xa26c76['dataValues'][_0xed6d('0x26')]);_0xf161e['retry']();}reportStatusStrategies[_0xa26c76[_0xed6d('0x40')]['status']]({'operation':_0xf161e,'currentAttempt':_0x35655a,'retryOptions':_0x4fc2fb,'job':_0x56dbf6,'data':_0x56399e,'entity':_0xa26c76});});}catch(_0x1205e3){_0xf161e['retry'](_0x1205e3);}});}function handleResult(_0x41539f){return function(_0x25364c){if(_0x41539f[_0xed6d('0x44')]&&_0x41539f['MailAccount']&&_0x41539f[_0xed6d('0x10')][_0xed6d('0x14')]&&!_[_0xed6d('0x45')](_0x41539f[_0xed6d('0xf')])){retryer(_0x41539f,_0x25364c);}};}function handleJob(_0x4904d8){return function(){try{if(_[_0xed6d('0x45')](_0x4904d8[_0xed6d('0x18')])){return logger[_0xed6d('0xe')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xed6d('0x45')](_0x4904d8[_0xed6d('0x19')])){return logger[_0xed6d('0xe')]('subtractUnit\x20null\x20or\x20undefined');}var _0x259eca={'startDate':moment()[_0xed6d('0x46')](_0x4904d8[_0xed6d('0x18')],_0x4904d8[_0xed6d('0x19')])[_0xed6d('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xed6d('0x12')](_0xed6d('0x47')),'type':'scheduled','output':_0x4904d8[_0xed6d('0x48')],'name':_0x4904d8[_0xed6d('0x13')]};if(!_[_0xed6d('0x45')](_0x4904d8['DefaultReportId'])){logger[_0xed6d('0xe')](_0xed6d('0x49'),_0x4904d8[_0xed6d('0x4a')]);return analyticDefaultReportController[_0xed6d('0x4b')]({'id':_0x4904d8['DefaultReportId']},_0x259eca)[_0xed6d('0xd')](handleResult(_0x4904d8))[_0xed6d('0x34')](handleError());}if(!_['isNil'](_0x4904d8[_0xed6d('0x4c')])){logger[_0xed6d('0xe')](_0xed6d('0x4d'),_0x4904d8[_0xed6d('0x4c')]);return analyticCustomReportController['runReport']({'id':_0x4904d8['CustomReportId']},_0x259eca)[_0xed6d('0xd')](handleResult(_0x4904d8))[_0xed6d('0x34')](handleError());}}catch(_0x2754be){logger['error'](JSON[_0xed6d('0x32')](_0x2754be));}return logger['info'](_0xed6d('0x4e'));};}function getJobs(_0x4b4304){var _0x47f9fd={};if(_0x4b4304){_0x47f9fd['id']=_0x4b4304;}return db[_0xed6d('0x4f')][_0xed6d('0x50')]({'where':_0x47f9fd,'include':[{'model':db['MailAccount'],'attributes':['id',_0xed6d('0x13'),_0xed6d('0xf')],'include':[{'model':db[_0xed6d('0x51')],'as':_0xed6d('0x14'),'include':[{'model':db[_0xed6d('0x52')],'as':_0xed6d('0x52')}]}]}]})[_0xed6d('0xd')](function(_0x2825dd){var _0x49fe09=_[_0xed6d('0x53')](manager[_0xed6d('0x54')]);var _0x44a632=_[_0xed6d('0x55')](_0x2825dd,function(_0x464bc1){return _0x464bc1['id'][_0xed6d('0x56')]();});var _0x5cd777=_[_0xed6d('0x57')](_0x2825dd,function(_0x4e818f){return _0x4e818f['id'][_0xed6d('0x56')]();});var _0x453764=_0x4b4304?_0x44a632:_[_0xed6d('0x58')](_0x44a632,_0x49fe09);var _0x4550be=_[_0xed6d('0x59')](_0x44a632,_0x49fe09);var _0x3a18da=_[_0xed6d('0x58')](_0x49fe09,_0x44a632);var _0x383912;var _0x5cc169;for(_0x383912=0x0;_0x383912<_0x3a18da[_0xed6d('0x5a')]&&!_0x4b4304;_0x383912+=0x1){_0x5cc169=_0x3a18da[_0x383912][_0xed6d('0x56')]();if(manager[_0xed6d('0x5b')](_0x5cc169)){manager[_0xed6d('0x38')](_0x5cc169);manager[_0xed6d('0x5c')](_0x5cc169);logger[_0xed6d('0xe')]('delete\x20cron',_0x5cc169);}}logger[_0xed6d('0xe')](_0xed6d('0x5d'),JSON[_0xed6d('0x32')](_0x453764));for(_0x383912=0x0;_0x383912<_0x453764['length'];_0x383912+=0x1){_0x5cc169=_0x453764[_0x383912][_0xed6d('0x56')]();if(_0x4b4304){logger[_0xed6d('0xe')](JSON[_0xed6d('0x32')](_0x5cd777[_0x5cc169]));BPromise[_0xed6d('0x5e')]()[_0xed6d('0xd')](handleJob(_0x5cd777[_0x5cc169]));logger['info'](_0xed6d('0x5f'),_0x5cd777[_0x5cc169]['name'],_0x5cd777[_0x5cc169][_0xed6d('0x60')]);}else if(_0x5cd777[_0x5cc169][_0xed6d('0x60')]&&_0x5cd777[_0x5cc169][_0xed6d('0x61')]&&moment()[_0xed6d('0x62')](_0x5cd777[_0x5cc169]['startAt'],_0x5cd777[_0x5cc169][_0xed6d('0x63')])){manager['add'](_0x5cc169,_0x5cd777[_0x5cc169][_0xed6d('0x60')],handleJob(_0x5cd777[_0x5cc169]));manager[_0xed6d('0x64')](_0x5cc169);logger['info'](_0xed6d('0x65'),_0x5cd777[_0x5cc169][_0xed6d('0x13')],_0x5cd777[_0x5cc169][_0xed6d('0x60')]);}else if(manager[_0xed6d('0x5b')](_0x5cc169)){manager[_0xed6d('0x38')](_0x5cc169);manager[_0xed6d('0x5c')](_0x5cc169);logger[_0xed6d('0xe')](_0xed6d('0x66'),_0x5cd777[_0x5cc169]['name'],_0x5cd777[_0x5cc169][_0xed6d('0x60')]);}}for(_0x383912=0x0,_0x5cc169;_0x383912<_0x4550be[_0xed6d('0x5a')]&&!_0x4b4304;_0x383912+=0x1){_0x5cc169=_0x4550be[_0x383912][_0xed6d('0x56')]();if(manager[_0xed6d('0x5b')](_0x5cc169)){if(_0x5cd777[_0x5cc169][_0xed6d('0x60')]&&_0x5cd777[_0x5cc169][_0xed6d('0x61')]&&moment()[_0xed6d('0x62')](_0x5cd777[_0x5cc169][_0xed6d('0x67')],_0x5cd777[_0x5cc169][_0xed6d('0x63')])){manager[_0xed6d('0x68')](_0x5cc169,_0x5cd777[_0x5cc169][_0xed6d('0x60')],handleJob(_0x5cd777[_0x5cc169]));logger[_0xed6d('0xe')](_0xed6d('0x69'),_0x5cd777[_0x5cc169][_0xed6d('0x13')],_0x5cd777[_0x5cc169][_0xed6d('0x60')]);}else{manager[_0xed6d('0x38')](_0x5cc169);manager[_0xed6d('0x5c')](_0x5cc169);logger[_0xed6d('0xe')](_0xed6d('0x66'),_0x5cd777[_0x5cc169]['name'],_0x5cd777[_0x5cc169][_0xed6d('0x60')]);}}}})[_0xed6d('0x34')](function(_0x2bc701){logger[_0xed6d('0x30')](JSON[_0xed6d('0x32')](_0x2bc701));});}exports[_0xed6d('0x6a')]=function(_0x4f601e){return getJobs(_0x4f601e);};exports[_0xed6d('0x64')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x62f6=['report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','intersection','length','deleteJob','toRun','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','exists','stop\x20cron','active','update','update\x20cron','run','util','path','lodash','cron-job-manager','bluebird','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','AnalyticExtractedReport','findOne','then','error','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','name','email','Smtp','user','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','extname','zip','existsSync','status','Sent','message','attachments','text','stringify','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','catch','currentAttempt','retryOptions','operation','stop','still\x20loading','case\x20completed','job','data','case\x20empty','case\x20failed','dataValues','Job\x20ID\x20'];(function(_0x4ca9ed,_0x17ea36){var _0x5197b3=function(_0x2da694){while(--_0x2da694){_0x4ca9ed['push'](_0x4ca9ed['shift']());}};_0x5197b3(++_0x17ea36);}(_0x62f6,0x15e));var _0x662f=function(_0x2f0d8e,_0x39acb4){_0x2f0d8e=_0x2f0d8e-0x0;var _0x5565cd=_0x62f6[_0x2f0d8e];return _0x5565cd;};'use strict';var fs=require('fs');var util=require(_0x662f('0x0'));var path=require(_0x662f('0x1'));var _=require(_0x662f('0x2'));var moment=require('moment');var CronJobManager=require(_0x662f('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x662f('0x4'));var logger=require('../logger')('schedule');var db=require(_0x662f('0x5'))['db'];const retry=require(_0x662f('0x6'));var analyticCustomReportController=require(_0x662f('0x7'));var analyticDefaultReportController=require(_0x662f('0x8'));var client=jayson['client'][_0x662f('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x5f1314){const _0x5e8565={};if(typeof _0x5f1314===_0x662f('0xa')){_0x5e8565['id']=_0x5f1314;}return db[_0x662f('0xb')][_0x662f('0xc')]({'where':_0x5e8565})[_0x662f('0xd')](function(_0x490a41){return _0x490a41;})['catch'](function(_0x423864){logger[_0x662f('0xe')](_0x423864);});}function handleSendEmail(_0x40cbd7,_0xa906b1){logger[_0x662f('0xf')](_0x662f('0x10'),_0x40cbd7['email']);var _0x5df121=!![];var _0x30d8a0=_0x40cbd7[_0x662f('0x11')][_0x662f('0x12')]();var _0x5b171f={'account':_0x30d8a0,'message':{'from':util[_0x662f('0x13')]('\x22%s\x22\x20<%s>',_0x40cbd7[_0x662f('0x11')][_0x662f('0x14')],_0x40cbd7['MailAccount'][_0x662f('0x15')]||_0x40cbd7[_0x662f('0x11')][_0x662f('0x16')][_0x662f('0x17')]),'to':_0x40cbd7[_0x662f('0x15')],'cc':_0x40cbd7['cc'],'bcc':_0x40cbd7[_0x662f('0x18')],'subject':util[_0x662f('0x13')]('Report\x20%s\x20last\x20%s\x20%s',_0xa906b1[_0x662f('0x14')],_0x40cbd7[_0x662f('0x19')],_0x40cbd7[_0x662f('0x1a')])}};var _0x52c64d=path[_0x662f('0x1b')](__dirname,_0x662f('0x1c'));var _0x57d31b=_0xa906b1[_0x662f('0x1d')];var _0x3449db=util[_0x662f('0x13')]('%s.%s',path['basename'](_0xa906b1['savename'],path[_0x662f('0x1e')](_0xa906b1['savename'])),_0x662f('0x1f'));var _0x5d6de3=path['join'](_0x52c64d,_0x57d31b);var _0x40d7d1=path[_0x662f('0x1b')](_0x52c64d,_0x3449db);if(fs[_0x662f('0x20')](_0x5d6de3)){_0xa906b1[_0x662f('0x21')]=_0x662f('0x22');_0x5b171f[_0x662f('0x23')][_0x662f('0x24')]=[{'filename':_0x57d31b,'path':_0x5d6de3}];_0x5b171f['message'][_0x662f('0x25')]=util[_0x662f('0x13')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x662f('0x26')](_0xa906b1,null,0x2));}else if(fs['existsSync'](_0x40d7d1)){_0xa906b1[_0x662f('0x21')]=_0x662f('0x22');_0x5b171f[_0x662f('0x23')][_0x662f('0x24')]=[{'filename':_0x3449db,'path':_0x40d7d1}];}else{if(_0xa906b1['status']===_0x662f('0x27')){_0x5b171f['message'][_0x662f('0x25')]=_0x662f('0x28');if(!_0x40cbd7[_0x662f('0x29')]){_0x5df121=![];logger[_0x662f('0xf')](_0x662f('0x2a'));}}else if(_0xa906b1[_0x662f('0x21')]===_0x662f('0x2b')){_0x5b171f['message']['text']='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0xa906b1[_0x662f('0x21')]===_0x662f('0x2c')){_0x5b171f[_0x662f('0x23')][_0x662f('0x25')]=_0x662f('0x2d');}else if(_0xa906b1[_0x662f('0x21')]===_0x662f('0x2e')){_0x5b171f[_0x662f('0x23')][_0x662f('0x25')]=_0x662f('0x2f');}else{logger[_0x662f('0xe')](_0x662f('0x30'),_0xa906b1[_0x662f('0x21')]);}}if(_0x5df121){return client[_0x662f('0x31')](_0x662f('0x32'),_0x5b171f)[_0x662f('0xd')](function(_0x167ff0){if(_0x167ff0[_0x662f('0xe')]){return logger[_0x662f('0xe')](_0x662f('0x33'),JSON[_0x662f('0x26')](_0x167ff0));}return logger[_0x662f('0xf')](_0x662f('0x34'));})[_0x662f('0x35')](function(_0x1ebaea){return logger[_0x662f('0xe')]('error\x20mail',JSON[_0x662f('0x26')](_0x1ebaea));});}}function handleError(){return function(_0x24eb9e){return logger['error'](JSON[_0x662f('0x26')](_0x24eb9e));};}function loading(_0x30bad7){logger[_0x662f('0xf')]('case\x20loading');if(_0x30bad7[_0x662f('0x36')]===_0x30bad7[_0x662f('0x37')]['retries']){handleSendEmail(_0x30bad7['job'],_0x30bad7['data']);_0x30bad7[_0x662f('0x38')][_0x662f('0x39')]();}else{_0x30bad7[_0x662f('0x38')][_0x662f('0x6')](_0x662f('0x3a'));}}function completed(_0x4c9fd7){logger['info'](_0x662f('0x3b'));handleSendEmail(_0x4c9fd7[_0x662f('0x3c')],_0x4c9fd7[_0x662f('0x3d')]);_0x4c9fd7[_0x662f('0x38')]['stop']();}function empty(_0x5b40fb){logger[_0x662f('0xf')](_0x662f('0x3e'));handleSendEmail(_0x5b40fb[_0x662f('0x3c')],_0x5b40fb[_0x662f('0x3d')]);_0x5b40fb[_0x662f('0x38')][_0x662f('0x39')]();}function failed(_0x23c24d){logger[_0x662f('0xf')](_0x662f('0x3f'));handleSendEmail(_0x23c24d['job'],_0x23c24d['data']);_0x23c24d['operation'][_0x662f('0x39')]();}function urecognized(_0x4843e1){logger['error']('Unrecognized\x20status:',_0x4843e1['entity'][_0x662f('0x40')][_0x662f('0x21')]);_0x4843e1['operation'][_0x662f('0x39')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x100411,_0x57e74c){const _0x5b9d6c={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x25d6e0=retry[_0x662f('0x38')](_0x5b9d6c);_0x25d6e0['attempt'](_0x4695a7=>{logger[_0x662f('0xf')](_0x662f('0x41')+_0x100411['id']+'\x20Attempt\x20#:'+_0x4695a7);try{getReportData(_0x57e74c['id'])[_0x662f('0xd')](function(_0xa647b3){_0x57e74c=_0xa647b3;logger['info']('report\x20status:',_0xa647b3[_0x662f('0x40')][_0x662f('0x21')]);if(!reportStatusStrategies[_0xa647b3[_0x662f('0x40')]['status']]){logger[_0x662f('0xe')](_0x662f('0x42'),_0xa647b3[_0x662f('0x40')][_0x662f('0x21')]);_0x25d6e0[_0x662f('0x6')]();}reportStatusStrategies[_0xa647b3[_0x662f('0x40')][_0x662f('0x21')]]({'operation':_0x25d6e0,'currentAttempt':_0x4695a7,'retryOptions':_0x5b9d6c,'job':_0x100411,'data':_0x57e74c,'entity':_0xa647b3});});}catch(_0x18c5e4){_0x25d6e0['retry'](_0x18c5e4);}});}function handleResult(_0x35e288){return function(_0x55b2e7){if(_0x35e288[_0x662f('0x43')]&&_0x35e288[_0x662f('0x11')]&&_0x35e288[_0x662f('0x11')][_0x662f('0x16')]&&!_[_0x662f('0x44')](_0x35e288[_0x662f('0x15')])){retryer(_0x35e288,_0x55b2e7);}};}function handleJob(_0x3fbdfc){return function(){try{if(_[_0x662f('0x44')](_0x3fbdfc['subtractNumber'])){return logger[_0x662f('0xf')](_0x662f('0x45'));}if(_['isNil'](_0x3fbdfc[_0x662f('0x1a')])){return logger[_0x662f('0xf')]('subtractUnit\x20null\x20or\x20undefined');}var _0x1d998f={'startDate':moment()[_0x662f('0x46')](_0x3fbdfc[_0x662f('0x19')],_0x3fbdfc[_0x662f('0x1a')])[_0x662f('0x13')](_0x662f('0x47')),'endDate':moment()[_0x662f('0x13')](_0x662f('0x47')),'type':'scheduled','output':_0x3fbdfc['output'],'name':_0x3fbdfc['name']};if(!_['isNil'](_0x3fbdfc[_0x662f('0x48')])){logger[_0x662f('0xf')](_0x662f('0x49'),_0x3fbdfc[_0x662f('0x48')]);return analyticDefaultReportController['runReport']({'id':_0x3fbdfc[_0x662f('0x48')]},_0x1d998f)[_0x662f('0xd')](handleResult(_0x3fbdfc))[_0x662f('0x35')](handleError());}if(!_[_0x662f('0x44')](_0x3fbdfc[_0x662f('0x4a')])){logger[_0x662f('0xf')](_0x662f('0x4b'),_0x3fbdfc[_0x662f('0x4a')]);return analyticCustomReportController['runReport']({'id':_0x3fbdfc['CustomReportId']},_0x1d998f)[_0x662f('0xd')](handleResult(_0x3fbdfc))[_0x662f('0x35')](handleError());}}catch(_0xf0a80d){logger[_0x662f('0xe')](JSON['stringify'](_0xf0a80d));}return logger[_0x662f('0xf')](_0x662f('0x4c'));};}function getJobs(_0x3fcc79){var _0x36d86a={};if(_0x3fcc79){_0x36d86a['id']=_0x3fcc79;}return db[_0x662f('0x4d')][_0x662f('0x4e')]({'where':_0x36d86a,'include':[{'model':db[_0x662f('0x11')],'attributes':['id',_0x662f('0x14'),'email'],'include':[{'model':db[_0x662f('0x4f')],'as':_0x662f('0x16'),'include':[{'model':db[_0x662f('0x50')],'as':_0x662f('0x50')}]}]}]})[_0x662f('0xd')](function(_0x28881e){var _0x2530cd=_['keys'](manager[_0x662f('0x51')]);var _0x1a7a51=_[_0x662f('0x52')](_0x28881e,function(_0x49c599){return _0x49c599['id'][_0x662f('0x53')]();});var _0x56b706=_[_0x662f('0x54')](_0x28881e,function(_0x4db818){return _0x4db818['id'][_0x662f('0x53')]();});var _0x10bdb6=_0x3fcc79?_0x1a7a51:_[_0x662f('0x55')](_0x1a7a51,_0x2530cd);var _0xc265f=_[_0x662f('0x56')](_0x1a7a51,_0x2530cd);var _0x45c241=_['difference'](_0x2530cd,_0x1a7a51);var _0x47f94a;var _0x5205c7;for(_0x47f94a=0x0;_0x47f94a<_0x45c241[_0x662f('0x57')]&&!_0x3fcc79;_0x47f94a+=0x1){_0x5205c7=_0x45c241[_0x47f94a][_0x662f('0x53')]();if(manager['exists'](_0x5205c7)){manager[_0x662f('0x39')](_0x5205c7);manager[_0x662f('0x58')](_0x5205c7);logger[_0x662f('0xf')]('delete\x20cron',_0x5205c7);}}logger['info'](_0x662f('0x59'),JSON[_0x662f('0x26')](_0x10bdb6));for(_0x47f94a=0x0;_0x47f94a<_0x10bdb6[_0x662f('0x57')];_0x47f94a+=0x1){_0x5205c7=_0x10bdb6[_0x47f94a][_0x662f('0x53')]();if(_0x3fcc79){logger[_0x662f('0xf')](JSON[_0x662f('0x26')](_0x56b706[_0x5205c7]));BPromise['resolve']()['then'](handleJob(_0x56b706[_0x5205c7]));logger[_0x662f('0xf')](_0x662f('0x5a'),_0x56b706[_0x5205c7][_0x662f('0x14')],_0x56b706[_0x5205c7][_0x662f('0x5b')]);}else if(_0x56b706[_0x5205c7]['cron']&&_0x56b706[_0x5205c7]['active']&&moment()[_0x662f('0x5c')](_0x56b706[_0x5205c7][_0x662f('0x5d')],_0x56b706[_0x5205c7][_0x662f('0x5e')])){manager[_0x662f('0x5f')](_0x5205c7,_0x56b706[_0x5205c7][_0x662f('0x5b')],handleJob(_0x56b706[_0x5205c7]));manager[_0x662f('0x60')](_0x5205c7);logger[_0x662f('0xf')](_0x662f('0x61'),_0x56b706[_0x5205c7][_0x662f('0x14')],_0x56b706[_0x5205c7][_0x662f('0x5b')]);}else if(manager[_0x662f('0x62')](_0x5205c7)){manager[_0x662f('0x39')](_0x5205c7);manager[_0x662f('0x58')](_0x5205c7);logger[_0x662f('0xf')](_0x662f('0x63'),_0x56b706[_0x5205c7][_0x662f('0x14')],_0x56b706[_0x5205c7]['cron']);}}for(_0x47f94a=0x0,_0x5205c7;_0x47f94a<_0xc265f[_0x662f('0x57')]&&!_0x3fcc79;_0x47f94a+=0x1){_0x5205c7=_0xc265f[_0x47f94a][_0x662f('0x53')]();if(manager[_0x662f('0x62')](_0x5205c7)){if(_0x56b706[_0x5205c7][_0x662f('0x5b')]&&_0x56b706[_0x5205c7][_0x662f('0x64')]&&moment()['isBetween'](_0x56b706[_0x5205c7][_0x662f('0x5d')],_0x56b706[_0x5205c7]['endAt'])){manager[_0x662f('0x65')](_0x5205c7,_0x56b706[_0x5205c7][_0x662f('0x5b')],handleJob(_0x56b706[_0x5205c7]));logger[_0x662f('0xf')](_0x662f('0x66'),_0x56b706[_0x5205c7][_0x662f('0x14')],_0x56b706[_0x5205c7][_0x662f('0x5b')]);}else{manager[_0x662f('0x39')](_0x5205c7);manager[_0x662f('0x58')](_0x5205c7);logger[_0x662f('0xf')](_0x662f('0x63'),_0x56b706[_0x5205c7][_0x662f('0x14')],_0x56b706[_0x5205c7][_0x662f('0x5b')]);}}}})[_0x662f('0x35')](function(_0x3c07cb){logger[_0x662f('0xe')](JSON[_0x662f('0x26')](_0x3c07cb));});}exports[_0x662f('0x67')]=function(_0x195312){return getJobs(_0x195312);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index d10bb2c..ad90164 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 _0xb79a=['[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','update','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','bucket','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','findOne','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','forEach','all','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeRegion','transcribeName'];(function(_0x2c2b8e,_0x33c59c){var _0x4063b0=function(_0x292fe6){while(--_0x292fe6){_0x2c2b8e['push'](_0x2c2b8e['shift']());}};_0x4063b0(++_0x33c59c);}(_0xb79a,0x18e));var _0xab79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb79a[_0x2641f9];return _0x585741;};var _=require(_0xab79('0x0'));var AWS=require(_0xab79('0x1'));var rp=require('request-promise');var util=require(_0xab79('0x2'));var BPromise=require(_0xab79('0x3'));var db=require(_0xab79('0x4'))['db'];var logger=require(_0xab79('0x5'))(_0xab79('0x6'));function getTranscriptionJob(_0x40fa8a,_0x55116,_0x1ad70b,_0x5ad60a){return new Promise(function(_0x1dae4,_0x4b0ad5){var _0xe8ba5a=new AWS[(_0xab79('0x7'))]({'accessKeyId':_0x55116,'secretAccessKey':_0x40fa8a,'region':_0x1ad70b});_0xe8ba5a[_0xab79('0x8')]({'TranscriptionJobName':_0x5ad60a},function(_0x7eabd1,_0x4585fe){if(_0x7eabd1){return _0x4b0ad5(_0x7eabd1);}else{return _0x1dae4(_0x4585fe);}});});}function sentiment(_0x1d0599,_0x3893fc,_0x426cb9,_0xf6b416,_0x283acc){return new Promise(function(_0x17767c,_0x526b0b){var _0x5b5009=new AWS[(_0xab79('0x9'))]({'accessKeyId':_0x3893fc,'secretAccessKey':_0x1d0599,'region':_0x426cb9});_0x5b5009[_0xab79('0xa')]({'Text':_0xf6b416,'LanguageCode':_0x283acc[_0xab79('0xb')](0x0,0x2)},function(_0x18a89e,_0x31aedd){if(_0x18a89e){return _0x526b0b(_0x18a89e);}else{return _0x17767c(_0x31aedd);}});});}function checkTranscribeJob(_0x1b3365,_0x5b889c,_0x5a6c60){var _0x17a70d;return new BPromise(function(_0x51c4ea,_0x1357dc){logger[_0xab79('0xc')](util[_0xab79('0xd')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x1b3365['id'],_0x1b3365['transcribeName']));return getTranscriptionJob(_0x5a6c60['data1'],_0x5a6c60['data2'],_0x5b889c[_0xab79('0xe')],_0x1b3365[_0xab79('0xf')])['then'](function(_0x5d2137){logger['info'](util[_0xab79('0xd')](_0xab79('0x10'),_0x1b3365['id'],_0x1b3365['transcribeName'],_0x5d2137[_0xab79('0x11')][_0xab79('0x12')]));if(!_0x1b3365[_0xab79('0x13')]){switch(_0x5d2137[_0xab79('0x11')]['TranscriptionJobStatus']){case _0xab79('0x14'):var _0x2c7b3e={'transcribeStatus':_0x5d2137[_0xab79('0x11')][_0xab79('0x12')],'fileUri':_0x5d2137['TranscriptionJob'][_0xab79('0x15')][_0xab79('0x16')]};logger[_0xab79('0xc')](util[_0xab79('0xd')](_0xab79('0x17'),_0x1b3365['id']));return rp({'uri':_0x5d2137['TranscriptionJob'][_0xab79('0x15')]['TranscriptFileUri'],'json':!![]})[_0xab79('0x18')](function(_0x3a0e04){logger[_0xab79('0xc')](util[_0xab79('0xd')](_0xab79('0x19'),_0x1b3365['id']));if(_0x3a0e04&&_0x3a0e04[_0xab79('0x1a')]&&_0x3a0e04[_0xab79('0x1a')][_0xab79('0x1b')]&&_0x3a0e04[_0xab79('0x1a')][_0xab79('0x1b')][_0xab79('0x1c')]){_0x2c7b3e['fileText']='';for(var _0x270593=0x0;_0x270593<_0x3a0e04[_0xab79('0x1a')][_0xab79('0x1b')][_0xab79('0x1c')];_0x270593++){_0x2c7b3e[_0xab79('0x13')]+=_0x3a0e04[_0xab79('0x1a')][_0xab79('0x1b')][_0x270593][_0xab79('0x1d')]+'';}}return _0x1b3365['update'](_0x2c7b3e);})[_0xab79('0x18')](function(){logger[_0xab79('0xc')](util[_0xab79('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1b3365['id']));if(!_0x1b3365['tempSentiment']){throw new db[(_0xab79('0x1e'))][(_0xab79('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5b889c[_0xab79('0x20')]||!_0x5b889c[_0xab79('0x21')]||!_0x5b889c[_0xab79('0x22')]||!_0x5b889c['language']||!_0x5b889c['bucket']){throw new db[(_0xab79('0x1e'))][(_0xab79('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2c7b3e[_0xab79('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x5b889c[_0xab79('0x21')]===_0x5a6c60['id']){return _0x5a6c60;}else{return db[_0xab79('0x23')]['findOne']({'where':{'id':_settings[_0xab79('0x21')]}});}})[_0xab79('0x18')](function(_0x44e5ab){if(!_0x44e5ab){throw new db[(_0xab79('0x1e'))][(_0xab79('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x44e5ab[_0xab79('0x24')]||!_0x44e5ab['data2']){throw new db[(_0xab79('0x1e'))]['ValidationError'](_0xab79('0x25'));}_0x17a70d=_0x44e5ab;logger['info'](util[_0xab79('0xd')](_0xab79('0x26'),_0x1b3365['id']));return sentiment(_0x17a70d[_0xab79('0x24')],_0x17a70d[_0xab79('0x27')],_0x5b889c[_0xab79('0x22')],_0x2c7b3e['fileText'],_0x5b889c[_0xab79('0x28')]);})[_0xab79('0x18')](function(_0x4fad0e){logger[_0xab79('0xc')](util['format'](_0xab79('0x29'),_0x1b3365['id']));return _0x1b3365['update']({'sentiment':_0x4fad0e[_0xab79('0x2a')],'sPositive':_0x4fad0e[_0xab79('0x2b')][_0xab79('0x2c')],'sNegative':_0x4fad0e[_0xab79('0x2b')][_0xab79('0x2d')],'sMixed':_0x4fad0e['SentimentScore'][_0xab79('0x2e')],'sNeutral':_0x4fad0e['SentimentScore']['Neutral']});})[_0xab79('0x18')](function(){logger[_0xab79('0xc')](util['format'](_0xab79('0x2f'),_0x1b3365['id']));_0x51c4ea();});case'FAILED':return _0x1b3365[_0xab79('0x30')]({'transcribeStatus':_0xab79('0x31'),'failureReason':_0x5d2137[_0xab79('0x11')][_0xab79('0x32')]})[_0xab79('0x18')](function(){logger[_0xab79('0xc')](util[_0xab79('0xd')](_0xab79('0x2f'),_0x1b3365['id']));_0x51c4ea();});default:logger[_0xab79('0xc')](util[_0xab79('0xd')](_0xab79('0x33'),_0x1b3365['id']));break;}}else{return BPromise['resolve']()[_0xab79('0x18')](function(){if(!_0x1b3365['tempSentiment']){throw new db['Sequelize'][(_0xab79('0x1f'))](_0xab79('0x34'));}if(!_0x5b889c['sentiment']||!_0x5b889c[_0xab79('0x21')]||!_0x5b889c['sentimentRegion']||!_0x5b889c[_0xab79('0x28')]||!_0x5b889c[_0xab79('0x35')]){throw new db['Sequelize'][(_0xab79('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1b3365[_0xab79('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x5b889c[_0xab79('0x21')]===_0x5a6c60['id']){return _0x5a6c60;}else{return db[_0xab79('0x23')]['findOne']({'where':{'id':_settings[_0xab79('0x21')]}});}})['then'](function(_0xd5bb09){if(!_0xd5bb09){throw new db[(_0xab79('0x1e'))][(_0xab79('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xd5bb09[_0xab79('0x24')]||!_0xd5bb09[_0xab79('0x27')]){throw new db[(_0xab79('0x1e'))][(_0xab79('0x1f'))](_0xab79('0x25'));}_0x17a70d=_0xd5bb09;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1b3365['id']));return sentiment(_0x17a70d[_0xab79('0x24')],_0x17a70d['data2'],_0x5b889c[_0xab79('0x22')],_0x1b3365[_0xab79('0x13')],_0x5b889c[_0xab79('0x28')]);})[_0xab79('0x18')](function(_0x191aa1){logger['info'](util[_0xab79('0xd')](_0xab79('0x29'),_0x1b3365['id']));return _0x1b3365[_0xab79('0x30')]({'sentiment':_0x191aa1[_0xab79('0x2a')],'sPositive':_0x191aa1[_0xab79('0x2b')][_0xab79('0x2c')],'sNegative':_0x191aa1[_0xab79('0x2b')]['Negative'],'sMixed':_0x191aa1[_0xab79('0x2b')]['Mixed'],'sNeutral':_0x191aa1[_0xab79('0x2b')][_0xab79('0x36')],'transcribeStatus':_0xab79('0x14')});})[_0xab79('0x18')](function(){logger['info'](util['format'](_0xab79('0x2f'),_0x1b3365['id']));_0x51c4ea();});}})[_0xab79('0x37')](function(_0x432a53){if(_0x432a53){if(!_0x432a53[_0xab79('0x38')]||_0x432a53['name']!==_0xab79('0x39')){logger[_0xab79('0x3a')](util[_0xab79('0xd')](_0xab79('0x3b'),_0x1b3365['id']),util['inspect'](_0x432a53,{'showHidden':![],'depth':null}));}}_0x51c4ea();});});}function checkTranscribe(){var _0x31d282;var _0x4cacab;var _0x100430;return db[_0xab79('0x3c')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x2846c5){if(!_0x2846c5||!_0x2846c5[_0xab79('0x1c')]){throw new db['Sequelize'][(_0xab79('0x1f'))](_0xab79('0x3d'));}_0x31d282=_0x2846c5;return db['Setting'][_0xab79('0x3e')]({'where':{'id':0x1}});})[_0xab79('0x18')](function(_0x22ba57){if(!_0x22ba57){throw new db[(_0xab79('0x1e'))][(_0xab79('0x1f'))]('Settings\x20not\x20available');}_0x4cacab=_0x22ba57;if(!_0x4cacab[_0xab79('0x6')]||!_0x4cacab[_0xab79('0x3f')]||!_0x4cacab[_0xab79('0xe')]||!_0x4cacab[_0xab79('0x28')]||!_0x4cacab[_0xab79('0x35')]){throw new db['Sequelize'][(_0xab79('0x1f'))](_0xab79('0x40'));}return db[_0xab79('0x23')][_0xab79('0x3e')]({'where':{'id':_0x4cacab[_0xab79('0x3f')]}});})[_0xab79('0x18')](function(_0x1b0134){if(!_0x1b0134){throw new db[(_0xab79('0x1e'))][(_0xab79('0x1f'))](_0xab79('0x41'));}if(!_0x1b0134[_0xab79('0x24')]||!_0x1b0134[_0xab79('0x27')]){throw new db[(_0xab79('0x1e'))][(_0xab79('0x1f'))](_0xab79('0x25'));}_0x100430=_0x1b0134;var _0x53a8c9=[];_0x31d282[_0xab79('0x42')](function(_0x131b8f){_0x53a8c9['push'](checkTranscribeJob(_0x131b8f,_0x4cacab,_0x100430));});return BPromise[_0xab79('0x43')](_0x53a8c9);})[_0xab79('0x37')](function(_0x2d21b2){if(_0x2d21b2){if(!_0x2d21b2[_0xab79('0x38')]||_0x2d21b2[_0xab79('0x38')]!=='SequelizeValidationError'){logger[_0xab79('0x3a')](util['inspect'](_0x2d21b2,{'showHidden':![],'depth':null}));}}});}exports[_0xab79('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3aa2=['FailureReason','CloudProvider','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Negative','Neutral','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','forEach','push','catch','inspect','lodash','aws-sdk','util','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED'];(function(_0x3bab53,_0x46230f){var _0x1a969e=function(_0x15ecb1){while(--_0x15ecb1){_0x3bab53['push'](_0x3bab53['shift']());}};_0x1a969e(++_0x46230f);}(_0x3aa2,0x13b));var _0x23aa=function(_0x2e5405,_0x42ec09){_0x2e5405=_0x2e5405-0x0;var _0x2f0270=_0x3aa2[_0x2e5405];return _0x2f0270;};var _=require(_0x23aa('0x0'));var AWS=require(_0x23aa('0x1'));var rp=require('request-promise');var util=require(_0x23aa('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x23aa('0x3'))(_0x23aa('0x4'));function getTranscriptionJob(_0x556204,_0x38c0ab,_0x5b9038,_0x34a195){return new Promise(function(_0x24a89d,_0x4868c2){var _0x461bde=new AWS[(_0x23aa('0x5'))]({'accessKeyId':_0x38c0ab,'secretAccessKey':_0x556204,'region':_0x5b9038});_0x461bde[_0x23aa('0x6')]({'TranscriptionJobName':_0x34a195},function(_0x5f3efd,_0x41bfc5){if(_0x5f3efd){return _0x4868c2(_0x5f3efd);}else{return _0x24a89d(_0x41bfc5);}});});}function sentiment(_0x3e2a05,_0x23cd87,_0x5c2595,_0x4b8b1a,_0xb70adc){return new Promise(function(_0x5100f4,_0x3f9456){var _0x155c20=new AWS[(_0x23aa('0x7'))]({'accessKeyId':_0x23cd87,'secretAccessKey':_0x3e2a05,'region':_0x5c2595});_0x155c20[_0x23aa('0x8')]({'Text':_0x4b8b1a,'LanguageCode':_0xb70adc[_0x23aa('0x9')](0x0,0x2)},function(_0x459412,_0x402b42){if(_0x459412){return _0x3f9456(_0x459412);}else{return _0x5100f4(_0x402b42);}});});}function checkTranscribeJob(_0x5ed160,_0x4fdd70,_0x4f9c72){var _0x1f71ef;return new BPromise(function(_0x1c664b,_0x109649){logger[_0x23aa('0xa')](util[_0x23aa('0xb')](_0x23aa('0xc'),_0x5ed160['id'],_0x5ed160[_0x23aa('0xd')]));return getTranscriptionJob(_0x4f9c72[_0x23aa('0xe')],_0x4f9c72['data2'],_0x4fdd70[_0x23aa('0xf')],_0x5ed160['transcribeName'])['then'](function(_0x3cbbde){logger[_0x23aa('0xa')](util[_0x23aa('0xb')](_0x23aa('0x10'),_0x5ed160['id'],_0x5ed160[_0x23aa('0xd')],_0x3cbbde[_0x23aa('0x11')]['TranscriptionJobStatus']));if(!_0x5ed160[_0x23aa('0x12')]){switch(_0x3cbbde[_0x23aa('0x11')]['TranscriptionJobStatus']){case'COMPLETED':var _0x4d660f={'transcribeStatus':_0x3cbbde['TranscriptionJob'][_0x23aa('0x13')],'fileUri':_0x3cbbde[_0x23aa('0x11')][_0x23aa('0x14')]['TranscriptFileUri']};logger[_0x23aa('0xa')](util[_0x23aa('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x5ed160['id']));return rp({'uri':_0x3cbbde[_0x23aa('0x11')][_0x23aa('0x14')][_0x23aa('0x15')],'json':!![]})[_0x23aa('0x16')](function(_0x106bde){logger[_0x23aa('0xa')](util[_0x23aa('0xb')](_0x23aa('0x17'),_0x5ed160['id']));if(_0x106bde&&_0x106bde[_0x23aa('0x18')]&&_0x106bde['results'][_0x23aa('0x19')]&&_0x106bde[_0x23aa('0x18')][_0x23aa('0x19')][_0x23aa('0x1a')]){_0x4d660f['fileText']='';for(var _0x23771b=0x0;_0x23771b<_0x106bde['results'][_0x23aa('0x19')][_0x23aa('0x1a')];_0x23771b++){_0x4d660f[_0x23aa('0x12')]+=_0x106bde['results'][_0x23aa('0x19')][_0x23771b][_0x23aa('0x1b')]+'';}}return _0x5ed160[_0x23aa('0x1c')](_0x4d660f);})[_0x23aa('0x16')](function(){logger[_0x23aa('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5ed160['id']));if(!_0x5ed160[_0x23aa('0x1d')]){throw new db[(_0x23aa('0x1e'))][(_0x23aa('0x1f'))](_0x23aa('0x20'));}if(!_0x4fdd70[_0x23aa('0x21')]||!_0x4fdd70[_0x23aa('0x22')]||!_0x4fdd70[_0x23aa('0x23')]||!_0x4fdd70[_0x23aa('0x24')]||!_0x4fdd70[_0x23aa('0x25')]){throw new db[(_0x23aa('0x1e'))][(_0x23aa('0x1f'))](_0x23aa('0x26'));}if(!_0x4d660f[_0x23aa('0x12')]){throw new Error(_0x23aa('0x27'));}if(_0x4fdd70['sentimentAccountId']===_0x4f9c72['id']){return _0x4f9c72;}else{return db['CloudProvider'][_0x23aa('0x28')]({'where':{'id':_settings[_0x23aa('0x22')]}});}})[_0x23aa('0x16')](function(_0x49f23d){if(!_0x49f23d){throw new db['Sequelize'][(_0x23aa('0x1f'))](_0x23aa('0x29'));}if(!_0x49f23d[_0x23aa('0xe')]||!_0x49f23d['data2']){throw new db[(_0x23aa('0x1e'))][(_0x23aa('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x1f71ef=_0x49f23d;logger[_0x23aa('0xa')](util[_0x23aa('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5ed160['id']));return sentiment(_0x1f71ef[_0x23aa('0xe')],_0x1f71ef[_0x23aa('0x2a')],_0x4fdd70['sentimentRegion'],_0x4d660f[_0x23aa('0x12')],_0x4fdd70[_0x23aa('0x24')]);})[_0x23aa('0x16')](function(_0x230a77){logger[_0x23aa('0xa')](util[_0x23aa('0xb')](_0x23aa('0x2b'),_0x5ed160['id']));return _0x5ed160['update']({'sentiment':_0x230a77[_0x23aa('0x2c')],'sPositive':_0x230a77[_0x23aa('0x2d')][_0x23aa('0x2e')],'sNegative':_0x230a77['SentimentScore']['Negative'],'sMixed':_0x230a77[_0x23aa('0x2d')][_0x23aa('0x2f')],'sNeutral':_0x230a77[_0x23aa('0x2d')]['Neutral']});})[_0x23aa('0x16')](function(){logger[_0x23aa('0xa')](util[_0x23aa('0xb')](_0x23aa('0x30'),_0x5ed160['id']));_0x1c664b();});case _0x23aa('0x31'):return _0x5ed160[_0x23aa('0x1c')]({'transcribeStatus':_0x23aa('0x31'),'failureReason':_0x3cbbde[_0x23aa('0x11')][_0x23aa('0x32')]})[_0x23aa('0x16')](function(){logger[_0x23aa('0xa')](util[_0x23aa('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5ed160['id']));_0x1c664b();});default:logger['info'](util[_0x23aa('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x5ed160['id']));break;}}else{return BPromise['resolve']()[_0x23aa('0x16')](function(){if(!_0x5ed160['tempSentiment']){throw new db[(_0x23aa('0x1e'))][(_0x23aa('0x1f'))](_0x23aa('0x20'));}if(!_0x4fdd70['sentiment']||!_0x4fdd70[_0x23aa('0x22')]||!_0x4fdd70[_0x23aa('0x23')]||!_0x4fdd70[_0x23aa('0x24')]||!_0x4fdd70[_0x23aa('0x25')]){throw new db[(_0x23aa('0x1e'))][(_0x23aa('0x1f'))](_0x23aa('0x26'));}if(!_0x5ed160['fileText']){throw new Error(_0x23aa('0x27'));}if(_0x4fdd70['sentimentAccountId']===_0x4f9c72['id']){return _0x4f9c72;}else{return db[_0x23aa('0x33')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x284b94){if(!_0x284b94){throw new db['Sequelize']['ValidationError'](_0x23aa('0x29'));}if(!_0x284b94[_0x23aa('0xe')]||!_0x284b94[_0x23aa('0x2a')]){throw new db[(_0x23aa('0x1e'))][(_0x23aa('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x1f71ef=_0x284b94;logger['info'](util[_0x23aa('0xb')](_0x23aa('0x34'),_0x5ed160['id']));return sentiment(_0x1f71ef[_0x23aa('0xe')],_0x1f71ef['data2'],_0x4fdd70[_0x23aa('0x23')],_0x5ed160['fileText'],_0x4fdd70[_0x23aa('0x24')]);})[_0x23aa('0x16')](function(_0x26d37d){logger['info'](util[_0x23aa('0xb')](_0x23aa('0x2b'),_0x5ed160['id']));return _0x5ed160['update']({'sentiment':_0x26d37d[_0x23aa('0x2c')],'sPositive':_0x26d37d['SentimentScore'][_0x23aa('0x2e')],'sNegative':_0x26d37d[_0x23aa('0x2d')][_0x23aa('0x35')],'sMixed':_0x26d37d[_0x23aa('0x2d')][_0x23aa('0x2f')],'sNeutral':_0x26d37d['SentimentScore'][_0x23aa('0x36')],'transcribeStatus':_0x23aa('0x37')});})['then'](function(){logger[_0x23aa('0xa')](util[_0x23aa('0xb')](_0x23aa('0x30'),_0x5ed160['id']));_0x1c664b();});}})['catch'](function(_0xf69307){if(_0xf69307){if(!_0xf69307['name']||_0xf69307[_0x23aa('0x38')]!==_0x23aa('0x39')){logger[_0x23aa('0x3a')](util[_0x23aa('0xb')](_0x23aa('0x3b'),_0x5ed160['id']),util['inspect'](_0xf69307,{'showHidden':![],'depth':null}));}}_0x1c664b();});});}function checkTranscribe(){var _0x3b8ec3;var _0x72f912;var _0x5a6653;return db[_0x23aa('0x3c')][_0x23aa('0x3d')]({'where':{'transcribeStatus':_0x23aa('0x3e')}})[_0x23aa('0x16')](function(_0x29985c){if(!_0x29985c||!_0x29985c['length']){throw new db[(_0x23aa('0x1e'))][(_0x23aa('0x1f'))](_0x23aa('0x3f'));}_0x3b8ec3=_0x29985c;return db[_0x23aa('0x40')][_0x23aa('0x28')]({'where':{'id':0x1}});})[_0x23aa('0x16')](function(_0x318fb3){if(!_0x318fb3){throw new db[(_0x23aa('0x1e'))]['ValidationError'](_0x23aa('0x41'));}_0x72f912=_0x318fb3;if(!_0x72f912[_0x23aa('0x4')]||!_0x72f912[_0x23aa('0x42')]||!_0x72f912[_0x23aa('0xf')]||!_0x72f912['language']||!_0x72f912[_0x23aa('0x25')]){throw new db[(_0x23aa('0x1e'))][(_0x23aa('0x1f'))](_0x23aa('0x43'));}return db['CloudProvider']['findOne']({'where':{'id':_0x72f912[_0x23aa('0x42')]}});})[_0x23aa('0x16')](function(_0x3a9c00){if(!_0x3a9c00){throw new db[(_0x23aa('0x1e'))][(_0x23aa('0x1f'))](_0x23aa('0x29'));}if(!_0x3a9c00[_0x23aa('0xe')]||!_0x3a9c00[_0x23aa('0x2a')]){throw new db[(_0x23aa('0x1e'))][(_0x23aa('0x1f'))](_0x23aa('0x44'));}_0x5a6653=_0x3a9c00;var _0x243634=[];_0x3b8ec3[_0x23aa('0x45')](function(_0x1effd3){_0x243634[_0x23aa('0x46')](checkTranscribeJob(_0x1effd3,_0x72f912,_0x5a6653));});return BPromise['all'](_0x243634);})[_0x23aa('0x47')](function(_0x72d858){if(_0x72d858){if(!_0x72d858[_0x23aa('0x38')]||_0x72d858[_0x23aa('0x38')]!==_0x23aa('0x39')){logger[_0x23aa('0x3a')](util[_0x23aa('0x48')](_0x72d858,{'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 2ab115e..63e2273 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 _0x889d=['lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','timeout','format','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll'];(function(_0xeb2f65,_0x19d5ed){var _0x1f4640=function(_0x131ec7){while(--_0x131ec7){_0xeb2f65['push'](_0xeb2f65['shift']());}};_0x1f4640(++_0x19d5ed);}(_0x889d,0x179));var _0xd889=function(_0x255444,_0x214810){_0x255444=_0x255444-0x0;var _0x326ffd=_0x889d[_0x255444];return _0x326ffd;};'use strict';var _=require(_0xd889('0x0'));var moment=require(_0xd889('0x1'));var Redis=require(_0xd889('0x2'));var util=require(_0xd889('0x3'));var config=require(_0xd889('0x4'));var db=require(_0xd889('0x5'))['db'];var logger=require(_0xd889('0x6'))(_0xd889('0x7'));config[_0xd889('0x8')]=_[_0xd889('0x9')](config[_0xd889('0x8')],{'host':_0xd889('0xa'),'port':0x18eb});var io=require(_0xd889('0xb'))(new Redis(config[_0xd889('0x8')]));function closeInteractions(){var _0x58dd28=[];return db['WhatsappInteraction'][_0xd889('0xc')]({'raw':!![],'attributes':['id',_0xd889('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd889('0xe')](0x18,_0xd889('0xf'))}}})[_0xd889('0x10')](function(_0x286ae1){if(_0x286ae1&&_0x286ae1['length']){_0x58dd28=_[_0xd889('0x11')](_0x286ae1||[],'id');logger[_0xd889('0x12')](_0xd889('0x13'),_0x58dd28[_0xd889('0x14')]());return db[_0xd889('0x15')]['update']({'closeReason':_0xd889('0x16'),'disposition':_0xd889('0x17'),'closed':!![],'closedAt':moment()[_0xd889('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x58dd28}});}})[_0xd889('0x10')](function(){if(_0x58dd28&&_0x58dd28[_0xd889('0x19')]){logger['info'](_0xd889('0x1a'),_0x58dd28[_0xd889('0x14')]());for(var _0x206653=0x0;_0x206653<_0x58dd28['length'];_0x206653++){io[_0xd889('0x1b')]('whatsappInteraction:update',{'id':_0x58dd28[_0x206653],'closed':!![]});}}})[_0xd889('0x1c')](function(_0xcc3481){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0xcc3481?util['inspect'](_0xcc3481,{'showHidden':![],'depth':null}):'');});}exports[_0xd889('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xaffc=['moment','ioredis','util','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','start'];(function(_0x3d3ea6,_0x1bf094){var _0x27a680=function(_0x521664){while(--_0x521664){_0x3d3ea6['push'](_0x3d3ea6['shift']());}};_0x27a680(++_0x1bf094);}(_0xaffc,0xc8));var _0xcaff=function(_0x1b02c6,_0x2e4948){_0x1b02c6=_0x1b02c6-0x0;var _0x256f23=_0xaffc[_0x1b02c6];return _0x256f23;};'use strict';var _=require('lodash');var moment=require(_0xcaff('0x0'));var Redis=require(_0xcaff('0x1'));var util=require(_0xcaff('0x2'));var config=require('../../config/environment');var db=require(_0xcaff('0x3'))['db'];var logger=require('../logger')(_0xcaff('0x4'));config[_0xcaff('0x5')]=_['defaults'](config['redis'],{'host':_0xcaff('0x6'),'port':0x18eb});var io=require(_0xcaff('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x4e6779=[];return db[_0xcaff('0x8')][_0xcaff('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xcaff('0xa'))}}})['then'](function(_0x3bb20b){if(_0x3bb20b&&_0x3bb20b[_0xcaff('0xb')]){_0x4e6779=_[_0xcaff('0xc')](_0x3bb20b||[],'id');logger[_0xcaff('0xd')](_0xcaff('0xe'),_0x4e6779['join']());return db[_0xcaff('0x8')][_0xcaff('0xf')]({'closeReason':'system','disposition':_0xcaff('0x10'),'closed':!![],'closedAt':moment()[_0xcaff('0x11')](_0xcaff('0x12'))},{'where':{'id':_0x4e6779}});}})['then'](function(){if(_0x4e6779&&_0x4e6779[_0xcaff('0xb')]){logger['info'](_0xcaff('0x13'),_0x4e6779['join']());for(var _0x2a6e5d=0x0;_0x2a6e5d<_0x4e6779['length'];_0x2a6e5d++){io[_0xcaff('0x14')](_0xcaff('0x15'),{'id':_0x4e6779[_0x2a6e5d],'closed':!![]});}}})[_0xcaff('0x16')](function(_0x2feccc){logger[_0xcaff('0x17')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2feccc?util['inspect'](_0x2feccc,{'showHidden':![],'depth':null}):'');});}exports[_0xcaff('0x18')]=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 6bd0bf6..0098abe 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb62=['catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','hopper1','contacts2','hopper2'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0xdb62,0x1dc));var _0x2db6=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0xdb62[_0x1d80be];return _0xf9a4f3;};'use strict';var util=require(_0x2db6('0x0'));var db=require(_0x2db6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2db6('0x2')]({'id':i,'firstName':_0x2db6('0x3')+i,'lastName':_0x2db6('0x4')+i,'phone':0xf879fb460+i,'email':_0x2db6('0x5')+i+_0x2db6('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x2db6('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x2db6('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2db6('0x2')]({'id':i,'firstName':_0x2db6('0x3')+i,'lastName':_0x2db6('0x4')+i,'phone':0xf879fb460+i,'email':_0x2db6('0x5')+i+_0x2db6('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2db6('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2db6('0x7')](),'updatedAt':Date[_0x2db6('0x7')]()});}db[_0x2db6('0x8')][_0x2db6('0x9')]({'where':{}})[_0x2db6('0xa')](function(){return db[_0x2db6('0x8')][_0x2db6('0xb')](contacts);})['then'](function(){console[_0x2db6('0xc')](_0x2db6('0xd'),_0x2db6('0xe'));return db['CmHopper'][_0x2db6('0x9')]({'where':{}});})[_0x2db6('0xa')](function(){return db['CmHopper'][_0x2db6('0xb')](hopper);})['then'](function(){console[_0x2db6('0xc')](_0x2db6('0xd'),_0x2db6('0xf'));return db[_0x2db6('0x8')][_0x2db6('0xb')](contacts2);})[_0x2db6('0xa')](function(){console[_0x2db6('0xc')](_0x2db6('0xd'),_0x2db6('0x10'));return db['CmHopper'][_0x2db6('0xb')](hopper2);})[_0x2db6('0xa')](function(){console[_0x2db6('0xc')](_0x2db6('0xd'),_0x2db6('0x11'));})[_0x2db6('0x12')](function(_0x552d36){console[_0x2db6('0xc')](_0x552d36);}); \ No newline at end of file +var _0x8e2f=['Biondo','innocenzo.biondo','@xcally.com','now','push','CmContact','then','bulkCreate','finished\x20populating','CmHopper','destroy','log','contacts2','hopper2','catch','util','../mysqldb','Innocenzo'];(function(_0x586da3,_0x4472a1){var _0x5d210e=function(_0x1dad20){while(--_0x1dad20){_0x586da3['push'](_0x586da3['shift']());}};_0x5d210e(++_0x4472a1);}(_0x8e2f,0x1ad));var _0xf8e2=function(_0x440a9b,_0x19435a){_0x440a9b=_0x440a9b-0x0;var _0x4fe804=_0x8e2f[_0x440a9b];return _0x4fe804;};'use strict';var util=require(_0xf8e2('0x0'));var db=require(_0xf8e2('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xf8e2('0x2')+i,'lastName':_0xf8e2('0x3')+i,'phone':0xf879fb460+i,'email':_0xf8e2('0x4')+i+_0xf8e2('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xf8e2('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf8e2('0x6')](),'updatedAt':Date[_0xf8e2('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xf8e2('0x7')]({'id':i,'firstName':_0xf8e2('0x2')+i,'lastName':_0xf8e2('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf8e2('0x7')]({'id':i,'active':![],'scheduledat':Date[_0xf8e2('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf8e2('0x6')](),'updatedAt':Date[_0xf8e2('0x6')]()});}db[_0xf8e2('0x8')]['destroy']({'where':{}})[_0xf8e2('0x9')](function(){return db['CmContact'][_0xf8e2('0xa')](contacts);})[_0xf8e2('0x9')](function(){console['log'](_0xf8e2('0xb'),'contacts1');return db[_0xf8e2('0xc')][_0xf8e2('0xd')]({'where':{}});})[_0xf8e2('0x9')](function(){return db[_0xf8e2('0xc')][_0xf8e2('0xa')](hopper);})['then'](function(){console[_0xf8e2('0xe')](_0xf8e2('0xb'),'hopper1');return db[_0xf8e2('0x8')][_0xf8e2('0xa')](contacts2);})[_0xf8e2('0x9')](function(){console[_0xf8e2('0xe')](_0xf8e2('0xb'),_0xf8e2('0xf'));return db[_0xf8e2('0xc')]['bulkCreate'](hopper2);})['then'](function(){console['log']('finished\x20populating',_0xf8e2('0x10'));})[_0xf8e2('0x11')](function(_0x5e66f1){console['log'](_0x5e66f1);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 93238fd..106b421 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa160=['agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','format','%s%s'];(function(_0x2b9eb8,_0x49c7e1){var _0x2e9316=function(_0x1b70d2){while(--_0x1b70d2){_0x2b9eb8['push'](_0x2b9eb8['shift']());}};_0x2e9316(++_0x49c7e1);}(_0xa160,0x122));var _0x0a16=function(_0x220719,_0x1cabf9){_0x220719=_0x220719-0x0;var _0x28b05e=_0xa160[_0x220719];return _0x28b05e;};'use strict';var util=require(_0x0a16('0x0'));var db=require(_0x0a16('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x0a16('0x2')]('%s%s','agent',i),'fullname':util[_0x0a16('0x2')](_0x0a16('0x3'),_0x0a16('0x4'),i),'email':util['format'](_0x0a16('0x5'),_0x0a16('0x4'),i),'role':'agent','password':_0x0a16('0x6'),'internal':0xfa0+i,'type':_0x0a16('0x7'),'transport':[_0x0a16('0x8'),'ws',_0x0a16('0x9')],'disallow':[_0x0a16('0xa')],'allow':[_0x0a16('0xb')],'defaultuser':util[_0x0a16('0x2')](_0x0a16('0x3'),_0x0a16('0x4'),i),'encryption':_0x0a16('0xc'),'avpf':'yes','force_avp':'yes','icesupport':_0x0a16('0xc'),'dtlsenable':_0x0a16('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x0a16('0xd'),'dtlssetup':_0x0a16('0xe'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x0a16('0x3'),_0x0a16('0x4'),i),0xfa0+i)});}db[_0x0a16('0xf')][_0x0a16('0x10')](users)[_0x0a16('0x11')](function(){console['log'](_0x0a16('0x12'));})[_0x0a16('0x13')](function(_0xb61629){console[_0x0a16('0x14')](_0xb61629);}); \ No newline at end of file +var _0x0305=['%s%s@xcally.com','password','udp','wss','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util','push','%s%s','agent','format'];(function(_0x18b931,_0x2cad1d){var _0x114958=function(_0x445b4f){while(--_0x445b4f){_0x18b931['push'](_0x18b931['shift']());}};_0x114958(++_0x2cad1d);}(_0x0305,0x109));var _0x5030=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x0305[_0x1abb09];return _0xea1c07;};'use strict';var util=require(_0x5030('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5030('0x1')]({'name':util['format'](_0x5030('0x2'),_0x5030('0x3'),i),'fullname':util['format'](_0x5030('0x2'),_0x5030('0x3'),i),'email':util[_0x5030('0x4')](_0x5030('0x5'),_0x5030('0x3'),i),'role':_0x5030('0x3'),'password':_0x5030('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x5030('0x7'),'ws',_0x5030('0x8')],'disallow':['all'],'allow':[_0x5030('0x9')],'defaultuser':util[_0x5030('0x4')](_0x5030('0x2'),_0x5030('0x3'),i),'encryption':_0x5030('0xa'),'avpf':_0x5030('0xa'),'force_avp':_0x5030('0xa'),'icesupport':_0x5030('0xa'),'dtlsenable':_0x5030('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x5030('0xb'),'callerid':util[_0x5030('0x4')](_0x5030('0xc'),util[_0x5030('0x4')]('%s%s',_0x5030('0x3'),i),0xfa0+i)});}db[_0x5030('0xd')][_0x5030('0xe')](users)[_0x5030('0xf')](function(){console[_0x5030('0x10')]('add\x20user');})[_0x5030('0x11')](function(_0x89e33b){console[_0x5030('0x10')](_0x89e33b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 82fdafb..19bb0af 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf54=['remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','nsp','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','UserProfileSection','then','autoAssociation','SmsQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','type','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','FaxQueues','WhatsappQueues','voice:inbound','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','join','default','connection','setMaxListeners','address'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xcf54,0x125));var _0x4cf5=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0xcf54[_0x15f8ad];return _0xc0238a;};'use strict';var _=require('lodash');var util=require(_0x4cf5('0x0'));var BPromise=require(_0x4cf5('0x1'));var db=require(_0x4cf5('0x2'))['db'];var config=require(_0x4cf5('0x3'));var queryQueues={'attributes':['id',_0x4cf5('0x4')],'include':[{'as':_0x4cf5('0x5'),'model':db[_0x4cf5('0x6')],'attributes':['id','name',_0x4cf5('0x7')],'raw':!![],'where':{'role':_0x4cf5('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4cf5('0x4')],'where':{'role':_0x4cf5('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4cf5('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x4cf5('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4cf5('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x16a089,_0x4f33e6,_0x3c7c38){return db[_0x4cf5('0xa')]['findOne']({'where':{'name':_0x16a089,'userProfileId':_0x4f33e6},'raw':!![]})[_0x4cf5('0xb')](function(_0x15f777){if(_0x15f777){if(_0x15f777[_0x4cf5('0xc')]){switch(_0x16a089){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0x4cf5('0xd'):case _0x4cf5('0xe'):case _0x4cf5('0xf'):case'WhatsappQueues':return db[_0x3c7c38]['findAll'](queryQueues);case _0x4cf5('0x10'):return db[_0x3c7c38][_0x4cf5('0x11')](queryTelephones);case _0x4cf5('0x12'):return db[_0x3c7c38][_0x4cf5('0x11')](queryTrunks);case _0x4cf5('0x13'):return db[_0x3c7c38][_0x4cf5('0x11')](queryCampaigns);}}else{return db[_0x4cf5('0x14')][_0x4cf5('0x11')]({'attributes':[_0x4cf5('0x15')],'where':{'sectionId':_0x15f777['id']},'raw':!![]})[_0x4cf5('0xb')](function(_0x3994c9){if(_0x3994c9){var _0x50a4a7={'where':{'id':_[_0x4cf5('0x16')](_0x3994c9,_0x4cf5('0x15'))},'raw':!![]};switch(_0x3c7c38){case'User':_0x50a4a7[_0x4cf5('0x17')][_0x4cf5('0x7')]=_0x4cf5('0x9');break;case _0x4cf5('0x18'):_0x50a4a7[_0x4cf5('0x17')][_0x4cf5('0x19')]='ivr';break;}return db[_0x3c7c38][_0x4cf5('0x11')](_0x50a4a7);}else{return[];}});}}else{return[];}})[_0x4cf5('0xb')](function(_0x36cecc){return _0x36cecc;});}function joinOrLeaveQueues(_0x562d8f,_0x283493,_0x5e2c97,_0x26bd99){_0x562d8f[_0x283493](util['format'](_0x4cf5('0x1a'),_0x5e2c97,_0x26bd99[_0x4cf5('0x4')]));if(_0x26bd99[_0x4cf5('0x5')]){for(var _0x213883=0x0;_0x213883<_0x26bd99[_0x4cf5('0x5')][_0x4cf5('0x1b')];_0x213883+=0x1){_0x562d8f[_0x283493](util[_0x4cf5('0x1c')](_0x4cf5('0x1d'),_0x26bd99['Agents'][_0x213883][_0x4cf5('0x4')]));}}}function joinOrLeave(_0x590140,_0x2cb9b7,_0xa39509){var _0x44494c;if(_0x590140[_0x4cf5('0x1e')][_0x4cf5('0x1f')]['id']){db[_0x4cf5('0x6')][_0x4cf5('0x20')]({'attributes':['id',_0x4cf5('0x4'),_0x4cf5('0x7'),_0x4cf5('0x21')],'where':{'id':_0x590140[_0x4cf5('0x1e')]['query']['id']},'include':[{'model':db[_0x4cf5('0x22')],'as':_0x4cf5('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x4cf5('0x24')],'as':_0x4cf5('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x4cf5('0x26')],'as':_0x4cf5('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x4cf5('0x28')],'as':_0x4cf5('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x4cf5('0x2a')],'as':_0x4cf5('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x4cf5('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x4cf5('0xb')](function(_0x1a2414){if(_0x1a2414){_0x44494c=_0x1a2414;_0x590140[_0x2cb9b7](util[_0x4cf5('0x1c')]('user:%s',_0x1a2414['name']));var _0x538914=[];switch(_0x1a2414['role']){case _0x4cf5('0x2d'):_0x590140[_0x2cb9b7]('voice:inbound');_0x590140[_0x2cb9b7](_0x4cf5('0x2e'));if(queryQueues[_0x4cf5('0x2f')]('include')){delete queryQueues[_0x4cf5('0x30')];}_0x538914['push'](db[_0x4cf5('0x31')][_0x4cf5('0x11')](queryQueues));_0x538914[_0x4cf5('0x32')](db[_0x4cf5('0x33')]['findAll'](queryQueues));_0x538914[_0x4cf5('0x32')](db[_0x4cf5('0x34')][_0x4cf5('0x11')](queryQueues));_0x538914[_0x4cf5('0x32')](db[_0x4cf5('0x35')][_0x4cf5('0x11')](queryQueues));_0x538914[_0x4cf5('0x32')](db[_0x4cf5('0x36')][_0x4cf5('0x11')](queryQueues));_0x538914['push'](db[_0x4cf5('0x37')]['findAll'](queryQueues));_0x538914[_0x4cf5('0x32')](db[_0x4cf5('0x38')]['findAll'](queryQueues));_0x538914['push'](db[_0x4cf5('0x6')][_0x4cf5('0x11')](queryTelephones));_0x538914[_0x4cf5('0x32')](db['Trunk']['findAll'](queryTrunks));_0x538914['push'](db[_0x4cf5('0x18')][_0x4cf5('0x11')](queryCampaigns));_0x538914[_0x4cf5('0x32')](db[_0x4cf5('0x6')]['findAll'](queryAgents));break;case _0x4cf5('0x39'):_0x590140[_0x2cb9b7]('voice:inbound');_0x590140[_0x2cb9b7](_0x4cf5('0x2e'));_0x538914[_0x4cf5('0x32')](getAssociatedResources('VoiceQueues',_0x1a2414['userProfileId'],_0x4cf5('0x31')));_0x538914['push'](getAssociatedResources('ChatQueues',_0x1a2414['userProfileId'],_0x4cf5('0x33')));_0x538914[_0x4cf5('0x32')](getAssociatedResources(_0x4cf5('0x3a'),_0x1a2414[_0x4cf5('0x21')],'FaxQueue'));_0x538914['push'](getAssociatedResources('SmsQueues',_0x1a2414[_0x4cf5('0x21')],_0x4cf5('0x35')));_0x538914[_0x4cf5('0x32')](getAssociatedResources(_0x4cf5('0xe'),_0x1a2414[_0x4cf5('0x21')],_0x4cf5('0x36')));_0x538914[_0x4cf5('0x32')](getAssociatedResources(_0x4cf5('0xf'),_0x1a2414[_0x4cf5('0x21')],_0x4cf5('0x37')));_0x538914[_0x4cf5('0x32')](getAssociatedResources(_0x4cf5('0x3b'),_0x1a2414[_0x4cf5('0x21')],'WhatsappQueue'));_0x538914['push'](getAssociatedResources(_0x4cf5('0x10'),_0x1a2414['userProfileId'],_0x4cf5('0x6')));_0x538914[_0x4cf5('0x32')](getAssociatedResources('Trunks',_0x1a2414['userProfileId'],'Trunk'));_0x538914[_0x4cf5('0x32')](getAssociatedResources(_0x4cf5('0x13'),_0x1a2414[_0x4cf5('0x21')],'Campaign'));_0x538914[_0x4cf5('0x32')](db[_0x4cf5('0x6')][_0x4cf5('0x11')](queryAgents));break;case _0x4cf5('0x8'):_0x590140[_0x2cb9b7](_0x4cf5('0x3c'));_0x590140[_0x2cb9b7](_0x4cf5('0x2e'));_0x538914[_0x4cf5('0x32')](_0x1a2414['getVoiceQueues']({'attributes':['id',_0x4cf5('0x4')]}));_0x538914['push'](_0x1a2414[_0x4cf5('0x3d')]({'attributes':['id',_0x4cf5('0x4')]}));_0x538914['push'](_0x1a2414['getFaxQueues']({'attributes':['id',_0x4cf5('0x4')]}));_0x538914[_0x4cf5('0x32')](_0x1a2414[_0x4cf5('0x3e')]({'attributes':['id',_0x4cf5('0x4')]}));_0x538914['push'](_0x1a2414[_0x4cf5('0x3f')]({'attributes':['id',_0x4cf5('0x4')]}));_0x538914[_0x4cf5('0x32')](_0x1a2414[_0x4cf5('0x40')]({'attributes':['id',_0x4cf5('0x4')]}));_0x538914['push'](_0x1a2414[_0x4cf5('0x41')]({'attributes':['id',_0x4cf5('0x4')]}));break;}return BPromise[_0x4cf5('0x42')](_0x538914);}})[_0x4cf5('0xb')](function(_0x4a8266){if(_0x4a8266&&_0x4a8266[_0x4cf5('0x1b')]){for(var _0x3b0a0a=0x0;_0x3b0a0a<_0x4a8266['length'];_0x3b0a0a+=0x1){for(var _0x226aaf=0x0;_0x226aaf<_0x4a8266[_0x3b0a0a][_0x4cf5('0x1b')];_0x226aaf+=0x1){switch(_0x3b0a0a){case 0x0:joinOrLeaveQueues(_0x590140,_0x2cb9b7,_0x4cf5('0x43'),_0x4a8266[_0x3b0a0a][_0x226aaf]);break;case 0x1:joinOrLeaveQueues(_0x590140,_0x2cb9b7,_0x4cf5('0x44'),_0x4a8266[_0x3b0a0a][_0x226aaf]);break;case 0x2:joinOrLeaveQueues(_0x590140,_0x2cb9b7,_0x4cf5('0x45'),_0x4a8266[_0x3b0a0a][_0x226aaf]);break;case 0x3:joinOrLeaveQueues(_0x590140,_0x2cb9b7,_0x4cf5('0x46'),_0x4a8266[_0x3b0a0a][_0x226aaf]);break;case 0x4:joinOrLeaveQueues(_0x590140,_0x2cb9b7,'mail',_0x4a8266[_0x3b0a0a][_0x226aaf]);break;case 0x5:joinOrLeaveQueues(_0x590140,_0x2cb9b7,_0x4cf5('0x47'),_0x4a8266[_0x3b0a0a][_0x226aaf]);break;case 0x6:joinOrLeaveQueues(_0x590140,_0x2cb9b7,_0x4cf5('0x48'),_0x4a8266[_0x3b0a0a][_0x226aaf]);break;case 0x7:if(_0x44494c['role']!=='agent')_0x590140[_0x2cb9b7](util['format'](_0x4cf5('0x49'),_0x4a8266[_0x3b0a0a][_0x226aaf]['name']));break;case 0x8:if(_0x44494c[_0x4cf5('0x7')]!==_0x4cf5('0x8'))_0x590140[_0x2cb9b7](util[_0x4cf5('0x1c')](_0x4cf5('0x4a'),_0x4a8266[_0x3b0a0a][_0x226aaf]['name']));break;case 0x9:if(_0x44494c[_0x4cf5('0x7')]!==_0x4cf5('0x8'))_0x590140[_0x2cb9b7](util[_0x4cf5('0x1c')]('campaign:%s:%s',_0x4a8266[_0x3b0a0a][_0x226aaf]['type'],_0x4a8266[_0x3b0a0a][_0x226aaf]['name']));break;case 0xa:_0x590140[_0x2cb9b7](util[_0x4cf5('0x1c')](_0x4cf5('0x1d'),_0x4a8266[_0x3b0a0a][_0x226aaf][_0x4cf5('0x4')]));break;}}}}})[_0x4cf5('0xb')](function(){if(_0x2cb9b7===_0x4cf5('0x4b')){var _0x2de8be=_[_0x4cf5('0x16')](_0x44494c[_0x4cf5('0x23')],'id');return _0x44494c[_0x4cf5('0x4c')](_0x2de8be)[_0x4cf5('0xb')](function(){for(var _0x5cf52e=0x0;_0x5cf52e<_0x2de8be[_0x4cf5('0x1b')];_0x5cf52e+=0x1){_0xa39509[_0x4cf5('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2de8be[_0x5cf52e]),'UserId':Number(_0x44494c['id'])});}});}})[_0x4cf5('0xb')](function(){if(_0x2cb9b7==='leave'){var _0x4aa663=_['map'](_0x44494c['MailInteractions'],'id');return _0x44494c[_0x4cf5('0x4e')](_0x4aa663)[_0x4cf5('0xb')](function(){for(var _0x1104bf=0x0;_0x1104bf<_0x4aa663[_0x4cf5('0x1b')];_0x1104bf+=0x1){_0xa39509[_0x4cf5('0x4d')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4aa663[_0x1104bf]),'UserId':Number(_0x44494c['id'])});}});}})[_0x4cf5('0xb')](function(){if(_0x2cb9b7==='leave'){var _0x4fa087=_[_0x4cf5('0x16')](_0x44494c[_0x4cf5('0x27')],'id');return _0x44494c['removeFaxInteractions'](_0x4fa087)[_0x4cf5('0xb')](function(){for(var _0x2c8170=0x0;_0x2c8170<_0x4fa087['length'];_0x2c8170+=0x1){_0xa39509[_0x4cf5('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4fa087[_0x2c8170]),'UserId':Number(_0x44494c['id'])});}});}})['then'](function(){if(_0x2cb9b7===_0x4cf5('0x4b')){var _0x137f19=_[_0x4cf5('0x16')](_0x44494c['SmsInteractions'],'id');return _0x44494c[_0x4cf5('0x4f')](_0x137f19)[_0x4cf5('0xb')](function(){for(var _0xb40494=0x0;_0xb40494<_0x137f19[_0x4cf5('0x1b')];_0xb40494+=0x1){_0xa39509[_0x4cf5('0x4d')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x137f19[_0xb40494]),'UserId':Number(_0x44494c['id'])});}});}})[_0x4cf5('0xb')](function(){if(_0x2cb9b7===_0x4cf5('0x4b')){var _0x1b5c63=_[_0x4cf5('0x16')](_0x44494c[_0x4cf5('0x2b')],'id');return _0x44494c[_0x4cf5('0x50')](_0x1b5c63)[_0x4cf5('0xb')](function(){for(var _0x3385ef=0x0;_0x3385ef<_0x1b5c63[_0x4cf5('0x1b')];_0x3385ef+=0x1){_0xa39509[_0x4cf5('0x4d')](_0x4cf5('0x51'),{'OpenchannelInteractionId':Number(_0x1b5c63[_0x3385ef]),'UserId':Number(_0x44494c['id'])});}});}})[_0x4cf5('0xb')](function(){if(_0x2cb9b7===_0x4cf5('0x4b')){var _0x33195a=_[_0x4cf5('0x16')](_0x44494c[_0x4cf5('0x2c')],'id');return _0x44494c['removeWhatsappInteractions'](_0x33195a)[_0x4cf5('0xb')](function(){for(var _0x344ff8=0x0;_0x344ff8<_0x33195a[_0x4cf5('0x1b')];_0x344ff8+=0x1){_0xa39509['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x33195a[_0x344ff8]),'UserId':Number(_0x44494c['id'])});}});}})['catch'](function(_0xe30a6e){_0x590140['log'](_0xe30a6e);});}}function onDisconnect(_0x424051,_0x3ad161){joinOrLeave(_0x424051,'leave',_0x3ad161);}function onConnect(_0x58f673){joinOrLeave(_0x58f673,_0x4cf5('0x52'));}exports[_0x4cf5('0x53')]=function(_0x3e705e){_0x3e705e['on'](_0x4cf5('0x54'),function(_0x4c0d81){_0x4c0d81[_0x4cf5('0x55')](0x0);_0x4c0d81[_0x4cf5('0x56')]=_0x4c0d81['request']['connection'][_0x4cf5('0x57')]+':'+_0x4c0d81[_0x4cf5('0x58')][_0x4cf5('0x54')][_0x4cf5('0x59')];_0x4c0d81[_0x4cf5('0x5a')]=new Date();_0x4c0d81[_0x4cf5('0x5b')]=function(_0x4fa52a){console[_0x4cf5('0x5b')](_0x4cf5('0x5c')+_0x4c0d81[_0x4cf5('0x5d')][_0x4cf5('0x4')]+'['+_0x4c0d81['address']+']',_0x4fa52a);};_0x4c0d81['on']('disconnect',function(){onDisconnect(_0x4c0d81,_0x3e705e);_0x4c0d81[_0x4cf5('0x5b')]('DISCONNECTED');});onConnect(_0x4c0d81);_0x4c0d81[_0x4cf5('0x5b')](_0x4cf5('0x5e'));});}; \ No newline at end of file +var _0xe353=['address','remoteAddress','request','remotePort','connectedAt','log','nsp','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','ivr','format','%s:queue:%s','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','voice:outbound','ChatQueues','WhatsappQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners'];(function(_0x45adaf,_0x21c3c1){var _0x15d189=function(_0x48dc43){while(--_0x48dc43){_0x45adaf['push'](_0x45adaf['shift']());}};_0x15d189(++_0x21c3c1);}(_0xe353,0xdc));var _0x3e35=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xe353[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');var util=require(_0x3e35('0x0'));var BPromise=require(_0x3e35('0x1'));var db=require(_0x3e35('0x2'))['db'];var config=require(_0x3e35('0x3'));var queryQueues={'attributes':['id',_0x3e35('0x4')],'include':[{'as':_0x3e35('0x5'),'model':db[_0x3e35('0x6')],'attributes':['id',_0x3e35('0x4'),_0x3e35('0x7')],'raw':!![],'where':{'role':_0x3e35('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3e35('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x3e35('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x3e35('0x4')],'where':{'role':_0x3e35('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x3e35('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0xe156a,_0x183d1f,_0x37dbac){return db[_0x3e35('0xa')][_0x3e35('0xb')]({'where':{'name':_0xe156a,'userProfileId':_0x183d1f},'raw':!![]})[_0x3e35('0xc')](function(_0x8e9557){if(_0x8e9557){if(_0x8e9557[_0x3e35('0xd')]){switch(_0xe156a){case _0x3e35('0xe'):case'ChatQueues':case _0x3e35('0xf'):case _0x3e35('0x10'):case _0x3e35('0x11'):case _0x3e35('0x12'):case'WhatsappQueues':return db[_0x37dbac][_0x3e35('0x13')](queryQueues);case _0x3e35('0x14'):return db[_0x37dbac]['findAll'](queryTelephones);case'Trunks':return db[_0x37dbac][_0x3e35('0x13')](queryTrunks);case _0x3e35('0x15'):return db[_0x37dbac][_0x3e35('0x13')](queryCampaigns);}}else{return db[_0x3e35('0x16')][_0x3e35('0x13')]({'attributes':[_0x3e35('0x17')],'where':{'sectionId':_0x8e9557['id']},'raw':!![]})['then'](function(_0x16ca34){if(_0x16ca34){var _0x5ab566={'where':{'id':_[_0x3e35('0x18')](_0x16ca34,'resourceId')},'raw':!![]};switch(_0x37dbac){case _0x3e35('0x6'):_0x5ab566[_0x3e35('0x19')][_0x3e35('0x7')]=_0x3e35('0x1a');break;case _0x3e35('0x1b'):_0x5ab566['where'][_0x3e35('0x9')]=_0x3e35('0x1c');break;}return db[_0x37dbac][_0x3e35('0x13')](_0x5ab566);}else{return[];}});}}else{return[];}})[_0x3e35('0xc')](function(_0x487e07){return _0x487e07;});}function joinOrLeaveQueues(_0x2a405d,_0x56aa31,_0x43fd52,_0x1eed3e){_0x2a405d[_0x56aa31](util[_0x3e35('0x1d')](_0x3e35('0x1e'),_0x43fd52,_0x1eed3e['name']));if(_0x1eed3e[_0x3e35('0x5')]){for(var _0x509244=0x0;_0x509244<_0x1eed3e['Agents'][_0x3e35('0x1f')];_0x509244+=0x1){_0x2a405d[_0x56aa31](util['format'](_0x3e35('0x20'),_0x1eed3e['Agents'][_0x509244]['name']));}}}function joinOrLeave(_0x22389a,_0x28614d,_0x1ca8c8){var _0x3ea7fa;if(_0x22389a['handshake'][_0x3e35('0x21')]['id']){db['User'][_0x3e35('0x22')]({'attributes':['id',_0x3e35('0x4'),_0x3e35('0x7'),_0x3e35('0x23')],'where':{'id':_0x22389a[_0x3e35('0x24')][_0x3e35('0x21')]['id']},'include':[{'model':db[_0x3e35('0x25')],'as':_0x3e35('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x3e35('0x27')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3e35('0x28')],'as':_0x3e35('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x3e35('0x2a')],'as':_0x3e35('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x3e35('0x2c')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3e35('0x2d')],'as':_0x3e35('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x3e35('0xc')](function(_0x3e2581){if(_0x3e2581){_0x3ea7fa=_0x3e2581;_0x22389a[_0x28614d](util[_0x3e35('0x1d')](_0x3e35('0x20'),_0x3e2581[_0x3e35('0x4')]));var _0x5084cf=[];switch(_0x3e2581[_0x3e35('0x7')]){case _0x3e35('0x2f'):_0x22389a[_0x28614d](_0x3e35('0x30'));_0x22389a[_0x28614d]('voice:outbound');if(queryQueues[_0x3e35('0x31')](_0x3e35('0x32'))){delete queryQueues['include'];}_0x5084cf[_0x3e35('0x33')](db[_0x3e35('0x34')]['findAll'](queryQueues));_0x5084cf['push'](db['ChatQueue'][_0x3e35('0x13')](queryQueues));_0x5084cf['push'](db[_0x3e35('0x35')][_0x3e35('0x13')](queryQueues));_0x5084cf[_0x3e35('0x33')](db[_0x3e35('0x36')][_0x3e35('0x13')](queryQueues));_0x5084cf[_0x3e35('0x33')](db[_0x3e35('0x37')][_0x3e35('0x13')](queryQueues));_0x5084cf[_0x3e35('0x33')](db[_0x3e35('0x38')]['findAll'](queryQueues));_0x5084cf[_0x3e35('0x33')](db[_0x3e35('0x39')][_0x3e35('0x13')](queryQueues));_0x5084cf[_0x3e35('0x33')](db[_0x3e35('0x6')][_0x3e35('0x13')](queryTelephones));_0x5084cf['push'](db['Trunk'][_0x3e35('0x13')](queryTrunks));_0x5084cf[_0x3e35('0x33')](db[_0x3e35('0x1b')][_0x3e35('0x13')](queryCampaigns));_0x5084cf['push'](db[_0x3e35('0x6')]['findAll'](queryAgents));break;case _0x3e35('0x3a'):_0x22389a[_0x28614d](_0x3e35('0x30'));_0x22389a[_0x28614d](_0x3e35('0x3b'));_0x5084cf[_0x3e35('0x33')](getAssociatedResources('VoiceQueues',_0x3e2581[_0x3e35('0x23')],'VoiceQueue'));_0x5084cf['push'](getAssociatedResources(_0x3e35('0x3c'),_0x3e2581[_0x3e35('0x23')],'ChatQueue'));_0x5084cf[_0x3e35('0x33')](getAssociatedResources(_0x3e35('0xf'),_0x3e2581[_0x3e35('0x23')],_0x3e35('0x35')));_0x5084cf[_0x3e35('0x33')](getAssociatedResources('SmsQueues',_0x3e2581[_0x3e35('0x23')],_0x3e35('0x36')));_0x5084cf[_0x3e35('0x33')](getAssociatedResources('MailQueues',_0x3e2581[_0x3e35('0x23')],'MailQueue'));_0x5084cf[_0x3e35('0x33')](getAssociatedResources(_0x3e35('0x12'),_0x3e2581[_0x3e35('0x23')],'OpenchannelQueue'));_0x5084cf[_0x3e35('0x33')](getAssociatedResources(_0x3e35('0x3d'),_0x3e2581['userProfileId'],'WhatsappQueue'));_0x5084cf[_0x3e35('0x33')](getAssociatedResources(_0x3e35('0x14'),_0x3e2581['userProfileId'],_0x3e35('0x6')));_0x5084cf[_0x3e35('0x33')](getAssociatedResources('Trunks',_0x3e2581[_0x3e35('0x23')],'Trunk'));_0x5084cf[_0x3e35('0x33')](getAssociatedResources(_0x3e35('0x15'),_0x3e2581[_0x3e35('0x23')],'Campaign'));_0x5084cf[_0x3e35('0x33')](db[_0x3e35('0x6')][_0x3e35('0x13')](queryAgents));break;case _0x3e35('0x8'):_0x22389a[_0x28614d](_0x3e35('0x30'));_0x22389a[_0x28614d](_0x3e35('0x3b'));_0x5084cf[_0x3e35('0x33')](_0x3e2581[_0x3e35('0x3e')]({'attributes':['id',_0x3e35('0x4')]}));_0x5084cf[_0x3e35('0x33')](_0x3e2581[_0x3e35('0x3f')]({'attributes':['id','name']}));_0x5084cf['push'](_0x3e2581[_0x3e35('0x40')]({'attributes':['id',_0x3e35('0x4')]}));_0x5084cf['push'](_0x3e2581[_0x3e35('0x41')]({'attributes':['id',_0x3e35('0x4')]}));_0x5084cf['push'](_0x3e2581[_0x3e35('0x42')]({'attributes':['id',_0x3e35('0x4')]}));_0x5084cf['push'](_0x3e2581[_0x3e35('0x43')]({'attributes':['id',_0x3e35('0x4')]}));_0x5084cf['push'](_0x3e2581[_0x3e35('0x44')]({'attributes':['id',_0x3e35('0x4')]}));break;}return BPromise[_0x3e35('0x45')](_0x5084cf);}})[_0x3e35('0xc')](function(_0x5e2c66){if(_0x5e2c66&&_0x5e2c66['length']){for(var _0x50244a=0x0;_0x50244a<_0x5e2c66[_0x3e35('0x1f')];_0x50244a+=0x1){for(var _0x330320=0x0;_0x330320<_0x5e2c66[_0x50244a][_0x3e35('0x1f')];_0x330320+=0x1){switch(_0x50244a){case 0x0:joinOrLeaveQueues(_0x22389a,_0x28614d,_0x3e35('0x46'),_0x5e2c66[_0x50244a][_0x330320]);break;case 0x1:joinOrLeaveQueues(_0x22389a,_0x28614d,_0x3e35('0x47'),_0x5e2c66[_0x50244a][_0x330320]);break;case 0x2:joinOrLeaveQueues(_0x22389a,_0x28614d,_0x3e35('0x48'),_0x5e2c66[_0x50244a][_0x330320]);break;case 0x3:joinOrLeaveQueues(_0x22389a,_0x28614d,_0x3e35('0x49'),_0x5e2c66[_0x50244a][_0x330320]);break;case 0x4:joinOrLeaveQueues(_0x22389a,_0x28614d,_0x3e35('0x4a'),_0x5e2c66[_0x50244a][_0x330320]);break;case 0x5:joinOrLeaveQueues(_0x22389a,_0x28614d,_0x3e35('0x4b'),_0x5e2c66[_0x50244a][_0x330320]);break;case 0x6:joinOrLeaveQueues(_0x22389a,_0x28614d,_0x3e35('0x4c'),_0x5e2c66[_0x50244a][_0x330320]);break;case 0x7:if(_0x3ea7fa[_0x3e35('0x7')]!=='agent')_0x22389a[_0x28614d](util[_0x3e35('0x1d')](_0x3e35('0x4d'),_0x5e2c66[_0x50244a][_0x330320][_0x3e35('0x4')]));break;case 0x8:if(_0x3ea7fa[_0x3e35('0x7')]!==_0x3e35('0x8'))_0x22389a[_0x28614d](util[_0x3e35('0x1d')]('trunk:%s',_0x5e2c66[_0x50244a][_0x330320][_0x3e35('0x4')]));break;case 0x9:if(_0x3ea7fa[_0x3e35('0x7')]!==_0x3e35('0x8'))_0x22389a[_0x28614d](util[_0x3e35('0x1d')](_0x3e35('0x4e'),_0x5e2c66[_0x50244a][_0x330320][_0x3e35('0x9')],_0x5e2c66[_0x50244a][_0x330320][_0x3e35('0x4')]));break;case 0xa:_0x22389a[_0x28614d](util[_0x3e35('0x1d')](_0x3e35('0x20'),_0x5e2c66[_0x50244a][_0x330320][_0x3e35('0x4')]));break;}}}}})[_0x3e35('0xc')](function(){if(_0x28614d===_0x3e35('0x4f')){var _0x30a550=_[_0x3e35('0x18')](_0x3ea7fa[_0x3e35('0x26')],'id');return _0x3ea7fa[_0x3e35('0x50')](_0x30a550)['then'](function(){for(var _0x1c5580=0x0;_0x1c5580<_0x30a550[_0x3e35('0x1f')];_0x1c5580+=0x1){_0x1ca8c8[_0x3e35('0x51')](_0x3e35('0x52'),{'ChatInteractionId':Number(_0x30a550[_0x1c5580]),'UserId':Number(_0x3ea7fa['id'])});}});}})['then'](function(){if(_0x28614d===_0x3e35('0x4f')){var _0x12d8c2=_['map'](_0x3ea7fa[_0x3e35('0x53')],'id');return _0x3ea7fa[_0x3e35('0x54')](_0x12d8c2)[_0x3e35('0xc')](function(){for(var _0x2a57d4=0x0;_0x2a57d4<_0x12d8c2[_0x3e35('0x1f')];_0x2a57d4+=0x1){_0x1ca8c8[_0x3e35('0x51')](_0x3e35('0x55'),{'MailInteractionId':Number(_0x12d8c2[_0x2a57d4]),'UserId':Number(_0x3ea7fa['id'])});}});}})[_0x3e35('0xc')](function(){if(_0x28614d===_0x3e35('0x4f')){var _0x2b518f=_[_0x3e35('0x18')](_0x3ea7fa[_0x3e35('0x29')],'id');return _0x3ea7fa['removeFaxInteractions'](_0x2b518f)[_0x3e35('0xc')](function(){for(var _0x953b54=0x0;_0x953b54<_0x2b518f[_0x3e35('0x1f')];_0x953b54+=0x1){_0x1ca8c8[_0x3e35('0x51')](_0x3e35('0x56'),{'FaxInteractionId':Number(_0x2b518f[_0x953b54]),'UserId':Number(_0x3ea7fa['id'])});}});}})[_0x3e35('0xc')](function(){if(_0x28614d==='leave'){var _0x120892=_['map'](_0x3ea7fa['SmsInteractions'],'id');return _0x3ea7fa[_0x3e35('0x57')](_0x120892)[_0x3e35('0xc')](function(){for(var _0x48e7c5=0x0;_0x48e7c5<_0x120892['length'];_0x48e7c5+=0x1){_0x1ca8c8[_0x3e35('0x51')](_0x3e35('0x58'),{'SmsInteractionId':Number(_0x120892[_0x48e7c5]),'UserId':Number(_0x3ea7fa['id'])});}});}})['then'](function(){if(_0x28614d===_0x3e35('0x4f')){var _0x56d72b=_['map'](_0x3ea7fa[_0x3e35('0x59')],'id');return _0x3ea7fa[_0x3e35('0x5a')](_0x56d72b)[_0x3e35('0xc')](function(){for(var _0x3376c7=0x0;_0x3376c7<_0x56d72b[_0x3e35('0x1f')];_0x3376c7+=0x1){_0x1ca8c8[_0x3e35('0x51')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x56d72b[_0x3376c7]),'UserId':Number(_0x3ea7fa['id'])});}});}})['then'](function(){if(_0x28614d===_0x3e35('0x4f')){var _0x116c21=_['map'](_0x3ea7fa[_0x3e35('0x2e')],'id');return _0x3ea7fa[_0x3e35('0x5b')](_0x116c21)[_0x3e35('0xc')](function(){for(var _0x4a74e8=0x0;_0x4a74e8<_0x116c21['length'];_0x4a74e8+=0x1){_0x1ca8c8['emit'](_0x3e35('0x5c'),{'WhatsappInteractionId':Number(_0x116c21[_0x4a74e8]),'UserId':Number(_0x3ea7fa['id'])});}});}})[_0x3e35('0x5d')](function(_0x21f24e){_0x22389a['log'](_0x21f24e);});}}function onDisconnect(_0x256f11,_0x58d7dd){joinOrLeave(_0x256f11,_0x3e35('0x4f'),_0x58d7dd);}function onConnect(_0x4e5553){joinOrLeave(_0x4e5553,_0x3e35('0x5e'));}exports[_0x3e35('0x5f')]=function(_0x224a04){_0x224a04['on'](_0x3e35('0x60'),function(_0x190011){_0x190011[_0x3e35('0x61')](0x0);_0x190011[_0x3e35('0x62')]=_0x190011['request']['connection'][_0x3e35('0x63')]+':'+_0x190011[_0x3e35('0x64')]['connection'][_0x3e35('0x65')];_0x190011[_0x3e35('0x66')]=new Date();_0x190011[_0x3e35('0x67')]=function(_0x26507c){console[_0x3e35('0x67')]('SocketIO\x20'+_0x190011[_0x3e35('0x68')][_0x3e35('0x4')]+'['+_0x190011[_0x3e35('0x62')]+']',_0x26507c);};_0x190011['on']('disconnect',function(){onDisconnect(_0x190011,_0x224a04);_0x190011[_0x3e35('0x67')]('DISCONNECTED');});onConnect(_0x190011);_0x190011[_0x3e35('0x67')](_0x3e35('0x69'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 9da46ac..a3c63e7 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 _0x1625=['name','AfterCreateMessage','event','offlineMessage','opened','sequelize','AfterCreate','changed','closed','substatus','agent','AfterUpdate','User','find','fullname','email','default','model','hook','callback','toLowerCase','condition','util','jayson/promise','../logger','triggers','client','afterCreate','newinteraction','ChatInteraction','closedinteraction','Chat','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s'];(function(_0x2eb37b,_0x40e269){var _0xc8c50=function(_0x4bc1d6){while(--_0x4bc1d6){_0x2eb37b['push'](_0x2eb37b['shift']());}};_0xc8c50(++_0x40e269);}(_0x1625,0xa8));var _0x5162=function(_0x190ff8,_0x152562){_0x190ff8=_0x190ff8-0x0;var _0xe58de6=_0x1625[_0x190ff8];return _0xe58de6;};'use strict';var util=require(_0x5162('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5162('0x1'));var logger=require(_0x5162('0x2'))(_0x5162('0x3'));var client=jayson[_0x5162('0x4')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0x5162('0x5'),'condition':_0x5162('0x6'),'callback':afterCreate},{'channel':'Chat','model':_0x5162('0x7'),'event':'afterUpdate','condition':_0x5162('0x8'),'callback':afterUpdate},{'channel':_0x5162('0x9'),'model':'ChatMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x5162('0x9'),'model':_0x5162('0xa'),'event':_0x5162('0x5'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x5162('0xb'),'model':'SmsInteraction','event':_0x5162('0x5'),'condition':_0x5162('0x6'),'callback':afterCreate},{'channel':_0x5162('0xb'),'model':_0x5162('0xc'),'event':_0x5162('0xd'),'condition':_0x5162('0x8'),'callback':afterUpdate},{'channel':_0x5162('0xb'),'model':_0x5162('0xe'),'event':'afterCreate','condition':_0x5162('0xf'),'callback':afterCreateMessage},{'channel':_0x5162('0x10'),'model':_0x5162('0x11'),'event':_0x5162('0x5'),'condition':_0x5162('0x6'),'callback':afterCreate},{'channel':_0x5162('0x10'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0x5162('0x8'),'callback':afterUpdate},{'channel':_0x5162('0x10'),'model':_0x5162('0x12'),'event':_0x5162('0x5'),'condition':_0x5162('0xf'),'callback':afterCreateMessage},{'channel':_0x5162('0x13'),'model':'FaxInteraction','event':_0x5162('0x5'),'condition':_0x5162('0x6'),'callback':afterCreate},{'channel':_0x5162('0x13'),'model':_0x5162('0x14'),'event':_0x5162('0xd'),'condition':_0x5162('0x8'),'callback':afterUpdate},{'channel':_0x5162('0x13'),'model':'FaxMessage','event':_0x5162('0x5'),'condition':_0x5162('0xf'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x5162('0x15'),'event':_0x5162('0x5'),'condition':_0x5162('0x6'),'callback':afterCreate},{'channel':_0x5162('0x16'),'model':_0x5162('0x15'),'event':_0x5162('0xd'),'condition':_0x5162('0x8'),'callback':afterUpdate},{'channel':'Mail','model':_0x5162('0x17'),'event':_0x5162('0x5'),'condition':_0x5162('0xf'),'callback':afterCreateMessage},{'channel':_0x5162('0x18'),'model':_0x5162('0x19'),'event':_0x5162('0x5'),'condition':_0x5162('0x6'),'callback':afterCreate},{'channel':_0x5162('0x18'),'model':_0x5162('0x19'),'event':_0x5162('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0x5162('0x5'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x3d76db){return client[_0x5162('0x1a')](_0x5162('0x1b'),_0x3d76db)[_0x5162('0x1c')](function(_0x18239e){logger[_0x5162('0x1d')](_0x5162('0x1e'),_0x5162('0x1b'),_0x18239e);if(_0x18239e[_0x5162('0x1f')]){if(_0x18239e[_0x5162('0x1f')][_0x5162('0x20')]===0x1f4){logger[_0x5162('0x1f')]('Trigger,\x20%s',_0x5162('0x1b'),_0x18239e[_0x5162('0x1f')]);}}})[_0x5162('0x21')](function(_0x17a42e){logger[_0x5162('0x1f')](_0x5162('0x1e'),'EventManager',_0x17a42e);});}function afterCreateMessage(_0x4a0bb3){return function(_0x1dbd4f){_0x1dbd4f=_0x1dbd4f[_0x5162('0x22')]({'plain':!![]});_0x1dbd4f[_0x5162('0x23')]=_0x4a0bb3;_0x1dbd4f[_0x5162('0x24')]=_0x4a0bb3;_0x1dbd4f['event']=_0x1dbd4f[_0x5162('0x25')];Promise[_0x5162('0x26')]()[_0x5162('0x1c')](function(){if(typeof _0x1dbd4f[_0x5162('0x27')]===_0x5162('0x28'))return null;var _0x118545=_0x5162('0x29')+_0x1dbd4f[_0x5162('0x27')];return db['sequelize'][_0x5162('0x2a')](_0x118545,{'type':db[_0x5162('0x2b')][_0x5162('0x2c')][_0x5162('0x2d')],'raw':!![]});})[_0x5162('0x1c')](function(_0x47ec51){if(_0x47ec51){_0x1dbd4f[_0x5162('0x2e')]=_0x47ec51[0x0];}if(typeof _0x1dbd4f[_0x5162('0x2f')]===_0x5162('0x28'))return;return getAgent(_0x1dbd4f[_0x5162('0x2f')]);})[_0x5162('0x1c')](function(_0x4604e5){if(_0x4604e5){_0x1dbd4f[_0x5162('0x30')]=util[_0x5162('0x31')](_0x5162('0x32'),_0x4604e5[_0x5162('0x33')]);_0x1dbd4f['agent']=_0x4604e5;_0x1dbd4f[_0x5162('0x23')]=_0x4a0bb3;return request({'event':'incomingmessage','message':_0x1dbd4f});}else{return request({'event':'outgoingmessage','message':_0x1dbd4f});}})[_0x5162('0x21')](function(_0x1b37da){logger['error']('Trigger,\x20%s',_0x5162('0x34'),_0x1b37da);});};}function afterCreateOfflineMessage(_0x1ecc71){return function(_0x2e3fab){_0x2e3fab=_0x2e3fab[_0x5162('0x22')]({'plain':!![]});_0x2e3fab[_0x5162('0x23')]=_0x1ecc71;_0x2e3fab['motionChannel']=_0x1ecc71;_0x2e3fab[_0x5162('0x35')]=_0x5162('0x36');return request({'event':_0x2e3fab['event'],'message':_0x2e3fab});};}function afterCreate(_0x391a3b,_0x5cf31c){return function(_0x3f2dcb){var _0x4481fe=_0x3f2dcb[_0x5162('0x22')]({'plain':!![]});_0x4481fe[_0x5162('0x23')]=_0x391a3b;_0x4481fe['motionChannel']=_0x391a3b;_0x4481fe[_0x5162('0x35')]=_0x5162('0x37');Promise[_0x5162('0x26')]()[_0x5162('0x1c')](function(){var _0x58d690='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4481fe[_0x5162('0x27')];return db[_0x5162('0x38')][_0x5162('0x2a')](_0x58d690,{'type':db[_0x5162('0x2b')][_0x5162('0x2c')]['SELECT'],'raw':!![]});})[_0x5162('0x1c')](function(_0xd01db5){if(_0xd01db5){_0x4481fe[_0x5162('0x2e')]=_0xd01db5[0x0];}if(_0x4481fe[_0x5162('0x2f')]){return getAgent(_0x4481fe[_0x5162('0x2f')]);}return;})['then'](function(_0x1654d6){if(_0x1654d6){_0x4481fe[_0x5162('0x30')]=util[_0x5162('0x31')]('SIP/%s',_0x1654d6[_0x5162('0x33')]);_0x4481fe['agent']=_0x1654d6;}return request({'event':_0x5cf31c,'message':_0x4481fe});})[_0x5162('0x21')](function(_0x486790){logger[_0x5162('0x1f')]('Trigger,\x20%s',_0x5162('0x39'),_0x486790);});};}function afterUpdate(_0xbb701d){return function(_0x2fa8d3){var _0xbf0518=_0x2fa8d3[_0x5162('0x3a')](_0x5162('0x3b'))&&_0x2fa8d3['closed'];var _0x5ca41a=_0x2fa8d3[_0x5162('0x3a')](_0x5162('0x3c'));if(_0xbf0518||_0x5ca41a){var _0xdff290=_0xbf0518?_0x5162('0x8'):_0x5162('0x3c');var _0x1e06e1=_0x2fa8d3[_0x5162('0x22')]({'plain':!![]});_0x1e06e1['channel']=_0xbb701d;_0x1e06e1[_0x5162('0x24')]=_0xbb701d;_0x1e06e1[_0x5162('0x35')]=_0xbf0518?_0x5162('0x3b'):_0x5162('0x3c');var _0x1da70b=_0x5162('0x29')+_0x1e06e1[_0x5162('0x27')];return db[_0x5162('0x38')]['query'](_0x1da70b,{'type':db[_0x5162('0x2b')][_0x5162('0x2c')][_0x5162('0x2d')],'raw':!![]})[_0x5162('0x1c')](function(_0x43168d){if(_0x43168d){_0x1e06e1['contact']=_0x43168d[0x0];}if(typeof _0x1e06e1[_0x5162('0x2f')]===_0x5162('0x28'))return;return getAgent(_0x1e06e1[_0x5162('0x2f')]);})[_0x5162('0x1c')](function(_0x3aa395){if(_0x3aa395){_0x1e06e1[_0x5162('0x30')]=util['format'](_0x5162('0x32'),_0x3aa395[_0x5162('0x33')]);_0x1e06e1[_0x5162('0x3d')]=_0x3aa395;}return request({'event':_0xdff290,'message':_0x1e06e1});})[_0x5162('0x21')](function(_0x433b66){logger[_0x5162('0x1f')](_0x5162('0x1e'),_0x5162('0x3e'),_0x433b66);});}};}function getAgent(_0x4440ba){return db[_0x5162('0x3f')][_0x5162('0x40')]({'where':{'id':_0x4440ba},'attributes':['id',_0x5162('0x33'),_0x5162('0x41'),_0x5162('0x42'),'internal'],'raw':!![]})[_0x5162('0x1c')](function(_0x305329){return _0x305329;});}exports[_0x5162('0x43')]=function(){for(var _0x11f9fd=0x0;_0x11f9fd=_0x4a1c47[_0x67f3('0x10')]){throw Error(_0x67f3('0x11'));}_0x19ac4b(_0x2c78a8);})['catch'](function(_0x311d88){_0x429d6b(_0x311d88);});});}; \ No newline at end of file +var _0x5a01=['chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','../mysqldb','./license/util','voice'];(function(_0x1fbab1,_0x43c7cd){var _0x3c55ed=function(_0x54fe19){while(--_0x54fe19){_0x1fbab1['push'](_0x1fbab1['shift']());}};_0x3c55ed(++_0x43c7cd);}(_0x5a01,0x105));var _0x15a0=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0x5a01[_0x1f0724];return _0x253ffb;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0x15a0('0x0'))['db'];var util=require(_0x15a0('0x1'));var channels=[_0x15a0('0x2'),'mail',_0x15a0('0x3'),_0x15a0('0x4'),_0x15a0('0x5'),_0x15a0('0x6'),_0x15a0('0x7')];exports[_0x15a0('0x8')]=function(){return channels;};exports[_0x15a0('0x9')]=function(_0x50f1fb){_0x50f1fb=_0x50f1fb[_0x15a0('0xa')]();return _[_0x15a0('0xb')](channels,_0x50f1fb);};exports[_0x15a0('0xc')]=function(_0x2ad1b9,_0x1377dd,_0x14991e,_0x509460){var _0x4d8c18={'loginAttempts':_0x1377dd,'blocked':_0x14991e};if(!_['isUndefined'](_0x509460)){_0x4d8c18[_0x15a0('0xd')]=_0x509460;}return _0x2ad1b9[_0x15a0('0xe')](_0x4d8c18);};exports[_0x15a0('0xf')]=function(_0x19ba68){return new BPromise(function(_0x1dae83,_0x570d29){var _0x2298be=0x0;if(_0x19ba68[_0x15a0('0x10')]!==_0x15a0('0x11')){_0x1dae83(_0x19ba68);}db[_0x15a0('0x12')][_0x15a0('0x13')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x19ba68['id']}}})[_0x15a0('0x14')](function(_0x2dae99){_0x2298be=_0x2dae99;return util['getLicense']();})[_0x15a0('0x14')](function(_0xa67734){if(_0xa67734&&_0xa67734[_0x15a0('0x15')]&&_0x2298be>=_0xa67734[_0x15a0('0x15')]){throw Error(_0x15a0('0x16'));}_0x1dae83(_0x19ba68);})[_0x15a0('0x17')](function(_0x1bdc81){_0x570d29(_0x1bdc81);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 6a0a14d..99abe52 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc6=['api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','OutOfInterval','Resource\x20Conflict','Conflict','error','status','send','exports'];(function(_0x560cae,_0x33c770){var _0x4e3c5d=function(_0xf12a74){while(--_0xf12a74){_0x560cae['push'](_0x560cae['shift']());}};_0x4e3c5d(++_0x33c770);}(_0xafc6,0x17c));var _0x6afc=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xafc6[_0x26f702];return _0x11417d;};'use strict';var util=require('util');var logger=require('../config/logger')(_0x6afc('0x0'));var APIError=function(_0x124892,_0xe68fb){this[_0x6afc('0x1')]=_0x124892||_0x6afc('0x2');this[_0x6afc('0x3')]=_0xe68fb||_0x6afc('0x4');util[_0x6afc('0x5')](APIError,Error);};var APIBadRequestError=function(_0x3cf24f){this['message']=_0x3cf24f||'Bad\x20Request';this[_0x6afc('0x3')]=_0x6afc('0x6');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x302452){this['message']=_0x302452||_0x6afc('0x7');this[_0x6afc('0x3')]=_0x6afc('0x7');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x558fe3){this[_0x6afc('0x1')]=_0x558fe3||_0x6afc('0x8');this['name']=_0x6afc('0x9');util[_0x6afc('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x5deccb){this[_0x6afc('0x1')]=_0x5deccb||_0x6afc('0xa');this['name']=_0x6afc('0xb');this[_0x6afc('0xc')]=0x193;this['details']={'type':_0x6afc('0xd')};util[_0x6afc('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x4a6214){this['message']=_0x4a6214||_0x6afc('0xe');this['name']=_0x6afc('0xf');util[_0x6afc('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x6dc229){switch(_0x6dc229){case'Bad\x20Request':return 0x190;case'Forbidden',_0x6afc('0xb'):return 0x193;case _0x6afc('0x9'):return 0x194;case _0x6afc('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1d431a){if(_0x1d431a===_0x6afc('0xb'))return _0x1d431a;return null;}function handleError(_0x54d49a){return function(_0x2c30b8){logger[_0x6afc('0x10')](_0x2c30b8['stack']);var _0x313624=getStatusCode(_0x2c30b8[_0x6afc('0x3')]);var _0x5e1b63=getCustomStatusMessage(_0x2c30b8[_0x6afc('0x3')]);if(_0x2c30b8[_0x6afc('0x3')]){delete _0x2c30b8[_0x6afc('0x3')];}if(_0x5e1b63){_0x54d49a['statusMessage']=_0x5e1b63;}return _0x54d49a[_0x6afc('0x11')](_0x313624)[_0x6afc('0x12')](_0x2c30b8);};}module[_0x6afc('0x13')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xe1bf=['Bad\x20Request','name','Forbidden','Entity\x20not\x20found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','Resource\x20Conflict','Conflict','Out\x20Of\x20Interval','Not\x20Found','error','statusMessage','status','send','util','api','message','Internal\x20Server\x20Error','Error','inherits'];(function(_0x65ff4c,_0x16a5be){var _0x3b80fa=function(_0x406722){while(--_0x406722){_0x65ff4c['push'](_0x65ff4c['shift']());}};_0x3b80fa(++_0x16a5be);}(_0xe1bf,0x126));var _0xfe1b=function(_0x386847,_0x3376f1){_0x386847=_0x386847-0x0;var _0x2b9820=_0xe1bf[_0x386847];return _0x2b9820;};'use strict';var util=require(_0xfe1b('0x0'));var logger=require('../config/logger')(_0xfe1b('0x1'));var APIError=function(_0x1def1c,_0x102953){this[_0xfe1b('0x2')]=_0x1def1c||_0xfe1b('0x3');this['name']=_0x102953||_0xfe1b('0x4');util[_0xfe1b('0x5')](APIError,Error);};var APIBadRequestError=function(_0x4e2d3c){this[_0xfe1b('0x2')]=_0x4e2d3c||_0xfe1b('0x6');this[_0xfe1b('0x7')]=_0xfe1b('0x6');util[_0xfe1b('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3dd201){this[_0xfe1b('0x2')]=_0x3dd201||_0xfe1b('0x8');this['name']=_0xfe1b('0x8');util[_0xfe1b('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x2f23f1){this[_0xfe1b('0x2')]=_0x2f23f1||_0xfe1b('0x9');this[_0xfe1b('0x7')]='Not\x20Found';util[_0xfe1b('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3237ce){this['message']=_0x3237ce||_0xfe1b('0xa');this[_0xfe1b('0x7')]='Out\x20Of\x20Interval';this[_0xfe1b('0xb')]=0x193;this['details']={'type':'OutOfInterval'};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x41426b){this[_0xfe1b('0x2')]=_0x41426b||_0xfe1b('0xc');this[_0xfe1b('0x7')]=_0xfe1b('0xd');util[_0xfe1b('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x3904ad){switch(_0x3904ad){case _0xfe1b('0x6'):return 0x190;case _0xfe1b('0x8'),_0xfe1b('0xe'):return 0x193;case _0xfe1b('0xf'):return 0x194;case _0xfe1b('0xd'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x3853fc){if(_0x3853fc===_0xfe1b('0xe'))return _0x3853fc;return null;}function handleError(_0x5d2e97){return function(_0x23cc5c){logger[_0xfe1b('0x10')](_0x23cc5c['stack']);var _0x2d9770=getStatusCode(_0x23cc5c[_0xfe1b('0x7')]);var _0x4d88de=getCustomStatusMessage(_0x23cc5c[_0xfe1b('0x7')]);if(_0x23cc5c[_0xfe1b('0x7')]){delete _0x23cc5c[_0xfe1b('0x7')];}if(_0x4d88de){_0x5d2e97[_0xfe1b('0x11')]=_0x4d88de;}return _0x5d2e97[_0xfe1b('0x12')](_0x2d9770)[_0xfe1b('0x13')](_0x23cc5c);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 45e5fee..92e72c7 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d71=['404','status','render','json','send','exports'];(function(_0x19d1dd,_0x586a74){var _0x2c8d2f=function(_0x31bb3e){while(--_0x31bb3e){_0x19d1dd['push'](_0x19d1dd['shift']());}};_0x2c8d2f(++_0x586a74);}(_0x4d71,0x6b));var _0x14d7=function(_0x3a11e1,_0x185961){_0x3a11e1=_0x3a11e1-0x0;var _0x181464=_0x4d71[_0x3a11e1];return _0x181464;};'use strict';module[_0x14d7('0x0')][0x194]=function pageNotFound(_0x5d7260,_0x515979){var _0x56299a=_0x14d7('0x1');var _0x4b397d=0x194;var _0x19f7ae={'status':_0x4b397d};_0x515979[_0x14d7('0x2')](_0x19f7ae['status']);_0x515979[_0x14d7('0x3')](_0x56299a,{},function(_0x211da1,_0x1dfd04){if(_0x211da1){return _0x515979[_0x14d7('0x2')](_0x19f7ae[_0x14d7('0x2')])[_0x14d7('0x4')](_0x19f7ae);}_0x515979[_0x14d7('0x5')](_0x1dfd04);});}; \ No newline at end of file +var _0xd10f=['status','json','send','exports','404'];(function(_0x40a415,_0x705cbc){var _0x4ad5d8=function(_0x363003){while(--_0x363003){_0x40a415['push'](_0x40a415['shift']());}};_0x4ad5d8(++_0x705cbc);}(_0xd10f,0x198));var _0xfd10=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd10f[_0x397e5f];return _0x5302b8;};'use strict';module[_0xfd10('0x0')][0x194]=function pageNotFound(_0x30b3a0,_0xf78fea){var _0x1ac970=_0xfd10('0x1');var _0x4affd5=0x194;var _0x41bd3f={'status':_0x4affd5};_0xf78fea[_0xfd10('0x2')](_0x41bd3f['status']);_0xf78fea['render'](_0x1ac970,{},function(_0x28f0ba,_0x1bf526){if(_0x28f0ba){return _0xf78fea[_0xfd10('0x2')](_0x41bd3f[_0xfd10('0x2')])[_0xfd10('0x3')](_0x41bd3f);}_0xf78fea[_0xfd10('0x4')](_0x1bf526);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 04d3553..afe4260 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b85=['../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','IntegrationReport','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','VoiceMail','cascade','UserId','User','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','UserNotifications','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueue','SmsQueues','OpenchannelQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','Applications','Sounds','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','CmHopper','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','Pause','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','VoiceCallReport','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Messages','MailInteraction','List','mandatoryDispositionPauseId','MailInteractionId','CmContact','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Account','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','ListId','Dashboard','Items','FaxAccountId','Exntensions','fax_interaction_has_tags','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','Interactions','SmsInteractionId','sms_interaction_has_tags','SmsQueue','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','Queue','ChatQueueId','ChatInteractionId','team_has_chat_queues','ChatGroupId','chat_group_has_users','Website','CompanyId','Phones','CmContactId','CmCompany','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','CampaignId','OwnerId','All','OneAll','Any','Action','AutomationId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','chat_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','Hopper','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','Field','VariableId','DescriptionId','DeskAccount','ZohoField','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Configuration','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','ProjectId','FaxQueues','team_has_whatsapp_queues','WhatsappQueues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','UserProfileSection','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','sequelize','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8_general_ci','sequelizeHistory','defaultsDeep','utf8mb4','utf8','database','username','password','options','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','VoiceRecording','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue'];(function(_0x4ad598,_0x3c91e7){var _0x4f201b=function(_0x59ba02){while(--_0x59ba02){_0x4ad598['push'](_0x4ad598['shift']());}};_0x4f201b(++_0x3c91e7);}(_0x2b85,0x197));var _0x52b8=function(_0x44fc94,_0x10c4f0){_0x44fc94=_0x44fc94-0x0;var _0x5f5950=_0x2b85[_0x44fc94];return _0x5f5950;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x52b8('0x0'));var _=require('lodash');var jstz=require(_0x52b8('0x1'));var timezone=jstz[_0x52b8('0x2')]();config[_0x52b8('0x0')]=_['defaultsDeep'](config[_0x52b8('0x0')],{'database':_0x52b8('0x3'),'username':_0x52b8('0x4'),'password':_0x52b8('0x5'),'options':{'host':_0x52b8('0x6'),'port':0xcea,'dialect':_0x52b8('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x52b8('0x8')](),'define':{'charset':'utf8','collate':_0x52b8('0x9')}}});config[_0x52b8('0xa')]=_[_0x52b8('0xb')](config['sequelizeHistory'],{'database':_0x52b8('0x3'),'username':_0x52b8('0x4'),'password':_0x52b8('0x5'),'options':{'host':_0x52b8('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x52b8('0xc')},'logging':![],'timezone':timezone[_0x52b8('0x8')](),'define':{'charset':_0x52b8('0xd'),'collate':_0x52b8('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x52b8('0x0')][_0x52b8('0xe')],config[_0x52b8('0x0')][_0x52b8('0xf')],config[_0x52b8('0x0')][_0x52b8('0x10')],config[_0x52b8('0x0')][_0x52b8('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x52b8('0xa')][_0x52b8('0xe')],config[_0x52b8('0xa')]['username'],config[_0x52b8('0xa')][_0x52b8('0x10')],config[_0x52b8('0xa')][_0x52b8('0x11')])};db['User']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x13'));db['VoiceChanSpy']=db[_0x52b8('0x0')]['import'](_0x52b8('0x14'));db[_0x52b8('0x15')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/voiceContext/voiceContext.model');db[_0x52b8('0x16')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x17'));db[_0x52b8('0x18')]=db['sequelize'][_0x52b8('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x52b8('0x19')]=db['sequelize'][_0x52b8('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0x52b8('0x1a')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/voiceRecording/voiceRecording.model');db[_0x52b8('0x1b')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x1c'));db[_0x52b8('0x1d')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x1e'));db['VoiceCallReport']=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x1f'));db[_0x52b8('0x20')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x21'));db[_0x52b8('0x22')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x23'));db['VoiceQueueReport']=db[_0x52b8('0x0')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0x52b8('0x24')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x25'));db[_0x52b8('0x26')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x27'));db[_0x52b8('0x28')]=db[_0x52b8('0x0')]['import']('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x29'));db[_0x52b8('0x2a')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x2b'));db[_0x52b8('0x2c')]=db['sequelize'][_0x52b8('0x12')]('../api/userChatQueue/userChatQueue.model');db[_0x52b8('0x2d')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/userMailQueue/userMailQueue.model');db[_0x52b8('0x2e')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x2f'));db[_0x52b8('0x30')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x31'));db[_0x52b8('0x32')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x33'));db[_0x52b8('0x34')]=db['sequelize']['import'](_0x52b8('0x35'));db[_0x52b8('0x36')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x37'));db[_0x52b8('0x38')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x39'));db[_0x52b8('0x3a')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x3b'));db[_0x52b8('0x3c')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x3d'));db[_0x52b8('0x3e')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x3f'));db[_0x52b8('0x40')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x41'));db[_0x52b8('0x42')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x43'));db[_0x52b8('0x44')]=db['sequelize']['import']('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/dashboard/dashboard.model');db[_0x52b8('0x45')]=db['sequelize']['import'](_0x52b8('0x46'));db[_0x52b8('0x47')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x48'));db[_0x52b8('0x49')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x4a'));db[_0x52b8('0x4b')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/faxInteraction/faxInteraction.model');db[_0x52b8('0x4c')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x4d'));db['FaxQueue']=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x4e'));db[_0x52b8('0x4f')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x50'));db[_0x52b8('0x51')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x52'));db[_0x52b8('0x53')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x54'));db[_0x52b8('0x55')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x56'));db[_0x52b8('0x57')]=db['sequelize'][_0x52b8('0x12')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x58'));db['OpenchannelAccount']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x59'));db[_0x52b8('0x5a')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0x52b8('0x5b')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x5c'));db['OpenchannelMessage']=db['sequelize']['import'](_0x52b8('0x5d'));db[_0x52b8('0x5e')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x5f'));db[_0x52b8('0x60')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x61'));db[_0x52b8('0x62')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x63'));db[_0x52b8('0x64')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x65'));db[_0x52b8('0x66')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x67'));db[_0x52b8('0x68')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x69'));db['ChatOfflineMessage']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x6a'));db[_0x52b8('0x6b')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x6c'));db[_0x52b8('0x6d')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x6e'));db[_0x52b8('0x6f')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x70'));db['CmCompany']=db['sequelize'][_0x52b8('0x12')]('../api/cmCompany/cmCompany.model');db['CmContact']=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x71'));db['CmHopper']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x72'));db[_0x52b8('0x73')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x74'));db[_0x52b8('0x75')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x76'));db[_0x52b8('0x77')]=db['sequelize'][_0x52b8('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x52b8('0x78')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x79'));db['CmCustomField']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x7a'));db['Action']=db['sequelize']['import'](_0x52b8('0x7b'));db[_0x52b8('0x7c')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x7d'));db[_0x52b8('0x7e')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x7f'));db[_0x52b8('0x80')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/disposition/disposition.model');db[_0x52b8('0x81')]=db['sequelize']['import']('../api/condition/condition.model');db[_0x52b8('0x82')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x83'));db['Pause']=db[_0x52b8('0x0')]['import'](_0x52b8('0x84'));db[_0x52b8('0x85')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/cdr/cdr.model');db[_0x52b8('0x86')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x87'));db[_0x52b8('0x88')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x89'));db[_0x52b8('0x8a')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x8b'));db[_0x52b8('0x8c')]=db['sequelize']['import'](_0x52b8('0x8d'));db['ContactItemType']=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/contactItemType/contactItemType.model');db[_0x52b8('0x8e')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x8f'));db[_0x52b8('0x90')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x91'));db[_0x52b8('0x92')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x93'));db[_0x52b8('0x94')]=db['sequelize'][_0x52b8('0x12')]('../api/trigger/trigger.model');db[_0x52b8('0x95')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x96'));db[_0x52b8('0x97')]=db[_0x52b8('0x0')]['import']('../api/integration/integration.model');db[_0x52b8('0x98')]=db[_0x52b8('0x0')]['import']('../api/integrationReport/integrationReport.model');db[_0x52b8('0x99')]=db[_0x52b8('0x0')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x52b8('0x9a')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x9b'));db[_0x52b8('0x9c')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x9d'));db[_0x52b8('0x9e')]=db['sequelize'][_0x52b8('0x12')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x9f'));db[_0x52b8('0xa0')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xa1'));db[_0x52b8('0xa2')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x52b8('0xa3')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0xa4'));db[_0x52b8('0xa5')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xa6'));db[_0x52b8('0xa7')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x52b8('0xa8')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xa9'));db[_0x52b8('0xaa')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db['sequelize'][_0x52b8('0x12')](_0x52b8('0xab'));db[_0x52b8('0xac')]=db[_0x52b8('0x0')]['import'](_0x52b8('0xad'));db[_0x52b8('0xae')]=db[_0x52b8('0x0')]['import']('../api/intDeskField/intDeskField.model');db[_0x52b8('0xaf')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xb0'));db[_0x52b8('0xb1')]=db['sequelize']['import'](_0x52b8('0xb2'));db['ZohoField']=db['sequelize'][_0x52b8('0x12')](_0x52b8('0xb3'));db[_0x52b8('0xb4')]=db[_0x52b8('0x0')]['import'](_0x52b8('0xb5'));db['ZendeskConfiguration']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xb6'));db['ZendeskField']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xb7'));db[_0x52b8('0xb8')]=db[_0x52b8('0x0')]['import'](_0x52b8('0xb9'));db['FreshdeskConfiguration']=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x52b8('0xba')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xbb'));db[_0x52b8('0xbc')]=db[_0x52b8('0x0')]['import'](_0x52b8('0xbd'));db[_0x52b8('0xbe')]=db['sequelize'][_0x52b8('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x52b8('0xbf')]=db[_0x52b8('0x0')]['import']('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x52b8('0xc0')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x52b8('0xc1')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xc2'));db[_0x52b8('0xc3')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xc4'));db['Dynamics365Configuration']=db[_0x52b8('0x0')]['import'](_0x52b8('0xc5'));db[_0x52b8('0xc6')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xc7'));db[_0x52b8('0xc8')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0xc9'));db['FreshsalesConfiguration']=db['sequelize'][_0x52b8('0x12')](_0x52b8('0xca'));db[_0x52b8('0xcb')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x52b8('0x97')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/integration/integration.model');db[_0x52b8('0xcc')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0xcd'));db['ChatQueueReport']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xce'));db['ChatInternalMessage']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xcf'));db[_0x52b8('0xd0')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xd1'));db[_0x52b8('0xd2')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0xd3'));db[_0x52b8('0xd4')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xd5'));db[_0x52b8('0xd6')]=db['sequelize'][_0x52b8('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0x52b8('0xd7')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xd8'));db[_0x52b8('0xd9')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xda'));db[_0x52b8('0xdb')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0xdc'));db['Setting']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xdd'));db[_0x52b8('0xde')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xdf'));db[_0x52b8('0xe0')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0xe1'));db[_0x52b8('0xe2')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xe3'));db['SquareMessage']=db[_0x52b8('0x0')]['import'](_0x52b8('0xe4'));db[_0x52b8('0xe5')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/team/team.model');db[_0x52b8('0xe6')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xe7'));db[_0x52b8('0xe8')]=db[_0x52b8('0x0')]['import'](_0x52b8('0xe9'));db[_0x52b8('0xea')]=db['sequelize']['import'](_0x52b8('0xeb'));db[_0x52b8('0xec')]=db[_0x52b8('0x0')]['import'](_0x52b8('0xed'));db[_0x52b8('0xee')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xef'));db[_0x52b8('0xf0')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xf1'));db[_0x52b8('0xf2')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xf3'));db[_0x52b8('0xf4')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xf5'));db[_0x52b8('0xf6')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x52b8('0xf7')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xf8'));db[_0x52b8('0xf9')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xfa'));db[_0x52b8('0xfb')]=db[_0x52b8('0x0')]['import'](_0x52b8('0xfc'));db[_0x52b8('0xfd')]=db['sequelize'][_0x52b8('0x12')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0xfe'));db[_0x52b8('0xff')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x100'));db[_0x52b8('0x101')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x102'));db['WhatsappAccount']=db[_0x52b8('0x0')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x52b8('0x103')]=db['sequelize']['import'](_0x52b8('0x104'));db[_0x52b8('0x105')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x106'));db[_0x52b8('0x107')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x108'));db[_0x52b8('0x109')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x10a'));db[_0x52b8('0x10b')]=db[_0x52b8('0x0')]['import'](_0x52b8('0x10c'));db[_0x52b8('0x10d')]=db['sequelize'][_0x52b8('0x12')](_0x52b8('0x10e'));db[_0x52b8('0x10f')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x110'));db[_0x52b8('0x111')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x112'));db['TeamVoicePrefix']=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x113'));db[_0x52b8('0x114')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x52b8('0x115')]=db[_0x52b8('0x0')][_0x52b8('0x12')](_0x52b8('0x116'));db[_0x52b8('0x117')]=db[_0x52b8('0x0')][_0x52b8('0x12')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db['User'][_0x52b8('0x118')](db[_0x52b8('0x119')],{'as':'VoiceMail','onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x11c')][_0x52b8('0x118')](db['UserSetting'],{'as':'userSetting','onDelete':'cascade','foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x11c')][_0x52b8('0x11d')](db[_0x52b8('0x1a')],{'as':_0x52b8('0x11e'),'foreignKey':_0x52b8('0x11b')});db['User']['hasMany'](db['UserVoiceQueueRt'],{'as':_0x52b8('0x11f'),'foreignKey':_0x52b8('0x11b')});db['User'][_0x52b8('0x11d')](db[_0x52b8('0x16')],{'as':_0x52b8('0x120'),'onDelete':_0x52b8('0x11a'),'hooks':!![]});db[_0x52b8('0x11c')]['hasMany'](db[_0x52b8('0x75')],{'as':_0x52b8('0x121'),'foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x11c')][_0x52b8('0x11d')](db[_0x52b8('0x77')],{'as':_0x52b8('0x122'),'foreignKey':'UserId'});db[_0x52b8('0x11c')][_0x52b8('0x11d')](db[_0x52b8('0x78')],{'as':_0x52b8('0x78'),'foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x11c')][_0x52b8('0x11d')](db[_0x52b8('0x5b')],{'as':_0x52b8('0x123'),'foreignKey':_0x52b8('0x11b')});db['User'][_0x52b8('0x11d')](db[_0x52b8('0x66')],{'as':_0x52b8('0x124'),'foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x11c')][_0x52b8('0x11d')](db[_0x52b8('0x55')],{'as':_0x52b8('0x125'),'foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x11c')][_0x52b8('0x11d')](db[_0x52b8('0x4b')],{'as':_0x52b8('0x126'),'foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x11c')][_0x52b8('0x11d')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x11c')][_0x52b8('0x11d')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x52b8('0x11c')][_0x52b8('0x11d')](db[_0x52b8('0x101')],{'as':_0x52b8('0x127'),'foreignKey':'SenderId'});db[_0x52b8('0x11c')]['hasMany'](db['CmHopper'],{'as':_0x52b8('0x128'),'foreignKey':_0x52b8('0x11b'),'onDelete':_0x52b8('0x129')});db[_0x52b8('0x11c')][_0x52b8('0x12a')](db[_0x52b8('0xfd')],{'as':_0x52b8('0xfd'),'foreignKey':_0x52b8('0x12b')});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db[_0x52b8('0x6d')],{'as':_0x52b8('0x12d'),'through':'chat_group_has_users'});db['User'][_0x52b8('0x12c')](db['CmContact'],{'as':_0x52b8('0x12e'),'through':_0x52b8('0x12f')});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db[_0x52b8('0xf9')],{'as':'Lists','through':'cm_user_has_lists'});db['User'][_0x52b8('0x12c')](db[_0x52b8('0xe5')],{'through':'user_has_teams'});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db['MailInteraction'],{'as':_0x52b8('0x130'),'through':_0x52b8('0x131')});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db['ChatInteraction'],{'as':_0x52b8('0x124'),'through':_0x52b8('0x132')});db['User'][_0x52b8('0x12c')](db[_0x52b8('0x4b')],{'as':_0x52b8('0x126'),'through':_0x52b8('0x133')});db[_0x52b8('0x11c')]['belongsToMany'](db['SmsInteraction'],{'as':_0x52b8('0x125'),'through':_0x52b8('0x134')});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db[_0x52b8('0x5b')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db[_0x52b8('0x105')],{'as':_0x52b8('0x135'),'through':_0x52b8('0x136')});db['User']['belongsToMany'](db[_0x52b8('0x19')],{'as':_0x52b8('0x137'),'through':_0x52b8('0x2a'),'required':![]});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db[_0x52b8('0xfb')],{'as':_0x52b8('0x138'),'through':_0x52b8('0x114'),'required':![]});db['User'][_0x52b8('0x12c')](db[_0x52b8('0x3c')],{'as':_0x52b8('0x139'),'through':'UserMailQueue','required':![]});db[_0x52b8('0x11c')]['belongsToMany'](db[_0x52b8('0x6b')],{'as':_0x52b8('0x13a'),'through':_0x52b8('0x2c'),'required':![],'hooks':!![]});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db[_0x52b8('0x13b')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db['SmsQueue'],{'as':_0x52b8('0x13c'),'through':_0x52b8('0x30'),'required':![]});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db[_0x52b8('0x5e')],{'as':_0x52b8('0x13d'),'through':_0x52b8('0x32'),'required':![]});db['User']['belongsToMany'](db[_0x52b8('0x10d')],{'as':'WhatsappQueues','through':_0x52b8('0x34'),'required':![]});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db[_0x52b8('0xf9')],{'through':_0x52b8('0x13e')});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db['ChatWebsite'],{'as':_0x52b8('0x13f'),'through':_0x52b8('0x140')});db[_0x52b8('0x11c')]['belongsToMany'](db[_0x52b8('0x47')],{'as':_0x52b8('0x141'),'through':_0x52b8('0x142')});db[_0x52b8('0x11c')]['belongsToMany'](db[_0x52b8('0x3a')],{'as':'MailAccounts','through':_0x52b8('0x143')});db[_0x52b8('0x11c')]['belongsToMany'](db[_0x52b8('0x144')],{'as':_0x52b8('0x145'),'through':_0x52b8('0x146')});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db[_0x52b8('0x51')],{'as':'SmsAccounts','through':_0x52b8('0x147')});db[_0x52b8('0x11c')][_0x52b8('0x12c')](db[_0x52b8('0x148')],{'as':'WhatsappAccounts','through':_0x52b8('0x149')});db[_0x52b8('0x14a')][_0x52b8('0x11d')](db[_0x52b8('0x16')],{'as':_0x52b8('0x14b'),'onDelete':_0x52b8('0x11a'),'foreignKey':'ChanSpyId'});db[_0x52b8('0x15')]['hasMany'](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x52b8('0x16')][_0x52b8('0x11d')](db[_0x52b8('0x16')],{'as':_0x52b8('0x14c'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x18')][_0x52b8('0x12c')](db[_0x52b8('0x8a')],{'as':_0x52b8('0x14d'),'through':_0x52b8('0x14e')});db[_0x52b8('0x19')]['hasMany'](db[_0x52b8('0x14f')],{'as':_0x52b8('0x150'),'foreignKey':_0x52b8('0x151')});db[_0x52b8('0x19')][_0x52b8('0x11d')](db[_0x52b8('0x152')],{'as':_0x52b8('0x128'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x52b8('0x11d')](db[_0x52b8('0x75')],{'as':'HopperFinals','foreignKey':_0x52b8('0x151')});db[_0x52b8('0x19')]['hasMany'](db[_0x52b8('0x77')],{'as':_0x52b8('0x153'),'foreignKey':_0x52b8('0x151')});db['VoiceQueue'][_0x52b8('0x11d')](db[_0x52b8('0x78')],{'as':'ReportAgentPreview','foreignKey':_0x52b8('0x151')});db[_0x52b8('0x19')][_0x52b8('0x11d')](db[_0x52b8('0x73')],{'as':_0x52b8('0x154'),'foreignKey':_0x52b8('0x151')});db[_0x52b8('0x19')][_0x52b8('0x11d')](db['JscriptySessionReport'],{'as':_0x52b8('0x155'),'foreignKey':_0x52b8('0x151')});db[_0x52b8('0x19')]['belongsTo'](db['Trunk'],{'as':_0x52b8('0x26'),'foreignKey':_0x52b8('0x156')});db[_0x52b8('0x19')]['belongsTo'](db[_0x52b8('0x26')],{'as':_0x52b8('0x157'),'foreignKey':'TrunkBackupId'});db[_0x52b8('0x19')][_0x52b8('0x12a')](db[_0x52b8('0x82')],{'as':_0x52b8('0x82'),'foreignKey':_0x52b8('0x158')});db['VoiceQueue']['belongsTo'](db[_0x52b8('0x159')],{'as':_0x52b8('0x15a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x52b8('0x19')][_0x52b8('0x12c')](db[_0x52b8('0xf9')],{'as':'Lists','through':_0x52b8('0x15b')});db['VoiceQueue'][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x15c'),'through':'UserVoiceQueue'});db[_0x52b8('0x19')]['belongsToMany'](db[_0x52b8('0xe5')],{'as':_0x52b8('0x15d'),'through':'TeamVoiceQueue'});db[_0x52b8('0x19')]['belongsToMany'](db[_0x52b8('0xf9')],{'as':_0x52b8('0x15e'),'through':_0x52b8('0x15f')});db[_0x52b8('0x1a')][_0x52b8('0x12a')](db['User'],{'as':_0x52b8('0x11c'),'foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x1b')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x11c'),'foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x119')][_0x52b8('0x11d')](db[_0x52b8('0x1d')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x52b8('0x160'),'sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0x52b8('0x160'),'targetKey':'mailbox'});db[_0x52b8('0x161')][_0x52b8('0x11d')](db[_0x52b8('0x162')],{'as':_0x52b8('0x163'),'foreignKey':_0x52b8('0x164'),'constraints':![]});db[_0x52b8('0x161')][_0x52b8('0x11d')](db['VoiceAgentReport'],{'as':_0x52b8('0x165'),'foreignKey':_0x52b8('0x164'),'constraints':![]});db[_0x52b8('0x161')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x11c'),'foreignKey':'UserId'});db[_0x52b8('0x161')][_0x52b8('0x12a')](db['CmContact'],{'as':'Contact','foreignKey':_0x52b8('0x166')});db[_0x52b8('0x36')][_0x52b8('0x12a')](db['MailAccount'],{'as':_0x52b8('0x3a'),'foreignKey':_0x52b8('0x167')});db['MailServerIn'][_0x52b8('0x12a')](db[_0x52b8('0x10f')],{'as':_0x52b8('0x10f'),'foreignKey':_0x52b8('0x168'),'onDelete':'restrict'});db[_0x52b8('0x38')][_0x52b8('0x12a')](db[_0x52b8('0x3a')],{'as':_0x52b8('0x3a'),'foreignKey':_0x52b8('0x167')});db['MailServerOut']['belongsTo'](db[_0x52b8('0x10f')],{'as':'CloudProvider','foreignKey':_0x52b8('0x168'),'onDelete':_0x52b8('0x169')});db[_0x52b8('0x3a')][_0x52b8('0x118')](db[_0x52b8('0x36')],{'as':_0x52b8('0x16a'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x3a')][_0x52b8('0x118')](db[_0x52b8('0x38')],{'as':_0x52b8('0x16b'),'onDelete':_0x52b8('0x11a')});db['MailAccount'][_0x52b8('0x11d')](db['Disposition'],{'as':_0x52b8('0x16c'),'foreignKey':_0x52b8('0x167'),'onDelete':'cascade'});db[_0x52b8('0x3a')][_0x52b8('0x11d')](db[_0x52b8('0x7e')],{'as':_0x52b8('0x16d'),'foreignKey':_0x52b8('0x167')});db[_0x52b8('0x3a')][_0x52b8('0x11d')](db[_0x52b8('0x40')],{'as':_0x52b8('0x16e'),'foreignKey':_0x52b8('0x167')});db[_0x52b8('0x3a')][_0x52b8('0x11d')](db[_0x52b8('0x16f')],{'as':'Interactions'});db['MailAccount'][_0x52b8('0x11d')](db[_0x52b8('0x42')],{'as':_0x52b8('0x14c'),'foreignKey':_0x52b8('0x167'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x3a')][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':_0x52b8('0x170'),'foreignKey':'ListId'});db[_0x52b8('0x3a')][_0x52b8('0x12a')](db[_0x52b8('0x92')],{'as':'Template','foreignKey':'TemplateId'});db[_0x52b8('0x3a')][_0x52b8('0x12a')](db[_0x52b8('0x159')],{'as':_0x52b8('0x15a'),'foreignKey':_0x52b8('0x171')});db[_0x52b8('0x3a')]['belongsToMany'](db[_0x52b8('0x11c')],{'as':_0x52b8('0x15c'),'through':_0x52b8('0x143')});db[_0x52b8('0x3c')]['belongsToMany'](db[_0x52b8('0x11c')],{'as':'Agents','through':_0x52b8('0x2d')});db[_0x52b8('0x3c')][_0x52b8('0x12c')](db[_0x52b8('0xe5')],{'through':'team_has_mail_queues','as':_0x52b8('0x15d')});db[_0x52b8('0x16f')][_0x52b8('0x11d')](db[_0x52b8('0x40')],{'as':'Messages','onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x172')});db['MailInteraction'][_0x52b8('0x12a')](db[_0x52b8('0x3a')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x52b8('0x16f')]['belongsTo'](db[_0x52b8('0x173')],{'as':_0x52b8('0x174'),'foreignKey':_0x52b8('0x166')});db[_0x52b8('0x16f')][_0x52b8('0x12a')](db['User'],{'as':_0x52b8('0x175'),'foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x16f')]['belongsToMany'](db[_0x52b8('0x8c')],{'through':_0x52b8('0x176'),'as':_0x52b8('0x177')});db['MailInteraction'][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':'mail_interaction_has_tags','as':_0x52b8('0x178')});db[_0x52b8('0x16f')][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x179'),'through':_0x52b8('0x131'),'foreignKey':_0x52b8('0x172')});db['MailMessage'][_0x52b8('0x11d')](db[_0x52b8('0xec')],{'as':_0x52b8('0x17a'),'onDelete':_0x52b8('0x11a')});db['MailMessage']['belongsTo'](db[_0x52b8('0x11c')],{'as':_0x52b8('0x11c')});db[_0x52b8('0x40')]['belongsTo'](db[_0x52b8('0x173')],{'onDelete':'cascade','as':_0x52b8('0x174')});db[_0x52b8('0x40')][_0x52b8('0x12a')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x52b8('0x172')});db[_0x52b8('0x40')][_0x52b8('0x12a')](db[_0x52b8('0x3a')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x167')});db[_0x52b8('0x40')][_0x52b8('0x12a')](db[_0x52b8('0x60')],{'as':_0x52b8('0x60'),'foreignKey':_0x52b8('0x17c')});db[_0x52b8('0x40')]['belongsTo'](db[_0x52b8('0x17d')],{'as':_0x52b8('0x17d'),'foreignKey':_0x52b8('0x17e')});db[_0x52b8('0x42')][_0x52b8('0x12a')](db['User'],{'onDelete':_0x52b8('0x169')});db[_0x52b8('0x42')][_0x52b8('0x12a')](db[_0x52b8('0x3c')],{'onDelete':_0x52b8('0x169')});db[_0x52b8('0x42')]['belongsTo'](db['MailAccount'],{'onDelete':_0x52b8('0x169')});db[_0x52b8('0x42')]['belongsTo'](db[_0x52b8('0x82')],{'onDelete':_0x52b8('0x169'),'foreignKey':_0x52b8('0x158')});db[_0x52b8('0x42')]['belongsTo'](db[_0x52b8('0x8c')],{'onDelete':_0x52b8('0x169'),'foreignKey':_0x52b8('0x17f')});db['MailQueueReport'][_0x52b8('0x12a')](db[_0x52b8('0x3a')],{});db[_0x52b8('0x44')][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':_0x52b8('0x170'),'foreignKey':_0x52b8('0x180')});db[_0x52b8('0x44')]['belongsTo'](db[_0x52b8('0x173')],{'as':_0x52b8('0x174'),'foreignKey':'ContactId'});db[_0x52b8('0x44')][_0x52b8('0x12a')](db['MailInteraction'],{});db['MailQueueReport'][_0x52b8('0x12a')](db[_0x52b8('0x40')],{});db[_0x52b8('0x44')]['belongsTo'](db['User'],{});db['MailQueueReport'][_0x52b8('0x12a')](db[_0x52b8('0x3c')],{});db[_0x52b8('0x181')]['hasMany'](db[_0x52b8('0x45')],{'as':_0x52b8('0x182'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x47')]['hasMany'](db[_0x52b8('0x80')],{'as':_0x52b8('0x16c'),'foreignKey':_0x52b8('0x183'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x47')]['hasMany'](db[_0x52b8('0x7e')],{'as':'Answers','foreignKey':_0x52b8('0x183')});db[_0x52b8('0x47')][_0x52b8('0x11d')](db['FaxInteraction'],{'as':'Interactions'});db[_0x52b8('0x47')]['hasMany'](db['FaxApplication'],{'as':_0x52b8('0x14c'),'foreignKey':'FaxAccountId','onDelete':_0x52b8('0x11a')});db[_0x52b8('0x47')][_0x52b8('0x11d')](db[_0x52b8('0x16')],{'as':_0x52b8('0x184'),'onDelete':_0x52b8('0x11a')});db['FaxAccount'][_0x52b8('0x11d')](db['FaxMessage'],{'as':_0x52b8('0x16e')});db['FaxAccount'][_0x52b8('0x12a')](db[_0x52b8('0x26')],{'as':_0x52b8('0x26')});db[_0x52b8('0x47')][_0x52b8('0x12a')](db['CmList'],{'as':_0x52b8('0x170'),'foreignKey':_0x52b8('0x180')});db[_0x52b8('0x47')][_0x52b8('0x12a')](db[_0x52b8('0x159')],{'as':_0x52b8('0x15a'),'foreignKey':_0x52b8('0x171')});db['FaxAccount'][_0x52b8('0x12c')](db['User'],{'as':_0x52b8('0x15c'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0x52b8('0x12a')](db['User'],{'onDelete':'restrict'});db[_0x52b8('0x49')][_0x52b8('0x12a')](db[_0x52b8('0x13b')],{'onDelete':_0x52b8('0x169')});db['FaxApplication']['belongsTo'](db['FaxAccount'],{'onDelete':_0x52b8('0x169')});db[_0x52b8('0x49')][_0x52b8('0x12a')](db[_0x52b8('0x8c')],{'onDelete':_0x52b8('0x169'),'foreignKey':_0x52b8('0x17f')});db[_0x52b8('0x4b')][_0x52b8('0x11d')](db[_0x52b8('0x4c')],{'as':_0x52b8('0x16e'),'onDelete':_0x52b8('0x11a'),'foreignKey':'FaxInteractionId'});db[_0x52b8('0x4b')][_0x52b8('0x12a')](db[_0x52b8('0x47')],{'as':_0x52b8('0x17b'),'foreignKey':'FaxAccountId'});db[_0x52b8('0x4b')]['belongsTo'](db[_0x52b8('0x173')],{'as':_0x52b8('0x174'),'foreignKey':_0x52b8('0x166')});db['FaxInteraction'][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x175'),'foreignKey':_0x52b8('0x11b')});db['FaxInteraction'][_0x52b8('0x12c')](db['Tag'],{'through':_0x52b8('0x185'),'as':_0x52b8('0x177')});db[_0x52b8('0x4b')][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':_0x52b8('0x185'),'as':_0x52b8('0x178')});db[_0x52b8('0x4b')][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x179'),'through':_0x52b8('0x133'),'foreignKey':_0x52b8('0x186')});db[_0x52b8('0x4c')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0x52b8('0x11c')});db[_0x52b8('0x4c')]['belongsTo'](db[_0x52b8('0x4b')],{'as':_0x52b8('0x187'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x52b8('0x12a')](db['CmContact'],{'onDelete':_0x52b8('0x11a'),'as':_0x52b8('0x174')});db[_0x52b8('0x4c')]['belongsTo'](db[_0x52b8('0xec')],{'as':_0x52b8('0xec'),'foreignKey':_0x52b8('0x188')});db['FaxMessage']['belongsTo'](db['FaxAccount'],{'as':_0x52b8('0x17b'),'foreignKey':'FaxAccountId'});db['FaxQueue']['belongsToMany'](db['User'],{'as':_0x52b8('0x15c'),'through':_0x52b8('0x2e')});db[_0x52b8('0x13b')][_0x52b8('0x12c')](db[_0x52b8('0xe5')],{'through':_0x52b8('0x189'),'as':_0x52b8('0x15d')});db[_0x52b8('0x4f')][_0x52b8('0x12a')](db[_0x52b8('0x47')],{});db[_0x52b8('0x4f')][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':_0x52b8('0x170'),'foreignKey':_0x52b8('0x180')});db[_0x52b8('0x4f')][_0x52b8('0x12a')](db[_0x52b8('0x173')],{'as':_0x52b8('0x174'),'foreignKey':_0x52b8('0x166')});db[_0x52b8('0x4f')][_0x52b8('0x12a')](db[_0x52b8('0x4b')],{});db[_0x52b8('0x4f')][_0x52b8('0x12a')](db[_0x52b8('0x4c')],{});db['FaxQueueReport'][_0x52b8('0x12a')](db['User'],{});db['FaxQueueReport'][_0x52b8('0x12a')](db[_0x52b8('0x13b')],{});db[_0x52b8('0x51')][_0x52b8('0x11d')](db[_0x52b8('0x80')],{'as':'Dispositions','foreignKey':_0x52b8('0x18a'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x51')][_0x52b8('0x11d')](db[_0x52b8('0x7e')],{'as':_0x52b8('0x16d'),'foreignKey':_0x52b8('0x18a')});db[_0x52b8('0x51')][_0x52b8('0x11d')](db['SmsMessage'],{'as':_0x52b8('0x16e'),'foreignKey':_0x52b8('0x18a')});db[_0x52b8('0x51')][_0x52b8('0x11d')](db[_0x52b8('0x55')],{'as':_0x52b8('0x18b')});db[_0x52b8('0x51')][_0x52b8('0x11d')](db[_0x52b8('0x53')],{'as':_0x52b8('0x14c'),'foreignKey':_0x52b8('0x18a'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x51')][_0x52b8('0x12a')](db['CmList'],{'as':_0x52b8('0x170'),'foreignKey':_0x52b8('0x180')});db[_0x52b8('0x51')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x52b8('0x171')});db[_0x52b8('0x51')][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x15c'),'through':_0x52b8('0x147')});db[_0x52b8('0x53')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'onDelete':'restrict'});db[_0x52b8('0x53')][_0x52b8('0x12a')](db['SmsQueue'],{'onDelete':_0x52b8('0x169')});db[_0x52b8('0x53')][_0x52b8('0x12a')](db[_0x52b8('0x51')],{'onDelete':_0x52b8('0x169')});db[_0x52b8('0x53')][_0x52b8('0x12a')](db[_0x52b8('0x82')],{'onDelete':_0x52b8('0x169'),'foreignKey':_0x52b8('0x158')});db[_0x52b8('0x53')]['belongsTo'](db[_0x52b8('0x8c')],{'onDelete':_0x52b8('0x169'),'foreignKey':'TagId'});db[_0x52b8('0x55')][_0x52b8('0x11d')](db[_0x52b8('0x57')],{'as':'Messages','onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x18c')});db[_0x52b8('0x55')]['belongsTo'](db[_0x52b8('0x51')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x18a')});db['SmsInteraction']['belongsTo'](db[_0x52b8('0x173')],{'as':_0x52b8('0x174'),'foreignKey':_0x52b8('0x166')});db[_0x52b8('0x55')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x175'),'foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x55')][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':_0x52b8('0x18d'),'as':_0x52b8('0x177')});db[_0x52b8('0x55')]['belongsToMany'](db[_0x52b8('0x8c')],{'through':_0x52b8('0x18d'),'as':_0x52b8('0x178')});db[_0x52b8('0x55')][_0x52b8('0x12c')](db['User'],{'as':_0x52b8('0x179'),'through':_0x52b8('0x134'),'foreignKey':_0x52b8('0x18c')});db[_0x52b8('0x57')][_0x52b8('0x12a')](db['User'],{'as':_0x52b8('0x11c')});db[_0x52b8('0x57')]['belongsTo'](db[_0x52b8('0x173')],{'onDelete':_0x52b8('0x11a'),'as':_0x52b8('0x174')});db['SmsMessage'][_0x52b8('0x12a')](db[_0x52b8('0x55')],{'onDelete':_0x52b8('0x11a'),'as':_0x52b8('0x187'),'foreignKey':_0x52b8('0x18c')});db[_0x52b8('0x57')][_0x52b8('0x12a')](db[_0x52b8('0x51')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x18a')});db[_0x52b8('0x18e')][_0x52b8('0x12c')](db['User'],{'as':_0x52b8('0x15c'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x52b8('0x18e')][_0x52b8('0x12c')](db['Team'],{'through':_0x52b8('0x18f'),'as':_0x52b8('0x15d')});db[_0x52b8('0x144')][_0x52b8('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x52b8('0x190'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x144')]['hasMany'](db[_0x52b8('0x7e')],{'as':_0x52b8('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0x52b8('0x144')]['hasMany'](db[_0x52b8('0x5b')],{'as':_0x52b8('0x18b'),'foreignKey':'OpenchannelAccountId'});db[_0x52b8('0x144')][_0x52b8('0x11d')](db[_0x52b8('0x191')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x52b8('0x144')][_0x52b8('0x11d')](db[_0x52b8('0x5a')],{'as':_0x52b8('0x14c'),'foreignKey':_0x52b8('0x190'),'onDelete':'cascade'});db[_0x52b8('0x144')][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':_0x52b8('0x170'),'foreignKey':'ListId'});db[_0x52b8('0x144')][_0x52b8('0x12a')](db[_0x52b8('0x159')],{'as':_0x52b8('0x15a'),'foreignKey':_0x52b8('0x171')});db[_0x52b8('0x144')][_0x52b8('0x12c')](db['User'],{'as':_0x52b8('0x15c'),'through':_0x52b8('0x146')});db['OpenchannelApplication'][_0x52b8('0x12a')](db['User'],{'onDelete':_0x52b8('0x169')});db[_0x52b8('0x5a')][_0x52b8('0x12a')](db[_0x52b8('0x5e')],{'onDelete':'restrict','foreignKey':_0x52b8('0x192')});db['OpenchannelApplication'][_0x52b8('0x12a')](db[_0x52b8('0x144')],{'onDelete':_0x52b8('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0x52b8('0x5a')]['belongsTo'](db['Interval'],{'onDelete':_0x52b8('0x169'),'foreignKey':'IntervalId'});db[_0x52b8('0x5a')][_0x52b8('0x12a')](db[_0x52b8('0x8c')],{'onDelete':_0x52b8('0x169'),'foreignKey':'TagId'});db[_0x52b8('0x5b')]['hasMany'](db[_0x52b8('0x191')],{'as':_0x52b8('0x16e'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x193')});db[_0x52b8('0x5b')][_0x52b8('0x12a')](db[_0x52b8('0x144')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x190')});db['OpenchannelInteraction']['belongsTo'](db['CmContact'],{'as':_0x52b8('0x174'),'foreignKey':'ContactId'});db[_0x52b8('0x5b')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x5b')][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':_0x52b8('0x194'),'as':_0x52b8('0x177')});db[_0x52b8('0x5b')][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':_0x52b8('0x194'),'as':_0x52b8('0x178')});db[_0x52b8('0x5b')][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x179'),'through':'user_has_openchannel_interactions','foreignKey':_0x52b8('0x193')});db['OpenchannelMessage'][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'onDelete':_0x52b8('0x11a'),'as':_0x52b8('0x11c')});db[_0x52b8('0x191')][_0x52b8('0x12a')](db[_0x52b8('0x173')],{'onDelete':_0x52b8('0x11a'),'as':_0x52b8('0x174')});db[_0x52b8('0x191')][_0x52b8('0x12a')](db[_0x52b8('0x5b')],{'onDelete':_0x52b8('0x11a'),'as':'Interaction','foreignKey':_0x52b8('0x193')});db['OpenchannelMessage'][_0x52b8('0x12a')](db['Attachment'],{'as':'Attachment','foreignKey':_0x52b8('0x188')});db['OpenchannelMessage'][_0x52b8('0x12a')](db[_0x52b8('0x144')],{'as':'Account','foreignKey':_0x52b8('0x190')});db[_0x52b8('0x5e')][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':'Agents','through':_0x52b8('0x32'),'foreignKey':_0x52b8('0x192')});db['OpenchannelQueue'][_0x52b8('0x12c')](db[_0x52b8('0xe5')],{'through':_0x52b8('0x195'),'as':_0x52b8('0x15d')});db[_0x52b8('0x60')]['hasMany'](db[_0x52b8('0x80')],{'as':_0x52b8('0x16c'),'foreignKey':_0x52b8('0x17c'),'onDelete':'cascade'});db[_0x52b8('0x60')][_0x52b8('0x11d')](db[_0x52b8('0x7e')],{'as':_0x52b8('0x16d'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x52b8('0x11d')](db['ChatProactiveAction'],{'as':_0x52b8('0x196')});db[_0x52b8('0x60')]['hasMany'](db[_0x52b8('0x66')],{'as':_0x52b8('0x18b')});db[_0x52b8('0x60')][_0x52b8('0x11d')](db['ChatApplication'],{'as':_0x52b8('0x14c'),'foreignKey':_0x52b8('0x17c'),'onDelete':_0x52b8('0x11a')});db['ChatWebsite'][_0x52b8('0x11d')](db[_0x52b8('0x68')],{'as':'Messages'});db[_0x52b8('0x60')][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':_0x52b8('0x170'),'foreignKey':_0x52b8('0x180')});db[_0x52b8('0x60')]['belongsTo'](db[_0x52b8('0x82')],{'as':_0x52b8('0x82'),'foreignKey':_0x52b8('0x158')});db[_0x52b8('0x60')][_0x52b8('0x12a')](db[_0x52b8('0x3a')],{'as':'MailAccount','foreignKey':_0x52b8('0x167')});db[_0x52b8('0x60')][_0x52b8('0x12a')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x52b8('0x60')][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x15c'),'through':_0x52b8('0x140')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x52b8('0x62')][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':'List','foreignKey':_0x52b8('0x180')});db[_0x52b8('0x62')][_0x52b8('0x12a')](db[_0x52b8('0x173')],{'as':_0x52b8('0x174'),'foreignKey':'ContactId'});db[_0x52b8('0x62')][_0x52b8('0x12a')](db[_0x52b8('0x5b')],{});db[_0x52b8('0x62')]['belongsTo'](db[_0x52b8('0x191')],{});db['OpenchannelQueueReport'][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{});db[_0x52b8('0x62')][_0x52b8('0x12a')](db[_0x52b8('0x5e')],{});db[_0x52b8('0x64')]['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0x52b8('0x11b'),'onDelete':_0x52b8('0x169')});db['ChatApplication'][_0x52b8('0x12a')](db[_0x52b8('0x6b')],{'as':_0x52b8('0x197'),'foreignKey':_0x52b8('0x198'),'onDelete':'restrict'});db['ChatApplication'][_0x52b8('0x12a')](db[_0x52b8('0x60')],{'as':'Website','foreignKey':_0x52b8('0x17c'),'onDelete':_0x52b8('0x169')});db[_0x52b8('0x64')][_0x52b8('0x12a')](db[_0x52b8('0x8c')],{'onDelete':'restrict','foreignKey':_0x52b8('0x17f')});db['ChatInteraction'][_0x52b8('0x11d')](db[_0x52b8('0x68')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x52b8('0x199')});db[_0x52b8('0x66')][_0x52b8('0x12a')](db[_0x52b8('0x60')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x17c')});db[_0x52b8('0x66')][_0x52b8('0x12a')](db[_0x52b8('0x173')],{'as':'Contact','foreignKey':_0x52b8('0x166')});db[_0x52b8('0x66')]['belongsTo'](db[_0x52b8('0x11c')],{'as':'Owner','foreignKey':_0x52b8('0x11b')});db[_0x52b8('0x66')][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':'chat_interaction_has_tags','as':_0x52b8('0x177')});db[_0x52b8('0x66')][_0x52b8('0x12c')](db['Tag'],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db['ChatInteraction']['belongsToMany'](db['User'],{'as':_0x52b8('0x179'),'through':_0x52b8('0x132'),'foreignKey':_0x52b8('0x199')});db[_0x52b8('0x68')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'onDelete':_0x52b8('0x11a'),'as':'User'});db[_0x52b8('0x68')][_0x52b8('0x12a')](db['CmContact'],{'onDelete':_0x52b8('0x11a'),'as':_0x52b8('0x174'),'foreignKey':_0x52b8('0x166')});db[_0x52b8('0x68')][_0x52b8('0x12a')](db[_0x52b8('0x66')],{'onDelete':'cascade','as':_0x52b8('0x187'),'foreignKey':_0x52b8('0x199')});db[_0x52b8('0x68')][_0x52b8('0x12a')](db['Attachment'],{'as':'Attachment','foreignKey':_0x52b8('0x188')});db['ChatMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x17c')});db[_0x52b8('0x17d')][_0x52b8('0x11d')](db['Attachment'],{'as':_0x52b8('0x17a'),'foreignKey':_0x52b8('0x17e'),'onDelete':_0x52b8('0x11a'),'hooks':!![]});db[_0x52b8('0x17d')][_0x52b8('0x12a')](db['CmContact'],{'onDelete':'cascade','as':_0x52b8('0x174'),'foreignKey':_0x52b8('0x166')});db[_0x52b8('0x17d')]['belongsTo'](db[_0x52b8('0x60')],{'as':'Account','foreignKey':_0x52b8('0x17c')});db[_0x52b8('0x6b')][_0x52b8('0x12c')](db['User'],{'as':_0x52b8('0x15c'),'through':_0x52b8('0x2c'),'hooks':!![]});db[_0x52b8('0x6b')][_0x52b8('0x12c')](db[_0x52b8('0xe5')],{'through':_0x52b8('0x19a'),'as':_0x52b8('0x15d')});db[_0x52b8('0x6d')][_0x52b8('0x11d')](db['ChatInternalMessage'],{'as':_0x52b8('0x16e'),'foreignKey':_0x52b8('0x19b'),'onDelete':'cascade'});db[_0x52b8('0x6d')][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':'Members','through':_0x52b8('0x19c')});db['ChatProactiveAction'][_0x52b8('0x12a')](db['ChatWebsite'],{'as':_0x52b8('0x19d'),'foreignKey':_0x52b8('0x17c')});db['CmCompany'][_0x52b8('0x11d')](db[_0x52b8('0x173')],{'as':_0x52b8('0x12e'),'foreignKey':_0x52b8('0x19e')});db['CmContact'][_0x52b8('0x11d')](db[_0x52b8('0x8e')],{'as':_0x52b8('0x19f'),'foreignKey':_0x52b8('0x1a0')});db['CmContact'][_0x52b8('0x11d')](db['CmHopper'],{'as':_0x52b8('0x128'),'foreignKey':_0x52b8('0x166')});db['CmContact'][_0x52b8('0x11d')](db[_0x52b8('0x75')],{'as':_0x52b8('0x121'),'foreignKey':_0x52b8('0x166')});db[_0x52b8('0x173')][_0x52b8('0x11d')](db[_0x52b8('0x77')],{'as':_0x52b8('0x153'),'foreignKey':_0x52b8('0x166')});db[_0x52b8('0x173')][_0x52b8('0x11d')](db[_0x52b8('0x78')],{'as':_0x52b8('0x78'),'foreignKey':_0x52b8('0x166')});db[_0x52b8('0x173')]['hasMany'](db['JscriptySessionReport'],{'as':_0x52b8('0x155'),'foreignKey':_0x52b8('0x166')});db[_0x52b8('0x173')][_0x52b8('0x11d')](db[_0x52b8('0x5b')],{'as':_0x52b8('0x123'),'foreignKey':_0x52b8('0x166'),'onDelete':'restrict'});db[_0x52b8('0x173')][_0x52b8('0x11d')](db[_0x52b8('0x66')],{'as':'ChatInteractions','foreignKey':_0x52b8('0x166'),'onDelete':_0x52b8('0x169')});db[_0x52b8('0x173')]['hasMany'](db[_0x52b8('0x55')],{'as':'SmsInteractions','foreignKey':_0x52b8('0x166'),'onDelete':_0x52b8('0x169')});db[_0x52b8('0x173')][_0x52b8('0x11d')](db[_0x52b8('0x4b')],{'as':_0x52b8('0x126'),'foreignKey':'ContactId','onDelete':_0x52b8('0x169')});db[_0x52b8('0x173')]['hasMany'](db[_0x52b8('0x16f')],{'as':_0x52b8('0x130'),'foreignKey':_0x52b8('0x166'),'onDelete':_0x52b8('0x169')});db[_0x52b8('0x173')]['belongsTo'](db[_0x52b8('0x1a1')],{'as':_0x52b8('0x1a2'),'foreignKey':_0x52b8('0x19e')});db[_0x52b8('0x173')][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':_0x52b8('0x170'),'foreignKey':_0x52b8('0x180'),'onDelete':'cascade'});db[_0x52b8('0x173')][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':'Users','through':_0x52b8('0x12f')});db[_0x52b8('0x173')][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'as':_0x52b8('0x177'),'through':_0x52b8('0x1a3')});db['CmContact']['belongsToMany'](db[_0x52b8('0x8c')],{'through':'cm_contact_has_tags','as':_0x52b8('0x178')});db['CmHopper']['hasMany'](db[_0x52b8('0x90')],{'as':_0x52b8('0x1a4'),'foreignKey':_0x52b8('0x1a5')});db[_0x52b8('0x152')]['belongsTo'](db[_0x52b8('0x173')],{'as':_0x52b8('0x174'),'foreignKey':_0x52b8('0x166'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x152')][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':_0x52b8('0x170'),'foreignKey':'ListId','onDelete':_0x52b8('0x11a')});db[_0x52b8('0x152')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x1a6'),'foreignKey':'UserId'});db[_0x52b8('0x152')][_0x52b8('0x12a')](db[_0x52b8('0x19')],{'as':'Queue','foreignKey':_0x52b8('0x151'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x152')][_0x52b8('0x12a')](db['Campaign'],{'as':'Campaign','foreignKey':_0x52b8('0x1a7'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x152')][_0x52b8('0x12a')](db['User'],{'as':_0x52b8('0x175'),'foreignKey':_0x52b8('0x1a8')});db[_0x52b8('0x73')][_0x52b8('0x12a')](db[_0x52b8('0x173')],{'as':'Contact','foreignKey':_0x52b8('0x166'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x73')][_0x52b8('0x12a')](db['CmList'],{'as':_0x52b8('0x170'),'foreignKey':_0x52b8('0x180'),'onDelete':_0x52b8('0x11a')});db['CmHopperBlack'][_0x52b8('0x12a')](db[_0x52b8('0x19')],{'as':'Queue','foreignKey':_0x52b8('0x151'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x73')][_0x52b8('0x12a')](db[_0x52b8('0xe8')],{'as':_0x52b8('0xe8'),'foreignKey':_0x52b8('0x1a7'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x7c')][_0x52b8('0x11d')](db[_0x52b8('0x81')],{'as':{'plural':_0x52b8('0x1a9'),'singular':_0x52b8('0x1aa')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x52b8('0x7c')][_0x52b8('0x11d')](db[_0x52b8('0x81')],{'as':{'plural':_0x52b8('0x1ab'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x52b8('0x11a'),'hooks':!![]});db['Automation'][_0x52b8('0x11d')](db[_0x52b8('0x1ac')],{'as':'Actions','foreignKey':_0x52b8('0x1ad'),'onDelete':_0x52b8('0x11a'),'hooks':!![]});db[_0x52b8('0x80')][_0x52b8('0x11d')](db['Disposition'],{'as':_0x52b8('0x16c'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0x52b8('0x82')]['hasMany'](db[_0x52b8('0x82')],{'as':_0x52b8('0x1ae'),'foreignKey':_0x52b8('0x158'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0x52b8('0x120'),'foreignKey':_0x52b8('0x158'),'onDelete':_0x52b8('0x169')});db[_0x52b8('0x82')][_0x52b8('0x11d')](db[_0x52b8('0x42')],{'as':_0x52b8('0x1af'),'foreignKey':_0x52b8('0x158')});db[_0x52b8('0x82')][_0x52b8('0x11d')](db['ChatApplication'],{'as':_0x52b8('0x1b0'),'foreignKey':_0x52b8('0x158')});db['Interval'][_0x52b8('0x11d')](db[_0x52b8('0x49')],{'as':'FaxApplications','foreignKey':_0x52b8('0x158')});db[_0x52b8('0x82')][_0x52b8('0x11d')](db[_0x52b8('0x53')],{'as':_0x52b8('0x1b1'),'foreignKey':_0x52b8('0x158')});db[_0x52b8('0x88')][_0x52b8('0x12a')](db[_0x52b8('0x3a')],{});db[_0x52b8('0x88')][_0x52b8('0x12a')](db[_0x52b8('0x9a')],{'foreignKey':_0x52b8('0x1b2')});db[_0x52b8('0x88')]['belongsTo'](db[_0x52b8('0x99')],{'foreignKey':_0x52b8('0x1b3')});db[_0x52b8('0x8a')][_0x52b8('0x12c')](db[_0x52b8('0x18')],{'as':_0x52b8('0x1b4'),'through':_0x52b8('0x14e'),'onDelete':_0x52b8('0x169')});db[_0x52b8('0x8c')][_0x52b8('0x12c')](db[_0x52b8('0x173')],{'through':_0x52b8('0x1a3')});db[_0x52b8('0x8c')]['belongsToMany'](db['ChatInteraction'],{'through':_0x52b8('0x1b5')});db['Tag'][_0x52b8('0x12c')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x52b8('0x55')],{'through':_0x52b8('0x18d')});db[_0x52b8('0x8c')][_0x52b8('0x12c')](db[_0x52b8('0x4b')],{'through':_0x52b8('0x185')});db[_0x52b8('0x8c')][_0x52b8('0x12c')](db[_0x52b8('0x5b')],{'through':'openchannel_interaction_has_tags'});db[_0x52b8('0x8c')]['belongsToMany'](db[_0x52b8('0x105')],{'through':'whatsapp_interaction_has_tags'});db[_0x52b8('0x8e')][_0x52b8('0x12a')](db[_0x52b8('0x1b6')],{'as':_0x52b8('0x1b7'),'foreignKey':_0x52b8('0x1b8')});db['CmHopperAdditionalPhone'][_0x52b8('0x12a')](db[_0x52b8('0x152')],{'as':_0x52b8('0x1b9'),'foreignKey':'CmHopperId'});db[_0x52b8('0x8e')][_0x52b8('0x12a')](db['CmContact'],{'as':_0x52b8('0x174'),'foreignKey':'CmContactId'});db[_0x52b8('0x94')][_0x52b8('0x11d')](db[_0x52b8('0x81')],{'as':{'plural':'AllConditions','singular':_0x52b8('0x1ba')},'foreignKey':_0x52b8('0x1bb'),'onDelete':_0x52b8('0x11a'),'hooks':!![]});db[_0x52b8('0x94')][_0x52b8('0x11d')](db[_0x52b8('0x81')],{'as':{'plural':_0x52b8('0x1bc'),'singular':_0x52b8('0x1bd')},'foreignKey':_0x52b8('0x1be'),'onDelete':_0x52b8('0x11a'),'hooks':!![]});db[_0x52b8('0x94')]['hasMany'](db['Action'],{'as':_0x52b8('0x1bf'),'foreignKey':_0x52b8('0x1c0'),'onDelete':'cascade','hooks':!![]});db[_0x52b8('0x99')][_0x52b8('0x11d')](db[_0x52b8('0x1c1')],{'as':_0x52b8('0x1c2'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x52b8('0x9a')][_0x52b8('0x11d')](db['AnalyticFieldReport'],{'as':_0x52b8('0x1c2'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1b2')});db[_0x52b8('0x9e')][_0x52b8('0x11d')](db[_0x52b8('0x1c1')],{'as':'Fields','onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c3')});db[_0x52b8('0x1c1')]['belongsTo'](db[_0x52b8('0x9e')],{'foreignKey':'MetricId'});db[_0x52b8('0xa2')][_0x52b8('0x11d')](db[_0x52b8('0xa3')],{'as':_0x52b8('0x1c4'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0xa3')][_0x52b8('0x11d')](db[_0x52b8('0xa5')],{'as':_0x52b8('0x1c6'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0xa3')][_0x52b8('0x11d')](db['SalesforceField'],{'as':_0x52b8('0x1c8'),'onDelete':_0x52b8('0x11a'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0x52b8('0x11d')](db[_0x52b8('0xa5')],{'as':'Fields','onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0xa3')][_0x52b8('0x12a')](db[_0x52b8('0xa2')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x1c5')});db['SalesforceField']['hasMany'](db[_0x52b8('0xa5')],{'as':_0x52b8('0x1ca'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0xa5')][_0x52b8('0x11d')](db[_0x52b8('0xa5')],{'as':_0x52b8('0x1cb'),'foreignKey':'DescriptionId'});db[_0x52b8('0xa5')][_0x52b8('0x11d')](db[_0x52b8('0xa5')],{'as':_0x52b8('0x1cc'),'foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0xa5')][_0x52b8('0x12a')](db[_0x52b8('0x95')],{'as':'Variable','foreignKey':_0x52b8('0x1cd')});db[_0x52b8('0xa7')][_0x52b8('0x11d')](db['SugarcrmConfiguration'],{'as':_0x52b8('0x1c4'),'onDelete':_0x52b8('0x11a'),'foreignKey':'AccountId'});db[_0x52b8('0xa8')][_0x52b8('0x11d')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0xa8')][_0x52b8('0x11d')](db[_0x52b8('0xaa')],{'as':_0x52b8('0x1c8'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0xa8')][_0x52b8('0x11d')](db[_0x52b8('0xaa')],{'as':_0x52b8('0x1c2'),'onDelete':'cascade','foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0xa8')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0xaa')][_0x52b8('0x11d')](db[_0x52b8('0xaa')],{'as':_0x52b8('0x1ca'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0x52b8('0x11d')](db[_0x52b8('0xaa')],{'as':'Description','foreignKey':_0x52b8('0x1ce')});db['SugarcrmField'][_0x52b8('0x11d')](db[_0x52b8('0xaa')],{'as':'Field','foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0xaa')][_0x52b8('0x12a')](db[_0x52b8('0x95')],{'as':_0x52b8('0x95'),'foreignKey':_0x52b8('0x1cd')});db[_0x52b8('0x1cf')][_0x52b8('0x11d')](db[_0x52b8('0xac')],{'as':_0x52b8('0x1c4'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x52b8('0xac')][_0x52b8('0x11d')](db[_0x52b8('0xae')],{'as':'Subjects','onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0xac')][_0x52b8('0x11d')](db[_0x52b8('0xae')],{'as':_0x52b8('0x1c8'),'onDelete':_0x52b8('0x11a'),'foreignKey':'DescriptionId'});db[_0x52b8('0xac')][_0x52b8('0x11d')](db[_0x52b8('0xae')],{'as':'Fields','onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0xac')][_0x52b8('0x12a')](db[_0x52b8('0x1cf')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x1c5')});db['DeskConfiguration'][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':'int_desk_configuration_has_tags'});db[_0x52b8('0xae')][_0x52b8('0x11d')](db[_0x52b8('0xae')],{'as':_0x52b8('0x1ca'),'foreignKey':'SubjectId'});db[_0x52b8('0xae')][_0x52b8('0x11d')](db[_0x52b8('0xae')],{'as':_0x52b8('0x1cb'),'foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0xae')]['hasMany'](db[_0x52b8('0xae')],{'as':_0x52b8('0x1cc'),'foreignKey':'FieldId'});db[_0x52b8('0xae')][_0x52b8('0x12a')](db[_0x52b8('0x95')],{'as':_0x52b8('0x95'),'foreignKey':_0x52b8('0x1cd')});db[_0x52b8('0xaf')]['hasMany'](db['ZohoConfiguration'],{'as':_0x52b8('0x1c4'),'onDelete':_0x52b8('0x11a'),'foreignKey':'AccountId'});db[_0x52b8('0xb1')][_0x52b8('0x11d')](db[_0x52b8('0x1d0')],{'as':_0x52b8('0x1c6'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0xb1')][_0x52b8('0x11d')](db[_0x52b8('0x1d0')],{'as':_0x52b8('0x1c8'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0xb1')][_0x52b8('0x11d')](db[_0x52b8('0x1d0')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db['ZohoConfiguration'][_0x52b8('0x12a')](db[_0x52b8('0xaf')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x1c5')});db['ZohoField'][_0x52b8('0x11d')](db[_0x52b8('0x1d0')],{'as':_0x52b8('0x1ca'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0x1d0')][_0x52b8('0x11d')](db[_0x52b8('0x1d0')],{'as':_0x52b8('0x1cb'),'foreignKey':_0x52b8('0x1ce')});db['ZohoField'][_0x52b8('0x11d')](db[_0x52b8('0x1d0')],{'as':'Field','foreignKey':_0x52b8('0x1c9')});db['ZohoField'][_0x52b8('0x12a')](db[_0x52b8('0x95')],{'as':_0x52b8('0x95'),'foreignKey':_0x52b8('0x1cd')});db[_0x52b8('0xb4')][_0x52b8('0x11d')](db[_0x52b8('0x1d1')],{'as':_0x52b8('0x1c4'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0x1d1')][_0x52b8('0x11d')](db['ZendeskField'],{'as':_0x52b8('0x1c6'),'foreignKey':'SubjectId'});db['ZendeskConfiguration']['hasMany'](db[_0x52b8('0x1d2')],{'as':_0x52b8('0x1c8'),'foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0x1d1')][_0x52b8('0x11d')](db['ZendeskField'],{'as':_0x52b8('0x1c2'),'foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0x1d1')][_0x52b8('0x12a')](db[_0x52b8('0xb4')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0x1d1')][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':_0x52b8('0x1d3')});db[_0x52b8('0x1d2')][_0x52b8('0x11d')](db[_0x52b8('0x1d2')],{'as':_0x52b8('0x1ca'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0x1d2')][_0x52b8('0x11d')](db[_0x52b8('0x1d2')],{'as':_0x52b8('0x1cb'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x52b8('0x11d')](db[_0x52b8('0x1d2')],{'as':'Field','foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0x1d2')][_0x52b8('0x12a')](db[_0x52b8('0x95')],{'as':'Variable','foreignKey':_0x52b8('0x1cd')});db[_0x52b8('0xb8')][_0x52b8('0x11d')](db[_0x52b8('0x1d4')],{'as':_0x52b8('0x1c4'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0x1d4')][_0x52b8('0x11d')](db['FreshdeskField'],{'as':_0x52b8('0x1c6'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0x1d4')]['hasMany'](db['FreshdeskField'],{'as':_0x52b8('0x1c8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x52b8('0x11d')](db['FreshdeskField'],{'as':_0x52b8('0x1c2'),'onDelete':'cascade','foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0x1d4')]['belongsTo'](db[_0x52b8('0xb8')],{'as':'Account','foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0x1d4')][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':_0x52b8('0x1d5')});db[_0x52b8('0xba')][_0x52b8('0x11d')](db['FreshdeskField'],{'as':_0x52b8('0x1ca'),'foreignKey':_0x52b8('0x1c7')});db['FreshdeskField'][_0x52b8('0x11d')](db[_0x52b8('0xba')],{'as':'Description','foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0xba')][_0x52b8('0x11d')](db[_0x52b8('0xba')],{'as':'Field','foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0xba')][_0x52b8('0x12a')](db['Variable'],{'as':_0x52b8('0x95'),'foreignKey':_0x52b8('0x1cd')});db[_0x52b8('0xbc')][_0x52b8('0x11d')](db[_0x52b8('0xbe')],{'as':'Configurations','onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c5')});db['VtigerConfiguration'][_0x52b8('0x11d')](db[_0x52b8('0xbf')],{'as':_0x52b8('0x1c6'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0xbe')][_0x52b8('0x11d')](db[_0x52b8('0xbf')],{'as':_0x52b8('0x1c8'),'foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0xbe')]['hasMany'](db[_0x52b8('0xbf')],{'as':_0x52b8('0x1c2'),'foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0xbe')][_0x52b8('0x12a')](db[_0x52b8('0xbc')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0xbf')]['hasMany'](db[_0x52b8('0xbf')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x52b8('0xbf')][_0x52b8('0x11d')](db[_0x52b8('0xbf')],{'as':_0x52b8('0x1cb'),'foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0xbf')][_0x52b8('0x11d')](db['VtigerField'],{'as':'Field','foreignKey':_0x52b8('0x1c9')});db[_0x52b8('0xbf')]['belongsTo'](db[_0x52b8('0x95')],{'as':_0x52b8('0x95'),'foreignKey':'VariableId'});db['ServicenowAccount'][_0x52b8('0x11d')](db[_0x52b8('0xc0')],{'as':_0x52b8('0x1c4'),'onDelete':'cascade','foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0xc0')][_0x52b8('0x11d')](db['ServicenowField'],{'as':_0x52b8('0x1c6'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0xc0')][_0x52b8('0x11d')](db[_0x52b8('0xc1')],{'as':'Descriptions','foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0xc0')][_0x52b8('0x11d')](db['ServicenowField'],{'as':_0x52b8('0x1c2'),'foreignKey':'FieldId'});db[_0x52b8('0xc0')]['belongsTo'](db[_0x52b8('0x1d6')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0xc1')]['hasMany'](db[_0x52b8('0xc1')],{'as':_0x52b8('0x1ca'),'foreignKey':_0x52b8('0x1c7')});db['ServicenowField'][_0x52b8('0x11d')](db[_0x52b8('0xc1')],{'as':'Description','foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0xc1')][_0x52b8('0x11d')](db[_0x52b8('0xc1')],{'as':_0x52b8('0x1cc'),'foreignKey':'FieldId'});db[_0x52b8('0xc1')][_0x52b8('0x12a')](db[_0x52b8('0x95')],{'as':_0x52b8('0x95'),'foreignKey':_0x52b8('0x1cd')});db['Dynamics365Account']['hasMany'](db[_0x52b8('0x1d7')],{'as':_0x52b8('0x1c4'),'onDelete':'cascade','foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0xc3')][_0x52b8('0x12a')](db[_0x52b8('0x10f')],{'as':'CloudProvider','foreignKey':'CloudProviderId'});db[_0x52b8('0x1d7')][_0x52b8('0x11d')](db[_0x52b8('0xc6')],{'as':'Subjects','onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0x1d7')][_0x52b8('0x11d')](db[_0x52b8('0xc6')],{'as':_0x52b8('0x1c8'),'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0x1d7')]['hasMany'](db[_0x52b8('0xc6')],{'as':_0x52b8('0x1c2'),'onDelete':_0x52b8('0x11a'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x52b8('0x12a')](db[_0x52b8('0xc3')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0xc6')][_0x52b8('0x11d')](db[_0x52b8('0xc6')],{'as':_0x52b8('0x1ca'),'foreignKey':_0x52b8('0x1c7')});db[_0x52b8('0xc6')][_0x52b8('0x11d')](db[_0x52b8('0xc6')],{'as':_0x52b8('0x1cb'),'foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0xc6')][_0x52b8('0x11d')](db[_0x52b8('0xc6')],{'as':'Field','foreignKey':'FieldId'});db[_0x52b8('0xc6')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x52b8('0x1cd')});db[_0x52b8('0xc8')][_0x52b8('0x11d')](db[_0x52b8('0x1d8')],{'as':_0x52b8('0x1c4'),'onDelete':'cascade','foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0x1d8')]['hasMany'](db[_0x52b8('0xcb')],{'as':_0x52b8('0x1c6'),'foreignKey':'SubjectId'});db[_0x52b8('0x1d8')]['hasMany'](db[_0x52b8('0xcb')],{'as':_0x52b8('0x1c8'),'foreignKey':_0x52b8('0x1ce')});db['FreshsalesConfiguration'][_0x52b8('0x11d')](db['FreshsalesField'],{'as':_0x52b8('0x1c2'),'foreignKey':'FieldId'});db[_0x52b8('0x1d8')][_0x52b8('0x12a')](db['FreshsalesAccount'],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x1c5')});db[_0x52b8('0xcb')][_0x52b8('0x11d')](db[_0x52b8('0xcb')],{'as':'Subject','foreignKey':'SubjectId'});db['FreshsalesField']['hasMany'](db[_0x52b8('0xcb')],{'as':_0x52b8('0x1cb'),'foreignKey':_0x52b8('0x1ce')});db[_0x52b8('0xcb')][_0x52b8('0x11d')](db[_0x52b8('0xcb')],{'as':'Field','foreignKey':'FieldId'});db[_0x52b8('0xcb')][_0x52b8('0x12a')](db[_0x52b8('0x95')],{'as':_0x52b8('0x95'),'foreignKey':_0x52b8('0x1cd')});db[_0x52b8('0x1d9')]['belongsTo'](db['ChatWebsite'],{});db[_0x52b8('0x1d9')][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':'List','foreignKey':'ListId'});db[_0x52b8('0x1d9')][_0x52b8('0x12a')](db[_0x52b8('0x173')],{'as':_0x52b8('0x174'),'foreignKey':_0x52b8('0x166')});db[_0x52b8('0x1d9')][_0x52b8('0x12a')](db[_0x52b8('0x66')],{});db[_0x52b8('0x1d9')][_0x52b8('0x12a')](db[_0x52b8('0x68')],{});db['ChatQueueReport'][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{});db[_0x52b8('0x1d9')][_0x52b8('0x12a')](db[_0x52b8('0x6b')],{});db['ChatInternalMessage'][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1da')});db['ChatInternalMessage'][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'onDelete':_0x52b8('0x11a'),'foreignKey':_0x52b8('0x1db')});db[_0x52b8('0xd4')][_0x52b8('0x11d')](db[_0x52b8('0xd2')],{'foreignKey':'SessionId','onDelete':_0x52b8('0x11a')});db[_0x52b8('0xd4')][_0x52b8('0x11d')](db[_0x52b8('0xd0')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x52b8('0xd6')]['belongsTo'](db['SmsAccount'],{});db[_0x52b8('0xd6')]['belongsTo'](db[_0x52b8('0xf9')],{'as':_0x52b8('0x170'),'foreignKey':'ListId'});db['SmsQueueReport'][_0x52b8('0x12a')](db[_0x52b8('0x173')],{'as':_0x52b8('0x174'),'foreignKey':_0x52b8('0x166')});db['SmsQueueReport'][_0x52b8('0x12a')](db['SmsInteraction'],{});db['SmsQueueReport']['belongsTo'](db[_0x52b8('0x57')],{});db[_0x52b8('0xd6')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{});db[_0x52b8('0xd6')][_0x52b8('0x12a')](db[_0x52b8('0x18e')],{});db[_0x52b8('0xdb')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x52b8('0x1dc')});db[_0x52b8('0xdb')][_0x52b8('0x11d')](db[_0x52b8('0xd2')],{'foreignKey':'ProjectId'});db[_0x52b8('0xdb')]['hasMany'](db[_0x52b8('0xd0')],{'foreignKey':'ProjectId'});db[_0x52b8('0xe5')][_0x52b8('0x12c')](db['User'],{'as':_0x52b8('0x15c'),'through':'user_has_teams'});db[_0x52b8('0xe5')][_0x52b8('0x12c')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0x52b8('0x137')});db[_0x52b8('0xe5')][_0x52b8('0x12c')](db[_0x52b8('0x3c')],{'through':'team_has_mail_queues','as':_0x52b8('0x139')});db['Team'][_0x52b8('0x12c')](db['ChatQueue'],{'through':_0x52b8('0x19a'),'as':_0x52b8('0x13a')});db['Team']['belongsToMany'](db[_0x52b8('0x13b')],{'through':_0x52b8('0x189'),'as':_0x52b8('0x1dd')});db[_0x52b8('0xe5')]['belongsToMany'](db['SmsQueue'],{'through':_0x52b8('0x18f'),'as':_0x52b8('0x13c')});db[_0x52b8('0xe5')][_0x52b8('0x12c')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x52b8('0x13d')});db['Team'][_0x52b8('0x12c')](db[_0x52b8('0x10d')],{'through':_0x52b8('0x1de'),'as':_0x52b8('0x1df')});db[_0x52b8('0xe5')][_0x52b8('0x12c')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0x52b8('0x138')});db['Campaign'][_0x52b8('0x11d')](db[_0x52b8('0x152')],{'as':_0x52b8('0x128'),'foreignKey':_0x52b8('0x1a7')});db[_0x52b8('0xe8')][_0x52b8('0x11d')](db[_0x52b8('0x75')],{'as':_0x52b8('0x121'),'foreignKey':_0x52b8('0x1a7')});db['Campaign'][_0x52b8('0x11d')](db[_0x52b8('0x77')],{'as':'HopperHistories','foreignKey':_0x52b8('0x1a7')});db['Campaign'][_0x52b8('0x11d')](db[_0x52b8('0x73')],{'as':_0x52b8('0x154'),'foreignKey':'CampaignId'});db[_0x52b8('0xe8')][_0x52b8('0x12a')](db[_0x52b8('0x26')],{'as':_0x52b8('0x26'),'foreignKey':'TrunkId'});db[_0x52b8('0xe8')][_0x52b8('0x12a')](db['Trunk'],{'as':_0x52b8('0x157'),'foreignKey':_0x52b8('0x1e0')});db[_0x52b8('0xe8')]['belongsTo'](db['Interval'],{'as':_0x52b8('0x82'),'foreignKey':_0x52b8('0x158')});db[_0x52b8('0xe8')][_0x52b8('0x12a')](db[_0x52b8('0xe0')],{'as':_0x52b8('0xe0'),'foreignKey':_0x52b8('0x1e1')});db[_0x52b8('0xe8')][_0x52b8('0x12c')](db['CmList'],{'as':'Lists','through':_0x52b8('0x1e2')});db['Campaign'][_0x52b8('0x12c')](db[_0x52b8('0xf9')],{'as':_0x52b8('0x15e'),'through':_0x52b8('0x1e3')});db['Attachment']['belongsTo'](db[_0x52b8('0x17d')],{'as':_0x52b8('0x17d'),'foreignKey':_0x52b8('0x17e')});db['MailTransferReport'][_0x52b8('0x12a')](db['MailMessage'],{});db[_0x52b8('0xf0')][_0x52b8('0x12a')](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db[_0x52b8('0x3a')],{'foreignKey':'FromMailAccountId','as':_0x52b8('0x1e4')});db[_0x52b8('0xf0')]['belongsTo'](db[_0x52b8('0x11c')],{'foreignKey':_0x52b8('0x1e5'),'as':_0x52b8('0x1e6')});db[_0x52b8('0xf0')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'foreignKey':_0x52b8('0x1e7'),'as':_0x52b8('0x1e8')});db['MailTransferReport'][_0x52b8('0x12a')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x52b8('0x1e9')});db[_0x52b8('0xf0')][_0x52b8('0x12a')](db[_0x52b8('0x3a')],{'foreignKey':'ToMailAccountId','as':_0x52b8('0x1ea')});db[_0x52b8('0xf2')]['belongsTo'](db[_0x52b8('0x68')],{});db[_0x52b8('0xf2')][_0x52b8('0x12a')](db[_0x52b8('0x66')],{});db[_0x52b8('0xf2')]['belongsTo'](db[_0x52b8('0x60')],{'foreignKey':_0x52b8('0x1eb'),'as':_0x52b8('0x1e4')});db['ChatTransferReport'][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'foreignKey':'FromUserId','as':_0x52b8('0x1e6')});db[_0x52b8('0xf2')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'foreignKey':'ToUserId','as':_0x52b8('0x1e8')});db[_0x52b8('0xf2')][_0x52b8('0x12a')](db['ChatQueue'],{'foreignKey':_0x52b8('0x1ec'),'as':_0x52b8('0x1e9')});db[_0x52b8('0xf2')][_0x52b8('0x12a')](db[_0x52b8('0x60')],{'foreignKey':_0x52b8('0x1ed'),'as':_0x52b8('0x1ea')});db['FaxTransferReport'][_0x52b8('0x12a')](db[_0x52b8('0x4c')],{});db[_0x52b8('0xf4')][_0x52b8('0x12a')](db[_0x52b8('0x4b')],{});db[_0x52b8('0xf4')][_0x52b8('0x12a')](db[_0x52b8('0x47')],{'foreignKey':_0x52b8('0x1ee'),'as':'FromAccount'});db['FaxTransferReport'][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'foreignKey':'FromUserId','as':_0x52b8('0x1e6')});db[_0x52b8('0xf4')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'foreignKey':'ToUserId','as':_0x52b8('0x1e8')});db[_0x52b8('0xf4')][_0x52b8('0x12a')](db['FaxQueue'],{'foreignKey':_0x52b8('0x1ef'),'as':_0x52b8('0x1e9')});db[_0x52b8('0xf4')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x52b8('0x1f0'),'as':_0x52b8('0x1ea')});db[_0x52b8('0xf6')][_0x52b8('0x12a')](db[_0x52b8('0x191')],{});db[_0x52b8('0xf6')]['belongsTo'](db[_0x52b8('0x5b')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x52b8('0x144')],{'foreignKey':_0x52b8('0x1f1'),'as':_0x52b8('0x1e4')});db[_0x52b8('0xf6')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'foreignKey':_0x52b8('0x1e5'),'as':'FromAgent'});db['OpenchannelTransferReport'][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'foreignKey':'ToUserId','as':_0x52b8('0x1e8')});db[_0x52b8('0xf6')][_0x52b8('0x12a')](db['OpenchannelQueue'],{'foreignKey':_0x52b8('0x1f2'),'as':_0x52b8('0x1e9')});db[_0x52b8('0xf6')][_0x52b8('0x12a')](db[_0x52b8('0x144')],{'foreignKey':_0x52b8('0x1f3'),'as':_0x52b8('0x1ea')});db[_0x52b8('0xf7')][_0x52b8('0x12a')](db[_0x52b8('0x57')],{});db[_0x52b8('0xf7')]['belongsTo'](db[_0x52b8('0x55')],{});db[_0x52b8('0xf7')][_0x52b8('0x12a')](db[_0x52b8('0x51')],{'foreignKey':_0x52b8('0x1f4'),'as':_0x52b8('0x1e4')});db[_0x52b8('0xf7')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'foreignKey':_0x52b8('0x1e5'),'as':'FromAgent'});db[_0x52b8('0xf7')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'foreignKey':_0x52b8('0x1e7'),'as':_0x52b8('0x1e8')});db[_0x52b8('0xf7')][_0x52b8('0x12a')](db[_0x52b8('0x18e')],{'foreignKey':_0x52b8('0x1f5'),'as':_0x52b8('0x1e9')});db[_0x52b8('0xf7')][_0x52b8('0x12a')](db[_0x52b8('0x51')],{'foreignKey':_0x52b8('0x1f6'),'as':_0x52b8('0x1ea')});db[_0x52b8('0xf9')]['hasMany'](db[_0x52b8('0x80')],{'as':'Dispositions','foreignKey':_0x52b8('0x180'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0xf9')][_0x52b8('0x11d')](db['CmCustomField'],{'as':_0x52b8('0x1f7'),'foreignKey':_0x52b8('0x180')});db['CmList']['hasMany'](db[_0x52b8('0x173')],{'as':_0x52b8('0x12e'),'onDelete':_0x52b8('0x11a'),'foreignKey':'ListId'});db[_0x52b8('0xf9')][_0x52b8('0x11d')](db[_0x52b8('0x75')],{'as':_0x52b8('0x121'),'foreignKey':_0x52b8('0x180')});db['CmList'][_0x52b8('0x11d')](db[_0x52b8('0x77')],{'as':_0x52b8('0x122'),'foreignKey':_0x52b8('0x180')});db['CmList']['hasMany'](db['ReportAgentPreview'],{'as':_0x52b8('0x78'),'foreignKey':_0x52b8('0x180')});db[_0x52b8('0xf9')][_0x52b8('0x12c')](db[_0x52b8('0x19')],{'as':_0x52b8('0x1f8'),'through':'voice_queues_has_cm_lists'});db[_0x52b8('0xf9')][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x15c'),'through':_0x52b8('0x13e')});db[_0x52b8('0xfb')][_0x52b8('0x11d')](db[_0x52b8('0x16')],{'as':_0x52b8('0x120'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0xfb')]['belongsToMany'](db[_0x52b8('0x11c')],{'as':_0x52b8('0x15c'),'through':_0x52b8('0x114')});db['VoicePrefix'][_0x52b8('0x12c')](db['Team'],{'through':'TeamVoicePrefix','as':'Teams'});db['UserProfile']['hasMany'](db[_0x52b8('0x11c')],{'as':_0x52b8('0x179'),'foreignKey':_0x52b8('0x12b')});db[_0x52b8('0xfd')][_0x52b8('0x11d')](db['UserProfileSection'],{'as':_0x52b8('0x1f9'),'foreignKey':_0x52b8('0x12b'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x1fa')][_0x52b8('0x11d')](db['UserProfileResource'],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x52b8('0x11a')});db[_0x52b8('0x148')][_0x52b8('0x11d')](db[_0x52b8('0x80')],{'as':'Dispositions','foreignKey':_0x52b8('0x1fb'),'onDelete':_0x52b8('0x11a')});db[_0x52b8('0x148')][_0x52b8('0x11d')](db['CannedAnswer'],{'as':_0x52b8('0x16d'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x52b8('0x11d')](db[_0x52b8('0x107')],{'as':_0x52b8('0x16e'),'foreignKey':_0x52b8('0x1fb')});db[_0x52b8('0x148')][_0x52b8('0x11d')](db[_0x52b8('0x105')],{'as':_0x52b8('0x18b')});db[_0x52b8('0x148')][_0x52b8('0x11d')](db[_0x52b8('0x103')],{'as':_0x52b8('0x14c'),'foreignKey':_0x52b8('0x1fb'),'onDelete':_0x52b8('0x11a')});db['WhatsappAccount'][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':_0x52b8('0x170'),'foreignKey':'ListId'});db[_0x52b8('0x148')][_0x52b8('0x12a')](db[_0x52b8('0x159')],{'as':_0x52b8('0x15a'),'foreignKey':_0x52b8('0x171')});db['WhatsappAccount'][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x15c'),'through':'user_has_whatsapp_accounts'});db[_0x52b8('0x103')][_0x52b8('0x12a')](db['User'],{'onDelete':_0x52b8('0x169')});db[_0x52b8('0x103')][_0x52b8('0x12a')](db[_0x52b8('0x10d')],{'onDelete':_0x52b8('0x169')});db['WhatsappApplication'][_0x52b8('0x12a')](db[_0x52b8('0x148')],{'onDelete':_0x52b8('0x169')});db['WhatsappApplication'][_0x52b8('0x12a')](db[_0x52b8('0x82')],{'onDelete':_0x52b8('0x169'),'foreignKey':'IntervalId'});db[_0x52b8('0x103')][_0x52b8('0x12a')](db[_0x52b8('0x8c')],{'onDelete':_0x52b8('0x169'),'foreignKey':_0x52b8('0x17f')});db[_0x52b8('0x105')]['hasMany'](db[_0x52b8('0x107')],{'as':_0x52b8('0x16e'),'onDelete':'cascade','foreignKey':_0x52b8('0x1fc')});db[_0x52b8('0x105')][_0x52b8('0x12a')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x52b8('0x1fb')});db[_0x52b8('0x105')][_0x52b8('0x12a')](db['CmContact'],{'as':_0x52b8('0x174'),'foreignKey':'ContactId'});db[_0x52b8('0x105')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x175'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':_0x52b8('0x1fd'),'as':_0x52b8('0x177')});db[_0x52b8('0x105')][_0x52b8('0x12c')](db[_0x52b8('0x8c')],{'through':_0x52b8('0x1fd'),'as':_0x52b8('0x178')});db['WhatsappInteraction'][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x179'),'through':_0x52b8('0x136'),'foreignKey':_0x52b8('0x1fc')});db[_0x52b8('0x107')]['belongsTo'](db[_0x52b8('0x11c')],{'as':'User'});db[_0x52b8('0x107')]['belongsTo'](db[_0x52b8('0x173')],{'onDelete':_0x52b8('0x11a'),'as':'Contact'});db[_0x52b8('0x107')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x52b8('0x1fc')});db['WhatsappMessage'][_0x52b8('0x12a')](db[_0x52b8('0x148')],{'as':_0x52b8('0x17b'),'foreignKey':_0x52b8('0x1fb')});db[_0x52b8('0x109')][_0x52b8('0x12a')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0x52b8('0x12a')](db[_0x52b8('0xf9')],{'as':'List','foreignKey':_0x52b8('0x180')});db[_0x52b8('0x109')][_0x52b8('0x12a')](db[_0x52b8('0x173')],{'as':_0x52b8('0x174'),'foreignKey':_0x52b8('0x166')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x52b8('0x109')][_0x52b8('0x12a')](db[_0x52b8('0x10d')],{});db[_0x52b8('0x109')]['belongsTo'](db[_0x52b8('0x107')],{});db[_0x52b8('0x109')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{});db[_0x52b8('0x10b')]['belongsTo'](db['WhatsappMessage'],{});db[_0x52b8('0x10b')]['belongsTo'](db[_0x52b8('0x105')],{});db['WhatsappTransferReport'][_0x52b8('0x12a')](db[_0x52b8('0x148')],{'foreignKey':_0x52b8('0x1fe'),'as':_0x52b8('0x1e4')});db[_0x52b8('0x10b')][_0x52b8('0x12a')](db[_0x52b8('0x148')],{'foreignKey':_0x52b8('0x1ff'),'as':_0x52b8('0x1ea')});db['WhatsappTransferReport'][_0x52b8('0x12a')](db[_0x52b8('0x10d')],{'foreignKey':_0x52b8('0x200'),'as':_0x52b8('0x1e9')});db[_0x52b8('0x10b')][_0x52b8('0x12a')](db[_0x52b8('0x11c')],{'foreignKey':_0x52b8('0x1e5'),'as':_0x52b8('0x1e6')});db['WhatsappTransferReport'][_0x52b8('0x12a')](db['User'],{'foreignKey':_0x52b8('0x1e7'),'as':_0x52b8('0x1e8')});db['WhatsappQueue'][_0x52b8('0x12c')](db[_0x52b8('0x11c')],{'as':_0x52b8('0x15c'),'through':_0x52b8('0x34'),'foreignKey':_0x52b8('0x201')});db[_0x52b8('0x10d')][_0x52b8('0x12c')](db[_0x52b8('0xe5')],{'through':_0x52b8('0x1de'),'as':_0x52b8('0x15d')});db[_0x52b8('0x115')][_0x52b8('0x12a')](db['User'],{'as':'user','foreignKey':_0x52b8('0x11b'),'onDelete':_0x52b8('0x11a'),'hooks':!![]});db[_0x52b8('0x10f')][_0x52b8('0x118')](db[_0x52b8('0xc3')],{'as':_0x52b8('0xc3'),'onDelete':_0x52b8('0x169')});db[_0x52b8('0x10f')][_0x52b8('0x118')](db[_0x52b8('0x36')],{'as':_0x52b8('0x16a'),'onDelete':_0x52b8('0x169')});db[_0x52b8('0x10f')][_0x52b8('0x118')](db[_0x52b8('0x38')],{'as':_0x52b8('0x16b'),'onDelete':'restrict'});module[_0x52b8('0x202')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x8ba9=['CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperHistory','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','UserVoicePrefix','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','VoiceMail','UserId','UserSetting','userSetting','cascade','Recordings','hasMany','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteraction','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','FaxQueues','UserFaxQueue','SmsQueues','UserSmsQueue','OpenchannelQueue','OpenchannelQueues','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','VoiceContext','Applications','VoiceMusicOnHold','Sounds','VoiceQueueId','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','BlackLists','Messages','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','ListId','Template','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Account','Tag','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','MailApplication','TagId','List','Items','FaxAccountId','FaxApplication','Exntensions','mandatoryDispositionPauseId','FaxMessage','FaxInteractionId','Owner','fax_interaction_has_tags','Users','Attachment','SmsAccountId','SmsMessage','SmsApplication','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelMessage','OpenchannelInteractionId','team_has_openchannel_queues','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','AttachmentId','team_has_chat_queues','ChatGroupId','Members','CmContactHasItem','CmContactId','HopperHistories','JscriptySessionReport','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','All','AutomationAllId','AutomationAnyId','Action','Actions','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperAdditionalPhone','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','Configurations','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','SugarcrmAccount','Subjects','Description','DeskConfiguration','DeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','FreshsalesField','FromId','ToId','JscriptyAnswerReport','SessionId','JscriptyProject','ProjectId','ChatQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToSmsAccountId','CustomFields','userProfileId','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','utf8mb4','name','utf8','sequelizeHistory','mysql','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxApplication/faxApplication.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany'];(function(_0x3f92b3,_0x3f5be4){var _0x539acd=function(_0x3da169){while(--_0x3da169){_0x3f92b3['push'](_0x3f92b3['shift']());}};_0x539acd(++_0x3f5be4);}(_0x8ba9,0x18c));var _0x98ba=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x8ba9[_0xaa0309];return _0x5de7ce;};'use strict';var config=require(_0x98ba('0x0'));var Sequelize=require(_0x98ba('0x1'));var _=require(_0x98ba('0x2'));var jstz=require(_0x98ba('0x3'));var timezone=jstz[_0x98ba('0x4')]();config[_0x98ba('0x1')]=_[_0x98ba('0x5')](config[_0x98ba('0x1')],{'database':_0x98ba('0x6'),'username':_0x98ba('0x7'),'password':_0x98ba('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x98ba('0x9')},'logging':![],'timezone':timezone[_0x98ba('0xa')](),'define':{'charset':_0x98ba('0xb'),'collate':'utf8_general_ci'}}});config[_0x98ba('0xc')]=_[_0x98ba('0x5')](config[_0x98ba('0xc')],{'database':_0x98ba('0x6'),'username':_0x98ba('0x7'),'password':_0x98ba('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x98ba('0xd'),'dialectOptions':{'charset':_0x98ba('0x9')},'logging':![],'timezone':timezone[_0x98ba('0xa')](),'define':{'charset':_0x98ba('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x98ba('0x1')][_0x98ba('0xe')],config[_0x98ba('0x1')][_0x98ba('0xf')],config[_0x98ba('0x1')][_0x98ba('0x10')],config[_0x98ba('0x1')][_0x98ba('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x98ba('0xc')][_0x98ba('0xe')],config['sequelizeHistory'][_0x98ba('0xf')],config[_0x98ba('0xc')][_0x98ba('0x10')],config[_0x98ba('0xc')][_0x98ba('0x11')])};db[_0x98ba('0x12')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/user/user.model');db[_0x98ba('0x14')]=db[_0x98ba('0x1')]['import'](_0x98ba('0x15'));db['VoiceContext']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x16'));db[_0x98ba('0x17')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x18'));db['VoiceMusicOnHold']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x19'));db[_0x98ba('0x1a')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x1b'));db[_0x98ba('0x1c')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x98ba('0x1d')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x1e'));db['VoiceMail']=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/voiceMail/voiceMail.model');db[_0x98ba('0x1f')]=db[_0x98ba('0x1')]['import'](_0x98ba('0x20'));db[_0x98ba('0x21')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x98ba('0x22')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0x98ba('0x23')]=db[_0x98ba('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0x98ba('0x24')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0x98ba('0x1')]['import'](_0x98ba('0x25'));db[_0x98ba('0x26')]=db[_0x98ba('0x1')]['import'](_0x98ba('0x27'));db['VoiceTransferReport']=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x98ba('0x28')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x29'));db[_0x98ba('0x2a')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x98ba('0x2b')]=db[_0x98ba('0x1')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x98ba('0x2c')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x2d'));db['UserFaxQueue']=db[_0x98ba('0x1')]['import'](_0x98ba('0x2e'));db['UserSmsQueue']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x2f'));db[_0x98ba('0x30')]=db[_0x98ba('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x98ba('0x31')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x98ba('0x32')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0x98ba('0x33')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x34'));db[_0x98ba('0x35')]=db['sequelize']['import'](_0x98ba('0x36'));db[_0x98ba('0x37')]=db['sequelize']['import'](_0x98ba('0x38'));db[_0x98ba('0x39')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x3a'));db[_0x98ba('0x3b')]=db['sequelize'][_0x98ba('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x98ba('0x3c')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x3d'));db['MailApplication']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x3e'));db[_0x98ba('0x3f')]=db['sequelize'][_0x98ba('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0x98ba('0x40')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/dashboard/dashboard.model');db[_0x98ba('0x41')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x42'));db[_0x98ba('0x43')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db['sequelize']['import'](_0x98ba('0x44'));db['FaxInteraction']=db['sequelize']['import']('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x98ba('0x1')]['import']('../api/faxMessage/faxMessage.model');db[_0x98ba('0x45')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x46'));db[_0x98ba('0x47')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x48'));db[_0x98ba('0x49')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x4a'));db['SmsApplication']=db['sequelize']['import'](_0x98ba('0x4b'));db[_0x98ba('0x4c')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x98ba('0x1')]['import']('../api/smsMessage/smsMessage.model');db[_0x98ba('0x4d')]=db[_0x98ba('0x1')]['import'](_0x98ba('0x4e'));db[_0x98ba('0x4f')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x50'));db[_0x98ba('0x51')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x52'));db[_0x98ba('0x53')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x54'));db['OpenchannelMessage']=db['sequelize']['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x98ba('0x1')]['import'](_0x98ba('0x55'));db[_0x98ba('0x56')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x57'));db[_0x98ba('0x58')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x59'));db[_0x98ba('0x5a')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x5b'));db[_0x98ba('0x5c')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x5d'));db[_0x98ba('0x5e')]=db[_0x98ba('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0x98ba('0x5f')]=db[_0x98ba('0x1')]['import'](_0x98ba('0x60'));db[_0x98ba('0x61')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x62'));db[_0x98ba('0x63')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x64'));db[_0x98ba('0x65')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x66'));db[_0x98ba('0x67')]=db['sequelize'][_0x98ba('0x13')]('../api/cmCompany/cmCompany.model');db[_0x98ba('0x68')]=db[_0x98ba('0x1')]['import'](_0x98ba('0x69'));db[_0x98ba('0x6a')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x6b'));db['CmHopperBlack']=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0x98ba('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x98ba('0x6c')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x98ba('0x6d')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x98ba('0x6e')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x6f'));db['Action']=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/action/action.model');db[_0x98ba('0x70')]=db['sequelize']['import'](_0x98ba('0x71'));db[_0x98ba('0x72')]=db['sequelize']['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x98ba('0x73')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x74'));db[_0x98ba('0x75')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/condition/condition.model');db[_0x98ba('0x76')]=db['sequelize']['import'](_0x98ba('0x77'));db[_0x98ba('0x78')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x79'));db[_0x98ba('0x7a')]=db['sequelize'][_0x98ba('0x13')]('../api/cdr/cdr.model');db[_0x98ba('0x7b')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x7c'));db['Schedule']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x7d'));db[_0x98ba('0x7e')]=db['sequelize']['import'](_0x98ba('0x7f'));db['Tag']=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/tag/tag.model');db[_0x98ba('0x80')]=db[_0x98ba('0x1')]['import'](_0x98ba('0x81'));db['CmContactHasItem']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x82'));db['CmHopperAdditionalPhone']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x83'));db['Template']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x84'));db[_0x98ba('0x85')]=db[_0x98ba('0x1')]['import'](_0x98ba('0x86'));db[_0x98ba('0x87')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x88'));db[_0x98ba('0x89')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/integration/integration.model');db[_0x98ba('0x8a')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x8b'));db[_0x98ba('0x8c')]=db['sequelize']['import'](_0x98ba('0x8d'));db[_0x98ba('0x8e')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x8f'));db['AnalyticExtractedReport']=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x90'));db[_0x98ba('0x91')]=db['sequelize']['import']('../api/analyticMetric/analyticMetric.model');db[_0x98ba('0x92')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x93'));db[_0x98ba('0x94')]=db['sequelize']['import'](_0x98ba('0x95'));db[_0x98ba('0x96')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x97'));db[_0x98ba('0x98')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x99'));db[_0x98ba('0x9a')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0x9b'));db['SugarcrmAccount']=db['sequelize'][_0x98ba('0x13')](_0x98ba('0x9c'));db[_0x98ba('0x9d')]=db[_0x98ba('0x1')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x98ba('0x9e')]=db['sequelize']['import'](_0x98ba('0x9f'));db[_0x98ba('0xa0')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0xa1'));db['DeskConfiguration']=db['sequelize'][_0x98ba('0x13')](_0x98ba('0xa2'));db['DeskField']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xa3'));db[_0x98ba('0xa4')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xa5'));db[_0x98ba('0xa6')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xa7'));db[_0x98ba('0xa8')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/intZohoField/intZohoField.model');db[_0x98ba('0xa9')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xaa'));db[_0x98ba('0xab')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xac'));db[_0x98ba('0xad')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xae'));db[_0x98ba('0xaf')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0xb0'));db['FreshdeskConfiguration']=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x98ba('0xb1')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xb2'));db[_0x98ba('0xb3')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xb4'));db[_0x98ba('0xb5')]=db['sequelize'][_0x98ba('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x98ba('0xb6')]=db['sequelize'][_0x98ba('0x13')](_0x98ba('0xb7'));db['ServicenowAccount']=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x98ba('0xb8')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xb9'));db[_0x98ba('0xba')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xbb'));db[_0x98ba('0xbc')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x98ba('0xbd')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xbe'));db[_0x98ba('0xbf')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xc0'));db[_0x98ba('0xc1')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x98ba('0xc2')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xc3'));db['FreshsalesField']=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x98ba('0x89')]=db['sequelize']['import'](_0x98ba('0xc4'));db['Network']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xc5'));db[_0x98ba('0xc6')]=db['sequelize']['import'](_0x98ba('0xc7'));db[_0x98ba('0xc8')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xc9'));db[_0x98ba('0xca')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xcb'));db['JscriptySessionReport']=db[_0x98ba('0x1')]['import'](_0x98ba('0xcc'));db[_0x98ba('0xcd')]=db[_0x98ba('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x98ba('0xce')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xcf'));db['SquareDetailsReport']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xd0'));db['JscriptyProject']=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/jscriptyProject/jscriptyProject.model');db[_0x98ba('0xd1')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xd2'));db[_0x98ba('0xd3')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x98ba('0xd4')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xd5'));db[_0x98ba('0xd6')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xd7'));db[_0x98ba('0xd8')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xd9'));db[_0x98ba('0xda')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/license/license.model');db[_0x98ba('0xdb')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xdc'));db[_0x98ba('0xdd')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xde'));db['Attachment']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xdf'));db['Plugin']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xe0'));db['MailTransferReport']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xe1'));db[_0x98ba('0xe2')]=db['sequelize'][_0x98ba('0x13')]('../api/chatTransferReport/chatTransferReport.model');db[_0x98ba('0xe3')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xe4'));db[_0x98ba('0xe5')]=db[_0x98ba('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x98ba('0xe6')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xe7'));db[_0x98ba('0xe8')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xe9'));db[_0x98ba('0xea')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xeb'));db[_0x98ba('0xec')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db['sequelize'][_0x98ba('0x13')](_0x98ba('0xed'));db[_0x98ba('0xee')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xef'));db[_0x98ba('0xf0')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xf1'));db['WhatsappApplication']=db['sequelize'][_0x98ba('0x13')](_0x98ba('0xf2'));db['WhatsappInteraction']=db['sequelize']['import'](_0x98ba('0xf3'));db['WhatsappMessage']=db['sequelize']['import'](_0x98ba('0xf4'));db['WhatsappQueueReport']=db[_0x98ba('0x1')]['import'](_0x98ba('0xf5'));db[_0x98ba('0xf6')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xf7'));db[_0x98ba('0xf8')]=db[_0x98ba('0x1')]['import'](_0x98ba('0xf9'));db[_0x98ba('0xfa')]=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xfb'));db[_0x98ba('0xfc')]=db['sequelize'][_0x98ba('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x98ba('0xfd')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x98ba('0xfe')]=db['sequelize'][_0x98ba('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0x98ba('0x1')][_0x98ba('0x13')](_0x98ba('0xff'));db[_0x98ba('0x100')]=db[_0x98ba('0x1')][_0x98ba('0x13')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db['User'][_0x98ba('0x101')](db['VoiceMail'],{'as':_0x98ba('0x102'),'onDelete':'cascade','foreignKey':_0x98ba('0x103')});db[_0x98ba('0x12')]['hasOne'](db[_0x98ba('0x104')],{'as':_0x98ba('0x105'),'onDelete':_0x98ba('0x106'),'foreignKey':'UserId'});db[_0x98ba('0x12')]['hasMany'](db[_0x98ba('0x1c')],{'as':_0x98ba('0x107'),'foreignKey':_0x98ba('0x103')});db['User'][_0x98ba('0x108')](db['UserVoiceQueueRt'],{'as':_0x98ba('0x109'),'foreignKey':_0x98ba('0x103')});db[_0x98ba('0x12')][_0x98ba('0x108')](db[_0x98ba('0x17')],{'as':_0x98ba('0x10a'),'onDelete':_0x98ba('0x106'),'hooks':!![]});db[_0x98ba('0x12')][_0x98ba('0x108')](db[_0x98ba('0x10b')],{'as':_0x98ba('0x10c'),'foreignKey':'UserId'});db[_0x98ba('0x12')][_0x98ba('0x108')](db[_0x98ba('0x6c')],{'as':_0x98ba('0x10d'),'foreignKey':'UserId'});db[_0x98ba('0x12')][_0x98ba('0x108')](db[_0x98ba('0x6d')],{'as':'ReportAgentPreview','foreignKey':_0x98ba('0x103')});db[_0x98ba('0x12')][_0x98ba('0x108')](db[_0x98ba('0x53')],{'as':_0x98ba('0x10e'),'foreignKey':_0x98ba('0x103')});db[_0x98ba('0x12')][_0x98ba('0x108')](db[_0x98ba('0x5c')],{'as':'ChatInteractions','foreignKey':_0x98ba('0x103')});db[_0x98ba('0x12')][_0x98ba('0x108')](db['SmsInteraction'],{'as':_0x98ba('0x10f'),'foreignKey':'UserId'});db['User'][_0x98ba('0x108')](db[_0x98ba('0x110')],{'as':'FaxInteractions','foreignKey':_0x98ba('0x103')});db[_0x98ba('0x12')][_0x98ba('0x108')](db[_0x98ba('0x3b')],{'as':'MailInteractions','foreignKey':_0x98ba('0x103')});db[_0x98ba('0x12')][_0x98ba('0x108')](db[_0x98ba('0x111')],{'as':_0x98ba('0x112'),'foreignKey':'UserId'});db['User'][_0x98ba('0x108')](db[_0x98ba('0xee')],{'as':_0x98ba('0x113'),'foreignKey':_0x98ba('0x114')});db[_0x98ba('0x12')][_0x98ba('0x108')](db[_0x98ba('0x6a')],{'as':_0x98ba('0x115'),'foreignKey':_0x98ba('0x103'),'onDelete':_0x98ba('0x116')});db[_0x98ba('0x12')][_0x98ba('0x117')](db[_0x98ba('0xec')],{'as':_0x98ba('0xec'),'foreignKey':'userProfileId'});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x63')],{'as':_0x98ba('0x119'),'through':_0x98ba('0x11a')});db[_0x98ba('0x12')]['belongsToMany'](db['CmContact'],{'as':_0x98ba('0x11b'),'through':'cm_user_has_contacts'});db[_0x98ba('0x12')]['belongsToMany'](db['CmList'],{'as':_0x98ba('0x11c'),'through':_0x98ba('0x11d')});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x11e')],{'through':_0x98ba('0x11f')});db[_0x98ba('0x12')]['belongsToMany'](db[_0x98ba('0x3b')],{'as':_0x98ba('0x120'),'through':_0x98ba('0x121')});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x5c')],{'as':_0x98ba('0x122'),'through':_0x98ba('0x123')});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x110')],{'as':_0x98ba('0x124'),'through':_0x98ba('0x125')});db[_0x98ba('0x12')][_0x98ba('0x118')](db['SmsInteraction'],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db['User']['belongsToMany'](db[_0x98ba('0x53')],{'as':_0x98ba('0x10e'),'through':_0x98ba('0x126')});db['User'][_0x98ba('0x118')](db[_0x98ba('0x111')],{'as':_0x98ba('0x112'),'through':'user_has_whatsapp_interactions'});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x1a')],{'as':_0x98ba('0x127'),'through':'UserVoiceQueue','required':![]});db['User'][_0x98ba('0x118')](db[_0x98ba('0xea')],{'as':_0x98ba('0x128'),'through':_0x98ba('0xfe'),'required':![]});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x37')],{'as':_0x98ba('0x129'),'through':_0x98ba('0x2c'),'required':![]});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x61')],{'as':'ChatQueues','through':_0x98ba('0x2b'),'required':![],'hooks':!![]});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x45')],{'as':_0x98ba('0x12a'),'through':_0x98ba('0x12b'),'required':![]});db[_0x98ba('0x12')][_0x98ba('0x118')](db['SmsQueue'],{'as':_0x98ba('0x12c'),'through':_0x98ba('0x12d'),'required':![]});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x12e')],{'as':_0x98ba('0x12f'),'through':_0x98ba('0x30'),'required':![]});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0xf8')],{'as':'WhatsappQueues','through':_0x98ba('0x31'),'required':![]});db['User'][_0x98ba('0x118')](db['CmList'],{'through':_0x98ba('0x11d')});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x56')],{'as':_0x98ba('0x130'),'through':_0x98ba('0x131')});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x43')],{'as':'FaxAccounts','through':_0x98ba('0x132')});db[_0x98ba('0x12')]['belongsToMany'](db[_0x98ba('0x35')],{'as':_0x98ba('0x133'),'through':_0x98ba('0x134')});db[_0x98ba('0x12')][_0x98ba('0x118')](db[_0x98ba('0x4f')],{'as':_0x98ba('0x135'),'through':_0x98ba('0x136')});db['User']['belongsToMany'](db[_0x98ba('0x49')],{'as':_0x98ba('0x137'),'through':_0x98ba('0x138')});db['User'][_0x98ba('0x118')](db[_0x98ba('0xf0')],{'as':'WhatsappAccounts','through':_0x98ba('0x139')});db['VoiceChanSpy'][_0x98ba('0x108')](db[_0x98ba('0x17')],{'as':_0x98ba('0x13a'),'onDelete':'cascade','foreignKey':_0x98ba('0x13b')});db[_0x98ba('0x13c')]['hasMany'](db[_0x98ba('0x17')],{'onDelete':'cascade'});db[_0x98ba('0x17')][_0x98ba('0x108')](db[_0x98ba('0x17')],{'as':_0x98ba('0x13d'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x13e')][_0x98ba('0x118')](db[_0x98ba('0x7e')],{'as':_0x98ba('0x13f'),'through':'moh_has_sounds'});db[_0x98ba('0x1a')][_0x98ba('0x108')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x98ba('0x140')});db[_0x98ba('0x1a')][_0x98ba('0x108')](db[_0x98ba('0x6a')],{'as':_0x98ba('0x115'),'foreignKey':_0x98ba('0x140')});db[_0x98ba('0x1a')][_0x98ba('0x108')](db[_0x98ba('0x10b')],{'as':'HopperFinals','foreignKey':_0x98ba('0x140')});db[_0x98ba('0x1a')]['hasMany'](db[_0x98ba('0x6c')],{'as':'HopperHistories','foreignKey':_0x98ba('0x140')});db[_0x98ba('0x1a')][_0x98ba('0x108')](db[_0x98ba('0x6d')],{'as':_0x98ba('0x6d'),'foreignKey':_0x98ba('0x140')});db[_0x98ba('0x1a')][_0x98ba('0x108')](db[_0x98ba('0x141')],{'as':_0x98ba('0x142'),'foreignKey':_0x98ba('0x140')});db[_0x98ba('0x1a')]['hasMany'](db['JscriptySessionReport'],{'as':_0x98ba('0x143'),'foreignKey':_0x98ba('0x140')});db[_0x98ba('0x1a')]['belongsTo'](db[_0x98ba('0x26')],{'as':_0x98ba('0x26'),'foreignKey':_0x98ba('0x144')});db[_0x98ba('0x1a')]['belongsTo'](db[_0x98ba('0x26')],{'as':_0x98ba('0x145'),'foreignKey':_0x98ba('0x146')});db['VoiceQueue'][_0x98ba('0x117')](db[_0x98ba('0x76')],{'as':_0x98ba('0x76'),'foreignKey':_0x98ba('0x147')});db[_0x98ba('0x1a')][_0x98ba('0x117')](db[_0x98ba('0x78')],{'as':_0x98ba('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x98ba('0x1a')][_0x98ba('0x118')](db['CmList'],{'as':_0x98ba('0x11c'),'through':_0x98ba('0x149')});db[_0x98ba('0x1a')][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':'Agents','through':_0x98ba('0x2a')});db[_0x98ba('0x1a')][_0x98ba('0x118')](db[_0x98ba('0x11e')],{'as':_0x98ba('0x14a'),'through':_0x98ba('0xfc')});db[_0x98ba('0x1a')]['belongsToMany'](db['CmList'],{'as':_0x98ba('0x14b'),'through':'voice_queues_has_cm_blacklists'});db[_0x98ba('0x1c')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'as':'User','foreignKey':_0x98ba('0x103')});db[_0x98ba('0x1d')][_0x98ba('0x117')](db['User'],{'as':_0x98ba('0x12'),'foreignKey':_0x98ba('0x103')});db[_0x98ba('0x102')][_0x98ba('0x108')](db['VoiceMailMessage'],{'as':_0x98ba('0x14c'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x14d'),'sourceKey':_0x98ba('0x14e')});db[_0x98ba('0x1f')][_0x98ba('0x117')](db['VoiceMail'],{'foreignKey':_0x98ba('0x14d'),'targetKey':'mailbox'});db[_0x98ba('0x21')][_0x98ba('0x108')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x98ba('0x14f'),'constraints':![]});db['VoiceCallReport']['hasMany'](db['VoiceAgentReport'],{'as':_0x98ba('0x150'),'foreignKey':_0x98ba('0x14f'),'constraints':![]});db['VoiceCallReport'][_0x98ba('0x117')](db['User'],{'as':_0x98ba('0x12'),'foreignKey':'UserId'});db[_0x98ba('0x21')]['belongsTo'](db[_0x98ba('0x68')],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0x32')][_0x98ba('0x117')](db[_0x98ba('0x35')],{'as':_0x98ba('0x35'),'foreignKey':_0x98ba('0x153')});db['MailServerIn']['belongsTo'](db[_0x98ba('0xfa')],{'as':_0x98ba('0xfa'),'foreignKey':_0x98ba('0x154'),'onDelete':_0x98ba('0x155')});db['MailServerOut']['belongsTo'](db[_0x98ba('0x35')],{'as':_0x98ba('0x35'),'foreignKey':_0x98ba('0x153')});db[_0x98ba('0x33')][_0x98ba('0x117')](db[_0x98ba('0xfa')],{'as':_0x98ba('0xfa'),'foreignKey':_0x98ba('0x154'),'onDelete':_0x98ba('0x155')});db[_0x98ba('0x35')][_0x98ba('0x101')](db['MailServerIn'],{'as':_0x98ba('0x156'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x35')][_0x98ba('0x101')](db[_0x98ba('0x33')],{'as':_0x98ba('0x157'),'onDelete':_0x98ba('0x106')});db['MailAccount'][_0x98ba('0x108')](db[_0x98ba('0x73')],{'as':_0x98ba('0x158'),'foreignKey':'MailAccountId','onDelete':_0x98ba('0x106')});db[_0x98ba('0x35')][_0x98ba('0x108')](db[_0x98ba('0x72')],{'as':_0x98ba('0x159'),'foreignKey':_0x98ba('0x153')});db[_0x98ba('0x35')]['hasMany'](db[_0x98ba('0x3c')],{'as':_0x98ba('0x14c'),'foreignKey':'MailAccountId'});db[_0x98ba('0x35')][_0x98ba('0x108')](db['MailInteraction'],{'as':_0x98ba('0x15a')});db[_0x98ba('0x35')][_0x98ba('0x108')](db['MailApplication'],{'as':_0x98ba('0x13d'),'foreignKey':_0x98ba('0x153'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x35')][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':'List','foreignKey':_0x98ba('0x15b')});db['MailAccount'][_0x98ba('0x117')](db['Template'],{'as':_0x98ba('0x15c'),'foreignKey':_0x98ba('0x15d')});db[_0x98ba('0x35')]['belongsTo'](db[_0x98ba('0x78')],{'as':_0x98ba('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x98ba('0x35')]['belongsToMany'](db[_0x98ba('0x12')],{'as':_0x98ba('0x15e'),'through':_0x98ba('0x134')});db[_0x98ba('0x37')][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':_0x98ba('0x15e'),'through':'UserMailQueue'});db['MailQueue'][_0x98ba('0x118')](db[_0x98ba('0x11e')],{'through':_0x98ba('0x15f'),'as':'Teams'});db[_0x98ba('0x3b')]['hasMany'](db['MailMessage'],{'as':_0x98ba('0x14c'),'onDelete':'cascade','foreignKey':_0x98ba('0x160')});db[_0x98ba('0x3b')][_0x98ba('0x117')](db[_0x98ba('0x35')],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x153')});db[_0x98ba('0x3b')]['belongsTo'](db[_0x98ba('0x68')],{'as':'Contact','foreignKey':_0x98ba('0x152')});db['MailInteraction'][_0x98ba('0x117')](db[_0x98ba('0x12')],{'as':'Owner','foreignKey':_0x98ba('0x103')});db[_0x98ba('0x3b')]['belongsToMany'](db[_0x98ba('0x162')],{'through':_0x98ba('0x163'),'as':_0x98ba('0x164')});db[_0x98ba('0x3b')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':'mail_interaction_has_tags','as':_0x98ba('0x165')});db[_0x98ba('0x3b')][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':'Users','through':_0x98ba('0x121'),'foreignKey':_0x98ba('0x160')});db['MailMessage'][_0x98ba('0x108')](db['Attachment'],{'as':_0x98ba('0x166'),'onDelete':'cascade'});db[_0x98ba('0x3c')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'as':'User'});db[_0x98ba('0x3c')][_0x98ba('0x117')](db['CmContact'],{'onDelete':_0x98ba('0x106'),'as':_0x98ba('0x151')});db[_0x98ba('0x3c')][_0x98ba('0x117')](db[_0x98ba('0x3b')],{'as':_0x98ba('0x167'),'foreignKey':_0x98ba('0x160')});db[_0x98ba('0x3c')]['belongsTo'](db[_0x98ba('0x35')],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x153')});db[_0x98ba('0x3c')]['belongsTo'](db[_0x98ba('0x56')],{'as':_0x98ba('0x56'),'foreignKey':_0x98ba('0x168')});db[_0x98ba('0x3c')]['belongsTo'](db[_0x98ba('0x5f')],{'as':'ChatOfflineMessage','foreignKey':_0x98ba('0x169')});db['MailApplication'][_0x98ba('0x117')](db[_0x98ba('0x12')],{'onDelete':_0x98ba('0x155')});db[_0x98ba('0x16a')][_0x98ba('0x117')](db['MailQueue'],{'onDelete':_0x98ba('0x155')});db['MailApplication'][_0x98ba('0x117')](db[_0x98ba('0x35')],{'onDelete':_0x98ba('0x155')});db[_0x98ba('0x16a')]['belongsTo'](db[_0x98ba('0x76')],{'onDelete':_0x98ba('0x155'),'foreignKey':_0x98ba('0x147')});db['MailApplication'][_0x98ba('0x117')](db['Tag'],{'onDelete':_0x98ba('0x155'),'foreignKey':_0x98ba('0x16b')});db[_0x98ba('0x3f')]['belongsTo'](db[_0x98ba('0x35')],{});db[_0x98ba('0x3f')][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':_0x98ba('0x16c'),'foreignKey':_0x98ba('0x15b')});db['MailQueueReport'][_0x98ba('0x117')](db[_0x98ba('0x68')],{'as':'Contact','foreignKey':'ContactId'});db[_0x98ba('0x3f')]['belongsTo'](db[_0x98ba('0x3b')],{});db['MailQueueReport'][_0x98ba('0x117')](db[_0x98ba('0x3c')],{});db[_0x98ba('0x3f')][_0x98ba('0x117')](db[_0x98ba('0x12')],{});db['MailQueueReport']['belongsTo'](db[_0x98ba('0x37')],{});db[_0x98ba('0x40')][_0x98ba('0x108')](db['DashboardItem'],{'as':_0x98ba('0x16d'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x43')][_0x98ba('0x108')](db['Disposition'],{'as':_0x98ba('0x158'),'foreignKey':_0x98ba('0x16e'),'onDelete':_0x98ba('0x106')});db['FaxAccount'][_0x98ba('0x108')](db[_0x98ba('0x72')],{'as':'Answers','foreignKey':_0x98ba('0x16e')});db[_0x98ba('0x43')][_0x98ba('0x108')](db[_0x98ba('0x110')],{'as':'Interactions'});db[_0x98ba('0x43')][_0x98ba('0x108')](db[_0x98ba('0x16f')],{'as':_0x98ba('0x13d'),'foreignKey':'FaxAccountId','onDelete':_0x98ba('0x106')});db['FaxAccount'][_0x98ba('0x108')](db['VoiceExtension'],{'as':_0x98ba('0x170'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x43')][_0x98ba('0x108')](db['FaxMessage'],{'as':_0x98ba('0x14c')});db[_0x98ba('0x43')][_0x98ba('0x117')](db[_0x98ba('0x26')],{'as':_0x98ba('0x26')});db[_0x98ba('0x43')][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':_0x98ba('0x16c'),'foreignKey':_0x98ba('0x15b')});db[_0x98ba('0x43')]['belongsTo'](db[_0x98ba('0x78')],{'as':'mandatoryDispositionPause','foreignKey':_0x98ba('0x171')});db['FaxAccount'][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':_0x98ba('0x15e'),'through':_0x98ba('0x132')});db[_0x98ba('0x16f')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'onDelete':'restrict'});db['FaxApplication'][_0x98ba('0x117')](db[_0x98ba('0x45')],{'onDelete':_0x98ba('0x155')});db[_0x98ba('0x16f')]['belongsTo'](db[_0x98ba('0x43')],{'onDelete':'restrict'});db[_0x98ba('0x16f')][_0x98ba('0x117')](db[_0x98ba('0x162')],{'onDelete':'restrict','foreignKey':_0x98ba('0x16b')});db[_0x98ba('0x110')][_0x98ba('0x108')](db[_0x98ba('0x172')],{'as':_0x98ba('0x14c'),'onDelete':'cascade','foreignKey':_0x98ba('0x173')});db['FaxInteraction'][_0x98ba('0x117')](db[_0x98ba('0x43')],{'as':_0x98ba('0x161'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x98ba('0x117')](db[_0x98ba('0x68')],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0x110')][_0x98ba('0x117')](db['User'],{'as':_0x98ba('0x174'),'foreignKey':_0x98ba('0x103')});db[_0x98ba('0x110')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':_0x98ba('0x175'),'as':_0x98ba('0x164')});db['FaxInteraction'][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':_0x98ba('0x175'),'as':_0x98ba('0x165')});db[_0x98ba('0x110')]['belongsToMany'](db[_0x98ba('0x12')],{'as':_0x98ba('0x176'),'through':'user_has_fax_interactions','foreignKey':_0x98ba('0x173')});db['FaxMessage']['belongsTo'](db[_0x98ba('0x12')],{'onDelete':_0x98ba('0x106'),'as':_0x98ba('0x12')});db[_0x98ba('0x172')][_0x98ba('0x117')](db[_0x98ba('0x110')],{'as':_0x98ba('0x167'),'foreignKey':_0x98ba('0x173')});db[_0x98ba('0x172')][_0x98ba('0x117')](db[_0x98ba('0x68')],{'onDelete':'cascade','as':_0x98ba('0x151')});db[_0x98ba('0x172')][_0x98ba('0x117')](db[_0x98ba('0x177')],{'as':_0x98ba('0x177'),'foreignKey':'AttachmentId'});db[_0x98ba('0x172')][_0x98ba('0x117')](db[_0x98ba('0x43')],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x16e')});db[_0x98ba('0x45')][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':_0x98ba('0x15e'),'through':_0x98ba('0x12b')});db[_0x98ba('0x45')]['belongsToMany'](db['Team'],{'through':'team_has_fax_queues','as':_0x98ba('0x14a')});db['FaxQueueReport'][_0x98ba('0x117')](db[_0x98ba('0x43')],{});db[_0x98ba('0x47')][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':_0x98ba('0x16c'),'foreignKey':_0x98ba('0x15b')});db[_0x98ba('0x47')][_0x98ba('0x117')](db['CmContact'],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0x47')]['belongsTo'](db[_0x98ba('0x110')],{});db[_0x98ba('0x47')][_0x98ba('0x117')](db[_0x98ba('0x172')],{});db[_0x98ba('0x47')]['belongsTo'](db['User'],{});db[_0x98ba('0x47')]['belongsTo'](db[_0x98ba('0x45')],{});db['SmsAccount'][_0x98ba('0x108')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x98ba('0x178'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x49')][_0x98ba('0x108')](db[_0x98ba('0x72')],{'as':_0x98ba('0x159'),'foreignKey':_0x98ba('0x178')});db[_0x98ba('0x49')][_0x98ba('0x108')](db[_0x98ba('0x179')],{'as':'Messages','foreignKey':'SmsAccountId'});db['SmsAccount'][_0x98ba('0x108')](db['SmsInteraction'],{'as':_0x98ba('0x15a')});db[_0x98ba('0x49')][_0x98ba('0x108')](db[_0x98ba('0x17a')],{'as':_0x98ba('0x13d'),'foreignKey':_0x98ba('0x178'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x49')][_0x98ba('0x117')](db['CmList'],{'as':'List','foreignKey':_0x98ba('0x15b')});db[_0x98ba('0x49')][_0x98ba('0x117')](db[_0x98ba('0x78')],{'as':_0x98ba('0x148'),'foreignKey':_0x98ba('0x171')});db[_0x98ba('0x49')][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':_0x98ba('0x15e'),'through':_0x98ba('0x138')});db[_0x98ba('0x17a')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x98ba('0x17a')][_0x98ba('0x117')](db[_0x98ba('0x4d')],{'onDelete':_0x98ba('0x155')});db['SmsApplication']['belongsTo'](db['SmsAccount'],{'onDelete':_0x98ba('0x155')});db[_0x98ba('0x17a')]['belongsTo'](db[_0x98ba('0x76')],{'onDelete':'restrict','foreignKey':_0x98ba('0x147')});db[_0x98ba('0x17a')]['belongsTo'](db[_0x98ba('0x162')],{'onDelete':_0x98ba('0x155'),'foreignKey':_0x98ba('0x16b')});db['SmsInteraction'][_0x98ba('0x108')](db[_0x98ba('0x179')],{'as':_0x98ba('0x14c'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x17b')});db[_0x98ba('0x4c')][_0x98ba('0x117')](db[_0x98ba('0x49')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x98ba('0x4c')][_0x98ba('0x117')](db['CmContact'],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0x4c')][_0x98ba('0x117')](db['User'],{'as':'Owner','foreignKey':_0x98ba('0x103')});db[_0x98ba('0x4c')][_0x98ba('0x118')](db['Tag'],{'through':_0x98ba('0x17c'),'as':_0x98ba('0x164')});db[_0x98ba('0x4c')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':'sms_interaction_has_tags','as':_0x98ba('0x165')});db[_0x98ba('0x4c')][_0x98ba('0x118')](db['User'],{'as':'Users','through':_0x98ba('0x17d'),'foreignKey':_0x98ba('0x17b')});db['SmsMessage'][_0x98ba('0x117')](db['User'],{'as':_0x98ba('0x12')});db[_0x98ba('0x179')][_0x98ba('0x117')](db[_0x98ba('0x68')],{'onDelete':_0x98ba('0x106'),'as':_0x98ba('0x151')});db['SmsMessage'][_0x98ba('0x117')](db[_0x98ba('0x4c')],{'onDelete':_0x98ba('0x106'),'as':_0x98ba('0x167'),'foreignKey':_0x98ba('0x17b')});db[_0x98ba('0x179')][_0x98ba('0x117')](db['SmsAccount'],{'as':'Account','foreignKey':_0x98ba('0x178')});db[_0x98ba('0x4d')][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':'Agents','through':_0x98ba('0x12d'),'foreignKey':'SmsQueueId'});db[_0x98ba('0x4d')][_0x98ba('0x118')](db['Team'],{'through':_0x98ba('0x17e'),'as':'Teams'});db[_0x98ba('0x4f')][_0x98ba('0x108')](db[_0x98ba('0x73')],{'as':'Dispositions','foreignKey':_0x98ba('0x17f'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x4f')][_0x98ba('0x108')](db[_0x98ba('0x72')],{'as':_0x98ba('0x159'),'foreignKey':'OpenchannelAccountId'});db[_0x98ba('0x4f')][_0x98ba('0x108')](db[_0x98ba('0x53')],{'as':_0x98ba('0x15a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db['OpenchannelMessage'],{'as':_0x98ba('0x14c'),'foreignKey':_0x98ba('0x17f')});db[_0x98ba('0x4f')][_0x98ba('0x108')](db['OpenchannelApplication'],{'as':_0x98ba('0x13d'),'foreignKey':_0x98ba('0x17f'),'onDelete':_0x98ba('0x106')});db['OpenchannelAccount'][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':'List','foreignKey':_0x98ba('0x15b')});db[_0x98ba('0x4f')][_0x98ba('0x117')](db['Pause'],{'as':_0x98ba('0x148'),'foreignKey':_0x98ba('0x171')});db['OpenchannelAccount'][_0x98ba('0x118')](db['User'],{'as':_0x98ba('0x15e'),'through':_0x98ba('0x136')});db[_0x98ba('0x51')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'onDelete':_0x98ba('0x155')});db[_0x98ba('0x51')][_0x98ba('0x117')](db['OpenchannelQueue'],{'onDelete':_0x98ba('0x155'),'foreignKey':_0x98ba('0x180')});db['OpenchannelApplication'][_0x98ba('0x117')](db[_0x98ba('0x4f')],{'onDelete':_0x98ba('0x155'),'foreignKey':_0x98ba('0x17f')});db[_0x98ba('0x51')]['belongsTo'](db['Interval'],{'onDelete':_0x98ba('0x155'),'foreignKey':_0x98ba('0x147')});db[_0x98ba('0x51')][_0x98ba('0x117')](db[_0x98ba('0x162')],{'onDelete':'restrict','foreignKey':_0x98ba('0x16b')});db['OpenchannelInteraction']['hasMany'](db[_0x98ba('0x181')],{'as':_0x98ba('0x14c'),'onDelete':'cascade','foreignKey':_0x98ba('0x182')});db[_0x98ba('0x53')][_0x98ba('0x117')](db[_0x98ba('0x4f')],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x17f')});db[_0x98ba('0x53')]['belongsTo'](db['CmContact'],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0x53')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'as':_0x98ba('0x174'),'foreignKey':'UserId'});db[_0x98ba('0x53')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':'openchannel_interaction_has_tags','as':_0x98ba('0x164')});db[_0x98ba('0x53')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':'openchannel_interaction_has_tags','as':_0x98ba('0x165')});db[_0x98ba('0x53')][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':'Users','through':_0x98ba('0x126'),'foreignKey':_0x98ba('0x182')});db[_0x98ba('0x181')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'onDelete':_0x98ba('0x106'),'as':_0x98ba('0x12')});db[_0x98ba('0x181')][_0x98ba('0x117')](db[_0x98ba('0x68')],{'onDelete':_0x98ba('0x106'),'as':_0x98ba('0x151')});db[_0x98ba('0x181')][_0x98ba('0x117')](db[_0x98ba('0x53')],{'onDelete':_0x98ba('0x106'),'as':_0x98ba('0x167'),'foreignKey':_0x98ba('0x182')});db[_0x98ba('0x181')][_0x98ba('0x117')](db[_0x98ba('0x177')],{'as':_0x98ba('0x177'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x98ba('0x117')](db[_0x98ba('0x4f')],{'as':_0x98ba('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0x98ba('0x12e')]['belongsToMany'](db[_0x98ba('0x12')],{'as':_0x98ba('0x15e'),'through':_0x98ba('0x30'),'foreignKey':_0x98ba('0x180')});db['OpenchannelQueue'][_0x98ba('0x118')](db[_0x98ba('0x11e')],{'through':_0x98ba('0x183'),'as':_0x98ba('0x14a')});db[_0x98ba('0x56')][_0x98ba('0x108')](db[_0x98ba('0x73')],{'as':_0x98ba('0x158'),'foreignKey':_0x98ba('0x168'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x56')][_0x98ba('0x108')](db[_0x98ba('0x72')],{'as':_0x98ba('0x159'),'foreignKey':_0x98ba('0x168')});db['ChatWebsite'][_0x98ba('0x108')](db[_0x98ba('0x65')],{'as':'ProactiveActions'});db[_0x98ba('0x56')][_0x98ba('0x108')](db[_0x98ba('0x5c')],{'as':_0x98ba('0x15a')});db[_0x98ba('0x56')][_0x98ba('0x108')](db[_0x98ba('0x5a')],{'as':_0x98ba('0x13d'),'foreignKey':_0x98ba('0x168'),'onDelete':'cascade'});db[_0x98ba('0x56')][_0x98ba('0x108')](db[_0x98ba('0x5e')],{'as':_0x98ba('0x14c')});db[_0x98ba('0x56')]['belongsTo'](db[_0x98ba('0xe8')],{'as':_0x98ba('0x16c'),'foreignKey':'ListId'});db[_0x98ba('0x56')][_0x98ba('0x117')](db[_0x98ba('0x76')],{'as':_0x98ba('0x76'),'foreignKey':_0x98ba('0x147')});db['ChatWebsite'][_0x98ba('0x117')](db[_0x98ba('0x35')],{'as':_0x98ba('0x35'),'foreignKey':_0x98ba('0x153')});db[_0x98ba('0x56')][_0x98ba('0x117')](db[_0x98ba('0x78')],{'as':_0x98ba('0x148'),'foreignKey':_0x98ba('0x171')});db[_0x98ba('0x56')][_0x98ba('0x118')](db['User'],{'as':_0x98ba('0x15e'),'through':_0x98ba('0x131')});db[_0x98ba('0x58')][_0x98ba('0x117')](db[_0x98ba('0x4f')],{});db[_0x98ba('0x58')][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':'List','foreignKey':_0x98ba('0x15b')});db['OpenchannelQueueReport'][_0x98ba('0x117')](db[_0x98ba('0x68')],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0x58')][_0x98ba('0x117')](db[_0x98ba('0x53')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x98ba('0x181')],{});db[_0x98ba('0x58')][_0x98ba('0x117')](db[_0x98ba('0x12')],{});db[_0x98ba('0x58')][_0x98ba('0x117')](db[_0x98ba('0x12e')],{});db[_0x98ba('0x5a')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'as':_0x98ba('0x184'),'foreignKey':_0x98ba('0x103'),'onDelete':'restrict'});db[_0x98ba('0x5a')][_0x98ba('0x117')](db['ChatQueue'],{'as':_0x98ba('0x185'),'foreignKey':_0x98ba('0x186'),'onDelete':_0x98ba('0x155')});db['ChatApplication'][_0x98ba('0x117')](db['ChatWebsite'],{'as':_0x98ba('0x187'),'foreignKey':_0x98ba('0x168'),'onDelete':_0x98ba('0x155')});db[_0x98ba('0x5a')]['belongsTo'](db['Tag'],{'onDelete':_0x98ba('0x155'),'foreignKey':_0x98ba('0x16b')});db[_0x98ba('0x5c')][_0x98ba('0x108')](db[_0x98ba('0x5e')],{'as':_0x98ba('0x14c'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x188')});db[_0x98ba('0x5c')]['belongsTo'](db[_0x98ba('0x56')],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x168')});db[_0x98ba('0x5c')][_0x98ba('0x117')](db['CmContact'],{'as':_0x98ba('0x151'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x98ba('0x117')](db[_0x98ba('0x12')],{'as':_0x98ba('0x174'),'foreignKey':_0x98ba('0x103')});db[_0x98ba('0x5c')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':_0x98ba('0x189'),'as':'Tags'});db['ChatInteraction']['belongsToMany'](db[_0x98ba('0x162')],{'through':'chat_interaction_has_tags','as':_0x98ba('0x165')});db['ChatInteraction']['belongsToMany'](db[_0x98ba('0x12')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x98ba('0x188')});db[_0x98ba('0x5e')]['belongsTo'](db[_0x98ba('0x12')],{'onDelete':_0x98ba('0x106'),'as':_0x98ba('0x12')});db[_0x98ba('0x5e')][_0x98ba('0x117')](db[_0x98ba('0x68')],{'onDelete':'cascade','as':_0x98ba('0x151'),'foreignKey':'ContactId'});db[_0x98ba('0x5e')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0x98ba('0x106'),'as':_0x98ba('0x167'),'foreignKey':'ChatInteractionId'});db[_0x98ba('0x5e')][_0x98ba('0x117')](db[_0x98ba('0x177')],{'as':_0x98ba('0x177'),'foreignKey':_0x98ba('0x18a')});db[_0x98ba('0x5e')]['belongsTo'](db[_0x98ba('0x56')],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x168')});db[_0x98ba('0x5f')][_0x98ba('0x108')](db[_0x98ba('0x177')],{'as':_0x98ba('0x166'),'foreignKey':_0x98ba('0x169'),'onDelete':_0x98ba('0x106'),'hooks':!![]});db[_0x98ba('0x5f')]['belongsTo'](db[_0x98ba('0x68')],{'onDelete':'cascade','as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0x5f')][_0x98ba('0x117')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x98ba('0x168')});db[_0x98ba('0x61')]['belongsToMany'](db['User'],{'as':_0x98ba('0x15e'),'through':_0x98ba('0x2b'),'hooks':!![]});db['ChatQueue'][_0x98ba('0x118')](db[_0x98ba('0x11e')],{'through':_0x98ba('0x18b'),'as':_0x98ba('0x14a')});db['ChatGroup'][_0x98ba('0x108')](db[_0x98ba('0xc8')],{'as':_0x98ba('0x14c'),'foreignKey':_0x98ba('0x18c'),'onDelete':_0x98ba('0x106')});db['ChatGroup'][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':_0x98ba('0x18d'),'through':_0x98ba('0x11a')});db['ChatProactiveAction']['belongsTo'](db[_0x98ba('0x56')],{'as':_0x98ba('0x187'),'foreignKey':_0x98ba('0x168')});db['CmCompany']['hasMany'](db[_0x98ba('0x68')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x98ba('0x68')]['hasMany'](db[_0x98ba('0x18e')],{'as':'Phones','foreignKey':_0x98ba('0x18f')});db[_0x98ba('0x68')][_0x98ba('0x108')](db[_0x98ba('0x6a')],{'as':_0x98ba('0x115'),'foreignKey':'ContactId'});db[_0x98ba('0x68')][_0x98ba('0x108')](db[_0x98ba('0x10b')],{'as':_0x98ba('0x10c'),'foreignKey':'ContactId'});db[_0x98ba('0x68')][_0x98ba('0x108')](db[_0x98ba('0x6c')],{'as':_0x98ba('0x190'),'foreignKey':'ContactId'});db[_0x98ba('0x68')]['hasMany'](db[_0x98ba('0x6d')],{'as':_0x98ba('0x6d'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0x68')][_0x98ba('0x108')](db[_0x98ba('0x191')],{'as':_0x98ba('0x143'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0x68')][_0x98ba('0x108')](db[_0x98ba('0x53')],{'as':_0x98ba('0x10e'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x98ba('0x108')](db[_0x98ba('0x5c')],{'as':_0x98ba('0x122'),'foreignKey':_0x98ba('0x152'),'onDelete':'restrict'});db[_0x98ba('0x68')][_0x98ba('0x108')](db['SmsInteraction'],{'as':_0x98ba('0x10f'),'foreignKey':_0x98ba('0x152'),'onDelete':_0x98ba('0x155')});db[_0x98ba('0x68')][_0x98ba('0x108')](db[_0x98ba('0x110')],{'as':_0x98ba('0x124'),'foreignKey':_0x98ba('0x152'),'onDelete':_0x98ba('0x155')});db['CmContact']['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x98ba('0x152'),'onDelete':_0x98ba('0x155')});db[_0x98ba('0x68')][_0x98ba('0x117')](db[_0x98ba('0x67')],{'as':_0x98ba('0x192'),'foreignKey':'CompanyId'});db[_0x98ba('0x68')][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':_0x98ba('0x16c'),'foreignKey':'ListId','onDelete':_0x98ba('0x106')});db[_0x98ba('0x68')][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':_0x98ba('0x176'),'through':'cm_user_has_contacts'});db[_0x98ba('0x68')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'as':_0x98ba('0x164'),'through':_0x98ba('0x193')});db[_0x98ba('0x68')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':_0x98ba('0x193'),'as':_0x98ba('0x165')});db[_0x98ba('0x6a')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0x98ba('0x194'),'foreignKey':_0x98ba('0x195')});db[_0x98ba('0x6a')][_0x98ba('0x117')](db['CmContact'],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152'),'onDelete':'cascade'});db[_0x98ba('0x6a')][_0x98ba('0x117')](db['CmList'],{'as':'List','foreignKey':_0x98ba('0x15b'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x6a')]['belongsTo'](db[_0x98ba('0x12')],{'as':_0x98ba('0x184'),'foreignKey':_0x98ba('0x103')});db['CmHopper'][_0x98ba('0x117')](db[_0x98ba('0x1a')],{'as':_0x98ba('0x185'),'foreignKey':_0x98ba('0x140'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x6a')][_0x98ba('0x117')](db[_0x98ba('0xdb')],{'as':_0x98ba('0xdb'),'foreignKey':_0x98ba('0x196'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x6a')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'as':_0x98ba('0x174'),'foreignKey':_0x98ba('0x197')});db['CmHopperBlack'][_0x98ba('0x117')](db[_0x98ba('0x68')],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152'),'onDelete':'cascade'});db['CmHopperBlack'][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':_0x98ba('0x16c'),'foreignKey':_0x98ba('0x15b'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x141')][_0x98ba('0x117')](db[_0x98ba('0x1a')],{'as':'Queue','foreignKey':_0x98ba('0x140'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x141')][_0x98ba('0x117')](db['Campaign'],{'as':_0x98ba('0xdb'),'foreignKey':_0x98ba('0x196'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x70')][_0x98ba('0x108')](db[_0x98ba('0x75')],{'as':{'plural':_0x98ba('0x198'),'singular':'OneAll'},'foreignKey':_0x98ba('0x199'),'onDelete':_0x98ba('0x106'),'hooks':!![]});db['Automation'][_0x98ba('0x108')](db[_0x98ba('0x75')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x98ba('0x19a'),'onDelete':_0x98ba('0x106'),'hooks':!![]});db[_0x98ba('0x70')][_0x98ba('0x108')](db[_0x98ba('0x19b')],{'as':_0x98ba('0x19c'),'foreignKey':'AutomationId','onDelete':_0x98ba('0x106'),'hooks':!![]});db[_0x98ba('0x73')]['hasMany'](db[_0x98ba('0x73')],{'as':_0x98ba('0x158'),'foreignKey':_0x98ba('0x19d'),'onDelete':'cascade'});db[_0x98ba('0x76')][_0x98ba('0x108')](db['Interval'],{'as':'Intervals','foreignKey':_0x98ba('0x147'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x98ba('0x108')](db[_0x98ba('0x17')],{'as':_0x98ba('0x10a'),'foreignKey':_0x98ba('0x147'),'onDelete':_0x98ba('0x155')});db[_0x98ba('0x76')][_0x98ba('0x108')](db[_0x98ba('0x16a')],{'as':_0x98ba('0x19e'),'foreignKey':_0x98ba('0x147')});db['Interval'][_0x98ba('0x108')](db[_0x98ba('0x5a')],{'as':_0x98ba('0x19f'),'foreignKey':_0x98ba('0x147')});db[_0x98ba('0x76')][_0x98ba('0x108')](db[_0x98ba('0x16f')],{'as':_0x98ba('0x1a0'),'foreignKey':_0x98ba('0x147')});db['Interval'][_0x98ba('0x108')](db[_0x98ba('0x17a')],{'as':_0x98ba('0x1a1'),'foreignKey':_0x98ba('0x147')});db[_0x98ba('0x1a2')]['belongsTo'](db[_0x98ba('0x35')],{});db[_0x98ba('0x1a2')][_0x98ba('0x117')](db[_0x98ba('0x8e')],{'foreignKey':_0x98ba('0x1a3')});db[_0x98ba('0x1a2')]['belongsTo'](db[_0x98ba('0x8c')],{'foreignKey':_0x98ba('0x1a4')});db[_0x98ba('0x7e')][_0x98ba('0x118')](db[_0x98ba('0x13e')],{'as':_0x98ba('0x1a5'),'through':_0x98ba('0x1a6'),'onDelete':'restrict'});db[_0x98ba('0x162')][_0x98ba('0x118')](db[_0x98ba('0x68')],{'through':_0x98ba('0x193')});db['Tag'][_0x98ba('0x118')](db[_0x98ba('0x5c')],{'through':_0x98ba('0x189')});db[_0x98ba('0x162')]['belongsToMany'](db[_0x98ba('0x3b')],{'through':_0x98ba('0x163')});db['Tag'][_0x98ba('0x118')](db[_0x98ba('0x4c')],{'through':_0x98ba('0x17c')});db[_0x98ba('0x162')][_0x98ba('0x118')](db[_0x98ba('0x110')],{'through':'fax_interaction_has_tags'});db[_0x98ba('0x162')][_0x98ba('0x118')](db[_0x98ba('0x53')],{'through':'openchannel_interaction_has_tags'});db[_0x98ba('0x162')][_0x98ba('0x118')](db[_0x98ba('0x111')],{'through':_0x98ba('0x1a7')});db[_0x98ba('0x18e')][_0x98ba('0x117')](db[_0x98ba('0x80')],{'as':_0x98ba('0x1a8'),'foreignKey':_0x98ba('0x1a9')});db[_0x98ba('0x1aa')][_0x98ba('0x117')](db[_0x98ba('0x6a')],{'as':_0x98ba('0x1ab'),'foreignKey':_0x98ba('0x195')});db['CmContactHasItem'][_0x98ba('0x117')](db[_0x98ba('0x68')],{'as':'Contact','foreignKey':_0x98ba('0x18f')});db['Trigger']['hasMany'](db['Condition'],{'as':{'plural':_0x98ba('0x1ac'),'singular':_0x98ba('0x1ad')},'foreignKey':_0x98ba('0x1ae'),'onDelete':_0x98ba('0x106'),'hooks':!![]});db['Trigger'][_0x98ba('0x108')](db[_0x98ba('0x75')],{'as':{'plural':_0x98ba('0x1af'),'singular':_0x98ba('0x1b0')},'foreignKey':'TriggerAnyId','onDelete':_0x98ba('0x106'),'hooks':!![]});db[_0x98ba('0x85')][_0x98ba('0x108')](db[_0x98ba('0x19b')],{'as':_0x98ba('0x19c'),'foreignKey':_0x98ba('0x1b1'),'onDelete':_0x98ba('0x106'),'hooks':!![]});db[_0x98ba('0x8c')][_0x98ba('0x108')](db['AnalyticFieldReport'],{'as':_0x98ba('0x1b2'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1a4'),'hooks':!![]});db[_0x98ba('0x8e')][_0x98ba('0x108')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1a3')});db[_0x98ba('0x91')][_0x98ba('0x108')](db[_0x98ba('0x92')],{'as':_0x98ba('0x1b2'),'onDelete':_0x98ba('0x106'),'foreignKey':'MetricId'});db[_0x98ba('0x92')][_0x98ba('0x117')](db['AnalyticMetric'],{'foreignKey':_0x98ba('0x1b3')});db[_0x98ba('0x96')][_0x98ba('0x108')](db[_0x98ba('0x98')],{'as':_0x98ba('0x1b4'),'onDelete':'cascade','foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0x98')]['hasMany'](db['SalesforceField'],{'as':'Subjects','onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0x98')][_0x98ba('0x108')](db[_0x98ba('0x9a')],{'as':_0x98ba('0x1b7'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b8')});db['SalesforceConfiguration'][_0x98ba('0x108')](db[_0x98ba('0x9a')],{'as':_0x98ba('0x1b2'),'onDelete':'cascade','foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0x98')]['belongsTo'](db['SalesforceAccount'],{'as':'Account','foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0x9a')]['hasMany'](db[_0x98ba('0x9a')],{'as':_0x98ba('0x1ba'),'foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0x9a')][_0x98ba('0x108')](db[_0x98ba('0x9a')],{'as':'Description','foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0x9a')]['hasMany'](db[_0x98ba('0x9a')],{'as':_0x98ba('0x1bb'),'foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0x9a')][_0x98ba('0x117')](db[_0x98ba('0x87')],{'as':_0x98ba('0x87'),'foreignKey':_0x98ba('0x1bc')});db[_0x98ba('0x1bd')]['hasMany'](db[_0x98ba('0x9d')],{'as':_0x98ba('0x1b4'),'onDelete':'cascade','foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0x9d')][_0x98ba('0x108')](db['SugarcrmField'],{'as':_0x98ba('0x1be'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x98ba('0x9d')][_0x98ba('0x108')](db[_0x98ba('0x9e')],{'as':_0x98ba('0x1b7'),'onDelete':'cascade','foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0x9d')][_0x98ba('0x108')](db[_0x98ba('0x9e')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x98ba('0x1b9')});db['SugarcrmConfiguration'][_0x98ba('0x117')](db[_0x98ba('0x1bd')],{'as':'Account','foreignKey':_0x98ba('0x1b5')});db['SugarcrmField'][_0x98ba('0x108')](db['SugarcrmField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x98ba('0x9e')][_0x98ba('0x108')](db[_0x98ba('0x9e')],{'as':_0x98ba('0x1bf'),'foreignKey':'DescriptionId'});db[_0x98ba('0x9e')]['hasMany'](db['SugarcrmField'],{'as':_0x98ba('0x1bb'),'foreignKey':_0x98ba('0x1b9')});db['SugarcrmField']['belongsTo'](db[_0x98ba('0x87')],{'as':_0x98ba('0x87'),'foreignKey':_0x98ba('0x1bc')});db[_0x98ba('0xa0')]['hasMany'](db[_0x98ba('0x1c0')],{'as':_0x98ba('0x1b4'),'onDelete':'cascade','foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0x1c0')][_0x98ba('0x108')](db[_0x98ba('0x1c1')],{'as':_0x98ba('0x1be'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0x1c0')][_0x98ba('0x108')](db[_0x98ba('0x1c1')],{'as':_0x98ba('0x1b7'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b8')});db['DeskConfiguration'][_0x98ba('0x108')](db[_0x98ba('0x1c1')],{'as':'Fields','onDelete':_0x98ba('0x106'),'foreignKey':'FieldId'});db[_0x98ba('0x1c0')][_0x98ba('0x117')](db[_0x98ba('0xa0')],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration'][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':'int_desk_configuration_has_tags'});db[_0x98ba('0x1c1')][_0x98ba('0x108')](db['DeskField'],{'as':_0x98ba('0x1ba'),'foreignKey':_0x98ba('0x1b6')});db['DeskField'][_0x98ba('0x108')](db[_0x98ba('0x1c1')],{'as':'Description','foreignKey':'DescriptionId'});db['DeskField'][_0x98ba('0x108')](db['DeskField'],{'as':_0x98ba('0x1bb'),'foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0x1c1')]['belongsTo'](db[_0x98ba('0x87')],{'as':_0x98ba('0x87'),'foreignKey':'VariableId'});db[_0x98ba('0xa4')][_0x98ba('0x108')](db[_0x98ba('0xa6')],{'as':_0x98ba('0x1b4'),'onDelete':_0x98ba('0x106'),'foreignKey':'AccountId'});db[_0x98ba('0xa6')]['hasMany'](db[_0x98ba('0xa8')],{'as':'Subjects','onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0xa6')]['hasMany'](db[_0x98ba('0xa8')],{'as':_0x98ba('0x1b7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x98ba('0xa6')][_0x98ba('0x108')](db['ZohoField'],{'as':_0x98ba('0x1b2'),'onDelete':'cascade','foreignKey':_0x98ba('0x1b9')});db['ZohoConfiguration'][_0x98ba('0x117')](db['ZohoAccount'],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0xa8')]['hasMany'](db[_0x98ba('0xa8')],{'as':_0x98ba('0x1ba'),'foreignKey':_0x98ba('0x1b6')});db['ZohoField'][_0x98ba('0x108')](db[_0x98ba('0xa8')],{'as':_0x98ba('0x1bf'),'foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0xa8')][_0x98ba('0x108')](db['ZohoField'],{'as':'Field','foreignKey':'FieldId'});db[_0x98ba('0xa8')][_0x98ba('0x117')](db['Variable'],{'as':_0x98ba('0x87'),'foreignKey':_0x98ba('0x1bc')});db['ZendeskAccount'][_0x98ba('0x108')](db['ZendeskConfiguration'],{'as':_0x98ba('0x1b4'),'onDelete':'cascade','foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0xab')][_0x98ba('0x108')](db[_0x98ba('0xad')],{'as':_0x98ba('0x1be'),'foreignKey':'SubjectId'});db[_0x98ba('0xab')][_0x98ba('0x108')](db[_0x98ba('0xad')],{'as':_0x98ba('0x1b7'),'foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0xab')][_0x98ba('0x108')](db['ZendeskField'],{'as':_0x98ba('0x1b2'),'foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0xab')][_0x98ba('0x117')](db[_0x98ba('0xa9')],{'as':'Account','foreignKey':'AccountId'});db[_0x98ba('0xab')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':_0x98ba('0x1c2')});db[_0x98ba('0xad')][_0x98ba('0x108')](db[_0x98ba('0xad')],{'as':_0x98ba('0x1ba'),'foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0xad')][_0x98ba('0x108')](db['ZendeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x98ba('0xad')][_0x98ba('0x108')](db['ZendeskField'],{'as':'Field','foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0xad')][_0x98ba('0x117')](db['Variable'],{'as':_0x98ba('0x87'),'foreignKey':_0x98ba('0x1bc')});db[_0x98ba('0xaf')][_0x98ba('0x108')](db[_0x98ba('0x1c3')],{'as':_0x98ba('0x1b4'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0x1c3')][_0x98ba('0x108')](db[_0x98ba('0xb1')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x98ba('0x1b6')});db['FreshdeskConfiguration']['hasMany'](db[_0x98ba('0xb1')],{'as':'Descriptions','onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0x1c3')][_0x98ba('0x108')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x98ba('0x106'),'foreignKey':'FieldId'});db[_0x98ba('0x1c3')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0x1c3')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':_0x98ba('0x1c4')});db[_0x98ba('0xb1')][_0x98ba('0x108')](db[_0x98ba('0xb1')],{'as':_0x98ba('0x1ba'),'foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0xb1')][_0x98ba('0x108')](db['FreshdeskField'],{'as':'Description','foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0xb1')][_0x98ba('0x108')](db[_0x98ba('0xb1')],{'as':_0x98ba('0x1bb'),'foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0xb1')][_0x98ba('0x117')](db[_0x98ba('0x87')],{'as':'Variable','foreignKey':_0x98ba('0x1bc')});db['VtigerAccount'][_0x98ba('0x108')](db[_0x98ba('0xb5')],{'as':_0x98ba('0x1b4'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0xb5')]['hasMany'](db[_0x98ba('0xb6')],{'as':_0x98ba('0x1be'),'foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0xb5')][_0x98ba('0x108')](db[_0x98ba('0xb6')],{'as':'Descriptions','foreignKey':_0x98ba('0x1b8')});db['VtigerConfiguration'][_0x98ba('0x108')](db[_0x98ba('0xb6')],{'as':'Fields','foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0xb5')]['belongsTo'](db[_0x98ba('0xb3')],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0xb6')][_0x98ba('0x108')](db[_0x98ba('0xb6')],{'as':_0x98ba('0x1ba'),'foreignKey':_0x98ba('0x1b6')});db['VtigerField'][_0x98ba('0x108')](db[_0x98ba('0xb6')],{'as':_0x98ba('0x1bf'),'foreignKey':'DescriptionId'});db[_0x98ba('0xb6')][_0x98ba('0x108')](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db[_0x98ba('0xb6')][_0x98ba('0x117')](db[_0x98ba('0x87')],{'as':_0x98ba('0x87'),'foreignKey':'VariableId'});db[_0x98ba('0x1c5')]['hasMany'](db[_0x98ba('0xb8')],{'as':_0x98ba('0x1b4'),'onDelete':'cascade','foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0xb8')][_0x98ba('0x108')](db['ServicenowField'],{'as':_0x98ba('0x1be'),'foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0xb8')][_0x98ba('0x108')](db[_0x98ba('0xba')],{'as':_0x98ba('0x1b7'),'foreignKey':_0x98ba('0x1b8')});db['ServicenowConfiguration'][_0x98ba('0x108')](db[_0x98ba('0xba')],{'as':_0x98ba('0x1b2'),'foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0xb8')][_0x98ba('0x117')](db[_0x98ba('0x1c5')],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x1b5')});db['ServicenowField']['hasMany'](db[_0x98ba('0xba')],{'as':'Subject','foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0xba')][_0x98ba('0x108')](db[_0x98ba('0xba')],{'as':'Description','foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0xba')]['hasMany'](db[_0x98ba('0xba')],{'as':_0x98ba('0x1bb'),'foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0xba')][_0x98ba('0x117')](db[_0x98ba('0x87')],{'as':_0x98ba('0x87'),'foreignKey':_0x98ba('0x1bc')});db[_0x98ba('0xbc')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x98ba('0x1b4'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0xbc')]['belongsTo'](db['CloudProvider'],{'as':_0x98ba('0xfa'),'foreignKey':_0x98ba('0x154')});db[_0x98ba('0xbd')][_0x98ba('0x108')](db['Dynamics365Field'],{'as':_0x98ba('0x1be'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b6')});db['Dynamics365Configuration'][_0x98ba('0x108')](db[_0x98ba('0xbf')],{'as':'Descriptions','onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0xbd')][_0x98ba('0x108')](db[_0x98ba('0xbf')],{'as':_0x98ba('0x1b2'),'onDelete':'cascade','foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0xbd')][_0x98ba('0x117')](db[_0x98ba('0xbc')],{'as':_0x98ba('0x161'),'foreignKey':'AccountId'});db[_0x98ba('0xbf')][_0x98ba('0x108')](db[_0x98ba('0xbf')],{'as':_0x98ba('0x1ba'),'foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0xbf')]['hasMany'](db[_0x98ba('0xbf')],{'as':_0x98ba('0x1bf'),'foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0xbf')][_0x98ba('0x108')](db[_0x98ba('0xbf')],{'as':_0x98ba('0x1bb'),'foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0xbf')][_0x98ba('0x117')](db['Variable'],{'as':_0x98ba('0x87'),'foreignKey':_0x98ba('0x1bc')});db['FreshsalesAccount'][_0x98ba('0x108')](db[_0x98ba('0xc2')],{'as':'Configurations','onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0xc2')][_0x98ba('0x108')](db['FreshsalesField'],{'as':_0x98ba('0x1be'),'foreignKey':_0x98ba('0x1b6')});db['FreshsalesConfiguration'][_0x98ba('0x108')](db['FreshsalesField'],{'as':_0x98ba('0x1b7'),'foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0xc2')][_0x98ba('0x108')](db['FreshsalesField'],{'as':_0x98ba('0x1b2'),'foreignKey':'FieldId'});db[_0x98ba('0xc2')][_0x98ba('0x117')](db['FreshsalesAccount'],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x1b5')});db[_0x98ba('0x1c6')]['hasMany'](db[_0x98ba('0x1c6')],{'as':_0x98ba('0x1ba'),'foreignKey':_0x98ba('0x1b6')});db[_0x98ba('0x1c6')]['hasMany'](db[_0x98ba('0x1c6')],{'as':_0x98ba('0x1bf'),'foreignKey':_0x98ba('0x1b8')});db[_0x98ba('0x1c6')]['hasMany'](db[_0x98ba('0x1c6')],{'as':_0x98ba('0x1bb'),'foreignKey':_0x98ba('0x1b9')});db[_0x98ba('0x1c6')]['belongsTo'](db[_0x98ba('0x87')],{'as':'Variable','foreignKey':'VariableId'});db[_0x98ba('0xc6')]['belongsTo'](db[_0x98ba('0x56')],{});db['ChatQueueReport'][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':_0x98ba('0x16c'),'foreignKey':'ListId'});db[_0x98ba('0xc6')]['belongsTo'](db[_0x98ba('0x68')],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0xc6')]['belongsTo'](db[_0x98ba('0x5c')],{});db[_0x98ba('0xc6')][_0x98ba('0x117')](db['ChatMessage'],{});db[_0x98ba('0xc6')]['belongsTo'](db[_0x98ba('0x12')],{});db[_0x98ba('0xc6')][_0x98ba('0x117')](db[_0x98ba('0x61')],{});db[_0x98ba('0xc8')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1c7')});db[_0x98ba('0xc8')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1c8')});db[_0x98ba('0x191')][_0x98ba('0x108')](db[_0x98ba('0xca')],{'foreignKey':'SessionId','onDelete':_0x98ba('0x106')});db['JscriptySessionReport']['hasMany'](db[_0x98ba('0x1c9')],{'foreignKey':_0x98ba('0x1ca'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0xcd')]['belongsTo'](db['SmsAccount'],{});db[_0x98ba('0xcd')][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':_0x98ba('0x16c'),'foreignKey':_0x98ba('0x15b')});db[_0x98ba('0xcd')][_0x98ba('0x117')](db[_0x98ba('0x68')],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0xcd')][_0x98ba('0x117')](db[_0x98ba('0x4c')],{});db[_0x98ba('0xcd')][_0x98ba('0x117')](db[_0x98ba('0x179')],{});db[_0x98ba('0xcd')][_0x98ba('0x117')](db[_0x98ba('0x12')],{});db['SmsQueueReport'][_0x98ba('0x117')](db['SmsQueue'],{});db[_0x98ba('0x1cb')][_0x98ba('0x108')](db[_0x98ba('0x191')],{'foreignKey':_0x98ba('0x1cc')});db['JscriptyProject']['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x98ba('0x1cc')});db[_0x98ba('0x1cb')][_0x98ba('0x108')](db[_0x98ba('0x1c9')],{'foreignKey':'ProjectId'});db['Team']['belongsToMany'](db[_0x98ba('0x12')],{'as':_0x98ba('0x15e'),'through':_0x98ba('0x11f')});db[_0x98ba('0x11e')][_0x98ba('0x118')](db[_0x98ba('0x1a')],{'through':_0x98ba('0xfc'),'as':_0x98ba('0x127')});db['Team'][_0x98ba('0x118')](db[_0x98ba('0x37')],{'through':'team_has_mail_queues','as':_0x98ba('0x129')});db[_0x98ba('0x11e')][_0x98ba('0x118')](db[_0x98ba('0x61')],{'through':_0x98ba('0x18b'),'as':_0x98ba('0x1cd')});db[_0x98ba('0x11e')][_0x98ba('0x118')](db[_0x98ba('0x45')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x98ba('0x11e')]['belongsToMany'](db[_0x98ba('0x4d')],{'through':_0x98ba('0x17e'),'as':'SmsQueues'});db[_0x98ba('0x11e')][_0x98ba('0x118')](db[_0x98ba('0x12e')],{'through':_0x98ba('0x183'),'as':'OpenchannelQueues'});db[_0x98ba('0x11e')][_0x98ba('0x118')](db[_0x98ba('0xf8')],{'through':_0x98ba('0x1ce'),'as':'WhatsappQueues'});db['Team']['belongsToMany'](db[_0x98ba('0xea')],{'through':_0x98ba('0xfd'),'as':_0x98ba('0x128')});db['Campaign'][_0x98ba('0x108')](db[_0x98ba('0x6a')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x98ba('0xdb')]['hasMany'](db['CmHopperFinal'],{'as':_0x98ba('0x10c'),'foreignKey':_0x98ba('0x196')});db['Campaign'][_0x98ba('0x108')](db[_0x98ba('0x6c')],{'as':_0x98ba('0x190'),'foreignKey':_0x98ba('0x196')});db['Campaign']['hasMany'](db['CmHopperBlack'],{'as':_0x98ba('0x142'),'foreignKey':_0x98ba('0x196')});db[_0x98ba('0xdb')][_0x98ba('0x117')](db[_0x98ba('0x26')],{'as':_0x98ba('0x26'),'foreignKey':_0x98ba('0x144')});db[_0x98ba('0xdb')][_0x98ba('0x117')](db[_0x98ba('0x26')],{'as':_0x98ba('0x145'),'foreignKey':_0x98ba('0x146')});db[_0x98ba('0xdb')][_0x98ba('0x117')](db[_0x98ba('0x76')],{'as':_0x98ba('0x76'),'foreignKey':_0x98ba('0x147')});db[_0x98ba('0xdb')][_0x98ba('0x117')](db[_0x98ba('0xd4')],{'as':_0x98ba('0xd4'),'foreignKey':_0x98ba('0x1cf')});db[_0x98ba('0xdb')][_0x98ba('0x118')](db['CmList'],{'as':'Lists','through':_0x98ba('0x1d0')});db[_0x98ba('0xdb')][_0x98ba('0x118')](db['CmList'],{'as':_0x98ba('0x14b'),'through':_0x98ba('0x1d1')});db['Attachment'][_0x98ba('0x117')](db[_0x98ba('0x5f')],{'as':'ChatOfflineMessage','foreignKey':_0x98ba('0x169')});db['MailTransferReport'][_0x98ba('0x117')](db['MailMessage'],{});db[_0x98ba('0x1d2')][_0x98ba('0x117')](db[_0x98ba('0x3b')],{});db['MailTransferReport'][_0x98ba('0x117')](db['MailAccount'],{'foreignKey':_0x98ba('0x1d3'),'as':_0x98ba('0x1d4')});db[_0x98ba('0x1d2')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'foreignKey':_0x98ba('0x1d5'),'as':_0x98ba('0x1d6')});db[_0x98ba('0x1d2')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'foreignKey':_0x98ba('0x1d7'),'as':_0x98ba('0x1d8')});db[_0x98ba('0x1d2')][_0x98ba('0x117')](db['MailQueue'],{'foreignKey':_0x98ba('0x1d9'),'as':_0x98ba('0x1da')});db[_0x98ba('0x1d2')]['belongsTo'](db[_0x98ba('0x35')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x98ba('0xe2')][_0x98ba('0x117')](db['ChatMessage'],{});db[_0x98ba('0xe2')][_0x98ba('0x117')](db[_0x98ba('0x5c')],{});db[_0x98ba('0xe2')][_0x98ba('0x117')](db[_0x98ba('0x56')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db['ChatTransferReport'][_0x98ba('0x117')](db[_0x98ba('0x12')],{'foreignKey':'FromUserId','as':_0x98ba('0x1d6')});db['ChatTransferReport'][_0x98ba('0x117')](db[_0x98ba('0x12')],{'foreignKey':_0x98ba('0x1d7'),'as':_0x98ba('0x1d8')});db[_0x98ba('0xe2')]['belongsTo'](db[_0x98ba('0x61')],{'foreignKey':'ToChatQueueId','as':_0x98ba('0x1da')});db[_0x98ba('0xe2')][_0x98ba('0x117')](db[_0x98ba('0x56')],{'foreignKey':'ToChatWebsiteId','as':_0x98ba('0x1db')});db[_0x98ba('0xe3')][_0x98ba('0x117')](db[_0x98ba('0x172')],{});db[_0x98ba('0xe3')][_0x98ba('0x117')](db[_0x98ba('0x110')],{});db[_0x98ba('0xe3')][_0x98ba('0x117')](db[_0x98ba('0x43')],{'foreignKey':_0x98ba('0x1dc'),'as':_0x98ba('0x1d4')});db[_0x98ba('0xe3')][_0x98ba('0x117')](db['User'],{'foreignKey':'FromUserId','as':_0x98ba('0x1d6')});db[_0x98ba('0xe3')]['belongsTo'](db['User'],{'foreignKey':_0x98ba('0x1d7'),'as':'ToAgent'});db['FaxTransferReport']['belongsTo'](db[_0x98ba('0x45')],{'foreignKey':_0x98ba('0x1dd'),'as':_0x98ba('0x1da')});db[_0x98ba('0xe3')]['belongsTo'](db[_0x98ba('0x43')],{'foreignKey':'ToFaxAccountId','as':_0x98ba('0x1db')});db['OpenchannelTransferReport'][_0x98ba('0x117')](db[_0x98ba('0x181')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x98ba('0xe5')][_0x98ba('0x117')](db[_0x98ba('0x4f')],{'foreignKey':_0x98ba('0x1de'),'as':'FromAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x98ba('0x12')],{'foreignKey':_0x98ba('0x1d5'),'as':_0x98ba('0x1d6')});db[_0x98ba('0xe5')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'foreignKey':'ToUserId','as':_0x98ba('0x1d8')});db[_0x98ba('0xe5')][_0x98ba('0x117')](db[_0x98ba('0x12e')],{'foreignKey':_0x98ba('0x1df'),'as':_0x98ba('0x1da')});db[_0x98ba('0xe5')][_0x98ba('0x117')](db[_0x98ba('0x4f')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0x98ba('0xe6')][_0x98ba('0x117')](db['SmsMessage'],{});db[_0x98ba('0xe6')][_0x98ba('0x117')](db[_0x98ba('0x4c')],{});db[_0x98ba('0xe6')][_0x98ba('0x117')](db[_0x98ba('0x49')],{'foreignKey':'FromSmsAccountId','as':_0x98ba('0x1d4')});db[_0x98ba('0xe6')]['belongsTo'](db[_0x98ba('0x12')],{'foreignKey':_0x98ba('0x1d5'),'as':_0x98ba('0x1d6')});db[_0x98ba('0xe6')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'foreignKey':_0x98ba('0x1d7'),'as':_0x98ba('0x1d8')});db[_0x98ba('0xe6')]['belongsTo'](db[_0x98ba('0x4d')],{'foreignKey':'ToSmsQueueId','as':_0x98ba('0x1da')});db[_0x98ba('0xe6')]['belongsTo'](db[_0x98ba('0x49')],{'foreignKey':_0x98ba('0x1e0'),'as':_0x98ba('0x1db')});db[_0x98ba('0xe8')][_0x98ba('0x108')](db[_0x98ba('0x73')],{'as':_0x98ba('0x158'),'foreignKey':'ListId','onDelete':_0x98ba('0x106')});db[_0x98ba('0xe8')]['hasMany'](db[_0x98ba('0x6e')],{'as':_0x98ba('0x1e1'),'foreignKey':'ListId'});db['CmList'][_0x98ba('0x108')](db[_0x98ba('0x68')],{'as':_0x98ba('0x11b'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x15b')});db[_0x98ba('0xe8')][_0x98ba('0x108')](db[_0x98ba('0x10b')],{'as':_0x98ba('0x10c'),'foreignKey':_0x98ba('0x15b')});db[_0x98ba('0xe8')]['hasMany'](db['CmHopperHistory'],{'as':_0x98ba('0x10d'),'foreignKey':_0x98ba('0x15b')});db[_0x98ba('0xe8')][_0x98ba('0x108')](db['ReportAgentPreview'],{'as':_0x98ba('0x6d'),'foreignKey':_0x98ba('0x15b')});db[_0x98ba('0xe8')][_0x98ba('0x118')](db['VoiceQueue'],{'as':'Queues','through':_0x98ba('0x149')});db[_0x98ba('0xe8')][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':_0x98ba('0x15e'),'through':_0x98ba('0x11d')});db[_0x98ba('0xea')][_0x98ba('0x108')](db[_0x98ba('0x17')],{'as':_0x98ba('0x10a'),'onDelete':_0x98ba('0x106')});db['VoicePrefix'][_0x98ba('0x118')](db['User'],{'as':_0x98ba('0x15e'),'through':'UserVoicePrefix'});db[_0x98ba('0xea')][_0x98ba('0x118')](db[_0x98ba('0x11e')],{'through':'TeamVoicePrefix','as':'Teams'});db[_0x98ba('0xec')][_0x98ba('0x108')](db[_0x98ba('0x12')],{'as':_0x98ba('0x176'),'foreignKey':_0x98ba('0x1e2')});db['UserProfile'][_0x98ba('0x108')](db[_0x98ba('0x1e3')],{'as':_0x98ba('0x1e4'),'foreignKey':_0x98ba('0x1e2'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0x1e3')][_0x98ba('0x108')](db[_0x98ba('0x1e5')],{'as':_0x98ba('0x1e6'),'foreignKey':_0x98ba('0x1e7'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0xf0')][_0x98ba('0x108')](db['Disposition'],{'as':_0x98ba('0x158'),'foreignKey':_0x98ba('0x1e8'),'onDelete':_0x98ba('0x106')});db[_0x98ba('0xf0')]['hasMany'](db[_0x98ba('0x72')],{'as':_0x98ba('0x159'),'foreignKey':_0x98ba('0x1e8')});db[_0x98ba('0xf0')][_0x98ba('0x108')](db[_0x98ba('0x1e9')],{'as':_0x98ba('0x14c'),'foreignKey':'WhatsappAccountId'});db[_0x98ba('0xf0')][_0x98ba('0x108')](db[_0x98ba('0x111')],{'as':_0x98ba('0x15a')});db[_0x98ba('0xf0')][_0x98ba('0x108')](db['WhatsappApplication'],{'as':_0x98ba('0x13d'),'foreignKey':_0x98ba('0x1e8'),'onDelete':_0x98ba('0x106')});db['WhatsappAccount'][_0x98ba('0x117')](db['CmList'],{'as':_0x98ba('0x16c'),'foreignKey':_0x98ba('0x15b')});db[_0x98ba('0xf0')]['belongsTo'](db[_0x98ba('0x78')],{'as':_0x98ba('0x148'),'foreignKey':_0x98ba('0x171')});db[_0x98ba('0xf0')][_0x98ba('0x118')](db[_0x98ba('0x12')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x98ba('0x1ea')]['belongsTo'](db[_0x98ba('0x12')],{'onDelete':_0x98ba('0x155')});db[_0x98ba('0x1ea')][_0x98ba('0x117')](db[_0x98ba('0xf8')],{'onDelete':'restrict'});db[_0x98ba('0x1ea')]['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x98ba('0x155')});db[_0x98ba('0x1ea')]['belongsTo'](db[_0x98ba('0x76')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x98ba('0x1ea')][_0x98ba('0x117')](db[_0x98ba('0x162')],{'onDelete':_0x98ba('0x155'),'foreignKey':_0x98ba('0x16b')});db[_0x98ba('0x111')][_0x98ba('0x108')](db[_0x98ba('0x1e9')],{'as':_0x98ba('0x14c'),'onDelete':_0x98ba('0x106'),'foreignKey':_0x98ba('0x1eb')});db[_0x98ba('0x111')]['belongsTo'](db[_0x98ba('0xf0')],{'as':_0x98ba('0x161'),'foreignKey':_0x98ba('0x1e8')});db['WhatsappInteraction'][_0x98ba('0x117')](db['CmContact'],{'as':_0x98ba('0x151'),'foreignKey':'ContactId'});db[_0x98ba('0x111')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'as':_0x98ba('0x174'),'foreignKey':_0x98ba('0x103')});db[_0x98ba('0x111')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':_0x98ba('0x1a7'),'as':_0x98ba('0x164')});db[_0x98ba('0x111')][_0x98ba('0x118')](db[_0x98ba('0x162')],{'through':'whatsapp_interaction_has_tags','as':_0x98ba('0x165')});db[_0x98ba('0x111')]['belongsToMany'](db[_0x98ba('0x12')],{'as':_0x98ba('0x176'),'through':_0x98ba('0x1ec'),'foreignKey':_0x98ba('0x1eb')});db[_0x98ba('0x1e9')]['belongsTo'](db[_0x98ba('0x12')],{'as':_0x98ba('0x12')});db[_0x98ba('0x1e9')]['belongsTo'](db['CmContact'],{'onDelete':_0x98ba('0x106'),'as':_0x98ba('0x151')});db[_0x98ba('0x1e9')][_0x98ba('0x117')](db[_0x98ba('0x111')],{'onDelete':_0x98ba('0x106'),'as':'Interaction','foreignKey':'WhatsappInteractionId'});db[_0x98ba('0x1e9')][_0x98ba('0x117')](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x98ba('0x1ed')]['belongsTo'](db[_0x98ba('0xf0')],{});db[_0x98ba('0x1ed')][_0x98ba('0x117')](db[_0x98ba('0xe8')],{'as':_0x98ba('0x16c'),'foreignKey':'ListId'});db[_0x98ba('0x1ed')][_0x98ba('0x117')](db[_0x98ba('0x68')],{'as':_0x98ba('0x151'),'foreignKey':_0x98ba('0x152')});db[_0x98ba('0x1ed')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x98ba('0x1ed')][_0x98ba('0x117')](db[_0x98ba('0xf8')],{});db[_0x98ba('0x1ed')][_0x98ba('0x117')](db[_0x98ba('0x1e9')],{});db[_0x98ba('0x1ed')][_0x98ba('0x117')](db[_0x98ba('0x12')],{});db['WhatsappTransferReport'][_0x98ba('0x117')](db[_0x98ba('0x1e9')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x98ba('0xf6')][_0x98ba('0x117')](db[_0x98ba('0xf0')],{'foreignKey':_0x98ba('0x1ee'),'as':_0x98ba('0x1d4')});db['WhatsappTransferReport'][_0x98ba('0x117')](db['WhatsappAccount'],{'foreignKey':_0x98ba('0x1ef'),'as':_0x98ba('0x1db')});db[_0x98ba('0xf6')][_0x98ba('0x117')](db['WhatsappQueue'],{'foreignKey':_0x98ba('0x1f0'),'as':'ToQueue'});db[_0x98ba('0xf6')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'foreignKey':_0x98ba('0x1d5'),'as':'FromAgent'});db[_0x98ba('0xf6')]['belongsTo'](db[_0x98ba('0x12')],{'foreignKey':_0x98ba('0x1d7'),'as':_0x98ba('0x1d8')});db[_0x98ba('0xf8')]['belongsToMany'](db[_0x98ba('0x12')],{'as':'Agents','through':_0x98ba('0x31'),'foreignKey':_0x98ba('0x1f1')});db['WhatsappQueue'][_0x98ba('0x118')](db['Team'],{'through':_0x98ba('0x1ce'),'as':_0x98ba('0x14a')});db[_0x98ba('0x104')][_0x98ba('0x117')](db[_0x98ba('0x12')],{'as':_0x98ba('0x1f2'),'foreignKey':'UserId','onDelete':_0x98ba('0x106'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0x98ba('0xbc')],{'as':_0x98ba('0xbc'),'onDelete':'restrict'});db[_0x98ba('0xfa')][_0x98ba('0x101')](db[_0x98ba('0x32')],{'as':_0x98ba('0x156'),'onDelete':_0x98ba('0x155')});db[_0x98ba('0xfa')]['hasOne'](db[_0x98ba('0x33')],{'as':'Smtp','onDelete':_0x98ba('0x155')});module[_0x98ba('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f61acb7..040dd28 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a71=['./api/pause','/api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','/www','static','root','/demo','snippet','3.12.2','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','path','express','./errors','./utils/client-side-logger','setupLoggers','/api/users','/api/voice/chanspy','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/chatApplication','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','./api/interval','/api/pauses'];(function(_0xd87028,_0x20a2aa){var _0x2f08a9=function(_0x8035a8){while(--_0x8035a8){_0xd87028['push'](_0xd87028['shift']());}};_0x2f08a9(++_0x20a2aa);}(_0x7a71,0xad));var _0x17a7=function(_0x243e52,_0x1915d9){_0x243e52=_0x243e52-0x0;var _0x1d42ab=_0x7a71[_0x243e52];return _0x1d42ab;};'use strict';var path=require(_0x17a7('0x0'));var express=require(_0x17a7('0x1'));var errors=require(_0x17a7('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x17a7('0x3'))[_0x17a7('0x4')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x4143b0){return setupLoggers(_0x4143b0)['then'](function(){_0x4143b0['use'](_0x17a7('0x5'),require('./api/user'));_0x4143b0['use'](_0x17a7('0x6'),require(_0x17a7('0x7')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x9'),require(_0x17a7('0xa')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xb'),require('./api/voiceExtension'));_0x4143b0['use'](_0x17a7('0xc'),require(_0x17a7('0xd')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xe'),require(_0x17a7('0xf')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x10'),require(_0x17a7('0x11')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x12'),require(_0x17a7('0x13')));_0x4143b0['use'](_0x17a7('0x14'),require(_0x17a7('0x15')));_0x4143b0['use'](_0x17a7('0x16'),require(_0x17a7('0x17')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x18'),require(_0x17a7('0x19')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x1a'),require(_0x17a7('0x1b')));_0x4143b0[_0x17a7('0x8')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x1c'),require(_0x17a7('0x1d')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x1e'),require(_0x17a7('0x1f')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x20'),require(_0x17a7('0x21')));_0x4143b0[_0x17a7('0x8')]('/api/voice/transfers/reports',require(_0x17a7('0x22')));_0x4143b0['use'](_0x17a7('0x23'),require('./api/mailServerOut'));_0x4143b0['use'](_0x17a7('0x24'),require(_0x17a7('0x25')));_0x4143b0['use'](_0x17a7('0x26'),require('./api/mailQueue'));_0x4143b0[_0x17a7('0x8')]('/api/mail/substatuses',require(_0x17a7('0x27')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x28'),require(_0x17a7('0x29')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x2a'),require(_0x17a7('0x2b')));_0x4143b0[_0x17a7('0x8')]('/api/mail/applications',require(_0x17a7('0x2c')));_0x4143b0['use'](_0x17a7('0x2d'),require(_0x17a7('0x2e')));_0x4143b0[_0x17a7('0x8')]('/api/dashboards',require('./api/dashboard'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x2f'),require(_0x17a7('0x30')));_0x4143b0[_0x17a7('0x8')]('/api/fax/accounts',require('./api/faxAccount'));_0x4143b0['use'](_0x17a7('0x31'),require(_0x17a7('0x32')));_0x4143b0[_0x17a7('0x8')]('/api/fax/interactions',require(_0x17a7('0x33')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x34'),require(_0x17a7('0x35')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x36'),require(_0x17a7('0x37')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x38'),require(_0x17a7('0x39')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x3a'),require('./api/smsAccount'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x3b'),require(_0x17a7('0x3c')));_0x4143b0['use']('/api/sms/interactions',require(_0x17a7('0x3d')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x3e'),require('./api/smsMessage'));_0x4143b0[_0x17a7('0x8')]('/api/sms/queues',require(_0x17a7('0x3f')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x40'),require(_0x17a7('0x41')));_0x4143b0['use'](_0x17a7('0x42'),require(_0x17a7('0x43')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x44'),require('./api/openchannelInteraction'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x45'),require(_0x17a7('0x46')));_0x4143b0[_0x17a7('0x8')]('/api/openchannel/queues',require(_0x17a7('0x47')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x48'),require('./api/chatWebsite'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x49'),require('./api/openchannelQueueReport'));_0x4143b0[_0x17a7('0x8')]('/api/chat/applications',require(_0x17a7('0x4a')));_0x4143b0['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x4b'),require(_0x17a7('0x4c')));_0x4143b0[_0x17a7('0x8')]('/api/chat/offline_messages',require(_0x17a7('0x4d')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x4e'),require(_0x17a7('0x4f')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x50'),require('./api/chatGroup'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x51'),require(_0x17a7('0x52')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x53'),require(_0x17a7('0x54')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x55'),require(_0x17a7('0x56')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x57'),require(_0x17a7('0x58')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x59'),require('./api/cmHopperBlack'));_0x4143b0[_0x17a7('0x8')]('/api/cm/hopper_final',require(_0x17a7('0x5a')));_0x4143b0['use'](_0x17a7('0x5b'),require(_0x17a7('0x5c')));_0x4143b0['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x5d'),require(_0x17a7('0x5e')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x5f'),require(_0x17a7('0x60')));_0x4143b0['use'](_0x17a7('0x61'),require(_0x17a7('0x62')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x63'),require('./api/disposition'));_0x4143b0[_0x17a7('0x8')]('/api/conditions',require(_0x17a7('0x64')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x65'),require(_0x17a7('0x66')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x67'),require(_0x17a7('0x68')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x69'),require('./api/cdr'));_0x4143b0['use']('/api/voiceQueuesLog',require(_0x17a7('0x6a')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x6b'),require(_0x17a7('0x6c')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x6d'),require(_0x17a7('0x6e')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x6f'),require('./api/tag'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x70'),require('./api/contactItemType'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x71'),require(_0x17a7('0x72')));_0x4143b0[_0x17a7('0x8')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x4143b0['use'](_0x17a7('0x73'),require(_0x17a7('0x74')));_0x4143b0['use'](_0x17a7('0x75'),require(_0x17a7('0x76')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x77'),require('./api/variable'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x78'),require(_0x17a7('0x79')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x7a'),require(_0x17a7('0x7b')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x7c'),require(_0x17a7('0x7d')));_0x4143b0[_0x17a7('0x8')]('/api/analytics/default_reports',require(_0x17a7('0x7e')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x7f'),require(_0x17a7('0x80')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x81'),require('./api/analyticMetric'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x82'),require(_0x17a7('0x83')));_0x4143b0['use'](_0x17a7('0x84'),require(_0x17a7('0x85')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x86'),require('./api/intSalesforceAccount'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x87'),require('./api/intSalesforceConfiguration'));_0x4143b0[_0x17a7('0x8')]('/api/integrations/salesforce/fields',require(_0x17a7('0x88')));_0x4143b0['use'](_0x17a7('0x89'),require('./api/intSugarcrmAccount'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x8a'),require('./api/intSugarcrmConfiguration'));_0x4143b0['use']('/api/integrations/sugarcrm/fields',require(_0x17a7('0x8b')));_0x4143b0['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x4143b0['use'](_0x17a7('0x8c'),require('./api/intDeskConfiguration'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x8d'),require(_0x17a7('0x8e')));_0x4143b0['use'](_0x17a7('0x8f'),require(_0x17a7('0x90')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x91'),require(_0x17a7('0x92')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x93'),require(_0x17a7('0x94')));_0x4143b0['use'](_0x17a7('0x95'),require(_0x17a7('0x96')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x97'),require(_0x17a7('0x98')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x99'),require(_0x17a7('0x9a')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x9b'),require('./api/intFreshdeskAccount'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x9c'),require(_0x17a7('0x9d')));_0x4143b0['use'](_0x17a7('0x9e'),require(_0x17a7('0x9f')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xa0'),require(_0x17a7('0xa1')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xa2'),require(_0x17a7('0xa3')));_0x4143b0[_0x17a7('0x8')]('/api/integrations/vtiger/fields',require(_0x17a7('0xa4')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xa5'),require(_0x17a7('0xa6')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xa7'),require(_0x17a7('0xa8')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xa9'),require('./api/intServicenowField'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xaa'),require(_0x17a7('0xab')));_0x4143b0['use'](_0x17a7('0xac'),require(_0x17a7('0xad')));_0x4143b0['use'](_0x17a7('0xae'),require(_0x17a7('0xaf')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xb0'),require('./api/intFreshsalesAccount'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xb1'),require('./api/intFreshsalesConfiguration'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xb2'),require(_0x17a7('0xb3')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xb4'),require('./api/network'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xb5'),require(_0x17a7('0xb6')));_0x4143b0['use'](_0x17a7('0xb7'),require('./api/chatInternalMessage'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xb8'),require(_0x17a7('0xb9')));_0x4143b0['use'](_0x17a7('0xba'),require('./api/jscriptyQuestionReport'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xbb'),require('./api/jscriptySessionReport'));_0x4143b0['use'](_0x17a7('0xbc'),require(_0x17a7('0xbd')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xbe'),require(_0x17a7('0xbf')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xc0'),require('./api/squareReportDetail'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xc1'),require(_0x17a7('0xc2')));_0x4143b0['use'](_0x17a7('0xc3'),require(_0x17a7('0xc4')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xc5'),require(_0x17a7('0xc6')));_0x4143b0['use']('/api/square/projects',require(_0x17a7('0xc7')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xc8'),require(_0x17a7('0xc9')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xca'),require(_0x17a7('0xcb')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xcc'),require('./api/team'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xcd'),require('./api/license'));_0x4143b0['use'](_0x17a7('0xce'),require(_0x17a7('0xcf')));_0x4143b0[_0x17a7('0x8')]('/api/migrations',require(_0x17a7('0xd0')));_0x4143b0['use'](_0x17a7('0xd1'),require('./api/attachment'));_0x4143b0[_0x17a7('0x8')]('/api/plugins',require(_0x17a7('0xd2')));_0x4143b0[_0x17a7('0x8')]('/api/mail/reports/transfer',require(_0x17a7('0xd3')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xd4'),require(_0x17a7('0xd5')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xd6'),require('./api/faxTransferReport'));_0x4143b0['use'](_0x17a7('0xd7'),require(_0x17a7('0xd8')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xd9'),require(_0x17a7('0xda')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xdb'),require('./api/cmList'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xdc'),require(_0x17a7('0xdd')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xde'),require(_0x17a7('0xdf')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xe0'),require(_0x17a7('0xe1')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xe2'),require('./api/userProfileResource'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xe3'),require(_0x17a7('0xe4')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xe5'),require(_0x17a7('0xe6')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xe7'),require(_0x17a7('0xe8')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xe9'),require(_0x17a7('0xea')));_0x4143b0[_0x17a7('0x8')]('/api/whatsapp/messages',require(_0x17a7('0xeb')));_0x4143b0['use']('/api/whatsapp/reports/queue',require(_0x17a7('0xec')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xed'),require('./api/whatsappTransferReport'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xee'),require(_0x17a7('0xef')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xf0'),require(_0x17a7('0xf1')));_0x4143b0['use'](_0x17a7('0xf2'),require(_0x17a7('0xf3')));_0x4143b0[_0x17a7('0x8')]('/api/user-settings',require(_0x17a7('0xf4')));_0x4143b0['use'](_0x17a7('0xf5'),require(_0x17a7('0xf6')));_0x4143b0['use'](_0x17a7('0xf7'),require(_0x17a7('0xf8')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xf9'),require('./api/authGoogle'));_0x4143b0[_0x17a7('0x8')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xfa'),require(_0x17a7('0xfb')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0xfc'),require('./api/rpc'));_0x4143b0['use'](_0x17a7('0xfd'),require(_0x17a7('0xfe')));_0x4143b0['use']('/api/system',require(_0x17a7('0xff')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x100'),require(_0x17a7('0x101')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x102'),require(_0x17a7('0x103')));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x104'),clientSideLogs);_0x4143b0['use'](_0x17a7('0x105'),express['static'](path[_0x17a7('0x106')](config['root'],_0x17a7('0x105'))));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x107'),express[_0x17a7('0x108')](path[_0x17a7('0x106')](config[_0x17a7('0x109')],_0x17a7('0x107'))));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x10a'),express[_0x17a7('0x108')](path[_0x17a7('0x106')](config[_0x17a7('0x109')],_0x17a7('0x10a'))));_0x4143b0[_0x17a7('0x8')]('/snippet',express[_0x17a7('0x108')](path['join'](config[_0x17a7('0x109')],_0x17a7('0x10b'),_0x17a7('0x10c'))));_0x4143b0[_0x17a7('0x8')](_0x17a7('0x10d'),express[_0x17a7('0x108')](path[_0x17a7('0x106')](config[_0x17a7('0x109')],_0x17a7('0x10e'))));_0x4143b0['route'](_0x17a7('0x10f'))[_0x17a7('0x110')](errors[0x194]);_0x4143b0[_0x17a7('0x111')]('/*')[_0x17a7('0x110')](function(_0x2ad68d,_0x306dd1){_0x306dd1[_0x17a7('0x112')](path[_0x17a7('0x113')](_0x4143b0[_0x17a7('0x110')](_0x17a7('0x114'))+'/index.html'));});return _0x4143b0;});}; \ No newline at end of file +var _0xed65=['/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/templates','./api/template','./api/trigger','/api/variables','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/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/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','root','/demo','snippet','3.12.2','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','sendFile','get','appPath','path','express','./errors','./config/environment','setupLoggers','default','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./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/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds'];(function(_0x412038,_0x5b02cd){var _0x3c9446=function(_0x4a82ad){while(--_0x4a82ad){_0x412038['push'](_0x412038['shift']());}};_0x3c9446(++_0x5b02cd);}(_0xed65,0xa1));var _0x5ed6=function(_0x130719,_0x2a7018){_0x130719=_0x130719-0x0;var _0x159865=_0xed65[_0x130719];return _0x159865;};'use strict';var path=require(_0x5ed6('0x0'));var express=require(_0x5ed6('0x1'));var errors=require(_0x5ed6('0x2'));var config=require(_0x5ed6('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0x5ed6('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0x5ed6('0x5')]=function(_0x553844){return setupLoggers(_0x553844)['then'](function(){_0x553844[_0x5ed6('0x6')]('/api/users',require(_0x5ed6('0x7')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x8'),require(_0x5ed6('0x9')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xa'),require(_0x5ed6('0xb')));_0x553844[_0x5ed6('0x6')]('/api/voice/extensions',require(_0x5ed6('0xc')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xd'),require(_0x5ed6('0xe')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xf'),require(_0x5ed6('0x10')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x11'),require(_0x5ed6('0x12')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x13'),require('./api/screenRecording'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x14'),require(_0x5ed6('0x15')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x16'),require(_0x5ed6('0x17')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x18'),require(_0x5ed6('0x19')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x1a'),require(_0x5ed6('0x1b')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x1c'),require(_0x5ed6('0x1d')));_0x553844[_0x5ed6('0x6')]('/api/voice/queues/reports',require(_0x5ed6('0x1e')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x1f'),require(_0x5ed6('0x20')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x21'),require(_0x5ed6('0x22')));_0x553844[_0x5ed6('0x6')]('/api/voice/transfers/reports',require(_0x5ed6('0x23')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x24'),require(_0x5ed6('0x25')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x26'),require(_0x5ed6('0x27')));_0x553844['use'](_0x5ed6('0x28'),require(_0x5ed6('0x29')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x2a'),require(_0x5ed6('0x2b')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x2c'),require(_0x5ed6('0x2d')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x2e'),require('./api/mailMessage'));_0x553844[_0x5ed6('0x6')]('/api/mail/applications',require(_0x5ed6('0x2f')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x30'),require(_0x5ed6('0x31')));_0x553844['use']('/api/dashboards',require(_0x5ed6('0x32')));_0x553844['use']('/api/dashboards/items',require('./api/dashboardItem'));_0x553844[_0x5ed6('0x6')]('/api/fax/accounts',require('./api/faxAccount'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x33'),require(_0x5ed6('0x34')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x35'),require('./api/faxInteraction'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x36'),require(_0x5ed6('0x37')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x38'),require(_0x5ed6('0x39')));_0x553844['use'](_0x5ed6('0x3a'),require('./api/faxQueueReport'));_0x553844['use'](_0x5ed6('0x3b'),require(_0x5ed6('0x3c')));_0x553844['use'](_0x5ed6('0x3d'),require(_0x5ed6('0x3e')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x3f'),require(_0x5ed6('0x40')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x41'),require('./api/smsMessage'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x42'),require(_0x5ed6('0x43')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x44'),require(_0x5ed6('0x45')));_0x553844[_0x5ed6('0x6')]('/api/openchannel/applications',require(_0x5ed6('0x46')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x47'),require(_0x5ed6('0x48')));_0x553844['use'](_0x5ed6('0x49'),require(_0x5ed6('0x4a')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x4b'),require(_0x5ed6('0x4c')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x4d'),require('./api/chatWebsite'));_0x553844[_0x5ed6('0x6')]('/api/openchannel/reports/queue',require(_0x5ed6('0x4e')));_0x553844['use']('/api/chat/applications',require(_0x5ed6('0x4f')));_0x553844['use'](_0x5ed6('0x50'),require('./api/chatInteraction'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x51'),require('./api/chatMessage'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x52'),require(_0x5ed6('0x53')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x54'),require('./api/chatQueue'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x55'),require(_0x5ed6('0x56')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x57'),require('./api/chatProactiveAction'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x58'),require('./api/cmCompany'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x59'),require('./api/cmContact'));_0x553844[_0x5ed6('0x6')]('/api/cm/hopper',require(_0x5ed6('0x5a')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x5b'),require(_0x5ed6('0x5c')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x5d'),require('./api/cmHopperFinal'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x5e'),require(_0x5ed6('0x5f')));_0x553844['use'](_0x5ed6('0x60'),require('./api/cmCustomField'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x61'),require(_0x5ed6('0x62')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x63'),require(_0x5ed6('0x64')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x65'),require(_0x5ed6('0x66')));_0x553844[_0x5ed6('0x6')]('/api/dispositions',require(_0x5ed6('0x67')));_0x553844[_0x5ed6('0x6')]('/api/conditions',require(_0x5ed6('0x68')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x69'),require(_0x5ed6('0x6a')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x6b'),require(_0x5ed6('0x6c')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x6d'),require(_0x5ed6('0x6e')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x6f'),require(_0x5ed6('0x70')));_0x553844[_0x5ed6('0x6')]('/api/schedules',require(_0x5ed6('0x71')));_0x553844['use'](_0x5ed6('0x72'),require('./api/sound'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x73'),require(_0x5ed6('0x74')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x75'),require(_0x5ed6('0x76')));_0x553844[_0x5ed6('0x6')]('/api/cm_contact_has_items',require(_0x5ed6('0x77')));_0x553844[_0x5ed6('0x6')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x78'),require(_0x5ed6('0x79')));_0x553844[_0x5ed6('0x6')]('/api/triggers',require(_0x5ed6('0x7a')));_0x553844['use'](_0x5ed6('0x7b'),require('./api/variable'));_0x553844[_0x5ed6('0x6')]('/api/integrations',require(_0x5ed6('0x7c')));_0x553844[_0x5ed6('0x6')]('/api/integrations/reports',require(_0x5ed6('0x7d')));_0x553844['use'](_0x5ed6('0x7e'),require(_0x5ed6('0x7f')));_0x553844[_0x5ed6('0x6')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x80'),require(_0x5ed6('0x81')));_0x553844['use'](_0x5ed6('0x82'),require(_0x5ed6('0x83')));_0x553844['use']('/api/analytics/field_reports',require(_0x5ed6('0x84')));_0x553844['use']('/api/analytics/tree_reports',require(_0x5ed6('0x85')));_0x553844[_0x5ed6('0x6')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x86'),require(_0x5ed6('0x87')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x88'),require('./api/intSalesforceField'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x89'),require(_0x5ed6('0x8a')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x8b'),require(_0x5ed6('0x8c')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x8d'),require(_0x5ed6('0x8e')));_0x553844['use'](_0x5ed6('0x8f'),require(_0x5ed6('0x90')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x91'),require(_0x5ed6('0x92')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x93'),require(_0x5ed6('0x94')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x95'),require(_0x5ed6('0x96')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x97'),require(_0x5ed6('0x98')));_0x553844['use'](_0x5ed6('0x99'),require(_0x5ed6('0x9a')));_0x553844['use']('/api/integrations/zendesk/accounts',require(_0x5ed6('0x9b')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x9c'),require('./api/intZendeskConfiguration'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x9d'),require(_0x5ed6('0x9e')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x9f'),require('./api/intFreshdeskAccount'));_0x553844[_0x5ed6('0x6')]('/api/integrations/freshdesk/configurations',require(_0x5ed6('0xa0')));_0x553844['use'](_0x5ed6('0xa1'),require(_0x5ed6('0xa2')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xa3'),require(_0x5ed6('0xa4')));_0x553844['use'](_0x5ed6('0xa5'),require('./api/intVtigerConfiguration'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xa6'),require(_0x5ed6('0xa7')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xa8'),require(_0x5ed6('0xa9')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xaa'),require(_0x5ed6('0xab')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xac'),require(_0x5ed6('0xad')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xae'),require(_0x5ed6('0xaf')));_0x553844['use']('/api/integrations/dynamics365/configurations',require(_0x5ed6('0xb0')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xb1'),require(_0x5ed6('0xb2')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xb3'),require('./api/intFreshsalesAccount'));_0x553844[_0x5ed6('0x6')]('/api/integrations/freshsales/configurations',require(_0x5ed6('0xb4')));_0x553844['use'](_0x5ed6('0xb5'),require('./api/intFreshsalesField'));_0x553844[_0x5ed6('0x6')]('/api/networks',require(_0x5ed6('0xb6')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xb7'),require(_0x5ed6('0xb8')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xb9'),require(_0x5ed6('0xba')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xbb'),require(_0x5ed6('0xbc')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xbd'),require(_0x5ed6('0xbe')));_0x553844['use'](_0x5ed6('0xbf'),require(_0x5ed6('0xc0')));_0x553844['use'](_0x5ed6('0xc1'),require('./api/smsQueueReport'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xc2'),require('./api/squareReport'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xc3'),require(_0x5ed6('0xc4')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xc5'),require(_0x5ed6('0xc6')));_0x553844['use'](_0x5ed6('0xc7'),require('./api/setting'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xc8'),require(_0x5ed6('0xc9')));_0x553844['use'](_0x5ed6('0xca'),require(_0x5ed6('0xcb')));_0x553844['use'](_0x5ed6('0xcc'),require(_0x5ed6('0xcd')));_0x553844['use'](_0x5ed6('0xce'),require(_0x5ed6('0xcf')));_0x553844['use'](_0x5ed6('0xd0'),require(_0x5ed6('0xd1')));_0x553844['use'](_0x5ed6('0xd2'),require(_0x5ed6('0xd3')));_0x553844[_0x5ed6('0x6')]('/api/campaigns',require(_0x5ed6('0xd4')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xd5'),require('./api/migration'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xd6'),require(_0x5ed6('0xd7')));_0x553844['use'](_0x5ed6('0xd8'),require('./api/plugin'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xd9'),require(_0x5ed6('0xda')));_0x553844[_0x5ed6('0x6')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x553844[_0x5ed6('0x6')]('/api/fax/reports/transfer',require(_0x5ed6('0xdb')));_0x553844[_0x5ed6('0x6')]('/api/openchannel/reports/transfer',require(_0x5ed6('0xdc')));_0x553844['use']('/api/sms/reports/transfer',require(_0x5ed6('0xdd')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xde'),require(_0x5ed6('0xdf')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xe0'),require(_0x5ed6('0xe1')));_0x553844['use'](_0x5ed6('0xe2'),require('./api/userProfile'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xe3'),require(_0x5ed6('0xe4')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xe5'),require('./api/userProfileResource'));_0x553844['use']('/api/userNotifications',require(_0x5ed6('0xe6')));_0x553844['use'](_0x5ed6('0xe7'),require(_0x5ed6('0xe8')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xe9'),require(_0x5ed6('0xea')));_0x553844['use'](_0x5ed6('0xeb'),require('./api/whatsappInteraction'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xec'),require(_0x5ed6('0xed')));_0x553844['use']('/api/whatsapp/reports/queue',require(_0x5ed6('0xee')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xef'),require('./api/whatsappTransferReport'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xf0'),require('./api/whatsappQueue'));_0x553844['use'](_0x5ed6('0xf1'),require('./api/cloudProvider'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xf2'),require(_0x5ed6('0xf3')));_0x553844[_0x5ed6('0x6')]('/api/user-settings',require(_0x5ed6('0xf4')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xf5'),require(_0x5ed6('0xf6')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xf7'),require(_0x5ed6('0xf8')));_0x553844['use']('/api/auth/google',require(_0x5ed6('0xf9')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xfa'),require(_0x5ed6('0xfb')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xfc'),require(_0x5ed6('0xfd')));_0x553844[_0x5ed6('0x6')]('/api/rpc',require('./api/rpc'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0xfe'),require(_0x5ed6('0xff')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x100'),require('./api/system'));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x101'),require(_0x5ed6('0x102')));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x103'),require(_0x5ed6('0x104')));_0x553844[_0x5ed6('0x6')]('/api/logs',clientSideLogs);_0x553844['use'](_0x5ed6('0x105'),express[_0x5ed6('0x106')](path[_0x5ed6('0x107')](config['root'],_0x5ed6('0x105'))));_0x553844['use'](_0x5ed6('0x108'),express[_0x5ed6('0x106')](path[_0x5ed6('0x107')](config[_0x5ed6('0x109')],_0x5ed6('0x108'))));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x10a'),express['static'](path[_0x5ed6('0x107')](config['root'],_0x5ed6('0x10a'))));_0x553844[_0x5ed6('0x6')]('/snippet',express['static'](path[_0x5ed6('0x107')](config['root'],_0x5ed6('0x10b'),_0x5ed6('0x10c'))));_0x553844[_0x5ed6('0x6')](_0x5ed6('0x10d'),express[_0x5ed6('0x106')](path[_0x5ed6('0x107')](config[_0x5ed6('0x109')],_0x5ed6('0x10e'))));_0x553844['route'](_0x5ed6('0x10f'))['get'](errors[0x194]);_0x553844[_0x5ed6('0x110')]('/*')['get'](function(_0x4f64c0,_0x4905a1){_0x4905a1[_0x5ed6('0x111')](path['resolve'](_0x553844[_0x5ed6('0x112')](_0x5ed6('0x113'))+'/index.html'));});return _0x553844;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index ab0d259..cccf204 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eb1=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','merge','../api/user/user.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.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/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc'];(function(_0x59d677,_0x344c67){var _0x2b7234=function(_0x33e11e){while(--_0x33e11e){_0x59d677['push'](_0x59d677['shift']());}};_0x2b7234(++_0x344c67);}(_0x1eb1,0xa2));var _0x11eb=function(_0x4d70c7,_0x1edb3a){_0x4d70c7=_0x4d70c7-0x0;var _0x1fca70=_0x1eb1[_0x4d70c7];return _0x1fca70;};'use strict';var jayson=require(_0x11eb('0x0'));var _=require(_0x11eb('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x58708b,_0x24b7fb){var _0x5edc55={};_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x3')));_0x5edc55=_['merge'](_0x5edc55,require('../api/voiceExtension/voiceExtension.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/voiceQueue/voiceQueue.rpc'));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0x4')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x5')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x6')));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0x7')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/memberReport/memberReport.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x8')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x9')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0xa')));_0x5edc55=_['merge'](_0x5edc55,require('../api/mailAccount/mailAccount.rpc'));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0xb')));_0x5edc55=_['merge'](_0x5edc55,require('../api/mailInteraction/mailInteraction.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/mailMessage/mailMessage.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0xc')));_0x5edc55=_['merge'](_0x5edc55,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0xd')));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0xe')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/faxInteraction/faxInteraction.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0xf')));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0x10')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x11')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/smsAccount/smsAccount.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x12')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x13')));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0x14')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x15')));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0x16')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x17')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x18')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x19')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x1a')));_0x5edc55=_['merge'](_0x5edc55,require('../api/chatMessage/chatMessage.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x1b')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x1c')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x1d')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x1e')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x1f')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x20')));_0x5edc55=_['merge'](_0x5edc55,require('../api/interval/interval.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x21')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/sound/sound.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x22')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x23')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/variable/variable.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x24')));_0x5edc55=_['merge'](_0x5edc55,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x25')));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0x26')));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0x27')));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0x28')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x29')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x2a')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5edc55=_['merge'](_0x5edc55,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x2b')));_0x5edc55=_['merge'](_0x5edc55,require('../api/squareReport/squareReport.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x2c')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/setting/setting.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/squareOdbc/squareOdbc.rpc'));_0x5edc55=_['merge'](_0x5edc55,require(_0x11eb('0x2d')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/squareRecording/squareRecording.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x2e')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x2f')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/attachment/attachment.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x30')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x31')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x32')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x33')));_0x5edc55=_[_0x11eb('0x2')](_0x5edc55,require(_0x11eb('0x34')));var _0x4d5bf0=jayson[_0x11eb('0x35')](_0x5edc55)[_0x11eb('0x36')]();var _0x589170=config[_0x11eb('0x37')][_0x11eb('0x38')]||config[_0x11eb('0x38')]+0x1;var _0x5970f3=config['rpc']['ip']||'localhost';_0x4d5bf0['on']('error',function(_0x3f3b9d){return _0x24b7fb(_0x3f3b9d);});_0x4d5bf0['listen'](_0x589170,_0x5970f3,function(){console[_0x11eb('0x39')](_0x11eb('0x3a'),_0x5970f3,_0x589170);require(_0x11eb('0x3b'))['default']();return _0x58708b(_0x11eb('0x3c')+_0x5970f3+':'+_0x589170);});});}; \ No newline at end of file +var _0x2712=['jayson/promise','lodash','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.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/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20'];(function(_0x46d6b9,_0x49c97c){var _0x270f39=function(_0x2b9b42){while(--_0x2b9b42){_0x46d6b9['push'](_0x46d6b9['shift']());}};_0x270f39(++_0x49c97c);}(_0x2712,0x84));var _0x2271=function(_0x144840,_0x1d2bbf){_0x144840=_0x144840-0x0;var _0xc201ad=_0x2712[_0x144840];return _0xc201ad;};'use strict';var jayson=require(_0x2271('0x0'));var _=require(_0x2271('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x6612f9,_0xe76d87){var _0x26d4ee={};_0x26d4ee=_['merge'](_0x26d4ee,require('../api/user/user.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/voiceExtension/voiceExtension.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/voiceQueue/voiceQueue.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x3')));_0x26d4ee=_['merge'](_0x26d4ee,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x4')));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0x5')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x6')));_0x26d4ee=_['merge'](_0x26d4ee,require('../api/memberReport/memberReport.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x7')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x8')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x9')));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0xa')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0xb')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0xc')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0xd')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0xe')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0xf')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/faxAccount/faxAccount.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/faxApplication/faxApplication.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x10')));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0x11')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x12')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x26d4ee=_['merge'](_0x26d4ee,require('../api/smsAccount/smsAccount.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/smsInteraction/smsInteraction.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x13')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x14')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x15')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x16')));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0x17')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x18')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x19')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/chatMessage/chatMessage.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x1a')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/cmContact/cmContact.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x1b')));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0x1c')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x1d')));_0x26d4ee=_['merge'](_0x26d4ee,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x1e')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x1f')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/pause/pause.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x20')));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0x21')));_0x26d4ee=_['merge'](_0x26d4ee,require('../api/template/template.rpc'));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0x22')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x23')));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0x24')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x25')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x26')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x27')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x28')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x29')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x2a')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x2b')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x2c')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x2d')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x2e')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/setting/setting.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x2f')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/squareProject/squareProject.rpc'));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x30')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x31')));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0x32')));_0x26d4ee=_['merge'](_0x26d4ee,require('../api/attachment/attachment.rpc'));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0x33')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x34')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x26d4ee=_['merge'](_0x26d4ee,require(_0x2271('0x35')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x36')));_0x26d4ee=_[_0x2271('0x2')](_0x26d4ee,require(_0x2271('0x37')));var _0x2a50bf=jayson[_0x2271('0x38')](_0x26d4ee)[_0x2271('0x39')]();var _0x254ff8=config[_0x2271('0x3a')][_0x2271('0x3b')]||config['port']+0x1;var _0x5f4a35=config['rpc']['ip']||_0x2271('0x3c');_0x2a50bf['on'](_0x2271('0x3d'),function(_0x369638){return _0xe76d87(_0x369638);});_0x2a50bf[_0x2271('0x3e')](_0x254ff8,_0x5f4a35,function(){console[_0x2271('0x3f')](_0x2271('0x40'),_0x5f4a35,_0x254ff8);require('../config/triggers')['default']();return _0x6612f9(_0x2271('0x41')+_0x5f4a35+':'+_0x254ff8);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index dfdaa4a..41e508a 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 _0xee7f=['SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','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','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','substring','520-Invalid','520\x20End\x20of\x20proper','replace','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','format','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s'];(function(_0x50ae30,_0x2309a1){var _0x4dc9b0=function(_0x4712ab){while(--_0x4712ab){_0x50ae30['push'](_0x50ae30['shift']());}};_0x4dc9b0(++_0x2309a1);}(_0xee7f,0x18a));var _0xfee7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xee7f[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xfee7('0x0'));var _=require(_0xfee7('0x1'));var EventEmitter=require(_0xfee7('0x2'))[_0xfee7('0x3')];var AGIReply=require(_0xfee7('0x4'));var AGIError=require(_0xfee7('0x5'));function AGIChannel(_0x226485){var _0x1d6c8c=this,_0x145211=new AGIReply(),_0x5d0107=![],_0x53feb0={};EventEmitter[_0xfee7('0x6')](_0x1d6c8c);_0x226485['setEncoding'](_0xfee7('0x7'));_0x226485[_0xfee7('0x8')](0x8*0x3c*0x3c*0x3e8);_0x145211[_0xfee7('0x9')](_0xfee7('0x7'));_0x145211['on'](_0xfee7('0xa'),function(_0xf68beb){for(var _0x1bd60a in _0xf68beb){_0x1d6c8c[_0x1bd60a]=_0xf68beb[_0x1bd60a];}_0x1d6c8c[_0xfee7('0xb')](_0xfee7('0xc'));});_0x145211['on'](_0xfee7('0xd'),function(_0x254dd0){if(_0x254dd0['toLowerCase']()=='hangup'){_0x1d6c8c[_0xfee7('0xb')]('hangup');return;}if(_0x254dd0[_0xfee7('0xe')](0x0,0xb)==_0xfee7('0xf')){_0x5d0107=!![];}if(_0x5d0107){_0x53feb0['rx']+=_0x254dd0+'\x0a';if(_0x254dd0['search'](_0xfee7('0x10'))!=-0x1){_0x5d0107=![];}}else{_0x53feb0['rx']=_0x254dd0;}if(_0x5d0107){return;}if(typeof _0x53feb0['cb']=='function'){var _0x259e7f=_0x53feb0['rx'][_0xfee7('0xe')](0x0,0x3),_0x333492=null,_0x5d66c9=null;_0x259e7f=parseInt(_0x259e7f);if(isNaN(_0x259e7f)){_0x53feb0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x259e7f!=0xc8){_0x53feb0['cb'](null,{'code':_0x259e7f,'result':-0x1,'extra':'KO'});return;}_0x333492=_0x53feb0['rx']['substring'](0x4)[_0xfee7('0x11')]('result=','');if(_0x333492[_0xfee7('0x12')]('\x20')!=-0x1){_0x333492=_0x333492[_0xfee7('0x13')](0x0,_0x333492[_0xfee7('0x12')]('\x20'));}if(_['startsWith'](_0x333492,'-1')){_0x333492=parseInt(_0x333492);}_0x5d66c9=_0x53feb0['rx'][_0xfee7('0x14')]('\x20');if(_0x5d66c9[_0xfee7('0x15')]==0x3){_0x5d66c9=_0x5d66c9[0x2][_0xfee7('0xe')](0x1,_0x5d66c9[0x2]['length']-0x1);}else if(_0x5d66c9[_0xfee7('0x15')]>0x3){var _0x118509=/\((.+)\)/;var _0x3e21b8=_0x53feb0['rx'][_0xfee7('0x16')](_0x118509);if(_0x3e21b8){_0x5d66c9=_0x3e21b8[0x1];}else{_0x5d66c9=null;}}else{_0x5d66c9=null;}_0x53feb0['cb'](null,{'code':_0x259e7f,'result':_0x333492,'extra':_0x5d66c9});}});_0x226485['on'](_0xfee7('0x17'),function(_0x49ca9f){_0x1d6c8c['emit'](_0xfee7('0x17'),new AGIError(_0xfee7('0x18'),_0x49ca9f[_0xfee7('0x19')]));});_0x226485['on']('close',function(){_0x1d6c8c[_0xfee7('0xb')]('close',new AGIError(_0xfee7('0x1a')));});_0x226485['on'](_0xfee7('0x1b'),function(){_0x1d6c8c[_0xfee7('0xb')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x226485[_0xfee7('0x1c')]();});_0x226485[_0xfee7('0x1d')](_0x145211);this[_0xfee7('0x1e')]=function(_0x5b25a2,_0x44c0a3){var _0x5b25a2=_0x5b25a2||'',_0x44c0a3=typeof _0x44c0a3=='function'?_0x44c0a3:new Function();_0x53feb0={'tx':_0x5b25a2,'rx':'','cb':_0x44c0a3};_0x226485[_0xfee7('0x1f')](_0x5b25a2+'\x0a');},this['close']=function(){_0x226485[_0xfee7('0x1c')]();};}util[_0xfee7('0x20')](AGIChannel,EventEmitter);AGIChannel[_0xfee7('0x21')][_0xfee7('0x22')]=function(_0x366d0a){return this['command'][_0xfee7('0x23')](this,_0x366d0a);};AGIChannel[_0xfee7('0x21')][_0xfee7('0x24')]=function(){return this[_0xfee7('0x22')]('ANSWER');};AGIChannel[_0xfee7('0x21')]['getData']=function(_0x20a3f0,_0x4de47b,_0x2285c6){_0x20a3f0=_0x20a3f0===undefined?_0xfee7('0x25'):_0x20a3f0;_0x4de47b=_0x4de47b===undefined?'5':_0x4de47b;_0x2285c6=_0x2285c6===undefined?'1':_0x2285c6;return this[_0xfee7('0x22')](util['format'](_0xfee7('0x26'),_0x20a3f0,_0x4de47b*0x3e8,_0x2285c6));};AGIChannel[_0xfee7('0x21')][_0xfee7('0x27')]=function(_0x331cf2){_0x331cf2=_0x331cf2||_0xfee7('0x28');return this[_0xfee7('0x22')](util['format'](_0xfee7('0x29'),_0x331cf2));};AGIChannel['prototype'][_0xfee7('0x2a')]=function(_0xfdc47,_0x26a6a8){if(_[_0xfee7('0x2b')](_0x26a6a8)){return this['sendRequest'](util[_0xfee7('0x2c')]('EXEC\x20%s\x20%s',_0xfdc47,_0x26a6a8['join'](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0xfdc47,_0x26a6a8));};AGIChannel[_0xfee7('0x21')]['setContext']=function(_0xc725ff){return this[_0xfee7('0x22')](util[_0xfee7('0x2c')](_0xfee7('0x2d'),_0xc725ff));};AGIChannel[_0xfee7('0x21')][_0xfee7('0x2e')]=function(_0xd7d955){return this[_0xfee7('0x22')](util[_0xfee7('0x2c')]('SET\x20EXTENSION\x20%s',_0xd7d955));};AGIChannel[_0xfee7('0x21')][_0xfee7('0x2f')]=function(_0x3c52b6){return this[_0xfee7('0x22')](util[_0xfee7('0x2c')](_0xfee7('0x30'),_0x3c52b6));};AGIChannel[_0xfee7('0x21')]['hangup']=function(){return this[_0xfee7('0x22')](_0xfee7('0x31'));};AGIChannel['prototype'][_0xfee7('0x32')]=function(_0x283471,_0x37df18){var _0xf95358=_['isBoolean'](_0x37df18)||_[_0xfee7('0x33')](_0x37df18)?_0x37df18[_0xfee7('0x34')]():_0x37df18;return this[_0xfee7('0x22')](util[_0xfee7('0x2c')](_0xfee7('0x35'),_0x283471,_0xf95358?_0xf95358[_0xfee7('0x34')]()[_0xfee7('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfee7('0x21')][_0xfee7('0x36')]=function(_0x6f325f,_0x1bed18){return this[_0xfee7('0x22')](util[_0xfee7('0x2c')](_0xfee7('0x37'),_0x6f325f,_0x1bed18));};AGIChannel['prototype']['sayDigits']=function(_0x99695a,_0x297153){return this['sendRequest'](util['format'](_0xfee7('0x38'),_0x99695a,_0x297153));};AGIChannel[_0xfee7('0x21')][_0xfee7('0x39')]=function(_0xcad17f,_0x34491e){return this['sendRequest'](util[_0xfee7('0x2c')](_0xfee7('0x3a'),_0xcad17f,_0x34491e));};AGIChannel[_0xfee7('0x21')][_0xfee7('0x3b')]=function(_0x2f3647,_0x311260,_0x1bd4f6){_0x311260=_0x311260||this['extension'];_0x1bd4f6=_0x1bd4f6||0x1;this[_0xfee7('0x3c')](_0x2f3647);this['setExtension'](_0x311260);this[_0xfee7('0x2f')](_0x1bd4f6);return this[_0xfee7('0x27')](util[_0xfee7('0x2c')](_0xfee7('0x3d'),_0x2f3647,_0x311260,_0x1bd4f6));};AGIChannel[_0xfee7('0x21')][_0xfee7('0x3e')]=function(_0x43f029){return this[_0xfee7('0x22')](util[_0xfee7('0x2c')](_0xfee7('0x3f'),_0x43f029));};AGIChannel[_0xfee7('0x21')]['recordFile']=function(_0x232783,_0x414b70,_0x1b366d,_0x3025a9,_0x4cfd4d,_0x47c8ae){_0x414b70=_0x414b70||_0xfee7('0x40');_0x1b366d=_0x1b366d||'';_0x3025a9=_0x3025a9===undefined?-0x1:_0x3025a9==='-1'?-0x1:_0x3025a9*0x3e8;_0x4cfd4d=_0x4cfd4d===undefined?'':'s='+_0x4cfd4d;_0x47c8ae=_0x47c8ae?_0xfee7('0x41'):'';return this[_0xfee7('0x22')](util[_0xfee7('0x2c')](_0xfee7('0x42'),_0x232783,_0x414b70,_0x1b366d,_0x3025a9,_0x47c8ae,_0x4cfd4d));};AGIChannel['prototype'][_0xfee7('0x43')]=function(_0x16d786,_0x1727b3){_0x1727b3=_0x1727b3||'';return this[_0xfee7('0x22')](util[_0xfee7('0x2c')](_0xfee7('0x44'),_0x16d786,_0x1727b3));};AGIChannel['prototype'][_0xfee7('0x45')]=function(_0x51f15a){return this[_0xfee7('0x2a')](_0xfee7('0x46'),_0x51f15a);};AGIChannel[_0xfee7('0x21')][_0xfee7('0x47')]=function(_0x233e1){return this[_0xfee7('0x2a')](_0xfee7('0x48'),_0x233e1);};AGIChannel[_0xfee7('0x21')][_0xfee7('0x17')]=function(_0x52467e,_0x408ff2){this[_0xfee7('0x27')](util[_0xfee7('0x2c')](_0xfee7('0x49'),_0x52467e['id'],_0x52467e[_0xfee7('0x4a')],_0x408ff2));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xbd3a=['SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','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','agi','AGI','wait','label','util','lodash','events','EventEmitter','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup','substring','520-Invalid','function','replace','indexOf','substr','startsWith','split','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','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','join','setContext','SET\x20CONTEXT\x20%s','setExtension'];(function(_0x54dc94,_0x16271a){var _0x2eedca=function(_0x26305f){while(--_0x26305f){_0x54dc94['push'](_0x54dc94['shift']());}};_0x2eedca(++_0x16271a);}(_0xbd3a,0xb9));var _0xabd3=function(_0x2bcc99,_0x32d887){_0x2bcc99=_0x2bcc99-0x0;var _0x24e08e=_0xbd3a[_0x2bcc99];return _0x24e08e;};'use strict';var util=require(_0xabd3('0x0'));var _=require(_0xabd3('0x1'));var EventEmitter=require(_0xabd3('0x2'))[_0xabd3('0x3')];var AGIReply=require('./reply');var AGIError=require(_0xabd3('0x4'));function AGIChannel(_0x4c8c22){var _0x274c8b=this,_0x4d09c9=new AGIReply(),_0x4f025f=![],_0x3e3a96={};EventEmitter['call'](_0x274c8b);_0x4c8c22[_0xabd3('0x5')](_0xabd3('0x6'));_0x4c8c22[_0xabd3('0x7')](0x8*0x3c*0x3c*0x3e8);_0x4d09c9[_0xabd3('0x5')](_0xabd3('0x6'));_0x4d09c9['on'](_0xabd3('0x8'),function(_0x27a36b){for(var _0x1df021 in _0x27a36b){_0x274c8b[_0x1df021]=_0x27a36b[_0x1df021];}_0x274c8b[_0xabd3('0x9')](_0xabd3('0xa'));});_0x4d09c9['on'](_0xabd3('0xb'),function(_0xddc4d4){if(_0xddc4d4['toLowerCase']()==_0xabd3('0xc')){_0x274c8b[_0xabd3('0x9')](_0xabd3('0xc'));return;}if(_0xddc4d4[_0xabd3('0xd')](0x0,0xb)==_0xabd3('0xe')){_0x4f025f=!![];}if(_0x4f025f){_0x3e3a96['rx']+=_0xddc4d4+'\x0a';if(_0xddc4d4['search']('520\x20End\x20of\x20proper')!=-0x1){_0x4f025f=![];}}else{_0x3e3a96['rx']=_0xddc4d4;}if(_0x4f025f){return;}if(typeof _0x3e3a96['cb']==_0xabd3('0xf')){var _0x1b24d5=_0x3e3a96['rx'][_0xabd3('0xd')](0x0,0x3),_0x3ec568=null,_0x40d5a6=null;_0x1b24d5=parseInt(_0x1b24d5);if(isNaN(_0x1b24d5)){_0x3e3a96['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x1b24d5!=0xc8){_0x3e3a96['cb'](null,{'code':_0x1b24d5,'result':-0x1,'extra':'KO'});return;}_0x3ec568=_0x3e3a96['rx']['substring'](0x4)[_0xabd3('0x10')]('result=','');if(_0x3ec568[_0xabd3('0x11')]('\x20')!=-0x1){_0x3ec568=_0x3ec568[_0xabd3('0x12')](0x0,_0x3ec568[_0xabd3('0x11')]('\x20'));}if(_[_0xabd3('0x13')](_0x3ec568,'-1')){_0x3ec568=parseInt(_0x3ec568);}_0x40d5a6=_0x3e3a96['rx'][_0xabd3('0x14')]('\x20');if(_0x40d5a6['length']==0x3){_0x40d5a6=_0x40d5a6[0x2][_0xabd3('0xd')](0x1,_0x40d5a6[0x2]['length']-0x1);}else if(_0x40d5a6['length']>0x3){var _0x3183d9=/\((.+)\)/;var _0x46e261=_0x3e3a96['rx']['match'](_0x3183d9);if(_0x46e261){_0x40d5a6=_0x46e261[0x1];}else{_0x40d5a6=null;}}else{_0x40d5a6=null;}_0x3e3a96['cb'](null,{'code':_0x1b24d5,'result':_0x3ec568,'extra':_0x40d5a6});}});_0x4c8c22['on']('error',function(_0xaef546){_0x274c8b[_0xabd3('0x9')](_0xabd3('0x15'),new AGIError(_0xabd3('0x16'),_0xaef546[_0xabd3('0x17')]));});_0x4c8c22['on'](_0xabd3('0x18'),function(){_0x274c8b[_0xabd3('0x9')](_0xabd3('0x18'),new AGIError(_0xabd3('0x19')));});_0x4c8c22['on'](_0xabd3('0x1a'),function(){_0x274c8b[_0xabd3('0x9')]('timeout',new AGIError(_0xabd3('0x1b')));_0x4c8c22[_0xabd3('0x1c')]();});_0x4c8c22[_0xabd3('0x1d')](_0x4d09c9);this[_0xabd3('0x1e')]=function(_0x4e1e68,_0x1c9882){var _0x4e1e68=_0x4e1e68||'',_0x1c9882=typeof _0x1c9882=='function'?_0x1c9882:new Function();_0x3e3a96={'tx':_0x4e1e68,'rx':'','cb':_0x1c9882};_0x4c8c22[_0xabd3('0x1f')](_0x4e1e68+'\x0a');},this[_0xabd3('0x18')]=function(){_0x4c8c22[_0xabd3('0x1c')]();};}util[_0xabd3('0x20')](AGIChannel,EventEmitter);AGIChannel[_0xabd3('0x21')][_0xabd3('0x22')]=function(_0x158aa9){return this[_0xabd3('0x1e')][_0xabd3('0x23')](this,_0x158aa9);};AGIChannel[_0xabd3('0x21')][_0xabd3('0x24')]=function(){return this[_0xabd3('0x22')](_0xabd3('0x25'));};AGIChannel[_0xabd3('0x21')][_0xabd3('0x26')]=function(_0x814004,_0x3bed77,_0xf3e239){_0x814004=_0x814004===undefined?_0xabd3('0x27'):_0x814004;_0x3bed77=_0x3bed77===undefined?'5':_0x3bed77;_0xf3e239=_0xf3e239===undefined?'1':_0xf3e239;return this['sendRequest'](util[_0xabd3('0x28')](_0xabd3('0x29'),_0x814004,_0x3bed77*0x3e8,_0xf3e239));};AGIChannel['prototype'][_0xabd3('0x2a')]=function(_0x179711){_0x179711=_0x179711||_0xabd3('0x2b');return this['sendRequest'](util[_0xabd3('0x28')](_0xabd3('0x2c'),_0x179711));};AGIChannel[_0xabd3('0x21')][_0xabd3('0x2d')]=function(_0x5db9c6,_0x158ea9){if(_[_0xabd3('0x2e')](_0x158ea9)){return this[_0xabd3('0x22')](util[_0xabd3('0x28')](_0xabd3('0x2f'),_0x5db9c6,_0x158ea9[_0xabd3('0x30')](',')));}return this['sendRequest'](util[_0xabd3('0x28')]('EXEC\x20%s\x20%s',_0x5db9c6,_0x158ea9));};AGIChannel['prototype'][_0xabd3('0x31')]=function(_0x1b995f){return this['sendRequest'](util[_0xabd3('0x28')](_0xabd3('0x32'),_0x1b995f));};AGIChannel['prototype'][_0xabd3('0x33')]=function(_0x184092){return this[_0xabd3('0x22')](util['format'](_0xabd3('0x34'),_0x184092));};AGIChannel[_0xabd3('0x21')]['setPriority']=function(_0x4c6c67){return this[_0xabd3('0x22')](util[_0xabd3('0x28')](_0xabd3('0x35'),_0x4c6c67));};AGIChannel[_0xabd3('0x21')][_0xabd3('0xc')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0xabd3('0x21')][_0xabd3('0x36')]=function(_0xeaa085,_0x55054f){var _0x46db68=_[_0xabd3('0x37')](_0x55054f)||_['isNumber'](_0x55054f)?_0x55054f[_0xabd3('0x38')]():_0x55054f;return this[_0xabd3('0x22')](util['format'](_0xabd3('0x39'),_0xeaa085,_0x46db68?_0x46db68[_0xabd3('0x38')]()[_0xabd3('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xabd3('0x21')][_0xabd3('0x3a')]=function(_0x15ab51,_0x44ae2c){return this[_0xabd3('0x22')](util[_0xabd3('0x28')](_0xabd3('0x3b'),_0x15ab51,_0x44ae2c));};AGIChannel[_0xabd3('0x21')][_0xabd3('0x3c')]=function(_0x4e4ab9,_0x2d9fd0){return this[_0xabd3('0x22')](util[_0xabd3('0x28')](_0xabd3('0x3d'),_0x4e4ab9,_0x2d9fd0));};AGIChannel[_0xabd3('0x21')][_0xabd3('0x3e')]=function(_0x2e2896,_0x207a9f){return this[_0xabd3('0x22')](util['format'](_0xabd3('0x3f'),_0x2e2896,_0x207a9f));};AGIChannel[_0xabd3('0x21')][_0xabd3('0x40')]=function(_0x126037,_0xb3d999,_0xdb3ffa){_0xb3d999=_0xb3d999||this[_0xabd3('0x41')];_0xdb3ffa=_0xdb3ffa||0x1;this[_0xabd3('0x31')](_0x126037);this[_0xabd3('0x33')](_0xb3d999);this[_0xabd3('0x42')](_0xdb3ffa);return this['noop'](util['format'](_0xabd3('0x43'),_0x126037,_0xb3d999,_0xdb3ffa));};AGIChannel[_0xabd3('0x21')]['getVariable']=function(_0x5b72d2){return this[_0xabd3('0x22')](util[_0xabd3('0x28')](_0xabd3('0x44'),_0x5b72d2));};AGIChannel[_0xabd3('0x21')][_0xabd3('0x45')]=function(_0x1d12bd,_0x6214ae,_0xef9f89,_0x1bd6b2,_0x16342c,_0x1ab4d6){_0x6214ae=_0x6214ae||_0xabd3('0x46');_0xef9f89=_0xef9f89||'';_0x1bd6b2=_0x1bd6b2===undefined?-0x1:_0x1bd6b2==='-1'?-0x1:_0x1bd6b2*0x3e8;_0x16342c=_0x16342c===undefined?'':'s='+_0x16342c;_0x1ab4d6=_0x1ab4d6?_0xabd3('0x47'):'';return this[_0xabd3('0x22')](util[_0xabd3('0x28')](_0xabd3('0x48'),_0x1d12bd,_0x6214ae,_0xef9f89,_0x1bd6b2,_0x1ab4d6,_0x16342c));};AGIChannel[_0xabd3('0x21')][_0xabd3('0x49')]=function(_0x36a4e7,_0x535272){_0x535272=_0x535272||'';return this[_0xabd3('0x22')](util['format'](_0xabd3('0x4a'),_0x36a4e7,_0x535272));};AGIChannel[_0xabd3('0x21')][_0xabd3('0x4b')]=function(_0x3e2a2e){return this['exec'](_0xabd3('0x4c'),_0x3e2a2e);};AGIChannel[_0xabd3('0x21')][_0xabd3('0x4d')]=function(_0x2e73ef){return this[_0xabd3('0x2d')]('WAIT',_0x2e73ef);};AGIChannel['prototype']['error']=function(_0x5173c1,_0x17a194){this[_0xabd3('0x2a')](util[_0xabd3('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5173c1['id'],_0x5173c1[_0xabd3('0x4e')],_0x17a194));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 b7820e5..f46724e 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 _0x8f45=['util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0xe76a95,_0x57c9ee){var _0xca2ed4=function(_0x23ea82){while(--_0x23ea82){_0xe76a95['push'](_0xe76a95['shift']());}};_0xca2ed4(++_0x57c9ee);}(_0x8f45,0x12c));var _0x58f4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8f45[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x58f4('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x58f4('0x1'),'E_AGI_SERVER_ERROR':_0x58f4('0x2'),'E_AGI_SERVER_CLOSE':_0x58f4('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x58f4('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x58f4('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x58f4('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x58f4('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x58f4('0x8'),'E_AGI_IVR_ENTRY':_0x58f4('0x9')};function AGIError(_0x354887){var _0x354887=_0x354887||null,_0x157107=_0x157107||[],_0x453e03=0x1,_0xd70dc1='';if(!error[_0x354887]){_0x354887=_0x58f4('0xa');}_0x157107[_0x58f4('0xb')](error[_0x354887]);while(arguments[_0x453e03]){_0x157107['push'](arguments[_0x453e03]);_0x453e03++;}_0xd70dc1=util[_0x58f4('0xc')][_0x58f4('0xd')](util,_0x157107);this[_0x58f4('0xe')]=_0xd70dc1;this['name']=_0x354887;}module['exports']=AGIError; \ No newline at end of file +var _0x5910=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x5910,0xb8));var _0x0591=function(_0x4b0cdb,_0x5cd397){_0x4b0cdb=_0x4b0cdb-0x0;var _0x805786=_0x5910[_0x4b0cdb];return _0x805786;};'use strict';var util=require(_0x0591('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x0591('0x1'),'E_AGI_SERVER_ERROR':_0x0591('0x2'),'E_AGI_SERVER_CLOSE':_0x0591('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x0591('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x0591('0x5'),'E_AGI_SOCKET_ERROR':_0x0591('0x6'),'E_AGI_SOCKET_CLOSE':_0x0591('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x0591('0x8'),'E_AGI_COMMAND_EMPTY':_0x0591('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0591('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3de8fe){var _0x3de8fe=_0x3de8fe||null,_0x529cc5=_0x529cc5||[],_0x4a42f0=0x1,_0x49acaf='';if(!error[_0x3de8fe]){_0x3de8fe=_0x0591('0xb');}_0x529cc5[_0x0591('0xc')](error[_0x3de8fe]);while(arguments[_0x4a42f0]){_0x529cc5['push'](arguments[_0x4a42f0]);_0x4a42f0++;}_0x49acaf=util['format'][_0x0591('0xd')](util,_0x529cc5);this[_0x0591('0xe')]=_0x49acaf;this[_0x0591('0xf')]=_0x3de8fe;}module[_0x0591('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index dcd4943..07f27d0 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 _0x2296=['ioredis','./error','../../config/environment','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','projectUpdate','exports','lodash','EventEmitter'];(function(_0x4eefdf,_0x2604d0){var _0x165423=function(_0x1bbdf4){while(--_0x1bbdf4){_0x4eefdf['push'](_0x4eefdf['shift']());}};_0x165423(++_0x2604d0);}(_0x2296,0xfd));var _0x6229=function(_0x3bb922,_0x4cb826){_0x3bb922=_0x3bb922-0x0;var _0x2b312c=_0x2296[_0x3bb922];return _0x2b312c;};'use strict';var _=require(_0x6229('0x0'));var EventEmitter=require('events')[_0x6229('0x1')];var Redis=require(_0x6229('0x2'));var AGIError=require(_0x6229('0x3'));var config=require(_0x6229('0x4'));config[_0x6229('0x5')]=_['defaults'](config[_0x6229('0x5')],{'host':_0x6229('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x6229('0x7')](_0x6229('0x8'),function(_0x1d227d){if(_0x1d227d)return eventEmitter[_0x6229('0x9')](_0x6229('0xa'),new AGIError(_0x6229('0xb'),_0x1d227d));});sub['on'](_0x6229('0xc'),function(_0x30e46a,_0x4bb947){if(_0x30e46a!=='agi')return;try{var _0x588d26=JSON['parse'](_0x4bb947);eventEmitter['emit'](_0x6229('0xd'),_0x588d26);}catch(_0x4f090d){eventEmitter[_0x6229('0x9')](_0x6229('0xa'),new AGIError(_0x6229('0xb'),_0x4f090d));}});module[_0x6229('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x3ac9=['emit','message','parse','projectUpdate','exports','lodash','./error','../../config/environment','redis','localhost','agi'];(function(_0x41de68,_0x33c39f){var _0x3c67b0=function(_0x15c2ac){while(--_0x15c2ac){_0x41de68['push'](_0x41de68['shift']());}};_0x3c67b0(++_0x33c39f);}(_0x3ac9,0x1d3));var _0x93ac=function(_0x4593e2,_0x4de5f0){_0x4593e2=_0x4593e2-0x0;var _0x8c7ce2=_0x3ac9[_0x4593e2];return _0x8c7ce2;};'use strict';var _=require(_0x93ac('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0x93ac('0x1'));var config=require(_0x93ac('0x2'));config['redis']=_['defaults'](config[_0x93ac('0x3')],{'host':_0x93ac('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe'](_0x93ac('0x5'),function(_0x5b0d60){if(_0x5b0d60)return eventEmitter[_0x93ac('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x5b0d60));});sub['on'](_0x93ac('0x7'),function(_0x15251e,_0x23f6ed){if(_0x15251e!==_0x93ac('0x5'))return;try{var _0x235e4e=JSON[_0x93ac('0x8')](_0x23f6ed);eventEmitter[_0x93ac('0x6')](_0x93ac('0x9'),_0x235e4e);}catch(_0x5e3343){eventEmitter[_0x93ac('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x5e3343));}});module[_0x93ac('0xa')]={'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 c1fbb66..68c3f18 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 _0x5c66=['stop\x20traverse','no\x20edge/s\x20available','length','condition','vswitch','target','default','agicommand','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x5c66,0x192));var _0x65c6=function(_0x39907f,_0x32247c){_0x39907f=_0x39907f-0x0;var _0x495d6e=_0x5c66[_0x39907f];return _0x495d6e;};'use strict';var _=require(_0x65c6('0x0'));var logger=require(_0x65c6('0x1'))(_0x65c6('0x2'));var verticesWithRetry=[_0x65c6('0x3'),_0x65c6('0x4'),_0x65c6('0x5')];var Graph=function(){this[_0x65c6('0x6')]={};this['edges']={};this[_0x65c6('0x7')]=0x0;};Graph[_0x65c6('0x8')][_0x65c6('0x9')]=function(_0x48e53a){this['vertices'][_0x48e53a['id']]=_0x48e53a;this[_0x65c6('0xa')][_0x48e53a['id']]=[];};Graph['prototype'][_0x65c6('0xb')]=function(_0x1afd21,_0x5ee68d,_0xad257e){this['edges'][_0x1afd21]['push']({'target':_0x5ee68d,'condition':_0xad257e});this[_0x65c6('0x7')]+=0x1;};Graph[_0x65c6('0x8')][_0x65c6('0xc')]=function(){return _[_0x65c6('0xc')](this[_0x65c6('0x6')]);};Graph[_0x65c6('0x8')][_0x65c6('0xd')]=function(){return this['numberOfEdges'];};Graph[_0x65c6('0x8')][_0x65c6('0xe')]=function(_0x4b17dd){return this['vertices'][_0x4b17dd];};Graph[_0x65c6('0x8')][_0x65c6('0xf')]=function(_0x1d15ac,_0x4f0139){if(!this[_0x65c6('0x6')][_0x1d15ac]){return logger[_0x65c6('0x10')](_0x65c6('0x11'));}var _0x4f4e29=_0x4f0139(this[_0x65c6('0x6')][_0x1d15ac]);if(!_0x4f4e29){return logger[_0x65c6('0x10')](_0x65c6('0x12'));}if(this[_0x65c6('0xa')][_0x1d15ac]['length']===0x0){return logger[_0x65c6('0x10')](_0x65c6('0x13'));}for(var _0x31444d=0x0,_0x33d514=[],_0x325f1f=![];_0x31444d\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','hasOwnProperty','indexOf','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','hangup','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','catch','[LICENSE]','finally'];(function(_0x561ddc,_0x107c47){var _0x1c43bf=function(_0x609814){while(--_0x609814){_0x561ddc['push'](_0x561ddc['shift']());}};_0x1c43bf(++_0x107c47);}(_0x34c3,0xf6));var _0x334c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x34c3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var syncho=require(_0x334c('0x0'));var util=require(_0x334c('0x1'));var config=require(_0x334c('0x2'));var logger=require(_0x334c('0x3'))(_0x334c('0x4'));var utilLicense=require(_0x334c('0x5'));var rpc=require(_0x334c('0x6'));var Project=require(_0x334c('0x7'));var AGIEmitter=require(_0x334c('0x8'))[_0x334c('0x9')];var projects=[];config[_0x334c('0x4')]=_['defaults'](config[_0x334c('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x334c('0xa'),projectUpdateHandler);function connectionHandler(_0x411527){process[_0x334c('0xb')](function(){syncho(function(){try{setChannelVariables(_0x411527);agiHandler(_0x411527);}catch(_0x401aca){logger[_0x334c('0xc')](_0x401aca[_0x334c('0xd')]);}});});}function projectUpdateHandler(_0x551770){try{var _0x7f4d02=_[_0x334c('0xe')](projects,['id',_0x551770['id']]);if(_0x7f4d02>-0x1){if(_0x551770[_0x334c('0xf')]===!![]){projects[_0x334c('0x10')](_0x7f4d02,0x1);}else{projects[_0x7f4d02]=_0x551770;}}else{projects[_0x334c('0x11')](_0x551770);}}catch(_0x42b9ce){logger[_0x334c('0xc')](_0x42b9ce[_0x334c('0xd')]);}}function listeningHandler(){var _0x3fad45=config[_0x334c('0x12')]===_0x334c('0x13')||![];console[_0x334c('0x14')](_0x334c('0x15'),config[_0x334c('0x4')][_0x334c('0x16')]);logger['info'](util['format'](_0x334c('0x17'),_0x3fad45?config['agi']['ip']:_0x334c('0x18'),config['agi'][_0x334c('0x16')]));}function errorHandler(_0x13cc28){if(_0x13cc28&&_0x13cc28[_0x334c('0x19')]&&_0x13cc28[_0x334c('0x1a')]){logger['error'](util[_0x334c('0x1b')]('[%s]\x20%s',_0x13cc28[_0x334c('0x19')],_0x13cc28['message']));}else{logger[_0x334c('0xc')](util[_0x334c('0x1b')](_0x334c('0x1c'),_0x13cc28[_0x334c('0xd')]));}}function closeHandler(){logger[_0x334c('0x1d')](util[_0x334c('0x1b')](_0x334c('0x1e'),this['arg_1'],this[_0x334c('0x1f')],this[_0x334c('0x20')],this[_0x334c('0x21')],this[_0x334c('0x22')]));try{createSquareReport(this);}catch(_0x2a8be1){logger[_0x334c('0xc')](_0x2a8be1[_0x334c('0xd')]);}}function timeoutHandler(){logger[_0x334c('0x1d')](util[_0x334c('0x1b')](_0x334c('0x23'),this[_0x334c('0x24')],this[_0x334c('0x1f')],this[_0x334c('0x20')],this['dnid'],this[_0x334c('0x22')]));}function hangupHandler(){logger[_0x334c('0x1d')](util[_0x334c('0x1b')](_0x334c('0x25'),this[_0x334c('0x24')],this[_0x334c('0x1f')],this[_0x334c('0x20')],this['dnid'],this[_0x334c('0x22')]));this['evtHangup']=!![];}function createSquareReport(_0x3d42c5,_0x1fb475){rpc[_0x334c('0x26')](_0x3d42c5)[_0x334c('0x27')](function(_0x52398c){if(_0x1fb475){_0x1fb475(null,_0x52398c);}})['catch'](function(_0x772806){if(_0x1fb475){_0x1fb475(null,_0x772806);}});}function setChannelVariables(_0x743b6f){for(var _0x2b4d53 in _0x743b6f){if(_0x743b6f[_0x334c('0x28')](_0x2b4d53)){if(_0x2b4d53[_0x334c('0x29')]('agi_')===0x0){_0x743b6f[_0x2b4d53[_0x334c('0x2a')](0x4)]=_0x743b6f[_0x2b4d53];delete _0x743b6f[_0x2b4d53];}}}}function agiHandler(_0x34d257){logger[_0x334c('0x2b')](_0x334c('0x2c'),JSON[_0x334c('0x2d')](_0x34d257,null,0x2));logger[_0x334c('0x1d')](util['format'](_0x334c('0x2e'),_0x34d257['arg_1'],_0x34d257[_0x334c('0x1f')],_0x34d257['callerid'],_0x34d257[_0x334c('0x21')],_0x34d257[_0x334c('0x22')]));_0x34d257['on'](_0x334c('0xc'),errorHandler);_0x34d257['on'](_0x334c('0x2f'),closeHandler);_0x34d257['on']('timeout',timeoutHandler);_0x34d257[_0x334c('0x30')]=![];_0x34d257['on'](_0x334c('0x31'),hangupHandler);var _0x8548f2=_['find'](projects,[_0x334c('0x19'),_0x34d257[_0x334c('0x24')]]);if(!_0x8548f2)return Project['handleNotFound'](_0x34d257);if(!_0x8548f2[_0x334c('0x13')])return Project['handleUnpublished'](_0x34d257);return Project[_0x334c('0x32')](_0x8548f2,_0x34d257);}function main(){var _0x1cb53d;return utilLicense['getLicense']()[_0x334c('0x27')](function(_0x264949){if(!_0x264949)return;if(_0x264949[_0x334c('0x33')]){if(_0x264949[_0x334c('0x34')]&&_0x264949['callysquare']>0x0){logger['info'](util['format'](_0x334c('0x35'),_0x264949['callysquare']));_0x1cb53d=_0x264949['callysquare'];}else{logger['info'](_0x334c('0x36'));}}else{logger[_0x334c('0x1d')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1cb53d=-0x1;}})[_0x334c('0x27')](function(){return Project[_0x334c('0x37')]();})['then'](function(_0x4b6c3a){projects=_0x4b6c3a;return;})[_0x334c('0x38')](function(_0x26b198){logger[_0x334c('0xc')](_0x334c('0x39'),_0x26b198[_0x334c('0xd')]);})[_0x334c('0x3a')](function(){var _0x3c8849=require(_0x334c('0x3b'))(config[_0x334c('0x4')][_0x334c('0x16')],config[_0x334c('0x4')]['ip'],_0x1cb53d);_0x3c8849['on']('error',errorHandler);_0x3c8849['on'](_0x334c('0x3c'),listeningHandler);_0x3c8849['on']('connection',connectionHandler);_0x3c8849['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x8f1a=['hangup','find','handleNotFound','handleUnpublished','initialize','getLicense','then','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','./server','connection','close','syncho','util','../../config/environment','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','nextTick','error','stack','findIndex','splice','production','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','host.docker.internal','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','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','catch','hasOwnProperty','indexOf','agi_','variables','timeout','evtHangup'];(function(_0x3efb40,_0x3e208c){var _0x539127=function(_0x4a762e){while(--_0x4a762e){_0x3efb40['push'](_0x3efb40['shift']());}};_0x539127(++_0x3e208c);}(_0x8f1a,0x188));var _0xa8f1=function(_0x145463,_0x277eb5){_0x145463=_0x145463-0x0;var _0x96a48b=_0x8f1a[_0x145463];return _0x96a48b;};'use strict';var _=require('lodash');var syncho=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var config=require(_0xa8f1('0x2'));var logger=require('../../config/logger')(_0xa8f1('0x3'));var utilLicense=require(_0xa8f1('0x4'));var rpc=require(_0xa8f1('0x5'));var Project=require(_0xa8f1('0x6'));var AGIEmitter=require(_0xa8f1('0x7'))[_0xa8f1('0x8')];var projects=[];config[_0xa8f1('0x3')]=_['defaults'](config[_0xa8f1('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x35497d){process[_0xa8f1('0x9')](function(){syncho(function(){try{setChannelVariables(_0x35497d);agiHandler(_0x35497d);}catch(_0x4b85dc){logger[_0xa8f1('0xa')](_0x4b85dc[_0xa8f1('0xb')]);}});});}function projectUpdateHandler(_0x588781){try{var _0x58f15c=_[_0xa8f1('0xc')](projects,['id',_0x588781['id']]);if(_0x58f15c>-0x1){if(_0x588781['deleted']===!![]){projects[_0xa8f1('0xd')](_0x58f15c,0x1);}else{projects[_0x58f15c]=_0x588781;}}else{projects['push'](_0x588781);}}catch(_0x1d5a1c){logger[_0xa8f1('0xa')](_0x1d5a1c[_0xa8f1('0xb')]);}}function listeningHandler(){var _0x5b3b31=config['env']===_0xa8f1('0xe')||![];console['log'](_0xa8f1('0xf'),config[_0xa8f1('0x3')][_0xa8f1('0x10')]);logger[_0xa8f1('0x11')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x5b3b31?config[_0xa8f1('0x3')]['ip']:_0xa8f1('0x12'),config[_0xa8f1('0x3')][_0xa8f1('0x10')]));}function errorHandler(_0x1772e0){if(_0x1772e0&&_0x1772e0[_0xa8f1('0x13')]&&_0x1772e0[_0xa8f1('0x14')]){logger[_0xa8f1('0xa')](util['format'](_0xa8f1('0x15'),_0x1772e0[_0xa8f1('0x13')],_0x1772e0[_0xa8f1('0x14')]));}else{logger['error'](util[_0xa8f1('0x16')](_0xa8f1('0x17'),_0x1772e0[_0xa8f1('0xb')]));}}function closeHandler(){logger[_0xa8f1('0x11')](util[_0xa8f1('0x16')](_0xa8f1('0x18'),this[_0xa8f1('0x19')],this[_0xa8f1('0x1a')],this[_0xa8f1('0x1b')],this[_0xa8f1('0x1c')],this[_0xa8f1('0x1d')]));try{createSquareReport(this);}catch(_0x2f7b39){logger[_0xa8f1('0xa')](_0x2f7b39[_0xa8f1('0xb')]);}}function timeoutHandler(){logger[_0xa8f1('0x11')](util[_0xa8f1('0x16')](_0xa8f1('0x1e'),this[_0xa8f1('0x19')],this['calleridname'],this['callerid'],this[_0xa8f1('0x1c')],this[_0xa8f1('0x1d')]));}function hangupHandler(){logger[_0xa8f1('0x11')](util[_0xa8f1('0x16')](_0xa8f1('0x1f'),this[_0xa8f1('0x19')],this['calleridname'],this[_0xa8f1('0x1b')],this[_0xa8f1('0x1c')],this[_0xa8f1('0x1d')]));this['evtHangup']=!![];}function createSquareReport(_0x16bcb5,_0x29294a){rpc[_0xa8f1('0x20')](_0x16bcb5)['then'](function(_0x33ef37){if(_0x29294a){_0x29294a(null,_0x33ef37);}})[_0xa8f1('0x21')](function(_0x3e766a){if(_0x29294a){_0x29294a(null,_0x3e766a);}});}function setChannelVariables(_0xa35903){for(var _0x384c3d in _0xa35903){if(_0xa35903[_0xa8f1('0x22')](_0x384c3d)){if(_0x384c3d[_0xa8f1('0x23')](_0xa8f1('0x24'))===0x0){_0xa35903[_0x384c3d['substring'](0x4)]=_0xa35903[_0x384c3d];delete _0xa35903[_0x384c3d];}}}}function agiHandler(_0x551377){logger['debug'](_0xa8f1('0x25'),JSON['stringify'](_0x551377,null,0x2));logger['info'](util[_0xa8f1('0x16')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x551377['arg_1'],_0x551377[_0xa8f1('0x1a')],_0x551377[_0xa8f1('0x1b')],_0x551377[_0xa8f1('0x1c')],_0x551377[_0xa8f1('0x1d')]));_0x551377['on'](_0xa8f1('0xa'),errorHandler);_0x551377['on']('close',closeHandler);_0x551377['on'](_0xa8f1('0x26'),timeoutHandler);_0x551377[_0xa8f1('0x27')]=![];_0x551377['on'](_0xa8f1('0x28'),hangupHandler);var _0x307821=_[_0xa8f1('0x29')](projects,[_0xa8f1('0x13'),_0x551377[_0xa8f1('0x19')]]);if(!_0x307821)return Project[_0xa8f1('0x2a')](_0x551377);if(!_0x307821[_0xa8f1('0xe')])return Project[_0xa8f1('0x2b')](_0x551377);return Project[_0xa8f1('0x2c')](_0x307821,_0x551377);}function main(){var _0x53422b;return utilLicense[_0xa8f1('0x2d')]()[_0xa8f1('0x2e')](function(_0x546029){if(!_0x546029)return;if(_0x546029['voice']){if(_0x546029[_0xa8f1('0x2f')]&&_0x546029[_0xa8f1('0x2f')]>0x0){logger[_0xa8f1('0x11')](util[_0xa8f1('0x16')]('[LICENSE]\x20CHANNELS:\x20%s',_0x546029[_0xa8f1('0x2f')]));_0x53422b=_0x546029['callysquare'];}else{logger['info'](_0xa8f1('0x30'));}}else{logger[_0xa8f1('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x53422b=-0x1;}})[_0xa8f1('0x2e')](function(){return Project[_0xa8f1('0x31')]();})[_0xa8f1('0x2e')](function(_0x18164b){projects=_0x18164b;return;})['catch'](function(_0x2e663e){logger[_0xa8f1('0xa')](_0xa8f1('0x32'),_0x2e663e['stack']);})['finally'](function(){var _0x29bd0b=require(_0xa8f1('0x33'))(config[_0xa8f1('0x3')][_0xa8f1('0x10')],config[_0xa8f1('0x3')]['ip'],_0x53422b);_0x29bd0b['on'](_0xa8f1('0xa'),errorHandler);_0x29bd0b['on']('listening',listeningHandler);_0x29bd0b['on'](_0xa8f1('0x34'),connectionHandler);_0x29bd0b['on'](_0xa8f1('0x35'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 2f4d5b3..28451c0 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 _0xeb76=['http','request','then','error','message','result','SendMail','bluebird'];(function(_0x46a84e,_0x174a48){var _0x53695d=function(_0x147c08){while(--_0x147c08){_0x46a84e['push'](_0x46a84e['shift']());}};_0x53695d(++_0x174a48);}(_0xeb76,0xe7));var _0x6eb7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xeb76[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x6eb7('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6eb7('0x1')]({'port':0x232b});function request(_0x379d19,_0x435084){return new BPromise(function(_0x39282d,_0x281549){return client[_0x6eb7('0x2')](_0x379d19,_0x435084)[_0x6eb7('0x3')](function(_0x4fd3c1){if(_0x4fd3c1[_0x6eb7('0x4')]){return _0x281549(_0x4fd3c1['error'][_0x6eb7('0x5')]);}else{return _0x39282d(_0x4fd3c1[_0x6eb7('0x6')]);}})['catch'](function(_0x4d2def){return _0x281549(_0x4d2def);});});}exports['sendMailMessage']=function(_0x560b8e,_0x5da449){return request(_0x6eb7('0x7'),{'account':_0x560b8e,'message':_0x5da449});}; \ No newline at end of file +var _0x10ec=['error','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x1436b9,_0x3fe8c7){var _0x30d0aa=function(_0xf342b6){while(--_0xf342b6){_0x1436b9['push'](_0x1436b9['shift']());}};_0x30d0aa(++_0x3fe8c7);}(_0x10ec,0x19e));var _0xc10e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x10ec[_0x199572];return _0x13cfa3;};'use strict';var BPromise=require(_0xc10e('0x0'));var jayson=require(_0xc10e('0x1'));var client=jayson[_0xc10e('0x2')][_0xc10e('0x3')]({'port':0x232b});function request(_0x2555e8,_0x8c5311){return new BPromise(function(_0x456aad,_0x1b1484){return client[_0xc10e('0x4')](_0x2555e8,_0x8c5311)[_0xc10e('0x5')](function(_0x65e2cf){if(_0x65e2cf[_0xc10e('0x6')]){return _0x1b1484(_0x65e2cf[_0xc10e('0x6')]['message']);}else{return _0x456aad(_0x65e2cf['result']);}})[_0xc10e('0x7')](function(_0x1b1c66){return _0x1b1484(_0x1b1c66);});});}exports[_0xc10e('0x8')]=function(_0x2ba4bc,_0xbcbb1b){return request(_0xc10e('0x9'),{'account':_0x2ba4bc,'message':_0xbcbb1b});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 9df77f9..72c2940 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 _0x3a07=['stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','info','format','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','debug','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[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','arg_1','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','catch','error','stack','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','source','target','addEdge','value','toJson','root','inspect','production','start'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x3a07,0xe4));var _0x73a0=function(_0x24a1c3,_0x38a257){_0x24a1c3=_0x24a1c3-0x0;var _0x1b3c8b=_0x3a07[_0x24a1c3];return _0x1b3c8b;};'use strict';var _=require(_0x73a0('0x0'));var moment=require(_0x73a0('0x1'));var parser=require(_0x73a0('0x2'));var util=require(_0x73a0('0x3'));var logger=require(_0x73a0('0x4'))(_0x73a0('0x5'));var rpc=require(_0x73a0('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0x73a0('0x7'));var Vertices=require(_0x73a0('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x73a0('0x9')]()[_0x73a0('0xa')](function(_0x26f67b){logger[_0x73a0('0xb')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x26f67b[_0x73a0('0xc')]);return[];});}function addVertex(_0x20030e,_0x45336a,_0x56d6d1){_0x45336a['agicommand']=_0x56d6d1;if(_0x45336a[_0x73a0('0xd')](_0x73a0('0xe'))){_0x45336a[_0x73a0('0xf')]=parseInt(_0x45336a[_0x73a0('0xe')],0xa);}_0x20030e[_0x73a0('0x10')](_['omit'](_0x45336a,_0x73a0('0x11')));}function initGraph(_0x320297,_0x51dc3d){var _0xd40765=new Graph();for(var _0x4b514d in _0x320297){if(_0x320297['hasOwnProperty'](_0x4b514d)){if(_['isArray'](_0x320297[_0x4b514d])){for(var _0x20794a=0x0;_0x20794a<_0x320297[_0x4b514d][_0x73a0('0x12')];_0x20794a+=0x1){addVertex(_0xd40765,_0x320297[_0x4b514d][_0x20794a],_0x4b514d);}}else{addVertex(_0xd40765,_0x320297[_0x4b514d],_0x4b514d);}}}for(var _0x39d148=0x0;_0x39d148<_0x51dc3d['length'];_0x39d148+=0x1){if(_0x51dc3d[_0x39d148][_0x73a0('0x13')]&&_0x51dc3d[_0x39d148][_0x73a0('0x14')]){_0xd40765[_0x73a0('0x15')](_0x51dc3d[_0x39d148]['source'],_0x51dc3d[_0x39d148][_0x73a0('0x14')],_0x51dc3d[_0x39d148][_0x73a0('0x16')]);}}return _0xd40765;}function getRoot(_0x2985f8){return parser[_0x73a0('0x17')](_0x2985f8,{'object':!![]})['mxGraphModel'][_0x73a0('0x18')];}function inspect(_0x5f0abe){return util[_0x73a0('0x19')](_0x5f0abe,{'showHidden':![],'depth':null});}function initialize(_0x160261,_0x1db489){var _0x239926=getRoot(_0x160261[_0x73a0('0x1a')]);if(!_0x239926||!_0x239926[_0x73a0('0x1b')])return;var _0x16cd03,_0x1686d3,_0x2f1231;logger['debug'](_0x73a0('0x18'),JSON[_0x73a0('0x1c')](_0x239926,null,0x2));_0x1db489[_0x73a0('0x1d')]=moment()['format'](_0x73a0('0x1e'));_0x16cd03=initGraph(_[_0x73a0('0x1f')](_0x239926,_0x73a0('0x11')),_0x239926[_0x73a0('0x11')]);_0x1686d3=new Vertices(_0x1db489,rpc,mailRpc);logger[_0x73a0('0x20')](util[_0x73a0('0x21')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1db489['arg_1'],_0x1db489[_0x73a0('0x22')],_0x1db489[_0x73a0('0x23')],_0x1db489[_0x73a0('0x24')],_0x1db489[_0x73a0('0x25')]));_0x16cd03[_0x73a0('0x26')](_0x239926[_0x73a0('0x1b')]['id'],function(_0x1d7acb){try{_0x1d7acb=_0x1686d3[_0x73a0('0x27')](_0x1d7acb);logger[_0x73a0('0x28')](_0x73a0('0x29'),JSON[_0x73a0('0x1c')](_0x1d7acb,null,0x2));if(_0x1d7acb[_0x73a0('0x2a')]===_0x73a0('0x2b')){logger['info'](_0x73a0('0x2c'));_0x1db489[_0x73a0('0x2d')]=_0x1d7acb[_0x73a0('0x2d')]||_0x1db489[_0x73a0('0x2d')];_0x1db489[_0x73a0('0x2e')]=_0x1d7acb[_0x73a0('0x2e')];_0x1db489['priority']=_0x1d7acb[_0x73a0('0x2f')]?_0x1d7acb[_0x73a0('0x2f')]-0x1:0x1;return null;}else if(_0x1d7acb&&_0x1686d3[_0x1d7acb['agicommand']]){_0x2f1231=_0x1686d3[_0x1d7acb[_0x73a0('0x2a')]](_0x1d7acb);logger['info'](_0x73a0('0x30'),JSON[_0x73a0('0x1c')](_0x2f1231,null,0x2));if(_0x2f1231&&_0x2f1231['code']===AGI_CODE_SUCCESS&&_0x2f1231[_0x73a0('0x31')]!==AGI_RESULT_ERROR&&!_0x1db489[_0x73a0('0x32')]){logger['debug'](_0x73a0('0x30'),inspect(_0x2f1231));return _[_0x73a0('0x33')](_0x2f1231[_0x73a0('0x31')])?null:_0x2f1231['result'][_0x73a0('0x34')]();}else{logger['error'](_0x73a0('0x30'),inspect(_0x2f1231));return null;}}else{logger[_0x73a0('0xb')](_0x73a0('0x35'));return null;}}catch(_0x59d433){logger[_0x73a0('0xb')](_0x59d433[_0x73a0('0xc')]);return null;}});if(_0x239926['finally']){logger[_0x73a0('0x20')](util[_0x73a0('0x21')](_0x73a0('0x36'),_0x1db489['arg_1'],_0x1db489['calleridname'],_0x1db489[_0x73a0('0x23')],_0x1db489[_0x73a0('0x24')],_0x1db489[_0x73a0('0x25')]));_0x16cd03['traverseBFS'](_0x239926[_0x73a0('0x37')]['id'],function(_0x5be572){try{_0x5be572=_0x1686d3['clear'](_0x5be572);logger[_0x73a0('0x28')](_0x73a0('0x29'),JSON[_0x73a0('0x1c')](_0x5be572,null,0x2));if(_0x5be572&&_0x1686d3[_0x5be572[_0x73a0('0x2a')]]){_0x2f1231=_0x1686d3[_0x5be572['agicommand']](_0x5be572);if(_0x2f1231){logger['debug']('response',inspect(_0x2f1231));return _['isUndefined'](_0x2f1231[_0x73a0('0x31')])?null:_0x2f1231['result'][_0x73a0('0x34')]();}else{logger[_0x73a0('0xb')](_0x73a0('0x30'),inspect(_0x2f1231));return null;}}else{logger[_0x73a0('0xb')](_0x73a0('0x35'));return null;}}catch(_0x16b3d8){logger[_0x73a0('0xb')](_0x16b3d8[_0x73a0('0xc')]);return null;}});}logger[_0x73a0('0x20')](util[_0x73a0('0x21')](_0x73a0('0x38'),_0x1db489['arg_1'],_0x1db489[_0x73a0('0x22')],_0x1db489['callerid'],_0x1db489['dnid'],_0x1db489[_0x73a0('0x25')]));logger['info'](util[_0x73a0('0x21')](_0x73a0('0x39'),_0x1db489[_0x73a0('0x2d')],_0x1db489[_0x73a0('0x2e')],parseInt(_0x1db489[_0x73a0('0x2f')],0xa)+0x1));_0x1db489[_0x73a0('0x3a')](_0x1db489[_0x73a0('0x2d')],_0x1db489['extension'],parseInt(_0x1db489[_0x73a0('0x2f')],0xa)+0x1);_0x1db489[_0x73a0('0x3b')]();}function handleNotFound(_0x591588){logger['error'](util[_0x73a0('0x21')](_0x73a0('0x3c'),_0x591588[_0x73a0('0x3d')]));_0x591588['continueAt'](_0x591588['context'],_0x591588[_0x73a0('0x2e')],parseInt(_0x591588[_0x73a0('0x2f')],0xa)+0x1);_0x591588['close']();}function handleUnpublished(_0x3592f9){logger[_0x73a0('0xb')](util['format'](_0x73a0('0x3e'),_0x3592f9['arg_1']));_0x3592f9[_0x73a0('0x3a')](_0x3592f9[_0x73a0('0x2d')],_0x3592f9['extension'],parseInt(_0x3592f9['priority'],0xa)+0x1);_0x3592f9[_0x73a0('0x3b')]();}module[_0x73a0('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x72e7=['stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','toJson','mxGraphModel','root','production','start','debug','stringify','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','util','../../config/logger','agi','./rpc','./graph','getSquareProjects','catch','error'];(function(_0x76f08a,_0x15cfad){var _0x2e7ff0=function(_0x2df3ea){while(--_0x2df3ea){_0x76f08a['push'](_0x76f08a['shift']());}};_0x2e7ff0(++_0x15cfad);}(_0x72e7,0x18d));var _0x772e=function(_0x246187,_0x4f590){_0x246187=_0x246187-0x0;var _0x34bec2=_0x72e7[_0x246187];return _0x34bec2;};'use strict';var _=require('lodash');var moment=require(_0x772e('0x0'));var parser=require('xml2json');var util=require(_0x772e('0x1'));var logger=require(_0x772e('0x2'))(_0x772e('0x3'));var rpc=require(_0x772e('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0x772e('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x772e('0x6')]()[_0x772e('0x7')](function(_0xb99c5d){logger[_0x772e('0x8')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0xb99c5d[_0x772e('0x9')]);return[];});}function addVertex(_0x3a909b,_0x5272b4,_0x2d2b09){_0x5272b4[_0x772e('0xa')]=_0x2d2b09;if(_0x5272b4[_0x772e('0xb')](_0x772e('0xc'))){_0x5272b4['maxRetry']=parseInt(_0x5272b4['retry'],0xa);}_0x3a909b[_0x772e('0xd')](_[_0x772e('0xe')](_0x5272b4,_0x772e('0xf')));}function initGraph(_0x225faf,_0x2cf19d){var _0x16ea65=new Graph();for(var _0x51ea36 in _0x225faf){if(_0x225faf[_0x772e('0xb')](_0x51ea36)){if(_[_0x772e('0x10')](_0x225faf[_0x51ea36])){for(var _0x2893bf=0x0;_0x2893bf<_0x225faf[_0x51ea36]['length'];_0x2893bf+=0x1){addVertex(_0x16ea65,_0x225faf[_0x51ea36][_0x2893bf],_0x51ea36);}}else{addVertex(_0x16ea65,_0x225faf[_0x51ea36],_0x51ea36);}}}for(var _0x986250=0x0;_0x986250<_0x2cf19d[_0x772e('0x11')];_0x986250+=0x1){if(_0x2cf19d[_0x986250][_0x772e('0x12')]&&_0x2cf19d[_0x986250]['target']){_0x16ea65[_0x772e('0x13')](_0x2cf19d[_0x986250][_0x772e('0x12')],_0x2cf19d[_0x986250][_0x772e('0x14')],_0x2cf19d[_0x986250][_0x772e('0x15')]);}}return _0x16ea65;}function getRoot(_0x33a0a3){return parser[_0x772e('0x16')](_0x33a0a3,{'object':!![]})[_0x772e('0x17')][_0x772e('0x18')];}function inspect(_0x19a4e1){return util['inspect'](_0x19a4e1,{'showHidden':![],'depth':null});}function initialize(_0x1be9f6,_0xcf9c6d){var _0x2a1cc4=getRoot(_0x1be9f6[_0x772e('0x19')]);if(!_0x2a1cc4||!_0x2a1cc4[_0x772e('0x1a')])return;var _0x4aa08e,_0x2cf729,_0x1762f4;logger[_0x772e('0x1b')](_0x772e('0x18'),JSON[_0x772e('0x1c')](_0x2a1cc4,null,0x2));_0xcf9c6d['joinAt']=moment()[_0x772e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x4aa08e=initGraph(_[_0x772e('0xe')](_0x2a1cc4,_0x772e('0xf')),_0x2a1cc4[_0x772e('0xf')]);_0x2cf729=new Vertices(_0xcf9c6d,rpc,mailRpc);logger[_0x772e('0x1e')](util[_0x772e('0x1d')](_0x772e('0x1f'),_0xcf9c6d[_0x772e('0x20')],_0xcf9c6d[_0x772e('0x21')],_0xcf9c6d[_0x772e('0x22')],_0xcf9c6d[_0x772e('0x23')],_0xcf9c6d[_0x772e('0x24')]));_0x4aa08e[_0x772e('0x25')](_0x2a1cc4[_0x772e('0x1a')]['id'],function(_0x57bde1){try{_0x57bde1=_0x2cf729[_0x772e('0x26')](_0x57bde1);logger[_0x772e('0x1b')]('vertex',JSON[_0x772e('0x1c')](_0x57bde1,null,0x2));if(_0x57bde1[_0x772e('0xa')]===_0x772e('0x27')){logger['info'](_0x772e('0x28'));_0xcf9c6d[_0x772e('0x29')]=_0x57bde1[_0x772e('0x29')]||_0xcf9c6d[_0x772e('0x29')];_0xcf9c6d[_0x772e('0x2a')]=_0x57bde1[_0x772e('0x2a')];_0xcf9c6d[_0x772e('0x2b')]=_0x57bde1[_0x772e('0x2b')]?_0x57bde1[_0x772e('0x2b')]-0x1:0x1;return null;}else if(_0x57bde1&&_0x2cf729[_0x57bde1[_0x772e('0xa')]]){_0x1762f4=_0x2cf729[_0x57bde1['agicommand']](_0x57bde1);logger[_0x772e('0x1e')](_0x772e('0x2c'),JSON['stringify'](_0x1762f4,null,0x2));if(_0x1762f4&&_0x1762f4['code']===AGI_CODE_SUCCESS&&_0x1762f4[_0x772e('0x2d')]!==AGI_RESULT_ERROR&&!_0xcf9c6d['evtHangup']){logger['debug']('response',inspect(_0x1762f4));return _[_0x772e('0x2e')](_0x1762f4['result'])?null:_0x1762f4[_0x772e('0x2d')][_0x772e('0x2f')]();}else{logger[_0x772e('0x8')](_0x772e('0x2c'),inspect(_0x1762f4));return null;}}else{logger[_0x772e('0x8')](_0x772e('0x30'));return null;}}catch(_0x4280f3){logger[_0x772e('0x8')](_0x4280f3[_0x772e('0x9')]);return null;}});if(_0x2a1cc4[_0x772e('0x31')]){logger[_0x772e('0x1e')](util[_0x772e('0x1d')](_0x772e('0x32'),_0xcf9c6d[_0x772e('0x20')],_0xcf9c6d['calleridname'],_0xcf9c6d[_0x772e('0x22')],_0xcf9c6d[_0x772e('0x23')],_0xcf9c6d['uniqueid']));_0x4aa08e['traverseBFS'](_0x2a1cc4[_0x772e('0x31')]['id'],function(_0x287528){try{_0x287528=_0x2cf729[_0x772e('0x26')](_0x287528);logger[_0x772e('0x1b')](_0x772e('0x33'),JSON[_0x772e('0x1c')](_0x287528,null,0x2));if(_0x287528&&_0x2cf729[_0x287528[_0x772e('0xa')]]){_0x1762f4=_0x2cf729[_0x287528[_0x772e('0xa')]](_0x287528);if(_0x1762f4){logger[_0x772e('0x1b')](_0x772e('0x2c'),inspect(_0x1762f4));return _[_0x772e('0x2e')](_0x1762f4['result'])?null:_0x1762f4['result'][_0x772e('0x2f')]();}else{logger[_0x772e('0x8')]('response',inspect(_0x1762f4));return null;}}else{logger[_0x772e('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x325406){logger[_0x772e('0x8')](_0x325406[_0x772e('0x9')]);return null;}});}logger[_0x772e('0x1e')](util[_0x772e('0x1d')](_0x772e('0x34'),_0xcf9c6d['arg_1'],_0xcf9c6d['calleridname'],_0xcf9c6d[_0x772e('0x22')],_0xcf9c6d[_0x772e('0x23')],_0xcf9c6d[_0x772e('0x24')]));logger[_0x772e('0x1e')](util[_0x772e('0x1d')](_0x772e('0x35'),_0xcf9c6d['context'],_0xcf9c6d[_0x772e('0x2a')],parseInt(_0xcf9c6d['priority'],0xa)+0x1));_0xcf9c6d[_0x772e('0x36')](_0xcf9c6d[_0x772e('0x29')],_0xcf9c6d[_0x772e('0x2a')],parseInt(_0xcf9c6d[_0x772e('0x2b')],0xa)+0x1);_0xcf9c6d['close']();}function handleNotFound(_0x3fc217){logger[_0x772e('0x8')](util[_0x772e('0x1d')](_0x772e('0x37'),_0x3fc217[_0x772e('0x20')]));_0x3fc217[_0x772e('0x36')](_0x3fc217[_0x772e('0x29')],_0x3fc217[_0x772e('0x2a')],parseInt(_0x3fc217[_0x772e('0x2b')],0xa)+0x1);_0x3fc217['close']();}function handleUnpublished(_0x4ac0f2){logger[_0x772e('0x8')](util['format'](_0x772e('0x38'),_0x4ac0f2[_0x772e('0x20')]));_0x4ac0f2['continueAt'](_0x4ac0f2[_0x772e('0x29')],_0x4ac0f2[_0x772e('0x2a')],parseInt(_0x4ac0f2[_0x772e('0x2b')],0xa)+0x1);_0x4ac0f2['close']();}module[_0x772e('0x39')]={'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 0b3a57b..60ea6a3 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 _0x41c8=['substring','length','split','trim','slice','headers','emit','line','util','stream','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf'];(function(_0x7cdff6,_0x22594c){var _0x2dc33c=function(_0x5ba790){while(--_0x5ba790){_0x7cdff6['push'](_0x7cdff6['shift']());}};_0x2dc33c(++_0x22594c);}(_0x41c8,0x98));var _0x841c=function(_0x2d9430,_0x527e5e){_0x2d9430=_0x2d9430-0x0;var _0x349c78=_0x41c8[_0x2d9430];return _0x349c78;};'use strict';var util=require(_0x841c('0x0'));var Transform=require(_0x841c('0x1'))['Transform'];function AGIReply(_0x7ad3de){Transform[_0x841c('0x2')](this,_0x7ad3de);this[_0x841c('0x3')]='';this[_0x841c('0x4')]=![];}util[_0x841c('0x5')](AGIReply,Transform);AGIReply[_0x841c('0x6')][_0x841c('0x7')]=function(_0x2fb789,_0x31e757,_0xff70f){var _0x3b7561='\x0a',_0x10183f=['\x0a\x0a',_0x841c('0x8')],_0x34c9c0=-0x1,_0x88a9f4=-0x1,_0x587552='',_0x2f0ea9=0x0,_0x32c65d='',_0x421639='';this[_0x841c('0x3')]+=_0x2fb789['toString']();_0x32c65d=this['_localBuffer'];if(!this[_0x841c('0x4')]){_0x2f0ea9=0x0;while(_0x10183f[_0x2f0ea9]){while((_0x88a9f4=_0x32c65d[_0x841c('0x9')](_0x10183f[_0x2f0ea9]))!=-0x1){_0x587552=_0x10183f[_0x2f0ea9];_0x421639=_0x32c65d['substring'](0x0,_0x88a9f4);_0x32c65d=_0x32c65d[_0x841c('0xa')](_0x88a9f4+_0x587552[_0x841c('0xb')]);var _0x750dd7=_0x421639[_0x841c('0xc')](_0x3b7561),_0x5553ca=0x0,_0x492357={},_0x509a1c='',_0x1f06d0='',_0xb23e5a=-0x1;while(_0x750dd7[_0x5553ca]){_0xb23e5a=_0x750dd7[_0x5553ca][_0x841c('0x9')](':');if(_0xb23e5a!=-0x1){_0x509a1c=_0x750dd7[_0x5553ca]['slice'](0x0,_0xb23e5a)[_0x841c('0xd')]();_0x1f06d0=_0x750dd7[_0x5553ca][_0x841c('0xe')](_0xb23e5a+0x1)[_0x841c('0xd')]();if(_0x509a1c[_0x841c('0xb')]>0x0){_0x492357[_0x509a1c]=_0x1f06d0;}}else{}_0x5553ca++;}this['emit'](_0x841c('0xf'),_0x492357);this[_0x841c('0x4')]=!![];}_0x2f0ea9++;}this[_0x841c('0x3')]=_0x32c65d;}else{while((_0x34c9c0=_0x32c65d[_0x841c('0x9')](_0x3b7561))!=-0x1){_0x421639=_0x32c65d['substring'](0x0,_0x34c9c0);this[_0x841c('0x10')](_0x841c('0x11'),_0x421639);_0x32c65d=_0x32c65d[_0x841c('0xa')](_0x34c9c0+_0x3b7561[_0x841c('0xb')]);}this[_0x841c('0x3')]=_0x32c65d;}_0xff70f();};module['exports']=AGIReply; \ No newline at end of file +var _0xe6b9=['trim','slice','emit','headers','line','util','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split'];(function(_0x12bd7e,_0x4fc380){var _0x4f4977=function(_0x5d2d00){while(--_0x5d2d00){_0x12bd7e['push'](_0x12bd7e['shift']());}};_0x4f4977(++_0x4fc380);}(_0xe6b9,0x1cd));var _0x9e6b=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0xe6b9[_0x532112];return _0x23e5fb;};'use strict';var util=require(_0x9e6b('0x0'));var Transform=require(_0x9e6b('0x1'))[_0x9e6b('0x2')];function AGIReply(_0x478b68){Transform['call'](this,_0x478b68);this[_0x9e6b('0x3')]='';this[_0x9e6b('0x4')]=![];}util[_0x9e6b('0x5')](AGIReply,Transform);AGIReply[_0x9e6b('0x6')][_0x9e6b('0x7')]=function(_0xf0afbd,_0x27a3a8,_0x3103cc){var _0x41005e='\x0a',_0x885139=['\x0a\x0a',_0x9e6b('0x8')],_0x2c59d4=-0x1,_0x17888b=-0x1,_0x50bc15='',_0x232225=0x0,_0x5ef308='',_0x16c1c5='';this[_0x9e6b('0x3')]+=_0xf0afbd[_0x9e6b('0x9')]();_0x5ef308=this[_0x9e6b('0x3')];if(!this[_0x9e6b('0x4')]){_0x232225=0x0;while(_0x885139[_0x232225]){while((_0x17888b=_0x5ef308[_0x9e6b('0xa')](_0x885139[_0x232225]))!=-0x1){_0x50bc15=_0x885139[_0x232225];_0x16c1c5=_0x5ef308[_0x9e6b('0xb')](0x0,_0x17888b);_0x5ef308=_0x5ef308[_0x9e6b('0xb')](_0x17888b+_0x50bc15[_0x9e6b('0xc')]);var _0x160c73=_0x16c1c5[_0x9e6b('0xd')](_0x41005e),_0x41a3b5=0x0,_0xd26063={},_0x31b963='',_0x49113c='',_0x2f66a5=-0x1;while(_0x160c73[_0x41a3b5]){_0x2f66a5=_0x160c73[_0x41a3b5][_0x9e6b('0xa')](':');if(_0x2f66a5!=-0x1){_0x31b963=_0x160c73[_0x41a3b5]['slice'](0x0,_0x2f66a5)[_0x9e6b('0xe')]();_0x49113c=_0x160c73[_0x41a3b5][_0x9e6b('0xf')](_0x2f66a5+0x1)[_0x9e6b('0xe')]();if(_0x31b963['length']>0x0){_0xd26063[_0x31b963]=_0x49113c;}}else{}_0x41a3b5++;}this[_0x9e6b('0x10')](_0x9e6b('0x11'),_0xd26063);this[_0x9e6b('0x4')]=!![];}_0x232225++;}this[_0x9e6b('0x3')]=_0x5ef308;}else{while((_0x2c59d4=_0x5ef308[_0x9e6b('0xa')](_0x41005e))!=-0x1){_0x16c1c5=_0x5ef308['substring'](0x0,_0x2c59d4);this['emit'](_0x9e6b('0x12'),_0x16c1c5);_0x5ef308=_0x5ef308[_0x9e6b('0xb')](_0x2c59d4+_0x41005e['length']);}this[_0x9e6b('0x3')]=_0x5ef308;}_0x3103cc();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 17e861d..76471f9 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 _0x394e=['agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http','request','then','error','message','result','catch','getSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','PauseUser'];(function(_0x246994,_0x12deba){var _0x5758c7=function(_0x551db9){while(--_0x551db9){_0x246994['push'](_0x246994['shift']());}};_0x5758c7(++_0x12deba);}(_0x394e,0x88));var _0xe394=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x394e[_0x1562a2];return _0x39a636;};'use strict';var _=require(_0xe394('0x0'));var moment=require(_0xe394('0x1'));var jayson=require('jayson/promise');var client=jayson[_0xe394('0x2')][_0xe394('0x3')]({'port':0x2329});function request(_0x373028,_0x1a96cc){return new Promise(function(_0x5640e5,_0x4269f4){return client[_0xe394('0x4')](_0x373028,_0x1a96cc)[_0xe394('0x5')](function(_0x322cd4){if(_0x322cd4[_0xe394('0x6')]){return _0x4269f4(_0x322cd4[_0xe394('0x6')][_0xe394('0x7')]);}else{return _0x5640e5(_0x322cd4[_0xe394('0x8')]);}})[_0xe394('0x9')](function(_0x267d68){return _0x4269f4(_0x267d68);});});}exports[_0xe394('0xa')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0xe394('0xb')]=function(_0x365100){return request(_0xe394('0xc'),{'options':{'raw':![],'where':{'name':_0x365100},'attributes':[_0xe394('0xd')]}});};exports[_0xe394('0xe')]=function(_0x24b778){return request(_0xe394('0xf'),{'options':{'raw':![],'where':{'id':_0x24b778},'include':[{'model':_0xe394('0x10'),'as':_0xe394('0x11'),'include':[{'model':_0xe394('0x12'),'as':_0xe394('0x12')}]}],'attributes':['id',_0xe394('0x13'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x4c2357){return request(_0xe394('0xc'),{'options':{'where':{'id':_0x4c2357},'attributes':[_0xe394('0x13')]}});};exports['getVoiceQueueById']=function(_0x996771){return request(_0xe394('0x14'),{'options':{'where':{'id':_0x996771},'attributes':[_0xe394('0x13')]}});};exports[_0xe394('0x15')]=function(_0x1f4f71){return request(_0xe394('0x16'),{'options':{'where':{'id':_0x1f4f71},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x1b8777){return request(_0xe394('0x17'),{'options':{'where':{'id':_0x1b8777},'attributes':[_0xe394('0x18')]}});};exports[_0xe394('0x19')]=function(_0x4a7a5b){return request(_0xe394('0x1a'),{'options':{'where':{'id':_0x4a7a5b},'attributes':['name']}});};exports[_0xe394('0x1b')]=function(_0x25c3b1){return request(_0xe394('0x1c'),{'options':{'where':{'phone':_0x25c3b1['phone']},'attributes':['id']}});};exports[_0xe394('0x1d')]=function(_0x28ab96){return request(_0xe394('0x1e'),{'options':{'where':{'id':_0x28ab96},'attributes':['name']}});};exports[_0xe394('0x1f')]=function(_0x321c35){return request(_0xe394('0x20'),{'options':{'where':{'id':_0x321c35},'attributes':[_0xe394('0x21')]}});};exports[_0xe394('0x22')]=function(_0x1a9004){return request(_0xe394('0x23'),{'options':{'raw':![],'where':{'id':_0x1a9004},'include':[{'model':_0xe394('0x24'),'as':_0xe394('0x25')}]}});};exports[_0xe394('0x26')]=function(_0x402fd5){return request(_0xe394('0x27'),{'options':{'where':{'id':_0x402fd5},'attributes':['id','name']}});};exports[_0xe394('0x28')]=function(_0x459bfe){return request(_0xe394('0x29'),{'body':_0x459bfe});};exports[_0xe394('0x2a')]=function(_0x1bc287){return request('CreateSquareDetailsReport',{'body':_0x1bc287});};exports[_0xe394('0x2b')]=function(_0xb8f58f){return request(_0xe394('0x2c'),{'body':_[_0xe394('0x2d')](_0xb8f58f,{'project_name':_0xb8f58f['arg_1'],'prev_project_name':_0xb8f58f[_0xe394('0x2e')]||'','is_subproject':_0xb8f58f[_0xe394('0x2e')]?!![]:![],'leaveAt':moment()[_0xe394('0x2f')](_0xe394('0x30'))})});};exports[_0xe394('0x31')]=function(_0x4a8683){return request(_0xe394('0x32'),{'body':_0x4a8683});};exports[_0xe394('0x33')]=function(_0x1ca899){return request(_0xe394('0x34'),{'body':_0x1ca899});};exports[_0xe394('0x35')]=function(_0x24146d){return request(_0xe394('0x36'),{'options':{'raw':![],'where':{'phone':_0x24146d[_0xe394('0x37')],'ListId':_0x24146d[_0xe394('0x38')]}}})['then'](function(_0xab58d1){if(_0xab58d1){return _0xab58d1;}return request(_0xe394('0x39'),{'body':_0x24146d});});};exports[_0xe394('0x3a')]=function(_0x299916){return request(_0xe394('0x3b'),{'options':{'where':{'id':_0x299916},'attributes':['name']}});};exports['agentLogin']=function(_0x382308,_0x3ecc7f){return request(_0xe394('0x3c'),{'body':{'interface':_0x3ecc7f},'options':{'where':_0x382308}});};exports['agentPause']=function(_0x1fd6e5,_0x5123c9,_0x5edf7f){return request(_0xe394('0x3d'),{'body':{'type':_0x5123c9,'uniqueid':_0x5edf7f},'options':{'where':_0x1fd6e5}});};exports[_0xe394('0x3e')]=function(_0x3d3cd4){return request(_0xe394('0x3f'),{'body':{},'options':{'where':_0x3d3cd4}});};exports[_0xe394('0x40')]=function(_0x1b21c2){return request(_0xe394('0x41'),{'body':{},'options':{'where':_0x1b21c2}});}; \ No newline at end of file +var _0x98d3=['GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getContactByPhone','ShowTrunk','getSoundById','ShowSound','save_name','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','createCmContact','phone','then','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','error','result','catch','getSquareProjects'];(function(_0x49a080,_0x1b0cc5){var _0xa83115=function(_0x156e33){while(--_0x156e33){_0x49a080['push'](_0x49a080['shift']());}};_0xa83115(++_0x1b0cc5);}(_0x98d3,0x173));var _0x398d=function(_0x101ede,_0x75e6d){_0x101ede=_0x101ede-0x0;var _0x2d05f6=_0x98d3[_0x101ede];return _0x2d05f6;};'use strict';var _=require(_0x398d('0x0'));var moment=require(_0x398d('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x398d('0x2')]['http']({'port':0x2329});function request(_0x18da44,_0x48fcf0){return new Promise(function(_0x465d4a,_0x41f57c){return client['request'](_0x18da44,_0x48fcf0)['then'](function(_0x2ef319){if(_0x2ef319[_0x398d('0x3')]){return _0x41f57c(_0x2ef319[_0x398d('0x3')]['message']);}else{return _0x465d4a(_0x2ef319[_0x398d('0x4')]);}})[_0x398d('0x5')](function(_0x3029f3){return _0x41f57c(_0x3029f3);});});}exports[_0x398d('0x6')]=function(){return request(_0x398d('0x7'),{'options':{'raw':![],'attributes':['id','name',_0x398d('0x8')]}});};exports[_0x398d('0x9')]=function(_0x45d5e3){return request(_0x398d('0xa'),{'options':{'raw':![],'where':{'name':_0x45d5e3},'attributes':[_0x398d('0x8')]}});};exports[_0x398d('0xb')]=function(_0x37eb46){return request(_0x398d('0xc'),{'options':{'raw':![],'where':{'id':_0x37eb46},'include':[{'model':'MailServerOut','as':_0x398d('0xd'),'include':[{'model':_0x398d('0xe'),'as':_0x398d('0xe')}]}],'attributes':['id',_0x398d('0xf'),_0x398d('0x10')],'smtp':!![]}});};exports[_0x398d('0x11')]=function(_0x1bcd1c){return request(_0x398d('0xa'),{'options':{'where':{'id':_0x1bcd1c},'attributes':[_0x398d('0xf')]}});};exports[_0x398d('0x12')]=function(_0x1fc998){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1fc998},'attributes':['name']}});};exports[_0x398d('0x13')]=function(_0x36cde2){return request(_0x398d('0x14'),{'options':{'where':{'id':_0x36cde2},'attributes':[_0x398d('0xf')]}});};exports[_0x398d('0x15')]=function(_0x4099a5){return request(_0x398d('0x16'),{'options':{'where':{'id':_0x4099a5},'attributes':[_0x398d('0x17')]}});};exports['getUserById']=function(_0x26b9a0){return request('ShowUser',{'options':{'where':{'id':_0x26b9a0},'attributes':[_0x398d('0xf')]}});};exports[_0x398d('0x18')]=function(_0x297768){return request('GetContactByPhone',{'options':{'where':{'phone':_0x297768['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x28b124){return request(_0x398d('0x19'),{'options':{'where':{'id':_0x28b124},'attributes':[_0x398d('0xf')]}});};exports[_0x398d('0x1a')]=function(_0x15f024){return request(_0x398d('0x1b'),{'options':{'where':{'id':_0x15f024},'attributes':[_0x398d('0x1c')]}});};exports['getIntervalById']=function(_0x55c98e){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x55c98e},'include':[{'model':_0x398d('0x1d'),'as':_0x398d('0x1e')}]}});};exports[_0x398d('0x1f')]=function(_0x2affed){return request(_0x398d('0x20'),{'options':{'where':{'id':_0x2affed},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x31e87d){return request(_0x398d('0x21'),{'body':_0x31e87d});};exports['createSquareDetailsReport']=function(_0x46f072){return request(_0x398d('0x22'),{'body':_0x46f072});};exports['createSquareReport']=function(_0x5618b3){return request('CreateSquareReport',{'body':_[_0x398d('0x23')](_0x5618b3,{'project_name':_0x5618b3[_0x398d('0x24')],'prev_project_name':_0x5618b3[_0x398d('0x25')]||'','is_subproject':_0x5618b3[_0x398d('0x25')]?!![]:![],'leaveAt':moment()[_0x398d('0x26')](_0x398d('0x27'))})});};exports[_0x398d('0x28')]=function(_0x17318c){return request('CreateSquareRecording',{'body':_0x17318c});};exports[_0x398d('0x29')]=function(_0x557dce){return request('CreateSquareMessage',{'body':_0x557dce});};exports[_0x398d('0x2a')]=function(_0x27bc6e){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x27bc6e[_0x398d('0x2b')],'ListId':_0x27bc6e['ListId']}}})[_0x398d('0x2c')](function(_0x8abf30){if(_0x8abf30){return _0x8abf30;}return request('CreateCmContact',{'body':_0x27bc6e});});};exports['getPauseById']=function(_0x410db2){return request(_0x398d('0x2d'),{'options':{'where':{'id':_0x410db2},'attributes':['name']}});};exports[_0x398d('0x2e')]=function(_0x2fbcce,_0x204b27){return request(_0x398d('0x2f'),{'body':{'interface':_0x204b27},'options':{'where':_0x2fbcce}});};exports[_0x398d('0x30')]=function(_0x3bcc5e,_0x490bee,_0x5a9f61){return request(_0x398d('0x31'),{'body':{'type':_0x490bee,'uniqueid':_0x5a9f61},'options':{'where':_0x3bcc5e}});};exports[_0x398d('0x32')]=function(_0x45f1a3){return request(_0x398d('0x33'),{'body':{},'options':{'where':_0x45f1a3}});};exports[_0x398d('0x34')]=function(_0x27ed5b){return request(_0x398d('0x35'),{'body':{},'options':{'where':_0x27ed5b}});}; \ 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 5bf2ec2..0912a7e 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 _0xfdcd=['exports','./lex'];(function(_0x57d00d,_0x3bb282){var _0x2d2b37=function(_0x595b76){while(--_0x595b76){_0x57d00d['push'](_0x57d00d['shift']());}};_0x2d2b37(++_0x3bb282);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};var polly=require('./polly');var lex=require(_0xdfdc('0x0'));module[_0xdfdc('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x90ec=['./polly','./lex'];(function(_0x24a56a,_0x550eb7){var _0x4175c0=function(_0x1bc188){while(--_0x1bc188){_0x24a56a['push'](_0x24a56a['shift']());}};_0x4175c0(++_0x550eb7);}(_0x90ec,0x1d4));var _0xc90e=function(_0x8f752a,_0x25dcda){_0x8f752a=_0x8f752a-0x0;var _0x5d57b4=_0x90ec[_0x8f752a];return _0x5d57b4;};var polly=require(_0xc90e('0x0'));var lex=require(_0xc90e('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 a9ec881..6706b77 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e){return lex(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e);}; \ No newline at end of file +var _0x2750=['./lib/api'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0x2750,0x13b));var _0x0275=function(_0x72915d,_0x129809){_0x72915d=_0x72915d-0x0;var _0x2dbb8e=_0x2750[_0x72915d];return _0x2dbb8e;};'use strict';var lex=require(_0x0275('0x0'));module['exports']=function(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06){return lex(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06);}; \ 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 30c1904..273b2d3 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(_0x5551ca,_0x1b0417){var _0x1a289d=function(_0x3d0e8c){while(--_0x3d0e8c){_0x5551ca['push'](_0x5551ca['shift']());}};_0x1a289d(++_0x1b0417);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x3433c3,_0x551b17){var _0x56fe00=function(_0x589709){while(--_0x589709){_0x3433c3['push'](_0x3433c3['shift']());}};_0x56fe00(++_0x551b17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 0a0d8c2..419e730 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 _0x5929=['exports'];(function(_0x235d85,_0x2db080){var _0x559ead=function(_0x3bde13){while(--_0x3bde13){_0x235d85['push'](_0x235d85['shift']());}};_0x559ead(++_0x2db080);}(_0x5929,0x139));var _0x9592=function(_0x27120a,_0x196ea7){_0x27120a=_0x27120a-0x0;var _0x17de11=_0x5929[_0x27120a];return _0x17de11;};'use strict';var polly=require('./lib/api');module[_0x9592('0x0')]=function(_0x24e64a,_0x90c729,_0x58a8df,_0x122e00,_0x4be371,_0x52bd08,_0x3ac8c8){return polly(_0x24e64a,_0x90c729,_0x58a8df,_0x122e00,_0x4be371,_0x52bd08,_0x3ac8c8);}; \ No newline at end of file +var _0x95a6=['./lib/api'];(function(_0x255733,_0x52db8c){var _0x2c0d55=function(_0x1062b0){while(--_0x1062b0){_0x255733['push'](_0x255733['shift']());}};_0x2c0d55(++_0x52db8c);}(_0x95a6,0x10e));var _0x695a=function(_0x1221fa,_0x18cec6){_0x1221fa=_0x1221fa-0x0;var _0x2a4005=_0x95a6[_0x1221fa];return _0x2a4005;};'use strict';var polly=require(_0x695a('0x0'));module['exports']=function(_0x26aa94,_0xb739eb,_0x2fe76a,_0x412980,_0x24671a,_0x3a80cc,_0x4c9d3e){return polly(_0x26aa94,_0xb739eb,_0x2fe76a,_0x412980,_0x24671a,_0x3a80cc,_0x4c9d3e);}; \ 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 e09ba0b..fe10194 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 _0xb427=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x1f2554,_0x4fa499){var _0x146d7d=function(_0x521b26){while(--_0x521b26){_0x1f2554['push'](_0x1f2554['shift']());}};_0x146d7d(++_0x4fa499);}(_0xb427,0x1bd));var _0x7b42=function(_0x3906b9,_0x56e4f2){_0x3906b9=_0x3906b9-0x0;var _0x148361=_0xb427[_0x3906b9];return _0x148361;};'use strict';var fs=require('fs');var path=require(_0x7b42('0x0'));var BPromise=require(_0x7b42('0x1'));var rs=require(_0x7b42('0x2'));var AWS=require(_0x7b42('0x3'));function pollyResult(_0x1b0235,_0x4641ee,_0x5eadbc){return new BPromise(function(_0x254a3b,_0x1d6afa){_0x1b0235[_0x7b42('0x4')](_0x4641ee,function(_0x83c8f4,_0x23630c){if(_0x83c8f4){_0x1d6afa(_0x83c8f4);}else if(_0x23630c){if(_0x23630c[_0x7b42('0x5')]instanceof Buffer){fs['writeFile'](_0x5eadbc,_0x23630c[_0x7b42('0x5')],function(_0x5ab82c){if(_0x5ab82c){_0x1d6afa(_0x5ab82c);}else{_0x254a3b();}});}else{_0x1d6afa(new Error(_0x7b42('0x6')));}}else{_0x1d6afa(new Error(_0x7b42('0x7')));}});});}module[_0x7b42('0x8')]=function(_0x31b2f0,_0x19c642,_0x4ba2b5,_0x4ea55d,_0x4bc58a,_0xced960,_0x364d99){var _0x190079=new AWS[(_0x7b42('0x9'))]({'accessKeyId':_0x31b2f0,'secretAccessKey':_0x19c642,'region':_0x4ba2b5});var _0x30d265={'Text':_0x4bc58a,'TextType':_0xced960||_0x7b42('0xa'),'OutputFormat':'mp3','VoiceId':_0x4ea55d};return pollyResult(_0x190079,_0x30d265,_0x364d99);}; \ No newline at end of file +var _0xb1a1=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile'];(function(_0x35e24b,_0x6eb583){var _0x193ca0=function(_0x32cb90){while(--_0x32cb90){_0x35e24b['push'](_0x35e24b['shift']());}};_0x193ca0(++_0x6eb583);}(_0xb1a1,0x1b3));var _0x1b1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1a1[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x1b1a('0x0'));var BPromise=require(_0x1b1a('0x1'));var rs=require(_0x1b1a('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x518bea,_0x11b6cb,_0x5af895){return new BPromise(function(_0x4d8a6c,_0x335181){_0x518bea[_0x1b1a('0x3')](_0x11b6cb,function(_0xf7d030,_0x4a39f6){if(_0xf7d030){_0x335181(_0xf7d030);}else if(_0x4a39f6){if(_0x4a39f6[_0x1b1a('0x4')]instanceof Buffer){fs[_0x1b1a('0x5')](_0x5af895,_0x4a39f6[_0x1b1a('0x4')],function(_0x5e16b9){if(_0x5e16b9){_0x335181(_0x5e16b9);}else{_0x4d8a6c();}});}else{_0x335181(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x335181(new Error(_0x1b1a('0x6')));}});});}module['exports']=function(_0x5678ea,_0x4da0fa,_0x1d40c7,_0xe0c26,_0x2933f8,_0x37481b,_0x1ccc9c){var _0x3cc424=new AWS[(_0x1b1a('0x7'))]({'accessKeyId':_0x5678ea,'secretAccessKey':_0x4da0fa,'region':_0x1d40c7});var _0xb0dd24={'Text':_0x2933f8,'TextType':_0x37481b||'text','OutputFormat':_0x1b1a('0x8'),'VoiceId':_0xe0c26};return pollyResult(_0x3cc424,_0xb0dd24,_0x1ccc9c);}; \ 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 c034e5d..855fd7e 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 _0x3841=['exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3841,0x170));var _0x1384=function(_0x57408b,_0xb7cbc5){_0x57408b=_0x57408b-0x0;var _0x31a897=_0x3841[_0x57408b];return _0x31a897;};'use strict';var asr=require('./lib/api');module[_0x1384('0x0')]=function(_0xe14c39,_0x21fccb,_0x361038,_0x3e391c){return asr(_0xe14c39,_0x21fccb,_0x361038);}; \ No newline at end of file +var _0x7ed3=['exports'];(function(_0x441f38,_0x52c6f3){var _0xa1de8c=function(_0x577285){while(--_0x577285){_0x441f38['push'](_0x441f38['shift']());}};_0xa1de8c(++_0x52c6f3);}(_0x7ed3,0x126));var _0x37ed=function(_0xdfddd7,_0xbe5893){_0xdfddd7=_0xdfddd7-0x0;var _0xdb98a2=_0x7ed3[_0xdfddd7];return _0xdb98a2;};'use strict';var asr=require('./lib/api');module[_0x37ed('0x0')]=function(_0x280250,_0xeeb599,_0xe2f9f7,_0x50036a){return asr(_0x280250,_0xeeb599,_0xe2f9f7);}; \ 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 72cfd4c..33d14f9 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 _0x0f9f=['readFileSync','toString','POST','/v1/speech:recognize?key=','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x324f55,_0x2e6ca4){var _0x284952=function(_0x36ceae){while(--_0x36ceae){_0x324f55['push'](_0x324f55['shift']());}};_0x284952(++_0x2e6ca4);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x5e43f4,_0x47ea74){_0x5e43f4=_0x5e43f4-0x0;var _0x3bcd34=_0x0f9f[_0x5e43f4];return _0x3bcd34;};'use strict';var url=require('url');var BPromise=require(_0xf0f9('0x0'));var fs=require('fs');var host=_0xf0f9('0x1');module[_0xf0f9('0x2')]=function(_0x48fa0e,_0x5cf55e,_0x45cc98){return new BPromise(function(_0x257b44,_0x17eab4){var _0x2f8d38;if(typeof _0x48fa0e!==_0xf0f9('0x3')||_0x48fa0e[_0xf0f9('0x4')]===0x0){return _0x17eab4(_0xf0f9('0x5'));}if(typeof _0x5cf55e!==_0xf0f9('0x3')||_0x5cf55e[_0xf0f9('0x4')]===0x0){return _0x17eab4('key\x20should\x20be\x20a\x20string');}if(typeof _0x45cc98!==_0xf0f9('0x6')&&(typeof _0x45cc98!==_0xf0f9('0x3')||_0x45cc98['length']===0x0)){return _0x17eab4(_0xf0f9('0x7'));}try{_0x2f8d38=fs[_0xf0f9('0x8')](_0x48fa0e)[_0xf0f9('0x9')]('base64');}catch(_0x196f21){return _0x17eab4(_0x196f21);}return _0x257b44({'method':_0xf0f9('0xa'),'uri':host+_0xf0f9('0xb')+_0x5cf55e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x45cc98},'audio':{'content':_0x2f8d38}},'json':!![]});});}; \ No newline at end of file +var _0x2121=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','8000','url','bluebird','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x2121,0x1b4));var _0x1212=function(_0x17235b,_0x5d9ae4){_0x17235b=_0x17235b-0x0;var _0x4658bd=_0x2121[_0x17235b];return _0x4658bd;};'use strict';var url=require(_0x1212('0x0'));var BPromise=require(_0x1212('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x1e00c4,_0x3081d8,_0x3929a1){return new BPromise(function(_0x2447e3,_0x44337c){var _0x553ed1;if(typeof _0x1e00c4!==_0x1212('0x2')||_0x1e00c4['length']===0x0){return _0x44337c(_0x1212('0x3'));}if(typeof _0x3081d8!==_0x1212('0x2')||_0x3081d8[_0x1212('0x4')]===0x0){return _0x44337c(_0x1212('0x5'));}if(typeof _0x3929a1!==_0x1212('0x6')&&(typeof _0x3929a1!==_0x1212('0x2')||_0x3929a1['length']===0x0)){return _0x44337c(_0x1212('0x7'));}try{_0x553ed1=fs[_0x1212('0x8')](_0x1e00c4)[_0x1212('0x9')](_0x1212('0xa'));}catch(_0x15011d){return _0x44337c(_0x15011d);}return _0x2447e3({'method':_0x1212('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x3081d8,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x1212('0xc'),'languageCode':_0x3929a1},'audio':{'content':_0x553ed1}},'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 7f34a20..419d004 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 _0x252e=['exports'];(function(_0x3d3b83,_0xcdf602){var _0x3d23f5=function(_0x4d493a){while(--_0x4d493a){_0x3d3b83['push'](_0x3d3b83['shift']());}};_0x3d23f5(++_0xcdf602);}(_0x252e,0xc1));var _0xe252=function(_0x1173dc,_0xee3cf3){_0x1173dc=_0x1173dc-0x0;var _0x559b19=_0x252e[_0x1173dc];return _0x559b19;};var asr=require('./asr');module[_0xe252('0x0')]={'asr':asr}; \ No newline at end of file +var _0x1084=['./asr'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x1084,0xb6));var _0x4108=function(_0x23f636,_0x1ccbc1){_0x23f636=_0x23f636-0x0;var _0x52eed7=_0x1084[_0x23f636];return _0x52eed7;};var asr=require(_0x4108('0x0'));module['exports']={'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 c152455..d25e7ef 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 _0xbcbf=['finish\x20download\x20file','unlink','pipe','end','data','transcode','wav','resolve','generate','.wav','writeFileSync','then','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','MP3','text:synthesize','POST','tmp','from','writeFile','chmodSync','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','speech','score','metadata','endConversation','isFallbackIntent','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','./aws','./google','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info'];(function(_0x2120b3,_0x1d9dc1){var _0x1315b4=function(_0x4ad0f1){while(--_0x4ad0f1){_0x2120b3['push'](_0x2120b3['shift']());}};_0x1315b4(++_0x1d9dc1);}(_0xbcbf,0x176));var _0xfbcb=function(_0x4a6050,_0x2d1919){_0x4a6050=_0x4a6050-0x0;var _0x5ef155=_0xbcbf[_0x4a6050];return _0x5ef155;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xfbcb('0x0'));var dialogflow=require(_0xfbcb('0x1'));var fs=require('fs');var http=require(_0xfbcb('0x2'));var https=require(_0xfbcb('0x3'));var md5=require(_0xfbcb('0x4'));var path=require(_0xfbcb('0x5'));var querystring=require(_0xfbcb('0x6'));var rp=require(_0xfbcb('0x7'));var rs=require(_0xfbcb('0x8'));var sox=require(_0xfbcb('0x9'));var tts=require(_0xfbcb('0xa'));var urlParse=require(_0xfbcb('0xb'))['parse'];var util=require('util');var aws=require(_0xfbcb('0xc'));var google=require(_0xfbcb('0xd'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require('../../../config/logger')(_0xfbcb('0xe'));var ISPEECH_API=_0xfbcb('0xf');function downloadFile(_0x4325f0,_0x414fe5){return new BPromise(function(_0xa233e7,_0x2a667d){var _0x5aed70=urlParse(_0x4325f0);var _0x2db7ba=_0x5aed70[_0xfbcb('0x10')]===_0xfbcb('0x11')?https:http;var _0x232140={'host':_0x5aed70['host'],'path':_0x5aed70['path'],'headers':{'user-agent':_0xfbcb('0x12')}};_0x2db7ba[_0xfbcb('0x13')](_0x232140,function(_0xd7efba){if(_0xd7efba[_0xfbcb('0x14')]!==0xc8){logger[_0xfbcb('0x15')](_0xfbcb('0x16')+_0x4325f0+_0xfbcb('0x17')+_0xd7efba[_0xfbcb('0x14')]+'\x20('+_0xd7efba['statusMessage']+')');_0x2a667d(new Error('request\x20to\x20'+_0x4325f0+_0xfbcb('0x17')+_0xd7efba[_0xfbcb('0x14')]+'\x20('+_0xd7efba[_0xfbcb('0x18')]+')'));return;}var _0xda7034=fs[_0xfbcb('0x19')](_0x414fe5);_0xda7034['on'](_0xfbcb('0x1a'),function(){logger[_0xfbcb('0x1b')](_0xfbcb('0x1c'));_0xda7034['close'](_0xa233e7);});_0xda7034['on']('error',function(_0x68842d){fs[_0xfbcb('0x1d')](_0x414fe5);logger['error']('download\x20error',_0x68842d);_0x2a667d(_0x68842d);});_0xd7efba[_0xfbcb('0x1e')](_0xda7034);})['on'](_0xfbcb('0x15'),function(_0x23c2a1){logger[_0xfbcb('0x15')](_0x23c2a1);_0x2a667d(_0x23c2a1);})[_0xfbcb('0x1f')]();});}function uploadFile(_0x4be9e3){return new BPromise(function(_0x5e55d4,_0x3d5570){var _0x420254=urlParse(_0x4be9e3);var _0x1b7d19=_0x420254['protocol']===_0xfbcb('0x11')?https:http;var _0x132382={'host':_0x420254['host'],'path':_0x420254[_0xfbcb('0x5')],'headers':{'user-agent':_0xfbcb('0x12')}};_0x1b7d19['get'](_0x132382,function(_0x188d4a){if(_0x188d4a[_0xfbcb('0x14')]!==0xc8){_0x3d5570(new Error('request\x20to\x20'+_0x4be9e3+_0xfbcb('0x17')+_0x188d4a['statusCode']+'\x20('+_0x188d4a[_0xfbcb('0x18')]+')'));return;}var _0x505236='';_0x188d4a['on'](_0xfbcb('0x20'),function(_0x26e27c){_0x505236+=_0x26e27c;});_0x188d4a['on'](_0xfbcb('0x1f'),function(){_0x5e55d4(_0x505236);});})['on'](_0xfbcb('0x15'),function(_0x3f97a8){_0x3d5570(_0x3f97a8);})[_0xfbcb('0x1f')]();});}function convertFile(_0x2bfaa2,_0x2a2e05){return new BPromise(function(_0x492804,_0x3436de){var _0x6809=sox[_0xfbcb('0x21')](_0x2bfaa2,_0x2a2e05,{'sampleRate':0x1f40,'format':_0xfbcb('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6809['on'](_0xfbcb('0x15'),function(_0x4faa24){logger[_0xfbcb('0x15')]('error\x20convert',_0x4faa24);_0x3436de(_0x4faa24);});_0x6809['on'](_0xfbcb('0x1f'),function(){logger[_0xfbcb('0x1b')]('finish\x20to\x20convert');_0x492804();});_0x6809['start']();});}function base64Decode(_0x3be369,_0x22503b){var _0x82786f=path[_0xfbcb('0x23')](__dirname,'tmp',rs[_0xfbcb('0x24')](0x4)+_0xfbcb('0x25'));fs[_0xfbcb('0x26')](_0x82786f,_0x3be369,'base64');return convertFile(_0x82786f,_0x22503b)[_0xfbcb('0x27')](function(){try{fs['unlink'](_0x82786f);fs['chmodSync'](_0x22503b,_0xfbcb('0x28'));}catch(_0x452cf0){logger[_0xfbcb('0x15')](_0x452cf0);}return _0x22503b[_0xfbcb('0x29')]('.')[0x0];});}function base64Encode(_0x1a8820){var _0x5d94b7=fs[_0xfbcb('0x2a')](_0x1a8820);return new Buffer(_0x5d94b7)[_0xfbcb('0x2b')](_0xfbcb('0x2c'));}exports[_0xfbcb('0x2d')]=function(_0x514cc1,_0x470ba7,_0x20f8f5,_0x4b4077,_0x5744fa,_0x595aea){var _0x5d10f5,_0x5cf673;var _0x4a6d87=_0xfbcb('0x2e');var _0x2e7cd7='?key='+_0x514cc1;var _0x47d38e={};if(_0x470ba7==='ssml'){_0x47d38e[_0xfbcb('0x2f')]={'ssml':_0x20f8f5};}else{_0x47d38e[_0xfbcb('0x2f')]={'text':_0x20f8f5};};_0x47d38e[_0xfbcb('0x30')]={'languageCode':_0x4b4077,'ssmlGender':_0x5744fa};_0x47d38e['audioConfig']={'audioEncoding':_0xfbcb('0x31'),'sampleRateHertz':0x1f40};var _0x7a4e71={'url':_0x4a6d87+_0xfbcb('0x32')+_0x2e7cd7,'method':_0xfbcb('0x33'),'json':!![],'body':_0x47d38e};return rp(_0x7a4e71)['then'](function(_0x5b21d4){return new BPromise(function(_0x280944,_0x11189e){_0x5d10f5=path['resolve'](__dirname,_0xfbcb('0x34'),rs[_0xfbcb('0x24')](0x4)+'.mp3');var _0x4b549b=Buffer[_0xfbcb('0x35')](_0x5b21d4['audioContent'],'base64');return fs[_0xfbcb('0x36')](_0x5d10f5,_0x4b549b,function(_0x21b22b){_0x11189e(_0x21b22b);},function(_0x33efc1){fs[_0xfbcb('0x37')](_0x5d10f5,_0xfbcb('0x28'));_0x280944(_0x33efc1);});});})['then'](function(_0xb4c4a0){_0x5cf673=path[_0xfbcb('0x23')](__dirname,_0xfbcb('0x34'),rs['generate'](0x4)+'.wav');return convertFile(_0x5d10f5,_0x5cf673);})[_0xfbcb('0x27')](function(){try{fs[_0xfbcb('0x1d')](_0x5d10f5);fs[_0xfbcb('0x37')](_0x5cf673,_0xfbcb('0x28'));}catch(_0x5e83c9){logger[_0xfbcb('0x15')](_0x5e83c9);}logger['info'](_0xfbcb('0x38'),_0x5cf673['split']('.')[0x0]);return _0x5cf673[_0xfbcb('0x29')]('.')[0x0];});};exports['googleTTS']=function(_0x9c268b,_0x4d3144){var _0x2b31aa=_0xfbcb('0x39');var _0x4fc9db,_0x59e881;var _0x4d7ce2;var _0x3e78c4={'encoding':_0xfbcb('0x3a'),'method':_0xfbcb('0x33'),'timeout':0x2710,'url':_0x2b31aa,'headers':{'Content-Type':_0xfbcb('0x3b')},'body':_0xfbcb('0x3c')+encodeURIComponent(JSON[_0xfbcb('0x3d')]([[[_0xfbcb('0x3e'),JSON[_0xfbcb('0x3d')]([_0x9c268b,_0x4d3144||'en',![],'null']),null,'generic']]]))};return rp(_0x3e78c4)[_0xfbcb('0x27')](function(_0x37522e){try{_0x4d7ce2=eval(_0x37522e[_0xfbcb('0x3f')](0x5))[0x0][0x2];}catch(_0x4307c7){throw new Error(_0xfbcb('0x40')+_0x37522e[_0xfbcb('0x20')]);}if(!_0x4d7ce2){if(_0x9c268b['length']>0xc8){throw new Error(_0xfbcb('0x41'));}else{throw new Error(_0xfbcb('0x42')+_0x4d3144+_0xfbcb('0x43'));}}try{_0x4d7ce2=eval(_0x4d7ce2)[0x0];}catch(_0x4d6244){throw new Error(_0xfbcb('0x40')+res['data']);}const _0x3933aa=_0x4d7ce2;_0x4fc9db=path[_0xfbcb('0x23')](__dirname,_0xfbcb('0x34'),rs['generate'](0x4)+_0xfbcb('0x44'));fs[_0xfbcb('0x26')](_0x4fc9db,_0x4d7ce2,{'encoding':_0xfbcb('0x2c')});_0x59e881=path[_0xfbcb('0x23')](__dirname,_0xfbcb('0x34'),rs['generate'](0x4)+_0xfbcb('0x25'));return convertFile(_0x4fc9db,_0x59e881);})['then'](function(){try{fs[_0xfbcb('0x1d')](_0x4fc9db);fs['chmodSync'](_0x59e881,'777');}catch(_0x1f2037){logger['error'](_0x1f2037);}logger[_0xfbcb('0x1b')]('goggleTTS\x20path',_0x59e881[_0xfbcb('0x29')]('.')[0x0]);return _0x59e881[_0xfbcb('0x29')]('.')[0x0];});};exports[_0xfbcb('0x45')]=function(_0x508cc5,_0x36d43c,_0xec7708){return google[_0xfbcb('0x46')](_0x508cc5,_0x36d43c,_0xec7708)[_0xfbcb('0x27')](function(_0x85c237){logger[_0xfbcb('0x1b')](_0x85c237[_0xfbcb('0x47')]);return rp(_0x85c237);})[_0xfbcb('0x27')](function(_0x4766e4){var _0xe0ad88='';var _0x56edc5=0x0;try{fs[_0xfbcb('0x1d')](_0x508cc5);}catch(_0x14e103){logger[_0xfbcb('0x15')](_0x14e103);}if(_0x4766e4&&_0x4766e4[_0xfbcb('0x48')]){_0xe0ad88=_0x4766e4[_0xfbcb('0x48')][_0xfbcb('0x49')](function(_0x2f421d){return _0x2f421d&&_0x2f421d['alternatives'][0x0]&&_0x2f421d[_0xfbcb('0x4a')][0x0]['transcript']?_0x2f421d[_0xfbcb('0x4a')][0x0][_0xfbcb('0x4b')]:'';})[_0xfbcb('0x4c')]('\x0a');_0x56edc5=_0x4766e4['results'][_0xfbcb('0x49')](function(_0x54facb){return _0x54facb&&_0x54facb[_0xfbcb('0x4a')][0x0]&&_0x54facb[_0xfbcb('0x4a')][0x0][_0xfbcb('0x4d')]?_0x54facb[_0xfbcb('0x4a')][0x0][_0xfbcb('0x4d')]:0x0;})['join']('\x0a');}logger[_0xfbcb('0x1b')](_0xfbcb('0x4e'),_0xe0ad88);logger[_0xfbcb('0x1b')](_0xfbcb('0x4f'),_0x56edc5);return{'transcript':_0xe0ad88,'confidence':_0x56edc5};})[_0xfbcb('0x50')](function(_0x530914){logger[_0xfbcb('0x15')](_0xfbcb('0x51'),_0x530914[_0xfbcb('0x14')],_0x530914['name'],_0x530914[_0xfbcb('0x52')]);});};exports['googleDialogflow']=function(_0x34f62d,_0x169bfe,_0x510d13,_0x4c364b){var _0x472559=apiai(_0x169bfe,{'language':_0x4c364b||'en'});return _0x472559[_0xfbcb('0x53')](_0x510d13,{'sessionId':md5(_0x34f62d)})['then'](function(_0x356b4b){logger[_0xfbcb('0x1b')](JSON[_0xfbcb('0x3d')](_0x356b4b));return{'source':_0x356b4b[_0xfbcb('0x54')][_0xfbcb('0x55')],'resolvedQuery':_0x356b4b['result'][_0xfbcb('0x56')],'action':_0x356b4b[_0xfbcb('0x54')][_0xfbcb('0x57')],'actionIncomplete':_0x356b4b[_0xfbcb('0x54')][_0xfbcb('0x58')],'speech':_0x356b4b[_0xfbcb('0x54')]['fulfillment'][_0xfbcb('0x59')],'score':_0x356b4b['result'][_0xfbcb('0x5a')],'statusCode':_0x356b4b['status']['code'],'endConversation':_0x356b4b[_0xfbcb('0x54')][_0xfbcb('0x5b')][_0xfbcb('0x5c')]||![],'isFallbackIntent':_0x356b4b[_0xfbcb('0x54')][_0xfbcb('0x5b')][_0xfbcb('0x5d')]};});};exports['googleDialogflowV2']=function(_0x139e45,_0x17cd04,_0x3e0fef,_0x4e4095,_0x32bdb1,_0x3d3da9){var _0x14d883=_0x4e4095['replace'](/\\n/g,'\x0a');var _0x7f79ec={'credentials':{'private_key':_0x14d883,'client_email':_0x3e0fef}};var _0x3513ba=new dialogflow[(_0xfbcb('0x5e'))](_0x7f79ec);var _0x2cd762=_0x3513ba[_0xfbcb('0x5f')](_0x17cd04,md5(_0x139e45));var _0x59b1e3={'session':_0x2cd762,'queryInput':{'text':{'text':_0x32bdb1,'languageCode':_0x3d3da9}}};return _0x3513ba[_0xfbcb('0x60')](_0x59b1e3)['then'](function(_0x4827b8){if(_0x4827b8&&_0x4827b8[_0xfbcb('0x61')]){logger[_0xfbcb('0x1b')](_0xfbcb('0x62'),JSON[_0xfbcb('0x3d')](_0x4827b8));var _0x569264=_0x4827b8[0x0];if(_0x569264){var _0x18779b={'action':_0x569264[_0xfbcb('0x63')][_0xfbcb('0x57')],'allRequiredParamsPresent':_0x569264[_0xfbcb('0x63')][_0xfbcb('0x64')],'endConversation':_0x569264[_0xfbcb('0x63')][_0xfbcb('0x65')]&&_0x569264['queryResult']['diagnosticInfo'][_0xfbcb('0x66')]?_0x569264[_0xfbcb('0x63')][_0xfbcb('0x65')]['fields']['end_conversation'][_0xfbcb('0x67')]:![],'fulfillmentText':_0x569264['queryResult'][_0xfbcb('0x68')],'intentName':_0x569264['queryResult'][_0xfbcb('0x69')][_0xfbcb('0x6a')],'intentDisplayName':_0x569264['queryResult']['intent'][_0xfbcb('0x6b')],'isFallbackIntent':_0x569264[_0xfbcb('0x63')][_0xfbcb('0x69')][_0xfbcb('0x6c')],'languageCode':_0x569264[_0xfbcb('0x63')]['languageCode'],'queryText':_0x569264[_0xfbcb('0x63')][_0xfbcb('0x6d')],'responseId':_0x569264[_0xfbcb('0x6e')],'score':_0x569264[_0xfbcb('0x63')][_0xfbcb('0x6f')],'speech':_0x569264[_0xfbcb('0x63')][_0xfbcb('0x68')],'providerResponse':JSON['stringify'](_0x4827b8)};return _0x18779b;}}});};exports[_0xfbcb('0x70')]=function(_0xedbcf2,_0x26912c,_0x9af06a,_0x487609){return tilde[_0xfbcb('0x46')](_0xedbcf2,_0x26912c,_0x9af06a,_0x487609)[_0xfbcb('0x27')](function(_0x16f07c){try{fs['unlink'](_0xedbcf2);}catch(_0x7bf9aa){logger[_0xfbcb('0x15')](_0x7bf9aa);}logger[_0xfbcb('0x1b')](_0xfbcb('0x71'),_0x16f07c[_0xfbcb('0x4b')]);logger['info']('Tilde\x20ASR\x20confidence',_0x16f07c[_0xfbcb('0x4d')]);return _0x16f07c;});};exports[_0xfbcb('0x72')]=function(_0x2335af,_0x46e232,_0x366e2d,_0x176efc,_0x917c89,_0x3ec717){var _0x47a9ff=path[_0xfbcb('0x23')](__dirname,_0xfbcb('0x34'),rs[_0xfbcb('0x24')](0x4)+'.mp3');var _0x32beb2;return aws[_0xfbcb('0x73')](_0x2335af,_0x46e232,_0x366e2d,_0x176efc,_0x917c89,_0x3ec717,_0x47a9ff)[_0xfbcb('0x27')](function(){_0x32beb2=path[_0xfbcb('0x23')](__dirname,_0xfbcb('0x34'),rs[_0xfbcb('0x24')](0x4)+_0xfbcb('0x25'));return convertFile(_0x47a9ff,_0x32beb2);})[_0xfbcb('0x27')](function(){try{fs['unlink'](_0x47a9ff);fs[_0xfbcb('0x37')](_0x32beb2,_0xfbcb('0x28'));}catch(_0x40bbf7){logger[_0xfbcb('0x15')](_0x40bbf7);}return _0x32beb2[_0xfbcb('0x29')]('.')[0x0];});};exports[_0xfbcb('0x74')]=function(_0x1c412c,_0x41b1e9,_0x1cb5d6,_0x32bfc3,_0x54fae5,_0x11dce1){return aws[_0xfbcb('0x75')](_0x1c412c,_0x41b1e9,_0x1cb5d6,_0x32bfc3,_0x54fae5,_0x11dce1)[_0xfbcb('0x27')](function(_0x5cf047){logger[_0xfbcb('0x1b')](JSON[_0xfbcb('0x3d')](_0x5cf047));return _0x5cf047;});};exports['ispeechTTS']=function(_0x5a45e5,_0x5ba663,_0x474dd1,_0x30a370){var _0x1afe58=util['format'](_0xfbcb('0x76'),ISPEECH_API,_0x5a45e5,encodeURIComponent(_0x5ba663),_0x474dd1,_0x30a370);var _0x2d2ac0=path[_0xfbcb('0x23')](__dirname,_0xfbcb('0x34'),rs[_0xfbcb('0x24')](0x4)+_0xfbcb('0x44'));var _0x114a47;return downloadFile(_0x1afe58,_0x2d2ac0)[_0xfbcb('0x27')](function(){_0x114a47=path[_0xfbcb('0x23')](__dirname,'tmp',rs[_0xfbcb('0x24')](0x4)+'.wav');return convertFile(_0x2d2ac0,_0x114a47);})[_0xfbcb('0x27')](function(){try{fs[_0xfbcb('0x1d')](_0x2d2ac0);fs['chmodSync'](_0x114a47,_0xfbcb('0x28'));}catch(_0x28a407){logger['error'](_0x28a407);}return _0x114a47[_0xfbcb('0x29')]('.')[0x0];});};exports[_0xfbcb('0x77')]=function(_0x45dc30,_0xe83ce6,_0x43c4e6,_0x31bf1a){var _0x1d85e5=util[_0xfbcb('0x78')](_0xfbcb('0x79'),ISPEECH_API,_0xe83ce6,_0x43c4e6,base64Encode(_0x45dc30),_0x31bf1a?util[_0xfbcb('0x78')](_0xfbcb('0x7a'),encodeURIComponent(_0x31bf1a)):'freeform=3');return uploadFile(_0x1d85e5)[_0xfbcb('0x27')](function(_0x3b9bac){return querystring[_0xfbcb('0x7b')](_0x3b9bac);});};exports[_0xfbcb('0x7c')]=function(_0x3222a4,_0x6c3989){return sestek[_0xfbcb('0x7d')](_0x3222a4,_0x6c3989)[_0xfbcb('0x27')](function(_0x21a216){logger[_0xfbcb('0x1b')](JSON[_0xfbcb('0x3d')](_0x21a216));var _0x5e9db1={'speech':_0x21a216[_0xfbcb('0x7e')],'action':_0x21a216[_0xfbcb('0x7f')]?_0x21a216[_0xfbcb('0x7f')][_0xfbcb('0x80')]:undefined,'actiondata':_0x21a216['channelData']?_0x21a216['channelData'][_0xfbcb('0x81')]:undefined};if(_0x21a216[_0xfbcb('0x7f')]&&_0x21a216[_0xfbcb('0x7f')][_0xfbcb('0x82')]){return base64Decode(_0x21a216[_0xfbcb('0x7f')][_0xfbcb('0x82')][_0xfbcb('0x83')],path[_0xfbcb('0x23')](__dirname,_0xfbcb('0x34'),rs[_0xfbcb('0x24')](0x4)+'.wav'))['then'](function(_0x298f16){_0x5e9db1[_0xfbcb('0x84')]=_0x298f16;return _0x5e9db1;});}return _0x5e9db1;});};exports[_0xfbcb('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x25d4=['stringify','null','generic','slice','parse\x20response\x20failed:\x0a','lang\x20\x22','goggleTTS\x20path','uri','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','action','result','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','wav','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','text:synthesize','POST','.mp3','from','audioContent','writeFile','then','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','jQ1olc'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x25d4,0x1d7));var _0x425d=function(_0x22a35e,_0x17dc67){_0x22a35e=_0x22a35e-0x0;var _0x3db566=_0x25d4[_0x22a35e];return _0x3db566;};'use strict';var apiai=require(_0x425d('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x425d('0x1'));var fs=require('fs');var http=require(_0x425d('0x2'));var https=require(_0x425d('0x3'));var md5=require(_0x425d('0x4'));var path=require('path');var querystring=require(_0x425d('0x5'));var rp=require(_0x425d('0x6'));var rs=require(_0x425d('0x7'));var sox=require(_0x425d('0x8'));var tts=require(_0x425d('0x9'));var urlParse=require(_0x425d('0xa'))[_0x425d('0xb')];var util=require('util');var aws=require(_0x425d('0xc'));var google=require(_0x425d('0xd'));var sestek=require('./sestek');var tilde=require(_0x425d('0xe'));var logger=require('../../../config/logger')(_0x425d('0xf'));var ISPEECH_API=_0x425d('0x10');function downloadFile(_0x5e1443,_0xf6c152){return new BPromise(function(_0x5e321e,_0x5afc87){var _0x29f38d=urlParse(_0x5e1443);var _0x21193e=_0x29f38d[_0x425d('0x11')]===_0x425d('0x12')?https:http;var _0x181510={'host':_0x29f38d[_0x425d('0x13')],'path':_0x29f38d[_0x425d('0x14')],'headers':{'user-agent':_0x425d('0x15')}};_0x21193e[_0x425d('0x16')](_0x181510,function(_0x49372f){if(_0x49372f['statusCode']!==0xc8){logger[_0x425d('0x17')]('request\x20to\x20'+_0x5e1443+_0x425d('0x18')+_0x49372f[_0x425d('0x19')]+'\x20('+_0x49372f['statusMessage']+')');_0x5afc87(new Error('request\x20to\x20'+_0x5e1443+_0x425d('0x18')+_0x49372f['statusCode']+'\x20('+_0x49372f[_0x425d('0x1a')]+')'));return;}var _0xde710b=fs[_0x425d('0x1b')](_0xf6c152);_0xde710b['on']('finish',function(){logger[_0x425d('0x1c')](_0x425d('0x1d'));_0xde710b[_0x425d('0x1e')](_0x5e321e);});_0xde710b['on'](_0x425d('0x17'),function(_0x69d06a){fs[_0x425d('0x1f')](_0xf6c152);logger[_0x425d('0x17')](_0x425d('0x20'),_0x69d06a);_0x5afc87(_0x69d06a);});_0x49372f[_0x425d('0x21')](_0xde710b);})['on']('error',function(_0x12c69e){logger['error'](_0x12c69e);_0x5afc87(_0x12c69e);})[_0x425d('0x22')]();});}function uploadFile(_0x1648b0){return new BPromise(function(_0xd928cd,_0x46c154){var _0x4a0018=urlParse(_0x1648b0);var _0x4047a7=_0x4a0018['protocol']==='https:'?https:http;var _0x4c3dea={'host':_0x4a0018[_0x425d('0x13')],'path':_0x4a0018[_0x425d('0x14')],'headers':{'user-agent':_0x425d('0x15')}};_0x4047a7[_0x425d('0x16')](_0x4c3dea,function(_0x2c23f5){if(_0x2c23f5['statusCode']!==0xc8){_0x46c154(new Error('request\x20to\x20'+_0x1648b0+'\x20failed,\x20status\x20code\x20=\x20'+_0x2c23f5[_0x425d('0x19')]+'\x20('+_0x2c23f5[_0x425d('0x1a')]+')'));return;}var _0x3bc389='';_0x2c23f5['on'](_0x425d('0x23'),function(_0x3d9a5a){_0x3bc389+=_0x3d9a5a;});_0x2c23f5['on'](_0x425d('0x22'),function(){_0xd928cd(_0x3bc389);});})['on']('error',function(_0x24fd63){_0x46c154(_0x24fd63);})[_0x425d('0x22')]();});}function convertFile(_0x1d2c25,_0x3437b4){return new BPromise(function(_0x2366e4,_0x41b9cf){var _0x437184=sox['transcode'](_0x1d2c25,_0x3437b4,{'sampleRate':0x1f40,'format':_0x425d('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x437184['on'](_0x425d('0x17'),function(_0x1541fb){logger[_0x425d('0x17')]('error\x20convert',_0x1541fb);_0x41b9cf(_0x1541fb);});_0x437184['on'](_0x425d('0x22'),function(){logger[_0x425d('0x1c')](_0x425d('0x25'));_0x2366e4();});_0x437184[_0x425d('0x26')]();});}function base64Decode(_0xf86622,_0x51ec1e){var _0x10c90b=path[_0x425d('0x27')](__dirname,_0x425d('0x28'),rs[_0x425d('0x29')](0x4)+_0x425d('0x2a'));fs[_0x425d('0x2b')](_0x10c90b,_0xf86622,_0x425d('0x2c'));return convertFile(_0x10c90b,_0x51ec1e)['then'](function(){try{fs[_0x425d('0x1f')](_0x10c90b);fs[_0x425d('0x2d')](_0x51ec1e,_0x425d('0x2e'));}catch(_0x44155d){logger[_0x425d('0x17')](_0x44155d);}return _0x51ec1e[_0x425d('0x2f')]('.')[0x0];});}function base64Encode(_0x4dcc8d){var _0x16077f=fs['readFileSync'](_0x4dcc8d);return new Buffer(_0x16077f)[_0x425d('0x30')](_0x425d('0x2c'));}exports[_0x425d('0x31')]=function(_0x364b9e,_0x535b43,_0x4c84fc,_0x129970,_0x106b29,_0x2e6f4b){var _0x102515,_0x17d475;var _0x3a0382=_0x425d('0x32');var _0x282a76=_0x425d('0x33')+_0x364b9e;var _0x1490a5={};if(_0x535b43==='ssml'){_0x1490a5[_0x425d('0x34')]={'ssml':_0x4c84fc};}else{_0x1490a5['input']={'text':_0x4c84fc};};_0x1490a5['voice']={'languageCode':_0x129970,'ssmlGender':_0x106b29};_0x1490a5['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x331830={'url':_0x3a0382+_0x425d('0x35')+_0x282a76,'method':_0x425d('0x36'),'json':!![],'body':_0x1490a5};return rp(_0x331830)['then'](function(_0x3fdc6d){return new BPromise(function(_0x1952e3,_0x2c2d45){_0x102515=path['resolve'](__dirname,_0x425d('0x28'),rs[_0x425d('0x29')](0x4)+_0x425d('0x37'));var _0x5a233b=Buffer[_0x425d('0x38')](_0x3fdc6d[_0x425d('0x39')],_0x425d('0x2c'));return fs[_0x425d('0x3a')](_0x102515,_0x5a233b,function(_0x1bd0c7){_0x2c2d45(_0x1bd0c7);},function(_0x3fb254){fs[_0x425d('0x2d')](_0x102515,_0x425d('0x2e'));_0x1952e3(_0x3fb254);});});})[_0x425d('0x3b')](function(_0x1c7a79){_0x17d475=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x102515,_0x17d475);})[_0x425d('0x3b')](function(){try{fs[_0x425d('0x1f')](_0x102515);fs[_0x425d('0x2d')](_0x17d475,'777');}catch(_0x2ab4d2){logger[_0x425d('0x17')](_0x2ab4d2);}logger[_0x425d('0x1c')](_0x425d('0x3c'),_0x17d475[_0x425d('0x2f')]('.')[0x0]);return _0x17d475[_0x425d('0x2f')]('.')[0x0];});};exports[_0x425d('0x3d')]=function(_0x3f99cc,_0x24fb6f){var _0xce119c=_0x425d('0x3e');var _0x318d98,_0x33f756;var _0x120fa1;var _0x3a573a={'encoding':'utf8','method':_0x425d('0x36'),'timeout':0x2710,'url':_0xce119c,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x425d('0x3f')+encodeURIComponent(JSON['stringify']([[[_0x425d('0x40'),JSON[_0x425d('0x41')]([_0x3f99cc,_0x24fb6f||'en',![],_0x425d('0x42')]),null,_0x425d('0x43')]]]))};return rp(_0x3a573a)[_0x425d('0x3b')](function(_0x33a147){try{_0x120fa1=eval(_0x33a147[_0x425d('0x44')](0x5))[0x0][0x2];}catch(_0x15fb35){throw new Error(_0x425d('0x45')+_0x33a147[_0x425d('0x23')]);}if(!_0x120fa1){if(_0x3f99cc['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x425d('0x46')+_0x24fb6f+'\x22\x20might\x20not\x20exist');}}try{_0x120fa1=eval(_0x120fa1)[0x0];}catch(_0x12d365){throw new Error(_0x425d('0x45')+res[_0x425d('0x23')]);}const _0x238f2b=_0x120fa1;_0x318d98=path[_0x425d('0x27')](__dirname,_0x425d('0x28'),rs[_0x425d('0x29')](0x4)+'.mp3');fs['writeFileSync'](_0x318d98,_0x120fa1,{'encoding':_0x425d('0x2c')});_0x33f756=path[_0x425d('0x27')](__dirname,_0x425d('0x28'),rs[_0x425d('0x29')](0x4)+_0x425d('0x2a'));return convertFile(_0x318d98,_0x33f756);})[_0x425d('0x3b')](function(){try{fs['unlink'](_0x318d98);fs[_0x425d('0x2d')](_0x33f756,'777');}catch(_0x4cb95f){logger['error'](_0x4cb95f);}logger[_0x425d('0x1c')](_0x425d('0x47'),_0x33f756[_0x425d('0x2f')]('.')[0x0]);return _0x33f756[_0x425d('0x2f')]('.')[0x0];});};exports['googleASR']=function(_0x3ac770,_0x5ee9aa,_0x44410f){return google['asr'](_0x3ac770,_0x5ee9aa,_0x44410f)['then'](function(_0x5db0f8){logger[_0x425d('0x1c')](_0x5db0f8[_0x425d('0x48')]);return rp(_0x5db0f8);})['then'](function(_0x506745){var _0x247913='';var _0x7733d7=0x0;try{fs['unlink'](_0x3ac770);}catch(_0x3b0c9e){logger[_0x425d('0x17')](_0x3b0c9e);}if(_0x506745&&_0x506745[_0x425d('0x49')]){_0x247913=_0x506745[_0x425d('0x49')][_0x425d('0x4a')](function(_0x7d2ece){return _0x7d2ece&&_0x7d2ece['alternatives'][0x0]&&_0x7d2ece[_0x425d('0x4b')][0x0][_0x425d('0x4c')]?_0x7d2ece[_0x425d('0x4b')][0x0]['transcript']:'';})[_0x425d('0x4d')]('\x0a');_0x7733d7=_0x506745[_0x425d('0x49')][_0x425d('0x4a')](function(_0xa6dfff){return _0xa6dfff&&_0xa6dfff[_0x425d('0x4b')][0x0]&&_0xa6dfff['alternatives'][0x0]['confidence']?_0xa6dfff['alternatives'][0x0]['confidence']:0x0;})[_0x425d('0x4d')]('\x0a');}logger['info'](_0x425d('0x4e'),_0x247913);logger['info'](_0x425d('0x4f'),_0x7733d7);return{'transcript':_0x247913,'confidence':_0x7733d7};})[_0x425d('0x50')](function(_0x5e0e18){logger['error'](_0x425d('0x51'),_0x5e0e18[_0x425d('0x19')],_0x5e0e18[_0x425d('0x52')],_0x5e0e18[_0x425d('0x53')]);});};exports[_0x425d('0x54')]=function(_0x1404c4,_0x545785,_0x56b75a,_0x4b0d13){var _0x594f0d=apiai(_0x545785,{'language':_0x4b0d13||'en'});return _0x594f0d[_0x425d('0x55')](_0x56b75a,{'sessionId':md5(_0x1404c4)})['then'](function(_0x1fd33b){logger[_0x425d('0x1c')](JSON[_0x425d('0x41')](_0x1fd33b));return{'source':_0x1fd33b['result'][_0x425d('0x56')],'resolvedQuery':_0x1fd33b['result']['resolvedQuery'],'action':_0x1fd33b['result'][_0x425d('0x57')],'actionIncomplete':_0x1fd33b[_0x425d('0x58')]['actionIncomplete'],'speech':_0x1fd33b[_0x425d('0x58')]['fulfillment'][_0x425d('0x59')],'score':_0x1fd33b[_0x425d('0x58')][_0x425d('0x5a')],'statusCode':_0x1fd33b['status'][_0x425d('0x5b')],'endConversation':_0x1fd33b[_0x425d('0x58')][_0x425d('0x5c')][_0x425d('0x5d')]||![],'isFallbackIntent':_0x1fd33b[_0x425d('0x58')][_0x425d('0x5c')][_0x425d('0x5e')]};});};exports[_0x425d('0x5f')]=function(_0x30a65c,_0x47faf7,_0x10718e,_0x289f02,_0xf59e37,_0x40dc00){var _0x4fbad4=_0x289f02[_0x425d('0x60')](/\\n/g,'\x0a');var _0x976dd2={'credentials':{'private_key':_0x4fbad4,'client_email':_0x10718e}};var _0x339776=new dialogflow['SessionsClient'](_0x976dd2);var _0x35c2f9=_0x339776['sessionPath'](_0x47faf7,md5(_0x30a65c));var _0x1d68db={'session':_0x35c2f9,'queryInput':{'text':{'text':_0xf59e37,'languageCode':_0x40dc00}}};return _0x339776[_0x425d('0x61')](_0x1d68db)['then'](function(_0x49d886){if(_0x49d886&&_0x49d886[_0x425d('0x62')]){logger[_0x425d('0x1c')](_0x425d('0x63'),JSON[_0x425d('0x41')](_0x49d886));var _0x529612=_0x49d886[0x0];if(_0x529612){var _0x1c6c8e={'action':_0x529612[_0x425d('0x64')]['action'],'allRequiredParamsPresent':_0x529612['queryResult'][_0x425d('0x65')],'endConversation':_0x529612[_0x425d('0x64')][_0x425d('0x66')]&&_0x529612[_0x425d('0x64')][_0x425d('0x66')]['fields']?_0x529612[_0x425d('0x64')][_0x425d('0x66')][_0x425d('0x67')]['end_conversation'][_0x425d('0x68')]:![],'fulfillmentText':_0x529612['queryResult'][_0x425d('0x69')],'intentName':_0x529612[_0x425d('0x64')][_0x425d('0x6a')][_0x425d('0x52')],'intentDisplayName':_0x529612[_0x425d('0x64')]['intent'][_0x425d('0x6b')],'isFallbackIntent':_0x529612['queryResult'][_0x425d('0x6a')][_0x425d('0x6c')],'languageCode':_0x529612[_0x425d('0x64')][_0x425d('0x6d')],'queryText':_0x529612[_0x425d('0x64')]['queryText'],'responseId':_0x529612[_0x425d('0x6e')],'score':_0x529612[_0x425d('0x64')]['intentDetectionConfidence'],'speech':_0x529612['queryResult'][_0x425d('0x69')],'providerResponse':JSON['stringify'](_0x49d886)};return _0x1c6c8e;}}});};exports[_0x425d('0x6f')]=function(_0x16b093,_0x371008,_0x4f98e3,_0x380410){return tilde[_0x425d('0x70')](_0x16b093,_0x371008,_0x4f98e3,_0x380410)[_0x425d('0x3b')](function(_0x4b85ae){try{fs[_0x425d('0x1f')](_0x16b093);}catch(_0x22b765){logger['error'](_0x22b765);}logger[_0x425d('0x1c')](_0x425d('0x71'),_0x4b85ae[_0x425d('0x4c')]);logger['info'](_0x425d('0x72'),_0x4b85ae[_0x425d('0x73')]);return _0x4b85ae;});};exports[_0x425d('0x74')]=function(_0x6c1832,_0x4e7eec,_0xc49561,_0x3be7d0,_0x54c9db,_0x29252b){var _0x94baa8=path[_0x425d('0x27')](__dirname,_0x425d('0x28'),rs['generate'](0x4)+_0x425d('0x37'));var _0xe7d8f6;return aws['polly'](_0x6c1832,_0x4e7eec,_0xc49561,_0x3be7d0,_0x54c9db,_0x29252b,_0x94baa8)['then'](function(){_0xe7d8f6=path[_0x425d('0x27')](__dirname,_0x425d('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x94baa8,_0xe7d8f6);})[_0x425d('0x3b')](function(){try{fs['unlink'](_0x94baa8);fs[_0x425d('0x2d')](_0xe7d8f6,_0x425d('0x2e'));}catch(_0x4e4f63){logger[_0x425d('0x17')](_0x4e4f63);}return _0xe7d8f6['split']('.')[0x0];});};exports['awsLex']=function(_0x12d811,_0x348f15,_0x1f67f2,_0x507fbb,_0x57b9ae,_0x401a86){return aws[_0x425d('0x75')](_0x12d811,_0x348f15,_0x1f67f2,_0x507fbb,_0x57b9ae,_0x401a86)[_0x425d('0x3b')](function(_0x5c7013){logger[_0x425d('0x1c')](JSON[_0x425d('0x41')](_0x5c7013));return _0x5c7013;});};exports[_0x425d('0x76')]=function(_0x1a3314,_0x524851,_0x4d0567,_0x54f8e7){var _0x49ccfc=util[_0x425d('0x77')](_0x425d('0x78'),ISPEECH_API,_0x1a3314,encodeURIComponent(_0x524851),_0x4d0567,_0x54f8e7);var _0x2768a4=path[_0x425d('0x27')](__dirname,_0x425d('0x28'),rs[_0x425d('0x29')](0x4)+_0x425d('0x37'));var _0x224e0d;return downloadFile(_0x49ccfc,_0x2768a4)['then'](function(){_0x224e0d=path[_0x425d('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x425d('0x2a'));return convertFile(_0x2768a4,_0x224e0d);})[_0x425d('0x3b')](function(){try{fs[_0x425d('0x1f')](_0x2768a4);fs[_0x425d('0x2d')](_0x224e0d,_0x425d('0x2e'));}catch(_0xc4dc66){logger[_0x425d('0x17')](_0xc4dc66);}return _0x224e0d['split']('.')[0x0];});};exports[_0x425d('0x79')]=function(_0xfd0fc3,_0x2485a9,_0x18bf10,_0x45dddc){var _0x573de9=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2485a9,_0x18bf10,base64Encode(_0xfd0fc3),_0x45dddc?util[_0x425d('0x77')](_0x425d('0x7a'),encodeURIComponent(_0x45dddc)):_0x425d('0x7b'));return uploadFile(_0x573de9)['then'](function(_0x3da435){return querystring[_0x425d('0xb')](_0x3da435);});};exports[_0x425d('0x7c')]=function(_0x59f7ed,_0x2c71f8){return sestek[_0x425d('0x7d')](_0x59f7ed,_0x2c71f8)[_0x425d('0x3b')](function(_0x148df5){logger[_0x425d('0x1c')](JSON[_0x425d('0x41')](_0x148df5));var _0x102b1a={'speech':_0x148df5[_0x425d('0x7e')],'action':_0x148df5['channelData']?_0x148df5[_0x425d('0x7f')][_0x425d('0x80')]:undefined,'actiondata':_0x148df5[_0x425d('0x7f')]?_0x148df5[_0x425d('0x7f')][_0x425d('0x81')]:undefined};if(_0x148df5[_0x425d('0x7f')]&&_0x148df5['channelData'][_0x425d('0x82')]){return base64Decode(_0x148df5[_0x425d('0x7f')]['AudioFromTts'][_0x425d('0x83')],path['resolve'](__dirname,_0x425d('0x28'),rs['generate'](0x4)+'.wav'))[_0x425d('0x3b')](function(_0xee8b0c){_0x102b1a[_0x425d('0x84')]=_0xee8b0c;return _0x102b1a;});}return _0x102b1a;});};exports[_0x425d('0x85')]=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 86438fe..8f34e03 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 _0xe8a9=['exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe8a9,0x1d7));var _0x9e8a=function(_0x42c0e4,_0x2afe29){_0x42c0e4=_0x42c0e4-0x0;var _0x521645=_0xe8a9[_0x42c0e4];return _0x521645;};var nda=require('./nda');module[_0x9e8a('0x0')]={'nda':nda}; \ No newline at end of file +var nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 5fb6eb5..b2da084 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 _0x9234=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','body','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','then'];(function(_0x329fc2,_0x2128bb){var _0x5b1704=function(_0xfb5b66){while(--_0xfb5b66){_0x329fc2['push'](_0x329fc2['shift']());}};_0x5b1704(++_0x2128bb);}(_0x9234,0x1bd));var _0x4923=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0x9234[_0x263a2f];return _0x8020e8;};'use strict';var rp=require(_0x4923('0x0'));var url=require('url');var logger=require(_0x4923('0x1'))(_0x4923('0x2'));module[_0x4923('0x3')]=function(_0x34915b,_0x481178){var _0x1ca221={'method':_0x4923('0x4'),'uri':url['resolve'](_0x481178[_0x4923('0x5')],_0x4923('0x6')),'form':{'grant_type':_0x4923('0x7'),'username':_0x481178[_0x4923('0x8')],'password':_0x481178[_0x4923('0x7')]},'json':!![]};return rp(_0x1ca221)[_0x4923('0x9')](function(_0x2de396){var _0x548676={'method':_0x4923('0x4'),'uri':url['resolve'](_0x481178[_0x4923('0xa')],_0x4923('0xb')),'body':{'type':_0x481178[_0x4923('0xc')]||'message','channelId':_0x4923('0xd'),'conversation':{'id':_0x34915b[_0x4923('0xe')]},'from':{'id':_0x34915b[_0x4923('0xf')],'name':_0x34915b[_0x4923('0x10')]},'recipient':{'id':_0x34915b[_0x4923('0x11')],'name':_0x34915b[_0x4923('0x12')]},'text':_0x481178[_0x4923('0x13')],'channelData':{}},'headers':{'Authorization':_0x4923('0x14')+_0x2de396[_0x4923('0x15')]},'json':!![]};if(_0x481178[_0x4923('0x16')]){_0x548676['body']['channelData'][_0x4923('0x17')]=_0x481178[_0x4923('0x16')];}if(_0x481178[_0x4923('0x18')]=='1'){_0x548676['body'][_0x4923('0x19')][_0x4923('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4923('0x1b')};}if(_0x481178[_0x4923('0x1c')]){_0x548676[_0x4923('0x1d')][_0x4923('0x19')][_0x4923('0x1e')]=_0x481178[_0x4923('0x1c')];if(_0x481178[_0x4923('0x1f')]){_0x548676[_0x4923('0x1d')]['channelData'][_0x4923('0x20')]=_0x481178[_0x4923('0x1f')];}}logger[_0x4923('0x21')](JSON[_0x4923('0x22')](_0x548676));return rp(_0x548676);});}; \ No newline at end of file +var _0x8cfd=['username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','channelData','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password'];(function(_0x5932a3,_0x4e6616){var _0x5082f7=function(_0x538d59){while(--_0x538d59){_0x5932a3['push'](_0x5932a3['shift']());}};_0x5082f7(++_0x4e6616);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x8cfd[_0x45518f];return _0x198175;};'use strict';var rp=require(_0xd8cf('0x0'));var url=require(_0xd8cf('0x1'));var logger=require(_0xd8cf('0x2'))(_0xd8cf('0x3'));module[_0xd8cf('0x4')]=function(_0x30dc05,_0x562c81){var _0x458a58={'method':_0xd8cf('0x5'),'uri':url[_0xd8cf('0x6')](_0x562c81[_0xd8cf('0x7')],_0xd8cf('0x8')),'form':{'grant_type':_0xd8cf('0x9'),'username':_0x562c81[_0xd8cf('0xa')],'password':_0x562c81['password']},'json':!![]};return rp(_0x458a58)['then'](function(_0x3fe2d2){var _0xa5b446={'method':_0xd8cf('0x5'),'uri':url[_0xd8cf('0x6')](_0x562c81[_0xd8cf('0xb')],_0xd8cf('0xc')),'body':{'type':_0x562c81['ndaactivity_type']||_0xd8cf('0xd'),'channelId':_0xd8cf('0xe'),'conversation':{'id':_0x30dc05[_0xd8cf('0xf')]},'from':{'id':_0x30dc05[_0xd8cf('0x10')],'name':_0x30dc05[_0xd8cf('0x11')]},'recipient':{'id':_0x30dc05[_0xd8cf('0x12')],'name':_0x30dc05[_0xd8cf('0x13')]},'text':_0x562c81[_0xd8cf('0x14')],'channelData':{}},'headers':{'Authorization':_0xd8cf('0x15')+_0x3fe2d2[_0xd8cf('0x16')]},'json':!![]};if(_0x562c81[_0xd8cf('0x17')]){_0xa5b446[_0xd8cf('0x18')]['channelData'][_0xd8cf('0x19')]=_0x562c81['project'];}if(_0x562c81[_0xd8cf('0x1a')]=='1'){_0xa5b446[_0xd8cf('0x18')]['channelData'][_0xd8cf('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xd8cf('0x1c')};}if(_0x562c81[_0xd8cf('0x1d')]){_0xa5b446['body'][_0xd8cf('0x1e')]['CustomAction']=_0x562c81[_0xd8cf('0x1d')];if(_0x562c81[_0xd8cf('0x1f')]){_0xa5b446[_0xd8cf('0x18')][_0xd8cf('0x1e')][_0xd8cf('0x20')]=_0x562c81[_0xd8cf('0x1f')];}}logger['info'](JSON[_0xd8cf('0x21')](_0xa5b446));return rp(_0xa5b446);});}; \ 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 2d2b258..423fe33 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 _0x4b8e=['exports'];(function(_0x3579d3,_0x1d04e4){var _0x309fa1=function(_0x495eec){while(--_0x495eec){_0x3579d3['push'](_0x3579d3['shift']());}};_0x309fa1(++_0x1d04e4);}(_0x4b8e,0xde));var _0xe4b8=function(_0x6b888e,_0x420fed){_0x6b888e=_0x6b888e-0x0;var _0x17d0f6=_0x4b8e[_0x6b888e];return _0x17d0f6;};'use strict';var asr=require('./lib/api');module[_0xe4b8('0x0')]=function(_0x4a7ff5,_0x2fb2a6,_0x31c368,_0xc22788){return asr(_0x4a7ff5,_0x2fb2a6,_0x31c368,_0xc22788);}; \ No newline at end of file +var _0x87f2=['./lib/api'];(function(_0x23b3b6,_0x12b420){var _0x3e65ca=function(_0x32ff51){while(--_0x32ff51){_0x23b3b6['push'](_0x23b3b6['shift']());}};_0x3e65ca(++_0x12b420);}(_0x87f2,0x165));var _0x287f=function(_0x3d7a02,_0x3da0cd){_0x3d7a02=_0x3d7a02-0x0;var _0x2d3d76=_0x87f2[_0x3d7a02];return _0x2d3d76;};'use strict';var asr=require(_0x287f('0x0'));module['exports']=function(_0xaae693,_0xb1e77a,_0x168b0c,_0x4760cf){return asr(_0xaae693,_0xb1e77a,_0x168b0c,_0x4760cf);}; \ 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 956cd89..2afcf31 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 _0x3db6=['parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','lodash','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','digest','hex','unix','send','stringify','createReadStream','close','EOS','error','terminate'];(function(_0x4f998c,_0x1f13ce){var _0x29c3d4=function(_0x255d06){while(--_0x255d06){_0x4f998c['push'](_0x4f998c['shift']());}};_0x29c3d4(++_0x1f13ce);}(_0x3db6,0x78));var _0x63db=function(_0x93345c,_0x1f8f16){_0x93345c=_0x93345c-0x0;var _0x58a544=_0x3db6[_0x93345c];return _0x58a544;};'use strict';var BPromise=require(_0x63db('0x0'));var _=require(_0x63db('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x63db('0x2'))(_0x63db('0x3'));module[_0x63db('0x4')]=function(_0x3f3b6e,_0x5401c7,_0x2a4e62,_0x24833c){return new BPromise(function(_0x5a6442,_0x5a4108){logger[_0x63db('0x5')](_0x63db('0x6'),_0x24833c||_0x63db('0x7'));var _0x2b2b2a=new WebSocket(_0x24833c||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x58366d='';var _0x5afefd='0';var _0x15a716='1';var _0x2d143b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x6dff20(_0x207260){var _0x442d2b=crypto[_0x63db('0x8')]('sha1');_0x442d2b[_0x63db('0x9')](_0x207260);return _0x442d2b[_0x63db('0xa')](_0x63db('0xb'));}function _0x545bbc(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x38a495=moment()[_0x63db('0xc')]();var _0x290b40=_0x6dff20(_0x38a495+_0x5401c7+_0x2a4e62);_0x2b2b2a[_0x63db('0xd')](JSON[_0x63db('0xe')]({'appID':_0x5401c7,'timestamp':_0x38a495,'appKey':_0x290b40}));var _0x13f3c5=fs[_0x63db('0xf')](_0x3f3b6e);_0x13f3c5['on']('data',function(_0x56a337){_0x2b2b2a['send'](_0x56a337);});_0x13f3c5['on'](_0x63db('0x10'),function(){_0x2b2b2a[_0x63db('0xd')](_0x63db('0x11'));});}catch(_0x2fccb2){logger[_0x63db('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0x63db('0xe')](_0x2fccb2));_0x2b2b2a[_0x63db('0x13')]();}}function _0x9cfe20(_0x47b705){try{if(_0x47b705){var _0x27a0f4=JSON[_0x63db('0x14')](_0x47b705);switch(_0x27a0f4['status']){case 0x0:if(_0x27a0f4[_0x63db('0x15')]){if(_0x27a0f4['result'][_0x63db('0x16')]){logger[_0x63db('0x5')](_0x63db('0x17'),JSON['stringify'](_0x27a0f4[_0x63db('0x15')]['hypotheses']));_0x58366d=_0x27a0f4[_0x63db('0x15')][_0x63db('0x18')][0x0][_0x63db('0x19')];_0x5afefd=_0x27a0f4[_0x63db('0x15')]['hypotheses'][0x0][_0x63db('0x1a')];_0x15a716='0';_0x2d143b=_0x63db('0x1b');_0x2b2b2a[_0x63db('0x13')]();}}break;case 0x1:logger[_0x63db('0x5')](_0x63db('0x1c'));_0x15a716='1';_0x2d143b=_0x63db('0x1c');break;case 0x2:logger[_0x63db('0x5')](_0x63db('0x1d'));_0x15a716='2';_0x2d143b=_0x63db('0x1d');break;case 0x9:logger['info'](_0x63db('0x1e'));_0x15a716='9';_0x2d143b=_0x63db('0x1e');break;case 0xa:logger[_0x63db('0x5')]('Authentication\x20failed.');_0x15a716='10';_0x2d143b='Authentication\x20failed.';break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x15a716='11';_0x2d143b=_0x63db('0x1f');}}}catch(_0x2c5d0f){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x63db('0xe')](_0x2c5d0f));_0x2b2b2a[_0x63db('0x13')]();}}function _0x5de527(){logger[_0x63db('0x5')](_0x63db('0x20'));_0x5a6442({'transcript':_0x58366d,'confidence':_0x5afefd,'status':_0x15a716,'status_message':_0x2d143b});}function _0x156381(_0x197b74){logger[_0x63db('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x197b74)){logger[_0x63db('0x12')](_[_0x63db('0x21')](_0x197b74)?JSON['stringify'](_0x197b74):_0x197b74);}}_0x2b2b2a['on'](_0x63db('0x22'),_0x545bbc);_0x2b2b2a['on']('message',_0x9cfe20);_0x2b2b2a['on'](_0x63db('0x10'),_0x5de527);_0x2b2b2a['on'](_0x63db('0x12'),_0x156381);});}; \ No newline at end of file +var _0xf592=['exports','info','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data','close','EOS','error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','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','bluebird','moment','crypto','../../../../../../config/logger','agi'];(function(_0x65d7c9,_0x42f130){var _0x2b98a7=function(_0x2fd11f){while(--_0x2fd11f){_0x65d7c9['push'](_0x65d7c9['shift']());}};_0x2b98a7(++_0x42f130);}(_0xf592,0x151));var _0x2f59=function(_0x16629d,_0x52983a){_0x16629d=_0x16629d-0x0;var _0x471981=_0xf592[_0x16629d];return _0x471981;};'use strict';var BPromise=require(_0x2f59('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2f59('0x1'));var crypto=require(_0x2f59('0x2'));var logger=require(_0x2f59('0x3'))(_0x2f59('0x4'));module[_0x2f59('0x5')]=function(_0x5eeff0,_0x42ae37,_0x1a9102,_0xba8677){return new BPromise(function(_0x3cb9a2,_0x29a7ca){logger[_0x2f59('0x6')]('Tilde\x20URI',_0xba8677||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1a7ecc=new WebSocket(_0xba8677||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x100ea0='';var _0x51cfc4='0';var _0x5867c0='1';var _0x7c81e5=_0x2f59('0x7');function _0x35ccac(_0x57e587){var _0x1c048c=crypto[_0x2f59('0x8')](_0x2f59('0x9'));_0x1c048c[_0x2f59('0xa')](_0x57e587);return _0x1c048c[_0x2f59('0xb')](_0x2f59('0xc'));}function _0x148093(){try{logger['info'](_0x2f59('0xd'));var _0x2882a5=moment()[_0x2f59('0xe')]();var _0x50a172=_0x35ccac(_0x2882a5+_0x42ae37+_0x1a9102);_0x1a7ecc['send'](JSON['stringify']({'appID':_0x42ae37,'timestamp':_0x2882a5,'appKey':_0x50a172}));var _0x4c5171=fs[_0x2f59('0xf')](_0x5eeff0);_0x4c5171['on'](_0x2f59('0x10'),function(_0x3e937a){_0x1a7ecc['send'](_0x3e937a);});_0x4c5171['on'](_0x2f59('0x11'),function(){_0x1a7ecc['send'](_0x2f59('0x12'));});}catch(_0x2be676){logger[_0x2f59('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x2f59('0x14')](_0x2be676));_0x1a7ecc[_0x2f59('0x15')]();}}function _0x30f05a(_0x426a1f){try{if(_0x426a1f){var _0x4b2aa0=JSON[_0x2f59('0x16')](_0x426a1f);switch(_0x4b2aa0[_0x2f59('0x17')]){case 0x0:if(_0x4b2aa0[_0x2f59('0x18')]){if(_0x4b2aa0[_0x2f59('0x18')][_0x2f59('0x19')]){logger[_0x2f59('0x6')](_0x2f59('0x1a'),JSON['stringify'](_0x4b2aa0[_0x2f59('0x18')][_0x2f59('0x1b')]));_0x100ea0=_0x4b2aa0[_0x2f59('0x18')][_0x2f59('0x1b')][0x0][_0x2f59('0x1c')];_0x51cfc4=_0x4b2aa0[_0x2f59('0x18')][_0x2f59('0x1b')][0x0][_0x2f59('0x1d')];_0x5867c0='0';_0x7c81e5='Success.';_0x1a7ecc['terminate']();}}break;case 0x1:logger['info'](_0x2f59('0x7'));_0x5867c0='1';_0x7c81e5=_0x2f59('0x7');break;case 0x2:logger[_0x2f59('0x6')](_0x2f59('0x1e'));_0x5867c0='2';_0x7c81e5=_0x2f59('0x1e');break;case 0x9:logger[_0x2f59('0x6')](_0x2f59('0x1f'));_0x5867c0='9';_0x7c81e5=_0x2f59('0x1f');break;case 0xa:logger[_0x2f59('0x6')](_0x2f59('0x20'));_0x5867c0='10';_0x7c81e5=_0x2f59('0x20');break;case 0xb:logger['info'](_0x2f59('0x21'));_0x5867c0='11';_0x7c81e5=_0x2f59('0x21');}}}catch(_0x206edc){logger[_0x2f59('0x13')](_0x2f59('0x22'),JSON['stringify'](_0x206edc));_0x1a7ecc[_0x2f59('0x15')]();}}function _0x1772e8(){logger['info'](_0x2f59('0x23'));_0x3cb9a2({'transcript':_0x100ea0,'confidence':_0x51cfc4,'status':_0x5867c0,'status_message':_0x7c81e5});}function _0x41ab2f(_0x26d9a6){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x2f59('0x24')](_0x26d9a6)){logger[_0x2f59('0x13')](_[_0x2f59('0x25')](_0x26d9a6)?JSON[_0x2f59('0x14')](_0x26d9a6):_0x26d9a6);}}_0x1a7ecc['on']('open',_0x148093);_0x1a7ecc['on']('message',_0x30f05a);_0x1a7ecc['on'](_0x2f59('0x11'),_0x1772e8);_0x1a7ecc['on']('error',_0x41ab2f);});}; \ 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 8508af6..c070118 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 _0x93c1=['./asr','exports'];(function(_0x3bab18,_0x53d735){var _0x12585f=function(_0x6cb5c4){while(--_0x6cb5c4){_0x3bab18['push'](_0x3bab18['shift']());}};_0x12585f(++_0x53d735);}(_0x93c1,0x1c4));var _0x193c=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x93c1[_0x102e37];return _0x35a07c;};var asr=require(_0x193c('0x0'));module[_0x193c('0x1')]={'asr':asr}; \ No newline at end of file +var _0xc15f=['exports'];(function(_0x28a9c4,_0x544707){var _0x1ccfe1=function(_0xd2533e){while(--_0xd2533e){_0x28a9c4['push'](_0x28a9c4['shift']());}};_0x1ccfe1(++_0x544707);}(_0xc15f,0x9c));var _0xfc15=function(_0x4c32f5,_0x3dbbf1){_0x4c32f5=_0x4c32f5-0x0;var _0x19cae9=_0xc15f[_0x4c32f5];return _0x19cae9;};var asr=require('./asr');module[_0xfc15('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 6e83c54..346da93 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x48a928,_0x430727){var _0x11c1e9=function(_0x338805){while(--_0x338805){_0x48a928['push'](_0x48a928['shift']());}};_0x11c1e9(++_0x430727);}(_0xe706,0xa3));var _0x6e70=function(_0x3ec0dd,_0x3a5e67){_0x3ec0dd=_0x3ec0dd-0x0;var _0x2818c7=_0xe706[_0x3ec0dd];return _0x2818c7;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +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(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'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 diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b43b081..b53a043 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 _0xc818=['no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariableById','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','then','dsn','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','googleCloudTTS','apiKey','text','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','stringify','split','replaceAll','getVariable','getAndSetVariable','result','extra','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','MRCPSynth','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','response','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','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','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured'];(function(_0x53bb90,_0x171d1c){var _0x361006=function(_0x422030){while(--_0x422030){_0x53bb90['push'](_0x53bb90['shift']());}};_0x361006(++_0x171d1c);}(_0xc818,0x1e3));var _0x8c81=function(_0x3f6408,_0x132511){_0x3f6408=_0x3f6408-0x0;var _0x37f707=_0xc818[_0x3f6408];return _0x37f707;};'use strict';var fs=require('fs');var util=require(_0x8c81('0x0'));var _=require(_0x8c81('0x1'));var sh=require(_0x8c81('0x2'));var odbc=require(_0x8c81('0x3'))();var rs=require('randomstring');var moment=require(_0x8c81('0x4'));var Mustache=require(_0x8c81('0x5'));var rp=require(_0x8c81('0x6'));var logger=require(_0x8c81('0x7'))(_0x8c81('0x8'));var config=require(_0x8c81('0x9'));var scripts=require(_0x8c81('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x8c81('0xb'),_0x8c81('0xc')];var verticesWithRetry=[_0x8c81('0xd'),_0x8c81('0xe'),'getsecretdigits'];var AGIVertices=function(_0x1173cf,_0x448af6,_0x186783){this[_0x8c81('0xf')]=_0x1173cf;this[_0x8c81('0x10')]=_0x448af6;this[_0x8c81('0x11')]=_0x186783;};AGIVertices[_0x8c81('0x12')]['getVariable']=function(_0x3de91f,_0x37dbb4){this[_0x8c81('0x10')][_0x8c81('0x13')](_0x3de91f)['then'](function(_0x5a2d9e){_0x37dbb4(null,_0x5a2d9e?_0x5a2d9e[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x31ff3f){_0x37dbb4(_0x31ff3f);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x16')]=function(_0x1b7b1b,_0xd04a1){this[_0x8c81('0x10')]['getVoiceQueueById'](_0x1b7b1b)['then'](function(_0x1db769){_0xd04a1(null,_0x1db769?_0x1db769[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x4fa5){_0xd04a1(_0x4fa5);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x17')]=function(_0x4f7180,_0x3683f0){this[_0x8c81('0x10')][_0x8c81('0x18')](_0x4f7180)[_0x8c81('0x19')](function(_0x17564e){_0x3683f0(null,_0x17564e?_0x17564e['name']:![]);})[_0x8c81('0x15')](function(_0x4d0b75){_0x3683f0(_0x4d0b75);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x216d29,_0x13e312){this[_0x8c81('0x10')]['getSquareOdbcById'](_0x216d29)[_0x8c81('0x19')](function(_0x2312d5){_0x13e312(null,_0x2312d5?_0x2312d5[_0x8c81('0x1a')]:![]);})['catch'](function(_0x261832){_0x13e312(_0x261832);});};AGIVertices[_0x8c81('0x12')]['getUser']=function(_0x35d61a,_0x31c4a2){this['rpc']['getUserById'](_0x35d61a)[_0x8c81('0x19')](function(_0x4f58ff){_0x31c4a2(null,_0x4f58ff?_0x4f58ff[_0x8c81('0x14')]:![]);})['catch'](function(_0x8c399c){_0x31c4a2(_0x8c399c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1b')]=function(_0xa0f0f7,_0x703dba){this[_0x8c81('0x10')][_0x8c81('0x1c')](_0xa0f0f7)[_0x8c81('0x19')](function(_0x4bfa48){_0x703dba(null,_0x4bfa48?_0x4bfa48['name']:![]);})[_0x8c81('0x15')](function(_0x1ee94c){_0x703dba(_0x1ee94c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1d')]=function(_0x3e5ed1,_0x1f9608){var _0x2e7ba2=this;this[_0x8c81('0x10')][_0x8c81('0x1e')](_0x3e5ed1)[_0x8c81('0x19')](function(_0x477a9e){_0x1f9608(null,_0x477a9e?_0x2e7ba2[_0x8c81('0x1f')](_0x477a9e[_0x8c81('0x20')]):![]);})['catch'](function(_0x1d73ac){_0x1f9608(_0x1d73ac);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x21')]=function(_0x29a52c,_0x428aba){this[_0x8c81('0x10')][_0x8c81('0x22')](_0x29a52c)[_0x8c81('0x19')](function(_0x2f419f){_0x428aba(null,_0x2f419f?_0x2f419f:![]);})['catch'](function(_0x2358be){_0x428aba(_0x2358be);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x23')]=function(_0x25654d,_0x1d931f,_0x551f0b){this[_0x8c81('0x11')][_0x8c81('0x23')](_0x25654d,_0x1d931f)[_0x8c81('0x19')](function(){_0x551f0b(null);})[_0x8c81('0x15')](function(_0x267c01){_0x551f0b(_0x267c01);});};AGIVertices['prototype']['getIntervals']=function(_0x1da1f1,_0x45e7fc){this[_0x8c81('0x10')]['getIntervalById'](_0x1da1f1)[_0x8c81('0x19')](function(_0x30b2a1){if(_0x30b2a1){if(_0x30b2a1[_0x8c81('0x24')]){_0x45e7fc(null,[_0x30b2a1[_0x8c81('0x25')]]);}else{_0x45e7fc(null,_['map'](_0x30b2a1[_0x8c81('0x26')],_0x8c81('0x25')));}}else{_0x45e7fc(null,![]);}})['catch'](function(_0x199478){_0x45e7fc(_0x199478);});};AGIVertices['prototype']['getSoundPath']=function(_0x3fc1c0){return util[_0x8c81('0x27')](_0x8c81('0x28'),FILES_PATH,_0x3fc1c0);};AGIVertices[_0x8c81('0x12')]['getQueryOdbc']=function(_0x30fa19,_0x252172,_0x3f14db){odbc['open'](_0x30fa19,function(_0x4c46dd){if(_0x4c46dd){logger[_0x8c81('0x29')](_0x8c81('0x2a'),_0x4c46dd);_0x3f14db(_0x4c46dd);}else{logger[_0x8c81('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x8c81('0x2c')](_0x252172,function(_0x5a30fa,_0x4ccca3){if(_0x5a30fa){logger['info'](_0x8c81('0x2d'),_0x252172);_0x3f14db(_0x5a30fa);}else{logger['info'](_0x8c81('0x2e'),_0x252172);odbc['close'](function(_0x4b2729){if(_0x4b2729){logger[_0x8c81('0x29')](_0x8c81('0x2f'),_0x4b2729);}_0x3f14db(null,_0x4ccca3);});}});}});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x30')]=function(_0x1e070d,_0x232ba7){this[_0x8c81('0x10')]['getSmsAccountById'](_0x1e070d)[_0x8c81('0x19')](function(_0x15e499){_0x232ba7(null,_0x15e499?_0x15e499:![]);})[_0x8c81('0x15')](function(_0x41f9d2){_0x232ba7(_0x41f9d2);});};AGIVertices[_0x8c81('0x12')]['createSmsMessage']=function(_0xc9dd61,_0x202f78){this[_0x8c81('0x10')][_0x8c81('0x31')](_0xc9dd61)[_0x8c81('0x19')](function(_0x2a2b97){_0x202f78(null,_0x2a2b97);})[_0x8c81('0x15')](function(_0x2c9085){_0x202f78(_0x2c9085);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x32')]=function(_0xae952a,_0xc7871,_0x5176d3){this['rpc'][_0x8c81('0x32')]({'uniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'node':_0xae952a[_0x8c81('0x34')],'application':_0xae952a[_0x8c81('0x35')],'data':_0xc7871||null,'project_name':this[_0x8c81('0xf')][_0x8c81('0x36')],'callerid':this['channel']['callerid']})[_0x8c81('0x19')](function(_0x2a8c67){if(_0x5176d3){_0x5176d3(null,_0x2a8c67);}})[_0x8c81('0x15')](function(_0x21891f){if(_0x5176d3){_0x5176d3(_0x21891f);}});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x37')]=function(_0x349a87,_0x55fe22,_0x41996c,_0xe20dad){this[_0x8c81('0x10')][_0x8c81('0x37')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x8c81('0xf')][_0x8c81('0x38')],'calleridname':this[_0x8c81('0xf')][_0x8c81('0x39')],'context':this[_0x8c81('0xf')][_0x8c81('0x3a')],'extension':this[_0x8c81('0xf')][_0x8c81('0x3b')],'priority':this[_0x8c81('0xf')][_0x8c81('0x3c')],'accountcode':this[_0x8c81('0xf')][_0x8c81('0x3d')],'dnid':this[_0x8c81('0xf')][_0x8c81('0x3e')],'projectName':this[_0x8c81('0xf')][_0x8c81('0x36')],'saveName':_0x55fe22,'filename':_0x349a87[_0x8c81('0x3f')]||_0x55fe22,'savePath':_0x41996c})[_0x8c81('0x19')](function(_0x39dbc8){_0xe20dad(null,_0x39dbc8);})[_0x8c81('0x15')](function(_0x16e822){_0xe20dad(_0x16e822);});};AGIVertices['prototype'][_0x8c81('0x40')]=function(_0x221f4f,_0x5c21f0,_0x18eb31,_0x1b928f,_0x38bb79){this['rpc'][_0x8c81('0x40')]({'uniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'body':_0x221f4f,'direction':_0x5c21f0,'providerName':_0x18eb31,'providerResponse':_0x1b928f})['then'](function(_0x51280e){if(_0x38bb79){_0x38bb79(null,_0x51280e);}})[_0x8c81('0x15')](function(_0x3f1d4c){if(_0x38bb79){_0x38bb79(_0x3f1d4c);}});};AGIVertices[_0x8c81('0x12')]['createCmContact']=function(_0x3c4f19,_0xc4fa7e){this[_0x8c81('0x10')][_0x8c81('0x41')]({'firstName':_[_0x8c81('0x42')](_0x3c4f19[_0x8c81('0x14')])||_[_0x8c81('0x43')](_0x3c4f19[_0x8c81('0x14')])?'callback_'+Math['random']():_0x3c4f19[_0x8c81('0x14')],'lastName':_[_0x8c81('0x42')](_0x3c4f19[_0x8c81('0x44')])||_[_0x8c81('0x43')](_0x3c4f19['lastName'])?null:_0x3c4f19[_0x8c81('0x44')],'phone':_0x3c4f19[_0x8c81('0x45')],'ListId':_0x3c4f19[_0x8c81('0x46')],'scheduledat':_0x3c4f19[_0x8c81('0x47')],'callbackUniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'tags':'callback','description':_0x8c81('0x48')+_0x3c4f19['scheduledAt'][_0x8c81('0x49')](),'priority':_0x3c4f19[_0x8c81('0x4a')]})[_0x8c81('0x19')](function(_0x5f39ff){_0xc4fa7e(null,_0x5f39ff);})['catch'](function(_0x30b694){_0xc4fa7e(_0x30b694);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x4b')]=function(_0x19d9bb,_0x3357ee){this[_0x8c81('0x10')][_0x8c81('0x4c')](_0x19d9bb)[_0x8c81('0x19')](function(_0x12ed28){_0x3357ee(null,_0x12ed28?_0x12ed28[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x30d6df){_0x3357ee(_0x30d6df);});};AGIVertices[_0x8c81('0x12')]['agentPause']=function(_0x11ef7a,_0x418977,_0x2a11d3){var _0x2bc8ab={'role':_0x8c81('0x4d')};_0x2bc8ab[_0x11ef7a]=this['channel'][_0x8c81('0x38')];this[_0x8c81('0x10')][_0x8c81('0x4e')](_0x2bc8ab,_0x418977,this[_0x8c81('0xf')][_0x8c81('0x33')])[_0x8c81('0x19')](function(_0x45f92e){_0x2a11d3(null,_[_0x8c81('0x43')](_0x45f92e)?![]:!![]);})['catch'](function(_0x28da6c){logger[_0x8c81('0x29')](_0x28da6c);_0x2a11d3(null,![]);});};AGIVertices[_0x8c81('0x12')]['agentUnpause']=function(_0x5b53f3,_0x4e7bb6){var _0x3d2d0e={'role':_0x8c81('0x4d')};_0x3d2d0e[_0x5b53f3]=this['channel'][_0x8c81('0x38')];this[_0x8c81('0x10')][_0x8c81('0x4f')](_0x3d2d0e)['then'](function(_0x59eaf1){_0x4e7bb6(null,_[_0x8c81('0x43')](_0x59eaf1)?![]:!![]);})[_0x8c81('0x15')](function(_0x111816){logger[_0x8c81('0x29')](_0x111816);_0x4e7bb6(null,![]);});};AGIVertices['prototype'][_0x8c81('0x50')]=function(_0x47ad6f,_0x3589d0){var _0x3deb72={'role':_0x8c81('0x4d')};_0x3deb72[_0x47ad6f]=this[_0x8c81('0xf')]['callerid'];this[_0x8c81('0x10')][_0x8c81('0x50')](_0x3deb72)[_0x8c81('0x19')](function(_0x306a66){_0x3589d0(null,_[_0x8c81('0x43')](_0x306a66)?![]:!![]);})[_0x8c81('0x15')](function(_0x2658e8){logger['error'](_0x2658e8);_0x3589d0(null,![]);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x51')]=function(_0x39c244,_0x36942e){var _0xa91282={'role':_0x8c81('0x4d')};_0xa91282[_0x39c244]=this[_0x8c81('0xf')]['callerid'];var _0x4e6168=_0x39c244!=_0x8c81('0x52')?util[_0x8c81('0x27')](_0x8c81('0x53'),'LOCAL',this[_0x8c81('0xf')][_0x8c81('0x38')]):undefined;this[_0x8c81('0x10')][_0x8c81('0x51')](_0xa91282,_0x4e6168)[_0x8c81('0x19')](function(_0x1a68e8){_0x36942e(null,_[_0x8c81('0x43')](_0x1a68e8)?![]:!![]);})['catch'](function(_0x2a6347){logger[_0x8c81('0x29')](_0x2a6347);_0x36942e(null,![]);});};AGIVertices['prototype'][_0x8c81('0x54')]=function(_0x4f5850,_0x40e5b5){sh[_0x8c81('0x55')](_['trim'](_0x4f5850),function(_0x2d3fa2,_0x40f800){var _0x1b435a=_0x40f800['replace'](/(\r\n|\n|\r)/gm,'');_0x40e5b5(null,_0x1b435a);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x56')]=function(_0x15e71a,_0x19426a){scripts[_0x8c81('0x56')](_0x15e71a[_0x8c81('0x57')],_0x15e71a['google_cloud_tts_text_type']||'text',_0x15e71a[_0x8c81('0x58')],_0x15e71a['languageCode']||'en-US',_0x15e71a[_0x8c81('0x59')]||_0x8c81('0x5a'),_0x15e71a[_0x8c81('0x5b')]||_0x8c81('0x5c'))[_0x8c81('0x19')](function(_0x3984a4){_0x19426a(null,_0x3984a4);})[_0x8c81('0x15')](function(_0x575764){_0x19426a(_0x575764);});};AGIVertices['prototype'][_0x8c81('0x5d')]=function(_0x512e3a,_0x5762db){scripts[_0x8c81('0x5d')](_0x512e3a[_0x8c81('0x58')],_0x512e3a[_0x8c81('0x5e')]||'en',0x1)[_0x8c81('0x19')](function(_0x9728e4){_0x5762db(null,_0x9728e4);})['catch'](function(_0x374795){_0x5762db(_0x374795);});};AGIVertices['prototype'][_0x8c81('0x5f')]=function(_0x22a4aa,_0x198c48){var _0x2e1962={'uri':_0x22a4aa[_0x8c81('0x60')],'method':_0x22a4aa['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x22a4aa[_0x8c81('0x61')])===_0x8c81('0x62')&&parseInt(_0x22a4aa[_0x8c81('0x61')])>=0x1?parseInt(_0x22a4aa[_0x8c81('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x8c81('0x63')]([_0x8c81('0x64'),'PUT'],_0x2e1962[_0x8c81('0x65')][_0x8c81('0x66')]())){try{_0x2e1962[_0x8c81('0x67')]=_0x22a4aa[_0x8c81('0xc')]?JSON[_0x8c81('0x68')](_0x22a4aa[_0x8c81('0xc')]):{};}catch(_0x866adb){logger[_0x8c81('0x29')](_0x8c81('0x69'),_0x866adb);}}try{_0x2e1962[_0x8c81('0x6a')]=_0x22a4aa[_0x8c81('0xb')]?JSON[_0x8c81('0x68')](_0x22a4aa[_0x8c81('0xb')]):{};}catch(_0x23b9f6){logger[_0x8c81('0x29')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x23b9f6);}if(_0x22a4aa[_0x8c81('0x6b')]){try{var _0x417163=require(_0x22a4aa[_0x8c81('0x6b')])[_0x8c81('0x6c')](this,_0x2e1962);_0x2e1962[_0x8c81('0x6d')]=Mustache[_0x8c81('0x6e')](_0x22a4aa['url'],_0x417163,{},['$$','$$']);if(_0x2e1962[_0x8c81('0x6a')]){_0x2e1962[_0x8c81('0x6a')]=JSON['parse'](Mustache[_0x8c81('0x6e')](JSON['stringify'](_0x2e1962[_0x8c81('0x6a')]),_0x417163,{},['$$','$$']));}if(_0x2e1962[_0x8c81('0x67')]){_0x2e1962['body']=JSON[_0x8c81('0x68')](Mustache[_0x8c81('0x6e')](JSON['stringify'](_0x2e1962['body']),_0x417163,{},['$$','$$']));}}catch(_0x9ba52e){logger['error'](_0x8c81('0x6f'),_0x9ba52e);}}rp(_0x2e1962)[_0x8c81('0x19')](function(_0x20df01){var _0x2374a2={'statusCode':_0x20df01[_0x8c81('0x70')]||0xc8,'statusMessage':_0x20df01['statusMessage']||'OK','headers':_0x20df01['headers']||{},'body':_0x20df01[_0x8c81('0x67')]||{}};_0x198c48(null,_0x2374a2);})[_0x8c81('0x15')](function(_0x4aeafe){var _0x58de6a={'statusCode':_0x4aeafe[_0x8c81('0x70')]||0x1f4,'statusMessage':_0x4aeafe['message']||_0x8c81('0x71'),'headers':_0x4aeafe[_0x8c81('0x72')][_0x8c81('0x6a')]||{},'body':_0x4aeafe[_0x8c81('0x72')]['body']||{}};_0x198c48(null,_0x58de6a);});};AGIVertices['prototype']['googleDialogflow']=function(_0xd39626,_0xc2828f){scripts[_0x8c81('0x73')](this[_0x8c81('0xf')][_0x8c81('0x33')],_0xd39626[_0x8c81('0x74')],_0xd39626[_0x8c81('0x58')],_0xd39626['dialogflow_language']||'en')[_0x8c81('0x19')](function(_0x5e3d40){_0xc2828f(null,_0x5e3d40);})['catch'](function(_0x31a3aa){_0xc2828f(_0x31a3aa);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x75')]=function(_0xa0c66e,_0x102d54){scripts['googleDialogflowV2'](this['channel'][_0x8c81('0x33')],_0xa0c66e[_0x8c81('0x76')],_0xa0c66e[_0x8c81('0x77')],_0xa0c66e[_0x8c81('0x78')],_0xa0c66e['text'],_0xa0c66e[_0x8c81('0x79')]||'en')[_0x8c81('0x19')](function(_0x2df0fa){_0x102d54(null,_0x2df0fa);})[_0x8c81('0x15')](function(_0x1d8e1c){_0x102d54(_0x1d8e1c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7a')]=function(_0x1fa933,_0x1936df){scripts[_0x8c81('0x7a')](this[_0x8c81('0xf')],_0x1fa933)[_0x8c81('0x19')](function(_0x3f1dab){_0x1936df(null,_0x3f1dab);})['catch'](function(_0x39a84f){_0x1936df(_0x39a84f);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7b')]=function(_0x27b542,_0x2a4815){scripts[_0x8c81('0x7b')](_0x27b542[_0x8c81('0x74')],_0x27b542[_0x8c81('0x58')],_0x27b542[_0x8c81('0x7c')]||'en-US',_0x27b542[_0x8c81('0x7d')])[_0x8c81('0x19')](function(_0x376b7d){_0x2a4815(null,_0x376b7d);})[_0x8c81('0x15')](function(_0x18ad13){_0x2a4815(_0x18ad13);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7e')]=function(_0x3183e6,_0x151a69,_0x457e00){scripts[_0x8c81('0x7e')](_0x151a69,_0x3183e6[_0x8c81('0x74')],_0x3183e6[_0x8c81('0x7f')]||_0x8c81('0x80'),this[_0x8c81('0x81')](_0x3183e6[_0x8c81('0x82')])?_0x3183e6[_0x8c81('0x82')]:undefined)[_0x8c81('0x19')](function(_0x2b1832){_0x457e00(null,_0x2b1832);})[_0x8c81('0x15')](function(_0x1db93c){_0x457e00(_0x1db93c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x83')]=function(_0x1108e6,_0x184a0b){scripts[_0x8c81('0x83')](_0x1108e6['aws_access_key_id'],_0x1108e6[_0x8c81('0x84')],_0x1108e6[_0x8c81('0x85')],_0x1108e6[_0x8c81('0x86')]||_0x8c81('0x87'),_0x1108e6[_0x8c81('0x58')],_0x1108e6[_0x8c81('0x88')]||_0x8c81('0x58'))[_0x8c81('0x19')](function(_0x12d591){_0x184a0b(null,_0x12d591);})[_0x8c81('0x15')](function(_0x3ad4d5){_0x184a0b(_0x3ad4d5);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x89')]=function(_0x23b7c4,_0x37220e){scripts[_0x8c81('0x89')](this[_0x8c81('0xf')][_0x8c81('0x33')],_0x23b7c4[_0x8c81('0x8a')],_0x23b7c4[_0x8c81('0x84')],_0x23b7c4[_0x8c81('0x8b')],_0x23b7c4[_0x8c81('0x58')],_0x23b7c4[_0x8c81('0x8c')])[_0x8c81('0x19')](function(_0x4e1e9d){_0x37220e(null,_0x4e1e9d);})[_0x8c81('0x15')](function(_0x4f9318){_0x37220e(_0x4f9318);});};AGIVertices[_0x8c81('0x12')]['googleASR']=function(_0x47da0c,_0x58a9e7,_0x148ac4){scripts[_0x8c81('0x8d')](_0x58a9e7,_0x47da0c[_0x8c81('0x74')],_0x47da0c[_0x8c81('0x8e')]||_0x8c81('0x80'))[_0x8c81('0x19')](function(_0x288981){_0x148ac4(null,_0x288981);})[_0x8c81('0x15')](function(_0x221988){_0x148ac4(_0x221988);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x8f')]=function(_0x20fdaf,_0x33f9a9,_0x4a19c4){scripts[_0x8c81('0x8f')](_0x33f9a9,_0x20fdaf[_0x8c81('0x90')],_0x20fdaf['appsecret'],_0x20fdaf[_0x8c81('0x6d')])[_0x8c81('0x19')](function(_0x353606){_0x4a19c4(null,_0x353606);})[_0x8c81('0x15')](function(_0x1224af){_0x4a19c4(_0x1224af);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x91')]=function(_0x4afc4b){var _0x2b8b52=_['includes'](verticesWithRetry,_0x4afc4b['agicommand'])?_0x4afc4b:_[_0x8c81('0x92')](_0x4afc4b);for(var _0x23ea3e in _0x2b8b52){if(_0x2b8b52[_0x8c81('0x93')](_0x23ea3e)){if(_0x2b8b52[_0x23ea3e]&&_['isString'](_0x2b8b52[_0x23ea3e])){if(_[_0x8c81('0x63')](recursiveMapAttributes,_0x23ea3e)){_0x2b8b52[_0x23ea3e]=this[_0x8c81('0x94')](_0x2b8b52[_0x23ea3e]);}else{_0x2b8b52[_0x23ea3e]=this[_0x8c81('0x95')](_0x2b8b52[_0x23ea3e]);}}}}return _0x2b8b52;};AGIVertices[_0x8c81('0x12')][_0x8c81('0x96')]=function(_0xfdc1a2){for(var _0x319fd8 in _0xfdc1a2){if(_0xfdc1a2['hasOwnProperty'](_0x319fd8)){if(_[_0x8c81('0x97')](_0xfdc1a2[_0x319fd8])){this[_0x8c81('0x96')](_0xfdc1a2[_0x319fd8]);}else if(_[_0x8c81('0x98')](_0xfdc1a2[_0x319fd8])){for(var _0x16a5c4=0x0;_0x16a5c4<_0xfdc1a2[_0x319fd8][_0x8c81('0x99')];_0x16a5c4++){this[_0x8c81('0x96')](_0xfdc1a2[_0x319fd8][_0x16a5c4]);}}else if(_['isString'](_0xfdc1a2[_0x319fd8])){_0xfdc1a2[_0x319fd8]=this[_0x8c81('0x95')](_0xfdc1a2[_0x319fd8]);}}}};AGIVertices['prototype'][_0x8c81('0x9a')]=function(_0x19324a,_0x13b30d){for(var _0x22c0fe in _0x19324a){if(_0x19324a[_0x8c81('0x93')](_0x22c0fe)){if(_[_0x8c81('0x97')](_0x19324a[_0x22c0fe])){if(!_[_0x8c81('0x42')](_0x19324a[_0x22c0fe])){this[_0x8c81('0x9a')](_0x19324a[_0x22c0fe],util[_0x8c81('0x27')]('%s.%s',_0x13b30d,_0x22c0fe));}}else if(_[_0x8c81('0x98')](_0x19324a[_0x22c0fe])){for(var _0x47851a=0x0;_0x47851a<_0x19324a[_0x22c0fe]['length'];_0x47851a++){this['saveRestApiResult'](_0x19324a[_0x22c0fe][_0x47851a],util[_0x8c81('0x27')](_0x8c81('0x9b'),_0x13b30d,_0x22c0fe+'['+_0x47851a+']'));}}else{if(!_['isNil'](_0x19324a[_0x22c0fe])){this[_0x8c81('0xf')][_0x8c81('0x9c')](util['format'](_0x8c81('0x9b'),_0x13b30d,_0x22c0fe),_0x19324a[_0x22c0fe]);}}}}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x94')]=function(_0x23dcc3){try{var _0x43c3eb=JSON['parse'](_0x23dcc3);this[_0x8c81('0x96')](_0x43c3eb);return JSON[_0x8c81('0x9d')](_0x43c3eb);}catch(_0x2cc3ba){return this['replaceAllVariables'](_0x23dcc3);}};AGIVertices[_0x8c81('0x12')]['replaceAllVariables']=function(_0x24e269){var _0x20230b=_0x24e269[_0x8c81('0x9e')]('{');for(var _0x3f154f=0x1;_0x3f154f<_0x20230b[_0x8c81('0x99')];_0x3f154f+=0x1){var _0x231516=_0x20230b[_0x3f154f][_0x8c81('0x9e')]('}');if(_0x231516[_0x8c81('0x99')]>0x1){_0x24e269=_0x24e269[_0x8c81('0x9f')]('{'+_0x231516[0x0]+'}',this['channel'][_0x8c81('0xa0')](_0x231516[0x0])['extra']||_0x231516[0x0]);}}if(_0x20230b['length']===0x1){return _0x24e269['toString']();}return this[_0x8c81('0x95')](_0x24e269);};AGIVertices['prototype'][_0x8c81('0xa1')]=function(_0x3c7302,_0x2cb331){var _0x534965=this[_0x8c81('0xf')]['getVariable'](_0x3c7302);if(_0x534965[_0x8c81('0xa2')]===-0x1){return _0x534965;}logger[_0x8c81('0x2b')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2cb331,_0x534965[_0x8c81('0xa3')]));return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x2cb331,_0x534965[_0x8c81('0xa3')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x81')]=function(_0x28aa15){return _0x28aa15&&_0x28aa15!=='0'&&_0x28aa15!=='-1'&&_0x28aa15!=='';};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa4')]=function(_0x4f0f00){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4f0f00,'-');_0x4f0f00['retry']=_0x4f0f00[_0x8c81('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x4291f8){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xa5'),_0x4291f8[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x4291f8[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}var _0x4adeb1='\x22'+_0x4291f8['text']+'\x22';if(this['isConfigured'](_0x4291f8[_0x8c81('0x72')])){_0x4adeb1+=','+_0x4291f8[_0x8c81('0x72')];}var _0x5d0e21=this[_0x8c81('0xf')][_0x8c81('0x55')]('MRCPSynth',_0x4adeb1);if(_0x5d0e21[_0x8c81('0xa2')]===-0x1){return _0x5d0e21;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xa8'),_0x4adeb1));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa9')]=function(_0x7c5c5){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xaa'),_0x7c5c5[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x7c5c5[_0x8c81('0xab')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20grammar\x20configured');}var _0x1b51f8=_0x7c5c5[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x7c5c5[_0x8c81('0x72')])){_0x1b51f8+=','+_0x7c5c5[_0x8c81('0x72')];}var _0xecf47b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xac'),_0x1b51f8);if(_0xecf47b[_0x8c81('0xa2')]===-0x1){return _0xecf47b;}var _0x5aa1bb=this[_0x8c81('0xa1')](_0x8c81('0xad'),_0x8c81('0xae'));if(_0x5aa1bb[_0x8c81('0xa2')]===-0x1){return _0x5aa1bb;}var _0x4b35f3=this[_0x8c81('0xa1')](_0x8c81('0xaf'),_0x8c81('0xb0'));if(_0x4b35f3[_0x8c81('0xa2')]===-0x1){return _0x4b35f3;}var _0x3de2c6=this[_0x8c81('0xa1')](_0x8c81('0xb1'),'MRCP_RECOG_INSTANCE');if(_0x3de2c6[_0x8c81('0xa2')]===-0x1){return _0x3de2c6;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xb2'),_0x1b51f8));};AGIVertices['prototype'][_0x8c81('0x8')]=function(_0x57f14c){logger['info'](util['format'](_0x8c81('0xb3'),_0x57f14c['label']));return this[_0x8c81('0xf')][_0x8c81('0x8')]([_0x57f14c[_0x8c81('0xb4')],_0x57f14c[_0x8c81('0xb5')]]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0xb6')]=function(_0x581a09){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xb7'),_0x581a09['label']));if(this[_0x8c81('0x81')](_0x581a09[_0x8c81('0x61')])){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xb8'),_0x581a09[_0x8c81('0x61')]));var _0x4a1ea1=this[_0x8c81('0xf')]['wait'](_0x581a09[_0x8c81('0x61')]);if(_0x4a1ea1[_0x8c81('0xa2')]===-0x1){return _0x4a1ea1;}}return this[_0x8c81('0xf')][_0x8c81('0xb6')]();};AGIVertices['prototype']['callback']=function(_0x544990){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xb9'),_0x544990[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x544990[_0x8c81('0x46')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x544990,_0x8c81('0xba'));}_0x544990['scheduledAt']=moment();if(this[_0x8c81('0x81')](_0x544990[_0x8c81('0xbb')])){_0x544990['scheduledAt']=moment()[_0x8c81('0xbc')](_0x544990['delay'],_0x8c81('0xbd'));}if(!this[_0x8c81('0x81')](_0x544990[_0x8c81('0x4a')])){_0x544990[_0x8c81('0x4a')]=0x2;}this['createCmContact']['sync'](this,_0x544990);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x544990[_0x8c81('0x45')],_0x544990[_0x8c81('0x46')],_0x544990[_0x8c81('0x47')]));};AGIVertices[_0x8c81('0x12')]['custom_app']=function(_0x19f29e){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xbe'),_0x19f29e[_0x8c81('0x34')]));var _0x24b481=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x19f29e[_0x8c81('0xbf')],_0x19f29e[_0x8c81('0x72')]);if(_0x24b481[_0x8c81('0xa2')]===-0x1){return _0x24b481;}return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x19f29e['application'],_0x19f29e[_0x8c81('0x72')]));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc1')]=function(_0x1bcb85){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1bcb85[_0x8c81('0x34')]));if(!this['isConfigured'](_0x1bcb85[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}var _0x38e4a1='\x22'+_0x1bcb85[_0x8c81('0x58')]+'\x22';if(this[_0x8c81('0x81')](_0x1bcb85[_0x8c81('0x72')])){_0x38e4a1+=','+_0x1bcb85[_0x8c81('0x72')];}var _0x25728b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xc2'),_0x38e4a1);if(_0x25728b['result']===-0x1){return _0x25728b;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xa8'),_0x38e4a1));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc3')]=function(_0x321819){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x321819[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x321819['text'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xa7'));}var _0x4f1880='\x22'+_0x321819['text']+'\x22';if(this[_0x8c81('0x81')](_0x321819[_0x8c81('0x72')])){_0x4f1880+=','+_0x321819['options'];}var _0x7eec41=this[_0x8c81('0xf')]['exec'](_0x8c81('0xc2'),_0x4f1880);if(_0x7eec41['result']===-0x1){return _0x7eec41;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4f1880));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc4')]=function(_0x65e0fa){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0xc5'),_0x65e0fa[_0x8c81('0x34')]));if(!this['isConfigured'](_0x65e0fa['grammar'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xc6'));}var _0xd80cc0=_0x65e0fa[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x65e0fa[_0x8c81('0x72')])){_0xd80cc0+=','+_0x65e0fa[_0x8c81('0x72')];}var _0x30ce49=this['channel'][_0x8c81('0x55')](_0x8c81('0xac'),_0xd80cc0);if(_0x30ce49[_0x8c81('0xa2')]===-0x1){return _0x30ce49;}var _0x1f43ca=this[_0x8c81('0xa1')](_0x8c81('0xad'),'LUMENVOX_ASR_CONFIDENCE');if(_0x1f43ca[_0x8c81('0xa2')]===-0x1){return _0x1f43ca;}var _0x5a8c91=this[_0x8c81('0xa1')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5a8c91[_0x8c81('0xa2')]===-0x1){return _0x5a8c91;}var _0xb2544=this[_0x8c81('0xa1')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0xb2544[_0x8c81('0xa2')]===-0x1){return _0xb2544;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xd80cc0));};AGIVertices['prototype'][_0x8c81('0xc7')]=function(_0x5bce2b){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5bce2b['label']));if(!this[_0x8c81('0x81')](_0x5bce2b[_0x8c81('0xab')])){return this[_0x8c81('0xf')]['noop']('no\x20grammar\x20configured');}var _0x539443=_0x5bce2b[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x5bce2b[_0x8c81('0x72')])){_0x539443+=','+_0x5bce2b[_0x8c81('0x72')];}var _0x24f82e=this['channel'][_0x8c81('0x55')](_0x8c81('0xac'),_0x539443);if(_0x24f82e[_0x8c81('0xa2')]===-0x1){return _0x24f82e;}var _0x1eca51=this[_0x8c81('0xa1')]('RECOG_CONFIDENCE()',_0x8c81('0xc8'));if(_0x1eca51[_0x8c81('0xa2')]===-0x1){return _0x1eca51;}var _0x21ca21=this[_0x8c81('0xa1')](_0x8c81('0xaf'),_0x8c81('0xc9'));if(_0x21ca21[_0x8c81('0xa2')]===-0x1){return _0x21ca21;}var _0x29b7b8=this[_0x8c81('0xa1')](_0x8c81('0xb1'),_0x8c81('0xca'));if(_0x29b7b8[_0x8c81('0xa2')]===-0x1){return _0x29b7b8;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xb2'),_0x539443));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xcb')]=function(_0x45cb0a){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xcc'),_0x45cb0a[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x45cb0a['odbc_id'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xcd'));}var _0x1278f8=this[_0x8c81('0xce')][_0x8c81('0x6c')](this,_0x45cb0a[_0x8c81('0xcf')]);if(!_0x1278f8){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd0'));}if(!this['isConfigured'](_0x45cb0a[_0x8c81('0x2c')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd1'));}var _0x4f962b=_0x45cb0a[_0x8c81('0x2c')][_0x8c81('0xd2')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('query:\x20%s',_0x4f962b));var _0x973fbd=this[_0x8c81('0xd3')]['sync'](this,_0x1278f8,_0x4f962b);this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x45cb0a,_0x4f962b);if(!this['isConfigured'](_0x45cb0a[_0x8c81('0xd4')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xd5'));}var _0x4e7221=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x45cb0a['variable_id']);if(!_0x4e7221){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd6'));}var _0x31c1f9=this;_0x973fbd[_0x8c81('0xd7')](function(_0x5185b2,_0x3f4d52){Object[_0x8c81('0xd8')](_0x5185b2)[_0x8c81('0xd7')](function(_0x4d6c68){_0x31c1f9[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')]('%s[%s][%s]',_0x4e7221,_0x3f4d52,_0x4d6c68),_0x5185b2[_0x4d6c68]);});});this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0xd9'),_0x4e7221),_0x973fbd[_0x8c81('0x99')]);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xda'),_0x4e7221));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xdb')]=function(_0x1cdd2d){logger[_0x8c81('0xdc')](util[_0x8c81('0x27')](_0x8c81('0xdd'),_0x1cdd2d[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x1cdd2d[_0x8c81('0xde')])){return this['channel'][_0x8c81('0x29')](_0x1cdd2d,_0x8c81('0xdf'));}var _0x58543d=this[_0x8c81('0xe0')][_0x8c81('0x6c')](this,_0x1cdd2d[_0x8c81('0xde')]);if(!_0x58543d){return this['channel'][_0x8c81('0x29')](_0x1cdd2d,_0x8c81('0xe1'));}var _0x5e589b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xe2'),[util[_0x8c81('0x27')](_0x8c81('0xe3'),_0x58543d),_0x1cdd2d[_0x8c81('0x61')],_0x1cdd2d[_0x8c81('0xe4')],_0x1cdd2d[_0x8c81('0x60')]]);if(_0x5e589b[_0x8c81('0xa2')]===-0x1){return _0x5e589b;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xe5'),'DIAL'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xe6')]=function(_0x1d5121){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0xe7'),_0x1d5121['label']));if(!this['isConfigured'](_0x1d5121[_0x8c81('0x74')])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xe8'));}if(!this[_0x8c81('0x81')](_0x1d5121[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20text\x20configured');}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x1d5121);this[_0x8c81('0x40')](_0x1d5121[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0xea'),_0x1d5121[_0x8c81('0x58')]));var _0x24166d=this[_0x8c81('0x73')][_0x8c81('0x6c')](this,_0x1d5121);if(_0x24166d){for(var _0x1ef06c in _0x24166d){if(_0x24166d[_0x8c81('0x93')](_0x1ef06c)){this['channel'][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0xeb'),_0x1ef06c[_0x8c81('0x66')]()),_0x24166d[_0x1ef06c]);}}this[_0x8c81('0x40')](_0x24166d[_0x8c81('0xec')],_0x8c81('0xed'),_0x8c81('0xe6'),'');return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xee'),_0x24166d[_0x8c81('0xec')]));}return this['channel'][_0x8c81('0x29')](_0x1d5121,_0x8c81('0xef'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xf0')]=function(_0x52b2be){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xf1'),_0x52b2be[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x76')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf2'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x77')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf3'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x78')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xf4'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x79')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf5'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20text\x20configured');}this['channel'][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x52b2be);this[_0x8c81('0x40')](_0x52b2be[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xf6'),_0x52b2be[_0x8c81('0x58')]));var _0x3243fe=this['googleDialogflowV2'][_0x8c81('0x6c')](this,_0x52b2be);if(_0x3243fe){for(var _0x3fabfa in _0x3243fe){if(_0x3243fe[_0x8c81('0x93')](_0x3fabfa)){if(_0x3fabfa!=='providerResponse'){this[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')](_0x8c81('0xeb'),_0x3fabfa[_0x8c81('0x66')]()),_0x3243fe[_0x3fabfa]);}}}this['createSquareMessage'](_0x3243fe[_0x8c81('0xec')],_0x8c81('0xed'),_0x8c81('0xf0'),_0x3243fe[_0x8c81('0xf7')]);return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xf8'),_0x3243fe['speech']));}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x52b2be,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')][_0x8c81('0xf9')]=function(_0x262d55){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xfa'),_0x262d55['label']));if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xfb')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x8c81('0x81')](_0x262d55['username'])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xfc'));}if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xfd')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xfe'));}if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xff')])){return this['channel'][_0x8c81('0xa6')]('no\x20text\x20configured');}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x262d55);this[_0x8c81('0x40')](_0x262d55[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x100'),_0x262d55['text']));var _0xd5c5e6=this[_0x8c81('0x7a')]['sync'](this,_0x262d55);if(_0xd5c5e6){for(var _0x4af755 in _0xd5c5e6){if(_0xd5c5e6[_0x8c81('0x93')](_0x4af755)){this[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')](_0x8c81('0x101'),_0x4af755[_0x8c81('0x66')]()),_0xd5c5e6[_0x4af755]);}}this['createSquareMessage'](_0xd5c5e6[_0x8c81('0xec')],'out',_0x8c81('0xf9'),'');if(_0xd5c5e6[_0x8c81('0x102')]){this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0xd5c5e6[_0x8c81('0x102')]));var _0x407995=this[_0x8c81('0xf')][_0x8c81('0x103')](_0xd5c5e6[_0x8c81('0x102')]);try{fs[_0x8c81('0x104')](_0xd5c5e6[_0x8c81('0x102')]+'.wav');}catch(_0x4be698){logger['error'](_0x4be698);}return _0x407995;}else{return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x105'),_0xd5c5e6[_0x8c81('0xec')]));}}return this[_0x8c81('0xf')]['error'](_0x262d55,_0x8c81('0x106'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x107')]=function(_0x4af7d8){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x108'),_0x4af7d8[_0x8c81('0x34')]));return this[_0x8c81('0xf')]['noop'](_0x8c81('0x107'));};AGIVertices[_0x8c81('0x12')]['ext_dial']=function(_0x41ba3c){logger['info'](util['format'](_0x8c81('0x109'),_0x41ba3c[_0x8c81('0x34')]));var _0xe364d1='';if(_0x41ba3c[_0x8c81('0x10a')]){if(!this[_0x8c81('0x81')](_0x41ba3c[_0x8c81('0x10a')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10b'));}else{var _0x28d85c=parseInt(_0x41ba3c[_0x8c81('0x10a')],0xa);if(isNaN(_0x28d85c)){_0xe364d1=_0x41ba3c[_0x8c81('0x10a')];}else{_0xe364d1=this['getTrunk']['sync'](this,_0x41ba3c[_0x8c81('0x10a')]);if(!_0xe364d1){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10c'));}}}}else if(_0x41ba3c[_0x8c81('0x10d')]){_0xe364d1=_0x41ba3c['trunk_name'];}else{return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10b'));}var _0x3636ce=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xe2'),[util[_0x8c81('0x27')](_0x8c81('0x10e'),_0xe364d1,_0x41ba3c['phone']),_0x41ba3c[_0x8c81('0x61')],_0x41ba3c[_0x8c81('0xe4')],_0x41ba3c[_0x8c81('0x60')]]);if(_0x3636ce[_0x8c81('0xa2')]===-0x1){return _0x3636ce;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Executed\x20command\x20%s',_0x8c81('0xe2')));};AGIVertices['prototype']['finally']=function(_0x53a6f6){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x53a6f6[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0xa6')]('finally');};AGIVertices[_0x8c81('0x12')][_0x8c81('0xe')]=function(_0x3459a1){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x10f'),_0x3459a1[_0x8c81('0x34')]));if(_0x3459a1['retry']===0x0){return this['maxRetry'](_0x3459a1);}_0x3459a1[_0x8c81('0x110')]-=0x1;if(!this[_0x8c81('0x81')](_0x3459a1['file_id'])){return this['channel'][_0x8c81('0x29')](_0x3459a1,_0x8c81('0x111'));}var _0x33f865=this['getSound']['sync'](this,_0x3459a1[_0x8c81('0x112')]);if(!_0x33f865){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x3459a1,'no\x20file\x20audio\x20found');}if(!this[_0x8c81('0x81')](_0x3459a1[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x8c81('0xd5'));}var _0x1fa6a3=this[_0x8c81('0xf')]['getData'](_0x33f865,_0x3459a1[_0x8c81('0x113')],_0x3459a1['maxdigit']);var _0x263bfb=_0x1fa6a3['result']?_0x1fa6a3[_0x8c81('0xa2')][_0x8c81('0x49')]():'';logger[_0x8c81('0x2b')](_0x8c81('0x114'),JSON[_0x8c81('0x9d')](_0x1fa6a3));if(_0x1fa6a3[_0x8c81('0xa2')]===-0x1){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,_0x263bfb);return _0x1fa6a3;}else if(_0x1fa6a3[_0x8c81('0xa3')]===_0x8c81('0x61')){_0x1fa6a3[_0x8c81('0xa2')]=_0x263bfb[_0x8c81('0x99')]>=parseInt(_0x3459a1['mindigit'])?'x':'i';}else{_0x1fa6a3[_0x8c81('0xa2')]=_0x263bfb[_0x8c81('0x99')]>=parseInt(_0x3459a1[_0x8c81('0x115')])&&_0x263bfb[_0x8c81('0x99')]<=parseInt(_0x3459a1['maxdigit'])?'x':'i';}var _0x5587df=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x3459a1[_0x8c81('0xd4')]);if(!_0x5587df){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x3459a1,_0x8c81('0xd6'));}this[_0x8c81('0xf')]['setVariable'](_0x5587df,_0x263bfb);if(this[_0x8c81('0x81')](_0x3459a1['hiddendigitsnum'])){var _0xd71cc4=parseInt(_0x3459a1[_0x8c81('0x116')],0xa);var _0x2a7a39=rs[_0x8c81('0x117')]({'charset':'*','length':_0xd71cc4});var _0x27b0e6=_0x263bfb['length'];if(_0x27b0e6>0x0){if(_0x27b0e6>_0xd71cc4){this['createSquareDetailsReport'][_0x8c81('0x6c')](this,_0x3459a1,_0x3459a1[_0x8c81('0x118')]==='first'?_0x2a7a39+_0x263bfb[_0x8c81('0x119')](_0xd71cc4):_0x263bfb[_0x8c81('0x119')](0x0,_0x27b0e6-_0xd71cc4)+_0x2a7a39);}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,rs[_0x8c81('0x117')]({'charset':'*','length':_0x27b0e6}));}}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,'');}}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,_0x263bfb);}return _0x1fa6a3;};AGIVertices[_0x8c81('0x12')][_0x8c81('0x11a')]=function(_0x46ae88){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x11b'),_0x46ae88[_0x8c81('0x34')]));return this[_0x8c81('0xe')](_0x46ae88);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x11c')]=function(_0xbbeb50){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x11d'),_0xbbeb50[_0x8c81('0x34')]));this[_0x8c81('0x32')]['sync'](this,_0xbbeb50,_0xbbeb50['goalname']);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x11e'),_0xbbeb50[_0x8c81('0x11f')]));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x120')]=function(_0x46b98c){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x121'),_0x46b98c[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x8a')])||!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x84')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x122'));}if(!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x58')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x123'),_0x46b98c['text']));var _0x120fea=this['awsPolly'][_0x8c81('0x6c')](this,_0x46b98c);if(_0x120fea){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x124'),_0x120fea));var _0x236bb5=this[_0x8c81('0xf')][_0x8c81('0x103')](_0x120fea);try{fs[_0x8c81('0x104')](_0x120fea+_0x8c81('0x125'));}catch(_0x3a4f36){logger[_0x8c81('0x29')](_0x3a4f36);}return _0x236bb5;}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x46b98c,_0x8c81('0x126'));};AGIVertices[_0x8c81('0x12')]['awslex']=function(_0x2f1b04){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x127'),_0x2f1b04[_0x8c81('0x34')]));if(!this['isConfigured'](_0x2f1b04['aws_access_key_id'])||!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x84')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x8c')])){return this['channel']['noop'](_0x8c81('0x128'));}if(!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x58')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this['createSquareDetailsReport'](_0x2f1b04);this['createSquareMessage'](_0x2f1b04[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2f1b04['text']));var _0x449395=this[_0x8c81('0x89')][_0x8c81('0x6c')](this,_0x2f1b04);if(_0x449395){for(var _0x58daa6 in _0x449395){if(_0x449395['hasOwnProperty'](_0x58daa6)&&_['isString'](_0x449395[_0x58daa6])){this['channel'][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x129'),_0x58daa6[_0x8c81('0x66')]()),_0x449395[_0x58daa6]);}}if(_[_0x8c81('0x43')](_0x449395[_0x8c81('0x12a')])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0x12b'));}else{this['createSquareMessage'](_0x449395[_0x8c81('0x12a')],_0x8c81('0xed'),_0x8c81('0x12c'),'');return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x12d'),_0x449395['message']));}}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2f1b04,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')]['googleasr']=function(_0x6598f0){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x12e'),_0x6598f0[_0x8c81('0x34')],_0x6598f0[_0x8c81('0x61')]));if(!this['isConfigured'](_0x6598f0[_0x8c81('0x74')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xe8'));}var _0x280d0d=_0x8c81('0x12f');var _0x1c1896=util['format'](_0x8c81('0x130'),FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x360545=util['format'](_0x8c81('0x9b'),_0x1c1896,_0x280d0d);var _0xfb0b44=!![];if(_0x6598f0[_0x8c81('0x131')]==='NOBEEP'){_0xfb0b44=![];}var _0x4b9e5d=this[_0x8c81('0xf')][_0x8c81('0x132')](_0x1c1896,_0x280d0d,_0x6598f0[_0x8c81('0x133')],_0x6598f0[_0x8c81('0x61')],undefined,_0xfb0b44);if(_0x4b9e5d[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x134'),_0x360545));var _0x4bf5c6=this[_0x8c81('0x8d')][_0x8c81('0x6c')](this,_0x6598f0,_0x360545);if(_0x4bf5c6){for(var _0x1a7d63 in _0x4bf5c6){if(_0x4bf5c6[_0x8c81('0x93')](_0x1a7d63)){this['channel'][_0x8c81('0x9c')](util['format'](_0x8c81('0x135'),_0x1a7d63[_0x8c81('0x66')]()),_0x4bf5c6[_0x1a7d63]);}}return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x136'),JSON[_0x8c81('0x9d')](_0x4bf5c6)));}}return _0x4b9e5d;};AGIVertices['prototype'][_0x8c81('0x137')]=function(_0x20779f){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x138'),_0x20779f[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x20779f[_0x8c81('0x90')])){return this[_0x8c81('0xf')]['noop']('no\x20appid\x20configured');}if(!this[_0x8c81('0x81')](_0x20779f[_0x8c81('0x139')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20appsecret\x20configured');}var _0x598d66='wav';var _0x1b621c=util[_0x8c81('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x5a3734=util[_0x8c81('0x27')](_0x8c81('0x9b'),_0x1b621c,_0x598d66);var _0x40c6fa=!![];if(_0x20779f[_0x8c81('0x131')]===_0x8c81('0x13a')){_0x40c6fa=![];}var _0x52dbac=this[_0x8c81('0xf')][_0x8c81('0x132')](_0x1b621c,_0x598d66,_0x20779f[_0x8c81('0x133')],_0x20779f[_0x8c81('0x61')],undefined,_0x40c6fa);if(_0x52dbac[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x13b'),_0x5a3734));var _0x3bbea0=this[_0x8c81('0x8f')][_0x8c81('0x6c')](this,_0x20779f,_0x5a3734);if(_0x3bbea0){for(var _0x474dbb in _0x3bbea0){if(_0x3bbea0[_0x8c81('0x93')](_0x474dbb)){this[_0x8c81('0xf')][_0x8c81('0x9c')](util['format']('TILDE_ASR_%s',_0x474dbb[_0x8c81('0x66')]()),_0x3bbea0[_0x474dbb]);}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x13c'),JSON[_0x8c81('0x9d')](_0x3bbea0)));}}return _0x52dbac;};AGIVertices['prototype'][_0x8c81('0x13d')]=function(_0x22ce14){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x13e'),_0x22ce14[_0x8c81('0x34')]));return this['channel']['continueAt'](_0x22ce14[_0x8c81('0x3a')],_0x22ce14['extension'],_0x22ce14[_0x8c81('0x3c')]);};AGIVertices['prototype'][_0x8c81('0x13f')]=function(_0x50afad){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x140'),_0x50afad[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x50afad['condition'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x50afad,_0x8c81('0x141'));}try{var _0x5b79b9=eval(_0x50afad[_0x8c81('0x142')])?_0x8c81('0x143'):_0x8c81('0x144');this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x145'),_0x50afad[_0x8c81('0x142')],_0x5b79b9));return{'code':0xc8,'result':_0x5b79b9};}catch(_0x568d66){return{'code':0xc8,'result':_0x8c81('0x144')};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x146')]=function(_0x2b85fc){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x147'),_0x2b85fc[_0x8c81('0x34')]));if(!this['isConfigured'](_0x2b85fc[_0x8c81('0x148')])){return this['channel'][_0x8c81('0x29')](_0x2b85fc,_0x8c81('0x149'));}var _0x1d8f2c=this[_0x8c81('0x14a')][_0x8c81('0x6c')](this,_0x2b85fc[_0x8c81('0x148')]);if(!_0x1d8f2c){return this['channel']['error'](_0x2b85fc,'no\x20intervals\x20found');}for(var _0x53d4d7=0x0;_0x53d4d7<_0x1d8f2c[_0x8c81('0x99')];_0x53d4d7+=0x1){var _0x343b31=this[_0x8c81('0xf')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x1d8f2c[_0x53d4d7]));if(_0x343b31['result']===-0x1){return _0x343b31;}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x343b31[_0x8c81('0xa3')]));if(_0x343b31[_0x8c81('0xa3')]===_0x8c81('0x143')){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x8c81('0x143')));this[_0x8c81('0xf')]['noop'](util['format'](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x8c81('0x143')));return{'code':0xc8,'result':_0x8c81('0x143')};}else{logger['info'](util[_0x8c81('0x27')]('IFTIME\x20%s\x20%s',_0x1d8f2c[_0x53d4d7],_0x8c81('0x144')));this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],'false'));}}return{'code':0xc8,'result':_0x8c81('0x144')};};AGIVertices[_0x8c81('0x12')][_0x8c81('0x14c')]=function(_0x135af4){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14d'),_0x135af4[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0x14c')]();};AGIVertices[_0x8c81('0x12')][_0x8c81('0x14e')]=function(_0x49df03){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14f'),_0x49df03[_0x8c81('0x34')]));if(!this['isConfigured'](_0x49df03['key'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xe8'));}var _0x5f380b=_0x8c81('0x12f');var _0x43dd88=util['format'](_0x8c81('0x130'),FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x3dd6ed=util['format']('%s.%s',_0x43dd88,_0x5f380b);var _0x1df8af=!![];if(_0x49df03[_0x8c81('0x131')]===_0x8c81('0x13a')){_0x1df8af=![];}var _0x29148d=this['channel'][_0x8c81('0x132')](_0x43dd88,_0x5f380b,_0x49df03[_0x8c81('0x133')],_0x49df03['timeout'],undefined,_0x1df8af);if(_0x29148d[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x150'),_0x3dd6ed));var _0x2f91e7=this[_0x8c81('0x7e')][_0x8c81('0x6c')](this,_0x49df03,_0x3dd6ed);if(_0x2f91e7){for(var _0x8eb411 in _0x2f91e7){if(_0x2f91e7[_0x8c81('0x93')](_0x8eb411)){this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x151'),_0x8eb411[_0x8c81('0x66')]()),_0x2f91e7[_0x8eb411]);}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x152'),JSON['stringify'](_0x2f91e7)));}}return _0x29148d;};AGIVertices['prototype'][_0x8c81('0x153')]=function(_0xe87c0b){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x154'),_0xe87c0b[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xe87c0b[_0x8c81('0x74')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xe8'));}if(!this[_0x8c81('0x81')](_0xe87c0b['text'])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x155'),_0xe87c0b['text']));var _0xcc4bb1=this[_0x8c81('0x7b')][_0x8c81('0x6c')](this,_0xe87c0b);if(_0xcc4bb1){this['channel']['noop'](util[_0x8c81('0x27')](_0x8c81('0x150'),_0xcc4bb1));var _0x5955e3=this[_0x8c81('0xf')][_0x8c81('0x103')](_0xcc4bb1,_0xe87c0b[_0x8c81('0x133')]);try{fs['unlink'](_0xcc4bb1+_0x8c81('0x125'));}catch(_0x26d53d){logger[_0x8c81('0x29')](_0x26d53d);}return _0x5955e3;}return this['channel']['error'](_0xe87c0b,_0x8c81('0x156'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x157')]=function(_0x1cbe58){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1cbe58['label']));if(!this['isConfigured'](_0x1cbe58[_0x8c81('0x158')])){return this['channel'][_0x8c81('0x29')](_0x1cbe58,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')]['callerid'],_0x1cbe58[_0x8c81('0x158')]));var _0x1460c0=this[_0x8c81('0x51')]['sync'](this,_0x1cbe58[_0x8c81('0x158')]);if(_0x1460c0){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')]['callerid'],_0x1cbe58['findBy']));this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1cbe58[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1cbe58['findBy']));this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8c81('0x38')],_0x1cbe58['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x8c81('0x15d')]=function(_0x549874){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15e'),_0x549874['label']));if(!this[_0x8c81('0x81')](_0x549874['findBy'])){return this[_0x8c81('0xf')]['error'](_0x549874,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')]['callerid'],_0x549874['findBy']));var _0x5a046a=this[_0x8c81('0x50')][_0x8c81('0x6c')](this,_0x549874[_0x8c81('0x158')]);if(_0x5a046a){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));this['channel'][_0x8c81('0xa6')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0x549874[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x160')};}};AGIVertices[_0x8c81('0x12')]['math']=function(_0x18f4ff){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x161'),_0x18f4ff[_0x8c81('0x34')]));if(!this['isConfigured'](_0x18f4ff[_0x8c81('0x162')])){return this['channel'][_0x8c81('0x29')](_0x18f4ff,_0x8c81('0x163'));}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('math\x20%s',_0x18f4ff[_0x8c81('0x162')]));var _0x42fa37=eval(_0x18f4ff['operation']);if(!this[_0x8c81('0x81')](_0x18f4ff[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xd5'));}var _0x3e86af=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x18f4ff[_0x8c81('0xd4')]);if(!_0x3e86af){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x18f4ff,_0x8c81('0xd6'));}if(_[_0x8c81('0x98')](_0x42fa37)){var _0x3468ec=this;_0x42fa37[_0x8c81('0xd7')](function(_0x45f996,_0x36f4dc){_0x3468ec[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')]('%s[%s]',_0x3e86af,_0x36f4dc),_0x45f996);});return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x164'),_0x3e86af));}else{return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x3e86af,_0x42fa37);}};AGIVertices[_0x8c81('0x12')][_0x8c81('0xd')]=function(_0x4516f1){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x165'),_0x4516f1[_0x8c81('0x34')]));if(_0x4516f1['retry']===0x0){return this[_0x8c81('0xa4')](_0x4516f1);}_0x4516f1['retry']-=0x1;if(!this['isConfigured'](_0x4516f1['file_id'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4516f1,_0x8c81('0x111'));}var _0x417cea=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0x4516f1[_0x8c81('0x112')]);if(!_0x417cea){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4516f1,_0x8c81('0x166'));}var _0x1292c2=this[_0x8c81('0xf')][_0x8c81('0x167')](_0x417cea,_0x4516f1[_0x8c81('0x113')],_0x4516f1['digit']);var _0x26624f=_0x1292c2[_0x8c81('0xa2')];if(_0x1292c2[_0x8c81('0xa2')]===-0x1){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4516f1,'-1');return _0x1292c2;}else if(_0x1292c2[_0x8c81('0xa3')]===_0x8c81('0x61')){_0x1292c2[_0x8c81('0xa2')]=_0x1292c2[_0x8c81('0xa2')][_0x8c81('0x99')]>0x0?_0x1292c2[_0x8c81('0xa2')]:'t';}else if(_['isEmpty'](_0x1292c2[_0x8c81('0xa2')])){_0x1292c2[_0x8c81('0xa2')]='#';_0x26624f='#';}if(!this['isConfigured'](_0x4516f1[_0x8c81('0xd4')])){this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x464a9c=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x4516f1[_0x8c81('0xd4')]);if(!_0x464a9c){return this['channel']['error'](_0x4516f1,'no\x20variable\x20found');}this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x464a9c,_0x26624f);}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4516f1,_0x26624f);return _0x1292c2;};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa6')]=function(_0x5a6894){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5a6894[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x5a6894[_0x8c81('0x168')]||_0x5a6894[_0x8c81('0x34')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x169')]=function(_0x1d4394){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x16a'),_0x1d4394[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x1d4394[_0x8c81('0x158')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x1d4394,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394[_0x8c81('0x158')]));var _0x5ac59a=this[_0x8c81('0x4b')]['sync'](this,_0x1d4394[_0x8c81('0x16b')]);var _0xd2e897=this[_0x8c81('0x4e')][_0x8c81('0x6c')](this,_0x1d4394['findBy'],_0x5ac59a);if(_0xd2e897){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')]['callerid'],_0x1d4394[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0x1d4394['findBy']));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394['findBy']));return{'code':0xc8,'result':_0x8c81('0x160')};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x16c')]=function(_0x357694){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x16d'),_0x357694[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x357694[_0x8c81('0x112')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x357694,_0x8c81('0x111'));}var _0x180bd2=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0x357694[_0x8c81('0x112')]);if(!_0x180bd2){return this['channel'][_0x8c81('0x29')](_0x357694,_0x8c81('0x166'));}var _0x197368=this[_0x8c81('0xf')][_0x8c81('0x55')]('PLAYBACK',[_0x180bd2,_0x357694['opts']]);if(_0x197368[_0x8c81('0xa2')]===-0x1){return _0x197368;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x16e'),_0x180bd2));};AGIVertices[_0x8c81('0x12')]['queue']=function(_0xa22de4){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x16f'),_0xa22de4[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xa22de4[_0x8c81('0x170')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xa22de4,_0x8c81('0x171'));}var _0x45ee0d='';var _0x463de7=parseInt(_0xa22de4[_0x8c81('0x170')],0xa);if(isNaN(_0x463de7)){_0x45ee0d=_0xa22de4[_0x8c81('0x170')];}else{_0x45ee0d=this['getVoiceQueue'][_0x8c81('0x6c')](this,_0xa22de4[_0x8c81('0x170')]);if(!_0x45ee0d){return this[_0x8c81('0xf')]['error'](_0xa22de4,_0x8c81('0x172'));}}var _0xb2c1df='';if(this[_0x8c81('0x81')](_0xa22de4[_0x8c81('0x112')])){var _0x3c6825=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0xa22de4[_0x8c81('0x112')]);if(_0x3c6825){_0xb2c1df=_0x3c6825;}}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0xa22de4,_0x45ee0d);if(_0xa22de4[_0x8c81('0xe4')][_0x8c81('0x173')]('x')<0x0){_0xa22de4['opts']+='x';}if(_0xa22de4['opts'][_0x8c81('0x173')]('X')<0x0){_0xa22de4[_0x8c81('0xe4')]+='X';}this[_0x8c81('0xf')]['setVariable'](_0x8c81('0x174'),_0x45ee0d?_0x45ee0d[_0x8c81('0x175')]():'');var _0x215959=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0x176'),[_0x45ee0d,_0xa22de4[_0x8c81('0xe4')],_0xa22de4[_0x8c81('0x60')],_0xb2c1df,_0xa22de4[_0x8c81('0x61')],_0xa22de4[_0x8c81('0x8')],_0xa22de4[_0x8c81('0x177')],_0xa22de4[_0x8c81('0x178')],'',_0xa22de4[_0x8c81('0x179')]]);if(_0x215959['result']===-0x1){return _0x215959;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x176'),_0x45ee0d));};AGIVertices[_0x8c81('0x12')]['record']=function(_0x4b3df1){logger['info'](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4b3df1['label']));var _0x47a016=_0x4b3df1[_0x8c81('0x17a')]||_0x8c81('0x12f');var _0x1dac99=util['format'](_0x8c81('0x17b'),this[_0x8c81('0xf')][_0x8c81('0x33')],rs['generate'](0x5));var _0x5c5521=util['format'](_0x8c81('0x17c'),FILES_PATH,_0x1dac99,_0x47a016);var _0x5c56a0=util[_0x8c81('0x27')]('%s/recordings/%s',FILES_PATH,_0x1dac99);this[_0x8c81('0x37')][_0x8c81('0x6c')](this,_0x4b3df1,_0x1dac99,_0x5c5521);this['channel'][_0x8c81('0x9c')](_0x8c81('0x17d'),_0x1dac99);logger[_0x8c81('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5c56a0,_0x47a016,_0x4b3df1['escape_digits'],_0x4b3df1[_0x8c81('0x61')]);return this[_0x8c81('0xf')][_0x8c81('0x132')](_0x5c56a0,_0x47a016,_0x4b3df1[_0x8c81('0x17e')],_0x4b3df1[_0x8c81('0x61')],undefined,!![]);};AGIVertices[_0x8c81('0x12')]['restapi']=function(_0x4d04b2){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x17f'),_0x4d04b2[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x4d04b2[_0x8c81('0x60')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0x180'));}var _0x1fba2c=this['restAPI']['sync'](this,_0x4d04b2);logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x181'),util['inspect'](_0x1fba2c,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4d04b2[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x182'));}var _0x21e98b=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x4d04b2[_0x8c81('0xd4')]);if(!_0x21e98b){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4d04b2,_0x8c81('0xd6'));}this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x183'),_0x21e98b),_0x1fba2c[_0x8c81('0x70')]?_0x1fba2c[_0x8c81('0x70')]:_0x8c81('0x184'));this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x185'),_0x21e98b),_0x1fba2c[_0x8c81('0x186')]?_0x1fba2c[_0x8c81('0x186')]:'OK');if(_0x1fba2c[_0x8c81('0x67')]){try{this['saveRestApiResult'](_0x1fba2c[_0x8c81('0x67')],_0x21e98b);}catch(_0x457953){logger[_0x8c81('0x29')](util[_0x8c81('0x27')](_0x8c81('0x187'),_0x21e98b));}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xda'),_0x21e98b));};AGIVertices['prototype'][_0x8c81('0x188')]=function(_0x593817){logger['info'](util['format'](_0x8c81('0x189'),_0x593817[_0x8c81('0x34')]));return this['channel']['sayDigits'](_0x593817['digits'][_0x8c81('0xd2')](/\s+/g,''),_0x593817['escape_digits']);};AGIVertices[_0x8c81('0x12')]['saynumber']=function(_0x17f6fd){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x18a'),_0x17f6fd[_0x8c81('0x34')]));return this['channel'][_0x8c81('0x18b')](_0x17f6fd[_0x8c81('0x62')][_0x8c81('0xd2')](/\s+/g,''),_0x17f6fd[_0x8c81('0x17e')]);};AGIVertices['prototype']['sayphonetic']=function(_0x278a40){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x18c'),_0x278a40[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0x18d')](_0x278a40[_0x8c81('0x58')],_0x278a40[_0x8c81('0x17e')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x18e')]=function(_0xfd717b){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x18f'),_0xfd717b['label']));if(!this['isConfigured'](_0xfd717b[_0x8c81('0x190')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x191'));}var _0xb67548=this[_0x8c81('0x21')][_0x8c81('0x6c')](this,_0xfd717b[_0x8c81('0x190')]);if(!_0xb67548||!_0xb67548['Smtp']){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xfd717b,'no\x20mail\x20account\x20found');}var _0x3fd9ef={'from':util[_0x8c81('0x27')](_0x8c81('0x192'),_0xb67548['name'],_0xb67548[_0x8c81('0x193')]||_0xb67548[_0x8c81('0x194')][_0x8c81('0x195')]),'to':_0xfd717b['to']||'','cc':_0xfd717b['cc']||'','bcc':_0xfd717b[_0x8c81('0x196')]||'','subject':_0xfd717b[_0x8c81('0x197')],'html':_0xfd717b[_0x8c81('0x58')],'text':_0xfd717b[_0x8c81('0x58')]};if(this['isConfigured'](_0xfd717b[_0x8c81('0x198')])){}logger['debug'](_0x8c81('0x199'),JSON[_0x8c81('0x9d')](_0x3fd9ef));this[_0x8c81('0x32')]['sync'](this,_0xfd717b,_0xfd717b[_0x8c81('0x190')]);this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x19a'),_0xb67548['name']));this['sendMailMessage']['sync'](this,_0xb67548[_0x8c81('0x19b')],_0x3fd9ef);return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x19c'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x19d')]=function(_0x1224ad){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x1224ad['label']));return this['channel']['noop'](_0x8c81('0x19e'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x19f')]=function(_0x17c22c){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1a0'),_0x17c22c[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x17c22c[_0x8c81('0x1a1')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0x1a2'));}var _0x102a31=this[_0x8c81('0x30')][_0x8c81('0x6c')](this,_0x17c22c[_0x8c81('0x1a1')]);if(!_0x102a31){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x17c22c,_0x8c81('0x1a3'));}var _0x59dc3b={'body':_0x17c22c[_0x8c81('0x1a4')],'phone':_0x17c22c['to']||'','SmsAccountId':_0x102a31['id']};logger[_0x8c81('0xdc')](_0x8c81('0x1a5'),JSON['stringify'](_0x59dc3b));this['createSquareDetailsReport']['sync'](this,_0x17c22c,_0x17c22c[_0x8c81('0x1a1')]);this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x1a6'),_0x102a31[_0x8c81('0x14')]));this[_0x8c81('0x31')][_0x8c81('0x6c')](this,_0x59dc3b);return this[_0x8c81('0xf')][_0x8c81('0xa6')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1a7')]=function(_0x2027a6){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x2027a6[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x2027a6[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2027a6,'no\x20variable\x20selected');}var _0x14050b=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x2027a6[_0x8c81('0xd4')]);if(!_0x14050b){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2027a6,_0x8c81('0xd6'));}return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x14050b,_0x2027a6['variable_value']);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1a8')]=function(_0x315899){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x315899[_0x8c81('0x34')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1a9'));var _0x1e0c67=this[_0x8c81('0xf')][_0x8c81('0xa0')](_0x8c81('0x1aa'));if(!_[_0x8c81('0x42')](_0x1e0c67[_0x8c81('0xa3')])){this[_0x8c81('0xf')][_0x8c81('0x33')]=_0x1e0c67[_0x8c81('0xa3')];}if(_0x315899[_0x8c81('0xb6')]==='yes'){this[_0x8c81('0xf')][_0x8c81('0xa6')]('Answer');return this['channel'][_0x8c81('0xb6')]();}return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1ab'));};AGIVertices['prototype']['subproject']=function(_0x283abb){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1ac'),_0x283abb[_0x8c81('0x34')]));if(!this['isConfigured'](_0x283abb[_0x8c81('0x1ad')])){return this['channel'][_0x8c81('0x29')](_0x283abb,_0x8c81('0x1ae'));}var _0x1a3915=this[_0x8c81('0x17')][_0x8c81('0x6c')](this,_0x283abb[_0x8c81('0x1ad')]);if(!this['isConfigured'](_0x1a3915)){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x283abb,util['format'](_0x8c81('0x1af'),_0x283abb[_0x8c81('0x1ad')]));}if(_0x1a3915===this['channel']['arg_1']){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x283abb,_0x8c81('0x1b0'));}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x283abb,_0x1a3915);var _0x57cfa5=this[_0x8c81('0xf')]['exec'](_0x8c81('0x1b1'),util[_0x8c81('0x27')](_0x8c81('0x1b2'),config['agi']['host']||'127.0.0.1',_0x1a3915,this[_0x8c81('0xf')][_0x8c81('0x36')]));if(_0x57cfa5['result']===-0x1){return _0x57cfa5;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x1b1'),_0x1a3915));};AGIVertices['prototype']['system']=function(_0x284d34){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1b3'),_0x284d34['label']));var _0x334861=this[_0x8c81('0x54')][_0x8c81('0x6c')](this,_0x284d34[_0x8c81('0xb4')]);this[_0x8c81('0x32')]['sync'](this,_0x284d34,_0x284d34[_0x8c81('0xb4')]);if(this[_0x8c81('0x81')](_0x284d34[_0x8c81('0xd4')])){var _0x4fa1ee=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x284d34['variable_id']);if(_0x4fa1ee){this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x4fa1ee,_0x334861);return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x284d34['command'],_0x4fa1ee));}}return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x1b4'),_0x284d34[_0x8c81('0xb4')]));};AGIVertices['prototype'][_0x8c81('0x1b5')]=function(_0x1d0429){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1d0429[_0x8c81('0x34')]));_0x1d0429[_0x8c81('0x58')]=_0x1d0429['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8c81('0x81')](_0x1d0429[_0x8c81('0x57')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1b6'));}if(!this['isConfigured'](_0x1d0429[_0x8c81('0x58')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1d0429[_0x8c81('0x58')]));var _0x489edc=this[_0x8c81('0x56')][_0x8c81('0x6c')](this,_0x1d0429);if(_0x489edc){this[_0x8c81('0xf')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x489edc));var _0xe20d46=this[_0x8c81('0xf')][_0x8c81('0x103')](_0x489edc);try{fs['unlink'](_0x489edc+_0x8c81('0x125'));}catch(_0x41a3d8){logger[_0x8c81('0x29')](_0x41a3d8);}return _0xe20d46;}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x1d0429,_0x8c81('0x1b7'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1b8')]=function(_0x1b2897){logger['info'](util['format'](_0x8c81('0x1b9'),_0x1b2897['label']));_0x1b2897[_0x8c81('0x58')]=_0x1b2897[_0x8c81('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8c81('0x81')](_0x1b2897[_0x8c81('0x58')])){return this[_0x8c81('0xf')]['noop']('no\x20text\x20configured');}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x1ba'),_0x1b2897['text']));var _0x6c2163=this[_0x8c81('0x5d')][_0x8c81('0x6c')](this,_0x1b2897);if(_0x6c2163){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x1bb'),_0x6c2163));var _0x2654ea=this['channel'][_0x8c81('0x103')](_0x6c2163);try{fs['unlink'](_0x6c2163+_0x8c81('0x125'));}catch(_0x2ef1bf){logger[_0x8c81('0x29')](_0x2ef1bf);}return _0x2654ea;}return this['channel'][_0x8c81('0x29')](_0x1b2897,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1bc')]=function(_0xf1ee3f){logger['info'](util['format'](_0x8c81('0x1bd'),_0xf1ee3f[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xf1ee3f[_0x8c81('0x158')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xf1ee3f,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));var _0x38e220=this[_0x8c81('0x4f')][_0x8c81('0x6c')](this,_0xf1ee3f['findBy']);if(_0x38e220){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0xf1ee3f[_0x8c81('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1be')]=function(_0x383114){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x1bf'),_0x383114['label']));var _0xe2fb19=this['channel'][_0x8c81('0x55')](_0x8c81('0x1c0'),[_0x383114[_0x8c81('0x1c1')],_0x383114[_0x8c81('0x72')]]);if(_0xe2fb19[_0x8c81('0xa2')]===-0x1){return _0xe2fb19;}return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x1c0'),_0x383114['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x886c43){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1c2'),_0x886c43[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x886c43[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x886c43,'no\x20variable\x20selected');}var _0x17c9b3=this[_0x8c81('0xa0')]['sync'](this,_0x886c43[_0x8c81('0xd4')]);if(!_0x17c9b3){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x886c43,'no\x20variable\x20found');}var _0x1792fd=this['channel'][_0x8c81('0xa0')](_0x17c9b3);return{'code':0xc8,'result':_0x1792fd[_0x8c81('0xa3')]?_0x1792fd['extra']:'-'};};String[_0x8c81('0x12')][_0x8c81('0x9f')]=function(_0x5557c9,_0x456b58){return this[_0x8c81('0x9e')](_0x5557c9)['join'](_0x456b58);};module['exports']=AGIVertices; \ No newline at end of file +var _0x4b1f=['arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','phone','list_id','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','callerid','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','google_tts_language','url','method','number','timeout','includes','POST','toUpperCase','body','parse','headers','sync','uri','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceAllVariables','split','replaceAll','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','scheduledAt','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','out','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\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\x20selected','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','maxRetry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','test','stringify','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','getsecretdigits','goalname','GOAL\x20%s','awspolly','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','subproject','no\x20subproject\x20selected','getSquareProject','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','odbc','randomstring','moment','request-promise','../../config/logger','agi','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','rpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','agicommand','createSquareRecording','uniqueid','extension','priority','accountcode','dnid'];(function(_0x1e7249,_0x5e7633){var _0x6e83f4=function(_0x2689a3){while(--_0x2689a3){_0x1e7249['push'](_0x1e7249['shift']());}};_0x6e83f4(++_0x5e7633);}(_0x4b1f,0x195));var _0xf4b1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4b1f[_0x46e363];return _0x3fb059;};'use strict';var fs=require('fs');var util=require(_0xf4b1('0x0'));var _=require(_0xf4b1('0x1'));var sh=require('shelljs');var odbc=require(_0xf4b1('0x2'))();var rs=require(_0xf4b1('0x3'));var moment=require(_0xf4b1('0x4'));var Mustache=require('mustache');var rp=require(_0xf4b1('0x5'));var logger=require(_0xf4b1('0x6'))(_0xf4b1('0x7'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH=_0xf4b1('0x8');var recursiveMapAttributes=[_0xf4b1('0x9'),_0xf4b1('0xa')];var verticesWithRetry=[_0xf4b1('0xb'),_0xf4b1('0xc'),'getsecretdigits'];var AGIVertices=function(_0x59cf77,_0x4bcd22,_0x2bf9d8){this['channel']=_0x59cf77;this[_0xf4b1('0xd')]=_0x4bcd22;this['mailRpc']=_0x2bf9d8;};AGIVertices['prototype'][_0xf4b1('0xe')]=function(_0x31720d,_0x10a08c){this[_0xf4b1('0xd')][_0xf4b1('0xf')](_0x31720d)[_0xf4b1('0x10')](function(_0x3bf5a0){_0x10a08c(null,_0x3bf5a0?_0x3bf5a0[_0xf4b1('0x11')]:![]);})[_0xf4b1('0x12')](function(_0xf66b4c){_0x10a08c(_0xf66b4c);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x14')]=function(_0x1c4b0f,_0x58bdf0){this['rpc'][_0xf4b1('0x15')](_0x1c4b0f)['then'](function(_0x598bec){_0x58bdf0(null,_0x598bec?_0x598bec[_0xf4b1('0x11')]:![]);})['catch'](function(_0x5764b1){_0x58bdf0(_0x5764b1);});};AGIVertices[_0xf4b1('0x13')]['getSquareProject']=function(_0x5e7206,_0x554517){this['rpc'][_0xf4b1('0x16')](_0x5e7206)[_0xf4b1('0x10')](function(_0x534fd8){_0x554517(null,_0x534fd8?_0x534fd8[_0xf4b1('0x11')]:![]);})[_0xf4b1('0x12')](function(_0x322b38){_0x554517(_0x322b38);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x17')]=function(_0x7e5336,_0x5b0214){this[_0xf4b1('0xd')][_0xf4b1('0x18')](_0x7e5336)['then'](function(_0xc6ec1d){_0x5b0214(null,_0xc6ec1d?_0xc6ec1d[_0xf4b1('0x19')]:![]);})['catch'](function(_0x13892d){_0x5b0214(_0x13892d);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x1a')]=function(_0x466739,_0x5c50e8){this[_0xf4b1('0xd')][_0xf4b1('0x1b')](_0x466739)[_0xf4b1('0x10')](function(_0xccb44){_0x5c50e8(null,_0xccb44?_0xccb44['name']:![]);})[_0xf4b1('0x12')](function(_0x474212){_0x5c50e8(_0x474212);});};AGIVertices['prototype'][_0xf4b1('0x1c')]=function(_0x502f0b,_0x15cfc4){this['rpc'][_0xf4b1('0x1d')](_0x502f0b)[_0xf4b1('0x10')](function(_0x2e803d){_0x15cfc4(null,_0x2e803d?_0x2e803d['name']:![]);})[_0xf4b1('0x12')](function(_0x5ace8c){_0x15cfc4(_0x5ace8c);});};AGIVertices[_0xf4b1('0x13')]['getSound']=function(_0x29493b,_0x447ae7){var _0x5d28af=this;this[_0xf4b1('0xd')][_0xf4b1('0x1e')](_0x29493b)['then'](function(_0x125bf4){_0x447ae7(null,_0x125bf4?_0x5d28af[_0xf4b1('0x1f')](_0x125bf4[_0xf4b1('0x20')]):![]);})[_0xf4b1('0x12')](function(_0x3046dc){_0x447ae7(_0x3046dc);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x21')]=function(_0x5cf063,_0x56ee5e){this[_0xf4b1('0xd')][_0xf4b1('0x22')](_0x5cf063)[_0xf4b1('0x10')](function(_0x29b9f9){_0x56ee5e(null,_0x29b9f9?_0x29b9f9:![]);})[_0xf4b1('0x12')](function(_0x4f2ec3){_0x56ee5e(_0x4f2ec3);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x23')]=function(_0xa6bdd7,_0x21a9fa,_0x1e4c8a){this[_0xf4b1('0x24')][_0xf4b1('0x23')](_0xa6bdd7,_0x21a9fa)[_0xf4b1('0x10')](function(){_0x1e4c8a(null);})['catch'](function(_0x1cc7b3){_0x1e4c8a(_0x1cc7b3);});};AGIVertices['prototype']['getIntervals']=function(_0x48f672,_0x22403c){this[_0xf4b1('0xd')][_0xf4b1('0x25')](_0x48f672)[_0xf4b1('0x10')](function(_0x303dff){if(_0x303dff){if(_0x303dff[_0xf4b1('0x26')]){_0x22403c(null,[_0x303dff[_0xf4b1('0x27')]]);}else{_0x22403c(null,_[_0xf4b1('0x28')](_0x303dff['Intervals'],_0xf4b1('0x27')));}}else{_0x22403c(null,![]);}})['catch'](function(_0x24bcae){_0x22403c(_0x24bcae);});};AGIVertices[_0xf4b1('0x13')]['getSoundPath']=function(_0x43470a){return util[_0xf4b1('0x29')](_0xf4b1('0x2a'),FILES_PATH,_0x43470a);};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x2b')]=function(_0x54e422,_0x3e0305,_0x4f52dd){odbc[_0xf4b1('0x2c')](_0x54e422,function(_0x50e658){if(_0x50e658){logger[_0xf4b1('0x2d')](_0xf4b1('0x2e'),_0x50e658);_0x4f52dd(_0x50e658);}else{logger[_0xf4b1('0x2f')]('ODBC\x20connection\x20successfully');odbc[_0xf4b1('0x30')](_0x3e0305,function(_0x40eb28,_0x207020){if(_0x40eb28){logger[_0xf4b1('0x2f')](_0xf4b1('0x31'),_0x3e0305);_0x4f52dd(_0x40eb28);}else{logger[_0xf4b1('0x2f')](_0xf4b1('0x32'),_0x3e0305);odbc['close'](function(_0x393da0){if(_0x393da0){logger[_0xf4b1('0x2d')](_0xf4b1('0x33'),_0x393da0);}_0x4f52dd(null,_0x207020);});}});}});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x34')]=function(_0x5aab12,_0x54df38){this[_0xf4b1('0xd')][_0xf4b1('0x35')](_0x5aab12)['then'](function(_0x513a7a){_0x54df38(null,_0x513a7a?_0x513a7a:![]);})[_0xf4b1('0x12')](function(_0x19581c){_0x54df38(_0x19581c);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x36')]=function(_0x29bada,_0x123058){this[_0xf4b1('0xd')][_0xf4b1('0x36')](_0x29bada)['then'](function(_0x3a4383){_0x123058(null,_0x3a4383);})['catch'](function(_0x4e8496){_0x123058(_0x4e8496);});};AGIVertices['prototype'][_0xf4b1('0x37')]=function(_0x3feed5,_0x28b9f2,_0x5c6fb9){this[_0xf4b1('0xd')][_0xf4b1('0x37')]({'uniqueid':this[_0xf4b1('0x38')]['uniqueid'],'node':_0x3feed5[_0xf4b1('0x39')],'application':_0x3feed5[_0xf4b1('0x3a')],'data':_0x28b9f2||null,'project_name':this[_0xf4b1('0x38')]['arg_1'],'callerid':this[_0xf4b1('0x38')]['callerid']})[_0xf4b1('0x10')](function(_0x35d94c){if(_0x5c6fb9){_0x5c6fb9(null,_0x35d94c);}})[_0xf4b1('0x12')](function(_0x54f24a){if(_0x5c6fb9){_0x5c6fb9(_0x54f24a);}});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x3b')]=function(_0x4a1624,_0xda618f,_0x3e0449,_0x44b126){this[_0xf4b1('0xd')]['createSquareRecording']({'uniqueid':this['channel'][_0xf4b1('0x3c')],'callerid':this[_0xf4b1('0x38')]['callerid'],'calleridname':this[_0xf4b1('0x38')]['calleridname'],'context':this[_0xf4b1('0x38')]['context'],'extension':this[_0xf4b1('0x38')][_0xf4b1('0x3d')],'priority':this['channel'][_0xf4b1('0x3e')],'accountcode':this[_0xf4b1('0x38')][_0xf4b1('0x3f')],'dnid':this[_0xf4b1('0x38')][_0xf4b1('0x40')],'projectName':this[_0xf4b1('0x38')][_0xf4b1('0x41')],'saveName':_0xda618f,'filename':_0x4a1624[_0xf4b1('0x42')]||_0xda618f,'savePath':_0x3e0449})['then'](function(_0x4a9761){_0x44b126(null,_0x4a9761);})[_0xf4b1('0x12')](function(_0x247165){_0x44b126(_0x247165);});};AGIVertices['prototype'][_0xf4b1('0x43')]=function(_0x3476b3,_0x21dc3b,_0x1f53d1,_0x2e214f,_0x2e8e2c){this[_0xf4b1('0xd')][_0xf4b1('0x43')]({'uniqueid':this[_0xf4b1('0x38')][_0xf4b1('0x3c')],'body':_0x3476b3,'direction':_0x21dc3b,'providerName':_0x1f53d1,'providerResponse':_0x2e214f})[_0xf4b1('0x10')](function(_0x10c01c){if(_0x2e8e2c){_0x2e8e2c(null,_0x10c01c);}})[_0xf4b1('0x12')](function(_0x1bf70f){if(_0x2e8e2c){_0x2e8e2c(_0x1bf70f);}});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x44')]=function(_0xacaa0e,_0x11918d){this[_0xf4b1('0xd')][_0xf4b1('0x44')]({'firstName':_[_0xf4b1('0x45')](_0xacaa0e[_0xf4b1('0x11')])||_[_0xf4b1('0x46')](_0xacaa0e[_0xf4b1('0x11')])?_0xf4b1('0x47')+Math[_0xf4b1('0x48')]():_0xacaa0e[_0xf4b1('0x11')],'lastName':_[_0xf4b1('0x45')](_0xacaa0e['lastName'])||_[_0xf4b1('0x46')](_0xacaa0e['lastName'])?null:_0xacaa0e['lastName'],'phone':_0xacaa0e[_0xf4b1('0x49')],'ListId':_0xacaa0e[_0xf4b1('0x4a')],'scheduledat':_0xacaa0e['scheduledAt'],'callbackUniqueid':this[_0xf4b1('0x38')][_0xf4b1('0x3c')],'tags':_0xf4b1('0x4b'),'description':'Callback\x20scheduled\x20at\x20'+_0xacaa0e['scheduledAt'][_0xf4b1('0x4c')](),'priority':_0xacaa0e[_0xf4b1('0x4d')]})[_0xf4b1('0x10')](function(_0x38938f){_0x11918d(null,_0x38938f);})[_0xf4b1('0x12')](function(_0x288095){_0x11918d(_0x288095);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x4e')]=function(_0x2a2c08,_0x1e77b6){this[_0xf4b1('0xd')][_0xf4b1('0x4f')](_0x2a2c08)[_0xf4b1('0x10')](function(_0x24d0a6){_0x1e77b6(null,_0x24d0a6?_0x24d0a6['name']:![]);})[_0xf4b1('0x12')](function(_0x44f606){_0x1e77b6(_0x44f606);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x50')]=function(_0xb53593,_0x43d373,_0xe7b6a3){var _0x302881={'role':_0xf4b1('0x51')};_0x302881[_0xb53593]=this['channel'][_0xf4b1('0x52')];this[_0xf4b1('0xd')][_0xf4b1('0x50')](_0x302881,_0x43d373,this['channel']['uniqueid'])[_0xf4b1('0x10')](function(_0x1cc591){_0xe7b6a3(null,_['isNil'](_0x1cc591)?![]:!![]);})[_0xf4b1('0x12')](function(_0x408c95){logger[_0xf4b1('0x2d')](_0x408c95);_0xe7b6a3(null,![]);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x53')]=function(_0x34e231,_0xf8fbc1){var _0x3b1a8e={'role':_0xf4b1('0x51')};_0x3b1a8e[_0x34e231]=this[_0xf4b1('0x38')][_0xf4b1('0x52')];this['rpc'][_0xf4b1('0x53')](_0x3b1a8e)[_0xf4b1('0x10')](function(_0x4cdb6b){_0xf8fbc1(null,_[_0xf4b1('0x46')](_0x4cdb6b)?![]:!![]);})[_0xf4b1('0x12')](function(_0x1feebf){logger['error'](_0x1feebf);_0xf8fbc1(null,![]);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x54')]=function(_0x53661b,_0x4d233d){var _0x2ad185={'role':'agent'};_0x2ad185[_0x53661b]=this['channel'][_0xf4b1('0x52')];this[_0xf4b1('0xd')]['agentLogout'](_0x2ad185)['then'](function(_0x10cab4){_0x4d233d(null,_[_0xf4b1('0x46')](_0x10cab4)?![]:!![]);})['catch'](function(_0x2a5d41){logger[_0xf4b1('0x2d')](_0x2a5d41);_0x4d233d(null,![]);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x55')]=function(_0xe82df1,_0x252b48){var _0x1560cc={'role':'agent'};_0x1560cc[_0xe82df1]=this[_0xf4b1('0x38')][_0xf4b1('0x52')];var _0xca5281=_0xe82df1!=_0xf4b1('0x56')?util[_0xf4b1('0x29')](_0xf4b1('0x57'),_0xf4b1('0x58'),this['channel']['callerid']):undefined;this[_0xf4b1('0xd')][_0xf4b1('0x55')](_0x1560cc,_0xca5281)['then'](function(_0x282e64){_0x252b48(null,_[_0xf4b1('0x46')](_0x282e64)?![]:!![]);})[_0xf4b1('0x12')](function(_0x3e3933){logger['error'](_0x3e3933);_0x252b48(null,![]);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x59')]=function(_0x3f1010,_0x5ce4c2){sh[_0xf4b1('0x5a')](_[_0xf4b1('0x5b')](_0x3f1010),function(_0x44e4b0,_0x945e8f){var _0x224e63=_0x945e8f['replace'](/(\r\n|\n|\r)/gm,'');_0x5ce4c2(null,_0x224e63);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x5c')]=function(_0x29d45a,_0x2e78cb){scripts[_0xf4b1('0x5c')](_0x29d45a[_0xf4b1('0x5d')],_0x29d45a['google_cloud_tts_text_type']||_0xf4b1('0x5e'),_0x29d45a['text'],_0x29d45a[_0xf4b1('0x5f')]||'en-US',_0x29d45a[_0xf4b1('0x60')]||_0xf4b1('0x61'),_0x29d45a[_0xf4b1('0x62')]||_0xf4b1('0x63'))['then'](function(_0x56517c){_0x2e78cb(null,_0x56517c);})['catch'](function(_0x32eb50){_0x2e78cb(_0x32eb50);});};AGIVertices['prototype']['googleTTS']=function(_0x35eb31,_0x460673){scripts['googleTTS'](_0x35eb31[_0xf4b1('0x5e')],_0x35eb31[_0xf4b1('0x64')]||'en',0x1)['then'](function(_0x20abad){_0x460673(null,_0x20abad);})[_0xf4b1('0x12')](function(_0x5022f2){_0x460673(_0x5022f2);});};AGIVertices[_0xf4b1('0x13')]['restAPI']=function(_0x1687d5,_0x5af286){var _0x59ac68={'uri':_0x1687d5[_0xf4b1('0x65')],'method':_0x1687d5[_0xf4b1('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1687d5['timeout'])===_0xf4b1('0x67')&&parseInt(_0x1687d5[_0xf4b1('0x68')])>=0x1?parseInt(_0x1687d5[_0xf4b1('0x68')])*0x3e8:0x5*0x3e8};if(_[_0xf4b1('0x69')]([_0xf4b1('0x6a'),'PUT'],_0x59ac68[_0xf4b1('0x66')][_0xf4b1('0x6b')]())){try{_0x59ac68[_0xf4b1('0x6c')]=_0x1687d5['rawBody']?JSON[_0xf4b1('0x6d')](_0x1687d5[_0xf4b1('0xa')]):{};}catch(_0x41bf68){logger[_0xf4b1('0x2d')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x41bf68);}}try{_0x59ac68[_0xf4b1('0x6e')]=_0x1687d5[_0xf4b1('0x9')]?JSON[_0xf4b1('0x6d')](_0x1687d5[_0xf4b1('0x9')]):{};}catch(_0x1823de){logger[_0xf4b1('0x2d')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1823de);}if(_0x1687d5['computedVariables']){try{var _0x4a9a2f=require(_0x1687d5['computedVariables'])[_0xf4b1('0x6f')](this,_0x59ac68);_0x59ac68[_0xf4b1('0x70')]=Mustache['render'](_0x1687d5[_0xf4b1('0x65')],_0x4a9a2f,{},['$$','$$']);if(_0x59ac68[_0xf4b1('0x6e')]){_0x59ac68[_0xf4b1('0x6e')]=JSON['parse'](Mustache[_0xf4b1('0x71')](JSON['stringify'](_0x59ac68['headers']),_0x4a9a2f,{},['$$','$$']));}if(_0x59ac68['body']){_0x59ac68[_0xf4b1('0x6c')]=JSON[_0xf4b1('0x6d')](Mustache['render'](JSON['stringify'](_0x59ac68[_0xf4b1('0x6c')]),_0x4a9a2f,{},['$$','$$']));}}catch(_0x49302a){logger[_0xf4b1('0x2d')](_0xf4b1('0x72'),_0x49302a);}}rp(_0x59ac68)[_0xf4b1('0x10')](function(_0x1a3280){var _0x5c6441={'statusCode':_0x1a3280[_0xf4b1('0x73')]||0xc8,'statusMessage':_0x1a3280[_0xf4b1('0x74')]||'OK','headers':_0x1a3280[_0xf4b1('0x6e')]||{},'body':_0x1a3280[_0xf4b1('0x6c')]||{}};_0x5af286(null,_0x5c6441);})[_0xf4b1('0x12')](function(_0x322422){var _0x16e3ff={'statusCode':_0x322422['statusCode']||0x1f4,'statusMessage':_0x322422[_0xf4b1('0x75')]||_0xf4b1('0x76'),'headers':_0x322422[_0xf4b1('0x77')][_0xf4b1('0x6e')]||{},'body':_0x322422[_0xf4b1('0x77')]['body']||{}};_0x5af286(null,_0x16e3ff);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x78')]=function(_0x704d5a,_0x2fd77b){scripts['googleDialogflow'](this['channel'][_0xf4b1('0x3c')],_0x704d5a[_0xf4b1('0x79')],_0x704d5a[_0xf4b1('0x5e')],_0x704d5a[_0xf4b1('0x7a')]||'en')['then'](function(_0x3a0e3e){_0x2fd77b(null,_0x3a0e3e);})[_0xf4b1('0x12')](function(_0x2787f0){_0x2fd77b(_0x2787f0);});};AGIVertices[_0xf4b1('0x13')]['googleDialogflowV2']=function(_0x503f3f,_0x13d74f){scripts[_0xf4b1('0x7b')](this[_0xf4b1('0x38')]['uniqueid'],_0x503f3f[_0xf4b1('0x7c')],_0x503f3f[_0xf4b1('0x7d')],_0x503f3f[_0xf4b1('0x7e')],_0x503f3f[_0xf4b1('0x5e')],_0x503f3f['dialogflowV2_language']||'en')[_0xf4b1('0x10')](function(_0x6fd319){_0x13d74f(null,_0x6fd319);})[_0xf4b1('0x12')](function(_0x31b397){_0x13d74f(_0x31b397);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x7f')]=function(_0x5f1e34,_0x272e3e){scripts[_0xf4b1('0x7f')](this[_0xf4b1('0x38')],_0x5f1e34)[_0xf4b1('0x10')](function(_0x456634){_0x272e3e(null,_0x456634);})['catch'](function(_0x6fe30c){_0x272e3e(_0x6fe30c);});};AGIVertices['prototype'][_0xf4b1('0x80')]=function(_0x1e12bd,_0x43f176){scripts[_0xf4b1('0x80')](_0x1e12bd[_0xf4b1('0x79')],_0x1e12bd[_0xf4b1('0x5e')],_0x1e12bd[_0xf4b1('0x81')]||_0xf4b1('0x82'),_0x1e12bd[_0xf4b1('0x83')])['then'](function(_0x111859){_0x43f176(null,_0x111859);})[_0xf4b1('0x12')](function(_0x54df44){_0x43f176(_0x54df44);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x84')]=function(_0x2d9472,_0xf8e916,_0x44e9f8){scripts[_0xf4b1('0x84')](_0xf8e916,_0x2d9472[_0xf4b1('0x79')],_0x2d9472[_0xf4b1('0x85')]||_0xf4b1('0x82'),this[_0xf4b1('0x86')](_0x2d9472[_0xf4b1('0x87')])?_0x2d9472[_0xf4b1('0x87')]:undefined)[_0xf4b1('0x10')](function(_0x55fda5){_0x44e9f8(null,_0x55fda5);})[_0xf4b1('0x12')](function(_0x1532c8){_0x44e9f8(_0x1532c8);});};AGIVertices[_0xf4b1('0x13')]['awsPolly']=function(_0x4236c2,_0x26584c){scripts[_0xf4b1('0x88')](_0x4236c2['aws_access_key_id'],_0x4236c2[_0xf4b1('0x89')],_0x4236c2['aws_polly_region'],_0x4236c2[_0xf4b1('0x8a')]||_0xf4b1('0x8b'),_0x4236c2['text'],_0x4236c2[_0xf4b1('0x8c')]||_0xf4b1('0x5e'))['then'](function(_0x267e89){_0x26584c(null,_0x267e89);})['catch'](function(_0x423833){_0x26584c(_0x423833);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x8d')]=function(_0x493c60,_0x1df6ee){scripts[_0xf4b1('0x8d')](this['channel']['uniqueid'],_0x493c60['aws_access_key_id'],_0x493c60[_0xf4b1('0x89')],_0x493c60['aws_lex_region'],_0x493c60['text'],_0x493c60[_0xf4b1('0x8e')])[_0xf4b1('0x10')](function(_0x5d53b6){_0x1df6ee(null,_0x5d53b6);})['catch'](function(_0x5db51b){_0x1df6ee(_0x5db51b);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x8f')]=function(_0x3c6e53,_0x31c1af,_0x20194b){scripts[_0xf4b1('0x8f')](_0x31c1af,_0x3c6e53[_0xf4b1('0x79')],_0x3c6e53[_0xf4b1('0x90')]||_0xf4b1('0x82'))[_0xf4b1('0x10')](function(_0x30a54b){_0x20194b(null,_0x30a54b);})[_0xf4b1('0x12')](function(_0x53277d){_0x20194b(_0x53277d);});};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x91')]=function(_0x406f2d,_0x5eb9a7,_0x138910){scripts[_0xf4b1('0x91')](_0x5eb9a7,_0x406f2d['appid'],_0x406f2d[_0xf4b1('0x92')],_0x406f2d['uri'])[_0xf4b1('0x10')](function(_0x39856c){_0x138910(null,_0x39856c);})['catch'](function(_0x5dd5ee){_0x138910(_0x5dd5ee);});};AGIVertices['prototype'][_0xf4b1('0x93')]=function(_0x172403){var _0x1f7b4e=_[_0xf4b1('0x69')](verticesWithRetry,_0x172403[_0xf4b1('0x3a')])?_0x172403:_[_0xf4b1('0x94')](_0x172403);for(var _0x25e56d in _0x1f7b4e){if(_0x1f7b4e[_0xf4b1('0x95')](_0x25e56d)){if(_0x1f7b4e[_0x25e56d]&&_[_0xf4b1('0x96')](_0x1f7b4e[_0x25e56d])){if(_['includes'](recursiveMapAttributes,_0x25e56d)){_0x1f7b4e[_0x25e56d]=this['replaceObjectAllVariables'](_0x1f7b4e[_0x25e56d]);}else{_0x1f7b4e[_0x25e56d]=this['replaceAllVariables'](_0x1f7b4e[_0x25e56d]);}}}}return _0x1f7b4e;};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x97')]=function(_0x5c3346){for(var _0x5e12c2 in _0x5c3346){if(_0x5c3346['hasOwnProperty'](_0x5e12c2)){if(_[_0xf4b1('0x98')](_0x5c3346[_0x5e12c2])){this[_0xf4b1('0x97')](_0x5c3346[_0x5e12c2]);}else if(_[_0xf4b1('0x99')](_0x5c3346[_0x5e12c2])){for(var _0x502c4f=0x0;_0x502c4f<_0x5c3346[_0x5e12c2][_0xf4b1('0x9a')];_0x502c4f++){this['recursiveNodeIndex'](_0x5c3346[_0x5e12c2][_0x502c4f]);}}else if(_[_0xf4b1('0x96')](_0x5c3346[_0x5e12c2])){_0x5c3346[_0x5e12c2]=this['replaceAllVariables'](_0x5c3346[_0x5e12c2]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x173d19,_0x17cd0d){for(var _0x18d326 in _0x173d19){if(_0x173d19['hasOwnProperty'](_0x18d326)){if(_[_0xf4b1('0x98')](_0x173d19[_0x18d326])){if(!_['isEmpty'](_0x173d19[_0x18d326])){this[_0xf4b1('0x9b')](_0x173d19[_0x18d326],util['format'](_0xf4b1('0x9c'),_0x17cd0d,_0x18d326));}}else if(_[_0xf4b1('0x99')](_0x173d19[_0x18d326])){for(var _0x3675f2=0x0;_0x3675f2<_0x173d19[_0x18d326][_0xf4b1('0x9a')];_0x3675f2++){this[_0xf4b1('0x9b')](_0x173d19[_0x18d326][_0x3675f2],util[_0xf4b1('0x29')](_0xf4b1('0x9c'),_0x17cd0d,_0x18d326+'['+_0x3675f2+']'));}}else{if(!_[_0xf4b1('0x46')](_0x173d19[_0x18d326])){this[_0xf4b1('0x38')][_0xf4b1('0x9d')](util['format']('%s.%s',_0x17cd0d,_0x18d326),_0x173d19[_0x18d326]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x545d5c){try{var _0x304a8e=JSON[_0xf4b1('0x6d')](_0x545d5c);this['recursiveNodeIndex'](_0x304a8e);return JSON['stringify'](_0x304a8e);}catch(_0x4aa232){return this[_0xf4b1('0x9e')](_0x545d5c);}};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x9e')]=function(_0x5eab5e){var _0x8b640e=_0x5eab5e[_0xf4b1('0x9f')]('{');for(var _0x406e81=0x1;_0x406e81<_0x8b640e[_0xf4b1('0x9a')];_0x406e81+=0x1){var _0x3fce20=_0x8b640e[_0x406e81][_0xf4b1('0x9f')]('}');if(_0x3fce20['length']>0x1){_0x5eab5e=_0x5eab5e[_0xf4b1('0xa0')]('{'+_0x3fce20[0x0]+'}',this[_0xf4b1('0x38')][_0xf4b1('0xe')](_0x3fce20[0x0])['extra']||_0x3fce20[0x0]);}}if(_0x8b640e[_0xf4b1('0x9a')]===0x1){return _0x5eab5e[_0xf4b1('0x4c')]();}return this[_0xf4b1('0x9e')](_0x5eab5e);};AGIVertices['prototype'][_0xf4b1('0xa1')]=function(_0x1e09e6,_0x3dfec6){var _0x593cfc=this[_0xf4b1('0x38')][_0xf4b1('0xe')](_0x1e09e6);if(_0x593cfc['result']===-0x1){return _0x593cfc;}logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xa2'),_0x3dfec6,_0x593cfc['extra']));return this[_0xf4b1('0x38')][_0xf4b1('0x9d')](_0x3dfec6,_0x593cfc[_0xf4b1('0xa3')]);};AGIVertices['prototype'][_0xf4b1('0x86')]=function(_0x108d62){return _0x108d62&&_0x108d62!=='0'&&_0x108d62!=='-1'&&_0x108d62!=='';};AGIVertices['prototype']['maxRetry']=function(_0x97135d){this[_0xf4b1('0x37')][_0xf4b1('0x6f')](this,_0x97135d,'-');_0x97135d[_0xf4b1('0xa4')]=_0x97135d['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0xa5')]=function(_0x907b0b){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x907b0b['label']));if(!this[_0xf4b1('0x86')](_0x907b0b[_0xf4b1('0x5e')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xa7'));}var _0x4182e8='\x22'+_0x907b0b[_0xf4b1('0x5e')]+'\x22';if(this[_0xf4b1('0x86')](_0x907b0b[_0xf4b1('0x77')])){_0x4182e8+=','+_0x907b0b[_0xf4b1('0x77')];}var _0x52bde8=this['channel']['exec'](_0xf4b1('0xa8'),_0x4182e8);if(_0x52bde8[_0xf4b1('0xa9')]===-0x1){return _0x52bde8;}return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util['format'](_0xf4b1('0xaa'),_0x4182e8));};AGIVertices[_0xf4b1('0x13')]['mrcprecog']=function(_0x22f9d1){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xab'),_0x22f9d1[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x22f9d1[_0xf4b1('0xac')])){return this['channel'][_0xf4b1('0xa6')]('no\x20grammar\x20configured');}var _0x1529c0=_0x22f9d1['grammar'];if(this[_0xf4b1('0x86')](_0x22f9d1[_0xf4b1('0x77')])){_0x1529c0+=','+_0x22f9d1['options'];}var _0x271abd=this[_0xf4b1('0x38')][_0xf4b1('0x5a')]('MRCPRecog',_0x1529c0);if(_0x271abd[_0xf4b1('0xa9')]===-0x1){return _0x271abd;}var _0x24e411=this[_0xf4b1('0xa1')]('RECOG_CONFIDENCE()',_0xf4b1('0xad'));if(_0x24e411[_0xf4b1('0xa9')]===-0x1){return _0x24e411;}var _0x44b0bf=this['getAndSetVariable']('RECOG_INPUT()',_0xf4b1('0xae'));if(_0x44b0bf['result']===-0x1){return _0x44b0bf;}var _0x2cd258=this[_0xf4b1('0xa1')]('RECOG_INSTANCE()',_0xf4b1('0xaf'));if(_0x2cd258[_0xf4b1('0xa9')]===-0x1){return _0x2cd258;}return this['channel'][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0xb0'),_0x1529c0));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x7')]=function(_0x304155){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xb1'),_0x304155[_0xf4b1('0x39')]));return this['channel'][_0xf4b1('0x7')]([_0x304155[_0xf4b1('0xb2')],_0x304155['args']]);};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0xb3')]=function(_0x13d101){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xb4'),_0x13d101[_0xf4b1('0x39')]));if(this[_0xf4b1('0x86')](_0x13d101[_0xf4b1('0x68')])){logger['info'](util['format'](_0xf4b1('0xb5'),_0x13d101[_0xf4b1('0x68')]));var _0x2b9b4a=this[_0xf4b1('0x38')][_0xf4b1('0xb6')](_0x13d101['timeout']);if(_0x2b9b4a['result']===-0x1){return _0x2b9b4a;}}return this['channel'][_0xf4b1('0xb3')]();};AGIVertices[_0xf4b1('0x13')]['callback']=function(_0x123d0f){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xb7'),_0x123d0f[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x123d0f[_0xf4b1('0x4a')])){return this['channel'][_0xf4b1('0x2d')](_0x123d0f,'no\x20list\x20selected');}_0x123d0f[_0xf4b1('0xb8')]=moment();if(this[_0xf4b1('0x86')](_0x123d0f['delay'])){_0x123d0f['scheduledAt']=moment()[_0xf4b1('0xb9')](_0x123d0f[_0xf4b1('0xba')],_0xf4b1('0xbb'));}if(!this[_0xf4b1('0x86')](_0x123d0f[_0xf4b1('0x4d')])){_0x123d0f['callback_priority']=0x2;}this[_0xf4b1('0x44')]['sync'](this,_0x123d0f);return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0xbc'),_0x123d0f[_0xf4b1('0x49')],_0x123d0f['list_id'],_0x123d0f[_0xf4b1('0xb8')]));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0xbd')]=function(_0x1a785f){logger['info'](util[_0xf4b1('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x1a785f[_0xf4b1('0x39')]));var _0x4a2f98=this['channel'][_0xf4b1('0x5a')](_0x1a785f[_0xf4b1('0xbe')],_0x1a785f[_0xf4b1('0x77')]);if(_0x4a2f98[_0xf4b1('0xa9')]===-0x1){return _0x4a2f98;}return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util['format'](_0xf4b1('0xbf'),_0x1a785f[_0xf4b1('0xbe')],_0x1a785f[_0xf4b1('0x77')]));};AGIVertices[_0xf4b1('0x13')]['lumenvoxtts']=function(_0x3848ee){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xc0'),_0x3848ee['label']));if(!this[_0xf4b1('0x86')](_0x3848ee[_0xf4b1('0x5e')])){return this['channel'][_0xf4b1('0xa6')](_0xf4b1('0xa7'));}var _0x7da84a='\x22'+_0x3848ee[_0xf4b1('0x5e')]+'\x22';if(this[_0xf4b1('0x86')](_0x3848ee['options'])){_0x7da84a+=','+_0x3848ee[_0xf4b1('0x77')];}var _0x3e3d31=this[_0xf4b1('0x38')][_0xf4b1('0x5a')](_0xf4b1('0xa8'),_0x7da84a);if(_0x3e3d31['result']===-0x1){return _0x3e3d31;}return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0xaa'),_0x7da84a));};AGIVertices['prototype'][_0xf4b1('0xc1')]=function(_0x51f326){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xc2'),_0x51f326['label']));if(!this['isConfigured'](_0x51f326[_0xf4b1('0x5e')])){return this['channel']['noop'](_0xf4b1('0xa7'));}var _0x3d5f41='\x22'+_0x51f326[_0xf4b1('0x5e')]+'\x22';if(this[_0xf4b1('0x86')](_0x51f326[_0xf4b1('0x77')])){_0x3d5f41+=','+_0x51f326[_0xf4b1('0x77')];}var _0x2d8e41=this[_0xf4b1('0x38')][_0xf4b1('0x5a')](_0xf4b1('0xa8'),_0x3d5f41);if(_0x2d8e41[_0xf4b1('0xa9')]===-0x1){return _0x2d8e41;}return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3d5f41));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0xc3')]=function(_0x91ef9c){logger['info'](util[_0xf4b1('0x29')](_0xf4b1('0xc4'),_0x91ef9c[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x91ef9c['grammar'])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xc5'));}var _0x5b0f25=_0x91ef9c[_0xf4b1('0xac')];if(this[_0xf4b1('0x86')](_0x91ef9c[_0xf4b1('0x77')])){_0x5b0f25+=','+_0x91ef9c[_0xf4b1('0x77')];}var _0x3cb2ea=this['channel']['exec'](_0xf4b1('0xc6'),_0x5b0f25);if(_0x3cb2ea[_0xf4b1('0xa9')]===-0x1){return _0x3cb2ea;}var _0x32cf8b=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xf4b1('0xc7'));if(_0x32cf8b['result']===-0x1){return _0x32cf8b;}var _0xbea107=this[_0xf4b1('0xa1')](_0xf4b1('0xc8'),_0xf4b1('0xc9'));if(_0xbea107[_0xf4b1('0xa9')]===-0x1){return _0xbea107;}var _0xec6c=this[_0xf4b1('0xa1')](_0xf4b1('0xca'),_0xf4b1('0xcb'));if(_0xec6c[_0xf4b1('0xa9')]===-0x1){return _0xec6c;}return this['channel'][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0xb0'),_0x5b0f25));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0xcc')]=function(_0x5601e4){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xcd'),_0x5601e4[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x5601e4[_0xf4b1('0xac')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xc5'));}var _0x56aaf5=_0x5601e4[_0xf4b1('0xac')];if(this[_0xf4b1('0x86')](_0x5601e4[_0xf4b1('0x77')])){_0x56aaf5+=','+_0x5601e4[_0xf4b1('0x77')];}var _0x280ea4=this[_0xf4b1('0x38')][_0xf4b1('0x5a')]('MRCPRecog',_0x56aaf5);if(_0x280ea4[_0xf4b1('0xa9')]===-0x1){return _0x280ea4;}var _0x4b56a0=this[_0xf4b1('0xa1')](_0xf4b1('0xce'),_0xf4b1('0xcf'));if(_0x4b56a0[_0xf4b1('0xa9')]===-0x1){return _0x4b56a0;}var _0x4db8d0=this['getAndSetVariable'](_0xf4b1('0xc8'),_0xf4b1('0xd0'));if(_0x4db8d0['result']===-0x1){return _0x4db8d0;}var _0x4b5653=this[_0xf4b1('0xa1')](_0xf4b1('0xca'),_0xf4b1('0xd1'));if(_0x4b5653[_0xf4b1('0xa9')]===-0x1){return _0x4b5653;}return this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x56aaf5));};AGIVertices['prototype'][_0xf4b1('0xd2')]=function(_0x20c774){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xd3'),_0x20c774[_0xf4b1('0x39')]));if(!this['isConfigured'](_0x20c774[_0xf4b1('0xd4')])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x20c774,_0xf4b1('0xd5'));}var _0x482cc7=this[_0xf4b1('0x17')][_0xf4b1('0x6f')](this,_0x20c774[_0xf4b1('0xd4')]);if(!_0x482cc7){return this[_0xf4b1('0x38')]['error'](_0x20c774,'no\x20odbc\x20database\x20found');}if(!this[_0xf4b1('0x86')](_0x20c774[_0xf4b1('0x30')])){return this['channel'][_0xf4b1('0x2d')](_0x20c774,_0xf4b1('0xd6'));}var _0x3f957e=_0x20c774[_0xf4b1('0x30')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util['format'](_0xf4b1('0xd7'),_0x3f957e));var _0x471473=this[_0xf4b1('0x2b')][_0xf4b1('0x6f')](this,_0x482cc7,_0x3f957e);this['createSquareDetailsReport'][_0xf4b1('0x6f')](this,_0x20c774,_0x3f957e);if(!this[_0xf4b1('0x86')](_0x20c774[_0xf4b1('0xd8')])){return this[_0xf4b1('0x38')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2a19b1=this[_0xf4b1('0xe')][_0xf4b1('0x6f')](this,_0x20c774[_0xf4b1('0xd8')]);if(!_0x2a19b1){return this['channel']['error'](_0x20c774,'no\x20variable\x20found');}var _0x2a3b1c=this;_0x471473[_0xf4b1('0xd9')](function(_0x55fcd6,_0x2fb811){Object[_0xf4b1('0xda')](_0x55fcd6)[_0xf4b1('0xd9')](function(_0x3275d3){_0x2a3b1c[_0xf4b1('0x38')][_0xf4b1('0x9d')](util[_0xf4b1('0x29')](_0xf4b1('0xdb'),_0x2a19b1,_0x2fb811,_0x3275d3),_0x55fcd6[_0x3275d3]);});});this[_0xf4b1('0x38')][_0xf4b1('0x9d')](util[_0xf4b1('0x29')](_0xf4b1('0xdc'),_0x2a19b1),_0x471473[_0xf4b1('0x9a')]);return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util['format'](_0xf4b1('0xdd'),_0x2a19b1));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0xde')]=function(_0x3ff747){logger['debug'](util[_0xf4b1('0x29')](_0xf4b1('0xdf'),_0x3ff747[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x3ff747[_0xf4b1('0xe0')])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x3ff747,_0xf4b1('0xe1'));}var _0x45ac3c=this[_0xf4b1('0x1a')][_0xf4b1('0x6f')](this,_0x3ff747['sip_id']);if(!_0x45ac3c){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x3ff747,_0xf4b1('0xe2'));}var _0x28ca60=this[_0xf4b1('0x38')][_0xf4b1('0x5a')](_0xf4b1('0xe3'),[util['format']('SIP/%s',_0x45ac3c),_0x3ff747['timeout'],_0x3ff747[_0xf4b1('0xe4')],_0x3ff747[_0xf4b1('0x65')]]);if(_0x28ca60['result']===-0x1){return _0x28ca60;}return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')]('Executed\x20command\x20%s',_0xf4b1('0xe3')));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0xe5')]=function(_0x1dcafb){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1dcafb[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x1dcafb['key'])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xe6'));}if(!this['isConfigured'](_0x1dcafb[_0xf4b1('0x5e')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xa7'));}this[_0xf4b1('0x38')][_0xf4b1('0xe7')]=!![];this[_0xf4b1('0x37')](_0x1dcafb);this[_0xf4b1('0x43')](_0x1dcafb[_0xf4b1('0x5e')],'in','','');this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')](_0xf4b1('0xe8'),_0x1dcafb[_0xf4b1('0x5e')]));var _0x40b11e=this[_0xf4b1('0x78')][_0xf4b1('0x6f')](this,_0x1dcafb);if(_0x40b11e){for(var _0x4828ac in _0x40b11e){if(_0x40b11e[_0xf4b1('0x95')](_0x4828ac)){this['channel']['setVariable'](util[_0xf4b1('0x29')](_0xf4b1('0xe9'),_0x4828ac[_0xf4b1('0x6b')]()),_0x40b11e[_0x4828ac]);}}this[_0xf4b1('0x43')](_0x40b11e[_0xf4b1('0xea')],'out',_0xf4b1('0xe5'),'');return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util['format']('Dialogflow\x20Result\x20%s',_0x40b11e['speech']));}return this['channel']['error'](_0x1dcafb,_0xf4b1('0xeb'));};AGIVertices[_0xf4b1('0x13')]['dialogflowV2']=function(_0x298587){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xec'),_0x298587[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x298587[_0xf4b1('0x7c')])){return this[_0xf4b1('0x38')]['noop'](_0xf4b1('0xed'));}if(!this[_0xf4b1('0x86')](_0x298587['client_email'])){return this[_0xf4b1('0x38')]['noop']('no\x20client_email\x20configured');}if(!this[_0xf4b1('0x86')](_0x298587[_0xf4b1('0x7e')])){return this['channel'][_0xf4b1('0xa6')](_0xf4b1('0xee'));}if(!this['isConfigured'](_0x298587['dialogflowV2_language'])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')]('no\x20anguage\x20configured');}if(!this[_0xf4b1('0x86')](_0x298587[_0xf4b1('0x5e')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xa7'));}this['channel']['bot']=!![];this[_0xf4b1('0x37')](_0x298587);this[_0xf4b1('0x43')](_0x298587[_0xf4b1('0x5e')],'in','','');this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')](_0xf4b1('0xef'),_0x298587[_0xf4b1('0x5e')]));var _0x445647=this[_0xf4b1('0x7b')][_0xf4b1('0x6f')](this,_0x298587);if(_0x445647){for(var _0x463623 in _0x445647){if(_0x445647[_0xf4b1('0x95')](_0x463623)){if(_0x463623!=='providerResponse'){this[_0xf4b1('0x38')][_0xf4b1('0x9d')](util['format'](_0xf4b1('0xe9'),_0x463623[_0xf4b1('0x6b')]()),_0x445647[_0x463623]);}}}this[_0xf4b1('0x43')](_0x445647[_0xf4b1('0xea')],_0xf4b1('0xf0'),_0xf4b1('0xf1'),_0x445647[_0xf4b1('0xf2')]);return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util['format'](_0xf4b1('0xf3'),_0x445647[_0xf4b1('0xea')]));}return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x298587,_0xf4b1('0xf4'));};AGIVertices['prototype'][_0xf4b1('0xf5')]=function(_0x2bb38b){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0xf6'),_0x2bb38b[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x2bb38b['ndauth_url'])){return this[_0xf4b1('0x38')]['noop'](_0xf4b1('0xf7'));}if(!this[_0xf4b1('0x86')](_0x2bb38b[_0xf4b1('0xf8')])){return this[_0xf4b1('0x38')]['noop'](_0xf4b1('0xf9'));}if(!this['isConfigured'](_0x2bb38b[_0xf4b1('0xfa')])){return this['channel']['noop'](_0xf4b1('0xfb'));}if(!this[_0xf4b1('0x86')](_0x2bb38b[_0xf4b1('0xfc')])){return this['channel']['noop'](_0xf4b1('0xa7'));}this[_0xf4b1('0x38')][_0xf4b1('0xe7')]=!![];this[_0xf4b1('0x37')](_0x2bb38b);this[_0xf4b1('0x43')](_0x2bb38b[_0xf4b1('0x5e')],'in','','');this['channel']['noop'](util[_0xf4b1('0x29')](_0xf4b1('0xfd'),_0x2bb38b[_0xf4b1('0x5e')]));var _0x21fc97=this[_0xf4b1('0x7f')][_0xf4b1('0x6f')](this,_0x2bb38b);if(_0x21fc97){for(var _0x48bfa4 in _0x21fc97){if(_0x21fc97['hasOwnProperty'](_0x48bfa4)){this['channel']['setVariable'](util['format']('SESTEK_NDA_%s',_0x48bfa4['toUpperCase']()),_0x21fc97[_0x48bfa4]);}}this[_0xf4b1('0x43')](_0x21fc97[_0xf4b1('0xea')],'out',_0xf4b1('0xf5'),'');if(_0x21fc97[_0xf4b1('0xfe')]){this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')](_0xf4b1('0xff'),_0x21fc97[_0xf4b1('0xfe')]));var _0x545185=this[_0xf4b1('0x38')][_0xf4b1('0x100')](_0x21fc97[_0xf4b1('0xfe')]);try{fs[_0xf4b1('0x101')](_0x21fc97['audiofile']+_0xf4b1('0x102'));}catch(_0x5c21ae){logger['error'](_0x5c21ae);}return _0x545185;}else{return this['channel'][_0xf4b1('0xa6')](util['format'](_0xf4b1('0x103'),_0x21fc97[_0xf4b1('0xea')]));}}return this['channel'][_0xf4b1('0x2d')](_0x2bb38b,_0xf4b1('0x104'));};AGIVertices[_0xf4b1('0x13')]['end']=function(_0x363c3a){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x105'),_0x363c3a[_0xf4b1('0x39')]));return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0x106'));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x107')]=function(_0x30f126){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x108'),_0x30f126['label']));var _0x107233='';if(_0x30f126[_0xf4b1('0x109')]){if(!this['isConfigured'](_0x30f126[_0xf4b1('0x109')])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x30f126,_0xf4b1('0x10a'));}else{var _0xa8df7d=parseInt(_0x30f126['trunk_id'],0xa);if(isNaN(_0xa8df7d)){_0x107233=_0x30f126[_0xf4b1('0x109')];}else{_0x107233=this['getTrunk'][_0xf4b1('0x6f')](this,_0x30f126[_0xf4b1('0x109')]);if(!_0x107233){return this['channel']['error'](_0x30f126,'no\x20trunk\x20found');}}}}else if(_0x30f126[_0xf4b1('0x10b')]){_0x107233=_0x30f126[_0xf4b1('0x10b')];}else{return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x30f126,_0xf4b1('0x10a'));}var _0x1aa3ba=this[_0xf4b1('0x38')][_0xf4b1('0x5a')](_0xf4b1('0xe3'),[util['format'](_0xf4b1('0x10c'),_0x107233,_0x30f126['phone']),_0x30f126[_0xf4b1('0x68')],_0x30f126['opts'],_0x30f126[_0xf4b1('0x65')]]);if(_0x1aa3ba[_0xf4b1('0xa9')]===-0x1){return _0x1aa3ba;}return this['channel'][_0xf4b1('0xa6')](util['format'](_0xf4b1('0x10d'),_0xf4b1('0xe3')));};AGIVertices[_0xf4b1('0x13')]['finally']=function(_0x18593f){logger[_0xf4b1('0x2f')](util['format'](_0xf4b1('0x10e'),_0x18593f[_0xf4b1('0x39')]));return this['channel'][_0xf4b1('0xa6')](_0xf4b1('0x10f'));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0xc')]=function(_0x188f88){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x188f88[_0xf4b1('0x39')]));if(_0x188f88[_0xf4b1('0xa4')]===0x0){return this[_0xf4b1('0x110')](_0x188f88);}_0x188f88['retry']-=0x1;if(!this[_0xf4b1('0x86')](_0x188f88[_0xf4b1('0x111')])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x188f88,_0xf4b1('0x112'));}var _0xf8d4c7=this[_0xf4b1('0x113')][_0xf4b1('0x6f')](this,_0x188f88[_0xf4b1('0x111')]);if(!_0xf8d4c7){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x188f88,'no\x20file\x20audio\x20found');}if(!this[_0xf4b1('0x86')](_0x188f88[_0xf4b1('0xd8')])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0xf4b1('0x114'));}var _0x3c6efa=this[_0xf4b1('0x38')][_0xf4b1('0x115')](_0xf8d4c7,_0x188f88[_0xf4b1('0x116')],_0x188f88['maxdigit']);var _0x222bf9=_0x3c6efa[_0xf4b1('0xa9')]?_0x3c6efa['result'][_0xf4b1('0x4c')]():'';logger[_0xf4b1('0x2f')](_0xf4b1('0x117'),JSON[_0xf4b1('0x118')](_0x3c6efa));if(_0x3c6efa['result']===-0x1){this[_0xf4b1('0x37')]['sync'](this,_0x188f88,_0x222bf9);return _0x3c6efa;}else if(_0x3c6efa[_0xf4b1('0xa3')]===_0xf4b1('0x68')){_0x3c6efa[_0xf4b1('0xa9')]=_0x222bf9[_0xf4b1('0x9a')]>=parseInt(_0x188f88[_0xf4b1('0x119')])?'x':'i';}else{_0x3c6efa[_0xf4b1('0xa9')]=_0x222bf9['length']>=parseInt(_0x188f88[_0xf4b1('0x119')])&&_0x222bf9[_0xf4b1('0x9a')]<=parseInt(_0x188f88[_0xf4b1('0x11a')])?'x':'i';}var _0x5a6261=this['getVariable'][_0xf4b1('0x6f')](this,_0x188f88[_0xf4b1('0xd8')]);if(!_0x5a6261){return this['channel'][_0xf4b1('0x2d')](_0x188f88,_0xf4b1('0x11b'));}this['channel'][_0xf4b1('0x9d')](_0x5a6261,_0x222bf9);if(this[_0xf4b1('0x86')](_0x188f88[_0xf4b1('0x11c')])){var _0x534569=parseInt(_0x188f88[_0xf4b1('0x11c')],0xa);var _0x4dfc54=rs['generate']({'charset':'*','length':_0x534569});var _0x4a35b5=_0x222bf9[_0xf4b1('0x9a')];if(_0x4a35b5>0x0){if(_0x4a35b5>_0x534569){this[_0xf4b1('0x37')][_0xf4b1('0x6f')](this,_0x188f88,_0x188f88[_0xf4b1('0x11d')]===_0xf4b1('0x11e')?_0x4dfc54+_0x222bf9[_0xf4b1('0x11f')](_0x534569):_0x222bf9[_0xf4b1('0x11f')](0x0,_0x4a35b5-_0x534569)+_0x4dfc54);}else{this[_0xf4b1('0x37')][_0xf4b1('0x6f')](this,_0x188f88,rs[_0xf4b1('0x120')]({'charset':'*','length':_0x4a35b5}));}}else{this['createSquareDetailsReport']['sync'](this,_0x188f88,'');}}else{this[_0xf4b1('0x37')][_0xf4b1('0x6f')](this,_0x188f88,_0x222bf9);}return _0x3c6efa;};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x121')]=function(_0x5c9abd){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x5c9abd[_0xf4b1('0x39')]));return this[_0xf4b1('0xc')](_0x5c9abd);};AGIVertices[_0xf4b1('0x13')]['goal']=function(_0x682d83){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x682d83[_0xf4b1('0x39')]));this[_0xf4b1('0x37')][_0xf4b1('0x6f')](this,_0x682d83,_0x682d83[_0xf4b1('0x122')]);return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x123'),_0x682d83[_0xf4b1('0x122')]));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x124')]=function(_0x3b092f){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x3b092f['label']));if(!this[_0xf4b1('0x86')](_0x3b092f[_0xf4b1('0x125')])||!this[_0xf4b1('0x86')](_0x3b092f[_0xf4b1('0x89')])){return this[_0xf4b1('0x38')]['noop'](_0xf4b1('0x126'));}if(!this[_0xf4b1('0x86')](_0x3b092f[_0xf4b1('0x5e')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xa7'));}this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')](_0xf4b1('0x127'),_0x3b092f['text']));var _0x421489=this[_0xf4b1('0x88')]['sync'](this,_0x3b092f);if(_0x421489){this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x421489));var _0x189b7a=this[_0xf4b1('0x38')]['streamFile'](_0x421489);try{fs[_0xf4b1('0x101')](_0x421489+_0xf4b1('0x102'));}catch(_0x19e2af){logger[_0xf4b1('0x2d')](_0x19e2af);}return _0x189b7a;}return this[_0xf4b1('0x38')]['error'](_0x3b092f,_0xf4b1('0x128'));};AGIVertices['prototype'][_0xf4b1('0x129')]=function(_0x2f9be){logger[_0xf4b1('0x2f')](util['format'](_0xf4b1('0x12a'),_0x2f9be[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x2f9be['aws_access_key_id'])||!this['isConfigured'](_0x2f9be[_0xf4b1('0x89')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xf4b1('0x86')](_0x2f9be[_0xf4b1('0x8e')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0x12b'));}if(!this['isConfigured'](_0x2f9be['text'])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')]('no\x20text\x20configured');}this[_0xf4b1('0x38')][_0xf4b1('0xe7')]=!![];this['createSquareDetailsReport'](_0x2f9be);this[_0xf4b1('0x43')](_0x2f9be[_0xf4b1('0x5e')],'in','','');this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x12c'),_0x2f9be[_0xf4b1('0x5e')]));var _0x7c58da=this[_0xf4b1('0x8d')][_0xf4b1('0x6f')](this,_0x2f9be);if(_0x7c58da){for(var _0x5499ec in _0x7c58da){if(_0x7c58da[_0xf4b1('0x95')](_0x5499ec)&&_['isString'](_0x7c58da[_0x5499ec])){this[_0xf4b1('0x38')]['setVariable'](util[_0xf4b1('0x29')]('AWS_LEX_%s',_0x5499ec[_0xf4b1('0x6b')]()),_0x7c58da[_0x5499ec]);}}if(_[_0xf4b1('0x46')](_0x7c58da['message'])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x7c58da[_0xf4b1('0x75')],_0xf4b1('0xf0'),_0xf4b1('0x12d'),'');return this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x7c58da[_0xf4b1('0x75')]));}}return this['channel'][_0xf4b1('0x2d')](_0x2f9be,_0xf4b1('0x12e'));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x12f')]=function(_0x2d5a57){logger['info'](util[_0xf4b1('0x29')](_0xf4b1('0x130'),_0x2d5a57[_0xf4b1('0x39')],_0x2d5a57[_0xf4b1('0x68')]));if(!this['isConfigured'](_0x2d5a57[_0xf4b1('0x79')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xe6'));}var _0x207023=_0xf4b1('0x131');var _0xa17629=util[_0xf4b1('0x29')](_0xf4b1('0x132'),FILES_PATH,rs[_0xf4b1('0x120')](0x4));var _0x3ef386=util['format'](_0xf4b1('0x9c'),_0xa17629,_0x207023);var _0x435252=!![];if(_0x2d5a57[_0xf4b1('0x133')]===_0xf4b1('0x134')){_0x435252=![];}var _0x50f378=this['channel'][_0xf4b1('0x135')](_0xa17629,_0x207023,_0x2d5a57[_0xf4b1('0x136')],_0x2d5a57[_0xf4b1('0x68')],undefined,_0x435252);if(_0x50f378[_0xf4b1('0xa9')]!==-0x1){this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x137'),_0x3ef386));var _0x2a19f2=this[_0xf4b1('0x8f')]['sync'](this,_0x2d5a57,_0x3ef386);if(_0x2a19f2){for(var _0x2431e9 in _0x2a19f2){if(_0x2a19f2[_0xf4b1('0x95')](_0x2431e9)){this[_0xf4b1('0x38')][_0xf4b1('0x9d')](util[_0xf4b1('0x29')](_0xf4b1('0x138'),_0x2431e9[_0xf4b1('0x6b')]()),_0x2a19f2[_0x2431e9]);}}return this['channel'][_0xf4b1('0xa6')](util['format'](_0xf4b1('0x139'),JSON[_0xf4b1('0x118')](_0x2a19f2)));}}return _0x50f378;};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x13a')]=function(_0x307d85){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x13b'),_0x307d85[_0xf4b1('0x39')]));if(!this['isConfigured'](_0x307d85['appid'])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0x13c'));}if(!this[_0xf4b1('0x86')](_0x307d85['appsecret'])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0x13d'));}var _0x56bb3d=_0xf4b1('0x131');var _0x8fbede=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xf4b1('0x120')](0x4));var _0x4ff353=util[_0xf4b1('0x29')](_0xf4b1('0x9c'),_0x8fbede,_0x56bb3d);var _0xb7dc60=!![];if(_0x307d85[_0xf4b1('0x133')]===_0xf4b1('0x134')){_0xb7dc60=![];}var _0x518d8d=this['channel'][_0xf4b1('0x135')](_0x8fbede,_0x56bb3d,_0x307d85[_0xf4b1('0x136')],_0x307d85[_0xf4b1('0x68')],undefined,_0xb7dc60);if(_0x518d8d['result']!==-0x1){this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')](_0xf4b1('0x13e'),_0x4ff353));var _0x51bc66=this[_0xf4b1('0x91')][_0xf4b1('0x6f')](this,_0x307d85,_0x4ff353);if(_0x51bc66){for(var _0x4730d9 in _0x51bc66){if(_0x51bc66[_0xf4b1('0x95')](_0x4730d9)){this[_0xf4b1('0x38')][_0xf4b1('0x9d')](util[_0xf4b1('0x29')](_0xf4b1('0x13f'),_0x4730d9[_0xf4b1('0x6b')]()),_0x51bc66[_0x4730d9]);}}return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x140'),JSON['stringify'](_0x51bc66)));}}return _0x518d8d;};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x141')]=function(_0x27d915){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x142'),_0x27d915[_0xf4b1('0x39')]));return this[_0xf4b1('0x38')][_0xf4b1('0x143')](_0x27d915[_0xf4b1('0x144')],_0x27d915['extension'],_0x27d915[_0xf4b1('0x3e')]);};AGIVertices[_0xf4b1('0x13')]['gotoif']=function(_0x9734c3){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x145'),_0x9734c3[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x9734c3['condition'])){return this['channel'][_0xf4b1('0x2d')](_0x9734c3,'no\x20condition\x20configured');}try{var _0x102e5e=eval(_0x9734c3[_0xf4b1('0x146')])?_0xf4b1('0x147'):_0xf4b1('0x148');this['channel']['noop'](util[_0xf4b1('0x29')](_0xf4b1('0x149'),_0x9734c3[_0xf4b1('0x146')],_0x102e5e));return{'code':0xc8,'result':_0x102e5e};}catch(_0x387dfd){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x14a')]=function(_0x4040c0){logger[_0xf4b1('0x2f')](util['format'](_0xf4b1('0x14b'),_0x4040c0[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x4040c0[_0xf4b1('0x14c')])){return this[_0xf4b1('0x38')]['error'](_0x4040c0,_0xf4b1('0x14d'));}var _0x4e1ee3=this[_0xf4b1('0x14e')][_0xf4b1('0x6f')](this,_0x4040c0['interval_id']);if(!_0x4e1ee3){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x4040c0,_0xf4b1('0x14f'));}for(var _0x35440b=0x0;_0x35440b<_0x4e1ee3[_0xf4b1('0x9a')];_0x35440b+=0x1){var _0x31c86a=this['channel']['getVariable'](util[_0xf4b1('0x29')]('IFTIME(%s?true:false)',_0x4e1ee3[_0x35440b]));if(_0x31c86a[_0xf4b1('0xa9')]===-0x1){return _0x31c86a;}logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x150'),_0x4e1ee3[_0x35440b],_0x31c86a[_0xf4b1('0xa3')]));if(_0x31c86a['extra']===_0xf4b1('0x147')){logger[_0xf4b1('0x2f')](util['format'](_0xf4b1('0x150'),_0x4e1ee3[_0x35440b],_0xf4b1('0x147')));this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')]('IFTIME\x20%s\x20%s',_0x4e1ee3[_0x35440b],'true'));return{'code':0xc8,'result':'true'};}else{logger['info'](util['format'](_0xf4b1('0x150'),_0x4e1ee3[_0x35440b],_0xf4b1('0x148')));this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')](_0xf4b1('0x150'),_0x4e1ee3[_0x35440b],_0xf4b1('0x148')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x151')]=function(_0x4fa011){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x152'),_0x4fa011[_0xf4b1('0x39')]));return this[_0xf4b1('0x38')][_0xf4b1('0x151')]();};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x153')]=function(_0x560217){logger['info'](util[_0xf4b1('0x29')](_0xf4b1('0x154'),_0x560217[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x560217[_0xf4b1('0x79')])){return this[_0xf4b1('0x38')]['noop'](_0xf4b1('0xe6'));}var _0x24d5ec='wav';var _0x45349b=util[_0xf4b1('0x29')](_0xf4b1('0x132'),FILES_PATH,rs[_0xf4b1('0x120')](0x4));var _0x35b9a7=util['format'](_0xf4b1('0x9c'),_0x45349b,_0x24d5ec);var _0x9d3fa=!![];if(_0x560217[_0xf4b1('0x133')]===_0xf4b1('0x134')){_0x9d3fa=![];}var _0x382ca4=this[_0xf4b1('0x38')][_0xf4b1('0x135')](_0x45349b,_0x24d5ec,_0x560217[_0xf4b1('0x136')],_0x560217[_0xf4b1('0x68')],undefined,_0x9d3fa);if(_0x382ca4[_0xf4b1('0xa9')]!==-0x1){this[_0xf4b1('0x38')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x35b9a7));var _0x34dc11=this[_0xf4b1('0x84')][_0xf4b1('0x6f')](this,_0x560217,_0x35b9a7);if(_0x34dc11){for(var _0x7854dd in _0x34dc11){if(_0x34dc11['hasOwnProperty'](_0x7854dd)){this['channel'][_0xf4b1('0x9d')](util[_0xf4b1('0x29')]('ISPEECH_ASR_%s',_0x7854dd[_0xf4b1('0x6b')]()),_0x34dc11[_0x7854dd]);}}return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x155'),JSON[_0xf4b1('0x118')](_0x34dc11)));}}return _0x382ca4;};AGIVertices['prototype'][_0xf4b1('0x156')]=function(_0x36fb89){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x157'),_0x36fb89['label']));if(!this[_0xf4b1('0x86')](_0x36fb89[_0xf4b1('0x79')])){return this[_0xf4b1('0x38')]['noop'](_0xf4b1('0xe6'));}if(!this[_0xf4b1('0x86')](_0x36fb89[_0xf4b1('0x5e')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xa7'));}this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')](_0xf4b1('0x158'),_0x36fb89[_0xf4b1('0x5e')]));var _0x26b29f=this['ispeechTTS'][_0xf4b1('0x6f')](this,_0x36fb89);if(_0x26b29f){this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')]('ispeech\x20%s\x20file\x20created',_0x26b29f));var _0x21b3fe=this[_0xf4b1('0x38')][_0xf4b1('0x100')](_0x26b29f,_0x36fb89[_0xf4b1('0x136')]);try{fs['unlink'](_0x26b29f+_0xf4b1('0x102'));}catch(_0x1c0b93){logger[_0xf4b1('0x2d')](_0x1c0b93);}return _0x21b3fe;}return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x36fb89,_0xf4b1('0x159'));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x15a')]=function(_0xb284fe){logger['info'](util[_0xf4b1('0x29')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xb284fe[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0xb284fe[_0xf4b1('0x15b')])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0xb284fe,_0xf4b1('0x15c'));}logger[_0xf4b1('0x2f')](util['format'](_0xf4b1('0x15d'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0xb284fe['findBy']));var _0x2088e4=this[_0xf4b1('0x55')][_0xf4b1('0x6f')](this,_0xb284fe[_0xf4b1('0x15b')]);if(_0x2088e4){logger['info'](util[_0xf4b1('0x29')](_0xf4b1('0x15e'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0xb284fe[_0xf4b1('0x15b')]));this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util['format'](_0xf4b1('0x15e'),this[_0xf4b1('0x38')]['callerid'],_0xb284fe[_0xf4b1('0x15b')]));return{'code':0xc8,'result':_0xf4b1('0x15f')};}else{logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x160'),this['channel'][_0xf4b1('0x52')],_0xb284fe[_0xf4b1('0x15b')]));this['channel'][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x160'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0xb284fe[_0xf4b1('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xf4b1('0x13')]['logout']=function(_0x4b5002){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x161'),_0x4b5002[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x4b5002[_0xf4b1('0x15b')])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x4b5002,_0xf4b1('0x15c'));}logger[_0xf4b1('0x2f')](util['format'](_0xf4b1('0x15d'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x4b5002['findBy']));var _0x1cf9c4=this['agentLogout'][_0xf4b1('0x6f')](this,_0x4b5002[_0xf4b1('0x15b')]);if(_0x1cf9c4){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x15e'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x4b5002[_0xf4b1('0x15b')]));this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x15e'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x4b5002[_0xf4b1('0x15b')]));return{'code':0xc8,'result':_0xf4b1('0x15f')};}else{logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf4b1('0x38')]['callerid'],_0x4b5002[_0xf4b1('0x15b')]));this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xf4b1('0x52')],_0x4b5002['findBy']));return{'code':0xc8,'result':_0xf4b1('0x162')};}};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x163')]=function(_0x4be13e){logger[_0xf4b1('0x2f')](util['format'](_0xf4b1('0x164'),_0x4be13e['label']));if(!this[_0xf4b1('0x86')](_0x4be13e[_0xf4b1('0x165')])){return this[_0xf4b1('0x38')]['error'](_0x4be13e,_0xf4b1('0x166'));}this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x167'),_0x4be13e[_0xf4b1('0x165')]));var _0x3c8fb4=eval(_0x4be13e[_0xf4b1('0x165')]);if(!this[_0xf4b1('0x86')](_0x4be13e[_0xf4b1('0xd8')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0x114'));}var _0x403dce=this[_0xf4b1('0xe')]['sync'](this,_0x4be13e[_0xf4b1('0xd8')]);if(!_0x403dce){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x4be13e,'no\x20variable\x20found');}if(_[_0xf4b1('0x99')](_0x3c8fb4)){var _0x2fa3af=this;_0x3c8fb4[_0xf4b1('0xd9')](function(_0x41fdcb,_0x5f5a03){_0x2fa3af[_0xf4b1('0x38')][_0xf4b1('0x9d')](util[_0xf4b1('0x29')](_0xf4b1('0x168'),_0x403dce,_0x5f5a03),_0x41fdcb);});return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')]('variable\x20%s[key]\x20set',_0x403dce));}else{return this[_0xf4b1('0x38')][_0xf4b1('0x9d')](_0x403dce,_0x3c8fb4);}};AGIVertices[_0xf4b1('0x13')]['menu']=function(_0x488aee){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x169'),_0x488aee[_0xf4b1('0x39')]));if(_0x488aee[_0xf4b1('0xa4')]===0x0){return this[_0xf4b1('0x110')](_0x488aee);}_0x488aee[_0xf4b1('0xa4')]-=0x1;if(!this['isConfigured'](_0x488aee[_0xf4b1('0x111')])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x488aee,_0xf4b1('0x112'));}var _0x126977=this[_0xf4b1('0x113')][_0xf4b1('0x6f')](this,_0x488aee[_0xf4b1('0x111')]);if(!_0x126977){return this['channel'][_0xf4b1('0x2d')](_0x488aee,'no\x20file\x20audio\x20found');}var _0x31a60b=this[_0xf4b1('0x38')]['getData'](_0x126977,_0x488aee[_0xf4b1('0x116')],_0x488aee[_0xf4b1('0x16a')]);var _0x1762c3=_0x31a60b['result'];if(_0x31a60b[_0xf4b1('0xa9')]===-0x1){this[_0xf4b1('0x37')][_0xf4b1('0x6f')](this,_0x488aee,'-1');return _0x31a60b;}else if(_0x31a60b[_0xf4b1('0xa3')]===_0xf4b1('0x68')){_0x31a60b[_0xf4b1('0xa9')]=_0x31a60b['result'][_0xf4b1('0x9a')]>0x0?_0x31a60b[_0xf4b1('0xa9')]:'t';}else if(_[_0xf4b1('0x45')](_0x31a60b['result'])){_0x31a60b[_0xf4b1('0xa9')]='#';_0x1762c3='#';}if(!this[_0xf4b1('0x86')](_0x488aee[_0xf4b1('0xd8')])){this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0x114'));}else{var _0x26f114=this['getVariable'][_0xf4b1('0x6f')](this,_0x488aee[_0xf4b1('0xd8')]);if(!_0x26f114){return this[_0xf4b1('0x38')]['error'](_0x488aee,_0xf4b1('0x11b'));}this[_0xf4b1('0x38')]['setVariable'](_0x26f114,_0x1762c3);}this['createSquareDetailsReport'][_0xf4b1('0x6f')](this,_0x488aee,_0x1762c3);return _0x31a60b;};AGIVertices['prototype']['noop']=function(_0xddb6d0){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x16b'),_0xddb6d0[_0xf4b1('0x39')]));return this[_0xf4b1('0x38')]['noop'](_0xddb6d0['output']||_0xddb6d0[_0xf4b1('0x39')]);};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x16c')]=function(_0x3f9dac){logger['info'](util[_0xf4b1('0x29')](_0xf4b1('0x16d'),_0x3f9dac['label']));if(!this[_0xf4b1('0x86')](_0x3f9dac[_0xf4b1('0x15b')])){return this['channel'][_0xf4b1('0x2d')](_0x3f9dac,'no\x20find\x20by\x20configured');}logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x15d'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x3f9dac[_0xf4b1('0x15b')]));var _0x10041e=this[_0xf4b1('0x4e')][_0xf4b1('0x6f')](this,_0x3f9dac[_0xf4b1('0x16e')]);var _0x2a3e94=this['agentPause'][_0xf4b1('0x6f')](this,_0x3f9dac[_0xf4b1('0x15b')],_0x10041e);if(_0x2a3e94){logger[_0xf4b1('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x3f9dac['findBy']));this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')](_0xf4b1('0x15e'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x3f9dac[_0xf4b1('0x15b')]));return{'code':0xc8,'result':_0xf4b1('0x15f')};}else{logger['info'](util[_0xf4b1('0x29')](_0xf4b1('0x160'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x3f9dac[_0xf4b1('0x15b')]));this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x3f9dac['findBy']));return{'code':0xc8,'result':_0xf4b1('0x162')};}};AGIVertices[_0xf4b1('0x13')]['playback']=function(_0x597140){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x16f'),_0x597140[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x597140[_0xf4b1('0x111')])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x597140,_0xf4b1('0x112'));}var _0x5194f1=this[_0xf4b1('0x113')][_0xf4b1('0x6f')](this,_0x597140[_0xf4b1('0x111')]);if(!_0x5194f1){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x597140,'no\x20file\x20audio\x20found');}var _0x3f3c4a=this['channel']['exec']('PLAYBACK',[_0x5194f1,_0x597140[_0xf4b1('0xe4')]]);if(_0x3f3c4a[_0xf4b1('0xa9')]===-0x1){return _0x3f3c4a;}return this['channel']['noop'](util[_0xf4b1('0x29')](_0xf4b1('0xbf'),_0xf4b1('0x170'),_0x5194f1));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x171')]=function(_0x177b6b){logger['info'](util[_0xf4b1('0x29')](_0xf4b1('0x172'),_0x177b6b[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x177b6b[_0xf4b1('0x173')])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x177b6b,_0xf4b1('0x174'));}var _0x37d74e='';var _0x5c2885=parseInt(_0x177b6b[_0xf4b1('0x173')],0xa);if(isNaN(_0x5c2885)){_0x37d74e=_0x177b6b[_0xf4b1('0x173')];}else{_0x37d74e=this[_0xf4b1('0x14')][_0xf4b1('0x6f')](this,_0x177b6b[_0xf4b1('0x173')]);if(!_0x37d74e){return this['channel'][_0xf4b1('0x2d')](_0x177b6b,_0xf4b1('0x175'));}}var _0x42e0db='';if(this[_0xf4b1('0x86')](_0x177b6b[_0xf4b1('0x111')])){var _0x41540b=this['getSound'][_0xf4b1('0x6f')](this,_0x177b6b['file_id']);if(_0x41540b){_0x42e0db=_0x41540b;}}this[_0xf4b1('0x37')]['sync'](this,_0x177b6b,_0x37d74e);if(_0x177b6b[_0xf4b1('0xe4')][_0xf4b1('0x176')]('x')<0x0){_0x177b6b[_0xf4b1('0xe4')]+='x';}if(_0x177b6b[_0xf4b1('0xe4')][_0xf4b1('0x176')]('X')<0x0){_0x177b6b['opts']+='X';}this['channel'][_0xf4b1('0x9d')](_0xf4b1('0x177'),_0x37d74e?_0x37d74e[_0xf4b1('0x178')]():'');var _0x5a3f90=this[_0xf4b1('0x38')][_0xf4b1('0x5a')]('QUEUE',[_0x37d74e,_0x177b6b[_0xf4b1('0xe4')],_0x177b6b[_0xf4b1('0x65')],_0x42e0db,_0x177b6b[_0xf4b1('0x68')],_0x177b6b[_0xf4b1('0x7')],_0x177b6b[_0xf4b1('0x179')],_0x177b6b['gosub'],'',_0x177b6b[_0xf4b1('0x17a')]]);if(_0x5a3f90['result']===-0x1){return _0x5a3f90;}return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0xbf'),_0xf4b1('0x17b'),_0x37d74e));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x17c')]=function(_0x53d310){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x17d'),_0x53d310[_0xf4b1('0x39')]));var _0xb98c29=_0x53d310['recordingFormat']||_0xf4b1('0x131');var _0x153ea6=util[_0xf4b1('0x29')](_0xf4b1('0x17e'),this['channel'][_0xf4b1('0x3c')],rs[_0xf4b1('0x120')](0x5));var _0x4209b9=util['format'](_0xf4b1('0x17f'),FILES_PATH,_0x153ea6,_0xb98c29);var _0x1b9b2a=util[_0xf4b1('0x29')]('%s/recordings/%s',FILES_PATH,_0x153ea6);this[_0xf4b1('0x3b')]['sync'](this,_0x53d310,_0x153ea6,_0x4209b9);this[_0xf4b1('0x38')][_0xf4b1('0x9d')](_0xf4b1('0x180'),_0x153ea6);logger['info'](_0xf4b1('0x181'),_0x1b9b2a,_0xb98c29,_0x53d310[_0xf4b1('0x182')],_0x53d310[_0xf4b1('0x68')]);return this[_0xf4b1('0x38')][_0xf4b1('0x135')](_0x1b9b2a,_0xb98c29,_0x53d310[_0xf4b1('0x182')],_0x53d310[_0xf4b1('0x68')],undefined,!![]);};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x183')]=function(_0x3ee55a){logger['info'](util['format'](_0xf4b1('0x184'),_0x3ee55a[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x3ee55a['url'])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0x185'));}var _0x57586e=this['restAPI'][_0xf4b1('0x6f')](this,_0x3ee55a);logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x186'),util[_0xf4b1('0x187')](_0x57586e,{'showHidden':![],'depth':null})));if(!this[_0xf4b1('0x86')](_0x3ee55a[_0xf4b1('0xd8')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x39ae94=this[_0xf4b1('0xe')][_0xf4b1('0x6f')](this,_0x3ee55a[_0xf4b1('0xd8')]);if(!_0x39ae94){return this['channel']['error'](_0x3ee55a,'no\x20variable\x20found');}this[_0xf4b1('0x38')][_0xf4b1('0x9d')](util[_0xf4b1('0x29')](_0xf4b1('0x188'),_0x39ae94),_0x57586e[_0xf4b1('0x73')]?_0x57586e[_0xf4b1('0x73')]:_0xf4b1('0x189'));this[_0xf4b1('0x38')][_0xf4b1('0x9d')](util[_0xf4b1('0x29')](_0xf4b1('0x18a'),_0x39ae94),_0x57586e[_0xf4b1('0x74')]?_0x57586e[_0xf4b1('0x74')]:'OK');if(_0x57586e[_0xf4b1('0x6c')]){try{this[_0xf4b1('0x9b')](_0x57586e[_0xf4b1('0x6c')],_0x39ae94);}catch(_0x2d5d39){logger[_0xf4b1('0x2d')](util['format'](_0xf4b1('0x18b'),_0x39ae94));}}return this['channel'][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0xdd'),_0x39ae94));};AGIVertices['prototype'][_0xf4b1('0x18c')]=function(_0x5bf409){logger['info'](util['format'](_0xf4b1('0x18d'),_0x5bf409[_0xf4b1('0x39')]));return this[_0xf4b1('0x38')]['sayDigits'](_0x5bf409[_0xf4b1('0x18e')][_0xf4b1('0x18f')](/\s+/g,''),_0x5bf409['escape_digits']);};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x190')]=function(_0x4c805d){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x191'),_0x4c805d[_0xf4b1('0x39')]));return this[_0xf4b1('0x38')][_0xf4b1('0x192')](_0x4c805d['number'][_0xf4b1('0x18f')](/\s+/g,''),_0x4c805d[_0xf4b1('0x182')]);};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x193')]=function(_0x3ba9cb){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x194'),_0x3ba9cb['label']));return this['channel'][_0xf4b1('0x195')](_0x3ba9cb[_0xf4b1('0x5e')],_0x3ba9cb[_0xf4b1('0x182')]);};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x196')]=function(_0x369d67){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x197'),_0x369d67[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x369d67[_0xf4b1('0x198')])){return this[_0xf4b1('0x38')]['noop'](_0xf4b1('0x199'));}var _0x3f1267=this['getMailAccount'][_0xf4b1('0x6f')](this,_0x369d67[_0xf4b1('0x198')]);if(!_0x3f1267||!_0x3f1267[_0xf4b1('0x19a')]){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x369d67,_0xf4b1('0x19b'));}var _0x1d09bf={'from':util[_0xf4b1('0x29')](_0xf4b1('0x19c'),_0x3f1267[_0xf4b1('0x11')],_0x3f1267[_0xf4b1('0x19d')]||_0x3f1267[_0xf4b1('0x19a')][_0xf4b1('0x19e')]),'to':_0x369d67['to']||'','cc':_0x369d67['cc']||'','bcc':_0x369d67[_0xf4b1('0x19f')]||'','subject':_0x369d67['subject'],'html':_0x369d67[_0xf4b1('0x5e')],'text':_0x369d67[_0xf4b1('0x5e')]};if(this[_0xf4b1('0x86')](_0x369d67[_0xf4b1('0x1a0')])){}logger[_0xf4b1('0x1a1')](_0xf4b1('0x1a2'),JSON[_0xf4b1('0x118')](_0x1d09bf));this[_0xf4b1('0x37')]['sync'](this,_0x369d67,_0x369d67[_0xf4b1('0x198')]);this['channel'][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x1a3'),_0x3f1267[_0xf4b1('0x11')]));this[_0xf4b1('0x23')][_0xf4b1('0x6f')](this,_0x3f1267[_0xf4b1('0x1a4')],_0x1d09bf);return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0x1a5'));};AGIVertices['prototype'][_0xf4b1('0x1a6')]=function(_0x12f817){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x1a7'),_0x12f817[_0xf4b1('0x39')]));return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0x1a8'));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x1a9')]=function(_0x1c8ce4){logger[_0xf4b1('0x2f')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x1c8ce4['label']));if(!this[_0xf4b1('0x86')](_0x1c8ce4['sms_account_id'])){return this[_0xf4b1('0x38')]['noop'](_0xf4b1('0x1aa'));}var _0x243946=this[_0xf4b1('0x34')][_0xf4b1('0x6f')](this,_0x1c8ce4['sms_account_id']);if(!_0x243946){return this['channel'][_0xf4b1('0x2d')](_0x1c8ce4,_0xf4b1('0x1ab'));}var _0x34ecb1={'body':_0x1c8ce4[_0xf4b1('0x1ac')],'phone':_0x1c8ce4['to']||'','SmsAccountId':_0x243946['id']};logger['debug'](_0xf4b1('0x1ad'),JSON['stringify'](_0x34ecb1));this['createSquareDetailsReport']['sync'](this,_0x1c8ce4,_0x1c8ce4[_0xf4b1('0x1ae')]);this['channel']['noop'](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x243946[_0xf4b1('0x11')]));this[_0xf4b1('0x36')][_0xf4b1('0x6f')](this,_0x34ecb1);return this['channel'][_0xf4b1('0xa6')](_0xf4b1('0x1af'));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x1b0')]=function(_0x36e6ec){logger[_0xf4b1('0x2f')](util['format'](_0xf4b1('0x1b1'),_0x36e6ec[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x36e6ec['variable_id'])){return this['channel'][_0xf4b1('0x2d')](_0x36e6ec,_0xf4b1('0x1b2'));}var _0x326ddf=this['getVariable'][_0xf4b1('0x6f')](this,_0x36e6ec[_0xf4b1('0xd8')]);if(!_0x326ddf){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x36e6ec,_0xf4b1('0x11b'));}return this[_0xf4b1('0x38')]['setVariable'](_0x326ddf,_0x36e6ec[_0xf4b1('0x1b3')]);};AGIVertices[_0xf4b1('0x13')]['start']=function(_0x3480fb){logger[_0xf4b1('0x2f')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x3480fb[_0xf4b1('0x39')]));this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0x1b4'));var _0x5acbd0=this[_0xf4b1('0x38')][_0xf4b1('0xe')](_0xf4b1('0x1b5'));if(!_[_0xf4b1('0x45')](_0x5acbd0['extra'])){this['channel'][_0xf4b1('0x3c')]=_0x5acbd0['extra'];}if(_0x3480fb[_0xf4b1('0xb3')]===_0xf4b1('0x1b6')){this[_0xf4b1('0x38')]['noop'](_0xf4b1('0x1b7'));return this[_0xf4b1('0x38')][_0xf4b1('0xb3')]();}return this[_0xf4b1('0x38')]['noop']('Skipped\x20Answer');};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x1b8')]=function(_0x22891f){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x22891f[_0xf4b1('0x39')]));if(!this['isConfigured'](_0x22891f['project_id'])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x22891f,_0xf4b1('0x1b9'));}var _0x8a4643=this[_0xf4b1('0x1ba')][_0xf4b1('0x6f')](this,_0x22891f[_0xf4b1('0x1bb')]);if(!this[_0xf4b1('0x86')](_0x8a4643)){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x22891f,util[_0xf4b1('0x29')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x22891f[_0xf4b1('0x1bb')]));}if(_0x8a4643===this['channel'][_0xf4b1('0x41')]){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x22891f,_0xf4b1('0x1bc'));}this[_0xf4b1('0x37')]['sync'](this,_0x22891f,_0x8a4643);var _0x153194=this[_0xf4b1('0x38')][_0xf4b1('0x5a')](_0xf4b1('0x1bd'),util['format'](_0xf4b1('0x1be'),config[_0xf4b1('0x7')][_0xf4b1('0x1bf')]||_0xf4b1('0x1c0'),_0x8a4643,this['channel'][_0xf4b1('0x41')]));if(_0x153194[_0xf4b1('0xa9')]===-0x1){return _0x153194;}return this['channel']['noop'](util[_0xf4b1('0x29')](_0xf4b1('0xbf'),_0xf4b1('0x1bd'),_0x8a4643));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x1c1')]=function(_0x1387ac){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x1c2'),_0x1387ac['label']));var _0x4f3161=this[_0xf4b1('0x59')][_0xf4b1('0x6f')](this,_0x1387ac[_0xf4b1('0xb2')]);this[_0xf4b1('0x37')][_0xf4b1('0x6f')](this,_0x1387ac,_0x1387ac[_0xf4b1('0xb2')]);if(this[_0xf4b1('0x86')](_0x1387ac[_0xf4b1('0xd8')])){var _0x4e8389=this[_0xf4b1('0xe')]['sync'](this,_0x1387ac['variable_id']);if(_0x4e8389){this[_0xf4b1('0x38')][_0xf4b1('0x9d')](_0x4e8389,_0x4f3161);return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x1c3'),_0x1387ac[_0xf4b1('0xb2')],_0x4e8389));}}return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x1c4'),_0x1387ac[_0xf4b1('0xb2')]));};AGIVertices['prototype'][_0xf4b1('0x1c5')]=function(_0x3dc059){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3dc059['label']));_0x3dc059[_0xf4b1('0x5e')]=_0x3dc059['text'][_0xf4b1('0x18f')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3dc059[_0xf4b1('0x5d')])){return this['channel']['noop'](_0xf4b1('0x1c6'));}if(!this[_0xf4b1('0x86')](_0x3dc059[_0xf4b1('0x5e')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xa7'));}this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x1c7'),_0x3dc059['text']));var _0x4690a6=this[_0xf4b1('0x5c')][_0xf4b1('0x6f')](this,_0x3dc059);if(_0x4690a6){this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')](_0xf4b1('0x1c8'),_0x4690a6));var _0x1b829b=this[_0xf4b1('0x38')]['streamFile'](_0x4690a6);try{fs[_0xf4b1('0x101')](_0x4690a6+'.wav');}catch(_0x2e3fd7){logger[_0xf4b1('0x2d')](_0x2e3fd7);}return _0x1b829b;}return this['channel'][_0xf4b1('0x2d')](_0x3dc059,_0xf4b1('0x1c9'));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x1ca')]=function(_0x36dd92){logger[_0xf4b1('0x2f')](util['format'](_0xf4b1('0x1cb'),_0x36dd92['label']));_0x36dd92['text']=_0x36dd92[_0xf4b1('0x5e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf4b1('0x86')](_0x36dd92[_0xf4b1('0x5e')])){return this[_0xf4b1('0x38')][_0xf4b1('0xa6')](_0xf4b1('0xa7'));}this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util['format'](_0xf4b1('0x1cc'),_0x36dd92[_0xf4b1('0x5e')]));var _0x3560ea=this['googleTTS'][_0xf4b1('0x6f')](this,_0x36dd92);if(_0x3560ea){this['channel'][_0xf4b1('0xa6')](util['format'](_0xf4b1('0x1cd'),_0x3560ea));var _0x82599f=this[_0xf4b1('0x38')]['streamFile'](_0x3560ea);try{fs['unlink'](_0x3560ea+'.wav');}catch(_0x3bbcaf){logger['error'](_0x3bbcaf);}return _0x82599f;}return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x36dd92,_0xf4b1('0x1ce'));};AGIVertices[_0xf4b1('0x13')][_0xf4b1('0x1cf')]=function(_0x50c820){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x1d0'),_0x50c820[_0xf4b1('0x39')]));if(!this[_0xf4b1('0x86')](_0x50c820['findBy'])){return this[_0xf4b1('0x38')][_0xf4b1('0x2d')](_0x50c820,'no\x20find\x20by\x20configured');}logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x15d'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x50c820[_0xf4b1('0x15b')]));var _0x1ddf13=this['agentUnpause'][_0xf4b1('0x6f')](this,_0x50c820[_0xf4b1('0x15b')]);if(_0x1ddf13){logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x15e'),this['channel'][_0xf4b1('0x52')],_0x50c820[_0xf4b1('0x15b')]));this[_0xf4b1('0x38')][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0x15e'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x50c820['findBy']));return{'code':0xc8,'result':_0xf4b1('0x15f')};}else{logger[_0xf4b1('0x2f')](util[_0xf4b1('0x29')](_0xf4b1('0x160'),this[_0xf4b1('0x38')]['callerid'],_0x50c820[_0xf4b1('0x15b')]));this[_0xf4b1('0x38')]['noop'](util[_0xf4b1('0x29')](_0xf4b1('0x160'),this[_0xf4b1('0x38')][_0xf4b1('0x52')],_0x50c820[_0xf4b1('0x15b')]));return{'code':0xc8,'result':_0xf4b1('0x162')};}};AGIVertices[_0xf4b1('0x13')]['voicemail']=function(_0x45bca8){logger[_0xf4b1('0x2f')](util['format'](_0xf4b1('0x1d1'),_0x45bca8[_0xf4b1('0x39')]));var _0xff259a=this[_0xf4b1('0x38')][_0xf4b1('0x5a')](_0xf4b1('0x1d2'),[_0x45bca8['mailbox'],_0x45bca8[_0xf4b1('0x77')]]);if(_0xff259a[_0xf4b1('0xa9')]===-0x1){return _0xff259a;}return this['channel'][_0xf4b1('0xa6')](util[_0xf4b1('0x29')](_0xf4b1('0xbf'),'VOICEMAIL',_0x45bca8[_0xf4b1('0x1d3')]));};AGIVertices[_0xf4b1('0x13')]['vswitch']=function(_0x3a9bf6){logger['info'](util[_0xf4b1('0x29')](_0xf4b1('0x1d4'),_0x3a9bf6[_0xf4b1('0x39')]));if(!this['isConfigured'](_0x3a9bf6[_0xf4b1('0xd8')])){return this[_0xf4b1('0x38')]['error'](_0x3a9bf6,_0xf4b1('0x1b2'));}var _0xf3c643=this[_0xf4b1('0xe')][_0xf4b1('0x6f')](this,_0x3a9bf6[_0xf4b1('0xd8')]);if(!_0xf3c643){return this['channel'][_0xf4b1('0x2d')](_0x3a9bf6,_0xf4b1('0x11b'));}var _0x51f4c2=this['channel'][_0xf4b1('0xe')](_0xf3c643);return{'code':0xc8,'result':_0x51f4c2[_0xf4b1('0xa3')]?_0x51f4c2['extra']:'-'};};String[_0xf4b1('0x13')][_0xf4b1('0xa0')]=function(_0x43fc51,_0x297c2b){return this[_0xf4b1('0x9f')](_0x43fc51)[_0xf4b1('0x1d5')](_0x297c2b);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 07089d0..ffd3e98 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 _0x9c28=['seconds','prototype','lastPauseAt','timer','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','finally','interface','mandatoryDisposition','mandatoryDispositionPause','name','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','message','queue','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff'];(function(_0x243720,_0x4be046){var _0x412e40=function(_0x6c7e41){while(--_0x6c7e41){_0x243720['push'](_0x243720['shift']());}};_0x412e40(++_0x4be046);}(_0x9c28,0x199));var _0x89c2=function(_0x57b065,_0xf74ffc){_0x57b065=_0x57b065-0x0;var _0x63318b=_0x9c28[_0x57b065];return _0x63318b;};'use strict';var _=require(_0x89c2('0x0'));var moment=require(_0x89c2('0x1'));var ami=require(_0x89c2('0x2'));var logger=require(_0x89c2('0x3'))(_0x89c2('0x4'));var RpcUser=require(_0x89c2('0x5'));var RpcVoiceAgentReport=require(_0x89c2('0x6'));function Acw(_0xecaa9b){this[_0x89c2('0x7')]=_0xecaa9b['voiceQueues'];this[_0x89c2('0x8')]=_0xecaa9b[_0x89c2('0x8')];this[_0x89c2('0x9')]=_0xecaa9b[_0x89c2('0x9')];this[_0x89c2('0xa')]={};ami['on'](_0x89c2('0xb'),this[_0x89c2('0xc')][_0x89c2('0xd')](this));ami['on'](_0x89c2('0xe'),this[_0x89c2('0xf')][_0x89c2('0xd')](this));ami['on'](_0x89c2('0x10'),this[_0x89c2('0x11')]['bind'](this));ami['on'](_0x89c2('0x12'),this['syncAgentRingNoAnswer'][_0x89c2('0xd')](this));ami['on'](_0x89c2('0x13'),this[_0x89c2('0x14')][_0x89c2('0xd')](this));ami['on'](_0x89c2('0x15'),this['syncBlindTransfer'][_0x89c2('0xd')](this));ami['on'](_0x89c2('0x16'),this[_0x89c2('0x17')][_0x89c2('0xd')](this));}function getDiff(_0x377bc9){var _0x4e3be1=moment()['milliseconds'](0x0);var _0x561c2d=moment(_0x377bc9)[_0x89c2('0x18')](0x0);return _0x4e3be1[_0x89c2('0x19')](_0x561c2d,_0x89c2('0x1a'));}Acw[_0x89c2('0x1b')]['updateAcw']=function(_0x407a48,_0x3d1d9a){var _0x567470=this;var _0x40c80a=getDiff(_0x567470[_0x89c2('0x9')][_0x407a48][_0x89c2('0x1c')]);clearTimeout(_0x567470['timers'][_0x407a48][_0x89c2('0x1d')]);_0x567470['timers'][_0x407a48]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0x40c80a},_0x567470[_0x89c2('0x9')][_0x407a48][_0x89c2('0x1e')],_0x407a48)['then'](function(_0xb8bb9e){logger[_0x89c2('0x1f')](_0x89c2('0x20'),_0x3d1d9a,_0x40c80a,_0xb8bb9e);})['catch'](function(_0x3bbff7){logger[_0x89c2('0x21')](_0x89c2('0x22'),_0x3d1d9a,_0x3bbff7);})[_0x89c2('0x23')](function(){delete _0x567470[_0x89c2('0x9')][_0x407a48];});};Acw[_0x89c2('0x1b')]['startAcw']=function(_0x3f2001){try{var _0xd0c3a9=this;var _0x2a4e2e=this[_0x89c2('0xa')][_0x3f2001][_0x89c2('0x24')];var _0x22859f=this['channels'][_0x3f2001]['queue'];var _0x2db4c0=this[_0x89c2('0x7')][_0x22859f];var _0x4e7c9b=![];var _0x1b4091='ACW';if(_0x2db4c0[_0x89c2('0x25')]&&_0x2db4c0[_0x89c2('0x26')]['name']){_0x4e7c9b=!![];_0x1b4091=_0x2db4c0[_0x89c2('0x26')][_0x89c2('0x27')];}return ami['Action']({'action':'QueuePause','interface':_0x2a4e2e,'paused':!![],'reason':_0x1b4091})['then'](function(){if(_0xd0c3a9[_0x89c2('0x8')][_0x2a4e2e]){return RpcUser[_0x89c2('0x28')](_0xd0c3a9[_0x89c2('0x8')][_0x2a4e2e]['id'])['then'](function(_0x527313){if(!_0x527313||_0x527313[_0x89c2('0x29')]){logger[_0x89c2('0x1f')](_0x89c2('0x2a'),_0x3f2001,_0x2a4e2e,_0x22859f);return;}logger['info'](_0x89c2('0x2b'),_0x3f2001,_0x2a4e2e,_0x22859f);var _0x32ad73=_0xd0c3a9[_0x89c2('0xa')][_0x3f2001][_0x89c2('0x2c')]&&_0xd0c3a9[_0x89c2('0xa')][_0x3f2001][_0x89c2('0x2d')]?_0xd0c3a9[_0x89c2('0xa')][_0x3f2001][_0x89c2('0x2d')]:_0x3f2001;return RpcUser[_0x89c2('0x2e')](_0xd0c3a9[_0x89c2('0x8')][_0x2a4e2e],_0x1b4091,_0x32ad73)[_0x89c2('0x2f')](function(_0x1b60f4){_0xd0c3a9[_0x89c2('0x7')][_0x22859f]['available']-=0x1;_0xd0c3a9[_0x89c2('0x7')][_0x22859f]['paused']+=0x1;return _0x1b60f4;});})[_0x89c2('0x2f')](function(_0x40b414){if(_0x4e7c9b||!_0x40b414){return;}_0xd0c3a9[_0x89c2('0x9')][_0x2a4e2e]={};logger[_0x89c2('0x1f')](_0x89c2('0x30'),_0x3f2001,_0xd0c3a9[_0x89c2('0x7')][_0x22859f]['acwTimeout'],_0x2a4e2e,_0x22859f);_0xd0c3a9[_0x89c2('0x9')][_0x2a4e2e]['timer']=setTimeout(_0xd0c3a9[_0x89c2('0x31')]['bind'](_0xd0c3a9,_0x2a4e2e),_0xd0c3a9[_0x89c2('0x7')][_0x22859f][_0x89c2('0x32')]*0x3e8);_0xd0c3a9[_0x89c2('0x9')][_0x2a4e2e][_0x89c2('0x1c')]=moment()[_0x89c2('0x33')](_0x89c2('0x34'));_0xd0c3a9['timers'][_0x2a4e2e][_0x89c2('0x1e')]=_0x3f2001;_0xd0c3a9[_0x89c2('0x9')][_0x2a4e2e]['queue']=_0x22859f;_0xd0c3a9['timers'][_0x2a4e2e][_0x89c2('0x35')]=_0xd0c3a9['updateAcw']['bind'](_0xd0c3a9,_0x2a4e2e,_0x3f2001);});}})['catch'](function(){logger[_0x89c2('0x21')](_0x89c2('0x30'),_0x3f2001,_0xd0c3a9[_0x89c2('0x7')][_0x22859f][_0x89c2('0x32')],_0x2a4e2e,_0x22859f);})['finally'](function(){delete _0xd0c3a9['channels'][_0x3f2001];});}catch(_0x1d11a7){logger[_0x89c2('0x21')]('[ACW][START]\x20%s',_0x1d11a7[_0x89c2('0x36')]);}};Acw['prototype'][_0x89c2('0x31')]=function(_0x5be8bc){try{var _0x35f556=this;if(_0x35f556[_0x89c2('0x9')][_0x5be8bc]){_0x35f556[_0x89c2('0x9')][_0x5be8bc][_0x89c2('0x1d')]=![];var _0x1b2d6c=_0x35f556[_0x89c2('0x9')][_0x5be8bc][_0x89c2('0x1e')];var _0x5dc4c3=_0x35f556['timers'][_0x5be8bc][_0x89c2('0x37')];var _0x446b31=_0x35f556['voiceQueues'][_0x5dc4c3]['acwTimeout'];logger[_0x89c2('0x1f')](_0x89c2('0x38'),_0x1b2d6c,_0x5be8bc);RpcUser['getAgent'](this['agents'][_0x5be8bc]['id'])[_0x89c2('0x2f')](function(_0x8ce46a){if(_0x8ce46a[_0x89c2('0x39')]==='ACW'){return RpcUser[_0x89c2('0x3a')](_0x35f556[_0x89c2('0x8')][_0x5be8bc]);}});RpcVoiceAgentReport['update']({'acwtime':_0x446b31,'agentacw':!![]},_0x1b2d6c,_0x5be8bc)[_0x89c2('0x2f')](function(_0x1ba273){logger[_0x89c2('0x1f')](_0x89c2('0x20'),_0x1b2d6c,_0x446b31,_0x1ba273);})[_0x89c2('0x3b')](function(_0x2bd3cd){logger[_0x89c2('0x21')](_0x89c2('0x22'),_0x1b2d6c,_0x2bd3cd);});}else{logger['error'](_0x89c2('0x3c'),_0x5be8bc);if(_0x35f556[_0x89c2('0x9')]){logger[_0x89c2('0x1f')]('[ACW][TIMERS]',JSON[_0x89c2('0x3d')](_0x35f556['timers']));}}}catch(_0x181f2a){logger[_0x89c2('0x21')]('[ACW][STOP]\x20%s',_0x181f2a['message']);}};Acw[_0x89c2('0x1b')][_0x89c2('0xc')]=function(_0x1ba945){try{if(this['voiceQueues'][_0x1ba945[_0x89c2('0x37')]]&&(this[_0x89c2('0x7')][_0x1ba945['queue']][_0x89c2('0x4')]||this[_0x89c2('0x7')][_0x1ba945[_0x89c2('0x37')]][_0x89c2('0x25')])){if(this[_0x89c2('0x8')][_0x1ba945[_0x89c2('0x24')]]){this['channels'][_0x1ba945[_0x89c2('0x1e')]]={'queue':_0x1ba945['queue'],'interface':_0x1ba945[_0x89c2('0x24')],'destlinkedid':_0x1ba945[_0x89c2('0x2d')]};}}}catch(_0x2310e2){logger[_0x89c2('0x21')](_0x89c2('0x3e'),_0x2310e2['message']);}};Acw[_0x89c2('0x1b')][_0x89c2('0x17')]=function(_0x2c8640){try{if(this[_0x89c2('0x7')][_0x2c8640[_0x89c2('0x37')]]&&(this[_0x89c2('0x7')][_0x2c8640[_0x89c2('0x37')]]['acw']||this['voiceQueues'][_0x2c8640[_0x89c2('0x37')]][_0x89c2('0x25')])){if(this['agents'][_0x2c8640[_0x89c2('0x24')]]){this[_0x89c2('0xa')][_0x2c8640[_0x89c2('0x1e')]]={'queue':_0x2c8640[_0x89c2('0x37')],'interface':_0x2c8640['interface']};}}}catch(_0x3ce5ee){logger[_0x89c2('0x21')](_0x89c2('0x3f'),_0x3ce5ee['message']);}};Acw[_0x89c2('0x1b')][_0x89c2('0xf')]=function(_0x45c381){try{if(this[_0x89c2('0xa')][_0x45c381[_0x89c2('0x1e')]]&&_['isUndefined'](this[_0x89c2('0xa')][_0x45c381[_0x89c2('0x1e')]]['attended'])){logger[_0x89c2('0x1f')](_0x89c2('0x40'),_0x45c381[_0x89c2('0x1e')]);this[_0x89c2('0x41')](_0x45c381['uniqueid']);}else if(this['channels'][_0x45c381[_0x89c2('0x42')]]&&_['isUndefined'](this[_0x89c2('0xa')][_0x45c381['linkedid']][_0x89c2('0x2c')])){logger[_0x89c2('0x1f')]('[%s][HANGUP:LINKEDID]',_0x45c381[_0x89c2('0x42')]);this['startAcw'](_0x45c381[_0x89c2('0x42')]);}}catch(_0x3657da){logger[_0x89c2('0x21')](_0x89c2('0x43'),_0x3657da[_0x89c2('0x36')]);}};Acw['prototype'][_0x89c2('0x11')]=function(_0x597d45){try{if(this[_0x89c2('0xa')][_0x597d45['uniqueid']]&&this[_0x89c2('0xa')][_0x597d45[_0x89c2('0x1e')]][_0x89c2('0x2c')]){logger['info'](_0x89c2('0x44'),_0x597d45[_0x89c2('0x1e')]);this[_0x89c2('0x41')](_0x597d45['uniqueid']);}else if(this['channels'][_0x597d45['linkedid']]&&this[_0x89c2('0xa')][_0x597d45[_0x89c2('0x42')]]['attended']){logger[_0x89c2('0x1f')](_0x89c2('0x45'),_0x597d45[_0x89c2('0x42')]);this[_0x89c2('0x41')](_0x597d45[_0x89c2('0x42')]);}}catch(_0x539f48){logger['error'](_0x89c2('0x46'),_0x539f48[_0x89c2('0x36')]);}};Acw[_0x89c2('0x1b')][_0x89c2('0x14')]=function(_0x4440c8){try{if(!_[_0x89c2('0x47')](this['channels'][_0x4440c8[_0x89c2('0x48')]])){this['startAcw'](_0x4440c8[_0x89c2('0x48')]);if(this['channels'][_0x4440c8[_0x89c2('0x49')]]){this[_0x89c2('0xa')][_0x4440c8[_0x89c2('0x49')]][_0x89c2('0x2c')]=!![];this[_0x89c2('0xa')][_0x4440c8[_0x89c2('0x4a')]]=this['channels'][_0x4440c8[_0x89c2('0x49')]];this[_0x89c2('0x4b')](_0x4440c8[_0x89c2('0x49')]);}}else if(!_['isNil'](this[_0x89c2('0xa')][_0x4440c8[_0x89c2('0x4a')]])){this[_0x89c2('0x41')](_0x4440c8[_0x89c2('0x4a')]);if(this[_0x89c2('0xa')][_0x4440c8[_0x89c2('0x4c')]]){this[_0x89c2('0xa')][_0x4440c8[_0x89c2('0x4c')]][_0x89c2('0x2c')]=!![];this[_0x89c2('0xa')][_0x4440c8['transfereeuniqueid']]=this['channels'][_0x4440c8[_0x89c2('0x4c')]];this[_0x89c2('0x4b')](_0x4440c8[_0x89c2('0x4c')]);}}}catch(_0x26a87b){logger[_0x89c2('0x21')]('[ACW][syncAttendedTransfer]\x20%s',_0x26a87b['message']);}};Acw['prototype'][_0x89c2('0x4d')]=function(_0x2f581a){try{if(this[_0x89c2('0xa')][_0x2f581a[_0x89c2('0x4e')]]){logger[_0x89c2('0x1f')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x2f581a[_0x89c2('0x4e')]));this[_0x89c2('0x41')](_0x2f581a[_0x89c2('0x4e')]);}else if(this['channels'][_0x2f581a['transfererlinkedid']]){logger[_0x89c2('0x1f')](_0x89c2('0x4f'),JSON[_0x89c2('0x3d')](_0x2f581a[_0x89c2('0x50')]));this[_0x89c2('0x41')](_0x2f581a[_0x89c2('0x50')]);}}catch(_0x44d4c8){logger[_0x89c2('0x21')](_0x89c2('0x51'),_0x44d4c8[_0x89c2('0x36')]);}};Acw[_0x89c2('0x1b')][_0x89c2('0x52')]=function(_0x10b7ab){try{if(this['voiceQueues'][_0x10b7ab['queue']]&&this[_0x89c2('0x7')][_0x10b7ab['queue']]['autopause']===_0x89c2('0x53')){if(this[_0x89c2('0x8')][_0x10b7ab[_0x89c2('0x24')]]){logger[_0x89c2('0x1f')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x10b7ab[_0x89c2('0x1e')],_0x10b7ab[_0x89c2('0x24')],_0x10b7ab[_0x89c2('0x37')]);return RpcUser['savePause'](this[_0x89c2('0x8')][_0x10b7ab[_0x89c2('0x24')]],_0x89c2('0x54'),_0x10b7ab[_0x89c2('0x1e')]);}}}catch(_0x4158ba){logger[_0x89c2('0x21')](_0x89c2('0x55'),_0x4158ba[_0x89c2('0x36')]);}};Acw[_0x89c2('0x1b')][_0x89c2('0x4b')]=function(_0x54a24e,_0xe05b5b=0x2710){if(this[_0x89c2('0xa')][_0x54a24e]){setTimeout(()=>{delete this[_0x89c2('0xa')][_0x54a24e];},_0xe05b5b);}};module[_0x89c2('0x56')]=Acw; \ No newline at end of file +var _0xcebd=['hanguprequest','syncHangupRequest','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','timers','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','prototype','startAcw','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','stopAcw','acwTimeout','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','updateAcw','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','uniqueid','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','interface','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','channels','agentconnect','bind'];(function(_0x506529,_0xf20d6){var _0x1f6caf=function(_0x27b90d){while(--_0x27b90d){_0x506529['push'](_0x506529['shift']());}};_0x1f6caf(++_0xf20d6);}(_0xcebd,0x106));var _0xdceb=function(_0x1621c8,_0x5a3507){_0x1621c8=_0x1621c8-0x0;var _0x21d0db=_0xcebd[_0x1621c8];return _0x21d0db;};'use strict';var _=require(_0xdceb('0x0'));var moment=require(_0xdceb('0x1'));var ami=require(_0xdceb('0x2'));var logger=require(_0xdceb('0x3'))(_0xdceb('0x4'));var RpcUser=require(_0xdceb('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3d6b30){this[_0xdceb('0x6')]=_0x3d6b30[_0xdceb('0x6')];this[_0xdceb('0x7')]=_0x3d6b30[_0xdceb('0x7')];this['timers']=_0x3d6b30['timers'];this[_0xdceb('0x8')]={};ami['on'](_0xdceb('0x9'),this['syncAgentConnect'][_0xdceb('0xa')](this));ami['on'](_0xdceb('0xb'),this[_0xdceb('0xc')][_0xdceb('0xa')](this));ami['on']('hangup',this[_0xdceb('0xd')][_0xdceb('0xa')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xdceb('0xa')](this));ami['on'](_0xdceb('0xe'),this[_0xdceb('0xf')][_0xdceb('0xa')](this));ami['on'](_0xdceb('0x10'),this[_0xdceb('0x11')][_0xdceb('0xa')](this));ami['on'](_0xdceb('0x12'),this[_0xdceb('0x13')][_0xdceb('0xa')](this));}function getDiff(_0xaa6749){var _0x2fe7b2=moment()['milliseconds'](0x0);var _0x18acdc=moment(_0xaa6749)[_0xdceb('0x14')](0x0);return _0x2fe7b2[_0xdceb('0x15')](_0x18acdc,_0xdceb('0x16'));}Acw['prototype']['updateAcw']=function(_0x231674,_0x16ecb2){var _0x4e20cf=this;var _0x2e64ce=getDiff(_0x4e20cf['timers'][_0x231674]['lastPauseAt']);clearTimeout(_0x4e20cf[_0xdceb('0x17')][_0x231674][_0xdceb('0x18')]);_0x4e20cf[_0xdceb('0x17')][_0x231674][_0xdceb('0x18')]=![];return RpcVoiceAgentReport[_0xdceb('0x19')]({'acwtime':_0x2e64ce},_0x4e20cf[_0xdceb('0x17')][_0x231674]['uniqueid'],_0x231674)[_0xdceb('0x1a')](function(_0x4c6091){logger[_0xdceb('0x1b')](_0xdceb('0x1c'),_0x16ecb2,_0x2e64ce,_0x4c6091);})[_0xdceb('0x1d')](function(_0x22df87){logger[_0xdceb('0x1e')](_0xdceb('0x1f'),_0x16ecb2,_0x22df87);})[_0xdceb('0x20')](function(){delete _0x4e20cf['timers'][_0x231674];});};Acw[_0xdceb('0x21')][_0xdceb('0x22')]=function(_0x5ba5ae){try{var _0x24cf81=this;var _0xe8a075=this[_0xdceb('0x8')][_0x5ba5ae]['interface'];var _0x26b778=this[_0xdceb('0x8')][_0x5ba5ae][_0xdceb('0x23')];var _0x5285f7=this[_0xdceb('0x6')][_0x26b778];var _0x4e1869=![];var _0x3f82ab=_0xdceb('0x24');if(_0x5285f7['mandatoryDisposition']&&_0x5285f7[_0xdceb('0x25')][_0xdceb('0x26')]){_0x4e1869=!![];_0x3f82ab=_0x5285f7[_0xdceb('0x25')][_0xdceb('0x26')];}return ami[_0xdceb('0x27')]({'action':_0xdceb('0x28'),'interface':_0xe8a075,'paused':!![],'reason':_0x3f82ab})[_0xdceb('0x1a')](function(){if(_0x24cf81[_0xdceb('0x7')][_0xe8a075]){return RpcUser[_0xdceb('0x29')](_0x24cf81[_0xdceb('0x7')][_0xe8a075]['id'])[_0xdceb('0x1a')](function(_0x1e5f44){if(!_0x1e5f44||_0x1e5f44[_0xdceb('0x2a')]){logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x5ba5ae,_0xe8a075,_0x26b778);return;}logger['info'](_0xdceb('0x2b'),_0x5ba5ae,_0xe8a075,_0x26b778);var _0xd8602e=_0x24cf81[_0xdceb('0x8')][_0x5ba5ae][_0xdceb('0x2c')]&&_0x24cf81[_0xdceb('0x8')][_0x5ba5ae]['destlinkedid']?_0x24cf81[_0xdceb('0x8')][_0x5ba5ae][_0xdceb('0x2d')]:_0x5ba5ae;return RpcUser[_0xdceb('0x2e')](_0x24cf81[_0xdceb('0x7')][_0xe8a075],_0x3f82ab,_0xd8602e)[_0xdceb('0x1a')](function(_0x49a08a){_0x24cf81[_0xdceb('0x6')][_0x26b778][_0xdceb('0x2f')]-=0x1;_0x24cf81[_0xdceb('0x6')][_0x26b778][_0xdceb('0x30')]+=0x1;return _0x49a08a;});})['then'](function(_0x1f9a37){if(_0x4e1869||!_0x1f9a37){return;}_0x24cf81['timers'][_0xe8a075]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5ba5ae,_0x24cf81['voiceQueues'][_0x26b778]['acwTimeout'],_0xe8a075,_0x26b778);_0x24cf81['timers'][_0xe8a075]['timer']=setTimeout(_0x24cf81[_0xdceb('0x31')][_0xdceb('0xa')](_0x24cf81,_0xe8a075),_0x24cf81['voiceQueues'][_0x26b778][_0xdceb('0x32')]*0x3e8);_0x24cf81[_0xdceb('0x17')][_0xe8a075][_0xdceb('0x33')]=moment()['format'](_0xdceb('0x34'));_0x24cf81['timers'][_0xe8a075]['uniqueid']=_0x5ba5ae;_0x24cf81['timers'][_0xe8a075]['queue']=_0x26b778;_0x24cf81[_0xdceb('0x17')][_0xe8a075][_0xdceb('0x35')]=_0x24cf81[_0xdceb('0x35')][_0xdceb('0xa')](_0x24cf81,_0xe8a075,_0x5ba5ae);});}})[_0xdceb('0x1d')](function(){logger[_0xdceb('0x1e')](_0xdceb('0x36'),_0x5ba5ae,_0x24cf81[_0xdceb('0x6')][_0x26b778][_0xdceb('0x32')],_0xe8a075,_0x26b778);})[_0xdceb('0x20')](function(){delete _0x24cf81[_0xdceb('0x8')][_0x5ba5ae];});}catch(_0x171592){logger[_0xdceb('0x1e')](_0xdceb('0x37'),_0x171592[_0xdceb('0x38')]);}};Acw[_0xdceb('0x21')][_0xdceb('0x31')]=function(_0x48f870){try{var _0x1ce2a9=this;if(_0x1ce2a9['timers'][_0x48f870]){_0x1ce2a9[_0xdceb('0x17')][_0x48f870][_0xdceb('0x18')]=![];var _0x24b348=_0x1ce2a9[_0xdceb('0x17')][_0x48f870][_0xdceb('0x39')];var _0x502e91=_0x1ce2a9[_0xdceb('0x17')][_0x48f870][_0xdceb('0x23')];var _0xb63772=_0x1ce2a9[_0xdceb('0x6')][_0x502e91]['acwTimeout'];logger['info'](_0xdceb('0x3a'),_0x24b348,_0x48f870);RpcUser[_0xdceb('0x29')](this['agents'][_0x48f870]['id'])[_0xdceb('0x1a')](function(_0x2e637a){if(_0x2e637a[_0xdceb('0x3b')]==='ACW'){return RpcUser[_0xdceb('0x3c')](_0x1ce2a9[_0xdceb('0x7')][_0x48f870]);}});RpcVoiceAgentReport[_0xdceb('0x19')]({'acwtime':_0xb63772,'agentacw':!![]},_0x24b348,_0x48f870)[_0xdceb('0x1a')](function(_0x4ac6a7){logger['info'](_0xdceb('0x1c'),_0x24b348,_0xb63772,_0x4ac6a7);})[_0xdceb('0x1d')](function(_0x3add7e){logger[_0xdceb('0x1e')](_0xdceb('0x1f'),_0x24b348,_0x3add7e);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x48f870);if(_0x1ce2a9[_0xdceb('0x17')]){logger[_0xdceb('0x1b')](_0xdceb('0x3d'),JSON[_0xdceb('0x3e')](_0x1ce2a9[_0xdceb('0x17')]));}}}catch(_0x3dd67d){logger[_0xdceb('0x1e')](_0xdceb('0x3f'),_0x3dd67d[_0xdceb('0x38')]);}};Acw[_0xdceb('0x21')][_0xdceb('0x40')]=function(_0x2528e4){try{if(this['voiceQueues'][_0x2528e4[_0xdceb('0x23')]]&&(this[_0xdceb('0x6')][_0x2528e4[_0xdceb('0x23')]][_0xdceb('0x4')]||this[_0xdceb('0x6')][_0x2528e4[_0xdceb('0x23')]][_0xdceb('0x41')])){if(this[_0xdceb('0x7')][_0x2528e4['interface']]){this['channels'][_0x2528e4[_0xdceb('0x39')]]={'queue':_0x2528e4[_0xdceb('0x23')],'interface':_0x2528e4['interface'],'destlinkedid':_0x2528e4[_0xdceb('0x2d')]};}}}catch(_0x1c80c6){logger['error'](_0xdceb('0x42'),_0x1c80c6['message']);}};Acw[_0xdceb('0x21')]['syncAgentConnectPreview']=function(_0x103edd){try{if(this[_0xdceb('0x6')][_0x103edd['queue']]&&(this[_0xdceb('0x6')][_0x103edd[_0xdceb('0x23')]][_0xdceb('0x4')]||this['voiceQueues'][_0x103edd['queue']]['mandatoryDisposition'])){if(this[_0xdceb('0x7')][_0x103edd[_0xdceb('0x43')]]){this['channels'][_0x103edd[_0xdceb('0x39')]]={'queue':_0x103edd['queue'],'interface':_0x103edd[_0xdceb('0x43')]};}}}catch(_0x1842f5){logger[_0xdceb('0x1e')](_0xdceb('0x44'),_0x1842f5[_0xdceb('0x38')]);}};Acw[_0xdceb('0x21')][_0xdceb('0xc')]=function(_0x226fc2){try{if(this[_0xdceb('0x8')][_0x226fc2[_0xdceb('0x39')]]&&_[_0xdceb('0x45')](this['channels'][_0x226fc2[_0xdceb('0x39')]][_0xdceb('0x2c')])){logger['info'](_0xdceb('0x46'),_0x226fc2[_0xdceb('0x39')]);this[_0xdceb('0x22')](_0x226fc2[_0xdceb('0x39')]);}else if(this[_0xdceb('0x8')][_0x226fc2[_0xdceb('0x47')]]&&_['isUndefined'](this[_0xdceb('0x8')][_0x226fc2[_0xdceb('0x47')]][_0xdceb('0x2c')])){logger['info'](_0xdceb('0x48'),_0x226fc2[_0xdceb('0x47')]);this['startAcw'](_0x226fc2[_0xdceb('0x47')]);}}catch(_0x51bdc9){logger[_0xdceb('0x1e')](_0xdceb('0x49'),_0x51bdc9[_0xdceb('0x38')]);}};Acw['prototype'][_0xdceb('0xd')]=function(_0x5505e4){try{if(this[_0xdceb('0x8')][_0x5505e4[_0xdceb('0x39')]]&&this['channels'][_0x5505e4['uniqueid']][_0xdceb('0x2c')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5505e4[_0xdceb('0x39')]);this[_0xdceb('0x22')](_0x5505e4[_0xdceb('0x39')]);}else if(this[_0xdceb('0x8')][_0x5505e4[_0xdceb('0x47')]]&&this[_0xdceb('0x8')][_0x5505e4['linkedid']][_0xdceb('0x2c')]){logger[_0xdceb('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5505e4[_0xdceb('0x47')]);this[_0xdceb('0x22')](_0x5505e4[_0xdceb('0x47')]);}}catch(_0x1f437c){logger[_0xdceb('0x1e')](_0xdceb('0x4a'),_0x1f437c['message']);}};Acw[_0xdceb('0x21')][_0xdceb('0xf')]=function(_0x1d28f4){try{if(!_[_0xdceb('0x4b')](this['channels'][_0x1d28f4[_0xdceb('0x4c')]])){this[_0xdceb('0x22')](_0x1d28f4[_0xdceb('0x4c')]);if(this[_0xdceb('0x8')][_0x1d28f4[_0xdceb('0x4d')]]){this['channels'][_0x1d28f4[_0xdceb('0x4d')]][_0xdceb('0x2c')]=!![];this[_0xdceb('0x8')][_0x1d28f4[_0xdceb('0x4e')]]=this[_0xdceb('0x8')][_0x1d28f4[_0xdceb('0x4d')]];this[_0xdceb('0x4f')](_0x1d28f4[_0xdceb('0x4d')]);}}else if(!_['isNil'](this[_0xdceb('0x8')][_0x1d28f4[_0xdceb('0x4e')]])){this[_0xdceb('0x22')](_0x1d28f4[_0xdceb('0x4e')]);if(this[_0xdceb('0x8')][_0x1d28f4[_0xdceb('0x50')]]){this['channels'][_0x1d28f4[_0xdceb('0x50')]][_0xdceb('0x2c')]=!![];this[_0xdceb('0x8')][_0x1d28f4[_0xdceb('0x4c')]]=this['channels'][_0x1d28f4[_0xdceb('0x50')]];this[_0xdceb('0x4f')](_0x1d28f4['origtransfereruniqueid']);}}}catch(_0x10be70){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x10be70[_0xdceb('0x38')]);}};Acw[_0xdceb('0x21')][_0xdceb('0x11')]=function(_0x18f4ef){try{if(this['channels'][_0x18f4ef[_0xdceb('0x51')]]){logger[_0xdceb('0x1b')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xdceb('0x3e')](_0x18f4ef['transfereruniqueid']));this['startAcw'](_0x18f4ef['transfereruniqueid']);}else if(this['channels'][_0x18f4ef[_0xdceb('0x52')]]){logger['info'](_0xdceb('0x53'),JSON[_0xdceb('0x3e')](_0x18f4ef[_0xdceb('0x52')]));this[_0xdceb('0x22')](_0x18f4ef[_0xdceb('0x52')]);}}catch(_0x950c1a){logger['error'](_0xdceb('0x54'),_0x950c1a[_0xdceb('0x38')]);}};Acw[_0xdceb('0x21')][_0xdceb('0x55')]=function(_0x2da775){try{if(this['voiceQueues'][_0x2da775[_0xdceb('0x23')]]&&this[_0xdceb('0x6')][_0x2da775['queue']][_0xdceb('0x56')]===_0xdceb('0x57')){if(this['agents'][_0x2da775[_0xdceb('0x43')]]){logger[_0xdceb('0x1b')](_0xdceb('0x58'),_0x2da775[_0xdceb('0x39')],_0x2da775[_0xdceb('0x43')],_0x2da775['queue']);return RpcUser['savePause'](this[_0xdceb('0x7')][_0x2da775[_0xdceb('0x43')]],_0xdceb('0x59'),_0x2da775[_0xdceb('0x39')]);}}}catch(_0x48d265){logger[_0xdceb('0x1e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x48d265['message']);}};Acw[_0xdceb('0x21')][_0xdceb('0x4f')]=function(_0x2fd419,_0x44e800=0x2710){if(this[_0xdceb('0x8')][_0x2fd419]){setTimeout(()=>{delete this[_0xdceb('0x8')][_0x2fd419];},_0x44e800);}};module[_0xdceb('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index cedbb84..fcdabfe 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 _0xbe1f=['sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','actionQueueSummary','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','asterisk','port','username','keepConnected','Action','promisify','action','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbe1f,0x96));var _0xfbe1=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbe1f[_0x19e35c];return _0x3e1fe8;};'use strict';var Manager=require(_0xfbe1('0x0'));var BPromise=require(_0xfbe1('0x1'));var util=require(_0xfbe1('0x2'));var logger=require('../../config/logger')('ami');var config=require('../../config/environment');var ami=new Manager(config[_0xfbe1('0x3')][_0xfbe1('0x4')],config['asterisk']['ip'],config[_0xfbe1('0x3')][_0xfbe1('0x5')],config[_0xfbe1('0x3')]['password'],!![]);ami[_0xfbe1('0x6')]();ami[_0xfbe1('0x7')]=BPromise[_0xfbe1('0x8')](ami[_0xfbe1('0x9')]);function error(_0x591fc9){logger[_0xfbe1('0xa')](util[_0xfbe1('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xfbe1('0x3')][_0xfbe1('0x5')],config[_0xfbe1('0x3')]['ip'],config[_0xfbe1('0x3')][_0xfbe1('0x4')],util[_0xfbe1('0xc')](_0x591fc9,![],null)));}function close(){logger[_0xfbe1('0xa')](util['format'](_0xfbe1('0xd'),config[_0xfbe1('0x3')][_0xfbe1('0x5')],config[_0xfbe1('0x3')]['ip'],config['asterisk']['port']));}ami[_0xfbe1('0xe')]=function(){return function(){return ami[_0xfbe1('0x7')]({'action':_0xfbe1('0xf')});};};ami[_0xfbe1('0x10')]=function(){return function(){return ami[_0xfbe1('0x7')]({'action':'devicestatelist'});};};ami[_0xfbe1('0x11')]=function(){return function(){return ami[_0xfbe1('0x7')]({'action':_0xfbe1('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xfbe1('0x7')]({'action':_0xfbe1('0x13')});};};ami[_0xfbe1('0x14')]=function(){return function(){return ami[_0xfbe1('0x7')]({'action':_0xfbe1('0x15')});};};function connect(){logger[_0xfbe1('0x16')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xfbe1('0x3')][_0xfbe1('0x5')],config[_0xfbe1('0x3')]['ip'],config['asterisk'][_0xfbe1('0x4')]));ami[_0xfbe1('0x17')](_0xfbe1('0xa'),error);ami[_0xfbe1('0x17')](_0xfbe1('0x18'),close);}ami['on'](_0xfbe1('0x19'),connect);ami['on']('shutdown',function(_0x4312a3){logger[_0xfbe1('0x16')](util[_0xfbe1('0xb')](_0xfbe1('0x1a'),config[_0xfbe1('0x3')][_0xfbe1('0x5')],config[_0xfbe1('0x3')]['ip'],config[_0xfbe1('0x3')]['port'],util['inspect'](_0x4312a3,![],null)));});ami['on']('fullybooted',function(){logger[_0xfbe1('0x16')](util[_0xfbe1('0xb')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xfbe1('0x3')][_0xfbe1('0x5')],config[_0xfbe1('0x3')]['ip'],config['asterisk'][_0xfbe1('0x4')]));return Promise[_0xfbe1('0x1b')]()[_0xfbe1('0x1c')](ami[_0xfbe1('0xe')]())[_0xfbe1('0x1c')](ami['actionDeviceStateList']())[_0xfbe1('0x1c')](ami[_0xfbe1('0x11')]())[_0xfbe1('0x1c')](ami[_0xfbe1('0x1d')]())['then'](ami[_0xfbe1('0x14')]())[_0xfbe1('0x1e')](function(_0x1c275a){logger[_0xfbe1('0xa')](_0xfbe1('0x1f'),util[_0xfbe1('0xc')](_0x1c275a,{'showHidden':![],'depth':null}));});});ami[_0xfbe1('0x17')]('error',error);ami[_0xfbe1('0x17')](_0xfbe1('0x18'),close);module[_0xfbe1('0x20')]=ami; \ No newline at end of file +var _0x3914=['sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','resolve','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','error','format','port','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus'];(function(_0x4a5b77,_0x30cdc2){var _0x89f599=function(_0x3d707b){while(--_0x3d707b){_0x4a5b77['push'](_0x4a5b77['shift']());}};_0x89f599(++_0x30cdc2);}(_0x3914,0xea));var _0x4391=function(_0x7ad6cb,_0xffee6c){_0x7ad6cb=_0x7ad6cb-0x0;var _0x22a0ba=_0x3914[_0x7ad6cb];return _0x22a0ba;};'use strict';var Manager=require(_0x4391('0x0'));var BPromise=require(_0x4391('0x1'));var util=require('util');var logger=require('../../config/logger')(_0x4391('0x2'));var config=require(_0x4391('0x3'));var ami=new Manager(config[_0x4391('0x4')]['port'],config[_0x4391('0x4')]['ip'],config['asterisk'][_0x4391('0x5')],config['asterisk'][_0x4391('0x6')],!![]);ami[_0x4391('0x7')]();ami[_0x4391('0x8')]=BPromise[_0x4391('0x9')](ami[_0x4391('0xa')]);function error(_0x21c5f0){logger[_0x4391('0xb')](util[_0x4391('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x4391('0x4')][_0x4391('0x5')],config['asterisk']['ip'],config[_0x4391('0x4')][_0x4391('0xd')],util['inspect'](_0x21c5f0,![],null)));}function close(){logger[_0x4391('0xb')](util[_0x4391('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x4391('0x5')],config[_0x4391('0x4')]['ip'],config[_0x4391('0x4')][_0x4391('0xd')]));}ami[_0x4391('0xe')]=function(){return function(){return ami[_0x4391('0x8')]({'action':'sipshowregistry'});};};ami[_0x4391('0xf')]=function(){return function(){return ami['Action']({'action':_0x4391('0x10')});};};ami[_0x4391('0x11')]=function(){return function(){return ami[_0x4391('0x8')]({'action':_0x4391('0x12')});};};ami[_0x4391('0x13')]=function(){return function(){return ami[_0x4391('0x8')]({'action':_0x4391('0x14')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x4391('0x8')]({'action':_0x4391('0x15')});};};function connect(){logger['info'](util[_0x4391('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x4391('0x4')][_0x4391('0x5')],config[_0x4391('0x4')]['ip'],config[_0x4391('0x4')]['port']));ami[_0x4391('0x16')](_0x4391('0xb'),error);ami[_0x4391('0x16')](_0x4391('0x17'),close);}ami['on'](_0x4391('0x18'),connect);ami['on'](_0x4391('0x19'),function(_0x10a817){logger[_0x4391('0x1a')](util['format'](_0x4391('0x1b'),config['asterisk'][_0x4391('0x5')],config[_0x4391('0x4')]['ip'],config[_0x4391('0x4')][_0x4391('0xd')],util[_0x4391('0x1c')](_0x10a817,![],null)));});ami['on'](_0x4391('0x1d'),function(){logger[_0x4391('0x1a')](util[_0x4391('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x4391('0x4')][_0x4391('0x5')],config['asterisk']['ip'],config[_0x4391('0x4')][_0x4391('0xd')]));return Promise[_0x4391('0x1e')]()['then'](ami['actionSipShowRegistry']())[_0x4391('0x1f')](ami['actionDeviceStateList']())[_0x4391('0x1f')](ami[_0x4391('0x11')]())[_0x4391('0x1f')](ami[_0x4391('0x13')]())['then'](ami[_0x4391('0x20')]())[_0x4391('0x21')](function(_0x24c6fb){logger[_0x4391('0xb')](_0x4391('0x22'),util[_0x4391('0x1c')](_0x24c6fb,{'showHidden':![],'depth':null}));});});ami['once'](_0x4391('0xb'),error);ami[_0x4391('0x16')](_0x4391('0x17'),close);module[_0x4391('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 0e174ce..d5e3a64 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x11d684,_0x4d4123){var _0x78a301=function(_0x1a1966){while(--_0x1a1966){_0x11d684['push'](_0x11d684['shift']());}};_0x78a301(++_0x4d4123);}(_0xac4a,0x13f));var _0xaac4=function(_0x59efe7,_0x11cbdd){_0x59efe7=_0x59efe7-0x0;var _0x4bf4cb=_0xac4a[_0x59efe7];return _0x4bf4cb;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x223bdb,_0x5882e6){var _0xef8e68=function(_0x55ab83){while(--_0x55ab83){_0x223bdb['push'](_0x223bdb['shift']());}};_0xef8e68(++_0x5882e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 435e365..15b3727 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 _0xe50a=['[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','Interval','Intervals','NULL_INTERVAL','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20deactivated','[ifTime][Action]','Error','active','SIP/%s','status','reachable','Trunk','isTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','ifTime','\x20Timezone\x20unknow\x20','isArray','push','Action','indexOf','true','catch','command','iftime\x20%s,%s','content','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','syncCampaigns','undefined','isIVRCampaign','isIVRCampaignActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueId','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','syncQueueCallerAbandon','[syncQueueCallerAbandon]','droptime','responsetime','dialQueueTimeout','state','Drop','dropreason','TIMEOUT','agiafterat','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','countdropretry','queueCallerAbandonCreateState','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','statedesc','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','rescheduleContact','add','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','queueBooked','pick','idHopper','[syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','preview','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','countnosuchnumberretry','reason19\x20machine....','createStateFinal','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','moveContactManagedDialer','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','[syncHangup]','AnswerAGI','AGI','outboundUnknownCallsDay','Unknown','[syncHangup][createHistory]','isPreviewCampaign','statusMessage','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','running','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','resolve','handlePreviewRecallNotifications','map','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','notFound','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','Agent','user:%s','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','[getContactCampaign2][Empty]','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','booked','dialLimitQueue','getContactDialer','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','[handlePower]','[getContactCampaign2]','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','checkContactEmpty','checkContactLowerLimitOriginate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','p\x20=\x20','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','dialer','predictive','predictiveCalls','../../../config/logger','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','optionPredictive','startPredictive','startProgressive','ivrOriginated','queuesSummary','syncAgentConnect','bind','queuecallerabandon','agentcomplete','custom:queuesummary','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','inspect','format','voice:queue:%s','name','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','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','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','---------------------------','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','---------\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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','debug','startPredictive\x20value\x20cleared','handlePredictive','error','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','endtime'];(function(_0x15da85,_0x376ec3){var _0x2074e7=function(_0xf7ccaf){while(--_0xf7ccaf){_0x15da85['push'](_0x15da85['shift']());}};_0x2074e7(++_0x376ec3);}(_0xe50a,0x1c2));var _0xae50=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xe50a[_0x286726];return _0xcd4fe9;};'use strict';var util=require(_0xae50('0x0'));var _=require(_0xae50('0x1'));var uuid=require(_0xae50('0x2'));var moment=require(_0xae50('0x3'));var rr=require('rr');var Redis=require(_0xae50('0x4'));var utils=require(_0xae50('0x5'));var hopperUtils=require(_0xae50('0x6'));var ut=require(_0xae50('0x7'));var config=require(_0xae50('0x8'));var logger=require('../../../config/logger')(_0xae50('0x9'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require('../../../config/logger')(_0xae50('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0xae50('0xb'));var loggerSyncQueueSummary=require(_0xae50('0xc'))(_0xae50('0xd'));var ami=require(_0xae50('0xe'));config['redis']=_[_0xae50('0xf')](config[_0xae50('0x10')],{'host':_0xae50('0x11'),'port':0x18eb});var io=require(_0xae50('0x12'))(new Redis(config['redis']));var cmHopper=require(_0xae50('0x13'));var voiceQueueRt=require(_0xae50('0x14'));var RpcSetting=require(_0xae50('0x15'));var Interval=require(_0xae50('0x16'));var Action=require(_0xae50('0x17'));var History=require('./models/history');var Final=require(_0xae50('0x18'));var AgentComplete=require(_0xae50('0x19'));var QueueCallerAbandon=require(_0xae50('0x1a'));var Hangup=require(_0xae50('0x1b'));var ipAgi=process[_0xae50('0x1c')][_0xae50('0x1d')]||_0xae50('0x1e');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xae50('0x1f')]['enqueue']=function(_0x5e972e){this[_0xae50('0x20')]=this['tail']?this[_0xae50('0x20')][_0xae50('0x21')](_0x5e972e):_0x5e972e();};function Dialer(_0x4cbcff,_0x5393e5){this[_0xae50('0x22')]=new Sequence();this['preview']=_0x5393e5;this[_0xae50('0x23')]=_0x4cbcff[_0xae50('0x23')];this[_0xae50('0x24')]=_0x4cbcff[_0xae50('0x24')];this[_0xae50('0x25')]=_0x4cbcff[_0xae50('0x25')];this[_0xae50('0x26')]=_0x4cbcff[_0xae50('0x26')];this[_0xae50('0x27')]=config[_0xae50('0x27')]||0x2;this[_0xae50('0x28')]={};this[_0xae50('0x29')]={};this['contactsId']={};this['uniqueId']={};this[_0xae50('0x2a')]={};this[_0xae50('0x2b')]={};this[_0xae50('0x2c')]={};this[_0xae50('0x2d')]={};this['queueBooked']={};this['queueBookedRR']={};this[_0xae50('0x2e')]={};ami['on']('agentconnect',this[_0xae50('0x2f')][_0xae50('0x30')](this));ami['on'](_0xae50('0x31'),this['syncQueueCallerAbandon'][_0xae50('0x30')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0xae50('0x32'),this['syncAgentComplete']['bind'](this));ami['on'](_0xae50('0x33'),this['syncQueueSummary'][_0xae50('0x30')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete']['bind'](this));ami['on']('hangup',this[_0xae50('0x34')]['bind'](this));ami['on'](_0xae50('0x35'),this[_0xae50('0x36')]['bind'](this));ami['on']('varset',this[_0xae50('0x37')]['bind'](this));ami['on'](_0xae50('0x38'),this[_0xae50('0x39')][_0xae50('0x30')](this));ami['on'](_0xae50('0x3a'),this[_0xae50('0x3b')][_0xae50('0x30')](this));this[_0xae50('0x3c')]();this[_0xae50('0x3d')]();RpcSetting[_0xae50('0x3e')]()[_0xae50('0x3f')](function(_0x31e2aa){previewRecallmeReminderInterval=_0x31e2aa[_0xae50('0x40')];});}function isNotNull(_0x2eeac2){return _0x2eeac2!==null&&!_['isUndefined'](_0x2eeac2);}function msgResponse(_0x256932,_0x2832a6,_0x12fff7){return{'action':_0x256932,'response':_0x2832a6,'message':_0x12fff7,'stack':_0x12fff7};}function emit(_0x5aaba0,_0x5a8158,_0x2553e5){io['to'](_0x5aaba0)[_0xae50('0x41')](_0x5a8158,_0x2553e5);}function emitOutboundVoiceQueueSummary(_0x21eee6){if(_0x21eee6[_0xae50('0x42')]===_0xae50('0x43')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xae50('0x44')](_0x21eee6,{'showHidden':![],'depth':null}));emit(util[_0xae50('0x45')](_0xae50('0x46'),_0x21eee6[_0xae50('0x47')]),'voice_queue:save',_0x21eee6);}}function checkGetDataPredictive(_0x1d305a){if(isNotNull(_0x1d305a)&&!_[_0xae50('0x48')](_0x1d305a)){loggerPredictive[_0xae50('0x49')](_0xae50('0x4a'));loggerPredictive[_0xae50('0x49')](_0xae50('0x4b'),_0x1d305a[_0xae50('0x4c')]);loggerPredictive[_0xae50('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d305a[_0xae50('0x4d')]);loggerPredictive[_0xae50('0x49')](_0xae50('0x4e'),_0x1d305a[_0xae50('0x4f')]);loggerPredictive[_0xae50('0x49')](_0xae50('0x50'),_0x1d305a[_0xae50('0x51')]);loggerPredictive[_0xae50('0x49')](_0xae50('0x52'),_0x1d305a['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xae50('0x49')](_0xae50('0x53'),_0x1d305a['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xae50('0x54'));if(_0x1d305a[_0xae50('0x4c')]>0x0){if(!_[_0xae50('0x55')](_0x1d305a[_0xae50('0x56')])&&_0x1d305a[_0xae50('0x56')]>0x0){return!![];}loggerPredictive[_0xae50('0x49')](_0xae50('0x57'));if(!_[_0xae50('0x55')](_0x1d305a['predictiveIntervalAvgHoldtime'])&&_0x1d305a[_0xae50('0x58')]>0x0){return!![];}loggerPredictive[_0xae50('0x49')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xae50('0x49')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xae50('0x49')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x11dd8d){return function(_0x2bb7aa){loggerPredictive[_0xae50('0x49')](_0xae50('0x59'));loggerPredictive[_0xae50('0x49')](_0xae50('0x5a'),_0x2bb7aa[_0xae50('0x5b')]);loggerPredictive[_0xae50('0x49')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2bb7aa[_0xae50('0x5c')]);loggerPredictive[_0xae50('0x49')](_0xae50('0x5d'),_0x2bb7aa[_0xae50('0x5e')]);loggerPredictive[_0xae50('0x49')](_0xae50('0x5f'),_0x2bb7aa[_0xae50('0x60')]);loggerPredictive[_0xae50('0x49')](_0xae50('0x5d'),_0x2bb7aa[_0xae50('0x5e')]);loggerPredictive[_0xae50('0x49')](_0xae50('0x54'));_[_0xae50('0x61')](_0x11dd8d,_0x2bb7aa);};}function ifInterval(_0x56d5aa,_0x39d95){if(_[_0xae50('0x55')](_0x39d95)){return![];}return utils[_0xae50('0x62')](undefined,_0x39d95)<_0x56d5aa*0x3c;}function clearPredictiveAttributes(_0x7d8732){if(_0x7d8732[_0xae50('0x2c')]){_0x7d8732[_0xae50('0x2c')]=undefined;loggerPredictive[_0xae50('0x63')](_0x7d8732[_0xae50('0x47')],'startProgressive\x20value\x20cleared');}if(_0x7d8732[_0xae50('0x2b')]){_0x7d8732[_0xae50('0x2b')]=undefined;loggerPredictive[_0xae50('0x63')](_0x7d8732[_0xae50('0x47')],_0xae50('0x64'));}if(_0x7d8732[_0xae50('0x65')]){clearInterval(_0x7d8732[_0xae50('0x65')]);_0x7d8732[_0xae50('0x65')]=undefined;loggerPredictive[_0xae50('0x63')](_0x7d8732[_0xae50('0x47')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1dfbe9,_0x30e320){return function(_0x3f029f){loggerPredictive[_0xae50('0x66')](_0x30e320[_0xae50('0x47')],_0x1dfbe9);loggerPredictive['error'](_0x3f029f['stack']);clearPredictiveAttributes(_0x30e320);};}function loggerCatch(_0x49fd25){return function(_0x3d296e){logger['error'](_0x49fd25,util[_0xae50('0x44')](_0x3d296e,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x232680){return function(_0x39f8c3){if(isNotNull(_0x39f8c3)&&isNotNull(_0x39f8c3[0x0])){if(_0x39f8c3[0x0][_0xae50('0x67')]>0x0){_0x232680[_0xae50('0x68')]=utils[_0xae50('0x69')][_0xae50('0x6a')];logger[_0xae50('0x49')]('[getContactDialer2][ReScheduled]'+_0x232680['name'],_0x39f8c3[0x0][_0xae50('0x67')],_0xae50('0x6b'));}else{_0x232680[_0xae50('0x68')]=utils['CAMPAIGN_STATUS'][_0xae50('0x6c')];logger['info'](_0xae50('0x6d')+_0x232680[_0xae50('0x47')]);}}};}function createObjHistory(_0x2715b0,_0x298b58,_0x41dd90,_0x53061d,_0x9bb01f){_0x2715b0[_0xae50('0x68')]=_0x41dd90;var _0x376679=new Action(_0x2715b0,_0x298b58);var _0x4abb6e=new History(_0x376679);_0x4abb6e['state']=_0x53061d;_0x4abb6e['statedesc']=_0x9bb01f;_0x4abb6e[_0xae50('0x6e')]=_0x376679['starttime'];return _0x4abb6e;}function unlockQueueStatus(_0x371a25,_0x1ba142){setTimeout(function(){if(_[_0xae50('0x55')](_0x371a25['queueStatusComplete'])){loggerBooked[_0xae50('0x66')](_0xae50('0x6f'),_0x1ba142);}_0x371a25[_0xae50('0x70')]=!![];loggerBooked['info'](_0xae50('0x71'),_0x1ba142,JSON[_0xae50('0x72')](_['pick'](_0x371a25,[_0xae50('0x47'),_0xae50('0x70')])));},0x1f3);}function checkInterval(_0x1a8cca){return function(){if(!isNotNull(_0x1a8cca[_0xae50('0x73')])){_0x1a8cca['message']=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x1a8cca['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1a8cca[_0xae50('0x73')][_0xae50('0x74')])){_0x1a8cca['message']=utils[_0xae50('0x69')]['NULL_INTERVAL'];throw _0x1a8cca['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x1a8cca[_0xae50('0x73')][_0xae50('0x74')]))){_0x1a8cca[_0xae50('0x68')]=utils[_0xae50('0x69')][_0xae50('0x75')];throw _0x1a8cca[_0xae50('0x47')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x57d968){return function(){if(!utils['isIVRCampaignActive'](_0x57d968)){_0x57d968[_0xae50('0x68')]=utils[_0xae50('0x69')]['INACTIVE'];throw _0x57d968[_0xae50('0x47')]+_0xae50('0x76');}};}function emitCampaignSummary(_0x54ccbe){if(utils['isIVRCampaign'](_0x54ccbe)){emit(util['format'](_0xae50('0x77'),_0x54ccbe[_0xae50('0x47')]),_0xae50('0x78'),_0x54ccbe);}}function loggerCatchQueueSummary(_0x39f8e4,_0x4341fa){return function(_0x338dbd){clearPredictiveAttributes(_0x4341fa);emitCampaignSummary(_0x4341fa);loggerSyncQueueSummary[_0xae50('0x63')](_0x39f8e4,util['inspect'](_0x338dbd,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x559b09){if(_0x559b09[_0xae50('0x79')]){if(_0x559b09[_0xae50('0x7a')]===0x0){_0x559b09[_0xae50('0x79')]=![];_0x559b09[_0xae50('0x68')]=utils[_0xae50('0x69')][_0xae50('0x7b')];loggerSyncQueueSummary[_0xae50('0x63')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x559b09[_0xae50('0x47')],_0xae50('0x7c'));}else{_0x559b09[_0xae50('0x68')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0xae50('0x63')](_0xae50('0x7d'),_0x559b09[_0xae50('0x47')],_0xae50('0x7e'));}emitCampaignSummary(_0x559b09);}}function myreject(_0x40934f){return function(_0x213c61){return _0x40934f(msgResponse(_0xae50('0x7f'),_0xae50('0x80'),JSON['stringify'](_0x213c61)));};}Dialer['prototype']['isTrunkReachable']=function(_0x5e348a){return!_['isUndefined'](_0x5e348a)&&_0x5e348a&&!_[_0xae50('0x55')](_0x5e348a[_0xae50('0x47')])&&!_[_0xae50('0x55')](_0x5e348a['active'])&&_0x5e348a[_0xae50('0x81')]&&(this[_0xae50('0x26')][util[_0xae50('0x45')](_0xae50('0x82'),_0x5e348a[_0xae50('0x47')])][_0xae50('0x83')]===_0xae50('0x84')||this['trunks'][util[_0xae50('0x45')](_0xae50('0x82'),_0x5e348a[_0xae50('0x47')])][_0xae50('0x83')]==='unmonitored');};Dialer['prototype']['checkIsTrunkReachable']=function(_0x25af89){var _0x2d08ac=this;return function(){if(!_0x2d08ac['isTrunkReachable'](_0x25af89[_0xae50('0x85')])){if(!_0x2d08ac[_0xae50('0x86')](_0x25af89[_0xae50('0x87')])){_0x25af89['message']=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x25af89[_0xae50('0x47')]+_0xae50('0x88');}}};};Dialer[_0xae50('0x1f')][_0xae50('0x89')]=function(_0x5774df,_0x4efb8b,_0x31eea7,_0x20e8ff){var _0x451d78=this;return function(){var _0x2e95b5=!![];return _0x451d78[_0xae50('0x8a')](_0x5774df,_0x4efb8b,_0x31eea7,_0x20e8ff,_0x2e95b5);};};Dialer[_0xae50('0x1f')]['checkIfTimeIntervals']=function(_0x5b51ed,_0x5bd895,_0x1b9b36,_0x43d52a){var _0x52c04f=this;return function(){var _0x1a5438=![];return _0x52c04f[_0xae50('0x8a')](_0x5b51ed[_0xae50('0x74')],_0x5bd895,_0x1b9b36,_0x43d52a,_0x1a5438);};};Dialer[_0xae50('0x1f')][_0xae50('0x8a')]=function(_0xfd1ca7,_0x521135,_0x3db9da,_0x46aa8f,_0x1df78a){var _0x4bbef9=[];return new Promise(function(_0x3be489,_0x533aa7){if(!isNotNull(_0xfd1ca7)){_0x46aa8f[_0xae50('0x68')]=utils[_0xae50('0x69')]['NULL_INTERVAL'];return _0x533aa7(msgResponse('ifTime',_0xae50('0x8b'),_0x3db9da+_0xae50('0x8c')));}if(_[_0xae50('0x48')](_0xfd1ca7)){_0x46aa8f[_0xae50('0x68')]=utils[_0xae50('0x69')][_0xae50('0x8d')];return _0x533aa7(msgResponse('ifTime','Failure',_0x3db9da+_0xae50('0x8e')));}if(_0x521135&&_['isUndefined'](config[_0xae50('0x8f')][_0x521135])){_0x46aa8f[_0xae50('0x68')]=utils[_0xae50('0x69')][_0xae50('0x90')];return _0x533aa7(msgResponse(_0xae50('0x91'),_0xae50('0x8b'),_0x3db9da+_0xae50('0x92')+_0x521135));}if(_[_0xae50('0x93')](_0xfd1ca7)){for(var _0x5c1567=0x0;_0x5c1567<_0xfd1ca7['length'];_0x5c1567+=0x1){_0x4bbef9[_0xae50('0x94')](ami[_0xae50('0x95')]({'action':'command','command':util[_0xae50('0x45')]('iftime\x20%s,%s',_0xfd1ca7[_0x5c1567]['interval'],!_[_0xae50('0x55')](config[_0xae50('0x8f')][_0x521135])?_0x521135:'')})[_0xae50('0x3f')](function(_0x25f06c){return _0x25f06c['content'][_0xae50('0x96')](_0xae50('0x97'))>=0x0;})[_0xae50('0x98')](myreject(_0x533aa7)));}}else{_0x4bbef9[_0xae50('0x94')](ami['Action']({'action':_0xae50('0x99'),'command':util[_0xae50('0x45')](_0xae50('0x9a'),_0xfd1ca7,!_[_0xae50('0x55')](config['timezones'][_0x521135])?_0x521135:'')})[_0xae50('0x3f')](function(_0x5e8510){return _0x5e8510[_0xae50('0x9b')][_0xae50('0x96')](_0xae50('0x97'))>=0x0;})[_0xae50('0x98')](myreject(_0x533aa7)));}Promise[_0xae50('0x9c')](_0x4bbef9)[_0xae50('0x3f')](function(_0x34f0a5){var _0x3d82c9=_[_0xae50('0x9d')](_0x34f0a5);if(_0x3d82c9){return _0x3be489(_0x3d82c9);}else{_0x46aa8f['message']=_0x1df78a?utils[_0xae50('0x69')][_0xae50('0x9e')]:utils[_0xae50('0x69')][_0xae50('0x9f')];return _0x533aa7(msgResponse('[ifTime][promiseAll]','Failure',_0xae50('0xa0')+_0x1df78a+'\x20'+_0x3db9da+_0xae50('0xa1')+util[_0xae50('0x44')](_0xfd1ca7,{'showHidden':![],'depth':null})+_0xae50('0xa2')+_0x521135));}})[_0xae50('0x98')](function(_0x5a7190){return _0x533aa7(msgResponse(_0xae50('0x91'),'Failure',JSON['stringify'](_0x5a7190)));});});};Dialer['prototype'][_0xae50('0x3c')]=function(){var _0xc5df4d=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xae50('0x3f')](function(){setInterval(function(){_0xc5df4d[_0xae50('0xa3')]();},0x3e8);});};Dialer['prototype'][_0xae50('0xa3')]=function(){var _0x324168=this;var _0x3c1113;for(var _0x4a0d45 in this[_0xae50('0x24')]){if(typeof this[_0xae50('0x24')][_0x4a0d45]!==_0xae50('0xa4')){_0x3c1113=this[_0xae50('0x24')][_0x4a0d45];if(utils[_0xae50('0xa5')](_0x3c1113)&&utils[_0xae50('0xa6')](_0x3c1113)){_0x3c1113[_0xae50('0x79')]=!![];Promise['resolve']()[_0xae50('0x3f')](checkIsIVRCampaignActive(_0x3c1113))[_0xae50('0x3f')](checkInterval(_0x3c1113))[_0xae50('0x3f')](_0x324168[_0xae50('0xa7')](_0x3c1113))[_0xae50('0x3f')](_0x324168[_0xae50('0x89')](_0x3c1113[_0xae50('0xa8')],_0x3c1113[_0xae50('0xa9')],_0x3c1113[_0xae50('0x47')],_0x3c1113))['then'](_0x324168[_0xae50('0xaa')](_0x3c1113[_0xae50('0x73')],_0x3c1113[_0xae50('0xa9')],_0x3c1113[_0xae50('0x47')],_0x3c1113))[_0xae50('0x3f')](_0x324168[_0xae50('0xab')](_0x3c1113))[_0xae50('0x98')](loggerCatchQueueSummary(_0xae50('0xac'),_0x3c1113));}else{notSendMessagesCampaign(_0x3c1113);}}}};Dialer[_0xae50('0x1f')][_0xae50('0xad')]=function(_0x3c571e){if(_0x3c571e[_0xae50('0xae')]!==_0xae50('0xa')){clearPredictiveAttributes(_0x3c571e);}switch(_0x3c571e[_0xae50('0xae')]){case _0xae50('0xaf'):this[_0xae50('0xb0')](_0x3c571e,0x1);break;case _0xae50('0xb1'):this['handlePower'](_0x3c571e,_0x3c571e[_0xae50('0xb2')]);break;case _0xae50('0xa'):this[_0xae50('0xa')](_0x3c571e);break;case'booked':this[_0xae50('0xb0')](_0x3c571e,0x1);break;default:logger[_0xae50('0x66')]('Queue',_0x3c571e['name'],_0xae50('0xb3'));}};Dialer['prototype'][_0xae50('0x91')]=function(_0x20b78a,_0xdb0079){var _0x113173=_0x20b78a[_0xae50('0xa9')];var _0x45b57c=_0xdb0079?_0x20b78a[_0xae50('0xa8')]:_0x20b78a['Interval']['Intervals'];logger['silly'](_0xae50('0xb4'),_0x45b57c,_0x113173,_0x20b78a[_0xae50('0x47')],util[_0xae50('0x45')](_0xae50('0xb5'),_0x20b78a[_0xae50('0x47')],_0x20b78a['id']));var _0x1b8e67=null;return Interval[_0xae50('0xb6')](_0x45b57c,_0x113173)[_0xae50('0x3f')](function(_0x3e85c9){if(_0x3e85c9===!![]){return _0x3e85c9;}else{_0x20b78a['message']=_0xdb0079?utils[_0xae50('0x69')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0xae50('0x9f')];_0x1b8e67=msgResponse(_0xae50('0xb7'),'Failure',_0xae50('0xa0')+_0xdb0079+'\x20'+_0x20b78a[_0xae50('0x47')]+_0xae50('0xa1')+util[_0xae50('0x44')](_0x45b57c,{'showHidden':![],'depth':null})+_0xae50('0xa2')+_0x113173);}if(_0x1b8e67!==null){logger['silly'](_0xae50('0xb8'),_0x1b8e67);_0x1b8e67[_0xae50('0xb9')]=_0xdb0079;throw _0x1b8e67;}})[_0xae50('0x98')](function(_0x441f5c){logger[_0xae50('0x66')]('AMI\x20IfTime',_0x441f5c);throw msgResponse(_0xae50('0x7f'),_0xae50('0x80'),util['inspect'](_0x441f5c,{'showHidden':![],'depth':null}));});};Dialer[_0xae50('0x1f')]['syncAgentConnect']=function(_0x54725a){if(this['voiceQueues'][_0x54725a[_0xae50('0xba')]]){if(this[_0xae50('0xbb')][_0x54725a['uniqueid']]&&this['uniqueId'][_0x54725a[_0xae50('0xbc')]][_0xae50('0x42')]!==_0xae50('0xbd')){utils[_0xae50('0xbe')](this[_0xae50('0x23')][_0x54725a[_0xae50('0xba')]],_0xae50('0xbf'));this[_0xae50('0xbb')][_0x54725a['uniqueid']][_0xae50('0xc0')]=moment()[_0xae50('0x45')](_0xae50('0xc1'));}}};Dialer[_0xae50('0x1f')][_0xae50('0xc2')]=function(_0x4c904c){var _0x2875ad=this['uniqueId'][_0x4c904c['uniqueid']];if(this[_0xae50('0x23')][_0x4c904c[_0xae50('0xba')]]){if(_0x2875ad&&_0x2875ad['type']!=='ivr'){delete this[_0xae50('0xbb')][_0x4c904c['uniqueid']];this['voiceQueues'][_0x4c904c[_0xae50('0xba')]][_0xae50('0xc3')]+=0x1;var _0x52ac06=new AgentComplete(_0x2875ad,_0x4c904c);if(_0x4c904c[_0xae50('0xc4')]===_0xae50('0xc5')){_0x52ac06['agiafterat']=this[_0xae50('0x23')][_0x4c904c[_0xae50('0xba')]][_0xae50('0xc6')]&&this[_0xae50('0x23')][_0x4c904c['queue']][_0xae50('0xc7')]?moment()[_0xae50('0x45')](_0xae50('0xc1')):undefined;}hopperUtils[_0xae50('0xc8')](_0x52ac06)[_0xae50('0x98')](loggerCatch(_0xae50('0xc9')));hopperUtils['moveContactManagedDialer'](_0x52ac06)[_0xae50('0x98')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xae50('0xca')]=function(_0x49aba2){var _0x187aac=this[_0xae50('0xbb')][_0x49aba2[_0xae50('0xbc')]];var _0x1c79d5=this;var _0x4d7735=![];var _0x43e9cb;var _0x3cb08e;if(this[_0xae50('0x23')][_0x49aba2[_0xae50('0xba')]]){if(_0x187aac&&_0x187aac[_0xae50('0x42')]!==_0xae50('0xbd')){delete this[_0xae50('0xbb')][_0x49aba2['uniqueid']];utils[_0xae50('0xbe')](this['voiceQueues'][_0x49aba2['queue']],_0xae50('0xcb'));_0x187aac[_0xae50('0xcc')]=moment()[_0xae50('0x45')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1fc090=new QueueCallerAbandon(_0x187aac,_0x49aba2);if(utils[_0xae50('0x62')](_0x187aac[_0xae50('0xcc')],_0x187aac[_0xae50('0xcd')])>=_0x187aac[_0xae50('0xce')]){this['voiceQueues'][_0x49aba2['queue']][_0xae50('0x4f')]+=0x1;this[_0xae50('0x23')][_0x49aba2[_0xae50('0xba')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xae50('0x23')][_0x49aba2[_0xae50('0xba')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x1fc090[_0xae50('0xcf')]=0xa;_0x1fc090['statedesc']=_0xae50('0xd0');_0x1fc090[_0xae50('0xd1')]=_0xae50('0xd2');_0x1fc090[_0xae50('0xd3')]=this[_0xae50('0x23')][_0x49aba2[_0xae50('0xba')]][_0xae50('0xc6')]?moment()[_0xae50('0x45')](_0xae50('0xc1')):undefined;_0x1fc090['countdropretry']+=0x1;_0x1fc090[_0xae50('0xd4')]+=0x1;_0x43e9cb=this[_0xae50('0x23')][_0x49aba2[_0xae50('0xba')]]['dialDropRetryFrequency'];_0x3cb08e=this[_0xae50('0x23')][_0x49aba2[_0xae50('0xba')]][_0xae50('0xd5')];hopperUtils[_0xae50('0xd6')](_0x1fc090,_0x1fc090[_0xae50('0xcf')],_0x187aac['voiceQueue'])[_0xae50('0x3f')](function(_0x3fee17){_0x4d7735=_0x3fee17[_0xae50('0xd7')]==0x1;if(_0x1fc090[_0xae50('0xd8')]>=_0x1c79d5[_0xae50('0x23')][_0x49aba2['queue']]['dialDropMaxRetry']){_0x1c79d5[_0xae50('0xd9')](_0x1fc090,_0x3fee17['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1fc090[_0xae50('0xd8')],'scheduledat':moment()['add'](_0x1c79d5[_0xae50('0x23')][_0x49aba2[_0xae50('0xba')]][_0xae50('0xda')],_0xae50('0xdb'))[_0xae50('0x45')](_0xae50('0xc1')),'ContactId':_0x187aac[_0xae50('0xdc')],'ListId':_0x187aac[_0xae50('0xdd')],'VoiceQueueId':_0x187aac[_0xae50('0xde')]||undefined,'CampaignId':_0x187aac[_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch(_0xae50('0xe0')));var _0x23f900=new History(_0x1fc090);_0x23f900[_0xae50('0xcf')]=0xa;_0x23f900[_0xae50('0xe1')]='Drop';_0x23f900[_0xae50('0xe2')]=moment()[_0xae50('0x45')](_0xae50('0xc1'));_0x23f900['endtime']=_0x23f900[_0xae50('0xe2')];_0x23f900[_0xae50('0xe3')]=_0x1fc090['calleridname'];_0x23f900['calleridnum']=_0x1fc090[_0xae50('0xe4')];hopperUtils[_0xae50('0xc8')](_0x23f900)[_0xae50('0x98')](loggerCatch(_0xae50('0xe5')));}})[_0xae50('0x3f')](function(){if(_0x4d7735)hopperUtils[_0xae50('0xe6')](_0x1fc090,_0x43e9cb,_0x3cb08e)[_0xae50('0x3f')](function(){return 0x1;});});}else{this[_0xae50('0x23')][_0x49aba2[_0xae50('0xba')]][_0xae50('0x51')]+=0x1;this['voiceQueues'][_0x49aba2[_0xae50('0xba')]][_0xae50('0xe7')]+=0x1;_0x1fc090['state']=0xb;_0x1fc090['statedesc']='Abandoned';_0x1fc090[_0xae50('0xd1')]=_0xae50('0xe8');_0x1fc090[_0xae50('0xe9')]+=0x1;_0x1fc090['countglobal']+=0x1;_0x43e9cb=this['voiceQueues'][_0x49aba2[_0xae50('0xba')]][_0xae50('0xea')];_0x3cb08e=this[_0xae50('0x23')][_0x49aba2['queue']][_0xae50('0xd5')];hopperUtils['verifyAdditionalPhones'](_0x1fc090,_0x1fc090[_0xae50('0xcf')],_0x187aac[_0xae50('0xeb')])[_0xae50('0x3f')](function(_0x208543){if(_0x1fc090['countabandonedretry']>=_0x1c79d5['voiceQueues'][_0x49aba2['queue']][_0xae50('0xec')]){_0x1c79d5[_0xae50('0xd9')](_0x1fc090,_0x208543['additional']);}else{hopperUtils[_0xae50('0xed')]({'active':![],'countabandonedretry':_0x1fc090[_0xae50('0xe9')],'scheduledat':moment()[_0xae50('0xee')](_0x1c79d5[_0xae50('0x23')][_0x49aba2[_0xae50('0xba')]][_0xae50('0xea')],_0xae50('0xdb'))[_0xae50('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x187aac['ContactId'],'ListId':_0x187aac[_0xae50('0xdd')],'VoiceQueueId':_0x187aac[_0xae50('0xde')]||undefined,'CampaignId':_0x187aac['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0xefdce3=new History(_0x1fc090);_0xefdce3['state']=0xb;_0xefdce3[_0xae50('0xe1')]='Abandoned';_0xefdce3[_0xae50('0xe2')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xefdce3[_0xae50('0x6e')]=_0xefdce3[_0xae50('0xe2')];_0xefdce3['calleridname']=_0x1fc090['calleridname'];_0xefdce3[_0xae50('0xe4')]=_0x1fc090['calleridnum'];hopperUtils[_0xae50('0xc8')](_0xefdce3)[_0xae50('0x98')](loggerCatch(_0xae50('0xef')));}})[_0xae50('0x3f')](function(){if(_0x4d7735)hopperUtils['swapAdditionalPhones'](_0x1fc090,_0x43e9cb,_0x3cb08e)[_0xae50('0x3f')](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0xdd65db){if(this[_0xae50('0x29')][_0xdd65db[_0xae50('0xbc')]]){this['actions'][_0xdd65db[_0xae50('0xbc')]][_0xae50('0xf0')]=_0xdd65db[_0xae50('0xf0')];}if(this['uniqueId'][_0xdd65db['uniqueid']]){this[_0xae50('0xbb')][_0xdd65db['uniqueid']][_0xae50('0xf0')]=_0xdd65db[_0xae50('0xf0')];}};Dialer[_0xae50('0x1f')][_0xae50('0x39')]=function(_0x551fb0){if(!this[_0xae50('0x29')][_0x551fb0[_0xae50('0xf1')]]){return;}var _0x2b1223=this[_0xae50('0x23')][this['actions'][_0x551fb0['actionid']][_0xae50('0xba')]][_0xae50('0xf2')]||_0xae50('0xf3');if(_0x2b1223===_0xae50('0xf4')){if(this[_0xae50('0x29')][_0x551fb0[_0xae50('0xf1')]]&&_[_0xae50('0xf5')](this[_0xae50('0x29')][_0x551fb0[_0xae50('0xf1')]][_0xae50('0xf6')])&&_0x551fb0[_0xae50('0x83')]==='1'&&_0x551fb0[_0xae50('0xf7')]==='0'){if(this[_0xae50('0x25')][_0x551fb0[_0xae50('0xf8')]]){if(!this[_0xae50('0x25')][_0x551fb0[_0xae50('0xf8')]][_0xae50('0xf6')]){this[_0xae50('0x25')][_0x551fb0[_0xae50('0xf8')]]['locked']=!![];this[_0xae50('0x29')][_0x551fb0[_0xae50('0xf1')]][_0xae50('0xf6')]=!![];this[_0xae50('0x29')][_0x551fb0['actionid']][_0xae50('0xf8')]=_0x551fb0[_0xae50('0xf8')];}}}}else if(_0x2b1223===_0xae50('0xf3')){if(this[_0xae50('0x29')][_0x551fb0['actionid']]){if(this[_0xae50('0x25')][_0x551fb0[_0xae50('0xf8')]]){this[_0xae50('0x29')][_0x551fb0[_0xae50('0xf1')]]['stateinterface']=_0x551fb0[_0xae50('0xf8')];if(_[_0xae50('0xf5')](this[_0xae50('0xf9')][this['actions'][_0x551fb0['actionid']][_0xae50('0xba')]])){this[_0xae50('0xf9')][this[_0xae50('0x29')][_0x551fb0[_0xae50('0xf1')]][_0xae50('0xba')]]=[];}this[_0xae50('0xf9')][this[_0xae50('0x29')][_0x551fb0[_0xae50('0xf1')]][_0xae50('0xba')]][_0xae50('0x94')](_[_0xae50('0x61')](_[_0xae50('0xfa')](this[_0xae50('0x29')][_0x551fb0[_0xae50('0xf1')]],['idHopper',_0xae50('0xf8')]),{'status':_0x551fb0['status'],'paused':_0x551fb0['paused']}));}}}};Dialer[_0xae50('0x1f')][_0xae50('0x3b')]=function(_0x3b282d){if(!this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]]){return;}var _0x2e26e6=this;var _0x2f0624=this[_0xae50('0x23')][this[_0xae50('0x29')][_0x3b282d['actionid']]['queue']];var _0xd4dc5f=_0x2f0624['strategy']||'rrmemory';if(_0xd4dc5f===_0xae50('0xf4')){if(this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]]&&this['actions'][_0x3b282d['actionid']][_0xae50('0xf8')]){this['preview']['run'](this[_0xae50('0x29')][_0x3b282d['actionid']][_0xae50('0xfb')],this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]][_0xae50('0xf8')])['catch'](function(_0x1e1847){logger[_0xae50('0x66')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x1e1847,{'showHidden':![],'depth':null}));})[_0xae50('0x21')](function(){utils[_0xae50('0xbe')](_0x2e26e6[_0xae50('0x23')][_0x2e26e6[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]][_0xae50('0xba')]],_0xae50('0xfc'));_0x2e26e6[_0xae50('0x25')][_0x2e26e6['actions'][_0x3b282d[_0xae50('0xf1')]][_0xae50('0xf8')]][_0xae50('0xf6')]=![];delete _0x2e26e6[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]];unlockQueueStatus(_0x2f0624);});}else{utils[_0xae50('0xbe')](this[_0xae50('0x23')][this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]][_0xae50('0xba')]],_0xae50('0xfc'));hopperUtils[_0xae50('0xed')]({'active':![],'ContactId':this[_0xae50('0x29')][_0x3b282d['actionid']][_0xae50('0xdc')],'ListId':this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]][_0xae50('0xdd')],'VoiceQueueId':this[_0xae50('0x29')][_0x3b282d['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]][_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch(_0xae50('0xfd')));delete this['actions'][_0x3b282d[_0xae50('0xf1')]];unlockQueueStatus(_0x2f0624);}}else if(_0xd4dc5f==='rrmemory'){var _0x574a50;if(this['actions'][_0x3b282d['actionid']]&&!_[_0xae50('0x48')](this['queueBooked'][this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]]['queue']])){if(this[_0xae50('0xfe')][_0x2e26e6['actions'][_0x3b282d[_0xae50('0xf1')]][_0xae50('0xba')]]){this[_0xae50('0xfe')][_0x2e26e6['actions'][_0x3b282d['actionid']]['queue']]=this['queueBookedRR'][this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]][_0xae50('0xba')]]?this['queueBookedRR'][this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]]['queue']]:this[_0xae50('0xf9')][this[_0xae50('0x29')][_0x3b282d['actionid']][_0xae50('0xba')]]?this[_0xae50('0xf9')][this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]]['queue']][_0xae50('0xff')]||0x0:0x0;}this['queueBooked'][this[_0xae50('0x29')][_0x3b282d['actionid']][_0xae50('0xba')]][_0xae50('0xff')]=this[_0xae50('0xfe')][this[_0xae50('0x29')][_0x3b282d[_0xae50('0xf1')]][_0xae50('0xba')]];for(var _0x5a2375=0x0;_0x5a2375=_0x3c1452[_0xae50('0x125')]){_0x58a157[_0xae50('0x126')](_0x35925c,_0x56209e,_0x423627,'reason19\x20machine....');}else{if(_0x35925c[_0xae50('0x120')]>=_0x3c1452[_0xae50('0x127')]){_0x58a157['createStateFinal'](_0x35925c,_0x56209e,_0x423627,_0xae50('0x128'));}else{hopperUtils[_0xae50('0xed')]({'active':![],'countmachineretry':_0x35925c[_0xae50('0x120')],'scheduledat':moment()[_0xae50('0xee')](_0x3c1452[_0xae50('0x129')],_0xae50('0xdb'))[_0xae50('0x45')](_0xae50('0xc1')),'ContactId':_0x35925c[_0xae50('0xdc')],'ListId':_0x35925c['ListId'],'VoiceQueueId':_0x35925c[_0xae50('0xde')]||undefined,'CampaignId':_0x35925c[_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch(_0xae50('0x12a')));_0x56209e({'reschedule':0x1});}}});}if(_0x8634f1[_0xae50('0x42')]===_0xae50('0xbd')&&this['campaigns'][_0x8634f1[_0xae50('0xba')]]['dialAMDActive']&&_0x4a698b[_0xae50('0x113')]===_0xae50('0x114')){delete this[_0xae50('0xbb')][_0x4a698b[_0xae50('0xbc')]];utils['decrementOriginate'](this['campaigns'][_0x8634f1[_0xae50('0xba')]],_0xae50('0x115'));_0x4175c7=new Hangup(_0x8634f1,_0x4a698b);_0x4175c7['state']=0x12;_0x4175c7[_0xae50('0xe1')]=_0xae50('0x117');_0x4175c7[_0xae50('0x12b')]=_0xae50('0x118');ami[_0xae50('0x41')](_0xae50('0x119'),ut['buildObj'](_0x4175c7,_0xae50('0x11a')));this['saveInDb'](_0x4175c7,_0xae50('0x12c'),_0xae50('0x12d'));}if(_0x8634f1[_0xae50('0x42')]===_0xae50('0xbd')&&this[_0xae50('0x24')][_0x8634f1[_0xae50('0xba')]][_0xae50('0x112')]&&_0x4a698b[_0xae50('0x113')]===_0xae50('0x11e')){return new Promise(function(_0x84758a,_0x8fbafb){delete _0x58a157[_0xae50('0xbb')][_0x4a698b[_0xae50('0xbc')]];utils[_0xae50('0xbe')](_0x58a157['campaigns'][_0x8634f1[_0xae50('0xba')]],_0xae50('0x115'));_0x58a157[_0xae50('0x24')][_0x8634f1['queue']][_0xae50('0xc3')]+=0x1;_0x58a157['campaigns'][_0x8634f1[_0xae50('0xba')]][_0xae50('0x116')]+=0x1;var _0x3988a8=_0x58a157[_0xae50('0x24')][_0x8634f1[_0xae50('0xba')]];var _0x3f50f4=new Hangup(_0x8634f1,_0x4a698b);_0x3f50f4[_0xae50('0xcf')]=0x13;_0x3f50f4[_0xae50('0xe1')]=_0xae50('0x11f');_0x3f50f4[_0xae50('0x12b')]='AMD';_0x3f50f4['countmachineretry']+=0x1;_0x3f50f4[_0xae50('0xd4')]+=0x1;_0x3f50f4[_0xae50('0x11a')]=!![];ami[_0xae50('0x41')](_0xae50('0x119'),ut['buildObj'](_0x3f50f4,'amd'));hopperUtils[_0xae50('0xc8')](_0x3f50f4)[_0xae50('0x98')](loggerCatch(_0xae50('0x122')));if(_0x3f50f4[_0xae50('0x123')]+_0x3f50f4[_0xae50('0x12e')]+_0x3f50f4['countnoanswerretry']+_0x3f50f4[_0xae50('0x12f')]+_0x3f50f4[_0xae50('0xd8')]+_0x3f50f4['countabandonedretry']+_0x3f50f4[_0xae50('0x120')]+_0x3f50f4[_0xae50('0x124')]>=_0x3988a8[_0xae50('0x125')]){_0x58a157['stateGlobal'](_0x3f50f4,_0x84758a,_0x8fbafb,_0xae50('0x130'));}else{if(_0x3f50f4['countmachineretry']>=_0x3988a8[_0xae50('0x127')]){_0x58a157[_0xae50('0x131')](_0x3f50f4,_0x84758a,_0x8fbafb,_0xae50('0x128'));}else{hopperUtils[_0xae50('0xed')]({'active':![],'countmachineretry':_0x3f50f4[_0xae50('0x120')],'scheduledat':moment()['add'](_0x3988a8[_0xae50('0x129')],_0xae50('0xdb'))[_0xae50('0x45')](_0xae50('0xc1')),'ContactId':_0x3f50f4[_0xae50('0xdc')],'ListId':_0x3f50f4['ListId'],'VoiceQueueId':_0x3f50f4[_0xae50('0xde')]||undefined,'CampaignId':_0x3f50f4[_0xae50('0xdf')]||undefined})['catch'](loggerCatch(_0xae50('0x12a')));_0x84758a({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xae50('0x34')]=function(_0x35d34e){var _0x4324b5=this[_0xae50('0xbb')][_0x35d34e[_0xae50('0xbc')]];var _0x18cc46;if(!_0x4324b5){return;}if(_0x4324b5[_0xae50('0x42')]==='ivr'){delete this[_0xae50('0xbb')][_0x35d34e['uniqueid']];utils[_0xae50('0xbe')](this['campaigns'][_0x4324b5[_0xae50('0xba')]],'[syncHangup]');this[_0xae50('0x24')][_0x4324b5[_0xae50('0xba')]][_0xae50('0x132')]+=0x1;if(_0x35d34e[_0xae50('0x133')]===_0xae50('0x134')){const _0x27d2ee=new AgentComplete(_0x4324b5,_0x35d34e);_0x27d2ee['CampaignId']=this[_0xae50('0x24')][_0x4324b5['queue']]['id'];hopperUtils[_0xae50('0xc8')](_0x27d2ee)['catch'](loggerCatch(_0xae50('0x135')));hopperUtils[_0xae50('0x136')](_0x27d2ee)[_0xae50('0x98')](loggerCatch(_0xae50('0x137')));}else{_0x18cc46=new Hangup(_0x4324b5,_0x35d34e);hopperUtils[_0xae50('0xc8')](_0x18cc46)[_0xae50('0x98')](loggerCatch(_0xae50('0x138')));hopperUtils['moveContactManagedDialer'](_0x18cc46)[_0xae50('0x98')](loggerCatch(_0xae50('0x139')));}}else{if(isNotNull(this[_0xae50('0x23')][_0x4324b5[_0xae50('0xba')]][_0xae50('0x13a')])){delete this[_0xae50('0xbb')][_0x35d34e[_0xae50('0xbc')]];utils[_0xae50('0xbe')](this[_0xae50('0x23')][_0x4324b5[_0xae50('0xba')]],_0xae50('0x13b'));this[_0xae50('0x23')][_0x4324b5[_0xae50('0xba')]]['outboundAnswerCallsDay']+=0x1;this[_0xae50('0x23')][_0x4324b5[_0xae50('0xba')]][_0xae50('0x116')]+=0x1;_0x18cc46=new Hangup(_0x4324b5,_0x35d34e);_0x18cc46[_0xae50('0xcf')]=0x10;_0x18cc46[_0xae50('0xe1')]=_0xae50('0x13c');_0x18cc46[_0xae50('0x12b')]=_0xae50('0x13d');hopperUtils['createHistory'](_0x18cc46)['catch'](loggerCatch(_0xae50('0x138')));hopperUtils[_0xae50('0x136')](_0x18cc46)[_0xae50('0x98')](loggerCatch(_0xae50('0x139')));}else{delete this[_0xae50('0xbb')][_0x35d34e[_0xae50('0xbc')]];utils[_0xae50('0xbe')](this['voiceQueues'][_0x4324b5[_0xae50('0xba')]],'[syncHangup2]');if(_0x35d34e[_0xae50('0x133')]===_0xae50('0x134')){this[_0xae50('0x23')][_0x4324b5['queue']]['outboundAnswerCallsDay']+=0x1;const _0x3d0af4=new AgentComplete(_0x4324b5,_0x35d34e);_0x3d0af4[_0xae50('0xde')]=this['voiceQueues'][_0x4324b5['queue']]['id'];hopperUtils[_0xae50('0xc8')](_0x3d0af4)[_0xae50('0x98')](loggerCatch(_0xae50('0xc9')));hopperUtils[_0xae50('0x136')](_0x3d0af4)['catch'](loggerCatch('[syncAgentComplete]'));}else{this[_0xae50('0x23')][_0x4324b5[_0xae50('0xba')]][_0xae50('0x13e')]+=0x1;_0x18cc46=new Hangup(_0x4324b5,_0x35d34e);_0x18cc46[_0xae50('0xcf')]=0xc;_0x18cc46[_0xae50('0xe1')]=_0x35d34e[_0xae50('0x133')];_0x18cc46['membername']=_0xae50('0x13f');hopperUtils[_0xae50('0xc8')](_0x18cc46)[_0xae50('0x98')](loggerCatch(_0xae50('0x140')));hopperUtils[_0xae50('0x136')](_0x18cc46)[_0xae50('0x98')](loggerCatch('[syncHangup]'));}}}};Dialer[_0xae50('0x1f')][_0xae50('0xd')]=function(_0x41de38){var _0x2dc8f3=this;if(!_0x2dc8f3['queuesSummary'][_0x41de38[_0xae50('0x47')]]){_0x2dc8f3[_0xae50('0x2e')][_0x41de38[_0xae50('0x47')]]={'running':![]};}else if(_0x2dc8f3[_0xae50('0x2e')][_0x41de38[_0xae50('0x47')]]['running']===!![]){return;}else if(_0x2dc8f3['queuesSummary'][_0x41de38[_0xae50('0x47')]]['running']===![]){_0x2dc8f3[_0xae50('0x2e')][_0x41de38[_0xae50('0x47')]]['running']=!![];}var _0x330f07=_0x2dc8f3[_0xae50('0x23')][_0x41de38[_0xae50('0x47')]];var _0x3ade3c=_0x330f07[_0xae50('0x68')]!==utils[_0xae50('0x69')][_0xae50('0x7b')];var _0x41faae=utils[_0xae50('0x141')](_0x330f07);_0x330f07[_0xae50('0x142')]=utils['getQueueCampaignStatusMessage'](_0x330f07,_0x2dc8f3[_0xae50('0x26')]);Promise['resolve']()['then'](function(){if(_0x330f07[_0xae50('0x142')]===utils[_0xae50('0x69')][_0xae50('0x7b')]){if(_0x3ade3c){clearPredictiveAttributes(_0x330f07);_0x41de38[_0xae50('0x2b')]=undefined;_0x41de38[_0xae50('0x2c')]=undefined;}if(_0x330f07[_0xae50('0x142')]===utils['CAMPAIGN_STATUS']['INACTIVE']){_0x41de38['available']=0x0;_0x41de38['paused']=0x0;_0x41de38['inUse']=0x0;_0x41de38[_0xae50('0x143')]=0x0;_0x41de38[_0xae50('0x144')]=0x0;}}else if(_0x330f07[_0xae50('0x142')]===utils[_0xae50('0x69')][_0xae50('0x145')]&&!_0x41faae){return _0x2dc8f3[_0xae50('0x91')](_0x330f07,!![])[_0xae50('0x3f')](function(){return _0x2dc8f3['ifTime'](_0x330f07,![]);})['then'](function(){return _0x2dc8f3[_0xae50('0xad')](_0x330f07);})['catch'](function(_0x438ecf){loggerSyncQueueSummary[_0xae50('0x63')](_0xae50('0x146'),util[_0xae50('0x44')](_0x438ecf,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x330f07);});}else{clearPredictiveAttributes(_0x330f07);}})['then'](function(){var _0x247bc4=_0x41de38[_0xae50('0x147')](_0x330f07);if(_0x247bc4||_0x330f07[_0xae50('0x148')]){_0x330f07[_0xae50('0x148')]=![];_0x41de38['updateReportFromOutboundQueue'](_0x330f07);Object[_0xae50('0x149')](_0x330f07,_0x41de38);emitOutboundVoiceQueueSummary(_0x41de38);}_0x2dc8f3[_0xae50('0x2e')][_0x330f07['name']][_0xae50('0x14a')]=![];})[_0xae50('0x98')](function(_0x2d35d0){logger[_0xae50('0x66')]('[syncQueueSummary]',util[_0xae50('0x44')](_0x2d35d0,{'showHidden':![],'depth':null}));_0x2dc8f3['queuesSummary'][_0x330f07[_0xae50('0x47')]][_0xae50('0x14a')]=![];});};Dialer[_0xae50('0x1f')][_0xae50('0x14b')]=_[_0xae50('0x14c')](function(){var _0x13abdf=_[_0xae50('0x14d')](this[_0xae50('0x23')],function(_0x159176){return _0x159176[_0xae50('0x14e')];});var _0x5f543d=_[_0xae50('0x14d')](this['agents'],function(_0x2fb124){return _0x2fb124[_0xae50('0x14f')]&&_0x2fb124[_0xae50('0x83')]==='reachable';});if(_0x13abdf[_0xae50('0x100')]>0x0&&_0x5f543d[_0xae50('0x100')]>0x0){return Promise[_0xae50('0x150')]()[_0xae50('0x3f')](cmHopper[_0xae50('0x151')](_[_0xae50('0x152')](_0x13abdf,'id'),previewRecallmeReminderInterval,_['map'](_0x5f543d,'id')))[_0xae50('0x3f')](function(_0x200d84){for(var _0x32ea97=0x0;_0x32ea97<_0x200d84[_0xae50('0x100')];_0x32ea97++){var _0x52d6f3=_0x200d84[_0x32ea97]['Agent']['name'];if(_0x52d6f3)io['to'](util[_0xae50('0x45')]('user:%s',_0x52d6f3))['emit'](_0xae50('0x153'),{'hopper':_0x200d84[_0x32ea97]});}})['catch'](function(_0x59d54f){logger[_0xae50('0x66')]('checkPreviewRecallReminder',_0x59d54f);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xae50('0x1f')]['loopClearZombieChannels']=function(){var _0x20a262=this;setInterval(function(){_0x20a262[_0xae50('0x154')](_0x20a262[_0xae50('0xbb')],_0xae50('0x155'));_0x20a262[_0xae50('0x154')](_0x20a262[_0xae50('0x29')],_0xae50('0x156'));},0x32c8);};Dialer[_0xae50('0x1f')][_0xae50('0x154')]=function(_0x315b75,_0x4dcc48){var _0x421103=this;for(var _0x40d04a in _0x315b75){if(typeof _0x315b75[_0x40d04a]!=='undefined'){this['sequence'][_0xae50('0x157')](function(){if(!_[_0xae50('0xf5')](_0x315b75[_0x40d04a])){return ami[_0xae50('0x95')]({'action':_0xae50('0x83'),'channel':_0x315b75[_0x40d04a]['channel']})['catch'](function(_0x377460){if(_0x377460[_0xae50('0x68')]===_0xae50('0x158')){setTimeout(function(){if(_0x315b75[_0x40d04a]&&_0x315b75[_0x40d04a][_0xae50('0x42')]!==_0xae50('0xbd')){utils['decrementOriginate'](_0x421103[_0xae50('0x23')][_0x315b75[_0x40d04a][_0xae50('0xba')]],_0xae50('0x159'));logger[_0xae50('0x66')](_0xae50('0x15a'),_0x4dcc48,_0x40d04a,_0x315b75[_0x40d04a][_0xae50('0xba')]);delete _0x315b75[_0x40d04a];}if(_0x315b75[_0x40d04a]&&_0x315b75[_0x40d04a][_0xae50('0x42')]===_0xae50('0xbd')){utils[_0xae50('0xbe')](_0x421103[_0xae50('0x24')][_0x315b75[_0x40d04a]['queue']],_0xae50('0x159'));logger[_0xae50('0x66')](_0xae50('0x15b'),_0x4dcc48,_0x40d04a,_0x315b75[_0x40d04a][_0xae50('0xba')]);delete _0x315b75[_0x40d04a];}},0x2328);}});}});}}};Dialer[_0xae50('0x1f')][_0xae50('0x15c')]=function(_0x1501b8){return Promise[_0xae50('0x150')]()['then'](voiceQueueRt[_0xae50('0x15c')](_0x1501b8))['catch'](loggerCatch(_0xae50('0x15d')));};Dialer[_0xae50('0x1f')][_0xae50('0x15e')]=function(_0x593823,_0x3d6106,_0x517201){var _0x438bfd={'state':0x19,'statedesc':_0xae50('0x15f')};utils[_0xae50('0xbe')](_0x3d6106,_0xae50('0x160')+_0x593823);this['saveInDb'](_[_0xae50('0x61')](_0x438bfd,_[_0xae50('0xfa')](_0x517201,['ContactId','ListId',_0xae50('0x161'),_0xae50('0xde'),'CampaignId'])),_0xae50('0x162'),'[emptyContact]');logger['error'](_0x593823);};Dialer['prototype'][_0xae50('0x11b')]=function(_0x1553fa,_0x39af86,_0x53c0a8){hopperUtils[_0xae50('0xc8')](_0x1553fa)[_0xae50('0x98')](loggerCatch(_0x39af86));hopperUtils['moveContactManagedDialer'](_0x1553fa)[_0xae50('0x98')](loggerCatch(_0x53c0a8));};Dialer[_0xae50('0x1f')]['queueCallerAbandonCreateState']=function(_0x13f4af,_0x19d2f4){hopperUtils[_0xae50('0xc8')](_0x13f4af)[_0xae50('0x98')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x19d2f4==0x0){hopperUtils[_0xae50('0x136')](_0x13f4af)[_0xae50('0x98')](loggerCatch(_0xae50('0x163')));}};Dialer[_0xae50('0x1f')][_0xae50('0x164')]=function(_0x29d8a8){return Promise['resolve']()[_0xae50('0x3f')](cmHopper[_0xae50('0x151')](_0x29d8a8['id'],previewRecallmeReminderInterval))[_0xae50('0x3f')](function(_0x4a100b){for(var _0x4d505b=0x0;_0x4d505b<_0x4a100b[_0xae50('0x100')];_0x4d505b++){var _0x56c1e0=_0x4a100b[_0x4d505b][_0xae50('0x165')][_0xae50('0x47')];if(_0x56c1e0)io['to'](util[_0xae50('0x45')](_0xae50('0x166'),_0x56c1e0))[_0xae50('0x41')](_0xae50('0x153'),{'hopper':_0x4a100b[_0x4d505b]});}})['catch'](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x5b5a10){var _0x3fa815=this;return function(){_0x3fa815['handleIvr'](_0x5b5a10);};};Dialer[_0xae50('0x1f')]['actionOriginate']=function(_0x1c16d9,_0x2a9199){var _0x5b68b4=this;var _0x183512=uuid['v4']();this[_0xae50('0x29')][_0x183512]=new Action(_0x1c16d9,_0x2a9199,_0x183512);return new Promise(function(_0xf0b328,_0x2447d1){if(_['isUndefined'](_0x1c16d9)&&typeof _0x1c16d9!==_0xae50('0x167')){return _0x2447d1(msgResponse(_0xae50('0x168'),_0xae50('0x8b'),_0xae50('0x169')));}if(_[_0xae50('0x55')](_0x2a9199[_0xae50('0x16a')])||_0x2a9199['phone']===null){return _0x2447d1(msgResponse('originate',_0xae50('0x8b'),_0xae50('0x16b')));}var _0x54e257={'XMD-CALLERID':_0x5b68b4[_0xae50('0x29')][_0x183512][_0xae50('0x16c')](),'XMD-AGI':_0x1c16d9['dialQueueProject']?util[_0xae50('0x45')](_0xae50('0x16d'),ipAgi,_0x1c16d9[_0xae50('0x13a')]):'NONE','XMD-AGIAFTER':_0x1c16d9[_0xae50('0xc6')]?util[_0xae50('0x45')](_0xae50('0x16d'),ipAgi,_0x1c16d9[_0xae50('0xc6')]):_0xae50('0x16e'),'XMD-QUEUE':utils[_0xae50('0x16f')](_0x1c16d9)?util['format'](_0xae50('0x170'),_0x1c16d9[_0xae50('0x47')],_0x1c16d9[_0xae50('0x171')]||'',_0x1c16d9[_0xae50('0xc7')]?'c':'',_0x1c16d9['dialQueueTimeout']||0x3):_0xae50('0x16e'),'XMD-CONTACTID':_0x2a9199[_0xae50('0xdc')],'XMD-CDRTYPE':_0xae50('0x9'),'CALLERID(all)':_0x5b68b4[_0xae50('0x29')][_0x183512][_0xae50('0x16c')](),'XMD-AMD':_0x1c16d9['dialAMDActive']?'ACTIVE':_0xae50('0x16e'),'XMD-DESTINATION':_0xae50('0x172')};if(_0x1c16d9[_0xae50('0x112')]){_0x54e257[_0xae50('0x173')]=_0x1c16d9['dialAMDInitialSilence']||0x9c4;_0x54e257[_0xae50('0x174')]=_0x1c16d9[_0xae50('0x175')]||0x5dc;_0x54e257[_0xae50('0x176')]=_0x1c16d9[_0xae50('0x177')]||0x320;_0x54e257[_0xae50('0x178')]=_0x1c16d9[_0xae50('0x179')]||0x1388;_0x54e257['XMD-AMDMINWORDLENGTH']=_0x1c16d9[_0xae50('0x17a')]||0x64;_0x54e257[_0xae50('0x17b')]=_0x1c16d9[_0xae50('0x17c')]||0x32;_0x54e257[_0xae50('0x17d')]=_0x1c16d9['dialAMDMaximumNumberOfWords']||0x3;_0x54e257[_0xae50('0x17e')]=_0x1c16d9['dialAMDSilenceThreshold']||0x100;_0x54e257[_0xae50('0x17f')]=_0x1c16d9[_0xae50('0x180')]||0x1388;}if(utils[_0xae50('0x16f')](_0x1c16d9)){_0x54e257[_0xae50('0x181')]=_0x2a9199[_0xae50('0xde')];}else{_0x54e257[_0xae50('0x182')]=_0x2a9199['CampaignId'];}var _0x21a5f1=utils['setXMDContactVariables'](_0x2a9199[_0xae50('0x183')]);Object[_0xae50('0x149')](_0x54e257,_0x21a5f1);var _0x11d6df=_0x5b68b4[_0xae50('0x86')](_0x1c16d9[_0xae50('0x85')])?utils[_0xae50('0x184')](_0x1c16d9['Trunk'][_0xae50('0x185')],_0x1c16d9['dialOriginateCallerIdName'],_0x1c16d9[_0xae50('0x186')]>0x0?utils['getCallerIdRandom'](_0x1c16d9[_0xae50('0x187')],_0x1c16d9[_0xae50('0x186')]):_0x1c16d9[_0xae50('0x187')]):utils[_0xae50('0x184')](_['isNil'](_0x1c16d9[_0xae50('0x87')])?_0x1c16d9[_0xae50('0x85')][_0xae50('0x185')]:_0x1c16d9[_0xae50('0x87')]['callerid'],_0x1c16d9[_0xae50('0x188')],_0x1c16d9[_0xae50('0x186')]>0x0?utils['getCallerIdRandom'](_0x1c16d9[_0xae50('0x187')],_0x1c16d9[_0xae50('0x186')]):_0x1c16d9[_0xae50('0x187')]);if(_0x11d6df){_0x54e257[_0xae50('0x189')]=_0x5b68b4['actions'][_0x183512][_0xae50('0x18a')]=utils[_0xae50('0x18b')](_0x11d6df);_0x54e257[_0xae50('0x18c')]=_0x2a9199['phone'];}_0x1c16d9['variables']=_0x54e257;return ami[_0xae50('0x95')]({'actionid':_0x183512,'action':_0xae50('0x168'),'channel':_0x5b68b4[_0xae50('0x86')](_0x1c16d9[_0xae50('0x85')])?util['format'](_0xae50('0x18d'),_0x1c16d9[_0xae50('0x85')][_0xae50('0x47')],isNotNull(_0x1c16d9[_0xae50('0x18e')])?_0x1c16d9[_0xae50('0x18e')]['trim']()||'':'',_0x1c16d9[_0xae50('0x18f')]>0x0?_0x2a9199['phone'][_0xae50('0x190')](_0x1c16d9[_0xae50('0x18f')]):_0x2a9199[_0xae50('0x16a')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x1c16d9[_0xae50('0x87')])?_0x1c16d9['Trunk']['name']:_0x1c16d9[_0xae50('0x87')]['name'],isNotNull(_0x1c16d9[_0xae50('0x18e')])?_0x1c16d9[_0xae50('0x18e')][_0xae50('0x191')]()||'':'',_0x1c16d9['dialCutDigit']>0x0?_0x2a9199[_0xae50('0x16a')][_0xae50('0x190')](_0x1c16d9[_0xae50('0x18f')]):_0x2a9199['phone']),'callerid':_0x11d6df,'Exten':_0xae50('0x172'),'Context':_0xae50('0x192'),'Priority':'1','variable':_0x54e257,'timeout':(_0x1c16d9[_0xae50('0x193')]||0x1e)*0x3e8,'async':!![],'channelid':_0x183512})[_0xae50('0x3f')](function(_0x306cbe){return _0xf0b328(_0x306cbe);})[_0xae50('0x98')](function(_0xf2125b){_0x1c16d9[_0xae50('0x194')]+=0x1;var _0x23111b=new History(_0x5b68b4[_0xae50('0x29')][_0x183512]);logger[_0xae50('0x66')](util[_0xae50('0x45')]('[originateError]:\x20%s',JSON['stringify'](_0xf2125b)));_0x23111b[_0xae50('0xcf')]=0xe;_0x23111b['statedesc']='OriginateError';_0x23111b[_0xae50('0xe2')]=moment()[_0xae50('0x45')](_0xae50('0xc1'));_0x23111b[_0xae50('0x6e')]=_0x23111b[_0xae50('0xe2')];hopperUtils['createHistory'](_0x23111b)[_0xae50('0x98')](loggerCatch(_0xae50('0x195')));_0x5b68b4[_0xae50('0x136')](_0x23111b)['catch'](loggerCatch('[originate][error]'))[_0xae50('0x21')](function(){delete _0x5b68b4['actions'][_0x183512];return _0x2447d1(msgResponse('originate',_0xae50('0x80'),_0xae50('0x196')));});});});};Dialer[_0xae50('0x1f')][_0xae50('0x197')]=function(_0x582ac5,_0x331934,_0x3cceb5){var _0xbe3020=new History(_0x331934);if(_0xbe3020[_0xae50('0x123')]+_0xbe3020[_0xae50('0x12e')]+_0xbe3020[_0xae50('0x198')]+_0xbe3020['countnosuchnumberretry']+_0xbe3020['countdropretry']+_0xbe3020[_0xae50('0xe9')]+_0xbe3020[_0xae50('0x120')]+_0xbe3020['countagentrejectretry']>=_0x3cceb5[_0xae50('0x125')]-0x1){return!![];}switch(_0x582ac5){case 0x3:if(_0xbe3020['countnoanswerretry']>=_0x3cceb5[_0xae50('0x199')]-0x1){return!![];}hopperUtils[_0xae50('0xed')]({'active':![],'countnoanswerretry':_0xbe3020[_0xae50('0x198')]+=0x1,'scheduledat':moment()['add'](_0x3cceb5[_0xae50('0x19a')],_0xae50('0xdb'))['format'](_0xae50('0xc1')),'ContactId':_0xbe3020[_0xae50('0xdc')],'ListId':_0xbe3020[_0xae50('0xdd')],'VoiceQueueId':_0xbe3020['VoiceQueueId']||undefined,'CampaignId':_0xbe3020[_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch(_0xae50('0x19b')));break;case 0x5:if(_0xbe3020[_0xae50('0x123')]>=_0x3cceb5['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xae50('0xed')]({'active':![],'countbusyretry':_0xbe3020['countbusyretry']+=0x1,'scheduledat':moment()[_0xae50('0xee')](_0x3cceb5[_0xae50('0x19c')],_0xae50('0xdb'))[_0xae50('0x45')](_0xae50('0xc1')),'ContactId':_0xbe3020[_0xae50('0xdc')],'ListId':_0xbe3020['ListId'],'VoiceQueueId':_0xbe3020[_0xae50('0xde')]||undefined,'CampaignId':_0xbe3020[_0xae50('0xdf')]||undefined})['catch'](loggerCatch(_0xae50('0x19d')));break;case 0x8:if(_0xbe3020[_0xae50('0x12e')]>=_0x3cceb5['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0xbe3020[_0xae50('0x12e')]+=0x1,'scheduledat':moment()['add'](_0x3cceb5['dialCongestionRetryFrequency'],_0xae50('0xdb'))[_0xae50('0x45')](_0xae50('0xc1')),'ContactId':_0xbe3020[_0xae50('0xdc')],'ListId':_0xbe3020[_0xae50('0xdd')],'VoiceQueueId':_0xbe3020['VoiceQueueId']||undefined,'CampaignId':_0xbe3020[_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0xbe3020['countnosuchnumberretry']>=_0x3cceb5[_0xae50('0x19e')]-0x1){return!![];}else{hopperUtils[_0xae50('0xed')]({'active':![],'countnosuchnumberretry':_0xbe3020['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xae50('0xee')](_0x3cceb5[_0xae50('0x19f')],_0xae50('0xdb'))['format'](_0xae50('0xc1')),'ContactId':_0xbe3020[_0xae50('0xdc')],'ListId':_0xbe3020[_0xae50('0xdd')],'VoiceQueueId':_0xbe3020['VoiceQueueId']||undefined,'CampaignId':_0xbe3020['CampaignId']||undefined})[_0xae50('0x98')](loggerCatch(_0xae50('0x1a0')));}break;case 0xa:if(_0xbe3020[_0xae50('0xd8')]>=_0x3cceb5[_0xae50('0x1a1')]-0x1){return!![];}hopperUtils[_0xae50('0xed')]({'active':![],'countdropretry':_0xbe3020[_0xae50('0xd8')]+=0x1,'scheduledat':moment()[_0xae50('0xee')](_0x3cceb5['dialDropRetryFrequency'],'minutes')[_0xae50('0x45')](_0xae50('0xc1')),'ContactId':_0xbe3020['ContactId'],'ListId':_0xbe3020[_0xae50('0xdd')],'VoiceQueueId':_0xbe3020[_0xae50('0xde')]||undefined,'CampaignId':_0xbe3020[_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch(_0xae50('0xe0')));break;case 0xb:if(_0xbe3020[_0xae50('0xe9')]>=_0x3cceb5[_0xae50('0xec')]-0x1){return!![];}hopperUtils[_0xae50('0xed')]({'active':![],'countabandonedretry':_0xbe3020[_0xae50('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x3cceb5['dialAbandonedRetryFrequency'],_0xae50('0xdb'))[_0xae50('0x45')](_0xae50('0xc1')),'ContactId':_0xbe3020[_0xae50('0xdc')],'ListId':_0xbe3020[_0xae50('0xdd')],'VoiceQueueId':_0xbe3020[_0xae50('0xde')]||undefined,'CampaignId':_0xbe3020[_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch(_0xae50('0x1a2')));break;case 0x13:if(_0xbe3020['countmachineretry']>=_0x3cceb5[_0xae50('0x127')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0xbe3020[_0xae50('0x120')]+=0x1,'scheduledat':moment()[_0xae50('0xee')](_0x3cceb5[_0xae50('0x129')],_0xae50('0xdb'))['format'](_0xae50('0xc1')),'ContactId':_0xbe3020[_0xae50('0xdc')],'ListId':_0xbe3020[_0xae50('0xdd')],'VoiceQueueId':_0xbe3020[_0xae50('0xde')]||undefined,'CampaignId':_0xbe3020[_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xbe3020[_0xae50('0x124')]>=_0x3cceb5[_0xae50('0x1a3')]-0x1){return!![];}hopperUtils[_0xae50('0xed')]({'active':![],'countagentrejectretry':_0xbe3020['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xae50('0xee')](_0x3cceb5['dialAgentRejectRetryFrequency'],_0xae50('0xdb'))['format'](_0xae50('0xc1')),'ContactId':_0xbe3020['ContactId'],'ListId':_0xbe3020[_0xae50('0xdd')],'VoiceQueueId':_0xbe3020[_0xae50('0xde')]||undefined,'CampaignId':_0xbe3020[_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch(_0xae50('0x1a4')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x3d52a0,_0x46ae27,_0xbedc7c){var _0x22ed8b=this;var _0x155af2=new History(_0x3d52a0);var _0x4bc5a4=![];var _0x14041d;var _0x2085af;return new Promise(function(_0x478daf,_0x24237d){if(_[_0xae50('0x55')](_0x46ae27)&&typeof _0x46ae27!=='object'){return _0x24237d(msgResponse(_0xae50('0x1a5'),'Failure',_0xae50('0x1a6')));}if(_[_0xae50('0x55')](_0xbedc7c)&&typeof _0xbedc7c!==_0xae50('0x167')){return _0x24237d(msgResponse(_0xae50('0x1a5'),_0xae50('0x8b'),_0xae50('0x1a7')));}hopperUtils[_0xae50('0xd6')](_0x155af2,_0xbedc7c[_0xae50('0xc4')],_0x46ae27)[_0xae50('0x3f')](function(_0x5b99b4){if(_0x5b99b4[_0xae50('0xd7')]==0x1)_0x4bc5a4=!![];switch(_0xbedc7c[_0xae50('0xc4')]){case'0':_0x46ae27['outboundNoSuchCallsDay']+=0x1;_0x155af2[_0xae50('0xcf')]=0x0;_0x155af2[_0xae50('0xe1')]=_0xae50('0x1a8');_0x155af2[_0xae50('0x12f')]+=0x1;_0x155af2[_0xae50('0xd4')]+=0x1;ami[_0xae50('0x41')](_0xae50('0x1a9'),ut[_0xae50('0x121')](_0x3d52a0,_0xae50('0x1aa')));_0x14041d=_0x46ae27['dialNoSuchNumberRetryFrequency'];_0x2085af=_0x46ae27['callAdditionalPhoneAfterMin'];hopperUtils[_0xae50('0xc8')](_0x155af2)[_0xae50('0x98')](loggerCatch(_0xae50('0x122')));if(_0x22ed8b[_0xae50('0x197')](0x0,_0x3d52a0,_0x46ae27)&&!_0x4bc5a4){if(_0x155af2[_0xae50('0x12f')]>=_0x46ae27['dialNoSuchNumberMaxRetry']){_0x22ed8b[_0xae50('0x131')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1ab'));}else{_0x22ed8b[_0xae50('0x126')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1ab'));}}break;case'3':_0x46ae27['outboundNoAnswerCallsDay']+=0x1;_0x155af2[_0xae50('0xcf')]=0x3;_0x155af2[_0xae50('0xe1')]=_0xae50('0x1ac');_0x155af2[_0xae50('0x198')]+=0x1;_0x155af2[_0xae50('0xd4')]+=0x1;var _0x41d48a=ut[_0xae50('0x1ad')](_0x3d52a0,_0x46ae27);ami['emit'](_0xae50('0x1ae'),_0x41d48a);_0x14041d=_0x46ae27[_0xae50('0x19a')];_0x2085af=_0x46ae27[_0xae50('0xd5')];hopperUtils[_0xae50('0xc8')](_0x155af2)[_0xae50('0x98')](loggerCatch(_0xae50('0x1af')));if(_0x22ed8b[_0xae50('0x197')](0x3,_0x3d52a0,_0x46ae27)&&!_0x4bc5a4){if(_0x155af2[_0xae50('0x198')]>=_0x46ae27[_0xae50('0x199')]){_0x22ed8b[_0xae50('0x131')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1b0'));}else{_0x22ed8b[_0xae50('0x126')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1b0'));}}break;case'5':_0x46ae27[_0xae50('0x1b1')]+=0x1;_0x155af2['state']=0x5;_0x155af2[_0xae50('0xe1')]=_0xae50('0x1b2');_0x155af2[_0xae50('0x123')]+=0x1;_0x155af2[_0xae50('0xd4')]+=0x1;ami['emit']('custom:agentbusy',ut['buildObj'](_0x3d52a0,_0xae50('0x1b3')));_0x14041d=_0x46ae27[_0xae50('0x19c')];_0x2085af=_0x46ae27['callAdditionalPhoneAfterMin'];hopperUtils[_0xae50('0xc8')](_0x155af2)[_0xae50('0x98')](loggerCatch(_0xae50('0x1b4')));if(_0x22ed8b[_0xae50('0x197')](0x5,_0x3d52a0,_0x46ae27)&&!_0x4bc5a4){if(_0x155af2[_0xae50('0x123')]>=_0x46ae27[_0xae50('0x1b5')]){_0x22ed8b[_0xae50('0x131')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1b6'));}else{_0x22ed8b[_0xae50('0x126')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1b6'));}}break;case'8':_0x46ae27[_0xae50('0x1b7')]+=0x1;_0x155af2[_0xae50('0xcf')]=0x8;_0x155af2[_0xae50('0xe1')]=_0xae50('0x1b8');_0x155af2[_0xae50('0x12e')]+=0x1;_0x155af2[_0xae50('0xd4')]+=0x1;_0x14041d=_0x46ae27[_0xae50('0x1b9')];_0x2085af=_0x46ae27[_0xae50('0xd5')];ami[_0xae50('0x41')](_0xae50('0x1ba'),ut[_0xae50('0x121')](_0x3d52a0,_0xae50('0x1bb')));hopperUtils[_0xae50('0xc8')](_0x155af2)[_0xae50('0x98')](loggerCatch(_0xae50('0x1bc')));if(_0x22ed8b[_0xae50('0x197')](0x8,_0x3d52a0,_0x46ae27)&&!_0x4bc5a4){if(_0x155af2['countcongestionretry']>=_0x46ae27[_0xae50('0x1bd')]){_0x22ed8b[_0xae50('0x131')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1be'));}else{_0x22ed8b[_0xae50('0x126')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1be'));}}break;case'11':_0x46ae27[_0xae50('0x1bf')]+=0x1;_0x155af2[_0xae50('0xcf')]=0xb;_0x155af2[_0xae50('0xe1')]=_0xae50('0x1c0');_0x155af2[_0xae50('0xe9')]+=0x1;_0x155af2[_0xae50('0xd4')]+=0x1;_0x14041d=_0x46ae27[_0xae50('0xea')];_0x2085af=_0x46ae27[_0xae50('0xd5')];hopperUtils[_0xae50('0xc8')](_0x155af2)['catch'](loggerCatch(_0xae50('0xef')));if(_0x22ed8b['checkRetriveMax'](0xb,_0x3d52a0,_0x46ae27)&&!_0x4bc5a4){if(_0x155af2[_0xae50('0xe9')]>=_0x46ae27[_0xae50('0xec')]){_0x22ed8b[_0xae50('0x131')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1c1'));}else{_0x22ed8b[_0xae50('0x126')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1c1'));}}break;case'20':_0x46ae27['outboundRejectCallsDay']+=0x1;_0x155af2[_0xae50('0xcf')]=0x14;_0x155af2[_0xae50('0xe1')]=_0xae50('0x1c2');_0x155af2['countagentrejectretry']+=0x1;_0x155af2['countglobal']+=0x1;_0x14041d=_0x46ae27[_0xae50('0x1c3')];_0x2085af=_0x46ae27[_0xae50('0xd5')];ami[_0xae50('0x41')](_0xae50('0x1c4'),ut[_0xae50('0x121')](_0x3d52a0,'agentreject'));hopperUtils['createHistory'](_0x155af2)[_0xae50('0x98')](loggerCatch(_0xae50('0x1c5')));if(_0x22ed8b[_0xae50('0x197')](0x14,_0x3d52a0,_0x46ae27)&&!_0x4bc5a4){if(_0x155af2['countagentrejectretry']>=_0x46ae27[_0xae50('0x1a3')]){_0x22ed8b[_0xae50('0x131')](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1c6'));}else{_0x22ed8b['stateGlobal'](_0x155af2,_0x478daf,_0x24237d,_0xae50('0x1c6'));}}break;default:_0x46ae27['outboundUnknownCallsDay']+=0x1;_0x155af2[_0xae50('0xcf')]=0xc;_0x155af2['statedesc']=_0xbedc7c['reason'];_0x14041d=_0x46ae27[_0xae50('0x1c3')];_0x2085af=_0x46ae27[_0xae50('0xd5')];hopperUtils[_0xae50('0xc8')](_0x155af2)[_0xae50('0x98')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x22ed8b[_0xae50('0x197')](_0xbedc7c[_0xae50('0xc4')],_0x3d52a0,_0x46ae27)&&!_0x4bc5a4){if(_0x155af2[_0xae50('0x123')]+_0x155af2[_0xae50('0x12e')]+_0x155af2[_0xae50('0x198')]+_0x155af2[_0xae50('0x12f')]+_0x155af2[_0xae50('0xd8')]+_0x155af2[_0xae50('0xe9')]+_0x155af2[_0xae50('0x120')]+_0x155af2[_0xae50('0x124')]>=_0x46ae27['dialGlobalMaxRetry']){_0x22ed8b['stateGlobal'](_0x155af2,_0x478daf,_0x24237d,_0xbedc7c[_0xae50('0xc4')]);}else{_0x22ed8b[_0xae50('0x131')](_0x155af2,_0x478daf,_0x24237d,_0xbedc7c['reason']);}}}})[_0xae50('0x3f')](function(){if(_0x4bc5a4){hopperUtils['swapAdditionalPhones'](_0x155af2,_0x14041d,_0x2085af)['then'](function(){return _0x478daf(0x1);});}});});};Dialer[_0xae50('0x1f')]['stateGlobal']=function(_0x41962d,_0x552b73,_0x1640d1,_0x244447){var _0x2d9944=new Final(_0x41962d);_0x2d9944[_0xae50('0xcf')]=0xf;_0x2d9944[_0xae50('0xe1')]=_0xae50('0x1c7');this[_0xae50('0x131')](_0x2d9944,_0x552b73,_0x1640d1,_0x244447);};Dialer[_0xae50('0x1f')]['createStateFinal']=function(_0x23ec15,_0x118ebc,_0x4f1c2a,_0x52dc83){hopperUtils[_0xae50('0x136')](_0x23ec15)['then'](function(){return _0x118ebc(msgResponse(_0xae50('0x1a5'),_0xae50('0x1c8'),_0x52dc83));})[_0xae50('0x98')](function(){return _0x4f1c2a(msgResponse(_0xae50('0x1c9'),_0xae50('0x8b'),_0xae50('0x1ca')));});};Dialer[_0xae50('0x1f')][_0xae50('0xa')]=function(_0x46f56f){var _0x263415=_0x46f56f[_0xae50('0x1cb')]/0x64;var _0x598913=_0x46f56f[_0xae50('0x1cc')]/(_0x46f56f[_0xae50('0x1cc')]+_0x46f56f[_0xae50('0xc3')]);var _0x262052=Math['round'](_0x46f56f[_0xae50('0x1cd')]*(_0x46f56f['predictiveIntervalMaxThreshold']/0x64));var _0x5ec760=Math['round'](_0x46f56f[_0xae50('0x1cd')]*(_0x46f56f[_0xae50('0x1ce')]/0x64));var _0x24291d=_0x46f56f[_0xae50('0x1cf')]+_0x46f56f['talking'];var _0x1ce082=Math[_0xae50('0x1d0')](_0x46f56f[_0xae50('0x5b')]*_0x46f56f[_0xae50('0x5e')]*_0x46f56f[_0xae50('0x1d1')]*_0x46f56f[_0xae50('0x1d2')]);if(_[_0xae50('0x55')](_0x46f56f['startProgressive'])){if(!_[_0xae50('0x55')](_0x46f56f[_0xae50('0x2b')])){_0x46f56f['startPredictive']=undefined;loggerPredictive[_0xae50('0x66')](_0xae50('0x1d3'),_0xae50('0x1d4'));}if(!_[_0xae50('0x55')](_0x46f56f['handlePredictive'])){loggerPredictive[_0xae50('0x66')](_0xae50('0x1d3'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x46f56f[_0xae50('0x65')]);_0x46f56f[_0xae50('0x65')]=undefined;}_0x46f56f[_0xae50('0x2c')]=moment()[_0xae50('0x45')](_0xae50('0xc1'));loggerPredictive[_0xae50('0x49')](_0x46f56f['name'],_0xae50('0x1d5'),_0x46f56f[_0xae50('0x2c')]);this[_0xae50('0xb0')](_0x46f56f,0x1);}else if(ifInterval(_0x46f56f[_0xae50('0x1d6')],_0x46f56f[_0xae50('0x2c')])){this[_0xae50('0xb0')](_0x46f56f,0x1);loggerPredictiveCalls[_0xae50('0x49')]('[startMethodPredictive][StartProgressive][Loop]',_0x46f56f[_0xae50('0x2c')],_0x46f56f[_0xae50('0x47')]);_0x46f56f[_0xae50('0x5b')]=0x0;_0x46f56f[_0xae50('0x1d7')]=0x0;}else if(_0x263415<_0x598913&&_0x46f56f[_0xae50('0x1d8')]==='dropRate'){clearPredictiveAttributes(_0x46f56f);loggerPredictive['info'](_0xae50('0x1d9'),'Dropped\x20calls\x20day',_0x598913,_0xae50('0x2c'),_0x46f56f['name']);}else if(_0x1ce082<_0x46f56f[_0xae50('0x1d7')]&&_0x46f56f[_0xae50('0x1d8')]===_0xae50('0x1da')){clearPredictiveAttributes(_0x46f56f);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x1ce082,_0xae50('0x1db'),_0x46f56f[_0xae50('0x1d7')],'startProgressive',_0x46f56f[_0xae50('0x47')]);}else if(!ifInterval(_0x46f56f[_0xae50('0x1d6')],_0x46f56f[_0xae50('0x2c')])&&_[_0xae50('0x55')](_0x46f56f[_0xae50('0x2b')])&&!_[_0xae50('0x55')](_0x46f56f[_0xae50('0x2c')])){_0x46f56f[_0xae50('0x2b')]=moment()[_0xae50('0x45')](_0xae50('0xc1'));loggerPredictive['info'](_0x46f56f['name'],_0xae50('0x1dc'),_0x46f56f[_0xae50('0x2b')]);hopperUtils['avgHandleTime'](_0x46f56f[_0xae50('0x1d6')])['then'](this[_0xae50('0x1dd')](_0x46f56f))[_0xae50('0x3f')](mergeDataErlangB(_0x46f56f))[_0xae50('0x3f')](this[_0xae50('0x1de')](_0x46f56f))['catch'](loggerCatchPredictive(_0xae50('0x1df'),_0x46f56f));}else if(!ifInterval(_0x46f56f[_0xae50('0x1d6')],_0x46f56f['startPredictive'])){_0x46f56f[_0xae50('0x1d7')]=0x0;_0x46f56f[_0xae50('0x2b')]=moment()['format'](_0xae50('0xc1'));loggerPredictive[_0xae50('0x49')](_0x46f56f[_0xae50('0x47')],_0xae50('0x1e0'),_0x46f56f['startPredictive']);clearInterval(_0x46f56f[_0xae50('0x65')]);_0x46f56f['handlePredictive']=undefined;hopperUtils[_0xae50('0x1e1')](_0x46f56f['dialPredictiveInterval'])[_0xae50('0x3f')](this[_0xae50('0x1dd')](_0x46f56f))['then'](mergeDataErlangB(_0x46f56f))[_0xae50('0x3f')](this['startMethodPredictive'](_0x46f56f))[_0xae50('0x98')](loggerCatchPredictive(_0xae50('0x1e2'),_0x46f56f));}else if(_0x46f56f[_0xae50('0x1cd')]&&_0x24291d<_0x46f56f[_0xae50('0x1cd')]-_0x5ec760){clearPredictiveAttributes(_0x46f56f);loggerPredictive[_0xae50('0x49')](_0x46f56f[_0xae50('0x47')],_0xae50('0x1e3'),_0x24291d,_0xae50('0x1e4'),_0x46f56f[_0xae50('0x1cd')],'-',_0x5ec760,'=',_0x46f56f['predictiveIntervalAvailable']-_0x5ec760,')');}else if(_0x46f56f[_0xae50('0x1cd')]&&_0x24291d>_0x46f56f[_0xae50('0x1cd')]+_0x262052){clearPredictiveAttributes(_0x46f56f);loggerPredictive[_0xae50('0x49')](_0x46f56f[_0xae50('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x24291d,_0xae50('0x1e5'),_0x46f56f[_0xae50('0x1cd')],'+',_0x262052,'=',_0x46f56f['predictiveIntervalAvailable']+_0x262052,')');}};Dialer['prototype'][_0xae50('0x1dd')]=function(_0x2791d4){var _0x2321da=this;return function(_0x4ea038){return new Promise(function(_0x389a8e,_0x49fa4c){_['merge'](_0x2791d4,_0x4ea038[0x0]);if(checkGetDataPredictive(_0x4ea038[0x0])){var _0x5e0b76=_0x2791d4[_0xae50('0x1cd')]=_0x2791d4[_0xae50('0x143')]+_0x2791d4[_0xae50('0x1cf')];var _0x3d4075=_0x2791d4[_0xae50('0x1d6')]*0x3c;var _0x27747a=_0x4ea038[0x0][_0xae50('0x56')]+_0x4ea038[0x0][_0xae50('0x58')];var _0x489740=(_0x4ea038[0x0]['predictiveIntervalAnsweredCalls']+_0x4ea038[0x0][_0xae50('0x4f')]+_0x4ea038[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4ea038[0x0]['predictiveIntervalTotalCalls'];_0x2791d4[_0xae50('0x1d1')]=_0x489740>0x0?_0x489740:0x1;switch(_0x2791d4[_0xae50('0x1d8')]){case _0xae50('0x1da'):var _0x432230=_0x2791d4[_0xae50('0x1cb')]/0x64;return _0x2321da[_0xae50('0x1e6')](_0x5e0b76,_0x3d4075,_0x27747a,_0x489740,_0x432230)[_0xae50('0x3f')](function(_0x499f79){return _0x389a8e(_0x499f79);});case _0xae50('0x1e7'):var _0x3e1a6a=_0x2791d4[_0xae50('0x1cb')]/0x64;return _0x2321da[_0xae50('0x1e8')](_0x5e0b76,_0x3d4075,_0x27747a,_0x489740,_0x3e1a6a)[_0xae50('0x3f')](function(_0xbd08d7){return _0x389a8e(_0xbd08d7);});default:return _0x49fa4c(msgResponse(_0xae50('0x1e9'),_0xae50('0x8b'),_0xae50('0x1ea')));}}else{return _0x49fa4c(msgResponse(_0xae50('0x1e9'),'Failure',_0xae50('0x1eb')));}});};};Dialer[_0xae50('0x1f')][_0xae50('0x1ec')]=function(_0x1b0c69){var _0xa88e6=this;return function(_0x57ad93){return new Promise(function(_0x3d0ff5,_0x211339){_[_0xae50('0x61')](_0x1b0c69,_0x57ad93[0x0]);if(checkGetDataPredictive(_0x57ad93[0x0])){loggerPredictive[_0xae50('0x49')](JSON['stringify'](_0x57ad93[0x0]));if(_0x1b0c69[_0xae50('0x1d8')]===_0xae50('0x1da')){return _0xa88e6[_0xae50('0x15c')](_0x1b0c69['id'])[_0xae50('0x3f')](function(_0x28969a){var _0x42c8d8=_0x1b0c69[_0xae50('0x1ed')]-_0x28969a[0x0]['outboundQueuePauses'];var _0x48fdd8=_0x1b0c69[_0xae50('0x1d6')]*0x3c;var _0x19ed0d=_0x57ad93[0x0]['predictiveIntervalAvgTalktime']+_0x57ad93[0x0][_0xae50('0x58')];var _0x32748f=(_0x57ad93[0x0]['predictiveIntervalAnsweredCalls']+_0x57ad93[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x57ad93[0x0][_0xae50('0x51')])/_0x57ad93[0x0][_0xae50('0x4c')];var _0x479d3c=_0x1b0c69['dialPredictiveOptimizationPercentage']/0x64;_0x1b0c69['predictiveIntervalPauses']=_0x28969a[0x0][_0xae50('0x1ee')]||0x0;_0x1b0c69[_0xae50('0x1d1')]=_0x32748f>0x0?_0x32748f:0x1;return _0xa88e6['abandonmentRate'](_0x42c8d8,_0x48fdd8,_0x19ed0d,_0x32748f,_0x479d3c);})[_0xae50('0x3f')](function(_0x331506){return _0x3d0ff5(_0x331506);})[_0xae50('0x98')](function(_0x41dad4){return _0x211339(msgResponse(_0xae50('0x1ef'),'Failure',JSON[_0xae50('0x72')](_0x41dad4)));});}if(_0x1b0c69[_0xae50('0x1d8')]===_0xae50('0x1e7')){return _0xa88e6[_0xae50('0x15c')](_0x1b0c69['id'])[_0xae50('0x3f')](function(_0x50a8c3){var _0x226a19=_0x1b0c69[_0xae50('0x1ed')]-_0x50a8c3[0x0][_0xae50('0x1ee')];var _0x2e22a2=_0x1b0c69['dialPredictiveInterval']*0x3c;var _0x107faf=_0x57ad93[0x0][_0xae50('0x56')]+_0x57ad93[0x0][_0xae50('0x58')];var _0x4a9733=(_0x57ad93[0x0][_0xae50('0x4d')]+_0x57ad93[0x0][_0xae50('0x4f')]+_0x57ad93[0x0][_0xae50('0x51')])/_0x57ad93[0x0][_0xae50('0x4c')];var _0x2cb68e=_0x1b0c69['dialPredictiveOptimizationPercentage']/0x64;_0x1b0c69[_0xae50('0x1f0')]=_0x50a8c3[0x0][_0xae50('0x1ee')]||0x0;_0x1b0c69[_0xae50('0x1d1')]=_0x4a9733>0x0?_0x4a9733:0x1;return _0xa88e6[_0xae50('0x1e8')](_0x226a19,_0x2e22a2,_0x107faf,_0x4a9733,_0x2cb68e);})[_0xae50('0x3f')](function(_0xe55683){return _0x3d0ff5(_0xe55683);})[_0xae50('0x98')](function(_0xe8c133){return _0x211339(msgResponse(_0xae50('0x1ef'),_0xae50('0x8b'),JSON['stringify'](_0xe8c133)));});}}else{return _0x211339(msgResponse(_0xae50('0x1e9'),_0xae50('0x8b'),_0xae50('0x1eb')));}});};};Dialer[_0xae50('0x1f')]['startMethodPredictive']=function(_0x6baae4){var _0x307156=this;return function(){var _0x7d701b=0x0;var _0x3e5ed1=Math[_0xae50('0x1d0')](_0x6baae4[_0xae50('0x5c')]*0x3e8);if(_0x3e5ed1>0x0){_0x3e5ed1=_0x3e5ed1<0x64?0x64:_0x3e5ed1;loggerPredictive['info'](_0x6baae4['name'],_0xae50('0x1f1'),_0x3e5ed1,_0xae50('0x1f2'));_0x6baae4[_0xae50('0x65')]=setInterval(function(){_0x307156['handlePredictive'](_0x6baae4);loggerPredictiveCalls[_0xae50('0x49')](_0xae50('0x1f3'),_0x7d701b+=0x1);},_0x3e5ed1);}else{loggerPredictive[_0xae50('0x49')](_0x6baae4['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0xae50('0x1f4')]=function(_0x11d06a,_0x6edee3){var _0x466f6f=this;return function(_0x195be3){if(_['isEmpty'](_0x195be3)){if(_['isNil'](_0x6edee3['UserId'])||!_0x6edee3[_0xae50('0x1f5')]){if(_0x11d06a[_0xae50('0xae')]==='booked'){_0x11d06a[_0xae50('0x70')]=_[_0xae50('0x55')](_0x11d06a[_0xae50('0x70')])?!![]:_0x11d06a[_0xae50('0x70')];var _0x3cadbb=uuid['v4']();_0x466f6f[_0xae50('0x29')][_0x3cadbb]=new Action(_0x11d06a,_0x6edee3,_0x3cadbb);loggerBooked[_0xae50('0x49')](_0xae50('0x1f6'),_0x3cadbb,_0xae50('0x1f7'),JSON['stringify'](_0x11d06a[_0xae50('0x70')]),_0xae50('0x1f8'),_0x11d06a[_0xae50('0x47')]);if(_0x11d06a['queueStatusComplete']){_0x11d06a[_0xae50('0x70')]=![];_0x466f6f[_0xae50('0xf9')][_0x466f6f[_0xae50('0x29')][_0x3cadbb][_0xae50('0xba')]]=[];ami['Action']({'actionid':_0x3cadbb,'action':_0xae50('0x1f9'),'queue':_0x11d06a[_0xae50('0x47')]})['catch'](function(){utils['decrementOriginate'](_0x11d06a,_0xae50('0x1fa'));hopperUtils[_0xae50('0xed')]({'active':![],'ContactId':_0x466f6f[_0xae50('0x29')][_0x3cadbb][_0xae50('0xdc')],'ListId':_0x466f6f['actions'][_0x3cadbb]['ListId'],'VoiceQueueId':_0x466f6f[_0xae50('0x29')][_0x3cadbb][_0xae50('0xde')]||undefined,'CampaignId':_0x466f6f[_0xae50('0x29')][_0x3cadbb][_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch(_0xae50('0x1fb')));delete _0x466f6f[_0xae50('0x29')][_0x3cadbb];});}else{loggerBooked[_0xae50('0x49')](_0xae50('0x1fc'),JSON['stringify'](_0x11d06a[_0xae50('0x70')]),_0xae50('0x1f8'),_0x11d06a[_0xae50('0x47')]);utils[_0xae50('0xbe')](_0x11d06a,_0xae50('0x1fa'));hopperUtils[_0xae50('0xed')]({'active':![],'ContactId':_0x466f6f[_0xae50('0x29')][_0x3cadbb][_0xae50('0xdc')],'ListId':_0x466f6f['actions'][_0x3cadbb]['ListId'],'VoiceQueueId':_0x466f6f[_0xae50('0x29')][_0x3cadbb][_0xae50('0xde')]||undefined,'CampaignId':_0x466f6f[_0xae50('0x29')][_0x3cadbb][_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch(_0xae50('0x1fb')));delete _0x466f6f['actions'][_0x3cadbb];}}else{return _0x466f6f['actionOriginate'](_0x11d06a,_0x6edee3);}}else{if(utils[_0xae50('0x62')](undefined,_0x6edee3[_0xae50('0x1fd')])<_0x11d06a[_0xae50('0x1fe')]*0x3c){if(_0x6edee3[_0xae50('0x165')]&&!_0x6edee3['Agent']['voicePause']){_0x466f6f[_0xae50('0x104')]['run'](_0x6edee3['id'])[_0xae50('0x21')](function(){utils[_0xae50('0xbe')](_0x11d06a,_0xae50('0x1fa'));});}else{hopperUtils[_0xae50('0x1ff')]({'active':![]},_0x6edee3['id'],0x1)[_0xae50('0x21')](function(){utils[_0xae50('0xbe')](_0x11d06a,_0xae50('0x1fa'));});}}else{_0x11d06a['outboundReCallsDay']+=0x1;utils[_0xae50('0xbe')](_0x11d06a,_0xae50('0x1fa'));if(_0x11d06a['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x6edee3[_0xae50('0xdc')],'ListId':_0x6edee3[_0xae50('0xdd')],'VoiceQueueId':_0x6edee3[_0xae50('0xde')]||undefined,'CampaignId':_0x6edee3[_0xae50('0xdf')]||undefined})[_0xae50('0x98')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xae50('0xc8')](createObjHistory(_0x11d06a,_0x6edee3,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,_0xae50('0x200')))[_0xae50('0x98')](loggerCatch(_0xae50('0x201')));}else{_0x466f6f[_0xae50('0x11b')](createObjHistory(_0x11d06a,_0x6edee3,utils[_0xae50('0x69')]['RECALL_TIMEOUT'],0x16,_0xae50('0x202')),_0xae50('0x203'),_0xae50('0x204'));}}}}else{_0x11d06a['outboundBlacklistCallsDay']+=0x1;_0x466f6f['saveInDb'](createObjHistory(_0x11d06a,_0x6edee3,utils[_0xae50('0x69')][_0xae50('0x205')],0xd,_0xae50('0x206')),_0xae50('0x207'),_0xae50('0x208'));throw _0xae50('0x209');}};};Dialer['prototype'][_0xae50('0x20a')]=function(_0x1eef8c){var _0x353dc7=this;var _0x4f0142=_0x1eef8c[_0xae50('0x20b')]-_0x1eef8c[_0xae50('0x7a')];emitCampaignSummary(_0x1eef8c);if(_0x4f0142>0x0&&_0x1eef8c[_0xae50('0x20c')]==0x0){if(_0x4f0142>this[_0xae50('0x27')]){_0x4f0142=this[_0xae50('0x27')];}_0x1eef8c['temp']=0x1;hopperUtils[_0xae50('0x20d')](_0x1eef8c,_0x4f0142)['then'](function(_0x5a6f3d){_0x1eef8c[_0xae50('0x20c')]=0x0;if(_0x5a6f3d){if(!utils['checkContactEmpty'](_0x5a6f3d)){_0x1eef8c[_0xae50('0x68')]=utils[_0xae50('0x69')]['NO_AVAILABLE_CONTACTS'];logger[_0xae50('0x49')](_0xae50('0x20e')+_0x1eef8c[_0xae50('0x47')]);}else{_0x1eef8c['originated']+=_0x5a6f3d['length'];_0x1eef8c[_0xae50('0x68')]=utils[_0xae50('0x69')]['RUNNING'];for(var _0x347153=0x0;_0x347153<_0x5a6f3d[_0xae50('0x100')];_0x347153+=0x1){_0x1eef8c['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x5a6f3d[_0x347153])||_[_0xae50('0xf5')](_0x5a6f3d[_0x347153][_0xae50('0x183')])||_[_0xae50('0xf5')](_0x5a6f3d[_0x347153]['phone'])){_0x353dc7[_0xae50('0x15e')](_0xae50('0x20f'),_0x1eef8c,_0x5a6f3d[_0x347153]);}else{hopperUtils[_0xae50('0x210')](_[_0xae50('0xfa')](_0x5a6f3d[_0x347153],[_0xae50('0xdf'),_0xae50('0x16a')]))[_0xae50('0x3f')](_0x353dc7[_0xae50('0x1f4')](_0x1eef8c,_0x5a6f3d[_0x347153]))['catch'](function(_0x10e7c1){logger[_0xae50('0x66')](_0xae50('0x211'),_0x10e7c1);utils[_0xae50('0xbe')](_0x1eef8c,_0xae50('0x212'));});}}}}})[_0xae50('0x98')](function(_0x13d9a7){_0x1eef8c[_0xae50('0x20c')]=0x0;logger[_0xae50('0x66')]('[getContactCampaign2]',_0x13d9a7);});}};Dialer[_0xae50('0x1f')]['handlePower']=function(_0x3be976,_0x2177ab){var _0x6c570e=this;var _0xa18989=[];if(_0x2177ab<0x1||_0x3be976[_0xae50('0xae')]===_0xae50('0x213')){_0x2177ab=0x1;}var _0x6cffec=Math[_0xae50('0x1d0')](_0x3be976['available']*_0x2177ab)-_0x3be976[_0xae50('0x7a')];if(_0x3be976[_0xae50('0x214')]>0x0){var _0x51ef9d=_0x3be976[_0xae50('0x214')]-_0x3be976[_0xae50('0x7a')]-_0x3be976[_0xae50('0x143')]-_0x3be976['pTalking'];if(_0x6cffec>_0x51ef9d){_0x6cffec=_0x51ef9d;}}if(_0x6cffec>0x0&&_0x3be976[_0xae50('0x20c')]==0x0){if(_0x3be976['dialMethod']===_0xae50('0x213')){_0x6cffec=0x1;}if(_0x6cffec>this[_0xae50('0x27')]){_0x6cffec=this['maxNumberOriginate'];}for(var _0x317eff in this[_0xae50('0x25')]){if(typeof this[_0xae50('0x25')][_0x317eff]!=='undefined'){if(this[_0xae50('0x25')][_0x317eff][_0xae50('0xcf')]==='not_inuse'&&this['agents'][_0x317eff][_0xae50('0x83')]===_0xae50('0x84')){_0xa18989[_0xae50('0x94')](this[_0xae50('0x25')][_0x317eff]['id']);}}}_0x3be976['temp']=0x1;hopperUtils[_0xae50('0x215')](_0x3be976,_0xa18989,_0x6cffec)[_0xae50('0x3f')](function(_0x43828e){_0x3be976['temp']=0x0;if(_0x43828e){if(!utils['checkContactEmpty'](_0x43828e)){hopperUtils[_0xae50('0x216')](_0x3be976)[_0xae50('0x3f')](sendMessageReschedule(_0x3be976))[_0xae50('0x98')](loggerCatch(_0xae50('0x217')));}else{_0x3be976[_0xae50('0x7a')]+=_0x43828e[_0xae50('0x100')];_0x3be976[_0xae50('0x68')]=_0x3be976[_0xae50('0xae')]===_0xae50('0x213')?utils[_0xae50('0x69')][_0xae50('0x145')]:utils['CAMPAIGN_STATUS'][_0xae50('0x218')];for(var _0x4e4b1=0x0;_0x4e4b1<_0x43828e[_0xae50('0x100')];_0x4e4b1+=0x1){if(_['isNil'](_0x43828e[_0x4e4b1])||_[_0xae50('0xf5')](_0x43828e[_0x4e4b1][_0xae50('0x183')])||_[_0xae50('0xf5')](_0x43828e[_0x4e4b1][_0xae50('0x16a')])){_0x6c570e['emptyContact']('[actionOriginate]\x20',_0x3be976,_0x43828e[_0x4e4b1]);}else{hopperUtils[_0xae50('0x219')](_[_0xae50('0xfa')](_0x43828e[_0x4e4b1],['VoiceQueueId',_0xae50('0x16a')]))[_0xae50('0x3f')](_0x6c570e['checkContactBlack'](_0x3be976,_0x43828e[_0x4e4b1]))[_0xae50('0x98')](function(_0x5f45ca){logger[_0xae50('0x66')]('[actionOriginate]',_0x5f45ca);utils[_0xae50('0xbe')](_0x3be976,_0xae50('0x21a'));});}}}}})[_0xae50('0x98')](function(_0x50ca07){_0x3be976[_0xae50('0x20c')]=0x0;logger['error'](_0xae50('0x21b'),_0x50ca07);});}};Dialer[_0xae50('0x1f')]['handlePredictive']=function(_0x512a40){if(_0x512a40[_0xae50('0x214')]>0x0){var _0x364a7f=_0x512a40[_0xae50('0x214')]-_0x512a40[_0xae50('0x7a')]-_0x512a40[_0xae50('0x143')];if(_0x364a7f>0x0&&_0x512a40[_0xae50('0x20c')]==0x0){this[_0xae50('0x21c')](_0x512a40);}else{loggerPredictiveCalls[_0xae50('0x49')]('[handlePredictive][limitChannel]');}}else{this[_0xae50('0x21c')](_0x512a40);}};Dialer[_0xae50('0x1f')][_0xae50('0x21c')]=function(_0x28cebb){var _0x537aba=this;var _0x1d2180=[];_0x28cebb[_0xae50('0x7a')]+=0x1;for(var _0x1928e3 in this[_0xae50('0x25')]){if(typeof this['agents'][_0x1928e3]!=='undefined'){if(this['agents'][_0x1928e3][_0xae50('0xcf')]===_0xae50('0x21d')&&this[_0xae50('0x25')][_0x1928e3]['status']===_0xae50('0x84')){_0x1d2180[_0xae50('0x94')](this[_0xae50('0x25')][_0x1928e3]['id']);}}}_0x28cebb['temp']=0x1;return this[_0xae50('0x215')](_0x28cebb['id'],_0x1d2180,0x1,_0x28cebb[_0xae50('0x21e')],_0x28cebb)[_0xae50('0x3f')](function(_0x4c1204){_0x28cebb['temp']=0x1;if(_0x4c1204){if(!utils[_0xae50('0x21f')](_0x4c1204)){utils[_0xae50('0x220')](_0x28cebb,0x1,0x0);return hopperUtils[_0xae50('0x216')](_0x28cebb)['then'](sendMessageReschedule(_0x28cebb))[_0xae50('0x98')](loggerCatch(_0xae50('0x217')));}else{_0x28cebb['message']=utils[_0xae50('0x69')][_0xae50('0x218')];if(_['isNil'](_0x4c1204[0x0])||_[_0xae50('0xf5')](_0x4c1204[0x0][_0xae50('0x183')])||_[_0xae50('0xf5')](_0x4c1204[0x0][_0xae50('0x16a')])){_0x537aba[_0xae50('0x15e')](_0xae50('0x20f'),_0x28cebb,_0x4c1204[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xae50('0xfa')](_0x4c1204[0x0],[_0xae50('0xde'),_0xae50('0x16a')]))[_0xae50('0x3f')](_0x537aba[_0xae50('0x1f4')](_0x28cebb,_0x4c1204[0x0]))[_0xae50('0x98')](function(_0x3cddb2){logger['error']('[actionOriginatePredictive]',_0x3cddb2);utils[_0xae50('0xbe')](_0x28cebb,'[actionOriginatePredictive]');});}}}})[_0xae50('0x98')](function(_0x474378){_0x28cebb[_0xae50('0x20c')]=0x0;logger[_0xae50('0x66')](_0xae50('0x21b'),_0x474378);});};Dialer[_0xae50('0x1f')][_0xae50('0x1e6')]=function(_0x2c7549,_0x33128f,_0x142589,_0x35cfdc,_0x29e4d7,_0x180548){loggerPredictive[_0xae50('0x49')](_0xae50('0x221'));loggerPredictive[_0xae50('0x49')](_0xae50('0x222'),_0x2c7549);loggerPredictive['info'](_0xae50('0x223'),_0x33128f);loggerPredictive[_0xae50('0x49')]('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',_0x142589);loggerPredictive['info'](_0xae50('0x224'),_0x35cfdc);loggerPredictive['info'](_0xae50('0x225'),_0x29e4d7);loggerPredictive[_0xae50('0x49')](_0xae50('0x54'));return new Promise(function(_0x381fa7,_0x5c0797){if(_0x2c7549<=0x0||isNaN(_0x2c7549)){return _0x5c0797(msgResponse(_0xae50('0x226'),_0xae50('0x80'),_0xae50('0x227')+_0x2c7549));}if(_0x142589<=0x0||isNaN(_0x142589)){return _0x5c0797(msgResponse(_0xae50('0x226'),_0xae50('0x80'),'Ts\x20=\x20'+_0x142589));}if(_0x35cfdc<=0x0||isNaN(_0x35cfdc)){return _0x5c0797(msgResponse(_0xae50('0x226'),_0xae50('0x80'),_0xae50('0x228')+_0x35cfdc));}if(_0x33128f<=0x0||isNaN(_0x33128f)){return _0x5c0797(msgResponse(_0xae50('0x226'),_0xae50('0x80'),_0xae50('0x229')+_0x33128f));}if(_0x29e4d7<=0x0||isNaN(_0x29e4d7)){return _0x5c0797(msgResponse('[abandonmentRate]',_0xae50('0x80'),'Amax\x20=\x20'+_0x29e4d7));}_0x180548=_0x180548||0x0;var _0x15bad9=0x1/_0x142589;var _0x111feb=0x0;var _0x3df714=0x0;var _0x1f4372=0x0;var _0x403fb4=0x0;for(var _0x517cd1=0x0;_0x1f4372<_0x29e4d7;_0x517cd1+=0x1){_0x3df714=_0x517cd1/_0x33128f;_0x111feb=(_0x35cfdc*_0x3df714+_0x180548)/_0x15bad9;_0x1f4372=utils[_0xae50('0x22a')](_0x111feb,_0x2c7549);_0x403fb4=_0x111feb/_0x2c7549*(0x1-utils[_0xae50('0x22a')](_0x111feb,_0x2c7549));}return _0x381fa7({'erlangCalls':_0x517cd1,'erlangCallToSecond':_0x33128f/_0x517cd1,'erlangAbandonmentRate':_0x1f4372,'erlangBusyFactor':_0x403fb4});});};Dialer[_0xae50('0x1f')][_0xae50('0x1e8')]=function(_0x3c40a1,_0xf19b12,_0x40151f,_0xd2844f,_0x36a959,_0x5545f1){loggerPredictive[_0xae50('0x49')](_0xae50('0x22b'));loggerPredictive[_0xae50('0x49')](_0xae50('0x222'),_0x3c40a1);loggerPredictive[_0xae50('0x49')](_0xae50('0x223'),_0xf19b12);loggerPredictive[_0xae50('0x49')](_0xae50('0x22c'),_0x40151f);loggerPredictive[_0xae50('0x49')](_0xae50('0x224'),_0xd2844f);loggerPredictive[_0xae50('0x49')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36a959);loggerPredictive[_0xae50('0x49')](_0xae50('0x54'));return new Promise(function(_0x42a615,_0x5632fc){if(_0x3c40a1<=0x0||isNaN(_0x3c40a1)){return _0x5632fc(msgResponse('[busyFactor]',_0xae50('0x80'),'m\x20=\x20'+_0x3c40a1));}if(_0x40151f<=0x0||isNaN(_0x40151f)){return _0x5632fc(msgResponse(_0xae50('0x22d'),'Error',_0xae50('0x22e')+_0x40151f));}if(_0xd2844f<=0x0||isNaN(_0xd2844f)){return _0x5632fc(msgResponse(_0xae50('0x22d'),'Error',_0xae50('0x228')+_0xd2844f));}if(_0xf19b12<=0x0||isNaN(_0xf19b12)){return _0x5632fc(msgResponse(_0xae50('0x22d'),_0xae50('0x80'),_0xae50('0x229')+_0xf19b12));}if(_0x36a959<=0x0||isNaN(_0x36a959)){return _0x5632fc(msgResponse(_0xae50('0x22d'),'Error',_0xae50('0x22f')+_0x36a959));}_0x5545f1=_0x5545f1||0x0;var _0x5d280c=0x1/_0x40151f;var _0x1be3b0=0x0;var _0x20d723=0x0;var _0x715876=0x0;var _0x450da0=0x0;for(var _0x2b7d87=0x0;_0x450da0<_0x36a959;_0x2b7d87+=0x1){_0x20d723=_0x2b7d87/_0xf19b12;_0x1be3b0=(_0xd2844f*_0x20d723+_0x5545f1)/_0x5d280c;_0x715876=utils['erlangb'](_0x1be3b0,_0x3c40a1);_0x450da0=_0x1be3b0/_0x3c40a1*(0x1-utils[_0xae50('0x22a')](_0x1be3b0,_0x3c40a1));}return _0x42a615({'erlangCalls':_0x2b7d87,'erlangCallToSecond':_0xf19b12/_0x2b7d87,'erlangAbandonmentRate':_0x715876,'erlangBusyFactor':_0x450da0});});};module[_0xae50('0x230')]=Dialer; \ No newline at end of file +var _0x1603=['starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','Interval','\x20INTERVAL_IS_NULL','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20deactivated','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Intervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','stringify','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','OVERTIME_INTERVAL','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','decrementOriginate','[syncAgentConnect]','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','getSeconds','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','dropreason','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','queueCallerAbandonCreateState','add','dialDropRetryFrequency','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','additional','countabandonedretry','[rescheduleContact][Abandoned]','syncNewExten','channel','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','roundrobin','run','idHopper','finally','[syncQueueStatusComplete]','ContactId','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','pick','contactAgent-idHopper:\x20','[booked][unlock]','rescheduleContact','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','responsetime','getQueue','response','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','membername','AMD','emit','buildObj','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','dialGlobalMaxRetry','dialMachineMaxRetry','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','[syncHangup]','AnswerAGI','[syncHangup2]','[syncAgentComplete]','outboundUnknownCallsDay','Unknown','running','isPreviewCampaign','resolve','statusMessage','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','updateReportFromOutboundQueue','throttle','filter','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[getVoiceQueueRtPauses]\x20','emptyContact','[emptyContact]','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','isOutboundQueue','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','getCallerId','Trunk','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countbusyretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','dialPredictiveInterval','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(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','getVoiceQueueRtPauses','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','[handleIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','[actionOriginate]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','checkIsBlackList','[actionOriginatePredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','lodash','uuid','ioredis','./utils','./utils/hopper','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','type','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','predictiveIntervalAvgHoldtime','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','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','state','endtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1603,0x1b4));var _0x3160=function(_0x4002a2,_0x49a870){_0x4002a2=_0x4002a2-0x0;var _0x1e993b=_0x1603[_0x4002a2];return _0x1e993b;};'use strict';var util=require('util');var _=require(_0x3160('0x0'));var uuid=require(_0x3160('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x3160('0x2'));var utils=require(_0x3160('0x3'));var hopperUtils=require(_0x3160('0x4'));var ut=require('../preview/util/util');var config=require(_0x3160('0x5'));var logger=require('../../../config/logger')(_0x3160('0x6'));var loggerBooked=require(_0x3160('0x7'))(_0x3160('0x8'));var loggerPredictive=require(_0x3160('0x7'))(_0x3160('0x9'));var loggerPredictiveCalls=require(_0x3160('0x7'))(_0x3160('0xa'));var loggerSyncQueueSummary=require(_0x3160('0x7'))(_0x3160('0xb'));var ami=require(_0x3160('0xc'));config[_0x3160('0xd')]=_[_0x3160('0xe')](config[_0x3160('0xd')],{'host':_0x3160('0xf'),'port':0x18eb});var io=require(_0x3160('0x10'))(new Redis(config[_0x3160('0xd')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x3160('0x11'));var RpcSetting=require(_0x3160('0x12'));var Interval=require(_0x3160('0x13'));var Action=require(_0x3160('0x14'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x3160('0x15'));var QueueCallerAbandon=require(_0x3160('0x16'));var Hangup=require(_0x3160('0x17'));var ipAgi=process['env'][_0x3160('0x18')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3160('0x19')][_0x3160('0x1a')]=function(_0x41ef02){this[_0x3160('0x1b')]=this['tail']?this[_0x3160('0x1b')]['finally'](_0x41ef02):_0x41ef02();};function Dialer(_0x155f26,_0x175f3c){this[_0x3160('0x1c')]=new Sequence();this[_0x3160('0x1d')]=_0x175f3c;this[_0x3160('0x1e')]=_0x155f26[_0x3160('0x1e')];this[_0x3160('0x1f')]=_0x155f26['campaigns'];this[_0x3160('0x20')]=_0x155f26[_0x3160('0x20')];this[_0x3160('0x21')]=_0x155f26[_0x3160('0x21')];this[_0x3160('0x22')]=config[_0x3160('0x22')]||0x2;this[_0x3160('0x23')]={};this[_0x3160('0x24')]={};this[_0x3160('0x25')]={};this[_0x3160('0x26')]={};this[_0x3160('0x27')]={};this[_0x3160('0x28')]={};this[_0x3160('0x29')]={};this[_0x3160('0x2a')]={};this[_0x3160('0x2b')]={};this[_0x3160('0x2c')]={};this[_0x3160('0x2d')]={};ami['on']('agentconnect',this[_0x3160('0x2e')][_0x3160('0x2f')](this));ami['on'](_0x3160('0x30'),this[_0x3160('0x31')][_0x3160('0x2f')](this));ami['on'](_0x3160('0x32'),this[_0x3160('0x33')][_0x3160('0x2f')](this));ami['on']('agentcomplete',this[_0x3160('0x34')][_0x3160('0x2f')](this));ami['on'](_0x3160('0x35'),this[_0x3160('0xb')][_0x3160('0x2f')](this));ami['on'](_0x3160('0x36'),this[_0x3160('0x37')][_0x3160('0x2f')](this));ami['on']('hangup',this[_0x3160('0x38')][_0x3160('0x2f')](this));ami['on'](_0x3160('0x39'),this['syncNewExten'][_0x3160('0x2f')](this));ami['on']('varset',this[_0x3160('0x3a')][_0x3160('0x2f')](this));ami['on'](_0x3160('0x3b'),this[_0x3160('0x3c')]['bind'](this));ami['on'](_0x3160('0x3d'),this[_0x3160('0x3e')][_0x3160('0x2f')](this));this[_0x3160('0x3f')]();this[_0x3160('0x40')]();RpcSetting[_0x3160('0x41')]()['then'](function(_0x556a3c){previewRecallmeReminderInterval=_0x556a3c[_0x3160('0x42')];});}function isNotNull(_0x284838){return _0x284838!==null&&!_[_0x3160('0x43')](_0x284838);}function msgResponse(_0x3d8e2d,_0x3f4984,_0x2c864c){return{'action':_0x3d8e2d,'response':_0x3f4984,'message':_0x2c864c,'stack':_0x2c864c};}function emit(_0x73ba78,_0x42e04b,_0x1b288e){io['to'](_0x73ba78)['emit'](_0x42e04b,_0x1b288e);}function emitOutboundVoiceQueueSummary(_0x4f89d5){if(_0x4f89d5[_0x3160('0x44')]===_0x3160('0x45')){logger[_0x3160('0x46')](_0x3160('0x47'),util[_0x3160('0x48')](_0x4f89d5,{'showHidden':![],'depth':null}));emit(util[_0x3160('0x49')](_0x3160('0x4a'),_0x4f89d5[_0x3160('0x4b')]),_0x3160('0x4c'),_0x4f89d5);}}function checkGetDataPredictive(_0x197d15){if(isNotNull(_0x197d15)&&!_[_0x3160('0x4d')](_0x197d15)){loggerPredictive[_0x3160('0x4e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x3160('0x4e')](_0x3160('0x4f'),_0x197d15[_0x3160('0x50')]);loggerPredictive[_0x3160('0x4e')](_0x3160('0x51'),_0x197d15[_0x3160('0x52')]);loggerPredictive['info'](_0x3160('0x53'),_0x197d15['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x3160('0x4e')](_0x3160('0x54'),_0x197d15[_0x3160('0x55')]);loggerPredictive['info'](_0x3160('0x56'),_0x197d15[_0x3160('0x57')]);loggerPredictive[_0x3160('0x4e')](_0x3160('0x58'),_0x197d15[_0x3160('0x59')]);loggerPredictive[_0x3160('0x4e')](_0x3160('0x5a'));if(_0x197d15[_0x3160('0x50')]>0x0){if(!_[_0x3160('0x43')](_0x197d15[_0x3160('0x59')])&&_0x197d15['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x3160('0x4e')](_0x3160('0x5b'));if(!_[_0x3160('0x43')](_0x197d15[_0x3160('0x57')])&&_0x197d15[_0x3160('0x57')]>0x0){return!![];}loggerPredictive[_0x3160('0x4e')](_0x3160('0x5c'));}else{loggerPredictive['info'](_0x3160('0x5d'));}}else{loggerPredictive[_0x3160('0x4e')](_0x3160('0x5e'));}return![];}function mergeDataErlangB(_0x1dba2f){return function(_0x2cb176){loggerPredictive[_0x3160('0x4e')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x3160('0x4e')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cb176['erlangCalls']);loggerPredictive[_0x3160('0x4e')](_0x3160('0x5f'),_0x2cb176[_0x3160('0x60')]);loggerPredictive['info'](_0x3160('0x61'),_0x2cb176[_0x3160('0x62')]);loggerPredictive[_0x3160('0x4e')](_0x3160('0x63'),_0x2cb176['erlangBusyFactor']);loggerPredictive[_0x3160('0x4e')](_0x3160('0x61'),_0x2cb176[_0x3160('0x62')]);loggerPredictive[_0x3160('0x4e')](_0x3160('0x5a'));_[_0x3160('0x64')](_0x1dba2f,_0x2cb176);};}function ifInterval(_0x1dfe41,_0x369a0e){if(_[_0x3160('0x43')](_0x369a0e)){return![];}return utils['getSeconds'](undefined,_0x369a0e)<_0x1dfe41*0x3c;}function clearPredictiveAttributes(_0x4304eb){if(_0x4304eb[_0x3160('0x29')]){_0x4304eb['startProgressive']=undefined;loggerPredictive[_0x3160('0x46')](_0x4304eb[_0x3160('0x4b')],'startProgressive\x20value\x20cleared');}if(_0x4304eb[_0x3160('0x28')]){_0x4304eb[_0x3160('0x28')]=undefined;loggerPredictive['debug'](_0x4304eb['name'],_0x3160('0x65'));}if(_0x4304eb['handlePredictive']){clearInterval(_0x4304eb[_0x3160('0x66')]);_0x4304eb[_0x3160('0x66')]=undefined;loggerPredictive[_0x3160('0x46')](_0x4304eb[_0x3160('0x4b')],_0x3160('0x67'));}}function loggerCatchPredictive(_0xd060de,_0x3a6a60){return function(_0xdd131){loggerPredictive[_0x3160('0x68')](_0x3a6a60[_0x3160('0x4b')],_0xd060de);loggerPredictive[_0x3160('0x68')](_0xdd131[_0x3160('0x69')]);clearPredictiveAttributes(_0x3a6a60);};}function loggerCatch(_0x14c0b1){return function(_0x2d1641){logger[_0x3160('0x68')](_0x14c0b1,util[_0x3160('0x48')](_0x2d1641,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x316720){return function(_0x3e4b42){if(isNotNull(_0x3e4b42)&&isNotNull(_0x3e4b42[0x0])){if(_0x3e4b42[0x0]['contactsRescheduled']>0x0){_0x316720[_0x3160('0x6a')]=utils[_0x3160('0x6b')][_0x3160('0x6c')];logger[_0x3160('0x4e')](_0x3160('0x6d')+_0x316720[_0x3160('0x4b')],_0x3e4b42[0x0]['contactsRescheduled'],_0x3160('0x6e'));}else{_0x316720[_0x3160('0x6a')]=utils['CAMPAIGN_STATUS'][_0x3160('0x6f')];logger[_0x3160('0x4e')]('[getContactDialer2][Empty]'+_0x316720[_0x3160('0x4b')]);}}};}function createObjHistory(_0x2876a3,_0x59b44e,_0x37b77d,_0x42d792,_0x24c29e){_0x2876a3['message']=_0x37b77d;var _0x33ac9a=new Action(_0x2876a3,_0x59b44e);var _0x3cb6f1=new History(_0x33ac9a);_0x3cb6f1[_0x3160('0x70')]=_0x42d792;_0x3cb6f1['statedesc']=_0x24c29e;_0x3cb6f1[_0x3160('0x71')]=_0x33ac9a[_0x3160('0x72')];return _0x3cb6f1;}function unlockQueueStatus(_0x4ee15f,_0x3e7fbd){setTimeout(function(){if(_['isUndefined'](_0x4ee15f['queueStatusComplete'])){loggerBooked['error'](_0x3160('0x73'),_0x3e7fbd);}_0x4ee15f[_0x3160('0x74')]=!![];loggerBooked[_0x3160('0x4e')](_0x3160('0x75'),_0x3e7fbd,JSON['stringify'](_['pick'](_0x4ee15f,[_0x3160('0x4b'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x1d3c84){return function(){if(!isNotNull(_0x1d3c84[_0x3160('0x76')])){_0x1d3c84[_0x3160('0x6a')]=utils[_0x3160('0x6b')]['NULL_INTERVAL'];throw _0x1d3c84[_0x3160('0x4b')]+_0x3160('0x77');}if(!isNotNull(_0x1d3c84[_0x3160('0x76')]['Intervals'])){_0x1d3c84[_0x3160('0x6a')]=utils[_0x3160('0x6b')][_0x3160('0x78')];throw _0x1d3c84[_0x3160('0x4b')]+_0x3160('0x77');}if(!isNotNull(_[_0x3160('0x4d')](_0x1d3c84[_0x3160('0x76')]['Intervals']))){_0x1d3c84[_0x3160('0x6a')]=utils[_0x3160('0x6b')][_0x3160('0x78')];throw _0x1d3c84[_0x3160('0x4b')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x43a799){return function(){if(!utils[_0x3160('0x79')](_0x43a799)){_0x43a799[_0x3160('0x6a')]=utils[_0x3160('0x6b')][_0x3160('0x7a')];throw _0x43a799[_0x3160('0x4b')]+_0x3160('0x7b');}};}function emitCampaignSummary(_0x1020e6){if(utils['isIVRCampaign'](_0x1020e6)){emit(util[_0x3160('0x49')](_0x3160('0x7c'),_0x1020e6['name']),_0x3160('0x7d'),_0x1020e6);}}function loggerCatchQueueSummary(_0x31e03c,_0x236b34){return function(_0x536a6c){clearPredictiveAttributes(_0x236b34);emitCampaignSummary(_0x236b34);loggerSyncQueueSummary[_0x3160('0x46')](_0x31e03c,util[_0x3160('0x48')](_0x536a6c,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3603e4){if(_0x3603e4[_0x3160('0x7e')]){if(_0x3603e4[_0x3160('0x7f')]===0x0){_0x3603e4['sendMessageOneNotActive']=![];_0x3603e4[_0x3160('0x6a')]=utils[_0x3160('0x6b')]['INACTIVE'];loggerSyncQueueSummary[_0x3160('0x46')](_0x3160('0x80'),_0x3603e4[_0x3160('0x4b')],_0x3160('0x81'));}else{_0x3603e4['message']=utils['CAMPAIGN_STATUS'][_0x3160('0x82')];loggerSyncQueueSummary['debug'](_0x3160('0x80'),_0x3603e4[_0x3160('0x4b')],_0x3160('0x83'));}emitCampaignSummary(_0x3603e4);}}function myreject(_0x4a2771){return function(_0x5e7146){return _0x4a2771(msgResponse('[ifTime][Action]',_0x3160('0x84'),JSON['stringify'](_0x5e7146)));};}Dialer[_0x3160('0x19')][_0x3160('0x85')]=function(_0x39623f){return!_['isUndefined'](_0x39623f)&&_0x39623f&&!_[_0x3160('0x43')](_0x39623f[_0x3160('0x4b')])&&!_['isUndefined'](_0x39623f[_0x3160('0x86')])&&_0x39623f[_0x3160('0x86')]&&(this[_0x3160('0x21')][util[_0x3160('0x49')](_0x3160('0x87'),_0x39623f[_0x3160('0x4b')])][_0x3160('0x88')]===_0x3160('0x89')||this[_0x3160('0x21')][util[_0x3160('0x49')](_0x3160('0x87'),_0x39623f['name'])][_0x3160('0x88')]===_0x3160('0x8a'));};Dialer[_0x3160('0x19')]['checkIsTrunkReachable']=function(_0x491ca1){var _0x47eb26=this;return function(){if(!_0x47eb26[_0x3160('0x85')](_0x491ca1['Trunk'])){if(!_0x47eb26[_0x3160('0x85')](_0x491ca1[_0x3160('0x8b')])){_0x491ca1['message']=utils[_0x3160('0x6b')][_0x3160('0x8c')];throw _0x491ca1[_0x3160('0x4b')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x3160('0x19')][_0x3160('0x8d')]=function(_0x1f7cdf,_0x4e416e,_0x226f53,_0x5dffbc){var _0x45865d=this;return function(){var _0x3c8c5e=!![];return _0x45865d[_0x3160('0x8e')](_0x1f7cdf,_0x4e416e,_0x226f53,_0x5dffbc,_0x3c8c5e);};};Dialer[_0x3160('0x19')][_0x3160('0x8f')]=function(_0x33a32a,_0x50a3cc,_0x1dfdc9,_0x2eca91){var _0x345a10=this;return function(){var _0x5c4414=![];return _0x345a10['ifTimeIvr'](_0x33a32a[_0x3160('0x90')],_0x50a3cc,_0x1dfdc9,_0x2eca91,_0x5c4414);};};Dialer['prototype'][_0x3160('0x8e')]=function(_0x2b3bcd,_0x291c9d,_0x56ed26,_0x11a258,_0x4bca25){var _0x27d264=[];return new Promise(function(_0x407cbb,_0x4f85fa){if(!isNotNull(_0x2b3bcd)){_0x11a258[_0x3160('0x6a')]=utils[_0x3160('0x6b')][_0x3160('0x78')];return _0x4f85fa(msgResponse(_0x3160('0x91'),_0x3160('0x92'),_0x56ed26+_0x3160('0x93')));}if(_[_0x3160('0x4d')](_0x2b3bcd)){_0x11a258[_0x3160('0x6a')]=utils[_0x3160('0x6b')]['EMPTY_INTERVAL'];return _0x4f85fa(msgResponse(_0x3160('0x91'),_0x3160('0x92'),_0x56ed26+'\x20Intervals\x20is\x20empty\x20'));}if(_0x291c9d&&_[_0x3160('0x43')](config[_0x3160('0x94')][_0x291c9d])){_0x11a258['message']=utils[_0x3160('0x6b')][_0x3160('0x95')];return _0x4f85fa(msgResponse('ifTime',_0x3160('0x92'),_0x56ed26+_0x3160('0x96')+_0x291c9d));}if(_[_0x3160('0x97')](_0x2b3bcd)){for(var _0x3d195f=0x0;_0x3d195f<_0x2b3bcd['length'];_0x3d195f+=0x1){_0x27d264[_0x3160('0x98')](ami[_0x3160('0x99')]({'action':_0x3160('0x9a'),'command':util[_0x3160('0x49')](_0x3160('0x9b'),_0x2b3bcd[_0x3d195f][_0x3160('0x9c')],!_[_0x3160('0x43')](config[_0x3160('0x94')][_0x291c9d])?_0x291c9d:'')})[_0x3160('0x9d')](function(_0x2f94cf){return _0x2f94cf[_0x3160('0x9e')][_0x3160('0x9f')](_0x3160('0xa0'))>=0x0;})[_0x3160('0xa1')](myreject(_0x4f85fa)));}}else{_0x27d264[_0x3160('0x98')](ami['Action']({'action':'command','command':util[_0x3160('0x49')]('iftime\x20%s,%s',_0x2b3bcd,!_[_0x3160('0x43')](config[_0x3160('0x94')][_0x291c9d])?_0x291c9d:'')})[_0x3160('0x9d')](function(_0x4f7883){return _0x4f7883['content'][_0x3160('0x9f')](_0x3160('0xa0'))>=0x0;})[_0x3160('0xa1')](myreject(_0x4f85fa)));}Promise['all'](_0x27d264)[_0x3160('0x9d')](function(_0x3d436e){var _0x32989d=_[_0x3160('0xa2')](_0x3d436e);if(_0x32989d){return _0x407cbb(_0x32989d);}else{_0x11a258[_0x3160('0x6a')]=_0x4bca25?utils[_0x3160('0x6b')][_0x3160('0xa3')]:utils[_0x3160('0x6b')]['OVERTIME_INTERVAL'];return _0x4f85fa(msgResponse(_0x3160('0xa4'),_0x3160('0x92'),_0x3160('0xa5')+_0x4bca25+'\x20'+_0x56ed26+_0x3160('0xa6')+util['inspect'](_0x2b3bcd,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x291c9d));}})[_0x3160('0xa1')](function(_0x118a68){return _0x4f85fa(msgResponse(_0x3160('0x91'),'Failure',JSON[_0x3160('0xa7')](_0x118a68)));});});};Dialer[_0x3160('0x19')][_0x3160('0x3f')]=function(){var _0x2231c6=this;return cmHopper[_0x3160('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0x3160('0x9d')](function(){setInterval(function(){_0x2231c6[_0x3160('0xa9')]();},0x3e8);});};Dialer['prototype'][_0x3160('0xa9')]=function(){var _0x110f94=this;var _0x284666;for(var _0x552312 in this[_0x3160('0x1f')]){if(typeof this[_0x3160('0x1f')][_0x552312]!==_0x3160('0xaa')){_0x284666=this[_0x3160('0x1f')][_0x552312];if(utils[_0x3160('0xab')](_0x284666)&&utils[_0x3160('0x79')](_0x284666)){_0x284666[_0x3160('0x7e')]=!![];Promise['resolve']()[_0x3160('0x9d')](checkIsIVRCampaignActive(_0x284666))[_0x3160('0x9d')](checkInterval(_0x284666))['then'](_0x110f94[_0x3160('0xac')](_0x284666))['then'](_0x110f94[_0x3160('0x8d')](_0x284666[_0x3160('0xad')],_0x284666[_0x3160('0xae')],_0x284666[_0x3160('0x4b')],_0x284666))[_0x3160('0x9d')](_0x110f94[_0x3160('0x8f')](_0x284666[_0x3160('0x76')],_0x284666[_0x3160('0xae')],_0x284666[_0x3160('0x4b')],_0x284666))['then'](_0x110f94[_0x3160('0xaf')](_0x284666))[_0x3160('0xa1')](loggerCatchQueueSummary(_0x3160('0xb0'),_0x284666));}else{notSendMessagesCampaign(_0x284666);}}}};Dialer[_0x3160('0x19')]['checkDialMethod']=function(_0x4281bf){if(_0x4281bf[_0x3160('0xb1')]!==_0x3160('0x9')){clearPredictiveAttributes(_0x4281bf);}switch(_0x4281bf[_0x3160('0xb1')]){case _0x3160('0xb2'):this[_0x3160('0xb3')](_0x4281bf,0x1);break;case _0x3160('0xb4'):this[_0x3160('0xb3')](_0x4281bf,_0x4281bf[_0x3160('0xb5')]);break;case'predictive':this[_0x3160('0x9')](_0x4281bf);break;case _0x3160('0x8'):this[_0x3160('0xb3')](_0x4281bf,0x1);break;default:logger[_0x3160('0x68')](_0x3160('0xb6'),_0x4281bf[_0x3160('0x4b')],_0x3160('0xb7'));}};Dialer[_0x3160('0x19')][_0x3160('0x91')]=function(_0x54d74a,_0x225ba5){var _0x1644e6=_0x54d74a[_0x3160('0xae')];var _0x4b3145=_0x225ba5?_0x54d74a['dialGlobalInterval']:_0x54d74a[_0x3160('0x76')]['Intervals'];logger[_0x3160('0xb8')](_0x3160('0xb9'),_0x4b3145,_0x1644e6,_0x54d74a[_0x3160('0x4b')],util[_0x3160('0x49')]('Voice\x20Queue\x20%s\x20$s',_0x54d74a[_0x3160('0x4b')],_0x54d74a['id']));var _0x4dee21=null;return Interval['intervalIftime'](_0x4b3145,_0x1644e6)[_0x3160('0x9d')](function(_0x59477d){if(_0x59477d===!![]){return _0x59477d;}else{_0x54d74a[_0x3160('0x6a')]=_0x225ba5?utils['CAMPAIGN_STATUS'][_0x3160('0xa3')]:utils[_0x3160('0x6b')][_0x3160('0xba')];_0x4dee21=msgResponse(_0x3160('0xa4'),_0x3160('0x92'),_0x3160('0xa5')+_0x225ba5+'\x20'+_0x54d74a[_0x3160('0x4b')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x4b3145,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1644e6);}if(_0x4dee21!==null){logger[_0x3160('0xb8')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x4dee21);_0x4dee21[_0x3160('0xbb')]=_0x225ba5;throw _0x4dee21;}})[_0x3160('0xa1')](function(_0x3311d1){logger[_0x3160('0x68')](_0x3160('0xbc'),_0x3311d1);throw msgResponse(_0x3160('0xbd'),_0x3160('0x84'),util[_0x3160('0x48')](_0x3311d1,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x3160('0x2e')]=function(_0x489d5d){if(this[_0x3160('0x1e')][_0x489d5d[_0x3160('0xbe')]]){if(this[_0x3160('0x26')][_0x489d5d[_0x3160('0xbf')]]&&this[_0x3160('0x26')][_0x489d5d[_0x3160('0xbf')]][_0x3160('0x44')]!==_0x3160('0xc0')){utils[_0x3160('0xc1')](this[_0x3160('0x1e')][_0x489d5d[_0x3160('0xbe')]],_0x3160('0xc2'));this[_0x3160('0x26')][_0x489d5d[_0x3160('0xbf')]][_0x3160('0xc3')]=moment()['format'](_0x3160('0xc4'));}}};Dialer[_0x3160('0x19')]['syncAgentComplete']=function(_0x52e2be){var _0x29e322=this[_0x3160('0x26')][_0x52e2be[_0x3160('0xbf')]];if(this[_0x3160('0x1e')][_0x52e2be[_0x3160('0xbe')]]){if(_0x29e322&&_0x29e322[_0x3160('0x44')]!=='ivr'){delete this[_0x3160('0x26')][_0x52e2be[_0x3160('0xbf')]];this[_0x3160('0x1e')][_0x52e2be[_0x3160('0xbe')]]['outboundAnswerCallsDay']+=0x1;var _0x1d6cb2=new AgentComplete(_0x29e322,_0x52e2be);if(_0x52e2be[_0x3160('0xc5')]===_0x3160('0xc6')){_0x1d6cb2[_0x3160('0xc7')]=this[_0x3160('0x1e')][_0x52e2be[_0x3160('0xbe')]][_0x3160('0xc8')]&&this[_0x3160('0x1e')][_0x52e2be[_0x3160('0xbe')]][_0x3160('0xc9')]?moment()[_0x3160('0x49')](_0x3160('0xc4')):undefined;}hopperUtils[_0x3160('0xca')](_0x1d6cb2)['catch'](loggerCatch(_0x3160('0xcb')));hopperUtils[_0x3160('0xcc')](_0x1d6cb2)[_0x3160('0xa1')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x3160('0x31')]=function(_0x269432){var _0x3c17f2=this[_0x3160('0x26')][_0x269432['uniqueid']];var _0x2c7f0c=this;var _0x418de9=![];var _0x2d7c40;var _0x5cccf7;if(this['voiceQueues'][_0x269432[_0x3160('0xbe')]]){if(_0x3c17f2&&_0x3c17f2[_0x3160('0x44')]!==_0x3160('0xc0')){delete this['uniqueId'][_0x269432[_0x3160('0xbf')]];utils[_0x3160('0xc1')](this[_0x3160('0x1e')][_0x269432['queue']],'[syncQueueCallerAbandon]');_0x3c17f2[_0x3160('0xcd')]=moment()[_0x3160('0x49')](_0x3160('0xc4'));var _0x3a9cde=new QueueCallerAbandon(_0x3c17f2,_0x269432);if(utils[_0x3160('0xce')](_0x3c17f2[_0x3160('0xcd')],_0x3c17f2['responsetime'])>=_0x3c17f2[_0x3160('0xcf')]){this[_0x3160('0x1e')][_0x269432[_0x3160('0xbe')]][_0x3160('0xd0')]+=0x1;this['voiceQueues'][_0x269432[_0x3160('0xbe')]][_0x3160('0xd1')]+=0x1;this[_0x3160('0x1e')][_0x269432[_0x3160('0xbe')]][_0x3160('0xd2')]+=0x1;_0x3a9cde[_0x3160('0x70')]=0xa;_0x3a9cde[_0x3160('0xd3')]='Drop';_0x3a9cde[_0x3160('0xd4')]='TIMEOUT';_0x3a9cde[_0x3160('0xc7')]=this[_0x3160('0x1e')][_0x269432['queue']][_0x3160('0xc8')]?moment()['format'](_0x3160('0xc4')):undefined;_0x3a9cde[_0x3160('0xd5')]+=0x1;_0x3a9cde[_0x3160('0xd6')]+=0x1;_0x2d7c40=this['voiceQueues'][_0x269432[_0x3160('0xbe')]]['dialDropRetryFrequency'];_0x5cccf7=this[_0x3160('0x1e')][_0x269432[_0x3160('0xbe')]][_0x3160('0xd7')];hopperUtils[_0x3160('0xd8')](_0x3a9cde,_0x3a9cde[_0x3160('0x70')],_0x3c17f2[_0x3160('0xd9')])[_0x3160('0x9d')](function(_0x1bf2cc){_0x418de9=_0x1bf2cc['additional']==0x1;if(_0x3a9cde[_0x3160('0xd5')]>=_0x2c7f0c['voiceQueues'][_0x269432[_0x3160('0xbe')]][_0x3160('0xda')]){_0x2c7f0c[_0x3160('0xdb')](_0x3a9cde,_0x1bf2cc['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x3a9cde[_0x3160('0xd5')],'scheduledat':moment()[_0x3160('0xdc')](_0x2c7f0c['voiceQueues'][_0x269432[_0x3160('0xbe')]][_0x3160('0xdd')],_0x3160('0xde'))[_0x3160('0x49')](_0x3160('0xc4')),'ContactId':_0x3c17f2['ContactId'],'ListId':_0x3c17f2[_0x3160('0xdf')],'VoiceQueueId':_0x3c17f2[_0x3160('0xe0')]||undefined,'CampaignId':_0x3c17f2[_0x3160('0xe1')]||undefined})['catch'](loggerCatch(_0x3160('0xe2')));var _0x39f60e=new History(_0x3a9cde);_0x39f60e['state']=0xa;_0x39f60e[_0x3160('0xd3')]=_0x3160('0xe3');_0x39f60e[_0x3160('0x72')]=moment()[_0x3160('0x49')](_0x3160('0xc4'));_0x39f60e['endtime']=_0x39f60e[_0x3160('0x72')];_0x39f60e[_0x3160('0xe4')]=_0x3a9cde[_0x3160('0xe4')];_0x39f60e['calleridnum']=_0x3a9cde[_0x3160('0xe5')];hopperUtils[_0x3160('0xca')](_0x39f60e)[_0x3160('0xa1')](loggerCatch(_0x3160('0xe6')));}})[_0x3160('0x9d')](function(){if(_0x418de9)hopperUtils[_0x3160('0xe7')](_0x3a9cde,_0x2d7c40,_0x5cccf7)[_0x3160('0x9d')](function(){return 0x1;});});}else{this['voiceQueues'][_0x269432[_0x3160('0xbe')]][_0x3160('0x55')]+=0x1;this[_0x3160('0x1e')][_0x269432[_0x3160('0xbe')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3a9cde[_0x3160('0x70')]=0xb;_0x3a9cde[_0x3160('0xd3')]='Abandoned';_0x3a9cde[_0x3160('0xd4')]=_0x3160('0xe8');_0x3a9cde['countabandonedretry']+=0x1;_0x3a9cde[_0x3160('0xd6')]+=0x1;_0x2d7c40=this['voiceQueues'][_0x269432[_0x3160('0xbe')]][_0x3160('0xe9')];_0x5cccf7=this[_0x3160('0x1e')][_0x269432[_0x3160('0xbe')]][_0x3160('0xd7')];hopperUtils[_0x3160('0xd8')](_0x3a9cde,_0x3a9cde[_0x3160('0x70')],_0x3c17f2['voiceQueue'])[_0x3160('0x9d')](function(_0x31c80c){if(_0x3a9cde['countabandonedretry']>=_0x2c7f0c[_0x3160('0x1e')][_0x269432[_0x3160('0xbe')]][_0x3160('0xea')]){_0x2c7f0c[_0x3160('0xdb')](_0x3a9cde,_0x31c80c[_0x3160('0xeb')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3a9cde[_0x3160('0xec')],'scheduledat':moment()['add'](_0x2c7f0c[_0x3160('0x1e')][_0x269432[_0x3160('0xbe')]]['dialAbandonedRetryFrequency'],_0x3160('0xde'))[_0x3160('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c17f2['ContactId'],'ListId':_0x3c17f2[_0x3160('0xdf')],'VoiceQueueId':_0x3c17f2['VoiceQueueId']||undefined,'CampaignId':_0x3c17f2['CampaignId']||undefined})[_0x3160('0xa1')](loggerCatch(_0x3160('0xed')));var _0x14a804=new History(_0x3a9cde);_0x14a804[_0x3160('0x70')]=0xb;_0x14a804[_0x3160('0xd3')]='Abandoned';_0x14a804[_0x3160('0x72')]=moment()[_0x3160('0x49')](_0x3160('0xc4'));_0x14a804['endtime']=_0x14a804[_0x3160('0x72')];_0x14a804['calleridname']=_0x3a9cde['calleridname'];_0x14a804[_0x3160('0xe5')]=_0x3a9cde[_0x3160('0xe5')];hopperUtils[_0x3160('0xca')](_0x14a804)[_0x3160('0xa1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x418de9)hopperUtils['swapAdditionalPhones'](_0x3a9cde,_0x2d7c40,_0x5cccf7)[_0x3160('0x9d')](function(){return 0x1;});});}}}};Dialer[_0x3160('0x19')][_0x3160('0xee')]=function(_0x5dd0ef){if(this[_0x3160('0x24')][_0x5dd0ef[_0x3160('0xbf')]]){this[_0x3160('0x24')][_0x5dd0ef[_0x3160('0xbf')]]['channel']=_0x5dd0ef[_0x3160('0xef')];}if(this[_0x3160('0x26')][_0x5dd0ef[_0x3160('0xbf')]]){this[_0x3160('0x26')][_0x5dd0ef[_0x3160('0xbf')]][_0x3160('0xef')]=_0x5dd0ef[_0x3160('0xef')];}};Dialer[_0x3160('0x19')][_0x3160('0x3c')]=function(_0x5a64db){if(!this['actions'][_0x5a64db['actionid']]){return;}var _0x4cc1eb=this[_0x3160('0x1e')][this[_0x3160('0x24')][_0x5a64db[_0x3160('0xf0')]][_0x3160('0xbe')]][_0x3160('0xf1')]||_0x3160('0xf2');if(_0x4cc1eb==='roundrobin'){if(this[_0x3160('0x24')][_0x5a64db['actionid']]&&_[_0x3160('0xf3')](this[_0x3160('0x24')][_0x5a64db['actionid']][_0x3160('0xf4')])&&_0x5a64db['status']==='1'&&_0x5a64db[_0x3160('0xf5')]==='0'){if(this[_0x3160('0x20')][_0x5a64db['stateinterface']]){if(!this[_0x3160('0x20')][_0x5a64db[_0x3160('0xf6')]][_0x3160('0xf4')]){this[_0x3160('0x20')][_0x5a64db[_0x3160('0xf6')]][_0x3160('0xf4')]=!![];this['actions'][_0x5a64db['actionid']]['locked']=!![];this[_0x3160('0x24')][_0x5a64db[_0x3160('0xf0')]][_0x3160('0xf6')]=_0x5a64db[_0x3160('0xf6')];}}}}else if(_0x4cc1eb===_0x3160('0xf2')){if(this[_0x3160('0x24')][_0x5a64db[_0x3160('0xf0')]]){if(this[_0x3160('0x20')][_0x5a64db['stateinterface']]){this[_0x3160('0x24')][_0x5a64db[_0x3160('0xf0')]][_0x3160('0xf6')]=_0x5a64db[_0x3160('0xf6')];if(_['isNil'](this[_0x3160('0x2b')][this[_0x3160('0x24')][_0x5a64db[_0x3160('0xf0')]]['queue']])){this[_0x3160('0x2b')][this[_0x3160('0x24')][_0x5a64db['actionid']][_0x3160('0xbe')]]=[];}this[_0x3160('0x2b')][this[_0x3160('0x24')][_0x5a64db['actionid']]['queue']][_0x3160('0x98')](_[_0x3160('0x64')](_['pick'](this[_0x3160('0x24')][_0x5a64db[_0x3160('0xf0')]],['idHopper',_0x3160('0xf6')]),{'status':_0x5a64db['status'],'paused':_0x5a64db[_0x3160('0xf5')]}));}}}};Dialer[_0x3160('0x19')][_0x3160('0x3e')]=function(_0x58f313){if(!this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]]){return;}var _0x3a813e=this;var _0x440eb2=this[_0x3160('0x1e')][this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xbe')]];var _0x369d82=_0x440eb2[_0x3160('0xf1')]||_0x3160('0xf2');if(_0x369d82===_0x3160('0xf7')){if(this['actions'][_0x58f313['actionid']]&&this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xf6')]){this[_0x3160('0x1d')][_0x3160('0xf8')](this['actions'][_0x58f313[_0x3160('0xf0')]][_0x3160('0xf9')],this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xf6')])[_0x3160('0xa1')](function(_0x37bd20){logger[_0x3160('0x68')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x37bd20,{'showHidden':![],'depth':null}));})[_0x3160('0xfa')](function(){utils[_0x3160('0xc1')](_0x3a813e[_0x3160('0x1e')][_0x3a813e[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xbe')]],_0x3160('0xfb'));_0x3a813e[_0x3160('0x20')][_0x3a813e[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xf6')]]['locked']=![];delete _0x3a813e['actions'][_0x58f313['actionid']];unlockQueueStatus(_0x440eb2);});}else{utils[_0x3160('0xc1')](this[_0x3160('0x1e')][this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]]['queue']],_0x3160('0xfb'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x3160('0x24')][_0x58f313['actionid']][_0x3160('0xfc')],'ListId':this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xdf')],'VoiceQueueId':this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xe0')]||undefined,'CampaignId':this[_0x3160('0x24')][_0x58f313['actionid']]['CampaignId']||undefined})['catch'](loggerCatch(_0x3160('0xfd')));delete this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]];unlockQueueStatus(_0x440eb2);}}else if(_0x369d82===_0x3160('0xf2')){var _0x4c5f9e;if(this['actions'][_0x58f313[_0x3160('0xf0')]]&&!_[_0x3160('0x4d')](this['queueBooked'][this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xbe')]])){if(this[_0x3160('0x2c')][_0x3a813e[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]]['queue']]){this[_0x3160('0x2c')][_0x3a813e[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xbe')]]=this[_0x3160('0x2c')][this['actions'][_0x58f313[_0x3160('0xf0')]][_0x3160('0xbe')]]?this[_0x3160('0x2c')][this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xbe')]]:this['queueBooked'][this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xbe')]]?this[_0x3160('0x2b')][this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]][_0x3160('0xbe')]][_0x3160('0xfe')]||0x0:0x0;}this[_0x3160('0x2b')][this[_0x3160('0x24')][_0x58f313[_0x3160('0xf0')]]['queue']][_0x3160('0xfe')]=this[_0x3160('0x2c')][this[_0x3160('0x24')][_0x58f313['actionid']]['queue']];for(var _0x115fdc=0x0;_0x115fdc=_0x55c19e['dialGlobalMaxRetry']){_0x559e6d[_0x3160('0x129')](_0x19f720,_0x511e19,_0x19eff7,_0x3160('0x12a'));}else{if(_0x19f720['countmachineretry']>=_0x55c19e['dialMachineMaxRetry']){_0x559e6d[_0x3160('0x12b')](_0x19f720,_0x511e19,_0x19eff7,_0x3160('0x12c'));}else{hopperUtils[_0x3160('0x106')]({'active':![],'countmachineretry':_0x19f720['countmachineretry'],'scheduledat':moment()[_0x3160('0xdc')](_0x55c19e[_0x3160('0x12d')],_0x3160('0xde'))[_0x3160('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19f720[_0x3160('0xfc')],'ListId':_0x19f720['ListId'],'VoiceQueueId':_0x19f720[_0x3160('0xe0')]||undefined,'CampaignId':_0x19f720[_0x3160('0xe1')]||undefined})[_0x3160('0xa1')](loggerCatch(_0x3160('0x12e')));_0x511e19({'reschedule':0x1});}}});}if(_0x5365a9[_0x3160('0x44')]===_0x3160('0xc0')&&this[_0x3160('0x1f')][_0x5365a9[_0x3160('0xbe')]][_0x3160('0x113')]&&_0x410e55[_0x3160('0x114')]===_0x3160('0x115')){delete this[_0x3160('0x26')][_0x410e55[_0x3160('0xbf')]];utils['decrementOriginate'](this[_0x3160('0x1f')][_0x5365a9['queue']],_0x3160('0x116'));_0x4be23f=new Hangup(_0x5365a9,_0x410e55);_0x4be23f[_0x3160('0x70')]=0x12;_0x4be23f[_0x3160('0xd3')]=_0x3160('0x12f');_0x4be23f['membername']=_0x3160('0x11a');ami['emit'](_0x3160('0x123'),ut['buildObj'](_0x4be23f,'amd'));this[_0x3160('0x11e')](_0x4be23f,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x5365a9[_0x3160('0x44')]===_0x3160('0xc0')&&this['campaigns'][_0x5365a9['queue']][_0x3160('0x113')]&&_0x410e55[_0x3160('0x114')]===_0x3160('0x120')){return new Promise(function(_0x28a326,_0x4123cd){delete _0x559e6d[_0x3160('0x26')][_0x410e55['uniqueid']];utils[_0x3160('0xc1')](_0x559e6d['campaigns'][_0x5365a9[_0x3160('0xbe')]],_0x3160('0x116'));_0x559e6d['campaigns'][_0x5365a9[_0x3160('0xbe')]][_0x3160('0x117')]+=0x1;_0x559e6d[_0x3160('0x1f')][_0x5365a9[_0x3160('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3b79b3=_0x559e6d['campaigns'][_0x5365a9['queue']];var _0x41aa50=new Hangup(_0x5365a9,_0x410e55);_0x41aa50[_0x3160('0x70')]=0x13;_0x41aa50[_0x3160('0xd3')]=_0x3160('0x121');_0x41aa50[_0x3160('0x119')]=_0x3160('0x11a');_0x41aa50['countmachineretry']+=0x1;_0x41aa50[_0x3160('0xd6')]+=0x1;_0x41aa50['amd']=!![];ami['emit'](_0x3160('0x123'),ut['buildObj'](_0x41aa50,_0x3160('0x11d')));hopperUtils[_0x3160('0xca')](_0x41aa50)[_0x3160('0xa1')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x41aa50['countbusyretry']+_0x41aa50[_0x3160('0x125')]+_0x41aa50[_0x3160('0x126')]+_0x41aa50[_0x3160('0x127')]+_0x41aa50[_0x3160('0xd5')]+_0x41aa50[_0x3160('0xec')]+_0x41aa50['countmachineretry']+_0x41aa50[_0x3160('0x128')]>=_0x3b79b3[_0x3160('0x130')]){_0x559e6d[_0x3160('0x129')](_0x41aa50,_0x28a326,_0x4123cd,_0x3160('0x12a'));}else{if(_0x41aa50[_0x3160('0x122')]>=_0x3b79b3[_0x3160('0x131')]){_0x559e6d['createStateFinal'](_0x41aa50,_0x28a326,_0x4123cd,'reason\x2019\x20machine....');}else{hopperUtils[_0x3160('0x106')]({'active':![],'countmachineretry':_0x41aa50[_0x3160('0x122')],'scheduledat':moment()[_0x3160('0xdc')](_0x3b79b3['dialMachineRetryFrequency'],_0x3160('0xde'))['format'](_0x3160('0xc4')),'ContactId':_0x41aa50[_0x3160('0xfc')],'ListId':_0x41aa50[_0x3160('0xdf')],'VoiceQueueId':_0x41aa50[_0x3160('0xe0')]||undefined,'CampaignId':_0x41aa50[_0x3160('0xe1')]||undefined})[_0x3160('0xa1')](loggerCatch(_0x3160('0x12e')));_0x28a326({'reschedule':0x1});}}});}}};Dialer[_0x3160('0x19')][_0x3160('0x38')]=function(_0x4924ef){var _0x33618c=this[_0x3160('0x26')][_0x4924ef[_0x3160('0xbf')]];var _0x4ef816;if(!_0x33618c){return;}if(_0x33618c[_0x3160('0x44')]===_0x3160('0xc0')){delete this[_0x3160('0x26')][_0x4924ef['uniqueid']];utils[_0x3160('0xc1')](this[_0x3160('0x1f')][_0x33618c[_0x3160('0xbe')]],'[syncHangup]');this['campaigns'][_0x33618c[_0x3160('0xbe')]][_0x3160('0x132')]+=0x1;if(_0x4924ef[_0x3160('0x133')]===_0x3160('0x134')){const _0x77d4a7=new AgentComplete(_0x33618c,_0x4924ef);_0x77d4a7['CampaignId']=this[_0x3160('0x1f')][_0x33618c[_0x3160('0xbe')]]['id'];hopperUtils['createHistory'](_0x77d4a7)['catch'](loggerCatch(_0x3160('0x135')));hopperUtils[_0x3160('0xcc')](_0x77d4a7)['catch'](loggerCatch('[syncAgentCompleteIvr]'));}else{_0x4ef816=new Hangup(_0x33618c,_0x4924ef);hopperUtils[_0x3160('0xca')](_0x4ef816)[_0x3160('0xa1')](loggerCatch(_0x3160('0x136')));hopperUtils['moveContactManagedDialer'](_0x4ef816)[_0x3160('0xa1')](loggerCatch(_0x3160('0x137')));}}else{if(isNotNull(this[_0x3160('0x1e')][_0x33618c[_0x3160('0xbe')]][_0x3160('0x138')])){delete this['uniqueId'][_0x4924ef[_0x3160('0xbf')]];utils[_0x3160('0xc1')](this[_0x3160('0x1e')][_0x33618c[_0x3160('0xbe')]],_0x3160('0x139'));this[_0x3160('0x1e')][_0x33618c[_0x3160('0xbe')]][_0x3160('0x117')]+=0x1;this['voiceQueues'][_0x33618c['queue']][_0x3160('0x118')]+=0x1;_0x4ef816=new Hangup(_0x33618c,_0x4924ef);_0x4ef816[_0x3160('0x70')]=0x10;_0x4ef816[_0x3160('0xd3')]=_0x3160('0x13a');_0x4ef816['membername']='AGI';hopperUtils['createHistory'](_0x4ef816)[_0x3160('0xa1')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x3160('0xcc')](_0x4ef816)[_0x3160('0xa1')](loggerCatch('[syncHangupIvr]'));}else{delete this['uniqueId'][_0x4924ef[_0x3160('0xbf')]];utils[_0x3160('0xc1')](this[_0x3160('0x1e')][_0x33618c['queue']],_0x3160('0x13b'));if(_0x4924ef[_0x3160('0x133')]===_0x3160('0x134')){this['voiceQueues'][_0x33618c[_0x3160('0xbe')]][_0x3160('0x117')]+=0x1;const _0x50bbf3=new AgentComplete(_0x33618c,_0x4924ef);_0x50bbf3[_0x3160('0xe0')]=this[_0x3160('0x1e')][_0x33618c[_0x3160('0xbe')]]['id'];hopperUtils[_0x3160('0xca')](_0x50bbf3)[_0x3160('0xa1')](loggerCatch(_0x3160('0xcb')));hopperUtils[_0x3160('0xcc')](_0x50bbf3)[_0x3160('0xa1')](loggerCatch(_0x3160('0x13c')));}else{this['voiceQueues'][_0x33618c[_0x3160('0xbe')]][_0x3160('0x13d')]+=0x1;_0x4ef816=new Hangup(_0x33618c,_0x4924ef);_0x4ef816[_0x3160('0x70')]=0xc;_0x4ef816['statedesc']=_0x4924ef[_0x3160('0x133')];_0x4ef816['membername']=_0x3160('0x13e');hopperUtils[_0x3160('0xca')](_0x4ef816)[_0x3160('0xa1')](loggerCatch('[syncHangup][createHistory]'));hopperUtils[_0x3160('0xcc')](_0x4ef816)[_0x3160('0xa1')](loggerCatch('[syncHangup]'));}}}};Dialer[_0x3160('0x19')][_0x3160('0xb')]=function(_0x56578b){var _0xd3ed56=this;if(!_0xd3ed56[_0x3160('0x2d')][_0x56578b['name']]){_0xd3ed56['queuesSummary'][_0x56578b['name']]={'running':![]};}else if(_0xd3ed56[_0x3160('0x2d')][_0x56578b[_0x3160('0x4b')]][_0x3160('0x13f')]===!![]){return;}else if(_0xd3ed56[_0x3160('0x2d')][_0x56578b[_0x3160('0x4b')]][_0x3160('0x13f')]===![]){_0xd3ed56['queuesSummary'][_0x56578b[_0x3160('0x4b')]][_0x3160('0x13f')]=!![];}var _0xee335d=_0xd3ed56['voiceQueues'][_0x56578b[_0x3160('0x4b')]];var _0x3b9936=_0xee335d[_0x3160('0x6a')]!==utils[_0x3160('0x6b')]['INACTIVE'];var _0x48b311=utils[_0x3160('0x140')](_0xee335d);_0xee335d['statusMessage']=utils['getQueueCampaignStatusMessage'](_0xee335d,_0xd3ed56[_0x3160('0x21')]);Promise[_0x3160('0x141')]()[_0x3160('0x9d')](function(){if(_0xee335d[_0x3160('0x142')]===utils['CAMPAIGN_STATUS'][_0x3160('0x7a')]){if(_0x3b9936){clearPredictiveAttributes(_0xee335d);_0x56578b[_0x3160('0x28')]=undefined;_0x56578b[_0x3160('0x29')]=undefined;}if(_0xee335d[_0x3160('0x142')]===utils[_0x3160('0x6b')]['INACTIVE']){_0x56578b['available']=0x0;_0x56578b[_0x3160('0xf5')]=0x0;_0x56578b[_0x3160('0x143')]=0x0;_0x56578b[_0x3160('0x144')]=0x0;_0x56578b[_0x3160('0x145')]=0x0;}}else if(_0xee335d['statusMessage']===utils[_0x3160('0x6b')][_0x3160('0x146')]&&!_0x48b311){return _0xd3ed56[_0x3160('0x91')](_0xee335d,!![])[_0x3160('0x9d')](function(){return _0xd3ed56['ifTime'](_0xee335d,![]);})[_0x3160('0x9d')](function(){return _0xd3ed56[_0x3160('0x147')](_0xee335d);})[_0x3160('0xa1')](function(_0x49c6dd){loggerSyncQueueSummary[_0x3160('0x46')](_0x3160('0x148'),util[_0x3160('0x48')](_0x49c6dd,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xee335d);});}else{clearPredictiveAttributes(_0xee335d);}})[_0x3160('0x9d')](function(){var _0x592488=_0x56578b['compareToOutboundQueue'](_0xee335d);if(_0x592488||_0xee335d['queueSummaryCountersUpdated']){_0xee335d['queueSummaryCountersUpdated']=![];_0x56578b[_0x3160('0x149')](_0xee335d);Object['assign'](_0xee335d,_0x56578b);emitOutboundVoiceQueueSummary(_0x56578b);}_0xd3ed56[_0x3160('0x2d')][_0xee335d[_0x3160('0x4b')]][_0x3160('0x13f')]=![];})[_0x3160('0xa1')](function(_0x34e581){logger[_0x3160('0x68')](_0x3160('0x148'),util[_0x3160('0x48')](_0x34e581,{'showHidden':![],'depth':null}));_0xd3ed56['queuesSummary'][_0xee335d[_0x3160('0x4b')]][_0x3160('0x13f')]=![];});};Dialer['prototype'][_0x3160('0x37')]=_[_0x3160('0x14a')](function(){var _0x1ace42=_[_0x3160('0x14b')](this[_0x3160('0x1e')],function(_0x37daa2){return _0x37daa2['dialPreviewRecallmeReminder'];});var _0x22b323=_['filter'](this['agents'],function(_0xe8975e){return _0xe8975e['online']&&_0xe8975e[_0x3160('0x88')]===_0x3160('0x89');});if(_0x1ace42[_0x3160('0xff')]>0x0&&_0x22b323['length']>0x0){return Promise[_0x3160('0x141')]()['then'](cmHopper['handlePreviewRecallNotifications'](_[_0x3160('0x14c')](_0x1ace42,'id'),previewRecallmeReminderInterval,_[_0x3160('0x14c')](_0x22b323,'id')))[_0x3160('0x9d')](function(_0xaf4267){for(var _0x4c782e=0x0;_0x4c782e<_0xaf4267['length'];_0x4c782e++){var _0x28bbea=_0xaf4267[_0x4c782e][_0x3160('0x14d')][_0x3160('0x4b')];if(_0x28bbea)io['to'](util['format']('user:%s',_0x28bbea))[_0x3160('0x11b')](_0x3160('0x14e'),{'hopper':_0xaf4267[_0x4c782e]});}})[_0x3160('0xa1')](function(_0xa714d){logger[_0x3160('0x68')](_0x3160('0x14f'),_0xa714d);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3160('0x19')][_0x3160('0x40')]=function(){var _0x4f6a02=this;setInterval(function(){_0x4f6a02[_0x3160('0x150')](_0x4f6a02[_0x3160('0x26')],'[uniqueid]');_0x4f6a02['clearZombieChannels'](_0x4f6a02[_0x3160('0x24')],'[actions]');},0x32c8);};Dialer[_0x3160('0x19')][_0x3160('0x150')]=function(_0x1103f1,_0x5c6123){var _0x4b0481=this;for(var _0x3a8fd7 in _0x1103f1){if(typeof _0x1103f1[_0x3a8fd7]!==_0x3160('0xaa')){this['sequence']['enqueue'](function(){if(!_[_0x3160('0xf3')](_0x1103f1[_0x3a8fd7])){return ami[_0x3160('0x99')]({'action':_0x3160('0x88'),'channel':_0x1103f1[_0x3a8fd7][_0x3160('0xef')]})[_0x3160('0xa1')](function(_0xa585e3){if(_0xa585e3['message']===_0x3160('0x151')){setTimeout(function(){if(_0x1103f1[_0x3a8fd7]&&_0x1103f1[_0x3a8fd7][_0x3160('0x44')]!==_0x3160('0xc0')){utils[_0x3160('0xc1')](_0x4b0481['voiceQueues'][_0x1103f1[_0x3a8fd7]['queue']],_0x3160('0x152'));logger[_0x3160('0x68')](_0x3160('0x153'),_0x5c6123,_0x3a8fd7,_0x1103f1[_0x3a8fd7][_0x3160('0xbe')]);delete _0x1103f1[_0x3a8fd7];}if(_0x1103f1[_0x3a8fd7]&&_0x1103f1[_0x3a8fd7][_0x3160('0x44')]===_0x3160('0xc0')){utils[_0x3160('0xc1')](_0x4b0481[_0x3160('0x1f')][_0x1103f1[_0x3a8fd7]['queue']],_0x3160('0x152'));logger[_0x3160('0x68')](_0x3160('0x154'),_0x5c6123,_0x3a8fd7,_0x1103f1[_0x3a8fd7][_0x3160('0xbe')]);delete _0x1103f1[_0x3a8fd7];}},0x2328);}});}});}}};Dialer[_0x3160('0x19')]['getVoiceQueueRtPauses']=function(_0x513b64){return Promise[_0x3160('0x141')]()[_0x3160('0x9d')](voiceQueueRt['getVoiceQueueRtPauses'](_0x513b64))[_0x3160('0xa1')](loggerCatch(_0x3160('0x155')));};Dialer[_0x3160('0x19')][_0x3160('0x156')]=function(_0x284ea1,_0x1ea89c,_0x5a42d2){var _0x5dc752={'state':0x19,'statedesc':'notFound'};utils[_0x3160('0xc1')](_0x1ea89c,_0x3160('0x157')+_0x284ea1);this['saveInDb'](_[_0x3160('0x64')](_0x5dc752,_['pick'](_0x5a42d2,[_0x3160('0xfc'),_0x3160('0xdf'),'UserId',_0x3160('0xe0'),_0x3160('0xe1')])),_0x3160('0x158'),_0x3160('0x157'));logger[_0x3160('0x68')](_0x284ea1);};Dialer[_0x3160('0x19')][_0x3160('0x11e')]=function(_0x131082,_0x1beb7a,_0x14b40b){hopperUtils['createHistory'](_0x131082)[_0x3160('0xa1')](loggerCatch(_0x1beb7a));hopperUtils[_0x3160('0xcc')](_0x131082)[_0x3160('0xa1')](loggerCatch(_0x14b40b));};Dialer['prototype'][_0x3160('0xdb')]=function(_0x4ef41b,_0x275e23){hopperUtils[_0x3160('0xca')](_0x4ef41b)[_0x3160('0xa1')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x275e23==0x0){hopperUtils[_0x3160('0xcc')](_0x4ef41b)[_0x3160('0xa1')](loggerCatch(_0x3160('0x159')));}};Dialer['prototype'][_0x3160('0x14f')]=function(_0x5a4ef5){return Promise[_0x3160('0x141')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x5a4ef5['id'],previewRecallmeReminderInterval))[_0x3160('0x9d')](function(_0x1589e4){for(var _0x1743e3=0x0;_0x1743e3<_0x1589e4[_0x3160('0xff')];_0x1743e3++){var _0x2f6ae1=_0x1589e4[_0x1743e3]['Agent'][_0x3160('0x4b')];if(_0x2f6ae1)io['to'](util[_0x3160('0x49')]('user:%s',_0x2f6ae1))[_0x3160('0x11b')](_0x3160('0x14e'),{'hopper':_0x1589e4[_0x1743e3]});}})[_0x3160('0xa1')](function(){});};Dialer[_0x3160('0x19')][_0x3160('0xaf')]=function(_0x26f3a3){var _0x12043e=this;return function(){_0x12043e[_0x3160('0x15a')](_0x26f3a3);};};Dialer[_0x3160('0x19')][_0x3160('0x15b')]=function(_0x2504db,_0x2625a3){var _0x5beee9=this;var _0x5b9882=uuid['v4']();this[_0x3160('0x24')][_0x5b9882]=new Action(_0x2504db,_0x2625a3,_0x5b9882);return new Promise(function(_0x391690,_0x267336){if(_[_0x3160('0x43')](_0x2504db)&&typeof _0x2504db!=='object'){return _0x267336(msgResponse(_0x3160('0x15c'),_0x3160('0x92'),_0x3160('0x15d')));}if(_[_0x3160('0x43')](_0x2625a3[_0x3160('0x15e')])||_0x2625a3[_0x3160('0x15e')]===null){return _0x267336(msgResponse(_0x3160('0x15c'),'Failure',_0x3160('0x15f')));}var _0x5cebb3={'XMD-CALLERID':_0x5beee9[_0x3160('0x24')][_0x5b9882]['getCaller'](),'XMD-AGI':_0x2504db[_0x3160('0x138')]?util['format'](_0x3160('0x160'),ipAgi,_0x2504db[_0x3160('0x138')]):_0x3160('0x161'),'XMD-AGIAFTER':_0x2504db[_0x3160('0xc8')]?util[_0x3160('0x49')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2504db[_0x3160('0xc8')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x2504db)?util[_0x3160('0x49')](_0x3160('0x162'),_0x2504db[_0x3160('0x4b')],_0x2504db[_0x3160('0x163')]||'',_0x2504db[_0x3160('0xc9')]?'c':'',_0x2504db[_0x3160('0xcf')]||0x3):_0x3160('0x161'),'XMD-CONTACTID':_0x2625a3[_0x3160('0xfc')],'XMD-CDRTYPE':_0x3160('0x6'),'CALLERID(all)':_0x5beee9[_0x3160('0x24')][_0x5b9882][_0x3160('0x164')](),'XMD-AMD':_0x2504db[_0x3160('0x113')]?_0x3160('0x146'):_0x3160('0x161'),'XMD-DESTINATION':_0x3160('0x165')};if(_0x2504db['dialAMDActive']){_0x5cebb3[_0x3160('0x166')]=_0x2504db[_0x3160('0x167')]||0x9c4;_0x5cebb3[_0x3160('0x168')]=_0x2504db[_0x3160('0x169')]||0x5dc;_0x5cebb3['XMD-AMDAFTERGREETINGSILENCE']=_0x2504db['dialAMDAfterGreetingSilence']||0x320;_0x5cebb3[_0x3160('0x16a')]=_0x2504db[_0x3160('0x16b')]||0x1388;_0x5cebb3[_0x3160('0x16c')]=_0x2504db[_0x3160('0x16d')]||0x64;_0x5cebb3[_0x3160('0x16e')]=_0x2504db[_0x3160('0x16f')]||0x32;_0x5cebb3[_0x3160('0x170')]=_0x2504db[_0x3160('0x171')]||0x3;_0x5cebb3['XMD-AMDSILENCETHRESHOLD']=_0x2504db[_0x3160('0x172')]||0x100;_0x5cebb3['XMD-AMDMAXIMUMWORDLENGTH']=_0x2504db[_0x3160('0x173')]||0x1388;}if(utils[_0x3160('0x174')](_0x2504db)){_0x5cebb3['XMD-VOICEQUEUEID']=_0x2625a3[_0x3160('0xe0')];}else{_0x5cebb3[_0x3160('0x175')]=_0x2625a3[_0x3160('0xe1')];}var _0x1d6834=utils[_0x3160('0x176')](_0x2625a3[_0x3160('0x177')]);Object[_0x3160('0x178')](_0x5cebb3,_0x1d6834);var _0x23d877=_0x5beee9[_0x3160('0x85')](_0x2504db['Trunk'])?utils[_0x3160('0x179')](_0x2504db[_0x3160('0x17a')][_0x3160('0x17b')],_0x2504db[_0x3160('0x17c')],_0x2504db['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x3160('0x17d')](_0x2504db[_0x3160('0x17e')],_0x2504db[_0x3160('0x17f')]):_0x2504db[_0x3160('0x17e')]):utils['getCallerId'](_[_0x3160('0xf3')](_0x2504db[_0x3160('0x8b')])?_0x2504db['Trunk'][_0x3160('0x17b')]:_0x2504db[_0x3160('0x8b')]['callerid'],_0x2504db[_0x3160('0x17c')],_0x2504db[_0x3160('0x17f')]>0x0?utils[_0x3160('0x17d')](_0x2504db[_0x3160('0x17e')],_0x2504db[_0x3160('0x17f')]):_0x2504db[_0x3160('0x17e')]);if(_0x23d877){_0x5cebb3[_0x3160('0x180')]=_0x5beee9['actions'][_0x5b9882][_0x3160('0x181')]=utils['extractCalleridName'](_0x23d877);_0x5cebb3['XMD-ORIGINATECALLERIDNUM']=_0x2625a3[_0x3160('0x15e')];}_0x2504db[_0x3160('0x182')]=_0x5cebb3;return ami['Action']({'actionid':_0x5b9882,'action':'originate','channel':_0x5beee9[_0x3160('0x85')](_0x2504db[_0x3160('0x17a')])?util[_0x3160('0x49')]('SIP/%s/%s%s',_0x2504db[_0x3160('0x17a')][_0x3160('0x4b')],isNotNull(_0x2504db[_0x3160('0x183')])?_0x2504db[_0x3160('0x183')]['trim']()||'':'',_0x2504db[_0x3160('0x184')]>0x0?_0x2625a3['phone'][_0x3160('0x185')](_0x2504db['dialCutDigit']):_0x2625a3[_0x3160('0x15e')]):util[_0x3160('0x49')](_0x3160('0x186'),_[_0x3160('0xf3')](_0x2504db[_0x3160('0x8b')])?_0x2504db[_0x3160('0x17a')][_0x3160('0x4b')]:_0x2504db[_0x3160('0x8b')][_0x3160('0x4b')],isNotNull(_0x2504db[_0x3160('0x183')])?_0x2504db[_0x3160('0x183')][_0x3160('0x187')]()||'':'',_0x2504db[_0x3160('0x184')]>0x0?_0x2625a3[_0x3160('0x15e')][_0x3160('0x185')](_0x2504db[_0x3160('0x184')]):_0x2625a3[_0x3160('0x15e')]),'callerid':_0x23d877,'Exten':_0x3160('0x165'),'Context':'from-sip','Priority':'1','variable':_0x5cebb3,'timeout':(_0x2504db[_0x3160('0x188')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5b9882})[_0x3160('0x9d')](function(_0x4098b6){return _0x391690(_0x4098b6);})[_0x3160('0xa1')](function(_0x3a78f0){_0x2504db[_0x3160('0x189')]+=0x1;var _0x4db7ec=new History(_0x5beee9[_0x3160('0x24')][_0x5b9882]);logger[_0x3160('0x68')](util[_0x3160('0x49')](_0x3160('0x18a'),JSON['stringify'](_0x3a78f0)));_0x4db7ec[_0x3160('0x70')]=0xe;_0x4db7ec['statedesc']='OriginateError';_0x4db7ec[_0x3160('0x72')]=moment()[_0x3160('0x49')](_0x3160('0xc4'));_0x4db7ec[_0x3160('0x71')]=_0x4db7ec[_0x3160('0x72')];hopperUtils[_0x3160('0xca')](_0x4db7ec)[_0x3160('0xa1')](loggerCatch(_0x3160('0x18b')));_0x5beee9['moveContactManagedDialer'](_0x4db7ec)['catch'](loggerCatch(_0x3160('0x18b')))[_0x3160('0xfa')](function(){delete _0x5beee9[_0x3160('0x24')][_0x5b9882];return _0x267336(msgResponse('originate',_0x3160('0x84'),_0x3160('0x18c')));});});});};Dialer[_0x3160('0x19')][_0x3160('0x18d')]=function(_0xa07018,_0x59854c,_0x2ec843){var _0x862613=new History(_0x59854c);if(_0x862613[_0x3160('0x18e')]+_0x862613['countcongestionretry']+_0x862613[_0x3160('0x126')]+_0x862613[_0x3160('0x127')]+_0x862613['countdropretry']+_0x862613['countabandonedretry']+_0x862613[_0x3160('0x122')]+_0x862613[_0x3160('0x128')]>=_0x2ec843[_0x3160('0x130')]-0x1){return!![];}switch(_0xa07018){case 0x3:if(_0x862613[_0x3160('0x126')]>=_0x2ec843['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x3160('0x106')]({'active':![],'countnoanswerretry':_0x862613[_0x3160('0x126')]+=0x1,'scheduledat':moment()[_0x3160('0xdc')](_0x2ec843[_0x3160('0x18f')],_0x3160('0xde'))['format'](_0x3160('0xc4')),'ContactId':_0x862613[_0x3160('0xfc')],'ListId':_0x862613[_0x3160('0xdf')],'VoiceQueueId':_0x862613[_0x3160('0xe0')]||undefined,'CampaignId':_0x862613[_0x3160('0xe1')]||undefined})[_0x3160('0xa1')](loggerCatch(_0x3160('0x190')));break;case 0x5:if(_0x862613[_0x3160('0x18e')]>=_0x2ec843[_0x3160('0x191')]-0x1){return!![];}hopperUtils[_0x3160('0x106')]({'active':![],'countbusyretry':_0x862613[_0x3160('0x18e')]+=0x1,'scheduledat':moment()[_0x3160('0xdc')](_0x2ec843[_0x3160('0x192')],_0x3160('0xde'))[_0x3160('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x862613['ContactId'],'ListId':_0x862613[_0x3160('0xdf')],'VoiceQueueId':_0x862613[_0x3160('0xe0')]||undefined,'CampaignId':_0x862613[_0x3160('0xe1')]||undefined})[_0x3160('0xa1')](loggerCatch(_0x3160('0x193')));break;case 0x8:if(_0x862613[_0x3160('0x125')]>=_0x2ec843['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x3160('0x106')]({'active':![],'countcongestionretry':_0x862613[_0x3160('0x125')]+=0x1,'scheduledat':moment()[_0x3160('0xdc')](_0x2ec843[_0x3160('0x194')],_0x3160('0xde'))[_0x3160('0x49')](_0x3160('0xc4')),'ContactId':_0x862613[_0x3160('0xfc')],'ListId':_0x862613[_0x3160('0xdf')],'VoiceQueueId':_0x862613[_0x3160('0xe0')]||undefined,'CampaignId':_0x862613[_0x3160('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x862613[_0x3160('0x127')]>=_0x2ec843[_0x3160('0x195')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x862613[_0x3160('0x127')]+=0x1,'scheduledat':moment()[_0x3160('0xdc')](_0x2ec843[_0x3160('0x196')],_0x3160('0xde'))['format'](_0x3160('0xc4')),'ContactId':_0x862613[_0x3160('0xfc')],'ListId':_0x862613[_0x3160('0xdf')],'VoiceQueueId':_0x862613[_0x3160('0xe0')]||undefined,'CampaignId':_0x862613['CampaignId']||undefined})[_0x3160('0xa1')](loggerCatch(_0x3160('0x197')));}break;case 0xa:if(_0x862613[_0x3160('0xd5')]>=_0x2ec843[_0x3160('0xda')]-0x1){return!![];}hopperUtils[_0x3160('0x106')]({'active':![],'countdropretry':_0x862613[_0x3160('0xd5')]+=0x1,'scheduledat':moment()[_0x3160('0xdc')](_0x2ec843[_0x3160('0xdd')],_0x3160('0xde'))[_0x3160('0x49')](_0x3160('0xc4')),'ContactId':_0x862613[_0x3160('0xfc')],'ListId':_0x862613[_0x3160('0xdf')],'VoiceQueueId':_0x862613[_0x3160('0xe0')]||undefined,'CampaignId':_0x862613['CampaignId']||undefined})[_0x3160('0xa1')](loggerCatch(_0x3160('0xe2')));break;case 0xb:if(_0x862613[_0x3160('0xec')]>=_0x2ec843[_0x3160('0xea')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x862613[_0x3160('0xec')]+=0x1,'scheduledat':moment()[_0x3160('0xdc')](_0x2ec843[_0x3160('0xe9')],_0x3160('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x862613[_0x3160('0xfc')],'ListId':_0x862613[_0x3160('0xdf')],'VoiceQueueId':_0x862613['VoiceQueueId']||undefined,'CampaignId':_0x862613['CampaignId']||undefined})[_0x3160('0xa1')](loggerCatch(_0x3160('0xed')));break;case 0x13:if(_0x862613[_0x3160('0x122')]>=_0x2ec843[_0x3160('0x131')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x862613[_0x3160('0x122')]+=0x1,'scheduledat':moment()[_0x3160('0xdc')](_0x2ec843[_0x3160('0x12d')],_0x3160('0xde'))[_0x3160('0x49')](_0x3160('0xc4')),'ContactId':_0x862613[_0x3160('0xfc')],'ListId':_0x862613[_0x3160('0xdf')],'VoiceQueueId':_0x862613[_0x3160('0xe0')]||undefined,'CampaignId':_0x862613[_0x3160('0xe1')]||undefined})[_0x3160('0xa1')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x862613[_0x3160('0x128')]>=_0x2ec843[_0x3160('0x198')]-0x1){return!![];}hopperUtils[_0x3160('0x106')]({'active':![],'countagentrejectretry':_0x862613[_0x3160('0x128')]+=0x1,'scheduledat':moment()[_0x3160('0xdc')](_0x2ec843[_0x3160('0x199')],_0x3160('0xde'))[_0x3160('0x49')](_0x3160('0xc4')),'ContactId':_0x862613[_0x3160('0xfc')],'ListId':_0x862613[_0x3160('0xdf')],'VoiceQueueId':_0x862613[_0x3160('0xe0')]||undefined,'CampaignId':_0x862613['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x3160('0x19')][_0x3160('0x10e')]=function(_0x4af5f4,_0x3c1706,_0x4370d9){var _0x122d60=this;var _0x4b0505=new History(_0x4af5f4);var _0x49f569=![];var _0x1956ee;var _0x3c479e;return new Promise(function(_0x3c2143,_0x24442c){if(_[_0x3160('0x43')](_0x3c1706)&&typeof _0x3c1706!==_0x3160('0x19a')){return _0x24442c(msgResponse(_0x3160('0x19b'),'Failure','entity\x20is\x20undefine'));}if(_[_0x3160('0x43')](_0x4370d9)&&typeof _0x4370d9!=='object'){return _0x24442c(msgResponse(_0x3160('0x19b'),_0x3160('0x92'),_0x3160('0x19c')));}hopperUtils[_0x3160('0xd8')](_0x4b0505,_0x4370d9['reason'],_0x3c1706)['then'](function(_0xd92e2e){if(_0xd92e2e[_0x3160('0xeb')]==0x1)_0x49f569=!![];switch(_0x4370d9[_0x3160('0xc5')]){case'0':_0x3c1706[_0x3160('0x19d')]+=0x1;_0x4b0505[_0x3160('0x70')]=0x0;_0x4b0505[_0x3160('0xd3')]=_0x3160('0x19e');_0x4b0505[_0x3160('0x127')]+=0x1;_0x4b0505['countglobal']+=0x1;ami[_0x3160('0x11b')](_0x3160('0x19f'),ut[_0x3160('0x11c')](_0x4af5f4,_0x3160('0x1a0')));_0x1956ee=_0x3c1706['dialNoSuchNumberRetryFrequency'];_0x3c479e=_0x3c1706[_0x3160('0xd7')];hopperUtils[_0x3160('0xca')](_0x4b0505)[_0x3160('0xa1')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x122d60[_0x3160('0x18d')](0x0,_0x4af5f4,_0x3c1706)&&!_0x49f569){if(_0x4b0505[_0x3160('0x127')]>=_0x3c1706[_0x3160('0x195')]){_0x122d60[_0x3160('0x12b')](_0x4b0505,_0x3c2143,_0x24442c,'reason\x200\x20no\x20such\x20number....');}else{_0x122d60['stateGlobal'](_0x4b0505,_0x3c2143,_0x24442c,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3c1706[_0x3160('0x1a1')]+=0x1;_0x4b0505[_0x3160('0x70')]=0x3;_0x4b0505[_0x3160('0xd3')]=_0x3160('0x1a2');_0x4b0505[_0x3160('0x126')]+=0x1;_0x4b0505[_0x3160('0xd6')]+=0x1;var _0x132a58=ut['buildNoAnswerEventPayload'](_0x4af5f4,_0x3c1706);ami['emit'](_0x3160('0x1a3'),_0x132a58);_0x1956ee=_0x3c1706[_0x3160('0x18f')];_0x3c479e=_0x3c1706[_0x3160('0xd7')];hopperUtils[_0x3160('0xca')](_0x4b0505)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x122d60[_0x3160('0x18d')](0x3,_0x4af5f4,_0x3c1706)&&!_0x49f569){if(_0x4b0505[_0x3160('0x126')]>=_0x3c1706[_0x3160('0x1a4')]){_0x122d60[_0x3160('0x12b')](_0x4b0505,_0x3c2143,_0x24442c,_0x3160('0x1a5'));}else{_0x122d60[_0x3160('0x129')](_0x4b0505,_0x3c2143,_0x24442c,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3c1706['outboundBusyCallsDay']+=0x1;_0x4b0505[_0x3160('0x70')]=0x5;_0x4b0505[_0x3160('0xd3')]=_0x3160('0x1a6');_0x4b0505['countbusyretry']+=0x1;_0x4b0505['countglobal']+=0x1;ami['emit']('custom:agentbusy',ut['buildObj'](_0x4af5f4,_0x3160('0x1a7')));_0x1956ee=_0x3c1706['dialBusyRetryFrequency'];_0x3c479e=_0x3c1706[_0x3160('0xd7')];hopperUtils['createHistory'](_0x4b0505)[_0x3160('0xa1')](loggerCatch(_0x3160('0x1a8')));if(_0x122d60[_0x3160('0x18d')](0x5,_0x4af5f4,_0x3c1706)&&!_0x49f569){if(_0x4b0505[_0x3160('0x18e')]>=_0x3c1706['dialBusyMaxRetry']){_0x122d60[_0x3160('0x12b')](_0x4b0505,_0x3c2143,_0x24442c,_0x3160('0x1a9'));}else{_0x122d60[_0x3160('0x129')](_0x4b0505,_0x3c2143,_0x24442c,_0x3160('0x1a9'));}}break;case'8':_0x3c1706[_0x3160('0x1aa')]+=0x1;_0x4b0505[_0x3160('0x70')]=0x8;_0x4b0505['statedesc']='Congestion';_0x4b0505[_0x3160('0x125')]+=0x1;_0x4b0505[_0x3160('0xd6')]+=0x1;_0x1956ee=_0x3c1706[_0x3160('0x194')];_0x3c479e=_0x3c1706[_0x3160('0xd7')];ami['emit'](_0x3160('0x1ab'),ut['buildObj'](_0x4af5f4,_0x3160('0x1ac')));hopperUtils[_0x3160('0xca')](_0x4b0505)[_0x3160('0xa1')](loggerCatch(_0x3160('0x1ad')));if(_0x122d60[_0x3160('0x18d')](0x8,_0x4af5f4,_0x3c1706)&&!_0x49f569){if(_0x4b0505[_0x3160('0x125')]>=_0x3c1706[_0x3160('0x1ae')]){_0x122d60[_0x3160('0x12b')](_0x4b0505,_0x3c2143,_0x24442c,'reason\x208\x20congestion');}else{_0x122d60[_0x3160('0x129')](_0x4b0505,_0x3c2143,_0x24442c,_0x3160('0x1af'));}}break;case'11':_0x3c1706[_0x3160('0x1b0')]+=0x1;_0x4b0505[_0x3160('0x70')]=0xb;_0x4b0505['statedesc']='Abandoned';_0x4b0505['countabandonedretry']+=0x1;_0x4b0505[_0x3160('0xd6')]+=0x1;_0x1956ee=_0x3c1706[_0x3160('0xe9')];_0x3c479e=_0x3c1706[_0x3160('0xd7')];hopperUtils['createHistory'](_0x4b0505)[_0x3160('0xa1')](loggerCatch(_0x3160('0x1b1')));if(_0x122d60[_0x3160('0x18d')](0xb,_0x4af5f4,_0x3c1706)&&!_0x49f569){if(_0x4b0505[_0x3160('0xec')]>=_0x3c1706[_0x3160('0xea')]){_0x122d60[_0x3160('0x12b')](_0x4b0505,_0x3c2143,_0x24442c,_0x3160('0x1b2'));}else{_0x122d60[_0x3160('0x129')](_0x4b0505,_0x3c2143,_0x24442c,_0x3160('0x1b2'));}}break;case'20':_0x3c1706['outboundRejectCallsDay']+=0x1;_0x4b0505[_0x3160('0x70')]=0x14;_0x4b0505[_0x3160('0xd3')]=_0x3160('0x1b3');_0x4b0505[_0x3160('0x128')]+=0x1;_0x4b0505[_0x3160('0xd6')]+=0x1;_0x1956ee=_0x3c1706[_0x3160('0x199')];_0x3c479e=_0x3c1706[_0x3160('0xd7')];ami[_0x3160('0x11b')](_0x3160('0x1b4'),ut['buildObj'](_0x4af5f4,_0x3160('0x1b5')));hopperUtils['createHistory'](_0x4b0505)[_0x3160('0xa1')](loggerCatch(_0x3160('0x1b6')));if(_0x122d60[_0x3160('0x18d')](0x14,_0x4af5f4,_0x3c1706)&&!_0x49f569){if(_0x4b0505[_0x3160('0x128')]>=_0x3c1706[_0x3160('0x198')]){_0x122d60[_0x3160('0x12b')](_0x4b0505,_0x3c2143,_0x24442c,'reason\x2020\x20agentreject');}else{_0x122d60[_0x3160('0x129')](_0x4b0505,_0x3c2143,_0x24442c,_0x3160('0x1b7'));}}break;default:_0x3c1706['outboundUnknownCallsDay']+=0x1;_0x4b0505[_0x3160('0x70')]=0xc;_0x4b0505[_0x3160('0xd3')]=_0x4370d9[_0x3160('0xc5')];_0x1956ee=_0x3c1706[_0x3160('0x199')];_0x3c479e=_0x3c1706[_0x3160('0xd7')];hopperUtils[_0x3160('0xca')](_0x4b0505)['catch'](loggerCatch(_0x3160('0x1b8')));if(_0x122d60[_0x3160('0x18d')](_0x4370d9['reason'],_0x4af5f4,_0x3c1706)&&!_0x49f569){if(_0x4b0505[_0x3160('0x18e')]+_0x4b0505[_0x3160('0x125')]+_0x4b0505[_0x3160('0x126')]+_0x4b0505[_0x3160('0x127')]+_0x4b0505[_0x3160('0xd5')]+_0x4b0505[_0x3160('0xec')]+_0x4b0505['countmachineretry']+_0x4b0505[_0x3160('0x128')]>=_0x3c1706['dialGlobalMaxRetry']){_0x122d60[_0x3160('0x129')](_0x4b0505,_0x3c2143,_0x24442c,_0x4370d9[_0x3160('0xc5')]);}else{_0x122d60[_0x3160('0x12b')](_0x4b0505,_0x3c2143,_0x24442c,_0x4370d9[_0x3160('0xc5')]);}}}})[_0x3160('0x9d')](function(){if(_0x49f569){hopperUtils[_0x3160('0xe7')](_0x4b0505,_0x1956ee,_0x3c479e)[_0x3160('0x9d')](function(){return _0x3c2143(0x1);});}});});};Dialer[_0x3160('0x19')][_0x3160('0x129')]=function(_0x4663e9,_0x1fadcb,_0x208c44,_0x573515){var _0x5411c9=new Final(_0x4663e9);_0x5411c9['state']=0xf;_0x5411c9[_0x3160('0xd3')]=_0x3160('0x1b9');this[_0x3160('0x12b')](_0x5411c9,_0x1fadcb,_0x208c44,_0x573515);};Dialer[_0x3160('0x19')]['createStateFinal']=function(_0x320c0a,_0x4c3d18,_0x4f2284,_0x3fec86){hopperUtils[_0x3160('0xcc')](_0x320c0a)[_0x3160('0x9d')](function(){return _0x4c3d18(msgResponse('[callProgressDetecting]','Success',_0x3fec86));})['catch'](function(){return _0x4f2284(msgResponse(_0x3160('0x1ba'),_0x3160('0x92'),'contact\x20not\x20moved'));});};Dialer[_0x3160('0x19')]['predictive']=function(_0x5a32fa){var _0xb2087d=_0x5a32fa[_0x3160('0x1bb')]/0x64;var _0x20779a=_0x5a32fa[_0x3160('0xd1')]/(_0x5a32fa[_0x3160('0xd1')]+_0x5a32fa[_0x3160('0x117')]);var _0x455bc9=Math[_0x3160('0x1bc')](_0x5a32fa[_0x3160('0x1bd')]*(_0x5a32fa[_0x3160('0x1be')]/0x64));var _0x27ed50=Math[_0x3160('0x1bc')](_0x5a32fa[_0x3160('0x1bd')]*(_0x5a32fa[_0x3160('0x1bf')]/0x64));var _0x300b17=_0x5a32fa[_0x3160('0x1c0')]+_0x5a32fa[_0x3160('0x144')];var _0x439a77=Math[_0x3160('0x1c1')](_0x5a32fa[_0x3160('0x1c2')]*_0x5a32fa[_0x3160('0x62')]*_0x5a32fa[_0x3160('0x1c3')]*_0x5a32fa[_0x3160('0x1c4')]);if(_[_0x3160('0x43')](_0x5a32fa[_0x3160('0x29')])){if(!_['isUndefined'](_0x5a32fa[_0x3160('0x28')])){_0x5a32fa['startPredictive']=undefined;loggerPredictive[_0x3160('0x68')](_0x3160('0x1c5'),_0x3160('0x1c6'));}if(!_[_0x3160('0x43')](_0x5a32fa[_0x3160('0x66')])){loggerPredictive[_0x3160('0x68')](_0x3160('0x1c5'),_0x3160('0x1c7'));clearInterval(_0x5a32fa[_0x3160('0x66')]);_0x5a32fa['handlePredictive']=undefined;}_0x5a32fa[_0x3160('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3160('0x4e')](_0x5a32fa[_0x3160('0x4b')],_0x3160('0x1c8'),_0x5a32fa['startProgressive']);this[_0x3160('0xb3')](_0x5a32fa,0x1);}else if(ifInterval(_0x5a32fa['dialPredictiveInterval'],_0x5a32fa[_0x3160('0x29')])){this['handlePower'](_0x5a32fa,0x1);loggerPredictiveCalls[_0x3160('0x4e')](_0x3160('0x1c9'),_0x5a32fa[_0x3160('0x29')],_0x5a32fa['name']);_0x5a32fa[_0x3160('0x1c2')]=0x0;_0x5a32fa[_0x3160('0xd2')]=0x0;}else if(_0xb2087d<_0x20779a&&_0x5a32fa[_0x3160('0x1ca')]==='dropRate'){clearPredictiveAttributes(_0x5a32fa);loggerPredictive[_0x3160('0x4e')](_0x3160('0x1cb'),_0x3160('0x1cc'),_0x20779a,'startProgressive',_0x5a32fa[_0x3160('0x4b')]);}else if(_0x439a77<_0x5a32fa[_0x3160('0xd2')]&&_0x5a32fa[_0x3160('0x1ca')]===_0x3160('0x1cd')){clearPredictiveAttributes(_0x5a32fa);loggerPredictive['info'](_0x3160('0x1ce'),_0x3160('0x1cf'),_0x439a77,'Drop\x20in\x20this\x20interval',_0x5a32fa[_0x3160('0xd2')],'startProgressive',_0x5a32fa[_0x3160('0x4b')]);}else if(!ifInterval(_0x5a32fa['dialPredictiveInterval'],_0x5a32fa[_0x3160('0x29')])&&_[_0x3160('0x43')](_0x5a32fa[_0x3160('0x28')])&&!_[_0x3160('0x43')](_0x5a32fa['startProgressive'])){_0x5a32fa[_0x3160('0x28')]=moment()[_0x3160('0x49')](_0x3160('0xc4'));loggerPredictive[_0x3160('0x4e')](_0x5a32fa[_0x3160('0x4b')],_0x3160('0x1d0'),_0x5a32fa[_0x3160('0x28')]);hopperUtils['avgHandleTime'](_0x5a32fa[_0x3160('0x1d1')])[_0x3160('0x9d')](this[_0x3160('0x1d2')](_0x5a32fa))['then'](mergeDataErlangB(_0x5a32fa))[_0x3160('0x9d')](this[_0x3160('0x1d3')](_0x5a32fa))[_0x3160('0xa1')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5a32fa));}else if(!ifInterval(_0x5a32fa['dialPredictiveInterval'],_0x5a32fa[_0x3160('0x28')])){_0x5a32fa[_0x3160('0xd2')]=0x0;_0x5a32fa[_0x3160('0x28')]=moment()[_0x3160('0x49')](_0x3160('0xc4'));loggerPredictive[_0x3160('0x4e')](_0x5a32fa[_0x3160('0x4b')],_0x3160('0x1d4'),_0x5a32fa[_0x3160('0x28')]);clearInterval(_0x5a32fa[_0x3160('0x66')]);_0x5a32fa[_0x3160('0x66')]=undefined;hopperUtils['avgHandleTime'](_0x5a32fa[_0x3160('0x1d1')])[_0x3160('0x9d')](this['getDataPredictive'](_0x5a32fa))['then'](mergeDataErlangB(_0x5a32fa))['then'](this[_0x3160('0x1d3')](_0x5a32fa))['catch'](loggerCatchPredictive(_0x3160('0x1d5'),_0x5a32fa));}else if(_0x5a32fa[_0x3160('0x1bd')]&&_0x300b17<_0x5a32fa['predictiveIntervalAvailable']-_0x27ed50){clearPredictiveAttributes(_0x5a32fa);loggerPredictive[_0x3160('0x4e')](_0x5a32fa[_0x3160('0x4b')],_0x3160('0x1d6'),_0x300b17,_0x3160('0x1d7'),_0x5a32fa['predictiveIntervalAvailable'],'-',_0x27ed50,'=',_0x5a32fa[_0x3160('0x1bd')]-_0x27ed50,')');}else if(_0x5a32fa[_0x3160('0x1bd')]&&_0x300b17>_0x5a32fa[_0x3160('0x1bd')]+_0x455bc9){clearPredictiveAttributes(_0x5a32fa);loggerPredictive[_0x3160('0x4e')](_0x5a32fa[_0x3160('0x4b')],_0x3160('0x1d6'),_0x300b17,_0x3160('0x1d8'),_0x5a32fa['predictiveIntervalAvailable'],'+',_0x455bc9,'=',_0x5a32fa['predictiveIntervalAvailable']+_0x455bc9,')');}};Dialer[_0x3160('0x19')][_0x3160('0x1d2')]=function(_0x389208){var _0x504854=this;return function(_0x5a86f7){return new Promise(function(_0xee8a4b,_0x505b63){_[_0x3160('0x64')](_0x389208,_0x5a86f7[0x0]);if(checkGetDataPredictive(_0x5a86f7[0x0])){var _0x45d854=_0x389208[_0x3160('0x1bd')]=_0x389208['talking']+_0x389208[_0x3160('0x1c0')];var _0x3618cf=_0x389208[_0x3160('0x1d1')]*0x3c;var _0x34f75c=_0x5a86f7[0x0][_0x3160('0x59')]+_0x5a86f7[0x0][_0x3160('0x57')];var _0x193433=(_0x5a86f7[0x0][_0x3160('0x52')]+_0x5a86f7[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5a86f7[0x0][_0x3160('0x55')])/_0x5a86f7[0x0][_0x3160('0x50')];_0x389208[_0x3160('0x1c3')]=_0x193433>0x0?_0x193433:0x1;switch(_0x389208['dialPredictiveOptimization']){case _0x3160('0x1cd'):var _0x2d06cf=_0x389208[_0x3160('0x1bb')]/0x64;return _0x504854[_0x3160('0x1d9')](_0x45d854,_0x3618cf,_0x34f75c,_0x193433,_0x2d06cf)[_0x3160('0x9d')](function(_0x156736){return _0xee8a4b(_0x156736);});case _0x3160('0x1da'):var _0x2f63a8=_0x389208[_0x3160('0x1bb')]/0x64;return _0x504854[_0x3160('0x1db')](_0x45d854,_0x3618cf,_0x34f75c,_0x193433,_0x2f63a8)['then'](function(_0x5d6f4d){return _0xee8a4b(_0x5d6f4d);});default:return _0x505b63(msgResponse(_0x3160('0x1dc'),_0x3160('0x92'),_0x3160('0x1dd')));}}else{return _0x505b63(msgResponse(_0x3160('0x1dc'),'Failure','check\x20failure'));}});};};Dialer['prototype'][_0x3160('0x1de')]=function(_0x4df399){var _0x23d217=this;return function(_0x51773a){return new Promise(function(_0x19cca0,_0x2bebd4){_[_0x3160('0x64')](_0x4df399,_0x51773a[0x0]);if(checkGetDataPredictive(_0x51773a[0x0])){loggerPredictive[_0x3160('0x4e')](JSON[_0x3160('0xa7')](_0x51773a[0x0]));if(_0x4df399[_0x3160('0x1ca')]==='dropRate'){return _0x23d217['getVoiceQueueRtPauses'](_0x4df399['id'])['then'](function(_0x31d231){var _0xe28259=_0x4df399[_0x3160('0x1df')]-_0x31d231[0x0][_0x3160('0x1e0')];var _0x47f90c=_0x4df399[_0x3160('0x1d1')]*0x3c;var _0x3c9878=_0x51773a[0x0][_0x3160('0x59')]+_0x51773a[0x0][_0x3160('0x57')];var _0x5b3e1e=(_0x51773a[0x0]['predictiveIntervalAnsweredCalls']+_0x51773a[0x0][_0x3160('0xd0')]+_0x51773a[0x0][_0x3160('0x55')])/_0x51773a[0x0][_0x3160('0x50')];var _0x4cb9fd=_0x4df399[_0x3160('0x1bb')]/0x64;_0x4df399[_0x3160('0x1e1')]=_0x31d231[0x0][_0x3160('0x1e0')]||0x0;_0x4df399[_0x3160('0x1c3')]=_0x5b3e1e>0x0?_0x5b3e1e:0x1;return _0x23d217[_0x3160('0x1d9')](_0xe28259,_0x47f90c,_0x3c9878,_0x5b3e1e,_0x4cb9fd);})[_0x3160('0x9d')](function(_0x4ce3c0){return _0x19cca0(_0x4ce3c0);})['catch'](function(_0x52cc7f){return _0x2bebd4(msgResponse(_0x3160('0x1e2'),_0x3160('0x92'),JSON[_0x3160('0xa7')](_0x52cc7f)));});}if(_0x4df399[_0x3160('0x1ca')]===_0x3160('0x1da')){return _0x23d217[_0x3160('0x1e3')](_0x4df399['id'])['then'](function(_0x489363){var _0x41f1d0=_0x4df399[_0x3160('0x1df')]-_0x489363[0x0][_0x3160('0x1e0')];var _0x402279=_0x4df399[_0x3160('0x1d1')]*0x3c;var _0x5a3a81=_0x51773a[0x0]['predictiveIntervalAvgTalktime']+_0x51773a[0x0][_0x3160('0x57')];var _0x47c472=(_0x51773a[0x0]['predictiveIntervalAnsweredCalls']+_0x51773a[0x0][_0x3160('0xd0')]+_0x51773a[0x0][_0x3160('0x55')])/_0x51773a[0x0][_0x3160('0x50')];var _0x4719af=_0x4df399[_0x3160('0x1bb')]/0x64;_0x4df399[_0x3160('0x1e1')]=_0x489363[0x0]['outboundQueuePauses']||0x0;_0x4df399['predictiveIntervalHitRate']=_0x47c472>0x0?_0x47c472:0x1;return _0x23d217[_0x3160('0x1db')](_0x41f1d0,_0x402279,_0x5a3a81,_0x47c472,_0x4719af);})[_0x3160('0x9d')](function(_0x5ee03f){return _0x19cca0(_0x5ee03f);})[_0x3160('0xa1')](function(_0x2efbc8){return _0x2bebd4(msgResponse(_0x3160('0x1e2'),_0x3160('0x92'),JSON[_0x3160('0xa7')](_0x2efbc8)));});}}else{return _0x2bebd4(msgResponse(_0x3160('0x1dc'),_0x3160('0x92'),_0x3160('0x1e4')));}});};};Dialer[_0x3160('0x19')][_0x3160('0x1d3')]=function(_0x1093e3){var _0x45f06c=this;return function(){var _0x59e725=0x0;var _0xd2ab5a=Math['floor'](_0x1093e3['erlangCallToSecond']*0x3e8);if(_0xd2ab5a>0x0){_0xd2ab5a=_0xd2ab5a<0x64?0x64:_0xd2ab5a;loggerPredictive['info'](_0x1093e3[_0x3160('0x4b')],_0x3160('0x1e5'),_0xd2ab5a,_0x3160('0x1e6'));_0x1093e3[_0x3160('0x66')]=setInterval(function(){_0x45f06c[_0x3160('0x66')](_0x1093e3);loggerPredictiveCalls[_0x3160('0x4e')](_0x3160('0x1e7'),_0x59e725+=0x1);},_0xd2ab5a);}else{loggerPredictive[_0x3160('0x4e')](_0x1093e3['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x3160('0x1e8')]=function(_0x48c1a8,_0x6d1d02){var _0x301d7a=this;return function(_0x515764){if(_[_0x3160('0x4d')](_0x515764)){if(_[_0x3160('0xf3')](_0x6d1d02[_0x3160('0x1e9')])||!_0x6d1d02[_0x3160('0x1ea')]){if(_0x48c1a8[_0x3160('0xb1')]===_0x3160('0x8')){_0x48c1a8[_0x3160('0x74')]=_['isUndefined'](_0x48c1a8['queueStatusComplete'])?!![]:_0x48c1a8['queueStatusComplete'];var _0x4b9a51=uuid['v4']();_0x301d7a['actions'][_0x4b9a51]=new Action(_0x48c1a8,_0x6d1d02,_0x4b9a51);loggerBooked[_0x3160('0x4e')](_0x3160('0x1eb'),_0x4b9a51,'queueStatusComplete:\x20',JSON[_0x3160('0xa7')](_0x48c1a8[_0x3160('0x74')]),'Queue:\x20',_0x48c1a8[_0x3160('0x4b')]);if(_0x48c1a8['queueStatusComplete']){_0x48c1a8['queueStatusComplete']=![];_0x301d7a['queueBooked'][_0x301d7a[_0x3160('0x24')][_0x4b9a51]['queue']]=[];ami['Action']({'actionid':_0x4b9a51,'action':_0x3160('0x1ec'),'queue':_0x48c1a8['name']})[_0x3160('0xa1')](function(){utils[_0x3160('0xc1')](_0x48c1a8,_0x3160('0x1ed'));hopperUtils[_0x3160('0x106')]({'active':![],'ContactId':_0x301d7a[_0x3160('0x24')][_0x4b9a51][_0x3160('0xfc')],'ListId':_0x301d7a['actions'][_0x4b9a51][_0x3160('0xdf')],'VoiceQueueId':_0x301d7a['actions'][_0x4b9a51][_0x3160('0xe0')]||undefined,'CampaignId':_0x301d7a[_0x3160('0x24')][_0x4b9a51][_0x3160('0xe1')]||undefined})[_0x3160('0xa1')](loggerCatch(_0x3160('0x1ee')));delete _0x301d7a[_0x3160('0x24')][_0x4b9a51];});}else{loggerBooked[_0x3160('0x4e')](_0x3160('0x1ef'),JSON[_0x3160('0xa7')](_0x48c1a8[_0x3160('0x74')]),_0x3160('0x1f0'),_0x48c1a8[_0x3160('0x4b')]);utils['decrementOriginate'](_0x48c1a8,_0x3160('0x1ed'));hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x301d7a[_0x3160('0x24')][_0x4b9a51][_0x3160('0xfc')],'ListId':_0x301d7a[_0x3160('0x24')][_0x4b9a51][_0x3160('0xdf')],'VoiceQueueId':_0x301d7a['actions'][_0x4b9a51]['VoiceQueueId']||undefined,'CampaignId':_0x301d7a['actions'][_0x4b9a51][_0x3160('0xe1')]||undefined})[_0x3160('0xa1')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x301d7a[_0x3160('0x24')][_0x4b9a51];}}else{return _0x301d7a[_0x3160('0x15b')](_0x48c1a8,_0x6d1d02);}}else{if(utils['getSeconds'](undefined,_0x6d1d02[_0x3160('0x1f1')])<_0x48c1a8[_0x3160('0x1f2')]*0x3c){if(_0x6d1d02[_0x3160('0x14d')]&&!_0x6d1d02[_0x3160('0x14d')]['voicePause']){_0x301d7a[_0x3160('0x1d')]['run'](_0x6d1d02['id'])[_0x3160('0xfa')](function(){utils[_0x3160('0xc1')](_0x48c1a8,'[checkContactBlack]');});}else{hopperUtils[_0x3160('0x1f3')]({'active':![]},_0x6d1d02['id'],0x1)['finally'](function(){utils[_0x3160('0xc1')](_0x48c1a8,_0x3160('0x1ed'));});}}else{_0x48c1a8[_0x3160('0x1f4')]+=0x1;utils['decrementOriginate'](_0x48c1a8,'[checkContactBlack]');if(_0x48c1a8[_0x3160('0x1f5')]){hopperUtils[_0x3160('0x106')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x6d1d02[_0x3160('0xfc')],'ListId':_0x6d1d02[_0x3160('0xdf')],'VoiceQueueId':_0x6d1d02[_0x3160('0xe0')]||undefined,'CampaignId':_0x6d1d02[_0x3160('0xe1')]||undefined})[_0x3160('0xa1')](loggerCatch(_0x3160('0x1f6')));hopperUtils[_0x3160('0xca')](createObjHistory(_0x48c1a8,_0x6d1d02,utils[_0x3160('0x6b')][_0x3160('0x1f7')],0x17,_0x3160('0x1f8')))[_0x3160('0xa1')](loggerCatch(_0x3160('0x1f9')));}else{_0x301d7a[_0x3160('0x11e')](createObjHistory(_0x48c1a8,_0x6d1d02,utils['CAMPAIGN_STATUS'][_0x3160('0x1fa')],0x16,_0x3160('0x1fb')),_0x3160('0x1fc'),_0x3160('0x1fd'));}}}}else{_0x48c1a8[_0x3160('0x1fe')]+=0x1;_0x301d7a[_0x3160('0x11e')](createObjHistory(_0x48c1a8,_0x6d1d02,utils[_0x3160('0x6b')]['BLACKLIST'],0xd,_0x3160('0x1ff')),_0x3160('0x200'),'[Originate][MoveBlacklist]');throw _0x3160('0x201');}};};Dialer[_0x3160('0x19')]['handleIvr']=function(_0x1b4af8){var _0x488609=this;var _0x2d6510=_0x1b4af8[_0x3160('0x202')]-_0x1b4af8[_0x3160('0x7f')];emitCampaignSummary(_0x1b4af8);if(_0x2d6510>0x0&&_0x1b4af8[_0x3160('0x203')]==0x0){if(_0x2d6510>this[_0x3160('0x22')]){_0x2d6510=this['maxNumberOriginate'];}_0x1b4af8[_0x3160('0x203')]=0x1;hopperUtils['getContactDialerIvr'](_0x1b4af8,_0x2d6510)['then'](function(_0x5cc03a){_0x1b4af8['temp']=0x0;if(_0x5cc03a){if(!utils[_0x3160('0x204')](_0x5cc03a)){_0x1b4af8[_0x3160('0x6a')]=utils[_0x3160('0x6b')][_0x3160('0x6f')];logger[_0x3160('0x4e')](_0x3160('0x205')+_0x1b4af8[_0x3160('0x4b')]);}else{_0x1b4af8['originated']+=_0x5cc03a[_0x3160('0xff')];_0x1b4af8[_0x3160('0x6a')]=utils['CAMPAIGN_STATUS'][_0x3160('0x206')];for(var _0x355449=0x0;_0x355449<_0x5cc03a['length'];_0x355449+=0x1){_0x1b4af8['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x5cc03a[_0x355449])||_[_0x3160('0xf3')](_0x5cc03a[_0x355449]['Contact'])||_[_0x3160('0xf3')](_0x5cc03a[_0x355449][_0x3160('0x15e')])){_0x488609[_0x3160('0x156')](_0x3160('0x207'),_0x1b4af8,_0x5cc03a[_0x355449]);}else{hopperUtils[_0x3160('0x208')](_[_0x3160('0x103')](_0x5cc03a[_0x355449],[_0x3160('0xe1'),'phone']))[_0x3160('0x9d')](_0x488609[_0x3160('0x1e8')](_0x1b4af8,_0x5cc03a[_0x355449]))[_0x3160('0xa1')](function(_0x32e579){logger[_0x3160('0x68')]('[actionOriginateIvr]',_0x32e579);utils[_0x3160('0xc1')](_0x1b4af8,_0x3160('0x209'));});}}}}})[_0x3160('0xa1')](function(_0xa31297){_0x1b4af8[_0x3160('0x203')]=0x0;logger['error'](_0x3160('0x20a'),_0xa31297);});}};Dialer['prototype'][_0x3160('0xb3')]=function(_0x22b578,_0x2f6a7f){var _0x5c0970=this;var _0x4027b3=[];if(_0x2f6a7f<0x1||_0x22b578[_0x3160('0xb1')]===_0x3160('0x8')){_0x2f6a7f=0x1;}var _0x2a48c3=Math[_0x3160('0x1c1')](_0x22b578[_0x3160('0x1c0')]*_0x2f6a7f)-_0x22b578[_0x3160('0x7f')];if(_0x22b578[_0x3160('0x20b')]>0x0){var _0xb3f301=_0x22b578[_0x3160('0x20b')]-_0x22b578[_0x3160('0x7f')]-_0x22b578[_0x3160('0x144')]-_0x22b578['pTalking'];if(_0x2a48c3>_0xb3f301){_0x2a48c3=_0xb3f301;}}if(_0x2a48c3>0x0&&_0x22b578['temp']==0x0){if(_0x22b578[_0x3160('0xb1')]===_0x3160('0x8')){_0x2a48c3=0x1;}if(_0x2a48c3>this[_0x3160('0x22')]){_0x2a48c3=this['maxNumberOriginate'];}for(var _0x3839b7 in this[_0x3160('0x20')]){if(typeof this[_0x3160('0x20')][_0x3839b7]!=='undefined'){if(this[_0x3160('0x20')][_0x3839b7][_0x3160('0x70')]===_0x3160('0x20c')&&this[_0x3160('0x20')][_0x3839b7][_0x3160('0x88')]==='reachable'){_0x4027b3[_0x3160('0x98')](this[_0x3160('0x20')][_0x3839b7]['id']);}}}_0x22b578[_0x3160('0x203')]=0x1;hopperUtils['getContactDialer'](_0x22b578,_0x4027b3,_0x2a48c3)[_0x3160('0x9d')](function(_0x7a68f4){_0x22b578[_0x3160('0x203')]=0x0;if(_0x7a68f4){if(!utils['checkContactEmpty'](_0x7a68f4)){hopperUtils[_0x3160('0x20d')](_0x22b578)[_0x3160('0x9d')](sendMessageReschedule(_0x22b578))['catch'](loggerCatch(_0x3160('0x20e')));}else{_0x22b578[_0x3160('0x7f')]+=_0x7a68f4[_0x3160('0xff')];_0x22b578[_0x3160('0x6a')]=_0x22b578['dialMethod']===_0x3160('0x8')?utils[_0x3160('0x6b')][_0x3160('0x146')]:utils[_0x3160('0x6b')]['RUNNING'];for(var _0x6abab3=0x0;_0x6abab3<_0x7a68f4[_0x3160('0xff')];_0x6abab3+=0x1){if(_[_0x3160('0xf3')](_0x7a68f4[_0x6abab3])||_['isNil'](_0x7a68f4[_0x6abab3][_0x3160('0x177')])||_[_0x3160('0xf3')](_0x7a68f4[_0x6abab3]['phone'])){_0x5c0970['emptyContact']('[actionOriginate]\x20',_0x22b578,_0x7a68f4[_0x6abab3]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x7a68f4[_0x6abab3],[_0x3160('0xe0'),_0x3160('0x15e')]))[_0x3160('0x9d')](_0x5c0970[_0x3160('0x1e8')](_0x22b578,_0x7a68f4[_0x6abab3]))[_0x3160('0xa1')](function(_0xde4948){logger[_0x3160('0x68')](_0x3160('0x20f'),_0xde4948);utils[_0x3160('0xc1')](_0x22b578,'[handlePower]');});}}}}})[_0x3160('0xa1')](function(_0x3d4f87){_0x22b578['temp']=0x0;logger[_0x3160('0x68')](_0x3160('0x20a'),_0x3d4f87);});}};Dialer['prototype'][_0x3160('0x66')]=function(_0x75d8d9){if(_0x75d8d9['dialLimitQueue']>0x0){var _0x3b2e7c=_0x75d8d9[_0x3160('0x20b')]-_0x75d8d9[_0x3160('0x7f')]-_0x75d8d9[_0x3160('0x144')];if(_0x3b2e7c>0x0&&_0x75d8d9[_0x3160('0x203')]==0x0){this[_0x3160('0x210')](_0x75d8d9);}else{loggerPredictiveCalls[_0x3160('0x4e')](_0x3160('0x211'));}}else{this[_0x3160('0x210')](_0x75d8d9);}};Dialer[_0x3160('0x19')]['tryOriginatePredictive']=function(_0xa89057){var _0x5c2c8e=this;var _0x330c69=[];_0xa89057[_0x3160('0x7f')]+=0x1;for(var _0x1a6a7a in this[_0x3160('0x20')]){if(typeof this['agents'][_0x1a6a7a]!==_0x3160('0xaa')){if(this[_0x3160('0x20')][_0x1a6a7a][_0x3160('0x70')]===_0x3160('0x20c')&&this[_0x3160('0x20')][_0x1a6a7a][_0x3160('0x88')]==='reachable'){_0x330c69['push'](this[_0x3160('0x20')][_0x1a6a7a]['id']);}}}_0xa89057[_0x3160('0x203')]=0x1;return this[_0x3160('0x212')](_0xa89057['id'],_0x330c69,0x1,_0xa89057['dialOrderByScheduledAt'],_0xa89057)[_0x3160('0x9d')](function(_0x1722b8){_0xa89057[_0x3160('0x203')]=0x1;if(_0x1722b8){if(!utils[_0x3160('0x204')](_0x1722b8)){utils['checkContactLowerLimitOriginate'](_0xa89057,0x1,0x0);return hopperUtils[_0x3160('0x20d')](_0xa89057)[_0x3160('0x9d')](sendMessageReschedule(_0xa89057))[_0x3160('0xa1')](loggerCatch(_0x3160('0x20e')));}else{_0xa89057[_0x3160('0x6a')]=utils[_0x3160('0x6b')][_0x3160('0x206')];if(_['isNil'](_0x1722b8[0x0])||_[_0x3160('0xf3')](_0x1722b8[0x0][_0x3160('0x177')])||_[_0x3160('0xf3')](_0x1722b8[0x0][_0x3160('0x15e')])){_0x5c2c8e[_0x3160('0x156')](_0x3160('0x207'),_0xa89057,_0x1722b8[0x0]);}else{return hopperUtils[_0x3160('0x213')](_[_0x3160('0x103')](_0x1722b8[0x0],['VoiceQueueId',_0x3160('0x15e')]))[_0x3160('0x9d')](_0x5c2c8e['checkContactBlack'](_0xa89057,_0x1722b8[0x0]))[_0x3160('0xa1')](function(_0x532759){logger[_0x3160('0x68')](_0x3160('0x214'),_0x532759);utils['decrementOriginate'](_0xa89057,'[actionOriginatePredictive]');});}}}})[_0x3160('0xa1')](function(_0x43eab3){_0xa89057[_0x3160('0x203')]=0x0;logger[_0x3160('0x68')](_0x3160('0x20a'),_0x43eab3);});};Dialer[_0x3160('0x19')][_0x3160('0x1d9')]=function(_0x33845f,_0x4f27d8,_0x3a879d,_0x1c2fc5,_0x512211,_0x2eab39){loggerPredictive['info'](_0x3160('0x215'));loggerPredictive[_0x3160('0x4e')]('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',_0x33845f);loggerPredictive[_0x3160('0x4e')](_0x3160('0x216'),_0x4f27d8);loggerPredictive['info'](_0x3160('0x217'),_0x3a879d);loggerPredictive[_0x3160('0x4e')](_0x3160('0x218'),_0x1c2fc5);loggerPredictive[_0x3160('0x4e')](_0x3160('0x219'),_0x512211);loggerPredictive['info'](_0x3160('0x5a'));return new Promise(function(_0x53e1b6,_0x4b67ce){if(_0x33845f<=0x0||isNaN(_0x33845f)){return _0x4b67ce(msgResponse(_0x3160('0x21a'),_0x3160('0x84'),_0x3160('0x21b')+_0x33845f));}if(_0x3a879d<=0x0||isNaN(_0x3a879d)){return _0x4b67ce(msgResponse(_0x3160('0x21a'),_0x3160('0x84'),_0x3160('0x21c')+_0x3a879d));}if(_0x1c2fc5<=0x0||isNaN(_0x1c2fc5)){return _0x4b67ce(msgResponse(_0x3160('0x21a'),_0x3160('0x84'),_0x3160('0x21d')+_0x1c2fc5));}if(_0x4f27d8<=0x0||isNaN(_0x4f27d8)){return _0x4b67ce(msgResponse(_0x3160('0x21a'),_0x3160('0x84'),_0x3160('0x21e')+_0x4f27d8));}if(_0x512211<=0x0||isNaN(_0x512211)){return _0x4b67ce(msgResponse(_0x3160('0x21a'),_0x3160('0x84'),_0x3160('0x21f')+_0x512211));}_0x2eab39=_0x2eab39||0x0;var _0x4ce5e9=0x1/_0x3a879d;var _0x6f3c97=0x0;var _0x1e0461=0x0;var _0x3c2a49=0x0;var _0x355557=0x0;for(var _0x9bffdc=0x0;_0x3c2a49<_0x512211;_0x9bffdc+=0x1){_0x1e0461=_0x9bffdc/_0x4f27d8;_0x6f3c97=(_0x1c2fc5*_0x1e0461+_0x2eab39)/_0x4ce5e9;_0x3c2a49=utils['erlangb'](_0x6f3c97,_0x33845f);_0x355557=_0x6f3c97/_0x33845f*(0x1-utils[_0x3160('0x220')](_0x6f3c97,_0x33845f));}return _0x53e1b6({'erlangCalls':_0x9bffdc,'erlangCallToSecond':_0x4f27d8/_0x9bffdc,'erlangAbandonmentRate':_0x3c2a49,'erlangBusyFactor':_0x355557});});};Dialer[_0x3160('0x19')][_0x3160('0x1db')]=function(_0x3496fa,_0x17285e,_0x51fb29,_0x187467,_0x2e6050,_0x5e4843){loggerPredictive[_0x3160('0x4e')](_0x3160('0x221'));loggerPredictive[_0x3160('0x4e')](_0x3160('0x222'),_0x3496fa);loggerPredictive[_0x3160('0x4e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x17285e);loggerPredictive['info'](_0x3160('0x217'),_0x51fb29);loggerPredictive[_0x3160('0x4e')]('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',_0x187467);loggerPredictive[_0x3160('0x4e')](_0x3160('0x223'),_0x2e6050);loggerPredictive[_0x3160('0x4e')](_0x3160('0x5a'));return new Promise(function(_0x20a146,_0x2649a7){if(_0x3496fa<=0x0||isNaN(_0x3496fa)){return _0x2649a7(msgResponse(_0x3160('0x224'),'Error',_0x3160('0x21b')+_0x3496fa));}if(_0x51fb29<=0x0||isNaN(_0x51fb29)){return _0x2649a7(msgResponse(_0x3160('0x224'),_0x3160('0x84'),'Ts\x20=\x20'+_0x51fb29));}if(_0x187467<=0x0||isNaN(_0x187467)){return _0x2649a7(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0x187467));}if(_0x17285e<=0x0||isNaN(_0x17285e)){return _0x2649a7(msgResponse(_0x3160('0x224'),_0x3160('0x84'),_0x3160('0x21e')+_0x17285e));}if(_0x2e6050<=0x0||isNaN(_0x2e6050)){return _0x2649a7(msgResponse(_0x3160('0x224'),'Error',_0x3160('0x225')+_0x2e6050));}_0x5e4843=_0x5e4843||0x0;var _0x18b6b7=0x1/_0x51fb29;var _0x407642=0x0;var _0x207a57=0x0;var _0x3a399d=0x0;var _0x4f7ffd=0x0;for(var _0x4a0bb6=0x0;_0x4f7ffd<_0x2e6050;_0x4a0bb6+=0x1){_0x207a57=_0x4a0bb6/_0x17285e;_0x407642=(_0x187467*_0x207a57+_0x5e4843)/_0x18b6b7;_0x3a399d=utils[_0x3160('0x220')](_0x407642,_0x3496fa);_0x4f7ffd=_0x407642/_0x3496fa*(0x1-utils['erlangb'](_0x407642,_0x3496fa));}return _0x20a146({'erlangCalls':_0x4a0bb6,'erlangCallToSecond':_0x17285e/_0x4a0bb6,'erlangAbandonmentRate':_0x3a399d,'erlangBusyFactor':_0x4f7ffd});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index fa81e9d..a3ee49a 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 _0x3ad3=['voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','exports','util','lodash','isNil','string'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x3ad3,0x1eb));var _0x33ad=function(_0x25dc35,_0x39aa2a){_0x25dc35=_0x25dc35-0x0;var _0x22e879=_0x3ad3[_0x25dc35];return _0x22e879;};'use strict';var util=require(_0x33ad('0x0'));var _=require(_0x33ad('0x1'));var moment=require('moment');function checkNameSurname(_0x1c851f,_0x242d37,_0x3951c2){var _0x5c39a6='';if(!_[_0x33ad('0x2')](_0x242d37)&&'string'===typeof _0x242d37){_0x5c39a6+=_0x242d37;}if(!_[_0x33ad('0x2')](_0x3951c2)&&_0x33ad('0x3')===typeof _0x3951c2){_0x5c39a6+='\x20'+_0x3951c2;}if(_0x5c39a6!==''){return _0x5c39a6;}return _0x1c851f;}function Action(_0x52dd6d,_0x1958fd,_0x71774e){this[_0x33ad('0x4')]=_0x52dd6d;this[_0x33ad('0x5')]=_0x71774e||undefined;this[_0x33ad('0x6')]=checkNameSurname(_0x1958fd['Contact'][_0x33ad('0x7')],_0x1958fd[_0x33ad('0x8')][_0x33ad('0x9')],_0x1958fd[_0x33ad('0x8')][_0x33ad('0xa')]);this[_0x33ad('0xb')]=_0x1958fd['phone'];this[_0x33ad('0xc')]=_0x52dd6d[_0x33ad('0x6')];this['active']=_0x1958fd[_0x33ad('0xd')]||![];this['type']=_0x52dd6d[_0x33ad('0xe')];this[_0x33ad('0xf')]=_0x52dd6d[_0x33ad('0xf')]||0x3;this[_0x33ad('0x10')]=_0x1958fd[_0x33ad('0x10')];this['countbusyretry']=_0x1958fd[_0x33ad('0x11')];this[_0x33ad('0x12')]=_0x1958fd[_0x33ad('0x12')];this[_0x33ad('0x13')]=_0x1958fd['countnoanswerretry'];this[_0x33ad('0x14')]=_0x1958fd[_0x33ad('0x14')];this[_0x33ad('0x15')]=_0x1958fd[_0x33ad('0x15')];this[_0x33ad('0x16')]=_0x1958fd[_0x33ad('0x16')];this[_0x33ad('0x17')]=_0x1958fd[_0x33ad('0x17')];this[_0x33ad('0x18')]=_0x1958fd[_0x33ad('0x18')];this['ContactId']=_0x1958fd[_0x33ad('0x19')];this[_0x33ad('0x1a')]=_0x1958fd[_0x33ad('0x1a')];this[_0x33ad('0x1b')]=_0x1958fd[_0x33ad('0x1b')];this['VoiceQueueId']=_0x1958fd[_0x33ad('0x1c')];this[_0x33ad('0x1d')]=_0x1958fd[_0x33ad('0x1d')];this[_0x33ad('0x1e')]=_0x1958fd['id'];this[_0x33ad('0x1f')]=_0x1958fd[_0x33ad('0x8')][_0x33ad('0x9')]||'';this[_0x33ad('0x20')]=moment()[_0x33ad('0x21')](_0x33ad('0x22'));this[_0x33ad('0x23')]=_0x1958fd[_0x33ad('0x23')];this[_0x33ad('0x24')]=_0x1958fd[_0x33ad('0x24')];this[_0x33ad('0x25')]=_0x1958fd['callbackat'];this[_0x33ad('0x26')]=_0x1958fd[_0x33ad('0x26')];this[_0x33ad('0x27')]='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util[_0x33ad('0x21')](_0x33ad('0x28'),this['name'],this[_0x33ad('0x4')][_0x33ad('0x29')]>0x0?this[_0x33ad('0xb')]['substring'](this[_0x33ad('0x4')]['dialCutDigit']):this[_0x33ad('0xb')]);};Action[_0x33ad('0x2a')][_0x33ad('0x2b')]=function(){return this[_0x33ad('0xc')];};module[_0x33ad('0x2c')]=Action; \ No newline at end of file +var _0xd1a3=['firstName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','format','dialCutDigit','substring','prototype','getQueue','queue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone'];(function(_0x29142c,_0x235938){var _0x37b071=function(_0x72c431){while(--_0x72c431){_0x29142c['push'](_0x29142c['shift']());}};_0x37b071(++_0x235938);}(_0xd1a3,0x75));var _0x3d1a=function(_0x56b3f8,_0x290b3f){_0x56b3f8=_0x56b3f8-0x0;var _0x9d8b32=_0xd1a3[_0x56b3f8];return _0x9d8b32;};'use strict';var util=require('util');var _=require(_0x3d1a('0x0'));var moment=require(_0x3d1a('0x1'));function checkNameSurname(_0x278fc9,_0x4f5a01,_0x4830f6){var _0x3d04a4='';if(!_[_0x3d1a('0x2')](_0x4f5a01)&&'string'===typeof _0x4f5a01){_0x3d04a4+=_0x4f5a01;}if(!_[_0x3d1a('0x2')](_0x4830f6)&&_0x3d1a('0x3')===typeof _0x4830f6){_0x3d04a4+='\x20'+_0x4830f6;}if(_0x3d04a4!==''){return _0x3d04a4;}return _0x278fc9;}function Action(_0x1f5803,_0x2358ba,_0x2632ca){this[_0x3d1a('0x4')]=_0x1f5803;this[_0x3d1a('0x5')]=_0x2632ca||undefined;this[_0x3d1a('0x6')]=checkNameSurname(_0x2358ba[_0x3d1a('0x7')][_0x3d1a('0x8')],_0x2358ba[_0x3d1a('0x7')][_0x3d1a('0x9')],_0x2358ba[_0x3d1a('0x7')]['lastName']);this[_0x3d1a('0xa')]=_0x2358ba[_0x3d1a('0x8')];this['queue']=_0x1f5803[_0x3d1a('0x6')];this['active']=_0x2358ba[_0x3d1a('0xb')]||![];this[_0x3d1a('0xc')]=_0x1f5803[_0x3d1a('0xc')];this[_0x3d1a('0xd')]=_0x1f5803['dialQueueTimeout']||0x3;this['scheduledat']=_0x2358ba[_0x3d1a('0xe')];this[_0x3d1a('0xf')]=_0x2358ba[_0x3d1a('0xf')];this[_0x3d1a('0x10')]=_0x2358ba[_0x3d1a('0x10')];this['countnoanswerretry']=_0x2358ba[_0x3d1a('0x11')];this['countnosuchnumberretry']=_0x2358ba[_0x3d1a('0x12')];this[_0x3d1a('0x13')]=_0x2358ba[_0x3d1a('0x13')];this[_0x3d1a('0x14')]=_0x2358ba[_0x3d1a('0x14')];this['countmachineretry']=_0x2358ba[_0x3d1a('0x15')];this[_0x3d1a('0x16')]=_0x2358ba[_0x3d1a('0x16')];this['ContactId']=_0x2358ba[_0x3d1a('0x17')];this[_0x3d1a('0x18')]=_0x2358ba[_0x3d1a('0x18')];this[_0x3d1a('0x19')]=_0x2358ba[_0x3d1a('0x19')];this[_0x3d1a('0x1a')]=_0x2358ba[_0x3d1a('0x1a')];this[_0x3d1a('0x1b')]=_0x2358ba[_0x3d1a('0x1b')];this['idHopper']=_0x2358ba['id'];this['ContactFirstName']=_0x2358ba[_0x3d1a('0x7')][_0x3d1a('0x9')]||'';this[_0x3d1a('0x1c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x2358ba[_0x3d1a('0x1d')];this[_0x3d1a('0x1e')]=_0x2358ba[_0x3d1a('0x1e')];this[_0x3d1a('0x1f')]=_0x2358ba[_0x3d1a('0x1f')];this[_0x3d1a('0x20')]=_0x2358ba['recallme'];this['originatecalleridnum']='';this[_0x3d1a('0x21')]='';}Action['prototype'][_0x3d1a('0x22')]=function(){return util[_0x3d1a('0x23')]('\x22%s\x22\x20<%s>',this[_0x3d1a('0x6')],this['voiceQueue'][_0x3d1a('0x24')]>0x0?this[_0x3d1a('0xa')][_0x3d1a('0x25')](this[_0x3d1a('0x4')][_0x3d1a('0x24')]):this[_0x3d1a('0xa')]);};Action[_0x3d1a('0x26')][_0x3d1a('0x27')]=function(){return this[_0x3d1a('0x28')];};module[_0x3d1a('0x29')]=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 d02dacf..be492c4 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 _0xdf3f=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','answertime','talktime','endtime','membername'];(function(_0x8449dd,_0x5f0aa1){var _0x213265=function(_0x49f856){while(--_0x49f856){_0x8449dd['push'](_0x8449dd['shift']());}};_0x213265(++_0x5f0aa1);}(_0xdf3f,0x1f2));var _0xfdf3=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0xdf3f[_0x44a3b0];return _0x39e6f6;};'use strict';var moment=require('moment');var utils=require('../utils');function AgentComplete(_0x935ec7,_0xd3bccd){this[_0xfdf3('0x0')]=0x4;this[_0xfdf3('0x1')]=_0xfdf3('0x2');this['scheduledat']=_0x935ec7[_0xfdf3('0x3')];this[_0xfdf3('0x4')]=_0x935ec7[_0xfdf3('0x4')];this[_0xfdf3('0x5')]=_0x935ec7['type']===_0xfdf3('0x6')?_0xfdf3('0x7'):_0x935ec7[_0xfdf3('0x4')];this['countbusyretry']=_0x935ec7[_0xfdf3('0x8')];this[_0xfdf3('0x9')]=_0x935ec7[_0xfdf3('0x9')];this[_0xfdf3('0xa')]=_0x935ec7['countnoanswerretry'];this[_0xfdf3('0xb')]=_0x935ec7[_0xfdf3('0x8')]+_0x935ec7['countcongestionretry']+_0x935ec7[_0xfdf3('0xa')]+_0x935ec7[_0xfdf3('0xc')]+_0x935ec7[_0xfdf3('0xd')]+_0x935ec7[_0xfdf3('0xe')]+_0x935ec7[_0xfdf3('0xf')]+_0x935ec7[_0xfdf3('0x10')];this[_0xfdf3('0xc')]=_0x935ec7[_0xfdf3('0xc')];this[_0xfdf3('0xd')]=_0x935ec7['countdropretry'];this[_0xfdf3('0xe')]=_0x935ec7['countabandonedretry'];this['countmachineretry']=_0x935ec7[_0xfdf3('0xf')];this[_0xfdf3('0x10')]=_0x935ec7['countagentrejectretry'];this[_0xfdf3('0x11')]=_0xd3bccd[_0xfdf3('0x11')];this[_0xfdf3('0x12')]=_0x935ec7['name'];this['calleridnum']=_0x935ec7['number'];this['starttime']=_0x935ec7[_0xfdf3('0x13')];this[_0xfdf3('0x14')]=_0x935ec7['responsetime'];this['answertime']=_0x935ec7['answertime'];this['endtime']=moment()[_0xfdf3('0x15')](_0xfdf3('0x16'));this[_0xfdf3('0x17')]=utils['getSeconds'](_0x935ec7[_0xfdf3('0x14')],_0x935ec7[_0xfdf3('0x13')]);this[_0xfdf3('0x18')]=utils[_0xfdf3('0x19')](_0x935ec7[_0xfdf3('0x1a')],_0x935ec7['responsetime']);this[_0xfdf3('0x1b')]=utils[_0xfdf3('0x19')](this[_0xfdf3('0x1c')],_0x935ec7[_0xfdf3('0x1a')]);this[_0xfdf3('0x7')]=_0xd3bccd[_0xfdf3('0x7')];this['membername']=_0xd3bccd[_0xfdf3('0x1d')];this[_0xfdf3('0x1e')]=_0xd3bccd[_0xfdf3('0x1e')];this[_0xfdf3('0x1f')]=_0x935ec7[_0xfdf3('0x1f')];this['callbackuniqueid']=_0x935ec7[_0xfdf3('0x20')];this['callbackat']=_0x935ec7[_0xfdf3('0x21')];this[_0xfdf3('0x22')]=_0x935ec7[_0xfdf3('0x22')];this[_0xfdf3('0x23')]=_0x935ec7[_0xfdf3('0x23')];this['ListId']=_0x935ec7[_0xfdf3('0x24')];this[_0xfdf3('0x25')]=_0x935ec7[_0xfdf3('0x25')];this['VoiceQueueId']=_0x935ec7[_0xfdf3('0x26')];this[_0xfdf3('0x27')]=_0x935ec7[_0xfdf3('0x27')];this[_0xfdf3('0x28')]=_0x935ec7[_0xfdf3('0x28')]||'';this[_0xfdf3('0x29')]=_0x935ec7[_0xfdf3('0x29')]||'';this[_0xfdf3('0x2a')]=_0x935ec7[_0xfdf3('0x2a')];}module[_0xfdf3('0x2b')]=AgentComplete; \ No newline at end of file +var _0xe0f3=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','Answer','scheduledat','type','countbusyretry','countnoanswerretry','countcongestionretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime'];(function(_0x15d742,_0x3bb1f2){var _0x4f51aa=function(_0x4d44de){while(--_0x4d44de){_0x15d742['push'](_0x15d742['shift']());}};_0x4f51aa(++_0x3bb1f2);}(_0xe0f3,0xbc));var _0x3e0f=function(_0x1733da,_0x329acb){_0x1733da=_0x1733da-0x0;var _0x172cbc=_0xe0f3[_0x1733da];return _0x172cbc;};'use strict';var moment=require(_0x3e0f('0x0'));var utils=require(_0x3e0f('0x1'));function AgentComplete(_0x24de87,_0x2f90fa){this[_0x3e0f('0x2')]=0x4;this['statedesc']=_0x3e0f('0x3');this[_0x3e0f('0x4')]=_0x24de87['scheduledat'];this[_0x3e0f('0x5')]=_0x24de87['type'];this['campaigntype']=_0x24de87['type']==='outbound'?'queue':_0x24de87[_0x3e0f('0x5')];this['countbusyretry']=_0x24de87[_0x3e0f('0x6')];this['countcongestionretry']=_0x24de87['countcongestionretry'];this[_0x3e0f('0x7')]=_0x24de87[_0x3e0f('0x7')];this['countglobal']=_0x24de87[_0x3e0f('0x6')]+_0x24de87[_0x3e0f('0x8')]+_0x24de87[_0x3e0f('0x7')]+_0x24de87['countnosuchnumberretry']+_0x24de87['countdropretry']+_0x24de87['countabandonedretry']+_0x24de87[_0x3e0f('0x9')]+_0x24de87[_0x3e0f('0xa')];this[_0x3e0f('0xb')]=_0x24de87[_0x3e0f('0xb')];this['countdropretry']=_0x24de87[_0x3e0f('0xc')];this[_0x3e0f('0xd')]=_0x24de87[_0x3e0f('0xd')];this['countmachineretry']=_0x24de87['countmachineretry'];this['countagentrejectretry']=_0x24de87['countagentrejectretry'];this[_0x3e0f('0xe')]=_0x2f90fa[_0x3e0f('0xe')];this[_0x3e0f('0xf')]=_0x24de87[_0x3e0f('0x10')];this[_0x3e0f('0x11')]=_0x24de87['number'];this[_0x3e0f('0x12')]=_0x24de87[_0x3e0f('0x12')];this[_0x3e0f('0x13')]=_0x24de87['responsetime'];this['answertime']=_0x24de87[_0x3e0f('0x14')];this[_0x3e0f('0x15')]=moment()[_0x3e0f('0x16')](_0x3e0f('0x17'));this[_0x3e0f('0x18')]=utils[_0x3e0f('0x19')](_0x24de87[_0x3e0f('0x13')],_0x24de87[_0x3e0f('0x12')]);this[_0x3e0f('0x1a')]=utils[_0x3e0f('0x19')](_0x24de87['answertime'],_0x24de87[_0x3e0f('0x13')]);this['talktime']=utils['getSeconds'](this[_0x3e0f('0x15')],_0x24de87['answertime']);this[_0x3e0f('0x1b')]=_0x2f90fa['queue'];this[_0x3e0f('0x1c')]=_0x2f90fa[_0x3e0f('0x1c')];this[_0x3e0f('0x1d')]=_0x2f90fa['reason'];this[_0x3e0f('0x1e')]=_0x24de87[_0x3e0f('0x1e')];this[_0x3e0f('0x1f')]=_0x24de87[_0x3e0f('0x1f')];this['callbackat']=_0x24de87[_0x3e0f('0x20')];this[_0x3e0f('0x21')]=_0x24de87[_0x3e0f('0x21')];this['ContactId']=_0x24de87[_0x3e0f('0x22')];this['ListId']=_0x24de87[_0x3e0f('0x23')];this[_0x3e0f('0x24')]=_0x24de87[_0x3e0f('0x24')];this['VoiceQueueId']=_0x24de87['VoiceQueueId'];this[_0x3e0f('0x25')]=_0x24de87[_0x3e0f('0x25')];this[_0x3e0f('0x26')]=_0x24de87[_0x3e0f('0x26')]||'';this[_0x3e0f('0x27')]=_0x24de87[_0x3e0f('0x27')]||'';this[_0x3e0f('0x28')]=_0x24de87[_0x3e0f('0x28')];}module[_0x3e0f('0x29')]=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 7cbfe0a..85b4c36 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 _0xf572=['calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry'];(function(_0x55a0d4,_0xd2c6d1){var _0x680c6=function(_0x4a2a18){while(--_0x4a2a18){_0x55a0d4['push'](_0x55a0d4['shift']());}};_0x680c6(++_0xd2c6d1);}(_0xf572,0x85));var _0x2f57=function(_0x4f9b75,_0x5da717){_0x4f9b75=_0x4f9b75-0x0;var _0x36b392=_0xf572[_0x4f9b75];return _0x36b392;};'use strict';function Final(_0x4d4f42){this['uniqueid']=_0x4d4f42[_0x2f57('0x0')];this['scheduledat']=_0x4d4f42[_0x2f57('0x1')];this[_0x2f57('0x2')]=_0x4d4f42[_0x2f57('0x2')];this[_0x2f57('0x3')]=_0x4d4f42[_0x2f57('0x2')]===_0x2f57('0x4')?_0x2f57('0x5'):_0x4d4f42[_0x2f57('0x2')];this[_0x2f57('0x6')]=_0x4d4f42['countbusyretry'];this['countcongestionretry']=_0x4d4f42[_0x2f57('0x7')];this[_0x2f57('0x8')]=_0x4d4f42['countnoanswerretry'];this[_0x2f57('0x9')]=_0x4d4f42['countbusyretry']+_0x4d4f42[_0x2f57('0x7')]+_0x4d4f42['countnoanswerretry']+_0x4d4f42['countnosuchnumberretry']+_0x4d4f42[_0x2f57('0xa')]+_0x4d4f42[_0x2f57('0xb')]+_0x4d4f42[_0x2f57('0xc')]+_0x4d4f42[_0x2f57('0xd')];this[_0x2f57('0xe')]=_0x4d4f42['countnosuchnumberretry'];this['countdropretry']=_0x4d4f42['countdropretry'];this[_0x2f57('0xb')]=_0x4d4f42['countabandonedretry'];this[_0x2f57('0xc')]=_0x4d4f42['countmachineretry'];this[_0x2f57('0xd')]=_0x4d4f42[_0x2f57('0xd')];this[_0x2f57('0x5')]=_0x4d4f42[_0x2f57('0x5')];this['calleridname']=_0x4d4f42[_0x2f57('0xf')];this[_0x2f57('0x10')]=_0x4d4f42['calleridnum'];this[_0x2f57('0x11')]=_0x4d4f42[_0x2f57('0x11')];this[_0x2f57('0x12')]=_0x4d4f42[_0x2f57('0x12')];this[_0x2f57('0x13')]=_0x4d4f42[_0x2f57('0x12')];this[_0x2f57('0x14')]=_0x4d4f42[_0x2f57('0x14')]||0x0;this[_0x2f57('0x15')]=_0x4d4f42[_0x2f57('0x15')]||0x0;this['talktime']=_0x4d4f42[_0x2f57('0x16')]||0x0;this[_0x2f57('0x17')]=_0x4d4f42['callback'];this[_0x2f57('0x18')]=_0x4d4f42['callbackuniqueid'];this[_0x2f57('0x19')]=_0x4d4f42[_0x2f57('0x19')];this['recallme']=_0x4d4f42[_0x2f57('0x1a')];this[_0x2f57('0x1b')]=_0x4d4f42[_0x2f57('0x1b')];this[_0x2f57('0x1c')]=_0x4d4f42[_0x2f57('0x1c')];this['UserId']=_0x4d4f42[_0x2f57('0x1d')];this['VoiceQueueId']=_0x4d4f42[_0x2f57('0x1e')];this[_0x2f57('0x1f')]=_0x4d4f42[_0x2f57('0x1f')];this[_0x2f57('0x20')]=_0x4d4f42[_0x2f57('0x20')]||'';this[_0x2f57('0x21')]=_0x4d4f42[_0x2f57('0x21')]||'';this[_0x2f57('0x22')]=_0x4d4f42[_0x2f57('0x22')];this['statedesc']=_0x4d4f42[_0x2f57('0x23')];}module[_0x2f57('0x24')]=Final; \ No newline at end of file +var _0x3a81=['countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x3db95c,_0x48a292){var _0x218ecc=function(_0x5f20ed){while(--_0x5f20ed){_0x3db95c['push'](_0x3db95c['shift']());}};_0x218ecc(++_0x48a292);}(_0x3a81,0x1dd));var _0x13a8=function(_0x1c5968,_0x68d40c){_0x1c5968=_0x1c5968-0x0;var _0x290441=_0x3a81[_0x1c5968];return _0x290441;};'use strict';function Final(_0x54a5df){this[_0x13a8('0x0')]=_0x54a5df[_0x13a8('0x0')];this['scheduledat']=_0x54a5df['scheduledat'];this['type']=_0x54a5df[_0x13a8('0x1')];this[_0x13a8('0x2')]=_0x54a5df[_0x13a8('0x1')]===_0x13a8('0x3')?_0x13a8('0x4'):_0x54a5df['type'];this[_0x13a8('0x5')]=_0x54a5df['countbusyretry'];this['countcongestionretry']=_0x54a5df[_0x13a8('0x6')];this[_0x13a8('0x7')]=_0x54a5df[_0x13a8('0x7')];this[_0x13a8('0x8')]=_0x54a5df['countbusyretry']+_0x54a5df[_0x13a8('0x6')]+_0x54a5df[_0x13a8('0x7')]+_0x54a5df[_0x13a8('0x9')]+_0x54a5df[_0x13a8('0xa')]+_0x54a5df[_0x13a8('0xb')]+_0x54a5df[_0x13a8('0xc')]+_0x54a5df[_0x13a8('0xd')];this[_0x13a8('0x9')]=_0x54a5df['countnosuchnumberretry'];this[_0x13a8('0xa')]=_0x54a5df['countdropretry'];this[_0x13a8('0xb')]=_0x54a5df['countabandonedretry'];this[_0x13a8('0xc')]=_0x54a5df['countmachineretry'];this[_0x13a8('0xd')]=_0x54a5df[_0x13a8('0xd')];this[_0x13a8('0x4')]=_0x54a5df[_0x13a8('0x4')];this[_0x13a8('0xe')]=_0x54a5df[_0x13a8('0xe')];this[_0x13a8('0xf')]=_0x54a5df['calleridnum'];this['starttime']=_0x54a5df[_0x13a8('0x10')];this[_0x13a8('0x11')]=_0x54a5df['responsetime'];this[_0x13a8('0x12')]=_0x54a5df[_0x13a8('0x11')];this['ringtime']=_0x54a5df[_0x13a8('0x13')]||0x0;this[_0x13a8('0x14')]=_0x54a5df['holdtime']||0x0;this[_0x13a8('0x15')]=_0x54a5df[_0x13a8('0x15')]||0x0;this[_0x13a8('0x16')]=_0x54a5df[_0x13a8('0x16')];this[_0x13a8('0x17')]=_0x54a5df[_0x13a8('0x17')];this[_0x13a8('0x18')]=_0x54a5df[_0x13a8('0x18')];this[_0x13a8('0x19')]=_0x54a5df[_0x13a8('0x19')];this[_0x13a8('0x1a')]=_0x54a5df[_0x13a8('0x1a')];this[_0x13a8('0x1b')]=_0x54a5df[_0x13a8('0x1b')];this[_0x13a8('0x1c')]=_0x54a5df[_0x13a8('0x1c')];this['VoiceQueueId']=_0x54a5df[_0x13a8('0x1d')];this[_0x13a8('0x1e')]=_0x54a5df['CampaignId'];this[_0x13a8('0x1f')]=_0x54a5df[_0x13a8('0x1f')]||'';this[_0x13a8('0x20')]=_0x54a5df['originatecalleridname']||'';this[_0x13a8('0x21')]=_0x54a5df[_0x13a8('0x21')];this[_0x13a8('0x22')]=_0x54a5df['statedesc'];}module['exports']=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 66b8bab..36c43da 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 _0xc000=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x3dfc82,_0x4a9d54){var _0x40f051=function(_0x3ddbe9){while(--_0x3ddbe9){_0x3dfc82['push'](_0x3dfc82['shift']());}};_0x40f051(++_0x4a9d54);}(_0xc000,0x1c6));var _0x0c00=function(_0x45d0ff,_0x4f473f){_0x45d0ff=_0x45d0ff-0x0;var _0x3993d8=_0xc000[_0x45d0ff];return _0x3993d8;};'use strict';var moment=require(_0x0c00('0x0'));var utils=require(_0x0c00('0x1'));function Hangup(_0x6e498b,_0x297dac){this['state']=0x4;this[_0x0c00('0x2')]=_0x0c00('0x3');this['scheduledat']=_0x6e498b[_0x0c00('0x4')];this[_0x0c00('0x5')]=_0x6e498b['type'];this[_0x0c00('0x6')]=_0x6e498b[_0x0c00('0x5')]==='outbound'?_0x0c00('0x7'):_0x6e498b['type'];this[_0x0c00('0x8')]=_0x6e498b[_0x0c00('0x8')]||![];this[_0x0c00('0x9')]=_0x6e498b[_0x0c00('0x9')];this[_0x0c00('0xa')]=_0x6e498b['countcongestionretry'];this['countnoanswerretry']=_0x6e498b[_0x0c00('0xb')];this[_0x0c00('0xc')]=_0x6e498b[_0x0c00('0x9')]+_0x6e498b[_0x0c00('0xa')]+_0x6e498b['countnoanswerretry']+_0x6e498b[_0x0c00('0xd')]+_0x6e498b[_0x0c00('0xe')]+_0x6e498b[_0x0c00('0xf')]+_0x6e498b[_0x0c00('0x10')]+_0x6e498b[_0x0c00('0x11')];this[_0x0c00('0xd')]=_0x6e498b[_0x0c00('0xd')];this[_0x0c00('0xe')]=_0x6e498b[_0x0c00('0xe')];this[_0x0c00('0xf')]=_0x6e498b['countabandonedretry'];this[_0x0c00('0x10')]=_0x6e498b[_0x0c00('0x10')];this['countagentrejectretry']=_0x6e498b['countagentrejectretry'];this[_0x0c00('0x12')]=_0x297dac['uniqueid'];this['calleridname']=_0x6e498b['name'];this[_0x0c00('0x13')]=_0x6e498b[_0x0c00('0x14')];this[_0x0c00('0x15')]=_0x6e498b[_0x0c00('0x15')];this[_0x0c00('0x16')]=_0x6e498b['responsetime'];this[_0x0c00('0x17')]=moment()['format'](_0x0c00('0x18'));this[_0x0c00('0x19')]=utils['getSeconds'](_0x6e498b[_0x0c00('0x16')],_0x6e498b[_0x0c00('0x15')]);this[_0x0c00('0x1a')]=0x0;this[_0x0c00('0x1b')]=utils['getSeconds'](this[_0x0c00('0x17')],_0x6e498b['responsetime']);this[_0x0c00('0x7')]=_0x6e498b[_0x0c00('0x7')];this[_0x0c00('0x1c')]='IVR';this['reason']=_0x297dac['cause-txt'];this[_0x0c00('0x1d')]=_0x6e498b[_0x0c00('0x1d')];this['callbackuniqueid']=_0x6e498b[_0x0c00('0x1e')];this[_0x0c00('0x1f')]=_0x6e498b['callbackat'];this[_0x0c00('0x20')]=_0x6e498b[_0x0c00('0x20')];this[_0x0c00('0x21')]=_0x6e498b[_0x0c00('0x21')];this[_0x0c00('0x22')]=_0x6e498b[_0x0c00('0x22')];this[_0x0c00('0x23')]=_0x6e498b[_0x0c00('0x23')];this[_0x0c00('0x24')]=_0x6e498b[_0x0c00('0x24')];this[_0x0c00('0x25')]=_0x6e498b[_0x0c00('0x25')];}module[_0x0c00('0x26')]=Hangup; \ No newline at end of file +var _0x6dbd=['countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x6dbd,0x110));var _0xd6db=function(_0x583033,_0x37f452){_0x583033=_0x583033-0x0;var _0x4f94da=_0x6dbd[_0x583033];return _0x4f94da;};'use strict';var moment=require(_0xd6db('0x0'));var utils=require(_0xd6db('0x1'));function Hangup(_0x3ebb24,_0x19208d){this['state']=0x4;this[_0xd6db('0x2')]=_0xd6db('0x3');this[_0xd6db('0x4')]=_0x3ebb24[_0xd6db('0x4')];this[_0xd6db('0x5')]=_0x3ebb24[_0xd6db('0x5')];this[_0xd6db('0x6')]=_0x3ebb24[_0xd6db('0x5')]===_0xd6db('0x7')?'queue':_0x3ebb24[_0xd6db('0x5')];this['amd']=_0x3ebb24[_0xd6db('0x8')]||![];this[_0xd6db('0x9')]=_0x3ebb24[_0xd6db('0x9')];this[_0xd6db('0xa')]=_0x3ebb24[_0xd6db('0xa')];this[_0xd6db('0xb')]=_0x3ebb24['countnoanswerretry'];this[_0xd6db('0xc')]=_0x3ebb24[_0xd6db('0x9')]+_0x3ebb24[_0xd6db('0xa')]+_0x3ebb24[_0xd6db('0xb')]+_0x3ebb24[_0xd6db('0xd')]+_0x3ebb24[_0xd6db('0xe')]+_0x3ebb24[_0xd6db('0xf')]+_0x3ebb24['countmachineretry']+_0x3ebb24[_0xd6db('0x10')];this[_0xd6db('0xd')]=_0x3ebb24['countnosuchnumberretry'];this[_0xd6db('0xe')]=_0x3ebb24[_0xd6db('0xe')];this[_0xd6db('0xf')]=_0x3ebb24['countabandonedretry'];this['countmachineretry']=_0x3ebb24[_0xd6db('0x11')];this[_0xd6db('0x10')]=_0x3ebb24['countagentrejectretry'];this['uniqueid']=_0x19208d[_0xd6db('0x12')];this['calleridname']=_0x3ebb24[_0xd6db('0x13')];this[_0xd6db('0x14')]=_0x3ebb24['number'];this[_0xd6db('0x15')]=_0x3ebb24['starttime'];this[_0xd6db('0x16')]=_0x3ebb24[_0xd6db('0x16')];this[_0xd6db('0x17')]=moment()[_0xd6db('0x18')](_0xd6db('0x19'));this[_0xd6db('0x1a')]=utils['getSeconds'](_0x3ebb24[_0xd6db('0x16')],_0x3ebb24[_0xd6db('0x15')]);this['holdtime']=0x0;this['talktime']=utils[_0xd6db('0x1b')](this[_0xd6db('0x17')],_0x3ebb24['responsetime']);this['queue']=_0x3ebb24['queue'];this[_0xd6db('0x1c')]=_0xd6db('0x1d');this['reason']=_0x19208d[_0xd6db('0x1e')];this[_0xd6db('0x1f')]=_0x3ebb24[_0xd6db('0x1f')];this[_0xd6db('0x20')]=_0x3ebb24['callbackuniqueid'];this[_0xd6db('0x21')]=_0x3ebb24[_0xd6db('0x21')];this[_0xd6db('0x22')]=_0x3ebb24['recallme'];this[_0xd6db('0x23')]=_0x3ebb24[_0xd6db('0x23')];this[_0xd6db('0x24')]=_0x3ebb24['ListId'];this[_0xd6db('0x25')]=_0x3ebb24[_0xd6db('0x25')];this[_0xd6db('0x26')]=_0x3ebb24[_0xd6db('0x26')];this[_0xd6db('0x27')]=_0x3ebb24[_0xd6db('0x27')];}module[_0xd6db('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 8e201b3..bbeda01 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 _0xc4a2=['calleridnum','number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name'];(function(_0x1c483e,_0x5a853c){var _0x1aabfa=function(_0x156915){while(--_0x156915){_0x1c483e['push'](_0x1c483e['shift']());}};_0x1aabfa(++_0x5a853c);}(_0xc4a2,0x16f));var _0x2c4a=function(_0x12b228,_0x520eda){_0x12b228=_0x12b228-0x0;var _0x5063b3=_0xc4a2[_0x12b228];return _0x5063b3;};'use strict';var utils=require(_0x2c4a('0x0'));function History(_0x4c9c92){this['uniqueid']=_0x4c9c92[_0x2c4a('0x1')];this['scheduledat']=_0x4c9c92[_0x2c4a('0x2')]||undefined;this[_0x2c4a('0x3')]=_0x4c9c92[_0x2c4a('0x3')];this[_0x2c4a('0x4')]=_0x4c9c92[_0x2c4a('0x3')]===_0x2c4a('0x5')?_0x2c4a('0x6'):_0x4c9c92[_0x2c4a('0x3')];this[_0x2c4a('0x7')]=_0x4c9c92[_0x2c4a('0x7')];this[_0x2c4a('0x8')]=_0x4c9c92[_0x2c4a('0x8')];this[_0x2c4a('0x9')]=_0x4c9c92[_0x2c4a('0x9')];this[_0x2c4a('0xa')]=_0x4c9c92[_0x2c4a('0x7')]+_0x4c9c92[_0x2c4a('0x8')]+_0x4c9c92[_0x2c4a('0x9')]+_0x4c9c92[_0x2c4a('0xb')]+_0x4c9c92[_0x2c4a('0xc')]+_0x4c9c92[_0x2c4a('0xd')]+_0x4c9c92['countmachineretry']+_0x4c9c92[_0x2c4a('0xe')];this[_0x2c4a('0xb')]=_0x4c9c92['countnosuchnumberretry'];this[_0x2c4a('0xc')]=_0x4c9c92[_0x2c4a('0xc')];this['countabandonedretry']=_0x4c9c92['countabandonedretry'];this[_0x2c4a('0xf')]=_0x4c9c92[_0x2c4a('0xf')];this[_0x2c4a('0xe')]=_0x4c9c92['countagentrejectretry'];this[_0x2c4a('0x6')]=_0x4c9c92[_0x2c4a('0x6')];this[_0x2c4a('0x10')]=_0x4c9c92[_0x2c4a('0x11')];this[_0x2c4a('0x12')]=_0x4c9c92[_0x2c4a('0x13')];this[_0x2c4a('0x14')]=_0x4c9c92[_0x2c4a('0x14')];this[_0x2c4a('0x15')]=_0x4c9c92[_0x2c4a('0x15')];this[_0x2c4a('0x16')]=_0x4c9c92['responsetime'];this[_0x2c4a('0x17')]=utils['getSeconds'](_0x4c9c92['responsetime'],_0x4c9c92[_0x2c4a('0x14')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x2c4a('0x18')]=_0x4c9c92['callback'];this['callbackuniqueid']=_0x4c9c92[_0x2c4a('0x19')];this['callbackat']=_0x4c9c92[_0x2c4a('0x1a')];this[_0x2c4a('0x1b')]=_0x4c9c92[_0x2c4a('0x1b')];this['ContactId']=_0x4c9c92[_0x2c4a('0x1c')];this['ListId']=_0x4c9c92[_0x2c4a('0x1d')];this[_0x2c4a('0x1e')]=_0x4c9c92[_0x2c4a('0x1e')];this['VoiceQueueId']=_0x4c9c92['VoiceQueueId'];this[_0x2c4a('0x1f')]=_0x4c9c92[_0x2c4a('0x1f')];this[_0x2c4a('0x20')]=_0x4c9c92[_0x2c4a('0x20')]||'';this[_0x2c4a('0x21')]=_0x4c9c92['originatecalleridname']||'';this['state']=_0x4c9c92['state'];this['statedesc']=_0x4c9c92[_0x2c4a('0x22')];}module['exports']=History; \ No newline at end of file +var _0x399b=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','exports','../utils','uniqueid','scheduledat'];(function(_0x3bcf9e,_0x148a5d){var _0x1bb37c=function(_0xcaf5da){while(--_0xcaf5da){_0x3bcf9e['push'](_0x3bcf9e['shift']());}};_0x1bb37c(++_0x148a5d);}(_0x399b,0x1de));var _0xb399=function(_0xfcf585,_0x341ab1){_0xfcf585=_0xfcf585-0x0;var _0x3268ae=_0x399b[_0xfcf585];return _0x3268ae;};'use strict';var utils=require(_0xb399('0x0'));function History(_0x293e56){this[_0xb399('0x1')]=_0x293e56['uniqueid'];this['scheduledat']=_0x293e56[_0xb399('0x2')]||undefined;this['type']=_0x293e56[_0xb399('0x3')];this[_0xb399('0x4')]=_0x293e56[_0xb399('0x3')]===_0xb399('0x5')?_0xb399('0x6'):_0x293e56[_0xb399('0x3')];this[_0xb399('0x7')]=_0x293e56['countbusyretry'];this[_0xb399('0x8')]=_0x293e56['countcongestionretry'];this['countnoanswerretry']=_0x293e56[_0xb399('0x9')];this[_0xb399('0xa')]=_0x293e56[_0xb399('0x7')]+_0x293e56['countcongestionretry']+_0x293e56[_0xb399('0x9')]+_0x293e56[_0xb399('0xb')]+_0x293e56[_0xb399('0xc')]+_0x293e56[_0xb399('0xd')]+_0x293e56[_0xb399('0xe')]+_0x293e56[_0xb399('0xf')];this[_0xb399('0xb')]=_0x293e56['countnosuchnumberretry'];this[_0xb399('0xc')]=_0x293e56[_0xb399('0xc')];this[_0xb399('0xd')]=_0x293e56['countabandonedretry'];this[_0xb399('0xe')]=_0x293e56[_0xb399('0xe')];this[_0xb399('0xf')]=_0x293e56[_0xb399('0xf')];this[_0xb399('0x6')]=_0x293e56[_0xb399('0x6')];this['calleridname']=_0x293e56[_0xb399('0x10')];this[_0xb399('0x11')]=_0x293e56[_0xb399('0x12')];this[_0xb399('0x13')]=_0x293e56[_0xb399('0x13')];this[_0xb399('0x14')]=_0x293e56[_0xb399('0x14')];this['endtime']=_0x293e56[_0xb399('0x14')];this[_0xb399('0x15')]=utils[_0xb399('0x16')](_0x293e56[_0xb399('0x14')],_0x293e56[_0xb399('0x13')]);this['holdtime']=0x0;this[_0xb399('0x17')]=0x0;this[_0xb399('0x18')]=_0x293e56[_0xb399('0x18')];this[_0xb399('0x19')]=_0x293e56['callbackuniqueid'];this[_0xb399('0x1a')]=_0x293e56[_0xb399('0x1a')];this[_0xb399('0x1b')]=_0x293e56['recallme'];this[_0xb399('0x1c')]=_0x293e56[_0xb399('0x1c')];this[_0xb399('0x1d')]=_0x293e56[_0xb399('0x1d')];this[_0xb399('0x1e')]=_0x293e56[_0xb399('0x1e')];this[_0xb399('0x1f')]=_0x293e56[_0xb399('0x1f')];this[_0xb399('0x20')]=_0x293e56[_0xb399('0x20')];this['originatecalleridnum']=_0x293e56[_0xb399('0x21')]||'';this[_0xb399('0x22')]=_0x293e56['originatecalleridname']||'';this['state']=_0x293e56['state'];this[_0xb399('0x23')]=_0x293e56[_0xb399('0x23')];}module[_0xb399('0x24')]=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 18338aa..b726f85 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 _0x7ef8=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x184643,_0x10cd17){var _0x449f54=function(_0x4d2447){while(--_0x4d2447){_0x184643['push'](_0x184643['shift']());}};_0x449f54(++_0x10cd17);}(_0x7ef8,0x1f4));var _0x87ef=function(_0x48eb11,_0x2a697c){_0x48eb11=_0x48eb11-0x0;var _0x2b1a9c=_0x7ef8[_0x48eb11];return _0x2b1a9c;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x3ce10b,_0x1d34ae){this[_0x87ef('0x0')]=_0x3ce10b['scheduledat'];this[_0x87ef('0x1')]=_0x3ce10b[_0x87ef('0x1')];this[_0x87ef('0x2')]=_0x3ce10b[_0x87ef('0x1')]===_0x87ef('0x3')?_0x87ef('0x4'):_0x3ce10b[_0x87ef('0x1')];this[_0x87ef('0x5')]=_0x3ce10b[_0x87ef('0x5')];this[_0x87ef('0x6')]=_0x3ce10b[_0x87ef('0x6')];this['countnoanswerretry']=_0x3ce10b[_0x87ef('0x7')];this[_0x87ef('0x8')]=_0x3ce10b['countbusyretry']+_0x3ce10b['countcongestionretry']+_0x3ce10b['countnoanswerretry']+_0x3ce10b['countnosuchnumberretry']+_0x3ce10b[_0x87ef('0x9')]+_0x3ce10b[_0x87ef('0xa')]+_0x3ce10b[_0x87ef('0xb')]+_0x3ce10b[_0x87ef('0xc')];this[_0x87ef('0xd')]=_0x3ce10b[_0x87ef('0xd')];this[_0x87ef('0x9')]=_0x3ce10b[_0x87ef('0x9')];this['countabandonedretry']=_0x3ce10b[_0x87ef('0xa')];this['countmachineretry']=_0x3ce10b['countmachineretry'];this['countagentrejectretry']=_0x3ce10b['countagentrejectretry'];this['uniqueid']=_0x1d34ae[_0x87ef('0xe')];this[_0x87ef('0xf')]=_0x3ce10b[_0x87ef('0x10')];this[_0x87ef('0x11')]=_0x3ce10b[_0x87ef('0x12')];this['starttime']=_0x3ce10b[_0x87ef('0x13')];this[_0x87ef('0x14')]=_0x3ce10b['responsetime'];this[_0x87ef('0x15')]=_0x3ce10b[_0x87ef('0x15')];this[_0x87ef('0x16')]=_0x3ce10b['dropreason'];this[_0x87ef('0x17')]=this[_0x87ef('0x15')];this[_0x87ef('0x18')]=utils['getSeconds'](_0x3ce10b[_0x87ef('0x14')],_0x3ce10b['starttime']);this[_0x87ef('0x19')]=utils[_0x87ef('0x1a')](this[_0x87ef('0x15')],_0x3ce10b[_0x87ef('0x14')]);this[_0x87ef('0x1b')]=0x0;this[_0x87ef('0x4')]=_0x1d34ae[_0x87ef('0x4')];this[_0x87ef('0x1c')]=_0x1d34ae[_0x87ef('0x1d')];this[_0x87ef('0x1e')]=_0x1d34ae[_0x87ef('0x1e')];this[_0x87ef('0x1f')]=_0x3ce10b[_0x87ef('0x1f')];this[_0x87ef('0x20')]=_0x3ce10b[_0x87ef('0x20')];this[_0x87ef('0x21')]=_0x3ce10b[_0x87ef('0x21')];this['recallme']=_0x3ce10b[_0x87ef('0x22')];this[_0x87ef('0x23')]=_0x3ce10b['ContactId'];this[_0x87ef('0x24')]=_0x3ce10b['ListId'];this['UserId']=_0x3ce10b[_0x87ef('0x25')];this['VoiceQueueId']=_0x3ce10b[_0x87ef('0x26')];this[_0x87ef('0x27')]=_0x3ce10b[_0x87ef('0x27')];this[_0x87ef('0x28')]=_0x3ce10b[_0x87ef('0x28')]||'';this[_0x87ef('0x29')]=_0x3ce10b[_0x87ef('0x29')]||'';this['agiafterat']=_0x3ce10b[_0x87ef('0x2a')];this[_0x87ef('0x2b')]=_0x3ce10b[_0x87ef('0x2b')];this['statedesc']=_0x3ce10b[_0x87ef('0x2c')];}module[_0x87ef('0x2d')]=QueueCallerAbandon; \ No newline at end of file +var _0x867d=['countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','talktime','queue','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x3ebf54,_0xe2ddf5){var _0x5cc57f=function(_0x178760){while(--_0x178760){_0x3ebf54['push'](_0x3ebf54['shift']());}};_0x5cc57f(++_0xe2ddf5);}(_0x867d,0x18e));var _0xd867=function(_0x153062,_0x3c67b8){_0x153062=_0x153062-0x0;var _0x43085f=_0x867d[_0x153062];return _0x43085f;};'use strict';var utils=require(_0xd867('0x0'));function QueueCallerAbandon(_0x444c02,_0x85b8ac){this[_0xd867('0x1')]=_0x444c02[_0xd867('0x1')];this[_0xd867('0x2')]=_0x444c02['type'];this[_0xd867('0x3')]=_0x444c02[_0xd867('0x2')]===_0xd867('0x4')?'queue':_0x444c02[_0xd867('0x2')];this[_0xd867('0x5')]=_0x444c02[_0xd867('0x5')];this[_0xd867('0x6')]=_0x444c02[_0xd867('0x6')];this[_0xd867('0x7')]=_0x444c02[_0xd867('0x7')];this['countglobal']=_0x444c02[_0xd867('0x5')]+_0x444c02[_0xd867('0x6')]+_0x444c02[_0xd867('0x7')]+_0x444c02[_0xd867('0x8')]+_0x444c02[_0xd867('0x9')]+_0x444c02[_0xd867('0xa')]+_0x444c02[_0xd867('0xb')]+_0x444c02[_0xd867('0xc')];this[_0xd867('0x8')]=_0x444c02[_0xd867('0x8')];this[_0xd867('0x9')]=_0x444c02['countdropretry'];this['countabandonedretry']=_0x444c02['countabandonedretry'];this['countmachineretry']=_0x444c02[_0xd867('0xb')];this['countagentrejectretry']=_0x444c02[_0xd867('0xc')];this[_0xd867('0xd')]=_0x85b8ac[_0xd867('0xd')];this[_0xd867('0xe')]=_0x444c02['name'];this[_0xd867('0xf')]=_0x444c02[_0xd867('0x10')];this[_0xd867('0x11')]=_0x444c02['starttime'];this['responsetime']=_0x444c02[_0xd867('0x12')];this[_0xd867('0x13')]=_0x444c02[_0xd867('0x13')];this[_0xd867('0x14')]=_0x444c02[_0xd867('0x14')];this[_0xd867('0x15')]=this[_0xd867('0x13')];this['ringtime']=utils[_0xd867('0x16')](_0x444c02[_0xd867('0x12')],_0x444c02[_0xd867('0x11')]);this['holdtime']=utils['getSeconds'](this['droptime'],_0x444c02[_0xd867('0x12')]);this[_0xd867('0x17')]=0x0;this[_0xd867('0x18')]=_0x85b8ac[_0xd867('0x18')];this[_0xd867('0x19')]=_0x85b8ac['connectedlinename'];this[_0xd867('0x1a')]=_0x85b8ac[_0xd867('0x1a')];this[_0xd867('0x1b')]=_0x444c02[_0xd867('0x1b')];this[_0xd867('0x1c')]=_0x444c02[_0xd867('0x1c')];this['callbackat']=_0x444c02['callbackat'];this['recallme']=_0x444c02[_0xd867('0x1d')];this[_0xd867('0x1e')]=_0x444c02[_0xd867('0x1e')];this[_0xd867('0x1f')]=_0x444c02['ListId'];this[_0xd867('0x20')]=_0x444c02['UserId'];this[_0xd867('0x21')]=_0x444c02[_0xd867('0x21')];this[_0xd867('0x22')]=_0x444c02['CampaignId'];this[_0xd867('0x23')]=_0x444c02[_0xd867('0x23')]||'';this['originatecalleridname']=_0x444c02[_0xd867('0x24')]||'';this['agiafterat']=_0x444c02[_0xd867('0x25')];this[_0xd867('0x26')]=_0x444c02[_0xd867('0x26')];this['statedesc']=_0x444c02[_0xd867('0x27')];}module[_0xd867('0x28')]=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 7c1d8ad..3974761 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 _0x2a07=['countReScheduled','rescheduleContact','[rescheduleContact]','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','[getContactDialerIvr]','getContactDialerIvr','[countReScheduled]'];(function(_0x2ee9ff,_0x204ec9){var _0x284368=function(_0x4cd1fd){while(--_0x4cd1fd){_0x2ee9ff['push'](_0x2ee9ff['shift']());}};_0x284368(++_0x204ec9);}(_0x2a07,0x74));var _0x72a0=function(_0x34f8ba,_0x2bb6a8){_0x34f8ba=_0x34f8ba-0x0;var _0xa5ed05=_0x2a07[_0x34f8ba];return _0xa5ed05;};'use strict';var util=require(_0x72a0('0x0'));var logger=require(_0x72a0('0x1'))(_0x72a0('0x2'));var cmHopper=require(_0x72a0('0x3'));var cmHopperAdditionalPhone=require(_0x72a0('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x72a0('0x5'));function inspectError(_0x5f7f29){return util[_0x72a0('0x6')](_0x5f7f29,{'showHidden':![],'depth':null});}function getContactDialer(_0x45b155,_0x431f65,_0xce74c){return cmHopper[_0x72a0('0x7')](_0x45b155['id'],_0x431f65,_0xce74c,_0x45b155[_0x72a0('0x8')])[_0x72a0('0x9')](function(_0x287b06){_0x45b155[_0x72a0('0xa')]=0x0;logger[_0x72a0('0xb')](_0x72a0('0xc'),inspectError(_0x287b06));});}exports[_0x72a0('0x7')]=getContactDialer;function getContactDialerIvr(_0x55b3e9,_0x2bc45b){return cmHopper['getContactDialerIvr'](_0x55b3e9['id'],_0x2bc45b,_0x55b3e9[_0x72a0('0x8')])[_0x72a0('0x9')](function(_0x54abf6){_0x55b3e9[_0x72a0('0xa')]=0x0;logger[_0x72a0('0xb')](_0x72a0('0xd'),inspectError(_0x54abf6));});}exports[_0x72a0('0xe')]=getContactDialerIvr;function countReScheduled(_0x975c27){return cmHopper['countReScheduled'](_0x975c27)[_0x72a0('0x9')](function(_0x335b9f){logger[_0x72a0('0xb')](_0x72a0('0xf'),inspectError(_0x335b9f));});}exports[_0x72a0('0x10')]=countReScheduled;function rescheduleContact(_0x324cbd){return cmHopper[_0x72a0('0x11')](_0x324cbd)['catch'](function(_0x4930c5){logger[_0x72a0('0xb')](_0x72a0('0x12'),inspectError(_0x4930c5));});}exports[_0x72a0('0x11')]=rescheduleContact;function unlockContact(_0x1d1133,_0x23b001,_0x3f3d62){return cmHopper['unlockContact'](_0x1d1133,_0x23b001,_0x3f3d62)[_0x72a0('0x9')](function(_0x2e7552){logger[_0x72a0('0xb')](_0x72a0('0x13'),inspectError(_0x2e7552));});}exports[_0x72a0('0x14')]=unlockContact;function moveContactManagedDialer(_0x54495e){return cmHopper[_0x72a0('0x15')](_0x54495e)[_0x72a0('0x9')](function(_0x131b73){logger['error'](_0x72a0('0x16'),inspectError(_0x131b73));});}exports[_0x72a0('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x30899b){return cmHopperBlack[_0x72a0('0x17')](_0x30899b)['catch'](function(_0x3bc78b){logger['error'](_0x72a0('0x18'),inspectError(_0x3bc78b));});}exports[_0x72a0('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0xde058c){return cmHopperBlack['checkIsBlackListIvr'](_0xde058c)[_0x72a0('0x9')](function(_0x1849d1){logger[_0x72a0('0xb')](_0x72a0('0x19'),inspectError(_0x1849d1));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x38a7ba,_0x390464,_0x1ddd54){return cmHopperAdditionalPhone[_0x72a0('0x1a')](_0x38a7ba,_0x390464,_0x1ddd54)[_0x72a0('0x9')](function(_0x174b1b){logger['error']('[verifyAdditionalPhone]',inspectError(_0x174b1b));});}exports[_0x72a0('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2d8b68,_0x123df4,_0x1504ed){return cmHopperAdditionalPhone[_0x72a0('0x1b')](_0x2d8b68,_0x123df4,_0x1504ed)[_0x72a0('0x9')](function(_0xa5bda0){logger[_0x72a0('0xb')](_0x72a0('0x1c'),inspectError(_0xa5bda0));});}exports[_0x72a0('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x4f9718){return cmHopperHistory[_0x72a0('0x1d')](_0x4f9718)[_0x72a0('0x9')](function(_0xc22d18){logger[_0x72a0('0xb')](_0x72a0('0x1e'),inspectError(_0xc22d18));});}exports[_0x72a0('0x1d')]=avgHandleTime;function createHistory(_0x432179){return cmHopperHistory[_0x72a0('0x1f')](_0x432179)[_0x72a0('0x9')](function(_0x916733){logger['error'](_0x72a0('0x20'),inspectError(_0x916733));});}exports[_0x72a0('0x1f')]=createHistory; \ No newline at end of file +var _0x323f=['[createHistory]','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','catch','temp','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','[getContactDialerIvr]','countReScheduled','rescheduleContact','unlockContact','[unlockContact]','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[avgHandleTime]','avgHandleTime','createHistory'];(function(_0x1191a4,_0x13b5fd){var _0x1a2d8b=function(_0x3a2fff){while(--_0x3a2fff){_0x1191a4['push'](_0x1191a4['shift']());}};_0x1a2d8b(++_0x13b5fd);}(_0x323f,0x1ee));var _0xf323=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x323f[_0x1ac595];return _0x455fff;};'use strict';var util=require('util');var logger=require(_0xf323('0x0'))('dialer');var cmHopper=require(_0xf323('0x1'));var cmHopperAdditionalPhone=require(_0xf323('0x2'));var cmHopperBlack=require(_0xf323('0x3'));var cmHopperHistory=require(_0xf323('0x4'));function inspectError(_0x111042){return util[_0xf323('0x5')](_0x111042,{'showHidden':![],'depth':null});}function getContactDialer(_0xb4caa8,_0x2d4750,_0x3cfee3){return cmHopper[_0xf323('0x6')](_0xb4caa8['id'],_0x2d4750,_0x3cfee3,_0xb4caa8['dialOrderByScheduledAt'])[_0xf323('0x7')](function(_0x444cba){_0xb4caa8[_0xf323('0x8')]=0x0;logger[_0xf323('0x9')](_0xf323('0xa'),inspectError(_0x444cba));});}exports[_0xf323('0x6')]=getContactDialer;function getContactDialerIvr(_0x105b93,_0x2b24a2){return cmHopper[_0xf323('0xb')](_0x105b93['id'],_0x2b24a2,_0x105b93[_0xf323('0xc')])[_0xf323('0x7')](function(_0x4196b5){_0x105b93[_0xf323('0x8')]=0x0;logger[_0xf323('0x9')](_0xf323('0xd'),inspectError(_0x4196b5));});}exports[_0xf323('0xb')]=getContactDialerIvr;function countReScheduled(_0x11a363){return cmHopper['countReScheduled'](_0x11a363)[_0xf323('0x7')](function(_0x7dbd26){logger[_0xf323('0x9')]('[countReScheduled]',inspectError(_0x7dbd26));});}exports[_0xf323('0xe')]=countReScheduled;function rescheduleContact(_0x46e0cc){return cmHopper[_0xf323('0xf')](_0x46e0cc)[_0xf323('0x7')](function(_0x22672e){logger[_0xf323('0x9')]('[rescheduleContact]',inspectError(_0x22672e));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x874219,_0x447517,_0x38fd4c){return cmHopper[_0xf323('0x10')](_0x874219,_0x447517,_0x38fd4c)[_0xf323('0x7')](function(_0x55d87d){logger[_0xf323('0x9')](_0xf323('0x11'),inspectError(_0x55d87d));});}exports[_0xf323('0x10')]=unlockContact;function moveContactManagedDialer(_0x44671c){return cmHopper['moveContactManagedDialer'](_0x44671c)[_0xf323('0x7')](function(_0x272aec){logger[_0xf323('0x9')](_0xf323('0x12'),inspectError(_0x272aec));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x409b16){return cmHopperBlack[_0xf323('0x13')](_0x409b16)['catch'](function(_0x32d7b0){logger[_0xf323('0x9')](_0xf323('0x14'),inspectError(_0x32d7b0));});}exports[_0xf323('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x58e22b){return cmHopperBlack[_0xf323('0x15')](_0x58e22b)[_0xf323('0x7')](function(_0x1c29d9){logger['error'](_0xf323('0x16'),inspectError(_0x1c29d9));});}exports[_0xf323('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3e1c49,_0x3450d6,_0x13ec1f){return cmHopperAdditionalPhone[_0xf323('0x17')](_0x3e1c49,_0x3450d6,_0x13ec1f)[_0xf323('0x7')](function(_0x43bc05){logger[_0xf323('0x9')]('[verifyAdditionalPhone]',inspectError(_0x43bc05));});}exports[_0xf323('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x308073,_0x33dc52,_0x292ce0){return cmHopperAdditionalPhone[_0xf323('0x18')](_0x308073,_0x33dc52,_0x292ce0)[_0xf323('0x7')](function(_0x4d737d){logger[_0xf323('0x9')]('[swapAdditionalPhone]',inspectError(_0x4d737d));});}exports[_0xf323('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x3902eb){return cmHopperHistory['avgHandleTime'](_0x3902eb)[_0xf323('0x7')](function(_0x3c95ce){logger[_0xf323('0x9')](_0xf323('0x19'),inspectError(_0x3c95ce));});}exports[_0xf323('0x1a')]=avgHandleTime;function createHistory(_0x5b8b60){return cmHopperHistory[_0xf323('0x1b')](_0x5b8b60)[_0xf323('0x7')](function(_0x12c7d5){logger[_0xf323('0x9')](_0xf323('0x1c'),inspectError(_0x12c7d5));});}exports[_0xf323('0x1b')]=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 4b89a0a..d4feb64 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 _0x51a0=['undefined','description','XMD-','toUpperCase','substring','moment','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialGlobalInterval','isNil','Intervals','isEmpty','Interval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','tags'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x51a0,0x1d6));var _0x051a=function(_0x1b01f6,_0x57d583){_0x1b01f6=_0x1b01f6-0x0;var _0x1f67af=_0x51a0[_0x1b01f6];return _0x1f67af;};'use strict';var _=require('lodash');var moment=require(_0x051a('0x0'));var util=require('util');var logger=require(_0x051a('0x1'))(_0x051a('0x2'));var timezones=require(_0x051a('0x3'))[_0x051a('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x051a('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x051a('0x6'),'DISACTIVED':_0x051a('0x7'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x051a('0x8'),'NO_AGENTS_LOGGED':_0x051a('0x9'),'NO_AVAILABLE_CONTACTS':_0x051a('0xa'),'NULL_INTERVAL':_0x051a('0xb'),'OVERTIME_INTERVAL':_0x051a('0xc'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x051a('0xd'),'RECALL_TIMEOUT':_0x051a('0xe'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x051a('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x051a('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1a5fe5){return _0x1a5fe5[_0x051a('0x11')]===_0x051a('0x12');}exports[_0x051a('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x43a190){return _0x43a190[_0x051a('0x14')]===_0x051a('0x15');}exports[_0x051a('0x16')]=isIVRCampaign;function isOutboundQueue(_0x2c58d0){return _0x2c58d0[_0x051a('0x14')]===_0x051a('0x17');}exports[_0x051a('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x29832a){return _0x29832a['dialActive'];}exports[_0x051a('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x45001d){return _0x45001d[_0x051a('0x1a')];}exports[_0x051a('0x1b')]=isIVRCampaignActive;function getSeconds(_0x161821,_0x447df0){var _0x3d3f87=moment(_0x161821)[_0x051a('0x1c')](0x0);var _0x13868c=moment(_0x447df0)[_0x051a('0x1c')](0x0);return _0x3d3f87[_0x051a('0x1d')](_0x13868c,_0x051a('0x1e'));}exports[_0x051a('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x2272f5,_0x4e8523){var _0x2f97a9=![];var _0x576a5c=_0x2272f5[_0x051a('0x11')]!==_0x4e8523['dialMethod']||_0x2272f5[_0x051a('0x20')]!==_0x4e8523[_0x051a('0x20')]||_0x2272f5[_0x051a('0x21')]!==_0x4e8523[_0x051a('0x21')];var _0x50460c=_0x2272f5[_0x051a('0x22')]!==_0x4e8523[_0x051a('0x22')]||_0x2272f5[_0x051a('0x23')]!==_0x4e8523[_0x051a('0x23')]||_0x2272f5[_0x051a('0x24')]!==_0x4e8523[_0x051a('0x24')]||_0x2272f5['paused']!==_0x4e8523[_0x051a('0x25')]||_0x2272f5[_0x051a('0x26')]!==_0x4e8523[_0x051a('0x26')]||_0x2272f5['pTalking']!==_0x4e8523[_0x051a('0x27')]||_0x2272f5[_0x051a('0x28')]!==_0x4e8523[_0x051a('0x28')]||_0x2272f5['inUse']!==_0x4e8523[_0x051a('0x29')]||_0x2272f5['originated']!==_0x4e8523[_0x051a('0x2a')];if(_0x2272f5[_0x051a('0x2b')]&&_0x4e8523['Trunk']){_0x2f97a9=_0x2272f5['Trunk']['name']!==_0x4e8523[_0x051a('0x2b')][_0x051a('0x2c')]||_0x2272f5[_0x051a('0x2b')][_0x051a('0x1a')]!==_0x4e8523[_0x051a('0x2b')][_0x051a('0x1a')];}return _0x576a5c||_0x50460c||_0x2f97a9;}exports[_0x051a('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x513737){var _0x391448=null;var _0x5a0d7f=_0x513737['dialTimezone'];if(_['isNil'](_0x513737[_0x051a('0x2e')])||_[_0x051a('0x2f')](_0x513737['Interval'])||_[_0x051a('0x2f')](_0x513737['Interval'][_0x051a('0x30')])){_0x391448=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x051a('0x31')](_0x513737[_0x051a('0x2e')])||_[_0x051a('0x31')](_0x513737[_0x051a('0x32')][_0x051a('0x30')])){_0x391448=CAMPAIGN_STATUS[_0x051a('0x33')];}else if(_0x5a0d7f&&!timezones[_0x5a0d7f]){_0x391448=CAMPAIGN_STATUS[_0x051a('0x34')];}return _0x391448;}function checkAnyValidTrunk(_0x5dc530,_0x552ba4){var _0x4395d4=null;var _0x4088df=_0x051a('0x35');var _0x336bd6=[_0x051a('0x36'),_0x051a('0x37')];var _0xadbf7d=!![];if(_0x5dc530[_0x051a('0x2b')]&&_0x5dc530[_0x051a('0x2b')][_0x051a('0x1a')]){_0x4088df+=_0x5dc530[_0x051a('0x2b')][_0x051a('0x2c')];_0x4395d4=_0x552ba4[_0x4088df];_0xadbf7d=_0x336bd6[_0x051a('0x38')](_0x4395d4[_0x051a('0x39')]);}else if(_0x5dc530[_0x051a('0x3a')]&&_0x5dc530[_0x051a('0x3a')][_0x051a('0x1a')]){_0x4088df+=_0x5dc530['TrunkBackup'][_0x051a('0x2c')];_0x4395d4=_0x552ba4[_0x4088df];_0xadbf7d=_0x336bd6[_0x051a('0x38')](_0x4395d4[_0x051a('0x39')]);}return _0xadbf7d;}function getQueueCampaignStatusMessage(_0x247e24,_0x10e5f1){var _0x1f1e77=CAMPAIGN_STATUS['ACTIVE'];var _0x152760=isPreviewCampaign(_0x247e24);if(!isQueueCampaignActive(_0x247e24)){if(_0x152760){_0x1f1e77=CAMPAIGN_STATUS[_0x051a('0x3b')];}else{if(_0x247e24[_0x051a('0x2a')]===0x0&&_0x247e24[_0x051a('0x26')]===0x0&&_0x247e24['waiting']===0x0&&(_0x247e24[_0x051a('0x27')]||0x0)===0x0){_0x1f1e77=CAMPAIGN_STATUS[_0x051a('0x3b')];}else{_0x1f1e77=CAMPAIGN_STATUS[_0x051a('0x3c')];}}}else if(_0x247e24[_0x051a('0x23')]===0x0){_0x1f1e77=CAMPAIGN_STATUS[_0x051a('0x3d')];}else if(!checkAnyValidTrunk(_0x247e24,_0x10e5f1)){_0x1f1e77=CAMPAIGN_STATUS[_0x051a('0x3e')];}else if(!isPreviewCampaign(_0x247e24)){var _0x6d521c=checkAnyValidQueueCampaignInterval(_0x247e24);if(_0x6d521c){_0x1f1e77=_0x6d521c;}}return _0x1f1e77;}exports[_0x051a('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x54425b){var _0x4324bd=CAMPAIGN_STATUS[_0x051a('0x3c')];if(_0x54425b['originated']===0x0&&_0x54425b[_0x051a('0x26')]===0x0&&_0x54425b['waiting']===0x0&&(_0x54425b[_0x051a('0x27')]||0x0)===0x0){_0x4324bd=CAMPAIGN_STATUS[_0x051a('0x3b')];}return _0x4324bd;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1d3b8a){var _0x74aa3b=_0x1d3b8a[_0x051a('0x40')](/"(.*?)"/);return _0x74aa3b?_0x74aa3b[0x1]:_0x1d3b8a;}exports[_0x051a('0x41')]=extractCalleridName;function getCallerId(_0x4a0df3,_0xd42597,_0xd1c8b7){if(!_[_0x051a('0x42')](_0xd1c8b7)&&typeof _0xd1c8b7===_0x051a('0x43')&&!_[_0x051a('0x31')](_0xd1c8b7)){if(!_[_0x051a('0x42')](_0xd42597)&&typeof _0xd42597===_0x051a('0x43')&&!_['isEmpty'](_0xd42597)){return util[_0x051a('0x44')](_0x051a('0x45'),_0xd42597,_0xd1c8b7);}return util['format'](_0x051a('0x45'),_0xd1c8b7,_0xd1c8b7);}if(!_[_0x051a('0x42')](_0x4a0df3)&&typeof _0x4a0df3===_0x051a('0x43')&&!_[_0x051a('0x31')](_0x4a0df3)){return _0x4a0df3;}return _0x051a('0x46');}exports[_0x051a('0x47')]=getCallerId;function getCallerIdRandom(_0x81f60,_0x5c8e80){var _0x2e0ee7;var _0x4e975e;var _0x5087d2;if(_0x5c8e80<=0x0){_0x5c8e80=0x1;}_0x2e0ee7=new RegExp(_0x051a('0x48')+_0x5c8e80+'}$');_0x4e975e=Math[_0x051a('0x49')](0xa,_0x5c8e80-0x1);_0x5087d2=Math[_0x051a('0x49')](0xa,_0x5c8e80)-0x1;return util[_0x051a('0x44')]('%s',_[_0x051a('0x4a')](_0x81f60,_0x2e0ee7,_[_0x051a('0x4b')](_0x4e975e,_0x5087d2)[_0x051a('0x4c')]()));}exports[_0x051a('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x14733d,_0x563212){if(_0x14733d[_0x051a('0x2a')]&&_0x14733d['originated']>0x0){_0x14733d[_0x051a('0x2a')]-=0x1;}else{logger[_0x051a('0x4e')](_0x051a('0x4f'),_0x563212);}}exports[_0x051a('0x50')]=decrementOriginate;function checkContactEmpty(_0x32c15a){return _0x32c15a&&_0x32c15a[_0x051a('0x51')]>0x0;}exports[_0x051a('0x52')]=checkContactEmpty;function erlangb(_0x5002ef,_0x4d079c){if(_0x4d079c===0x0){return 0x0;}var _0x2c93c0=0x1;for(var _0x2bf221=0x1;_0x2bf221<=_0x4d079c;_0x2bf221+=0x1){_0x2c93c0=0x1+_0x2c93c0*_0x2bf221/_0x5002ef;}return 0x1/_0x2c93c0;}exports[_0x051a('0x53')]=erlangb;function checkContactLowerLimitOriginate(_0x2b8c29,_0x139a71,_0x2a37f5){if(_0x139a71>_0x2a37f5){for(var _0x20682e=0x0;_0x20682e<_0x139a71-_0x2a37f5;_0x20682e+=0x1){decrementOriginate(_0x2b8c29,_0x051a('0x54'));}}}exports[_0x051a('0x55')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x30be10){var _0x4507de={};var _0x25b170=['id',_0x051a('0x56'),_0x051a('0x57'),'updatedAt'];const _0x4d9a27=0xfa;if(_0x30be10){for(var _0x276824 in _0x30be10){if(typeof _0x30be10[_0x276824]!==_0x051a('0x58')){if(!_['isNil'](_0x30be10[_0x276824])&&!_0x25b170[_0x051a('0x38')](_0x276824)){if(_0x276824===_0x051a('0x59')&&_0x30be10[_0x276824][_0x051a('0x51')]>_0x4d9a27){_0x4507de[_0x051a('0x5a')+_0x276824[_0x051a('0x5b')]()]=_0x30be10[_0x276824][_0x051a('0x4c')]()[_0x051a('0x5c')](0x0,_0x4d9a27);}else{_0x4507de[_0x051a('0x5a')+_0x276824[_0x051a('0x5b')]()]=_0x30be10[_0x276824];}}}}}return _0x4507de;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x365c=['Intervals','NULL_INTERVAL','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','toString','error','[decrementOriginate]\x20queue\x20originate\x20value','length','checkContactEmpty','erlangb','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','tags','undefined','XMD-','toUpperCase','setXMDContactVariables','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','ivr','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','isNil','Interval'];(function(_0x570195,_0x5a30b3){var _0xbf388c=function(_0x1a23af){while(--_0x1a23af){_0x570195['push'](_0x570195['shift']());}};_0xbf388c(++_0x5a30b3);}(_0x365c,0x1d5));var _0xc365=function(_0x193068,_0x26e0a1){_0x193068=_0x193068-0x0;var _0x3a9b16=_0x365c[_0x193068];return _0x3a9b16;};'use strict';var _=require('lodash');var moment=require(_0xc365('0x0'));var util=require(_0xc365('0x1'));var logger=require(_0xc365('0x2'))(_0xc365('0x3'));var timezones=require(_0xc365('0x4'))[_0xc365('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xc365('0x6'),'BLACKLIST':_0xc365('0x7'),'CONTACTS_RESCHEDULED':_0xc365('0x8'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xc365('0x9'),'EMPTY_INTERVAL':_0xc365('0xa'),'INACTIVE':_0xc365('0xb'),'NO_AGENTS_LOGGED':_0xc365('0xc'),'NO_AVAILABLE_CONTACTS':_0xc365('0xd'),'NULL_INTERVAL':_0xc365('0xe'),'OVERTIME_INTERVAL':_0xc365('0xf'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xc365('0x10'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xc365('0x11'),'UNKNOWN_TIMEZONE':_0xc365('0x12'),'UNREACHABLE_TRUNK':_0xc365('0x13')};exports[_0xc365('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x16beec){return _0x16beec[_0xc365('0x15')]==='preview';}exports[_0xc365('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x246cf1){return _0x246cf1['type']===_0xc365('0x17');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0xd3f92e){return _0xd3f92e[_0xc365('0x18')]==='outbound';}exports[_0xc365('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x4c8e9e){return _0x4c8e9e[_0xc365('0x1a')];}exports[_0xc365('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0xe3bf3f){return _0xe3bf3f[_0xc365('0x1c')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0xf545a2,_0xf0ed9a){var _0x45a3b6=moment(_0xf545a2)[_0xc365('0x1d')](0x0);var _0x3ae039=moment(_0xf0ed9a)[_0xc365('0x1d')](0x0);return _0x45a3b6[_0xc365('0x1e')](_0x3ae039,_0xc365('0x1f'));}exports[_0xc365('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x1d2287,_0x3880a6){var _0xd83b7=![];var _0xd88334=_0x1d2287['dialMethod']!==_0x3880a6[_0xc365('0x15')]||_0x1d2287[_0xc365('0x1a')]!==_0x3880a6[_0xc365('0x1a')]||_0x1d2287[_0xc365('0x21')]!==_0x3880a6[_0xc365('0x21')];var _0x135f24=_0x1d2287['available']!==_0x3880a6[_0xc365('0x22')]||_0x1d2287[_0xc365('0x23')]!==_0x3880a6['loggedIn']||_0x1d2287[_0xc365('0x24')]!==_0x3880a6[_0xc365('0x24')]||_0x1d2287['paused']!==_0x3880a6[_0xc365('0x25')]||_0x1d2287[_0xc365('0x26')]!==_0x3880a6['talking']||_0x1d2287['pTalking']!==_0x3880a6[_0xc365('0x27')]||_0x1d2287[_0xc365('0x28')]!==_0x3880a6[_0xc365('0x28')]||_0x1d2287[_0xc365('0x29')]!==_0x3880a6[_0xc365('0x29')]||_0x1d2287['originated']!==_0x3880a6[_0xc365('0x2a')];if(_0x1d2287['Trunk']&&_0x3880a6[_0xc365('0x2b')]){_0xd83b7=_0x1d2287[_0xc365('0x2b')][_0xc365('0x2c')]!==_0x3880a6['Trunk'][_0xc365('0x2c')]||_0x1d2287['Trunk'][_0xc365('0x1c')]!==_0x3880a6['Trunk']['active'];}return _0xd88334||_0x135f24||_0xd83b7;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x257602){var _0x5abb2d=null;var _0x14ddc0=_0x257602['dialTimezone'];if(_[_0xc365('0x2d')](_0x257602['dialGlobalInterval'])||_[_0xc365('0x2d')](_0x257602[_0xc365('0x2e')])||_[_0xc365('0x2d')](_0x257602[_0xc365('0x2e')][_0xc365('0x2f')])){_0x5abb2d=CAMPAIGN_STATUS[_0xc365('0x30')];}else if(_[_0xc365('0x31')](_0x257602[_0xc365('0x32')])||_[_0xc365('0x31')](_0x257602[_0xc365('0x2e')][_0xc365('0x2f')])){_0x5abb2d=CAMPAIGN_STATUS[_0xc365('0x33')];}else if(_0x14ddc0&&!timezones[_0x14ddc0]){_0x5abb2d=CAMPAIGN_STATUS[_0xc365('0x34')];}return _0x5abb2d;}function checkAnyValidTrunk(_0xd24fd9,_0x4b41af){var _0x1a87d6=null;var _0x54de97=_0xc365('0x35');var _0x294f5d=[_0xc365('0x36'),_0xc365('0x37')];var _0x26f0e0=!![];if(_0xd24fd9[_0xc365('0x2b')]&&_0xd24fd9[_0xc365('0x2b')][_0xc365('0x1c')]){_0x54de97+=_0xd24fd9[_0xc365('0x2b')]['name'];_0x1a87d6=_0x4b41af[_0x54de97];_0x26f0e0=_0x294f5d['includes'](_0x1a87d6[_0xc365('0x38')]);}else if(_0xd24fd9['TrunkBackup']&&_0xd24fd9[_0xc365('0x39')][_0xc365('0x1c')]){_0x54de97+=_0xd24fd9['TrunkBackup'][_0xc365('0x2c')];_0x1a87d6=_0x4b41af[_0x54de97];_0x26f0e0=_0x294f5d[_0xc365('0x3a')](_0x1a87d6['status']);}return _0x26f0e0;}function getQueueCampaignStatusMessage(_0x2792bf,_0x102fbd){var _0x54656f=CAMPAIGN_STATUS['ACTIVE'];var _0x3ef0da=isPreviewCampaign(_0x2792bf);if(!isQueueCampaignActive(_0x2792bf)){if(_0x3ef0da){_0x54656f=CAMPAIGN_STATUS[_0xc365('0x3b')];}else{if(_0x2792bf['originated']===0x0&&_0x2792bf['talking']===0x0&&_0x2792bf[_0xc365('0x28')]===0x0&&(_0x2792bf[_0xc365('0x27')]||0x0)===0x0){_0x54656f=CAMPAIGN_STATUS[_0xc365('0x3b')];}else{_0x54656f=CAMPAIGN_STATUS[_0xc365('0x3c')];}}}else if(_0x2792bf['loggedIn']===0x0){_0x54656f=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x2792bf,_0x102fbd)){_0x54656f=CAMPAIGN_STATUS[_0xc365('0x3d')];}else if(!isPreviewCampaign(_0x2792bf)){var _0x4c715e=checkAnyValidQueueCampaignInterval(_0x2792bf);if(_0x4c715e){_0x54656f=_0x4c715e;}}return _0x54656f;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5b88f){var _0x4ac3c3=CAMPAIGN_STATUS[_0xc365('0x3c')];if(_0x5b88f[_0xc365('0x2a')]===0x0&&_0x5b88f[_0xc365('0x26')]===0x0&&_0x5b88f['waiting']===0x0&&(_0x5b88f[_0xc365('0x27')]||0x0)===0x0){_0x4ac3c3=CAMPAIGN_STATUS[_0xc365('0x3b')];}return _0x4ac3c3;}exports[_0xc365('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x55bc44){var _0x3034df=_0x55bc44[_0xc365('0x3f')](/"(.*?)"/);return _0x3034df?_0x3034df[0x1]:_0x55bc44;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x96d764,_0x253599,_0x4f7d20){if(!_[_0xc365('0x40')](_0x4f7d20)&&typeof _0x4f7d20==='string'&&!_[_0xc365('0x31')](_0x4f7d20)){if(!_[_0xc365('0x40')](_0x253599)&&typeof _0x253599===_0xc365('0x41')&&!_[_0xc365('0x31')](_0x253599)){return util[_0xc365('0x42')](_0xc365('0x43'),_0x253599,_0x4f7d20);}return util[_0xc365('0x42')](_0xc365('0x43'),_0x4f7d20,_0x4f7d20);}if(!_[_0xc365('0x40')](_0x96d764)&&typeof _0x96d764==='string'&&!_[_0xc365('0x31')](_0x96d764)){return _0x96d764;}return _0xc365('0x44');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x3513e3,_0x3ec7f5){var _0x57d9f9;var _0x4a0b9f;var _0x479380;if(_0x3ec7f5<=0x0){_0x3ec7f5=0x1;}_0x57d9f9=new RegExp(_0xc365('0x45')+_0x3ec7f5+'}$');_0x4a0b9f=Math[_0xc365('0x46')](0xa,_0x3ec7f5-0x1);_0x479380=Math['pow'](0xa,_0x3ec7f5)-0x1;return util[_0xc365('0x42')]('%s',_[_0xc365('0x47')](_0x3513e3,_0x57d9f9,_['random'](_0x4a0b9f,_0x479380)[_0xc365('0x48')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x15bbcc,_0x127639){if(_0x15bbcc[_0xc365('0x2a')]&&_0x15bbcc['originated']>0x0){_0x15bbcc[_0xc365('0x2a')]-=0x1;}else{logger[_0xc365('0x49')](_0xc365('0x4a'),_0x127639);}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x55e770){return _0x55e770&&_0x55e770[_0xc365('0x4b')]>0x0;}exports[_0xc365('0x4c')]=checkContactEmpty;function erlangb(_0x253ff9,_0x5f1c32){if(_0x5f1c32===0x0){return 0x0;}var _0x47d68f=0x1;for(var _0x48f8ff=0x1;_0x48f8ff<=_0x5f1c32;_0x48f8ff+=0x1){_0x47d68f=0x1+_0x47d68f*_0x48f8ff/_0x253ff9;}return 0x1/_0x47d68f;}exports[_0xc365('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x2a7d04,_0x25f3f6,_0x12eb0d){if(_0x25f3f6>_0x12eb0d){for(var _0x57a088=0x0;_0x57a088<_0x25f3f6-_0x12eb0d;_0x57a088+=0x1){decrementOriginate(_0x2a7d04,_0xc365('0x4e'));}}}exports[_0xc365('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x174042){var _0x1770d2={};var _0x11c222=['id',_0xc365('0x50'),_0xc365('0x51'),'updatedAt'];const _0x502367=0xfa;if(_0x174042){for(var _0x1e3a03 in _0x174042){if(typeof _0x174042[_0x1e3a03]!==_0xc365('0x52')){if(!_[_0xc365('0x2d')](_0x174042[_0x1e3a03])&&!_0x11c222['includes'](_0x1e3a03)){if(_0x1e3a03==='description'&&_0x174042[_0x1e3a03]['length']>_0x502367){_0x1770d2[_0xc365('0x53')+_0x1e3a03[_0xc365('0x54')]()]=_0x174042[_0x1e3a03][_0xc365('0x48')]()['substring'](0x0,_0x502367);}else{_0x1770d2['XMD-'+_0x1e3a03[_0xc365('0x54')]()]=_0x174042[_0x1e3a03];}}}}}return _0x1770d2;}exports[_0xc365('0x55')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 42dac5a..576bec9 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(_0x376ee6,_0x46f408){var _0x9fe2f8=function(_0x34a466){while(--_0x34a466){_0x376ee6['push'](_0x376ee6['shift']());}};_0x9fe2f8(++_0x46f408);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x218eba,_0x50b220){var _0x557b2b=function(_0x5c28ae){while(--_0x5c28ae){_0x218eba['push'](_0x218eba['shift']());}};_0x557b2b(++_0x50b220);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 e61309f..86dd8b6 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 _0xa7db=['syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','.pdf','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','deleteChannelAfterTimeout','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','bind','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup'];(function(_0xa4e3e0,_0x2f9e36){var _0x434853=function(_0x560b72){while(--_0x560b72){_0xa4e3e0['push'](_0xa4e3e0['shift']());}};_0x434853(++_0x2f9e36);}(_0xa7db,0xd9));var _0xba7d=function(_0x2ce166,_0x809765){_0x2ce166=_0x2ce166-0x0;var _0x221f17=_0xa7db[_0x2ce166];return _0x221f17;};'use strict';var util=require('util');var _=require(_0xba7d('0x0'));var BPromise=require(_0xba7d('0x1'));var uuid=require(_0xba7d('0x2'));var moment=require(_0xba7d('0x3'));var path=require(_0xba7d('0x4'));var tiff2pdf=require(_0xba7d('0x5'));var gs=require(_0xba7d('0x6'));var logger=require(_0xba7d('0x7'))('fax');var ami=require(_0xba7d('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0xba7d('0x9'));var ut=require(_0xba7d('0xa'));var Action=require(_0xba7d('0xb'));var faxAccount=require(_0xba7d('0xc'));var attachment=require(_0xba7d('0xd'));var faxMessage=require(_0xba7d('0xe'));function Fax(_0xe3635f){this['channels']={};this[_0xba7d('0xf')]=_0xe3635f[_0xba7d('0xf')];this[_0xba7d('0x10')]=_0xe3635f[_0xba7d('0x10')];this[_0xba7d('0x11')]={};ami['on'](_0xba7d('0x12'),this[_0xba7d('0x13')]['bind'](this));ami['on'](_0xba7d('0x14'),this[_0xba7d('0x15')]['bind'](this));ami['on'](_0xba7d('0x16'),this[_0xba7d('0x17')][_0xba7d('0x18')](this));ami['on'](_0xba7d('0x19'),this[_0xba7d('0x1a')]['bind'](this));ami['on']('faxstatus',this[_0xba7d('0x1b')]['bind'](this));ami['on'](_0xba7d('0x1c'),this[_0xba7d('0x1d')][_0xba7d('0x18')](this));ami['on'](_0xba7d('0x1e'),this[_0xba7d('0x1f')][_0xba7d('0x18')](this));ami['on'](_0xba7d('0x20'),this[_0xba7d('0x21')]['bind'](this));}Fax[_0xba7d('0x22')][_0xba7d('0x13')]=function(_0x2936a3){if(_0x2936a3[_0xba7d('0x23')]===_0xba7d('0x24')){for(var _0x429e09 in this[_0xba7d('0xf')]){if(this['faxAccounts'][_0xba7d('0x25')](_0x429e09)){if(_0x2936a3[_0xba7d('0x26')]===this[_0xba7d('0xf')][_0x429e09][_0xba7d('0x27')]){this[_0xba7d('0x28')][_0x2936a3[_0xba7d('0x29')]]={};this[_0xba7d('0x28')][_0x2936a3['uniqueid']][_0xba7d('0x2a')]=_0x2936a3[_0xba7d('0x2a')];this[_0xba7d('0x28')][_0x2936a3[_0xba7d('0x29')]]['id']=this[_0xba7d('0xf')][_0x429e09]['id'];this['channels'][_0x2936a3[_0xba7d('0x29')]]['name']=this[_0xba7d('0xf')][_0x429e09][_0xba7d('0x2b')];logger[_0xba7d('0x2c')](_0x2936a3[_0xba7d('0x29')],_0xba7d('0x2d'));}}}}if(this[_0xba7d('0x11')][_0x2936a3['uniqueid']]){this['channels'][_0x2936a3['uniqueid']]={};this[_0xba7d('0x28')][_0x2936a3[_0xba7d('0x29')]]['channel']=_0x2936a3['channel'];logger[_0xba7d('0x2c')](_0x2936a3['uniqueid'],_0xba7d('0x2d'));}};Fax['prototype']['syncVarSet']=function(_0x5f1b3){if(this[_0xba7d('0x28')][_0x5f1b3[_0xba7d('0x29')]]){for(var _0x11f646 in _0x5f1b3[_0xba7d('0x2e')]){if(_0x5f1b3[_0xba7d('0x2e')][_0xba7d('0x25')](_0x11f646)){this[_0xba7d('0x28')][_0x5f1b3['uniqueid']][_0x11f646]=_0x5f1b3['value'];}}}};Fax[_0xba7d('0x22')][_0xba7d('0x17')]=function(_0x15acbb){if(this[_0xba7d('0x28')][_0x15acbb[_0xba7d('0x29')]]){this[_0xba7d('0x28')][_0x15acbb[_0xba7d('0x29')]][_0xba7d('0x2f')]=_0x15acbb[_0xba7d('0x2f')];this['channels'][_0x15acbb[_0xba7d('0x29')]][_0xba7d('0x30')]=_0x15acbb[_0xba7d('0x30')];}};Fax['prototype'][_0xba7d('0x1a')]=function(_0x396207){if(this[_0xba7d('0x28')][_0x396207[_0xba7d('0x29')]]){for(var _0x3cee26 in _0x396207[_0xba7d('0x2e')]){if(_0x396207[_0xba7d('0x2e')]['hasOwnProperty'](_0x3cee26)){this[_0xba7d('0x28')][_0x396207[_0xba7d('0x29')]][_0x3cee26]=_0x396207[_0xba7d('0x31')];}}}};Fax[_0xba7d('0x22')]['syncFaxStatus']=function(_0x4f1ec2){if(this[_0xba7d('0x28')][_0x4f1ec2[_0xba7d('0x29')]]){this[_0xba7d('0x28')][_0x4f1ec2[_0xba7d('0x29')]][_0xba7d('0x32')]=_0x4f1ec2['operation'];this['channels'][_0x4f1ec2[_0xba7d('0x29')]][_0xba7d('0x33')]=_0x4f1ec2[_0xba7d('0x33')];this['channels'][_0x4f1ec2[_0xba7d('0x29')]][_0xba7d('0x27')]=_0x4f1ec2[_0xba7d('0x27')];this['channels'][_0x4f1ec2[_0xba7d('0x29')]][_0xba7d('0x34')]=_0x4f1ec2['filename'];logger['info'](_0x4f1ec2[_0xba7d('0x29')],_0xba7d('0x35'));}};Fax[_0xba7d('0x22')]['syncReceiveFax']=function(_0x49b5f3){var _0x84bd80=this;if(this[_0xba7d('0x28')][_0x49b5f3['uniqueid']]){var _0x8b18bd=this[_0xba7d('0x28')][_0x49b5f3[_0xba7d('0x29')]]['id'];this['channels'][_0x49b5f3['uniqueid']]['remotestationid']=_0x49b5f3[_0xba7d('0x36')];this[_0xba7d('0x28')][_0x49b5f3['uniqueid']]['pagestransferred']=_0x49b5f3[_0xba7d('0x37')];this[_0xba7d('0x28')][_0x49b5f3[_0xba7d('0x29')]]['localstationid']=_0x49b5f3['localstationid'];this['channels'][_0x49b5f3['uniqueid']]['resolution']=_0x49b5f3[_0xba7d('0x38')];this[_0xba7d('0x28')][_0x49b5f3[_0xba7d('0x29')]][_0xba7d('0x39')]=_0x49b5f3[_0xba7d('0x39')];this[_0xba7d('0x28')][_0x49b5f3[_0xba7d('0x29')]][_0xba7d('0x34')]=_0x49b5f3['filename'];this[_0xba7d('0x28')][_0x49b5f3[_0xba7d('0x29')]][_0xba7d('0x3a')]=_0x49b5f3['calleridnum'];if(this['channels'][_0x49b5f3[_0xba7d('0x29')]][_0xba7d('0x37')]>0x0){tiff2pdf(_0x49b5f3[_0xba7d('0x34')],_0xba7d('0x3b'),function(_0x3e4d4b){logger[_0xba7d('0x2c')](_0x49b5f3[_0xba7d('0x29')],_0xba7d('0x3c'),_0x3e4d4b[_0xba7d('0x3d')]);attachment[_0xba7d('0x3e')]({'name':path[_0xba7d('0x3f')](_0x49b5f3[_0xba7d('0x34')])['name'],'basename':path['parse'](_0x49b5f3[_0xba7d('0x34')])[_0xba7d('0x2b')]+'.pdf','type':_0xba7d('0x40')})[_0xba7d('0x41')](function(_0xd7d598){faxAccount['notify'](_0x8b18bd,{'from':_0x49b5f3[_0xba7d('0x3a')],'mapKey':'fax','body':path['parse'](_0x49b5f3[_0xba7d('0x34')])['name']+_0xba7d('0x42'),'AttachmentId':_0xd7d598['id']})['catch'](function(_0x505571){logger[_0xba7d('0x43')](_0x49b5f3[_0xba7d('0x29')],_0xba7d('0x44'),JSON['stringify'](_0x505571));});})['catch'](function(_0x3bde4b){logger['error'](_0x49b5f3[_0xba7d('0x29')],_0xba7d('0x45'),JSON[_0xba7d('0x46')](_0x3bde4b));});});}logger['info'](_0x49b5f3[_0xba7d('0x29')],'\x20receiveFax\x20');}};Fax[_0xba7d('0x22')]['syncOriginateResponse']=function(_0x1c1b8e){if(this['actions'][_0x1c1b8e[_0xba7d('0x29')]]){_[_0xba7d('0x47')](this[_0xba7d('0x28')][_0x1c1b8e[_0xba7d('0x29')]],_['pick'](_0x1c1b8e,[_0xba7d('0x48'),_0xba7d('0x49')]));}};function updateStatus(_0x16a27f){if(_0x16a27f['AttachmentId']){faxMessage[_0xba7d('0x4a')](_0x16a27f[_0xba7d('0x4b')],{'failMessage':_0xba7d('0x4c')})[_0xba7d('0x41')](function(_0x52e60a){ut[_0xba7d('0x4d')](_0xba7d('0x4e'),_0x52e60a);})[_0xba7d('0x4f')](function(_0x436271){ut[_0xba7d('0x4d')](_0xba7d('0x50'),_0x436271);});}else{ut['logger'](_0xba7d('0x51'));}}Fax[_0xba7d('0x22')][_0xba7d('0x52')]=function(_0x2a6b17,_0x897bc3,_0x235c15){var _0xdc8463=this;var _0x59d659={};if(_0x897bc3){_0x59d659={'read':_0x897bc3};}else{_0x59d659={'failMessage':_0x235c15};}if(this['actions'][_0x2a6b17][_0xba7d('0x4b')]){faxMessage[_0xba7d('0x4a')](this[_0xba7d('0x11')][_0x2a6b17][_0xba7d('0x4b')],_0x59d659)[_0xba7d('0x41')](function(_0xd6c328){ut['logger'](_0xba7d('0x53'),_0xd6c328);})['catch'](function(_0x2fcc31){ut['logger'](_0xba7d('0x54'),_0x2fcc31);})['finally'](function(){delete _0xdc8463[_0xba7d('0x28')][_0x2a6b17];delete _0xdc8463[_0xba7d('0x11')][_0x2a6b17];});}else{ut[_0xba7d('0x4d')](_0xba7d('0x55'));this['deleteChannelAfterTimeout'](_0x2a6b17);delete this[_0xba7d('0x11')][_0x2a6b17];}};Fax[_0xba7d('0x22')]['syncHangup']=function(_0x6e006e){var _0x40fe3e=this;if(this[_0xba7d('0x28')][_0x6e006e['uniqueid']]){if(this['actions'][_0x6e006e[_0xba7d('0x29')]]){this[_0xba7d('0x28')][_0x6e006e[_0xba7d('0x29')]]['id']=this[_0xba7d('0x11')][_0x6e006e[_0xba7d('0x29')]]['id'];this[_0xba7d('0x28')][_0x6e006e[_0xba7d('0x29')]]['name']=this[_0xba7d('0x11')][_0x6e006e['uniqueid']][_0xba7d('0x2b')];}logger[_0xba7d('0x2c')](_0x6e006e['uniqueid'],this[_0xba7d('0x11')][_0x6e006e[_0xba7d('0x29')]]?_0xba7d('0x56'):_0xba7d('0x57'),JSON['stringify'](this[_0xba7d('0x28')][_0x6e006e['uniqueid']]));if(this[_0xba7d('0x11')][_0x6e006e[_0xba7d('0x29')]]){if(this[_0xba7d('0x28')][_0x6e006e[_0xba7d('0x29')]]['faxpages']>0x0&&this['channels'][_0x6e006e[_0xba7d('0x29')]][_0xba7d('0x58')]==='SUCCESS'){this[_0xba7d('0x52')](_0x6e006e[_0xba7d('0x29')],!![]);}else{this['updateStatus'](_0x6e006e[_0xba7d('0x29')],![],this[_0xba7d('0x28')][_0x6e006e[_0xba7d('0x29')]][_0xba7d('0x59')]?_0xba7d('0x5a')+this[_0xba7d('0x28')][_0x6e006e['uniqueid']][_0xba7d('0x59')]:_0xba7d('0x5b'));}}}};Fax[_0xba7d('0x22')][_0xba7d('0x5c')]=function(_0x311b2f){var _0x2f0346=this;return new BPromise(function(_0x1218c9,_0x23eab9){_0x2f0346[_0xba7d('0x5d')](_0x311b2f,_0x2f0346['faxAccounts'][_0x311b2f[_0xba7d('0x5e')]])[_0xba7d('0x41')](function(_0x4202ac){ut[_0xba7d('0x4d')]('[Fax][execOriginate][success]',_0x4202ac);_0x1218c9(ut[_0xba7d('0x3d')](_0xba7d('0x5f')));})[_0xba7d('0x4f')](function(_0xd3adec){ut[_0xba7d('0x4d')](_0xba7d('0x60'),_0xd3adec);updateStatus(_0x311b2f);_0x23eab9(ut[_0xba7d('0x3d')](_0xba7d('0x61')));});});};Fax[_0xba7d('0x22')]['checkAfterSend']=function(_0x1ae58c){var _0x16c32f=this;return new BPromise(function(_0x17ae3a,_0x18a547){var _0x4db552=_0x16c32f[_0xba7d('0x62')](_0x16c32f[_0xba7d('0xf')][_0x1ae58c[_0xba7d('0x5e')]]['Trunk'],_0x1ae58c);if(_0x4db552[_0xba7d('0x63')]){_0x17ae3a(ut['message'](_0xba7d('0x64')));}else{_0x18a547(ut[_0xba7d('0x3d')](_0x4db552[_0xba7d('0x3d')]));}});};function originate(_0x5bacb9,_0x298e29,_0x4d6181){return new BPromise(function(_0x7de00a,_0x3643cb){if(_0x4d6181){var _0x3c1ac2=util[_0xba7d('0x65')](_0xba7d('0x66'),path['parse'](_0x5bacb9[_0xba7d('0x4')])[_0xba7d('0x2b')],_0x5bacb9[_0xba7d('0x4')]);gs['execute'](_0x3c1ac2)[_0xba7d('0x41')](function(){_0x5bacb9[_0xba7d('0x4')]=util['format'](_0xba7d('0x67'),path[_0xba7d('0x3f')](_0x5bacb9[_0xba7d('0x4')])[_0xba7d('0x68')],path[_0xba7d('0x3f')](_0x5bacb9[_0xba7d('0x4')])['name']);_0x298e29[_0xba7d('0x69')]=_0x5bacb9[_0xba7d('0x4')];ut[_0xba7d('0x4d')](_0xba7d('0x6a'),'');ami[_0xba7d('0x6b')](ut[_0xba7d('0x6c')](_0x5bacb9,_0x298e29))[_0xba7d('0x41')](function(_0x3f4a30){_0x7de00a(_0x3f4a30);})[_0xba7d('0x4f')](function(_0xb31931){_0x3643cb(_0xb31931);});})[_0xba7d('0x4f')](function(_0x12f42e){_0x3643cb(_0x12f42e);});}else{ami[_0xba7d('0x6b')](ut[_0xba7d('0x6c')](_0x5bacb9,_0x298e29))[_0xba7d('0x41')](function(_0x26d507){_0x7de00a(_0x26d507);})[_0xba7d('0x4f')](function(_0x41176e){_0x3643cb(_0x41176e);});}});}Fax[_0xba7d('0x22')][_0xba7d('0x5d')]=function(_0x39dce5,_0xada54f){var _0x24fbf9=this;return new BPromise(function(_0x3b0e9e,_0x4248ec){var _0x64c8c0=uuid['v4']();var _0x2a550f=ut[_0xba7d('0x6d')](_0x39dce5,_0xada54f);_0x24fbf9[_0xba7d('0x11')][_0x64c8c0]=new Action(_0x64c8c0,_0xada54f,_0x39dce5);var _0x33230d=_0x24fbf9[_0xba7d('0x11')][_0x64c8c0];if(path['parse'](_0x39dce5[_0xba7d('0x4')])['ext']===_0xba7d('0x42')){originate(_0x33230d,_0x2a550f,!![])[_0xba7d('0x41')](function(_0x2667cb){_0x3b0e9e(_0x2667cb);})[_0xba7d('0x4f')](function(_0x564208){_0x4248ec(_0x564208);});}else{originate(_0x33230d,_0x2a550f,![])['then'](function(_0x25a748){_0x3b0e9e(_0x25a748);})[_0xba7d('0x4f')](function(_0x551b98){_0x4248ec(_0x551b98);});}});};Fax[_0xba7d('0x22')]['isTrunkReachable']=function(_0x481ada){return!_[_0xba7d('0x6e')](_0x481ada)&&!_['isNil'](_0x481ada['name'])&&!_[_0xba7d('0x6e')](_0x481ada[_0xba7d('0x6f')])&&_0x481ada[_0xba7d('0x6f')]&&!_[_0xba7d('0x6e')](this['trunks'][util[_0xba7d('0x65')](_0xba7d('0x70'),_0x481ada[_0xba7d('0x2b')])])&&!_[_0xba7d('0x6e')](this[_0xba7d('0x10')][util['format'](_0xba7d('0x70'),_0x481ada[_0xba7d('0x2b')])][_0xba7d('0x33')])&&(this[_0xba7d('0x10')][util['format'](_0xba7d('0x70'),_0x481ada[_0xba7d('0x2b')])][_0xba7d('0x33')]===_0xba7d('0x71')||this[_0xba7d('0x10')][util[_0xba7d('0x65')](_0xba7d('0x70'),_0x481ada[_0xba7d('0x2b')])][_0xba7d('0x33')]===_0xba7d('0x72'));};Fax[_0xba7d('0x22')][_0xba7d('0x62')]=function(_0x483102,_0x28b50f){if(!this[_0xba7d('0x73')](_0x483102)){ut[_0xba7d('0x4d')](_0xba7d('0x74'),_[_0xba7d('0x6e')](_0x483102)?'':_0x483102['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0x28b50f[_0xba7d('0x75')])){ut[_0xba7d('0x4d')](_0xba7d('0x76'),JSON[_0xba7d('0x46')](_0x28b50f));return{'isValid':![],'message':_0xba7d('0x77')};}if(_[_0xba7d('0x6e')](_0x28b50f[_0xba7d('0x4')])){ut[_0xba7d('0x4d')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xba7d('0x46')](_0x28b50f));return{'isValid':![],'message':_0xba7d('0x78')};}return{'isValid':!![],'message':_0xba7d('0x79')};};Fax[_0xba7d('0x22')][_0xba7d('0x7a')]=function(_0x5e173b,_0x5e491e=0x2710){if(this['channels'][_0x5e173b]){setTimeout(()=>{delete this['channels'][_0x5e173b];},_0x5e491e);}};module[_0xba7d('0x7b')]=Fax; \ No newline at end of file +var _0x7cf8=['syncFaxStatus','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','name','\x20syncNewchannel\x20','channel','info','variable','syncNewState','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','response','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','deleteChannelAfterTimeout','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','FaxAccountId','Trunk','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newexten','syncNewExten'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0x7cf8,0xcd));var _0x87cf=function(_0x226a21,_0x1f7097){_0x226a21=_0x226a21-0x0;var _0x2ef047=_0x7cf8[_0x226a21];return _0x2ef047;};'use strict';var util=require(_0x87cf('0x0'));var _=require(_0x87cf('0x1'));var BPromise=require(_0x87cf('0x2'));var uuid=require(_0x87cf('0x3'));var moment=require(_0x87cf('0x4'));var path=require(_0x87cf('0x5'));var tiff2pdf=require(_0x87cf('0x6'));var gs=require(_0x87cf('0x7'));var logger=require('../../../config/logger')(_0x87cf('0x8'));var ami=require(_0x87cf('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0x87cf('0xa'));var ut=require(_0x87cf('0xb'));var Action=require(_0x87cf('0xc'));var faxAccount=require(_0x87cf('0xd'));var attachment=require(_0x87cf('0xe'));var faxMessage=require(_0x87cf('0xf'));function Fax(_0x5e1a8d){this['channels']={};this[_0x87cf('0x10')]=_0x5e1a8d['faxAccounts'];this[_0x87cf('0x11')]=_0x5e1a8d[_0x87cf('0x11')];this[_0x87cf('0x12')]={};ami['on']('newchannel',this[_0x87cf('0x13')][_0x87cf('0x14')](this));ami['on'](_0x87cf('0x15'),this[_0x87cf('0x16')][_0x87cf('0x14')](this));ami['on']('newstate',this['syncNewState'][_0x87cf('0x14')](this));ami['on'](_0x87cf('0x17'),this[_0x87cf('0x18')]['bind'](this));ami['on']('faxstatus',this[_0x87cf('0x19')][_0x87cf('0x14')](this));ami['on']('receivefax',this[_0x87cf('0x1a')][_0x87cf('0x14')](this));ami['on'](_0x87cf('0x1b'),this[_0x87cf('0x1c')][_0x87cf('0x14')](this));ami['on']('originateresponse',this[_0x87cf('0x1d')]['bind'](this));}Fax[_0x87cf('0x1e')][_0x87cf('0x13')]=function(_0x190b41){if(_0x190b41[_0x87cf('0x1f')]===_0x87cf('0x20')){for(var _0x135429 in this[_0x87cf('0x10')]){if(this[_0x87cf('0x10')][_0x87cf('0x21')](_0x135429)){if(_0x190b41[_0x87cf('0x22')]===this[_0x87cf('0x10')][_0x135429]['localstationid']){this[_0x87cf('0x23')][_0x190b41['uniqueid']]={};this['channels'][_0x190b41[_0x87cf('0x24')]]['channel']=_0x190b41['channel'];this[_0x87cf('0x23')][_0x190b41[_0x87cf('0x24')]]['id']=this['faxAccounts'][_0x135429]['id'];this[_0x87cf('0x23')][_0x190b41['uniqueid']][_0x87cf('0x25')]=this[_0x87cf('0x10')][_0x135429][_0x87cf('0x25')];logger['info'](_0x190b41['uniqueid'],_0x87cf('0x26'));}}}}if(this[_0x87cf('0x12')][_0x190b41[_0x87cf('0x24')]]){this[_0x87cf('0x23')][_0x190b41[_0x87cf('0x24')]]={};this[_0x87cf('0x23')][_0x190b41[_0x87cf('0x24')]]['channel']=_0x190b41[_0x87cf('0x27')];logger[_0x87cf('0x28')](_0x190b41['uniqueid'],_0x87cf('0x26'));}};Fax['prototype'][_0x87cf('0x16')]=function(_0x30a86b){if(this[_0x87cf('0x23')][_0x30a86b[_0x87cf('0x24')]]){for(var _0x2a987d in _0x30a86b[_0x87cf('0x29')]){if(_0x30a86b[_0x87cf('0x29')][_0x87cf('0x21')](_0x2a987d)){this['channels'][_0x30a86b[_0x87cf('0x24')]][_0x2a987d]=_0x30a86b['value'];}}}};Fax['prototype'][_0x87cf('0x2a')]=function(_0x2e6e2e){if(this['channels'][_0x2e6e2e[_0x87cf('0x24')]]){this['channels'][_0x2e6e2e[_0x87cf('0x24')]][_0x87cf('0x2b')]=_0x2e6e2e['channelstate'];this[_0x87cf('0x23')][_0x2e6e2e['uniqueid']][_0x87cf('0x2c')]=_0x2e6e2e[_0x87cf('0x2c')];}};Fax[_0x87cf('0x1e')][_0x87cf('0x18')]=function(_0x50f5c8){if(this['channels'][_0x50f5c8['uniqueid']]){for(var _0x453d41 in _0x50f5c8[_0x87cf('0x29')]){if(_0x50f5c8[_0x87cf('0x29')][_0x87cf('0x21')](_0x453d41)){this['channels'][_0x50f5c8[_0x87cf('0x24')]][_0x453d41]=_0x50f5c8[_0x87cf('0x2d')];}}}};Fax[_0x87cf('0x1e')][_0x87cf('0x19')]=function(_0x394c6a){if(this[_0x87cf('0x23')][_0x394c6a[_0x87cf('0x24')]]){this['channels'][_0x394c6a[_0x87cf('0x24')]][_0x87cf('0x2e')]=_0x394c6a[_0x87cf('0x2e')];this[_0x87cf('0x23')][_0x394c6a['uniqueid']][_0x87cf('0x2f')]=_0x394c6a[_0x87cf('0x2f')];this['channels'][_0x394c6a[_0x87cf('0x24')]][_0x87cf('0x30')]=_0x394c6a['localstationid'];this[_0x87cf('0x23')][_0x394c6a[_0x87cf('0x24')]][_0x87cf('0x31')]=_0x394c6a[_0x87cf('0x31')];logger[_0x87cf('0x28')](_0x394c6a[_0x87cf('0x24')],_0x87cf('0x32'));}};Fax[_0x87cf('0x1e')][_0x87cf('0x1a')]=function(_0x4835d6){var _0x2cfff8=this;if(this['channels'][_0x4835d6[_0x87cf('0x24')]]){var _0x27795c=this['channels'][_0x4835d6['uniqueid']]['id'];this['channels'][_0x4835d6[_0x87cf('0x24')]][_0x87cf('0x33')]=_0x4835d6[_0x87cf('0x33')];this['channels'][_0x4835d6[_0x87cf('0x24')]][_0x87cf('0x34')]=_0x4835d6[_0x87cf('0x34')];this[_0x87cf('0x23')][_0x4835d6[_0x87cf('0x24')]][_0x87cf('0x30')]=_0x4835d6[_0x87cf('0x30')];this[_0x87cf('0x23')][_0x4835d6[_0x87cf('0x24')]][_0x87cf('0x35')]=_0x4835d6[_0x87cf('0x35')];this[_0x87cf('0x23')][_0x4835d6[_0x87cf('0x24')]]['transferrate']=_0x4835d6[_0x87cf('0x36')];this['channels'][_0x4835d6[_0x87cf('0x24')]][_0x87cf('0x31')]=_0x4835d6['filename'];this[_0x87cf('0x23')][_0x4835d6[_0x87cf('0x24')]][_0x87cf('0x37')]=_0x4835d6[_0x87cf('0x37')];if(this['channels'][_0x4835d6[_0x87cf('0x24')]][_0x87cf('0x34')]>0x0){tiff2pdf(_0x4835d6['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x450eee){logger['info'](_0x4835d6[_0x87cf('0x24')],_0x87cf('0x38'),_0x450eee[_0x87cf('0x39')]);attachment[_0x87cf('0x3a')]({'name':path['parse'](_0x4835d6[_0x87cf('0x31')])[_0x87cf('0x25')],'basename':path[_0x87cf('0x3b')](_0x4835d6[_0x87cf('0x31')])[_0x87cf('0x25')]+_0x87cf('0x3c'),'type':'application/pdf'})[_0x87cf('0x3d')](function(_0x25b97a){faxAccount[_0x87cf('0x3e')](_0x27795c,{'from':_0x4835d6['calleridnum'],'mapKey':_0x87cf('0x8'),'body':path['parse'](_0x4835d6['filename'])[_0x87cf('0x25')]+_0x87cf('0x3c'),'AttachmentId':_0x25b97a['id']})['catch'](function(_0x3f983a){logger['error'](_0x4835d6[_0x87cf('0x24')],_0x87cf('0x3f'),JSON[_0x87cf('0x40')](_0x3f983a));});})[_0x87cf('0x41')](function(_0x458317){logger['error'](_0x4835d6['uniqueid'],_0x87cf('0x42'),JSON['stringify'](_0x458317));});});}logger['info'](_0x4835d6[_0x87cf('0x24')],_0x87cf('0x42'));}};Fax[_0x87cf('0x1e')][_0x87cf('0x1d')]=function(_0x42053c){if(this[_0x87cf('0x12')][_0x42053c[_0x87cf('0x24')]]){_[_0x87cf('0x43')](this['channels'][_0x42053c[_0x87cf('0x24')]],_['pick'](_0x42053c,[_0x87cf('0x44'),_0x87cf('0x45')]));}};function updateStatus(_0x1cb5d7){if(_0x1cb5d7['AttachmentId']){faxMessage[_0x87cf('0x46')](_0x1cb5d7[_0x87cf('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x87cf('0x3d')](function(_0x40c4a7){ut[_0x87cf('0x48')](_0x87cf('0x49'),_0x40c4a7);})['catch'](function(_0x50cf1e){ut['logger'](_0x87cf('0x4a'),_0x50cf1e);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x87cf('0x1e')][_0x87cf('0x4b')]=function(_0x584c5e,_0x514556,_0x87ab26){var _0x206fc2=this;var _0x4caabb={};if(_0x514556){_0x4caabb={'read':_0x514556};}else{_0x4caabb={'failMessage':_0x87ab26};}if(this['actions'][_0x584c5e][_0x87cf('0x47')]){faxMessage[_0x87cf('0x46')](this[_0x87cf('0x12')][_0x584c5e][_0x87cf('0x47')],_0x4caabb)[_0x87cf('0x3d')](function(_0x2a068c){ut[_0x87cf('0x48')](_0x87cf('0x4c'),_0x2a068c);})[_0x87cf('0x41')](function(_0x1d2fd1){ut[_0x87cf('0x48')](_0x87cf('0x4d'),_0x1d2fd1);})[_0x87cf('0x4e')](function(){delete _0x206fc2[_0x87cf('0x23')][_0x584c5e];delete _0x206fc2[_0x87cf('0x12')][_0x584c5e];});}else{ut['logger']('[Fax][Message][NoUpdate2]');this[_0x87cf('0x4f')](_0x584c5e);delete this[_0x87cf('0x12')][_0x584c5e];}};Fax[_0x87cf('0x1e')][_0x87cf('0x1c')]=function(_0x2f7551){var _0x1081d3=this;if(this[_0x87cf('0x23')][_0x2f7551['uniqueid']]){if(this['actions'][_0x2f7551[_0x87cf('0x24')]]){this[_0x87cf('0x23')][_0x2f7551['uniqueid']]['id']=this['actions'][_0x2f7551[_0x87cf('0x24')]]['id'];this[_0x87cf('0x23')][_0x2f7551[_0x87cf('0x24')]][_0x87cf('0x25')]=this[_0x87cf('0x12')][_0x2f7551[_0x87cf('0x24')]][_0x87cf('0x25')];}logger[_0x87cf('0x28')](_0x2f7551[_0x87cf('0x24')],this['actions'][_0x2f7551['uniqueid']]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x87cf('0x40')](this['channels'][_0x2f7551[_0x87cf('0x24')]]));if(this[_0x87cf('0x12')][_0x2f7551['uniqueid']]){if(this[_0x87cf('0x23')][_0x2f7551[_0x87cf('0x24')]][_0x87cf('0x50')]>0x0&&this[_0x87cf('0x23')][_0x2f7551['uniqueid']][_0x87cf('0x51')]===_0x87cf('0x52')){this[_0x87cf('0x4b')](_0x2f7551[_0x87cf('0x24')],!![]);}else{this['updateStatus'](_0x2f7551[_0x87cf('0x24')],![],this[_0x87cf('0x23')][_0x2f7551[_0x87cf('0x24')]][_0x87cf('0x53')]?_0x87cf('0x54')+this['channels'][_0x2f7551['uniqueid']][_0x87cf('0x53')]:_0x87cf('0x55'));}}}};Fax[_0x87cf('0x1e')]['send']=function(_0x3713f7){var _0x520ad6=this;return new BPromise(function(_0x39a5e5,_0x171681){_0x520ad6[_0x87cf('0x56')](_0x3713f7,_0x520ad6[_0x87cf('0x10')][_0x3713f7['FaxAccountId']])['then'](function(_0x168fbb){ut[_0x87cf('0x48')](_0x87cf('0x57'),_0x168fbb);_0x39a5e5(ut[_0x87cf('0x39')](_0x87cf('0x58')));})[_0x87cf('0x41')](function(_0x219f4e){ut[_0x87cf('0x48')](_0x87cf('0x59'),_0x219f4e);updateStatus(_0x3713f7);_0x171681(ut[_0x87cf('0x39')](_0x87cf('0x5a')));});});};Fax['prototype']['checkAfterSend']=function(_0x2a549f){var _0x12fa73=this;return new BPromise(function(_0x235e8e,_0x27adc3){var _0x45bfe0=_0x12fa73['checkTrunk'](_0x12fa73[_0x87cf('0x10')][_0x2a549f[_0x87cf('0x5b')]][_0x87cf('0x5c')],_0x2a549f);if(_0x45bfe0['isValid']){_0x235e8e(ut[_0x87cf('0x39')](_0x87cf('0x5d')));}else{_0x27adc3(ut[_0x87cf('0x39')](_0x45bfe0['message']));}});};function originate(_0x369f37,_0x393e0b,_0x43057e){return new BPromise(function(_0x49a9bf,_0x27457c){if(_0x43057e){var _0x1a5494=util[_0x87cf('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[_0x87cf('0x3b')](_0x369f37[_0x87cf('0x5')])[_0x87cf('0x25')],_0x369f37[_0x87cf('0x5')]);gs[_0x87cf('0x5f')](_0x1a5494)[_0x87cf('0x3d')](function(){_0x369f37[_0x87cf('0x5')]=util[_0x87cf('0x5e')](_0x87cf('0x60'),path[_0x87cf('0x3b')](_0x369f37[_0x87cf('0x5')])[_0x87cf('0x61')],path['parse'](_0x369f37[_0x87cf('0x5')])[_0x87cf('0x25')]);_0x393e0b['XMF-PATH']=_0x369f37['path'];ut[_0x87cf('0x48')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0x87cf('0x62')](_0x369f37,_0x393e0b))[_0x87cf('0x3d')](function(_0x590fc0){_0x49a9bf(_0x590fc0);})[_0x87cf('0x41')](function(_0x1a879a){_0x27457c(_0x1a879a);});})['catch'](function(_0x175df6){_0x27457c(_0x175df6);});}else{ami['Action'](ut[_0x87cf('0x62')](_0x369f37,_0x393e0b))['then'](function(_0x4a1143){_0x49a9bf(_0x4a1143);})[_0x87cf('0x41')](function(_0x142ff8){_0x27457c(_0x142ff8);});}});}Fax['prototype'][_0x87cf('0x56')]=function(_0x27f8e4,_0x2df1cc){var _0x797acd=this;return new BPromise(function(_0x1cfd51,_0x566a93){var _0x4769b6=uuid['v4']();var _0x110154=ut[_0x87cf('0x63')](_0x27f8e4,_0x2df1cc);_0x797acd[_0x87cf('0x12')][_0x4769b6]=new Action(_0x4769b6,_0x2df1cc,_0x27f8e4);var _0x42a1ac=_0x797acd[_0x87cf('0x12')][_0x4769b6];if(path[_0x87cf('0x3b')](_0x27f8e4[_0x87cf('0x5')])[_0x87cf('0x64')]==='.pdf'){originate(_0x42a1ac,_0x110154,!![])[_0x87cf('0x3d')](function(_0xb3c351){_0x1cfd51(_0xb3c351);})[_0x87cf('0x41')](function(_0x16403a){_0x566a93(_0x16403a);});}else{originate(_0x42a1ac,_0x110154,![])[_0x87cf('0x3d')](function(_0x468331){_0x1cfd51(_0x468331);})[_0x87cf('0x41')](function(_0x27a638){_0x566a93(_0x27a638);});}});};Fax['prototype'][_0x87cf('0x65')]=function(_0x35dc67){return!_[_0x87cf('0x66')](_0x35dc67)&&!_[_0x87cf('0x66')](_0x35dc67[_0x87cf('0x25')])&&!_[_0x87cf('0x66')](_0x35dc67[_0x87cf('0x67')])&&_0x35dc67[_0x87cf('0x67')]&&!_[_0x87cf('0x66')](this['trunks'][util[_0x87cf('0x5e')]('SIP/%s',_0x35dc67[_0x87cf('0x25')])])&&!_['isNil'](this[_0x87cf('0x11')][util[_0x87cf('0x5e')]('SIP/%s',_0x35dc67[_0x87cf('0x25')])][_0x87cf('0x2f')])&&(this[_0x87cf('0x11')][util[_0x87cf('0x5e')](_0x87cf('0x68'),_0x35dc67['name'])][_0x87cf('0x2f')]===_0x87cf('0x69')||this['trunks'][util[_0x87cf('0x5e')](_0x87cf('0x68'),_0x35dc67['name'])][_0x87cf('0x2f')]===_0x87cf('0x6a'));};Fax[_0x87cf('0x1e')][_0x87cf('0x6b')]=function(_0x22cb80,_0x16e34f){if(!this[_0x87cf('0x65')](_0x22cb80)){ut[_0x87cf('0x48')](_0x87cf('0x6c'),_['isNil'](_0x22cb80)?'':_0x22cb80[_0x87cf('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x87cf('0x6d')};}if(_[_0x87cf('0x66')](_0x16e34f[_0x87cf('0x8')])){ut[_0x87cf('0x48')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x87cf('0x40')](_0x16e34f));return{'isValid':![],'message':_0x87cf('0x6e')};}if(_[_0x87cf('0x66')](_0x16e34f['path'])){ut[_0x87cf('0x48')](_0x87cf('0x6f'),JSON[_0x87cf('0x40')](_0x16e34f));return{'isValid':![],'message':_0x87cf('0x70')};}return{'isValid':!![],'message':_0x87cf('0x71')};};Fax[_0x87cf('0x1e')][_0x87cf('0x4f')]=function(_0x58ad11,_0x46c46c=0x2710){if(this['channels'][_0x58ad11]){setTimeout(()=>{delete this[_0x87cf('0x23')][_0x58ad11];},_0x46c46c);}};module[_0x87cf('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 6605507..3f13642 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 _0xf2a6=['error','inspect','notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger','../rpc/faxAccount'];(function(_0x59b4ef,_0x255fa2){var _0x5e11c1=function(_0x202b53){while(--_0x202b53){_0x59b4ef['push'](_0x59b4ef['shift']());}};_0x5e11c1(++_0x255fa2);}(_0xf2a6,0x1f0));var _0x6f2a=function(_0x44c376,_0x194672){_0x44c376=_0x44c376-0x0;var _0x258003=_0xf2a6[_0x44c376];return _0x258003;};'use strict';var util=require(_0x6f2a('0x0'));var BPromise=require(_0x6f2a('0x1'));var logger=require(_0x6f2a('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0x6f2a('0x3'));function loggerCatch(_0x5a077c){return function(_0x971704){logger[_0x6f2a('0x4')](_0x5a077c,util[_0x6f2a('0x5')](_0x971704,{'showHidden':![],'depth':null}));};}exports[_0x6f2a('0x6')]=function(_0x403273,_0x3f985e){return BPromise[_0x6f2a('0x7')]()['then'](faxAccount[_0x6f2a('0x6')](_0x403273,_0x3f985e))[_0x6f2a('0x8')](loggerCatch(_0x6f2a('0x9')));}; \ No newline at end of file +var _0x7e19=['catch','[Notify]\x20','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','notify','resolve','then'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0x7e19,0x188));var _0x97e1=function(_0x3fa502,_0x4a8109){_0x3fa502=_0x3fa502-0x0;var _0x498e7c=_0x7e19[_0x3fa502];return _0x498e7c;};'use strict';var util=require(_0x97e1('0x0'));var BPromise=require(_0x97e1('0x1'));var logger=require(_0x97e1('0x2'))('preview');var _=require(_0x97e1('0x3'));var faxAccount=require(_0x97e1('0x4'));function loggerCatch(_0x4ee88c){return function(_0x3b8b22){logger['error'](_0x4ee88c,util['inspect'](_0x3b8b22,{'showHidden':![],'depth':null}));};}exports[_0x97e1('0x5')]=function(_0x3025c6,_0x5b2c8f){return BPromise[_0x97e1('0x6')]()[_0x97e1('0x7')](faxAccount[_0x97e1('0x5')](_0x3025c6,_0x5b2c8f))[_0x97e1('0x8')](loggerCatch(_0x97e1('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 22ae4be..5f25e37 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 _0x4c2d=['../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs','inspect','util'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x4c2d,0x182));var _0xd4c2=function(_0x12ca70,_0x1fc492){_0x12ca70=_0x12ca70-0x0;var _0x5666f3=_0x4c2d[_0x12ca70];return _0x5666f3;};'use strict';var util=require(_0xd4c2('0x0'));var logger=require(_0xd4c2('0x1'))(_0xd4c2('0x2'));var BPromise=require(_0xd4c2('0x3'));var exec=require(_0xd4c2('0x4'))['exec'];exports[_0xd4c2('0x5')]=function(_0x5bbd3e){return new BPromise(function(_0x427ae6,_0x2e1e38){exec(_0x5bbd3e,function(_0x540872,_0x26a46d,_0x1147f9){logger[_0xd4c2('0x6')](_0xd4c2('0x7'),_0x26a46d);if(_0x540872){logger[_0xd4c2('0x6')](_0xd4c2('0x7'),'\x20Error\x20:',util[_0xd4c2('0x8')](_0x540872,{'showHidden':![],'depth':null}),_0x26a46d,_0x1147f9);_0x2e1e38(_0x540872);}_0x427ae6(_0x26a46d);});});}; \ No newline at end of file +var _0x0539=['info','Exec\x20gs','util','../../../../config/logger','bluebird','child_process','exec','execute'];(function(_0x25c044,_0xbd05f8){var _0x558ee5=function(_0x5de5d2){while(--_0x5de5d2){_0x25c044['push'](_0x25c044['shift']());}};_0x558ee5(++_0xbd05f8);}(_0x0539,0xe2));var _0x9053=function(_0x4f0dea,_0x30dbe){_0x4f0dea=_0x4f0dea-0x0;var _0x220cc8=_0x0539[_0x4f0dea];return _0x220cc8;};'use strict';var util=require(_0x9053('0x0'));var logger=require(_0x9053('0x1'))('fax');var BPromise=require(_0x9053('0x2'));var exec=require(_0x9053('0x3'))[_0x9053('0x4')];exports[_0x9053('0x5')]=function(_0x50ec6e){return new BPromise(function(_0x16c091,_0x107e91){exec(_0x50ec6e,function(_0x32249e,_0x3f3626,_0x4ce743){logger[_0x9053('0x6')](_0x9053('0x7'),_0x3f3626);if(_0x32249e){logger[_0x9053('0x6')](_0x9053('0x7'),'\x20Error\x20:',util['inspect'](_0x32249e,{'showHidden':![],'depth':null}),_0x3f3626,_0x4ce743);_0x107e91(_0x32249e);}_0x16c091(_0x3f3626);});});}; \ 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 35ec45a..a01cf91 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 _0x0292=['info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','uniqueid','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger'];(function(_0x5bc040,_0x1654cc){var _0xb2205=function(_0x4ebb2f){while(--_0x4ebb2f){_0x5bc040['push'](_0x5bc040['shift']());}};_0xb2205(++_0x1654cc);}(_0x0292,0x117));var _0x2029=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x0292[_0x120376];return _0x28c529;};'use strict';var util=require(_0x2029('0x0'));var _=require(_0x2029('0x1'));var moment=require(_0x2029('0x2'));var logger=require(_0x2029('0x3'))(_0x2029('0x4'));exports[_0x2029('0x5')]=function(_0x3adfd7){return{'message':_0x3adfd7};};exports[_0x2029('0x6')]=function(_0x414db6,_0x17d5ae){logger[_0x2029('0x7')](_0x414db6,util[_0x2029('0x8')](_0x17d5ae,{'showHidden':![],'depth':null}));};exports[_0x2029('0x9')]=function(_0x477a8a,_0x541b56){var _0x5be5b={'XMF-ECM':_0x541b56[_0x2029('0xa')],'XMF-HEADERINFO':_0x541b56[_0x2029('0xb')],'XMF-MINRATE':_0x541b56[_0x2029('0xc')],'XMF-MAXRATE':_0x541b56['maxrate'],'XMF-MODEM':util[_0x2029('0xd')](_0x2029('0xe'),_0x541b56[_0x2029('0xf')]),'XMF-GATEWAY':_0x541b56[_0x2029('0x10')],'XMF-FAXDETECT':_0x541b56[_0x2029('0x11')],'XMF-T38TIMEOUT':_0x541b56['t38timeout'],'XMF-LOCALSTATIONID':_0x541b56[_0x2029('0x12')],'XMF-PATH':_0x477a8a[_0x2029('0x13')]};return _0x5be5b;};exports['variablesAction']=function(_0x342f43,_0x2b525d){return{'actionid':_0x342f43[_0x2029('0x14')],'action':'originate','channel':_0x342f43['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util['format'](_0x2029('0x15'),_0x342f43[_0x2029('0xb')]?_0x342f43['headerinfo']:'',_0x342f43['localstationid']),'variable':_0x2b525d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x342f43[_0x2029('0x14')]};}; \ No newline at end of file +var _0x1195=['gateway','faxdetect','localstationid','path','variablesAction','channel','\x22%s\x22\x20<%s>','headerinfo','uniqueid','util','../../../../config/logger','fax','inspect','minrate','maxrate','format','\x22%s\x22'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x1195,0xc4));var _0x5119=function(_0x13610a,_0x4f866c){_0x13610a=_0x13610a-0x0;var _0x150ecc=_0x1195[_0x13610a];return _0x150ecc;};'use strict';var util=require(_0x5119('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x5119('0x1'))(_0x5119('0x2'));exports['message']=function(_0x6c6634){return{'message':_0x6c6634};};exports['logger']=function(_0x233402,_0x1e1546){logger['info'](_0x233402,util[_0x5119('0x3')](_0x1e1546,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x373f91,_0x31a8d1){var _0x2f6c6f={'XMF-ECM':_0x31a8d1['ecm'],'XMF-HEADERINFO':_0x31a8d1['headerinfo'],'XMF-MINRATE':_0x31a8d1[_0x5119('0x4')],'XMF-MAXRATE':_0x31a8d1[_0x5119('0x5')],'XMF-MODEM':util[_0x5119('0x6')](_0x5119('0x7'),_0x31a8d1['modem']),'XMF-GATEWAY':_0x31a8d1[_0x5119('0x8')],'XMF-FAXDETECT':_0x31a8d1[_0x5119('0x9')],'XMF-T38TIMEOUT':_0x31a8d1['t38timeout'],'XMF-LOCALSTATIONID':_0x31a8d1[_0x5119('0xa')],'XMF-PATH':_0x373f91[_0x5119('0xb')]};return _0x2f6c6f;};exports[_0x5119('0xc')]=function(_0x45bc31,_0x190ea4){return{'actionid':_0x45bc31['uniqueid'],'action':'originate','channel':_0x45bc31[_0x5119('0xd')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x5119('0x6')](_0x5119('0xe'),_0x45bc31[_0x5119('0xf')]?_0x45bc31[_0x5119('0xf')]:'',_0x45bc31['localstationid']),'variable':_0x190ea4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x45bc31[_0x5119('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3f0b9bf..e4e937d 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 _0xbeb3=['[index.js][initParams]','inspect','sync','util','moment','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error'];(function(_0x24faf4,_0x4b58a9){var _0x3816e9=function(_0x312f6e){while(--_0x312f6e){_0x24faf4['push'](_0x24faf4['shift']());}};_0x3816e9(++_0x4b58a9);}(_0xbeb3,0x152));var _0x3beb=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0xbeb3[_0x4178af];return _0x20f4b1;};'use strict';var util=require(_0x3beb('0x0'));var moment=require(_0x3beb('0x1'));var server=require('./server');var Realtime=require(_0x3beb('0x2'));var Report=require(_0x3beb('0x3'));var Acw=require(_0x3beb('0x4'));var Trigger=require(_0x3beb('0x5'));var Dialer=require(_0x3beb('0x6'));var Preview=require('./preview');var Fax=require(_0x3beb('0x7'));var user=require(_0x3beb('0x8'));var voiceQueue=require(_0x3beb('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x3beb('0xa'));var trigger=require(_0x3beb('0xb'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x3beb('0xc'));var voiceExtension=require(_0x3beb('0xd'));var faxAccount=require(_0x3beb('0xe'));var zendesk=require(_0x3beb('0xf'));var salesforce=require(_0x3beb('0x10'));var sugarcrm=require(_0x3beb('0x11'));var freshdesk=require(_0x3beb('0x12'));var desk=require(_0x3beb('0x13'));var zoho=require(_0x3beb('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x3beb('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x3beb('0x16'));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(_0x3beb('0x17'))(_0x3beb('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3beb('0x19')](_0x3beb('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3beb('0x19')](_0x3beb('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x3beb('0x1b')]()[_0x3beb('0x1c')](user[_0x3beb('0x1d')]())['then'](realtime[_0x3beb('0x1e')]())[_0x3beb('0x1c')](user[_0x3beb('0x1f')]())[_0x3beb('0x1c')](realtime['initTelephones']())[_0x3beb('0x1c')](trunk[_0x3beb('0x20')]())[_0x3beb('0x1c')](realtime[_0x3beb('0x21')]())[_0x3beb('0x1c')](voiceQueue[_0x3beb('0x22')]())[_0x3beb('0x1c')](realtime[_0x3beb('0x23')]())[_0x3beb('0x1c')](trigger[_0x3beb('0x24')]())[_0x3beb('0x1c')](realtime[_0x3beb('0x25')]())[_0x3beb('0x1c')](template['getTemplates']())[_0x3beb('0x1c')](realtime['initTemplates']())[_0x3beb('0x1c')](zendesk['getZendeskAccounts']())[_0x3beb('0x1c')](realtime[_0x3beb('0x26')]())[_0x3beb('0x1c')](salesforce[_0x3beb('0x27')]())[_0x3beb('0x1c')](realtime[_0x3beb('0x28')]())[_0x3beb('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0x3beb('0x1c')](realtime['initSugarcrmAccounts']())[_0x3beb('0x1c')](freshdesk[_0x3beb('0x29')]())['then'](realtime['initFreshdeskAccounts']())[_0x3beb('0x1c')](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0x3beb('0x1c')](zoho[_0x3beb('0x2a')]())['then'](realtime[_0x3beb('0x2b')]())[_0x3beb('0x1c')](vtiger[_0x3beb('0x2c')]())[_0x3beb('0x1c')](realtime[_0x3beb('0x2d')]())[_0x3beb('0x1c')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x3beb('0x2e')]())['then'](servicenow[_0x3beb('0x2f')]())[_0x3beb('0x1c')](realtime[_0x3beb('0x30')]())[_0x3beb('0x1c')](dynamics365[_0x3beb('0x31')]())[_0x3beb('0x1c')](realtime[_0x3beb('0x32')]())[_0x3beb('0x1c')](campaign[_0x3beb('0x33')]())[_0x3beb('0x1c')](realtime[_0x3beb('0x34')]())[_0x3beb('0x1c')](voiceExtension[_0x3beb('0x35')]())[_0x3beb('0x1c')](realtime[_0x3beb('0x36')]())[_0x3beb('0x1c')](faxAccount['getFaxAccounts']())[_0x3beb('0x1c')](realtime[_0x3beb('0x37')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0x3beb('0x1b')]()['then'](voiceQueueReport[_0x3beb('0x38')]())[_0x3beb('0x1c')](realtime['initVoiceQueueReports']())[_0x3beb('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x3beb('0x1c')](realtime[_0x3beb('0x39')]())[_0x3beb('0x1c')](cmHopperHistory[_0x3beb('0x3a')]())[_0x3beb('0x1c')](realtime[_0x3beb('0x3b')]())[_0x3beb('0x1c')](voiceCallReport[_0x3beb('0x3c')]())['then'](realtime[_0x3beb('0x3d')]())[_0x3beb('0x3e')](function(_0x341944){logger[_0x3beb('0x3f')](_0x3beb('0x40'),util[_0x3beb('0x41')](_0x341944,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x3beb('0x1c')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x3beb('0x1c')](function(){report[_0x3beb('0x42')]();setInterval(initRealtime,0x1388);})[_0x3beb('0x3e')](function(_0xaaf9a8){logger[_0x3beb('0x3f')]('[index.js][main]',util[_0x3beb('0x41')](_0xaaf9a8,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x8b62=['getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','sync','error','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','then','initAgents','getTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates'];(function(_0x9a86fc,_0x405ef5){var _0x32b0ba=function(_0xca1299){while(--_0xca1299){_0x9a86fc['push'](_0x9a86fc['shift']());}};_0x32b0ba(++_0x405ef5);}(_0x8b62,0x1b8));var _0x28b6=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x8b62[_0xdea41a];return _0x15d0d8;};'use strict';var util=require(_0x28b6('0x0'));var moment=require(_0x28b6('0x1'));var server=require(_0x28b6('0x2'));var Realtime=require(_0x28b6('0x3'));var Report=require(_0x28b6('0x4'));var Acw=require(_0x28b6('0x5'));var Trigger=require(_0x28b6('0x6'));var Dialer=require(_0x28b6('0x7'));var Preview=require('./preview');var Fax=require(_0x28b6('0x8'));var user=require(_0x28b6('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x28b6('0xa'));var voiceCallReport=require(_0x28b6('0xb'));var trunk=require(_0x28b6('0xc'));var trigger=require(_0x28b6('0xd'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x28b6('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x28b6('0xf'));var zendesk=require(_0x28b6('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x28b6('0x11'));var freshdesk=require(_0x28b6('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x28b6('0x13'));var vtiger=require(_0x28b6('0x14'));var freshsales=require(_0x28b6('0x15'));var servicenow=require(_0x28b6('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x28b6('0x17'))(_0x28b6('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x28b6('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x28b6('0x1a')](_0x28b6('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x28b6('0x1b')]()['then'](user['getAgents']())[_0x28b6('0x1c')](realtime[_0x28b6('0x1d')]())[_0x28b6('0x1c')](user[_0x28b6('0x1e')]())[_0x28b6('0x1c')](realtime['initTelephones']())[_0x28b6('0x1c')](trunk[_0x28b6('0x1f')]())[_0x28b6('0x1c')](realtime[_0x28b6('0x20')]())[_0x28b6('0x1c')](voiceQueue['getVoiceQueues']())[_0x28b6('0x1c')](realtime['initVoiceQueues']())[_0x28b6('0x1c')](trigger[_0x28b6('0x21')]())[_0x28b6('0x1c')](realtime[_0x28b6('0x22')]())[_0x28b6('0x1c')](template[_0x28b6('0x23')]())['then'](realtime['initTemplates']())[_0x28b6('0x1c')](zendesk[_0x28b6('0x24')]())[_0x28b6('0x1c')](realtime[_0x28b6('0x25')]())['then'](salesforce['getSalesforceAccounts']())[_0x28b6('0x1c')](realtime[_0x28b6('0x26')]())['then'](sugarcrm[_0x28b6('0x27')]())[_0x28b6('0x1c')](realtime[_0x28b6('0x28')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x28b6('0x1c')](realtime['initFreshdeskAccounts']())['then'](desk['getDeskAccounts']())[_0x28b6('0x1c')](realtime[_0x28b6('0x29')]())[_0x28b6('0x1c')](zoho[_0x28b6('0x2a')]())['then'](realtime[_0x28b6('0x2b')]())[_0x28b6('0x1c')](vtiger[_0x28b6('0x2c')]())[_0x28b6('0x1c')](realtime[_0x28b6('0x2d')]())[_0x28b6('0x1c')](freshsales['getFreshsalesAccounts']())[_0x28b6('0x1c')](realtime[_0x28b6('0x2e')]())['then'](servicenow[_0x28b6('0x2f')]())['then'](realtime[_0x28b6('0x30')]())[_0x28b6('0x1c')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x28b6('0x31')]())[_0x28b6('0x1c')](campaign[_0x28b6('0x32')]())['then'](realtime[_0x28b6('0x33')]())[_0x28b6('0x1c')](voiceExtension[_0x28b6('0x34')]())[_0x28b6('0x1c')](realtime[_0x28b6('0x35')]())['then'](faxAccount['getFaxAccounts']())[_0x28b6('0x1c')](realtime[_0x28b6('0x36')]())[_0x28b6('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x28b6('0x1b')]()[_0x28b6('0x1c')](voiceQueueReport[_0x28b6('0x37')]())['then'](realtime[_0x28b6('0x38')]())[_0x28b6('0x1c')](cmHopperHistory[_0x28b6('0x39')]())['then'](realtime[_0x28b6('0x3a')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x28b6('0x1c')](realtime[_0x28b6('0x3b')]())[_0x28b6('0x1c')](voiceCallReport[_0x28b6('0x3c')]())[_0x28b6('0x1c')](realtime[_0x28b6('0x3d')]())[_0x28b6('0x3e')](function(_0x4e9281){logger['error'](_0x28b6('0x3f'),util[_0x28b6('0x40')](_0x4e9281,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x28b6('0x1c')](function(){return initRealtime();})[_0x28b6('0x1c')](function(){return initParams();})[_0x28b6('0x1c')](function(){report[_0x28b6('0x41')]();setInterval(initRealtime,0x1388);})[_0x28b6('0x3e')](function(_0x1794ab){logger[_0x28b6('0x42')](_0x28b6('0x43'),util[_0x28b6('0x40')](_0x1794ab,{'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 8c16e4a..9036f12 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 _0x6e29=['localhost','socket.io-emitter','name','email','accountcode','state','unknown','stateTime','status','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','stringify','md5','emit','user:ami:update','user:presence','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults'];(function(_0x21c2c8,_0x44257e){var _0x4dd745=function(_0x1b3196){while(--_0x1b3196){_0x21c2c8['push'](_0x21c2c8['shift']());}};_0x4dd745(++_0x44257e);}(_0x6e29,0x72));var _0x96e2=function(_0x180445,_0x372483){_0x180445=_0x180445-0x0;var _0x54d4f4=_0x6e29[_0x180445];return _0x54d4f4;};'use strict';var _=require(_0x96e2('0x0'));var util=require('util');var moment=require(_0x96e2('0x1'));var md5=require('md5');var Redis=require(_0x96e2('0x2'));var config=require(_0x96e2('0x3'));config[_0x96e2('0x4')]=_[_0x96e2('0x5')](config[_0x96e2('0x4')],{'host':_0x96e2('0x6'),'port':0x18eb});var io=require(_0x96e2('0x7'))(new Redis(config[_0x96e2('0x4')]));function Agent(_0x3eac25){this['id']=_0x3eac25['id']||0x0;this[_0x96e2('0x8')]=_0x3eac25['name']||'';this[_0x96e2('0x9')]=_0x3eac25[_0x96e2('0x9')]||'';this['accountcode']=_0x3eac25[_0x96e2('0xa')]||'';this['fullname']=_0x3eac25['fullname']||'';this[_0x96e2('0xb')]=_0x96e2('0xc');this[_0x96e2('0xd')]=0x0;this[_0x96e2('0xe')]=_0x96e2('0xc');this[_0x96e2('0xf')]='';this['phone']='';this[_0x96e2('0x10')]='';this['interface']='';this[_0x96e2('0x11')]=_0x3eac25['online']||![];this[_0x96e2('0x12')]='unknown';this[_0x96e2('0x13')]=0x0;this[_0x96e2('0x14')]='';this[_0x96e2('0x15')]='';this[_0x96e2('0x16')]=![];this[_0x96e2('0x17')]=![];this['md5']='';}Agent[_0x96e2('0x18')][_0x96e2('0x19')]=function(_0x1cfdac){var _0x38a7c3;if(_0x1cfdac&&_0x1cfdac[_0x96e2('0xb')]){_0x38a7c3=_0x1cfdac[_0x96e2('0xb')][_0x96e2('0x1a')]();switch(_0x38a7c3){case _0x96e2('0x1b'):_0x38a7c3=_0x96e2('0x1c');break;case _0x96e2('0x1d'):_0x38a7c3=_0x96e2('0x1e');break;}}if(_0x38a7c3&&this[_0x96e2('0x12')]!==_0x38a7c3||_0x1cfdac[_0x96e2('0x1f')]){this[_0x96e2('0x13')]=_[_0x96e2('0x20')](moment()[_0x96e2('0x21')]('x'));}if(_0x38a7c3){this['voiceStatus']=_0x38a7c3;}var _0x21837d={'id':this['id'],'name':this[_0x96e2('0x8')],'email':this['email'],'accountcode':this[_0x96e2('0xa')],'fullname':this['fullname'],'state':this[_0x96e2('0xb')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x96e2('0xf')],'online':this[_0x96e2('0x11')],'voiceStatus':this[_0x96e2('0x12')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x96e2('0x15')],'interface':this['interface'],'onhold':this[_0x96e2('0x16')]};var _0xf05171=md5(JSON[_0x96e2('0x22')](_0x21837d));if(this[_0x96e2('0x23')]!==_0xf05171){this[_0x96e2('0x23')]=_0xf05171;io['to'](util[_0x96e2('0x21')]('user:%s',_0x21837d[_0x96e2('0x8')]))[_0x96e2('0x24')](_0x96e2('0x25'),_['omit'](_0x21837d,[_0x96e2('0x11')]));io[_0x96e2('0x24')](_0x96e2('0x26'),_0x21837d);}};module[_0x96e2('0x27')]=Agent; \ No newline at end of file +var _0x7083=['voiceStatusQueue','stringify','emit','user:ami:update','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','prototype','updateStatusRealtime','idle','talking','statePause','toNumber','format'];(function(_0x52a242,_0x181a8e){var _0x185d9b=function(_0x4219e1){while(--_0x4219e1){_0x52a242['push'](_0x52a242['shift']());}};_0x185d9b(++_0x181a8e);}(_0x7083,0x163));var _0x3708=function(_0x1441f8,_0xab87b){_0x1441f8=_0x1441f8-0x0;var _0x276636=_0x7083[_0x1441f8];return _0x276636;};'use strict';var _=require('lodash');var util=require(_0x3708('0x0'));var moment=require(_0x3708('0x1'));var md5=require(_0x3708('0x2'));var Redis=require(_0x3708('0x3'));var config=require(_0x3708('0x4'));config[_0x3708('0x5')]=_[_0x3708('0x6')](config[_0x3708('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3708('0x7'))(new Redis(config['redis']));function Agent(_0x5b9862){this['id']=_0x5b9862['id']||0x0;this[_0x3708('0x8')]=_0x5b9862[_0x3708('0x8')]||'';this[_0x3708('0x9')]=_0x5b9862[_0x3708('0x9')]||'';this[_0x3708('0xa')]=_0x5b9862[_0x3708('0xa')]||'';this[_0x3708('0xb')]=_0x5b9862[_0x3708('0xb')]||'';this[_0x3708('0xc')]=_0x3708('0xd');this[_0x3708('0xe')]=0x0;this['status']=_0x3708('0xd');this[_0x3708('0xf')]='';this['phone']='';this[_0x3708('0x10')]='';this[_0x3708('0x11')]='';this[_0x3708('0x12')]=_0x5b9862[_0x3708('0x12')]||![];this[_0x3708('0x13')]=_0x3708('0xd');this[_0x3708('0x14')]=0x0;this[_0x3708('0x15')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x3708('0x16')]=![];this[_0x3708('0x2')]='';}Agent[_0x3708('0x17')][_0x3708('0x18')]=function(_0x29c1b5){var _0x25dbf2;if(_0x29c1b5&&_0x29c1b5[_0x3708('0xc')]){_0x25dbf2=_0x29c1b5['state']['toLowerCase']();switch(_0x25dbf2){case'not_inuse':_0x25dbf2=_0x3708('0x19');break;case'inuse':_0x25dbf2=_0x3708('0x1a');break;}}if(_0x25dbf2&&this[_0x3708('0x13')]!==_0x25dbf2||_0x29c1b5[_0x3708('0x1b')]){this['voiceStatusTime']=_[_0x3708('0x1c')](moment()[_0x3708('0x1d')]('x'));}if(_0x25dbf2){this[_0x3708('0x13')]=_0x25dbf2;}var _0x4924e0={'id':this['id'],'name':this['name'],'email':this[_0x3708('0x9')],'accountcode':this['accountcode'],'fullname':this[_0x3708('0xb')],'state':this['state'],'stateTime':this[_0x3708('0xe')],'status':this['status'],'address':this[_0x3708('0xf')],'online':this[_0x3708('0x12')],'voiceStatus':this[_0x3708('0x13')],'voiceStatusTime':this[_0x3708('0x14')],'voiceStatusCallerIdNumber':this[_0x3708('0x15')],'voiceStatusQueue':this[_0x3708('0x1e')],'interface':this[_0x3708('0x11')],'onhold':this['onhold']};var _0xa1c0de=md5(JSON[_0x3708('0x1f')](_0x4924e0));if(this[_0x3708('0x2')]!==_0xa1c0de){this[_0x3708('0x2')]=_0xa1c0de;io['to'](util[_0x3708('0x1d')]('user:%s',_0x4924e0[_0x3708('0x8')]))[_0x3708('0x20')](_0x3708('0x21'),_['omit'](_0x4924e0,[_0x3708('0x12')]));io[_0x3708('0x20')]('user:presence',_0x4924e0);}};module[_0x3708('0x22')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index befdf52..d1b3e11 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 _0x2134=['name','type','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x22b9d3,_0x3837eb){var _0x38508c=function(_0x27b8f7){while(--_0x27b8f7){_0x22b9d3['push'](_0x22b9d3['shift']());}};_0x38508c(++_0x3837eb);}(_0x2134,0x198));var _0x4213=function(_0x32b728,_0x266409){_0x32b728=_0x32b728-0x0;var _0x387f90=_0x2134[_0x32b728];return _0x387f90;};'use strict';function Campaign(_0x29006e){this['id']=_0x29006e['id']||0x0;this[_0x4213('0x0')]=_0x29006e['name']||'';this[_0x4213('0x1')]=_0x29006e[_0x4213('0x1')]||'campaign';this[_0x4213('0x2')]=0x0;this[_0x4213('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x4213('0x4')]=0x0;this[_0x4213('0x5')]='';this[_0x4213('0x6')]=!![];this[_0x4213('0x7')]=_0x29006e['active'];this[_0x4213('0x8')]=_0x29006e[_0x4213('0x8')];this[_0x4213('0x9')]=_0x29006e[_0x4213('0x9')]||null;this[_0x4213('0xa')]=_0x29006e[_0x4213('0xa')]?_0x29006e[_0x4213('0xa')]:null;this[_0x4213('0xb')]=_0x29006e['dialOriginateCallerIdName'];this[_0x4213('0xc')]=_0x29006e[_0x4213('0xc')];this[_0x4213('0xd')]=_0x29006e['dialOriginateTimeout']||0x1e;this[_0x4213('0xe')]=_0x29006e['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x29006e[_0x4213('0xf')];this[_0x4213('0x10')]=_0x29006e[_0x4213('0x10')];this['dialBusyRetryFrequency']=_0x29006e[_0x4213('0x11')];this[_0x4213('0x12')]=_0x29006e[_0x4213('0x12')];this[_0x4213('0x13')]=_0x29006e[_0x4213('0x13')];this['dialGlobalMaxRetry']=_0x29006e[_0x4213('0x14')];this[_0x4213('0x15')]=_0x29006e['dialNoSuchNumberMaxRetry']||0x3;this[_0x4213('0x16')]=_0x29006e[_0x4213('0x16')]||0x96;this[_0x4213('0x17')]=_0x29006e[_0x4213('0x17')]||0x3;this[_0x4213('0x18')]=_0x29006e[_0x4213('0x18')]||0x96;this[_0x4213('0x19')]=_0x29006e[_0x4213('0x19')]||0x3;this[_0x4213('0x1a')]=_0x29006e['dialAbandonedRetryFrequency']||0x96;this[_0x4213('0x1b')]=_0x29006e[_0x4213('0x1b')]||0x3;this[_0x4213('0x1c')]=_0x29006e['dialMachineRetryFrequency']||0x96;this[_0x4213('0x1d')]=_0x29006e[_0x4213('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x29006e[_0x4213('0x1e')]||0x96;this[_0x4213('0x1f')]=_0x29006e['dialOrderByScheduledAt']||_0x4213('0x20');this[_0x4213('0x21')]=_0x29006e['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x29006e[_0x4213('0x22')]||undefined;this[_0x4213('0x23')]=_0x29006e[_0x4213('0x23')]||undefined;this[_0x4213('0x24')]=_0x29006e[_0x4213('0x24')]?_0x29006e[_0x4213('0x24')]:undefined;this[_0x4213('0x25')]=_0x29006e[_0x4213('0x25')]?_0x29006e[_0x4213('0x25')]:undefined;this['Interval']=_0x29006e[_0x4213('0x26')]?_0x29006e[_0x4213('0x26')]:undefined;this['SquareProject']=_0x29006e[_0x4213('0x27')]?_0x29006e[_0x4213('0x27')]:undefined;this[_0x4213('0x28')]=_0x29006e[_0x4213('0x27')]?_0x29006e['SquareProject'][_0x4213('0x0')]:undefined;this['dialAMDActive']=_0x29006e[_0x4213('0x29')]||![];this['dialAMDInitialSilence']=_0x29006e[_0x4213('0x2a')];this[_0x4213('0x2b')]=_0x29006e[_0x4213('0x2b')];this['dialAMDAfterGreetingSilence']=_0x29006e[_0x4213('0x2c')];this[_0x4213('0x2d')]=_0x29006e['dialAMDTotalAnalysisTime'];this[_0x4213('0x2e')]=_0x29006e[_0x4213('0x2e')];this[_0x4213('0x2f')]=_0x29006e[_0x4213('0x2f')];this[_0x4213('0x30')]=_0x29006e[_0x4213('0x30')];this[_0x4213('0x31')]=_0x29006e[_0x4213('0x31')];this['dialAMDMaximumWordLength']=_0x29006e[_0x4213('0x32')];}module['exports']=Campaign; \ No newline at end of file +var _0x4864=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','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','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x4864,0x16b));var _0x4486=function(_0x21eacf,_0x1d1f5b){_0x21eacf=_0x21eacf-0x0;var _0xbae3e=_0x4864[_0x21eacf];return _0xbae3e;};'use strict';function Campaign(_0x112a99){this['id']=_0x112a99['id']||0x0;this[_0x4486('0x0')]=_0x112a99['name']||'';this[_0x4486('0x1')]=_0x112a99[_0x4486('0x1')]||_0x4486('0x2');this[_0x4486('0x3')]=0x0;this[_0x4486('0x4')]=0x0;this[_0x4486('0x5')]=0x0;this[_0x4486('0x6')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x4486('0x7')]=_0x112a99[_0x4486('0x7')];this['limitCalls']=_0x112a99[_0x4486('0x8')];this[_0x4486('0x9')]=_0x112a99[_0x4486('0x9')]||null;this[_0x4486('0xa')]=_0x112a99[_0x4486('0xa')]?_0x112a99[_0x4486('0xa')]:null;this[_0x4486('0xb')]=_0x112a99['dialOriginateCallerIdName'];this[_0x4486('0xc')]=_0x112a99['dialOriginateCallerIdNumber'];this[_0x4486('0xd')]=_0x112a99[_0x4486('0xd')]||0x1e;this[_0x4486('0xe')]=_0x112a99[_0x4486('0xe')];this['dialCongestionRetryFrequency']=_0x112a99[_0x4486('0xf')];this[_0x4486('0x10')]=_0x112a99[_0x4486('0x10')];this[_0x4486('0x11')]=_0x112a99[_0x4486('0x11')];this[_0x4486('0x12')]=_0x112a99[_0x4486('0x12')];this[_0x4486('0x13')]=_0x112a99[_0x4486('0x13')];this[_0x4486('0x14')]=_0x112a99[_0x4486('0x14')];this['dialNoSuchNumberMaxRetry']=_0x112a99[_0x4486('0x15')]||0x3;this[_0x4486('0x16')]=_0x112a99[_0x4486('0x16')]||0x96;this['dialDropMaxRetry']=_0x112a99[_0x4486('0x17')]||0x3;this[_0x4486('0x18')]=_0x112a99[_0x4486('0x18')]||0x96;this[_0x4486('0x19')]=_0x112a99[_0x4486('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x112a99[_0x4486('0x1a')]||0x96;this[_0x4486('0x1b')]=_0x112a99[_0x4486('0x1b')]||0x3;this[_0x4486('0x1c')]=_0x112a99[_0x4486('0x1c')]||0x96;this[_0x4486('0x1d')]=_0x112a99[_0x4486('0x1d')]||0x3;this[_0x4486('0x1e')]=_0x112a99[_0x4486('0x1e')]||0x96;this[_0x4486('0x1f')]=_0x112a99['dialOrderByScheduledAt']||_0x4486('0x20');this[_0x4486('0x21')]=_0x112a99[_0x4486('0x21')]||undefined;this[_0x4486('0x22')]=_0x112a99[_0x4486('0x22')]||undefined;this['dialCutDigit']=_0x112a99[_0x4486('0x23')]||undefined;this[_0x4486('0x24')]=_0x112a99[_0x4486('0x24')]?_0x112a99[_0x4486('0x24')]:undefined;this[_0x4486('0x25')]=_0x112a99[_0x4486('0x25')]?_0x112a99[_0x4486('0x25')]:undefined;this['Interval']=_0x112a99[_0x4486('0x26')]?_0x112a99[_0x4486('0x26')]:undefined;this['SquareProject']=_0x112a99[_0x4486('0x27')]?_0x112a99[_0x4486('0x27')]:undefined;this['dialQueueProject']=_0x112a99['SquareProject']?_0x112a99[_0x4486('0x27')][_0x4486('0x0')]:undefined;this[_0x4486('0x28')]=_0x112a99[_0x4486('0x28')]||![];this[_0x4486('0x29')]=_0x112a99[_0x4486('0x29')];this[_0x4486('0x2a')]=_0x112a99[_0x4486('0x2a')];this[_0x4486('0x2b')]=_0x112a99['dialAMDAfterGreetingSilence'];this[_0x4486('0x2c')]=_0x112a99['dialAMDTotalAnalysisTime'];this[_0x4486('0x2d')]=_0x112a99[_0x4486('0x2d')];this['dialAMDBetweenWordsSilence']=_0x112a99[_0x4486('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x112a99[_0x4486('0x2f')];this[_0x4486('0x30')]=_0x112a99[_0x4486('0x30')];this[_0x4486('0x31')]=_0x112a99['dialAMDMaximumWordLength'];}module[_0x4486('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 59cd1c7..713aefc 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 _0x1abc=['lastapplication','lastdata','duration','type','disposition','queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','accountcode','context','exten','answered','answertime','endtime','unmanaged','abandoned'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1abc,0x107));var _0xc1ab=function(_0x1f88b3,_0x3560e0){_0x1f88b3=_0x1f88b3-0x0;var _0x5e0463=_0x1abc[_0x1f88b3];return _0x5e0463;};'use strict';function Channel(){this[_0xc1ab('0x0')]=null;this[_0xc1ab('0x1')]='';this[_0xc1ab('0x2')]='';this['calleridnum']=0x0;this[_0xc1ab('0x3')]='';this[_0xc1ab('0x4')]=undefined;this['connectedlinename']=undefined;this[_0xc1ab('0x5')]=0x0;this[_0xc1ab('0x6')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0xc1ab('0x7')]=0x0;this[_0xc1ab('0x8')]=![];this[_0xc1ab('0x9')]=null;this[_0xc1ab('0xa')]=null;this[_0xc1ab('0xb')]=![];this[_0xc1ab('0xc')]=![];this[_0xc1ab('0xd')]='';this[_0xc1ab('0xe')]='';this[_0xc1ab('0xf')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0xc1ab('0x10')]=null;this['tag']=null;this[_0xc1ab('0x11')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0xc1ab('0x12')]=null;this['monitors']=[];this[_0xc1ab('0x13')]=undefined;this[_0xc1ab('0x14')]=undefined;this['transferType']=undefined;this[_0xc1ab('0x15')]=0x0;}module[_0xc1ab('0x16')]=Channel; \ No newline at end of file +var _0x1867=['linkedid','exten','answered','answertime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid'];(function(_0x5c732b,_0x39aaf3){var _0xeedcfe=function(_0x5089c5){while(--_0x5089c5){_0x5c732b['push'](_0x5c732b['shift']());}};_0xeedcfe(++_0x39aaf3);}(_0x1867,0xb5));var _0x7186=function(_0x1c6078,_0x5c5781){_0x1c6078=_0x1c6078-0x0;var _0xf9f6b4=_0x1867[_0x1c6078];return _0xf9f6b4;};'use strict';function Channel(){this[_0x7186('0x0')]=null;this[_0x7186('0x1')]='';this['destinationchannel']='';this[_0x7186('0x2')]=0x0;this['calleridname']='';this[_0x7186('0x3')]=undefined;this[_0x7186('0x4')]=undefined;this[_0x7186('0x5')]=0x0;this[_0x7186('0x6')]='';this[_0x7186('0x7')]=0x0;this[_0x7186('0x8')]=0x0;this[_0x7186('0x9')]=0x0;this[_0x7186('0xa')]=![];this[_0x7186('0xb')]=null;this['endtime']=null;this[_0x7186('0xc')]=![];this[_0x7186('0xd')]=![];this['lastapplication']='';this[_0x7186('0xe')]='';this[_0x7186('0xf')]=0x0;this[_0x7186('0x10')]=0x0;this[_0x7186('0x11')]=0x0;this['type']=null;this[_0x7186('0x12')]=null;this[_0x7186('0x13')]=null;this[_0x7186('0x14')]=![];this[_0x7186('0x15')]=null;this[_0x7186('0x16')]=null;this['monitors']=[];this[_0x7186('0x17')]=undefined;this[_0x7186('0x18')]=undefined;this[_0x7186('0x19')]=undefined;this[_0x7186('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index d551ea1..c3c4100 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 _0xe672=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x3c77ef,_0xa8c6f){var _0x3593fd=function(_0x40c22e){while(--_0x40c22e){_0x3c77ef['push'](_0x3c77ef['shift']());}};_0x3593fd(++_0xa8c6f);}(_0xe672,0x74));var _0x2e67=function(_0x27d517,_0x8e5a42){_0x27d517=_0x27d517-0x0;var _0x2c9c65=_0xe672[_0x27d517];return _0x2c9c65;};'use strict';function DeskAccount(_0x502257){this['id']=_0x502257['id']||0x0;this[_0x2e67('0x0')]=_0x502257[_0x2e67('0x0')]||'';this[_0x2e67('0x1')]=_0x502257['username']||'';this[_0x2e67('0x2')]=_0x502257['remoteUri']||'';this[_0x2e67('0x3')]=_0x502257[_0x2e67('0x3')]||'';this[_0x2e67('0x4')]=_0x502257[_0x2e67('0x4')]||'';this[_0x2e67('0x5')]=_0x502257[_0x2e67('0x5')]||'';this[_0x2e67('0x6')]=_0x502257[_0x2e67('0x6')]||'';this[_0x2e67('0x7')]=_0x502257[_0x2e67('0x7')]||'';this[_0x2e67('0x8')]=_0x502257[_0x2e67('0x8')]||'';this['type']=_0x502257[_0x2e67('0x9')]||'';this[_0x2e67('0xa')]=_0x502257['serverUrl']||'';this[_0x2e67('0xb')]=_0x502257['Configurations']||{};}module[_0x2e67('0xc')]=DeskAccount; \ No newline at end of file +var _0xed5b=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xed5b,0x174));var _0xbed5=function(_0x1bc4cc,_0x4e47c2){_0x1bc4cc=_0x1bc4cc-0x0;var _0x7c6009=_0xed5b[_0x1bc4cc];return _0x7c6009;};'use strict';function DeskAccount(_0x264b5b){this['id']=_0x264b5b['id']||0x0;this[_0xbed5('0x0')]=_0x264b5b[_0xbed5('0x0')]||'';this[_0xbed5('0x1')]=_0x264b5b[_0xbed5('0x1')]||'';this[_0xbed5('0x2')]=_0x264b5b[_0xbed5('0x2')]||'';this[_0xbed5('0x3')]=_0x264b5b['authType']||'';this[_0xbed5('0x4')]=_0x264b5b[_0xbed5('0x4')]||'';this[_0xbed5('0x5')]=_0x264b5b['consumerKey']||'';this[_0xbed5('0x6')]=_0x264b5b[_0xbed5('0x6')]||'';this[_0xbed5('0x7')]=_0x264b5b[_0xbed5('0x7')]||'';this[_0xbed5('0x8')]=_0x264b5b[_0xbed5('0x8')]||'';this[_0xbed5('0x9')]=_0x264b5b[_0xbed5('0x9')]||'';this['serverUrl']=_0x264b5b[_0xbed5('0xa')]||'';this[_0xbed5('0xb')]=_0x264b5b['Configurations']||{};}module[_0xbed5('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 639ac80..98d90e0 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 _0x9fab=['serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x5ce786,_0xc111){var _0x1ee460=function(_0x200dc2){while(--_0x200dc2){_0x5ce786['push'](_0x5ce786['shift']());}};_0x1ee460(++_0xc111);}(_0x9fab,0xf6));var _0xb9fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fab[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0xd602f0){this['id']=_0xd602f0['id']||0x0;this[_0xb9fa('0x0')]=_0xd602f0[_0xb9fa('0x0')]||'';this[_0xb9fa('0x1')]=_0xd602f0[_0xb9fa('0x1')]||'';this[_0xb9fa('0x2')]=_0xd602f0[_0xb9fa('0x2')]||'';this[_0xb9fa('0x3')]=_0xd602f0['remoteUri']||'';this[_0xb9fa('0x4')]=_0xd602f0[_0xb9fa('0x4')]||'';this['clientId']=_0xd602f0[_0xb9fa('0x5')]||'';this[_0xb9fa('0x6')]=_0xd602f0[_0xb9fa('0x6')]||{};this[_0xb9fa('0x7')]=_0xd602f0[_0xb9fa('0x7')]||'';this[_0xb9fa('0x8')]=_0xd602f0[_0xb9fa('0x8')]||![];this['Configurations']=_0xd602f0[_0xb9fa('0x9')]||{};this[_0xb9fa('0xa')]=_0xd602f0[_0xb9fa('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x143d=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','exports','name','username','password','remoteUri'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x143d,0x1b4));var _0xd143=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0x143d[_0x25a0b9];return _0x30b9ab;};'use strict';function Dynamics365Account(_0xea91e0){this['id']=_0xea91e0['id']||0x0;this[_0xd143('0x0')]=_0xea91e0[_0xd143('0x0')]||'';this[_0xd143('0x1')]=_0xea91e0[_0xd143('0x1')]||'';this[_0xd143('0x2')]=_0xea91e0[_0xd143('0x2')]||'';this[_0xd143('0x3')]=_0xea91e0[_0xd143('0x3')]||'';this[_0xd143('0x4')]=_0xea91e0[_0xd143('0x4')]||'';this[_0xd143('0x5')]=_0xea91e0[_0xd143('0x5')]||'';this[_0xd143('0x6')]=_0xea91e0[_0xd143('0x6')]||{};this[_0xd143('0x7')]=_0xea91e0[_0xd143('0x7')]||'';this[_0xd143('0x8')]=_0xea91e0[_0xd143('0x8')]||![];this[_0xd143('0x9')]=_0xea91e0['Configurations']||{};this['CloudProvider']=_0xea91e0['CloudProvider']||{};}module[_0xd143('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 1b063dd..ed64dee 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 _0x745c=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description'];(function(_0x3d88ee,_0x39bebf){var _0xa93f8a=function(_0x123351){while(--_0x123351){_0x3d88ee['push'](_0x3d88ee['shift']());}};_0xa93f8a(++_0x39bebf);}(_0x745c,0x1c0));var _0xc745=function(_0x47bcee,_0x5c0311){_0x47bcee=_0x47bcee-0x0;var _0x4b88a8=_0x745c[_0x47bcee];return _0x4b88a8;};'use strict';function FaxAccount(_0x30274f){this['id']=_0x30274f['id']||0x0;this[_0xc745('0x0')]=_0x30274f[_0xc745('0x0')]||'';this['description']=_0x30274f[_0xc745('0x1')];this[_0xc745('0x2')]=_0x30274f[_0xc745('0x2')];this[_0xc745('0x3')]=_0x30274f[_0xc745('0x3')];this[_0xc745('0x4')]=_0x30274f[_0xc745('0x4')];this[_0xc745('0x5')]=_0x30274f[_0xc745('0x5')]||0x960;this[_0xc745('0x6')]=_0x30274f[_0xc745('0x6')]||0x3840;this[_0xc745('0x7')]=_0x30274f[_0xc745('0x7')]||_0xc745('0x8');this[_0xc745('0x9')]=_0x30274f[_0xc745('0x9')]||'no';this['faxdetect']=_0x30274f[_0xc745('0xa')]||'no';this[_0xc745('0xb')]=_0x30274f[_0xc745('0xb')]||0x1388;this['tech']=_0x30274f[_0xc745('0xc')]||_0xc745('0xd');this[_0xc745('0xe')]=_0x30274f[_0xc745('0xe')]?_0x30274f[_0xc745('0xe')]:undefined;this[_0xc745('0xf')]=_0x30274f[_0xc745('0xf')];this['key']=_0x30274f[_0xc745('0x10')];}module[_0xc745('0x11')]=FaxAccount; \ No newline at end of file +var _0xfd89=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x4da062,_0x1bd9e6){var _0x302cf3=function(_0x42d9a8){while(--_0x42d9a8){_0x4da062['push'](_0x4da062['shift']());}};_0x302cf3(++_0x1bd9e6);}(_0xfd89,0xb1));var _0x9fd8=function(_0xc3b3d8,_0x497c9e){_0xc3b3d8=_0xc3b3d8-0x0;var _0x522067=_0xfd89[_0xc3b3d8];return _0x522067;};'use strict';function FaxAccount(_0x9dc01){this['id']=_0x9dc01['id']||0x0;this[_0x9fd8('0x0')]=_0x9dc01['name']||'';this[_0x9fd8('0x1')]=_0x9dc01[_0x9fd8('0x1')];this[_0x9fd8('0x2')]=_0x9dc01['ecm'];this[_0x9fd8('0x3')]=_0x9dc01[_0x9fd8('0x3')];this[_0x9fd8('0x4')]=_0x9dc01[_0x9fd8('0x4')];this[_0x9fd8('0x5')]=_0x9dc01['minrate']||0x960;this[_0x9fd8('0x6')]=_0x9dc01[_0x9fd8('0x6')]||0x3840;this[_0x9fd8('0x7')]=_0x9dc01[_0x9fd8('0x7')]||_0x9fd8('0x8');this[_0x9fd8('0x9')]=_0x9dc01[_0x9fd8('0x9')]||'no';this['faxdetect']=_0x9dc01[_0x9fd8('0xa')]||'no';this[_0x9fd8('0xb')]=_0x9dc01['t38timeout']||0x1388;this[_0x9fd8('0xc')]=_0x9dc01[_0x9fd8('0xc')]||_0x9fd8('0xd');this['Trunk']=_0x9dc01[_0x9fd8('0xe')]?_0x9dc01['Trunk']:undefined;this[_0x9fd8('0xf')]=_0x9dc01[_0x9fd8('0xf')];this[_0x9fd8('0x10')]=_0x9dc01[_0x9fd8('0x10')];}module[_0x9fd8('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 108db02..6d06598 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 _0x8f5e=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0x8f5e,0x184));var _0xe8f5=function(_0x530c4b,_0x41ddbf){_0x530c4b=_0x530c4b-0x0;var _0x46cb06=_0x8f5e[_0x530c4b];return _0x46cb06;};'use strict';function FreshdeskAccount(_0x23d8e2){this['id']=_0x23d8e2['id']||0x0;this[_0xe8f5('0x0')]=_0x23d8e2[_0xe8f5('0x0')]||'';this[_0xe8f5('0x1')]=_0x23d8e2[_0xe8f5('0x1')]||'';this[_0xe8f5('0x2')]=_0x23d8e2[_0xe8f5('0x3')]||'';this['remoteUri']=_0x23d8e2[_0xe8f5('0x4')]||'';this[_0xe8f5('0x5')]=_0x23d8e2['serverUrl']||'';this['Configurations']=_0x23d8e2[_0xe8f5('0x6')]||{};}module[_0xe8f5('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x9dc5=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2a114e,_0xacb2dd){var _0x403755=function(_0xb42cb9){while(--_0xb42cb9){_0x2a114e['push'](_0x2a114e['shift']());}};_0x403755(++_0xacb2dd);}(_0x9dc5,0xd1));var _0x59dc=function(_0x153863,_0x41363d){_0x153863=_0x153863-0x0;var _0x3bfc32=_0x9dc5[_0x153863];return _0x3bfc32;};'use strict';function FreshdeskAccount(_0x11b603){this['id']=_0x11b603['id']||0x0;this[_0x59dc('0x0')]=_0x11b603[_0x59dc('0x0')]||'';this['username']=_0x11b603[_0x59dc('0x1')]||'';this[_0x59dc('0x2')]=_0x11b603['token']||'';this[_0x59dc('0x3')]=_0x11b603[_0x59dc('0x3')]||'';this[_0x59dc('0x4')]=_0x11b603[_0x59dc('0x4')]||'';this[_0x59dc('0x5')]=_0x11b603['Configurations']||{};}module[_0x59dc('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f59d0d5..eae744a 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 _0xe4d9=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0xe4d9,0x141));var _0x9e4d=function(_0x3ec241,_0x322827){_0x3ec241=_0x3ec241-0x0;var _0x4847ed=_0xe4d9[_0x3ec241];return _0x4847ed;};'use strict';function FreshsalesAccount(_0x277259){this['id']=_0x277259['id']||0x0;this[_0x9e4d('0x0')]=_0x277259[_0x9e4d('0x0')]||'';this['username']=_0x277259[_0x9e4d('0x1')]||'';this['apiKey']=_0x277259['token']||'';this[_0x9e4d('0x2')]=_0x277259[_0x9e4d('0x2')]||'';this['serverUrl']=_0x277259[_0x9e4d('0x3')]||'';this[_0x9e4d('0x4')]=_0x277259['Configurations']||{};}module[_0x9e4d('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0xed5f=['remoteUri','serverUrl','Configurations','name','username','apiKey','token'];(function(_0x31eb22,_0x4e91e2){var _0x3db267=function(_0x2be2af){while(--_0x2be2af){_0x31eb22['push'](_0x31eb22['shift']());}};_0x3db267(++_0x4e91e2);}(_0xed5f,0x1e6));var _0xfed5=function(_0x483fec,_0x51997d){_0x483fec=_0x483fec-0x0;var _0x1f9a74=_0xed5f[_0x483fec];return _0x1f9a74;};'use strict';function FreshsalesAccount(_0x51df8){this['id']=_0x51df8['id']||0x0;this[_0xfed5('0x0')]=_0x51df8[_0xfed5('0x0')]||'';this[_0xfed5('0x1')]=_0x51df8['username']||'';this[_0xfed5('0x2')]=_0x51df8[_0xfed5('0x3')]||'';this[_0xfed5('0x4')]=_0x51df8[_0xfed5('0x4')]||'';this['serverUrl']=_0x51df8[_0xfed5('0x5')]||'';this[_0xfed5('0x6')]=_0x51df8[_0xfed5('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 7e80c51..5e8cc4b 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 _0x8561=['type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','channel','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','voice','variables'];(function(_0x39b69b,_0x41e201){var _0x207ffd=function(_0x39c108){while(--_0x39c108){_0x39b69b['push'](_0x39b69b['shift']());}};_0x207ffd(++_0x41e201);}(_0x8561,0x1c8));var _0x1856=function(_0x52c8d3,_0x15009a){_0x52c8d3=_0x52c8d3-0x0;var _0x4b7f9d=_0x8561[_0x52c8d3];return _0x4b7f9d;};'use strict';function QueueReport(){this[_0x1856('0x0')]=_0x1856('0x1');this[_0x1856('0x2')]='';this[_0x1856('0x3')]='';this['calleridname']='';this[_0x1856('0x4')]='';this[_0x1856('0x5')]=null;this[_0x1856('0x6')]=null;this[_0x1856('0x7')]=0x1;this[_0x1856('0x8')]=0x1;this['queuecallerabandon']=![];this[_0x1856('0x9')]=null;this[_0x1856('0xa')]=![];this['queuecallercompleteAt']=null;this[_0x1856('0xb')]=![];this['queuecallerexitAt']=null;this[_0x1856('0xc')]=0x1;this[_0x1856('0xd')]='';this['connectedlinenum']='';this[_0x1856('0xe')]='';this[_0x1856('0xf')]='';this[_0x1856('0x10')]='';this[_0x1856('0x11')]='';this[_0x1856('0x12')]='';this[_0x1856('0x13')]=0x0;this[_0x1856('0x14')]=![];this['lastAssignedTo']='';this[_0x1856('0x15')]=_0x1856('0x16');this['mohtime']=0x0;this[_0x1856('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xd20d=['queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','accountcode','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position'];(function(_0x3a3edc,_0x4893eb){var _0x1c9a73=function(_0x49fd9a){while(--_0x49fd9a){_0x3a3edc['push'](_0x3a3edc['shift']());}};_0x1c9a73(++_0x4893eb);}(_0xd20d,0x1db));var _0xdd20=function(_0x4f5ebb,_0x4b4f35){_0x4f5ebb=_0x4f5ebb-0x0;var _0x2ef576=_0xd20d[_0x4f5ebb];return _0x2ef576;};'use strict';function QueueReport(){this[_0xdd20('0x0')]=_0xdd20('0x1');this[_0xdd20('0x2')]='';this[_0xdd20('0x3')]='';this['calleridname']='';this[_0xdd20('0x4')]='';this[_0xdd20('0x5')]=null;this[_0xdd20('0x6')]=null;this[_0xdd20('0x7')]=0x1;this['count']=0x1;this[_0xdd20('0x8')]=![];this['queuecallerabandonAt']=null;this[_0xdd20('0x9')]=![];this[_0xdd20('0xa')]=null;this[_0xdd20('0xb')]=![];this[_0xdd20('0xc')]=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xdd20('0xd')]='';this[_0xdd20('0xe')]='';this['exten']='';this[_0xdd20('0xf')]='';this[_0xdd20('0x10')]=0x0;this[_0xdd20('0x11')]=![];this[_0xdd20('0x12')]='';this[_0xdd20('0x13')]=_0xdd20('0x14');this[_0xdd20('0x15')]=0x0;this['variables']={};}module[_0xdd20('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 0848dcd..57d691a 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 _0xe530=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0xfcf576,_0x373f6a){var _0xf43ed1=function(_0x36e167){while(--_0x36e167){_0xfcf576['push'](_0xfcf576['shift']());}};_0xf43ed1(++_0x373f6a);}(_0xe530,0x1ca));var _0x0e53=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xe530[_0x36eaaa];return _0x461349;};'use strict';function SalesforceAccount(_0x2c9cc1){this['id']=_0x2c9cc1['id']||0x0;this['name']=_0x2c9cc1[_0x0e53('0x0')]||'';this['username']=_0x2c9cc1[_0x0e53('0x1')]||'';this[_0x0e53('0x2')]=_0x2c9cc1[_0x0e53('0x2')]||'';this[_0x0e53('0x3')]=_0x2c9cc1[_0x0e53('0x3')]||'';this[_0x0e53('0x4')]=_0x2c9cc1[_0x0e53('0x4')]||'';this[_0x0e53('0x5')]=_0x2c9cc1['clientSecret']||'';this['securityToken']=_0x2c9cc1[_0x0e53('0x6')]||'';this[_0x0e53('0x7')]=_0x2c9cc1[_0x0e53('0x7')]||_0x0e53('0x8');this['serverUrl']=_0x2c9cc1[_0x0e53('0x9')]||'';this[_0x0e53('0xa')]=_0x2c9cc1[_0x0e53('0xa')]||{};}module[_0x0e53('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x9092=['username','remoteUri','password','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x577bf8,_0x3ea8e0){var _0x9b0d00=function(_0x51faf6){while(--_0x51faf6){_0x577bf8['push'](_0x577bf8['shift']());}};_0x9b0d00(++_0x3ea8e0);}(_0x9092,0x95));var _0x2909=function(_0x21bc17,_0x4c1833){_0x21bc17=_0x21bc17-0x0;var _0x4e3fc9=_0x9092[_0x21bc17];return _0x4e3fc9;};'use strict';function SalesforceAccount(_0x1756e2){this['id']=_0x1756e2['id']||0x0;this[_0x2909('0x0')]=_0x1756e2[_0x2909('0x0')]||'';this[_0x2909('0x1')]=_0x1756e2[_0x2909('0x1')]||'';this['remoteUri']=_0x1756e2[_0x2909('0x2')]||'';this[_0x2909('0x3')]=_0x1756e2[_0x2909('0x3')]||'';this['clientId']=_0x1756e2['clientId']||'';this[_0x2909('0x4')]=_0x1756e2['clientSecret']||'';this[_0x2909('0x5')]=_0x1756e2['securityToken']||'';this['type']=_0x1756e2[_0x2909('0x6')]||_0x2909('0x7');this[_0x2909('0x8')]=_0x1756e2['serverUrl']||'';this[_0x2909('0x9')]=_0x1756e2[_0x2909('0x9')]||{};}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 5e799a4..9ba71d4 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 _0xb5f9=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x589c86,_0x62230c){var _0x206aa0=function(_0x507109){while(--_0x507109){_0x589c86['push'](_0x589c86['shift']());}};_0x206aa0(++_0x62230c);}(_0xb5f9,0x1b0));var _0x9b5f=function(_0x41ccf4,_0x589f78){_0x41ccf4=_0x41ccf4-0x0;var _0x67a52c=_0xb5f9[_0x41ccf4];return _0x67a52c;};'use strict';function ServicenowAccount(_0x14f1a6){this['id']=_0x14f1a6['id']||0x0;this[_0x9b5f('0x0')]=_0x14f1a6[_0x9b5f('0x0')]||'';this[_0x9b5f('0x1')]=_0x14f1a6[_0x9b5f('0x1')]||'';this[_0x9b5f('0x2')]=_0x14f1a6[_0x9b5f('0x2')]||'';this[_0x9b5f('0x3')]=_0x14f1a6[_0x9b5f('0x3')]||'';this[_0x9b5f('0x4')]=_0x14f1a6['serverUrl']||'';this[_0x9b5f('0x5')]=_0x14f1a6['Configurations']||{};}module[_0x9b5f('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x0b1b=['serverUrl','exports','name','username','password','remoteUri'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x0b1b,0x176));var _0xb0b1=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x0b1b[_0x411017];return _0x2adeea;};'use strict';function ServicenowAccount(_0x1d09a1){this['id']=_0x1d09a1['id']||0x0;this['name']=_0x1d09a1[_0xb0b1('0x0')]||'';this['username']=_0x1d09a1[_0xb0b1('0x1')]||'';this[_0xb0b1('0x2')]=_0x1d09a1[_0xb0b1('0x2')]||'';this[_0xb0b1('0x3')]=_0x1d09a1[_0xb0b1('0x3')]||'';this[_0xb0b1('0x4')]=_0x1d09a1[_0xb0b1('0x4')]||'';this['Configurations']=_0x1d09a1['Configurations']||{};}module[_0xb0b1('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 c9b8e00..658e435 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 _0xc737=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x5e2e02,_0xbd5a5e){var _0x396aa4=function(_0x50ef07){while(--_0x50ef07){_0x5e2e02['push'](_0x5e2e02['shift']());}};_0x396aa4(++_0xbd5a5e);}(_0xc737,0x8e));var _0x7c73=function(_0x35928b,_0x53890f){_0x35928b=_0x35928b-0x0;var _0x486edb=_0xc737[_0x35928b];return _0x486edb;};'use strict';function SugarcrmAccount(_0x26bbdd){this['id']=_0x26bbdd['id']||0x0;this[_0x7c73('0x0')]=_0x26bbdd['name']||'';this[_0x7c73('0x1')]=_0x26bbdd[_0x7c73('0x1')]||'';this[_0x7c73('0x2')]=_0x26bbdd[_0x7c73('0x2')]||'';this[_0x7c73('0x3')]=_0x26bbdd[_0x7c73('0x3')]||'';this[_0x7c73('0x4')]=_0x26bbdd['serverUrl']||'';this['Configurations']=_0x26bbdd[_0x7c73('0x5')]||{};}module[_0x7c73('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x6dcd=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x3798e6,_0x586a49){var _0x34e32e=function(_0x417386){while(--_0x417386){_0x3798e6['push'](_0x3798e6['shift']());}};_0x34e32e(++_0x586a49);}(_0x6dcd,0x115));var _0xd6dc=function(_0x13a2de,_0x50bf60){_0x13a2de=_0x13a2de-0x0;var _0x5d111b=_0x6dcd[_0x13a2de];return _0x5d111b;};'use strict';function SugarcrmAccount(_0x450fea){this['id']=_0x450fea['id']||0x0;this[_0xd6dc('0x0')]=_0x450fea['name']||'';this[_0xd6dc('0x1')]=_0x450fea[_0xd6dc('0x1')]||'';this[_0xd6dc('0x2')]=_0x450fea[_0xd6dc('0x2')]||'';this['remoteUri']=_0x450fea[_0xd6dc('0x3')]||'';this[_0xd6dc('0x4')]=_0x450fea[_0xd6dc('0x4')]||'';this['Configurations']=_0x450fea[_0xd6dc('0x5')]||{};}module[_0xd6dc('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 9b17cd5..16933dc 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 _0x1648=['accountcode','state','stateTime','status','exports','name'];(function(_0x4c047e,_0x2ed458){var _0x28b4a9=function(_0x4762cd){while(--_0x4762cd){_0x4c047e['push'](_0x4c047e['shift']());}};_0x28b4a9(++_0x2ed458);}(_0x1648,0xa7));var _0x8164=function(_0xe1ce92,_0x360e16){_0xe1ce92=_0xe1ce92-0x0;var _0x4dd1b5=_0x1648[_0xe1ce92];return _0x4dd1b5;};'use strict';function Telephone(_0x54939f){this['id']=_0x54939f['id']||0x0;this[_0x8164('0x0')]=_0x54939f[_0x8164('0x0')]||'';this[_0x8164('0x1')]=_0x54939f[_0x8164('0x1')]||'';this[_0x8164('0x2')]='unknown';this[_0x8164('0x3')]=0x0;this[_0x8164('0x4')]='unknown';this['address']='';}module[_0x8164('0x5')]=Telephone; \ No newline at end of file +var _0xbe75=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x5b1f65,_0x1b5cb4){var _0x290cc6=function(_0x168364){while(--_0x168364){_0x5b1f65['push'](_0x5b1f65['shift']());}};_0x290cc6(++_0x1b5cb4);}(_0xbe75,0x193));var _0x5be7=function(_0x1cbd30,_0x2d16c3){_0x1cbd30=_0x1cbd30-0x0;var _0x12f937=_0xbe75[_0x1cbd30];return _0x12f937;};'use strict';function Telephone(_0x55c423){this['id']=_0x55c423['id']||0x0;this['name']=_0x55c423[_0x5be7('0x0')]||'';this[_0x5be7('0x1')]=_0x55c423[_0x5be7('0x1')]||'';this[_0x5be7('0x2')]=_0x5be7('0x3');this[_0x5be7('0x4')]=0x0;this[_0x5be7('0x5')]=_0x5be7('0x3');this[_0x5be7('0x6')]='';}module[_0x5be7('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index b3ca473..893b3aa 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(_0x46ccb6,_0x52bbdf){var _0x24fb9a=function(_0x451fa7){while(--_0x451fa7){_0x46ccb6['push'](_0x46ccb6['shift']());}};_0x24fb9a(++_0x52bbdf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x183900,_0x35e2ec){var _0x3aa982=function(_0x44bf1){while(--_0x44bf1){_0x183900['push'](_0x183900['shift']());}};_0x3aa982(++_0x35e2ec);}(_0xb10b,0x12a));var _0xbb10=function(_0x179039,_0x1fb713){_0x179039=_0x179039-0x0;var _0xeb427=_0xb10b[_0x179039];return _0xeb427;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 198a7dd..ef5b589 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x45e5f3,_0x69e558){var _0x332098=function(_0x407310){while(--_0x407310){_0x45e5f3['push'](_0x45e5f3['shift']());}};_0x332098(++_0x69e558);}(_0xda2d,0x102));var _0xdda2=function(_0xb610db,_0x2b8efc){_0xb610db=_0xb610db-0x0;var _0x5c8b8c=_0xda2d[_0xb610db];return _0x5c8b8c;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index fd77ec6..5eb58e4 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 _0xb29c=['domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown','status','registry','split','host','port','domain'];(function(_0xf5fa0d,_0x17485e){var _0x2633e3=function(_0x593a2f){while(--_0x593a2f){_0xf5fa0d['push'](_0xf5fa0d['shift']());}};_0x2633e3(++_0x17485e);}(_0xb29c,0x1b6));var _0xcb29=function(_0x512f8c,_0x3545c1){_0x512f8c=_0x512f8c-0x0;var _0x2099f8=_0xb29c[_0x512f8c];return _0x2099f8;};'use strict';function Trunk(_0x536802){this['id']=_0x536802['id']||0x0;this['active']=_0x536802[_0xcb29('0x0')]||![];this[_0xcb29('0x1')]=_0x536802[_0xcb29('0x1')]||'';this[_0xcb29('0x2')]=_0xcb29('0x3');this['stateTime']=0x0;this[_0xcb29('0x4')]='unknown';this['registry']=_0x536802[_0xcb29('0x5')]&&_0x536802[_0xcb29('0x5')]['indexOf'](':')?_0x536802[_0xcb29('0x5')][_0xcb29('0x6')](':')[0x0]:'';this[_0xcb29('0x7')]='';this[_0xcb29('0x8')]='';this[_0xcb29('0x9')]='';this[_0xcb29('0xa')]='';this[_0xcb29('0xb')]='';this[_0xcb29('0xc')]=_0xcb29('0x3');this['registrationtime']='';this[_0xcb29('0xd')]='';this[_0xcb29('0xe')]=_0x536802[_0xcb29('0xe')]||'';}module[_0xcb29('0xf')]=Trunk; \ No newline at end of file +var _0xd160=['active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports'];(function(_0xb9d78f,_0x56ebf3){var _0x486fe2=function(_0x1c678f){while(--_0x1c678f){_0xb9d78f['push'](_0xb9d78f['shift']());}};_0x486fe2(++_0x56ebf3);}(_0xd160,0x72));var _0x0d16=function(_0x3ef8f7,_0x35359a){_0x3ef8f7=_0x3ef8f7-0x0;var _0x3b097e=_0xd160[_0x3ef8f7];return _0x3b097e;};'use strict';function Trunk(_0x21cba9){this['id']=_0x21cba9['id']||0x0;this[_0x0d16('0x0')]=_0x21cba9[_0x0d16('0x0')]||![];this[_0x0d16('0x1')]=_0x21cba9[_0x0d16('0x1')]||'';this[_0x0d16('0x2')]=_0x0d16('0x3');this[_0x0d16('0x4')]=0x0;this[_0x0d16('0x5')]=_0x0d16('0x3');this[_0x0d16('0x6')]=_0x21cba9[_0x0d16('0x6')]&&_0x21cba9[_0x0d16('0x6')][_0x0d16('0x7')](':')?_0x21cba9['registry'][_0x0d16('0x8')](':')[0x0]:'';this[_0x0d16('0x9')]='';this[_0x0d16('0xa')]='';this[_0x0d16('0xb')]='';this[_0x0d16('0xc')]='';this[_0x0d16('0xd')]='';this[_0x0d16('0xe')]=_0x0d16('0x3');this[_0x0d16('0xf')]='';this[_0x0d16('0x10')]='';this[_0x0d16('0x11')]=_0x21cba9[_0x0d16('0x11')]||'';}module[_0x0d16('0x12')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index dbc847e..d109203 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 _0xd65d=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x2db6f5,_0x4bec94){var _0x1a9c44=function(_0x3784e8){while(--_0x3784e8){_0x2db6f5['push'](_0x2db6f5['shift']());}};_0x1a9c44(++_0x4bec94);}(_0xd65d,0xc8));var _0xdd65=function(_0x4ce49d,_0x1d39a2){_0x4ce49d=_0x4ce49d-0x0;var _0xccb8a3=_0xd65d[_0x4ce49d];return _0xccb8a3;};'use strict';function voiceExtension(_0x24c81c){this['id']=_0x24c81c['id']||0x0;this[_0xdd65('0x0')]=_0x24c81c[_0xdd65('0x0')]||'';this[_0xdd65('0x1')]=_0x24c81c[_0xdd65('0x1')]||'none';this[_0xdd65('0x2')]=_0x24c81c[_0xdd65('0x2')]||![];}module[_0xdd65('0x3')]=voiceExtension; \ No newline at end of file +var _0x13c0=['exten','recordingFormat','mandatoryDisposition'];(function(_0x1da8d5,_0xa48a6d){var _0x23085e=function(_0x44f374){while(--_0x44f374){_0x1da8d5['push'](_0x1da8d5['shift']());}};_0x23085e(++_0xa48a6d);}(_0x13c0,0x19e));var _0x013c=function(_0x39887a,_0x5835ca){_0x39887a=_0x39887a-0x0;var _0x1f8468=_0x13c0[_0x39887a];return _0x1f8468;};'use strict';function voiceExtension(_0x3bca6d){this['id']=_0x3bca6d['id']||0x0;this['exten']=_0x3bca6d[_0x013c('0x0')]||'';this[_0x013c('0x1')]=_0x3bca6d[_0x013c('0x1')]||'none';this[_0x013c('0x2')]=_0x3bca6d[_0x013c('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 2c65625..2d11d02 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 _0x09b1=['timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','sumBillable','unmanaged','available','busy','inUse','invalid','notInUse','onHold','paused','ringing','ringInUse','talking','acw','acwTimeout','autopause','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking'];(function(_0xaf25ae,_0x2001c1){var _0x49732d=function(_0x5b764d){while(--_0x5b764d){_0xaf25ae['push'](_0xaf25ae['shift']());}};_0x49732d(++_0x2001c1);}(_0x09b1,0xa7));var _0x109b=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x09b1[_0x7e2eb0];return _0xd92de4;};'use strict';var monitorFormat={'wav':_0x109b('0x0'),'wav49':_0x109b('0x1'),'gsm':_0x109b('0x2')};var strategy={'fewestcalls':_0x109b('0x3'),'leastrecent':_0x109b('0x4'),'linear':'linear','random':_0x109b('0x5'),'ringall':_0x109b('0x6'),'rr':_0x109b('0x7'),'rrmemory':_0x109b('0x8'),'rrordered':_0x109b('0x9'),'wrandom':_0x109b('0xa')};function VoiceQueue(_0x5d1828){this['id']=_0x5d1828['id']||0x0;this[_0x109b('0xb')]=_0x5d1828[_0x109b('0xb')]||'';this[_0x109b('0xc')]=_0x5d1828[_0x109b('0xc')]||'';this[_0x109b('0xd')]=_0x5d1828['type']||'inbound';this[_0x109b('0xe')]=0x0;this[_0x109b('0xf')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x109b('0x10')]=0x0;this[_0x109b('0x11')]=0x0;this['abandoned']=0x0;this[_0x109b('0x12')]=0x0;this[_0x109b('0x13')]=0x0;this[_0x109b('0x14')]=0x0;this[_0x109b('0x15')]=0x0;this['loggedIn']=0x0;this[_0x109b('0x16')]=0x0;this[_0x109b('0x17')]=0x0;this[_0x109b('0x18')]=0x0;this[_0x109b('0x19')]=0x0;this[_0x109b('0x1a')]=0x0;this[_0x109b('0x1b')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this[_0x109b('0x1c')]=_0x5d1828[_0x109b('0x1c')]||![];this[_0x109b('0x1d')]=_0x5d1828[_0x109b('0x1d')]||0xa;this[_0x109b('0x1e')]=_0x5d1828['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x109b('0x1f')]='';this[_0x109b('0x20')]='';this['originated']=0x0;this[_0x109b('0x21')]=0x0;this[_0x109b('0x22')]=_0x5d1828['dialTimezone']||null;this[_0x109b('0x23')]=_0x5d1828[_0x109b('0x23')]?_0x5d1828[_0x109b('0x23')]:null;this['dialActive']=_0x5d1828['dialActive'];this[_0x109b('0x24')]=_0x5d1828['dialMethod']||'progressive';this[_0x109b('0x25')]=_0x5d1828[_0x109b('0x25')]||0x0;this[_0x109b('0x26')]=_0x5d1828[_0x109b('0x26')]||0x0;this[_0x109b('0x27')]=_0x5d1828[_0x109b('0x27')]||0x1;this[_0x109b('0x28')]=_0x5d1828[_0x109b('0x28')]||_0x109b('0x29');this[_0x109b('0x2a')]=_0x5d1828[_0x109b('0x2a')]||0.03;this['dialPredictiveInterval']=_0x5d1828[_0x109b('0x2b')]||0x258;this[_0x109b('0x2c')]=_0x5d1828[_0x109b('0x2c')]||'anonymous';this[_0x109b('0x2d')]=_0x5d1828[_0x109b('0x2d')]||_0x109b('0x2e');this[_0x109b('0x2f')]=_0x5d1828[_0x109b('0x2f')]||0x1e;this['dialQueueOptions']=_0x5d1828[_0x109b('0x30')]||_0x109b('0x31');this[_0x109b('0x32')]=_0x5d1828[_0x109b('0x32')]||0x3;this[_0x109b('0x33')]=_0x5d1828['dialQueueProject']||undefined;this[_0x109b('0x34')]=_0x5d1828[_0x109b('0x34')]||0x3;this[_0x109b('0x35')]=_0x5d1828[_0x109b('0x35')]||0x96;this[_0x109b('0x36')]=_0x5d1828[_0x109b('0x36')]||0x3;this[_0x109b('0x37')]=_0x5d1828[_0x109b('0x37')]||0x96;this[_0x109b('0x38')]=_0x5d1828[_0x109b('0x38')]||0x3;this[_0x109b('0x39')]=_0x5d1828[_0x109b('0x39')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x5d1828[_0x109b('0x3a')]||0x3;this[_0x109b('0x3b')]=_0x5d1828[_0x109b('0x3b')]||0x96;this[_0x109b('0x3c')]=_0x5d1828[_0x109b('0x3c')]||0x3;this['dialDropRetryFrequency']=_0x5d1828[_0x109b('0x3d')]||0x96;this[_0x109b('0x3e')]=_0x5d1828[_0x109b('0x3e')]||0x3;this[_0x109b('0x3f')]=_0x5d1828[_0x109b('0x3f')]||0x96;this[_0x109b('0x40')]=_0x5d1828[_0x109b('0x40')]||0x3;this[_0x109b('0x41')]=_0x5d1828[_0x109b('0x41')]||0x96;this[_0x109b('0x42')]=_0x5d1828['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x5d1828[_0x109b('0x43')]||0x96;this[_0x109b('0x44')]=_0x5d1828[_0x109b('0x44')]||0x3;this['dialGlobalMaxRetry']=_0x5d1828['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x5d1828[_0x109b('0x45')]?_0x5d1828[_0x109b('0x45')]:undefined;this['TrunkBackup']=_0x5d1828['TrunkBackup']?_0x5d1828['TrunkBackup']:undefined;this[_0x109b('0x46')]=_0x5d1828[_0x109b('0x46')]||undefined;this[_0x109b('0x47')]=_0x5d1828[_0x109b('0x47')]?_0x5d1828[_0x109b('0x47')]:undefined;this['dialOrderByScheduledAt']=_0x5d1828[_0x109b('0x48')]||_0x109b('0x49');this[_0x109b('0x4a')]=_0x5d1828[_0x109b('0x4a')]||undefined;this[_0x109b('0x4b')]=_0x5d1828[_0x109b('0x4b')]||undefined;this['strategy']=strategy[_0x5d1828[_0x109b('0x4c')]];this[_0x109b('0x4d')]=!![];this[_0x109b('0x4e')]=_0x5d1828[_0x109b('0x4e')]||![];this[_0x109b('0x4f')]=_0x5d1828[_0x109b('0x4f')];this[_0x109b('0x50')]=_0x5d1828[_0x109b('0x50')];this[_0x109b('0x51')]=_0x5d1828[_0x109b('0x51')];this[_0x109b('0x52')]=_0x5d1828[_0x109b('0x52')];this[_0x109b('0x53')]=_0x5d1828[_0x109b('0x53')];this[_0x109b('0x54')]=_0x5d1828['dialAMDBetweenWordsSilence'];this[_0x109b('0x55')]=_0x5d1828['dialAMDMaximumNumberOfWords'];this[_0x109b('0x56')]=_0x5d1828[_0x109b('0x56')];this[_0x109b('0x57')]=_0x5d1828['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x109b('0x58')]=0x0;this[_0x109b('0x59')]=_0x5d1828['timeout'];this[_0x109b('0x5a')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x109b('0x5b')]=0x0;this[_0x109b('0x5c')]=0x0;this[_0x109b('0x5d')]=0x0;this[_0x109b('0x5e')]=0x0;this[_0x109b('0x5f')]=0x0;this[_0x109b('0x60')]=0x0;this[_0x109b('0x61')]=0x0;this[_0x109b('0x62')]=0x0;this[_0x109b('0x63')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0x109b('0x64')]=0x0;this[_0x109b('0x65')]=undefined;this[_0x109b('0x66')]=undefined;this['handlePredictive']=undefined;this[_0x109b('0x67')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x109b('0x68')]=0x0;this[_0x109b('0x69')]=0x0;this[_0x109b('0x6a')]=0x0;this[_0x109b('0x6b')]=0x0;this[_0x109b('0x6c')]=0x0;this[_0x109b('0x6d')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x5d1828[_0x109b('0x6e')]||0x14;this[_0x109b('0x6f')]=_0x5d1828[_0x109b('0x6e')]||0xa;this[_0x109b('0x70')]=0x0;this[_0x109b('0x71')]=0x0;this[_0x109b('0x72')]=0x1;this['erlangCalls']=0x0;this[_0x109b('0x73')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x109b('0x74')]=0x0;this[_0x109b('0x75')]=_0x5d1828[_0x109b('0x75')]||0x1e;this[_0x109b('0x76')]=_0x5d1828['dialRecallInQueue']||![];this[_0x109b('0x77')]=!!_0x5d1828['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x5d1828[_0x109b('0x78')]||![];this['dialQueueProject2']=_0x5d1828[_0x109b('0x79')]||undefined;this[_0x109b('0x7a')]=_0x5d1828['dialAgiAfterHangupClient']||![];this[_0x109b('0x7b')]=_0x5d1828[_0x109b('0x7b')]||![];this[_0x109b('0xc')]=monitorFormat[_0x5d1828[_0x109b('0xc')]]?monitorFormat[_0x5d1828[_0x109b('0xc')]]:undefined;this[_0x109b('0x7c')]=_0x5d1828[_0x109b('0x7c')]||![];this[_0x109b('0x7d')]=_0x5d1828[_0x109b('0x7d')]?_0x5d1828[_0x109b('0x7d')]:undefined;this[_0x109b('0x7e')]=![];}module[_0x109b('0x7f')]=VoiceQueue; \ No newline at end of file +var _0x0837=['dialOriginateCallerIdNumber','dialQueueOptions','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','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','unmanaged','available','inUse','invalid','loggedIn','paused','ringInUse','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous'];(function(_0x8b7cf3,_0x29ad74){var _0x46a0b1=function(_0x148848){while(--_0x148848){_0x8b7cf3['push'](_0x8b7cf3['shift']());}};_0x46a0b1(++_0x29ad74);}(_0x0837,0x1db));var _0x7083=function(_0x265d6d,_0x31f6e9){_0x265d6d=_0x265d6d-0x0;var _0x5e93e0=_0x0837[_0x265d6d];return _0x5e93e0;};'use strict';var monitorFormat={'wav':_0x7083('0x0'),'wav49':_0x7083('0x1'),'gsm':_0x7083('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x7083('0x3'),'linear':_0x7083('0x4'),'random':_0x7083('0x5'),'ringall':_0x7083('0x6'),'rr':_0x7083('0x7'),'rrmemory':_0x7083('0x8'),'rrordered':_0x7083('0x9'),'wrandom':_0x7083('0xa')};function VoiceQueue(_0x152edc){this['id']=_0x152edc['id']||0x0;this['name']=_0x152edc[_0x7083('0xb')]||'';this[_0x7083('0xc')]=_0x152edc[_0x7083('0xc')]||'';this[_0x7083('0xd')]=_0x152edc[_0x7083('0xd')]||_0x7083('0xe');this[_0x7083('0xf')]=0x0;this[_0x7083('0x10')]=0x0;this[_0x7083('0x11')]=0x0;this[_0x7083('0x12')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x7083('0x13')]=0x0;this['abandoned']=0x0;this[_0x7083('0x14')]=0x0;this['busy']=0x0;this[_0x7083('0x15')]=0x0;this[_0x7083('0x16')]=0x0;this[_0x7083('0x17')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x7083('0x18')]=0x0;this['ringing']=0x0;this[_0x7083('0x19')]=0x0;this[_0x7083('0x1a')]=0x0;this['unavailable']=0x0;this[_0x7083('0x1b')]=0x0;this[_0x7083('0x1c')]=_0x152edc[_0x7083('0x1c')]||![];this['acwTimeout']=_0x152edc[_0x7083('0x1d')]||0xa;this['autopause']=_0x152edc[_0x7083('0x1e')]||'no';this[_0x7083('0x1f')]=!![];this[_0x7083('0x20')]='';this[_0x7083('0x21')]='';this[_0x7083('0x22')]=0x0;this[_0x7083('0x23')]=0x0;this[_0x7083('0x24')]=_0x152edc[_0x7083('0x24')]||null;this[_0x7083('0x25')]=_0x152edc['dialGlobalInterval']?_0x152edc['dialGlobalInterval']:null;this[_0x7083('0x26')]=_0x152edc[_0x7083('0x26')];this[_0x7083('0x27')]=_0x152edc['dialMethod']||_0x7083('0x28');this['dialLimitChannel']=_0x152edc[_0x7083('0x29')]||0x0;this[_0x7083('0x2a')]=_0x152edc[_0x7083('0x2a')]||0x0;this[_0x7083('0x2b')]=_0x152edc[_0x7083('0x2b')]||0x1;this['dialPredictiveOptimization']=_0x152edc['dialPredictiveOptimization']||_0x7083('0x2c');this[_0x7083('0x2d')]=_0x152edc[_0x7083('0x2d')]||0.03;this[_0x7083('0x2e')]=_0x152edc[_0x7083('0x2e')]||0x258;this[_0x7083('0x2f')]=_0x152edc[_0x7083('0x2f')]||_0x7083('0x30');this[_0x7083('0x31')]=_0x152edc[_0x7083('0x31')]||_0x7083('0x30');this['dialOriginateTimeout']=_0x152edc['dialOriginateTimeout']||0x1e;this[_0x7083('0x32')]=_0x152edc[_0x7083('0x32')]||'tTxX';this[_0x7083('0x33')]=_0x152edc[_0x7083('0x33')]||0x3;this[_0x7083('0x34')]=_0x152edc[_0x7083('0x34')]||undefined;this[_0x7083('0x35')]=_0x152edc[_0x7083('0x35')]||0x3;this[_0x7083('0x36')]=_0x152edc['dialCongestionRetryFrequency']||0x96;this[_0x7083('0x37')]=_0x152edc[_0x7083('0x37')]||0x3;this[_0x7083('0x38')]=_0x152edc[_0x7083('0x38')]||0x96;this[_0x7083('0x39')]=_0x152edc[_0x7083('0x39')]||0x3;this[_0x7083('0x3a')]=_0x152edc[_0x7083('0x3a')]||0x96;this[_0x7083('0x3b')]=_0x152edc[_0x7083('0x3b')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x152edc[_0x7083('0x3c')]||0x96;this[_0x7083('0x3d')]=_0x152edc[_0x7083('0x3d')]||0x3;this[_0x7083('0x3e')]=_0x152edc[_0x7083('0x3e')]||0x96;this[_0x7083('0x3f')]=_0x152edc['dialAbandonedMaxRetry']||0x3;this[_0x7083('0x40')]=_0x152edc['dialAbandonedRetryFrequency']||0x96;this[_0x7083('0x41')]=_0x152edc[_0x7083('0x41')]||0x3;this[_0x7083('0x42')]=_0x152edc[_0x7083('0x42')]||0x96;this[_0x7083('0x43')]=_0x152edc[_0x7083('0x43')]||0x3;this['dialAgentRejectRetryFrequency']=_0x152edc[_0x7083('0x44')]||0x96;this[_0x7083('0x45')]=_0x152edc[_0x7083('0x45')]||0x3;this['dialGlobalMaxRetry']=_0x152edc[_0x7083('0x46')]||0x4;this[_0x7083('0x47')]=_0x152edc[_0x7083('0x47')]?_0x152edc[_0x7083('0x47')]:undefined;this['TrunkBackup']=_0x152edc[_0x7083('0x48')]?_0x152edc[_0x7083('0x48')]:undefined;this[_0x7083('0x49')]=_0x152edc[_0x7083('0x49')]||undefined;this[_0x7083('0x4a')]=_0x152edc[_0x7083('0x4a')]?_0x152edc['Interval']:undefined;this[_0x7083('0x4b')]=_0x152edc[_0x7083('0x4b')]||_0x7083('0x4c');this[_0x7083('0x4d')]=_0x152edc[_0x7083('0x4d')]||undefined;this['dialCutDigit']=_0x152edc[_0x7083('0x4e')]||undefined;this['strategy']=strategy[_0x152edc['strategy']];this[_0x7083('0x4f')]=!![];this[_0x7083('0x50')]=_0x152edc['dialAMDActive']||![];this[_0x7083('0x51')]=_0x152edc[_0x7083('0x51')];this['dialAMDGreeting']=_0x152edc['dialAMDGreeting'];this[_0x7083('0x52')]=_0x152edc[_0x7083('0x52')];this[_0x7083('0x53')]=_0x152edc[_0x7083('0x53')];this['dialAMDMinWordLength']=_0x152edc[_0x7083('0x54')];this[_0x7083('0x55')]=_0x152edc[_0x7083('0x55')];this[_0x7083('0x56')]=_0x152edc[_0x7083('0x56')];this[_0x7083('0x57')]=_0x152edc[_0x7083('0x57')];this['dialAMDMaximumWordLength']=_0x152edc[_0x7083('0x58')];this[_0x7083('0x59')]=0x0;this[_0x7083('0x5a')]=0x0;this['timeout']=_0x152edc[_0x7083('0x5b')];this[_0x7083('0x5c')]=0x0;this[_0x7083('0x5d')]=0x0;this[_0x7083('0x5e')]=0x0;this[_0x7083('0x5f')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x7083('0x60')]=0x0;this[_0x7083('0x61')]=0x0;this[_0x7083('0x62')]=0x0;this[_0x7083('0x63')]=0x0;this[_0x7083('0x64')]=0x0;this[_0x7083('0x65')]=0x0;this[_0x7083('0x66')]=0x0;this[_0x7083('0x67')]=0x0;this[_0x7083('0x68')]=0x0;this['startProgressive']=undefined;this[_0x7083('0x69')]=undefined;this[_0x7083('0x6a')]=undefined;this[_0x7083('0x6b')]=1.05;this[_0x7083('0x6c')]=0x0;this[_0x7083('0x6d')]=0x0;this[_0x7083('0x6e')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x7083('0x6f')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x152edc[_0x7083('0x70')]||0x14;this[_0x7083('0x71')]=_0x152edc[_0x7083('0x70')]||0xa;this[_0x7083('0x72')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x7083('0x73')]=0x1;this[_0x7083('0x74')]=0x0;this[_0x7083('0x75')]=0x0;this[_0x7083('0x76')]=0x0;this[_0x7083('0x77')]=0x0;this[_0x7083('0x78')]=_0x152edc['dialRecallMeTimeout']||0x1e;this[_0x7083('0x79')]=_0x152edc[_0x7083('0x79')]||![];this[_0x7083('0x7a')]=!!_0x152edc[_0x7083('0x7a')]||![];this[_0x7083('0x7b')]=!!_0x152edc['dialPreviewRecallmeReminder']||![];this[_0x7083('0x7c')]=_0x152edc[_0x7083('0x7c')]||undefined;this['dialAgiAfterHangupClient']=_0x152edc[_0x7083('0x7d')]||![];this[_0x7083('0x7e')]=_0x152edc['dialAgiAfterHangupAgent']||![];this[_0x7083('0xc')]=monitorFormat[_0x152edc[_0x7083('0xc')]]?monitorFormat[_0x152edc[_0x7083('0xc')]]:undefined;this[_0x7083('0x7f')]=_0x152edc[_0x7083('0x7f')]||![];this[_0x7083('0x80')]=_0x152edc[_0x7083('0x80')]?_0x152edc[_0x7083('0x80')]:undefined;this[_0x7083('0x81')]=![];}module[_0x7083('0x82')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 7f9e075..fd47a0a 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 _0x5183=['dialPrefix','temp','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','SIP/','online','includes','status','booked','length','queue','dialer','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','talking','waiting','answered','originated','outboundAbandonedCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','paused','pTalking','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringing','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x520071,_0x449f4d){var _0x2c2ec6=function(_0x298936){while(--_0x298936){_0x520071['push'](_0x520071['shift']());}};_0x2c2ec6(++_0x449f4d);}(_0x5183,0x13e));var _0x3518=function(_0x7bd0d3,_0x50d7c9){_0x7bd0d3=_0x7bd0d3-0x0;var _0x480fbc=_0x5183[_0x7bd0d3];return _0x480fbc;};'use strict';var INBOUND_COUNTERS=[_0x3518('0x0'),_0x3518('0x1'),_0x3518('0x2'),'paused','ringing',_0x3518('0x3'),_0x3518('0x4')];var OUTBOUND_COUNTERS=[_0x3518('0x0'),_0x3518('0x5'),'inUse','loggedIn',_0x3518('0x2'),_0x3518('0x6'),_0x3518('0x7'),'outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay',_0x3518('0x8'),_0x3518('0x9'),_0x3518('0xa'),'outboundReCallsDay',_0x3518('0xb'),'outboundUnknownCallsDay',_0x3518('0xc'),_0x3518('0xd'),_0x3518('0x3'),'sumBillable',_0x3518('0xe'),_0x3518('0xf'),'waiting'];function VoiceQueueSummary(_0x4631a7){this['id']=_0x4631a7['id'];this[_0x3518('0x10')]=_0x4631a7[_0x3518('0x10')];this[_0x3518('0x11')]=_0x4631a7['strategy'];this['abandoned']=_0x4631a7[_0x3518('0x12')]||0x0;this[_0x3518('0x5')]=_0x4631a7[_0x3518('0x5')]||0x0;this['available']=_0x4631a7['available']||0x0;this[_0x3518('0x13')]=_0x4631a7[_0x3518('0x13')]||0x0;this[_0x3518('0x14')]=_0x4631a7['inUse']||0x0;this[_0x3518('0x15')]=_0x4631a7[_0x3518('0x15')]||0x0;this[_0x3518('0x1')]=_0x4631a7[_0x3518('0x1')]||0x0;this['loggedInDb']=_0x4631a7[_0x3518('0x2')]||0x0;this['onHold']=_0x4631a7[_0x3518('0x16')]||0x0;this['notInUse']=_0x4631a7[_0x3518('0x17')]||0x0;this[_0x3518('0xc')]=_0x4631a7['paused']||0x0;this[_0x3518('0x18')]=_0x4631a7[_0x3518('0x18')]||0x0;this[_0x3518('0x19')]=_0x4631a7[_0x3518('0x19')];this[_0x3518('0x1a')]=_0x4631a7['sumBillable'];this[_0x3518('0xe')]=_0x4631a7['sumDuration'];this[_0x3518('0x1b')]=_0x4631a7[_0x3518('0x1b')]||0x0;this[_0x3518('0x3')]=_0x4631a7['talking']||0x0;this[_0x3518('0xf')]=_0x4631a7[_0x3518('0xf')]||0x0;this[_0x3518('0x1c')]=_0x4631a7[_0x3518('0x1c')];this[_0x3518('0x1d')]=_0x4631a7['unavailable']||0x0;this[_0x3518('0x1e')]=_0x4631a7[_0x3518('0x1e')]||0x0;this[_0x3518('0x1f')]=_0x4631a7[_0x3518('0x1f')]||0x0;this[_0x3518('0x4')]=_0x4631a7[_0x3518('0x4')]||0x0;if(_0x4631a7[_0x3518('0x1c')]===_0x3518('0x20')){this[_0x3518('0xd')]=_0x4631a7[_0x3518('0xd')]||0x0;this[_0x3518('0x21')]=_0x4631a7[_0x3518('0x21')];this[_0x3518('0x22')]=_0x4631a7[_0x3518('0x22')];this[_0x3518('0x23')]=_0x4631a7[_0x3518('0x23')];this[_0x3518('0x24')]=_0x4631a7[_0x3518('0x24')];this[_0x3518('0x25')]=_0x4631a7[_0x3518('0x25')];this[_0x3518('0x26')]=_0x4631a7[_0x3518('0x26')];this[_0x3518('0x27')]=_0x4631a7[_0x3518('0x27')];this['outboundAnswerAgiCallsDay']=_0x4631a7['outboundAnswerAgiCallsDay'];this[_0x3518('0x28')]=_0x4631a7[_0x3518('0x28')];this['outboundBlacklistCallsDay']=_0x4631a7[_0x3518('0x29')];this[_0x3518('0x2a')]=_0x4631a7['outboundBusyCallsDay'];this[_0x3518('0x8')]=_0x4631a7['outboundCongestionCallsDay'];this[_0x3518('0x2b')]=_0x4631a7['outboundDropCallsDayACS'];this[_0x3518('0x2c')]=_0x4631a7[_0x3518('0x2c')];this[_0x3518('0x2d')]=_0x4631a7[_0x3518('0x2d')];this[_0x3518('0x9')]=_0x4631a7[_0x3518('0x9')];this['outboundNoSuchCallsDay']=_0x4631a7[_0x3518('0xa')];this['outboundOriginateFailureCallsDay']=_0x4631a7[_0x3518('0x2e')];this[_0x3518('0x2f')]=_0x4631a7[_0x3518('0x2f')];this[_0x3518('0xb')]=_0x4631a7[_0x3518('0xb')];this[_0x3518('0x30')]=_0x4631a7[_0x3518('0x30')];this[_0x3518('0x31')]=_0x4631a7[_0x3518('0x31')];this[_0x3518('0x32')]=_0x4631a7[_0x3518('0x32')];this[_0x3518('0x33')]=_0x4631a7[_0x3518('0x33')];this['predictiveIntervalDroppedCallsCallersExit']=_0x4631a7[_0x3518('0x34')];this[_0x3518('0x35')]=_0x4631a7[_0x3518('0x35')];this[_0x3518('0x36')]=_0x4631a7[_0x3518('0x36')];this[_0x3518('0x37')]=_0x4631a7[_0x3518('0x37')];this['predictiveIntervalHitRate']=_0x4631a7[_0x3518('0x38')];this[_0x3518('0x39')]=_0x4631a7[_0x3518('0x39')];this[_0x3518('0x3a')]=_0x4631a7['predictiveIntervalPauses'];this['predictiveIntervalAvailable']=_0x4631a7[_0x3518('0x3b')];this[_0x3518('0x3c')]=_0x4631a7[_0x3518('0x3c')];this[_0x3518('0x6')]=_0x4631a7['originated'];this[_0x3518('0x3d')]=_0x4631a7[_0x3518('0x3d')];this[_0x3518('0x3e')]=_0x4631a7[_0x3518('0x3e')];this[_0x3518('0x3f')]=_0x4631a7['erlangAbandonmentRate'];this[_0x3518('0x40')]=_0x4631a7[_0x3518('0x40')];this[_0x3518('0x41')]=_0x4631a7[_0x3518('0x41')];this[_0x3518('0x42')]=_0x4631a7[_0x3518('0x42')];this[_0x3518('0x43')]=_0x4631a7[_0x3518('0x43')];this[_0x3518('0x44')]=_0x4631a7['statusMessage'];}if(_0x4631a7[_0x3518('0x45')]){this[_0x3518('0x45')]={'id':_0x4631a7[_0x3518('0x45')]['id'],'name':_0x4631a7['Trunk'][_0x3518('0x10')],'active':_0x4631a7[_0x3518('0x45')]['active'],'callerid':_0x4631a7['Trunk'][_0x3518('0x46')]};}}VoiceQueueSummary[_0x3518('0x47')][_0x3518('0x48')]=function(_0x2d9f87,_0x2af55f,_0x3bb411,_0x485409){this[_0x3518('0x2')]=0x0;this[_0x3518('0x3')]=0x0;this[_0x3518('0xc')]=0x0;this[_0x3518('0x1e')]=0x0;this['notInUse']=0x0;this[_0x3518('0x14')]=0x0;this[_0x3518('0x13')]=0x0;this[_0x3518('0x15')]=0x0;this[_0x3518('0x1d')]=0x0;this[_0x3518('0x18')]=0x0;this[_0x3518('0x19')]=0x0;this[_0x3518('0x16')]=0x0;if(_0x3bb411){if(_0x3bb411[_0x3518('0x0')]){this[_0x3518('0x0')]=Number(_0x3bb411[_0x3518('0x0')]);}if(_0x3bb411[_0x3518('0x49')]){this[_0x3518('0x1')]=Number(_0x3bb411['loggedin']);}if(_0x3bb411['callers']){this[_0x3518('0x4')]=Number(_0x3bb411['callers']);}}for(var _0x52df96=0x0;_0x52df96<_0x2d9f87['length'];_0x52df96++){var _0x2acc44=_0x2af55f[_0x3518('0x4a')+_0x2d9f87[_0x52df96][_0x3518('0x10')]];if(_0x2acc44&&_0x2acc44[_0x3518('0x4b')]){this[_0x3518('0x2')]+=0x1;}if(_0x2d9f87[_0x52df96]['incall']==='1'){this[_0x3518('0x3')]+=0x1;}if(_0x2d9f87[_0x52df96]['paused']==='1'&&!['2','7','8'][_0x3518('0x4c')](_0x2d9f87[_0x52df96][_0x3518('0x4d')])){this['paused']+=0x1;}switch(_0x2d9f87[_0x52df96]['status']){case'0':this[_0x3518('0x1e')]+=0x1;break;case'1':this[_0x3518('0x17')]+=0x1;break;case'2':this[_0x3518('0x14')]+=0x1;break;case'3':this[_0x3518('0x13')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x3518('0x1d')]+=0x1;break;case'6':this[_0x3518('0x18')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x3518('0x16')]+=0x1;break;}}if(this['dialMethod']===_0x3518('0x4e')){var _0x3e8236=Object['keys'](_0x485409);for(var _0x1c2506=0x0;_0x1c2506<_0x3e8236[_0x3518('0x4f')];_0x1c2506++){var _0x5a294b=_0x3e8236[_0x1c2506];var _0x538ec7=_0x485409[_0x5a294b];if(_0x538ec7[_0x3518('0x50')]===this[_0x3518('0x10')]&&_0x538ec7[_0x3518('0x1c')]===_0x3518('0x51')&&_0x538ec7['exten']===_0x3518('0x52')){this[_0x3518('0x3')]+=0x1;}}if(this[_0x3518('0x3')]>this[_0x3518('0x14')]){this[_0x3518('0x3')]=this[_0x3518('0x14')];}this[_0x3518('0xd')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x3518('0x53')]=function(_0x31b881){var _0x59a0af=![];if(_0x31b881){_0x59a0af=INBOUND_COUNTERS[_0x3518('0x54')](function(_0x3b2869){return this[_0x3b2869]!==_0x31b881[_0x3b2869];},this);}return _0x59a0af;};VoiceQueueSummary[_0x3518('0x47')]['compareToOutboundQueue']=function(_0x44fdac){var _0xae2751=![];var _0x4f8cb6=![];var _0x50b998=![];if(_0x44fdac){_0xae2751=this[_0x3518('0x22')]!==_0x44fdac['dialMethod']||this[_0x3518('0x21')]!==_0x44fdac['dialActive']||this[_0x3518('0x43')]!==_0x44fdac[_0x3518('0x43')]||this[_0x3518('0x44')]!==_0x44fdac['statusMessage'];_0x4f8cb6=OUTBOUND_COUNTERS[_0x3518('0x54')](function(_0x54696e){return this[_0x54696e]!==_0x44fdac[_0x54696e];},this);if(this[_0x3518('0x45')]&&_0x44fdac['Trunk']){_0x50b998=this[_0x3518('0x45')]['name']!==_0x44fdac[_0x3518('0x45')][_0x3518('0x10')]||this[_0x3518('0x45')][_0x3518('0x55')]!==_0x44fdac[_0x3518('0x45')][_0x3518('0x55')];}}return _0xae2751||_0x4f8cb6||_0x50b998;};VoiceQueueSummary[_0x3518('0x47')][_0x3518('0x56')]=function(_0x25e97b){this[_0x3518('0x5')]=_0x25e97b[_0x3518('0x5')];this[_0x3518('0x43')]=_0x25e97b[_0x3518('0x43')];this[_0x3518('0x44')]=_0x25e97b[_0x3518('0x44')];this['originated']=_0x25e97b[_0x3518('0x6')];this['outboundAbandonedCallsDay']=_0x25e97b[_0x3518('0x7')];this[_0x3518('0x28')]=_0x25e97b[_0x3518('0x28')];this[_0x3518('0x29')]=_0x25e97b[_0x3518('0x29')];this[_0x3518('0x2a')]=_0x25e97b['outboundBusyCallsDay'];this[_0x3518('0x8')]=_0x25e97b[_0x3518('0x8')];this[_0x3518('0x9')]=_0x25e97b[_0x3518('0x9')];this['outboundNoSuchCallsDay']=_0x25e97b[_0x3518('0xa')];this['outboundReCallsDay']=_0x25e97b[_0x3518('0x2f')];this[_0x3518('0xb')]=_0x25e97b[_0x3518('0xb')];this[_0x3518('0x30')]=_0x25e97b[_0x3518('0x30')];this[_0x3518('0x1a')]=_0x25e97b[_0x3518('0x1a')];this[_0x3518('0xe')]=_0x25e97b[_0x3518('0xe')];this['total']=_0x25e97b['total'];if(this[_0x3518('0x22')]===_0x3518('0x57')){this[_0x3518('0xd')]=_0x25e97b[_0x3518('0xd')];}};module[_0x3518('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x394e=['dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','Trunk','callerid','createReport','loggedin','callers','length','online','incall','includes','status','keys','exten','prototype','compareToInboundQueue','some','compareToOutboundQueue','statusMessage','active','updateReportFromOutboundQueue','exports','available','loggedIn','paused','ringing','talking','waiting','answered','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x2a88b8,_0x949464){var _0xf5c7a5=function(_0x5d1918){while(--_0x5d1918){_0x2a88b8['push'](_0x2a88b8['shift']());}};_0xf5c7a5(++_0x949464);}(_0x394e,0x88));var _0xe394=function(_0xd13a88,_0x3c5269){_0xd13a88=_0xd13a88-0x0;var _0x1c993c=_0x394e[_0xd13a88];return _0x1c993c;};'use strict';var INBOUND_COUNTERS=[_0xe394('0x0'),_0xe394('0x1'),'loggedInDb',_0xe394('0x2'),_0xe394('0x3'),_0xe394('0x4'),_0xe394('0x5')];var OUTBOUND_COUNTERS=['available',_0xe394('0x6'),_0xe394('0x7'),_0xe394('0x1'),_0xe394('0x8'),_0xe394('0x9'),_0xe394('0xa'),_0xe394('0xb'),_0xe394('0xc'),_0xe394('0xd'),_0xe394('0xe'),_0xe394('0xf'),'outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay',_0xe394('0x10'),_0xe394('0x2'),_0xe394('0x11'),_0xe394('0x4'),_0xe394('0x12'),_0xe394('0x13'),_0xe394('0x14'),_0xe394('0x5')];function VoiceQueueSummary(_0x1285de){this['id']=_0x1285de['id'];this[_0xe394('0x15')]=_0x1285de[_0xe394('0x15')];this[_0xe394('0x16')]=_0x1285de['strategy'];this['abandoned']=_0x1285de['abandoned']||0x0;this[_0xe394('0x6')]=_0x1285de[_0xe394('0x6')]||0x0;this['available']=_0x1285de[_0xe394('0x0')]||0x0;this[_0xe394('0x17')]=_0x1285de[_0xe394('0x17')]||0x0;this[_0xe394('0x7')]=_0x1285de[_0xe394('0x7')]||0x0;this[_0xe394('0x18')]=_0x1285de['invalid']||0x0;this['loggedIn']=_0x1285de[_0xe394('0x1')]||0x0;this[_0xe394('0x8')]=_0x1285de[_0xe394('0x8')]||0x0;this[_0xe394('0x19')]=_0x1285de['onHold']||0x0;this[_0xe394('0x1a')]=_0x1285de['notInUse']||0x0;this[_0xe394('0x2')]=_0x1285de[_0xe394('0x2')]||0x0;this[_0xe394('0x3')]=_0x1285de['ringing']||0x0;this[_0xe394('0x1b')]=_0x1285de[_0xe394('0x1b')];this[_0xe394('0x12')]=_0x1285de['sumBillable'];this[_0xe394('0x13')]=_0x1285de[_0xe394('0x13')];this[_0xe394('0x1c')]=_0x1285de[_0xe394('0x1c')]||0x0;this[_0xe394('0x4')]=_0x1285de[_0xe394('0x4')]||0x0;this[_0xe394('0x14')]=_0x1285de[_0xe394('0x14')]||0x0;this[_0xe394('0x1d')]=_0x1285de[_0xe394('0x1d')];this[_0xe394('0x1e')]=_0x1285de[_0xe394('0x1e')]||0x0;this['unknown']=_0x1285de[_0xe394('0x1f')]||0x0;this[_0xe394('0x20')]=_0x1285de[_0xe394('0x20')]||0x0;this[_0xe394('0x5')]=_0x1285de[_0xe394('0x5')]||0x0;if(_0x1285de['type']===_0xe394('0x21')){this[_0xe394('0x11')]=_0x1285de[_0xe394('0x11')]||0x0;this[_0xe394('0x22')]=_0x1285de['dialActive'];this[_0xe394('0x23')]=_0x1285de[_0xe394('0x23')];this[_0xe394('0x24')]=_0x1285de[_0xe394('0x24')];this[_0xe394('0x25')]=_0x1285de['dialOriginateCallerIdNumber'];this[_0xe394('0x26')]=_0x1285de[_0xe394('0x26')];this[_0xe394('0x27')]=_0x1285de[_0xe394('0x27')];this[_0xe394('0x28')]=_0x1285de[_0xe394('0x28')];this[_0xe394('0x29')]=_0x1285de[_0xe394('0x29')];this[_0xe394('0xb')]=_0x1285de['outboundAnswerCallsDay'];this[_0xe394('0xc')]=_0x1285de[_0xe394('0xc')];this[_0xe394('0xd')]=_0x1285de[_0xe394('0xd')];this[_0xe394('0xe')]=_0x1285de['outboundCongestionCallsDay'];this['outboundDropCallsDayACS']=_0x1285de[_0xe394('0x2a')];this[_0xe394('0x2b')]=_0x1285de[_0xe394('0x2b')];this['outboundDropCallsDayTimeout']=_0x1285de[_0xe394('0x2c')];this['outboundNoAnswerCallsDay']=_0x1285de['outboundNoAnswerCallsDay'];this[_0xe394('0x2d')]=_0x1285de[_0xe394('0x2d')];this[_0xe394('0x2e')]=_0x1285de[_0xe394('0x2e')];this[_0xe394('0x2f')]=_0x1285de[_0xe394('0x2f')];this[_0xe394('0x30')]=_0x1285de[_0xe394('0x30')];this[_0xe394('0x10')]=_0x1285de[_0xe394('0x10')];this[_0xe394('0x31')]=_0x1285de['predictiveIntervalAnsweredCalls'];this[_0xe394('0x32')]=_0x1285de[_0xe394('0x32')];this[_0xe394('0x33')]=_0x1285de[_0xe394('0x33')];this[_0xe394('0x34')]=_0x1285de[_0xe394('0x34')];this['predictiveIntervalDroppedCallsTimeout']=_0x1285de['predictiveIntervalDroppedCallsTimeout'];this[_0xe394('0x35')]=_0x1285de[_0xe394('0x35')];this[_0xe394('0x36')]=_0x1285de[_0xe394('0x36')];this[_0xe394('0x37')]=_0x1285de[_0xe394('0x37')];this[_0xe394('0x38')]=_0x1285de[_0xe394('0x38')];this[_0xe394('0x39')]=_0x1285de[_0xe394('0x39')];this[_0xe394('0x3a')]=_0x1285de[_0xe394('0x3a')];this[_0xe394('0x3b')]=_0x1285de[_0xe394('0x3b')];this[_0xe394('0x9')]=_0x1285de['originated'];this[_0xe394('0x3c')]=_0x1285de[_0xe394('0x3c')];this[_0xe394('0x3d')]=_0x1285de[_0xe394('0x3d')];this[_0xe394('0x3e')]=_0x1285de['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x1285de[_0xe394('0x3f')];this['startPredictive']=_0x1285de[_0xe394('0x40')];this[_0xe394('0x41')]=_0x1285de[_0xe394('0x41')];this['message']=_0x1285de[_0xe394('0x42')];this['statusMessage']=_0x1285de['statusMessage'];}if(_0x1285de[_0xe394('0x43')]){this[_0xe394('0x43')]={'id':_0x1285de[_0xe394('0x43')]['id'],'name':_0x1285de['Trunk'][_0xe394('0x15')],'active':_0x1285de[_0xe394('0x43')]['active'],'callerid':_0x1285de[_0xe394('0x43')][_0xe394('0x44')]};}}VoiceQueueSummary['prototype'][_0xe394('0x45')]=function(_0x3b5f69,_0x380a4e,_0x2a0db4,_0x32ab74){this['loggedInDb']=0x0;this[_0xe394('0x4')]=0x0;this[_0xe394('0x2')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0xe394('0x7')]=0x0;this[_0xe394('0x17')]=0x0;this[_0xe394('0x18')]=0x0;this[_0xe394('0x1e')]=0x0;this[_0xe394('0x3')]=0x0;this[_0xe394('0x1b')]=0x0;this[_0xe394('0x19')]=0x0;if(_0x2a0db4){if(_0x2a0db4[_0xe394('0x0')]){this[_0xe394('0x0')]=Number(_0x2a0db4[_0xe394('0x0')]);}if(_0x2a0db4['loggedin']){this[_0xe394('0x1')]=Number(_0x2a0db4[_0xe394('0x46')]);}if(_0x2a0db4[_0xe394('0x47')]){this[_0xe394('0x5')]=Number(_0x2a0db4['callers']);}}for(var _0x5aa73c=0x0;_0x5aa73c<_0x3b5f69[_0xe394('0x48')];_0x5aa73c++){var _0x12834f=_0x380a4e['SIP/'+_0x3b5f69[_0x5aa73c][_0xe394('0x15')]];if(_0x12834f&&_0x12834f[_0xe394('0x49')]){this['loggedInDb']+=0x1;}if(_0x3b5f69[_0x5aa73c][_0xe394('0x4a')]==='1'){this[_0xe394('0x4')]+=0x1;}if(_0x3b5f69[_0x5aa73c][_0xe394('0x2')]==='1'&&!['2','7','8'][_0xe394('0x4b')](_0x3b5f69[_0x5aa73c][_0xe394('0x4c')])){this[_0xe394('0x2')]+=0x1;}switch(_0x3b5f69[_0x5aa73c][_0xe394('0x4c')]){case'0':this[_0xe394('0x1f')]+=0x1;break;case'1':this[_0xe394('0x1a')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xe394('0x18')]+=0x1;break;case'5':this[_0xe394('0x1e')]+=0x1;break;case'6':this[_0xe394('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xe394('0x19')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x2b45a0=Object[_0xe394('0x4d')](_0x32ab74);for(var _0x4a5550=0x0;_0x4a5550<_0x2b45a0[_0xe394('0x48')];_0x4a5550++){var _0x49046b=_0x2b45a0[_0x4a5550];var _0x5a788c=_0x32ab74[_0x49046b];if(_0x5a788c['queue']===this[_0xe394('0x15')]&&_0x5a788c[_0xe394('0x1d')]==='dialer'&&_0x5a788c[_0xe394('0x4e')]==='xcally-motion-preview'){this[_0xe394('0x4')]+=0x1;}}if(this[_0xe394('0x4')]>this[_0xe394('0x7')]){this[_0xe394('0x4')]=this[_0xe394('0x7')];}this[_0xe394('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xe394('0x4f')][_0xe394('0x50')]=function(_0x7767f3){var _0x2a8841=![];if(_0x7767f3){_0x2a8841=INBOUND_COUNTERS[_0xe394('0x51')](function(_0x324bcd){return this[_0x324bcd]!==_0x7767f3[_0x324bcd];},this);}return _0x2a8841;};VoiceQueueSummary[_0xe394('0x4f')][_0xe394('0x52')]=function(_0x5dd4df){var _0x56cdd5=![];var _0x8bacdf=![];var _0x41eaa4=![];if(_0x5dd4df){_0x56cdd5=this[_0xe394('0x23')]!==_0x5dd4df['dialMethod']||this['dialActive']!==_0x5dd4df['dialActive']||this[_0xe394('0x42')]!==_0x5dd4df['message']||this[_0xe394('0x53')]!==_0x5dd4df['statusMessage'];_0x8bacdf=OUTBOUND_COUNTERS[_0xe394('0x51')](function(_0x27f67f){return this[_0x27f67f]!==_0x5dd4df[_0x27f67f];},this);if(this[_0xe394('0x43')]&&_0x5dd4df[_0xe394('0x43')]){_0x41eaa4=this[_0xe394('0x43')][_0xe394('0x15')]!==_0x5dd4df[_0xe394('0x43')][_0xe394('0x15')]||this[_0xe394('0x43')][_0xe394('0x54')]!==_0x5dd4df[_0xe394('0x43')][_0xe394('0x54')];}}return _0x56cdd5||_0x8bacdf||_0x41eaa4;};VoiceQueueSummary['prototype'][_0xe394('0x55')]=function(_0x1fe577){this[_0xe394('0x6')]=_0x1fe577[_0xe394('0x6')];this['message']=_0x1fe577[_0xe394('0x42')];this[_0xe394('0x53')]=_0x1fe577[_0xe394('0x53')];this['originated']=_0x1fe577[_0xe394('0x9')];this[_0xe394('0xa')]=_0x1fe577['outboundAbandonedCallsDay'];this[_0xe394('0xb')]=_0x1fe577[_0xe394('0xb')];this[_0xe394('0xc')]=_0x1fe577[_0xe394('0xc')];this[_0xe394('0xd')]=_0x1fe577[_0xe394('0xd')];this[_0xe394('0xe')]=_0x1fe577[_0xe394('0xe')];this[_0xe394('0xf')]=_0x1fe577['outboundNoAnswerCallsDay'];this[_0xe394('0x2d')]=_0x1fe577[_0xe394('0x2d')];this['outboundReCallsDay']=_0x1fe577[_0xe394('0x2f')];this['outboundRejectCallsDay']=_0x1fe577['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x1fe577[_0xe394('0x10')];this['sumBillable']=_0x1fe577['sumBillable'];this[_0xe394('0x13')]=_0x1fe577['sumDuration'];this[_0xe394('0x14')]=_0x1fe577[_0xe394('0x14')];if(this[_0xe394('0x23')]==='preview'){this[_0xe394('0x11')]=_0x1fe577['pTalking'];}};module[_0xe394('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index bcd8731..2fe446a 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 _0x6788=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6788,0xfa));var _0x8678=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x6788[_0x29d94e];return _0x106237;};'use strict';function VtigerAccount(_0x450ef3){this['id']=_0x450ef3['id']||0x0;this[_0x8678('0x0')]=_0x450ef3[_0x8678('0x0')]||'';this[_0x8678('0x1')]=_0x450ef3[_0x8678('0x1')]||'';this['accessKey']=_0x450ef3['accessKey']||'';this['remoteUri']=_0x450ef3[_0x8678('0x2')]||'';this[_0x8678('0x3')]=_0x450ef3[_0x8678('0x3')]||'';this[_0x8678('0x4')]=_0x450ef3[_0x8678('0x4')]||{};}module[_0x8678('0x5')]=VtigerAccount; \ No newline at end of file +var _0xe359=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0xa05c26,_0xe1c53e){var _0x150a81=function(_0x26fb24){while(--_0x26fb24){_0xa05c26['push'](_0xa05c26['shift']());}};_0x150a81(++_0xe1c53e);}(_0xe359,0x9b));var _0x9e35=function(_0x1f6f82,_0x468ca0){_0x1f6f82=_0x1f6f82-0x0;var _0x4b6d39=_0xe359[_0x1f6f82];return _0x4b6d39;};'use strict';function VtigerAccount(_0x47f21c){this['id']=_0x47f21c['id']||0x0;this[_0x9e35('0x0')]=_0x47f21c[_0x9e35('0x0')]||'';this[_0x9e35('0x1')]=_0x47f21c[_0x9e35('0x1')]||'';this[_0x9e35('0x2')]=_0x47f21c[_0x9e35('0x2')]||'';this[_0x9e35('0x3')]=_0x47f21c[_0x9e35('0x3')]||'';this[_0x9e35('0x4')]=_0x47f21c['serverUrl']||'';this[_0x9e35('0x5')]=_0x47f21c[_0x9e35('0x5')]||{};}module[_0x9e35('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 8556a49..a3c7453 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 _0x3322=['password','token','remoteUri','authType','type','integrationTab','Configurations','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3322,0x11e));var _0x2332=function(_0x48b0d2,_0x41e481){_0x48b0d2=_0x48b0d2-0x0;var _0x2b6398=_0x3322[_0x48b0d2];return _0x2b6398;};'use strict';function ZendeskAccount(_0xc4a7ea){this['id']=_0xc4a7ea['id']||0x0;this[_0x2332('0x0')]=_0xc4a7ea[_0x2332('0x0')]||'';this[_0x2332('0x1')]=_0xc4a7ea[_0x2332('0x1')]||'';this[_0x2332('0x2')]=_0xc4a7ea[_0x2332('0x2')]||'';this[_0x2332('0x3')]=_0xc4a7ea[_0x2332('0x3')]||'';this[_0x2332('0x4')]=_0xc4a7ea['remoteUri']||'';this[_0x2332('0x5')]=_0xc4a7ea[_0x2332('0x5')]||'';this[_0x2332('0x6')]=_0xc4a7ea['type']||_0x2332('0x7');this['serverUrl']=_0xc4a7ea['serverUrl']||'';this['Configurations']=_0xc4a7ea[_0x2332('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x487c=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x289330,_0x54f85a){var _0x22d2d0=function(_0x4bdcf9){while(--_0x4bdcf9){_0x289330['push'](_0x289330['shift']());}};_0x22d2d0(++_0x54f85a);}(_0x487c,0x71));var _0xc487=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x487c[_0x3c2a69];return _0x596bc8;};'use strict';function ZendeskAccount(_0x28ca87){this['id']=_0x28ca87['id']||0x0;this['name']=_0x28ca87[_0xc487('0x0')]||'';this[_0xc487('0x1')]=_0x28ca87[_0xc487('0x1')]||'';this[_0xc487('0x2')]=_0x28ca87[_0xc487('0x2')]||'';this['token']=_0x28ca87[_0xc487('0x3')]||'';this['remoteUri']=_0x28ca87[_0xc487('0x4')]||'';this[_0xc487('0x5')]=_0x28ca87[_0xc487('0x5')]||'';this['type']=_0x28ca87[_0xc487('0x6')]||_0xc487('0x7');this[_0xc487('0x8')]=_0x28ca87['serverUrl']||'';this['Configurations']=_0x28ca87[_0xc487('0x9')]||{};}module[_0xc487('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a210d23..c6b6df6 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 _0xe650=['description','host','zone','clientId','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x2a5a84,_0x457143){var _0x616270=function(_0x247308){while(--_0x247308){_0x2a5a84['push'](_0x2a5a84['shift']());}};_0x616270(++_0x457143);}(_0xe650,0x1a3));var _0x0e65=function(_0x1671c7,_0x36f775){_0x1671c7=_0x1671c7-0x0;var _0x160b76=_0xe650[_0x1671c7];return _0x160b76;};'use strict';function ZohoAccount(_0x382b75){this['id']=_0x382b75['id']||0x0;this['name']=_0x382b75[_0x0e65('0x0')]||'';this[_0x0e65('0x1')]=_0x382b75[_0x0e65('0x1')]||'';this[_0x0e65('0x2')]=_0x382b75[_0x0e65('0x2')]||'';this[_0x0e65('0x3')]=_0x382b75[_0x0e65('0x3')]||'';this[_0x0e65('0x4')]=_0x382b75['clientId']||'';this['clientSecret']=_0x382b75['clientSecret']||'';this['serverUrl']=_0x382b75[_0x0e65('0x5')]||'';this['code']=_0x382b75[_0x0e65('0x6')]||'';this[_0x0e65('0x7')]=_0x382b75[_0x0e65('0x7')]||'';this[_0x0e65('0x8')]=_0x382b75['Configurations']||{};}module[_0x0e65('0x9')]=ZohoAccount; \ No newline at end of file +var _0x6b7a=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name'];(function(_0x33782f,_0x7674f4){var _0xdb870f=function(_0x39481e){while(--_0x39481e){_0x33782f['push'](_0x33782f['shift']());}};_0xdb870f(++_0x7674f4);}(_0x6b7a,0x8b));var _0xa6b7=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x6b7a[_0x5a19fc];return _0x34b413;};'use strict';function ZohoAccount(_0x320728){this['id']=_0x320728['id']||0x0;this['name']=_0x320728[_0xa6b7('0x0')]||'';this[_0xa6b7('0x1')]=_0x320728[_0xa6b7('0x1')]||'';this[_0xa6b7('0x2')]=_0x320728['host']||'';this[_0xa6b7('0x3')]=_0x320728[_0xa6b7('0x3')]||'';this[_0xa6b7('0x4')]=_0x320728[_0xa6b7('0x4')]||'';this[_0xa6b7('0x5')]=_0x320728['clientSecret']||'';this[_0xa6b7('0x6')]=_0x320728[_0xa6b7('0x6')]||'';this[_0xa6b7('0x7')]=_0x320728[_0xa6b7('0x7')]||'';this[_0xa6b7('0x8')]=_0x320728[_0xa6b7('0x8')]||'';this[_0xa6b7('0x9')]=_0x320728[_0xa6b7('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f9e90ca..12c03ac 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 _0xa30a=['Agent','channelAgent','membername','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype'];(function(_0x3ae27d,_0xdfdbdb){var _0x1af5b7=function(_0x3c54c3){while(--_0x3c54c3){_0x3ae27d['push'](_0x3ae27d['shift']());}};_0x1af5b7(++_0xdfdbdb);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xaa30('0x0'));var _=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));function checkNameSurname(_0x4dfa7e,_0x49b545,_0x1ebf61){var _0x36f517='';if(!_[_0xaa30('0x3')](_0x49b545)&&_0xaa30('0x4')===typeof _0x49b545){_0x36f517+=_0x49b545;}if(!_[_0xaa30('0x3')](_0x1ebf61)&&_0xaa30('0x4')===typeof _0x1ebf61){_0x36f517+='\x20'+_0x1ebf61;}if(_0x36f517!==''){return _0x36f517;}return _0x4dfa7e;}function Action(_0x555947,_0x347cd5,_0x4efe89,_0x8af448,_0x14fe09){this[_0xaa30('0x5')]=_0x4efe89||undefined;this['idContact']=_0x555947['id'];this[_0xaa30('0x6')]=_0x347cd5[_0xaa30('0x7')];this[_0xaa30('0x8')]=_0x347cd5[_0xaa30('0x8')];this[_0xaa30('0x9')]=_0xaa30('0x6');this['dialAnswer']=![];this['membername']=_[_0xaa30('0x3')](_0x555947['Agent'])?undefined:_0x555947[_0xaa30('0xa')][_0xaa30('0x7')];this[_0xaa30('0xb')]=this[_0xaa30('0xc')]?util['format'](_0xaa30('0xd'),this[_0xaa30('0xc')]):_0x8af448||undefined;this[_0xaa30('0xe')]=checkNameSurname(_0x555947['Contact'][_0xaa30('0xf')],_0x555947[_0xaa30('0x10')][_0xaa30('0x11')],_0x555947[_0xaa30('0x10')][_0xaa30('0x12')]);this[_0xaa30('0x13')]=_0x555947[_0xaa30('0x13')]||![];this[_0xaa30('0x14')]=_0x555947[_0xaa30('0xf')];this[_0xaa30('0x15')]=_0x555947['scheduledat'];this[_0xaa30('0x16')]=_0x555947['countbusyretry']||0x0;this['countcongestionretry']=_0x555947[_0xaa30('0x17')]||0x0;this[_0xaa30('0x18')]=_0x555947[_0xaa30('0x18')]||0x0;this['countglobal']=(_0x555947['countbusyretry']||0x0)+(_0x555947['countcongestionretry']||0x0)+(_0x555947[_0xaa30('0x18')]||0x0)+(_0x555947['countnosuchnumberretry']||0x0)+(_0x555947[_0xaa30('0x19')]||0x0)+(_0x555947[_0xaa30('0x1a')]||0x0)+(_0x555947['countmachineretry']||0x0)+(_0x555947['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x555947[_0xaa30('0x1b')]||0x0;this[_0xaa30('0x19')]=_0x555947[_0xaa30('0x19')]||0x0;this[_0xaa30('0x1a')]=_0x555947[_0xaa30('0x1a')]||0x0;this['countmachineretry']=_0x555947[_0xaa30('0x1c')]||0x0;this[_0xaa30('0x1d')]=_0x555947[_0xaa30('0x1d')]||0x0;this[_0xaa30('0x1e')]=_0x555947[_0xaa30('0x1e')];this['callbackuniqueid']=_0x555947[_0xaa30('0x1f')];this[_0xaa30('0x20')]=_0x555947[_0xaa30('0x20')];this[_0xaa30('0x21')]=_0x555947['recallme'];this[_0xaa30('0x22')]=_0x555947[_0xaa30('0x22')];this[_0xaa30('0x23')]=_0x555947[_0xaa30('0x23')];this[_0xaa30('0x24')]=_[_0xaa30('0x3')](_0x555947['Agent'])?_0x555947[_0xaa30('0x24')]:_0x555947[_0xaa30('0xa')]['id'];this['VoiceQueueId']=_0x555947[_0xaa30('0x25')];this['originatecalleridnum']='';this[_0xaa30('0x26')]='';}Action[_0xaa30('0x27')][_0xaa30('0x28')]=function(){return util[_0xaa30('0x29')](_0xaa30('0x2a'),this[_0xaa30('0xe')],this[_0xaa30('0x2b')]);};module[_0xaa30('0x2c')]=Action; \ No newline at end of file +var _0xcf2f=['lodash','moment','isNil','string','uniqueid','idContact','queue','name','dialAnswer','Agent','format','SIP/%s','membername','calleridname','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util'];(function(_0x2f8000,_0x37c02b){var _0x25cfee=function(_0x56aca2){while(--_0x56aca2){_0x2f8000['push'](_0x2f8000['shift']());}};_0x25cfee(++_0x37c02b);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x32a1eb,_0x290389){_0x32a1eb=_0x32a1eb-0x0;var _0x317e2a=_0xcf2f[_0x32a1eb];return _0x317e2a;};'use strict';var util=require(_0xfcf2('0x0'));var _=require(_0xfcf2('0x1'));var moment=require(_0xfcf2('0x2'));function checkNameSurname(_0x3165cf,_0x343fc4,_0x5637be){var _0x16c210='';if(!_[_0xfcf2('0x3')](_0x343fc4)&&_0xfcf2('0x4')===typeof _0x343fc4){_0x16c210+=_0x343fc4;}if(!_[_0xfcf2('0x3')](_0x5637be)&&_0xfcf2('0x4')===typeof _0x5637be){_0x16c210+='\x20'+_0x5637be;}if(_0x16c210!==''){return _0x16c210;}return _0x3165cf;}function Action(_0x167a77,_0x1e6d99,_0x3a4950,_0x41d4bd,_0x157f48){this[_0xfcf2('0x5')]=_0x3a4950||undefined;this[_0xfcf2('0x6')]=_0x167a77['id'];this[_0xfcf2('0x7')]=_0x1e6d99[_0xfcf2('0x8')];this['type']=_0x1e6d99['type'];this['campaigntype']=_0xfcf2('0x7');this[_0xfcf2('0x9')]=![];this['membername']=_[_0xfcf2('0x3')](_0x167a77[_0xfcf2('0xa')])?undefined:_0x167a77[_0xfcf2('0xa')][_0xfcf2('0x8')];this['channelAgent']=this['membername']?util[_0xfcf2('0xb')](_0xfcf2('0xc'),this[_0xfcf2('0xd')]):_0x41d4bd||undefined;this[_0xfcf2('0xe')]=checkNameSurname(_0x167a77['Contact'][_0xfcf2('0xf')],_0x167a77['Contact']['firstName'],_0x167a77['Contact'][_0xfcf2('0x10')]);this['active']=_0x167a77[_0xfcf2('0x11')]||![];this[_0xfcf2('0x12')]=_0x167a77[_0xfcf2('0xf')];this[_0xfcf2('0x13')]=_0x167a77[_0xfcf2('0x13')];this[_0xfcf2('0x14')]=_0x167a77[_0xfcf2('0x14')]||0x0;this['countcongestionretry']=_0x167a77[_0xfcf2('0x15')]||0x0;this[_0xfcf2('0x16')]=_0x167a77[_0xfcf2('0x16')]||0x0;this['countglobal']=(_0x167a77[_0xfcf2('0x14')]||0x0)+(_0x167a77[_0xfcf2('0x15')]||0x0)+(_0x167a77[_0xfcf2('0x16')]||0x0)+(_0x167a77[_0xfcf2('0x17')]||0x0)+(_0x167a77[_0xfcf2('0x18')]||0x0)+(_0x167a77['countabandonedretry']||0x0)+(_0x167a77[_0xfcf2('0x19')]||0x0)+(_0x167a77[_0xfcf2('0x1a')]||0x0);this['countnosuchnumberretry']=_0x167a77[_0xfcf2('0x17')]||0x0;this[_0xfcf2('0x18')]=_0x167a77[_0xfcf2('0x18')]||0x0;this[_0xfcf2('0x1b')]=_0x167a77[_0xfcf2('0x1b')]||0x0;this[_0xfcf2('0x19')]=_0x167a77[_0xfcf2('0x19')]||0x0;this[_0xfcf2('0x1a')]=_0x167a77[_0xfcf2('0x1a')]||0x0;this['callback']=_0x167a77[_0xfcf2('0x1c')];this[_0xfcf2('0x1d')]=_0x167a77[_0xfcf2('0x1d')];this['callbackat']=_0x167a77[_0xfcf2('0x1e')];this[_0xfcf2('0x1f')]=_0x167a77['recallme'];this[_0xfcf2('0x20')]=_0x167a77[_0xfcf2('0x20')];this['ListId']=_0x167a77[_0xfcf2('0x21')];this[_0xfcf2('0x22')]=_[_0xfcf2('0x3')](_0x167a77[_0xfcf2('0xa')])?_0x167a77['UserId']:_0x167a77[_0xfcf2('0xa')]['id'];this[_0xfcf2('0x23')]=_0x167a77[_0xfcf2('0x23')];this[_0xfcf2('0x24')]='';this[_0xfcf2('0x25')]='';}Action[_0xfcf2('0x26')][_0xfcf2('0x27')]=function(){return util[_0xfcf2('0xb')](_0xfcf2('0x28'),this['calleridname'],this['number']);};module[_0xfcf2('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 6c9fbc7..098a252 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 _0x3cc0=['recallMe','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','stringify','originated','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','length','getDiff','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','complete','outboundAnswerCallsDay','total','answered','[16]','[callProgressDetectingCustomer][logAnswer]','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','rescheduleContact','dialBusyRetryFrequency','incrementPreviewCounters','swapAdditionalPhones','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','outboundCongestionCallsDay','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','Busy','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','run','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','dialPrefix','substring','trim','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','keys','addVariable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','../../../config/logger','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','socket.io-emitter','prototype','tail','finally','sequence','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive'];(function(_0x11f598,_0x5a2990){var _0x2a37dc=function(_0x510577){while(--_0x510577){_0x11f598['push'](_0x11f598['shift']());}};_0x2a37dc(++_0x5a2990);}(_0x3cc0,0x10d));var _0x03cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3cc0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x03cc('0x0'));var uuid=require(_0x03cc('0x1'));var moment=require(_0x03cc('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x03cc('0x3'))(_0x03cc('0x4'));var loggerAction=require(_0x03cc('0x3'))(_0x03cc('0x5'));var ami=require('../ami');var rpcDb=require(_0x03cc('0x6'));var cmHopperAdditionalPhone=require(_0x03cc('0x7'));var Action=require(_0x03cc('0x8'));var ut=require(_0x03cc('0x9'));var utils=require(_0x03cc('0xa'));config[_0x03cc('0xb')]=_[_0x03cc('0xc')](config[_0x03cc('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x03cc('0xd'))(new Redis(config[_0x03cc('0xb')]));var Sequence=function(){};Sequence[_0x03cc('0xe')]['enqueue']=function(_0x4e3123){this['tail']=this[_0x03cc('0xf')]?this['tail'][_0x03cc('0x10')](_0x4e3123):_0x4e3123();};function Preview(_0x445ba5){this[_0x03cc('0x11')]=new Sequence();this['campaignsPreview']=_0x445ba5[_0x03cc('0x12')];this[_0x03cc('0x13')]=_0x445ba5[_0x03cc('0x13')];this[_0x03cc('0x14')]={};this[_0x03cc('0x15')]=_0x445ba5[_0x03cc('0x15')];this['clockClearZombieChannels']=0x0;ami['on'](_0x03cc('0x16'),this[_0x03cc('0x17')][_0x03cc('0x18')](this));ami['on'](_0x03cc('0x19'),this['syncHangup']['bind'](this));ami['on'](_0x03cc('0x1a'),this[_0x03cc('0x1b')][_0x03cc('0x18')](this));ami['on'](_0x03cc('0x1c'),this[_0x03cc('0x1d')][_0x03cc('0x18')](this));ami['on']('newexten',this[_0x03cc('0x1e')][_0x03cc('0x18')](this));ami['on']('varset',this[_0x03cc('0x1f')]['bind'](this));ami['on'](_0x03cc('0x20'),this[_0x03cc('0x21')][_0x03cc('0x18')](this));ami['on'](_0x03cc('0x22'),this['syncBlindTransfer'][_0x03cc('0x18')](this));this[_0x03cc('0x23')](this[_0x03cc('0x24')]);}function emit(_0x21e83e,_0x4a651b,_0x22fc8a){io['to'](_0x21e83e)[_0x03cc('0x25')](_0x4a651b,_0x22fc8a);}function emitVoiceQueueChannelRemove(_0x510f6c){logger[_0x03cc('0x26')](_0x03cc('0x27'),JSON['stringify'](_0x510f6c));emit(util[_0x03cc('0x28')](_0x03cc('0x29'),_0x510f6c['name']),_0x03cc('0x2a'),_0x510f6c);io[_0x03cc('0x25')](_0x03cc('0x2b'),_0x510f6c);}function notSendMessagesQueue(_0x21b9d1){if(_0x21b9d1[_0x03cc('0x2c')]){if(_0x21b9d1['originated']===0x0&&_0x21b9d1[_0x03cc('0x2d')]===0x0){_0x21b9d1['sendMessageOneNotActive']=![];_0x21b9d1['available']=0x0;_0x21b9d1['paused']=0x0;_0x21b9d1[_0x03cc('0x2e')]=utils[_0x03cc('0x2f')][_0x03cc('0x30')];ut[_0x03cc('0x31')](_0x03cc('0x32'),_0x21b9d1[_0x03cc('0x33')]+_0x03cc('0x34'));}else{_0x21b9d1['message']=utils['CAMPAIGN_STATUS'][_0x03cc('0x35')];ut[_0x03cc('0x31')](_0x03cc('0x32'),_0x21b9d1[_0x03cc('0x33')]+_0x03cc('0x36'));}}}Preview[_0x03cc('0xe')][_0x03cc('0x23')]=function(){var _0x5777f2=this;setInterval(function(){_0x5777f2[_0x03cc('0x37')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x3ba6a6=this[_0x03cc('0x24')];this[_0x03cc('0x38')]+=0x1;for(var _0xf377f3 in _0x3ba6a6){if(_0x3ba6a6['hasOwnProperty'](_0xf377f3)&&(_0x3ba6a6[_0xf377f3][_0x03cc('0x39')]===_0x03cc('0x4')||_0x3ba6a6[_0xf377f3][_0x03cc('0x39')]===_0x03cc('0x3a'))&&_0x3ba6a6[_0xf377f3][_0x03cc('0x3b')]===_0x03cc('0x3c')){if(this[_0x03cc('0x38')]>0x7){this[_0x03cc('0x38')]=0x0;this[_0x03cc('0x3d')]();}}if(_0x3ba6a6[_0x03cc('0x3e')](_0xf377f3)&&_0x3ba6a6[_0xf377f3][_0x03cc('0x39')]===_0x03cc('0x4')&&_0x3ba6a6[_0xf377f3]['type']==='outbound'){if(_0x3ba6a6[_0xf377f3][_0x03cc('0x3f')]){this['setMessage'](_0x3ba6a6[_0xf377f3]);if(_0x3ba6a6[_0xf377f3]['dialPreviewAutoRecallMe'])this[_0x03cc('0x40')](_0x3ba6a6[_0xf377f3]);}else{notSendMessagesQueue(_0x3ba6a6[_0xf377f3]);}}}};Preview[_0x03cc('0xe')]['clearZombieChannel']=function(_0x5f104e){var _0x481663=this;this[_0x03cc('0x11')][_0x03cc('0x41')](function(){if(!_[_0x03cc('0x42')](_0x481663[_0x03cc('0x14')][_0x5f104e])){loggerAction[_0x03cc('0x26')](_0x03cc('0x43'),_0x5f104e,_0x03cc('0x44'),_0x481663[_0x03cc('0x14')][_0x5f104e][_0x03cc('0x45')],'originated:\x20',JSON[_0x03cc('0x46')](_0x481663[_0x03cc('0x24')][_0x481663[_0x03cc('0x14')][_0x5f104e]['queue']][_0x03cc('0x47')]),_0x03cc('0x48'),JSON[_0x03cc('0x46')](_0x481663[_0x03cc('0x24')][_0x481663[_0x03cc('0x14')][_0x5f104e][_0x03cc('0x45')]][_0x03cc('0x2d')]),JSON[_0x03cc('0x46')](_0x481663[_0x03cc('0x14')][_0x5f104e][_0x03cc('0x49')]),JSON['stringify'](_[_0x03cc('0x4a')](_0x481663[_0x03cc('0x14')][_0x5f104e],['contactId',_0x03cc('0x4b'),_0x03cc('0x4c'),_0x03cc('0x4d')])));return ami['Action']({'action':'status','channel':_0x481663[_0x03cc('0x14')][_0x5f104e][_0x03cc('0x4e')]})[_0x03cc('0x4f')](function(_0x5ab956){if(_0x5ab956[_0x03cc('0x2e')]===_0x03cc('0x50')){setTimeout(function(){if(_0x481663['actions'][_0x5f104e]){utils[_0x03cc('0x51')](_0x481663[_0x03cc('0x24')][_0x481663[_0x03cc('0x14')][_0x5f104e][_0x03cc('0x45')]],_0x03cc('0x52'));if(_0x481663[_0x03cc('0x14')][_0x5f104e][_0x03cc('0x49')]===!![]){ut[_0x03cc('0x53')](_0x481663[_0x03cc('0x24')][_0x481663['actions'][_0x5f104e][_0x03cc('0x45')]],_0x03cc('0x52'));ut[_0x03cc('0x54')](_0x03cc('0x55')+_0x5f104e,_0x481663['actions'][_0x5f104e][_0x03cc('0x45')]);}ut['loggerError'](_0x03cc('0x56')+_0x5f104e,_0x481663[_0x03cc('0x14')][_0x5f104e][_0x03cc('0x45')]);delete _0x481663[_0x03cc('0x14')][_0x5f104e];}},0x2328);}});}});};Preview['prototype'][_0x03cc('0x3d')]=function(){var _0x272567=this;loggerAction['info'](_0x03cc('0x57'),_[_0x03cc('0x58')](this[_0x03cc('0x14')]));for(var _0x3bbf15 in this[_0x03cc('0x14')]){if(_0x272567[_0x03cc('0x14')][_0x03cc('0x3e')](_0x3bbf15)){_0x272567['clearZombieChannel'](_0x3bbf15);}}};Preview[_0x03cc('0xe')][_0x03cc('0x40')]=function(_0x29e56f){var _0x488405=this;rpcDb['getContactRecallMe'](_0x29e56f['id'],ut[_0x03cc('0x59')](this[_0x03cc('0x15')]))[_0x03cc('0x5a')](function(_0x46f240){if(!_[_0x03cc('0x42')](_0x46f240)){for(var _0x46ca1f=0x0;_0x46ca1f<_0x46f240[_0x03cc('0x5b')];_0x46ca1f+=0x1){if(ut[_0x03cc('0x5c')](_0x46f240[_0x46ca1f]['scheduledat'])<_0x29e56f['dialRecallMeTimeout']*0x3c){if(_0x46f240[_0x46ca1f][_0x03cc('0x5d')]&&!_0x46f240[_0x46ca1f][_0x03cc('0x5d')][_0x03cc('0x5e')]){_0x488405['run'](_0x46f240[_0x46ca1f]['id'])['then'](ut[_0x03cc('0x5f')]('[RecallMe]'))[_0x03cc('0x4f')](ut[_0x03cc('0x5f')](_0x03cc('0x60')));}else{rpcDb[_0x03cc('0x61')](_0x46f240[_0x46ca1f]['id']);}}else{var _0x2785db=new Action(_0x46f240[_0x46ca1f],_0x29e56f);_0x2785db[_0x03cc('0x62')]=moment()[_0x03cc('0x28')](_0x03cc('0x63'));_0x29e56f[_0x03cc('0x64')]+=0x1;ut[_0x03cc('0x65')](_0x2785db,0x17,'RecallInQueue');if(_0x29e56f[_0x03cc('0x66')]){rpcDb[_0x03cc('0x67')](ut[_0x03cc('0x68')](_0x46f240[_0x46ca1f]));rpcDb[_0x03cc('0x69')](_0x2785db,_0x03cc('0x6a'));}else{ut[_0x03cc('0x65')](_0x2785db,0x16,_0x03cc('0x6b'));rpcDb[_0x03cc('0x69')](_0x2785db,_0x03cc('0x6c'));rpcDb[_0x03cc('0x6d')](_0x2785db,_0x03cc('0x6c'));}}}}})['catch'](ut[_0x03cc('0x5f')](_0x03cc('0x6e')));};Preview['prototype']['setMessage']=function(_0x2dfa35){_0x2dfa35['sendMessageOneNotActive']=!![];if(ut[_0x03cc('0x6f')](_0x2dfa35[_0x03cc('0x70')])){_0x2dfa35['message']=utils[_0x03cc('0x2f')][_0x03cc('0x71')];}else if(!ut[_0x03cc('0x72')](_0x2dfa35[_0x03cc('0x3f')])){_0x2dfa35[_0x03cc('0x2e')]=utils[_0x03cc('0x2f')][_0x03cc('0x30')];}else if(!this[_0x03cc('0x73')](_0x2dfa35['Trunk'])){if(!this['isTrunkReachable'](_0x2dfa35[_0x03cc('0x74')])){_0x2dfa35['message']=utils['CAMPAIGN_STATUS'][_0x03cc('0x75')];}else{_0x2dfa35[_0x03cc('0x2e')]=utils[_0x03cc('0x2f')][_0x03cc('0x76')];}}else{_0x2dfa35['message']=utils['CAMPAIGN_STATUS'][_0x03cc('0x76')];}};Preview[_0x03cc('0xe')]['callProgressDetectingCustomer']=function(_0x2b661b,_0x105381,_0x59d289){var _0x345efb=this;var _0x3907b8=this['actions'][_0x105381];var _0x173950=this[_0x03cc('0x24')][_0x3907b8[_0x03cc('0x45')]];var _0x571820;var _0x55260b=![];var _0x67cb74=0x2;var _0x611061=0x3;if(_0x173950){switch(_0x59d289){case'1':_0x173950[_0x03cc('0x77')]+=0x1;_0x3907b8[_0x03cc('0x78')]+=0x1;_0x3907b8[_0x03cc('0x79')]=ut['totalGlobal'](_0x3907b8);ut[_0x03cc('0x65')](_0x3907b8,0x0,_0x03cc('0x7a'));ami[_0x03cc('0x25')](_0x03cc('0x7b'),ut[_0x03cc('0x7c')](_0x3907b8,_0x03cc('0x7d')));rpcDb[_0x03cc('0x69')](_0x3907b8,'[callProgressDetectingCustomer][logNoSuch]');_0x345efb[_0x03cc('0x7e')](_0x3907b8,'0',_0x173950)[_0x03cc('0x5a')](function(_0xa3a38c){_0x55260b=_0xa3a38c[_0x03cc('0x7f')]==0x1;_0x67cb74=_0x173950[_0x03cc('0x80')];_0x611061=_0x173950[_0x03cc('0x81')];if(!_0x55260b){if(ut[_0x03cc('0x82')](_0x3907b8)>=_0x173950[_0x03cc('0x83')]){_0x571820=ut[_0x03cc('0x84')](_0x3907b8,0xf,'Global');rpcDb[_0x03cc('0x6d')](_0x571820,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3907b8[_0x03cc('0x78')]>=_0x173950[_0x03cc('0x85')]){rpcDb[_0x03cc('0x6d')](_0x3907b8,_0x03cc('0x86'));}else{rpcDb['rescheduleContact'](ut[_0x03cc('0x87')](_0x3907b8,_0x03cc('0x78'),_0x173950[_0x03cc('0x80')]),_0x3907b8[_0x03cc('0x88')],_0x3907b8[_0x03cc('0x89')]);}}delete this[_0x03cc('0x14')][_0x2b661b['linkedid']];}else{_0x3907b8['countnosuchnumberretry']++;logger[_0x03cc('0x26')](_0x03cc('0x8a'),_0x3907b8[_0x03cc('0x78')]);logger[_0x03cc('0x26')]('id',_0x3907b8[_0x03cc('0x8b')]);_0x345efb['incrementPreviewCounters']({'id':_0x3907b8[_0x03cc('0x8b')],'field':{'countnosuchnumberretry':_0x3907b8[_0x03cc('0x78')]}})[_0x03cc('0x5a')](function(){_0x345efb['swapAdditionalPhones'](_0x3907b8,_0x67cb74,_0x611061)[_0x03cc('0x5a')](function(){});});}});break;case'ANSWER':var _0x3a565a=moment()[_0x03cc('0x28')](_0x03cc('0x63'));_0x3907b8['responsetime']=_0x3a565a;_0x3907b8['answertime']=_0x3a565a;_0x3907b8[_0x03cc('0x49')]=!![];_0x173950[_0x03cc('0x2d')]+=0x1;logger[_0x03cc('0x26')](_0x03cc('0x8c'),_0x3907b8[_0x03cc('0x8d')],_0x03cc('0x8e'),_0x173950[_0x03cc('0x33')],_0x03cc('0x48'),_0x173950['pTalking']);ami[_0x03cc('0x25')](_0x03cc('0x8f'),ut[_0x03cc('0x7c')](_0x3907b8,'connect',this[_0x03cc('0x24')][_0x3907b8[_0x03cc('0x45')]]));if(_0x173950[_0x03cc('0x90')]||_0x173950[_0x03cc('0x91')]){ami[_0x03cc('0x25')](_0x03cc('0x92'),{'queue':_0x3907b8[_0x03cc('0x45')],'interface':_0x3907b8[_0x03cc('0x93')],'uniqueid':_0x3907b8[_0x03cc('0x8d')]});}break;case'16':ami[_0x03cc('0x25')]('custom:agentcomplete',ut['buildObj'](_0x3907b8,_0x03cc('0x94'),this[_0x03cc('0x24')][_0x3907b8['queue']]));emitVoiceQueueChannelRemove(ut[_0x03cc('0x7c')](_0x3907b8,_0x03cc('0x94')));_0x173950[_0x03cc('0x95')]+=0x1;_0x173950[_0x03cc('0x96')]+=0x1;_0x173950[_0x03cc('0x97')]+=0x1;ut[_0x03cc('0x53')](_0x173950,_0x03cc('0x98'));_0x3907b8[_0x03cc('0x79')]=ut['totalGlobal'](_0x3907b8);ut[_0x03cc('0x65')](_0x3907b8,0x4,'Answer');rpcDb[_0x03cc('0x69')](_0x3907b8,_0x03cc('0x99'));rpcDb['createCustomerFinal'](_0x3907b8,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x3907b8);_0x173950['sumDuration']+=_0x3907b8[_0x03cc('0x9a')];_0x173950[_0x03cc('0x9b')]+=_0x3907b8[_0x03cc('0x9a')];logger[_0x03cc('0x26')](_0x03cc('0x9c'),_0x3907b8[_0x03cc('0x8d')],_0x03cc('0x8e'),_0x173950[_0x03cc('0x33')],_0x03cc('0x48'),_0x173950[_0x03cc('0x2d')]);delete this['actions'][_0x2b661b[_0x03cc('0x9d')]];break;case _0x03cc('0x9e'):_0x173950[_0x03cc('0x9f')]+=0x1;_0x3907b8[_0x03cc('0xa0')]+=0x1;_0x3907b8['countglobal']=ut[_0x03cc('0x82')](_0x3907b8);ut[_0x03cc('0x65')](_0x3907b8,0x5,'Busy');_0x67cb74=_0x173950['dialBusyRetryFrequency'];_0x611061=_0x173950[_0x03cc('0x81')];ami['emit'](_0x03cc('0xa1'),ut[_0x03cc('0x7c')](_0x3907b8,_0x03cc('0xa2')));rpcDb[_0x03cc('0x69')](_0x3907b8,_0x03cc('0xa3'));_0x345efb[_0x03cc('0x7e')](_0x3907b8,'5',_0x173950)['then'](function(_0xa7d64e){_0x55260b=_0xa7d64e[_0x03cc('0x7f')]==0x1;if(!_0x55260b){if(ut[_0x03cc('0x82')](_0x3907b8)>=_0x173950[_0x03cc('0x83')]){_0x571820=ut['cloneAction'](_0x3907b8,0xf,_0x03cc('0xa4'));rpcDb['createCustomerFinal'](_0x571820,_0x03cc('0xa5'));}else{if(_0x3907b8[_0x03cc('0xa0')]>=_0x173950['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x3907b8,_0x03cc('0xa3'));}else{rpcDb[_0x03cc('0xa6')](ut[_0x03cc('0x87')](_0x3907b8,_0x03cc('0xa0'),_0x173950[_0x03cc('0xa7')]),_0x3907b8['unlockAgent'],_0x3907b8[_0x03cc('0x89')]);}}}else{_0x3907b8['countbusyretry']++;_0x345efb[_0x03cc('0xa8')]({'id':_0x3907b8[_0x03cc('0x8b')],'field':{'countbusyretry':_0x3907b8[_0x03cc('0xa0')]}})[_0x03cc('0x5a')](function(){_0x345efb[_0x03cc('0xa9')](_0x3907b8,_0x67cb74,_0x611061)[_0x03cc('0x5a')](function(){});});}});break;case'NOANSWER':_0x173950[_0x03cc('0xaa')]+=0x1;_0x3907b8[_0x03cc('0xab')]+=0x1;_0x3907b8[_0x03cc('0x79')]=ut[_0x03cc('0x82')](_0x3907b8);ut['logCustomer'](_0x3907b8,0x3,'NoAnswer');_0x67cb74=_0x173950[_0x03cc('0xac')];_0x611061=_0x173950['callAdditionalPhoneAfterMin'];var _0x17c262=ut[_0x03cc('0xad')](_0x3907b8,_0x173950);ami['emit'](_0x03cc('0xae'),_0x17c262);rpcDb[_0x03cc('0x69')](_0x3907b8,_0x03cc('0xaf'));_0x345efb[_0x03cc('0x7e')](_0x3907b8,'3',_0x173950)['then'](function(_0x2db539){_0x55260b=_0x2db539[_0x03cc('0x7f')]==0x1;if(!_0x55260b){if(ut[_0x03cc('0x82')](_0x3907b8)>=_0x173950[_0x03cc('0x83')]){_0x571820=ut[_0x03cc('0x84')](_0x3907b8,0xf,_0x03cc('0xa4'));rpcDb[_0x03cc('0x6d')](_0x571820,_0x03cc('0xb0'));}else{if(_0x3907b8[_0x03cc('0xab')]>=_0x173950[_0x03cc('0xb1')]){rpcDb[_0x03cc('0x6d')](_0x3907b8,_0x03cc('0xaf'));}else{rpcDb[_0x03cc('0xa6')](ut[_0x03cc('0x87')](_0x3907b8,_0x03cc('0xab'),_0x173950['dialNoAnswerRetryFrequency']),_0x3907b8[_0x03cc('0x88')],_0x3907b8[_0x03cc('0x89')]);}}}else{_0x3907b8[_0x03cc('0xab')]++;_0x345efb['incrementPreviewCounters']({'id':_0x3907b8['idContact'],'field':{'countnoanswerretry':_0x3907b8[_0x03cc('0xab')]}})[_0x03cc('0x5a')](function(){_0x345efb['swapAdditionalPhones'](_0x3907b8,_0x67cb74,_0x611061)[_0x03cc('0x5a')](function(){});});}});break;case'CONGESTION':_0x173950[_0x03cc('0xb2')]+=0x1;_0x3907b8['countcongestionretry']+=0x1;_0x3907b8[_0x03cc('0x79')]=ut[_0x03cc('0x82')](_0x3907b8);ut[_0x03cc('0x65')](_0x3907b8,0x8,'Congestion');_0x67cb74=_0x173950[_0x03cc('0xb3')];_0x611061=_0x173950['callAdditionalPhoneAfterMin'];ami[_0x03cc('0x25')]('custom:agentcongestion',ut['buildObj'](_0x3907b8,_0x03cc('0xb4')));rpcDb[_0x03cc('0x69')](_0x3907b8,_0x03cc('0xb5'));_0x345efb[_0x03cc('0x7e')](_0x3907b8,'8',_0x173950)[_0x03cc('0x5a')](function(_0x30162d){_0x55260b=_0x30162d[_0x03cc('0x7f')]==0x1;if(!_0x55260b){if(ut['totalGlobal'](_0x3907b8)>=_0x173950['dialGlobalMaxRetry']){_0x571820=ut[_0x03cc('0x84')](_0x3907b8,0xf,_0x03cc('0xa4'));rpcDb['createCustomerFinal'](_0x571820,_0x03cc('0xb6'));}else{if(_0x3907b8[_0x03cc('0xb7')]>=_0x173950[_0x03cc('0xb8')]){rpcDb['createCustomerFinal'](_0x3907b8,_0x03cc('0xb5'));}else{rpcDb[_0x03cc('0xa6')](ut[_0x03cc('0x87')](_0x3907b8,_0x03cc('0xb7'),_0x173950[_0x03cc('0xa7')]),_0x3907b8[_0x03cc('0x88')],_0x3907b8['activeContact']);}}}else{_0x3907b8[_0x03cc('0xb7')]++;_0x345efb['incrementPreviewCounters']({'id':_0x3907b8[_0x03cc('0x8b')],'field':{'countcongestionretry':_0x3907b8[_0x03cc('0xb7')]}})[_0x03cc('0x5a')](function(){_0x345efb[_0x03cc('0xa9')](_0x3907b8,_0x67cb74,_0x611061)[_0x03cc('0x5a')](function(){});});}});break;case _0x03cc('0xb9'):_0x173950[_0x03cc('0xba')]+=0x1;_0x3907b8['countagentrejectretry']+=0x1;_0x3907b8[_0x03cc('0x79')]=ut[_0x03cc('0x82')](_0x3907b8);ut[_0x03cc('0x65')](_0x3907b8,0x14,_0x03cc('0xbb'));_0x67cb74=_0x173950[_0x03cc('0xbc')];_0x611061=_0x173950[_0x03cc('0x81')];ami[_0x03cc('0x25')](_0x03cc('0xbd'),ut[_0x03cc('0x7c')](_0x3907b8,_0x03cc('0xbe')));rpcDb[_0x03cc('0x69')](_0x3907b8,'[syncHangupRequest][logAgentReject]');_0x345efb[_0x03cc('0x7e')](_0x3907b8,'20',_0x173950)[_0x03cc('0x5a')](function(_0x2bbab6){_0x55260b=_0x2bbab6[_0x03cc('0x7f')]==0x1;if(!_0x55260b){if(ut[_0x03cc('0x82')](_0x3907b8)>=_0x173950['dialGlobalMaxRetry']){_0x571820=ut['cloneAction'](_0x3907b8,0x14,'AgentReject');rpcDb[_0x03cc('0x6d')](_0x571820,_0x03cc('0xbf'));}else{if(_0x3907b8[_0x03cc('0xc0')]>=_0x173950['dialAgentRejectMaxRetry']){rpcDb[_0x03cc('0x6d')](_0x3907b8,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3907b8,'countagentrejectretry',_0x173950[_0x03cc('0xbc')]),_0x3907b8[_0x03cc('0x88')],_0x3907b8[_0x03cc('0x89')]);}}}else{_0x3907b8[_0x03cc('0xab')]++;_0x345efb[_0x03cc('0xa8')]({'id':_0x3907b8['idContact'],'field':{'countnoanswerretry':_0x3907b8['countnoanswerretry']}})[_0x03cc('0x5a')](function(){_0x345efb[_0x03cc('0xa9')](_0x3907b8,_0x67cb74,_0x611061)['then'](function(){});});}});break;case _0x03cc('0xc1'):_0x173950[_0x03cc('0xc2')]+=0x1;_0x3907b8['countabandonedretry']+=0x1;_0x3907b8[_0x03cc('0x79')]=ut['totalGlobal'](_0x3907b8);ut[_0x03cc('0x65')](_0x3907b8,0xb,_0x03cc('0xc3'));rpcDb[_0x03cc('0x69')](_0x3907b8,_0x03cc('0xc4'));_0x345efb[_0x03cc('0x7e')](_0x3907b8,'11',_0x173950)[_0x03cc('0x5a')](function(_0x140ce3){_0x55260b=_0x140ce3['additional']==0x1;if(!_0x55260b){if(ut[_0x03cc('0x82')](_0x3907b8)>=_0x173950[_0x03cc('0x83')]){_0x571820=ut[_0x03cc('0x84')](_0x3907b8,0xf,_0x03cc('0xa4'));rpcDb[_0x03cc('0x6d')](_0x571820,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3907b8[_0x03cc('0xc5')]>=_0x173950[_0x03cc('0xc6')]){rpcDb[_0x03cc('0x6d')](_0x3907b8,_0x03cc('0xc4'));}else{rpcDb[_0x03cc('0xa6')](ut['scheduledAt'](_0x3907b8,_0x03cc('0xc7'),_0x173950['dialAbandonedRetryFrequency']),_0x3907b8[_0x03cc('0x88')],_0x3907b8[_0x03cc('0x89')]);}}}else{_0x3907b8[_0x03cc('0xab')]++;_0x345efb['incrementPreviewCounters']({'id':_0x3907b8[_0x03cc('0x8b')],'field':{'countnoanswerretry':_0x3907b8[_0x03cc('0xab')]}})[_0x03cc('0x5a')](function(){_0x345efb[_0x03cc('0xa9')](_0x3907b8,_0x67cb74,_0x611061)[_0x03cc('0x5a')](function(){});});}});break;case'18':_0x173950[_0x03cc('0xc8')]+=0x1;_0x3907b8[_0x03cc('0xc9')]+=0x1;_0x3907b8[_0x03cc('0x79')]=ut[_0x03cc('0x82')](_0x3907b8);ut['logCustomer'](_0x3907b8,0x12,_0x2b661b[_0x03cc('0xca')]||_0x2b661b[_0x03cc('0xcb')]);ami[_0x03cc('0x25')](_0x03cc('0xcc'),ut[_0x03cc('0x7c')](_0x3907b8,'amd'));rpcDb[_0x03cc('0x69')](_0x3907b8,_0x03cc('0xcd'));_0x345efb[_0x03cc('0x7e')](_0x3907b8,'18',_0x173950)['then'](function(_0x1c8d47){_0x55260b=_0x1c8d47[_0x03cc('0x7f')]==0x1;if(!_0x55260b){if(ut['totalGlobal'](_0x3907b8)>=_0x173950[_0x03cc('0x83')]){_0x571820=ut[_0x03cc('0x84')](_0x3907b8,0x12,'Global');rpcDb[_0x03cc('0x6d')](_0x571820,_0x03cc('0xcd'));}else{rpcDb[_0x03cc('0x6d')](_0x3907b8,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x3907b8[_0x03cc('0xab')]++;_0x345efb[_0x03cc('0xa8')]({'id':_0x3907b8[_0x03cc('0x8b')],'field':{'countnoanswerretry':_0x3907b8[_0x03cc('0xab')]}})['then'](function(){_0x345efb[_0x03cc('0xa9')](_0x3907b8,_0x67cb74,_0x611061)[_0x03cc('0x5a')](function(){});});}});delete this[_0x03cc('0x14')][_0x2b661b['linkedid']];break;case'19':_0x173950[_0x03cc('0xc8')]+=0x1;_0x3907b8[_0x03cc('0x79')]=ut['totalGlobal'](_0x3907b8);ut[_0x03cc('0x65')](_0x3907b8,0x13,_0x2b661b[_0x03cc('0xca')]||_0x2b661b[_0x03cc('0xcb')]);ami[_0x03cc('0x25')](_0x03cc('0xcc'),ut[_0x03cc('0x7c')](_0x3907b8,_0x03cc('0xce')));rpcDb['createCustomerHistory'](_0x3907b8,_0x03cc('0xcf'));_0x345efb['verifyAdditionalPhones'](_0x3907b8,'18',_0x173950)[_0x03cc('0x5a')](function(_0x418f28){_0x55260b=_0x418f28[_0x03cc('0x7f')]==0x1;if(!_0x55260b){if(ut[_0x03cc('0x82')](_0x3907b8)>=_0x173950[_0x03cc('0x83')]){_0x571820=ut[_0x03cc('0x84')](_0x3907b8,0xf,'Global');rpcDb[_0x03cc('0x6d')](_0x571820,_0x03cc('0xcf'));}else{rpcDb[_0x03cc('0x6d')](_0x3907b8,_0x03cc('0xcf'));}}else{_0x3907b8['countnoanswerretry']++;_0x345efb['incrementPreviewCounters']({'id':_0x3907b8[_0x03cc('0x8b')],'field':{'countnoanswerretry':_0x3907b8[_0x03cc('0xab')]}})[_0x03cc('0x5a')](function(){_0x345efb[_0x03cc('0xa9')](_0x3907b8,_0x67cb74,_0x611061)['then'](function(){});});}});delete this[_0x03cc('0x14')][_0x2b661b['linkedid']];break;default:if(_0x3907b8[_0x03cc('0x49')]){ut[_0x03cc('0x53')](_0x173950,_0x03cc('0xd0'));ut[_0x03cc('0x54')](_0x03cc('0xd1')+_0x173950[_0x03cc('0x33')],_0x2b661b);}_0x173950['outboundUnknownCallsDay']+=0x1;_0x3907b8[_0x03cc('0x79')]=ut['totalGlobal'](_0x3907b8);ut[_0x03cc('0x65')](_0x3907b8,0xc,_0x2b661b[_0x03cc('0xca')]||_0x2b661b[_0x03cc('0xcb')]);_0x67cb74=_0x173950[_0x03cc('0xbc')];_0x611061=_0x173950[_0x03cc('0x81')];rpcDb[_0x03cc('0x69')](_0x3907b8,_0x03cc('0xd2'));_0x345efb['verifyAdditionalPhones'](_0x3907b8,'20',_0x173950)[_0x03cc('0x5a')](function(_0x1390b2){_0x55260b=_0x1390b2[_0x03cc('0x7f')]==0x1;if(!_0x55260b){if(ut[_0x03cc('0x82')](_0x3907b8)>=_0x173950[_0x03cc('0x83')]){_0x571820=ut[_0x03cc('0x84')](_0x3907b8,0xf,_0x03cc('0xa4'));rpcDb[_0x03cc('0x6d')](_0x571820,_0x03cc('0xd3'));}else{rpcDb[_0x03cc('0x6d')](_0x3907b8,_0x03cc('0xd3'));}delete this[_0x03cc('0x14')][_0x2b661b[_0x03cc('0x9d')]];}else{_0x345efb[_0x03cc('0xa9')](_0x3907b8,_0x67cb74,_0x611061)[_0x03cc('0x5a')](function(){});}});}if(!(_0x3907b8[_0x03cc('0x49')]&&_0x59d289==='16')){utils['decrementOriginate'](_0x173950,_0x03cc('0xd4'));logger[_0x03cc('0x26')]('[originated][decrement][callProgressDetectingCustomer]',_0x3907b8[_0x03cc('0x8d')],_0x03cc('0x8e'),_0x173950['name'],_0x03cc('0xd5'),_0x173950[_0x03cc('0x47')]);}if(_0x59d289!==_0x03cc('0xd6')){delete this[_0x03cc('0x14')][_0x2b661b['linkedid']];delete this[_0x03cc('0x14')][_0x2b661b[_0x03cc('0xd7')]];}_0x173950[_0x03cc('0xd8')]=!![];}};Preview[_0x03cc('0xe')][_0x03cc('0xd9')]=function(_0x3303d0,_0x336205,_0x3fad78){if(_[_0x03cc('0xda')](_0x336205)&&_0x03cc('0xdb')!==typeof _0x336205){return;}if(_['isUndefined'](_0x3fad78)&&'object'!==typeof _0x3fad78){return;}switch(_0x3fad78[_0x03cc('0xdc')]){case'0':ut[_0x03cc('0xdd')](_0x3303d0,0x0,_0x03cc('0x7a'));rpcDb[_0x03cc('0xde')](_0x3303d0,_0x03cc('0xdf'));break;case'3':ut[_0x03cc('0xdd')](_0x3303d0,0x3,_0x03cc('0xe0'));rpcDb[_0x03cc('0xde')](_0x3303d0,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x03cc('0xdd')](_0x3303d0,0x5,_0x03cc('0xe1'));rpcDb['createAgentHistory'](_0x3303d0,_0x03cc('0xe2'));break;case'8':ut['logAgent'](_0x3303d0,0x8,_0x03cc('0xe3'));rpcDb['createAgentHistory'](_0x3303d0,_0x03cc('0xe4'));break;case'22':ut['logAgent'](_0x3303d0,0x16,_0x03cc('0xe5'));rpcDb[_0x03cc('0xde')](_0x3303d0,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x3303d0,0xc,_0x3fad78[_0x03cc('0xdc')]);rpcDb[_0x03cc('0xde')](_0x3303d0,_0x03cc('0xe4'));}utils[_0x03cc('0x51')](_0x336205,_0x03cc('0xe6'));logger[_0x03cc('0x26')](_0x03cc('0xe7'),_0x3303d0['uniqueid'],_0x03cc('0x8e'),_0x336205[_0x03cc('0x33')],_0x03cc('0xd5'),_0x336205['originated']);delete this[_0x03cc('0x14')][_0x3303d0[_0x03cc('0x8d')]];};Preview[_0x03cc('0xe')][_0x03cc('0x7e')]=function(_0xf94505,_0x4529f4,_0x43498f){return cmHopperAdditionalPhone[_0x03cc('0x7e')](_0xf94505,_0x4529f4,_0x43498f)[_0x03cc('0x4f')](logger[_0x03cc('0x26')](_0x03cc('0xe8')));};Preview[_0x03cc('0xe')][_0x03cc('0xa9')]=function(_0x300af3,_0xa08a02,_0xd9f606){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x300af3,_0xa08a02,_0xd9f606)[_0x03cc('0x4f')](logger[_0x03cc('0x26')](_0x03cc('0xe9')));};Preview['prototype']['incrementPreviewCounters']=function(_0x4652db){return Promise[_0x03cc('0xea')]()[_0x03cc('0x5a')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x4652db))[_0x03cc('0x4f')](logger[_0x03cc('0x26')](_0x03cc('0xeb')));};Preview[_0x03cc('0xe')]['checkInBlack']=function(_0x11999a,_0x1a3172,_0x4cd056,_0x4daba7,_0x127455){var _0x588c63=this;return new Promise(function(_0x21c3af,_0x556d35){if(_[_0x03cc('0x42')](_0x1a3172)||_[_0x03cc('0x42')](_0x1a3172[_0x03cc('0xec')])||_[_0x03cc('0x42')](_0x1a3172['phone'])||_[_0x03cc('0x42')](_0x1a3172['VoiceQueueId'])){_0x556d35(ut[_0x03cc('0x2e')](_0x03cc('0xed'),_0x4daba7,_0x127455));return;}var _0x2bbf1a=uuid['v4']();var _0x29b023=_0x588c63[_0x03cc('0x24')][_0x1a3172[_0x03cc('0x44')]['name']];var _0x37e505=_0x4cd056?_0x588c63['agents'][_0x4cd056]['id']:undefined;_0x588c63[_0x03cc('0x14')][_0x2bbf1a]=new Action(_0x1a3172,_0x29b023,_0x2bbf1a,_0x4cd056,_0x37e505);var _0x33a664=_0x588c63['actions'][_0x2bbf1a];_0x33a664[_0x03cc('0x88')]=_0x4daba7;_0x33a664[_0x03cc('0x89')]=_0x127455;_0x33a664[_0x03cc('0xee')]=_0x4cd056;if(_[_0x03cc('0xef')](_0x11999a)){_0x588c63['execCall'](_0x33a664,_0x29b023,_0x1a3172,_0x4cd056)[_0x03cc('0x5a')](function(_0x261515){logger[_0x03cc('0x26')](_0x03cc('0xf0'),'Queue:\x20'+_0x33a664[_0x03cc('0x45')]+_0x03cc('0xf1')+_0x33a664[_0x03cc('0x8b')],JSON[_0x03cc('0x46')](_0x261515));ami[_0x03cc('0x25')](_0x03cc('0xf2'),ut['buildObj'](_0x33a664,_0x03cc('0xf3'),_0x588c63[_0x03cc('0x24')][_0x33a664[_0x03cc('0x45')]]));_0x21c3af(ut[_0x03cc('0x2e')](_0x03cc('0xf4')));})[_0x03cc('0x4f')](function(_0x136590){ut['logger'](_0x03cc('0xf5'),_0x136590);_0x556d35(ut[_0x03cc('0x2e')](_0x03cc('0xf6'),_0x4daba7,_0x127455));});}else{_0x29b023[_0x03cc('0xf7')]+=0x1;ut[_0x03cc('0xf8')](_0x33a664);rpcDb[_0x03cc('0xf9')](_0x33a664,_0x03cc('0xfa'));delete _0x588c63['actions'][_0x2bbf1a];_0x556d35(ut[_0x03cc('0x2e')](_0x03cc('0xfb'),_0x4daba7,_0x127455));}});};Preview[_0x03cc('0xe')][_0x03cc('0x73')]=function(_0x1e4596){return!_['isNil'](_0x1e4596)&&!_['isNil'](_0x1e4596[_0x03cc('0x33')])&&!_[_0x03cc('0x42')](_0x1e4596[_0x03cc('0xfc')])&&_0x1e4596[_0x03cc('0xfc')]&&!_[_0x03cc('0x42')](this[_0x03cc('0x13')][util[_0x03cc('0x28')](_0x03cc('0xfd'),_0x1e4596[_0x03cc('0x33')])])&&!_['isNil'](this[_0x03cc('0x13')][util[_0x03cc('0x28')](_0x03cc('0xfd'),_0x1e4596[_0x03cc('0x33')])][_0x03cc('0xfe')])&&(this[_0x03cc('0x13')][util[_0x03cc('0x28')](_0x03cc('0xfd'),_0x1e4596[_0x03cc('0x33')])][_0x03cc('0xfe')]===_0x03cc('0xff')||this[_0x03cc('0x13')][util['format'](_0x03cc('0xfd'),_0x1e4596[_0x03cc('0x33')])]['status']===_0x03cc('0x100'));};Preview[_0x03cc('0xe')][_0x03cc('0x101')]=function(_0xb78595,_0x569578){return this[_0x03cc('0x102')](_0xb78595,_0x569578)[_0x03cc('0x5a')](function(_0x544bc1){return _['pick'](_0x544bc1,['message']);})[_0x03cc('0x4f')](function(_0x22de99){if(_0x22de99[_0x03cc('0x103')]){rpcDb[_0x03cc('0x104')](_0xb78595);}if(_0x22de99[_0x03cc('0xfc')]){rpcDb[_0x03cc('0x61')](_0xb78595);}throw _[_0x03cc('0x4a')](_0x22de99,[_0x03cc('0x2e')]);});};Preview[_0x03cc('0xe')][_0x03cc('0x102')]=function(_0x7a00b8,_0x629f13){var _0xe279e6=this;var _0x3e90b7,_0x5439ad;return rpcDb[_0x03cc('0x105')](_0x7a00b8)[_0x03cc('0x5a')](function(_0x18e21d){if(!_['isNil'](_0x18e21d[0x0])){_0x5439ad=_0x18e21d[0x0][_0x03cc('0x106')]?![]:!![];_0x3e90b7=_0x18e21d[0x0][_0x03cc('0x106')]?!![]:![];_0x3e90b7=_0x629f13?!![]:_0x3e90b7;}var _0x4f4dee=_0xe279e6[_0x03cc('0x107')](_0x18e21d);if(_0x4f4dee[_0x03cc('0x108')]){rpcDb['checkIsBlackList'](_[_0x03cc('0x4a')](_0x18e21d[0x0],[_0x03cc('0x4c'),_0x03cc('0x109')]))[_0x03cc('0x5a')](function(_0x344711){_0xe279e6['checkInBlack'](_0x344711,_0x18e21d[0x0],_0x629f13,_0x5439ad,_0x3e90b7)[_0x03cc('0x5a')](function(_0x559ab3){return _0x559ab3;})[_0x03cc('0x4f')](function(_0x1597d3){throw _0x1597d3;});})[_0x03cc('0x4f')](function(_0x540aa6){ut[_0x03cc('0x31')](_0x03cc('0x10a'),_0x540aa6);throw ut['message'](_0x03cc('0x10b'),_0x5439ad,_0x3e90b7);});}else{throw ut['message'](_0x4f4dee[_0x03cc('0x2e')],_0x5439ad,_0x3e90b7);}})[_0x03cc('0x4f')](function(_0x7774b0){ut[_0x03cc('0x31')](_0x03cc('0x10c'),_0x7774b0);throw ut[_0x03cc('0x2e')](_0x03cc('0x10b'),![],!![]);});};Preview['prototype'][_0x03cc('0x107')]=function(_0x242023){if(_[_0x03cc('0x42')](_0x242023)||_[_0x03cc('0xef')](_0x242023)||!_[_0x03cc('0x42')](_0x242023[0x0][_0x03cc('0x5d')])&&_['isNil'](_0x242023[0x0][_0x03cc('0x5d')]['name'])){ut[_0x03cc('0x31')](_0x03cc('0x10d'),_0x242023);return{'isValid':![],'message':_0x03cc('0x10e')};}var _0x435214=this[_0x03cc('0x24')][_0x242023[0x0]['Queue'][_0x03cc('0x33')]];_0x435214[_0x03cc('0x2e')]=utils['CAMPAIGN_STATUS'][_0x03cc('0x76')];if(_[_0x03cc('0x42')](_0x435214)){ut[_0x03cc('0x31')](_0x03cc('0x10f'),_0x435214);return{'isValid':![],'message':_0x03cc('0x110')};}if(!this[_0x03cc('0x73')](_0x435214[_0x03cc('0x111')])){ut[_0x03cc('0x31')](_0x03cc('0x112'),_0x03cc('0x113')+_0x435214[_0x03cc('0x33')]+_0x03cc('0x114'));if(!this[_0x03cc('0x73')](_0x435214[_0x03cc('0x74')])){ut[_0x03cc('0x31')](_0x03cc('0x112'),_0x435214[_0x03cc('0x33')]+_0x03cc('0x115'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x03cc('0x72')](_0x435214['dialActive'])){ut['logger'](_0x03cc('0x116'),_0x435214[_0x03cc('0x33')]+_0x03cc('0x117'));return{'isValid':![],'message':_0x03cc('0x113')+_0x435214[_0x03cc('0x33')]+_0x03cc('0x117')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x03cc('0xe')][_0x03cc('0x118')]=function(_0x3057d3,_0x142ae2,_0x195168,_0x4c1d0d){var _0x4b9aec=this;return new Promise(function(_0x11b0d4,_0x54bf32){var _0x2d1db3=_0x3057d3[_0x03cc('0x8d')];var _0x325532=_0x4b9aec[_0x03cc('0x73')](_0x142ae2['Trunk'])?util[_0x03cc('0x28')](_0x03cc('0x119'),_0x142ae2['Trunk'][_0x03cc('0x33')],_[_0x03cc('0x42')](_0x142ae2[_0x03cc('0x11a')])?'':_0x142ae2[_0x03cc('0x11a')]['trim']()||'',_0x142ae2['dialCutDigit']>0x0?_0x195168[_0x03cc('0x109')][_0x03cc('0x11b')](_0x142ae2['dialCutDigit']):_0x195168[_0x03cc('0x109')]):util[_0x03cc('0x28')](_0x03cc('0x119'),_['isNil'](_0x142ae2['TrunkBackup'])?_0x142ae2[_0x03cc('0x111')][_0x03cc('0x33')]:_0x142ae2[_0x03cc('0x74')][_0x03cc('0x33')],_[_0x03cc('0x42')](_0x142ae2[_0x03cc('0x11a')])?'':_0x142ae2['dialPrefix'][_0x03cc('0x11c')]()||'',_0x142ae2['dialCutDigit']>0x0?_0x195168[_0x03cc('0x109')][_0x03cc('0x11b')](_0x142ae2[_0x03cc('0x11d')]):_0x195168[_0x03cc('0x109')]);var _0x4a6d87=_0x4b9aec[_0x03cc('0x73')](_0x142ae2[_0x03cc('0x111')])?ut[_0x03cc('0x11e')](_0x142ae2[_0x03cc('0x111')][_0x03cc('0x11f')],_0x142ae2[_0x03cc('0x120')],_0x142ae2[_0x03cc('0x121')]>0x0?ut['getCallerIdRandom'](_0x142ae2[_0x03cc('0x122')],_0x142ae2[_0x03cc('0x121')]):_0x142ae2[_0x03cc('0x122')]):ut[_0x03cc('0x11e')](_[_0x03cc('0x42')](_0x142ae2[_0x03cc('0x74')])?_0x142ae2[_0x03cc('0x111')][_0x03cc('0x11f')]:_0x142ae2['TrunkBackup'][_0x03cc('0x11f')],_0x142ae2[_0x03cc('0x120')],_0x142ae2[_0x03cc('0x121')]>0x0?ut[_0x03cc('0x123')](_0x142ae2[_0x03cc('0x122')],_0x142ae2[_0x03cc('0x121')]):_0x142ae2[_0x03cc('0x122')]);if(_0x4a6d87){_0x3057d3['originatecalleridname']=ut[_0x03cc('0x124')](_0x4a6d87);_0x3057d3['originatecalleridnum']=ut[_0x03cc('0x125')](_0x4a6d87);}var _0x48f338=ut[_0x03cc('0x126')](_0x142ae2,_0x195168,_0x325532,_0x4a6d87,_0x2d1db3,_0x3057d3);var _0x1aab81=utils[_0x03cc('0x127')](_0x195168['Contact']);Object[_0x03cc('0x128')](_0x48f338,_0x1aab81);_[_0x03cc('0x129')](_0x3057d3,ut[_0x03cc('0x12a')](_0x48f338));_0x3057d3['starttime']=moment()[_0x03cc('0x28')](_0x03cc('0x63'));_0x142ae2[_0x03cc('0x12b')]=_0x48f338;var _0x349c7c=ut[_0x03cc('0x12c')](_0x3057d3,_0x142ae2,_0x48f338,_0x3057d3['activeContact'],_0x4c1d0d);return ami[_0x03cc('0x12d')](_0x349c7c)['then'](function(_0x499297){_0x142ae2[_0x03cc('0x47')]+=0x1;logger['info'](_0x03cc('0x12e'),_0x2d1db3,_0x03cc('0x8e'),_0x142ae2[_0x03cc('0x33')],_0x03cc('0xd5'),_0x142ae2[_0x03cc('0x47')]);_0x11b0d4(_0x499297);})[_0x03cc('0x4f')](function(_0x17a44f){ut['logAgent'](_0x3057d3,0xe,_0x03cc('0x12f'));rpcDb[_0x03cc('0xde')](_0x3057d3,_0x03cc('0x130'));_0x54bf32(_0x17a44f);});});};Preview[_0x03cc('0xe')][_0x03cc('0x1e')]=function(_0x378bc9){if(this[_0x03cc('0x14')][_0x378bc9['linkedid']]){this[_0x03cc('0x14')][_0x378bc9['linkedid']]['channel']=_0x378bc9[_0x03cc('0x4e')];}};Preview['prototype']['syncOriginateResponse']=function(_0x3ca0b0){var _0x51a38e=this;var _0x50bfa9=this[_0x03cc('0x14')][_0x3ca0b0[_0x03cc('0x131')]];if(_0x50bfa9){if(_0x50bfa9['lookAgent']&&this[_0x03cc('0x15')][_0x50bfa9['lookAgent']]){ut[_0x03cc('0x132')](_0x50bfa9,this[_0x03cc('0x15')][_0x50bfa9[_0x03cc('0xee')]]['name'],this[_0x03cc('0x15')][_0x50bfa9[_0x03cc('0xee')]]['id']);}var _0x5986cd=_[_0x03cc('0x133')](_0x50bfa9);_0x5986cd[_0x03cc('0x134')]=moment()[_0x03cc('0x28')]('YYYY-MM-DD\x20HH:mm:ss');var _0x482b3a=_0x51a38e[_0x03cc('0x24')][_0x50bfa9[_0x03cc('0x45')]];if(ut[_0x03cc('0x135')](_0x3ca0b0[_0x03cc('0x136')])){if(_0x50bfa9[_0x03cc('0x88')]){rpcDb[_0x03cc('0x104')](_0x50bfa9[_0x03cc('0x8b')]);}if(_0x50bfa9[_0x03cc('0x89')]){rpcDb[_0x03cc('0x61')](_0x50bfa9['idContact']);}ami[_0x03cc('0x25')](_0x03cc('0x137'),ut[_0x03cc('0x7c')](_0x50bfa9,_0x03cc('0x138'),this[_0x03cc('0x24')][_0x50bfa9[_0x03cc('0x45')]]));this[_0x03cc('0xd9')](_0x5986cd,_0x482b3a,_0x3ca0b0);}else{_0x50bfa9[_0x03cc('0x62')]=moment()[_0x03cc('0x28')](_0x03cc('0x63'));ut[_0x03cc('0xdd')](_0x5986cd,0x4,_0x03cc('0x139'));rpcDb[_0x03cc('0xde')](_0x5986cd,_0x03cc('0x13a'));}}};Preview[_0x03cc('0xe')][_0x03cc('0x13b')]=function(_0x145b4d){var _0x43d2b3=this['actions'][_0x145b4d[_0x03cc('0x9d')]];var _0x379835;if(_0x43d2b3){_0x379835=this[_0x03cc('0x24')][_0x43d2b3[_0x03cc('0x45')]];logger[_0x03cc('0x26')](_0x03cc('0x13c'),_0x145b4d[_0x03cc('0x9d')],_0x03cc('0x8e'),_0x379835['name'],_0x03cc('0x48'),_0x379835[_0x03cc('0x2d')]);}if(this[_0x03cc('0x14')][_0x145b4d[_0x03cc('0x9d')]]&&_0x145b4d[_0x03cc('0x9d')]!==_0x145b4d[_0x03cc('0x8d')]){if(_0x145b4d[_0x03cc('0x13d')]==='16'&&this['actions'][_0x145b4d[_0x03cc('0x9d')]][_0x03cc('0x49')]){this['callProgressDetectingCustomer'](_0x145b4d,_0x145b4d['linkedid'],_0x145b4d[_0x03cc('0x13d')]);}else if(this['actions'][_0x145b4d[_0x03cc('0x9d')]][_0x03cc('0x49')]){logger[_0x03cc('0x26')](_0x03cc('0x13e'),_0x145b4d['linkedid'],_0x145b4d['cause'],'\x20Queue',_0x379835['name'],_0x03cc('0x48'),_0x379835[_0x03cc('0x2d')]);this[_0x03cc('0x13f')](_0x145b4d,_0x145b4d[_0x03cc('0x9d')],_0x145b4d[_0x03cc('0x13d')]);}}else if(_0x43d2b3&&_['isNil'](_0x43d2b3[_0x03cc('0x140')])&&_0x379835[_0x03cc('0x141')]&&_0x145b4d[_0x03cc('0x9d')]===_0x145b4d[_0x03cc('0x8d')]&&_[_0x03cc('0x42')](_0x145b4d[_0x03cc('0xdc')])&&_0x145b4d[_0x03cc('0x13d')]==='16'&&_0x145b4d[_0x03cc('0x142')]==='6'&&_[_0x03cc('0xda')](_0x43d2b3[_0x03cc('0x143')])){if(_0x43d2b3[_0x03cc('0x88')]){rpcDb['unlockContact'](_0x43d2b3[_0x03cc('0x8b')]);}if(_0x43d2b3[_0x03cc('0x89')]){rpcDb['disableContact'](_0x43d2b3['idContact']);}_0x145b4d[_0x03cc('0xdc')]='22';this[_0x03cc('0xd9')](_0x43d2b3,_0x379835,_0x145b4d);}else if(_0x43d2b3&&_0x43d2b3[_0x03cc('0x143')]){if(_0x145b4d['cause']==='16'&&this['actions'][_0x145b4d[_0x03cc('0x9d')]][_0x03cc('0x49')]){logger[_0x03cc('0x26')](_0x03cc('0x144'),_0x145b4d[_0x03cc('0x9d')],_0x145b4d['cause'],_0x03cc('0x8e'),_0x379835[_0x03cc('0x33')],_0x03cc('0x48'),_0x379835[_0x03cc('0x2d')]);this[_0x03cc('0x13f')](_0x145b4d,_0x145b4d[_0x03cc('0x9d')],_0x145b4d[_0x03cc('0x13d')]);}else if(this[_0x03cc('0x14')][_0x145b4d[_0x03cc('0x9d')]][_0x03cc('0x49')]){logger[_0x03cc('0x26')](_0x03cc('0x13e'),_0x145b4d[_0x03cc('0x9d')],_0x145b4d[_0x03cc('0x13d')],_0x03cc('0x8e'),_0x379835[_0x03cc('0x33')],_0x03cc('0x48'),_0x379835[_0x03cc('0x2d')]);this[_0x03cc('0x13f')](_0x145b4d,_0x145b4d['linkedid'],_0x145b4d[_0x03cc('0x13d')]);}}};Preview[_0x03cc('0xe')]['syncDialEnd']=function(_0x317b0d){if(this[_0x03cc('0x14')][_0x317b0d[_0x03cc('0xd7')]]&&_0x317b0d['destlinkedid']!==_0x317b0d[_0x03cc('0x145')]){this[_0x03cc('0x13f')](_0x317b0d,_0x317b0d[_0x03cc('0xd7')],_0x317b0d[_0x03cc('0xcb')]);}};Preview[_0x03cc('0xe')][_0x03cc('0x1b')]=function(_0x227ddf){if(this['actions'][_0x227ddf['linkedid']]&&_0x227ddf[_0x03cc('0x9d')]!==_0x227ddf[_0x03cc('0x8d')]&&!this[_0x03cc('0x14')][_0x227ddf['linkedid']][_0x03cc('0x49')]){if(_0x227ddf[_0x03cc('0x13d')]==='1'){this['callProgressDetectingCustomer'](_0x227ddf,_0x227ddf['linkedid'],_0x227ddf['cause']);}}};Preview[_0x03cc('0xe')]['addVariable']=function(_0x3a14c5,_0x2f77c6,_0x133b04){if(this[_0x03cc('0x14')][_0x3a14c5]){if(_[_0x03cc('0x42')](this['actions'][_0x3a14c5][_0x03cc('0x12b')])){this['actions'][_0x3a14c5][_0x03cc('0x12b')]={};}this[_0x03cc('0x14')][_0x3a14c5]['variables'][_0x2f77c6]=_0x133b04;}};Preview[_0x03cc('0xe')][_0x03cc('0x1f')]=function(_0x4cd53e){try{if(!_[_0x03cc('0x42')](_0x4cd53e)){if(ut['filterKey'](_[_0x03cc('0x146')](_0x4cd53e['variable'])[0x0])){this[_0x03cc('0x147')](_0x4cd53e[_0x03cc('0x8d')],_['keys'](_0x4cd53e['variable'])[0x0],_0x4cd53e['value']);}}}catch(_0x5487a5){logger['error'](_0x03cc('0x148'),util[_0x03cc('0x149')](_0x5487a5,{'showHidden':![],'depth':null}));}};Preview[_0x03cc('0xe')][_0x03cc('0x21')]=function(_0x37ce8f){if(_0x37ce8f){if(this['actions'][_0x37ce8f[_0x03cc('0x14a')]]){this[_0x03cc('0x14')][_0x37ce8f[_0x03cc('0x14a')]][_0x03cc('0x143')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x3e2e1b){if(_0x3e2e1b){if(this[_0x03cc('0x14')][_0x3e2e1b['transfererlinkedid']]){this[_0x03cc('0x14')][_0x3e2e1b[_0x03cc('0x14b')]][_0x03cc('0x143')]=!![];}}};module[_0x03cc('0x14c')]=Preview; \ No newline at end of file +var _0xf5b0=['prototype','enqueue','tail','finally','sequence','campaignsPreview','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','syncHangupRequest','bind','dialend','syncDialEnd','varset','syncVarSet','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','CAMPAIGN_STATUS','INACTIVE','\x20is\x20not\x20active','message','DEACTIVATED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','dialMethod','preview','booked','clearZombieChannels','hasOwnProperty','type','outbound','setMessage','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','originated','pTalking:\x20','pTalking','dialAnswer','pick','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','linkedid','info','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','uniqueid','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','total','answered','decrementTalking','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','additional','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','activeContact','NOANSWER','outboundNoAnswerCallsDay','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','outboundRejectCallsDay','countagentrejectretry','AgentReject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','dialstatus','custom:amd','amd','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','trunks','SIP/%s','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','phone','substring','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridnum','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','[originated][increment]','OriginateError','syncNewExten','actionid','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','filterKey','keys','variable','value','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','defaults','redis'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0xf5b0,0x12f));var _0x0f5b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xf5b0[_0x5c351c];return _0x26f3b3;};'use strict';var util=require(_0x0f5b('0x0'));var _=require(_0x0f5b('0x1'));var uuid=require(_0x0f5b('0x2'));var moment=require(_0x0f5b('0x3'));var Redis=require(_0x0f5b('0x4'));var config=require(_0x0f5b('0x5'));var logger=require(_0x0f5b('0x6'))('preview');var loggerAction=require('../../../config/logger')(_0x0f5b('0x7'));var ami=require(_0x0f5b('0x8'));var rpcDb=require(_0x0f5b('0x9'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0f5b('0xa'));var ut=require(_0x0f5b('0xb'));var utils=require(_0x0f5b('0xc'));config['redis']=_[_0x0f5b('0xd')](config[_0x0f5b('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x0f5b('0xf')][_0x0f5b('0x10')]=function(_0x5d9b48){this[_0x0f5b('0x11')]=this['tail']?this['tail'][_0x0f5b('0x12')](_0x5d9b48):_0x5d9b48();};function Preview(_0x1d6ce1){this[_0x0f5b('0x13')]=new Sequence();this[_0x0f5b('0x14')]=_0x1d6ce1['voiceQueues'];this['trunks']=_0x1d6ce1['trunks'];this[_0x0f5b('0x15')]={};this['agents']=_0x1d6ce1[_0x0f5b('0x16')];this[_0x0f5b('0x17')]=0x0;ami['on'](_0x0f5b('0x18'),this[_0x0f5b('0x19')]['bind'](this));ami['on']('hangup',this[_0x0f5b('0x1a')]['bind'](this));ami['on']('hanguprequest',this[_0x0f5b('0x1b')][_0x0f5b('0x1c')](this));ami['on'](_0x0f5b('0x1d'),this[_0x0f5b('0x1e')][_0x0f5b('0x1c')](this));ami['on']('newexten',this['syncNewExten'][_0x0f5b('0x1c')](this));ami['on'](_0x0f5b('0x1f'),this[_0x0f5b('0x20')][_0x0f5b('0x1c')](this));ami['on']('attendedtransfer',this[_0x0f5b('0x21')]['bind'](this));ami['on']('blindtransfer',this[_0x0f5b('0x22')][_0x0f5b('0x1c')](this));this[_0x0f5b('0x23')](this['campaignsPreview']);}function emit(_0x1b5219,_0x52943c,_0x312f9e){io['to'](_0x1b5219)[_0x0f5b('0x24')](_0x52943c,_0x312f9e);}function emitVoiceQueueChannelRemove(_0x4e56cf){logger['info'](_0x0f5b('0x25'),JSON[_0x0f5b('0x26')](_0x4e56cf));emit(util[_0x0f5b('0x27')](_0x0f5b('0x28'),_0x4e56cf[_0x0f5b('0x29')]),_0x0f5b('0x2a'),_0x4e56cf);io[_0x0f5b('0x24')](_0x0f5b('0x2b'),_0x4e56cf);}function notSendMessagesQueue(_0x26aa94){if(_0x26aa94[_0x0f5b('0x2c')]){if(_0x26aa94['originated']===0x0&&_0x26aa94['pTalking']===0x0){_0x26aa94[_0x0f5b('0x2c')]=![];_0x26aa94['available']=0x0;_0x26aa94[_0x0f5b('0x2d')]=0x0;_0x26aa94['message']=utils[_0x0f5b('0x2e')][_0x0f5b('0x2f')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x26aa94[_0x0f5b('0x29')]+_0x0f5b('0x30'));}else{_0x26aa94[_0x0f5b('0x31')]=utils[_0x0f5b('0x2e')][_0x0f5b('0x32')];ut[_0x0f5b('0x33')](_0x0f5b('0x34'),_0x26aa94[_0x0f5b('0x29')]+'\x20is\x20deactivated');}}}Preview[_0x0f5b('0xf')]['loopCampaigns']=function(){var _0x34d359=this;setInterval(function(){_0x34d359[_0x0f5b('0x35')]();},0x7cf);};Preview[_0x0f5b('0xf')]['syncCampaigns']=function(){var _0x5e067b=this[_0x0f5b('0x14')];this[_0x0f5b('0x17')]+=0x1;for(var _0xb8627e in _0x5e067b){if(_0x5e067b['hasOwnProperty'](_0xb8627e)&&(_0x5e067b[_0xb8627e][_0x0f5b('0x36')]===_0x0f5b('0x37')||_0x5e067b[_0xb8627e][_0x0f5b('0x36')]===_0x0f5b('0x38'))&&_0x5e067b[_0xb8627e]['type']==='outbound'){if(this[_0x0f5b('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x0f5b('0x39')]();}}if(_0x5e067b[_0x0f5b('0x3a')](_0xb8627e)&&_0x5e067b[_0xb8627e][_0x0f5b('0x36')]===_0x0f5b('0x37')&&_0x5e067b[_0xb8627e][_0x0f5b('0x3b')]===_0x0f5b('0x3c')){if(_0x5e067b[_0xb8627e]['dialActive']){this[_0x0f5b('0x3d')](_0x5e067b[_0xb8627e]);if(_0x5e067b[_0xb8627e]['dialPreviewAutoRecallMe'])this['recallMe'](_0x5e067b[_0xb8627e]);}else{notSendMessagesQueue(_0x5e067b[_0xb8627e]);}}}};Preview[_0x0f5b('0xf')][_0x0f5b('0x3e')]=function(_0x46d313){var _0x36978d=this;this[_0x0f5b('0x13')]['enqueue'](function(){if(!_[_0x0f5b('0x3f')](_0x36978d[_0x0f5b('0x15')][_0x46d313])){loggerAction['info'](_0x0f5b('0x40'),_0x46d313,_0x0f5b('0x41'),_0x36978d[_0x0f5b('0x15')][_0x46d313][_0x0f5b('0x42')],_0x0f5b('0x43'),JSON['stringify'](_0x36978d[_0x0f5b('0x14')][_0x36978d[_0x0f5b('0x15')][_0x46d313][_0x0f5b('0x42')]][_0x0f5b('0x44')]),_0x0f5b('0x45'),JSON[_0x0f5b('0x26')](_0x36978d[_0x0f5b('0x14')][_0x36978d[_0x0f5b('0x15')][_0x46d313][_0x0f5b('0x42')]][_0x0f5b('0x46')]),JSON[_0x0f5b('0x26')](_0x36978d[_0x0f5b('0x15')][_0x46d313][_0x0f5b('0x47')]),JSON[_0x0f5b('0x26')](_[_0x0f5b('0x48')](_0x36978d[_0x0f5b('0x15')][_0x46d313],['contactId',_0x0f5b('0x49'),_0x0f5b('0x4a'),'ListId'])));return ami[_0x0f5b('0x4b')]({'action':_0x0f5b('0x4c'),'channel':_0x36978d[_0x0f5b('0x15')][_0x46d313][_0x0f5b('0x4d')]})[_0x0f5b('0x4e')](function(_0x4dd50c){if(_0x4dd50c[_0x0f5b('0x31')]===_0x0f5b('0x4f')){setTimeout(function(){if(_0x36978d[_0x0f5b('0x15')][_0x46d313]){utils[_0x0f5b('0x50')](_0x36978d[_0x0f5b('0x14')][_0x36978d[_0x0f5b('0x15')][_0x46d313][_0x0f5b('0x42')]],_0x0f5b('0x51'));if(_0x36978d['actions'][_0x46d313][_0x0f5b('0x47')]===!![]){ut['decrementTalking'](_0x36978d[_0x0f5b('0x14')][_0x36978d[_0x0f5b('0x15')][_0x46d313]['queue']],_0x0f5b('0x51'));ut[_0x0f5b('0x52')](_0x0f5b('0x53')+_0x46d313,_0x36978d[_0x0f5b('0x15')][_0x46d313][_0x0f5b('0x42')]);}ut['loggerError'](_0x0f5b('0x54')+_0x46d313,_0x36978d[_0x0f5b('0x15')][_0x46d313][_0x0f5b('0x42')]);delete _0x36978d[_0x0f5b('0x15')][_0x46d313];}},0x2328);}});}});};Preview[_0x0f5b('0xf')][_0x0f5b('0x39')]=function(){var _0x5e9f67=this;loggerAction['info'](_0x0f5b('0x55'),_['size'](this[_0x0f5b('0x15')]));for(var _0x367600 in this[_0x0f5b('0x15')]){if(_0x5e9f67[_0x0f5b('0x15')]['hasOwnProperty'](_0x367600)){_0x5e9f67[_0x0f5b('0x3e')](_0x367600);}}};Preview[_0x0f5b('0xf')][_0x0f5b('0x56')]=function(_0x2b4fbc){var _0x40a8eb=this;rpcDb[_0x0f5b('0x57')](_0x2b4fbc['id'],ut[_0x0f5b('0x58')](this['agents']))[_0x0f5b('0x59')](function(_0x53ca9e){if(!_[_0x0f5b('0x3f')](_0x53ca9e)){for(var _0x7fc443=0x0;_0x7fc443<_0x53ca9e[_0x0f5b('0x5a')];_0x7fc443+=0x1){if(ut[_0x0f5b('0x5b')](_0x53ca9e[_0x7fc443]['scheduledat'])<_0x2b4fbc[_0x0f5b('0x5c')]*0x3c){if(_0x53ca9e[_0x7fc443]['Agent']&&!_0x53ca9e[_0x7fc443][_0x0f5b('0x5d')][_0x0f5b('0x5e')]){_0x40a8eb[_0x0f5b('0x5f')](_0x53ca9e[_0x7fc443]['id'])['then'](ut[_0x0f5b('0x60')](_0x0f5b('0x61')))[_0x0f5b('0x4e')](ut[_0x0f5b('0x60')]('[RecallMe]'));}else{rpcDb[_0x0f5b('0x62')](_0x53ca9e[_0x7fc443]['id']);}}else{var _0x26df91=new Action(_0x53ca9e[_0x7fc443],_0x2b4fbc);_0x26df91[_0x0f5b('0x63')]=moment()[_0x0f5b('0x27')](_0x0f5b('0x64'));_0x2b4fbc[_0x0f5b('0x65')]+=0x1;ut[_0x0f5b('0x66')](_0x26df91,0x17,_0x0f5b('0x67'));if(_0x2b4fbc[_0x0f5b('0x68')]){rpcDb[_0x0f5b('0x69')](ut['createBody'](_0x53ca9e[_0x7fc443]));rpcDb[_0x0f5b('0x6a')](_0x26df91,_0x0f5b('0x6b'));}else{ut[_0x0f5b('0x66')](_0x26df91,0x16,_0x0f5b('0x6c'));rpcDb[_0x0f5b('0x6a')](_0x26df91,_0x0f5b('0x6d'));rpcDb[_0x0f5b('0x6e')](_0x26df91,_0x0f5b('0x6d'));}}}}})[_0x0f5b('0x4e')](ut['logger2'](_0x0f5b('0x6f')));};Preview[_0x0f5b('0xf')][_0x0f5b('0x3d')]=function(_0x2ddb92){_0x2ddb92[_0x0f5b('0x2c')]=!![];if(ut[_0x0f5b('0x70')](_0x2ddb92[_0x0f5b('0x71')])){_0x2ddb92[_0x0f5b('0x31')]=utils[_0x0f5b('0x2e')][_0x0f5b('0x72')];}else if(!ut[_0x0f5b('0x73')](_0x2ddb92['dialActive'])){_0x2ddb92[_0x0f5b('0x31')]=utils[_0x0f5b('0x2e')][_0x0f5b('0x2f')];}else if(!this[_0x0f5b('0x74')](_0x2ddb92[_0x0f5b('0x75')])){if(!this['isTrunkReachable'](_0x2ddb92[_0x0f5b('0x76')])){_0x2ddb92[_0x0f5b('0x31')]=utils[_0x0f5b('0x2e')][_0x0f5b('0x77')];}else{_0x2ddb92[_0x0f5b('0x31')]=utils['CAMPAIGN_STATUS'][_0x0f5b('0x78')];}}else{_0x2ddb92[_0x0f5b('0x31')]=utils[_0x0f5b('0x2e')][_0x0f5b('0x78')];}};Preview[_0x0f5b('0xf')][_0x0f5b('0x79')]=function(_0x154386,_0x2de5ef,_0x2221e3){var _0x188195=this;var _0x4804f8=this['actions'][_0x2de5ef];var _0x51fb76=this['campaignsPreview'][_0x4804f8[_0x0f5b('0x42')]];var _0x4c7a6b;var _0x18971d=![];var _0x439657=0x2;var _0x1bffba=0x3;if(_0x51fb76){switch(_0x2221e3){case'1':_0x51fb76['outboundNoSuchCallsDay']+=0x1;_0x4804f8[_0x0f5b('0x7a')]+=0x1;_0x4804f8[_0x0f5b('0x7b')]=ut[_0x0f5b('0x7c')](_0x4804f8);ut[_0x0f5b('0x66')](_0x4804f8,0x0,_0x0f5b('0x7d'));ami['emit'](_0x0f5b('0x7e'),ut[_0x0f5b('0x7f')](_0x4804f8,_0x0f5b('0x80')));rpcDb['createCustomerHistory'](_0x4804f8,_0x0f5b('0x81'));_0x188195[_0x0f5b('0x82')](_0x4804f8,'0',_0x51fb76)['then'](function(_0x371830){_0x18971d=_0x371830['additional']==0x1;_0x439657=_0x51fb76[_0x0f5b('0x83')];_0x1bffba=_0x51fb76[_0x0f5b('0x84')];if(!_0x18971d){if(ut['totalGlobal'](_0x4804f8)>=_0x51fb76[_0x0f5b('0x85')]){_0x4c7a6b=ut[_0x0f5b('0x86')](_0x4804f8,0xf,'Global');rpcDb[_0x0f5b('0x6e')](_0x4c7a6b,_0x0f5b('0x87'));}else{if(_0x4804f8[_0x0f5b('0x7a')]>=_0x51fb76[_0x0f5b('0x88')]){rpcDb[_0x0f5b('0x6e')](_0x4804f8,_0x0f5b('0x87'));}else{rpcDb['rescheduleContact'](ut[_0x0f5b('0x89')](_0x4804f8,_0x0f5b('0x7a'),_0x51fb76['dialNoSuchNumberRetryFrequency']),_0x4804f8[_0x0f5b('0x8a')],_0x4804f8['activeContact']);}}delete this[_0x0f5b('0x15')][_0x154386[_0x0f5b('0x8b')]];}else{_0x4804f8['countnosuchnumberretry']++;logger[_0x0f5b('0x8c')]('actioncountonusuch',_0x4804f8[_0x0f5b('0x7a')]);logger[_0x0f5b('0x8c')]('id',_0x4804f8[_0x0f5b('0x8d')]);_0x188195[_0x0f5b('0x8e')]({'id':_0x4804f8[_0x0f5b('0x8d')],'field':{'countnosuchnumberretry':_0x4804f8[_0x0f5b('0x7a')]}})[_0x0f5b('0x59')](function(){_0x188195[_0x0f5b('0x8f')](_0x4804f8,_0x439657,_0x1bffba)[_0x0f5b('0x59')](function(){});});}});break;case _0x0f5b('0x90'):var _0x494808=moment()[_0x0f5b('0x27')](_0x0f5b('0x64'));_0x4804f8['responsetime']=_0x494808;_0x4804f8['answertime']=_0x494808;_0x4804f8[_0x0f5b('0x47')]=!![];_0x51fb76[_0x0f5b('0x46')]+=0x1;logger[_0x0f5b('0x8c')]('[syncHangup][talking][increment]',_0x4804f8[_0x0f5b('0x91')],'\x20Queue',_0x51fb76[_0x0f5b('0x29')],_0x0f5b('0x45'),_0x51fb76['pTalking']);ami[_0x0f5b('0x24')](_0x0f5b('0x92'),ut[_0x0f5b('0x7f')](_0x4804f8,_0x0f5b('0x93'),this['campaignsPreview'][_0x4804f8[_0x0f5b('0x42')]]));if(_0x51fb76[_0x0f5b('0x94')]||_0x51fb76[_0x0f5b('0x95')]){ami[_0x0f5b('0x24')](_0x0f5b('0x96'),{'queue':_0x4804f8['queue'],'interface':_0x4804f8[_0x0f5b('0x97')],'uniqueid':_0x4804f8[_0x0f5b('0x91')]});}break;case'16':ami[_0x0f5b('0x24')](_0x0f5b('0x98'),ut[_0x0f5b('0x7f')](_0x4804f8,_0x0f5b('0x99'),this['campaignsPreview'][_0x4804f8[_0x0f5b('0x42')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x4804f8,_0x0f5b('0x99')));_0x51fb76['outboundAnswerCallsDay']+=0x1;_0x51fb76[_0x0f5b('0x9a')]+=0x1;_0x51fb76[_0x0f5b('0x9b')]+=0x1;ut[_0x0f5b('0x9c')](_0x51fb76,_0x0f5b('0x9d'));_0x4804f8['countglobal']=ut[_0x0f5b('0x7c')](_0x4804f8);ut[_0x0f5b('0x66')](_0x4804f8,0x4,_0x0f5b('0x9e'));rpcDb[_0x0f5b('0x6a')](_0x4804f8,_0x0f5b('0x9f'));rpcDb['createCustomerFinal'](_0x4804f8,_0x0f5b('0xa0'));rpcDb['crateCustomerReportQueue'](_0x4804f8);_0x51fb76['sumDuration']+=_0x4804f8[_0x0f5b('0xa1')];_0x51fb76[_0x0f5b('0xa2')]+=_0x4804f8['talktime'];logger[_0x0f5b('0x8c')](_0x0f5b('0xa3'),_0x4804f8[_0x0f5b('0x91')],_0x0f5b('0xa4'),_0x51fb76['name'],_0x0f5b('0x45'),_0x51fb76['pTalking']);delete this[_0x0f5b('0x15')][_0x154386[_0x0f5b('0x8b')]];break;case _0x0f5b('0xa5'):_0x51fb76['outboundBusyCallsDay']+=0x1;_0x4804f8[_0x0f5b('0xa6')]+=0x1;_0x4804f8[_0x0f5b('0x7b')]=ut[_0x0f5b('0x7c')](_0x4804f8);ut['logCustomer'](_0x4804f8,0x5,_0x0f5b('0xa7'));_0x439657=_0x51fb76['dialBusyRetryFrequency'];_0x1bffba=_0x51fb76[_0x0f5b('0x84')];ami[_0x0f5b('0x24')]('custom:agentbusy',ut[_0x0f5b('0x7f')](_0x4804f8,'busy'));rpcDb[_0x0f5b('0x6a')](_0x4804f8,_0x0f5b('0xa8'));_0x188195['verifyAdditionalPhones'](_0x4804f8,'5',_0x51fb76)[_0x0f5b('0x59')](function(_0x2cec20){_0x18971d=_0x2cec20[_0x0f5b('0xa9')]==0x1;if(!_0x18971d){if(ut[_0x0f5b('0x7c')](_0x4804f8)>=_0x51fb76[_0x0f5b('0x85')]){_0x4c7a6b=ut[_0x0f5b('0x86')](_0x4804f8,0xf,'Global');rpcDb[_0x0f5b('0x6e')](_0x4c7a6b,_0x0f5b('0xaa'));}else{if(_0x4804f8['countbusyretry']>=_0x51fb76[_0x0f5b('0xab')]){rpcDb[_0x0f5b('0x6e')](_0x4804f8,_0x0f5b('0xa8'));}else{rpcDb[_0x0f5b('0xac')](ut[_0x0f5b('0x89')](_0x4804f8,_0x0f5b('0xa6'),_0x51fb76[_0x0f5b('0xad')]),_0x4804f8['unlockAgent'],_0x4804f8[_0x0f5b('0xae')]);}}}else{_0x4804f8[_0x0f5b('0xa6')]++;_0x188195['incrementPreviewCounters']({'id':_0x4804f8[_0x0f5b('0x8d')],'field':{'countbusyretry':_0x4804f8[_0x0f5b('0xa6')]}})[_0x0f5b('0x59')](function(){_0x188195['swapAdditionalPhones'](_0x4804f8,_0x439657,_0x1bffba)[_0x0f5b('0x59')](function(){});});}});break;case _0x0f5b('0xaf'):_0x51fb76[_0x0f5b('0xb0')]+=0x1;_0x4804f8['countnoanswerretry']+=0x1;_0x4804f8[_0x0f5b('0x7b')]=ut[_0x0f5b('0x7c')](_0x4804f8);ut[_0x0f5b('0x66')](_0x4804f8,0x3,'NoAnswer');_0x439657=_0x51fb76[_0x0f5b('0xb1')];_0x1bffba=_0x51fb76['callAdditionalPhoneAfterMin'];var _0x343206=ut[_0x0f5b('0xb2')](_0x4804f8,_0x51fb76);ami[_0x0f5b('0x24')](_0x0f5b('0xb3'),_0x343206);rpcDb[_0x0f5b('0x6a')](_0x4804f8,_0x0f5b('0xb4'));_0x188195[_0x0f5b('0x82')](_0x4804f8,'3',_0x51fb76)['then'](function(_0x5e9f55){_0x18971d=_0x5e9f55[_0x0f5b('0xa9')]==0x1;if(!_0x18971d){if(ut[_0x0f5b('0x7c')](_0x4804f8)>=_0x51fb76[_0x0f5b('0x85')]){_0x4c7a6b=ut['cloneAction'](_0x4804f8,0xf,_0x0f5b('0xb5'));rpcDb['createCustomerFinal'](_0x4c7a6b,_0x0f5b('0xb6'));}else{if(_0x4804f8[_0x0f5b('0xb7')]>=_0x51fb76[_0x0f5b('0xb8')]){rpcDb[_0x0f5b('0x6e')](_0x4804f8,_0x0f5b('0xb4'));}else{rpcDb['rescheduleContact'](ut[_0x0f5b('0x89')](_0x4804f8,_0x0f5b('0xb7'),_0x51fb76[_0x0f5b('0xb1')]),_0x4804f8[_0x0f5b('0x8a')],_0x4804f8[_0x0f5b('0xae')]);}}}else{_0x4804f8['countnoanswerretry']++;_0x188195[_0x0f5b('0x8e')]({'id':_0x4804f8[_0x0f5b('0x8d')],'field':{'countnoanswerretry':_0x4804f8[_0x0f5b('0xb7')]}})[_0x0f5b('0x59')](function(){_0x188195[_0x0f5b('0x8f')](_0x4804f8,_0x439657,_0x1bffba)['then'](function(){});});}});break;case'CONGESTION':_0x51fb76[_0x0f5b('0xb9')]+=0x1;_0x4804f8[_0x0f5b('0xba')]+=0x1;_0x4804f8[_0x0f5b('0x7b')]=ut[_0x0f5b('0x7c')](_0x4804f8);ut['logCustomer'](_0x4804f8,0x8,'Congestion');_0x439657=_0x51fb76['dialCongestionRetryFrequency'];_0x1bffba=_0x51fb76[_0x0f5b('0x84')];ami[_0x0f5b('0x24')](_0x0f5b('0xbb'),ut[_0x0f5b('0x7f')](_0x4804f8,_0x0f5b('0xbc')));rpcDb[_0x0f5b('0x6a')](_0x4804f8,'[callProgressDetectingCustomer][logCongestion]');_0x188195[_0x0f5b('0x82')](_0x4804f8,'8',_0x51fb76)['then'](function(_0x5383ee){_0x18971d=_0x5383ee[_0x0f5b('0xa9')]==0x1;if(!_0x18971d){if(ut['totalGlobal'](_0x4804f8)>=_0x51fb76[_0x0f5b('0x85')]){_0x4c7a6b=ut[_0x0f5b('0x86')](_0x4804f8,0xf,_0x0f5b('0xb5'));rpcDb[_0x0f5b('0x6e')](_0x4c7a6b,_0x0f5b('0xbd'));}else{if(_0x4804f8[_0x0f5b('0xba')]>=_0x51fb76[_0x0f5b('0xbe')]){rpcDb['createCustomerFinal'](_0x4804f8,_0x0f5b('0xbf'));}else{rpcDb[_0x0f5b('0xac')](ut[_0x0f5b('0x89')](_0x4804f8,_0x0f5b('0xba'),_0x51fb76[_0x0f5b('0xad')]),_0x4804f8[_0x0f5b('0x8a')],_0x4804f8['activeContact']);}}}else{_0x4804f8[_0x0f5b('0xba')]++;_0x188195['incrementPreviewCounters']({'id':_0x4804f8[_0x0f5b('0x8d')],'field':{'countcongestionretry':_0x4804f8[_0x0f5b('0xba')]}})[_0x0f5b('0x59')](function(){_0x188195[_0x0f5b('0x8f')](_0x4804f8,_0x439657,_0x1bffba)[_0x0f5b('0x59')](function(){});});}});break;case'CANCEL':_0x51fb76[_0x0f5b('0xc0')]+=0x1;_0x4804f8[_0x0f5b('0xc1')]+=0x1;_0x4804f8[_0x0f5b('0x7b')]=ut['totalGlobal'](_0x4804f8);ut[_0x0f5b('0x66')](_0x4804f8,0x14,_0x0f5b('0xc2'));_0x439657=_0x51fb76['dialAgentRejectRetryFrequency'];_0x1bffba=_0x51fb76[_0x0f5b('0x84')];ami[_0x0f5b('0x24')]('custom:agentreject',ut[_0x0f5b('0x7f')](_0x4804f8,_0x0f5b('0xc3')));rpcDb[_0x0f5b('0x6a')](_0x4804f8,'[syncHangupRequest][logAgentReject]');_0x188195['verifyAdditionalPhones'](_0x4804f8,'20',_0x51fb76)[_0x0f5b('0x59')](function(_0x2df338){_0x18971d=_0x2df338[_0x0f5b('0xa9')]==0x1;if(!_0x18971d){if(ut[_0x0f5b('0x7c')](_0x4804f8)>=_0x51fb76['dialGlobalMaxRetry']){_0x4c7a6b=ut[_0x0f5b('0x86')](_0x4804f8,0x14,_0x0f5b('0xc2'));rpcDb[_0x0f5b('0x6e')](_0x4c7a6b,_0x0f5b('0xc4'));}else{if(_0x4804f8['countagentrejectretry']>=_0x51fb76[_0x0f5b('0xc5')]){rpcDb[_0x0f5b('0x6e')](_0x4804f8,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0f5b('0xac')](ut[_0x0f5b('0x89')](_0x4804f8,_0x0f5b('0xc1'),_0x51fb76[_0x0f5b('0xc6')]),_0x4804f8[_0x0f5b('0x8a')],_0x4804f8['activeContact']);}}}else{_0x4804f8[_0x0f5b('0xb7')]++;_0x188195[_0x0f5b('0x8e')]({'id':_0x4804f8[_0x0f5b('0x8d')],'field':{'countnoanswerretry':_0x4804f8[_0x0f5b('0xb7')]}})[_0x0f5b('0x59')](function(){_0x188195[_0x0f5b('0x8f')](_0x4804f8,_0x439657,_0x1bffba)[_0x0f5b('0x59')](function(){});});}});break;case _0x0f5b('0xc7'):_0x51fb76[_0x0f5b('0xc8')]+=0x1;_0x4804f8[_0x0f5b('0xc9')]+=0x1;_0x4804f8[_0x0f5b('0x7b')]=ut[_0x0f5b('0x7c')](_0x4804f8);ut[_0x0f5b('0x66')](_0x4804f8,0xb,_0x0f5b('0xca'));rpcDb['createCustomerHistory'](_0x4804f8,'[callProgressDetectingCustomer][logAbandoned]');_0x188195['verifyAdditionalPhones'](_0x4804f8,'11',_0x51fb76)[_0x0f5b('0x59')](function(_0x10d7c5){_0x18971d=_0x10d7c5[_0x0f5b('0xa9')]==0x1;if(!_0x18971d){if(ut[_0x0f5b('0x7c')](_0x4804f8)>=_0x51fb76[_0x0f5b('0x85')]){_0x4c7a6b=ut['cloneAction'](_0x4804f8,0xf,_0x0f5b('0xb5'));rpcDb[_0x0f5b('0x6e')](_0x4c7a6b,_0x0f5b('0xcb'));}else{if(_0x4804f8[_0x0f5b('0xcc')]>=_0x51fb76['dialAbandonedMaxRety']){rpcDb[_0x0f5b('0x6e')](_0x4804f8,_0x0f5b('0xcb'));}else{rpcDb[_0x0f5b('0xac')](ut[_0x0f5b('0x89')](_0x4804f8,'countabandonedretry',_0x51fb76[_0x0f5b('0xcd')]),_0x4804f8[_0x0f5b('0x8a')],_0x4804f8[_0x0f5b('0xae')]);}}}else{_0x4804f8['countnoanswerretry']++;_0x188195[_0x0f5b('0x8e')]({'id':_0x4804f8[_0x0f5b('0x8d')],'field':{'countnoanswerretry':_0x4804f8[_0x0f5b('0xb7')]}})[_0x0f5b('0x59')](function(){_0x188195[_0x0f5b('0x8f')](_0x4804f8,_0x439657,_0x1bffba)[_0x0f5b('0x59')](function(){});});}});break;case'18':_0x51fb76[_0x0f5b('0xce')]+=0x1;_0x4804f8['countmachineretry']+=0x1;_0x4804f8[_0x0f5b('0x7b')]=ut[_0x0f5b('0x7c')](_0x4804f8);ut[_0x0f5b('0x66')](_0x4804f8,0x12,_0x154386['cause-txt']||_0x154386[_0x0f5b('0xcf')]);ami[_0x0f5b('0x24')](_0x0f5b('0xd0'),ut[_0x0f5b('0x7f')](_0x4804f8,_0x0f5b('0xd1')));rpcDb[_0x0f5b('0x6a')](_0x4804f8,'[callProgressDetectingCustomer][hangupInAMD]');_0x188195[_0x0f5b('0x82')](_0x4804f8,'18',_0x51fb76)[_0x0f5b('0x59')](function(_0x37c78c){_0x18971d=_0x37c78c[_0x0f5b('0xa9')]==0x1;if(!_0x18971d){if(ut['totalGlobal'](_0x4804f8)>=_0x51fb76[_0x0f5b('0x85')]){_0x4c7a6b=ut[_0x0f5b('0x86')](_0x4804f8,0x12,_0x0f5b('0xb5'));rpcDb['createCustomerFinal'](_0x4c7a6b,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x0f5b('0x6e')](_0x4804f8,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x4804f8[_0x0f5b('0xb7')]++;_0x188195['incrementPreviewCounters']({'id':_0x4804f8[_0x0f5b('0x8d')],'field':{'countnoanswerretry':_0x4804f8[_0x0f5b('0xb7')]}})[_0x0f5b('0x59')](function(){_0x188195[_0x0f5b('0x8f')](_0x4804f8,_0x439657,_0x1bffba)[_0x0f5b('0x59')](function(){});});}});delete this[_0x0f5b('0x15')][_0x154386[_0x0f5b('0x8b')]];break;case'19':_0x51fb76['outboundUnknownCallsDay']+=0x1;_0x4804f8[_0x0f5b('0x7b')]=ut[_0x0f5b('0x7c')](_0x4804f8);ut[_0x0f5b('0x66')](_0x4804f8,0x13,_0x154386[_0x0f5b('0xd2')]||_0x154386[_0x0f5b('0xcf')]);ami[_0x0f5b('0x24')](_0x0f5b('0xd0'),ut[_0x0f5b('0x7f')](_0x4804f8,'amd'));rpcDb[_0x0f5b('0x6a')](_0x4804f8,'[callProgressDetectingCustomer][machine]');_0x188195[_0x0f5b('0x82')](_0x4804f8,'18',_0x51fb76)['then'](function(_0x1ad9c6){_0x18971d=_0x1ad9c6[_0x0f5b('0xa9')]==0x1;if(!_0x18971d){if(ut[_0x0f5b('0x7c')](_0x4804f8)>=_0x51fb76['dialGlobalMaxRetry']){_0x4c7a6b=ut[_0x0f5b('0x86')](_0x4804f8,0xf,'Global');rpcDb[_0x0f5b('0x6e')](_0x4c7a6b,_0x0f5b('0xd3'));}else{rpcDb['createCustomerFinal'](_0x4804f8,_0x0f5b('0xd3'));}}else{_0x4804f8[_0x0f5b('0xb7')]++;_0x188195[_0x0f5b('0x8e')]({'id':_0x4804f8[_0x0f5b('0x8d')],'field':{'countnoanswerretry':_0x4804f8['countnoanswerretry']}})['then'](function(){_0x188195[_0x0f5b('0x8f')](_0x4804f8,_0x439657,_0x1bffba)[_0x0f5b('0x59')](function(){});});}});delete this[_0x0f5b('0x15')][_0x154386['linkedid']];break;default:if(_0x4804f8[_0x0f5b('0x47')]){ut['decrementTalking'](_0x51fb76,_0x0f5b('0xd4'));ut[_0x0f5b('0x52')](_0x0f5b('0xd5')+_0x51fb76[_0x0f5b('0x29')],_0x154386);}_0x51fb76[_0x0f5b('0xce')]+=0x1;_0x4804f8[_0x0f5b('0x7b')]=ut[_0x0f5b('0x7c')](_0x4804f8);ut[_0x0f5b('0x66')](_0x4804f8,0xc,_0x154386['cause-txt']||_0x154386[_0x0f5b('0xcf')]);_0x439657=_0x51fb76['dialAgentRejectRetryFrequency'];_0x1bffba=_0x51fb76[_0x0f5b('0x84')];rpcDb[_0x0f5b('0x6a')](_0x4804f8,'[callProgressDetectingCustomer][logUnknown]');_0x188195[_0x0f5b('0x82')](_0x4804f8,'20',_0x51fb76)[_0x0f5b('0x59')](function(_0x30bafb){_0x18971d=_0x30bafb[_0x0f5b('0xa9')]==0x1;if(!_0x18971d){if(ut[_0x0f5b('0x7c')](_0x4804f8)>=_0x51fb76[_0x0f5b('0x85')]){_0x4c7a6b=ut[_0x0f5b('0x86')](_0x4804f8,0xf,_0x0f5b('0xb5'));rpcDb[_0x0f5b('0x6e')](_0x4c7a6b,_0x0f5b('0xd6'));}else{rpcDb['createCustomerFinal'](_0x4804f8,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x0f5b('0x15')][_0x154386['linkedid']];}else{_0x188195[_0x0f5b('0x8f')](_0x4804f8,_0x439657,_0x1bffba)[_0x0f5b('0x59')](function(){});}});}if(!(_0x4804f8[_0x0f5b('0x47')]&&_0x2221e3==='16')){utils[_0x0f5b('0x50')](_0x51fb76,_0x0f5b('0xd7'));logger[_0x0f5b('0x8c')](_0x0f5b('0xd8'),_0x4804f8[_0x0f5b('0x91')],'\x20Queue',_0x51fb76[_0x0f5b('0x29')],_0x0f5b('0x43'),_0x51fb76[_0x0f5b('0x44')]);}if(_0x2221e3!==_0x0f5b('0x90')){delete this['actions'][_0x154386[_0x0f5b('0x8b')]];delete this['actions'][_0x154386[_0x0f5b('0xd9')]];}_0x51fb76[_0x0f5b('0xda')]=!![];}};Preview[_0x0f5b('0xf')][_0x0f5b('0xdb')]=function(_0x1d687e,_0x18d705,_0x3cb620){if(_[_0x0f5b('0xdc')](_0x18d705)&&_0x0f5b('0xdd')!==typeof _0x18d705){return;}if(_['isUndefined'](_0x3cb620)&&_0x0f5b('0xdd')!==typeof _0x3cb620){return;}switch(_0x3cb620[_0x0f5b('0xde')]){case'0':ut[_0x0f5b('0xdf')](_0x1d687e,0x0,'NoSuchNumber');rpcDb[_0x0f5b('0xe0')](_0x1d687e,_0x0f5b('0xe1'));break;case'3':ut['logAgent'](_0x1d687e,0x3,_0x0f5b('0xe2'));rpcDb[_0x0f5b('0xe0')](_0x1d687e,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x0f5b('0xdf')](_0x1d687e,0x5,'Busy');rpcDb[_0x0f5b('0xe0')](_0x1d687e,_0x0f5b('0xe3'));break;case'8':ut[_0x0f5b('0xdf')](_0x1d687e,0x8,_0x0f5b('0xe4'));rpcDb[_0x0f5b('0xe0')](_0x1d687e,_0x0f5b('0xe5'));break;case'22':ut[_0x0f5b('0xdf')](_0x1d687e,0x16,_0x0f5b('0xe6'));rpcDb[_0x0f5b('0xe0')](_0x1d687e,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x0f5b('0xdf')](_0x1d687e,0xc,_0x3cb620[_0x0f5b('0xde')]);rpcDb[_0x0f5b('0xe0')](_0x1d687e,_0x0f5b('0xe5'));}utils[_0x0f5b('0x50')](_0x18d705,'[callProgressDetectingAgent]');logger[_0x0f5b('0x8c')]('[originated][decrement][callProgressDetectingAgent]',_0x1d687e['uniqueid'],_0x0f5b('0xa4'),_0x18d705['name'],_0x0f5b('0x43'),_0x18d705[_0x0f5b('0x44')]);delete this[_0x0f5b('0x15')][_0x1d687e[_0x0f5b('0x91')]];};Preview[_0x0f5b('0xf')][_0x0f5b('0x82')]=function(_0x183316,_0x22066d,_0x38d694){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x183316,_0x22066d,_0x38d694)[_0x0f5b('0x4e')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0x0f5b('0xf')][_0x0f5b('0x8f')]=function(_0x18231f,_0x12e46b,_0x61e49c){return cmHopperAdditionalPhone[_0x0f5b('0x8f')](_0x18231f,_0x12e46b,_0x61e49c)['catch'](logger[_0x0f5b('0x8c')](_0x0f5b('0xe7')));};Preview[_0x0f5b('0xf')][_0x0f5b('0x8e')]=function(_0x554082){return Promise['resolve']()[_0x0f5b('0x59')](cmHopperAdditionalPhone[_0x0f5b('0x8e')](_0x554082))[_0x0f5b('0x4e')](logger['info'](_0x0f5b('0xe8')));};Preview['prototype'][_0x0f5b('0xe9')]=function(_0x314820,_0x3a1397,_0x1318e5,_0x369839,_0x2bc625){var _0x49e85c=this;return new Promise(function(_0x453096,_0x30cc83){if(_[_0x0f5b('0x3f')](_0x3a1397)||_[_0x0f5b('0x3f')](_0x3a1397['Contact'])||_[_0x0f5b('0x3f')](_0x3a1397['phone'])||_[_0x0f5b('0x3f')](_0x3a1397[_0x0f5b('0x4a')])){_0x30cc83(ut['message'](_0x0f5b('0xea'),_0x369839,_0x2bc625));return;}var _0x5a1879=uuid['v4']();var _0x11cddc=_0x49e85c[_0x0f5b('0x14')][_0x3a1397[_0x0f5b('0x41')]['name']];var _0x40132c=_0x1318e5?_0x49e85c['agents'][_0x1318e5]['id']:undefined;_0x49e85c[_0x0f5b('0x15')][_0x5a1879]=new Action(_0x3a1397,_0x11cddc,_0x5a1879,_0x1318e5,_0x40132c);var _0xa018ea=_0x49e85c[_0x0f5b('0x15')][_0x5a1879];_0xa018ea[_0x0f5b('0x8a')]=_0x369839;_0xa018ea[_0x0f5b('0xae')]=_0x2bc625;_0xa018ea[_0x0f5b('0xeb')]=_0x1318e5;if(_[_0x0f5b('0xec')](_0x314820)){_0x49e85c[_0x0f5b('0xed')](_0xa018ea,_0x11cddc,_0x3a1397,_0x1318e5)['then'](function(_0x3e76bb){logger['info'](_0x0f5b('0xee'),_0x0f5b('0xef')+_0xa018ea['queue']+'\x20IdHopper:\x20'+_0xa018ea[_0x0f5b('0x8d')],JSON['stringify'](_0x3e76bb));ami[_0x0f5b('0x24')](_0x0f5b('0xf0'),ut[_0x0f5b('0x7f')](_0xa018ea,_0x0f5b('0xf1'),_0x49e85c['campaignsPreview'][_0xa018ea[_0x0f5b('0x42')]]));_0x453096(ut[_0x0f5b('0x31')](_0x0f5b('0xf2')));})[_0x0f5b('0x4e')](function(_0x251f74){ut[_0x0f5b('0x33')](_0x0f5b('0xf3'),_0x251f74);_0x30cc83(ut[_0x0f5b('0x31')](_0x0f5b('0xf4'),_0x369839,_0x2bc625));});}else{_0x11cddc[_0x0f5b('0xf5')]+=0x1;ut[_0x0f5b('0xf6')](_0xa018ea);rpcDb[_0x0f5b('0xf7')](_0xa018ea,'[Blacklist][error]');delete _0x49e85c[_0x0f5b('0x15')][_0x5a1879];_0x30cc83(ut[_0x0f5b('0x31')](_0x0f5b('0xf8'),_0x369839,_0x2bc625));}});};Preview[_0x0f5b('0xf')]['isTrunkReachable']=function(_0x533d94){return!_[_0x0f5b('0x3f')](_0x533d94)&&!_[_0x0f5b('0x3f')](_0x533d94[_0x0f5b('0x29')])&&!_[_0x0f5b('0x3f')](_0x533d94[_0x0f5b('0xf9')])&&_0x533d94[_0x0f5b('0xf9')]&&!_[_0x0f5b('0x3f')](this[_0x0f5b('0xfa')][util[_0x0f5b('0x27')](_0x0f5b('0xfb'),_0x533d94[_0x0f5b('0x29')])])&&!_[_0x0f5b('0x3f')](this[_0x0f5b('0xfa')][util['format'](_0x0f5b('0xfb'),_0x533d94['name'])][_0x0f5b('0x4c')])&&(this[_0x0f5b('0xfa')][util[_0x0f5b('0x27')](_0x0f5b('0xfb'),_0x533d94['name'])]['status']===_0x0f5b('0xfc')||this[_0x0f5b('0xfa')][util[_0x0f5b('0x27')]('SIP/%s',_0x533d94['name'])][_0x0f5b('0x4c')]==='unmonitored');};Preview[_0x0f5b('0xf')][_0x0f5b('0x5f')]=function(_0x5a31bc,_0x3833fd){return this[_0x0f5b('0xfd')](_0x5a31bc,_0x3833fd)['then'](function(_0x4c44e){return _[_0x0f5b('0x48')](_0x4c44e,[_0x0f5b('0x31')]);})[_0x0f5b('0x4e')](function(_0x5ad745){if(_0x5ad745[_0x0f5b('0xfe')]){rpcDb[_0x0f5b('0xff')](_0x5a31bc);}if(_0x5ad745[_0x0f5b('0xf9')]){rpcDb[_0x0f5b('0x62')](_0x5a31bc);}throw _['pick'](_0x5ad745,[_0x0f5b('0x31')]);});};Preview[_0x0f5b('0xf')][_0x0f5b('0xfd')]=function(_0x1bf137,_0x32274e){var _0x5783da=this;var _0x3cf9b7,_0x1b5eeb;return rpcDb[_0x0f5b('0x100')](_0x1bf137)[_0x0f5b('0x59')](function(_0x225b4d){if(!_[_0x0f5b('0x3f')](_0x225b4d[0x0])){_0x1b5eeb=_0x225b4d[0x0]['recallme']?![]:!![];_0x3cf9b7=_0x225b4d[0x0][_0x0f5b('0x101')]?!![]:![];_0x3cf9b7=_0x32274e?!![]:_0x3cf9b7;}var _0x14aa7a=_0x5783da[_0x0f5b('0x102')](_0x225b4d);if(_0x14aa7a[_0x0f5b('0x103')]){rpcDb['checkIsBlackList'](_[_0x0f5b('0x48')](_0x225b4d[0x0],[_0x0f5b('0x4a'),'phone']))[_0x0f5b('0x59')](function(_0x5457fd){_0x5783da[_0x0f5b('0xe9')](_0x5457fd,_0x225b4d[0x0],_0x32274e,_0x1b5eeb,_0x3cf9b7)[_0x0f5b('0x59')](function(_0x55ec12){return _0x55ec12;})[_0x0f5b('0x4e')](function(_0x3bc86f){throw _0x3bc86f;});})[_0x0f5b('0x4e')](function(_0x2156d0){ut[_0x0f5b('0x33')]('[Preview][checkIsBlackList]',_0x2156d0);throw ut[_0x0f5b('0x31')]('Call\x20unsuccessful',_0x1b5eeb,_0x3cf9b7);});}else{throw ut['message'](_0x14aa7a[_0x0f5b('0x31')],_0x1b5eeb,_0x3cf9b7);}})['catch'](function(_0x43f505){ut['logger']('[Preview][getContactPreview]',_0x43f505);throw ut[_0x0f5b('0x31')](_0x0f5b('0x104'),![],!![]);});};Preview['prototype']['validateContact']=function(_0x59d519){if(_[_0x0f5b('0x3f')](_0x59d519)||_[_0x0f5b('0xec')](_0x59d519)||!_[_0x0f5b('0x3f')](_0x59d519[0x0][_0x0f5b('0x5d')])&&_[_0x0f5b('0x3f')](_0x59d519[0x0][_0x0f5b('0x5d')]['name'])){ut[_0x0f5b('0x33')](_0x0f5b('0x105'),_0x59d519);return{'isValid':![],'message':_0x0f5b('0x106')};}var _0x8a2986=this[_0x0f5b('0x14')][_0x59d519[0x0][_0x0f5b('0x41')][_0x0f5b('0x29')]];_0x8a2986['message']=utils[_0x0f5b('0x2e')][_0x0f5b('0x78')];if(_[_0x0f5b('0x3f')](_0x8a2986)){ut[_0x0f5b('0x33')](_0x0f5b('0x107'),_0x8a2986);return{'isValid':![],'message':_0x0f5b('0x108')};}if(!this[_0x0f5b('0x74')](_0x8a2986[_0x0f5b('0x75')])){ut[_0x0f5b('0x33')](_0x0f5b('0x109'),'campaign\x20Name:\x20'+_0x8a2986[_0x0f5b('0x29')]+_0x0f5b('0x10a'));if(!this[_0x0f5b('0x74')](_0x8a2986[_0x0f5b('0x76')])){ut[_0x0f5b('0x33')](_0x0f5b('0x109'),_0x8a2986['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x0f5b('0x10b')};}}if(!ut[_0x0f5b('0x73')](_0x8a2986[_0x0f5b('0x10c')])){ut[_0x0f5b('0x33')](_0x0f5b('0x10d'),_0x8a2986[_0x0f5b('0x29')]+_0x0f5b('0x10e'));return{'isValid':![],'message':_0x0f5b('0x10f')+_0x8a2986[_0x0f5b('0x29')]+_0x0f5b('0x10e')};}return{'isValid':!![],'message':_0x0f5b('0x110')};};Preview[_0x0f5b('0xf')]['execCall']=function(_0x5644c3,_0x5084cb,_0xbf5772,_0x64239f){var _0x4ce7b2=this;return new Promise(function(_0x1ce2fc,_0x4de243){var _0x111723=_0x5644c3['uniqueid'];var _0x5631a5=_0x4ce7b2[_0x0f5b('0x74')](_0x5084cb['Trunk'])?util[_0x0f5b('0x27')](_0x0f5b('0x111'),_0x5084cb[_0x0f5b('0x75')][_0x0f5b('0x29')],_[_0x0f5b('0x3f')](_0x5084cb[_0x0f5b('0x112')])?'':_0x5084cb[_0x0f5b('0x112')][_0x0f5b('0x113')]()||'',_0x5084cb[_0x0f5b('0x114')]>0x0?_0xbf5772[_0x0f5b('0x115')][_0x0f5b('0x116')](_0x5084cb[_0x0f5b('0x114')]):_0xbf5772[_0x0f5b('0x115')]):util[_0x0f5b('0x27')](_0x0f5b('0x111'),_[_0x0f5b('0x3f')](_0x5084cb[_0x0f5b('0x76')])?_0x5084cb[_0x0f5b('0x75')][_0x0f5b('0x29')]:_0x5084cb[_0x0f5b('0x76')][_0x0f5b('0x29')],_[_0x0f5b('0x3f')](_0x5084cb[_0x0f5b('0x112')])?'':_0x5084cb[_0x0f5b('0x112')]['trim']()||'',_0x5084cb['dialCutDigit']>0x0?_0xbf5772[_0x0f5b('0x115')][_0x0f5b('0x116')](_0x5084cb['dialCutDigit']):_0xbf5772[_0x0f5b('0x115')]);var _0x316acc=_0x4ce7b2[_0x0f5b('0x74')](_0x5084cb[_0x0f5b('0x75')])?ut[_0x0f5b('0x117')](_0x5084cb[_0x0f5b('0x75')][_0x0f5b('0x118')],_0x5084cb[_0x0f5b('0x119')],_0x5084cb['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0f5b('0x11a')](_0x5084cb[_0x0f5b('0x11b')],_0x5084cb['dialRandomLastDigitCallerIdNumber']):_0x5084cb[_0x0f5b('0x11b')]):ut[_0x0f5b('0x117')](_[_0x0f5b('0x3f')](_0x5084cb[_0x0f5b('0x76')])?_0x5084cb[_0x0f5b('0x75')]['callerid']:_0x5084cb[_0x0f5b('0x76')][_0x0f5b('0x118')],_0x5084cb[_0x0f5b('0x119')],_0x5084cb['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0f5b('0x11a')](_0x5084cb[_0x0f5b('0x11b')],_0x5084cb['dialRandomLastDigitCallerIdNumber']):_0x5084cb['dialOriginateCallerIdNumber']);if(_0x316acc){_0x5644c3['originatecalleridname']=ut['extractCalleridName'](_0x316acc);_0x5644c3[_0x0f5b('0x11c')]=ut['extractCalleridNumber'](_0x316acc);}var _0x1cf94f=ut[_0x0f5b('0x11d')](_0x5084cb,_0xbf5772,_0x5631a5,_0x316acc,_0x111723,_0x5644c3);var _0x1372fc=utils[_0x0f5b('0x11e')](_0xbf5772['Contact']);Object[_0x0f5b('0x11f')](_0x1cf94f,_0x1372fc);_[_0x0f5b('0x120')](_0x5644c3,ut[_0x0f5b('0x121')](_0x1cf94f));_0x5644c3[_0x0f5b('0x63')]=moment()[_0x0f5b('0x27')](_0x0f5b('0x64'));_0x5084cb[_0x0f5b('0x122')]=_0x1cf94f;var _0x487076=ut['variablesAction'](_0x5644c3,_0x5084cb,_0x1cf94f,_0x5644c3[_0x0f5b('0xae')],_0x64239f);return ami[_0x0f5b('0x4b')](_0x487076)[_0x0f5b('0x59')](function(_0x5be262){_0x5084cb['originated']+=0x1;logger['info'](_0x0f5b('0x123'),_0x111723,_0x0f5b('0xa4'),_0x5084cb[_0x0f5b('0x29')],_0x0f5b('0x43'),_0x5084cb[_0x0f5b('0x44')]);_0x1ce2fc(_0x5be262);})[_0x0f5b('0x4e')](function(_0x41f0cf){ut['logAgent'](_0x5644c3,0xe,_0x0f5b('0x124'));rpcDb[_0x0f5b('0xe0')](_0x5644c3,'[originateFailure][logOriginateFailure]');_0x4de243(_0x41f0cf);});});};Preview['prototype'][_0x0f5b('0x125')]=function(_0x169953){if(this[_0x0f5b('0x15')][_0x169953[_0x0f5b('0x8b')]]){this[_0x0f5b('0x15')][_0x169953['linkedid']]['channel']=_0x169953[_0x0f5b('0x4d')];}};Preview[_0x0f5b('0xf')]['syncOriginateResponse']=function(_0xf35a32){var _0x8ebfb4=this;var _0x3a648e=this[_0x0f5b('0x15')][_0xf35a32[_0x0f5b('0x126')]];if(_0x3a648e){if(_0x3a648e[_0x0f5b('0xeb')]&&this[_0x0f5b('0x16')][_0x3a648e['lookAgent']]){ut[_0x0f5b('0x127')](_0x3a648e,this[_0x0f5b('0x16')][_0x3a648e[_0x0f5b('0xeb')]][_0x0f5b('0x29')],this[_0x0f5b('0x16')][_0x3a648e[_0x0f5b('0xeb')]]['id']);}var _0x1db4be=_[_0x0f5b('0x128')](_0x3a648e);_0x1db4be[_0x0f5b('0x129')]=moment()['format'](_0x0f5b('0x64'));var _0x4c2247=_0x8ebfb4[_0x0f5b('0x14')][_0x3a648e[_0x0f5b('0x42')]];if(ut[_0x0f5b('0x12a')](_0xf35a32[_0x0f5b('0x12b')])){if(_0x3a648e[_0x0f5b('0x8a')]){rpcDb[_0x0f5b('0xff')](_0x3a648e[_0x0f5b('0x8d')]);}if(_0x3a648e[_0x0f5b('0xae')]){rpcDb[_0x0f5b('0x62')](_0x3a648e[_0x0f5b('0x8d')]);}ami[_0x0f5b('0x24')](_0x0f5b('0x12c'),ut[_0x0f5b('0x7f')](_0x3a648e,_0x0f5b('0x12d'),this[_0x0f5b('0x14')][_0x3a648e[_0x0f5b('0x42')]]));this['callProgressDetectingAgent'](_0x1db4be,_0x4c2247,_0xf35a32);}else{_0x3a648e[_0x0f5b('0x63')]=moment()[_0x0f5b('0x27')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x1db4be,0x4,_0x0f5b('0x9e'));rpcDb[_0x0f5b('0xe0')](_0x1db4be,_0x0f5b('0x12e'));}}};Preview[_0x0f5b('0xf')][_0x0f5b('0x1a')]=function(_0x150c23){var _0x2dcd1b=this[_0x0f5b('0x15')][_0x150c23[_0x0f5b('0x8b')]];var _0x561866;if(_0x2dcd1b){_0x561866=this[_0x0f5b('0x14')][_0x2dcd1b[_0x0f5b('0x42')]];logger[_0x0f5b('0x8c')](_0x0f5b('0x12f'),_0x150c23[_0x0f5b('0x8b')],_0x0f5b('0xa4'),_0x561866[_0x0f5b('0x29')],_0x0f5b('0x45'),_0x561866[_0x0f5b('0x46')]);}if(this[_0x0f5b('0x15')][_0x150c23[_0x0f5b('0x8b')]]&&_0x150c23[_0x0f5b('0x8b')]!==_0x150c23[_0x0f5b('0x91')]){if(_0x150c23[_0x0f5b('0x130')]==='16'&&this['actions'][_0x150c23[_0x0f5b('0x8b')]][_0x0f5b('0x47')]){this['callProgressDetectingCustomer'](_0x150c23,_0x150c23[_0x0f5b('0x8b')],_0x150c23[_0x0f5b('0x130')]);}else if(this[_0x0f5b('0x15')][_0x150c23[_0x0f5b('0x8b')]][_0x0f5b('0x47')]){logger[_0x0f5b('0x8c')](_0x0f5b('0x131'),_0x150c23['linkedid'],_0x150c23[_0x0f5b('0x130')],'\x20Queue',_0x561866['name'],_0x0f5b('0x45'),_0x561866[_0x0f5b('0x46')]);this[_0x0f5b('0x79')](_0x150c23,_0x150c23[_0x0f5b('0x8b')],_0x150c23[_0x0f5b('0x130')]);}}else if(_0x2dcd1b&&_[_0x0f5b('0x3f')](_0x2dcd1b['statedesc'])&&_0x561866[_0x0f5b('0x132')]&&_0x150c23[_0x0f5b('0x8b')]===_0x150c23[_0x0f5b('0x91')]&&_['isNil'](_0x150c23['reason'])&&_0x150c23[_0x0f5b('0x130')]==='16'&&_0x150c23[_0x0f5b('0x133')]==='6'&&_[_0x0f5b('0xdc')](_0x2dcd1b['transfer'])){if(_0x2dcd1b['unlockAgent']){rpcDb[_0x0f5b('0xff')](_0x2dcd1b[_0x0f5b('0x8d')]);}if(_0x2dcd1b[_0x0f5b('0xae')]){rpcDb['disableContact'](_0x2dcd1b[_0x0f5b('0x8d')]);}_0x150c23[_0x0f5b('0xde')]='22';this[_0x0f5b('0xdb')](_0x2dcd1b,_0x561866,_0x150c23);}else if(_0x2dcd1b&&_0x2dcd1b[_0x0f5b('0x134')]){if(_0x150c23['cause']==='16'&&this[_0x0f5b('0x15')][_0x150c23[_0x0f5b('0x8b')]][_0x0f5b('0x47')]){logger[_0x0f5b('0x8c')](_0x0f5b('0x135'),_0x150c23[_0x0f5b('0x8b')],_0x150c23[_0x0f5b('0x130')],_0x0f5b('0xa4'),_0x561866[_0x0f5b('0x29')],'pTalking:\x20',_0x561866[_0x0f5b('0x46')]);this['callProgressDetectingCustomer'](_0x150c23,_0x150c23[_0x0f5b('0x8b')],_0x150c23['cause']);}else if(this[_0x0f5b('0x15')][_0x150c23['linkedid']][_0x0f5b('0x47')]){logger[_0x0f5b('0x8c')](_0x0f5b('0x131'),_0x150c23[_0x0f5b('0x8b')],_0x150c23[_0x0f5b('0x130')],_0x0f5b('0xa4'),_0x561866[_0x0f5b('0x29')],_0x0f5b('0x45'),_0x561866[_0x0f5b('0x46')]);this['callProgressDetectingCustomer'](_0x150c23,_0x150c23[_0x0f5b('0x8b')],_0x150c23[_0x0f5b('0x130')]);}}};Preview['prototype']['syncDialEnd']=function(_0x704f99){if(this[_0x0f5b('0x15')][_0x704f99['destlinkedid']]&&_0x704f99[_0x0f5b('0xd9')]!==_0x704f99['destuniqueid']){this[_0x0f5b('0x79')](_0x704f99,_0x704f99[_0x0f5b('0xd9')],_0x704f99[_0x0f5b('0xcf')]);}};Preview[_0x0f5b('0xf')][_0x0f5b('0x1b')]=function(_0x3842a8){if(this[_0x0f5b('0x15')][_0x3842a8[_0x0f5b('0x8b')]]&&_0x3842a8['linkedid']!==_0x3842a8['uniqueid']&&!this[_0x0f5b('0x15')][_0x3842a8[_0x0f5b('0x8b')]]['dialAnswer']){if(_0x3842a8[_0x0f5b('0x130')]==='1'){this[_0x0f5b('0x79')](_0x3842a8,_0x3842a8[_0x0f5b('0x8b')],_0x3842a8[_0x0f5b('0x130')]);}}};Preview[_0x0f5b('0xf')][_0x0f5b('0x136')]=function(_0x577e9f,_0x4777cd,_0x16d87e){if(this[_0x0f5b('0x15')][_0x577e9f]){if(_[_0x0f5b('0x3f')](this[_0x0f5b('0x15')][_0x577e9f][_0x0f5b('0x122')])){this['actions'][_0x577e9f][_0x0f5b('0x122')]={};}this[_0x0f5b('0x15')][_0x577e9f][_0x0f5b('0x122')][_0x4777cd]=_0x16d87e;}};Preview[_0x0f5b('0xf')][_0x0f5b('0x20')]=function(_0xf6fe38){try{if(!_['isNil'](_0xf6fe38)){if(ut[_0x0f5b('0x137')](_[_0x0f5b('0x138')](_0xf6fe38[_0x0f5b('0x139')])[0x0])){this[_0x0f5b('0x136')](_0xf6fe38[_0x0f5b('0x91')],_[_0x0f5b('0x138')](_0xf6fe38[_0x0f5b('0x139')])[0x0],_0xf6fe38[_0x0f5b('0x13a')]);}}}catch(_0x1c7405){logger['error']('[syncVarSet][Preview]',util[_0x0f5b('0x13b')](_0x1c7405,{'showHidden':![],'depth':null}));}};Preview[_0x0f5b('0xf')][_0x0f5b('0x21')]=function(_0x2beeb0){if(_0x2beeb0){if(this['actions'][_0x2beeb0[_0x0f5b('0x13c')]]){this[_0x0f5b('0x15')][_0x2beeb0[_0x0f5b('0x13c')]][_0x0f5b('0x134')]=!![];}}};Preview['prototype'][_0x0f5b('0x22')]=function(_0x4ac87f){if(_0x4ac87f){if(this['actions'][_0x4ac87f[_0x0f5b('0x13d')]]){this[_0x0f5b('0x15')][_0x4ac87f['transfererlinkedid']]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 8c15ed5..c78db62 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 _0xf050=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','[createHistory]\x20','resolve','then','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','membername','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0xf050,0xce));var _0x0f05=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0xf050[_0x15ec4e];return _0xb5e5dd;};'use strict';var util=require(_0x0f05('0x0'));var BPromise=require(_0x0f05('0x1'));var logger=require('../../../config/logger')(_0x0f05('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x0f05('0x3'));var voiceQueueReport=require(_0x0f05('0x4'));function loggerCatch(_0x3aa1f7){return function(_0x2f3c52){logger[_0x0f05('0x5')](_0x3aa1f7,util[_0x0f05('0x6')](_0x2f3c52,{'showHidden':![],'depth':null}));};}function create(_0x38a0c2){return cmHopperHistory['createHistory'](_0x38a0c2)['catch'](loggerCatch(_0x0f05('0x7')));}function createAgent(_0x2cabe7){return BPromise[_0x0f05('0x8')]()[_0x0f05('0x9')](agentReportPreview[_0x0f05('0xa')](_0x2cabe7))[_0x0f05('0xb')](loggerCatch(_0x0f05('0x7')));}function moveContact(_0x4b5d42){return cmHopper[_0x0f05('0xc')](_0x4b5d42,!![])['catch'](loggerCatch(_0x0f05('0xd')));}exports[_0x0f05('0xe')]=function(_0x225b5f){return cmHopperBlack['checkIsBlackList'](_0x225b5f)[_0x0f05('0xb')](loggerCatch(_0x0f05('0xf')));};exports[_0x0f05('0x10')]=function(_0x2c1974){return BPromise[_0x0f05('0x8')]()[_0x0f05('0x9')](cmHopper[_0x0f05('0x10')](_0x2c1974))[_0x0f05('0xb')](loggerCatch('[getContactPreview]\x20'));};exports[_0x0f05('0xa')]=function(_0x4b766b,_0x4f234d){create(_0x4b766b)[_0x0f05('0xb')](loggerCatch(_0x4f234d));moveContact(_0x4b766b)[_0x0f05('0xb')](loggerCatch(_0x4f234d));};exports[_0x0f05('0x11')]=function(_0x3a06c9,_0x375900){createAgent(_0x3a06c9)[_0x0f05('0xb')](loggerCatch(_0x375900));};exports[_0x0f05('0x12')]=function(_0x553220,_0xf3b1a7){create(_0x553220)['catch'](loggerCatch(_0xf3b1a7));};exports['createCustomerFinal']=function(_0x3ac6e7,_0x5b3633){moveContact(_0x3ac6e7)[_0x0f05('0xb')](loggerCatch(_0x5b3633));};exports[_0x0f05('0x13')]=function(_0x559255,_0x37ca87,_0x5d2854){if(_0x37ca87){_0x559255[_0x0f05('0x14')]=null;}if(_0x5d2854){_0x559255[_0x0f05('0x15')]=![];}return cmHopper['rescheduleContact'](_0x559255)[_0x0f05('0xb')](loggerCatch(_0x0f05('0x16')));};exports[_0x0f05('0x17')]=function(_0x5c1ac3){return cmHopper[_0x0f05('0x17')](_0x5c1ac3)[_0x0f05('0xb')](loggerCatch(_0x0f05('0x18')));};exports[_0x0f05('0x19')]=function(_0x1fb96c){return cmHopper['unlockContact']({'UserId':null},_0x1fb96c,0x1)[_0x0f05('0xb')](loggerCatch(_0x0f05('0x1a')));};exports[_0x0f05('0x1b')]=function(_0x5bdacb){return cmHopper[_0x0f05('0x19')]({'active':![]},_0x5bdacb,0x1)['catch'](loggerCatch(_0x0f05('0x1c')));};exports[_0x0f05('0x1d')]=function(_0x4f905c){var _0x3bb979={};_0x3bb979[_0x0f05('0x1e')]=_0x4f905c[_0x0f05('0x1e')];_0x3bb979['uniqueid']=_0x4f905c['uniqueid'];_0x3bb979['calleridnum']=_0x4f905c[_0x0f05('0x1f')];_0x3bb979[_0x0f05('0x20')]=_0x4f905c[_0x0f05('0x20')];_0x3bb979[_0x0f05('0x21')]=_0x4f905c[_0x0f05('0x21')];_0x3bb979[_0x0f05('0x22')]=_0x4f905c[_0x0f05('0x23')];_0x3bb979['queuecallerleaveAt']=_0x4f905c[_0x0f05('0x23')];_0x3bb979[_0x0f05('0x24')]=0x1;_0x3bb979[_0x0f05('0x25')]=_0x4f905c['endtime'];_0x3bb979[_0x0f05('0x26')]=_0x4f905c['membername'];_0x3bb979[_0x0f05('0x27')]=_0x0f05('0x28');_0x3bb979['exten']=_0x0f05('0x29');_0x3bb979['holdtime']=0x0;_0x3bb979[_0x0f05('0x2a')]=0x1;_0x3bb979[_0x0f05('0x2b')]=_0x4f905c[_0x0f05('0x2c')];_0x3bb979['queuecallerexitreason']=_0x0f05('0x2d');return BPromise[_0x0f05('0x8')]()[_0x0f05('0x9')](voiceQueueReport['create'](_0x3bb979))[_0x0f05('0xb')](loggerCatch(_0x0f05('0x2e')));};exports['getContactRecallMe']=function(_0x3950da,_0x22be1b){return BPromise[_0x0f05('0x8')]()[_0x0f05('0x9')](cmHopper[_0x0f05('0x2f')](_0x3950da,_0x22be1b))[_0x0f05('0xb')](loggerCatch(_0x0f05('0x30')));};exports[_0x0f05('0x31')]=function(_0x422877){return cmHopper[_0x0f05('0x13')](_0x422877,!![],!![])['catch'](loggerCatch(_0x0f05('0x32')));}; \ No newline at end of file +var _0x7049=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type'];(function(_0x5a6ab3,_0x272a11){var _0x3712e6=function(_0x86c00){while(--_0x86c00){_0x5a6ab3['push'](_0x5a6ab3['shift']());}};_0x3712e6(++_0x272a11);}(_0x7049,0x7a));var _0x9704=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7049[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x9704('0x0'));var BPromise=require(_0x9704('0x1'));var logger=require('../../../config/logger')(_0x9704('0x2'));var cmHopper=require(_0x9704('0x3'));var cmHopperHistory=require(_0x9704('0x4'));var cmHopperBlack=require(_0x9704('0x5'));var agentReportPreview=require(_0x9704('0x6'));var voiceQueueReport=require(_0x9704('0x7'));function loggerCatch(_0xab147f){return function(_0x4894ae){logger['error'](_0xab147f,util[_0x9704('0x8')](_0x4894ae,{'showHidden':![],'depth':null}));};}function create(_0x2f1e52){return cmHopperHistory[_0x9704('0x9')](_0x2f1e52)[_0x9704('0xa')](loggerCatch(_0x9704('0xb')));}function createAgent(_0x48b5d2){return BPromise[_0x9704('0xc')]()[_0x9704('0xd')](agentReportPreview[_0x9704('0x9')](_0x48b5d2))[_0x9704('0xa')](loggerCatch(_0x9704('0xb')));}function moveContact(_0x591251){return cmHopper[_0x9704('0xe')](_0x591251,!![])[_0x9704('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x9704('0xf')]=function(_0x4fd2f3){return cmHopperBlack[_0x9704('0xf')](_0x4fd2f3)[_0x9704('0xa')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x9f73e8){return BPromise['resolve']()[_0x9704('0xd')](cmHopper['getContactPreview'](_0x9f73e8))[_0x9704('0xa')](loggerCatch('[getContactPreview]\x20'));};exports[_0x9704('0x9')]=function(_0x43a883,_0x50f0e4){create(_0x43a883)[_0x9704('0xa')](loggerCatch(_0x50f0e4));moveContact(_0x43a883)['catch'](loggerCatch(_0x50f0e4));};exports[_0x9704('0x10')]=function(_0x48ab38,_0x5eaf82){createAgent(_0x48ab38)[_0x9704('0xa')](loggerCatch(_0x5eaf82));};exports['createCustomerHistory']=function(_0x379803,_0x39fd00){create(_0x379803)['catch'](loggerCatch(_0x39fd00));};exports[_0x9704('0x11')]=function(_0x38b4d9,_0x556c4d){moveContact(_0x38b4d9)['catch'](loggerCatch(_0x556c4d));};exports[_0x9704('0x12')]=function(_0x203be2,_0x4cb328,_0x29a69f){if(_0x4cb328){_0x203be2[_0x9704('0x13')]=null;}if(_0x29a69f){_0x203be2[_0x9704('0x14')]=![];}return cmHopper[_0x9704('0x12')](_0x203be2)['catch'](loggerCatch(_0x9704('0x15')));};exports[_0x9704('0x16')]=function(_0x4e37e0){return cmHopper['countReScheduled'](_0x4e37e0)[_0x9704('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0x9704('0x17')]=function(_0x1f4880){return cmHopper[_0x9704('0x17')]({'UserId':null},_0x1f4880,0x1)[_0x9704('0xa')](loggerCatch(_0x9704('0x18')));};exports[_0x9704('0x19')]=function(_0x42cd2c){return cmHopper[_0x9704('0x17')]({'active':![]},_0x42cd2c,0x1)[_0x9704('0xa')](loggerCatch(_0x9704('0x1a')));};exports['crateCustomerReportQueue']=function(_0x5c5ae7){var _0x40ae2f={};_0x40ae2f[_0x9704('0x1b')]=_0x5c5ae7[_0x9704('0x1b')];_0x40ae2f[_0x9704('0x1c')]=_0x5c5ae7['uniqueid'];_0x40ae2f[_0x9704('0x1d')]=_0x5c5ae7[_0x9704('0x1d')];_0x40ae2f['calleridname']=_0x5c5ae7[_0x9704('0x1e')];_0x40ae2f[_0x9704('0x1f')]=_0x5c5ae7[_0x9704('0x1f')];_0x40ae2f[_0x9704('0x20')]=_0x5c5ae7['answertime'];_0x40ae2f[_0x9704('0x21')]=_0x5c5ae7[_0x9704('0x22')];_0x40ae2f['queuecallercomplete']=0x1;_0x40ae2f['queuecallercompleteAt']=_0x5c5ae7[_0x9704('0x23')];_0x40ae2f[_0x9704('0x24')]=_0x5c5ae7[_0x9704('0x25')];_0x40ae2f[_0x9704('0x26')]='from-sip';_0x40ae2f[_0x9704('0x27')]=_0x9704('0x28');_0x40ae2f[_0x9704('0x29')]=0x0;_0x40ae2f[_0x9704('0x2a')]=0x1;_0x40ae2f[_0x9704('0x2b')]=_0x5c5ae7[_0x9704('0x25')];_0x40ae2f[_0x9704('0x2c')]='COMPLETED';return BPromise['resolve']()[_0x9704('0xd')](voiceQueueReport[_0x9704('0x2d')](_0x40ae2f))[_0x9704('0xa')](loggerCatch(_0x9704('0x2e')));};exports['getContactRecallMe']=function(_0x5eb8ab,_0xcbc363){return BPromise['resolve']()[_0x9704('0xd')](cmHopper[_0x9704('0x2f')](_0x5eb8ab,_0xcbc363))[_0x9704('0xa')](loggerCatch(_0x9704('0x30')));};exports[_0x9704('0x31')]=function(_0x4b2d35){return cmHopper[_0x9704('0x12')](_0x4b2d35,!![],!![])[_0x9704('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index ca4aab2..0f9c7e3 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 _0xda36=['U(xcally-mixmonitor-context)','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','logCustomer','getSeconds','talktime','answertime','isFailure','Failure','BOOKED','originate','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ListId','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','interface','channelAgent','voice','mandatoryDisposition','buildObj','agentReadyId','status','push','getDiff','milliseconds','diff','seconds','createBody','idContact','queue','type','campaigntype','dialAnswer','calleridname','active','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','inspect','logger','info','loggerError','error','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialQueueProject2'];(function(_0x4827f5,_0x5cc92c){var _0x54104d=function(_0x189039){while(--_0x189039){_0x4827f5['push'](_0x4827f5['shift']());}};_0x54104d(++_0x5cc92c);}(_0xda36,0xf6));var _0x6da3=function(_0x411982,_0x25ca2b){_0x411982=_0x411982-0x0;var _0x40c6f2=_0xda36[_0x411982];return _0x40c6f2;};'use strict';var util=require(_0x6da3('0x0'));var _=require(_0x6da3('0x1'));var moment=require(_0x6da3('0x2'));var logger=require(_0x6da3('0x3'))(_0x6da3('0x4'));var ipAgi=process[_0x6da3('0x5')][_0x6da3('0x6')]||_0x6da3('0x7');var utils=require(_0x6da3('0x8'));exports['loggerCatch']=function(_0x3c9349){return function(_0x486ac){logger['error'](_0x3c9349,util[_0x6da3('0x9')](_0x486ac,{'showHidden':![],'depth':null}));};};exports[_0x6da3('0xa')]=function(_0x4bfd3c,_0x33824f){logger[_0x6da3('0xb')](_0x4bfd3c,util['inspect'](_0x33824f,{'showHidden':![],'depth':null}));};exports[_0x6da3('0xc')]=function(_0x4560d4,_0x28c4db){logger[_0x6da3('0xd')](_0x4560d4,util[_0x6da3('0x9')](_0x28c4db,{'showHidden':![],'depth':null}));};exports[_0x6da3('0xe')]=function(_0x34a2c7){return function(_0x3a9208){logger[_0x6da3('0xb')](_0x34a2c7,util['inspect'](_0x3a9208,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x401c79,_0x106a9e,_0x5ce912){return{'message':_0x401c79,'unlock':_0x106a9e,'active':_0x5ce912};};exports[_0x6da3('0xf')]=function(_0x5e3543,_0x4c8774,_0x41a47c){if(!_[_0x6da3('0x10')](_0x41a47c)&&_0x6da3('0x11')===typeof _0x41a47c&&!_[_0x6da3('0x12')](_0x41a47c)){if(!_['isUndefined'](_0x4c8774)&&_0x6da3('0x11')===typeof _0x4c8774&&!_[_0x6da3('0x12')](_0x4c8774)){return util[_0x6da3('0x13')](_0x6da3('0x14'),_0x4c8774,_0x41a47c);}return util[_0x6da3('0x13')](_0x6da3('0x14'),_0x41a47c,_0x41a47c);}if(!_[_0x6da3('0x10')](_0x5e3543)&&_0x6da3('0x11')===typeof _0x5e3543&&!_[_0x6da3('0x12')](_0x5e3543)){return _0x5e3543;}return _0x6da3('0x15');};exports['isActive']=function(_0x42094a){if(_['isNil'](_0x42094a)){return![];}return _0x42094a;};exports[_0x6da3('0x16')]=function(_0x351610,_0x421be8,_0x2686b2,_0x3ac9b1,_0x23f57f,_0x23699d){var _0x510779={'XMD-QUEUE':_0x421be8['Queue']?_0x421be8[_0x6da3('0x17')][_0x6da3('0x18')]:'','XMD-CALLERID':_0x3ac9b1,'XMD-CALLERID-PREVIEW':_0x23699d?util['format'](_0x6da3('0x14'),_0x23699d['calleridname'],_0x23699d[_0x6da3('0x19')]):_0x3ac9b1,'XMD-DIALID':_0x23f57f,'XMD-CONTACTID':_0x421be8[_0x6da3('0x1a')],'XMD-CDRTYPE':_0x6da3('0x1b'),'CALLERID(all)':_0x3ac9b1,'XMD-VOICEQUEUEID':_0x421be8[_0x6da3('0x1c')],'XMD-DIALCHANNEL':_0x2686b2,'XMD-DIALTIMEOUT':_0x351610['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x6da3('0x13')]('\x22rtTxX%s%s\x22',_0x351610[_0x6da3('0x1d')]?'g':'',_['isEmpty'](_0x351610['monitor_format'])?'':_0x6da3('0x1e')),'XMD-DIALURL':_0x351610['dialPreviewUrl']||'','XMD-AGI':_0x351610[_0x6da3('0x1f')]?util[_0x6da3('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x351610['dialQueueProject']):_0x6da3('0x20'),'XMD-AGIAFTER':_0x351610[_0x6da3('0x1d')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x351610[_0x6da3('0x1d')]):_0x6da3('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x23699d?_0x23699d[_0x6da3('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x23699d?_0x23699d[_0x6da3('0x22')]:'','XMD-DESTINATION':_0x6da3('0x23'),'SIPADDHEADER':_0x6da3('0x24')};if(!_['isEmpty'](_0x351610[_0x6da3('0x25')])){_0x510779[util[_0x6da3('0x13')]('%s',_0x6da3('0x26'))]=_0x351610[_0x6da3('0x25')];_0x510779[util[_0x6da3('0x13')]('%s',_0x6da3('0x27'))]=_0x23f57f;}return _0x510779;};exports['toLowerVariables']=function(_0x1df1be){var _0x5d97d2={};for(var _0x3be7db in _0x1df1be){if(_0x1df1be[_0x6da3('0x28')](_0x3be7db)){_0x5d97d2[util[_0x6da3('0x13')]('%s',_['toLower'](_0x3be7db))]=_0x1df1be[_0x3be7db];}}return{'variables':_0x5d97d2};};exports[_0x6da3('0x29')]=function(_0x1657e3){var _0x34c4cb=moment()[_0x6da3('0x13')](_0x6da3('0x2a'));_0x1657e3[_0x6da3('0x2b')]=0xd;_0x1657e3[_0x6da3('0x2c')]=_0x6da3('0x2d');_0x1657e3[_0x6da3('0x2e')]=_0x34c4cb;_0x1657e3[_0x6da3('0x2f')]=_0x34c4cb;_0x1657e3[_0x6da3('0x30')]=_0x34c4cb;};exports[_0x6da3('0x31')]=function(_0x1ed981,_0x706a12,_0xb7be93){var _0x5b3b8f=moment()['format'](_0x6da3('0x2a'));_0x1ed981['state']=_0x706a12;_0x1ed981['statedesc']=_0xb7be93;_0x1ed981[_0x6da3('0x2f')]=_0x5b3b8f;_0x1ed981[_0x6da3('0x32')]=utils['getSeconds'](_0x1ed981[_0x6da3('0x2f')],_0x1ed981[_0x6da3('0x2e')]);};exports[_0x6da3('0x33')]=function(_0x23cd09,_0x406e9e,_0x49e4c5){_0x23cd09[_0x6da3('0x34')]=_0x406e9e;_0x23cd09['UserId']=_0x49e4c5;};exports[_0x6da3('0x35')]=function(_0x300761,_0x1b6817,_0x4651cb){var _0x471dee=moment()[_0x6da3('0x13')](_0x6da3('0x2a'));_0x300761[_0x6da3('0x2b')]=_0x1b6817;_0x300761['statedesc']=_0x4651cb;_0x300761['responsetime']=_0x300761['responsetime']?_0x300761[_0x6da3('0x2f')]:_0x471dee;_0x300761[_0x6da3('0x30')]=_0x300761[_0x6da3('0x30')]?_0x300761[_0x6da3('0x30')]:_0x471dee;_0x300761[_0x6da3('0x32')]=utils[_0x6da3('0x36')](_0x300761['responsetime']||0x0,_0x300761[_0x6da3('0x2e')]||0x0);_0x300761[_0x6da3('0x37')]=_0x300761[_0x6da3('0x38')]?utils[_0x6da3('0x36')](_0x300761[_0x6da3('0x30')],_0x300761[_0x6da3('0x38')]):0x0;};exports[_0x6da3('0x39')]=function(_0x368ffe){return _0x368ffe===_0x6da3('0x3a');};exports['variablesAction']=function(_0x2bed1c,_0x2acdd3,_0x195b14,_0x57609d,_0x2f8650){var _0x1635ec=_0x57609d?'RECALL':_0x2bed1c['calleridname'];_0x1635ec=_0x2f8650?_0x6da3('0x3b'):_0x1635ec;return{'actionid':_0x2bed1c['uniqueid'],'action':_0x6da3('0x3c'),'channel':_0x2bed1c['channelAgent'],'callerid':util[_0x6da3('0x13')](_0x6da3('0x14'),_0x1635ec,_0x2bed1c[_0x6da3('0x19')]),'Exten':'xcally-motion-preview','Context':_0x6da3('0x3d'),'Priority':'1','variable':_0x195b14,'timeout':(_0x2acdd3[_0x6da3('0x3e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2bed1c[_0x6da3('0x3f')]};};exports[_0x6da3('0x40')]=function(_0x257b1c){return _0x257b1c[_0x6da3('0x41')]+_0x257b1c['countcongestionretry']+_0x257b1c[_0x6da3('0x42')]+_0x257b1c[_0x6da3('0x43')]+_0x257b1c[_0x6da3('0x44')];};exports[_0x6da3('0x45')]=function(_0xaee359){var _0x13eea9=_['clone'](_0xaee359);_0x13eea9['state']=0xf;_0x13eea9[_0x6da3('0x2c')]=_0x6da3('0x46');return _0x13eea9;};exports[_0x6da3('0x47')]=function(_0x366938,_0x3e432b,_0x41b6d0){var _0x1d91b2={};_0x1d91b2[_0x3e432b]=_0x366938[_0x3e432b];_0x1d91b2['active']=![];_0x1d91b2[_0x6da3('0x48')]=moment()[_0x6da3('0x49')](_0x41b6d0,_0x6da3('0x4a'))['format'](_0x6da3('0x2a'));_0x1d91b2[_0x6da3('0x1a')]=_0x366938[_0x6da3('0x1a')];_0x1d91b2['ListId']=_0x366938[_0x6da3('0x4b')];_0x1d91b2[_0x6da3('0x1c')]=_0x366938['VoiceQueueId']||undefined;return _0x1d91b2;};exports['decrementTalking']=function(_0x4d493a,_0x53cc3d){if(!_['isNil'](_0x4d493a)){if(_0x4d493a['pTalking']>0x0){_0x4d493a[_0x6da3('0x4c')]-=0x1;}else{logger['info'](_0x53cc3d,_0x6da3('0x4d'));}}else{logger['error'](_0x53cc3d,_0x6da3('0x4e'));}};exports['IsNotLoggedIn']=function(_0x54a4a1){if(_0x54a4a1<=0x0){return!![];}return![];};function buildObj(_0x3dc42c,_0x2ba119,_0x4309ab){_0x3dc42c['lastevent']=_0x2ba119;_0x3dc42c[_0x6da3('0x18')]=_0x3dc42c['queue'];_0x3dc42c[_0x6da3('0x4f')]=_0x3dc42c[_0x6da3('0x50')];_0x3dc42c['motionChannel']=_0x6da3('0x51');if(_0x4309ab){_0x3dc42c[_0x6da3('0x52')]=_0x4309ab[_0x6da3('0x52')];}return _0x3dc42c;}exports[_0x6da3('0x53')]=buildObj;exports[_0x6da3('0x54')]=function(_0x5eb4a2){var _0x825f92=[];for(var _0x4888d1 in _0x5eb4a2){if(_0x5eb4a2[_0x6da3('0x28')](_0x4888d1)){if(!_['isNil'](_0x5eb4a2[_0x4888d1])&&_0x5eb4a2[_0x4888d1][_0x6da3('0x2b')]==='not_inuse'&&_0x5eb4a2[_0x4888d1][_0x6da3('0x55')]==='reachable'){_0x825f92[_0x6da3('0x56')](_0x5eb4a2[_0x4888d1]['id']);}}}return _0x825f92;};exports[_0x6da3('0x57')]=function(_0x21f849){var _0x49649f=moment()[_0x6da3('0x58')](0x0);var _0x328faf=moment(_0x21f849)[_0x6da3('0x58')](0x0);return _0x49649f[_0x6da3('0x59')](_0x328faf,_0x6da3('0x5a'));};exports[_0x6da3('0x5b')]=function(_0x504c9b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x504c9b['ContactId'],'ListId':_0x504c9b[_0x6da3('0x4b')],'VoiceQueueId':_0x504c9b[_0x6da3('0x1c')]||undefined,'CampaignId':_0x504c9b['CampaignId']||undefined};};exports['filterKey']=function(_0x1c435f){if(_0x1c435f===_0x6da3('0x3f')||_0x1c435f===_0x6da3('0x5c')||_0x1c435f===_0x6da3('0x5d')||_0x1c435f===_0x6da3('0x5e')||_0x1c435f===_0x6da3('0x5f')||_0x1c435f===_0x6da3('0x60')||_0x1c435f==='membername'||_0x1c435f===_0x6da3('0x50')||_0x1c435f===_0x6da3('0x61')||_0x1c435f===_0x6da3('0x62')||_0x1c435f===_0x6da3('0x19')||_0x1c435f===_0x6da3('0x48')||_0x1c435f===_0x6da3('0x41')||_0x1c435f===_0x6da3('0x63')||_0x1c435f===_0x6da3('0x42')||_0x1c435f===_0x6da3('0x64')||_0x1c435f===_0x6da3('0x65')||_0x1c435f===_0x6da3('0x66')||_0x1c435f===_0x6da3('0x67')||_0x1c435f===_0x6da3('0x68')||_0x1c435f===_0x6da3('0x1a')||_0x1c435f===_0x6da3('0x4b')||_0x1c435f===_0x6da3('0x69')||_0x1c435f===_0x6da3('0x1c')||_0x1c435f===_0x6da3('0x6a')||_0x1c435f===_0x6da3('0x6b')||_0x1c435f===_0x6da3('0x6c')||_0x1c435f===_0x6da3('0x6d')||_0x1c435f==='xmd-listid'||_0x1c435f===_0x6da3('0x6e')||_0x1c435f==='xmd-dialtimeout'||_0x1c435f===_0x6da3('0x6f')||_0x1c435f===_0x6da3('0x70')||_0x1c435f===_0x6da3('0x71')||_0x1c435f===_0x6da3('0x72')||_0x1c435f===_0x6da3('0x73')||_0x1c435f==='xmd-callerid'||_0x1c435f===_0x6da3('0x74')||_0x1c435f==='xmd-agi'||_0x1c435f===_0x6da3('0x75')||_0x1c435f===_0x6da3('0x76')||_0x1c435f===_0x6da3('0x77')||_0x1c435f===_0x6da3('0x78')||_0x1c435f===_0x6da3('0x79')||_0x1c435f===_0x6da3('0x7a')||_0x1c435f===_0x6da3('0x7b')||_0x1c435f===_0x6da3('0x7c')||_0x1c435f===_0x6da3('0x75')||_0x1c435f===_0x6da3('0x76')||_0x1c435f===_0x6da3('0x77')||_0x1c435f==='rtpaudioqosjitterbridged'||_0x1c435f===_0x6da3('0x79')||_0x1c435f==='rtpaudioqoslossbridged'||_0x1c435f===_0x6da3('0x7b')||_0x1c435f===_0x6da3('0x7c')||_0x1c435f===_0x6da3('0x7d')||_0x1c435f==='bridgepvtcallid'||_0x1c435f===_0x6da3('0x2b')||_0x1c435f===_0x6da3('0x2c')){return![];}return!![];};exports[_0x6da3('0x7e')]=function(_0x436489,_0xa8b8){var _0x2a41a1,_0x1349b2,_0x5c80f1;if(_0xa8b8<=0x0){_0xa8b8=0x1;}_0x2a41a1=new RegExp('\x5cw{0,'+_0xa8b8+'}$');_0x1349b2=Math[_0x6da3('0x7f')](0xa,_0xa8b8-0x1);_0x5c80f1=Math[_0x6da3('0x7f')](0xa,_0xa8b8)-0x1;return util[_0x6da3('0x13')]('%s',_[_0x6da3('0x80')](_0x436489,_0x2a41a1,_[_0x6da3('0x81')](_0x1349b2,_0x5c80f1)));};exports[_0x6da3('0x82')]=function(_0x3457f4){var _0x3471b5=_0x3457f4[_0x6da3('0x83')](/"(.*?)"/);return _0x3471b5?_0x3471b5[0x1]:_0x3457f4;};exports['extractCalleridNumber']=function(_0x2edd1a){var _0x4d0047=_0x2edd1a[_0x6da3('0x83')](/<(.*?)>/);return _0x4d0047?_0x4d0047[0x1]:_0x2edd1a;};function buildNoAnswerEventPayload(_0x52b721,_0x353b03){var _0x3fcf1f=buildObj(_0x52b721,_0x6da3('0x84'));if(!_['isEmpty'](_0x353b03[_0x6da3('0x85')])){Object[_0x6da3('0x86')](_0x353b03[_0x6da3('0x85')])[_0x6da3('0x87')](function(_0x487506){_0x3fcf1f[_0x487506[_0x6da3('0x88')]()]=_0x353b03['variables'][_0x487506];});}return _0x3fcf1f;}exports[_0x6da3('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x1532=['name','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','status','push','milliseconds','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','random','extractCalleridName','match','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','format','\x22%s\x22\x20<%s>','string','isEmpty','\x22\x22\x20<>','addVariables','Queue','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','channelAgent','from-sip','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalking','isNil','pTalking','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent'];(function(_0xf29d92,_0x3de2dd){var _0x38a257=function(_0x42afe2){while(--_0x42afe2){_0xf29d92['push'](_0xf29d92['shift']());}};_0x38a257(++_0x3de2dd);}(_0x1532,0x1d9));var _0x2153=function(_0x111ec6,_0x4d4b04){_0x111ec6=_0x111ec6-0x0;var _0x3215f2=_0x1532[_0x111ec6];return _0x3215f2;};'use strict';var util=require(_0x2153('0x0'));var _=require('lodash');var moment=require(_0x2153('0x1'));var logger=require(_0x2153('0x2'))('preview');var ipAgi=process[_0x2153('0x3')][_0x2153('0x4')]||_0x2153('0x5');var utils=require(_0x2153('0x6'));exports['loggerCatch']=function(_0x166f83){return function(_0x244120){logger[_0x2153('0x7')](_0x166f83,util[_0x2153('0x8')](_0x244120,{'showHidden':![],'depth':null}));};};exports[_0x2153('0x9')]=function(_0x3975cd,_0x1e15d9){logger[_0x2153('0xa')](_0x3975cd,util[_0x2153('0x8')](_0x1e15d9,{'showHidden':![],'depth':null}));};exports[_0x2153('0xb')]=function(_0x19b17c,_0xe35a32){logger[_0x2153('0x7')](_0x19b17c,util[_0x2153('0x8')](_0xe35a32,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x50408f){return function(_0x1fa3d8){logger['info'](_0x50408f,util['inspect'](_0x1fa3d8,{'showHidden':![],'depth':null}));};};exports[_0x2153('0xc')]=function(_0x3435b7,_0x9e7ae,_0x4217f2){return{'message':_0x3435b7,'unlock':_0x9e7ae,'active':_0x4217f2};};exports[_0x2153('0xd')]=function(_0x2383ac,_0x548c2b,_0x394b88){if(!_[_0x2153('0xe')](_0x394b88)&&'string'===typeof _0x394b88&&!_['isEmpty'](_0x394b88)){if(!_['isUndefined'](_0x548c2b)&&'string'===typeof _0x548c2b&&!_['isEmpty'](_0x548c2b)){return util[_0x2153('0xf')]('\x22%s\x22\x20<%s>',_0x548c2b,_0x394b88);}return util[_0x2153('0xf')](_0x2153('0x10'),_0x394b88,_0x394b88);}if(!_[_0x2153('0xe')](_0x2383ac)&&_0x2153('0x11')===typeof _0x2383ac&&!_[_0x2153('0x12')](_0x2383ac)){return _0x2383ac;}return _0x2153('0x13');};exports['isActive']=function(_0x52a1db){if(_['isNil'](_0x52a1db)){return![];}return _0x52a1db;};exports[_0x2153('0x14')]=function(_0x3537ce,_0x5b2342,_0x175cac,_0x43e598,_0x511893,_0x188af9){var _0x3a4ee3={'XMD-QUEUE':_0x5b2342['Queue']?_0x5b2342[_0x2153('0x15')]['name']:'','XMD-CALLERID':_0x43e598,'XMD-CALLERID-PREVIEW':_0x188af9?util[_0x2153('0xf')](_0x2153('0x10'),_0x188af9[_0x2153('0x16')],_0x188af9[_0x2153('0x17')]):_0x43e598,'XMD-DIALID':_0x511893,'XMD-CONTACTID':_0x5b2342[_0x2153('0x18')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x43e598,'XMD-VOICEQUEUEID':_0x5b2342['VoiceQueueId'],'XMD-DIALCHANNEL':_0x175cac,'XMD-DIALTIMEOUT':_0x3537ce[_0x2153('0x19')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x2153('0x1a'),_0x3537ce[_0x2153('0x1b')]?'g':'',_[_0x2153('0x12')](_0x3537ce['monitor_format'])?'':_0x2153('0x1c')),'XMD-DIALURL':_0x3537ce[_0x2153('0x1d')]||'','XMD-AGI':_0x3537ce[_0x2153('0x1e')]?util[_0x2153('0xf')](_0x2153('0x1f'),ipAgi,_0x3537ce[_0x2153('0x1e')]):_0x2153('0x20'),'XMD-AGIAFTER':_0x3537ce[_0x2153('0x1b')]?util[_0x2153('0xf')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3537ce['dialQueueProject2']):_0x2153('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x188af9?_0x188af9['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x188af9?_0x188af9[_0x2153('0x21')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x2153('0x22')};if(!_[_0x2153('0x12')](_0x3537ce['monitor_format'])){_0x3a4ee3[util[_0x2153('0xf')]('%s',_0x2153('0x23'))]=_0x3537ce[_0x2153('0x24')];_0x3a4ee3[util[_0x2153('0xf')]('%s',_0x2153('0x25'))]=_0x511893;}return _0x3a4ee3;};exports[_0x2153('0x26')]=function(_0x5a4221){var _0x1adb50={};for(var _0x39f303 in _0x5a4221){if(_0x5a4221['hasOwnProperty'](_0x39f303)){_0x1adb50[util['format']('%s',_['toLower'](_0x39f303))]=_0x5a4221[_0x39f303];}}return{'variables':_0x1adb50};};exports['logBlacklist']=function(_0x37d2c6){var _0xe83330=moment()['format'](_0x2153('0x27'));_0x37d2c6[_0x2153('0x28')]=0xd;_0x37d2c6[_0x2153('0x29')]=_0x2153('0x2a');_0x37d2c6[_0x2153('0x2b')]=_0xe83330;_0x37d2c6[_0x2153('0x2c')]=_0xe83330;_0x37d2c6[_0x2153('0x2d')]=_0xe83330;};exports[_0x2153('0x2e')]=function(_0x5dbb8c,_0x5b253c,_0x32bbc2){var _0x4614ef=moment()['format'](_0x2153('0x27'));_0x5dbb8c[_0x2153('0x28')]=_0x5b253c;_0x5dbb8c[_0x2153('0x29')]=_0x32bbc2;_0x5dbb8c['responsetime']=_0x4614ef;_0x5dbb8c[_0x2153('0x2f')]=utils[_0x2153('0x30')](_0x5dbb8c[_0x2153('0x2c')],_0x5dbb8c['starttime']);};exports[_0x2153('0x31')]=function(_0x4867c9,_0x34fc7c,_0x4136fe){_0x4867c9[_0x2153('0x32')]=_0x34fc7c;_0x4867c9[_0x2153('0x33')]=_0x4136fe;};exports[_0x2153('0x34')]=function(_0x6d518a,_0x4f56a1,_0x59c500){var _0x53aa36=moment()[_0x2153('0xf')](_0x2153('0x27'));_0x6d518a[_0x2153('0x28')]=_0x4f56a1;_0x6d518a['statedesc']=_0x59c500;_0x6d518a[_0x2153('0x2c')]=_0x6d518a[_0x2153('0x2c')]?_0x6d518a[_0x2153('0x2c')]:_0x53aa36;_0x6d518a[_0x2153('0x2d')]=_0x6d518a[_0x2153('0x2d')]?_0x6d518a[_0x2153('0x2d')]:_0x53aa36;_0x6d518a['ringtime']=utils[_0x2153('0x30')](_0x6d518a[_0x2153('0x2c')]||0x0,_0x6d518a[_0x2153('0x2b')]||0x0);_0x6d518a[_0x2153('0x35')]=_0x6d518a['answertime']?utils[_0x2153('0x30')](_0x6d518a[_0x2153('0x2d')],_0x6d518a[_0x2153('0x36')]):0x0;};exports[_0x2153('0x37')]=function(_0x1e603e){return _0x1e603e===_0x2153('0x38');};exports[_0x2153('0x39')]=function(_0x28bcda,_0x2aca60,_0x335574,_0x1dac2d,_0x1cc218){var _0x5390f4=_0x1dac2d?_0x2153('0x3a'):_0x28bcda[_0x2153('0x16')];_0x5390f4=_0x1cc218?_0x2153('0x3b'):_0x5390f4;return{'actionid':_0x28bcda['uniqueid'],'action':'originate','channel':_0x28bcda[_0x2153('0x3c')],'callerid':util['format'](_0x2153('0x10'),_0x5390f4,_0x28bcda[_0x2153('0x17')]),'Exten':'xcally-motion-preview','Context':_0x2153('0x3d'),'Priority':'1','variable':_0x335574,'timeout':(_0x2aca60['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x28bcda[_0x2153('0x3e')]};};exports[_0x2153('0x3f')]=function(_0xcadad2){return _0xcadad2[_0x2153('0x40')]+_0xcadad2[_0x2153('0x41')]+_0xcadad2[_0x2153('0x42')]+_0xcadad2['countagentrejectretry']+_0xcadad2[_0x2153('0x43')];};exports[_0x2153('0x44')]=function(_0x3bc824){var _0x1c8c88=_[_0x2153('0x45')](_0x3bc824);_0x1c8c88['state']=0xf;_0x1c8c88[_0x2153('0x29')]='Global';return _0x1c8c88;};exports[_0x2153('0x46')]=function(_0x2963db,_0x2c9a4a,_0x1b23b9){var _0x596ca8={};_0x596ca8[_0x2c9a4a]=_0x2963db[_0x2c9a4a];_0x596ca8[_0x2153('0x47')]=![];_0x596ca8[_0x2153('0x48')]=moment()[_0x2153('0x49')](_0x1b23b9,_0x2153('0x4a'))[_0x2153('0xf')](_0x2153('0x27'));_0x596ca8[_0x2153('0x18')]=_0x2963db['ContactId'];_0x596ca8[_0x2153('0x4b')]=_0x2963db['ListId'];_0x596ca8[_0x2153('0x4c')]=_0x2963db[_0x2153('0x4c')]||undefined;return _0x596ca8;};exports[_0x2153('0x4d')]=function(_0x556015,_0x14d281){if(!_[_0x2153('0x4e')](_0x556015)){if(_0x556015[_0x2153('0x4f')]>0x0){_0x556015[_0x2153('0x4f')]-=0x1;}else{logger[_0x2153('0xa')](_0x14d281,'[decrementTalking]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x14d281,_0x2153('0x50'));}};exports[_0x2153('0x51')]=function(_0x2fe2e4){if(_0x2fe2e4<=0x0){return!![];}return![];};function buildObj(_0x405485,_0x27a9f5,_0xc471a7){_0x405485[_0x2153('0x52')]=_0x27a9f5;_0x405485[_0x2153('0x53')]=_0x405485[_0x2153('0x54')];_0x405485[_0x2153('0x55')]=_0x405485[_0x2153('0x3c')];_0x405485[_0x2153('0x56')]=_0x2153('0x57');if(_0xc471a7){_0x405485['mandatoryDisposition']=_0xc471a7[_0x2153('0x58')];}return _0x405485;}exports[_0x2153('0x59')]=buildObj;exports[_0x2153('0x5a')]=function(_0x19505a){var _0x32ab90=[];for(var _0x509ef5 in _0x19505a){if(_0x19505a[_0x2153('0x5b')](_0x509ef5)){if(!_['isNil'](_0x19505a[_0x509ef5])&&_0x19505a[_0x509ef5][_0x2153('0x28')]==='not_inuse'&&_0x19505a[_0x509ef5][_0x2153('0x5c')]==='reachable'){_0x32ab90[_0x2153('0x5d')](_0x19505a[_0x509ef5]['id']);}}}return _0x32ab90;};exports['getDiff']=function(_0x4302aa){var _0x30034e=moment()[_0x2153('0x5e')](0x0);var _0x375eb7=moment(_0x4302aa)['milliseconds'](0x0);return _0x30034e[_0x2153('0x5f')](_0x375eb7,'seconds');};exports[_0x2153('0x60')]=function(_0xa4f5a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xa4f5a[_0x2153('0x18')],'ListId':_0xa4f5a['ListId'],'VoiceQueueId':_0xa4f5a[_0x2153('0x4c')]||undefined,'CampaignId':_0xa4f5a[_0x2153('0x61')]||undefined};};exports[_0x2153('0x62')]=function(_0x4268f1){if(_0x4268f1===_0x2153('0x3e')||_0x4268f1===_0x2153('0x63')||_0x4268f1===_0x2153('0x54')||_0x4268f1===_0x2153('0x64')||_0x4268f1===_0x2153('0x65')||_0x4268f1===_0x2153('0x66')||_0x4268f1===_0x2153('0x32')||_0x4268f1===_0x2153('0x3c')||_0x4268f1==='calleridname'||_0x4268f1===_0x2153('0x47')||_0x4268f1===_0x2153('0x17')||_0x4268f1===_0x2153('0x48')||_0x4268f1==='countbusyretry'||_0x4268f1===_0x2153('0x41')||_0x4268f1===_0x2153('0x42')||_0x4268f1==='countglobal'||_0x4268f1==='callback'||_0x4268f1===_0x2153('0x67')||_0x4268f1===_0x2153('0x68')||_0x4268f1===_0x2153('0x69')||_0x4268f1===_0x2153('0x18')||_0x4268f1===_0x2153('0x4b')||_0x4268f1===_0x2153('0x33')||_0x4268f1===_0x2153('0x4c')||_0x4268f1===_0x2153('0x6a')||_0x4268f1===_0x2153('0x6b')||_0x4268f1===_0x2153('0x6c')||_0x4268f1===_0x2153('0x6d')||_0x4268f1===_0x2153('0x6e')||_0x4268f1===_0x2153('0x6f')||_0x4268f1===_0x2153('0x70')||_0x4268f1===_0x2153('0x71')||_0x4268f1==='xmd-dialid'||_0x4268f1===_0x2153('0x72')||_0x4268f1===_0x2153('0x73')||_0x4268f1===_0x2153('0x74')||_0x4268f1==='xmd-callerid'||_0x4268f1===_0x2153('0x75')||_0x4268f1===_0x2153('0x76')||_0x4268f1==='rtpaudioqos'||_0x4268f1===_0x2153('0x77')||_0x4268f1===_0x2153('0x78')||_0x4268f1===_0x2153('0x79')||_0x4268f1===_0x2153('0x7a')||_0x4268f1===_0x2153('0x7b')||_0x4268f1==='rtpaudioqosrtt'||_0x4268f1===_0x2153('0x7c')||_0x4268f1===_0x2153('0x7d')||_0x4268f1===_0x2153('0x77')||_0x4268f1===_0x2153('0x78')||_0x4268f1===_0x2153('0x79')||_0x4268f1===_0x2153('0x7a')||_0x4268f1===_0x2153('0x7b')||_0x4268f1===_0x2153('0x7e')||_0x4268f1===_0x2153('0x7c')||_0x4268f1===_0x2153('0x7f')||_0x4268f1===_0x2153('0x80')||_0x4268f1==='state'||_0x4268f1===_0x2153('0x29')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x1ce63b,_0x5d25e5){var _0x4de6bf,_0x47f6ac,_0x12e609;if(_0x5d25e5<=0x0){_0x5d25e5=0x1;}_0x4de6bf=new RegExp(_0x2153('0x81')+_0x5d25e5+'}$');_0x47f6ac=Math[_0x2153('0x82')](0xa,_0x5d25e5-0x1);_0x12e609=Math[_0x2153('0x82')](0xa,_0x5d25e5)-0x1;return util[_0x2153('0xf')]('%s',_['replace'](_0x1ce63b,_0x4de6bf,_[_0x2153('0x83')](_0x47f6ac,_0x12e609)));};exports[_0x2153('0x84')]=function(_0x1d4922){var _0x567f2d=_0x1d4922[_0x2153('0x85')](/"(.*?)"/);return _0x567f2d?_0x567f2d[0x1]:_0x1d4922;};exports['extractCalleridNumber']=function(_0x2b5e33){var _0x302396=_0x2b5e33[_0x2153('0x85')](/<(.*?)>/);return _0x302396?_0x302396[0x1]:_0x2b5e33;};function buildNoAnswerEventPayload(_0x511a97,_0x4ff12a){var _0x50e1f5=buildObj(_0x511a97,_0x2153('0x86'));if(!_[_0x2153('0x12')](_0x4ff12a[_0x2153('0x87')])){Object[_0x2153('0x88')](_0x4ff12a[_0x2153('0x87')])['forEach'](function(_0x5937de){_0x50e1f5[_0x5937de[_0x2153('0x89')]()]=_0x4ff12a[_0x2153('0x87')][_0x5937de];});}return _0x50e1f5;}exports[_0x2153('0x8a')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index dd2023a..593cfe1 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 _0xa7f8=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x10faae,_0x11b056){var _0x5ced46=function(_0x1f0a94){while(--_0x1f0a94){_0x10faae['push'](_0x10faae['shift']());}};_0x5ced46(++_0x11b056);}(_0xa7f8,0xcc));var _0x8a7f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa7f8[_0x5b644e];return _0x49c6bf;};'use strict';exports[_0x8a7f('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8a7f('0x1'),'required':!![]},'membername':{'type':_0x8a7f('0x1'),'required':!![]},'penalty':{'type':_0x8a7f('0x2'),'required':![]},'paused':{'type':_0x8a7f('0x3'),'required':![]}};exports[_0x8a7f('0x4')]={'queue':{'type':_0x8a7f('0x1'),'required':!![]},'interface':{'type':_0x8a7f('0x1'),'required':!![]}};exports[_0x8a7f('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x8a7f('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x8a7f('0x1'),'required':![]}};exports[_0x8a7f('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x8a7f('0x7')]={'uniqueid':{'type':_0x8a7f('0x1'),'required':!![]},'filename':{'type':_0x8a7f('0x1')},'format':{'type':_0x8a7f('0x1')},'mixmonitorid':{'type':_0x8a7f('0x1')}};exports[_0x8a7f('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x8a7f('0x9')]={'uniqueid':{'type':_0x8a7f('0x1'),'required':!![]},'exten':{'type':_0x8a7f('0x1'),'required':!![]},'context':{'type':_0x8a7f('0x1')}}; \ No newline at end of file +var _0x3d5f=['string','number','queueremove','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd'];(function(_0x142463,_0x29000f){var _0x13cd96=function(_0x11e05f){while(--_0x11e05f){_0x142463['push'](_0x142463['shift']());}};_0x13cd96(++_0x29000f);}(_0x3d5f,0x1df));var _0xf3d5=function(_0x3ed268,_0xf095de){_0x3ed268=_0x3ed268-0x0;var _0xb36a34=_0x3d5f[_0x3ed268];return _0xb36a34;};'use strict';exports[_0xf3d5('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xf3d5('0x1'),'required':!![]},'membername':{'type':_0xf3d5('0x1'),'required':!![]},'penalty':{'type':_0xf3d5('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xf3d5('0x3')]={'queue':{'type':_0xf3d5('0x1'),'required':!![]},'interface':{'type':_0xf3d5('0x1'),'required':!![]}};exports[_0xf3d5('0x4')]={'interface':{'type':_0xf3d5('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xf3d5('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xf3d5('0x1'),'required':![]}};exports[_0xf3d5('0x5')]={'uniqueid':{'type':_0xf3d5('0x1'),'required':!![]}};exports[_0xf3d5('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xf3d5('0x1')},'format':{'type':_0xf3d5('0x1')},'mixmonitorid':{'type':_0xf3d5('0x1')}};exports[_0xf3d5('0x7')]={'uniqueid':{'type':_0xf3d5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xf3d5('0x1'),'required':!![]},'context':{'type':_0xf3d5('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 0387b1b..b2f6b48 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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1d930e,_0x20d8b8){_0x1d930e=_0x1d930e-0x0;var _0x5bbd66=_0x0b0e[_0x1d930e];return _0x5bbd66;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x3150f9,_0xb687b7){var _0x229bc2=function(_0x41302e){while(--_0x41302e){_0x3150f9['push'](_0x3150f9['shift']());}};_0x229bc2(++_0xb687b7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x137ef8,_0x3384dc){_0x137ef8=_0x137ef8-0x0;var _0x3b7d28=_0x5f2f[_0x137ef8];return _0x3b7d28;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 3c82b96..baaa445 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 _0xee71=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x1f96d6,_0xf8b761){var _0x227e4c=function(_0x2f29cc){while(--_0x2f29cc){_0x1f96d6['push'](_0x1f96d6['shift']());}};_0x227e4c(++_0xf8b761);}(_0xee71,0x159));var _0x1ee7=function(_0x10c360,_0x355f1d){_0x10c360=_0x10c360-0x0;var _0x2105bb=_0xee71[_0x10c360];return _0x2105bb;};'use strict';function mergeDBDataToRealtime(_0x3b4631,_0x10c725){var _0x299ce9=Object[_0x1ee7('0x0')]({},_0x3b4631);for(var _0x2e1c01 in _0x10c725){if(_0x299ce9[_0x1ee7('0x1')](_0x2e1c01)){_0x299ce9[_0x2e1c01]=_0x10c725[_0x2e1c01];}}return _0x299ce9;}exports[_0x1ee7('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x6685=['mergeDBDataToRealtime','assign'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0x6685,0x143));var _0x5668=function(_0x3cc326,_0x5031f9){_0x3cc326=_0x3cc326-0x0;var _0x59a1af=_0x6685[_0x3cc326];return _0x59a1af;};'use strict';function mergeDBDataToRealtime(_0x412977,_0x5a5dc1){var _0x40d57a=Object[_0x5668('0x0')]({},_0x412977);for(var _0x14af84 in _0x5a5dc1){if(_0x40d57a['hasOwnProperty'](_0x14af84)){_0x40d57a[_0x14af84]=_0x5a5dc1[_0x14af84];}}return _0x40d57a;}exports[_0x5668('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index a7cea3d..305c49f 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 _0xfb98=['transfereelinkedid','uniqueid','UserId','split','membername','monitor','monitors','createdAt','connectedlinename','xcally-motion-dialer','isArray','startsWith','Local','substring','indexOf','lastIndexOf','transfererlinkedid','attendedTransfer','exports','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindTransfer','attendedtransfer','findAgent','name','isNil','find','accountcode','interface','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','calleridnum','destination','exten','type','dialer','queue','lastdata','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','disposition','calleridname','transfers','linkedid'];(function(_0x264e6e,_0x2a9086){var _0x9de09a=function(_0x4bf95f){while(--_0x4bf95f){_0x264e6e['push'](_0x264e6e['shift']());}};_0x9de09a(++_0x2a9086);}(_0xfb98,0x11b));var _0x8fb9=function(_0x11aebe,_0x2e0d96){_0x11aebe=_0x11aebe-0x0;var _0xecfb7f=_0xfb98[_0x11aebe];return _0xecfb7f;};'use strict';var _=require('lodash');var moment=require(_0x8fb9('0x0'));var util=require(_0x8fb9('0x1'));var config=require(_0x8fb9('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x8fb9('0x3'));var RpcVoiceCallReport=require(_0x8fb9('0x4'));var RpcVoiceDialReport=require(_0x8fb9('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x8fb9('0x6'));var RpcVoiceRecording=require(_0x8fb9('0x7'));var RpcVoiceTransferReport=require(_0x8fb9('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x8fb9('0x9'));var VoiceAgentReport=require(_0x8fb9('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x8fb9('0xb'));function Report(_0x6cff2a){this[_0x8fb9('0xc')]=_0x6cff2a;this[_0x8fb9('0xd')]=_0x6cff2a[_0x8fb9('0xd')];this['telephones']=_0x6cff2a[_0x8fb9('0xe')];}Report[_0x8fb9('0xf')][_0x8fb9('0x10')]=function(_0x2345a8){var _0x2a21ec=new VoiceQueueReport(this['realtime']);var _0x14b97b=new VoiceAgentReport(this[_0x8fb9('0xc')]);var _0x3c2c51=new VoiceDialReport(this[_0x8fb9('0xc')]);var _0x16b846=new VoiceCallReport(this[_0x8fb9('0xc')]);var _0x5d6103=new UserReport(this['realtime']);if(config[_0x8fb9('0x11')]&&config['xdr'][_0x8fb9('0x12')]){ami['on'](_0x8fb9('0x13'),this[_0x8fb9('0x14')][_0x8fb9('0x15')](this));ami['on'](_0x8fb9('0x16'),this[_0x8fb9('0x17')][_0x8fb9('0x15')](this));ami['on'](_0x8fb9('0x18'),this[_0x8fb9('0x19')][_0x8fb9('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x8fb9('0x1a')][_0x8fb9('0x15')](this));ami['on']('blindtransfer',this[_0x8fb9('0x1b')]['bind'](this));ami['on'](_0x8fb9('0x1c'),this['attendedTransfer'][_0x8fb9('0x15')](this));}};Report[_0x8fb9('0xf')][_0x8fb9('0x1d')]=function(_0x171c8f){var _0x1889ec;_0x1889ec=_['find'](this[_0x8fb9('0xd')],function(_0x26206f){return _0x26206f['accountcode']==_0x171c8f||_0x26206f[_0x8fb9('0x1e')]==_0x171c8f;});if(_[_0x8fb9('0x1f')](_0x1889ec)){var _0x20422f=_[_0x8fb9('0x20')](this['telephones'],function(_0x234487){return _0x234487[_0x8fb9('0x21')]==_0x171c8f||_0x234487[_0x8fb9('0x1e')]==_0x171c8f;});if(_0x20422f){_0x1889ec=_[_0x8fb9('0x20')](this['agents'],function(_0x57a380){return _0x57a380[_0x8fb9('0x22')]==util['format'](_0x8fb9('0x23'),_0x20422f[_0x8fb9('0x1e')]);});}}return _0x1889ec;};Report[_0x8fb9('0xf')][_0x8fb9('0x14')]=function(_0x3f93d2){for(var _0x41f6fc=0x0;_0x41f6fc<_0x3f93d2[_0x8fb9('0x24')];_0x41f6fc+=0x1){var _0x22b2f6=this['findAgent'](_0x3f93d2[_0x41f6fc][_0x8fb9('0x25')]);if(_0x22b2f6){_0x3f93d2[_0x41f6fc][_0x8fb9('0x21')]=_0x22b2f6[_0x8fb9('0x21')];_0x3f93d2[_0x41f6fc][_0x8fb9('0x26')]=!![];_0x3f93d2[_0x41f6fc][_0x8fb9('0x27')]=_0x22b2f6[_0x8fb9('0x1e')];_0x3f93d2[_0x41f6fc][_0x8fb9('0x22')]=_[_0x8fb9('0x1f')](_0x22b2f6[_0x8fb9('0x22')])?util[_0x8fb9('0x28')](_0x8fb9('0x23'),_0x22b2f6[_0x8fb9('0x1e')]):_0x22b2f6[_0x8fb9('0x22')];if(_0x3f93d2[_0x41f6fc][_0x8fb9('0x29')]){_0x3f93d2[_0x41f6fc][_0x8fb9('0x2a')]=moment()[_0x8fb9('0x28')](_0x8fb9('0x2b'));}if(_0x3f93d2[_0x41f6fc]['queuecallerexit']){_0x3f93d2[_0x41f6fc][_0x8fb9('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x8fb9('0x14')](_0x3f93d2[_0x41f6fc]);}RpcVoiceQueueReport[_0x8fb9('0x2d')](_0x3f93d2[_0x41f6fc]);}};function extractCalleridNumber(_0x4799df){var _0x4a179a=_0x4799df['match'](/<(.*?)>/);return _0x4a179a?_0x4a179a[0x1]:_0x4799df;}Report[_0x8fb9('0xf')][_0x8fb9('0x2e')]=function(_0x5930ea){for(var _0x2394f9=0x0;_0x2394f9',_0x42b4a7[_0x8fb9('0x42')],_0x42b4a7[_0x8fb9('0x31')]);}if(RpcVoiceTransferReport['transfers'][_0x42b4a7['linkedid']]){var _0x293e50=RpcVoiceTransferReport[_0x8fb9('0x43')][_0x42b4a7[_0x8fb9('0x44')]];_0x293e50[_0x8fb9('0x45')]=_0x42b4a7[_0x8fb9('0x46')];RpcVoiceTransferReport[_0x8fb9('0x1b')](_0x293e50);delete RpcVoiceTransferReport[_0x8fb9('0x43')][_0x42b4a7[_0x8fb9('0x44')]];}if(_[_0x8fb9('0x1f')](_0x42b4a7['type'])){_0x42b4a7[_0x8fb9('0x34')]=this[_0x8fb9('0x30')](_0x42b4a7);}if(_[_0x8fb9('0x1f')](_0x42b4a7[_0x8fb9('0x47')])){var _0x734fab=_0x42b4a7['channel'][_0x8fb9('0x48')]('-')[0x0];var _0x5c490f=this[_0x8fb9('0xd')][_0x734fab];if(!_0x5c490f)_0x5c490f=this[_0x8fb9('0x2e')](_0x42b4a7[_0x8fb9('0x21')]);if(_0x5c490f){_0x42b4a7['UserId']=_0x5c490f['id'];_0x42b4a7[_0x8fb9('0x49')]=_0x5c490f[_0x8fb9('0x1e')];}}RpcVoiceCallReport[_0x8fb9('0x2d')](_0x42b4a7);if(_0x42b4a7[_0x8fb9('0x4a')]){for(var _0x1d4629=0x0;_0x1d4629<_0x42b4a7[_0x8fb9('0x4b')][_0x8fb9('0x24')];_0x1d4629+=0x1){_0x42b4a7['monitorFilename']=_0x42b4a7['monitors'][_0x1d4629]['filename'];_0x42b4a7[_0x8fb9('0x4c')]=_0x42b4a7['monitors'][_0x1d4629]['createdAt'];if(_0x42b4a7['exten']==_0x8fb9('0x3c')){_0x42b4a7['calleridnum']=_0x42b4a7[_0x8fb9('0x25')];_0x42b4a7[_0x8fb9('0x42')]=_0x42b4a7[_0x8fb9('0x4d')];_0x42b4a7[_0x8fb9('0x25')]=_0x42b4a7[_0x8fb9('0x21')];_0x42b4a7[_0x8fb9('0x4d')]=_0x42b4a7[_0x8fb9('0x49')];_0x42b4a7[_0x8fb9('0x33')]=_0x42b4a7[_0x8fb9('0x3e')];}else if(_0x42b4a7[_0x8fb9('0x33')]==_0x8fb9('0x4e')){_0x42b4a7[_0x8fb9('0x31')]=_0x42b4a7[_0x8fb9('0x32')];_0x42b4a7[_0x8fb9('0x33')]=_0x42b4a7['originatecalleridnum'];}RpcVoiceRecording[_0x8fb9('0x2d')](_0x42b4a7);}}};Report[_0x8fb9('0xf')][_0x8fb9('0x19')]=function(_0x2828df){if(_[_0x8fb9('0x4f')](_0x2828df)){_0x2828df['forEach'](function(_0x2d6366){RpcVoiceAgentReport[_0x8fb9('0x2d')](_0x2d6366);});}else{RpcVoiceAgentReport[_0x8fb9('0x2d')](_0x2828df);}};Report[_0x8fb9('0xf')][_0x8fb9('0x1a')]=function(_0x1b85b9){RpcVoiceDialReport[_0x8fb9('0x2d')](_0x1b85b9);var _0x442b7b;var _0x4d9fb9;var _0x3726c9=_0x1b85b9['channel'];if(_[_0x8fb9('0x50')](_0x3726c9,_0x8fb9('0x51'))){_0x4d9fb9=_0x3726c9[_0x8fb9('0x52')](_0x3726c9[_0x8fb9('0x53')]('/')+0x1,_0x3726c9[_0x8fb9('0x53')]('@'));_0x442b7b=_['find'](this['agents'],function(_0x330a65){return _0x330a65['mobile']==_0x4d9fb9||_0x330a65['phone']==_0x4d9fb9||_0x330a65[_0x8fb9('0x21')]==_0x4d9fb9;});}else{_0x4d9fb9=_0x3726c9['substring'](_0x3726c9[_0x8fb9('0x53')]('/')+0x1,_0x3726c9[_0x8fb9('0x54')]('-'));_0x442b7b=this[_0x8fb9('0x1d')](_0x4d9fb9);}if(_0x442b7b){_0x1b85b9['interface']=_[_0x8fb9('0x1f')](_0x442b7b['interface'])?util[_0x8fb9('0x28')]('SIP/%s',_0x442b7b[_0x8fb9('0x1e')]):_0x442b7b[_0x8fb9('0x22')];_0x1b85b9[_0x8fb9('0x49')]=_0x442b7b['name'];_0x1b85b9['accountcode']=_0x442b7b[_0x8fb9('0x21')];RpcMemberReport[_0x8fb9('0x1a')](_0x1b85b9);}};Report['prototype'][_0x8fb9('0x1b')]=function(_0x38ecba){RpcVoiceTransferReport['transfers'][_0x38ecba[_0x8fb9('0x55')]]=_0x38ecba;};Report[_0x8fb9('0xf')][_0x8fb9('0x56')]=function(_0xd94fa6){RpcVoiceTransferReport[_0x8fb9('0x56')](_0xd94fa6);};module[_0x8fb9('0x57')]=Report; \ No newline at end of file +var _0x413f=['disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','accountcode','name','isNil','find','interface','format','SIP/%s','length','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','keys','getCallType','split','getAgentByInternal','calleridnum','outbound','internal','destination','exten','dialer','lastapplication','lastdata','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','UserId','membername','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinenum','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','findAgent','transfererlinkedid','attendedTransfer','exports','lodash','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr'];(function(_0xdf3db6,_0x2a1952){var _0x4b7a65=function(_0x2953be){while(--_0x2953be){_0xdf3db6['push'](_0xdf3db6['shift']());}};_0x4b7a65(++_0x2a1952);}(_0x413f,0xac));var _0xf413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x413f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf413('0x0'));var moment=require('moment');var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xf413('0x1'));var RpcVoiceCallReport=require(_0xf413('0x2'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xf413('0x3'));var RpcVoiceQueueReport=require(_0xf413('0x4'));var RpcVoiceRecording=require(_0xf413('0x5'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xf413('0x6'));var VoiceCallReport=require(_0xf413('0x7'));var VoiceAgentReport=require(_0xf413('0x8'));var VoiceDialReport=require(_0xf413('0x9'));var UserReport=require('./userReport');function Report(_0xce617){this['realtime']=_0xce617;this[_0xf413('0xa')]=_0xce617[_0xf413('0xa')];this[_0xf413('0xb')]=_0xce617[_0xf413('0xb')];}Report[_0xf413('0xc')][_0xf413('0xd')]=function(_0x33e7bc){var _0x329df9=new VoiceQueueReport(this[_0xf413('0xe')]);var _0x47e157=new VoiceAgentReport(this[_0xf413('0xe')]);var _0x19ac1f=new VoiceDialReport(this['realtime']);var _0x39ca60=new VoiceCallReport(this[_0xf413('0xe')]);var _0x2009ec=new UserReport(this[_0xf413('0xe')]);if(config[_0xf413('0xf')]&&config[_0xf413('0xf')][_0xf413('0x10')]){ami['on'](_0xf413('0x11'),this[_0xf413('0x12')][_0xf413('0x13')](this));ami['on'](_0xf413('0x14'),this[_0xf413('0x15')][_0xf413('0x13')](this));ami['on']('custom:voiceAgentReport',this[_0xf413('0x16')][_0xf413('0x13')](this));ami['on'](_0xf413('0x17'),this['voiceDialReport']['bind'](this));ami['on'](_0xf413('0x18'),this[_0xf413('0x19')][_0xf413('0x13')](this));ami['on'](_0xf413('0x1a'),this['attendedTransfer'][_0xf413('0x13')](this));}};Report[_0xf413('0xc')]['findAgent']=function(_0x42d2c2){var _0x418c0e;_0x418c0e=_['find'](this[_0xf413('0xa')],function(_0x54f7ce){return _0x54f7ce[_0xf413('0x1b')]==_0x42d2c2||_0x54f7ce[_0xf413('0x1c')]==_0x42d2c2;});if(_[_0xf413('0x1d')](_0x418c0e)){var _0xf05601=_[_0xf413('0x1e')](this[_0xf413('0xb')],function(_0x37fa40){return _0x37fa40[_0xf413('0x1b')]==_0x42d2c2||_0x37fa40[_0xf413('0x1c')]==_0x42d2c2;});if(_0xf05601){_0x418c0e=_[_0xf413('0x1e')](this[_0xf413('0xa')],function(_0x327245){return _0x327245[_0xf413('0x1f')]==util[_0xf413('0x20')](_0xf413('0x21'),_0xf05601[_0xf413('0x1c')]);});}}return _0x418c0e;};Report[_0xf413('0xc')]['voiceQueueReport']=function(_0x4891c9){for(var _0x2bfeaa=0x0;_0x2bfeaa<_0x4891c9[_0xf413('0x22')];_0x2bfeaa+=0x1){var _0x3df6f4=this['findAgent'](_0x4891c9[_0x2bfeaa]['connectedlinenum']);if(_0x3df6f4){_0x4891c9[_0x2bfeaa]['accountcode']=_0x3df6f4[_0xf413('0x1b')];_0x4891c9[_0x2bfeaa][_0xf413('0x23')]=!![];_0x4891c9[_0x2bfeaa][_0xf413('0x24')]=_0x3df6f4[_0xf413('0x1c')];_0x4891c9[_0x2bfeaa]['interface']=_[_0xf413('0x1d')](_0x3df6f4[_0xf413('0x1f')])?util[_0xf413('0x20')](_0xf413('0x21'),_0x3df6f4[_0xf413('0x1c')]):_0x3df6f4[_0xf413('0x1f')];if(_0x4891c9[_0x2bfeaa][_0xf413('0x25')]){_0x4891c9[_0x2bfeaa][_0xf413('0x26')]=moment()[_0xf413('0x20')](_0xf413('0x27'));}if(_0x4891c9[_0x2bfeaa][_0xf413('0x28')]){_0x4891c9[_0x2bfeaa][_0xf413('0x29')]=moment()[_0xf413('0x20')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xf413('0x12')](_0x4891c9[_0x2bfeaa]);}RpcVoiceQueueReport['create'](_0x4891c9[_0x2bfeaa]);}};function extractCalleridNumber(_0x245e13){var _0x15cb65=_0x245e13[_0xf413('0x2a')](/<(.*?)>/);return _0x15cb65?_0x15cb65[0x1]:_0x245e13;}Report[_0xf413('0xc')]['getAgentByInternal']=function(_0x111edd){for(var _0x18fe57=0x0;_0x18fe57{delete this['channels'][_0x525a8e];},_0x4bd742);}};module[_0xb75f('0x97')]=VoiceAgentReport; \ No newline at end of file +var _0x27d8=['[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','syncMusicOnHoldStart','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','channel','deleteChannelAfterTimeout','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','variables','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','agents','destuniqueid','queue','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','voice','assign','omit','privilege','debug','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','pick','destconnectedlinenum','interface','name','accountcode','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberrealtime','[%s][voiceAgentReport][hangup]\x20event:'];(function(_0x3a66fa,_0x399904){var _0x388cf9=function(_0x39be41){while(--_0x39be41){_0x3a66fa['push'](_0x3a66fa['shift']());}};_0x388cf9(++_0x399904);}(_0x27d8,0x13f));var _0x827d=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0x27d8[_0x285800];return _0x4b809e;};'use strict';var _=require(_0x827d('0x0'));var moment=require(_0x827d('0x1'));var util=require(_0x827d('0x2'));var Redis=require('ioredis');var config=require(_0x827d('0x3'));var logger=require(_0x827d('0x4'))(_0x827d('0x5'));var ami=require(_0x827d('0x6'));config[_0x827d('0x7')]=_[_0x827d('0x8')](config[_0x827d('0x7')],{'host':_0x827d('0x9'),'port':0x18eb});var io=require(_0x827d('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x5e8fcf){this[_0x827d('0xb')]={};this[_0x827d('0xc')]=_0x5e8fcf[_0x827d('0xb')];this[_0x827d('0xd')]=_0x5e8fcf[_0x827d('0xd')];this['agents']=_0x5e8fcf['agents'];this[_0x827d('0xe')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x827d('0xf')](this));ami['on'](_0x827d('0x10'),this[_0x827d('0x11')][_0x827d('0xf')](this));ami['on'](_0x827d('0x12'),this[_0x827d('0x13')][_0x827d('0xf')](this));ami['on'](_0x827d('0x14'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x827d('0x15'),this['syncAgentComplete'][_0x827d('0xf')](this));ami['on'](_0x827d('0x16'),this[_0x827d('0x17')][_0x827d('0xf')](this));ami['on'](_0x827d('0x18'),this[_0x827d('0x19')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x827d('0xf')](this));ami['on'](_0x827d('0x1a'),this[_0x827d('0x1b')]['bind'](this));ami['on'](_0x827d('0x1c'),this[_0x827d('0x1d')][_0x827d('0xf')](this));ami['on'](_0x827d('0x1e'),this[_0x827d('0x1f')][_0x827d('0xf')](this));}VoiceAgentReport[_0x827d('0x20')][_0x827d('0x21')]=function(_0x2cf01d,_0x1b2216,_0x2f05e9){io['to'](_0x2cf01d)['emit'](_0x1b2216,_0x2f05e9);};VoiceAgentReport[_0x827d('0x20')][_0x827d('0x22')]=function(_0x257916){return _0x257916!==null&&!_[_0x827d('0x23')](_0x257916);};VoiceAgentReport[_0x827d('0x20')]['syncAgentCalled']=function(_0x343922){try{if(this[_0x827d('0x22')](_0x343922)){logger[_0x827d('0x24')](_0x827d('0x25'),_0x343922[_0x827d('0x26')],_0x343922[_0x827d('0x27')],_0x343922['destuniqueid']);logger['debug'](_0x827d('0x28'),_0x343922['uniqueid'],util[_0x827d('0x29')](_0x343922,{'showHidden':![],'depth':null}));if(_[_0x827d('0x23')](this[_0x827d('0xb')][_0x343922[_0x827d('0x26')]])){this[_0x827d('0xb')][_0x343922['uniqueid']]={};}var _0x5f504c=this[_0x827d('0x2a')][_0x343922['interface']];var _0x39611c=this[_0x827d('0xb')][_0x343922[_0x827d('0x26')]][_0x343922[_0x827d('0x2b')]];var _0x2fbe28=this['voiceQueues'][_0x343922[_0x827d('0x2c')]];var _0x3b2012=this[_0x827d('0xe')][_0x343922[_0x827d('0x26')]];if(_[_0x827d('0x23')](_0x39611c)){_0x39611c={'agentcalledAt':moment()['format'](_0x827d('0x2d')),'lastevent':'called','mandatoryDisposition':_0x2fbe28&&_0x2fbe28[_0x827d('0x2e')]?_0x2fbe28['mandatoryDisposition']:![],'type':_0x2fbe28&&_0x2fbe28[_0x827d('0x2f')]?_0x2fbe28['type']:'inbound','variables':_0x3b2012,'motionChannel':_0x827d('0x30')};}Object[_0x827d('0x31')](_0x39611c,_[_0x827d('0x32')](_0x343922,['event',_0x827d('0x33')]));this[_0x827d('0xb')][_0x343922['uniqueid']][_0x343922[_0x827d('0x2b')]]=_0x39611c;logger[_0x827d('0x34')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x343922[_0x827d('0x26')],util['inspect'](_0x39611c,{'showHidden':![],'depth':null}));ami[_0x827d('0x21')](_0x827d('0x35'),_0x39611c);var _0x91ab6b={'id':_0x5f504c['id'],'calleridnum':_0x39611c[_0x827d('0x36')],'queue':_0x39611c['queue'],'variables':_0x39611c[_0x827d('0xe')],'uniqueid':_0x343922['uniqueid']};logger[_0x827d('0x34')](_0x827d('0x37'),_0x343922[_0x827d('0x26')],util[_0x827d('0x29')](_0x91ab6b,{'showHidden':![],'depth':null}));this['emit'](util[_0x827d('0x38')](_0x827d('0x39'),_0x343922[_0x827d('0x27')]),'user:called',_0x91ab6b);}}catch(_0x3ee386){logger[_0x827d('0x3a')](_0x827d('0x3b'),_0x343922[_0x827d('0x26')],util[_0x827d('0x29')](_0x3ee386,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')]['syncAgentConnect']=function(_0x12cec3){try{if(this[_0x827d('0x22')](_0x12cec3)){if(this[_0x827d('0xb')][_0x12cec3['uniqueid']]){for(var _0xb4c175 in this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]]){if(this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]]['hasOwnProperty'](_0xb4c175)){if(_0x12cec3[_0x827d('0x2b')]===_0xb4c175){logger[_0x827d('0x24')](_0x827d('0x3c'),_0x12cec3[_0x827d('0x26')],_0x12cec3[_0x827d('0x27')],_0x12cec3[_0x827d('0x2b')]);this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x3d')]=moment()[_0x827d('0x38')](_0x827d('0x2d'));this['channels'][_0x12cec3[_0x827d('0x26')]][_0xb4c175]['connectedlinename']=_0x12cec3[_0x827d('0x3e')];this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0xb4c175]['connectedlinenum']=_0x12cec3[_0x827d('0x3f')];this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x40')]=_0x12cec3[_0x827d('0x40')];this['channels'][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x41')]=_0x12cec3[_0x827d('0x41')];this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x42')]=_0x12cec3[_0x827d('0x42')];this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x43')]=_0x827d('0x44');_[_0x827d('0x45')](this['agents'][_0x12cec3['interface']],_[_0x827d('0x46')](_0x12cec3,['queue',_0x827d('0x47')]));var _0x661f13=this[_0x827d('0x2a')][_0x12cec3[_0x827d('0x48')]];var _0x41d7e8={'id':_0x661f13['id'],'name':_0x661f13[_0x827d('0x49')],'agentconnected':!![],'destaccountcode':_0x661f13[_0x827d('0x4a')],'destconnectedlinenum':this['channels'][_0x12cec3[_0x827d('0x26')]][_0x12cec3['destuniqueid']]['exten'],'queue':this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0x12cec3[_0x827d('0x2b')]][_0x827d('0x2c')],'uniqueid':this['channels'][_0x12cec3[_0x827d('0x26')]][_0x12cec3['destuniqueid']][_0x827d('0x26')]};ami[_0x827d('0x21')](_0x827d('0x4b'),this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0x12cec3[_0x827d('0x2b')]]);this['emit'](util[_0x827d('0x38')]('user:%s',_0x12cec3[_0x827d('0x27')]),_0x827d('0x4c'),_0x41d7e8);}else if(!this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0xb4c175]['agentringnoanswer']&&!this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x15')]){logger['info'](_0x827d('0x4d'),_0x12cec3[_0x827d('0x26')],this['channels'][_0x12cec3[_0x827d('0x26')]][_0xb4c175]['membername'],_0xb4c175);this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x12')]=!![];this['channels'][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x4e')]=moment()[_0x827d('0x38')](_0x827d('0x2d'));this[_0x827d('0xb')][_0x12cec3['uniqueid']][_0xb4c175][_0x827d('0x4f')]=_0x12cec3[_0x827d('0x2b')];this['channels'][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x50')]=_0x12cec3[_0x827d('0x27')];this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x43')]=_0x827d('0x51');this['channels'][_0x12cec3[_0x827d('0x26')]][_0xb4c175][_0x827d('0x52')]='answered_elsewhere';logger[_0x827d('0x34')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x12cec3[_0x827d('0x26')],util[_0x827d('0x29')](this['channels'][_0x12cec3['uniqueid']][_0xb4c175],{'showHidden':![],'depth':null}));ami[_0x827d('0x21')](_0x827d('0x53'),this[_0x827d('0xb')][_0x12cec3[_0x827d('0x26')]][_0xb4c175]);}else{logger[_0x827d('0x34')](_0x827d('0x54'),_0x12cec3[_0x827d('0x26')]);}}}}}}catch(_0x447acd){logger[_0x827d('0x3a')](_0x827d('0x55'),_0x12cec3[_0x827d('0x26')],util[_0x827d('0x29')](_0x447acd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')]['syncAgentRingNoAnswer']=function(_0x5d8b6a){try{if(this[_0x827d('0x22')](_0x5d8b6a)){logger[_0x827d('0x34')](_0x827d('0x56'),_0x5d8b6a[_0x827d('0x26')],util[_0x827d('0x29')](_0x5d8b6a,{'showHidden':![],'depth':null}));if(this['channels'][_0x5d8b6a[_0x827d('0x26')]]&&this[_0x827d('0xb')][_0x5d8b6a[_0x827d('0x26')]][_0x5d8b6a[_0x827d('0x2b')]]){logger['info'](_0x827d('0x57'),_0x5d8b6a[_0x827d('0x26')],_0x5d8b6a[_0x827d('0x27')],_0x5d8b6a[_0x827d('0x2b')]);var _0x4b6d49=this[_0x827d('0x2a')][_0x5d8b6a[_0x827d('0x48')]];var _0x472399=this[_0x827d('0xb')][_0x5d8b6a['uniqueid']][_0x5d8b6a['destuniqueid']];_0x472399['agentringnoanswer']=!![];_0x472399['agentringnoanswerAt']=moment()['format'](_0x827d('0x2d'));_0x472399[_0x827d('0x43')]=_0x827d('0x58');_0x472399['reason']=_0x827d('0x58');var _0x42b938={'id':_0x4b6d49['id'],'name':_0x4b6d49[_0x827d('0x49')],'queue':_0x472399[_0x827d('0x2c')],'uniqueid':_0x472399[_0x827d('0x26')]};logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5d8b6a[_0x827d('0x26')],util[_0x827d('0x29')](_0x42b938,{'showHidden':![],'depth':null}));this[_0x827d('0x21')](util[_0x827d('0x38')]('user:%s',_0x4b6d49[_0x827d('0x49')]),_0x827d('0x59'),_0x42b938);ami[_0x827d('0x21')](_0x827d('0x5a'),_0x472399);this[_0x827d('0xb')][_0x5d8b6a[_0x827d('0x26')]][_0x5d8b6a[_0x827d('0x2b')]]=Object[_0x827d('0x31')]({},_0x472399);}}}catch(_0x38bc2d){logger[_0x827d('0x3a')](_0x827d('0x5b'),_0x5d8b6a[_0x827d('0x26')],util['inspect'](_0x38bc2d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')][_0x827d('0x5c')]=function(_0x590b5d){try{if(this[_0x827d('0x22')](_0x590b5d)){logger[_0x827d('0x34')](_0x827d('0x5d'),_0x590b5d['uniqueid'],util[_0x827d('0x29')](_0x590b5d,{'showHidden':![],'depth':null}));if(this['channels'][_0x590b5d['uniqueid']]){for(var _0x3e013f in this[_0x827d('0xb')][_0x590b5d[_0x827d('0x26')]]){if(this[_0x827d('0xb')][_0x590b5d['uniqueid']][_0x827d('0x5e')](_0x3e013f)&&!this[_0x827d('0xb')][_0x590b5d[_0x827d('0x26')]][_0x3e013f][_0x827d('0x12')]&&!this[_0x827d('0xb')][_0x590b5d[_0x827d('0x26')]][_0x3e013f][_0x827d('0x15')]){logger['info'](_0x827d('0x5f'),_0x590b5d[_0x827d('0x26')],this[_0x827d('0xb')][_0x590b5d['uniqueid']][_0x3e013f][_0x827d('0x27')],_0x3e013f);this[_0x827d('0xb')][_0x590b5d[_0x827d('0x26')]][_0x3e013f][_0x827d('0x12')]=!![];this[_0x827d('0xb')][_0x590b5d['uniqueid']][_0x3e013f]['agentringnoanswerAt']=moment()['format'](_0x827d('0x2d'));this[_0x827d('0xb')][_0x590b5d[_0x827d('0x26')]][_0x3e013f][_0x827d('0x43')]=_0x827d('0x60');this['channels'][_0x590b5d['uniqueid']][_0x3e013f][_0x827d('0x52')]=_0x827d('0x60');logger[_0x827d('0x34')](_0x827d('0x61'),_0x590b5d[_0x827d('0x26')],util[_0x827d('0x29')](this[_0x827d('0xb')][_0x590b5d[_0x827d('0x26')]][_0x3e013f],{'showHidden':![],'depth':null}));ami[_0x827d('0x21')](_0x827d('0x62'),this[_0x827d('0xb')][_0x590b5d['uniqueid']][_0x3e013f]);}}}}}catch(_0x4288a0){logger[_0x827d('0x3a')](_0x827d('0x63'),_0x590b5d['uniqueid'],util[_0x827d('0x29')](_0x4288a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')][_0x827d('0x64')]=function(_0x523f73){try{if(this['isNotNull'](_0x523f73)){logger[_0x827d('0x34')](_0x827d('0x65'),_0x523f73[_0x827d('0x26')],util['inspect'](_0x523f73,{'showHidden':![],'depth':null}));if(this[_0x827d('0xb')][_0x523f73[_0x827d('0x26')]]){for(var _0x1e7b41 in this['channels'][_0x523f73['uniqueid']]){if(this[_0x827d('0xb')][_0x523f73['uniqueid']]['hasOwnProperty'](_0x1e7b41)){if(this[_0x827d('0xb')][_0x523f73['uniqueid']][_0x1e7b41]['agentconnectAt']&&!this[_0x827d('0xb')][_0x523f73['uniqueid']][_0x1e7b41][_0x827d('0x15')]){logger[_0x827d('0x24')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x523f73[_0x827d('0x26')],this[_0x827d('0xb')][_0x523f73['uniqueid']][_0x1e7b41][_0x827d('0x27')],_0x1e7b41);this['channels'][_0x523f73['uniqueid']][_0x1e7b41][_0x827d('0x15')]=!![];this[_0x827d('0xb')][_0x523f73[_0x827d('0x26')]][_0x1e7b41][_0x827d('0x66')]=moment()[_0x827d('0x38')](_0x827d('0x2d'));this[_0x827d('0xb')][_0x523f73['uniqueid']][_0x1e7b41][_0x827d('0x43')]=_0x827d('0x67');this[_0x827d('0xb')][_0x523f73[_0x827d('0x26')]][_0x1e7b41][_0x827d('0x52')]=_0x523f73[_0x827d('0x52')]==_0x827d('0x68')?_0x827d('0x69'):_0x523f73[_0x827d('0x52')];this[_0x827d('0xb')][_0x523f73['uniqueid']][_0x1e7b41][_0x827d('0x6a')]=_0x523f73[_0x827d('0x6a')];if(this[_0x827d('0xd')][_0x523f73[_0x827d('0x2c')]]&&this[_0x827d('0xd')][_0x523f73[_0x827d('0x2c')]][_0x827d('0x6b')]){this['channels'][_0x523f73[_0x827d('0x26')]][_0x1e7b41][_0x827d('0x6c')]=this['voiceQueues'][_0x523f73[_0x827d('0x2c')]]['acwTimeout'];this[_0x827d('0xb')][_0x523f73['uniqueid']][_0x1e7b41][_0x827d('0x6d')]=!![];}this[_0x827d('0x2a')][_0x523f73[_0x827d('0x48')]]=_['omit'](this[_0x827d('0x2a')][_0x523f73[_0x827d('0x48')]],[_0x827d('0x2c'),_0x827d('0x47')]);logger['debug'](_0x827d('0x6e'),_0x523f73[_0x827d('0x26')],util[_0x827d('0x29')](this[_0x827d('0xb')][_0x523f73['uniqueid']][_0x1e7b41],{'showHidden':![],'depth':null}));ami[_0x827d('0x21')](_0x827d('0x6f'),this[_0x827d('0xb')][_0x523f73[_0x827d('0x26')]][_0x1e7b41]);logger[_0x827d('0x34')](_0x827d('0x70'),_0x523f73[_0x827d('0x26')],util['inspect']({'id':this['agents'][_0x523f73[_0x827d('0x48')]]['id'],'destaccountcode':_0x523f73[_0x827d('0x71')]},{'showHidden':![],'depth':null}));this[_0x827d('0x21')](util['format'](_0x827d('0x39'),_0x523f73['membername']),_0x827d('0x72'),{'id':this[_0x827d('0x2a')][_0x523f73[_0x827d('0x48')]]['id'],'destaccountcode':Number(_0x523f73[_0x827d('0x71')])});}}}}}}catch(_0x2309aa){logger['error'](_0x827d('0x73'),_0x523f73[_0x827d('0x26')],util[_0x827d('0x29')](_0x2309aa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')]['syncVarSet']=function(_0x3f4c61){try{if(this[_0x827d('0x22')](_0x3f4c61)){logger[_0x827d('0x34')](_0x827d('0x74'),_0x3f4c61[_0x827d('0x26')],util[_0x827d('0x29')](_0x3f4c61,{'showHidden':![],'depth':null}));this[_0x827d('0x75')](_0x3f4c61['uniqueid'],_[_0x827d('0x76')](_0x3f4c61[_0x827d('0x77')])[0x0],_0x3f4c61['value']);if(this[_0x827d('0xb')][_0x3f4c61[_0x827d('0x26')]]){for(var _0x242bdd in this[_0x827d('0xb')][_0x3f4c61[_0x827d('0x26')]]){if(this[_0x827d('0xb')][_0x3f4c61[_0x827d('0x26')]][_0x827d('0x5e')](_0x242bdd)){logger[_0x827d('0x24')](_0x827d('0x78'),_0x3f4c61['uniqueid'],_0x242bdd,_[_0x827d('0x76')](_0x3f4c61[_0x827d('0x77')])[0x0],_0x3f4c61['value']);if(_[_0x827d('0x23')](this[_0x827d('0xb')][_0x3f4c61[_0x827d('0x26')]][_0x242bdd]['variables'])){this[_0x827d('0xb')][_0x3f4c61[_0x827d('0x26')]][_0x242bdd]['variables']={};}this[_0x827d('0xb')][_0x3f4c61['uniqueid']][_0x242bdd][_0x827d('0xe')]=this['variables'][_0x3f4c61[_0x827d('0x26')]];}}}}}catch(_0x388c56){logger[_0x827d('0x3a')](_0x827d('0x79'),_0x3f4c61[_0x827d('0x26')],util['inspect'](_0x388c56,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')]['addVariable']=function(_0x2ff55a,_0x1198e3,_0x2a0fd1){var _0x34f80e=[_0x827d('0x7a'),_0x827d('0x7b'),_0x827d('0x7c'),_0x827d('0x7d'),_0x827d('0x7e'),'rtpaudioqoslossbridged',_0x827d('0x7f'),_0x827d('0x80'),_0x827d('0x81'),'sipuri',_0x827d('0x82'),_0x827d('0x83'),'membercalls','memberdynamic','memberinterface','memberlastcall',_0x827d('0x27'),'memberpenalty',_0x827d('0x84')];if(!_['isNil'](_0x1198e3)&&!_['includes'](_0x34f80e,_0x1198e3)){if(_[_0x827d('0x23')](this['variables'][_0x2ff55a])){this['variables'][_0x2ff55a]={};}this[_0x827d('0xe')][_0x2ff55a][_0x1198e3]=_0x2a0fd1;}};VoiceAgentReport[_0x827d('0x20')][_0x827d('0x19')]=function(_0x196fdd){try{if(this[_0x827d('0x22')](_0x196fdd)){logger['debug'](_0x827d('0x85'),_0x196fdd[_0x827d('0x26')],util[_0x827d('0x29')](_0x196fdd,{'showHidden':![],'depth':null}));if(this[_0x827d('0xb')][_0x196fdd['uniqueid']]){for(var _0x4de6a5 in this[_0x827d('0xb')][_0x196fdd[_0x827d('0x26')]]){if(this['channels'][_0x196fdd['uniqueid']][_0x827d('0x5e')](_0x4de6a5)){if(this['channels'][_0x196fdd[_0x827d('0x26')]][_0x4de6a5][_0x827d('0x52')]==_0x827d('0x68')&&this[_0x827d('0xb')][_0x196fdd[_0x827d('0x26')]][_0x4de6a5][_0x827d('0x15')]){logger[_0x827d('0x24')](_0x827d('0x86'),_0x196fdd[_0x827d('0x26')],_0x4de6a5);this[_0x827d('0xb')][_0x196fdd[_0x827d('0x26')]][_0x4de6a5][_0x827d('0x66')]=moment()[_0x827d('0x38')](_0x827d('0x2d'));}}}logger[_0x827d('0x34')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x196fdd['uniqueid'],util['inspect'](_['values'](this['channels'][_0x196fdd[_0x827d('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x827d('0x21')](_0x827d('0x87'),_['values'](this[_0x827d('0xb')][_0x196fdd[_0x827d('0x26')]]));this['deleteChannelAfterTimeout'](_0x196fdd[_0x827d('0x26')]);}if(this[_0x827d('0xe')][_0x196fdd['uniqueid']]){delete this[_0x827d('0xe')][_0x196fdd[_0x827d('0x26')]];}}}catch(_0x360c92){logger['error'](_0x827d('0x88'),_0x196fdd[_0x827d('0x26')],util[_0x827d('0x29')](_0x360c92,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')][_0x827d('0x1d')]=function(_0x586e19){try{if(this['isNotNull'](_0x586e19)){logger[_0x827d('0x34')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x586e19[_0x827d('0x26')],util[_0x827d('0x29')](_0x586e19,{'showHidden':![],'depth':null}));if(this['channels'][_0x586e19['transfereeuniqueid']]){for(var _0x3cfee8 in this[_0x827d('0xb')][_0x586e19[_0x827d('0x89')]]){if(this[_0x827d('0xb')][_0x586e19[_0x827d('0x89')]][_0x827d('0x5e')](_0x3cfee8)){if(_0x586e19[_0x827d('0x8a')]===_0x3cfee8){logger[_0x827d('0x24')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x586e19[_0x827d('0x26')],this[_0x827d('0xb')][_0x586e19[_0x827d('0x89')]][_0x3cfee8][_0x827d('0x27')],_0x3cfee8);var _0x59667c=moment();this[_0x827d('0xb')][_0x586e19[_0x827d('0x89')]][_0x3cfee8]['agentcomplete']=!![];this['channels'][_0x586e19['transfereeuniqueid']][_0x3cfee8][_0x827d('0x66')]=moment()['format'](_0x827d('0x2d'));this[_0x827d('0xb')][_0x586e19['transfereeuniqueid']][_0x3cfee8][_0x827d('0x43')]=_0x827d('0x67');this[_0x827d('0xb')][_0x586e19[_0x827d('0x89')]][_0x3cfee8][_0x827d('0x52')]=_0x827d('0x68');this['channels'][_0x586e19[_0x827d('0x89')]][_0x3cfee8]['talktime']=_0x59667c[_0x827d('0x8b')](this[_0x827d('0xb')][_0x586e19[_0x827d('0x89')]][_0x3cfee8][_0x827d('0x3d')],_0x827d('0x8c'));}}}}if(this[_0x827d('0xb')][_0x586e19[_0x827d('0x8d')]]){var _0x55adc7=this[_0x827d('0xb')][_0x586e19['secondtransfereruniqueid']];this[_0x827d('0xb')][_0x586e19[_0x827d('0x8d')]]=this[_0x827d('0xb')][_0x586e19[_0x827d('0x89')]];this[_0x827d('0xb')][_0x586e19[_0x827d('0x89')]]=_0x55adc7;}}}catch(_0x11c176){logger[_0x827d('0x3a')]('[%s][voiceAgentReport][attendedtransfer]',_0x586e19['uniqueid'],util['inspect'](_0x11c176,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')][_0x827d('0x1f')]=function(_0x4e58b0){try{if(this['isNotNull'](_0x4e58b0)){logger[_0x827d('0x34')](_0x827d('0x8e'),_0x4e58b0[_0x827d('0x26')],util[_0x827d('0x29')](_0x4e58b0,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e58b0['transfereeuniqueid']]){for(var _0x35413c in this[_0x827d('0xb')][_0x4e58b0['transfereeuniqueid']]){if(this['channels'][_0x4e58b0[_0x827d('0x89')]][_0x827d('0x5e')](_0x35413c)){if(_0x4e58b0[_0x827d('0x8f')]===_0x35413c){logger[_0x827d('0x24')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4e58b0[_0x827d('0x26')],this[_0x827d('0xb')][_0x4e58b0['transfereeuniqueid']][_0x35413c][_0x827d('0x27')],_0x35413c);var _0x110ee1=moment();this['channels'][_0x4e58b0['transfereeuniqueid']][_0x35413c][_0x827d('0x15')]=!![];this[_0x827d('0xb')][_0x4e58b0[_0x827d('0x89')]][_0x35413c][_0x827d('0x66')]=_0x110ee1;this[_0x827d('0xb')][_0x4e58b0[_0x827d('0x89')]][_0x35413c][_0x827d('0x43')]=_0x827d('0x67');this[_0x827d('0xb')][_0x4e58b0[_0x827d('0x89')]][_0x35413c][_0x827d('0x52')]=_0x827d('0x68');this['channels'][_0x4e58b0[_0x827d('0x89')]][_0x35413c][_0x827d('0x6a')]=_0x110ee1[_0x827d('0x8b')](this[_0x827d('0xb')][_0x4e58b0[_0x827d('0x89')]][_0x35413c][_0x827d('0x3d')],'seconds');}}}}}}catch(_0x7a958){logger[_0x827d('0x3a')]('[%s][voiceAgentReport][blindtransfer]',_0x4e58b0['uniqueid'],util[_0x827d('0x29')](_0x7a958,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')][_0x827d('0x90')]=function(_0x3924d9){var _0xb0f4d0='';try{if(this['isNotNull'](_0x3924d9)){logger[_0x827d('0x34')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x3924d9['uniqueid'],util[_0x827d('0x29')](_0x3924d9,{'showHidden':![],'depth':null}));if(_0x3924d9['channel']){_0xb0f4d0=_0x3924d9['channel']['substring'](0x0,_0x3924d9['channel'][_0x827d('0x91')]('-'));if(this[_0x827d('0x2a')][_0xb0f4d0]){logger[_0x827d('0x24')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x3924d9[_0x827d('0x26')],_0xb0f4d0);this[_0x827d('0x2a')][_0xb0f4d0][_0x827d('0x92')]=!![];}}}}catch(_0xf10476){logger[_0x827d('0x3a')](_0x827d('0x93'),_0x3924d9[_0x827d('0x26')],util[_0x827d('0x29')](_0xf10476,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')][_0x827d('0x1b')]=function(_0x318c4a){var _0x3fe649='';try{if(this[_0x827d('0x22')](_0x318c4a)){logger[_0x827d('0x34')](_0x827d('0x94'),_0x318c4a[_0x827d('0x26')],util[_0x827d('0x29')](_0x318c4a,{'showHidden':![],'depth':null}));if(_0x318c4a[_0x827d('0x95')]){_0x3fe649=_0x318c4a[_0x827d('0x95')]['substring'](0x0,_0x318c4a['channel'][_0x827d('0x91')]('-'));if(this[_0x827d('0x2a')][_0x3fe649]){logger[_0x827d('0x24')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x318c4a[_0x827d('0x26')],_0x3fe649);this[_0x827d('0x2a')][_0x3fe649][_0x827d('0x92')]=![];}}}}catch(_0x31edc8){logger[_0x827d('0x3a')]('[%s][voiceAgentReport][musiconholdstop]',_0x318c4a[_0x827d('0x26')],util['inspect'](_0x31edc8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x827d('0x20')][_0x827d('0x96')]=function(_0x1706d7,_0x38285e=0x2710){if(this['channels'][_0x1706d7]){setTimeout(()=>{delete this[_0x827d('0xb')][_0x1706d7];},_0x38285e);}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 55fa6f3..a35e927 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9af=['lastapplication','lastdata','set','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','calleridname','answered','holdtime','diff','connectedlinename','destinationchannel','UserId','membername','answertime','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','routeid','origtransfererlinkedid','transferToInternal','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','BlindTransfer','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','exports','lodash','moment','util','path','ioredis','../../../config/environment','ami','../ami','../model/channel','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','socket.io-emitter','channels','blindTransfers','coreshowchannel','newexten','syncNewExten','syncNewChannel','bind','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','linkedid','merge','pick','keys','channel','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','name','user:agentconnect','[%s][voiceCallReport][newchannel]\x20event:','inspect','OutgoingSpoolFailed','exten','format','disposition','toNumber','channelstate','context','agents','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes'];(function(_0x18de22,_0x483879){var _0x3eb6e4=function(_0x32c41d){while(--_0x32c41d){_0x18de22['push'](_0x18de22['shift']());}};_0x3eb6e4(++_0x483879);}(_0xa9af,0x70));var _0xfa9a=function(_0x192103,_0x1715dd){_0x192103=_0x192103-0x0;var _0x58bb34=_0xa9af[_0x192103];return _0x58bb34;};'use strict';var _=require(_0xfa9a('0x0'));var moment=require(_0xfa9a('0x1'));var util=require(_0xfa9a('0x2'));var path=require(_0xfa9a('0x3'));var Redis=require(_0xfa9a('0x4'));var config=require(_0xfa9a('0x5'));var logger=require('../../../config/logger')(_0xfa9a('0x6'));var ami=require(_0xfa9a('0x7'));var Channel=require(_0xfa9a('0x8'));var RpcSetting=require('../rpc/setting');var applications=['set',_0xfa9a('0x9'),_0xfa9a('0xa'),_0xfa9a('0xb'),_0xfa9a('0xc'),_0xfa9a('0xd')];var dispositions=[_0xfa9a('0xe'),'FAILED','FAILED',_0xfa9a('0xe'),_0xfa9a('0xe'),_0xfa9a('0xe'),_0xfa9a('0xf'),_0xfa9a('0x10'),'FAILED','FAILED',_0xfa9a('0x11')];config[_0xfa9a('0x12')]=_[_0xfa9a('0x13')](config[_0xfa9a('0x12')],{'host':'localhost','port':0x18eb});var io=require(_0xfa9a('0x14'))(new Redis(config[_0xfa9a('0x12')]));function VoiceCallReport(_0x1e4fe5){this[_0xfa9a('0x15')]=_0x1e4fe5[_0xfa9a('0x15')];this['agents']=_0x1e4fe5['agents'];this[_0xfa9a('0x16')]={};ami['on'](_0xfa9a('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0xfa9a('0x18'),this[_0xfa9a('0x19')]['bind'](this));ami['on']('newchannel',this[_0xfa9a('0x1a')][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x1c'),this[_0xfa9a('0x1d')][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x1e'),this[_0xfa9a('0x1f')][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x20'),this[_0xfa9a('0x21')]['bind'](this));ami['on'](_0xfa9a('0x22'),this[_0xfa9a('0x23')][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x24'),this[_0xfa9a('0x25')]['bind'](this));ami['on'](_0xfa9a('0x26'),this[_0xfa9a('0x27')][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x28'),this['syncMusicOnHoldStart'][_0xfa9a('0x1b')](this));ami['on'](_0xfa9a('0x29'),this[_0xfa9a('0x2a')][_0xfa9a('0x1b')](this));try{logger[_0xfa9a('0x2b')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xfa9a('0x2c')]();}catch(_0x3b5b61){logger[_0xfa9a('0x2d')](_0xfa9a('0x2e'),util['inspect'](_0x3b5b61,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xfa9a('0x2f')]=function(_0xe6a4dd){return _0xe6a4dd!==null&&!_[_0xfa9a('0x30')](_0xe6a4dd);};VoiceCallReport[_0xfa9a('0x31')][_0xfa9a('0x32')]=function(_0x10e92a,_0x3816b2,_0x4c9d83){io['to'](_0x10e92a)[_0xfa9a('0x32')](_0x3816b2,_0x4c9d83);};VoiceCallReport['prototype'][_0xfa9a('0x23')]=function(_0x479062){try{if(this['isNotNull'](_0x479062)){logger['info'](_0xfa9a('0x33'),_0x479062[_0xfa9a('0x34')],_0x479062['calleridname'],_0x479062[_0xfa9a('0x35')]);logger[_0xfa9a('0x36')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x479062[_0xfa9a('0x34')],util['inspect'](_0x479062,{'showHidden':![],'depth':null}));if(_0x479062[_0xfa9a('0x34')]===_0x479062[_0xfa9a('0x37')]){if(!_[_0xfa9a('0x30')](this[_0xfa9a('0x15')][_0x479062[_0xfa9a('0x34')]])){_[_0xfa9a('0x38')](this[_0xfa9a('0x15')][_0x479062[_0xfa9a('0x34')]],_[_0xfa9a('0x39')](_0x479062,_[_0xfa9a('0x3a')](this[_0xfa9a('0x15')][_0x479062['uniqueid']])));}}if(_0x479062['context']==='from-sip'){var _0x5994aa=this['agents'][_0x479062[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]];if(_0x5994aa){if(_0x479062['exten']==_0xfa9a('0x3d')){_0x5994aa[_0xfa9a('0x3e')]=_0x479062[_0xfa9a('0x3f')];this['emit'](util['format']('user:%s',_0x5994aa[_0xfa9a('0x40')]),_0xfa9a('0x41'),{'id':_0x5994aa['id'],'destaccountcode':_0x5994aa['accountcode'],'destconnectedlinenum':_0x479062[_0xfa9a('0x3f')]});}}}}}catch(_0x406a9c){logger['error']('[%s][voiceCallReport][newcallerid]',_0x479062[_0xfa9a('0x34')],util['inspect'](_0x406a9c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfa9a('0x1a')]=function(_0x4ab77f){try{if(this[_0xfa9a('0x2f')](_0x4ab77f)){logger[_0xfa9a('0x36')](_0xfa9a('0x42'),_0x4ab77f[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x4ab77f,{'showHidden':![],'depth':null}));if(this[_0xfa9a('0x15')][_0x4ab77f[_0xfa9a('0x34')]]){return;}if(_0x4ab77f[_0xfa9a('0x3b')]===_0xfa9a('0x44')){return;}if(_0x4ab77f[_0xfa9a('0x34')]!==_0x4ab77f[_0xfa9a('0x37')]&&!this['blindTransfers'][_0x4ab77f[_0xfa9a('0x37')]]){return;}logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x4ab77f[_0xfa9a('0x34')],_0x4ab77f['context'],_0x4ab77f[_0xfa9a('0x45')]);this['channels'][_0x4ab77f[_0xfa9a('0x34')]]=new Channel();this[_0xfa9a('0x15')][_0x4ab77f[_0xfa9a('0x34')]]['starttime']=moment()[_0xfa9a('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfa9a('0x15')][_0x4ab77f['uniqueid']][_0xfa9a('0x47')]=dispositions[_[_0xfa9a('0x48')](_0x4ab77f[_0xfa9a('0x49')])];_[_0xfa9a('0x38')](this[_0xfa9a('0x15')][_0x4ab77f[_0xfa9a('0x34')]],_[_0xfa9a('0x39')](_0x4ab77f,_[_0xfa9a('0x3a')](this['channels'][_0x4ab77f[_0xfa9a('0x34')]])));if(_0x4ab77f[_0xfa9a('0x4a')]==='from-sip'){var _0x1e47b5=this[_0xfa9a('0x4b')][_0x4ab77f[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]];if(_0x1e47b5&&typeof _0x1e47b5[_0xfa9a('0x3e')]===_0xfa9a('0x4c')){_0x1e47b5[_0xfa9a('0x3e')]=_0x4ab77f[_0xfa9a('0x45')];logger['debug'](_0xfa9a('0x4d'),_0x4ab77f[_0xfa9a('0x34')],util[_0xfa9a('0x43')]({'id':_0x1e47b5['id'],'destaccountcode':_0x1e47b5[_0xfa9a('0x4e')],'destconnectedlinenum':_0x4ab77f[_0xfa9a('0x45')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xfa9a('0x46')](_0xfa9a('0x4f'),_0x1e47b5[_0xfa9a('0x40')]),_0xfa9a('0x41'),{'id':_0x1e47b5['id'],'destaccountcode':_0x1e47b5[_0xfa9a('0x4e')],'destconnectedlinenum':_0x4ab77f[_0xfa9a('0x45')]});}}}}catch(_0x46975a){logger[_0xfa9a('0x2d')](_0xfa9a('0x50'),_0x4ab77f['uniqueid'],util[_0xfa9a('0x43')](_0x46975a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')]['syncNewExten']=function(_0x1b56e1){try{if(this[_0xfa9a('0x2f')](_0x1b56e1)){logger['debug'](_0xfa9a('0x51'),_0x1b56e1[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x1b56e1,{'showHidden':![],'depth':null}));if(_0x1b56e1[_0xfa9a('0x3b')]===_0xfa9a('0x44')||_0x1b56e1[_0xfa9a('0x45')]==='h')return;if(_0x1b56e1['uniqueid']===_0x1b56e1['linkedid']||this['blindTransfers'][_0x1b56e1[_0xfa9a('0x37')]]){_0x1b56e1['application']=_0x1b56e1[_0xfa9a('0x52')]?_0x1b56e1[_0xfa9a('0x52')][_0xfa9a('0x53')]():undefined;_0x1b56e1[_0xfa9a('0x54')]=_0x1b56e1[_0xfa9a('0x55')]||_0x1b56e1[_0xfa9a('0x54')];if(_0x1b56e1['appdata']&&_0x1b56e1['application']!==_0xfa9a('0x9')){_0x1b56e1['applicationdata']=_0x1b56e1['applicationdata'][_0xfa9a('0x53')]();}logger[_0xfa9a('0x2b')](_0xfa9a('0x56'),_0x1b56e1[_0xfa9a('0x34')],_0x1b56e1['application'],_0x1b56e1[_0xfa9a('0x54')]);if(_[_0xfa9a('0x30')](this[_0xfa9a('0x15')][_0x1b56e1['uniqueid']])){this[_0xfa9a('0x15')][_0x1b56e1['uniqueid']]=new Channel();this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0xfa9a('0x57')]=_0x1b56e1['duration']?moment()[_0xfa9a('0x58')](moment[_0xfa9a('0x59')](_0x1b56e1[_0xfa9a('0x59')])[_0xfa9a('0x5a')](),_0xfa9a('0x5a'))[_0xfa9a('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xfa9a('0x46')](_0xfa9a('0x5b'));this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0xfa9a('0x47')]=_0xfa9a('0xe');}_[_0xfa9a('0x38')](this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]],_['pick'](_0x1b56e1,_[_0xfa9a('0x3a')](this['channels'][_0x1b56e1['uniqueid']])));if(_[_0xfa9a('0x5c')](applications,_0x1b56e1['application'])){this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0xfa9a('0x5d')]=_0x1b56e1[_0xfa9a('0x52')];this['channels'][_0x1b56e1['uniqueid']][_0xfa9a('0x5e')]=_0x1b56e1['applicationdata'];if(_0x1b56e1[_0xfa9a('0x52')]===_0xfa9a('0x5f')&&_[_0xfa9a('0x60')](_0x1b56e1[_0xfa9a('0x54')]['toLowerCase'](),_0xfa9a('0x61'))){var _0x506f19=_0x1b56e1[_0xfa9a('0x54')][_0xfa9a('0x3c')]('=');var _0x291347=_0x506f19[0x0][_0xfa9a('0x53')]()[_0xfa9a('0x62')](/cdr\((.*)\)/);if(_0x291347){if(_0x291347[0x1]===_0xfa9a('0x63')&&!_[_0xfa9a('0x64')](this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0x291347[0x1]]))return;this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0x291347[0x1]]=_0x506f19[0x1];}}else if(_0x1b56e1[_0xfa9a('0x52')]===_0xfa9a('0x9')){this[_0xfa9a('0x15')][_0x1b56e1[_0xfa9a('0x34')]][_0xfa9a('0x9')]=_0x1b56e1[_0xfa9a('0x54')]['split'](',')[0x0];}}}}}catch(_0x2153be){logger[_0xfa9a('0x2d')](_0xfa9a('0x65'),_0x1b56e1[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x2153be,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')][_0xfa9a('0x1d')]=function(_0x4acda6){try{if(this[_0xfa9a('0x2f')](_0x4acda6)){logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x4acda6[_0xfa9a('0x34')],_0x4acda6[_0xfa9a('0x37')],_0x4acda6[_0xfa9a('0x66')],_0x4acda6[_0xfa9a('0x35')]);logger[_0xfa9a('0x36')]('[%s][voiceCallReport][newstate]\x20event:',_0x4acda6['uniqueid'],util[_0xfa9a('0x43')](_0x4acda6,{'showHidden':![],'depth':null}));if(_0x4acda6[_0xfa9a('0x49')]!=='6')return;var _0x3d2f66=this[_0xfa9a('0x4b')][_0x4acda6[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]];if(_0x4acda6[_0xfa9a('0x34')]!==_0x4acda6[_0xfa9a('0x37')]){var _0x3c8bf4=moment();if(this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]]){if(!this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x67')]){this['channels'][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x67')]=!![];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]]['answertime']=_0x3c8bf4[_0xfa9a('0x46')](_0xfa9a('0x5b'));if(this['channels'][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x57')]){this[_0xfa9a('0x15')][_0x4acda6['linkedid']][_0xfa9a('0x68')]=_0x3c8bf4[_0xfa9a('0x69')](this[_0xfa9a('0x15')][_0x4acda6['linkedid']][_0xfa9a('0x57')],'seconds');}}this[_0xfa9a('0x15')][_0x4acda6['linkedid']][_0xfa9a('0x37')]=_0x4acda6['uniqueid'];if(_0x4acda6['calleridnum']!=='xcally-motion-preview'){this[_0xfa9a('0x15')][_0x4acda6['linkedid']][_0xfa9a('0x3f')]=_0x4acda6[_0xfa9a('0x35')];}this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x6a')]=_0x4acda6['calleridname'];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x6b')]=_0x4acda6[_0xfa9a('0x3b')];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x47')]=dispositions[_['toNumber'](_0x4acda6[_0xfa9a('0x49')])];if(_0x3d2f66){this[_0xfa9a('0x15')][_0x4acda6['linkedid']][_0xfa9a('0x6c')]=_0x3d2f66['id'];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x6d')]=_0x3d2f66[_0xfa9a('0x40')];}}if(this['channels'][_0x4acda6['uniqueid']]){if(!this['channels'][_0x4acda6['uniqueid']]['answered']){this['channels'][_0x4acda6[_0xfa9a('0x34')]][_0xfa9a('0x67')]=!![];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]][_0xfa9a('0x6e')]=_0x3c8bf4['format']('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x4acda6['uniqueid']][_0xfa9a('0x57')]){this['channels'][_0x4acda6[_0xfa9a('0x34')]]['holdtime']=_0x3c8bf4['diff'](this[_0xfa9a('0x15')][_0x4acda6['uniqueid']][_0xfa9a('0x57')],'seconds');}}if(_0x4acda6[_0xfa9a('0x35')]!=='xcally-motion-preview'){this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]][_0xfa9a('0x3f')]=_0x4acda6[_0xfa9a('0x35')];}this['channels'][_0x4acda6[_0xfa9a('0x34')]][_0xfa9a('0x6a')]=_0x4acda6[_0xfa9a('0x66')];this['channels'][_0x4acda6['uniqueid']][_0xfa9a('0x6b')]=_0x4acda6[_0xfa9a('0x3b')];this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]]['disposition']=dispositions[_[_0xfa9a('0x48')](_0x4acda6[_0xfa9a('0x49')])];}}else{if(this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]]){if(_0x3d2f66){this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]]['UserId']=_0x3d2f66['id'];this['channels'][_0x4acda6[_0xfa9a('0x34')]]['membername']=_0x3d2f66['name'];}}}if(_0x4acda6[_0xfa9a('0x4a')]==='from-sip'){if(_0x3d2f66){_0x3d2f66[_0xfa9a('0x3e')]=_0x4acda6[_0xfa9a('0x45')];var _0x4a73da;if(this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]]){_0x4a73da=this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x34')]][_0xfa9a('0x9')];}else if(this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]]){_0x4a73da=this[_0xfa9a('0x15')][_0x4acda6[_0xfa9a('0x37')]][_0xfa9a('0x9')];}_0x3d2f66[_0xfa9a('0x9')]=_0x4a73da;var _0xc2afe1={'id':_0x3d2f66['id'],'name':_0x3d2f66[_0xfa9a('0x40')],'agentconnected':!![],'destaccountcode':_0x3d2f66['accountcode'],'destconnectedlinenum':_0x4acda6['exten'],'queue':_0x4a73da||undefined,'uniqueid':_0x4acda6['linkedid']};logger[_0xfa9a('0x36')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x4acda6[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0xc2afe1,{'showHidden':![],'depth':null}));this[_0xfa9a('0x32')](util[_0xfa9a('0x46')]('user:%s',_0x3d2f66['name']),'user:agentconnect',_0xc2afe1);}}}}catch(_0x3fffc4){logger['error'](_0xfa9a('0x6f'),_0x4acda6[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x3fffc4,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xfa9a('0x70')]=function(_0x1abd2a,_0xba2140){try{if(this[_0xfa9a('0x15')][_0x1abd2a]){logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x1abd2a,_0xba2140);this['channels'][_0x1abd2a][_0xfa9a('0x71')]=!![];if(_[_0xfa9a('0x72')](_0xba2140,_0xfa9a('0x73'))){_0xba2140=_0xba2140[_0xfa9a('0x74')]('.wav49',_0xfa9a('0x75'));}this[_0xfa9a('0x15')][_0x1abd2a]['monitorFilename']=_0xba2140;var _0x1a0196=_['find'](this[_0xfa9a('0x15')][_0x1abd2a]['monitors'],{'filename':_0xba2140});if(_[_0xfa9a('0x64')](_0x1a0196)){this[_0xfa9a('0x15')][_0x1abd2a][_0xfa9a('0x76')][_0xfa9a('0x77')]({'filename':_0xba2140,'createdAt':moment()['format'](_0xfa9a('0x5b')),'mixmonitorid':'','status':_0xfa9a('0x78')});}}}catch(_0x460c06){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x1abd2a,util['inspect'](_0x460c06,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')][_0xfa9a('0x1f')]=function(_0x34b25c){try{if(this['isNotNull'](_0x34b25c)){logger[_0xfa9a('0x36')](_0xfa9a('0x79'),_0x34b25c[_0xfa9a('0x34')],util['inspect'](_0x34b25c,{'showHidden':![],'depth':null}));if(this['channels'][_0x34b25c[_0xfa9a('0x34')]]&&_0x34b25c[_0xfa9a('0x3b')]!=_0xfa9a('0x44')){if(this['isNotNull'](_0x34b25c[_0xfa9a('0x7a')])){if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')]['mixmonitor_filename'])){logger[_0xfa9a('0x2b')](_0xfa9a('0x7b'),_0x34b25c[_0xfa9a('0x34')],_0x34b25c[_0xfa9a('0x7c')]);this[_0xfa9a('0x70')](_0x34b25c[_0xfa9a('0x34')],_0x34b25c[_0xfa9a('0x7c')]);}else if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x7d')])){logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x34b25c[_0xfa9a('0x34')],_0x34b25c[_0xfa9a('0x7c')]);this['channels'][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x35')]=_0x34b25c['value'];}else if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x7e')])){logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x34b25c[_0xfa9a('0x34')],_0x34b25c['value']);this[_0xfa9a('0x15')][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x7f')]=_0x34b25c['value'];}else if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x80')])){logger['info'](_0xfa9a('0x81'),_0x34b25c['uniqueid'],_0x34b25c['value']);this[_0xfa9a('0x15')][_0x34b25c['uniqueid']][_0xfa9a('0x63')]=_0x34b25c[_0xfa9a('0x7c')];}else if(this['isNotNull'](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x82')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x83'),_0x34b25c['uniqueid'],_0x34b25c[_0xfa9a('0x7c')][_0xfa9a('0x3c')](',')[0x0]);this['channels'][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x9')]=_0x34b25c['value'][_0xfa9a('0x3c')](',')[0x0];}else if(this[_0xfa9a('0x2f')](_0x34b25c['variable'][_0xfa9a('0x84')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x85'),_0x34b25c[_0xfa9a('0x34')],_0x34b25c['value']);this[_0xfa9a('0x15')][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x86')]=_0x34b25c[_0xfa9a('0x7c')];}else if(this['isNotNull'](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x87')])){logger['info'](_0xfa9a('0x88'),_0x34b25c[_0xfa9a('0x34')],_0x34b25c[_0xfa9a('0x7c')]);this[_0xfa9a('0x15')][_0x34b25c['uniqueid']][_0xfa9a('0x89')]=_0x34b25c[_0xfa9a('0x7c')];}else if(this[_0xfa9a('0x2f')](_0x34b25c['variable'][_0xfa9a('0x8a')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x8b'),_0x34b25c['uniqueid'],_0x34b25c['value']);this[_0xfa9a('0x15')][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x8c')]=_0x34b25c[_0xfa9a('0x7c')];}else if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x8d')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x8e'),_0x34b25c['uniqueid'],_0x34b25c['value']);this['channels'][_0x34b25c[_0xfa9a('0x34')]][_0xfa9a('0x9')]=_0x34b25c['value'];}else if(this[_0xfa9a('0x2f')](_0x34b25c['variable'][_0xfa9a('0x8f')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x90'),_0x34b25c[_0xfa9a('0x34')],_0x34b25c[_0xfa9a('0x7c')]);this[_0xfa9a('0x15')][_0x34b25c['uniqueid']][_0xfa9a('0x91')]=_0x34b25c[_0xfa9a('0x7c')];}}}else if(this['isNotNull'](_0x34b25c['variable']['mixmonitor_filename'])){if(_0x34b25c[_0xfa9a('0x7c')]){var _0x59842d=path[_0xfa9a('0x92')](_0x34b25c[_0xfa9a('0x7c')])[_0xfa9a('0x40')];logger[_0xfa9a('0x2b')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x59842d,_0x34b25c[_0xfa9a('0x7c')]);this[_0xfa9a('0x70')](_0x59842d,_0x34b25c[_0xfa9a('0x7c')]);}}else if(this['channels'][_0x34b25c[_0xfa9a('0x37')]]){if(this[_0xfa9a('0x2f')](_0x34b25c['variable'])){if(this[_0xfa9a('0x2f')](_0x34b25c[_0xfa9a('0x7a')][_0xfa9a('0x8f')])){logger[_0xfa9a('0x2b')](_0xfa9a('0x90'),_0x34b25c[_0xfa9a('0x37')],_0x34b25c['value']);this[_0xfa9a('0x15')][_0x34b25c['linkedid']][_0xfa9a('0x93')]=_0x34b25c[_0xfa9a('0x7c')];}}}}}catch(_0x2e656c){logger[_0xfa9a('0x2d')](_0xfa9a('0x94'),_0x34b25c['uniqueid'],util['inspect'](_0x2e656c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xfa9a('0x31')]['syncHangup']=function(_0x47e1fd){try{if(this[_0xfa9a('0x2f')](_0x47e1fd)){logger[_0xfa9a('0x36')](_0xfa9a('0x95'),_0x47e1fd[_0xfa9a('0x34')],util[_0xfa9a('0x43')](_0x47e1fd,{'showHidden':![],'depth':null}));if(this[_0xfa9a('0x16')][_0x47e1fd['linkedid']]){if(this[_0xfa9a('0x15')][this['blindTransfers'][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]]){this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]][_0xfa9a('0x34')]=_0x47e1fd[_0xfa9a('0x34')];this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]]['linkedid']]['answered']=this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]['answered'];this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]][_0xfa9a('0x6e')]=this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x6e')];this['channels'][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]][_0xfa9a('0x6b')]=this['channels'][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]]['linkedid']]['channel'];this['channels'][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]][_0xfa9a('0x47')]=this['channels'][_0x47e1fd['uniqueid']]['disposition'];this['channels'][_0x47e1fd[_0xfa9a('0x34')]]=this[_0xfa9a('0x15')][this['blindTransfers'][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x37')]];this[_0xfa9a('0x96')](this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]]['linkedid']);}else if(this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]]){this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]]['uniqueid']=[this['channels'][this['blindTransfers'][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]]['linkedid'],this[_0xfa9a('0x15')][this['blindTransfers'][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]][_0xfa9a('0x37')]=this[_0xfa9a('0x15')][this['blindTransfers'][_0x47e1fd['linkedid']][_0xfa9a('0x34')]]['uniqueid']][0x0];this['channels'][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]]['uniqueid']][_0xfa9a('0x67')]=this[_0xfa9a('0x15')][_0x47e1fd['uniqueid']][_0xfa9a('0x67')];this[_0xfa9a('0x15')][this['blindTransfers'][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]][_0xfa9a('0x6e')]=this[_0xfa9a('0x15')][_0x47e1fd['uniqueid']]['answertime'];this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]][_0xfa9a('0x6b')]=this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]][_0xfa9a('0x3b')];this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]][_0xfa9a('0x47')]=this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x47')];this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]=this[_0xfa9a('0x15')][this[_0xfa9a('0x16')][_0x47e1fd['linkedid']][_0xfa9a('0x34')]];this[_0xfa9a('0x96')](this[_0xfa9a('0x16')][_0x47e1fd[_0xfa9a('0x37')]][_0xfa9a('0x34')]);}}if(this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]){logger['info'](_0xfa9a('0x97'),_0x47e1fd[_0xfa9a('0x34')],_0x47e1fd[_0xfa9a('0x98')]);var _0x551fc5=moment();this['channels'][_0x47e1fd[_0xfa9a('0x34')]]['endtime']=_0x551fc5[_0xfa9a('0x46')](_0xfa9a('0x5b'));this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x59')]=_0x551fc5[_0xfa9a('0x69')](this['channels'][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x57')],_0xfa9a('0x5a'));if(this['channels'][_0x47e1fd[_0xfa9a('0x34')]]['answered']){this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]['billableseconds']=_0x551fc5[_0xfa9a('0x69')](this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]][_0xfa9a('0x6e')],_0xfa9a('0x5a'));this[_0xfa9a('0x15')][_0x47e1fd['uniqueid']]['holdtime']=this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]['duration']-this[_0xfa9a('0x15')][_0x47e1fd[_0xfa9a('0x34')]]['billableseconds'];}if(_0x47e1fd[_0xfa9a('0x4a')]===_0xfa9a('0x99')){if(this[_0xfa9a('0x4b')][_0x47e1fd[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]]){this['agents'][_0x47e1fd[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]]=_[_0xfa9a('0x9a')](this[_0xfa9a('0x4b')][_0x47e1fd[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0xfa9a('0x9b'),_0x47e1fd[_0xfa9a('0x34')],util[_0xfa9a('0x43')]({'id':this['agents'][_0x47e1fd['channel'][_0xfa9a('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xfa9a('0x4b')][_0x47e1fd[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]][_0xfa9a('0x4e')]},{'showHidden':![],'depth':null}));this[_0xfa9a('0x32')](util[_0xfa9a('0x46')](_0xfa9a('0x4f'),this[_0xfa9a('0x4b')][_0x47e1fd[_0xfa9a('0x3b')][_0xfa9a('0x3c')]('-')[0x0]][_0xfa9a('0x40')]),_0xfa9a('0x9c'),{'id':this[_0xfa9a('0x4b')][_0x47e1fd['channel'][_0xfa9a('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0xfa9a('0x4b')][_0x47e1fd['channel'][_0xfa9a('0x3c')]('-')[0x0]]['accountcode']});for(var _0x5c0458=0x0;_0x5c0458{delete this[_0xfa9a('0x15')][_0x1e3839];},_0x3410a4);}};module[_0xfa9a('0xcc')]=VoiceCallReport; \ No newline at end of file +var _0xdc54=['newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','pick','keys','context','agents','channel','split','exten','xcally-motion-preview','connectedlinenum','name','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','destconnectedlinenum','format','user:%s','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','match','type','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','connectedlinename','destinationchannel','UserId','membername','answertime','user:agentconnect','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','.WAV','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','originatecalleridnum','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','resolve','then','undefined','transferToInternal','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','some','origtransfererlinkedid','outbound','routeid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','transfereruniqueid','BLIND','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','socket.io-emitter','channels','blindTransfers','coreshowchannel','syncNewExten','bind','newexten'];(function(_0x31b4c8,_0x3813ee){var _0x3fcce4=function(_0x5bc1f4){while(--_0x5bc1f4){_0x31b4c8['push'](_0x31b4c8['shift']());}};_0x3fcce4(++_0x3813ee);}(_0xdc54,0x174));var _0x4dc5=function(_0x7e64,_0x17dfd6){_0x7e64=_0x7e64-0x0;var _0x959806=_0xdc54[_0x7e64];return _0x959806;};'use strict';var _=require(_0x4dc5('0x0'));var moment=require(_0x4dc5('0x1'));var util=require('util');var path=require(_0x4dc5('0x2'));var Redis=require(_0x4dc5('0x3'));var config=require(_0x4dc5('0x4'));var logger=require(_0x4dc5('0x5'))(_0x4dc5('0x6'));var ami=require('../ami');var Channel=require(_0x4dc5('0x7'));var RpcSetting=require('../rpc/setting');var applications=[_0x4dc5('0x8'),_0x4dc5('0x9'),_0x4dc5('0xa'),_0x4dc5('0xb'),_0x4dc5('0xc'),_0x4dc5('0xd')];var dispositions=[_0x4dc5('0xe'),_0x4dc5('0xf'),'FAILED',_0x4dc5('0xe'),_0x4dc5('0xe'),_0x4dc5('0xe'),'ANSWERED',_0x4dc5('0x10'),_0x4dc5('0xf'),_0x4dc5('0xf'),_0x4dc5('0xf')];config[_0x4dc5('0x11')]=_[_0x4dc5('0x12')](config[_0x4dc5('0x11')],{'host':'localhost','port':0x18eb});var io=require(_0x4dc5('0x13'))(new Redis(config['redis']));function VoiceCallReport(_0x342faa){this[_0x4dc5('0x14')]=_0x342faa['channels'];this['agents']=_0x342faa['agents'];this[_0x4dc5('0x15')]={};ami['on'](_0x4dc5('0x16'),this[_0x4dc5('0x17')][_0x4dc5('0x18')](this));ami['on'](_0x4dc5('0x19'),this[_0x4dc5('0x17')][_0x4dc5('0x18')](this));ami['on'](_0x4dc5('0x1a'),this[_0x4dc5('0x1b')]['bind'](this));ami['on'](_0x4dc5('0x1c'),this[_0x4dc5('0x1d')][_0x4dc5('0x18')](this));ami['on'](_0x4dc5('0x1e'),this[_0x4dc5('0x1f')][_0x4dc5('0x18')](this));ami['on']('hangup',this[_0x4dc5('0x20')][_0x4dc5('0x18')](this));ami['on'](_0x4dc5('0x21'),this[_0x4dc5('0x22')][_0x4dc5('0x18')](this));ami['on']('attendedtransfer',this[_0x4dc5('0x23')][_0x4dc5('0x18')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4dc5('0x18')](this));ami['on'](_0x4dc5('0x24'),this[_0x4dc5('0x25')][_0x4dc5('0x18')](this));ami['on'](_0x4dc5('0x26'),this[_0x4dc5('0x27')][_0x4dc5('0x18')](this));try{logger[_0x4dc5('0x28')](_0x4dc5('0x29'));ami[_0x4dc5('0x2a')]();}catch(_0x493b39){logger['error']('[voiceCallReport][coreshowchannels]',util[_0x4dc5('0x2b')](_0x493b39,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x4dc5('0x2c')]['isNotNull']=function(_0x5f38eb){return _0x5f38eb!==null&&!_[_0x4dc5('0x2d')](_0x5f38eb);};VoiceCallReport['prototype'][_0x4dc5('0x2e')]=function(_0x17a8f3,_0x34fa29,_0x42b9fc){io['to'](_0x17a8f3)[_0x4dc5('0x2e')](_0x34fa29,_0x42b9fc);};VoiceCallReport[_0x4dc5('0x2c')][_0x4dc5('0x22')]=function(_0x39859e){try{if(this[_0x4dc5('0x2f')](_0x39859e)){logger[_0x4dc5('0x28')](_0x4dc5('0x30'),_0x39859e['uniqueid'],_0x39859e[_0x4dc5('0x31')],_0x39859e[_0x4dc5('0x32')]);logger[_0x4dc5('0x33')](_0x4dc5('0x34'),_0x39859e['uniqueid'],util['inspect'](_0x39859e,{'showHidden':![],'depth':null}));if(_0x39859e[_0x4dc5('0x35')]===_0x39859e[_0x4dc5('0x36')]){if(!_[_0x4dc5('0x2d')](this[_0x4dc5('0x14')][_0x39859e[_0x4dc5('0x35')]])){_[_0x4dc5('0x37')](this[_0x4dc5('0x14')][_0x39859e[_0x4dc5('0x35')]],_[_0x4dc5('0x38')](_0x39859e,_[_0x4dc5('0x39')](this[_0x4dc5('0x14')][_0x39859e[_0x4dc5('0x35')]])));}}if(_0x39859e[_0x4dc5('0x3a')]==='from-sip'){var _0x5b2e6=this[_0x4dc5('0x3b')][_0x39859e[_0x4dc5('0x3c')][_0x4dc5('0x3d')]('-')[0x0]];if(_0x5b2e6){if(_0x39859e[_0x4dc5('0x3e')]==_0x4dc5('0x3f')){_0x5b2e6['destconnectedlinenum']=_0x39859e[_0x4dc5('0x40')];this[_0x4dc5('0x2e')](util['format']('user:%s',_0x5b2e6[_0x4dc5('0x41')]),'user:agentconnect',{'id':_0x5b2e6['id'],'destaccountcode':_0x5b2e6[_0x4dc5('0x42')],'destconnectedlinenum':_0x39859e[_0x4dc5('0x40')]});}}}}}catch(_0x438451){logger[_0x4dc5('0x43')](_0x4dc5('0x44'),_0x39859e['uniqueid'],util[_0x4dc5('0x2b')](_0x438451,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4dc5('0x2c')][_0x4dc5('0x1b')]=function(_0x174727){try{if(this[_0x4dc5('0x2f')](_0x174727)){logger['debug'](_0x4dc5('0x45'),_0x174727[_0x4dc5('0x35')],util[_0x4dc5('0x2b')](_0x174727,{'showHidden':![],'depth':null}));if(this['channels'][_0x174727[_0x4dc5('0x35')]]){return;}if(_0x174727[_0x4dc5('0x3c')]===_0x4dc5('0x46')){return;}if(_0x174727[_0x4dc5('0x35')]!==_0x174727[_0x4dc5('0x36')]&&!this[_0x4dc5('0x15')][_0x174727[_0x4dc5('0x36')]]){return;}logger[_0x4dc5('0x28')](_0x4dc5('0x47'),_0x174727[_0x4dc5('0x35')],_0x174727[_0x4dc5('0x3a')],_0x174727[_0x4dc5('0x3e')]);this['channels'][_0x174727[_0x4dc5('0x35')]]=new Channel();this['channels'][_0x174727[_0x4dc5('0x35')]]['starttime']=moment()['format'](_0x4dc5('0x48'));this[_0x4dc5('0x14')][_0x174727['uniqueid']][_0x4dc5('0x49')]=dispositions[_[_0x4dc5('0x4a')](_0x174727[_0x4dc5('0x4b')])];_[_0x4dc5('0x37')](this[_0x4dc5('0x14')][_0x174727[_0x4dc5('0x35')]],_['pick'](_0x174727,_[_0x4dc5('0x39')](this['channels'][_0x174727['uniqueid']])));if(_0x174727[_0x4dc5('0x3a')]===_0x4dc5('0x4c')){var _0x16dbd0=this['agents'][_0x174727[_0x4dc5('0x3c')]['split']('-')[0x0]];if(_0x16dbd0&&typeof _0x16dbd0[_0x4dc5('0x4d')]==='undefined'){_0x16dbd0[_0x4dc5('0x4d')]=_0x174727[_0x4dc5('0x3e')];logger[_0x4dc5('0x33')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x174727['uniqueid'],util[_0x4dc5('0x2b')]({'id':_0x16dbd0['id'],'destaccountcode':_0x16dbd0[_0x4dc5('0x42')],'destconnectedlinenum':_0x174727['exten']},{'showHidden':![],'depth':null}));this['emit'](util[_0x4dc5('0x4e')](_0x4dc5('0x4f'),_0x16dbd0[_0x4dc5('0x41')]),'user:agentconnect',{'id':_0x16dbd0['id'],'destaccountcode':_0x16dbd0[_0x4dc5('0x42')],'destconnectedlinenum':_0x174727[_0x4dc5('0x3e')]});}}}}catch(_0x33d3dd){logger[_0x4dc5('0x43')](_0x4dc5('0x50'),_0x174727['uniqueid'],util[_0x4dc5('0x2b')](_0x33d3dd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4dc5('0x2c')][_0x4dc5('0x17')]=function(_0x3ba1c8){try{if(this[_0x4dc5('0x2f')](_0x3ba1c8)){logger['debug'](_0x4dc5('0x51'),_0x3ba1c8[_0x4dc5('0x35')],util[_0x4dc5('0x2b')](_0x3ba1c8,{'showHidden':![],'depth':null}));if(_0x3ba1c8[_0x4dc5('0x3c')]===_0x4dc5('0x46')||_0x3ba1c8[_0x4dc5('0x3e')]==='h')return;if(_0x3ba1c8['uniqueid']===_0x3ba1c8[_0x4dc5('0x36')]||this['blindTransfers'][_0x3ba1c8['linkedid']]){_0x3ba1c8[_0x4dc5('0x52')]=_0x3ba1c8[_0x4dc5('0x52')]?_0x3ba1c8[_0x4dc5('0x52')][_0x4dc5('0x53')]():undefined;_0x3ba1c8['applicationdata']=_0x3ba1c8[_0x4dc5('0x54')]||_0x3ba1c8[_0x4dc5('0x55')];if(_0x3ba1c8['appdata']&&_0x3ba1c8[_0x4dc5('0x52')]!==_0x4dc5('0x9')){_0x3ba1c8[_0x4dc5('0x55')]=_0x3ba1c8[_0x4dc5('0x55')]['toLowerCase']();}logger['info'](_0x4dc5('0x56'),_0x3ba1c8[_0x4dc5('0x35')],_0x3ba1c8[_0x4dc5('0x52')],_0x3ba1c8[_0x4dc5('0x55')]);if(_['isUndefined'](this[_0x4dc5('0x14')][_0x3ba1c8['uniqueid']])){this[_0x4dc5('0x14')][_0x3ba1c8[_0x4dc5('0x35')]]=new Channel();this[_0x4dc5('0x14')][_0x3ba1c8[_0x4dc5('0x35')]][_0x4dc5('0x57')]=_0x3ba1c8[_0x4dc5('0x58')]?moment()[_0x4dc5('0x59')](moment['duration'](_0x3ba1c8[_0x4dc5('0x58')])['seconds'](),_0x4dc5('0x5a'))[_0x4dc5('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x4dc5('0x4e')](_0x4dc5('0x48'));this[_0x4dc5('0x14')][_0x3ba1c8[_0x4dc5('0x35')]][_0x4dc5('0x49')]=_0x4dc5('0xe');}_[_0x4dc5('0x37')](this[_0x4dc5('0x14')][_0x3ba1c8[_0x4dc5('0x35')]],_['pick'](_0x3ba1c8,_[_0x4dc5('0x39')](this['channels'][_0x3ba1c8['uniqueid']])));if(_[_0x4dc5('0x5b')](applications,_0x3ba1c8[_0x4dc5('0x52')])){this[_0x4dc5('0x14')][_0x3ba1c8['uniqueid']][_0x4dc5('0x5c')]=_0x3ba1c8['application'];this['channels'][_0x3ba1c8[_0x4dc5('0x35')]][_0x4dc5('0x5d')]=_0x3ba1c8[_0x4dc5('0x55')];if(_0x3ba1c8[_0x4dc5('0x52')]===_0x4dc5('0x8')&&_[_0x4dc5('0x5e')](_0x3ba1c8[_0x4dc5('0x55')]['toLowerCase'](),'cdr(')){var _0x58e8e3=_0x3ba1c8[_0x4dc5('0x55')][_0x4dc5('0x3d')]('=');var _0x2d01c6=_0x58e8e3[0x0][_0x4dc5('0x53')]()[_0x4dc5('0x5f')](/cdr\((.*)\)/);if(_0x2d01c6){if(_0x2d01c6[0x1]===_0x4dc5('0x60')&&!_['isNil'](this[_0x4dc5('0x14')][_0x3ba1c8[_0x4dc5('0x35')]][_0x2d01c6[0x1]]))return;this[_0x4dc5('0x14')][_0x3ba1c8[_0x4dc5('0x35')]][_0x2d01c6[0x1]]=_0x58e8e3[0x1];}}else if(_0x3ba1c8[_0x4dc5('0x52')]===_0x4dc5('0x9')){this['channels'][_0x3ba1c8[_0x4dc5('0x35')]][_0x4dc5('0x9')]=_0x3ba1c8[_0x4dc5('0x55')][_0x4dc5('0x3d')](',')[0x0];}}}}}catch(_0x5cf393){logger[_0x4dc5('0x43')](_0x4dc5('0x61'),_0x3ba1c8[_0x4dc5('0x35')],util[_0x4dc5('0x2b')](_0x5cf393,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x4f6405){try{if(this[_0x4dc5('0x2f')](_0x4f6405)){logger[_0x4dc5('0x28')](_0x4dc5('0x62'),_0x4f6405[_0x4dc5('0x35')],_0x4f6405[_0x4dc5('0x36')],_0x4f6405[_0x4dc5('0x31')],_0x4f6405['calleridnum']);logger['debug'](_0x4dc5('0x63'),_0x4f6405['uniqueid'],util[_0x4dc5('0x2b')](_0x4f6405,{'showHidden':![],'depth':null}));if(_0x4f6405[_0x4dc5('0x4b')]!=='6')return;var _0x31667d=this[_0x4dc5('0x3b')][_0x4f6405[_0x4dc5('0x3c')]['split']('-')[0x0]];if(_0x4f6405[_0x4dc5('0x35')]!==_0x4f6405['linkedid']){var _0x248d52=moment();if(this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]]){if(!this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]]['answered']){this['channels'][_0x4f6405[_0x4dc5('0x36')]][_0x4dc5('0x64')]=!![];this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]]['answertime']=_0x248d52[_0x4dc5('0x4e')](_0x4dc5('0x48'));if(this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]][_0x4dc5('0x57')]){this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]][_0x4dc5('0x65')]=_0x248d52[_0x4dc5('0x66')](this['channels'][_0x4f6405['linkedid']][_0x4dc5('0x57')],_0x4dc5('0x5a'));}}this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]]['linkedid']=_0x4f6405[_0x4dc5('0x35')];if(_0x4f6405[_0x4dc5('0x32')]!==_0x4dc5('0x3f')){this[_0x4dc5('0x14')][_0x4f6405['linkedid']][_0x4dc5('0x40')]=_0x4f6405['calleridnum'];}this[_0x4dc5('0x14')][_0x4f6405['linkedid']][_0x4dc5('0x67')]=_0x4f6405[_0x4dc5('0x31')];this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]][_0x4dc5('0x68')]=_0x4f6405['channel'];this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]][_0x4dc5('0x49')]=dispositions[_[_0x4dc5('0x4a')](_0x4f6405['channelstate'])];if(_0x31667d){this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]][_0x4dc5('0x69')]=_0x31667d['id'];this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]][_0x4dc5('0x6a')]=_0x31667d[_0x4dc5('0x41')];}}if(this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]]){if(!this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x64')]){this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x64')]=!![];this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x6b')]=_0x248d52[_0x4dc5('0x4e')](_0x4dc5('0x48'));if(this[_0x4dc5('0x14')][_0x4f6405['uniqueid']]['starttime']){this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x65')]=_0x248d52[_0x4dc5('0x66')](this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x57')],_0x4dc5('0x5a'));}}if(_0x4f6405['calleridnum']!==_0x4dc5('0x3f')){this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x40')]=_0x4f6405[_0x4dc5('0x32')];}this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x67')]=_0x4f6405[_0x4dc5('0x31')];this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x68')]=_0x4f6405[_0x4dc5('0x3c')];this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x49')]=dispositions[_[_0x4dc5('0x4a')](_0x4f6405[_0x4dc5('0x4b')])];}}else{if(this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]]){if(_0x31667d){this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x69')]=_0x31667d['id'];this['channels'][_0x4f6405[_0x4dc5('0x35')]]['membername']=_0x31667d['name'];}}}if(_0x4f6405[_0x4dc5('0x3a')]==='from-sip'){if(_0x31667d){_0x31667d[_0x4dc5('0x4d')]=_0x4f6405[_0x4dc5('0x3e')];var _0x29af37;if(this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]]){_0x29af37=this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x35')]][_0x4dc5('0x9')];}else if(this[_0x4dc5('0x14')][_0x4f6405[_0x4dc5('0x36')]]){_0x29af37=this['channels'][_0x4f6405['linkedid']]['queue'];}_0x31667d['queue']=_0x29af37;var _0x26432b={'id':_0x31667d['id'],'name':_0x31667d[_0x4dc5('0x41')],'agentconnected':!![],'destaccountcode':_0x31667d[_0x4dc5('0x42')],'destconnectedlinenum':_0x4f6405[_0x4dc5('0x3e')],'queue':_0x29af37||undefined,'uniqueid':_0x4f6405['linkedid']};logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x4f6405[_0x4dc5('0x35')],util[_0x4dc5('0x2b')](_0x26432b,{'showHidden':![],'depth':null}));this[_0x4dc5('0x2e')](util['format'](_0x4dc5('0x4f'),_0x31667d[_0x4dc5('0x41')]),_0x4dc5('0x6c'),_0x26432b);}}}}catch(_0x4e0f07){logger[_0x4dc5('0x43')]('[%s][voiceCallReport][newstate]',_0x4f6405[_0x4dc5('0x35')],util['inspect'](_0x4e0f07,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4dc5('0x2c')][_0x4dc5('0x6d')]=function(_0x484126,_0x3c3dda){try{if(this[_0x4dc5('0x14')][_0x484126]){logger[_0x4dc5('0x28')](_0x4dc5('0x6e'),_0x484126,_0x3c3dda);this[_0x4dc5('0x14')][_0x484126][_0x4dc5('0x6f')]=!![];if(_[_0x4dc5('0x70')](_0x3c3dda,'.wav49')){_0x3c3dda=_0x3c3dda[_0x4dc5('0x71')](_0x4dc5('0x72'),_0x4dc5('0x73'));}this[_0x4dc5('0x14')][_0x484126]['monitorFilename']=_0x3c3dda;var _0x5b8cd3=_[_0x4dc5('0x74')](this[_0x4dc5('0x14')][_0x484126][_0x4dc5('0x75')],{'filename':_0x3c3dda});if(_[_0x4dc5('0x76')](_0x5b8cd3)){this[_0x4dc5('0x14')][_0x484126][_0x4dc5('0x75')][_0x4dc5('0x77')]({'filename':_0x3c3dda,'createdAt':moment()['format'](_0x4dc5('0x48')),'mixmonitorid':'','status':_0x4dc5('0x78')});}}}catch(_0x47e3b1){logger[_0x4dc5('0x43')](_0x4dc5('0x79'),_0x484126,util['inspect'](_0x47e3b1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4dc5('0x2c')][_0x4dc5('0x1f')]=function(_0x1a1f71){try{if(this[_0x4dc5('0x2f')](_0x1a1f71)){logger[_0x4dc5('0x33')](_0x4dc5('0x7a'),_0x1a1f71[_0x4dc5('0x35')],util[_0x4dc5('0x2b')](_0x1a1f71,{'showHidden':![],'depth':null}));if(this['channels'][_0x1a1f71['uniqueid']]&&_0x1a1f71[_0x4dc5('0x3c')]!=_0x4dc5('0x46')){if(this['isNotNull'](_0x1a1f71[_0x4dc5('0x7b')])){if(this[_0x4dc5('0x2f')](_0x1a1f71[_0x4dc5('0x7b')][_0x4dc5('0x7c')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x1a1f71['uniqueid'],_0x1a1f71[_0x4dc5('0x7d')]);this[_0x4dc5('0x6d')](_0x1a1f71[_0x4dc5('0x35')],_0x1a1f71['value']);}else if(this[_0x4dc5('0x2f')](_0x1a1f71[_0x4dc5('0x7b')]['xmd-phone'])){logger[_0x4dc5('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x1a1f71[_0x4dc5('0x35')],_0x1a1f71[_0x4dc5('0x7d')]);this[_0x4dc5('0x14')][_0x1a1f71[_0x4dc5('0x35')]]['calleridnum']=_0x1a1f71['value'];}else if(this[_0x4dc5('0x2f')](_0x1a1f71[_0x4dc5('0x7b')][_0x4dc5('0x7e')])){logger[_0x4dc5('0x28')](_0x4dc5('0x7f'),_0x1a1f71[_0x4dc5('0x35')],_0x1a1f71[_0x4dc5('0x7d')]);this['channels'][_0x1a1f71['uniqueid']][_0x4dc5('0x80')]=_0x1a1f71[_0x4dc5('0x7d')];}else if(this[_0x4dc5('0x2f')](_0x1a1f71['variable'][_0x4dc5('0x81')])){logger[_0x4dc5('0x28')](_0x4dc5('0x82'),_0x1a1f71[_0x4dc5('0x35')],_0x1a1f71[_0x4dc5('0x7d')]);this['channels'][_0x1a1f71[_0x4dc5('0x35')]][_0x4dc5('0x60')]=_0x1a1f71[_0x4dc5('0x7d')];}else if(this['isNotNull'](_0x1a1f71[_0x4dc5('0x7b')][_0x4dc5('0x83')])){logger['info'](_0x4dc5('0x84'),_0x1a1f71[_0x4dc5('0x35')],_0x1a1f71['value']['split'](',')[0x0]);this[_0x4dc5('0x14')][_0x1a1f71['uniqueid']]['queue']=_0x1a1f71[_0x4dc5('0x7d')]['split'](',')[0x0];}else if(this['isNotNull'](_0x1a1f71['variable']['xmd-originatecalleridnum'])){logger[_0x4dc5('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1a1f71[_0x4dc5('0x35')],_0x1a1f71[_0x4dc5('0x7d')]);this['channels'][_0x1a1f71[_0x4dc5('0x35')]][_0x4dc5('0x85')]=_0x1a1f71[_0x4dc5('0x7d')];}else if(this[_0x4dc5('0x2f')](_0x1a1f71[_0x4dc5('0x7b')]['xmd-destination'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x1a1f71[_0x4dc5('0x35')],_0x1a1f71[_0x4dc5('0x7d')]);this[_0x4dc5('0x14')][_0x1a1f71[_0x4dc5('0x35')]]['destination']=_0x1a1f71[_0x4dc5('0x7d')];}else if(this[_0x4dc5('0x2f')](_0x1a1f71['variable'][_0x4dc5('0x86')])){logger['info'](_0x4dc5('0x87'),_0x1a1f71[_0x4dc5('0x35')],_0x1a1f71[_0x4dc5('0x7d')]);this[_0x4dc5('0x14')][_0x1a1f71['uniqueid']][_0x4dc5('0x88')]=_0x1a1f71[_0x4dc5('0x7d')];}else if(this[_0x4dc5('0x2f')](_0x1a1f71[_0x4dc5('0x7b')][_0x4dc5('0x89')])){logger[_0x4dc5('0x28')](_0x4dc5('0x8a'),_0x1a1f71['uniqueid'],_0x1a1f71['value']);this[_0x4dc5('0x14')][_0x1a1f71[_0x4dc5('0x35')]][_0x4dc5('0x9')]=_0x1a1f71[_0x4dc5('0x7d')];}else if(this[_0x4dc5('0x2f')](_0x1a1f71[_0x4dc5('0x7b')][_0x4dc5('0x8b')])){logger['info'](_0x4dc5('0x8c'),_0x1a1f71['uniqueid'],_0x1a1f71[_0x4dc5('0x7d')]);this[_0x4dc5('0x14')][_0x1a1f71['uniqueid']][_0x4dc5('0x8d')]=_0x1a1f71['value'];}}}else if(this['isNotNull'](_0x1a1f71[_0x4dc5('0x7b')]['mixmonitor_filename'])){if(_0x1a1f71[_0x4dc5('0x7d')]){var _0xaad64a=path[_0x4dc5('0x8e')](_0x1a1f71[_0x4dc5('0x7d')])[_0x4dc5('0x41')];logger['info'](_0x4dc5('0x8f'),_0xaad64a,_0x1a1f71[_0x4dc5('0x7d')]);this['syncMixMonitorFilename'](_0xaad64a,_0x1a1f71[_0x4dc5('0x7d')]);}}else if(this['channels'][_0x1a1f71[_0x4dc5('0x36')]]){if(this[_0x4dc5('0x2f')](_0x1a1f71[_0x4dc5('0x7b')])){if(this[_0x4dc5('0x2f')](_0x1a1f71['variable'][_0x4dc5('0x8b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1a1f71['linkedid'],_0x1a1f71[_0x4dc5('0x7d')]);this[_0x4dc5('0x14')][_0x1a1f71[_0x4dc5('0x36')]][_0x4dc5('0x90')]=_0x1a1f71[_0x4dc5('0x7d')];}}}}}catch(_0x48a376){logger[_0x4dc5('0x43')](_0x4dc5('0x91'),_0x1a1f71[_0x4dc5('0x35')],util[_0x4dc5('0x2b')](_0x48a376,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4dc5('0x2c')][_0x4dc5('0x20')]=function(_0x25efc6){try{if(this['isNotNull'](_0x25efc6)){logger[_0x4dc5('0x33')](_0x4dc5('0x92'),_0x25efc6[_0x4dc5('0x35')],util[_0x4dc5('0x2b')](_0x25efc6,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x25efc6['linkedid']]){if(this[_0x4dc5('0x14')][this['blindTransfers'][_0x25efc6[_0x4dc5('0x36')]]['linkedid']]){this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]]['linkedid']]['uniqueid']=_0x25efc6[_0x4dc5('0x35')];this['channels'][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x36')]][_0x4dc5('0x64')]=this[_0x4dc5('0x14')][_0x25efc6[_0x4dc5('0x35')]][_0x4dc5('0x64')];this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]]['linkedid']]['answertime']=this[_0x4dc5('0x14')][_0x25efc6[_0x4dc5('0x35')]][_0x4dc5('0x6b')];this[_0x4dc5('0x14')][this['blindTransfers'][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x36')]]['destinationchannel']=this['channels'][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x36')]][_0x4dc5('0x3c')];this[_0x4dc5('0x14')][this['blindTransfers'][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x36')]][_0x4dc5('0x49')]=this[_0x4dc5('0x14')][_0x25efc6[_0x4dc5('0x35')]][_0x4dc5('0x49')];this['channels'][_0x25efc6[_0x4dc5('0x35')]]=this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x36')]];this[_0x4dc5('0x93')](this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x36')]);}else if(this[_0x4dc5('0x14')][this['blindTransfers'][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x35')]]){this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]]['uniqueid']]['uniqueid']=[this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x35')]][_0x4dc5('0x36')],this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6['linkedid']][_0x4dc5('0x35')]][_0x4dc5('0x36')]=this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6['linkedid']][_0x4dc5('0x35')]]['uniqueid']][0x0];this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x35')]][_0x4dc5('0x64')]=this[_0x4dc5('0x14')][_0x25efc6[_0x4dc5('0x35')]]['answered'];this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x35')]]['answertime']=this[_0x4dc5('0x14')][_0x25efc6['uniqueid']][_0x4dc5('0x6b')];this['channels'][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]][_0x4dc5('0x35')]][_0x4dc5('0x68')]=this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]]['uniqueid']][_0x4dc5('0x3c')];this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6[_0x4dc5('0x36')]]['uniqueid']][_0x4dc5('0x49')]=this[_0x4dc5('0x14')][_0x25efc6['uniqueid']][_0x4dc5('0x49')];this['channels'][_0x25efc6[_0x4dc5('0x35')]]=this[_0x4dc5('0x14')][this[_0x4dc5('0x15')][_0x25efc6['linkedid']][_0x4dc5('0x35')]];this[_0x4dc5('0x93')](this[_0x4dc5('0x15')][_0x25efc6['linkedid']][_0x4dc5('0x35')]);}}if(this['channels'][_0x25efc6[_0x4dc5('0x35')]]){logger[_0x4dc5('0x28')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x25efc6[_0x4dc5('0x35')],_0x25efc6['cause-txt']);var _0x22700a=moment();this[_0x4dc5('0x14')][_0x25efc6[_0x4dc5('0x35')]]['endtime']=_0x22700a[_0x4dc5('0x4e')](_0x4dc5('0x48'));this['channels'][_0x25efc6[_0x4dc5('0x35')]][_0x4dc5('0x58')]=_0x22700a[_0x4dc5('0x66')](this[_0x4dc5('0x14')][_0x25efc6[_0x4dc5('0x35')]][_0x4dc5('0x57')],_0x4dc5('0x5a'));if(this[_0x4dc5('0x14')][_0x25efc6[_0x4dc5('0x35')]][_0x4dc5('0x64')]){this[_0x4dc5('0x14')][_0x25efc6['uniqueid']][_0x4dc5('0x94')]=_0x22700a[_0x4dc5('0x66')](this[_0x4dc5('0x14')][_0x25efc6[_0x4dc5('0x35')]]['answertime'],_0x4dc5('0x5a'));this[_0x4dc5('0x14')][_0x25efc6[_0x4dc5('0x35')]]['holdtime']=this['channels'][_0x25efc6[_0x4dc5('0x35')]]['duration']-this[_0x4dc5('0x14')][_0x25efc6[_0x4dc5('0x35')]][_0x4dc5('0x94')];}if(_0x25efc6[_0x4dc5('0x3a')]===_0x4dc5('0x4c')){if(this[_0x4dc5('0x3b')][_0x25efc6[_0x4dc5('0x3c')][_0x4dc5('0x3d')]('-')[0x0]]){this[_0x4dc5('0x3b')][_0x25efc6[_0x4dc5('0x3c')][_0x4dc5('0x3d')]('-')[0x0]]=_[_0x4dc5('0x95')](this[_0x4dc5('0x3b')][_0x25efc6[_0x4dc5('0x3c')][_0x4dc5('0x3d')]('-')[0x0]],[_0x4dc5('0x4d')]);logger[_0x4dc5('0x33')](_0x4dc5('0x96'),_0x25efc6[_0x4dc5('0x35')],util[_0x4dc5('0x2b')]({'id':this['agents'][_0x25efc6[_0x4dc5('0x3c')][_0x4dc5('0x3d')]('-')[0x0]]['id'],'destaccountcode':this[_0x4dc5('0x3b')][_0x25efc6[_0x4dc5('0x3c')][_0x4dc5('0x3d')]('-')[0x0]][_0x4dc5('0x42')]},{'showHidden':![],'depth':null}));this[_0x4dc5('0x2e')](util[_0x4dc5('0x4e')](_0x4dc5('0x4f'),this[_0x4dc5('0x3b')][_0x25efc6[_0x4dc5('0x3c')]['split']('-')[0x0]][_0x4dc5('0x41')]),_0x4dc5('0x97'),{'id':this[_0x4dc5('0x3b')][_0x25efc6[_0x4dc5('0x3c')][_0x4dc5('0x3d')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x25efc6['channel'][_0x4dc5('0x3d')]('-')[0x0]]['accountcode']});for(var _0x4b1463=0x0;_0x4b1463{delete this['channels'][_0x3c1612];},_0x3c612f);}};module[_0x4dc5('0xc6')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 4fb27c2..75fccce 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54dd=['[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','value','variable','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','variables','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','format','duration','endtime','diff','seconds','lastevent','complete','total','holdtime','billableseconds','sumHoldTime','sumDuration','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','stringify','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','socket.io-emitter','channels','outbound','applications','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','syncVarSet','syncHangup','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','isNotNull','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect'];(function(_0x182e4d,_0x169b2e){var _0x5e3697=function(_0x289fcb){while(--_0x289fcb){_0x182e4d['push'](_0x182e4d['shift']());}};_0x5e3697(++_0x169b2e);}(_0x54dd,0x19a));var _0xd54d=function(_0x5c637c,_0x55545b){_0x5c637c=_0x5c637c-0x0;var _0x1c9671=_0x54dd[_0x5c637c];return _0x1c9671;};'use strict';var _=require(_0xd54d('0x0'));var moment=require(_0xd54d('0x1'));var util=require(_0xd54d('0x2'));var Redis=require(_0xd54d('0x3'));var config=require(_0xd54d('0x4'));var logger=require(_0xd54d('0x5'))('ami');var ami=require(_0xd54d('0x6'));config[_0xd54d('0x7')]=_['defaults'](config[_0xd54d('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd54d('0x8'))(new Redis(config[_0xd54d('0x7')]));function VoiceDialReport(_0x1814e7){this[_0xd54d('0x9')]=_0x1814e7['outboundChannels'];this[_0xd54d('0xa')]=_0x1814e7[_0xd54d('0xa')];this[_0xd54d('0xb')]={};this['variables']={};ami['on'](_0xd54d('0xc'),this[_0xd54d('0xd')]['bind'](this));ami['on'](_0xd54d('0xe'),this[_0xd54d('0xf')][_0xd54d('0x10')](this));ami['on']('varset',this[_0xd54d('0x11')][_0xd54d('0x10')](this));ami['on']('hangup',this[_0xd54d('0x12')][_0xd54d('0x10')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x5c65b3){return _0x5c65b3!==null&&!_[_0xd54d('0x13')](_0x5c65b3);};VoiceDialReport[_0xd54d('0x14')][_0xd54d('0x15')]=function(_0x4585b8,_0x30db97,_0x187262){io['to'](_0x4585b8)[_0xd54d('0x15')](_0x30db97,_0x187262);};VoiceDialReport[_0xd54d('0x14')][_0xd54d('0xd')]=function(_0x2bcf2b){try{if(this['isNotNull'](_0x2bcf2b)){logger[_0xd54d('0x16')](_0xd54d('0x17'),_0x2bcf2b[_0xd54d('0x18')],util[_0xd54d('0x19')](_0x2bcf2b,{'showHidden':![],'depth':null}));if(this[_0xd54d('0x9')][_0x2bcf2b[_0xd54d('0x18')]]){_[_0xd54d('0x1a')](this[_0xd54d('0x9')][_0x2bcf2b[_0xd54d('0x18')]],{'starttime':moment()['format'](_0xd54d('0x1b')),'lastevent':_0xd54d('0x1c'),'interface':_0x2bcf2b['channel'][_0xd54d('0x1d')](0x0,_0x2bcf2b[_0xd54d('0x1e')][_0xd54d('0x1f')]('-')),'membername':_0x2bcf2b[_0xd54d('0x1e')]['substring'](_0x2bcf2b[_0xd54d('0x1e')][_0xd54d('0x1f')]('/')+0x1,_0x2bcf2b[_0xd54d('0x1e')][_0xd54d('0x1f')]('-'))},_[_0xd54d('0x20')](_0x2bcf2b,[_0xd54d('0x21'),_0xd54d('0x22')]));logger['info'](_0xd54d('0x23'),_0x2bcf2b[_0xd54d('0x18')],this['channels'][_0x2bcf2b[_0xd54d('0x18')]][_0xd54d('0x24')],this[_0xd54d('0x9')][_0x2bcf2b[_0xd54d('0x18')]][_0xd54d('0x25')]);logger[_0xd54d('0x16')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2bcf2b[_0xd54d('0x18')],util[_0xd54d('0x19')](this[_0xd54d('0x9')][_0x2bcf2b[_0xd54d('0x18')]],{'showHidden':![],'depth':null}));if(this[_0xd54d('0xb')][_0x2bcf2b[_0xd54d('0x18')]])_[_0xd54d('0x1a')](this[_0xd54d('0x9')][_0x2bcf2b[_0xd54d('0x18')]],this[_0xd54d('0xb')][_0x2bcf2b[_0xd54d('0x18')]]);this['emit'](_0xd54d('0x26'),_0xd54d('0x27'),this[_0xd54d('0x9')][_0x2bcf2b[_0xd54d('0x18')]]);logger[_0xd54d('0x16')](_0xd54d('0x28'),_0x2bcf2b[_0xd54d('0x18')],util[_0xd54d('0x19')](this['channels'][_0x2bcf2b[_0xd54d('0x18')]],{'showHidden':![],'depth':null}));ami['emit'](_0xd54d('0x29'),this[_0xd54d('0x9')][_0x2bcf2b['uniqueid']]);}}}catch(_0x28e574){logger[_0xd54d('0x2a')](_0xd54d('0x2b'),_0x2bcf2b[_0xd54d('0x18')],util[_0xd54d('0x19')](_0x28e574,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd54d('0x14')]['syncDialEnd']=function(_0xe96e91){try{if(this[_0xd54d('0x2c')](_0xe96e91)){logger[_0xd54d('0x16')](_0xd54d('0x2d'),_0xe96e91[_0xd54d('0x18')],util['inspect'](_0xe96e91,{'showHidden':![],'depth':null}));if(this[_0xd54d('0x9')][_0xe96e91[_0xd54d('0x18')]]){this[_0xd54d('0x9')][_0xe96e91[_0xd54d('0x18')]][_0xd54d('0x2e')]=_0xe96e91[_0xd54d('0x2e')];if(_0xe96e91[_0xd54d('0x2e')]===_0xd54d('0x2f')){this[_0xd54d('0x9')][_0xe96e91[_0xd54d('0x18')]][_0xd54d('0x30')]=_0xe96e91[_0xd54d('0x30')];this[_0xd54d('0x9')][_0xe96e91[_0xd54d('0x18')]][_0xd54d('0x31')]=_0xe96e91['connectedlinename'];this[_0xd54d('0x9')][_0xe96e91['uniqueid']][_0xd54d('0x32')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xe96e91['uniqueid']]['lastevent']='connect';logger[_0xd54d('0x33')](_0xd54d('0x34'),_0xe96e91[_0xd54d('0x18')],_0xe96e91[_0xd54d('0x1e')][_0xd54d('0x1d')](_0xe96e91[_0xd54d('0x1e')]['lastIndexOf']('/')+0x1,_0xe96e91[_0xd54d('0x1e')][_0xd54d('0x1f')]('-')));logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0xe96e91[_0xd54d('0x18')],util[_0xd54d('0x19')](this[_0xd54d('0x9')][_0xe96e91['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xd54d('0x15')](_0xd54d('0x35'),this[_0xd54d('0x9')][_0xe96e91[_0xd54d('0x18')]]);}logger[_0xd54d('0x16')](_0xd54d('0x36'),_0xe96e91[_0xd54d('0x18')],util['inspect'](this[_0xd54d('0x9')][_0xe96e91['uniqueid']],{'showHidden':![],'depth':null}));this[_0xd54d('0x15')](_0xd54d('0x26'),_0xd54d('0x27'),this[_0xd54d('0x9')][_0xe96e91[_0xd54d('0x18')]]);}}}catch(_0x56a01b){logger[_0xd54d('0x2a')](_0xd54d('0x37'),_0xe96e91[_0xd54d('0x18')],util[_0xd54d('0x19')](_0x56a01b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd54d('0x14')][_0xd54d('0x11')]=function(_0x1fb671){try{if(this[_0xd54d('0x2c')](_0x1fb671)){logger['debug'](_0xd54d('0x38'),_0x1fb671['uniqueid'],util[_0xd54d('0x19')](_0x1fb671,{'showHidden':![],'depth':null}));this[_0xd54d('0x39')](_0x1fb671[_0xd54d('0x18')],_['keys'](_0x1fb671['variable'])[0x0],_0x1fb671[_0xd54d('0x3a')]);if(this[_0xd54d('0x2c')](_0x1fb671[_0xd54d('0x3b')])&&this[_0xd54d('0x2c')](_0x1fb671[_0xd54d('0x3b')][_0xd54d('0x3c')])){if(_[_0xd54d('0x13')](this[_0xd54d('0x9')][_0x1fb671[_0xd54d('0x18')]])){this[_0xd54d('0x9')][_0x1fb671[_0xd54d('0x18')]]={'routeId':_0x1fb671[_0xd54d('0x3a')],'variables':this['variables'][_0x1fb671['uniqueid']],'motionChannel':'voice'};logger[_0xd54d('0x33')](_0xd54d('0x3d'),_0x1fb671[_0xd54d('0x18')],_0x1fb671['variable'][_0xd54d('0x3c')],_[_0xd54d('0x3e')](_0x1fb671['variable'])[0x0],_0x1fb671['value']);logger['debug'](_0xd54d('0x3f'),_0x1fb671[_0xd54d('0x18')],util[_0xd54d('0x19')](this[_0xd54d('0x9')][_0x1fb671[_0xd54d('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0xd54d('0x26'),'voice_outbound_channel:save',this[_0xd54d('0x9')][_0x1fb671[_0xd54d('0x18')]]);}}}}catch(_0x4a5479){logger[_0xd54d('0x2a')](_0xd54d('0x40'),_0x1fb671[_0xd54d('0x18')],util[_0xd54d('0x19')](_0x4a5479,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xd54d('0x39')]=function(_0x55f1a8,_0x5cbd4b,_0x4658ea){var _0x5ca671=[_0xd54d('0x41'),_0xd54d('0x42'),'rtpaudioqosjitter',_0xd54d('0x43'),'rtpaudioqosloss',_0xd54d('0x44'),'rtpaudioqosrtt',_0xd54d('0x45'),_0xd54d('0x46'),_0xd54d('0x47'),_0xd54d('0x48'),'bridgepvtcallid',_0xd54d('0x49'),'memberdynamic',_0xd54d('0x4a'),_0xd54d('0x4b'),'membername',_0xd54d('0x4c'),_0xd54d('0x4d')];if(!_[_0xd54d('0x4e')](_0x5cbd4b)&&!_[_0xd54d('0x4f')](_0x5ca671,_0x5cbd4b)){if(_['isUndefined'](this[_0xd54d('0x50')][_0x55f1a8])){this[_0xd54d('0x50')][_0x55f1a8]={};}this['variables'][_0x55f1a8][_0x5cbd4b]=_0x4658ea;}};VoiceDialReport[_0xd54d('0x14')][_0xd54d('0x12')]=function(_0x243070){try{if(this['isNotNull'](_0x243070)){logger[_0xd54d('0x16')](_0xd54d('0x51'),_0x243070[_0xd54d('0x18')],util[_0xd54d('0x19')](_0x243070,{'showHidden':![],'depth':null}));if(this['channels'][_0x243070[_0xd54d('0x18')]]){logger['info'](_0xd54d('0x52'),_0x243070[_0xd54d('0x18')],_0x243070[_0xd54d('0x53')]);this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]]['endtime']=moment()[_0xd54d('0x54')](_0xd54d('0x1b'));this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]][_0xd54d('0x55')]=moment(this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]][_0xd54d('0x56')])[_0xd54d('0x57')](this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]]['starttime'],_0xd54d('0x58'));this[_0xd54d('0x9')][_0x243070['uniqueid']][_0xd54d('0x59')]=_0xd54d('0x5a');this[_0xd54d('0xa')][_0xd54d('0x5b')]+=0x1;if(this[_0xd54d('0x9')][_0x243070['uniqueid']][_0xd54d('0x32')]){this[_0xd54d('0xa')]['answered']+=0x1;this['channels'][_0x243070['uniqueid']][_0xd54d('0x5c')]=moment(this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]][_0xd54d('0x32')])[_0xd54d('0x57')](this[_0xd54d('0x9')][_0x243070['uniqueid']]['starttime'],_0xd54d('0x58'));this[_0xd54d('0x9')][_0x243070['uniqueid']][_0xd54d('0x5d')]=moment(this['channels'][_0x243070[_0xd54d('0x18')]][_0xd54d('0x56')])[_0xd54d('0x57')](this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]][_0xd54d('0x32')],'seconds');this[_0xd54d('0xa')][_0xd54d('0x5e')]+=this[_0xd54d('0x9')][_0x243070['uniqueid']][_0xd54d('0x5c')]||0x0;this[_0xd54d('0xa')]['sumBillable']+=this['channels'][_0x243070['uniqueid']]['billableseconds'];}this[_0xd54d('0xa')][_0xd54d('0x5f')]+=this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]][_0xd54d('0x55')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x243070['uniqueid'],util[_0xd54d('0x19')](this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]],{'showHidden':![],'depth':null}));ami[_0xd54d('0x15')](_0xd54d('0x60'),this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x243070[_0xd54d('0x18')],util[_0xd54d('0x19')](this['channels'][_0x243070[_0xd54d('0x18')]],{'showHidden':![],'depth':null}));ami[_0xd54d('0x15')](_0xd54d('0x61'),this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]]);logger[_0xd54d('0x16')](_0xd54d('0x62'),_0x243070['uniqueid'],util[_0xd54d('0x19')](this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]],{'showHidden':![],'depth':null}));this[_0xd54d('0x15')](_0xd54d('0x26'),_0xd54d('0x63'),this[_0xd54d('0xa')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xd54d('0x64')](this[_0xd54d('0x9')][_0x243070['uniqueid']]));logger[_0xd54d('0x16')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x243070[_0xd54d('0x18')],util[_0xd54d('0x19')](this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]],{'showHidden':![],'depth':null}));this[_0xd54d('0x15')](_0xd54d('0x26'),_0xd54d('0x65'),this[_0xd54d('0x9')][_0x243070[_0xd54d('0x18')]]);this['deleteChannelAfterTimeout'](_0x243070[_0xd54d('0x18')]);}else if(this[_0xd54d('0x9')][_0x243070[_0xd54d('0x66')]]){this['channels'][_0x243070['linkedid']][_0xd54d('0x18')]=this[_0xd54d('0x9')][_0x243070[_0xd54d('0x66')]]['destuniqueid'];}if(this[_0xd54d('0x50')][_0x243070[_0xd54d('0x18')]]){delete this['variables'][_0x243070[_0xd54d('0x18')]];}}}catch(_0x43dd1f){logger[_0xd54d('0x2a')](_0xd54d('0x67'),_0x243070[_0xd54d('0x18')],util[_0xd54d('0x19')](_0x43dd1f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd54d('0x14')][_0xd54d('0x68')]=function(_0x5c22f9){try{if(this[_0xd54d('0x2c')](_0x5c22f9)){logger[_0xd54d('0x16')](_0xd54d('0x69'),_0x5c22f9[_0xd54d('0x18')],util[_0xd54d('0x19')](_0x5c22f9,{'showHidden':![],'depth':null}));if(_0x5c22f9['application'][_0xd54d('0x6a')]()==='set'){_0x5c22f9[_0xd54d('0x6b')]=(_0x5c22f9[_0xd54d('0x6c')]||_0x5c22f9[_0xd54d('0x6b')])['toLowerCase']();if(_[_0xd54d('0x6d')](_0x5c22f9[_0xd54d('0x6b')],_0xd54d('0x6e'))){if(_[_0xd54d('0x13')](this['applications'][_0x5c22f9[_0xd54d('0x18')]]))this[_0xd54d('0xb')][_0x5c22f9['uniqueid']]={};logger['info'](_0xd54d('0x6f'),_0x5c22f9[_0xd54d('0x18')],_0x5c22f9['application'],_0x5c22f9[_0xd54d('0x6b')]);var _0x72010d=_0x5c22f9[_0xd54d('0x6b')][_0xd54d('0x70')]('=');var _0x2aef9b=_0x72010d[0x0][_0xd54d('0x71')](/cdr\((.*)\)/);if(_0x2aef9b)this[_0xd54d('0xb')][_0x5c22f9[_0xd54d('0x18')]][_0x2aef9b[0x1]]=_0x72010d[0x1];}}}}catch(_0x445d0a){logger[_0xd54d('0x2a')](_0xd54d('0x72'),_0x5c22f9[_0xd54d('0x18')],util[_0xd54d('0x19')](_0x445d0a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd54d('0x14')]['deleteChannelAfterTimeout']=function(_0x1195d0,_0x5ee3ad=0x2710){if(this[_0xd54d('0x9')][_0x1195d0]){setTimeout(()=>{delete this[_0xd54d('0x9')][_0x1195d0];},_0x5ee3ad);}};module[_0xd54d('0x73')]=VoiceDialReport; \ No newline at end of file +var _0x23f4=['total','answered','holdtime','seconds','billableseconds','diff','sumBillable','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','exports','lodash','moment','util','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','lastIndexOf','channel','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','outboundrouteid','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','starttime','complete'];(function(_0x14730c,_0x4a0aca){var _0x40658d=function(_0x51f26d){while(--_0x51f26d){_0x14730c['push'](_0x14730c['shift']());}};_0x40658d(++_0x4a0aca);}(_0x23f4,0x97));var _0x423f=function(_0xdbccd3,_0x162608){_0xdbccd3=_0xdbccd3-0x0;var _0x556cfb=_0x23f4[_0xdbccd3];return _0x556cfb;};'use strict';var _=require(_0x423f('0x0'));var moment=require(_0x423f('0x1'));var util=require(_0x423f('0x2'));var Redis=require('ioredis');var config=require(_0x423f('0x3'));var logger=require('../../../config/logger')(_0x423f('0x4'));var ami=require(_0x423f('0x5'));config[_0x423f('0x6')]=_[_0x423f('0x7')](config[_0x423f('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x423f('0x8'))(new Redis(config[_0x423f('0x6')]));function VoiceDialReport(_0x3c516d){this['channels']=_0x3c516d[_0x423f('0x9')];this[_0x423f('0xa')]=_0x3c516d[_0x423f('0xa')];this[_0x423f('0xb')]={};this[_0x423f('0xc')]={};ami['on'](_0x423f('0xd'),this[_0x423f('0xe')][_0x423f('0xf')](this));ami['on'](_0x423f('0x10'),this['syncDialEnd']['bind'](this));ami['on'](_0x423f('0x11'),this['syncVarSet'][_0x423f('0xf')](this));ami['on'](_0x423f('0x12'),this[_0x423f('0x13')]['bind'](this));}VoiceDialReport[_0x423f('0x14')][_0x423f('0x15')]=function(_0x1d35ba){return _0x1d35ba!==null&&!_[_0x423f('0x16')](_0x1d35ba);};VoiceDialReport[_0x423f('0x14')][_0x423f('0x17')]=function(_0x3383b6,_0x2655b0,_0x3f7932){io['to'](_0x3383b6)[_0x423f('0x17')](_0x2655b0,_0x3f7932);};VoiceDialReport[_0x423f('0x14')][_0x423f('0xe')]=function(_0x5b4239){try{if(this[_0x423f('0x15')](_0x5b4239)){logger[_0x423f('0x18')](_0x423f('0x19'),_0x5b4239[_0x423f('0x1a')],util[_0x423f('0x1b')](_0x5b4239,{'showHidden':![],'depth':null}));if(this[_0x423f('0x1c')][_0x5b4239[_0x423f('0x1a')]]){_['merge'](this[_0x423f('0x1c')][_0x5b4239[_0x423f('0x1a')]],{'starttime':moment()[_0x423f('0x1d')](_0x423f('0x1e')),'lastevent':_0x423f('0x1f'),'interface':_0x5b4239['channel'][_0x423f('0x20')](0x0,_0x5b4239['channel'][_0x423f('0x21')]('-')),'membername':_0x5b4239[_0x423f('0x22')][_0x423f('0x20')](_0x5b4239[_0x423f('0x22')][_0x423f('0x21')]('/')+0x1,_0x5b4239[_0x423f('0x22')][_0x423f('0x21')]('-'))},_[_0x423f('0x23')](_0x5b4239,[_0x423f('0x24'),_0x423f('0x25')]));logger[_0x423f('0x26')](_0x423f('0x27'),_0x5b4239[_0x423f('0x1a')],this[_0x423f('0x1c')][_0x5b4239[_0x423f('0x1a')]][_0x423f('0x28')],this[_0x423f('0x1c')][_0x5b4239[_0x423f('0x1a')]][_0x423f('0x29')]);logger[_0x423f('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5b4239['uniqueid'],util[_0x423f('0x1b')](this[_0x423f('0x1c')][_0x5b4239[_0x423f('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0x423f('0xb')][_0x5b4239[_0x423f('0x1a')]])_['merge'](this[_0x423f('0x1c')][_0x5b4239[_0x423f('0x1a')]],this[_0x423f('0xb')][_0x5b4239['uniqueid']]);this['emit'](_0x423f('0x2a'),'voice_outbound_channel:save',this[_0x423f('0x1c')][_0x5b4239[_0x423f('0x1a')]]);logger[_0x423f('0x18')](_0x423f('0x2b'),_0x5b4239['uniqueid'],util[_0x423f('0x1b')](this[_0x423f('0x1c')][_0x5b4239[_0x423f('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x423f('0x17')](_0x423f('0x2c'),this[_0x423f('0x1c')][_0x5b4239['uniqueid']]);}}}catch(_0x2c0e28){logger[_0x423f('0x2d')](_0x423f('0x2e'),_0x5b4239[_0x423f('0x1a')],util[_0x423f('0x1b')](_0x2c0e28,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x423f('0x2f')]=function(_0x409cf0){try{if(this[_0x423f('0x15')](_0x409cf0)){logger['debug'](_0x423f('0x30'),_0x409cf0[_0x423f('0x1a')],util['inspect'](_0x409cf0,{'showHidden':![],'depth':null}));if(this[_0x423f('0x1c')][_0x409cf0[_0x423f('0x1a')]]){this['channels'][_0x409cf0[_0x423f('0x1a')]][_0x423f('0x31')]=_0x409cf0[_0x423f('0x31')];if(_0x409cf0[_0x423f('0x31')]===_0x423f('0x32')){this[_0x423f('0x1c')][_0x409cf0['uniqueid']]['connectedlinenum']=_0x409cf0[_0x423f('0x33')];this[_0x423f('0x1c')][_0x409cf0[_0x423f('0x1a')]][_0x423f('0x34')]=_0x409cf0[_0x423f('0x34')];this[_0x423f('0x1c')][_0x409cf0[_0x423f('0x1a')]][_0x423f('0x35')]=moment()[_0x423f('0x1d')](_0x423f('0x1e'));this[_0x423f('0x1c')][_0x409cf0[_0x423f('0x1a')]][_0x423f('0x36')]=_0x423f('0x37');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x409cf0[_0x423f('0x1a')],_0x409cf0[_0x423f('0x22')]['substring'](_0x409cf0['channel']['lastIndexOf']('/')+0x1,_0x409cf0['channel'][_0x423f('0x21')]('-')));logger[_0x423f('0x18')](_0x423f('0x38'),_0x409cf0[_0x423f('0x1a')],util['inspect'](this[_0x423f('0x1c')][_0x409cf0[_0x423f('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x423f('0x17')]('custom:dialconnect',this[_0x423f('0x1c')][_0x409cf0[_0x423f('0x1a')]]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x409cf0[_0x423f('0x1a')],util['inspect'](this[_0x423f('0x1c')][_0x409cf0[_0x423f('0x1a')]],{'showHidden':![],'depth':null}));this[_0x423f('0x17')]('voice:outbound',_0x423f('0x39'),this[_0x423f('0x1c')][_0x409cf0[_0x423f('0x1a')]]);}}}catch(_0x32f1b3){logger[_0x423f('0x2d')](_0x423f('0x3a'),_0x409cf0[_0x423f('0x1a')],util[_0x423f('0x1b')](_0x32f1b3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x423f('0x14')][_0x423f('0x3b')]=function(_0x7c50ae){try{if(this[_0x423f('0x15')](_0x7c50ae)){logger['debug'](_0x423f('0x3c'),_0x7c50ae[_0x423f('0x1a')],util['inspect'](_0x7c50ae,{'showHidden':![],'depth':null}));this[_0x423f('0x3d')](_0x7c50ae[_0x423f('0x1a')],_['keys'](_0x7c50ae[_0x423f('0x3e')])[0x0],_0x7c50ae[_0x423f('0x3f')]);if(this[_0x423f('0x15')](_0x7c50ae[_0x423f('0x3e')])&&this[_0x423f('0x15')](_0x7c50ae[_0x423f('0x3e')]['outboundrouteid'])){if(_[_0x423f('0x16')](this[_0x423f('0x1c')][_0x7c50ae[_0x423f('0x1a')]])){this[_0x423f('0x1c')][_0x7c50ae[_0x423f('0x1a')]]={'routeId':_0x7c50ae['value'],'variables':this[_0x423f('0xc')][_0x7c50ae[_0x423f('0x1a')]],'motionChannel':'voice'};logger[_0x423f('0x26')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x7c50ae[_0x423f('0x1a')],_0x7c50ae['variable'][_0x423f('0x40')],_[_0x423f('0x41')](_0x7c50ae[_0x423f('0x3e')])[0x0],_0x7c50ae[_0x423f('0x3f')]);logger[_0x423f('0x18')](_0x423f('0x42'),_0x7c50ae[_0x423f('0x1a')],util[_0x423f('0x1b')](this['channels'][_0x7c50ae[_0x423f('0x1a')]],{'showHidden':![],'depth':null}));this[_0x423f('0x17')]('voice:outbound',_0x423f('0x39'),this[_0x423f('0x1c')][_0x7c50ae[_0x423f('0x1a')]]);}}}}catch(_0x5a6267){logger[_0x423f('0x2d')](_0x423f('0x43'),_0x7c50ae[_0x423f('0x1a')],util[_0x423f('0x1b')](_0x5a6267,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x423f('0x14')][_0x423f('0x3d')]=function(_0x4bad2c,_0x552ce7,_0x24ad8f){var _0x417821=['rtpaudioqos',_0x423f('0x44'),_0x423f('0x45'),'rtpaudioqosjitterbridged',_0x423f('0x46'),_0x423f('0x47'),_0x423f('0x48'),'rtpaudioqosrttbridged','sipcallid',_0x423f('0x49'),_0x423f('0x4a'),_0x423f('0x4b'),_0x423f('0x4c'),'memberdynamic','memberinterface',_0x423f('0x4d'),'membername',_0x423f('0x4e'),_0x423f('0x4f')];if(!_['isNil'](_0x552ce7)&&!_[_0x423f('0x50')](_0x417821,_0x552ce7)){if(_[_0x423f('0x16')](this[_0x423f('0xc')][_0x4bad2c])){this[_0x423f('0xc')][_0x4bad2c]={};}this['variables'][_0x4bad2c][_0x552ce7]=_0x24ad8f;}};VoiceDialReport[_0x423f('0x14')]['syncHangup']=function(_0x536a9e){try{if(this[_0x423f('0x15')](_0x536a9e)){logger[_0x423f('0x18')](_0x423f('0x51'),_0x536a9e[_0x423f('0x1a')],util[_0x423f('0x1b')](_0x536a9e,{'showHidden':![],'depth':null}));if(this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]]){logger[_0x423f('0x26')](_0x423f('0x52'),_0x536a9e[_0x423f('0x1a')],_0x536a9e[_0x423f('0x53')]);this['channels'][_0x536a9e[_0x423f('0x1a')]][_0x423f('0x54')]=moment()[_0x423f('0x1d')](_0x423f('0x1e'));this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]]['duration']=moment(this[_0x423f('0x1c')][_0x536a9e['uniqueid']][_0x423f('0x54')])['diff'](this['channels'][_0x536a9e[_0x423f('0x1a')]][_0x423f('0x55')],'seconds');this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]]['lastevent']=_0x423f('0x56');this[_0x423f('0xa')][_0x423f('0x57')]+=0x1;if(this['channels'][_0x536a9e['uniqueid']][_0x423f('0x35')]){this[_0x423f('0xa')][_0x423f('0x58')]+=0x1;this[_0x423f('0x1c')][_0x536a9e['uniqueid']][_0x423f('0x59')]=moment(this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]][_0x423f('0x35')])['diff'](this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]][_0x423f('0x55')],_0x423f('0x5a'));this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]][_0x423f('0x5b')]=moment(this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]][_0x423f('0x54')])[_0x423f('0x5c')](this['channels'][_0x536a9e[_0x423f('0x1a')]][_0x423f('0x35')],_0x423f('0x5a'));this[_0x423f('0xa')]['sumHoldTime']+=this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]][_0x423f('0x59')]||0x0;this[_0x423f('0xa')][_0x423f('0x5d')]+=this['channels'][_0x536a9e['uniqueid']]['billableseconds'];}this[_0x423f('0xa')]['sumDuration']+=this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]][_0x423f('0x5e')];logger['debug'](_0x423f('0x5f'),_0x536a9e[_0x423f('0x1a')],util[_0x423f('0x1b')](this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x423f('0x17')](_0x423f('0x60'),this[_0x423f('0x1c')][_0x536a9e['uniqueid']]);logger['debug'](_0x423f('0x61'),_0x536a9e[_0x423f('0x1a')],util[_0x423f('0x1b')](this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x423f('0x62'),this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]]);logger['debug'](_0x423f('0x63'),_0x536a9e['uniqueid'],util[_0x423f('0x1b')](this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]],{'showHidden':![],'depth':null}));this[_0x423f('0x17')]('voice:outbound',_0x423f('0x64'),this[_0x423f('0xa')]);logger[_0x423f('0x26')](_0x423f('0x65'),JSON[_0x423f('0x66')](this['channels'][_0x536a9e['uniqueid']]));logger[_0x423f('0x18')](_0x423f('0x67'),_0x536a9e[_0x423f('0x1a')],util[_0x423f('0x1b')](this[_0x423f('0x1c')][_0x536a9e['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x423f('0x2a'),_0x423f('0x68'),this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x1a')]]);this[_0x423f('0x69')](_0x536a9e['uniqueid']);}else if(this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x6a')]]){this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x6a')]][_0x423f('0x1a')]=this[_0x423f('0x1c')][_0x536a9e[_0x423f('0x6a')]][_0x423f('0x6b')];}if(this['variables'][_0x536a9e[_0x423f('0x1a')]]){delete this['variables'][_0x536a9e[_0x423f('0x1a')]];}}}catch(_0x19a0ac){logger['error'](_0x423f('0x6c'),_0x536a9e['uniqueid'],util[_0x423f('0x1b')](_0x19a0ac,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x423f('0x6d')]=function(_0x2d32b3){try{if(this[_0x423f('0x15')](_0x2d32b3)){logger[_0x423f('0x18')](_0x423f('0x6e'),_0x2d32b3[_0x423f('0x1a')],util[_0x423f('0x1b')](_0x2d32b3,{'showHidden':![],'depth':null}));if(_0x2d32b3[_0x423f('0x6f')]['toLowerCase']()===_0x423f('0x70')){_0x2d32b3[_0x423f('0x71')]=(_0x2d32b3[_0x423f('0x72')]||_0x2d32b3[_0x423f('0x71')])['toLowerCase']();if(_['startsWith'](_0x2d32b3[_0x423f('0x71')],_0x423f('0x73'))){if(_[_0x423f('0x16')](this[_0x423f('0xb')][_0x2d32b3[_0x423f('0x1a')]]))this['applications'][_0x2d32b3[_0x423f('0x1a')]]={};logger[_0x423f('0x26')](_0x423f('0x74'),_0x2d32b3[_0x423f('0x1a')],_0x2d32b3[_0x423f('0x6f')],_0x2d32b3[_0x423f('0x71')]);var _0x102c8e=_0x2d32b3[_0x423f('0x71')]['split']('=');var _0x39252f=_0x102c8e[0x0][_0x423f('0x75')](/cdr\((.*)\)/);if(_0x39252f)this[_0x423f('0xb')][_0x2d32b3[_0x423f('0x1a')]][_0x39252f[0x1]]=_0x102c8e[0x1];}}}}catch(_0x546378){logger[_0x423f('0x2d')]('[%s][voiceDialReport][newexten]',_0x2d32b3[_0x423f('0x1a')],util[_0x423f('0x1b')](_0x546378,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x423f('0x14')][_0x423f('0x69')]=function(_0x323a14,_0x140816=0x2710){if(this[_0x423f('0x1c')][_0x323a14]){setTimeout(()=>{delete this[_0x423f('0x1c')][_0x323a14];},_0x140816);}};module[_0x423f('0x76')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 16947c5..66e0b85 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02cd=['syncHangup','BlindTransfer','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','queueReports','realtime','agents','channels','queueChannels','voiceQueues','summary','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuestatuscomplete','syncQueueStatusComplete','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','clearZombieChannels','switch','isNil','Action','status','channel','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','campaigns','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][','format','voice:queue:%s','queue','voice_queue_channel:save','emitVoiceQueueChannelRemove','debug','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','queues','catch','[voiceQueueReport][queues]','isRunning','queuesummary','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','name','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','outbound','custom:queuesummary','statusRequests','syncQueueMember','queuestatus','push','completeEvent','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','syncQueueCallerJoin','[%s][voiceQueueReport][queuecallerjoin]','uniqueid','queuecallerjoinAt','position','count','info','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','lastAssignedTo','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][queuecallerleave]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','membername','queuecallerexitAt','transfer','reason','COMPLETED','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','keys','variable','value','CONTINUE','TIMEOUT','timeout','queuecallerleaveAt','queueposition','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberpenalty','includes','length','sumHoldTime','diff','COMPLETEDBYAGENT','milliseconds','total','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','handleHangup','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','transferexten','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','syncBlindTransfer','BLINDTRANSFER','BLIND'];(function(_0x5f1e1c,_0x329fc6){var _0x5981f5=function(_0x2f1db5){while(--_0x2f1db5){_0x5f1e1c['push'](_0x5f1e1c['shift']());}};_0x5981f5(++_0x329fc6);}(_0x02cd,0xf7));var _0xd02c=function(_0x3c4087,_0x5c764b){_0x3c4087=_0x3c4087-0x0;var _0x23ad1f=_0x02cd[_0x3c4087];return _0x23ad1f;};'use strict';var _=require(_0xd02c('0x0'));var moment=require(_0xd02c('0x1'));var util=require(_0xd02c('0x2'));var Redis=require(_0xd02c('0x3'));var config=require(_0xd02c('0x4'));var logger=require(_0xd02c('0x5'))(_0xd02c('0x6'));var ami=require('../ami');var QueueReport=require(_0xd02c('0x7'));var VoiceQueueSummary=require(_0xd02c('0x8'));config[_0xd02c('0x9')]=_[_0xd02c('0xa')](config[_0xd02c('0x9')],{'host':_0xd02c('0xb'),'port':0x18eb});var io=require(_0xd02c('0xc'))(new Redis(config[_0xd02c('0x9')]));var Sequence=function(){};Sequence[_0xd02c('0xd')][_0xd02c('0xe')]=function(_0x43e7a1){this[_0xd02c('0xf')]=this[_0xd02c('0xf')]?this[_0xd02c('0xf')]['finally'](_0x43e7a1):_0x43e7a1();};function VoiceQueueReport(_0x111426){this['sequence']=new Sequence();this[_0xd02c('0x10')]={};this[_0xd02c('0x11')]=_0x111426;this['agents']=_0x111426[_0xd02c('0x12')];this[_0xd02c('0x13')]=_0x111426[_0xd02c('0x14')];this[_0xd02c('0x15')]=_0x111426[_0xd02c('0x15')];this['campaigns']=_0x111426['campaigns'];this[_0xd02c('0x16')]=initializeSummary();this[_0xd02c('0x17')]={};ami['on']('queuesummary',this[_0xd02c('0x18')][_0xd02c('0x19')](this));ami['on'](_0xd02c('0x1a'),this[_0xd02c('0x1b')][_0xd02c('0x19')](this));ami['on']('queuemember',this['syncQueueMember'][_0xd02c('0x19')](this));ami['on'](_0xd02c('0x1c'),this[_0xd02c('0x1d')][_0xd02c('0x19')](this));ami['on']('queuecallerjoin',this['syncQueueCallerJoin']['bind'](this));ami['on'](_0xd02c('0x1e'),this[_0xd02c('0x1f')][_0xd02c('0x19')](this));ami['on'](_0xd02c('0x20'),this['syncQueueCallerLeave'][_0xd02c('0x19')](this));ami['on'](_0xd02c('0x21'),this[_0xd02c('0x22')][_0xd02c('0x19')](this));ami['on'](_0xd02c('0x23'),this[_0xd02c('0x24')][_0xd02c('0x19')](this));ami['on'](_0xd02c('0x25'),this[_0xd02c('0x26')][_0xd02c('0x19')](this));ami['on'](_0xd02c('0x27'),this['syncHangup']['bind'](this));ami['on']('fullybooted',this[_0xd02c('0x28')][_0xd02c('0x19')](this));ami['on'](_0xd02c('0x29'),this[_0xd02c('0x2a')][_0xd02c('0x19')](this));ami['on'](_0xd02c('0x2b'),this[_0xd02c('0x2c')]['bind'](this));ami['on'](_0xd02c('0x2d'),this[_0xd02c('0x2e')][_0xd02c('0x19')](this));ami['on'](_0xd02c('0x2f'),this['syncBlindTransfer']['bind'](this));this[_0xd02c('0x30')]();this[_0xd02c('0x31')]();}function clearChannels(_0xa4b80a){if(!_[_0xd02c('0x32')](_0xa4b80a)){for(var _0x567283 in _0xa4b80a){if(_0xa4b80a['hasOwnProperty'](_0x567283)){delete _0xa4b80a[_0x567283];}}}}function clearCampaigns(_0x33271b){if(!_['isEmpty'](_0x33271b)){for(var _0x4b3425 in _0x33271b){if(_0x33271b[_0xd02c('0x33')](_0x4b3425)){_0x33271b[_0x4b3425][_0xd02c('0x34')]=0x0;}}}}function clearVoiceQueues(_0x25fca9){if(!_[_0xd02c('0x32')](_0x25fca9)){for(var _0x54a555 in _0x25fca9){if(_0x25fca9['hasOwnProperty'](_0x54a555)){_0x25fca9[_0x54a555][_0xd02c('0x34')]=0x0;_0x25fca9[_0x54a555]['talking']=0x0;_0x25fca9[_0x54a555][_0xd02c('0x35')]=0x0;_0x25fca9[_0x54a555][_0xd02c('0x36')]=0x0;_0x25fca9[_0x54a555][_0xd02c('0x37')]=!![];}}}}function clearAgentBooked(_0x117a57){if(!_[_0xd02c('0x32')](_0x117a57)){for(var _0x549523 in _0x117a57){if(_0x117a57[_0xd02c('0x33')](_0x549523)){_0x117a57[_0x549523][_0xd02c('0x38')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x1edeab){return _0x1edeab[_0xd02c('0x39')]||_0x1edeab[_0xd02c('0x1e')]||_0x1edeab[_0xd02c('0x3a')];}VoiceQueueReport[_0xd02c('0xd')][_0xd02c('0x3b')]=function(){var _0x5d0112=this;for(var _0x3b9a37 in this[_0xd02c('0x13')]){if(this[_0xd02c('0x13')][_0xd02c('0x33')](_0x3b9a37)&&!this['channels'][_0x3b9a37][_0xd02c('0x3c')]){this['sequence'][_0xd02c('0xe')](function(){if(!_[_0xd02c('0x3d')](_0x5d0112[_0xd02c('0x13')][_0x3b9a37])){return ami[_0xd02c('0x3e')]({'action':_0xd02c('0x3f'),'channel':_0x5d0112[_0xd02c('0x13')][_0x3b9a37][_0xd02c('0x40')]})['catch'](function(_0x331387){if(_0x331387[_0xd02c('0x41')]===_0xd02c('0x42')){setTimeout(function(){if(_0x5d0112[_0xd02c('0x13')][_0x3b9a37]){delete _0x5d0112[_0xd02c('0x13')][_0x3b9a37];logger[_0xd02c('0x43')](_0xd02c('0x44'),_0x3b9a37,util['inspect'](_0x331387,{'showHidden':![],'depth':null}));}if(_0x5d0112[_0xd02c('0x10')][_0x3b9a37]){delete _0x5d0112[_0xd02c('0x10')][_0x3b9a37];logger[_0xd02c('0x43')](_0xd02c('0x45'),_0x3b9a37,util[_0xd02c('0x46')](_0x331387,{'showHidden':![],'depth':null}));}if(_0x5d0112['variables'][_0x3b9a37]){delete _0x5d0112[_0xd02c('0x17')][_0x3b9a37];logger[_0xd02c('0x43')](_0xd02c('0x47'),_0x3b9a37,util[_0xd02c('0x46')](_0x331387,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xd02c('0x28')]=function(){logger[_0xd02c('0x43')](_0xd02c('0x48'));clearChannels(this[_0xd02c('0x13')]);this[_0xd02c('0x49')](this[_0xd02c('0x10')]);clearAgentBooked(this[_0xd02c('0x12')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xd02c('0x4a')]);this[_0xd02c('0x16')]=initializeSummary();};VoiceQueueReport['prototype'][_0xd02c('0x49')]=function(_0x43ff0e){var _0x2577f3=this;if(!_['isEmpty'](_0x43ff0e)){for(var _0x3019b4 in _0x43ff0e){if(_0x43ff0e[_0xd02c('0x33')](_0x3019b4)){_0x2577f3['emitVoiceQueueChannelRemove'](_0x43ff0e[_0x3019b4],_0xd02c('0x4b'));delete _0x43ff0e[_0x3019b4];}}}};VoiceQueueReport[_0xd02c('0xd')]['emit']=function(_0x58a092,_0xbffddd,_0x25da86){io['to'](_0x58a092)[_0xd02c('0x4c')](_0xbffddd,_0x25da86);};VoiceQueueReport[_0xd02c('0xd')][_0xd02c('0x4d')]=function(_0x365a95,_0x5d3c6f){logger['debug'](_0xd02c('0x4e')+_0x5d3c6f+']\x20sending\x20voice_queue_channel:save\x20event:',_0x365a95['uniqueid'],util[_0xd02c('0x46')](_0x365a95,{'showHidden':![],'depth':null}));this['emit'](util[_0xd02c('0x4f')](_0xd02c('0x50'),_0x365a95[_0xd02c('0x51')]),_0xd02c('0x52'),_0x365a95);io['emit']('voice_queue_presence:save',_0x365a95);};VoiceQueueReport[_0xd02c('0xd')][_0xd02c('0x53')]=function(_0x533f3b,_0x1e9c86){logger[_0xd02c('0x54')]('[%s][voiceQueueReport]['+_0x1e9c86+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x533f3b['uniqueid'],util[_0xd02c('0x46')](_0x533f3b,{'showHidden':![],'depth':null}));if(_0x533f3b[_0xd02c('0x55')]===_0xd02c('0x56')){return;}this[_0xd02c('0x4c')](util[_0xd02c('0x4f')](_0xd02c('0x50'),_0x533f3b[_0xd02c('0x51')]),'voice_queue_channel:remove',_0x533f3b);io[_0xd02c('0x4c')](_0xd02c('0x57'),_0x533f3b);};VoiceQueueReport[_0xd02c('0xd')][_0xd02c('0x58')]=function(_0x449817){if(_0x449817[_0xd02c('0x59')]===_0xd02c('0x5a')){logger[_0xd02c('0x54')](_0xd02c('0x5b'),util[_0xd02c('0x46')](_0x449817,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xd02c('0x50'),_0x449817['name']),_0xd02c('0x5c'),_0x449817);}};VoiceQueueReport[_0xd02c('0xd')][_0xd02c('0x5d')]=function(_0x25e2d5){return _0x25e2d5!==null&&!_[_0xd02c('0x5e')](_0x25e2d5);};VoiceQueueReport[_0xd02c('0xd')]['loopQueueShow']=function(){var _0x2ff42b=this;setInterval(function(){_0x2ff42b['clearZombieChannels']();ami[_0xd02c('0x3e')]({'action':_0xd02c('0x5f')})[_0xd02c('0x60')](function(_0x2d426a){logger[_0xd02c('0x43')](_0xd02c('0x61'),util[_0xd02c('0x46')](_0x2d426a,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype']['loopQueueSummary']=function(){var _0x417ee6=this;setInterval(function(){if(!_0x417ee6['summary'][_0xd02c('0x62')]){return ami[_0xd02c('0x3e')]({'action':_0xd02c('0x63')})[_0xd02c('0x64')](function(_0x129090){_0x417ee6['summary']['id']=_0x129090['actionid'];_0x417ee6[_0xd02c('0x16')][_0xd02c('0x62')]=!![];_0x417ee6[_0xd02c('0x16')]['queuestatus'][_0x129090[_0xd02c('0x65')]]={};})[_0xd02c('0x60')](function(_0x4b7a75){logger['error'](_0xd02c('0x66'),util[_0xd02c('0x46')](_0x4b7a75,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xd02c('0xd')][_0xd02c('0x67')]=function(_0x5e38a0,_0x250502){var _0x5afc95;if(this['summary']&&this[_0xd02c('0x16')][_0xd02c('0x5f')]&&this['summary']['queues'][_0x5e38a0[_0xd02c('0x68')]]){_0x5afc95=this['summary'][_0xd02c('0x5f')][_0x5e38a0[_0xd02c('0x68')]]['summaryEvent'];}var _0x586f08=new VoiceQueueSummary(_0x5e38a0);return _0x586f08[_0xd02c('0x69')](_0x250502[_0xd02c('0x12')],this[_0xd02c('0x12')],_0x5afc95,this[_0xd02c('0x11')][_0xd02c('0x13')]);};VoiceQueueReport[_0xd02c('0xd')][_0xd02c('0x6a')]=function(_0x3354c7,_0x36105c){var _0x55f6a8=this[_0xd02c('0x67')](_0x3354c7,_0x36105c);var _0x1e51c4=![];_0x1e51c4=_0x55f6a8[_0xd02c('0x6b')](_0x3354c7);if(_0x1e51c4){Object[_0xd02c('0x6c')](_0x3354c7,_0x55f6a8);this[_0xd02c('0x11')]['voiceQueues'][_0x3354c7[_0xd02c('0x68')]]=_0x3354c7;this[_0xd02c('0x58')](_0x55f6a8);}};VoiceQueueReport[_0xd02c('0xd')][_0xd02c('0x1d')]=function(_0x3f4df7){var _0x5aef47=null;var _0x4c2dd1=this[_0xd02c('0x16')]['id'];if(this[_0xd02c('0x16')]['queuestatus'][_0x4c2dd1]){_0x5aef47=this[_0xd02c('0x16')]['queuestatus'][_0x4c2dd1][_0x3f4df7['actionid']];}if(!_0x5aef47){this['summary']=initializeSummary();return;}var _0x32b930=this[_0xd02c('0x15')][_0x5aef47[_0xd02c('0x51')]];if(_0x32b930['type']==='inbound'){this[_0xd02c('0x6a')](_0x32b930,_0x5aef47);}else if(_0x32b930[_0xd02c('0x59')]===_0xd02c('0x6d')){var _0x246b58=this['createQueueSummaryReport'](_0x32b930,_0x5aef47);ami[_0xd02c('0x4c')](_0xd02c('0x6e'),_0x246b58);}this[_0xd02c('0x16')]['statusRequests']-=0x1;var _0x569ebe=this[_0xd02c('0x16')][_0xd02c('0x6f')]>0x0?!![]:![];if(!_0x569ebe){return this[_0xd02c('0x1b')](this[_0xd02c('0x16')]['completeEvent']);}};VoiceQueueReport['prototype'][_0xd02c('0x70')]=function(_0x3127b3){var _0xd92747=this[_0xd02c('0x16')]['id'];if(this[_0xd02c('0x16')][_0xd02c('0x71')][_0xd92747]&&this[_0xd02c('0x16')][_0xd02c('0x71')][_0xd92747][_0x3127b3[_0xd02c('0x65')]]){this['summary'][_0xd02c('0x71')][_0xd92747][_0x3127b3[_0xd02c('0x65')]][_0xd02c('0x12')][_0xd02c('0x72')](_0x3127b3);}};VoiceQueueReport[_0xd02c('0xd')][_0xd02c('0x18')]=function(_0x1c8d9e){var _0x3ff775=this;try{if(this[_0xd02c('0x5d')](_0x1c8d9e)&&this[_0xd02c('0x5d')](_0x1c8d9e[_0xd02c('0x51')])){logger[_0xd02c('0x54')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x1c8d9e,{'showHidden':![],'depth':null}));var _0x48f2a=this[_0xd02c('0x15')][_0x1c8d9e[_0xd02c('0x51')]];if(_0x48f2a){logger[_0xd02c('0x54')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x48f2a[_0xd02c('0x68')]);this[_0xd02c('0x16')][_0xd02c('0x5f')][_0x48f2a[_0xd02c('0x68')]]={'summaryEvent':_0x1c8d9e};this['summary'][_0xd02c('0x6f')]+=0x1;return ami[_0xd02c('0x3e')]({'action':_0xd02c('0x71'),'queue':_0x48f2a[_0xd02c('0x68')]})[_0xd02c('0x64')](function(_0x15ccda){if(!_0x3ff775[_0xd02c('0x16')][_0xd02c('0x71')][_0x1c8d9e[_0xd02c('0x65')]]){_0x3ff775[_0xd02c('0x16')]['queuestatus'][_0x1c8d9e[_0xd02c('0x65')]]={};}_0x3ff775['summary'][_0xd02c('0x71')][_0x1c8d9e[_0xd02c('0x65')]][_0x15ccda['actionid']]={'queue':_0x48f2a[_0xd02c('0x68')],'agents':[]};})[_0xd02c('0x60')](function(_0x211b68){throw _0x211b68;});}}}catch(_0x75834a){logger[_0xd02c('0x43')]('[voiceQueueReport][queuesummary]',util[_0xd02c('0x46')](_0x75834a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd02c('0xd')]['syncQueueSummaryComplete']=function(_0x1a514a){if(this[_0xd02c('0x16')]['statusRequests']>0x0){this[_0xd02c('0x16')][_0xd02c('0x73')]=_0x1a514a;return;}logger[_0xd02c('0x54')](_0xd02c('0x74'),util[_0xd02c('0x46')](_0x1a514a,{'showHidden':![],'depth':null}));this[_0xd02c('0x16')]=initializeSummary();ami[_0xd02c('0x4c')](_0xd02c('0x75'),{});};VoiceQueueReport[_0xd02c('0xd')][_0xd02c('0x76')]=function(_0x3f6d0c){try{if(this[_0xd02c('0x5d')](_0x3f6d0c)){logger[_0xd02c('0x54')](_0xd02c('0x77'),_0x3f6d0c[_0xd02c('0x78')],util[_0xd02c('0x46')](_0x3f6d0c,{'showHidden':![],'depth':null}));if(_[_0xd02c('0x5e')](this['queueReports'][_0x3f6d0c['uniqueid']])){this[_0xd02c('0x10')][_0x3f6d0c[_0xd02c('0x78')]]=[];}if(_[_0xd02c('0x5e')](this[_0xd02c('0x13')][_0x3f6d0c['uniqueid']])){this[_0xd02c('0x13')][_0x3f6d0c[_0xd02c('0x78')]]={};}var _0x152424=new QueueReport();_0x152424['queue']=_0x3f6d0c['queue'];_0x152424[_0xd02c('0x59')]=this[_0xd02c('0x15')][_0x152424[_0xd02c('0x51')]]&&this[_0xd02c('0x15')][_0x152424[_0xd02c('0x51')]][_0xd02c('0x59')]?this[_0xd02c('0x15')][_0x152424[_0xd02c('0x51')]][_0xd02c('0x59')]||'inbound':_0xd02c('0x5a');_0x152424[_0xd02c('0x79')]=moment()[_0xd02c('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x152424[_0xd02c('0x7a')]=_0x3f6d0c[_0xd02c('0x7a')];_0x152424[_0xd02c('0x7b')]=_0x3f6d0c[_0xd02c('0x7b')];_0x152424[_0xd02c('0x78')]=_0x3f6d0c[_0xd02c('0x78')];logger[_0xd02c('0x7c')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x152424[_0xd02c('0x51')],_0x152424[_0xd02c('0x59')]);Object[_0xd02c('0x6c')](_0x152424,_['pick'](_0x3f6d0c,_['keys'](_0x152424)));this[_0xd02c('0x10')][_0x3f6d0c[_0xd02c('0x78')]]['push'](_0x152424);this[_0xd02c('0x13')][_0x3f6d0c[_0xd02c('0x78')]]=_0x152424;this['emitVoiceQueueChannelSave'](_0x152424,'queuecallerjoin');}}catch(_0x305522){logger[_0xd02c('0x43')](_0xd02c('0x77'),_0x3f6d0c[_0xd02c('0x78')],util[_0xd02c('0x46')](_0x305522,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd02c('0x1f')]=function(_0x4c5117){try{if(this['isNotNull'](_0x4c5117)){logger[_0xd02c('0x54')](_0xd02c('0x7d'),_0x4c5117[_0xd02c('0x78')],util[_0xd02c('0x46')](_0x4c5117,{'showHidden':![],'depth':null}));if(this[_0xd02c('0x10')][_0x4c5117[_0xd02c('0x78')]]){var _0x34f182=_[_0xd02c('0x7e')](this[_0xd02c('0x10')][_0x4c5117[_0xd02c('0x78')]]);_0x34f182[_0xd02c('0x3a')]=![];_0x34f182[_0xd02c('0x7f')]=null;_0x34f182[_0xd02c('0x80')]=_0x4c5117[_0xd02c('0x80')];_0x34f182[_0xd02c('0x81')]=_0x4c5117[_0xd02c('0x81')];_0x34f182[_0xd02c('0x1e')]=!![];_0x34f182[_0xd02c('0x82')]=moment()['format'](_0xd02c('0x83'));_0x34f182[_0xd02c('0x55')]='ABANDONED';_0x34f182[_0xd02c('0x84')]=null;logger[_0xd02c('0x7c')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x34f182['queue'],_0x34f182[_0xd02c('0x59')]);this[_0xd02c('0x13')][_0x4c5117[_0xd02c('0x78')]]=_0x34f182;this[_0xd02c('0x53')](_0x34f182,'queuecallerabandon');}}}catch(_0xe6af5f){logger['error'](_0xd02c('0x7d'),_0x4c5117[_0xd02c('0x78')],util['inspect'](_0xe6af5f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x145f6a){try{if(this['isNotNull'](_0x145f6a)){logger[_0xd02c('0x54')]('[%s][voiceQueueReport][queuecallerleave]',_0x145f6a[_0xd02c('0x78')],util['inspect'](_0x145f6a,{'showHidden':![],'depth':null}));if(this[_0xd02c('0x10')][_0x145f6a['uniqueid']]){var _0x8ec910=_['last'](this['queueReports'][_0x145f6a[_0xd02c('0x78')]]);_0x8ec910['queuecallerleaveAt']=moment()[_0xd02c('0x4f')](_0xd02c('0x83'));_0x8ec910[_0xd02c('0x85')]=_0x145f6a['connectedlinenum'];_0x8ec910[_0xd02c('0x86')]=_0x145f6a[_0xd02c('0x86')];logger[_0xd02c('0x7c')](_0xd02c('0x87'),_0x8ec910[_0xd02c('0x51')],_0x8ec910[_0xd02c('0x59')],_0x145f6a['connectedlinenum'],_0x145f6a['connectedlinename']);this[_0xd02c('0x13')][_0x145f6a[_0xd02c('0x78')]]=_0x8ec910;this[_0xd02c('0x4d')](_0x8ec910,_0xd02c('0x20'));}}}catch(_0x4a727e){logger[_0xd02c('0x43')](_0xd02c('0x88'),_0x145f6a[_0xd02c('0x78')],util[_0xd02c('0x46')](_0x4a727e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd02c('0xd')]['syncAgentConnect']=function(_0x3108f2){try{if(this[_0xd02c('0x5d')](_0x3108f2)){logger[_0xd02c('0x54')]('[%s][voiceQueueReport][agentconnect]',_0x3108f2[_0xd02c('0x78')],util[_0xd02c('0x46')](_0x3108f2,{'showHidden':![],'depth':null}));if(this[_0xd02c('0x10')][_0x3108f2[_0xd02c('0x78')]]){var _0xcd649f=_[_0xd02c('0x7e')](this['queueReports'][_0x3108f2[_0xd02c('0x78')]]);_0xcd649f[_0xd02c('0x3a')]=!![];_0xcd649f[_0xd02c('0x55')]='COMPLETEDBYAGENT';logger[_0xd02c('0x7c')](_0xd02c('0x89'),_0xcd649f[_0xd02c('0x51')],_0xcd649f[_0xd02c('0x59')]);}}}catch(_0x142211){logger[_0xd02c('0x43')]('[%s][voiceQueueReport][agentconnect]',_0x3108f2[_0xd02c('0x78')],util[_0xd02c('0x46')](_0x142211,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd02c('0x22')]=function(_0x521452){try{if(this[_0xd02c('0x5d')](_0x521452)){logger['debug'](_0xd02c('0x8a'),_0x521452[_0xd02c('0x78')],util[_0xd02c('0x46')](_0x521452,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x521452[_0xd02c('0x78')]]){var _0x2a128a=_['last'](this[_0xd02c('0x10')][_0x521452[_0xd02c('0x78')]]);_0x2a128a[_0xd02c('0x1e')]=![];_0x2a128a[_0xd02c('0x82')]=null;_0x2a128a['assigned']=!![];_0x2a128a[_0xd02c('0x84')]=_0x521452[_0xd02c('0x8b')];_0x2a128a[_0xd02c('0x80')]=_0x521452[_0xd02c('0x80')];_0x2a128a['queuecallercomplete']=!![];_0x2a128a[_0xd02c('0x39')]=![];_0x2a128a[_0xd02c('0x8c')]=null;if(!_0x2a128a[_0xd02c('0x8d')]){if(_0x521452[_0xd02c('0x8e')]=='transfer'){_0x2a128a[_0xd02c('0x55')]=_0xd02c('0x8f');logger[_0xd02c('0x7c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x2a128a[_0xd02c('0x51')],_0x2a128a[_0xd02c('0x59')]);}else{if(_['startsWith'](_0x521452[_0xd02c('0x40')]['toLowerCase'](),_0xd02c('0x90'))){if(this[_0xd02c('0x10')][_0x521452['linkedid']]){var _0x38f5ff=_['last'](this[_0xd02c('0x10')][_0x521452[_0xd02c('0x91')]]);_0x38f5ff[_0xd02c('0x3a')]=![];_0x38f5ff['queuecallerexit']=!![];_0x38f5ff[_0xd02c('0x8c')]=moment(_0x2a128a[_0xd02c('0x79')])['add'](_0x521452[_0xd02c('0x80')],_0xd02c('0x92'))['format'](_0xd02c('0x83'));_0x38f5ff['queuecallerexitreason']=_0xd02c('0x93');_0x38f5ff[_0xd02c('0x8d')]=!![];_0x38f5ff[_0xd02c('0x94')]=_0xd02c('0x95');_0x38f5ff['transferexten']=_0x521452['destexten'];_0x38f5ff[_0xd02c('0x96')]=_0x521452['uniqueid'];logger[_0xd02c('0x7c')](_0xd02c('0x97'),_0x38f5ff[_0xd02c('0x51')],_0x38f5ff[_0xd02c('0x59')]);var _0x3d082c=this[_0xd02c('0x10')][_0x521452[_0xd02c('0x91')]];this[_0xd02c('0x10')][_0x521452[_0xd02c('0x91')]]=this[_0xd02c('0x10')][_0x521452['uniqueid']];this[_0xd02c('0x10')][_0x521452['uniqueid']]=_0x3d082c;}}else{_0x2a128a[_0xd02c('0x55')]=_0xd02c('0x98')+_0x521452[_0xd02c('0x8e')][_0xd02c('0x99')]();logger[_0xd02c('0x7c')](_0xd02c('0x9a'),_0x2a128a[_0xd02c('0x51')],_0x2a128a['type'],_0x2a128a[_0xd02c('0x55')]);}}}this['channels'][_0x521452[_0xd02c('0x78')]]=_0x2a128a;}}}catch(_0x45ee4d){logger[_0xd02c('0x43')](_0xd02c('0x8a'),_0x521452[_0xd02c('0x78')],util['inspect'](_0x45ee4d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd02c('0x26')]=function(_0x2cd634){try{if(this['isNotNull'](_0x2cd634)){logger[_0xd02c('0x54')](_0xd02c('0x9b'),_0x2cd634[_0xd02c('0x78')],util[_0xd02c('0x46')](_0x2cd634,{'showHidden':![],'depth':null}));this[_0xd02c('0x9c')](_0x2cd634[_0xd02c('0x78')],_[_0xd02c('0x9d')](_0x2cd634[_0xd02c('0x9e')])[0x0],_0x2cd634[_0xd02c('0x9f')]);if(this[_0xd02c('0x10')][_0x2cd634[_0xd02c('0x78')]]){var _0x5a351a=_[_0xd02c('0x7e')](this[_0xd02c('0x10')][_0x2cd634[_0xd02c('0x78')]]);if(_0x5a351a){if(this[_0xd02c('0x5d')](_0x2cd634[_0xd02c('0x9e')])&&this[_0xd02c('0x5d')](_0x2cd634[_0xd02c('0x9e')][_0xd02c('0x71')])){switch(_0x2cd634['value']){case _0xd02c('0xa0'):_0x5a351a[_0xd02c('0x39')]=![];_0x5a351a[_0xd02c('0x8c')]=null;break;case _0xd02c('0xa1'):_0x5a351a['lastevent']=_0xd02c('0xa2');_0x5a351a[_0xd02c('0x39')]=!![];_0x5a351a['queuecallerexitAt']=moment()[_0xd02c('0x4f')](_0xd02c('0x83'));_0x5a351a[_0xd02c('0xa3')]=moment()[_0xd02c('0x4f')](_0xd02c('0x83'));logger[_0xd02c('0x54')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x2cd634[_0xd02c('0x78')],util[_0xd02c('0x46')](_0x5a351a,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x5a351a);break;default:_0x5a351a['queuecallerexit']=!![];_0x5a351a['queuecallerexitAt']=moment()['format'](_0xd02c('0x83'));_0x5a351a[_0xd02c('0xa3')]=moment()[_0xd02c('0x4f')](_0xd02c('0x83'));}_0x5a351a[_0xd02c('0x1e')]=![];_0x5a351a[_0xd02c('0x82')]=null;_0x5a351a['queuecallerexitreason']=_0x2cd634[_0xd02c('0x9f')];this[_0xd02c('0x13')][_0x2cd634[_0xd02c('0x78')]]=_0x5a351a;this['emitVoiceQueueChannelRemove'](_0x5a351a,'varset');}else if(this['isNotNull'](_0x2cd634[_0xd02c('0x9e')])&&this[_0xd02c('0x5d')](_0x2cd634[_0xd02c('0x9e')][_0xd02c('0xa4')])){if(!_0x5a351a[_0xd02c('0x1e')]){_0x5a351a['queuecallerexit']=!![];_0x5a351a['queuecallerexitAt']=moment()['format'](_0xd02c('0x83'));_0x5a351a[_0xd02c('0x55')]='EXITWITHKEY';_0x5a351a['queuecallerleaveAt']=moment()[_0xd02c('0x4f')](_0xd02c('0x83'));this['channels'][_0x2cd634[_0xd02c('0x78')]]=_0x5a351a;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x2cd634['uniqueid'],_0x5a351a[_0xd02c('0x51')],_0x5a351a[_0xd02c('0x59')],_[_0xd02c('0x9d')](_0x2cd634['variable'])[0x0],_0x2cd634[_0xd02c('0x9f')]);_0x5a351a[_0xd02c('0x17')]=this[_0xd02c('0x17')][_0x2cd634[_0xd02c('0x78')]];}}}}catch(_0x5b7092){logger[_0xd02c('0x43')]('[%s][voiceQueueReport][varset]',_0x2cd634[_0xd02c('0x78')],util[_0xd02c('0x46')](_0x5b7092,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd02c('0xd')]['addVariable']=function(_0x17ea1f,_0xffb694,_0x189278){var _0x4c21fd=['rtpaudioqos',_0xd02c('0xa5'),_0xd02c('0xa6'),'rtpaudioqosjitterbridged',_0xd02c('0xa7'),_0xd02c('0xa8'),_0xd02c('0xa9'),'rtpaudioqosrttbridged',_0xd02c('0xaa'),_0xd02c('0xab'),_0xd02c('0xac'),_0xd02c('0xad'),'membercalls','memberdynamic',_0xd02c('0xae'),'memberlastcall',_0xd02c('0x8b'),_0xd02c('0xaf'),'memberrealtime'];if(!_[_0xd02c('0x3d')](_0xffb694)&&!_[_0xd02c('0xb0')](_0x4c21fd,_0xffb694)){if(_['isUndefined'](this[_0xd02c('0x17')][_0x17ea1f])){this[_0xd02c('0x17')][_0x17ea1f]={};}this[_0xd02c('0x17')][_0x17ea1f][_0xffb694]=_0x189278;}};VoiceQueueReport[_0xd02c('0xd')]['handleHangup']=function(_0x33d66d,_0x23f509,_0x5885a1){try{var _0xd0d67c={};if(this[_0xd02c('0x10')][_0x33d66d]){for(var _0x28d66f=0x0;_0x28d66f{delete this['channels'][_0x1f5e4d];},_0x570d53);}};module['exports']=VoiceQueueReport; \ No newline at end of file +var _0xd1c7=['memberlastcall','memberrealtime','includes','length','sumHoldTime','diff','COMPLETEDBYAGENT','milliseconds','answered','sumBillable','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','handleHangup','cause-txt','transferid','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDED','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','syncMusicOnHoldStart','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','isNil','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','util','ioredis','../../../config/logger','../ami','../model/voiceQueueSummary','redis','localhost','prototype','enqueue','finally','queueReports','channels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueCallerJoin','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','queueStatusComplete','unlockRR','queuecallerexit','queuecallerabandon','sequence','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','agents','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','queues','then','actionid','isRunning','[voiceQueueReport][queuesummary]','createQueueSummaryReport','name','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','syncQueueStatusComplete','queuestatus','inbound','outbound','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','queuecallerjoin','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','syncAgentConnect','last','queuecallercomplete','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','membername','holdtime','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xd1c7,0x122));var _0x7d1c=function(_0x2eedb5,_0x2e1801){_0x2eedb5=_0x2eedb5-0x0;var _0x534cd6=_0xd1c7[_0x2eedb5];return _0x534cd6;};'use strict';var _=require(_0x7d1c('0x0'));var moment=require('moment');var util=require(_0x7d1c('0x1'));var Redis=require(_0x7d1c('0x2'));var config=require('../../../config/environment');var logger=require(_0x7d1c('0x3'))('ami');var ami=require(_0x7d1c('0x4'));var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require(_0x7d1c('0x5'));config[_0x7d1c('0x6')]=_['defaults'](config[_0x7d1c('0x6')],{'host':_0x7d1c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7d1c('0x6')]));var Sequence=function(){};Sequence[_0x7d1c('0x8')][_0x7d1c('0x9')]=function(_0x5d4505){this['tail']=this['tail']?this['tail'][_0x7d1c('0xa')](_0x5d4505):_0x5d4505();};function VoiceQueueReport(_0x9746af){this['sequence']=new Sequence();this[_0x7d1c('0xb')]={};this['realtime']=_0x9746af;this['agents']=_0x9746af['agents'];this[_0x7d1c('0xc')]=_0x9746af['queueChannels'];this['voiceQueues']=_0x9746af[_0x7d1c('0xd')];this[_0x7d1c('0xe')]=_0x9746af[_0x7d1c('0xe')];this[_0x7d1c('0xf')]=initializeSummary();this[_0x7d1c('0x10')]={};ami['on'](_0x7d1c('0x11'),this[_0x7d1c('0x12')][_0x7d1c('0x13')](this));ami['on']('queuesummarycomplete',this[_0x7d1c('0x14')]['bind'](this));ami['on'](_0x7d1c('0x15'),this[_0x7d1c('0x16')][_0x7d1c('0x13')](this));ami['on'](_0x7d1c('0x17'),this['syncQueueStatusComplete'][_0x7d1c('0x13')](this));ami['on']('queuecallerjoin',this[_0x7d1c('0x18')]['bind'](this));ami['on']('queuecallerabandon',this[_0x7d1c('0x19')][_0x7d1c('0x13')](this));ami['on']('queuecallerleave',this[_0x7d1c('0x1a')][_0x7d1c('0x13')](this));ami['on'](_0x7d1c('0x1b'),this['syncAgentComplete'][_0x7d1c('0x13')](this));ami['on'](_0x7d1c('0x1c'),this['syncAgentConnect'][_0x7d1c('0x13')](this));ami['on'](_0x7d1c('0x1d'),this[_0x7d1c('0x1e')][_0x7d1c('0x13')](this));ami['on'](_0x7d1c('0x1f'),this[_0x7d1c('0x20')][_0x7d1c('0x13')](this));ami['on'](_0x7d1c('0x21'),this[_0x7d1c('0x22')]['bind'](this));ami['on'](_0x7d1c('0x23'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x7d1c('0x24'),this['syncMusicOnHoldStop'][_0x7d1c('0x13')](this));ami['on'](_0x7d1c('0x25'),this[_0x7d1c('0x26')]['bind'](this));ami['on'](_0x7d1c('0x27'),this['syncBlindTransfer'][_0x7d1c('0x13')](this));this[_0x7d1c('0x28')]();this[_0x7d1c('0x29')]();}function clearChannels(_0x489189){if(!_[_0x7d1c('0x2a')](_0x489189)){for(var _0x13bdd7 in _0x489189){if(_0x489189[_0x7d1c('0x2b')](_0x13bdd7)){delete _0x489189[_0x13bdd7];}}}}function clearCampaigns(_0x39a14b){if(!_[_0x7d1c('0x2a')](_0x39a14b)){for(var _0x2be1d0 in _0x39a14b){if(_0x39a14b[_0x7d1c('0x2b')](_0x2be1d0)){_0x39a14b[_0x2be1d0][_0x7d1c('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x3fa6ea){if(!_[_0x7d1c('0x2a')](_0x3fa6ea)){for(var _0x97dd97 in _0x3fa6ea){if(_0x3fa6ea['hasOwnProperty'](_0x97dd97)){_0x3fa6ea[_0x97dd97][_0x7d1c('0x2c')]=0x0;_0x3fa6ea[_0x97dd97][_0x7d1c('0x2d')]=0x0;_0x3fa6ea[_0x97dd97]['pTalking']=0x0;_0x3fa6ea[_0x97dd97]['waiting']=0x0;_0x3fa6ea[_0x97dd97][_0x7d1c('0x2e')]=!![];}}}}function clearAgentBooked(_0x13932f){if(!_[_0x7d1c('0x2a')](_0x13932f)){for(var _0x324d02 in _0x13932f){if(_0x13932f[_0x7d1c('0x2b')](_0x324d02)){_0x13932f[_0x324d02][_0x7d1c('0x2f')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x2ce7f7){return _0x2ce7f7[_0x7d1c('0x30')]||_0x2ce7f7[_0x7d1c('0x31')]||_0x2ce7f7['queuecallercomplete'];}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x35c6f8=this;for(var _0x1de150 in this['channels']){if(this[_0x7d1c('0xc')][_0x7d1c('0x2b')](_0x1de150)&&!this['channels'][_0x1de150]['switch']){this[_0x7d1c('0x32')][_0x7d1c('0x9')](function(){if(!_['isNil'](_0x35c6f8[_0x7d1c('0xc')][_0x1de150])){return ami[_0x7d1c('0x33')]({'action':_0x7d1c('0x34'),'channel':_0x35c6f8[_0x7d1c('0xc')][_0x1de150][_0x7d1c('0x35')]})[_0x7d1c('0x36')](function(_0xefe12c){if(_0xefe12c[_0x7d1c('0x37')]===_0x7d1c('0x38')){setTimeout(function(){if(_0x35c6f8[_0x7d1c('0xc')][_0x1de150]){delete _0x35c6f8[_0x7d1c('0xc')][_0x1de150];logger[_0x7d1c('0x39')](_0x7d1c('0x3a'),_0x1de150,util[_0x7d1c('0x3b')](_0xefe12c,{'showHidden':![],'depth':null}));}if(_0x35c6f8[_0x7d1c('0xb')][_0x1de150]){delete _0x35c6f8[_0x7d1c('0xb')][_0x1de150];logger['error']('[%s][voiceQueueReport][checkQueueReport]',_0x1de150,util[_0x7d1c('0x3b')](_0xefe12c,{'showHidden':![],'depth':null}));}if(_0x35c6f8[_0x7d1c('0x10')][_0x1de150]){delete _0x35c6f8['variables'][_0x1de150];logger[_0x7d1c('0x39')](_0x7d1c('0x3c'),_0x1de150,util[_0x7d1c('0x3b')](_0xefe12c,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x7d1c('0x8')]['syncFullyBooted']=function(){logger['error'](_0x7d1c('0x3d'));clearChannels(this[_0x7d1c('0xc')]);this[_0x7d1c('0x3e')](this[_0x7d1c('0xb')]);clearAgentBooked(this[_0x7d1c('0x3f')]);clearVoiceQueues(this[_0x7d1c('0xd')]);clearCampaigns(this['campaigns']);this[_0x7d1c('0xf')]=initializeSummary();};VoiceQueueReport['prototype']['clearQueueReport']=function(_0x3f46cb){var _0x4580a5=this;if(!_[_0x7d1c('0x2a')](_0x3f46cb)){for(var _0x450320 in _0x3f46cb){if(_0x3f46cb[_0x7d1c('0x2b')](_0x450320)){_0x4580a5[_0x7d1c('0x40')](_0x3f46cb[_0x450320],_0x7d1c('0x41'));delete _0x3f46cb[_0x450320];}}}};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x42')]=function(_0x10260c,_0x47081d,_0x26ec09){io['to'](_0x10260c)['emit'](_0x47081d,_0x26ec09);};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x43')]=function(_0x456097,_0x1b393c){logger[_0x7d1c('0x44')](_0x7d1c('0x45')+_0x1b393c+']\x20sending\x20voice_queue_channel:save\x20event:',_0x456097[_0x7d1c('0x46')],util[_0x7d1c('0x3b')](_0x456097,{'showHidden':![],'depth':null}));this[_0x7d1c('0x42')](util[_0x7d1c('0x47')](_0x7d1c('0x48'),_0x456097[_0x7d1c('0x49')]),_0x7d1c('0x4a'),_0x456097);io[_0x7d1c('0x42')](_0x7d1c('0x4b'),_0x456097);};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x40')]=function(_0x12a8ba,_0x349477){logger[_0x7d1c('0x44')]('[%s][voiceQueueReport]['+_0x349477+_0x7d1c('0x4c'),_0x12a8ba[_0x7d1c('0x46')],util[_0x7d1c('0x3b')](_0x12a8ba,{'showHidden':![],'depth':null}));if(_0x12a8ba[_0x7d1c('0x4d')]===_0x7d1c('0x4e')){return;}this[_0x7d1c('0x42')](util[_0x7d1c('0x47')](_0x7d1c('0x48'),_0x12a8ba['queue']),_0x7d1c('0x4f'),_0x12a8ba);io[_0x7d1c('0x42')]('voice_queue_presence:remove',_0x12a8ba);};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x50')]=function(_0x462e57){if(_0x462e57[_0x7d1c('0x51')]==='inbound'){logger[_0x7d1c('0x44')](_0x7d1c('0x52'),util[_0x7d1c('0x3b')](_0x462e57,{'showHidden':![],'depth':null}));this['emit'](util[_0x7d1c('0x47')](_0x7d1c('0x48'),_0x462e57['name']),_0x7d1c('0x53'),_0x462e57);}};VoiceQueueReport['prototype'][_0x7d1c('0x54')]=function(_0x5c6b0c){return _0x5c6b0c!==null&&!_[_0x7d1c('0x55')](_0x5c6b0c);};VoiceQueueReport['prototype'][_0x7d1c('0x29')]=function(){var _0xf1c60c=this;setInterval(function(){_0xf1c60c[_0x7d1c('0x56')]();ami['Action']({'action':_0x7d1c('0x57')})[_0x7d1c('0x36')](function(_0x4f9e19){logger[_0x7d1c('0x39')]('[voiceQueueReport][queues]',util[_0x7d1c('0x3b')](_0x4f9e19,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x28')]=function(){var _0x8e2698=this;setInterval(function(){if(!_0x8e2698[_0x7d1c('0xf')]['isRunning']){return ami[_0x7d1c('0x33')]({'action':_0x7d1c('0x11')})[_0x7d1c('0x58')](function(_0x30b09d){_0x8e2698[_0x7d1c('0xf')]['id']=_0x30b09d[_0x7d1c('0x59')];_0x8e2698['summary'][_0x7d1c('0x5a')]=!![];_0x8e2698[_0x7d1c('0xf')]['queuestatus'][_0x30b09d['actionid']]={};})[_0x7d1c('0x36')](function(_0x1c894a){logger[_0x7d1c('0x39')](_0x7d1c('0x5b'),util[_0x7d1c('0x3b')](_0x1c894a,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x5c')]=function(_0x188d99,_0x4d9fc4){var _0x14fef0;if(this[_0x7d1c('0xf')]&&this[_0x7d1c('0xf')][_0x7d1c('0x57')]&&this[_0x7d1c('0xf')][_0x7d1c('0x57')][_0x188d99[_0x7d1c('0x5d')]]){_0x14fef0=this[_0x7d1c('0xf')]['queues'][_0x188d99[_0x7d1c('0x5d')]]['summaryEvent'];}var _0x592e23=new VoiceQueueSummary(_0x188d99);return _0x592e23[_0x7d1c('0x5e')](_0x4d9fc4[_0x7d1c('0x3f')],this[_0x7d1c('0x3f')],_0x14fef0,this[_0x7d1c('0x5f')]['channels']);};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x60')]=function(_0xec54a5,_0x4ad0a5){var _0xec2a58=this[_0x7d1c('0x5c')](_0xec54a5,_0x4ad0a5);var _0x4467c9=![];_0x4467c9=_0xec2a58[_0x7d1c('0x61')](_0xec54a5);if(_0x4467c9){Object['assign'](_0xec54a5,_0xec2a58);this[_0x7d1c('0x5f')][_0x7d1c('0xd')][_0xec54a5['name']]=_0xec54a5;this['emitInboundVoiceQueueSummary'](_0xec2a58);}};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x62')]=function(_0x141d60){var _0x6176a9=null;var _0x372d3c=this['summary']['id'];if(this[_0x7d1c('0xf')][_0x7d1c('0x63')][_0x372d3c]){_0x6176a9=this['summary'][_0x7d1c('0x63')][_0x372d3c][_0x141d60[_0x7d1c('0x59')]];}if(!_0x6176a9){this['summary']=initializeSummary();return;}var _0x27f155=this[_0x7d1c('0xd')][_0x6176a9[_0x7d1c('0x49')]];if(_0x27f155[_0x7d1c('0x51')]===_0x7d1c('0x64')){this['handleInboundQueueSummaryReport'](_0x27f155,_0x6176a9);}else if(_0x27f155['type']===_0x7d1c('0x65')){var _0xef8a34=this[_0x7d1c('0x5c')](_0x27f155,_0x6176a9);ami[_0x7d1c('0x42')](_0x7d1c('0x66'),_0xef8a34);}this[_0x7d1c('0xf')][_0x7d1c('0x67')]-=0x1;var _0x3b7fa0=this['summary']['statusRequests']>0x0?!![]:![];if(!_0x3b7fa0){return this['syncQueueSummaryComplete'](this['summary'][_0x7d1c('0x68')]);}};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x16')]=function(_0x3a8475){var _0x4c0d9c=this[_0x7d1c('0xf')]['id'];if(this['summary'][_0x7d1c('0x63')][_0x4c0d9c]&&this[_0x7d1c('0xf')][_0x7d1c('0x63')][_0x4c0d9c][_0x3a8475[_0x7d1c('0x59')]]){this[_0x7d1c('0xf')]['queuestatus'][_0x4c0d9c][_0x3a8475[_0x7d1c('0x59')]][_0x7d1c('0x3f')][_0x7d1c('0x69')](_0x3a8475);}};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x12')]=function(_0x57b377){var _0x21303d=this;try{if(this[_0x7d1c('0x54')](_0x57b377)&&this[_0x7d1c('0x54')](_0x57b377[_0x7d1c('0x49')])){logger[_0x7d1c('0x44')](_0x7d1c('0x6a'),util['inspect'](_0x57b377,{'showHidden':![],'depth':null}));var _0x59c40d=this[_0x7d1c('0xd')][_0x57b377[_0x7d1c('0x49')]];if(_0x59c40d){logger[_0x7d1c('0x44')](_0x7d1c('0x6b'),_0x59c40d[_0x7d1c('0x5d')]);this[_0x7d1c('0xf')][_0x7d1c('0x57')][_0x59c40d[_0x7d1c('0x5d')]]={'summaryEvent':_0x57b377};this[_0x7d1c('0xf')][_0x7d1c('0x67')]+=0x1;return ami['Action']({'action':_0x7d1c('0x63'),'queue':_0x59c40d[_0x7d1c('0x5d')]})[_0x7d1c('0x58')](function(_0xdcad7d){if(!_0x21303d['summary'][_0x7d1c('0x63')][_0x57b377['actionid']]){_0x21303d[_0x7d1c('0xf')][_0x7d1c('0x63')][_0x57b377[_0x7d1c('0x59')]]={};}_0x21303d['summary'][_0x7d1c('0x63')][_0x57b377[_0x7d1c('0x59')]][_0xdcad7d['actionid']]={'queue':_0x59c40d['name'],'agents':[]};})['catch'](function(_0x461fff){throw _0x461fff;});}}}catch(_0x951d62){logger['error'](_0x7d1c('0x5b'),util[_0x7d1c('0x3b')](_0x951d62,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x14')]=function(_0x351fb7){if(this[_0x7d1c('0xf')][_0x7d1c('0x67')]>0x0){this[_0x7d1c('0xf')]['completeEvent']=_0x351fb7;return;}logger['debug'](_0x7d1c('0x6c'),util[_0x7d1c('0x3b')](_0x351fb7,{'showHidden':![],'depth':null}));this[_0x7d1c('0xf')]=initializeSummary();ami[_0x7d1c('0x42')](_0x7d1c('0x6d'),{});};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x18')]=function(_0x490bdb){try{if(this[_0x7d1c('0x54')](_0x490bdb)){logger[_0x7d1c('0x44')]('[%s][voiceQueueReport][queuecallerjoin]',_0x490bdb[_0x7d1c('0x46')],util[_0x7d1c('0x3b')](_0x490bdb,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x7d1c('0xb')][_0x490bdb[_0x7d1c('0x46')]])){this[_0x7d1c('0xb')][_0x490bdb[_0x7d1c('0x46')]]=[];}if(_[_0x7d1c('0x55')](this[_0x7d1c('0xc')][_0x490bdb[_0x7d1c('0x46')]])){this[_0x7d1c('0xc')][_0x490bdb[_0x7d1c('0x46')]]={};}var _0x28caad=new QueueReport();_0x28caad[_0x7d1c('0x49')]=_0x490bdb[_0x7d1c('0x49')];_0x28caad[_0x7d1c('0x51')]=this[_0x7d1c('0xd')][_0x28caad['queue']]&&this[_0x7d1c('0xd')][_0x28caad[_0x7d1c('0x49')]][_0x7d1c('0x51')]?this[_0x7d1c('0xd')][_0x28caad['queue']][_0x7d1c('0x51')]||_0x7d1c('0x64'):_0x7d1c('0x64');_0x28caad[_0x7d1c('0x6e')]=moment()[_0x7d1c('0x47')](_0x7d1c('0x6f'));_0x28caad[_0x7d1c('0x70')]=_0x490bdb[_0x7d1c('0x70')];_0x28caad[_0x7d1c('0x71')]=_0x490bdb[_0x7d1c('0x71')];_0x28caad[_0x7d1c('0x46')]=_0x490bdb['uniqueid'];logger['info'](_0x7d1c('0x72'),_0x28caad[_0x7d1c('0x49')],_0x28caad['type']);Object['assign'](_0x28caad,_[_0x7d1c('0x73')](_0x490bdb,_[_0x7d1c('0x74')](_0x28caad)));this['queueReports'][_0x490bdb[_0x7d1c('0x46')]]['push'](_0x28caad);this[_0x7d1c('0xc')][_0x490bdb['uniqueid']]=_0x28caad;this[_0x7d1c('0x43')](_0x28caad,_0x7d1c('0x75'));}}catch(_0x231b4a){logger[_0x7d1c('0x39')](_0x7d1c('0x76'),_0x490bdb[_0x7d1c('0x46')],util['inspect'](_0x231b4a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x19')]=function(_0x17868e){try{if(this['isNotNull'](_0x17868e)){logger['debug'](_0x7d1c('0x77'),_0x17868e[_0x7d1c('0x46')],util[_0x7d1c('0x3b')](_0x17868e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x17868e[_0x7d1c('0x46')]]){var _0x1751a8=_['last'](this[_0x7d1c('0xb')][_0x17868e[_0x7d1c('0x46')]]);_0x1751a8['queuecallercomplete']=![];_0x1751a8[_0x7d1c('0x78')]=null;_0x1751a8['holdtime']=_0x17868e['holdtime'];_0x1751a8[_0x7d1c('0x79')]=_0x17868e['originalposition'];_0x1751a8['queuecallerabandon']=!![];_0x1751a8[_0x7d1c('0x7a')]=moment()[_0x7d1c('0x47')](_0x7d1c('0x6f'));_0x1751a8['queuecallerexitreason']=_0x7d1c('0x7b');_0x1751a8[_0x7d1c('0x7c')]=null;logger[_0x7d1c('0x7d')](_0x7d1c('0x7e'),_0x1751a8[_0x7d1c('0x49')],_0x1751a8[_0x7d1c('0x51')]);this[_0x7d1c('0xc')][_0x17868e[_0x7d1c('0x46')]]=_0x1751a8;this[_0x7d1c('0x40')](_0x1751a8,_0x7d1c('0x31'));}}}catch(_0x394218){logger[_0x7d1c('0x39')](_0x7d1c('0x77'),_0x17868e[_0x7d1c('0x46')],util[_0x7d1c('0x3b')](_0x394218,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x1a')]=function(_0x8c09ad){try{if(this['isNotNull'](_0x8c09ad)){logger['debug'](_0x7d1c('0x7f'),_0x8c09ad[_0x7d1c('0x46')],util[_0x7d1c('0x3b')](_0x8c09ad,{'showHidden':![],'depth':null}));if(this[_0x7d1c('0xb')][_0x8c09ad[_0x7d1c('0x46')]]){var _0x29f8df=_['last'](this[_0x7d1c('0xb')][_0x8c09ad[_0x7d1c('0x46')]]);_0x29f8df[_0x7d1c('0x80')]=moment()[_0x7d1c('0x47')](_0x7d1c('0x6f'));_0x29f8df[_0x7d1c('0x81')]=_0x8c09ad[_0x7d1c('0x81')];_0x29f8df[_0x7d1c('0x82')]=_0x8c09ad['connectedlinename'];logger['info'](_0x7d1c('0x83'),_0x29f8df['queue'],_0x29f8df[_0x7d1c('0x51')],_0x8c09ad[_0x7d1c('0x81')],_0x8c09ad[_0x7d1c('0x82')]);this[_0x7d1c('0xc')][_0x8c09ad[_0x7d1c('0x46')]]=_0x29f8df;this['emitVoiceQueueChannelSave'](_0x29f8df,_0x7d1c('0x84'));}}}catch(_0x4c79dc){logger[_0x7d1c('0x39')](_0x7d1c('0x7f'),_0x8c09ad[_0x7d1c('0x46')],util[_0x7d1c('0x3b')](_0x4c79dc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x85')]=function(_0x46078a){try{if(this[_0x7d1c('0x54')](_0x46078a)){logger[_0x7d1c('0x44')]('[%s][voiceQueueReport][agentconnect]',_0x46078a['uniqueid'],util[_0x7d1c('0x3b')](_0x46078a,{'showHidden':![],'depth':null}));if(this[_0x7d1c('0xb')][_0x46078a[_0x7d1c('0x46')]]){var _0x23dddd=_[_0x7d1c('0x86')](this[_0x7d1c('0xb')][_0x46078a['uniqueid']]);_0x23dddd[_0x7d1c('0x87')]=!![];_0x23dddd[_0x7d1c('0x4d')]='COMPLETEDBYAGENT';logger[_0x7d1c('0x7d')](_0x7d1c('0x88'),_0x23dddd[_0x7d1c('0x49')],_0x23dddd[_0x7d1c('0x51')]);}}}catch(_0x346e13){logger[_0x7d1c('0x39')](_0x7d1c('0x89'),_0x46078a[_0x7d1c('0x46')],util[_0x7d1c('0x3b')](_0x346e13,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x8a')]=function(_0x4239ef){try{if(this[_0x7d1c('0x54')](_0x4239ef)){logger[_0x7d1c('0x44')](_0x7d1c('0x8b'),_0x4239ef[_0x7d1c('0x46')],util['inspect'](_0x4239ef,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4239ef[_0x7d1c('0x46')]]){var _0x18b8ab=_[_0x7d1c('0x86')](this[_0x7d1c('0xb')][_0x4239ef[_0x7d1c('0x46')]]);_0x18b8ab['queuecallerabandon']=![];_0x18b8ab[_0x7d1c('0x7a')]=null;_0x18b8ab['assigned']=!![];_0x18b8ab[_0x7d1c('0x7c')]=_0x4239ef[_0x7d1c('0x8c')];_0x18b8ab[_0x7d1c('0x8d')]=_0x4239ef[_0x7d1c('0x8d')];_0x18b8ab[_0x7d1c('0x87')]=!![];_0x18b8ab['queuecallerexit']=![];_0x18b8ab[_0x7d1c('0x8e')]=null;if(!_0x18b8ab[_0x7d1c('0x8f')]){if(_0x4239ef[_0x7d1c('0x90')]==_0x7d1c('0x8f')){_0x18b8ab['queuecallerexitreason']=_0x7d1c('0x91');logger[_0x7d1c('0x7d')](_0x7d1c('0x92'),_0x18b8ab[_0x7d1c('0x49')],_0x18b8ab[_0x7d1c('0x51')]);}else{if(_[_0x7d1c('0x93')](_0x4239ef['channel']['toLowerCase'](),_0x7d1c('0x94'))){if(this[_0x7d1c('0xb')][_0x4239ef[_0x7d1c('0x95')]]){var _0x29bbaa=_['last'](this[_0x7d1c('0xb')][_0x4239ef[_0x7d1c('0x95')]]);_0x29bbaa[_0x7d1c('0x87')]=![];_0x29bbaa['queuecallerexit']=!![];_0x29bbaa[_0x7d1c('0x8e')]=moment(_0x18b8ab[_0x7d1c('0x6e')])['add'](_0x4239ef[_0x7d1c('0x8d')],_0x7d1c('0x96'))[_0x7d1c('0x47')](_0x7d1c('0x6f'));_0x29bbaa[_0x7d1c('0x4d')]=_0x7d1c('0x97');_0x29bbaa['transfer']=!![];_0x29bbaa[_0x7d1c('0x98')]=_0x7d1c('0x99');_0x29bbaa['transferexten']=_0x4239ef['destexten'];_0x29bbaa[_0x7d1c('0x9a')]=_0x4239ef[_0x7d1c('0x46')];logger[_0x7d1c('0x7d')](_0x7d1c('0x9b'),_0x29bbaa[_0x7d1c('0x49')],_0x29bbaa[_0x7d1c('0x51')]);var _0x542245=this[_0x7d1c('0xb')][_0x4239ef[_0x7d1c('0x95')]];this[_0x7d1c('0xb')][_0x4239ef[_0x7d1c('0x95')]]=this[_0x7d1c('0xb')][_0x4239ef['uniqueid']];this[_0x7d1c('0xb')][_0x4239ef[_0x7d1c('0x46')]]=_0x542245;}}else{_0x18b8ab[_0x7d1c('0x4d')]='COMPLETEDBY'+_0x4239ef[_0x7d1c('0x90')][_0x7d1c('0x9c')]();logger['info'](_0x7d1c('0x9d'),_0x18b8ab[_0x7d1c('0x49')],_0x18b8ab[_0x7d1c('0x51')],_0x18b8ab['queuecallerexitreason']);}}}this['channels'][_0x4239ef[_0x7d1c('0x46')]]=_0x18b8ab;}}}catch(_0xb1e33b){logger[_0x7d1c('0x39')](_0x7d1c('0x8b'),_0x4239ef[_0x7d1c('0x46')],util[_0x7d1c('0x3b')](_0xb1e33b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d1c('0x8')][_0x7d1c('0x1e')]=function(_0x51667d){try{if(this[_0x7d1c('0x54')](_0x51667d)){logger[_0x7d1c('0x44')](_0x7d1c('0x9e'),_0x51667d[_0x7d1c('0x46')],util['inspect'](_0x51667d,{'showHidden':![],'depth':null}));this[_0x7d1c('0x9f')](_0x51667d[_0x7d1c('0x46')],_[_0x7d1c('0x74')](_0x51667d[_0x7d1c('0xa0')])[0x0],_0x51667d[_0x7d1c('0xa1')]);if(this[_0x7d1c('0xb')][_0x51667d[_0x7d1c('0x46')]]){var _0x51dbe1=_[_0x7d1c('0x86')](this['queueReports'][_0x51667d[_0x7d1c('0x46')]]);if(_0x51dbe1){if(this[_0x7d1c('0x54')](_0x51667d[_0x7d1c('0xa0')])&&this[_0x7d1c('0x54')](_0x51667d[_0x7d1c('0xa0')][_0x7d1c('0x63')])){switch(_0x51667d['value']){case _0x7d1c('0xa2'):_0x51dbe1[_0x7d1c('0x30')]=![];_0x51dbe1[_0x7d1c('0x8e')]=null;break;case _0x7d1c('0xa3'):_0x51dbe1[_0x7d1c('0xa4')]=_0x7d1c('0xa5');_0x51dbe1[_0x7d1c('0x30')]=!![];_0x51dbe1['queuecallerexitAt']=moment()[_0x7d1c('0x47')](_0x7d1c('0x6f'));_0x51dbe1[_0x7d1c('0x80')]=moment()[_0x7d1c('0x47')](_0x7d1c('0x6f'));logger['debug'](_0x7d1c('0xa6'),_0x51667d[_0x7d1c('0x46')],util[_0x7d1c('0x3b')](_0x51dbe1,{'showHidden':![],'depth':null}));ami[_0x7d1c('0x42')]('custom:timeout',_0x51dbe1);break;default:_0x51dbe1[_0x7d1c('0x30')]=!![];_0x51dbe1[_0x7d1c('0x8e')]=moment()[_0x7d1c('0x47')](_0x7d1c('0x6f'));_0x51dbe1[_0x7d1c('0x80')]=moment()[_0x7d1c('0x47')](_0x7d1c('0x6f'));}_0x51dbe1[_0x7d1c('0x31')]=![];_0x51dbe1['queuecallerabandonAt']=null;_0x51dbe1['queuecallerexitreason']=_0x51667d[_0x7d1c('0xa1')];this[_0x7d1c('0xc')][_0x51667d[_0x7d1c('0x46')]]=_0x51dbe1;this['emitVoiceQueueChannelRemove'](_0x51dbe1,'varset');}else if(this[_0x7d1c('0x54')](_0x51667d[_0x7d1c('0xa0')])&&this[_0x7d1c('0x54')](_0x51667d[_0x7d1c('0xa0')]['queueposition'])){if(!_0x51dbe1[_0x7d1c('0x31')]){_0x51dbe1[_0x7d1c('0x30')]=!![];_0x51dbe1[_0x7d1c('0x8e')]=moment()[_0x7d1c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x51dbe1['queuecallerexitreason']='EXITWITHKEY';_0x51dbe1[_0x7d1c('0x80')]=moment()[_0x7d1c('0x47')](_0x7d1c('0x6f'));this['channels'][_0x51667d['uniqueid']]=_0x51dbe1;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x51667d['uniqueid'],_0x51dbe1['queue'],_0x51dbe1[_0x7d1c('0x51')],_[_0x7d1c('0x74')](_0x51667d[_0x7d1c('0xa0')])[0x0],_0x51667d[_0x7d1c('0xa1')]);_0x51dbe1[_0x7d1c('0x10')]=this[_0x7d1c('0x10')][_0x51667d['uniqueid']];}}}}catch(_0x3999a1){logger[_0x7d1c('0x39')](_0x7d1c('0x9e'),_0x51667d[_0x7d1c('0x46')],util['inspect'](_0x3999a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7d1c('0x9f')]=function(_0x82e551,_0x207fa9,_0x13aa92){var _0x47e576=[_0x7d1c('0xa7'),_0x7d1c('0xa8'),_0x7d1c('0xa9'),_0x7d1c('0xaa'),'rtpaudioqosloss',_0x7d1c('0xab'),_0x7d1c('0xac'),_0x7d1c('0xad'),_0x7d1c('0xae'),'sipuri','bridgepeer',_0x7d1c('0xaf'),_0x7d1c('0xb0'),_0x7d1c('0xb1'),'memberinterface',_0x7d1c('0xb2'),'membername','memberpenalty',_0x7d1c('0xb3')];if(!_['isNil'](_0x207fa9)&&!_[_0x7d1c('0xb4')](_0x47e576,_0x207fa9)){if(_[_0x7d1c('0x55')](this[_0x7d1c('0x10')][_0x82e551])){this[_0x7d1c('0x10')][_0x82e551]={};}this[_0x7d1c('0x10')][_0x82e551][_0x207fa9]=_0x13aa92;}};VoiceQueueReport[_0x7d1c('0x8')]['handleHangup']=function(_0x1812ee,_0x337b63,_0x20facd){try{var _0x19d070={};if(this[_0x7d1c('0xb')][_0x1812ee]){for(var _0x58dfe3=0x0;_0x58dfe3{delete this[_0x7d1c('0xc')][_0x250eba];},_0x3f3e05);}};module[_0x7d1c('0xe9')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 22cd1a3..47e09eb 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f16=['CreateReportAgentPreview','../client','campaign','queue'];(function(_0x5eb4bb,_0xbd4598){var _0x12d25b=function(_0x4f0ccd){while(--_0x4f0ccd){_0x5eb4bb['push'](_0x5eb4bb['shift']());}};_0x12d25b(++_0xbd4598);}(_0x7f16,0x171));var _0x67f1=function(_0x1f803d,_0x1c966e){_0x1f803d=_0x1f803d-0x0;var _0x549186=_0x7f16[_0x1f803d];return _0x549186;};'use strict';var client=require(_0x67f1('0x0'));exports['createHistory']=function(_0x26b33e){return function(){_0x26b33e[_0x67f1('0x1')]=_0x26b33e[_0x67f1('0x2')];return client['Request'](_0x67f1('0x3'),{'body':_0x26b33e,'log':_0x67f1('0x3')});};}; \ No newline at end of file +var _0x203e=['../client','createHistory','campaign','CreateReportAgentPreview'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x203e,0xb0));var _0xe203=function(_0x585df5,_0x52b28b){_0x585df5=_0x585df5-0x0;var _0x52e87f=_0x203e[_0x585df5];return _0x52e87f;};'use strict';var client=require(_0xe203('0x0'));exports[_0xe203('0x1')]=function(_0x5016bc){return function(){_0x5016bc[_0xe203('0x2')]=_0x5016bc['queue'];return client['Request'](_0xe203('0x3'),{'body':_0x5016bc,'log':_0xe203('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 97453cc..72c31a4 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbf0=['Request','../client','create'];(function(_0x13be43,_0x1261e8){var _0x2b5d2f=function(_0x4a979f){while(--_0x4a979f){_0x13be43['push'](_0x13be43['shift']());}};_0x2b5d2f(++_0x1261e8);}(_0xcbf0,0xc1));var _0x0cbf=function(_0x355866,_0x14f421){_0x355866=_0x355866-0x0;var _0x1427a7=_0xcbf0[_0x355866];return _0x1427a7;};'use strict';var client=require(_0x0cbf('0x0'));exports[_0x0cbf('0x1')]=function(_0xb85f02){return client[_0x0cbf('0x2')]('CreateAttachment',{'body':_0xb85f02,'log':'CreateAttachment'});}; \ No newline at end of file +var _0xe59e=['CreateAttachment','../client','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe59e,0x193));var _0xee59=function(_0x1aec96,_0x297d87){_0x1aec96=_0x1aec96-0x0;var _0x425815=_0xe59e[_0x1aec96];return _0x425815;};'use strict';var client=require(_0xee59('0x0'));exports[_0xee59('0x1')]=function(_0x380d1d){return client['Request']('CreateAttachment',{'body':_0x380d1d,'log':_0xee59('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 70ee7b1..53ffc88 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialCutDigit','Trunk','callerid','active','TrunkBackup','Interval','SquareProject','getCampaign','getCampaigns','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength'];(function(_0x4d62f1,_0x531441){var _0x17b71d=function(_0x4aa336){while(--_0x4aa336){_0x4d62f1['push'](_0x4d62f1['shift']());}};_0x17b71d(++_0x531441);}(_0xadb5,0xad));var _0x5adb=function(_0x577788,_0x12e02f){_0x577788=_0x577788-0x0;var _0x483e66=_0xadb5[_0x577788];return _0x483e66;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(){return function(){return client['Request'](_0x5adb('0x1'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x2'),_0x5adb('0x3'),'active',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'dialOriginateTimeout',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'dialAMDActive',_0x5adb('0x18'),'dialAMDGreeting',_0x5adb('0x19'),'dialAMDTotalAnalysisTime',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'dialAMDSilenceThreshold',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'dialRandomLastDigitCallerIdNumber',_0x5adb('0x20')],'include':[{'model':'Trunk','as':_0x5adb('0x21'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':_0x5adb('0x21'),'as':_0x5adb('0x24'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':'Interval','as':_0x5adb('0x25'),'attributes':['id','name'],'include':[{'model':_0x5adb('0x25'),'as':'Intervals','attributes':['id',_0x5adb('0x2'),'interval']}]},{'model':'SquareProject','as':_0x5adb('0x26'),'attributes':['id',_0x5adb('0x2')]}]},'log':_0x5adb('0x27')});};}; \ No newline at end of file +var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x51b19b,_0x5015d2){var _0x1a3cd6=function(_0x495134){while(--_0x495134){_0x51b19b['push'](_0x51b19b['shift']());}};_0x1a3cd6(++_0x5015d2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index d6c7c64..49b1218 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9226=['CreateCmContact','GetCmContact','../client','createContact','Request'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x9226,0x174));var _0x6922=function(_0x212f04,_0x562064){_0x212f04=_0x212f04-0x0;var _0x5111ee=_0x9226[_0x212f04];return _0x5111ee;};'use strict';var client=require(_0x6922('0x0'));exports[_0x6922('0x1')]=function(_0x52dae6){return function(){return client[_0x6922('0x2')]('CreateCmContact',{'body':_0x52dae6,'log':_0x6922('0x3')});};};exports['getContacts']=function(_0x1a2a7e){return function(){return client[_0x6922('0x2')](_0x6922('0x4'),{'options':_0x1a2a7e,'log':_0x6922('0x4')});};}; \ No newline at end of file +var _0x7289=['CreateCmContact','GetCmContact','../client','createContact','Request'];(function(_0x494ef4,_0x4b7a6c){var _0x1a3ff5=function(_0x3c6a87){while(--_0x3c6a87){_0x494ef4['push'](_0x494ef4['shift']());}};_0x1a3ff5(++_0x4b7a6c);}(_0x7289,0x14c));var _0x9728=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7289[_0x618414];return _0x21c19a;};'use strict';var client=require(_0x9728('0x0'));exports[_0x9728('0x1')]=function(_0x4ce14c){return function(){return client[_0x9728('0x2')](_0x9728('0x3'),{'body':_0x4ce14c,'log':_0x9728('0x3')});};};exports['getContacts']=function(_0x1bd6e4){return function(){return client[_0x9728('0x2')](_0x9728('0x4'),{'options':_0x1bd6e4,'log':_0x9728('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index f7aebab..00d5857 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcfa=['CountReScheduled','getContactPreview','GetCmHopperPreview','name','VoiceQueue','getContactRecallMe','GetContactRecallMe','User','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId','CampaignId','DestroyCmHopper','format','DESC','scheduledat','ASC','GetContactDialer','getContactDialerIvr','priority','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ContactId','countReScheduled'];(function(_0x2694e0,_0x1d6137){var _0x5f257e=function(_0xad02fa){while(--_0xad02fa){_0x2694e0['push'](_0x2694e0['shift']());}};_0x5f257e(++_0x1d6137);}(_0xdcfa,0xad));var _0xadcf=function(_0x5c9f56,_0x42c9ad){_0x5c9f56=_0x5c9f56-0x0;var _0x2a726b=_0xdcfa[_0x5c9f56];return _0x2a726b;};'use strict';var client=require(_0xadcf('0x0'));var moment=require('moment');exports[_0xadcf('0x1')]=function(_0x5c6295,_0x14990c){return function(){return client[_0xadcf('0x2')](_0xadcf('0x3'),{'options':{'where':{'VoiceQueueId':_0x5c6295},'include':[{'model':_0xadcf('0x4'),'as':_0xadcf('0x5')}],'limit':_0x14990c,'raw':![]},'log':_0xadcf('0x6')});};};exports[_0xadcf('0x7')]=function(_0x12c098,_0x706348,_0x355ffd){return function(){return client[_0xadcf('0x2')](_0xadcf('0x8'),{'body':_0x12c098,'options':{'where':{'VoiceQueueId':_0x706348,'scheduledat':{'$lte':moment()['format'](_0xadcf('0x9'))}},'limit':_0x355ffd},'log':'UpdateCmHopper'});};};exports[_0xadcf('0xa')]=function(_0x28d5e3){return client['Request'](_0xadcf('0x8'),{'body':_0x28d5e3,'options':{'where':{'ContactId':_0x28d5e3['ContactId'],'ListId':_0x28d5e3[_0xadcf('0xb')],'VoiceQueueId':_0x28d5e3['VoiceQueueId'],'CampaignId':_0x28d5e3[_0xadcf('0xc')]}},'log':_0xadcf('0xa')});};exports['destroyContact']=function(_0x23aa9b,_0x30411e,_0x758b3e){return function(){return client[_0xadcf('0x2')](_0xadcf('0xd'),{'options':{'where':{'VoiceQueueId':_0x23aa9b,'ListId':_0x30411e,'ContactId':_0x758b3e}},'log':_0xadcf('0xd')});};};exports['getContactDialer']=function(_0x2cda6a,_0x1ff31b,_0x43c311,_0xfb6dd8){return client[_0xadcf('0x2')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2cda6a,'active':![],'scheduledat':{'$lte':moment()[_0xadcf('0xe')](_0xadcf('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x1ff31b}}]},'order':[['priority',_0xadcf('0xf')],[_0xadcf('0x10'),_0xfb6dd8],['id',_0xadcf('0x11')]],'raw':!![],'limit':_0x43c311},'log':_0xadcf('0x12')});};exports[_0xadcf('0x13')]=function(_0x4d9333,_0x3165c1,_0x58975b){return client[_0xadcf('0x2')](_0xadcf('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x4d9333,'active':![],'scheduledat':{'$lte':moment()['format'](_0xadcf('0x9'))}},'include':[{'model':'CmContact','as':_0xadcf('0x5')}],'order':[[_0xadcf('0x14'),_0xadcf('0xf')],[_0xadcf('0x10'),_0x58975b],['id',_0xadcf('0x11')]],'raw':!![],'limit':_0x3165c1},'log':'GetContactDialerIvr'});};exports[_0xadcf('0x15')]=function(_0x401c88,_0x38e9b5){_0x401c88[_0xadcf('0x16')]=_0x401c88[_0xadcf('0x17')];return client[_0xadcf('0x2')](_0xadcf('0x18'),{'body':_0x401c88,'options':{'where':{'ContactId':_0x401c88[_0xadcf('0x19')],'ListId':_0x401c88[_0xadcf('0xb')],'VoiceQueueId':_0x401c88['VoiceQueueId'],'CampaignId':_0x401c88[_0xadcf('0xc')],'active':_0x38e9b5?undefined:!![]}},'log':_0xadcf('0x18')});};exports[_0xadcf('0x1a')]=function(_0x559f70){return client[_0xadcf('0x2')](_0xadcf('0x1b'),{'options':{'where':{'VoiceQueueId':_0x559f70['id']?_0x559f70['id']||null:null}},'log':_0xadcf('0x1a')});};exports[_0xadcf('0x1c')]=function(_0x5c63ae){return function(){return client[_0xadcf('0x2')](_0xadcf('0x1d'),{'options':{'where':{'id':_0x5c63ae},'include':[{'model':_0xadcf('0x4'),'as':_0xadcf('0x5')},{'model':'User','as':'Agent','attributes':['id',_0xadcf('0x1e')]},{'model':_0xadcf('0x1f'),'as':'Queue','attributes':['id',_0xadcf('0x1e')]}],'raw':!![]},'log':_0xadcf('0x6')});};};exports['unlockContact']=function(_0x396891,_0x5ac066,_0x563ddd){return client['Request'](_0xadcf('0x8'),{'body':_0x396891,'options':{'where':{'id':_0x5ac066},'limit':_0x563ddd},'log':'UpdateCmHopper'});};exports[_0xadcf('0x20')]=function(_0x1a12c2,_0x4b91bd){return function(){return client[_0xadcf('0x2')](_0xadcf('0x21'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1a12c2,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xadcf('0xe')](_0xadcf('0x9'))},'UserId':{'$in':_0x4b91bd}},'order':[[_0xadcf('0x14'),_0xadcf('0xf')],[_0xadcf('0x10'),_0xadcf('0xf')],['id',_0xadcf('0x11')]],'include':[{'model':_0xadcf('0x4'),'as':_0xadcf('0x5')},{'model':_0xadcf('0x22'),'as':'Agent','attributes':['id',_0xadcf('0x1e'),_0xadcf('0x23')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0xadcf('0x12')});};};exports[_0xadcf('0x24')]=function(_0x468e9d,_0x45a15c){return client[_0xadcf('0x2')](_0xadcf('0x25'),{'body':_0x468e9d,'options':_0x45a15c||{},'log':_0xadcf('0x25')});};exports[_0xadcf('0x26')]=function(_0x42d09d,_0x52e265,_0x3fc97f){return function(){return client[_0xadcf('0x2')](_0xadcf('0x27'),{'body':{'where':{'voiceQueueIds':_0x42d09d,'interval':_0x52e265,'availableAgentsIds':_0x3fc97f}},'log':_0xadcf('0x26')});};}; \ No newline at end of file +var _0xdbd0=['GetCmHopperPreview','Agent','name','VoiceQueue','Queue','getCmHopper','GetContactRecallMe','ASC','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','GetCmHopper','CmContact','Contact','updateContacts','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','Request','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','getContactDialerIvr','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled'];(function(_0xebd79f,_0x40b42f){var _0x24b217=function(_0x219961){while(--_0x219961){_0xebd79f['push'](_0xebd79f['shift']());}};_0x24b217(++_0x40b42f);}(_0xdbd0,0x88));var _0x0dbd=function(_0x326954,_0x4236cb){_0x326954=_0x326954-0x0;var _0x2cdab5=_0xdbd0[_0x326954];return _0x2cdab5;};'use strict';var client=require(_0x0dbd('0x0'));var moment=require(_0x0dbd('0x1'));exports[_0x0dbd('0x2')]=function(_0xac1778,_0x4392ca){return function(){return client['Request'](_0x0dbd('0x3'),{'options':{'where':{'VoiceQueueId':_0xac1778},'include':[{'model':_0x0dbd('0x4'),'as':_0x0dbd('0x5')}],'limit':_0x4392ca,'raw':![]},'log':'getCmHopper'});};};exports[_0x0dbd('0x6')]=function(_0x153856,_0xcd515f,_0x3bd770){return function(){return client['Request']('UpdateCmHopper',{'body':_0x153856,'options':{'where':{'VoiceQueueId':_0xcd515f,'scheduledat':{'$lte':moment()[_0x0dbd('0x7')](_0x0dbd('0x8'))}},'limit':_0x3bd770},'log':_0x0dbd('0x9')});};};exports[_0x0dbd('0xa')]=function(_0x12057a){return client[_0x0dbd('0xb')]('UpdateCmHopper',{'body':_0x12057a,'options':{'where':{'ContactId':_0x12057a['ContactId'],'ListId':_0x12057a[_0x0dbd('0xc')],'VoiceQueueId':_0x12057a[_0x0dbd('0xd')],'CampaignId':_0x12057a[_0x0dbd('0xe')]}},'log':_0x0dbd('0xa')});};exports[_0x0dbd('0xf')]=function(_0x18e73c,_0x1e0006,_0x46c818){return function(){return client['Request'](_0x0dbd('0x10'),{'options':{'where':{'VoiceQueueId':_0x18e73c,'ListId':_0x1e0006,'ContactId':_0x46c818}},'log':_0x0dbd('0x10')});};};exports[_0x0dbd('0x11')]=function(_0x59f880,_0x1f358a,_0x156830,_0x1a45d0){return client[_0x0dbd('0xb')](_0x0dbd('0x12'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x59f880,'active':![],'scheduledat':{'$lte':moment()[_0x0dbd('0x7')](_0x0dbd('0x8'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x1f358a}}]},'order':[[_0x0dbd('0x13'),_0x0dbd('0x14')],['scheduledat',_0x1a45d0],['id','ASC']],'raw':!![],'limit':_0x156830},'log':_0x0dbd('0x12')});};exports[_0x0dbd('0x15')]=function(_0x5b2a34,_0x18b3f8,_0x16ae44){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5b2a34,'active':![],'scheduledat':{'$lte':moment()[_0x0dbd('0x7')](_0x0dbd('0x8'))}},'include':[{'model':_0x0dbd('0x4'),'as':'Contact'}],'order':[[_0x0dbd('0x13'),_0x0dbd('0x14')],['scheduledat',_0x16ae44],['id','ASC']],'raw':!![],'limit':_0x18b3f8},'log':_0x0dbd('0x16')});};exports[_0x0dbd('0x17')]=function(_0x3b9fc6,_0x50866a){_0x3b9fc6['campaign']=_0x3b9fc6[_0x0dbd('0x18')];return client[_0x0dbd('0xb')]('MoveContactManagedDialer',{'body':_0x3b9fc6,'options':{'where':{'ContactId':_0x3b9fc6['ContactId'],'ListId':_0x3b9fc6[_0x0dbd('0xc')],'VoiceQueueId':_0x3b9fc6[_0x0dbd('0xd')],'CampaignId':_0x3b9fc6['CampaignId'],'active':_0x50866a?undefined:!![]}},'log':_0x0dbd('0x19')});};exports[_0x0dbd('0x1a')]=function(_0x18edd1){return client['Request'](_0x0dbd('0x1b'),{'options':{'where':{'VoiceQueueId':_0x18edd1['id']?_0x18edd1['id']||null:null}},'log':_0x0dbd('0x1a')});};exports['getContactPreview']=function(_0x328eba){return function(){return client[_0x0dbd('0xb')](_0x0dbd('0x1c'),{'options':{'where':{'id':_0x328eba},'include':[{'model':_0x0dbd('0x4'),'as':_0x0dbd('0x5')},{'model':'User','as':_0x0dbd('0x1d'),'attributes':['id',_0x0dbd('0x1e')]},{'model':_0x0dbd('0x1f'),'as':_0x0dbd('0x20'),'attributes':['id',_0x0dbd('0x1e')]}],'raw':!![]},'log':_0x0dbd('0x21')});};};exports['unlockContact']=function(_0x5dd8cd,_0x47dce1,_0x1728d1){return client['Request'](_0x0dbd('0x9'),{'body':_0x5dd8cd,'options':{'where':{'id':_0x47dce1},'limit':_0x1728d1},'log':'UpdateCmHopper'});};exports['getContactRecallMe']=function(_0xd13db9,_0x193f03){return function(){return client[_0x0dbd('0xb')](_0x0dbd('0x22'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xd13db9,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x0dbd('0x8'))},'UserId':{'$in':_0x193f03}},'order':[[_0x0dbd('0x13'),_0x0dbd('0x14')],['scheduledat',_0x0dbd('0x14')],['id',_0x0dbd('0x23')]],'include':[{'model':_0x0dbd('0x4'),'as':_0x0dbd('0x5')},{'model':'User','as':_0x0dbd('0x1d'),'attributes':['id',_0x0dbd('0x1e'),_0x0dbd('0x24')]}],'group':_0x0dbd('0x25'),'raw':!![]},'log':'GetContactDialer'});};};exports[_0x0dbd('0x26')]=function(_0x20d062,_0x1a400a){return client['Request'](_0x0dbd('0x27'),{'body':_0x20d062,'options':_0x1a400a||{},'log':_0x0dbd('0x27')});};exports[_0x0dbd('0x28')]=function(_0x531d54,_0x7252ec,_0x4f21a9){return function(){return client[_0x0dbd('0xb')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x531d54,'interval':_0x7252ec,'availableAgentsIds':_0x4f21a9}},'log':'handlePreviewRecallNotifications'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 29a187c..53708af 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c03=['IncrementPreviewCounters','verifyAdditionalPhones','Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters'];(function(_0x32ae93,_0x248b83){var _0x35dafc=function(_0x3ff7c4){while(--_0x3ff7c4){_0x32ae93['push'](_0x32ae93['shift']());}};_0x35dafc(++_0x248b83);}(_0x5c03,0x127));var _0x35c0=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x5c03[_0xd1d19a];return _0x52a79d;};'use strict';var client=require('../client');exports[_0x35c0('0x0')]=function(_0x474985,_0xa817c3,_0x65d682){return client[_0x35c0('0x1')](_0x35c0('0x2'),{'body':_0x474985,'reason':_0xa817c3,'entity':_0x65d682,'log':'VerifyAdditionalPhones'});};exports[_0x35c0('0x3')]=function(_0x177b63,_0x72bc6e,_0x4d315f){return client[_0x35c0('0x1')](_0x35c0('0x4'),{'body':_0x177b63,'duration':_0x72bc6e,'waitTime':_0x4d315f,'log':_0x35c0('0x4')});};exports[_0x35c0('0x5')]=function(_0x5a0b82){return function(){return client[_0x35c0('0x1')](_0x35c0('0x6'),{'body':_0x5a0b82,'log':_0x35c0('0x6')});};}; \ No newline at end of file +var _0xc6c0=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','verifyAdditionalPhones','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc6c0,0xfa));var _0x0c6c=function(_0x397f37,_0x3cf86d){_0x397f37=_0x397f37-0x0;var _0x31cae6=_0xc6c0[_0x397f37];return _0x31cae6;};'use strict';var client=require('../client');exports[_0x0c6c('0x0')]=function(_0x5df399,_0x1380bd,_0x5625cc){return client[_0x0c6c('0x1')]('VerifyAdditionalPhones',{'body':_0x5df399,'reason':_0x1380bd,'entity':_0x5625cc,'log':_0x0c6c('0x2')});};exports[_0x0c6c('0x3')]=function(_0x42e428,_0x49ada4,_0x2139d2){return client[_0x0c6c('0x1')](_0x0c6c('0x4'),{'body':_0x42e428,'duration':_0x49ada4,'waitTime':_0x2139d2,'log':_0x0c6c('0x4')});};exports[_0x0c6c('0x5')]=function(_0x50631e){return function(){return client[_0x0c6c('0x1')]('IncrementPreviewCounters',{'body':_0x50631e,'log':_0x0c6c('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 34b7ec9..b6120b0 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x015e=['checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone'];(function(_0x355f95,_0x369c0b){var _0x5e5db5=function(_0x59ef48){while(--_0x59ef48){_0x355f95['push'](_0x355f95['shift']());}};_0x5e5db5(++_0x369c0b);}(_0x015e,0x1aa));var _0xe015=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x015e[_0x2e4aa2];return _0x5e6092;};'use strict';var client=require(_0xe015('0x0'));exports[_0xe015('0x1')]=function(_0x115677){return client[_0xe015('0x2')](_0xe015('0x3'),{'options':{'where':{'VoiceQueueId':_0x115677[_0xe015('0x4')],'phone':_0x115677[_0xe015('0x5')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0xe015('0x6')]=function(_0x362f47){return client[_0xe015('0x2')](_0xe015('0x3'),{'options':{'where':{'CampaignId':_0x362f47[_0xe015('0x7')],'phone':_0x362f47[_0xe015('0x5')]},'raw':![]},'log':_0xe015('0x8')});}; \ No newline at end of file +var _0xb6af=['CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','GetCmHopperBlack','VoiceQueueId','phone'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xb6af,0xcd));var _0xfb6a=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0xb6af[_0x22e47a];return _0x15a12a;};'use strict';var client=require(_0xfb6a('0x0'));exports[_0xfb6a('0x1')]=function(_0x4cac65){return client['Request'](_0xfb6a('0x2'),{'options':{'where':{'VoiceQueueId':_0x4cac65[_0xfb6a('0x3')],'phone':_0x4cac65[_0xfb6a('0x4')]},'raw':![]},'log':'GetCmHopperBlack'});};exports['checkIsBlackListIvr']=function(_0x5b849e){return client['Request'](_0xfb6a('0x2'),{'options':{'where':{'CampaignId':_0x5b849e[_0xfb6a('0x5')],'phone':_0x5b849e['phone']},'raw':![]},'log':_0xfb6a('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 92a151b..5b8e8ad 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa575=['Request','CreateCmHopperFinal','../client','createContact','campaign','queue'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa575,0x1a6));var _0x5a57=function(_0x2991c7,_0x484cd2){_0x2991c7=_0x2991c7-0x0;var _0x492186=_0xa575[_0x2991c7];return _0x492186;};'use strict';var client=require(_0x5a57('0x0'));exports[_0x5a57('0x1')]=function(_0x5b05d6){return function(){_0x5b05d6[_0x5a57('0x2')]=_0x5b05d6[_0x5a57('0x3')];return client[_0x5a57('0x4')]('CreateCmHopperFinal',{'body':_0x5b05d6,'log':_0x5a57('0x5')});};}; \ No newline at end of file +var _0x5055=['Request','CreateCmHopperFinal','createContact','campaign','queue'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x5055,0x7a));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x5505('0x0')]=function(_0x3caba1){return function(){_0x3caba1[_0x5505('0x1')]=_0x3caba1[_0x5505('0x2')];return client[_0x5505('0x3')]('CreateCmHopperFinal',{'body':_0x3caba1,'log':_0x5505('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 323a609..deddc42 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6f0=['ivr','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','day','getCampaignHopperHistory','GetCampaignHopperHistory','startOf','endOf'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0xf6f0,0x157));var _0x0f6f=function(_0x561197,_0x2d7d64){_0x561197=_0x561197-0x0;var _0x191270=_0xf6f0[_0x561197];return _0x191270;};'use strict';var client=require('../client');var moment=require('moment');exports['createHistory']=function(_0x101d14){_0x101d14[_0x0f6f('0x0')]=_0x101d14[_0x0f6f('0x1')];return client[_0x0f6f('0x2')](_0x0f6f('0x3'),{'body':_0x101d14,'log':_0x0f6f('0x3')});};exports[_0x0f6f('0x4')]=function(_0x13055c){return client[_0x0f6f('0x2')](_0x0f6f('0x5'),{'options':{'where':{'endtime':{'$between':[moment()[_0x0f6f('0x6')](_0x13055c,_0x0f6f('0x7'))[_0x0f6f('0x8')](_0x0f6f('0x9')),moment()['format'](_0x0f6f('0x9'))]}},'raw':![]},'log':_0x0f6f('0xa')});};exports[_0x0f6f('0xb')]=function(){return function(){return client[_0x0f6f('0x2')](_0x0f6f('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x0f6f('0xd'))['format'](_0x0f6f('0x9')),moment()['endOf'](_0x0f6f('0xd'))[_0x0f6f('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x0f6f('0x1')},'raw':![]},'log':_0x0f6f('0xc')});};};exports[_0x0f6f('0xe')]=function(){return function(){return client['Request'](_0x0f6f('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0f6f('0x10')](_0x0f6f('0xd'))['format'](_0x0f6f('0x9')),moment()[_0x0f6f('0x11')](_0x0f6f('0xd'))[_0x0f6f('0x8')](_0x0f6f('0x9'))]},'campaigntype':_0x0f6f('0x12')},'raw':![]},'log':_0x0f6f('0xf')});};}; \ No newline at end of file +var _0x2d5d=['../client','moment','createHistory','campaign','queue','Request','avgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','startOf','endOf','day','getCampaignHopperHistory','GetCampaignHopperHistory','ivr'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x2d5d,0xbe));var _0xd2d5=function(_0x30a34b,_0x21e90c){_0x30a34b=_0x30a34b-0x0;var _0x47a19f=_0x2d5d[_0x30a34b];return _0x47a19f;};'use strict';var client=require(_0xd2d5('0x0'));var moment=require(_0xd2d5('0x1'));exports[_0xd2d5('0x2')]=function(_0x541e0c){_0x541e0c[_0xd2d5('0x3')]=_0x541e0c[_0xd2d5('0x4')];return client[_0xd2d5('0x5')]('CreateCmHopperHistory',{'body':_0x541e0c,'log':'CreateCmHopperHistory'});};exports[_0xd2d5('0x6')]=function(_0x2a798a){return client[_0xd2d5('0x5')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0xd2d5('0x7')](_0x2a798a,_0xd2d5('0x8'))[_0xd2d5('0x9')](_0xd2d5('0xa')),moment()[_0xd2d5('0x9')](_0xd2d5('0xa'))]}},'raw':![]},'log':_0xd2d5('0xb')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client['Request'](_0xd2d5('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xd2d5('0xd')]('day')[_0xd2d5('0x9')](_0xd2d5('0xa')),moment()[_0xd2d5('0xe')](_0xd2d5('0xf'))[_0xd2d5('0x9')](_0xd2d5('0xa'))]},'campaigntype':'queue'},'raw':![]},'log':_0xd2d5('0xc')});};};exports[_0xd2d5('0x10')]=function(){return function(){return client[_0xd2d5('0x5')](_0xd2d5('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xd2d5('0xd')](_0xd2d5('0xf'))[_0xd2d5('0x9')](_0xd2d5('0xa')),moment()[_0xd2d5('0xe')](_0xd2d5('0xf'))[_0xd2d5('0x9')](_0xd2d5('0xa'))]},'campaigntype':_0xd2d5('0x12')},'raw':![]},'log':_0xd2d5('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 63dfe46..f48daa2 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57b7=['../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','localstationid','minrate','maxrate','modem','faxdetect','t38timeout','tech','TrunkId','ListId','key','Trunk','callerid','active','notify','NotifyFaxAccount'];(function(_0x57bff0,_0x3567b1){var _0x30b143=function(_0x801da6){while(--_0x801da6){_0x57bff0['push'](_0x57bff0['shift']());}};_0x30b143(++_0x3567b1);}(_0x57b7,0x160));var _0x757b=function(_0x5b3910,_0x118b8d){_0x5b3910=_0x5b3910-0x0;var _0x6f8d30=_0x57b7[_0x5b3910];return _0x6f8d30;};'use strict';var client=require(_0x757b('0x0'));exports[_0x757b('0x1')]=function(){return function(){return client[_0x757b('0x2')](_0x757b('0x3'),{'options':{'raw':![],'attributes':['id',_0x757b('0x4'),_0x757b('0x5'),_0x757b('0x6'),'headerinfo',_0x757b('0x7'),_0x757b('0x8'),_0x757b('0x9'),_0x757b('0xa'),'gateway',_0x757b('0xb'),_0x757b('0xc'),_0x757b('0xd'),_0x757b('0xe'),_0x757b('0xf'),_0x757b('0x10')],'include':[{'model':_0x757b('0x11'),'as':_0x757b('0x11'),'attributes':['id','name',_0x757b('0x12'),_0x757b('0x13')]}]},'log':'getFaxAccount'});};};exports[_0x757b('0x14')]=function(_0x5a0164,_0x35be15){return client['Request'](_0x757b('0x15'),{'account':{'id':_0x5a0164},'body':_0x35be15,'log':_0x757b('0x15')});}; \ No newline at end of file +var _0xc891=['callerid','NotifyFaxAccount','../client','GetFaxAccount','description','ecm','headerinfo','minrate','maxrate','modem','gateway','t38timeout','tech','ListId','key','Trunk'];(function(_0x49190b,_0x3df5af){var _0x3d9c84=function(_0x7fee81){while(--_0x7fee81){_0x49190b['push'](_0x49190b['shift']());}};_0x3d9c84(++_0x3df5af);}(_0xc891,0x152));var _0x1c89=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc891[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x1c89('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request'](_0x1c89('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x1c89('0x2'),_0x1c89('0x3'),_0x1c89('0x4'),'localstationid',_0x1c89('0x5'),_0x1c89('0x6'),_0x1c89('0x7'),_0x1c89('0x8'),'faxdetect',_0x1c89('0x9'),_0x1c89('0xa'),'TrunkId',_0x1c89('0xb'),_0x1c89('0xc')],'include':[{'model':'Trunk','as':_0x1c89('0xd'),'attributes':['id','name',_0x1c89('0xe'),'active']}]},'log':'getFaxAccount'});};};exports['notify']=function(_0x478ca1,_0xbd061){return client['Request'](_0x1c89('0xf'),{'account':{'id':_0x478ca1},'body':_0xbd061,'log':_0x1c89('0xf')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 8792894..c5befea 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x129b=['../client','Request','UpdateFaxMessage'];(function(_0x5c2310,_0x2cacbf){var _0x3d6433=function(_0x19f85e){while(--_0x19f85e){_0x5c2310['push'](_0x5c2310['shift']());}};_0x3d6433(++_0x2cacbf);}(_0x129b,0x1ad));var _0xb129=function(_0x291276,_0x5a4690){_0x291276=_0x291276-0x0;var _0x303ab3=_0x129b[_0x291276];return _0x303ab3;};'use strict';var client=require(_0xb129('0x0'));exports['update']=function(_0x1e5469,_0x44e95f){return client[_0xb129('0x1')](_0xb129('0x2'),{'body':_0x44e95f,'options':{'where':{'AttachmentId':_0x1e5469}},'log':_0xb129('0x2')});}; \ No newline at end of file +var _0xd091=['UpdateFaxMessage','../client'];(function(_0x105041,_0x401872){var _0x430166=function(_0x158fa0){while(--_0x158fa0){_0x105041['push'](_0x105041['shift']());}};_0x430166(++_0x401872);}(_0xd091,0xf9));var _0x1d09=function(_0x17d69e,_0x27717d){_0x17d69e=_0x17d69e-0x0;var _0x4b153f=_0xd091[_0x17d69e];return _0x4b153f;};'use strict';var client=require(_0x1d09('0x0'));exports['update']=function(_0x112dd5,_0xd2bf88){return client['Request'](_0x1d09('0x1'),{'body':_0xd2bf88,'options':{'where':{'AttachmentId':_0x112dd5}},'log':'UpdateFaxMessage'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 0b58aad..66ebb4f 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdefd=['authType','type','serverUrl','DeskConfiguration','name','DeskField','Subjects','content','variableName','Variable','Descriptions','key','keyType','keyContent','idField','nameField','customField','Tag','../../client','getDeskAccounts','Request','GetDeskAccount','description','remoteUri'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0xdefd,0x1c2));var _0xddef=function(_0x1b3150,_0x501411){_0x1b3150=_0x1b3150-0x0;var _0x3e06aa=_0xdefd[_0x1b3150];return _0x3e06aa;};'use strict';var client=require(_0xddef('0x0'));exports[_0xddef('0x1')]=function(){return function(_0x55488e){return client[_0xddef('0x2')](_0xddef('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xddef('0x4'),'username','password',_0xddef('0x5'),_0xddef('0x6'),_0xddef('0x7'),_0xddef('0x8')],'include':[{'model':_0xddef('0x9'),'as':'Configurations','attributes':['id',_0xddef('0xa')],'include':[{'model':_0xddef('0xb'),'as':_0xddef('0xc'),'attributes':['id',_0xddef('0x7'),_0xddef('0xd'),_0xddef('0xe')],'include':[{'model':_0xddef('0xf'),'as':_0xddef('0xf'),'attributes':['id','name']}]},{'model':_0xddef('0xb'),'as':_0xddef('0x10'),'attributes':['id',_0xddef('0x7'),'content',_0xddef('0x11'),_0xddef('0x12'),_0xddef('0x13'),_0xddef('0xe')],'include':[{'model':_0xddef('0xf'),'as':_0xddef('0xf'),'attributes':['id',_0xddef('0xa')]}]},{'model':_0xddef('0xb'),'as':'Fields','attributes':['id',_0xddef('0x7'),_0xddef('0xd'),_0xddef('0x14'),_0xddef('0x15'),_0xddef('0x16'),_0xddef('0xe')],'include':[{'model':_0xddef('0xf'),'as':_0xddef('0xf'),'attributes':['id',_0xddef('0xa')]}]},{'model':_0xddef('0x17'),'as':'Tags','attributes':['id',_0xddef('0xa')]}]}]},'log':_0xddef('0x3')});};}; \ No newline at end of file +var _0x9e6a=['Variable','Descriptions','content','key','keyType','keyContent','variableName','Fields','idField','nameField','customField','Tag','Tags','../../client','Request','GetDeskAccount','name','username','password','remoteUri','authType','type','serverUrl','Configurations','DeskField','Subjects'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0x9e6a,0xdd));var _0xa9e6=function(_0x18fb4c,_0x578f22){_0x18fb4c=_0x18fb4c-0x0;var _0x4a75b3=_0x9e6a[_0x18fb4c];return _0x4a75b3;};'use strict';var client=require(_0xa9e6('0x0'));exports['getDeskAccounts']=function(){return function(_0x2f5f4e){return client[_0xa9e6('0x1')](_0xa9e6('0x2'),{'options':{'raw':![],'attributes':['id',_0xa9e6('0x3'),'description',_0xa9e6('0x4'),_0xa9e6('0x5'),_0xa9e6('0x6'),_0xa9e6('0x7'),_0xa9e6('0x8'),_0xa9e6('0x9')],'include':[{'model':'DeskConfiguration','as':_0xa9e6('0xa'),'attributes':['id',_0xa9e6('0x3')],'include':[{'model':_0xa9e6('0xb'),'as':_0xa9e6('0xc'),'attributes':['id',_0xa9e6('0x8'),'content','variableName'],'include':[{'model':_0xa9e6('0xd'),'as':_0xa9e6('0xd'),'attributes':['id',_0xa9e6('0x3')]}]},{'model':_0xa9e6('0xb'),'as':_0xa9e6('0xe'),'attributes':['id',_0xa9e6('0x8'),_0xa9e6('0xf'),_0xa9e6('0x10'),_0xa9e6('0x11'),_0xa9e6('0x12'),_0xa9e6('0x13')],'include':[{'model':_0xa9e6('0xd'),'as':'Variable','attributes':['id','name']}]},{'model':_0xa9e6('0xb'),'as':_0xa9e6('0x14'),'attributes':['id',_0xa9e6('0x8'),'content',_0xa9e6('0x15'),_0xa9e6('0x16'),_0xa9e6('0x17'),_0xa9e6('0x13')],'include':[{'model':'Variable','as':_0xa9e6('0xd'),'attributes':['id','name']}]},{'model':_0xa9e6('0x18'),'as':_0xa9e6('0x19'),'attributes':['id',_0xa9e6('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index f41e9af..f37fcc5 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3070=['Configurations','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','CloudProvider','data2','data5','data7','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','clientSecret','serverUrl','description','modernAuthentication'];(function(_0x28bef9,_0x28e8d6){var _0x45db81=function(_0x269033){while(--_0x269033){_0x28bef9['push'](_0x28bef9['shift']());}};_0x45db81(++_0x28e8d6);}(_0x3070,0x75));var _0x0307=function(_0x2bd752,_0x41d4d2){_0x2bd752=_0x2bd752-0x0;var _0x2dce67=_0x3070[_0x2bd752];return _0x2dce67;};'use strict';var client=require('../../client');exports[_0x0307('0x0')]=function(){return function(_0x50afb5){return client[_0x0307('0x1')](_0x0307('0x2'),{'options':{'raw':![],'attributes':['id',_0x0307('0x3'),_0x0307('0x4'),_0x0307('0x5'),_0x0307('0x6'),'tenantId','clientId',_0x0307('0x7'),_0x0307('0x8'),_0x0307('0x9'),_0x0307('0xa')],'include':[{'model':'Dynamics365Configuration','as':_0x0307('0xb'),'attributes':['id',_0x0307('0x3'),'ticketType',_0x0307('0xc'),_0x0307('0xd'),_0x0307('0xe')],'include':[{'model':_0x0307('0xf'),'as':_0x0307('0x10'),'attributes':['id',_0x0307('0x11'),_0x0307('0x12'),_0x0307('0x13')],'include':[{'model':_0x0307('0x14'),'as':'Variable','attributes':['id',_0x0307('0x3')]}]},{'model':'Dynamics365Field','as':_0x0307('0x15'),'attributes':['id',_0x0307('0x11'),_0x0307('0x12'),_0x0307('0x16'),_0x0307('0x17'),_0x0307('0x18'),_0x0307('0x13')],'include':[{'model':_0x0307('0x14'),'as':_0x0307('0x14'),'attributes':['id',_0x0307('0x3')]}]},{'model':_0x0307('0xf'),'as':_0x0307('0x19'),'attributes':['id',_0x0307('0x11'),_0x0307('0x12'),_0x0307('0x1a'),'nameField',_0x0307('0x1b'),_0x0307('0x13')],'include':[{'model':_0x0307('0x14'),'as':'Variable','attributes':['id','name']}]}]},{'model':_0x0307('0x1c'),'as':_0x0307('0x1c'),'attributes':['id',_0x0307('0x1d'),_0x0307('0x1e'),_0x0307('0x1f')]}]},'log':_0x0307('0x2')});};}; \ No newline at end of file +var _0x065e=['additionalSearchContact','openNewTab','Dynamics365Field','type','content','variableName','Variable','key','keyContent','Fields','idField','nameField','customField','CloudProvider','data2','data5','data7','../../client','GetDynamics365Account','name','username','tenantId','clientId','serverUrl','description','modernAuthentication','Configurations','ticketType','moduleCreate'];(function(_0x2b76f1,_0x4f6c4d){var _0x3a32e3=function(_0x55fead){while(--_0x55fead){_0x2b76f1['push'](_0x2b76f1['shift']());}};_0x3a32e3(++_0x4f6c4d);}(_0x065e,0x1a7));var _0xe065=function(_0x1db51d,_0x12b986){_0x1db51d=_0x1db51d-0x0;var _0xcf9d61=_0x065e[_0x1db51d];return _0xcf9d61;};'use strict';var client=require(_0xe065('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x549f09){return client['Request'](_0xe065('0x1'),{'options':{'raw':![],'attributes':['id',_0xe065('0x2'),_0xe065('0x3'),'password','remoteUri',_0xe065('0x4'),_0xe065('0x5'),'clientSecret',_0xe065('0x6'),_0xe065('0x7'),_0xe065('0x8')],'include':[{'model':'Dynamics365Configuration','as':_0xe065('0x9'),'attributes':['id','name',_0xe065('0xa'),_0xe065('0xb'),_0xe065('0xc'),_0xe065('0xd')],'include':[{'model':_0xe065('0xe'),'as':'Subjects','attributes':['id',_0xe065('0xf'),_0xe065('0x10'),_0xe065('0x11')],'include':[{'model':_0xe065('0x12'),'as':_0xe065('0x12'),'attributes':['id',_0xe065('0x2')]}]},{'model':'Dynamics365Field','as':'Descriptions','attributes':['id',_0xe065('0xf'),_0xe065('0x10'),_0xe065('0x13'),'keyType',_0xe065('0x14'),_0xe065('0x11')],'include':[{'model':_0xe065('0x12'),'as':_0xe065('0x12'),'attributes':['id',_0xe065('0x2')]}]},{'model':'Dynamics365Field','as':_0xe065('0x15'),'attributes':['id',_0xe065('0xf'),_0xe065('0x10'),_0xe065('0x16'),_0xe065('0x17'),_0xe065('0x18'),_0xe065('0x11')],'include':[{'model':'Variable','as':_0xe065('0x12'),'attributes':['id',_0xe065('0x2')]}]}]},{'model':'CloudProvider','as':_0xe065('0x19'),'attributes':['id',_0xe065('0x1a'),_0xe065('0x1b'),_0xe065('0x1c')]}]},'log':_0xe065('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 50d201c..f79e559 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1572=['username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','variableName','Variable','Descriptions','content','key','keyType','Fields','idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name'];(function(_0x383859,_0x2e786e){var _0x413dbd=function(_0x521370){while(--_0x521370){_0x383859['push'](_0x383859['shift']());}};_0x413dbd(++_0x2e786e);}(_0x1572,0xf5));var _0x2157=function(_0x2e4774,_0x1f8fc1){_0x2e4774=_0x2e4774-0x0;var _0x302a16=_0x1572[_0x2e4774];return _0x302a16;};'use strict';var client=require(_0x2157('0x0'));exports[_0x2157('0x1')]=function(){return function(_0x1ee938){return client[_0x2157('0x2')](_0x2157('0x3'),{'options':{'raw':![],'attributes':['id',_0x2157('0x4'),_0x2157('0x5'),_0x2157('0x6'),_0x2157('0x7'),_0x2157('0x8')],'include':[{'model':_0x2157('0x9'),'as':_0x2157('0xa'),'attributes':['id',_0x2157('0x4')],'include':[{'model':_0x2157('0xb'),'attributes':['id',_0x2157('0x4')]},{'model':_0x2157('0xc'),'as':_0x2157('0xd'),'attributes':['id',_0x2157('0xe'),'content',_0x2157('0xf')],'include':[{'model':'Variable','as':_0x2157('0x10'),'attributes':['id',_0x2157('0x4')]}]},{'model':_0x2157('0xc'),'as':_0x2157('0x11'),'attributes':['id',_0x2157('0xe'),_0x2157('0x12'),_0x2157('0x13'),_0x2157('0x14'),'keyContent',_0x2157('0xf')],'include':[{'model':_0x2157('0x10'),'as':_0x2157('0x10'),'attributes':['id',_0x2157('0x4')]}]},{'model':'FreshdeskField','as':_0x2157('0x15'),'attributes':['id',_0x2157('0xe'),_0x2157('0x12'),_0x2157('0x16'),_0x2157('0x17'),_0x2157('0x18'),_0x2157('0xf')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]}]},'log':_0x2157('0x3')});};}; \ No newline at end of file +var _0xcae2=['variableName','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','Descriptions','content','key','keyContent','Variable','Fields','idField','customField'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcae2,0x143));var _0x2cae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcae2[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x2cae('0x0'));exports[_0x2cae('0x1')]=function(){return function(_0x207474){return client[_0x2cae('0x2')](_0x2cae('0x3'),{'options':{'raw':![],'attributes':['id',_0x2cae('0x4'),_0x2cae('0x5'),'apiKey',_0x2cae('0x6'),_0x2cae('0x7')],'include':[{'model':_0x2cae('0x8'),'as':_0x2cae('0x9'),'attributes':['id','name'],'include':[{'model':_0x2cae('0xa'),'attributes':['id',_0x2cae('0x4')]},{'model':_0x2cae('0xb'),'as':_0x2cae('0xc'),'attributes':['id',_0x2cae('0xd'),'content','variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x2cae('0x4')]}]},{'model':_0x2cae('0xb'),'as':_0x2cae('0xe'),'attributes':['id',_0x2cae('0xd'),_0x2cae('0xf'),_0x2cae('0x10'),'keyType',_0x2cae('0x11'),'variableName'],'include':[{'model':_0x2cae('0x12'),'as':_0x2cae('0x12'),'attributes':['id',_0x2cae('0x4')]}]},{'model':_0x2cae('0xb'),'as':_0x2cae('0x13'),'attributes':['id',_0x2cae('0xd'),'content',_0x2cae('0x14'),'nameField',_0x2cae('0x15'),_0x2cae('0x16')],'include':[{'model':'Variable','as':_0x2cae('0x12'),'attributes':['id',_0x2cae('0x4')]}]}]}]},'log':_0x2cae('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 7772027..83f07b1 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a6b=['username','apiKey','remoteUri','FreshsalesConfiguration','name','FreshsalesField','type','content','variableName','Descriptions','keyType','keyContent','Variable','GetFreshsalesccount','../../client','GetFreshsalesAccount'];(function(_0x13e3a4,_0x2b9710){var _0x10b023=function(_0xa1da88){while(--_0xa1da88){_0x13e3a4['push'](_0x13e3a4['shift']());}};_0x10b023(++_0x2b9710);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x73e726,_0x5a9c29){_0x73e726=_0x73e726-0x0;var _0x261d0c=_0x0a6b[_0x73e726];return _0x261d0c;};'use strict';var client=require(_0xb0a6('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x5d7cd9){return client['Request'](_0xb0a6('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xb0a6('0x2'),_0xb0a6('0x3'),_0xb0a6('0x4'),'serverUrl'],'include':[{'model':_0xb0a6('0x5'),'as':'Configurations','attributes':['id',_0xb0a6('0x6')],'include':[{'model':_0xb0a6('0x7'),'as':'Subjects','attributes':['id',_0xb0a6('0x8'),_0xb0a6('0x9'),_0xb0a6('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0xb0a6('0x7'),'as':_0xb0a6('0xb'),'attributes':['id',_0xb0a6('0x8'),_0xb0a6('0x9'),'key',_0xb0a6('0xc'),_0xb0a6('0xd'),'variableName'],'include':[{'model':_0xb0a6('0xe'),'as':_0xb0a6('0xe'),'attributes':['id',_0xb0a6('0x6')]}]}]}]},'log':_0xb0a6('0xf')});};}; \ No newline at end of file +var _0x77d4=['Subjects','variableName','Descriptions','type','content','keyType','Variable','GetFreshsalesccount','getFreshsalesAccounts','Request','name','username','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x77d4,0x108));var _0x477d=function(_0x484d35,_0x41e4ba){_0x484d35=_0x484d35-0x0;var _0x2a3f74=_0x77d4[_0x484d35];return _0x2a3f74;};'use strict';var client=require('../../client');exports[_0x477d('0x0')]=function(){return function(_0x49b615){return client[_0x477d('0x1')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x477d('0x2'),_0x477d('0x3'),'apiKey','remoteUri',_0x477d('0x4')],'include':[{'model':_0x477d('0x5'),'as':_0x477d('0x6'),'attributes':['id',_0x477d('0x2')],'include':[{'model':_0x477d('0x7'),'as':_0x477d('0x8'),'attributes':['id','type','content',_0x477d('0x9')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x477d('0x2')]}]},{'model':_0x477d('0x7'),'as':_0x477d('0xa'),'attributes':['id',_0x477d('0xb'),_0x477d('0xc'),'key',_0x477d('0xd'),'keyContent',_0x477d('0x9')],'include':[{'model':_0x477d('0xe'),'as':'Variable','attributes':['id',_0x477d('0x2')]}]}]}]},'log':_0x477d('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index c17ba36..a023c15 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa503=['clientSecret','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','clientId'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xa503,0x143));var _0x3a50=function(_0x4b0c65,_0x5ca727){_0x4b0c65=_0x4b0c65-0x0;var _0x3a209e=_0xa503[_0x4b0c65];return _0x3a209e;};'use strict';var client=require(_0x3a50('0x0'));exports[_0x3a50('0x1')]=function(){return function(_0x58bd8d){return client[_0x3a50('0x2')](_0x3a50('0x3'),{'options':{'raw':![],'attributes':['id',_0x3a50('0x4'),_0x3a50('0x5'),'password','remoteUri',_0x3a50('0x6'),_0x3a50('0x7'),'securityToken','serverUrl',_0x3a50('0x8')],'include':[{'model':_0x3a50('0x9'),'as':_0x3a50('0xa'),'attributes':['id',_0x3a50('0x4'),_0x3a50('0xb'),_0x3a50('0xc'),'ticketType',_0x3a50('0xd'),_0x3a50('0xe'),_0x3a50('0xf'),_0x3a50('0x10')],'include':[{'model':_0x3a50('0x11'),'as':_0x3a50('0x12'),'include':[{'model':_0x3a50('0x13'),'as':'Variable','attributes':['id',_0x3a50('0x4')]}]},{'model':_0x3a50('0x11'),'as':_0x3a50('0x14'),'include':[{'model':'Variable','as':_0x3a50('0x13'),'attributes':['id','name']}]},{'model':_0x3a50('0x11'),'as':_0x3a50('0x15'),'include':[{'model':_0x3a50('0x13'),'as':_0x3a50('0x13'),'attributes':['id','name']}]}]}]},'log':_0x3a50('0x3')});};}; \ No newline at end of file +var _0x3266=['Descriptions','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','remoteUri','clientSecret','serverUrl','type','SalesforceConfiguration','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','SalesforceField','Subjects','Variable'];(function(_0x3903bd,_0x4e46bd){var _0x2d0af9=function(_0x3a3f1d){while(--_0x3a3f1d){_0x3903bd['push'](_0x3903bd['shift']());}};_0x2d0af9(++_0x4e46bd);}(_0x3266,0x6a));var _0x6326=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x3266[_0x4c6d6f];return _0x2d4478;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(){return function(_0x3a3ebd){return client[_0x6326('0x2')](_0x6326('0x3'),{'options':{'raw':![],'attributes':['id',_0x6326('0x4'),_0x6326('0x5'),_0x6326('0x6'),_0x6326('0x7'),'clientId',_0x6326('0x8'),'securityToken',_0x6326('0x9'),_0x6326('0xa')],'include':[{'model':_0x6326('0xb'),'as':'Configurations','attributes':['id',_0x6326('0x4'),'moduleSearch',_0x6326('0xc'),_0x6326('0xd'),_0x6326('0xe'),_0x6326('0xf'),_0x6326('0x10'),'additionalSearchLead'],'include':[{'model':_0x6326('0x11'),'as':_0x6326('0x12'),'include':[{'model':_0x6326('0x13'),'as':_0x6326('0x13'),'attributes':['id',_0x6326('0x4')]}]},{'model':_0x6326('0x11'),'as':_0x6326('0x14'),'include':[{'model':_0x6326('0x13'),'as':_0x6326('0x13'),'attributes':['id',_0x6326('0x4')]}]},{'model':'SalesforceField','as':'Fields','include':[{'model':_0x6326('0x13'),'as':_0x6326('0x13'),'attributes':['id','name']}]}]}]},'log':_0x6326('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 0cb9b3b..4698675 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['type','variableName','Variable','Descriptions','content','key','keyContent','Fields','nameField','customField','GetServicenowkAccount','getServicenowAccounts','GetServicenowAccount','name','description','username','password','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x57ca,0x108));var _0xa57c=function(_0x473baf,_0x46edc6){_0x473baf=_0x473baf-0x0;var _0x660f23=_0x57ca[_0x473baf];return _0x660f23;};'use strict';var client=require('../../client');exports[_0xa57c('0x0')]=function(){return function(_0x4ad696){return client['Request'](_0xa57c('0x1'),{'options':{'raw':![],'attributes':['id',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),'email',_0xa57c('0x6'),_0xa57c('0x7')],'include':[{'model':_0xa57c('0x8'),'as':_0xa57c('0x9'),'attributes':['id',_0xa57c('0x2')],'include':[{'model':_0xa57c('0xa'),'as':_0xa57c('0xb'),'attributes':['id',_0xa57c('0xc'),'content',_0xa57c('0xd')],'include':[{'model':'Variable','as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]},{'model':'ServicenowField','as':_0xa57c('0xf'),'attributes':['id','type',_0xa57c('0x10'),_0xa57c('0x11'),'keyType',_0xa57c('0x12'),'variableName'],'include':[{'model':_0xa57c('0xe'),'as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]},{'model':_0xa57c('0xa'),'as':_0xa57c('0x13'),'attributes':['id','type',_0xa57c('0x10'),'idField',_0xa57c('0x14'),_0xa57c('0x15'),_0xa57c('0xd')],'include':[{'model':_0xa57c('0xe'),'as':_0xa57c('0xe'),'attributes':['id',_0xa57c('0x2')]}]}]}]},'log':_0xa57c('0x16')});};}; \ No newline at end of file +var _0x2542=['content','variableName','Variable','key','keyType','Fields','idField','nameField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','name','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','type'];(function(_0xad54ac,_0x52d228){var _0x16d25e=function(_0x5157e1){while(--_0x5157e1){_0xad54ac['push'](_0xad54ac['shift']());}};_0x16d25e(++_0x52d228);}(_0x2542,0x169));var _0x2254=function(_0x1640c5,_0x3b2eec){_0x1640c5=_0x1640c5-0x0;var _0x561b87=_0x2542[_0x1640c5];return _0x561b87;};'use strict';var client=require(_0x2254('0x0'));exports[_0x2254('0x1')]=function(){return function(_0x2f3bcd){return client[_0x2254('0x2')]('GetServicenowAccount',{'options':{'raw':![],'attributes':['id',_0x2254('0x3'),'description',_0x2254('0x4'),_0x2254('0x5'),_0x2254('0x6'),_0x2254('0x7'),_0x2254('0x8')],'include':[{'model':'ServicenowConfiguration','as':_0x2254('0x9'),'attributes':['id',_0x2254('0x3')],'include':[{'model':_0x2254('0xa'),'as':_0x2254('0xb'),'attributes':['id',_0x2254('0xc'),_0x2254('0xd'),_0x2254('0xe')],'include':[{'model':_0x2254('0xf'),'as':_0x2254('0xf'),'attributes':['id',_0x2254('0x3')]}]},{'model':_0x2254('0xa'),'as':'Descriptions','attributes':['id',_0x2254('0xc'),_0x2254('0xd'),_0x2254('0x10'),_0x2254('0x11'),'keyContent','variableName'],'include':[{'model':_0x2254('0xf'),'as':_0x2254('0xf'),'attributes':['id',_0x2254('0x3')]}]},{'model':_0x2254('0xa'),'as':_0x2254('0x12'),'attributes':['id',_0x2254('0xc'),'content',_0x2254('0x13'),_0x2254('0x14'),'customField',_0x2254('0xe')],'include':[{'model':_0x2254('0xf'),'as':_0x2254('0xf'),'attributes':['id',_0x2254('0x3')]}]}]}]},'log':_0x2254('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 0de5ae1..71c5fc3 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['variableName','key','keyContent','Variable','SugarcrmField','Fields','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','SugarcrmConfiguration','Configurations','type','content'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0x14a0,0x8e));var _0x014a=function(_0x30a42d,_0x41efa3){_0x30a42d=_0x30a42d-0x0;var _0x3dd4ee=_0x14a0[_0x30a42d];return _0x3dd4ee;};'use strict';var client=require('../../client');exports[_0x014a('0x0')]=function(){return function(_0x451138){return client[_0x014a('0x1')](_0x014a('0x2'),{'options':{'raw':![],'attributes':['id',_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),'remoteUri','serverUrl'],'include':[{'model':_0x014a('0x6'),'as':_0x014a('0x7'),'attributes':['id',_0x014a('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x014a('0x8'),_0x014a('0x9'),_0x014a('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x014a('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id','type','content',_0x014a('0xb'),'keyType',_0x014a('0xc'),_0x014a('0xa')],'include':[{'model':'Variable','as':_0x014a('0xd'),'attributes':['id',_0x014a('0x3')]}]},{'model':_0x014a('0xe'),'as':_0x014a('0xf'),'attributes':['id',_0x014a('0x8'),_0x014a('0x9'),_0x014a('0x10'),_0x014a('0x11'),_0x014a('0x12'),_0x014a('0xa')],'include':[{'model':_0x014a('0xd'),'as':_0x014a('0xd'),'attributes':['id','name']}]}]}]},'log':_0x014a('0x2')});};}; \ No newline at end of file +var _0x1a85=['serverUrl','Configurations','SugarcrmField','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','name','Fields','idField','nameField','Request','GetSugarcrmAccount','password','remoteUri'];(function(_0x39264b,_0x20a29d){var _0x4d5c13=function(_0x3d6e37){while(--_0x3d6e37){_0x39264b['push'](_0x39264b['shift']());}};_0x4d5c13(++_0x20a29d);}(_0x1a85,0x178));var _0x51a8=function(_0x5b620e,_0x266273){_0x5b620e=_0x5b620e-0x0;var _0x6b7008=_0x1a85[_0x5b620e];return _0x6b7008;};'use strict';var client=require('../../client');exports['getSugarcrmAccounts']=function(){return function(_0x305f18){return client[_0x51a8('0x0')](_0x51a8('0x1'),{'options':{'raw':![],'attributes':['id','name','username',_0x51a8('0x2'),_0x51a8('0x3'),_0x51a8('0x4')],'include':[{'model':'SugarcrmConfiguration','as':_0x51a8('0x5'),'attributes':['id','name'],'include':[{'model':_0x51a8('0x6'),'as':'Subjects','attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),'variableName'],'include':[{'model':_0x51a8('0x9'),'as':'Variable','attributes':['id','name']}]},{'model':_0x51a8('0x6'),'as':_0x51a8('0xa'),'attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe')],'include':[{'model':_0x51a8('0x9'),'as':_0x51a8('0x9'),'attributes':['id',_0x51a8('0xf')]}]},{'model':_0x51a8('0x6'),'as':_0x51a8('0x10'),'attributes':['id',_0x51a8('0x7'),_0x51a8('0x8'),_0x51a8('0x11'),_0x51a8('0x12'),'customField',_0x51a8('0xe')],'include':[{'model':_0x51a8('0x9'),'as':_0x51a8('0x9'),'attributes':['id','name']}]}]}]},'log':_0x51a8('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 73a607b..e548bbb 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97dc=['remoteUri','serverUrl','VtigerConfiguration','Configurations','Subjects','type','content','Variable','key','variableName','VtigerField','idField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0x97dc,0xe9));var _0xc97d=function(_0x193288,_0x2ecd4a){_0x193288=_0x193288-0x0;var _0x54709d=_0x97dc[_0x193288];return _0x54709d;};'use strict';var client=require(_0xc97d('0x0'));exports[_0xc97d('0x1')]=function(){return function(_0x2cac6e){return client[_0xc97d('0x2')](_0xc97d('0x3'),{'options':{'raw':![],'attributes':['id',_0xc97d('0x4'),_0xc97d('0x5'),_0xc97d('0x6'),'accessKey',_0xc97d('0x7'),_0xc97d('0x8')],'include':[{'model':_0xc97d('0x9'),'as':_0xc97d('0xa'),'attributes':['id',_0xc97d('0x4')],'include':[{'model':'VtigerField','as':_0xc97d('0xb'),'attributes':['id',_0xc97d('0xc'),_0xc97d('0xd'),'variableName'],'include':[{'model':_0xc97d('0xe'),'as':'Variable','attributes':['id',_0xc97d('0x4')]}]},{'model':'VtigerField','as':'Descriptions','attributes':['id',_0xc97d('0xc'),_0xc97d('0xd'),_0xc97d('0xf'),'keyType','keyContent',_0xc97d('0x10')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0xc97d('0x11'),'as':'Fields','attributes':['id',_0xc97d('0xc'),_0xc97d('0xd'),_0xc97d('0x12'),'nameField',_0xc97d('0x13'),_0xc97d('0x10')],'include':[{'model':_0xc97d('0xe'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0xc97d('0x3')});};}; \ No newline at end of file +var _0x0731=['variableName','Variable','content','keyType','keyContent','Fields','nameField','customField','../../client','getVtigerAccounts','GetVtigerAccount','name','description','VtigerConfiguration','Configurations','VtigerField','Subjects'];(function(_0x320d1f,_0x5e4279){var _0x49c4cd=function(_0x365a39){while(--_0x365a39){_0x320d1f['push'](_0x320d1f['shift']());}};_0x49c4cd(++_0x5e4279);}(_0x0731,0x7f));var _0x1073=function(_0x543e4f,_0x22c39a){_0x543e4f=_0x543e4f-0x0;var _0x4dc449=_0x0731[_0x543e4f];return _0x4dc449;};'use strict';var client=require(_0x1073('0x0'));exports[_0x1073('0x1')]=function(){return function(_0x25f325){return client['Request'](_0x1073('0x2'),{'options':{'raw':![],'attributes':['id',_0x1073('0x3'),_0x1073('0x4'),'username','accessKey','remoteUri','serverUrl'],'include':[{'model':_0x1073('0x5'),'as':_0x1073('0x6'),'attributes':['id','name'],'include':[{'model':_0x1073('0x7'),'as':_0x1073('0x8'),'attributes':['id','type','content',_0x1073('0x9')],'include':[{'model':_0x1073('0xa'),'as':_0x1073('0xa'),'attributes':['id','name']}]},{'model':'VtigerField','as':'Descriptions','attributes':['id','type',_0x1073('0xb'),'key',_0x1073('0xc'),_0x1073('0xd'),_0x1073('0x9')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x1073('0x3')]}]},{'model':'VtigerField','as':_0x1073('0xe'),'attributes':['id','type','content','idField',_0x1073('0xf'),_0x1073('0x10'),'variableName'],'include':[{'model':_0x1073('0xa'),'as':_0x1073('0xa'),'attributes':['id','name']}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 6a3623c..e2f3c1a 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00ed=['nameField','customField','../../client','Request','name','username','password','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','Subjects','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField'];(function(_0x421673,_0x364b94){var _0x100326=function(_0x13665b){while(--_0x13665b){_0x421673['push'](_0x421673['shift']());}};_0x100326(++_0x364b94);}(_0x00ed,0x1f0));var _0xd00e=function(_0x2709e4,_0x4cb87c){_0x2709e4=_0x2709e4-0x0;var _0x420dc8=_0x00ed[_0x2709e4];return _0x420dc8;};'use strict';var client=require(_0xd00e('0x0'));exports['getZendeskAccounts']=function(){return function(_0x5b5cf9){return client[_0xd00e('0x1')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0xd00e('0x2'),_0xd00e('0x3'),_0xd00e('0x4'),_0xd00e('0x5'),_0xd00e('0x6'),_0xd00e('0x7'),_0xd00e('0x8'),_0xd00e('0x9')],'include':[{'model':_0xd00e('0xa'),'as':_0xd00e('0xb'),'attributes':['id',_0xd00e('0x2')],'include':[{'model':_0xd00e('0xc'),'attributes':['id',_0xd00e('0x2')]},{'model':_0xd00e('0xd'),'as':_0xd00e('0xe'),'attributes':['id',_0xd00e('0x9'),_0xd00e('0xf'),_0xd00e('0x10')],'include':[{'model':'Variable','as':_0xd00e('0x11'),'attributes':['id','name']}]},{'model':_0xd00e('0xd'),'as':_0xd00e('0x12'),'attributes':['id','type','content',_0xd00e('0x13'),_0xd00e('0x14'),_0xd00e('0x15'),_0xd00e('0x10')],'include':[{'model':'Variable','as':_0xd00e('0x11'),'attributes':['id',_0xd00e('0x2')]}]},{'model':_0xd00e('0xd'),'as':_0xd00e('0x16'),'attributes':['id',_0xd00e('0x9'),_0xd00e('0xf'),_0xd00e('0x17'),_0xd00e('0x18'),_0xd00e('0x19'),'variableName'],'include':[{'model':_0xd00e('0x11'),'as':_0xd00e('0x11'),'attributes':['id','name']}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file +var _0x8421=['key','keyType','Fields','idField','nameField','../../client','getZendeskAccounts','Request','GetZendeskAccount','username','password','token','remoteUri','authType','serverUrl','type','Configurations','name','Tag','ZendeskField','Subjects','content','variableName','Variable','Descriptions'];(function(_0x132889,_0x2207a8){var _0xd93752=function(_0x572faa){while(--_0x572faa){_0x132889['push'](_0x132889['shift']());}};_0xd93752(++_0x2207a8);}(_0x8421,0x118));var _0x1842=function(_0x2a9f85,_0x2aeb56){_0x2a9f85=_0x2a9f85-0x0;var _0x4dae9f=_0x8421[_0x2a9f85];return _0x4dae9f;};'use strict';var client=require(_0x1842('0x0'));exports[_0x1842('0x1')]=function(){return function(_0x4b3faf){return client[_0x1842('0x2')](_0x1842('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x1842('0x4'),_0x1842('0x5'),_0x1842('0x6'),_0x1842('0x7'),_0x1842('0x8'),_0x1842('0x9'),_0x1842('0xa')],'include':[{'model':'ZendeskConfiguration','as':_0x1842('0xb'),'attributes':['id',_0x1842('0xc')],'include':[{'model':_0x1842('0xd'),'attributes':['id',_0x1842('0xc')]},{'model':_0x1842('0xe'),'as':_0x1842('0xf'),'attributes':['id',_0x1842('0xa'),_0x1842('0x10'),_0x1842('0x11')],'include':[{'model':_0x1842('0x12'),'as':'Variable','attributes':['id',_0x1842('0xc')]}]},{'model':'ZendeskField','as':_0x1842('0x13'),'attributes':['id',_0x1842('0xa'),_0x1842('0x10'),_0x1842('0x14'),_0x1842('0x15'),'keyContent',_0x1842('0x11')],'include':[{'model':_0x1842('0x12'),'as':_0x1842('0x12'),'attributes':['id',_0x1842('0xc')]}]},{'model':_0x1842('0xe'),'as':_0x1842('0x16'),'attributes':['id','type',_0x1842('0x10'),_0x1842('0x17'),_0x1842('0x18'),'customField',_0x1842('0x11')],'include':[{'model':_0x1842('0x12'),'as':_0x1842('0x12'),'attributes':['id',_0x1842('0xc')]}]}]}]},'log':_0x1842('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index a31fe90..cf85f09 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff8b=['Variable','ZohoField','Descriptions','type','key','keyType','keyContent','variableName','Fields','nameField','GetZohoAccount','getZohoAccounts','Request','name','description','host','zone','clientId','clientSecret','code','refreshToken','ZohoConfiguration','Configurations','moduleCreate','Subjects','content'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff8b,0x8d));var _0xbff8=function(_0xb3c24f,_0x3d56ff){_0xb3c24f=_0xb3c24f-0x0;var _0x269e07=_0xff8b[_0xb3c24f];return _0x269e07;};'use strict';var client=require('../../client');exports[_0xbff8('0x0')]=function(){return function(_0x356129){return client[_0xbff8('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0xbff8('0x2'),_0xbff8('0x3'),_0xbff8('0x4'),_0xbff8('0x5'),_0xbff8('0x6'),_0xbff8('0x7'),'serverUrl',_0xbff8('0x8'),_0xbff8('0x9')],'include':[{'model':_0xbff8('0xa'),'as':_0xbff8('0xb'),'attributes':['id',_0xbff8('0x2'),_0xbff8('0xc'),'moduleSearch',_0xbff8('0x3')],'include':[{'model':'ZohoField','as':_0xbff8('0xd'),'attributes':['id','type',_0xbff8('0xe'),'variableName'],'include':[{'model':_0xbff8('0xf'),'as':'Variable','attributes':['id',_0xbff8('0x2')]}]},{'model':_0xbff8('0x10'),'as':_0xbff8('0x11'),'attributes':['id',_0xbff8('0x12'),_0xbff8('0xe'),_0xbff8('0x13'),_0xbff8('0x14'),_0xbff8('0x15'),_0xbff8('0x16')],'include':[{'model':_0xbff8('0xf'),'as':_0xbff8('0xf'),'attributes':['id',_0xbff8('0x2')]}]},{'model':_0xbff8('0x10'),'as':_0xbff8('0x17'),'attributes':['id','type',_0xbff8('0xe'),'idField',_0xbff8('0x18'),'customField',_0xbff8('0x16')],'include':[{'model':'Variable','as':_0xbff8('0xf'),'attributes':['id',_0xbff8('0x2')]}]}]}]},'log':_0xbff8('0x19')});};}; \ No newline at end of file +var _0x5ff6=['key','keyType','keyContent','Fields','idField','nameField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientId','clientSecret','serverUrl','code','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','type','variableName','Variable','Descriptions','content'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5ff6,0x7b));var _0x65ff=function(_0x38eda4,_0x1911a4){_0x38eda4=_0x38eda4-0x0;var _0x1cd971=_0x5ff6[_0x38eda4];return _0x1cd971;};'use strict';var client=require(_0x65ff('0x0'));exports[_0x65ff('0x1')]=function(){return function(_0x4be498){return client[_0x65ff('0x2')](_0x65ff('0x3'),{'options':{'raw':![],'attributes':['id',_0x65ff('0x4'),_0x65ff('0x5'),_0x65ff('0x6'),_0x65ff('0x7'),_0x65ff('0x8'),_0x65ff('0x9'),_0x65ff('0xa'),_0x65ff('0xb'),'refreshToken'],'include':[{'model':'ZohoConfiguration','as':_0x65ff('0xc'),'attributes':['id',_0x65ff('0x4'),_0x65ff('0xd'),_0x65ff('0xe'),_0x65ff('0x5')],'include':[{'model':_0x65ff('0xf'),'as':_0x65ff('0x10'),'attributes':['id',_0x65ff('0x11'),'content',_0x65ff('0x12')],'include':[{'model':_0x65ff('0x13'),'as':'Variable','attributes':['id','name']}]},{'model':'ZohoField','as':_0x65ff('0x14'),'attributes':['id',_0x65ff('0x11'),_0x65ff('0x15'),_0x65ff('0x16'),_0x65ff('0x17'),_0x65ff('0x18'),_0x65ff('0x12')],'include':[{'model':_0x65ff('0x13'),'as':_0x65ff('0x13'),'attributes':['id',_0x65ff('0x4')]}]},{'model':'ZohoField','as':_0x65ff('0x19'),'attributes':['id',_0x65ff('0x11'),_0x65ff('0x15'),_0x65ff('0x1a'),_0x65ff('0x1b'),_0x65ff('0x1c'),_0x65ff('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]}]},'log':_0x65ff('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 439ade5..837ca06 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ad5=['../client','replace','trim','silly','intervalIftime\x20called\x20with','isArray','length','resolve','number','every','string','map','concat','Request','IntervalIftime','intervalIftime','dialer'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x9ad5,0x10f));var _0x59ad=function(_0x637e56,_0x1dda8f){_0x637e56=_0x637e56-0x0;var _0x1f50fd=_0x9ad5[_0x637e56];return _0x1f50fd;};var logger=require('../../../config/logger')(_0x59ad('0x0'));var client=require(_0x59ad('0x1'));function intervalIftime(_0x211b45,_0x31614b){const _0x2738d8=new Error()['stack'][_0x59ad('0x2')](/^Error/,'')[_0x59ad('0x3')]();logger[_0x59ad('0x4')](_0x59ad('0x5'),_0x211b45,_0x31614b,_0x2738d8);const _0x5a554a=Array[_0x59ad('0x6')](_0x211b45);if(!_0x211b45||_0x5a554a&&_0x211b45[_0x59ad('0x7')]===0x0){return Promise[_0x59ad('0x8')](![]);}else{var _0x2e1a26=[];var _0x2271d3=[];var _0x1b96f2=_0x5a554a?_0x211b45:[_0x211b45];var _0x26ab3a=_0x1b96f2['every'](function(_0x2dbd65){return typeof _0x2dbd65===_0x59ad('0x9');});var _0x10de36=_0x1b96f2[_0x59ad('0xa')](function(_0x2104ab){return typeof _0x2104ab===_0x59ad('0xb');});if(!_0x26ab3a&&!_0x10de36){_0x2e1a26=_0x1b96f2[_0x59ad('0xc')](function(_0x267d41){return _0x267d41['id'];});if(_0x2e1a26['length']===0x0){_0x2271d3=_0x1b96f2['map'](function(_0x47cf18){return _0x47cf18['interval'];});}}else{if(_0x26ab3a){_0x2e1a26=_0x2e1a26[_0x59ad('0xd')](_0x1b96f2);}if(_0x10de36){_0x2271d3=_0x2271d3['concat'](_0x1b96f2);}}return client[_0x59ad('0xe')]('IntervalIftime',{'intervalIds':_0x2e1a26,'intervals':_0x2271d3,'timezone':_0x31614b,'log':_0x59ad('0xf')});}}exports[_0x59ad('0x10')]=intervalIftime; \ No newline at end of file +var _0x8c19=['map','interval','concat','Request','IntervalIftime','dialer','stack','replace','intervalIftime\x20called\x20with','isArray','length','resolve','number','every','string'];(function(_0x1fb51b,_0x40539c){var _0x173ebb=function(_0x1024bc){while(--_0x1024bc){_0x1fb51b['push'](_0x1fb51b['shift']());}};_0x173ebb(++_0x40539c);}(_0x8c19,0x19a));var _0x98c1=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x8c19[_0x4243a3];return _0x1b2a33;};var logger=require('../../../config/logger')(_0x98c1('0x0'));var client=require('../client');function intervalIftime(_0xff00bc,_0x48628f){const _0xf29ee3=new Error()[_0x98c1('0x1')][_0x98c1('0x2')](/^Error/,'')['trim']();logger['silly'](_0x98c1('0x3'),_0xff00bc,_0x48628f,_0xf29ee3);const _0x47c1eb=Array[_0x98c1('0x4')](_0xff00bc);if(!_0xff00bc||_0x47c1eb&&_0xff00bc[_0x98c1('0x5')]===0x0){return Promise[_0x98c1('0x6')](![]);}else{var _0x4711ed=[];var _0x17cead=[];var _0x510221=_0x47c1eb?_0xff00bc:[_0xff00bc];var _0x5dbf42=_0x510221['every'](function(_0x42dd5b){return typeof _0x42dd5b===_0x98c1('0x7');});var _0x45a411=_0x510221[_0x98c1('0x8')](function(_0x430ca2){return typeof _0x430ca2===_0x98c1('0x9');});if(!_0x5dbf42&&!_0x45a411){_0x4711ed=_0x510221['map'](function(_0x476050){return _0x476050['id'];});if(_0x4711ed[_0x98c1('0x5')]===0x0){_0x17cead=_0x510221[_0x98c1('0xa')](function(_0xc5fef){return _0xc5fef[_0x98c1('0xb')];});}}else{if(_0x5dbf42){_0x4711ed=_0x4711ed[_0x98c1('0xc')](_0x510221);}if(_0x45a411){_0x17cead=_0x17cead[_0x98c1('0xc')](_0x510221);}}return client[_0x98c1('0xd')](_0x98c1('0xe'),{'intervalIds':_0x4711ed,'intervals':_0x17cead,'timezone':_0x48628f,'log':_0x98c1('0xe')});}}exports['intervalIftime']=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 6bd8671..136b698 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b60=['../client','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','Request','membername','starttime','diff','seconds','endtime','outbound','toNumber','lodash'];(function(_0x3fe1e3,_0x2d5875){var _0x4dd31a=function(_0x3ff20a){while(--_0x3ff20a){_0x3fe1e3['push'](_0x3fe1e3['shift']());}};_0x4dd31a(++_0x2d5875);}(_0x6b60,0x8b));var _0x06b6=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x6b60[_0xf51c06];return _0x1d5420;};'use strict';var moment=require('moment');var _=require(_0x06b6('0x0'));var util=require('util');var client=require(_0x06b6('0x1'));exports[_0x06b6('0x2')]=function(_0x2a0668){var _0x2612a9=_0x2a0668[_0x06b6('0x3')]||_0x2a0668['queuecallerexitAt'];return client['Request'](_0x06b6('0x4'),{'body':{'channel':_0x06b6('0x5'),'membername':_0x2a0668[_0x06b6('0x6')],'interface':_[_0x06b6('0x7')](_0x2a0668[_0x06b6('0x8')])?util[_0x06b6('0x9')](_0x06b6('0xa'),_0x2a0668[_0x06b6('0x6')]):_0x2a0668[_0x06b6('0x8')],'type':_0x06b6('0xb'),'enterAt':_0x2a0668[_0x06b6('0xc')],'exitAt':_0x2612a9,'duration':moment(_0x2612a9)['diff'](_0x2a0668['queuecallerleaveAt'],'seconds'),'data1':_0x06b6('0xd'),'data2':_0x2a0668[_0x06b6('0xe')],'data3':_0x2a0668[_0x06b6('0xf')],'data4':null,'data5':_0x2a0668[_0x06b6('0x10')],'role':_0x06b6('0x11'),'internal':_0x2a0668['accountcode']?_['toNumber'](_0x2a0668[_0x06b6('0x12')]):undefined,'uniqueid':_0x2a0668[_0x06b6('0x13')]},'log':_0x06b6('0x4')});};exports['voiceDialReport']=function(_0x45bece){return client[_0x06b6('0x14')]('CreateMemberReport',{'body':{'channel':_0x06b6('0x5'),'membername':_0x45bece[_0x06b6('0x15')],'interface':_0x45bece[_0x06b6('0x8')],'type':'TALKING','enterAt':_0x45bece[_0x06b6('0x16')],'exitAt':_0x45bece['endtime'],'duration':moment(_0x45bece['endtime'])[_0x06b6('0x17')](_0x45bece[_0x06b6('0x16')],_0x06b6('0x18'))>=0x0?moment(_0x45bece[_0x06b6('0x19')])[_0x06b6('0x17')](_0x45bece[_0x06b6('0x16')],_0x06b6('0x18')):null,'data1':_0x06b6('0x1a'),'data2':_0x45bece[_0x06b6('0x12')],'data3':_0x45bece['exten'],'data4':_0x45bece['dialstring']||null,'role':_0x06b6('0x11'),'internal':_0x45bece[_0x06b6('0x12')]?_[_0x06b6('0x1b')](_0x45bece[_0x06b6('0x12')]):undefined,'uniqueid':_0x45bece[_0x06b6('0x13')]},'log':_0x06b6('0x4')});}; \ No newline at end of file +var _0xe10c=['endtime','starttime','outbound','accountcode','dialstring','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s','interface','diff','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','toNumber','uniqueid','voiceDialReport','membername','TALKING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe10c,0x125));var _0xce10=function(_0x316e1c,_0x503be3){_0x316e1c=_0x316e1c-0x0;var _0x550226=_0xe10c[_0x316e1c];return _0x550226;};'use strict';var moment=require('moment');var _=require(_0xce10('0x0'));var util=require(_0xce10('0x1'));var client=require(_0xce10('0x2'));exports[_0xce10('0x3')]=function(_0x56da9b){var _0x2f5e55=_0x56da9b[_0xce10('0x4')]||_0x56da9b[_0xce10('0x5')];return client[_0xce10('0x6')](_0xce10('0x7'),{'body':{'channel':_0xce10('0x8'),'membername':_0x56da9b[_0xce10('0x9')],'interface':_[_0xce10('0xa')](_0x56da9b['interface'])?util[_0xce10('0xb')](_0xce10('0xc'),_0x56da9b[_0xce10('0x9')]):_0x56da9b[_0xce10('0xd')],'type':'TALKING','enterAt':_0x56da9b['queuecallerleaveAt'],'exitAt':_0x2f5e55,'duration':moment(_0x2f5e55)[_0xce10('0xe')](_0x56da9b[_0xce10('0xf')],_0xce10('0x10')),'data1':_0xce10('0x11'),'data2':_0x56da9b[_0xce10('0x12')],'data3':_0x56da9b[_0xce10('0x13')],'data4':null,'data5':_0x56da9b[_0xce10('0x14')],'role':_0xce10('0x15'),'internal':_0x56da9b['accountcode']?_[_0xce10('0x16')](_0x56da9b['accountcode']):undefined,'uniqueid':_0x56da9b[_0xce10('0x17')]},'log':_0xce10('0x7')});};exports[_0xce10('0x18')]=function(_0x4c3a35){return client[_0xce10('0x6')](_0xce10('0x7'),{'body':{'channel':_0xce10('0x8'),'membername':_0x4c3a35[_0xce10('0x19')],'interface':_0x4c3a35[_0xce10('0xd')],'type':_0xce10('0x1a'),'enterAt':_0x4c3a35['starttime'],'exitAt':_0x4c3a35['endtime'],'duration':moment(_0x4c3a35[_0xce10('0x1b')])[_0xce10('0xe')](_0x4c3a35[_0xce10('0x1c')],_0xce10('0x10'))>=0x0?moment(_0x4c3a35['endtime'])[_0xce10('0xe')](_0x4c3a35[_0xce10('0x1c')],_0xce10('0x10')):null,'data1':_0xce10('0x1d'),'data2':_0x4c3a35[_0xce10('0x1e')],'data3':_0x4c3a35[_0xce10('0x13')],'data4':_0x4c3a35[_0xce10('0x1f')]||null,'role':_0xce10('0x15'),'internal':_0x4c3a35[_0xce10('0x1e')]?_[_0xce10('0x16')](_0x4c3a35[_0xce10('0x1e')]):undefined,'uniqueid':_0x4c3a35[_0xce10('0x17')]},'log':_0xce10('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index e7ca8dc..8125b98 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 _0x0102=['ShowSetting','stopRecordingOnTransfer','getSettings','Request'];(function(_0x354674,_0x3ad051){var _0x34005c=function(_0x32563e){while(--_0x32563e){_0x354674['push'](_0x354674['shift']());}};_0x34005c(++_0x3ad051);}(_0x0102,0x186));var _0x2010=function(_0x591998,_0x1117e2){_0x591998=_0x591998-0x0;var _0x2d0f29=_0x0102[_0x591998];return _0x2d0f29;};'use strict';var client=require('../client');exports[_0x2010('0x0')]=function(){return client[_0x2010('0x1')](_0x2010('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2010('0x3'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x4f31=['getSettings','ShowSetting','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x2d224e,_0x486251){var _0xf2d7fb=function(_0x326c7b){while(--_0x326c7b){_0x2d224e['push'](_0x2d224e['shift']());}};_0xf2d7fb(++_0x486251);}(_0x4f31,0x13f));var _0x14f3=function(_0x40f33e,_0x3c0d29){_0x40f33e=_0x40f33e-0x0;var _0x289697=_0x4f31[_0x40f33e];return _0x289697;};'use strict';var client=require(_0x14f3('0x0'));exports[_0x14f3('0x1')]=function(){return client['Request'](_0x14f3('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x14f3('0x3')]},'log':_0x14f3('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 88317ca..79490f6 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 _0x7ff7=['Request','html','GetTemplate','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7ff7,0xef));var _0x77ff=function(_0x2560eb,_0x56e299){_0x2560eb=_0x2560eb-0x0;var _0x380988=_0x7ff7[_0x2560eb];return _0x380988;};'use strict';var client=require(_0x77ff('0x0'));exports['getTemplates']=function(_0x433110){return function(_0x2a9fbc){return client[_0x77ff('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x77ff('0x2')]},'log':_0x77ff('0x3')});};}; \ No newline at end of file +var _0xaaf7=['html','../client','getTemplates','Request','GetTemplate'];(function(_0x3a06be,_0x560158){var _0x5609aa=function(_0x23c8eb){while(--_0x23c8eb){_0x3a06be['push'](_0x3a06be['shift']());}};_0x5609aa(++_0x560158);}(_0xaaf7,0x79));var _0x7aaf=function(_0x4d0899,_0x23afea){_0x4d0899=_0x4d0899-0x0;var _0x360aab=_0xaaf7[_0x4d0899];return _0x360aab;};'use strict';var client=require(_0x7aaf('0x0'));exports[_0x7aaf('0x1')]=function(_0x2250b7){return function(_0x304173){return client[_0x7aaf('0x2')](_0x7aaf('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x7aaf('0x4')]},'log':_0x7aaf('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 49b0698..ad3436d 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 _0x0587=['AnyConditions','field','Action','data1','data5','data6','data7','GetTrigger','../client','getTriggers','Request','operator','value','Condition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0587,0x86));var _0x7058=function(_0x56fcf6,_0x401b3c){_0x56fcf6=_0x56fcf6-0x0;var _0x2078a7=_0x0587[_0x56fcf6];return _0x2078a7;};'use strict';var client=require(_0x7058('0x0'));exports[_0x7058('0x1')]=function(_0x374d25){return function(_0x515315){return client[_0x7058('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id','field',_0x7058('0x3'),_0x7058('0x4')]},{'model':_0x7058('0x5'),'as':_0x7058('0x6'),'attributes':['id',_0x7058('0x7'),_0x7058('0x3'),'value']},{'model':_0x7058('0x8'),'as':'Actions','attributes':['id','action',_0x7058('0x9'),'data2','data3','data4',_0x7058('0xa'),_0x7058('0xb'),_0x7058('0xc')]}]},'log':_0x7058('0xd')});};}; \ No newline at end of file +var _0x92dc=['name','Condition','AllConditions','operator','value','AnyConditions','field','Action','data2','data3','data4','data5','data6','data7','getTriggers','GetTrigger'];(function(_0x53ad92,_0x8f58e1){var _0x1f45b8=function(_0x217781){while(--_0x217781){_0x53ad92['push'](_0x53ad92['shift']());}};_0x1f45b8(++_0x8f58e1);}(_0x92dc,0x10e));var _0xc92d=function(_0x2300fa,_0x41c382){_0x2300fa=_0x2300fa-0x0;var _0x11fef0=_0x92dc[_0x2300fa];return _0x11fef0;};'use strict';var client=require('../client');exports[_0xc92d('0x0')]=function(_0x4d72c5){return function(_0x234142){return client['Request'](_0xc92d('0x1'),{'options':{'raw':![],'attributes':['id',_0xc92d('0x2'),'channel','status'],'include':[{'model':_0xc92d('0x3'),'as':_0xc92d('0x4'),'attributes':['id','field',_0xc92d('0x5'),_0xc92d('0x6')]},{'model':'Condition','as':_0xc92d('0x7'),'attributes':['id',_0xc92d('0x8'),_0xc92d('0x5'),_0xc92d('0x6')]},{'model':_0xc92d('0x9'),'as':'Actions','attributes':['id','action','data1',_0xc92d('0xa'),_0xc92d('0xb'),_0xc92d('0xc'),_0xc92d('0xd'),_0xc92d('0xe'),_0xc92d('0xf')]}]},'log':_0xc92d('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 95a1f8b..333cd25 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 _0x3248=['getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x312f0b,_0x5ac7ea){var _0x264ba7=function(_0x96fb9a){while(--_0x96fb9a){_0x312f0b['push'](_0x312f0b['shift']());}};_0x264ba7(++_0x5ac7ea);}(_0x3248,0x1bc));var _0x8324=function(_0x44ae00,_0x28de9f){_0x44ae00=_0x44ae00-0x0;var _0x4cb201=_0x3248[_0x44ae00];return _0x4cb201;};'use strict';var client=require('../client');exports[_0x8324('0x0')]=function(_0x5b736a){return function(_0x5f314a){return client[_0x8324('0x1')](_0x8324('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8324('0x3'),_0x8324('0x4'),_0x8324('0x5')]},'log':_0x8324('0x2')});};}; \ No newline at end of file +var _0x9275=['GetTrunk','name','registry','defaultuser','getTrunks'];(function(_0x13432c,_0x421fbf){var _0x38037e=function(_0x1b9ef7){while(--_0x1b9ef7){_0x13432c['push'](_0x13432c['shift']());}};_0x38037e(++_0x421fbf);}(_0x9275,0x130));var _0x5927=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0x9275[_0x3b632f];return _0x10e788;};'use strict';var client=require('../client');exports[_0x5927('0x0')]=function(_0xcde304){return function(_0x16b603){return client['Request'](_0x5927('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5927('0x2'),_0x5927('0x3'),_0x5927('0x4')]},'log':_0x5927('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 220ec53..7c06e02 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 643d487..c3530ea 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 _0xb4b1=['Request','CreateVoiceAgentReport','update','../client'];(function(_0x56f7e2,_0x145392){var _0x36240b=function(_0x216ff7){while(--_0x216ff7){_0x56f7e2['push'](_0x56f7e2['shift']());}};_0x36240b(++_0x145392);}(_0xb4b1,0x10b));var _0x1b4b=function(_0x8a528a,_0x118b97){_0x8a528a=_0x8a528a-0x0;var _0x77a38c=_0xb4b1[_0x8a528a];return _0x77a38c;};'use strict';var client=require(_0x1b4b('0x0'));exports['create']=function(_0x1d7b8c){return client[_0x1b4b('0x1')](_0x1b4b('0x2'),{'body':_0x1d7b8c,'log':'CreateVoiceAgentReport'});};exports[_0x1b4b('0x3')]=function(_0x293a63,_0x527d68,_0x2c4228){return client['Request']('UpdateVoiceAgentReport',{'body':_0x293a63,'options':{'where':{'uniqueid':_0x527d68,'interface':_0x2c4228,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x00cb=['UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport','update'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x00cb,0xba));var _0xb00c=function(_0x2cb7ad,_0xcc7928){_0x2cb7ad=_0x2cb7ad-0x0;var _0x49054b=_0x00cb[_0x2cb7ad];return _0x49054b;};'use strict';var client=require(_0xb00c('0x0'));exports['create']=function(_0x210287){return client[_0xb00c('0x1')](_0xb00c('0x2'),{'body':_0x210287,'log':_0xb00c('0x2')});};exports[_0xb00c('0x3')]=function(_0x5075b8,_0x24ca6d,_0x53d657){return client['Request'](_0xb00c('0x4'),{'body':_0x5075b8,'options':{'where':{'uniqueid':_0x24ca6d,'interface':_0x53d657,'agentcomplete':!![]}},'log':_0xb00c('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b369d0f..3ace7e2 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 _0x694b=['type','disposition','duration','billableseconds','GetVoiceCallReports','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','format','endOf'];(function(_0xbc1a4b,_0x4dfbe4){var _0x108b87=function(_0x409062){while(--_0x409062){_0xbc1a4b['push'](_0xbc1a4b['shift']());}};_0x108b87(++_0x4dfbe4);}(_0x694b,0x1b5));var _0xb694=function(_0x525b3e,_0x1409e2){_0x525b3e=_0x525b3e-0x0;var _0x232f5d=_0x694b[_0x525b3e];return _0x232f5d;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require('../client');exports[_0xb694('0x0')]=function(_0x227e95){return client[_0xb694('0x1')](_0xb694('0x2'),{'body':_[_0xb694('0x3')](_0x227e95,{'source':_0x227e95[_0xb694('0x4')],'destinationcontext':_0x227e95['context'],'callerid':_0x227e95[_0xb694('0x5')],'amaflags':_0xb694('0x6')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0xb694('0x1')](_0xb694('0x7'),{'options':{'where':{'type':[_0xb694('0x8')],'createdAt':{'$between':[moment()[_0xb694('0x9')](_0xb694('0xa'))[_0xb694('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb694('0xc')](_0xb694('0xa'))[_0xb694('0xb')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xb694('0xd'),_0xb694('0xe'),_0xb694('0xf'),_0xb694('0x10')]},'log':_0xb694('0x11')});};}; \ No newline at end of file +var _0xf49d=['Request','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','duration','billableseconds','GetVoiceCallReports','util','lodash','../client'];(function(_0x3094ad,_0x5a68e1){var _0x5146bd=function(_0x570a87){while(--_0x570a87){_0x3094ad['push'](_0x3094ad['shift']());}};_0x5146bd(++_0x5a68e1);}(_0xf49d,0x12d));var _0xdf49=function(_0x4c7879,_0x5b0eb5){_0x4c7879=_0x4c7879-0x0;var _0x370b13=_0xf49d[_0x4c7879];return _0x370b13;};'use strict';var moment=require('moment');var util=require(_0xdf49('0x0'));var _=require(_0xdf49('0x1'));var client=require(_0xdf49('0x2'));exports['create']=function(_0x1760eb){return client[_0xdf49('0x3')]('CreateVoiceCallReport',{'body':_[_0xdf49('0x4')](_0x1760eb,{'source':_0x1760eb[_0xdf49('0x5')],'destinationcontext':_0x1760eb['context'],'callerid':_0x1760eb[_0xdf49('0x6')],'amaflags':_0xdf49('0x7')}),'log':'CreateVoiceCallReport'});};exports[_0xdf49('0x8')]=function(){return function(){return client[_0xdf49('0x3')](_0xdf49('0x9'),{'options':{'where':{'type':[_0xdf49('0xa')],'createdAt':{'$between':[moment()[_0xdf49('0xb')](_0xdf49('0xc'))[_0xdf49('0xd')](_0xdf49('0xe')),moment()[_0xdf49('0xf')](_0xdf49('0xc'))['format'](_0xdf49('0xe'))]}},'attributes':['type','disposition',_0xdf49('0x10'),_0xdf49('0x11')]},'log':_0xdf49('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8548971..089c5aa 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 _0x7b38=['../client','CreateVoiceDialReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b38,0x1b2));var _0x87b3=function(_0x424405,_0x58a9cc){_0x424405=_0x424405-0x0;var _0x38aa6b=_0x7b38[_0x424405];return _0x38aa6b;};'use strict';var client=require(_0x87b3('0x0'));exports['create']=function(_0x3b60df){return client['Request'](_0x87b3('0x1'),{'body':_0x3b60df,'log':_0x87b3('0x1')});}; \ No newline at end of file +var _0x5186=['../client','Request','CreateVoiceDialReport'];(function(_0x46a270,_0x4d4372){var _0x531151=function(_0x23710){while(--_0x23710){_0x46a270['push'](_0x46a270['shift']());}};_0x531151(++_0x4d4372);}(_0x5186,0x156));var _0x6518=function(_0x3fd7a8,_0xb4c6d8){_0x3fd7a8=_0x3fd7a8-0x0;var _0x18c5ee=_0x5186[_0x3fd7a8];return _0x18c5ee;};'use strict';var client=require(_0x6518('0x0'));exports['create']=function(_0x3f0f5b){return client[_0x6518('0x1')](_0x6518('0x2'),{'body':_0x3f0f5b,'log':_0x6518('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e825b75..6009df0 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 _0x0102=['GetVoiceExtension','exten','getVoiceExtensions','Request'];(function(_0x2a1429,_0x95a426){var _0x1d65a3=function(_0x14a4dc){while(--_0x14a4dc){_0x2a1429['push'](_0x2a1429['shift']());}};_0x1d65a3(++_0x95a426);}(_0x0102,0x186));var _0x2010=function(_0x5a6559,_0x1418c8){_0x5a6559=_0x5a6559-0x0;var _0x426ea9=_0x0102[_0x5a6559];return _0x426ea9;};'use strict';var client=require('../client');exports[_0x2010('0x0')]=function(){return function(){return client[_0x2010('0x1')](_0x2010('0x2'),{'options':{'raw':!![],'attributes':['id',_0x2010('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xaa1b=['getVoiceExtensions','Request','exten','../client'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xbaa1('0x0'));exports[_0xbaa1('0x1')]=function(){return function(){return client[_0xbaa1('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xbaa1('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xbaa1('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 38a4d8e..bf32b2a 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 _0x2b44=['dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','Pause','TrunkBackup','callerid','active','Interval','Intervals','interval','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type'];(function(_0xe38e52,_0x1ab075){var _0x1b69b1=function(_0x50bb59){while(--_0x50bb59){_0xe38e52['push'](_0xe38e52['shift']());}};_0x1b69b1(++_0x1ab075);}(_0x2b44,0x1d7));var _0x42b4=function(_0xc044e1,_0x143beb){_0xc044e1=_0xc044e1-0x0;var _0x2608c1=_0x2b44[_0xc044e1];return _0x2608c1;};'use strict';var client=require(_0x42b4('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x42b4('0x1')](_0x42b4('0x2'),{'options':{'raw':![],'attributes':['id',_0x42b4('0x3'),_0x42b4('0x4'),_0x42b4('0x5'),_0x42b4('0x6'),_0x42b4('0x7'),_0x42b4('0x8'),_0x42b4('0x9'),_0x42b4('0xa'),'dialLimitChannel',_0x42b4('0xb'),_0x42b4('0xc'),_0x42b4('0xd'),_0x42b4('0xe'),_0x42b4('0xf'),_0x42b4('0x10'),_0x42b4('0x11'),_0x42b4('0x12'),'dialQueueOptions','dialQueueTimeout',_0x42b4('0x13'),_0x42b4('0x14'),_0x42b4('0x15'),'dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x42b4('0x16'),_0x42b4('0x17'),_0x42b4('0x18'),_0x42b4('0x19'),'dialPrefix',_0x42b4('0x1a'),'dialAMDActive','dialAMDInitialSilence',_0x42b4('0x1b'),_0x42b4('0x1c'),_0x42b4('0x1d'),'dialAMDMinWordLength',_0x42b4('0x1e'),_0x42b4('0x1f'),_0x42b4('0x20'),_0x42b4('0x21'),_0x42b4('0x22'),_0x42b4('0x23'),'dialRecallInQueue',_0x42b4('0x24'),'dialAgiAfterHangupAgent',_0x42b4('0x25'),_0x42b4('0x26'),_0x42b4('0x7'),'strategy',_0x42b4('0x27'),_0x42b4('0x28'),_0x42b4('0x29'),'dialNoSuchNumberRetryFrequency',_0x42b4('0x2a'),_0x42b4('0x2b'),_0x42b4('0x2c'),_0x42b4('0x2d'),'dialMachineMaxRetry',_0x42b4('0x2e'),_0x42b4('0x2f'),'dialAgentRejectRetryFrequency',_0x42b4('0x30'),_0x42b4('0x31'),_0x42b4('0x32'),'dialPreviewAutoRecallMe',_0x42b4('0x33')],'include':[{'model':_0x42b4('0x34'),'as':_0x42b4('0x34'),'attributes':['id','name','callerid','active']},{'model':_0x42b4('0x35'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x42b4('0x34'),'as':_0x42b4('0x36'),'attributes':['id',_0x42b4('0x3'),_0x42b4('0x37'),_0x42b4('0x38')]},{'model':_0x42b4('0x39'),'as':_0x42b4('0x39'),'attributes':['id',_0x42b4('0x3')],'include':[{'model':'Interval','as':_0x42b4('0x3a'),'attributes':['id',_0x42b4('0x3'),_0x42b4('0x3b')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x76ec=['dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe'];(function(_0x1fa638,_0x5012bc){var _0x3eccce=function(_0x553fb7){while(--_0x553fb7){_0x1fa638['push'](_0x1fa638['shift']());}};_0x3eccce(++_0x5012bc);}(_0x76ec,0x11b));var _0xc76e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x76ec[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xc76e('0x0'));exports[_0xc76e('0x1')]=function(){return function(){return client[_0xc76e('0x2')](_0xc76e('0x3'),{'options':{'raw':![],'attributes':['id',_0xc76e('0x4'),'acw',_0xc76e('0x5'),'autopause',_0xc76e('0x6'),_0xc76e('0x7'),_0xc76e('0x8'),'dialMethod',_0xc76e('0x9'),'dialLimitQueue',_0xc76e('0xa'),_0xc76e('0xb'),_0xc76e('0xc'),_0xc76e('0xd'),'dialOriginateCallerIdName',_0xc76e('0xe'),'dialOriginateTimeout','dialQueueOptions',_0xc76e('0xf'),_0xc76e('0x10'),_0xc76e('0x11'),_0xc76e('0x12'),_0xc76e('0x13'),_0xc76e('0x14'),_0xc76e('0x15'),'dialNoAnswerRetryFrequency',_0xc76e('0x16'),_0xc76e('0x17'),_0xc76e('0x18'),'dialPrefix','dialCheckDuplicateType',_0xc76e('0x19'),_0xc76e('0x1a'),'dialAMDGreeting',_0xc76e('0x1b'),_0xc76e('0x1c'),_0xc76e('0x1d'),_0xc76e('0x1e'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xc76e('0x1f'),_0xc76e('0x20'),_0xc76e('0x21'),_0xc76e('0x22'),_0xc76e('0x23'),_0xc76e('0x24'),'dialAgiAfterHangupClient',_0xc76e('0x25'),_0xc76e('0x6'),'strategy',_0xc76e('0x26'),'dialCutDigit',_0xc76e('0x27'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xc76e('0x28'),'dialAbandonedMaxRetry',_0xc76e('0x29'),'dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0xc76e('0x2a'),_0xc76e('0x2b'),_0xc76e('0x2c'),_0xc76e('0x2d'),_0xc76e('0x2e'),_0xc76e('0x2f')],'include':[{'model':_0xc76e('0x30'),'as':_0xc76e('0x30'),'attributes':['id',_0xc76e('0x4'),_0xc76e('0x31'),_0xc76e('0x32')]},{'model':_0xc76e('0x33'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xc76e('0x30'),'as':_0xc76e('0x34'),'attributes':['id',_0xc76e('0x4'),_0xc76e('0x31'),_0xc76e('0x32')]},{'model':_0xc76e('0x35'),'as':'Interval','attributes':['id',_0xc76e('0x4')],'include':[{'model':_0xc76e('0x35'),'as':_0xc76e('0x36'),'attributes':['id','name','interval']}]}]},'log':_0xc76e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1a29ef4..22aee29 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(_0x203563,_0x1d2959){var _0x3a2dbd=function(_0x510a05){while(--_0x510a05){_0x203563['push'](_0x203563['shift']());}};_0x3a2dbd(++_0x1d2959);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x1f6e01,_0x3e70){var _0x4fe892=function(_0x52f080){while(--_0x52f080){_0x1f6e01['push'](_0x1f6e01['shift']());}};_0x4fe892(++_0x3e70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 b23e987..516b308 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 _0x37ec=['Request','GetVoiceQueueRtPauses'];(function(_0x3fb1e9,_0x20991a){var _0x46ed92=function(_0x1f23c2){while(--_0x1f23c2){_0x3fb1e9['push'](_0x3fb1e9['shift']());}};_0x46ed92(++_0x20991a);}(_0x37ec,0xa8));var _0xc37e=function(_0x69a7aa,_0x37e649){_0x69a7aa=_0x69a7aa-0x0;var _0x3b8402=_0x37ec[_0x69a7aa];return _0x3b8402;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x4e3b4e){return function(){return client[_0xc37e('0x0')](_0xc37e('0x1'),{'options':{'where':{'VoiceQueueId':_0x4e3b4e,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x02f1=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x5da14f,_0x40486a){var _0x1676dc=function(_0x3ec3e8){while(--_0x3ec3e8){_0x5da14f['push'](_0x5da14f['shift']());}};_0x1676dc(++_0x40486a);}(_0x02f1,0x101));var _0x102f=function(_0x52423d,_0xaf3f44){_0x52423d=_0x52423d-0x0;var _0x5c6df9=_0x02f1[_0x52423d];return _0x5c6df9;};'use strict';var client=require('../client');exports[_0x102f('0x0')]=function(_0x4fe480){return function(){return client[_0x102f('0x1')](_0x102f('0x2'),{'options':{'where':{'VoiceQueueId':_0x4fe480,'paused':!![]},'raw':!![]},'log':_0x102f('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index ff8a7e9..6934ac9 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x47af82,_0x132cc0){var _0xcfae00=function(_0x456ae9){while(--_0x456ae9){_0x47af82['push'](_0x47af82['shift']());}};_0xcfae00(++_0x132cc0);}(_0x7a54,0x106));var _0x47a5=function(_0x34b72c,_0x51989c){_0x34b72c=_0x34b72c-0x0;var _0x183f51=_0x7a54[_0x34b72c];return _0x183f51;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x45e5a2,_0x16e9f1){var _0x1beb67=function(_0x2a559f){while(--_0x2a559f){_0x45e5a2['push'](_0x45e5a2['shift']());}};_0x1beb67(++_0x16e9f1);}(_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 diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index c37cdf6..53d723e 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 _0x2966=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x5f551a,_0x2eae71){var _0x4a5978=function(_0x3d2702){while(--_0x3d2702){_0x5f551a['push'](_0x5f551a['shift']());}};_0x4a5978(++_0x2eae71);}(_0x2966,0x1c7));var _0x6296=function(_0x3a9e83,_0x3e40bb){_0x3a9e83=_0x3a9e83-0x0;var _0x1038cd=_0x2966[_0x3a9e83];return _0x1038cd;};'use strict';var client=require(_0x6296('0x0'));exports[_0x6296('0x1')]={};exports[_0x6296('0x2')]=function(_0x1620e7){return client[_0x6296('0x3')](_0x6296('0x4'),{'body':{'result':_0x1620e7[_0x6296('0x5')],'transfererchannel':_0x1620e7[_0x6296('0x6')],'transferercalleridnum':_0x1620e7['transferercalleridnum'],'transferercalleridname':_0x1620e7[_0x6296('0x7')],'transfererconnectedlinenum':_0x1620e7[_0x6296('0x8')],'transfererconnectedlinename':_0x1620e7['transfererconnectedlinename'],'transfereraccountcode':_0x1620e7[_0x6296('0x9')],'transferercontext':_0x1620e7[_0x6296('0xa')],'transfererexten':_0x1620e7[_0x6296('0xb')],'transfererlinkedid':_0x1620e7[_0x6296('0xc')],'transfereechannel':_0x1620e7[_0x6296('0xd')],'transfereecalleridnum':_0x1620e7[_0x6296('0xe')],'transfereecalleridname':_0x1620e7['transfereecalleridname'],'transfereeconnectedlinenum':_0x1620e7[_0x6296('0xf')],'transfereeconnectedlinename':_0x1620e7[_0x6296('0x10')],'transfereeaccountcode':_0x1620e7[_0x6296('0x11')],'transfereecontext':_0x1620e7['transfereecontext'],'transfereeexten':_0x1620e7[_0x6296('0x12')],'transfereelinkedid':_0x1620e7[_0x6296('0x13')],'isexternal':_0x1620e7[_0x6296('0x14')],'context':_0x1620e7['context'],'extension':_0x1620e7[_0x6296('0x15')],'type':_0x6296('0x16')},'log':_0x6296('0x4')});};exports[_0x6296('0x17')]=function(_0x245dbe){return client[_0x6296('0x3')](_0x6296('0x4'),{'body':{'result':_0x245dbe['result'],'transfererchannel':_0x245dbe[_0x6296('0x18')],'transferercalleridnum':_0x245dbe[_0x6296('0x19')],'transferercalleridname':_0x245dbe[_0x6296('0x1a')],'transfererconnectedlinenum':_0x245dbe[_0x6296('0x1b')],'transfererconnectedlinename':_0x245dbe[_0x6296('0x1c')],'transfereraccountcode':_0x245dbe[_0x6296('0x1d')],'transferercontext':_0x245dbe[_0x6296('0x1e')],'transfererexten':_0x245dbe[_0x6296('0x1f')],'transfererlinkedid':_0x245dbe[_0x6296('0x20')],'transfereechannel':_0x245dbe[_0x6296('0x21')],'transfereecalleridnum':_0x245dbe[_0x6296('0x22')],'transfereecalleridname':_0x245dbe[_0x6296('0x23')],'transfereeconnectedlinenum':_0x245dbe[_0x6296('0x24')],'transfereeconnectedlinename':_0x245dbe[_0x6296('0x25')],'transfereeaccountcode':_0x245dbe[_0x6296('0x26')],'transfereecontext':_0x245dbe[_0x6296('0x27')],'transfereeexten':_0x245dbe['transfertargetexten'],'transfereelinkedid':_0x245dbe[_0x6296('0x28')],'isexternal':_0x245dbe['isexternal'],'context':_0x245dbe[_0x6296('0x29')],'extension':_0x245dbe[_0x6296('0x2a')],'type':_0x6296('0x2b')},'log':_0x6296('0x4')});}; \ No newline at end of file +var _0x6c6c=['result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransfererexten','../client','CreateVoiceTransferReport'];(function(_0x103afc,_0x40e109){var _0x2c580a=function(_0x17bf86){while(--_0x17bf86){_0x103afc['push'](_0x103afc['shift']());}};_0x2c580a(++_0x40e109);}(_0x6c6c,0x154));var _0xc6c6=function(_0x148910,_0xfc1467){_0x148910=_0x148910-0x0;var _0x44a023=_0x6c6c[_0x148910];return _0x44a023;};'use strict';var client=require(_0xc6c6('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x286d3d){return client['Request'](_0xc6c6('0x1'),{'body':{'result':_0x286d3d[_0xc6c6('0x2')],'transfererchannel':_0x286d3d['transfererchannel'],'transferercalleridnum':_0x286d3d[_0xc6c6('0x3')],'transferercalleridname':_0x286d3d[_0xc6c6('0x4')],'transfererconnectedlinenum':_0x286d3d[_0xc6c6('0x5')],'transfererconnectedlinename':_0x286d3d[_0xc6c6('0x6')],'transfereraccountcode':_0x286d3d['transfereraccountcode'],'transferercontext':_0x286d3d[_0xc6c6('0x7')],'transfererexten':_0x286d3d[_0xc6c6('0x8')],'transfererlinkedid':_0x286d3d[_0xc6c6('0x9')],'transfereechannel':_0x286d3d['transfereechannel'],'transfereecalleridnum':_0x286d3d[_0xc6c6('0xa')],'transfereecalleridname':_0x286d3d[_0xc6c6('0xb')],'transfereeconnectedlinenum':_0x286d3d[_0xc6c6('0xc')],'transfereeconnectedlinename':_0x286d3d[_0xc6c6('0xd')],'transfereeaccountcode':_0x286d3d[_0xc6c6('0xe')],'transfereecontext':_0x286d3d[_0xc6c6('0xf')],'transfereeexten':_0x286d3d[_0xc6c6('0x10')],'transfereelinkedid':_0x286d3d[_0xc6c6('0x11')],'isexternal':_0x286d3d['isexternal'],'context':_0x286d3d[_0xc6c6('0x12')],'extension':_0x286d3d[_0xc6c6('0x13')],'type':_0xc6c6('0x14')},'log':_0xc6c6('0x1')});};exports['attendedTransfer']=function(_0x167720){return client['Request'](_0xc6c6('0x1'),{'body':{'result':_0x167720[_0xc6c6('0x2')],'transfererchannel':_0x167720[_0xc6c6('0x15')],'transferercalleridnum':_0x167720['origtransferercalleridnum'],'transferercalleridname':_0x167720[_0xc6c6('0x16')],'transfererconnectedlinenum':_0x167720['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x167720[_0xc6c6('0x17')],'transfereraccountcode':_0x167720[_0xc6c6('0x18')],'transferercontext':_0x167720[_0xc6c6('0x19')],'transfererexten':_0x167720['secondtransfererexten'],'transfererlinkedid':_0x167720[_0xc6c6('0x1a')],'transfereechannel':_0x167720[_0xc6c6('0x1b')],'transfereecalleridnum':_0x167720[_0xc6c6('0x1c')],'transfereecalleridname':_0x167720[_0xc6c6('0x1d')],'transfereeconnectedlinenum':_0x167720[_0xc6c6('0x1e')],'transfereeconnectedlinename':_0x167720[_0xc6c6('0x1f')],'transfereeaccountcode':_0x167720[_0xc6c6('0x20')],'transfereecontext':_0x167720[_0xc6c6('0x21')],'transfereeexten':_0x167720[_0xc6c6('0x22')],'transfereelinkedid':_0x167720[_0xc6c6('0x23')],'isexternal':_0x167720[_0xc6c6('0x24')],'context':_0x167720['origtransferercontext'],'extension':_0x167720[_0xc6c6('0x25')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 360151c..120ad70 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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x2ed962,_0xc5c5b1){var _0x3a7e5a=function(_0x51c1ee){while(--_0x51c1ee){_0x2ed962['push'](_0x2ed962['shift']());}};_0x3a7e5a(++_0xc5c5b1);}(_0xb10b,0x12a));var _0xbb10=function(_0x43f5c7,_0x118763){_0x43f5c7=_0x43f5c7-0x0;var _0x46be5f=_0xb10b[_0x43f5c7];return _0x46be5f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x9f4fba,_0x43464a){var _0x337afb=function(_0x1aafc8){while(--_0x1aafc8){_0x9f4fba['push'](_0x9f4fba['shift']());}};_0x337afb(++_0x43464a);}(_0x7a54,0x106));var _0x47a5=function(_0xe139f4,_0x5f5216){_0xe139f4=_0xe139f4-0x0;var _0x2d2490=_0x7a54[_0xe139f4];return _0x2d2490;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index cd0d3d7..f0ae048 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 _0x9ef9=['$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','phone','mobile','fax','ListId','createdAt','scheduledAt','union','resolve','then','getContacts','isEmpty','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','user:%s','name','trigger:%s','action','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','data1','data2','isNil','data5','data3','split'];(function(_0x52653a,_0x1b1f3e){var _0x16f5c6=function(_0x5c3f01){while(--_0x5c3f01){_0x52653a['push'](_0x52653a['shift']());}};_0x16f5c6(++_0x1b1f3e);}(_0x9ef9,0x190));var _0x99ef=function(_0x39e23f,_0x27fd31){_0x39e23f=_0x39e23f-0x0;var _0x3f6388=_0x9ef9[_0x39e23f];return _0x3f6388;};'use strict';var _=require(_0x99ef('0x0'));var BPromise=require(_0x99ef('0x1'));var Redis=require(_0x99ef('0x2'));var util=require('util');var config=require(_0x99ef('0x3'));var logger=require(_0x99ef('0x4'))(_0x99ef('0x5'));var cmContactRpc=require(_0x99ef('0x6'));config[_0x99ef('0x7')]=_[_0x99ef('0x8')](config[_0x99ef('0x7')],{'host':_0x99ef('0x9'),'port':0x18eb});var io=require(_0x99ef('0xa'))(new Redis(config['redis']));function emit(_0x749d43,_0x3a13eb,_0x20f3f9,_0x50f6c3,_0x4dc4b5){logger[_0x99ef('0xb')](_0x99ef('0xc'),_0x749d43,_0x3a13eb['id'],_0x20f3f9,_0x50f6c3,JSON['stringify'](_0x4dc4b5));io['to'](_0x20f3f9)[_0x99ef('0xd')](_0x50f6c3,_0x4dc4b5);}exports['exec']=function(_0xae9ed1,_0xcf0fa5,_0x1113c0,_0xb6fd3d){var _0x2e4022,_0xfd1ee9;var _0x8276f6={};var _0x383116;var _0x17ca41=Number(_0x1113c0[_0x99ef('0xe')]);var _0x242e1f=_0x1113c0['data2']?Boolean(Number(_0x1113c0[_0x99ef('0xf')])):![];var _0x57569a;var _0x3cd419=![];if(!_[_0x99ef('0x10')](_0x1113c0['data5'])){if(_0x1113c0[_0x99ef('0x11')]=='1')_0x3cd419=!![];}if(!_0x3cd419){if(_0xb6fd3d['xmd-contactid']){_0x8276f6['id']=_0xb6fd3d['xmd-contactid'];}}if(!_0x8276f6['id']){_0x8276f6['ListId']=_0x17ca41;_0x57569a=_0x1113c0[_0x99ef('0x12')]&&_0x1113c0[_0x99ef('0x12')]!=='0'?_0x1113c0[_0x99ef('0x12')][_0x99ef('0x13')](','):['phone'];_0x8276f6[_0x99ef('0x14')]=_[_0x99ef('0x15')](_0x57569a,function(_0x390bf1){var _0x3f76e2={};_0x3f76e2[_0x390bf1]=_0xb6fd3d[_0x99ef('0x16')]?_0xb6fd3d['destcalleridnum']:_0xb6fd3d[_0x99ef('0x17')];return _0x3f76e2;});_0x383116=_0xb6fd3d[_0x99ef('0x16')]?_0xb6fd3d[_0x99ef('0x18')]:_0xb6fd3d[_0x99ef('0x17')];}var _0x462463=['id',_0x99ef('0x19'),_0x99ef('0x1a'),_0x99ef('0x1b'),_0x99ef('0x1c'),_0x99ef('0x1d'),_0x99ef('0x1e'),_0x99ef('0x1f'),_0x99ef('0x20'),'updatedAt'];var _0x3138f3=_[_0x99ef('0x21')](_0x462463,_0x57569a);BPromise[_0x99ef('0x22')]()[_0x99ef('0x23')](cmContactRpc[_0x99ef('0x24')]({'attributes':_0x3138f3,'where':_0x8276f6,'phone':_0x383116}))['then'](function(_0x5a2941){_0xfd1ee9=_0x5a2941;if(!_[_0x99ef('0x25')](_0xfd1ee9)){if(_0xfd1ee9[_0x99ef('0x26')]===0x1){_0x2e4022=_0xfd1ee9[0x0];logger['info'](_0x99ef('0x27'),_0xb6fd3d[_0x99ef('0x28')],_0xcf0fa5['id'],_0x2e4022['id']);}else{logger[_0x99ef('0xb')](_0x99ef('0x29'),_0xb6fd3d[_0x99ef('0x28')],_0xcf0fa5['id'],_[_0x99ef('0x15')](_0xfd1ee9,'id')[_0x99ef('0x2a')](','));}return;}else{logger[_0x99ef('0xb')](_0x99ef('0x2b'),_0xb6fd3d[_0x99ef('0x28')],_0xcf0fa5['id']);var _0x3dcde1={'ListId':_0x17ca41};var _0x21b8e1=_0x1113c0[_0x99ef('0x2c')]&&_0x1113c0[_0x99ef('0x2c')]!=='0'?_0x1113c0[_0x99ef('0x2c')]:_0x99ef('0x1b');if(_0x242e1f){logger[_0x99ef('0xb')](_0x99ef('0x2d'),_0xb6fd3d['uniqueid'],_0xcf0fa5['id']);_0x3dcde1[_0x21b8e1]=_[_0x99ef('0x10')](_0xb6fd3d[_0x99ef('0x16')])?_0xb6fd3d[_0x99ef('0x17')]:_0xb6fd3d[_0x99ef('0x18')];if(_[_0x99ef('0x10')](_0xb6fd3d['routeId'])){_0x3dcde1['firstName']=_0xb6fd3d[_0x99ef('0x2e')]&&_0xb6fd3d['calleridname']!==_0x99ef('0x2f')?_0xb6fd3d['calleridname']:_0x99ef('0x30');}else{_0x3dcde1[_0x99ef('0x19')]=_0xb6fd3d[_0x99ef('0x31')]&&_0xb6fd3d[_0x99ef('0x31')]!==_0x99ef('0x2f')?_0xb6fd3d['destcalleridname']:_0x99ef('0x30');}return BPromise[_0x99ef('0x22')]()['then'](cmContactRpc[_0x99ef('0x32')](_0x3dcde1))['then'](function(_0x4b93c2){_0x2e4022=_0x4b93c2;_0xfd1ee9['push'](_0x4b93c2);if(_0x2e4022){logger[_0x99ef('0xb')](_0x99ef('0x33'),_0xb6fd3d[_0x99ef('0x28')],_0xcf0fa5['id'],_0x2e4022['id']);}return;});}else{logger[_0x99ef('0xb')](_0x99ef('0x34'),_0xb6fd3d['uniqueid'],_0xcf0fa5['id']);_0x3dcde1[_0x21b8e1]=_[_0x99ef('0x10')](_0xb6fd3d[_0x99ef('0x16')])?_0xb6fd3d[_0x99ef('0x17')]:_0xb6fd3d['destcalleridnum'];if(_[_0x99ef('0x10')](_0xb6fd3d[_0x99ef('0x16')])){_0x3dcde1[_0x99ef('0x19')]=_0xb6fd3d[_0x99ef('0x2e')]&&_0xb6fd3d['calleridname']!==_0x99ef('0x2f')?_0xb6fd3d[_0x99ef('0x2e')]:_0x99ef('0x30');}else{_0x3dcde1[_0x99ef('0x19')]=_0xb6fd3d[_0x99ef('0x31')]&&_0xb6fd3d[_0x99ef('0x31')]!==_0x99ef('0x2f')?_0xb6fd3d[_0x99ef('0x31')]:_0x99ef('0x30');}_0x2e4022=_0x3dcde1;_0xfd1ee9[_0x99ef('0x35')](_0x3dcde1);return;}}})['then'](function(){if(_0xae9ed1){emit(_0xb6fd3d[_0x99ef('0x28')],_0xcf0fa5,util[_0x99ef('0x36')](_0x99ef('0x37'),_0xae9ed1[_0x99ef('0x38')]),util[_0x99ef('0x36')](_0x99ef('0x39'),_0x1113c0[_0x99ef('0x3a')]['toLowerCase']()),{'evt':_[_0x99ef('0x3b')](_0xb6fd3d,{'autoCreate':_0x242e1f}),'contact':_0x2e4022===undefined?{}:_0x2e4022,'contacts':_0xfd1ee9['length']===0x0?undefined:_0xfd1ee9});}});}; \ No newline at end of file +var _0x1b1b=['format','trigger:%s','action','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','exec','data2','isNil','data5','ListId','data3','phone','$or','routeId','calleridnum','firstName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled'];(function(_0x3d4ba2,_0x40d12d){var _0x889610=function(_0x2d3066){while(--_0x2d3066){_0x3d4ba2['push'](_0x3d4ba2['shift']());}};_0x889610(++_0x40d12d);}(_0x1b1b,0x1be));var _0xb1b1=function(_0x2e89f2,_0x242212){_0x2e89f2=_0x2e89f2-0x0;var _0x4f04b0=_0x1b1b[_0x2e89f2];return _0x4f04b0;};'use strict';var _=require(_0xb1b1('0x0'));var BPromise=require(_0xb1b1('0x1'));var Redis=require(_0xb1b1('0x2'));var util=require(_0xb1b1('0x3'));var config=require(_0xb1b1('0x4'));var logger=require(_0xb1b1('0x5'))(_0xb1b1('0x6'));var cmContactRpc=require(_0xb1b1('0x7'));config[_0xb1b1('0x8')]=_[_0xb1b1('0x9')](config[_0xb1b1('0x8')],{'host':_0xb1b1('0xa'),'port':0x18eb});var io=require(_0xb1b1('0xb'))(new Redis(config[_0xb1b1('0x8')]));function emit(_0x13b731,_0x35479f,_0x1bf2af,_0x3007a2,_0x43557c){logger[_0xb1b1('0xc')]('[CM][%s][%s]',_0x13b731,_0x35479f['id'],_0x1bf2af,_0x3007a2,JSON[_0xb1b1('0xd')](_0x43557c));io['to'](_0x1bf2af)['emit'](_0x3007a2,_0x43557c);}exports[_0xb1b1('0xe')]=function(_0xfd7a2a,_0x41a1bd,_0x277024,_0x4236af){var _0x3c1e3a,_0xdeb1a9;var _0x88d84f={};var _0xc8046;var _0x3f4c73=Number(_0x277024['data1']);var _0x28e2ec=_0x277024[_0xb1b1('0xf')]?Boolean(Number(_0x277024[_0xb1b1('0xf')])):![];var _0x15d3d9;var _0x138368=![];if(!_[_0xb1b1('0x10')](_0x277024[_0xb1b1('0x11')])){if(_0x277024[_0xb1b1('0x11')]=='1')_0x138368=!![];}if(!_0x138368){if(_0x4236af['xmd-contactid']){_0x88d84f['id']=_0x4236af['xmd-contactid'];}}if(!_0x88d84f['id']){_0x88d84f[_0xb1b1('0x12')]=_0x3f4c73;_0x15d3d9=_0x277024[_0xb1b1('0x13')]&&_0x277024[_0xb1b1('0x13')]!=='0'?_0x277024[_0xb1b1('0x13')]['split'](','):[_0xb1b1('0x14')];_0x88d84f[_0xb1b1('0x15')]=_['map'](_0x15d3d9,function(_0x5a8f4c){var _0x5de4a3={};_0x5de4a3[_0x5a8f4c]=_0x4236af[_0xb1b1('0x16')]?_0x4236af['destcalleridnum']:_0x4236af['calleridnum'];return _0x5de4a3;});_0xc8046=_0x4236af[_0xb1b1('0x16')]?_0x4236af['destcalleridnum']:_0x4236af[_0xb1b1('0x17')];}var _0x2ab901=['id',_0xb1b1('0x18'),'lastName',_0xb1b1('0x14'),'mobile',_0xb1b1('0x19'),_0xb1b1('0x12'),_0xb1b1('0x1a'),_0xb1b1('0x1b'),_0xb1b1('0x1c')];var _0x718799=_[_0xb1b1('0x1d')](_0x2ab901,_0x15d3d9);BPromise[_0xb1b1('0x1e')]()[_0xb1b1('0x1f')](cmContactRpc[_0xb1b1('0x20')]({'attributes':_0x718799,'where':_0x88d84f,'phone':_0xc8046}))[_0xb1b1('0x1f')](function(_0x176188){_0xdeb1a9=_0x176188;if(!_['isEmpty'](_0xdeb1a9)){if(_0xdeb1a9['length']===0x1){_0x3c1e3a=_0xdeb1a9[0x0];logger[_0xb1b1('0xc')](_0xb1b1('0x21'),_0x4236af[_0xb1b1('0x22')],_0x41a1bd['id'],_0x3c1e3a['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4236af[_0xb1b1('0x22')],_0x41a1bd['id'],_[_0xb1b1('0x23')](_0xdeb1a9,'id')[_0xb1b1('0x24')](','));}return;}else{logger[_0xb1b1('0xc')](_0xb1b1('0x25'),_0x4236af['uniqueid'],_0x41a1bd['id']);var _0x1463e3={'ListId':_0x3f4c73};var _0x3b9227=_0x277024[_0xb1b1('0x26')]&&_0x277024[_0xb1b1('0x26')]!=='0'?_0x277024[_0xb1b1('0x26')]:_0xb1b1('0x14');if(_0x28e2ec){logger[_0xb1b1('0xc')](_0xb1b1('0x27'),_0x4236af[_0xb1b1('0x22')],_0x41a1bd['id']);_0x1463e3[_0x3b9227]=_['isNil'](_0x4236af[_0xb1b1('0x16')])?_0x4236af[_0xb1b1('0x17')]:_0x4236af[_0xb1b1('0x28')];if(_[_0xb1b1('0x10')](_0x4236af[_0xb1b1('0x16')])){_0x1463e3['firstName']=_0x4236af[_0xb1b1('0x29')]&&_0x4236af['calleridname']!==_0xb1b1('0x2a')?_0x4236af[_0xb1b1('0x29')]:'Unknown';}else{_0x1463e3['firstName']=_0x4236af[_0xb1b1('0x2b')]&&_0x4236af[_0xb1b1('0x2b')]!==''?_0x4236af[_0xb1b1('0x2b')]:_0xb1b1('0x2c');}return BPromise[_0xb1b1('0x1e')]()[_0xb1b1('0x1f')](cmContactRpc[_0xb1b1('0x2d')](_0x1463e3))[_0xb1b1('0x1f')](function(_0x4408f8){_0x3c1e3a=_0x4408f8;_0xdeb1a9[_0xb1b1('0x2e')](_0x4408f8);if(_0x3c1e3a){logger[_0xb1b1('0xc')](_0xb1b1('0x2f'),_0x4236af[_0xb1b1('0x22')],_0x41a1bd['id'],_0x3c1e3a['id']);}return;});}else{logger['info'](_0xb1b1('0x30'),_0x4236af[_0xb1b1('0x22')],_0x41a1bd['id']);_0x1463e3[_0x3b9227]=_['isNil'](_0x4236af['routeId'])?_0x4236af['calleridnum']:_0x4236af[_0xb1b1('0x28')];if(_[_0xb1b1('0x10')](_0x4236af[_0xb1b1('0x16')])){_0x1463e3[_0xb1b1('0x18')]=_0x4236af[_0xb1b1('0x29')]&&_0x4236af['calleridname']!==_0xb1b1('0x2a')?_0x4236af[_0xb1b1('0x29')]:_0xb1b1('0x2c');}else{_0x1463e3[_0xb1b1('0x18')]=_0x4236af[_0xb1b1('0x2b')]&&_0x4236af['destcalleridname']!==_0xb1b1('0x2a')?_0x4236af[_0xb1b1('0x2b')]:_0xb1b1('0x2c');}_0x3c1e3a=_0x1463e3;_0xdeb1a9['push'](_0x1463e3);return;}}})[_0xb1b1('0x1f')](function(){if(_0xfd7a2a){emit(_0x4236af['uniqueid'],_0x41a1bd,util[_0xb1b1('0x31')]('user:%s',_0xfd7a2a['name']),util[_0xb1b1('0x31')](_0xb1b1('0x32'),_0x277024[_0xb1b1('0x33')][_0xb1b1('0x34')]()),{'evt':_[_0xb1b1('0x35')](_0x4236af,{'autoCreate':_0x28e2ec}),'contact':_0x3c1e3a===undefined?{}:_0x3c1e3a,'contacts':_0xdeb1a9[_0xb1b1('0x36')]===0x0?undefined:_0xdeb1a9});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index b80f0a8..1ea2a22 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 _0xa35c=['custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','clone','motionChannel','undefined','voice','inspect','checkTriggers','agents','interface','hasOwnProperty','status','checkTrigger','merge','Actions','action','toLowerCase','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','winApplication','format','name','trigger:%s:%s','jscripty','user:%s','trigger:%s','emit','contactmanager','exec','integration','queue','routeId','urlforward','script','parse','search','channel','AllConditions','length','every','AnyConditions','some','checkConditions','debug','evt','account','chat','operator','value','AccountId','upperFirst','interaction','message','event','agent','membername','mailSubstatus','null','substatus','created','equals','exports','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','voiceQueues','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','accounts','freshdeskAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent'];(function(_0x56d472,_0x55911d){var _0xe2af19=function(_0x54a525){while(--_0x54a525){_0x56d472['push'](_0x56d472['shift']());}};_0xe2af19(++_0x55911d);}(_0xa35c,0xe1));var _0xca35=function(_0x3f73a8,_0x2a7496){_0x3f73a8=_0x3f73a8-0x0;var _0x567251=_0xa35c[_0x3f73a8];return _0x567251;};'use strict';var util=require('util');var _=require(_0xca35('0x0'));var url=require(_0xca35('0x1'));var Mustache=require(_0xca35('0x2'));var Redis=require(_0xca35('0x3'));var urlforward=require(_0xca35('0x4'));var integration=require('./integration');var cmContact=require(_0xca35('0x5'));var script=require(_0xca35('0x6'));var config=require(_0xca35('0x7'));var logger=require(_0xca35('0x8'))(_0xca35('0x9'));var ami=require(_0xca35('0xa'));config[_0xca35('0xb')]=_['defaults'](config[_0xca35('0xb')],{'host':_0xca35('0xc'),'port':0x18eb});var io=require(_0xca35('0xd'))(new Redis(config[_0xca35('0xb')]));var operators={'equals':function(_0x3078f6,_0x21f904){return _0x3078f6==_0x21f904;},'not_equals':function(_0x54d59e,_0x1afcc0){return _0x54d59e!=_0x1afcc0;}};var barAndWebActions=[_0xca35('0xe'),'url',_0xca35('0xf')];function Trigger(_0x3ab051){this[_0xca35('0x10')]=_0x3ab051[_0xca35('0x10')];this['agents']=_0x3ab051['agents'];this['voiceQueues']=_0x3ab051[_0xca35('0x11')];this[_0xca35('0x12')]=_0x3ab051[_0xca35('0x12')];this[_0xca35('0x13')]=_0x3ab051['voiceExtensions'];this[_0xca35('0x14')]=_0x3ab051['zendeskAccounts'];this['freshdeskAccounts']=_0x3ab051['freshdeskAccounts'];this[_0xca35('0x15')]=_0x3ab051['salesforceAccounts'];this[_0xca35('0x16')]=_0x3ab051[_0xca35('0x16')];this[_0xca35('0x17')]=_0x3ab051[_0xca35('0x17')];this['deskAccounts']=_0x3ab051[_0xca35('0x18')];this['vtigerAccounts']=_0x3ab051[_0xca35('0x19')];this[_0xca35('0x1a')]=_0x3ab051['servicenowAccounts'];this['dynamics365Accounts']=_0x3ab051['dynamics365Accounts'];this['freshsalesAccounts']=_0x3ab051['freshsalesAccounts'];this[_0xca35('0x1b')]={'zendesk':this[_0xca35('0x14')],'salesforce':this[_0xca35('0x15')],'freshdesk':this[_0xca35('0x1c')],'sugarcrm':this[_0xca35('0x16')],'zoho':this[_0xca35('0x17')],'desk':this['deskAccounts'],'vtiger':this[_0xca35('0x19')],'dynamics365':this[_0xca35('0x1d')],'freshsales':this[_0xca35('0x1e')],'servicenow':this[_0xca35('0x1a')]};ami['on'](_0xca35('0x1f'),this[_0xca35('0x20')]['bind'](this));ami['on'](_0xca35('0x21'),this['syncCustomEvent'][_0xca35('0x22')](this));ami['on'](_0xca35('0x23'),this[_0xca35('0x20')]['bind'](this));ami['on'](_0xca35('0x24'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x25'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on']('custom:agentnoanswer',this[_0xca35('0x20')]['bind'](this));ami['on'](_0xca35('0x26'),this['syncCustomEvent'][_0xca35('0x22')](this));ami['on']('custom:agentcongestion',this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x27'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x28'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x29'),this['syncCustomEvent'][_0xca35('0x22')](this));ami['on']('custom:timeout',this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x2a'),this[_0xca35('0x2b')][_0xca35('0x22')](this));ami['on'](_0xca35('0x2c'),this['syncAgentDial'][_0xca35('0x22')](this));ami['on'](_0xca35('0x2d'),this['syncAgentDial']['bind'](this));ami['on'](_0xca35('0x2e'),this[_0xca35('0x20')]['bind'](this));ami['on'](_0xca35('0x2f'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x30'),this[_0xca35('0x20')]['bind'](this));ami['on'](_0xca35('0x31'),this['syncCustomEvent'][_0xca35('0x22')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0xca35('0x32'),this[_0xca35('0x20')][_0xca35('0x22')](this));ami['on'](_0xca35('0x33'),this[_0xca35('0x20')]['bind'](this));ami['on']('custom:offlineMessage',this[_0xca35('0x20')][_0xca35('0x22')](this));}Trigger[_0xca35('0x34')]['emit']=function(_0x163cdc,_0x4911bb,_0x3c47fc){logger['info'](_0x163cdc,_0x4911bb,JSON['stringify'](_0x3c47fc));io['to'](_0x163cdc)['emit'](_0x4911bb,_0x3c47fc);};Trigger[_0xca35('0x34')]['syncCustomEvent']=function(_0x57b815){var _0x425e55=_[_0xca35('0x35')](_0x57b815);if(typeof _0x425e55[_0xca35('0x36')]===_0xca35('0x37')){_0x425e55[_0xca35('0x36')]=_0xca35('0x38');}logger['debug']('syncCustomEvent',util[_0xca35('0x39')](_0x425e55,{'showHidden':!![],'depth':null}));this[_0xca35('0x3a')](_0x425e55);};Trigger[_0xca35('0x34')][_0xca35('0x2b')]=function(_0x3895f6){if(this[_0xca35('0x3b')][_0x3895f6[_0xca35('0x3c')]]){this['syncCustomEvent'](_0x3895f6);}};Trigger[_0xca35('0x34')]['checkTriggers']=function(_0x2866d8){var _0x261fc7;for(var _0x36cc97 in this[_0xca35('0x10')]){if(this[_0xca35('0x10')][_0xca35('0x3d')](_0x36cc97)){if(this[_0xca35('0x10')][_0x36cc97][_0xca35('0x3e')]){_0x261fc7=this[_0xca35('0x3f')](this[_0xca35('0x10')][_0x36cc97],_0x2866d8);if(_0x261fc7){_[_0xca35('0x40')](_0x2866d8,_0x2866d8['variables']);for(var _0x2b3b9b=0x0,_0x3821c3,_0x494e62,_0x2bb487;_0x2b3b9b0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x5fc3[_0x11a55c];return _0x26c390;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 698c232..26276f5 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 _0xff15=['format','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','../../../../config/logger','dynamics365','redis','defaults','localhost','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','POST','clientId','username','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','odata-entityid','substring','lastIndexOf','enduserId','telephone1','&$filter=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','queue','callDirection','phonecalls','Subjects','headers','ticketId'];(function(_0x268e54,_0x597e8c){var _0x455a38=function(_0x1b9b06){while(--_0x1b9b06){_0x268e54['push'](_0x268e54['shift']());}};_0x455a38(++_0x597e8c);}(_0xff15,0x1c7));var _0x5ff1=function(_0x187279,_0x26d152){_0x187279=_0x187279-0x0;var _0x3da59d=_0xff15[_0x187279];return _0x3da59d;};'use strict';var _=require(_0x5ff1('0x0'));var rp=require(_0x5ff1('0x1'));var util=require('util');var intUtil=require(_0x5ff1('0x2'));var md5=require(_0x5ff1('0x3'));var Redis=require('ioredis');var logger=require(_0x5ff1('0x4'))(_0x5ff1('0x5'));var config=require('../../../../config/environment');config[_0x5ff1('0x6')]=_[_0x5ff1('0x7')](config[_0x5ff1('0x6')],{'host':_0x5ff1('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5ff1('0x6')]));function getAuthToken(_0x3d3505,_0x40875e,_0x35f484){if(_0x3d3505[_0x5ff1('0x9')]){_0x3d3505[_0x5ff1('0xa')]=_0x3d3505[_0x5ff1('0xb')]['data7'];_0x3d3505[_0x5ff1('0xc')]=_0x3d3505[_0x5ff1('0xb')][_0x5ff1('0xd')];return Promise[_0x5ff1('0xe')](_0x3d3505['CloudProvider']['data5']);}var _0x47a782={'method':_0x5ff1('0xf'),'uri':_0x40875e,'form':{'client_id':_0x3d3505[_0x5ff1('0x10')],'resource':_0x3d3505[_0x5ff1('0xa')],'username':_0x3d3505[_0x5ff1('0x11')],'password':_0x3d3505[_0x5ff1('0x12')],'grant_type':_0x5ff1('0x12'),'client_secret':_0x3d3505[_0x5ff1('0x13')]},'json':!![]};return rp(_0x47a782)[_0x5ff1('0x14')](function(_0x393345){return _0x393345[_0x5ff1('0x15')];})[_0x5ff1('0x16')](function(_0x329346){logger[_0x5ff1('0x17')]('['+[_0x35f484['toUpperCase']()]+_0x5ff1('0x18'));return _0x329346[_0x5ff1('0x19')];});}function getUser(_0x3b34bc,_0x5427bc,_0x6f70fc,_0x5f2f03,_0x1daf05,_0x40e12d){return new Promise(function(_0x10eb67,_0xbeca2c){return getAuthToken(_0x5427bc,_0x5f2f03,_0x40e12d)[_0x5ff1('0x14')](function(_0xe90396){var _0x417752={'method':_0x5ff1('0x1a'),'uri':_0x1daf05+_0x5ff1('0x1b'),'headers':{'Authorization':_0x5ff1('0x1c')+_0xe90396,'OData-Version':_0x5ff1('0x1d')},'json':!![]};return rp(_0x417752);})[_0x5ff1('0x14')](function(_0x3b1095){var _0x287826=_0x3b1095[_0x5ff1('0x1e')];var _0x4cdccc=![];var _0x107660=null;if(!_['isNil'](_0x6f70fc)){if(intUtil[_0x5ff1('0x1f')](_0x6f70fc['email'])){_0x3b34bc[_0x5ff1('0x20')]=_0x6f70fc[_0x5ff1('0x21')];for(_0x107660=0x0;_0x107660<_0x287826[_0x5ff1('0x22')];_0x107660++){if(_0x287826[_0x107660][_0x5ff1('0x23')]===_0x6f70fc['email']&&!_0x287826[_0x107660][_0x5ff1('0x24')]){_0x4cdccc=!![];logger[_0x5ff1('0x25')]('['+[_0x40e12d[_0x5ff1('0x26')]()]+_0x5ff1('0x27')+_0x287826[_0x107660][_0x5ff1('0x28')]+'!');_0x3b34bc[_0x5ff1('0x29')]=_0x287826[_0x107660][_0x5ff1('0x28')];}}}}if(!_0x4cdccc){logger['info']('['+[_0x40e12d['toUpperCase']()]+_0x5ff1('0x2a'));_0x3b34bc[_0x5ff1('0x20')]=_0x5427bc[_0x5ff1('0x11')];for(_0x107660=0x0;_0x107660<_0x287826['length'];_0x107660++){if(_0x287826[_0x107660][_0x5ff1('0x23')]===_0x5427bc[_0x5ff1('0x11')]){_0x3b34bc[_0x5ff1('0x29')]=_0x287826[_0x107660][_0x5ff1('0x28')];}}}_0x10eb67(_0x3b34bc);})[_0x5ff1('0x16')](function(_0x543459){_0xbeca2c(_0x543459['message']);});});}function createEndUser(_0x1d5ac1,_0x2bb397,_0x75fff8,_0x2792ae,_0x2f696a,_0x4991a0,_0x4f0810){return new Promise(function(_0x1c1b5a,_0x3cd040){return getAuthToken(_0x2bb397,_0x75fff8,_0x4991a0)['then'](function(_0x3653b7){var _0x1f7d8d=_0x4991a0[_0x5ff1('0x2b')]()===_0x5ff1('0x2c')?_0x2f696a[_0x5ff1('0x2d')]:_0x2f696a[_0x5ff1('0x2e')];var _0x25eda0={'method':_0x5ff1('0xf'),'uri':_0x2792ae+_0x5ff1('0x2f'),'body':{'fullname':_0x1f7d8d,'firstname':_0x1f7d8d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5ff1('0x30')+_0x1d5ac1[_0x5ff1('0x29')]+')'},'headers':{'Authorization':_0x5ff1('0x1c')+_0x3653b7,'OData-Version':_0x5ff1('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x25eda0[_0x5ff1('0x31')][_0x4f0810]=_0x1f7d8d;return rp(_0x25eda0);})[_0x5ff1('0x14')](function(_0x11faa8){var _0x4eb404=_0x11faa8['headers'][_0x5ff1('0x32')];var _0x2c9397=_0x4eb404[_0x5ff1('0x33')](_0x4eb404[_0x5ff1('0x34')]('(')+0x1,_0x4eb404['lastIndexOf'](')'));_0x1d5ac1[_0x5ff1('0x35')]=_0x2c9397;_0x1c1b5a(_0x1d5ac1);})[_0x5ff1('0x16')](function(_0x5c0729){_0x3cd040(_0x5c0729[_0x5ff1('0x19')]);});});}function getEndUser(_0x4760a6,_0x3695d8,_0x52c403,_0x332d13,_0x4f2ebd,_0x2e5c6b,_0x2e64cc,_0x40f501){var _0x42b0d4=_0x2e5c6b[_0x5ff1('0x2b')]()===_0x5ff1('0x2c')?_0x4f2ebd[_0x5ff1('0x2d')]:_0x4f2ebd['calleridnum'];return getAuthToken(_0x3695d8,_0x52c403,_0x2e5c6b)[_0x5ff1('0x14')](function(_0x41c7f3){_0x40f501=_0x40f501?_0x40f501:_0x5ff1('0x36');var _0x5bf27d={'method':'GET','uri':_0x332d13+'contacts?$select='+_0x40f501+_0x5ff1('0x37')+_0x40f501+_0x5ff1('0x38')+_0x42b0d4[_0x5ff1('0x39')]('+','%2b')+'\x27','headers':{'Authorization':_0x5ff1('0x1c')+_0x41c7f3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5bf27d);})['then'](function(_0x1c9727){var _0x3ea88c=![];if(!_0x1c9727)return _0x3ea88c;var _0x1e3a1c=_0x1c9727[_0x5ff1('0x1e')];for(var _0xab53ae=0x0;_0xab53ae<_0x1e3a1c[_0x5ff1('0x22')];_0xab53ae++){if(_0x1e3a1c[_0xab53ae][_0x40f501]===_0x42b0d4){_0x3ea88c=!![];_0x4760a6['enduserId']=_0x1e3a1c[_0xab53ae][_0x5ff1('0x3a')];}}return _0x3ea88c;})[_0x5ff1('0x14')](function(_0x4a3e21){if(_0x4a3e21)return _0x4760a6;if(_0x2e64cc===_0x5ff1('0x3b')){logger[_0x5ff1('0x25')]('['+[_0x2e5c6b[_0x5ff1('0x26')]()]+_0x5ff1('0x3c'));return _0x4760a6;}return createEndUser(_0x4760a6,_0x3695d8,_0x52c403,_0x332d13,_0x4f2ebd,_0x2e5c6b,_0x40f501)['then'](function(_0x138b30){logger[_0x5ff1('0x25')]('['+[_0x2e5c6b[_0x5ff1('0x26')]()]+_0x5ff1('0x3d'),_0x138b30[_0x5ff1('0x35')]);return _0x138b30;});});}function getCustomFields(_0x20d409,_0x390fe2,_0x1afd03){var _0x3b2ac7={};if(_0x20d409[_0x5ff1('0x22')]>0x0){_[_0x5ff1('0x3e')](_0x20d409,function(_0x3b0b5d){if(_['includes']([_0x5ff1('0x3f'),_0x5ff1('0x40')],_0x3b0b5d['type'])&&_0x3b0b5d[_0x5ff1('0x41')]&&!_0x3b0b5d[_0x5ff1('0x42')]){var _0x1364a4=_0x3b0b5d[_0x5ff1('0x43')][_0x5ff1('0x2b')]();var _0xeafd84=_0x1364a4[_0x5ff1('0x33')](0x0,_0x1364a4[_0x5ff1('0x44')]('_'));var _0x2c469f=_0x1364a4[_0x5ff1('0x33')](_0x1364a4[_0x5ff1('0x44')]('_')+0x1);if(_0xeafd84===_0x1afd03){_0x3b2ac7[_0x2c469f]=_0x3b0b5d[_0x5ff1('0x45')];}}});}return _0x3b2ac7;}function getTicket(_0x2717a0,_0x229595,_0x52543d,_0x2dc2e7,_0x1d9675,_0x2d8088,_0x2e35b4){return new Promise(function(_0x210183,_0x49d34f){var _0x1dd2bc;return getAuthToken(_0x229595,_0x52543d,_0x2e35b4)[_0x5ff1('0x14')](function(_0x57feeb){if(_0x2d8088['ticketType']===_0x5ff1('0x46')){_0x1dd2bc={'method':_0x5ff1('0xf'),'uri':_0x2dc2e7+_0x5ff1('0x47'),'body':Object[_0x5ff1('0x48')]({},{'title':intUtil['getString'](_0x2d8088['Subjects'],_0x1d9675,'\x20'),'description':intUtil[_0x5ff1('0x49')](_0x2d8088[_0x5ff1('0x4a')],_0x1d9675,'\x0a'),'customerid_contact@odata.bind':_0x2717a0[_0x5ff1('0x35')]?_0x5ff1('0x4b')+_0x2717a0['enduserId']+')':undefined,'ownerid@odata.bind':_0x5ff1('0x30')+_0x2717a0[_0x5ff1('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x2d8088[_0x5ff1('0x4c')],_0x1d9675,_0x2d8088[_0x5ff1('0x4d')])),'headers':{'Authorization':'Bearer\x20'+_0x57feeb,'OData-Version':_0x5ff1('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2d8088[_0x5ff1('0x4d')]===_0x5ff1('0x4e')){var _0x20bd28=_0x2717a0['enduserId']?[{'partyid_systemuser@odata.bind':_0x5ff1('0x30')+_0x2717a0[_0x5ff1('0x29')]+')','participationtypemask':_0x2717a0['callDirection']===_0x5ff1('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x5ff1('0x4b')+_0x2717a0['enduserId']+')','participationtypemask':_0x2717a0[_0x5ff1('0x50')]===_0x5ff1('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5ff1('0x30')+_0x2717a0[_0x5ff1('0x29')]+')','participationtypemask':_0x2717a0[_0x5ff1('0x50')]===_0x5ff1('0x4f')?0x2:0x1}];_0x1dd2bc={'method':_0x5ff1('0xf'),'uri':_0x2dc2e7+_0x5ff1('0x51'),'body':Object['assign']({},{'subject':intUtil[_0x5ff1('0x49')](_0x2d8088[_0x5ff1('0x52')],_0x1d9675,'\x20'),'phonenumber':String(_0x1d9675[_0x5ff1('0x2e')]),'description':intUtil[_0x5ff1('0x49')](_0x2d8088[_0x5ff1('0x4a')],_0x1d9675,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2717a0[_0x5ff1('0x35')]?_0x5ff1('0x4b')+_0x2717a0['enduserId']+')':undefined,'ownerid@odata.bind':_0x5ff1('0x30')+_0x2717a0[_0x5ff1('0x29')]+')','directioncode':_0x2717a0[_0x5ff1('0x50')]==='queue'?![]:!![],'phonecall_activity_parties':_0x20bd28},getCustomFields(_0x2d8088['Fields'],_0x1d9675,_0x2d8088[_0x5ff1('0x4d')])),'headers':{'Authorization':'Bearer\x20'+_0x57feeb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1dd2bc);})[_0x5ff1('0x14')](function(_0x1c7fef){var _0x2d860a=_0x1c7fef[_0x5ff1('0x53')]['odata-entityid'];var _0x1d3a12=_0x2d860a['substring'](_0x2d860a[_0x5ff1('0x34')]('(')+0x1,_0x2d860a['lastIndexOf'](')'));_0x2717a0[_0x5ff1('0x54')]=_0x1d3a12;_0x210183(_0x2717a0);})['catch'](function(_0x3c1259){_0x49d34f(_0x3c1259['message']);});});}function emit(_0x4a3cfc,_0x629ead,_0x362c48,_0x111400){var _0x2d6cfb={'uri':util[_0x5ff1('0x55')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4a3cfc,_0x362c48,_0x111400)};io['to'](util[_0x5ff1('0x55')]('user:%s',_0x629ead))[_0x5ff1('0x56')]('trigger:browser:url',_0x2d6cfb);}exports['cs']=function(_0x364139,_0xb7a138,_0x5ebaf4,_0x4579b4,_0x2780fc,_0x5b496f,_0x7249a3,_0x391a22){var _0x3f9602={};_0x5b496f['remoteUri']=_0x5b496f[_0x5ff1('0x9')]?intUtil[_0x5ff1('0x57')](_0x5b496f[_0x5ff1('0xb')]['data7']):intUtil['stripTrailingSlash'](_0x5b496f[_0x5ff1('0xa')]);_0x5b496f['serverUrl']=intUtil[_0x5ff1('0x57')](_0x5b496f[_0x5ff1('0x58')]);_0x3f9602[_0x5ff1('0x50')]=_0x391a22===_0x5ff1('0x4f')||_0x391a22===_0x5ff1('0x59')?_0x5ff1('0x4f'):'outbound';var _0x1a2999=_0x5b496f['modernAuthentication']?util[_0x5ff1('0x55')](_0x5ff1('0x5a'),_0x5b496f[_0x5ff1('0xb')][_0x5ff1('0x5b')]):util['format'](_0x5ff1('0x5a'),_0x5b496f[_0x5ff1('0xa')]);var _0xb6df00=util[_0x5ff1('0x55')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5b496f['tenantId']);var _0x55062a=util['format'](_0x5ff1('0x5c'),_0x5b496f[_0x5ff1('0x58')],_0xb7a138[_0x5ff1('0x5d')],md5(_0xb7a138[_0x5ff1('0x5d')]));if(_0x2780fc&&_0x2780fc[_0x5ff1('0x5e')]){logger[_0x5ff1('0x25')]('[QUEUE]',_0x5ff1('0x5f'));_0xb7a138[_0x5ff1('0x60')]=_0x55062a;}else if(_0x7249a3&&_0x7249a3['recordingFormat']&&_0x7249a3[_0x5ff1('0x61')]!=='none'){logger['info']('[OUTBOUND]',_0x5ff1('0x5f'));_0xb7a138[_0x5ff1('0x60')]=_0x55062a;}else{_0xb7a138[_0x5ff1('0x60')]='';}return getUser(_0x3f9602,_0x5b496f,_0x4579b4,_0xb6df00,_0x1a2999,_0x391a22)[_0x5ff1('0x14')](function(_0x3fdf42){logger['info']('['+_0x391a22[_0x5ff1('0x26')]()+']\x20The\x20User\x20ID\x20is:',_0x3fdf42[_0x5ff1('0x29')]);logger[_0x5ff1('0x25')]('['+_0x391a22[_0x5ff1('0x26')]()+_0x5ff1('0x62'),_0x3fdf42['userEmail']);return getEndUser(_0x3fdf42,_0x5b496f,_0xb6df00,_0x1a2999,_0xb7a138,_0x391a22,_0x5ebaf4[_0x5ff1('0x63')],_0x5ebaf4[_0x5ff1('0x64')]);})[_0x5ff1('0x14')](function(_0x53231d){logger[_0x5ff1('0x25')]('['+_0x391a22['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x53231d['enduserId']);logger['info']('['+_0x391a22[_0x5ff1('0x26')]()+_0x5ff1('0x65'),_0xb7a138[_0x5ff1('0x2e')]);return getTicket(_0x53231d,_0x5b496f,_0xb6df00,_0x1a2999,_0xb7a138,_0x5ebaf4,_0x391a22);})['then'](function(_0x555ba8){logger[_0x5ff1('0x25')](util[_0x5ff1('0x55')]('['+_0x391a22[_0x5ff1('0x26')]()+_0x5ff1('0x66'),_0x5ebaf4['ticketType'],_0x555ba8[_0x5ff1('0x54')]));logger[_0x5ff1('0x25')](util[_0x5ff1('0x55')]('['+_0x391a22['toUpperCase']()+_0x5ff1('0x67'),_0x391a22));if(_0x391a22!==_0x5ff1('0x59')&&_0x5ebaf4[_0x5ff1('0x68')]){logger['info']('['+_0x391a22[_0x5ff1('0x26')]()+']',_0x5ff1('0x69'));emit(_0x5b496f[_0x5ff1('0xa')],_0x4579b4[_0x5ff1('0x6a')],_0x5ebaf4['ticketType'],_0x555ba8[_0x5ff1('0x54')]);}})[_0x5ff1('0x16')](function(_0x464e9a){logger[_0x5ff1('0x17')]('['+_0x391a22[_0x5ff1('0x26')]()+_0x5ff1('0x6b'),_0x464e9a[_0x5ff1('0x19')]);console[_0x5ff1('0x17')]('Error\x20running\x20Dynamics365\x20integration',_0x464e9a);});}; \ No newline at end of file +var _0x0191=['systemuserid','userId','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','Bearer\x20','body','headers','odata-entityid','substring','lastIndexOf','destcalleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','%2b','enduserId',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error','lodash','request-promise','./util','md5','ioredis','dynamics365','redis','modernAuthentication','remoteUri','data7','tenantId','data2','CloudProvider','data5','clientId','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20'];(function(_0x3c964f,_0x377ad3){var _0x16afec=function(_0x43f7a1){while(--_0x43f7a1){_0x3c964f['push'](_0x3c964f['shift']());}};_0x16afec(++_0x377ad3);}(_0x0191,0xac));var _0x1019=function(_0x48ab04,_0x160f27){_0x48ab04=_0x48ab04-0x0;var _0x1904e4=_0x0191[_0x48ab04];return _0x1904e4;};'use strict';var _=require(_0x1019('0x0'));var rp=require(_0x1019('0x1'));var util=require('util');var intUtil=require(_0x1019('0x2'));var md5=require(_0x1019('0x3'));var Redis=require(_0x1019('0x4'));var logger=require('../../../../config/logger')(_0x1019('0x5'));var config=require('../../../../config/environment');config['redis']=_['defaults'](config[_0x1019('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1019('0x6')]));function getAuthToken(_0x107fc8,_0x6f0f52,_0x46c2f4){if(_0x107fc8[_0x1019('0x7')]){_0x107fc8[_0x1019('0x8')]=_0x107fc8['CloudProvider'][_0x1019('0x9')];_0x107fc8[_0x1019('0xa')]=_0x107fc8['CloudProvider'][_0x1019('0xb')];return Promise['resolve'](_0x107fc8[_0x1019('0xc')][_0x1019('0xd')]);}var _0x15a6bd={'method':'POST','uri':_0x6f0f52,'form':{'client_id':_0x107fc8[_0x1019('0xe')],'resource':_0x107fc8[_0x1019('0x8')],'username':_0x107fc8[_0x1019('0xf')],'password':_0x107fc8['password'],'grant_type':_0x1019('0x10'),'client_secret':_0x107fc8[_0x1019('0x11')]},'json':!![]};return rp(_0x15a6bd)[_0x1019('0x12')](function(_0x5d1b4c){return _0x5d1b4c[_0x1019('0x13')];})[_0x1019('0x14')](function(_0x34dc2c){logger['error']('['+[_0x46c2f4[_0x1019('0x15')]()]+_0x1019('0x16'));return _0x34dc2c[_0x1019('0x17')];});}function getUser(_0x8e764c,_0x152498,_0x574f3b,_0x4c8985,_0x5803c8,_0x2afa66){return new Promise(function(_0x56d958,_0xdc390){return getAuthToken(_0x152498,_0x4c8985,_0x2afa66)[_0x1019('0x12')](function(_0x185a95){var _0x403534={'method':_0x1019('0x18'),'uri':_0x5803c8+_0x1019('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x185a95,'OData-Version':_0x1019('0x1a')},'json':!![]};return rp(_0x403534);})['then'](function(_0x5b1c07){var _0x232a1c=_0x5b1c07[_0x1019('0x1b')];var _0x51ec4b=![];var _0x42726b=null;if(!_[_0x1019('0x1c')](_0x574f3b)){if(intUtil[_0x1019('0x1d')](_0x574f3b[_0x1019('0x1e')])){_0x8e764c[_0x1019('0x1f')]=_0x574f3b[_0x1019('0x1e')];for(_0x42726b=0x0;_0x42726b<_0x232a1c[_0x1019('0x20')];_0x42726b++){if(_0x232a1c[_0x42726b][_0x1019('0x21')]===_0x574f3b['email']&&!_0x232a1c[_0x42726b]['isdisabled']){_0x51ec4b=!![];logger[_0x1019('0x22')]('['+[_0x2afa66[_0x1019('0x15')]()]+_0x1019('0x23')+_0x232a1c[_0x42726b][_0x1019('0x24')]+'!');_0x8e764c[_0x1019('0x25')]=_0x232a1c[_0x42726b][_0x1019('0x24')];}}}}if(!_0x51ec4b){logger[_0x1019('0x22')]('['+[_0x2afa66[_0x1019('0x15')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x8e764c[_0x1019('0x1f')]=_0x152498[_0x1019('0xf')];for(_0x42726b=0x0;_0x42726b<_0x232a1c[_0x1019('0x20')];_0x42726b++){if(_0x232a1c[_0x42726b]['internalemailaddress']===_0x152498[_0x1019('0xf')]){_0x8e764c[_0x1019('0x25')]=_0x232a1c[_0x42726b][_0x1019('0x24')];}}}_0x56d958(_0x8e764c);})[_0x1019('0x14')](function(_0x3a3ed2){_0xdc390(_0x3a3ed2[_0x1019('0x17')]);});});}function createEndUser(_0x75f10c,_0x7513ff,_0x1349c7,_0x4fca85,_0x35908f,_0x1cf8e0,_0x1ff49d){return new Promise(function(_0x258497,_0xe4e4a6){return getAuthToken(_0x7513ff,_0x1349c7,_0x1cf8e0)[_0x1019('0x12')](function(_0x17f764){var _0x415a45=_0x1cf8e0[_0x1019('0x26')]()===_0x1019('0x27')?_0x35908f['destcalleridnum']:_0x35908f[_0x1019('0x28')];var _0x38f111={'method':_0x1019('0x29'),'uri':_0x4fca85+_0x1019('0x2a'),'body':{'fullname':_0x415a45,'firstname':_0x415a45,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1019('0x2b')+_0x75f10c[_0x1019('0x25')]+')'},'headers':{'Authorization':_0x1019('0x2c')+_0x17f764,'OData-Version':_0x1019('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x38f111[_0x1019('0x2d')][_0x1ff49d]=_0x415a45;return rp(_0x38f111);})['then'](function(_0xb223f7){var _0x49df2e=_0xb223f7[_0x1019('0x2e')][_0x1019('0x2f')];var _0x40a402=_0x49df2e[_0x1019('0x30')](_0x49df2e[_0x1019('0x31')]('(')+0x1,_0x49df2e[_0x1019('0x31')](')'));_0x75f10c['enduserId']=_0x40a402;_0x258497(_0x75f10c);})[_0x1019('0x14')](function(_0x3a71e0){_0xe4e4a6(_0x3a71e0[_0x1019('0x17')]);});});}function getEndUser(_0x2ca287,_0x460444,_0x4038ed,_0x2a4c63,_0x24fd14,_0x5a6b06,_0x90014c,_0x16a18d){var _0x3e170d=_0x5a6b06['toLowerCase']()===_0x1019('0x27')?_0x24fd14[_0x1019('0x32')]:_0x24fd14[_0x1019('0x28')];return getAuthToken(_0x460444,_0x4038ed,_0x5a6b06)['then'](function(_0x267c0b){_0x16a18d=_0x16a18d?_0x16a18d:_0x1019('0x33');var _0x4554ce={'method':_0x1019('0x18'),'uri':_0x2a4c63+_0x1019('0x34')+_0x16a18d+'&$filter='+_0x16a18d+_0x1019('0x35')+_0x3e170d['replace']('+',_0x1019('0x36'))+'\x27','headers':{'Authorization':_0x1019('0x2c')+_0x267c0b,'If-None-Match':null,'OData-Version':_0x1019('0x1a')},'json':!![]};return rp(_0x4554ce);})[_0x1019('0x12')](function(_0x436013){var _0x2dfce7=![];if(!_0x436013)return _0x2dfce7;var _0x53c598=_0x436013[_0x1019('0x1b')];for(var _0x198035=0x0;_0x198035<_0x53c598[_0x1019('0x20')];_0x198035++){if(_0x53c598[_0x198035][_0x16a18d]===_0x3e170d){_0x2dfce7=!![];_0x2ca287[_0x1019('0x37')]=_0x53c598[_0x198035]['contactid'];}}return _0x2dfce7;})[_0x1019('0x12')](function(_0x336a3f){if(_0x336a3f)return _0x2ca287;if(_0x90014c==='nothing'){logger[_0x1019('0x22')]('['+[_0x5a6b06['toUpperCase']()]+_0x1019('0x38'));return _0x2ca287;}return createEndUser(_0x2ca287,_0x460444,_0x4038ed,_0x2a4c63,_0x24fd14,_0x5a6b06,_0x16a18d)[_0x1019('0x12')](function(_0x5cf4a3){logger[_0x1019('0x22')]('['+[_0x5a6b06['toUpperCase']()]+_0x1019('0x39'),_0x5cf4a3[_0x1019('0x37')]);return _0x5cf4a3;});});}function getCustomFields(_0x295401,_0xc373e2,_0x2da3e8){var _0x46c703={};if(_0x295401['length']>0x0){_[_0x1019('0x3a')](_0x295401,function(_0x4f7285){if(_[_0x1019('0x3b')]([_0x1019('0x3c'),_0x1019('0x3d')],_0x4f7285[_0x1019('0x3e')])&&_0x4f7285[_0x1019('0x3f')]&&!_0x4f7285['customField']){var _0xbdae4b=_0x4f7285['idField'][_0x1019('0x26')]();var _0x53468f=_0xbdae4b[_0x1019('0x30')](0x0,_0xbdae4b[_0x1019('0x40')]('_'));var _0x386848=_0xbdae4b[_0x1019('0x30')](_0xbdae4b['indexOf']('_')+0x1);if(_0x53468f===_0x2da3e8){_0x46c703[_0x386848]=_0x4f7285['content'];}}});}return _0x46c703;}function getTicket(_0x41e854,_0x27aa8e,_0x2212db,_0x1d96df,_0x5ab3bc,_0x10fbdf,_0x457508){return new Promise(function(_0x21ae01,_0x5435dd){var _0x2c8ee7;return getAuthToken(_0x27aa8e,_0x2212db,_0x457508)[_0x1019('0x12')](function(_0x4f4eb3){if(_0x10fbdf[_0x1019('0x41')]===_0x1019('0x42')){_0x2c8ee7={'method':_0x1019('0x29'),'uri':_0x1d96df+_0x1019('0x43'),'body':Object[_0x1019('0x44')]({},{'title':intUtil[_0x1019('0x45')](_0x10fbdf[_0x1019('0x46')],_0x5ab3bc,'\x20'),'description':intUtil[_0x1019('0x45')](_0x10fbdf[_0x1019('0x47')],_0x5ab3bc,'\x0a'),'customerid_contact@odata.bind':_0x41e854[_0x1019('0x37')]?_0x1019('0x48')+_0x41e854['enduserId']+')':undefined,'ownerid@odata.bind':_0x1019('0x2b')+_0x41e854[_0x1019('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x10fbdf[_0x1019('0x49')],_0x5ab3bc,_0x10fbdf[_0x1019('0x41')])),'headers':{'Authorization':_0x1019('0x2c')+_0x4f4eb3,'OData-Version':_0x1019('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x10fbdf[_0x1019('0x41')]===_0x1019('0x4a')){var _0x12c813=_0x41e854[_0x1019('0x37')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x41e854[_0x1019('0x25')]+')','participationtypemask':_0x41e854[_0x1019('0x4b')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x1019('0x48')+_0x41e854['enduserId']+')','participationtypemask':_0x41e854[_0x1019('0x4b')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1019('0x2b')+_0x41e854[_0x1019('0x25')]+')','participationtypemask':_0x41e854[_0x1019('0x4b')]===_0x1019('0x4c')?0x2:0x1}];_0x2c8ee7={'method':_0x1019('0x29'),'uri':_0x1d96df+_0x1019('0x4d'),'body':Object[_0x1019('0x44')]({},{'subject':intUtil[_0x1019('0x45')](_0x10fbdf[_0x1019('0x46')],_0x5ab3bc,'\x20'),'phonenumber':String(_0x5ab3bc[_0x1019('0x28')]),'description':intUtil[_0x1019('0x45')](_0x10fbdf[_0x1019('0x47')],_0x5ab3bc,'\x0a'),'regardingobjectid_contact@odata.bind':_0x41e854[_0x1019('0x37')]?_0x1019('0x48')+_0x41e854['enduserId']+')':undefined,'ownerid@odata.bind':_0x1019('0x2b')+_0x41e854[_0x1019('0x25')]+')','directioncode':_0x41e854[_0x1019('0x4b')]===_0x1019('0x4c')?![]:!![],'phonecall_activity_parties':_0x12c813},getCustomFields(_0x10fbdf['Fields'],_0x5ab3bc,_0x10fbdf[_0x1019('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x4f4eb3,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2c8ee7);})[_0x1019('0x12')](function(_0xa3d70){var _0x571975=_0xa3d70[_0x1019('0x2e')][_0x1019('0x2f')];var _0x15808b=_0x571975[_0x1019('0x30')](_0x571975[_0x1019('0x31')]('(')+0x1,_0x571975[_0x1019('0x31')](')'));_0x41e854['ticketId']=_0x15808b;_0x21ae01(_0x41e854);})[_0x1019('0x14')](function(_0x5d3713){_0x5435dd(_0x5d3713[_0x1019('0x17')]);});});}function emit(_0x1b5ed7,_0x5d2579,_0x35fdff,_0x52f334){var _0xf81c9d={'uri':util[_0x1019('0x4e')](_0x1019('0x4f'),_0x1b5ed7,_0x35fdff,_0x52f334)};io['to'](util[_0x1019('0x4e')](_0x1019('0x50'),_0x5d2579))['emit']('trigger:browser:url',_0xf81c9d);}exports['cs']=function(_0x581540,_0x34e722,_0x2c6e3a,_0x12c80f,_0x7f45ca,_0x28d918,_0x3d1726,_0x394c23){var _0x518406={};_0x28d918[_0x1019('0x8')]=_0x28d918['modernAuthentication']?intUtil['stripTrailingSlash'](_0x28d918[_0x1019('0xc')][_0x1019('0x9')]):intUtil[_0x1019('0x51')](_0x28d918[_0x1019('0x8')]);_0x28d918[_0x1019('0x52')]=intUtil['stripTrailingSlash'](_0x28d918[_0x1019('0x52')]);_0x518406['callDirection']=_0x394c23===_0x1019('0x4c')||_0x394c23===_0x1019('0x53')?'queue':'outbound';var _0x4b5b10=_0x28d918['modernAuthentication']?util[_0x1019('0x4e')](_0x1019('0x54'),_0x28d918[_0x1019('0xc')][_0x1019('0x9')]):util['format']('%s/api/data/v9.0/',_0x28d918['remoteUri']);var _0x36e8bf=util['format'](_0x1019('0x55'),_0x28d918[_0x1019('0xa')]);var _0x32e211=util[_0x1019('0x4e')](_0x1019('0x56'),_0x28d918[_0x1019('0x52')],_0x34e722[_0x1019('0x57')],md5(_0x34e722[_0x1019('0x57')]));if(_0x7f45ca&&_0x7f45ca['monitor_format']){logger[_0x1019('0x22')](_0x1019('0x58'),_0x1019('0x59'));_0x34e722[_0x1019('0x5a')]=_0x32e211;}else if(_0x3d1726&&_0x3d1726[_0x1019('0x5b')]&&_0x3d1726[_0x1019('0x5b')]!==_0x1019('0x5c')){logger[_0x1019('0x22')](_0x1019('0x5d'),'Recording\x20is\x20enabled!');_0x34e722[_0x1019('0x5a')]=_0x32e211;}else{_0x34e722['recordingURL']='';}return getUser(_0x518406,_0x28d918,_0x12c80f,_0x36e8bf,_0x4b5b10,_0x394c23)[_0x1019('0x12')](function(_0x34f4ba){logger[_0x1019('0x22')]('['+_0x394c23[_0x1019('0x15')]()+']\x20The\x20User\x20ID\x20is:',_0x34f4ba['userId']);logger[_0x1019('0x22')]('['+_0x394c23[_0x1019('0x15')]()+_0x1019('0x5e'),_0x34f4ba[_0x1019('0x1f')]);return getEndUser(_0x34f4ba,_0x28d918,_0x36e8bf,_0x4b5b10,_0x34e722,_0x394c23,_0x2c6e3a[_0x1019('0x5f')],_0x2c6e3a['additionalSearchContact']);})[_0x1019('0x12')](function(_0x2e676c){logger[_0x1019('0x22')]('['+_0x394c23[_0x1019('0x15')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2e676c[_0x1019('0x37')]);logger[_0x1019('0x22')]('['+_0x394c23[_0x1019('0x15')]()+_0x1019('0x60'),_0x34e722[_0x1019('0x28')]);return getTicket(_0x2e676c,_0x28d918,_0x36e8bf,_0x4b5b10,_0x34e722,_0x2c6e3a,_0x394c23);})['then'](function(_0x227973){logger[_0x1019('0x22')](util[_0x1019('0x4e')]('['+_0x394c23[_0x1019('0x15')]()+_0x1019('0x61'),_0x2c6e3a['ticketType'],_0x227973[_0x1019('0x62')]));logger[_0x1019('0x22')](util[_0x1019('0x4e')]('['+_0x394c23[_0x1019('0x15')]()+_0x1019('0x63'),_0x394c23));if(_0x394c23!==_0x1019('0x53')&&_0x2c6e3a[_0x1019('0x64')]){logger[_0x1019('0x22')]('['+_0x394c23[_0x1019('0x15')]()+']',_0x1019('0x65'));emit(_0x28d918[_0x1019('0x8')],_0x12c80f[_0x1019('0x66')],_0x2c6e3a[_0x1019('0x41')],_0x227973['ticketId']);}})['catch'](function(_0x4b4b94){logger['error']('['+_0x394c23['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x4b4b94[_0x1019('0x17')]);console[_0x1019('0x67')]('Error\x20running\x20Dynamics365\x20integration',_0x4b4b94);});}; \ 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 a5a5fd0..2a8e9bd 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 _0x6858=['variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','./util','defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','keyBy','value','then','validateEmail','%s/api/v2/agents','remoteUri','Agent\x20found!','find','contact','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push'];(function(_0x50bcf4,_0x1c23cf){var _0xd99f7=function(_0xa8fd6d){while(--_0xa8fd6d){_0x50bcf4['push'](_0x50bcf4['shift']());}};_0xd99f7(++_0x1c23cf);}(_0x6858,0x7b));var _0x8685=function(_0x282627,_0xe8e72c){_0x282627=_0x282627-0x0;var _0x5bc21f=_0x6858[_0x282627];return _0x5bc21f;};'use strict';var _=require(_0x8685('0x0'));var rp=require(_0x8685('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x8685('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshdesk');config['redis']=_[_0x8685('0x3')](config[_0x8685('0x4')],{'host':_0x8685('0x5'),'port':0x18eb});var io=require(_0x8685('0x6'))(new Redis(config[_0x8685('0x4')]));var headers={'Content-Type':'application/json','Accept':_0x8685('0x7')};function emit(_0x3a9004,_0x4659e6,_0x89100){io['to'](_0x3a9004)[_0x8685('0x8')](_0x4659e6,_0x89100);}function getTicket(_0x17c028,_0x57f12f,_0x83cf27,_0x1c85f9,_0x30249c){logger[_0x8685('0x9')](_0x8685('0xa'));var _0x2212b2=_['merge']({'responder_id':_0x57f12f['id'],'requester_id':_0x83cf27['id'],'name':util[_0x8685('0xb')](_0x8685('0xc'),_0x30249c[_0x8685('0xd')]),'phone':_0x30249c[_0x8685('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8685('0xf')](_0x1c85f9[_0x8685('0x10')],_0x30249c,'\x20'),'description':intUtil[_0x8685('0xf')](_0x1c85f9[_0x8685('0x11')],_0x30249c,_0x8685('0x12')),'tags':getTags(_0x1c85f9[_0x8685('0x13')],'name')},getCustomFields(_0x1c85f9[_0x8685('0x14')],_0x30249c));_0x2212b2[_0x8685('0x15')]=_['mapValues'](_[_0x8685('0x16')](_0x2212b2[_0x8685('0x15')],'id'),_0x8685('0x17'));return request({'uri':util[_0x8685('0xb')]('%s/api/v2/tickets',_0x17c028['remoteUri']),'method':'POST','body':_0x2212b2})[_0x8685('0x18')](function(_0x1617c1){logger[_0x8685('0x9')]('Ticket\x20created!');return _0x1617c1;});}function getUser(_0x21e54b,_0x17fce7){if(intUtil[_0x8685('0x19')](_0x17fce7)){return request({'uri':util[_0x8685('0xb')](_0x8685('0x1a'),_0x21e54b[_0x8685('0x1b')]),'qs':{'email':_0x17fce7}})[_0x8685('0x18')](function(_0x436bcb){if(_0x436bcb['length']){logger[_0x8685('0x9')](_0x8685('0x1c'));return _[_0x8685('0x1d')](_0x436bcb,function(_0x4362b0){return _0x4362b0[_0x8685('0x1e')][_0x8685('0x1f')]===_0x17fce7;});}else{logger[_0x8685('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8685('0xb')]('%s/api/v2/agents/me',_0x21e54b[_0x8685('0x1b')])})[_0x8685('0x18')](function(_0x1dcb14){logger[_0x8685('0x9')](_0x8685('0x20'));return _0x1dcb14;});}});}else{logger['info'](_0x8685('0x21'));return request({'uri':util[_0x8685('0xb')]('%s/api/v2/agents/me',_0x21e54b['remoteUri'])})[_0x8685('0x18')](function(_0xb61cb3){logger[_0x8685('0x9')](_0x8685('0x20'));return _0xb61cb3;});}}function getEndUser(_0x5a5fc2,_0x14bb60,_0x1a5357){logger['info'](_0x8685('0x22'),_0x1a5357);return request({'uri':util['format']('%s/api/v2/contacts',_0x5a5fc2[_0x8685('0x1b')]),'qs':{'phone':_0x1a5357}})['then'](function(_0x56ed85){if(_0x56ed85[_0x8685('0x23')]){logger['info']('Enduser\x20found!');return _[_0x8685('0x1d')](_0x56ed85,{'phone':_0x1a5357});}else{logger[_0x8685('0x9')](_0x8685('0x24'));return request({'uri':util['format'](_0x8685('0x25'),_0x5a5fc2[_0x8685('0x1b')]),'method':_0x8685('0x26'),'body':{'name':_0x14bb60,'phone':_0x1a5357}})[_0x8685('0x18')](function(_0x3c7e63){logger['info']('Enduser\x20created.');return _0x3c7e63;});}});}function getAuth(_0x671a48){return util[_0x8685('0xb')](_0x8685('0x27'),new Buffer(_0x671a48[_0x8685('0x28')]+':X')[_0x8685('0x29')](_0x8685('0x2a')));}function request(_0x5ba6d5){logger[_0x8685('0x2b')](_0x8685('0x2c'),JSON[_0x8685('0x2d')](_0x5ba6d5));return rp(_[_0x8685('0x3')](_0x5ba6d5,{'method':_0x8685('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x16660e,_0x556241){var _0x33106c=[];if(_0x16660e&&_0x16660e[_0x8685('0x23')]>0x0){_0x33106c=_[_0x8685('0x2f')](_0x16660e,_0x556241);}return _0x33106c;}function getCustomFields(_0x384b9d,_0x47d559){var _0x57900f=[];var _0xc91ce2={'custom_fields':[]};if(_0x384b9d[_0x8685('0x23')]>0x0){_[_0x8685('0x30')](_0x384b9d,function(_0x26d16d){if(_[_0x8685('0x31')]([_0x8685('0x32'),_0x8685('0x33')],_0x26d16d[_0x8685('0x34')])&&_0x26d16d[_0x8685('0x35')]&&!_0x26d16d[_0x8685('0x36')]){_0xc91ce2[_0x26d16d[_0x8685('0x35')][_0x8685('0x37')]()]=_0x26d16d[_0x8685('0x38')][_0x8685('0x29')]();}else if(_['includes']([_0x8685('0x32'),_0x8685('0x33')],_0x26d16d[_0x8685('0x34')])&&_0x26d16d[_0x8685('0x39')]&&_0x26d16d[_0x8685('0x36')]){_0xc91ce2[_0x8685('0x15')][_0x8685('0x3a')]({'id':_0x26d16d['idField'],'value':_0x26d16d['content']['toString']()});}else if(_0x26d16d[_0x8685('0x34')]===_0x8685('0x3b')&&_0x26d16d['variableName']&&_0x26d16d[_0x8685('0x39')]&&_0x26d16d[_0x8685('0x36')]){_0x47d559[_0x26d16d[_0x8685('0x3c')]]&&_0xc91ce2[_0x8685('0x15')][_0x8685('0x3a')]({'id':_0x26d16d[_0x8685('0x39')],'value':_0x47d559[_0x26d16d['variableName']][_0x8685('0x29')]()});}else if(_0x26d16d[_0x8685('0x34')]===_0x8685('0x3d')&&_0x26d16d[_0x8685('0x3e')]&&_0x26d16d[_0x8685('0x3e')]['name']&&_0x26d16d[_0x8685('0x39')]&&_0x26d16d[_0x8685('0x36')]){_0x47d559[_0x26d16d[_0x8685('0x3e')][_0x8685('0x3f')][_0x8685('0x37')]()]&&_0xc91ce2[_0x8685('0x15')]['push']({'id':_0x26d16d[_0x8685('0x39')],'value':_0x47d559[_0x26d16d[_0x8685('0x3e')][_0x8685('0x3f')][_0x8685('0x37')]()][_0x8685('0x29')]()});}});}return _0xc91ce2;}exports[_0x8685('0x40')]=function(_0x3ae010,_0x3b4774,_0xdc15a8,_0x1ac677,_0x2ac19b,_0x5b94b1){var _0x22ceae,_0x2d644e;_0x5b94b1[_0x8685('0x1b')]=intUtil[_0x8685('0x41')](_0x5b94b1[_0x8685('0x1b')]);_0x5b94b1[_0x8685('0x42')]=intUtil[_0x8685('0x41')](_0x5b94b1[_0x8685('0x42')]);if(_0x2ac19b&&_0x2ac19b[_0x8685('0x43')]){logger[_0x8685('0x9')](_0x8685('0x44'),'Recording\x20is\x20enabled!');_0x3b4774[_0x8685('0x45')]=util[_0x8685('0xb')](_0x8685('0x46'),_0x5b94b1['serverUrl'],_0x3b4774[_0x8685('0x47')],md5(_0x3b4774[_0x8685('0x47')]));}else{_0x3b4774[_0x8685('0x45')]='';}headers[_0x8685('0x48')]=getAuth(_0x5b94b1);return getUser(_0x5b94b1,_0x1ac677[_0x8685('0x1f')])['then'](function(_0x23c271){_0x22ceae=_0x23c271;logger[_0x8685('0x9')]('The\x20User\x20ID\x20is:',_0x22ceae['id']);return getEndUser(_0x5b94b1,_0x3b4774[_0x8685('0xd')],_0x3b4774['calleridnum']);})[_0x8685('0x18')](function(_0x108853){_0x2d644e=_0x108853;logger[_0x8685('0x9')](_0x8685('0x49'),_0x2d644e['id']);return getTicket(_0x5b94b1,_0x22ceae,_0x2d644e,_0xdc15a8,_0x3b4774);})[_0x8685('0x18')](function(_0x5f3b74){if(_0x5f3b74&&_0x5f3b74['id']){logger[_0x8685('0x9')](_0x8685('0x4a'));logger[_0x8685('0x9')](_0x8685('0x4b'),_0x5f3b74['id']);logger['info'](_0x8685('0x44'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8685('0xb')](_0x8685('0x4c'),_0x1ac677[_0x8685('0x3f')]),'trigger:browser:url',{'uri':util['format'](_0x8685('0x4d'),_0x5b94b1['remoteUri'],_0x5f3b74['id'])});}})[_0x8685('0x4e')](function(_0x49f415){logger[_0x8685('0x4f')](_0x8685('0x44'),JSON[_0x8685('0x2d')](_0x49f415));});};exports[_0x8685('0x50')]=function(_0x57dcd8,_0x264c3a,_0x48a3f3,_0x266d65,_0x39feea,_0x52a47a,_0x4e1719){var _0x74409d,_0x1b3066;_0x52a47a[_0x8685('0x1b')]=intUtil[_0x8685('0x41')](_0x52a47a['remoteUri']);_0x52a47a[_0x8685('0x42')]=intUtil['stripTrailingSlash'](_0x52a47a[_0x8685('0x42')]);if(_0x4e1719&&_0x4e1719[_0x8685('0x51')]&&_0x4e1719[_0x8685('0x51')]!==_0x8685('0x52')){logger[_0x8685('0x9')]('[OUTBOUND]',_0x8685('0x53'));_0x264c3a['recordingURL']=util[_0x8685('0xb')](_0x8685('0x46'),_0x52a47a[_0x8685('0x42')],_0x264c3a[_0x8685('0x47')],md5(_0x264c3a[_0x8685('0x47')]));}headers['Authorization']=getAuth(_0x52a47a);return getUser(_0x52a47a,_0x266d65[_0x8685('0x1f')])[_0x8685('0x18')](function(_0xd88043){_0x74409d=_0xd88043;logger[_0x8685('0x9')](_0x8685('0x54'),_0x74409d['id']);return getEndUser(_0x52a47a,_0x264c3a[_0x8685('0x55')],_0x264c3a['destcalleridnum']);})[_0x8685('0x18')](function(_0x4ed9ce){_0x1b3066=_0x4ed9ce;logger['info'](_0x8685('0x49'),_0x1b3066['id']);return getTicket(_0x52a47a,_0x74409d,_0x1b3066,_0x48a3f3,_0x264c3a);})[_0x8685('0x18')](function(_0x24c062){if(_0x24c062&&_0x24c062['id']){logger[_0x8685('0x9')](_0x8685('0x4a'));logger[_0x8685('0x9')](_0x8685('0x4b'),_0x24c062['id']);logger[_0x8685('0x9')](_0x8685('0x56'),_0x8685('0x57'));emit(util[_0x8685('0xb')](_0x8685('0x4c'),_0x266d65[_0x8685('0x3f')]),'trigger:browser:url',{'uri':util[_0x8685('0xb')](_0x8685('0x4d'),_0x52a47a['remoteUri'],_0x24c062['id'])});}})[_0x8685('0x4e')](function(_0x3d12f8){logger['error'](_0x8685('0x56'),JSON['stringify'](_0x3d12f8));});};exports[_0x8685('0x58')]=function(_0x10a3ea,_0x184988,_0x1cadfb,_0x155709,_0x2c3515,_0x397fa7){var _0x2b78fd,_0x12f2fe;_0x397fa7[_0x8685('0x1b')]=intUtil[_0x8685('0x41')](_0x397fa7['remoteUri']);_0x397fa7[_0x8685('0x42')]=intUtil[_0x8685('0x41')](_0x397fa7[_0x8685('0x42')]);if(_0x2c3515&&_0x2c3515[_0x8685('0x43')]){logger[_0x8685('0x9')]('['+_0x184988[_0x8685('0x59')]['toUpperCase']()+']',_0x8685('0x53'));_0x184988[_0x8685('0x45')]=util[_0x8685('0xb')](_0x8685('0x46'),_0x397fa7['serverUrl'],_0x184988[_0x8685('0x47')],md5(_0x184988[_0x8685('0x47')]));}else{_0x184988[_0x8685('0x45')]='';}headers['Authorization']=getAuth(_0x397fa7);return getUser(_0x397fa7,'')[_0x8685('0x18')](function(_0x2c166d){_0x2b78fd=_0x2c166d;logger[_0x8685('0x9')](_0x8685('0x54'),_0x2b78fd['id']);return getEndUser(_0x397fa7,_0x184988[_0x8685('0xd')],_0x184988[_0x8685('0xe')]);})[_0x8685('0x18')](function(_0xb0beaa){_0x12f2fe=_0xb0beaa;logger[_0x8685('0x9')](_0x8685('0x49'),_0x12f2fe['id']);return getTicket(_0x397fa7,_0x2b78fd,_0x12f2fe,_0x1cadfb,_0x184988);})[_0x8685('0x18')](function(_0x2b605a){if(_0x2b605a){logger[_0x8685('0x9')](_0x8685('0x4a'));logger[_0x8685('0x9')](_0x8685('0x4b'),_0x2b605a['id']);}})['catch'](function(_0x6130ac){logger['error']('['+_0x184988['lastevent'][_0x8685('0x5a')]()+']',JSON[_0x8685('0x2d')](_0x6130ac));});}; \ No newline at end of file +var _0x6b5e=['%s/helpdesk/tickets/%d','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','user:%s','catch','unmanaged','toUpperCase','error','lastevent','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','info','Creating\x20new\x20ticket...','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','push','idField','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url'];(function(_0x4bd3b7,_0x16f13b){var _0x1b52d8=function(_0x16feff){while(--_0x16feff){_0x4bd3b7['push'](_0x4bd3b7['shift']());}};_0x1b52d8(++_0x16f13b);}(_0x6b5e,0x69));var _0xe6b5=function(_0x3b67b4,_0x13b797){_0x3b67b4=_0x3b67b4-0x0;var _0x2a6358=_0x6b5e[_0x3b67b4];return _0x2a6358;};'use strict';var _=require(_0xe6b5('0x0'));var rp=require(_0xe6b5('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xe6b5('0x2'));var intUtil=require(_0xe6b5('0x3'));var config=require(_0xe6b5('0x4'));var logger=require(_0xe6b5('0x5'))('freshdesk');config['redis']=_[_0xe6b5('0x6')](config[_0xe6b5('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x28b72d,_0x68f721,_0x301dd1){io['to'](_0x28b72d)['emit'](_0x68f721,_0x301dd1);}function getTicket(_0x18b3c0,_0x57bdbf,_0x7ea130,_0x56b543,_0x160ffa){logger[_0xe6b5('0x8')](_0xe6b5('0x9'));var _0x4684c5=_['merge']({'responder_id':_0x57bdbf['id'],'requester_id':_0x7ea130['id'],'name':util['format']('Caller\x20-\x20%s',_0x160ffa[_0xe6b5('0xa')]),'phone':_0x160ffa[_0xe6b5('0xb')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe6b5('0xc')](_0x56b543[_0xe6b5('0xd')],_0x160ffa,'\x20'),'description':intUtil[_0xe6b5('0xc')](_0x56b543[_0xe6b5('0xe')],_0x160ffa,_0xe6b5('0xf')),'tags':getTags(_0x56b543[_0xe6b5('0x10')],_0xe6b5('0x11'))},getCustomFields(_0x56b543['Fields'],_0x160ffa));_0x4684c5[_0xe6b5('0x12')]=_[_0xe6b5('0x13')](_[_0xe6b5('0x14')](_0x4684c5[_0xe6b5('0x12')],'id'),_0xe6b5('0x15'));return request({'uri':util[_0xe6b5('0x16')](_0xe6b5('0x17'),_0x18b3c0[_0xe6b5('0x18')]),'method':_0xe6b5('0x19'),'body':_0x4684c5})[_0xe6b5('0x1a')](function(_0x6dd557){logger['info'](_0xe6b5('0x1b'));return _0x6dd557;});}function getUser(_0x535008,_0x271f3f){if(intUtil[_0xe6b5('0x1c')](_0x271f3f)){return request({'uri':util['format']('%s/api/v2/agents',_0x535008['remoteUri']),'qs':{'email':_0x271f3f}})[_0xe6b5('0x1a')](function(_0x32fb87){if(_0x32fb87[_0xe6b5('0x1d')]){logger[_0xe6b5('0x8')](_0xe6b5('0x1e'));return _[_0xe6b5('0x1f')](_0x32fb87,function(_0x29ec2e){return _0x29ec2e[_0xe6b5('0x20')][_0xe6b5('0x21')]===_0x271f3f;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe6b5('0x16')](_0xe6b5('0x22'),_0x535008[_0xe6b5('0x18')])})['then'](function(_0x1b10cb){logger[_0xe6b5('0x8')]('Admin\x20account\x20selected.');return _0x1b10cb;});}});}else{logger[_0xe6b5('0x8')](_0xe6b5('0x23'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x535008[_0xe6b5('0x18')])})[_0xe6b5('0x1a')](function(_0x187e6a){logger[_0xe6b5('0x8')](_0xe6b5('0x24'));return _0x187e6a;});}}function getEndUser(_0x586cf2,_0x2a75d0,_0x1027bf){logger['info'](_0xe6b5('0x25'),_0x1027bf);return request({'uri':util[_0xe6b5('0x16')](_0xe6b5('0x26'),_0x586cf2[_0xe6b5('0x18')]),'qs':{'phone':_0x1027bf}})[_0xe6b5('0x1a')](function(_0x3dfc7b){if(_0x3dfc7b[_0xe6b5('0x1d')]){logger[_0xe6b5('0x8')](_0xe6b5('0x27'));return _[_0xe6b5('0x1f')](_0x3dfc7b,{'phone':_0x1027bf});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xe6b5('0x16')](_0xe6b5('0x26'),_0x586cf2[_0xe6b5('0x18')]),'method':_0xe6b5('0x19'),'body':{'name':_0x2a75d0,'phone':_0x1027bf}})[_0xe6b5('0x1a')](function(_0x2fb4f6){logger['info'](_0xe6b5('0x28'));return _0x2fb4f6;});}});}function getAuth(_0x3ae081){return util[_0xe6b5('0x16')]('Basic\x20%s',new Buffer(_0x3ae081[_0xe6b5('0x29')]+':X')[_0xe6b5('0x2a')](_0xe6b5('0x2b')));}function request(_0x1c9762){logger[_0xe6b5('0x2c')](_0xe6b5('0x2d'),JSON[_0xe6b5('0x2e')](_0x1c9762));return rp(_[_0xe6b5('0x6')](_0x1c9762,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2dc098,_0x44a601){var _0x3f5b88=[];if(_0x2dc098&&_0x2dc098[_0xe6b5('0x1d')]>0x0){_0x3f5b88=_[_0xe6b5('0x2f')](_0x2dc098,_0x44a601);}return _0x3f5b88;}function getCustomFields(_0x2477b5,_0x2accbb){var _0x463b00=[];var _0x1310b5={'custom_fields':[]};if(_0x2477b5[_0xe6b5('0x1d')]>0x0){_[_0xe6b5('0x30')](_0x2477b5,function(_0x4c45b0){if(_[_0xe6b5('0x31')]([_0xe6b5('0x32'),_0xe6b5('0x33')],_0x4c45b0[_0xe6b5('0x34')])&&_0x4c45b0[_0xe6b5('0x35')]&&!_0x4c45b0[_0xe6b5('0x36')]){_0x1310b5[_0x4c45b0[_0xe6b5('0x35')][_0xe6b5('0x37')]()]=_0x4c45b0[_0xe6b5('0x38')][_0xe6b5('0x2a')]();}else if(_[_0xe6b5('0x31')]([_0xe6b5('0x32'),_0xe6b5('0x33')],_0x4c45b0[_0xe6b5('0x34')])&&_0x4c45b0['idField']&&_0x4c45b0[_0xe6b5('0x36')]){_0x1310b5[_0xe6b5('0x12')][_0xe6b5('0x39')]({'id':_0x4c45b0[_0xe6b5('0x3a')],'value':_0x4c45b0[_0xe6b5('0x38')][_0xe6b5('0x2a')]()});}else if(_0x4c45b0[_0xe6b5('0x34')]==='variable'&&_0x4c45b0[_0xe6b5('0x3b')]&&_0x4c45b0[_0xe6b5('0x3a')]&&_0x4c45b0[_0xe6b5('0x36')]){_0x2accbb[_0x4c45b0['variableName']]&&_0x1310b5[_0xe6b5('0x12')][_0xe6b5('0x39')]({'id':_0x4c45b0[_0xe6b5('0x3a')],'value':_0x2accbb[_0x4c45b0[_0xe6b5('0x3b')]][_0xe6b5('0x2a')]()});}else if(_0x4c45b0[_0xe6b5('0x34')]===_0xe6b5('0x3c')&&_0x4c45b0[_0xe6b5('0x3d')]&&_0x4c45b0['Variable'][_0xe6b5('0x11')]&&_0x4c45b0['idField']&&_0x4c45b0[_0xe6b5('0x36')]){_0x2accbb[_0x4c45b0['Variable'][_0xe6b5('0x11')]['toLowerCase']()]&&_0x1310b5['custom_fields'][_0xe6b5('0x39')]({'id':_0x4c45b0['idField'],'value':_0x2accbb[_0x4c45b0[_0xe6b5('0x3d')][_0xe6b5('0x11')][_0xe6b5('0x37')]()][_0xe6b5('0x2a')]()});}});}return _0x1310b5;}exports[_0xe6b5('0x3e')]=function(_0x2b069e,_0x195b54,_0x304480,_0x13356c,_0x210db9,_0x3ed193){var _0x16d4b5,_0x48abb6;_0x3ed193[_0xe6b5('0x18')]=intUtil[_0xe6b5('0x3f')](_0x3ed193['remoteUri']);_0x3ed193[_0xe6b5('0x40')]=intUtil[_0xe6b5('0x3f')](_0x3ed193[_0xe6b5('0x40')]);if(_0x210db9&&_0x210db9[_0xe6b5('0x41')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x195b54[_0xe6b5('0x42')]=util[_0xe6b5('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ed193['serverUrl'],_0x195b54[_0xe6b5('0x43')],md5(_0x195b54['uniqueid']));}else{_0x195b54[_0xe6b5('0x42')]='';}headers[_0xe6b5('0x44')]=getAuth(_0x3ed193);return getUser(_0x3ed193,_0x13356c[_0xe6b5('0x21')])[_0xe6b5('0x1a')](function(_0x51d45d){_0x16d4b5=_0x51d45d;logger['info'](_0xe6b5('0x45'),_0x16d4b5['id']);return getEndUser(_0x3ed193,_0x195b54[_0xe6b5('0xa')],_0x195b54[_0xe6b5('0xb')]);})[_0xe6b5('0x1a')](function(_0x4d84a2){_0x48abb6=_0x4d84a2;logger[_0xe6b5('0x8')](_0xe6b5('0x46'),_0x48abb6['id']);return getTicket(_0x3ed193,_0x16d4b5,_0x48abb6,_0x304480,_0x195b54);})[_0xe6b5('0x1a')](function(_0x3ff915){if(_0x3ff915&&_0x3ff915['id']){logger[_0xe6b5('0x8')](_0xe6b5('0x1b'));logger[_0xe6b5('0x8')](_0xe6b5('0x47'),_0x3ff915['id']);logger['info'](_0xe6b5('0x48'),_0xe6b5('0x49'));emit(util[_0xe6b5('0x16')]('user:%s',_0x13356c['name']),_0xe6b5('0x4a'),{'uri':util[_0xe6b5('0x16')](_0xe6b5('0x4b'),_0x3ed193[_0xe6b5('0x18')],_0x3ff915['id'])});}})['catch'](function(_0x3d1f65){logger['error'](_0xe6b5('0x48'),JSON[_0xe6b5('0x2e')](_0x3d1f65));});};exports[_0xe6b5('0x4c')]=function(_0x194140,_0x311f4c,_0x3282bf,_0x1e2e21,_0x50a357,_0x3c4e20,_0x2072f1){var _0x319c57,_0xf63fa3;_0x3c4e20[_0xe6b5('0x18')]=intUtil[_0xe6b5('0x3f')](_0x3c4e20['remoteUri']);_0x3c4e20[_0xe6b5('0x40')]=intUtil[_0xe6b5('0x3f')](_0x3c4e20[_0xe6b5('0x40')]);if(_0x2072f1&&_0x2072f1[_0xe6b5('0x4d')]&&_0x2072f1[_0xe6b5('0x4d')]!==_0xe6b5('0x4e')){logger['info'](_0xe6b5('0x4f'),_0xe6b5('0x50'));_0x311f4c[_0xe6b5('0x42')]=util[_0xe6b5('0x16')](_0xe6b5('0x51'),_0x3c4e20[_0xe6b5('0x40')],_0x311f4c[_0xe6b5('0x43')],md5(_0x311f4c[_0xe6b5('0x43')]));}headers[_0xe6b5('0x44')]=getAuth(_0x3c4e20);return getUser(_0x3c4e20,_0x1e2e21[_0xe6b5('0x21')])['then'](function(_0x5362ac){_0x319c57=_0x5362ac;logger['info'](_0xe6b5('0x45'),_0x319c57['id']);return getEndUser(_0x3c4e20,_0x311f4c[_0xe6b5('0x52')],_0x311f4c[_0xe6b5('0x53')]);})[_0xe6b5('0x1a')](function(_0x3c657e){_0xf63fa3=_0x3c657e;logger[_0xe6b5('0x8')](_0xe6b5('0x46'),_0xf63fa3['id']);return getTicket(_0x3c4e20,_0x319c57,_0xf63fa3,_0x3282bf,_0x311f4c);})[_0xe6b5('0x1a')](function(_0x4ef983){if(_0x4ef983&&_0x4ef983['id']){logger[_0xe6b5('0x8')]('Ticket\x20created!');logger[_0xe6b5('0x8')](_0xe6b5('0x47'),_0x4ef983['id']);logger['info'](_0xe6b5('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe6b5('0x16')](_0xe6b5('0x54'),_0x1e2e21['name']),'trigger:browser:url',{'uri':util[_0xe6b5('0x16')](_0xe6b5('0x4b'),_0x3c4e20['remoteUri'],_0x4ef983['id'])});}})[_0xe6b5('0x55')](function(_0x69ddd6){logger['error'](_0xe6b5('0x4f'),JSON['stringify'](_0x69ddd6));});};exports[_0xe6b5('0x56')]=function(_0x59914f,_0x224c50,_0x320c30,_0xec72e0,_0x40c227,_0x4c66e5){var _0x39130f,_0x1de2ec;_0x4c66e5[_0xe6b5('0x18')]=intUtil[_0xe6b5('0x3f')](_0x4c66e5[_0xe6b5('0x18')]);_0x4c66e5[_0xe6b5('0x40')]=intUtil[_0xe6b5('0x3f')](_0x4c66e5[_0xe6b5('0x40')]);if(_0x40c227&&_0x40c227['monitor_format']){logger[_0xe6b5('0x8')]('['+_0x224c50['lastevent'][_0xe6b5('0x57')]()+']',_0xe6b5('0x50'));_0x224c50['recordingURL']=util[_0xe6b5('0x16')](_0xe6b5('0x51'),_0x4c66e5[_0xe6b5('0x40')],_0x224c50[_0xe6b5('0x43')],md5(_0x224c50['uniqueid']));}else{_0x224c50['recordingURL']='';}headers[_0xe6b5('0x44')]=getAuth(_0x4c66e5);return getUser(_0x4c66e5,'')[_0xe6b5('0x1a')](function(_0x4d682b){_0x39130f=_0x4d682b;logger[_0xe6b5('0x8')](_0xe6b5('0x45'),_0x39130f['id']);return getEndUser(_0x4c66e5,_0x224c50[_0xe6b5('0xa')],_0x224c50[_0xe6b5('0xb')]);})[_0xe6b5('0x1a')](function(_0x5b7492){_0x1de2ec=_0x5b7492;logger[_0xe6b5('0x8')](_0xe6b5('0x46'),_0x1de2ec['id']);return getTicket(_0x4c66e5,_0x39130f,_0x1de2ec,_0x320c30,_0x224c50);})[_0xe6b5('0x1a')](function(_0x20782c){if(_0x20782c){logger[_0xe6b5('0x8')](_0xe6b5('0x1b'));logger[_0xe6b5('0x8')](_0xe6b5('0x47'),_0x20782c['id']);}})[_0xe6b5('0x55')](function(_0xeea907){logger[_0xe6b5('0x58')]('['+_0x224c50[_0xe6b5('0x59')]['toUpperCase']()+']',JSON[_0xe6b5('0x2e')](_0xeea907));});}; \ 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 cb5ba93..90fc267 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 _0xd2e0=['Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','apiKey','remoteUri','toLowerCase','outbound','destcalleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','email','userId','User\x20found:','Admin\x20selected','userEmail','&entities=contact','find','contacts','format'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xd2e0,0x1ed));var _0x0d2e=function(_0x3c984f,_0x3ae1a9){_0x3c984f=_0x3c984f-0x0;var _0x59084f=_0xd2e0[_0x3c984f];return _0x59084f;};'use strict';var _=require(_0x0d2e('0x0'));var rp=require(_0x0d2e('0x1'));var md5=require('md5');var util=require(_0x0d2e('0x2'));var moment=require(_0x0d2e('0x3'));var Promise=require(_0x0d2e('0x4'));var Redis=require('ioredis');var intUtil=require(_0x0d2e('0x5'));var config=require(_0x0d2e('0x6'));var logger=require(_0x0d2e('0x7'))(_0x0d2e('0x8'));config['redis']=_[_0x0d2e('0x9')](config[_0x0d2e('0xa')],{'host':_0x0d2e('0xb'),'port':0x18eb});var io=require(_0x0d2e('0xc'))(new Redis(config[_0x0d2e('0xa')]));function getAdminId(_0xf46dd0,_0x542380,_0x18dfbb,_0x523b92){return new Promise(function(_0x3418fa,_0x159953){var _0x1ad2f3=![];var _0x4c8e11={'method':_0x0d2e('0xd'),'uri':_0x523b92+_0x0d2e('0xe'),'json':!![]};_0x4c8e11[_0x0d2e('0xf')]=_0x18dfbb;logger['info'](_0x0d2e('0x10'));return rp(_0x4c8e11)[_0x0d2e('0x11')](function(_0x1713b3){if(_0x1713b3){var _0x51f6b1=_0x1713b3[_0x0d2e('0x12')];var _0x14f8cb=null;for(_0x14f8cb=0x0;_0x14f8cb<_0x51f6b1[_0x0d2e('0x13')];_0x14f8cb++){if(_0x51f6b1[_0x14f8cb]['email']===_0xf46dd0[_0x0d2e('0x14')]){_0xf46dd0[_0x0d2e('0x15')]=_0x51f6b1[_0x14f8cb]['id'];_0x1ad2f3=!![];}}if(_0x1ad2f3){logger[_0x0d2e('0x16')](_0x0d2e('0x17'),_0xf46dd0[_0x0d2e('0x15')]);_0x3418fa(_0xf46dd0);}else{_0x159953({'statusCode':0x194,'message':_0x0d2e('0x18')});}}else{_0x159953({'statusCode':0x194,'message':_0x0d2e('0x18')});}})[_0x0d2e('0x19')](function(_0xc262bf){logger[_0x0d2e('0x1a')]('['+[_0x542380[_0x0d2e('0x1b')]()]+']',_0xc262bf[_0x0d2e('0x1c')]);_0x159953(_0xc262bf);});});}function getUser(_0x55867f,_0x1b1ebb,_0x444469){return function(_0x2592f0){return new Promise(function(_0x2b2ed1,_0x5a7948){var _0x477cb4={'method':_0x0d2e('0xd'),'uri':_0x444469+_0x0d2e('0xe'),'json':!![]};_0x477cb4['headers']=_0x1b1ebb;logger['info'](_0x0d2e('0x1d'));return rp(_0x477cb4)[_0x0d2e('0x11')](function(_0x47b79c){if(_0x47b79c){var _0x545d54=_0x47b79c[_0x0d2e('0x12')];var _0x2dd606=![];var _0x4e65f0=null;if(_0x2592f0['agentEmail']!==null){logger[_0x0d2e('0x16')](_0x0d2e('0x1e'),_0x2592f0['agentEmail']);_0x2592f0['userEmail']=_0x2592f0[_0x0d2e('0x1f')];for(_0x4e65f0=0x0;_0x4e65f0<_0x545d54[_0x0d2e('0x13')];_0x4e65f0++){if(_0x545d54[_0x4e65f0][_0x0d2e('0x20')]===_0x2592f0[_0x0d2e('0x1f')]){_0x2dd606=!![];_0x2592f0[_0x0d2e('0x21')]=_0x545d54[_0x4e65f0]['id'];logger[_0x0d2e('0x16')](_0x0d2e('0x22'),_0x2592f0[_0x0d2e('0x21')]);}}}if(!_0x2dd606){logger[_0x0d2e('0x16')](_0x0d2e('0x23'));_0x2592f0[_0x0d2e('0x24')]=_0x2592f0[_0x0d2e('0x14')];_0x2592f0[_0x0d2e('0x21')]=_0x2592f0[_0x0d2e('0x15')];_0x2dd606=!![];}if(_0x2dd606){_0x2b2ed1(_0x2592f0);}else{_0x5a7948({'statusCode':0x194,'message':_0x0d2e('0x18')});}}else{_0x5a7948({'statusCode':0x194,'message':_0x0d2e('0x18')});}})[_0x0d2e('0x19')](function(_0x3e7227){logger[_0x0d2e('0x1a')]('['+[_0x55867f[_0x0d2e('0x1b')]()]+']',_0x3e7227['message']);_0x5a7948(_0x3e7227);});});};}function searchContact(_0x56ad9e,_0x2a183a,_0x2e810f,_0x29f9a3){return new Promise(function(_0x3b3470,_0x5cc0aa){var _0x1e754c={'method':_0x0d2e('0xd'),'headers':_0x2a183a,'uri':_0x56ad9e+'/api/lookup?q='+_0x29f9a3+'&f='+_0x2e810f+_0x0d2e('0x25'),'json':!![]};rp(_0x1e754c)['then'](function(_0x33285c){var _0x3ab8eb=_[_0x0d2e('0x26')](_0x33285c[_0x0d2e('0x27')][_0x0d2e('0x27')],[_0x2e810f,_0x29f9a3]);_0x3b3470(_0x3ab8eb);})[_0x0d2e('0x19')](function(_0x44d048){_0x5cc0aa(_0x44d048);});});}function getEndUser(_0x517805,_0x46dba9,_0x1825f3){return function(_0x5a26de){return new Promise(function(_0x32441a,_0x2aaca4){logger[_0x0d2e('0x16')](util[_0x0d2e('0x28')](_0x0d2e('0x29'),_0x5a26de[_0x0d2e('0x2a')]));searchContact(_0x1825f3,_0x46dba9,_0x0d2e('0x2b'),_0x5a26de[_0x0d2e('0x2a')])['then'](function(_0x5502b5){if(_0x5502b5){_0x5a26de[_0x0d2e('0x2c')]=_0x5502b5['id'];logger[_0x0d2e('0x16')](_0x0d2e('0x2d'),_0x5a26de[_0x0d2e('0x2c')]);return _0x32441a(_0x5a26de);}searchContact(_0x1825f3,_0x46dba9,_0x0d2e('0x2e'),_0x5a26de[_0x0d2e('0x2a')])[_0x0d2e('0x11')](function(_0x487a01){if(_0x487a01){_0x5a26de[_0x0d2e('0x2c')]=_0x487a01['id'];logger[_0x0d2e('0x16')](_0x0d2e('0x2f'),_0x5a26de[_0x0d2e('0x2c')]);return _0x32441a(_0x5a26de);}createEndUser(_0x5a26de,_0x517805,_0x46dba9,_0x1825f3)[_0x0d2e('0x11')](function(_0x1ad309){logger[_0x0d2e('0x16')](_0x0d2e('0x30'),_0x1ad309['endUserId']);return _0x32441a(_0x1ad309);});});})['catch'](function(_0x281f98){_0x2aaca4(_0x281f98);});});};}function createEndUser(_0xcf5dfc,_0x1b812f,_0x42aed2,_0x2071a2){return new Promise(function(_0x24e42a,_0x1bc356){var _0xc24442=moment();var _0x4dc928={'method':_0x0d2e('0x31'),'uri':_0x2071a2+_0x0d2e('0x32'),'body':{'contact':{'last_name':_0xcf5dfc[_0x0d2e('0x2a')],'work_number':_0xcf5dfc['contactNumber'],'mobile_number':_0xcf5dfc[_0x0d2e('0x2a')],'owner_id':_0xcf5dfc[_0x0d2e('0x21')],'created_at':_0xc24442[_0x0d2e('0x28')](_0x0d2e('0x33'))}},'json':!![]};_0x4dc928[_0x0d2e('0xf')]=_0x42aed2;logger[_0x0d2e('0x16')](_0x0d2e('0x34'));return rp(_0x4dc928)[_0x0d2e('0x11')](function(_0x59d6e2){_0xcf5dfc[_0x0d2e('0x2c')]=_0x59d6e2[_0x0d2e('0x35')]['id'];_0x24e42a(_0xcf5dfc);})['catch'](function(_0x28cafb){logger['error']('['+[_0x1b812f[_0x0d2e('0x1b')]()]+']',_0x28cafb[_0x0d2e('0x1c')]);_0x1bc356(_0x28cafb[_0x0d2e('0x1c')]);});});}function getTicket(_0x537862,_0x3f6b42,_0x4cf08d,_0x413cec,_0x2bb932){return function(_0x26a390){logger[_0x0d2e('0x16')](_0x0d2e('0x36'));return new Promise(function(_0x27bb0f,_0x236040){var _0x249f40=moment();var _0x575fb0={'method':_0x0d2e('0x31'),'uri':_0x4cf08d+_0x0d2e('0x37'),'body':{'title':intUtil[_0x0d2e('0x38')](_0x413cec[_0x0d2e('0x39')],_0x2bb932,'\x20'),'description':intUtil[_0x0d2e('0x38')](_0x413cec[_0x0d2e('0x3a')],_0x2bb932,'\x0a'),'owner_id':_0x26a390[_0x0d2e('0x21')],'creater_id':_0x26a390[_0x0d2e('0x15')],'targetable_id':_0x26a390['endUserId'],'targetable_type':_0x0d2e('0x3b'),'created_at':_0x249f40[_0x0d2e('0x28')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x249f40['add'](0x1e,'m')[_0x0d2e('0x28')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x575fb0[_0x0d2e('0xf')]=_0x3f6b42;return rp(_0x575fb0)[_0x0d2e('0x11')](function(_0xaccb8b){_0x26a390['ticketId']=_0xaccb8b[_0x0d2e('0x3c')]['id'];logger['info'](_0x0d2e('0x3d'),_0x26a390[_0x0d2e('0x3e')]);_0x27bb0f(_0x26a390);})[_0x0d2e('0x19')](function(_0x53a64a){logger['error']('['+[_0x537862['toUpperCase']()]+']',_0x53a64a['message']);_0x236040(_0x53a64a[_0x0d2e('0x1c')]);});});};}function emit(_0x440c4c,_0x2bc6a2,_0x5e9e5d){var _0x146be0={'uri':_0x440c4c+_0x0d2e('0x3f')+_0x5e9e5d};io['to'](util['format'](_0x0d2e('0x40'),_0x2bc6a2))[_0x0d2e('0x41')](_0x0d2e('0x42'),_0x146be0);}exports['cs']=function(_0x48ae98,_0x1d98c4,_0x1f2985,_0x596112,_0x1e51be,_0x411a71,_0x1f7ac6,_0x15d492){var _0x2da55b={};var _0x102cdc={'Authorization':'Token\x20token='+_0x411a71[_0x0d2e('0x43')]};_0x411a71[_0x0d2e('0x44')]=intUtil['stripTrailingSlash'](_0x411a71['remoteUri']);_0x411a71['serverUrl']=intUtil['stripTrailingSlash'](_0x411a71['serverUrl']);var _0x4c41fa=_0x411a71[_0x0d2e('0x44')];_0x2da55b[_0x0d2e('0x14')]=_0x411a71['username'];_0x2da55b[_0x0d2e('0x2a')]=_0x15d492[_0x0d2e('0x45')]()===_0x0d2e('0x46')?_0x1d98c4[_0x0d2e('0x47')]:_0x1d98c4['calleridnum'];_0x2da55b[_0x0d2e('0x48')]=_0x15d492==='queue'||_0x15d492===_0x0d2e('0x49')?_0x0d2e('0x4a'):_0x0d2e('0x46');if(_0x596112){_0x2da55b[_0x0d2e('0x1f')]=_0x596112['email'];}var _0xfcdf1=util[_0x0d2e('0x28')](_0x0d2e('0x4b'),_0x411a71[_0x0d2e('0x4c')],_0x1d98c4['uniqueid'],md5(_0x1d98c4[_0x0d2e('0x4d')]));if(_0x1e51be&&_0x1e51be[_0x0d2e('0x4e')]){logger['info'](_0x0d2e('0x4f'),_0x0d2e('0x50'));_0x1d98c4[_0x0d2e('0x51')]=_0xfcdf1;}else if(_0x1f7ac6&&_0x1f7ac6[_0x0d2e('0x52')]&&_0x1f7ac6[_0x0d2e('0x52')]!==_0x0d2e('0x53')){logger['info'](_0x0d2e('0x54'),'Recording\x20is\x20enabled!');_0x1d98c4[_0x0d2e('0x51')]=_0xfcdf1;}else{_0x1d98c4[_0x0d2e('0x51')]='';}return getAdminId(_0x2da55b,_0x15d492,_0x102cdc,_0x4c41fa)[_0x0d2e('0x11')](getUser(_0x15d492,_0x102cdc,_0x4c41fa))['then'](getEndUser(_0x15d492,_0x102cdc,_0x4c41fa))[_0x0d2e('0x11')](getTicket(_0x15d492,_0x102cdc,_0x4c41fa,_0x1f2985,_0x1d98c4))['then'](function(_0x4b5f2e){logger[_0x0d2e('0x16')](util[_0x0d2e('0x28')](_0x0d2e('0x55'),_0x4b5f2e['ticketId']));if(_0x15d492!==_0x0d2e('0x49')){logger[_0x0d2e('0x16')]('['+[_0x15d492[_0x0d2e('0x1b')]()]+']',_0x0d2e('0x56'));emit(_0x4c41fa,_0x596112[_0x0d2e('0x57')],_0x4b5f2e[_0x0d2e('0x2c')]);}})[_0x0d2e('0x19')](function(_0x416f9a){logger[_0x0d2e('0x1a')]('['+[_0x15d492[_0x0d2e('0x1b')]()]+_0x0d2e('0x58'),util['inspect'](_0x416f9a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4dfc=['inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','Admin\x20selected','userId','adminId','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','contactNumber','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','adminEmail','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration'];(function(_0x547cd9,_0x56bb46){var _0x47ec80=function(_0x3f2c6c){while(--_0x3f2c6c){_0x547cd9['push'](_0x547cd9['shift']());}};_0x47ec80(++_0x56bb46);}(_0x4dfc,0x151));var _0xc4df=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x4dfc[_0x318840];return _0x223da4;};'use strict';var _=require(_0xc4df('0x0'));var rp=require(_0xc4df('0x1'));var md5=require(_0xc4df('0x2'));var util=require(_0xc4df('0x3'));var moment=require(_0xc4df('0x4'));var Promise=require(_0xc4df('0x5'));var Redis=require(_0xc4df('0x6'));var intUtil=require(_0xc4df('0x7'));var config=require('../../../../config/environment');var logger=require(_0xc4df('0x8'))(_0xc4df('0x9'));config[_0xc4df('0xa')]=_[_0xc4df('0xb')](config[_0xc4df('0xa')],{'host':_0xc4df('0xc'),'port':0x18eb});var io=require(_0xc4df('0xd'))(new Redis(config[_0xc4df('0xa')]));function getAdminId(_0x4fe54a,_0x222b36,_0x29c978,_0x20bd50){return new Promise(function(_0x5651d4,_0xe64ffd){var _0x37c7d7=![];var _0xeed08={'method':_0xc4df('0xe'),'uri':_0x20bd50+_0xc4df('0xf'),'json':!![]};_0xeed08[_0xc4df('0x10')]=_0x29c978;logger[_0xc4df('0x11')](_0xc4df('0x12'));return rp(_0xeed08)['then'](function(_0x389965){if(_0x389965){var _0xdfcdcc=_0x389965[_0xc4df('0x13')];var _0x534df5=null;for(_0x534df5=0x0;_0x534df5<_0xdfcdcc[_0xc4df('0x14')];_0x534df5++){if(_0xdfcdcc[_0x534df5]['email']===_0x4fe54a['adminEmail']){_0x4fe54a['adminId']=_0xdfcdcc[_0x534df5]['id'];_0x37c7d7=!![];}}if(_0x37c7d7){logger[_0xc4df('0x11')](_0xc4df('0x15'),_0x4fe54a['adminId']);_0x5651d4(_0x4fe54a);}else{_0xe64ffd({'statusCode':0x194,'message':_0xc4df('0x16')});}}else{_0xe64ffd({'statusCode':0x194,'message':_0xc4df('0x16')});}})[_0xc4df('0x17')](function(_0x121e81){logger[_0xc4df('0x18')]('['+[_0x222b36[_0xc4df('0x19')]()]+']',_0x121e81[_0xc4df('0x1a')]);_0xe64ffd(_0x121e81);});});}function getUser(_0x11546e,_0x132cbc,_0x79fc0d){return function(_0x412951){return new Promise(function(_0x419e1a,_0x41021f){var _0x464aa5={'method':_0xc4df('0xe'),'uri':_0x79fc0d+'/api/selector/owners','json':!![]};_0x464aa5[_0xc4df('0x10')]=_0x132cbc;logger[_0xc4df('0x11')](_0xc4df('0x1b'));return rp(_0x464aa5)[_0xc4df('0x1c')](function(_0x5092ae){if(_0x5092ae){var _0x2846c7=_0x5092ae['users'];var _0x3979b7=![];var _0x243f68=null;if(_0x412951[_0xc4df('0x1d')]!==null){logger[_0xc4df('0x11')](_0xc4df('0x1e'),_0x412951['agentEmail']);_0x412951[_0xc4df('0x1f')]=_0x412951[_0xc4df('0x1d')];for(_0x243f68=0x0;_0x243f68<_0x2846c7[_0xc4df('0x14')];_0x243f68++){if(_0x2846c7[_0x243f68][_0xc4df('0x20')]===_0x412951[_0xc4df('0x1d')]){_0x3979b7=!![];_0x412951['userId']=_0x2846c7[_0x243f68]['id'];logger['info'](_0xc4df('0x21'),_0x412951['userId']);}}}if(!_0x3979b7){logger['info'](_0xc4df('0x22'));_0x412951['userEmail']=_0x412951['adminEmail'];_0x412951[_0xc4df('0x23')]=_0x412951[_0xc4df('0x24')];_0x3979b7=!![];}if(_0x3979b7){_0x419e1a(_0x412951);}else{_0x41021f({'statusCode':0x194,'message':_0xc4df('0x16')});}}else{_0x41021f({'statusCode':0x194,'message':_0xc4df('0x16')});}})[_0xc4df('0x17')](function(_0x57983e){logger[_0xc4df('0x18')]('['+[_0x11546e[_0xc4df('0x19')]()]+']',_0x57983e[_0xc4df('0x1a')]);_0x41021f(_0x57983e);});});};}function searchContact(_0x4c7dfc,_0x56afff,_0xdcbce4,_0x46d520){return new Promise(function(_0x2e8f7e,_0x5b51bf){var _0x4c7f41={'method':_0xc4df('0xe'),'headers':_0x56afff,'uri':_0x4c7dfc+'/api/lookup?q='+_0x46d520+'&f='+_0xdcbce4+_0xc4df('0x25'),'json':!![]};rp(_0x4c7f41)['then'](function(_0x46b336){var _0x469f5b=_[_0xc4df('0x26')](_0x46b336[_0xc4df('0x27')]['contacts'],[_0xdcbce4,_0x46d520]);_0x2e8f7e(_0x469f5b);})[_0xc4df('0x17')](function(_0x5d6c09){_0x5b51bf(_0x5d6c09);});});}function getEndUser(_0x429af4,_0x3baa10,_0x53ab2c){return function(_0x3cba30){return new Promise(function(_0x5bde6d,_0x380798){logger[_0xc4df('0x11')](util[_0xc4df('0x28')](_0xc4df('0x29'),_0x3cba30['contactNumber']));searchContact(_0x53ab2c,_0x3baa10,_0xc4df('0x2a'),_0x3cba30['contactNumber'])[_0xc4df('0x1c')](function(_0x3aaa16){if(_0x3aaa16){_0x3cba30[_0xc4df('0x2b')]=_0x3aaa16['id'];logger[_0xc4df('0x11')]('Contact\x20found\x20mobile_number:',_0x3cba30[_0xc4df('0x2b')]);return _0x5bde6d(_0x3cba30);}searchContact(_0x53ab2c,_0x3baa10,'work_number',_0x3cba30[_0xc4df('0x2c')])[_0xc4df('0x1c')](function(_0x5c26c5){if(_0x5c26c5){_0x3cba30[_0xc4df('0x2b')]=_0x5c26c5['id'];logger[_0xc4df('0x11')]('Contact\x20found\x20work_number:',_0x3cba30[_0xc4df('0x2b')]);return _0x5bde6d(_0x3cba30);}createEndUser(_0x3cba30,_0x429af4,_0x3baa10,_0x53ab2c)[_0xc4df('0x1c')](function(_0x2fbb24){logger[_0xc4df('0x11')](_0xc4df('0x2d'),_0x2fbb24[_0xc4df('0x2b')]);return _0x5bde6d(_0x2fbb24);});});})[_0xc4df('0x17')](function(_0xa6e23b){_0x380798(_0xa6e23b);});});};}function createEndUser(_0x4ca259,_0x328ec5,_0x9a5037,_0x408648){return new Promise(function(_0x45000b,_0x11fcd6){var _0x1bef82=moment();var _0x2d4482={'method':_0xc4df('0x2e'),'uri':_0x408648+_0xc4df('0x2f'),'body':{'contact':{'last_name':_0x4ca259[_0xc4df('0x2c')],'work_number':_0x4ca259[_0xc4df('0x2c')],'mobile_number':_0x4ca259[_0xc4df('0x2c')],'owner_id':_0x4ca259[_0xc4df('0x23')],'created_at':_0x1bef82['format'](_0xc4df('0x30'))}},'json':!![]};_0x2d4482[_0xc4df('0x10')]=_0x9a5037;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2d4482)[_0xc4df('0x1c')](function(_0x2b1480){_0x4ca259['endUserId']=_0x2b1480[_0xc4df('0x31')]['id'];_0x45000b(_0x4ca259);})[_0xc4df('0x17')](function(_0x2d543a){logger[_0xc4df('0x18')]('['+[_0x328ec5[_0xc4df('0x19')]()]+']',_0x2d543a[_0xc4df('0x1a')]);_0x11fcd6(_0x2d543a[_0xc4df('0x1a')]);});});}function getTicket(_0x4b9660,_0x1b7151,_0x3858f9,_0x43a90d,_0x6621d3){return function(_0x26e6e5){logger[_0xc4df('0x11')]('Creating\x20new\x20task');return new Promise(function(_0x25296b,_0x1c727c){var _0x9ec181=moment();var _0x221ac3={'method':_0xc4df('0x2e'),'uri':_0x3858f9+_0xc4df('0x32'),'body':{'title':intUtil[_0xc4df('0x33')](_0x43a90d[_0xc4df('0x34')],_0x6621d3,'\x20'),'description':intUtil[_0xc4df('0x33')](_0x43a90d[_0xc4df('0x35')],_0x6621d3,'\x0a'),'owner_id':_0x26e6e5['userId'],'creater_id':_0x26e6e5[_0xc4df('0x24')],'targetable_id':_0x26e6e5[_0xc4df('0x2b')],'targetable_type':_0xc4df('0x36'),'created_at':_0x9ec181[_0xc4df('0x28')](_0xc4df('0x30')),'due_date':_0x9ec181[_0xc4df('0x37')](0x1e,'m')[_0xc4df('0x28')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x221ac3['headers']=_0x1b7151;return rp(_0x221ac3)[_0xc4df('0x1c')](function(_0x353702){_0x26e6e5[_0xc4df('0x38')]=_0x353702[_0xc4df('0x39')]['id'];logger[_0xc4df('0x11')]('Task\x20created:',_0x26e6e5['ticketId']);_0x25296b(_0x26e6e5);})[_0xc4df('0x17')](function(_0x1ff26f){logger['error']('['+[_0x4b9660[_0xc4df('0x19')]()]+']',_0x1ff26f[_0xc4df('0x1a')]);_0x1c727c(_0x1ff26f[_0xc4df('0x1a')]);});});};}function emit(_0x134c9d,_0x34afe9,_0x272899){var _0x5f48ba={'uri':_0x134c9d+_0xc4df('0x3a')+_0x272899};io['to'](util[_0xc4df('0x28')](_0xc4df('0x3b'),_0x34afe9))[_0xc4df('0x3c')](_0xc4df('0x3d'),_0x5f48ba);}exports['cs']=function(_0x1aace0,_0x41a0aa,_0x4c1c26,_0x50c577,_0x2640d2,_0x56b87e,_0x209fa5,_0x1fbab5){var _0x40608a={};var _0x3c6c15={'Authorization':_0xc4df('0x3e')+_0x56b87e[_0xc4df('0x3f')]};_0x56b87e[_0xc4df('0x40')]=intUtil['stripTrailingSlash'](_0x56b87e[_0xc4df('0x40')]);_0x56b87e[_0xc4df('0x41')]=intUtil[_0xc4df('0x42')](_0x56b87e[_0xc4df('0x41')]);var _0x5a98ba=_0x56b87e[_0xc4df('0x40')];_0x40608a[_0xc4df('0x43')]=_0x56b87e['username'];_0x40608a[_0xc4df('0x2c')]=_0x1fbab5[_0xc4df('0x44')]()===_0xc4df('0x45')?_0x41a0aa[_0xc4df('0x46')]:_0x41a0aa['calleridnum'];_0x40608a[_0xc4df('0x47')]=_0x1fbab5===_0xc4df('0x48')||_0x1fbab5===_0xc4df('0x49')?_0xc4df('0x48'):_0xc4df('0x45');if(_0x50c577){_0x40608a[_0xc4df('0x1d')]=_0x50c577['email'];}var _0x38df2d=util[_0xc4df('0x28')](_0xc4df('0x4a'),_0x56b87e[_0xc4df('0x41')],_0x41a0aa[_0xc4df('0x4b')],md5(_0x41a0aa[_0xc4df('0x4b')]));if(_0x2640d2&&_0x2640d2['monitor_format']){logger['info'](_0xc4df('0x4c'),_0xc4df('0x4d'));_0x41a0aa[_0xc4df('0x4e')]=_0x38df2d;}else if(_0x209fa5&&_0x209fa5[_0xc4df('0x4f')]&&_0x209fa5[_0xc4df('0x4f')]!=='none'){logger[_0xc4df('0x11')]('[OUTBOUND]',_0xc4df('0x4d'));_0x41a0aa['recordingURL']=_0x38df2d;}else{_0x41a0aa[_0xc4df('0x4e')]='';}return getAdminId(_0x40608a,_0x1fbab5,_0x3c6c15,_0x5a98ba)['then'](getUser(_0x1fbab5,_0x3c6c15,_0x5a98ba))['then'](getEndUser(_0x1fbab5,_0x3c6c15,_0x5a98ba))[_0xc4df('0x1c')](getTicket(_0x1fbab5,_0x3c6c15,_0x5a98ba,_0x4c1c26,_0x41a0aa))[_0xc4df('0x1c')](function(_0x22c761){logger[_0xc4df('0x11')](util[_0xc4df('0x28')](_0xc4df('0x50'),_0x22c761[_0xc4df('0x38')]));if(_0x1fbab5!==_0xc4df('0x49')){logger[_0xc4df('0x11')]('['+[_0x1fbab5[_0xc4df('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5a98ba,_0x50c577[_0xc4df('0x51')],_0x22c761['endUserId']);}})[_0xc4df('0x17')](function(_0x2ae9a0){logger[_0xc4df('0x18')]('['+[_0x1fbab5['toUpperCase']()]+_0xc4df('0x52'),util[_0xc4df('0x53')](_0x2ae9a0,{'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 40f144e..8650a1d 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 _0xb1cc=['EVENT\x20UNKNOWN','unmanaged','servicenow','unknown\x20integration','error','[EXEC]','format','../../../../config/logger','lodash','util','./zendesk','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log'];(function(_0x35b0eb,_0xa4f7cf){var _0x455be4=function(_0x2a9c5d){while(--_0x2a9c5d){_0x35b0eb['push'](_0x35b0eb['shift']());}};_0x455be4(++_0xa4f7cf);}(_0xb1cc,0xbc));var _0xcb1c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb1cc[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xcb1c('0x0'));var util=require(_0xcb1c('0x1'));var zendesk=require(_0xcb1c('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xcb1c('0x3'));var zoho=require(_0xcb1c('0x4'));var desk=require('./desk');var vtiger=require(_0xcb1c('0x5'));var servicenow=require(_0xcb1c('0x6'));var dynamics365=require(_0xcb1c('0x7'));var freshsales=require(_0xcb1c('0x8'));var integrations=[_0xcb1c('0x9'),_0xcb1c('0xa'),_0xcb1c('0xb'),_0xcb1c('0xc'),_0xcb1c('0xd'),_0xcb1c('0xe'),_0xcb1c('0xf'),_0xcb1c('0x10'),_0xcb1c('0x11'),'servicenow'];exports[_0xcb1c('0x12')]=function(_0x378a68,_0x14088f,_0x5709e8,_0x313823,_0x2db221,_0x241857){if(_0x5709e8){if(_['includes'](integrations,_0x378a68[_0xcb1c('0x13')][_0xcb1c('0x14')]())){try{var _0x5db9d7=null;var _0x5da5c0='';var _0x11f0a3=_0x5709e8[_0x378a68[_0xcb1c('0x13')][_0xcb1c('0x14')]()];if(_0x11f0a3){var _0x761de5=_0x11f0a3[_0x378a68[_0xcb1c('0x15')]];if(_0x761de5){var _0x10a125=_[_0xcb1c('0x16')](_0x761de5[_0xcb1c('0x17')],{'id':parseInt(_0x378a68[_0xcb1c('0x18')],0xa)});if(_0x10a125){if(_0x313823){if(_0x2db221&&_0x14088f[_0xcb1c('0x19')]){_0x5da5c0=_0xcb1c('0x19');}else if(_0x14088f[_0xcb1c('0x1a')]){_0x5da5c0='outbound';}else{console[_0xcb1c('0x1b')](_0xcb1c('0x1c'),_0x14088f);}}else{_0x5da5c0=_0xcb1c('0x1d');}switch(_0x378a68[_0xcb1c('0x13')]['toLowerCase']()){case'zendesk':zendesk[_0x5da5c0](_0x378a68,_0x14088f,_0x10a125,_0x313823,_0x2db221,_0x761de5,_0x241857);break;case _0xcb1c('0xa'):salesforce[_0x5da5c0](_0x378a68,_0x14088f,_0x10a125,_0x313823,_0x2db221,_0x761de5,_0x241857);break;case _0xcb1c('0xb'):sugarcrm[_0x5da5c0](_0x378a68,_0x14088f,_0x10a125,_0x313823,_0x2db221,_0x761de5,_0x241857);break;case _0xcb1c('0xc'):freshdesk[_0x5da5c0](_0x378a68,_0x14088f,_0x10a125,_0x313823,_0x2db221,_0x761de5,_0x241857);break;case _0xcb1c('0xd'):zoho[_0x5da5c0](_0x378a68,_0x14088f,_0x10a125,_0x313823,_0x2db221,_0x761de5,_0x241857);break;case _0xcb1c('0xe'):desk[_0x5da5c0](_0x378a68,_0x14088f,_0x10a125,_0x313823,_0x2db221,_0x761de5,_0x241857);break;case _0xcb1c('0xf'):vtiger[_0x5da5c0](_0x378a68,_0x14088f,_0x10a125,_0x313823,_0x2db221,_0x761de5,_0x241857);break;case _0xcb1c('0x11'):freshsales['cs'](_0x378a68,_0x14088f,_0x10a125,_0x313823,_0x2db221,_0x761de5,_0x241857,_0x5da5c0);break;case _0xcb1c('0x1e'):servicenow['cs'](_0x378a68,_0x14088f,_0x10a125,_0x313823,_0x2db221,_0x761de5,_0x241857,_0x5da5c0);break;case _0xcb1c('0x10'):dynamics365['cs'](_0x378a68,_0x14088f,_0x10a125,_0x313823,_0x2db221,_0x761de5,_0x241857,_0x5da5c0);break;default:console[_0xcb1c('0x1b')](_0xcb1c('0x1f'));}}else{_0x5db9d7=require('../../../../config/logger')(_0x378a68[_0xcb1c('0x13')]['toLowerCase']());_0x5db9d7[_0xcb1c('0x20')](_0xcb1c('0x21'),util[_0xcb1c('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x378a68[_0xcb1c('0x13')][_0xcb1c('0x14')](),_0x378a68['data3']));}}else{_0x5db9d7=require(_0xcb1c('0x23'))(_0x378a68['data1'][_0xcb1c('0x14')]());_0x5db9d7['error']('[EXEC]',util[_0xcb1c('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x378a68[_0xcb1c('0x13')][_0xcb1c('0x14')](),_0x378a68[_0xcb1c('0x15')]));}}else{}}catch(_0x3f238f){console['error'](_0x3f238f);}}}}; \ No newline at end of file +var _0xa9bf=['data2','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','zendesk','salesforce','unknown\x20integration','[EXEC]','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./sugarcrm','./freshdesk','./vtiger','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xa9bf,0xfe));var _0xfa9b=function(_0x13d1d2,_0x5b3c24){_0x13d1d2=_0x13d1d2-0x0;var _0x5e93fb=_0xa9bf[_0x13d1d2];return _0x5e93fb;};'use strict';var _=require('lodash');var util=require(_0xfa9b('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0xfa9b('0x1'));var sugarcrm=require(_0xfa9b('0x2'));var freshdesk=require(_0xfa9b('0x3'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0xfa9b('0x4'));var servicenow=require('./servicenow');var dynamics365=require(_0xfa9b('0x5'));var freshsales=require(_0xfa9b('0x6'));var integrations=['zendesk','salesforce',_0xfa9b('0x7'),_0xfa9b('0x8'),_0xfa9b('0x9'),'desk',_0xfa9b('0xa'),_0xfa9b('0xb'),_0xfa9b('0xc'),_0xfa9b('0xd')];exports[_0xfa9b('0xe')]=function(_0x37a8d0,_0x3857aa,_0x29aed9,_0x238f91,_0x24032a,_0x41fdbc){if(_0x29aed9){if(_[_0xfa9b('0xf')](integrations,_0x37a8d0[_0xfa9b('0x10')][_0xfa9b('0x11')]())){try{var _0x289c43=null;var _0x545371='';var _0x3960f0=_0x29aed9[_0x37a8d0[_0xfa9b('0x10')][_0xfa9b('0x11')]()];if(_0x3960f0){var _0x127f12=_0x3960f0[_0x37a8d0[_0xfa9b('0x12')]];if(_0x127f12){var _0x5b98d3=_[_0xfa9b('0x13')](_0x127f12[_0xfa9b('0x14')],{'id':parseInt(_0x37a8d0[_0xfa9b('0x15')],0xa)});if(_0x5b98d3){if(_0x238f91){if(_0x24032a&&_0x3857aa[_0xfa9b('0x16')]){_0x545371='queue';}else if(_0x3857aa[_0xfa9b('0x17')]){_0x545371=_0xfa9b('0x18');}else{console[_0xfa9b('0x19')]('EVENT\x20UNKNOWN',_0x3857aa);}}else{_0x545371=_0xfa9b('0x1a');}switch(_0x37a8d0['data1'][_0xfa9b('0x11')]()){case _0xfa9b('0x1b'):zendesk[_0x545371](_0x37a8d0,_0x3857aa,_0x5b98d3,_0x238f91,_0x24032a,_0x127f12,_0x41fdbc);break;case _0xfa9b('0x1c'):salesforce[_0x545371](_0x37a8d0,_0x3857aa,_0x5b98d3,_0x238f91,_0x24032a,_0x127f12,_0x41fdbc);break;case _0xfa9b('0x7'):sugarcrm[_0x545371](_0x37a8d0,_0x3857aa,_0x5b98d3,_0x238f91,_0x24032a,_0x127f12,_0x41fdbc);break;case _0xfa9b('0x8'):freshdesk[_0x545371](_0x37a8d0,_0x3857aa,_0x5b98d3,_0x238f91,_0x24032a,_0x127f12,_0x41fdbc);break;case _0xfa9b('0x9'):zoho[_0x545371](_0x37a8d0,_0x3857aa,_0x5b98d3,_0x238f91,_0x24032a,_0x127f12,_0x41fdbc);break;case'desk':desk[_0x545371](_0x37a8d0,_0x3857aa,_0x5b98d3,_0x238f91,_0x24032a,_0x127f12,_0x41fdbc);break;case'vtiger':vtiger[_0x545371](_0x37a8d0,_0x3857aa,_0x5b98d3,_0x238f91,_0x24032a,_0x127f12,_0x41fdbc);break;case _0xfa9b('0xc'):freshsales['cs'](_0x37a8d0,_0x3857aa,_0x5b98d3,_0x238f91,_0x24032a,_0x127f12,_0x41fdbc,_0x545371);break;case _0xfa9b('0xd'):servicenow['cs'](_0x37a8d0,_0x3857aa,_0x5b98d3,_0x238f91,_0x24032a,_0x127f12,_0x41fdbc,_0x545371);break;case _0xfa9b('0xb'):dynamics365['cs'](_0x37a8d0,_0x3857aa,_0x5b98d3,_0x238f91,_0x24032a,_0x127f12,_0x41fdbc,_0x545371);break;default:console[_0xfa9b('0x19')](_0xfa9b('0x1d'));}}else{_0x289c43=require('../../../../config/logger')(_0x37a8d0[_0xfa9b('0x10')]['toLowerCase']());_0x289c43['error'](_0xfa9b('0x1e'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x37a8d0[_0xfa9b('0x10')][_0xfa9b('0x11')](),_0x37a8d0[_0xfa9b('0x15')]));}}else{_0x289c43=require(_0xfa9b('0x1f'))(_0x37a8d0[_0xfa9b('0x10')][_0xfa9b('0x11')]());_0x289c43[_0xfa9b('0x20')](_0xfa9b('0x1e'),util['format'](_0xfa9b('0x21'),_0x37a8d0[_0xfa9b('0x10')][_0xfa9b('0x11')](),_0x37a8d0['data2']));}}else{}}catch(_0x86d8dd){console[_0xfa9b('0x20')](_0x86d8dd);}}}}; \ 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 6ad052e..8e26d34 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 _0xa5ee=['[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','salesforce','redis','defaults','localhost','emit','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','leadId','info','sobject','create','isNil','validateEmail','User','execute','find','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','additionalSearchLead','$or','account_contact_lead','additionalSearchAccount','Account','length','Contact','Lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variableName','Variable','name','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','queue'];(function(_0xb4740f,_0x11b7b1){var _0x17dec1=function(_0x56c288){while(--_0x56c288){_0xb4740f['push'](_0xb4740f['shift']());}};_0x17dec1(++_0x11b7b1);}(_0xa5ee,0x18f));var _0xea5e=function(_0x323590,_0x3211db){_0x323590=_0x323590-0x0;var _0x246383=_0xa5ee[_0x323590];return _0x246383;};'use strict';var _=require(_0xea5e('0x0'));var rp=require(_0xea5e('0x1'));var moment=require(_0xea5e('0x2'));var BPromise=require(_0xea5e('0x3'));var md5=require('md5');var jsforce=require(_0xea5e('0x4'));var util=require(_0xea5e('0x5'));var Redis=require(_0xea5e('0x6'));var intUtil=require(_0xea5e('0x7'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xea5e('0x8'));config[_0xea5e('0x9')]=_[_0xea5e('0xa')](config[_0xea5e('0x9')],{'host':_0xea5e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xea5e('0x9')]));function emit(_0x48e835,_0x22a03b,_0x5c3702){io['to'](_0x48e835)[_0xea5e('0xc')](_0x22a03b,_0x5c3702);}function getTicket(_0x5dc10f,_0x4cacc9,_0x2559db,_0x3aec72,_0x37b537,_0x2ef904,_0x36f079,_0x4c610f){var _0x392d85=Object['assign']({},{'OwnerId':_0x4cacc9['id'],'Subject':intUtil['getString'](_0x3aec72['Subjects'],_0x37b537,'\x20'),'Description':intUtil['getString'](_0x3aec72[_0xea5e('0xd')],_0x37b537,'\x0a')},getCustomFields(_0x2ef904,_0x37b537));if(_0x2559db){if(_0x3aec72[_0xea5e('0xe')]===_0xea5e('0xf')){_0x392d85[_0xea5e('0x10')]=moment[_0xea5e('0x11')]();_0x392d85['IsReminderSet']=![];_0x392d85[_0xea5e('0x12')]=![];if(_0x2559db[_0xea5e('0x13')]===_0xea5e('0x14')||_0x2559db[_0xea5e('0x13')]===_0xea5e('0x15')){_0x392d85[_0xea5e('0x16')]=_0x2559db['id'];}else if(_0x2559db['endUserType']===_0xea5e('0x17')){_0x392d85[_0xea5e('0x18')]=_0x2559db['id'];}}else if(_0x3aec72[_0xea5e('0xe')]==='Case'){if(_0x2559db['endUserType']===_0xea5e('0x14')){_0x392d85[_0xea5e('0x19')]=_0x2559db['id'];}else if(_0x2559db[_0xea5e('0x13')]===_0xea5e('0x17')){_0x392d85['AccountId']=_0x2559db['id'];}else if(_0x2559db[_0xea5e('0x13')]===_0xea5e('0x15')&&_0x3aec72[_0xea5e('0x1a')]){_0x392d85[_0x3aec72['leadId']]=_0x2559db['id'];}else{logger[_0xea5e('0x1b')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x36f079[_0xea5e('0x1c')](_0x3aec72[_0xea5e('0xe')])[_0xea5e('0x1d')](_0x392d85);}function getUser(_0x3a0bb5,_0x2df936,_0x20b12c){if(!_[_0xea5e('0x1e')](_0x2df936)&&intUtil[_0xea5e('0x1f')](_0x2df936)){var _0x3463c7={'Email':_0x2df936};var _0x54ae40={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x20b12c[_0xea5e('0x1c')](_0xea5e('0x20'))['find'](_0x3463c7,_0x54ae40)[_0xea5e('0x21')]()['then'](function(_0x4dffbb){if(_0x4dffbb['length']){var _0x3febe1=_[_0xea5e('0x22')](_0x4dffbb,function(_0x134607){return _0x134607['Email']===_0x2df936;});if(_0x3febe1){logger[_0xea5e('0x1b')](_0xea5e('0x23'),_0x2df936);return BPromise[_0xea5e('0x24')]({'id':_0x3febe1['Id'],'name':_0x3febe1[_0xea5e('0x25')]});}}else{logger[_0xea5e('0x1b')](_0xea5e('0x26'),_0x2df936);return _0x20b12c['identity']()[_0xea5e('0x27')](function(_0x1bbbd6){return BPromise['resolve']({'id':_0x1bbbd6[_0xea5e('0x28')],'name':_0x1bbbd6[_0xea5e('0x29')]});});}});}else{logger[_0xea5e('0x1b')](_0xea5e('0x26'),_0x2df936);return _0x20b12c[_0xea5e('0x2a')]()['then'](function(_0x2bb081){return BPromise[_0xea5e('0x24')]({'id':_0x2bb081[_0xea5e('0x28')],'name':_0x2bb081[_0xea5e('0x29')]});});}}function getEndUser(_0x2a959c,_0x2c6462,_0x1b49d7,_0x42689f,_0x4a83c6){var _0x2f8890={'$or':{'Phone':_0x42689f}};var _0x3498ea={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xea5e('0x24')]()['then'](function(){logger['info'](_0xea5e('0x2b'),_0x42689f,_0x2c6462[_0xea5e('0x2c')]);switch(_0x2c6462['moduleSearch']){case _0xea5e('0x2d'):var _0x235e72=_[_0xea5e('0x2e')](_0x2f8890);if(_0x2c6462[_0xea5e('0x2f')]){var _0x34b35a={};_0x34b35a[_0x2c6462['additionalSearchContact']]=_0x42689f;_[_0xea5e('0x30')](_0x235e72['$or'],_0x34b35a);}return _0x4a83c6['sobject']('Contact')[_0xea5e('0x22')](_0x235e72,_0x3498ea)[_0xea5e('0x21')]()['then'](function(_0x502c5b){if(_0x502c5b&&_0x502c5b['length']){return _0x502c5b;}else{var _0x12668f=_['cloneDeep'](_0x2f8890);if(_0x2c6462['additionalSearchLead']){var _0x48eca7={};_0x48eca7[_0x2c6462[_0xea5e('0x31')]]=_0x42689f;_[_0xea5e('0x30')](_0x12668f[_0xea5e('0x32')],_0x48eca7);}return _0x4a83c6['sobject']('Lead')[_0xea5e('0x22')](_0x12668f,_0x3498ea);}});case _0xea5e('0x33'):var _0x1fa7e8=_[_0xea5e('0x2e')](_0x2f8890);if(_0x2c6462['additionalSearchAccount']){var _0x34b35a={};_0x34b35a[_0x2c6462[_0xea5e('0x34')]]=_0x42689f;_[_0xea5e('0x30')](_0x1fa7e8[_0xea5e('0x32')],_0x34b35a);}return _0x4a83c6[_0xea5e('0x1c')](_0xea5e('0x35'))[_0xea5e('0x22')](_0x1fa7e8,_0x3498ea)[_0xea5e('0x21')]()[_0xea5e('0x27')](function(_0x4c0938){if(_0x4c0938&&_0x4c0938[_0xea5e('0x36')]){return _0x4c0938;}else{var _0x3db849=_[_0xea5e('0x2e')](_0x2f8890);if(_0x2c6462[_0xea5e('0x2f')]){var _0x47d3a2={};_0x47d3a2[_0x2c6462[_0xea5e('0x2f')]]=_0x42689f;_[_0xea5e('0x30')](_0x3db849[_0xea5e('0x32')],_0x47d3a2);}return _0x4a83c6[_0xea5e('0x1c')](_0xea5e('0x37'))[_0xea5e('0x22')](_0x3db849,_0x3498ea)[_0xea5e('0x27')](function(_0x3622a6){if(_0x3622a6&&_0x3622a6[_0xea5e('0x36')]){return _0x3622a6;}else{var _0x190bb5=_[_0xea5e('0x2e')](_0x2f8890);if(_0x2c6462[_0xea5e('0x31')]){var _0x46f97b={};_0x46f97b[_0x2c6462[_0xea5e('0x31')]]=_0x42689f;_['merge'](_0x190bb5[_0xea5e('0x32')],_0x46f97b);}return _0x4a83c6['sobject'](_0xea5e('0x38'))['find'](_0x190bb5,_0x3498ea);}});}});case _0xea5e('0x14'):var _0x235e72=_[_0xea5e('0x2e')](_0x2f8890);if(_0x2c6462[_0xea5e('0x2f')]){var _0x34b35a={};_0x34b35a[_0x2c6462[_0xea5e('0x2f')]]=_0x42689f;_[_0xea5e('0x30')](_0x235e72[_0xea5e('0x32')],_0x34b35a);}return _0x4a83c6[_0xea5e('0x1c')](_0xea5e('0x37'))[_0xea5e('0x22')](_0x235e72,_0x3498ea)[_0xea5e('0x21')]();case _0xea5e('0x15'):var _0x9e8f90=_[_0xea5e('0x2e')](_0x2f8890);if(_0x2c6462['additionalSearchLead']){var _0x34b35a={};_0x34b35a[_0x2c6462[_0xea5e('0x31')]]=_0x42689f;_[_0xea5e('0x30')](_0x9e8f90[_0xea5e('0x32')],_0x34b35a);}return _0x4a83c6[_0xea5e('0x1c')](_0xea5e('0x38'))[_0xea5e('0x22')](_0x9e8f90,_0x3498ea);case _0xea5e('0x17'):var _0x1fa7e8=_[_0xea5e('0x2e')](_0x2f8890);if(_0x2c6462[_0xea5e('0x34')]){var _0x34b35a={};_0x34b35a[_0x2c6462['additionalSearchAccount']]=_0x42689f;_[_0xea5e('0x30')](_0x1fa7e8[_0xea5e('0x32')],_0x34b35a);}return _0x4a83c6[_0xea5e('0x1c')]('Account')[_0xea5e('0x22')](_0x1fa7e8,_0x3498ea);default:return null;}})['then'](function(_0xc457ca){if(_0xc457ca&&_0xc457ca[_0xea5e('0x36')]){var _0x20dbeb=_[_0xea5e('0x39')](_0xc457ca);if(_0x20dbeb){return BPromise[_0xea5e('0x24')]({'id':_0x20dbeb['Id'],'name':_0x20dbeb['Name'],'phone':_0x20dbeb[_0xea5e('0x3a')],'endUserType':_0x20dbeb[_0xea5e('0x3b')][_0xea5e('0x3c')][_0xea5e('0x3d')]()});}}})[_0xea5e('0x27')](function(_0x1deccc){if(_0x1deccc){logger[_0xea5e('0x1b')](_0xea5e('0x3e'),_0x1deccc[_0xea5e('0x13')],_0x42689f);return BPromise['resolve'](_0x1deccc);}else{logger[_0xea5e('0x1b')](_0xea5e('0x3f'),_0x42689f);var _0x521640={'Phone':_0x42689f};if(_0x2c6462['moduleCreate']){if(_0x2c6462[_0xea5e('0x40')]==='contact'){logger['info'](_0xea5e('0x41'),_0x42689f,_0x2c6462[_0xea5e('0x40')]);_0x521640[_0xea5e('0x42')]=_0x1b49d7!==_0xea5e('0x43')?_0x1b49d7:util[_0xea5e('0x44')](_0xea5e('0x45'),_0x42689f);}else if(_0x2c6462[_0xea5e('0x40')]===_0xea5e('0x15')){logger[_0xea5e('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x42689f,_0x2c6462[_0xea5e('0x40')]);_0x521640['LastName']=_0x1b49d7!==_0xea5e('0x43')?_0x1b49d7:util[_0xea5e('0x44')](_0xea5e('0x45'),_0x42689f);_0x521640['Company']=_0xea5e('0x46');}else if(_0x2c6462[_0xea5e('0x40')]===_0xea5e('0x17')){logger[_0xea5e('0x1b')](_0xea5e('0x41'),_0x42689f,_0x2c6462[_0xea5e('0x40')]);_0x521640[_0xea5e('0x25')]=_0x1b49d7!==_0xea5e('0x43')?_0x1b49d7:util[_0xea5e('0x44')]('Caller\x20-\x20%s',_0x42689f);}else{return null;}}return _0x4a83c6[_0xea5e('0x1c')](_[_0xea5e('0x47')](_0x2c6462['moduleCreate']))[_0xea5e('0x1d')](_0x521640)[_0xea5e('0x27')](function(_0x53d562){return BPromise[_0xea5e('0x24')]({'id':_0x53d562['id'],'endUserType':_0x2c6462['moduleCreate']});});}});}function getCustomFields(_0x2a53ae,_0x3ab126){var _0x1ced67={};if(_0x2a53ae[_0xea5e('0x36')]>0x0){_[_0xea5e('0x48')](_0x2a53ae,function(_0x55f853){if(_[_0xea5e('0x49')]([_0xea5e('0x4a'),_0xea5e('0x4b')],_0x55f853[_0xea5e('0x3c')])&&_0x55f853[_0xea5e('0x4c')]){_0x1ced67[_0x55f853[_0xea5e('0x4c')]]=_0x55f853[_0xea5e('0x4d')][_0xea5e('0x4e')]();}else if(_0x55f853[_0xea5e('0x3c')]==='variable'&&_0x55f853[_0xea5e('0x4f')]&&_0x55f853[_0xea5e('0x4c')]){_0x3ab126[_0x55f853[_0xea5e('0x4f')]]&&(_0x1ced67[_0x55f853[_0xea5e('0x4c')]]=_0x3ab126[_0x55f853[_0xea5e('0x4f')]][_0xea5e('0x4e')]());}else if(_0x55f853['type']==='customVariable'&&_0x55f853['Variable']&&_0x55f853[_0xea5e('0x50')]['name']&&_0x55f853[_0xea5e('0x4c')]){_0x3ab126[_0x55f853[_0xea5e('0x50')][_0xea5e('0x51')][_0xea5e('0x3d')]()]&&(_0x1ced67[_0x55f853['idField']]=_0x3ab126[_0x55f853[_0xea5e('0x50')]['name'][_0xea5e('0x3d')]()][_0xea5e('0x4e')]());}});}return _0x1ced67;}function getConnection(_0x154a90){var _0x9d808c=_0x154a90['password'][_0xea5e('0x52')](_0x154a90['securityToken']);var _0x4880af=new jsforce[(_0xea5e('0x53'))]({'oauth2':{'loginUrl':_0x154a90[_0xea5e('0x54')]||_0xea5e('0x55'),'clientId':_0x154a90[_0xea5e('0x56')],'clientSecret':_0x154a90[_0xea5e('0x57')]}});return _0x4880af[_0xea5e('0x58')](_0x154a90[_0xea5e('0x59')],_0x9d808c)[_0xea5e('0x27')](function(){logger[_0xea5e('0x1b')](_0xea5e('0x5a'));return _0x4880af;});}exports['queue']=function(_0xc227b6,_0x3e58ba,_0x542256,_0x51447d,_0x397070,_0x4c1e44){var _0x2479f0,_0x4b1222,_0x1c0c24,_0x33b8a7;_0x4c1e44[_0xea5e('0x5b')]=intUtil[_0xea5e('0x5c')](_0x4c1e44[_0xea5e('0x5b')]);_0x4c1e44['remoteUri']=intUtil[_0xea5e('0x5c')](_0x4c1e44[_0xea5e('0x54')]);if(_0x397070&&_0x397070['monitor_format']){logger[_0xea5e('0x1b')](_0xea5e('0x5d'),'Recording\x20is\x20enabled!');_0x3e58ba[_0xea5e('0x5e')]=util[_0xea5e('0x44')](_0xea5e('0x5f'),_0x4c1e44[_0xea5e('0x5b')],_0x3e58ba[_0xea5e('0x60')],md5(_0x3e58ba[_0xea5e('0x60')]));}else{_0x3e58ba[_0xea5e('0x5e')]='';}return getConnection(_0x4c1e44)[_0xea5e('0x27')](function(_0x57feab){_0x33b8a7=_0x57feab;return getUser(_0x4c1e44,_0x51447d['email'],_0x33b8a7);})[_0xea5e('0x27')](function(_0xc55189){_0x2479f0=_0xc55189;return getEndUser(_0x4c1e44,_0x542256,_0x3e58ba[_0xea5e('0x61')],_0x3e58ba[_0xea5e('0x62')],_0x33b8a7);})[_0xea5e('0x27')](function(_0x3052f2){_0x4b1222=_0x3052f2;return getTicket(_0x4c1e44,_0x2479f0,_0x4b1222,_0x542256,_0x3e58ba,_0x542256[_0xea5e('0x63')],_0x33b8a7,_0xea5e('0x64'));})['then'](function(_0x2636c0){_0x1c0c24=_0x2636c0;logger[_0xea5e('0x1b')](_0xea5e('0x65'),_0x1c0c24['id']);logger[_0xea5e('0x1b')](_0xea5e('0x66'),_0x1c0c24['id'],_0x51447d['name'],_0x4c1e44[_0xea5e('0x3c')]);switch(_0x4c1e44[_0xea5e('0x3c')]){case _0xea5e('0x67'):emit(util['format']('user:%s',_0x51447d[_0xea5e('0x51')]),'trigger:salesforce:display',{'recordId':_0x1c0c24['id']});break;case _0xea5e('0x68'):emit(util[_0xea5e('0x44')]('user:%s',_0x51447d[_0xea5e('0x51')]),'trigger:browser:url',{'uri':util[_0xea5e('0x44')](_0xea5e('0x69'),_0x33b8a7[_0xea5e('0x6a')],_0x1c0c24['id'])});break;default:logger['error'](_0xea5e('0x6b'));}})[_0xea5e('0x6c')](function(_0x520263){logger[_0xea5e('0x6d')](_0xea5e('0x5d'),_0x520263);});};exports[_0xea5e('0x6e')]=function(_0x2c129a,_0x3c286d,_0x55da7f,_0x3e1e4f,_0x590d3c,_0x52c336,_0x119df0){var _0x878e78,_0x416503,_0x457b24,_0x2db136;_0x52c336[_0xea5e('0x5b')]=intUtil[_0xea5e('0x5c')](_0x52c336[_0xea5e('0x5b')]);_0x52c336[_0xea5e('0x54')]=intUtil['stripTrailingSlash'](_0x52c336[_0xea5e('0x54')]);if(_0x119df0&&_0x119df0[_0xea5e('0x6f')]&&_0x119df0[_0xea5e('0x6f')]!==_0xea5e('0x70')){logger[_0xea5e('0x1b')](_0xea5e('0x71'),_0xea5e('0x72'));_0x3c286d[_0xea5e('0x5e')]=util[_0xea5e('0x44')](_0xea5e('0x5f'),_0x52c336['serverUrl'],_0x3c286d['uniqueid'],md5(_0x3c286d[_0xea5e('0x60')]));}return getConnection(_0x52c336)[_0xea5e('0x27')](function(_0x15f0e6){_0x2db136=_0x15f0e6;return getUser(_0x52c336,_0x3e1e4f['email'],_0x2db136);})[_0xea5e('0x27')](function(_0xe8c7d4){_0x878e78=_0xe8c7d4;return getEndUser(_0x52c336,_0x55da7f,_0x3c286d['destcalleridname'],_0x3c286d[_0xea5e('0x73')],_0x2db136);})[_0xea5e('0x27')](function(_0x385f01){_0x416503=_0x385f01;return getTicket(_0x52c336,_0x878e78,_0x416503,_0x55da7f,_0x3c286d,_0x55da7f[_0xea5e('0x63')],_0x2db136,'outbound');})['then'](function(_0x5bd61d){_0x457b24=_0x5bd61d;logger[_0xea5e('0x1b')](_0xea5e('0x74'),_0x457b24['id']);logger['info'](_0xea5e('0x75'),_0x457b24['id'],_0x3e1e4f[_0xea5e('0x51')],_0x52c336[_0xea5e('0x3c')]);switch(_0x52c336['type']){case'integrationTab':emit(util[_0xea5e('0x44')](_0xea5e('0x76'),_0x3e1e4f[_0xea5e('0x51')]),'trigger:salesforce:display',{'recordId':_0x457b24['id']});break;case _0xea5e('0x68'):emit(util[_0xea5e('0x44')]('user:%s',_0x3e1e4f[_0xea5e('0x51')]),'trigger:browser:url',{'uri':util['format'](_0xea5e('0x69'),_0x2db136[_0xea5e('0x6a')],_0x457b24['id'])});break;default:logger['error']('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xea5e('0x6c')](function(_0x40d44a){logger['error'](_0xea5e('0x71'),_0x40d44a);});};exports[_0xea5e('0x77')]=function(_0x5143e7,_0x3e4539,_0x2a76f0,_0x329983,_0x1b5b92,_0x2c9a96){var _0x2545fd,_0x39c432,_0x107a3a,_0x39df0e;_0x2c9a96[_0xea5e('0x5b')]=intUtil[_0xea5e('0x5c')](_0x2c9a96[_0xea5e('0x5b')]);_0x2c9a96[_0xea5e('0x54')]=intUtil[_0xea5e('0x5c')](_0x2c9a96['remoteUri']);if(_0x1b5b92&&_0x1b5b92[_0xea5e('0x78')]){logger[_0xea5e('0x1b')]('['+_0x3e4539[_0xea5e('0x79')][_0xea5e('0x7a')]()+']',_0xea5e('0x72'));_0x3e4539[_0xea5e('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c9a96['serverUrl'],_0x3e4539['uniqueid'],md5(_0x3e4539[_0xea5e('0x60')]));}else{_0x3e4539[_0xea5e('0x5e')]='';}return getConnection(_0x2c9a96)['then'](function(_0x47aa13){_0x39df0e=_0x47aa13;if(!_[_0xea5e('0x1e')](_0x329983)){return getUser(_0x2c9a96,_0x329983[_0xea5e('0x51')],_0x39df0e);}else{return getUser(_0x2c9a96,null,_0x39df0e);}})[_0xea5e('0x27')](function(_0xde85d6){_0x2545fd=_0xde85d6;return getEndUser(_0x2c9a96,_0x2a76f0,_0x3e4539[_0xea5e('0x61')],_0x3e4539['calleridnum'],_0x39df0e);})[_0xea5e('0x27')](function(_0x51eaf3){_0x39c432=_0x51eaf3;return getTicket(_0x2c9a96,_0x2545fd,_0x39c432,_0x2a76f0,_0x3e4539,_0x2a76f0['Fields'],_0x39df0e);})[_0xea5e('0x27')](function(_0x38eb07){_0x107a3a=_0x38eb07;logger['info']('['+_0x3e4539[_0xea5e('0x79')][_0xea5e('0x7a')]()+_0xea5e('0x7b'),_0x107a3a['id']);logger['info']('['+_0x3e4539[_0xea5e('0x79')][_0xea5e('0x7a')]()+_0xea5e('0x7c'),_0x2c9a96[_0xea5e('0x3c')]);})['catch'](function(_0x5f59e5){logger['error']('['+_0x3e4539[_0xea5e('0x79')][_0xea5e('0x7a')]()+']',_0x5f59e5);});}; \ No newline at end of file +var _0x5e59=['variableName','customVariable','Variable','name','password','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','recordingFormat','none','[OUTBOUND]','uniqueid','email','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','error','Salesforce\x20account\x20type\x20not\x20recognized','catch','monitor_format','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','assign','Subjects','getString','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','contact','lead','WhoId','endUserType','WhatId','Case','ContactId','account','leadId','info','create','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','picklist','idField','content','toString','variable'];(function(_0x5af629,_0x10517e){var _0x55c005=function(_0x2dc33b){while(--_0x2dc33b){_0x5af629['push'](_0x5af629['shift']());}};_0x55c005(++_0x10517e);}(_0x5e59,0xaf));var _0x95e5=function(_0x4d7379,_0x4b4e63){_0x4d7379=_0x4d7379-0x0;var _0x46d7cf=_0x5e59[_0x4d7379];return _0x46d7cf;};'use strict';var _=require(_0x95e5('0x0'));var rp=require('request-promise');var moment=require(_0x95e5('0x1'));var BPromise=require(_0x95e5('0x2'));var md5=require(_0x95e5('0x3'));var jsforce=require(_0x95e5('0x4'));var util=require(_0x95e5('0x5'));var Redis=require(_0x95e5('0x6'));var intUtil=require(_0x95e5('0x7'));var config=require(_0x95e5('0x8'));var logger=require(_0x95e5('0x9'))('salesforce');config[_0x95e5('0xa')]=_[_0x95e5('0xb')](config[_0x95e5('0xa')],{'host':_0x95e5('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x95e5('0xa')]));function emit(_0xd38b31,_0x51f660,_0x21ca7d){io['to'](_0xd38b31)['emit'](_0x51f660,_0x21ca7d);}function getTicket(_0x556239,_0x472c76,_0x34bd34,_0x53b07a,_0xf5bc52,_0x1c6a38,_0x24320b,_0x4bf292){var _0x8d4b80=Object[_0x95e5('0xd')]({},{'OwnerId':_0x472c76['id'],'Subject':intUtil['getString'](_0x53b07a[_0x95e5('0xe')],_0xf5bc52,'\x20'),'Description':intUtil[_0x95e5('0xf')](_0x53b07a[_0x95e5('0x10')],_0xf5bc52,'\x0a')},getCustomFields(_0x1c6a38,_0xf5bc52));if(_0x34bd34){if(_0x53b07a[_0x95e5('0x11')]==='Task'){_0x8d4b80[_0x95e5('0x12')]=moment[_0x95e5('0x13')]();_0x8d4b80[_0x95e5('0x14')]=![];_0x8d4b80['IsRecurrence']=![];if(_0x34bd34['endUserType']===_0x95e5('0x15')||_0x34bd34['endUserType']===_0x95e5('0x16')){_0x8d4b80[_0x95e5('0x17')]=_0x34bd34['id'];}else if(_0x34bd34[_0x95e5('0x18')]==='account'){_0x8d4b80[_0x95e5('0x19')]=_0x34bd34['id'];}}else if(_0x53b07a['ticketType']===_0x95e5('0x1a')){if(_0x34bd34[_0x95e5('0x18')]===_0x95e5('0x15')){_0x8d4b80[_0x95e5('0x1b')]=_0x34bd34['id'];}else if(_0x34bd34[_0x95e5('0x18')]===_0x95e5('0x1c')){_0x8d4b80['AccountId']=_0x34bd34['id'];}else if(_0x34bd34[_0x95e5('0x18')]==='lead'&&_0x53b07a[_0x95e5('0x1d')]){_0x8d4b80[_0x53b07a[_0x95e5('0x1d')]]=_0x34bd34['id'];}else{logger[_0x95e5('0x1e')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x24320b['sobject'](_0x53b07a[_0x95e5('0x11')])[_0x95e5('0x1f')](_0x8d4b80);}function getUser(_0x2d0aa0,_0xd6829b,_0x572f93){if(!_[_0x95e5('0x20')](_0xd6829b)&&intUtil[_0x95e5('0x21')](_0xd6829b)){var _0x5997ad={'Email':_0xd6829b};var _0xddb8e4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x572f93[_0x95e5('0x22')](_0x95e5('0x23'))[_0x95e5('0x24')](_0x5997ad,_0xddb8e4)[_0x95e5('0x25')]()[_0x95e5('0x26')](function(_0x70c501){if(_0x70c501[_0x95e5('0x27')]){var _0x40a77c=_['find'](_0x70c501,function(_0x2381e8){return _0x2381e8[_0x95e5('0x28')]===_0xd6829b;});if(_0x40a77c){logger[_0x95e5('0x1e')](_0x95e5('0x29'),_0xd6829b);return BPromise[_0x95e5('0x2a')]({'id':_0x40a77c['Id'],'name':_0x40a77c[_0x95e5('0x2b')]});}}else{logger[_0x95e5('0x1e')](_0x95e5('0x2c'),_0xd6829b);return _0x572f93[_0x95e5('0x2d')]()[_0x95e5('0x26')](function(_0x59473f){return BPromise[_0x95e5('0x2a')]({'id':_0x59473f[_0x95e5('0x2e')],'name':_0x59473f[_0x95e5('0x2f')]});});}});}else{logger[_0x95e5('0x1e')](_0x95e5('0x2c'),_0xd6829b);return _0x572f93[_0x95e5('0x2d')]()['then'](function(_0xaaebc8){return BPromise[_0x95e5('0x2a')]({'id':_0xaaebc8[_0x95e5('0x2e')],'name':_0xaaebc8[_0x95e5('0x2f')]});});}}function getEndUser(_0x23d027,_0x479a8c,_0x289eb5,_0x1fb272,_0x9f46cb){var _0x380b7c={'$or':{'Phone':_0x1fb272}};var _0x42ebc7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x95e5('0x2a')]()[_0x95e5('0x26')](function(){logger[_0x95e5('0x1e')](_0x95e5('0x30'),_0x1fb272,_0x479a8c['moduleSearch']);switch(_0x479a8c[_0x95e5('0x31')]){case'contact_lead':var _0x1ec45b=_[_0x95e5('0x32')](_0x380b7c);if(_0x479a8c['additionalSearchContact']){var _0x5d8efa={};_0x5d8efa[_0x479a8c[_0x95e5('0x33')]]=_0x1fb272;_['merge'](_0x1ec45b[_0x95e5('0x34')],_0x5d8efa);}return _0x9f46cb[_0x95e5('0x22')](_0x95e5('0x35'))[_0x95e5('0x24')](_0x1ec45b,_0x42ebc7)[_0x95e5('0x25')]()[_0x95e5('0x26')](function(_0x1f2349){if(_0x1f2349&&_0x1f2349[_0x95e5('0x27')]){return _0x1f2349;}else{var _0x10ea52=_[_0x95e5('0x32')](_0x380b7c);if(_0x479a8c[_0x95e5('0x36')]){var _0x4b6328={};_0x4b6328[_0x479a8c[_0x95e5('0x36')]]=_0x1fb272;_[_0x95e5('0x37')](_0x10ea52[_0x95e5('0x34')],_0x4b6328);}return _0x9f46cb[_0x95e5('0x22')](_0x95e5('0x38'))[_0x95e5('0x24')](_0x10ea52,_0x42ebc7);}});case _0x95e5('0x39'):var _0x1a06a2=_[_0x95e5('0x32')](_0x380b7c);if(_0x479a8c[_0x95e5('0x3a')]){var _0x5d8efa={};_0x5d8efa[_0x479a8c[_0x95e5('0x3a')]]=_0x1fb272;_[_0x95e5('0x37')](_0x1a06a2[_0x95e5('0x34')],_0x5d8efa);}return _0x9f46cb[_0x95e5('0x22')](_0x95e5('0x3b'))[_0x95e5('0x24')](_0x1a06a2,_0x42ebc7)[_0x95e5('0x25')]()[_0x95e5('0x26')](function(_0x184572){if(_0x184572&&_0x184572[_0x95e5('0x27')]){return _0x184572;}else{var _0x3acc1e=_['cloneDeep'](_0x380b7c);if(_0x479a8c['additionalSearchContact']){var _0x16c333={};_0x16c333[_0x479a8c[_0x95e5('0x33')]]=_0x1fb272;_[_0x95e5('0x37')](_0x3acc1e[_0x95e5('0x34')],_0x16c333);}return _0x9f46cb[_0x95e5('0x22')]('Contact')[_0x95e5('0x24')](_0x3acc1e,_0x42ebc7)[_0x95e5('0x26')](function(_0x56f842){if(_0x56f842&&_0x56f842[_0x95e5('0x27')]){return _0x56f842;}else{var _0x2506c7=_['cloneDeep'](_0x380b7c);if(_0x479a8c[_0x95e5('0x36')]){var _0x27fbfd={};_0x27fbfd[_0x479a8c[_0x95e5('0x36')]]=_0x1fb272;_[_0x95e5('0x37')](_0x2506c7[_0x95e5('0x34')],_0x27fbfd);}return _0x9f46cb['sobject'](_0x95e5('0x38'))['find'](_0x2506c7,_0x42ebc7);}});}});case _0x95e5('0x15'):var _0x1ec45b=_[_0x95e5('0x32')](_0x380b7c);if(_0x479a8c[_0x95e5('0x33')]){var _0x5d8efa={};_0x5d8efa[_0x479a8c[_0x95e5('0x33')]]=_0x1fb272;_[_0x95e5('0x37')](_0x1ec45b[_0x95e5('0x34')],_0x5d8efa);}return _0x9f46cb[_0x95e5('0x22')](_0x95e5('0x35'))[_0x95e5('0x24')](_0x1ec45b,_0x42ebc7)[_0x95e5('0x25')]();case _0x95e5('0x16'):var _0x52cc13=_[_0x95e5('0x32')](_0x380b7c);if(_0x479a8c[_0x95e5('0x36')]){var _0x5d8efa={};_0x5d8efa[_0x479a8c['additionalSearchLead']]=_0x1fb272;_[_0x95e5('0x37')](_0x52cc13['$or'],_0x5d8efa);}return _0x9f46cb[_0x95e5('0x22')](_0x95e5('0x38'))[_0x95e5('0x24')](_0x52cc13,_0x42ebc7);case _0x95e5('0x1c'):var _0x1a06a2=_['cloneDeep'](_0x380b7c);if(_0x479a8c[_0x95e5('0x3a')]){var _0x5d8efa={};_0x5d8efa[_0x479a8c[_0x95e5('0x3a')]]=_0x1fb272;_[_0x95e5('0x37')](_0x1a06a2['$or'],_0x5d8efa);}return _0x9f46cb[_0x95e5('0x22')](_0x95e5('0x3b'))['find'](_0x1a06a2,_0x42ebc7);default:return null;}})[_0x95e5('0x26')](function(_0x3be118){if(_0x3be118&&_0x3be118[_0x95e5('0x27')]){var _0x221b8e=_[_0x95e5('0x3c')](_0x3be118);if(_0x221b8e){return BPromise[_0x95e5('0x2a')]({'id':_0x221b8e['Id'],'name':_0x221b8e[_0x95e5('0x2b')],'phone':_0x221b8e[_0x95e5('0x3d')],'endUserType':_0x221b8e[_0x95e5('0x3e')][_0x95e5('0x3f')][_0x95e5('0x40')]()});}}})[_0x95e5('0x26')](function(_0x15822d){if(_0x15822d){logger[_0x95e5('0x1e')](_0x95e5('0x41'),_0x15822d[_0x95e5('0x18')],_0x1fb272);return BPromise[_0x95e5('0x2a')](_0x15822d);}else{logger[_0x95e5('0x1e')](_0x95e5('0x42'),_0x1fb272);var _0x325aa1={'Phone':_0x1fb272};if(_0x479a8c[_0x95e5('0x43')]){if(_0x479a8c[_0x95e5('0x43')]==='contact'){logger[_0x95e5('0x1e')](_0x95e5('0x44'),_0x1fb272,_0x479a8c[_0x95e5('0x43')]);_0x325aa1['LastName']=_0x289eb5!==_0x95e5('0x45')?_0x289eb5:util[_0x95e5('0x46')](_0x95e5('0x47'),_0x1fb272);}else if(_0x479a8c[_0x95e5('0x43')]==='lead'){logger[_0x95e5('0x1e')](_0x95e5('0x44'),_0x1fb272,_0x479a8c['moduleCreate']);_0x325aa1['LastName']=_0x289eb5!==_0x95e5('0x45')?_0x289eb5:util[_0x95e5('0x46')]('Caller\x20-\x20%s',_0x1fb272);_0x325aa1[_0x95e5('0x48')]='No\x20Company';}else if(_0x479a8c[_0x95e5('0x43')]===_0x95e5('0x1c')){logger['info'](_0x95e5('0x44'),_0x1fb272,_0x479a8c[_0x95e5('0x43')]);_0x325aa1[_0x95e5('0x2b')]=_0x289eb5!==''?_0x289eb5:util[_0x95e5('0x46')](_0x95e5('0x47'),_0x1fb272);}else{return null;}}return _0x9f46cb[_0x95e5('0x22')](_[_0x95e5('0x49')](_0x479a8c[_0x95e5('0x43')]))[_0x95e5('0x1f')](_0x325aa1)['then'](function(_0x1102f6){return BPromise[_0x95e5('0x2a')]({'id':_0x1102f6['id'],'endUserType':_0x479a8c[_0x95e5('0x43')]});});}});}function getCustomFields(_0x12cc6e,_0x4e6e9b){var _0x3a99b1={};if(_0x12cc6e[_0x95e5('0x27')]>0x0){_[_0x95e5('0x4a')](_0x12cc6e,function(_0x241fa7){if(_[_0x95e5('0x4b')](['string',_0x95e5('0x4c')],_0x241fa7[_0x95e5('0x3f')])&&_0x241fa7[_0x95e5('0x4d')]){_0x3a99b1[_0x241fa7[_0x95e5('0x4d')]]=_0x241fa7[_0x95e5('0x4e')][_0x95e5('0x4f')]();}else if(_0x241fa7['type']===_0x95e5('0x50')&&_0x241fa7[_0x95e5('0x51')]&&_0x241fa7[_0x95e5('0x4d')]){_0x4e6e9b[_0x241fa7[_0x95e5('0x51')]]&&(_0x3a99b1[_0x241fa7['idField']]=_0x4e6e9b[_0x241fa7[_0x95e5('0x51')]]['toString']());}else if(_0x241fa7[_0x95e5('0x3f')]===_0x95e5('0x52')&&_0x241fa7[_0x95e5('0x53')]&&_0x241fa7[_0x95e5('0x53')][_0x95e5('0x54')]&&_0x241fa7['idField']){_0x4e6e9b[_0x241fa7[_0x95e5('0x53')][_0x95e5('0x54')]['toLowerCase']()]&&(_0x3a99b1[_0x241fa7[_0x95e5('0x4d')]]=_0x4e6e9b[_0x241fa7['Variable'][_0x95e5('0x54')][_0x95e5('0x40')]()][_0x95e5('0x4f')]());}});}return _0x3a99b1;}function getConnection(_0x3b2970){var _0xa4507f=_0x3b2970[_0x95e5('0x55')]['concat'](_0x3b2970['securityToken']);var _0x586e57=new jsforce[(_0x95e5('0x56'))]({'oauth2':{'loginUrl':_0x3b2970[_0x95e5('0x57')]||'https://login.salesforce.com','clientId':_0x3b2970[_0x95e5('0x58')],'clientSecret':_0x3b2970[_0x95e5('0x59')]}});return _0x586e57[_0x95e5('0x5a')](_0x3b2970[_0x95e5('0x5b')],_0xa4507f)[_0x95e5('0x26')](function(){logger[_0x95e5('0x1e')](_0x95e5('0x5c'));return _0x586e57;});}exports[_0x95e5('0x5d')]=function(_0xb1619f,_0x12b92b,_0x4622ee,_0x580cb,_0x45d5b5,_0x3c2f4c){var _0x3cd3d9,_0x39b4dc,_0x510845,_0x86984a;_0x3c2f4c['serverUrl']=intUtil[_0x95e5('0x5e')](_0x3c2f4c[_0x95e5('0x5f')]);_0x3c2f4c[_0x95e5('0x57')]=intUtil[_0x95e5('0x5e')](_0x3c2f4c[_0x95e5('0x57')]);if(_0x45d5b5&&_0x45d5b5['monitor_format']){logger['info']('[QUEUE]',_0x95e5('0x60'));_0x12b92b[_0x95e5('0x61')]=util[_0x95e5('0x46')](_0x95e5('0x62'),_0x3c2f4c[_0x95e5('0x5f')],_0x12b92b['uniqueid'],md5(_0x12b92b['uniqueid']));}else{_0x12b92b[_0x95e5('0x61')]='';}return getConnection(_0x3c2f4c)[_0x95e5('0x26')](function(_0x403c03){_0x86984a=_0x403c03;return getUser(_0x3c2f4c,_0x580cb['email'],_0x86984a);})[_0x95e5('0x26')](function(_0x17fa2a){_0x3cd3d9=_0x17fa2a;return getEndUser(_0x3c2f4c,_0x4622ee,_0x12b92b[_0x95e5('0x63')],_0x12b92b[_0x95e5('0x64')],_0x86984a);})[_0x95e5('0x26')](function(_0x54e95d){_0x39b4dc=_0x54e95d;return getTicket(_0x3c2f4c,_0x3cd3d9,_0x39b4dc,_0x4622ee,_0x12b92b,_0x4622ee['Fields'],_0x86984a,'queue');})[_0x95e5('0x26')](function(_0xfb6a29){_0x510845=_0xfb6a29;logger[_0x95e5('0x1e')](_0x95e5('0x65'),_0x510845['id']);logger[_0x95e5('0x1e')](_0x95e5('0x66'),_0x510845['id'],_0x580cb['name'],_0x3c2f4c['type']);switch(_0x3c2f4c[_0x95e5('0x3f')]){case _0x95e5('0x67'):emit(util[_0x95e5('0x46')]('user:%s',_0x580cb['name']),_0x95e5('0x68'),{'recordId':_0x510845['id']});break;case _0x95e5('0x69'):emit(util[_0x95e5('0x46')]('user:%s',_0x580cb[_0x95e5('0x54')]),_0x95e5('0x6a'),{'uri':util[_0x95e5('0x46')](_0x95e5('0x6b'),_0x86984a[_0x95e5('0x6c')],_0x510845['id'])});break;default:logger['error'](_0x95e5('0x6d'));}})['catch'](function(_0xa73fef){logger['error'](_0x95e5('0x6e'),_0xa73fef);});};exports['outbound']=function(_0xafb76f,_0x2af382,_0x43f5bb,_0x430af1,_0x55d54d,_0x5c3951,_0x53f83d){var _0x475c86,_0x5c4cdf,_0x1a8fe9,_0x23f746;_0x5c3951['serverUrl']=intUtil['stripTrailingSlash'](_0x5c3951[_0x95e5('0x5f')]);_0x5c3951[_0x95e5('0x57')]=intUtil[_0x95e5('0x5e')](_0x5c3951['remoteUri']);if(_0x53f83d&&_0x53f83d[_0x95e5('0x6f')]&&_0x53f83d[_0x95e5('0x6f')]!==_0x95e5('0x70')){logger[_0x95e5('0x1e')](_0x95e5('0x71'),'Recording\x20is\x20enabled!');_0x2af382[_0x95e5('0x61')]=util[_0x95e5('0x46')](_0x95e5('0x62'),_0x5c3951[_0x95e5('0x5f')],_0x2af382[_0x95e5('0x72')],md5(_0x2af382[_0x95e5('0x72')]));}return getConnection(_0x5c3951)['then'](function(_0x8570b4){_0x23f746=_0x8570b4;return getUser(_0x5c3951,_0x430af1[_0x95e5('0x73')],_0x23f746);})[_0x95e5('0x26')](function(_0x34333e){_0x475c86=_0x34333e;return getEndUser(_0x5c3951,_0x43f5bb,_0x2af382['destcalleridname'],_0x2af382['destcalleridnum'],_0x23f746);})[_0x95e5('0x26')](function(_0x41feaf){_0x5c4cdf=_0x41feaf;return getTicket(_0x5c3951,_0x475c86,_0x5c4cdf,_0x43f5bb,_0x2af382,_0x43f5bb[_0x95e5('0x74')],_0x23f746,_0x95e5('0x75'));})[_0x95e5('0x26')](function(_0x2b7f39){_0x1a8fe9=_0x2b7f39;logger[_0x95e5('0x1e')](_0x95e5('0x76'),_0x1a8fe9['id']);logger['info'](_0x95e5('0x77'),_0x1a8fe9['id'],_0x430af1['name'],_0x5c3951[_0x95e5('0x3f')]);switch(_0x5c3951[_0x95e5('0x3f')]){case _0x95e5('0x67'):emit(util['format'](_0x95e5('0x78'),_0x430af1[_0x95e5('0x54')]),'trigger:salesforce:display',{'recordId':_0x1a8fe9['id']});break;case _0x95e5('0x69'):emit(util[_0x95e5('0x46')](_0x95e5('0x78'),_0x430af1[_0x95e5('0x54')]),_0x95e5('0x6a'),{'uri':util[_0x95e5('0x46')](_0x95e5('0x6b'),_0x23f746[_0x95e5('0x6c')],_0x1a8fe9['id'])});break;default:logger[_0x95e5('0x79')](_0x95e5('0x71'),_0x95e5('0x7a'));}})[_0x95e5('0x7b')](function(_0x47d444){logger['error']('[OUTBOUND]',_0x47d444);});};exports['unmanaged']=function(_0x5338f7,_0x1e9fac,_0x1ca2e8,_0x20c75a,_0x337571,_0x3651a4){var _0x358313,_0x3cc9cd,_0xd6c3bf,_0x13e62e;_0x3651a4['serverUrl']=intUtil['stripTrailingSlash'](_0x3651a4[_0x95e5('0x5f')]);_0x3651a4[_0x95e5('0x57')]=intUtil[_0x95e5('0x5e')](_0x3651a4[_0x95e5('0x57')]);if(_0x337571&&_0x337571[_0x95e5('0x7c')]){logger[_0x95e5('0x1e')]('['+_0x1e9fac['lastevent'][_0x95e5('0x7d')]()+']',_0x95e5('0x60'));_0x1e9fac[_0x95e5('0x61')]=util[_0x95e5('0x46')](_0x95e5('0x62'),_0x3651a4['serverUrl'],_0x1e9fac[_0x95e5('0x72')],md5(_0x1e9fac[_0x95e5('0x72')]));}else{_0x1e9fac[_0x95e5('0x61')]='';}return getConnection(_0x3651a4)[_0x95e5('0x26')](function(_0x5afe8a){_0x13e62e=_0x5afe8a;if(!_['isNil'](_0x20c75a)){return getUser(_0x3651a4,_0x20c75a[_0x95e5('0x54')],_0x13e62e);}else{return getUser(_0x3651a4,null,_0x13e62e);}})[_0x95e5('0x26')](function(_0xa84c76){_0x358313=_0xa84c76;return getEndUser(_0x3651a4,_0x1ca2e8,_0x1e9fac[_0x95e5('0x63')],_0x1e9fac['calleridnum'],_0x13e62e);})[_0x95e5('0x26')](function(_0x11d2f6){_0x3cc9cd=_0x11d2f6;return getTicket(_0x3651a4,_0x358313,_0x3cc9cd,_0x1ca2e8,_0x1e9fac,_0x1ca2e8[_0x95e5('0x74')],_0x13e62e);})['then'](function(_0x558c95){_0xd6c3bf=_0x558c95;logger[_0x95e5('0x1e')]('['+_0x1e9fac[_0x95e5('0x7e')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0xd6c3bf['id']);logger[_0x95e5('0x1e')]('['+_0x1e9fac[_0x95e5('0x7e')][_0x95e5('0x7d')]()+_0x95e5('0x7f'),_0x3651a4['type']);})['catch'](function(_0x2c6cce){logger[_0x95e5('0x79')]('['+_0x1e9fac[_0x95e5('0x7e')]['toUpperCase']()+']',_0x2c6cce);});}; \ 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 7799a30..7920e3c 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 _0xb99b=['ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','userEmail','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','nameField','customField','toLowerCase','toString','includes','type','idField','content','variable','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId'];(function(_0x3e52b7,_0x3561a8){var _0x3d902c=function(_0x4b14e2){while(--_0x4b14e2){_0x3e52b7['push'](_0x3e52b7['shift']());}};_0x3d902c(++_0x3561a8);}(_0xb99b,0x1e1));var _0xbb99=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb99b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var Promise=require(_0xbb99('0x0'));var rp=require(_0xbb99('0x1'));var util=require(_0xbb99('0x2'));var md5=require(_0xbb99('0x3'));var Redis=require(_0xbb99('0x4'));var intUtil=require(_0xbb99('0x5'));var config=require(_0xbb99('0x6'));var logger=require(_0xbb99('0x7'))('servicenow');config[_0xbb99('0x8')]=_[_0xbb99('0x9')](config[_0xbb99('0x8')],{'host':_0xbb99('0xa'),'port':0x18eb});var io=require(_0xbb99('0xb'))(new Redis(config[_0xbb99('0x8')]));function getAdminUser(_0x41f851,_0x3a37ea,_0x4d7a03,_0x3bfe0d,_0x2830bb,_0x538ebf){return new Promise(function(_0x4b444b,_0x5cf4b9){var _0x522c45={'method':'GET','uri':_0x3bfe0d+_0xbb99('0xc')+'&'+_0x2830bb+'&'+_0x538ebf,'auth':_0x3a37ea,'json':!![]};return rp(_0x522c45)[_0xbb99('0xd')](function(_0xdba28a){if(_0xdba28a[_0xbb99('0xe')][_0xbb99('0xf')]>0x0){_0x4d7a03[_0xbb99('0x10')]=_0xdba28a['result'][0x0][_0xbb99('0x11')];}logger[_0xbb99('0x12')]('['+[_0x41f851[_0xbb99('0x13')]()]+_0xbb99('0x14'),_0x4d7a03);_0x4b444b(_0x4d7a03);})['catch'](function(_0x46b641){logger[_0xbb99('0x15')]('['+[_0x41f851[_0xbb99('0x13')]()]+']',_0x46b641[_0xbb99('0x16')]);_0x5cf4b9(_0x46b641[_0xbb99('0x16')]);});});}function getUser(_0x13bc9c,_0x21e0e0,_0x594531,_0x26f52a,_0x1978ac){return function(_0x1ab04f){logger['info']('['+[_0x13bc9c[_0xbb99('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x1ab04f);return new Promise(function(_0x4bfe82,_0x5c17fc){if(intUtil['validateEmail'](_0x1ab04f['userEmail'])){var _0x16cca8={'method':_0xbb99('0x17'),'uri':_0x594531+_0xbb99('0x18')+_0x1ab04f['userEmail']+'&'+_0x26f52a+'&'+_0x1978ac,'auth':_0x21e0e0,'json':!![]};logger[_0xbb99('0x12')]('['+[_0x13bc9c[_0xbb99('0x13')]()]+_0xbb99('0x19'),_0x16cca8);return rp(_0x16cca8)[_0xbb99('0xd')](function(_0xb2a1b){logger[_0xbb99('0x12')]('['+[_0x13bc9c[_0xbb99('0x13')]()]+_0xbb99('0x1a'),_0xb2a1b);if(_0xb2a1b[_0xbb99('0xe')][_0xbb99('0xf')]>0x0&&String(_0xb2a1b[_0xbb99('0xe')][0x0]['active'])===_0xbb99('0x1b')){_0x1ab04f[_0xbb99('0x1c')]=_0xb2a1b[_0xbb99('0xe')][0x0][_0xbb99('0x11')];}else{_0x1ab04f[_0xbb99('0x1c')]=_0x1ab04f['adminId'];_0x1ab04f[_0xbb99('0x1d')]=_0x1ab04f[_0xbb99('0x1e')];}logger[_0xbb99('0x12')]('['+[_0x13bc9c[_0xbb99('0x13')]()]+_0xbb99('0x1f'),_0x1ab04f);_0x4bfe82(_0x1ab04f);})[_0xbb99('0x20')](function(_0x128524){logger[_0xbb99('0x15')]('['+[_0x13bc9c[_0xbb99('0x13')]()]+']',_0x128524['message']);_0x5c17fc(_0x128524[_0xbb99('0x16')]);});}else{logger['info']('['+[_0x13bc9c['toUpperCase']()]+_0xbb99('0x21'));_0x1ab04f[_0xbb99('0x1c')]=_0x1ab04f[_0xbb99('0x10')];_0x1ab04f['userEmail']=_0x1ab04f[_0xbb99('0x1e')];_0x4bfe82(_0x1ab04f);}});};}function createEndUser(_0x5163f7,_0x25f4f7,_0x8410cb,_0xbe8771,_0xc4b1ec){logger[_0xbb99('0x12')]('['+[_0x5163f7[_0xbb99('0x13')]()]+_0xbb99('0x22'),_0x8410cb);return new Promise(function(_0x110e94,_0x33fcf1){var _0xace172={'method':_0xbb99('0x23'),'uri':_0xbe8771+_0xbb99('0x24')+_0xc4b1ec,'body':{'user_name':_0x8410cb[_0xbb99('0x25')],'roles':_0xbb99('0x26'),'first_name':_0x8410cb[_0xbb99('0x25')],'active':'true','date_format':_0xbb99('0x27'),'phone':_0x8410cb[_0xbb99('0x25')]},'auth':_0x25f4f7,'json':!![]};return rp(_0xace172)[_0xbb99('0xd')](function(_0x4ce14e){logger[_0xbb99('0x12')]('['+[_0x5163f7['toUpperCase']()]+'],\x20EndUser\x20schema',_0x4ce14e[_0xbb99('0xe')]);_0x8410cb[_0xbb99('0x28')]=_0x4ce14e[_0xbb99('0xe')][_0xbb99('0x11')];_0x110e94(_0x8410cb);})['catch'](function(_0xd085e7){logger[_0xbb99('0x15')]('['+[_0x5163f7[_0xbb99('0x13')]()]+']',_0xd085e7[_0xbb99('0x16')]);_0x33fcf1(_0xd085e7[_0xbb99('0x16')]);});});}function getEndUser(_0x5b756b,_0x5b2bca,_0x298954,_0x3d120b,_0x35e1bf){return function(_0x265ce0){logger[_0xbb99('0x12')]('['+[_0x5b756b[_0xbb99('0x13')]()]+_0xbb99('0x29'),_0x265ce0);return new Promise(function(_0x326ee4,_0x4821f6){var _0x3a7691={'method':_0xbb99('0x17'),'uri':_0x298954+_0xbb99('0x2a')+_0x265ce0[_0xbb99('0x25')]+'&'+_0x3d120b+'&'+_0x35e1bf,'auth':_0x5b2bca,'json':!![]};return rp(_0x3a7691)[_0xbb99('0xd')](function(_0x210141){if(_0x210141[_0xbb99('0xe')][_0xbb99('0xf')]>0x0){_0x265ce0[_0xbb99('0x28')]=_0x210141[_0xbb99('0xe')][0x0][_0xbb99('0x11')];logger[_0xbb99('0x12')]('['+[_0x5b756b[_0xbb99('0x13')]()]+_0xbb99('0x2b'),_0x265ce0);_0x326ee4(_0x265ce0);}else{return createEndUser(_0x5b756b,_0x5b2bca,_0x265ce0,_0x298954,_0x3d120b)[_0xbb99('0xd')](function(_0x45fe7e){logger[_0xbb99('0x12')]('['+[_0x5b756b[_0xbb99('0x13')]()]+_0xbb99('0x2c'),_0x45fe7e);_0x326ee4(_0x45fe7e);});}})[_0xbb99('0x20')](function(_0x26822e){logger[_0xbb99('0x15')]('['+[_0x5b756b['toUpperCase']()]+']',_0x26822e[_0xbb99('0x16')]);_0x4821f6(_0x26822e['message']);});});};}function getCustomFields(_0x3c8d62,_0x4fed01){var _0x722f22={};if(_0x3c8d62[_0xbb99('0xf')]>0x0){_['forEach'](_0x3c8d62,function(_0x34f248){if(_['includes']([_0xbb99('0x2d'),_0xbb99('0x2e')],_0x34f248['type'])&&_0x34f248[_0xbb99('0x2f')]&&!_0x34f248[_0xbb99('0x30')]){_0x722f22[_0x34f248['nameField'][_0xbb99('0x31')]()]=_0x34f248['content'][_0xbb99('0x32')]();}else if(_[_0xbb99('0x33')]([_0xbb99('0x2d'),_0xbb99('0x2e')],_0x34f248[_0xbb99('0x34')])&&_0x34f248['idField']&&_0x34f248[_0xbb99('0x30')]){_0x722f22[_0x34f248[_0xbb99('0x35')][_0xbb99('0x31')]()]=_0x34f248[_0xbb99('0x36')][_0xbb99('0x32')]();}else if(_0x34f248[_0xbb99('0x34')]===_0xbb99('0x37')&&_0x34f248[_0xbb99('0x38')]&&_0x34f248[_0xbb99('0x35')]&&_0x34f248['customField']){_0x722f22[_0x34f248[_0xbb99('0x35')][_0xbb99('0x31')]()]=_0x4fed01[_0x34f248[_0xbb99('0x38')]][_0xbb99('0x32')]();}else if(_0x34f248[_0xbb99('0x34')]===_0xbb99('0x39')&&_0x34f248[_0xbb99('0x3a')]&&_0x34f248['Variable'][_0xbb99('0x3b')]&&_0x34f248[_0xbb99('0x35')]&&_0x34f248[_0xbb99('0x30')]){_0x722f22[_0x34f248[_0xbb99('0x35')][_0xbb99('0x31')]()]=_0x4fed01[_0x34f248[_0xbb99('0x3a')][_0xbb99('0x3b')]['toLowerCase']()][_0xbb99('0x32')]();}});}return _0x722f22;}function getTicket(_0x313287,_0x545bfe,_0x42004d,_0x27ae95,_0x555f5c,_0x1e9ac0){return function(_0x28b64d){logger[_0xbb99('0x12')]('['+[_0x313287[_0xbb99('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x28b64d);return new Promise(function(_0x6d5fac,_0x477a92){var _0x59cc96=_0x313287[_0xbb99('0x31')]()===_0xbb99('0x3c')?_0x28b64d[_0xbb99('0x1c')]:_0x28b64d[_0xbb99('0x28')];var _0xda50d1={'method':_0xbb99('0x23'),'uri':_0x42004d+_0xbb99('0x3d')+'?'+_0x1e9ac0,'body':Object[_0xbb99('0x3e')]({},{'active':_0xbb99('0x1b'),'caller_id':_0x59cc96,'assigned_to':_0x28b64d['userId'],'short_description':intUtil[_0xbb99('0x3f')](_0x27ae95[_0xbb99('0x40')],_0x555f5c,'\x20'),'description':intUtil[_0xbb99('0x3f')](_0x27ae95[_0xbb99('0x41')],_0x555f5c,'\x0a')},getCustomFields(_0x27ae95[_0xbb99('0x42')],_0x555f5c)),'auth':_0x545bfe,'json':!![]};return rp(_0xda50d1)[_0xbb99('0xd')](function(_0x11a537){logger[_0xbb99('0x12')]('['+[_0x313287[_0xbb99('0x13')]()]+_0xbb99('0x43'),_0x11a537['result']);_0x28b64d[_0xbb99('0x44')]=_0x11a537[_0xbb99('0xe')]['sys_id'];_0x28b64d[_0xbb99('0x45')]=_0x11a537['result'][_0xbb99('0x46')];logger[_0xbb99('0x12')]('['+[_0x313287[_0xbb99('0x13')]()]+_0xbb99('0x47'),_0x28b64d);_0x6d5fac(_0x28b64d);})['catch'](function(_0x223213){logger['error']('['+[_0x313287['toUpperCase']()]+']',_0x223213[_0xbb99('0x16')]);_0x477a92(_0x223213[_0xbb99('0x16')]);});});};}function createRemoteTag(_0x475cfd,_0x66d39f,_0x462751,_0x24b4cd){return new Promise(function(_0x4ece3f,_0x57f2b2){var _0x44bf9d={'method':'POST','uri':_0x462751+'label'+'?'+_0x24b4cd,'body':{'short_description':_0x475cfd,'global':!![],'active':!![],'name':_0x475cfd},'auth':_0x66d39f,'json':!![]};return rp(_0x44bf9d)[_0xbb99('0xd')](function(_0x2e46de){var _0x34a9d4=_0x2e46de[_0xbb99('0xe')]['sys_id'];_0x4ece3f(_0x34a9d4);});});}function getRemoteTag(_0x3fb5b6,_0x575ef1,_0x14dceb,_0x5c02cd,_0x4a5bd3){return new Promise(function(_0x344f9b,_0x3b2e38){var _0x5f0d48={'method':_0xbb99('0x17'),'uri':_0x14dceb+_0xbb99('0x48')+_0xbb99('0x49')+_0x3fb5b6+'&'+_0x5c02cd,'auth':_0x575ef1,'json':!![]};return rp(_0x5f0d48)[_0xbb99('0xd')](function(_0x430a37){if(_0x430a37[_0xbb99('0xe')][_0xbb99('0xf')]>0x0){var _0x577a04=_0x430a37[_0xbb99('0xe')][0x0][_0xbb99('0x11')];_0x344f9b(_0x577a04);}else{return createRemoteTag(_0x3fb5b6,_0x575ef1,_0x14dceb,_0x5c02cd)[_0xbb99('0xd')](function(_0x2390e3){_0x344f9b(_0x2390e3);});}});});}function assignTagToIncident(_0x21779b,_0x1ccec9,_0xb2658c,_0x3ad37e,_0x3c3f63){return new Promise(function(_0x3b4273,_0x187aa2){var _0x4dd836={'method':_0xbb99('0x23'),'uri':_0xb2658c+'label_entry'+'?'+_0x3c3f63,'body':{'label':_0x21779b,'table':'incident','id_type':_0xbb99('0x4a'),'table_key':_0x3ad37e[_0xbb99('0x44')],'title':'Incident\x20-\x20'+_0x3ad37e[_0xbb99('0x45')],'id_display':_0x3ad37e[_0xbb99('0x45')]},'auth':_0x1ccec9,'json':!![]};return rp(_0x4dd836)[_0xbb99('0xd')](function(_0x2f7778){_0x3b4273();})[_0xbb99('0x20')](function(){_0x3b4273();});});}function manageTags(_0x399427,_0x15574a,_0x477a91,_0x4dec0d,_0x35addf,_0x35f382,_0x9f1d9b){return new Promise(function(_0x12fb51,_0x7395cc){var _0x2a1a25=[];_0x15574a[_0xbb99('0x4b')](function(_0x232e9f){_0x2a1a25[_0xbb99('0x4c')](getRemoteTag(_0x232e9f,_0x477a91,_0x4dec0d,_0x35f382,_0x9f1d9b));});return Promise[_0xbb99('0x4d')](_0x2a1a25)['then'](function(_0x316424){if(_0x316424['length']){logger[_0xbb99('0x12')]('['+[_0x399427[_0xbb99('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x316424);var _0x212747=[];_0x316424[_0xbb99('0x4b')](function(_0x59da21){_0x212747[_0xbb99('0x4c')](assignTagToIncident(_0x59da21,_0x477a91,_0x4dec0d,_0x35addf,_0x35f382));});return Promise[_0xbb99('0x4d')](_0x212747)[_0xbb99('0xd')](function(){_0x12fb51();})[_0xbb99('0x20')](function(){_0x12fb51();});}else{_0x12fb51();}});});}function getTags(_0xe9f666,_0xc31faa,_0x258635,_0x366a91,_0x5eca57,_0x30e008){return function(_0x3b8b23){return new Promise(function(_0x53929b,_0x22a346){var _0x32ecbe=[];var _0x29de1d=_0x366a91[_0xbb99('0x4e')];if(_0x29de1d&&_0x29de1d[_0xbb99('0xf')]>0x0){_0x32ecbe=_['map'](_0x29de1d,'name');}if(_0x32ecbe[_0xbb99('0xf')]>0x0){return manageTags(_0xe9f666,_0x32ecbe,_0xc31faa,_0x258635,_0x3b8b23,_0x5eca57,_0x30e008)['then'](function(){_0x53929b(_0x3b8b23);});}else{_0x53929b(_0x3b8b23);}});};}function emit(_0x48256a,_0xa85155,_0x594807){var _0x2ebd91=_0xbb99('0x4f')+_0xbb99('0x50')+_0xbb99('0x51')+_0xbb99('0x52');var _0x3bcb07={'uri':_0x48256a+_0xbb99('0x53')+_0x594807+_0x2ebd91};io['to'](util[_0xbb99('0x54')](_0xbb99('0x55'),_0xa85155))[_0xbb99('0x56')](_0xbb99('0x57'),_0x3bcb07);}exports['cs']=function(_0x1b8887,_0x1b44e8,_0x1330c0,_0x9221be,_0x5ca04d,_0x5183b4,_0x4d2e11,_0x52919e){var _0x1da29f={};var _0xf33cf6={'user':_0x5183b4[_0xbb99('0x58')],'pass':_0x5183b4[_0xbb99('0x59')]};var _0x3cead4=_0xbb99('0x5a');var _0x37c461='sysparm_display_value=true';_0x5183b4['remoteUri']=intUtil[_0xbb99('0x5b')](_0x5183b4['remoteUri']);_0x5183b4['serverUrl']=intUtil[_0xbb99('0x5b')](_0x5183b4['serverUrl']);var _0x36b45b=util['format'](_0xbb99('0x5c'),_0x5183b4[_0xbb99('0x5d')]);_0x1da29f[_0xbb99('0x1d')]=!_['isNil'](_0x9221be)?_0x9221be['email']:null;_0x1da29f[_0xbb99('0x1e')]=_0x5183b4[_0xbb99('0x5e')];_0x1da29f['endUserNumber']=_0x52919e[_0xbb99('0x31')]()==='outbound'?_0x1b44e8[_0xbb99('0x5f')]:_0x1b44e8[_0xbb99('0x60')];_0x1da29f[_0xbb99('0x61')]=_0x52919e===_0xbb99('0x62')||_0x52919e==='unmanaged'?'queue':_0xbb99('0x3c');var _0x9769b9=util['format'](_0xbb99('0x63'),_0x5183b4['serverUrl'],_0x1b44e8['uniqueid'],md5(_0x1b44e8[_0xbb99('0x64')]));if(_0x5ca04d&&_0x5ca04d['monitor_format']){logger[_0xbb99('0x12')](_0xbb99('0x65'),_0xbb99('0x66'));_0x1b44e8['recordingURL']=_0x9769b9;}else if(_0x4d2e11&&_0x4d2e11[_0xbb99('0x67')]&&_0x4d2e11[_0xbb99('0x67')]!=='none'){logger[_0xbb99('0x12')](_0xbb99('0x68'),'Recording\x20is\x20enabled!');_0x1b44e8[_0xbb99('0x69')]=_0x9769b9;}else{_0x1b44e8[_0xbb99('0x69')]='';}return getAdminUser(_0x52919e,_0xf33cf6,_0x1da29f,_0x36b45b,_0x37c461,_0x3cead4)['then'](getUser(_0x52919e,_0xf33cf6,_0x36b45b,_0x37c461,_0x3cead4))[_0xbb99('0xd')](getEndUser(_0x52919e,_0xf33cf6,_0x36b45b,_0x37c461,_0x3cead4))['then'](getTicket(_0x52919e,_0xf33cf6,_0x36b45b,_0x1330c0,_0x1b44e8,_0x37c461))['then'](function(_0x3b8ed3){logger[_0xbb99('0x12')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x3b8ed3[_0xbb99('0x44')]));logger[_0xbb99('0x12')](util['format'](_0xbb99('0x6a'),_0x52919e));if(_0x52919e!==_0xbb99('0x6b')){logger['info']('['+[_0x52919e[_0xbb99('0x13')]()]+']',_0xbb99('0x6c'));emit(_0x5183b4[_0xbb99('0x5d')],_0x9221be['name'],_0x3b8ed3['ticketId']);}})['catch'](function(_0x495310){logger[_0xbb99('0x15')]('['+[_0x52919e[_0xbb99('0x13')]()]+_0xbb99('0x6d'),util['inspect'](_0x495310,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4643=['md5','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','socket.io-emitter','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','catch','error','toUpperCase','message','userEmail','sys_user?sysparm_query=email%3D','active','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','picklist','customField','nameField','toLowerCase','content','toString','type','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util'];(function(_0x3b2bf2,_0x39af0c){var _0x1f3c21=function(_0x288949){while(--_0x288949){_0x3b2bf2['push'](_0x3b2bf2['shift']());}};_0x1f3c21(++_0x39af0c);}(_0x4643,0x12c));var _0x3464=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x4643[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x3464('0x0'));var Promise=require('bluebird');var rp=require(_0x3464('0x1'));var util=require(_0x3464('0x2'));var md5=require(_0x3464('0x3'));var Redis=require(_0x3464('0x4'));var intUtil=require(_0x3464('0x5'));var config=require(_0x3464('0x6'));var logger=require(_0x3464('0x7'))('servicenow');config['redis']=_[_0x3464('0x8')](config['redis'],{'host':_0x3464('0x9'),'port':0x18eb});var io=require(_0x3464('0xa'))(new Redis(config[_0x3464('0xb')]));function getAdminUser(_0x5c4cbd,_0x1d0f60,_0x254a92,_0x4cf50d,_0x1b6f5e,_0x3ba428){return new Promise(function(_0x3de095,_0x7b182f){var _0x457669={'method':_0x3464('0xc'),'uri':_0x4cf50d+_0x3464('0xd')+'&'+_0x1b6f5e+'&'+_0x3ba428,'auth':_0x1d0f60,'json':!![]};return rp(_0x457669)[_0x3464('0xe')](function(_0x31acb8){if(_0x31acb8[_0x3464('0xf')][_0x3464('0x10')]>0x0){_0x254a92['adminId']=_0x31acb8[_0x3464('0xf')][0x0][_0x3464('0x11')];}logger[_0x3464('0x12')]('['+[_0x5c4cbd['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x254a92);_0x3de095(_0x254a92);})[_0x3464('0x13')](function(_0x20ba43){logger[_0x3464('0x14')]('['+[_0x5c4cbd[_0x3464('0x15')]()]+']',_0x20ba43[_0x3464('0x16')]);_0x7b182f(_0x20ba43[_0x3464('0x16')]);});});}function getUser(_0x4caf0a,_0x3aa5be,_0x4b98b4,_0x306c3f,_0x1801e7){return function(_0x57ac24){logger[_0x3464('0x12')]('['+[_0x4caf0a[_0x3464('0x15')]()]+'],\x20getUser\x20input\x20crm',_0x57ac24);return new Promise(function(_0x54342f,_0x47795f){if(intUtil['validateEmail'](_0x57ac24[_0x3464('0x17')])){var _0x41ad0c={'method':_0x3464('0xc'),'uri':_0x4b98b4+_0x3464('0x18')+_0x57ac24[_0x3464('0x17')]+'&'+_0x306c3f+'&'+_0x1801e7,'auth':_0x3aa5be,'json':!![]};logger[_0x3464('0x12')]('['+[_0x4caf0a[_0x3464('0x15')]()]+'],\x20getUser\x20rp\x20obj',_0x41ad0c);return rp(_0x41ad0c)[_0x3464('0xe')](function(_0x2a1824){logger[_0x3464('0x12')]('['+[_0x4caf0a['toUpperCase']()]+'],\x20getUser\x20entity',_0x2a1824);if(_0x2a1824[_0x3464('0xf')][_0x3464('0x10')]>0x0&&String(_0x2a1824['result'][0x0][_0x3464('0x19')])==='true'){_0x57ac24[_0x3464('0x1a')]=_0x2a1824[_0x3464('0xf')][0x0]['sys_id'];}else{_0x57ac24[_0x3464('0x1a')]=_0x57ac24[_0x3464('0x1b')];_0x57ac24[_0x3464('0x17')]=_0x57ac24[_0x3464('0x1c')];}logger[_0x3464('0x12')]('['+[_0x4caf0a[_0x3464('0x15')]()]+_0x3464('0x1d'),_0x57ac24);_0x54342f(_0x57ac24);})[_0x3464('0x13')](function(_0x53ac53){logger['error']('['+[_0x4caf0a[_0x3464('0x15')]()]+']',_0x53ac53[_0x3464('0x16')]);_0x47795f(_0x53ac53[_0x3464('0x16')]);});}else{logger[_0x3464('0x12')]('['+[_0x4caf0a['toUpperCase']()]+_0x3464('0x1e'));_0x57ac24['userId']=_0x57ac24[_0x3464('0x1b')];_0x57ac24['userEmail']=_0x57ac24['adminEmail'];_0x54342f(_0x57ac24);}});};}function createEndUser(_0xe40832,_0xaff93,_0x36b3e8,_0x27ee77,_0x1a0eeb){logger[_0x3464('0x12')]('['+[_0xe40832[_0x3464('0x15')]()]+_0x3464('0x1f'),_0x36b3e8);return new Promise(function(_0x95b098,_0x429ea3){var _0x1be858={'method':_0x3464('0x20'),'uri':_0x27ee77+'sys_user?'+_0x1a0eeb,'body':{'user_name':_0x36b3e8[_0x3464('0x21')],'roles':_0x3464('0x22'),'first_name':_0x36b3e8[_0x3464('0x21')],'active':_0x3464('0x23'),'date_format':_0x3464('0x24'),'phone':_0x36b3e8[_0x3464('0x21')]},'auth':_0xaff93,'json':!![]};return rp(_0x1be858)[_0x3464('0xe')](function(_0x4a9e91){logger['info']('['+[_0xe40832['toUpperCase']()]+_0x3464('0x25'),_0x4a9e91['result']);_0x36b3e8[_0x3464('0x26')]=_0x4a9e91[_0x3464('0xf')][_0x3464('0x11')];_0x95b098(_0x36b3e8);})[_0x3464('0x13')](function(_0x1f8ec3){logger[_0x3464('0x14')]('['+[_0xe40832[_0x3464('0x15')]()]+']',_0x1f8ec3[_0x3464('0x16')]);_0x429ea3(_0x1f8ec3['message']);});});}function getEndUser(_0x2d6eea,_0x3a99be,_0xb46a3f,_0x1cc496,_0x44aba4){return function(_0x3b9588){logger[_0x3464('0x12')]('['+[_0x2d6eea[_0x3464('0x15')]()]+'],\x20getEndUser\x20input\x20crm',_0x3b9588);return new Promise(function(_0x49009a,_0x5bcc83){var _0x49b002={'method':_0x3464('0xc'),'uri':_0xb46a3f+'sys_user?sysparm_query=phone%3D'+_0x3b9588[_0x3464('0x21')]+'&'+_0x1cc496+'&'+_0x44aba4,'auth':_0x3a99be,'json':!![]};return rp(_0x49b002)[_0x3464('0xe')](function(_0x3cd171){if(_0x3cd171['result'][_0x3464('0x10')]>0x0){_0x3b9588['endUserId']=_0x3cd171[_0x3464('0xf')][0x0][_0x3464('0x11')];logger[_0x3464('0x12')]('['+[_0x2d6eea['toUpperCase']()]+_0x3464('0x27'),_0x3b9588);_0x49009a(_0x3b9588);}else{return createEndUser(_0x2d6eea,_0x3a99be,_0x3b9588,_0xb46a3f,_0x1cc496)[_0x3464('0xe')](function(_0x23a328){logger[_0x3464('0x12')]('['+[_0x2d6eea[_0x3464('0x15')]()]+'],\x20createEndUser\x20crm',_0x23a328);_0x49009a(_0x23a328);});}})[_0x3464('0x13')](function(_0x5925ea){logger['error']('['+[_0x2d6eea[_0x3464('0x15')]()]+']',_0x5925ea[_0x3464('0x16')]);_0x5bcc83(_0x5925ea[_0x3464('0x16')]);});});};}function getCustomFields(_0x25ab1e,_0x4a3f19){var _0xe85fb8={};if(_0x25ab1e[_0x3464('0x10')]>0x0){_[_0x3464('0x28')](_0x25ab1e,function(_0x4994c0){if(_[_0x3464('0x29')]([_0x3464('0x2a'),_0x3464('0x2b')],_0x4994c0['type'])&&_0x4994c0['nameField']&&!_0x4994c0[_0x3464('0x2c')]){_0xe85fb8[_0x4994c0[_0x3464('0x2d')][_0x3464('0x2e')]()]=_0x4994c0[_0x3464('0x2f')][_0x3464('0x30')]();}else if(_['includes']([_0x3464('0x2a'),_0x3464('0x2b')],_0x4994c0[_0x3464('0x31')])&&_0x4994c0[_0x3464('0x32')]&&_0x4994c0['customField']){_0xe85fb8[_0x4994c0[_0x3464('0x32')]['toLowerCase']()]=_0x4994c0[_0x3464('0x2f')][_0x3464('0x30')]();}else if(_0x4994c0['type']==='variable'&&_0x4994c0[_0x3464('0x33')]&&_0x4994c0[_0x3464('0x32')]&&_0x4994c0[_0x3464('0x2c')]){_0xe85fb8[_0x4994c0['idField'][_0x3464('0x2e')]()]=_0x4a3f19[_0x4994c0['variableName']][_0x3464('0x30')]();}else if(_0x4994c0[_0x3464('0x31')]===_0x3464('0x34')&&_0x4994c0[_0x3464('0x35')]&&_0x4994c0['Variable'][_0x3464('0x36')]&&_0x4994c0['idField']&&_0x4994c0[_0x3464('0x2c')]){_0xe85fb8[_0x4994c0[_0x3464('0x32')][_0x3464('0x2e')]()]=_0x4a3f19[_0x4994c0[_0x3464('0x35')]['name'][_0x3464('0x2e')]()][_0x3464('0x30')]();}});}return _0xe85fb8;}function getTicket(_0x195491,_0x3db2d0,_0x36a010,_0x2cd9c8,_0x540996,_0x12ed33){return function(_0x16ca83){logger[_0x3464('0x12')]('['+[_0x195491[_0x3464('0x15')]()]+_0x3464('0x37'),_0x16ca83);return new Promise(function(_0x3e1870,_0x3982f8){var _0x408f34=_0x195491[_0x3464('0x2e')]()===_0x3464('0x38')?_0x16ca83[_0x3464('0x1a')]:_0x16ca83[_0x3464('0x26')];var _0x504030={'method':'POST','uri':_0x36a010+_0x3464('0x39')+'?'+_0x12ed33,'body':Object[_0x3464('0x3a')]({},{'active':'true','caller_id':_0x408f34,'assigned_to':_0x16ca83[_0x3464('0x1a')],'short_description':intUtil[_0x3464('0x3b')](_0x2cd9c8[_0x3464('0x3c')],_0x540996,'\x20'),'description':intUtil[_0x3464('0x3b')](_0x2cd9c8[_0x3464('0x3d')],_0x540996,'\x0a')},getCustomFields(_0x2cd9c8['Fields'],_0x540996)),'auth':_0x3db2d0,'json':!![]};return rp(_0x504030)[_0x3464('0xe')](function(_0x156b4e){logger[_0x3464('0x12')]('['+[_0x195491['toUpperCase']()]+_0x3464('0x3e'),_0x156b4e[_0x3464('0xf')]);_0x16ca83[_0x3464('0x3f')]=_0x156b4e[_0x3464('0xf')]['sys_id'];_0x16ca83[_0x3464('0x40')]=_0x156b4e[_0x3464('0xf')][_0x3464('0x41')];logger[_0x3464('0x12')]('['+[_0x195491[_0x3464('0x15')]()]+_0x3464('0x42'),_0x16ca83);_0x3e1870(_0x16ca83);})[_0x3464('0x13')](function(_0x4b6cfa){logger[_0x3464('0x14')]('['+[_0x195491[_0x3464('0x15')]()]+']',_0x4b6cfa[_0x3464('0x16')]);_0x3982f8(_0x4b6cfa[_0x3464('0x16')]);});});};}function createRemoteTag(_0x1674fd,_0x3e4216,_0x7813b6,_0x4066a6){return new Promise(function(_0x2b6c63,_0x34d728){var _0x165fa7={'method':'POST','uri':_0x7813b6+_0x3464('0x43')+'?'+_0x4066a6,'body':{'short_description':_0x1674fd,'global':!![],'active':!![],'name':_0x1674fd},'auth':_0x3e4216,'json':!![]};return rp(_0x165fa7)[_0x3464('0xe')](function(_0x2e14e9){var _0x1880a6=_0x2e14e9[_0x3464('0xf')][_0x3464('0x11')];_0x2b6c63(_0x1880a6);});});}function getRemoteTag(_0x40a3be,_0x531959,_0xd90f21,_0x55d137,_0xb6099f){return new Promise(function(_0x20e5d8,_0x517ab5){var _0xcf524a={'method':_0x3464('0xc'),'uri':_0xd90f21+_0x3464('0x43')+_0x3464('0x44')+_0x40a3be+'&'+_0x55d137,'auth':_0x531959,'json':!![]};return rp(_0xcf524a)[_0x3464('0xe')](function(_0x35a790){if(_0x35a790[_0x3464('0xf')]['length']>0x0){var _0x54bacf=_0x35a790[_0x3464('0xf')][0x0][_0x3464('0x11')];_0x20e5d8(_0x54bacf);}else{return createRemoteTag(_0x40a3be,_0x531959,_0xd90f21,_0x55d137)[_0x3464('0xe')](function(_0x2de806){_0x20e5d8(_0x2de806);});}});});}function assignTagToIncident(_0x5955c8,_0x1560c7,_0x3a111d,_0x5d91b6,_0x36049e){return new Promise(function(_0x28f518,_0x51d541){var _0x4bf0c8={'method':_0x3464('0x20'),'uri':_0x3a111d+_0x3464('0x45')+'?'+_0x36049e,'body':{'label':_0x5955c8,'table':_0x3464('0x39'),'id_type':'Incident','table_key':_0x5d91b6['ticketId'],'title':_0x3464('0x46')+_0x5d91b6[_0x3464('0x40')],'id_display':_0x5d91b6['ticketNumber']},'auth':_0x1560c7,'json':!![]};return rp(_0x4bf0c8)['then'](function(_0x18b4d4){_0x28f518();})[_0x3464('0x13')](function(){_0x28f518();});});}function manageTags(_0x327bc5,_0xcfd8b1,_0x427d88,_0x5d66b4,_0x5a7d9c,_0x565a30,_0x4995b7){return new Promise(function(_0x36ed3a,_0x453264){var _0x1bdaba=[];_0xcfd8b1[_0x3464('0x28')](function(_0x44c7fc){_0x1bdaba[_0x3464('0x47')](getRemoteTag(_0x44c7fc,_0x427d88,_0x5d66b4,_0x565a30,_0x4995b7));});return Promise[_0x3464('0x48')](_0x1bdaba)['then'](function(_0x2484bc){if(_0x2484bc['length']){logger[_0x3464('0x12')]('['+[_0x327bc5[_0x3464('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x2484bc);var _0x15f889=[];_0x2484bc[_0x3464('0x28')](function(_0xafc5fd){_0x15f889[_0x3464('0x47')](assignTagToIncident(_0xafc5fd,_0x427d88,_0x5d66b4,_0x5a7d9c,_0x565a30));});return Promise[_0x3464('0x48')](_0x15f889)[_0x3464('0xe')](function(){_0x36ed3a();})[_0x3464('0x13')](function(){_0x36ed3a();});}else{_0x36ed3a();}});});}function getTags(_0x4cdaa1,_0x41d2d3,_0x49ce24,_0x195251,_0x59f208,_0x17bdfe){return function(_0x362244){return new Promise(function(_0x279331,_0x2cc999){var _0x3842da=[];var _0x229b09=_0x195251[_0x3464('0x49')];if(_0x229b09&&_0x229b09['length']>0x0){_0x3842da=_[_0x3464('0x4a')](_0x229b09,_0x3464('0x36'));}if(_0x3842da['length']>0x0){return manageTags(_0x4cdaa1,_0x3842da,_0x41d2d3,_0x49ce24,_0x362244,_0x59f208,_0x17bdfe)[_0x3464('0xe')](function(){_0x279331(_0x362244);});}else{_0x279331(_0x362244);}});};}function emit(_0x5f10f3,_0x1a0a0d,_0x11bf89){var _0x3d09d4='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x3464('0x4b')+'%255EORDERBYDESCnumber';var _0x1b3add={'uri':_0x5f10f3+_0x3464('0x4c')+_0x11bf89+_0x3d09d4};io['to'](util[_0x3464('0x4d')]('user:%s',_0x1a0a0d))[_0x3464('0x4e')](_0x3464('0x4f'),_0x1b3add);}exports['cs']=function(_0x1821ee,_0x4bbc23,_0x4dad11,_0x37f091,_0x2762fc,_0x20d70f,_0x4d2adb,_0x45f126){var _0x10f4b0={};var _0x19312a={'user':_0x20d70f['username'],'pass':_0x20d70f['password']};var _0xdd7831='sysparm_limit=1';var _0x4979de='sysparm_display_value=true';_0x20d70f[_0x3464('0x50')]=intUtil[_0x3464('0x51')](_0x20d70f[_0x3464('0x50')]);_0x20d70f[_0x3464('0x52')]=intUtil[_0x3464('0x51')](_0x20d70f[_0x3464('0x52')]);var _0x4cc193=util[_0x3464('0x4d')](_0x3464('0x53'),_0x20d70f['remoteUri']);_0x10f4b0[_0x3464('0x17')]=!_[_0x3464('0x54')](_0x37f091)?_0x37f091[_0x3464('0x55')]:null;_0x10f4b0[_0x3464('0x1c')]=_0x20d70f['email'];_0x10f4b0['endUserNumber']=_0x45f126[_0x3464('0x2e')]()===_0x3464('0x38')?_0x4bbc23['destcalleridnum']:_0x4bbc23[_0x3464('0x56')];_0x10f4b0[_0x3464('0x57')]=_0x45f126===_0x3464('0x58')||_0x45f126==='unmanaged'?_0x3464('0x58'):_0x3464('0x38');var _0x4dced4=util[_0x3464('0x4d')](_0x3464('0x59'),_0x20d70f[_0x3464('0x52')],_0x4bbc23[_0x3464('0x5a')],md5(_0x4bbc23[_0x3464('0x5a')]));if(_0x2762fc&&_0x2762fc[_0x3464('0x5b')]){logger[_0x3464('0x12')](_0x3464('0x5c'),_0x3464('0x5d'));_0x4bbc23[_0x3464('0x5e')]=_0x4dced4;}else if(_0x4d2adb&&_0x4d2adb['recordingFormat']&&_0x4d2adb['recordingFormat']!==_0x3464('0x5f')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4bbc23[_0x3464('0x5e')]=_0x4dced4;}else{_0x4bbc23[_0x3464('0x5e')]='';}return getAdminUser(_0x45f126,_0x19312a,_0x10f4b0,_0x4cc193,_0x4979de,_0xdd7831)['then'](getUser(_0x45f126,_0x19312a,_0x4cc193,_0x4979de,_0xdd7831))['then'](getEndUser(_0x45f126,_0x19312a,_0x4cc193,_0x4979de,_0xdd7831))[_0x3464('0xe')](getTicket(_0x45f126,_0x19312a,_0x4cc193,_0x4dad11,_0x4bbc23,_0x4979de))['then'](function(_0x208bfb){logger[_0x3464('0x12')](util[_0x3464('0x4d')]('The\x20ticket\x20ID\x20is:\x20%s',_0x208bfb[_0x3464('0x3f')]));logger[_0x3464('0x12')](util[_0x3464('0x4d')](_0x3464('0x60'),_0x45f126));if(_0x45f126!==_0x3464('0x61')){logger[_0x3464('0x12')]('['+[_0x45f126[_0x3464('0x15')]()]+']',_0x3464('0x62'));emit(_0x20d70f[_0x3464('0x50')],_0x37f091[_0x3464('0x36')],_0x208bfb[_0x3464('0x3f')]);}})['catch'](function(_0x4750b7){logger['error']('['+[_0x45f126[_0x3464('0x15')]()]+_0x3464('0x63'),util[_0x3464('0x64')](_0x4750b7,{'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 129b60b..79761d6 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 _0xee94=['catch','recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','Outbound','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','error','unmanaged','toUpperCase','Inbound','lastevent','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','toISOString','slice','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','merge','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','push','customVariable','Variable','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x5c42b8,_0x4f54ed){var _0xc6b4ca=function(_0x483abd){while(--_0x483abd){_0x5c42b8['push'](_0x5c42b8['shift']());}};_0xc6b4ca(++_0x4f54ed);}(_0xee94,0x181));var _0x4ee9=function(_0x4a57f9,_0x169b9c){_0x4a57f9=_0x4a57f9-0x0;var _0x449ca8=_0xee94[_0x4a57f9];return _0x449ca8;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x4ee9('0x0'));var md5=require(_0x4ee9('0x1'));var util=require(_0x4ee9('0x2'));var Redis=require('ioredis');var intUtil=require(_0x4ee9('0x3'));var config=require(_0x4ee9('0x4'));var logger=require(_0x4ee9('0x5'))(_0x4ee9('0x6'));config[_0x4ee9('0x7')]=_[_0x4ee9('0x8')](config[_0x4ee9('0x7')],{'host':_0x4ee9('0x9'),'port':0x18eb});var io=require(_0x4ee9('0xa'))(new Redis(config[_0x4ee9('0x7')]));var def={'method':_0x4ee9('0xb'),'json':!![]};function emit(_0x3675a0,_0x21f9b3,_0x5cc602){io['to'](_0x3675a0)[_0x4ee9('0xc')](_0x21f9b3,_0x5cc602);}function getTicket(_0x5216ec,_0x513bce,_0x5f240a,_0x4e93eb,_0x515d34,_0x44c0e7,_0x617b3,_0x1c2074){logger[_0x4ee9('0xd')]('Creating\x20new\x20ticket...');var _0x561e49=new Date();var _0x4a7c7a=[{'name':_0x4ee9('0xe'),'value':intUtil['getString'](_0x4e93eb[_0x4ee9('0xf')],_0x515d34,'\x20')},{'name':_0x4ee9('0x10'),'value':_0x513bce['id']},{'name':_0x4ee9('0x11'),'value':_0x513bce['id']},{'name':_0x4ee9('0x12'),'value':intUtil[_0x4ee9('0x13')](_0x4e93eb[_0x4ee9('0x14')],_0x515d34,'\x0a')},{'name':_0x4ee9('0x15'),'value':_0x561e49[_0x4ee9('0x16')]()[_0x4ee9('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x4ee9('0x18'),'value':'15'},{'name':_0x4ee9('0x19'),'value':_0x5f240a['id']},{'name':_0x4ee9('0x1a'),'value':_0x4ee9('0x1b')},{'name':_0x4ee9('0x1c'),'value':_0x5f240a['name']},{'name':_0x4ee9('0x1d'),'value':_0x1c2074}];if(_0x44c0e7[_0x4ee9('0x1e')]){_[_0x4ee9('0x1f')](_0x44c0e7,function(_0x34f341){if(_0x515d34[_0x34f341[_0x4ee9('0x20')]]){_0x4a7c7a['push']({'name':_0x34f341[_0x4ee9('0x21')],'value':_0x515d34[_0x34f341[_0x4ee9('0x20')]]});}});}return request({'form':{'method':_0x4ee9('0x22'),'input_type':'JSON','response_type':_0x4ee9('0x23'),'rest_data':JSON[_0x4ee9('0x24')]({'session':_0x617b3['id'],'module_name':_0x4ee9('0x25'),'name_value_list':_0x4a7c7a})}});}function getAuth(_0x2488dd){return util[_0x4ee9('0x26')](_0x4ee9('0x27'),new Buffer(_0x2488dd[_0x4ee9('0x28')]+':X')[_0x4ee9('0x29')](_0x4ee9('0x2a')));}function getServerInfo(_0x2193c2){return request({'form':{'method':_0x4ee9('0x2b'),'input_type':_0x4ee9('0x23'),'response_type':'JSON','rest_data':JSON[_0x4ee9('0x24')]({'session':_0x2193c2['id']})}});}function getUser(_0x481016,_0x3a2a7a,_0x14354a){if(!_[_0x4ee9('0x2c')](_0x3a2a7a)){logger[_0x4ee9('0xd')](_0x4ee9('0x2d'),_0x3a2a7a);return request({'form':{'method':'get_entry_list','input_type':_0x4ee9('0x23'),'response_type':_0x4ee9('0x23'),'rest_data':JSON[_0x4ee9('0x24')]({'session':_0x14354a['id'],'module_name':'Employees','query':util[_0x4ee9('0x26')](_0x4ee9('0x2e'),_0x3a2a7a),'order_by':'','offset':'0','select_fields':['id',_0x4ee9('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4ee9('0x2f')](function(_0x402524){if(_0x402524[_0x4ee9('0x30')][_0x4ee9('0x1e')]){var _0x56a0a4=_[_0x4ee9('0x31')](_0x402524[_0x4ee9('0x30')],function(_0xb9a6bf){return _0xb9a6bf[_0x4ee9('0x32')][_0x4ee9('0x33')]['value']===_0x3a2a7a;});if(_0x56a0a4){logger[_0x4ee9('0xd')](_0x4ee9('0x34'));return BPromise[_0x4ee9('0x35')]({'id':_0x56a0a4['name_value_list']['id'][_0x4ee9('0x36')],'name':_0x56a0a4[_0x4ee9('0x32')][_0x4ee9('0xe')][_0x4ee9('0x36')]});}}logger[_0x4ee9('0xd')](_0x4ee9('0x37'));return BPromise['resolve']({'id':_0x14354a[_0x4ee9('0x32')][_0x4ee9('0x38')][_0x4ee9('0x36')],'name':_0x14354a[_0x4ee9('0x32')][_0x4ee9('0x33')]['value']});});}else{logger[_0x4ee9('0xd')](_0x4ee9('0x39'));return BPromise[_0x4ee9('0x35')]({'id':_0x14354a[_0x4ee9('0x32')]['user_id'][_0x4ee9('0x36')],'name':_0x14354a[_0x4ee9('0x32')][_0x4ee9('0x33')][_0x4ee9('0x36')]});}}function getEndUser(_0x3d0bdb,_0x4cf214,_0x51598d,_0x8dd944){logger[_0x4ee9('0xd')](_0x4ee9('0x3a'),_0x51598d);return request({'form':{'method':_0x4ee9('0x3b'),'input_type':_0x4ee9('0x23'),'response_type':_0x4ee9('0x23'),'rest_data':JSON[_0x4ee9('0x24')]({'session':_0x8dd944['id'],'module_name':_0x4ee9('0x1b'),'query':util[_0x4ee9('0x26')](_0x4ee9('0x3c'),_0x51598d),'order_by':'','offset':'0','select_fields':['id',_0x4ee9('0xe'),_0x4ee9('0x3d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4ee9('0x2f')](function(_0x8f8963){if(_0x8f8963[_0x4ee9('0x30')]['length']){var _0x1b30bc=_[_0x4ee9('0x31')](_0x8f8963[_0x4ee9('0x30')],function(_0x438744){return _0x438744['name_value_list'][_0x4ee9('0x3d')][_0x4ee9('0x36')]===_0x51598d;});if(_0x1b30bc){logger[_0x4ee9('0xd')](_0x4ee9('0x3e'));return BPromise['resolve']({'id':_0x1b30bc[_0x4ee9('0x32')]['id'][_0x4ee9('0x36')],'name':_0x1b30bc[_0x4ee9('0x32')]['name'][_0x4ee9('0x36')],'phone':_0x1b30bc[_0x4ee9('0x32')][_0x4ee9('0x3d')][_0x4ee9('0x36')]});}}else{logger[_0x4ee9('0xd')](_0x4ee9('0x3f'));return request({'form':{'method':_0x4ee9('0x22'),'input_type':_0x4ee9('0x23'),'response_type':_0x4ee9('0x23'),'rest_data':JSON[_0x4ee9('0x24')]({'session':_0x8dd944['id'],'module_name':_0x4ee9('0x1b'),'name_value_list':[{'name':'first_name','value':_0x4cf214!==_0x4ee9('0x40')?_0x4cf214:util[_0x4ee9('0x26')](_0x4ee9('0x41'),_0x51598d)},{'name':'phone_home','value':_0x51598d}]})}})[_0x4ee9('0x2f')](function(_0x33a320){logger[_0x4ee9('0xd')](_0x4ee9('0x42'));return BPromise['resolve']({'id':_0x33a320['id'],'name':_0x33a320[_0x4ee9('0x30')][_0x4ee9('0x43')][_0x4ee9('0x36')],'phone':_0x33a320[_0x4ee9('0x30')][_0x4ee9('0x3d')]['value']});});}});}function request(_0x1c557e){logger[_0x4ee9('0x44')]('[HTTP]',JSON['stringify'](_0x1c557e));return rp(_[_0x4ee9('0x45')](def,_0x1c557e));}function getTags(_0x2ae012,_0x20329b){var _0x5f0d5b=[];if(_0x2ae012&&_0x2ae012['length']>0x0){_0x5f0d5b=_['map'](_0x2ae012,_0x20329b);}return _0x5f0d5b;}function getCustomFields(_0x1a2de4,_0x3e5225){var _0x329e7f=[];var _0x36b6f={'custom_fields':[]};if(_0x1a2de4['length']>0x0){_[_0x4ee9('0x1f')](_0x1a2de4,function(_0x4cb4e0){if(_0x4cb4e0[_0x4ee9('0x46')]===_0x4ee9('0x47')&&_0x4cb4e0[_0x4ee9('0x48')]&&!_0x4cb4e0[_0x4ee9('0x49')]){_0x36b6f[_0x4cb4e0[_0x4ee9('0x48')][_0x4ee9('0x4a')]()]=_0x4cb4e0[_0x4ee9('0x4b')][_0x4ee9('0x29')]();}else if(_0x4cb4e0['type']==='string'&&_0x4cb4e0[_0x4ee9('0x21')]&&_0x4cb4e0[_0x4ee9('0x49')]){_0x36b6f[_0x4ee9('0x4c')]['push']({'id':_0x4cb4e0[_0x4ee9('0x21')],'value':_0x4cb4e0[_0x4ee9('0x4b')][_0x4ee9('0x29')]()});}else if(_0x4cb4e0[_0x4ee9('0x46')]===_0x4ee9('0x4d')&&_0x4cb4e0[_0x4ee9('0x20')]&&_0x4cb4e0[_0x4ee9('0x21')]&&_0x4cb4e0[_0x4ee9('0x49')]){_0x3e5225[_0x4cb4e0[_0x4ee9('0x20')]]&&_0x36b6f[_0x4ee9('0x4c')][_0x4ee9('0x4e')]({'id':_0x4cb4e0[_0x4ee9('0x21')],'value':_0x3e5225[_0x4cb4e0['variableName']]['toString']()});}else if(_0x4cb4e0[_0x4ee9('0x46')]===_0x4ee9('0x4f')&&_0x4cb4e0[_0x4ee9('0x50')]&&_0x4cb4e0[_0x4ee9('0x50')][_0x4ee9('0xe')]&&_0x4cb4e0[_0x4ee9('0x21')]&&_0x4cb4e0[_0x4ee9('0x49')]){_0x3e5225[_0x4cb4e0[_0x4ee9('0x50')][_0x4ee9('0xe')][_0x4ee9('0x4a')]()]&&_0x36b6f[_0x4ee9('0x4c')]['push']({'id':_0x4cb4e0[_0x4ee9('0x21')],'value':_0x3e5225[_0x4cb4e0[_0x4ee9('0x50')][_0x4ee9('0xe')][_0x4ee9('0x4a')]()][_0x4ee9('0x29')]()});}});}return _0x36b6f;}function getConnection(_0x1e6d70){return request({'method':_0x4ee9('0xb'),'form':{'method':'login','input_type':_0x4ee9('0x23'),'response_type':_0x4ee9('0x23'),'rest_data':JSON[_0x4ee9('0x24')]({'user_auth':{'user_name':_0x1e6d70['username'],'password':_0x1e6d70[_0x4ee9('0x51')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4ee9('0x2f')](function(_0x369bf2){var _0x2f180c=_0x369bf2;if(_0x2f180c['id']){def[_0x4ee9('0x52')]=_0x2f180c['id'];return BPromise[_0x4ee9('0x35')](_0x2f180c);}else{throw new Error(util[_0x4ee9('0x26')](_0x4ee9('0x53'),_0x1e6d70['id']));}});}function setRelationship(_0x77a83,_0x2abab0,_0x256f50,_0x56892e){return request({'form':{'method':_0x4ee9('0x54'),'input_type':_0x4ee9('0x23'),'response_type':_0x4ee9('0x23'),'rest_data':JSON[_0x4ee9('0x24')]({'session':_0x77a83['id'],'module_name':_0x4ee9('0x25'),'module_id':_0x256f50['id'],'link_field_name':_0x56892e,'related_ids':[_0x2abab0['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4ee9('0x55')]=function(_0x107e7a,_0x115d9e,_0x41bd39,_0x12678e,_0x19a5f4,_0x4722e9){var _0x5180e8,_0x46db15,_0x1c856b,_0x15754f;_0x4722e9[_0x4ee9('0x56')]=intUtil[_0x4ee9('0x57')](_0x4722e9['remoteUri']);_0x4722e9['serverUrl']=intUtil[_0x4ee9('0x57')](_0x4722e9[_0x4ee9('0x58')]);def[_0x4ee9('0x59')]=util[_0x4ee9('0x26')](_0x4ee9('0x5a'),_0x4722e9[_0x4ee9('0x56')]);if(_0x19a5f4&&_0x19a5f4[_0x4ee9('0x5b')]){logger[_0x4ee9('0xd')](_0x4ee9('0x5c'),_0x4ee9('0x5d'));_0x115d9e['recordingURL']=util[_0x4ee9('0x26')](_0x4ee9('0x5e'),_0x4722e9['serverUrl'],_0x115d9e[_0x4ee9('0x5f')],md5(_0x115d9e['uniqueid']));}else{_0x115d9e[_0x4ee9('0x60')]='';}return getConnection(_0x4722e9)[_0x4ee9('0x2f')](function(_0x83d5de){_0x15754f=_0x83d5de;return getUser(_0x4722e9,_0x12678e[_0x4ee9('0xe')],_0x15754f);})['then'](function(_0x3abeb4){_0x5180e8=_0x3abeb4;logger[_0x4ee9('0xd')](_0x4ee9('0x61'),_0x5180e8['id']);return getEndUser(_0x4722e9,_0x115d9e[_0x4ee9('0x62')],_0x115d9e[_0x4ee9('0x63')],_0x15754f);})[_0x4ee9('0x2f')](function(_0x9922aa){_0x46db15=_0x9922aa;logger[_0x4ee9('0xd')](_0x4ee9('0x64'),_0x46db15['id']);return getTicket(_0x4722e9,_0x5180e8,_0x46db15,_0x41bd39,_0x115d9e,_0x41bd39['Fields'],_0x15754f,'Inbound');})['then'](function(_0x43630){_0x1c856b=_0x43630;logger[_0x4ee9('0xd')](_0x4ee9('0x65'));logger['info'](_0x4ee9('0x66'),_0x1c856b['id']);return setRelationship(_0x15754f,_0x5180e8,_0x1c856b,_0x4ee9('0x67'));})['then'](function(){return setRelationship(_0x15754f,_0x46db15,_0x1c856b,_0x4ee9('0x68'));})[_0x4ee9('0x2f')](function(){return getServerInfo(_0x15754f);})['then'](function(_0x320a35){var _0x1b7090=parseInt(_0x320a35[_0x4ee9('0x69')][_0x4ee9('0x6a')](0x0));var _0xad0c32=util[_0x4ee9('0x26')](_0x4ee9('0x6b'),_0x4722e9[_0x4ee9('0x56')],_0x1c856b['id']);if(_0x1b7090>0x6){_0xad0c32=util[_0x4ee9('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4722e9[_0x4ee9('0x56')],_0x1c856b['id']);}logger['info']('[QUEUE]',_0x4ee9('0x6c'));emit(util[_0x4ee9('0x26')](_0x4ee9('0x6d'),_0x12678e['name']),_0x4ee9('0x6e'),{'uri':_0xad0c32});})[_0x4ee9('0x6f')](function(_0x1cdca5){logger['error']('[QUEUE]',JSON['stringify'](_0x1cdca5));});};exports['outbound']=function(_0x4f9785,_0x17eda5,_0x2ef65e,_0x49c409,_0x5a68e1,_0x13db2c,_0x3183a1){var _0x5558e0,_0x12b920,_0x2d2ae7,_0x37e3d4;_0x13db2c['remoteUri']=intUtil[_0x4ee9('0x57')](_0x13db2c[_0x4ee9('0x56')]);_0x13db2c[_0x4ee9('0x58')]=intUtil[_0x4ee9('0x57')](_0x13db2c[_0x4ee9('0x58')]);def[_0x4ee9('0x59')]=util['format'](_0x4ee9('0x5a'),_0x13db2c[_0x4ee9('0x56')]);if(_0x3183a1&&_0x3183a1[_0x4ee9('0x70')]&&_0x3183a1[_0x4ee9('0x70')]!==_0x4ee9('0x71')){logger['info'](_0x4ee9('0x72'),_0x4ee9('0x5d'));_0x17eda5[_0x4ee9('0x60')]=util[_0x4ee9('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13db2c[_0x4ee9('0x58')],_0x17eda5[_0x4ee9('0x5f')],md5(_0x17eda5['uniqueid']));}return getConnection(_0x13db2c)['then'](function(_0x5d9b96){_0x37e3d4=_0x5d9b96;return getUser(_0x13db2c,_0x49c409[_0x4ee9('0xe')],_0x37e3d4);})[_0x4ee9('0x2f')](function(_0xc559f3){_0x5558e0=_0xc559f3;logger[_0x4ee9('0xd')](_0x4ee9('0x61'),_0x5558e0['id']);return getEndUser(_0x13db2c,_0x17eda5['destcalleridname'],_0x17eda5[_0x4ee9('0x73')],_0x37e3d4);})[_0x4ee9('0x2f')](function(_0x141cb3){_0x12b920=_0x141cb3;logger[_0x4ee9('0xd')](_0x4ee9('0x64'),_0x12b920['id']);return getTicket(_0x13db2c,_0x5558e0,_0x12b920,_0x2ef65e,_0x17eda5,_0x2ef65e[_0x4ee9('0x74')],_0x37e3d4,_0x4ee9('0x75'));})['then'](function(_0x132607){_0x2d2ae7=_0x132607;logger['info']('Ticket\x20created!');logger[_0x4ee9('0xd')](_0x4ee9('0x66'),_0x2d2ae7['id']);return setRelationship(_0x37e3d4,_0x5558e0,_0x2d2ae7,_0x4ee9('0x67'));})['then'](function(){return setRelationship(_0x37e3d4,_0x12b920,_0x2d2ae7,_0x4ee9('0x68'));})[_0x4ee9('0x2f')](function(){return getServerInfo(_0x37e3d4);})['then'](function(_0x3ad111){var _0x1df49c=parseInt(_0x3ad111[_0x4ee9('0x69')]['charAt'](0x0));var _0x4e111a=util[_0x4ee9('0x26')](_0x4ee9('0x6b'),_0x13db2c[_0x4ee9('0x56')],_0x2d2ae7['id']);if(_0x1df49c>0x6){_0x4e111a=util[_0x4ee9('0x26')](_0x4ee9('0x76'),_0x13db2c[_0x4ee9('0x56')],_0x2d2ae7['id']);}logger[_0x4ee9('0xd')]('[OUTBOUND]',_0x4ee9('0x6c'));emit(util[_0x4ee9('0x26')]('user:%s',_0x49c409[_0x4ee9('0xe')]),_0x4ee9('0x6e'),{'uri':_0x4e111a});})['catch'](function(_0x310007){logger[_0x4ee9('0x77')](_0x4ee9('0x72'),JSON[_0x4ee9('0x24')](_0x310007));});};exports[_0x4ee9('0x78')]=function(_0x14d40d,_0x5f5b30,_0x3da923,_0x4bd354,_0x75a0f5,_0x251fe0){var _0x48442c,_0x23b384,_0x5cc99c,_0x17e523;_0x251fe0[_0x4ee9('0x56')]=intUtil[_0x4ee9('0x57')](_0x251fe0[_0x4ee9('0x56')]);_0x251fe0[_0x4ee9('0x58')]=intUtil[_0x4ee9('0x57')](_0x251fe0['serverUrl']);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x251fe0[_0x4ee9('0x56')]);if(_0x75a0f5&&_0x75a0f5[_0x4ee9('0x5b')]){logger[_0x4ee9('0xd')]('['+_0x5f5b30['lastevent'][_0x4ee9('0x79')]()+']',_0x4ee9('0x5d'));_0x5f5b30[_0x4ee9('0x60')]=util['format'](_0x4ee9('0x5e'),_0x251fe0['serverUrl'],_0x5f5b30['uniqueid'],md5(_0x5f5b30[_0x4ee9('0x5f')]));}else{_0x5f5b30[_0x4ee9('0x60')]='';}return getConnection(_0x251fe0)[_0x4ee9('0x2f')](function(_0x3af6b6){_0x17e523=_0x3af6b6;if(!_[_0x4ee9('0x2c')](_0x4bd354)){return getUser(_0x251fe0,_0x4bd354[_0x4ee9('0xe')],_0x17e523);}else{return getUser(_0x251fe0,null,_0x17e523);}})[_0x4ee9('0x2f')](function(_0x41e39b){_0x48442c=_0x41e39b;logger[_0x4ee9('0xd')]('The\x20User\x20ID\x20is:',_0x48442c['id']);return getEndUser(_0x251fe0,_0x5f5b30['calleridname'],_0x5f5b30[_0x4ee9('0x63')],_0x17e523);})[_0x4ee9('0x2f')](function(_0x24fb85){_0x23b384=_0x24fb85;logger['info']('The\x20Enduser\x20ID\x20is:',_0x23b384['id']);return getTicket(_0x251fe0,_0x48442c,_0x23b384,_0x3da923,_0x5f5b30,_0x3da923['Fields'],_0x17e523,_0x4ee9('0x7a'));})[_0x4ee9('0x2f')](function(_0x543174){_0x5cc99c=_0x543174;logger[_0x4ee9('0xd')](_0x4ee9('0x65'));logger[_0x4ee9('0xd')](_0x4ee9('0x66'),_0x5cc99c['id']);return setRelationship(_0x17e523,_0x48442c,_0x5cc99c,_0x4ee9('0x67'));})[_0x4ee9('0x2f')](function(){return setRelationship(_0x17e523,_0x23b384,_0x5cc99c,_0x4ee9('0x68'));})[_0x4ee9('0x2f')](function(){return getServerInfo(_0x17e523);})['catch'](function(_0x1ffc91){logger[_0x4ee9('0x77')]('['+_0x5f5b30[_0x4ee9('0x7b')][_0x4ee9('0x79')]()+']',JSON[_0x4ee9('0x24')](_0x1ffc91));});}; \ No newline at end of file +var _0xde9c=['error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','contacts','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','catch','toUpperCase','calleridnum','The\x20Enduser\x20ID\x20is:','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','info','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','parent_type','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','format','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','variable','Variable','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xde9c,0x17b));var _0xcde9=function(_0x5f3d72,_0xf417a2){_0x5f3d72=_0x5f3d72-0x0;var _0x2a0c98=_0xde9c[_0x5f3d72];return _0x2a0c98;};'use strict';var _=require(_0xcde9('0x0'));var rp=require(_0xcde9('0x1'));var BPromise=require(_0xcde9('0x2'));var md5=require(_0xcde9('0x3'));var util=require(_0xcde9('0x4'));var Redis=require(_0xcde9('0x5'));var intUtil=require(_0xcde9('0x6'));var config=require(_0xcde9('0x7'));var logger=require(_0xcde9('0x8'))(_0xcde9('0x9'));config[_0xcde9('0xa')]=_['defaults'](config['redis'],{'host':_0xcde9('0xb'),'port':0x18eb});var io=require(_0xcde9('0xc'))(new Redis(config[_0xcde9('0xa')]));var def={'method':_0xcde9('0xd'),'json':!![]};function emit(_0x3d5a93,_0x15782a,_0x5124bf){io['to'](_0x3d5a93)['emit'](_0x15782a,_0x5124bf);}function getTicket(_0xd3ec7d,_0xb7c9e1,_0x21f028,_0x57f7c5,_0x57ebba,_0x5b0f3c,_0xa95528,_0x6fc8ea){logger[_0xcde9('0xe')]('Creating\x20new\x20ticket...');var _0x550b9d=new Date();var _0x4d22dd=[{'name':_0xcde9('0xf'),'value':intUtil[_0xcde9('0x10')](_0x57f7c5[_0xcde9('0x11')],_0x57ebba,'\x20')},{'name':_0xcde9('0x12'),'value':_0xb7c9e1['id']},{'name':_0xcde9('0x13'),'value':_0xb7c9e1['id']},{'name':_0xcde9('0x14'),'value':intUtil[_0xcde9('0x10')](_0x57f7c5['Descriptions'],_0x57ebba,'\x0a')},{'name':_0xcde9('0x15'),'value':_0x550b9d[_0xcde9('0x16')]()[_0xcde9('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x21f028['id']},{'name':_0xcde9('0x18'),'value':'Contacts'},{'name':_0xcde9('0x19'),'value':_0x21f028['name']},{'name':_0xcde9('0x1a'),'value':_0x6fc8ea}];if(_0x5b0f3c[_0xcde9('0x1b')]){_[_0xcde9('0x1c')](_0x5b0f3c,function(_0xaf7f17){if(_0x57ebba[_0xaf7f17[_0xcde9('0x1d')]]){_0x4d22dd['push']({'name':_0xaf7f17[_0xcde9('0x1e')],'value':_0x57ebba[_0xaf7f17['variableName']]});}});}return request({'form':{'method':_0xcde9('0x1f'),'input_type':_0xcde9('0x20'),'response_type':_0xcde9('0x20'),'rest_data':JSON[_0xcde9('0x21')]({'session':_0xa95528['id'],'module_name':'Calls','name_value_list':_0x4d22dd})}});}function getAuth(_0xfe6b76){return util['format'](_0xcde9('0x22'),new Buffer(_0xfe6b76[_0xcde9('0x23')]+':X')[_0xcde9('0x24')](_0xcde9('0x25')));}function getServerInfo(_0x34583c){return request({'form':{'method':_0xcde9('0x26'),'input_type':_0xcde9('0x20'),'response_type':_0xcde9('0x20'),'rest_data':JSON[_0xcde9('0x21')]({'session':_0x34583c['id']})}});}function getUser(_0x1217bc,_0x7d79e6,_0x507a39){if(!_[_0xcde9('0x27')](_0x7d79e6)){logger[_0xcde9('0xe')](_0xcde9('0x28'),_0x7d79e6);return request({'form':{'method':'get_entry_list','input_type':_0xcde9('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x507a39['id'],'module_name':'Employees','query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x7d79e6),'order_by':'','offset':'0','select_fields':['id',_0xcde9('0xf'),_0xcde9('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcde9('0x2a')](function(_0x37da91){if(_0x37da91[_0xcde9('0x2b')]['length']){var _0x25563e=_[_0xcde9('0x2c')](_0x37da91[_0xcde9('0x2b')],function(_0x47fc06){return _0x47fc06[_0xcde9('0x2d')][_0xcde9('0x29')]['value']===_0x7d79e6;});if(_0x25563e){logger[_0xcde9('0xe')](_0xcde9('0x2e'));return BPromise[_0xcde9('0x2f')]({'id':_0x25563e[_0xcde9('0x2d')]['id'][_0xcde9('0x30')],'name':_0x25563e[_0xcde9('0x2d')]['name'][_0xcde9('0x30')]});}}logger[_0xcde9('0xe')](_0xcde9('0x31'));return BPromise[_0xcde9('0x2f')]({'id':_0x507a39[_0xcde9('0x2d')][_0xcde9('0x32')][_0xcde9('0x30')],'name':_0x507a39[_0xcde9('0x2d')][_0xcde9('0x29')][_0xcde9('0x30')]});});}else{logger[_0xcde9('0xe')](_0xcde9('0x33'));return BPromise[_0xcde9('0x2f')]({'id':_0x507a39['name_value_list']['user_id'][_0xcde9('0x30')],'name':_0x507a39[_0xcde9('0x2d')][_0xcde9('0x29')]['value']});}}function getEndUser(_0x53db94,_0x433f3e,_0x331598,_0x4e1305){logger['info']('Searching\x20enduser\x20with\x20phone',_0x331598);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xcde9('0x20'),'rest_data':JSON['stringify']({'session':_0x4e1305['id'],'module_name':_0xcde9('0x34'),'query':util['format'](_0xcde9('0x35'),_0x331598),'order_by':'','offset':'0','select_fields':['id',_0xcde9('0xf'),_0xcde9('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcde9('0x2a')](function(_0x5ce15e){if(_0x5ce15e[_0xcde9('0x2b')][_0xcde9('0x1b')]){var _0x477357=_[_0xcde9('0x2c')](_0x5ce15e['entry_list'],function(_0xb80937){return _0xb80937[_0xcde9('0x2d')][_0xcde9('0x36')][_0xcde9('0x30')]===_0x331598;});if(_0x477357){logger['info'](_0xcde9('0x37'));return BPromise['resolve']({'id':_0x477357[_0xcde9('0x2d')]['id'][_0xcde9('0x30')],'name':_0x477357['name_value_list'][_0xcde9('0xf')][_0xcde9('0x30')],'phone':_0x477357[_0xcde9('0x2d')][_0xcde9('0x36')]['value']});}}else{logger[_0xcde9('0xe')](_0xcde9('0x38'));return request({'form':{'method':_0xcde9('0x1f'),'input_type':_0xcde9('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4e1305['id'],'module_name':_0xcde9('0x34'),'name_value_list':[{'name':'first_name','value':_0x433f3e!==_0xcde9('0x39')?_0x433f3e:util[_0xcde9('0x3a')](_0xcde9('0x3b'),_0x331598)},{'name':'phone_home','value':_0x331598}]})}})[_0xcde9('0x2a')](function(_0x1038b3){logger[_0xcde9('0xe')](_0xcde9('0x3c'));return BPromise[_0xcde9('0x2f')]({'id':_0x1038b3['id'],'name':_0x1038b3[_0xcde9('0x2b')][_0xcde9('0x3d')][_0xcde9('0x30')],'phone':_0x1038b3[_0xcde9('0x2b')][_0xcde9('0x36')][_0xcde9('0x30')]});});}});}function request(_0x3d54e3){logger[_0xcde9('0x3e')]('[HTTP]',JSON[_0xcde9('0x21')](_0x3d54e3));return rp(_[_0xcde9('0x3f')](def,_0x3d54e3));}function getTags(_0x17cfa6,_0x24f6fd){var _0x26726e=[];if(_0x17cfa6&&_0x17cfa6['length']>0x0){_0x26726e=_[_0xcde9('0x40')](_0x17cfa6,_0x24f6fd);}return _0x26726e;}function getCustomFields(_0x5f444a,_0x550510){var _0x12d735=[];var _0x425389={'custom_fields':[]};if(_0x5f444a['length']>0x0){_[_0xcde9('0x1c')](_0x5f444a,function(_0x4e3936){if(_0x4e3936[_0xcde9('0x41')]===_0xcde9('0x42')&&_0x4e3936[_0xcde9('0x43')]&&!_0x4e3936[_0xcde9('0x44')]){_0x425389[_0x4e3936['nameField'][_0xcde9('0x45')]()]=_0x4e3936[_0xcde9('0x46')][_0xcde9('0x24')]();}else if(_0x4e3936[_0xcde9('0x41')]===_0xcde9('0x42')&&_0x4e3936[_0xcde9('0x1e')]&&_0x4e3936['customField']){_0x425389[_0xcde9('0x47')][_0xcde9('0x48')]({'id':_0x4e3936[_0xcde9('0x1e')],'value':_0x4e3936[_0xcde9('0x46')][_0xcde9('0x24')]()});}else if(_0x4e3936['type']===_0xcde9('0x49')&&_0x4e3936[_0xcde9('0x1d')]&&_0x4e3936['idField']&&_0x4e3936[_0xcde9('0x44')]){_0x550510[_0x4e3936[_0xcde9('0x1d')]]&&_0x425389[_0xcde9('0x47')]['push']({'id':_0x4e3936[_0xcde9('0x1e')],'value':_0x550510[_0x4e3936['variableName']]['toString']()});}else if(_0x4e3936[_0xcde9('0x41')]==='customVariable'&&_0x4e3936[_0xcde9('0x4a')]&&_0x4e3936[_0xcde9('0x4a')][_0xcde9('0xf')]&&_0x4e3936['idField']&&_0x4e3936['customField']){_0x550510[_0x4e3936[_0xcde9('0x4a')][_0xcde9('0xf')][_0xcde9('0x45')]()]&&_0x425389[_0xcde9('0x47')]['push']({'id':_0x4e3936['idField'],'value':_0x550510[_0x4e3936[_0xcde9('0x4a')][_0xcde9('0xf')][_0xcde9('0x45')]()][_0xcde9('0x24')]()});}});}return _0x425389;}function getConnection(_0xf5d324){return request({'method':_0xcde9('0xd'),'form':{'method':'login','input_type':'JSON','response_type':_0xcde9('0x20'),'rest_data':JSON[_0xcde9('0x21')]({'user_auth':{'user_name':_0xf5d324[_0xcde9('0x4b')],'password':_0xf5d324[_0xcde9('0x4c')],'encryption':'PLAIN'},'application':_0xcde9('0x4d')})}})[_0xcde9('0x2a')](function(_0x144982){var _0x5b61f9=_0x144982;if(_0x5b61f9['id']){def['sessionID']=_0x5b61f9['id'];return BPromise[_0xcde9('0x2f')](_0x5b61f9);}else{throw new Error(util[_0xcde9('0x3a')](_0xcde9('0x4e'),_0xf5d324['id']));}});}function setRelationship(_0x771e8c,_0x5ec70d,_0x5747bd,_0x303da5){return request({'form':{'method':_0xcde9('0x4f'),'input_type':_0xcde9('0x20'),'response_type':'JSON','rest_data':JSON[_0xcde9('0x21')]({'session':_0x771e8c['id'],'module_name':_0xcde9('0x50'),'module_id':_0x5747bd['id'],'link_field_name':_0x303da5,'related_ids':[_0x5ec70d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xcde9('0x51')]=function(_0x2cd841,_0x45d9d8,_0x5a6f22,_0x4bfeca,_0x38fc06,_0x5393c4){var _0x265152,_0x11cf48,_0x5425f,_0x3a1590;_0x5393c4[_0xcde9('0x52')]=intUtil[_0xcde9('0x53')](_0x5393c4[_0xcde9('0x52')]);_0x5393c4[_0xcde9('0x54')]=intUtil['stripTrailingSlash'](_0x5393c4[_0xcde9('0x54')]);def[_0xcde9('0x55')]=util[_0xcde9('0x3a')](_0xcde9('0x56'),_0x5393c4[_0xcde9('0x52')]);if(_0x38fc06&&_0x38fc06[_0xcde9('0x57')]){logger['info'](_0xcde9('0x58'),_0xcde9('0x59'));_0x45d9d8[_0xcde9('0x5a')]=util['format'](_0xcde9('0x5b'),_0x5393c4['serverUrl'],_0x45d9d8['uniqueid'],md5(_0x45d9d8[_0xcde9('0x5c')]));}else{_0x45d9d8[_0xcde9('0x5a')]='';}return getConnection(_0x5393c4)['then'](function(_0x28b437){_0x3a1590=_0x28b437;return getUser(_0x5393c4,_0x4bfeca[_0xcde9('0xf')],_0x3a1590);})['then'](function(_0x1b36e7){_0x265152=_0x1b36e7;logger[_0xcde9('0xe')]('The\x20User\x20ID\x20is:',_0x265152['id']);return getEndUser(_0x5393c4,_0x45d9d8[_0xcde9('0x5d')],_0x45d9d8['calleridnum'],_0x3a1590);})['then'](function(_0x48c994){_0x11cf48=_0x48c994;logger[_0xcde9('0xe')]('The\x20Enduser\x20ID\x20is:',_0x11cf48['id']);return getTicket(_0x5393c4,_0x265152,_0x11cf48,_0x5a6f22,_0x45d9d8,_0x5a6f22[_0xcde9('0x5e')],_0x3a1590,_0xcde9('0x5f'));})['then'](function(_0x2753a0){_0x5425f=_0x2753a0;logger['info'](_0xcde9('0x60'));logger[_0xcde9('0xe')](_0xcde9('0x61'),_0x5425f['id']);return setRelationship(_0x3a1590,_0x265152,_0x5425f,_0xcde9('0x62'));})[_0xcde9('0x2a')](function(){return setRelationship(_0x3a1590,_0x11cf48,_0x5425f,'contacts');})[_0xcde9('0x2a')](function(){return getServerInfo(_0x3a1590);})[_0xcde9('0x2a')](function(_0x281d4d){var _0x5b372f=parseInt(_0x281d4d[_0xcde9('0x63')][_0xcde9('0x64')](0x0));var _0x14e0ee=util[_0xcde9('0x3a')](_0xcde9('0x65'),_0x5393c4[_0xcde9('0x52')],_0x5425f['id']);if(_0x5b372f>0x6){_0x14e0ee=util[_0xcde9('0x3a')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5393c4[_0xcde9('0x52')],_0x5425f['id']);}logger[_0xcde9('0xe')](_0xcde9('0x58'),_0xcde9('0x66'));emit(util[_0xcde9('0x3a')](_0xcde9('0x67'),_0x4bfeca[_0xcde9('0xf')]),_0xcde9('0x68'),{'uri':_0x14e0ee});})['catch'](function(_0x4db155){logger[_0xcde9('0x69')](_0xcde9('0x58'),JSON[_0xcde9('0x21')](_0x4db155));});};exports[_0xcde9('0x6a')]=function(_0x54a9ef,_0x5af608,_0x5bafd1,_0x59265c,_0x10d5c5,_0x408071,_0x43e206){var _0x5b393e,_0xfc7b9d,_0x17e5ee,_0x55ec31;_0x408071[_0xcde9('0x52')]=intUtil[_0xcde9('0x53')](_0x408071[_0xcde9('0x52')]);_0x408071['serverUrl']=intUtil[_0xcde9('0x53')](_0x408071[_0xcde9('0x54')]);def[_0xcde9('0x55')]=util[_0xcde9('0x3a')]('%s/service/v4_1/rest.php',_0x408071[_0xcde9('0x52')]);if(_0x43e206&&_0x43e206[_0xcde9('0x6b')]&&_0x43e206[_0xcde9('0x6b')]!==_0xcde9('0x6c')){logger[_0xcde9('0xe')](_0xcde9('0x6d'),_0xcde9('0x59'));_0x5af608[_0xcde9('0x5a')]=util[_0xcde9('0x3a')](_0xcde9('0x5b'),_0x408071[_0xcde9('0x54')],_0x5af608[_0xcde9('0x5c')],md5(_0x5af608['uniqueid']));}return getConnection(_0x408071)[_0xcde9('0x2a')](function(_0x1fe4ba){_0x55ec31=_0x1fe4ba;return getUser(_0x408071,_0x59265c[_0xcde9('0xf')],_0x55ec31);})['then'](function(_0x2e6c49){_0x5b393e=_0x2e6c49;logger[_0xcde9('0xe')](_0xcde9('0x6e'),_0x5b393e['id']);return getEndUser(_0x408071,_0x5af608[_0xcde9('0x6f')],_0x5af608[_0xcde9('0x70')],_0x55ec31);})[_0xcde9('0x2a')](function(_0x24dfe3){_0xfc7b9d=_0x24dfe3;logger[_0xcde9('0xe')]('The\x20Enduser\x20ID\x20is:',_0xfc7b9d['id']);return getTicket(_0x408071,_0x5b393e,_0xfc7b9d,_0x5bafd1,_0x5af608,_0x5bafd1[_0xcde9('0x5e')],_0x55ec31,_0xcde9('0x71'));})[_0xcde9('0x2a')](function(_0x53e17d){_0x17e5ee=_0x53e17d;logger['info'](_0xcde9('0x60'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x17e5ee['id']);return setRelationship(_0x55ec31,_0x5b393e,_0x17e5ee,'users');})[_0xcde9('0x2a')](function(){return setRelationship(_0x55ec31,_0xfc7b9d,_0x17e5ee,_0xcde9('0x72'));})[_0xcde9('0x2a')](function(){return getServerInfo(_0x55ec31);})[_0xcde9('0x2a')](function(_0x3fe278){var _0x3aadba=parseInt(_0x3fe278[_0xcde9('0x63')][_0xcde9('0x64')](0x0));var _0x46eafa=util[_0xcde9('0x3a')](_0xcde9('0x65'),_0x408071[_0xcde9('0x52')],_0x17e5ee['id']);if(_0x3aadba>0x6){_0x46eafa=util['format'](_0xcde9('0x73'),_0x408071['remoteUri'],_0x17e5ee['id']);}logger[_0xcde9('0xe')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xcde9('0x67'),_0x59265c['name']),_0xcde9('0x68'),{'uri':_0x46eafa});})[_0xcde9('0x74')](function(_0xf1812f){logger[_0xcde9('0x69')](_0xcde9('0x6d'),JSON['stringify'](_0xf1812f));});};exports['unmanaged']=function(_0x735bc6,_0x5ca3d8,_0x23c00a,_0x23cd89,_0x3ba197,_0x366e2a){var _0x4ad11a,_0xe1f3bd,_0x5df4c3,_0x2b9dd4;_0x366e2a['remoteUri']=intUtil[_0xcde9('0x53')](_0x366e2a[_0xcde9('0x52')]);_0x366e2a['serverUrl']=intUtil[_0xcde9('0x53')](_0x366e2a[_0xcde9('0x54')]);def[_0xcde9('0x55')]=util[_0xcde9('0x3a')](_0xcde9('0x56'),_0x366e2a[_0xcde9('0x52')]);if(_0x3ba197&&_0x3ba197['monitor_format']){logger[_0xcde9('0xe')]('['+_0x5ca3d8['lastevent'][_0xcde9('0x75')]()+']',_0xcde9('0x59'));_0x5ca3d8[_0xcde9('0x5a')]=util[_0xcde9('0x3a')](_0xcde9('0x5b'),_0x366e2a['serverUrl'],_0x5ca3d8[_0xcde9('0x5c')],md5(_0x5ca3d8[_0xcde9('0x5c')]));}else{_0x5ca3d8[_0xcde9('0x5a')]='';}return getConnection(_0x366e2a)[_0xcde9('0x2a')](function(_0x4edafd){_0x2b9dd4=_0x4edafd;if(!_[_0xcde9('0x27')](_0x23cd89)){return getUser(_0x366e2a,_0x23cd89[_0xcde9('0xf')],_0x2b9dd4);}else{return getUser(_0x366e2a,null,_0x2b9dd4);}})['then'](function(_0x177605){_0x4ad11a=_0x177605;logger[_0xcde9('0xe')](_0xcde9('0x6e'),_0x4ad11a['id']);return getEndUser(_0x366e2a,_0x5ca3d8[_0xcde9('0x5d')],_0x5ca3d8[_0xcde9('0x76')],_0x2b9dd4);})[_0xcde9('0x2a')](function(_0x19ebbb){_0xe1f3bd=_0x19ebbb;logger['info'](_0xcde9('0x77'),_0xe1f3bd['id']);return getTicket(_0x366e2a,_0x4ad11a,_0xe1f3bd,_0x23c00a,_0x5ca3d8,_0x23c00a[_0xcde9('0x5e')],_0x2b9dd4,_0xcde9('0x5f'));})[_0xcde9('0x2a')](function(_0x2171c9){_0x5df4c3=_0x2171c9;logger[_0xcde9('0xe')](_0xcde9('0x60'));logger[_0xcde9('0xe')](_0xcde9('0x61'),_0x5df4c3['id']);return setRelationship(_0x2b9dd4,_0x4ad11a,_0x5df4c3,_0xcde9('0x62'));})[_0xcde9('0x2a')](function(){return setRelationship(_0x2b9dd4,_0xe1f3bd,_0x5df4c3,'contacts');})[_0xcde9('0x2a')](function(){return getServerInfo(_0x2b9dd4);})[_0xcde9('0x74')](function(_0x17d05b){logger[_0xcde9('0x69')]('['+_0x5ca3d8[_0xcde9('0x78')][_0xcde9('0x75')]()+']',JSON[_0xcde9('0x21')](_0x17d05b));});}; \ 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 03eb876..bc9d2d3 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 _0x95c4=['substring','validateEmail','isNil','test','util','getString','length','sortBy','type','push','content','variableName','customVariable','Variable','name','toLowerCase','toString','string','key','%s:\x20%s','keyType','variable','join','stripTrailingSlash','slice'];(function(_0x2202c9,_0x53a745){var _0x535254=function(_0x264b92){while(--_0x264b92){_0x2202c9['push'](_0x2202c9['shift']());}};_0x535254(++_0x53a745);}(_0x95c4,0xe5));var _0x495c=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x95c4[_0x40a825];return _0x273a54;};'use strict';var _=require('lodash');var util=require(_0x495c('0x0'));exports[_0x495c('0x1')]=function(_0x67c1ff,_0x2319bc,_0x43508a){var _0x2dd69c=[];if(_0x67c1ff[_0x495c('0x2')]>0x0){var _0x31b939=_[_0x495c('0x3')](_0x67c1ff,['id']);for(var _0x710e8f=0x0;_0x710e8f<_0x31b939[_0x495c('0x2')];_0x710e8f++){var _0x34df70=_0x31b939[_0x710e8f];if(_0x34df70[_0x495c('0x4')]==='string'){_0x2dd69c[_0x495c('0x5')](_0x34df70[_0x495c('0x6')]);}else if(_0x34df70['type']==='variable'&&_0x34df70[_0x495c('0x7')]){_0x2319bc[_0x34df70[_0x495c('0x7')]]&&_0x2dd69c[_0x495c('0x5')](_0x2319bc[_0x34df70[_0x495c('0x7')]]['toString']());}else if(_0x34df70[_0x495c('0x4')]===_0x495c('0x8')&&_0x34df70[_0x495c('0x9')]&&_0x34df70[_0x495c('0x9')][_0x495c('0xa')]){_0x2319bc[_0x34df70['Variable'][_0x495c('0xa')][_0x495c('0xb')]()]&&_0x2dd69c[_0x495c('0x5')](_0x2319bc[_0x34df70[_0x495c('0x9')][_0x495c('0xa')]['toLowerCase']()][_0x495c('0xc')]());}else if(_0x34df70[_0x495c('0x4')]==='keyValue'){if(_0x34df70['keyType']===_0x495c('0xd')&&_0x34df70[_0x495c('0xe')]){_0x2dd69c[_0x495c('0x5')](util['format'](_0x495c('0xf'),_0x34df70[_0x495c('0xe')],_0x34df70['keyContent']));}else if(_0x34df70[_0x495c('0x10')]===_0x495c('0x11')&&_0x34df70[_0x495c('0x7')]&&_0x34df70['key']){_0x2319bc[_0x34df70[_0x495c('0x7')]]&&_0x2dd69c[_0x495c('0x5')](util['format'](_0x495c('0xf'),_0x34df70[_0x495c('0xe')],_0x2319bc[_0x34df70[_0x495c('0x7')]]));}else if(_0x34df70[_0x495c('0x10')]===_0x495c('0x8')&&_0x34df70[_0x495c('0x9')]&&_0x34df70['Variable']['name']&&_0x34df70[_0x495c('0xe')]){_0x2319bc[_0x34df70[_0x495c('0x9')][_0x495c('0xa')][_0x495c('0xb')]()]&&_0x2dd69c[_0x495c('0x5')](util['format'](_0x495c('0xf'),_0x34df70[_0x495c('0xe')],_0x2319bc[_0x34df70[_0x495c('0x9')]['name']['toLowerCase']()]));}}}}return _0x2dd69c[_0x495c('0x12')](_0x43508a);};exports[_0x495c('0x13')]=function(_0x35da06){var _0x1ce004=_0x35da06[_0x495c('0x14')](-0x1);if(_0x1ce004==='/'){_0x35da06=_0x35da06[_0x495c('0x15')](0x0,_0x35da06['lastIndexOf'](_0x1ce004));}return _0x35da06;};exports[_0x495c('0x16')]=function(_0x8682e6){if(!_[_0x495c('0x17')](_0x8682e6)&&_0x8682e6!==''){var _0x5e46a4=/^(([^<>()\[\]\\.,;:\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 _0x5e46a4[_0x495c('0x18')](String(_0x8682e6)[_0x495c('0xb')]());}else{return![];}}; \ No newline at end of file +var _0xd304=['substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','sortBy','length','string','push','content','variable','variableName','type','customVariable','Variable','toLowerCase','name','toString','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice'];(function(_0x66555b,_0x696b02){var _0x36aa73=function(_0x338a65){while(--_0x338a65){_0x66555b['push'](_0x66555b['shift']());}};_0x36aa73(++_0x696b02);}(_0xd304,0x74));var _0x4d30=function(_0x4bcb49,_0x5117cb){_0x4bcb49=_0x4bcb49-0x0;var _0x242786=_0xd304[_0x4bcb49];return _0x242786;};'use strict';var _=require(_0x4d30('0x0'));var util=require(_0x4d30('0x1'));exports[_0x4d30('0x2')]=function(_0x4dd9df,_0xeb0506,_0x263168){var _0x1ed3ac=[];if(_0x4dd9df['length']>0x0){var _0x12466d=_[_0x4d30('0x3')](_0x4dd9df,['id']);for(var _0x507880=0x0;_0x507880<_0x12466d[_0x4d30('0x4')];_0x507880++){var _0x522eb5=_0x12466d[_0x507880];if(_0x522eb5['type']===_0x4d30('0x5')){_0x1ed3ac[_0x4d30('0x6')](_0x522eb5[_0x4d30('0x7')]);}else if(_0x522eb5['type']===_0x4d30('0x8')&&_0x522eb5[_0x4d30('0x9')]){_0xeb0506[_0x522eb5['variableName']]&&_0x1ed3ac[_0x4d30('0x6')](_0xeb0506[_0x522eb5[_0x4d30('0x9')]]['toString']());}else if(_0x522eb5[_0x4d30('0xa')]===_0x4d30('0xb')&&_0x522eb5[_0x4d30('0xc')]&&_0x522eb5['Variable']['name']){_0xeb0506[_0x522eb5[_0x4d30('0xc')]['name'][_0x4d30('0xd')]()]&&_0x1ed3ac['push'](_0xeb0506[_0x522eb5['Variable'][_0x4d30('0xe')]['toLowerCase']()][_0x4d30('0xf')]());}else if(_0x522eb5[_0x4d30('0xa')]==='keyValue'){if(_0x522eb5[_0x4d30('0x10')]===_0x4d30('0x5')&&_0x522eb5[_0x4d30('0x11')]){_0x1ed3ac['push'](util[_0x4d30('0x12')](_0x4d30('0x13'),_0x522eb5['key'],_0x522eb5[_0x4d30('0x14')]));}else if(_0x522eb5[_0x4d30('0x10')]===_0x4d30('0x8')&&_0x522eb5['variableName']&&_0x522eb5['key']){_0xeb0506[_0x522eb5['variableName']]&&_0x1ed3ac[_0x4d30('0x6')](util['format'](_0x4d30('0x13'),_0x522eb5[_0x4d30('0x11')],_0xeb0506[_0x522eb5[_0x4d30('0x9')]]));}else if(_0x522eb5[_0x4d30('0x10')]==='customVariable'&&_0x522eb5[_0x4d30('0xc')]&&_0x522eb5[_0x4d30('0xc')][_0x4d30('0xe')]&&_0x522eb5['key']){_0xeb0506[_0x522eb5['Variable'][_0x4d30('0xe')]['toLowerCase']()]&&_0x1ed3ac['push'](util['format'](_0x4d30('0x13'),_0x522eb5[_0x4d30('0x11')],_0xeb0506[_0x522eb5['Variable']['name'][_0x4d30('0xd')]()]));}}}}return _0x1ed3ac[_0x4d30('0x15')](_0x263168);};exports[_0x4d30('0x16')]=function(_0x3c2e52){var _0xbcf697=_0x3c2e52[_0x4d30('0x17')](-0x1);if(_0xbcf697==='/'){_0x3c2e52=_0x3c2e52[_0x4d30('0x18')](0x0,_0x3c2e52[_0x4d30('0x19')](_0xbcf697));}return _0x3c2e52;};exports[_0x4d30('0x1a')]=function(_0x407860){if(!_[_0x4d30('0x1b')](_0x407860)&&_0x407860!==''){var _0x5e450a=/^(([^<>()\[\]\\.,;:\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 _0x5e450a['test'](String(_0x407860)[_0x4d30('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index f283af9..2c7fb3f 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x236d34,_0x10c419){var _0x5401c0=function(_0x16028d){while(--_0x16028d){_0x236d34['push'](_0x236d34['shift']());}};_0x5401c0(++_0x10c419);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index e50cb47..3f88aae 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 _0x8720=['Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Enduser\x20created.','password','%s:%s','authType','%s/token:%s','token','Basic\x20%s','toString','base64','debug','stringify','GET','map','forEach','includes','picklist','customField','nameField','toLowerCase','content','string','type','custom_fields','push','idField','variable','variableName','customVariable','Variable','queue','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','email','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','\x20Error\x20running\x20Zendesk\x20integration','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json'];(function(_0x2fbf31,_0x3a1f95){var _0x1abe93=function(_0x546e8d){while(--_0x546e8d){_0x2fbf31['push'](_0x2fbf31['shift']());}};_0x1abe93(++_0x3a1f95);}(_0x8720,0x134));var _0x0872=function(_0x303210,_0x1944be){_0x303210=_0x303210-0x0;var _0xb43f2f=_0x8720[_0x303210];return _0xb43f2f;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x0872('0x0'));var util=require(_0x0872('0x1'));var Redis=require('ioredis');var intUtil=require(_0x0872('0x2'));var config=require(_0x0872('0x3'));var logger=require(_0x0872('0x4'))(_0x0872('0x5'));config[_0x0872('0x6')]=_[_0x0872('0x7')](config[_0x0872('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0872('0x8'))(new Redis(config[_0x0872('0x6')]));function emit(_0x25c223,_0x56203a,_0x14b816){io['to'](_0x25c223)['emit'](_0x56203a,_0x14b816);}var headers={'Content-Type':_0x0872('0x9'),'Accept':_0x0872('0x9')};function getTicket(_0x529e48,_0x463962,_0x807a34,_0x14143c,_0x3f5710){logger[_0x0872('0xa')](_0x0872('0xb'));return request({'uri':util[_0x0872('0xc')]('%s/tickets.json',_0x529e48[_0x0872('0xd')]),'method':_0x0872('0xe'),'body':{'ticket':_[_0x0872('0xf')]({'requester_id':_0x807a34['id'],'submitter_id':_0x463962?_0x463962['id']:undefined,'assignee_id':_0x463962?_0x463962['id']:undefined,'tags':getTags(_0x14143c['Tags'],_0x0872('0x10')),'subject':intUtil[_0x0872('0x11')](_0x14143c[_0x0872('0x12')],_0x3f5710,'\x20'),'description':intUtil[_0x0872('0x11')](_0x14143c[_0x0872('0x13')],_0x3f5710,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0872('0x11')](_0x14143c[_0x0872('0x13')],_0x3f5710,'\x0a')}},getCustomFields(_0x14143c[_0x0872('0x14')],_0x3f5710))}})[_0x0872('0x15')](function(_0x2ab4f7){logger[_0x0872('0xa')](_0x0872('0x16'));return _0x2ab4f7[_0x0872('0x17')];});}function getUser(_0x2ea02f,_0x1fd781){if(intUtil[_0x0872('0x18')](_0x1fd781)){logger[_0x0872('0xa')](_0x0872('0x19'),_0x1fd781);return request({'uri':util[_0x0872('0xc')](_0x0872('0x1a'),_0x2ea02f[_0x0872('0xd')]),'qs':{'query':util[_0x0872('0xc')](_0x0872('0x1b'),_0x1fd781)}})['then'](function(_0x485adf){if(_0x485adf[_0x0872('0x1c')]){logger[_0x0872('0xa')](_0x0872('0x1d'));return _[_0x0872('0x1e')](_0x485adf[_0x0872('0x1f')],{'email':_0x1fd781,'role':_0x0872('0x20')});}else{logger[_0x0872('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x0872('0xc')](_0x0872('0x21'),_0x2ea02f[_0x0872('0xd')])})[_0x0872('0x15')](function(_0x44cb79){logger['info'](_0x0872('0x22'));return _0x44cb79['user'];});}});}else{logger[_0x0872('0xa')](_0x0872('0x23'));return request({'uri':util[_0x0872('0xc')]('%s/users/me.json',_0x2ea02f[_0x0872('0xd')])})[_0x0872('0x15')](function(_0x3f5871){logger[_0x0872('0xa')](_0x0872('0x22'));return _0x3f5871[_0x0872('0x24')];});}}function getEndUser(_0x3d2c16,_0x374d34,_0x50cb9c){logger[_0x0872('0xa')](_0x0872('0x25'),_0x50cb9c);return request({'uri':util[_0x0872('0xc')](_0x0872('0x1a'),_0x3d2c16[_0x0872('0xd')]),'qs':{'query':util[_0x0872('0xc')](_0x0872('0x26'),_0x50cb9c)}})[_0x0872('0x15')](function(_0x53432d){var _0xed8478;if(_0x53432d[_0x0872('0x1f')]['length']){_0x53432d[_0x0872('0x1f')]=_[_0x0872('0x27')](_0x53432d[_0x0872('0x1f')],{'suspended':![],'role':'end-user'});if(_0x53432d[_0x0872('0x1f')][_0x0872('0x28')]){_0xed8478=_['first'](_0x53432d[_0x0872('0x1f')]);}}if(_0xed8478){logger[_0x0872('0xa')](_0x0872('0x29'));return _0xed8478;}else{logger['info'](_0x0872('0x2a'));return request({'uri':util['format'](_0x0872('0x2b'),_0x3d2c16[_0x0872('0xd')]),'method':'POST','body':{'user':{'role':_0x0872('0x2c'),'name':util[_0x0872('0xc')]('Caller\x20-\x20%s',_0x374d34||_0x50cb9c),'phone':_0x50cb9c}}})['then'](function(_0x175ffd){logger[_0x0872('0xa')](_0x0872('0x2d'));return _0x175ffd['user'];});}});}function getAuth(_0x3be525){var _0x348197;if(_0x3be525['authType']===_0x0872('0x2e')){_0x348197=util[_0x0872('0xc')](_0x0872('0x2f'),_0x3be525['username'],_0x3be525['password']);}else if(_0x3be525[_0x0872('0x30')]==='token'){_0x348197=util[_0x0872('0xc')](_0x0872('0x31'),_0x3be525['username'],_0x3be525[_0x0872('0x32')]);}return util[_0x0872('0xc')](_0x0872('0x33'),new Buffer(_0x348197)[_0x0872('0x34')](_0x0872('0x35')));}function request(_0x71b0de){logger[_0x0872('0x36')]('[HTTP]',JSON[_0x0872('0x37')](_0x71b0de));return rp(_[_0x0872('0x7')](_0x71b0de,{'method':_0x0872('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x2ef450,_0x1040a9){var _0xa06f1a=[];if(_0x2ef450&&_0x2ef450[_0x0872('0x28')]>0x0){_0xa06f1a=_[_0x0872('0x39')](_0x2ef450,_0x1040a9);}return _0xa06f1a;}function getCustomFields(_0x42431a,_0x52237b){var _0x1eb8ec=[];var _0x6dc826={'custom_fields':[]};if(_0x42431a[_0x0872('0x28')]>0x0){_[_0x0872('0x3a')](_0x42431a,function(_0x53b3c6){if(_[_0x0872('0x3b')](['string',_0x0872('0x3c')],_0x53b3c6['type'])&&_0x53b3c6['nameField']&&!_0x53b3c6[_0x0872('0x3d')]){_0x6dc826[_0x53b3c6[_0x0872('0x3e')][_0x0872('0x3f')]()]=_0x53b3c6[_0x0872('0x40')][_0x0872('0x34')]();}else if(_[_0x0872('0x3b')]([_0x0872('0x41'),_0x0872('0x3c')],_0x53b3c6[_0x0872('0x42')])&&_0x53b3c6['idField']&&_0x53b3c6[_0x0872('0x3d')]){_0x6dc826[_0x0872('0x43')][_0x0872('0x44')]({'id':_0x53b3c6[_0x0872('0x45')],'value':_0x53b3c6[_0x0872('0x40')][_0x0872('0x34')]()});}else if(_0x53b3c6['type']===_0x0872('0x46')&&_0x53b3c6[_0x0872('0x47')]&&_0x53b3c6[_0x0872('0x45')]&&_0x53b3c6[_0x0872('0x3d')]){_0x52237b[_0x53b3c6[_0x0872('0x47')]]&&_0x6dc826[_0x0872('0x43')][_0x0872('0x44')]({'id':_0x53b3c6[_0x0872('0x45')],'value':_0x52237b[_0x53b3c6[_0x0872('0x47')]][_0x0872('0x34')]()});}else if(_0x53b3c6[_0x0872('0x42')]===_0x0872('0x48')&&_0x53b3c6['Variable']&&_0x53b3c6[_0x0872('0x49')][_0x0872('0x10')]&&_0x53b3c6[_0x0872('0x45')]&&_0x53b3c6[_0x0872('0x3d')]){_0x52237b[_0x53b3c6[_0x0872('0x49')][_0x0872('0x10')]['toLowerCase']()]&&_0x6dc826[_0x0872('0x43')][_0x0872('0x44')]({'id':_0x53b3c6[_0x0872('0x45')],'value':_0x52237b[_0x53b3c6[_0x0872('0x49')][_0x0872('0x10')]['toLowerCase']()][_0x0872('0x34')]()});}});}return _0x6dc826;}exports[_0x0872('0x4a')]=function(_0x449bdf,_0x10964b,_0x270a9e,_0x1b9688,_0x18637b,_0x3d8a80){var _0x3991dd,_0x535820;_0x3d8a80[_0x0872('0xd')]=intUtil['stripTrailingSlash'](_0x3d8a80[_0x0872('0xd')]);_0x3d8a80[_0x0872('0x4b')]=intUtil['stripTrailingSlash'](_0x3d8a80[_0x0872('0x4b')]);if(_0x18637b&&_0x18637b[_0x0872('0x4c')]){logger[_0x0872('0xa')](_0x0872('0x4d'),'Recording\x20is\x20enabled!');_0x10964b[_0x0872('0x4e')]=util[_0x0872('0xc')](_0x0872('0x4f'),_0x3d8a80[_0x0872('0x4b')],_0x10964b[_0x0872('0x50')],md5(_0x10964b[_0x0872('0x50')]));}else{_0x10964b[_0x0872('0x4e')]='';}headers['Authorization']=getAuth(_0x3d8a80);return getUser(_0x3d8a80,_0x1b9688['email'])['then'](function(_0x492a67){_0x3991dd=_0x492a67;logger[_0x0872('0xa')](_0x0872('0x51'),_0x3991dd['id']);return getEndUser(_0x3d8a80,_0x10964b[_0x0872('0x52')],_0x10964b[_0x0872('0x53')]);})[_0x0872('0x15')](function(_0x3497fb){_0x535820=_0x3497fb;logger[_0x0872('0xa')](_0x0872('0x54'),_0x535820['id']);return getTicket(_0x3d8a80,_0x3991dd,_0x535820,_0x270a9e,_0x10964b);})[_0x0872('0x15')](function(_0x9ca20b){if(_0x9ca20b){logger['info'](_0x0872('0x55'),_0x9ca20b['id']);switch(_0x3d8a80['type']){case _0x0872('0x56'):logger[_0x0872('0xa')](_0x0872('0x4d'),_0x0872('0x57'));return request({'uri':util[_0x0872('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3d8a80[_0x0872('0xd')],_0x3991dd['id'],_0x9ca20b['id']),'method':_0x0872('0xe')});case'newTab':logger[_0x0872('0xa')](_0x0872('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0872('0xc')](_0x0872('0x58'),_0x1b9688[_0x0872('0x10')]),_0x0872('0x59'),{'uri':util['format'](_0x0872('0x5a'),_0x3d8a80[_0x0872('0xd')][_0x0872('0x5b')]('/api/v2',''),_0x9ca20b['id'])});break;default:logger[_0x0872('0x5c')]('[QUEUE]',_0x0872('0x5d'));}}})[_0x0872('0x5e')](function(_0x24c2af){logger[_0x0872('0x5c')](_0x0872('0x5f'),util['inspect'](_0x24c2af,{'showHidden':!![],'depth':null}));});};exports[_0x0872('0x60')]=function(_0x308b33,_0xcea98a,_0x5e7098,_0x2d87b1,_0x58c07c,_0x1e993f,_0x33f148){var _0x3d5283,_0x3e528b;_0x1e993f[_0x0872('0xd')]=intUtil[_0x0872('0x61')](_0x1e993f[_0x0872('0xd')]);_0x1e993f[_0x0872('0x4b')]=intUtil[_0x0872('0x61')](_0x1e993f[_0x0872('0x4b')]);if(_0x33f148&&_0x33f148[_0x0872('0x62')]&&_0x33f148['recordingFormat']!==_0x0872('0x63')){logger['info'](_0x0872('0x64'),_0x0872('0x65'));_0xcea98a['recordingURL']=util[_0x0872('0xc')](_0x0872('0x4f'),_0x1e993f[_0x0872('0x4b')],_0xcea98a[_0x0872('0x50')],md5(_0xcea98a[_0x0872('0x50')]));}headers[_0x0872('0x66')]=getAuth(_0x1e993f);return getUser(_0x1e993f,_0x2d87b1[_0x0872('0x67')])[_0x0872('0x15')](function(_0x57e7d4){_0x3d5283=_0x57e7d4;logger[_0x0872('0xa')](_0x0872('0x51'),_0x3d5283['id']);return getEndUser(_0x1e993f,_0xcea98a['destcalleridname'],_0xcea98a[_0x0872('0x68')]);})['then'](function(_0x5ba205){_0x3e528b=_0x5ba205;logger['info'](_0x0872('0x54'),_0x3e528b['id']);return getTicket(_0x1e993f,_0x3d5283,_0x3e528b,_0x5e7098,_0xcea98a);})[_0x0872('0x15')](function(_0x59bb5e){if(_0x59bb5e){logger[_0x0872('0xa')](_0x0872('0x55'),_0x59bb5e['id']);switch(_0x1e993f[_0x0872('0x42')]){case _0x0872('0x56'):logger['info'](_0x0872('0x64'),_0x0872('0x57'));return request({'uri':util['format'](_0x0872('0x69'),_0x1e993f[_0x0872('0xd')],_0x3d5283['id'],_0x59bb5e['id']),'method':_0x0872('0xe')});case _0x0872('0x6a'):logger['info']('[OUTBOUND]',_0x0872('0x6b'));emit(util[_0x0872('0xc')]('user:%s',_0x2d87b1['name']),_0x0872('0x59'),{'uri':util[_0x0872('0xc')](_0x0872('0x5a'),_0x1e993f[_0x0872('0xd')]['replace'](_0x0872('0x6c'),''),_0x59bb5e['id'])});break;default:logger['error'](_0x0872('0x64'),_0x0872('0x5d'));}}})['catch'](function(_0x1faadd){logger['error'](_0x0872('0x6d'),util[_0x0872('0x6e')](_0x1faadd,{'showHidden':!![],'depth':null}));});};exports[_0x0872('0x6f')]=function(_0x15056f,_0x222db9,_0x587709,_0xecdd86,_0x436082,_0xdeb65){var _0x34cb23,_0x1f009c;_0xdeb65[_0x0872('0xd')]=intUtil[_0x0872('0x61')](_0xdeb65['remoteUri']);_0xdeb65[_0x0872('0x4b')]=intUtil[_0x0872('0x61')](_0xdeb65[_0x0872('0x4b')]);if(_0x436082&&_0x436082[_0x0872('0x4c')]){logger[_0x0872('0xa')]('['+_0x222db9[_0x0872('0x70')]['toUpperCase']()+']',_0x0872('0x65'));_0x222db9[_0x0872('0x4e')]=util[_0x0872('0xc')](_0x0872('0x4f'),_0xdeb65[_0x0872('0x4b')],_0x222db9[_0x0872('0x50')],md5(_0x222db9[_0x0872('0x50')]));}else{_0x222db9[_0x0872('0x4e')]='';}headers[_0x0872('0x66')]=getAuth(_0xdeb65);return getUser(_0xdeb65)[_0x0872('0x15')](function(_0x408f01){_0x34cb23=_0x408f01;logger['info'](_0x0872('0x51'),_0x34cb23['id']);return getEndUser(_0xdeb65,_0x222db9[_0x0872('0x52')],_0x222db9[_0x0872('0x53')]);})[_0x0872('0x15')](function(_0x1fdd14){_0x1f009c=_0x1fdd14;logger[_0x0872('0xa')](_0x0872('0x54'),_0x1f009c['id']);return getTicket(_0xdeb65,_0x34cb23,_0x1f009c,_0x587709,_0x222db9);})[_0x0872('0x15')](function(_0x2584f2){if(_0x2584f2){logger[_0x0872('0xa')](_0x0872('0x55'),_0x2584f2['id']);}})[_0x0872('0x5e')](function(_0x5a43c0){logger[_0x0872('0x5c')]('['+_0x222db9[_0x0872('0x70')]['toUpperCase']()+']'+_0x0872('0x71'),util[_0x0872('0x6e')](_0x5a43c0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x86bd=['validateEmail','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','push','variable','variableName','idField','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','Displaying\x20ticket\x20to\x20agent...','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','toUpperCase','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','Descriptions','then','ticket'];(function(_0x24b1f6,_0x51bde3){var _0x5a6ea6=function(_0x3044be){while(--_0x3044be){_0x24b1f6['push'](_0x24b1f6['shift']());}};_0x5a6ea6(++_0x51bde3);}(_0x86bd,0x131));var _0xd86b=function(_0x499b62,_0x2e7c5d){_0x499b62=_0x499b62-0x0;var _0x51e6f9=_0x86bd[_0x499b62];return _0x51e6f9;};'use strict';var _=require(_0xd86b('0x0'));var rp=require(_0xd86b('0x1'));var md5=require(_0xd86b('0x2'));var util=require(_0xd86b('0x3'));var Redis=require(_0xd86b('0x4'));var intUtil=require(_0xd86b('0x5'));var config=require(_0xd86b('0x6'));var logger=require(_0xd86b('0x7'))(_0xd86b('0x8'));config['redis']=_[_0xd86b('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd86b('0xa'))(new Redis(config['redis']));function emit(_0xed0270,_0x3e2987,_0x1d98d0){io['to'](_0xed0270)[_0xd86b('0xb')](_0x3e2987,_0x1d98d0);}var headers={'Content-Type':_0xd86b('0xc'),'Accept':'application/json'};function getTicket(_0x2a3a13,_0x425423,_0x2aa114,_0x4e7f15,_0x36f698){logger[_0xd86b('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xd86b('0xe')](_0xd86b('0xf'),_0x2a3a13[_0xd86b('0x10')]),'method':_0xd86b('0x11'),'body':{'ticket':_[_0xd86b('0x12')]({'requester_id':_0x2aa114['id'],'submitter_id':_0x425423?_0x425423['id']:undefined,'assignee_id':_0x425423?_0x425423['id']:undefined,'tags':getTags(_0x4e7f15[_0xd86b('0x13')],_0xd86b('0x14')),'subject':intUtil['getString'](_0x4e7f15[_0xd86b('0x15')],_0x36f698,'\x20'),'description':intUtil['getString'](_0x4e7f15['Descriptions'],_0x36f698,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4e7f15[_0xd86b('0x16')],_0x36f698,'\x0a')}},getCustomFields(_0x4e7f15['Fields'],_0x36f698))}})[_0xd86b('0x17')](function(_0x3a9845){logger[_0xd86b('0xd')]('Ticket\x20created!');return _0x3a9845[_0xd86b('0x18')];});}function getUser(_0x33ffbd,_0x315be4){if(intUtil[_0xd86b('0x19')](_0x315be4)){logger[_0xd86b('0xd')]('Getting\x20agent\x20with\x20email',_0x315be4);return request({'uri':util[_0xd86b('0xe')]('%s/search.json',_0x33ffbd[_0xd86b('0x10')]),'qs':{'query':util['format'](_0xd86b('0x1a'),_0x315be4)}})[_0xd86b('0x17')](function(_0x2f9ed4){if(_0x2f9ed4[_0xd86b('0x1b')]){logger[_0xd86b('0xd')](_0xd86b('0x1c'));return _['find'](_0x2f9ed4[_0xd86b('0x1d')],{'email':_0x315be4,'role':_0xd86b('0x1e')});}else{logger[_0xd86b('0xd')](_0xd86b('0x1f'));return request({'uri':util['format'](_0xd86b('0x20'),_0x33ffbd['remoteUri'])})[_0xd86b('0x17')](function(_0x10e5b4){logger[_0xd86b('0xd')](_0xd86b('0x21'));return _0x10e5b4['user'];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x33ffbd[_0xd86b('0x10')])})['then'](function(_0xd6de3e){logger[_0xd86b('0xd')]('Admin\x20account\x20selected.');return _0xd6de3e[_0xd86b('0x22')];});}}function getEndUser(_0x11646f,_0x103e2a,_0x4cc489){logger['info'](_0xd86b('0x23'),_0x4cc489);return request({'uri':util[_0xd86b('0xe')](_0xd86b('0x24'),_0x11646f[_0xd86b('0x10')]),'qs':{'query':util[_0xd86b('0xe')](_0xd86b('0x25'),_0x4cc489)}})[_0xd86b('0x17')](function(_0x1b8c4b){var _0x507448;if(_0x1b8c4b[_0xd86b('0x1d')]['length']){_0x1b8c4b[_0xd86b('0x1d')]=_[_0xd86b('0x26')](_0x1b8c4b[_0xd86b('0x1d')],{'suspended':![],'role':_0xd86b('0x27')});if(_0x1b8c4b[_0xd86b('0x1d')][_0xd86b('0x28')]){_0x507448=_['first'](_0x1b8c4b[_0xd86b('0x1d')]);}}if(_0x507448){logger[_0xd86b('0xd')]('Enduser\x20found!');return _0x507448;}else{logger[_0xd86b('0xd')](_0xd86b('0x29'));return request({'uri':util['format'](_0xd86b('0x2a'),_0x11646f[_0xd86b('0x10')]),'method':_0xd86b('0x11'),'body':{'user':{'role':_0xd86b('0x27'),'name':util['format']('Caller\x20-\x20%s',_0x103e2a||_0x4cc489),'phone':_0x4cc489}}})[_0xd86b('0x17')](function(_0x389f6b){logger[_0xd86b('0xd')](_0xd86b('0x2b'));return _0x389f6b[_0xd86b('0x22')];});}});}function getAuth(_0x3b399b){var _0x574e2d;if(_0x3b399b['authType']===_0xd86b('0x2c')){_0x574e2d=util['format'](_0xd86b('0x2d'),_0x3b399b[_0xd86b('0x2e')],_0x3b399b['password']);}else if(_0x3b399b['authType']===_0xd86b('0x2f')){_0x574e2d=util[_0xd86b('0xe')](_0xd86b('0x30'),_0x3b399b[_0xd86b('0x2e')],_0x3b399b[_0xd86b('0x2f')]);}return util[_0xd86b('0xe')](_0xd86b('0x31'),new Buffer(_0x574e2d)[_0xd86b('0x32')]('base64'));}function request(_0x185189){logger[_0xd86b('0x33')](_0xd86b('0x34'),JSON['stringify'](_0x185189));return rp(_['defaults'](_0x185189,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x593405,_0x515680){var _0xc40062=[];if(_0x593405&&_0x593405['length']>0x0){_0xc40062=_[_0xd86b('0x35')](_0x593405,_0x515680);}return _0xc40062;}function getCustomFields(_0x9a3a6a,_0x5d8871){var _0x5df8e2=[];var _0x4eabbe={'custom_fields':[]};if(_0x9a3a6a[_0xd86b('0x28')]>0x0){_[_0xd86b('0x36')](_0x9a3a6a,function(_0x4f23be){if(_[_0xd86b('0x37')]([_0xd86b('0x38'),_0xd86b('0x39')],_0x4f23be[_0xd86b('0x3a')])&&_0x4f23be[_0xd86b('0x3b')]&&!_0x4f23be[_0xd86b('0x3c')]){_0x4eabbe[_0x4f23be[_0xd86b('0x3b')][_0xd86b('0x3d')]()]=_0x4f23be[_0xd86b('0x3e')][_0xd86b('0x32')]();}else if(_[_0xd86b('0x37')](['string',_0xd86b('0x39')],_0x4f23be[_0xd86b('0x3a')])&&_0x4f23be['idField']&&_0x4f23be[_0xd86b('0x3c')]){_0x4eabbe[_0xd86b('0x3f')][_0xd86b('0x40')]({'id':_0x4f23be['idField'],'value':_0x4f23be[_0xd86b('0x3e')][_0xd86b('0x32')]()});}else if(_0x4f23be['type']===_0xd86b('0x41')&&_0x4f23be[_0xd86b('0x42')]&&_0x4f23be[_0xd86b('0x43')]&&_0x4f23be['customField']){_0x5d8871[_0x4f23be[_0xd86b('0x42')]]&&_0x4eabbe['custom_fields'][_0xd86b('0x40')]({'id':_0x4f23be[_0xd86b('0x43')],'value':_0x5d8871[_0x4f23be['variableName']][_0xd86b('0x32')]()});}else if(_0x4f23be[_0xd86b('0x3a')]==='customVariable'&&_0x4f23be[_0xd86b('0x44')]&&_0x4f23be['Variable']['name']&&_0x4f23be[_0xd86b('0x43')]&&_0x4f23be[_0xd86b('0x3c')]){_0x5d8871[_0x4f23be[_0xd86b('0x44')][_0xd86b('0x14')][_0xd86b('0x3d')]()]&&_0x4eabbe[_0xd86b('0x3f')]['push']({'id':_0x4f23be[_0xd86b('0x43')],'value':_0x5d8871[_0x4f23be[_0xd86b('0x44')][_0xd86b('0x14')][_0xd86b('0x3d')]()]['toString']()});}});}return _0x4eabbe;}exports[_0xd86b('0x45')]=function(_0x3f04f7,_0x33b74d,_0x24da2a,_0x319273,_0x51b3b4,_0x35678c){var _0x3d2d5b,_0x3cd02a;_0x35678c[_0xd86b('0x10')]=intUtil[_0xd86b('0x46')](_0x35678c[_0xd86b('0x10')]);_0x35678c[_0xd86b('0x47')]=intUtil[_0xd86b('0x46')](_0x35678c[_0xd86b('0x47')]);if(_0x51b3b4&&_0x51b3b4[_0xd86b('0x48')]){logger[_0xd86b('0xd')](_0xd86b('0x49'),_0xd86b('0x4a'));_0x33b74d['recordingURL']=util[_0xd86b('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35678c[_0xd86b('0x47')],_0x33b74d['uniqueid'],md5(_0x33b74d[_0xd86b('0x4b')]));}else{_0x33b74d[_0xd86b('0x4c')]='';}headers[_0xd86b('0x4d')]=getAuth(_0x35678c);return getUser(_0x35678c,_0x319273[_0xd86b('0x4e')])[_0xd86b('0x17')](function(_0x2de84c){_0x3d2d5b=_0x2de84c;logger['info']('The\x20User\x20ID\x20is:',_0x3d2d5b['id']);return getEndUser(_0x35678c,_0x33b74d[_0xd86b('0x4f')],_0x33b74d['calleridnum']);})['then'](function(_0x2d89ba){_0x3cd02a=_0x2d89ba;logger[_0xd86b('0xd')](_0xd86b('0x50'),_0x3cd02a['id']);return getTicket(_0x35678c,_0x3d2d5b,_0x3cd02a,_0x24da2a,_0x33b74d);})[_0xd86b('0x17')](function(_0xe6537b){if(_0xe6537b){logger[_0xd86b('0xd')](_0xd86b('0x51'),_0xe6537b['id']);switch(_0x35678c[_0xd86b('0x3a')]){case _0xd86b('0x52'):logger[_0xd86b('0xd')](_0xd86b('0x49'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xd86b('0xe')](_0xd86b('0x53'),_0x35678c[_0xd86b('0x10')],_0x3d2d5b['id'],_0xe6537b['id']),'method':_0xd86b('0x11')});case _0xd86b('0x54'):logger[_0xd86b('0xd')](_0xd86b('0x49'),_0xd86b('0x55'));emit(util[_0xd86b('0xe')](_0xd86b('0x56'),_0x319273[_0xd86b('0x14')]),_0xd86b('0x57'),{'uri':util[_0xd86b('0xe')](_0xd86b('0x58'),_0x35678c['remoteUri'][_0xd86b('0x59')]('/api/v2',''),_0xe6537b['id'])});break;default:logger[_0xd86b('0x5a')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd86b('0x5b')](function(_0x5dfa0a){logger['error'](_0xd86b('0x5c'),util['inspect'](_0x5dfa0a,{'showHidden':!![],'depth':null}));});};exports[_0xd86b('0x5d')]=function(_0x9f22d9,_0x20b6f4,_0x53896e,_0x2e47a7,_0x18060e,_0x28c1d2,_0x3b775a){var _0x163c3b,_0x3618e3;_0x28c1d2[_0xd86b('0x10')]=intUtil[_0xd86b('0x46')](_0x28c1d2['remoteUri']);_0x28c1d2[_0xd86b('0x47')]=intUtil[_0xd86b('0x46')](_0x28c1d2[_0xd86b('0x47')]);if(_0x3b775a&&_0x3b775a[_0xd86b('0x5e')]&&_0x3b775a['recordingFormat']!==_0xd86b('0x5f')){logger['info'](_0xd86b('0x60'),_0xd86b('0x4a'));_0x20b6f4[_0xd86b('0x4c')]=util[_0xd86b('0xe')](_0xd86b('0x61'),_0x28c1d2[_0xd86b('0x47')],_0x20b6f4[_0xd86b('0x4b')],md5(_0x20b6f4[_0xd86b('0x4b')]));}headers[_0xd86b('0x4d')]=getAuth(_0x28c1d2);return getUser(_0x28c1d2,_0x2e47a7[_0xd86b('0x4e')])['then'](function(_0x5b5991){_0x163c3b=_0x5b5991;logger['info'](_0xd86b('0x62'),_0x163c3b['id']);return getEndUser(_0x28c1d2,_0x20b6f4[_0xd86b('0x63')],_0x20b6f4['destcalleridnum']);})[_0xd86b('0x17')](function(_0x4e6aa7){_0x3618e3=_0x4e6aa7;logger['info'](_0xd86b('0x50'),_0x3618e3['id']);return getTicket(_0x28c1d2,_0x163c3b,_0x3618e3,_0x53896e,_0x20b6f4);})[_0xd86b('0x17')](function(_0x42a650){if(_0x42a650){logger[_0xd86b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x42a650['id']);switch(_0x28c1d2[_0xd86b('0x3a')]){case _0xd86b('0x52'):logger[_0xd86b('0xd')]('[OUTBOUND]',_0xd86b('0x64'));return request({'uri':util[_0xd86b('0xe')](_0xd86b('0x53'),_0x28c1d2[_0xd86b('0x10')],_0x163c3b['id'],_0x42a650['id']),'method':_0xd86b('0x11')});case _0xd86b('0x54'):logger['info'](_0xd86b('0x60'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xd86b('0x56'),_0x2e47a7[_0xd86b('0x14')]),'trigger:browser:url',{'uri':util[_0xd86b('0xe')](_0xd86b('0x58'),_0x28c1d2[_0xd86b('0x10')][_0xd86b('0x59')](_0xd86b('0x65'),''),_0x42a650['id'])});break;default:logger[_0xd86b('0x5a')](_0xd86b('0x60'),_0xd86b('0x66'));}}})[_0xd86b('0x5b')](function(_0x2fdda6){logger[_0xd86b('0x5a')](_0xd86b('0x67'),util[_0xd86b('0x68')](_0x2fdda6,{'showHidden':!![],'depth':null}));});};exports[_0xd86b('0x69')]=function(_0x4c8aa1,_0x492567,_0x4f7aff,_0x215ddd,_0x550c62,_0x4fcfbd){var _0x3b82af,_0x3cadab;_0x4fcfbd[_0xd86b('0x10')]=intUtil[_0xd86b('0x46')](_0x4fcfbd['remoteUri']);_0x4fcfbd[_0xd86b('0x47')]=intUtil[_0xd86b('0x46')](_0x4fcfbd[_0xd86b('0x47')]);if(_0x550c62&&_0x550c62[_0xd86b('0x48')]){logger[_0xd86b('0xd')]('['+_0x492567['lastevent'][_0xd86b('0x6a')]()+']',_0xd86b('0x4a'));_0x492567['recordingURL']=util[_0xd86b('0xe')](_0xd86b('0x61'),_0x4fcfbd[_0xd86b('0x47')],_0x492567['uniqueid'],md5(_0x492567[_0xd86b('0x4b')]));}else{_0x492567[_0xd86b('0x4c')]='';}headers['Authorization']=getAuth(_0x4fcfbd);return getUser(_0x4fcfbd)[_0xd86b('0x17')](function(_0x24881d){_0x3b82af=_0x24881d;logger[_0xd86b('0xd')](_0xd86b('0x62'),_0x3b82af['id']);return getEndUser(_0x4fcfbd,_0x492567[_0xd86b('0x4f')],_0x492567[_0xd86b('0x6b')]);})[_0xd86b('0x17')](function(_0x448662){_0x3cadab=_0x448662;logger['info'](_0xd86b('0x50'),_0x3cadab['id']);return getTicket(_0x4fcfbd,_0x3b82af,_0x3cadab,_0x4f7aff,_0x492567);})[_0xd86b('0x17')](function(_0x550dcd){if(_0x550dcd){logger['info'](_0xd86b('0x51'),_0x550dcd['id']);}})['catch'](function(_0x4705e3){logger[_0xd86b('0x5a')]('['+_0x492567[_0xd86b('0x6c')][_0xd86b('0x6a')]()+']'+_0xd86b('0x6d'),util['inspect'](_0x4705e3,{'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 460d775..7d544e3 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 _0x4f9c=['Subject','getString','Subjects','Description','Descriptions','Last_Name','What_Id','Full_Name','First_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','complete','connect','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','merge','Fields','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','com','The\x20User\x20ID\x20is:','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/downloads?type=uniqueid&token=','zoho.eu','destcalleridname','[OUTBOUND]','unmanaged','lastevent','calleridname','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','picklist','type','idField','toString','variable','variableName','Variable','name','toLowerCase','split','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','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','isNil','first_name','last_name','Zoho-oauthtoken\x20','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','role','administrator'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x4f9c,0xdc));var _0xc4f9=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x4f9c[_0x267c52];return _0x46c47b;};'use strict';var _=require(_0xc4f9('0x0'));var rp=require(_0xc4f9('0x1'));var md5=require(_0xc4f9('0x2'));var util=require(_0xc4f9('0x3'));var intUtil=require(_0xc4f9('0x4'));var moment=require(_0xc4f9('0x5'));var Redis=require(_0xc4f9('0x6'));var BPromise=require(_0xc4f9('0x7'));var config=require(_0xc4f9('0x8'));var logger=require(_0xc4f9('0x9'))(_0xc4f9('0xa'));config[_0xc4f9('0xb')]=_[_0xc4f9('0xc')](config[_0xc4f9('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xc4f9('0xd'))(new Redis(config[_0xc4f9('0xb')]));function emit(_0x7eafb0,_0x115095,_0x2249c6){io['to'](_0x7eafb0)[_0xc4f9('0xe')](_0x115095,_0x2249c6);}function request(_0x2dd2b3){logger[_0xc4f9('0xf')](_0xc4f9('0x10'),JSON[_0xc4f9('0x11')](_0x2dd2b3));return rp(_0x2dd2b3);}function getCustomFields(_0x2d27ce,_0x4f3370){var _0x2d7a16={};if(_0x2d27ce[_0xc4f9('0x12')]>0x0){_[_0xc4f9('0x13')](_0x2d27ce,function(_0x586646){if(_['includes']([_0xc4f9('0x14'),_0xc4f9('0x15')],_0x586646[_0xc4f9('0x16')])&&_0x586646['idField']){_0x2d7a16[_0x586646[_0xc4f9('0x17')]]=_0x586646['content'][_0xc4f9('0x18')]();}else if(_0x586646[_0xc4f9('0x16')]===_0xc4f9('0x19')&&_0x586646[_0xc4f9('0x1a')]&&_0x586646['idField']&&_0x4f3370[_0x586646[_0xc4f9('0x1a')]]){_0x2d7a16[_0x586646[_0xc4f9('0x17')]]=_0x4f3370[_0x586646['variableName']][_0xc4f9('0x18')]();}else if(_0x586646[_0xc4f9('0x16')]==='customVariable'&&_0x586646[_0xc4f9('0x1b')]&&_0x586646['Variable'][_0xc4f9('0x1c')]&&_0x586646[_0xc4f9('0x17')]&&_0x4f3370[_0x586646['Variable'][_0xc4f9('0x1c')]['toLowerCase']()]){_0x2d7a16[_0x586646[_0xc4f9('0x17')]]=_0x4f3370[_0x586646['Variable']['name'][_0xc4f9('0x1d')]()][_0xc4f9('0x18')]();}});}return _0x2d7a16;}function getName(_0x1c86eb){if(_0x1c86eb['indexOf']('\x20')>0x0){var _0x33f8a6=_0x1c86eb[_0xc4f9('0x1e')](/ (.+)/);if(_0x33f8a6[0x1]){return _0x33f8a6;}}return[_0x1c86eb,_0x1c86eb];}var accountsTokens={};function getAccessToken(_0x32dc36){return new Promise(function(_0x2c569e,_0x179d3d){if(!_['isNil'](accountsTokens[_0x32dc36['id']])&&!_['isNil'](accountsTokens[_0x32dc36['id']][_0xc4f9('0x1f')])){if(moment()[_0xc4f9('0x20')](accountsTokens[_0x32dc36['id']][_0xc4f9('0x21')])){_0x2c569e(accountsTokens[_0x32dc36['id']][_0xc4f9('0x1f')]);}}var _0xe96a76;switch(_0x32dc36['zone']){case'US':_0xe96a76=_0xc4f9('0x22');break;case'AU':_0xe96a76='https://accounts.zoho.com.au';break;case'EU':_0xe96a76='https://accounts.zoho.eu';break;case'IN':_0xe96a76=_0xc4f9('0x23');break;case'CN':_0xe96a76='https://accounts.zoho.com.cn';break;default:_0xe96a76=_0xc4f9('0x24');break;}var _0x412790={'method':_0xc4f9('0x25'),'uri':_0xe96a76+_0xc4f9('0x26'),'qs':{'refresh_token':_0x32dc36[_0xc4f9('0x27')],'client_id':_0x32dc36[_0xc4f9('0x28')],'client_secret':_0x32dc36[_0xc4f9('0x29')],'grant_type':_0xc4f9('0x2a')},'json':!![]};return rp(_0x412790)[_0xc4f9('0x2b')](function(_0x281756){accountsTokens[_0x32dc36['id']]={'access_token':_0x281756[_0xc4f9('0x1f')],'expires_in':moment()[_0xc4f9('0x2c')](_0x281756['expires_in'],'seconds')};_0x2c569e(_0x281756[_0xc4f9('0x1f')]);})[_0xc4f9('0x2d')](function(_0x1b3064){logger[_0xc4f9('0x2e')](_0xc4f9('0x2f'),_0x1b3064['stack']);_0x179d3d(_0x1b3064);});});}function getUser(_0x93846d,_0x12b453,_0x56452e,_0x353eb3){logger[_0xc4f9('0x30')](_0xc4f9('0x31'));return request({'method':_0xc4f9('0x32'),'uri':util[_0xc4f9('0x33')](_0xc4f9('0x34'),_0x12b453),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x93846d},'json':!![]})[_0xc4f9('0x2b')](function(_0x247ff0){if(_0x247ff0[_0xc4f9('0x35')]){var _0x6fb28f=-0x1;if(_[_0xc4f9('0x36')](_0x247ff0['users'])){if(!_['isNil'](_0x353eb3)){_0x6fb28f=_['findIndex'](_0x247ff0['users'],function(_0x230889){return _0x230889[_0xc4f9('0x37')]===_0x353eb3;});}if(_0x6fb28f>=0x0){logger[_0xc4f9('0x30')](_0xc4f9('0x38'));}else{logger[_0xc4f9('0x30')](_0xc4f9('0x39'));_0x6fb28f=_[_0xc4f9('0x3a')](_0x247ff0['users'],function(_0x201a3c){return _0x201a3c[_0xc4f9('0x3b')]['name']==='Administrator';});}return _0x247ff0[_0xc4f9('0x35')][_0x6fb28f];}else{if(_0x247ff0[_0xc4f9('0x3c')]['profile'][_0xc4f9('0x1c')]===_0xc4f9('0x3d')){logger['info'](_0xc4f9('0x39'));user=_0x247ff0[_0xc4f9('0x3c')];return user;}else{logger[_0xc4f9('0x2e')](_0xc4f9('0x3e'),JSON[_0xc4f9('0x11')](_0x247ff0));throw new Error(_0xc4f9('0x3f')+JSON[_0xc4f9('0x11')](_0x247ff0));}}}else{logger[_0xc4f9('0x2e')]('The\x20failing\x20result\x20is',JSON[_0xc4f9('0x11')](_0x247ff0));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xc4f9('0x11')](_0x247ff0));}})[_0xc4f9('0x2d')](function(_0x492f61){console[_0xc4f9('0x2e')](_0x492f61);});}function getZohoUser(_0x5ef622,_0x1de6d1){return new BPromise(function(_0x23cc48,_0x442212){request(_0x5ef622)[_0xc4f9('0x2b')](function(_0x4efc43){var _0x260aca=null;if(_0x4efc43){_0x260aca=_0x4efc43[_0xc4f9('0x40')][0x0];_0x260aca[_0xc4f9('0x41')]=_0x1de6d1;}_0x23cc48(_0x260aca);})[_0xc4f9('0x2d')](function(_0x19209f){_0x442212(_0x19209f);});});}function createEndUser(_0x41a04c,_0x118a75,_0x257862,_0x29b242,_0x30482f,_0x106b94){var _0x257862=getName(_0x257862);return request({'method':_0xc4f9('0x25'),'uri':_0xc4f9('0x42')+_0x118a75+_0xc4f9('0x43')+_[_0xc4f9('0x44')](_0x106b94[_0xc4f9('0x45')])+'s','body':{'data':[{'Last_Name':_0x257862[0x1],'First_Name':_0x257862[0x0],'Phone':_0x29b242,'Owner':{'name':!_[_0xc4f9('0x46')](_0x30482f['role']['name'])?_0x30482f['role']['name']:!_[_0xc4f9('0x46')](_0x30482f[_0xc4f9('0x47')])?_0x30482f['first_name']+'\x20'+_0x30482f[_0xc4f9('0x48')]:_0x30482f['last_name'],'id':_0x30482f['id']}}]},'headers':{'Authorization':_0xc4f9('0x49')+_0x41a04c},'json':!![]})[_0xc4f9('0x2b')](function(_0x541918){if(_0x541918&&_0x541918['data'][0x0][_0xc4f9('0x4a')]==='SUCCESS'){var _0x628096=_0x541918['data'][0x0][_0xc4f9('0x4b')];_0x628096['enduserType']=_[_0xc4f9('0x44')](_0x106b94[_0xc4f9('0x45')])+'s';return _0x628096;}logger[_0xc4f9('0x2e')](_0xc4f9('0x3e'),JSON[_0xc4f9('0x11')](data));throw new Error(_0xc4f9('0x4c')+JSON[_0xc4f9('0x11')](data));})[_0xc4f9('0x2d')](function(_0x5afeec){console[_0xc4f9('0x4d')](_0xc4f9('0x4e'),_0x5afeec);});}function getEndUser(_0x571031,_0xca936e,_0xe45ca9,_0x240680,_0x48f2fc,_0x21d2f8,_0x1e5a0f){var _0x3b88c9={'method':_0xc4f9('0x32'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x571031},'json':!![]};switch(_0x1e5a0f[_0xc4f9('0x4f')]){case _0xc4f9('0x50'):_0x3b88c9[_0xc4f9('0x51')]=_0xc4f9('0x42')+_0xca936e+_0xc4f9('0x52')+_0x48f2fc+'))';return getZohoUser(_0x3b88c9,_0xc4f9('0x53'))[_0xc4f9('0x2b')](function(_0x3be261){if(_0x3be261)return _0x3be261;_0x3b88c9[_0xc4f9('0x51')]=_0xc4f9('0x42')+_0xca936e+_0xc4f9('0x54')+_0x48f2fc+'))';return getZohoUser(_0x3b88c9,_0xc4f9('0x55'))[_0xc4f9('0x2b')](function(_0x24bdd3){if(_0x24bdd3)return _0x24bdd3;if(_0x1e5a0f[_0xc4f9('0x45')]!=_0xc4f9('0x56')){return createEndUser(_0x571031,_0xca936e,_0x240680,_0x48f2fc,_0x21d2f8,_0x1e5a0f);}else{return{};}});});break;case _0xc4f9('0x57'):_0x3b88c9[_0xc4f9('0x51')]=_0xc4f9('0x42')+_0xca936e+_0xc4f9('0x52')+_0x48f2fc+'))';return getZohoUser(_0x3b88c9,_0xc4f9('0x53'))['then'](function(_0x317a8c){if(_0x317a8c)return _0x317a8c;if(_0x1e5a0f[_0xc4f9('0x45')]!=_0xc4f9('0x56')){return createEndUser(_0x571031,_0xca936e,_0x240680,_0x48f2fc,_0x21d2f8,_0x1e5a0f);}else{return{};}});break;case'lead':_0x3b88c9[_0xc4f9('0x51')]=_0xc4f9('0x42')+_0xca936e+_0xc4f9('0x54')+_0x48f2fc+'))';return getZohoUser(_0x3b88c9,_0xc4f9('0x55'))[_0xc4f9('0x2b')](function(_0x9c646c){if(_0x9c646c)return _0x9c646c;if(_0x1e5a0f[_0xc4f9('0x45')]!=_0xc4f9('0x56')){return createEndUser(_0x571031,_0xca936e,_0x240680,_0x48f2fc,_0x21d2f8,_0x1e5a0f);}else{return{};}});break;}}function getCall(_0x1a3bcb,_0x17cd76,_0x5be3ec,_0x1ac9f2,_0x132960,_0x48879b,_0x5986ca,_0x471e22){logger[_0xc4f9('0x30')](_0xc4f9('0x58'));var _0x2cdce7={};_0x2cdce7[_0xc4f9('0x59')]={'name':!_[_0xc4f9('0x46')](_0x1ac9f2[_0xc4f9('0x5a')][_0xc4f9('0x1c')])&&!_[_0xc4f9('0x46')](_0x1ac9f2[_0xc4f9('0x3b')][_0xc4f9('0x1c')])&&_0x1ac9f2['profile'][_0xc4f9('0x1c')]===_0xc4f9('0x5b')?_0x1ac9f2[_0xc4f9('0x5a')][_0xc4f9('0x1c')]:!_[_0xc4f9('0x46')](_0x1ac9f2[_0xc4f9('0x47')])?_0x1ac9f2[_0xc4f9('0x47')]+'\x20'+_0x1ac9f2[_0xc4f9('0x48')]:_0x1ac9f2['last_name'],'id':_0x1ac9f2['id']};_0x2cdce7[_0xc4f9('0x5c')]=intUtil[_0xc4f9('0x5d')](_0x48879b[_0xc4f9('0x5e')],_0x5986ca,'\x20');_0x2cdce7[_0xc4f9('0x5f')]=intUtil[_0xc4f9('0x5d')](_0x48879b[_0xc4f9('0x60')],_0x5986ca,'\x0a');if(_0x132960[_0xc4f9('0x41')]===_0xc4f9('0x53')){_0x2cdce7['Who_Id']={'name':!_[_0xc4f9('0x46')](_0x132960['Full_Name'])?_0x132960['Full_Name']:!_[_0xc4f9('0x46')](_0x132960['First_Name'])?_0x132960['First_Name']+'\x20'+_0x132960[_0xc4f9('0x61')]:_0x132960[_0xc4f9('0x61')],'id':_0x132960['id']};}if(_0x132960[_0xc4f9('0x41')]===_0xc4f9('0x55')){_0x2cdce7[_0xc4f9('0x62')]={'name':!_['isNil'](_0x132960[_0xc4f9('0x63')])?_0x132960[_0xc4f9('0x63')]:!_[_0xc4f9('0x46')](_0x132960[_0xc4f9('0x64')])?_0x132960[_0xc4f9('0x64')]+'\x20'+_0x132960[_0xc4f9('0x61')]:_0x132960[_0xc4f9('0x61')],'id':_0x132960['id']};_0x2cdce7[_0xc4f9('0x65')]=_[_0xc4f9('0x44')](_0x132960['enduserType']);}if(_0x5986ca[_0xc4f9('0x66')]){_0x2cdce7[_0xc4f9('0x67')]=moment['utc'](parseInt(_0x5986ca[_0xc4f9('0x66')])*0x3e8)[_0xc4f9('0x33')](_0xc4f9('0x68'));}else if(_0x5986ca[_0xc4f9('0x69')]&&_0x5986ca[_0xc4f9('0x6a')]){_0x2cdce7[_0xc4f9('0x67')]=moment[_0xc4f9('0x6b')](moment(_0x5986ca[_0xc4f9('0x6a')],_0xc4f9('0x6c'))[_0xc4f9('0x6d')](moment(_0x5986ca[_0xc4f9('0x6e')],_0xc4f9('0x6c'))))[_0xc4f9('0x33')]('mm:ss');}switch(_0x5986ca['lastevent']){case'called':_0x2cdce7[_0xc4f9('0x6f')]='Called';break;case _0xc4f9('0x70'):case _0xc4f9('0x71'):_0x2cdce7[_0xc4f9('0x6f')]='Answered';break;case _0xc4f9('0x72'):_0x2cdce7['Call_Result']=_0xc4f9('0x73');break;case _0xc4f9('0x74'):_0x2cdce7[_0xc4f9('0x6f')]=_0xc4f9('0x75');break;case'timeout':_0x2cdce7[_0xc4f9('0x6f')]=_0xc4f9('0x76');default:}_0x2cdce7[_0xc4f9('0x77')]=(_0x471e22===_0xc4f9('0x78')?moment(_0x5986ca[_0xc4f9('0x6e')])[_0xc4f9('0x33')](_0xc4f9('0x6c')):moment(_0x5986ca[_0xc4f9('0x79')])[_0xc4f9('0x33')](_0xc4f9('0x6c')))||moment()[_0xc4f9('0x33')](_0xc4f9('0x6c'));_0x2cdce7['Call_Type']=_0x471e22||'Inbound';_0x2cdce7=_[_0xc4f9('0x7a')](_0x2cdce7,getCustomFields(_0x48879b[_0xc4f9('0x7b')],_0x5986ca));return request({'method':'POST','uri':_0xc4f9('0x42')+_0x17cd76+'/crm/v2/Calls','headers':{'Authorization':_0xc4f9('0x49')+_0x1a3bcb},'body':{'data':[_0x2cdce7]},'json':!![]})['then'](function(_0x54bdd0){if(_0x54bdd0&&_0x54bdd0[_0xc4f9('0x40')][0x0]['code']===_0xc4f9('0x7c')){logger[_0xc4f9('0x30')](_0xc4f9('0x7d'));return{'id':_0x54bdd0[_0xc4f9('0x40')][0x0][_0xc4f9('0x4b')]['id']};}})['catch'](function(_0x435048){logger['info'](_0xc4f9('0x7e'),_0x435048['stack']);console[_0xc4f9('0x4d')](_0xc4f9('0x7e'),_0x435048);});}exports[_0xc4f9('0x7f')]=function(_0x2d4b4d,_0x38e2a3,_0x30e361,_0x2677e8,_0x3a8e91,_0x2e6d56){var _0x136f79,_0x4c1984,_0x485e;_0x2e6d56[_0xc4f9('0x80')]=intUtil[_0xc4f9('0x81')](_0x2e6d56['host']);_0x2e6d56['serverUrl']=intUtil[_0xc4f9('0x81')](_0x2e6d56[_0xc4f9('0x82')]);if(_0x3a8e91&&_0x3a8e91[_0xc4f9('0x83')]){logger[_0xc4f9('0x30')](_0xc4f9('0x84'),_0xc4f9('0x85'));_0x38e2a3[_0xc4f9('0x86')]=_0x2e6d56[_0xc4f9('0x82')]+_0xc4f9('0x87')+_0x38e2a3[_0xc4f9('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x38e2a3['uniqueid']);}else{_0x38e2a3[_0xc4f9('0x86')]='';}var _0x37e30a=_0x2e6d56[_0xc4f9('0x80')]==='zoho.eu'?'eu':_0xc4f9('0x89');return getAccessToken(_0x2e6d56)['then'](function(_0x243839){_0x485e=_0x243839;return getUser(_0x485e,_0x37e30a,_0x2e6d56,_0x2677e8[_0xc4f9('0x37')]);})[_0xc4f9('0x2b')](function(_0x209ac0){_0x136f79=_0x209ac0;logger[_0xc4f9('0x30')](_0xc4f9('0x8a'),_0x136f79['id']);return getEndUser(_0x485e,_0x37e30a,_0x2e6d56,_0x38e2a3['calleridname'],_0x38e2a3[_0xc4f9('0x8b')],_0x136f79,_0x30e361);})['then'](function(_0x5a8ea3){_0x4c1984=_0x5a8ea3;return getCall(_0x485e,_0x37e30a,_0x2e6d56,_0x136f79,_0x4c1984,_0x30e361,_0x38e2a3,_0xc4f9('0x8c'));})[_0xc4f9('0x2b')](function(_0x5ba2ff){if(_0x5ba2ff){logger[_0xc4f9('0x30')](_0xc4f9('0x8d'),_0x5ba2ff['id']);logger[_0xc4f9('0x30')](_0xc4f9('0x84'),_0xc4f9('0x8e'));emit(util[_0xc4f9('0x33')](_0xc4f9('0x8f'),_0x2677e8[_0xc4f9('0x1c')]),_0xc4f9('0x90'),{'uri':_0xc4f9('0x91')+_0x2e6d56[_0xc4f9('0x80')]+_0xc4f9('0x92')+_0x5ba2ff['id']});}})[_0xc4f9('0x2d')](function(_0x4070e6){logger[_0xc4f9('0x2e')](_0xc4f9('0x84'),JSON[_0xc4f9('0x11')](_0x4070e6));});};exports[_0xc4f9('0x78')]=function(_0x230ab5,_0x3e577e,_0x27e670,_0x3975c8,_0x2aea62,_0x34729e,_0x101267){var _0x387c0b,_0x1842c0,_0x414a63;_0x34729e[_0xc4f9('0x80')]=intUtil[_0xc4f9('0x81')](_0x34729e[_0xc4f9('0x80')]);_0x34729e[_0xc4f9('0x82')]=intUtil[_0xc4f9('0x81')](_0x34729e[_0xc4f9('0x82')]);if(_0x101267&&_0x101267['recordingFormat']&&_0x101267[_0xc4f9('0x93')]!==_0xc4f9('0x94')){logger[_0xc4f9('0x30')]('[OUTBOUND]',_0xc4f9('0x85'));_0x3e577e[_0xc4f9('0x86')]=_0x34729e[_0xc4f9('0x82')]+'/api/voice/recordings/'+_0x3e577e[_0xc4f9('0x88')]+_0xc4f9('0x95')+md5(_0x3e577e[_0xc4f9('0x88')]);}var _0x3baeeb=_0x34729e[_0xc4f9('0x80')]===_0xc4f9('0x96')?'eu':_0xc4f9('0x89');return getAccessToken(_0x34729e)[_0xc4f9('0x2b')](function(_0x5ccfae){_0x414a63=_0x5ccfae;return getUser(_0x414a63,_0x3baeeb,_0x34729e,_0x3975c8[_0xc4f9('0x37')]);})[_0xc4f9('0x2b')](function(_0x20ecae){_0x387c0b=_0x20ecae;logger[_0xc4f9('0x30')]('The\x20User\x20ID\x20is:',_0x387c0b['id']);return getEndUser(_0x414a63,_0x3baeeb,_0x34729e,_0x3e577e[_0xc4f9('0x97')],_0x3e577e['destcalleridnum'],_0x387c0b,_0x27e670);})['then'](function(_0x33f72e){_0x1842c0=_0x33f72e;return getCall(_0x414a63,_0x3baeeb,_0x34729e,_0x387c0b,_0x1842c0,_0x27e670,_0x3e577e,'Outbound');})[_0xc4f9('0x2b')](function(_0x448d0a){if(_0x448d0a){logger[_0xc4f9('0x30')](_0xc4f9('0x8d'),_0x448d0a['id']);logger['info'](_0xc4f9('0x98'),_0xc4f9('0x8e'));emit(util['format']('user:%s',_0x3975c8[_0xc4f9('0x1c')]),_0xc4f9('0x90'),{'uri':_0xc4f9('0x91')+_0x34729e[_0xc4f9('0x80')]+_0xc4f9('0x92')+_0x448d0a['id']});}})[_0xc4f9('0x2d')](function(_0x5d1f23){logger[_0xc4f9('0x2e')](_0xc4f9('0x98'),JSON[_0xc4f9('0x11')](_0x5d1f23));});};exports[_0xc4f9('0x99')]=function(_0xd82bc8,_0x538e6a,_0x481358,_0x4bf857,_0x1dff77,_0x52267e){var _0x2bdc12,_0x185ca1,_0x5c0e80;_0x52267e['host']=intUtil[_0xc4f9('0x81')](_0x52267e[_0xc4f9('0x80')]);_0x52267e[_0xc4f9('0x82')]=intUtil[_0xc4f9('0x81')](_0x52267e['serverUrl']);if(_0x1dff77&&_0x1dff77[_0xc4f9('0x83')]){logger[_0xc4f9('0x30')]('['+_0x538e6a[_0xc4f9('0x9a')]['toUpperCase']()+']',_0xc4f9('0x85'));_0x538e6a[_0xc4f9('0x86')]=_0x52267e['serverUrl']+_0xc4f9('0x87')+_0x538e6a[_0xc4f9('0x88')]+_0xc4f9('0x95')+md5(_0x538e6a[_0xc4f9('0x88')]);}else{_0x538e6a['recordingURL']='';}var _0x435d5c=_0x52267e[_0xc4f9('0x80')]===_0xc4f9('0x96')?'eu':_0xc4f9('0x89');return getAccessToken(_0x52267e)['then'](function(_0x110c2b){_0x5c0e80=_0x110c2b;return getUser(_0x5c0e80,_0x435d5c,_0x52267e);})[_0xc4f9('0x2b')](function(_0x21cd53){_0x2bdc12=_0x21cd53;logger['info'](_0xc4f9('0x8a'),_0x2bdc12['id']);return getEndUser(_0x5c0e80,_0x435d5c,_0x52267e,_0x538e6a[_0xc4f9('0x9b')],_0x538e6a[_0xc4f9('0x8b')],_0x2bdc12,_0x481358);})['then'](function(_0x59e002){_0x185ca1=_0x59e002;return getCall(_0x5c0e80,_0x435d5c,_0x52267e,_0x2bdc12,_0x185ca1,_0x481358,_0x538e6a,_0xc4f9('0x8c'));})[_0xc4f9('0x2b')](function(_0x5ad906){if(_0x5ad906){logger[_0xc4f9('0x30')](_0xc4f9('0x8d'),_0x5ad906['id']);}})['catch'](function(_0x12e3fc){logger[_0xc4f9('0x2e')]('['+_0x538e6a['lastevent']['toUpperCase']()+']',JSON[_0xc4f9('0x11')](_0x12e3fc));});}; \ No newline at end of file +var _0x2eb3=['Inbound','POST','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','request-promise','md5','util','ioredis','redis','localhost','socket.io-emitter','stringify','forEach','includes','string','picklist','type','idField','content','toString','variableName','Variable','name','toLowerCase','split','isNil','isBefore','access_token','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientId','refresh_token','then','add','expires_in','seconds','error','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','catch','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','last_name','data','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','Creating\x20new\x20call...','Owner','profile','administrator','first_name','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','Called','connect','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','agentcalledAt','Call_Type'];(function(_0x191e2d,_0x2af44b){var _0x5b69de=function(_0x328c98){while(--_0x328c98){_0x191e2d['push'](_0x191e2d['shift']());}};_0x5b69de(++_0x2af44b);}(_0x2eb3,0xa2));var _0x32eb=function(_0x4cf838,_0x145b6c){_0x4cf838=_0x4cf838-0x0;var _0x5b9361=_0x2eb3[_0x4cf838];return _0x5b9361;};'use strict';var _=require('lodash');var rp=require(_0x32eb('0x0'));var md5=require(_0x32eb('0x1'));var util=require(_0x32eb('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x32eb('0x3'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zoho');config[_0x32eb('0x4')]=_['defaults'](config[_0x32eb('0x4')],{'host':_0x32eb('0x5'),'port':0x18eb});var io=require(_0x32eb('0x6'))(new Redis(config[_0x32eb('0x4')]));function emit(_0x50f353,_0x2b7c54,_0x44d75a){io['to'](_0x50f353)['emit'](_0x2b7c54,_0x44d75a);}function request(_0x312089){logger['debug']('[HTTP]',JSON[_0x32eb('0x7')](_0x312089));return rp(_0x312089);}function getCustomFields(_0x1be167,_0x58de10){var _0x5f4431={};if(_0x1be167['length']>0x0){_[_0x32eb('0x8')](_0x1be167,function(_0x4bab4c){if(_[_0x32eb('0x9')]([_0x32eb('0xa'),_0x32eb('0xb')],_0x4bab4c[_0x32eb('0xc')])&&_0x4bab4c[_0x32eb('0xd')]){_0x5f4431[_0x4bab4c['idField']]=_0x4bab4c[_0x32eb('0xe')][_0x32eb('0xf')]();}else if(_0x4bab4c[_0x32eb('0xc')]==='variable'&&_0x4bab4c[_0x32eb('0x10')]&&_0x4bab4c[_0x32eb('0xd')]&&_0x58de10[_0x4bab4c[_0x32eb('0x10')]]){_0x5f4431[_0x4bab4c['idField']]=_0x58de10[_0x4bab4c[_0x32eb('0x10')]][_0x32eb('0xf')]();}else if(_0x4bab4c[_0x32eb('0xc')]==='customVariable'&&_0x4bab4c[_0x32eb('0x11')]&&_0x4bab4c[_0x32eb('0x11')][_0x32eb('0x12')]&&_0x4bab4c[_0x32eb('0xd')]&&_0x58de10[_0x4bab4c['Variable'][_0x32eb('0x12')][_0x32eb('0x13')]()]){_0x5f4431[_0x4bab4c[_0x32eb('0xd')]]=_0x58de10[_0x4bab4c[_0x32eb('0x11')][_0x32eb('0x12')]['toLowerCase']()][_0x32eb('0xf')]();}});}return _0x5f4431;}function getName(_0x3dfb96){if(_0x3dfb96['indexOf']('\x20')>0x0){var _0x18f616=_0x3dfb96[_0x32eb('0x14')](/ (.+)/);if(_0x18f616[0x1]){return _0x18f616;}}return[_0x3dfb96,_0x3dfb96];}var accountsTokens={};function getAccessToken(_0x205fc7){return new Promise(function(_0x1c825b,_0x4d2715){if(!_[_0x32eb('0x15')](accountsTokens[_0x205fc7['id']])&&!_['isNil'](accountsTokens[_0x205fc7['id']]['access_token'])){if(moment()[_0x32eb('0x16')](accountsTokens[_0x205fc7['id']]['expires_in'])){_0x1c825b(accountsTokens[_0x205fc7['id']][_0x32eb('0x17')]);}}var _0x3f23a0;switch(_0x205fc7['zone']){case'US':_0x3f23a0=_0x32eb('0x18');break;case'AU':_0x3f23a0='https://accounts.zoho.com.au';break;case'EU':_0x3f23a0=_0x32eb('0x19');break;case'IN':_0x3f23a0=_0x32eb('0x1a');break;case'CN':_0x3f23a0='https://accounts.zoho.com.cn';break;default:_0x3f23a0=_0x32eb('0x19');break;}var _0x548f33={'method':'POST','uri':_0x3f23a0+'/oauth/v2/token','qs':{'refresh_token':_0x205fc7[_0x32eb('0x1b')],'client_id':_0x205fc7[_0x32eb('0x1c')],'client_secret':_0x205fc7['clientSecret'],'grant_type':_0x32eb('0x1d')},'json':!![]};return rp(_0x548f33)[_0x32eb('0x1e')](function(_0x316ec7){accountsTokens[_0x205fc7['id']]={'access_token':_0x316ec7[_0x32eb('0x17')],'expires_in':moment()[_0x32eb('0x1f')](_0x316ec7[_0x32eb('0x20')],_0x32eb('0x21'))};_0x1c825b(_0x316ec7[_0x32eb('0x17')]);})['catch'](function(_0x56c1c6){logger[_0x32eb('0x22')]('Failing\x20creating\x20the\x20access_token',_0x56c1c6[_0x32eb('0x23')]);_0x4d2715(_0x56c1c6);});});}function getUser(_0xc0484f,_0x36848d,_0x3244b8,_0x3f3251){logger[_0x32eb('0x24')]('Search\x20user');return request({'method':_0x32eb('0x25'),'uri':util[_0x32eb('0x26')](_0x32eb('0x27'),_0x36848d),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x32eb('0x28')+_0xc0484f},'json':!![]})[_0x32eb('0x1e')](function(_0x578c38){if(_0x578c38['users']){var _0x245f6f=-0x1;if(_[_0x32eb('0x29')](_0x578c38[_0x32eb('0x2a')])){if(!_[_0x32eb('0x15')](_0x3f3251)){_0x245f6f=_[_0x32eb('0x2b')](_0x578c38[_0x32eb('0x2a')],function(_0x508262){return _0x508262[_0x32eb('0x2c')]===_0x3f3251;});}if(_0x245f6f>=0x0){logger[_0x32eb('0x24')]('Agent\x20found!');}else{logger['info'](_0x32eb('0x2d'));_0x245f6f=_[_0x32eb('0x2b')](_0x578c38['users'],function(_0x359549){return _0x359549['profile']['name']===_0x32eb('0x2e');});}return _0x578c38[_0x32eb('0x2a')][_0x245f6f];}else{if(_0x578c38[_0x32eb('0x2f')]['profile'][_0x32eb('0x12')]===_0x32eb('0x2e')){logger[_0x32eb('0x24')]('Using\x20the\x20admin\x20account!');user=_0x578c38[_0x32eb('0x2f')];return user;}else{logger[_0x32eb('0x22')]('The\x20failing\x20result\x20is',JSON[_0x32eb('0x7')](_0x578c38));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x578c38));}}}else{logger[_0x32eb('0x22')](_0x32eb('0x30'),JSON[_0x32eb('0x7')](_0x578c38));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x578c38));}})[_0x32eb('0x31')](function(_0x222e63){console[_0x32eb('0x22')](_0x222e63);});}function getZohoUser(_0x238fb7,_0x1f6ea2){return new BPromise(function(_0x251967,_0x5ead9d){request(_0x238fb7)[_0x32eb('0x1e')](function(_0x2432b5){var _0x4a6b7a=null;if(_0x2432b5){_0x4a6b7a=_0x2432b5['data'][0x0];_0x4a6b7a[_0x32eb('0x32')]=_0x1f6ea2;}_0x251967(_0x4a6b7a);})[_0x32eb('0x31')](function(_0x5ce9ba){_0x5ead9d(_0x5ce9ba);});});}function createEndUser(_0x3e989c,_0x5f39a7,_0x3d1f23,_0x336da7,_0x301c6b,_0x282970){var _0x3d1f23=getName(_0x3d1f23);return request({'method':'POST','uri':_0x32eb('0x33')+_0x5f39a7+'/crm/v2/'+_[_0x32eb('0x34')](_0x282970[_0x32eb('0x35')])+'s','body':{'data':[{'Last_Name':_0x3d1f23[0x1],'First_Name':_0x3d1f23[0x0],'Phone':_0x336da7,'Owner':{'name':!_[_0x32eb('0x15')](_0x301c6b['role'][_0x32eb('0x12')])?_0x301c6b[_0x32eb('0x36')][_0x32eb('0x12')]:!_['isNil'](_0x301c6b['first_name'])?_0x301c6b['first_name']+'\x20'+_0x301c6b[_0x32eb('0x37')]:_0x301c6b[_0x32eb('0x37')],'id':_0x301c6b['id']}}]},'headers':{'Authorization':_0x32eb('0x28')+_0x3e989c},'json':!![]})[_0x32eb('0x1e')](function(_0x112d3a){if(_0x112d3a&&_0x112d3a[_0x32eb('0x38')][0x0][_0x32eb('0x39')]==='SUCCESS'){var _0x2ccd29=_0x112d3a[_0x32eb('0x38')][0x0][_0x32eb('0x3a')];_0x2ccd29[_0x32eb('0x32')]=_[_0x32eb('0x34')](_0x282970[_0x32eb('0x35')])+'s';return _0x2ccd29;}logger[_0x32eb('0x22')](_0x32eb('0x30'),JSON['stringify'](data));throw new Error(_0x32eb('0x3b')+JSON[_0x32eb('0x7')](data));})[_0x32eb('0x31')](function(_0x1b5ab7){console[_0x32eb('0x3c')](_0x32eb('0x3d'),_0x1b5ab7);});}function getEndUser(_0x2f87e1,_0xefef22,_0x5a2112,_0x413c86,_0x29c5d0,_0x23ce43,_0x4e1cfe){var _0x33f7ab={'method':_0x32eb('0x25'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2f87e1},'json':!![]};switch(_0x4e1cfe[_0x32eb('0x3e')]){case _0x32eb('0x3f'):_0x33f7ab[_0x32eb('0x40')]='https://www.zohoapis.'+_0xefef22+_0x32eb('0x41')+_0x29c5d0+'))';return getZohoUser(_0x33f7ab,_0x32eb('0x42'))[_0x32eb('0x1e')](function(_0x4216aa){if(_0x4216aa)return _0x4216aa;_0x33f7ab[_0x32eb('0x40')]=_0x32eb('0x33')+_0xefef22+_0x32eb('0x43')+_0x29c5d0+'))';return getZohoUser(_0x33f7ab,_0x32eb('0x44'))[_0x32eb('0x1e')](function(_0x4bafbe){if(_0x4bafbe)return _0x4bafbe;if(_0x4e1cfe['moduleCreate']!='nothing'){return createEndUser(_0x2f87e1,_0xefef22,_0x413c86,_0x29c5d0,_0x23ce43,_0x4e1cfe);}else{return{};}});});break;case _0x32eb('0x45'):_0x33f7ab[_0x32eb('0x40')]=_0x32eb('0x33')+_0xefef22+_0x32eb('0x41')+_0x29c5d0+'))';return getZohoUser(_0x33f7ab,_0x32eb('0x42'))['then'](function(_0x116dd8){if(_0x116dd8)return _0x116dd8;if(_0x4e1cfe['moduleCreate']!='nothing'){return createEndUser(_0x2f87e1,_0xefef22,_0x413c86,_0x29c5d0,_0x23ce43,_0x4e1cfe);}else{return{};}});break;case'lead':_0x33f7ab[_0x32eb('0x40')]='https://www.zohoapis.'+_0xefef22+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x29c5d0+'))';return getZohoUser(_0x33f7ab,_0x32eb('0x44'))[_0x32eb('0x1e')](function(_0x51ca07){if(_0x51ca07)return _0x51ca07;if(_0x4e1cfe[_0x32eb('0x35')]!=_0x32eb('0x46')){return createEndUser(_0x2f87e1,_0xefef22,_0x413c86,_0x29c5d0,_0x23ce43,_0x4e1cfe);}else{return{};}});break;}}function getCall(_0x5c4d30,_0x45a3fb,_0x11f8d8,_0x20361e,_0x282428,_0x65d12c,_0x3325b2,_0xe5a9b1){logger['info'](_0x32eb('0x47'));var _0x15e667={};_0x15e667[_0x32eb('0x48')]={'name':!_[_0x32eb('0x15')](_0x20361e[_0x32eb('0x36')][_0x32eb('0x12')])&&!_[_0x32eb('0x15')](_0x20361e[_0x32eb('0x49')][_0x32eb('0x12')])&&_0x20361e[_0x32eb('0x49')][_0x32eb('0x12')]===_0x32eb('0x4a')?_0x20361e[_0x32eb('0x36')][_0x32eb('0x12')]:!_[_0x32eb('0x15')](_0x20361e['first_name'])?_0x20361e[_0x32eb('0x4b')]+'\x20'+_0x20361e[_0x32eb('0x37')]:_0x20361e[_0x32eb('0x37')],'id':_0x20361e['id']};_0x15e667['Subject']=intUtil['getString'](_0x65d12c['Subjects'],_0x3325b2,'\x20');_0x15e667[_0x32eb('0x4c')]=intUtil[_0x32eb('0x4d')](_0x65d12c[_0x32eb('0x4e')],_0x3325b2,'\x0a');if(_0x282428[_0x32eb('0x32')]===_0x32eb('0x42')){_0x15e667[_0x32eb('0x4f')]={'name':!_[_0x32eb('0x15')](_0x282428[_0x32eb('0x50')])?_0x282428[_0x32eb('0x50')]:!_[_0x32eb('0x15')](_0x282428['First_Name'])?_0x282428[_0x32eb('0x51')]+'\x20'+_0x282428[_0x32eb('0x52')]:_0x282428[_0x32eb('0x52')],'id':_0x282428['id']};}if(_0x282428['enduserType']===_0x32eb('0x44')){_0x15e667[_0x32eb('0x53')]={'name':!_[_0x32eb('0x15')](_0x282428[_0x32eb('0x50')])?_0x282428[_0x32eb('0x50')]:!_[_0x32eb('0x15')](_0x282428[_0x32eb('0x51')])?_0x282428[_0x32eb('0x51')]+'\x20'+_0x282428[_0x32eb('0x52')]:_0x282428[_0x32eb('0x52')],'id':_0x282428['id']};_0x15e667['$se_module']=_[_0x32eb('0x34')](_0x282428['enduserType']);}if(_0x3325b2['talktime']){_0x15e667[_0x32eb('0x54')]=moment[_0x32eb('0x55')](parseInt(_0x3325b2['talktime'])*0x3e8)[_0x32eb('0x26')](_0x32eb('0x56'));}else if(_0x3325b2[_0x32eb('0x57')]&&_0x3325b2[_0x32eb('0x58')]){_0x15e667[_0x32eb('0x54')]=moment[_0x32eb('0x55')](moment(_0x3325b2[_0x32eb('0x58')],'YYYY-MM-DDTHH:mm:ss')[_0x32eb('0x59')](moment(_0x3325b2[_0x32eb('0x5a')],_0x32eb('0x5b'))))[_0x32eb('0x26')](_0x32eb('0x56'));}switch(_0x3325b2[_0x32eb('0x5c')]){case'called':_0x15e667['Call_Result']=_0x32eb('0x5d');break;case'complete':case _0x32eb('0x5e'):_0x15e667[_0x32eb('0x5f')]=_0x32eb('0x60');break;case'rejected':_0x15e667['Call_Result']=_0x32eb('0x61');break;case _0x32eb('0x62'):_0x15e667[_0x32eb('0x5f')]=_0x32eb('0x63');break;case _0x32eb('0x64'):_0x15e667[_0x32eb('0x5f')]='Timeout';default:}_0x15e667[_0x32eb('0x65')]=(_0xe5a9b1==='outbound'?moment(_0x3325b2['starttime'])[_0x32eb('0x26')](_0x32eb('0x5b')):moment(_0x3325b2[_0x32eb('0x66')])[_0x32eb('0x26')](_0x32eb('0x5b')))||moment()[_0x32eb('0x26')]('YYYY-MM-DDTHH:mm:ss');_0x15e667[_0x32eb('0x67')]=_0xe5a9b1||_0x32eb('0x68');_0x15e667=_['merge'](_0x15e667,getCustomFields(_0x65d12c['Fields'],_0x3325b2));return request({'method':_0x32eb('0x69'),'uri':_0x32eb('0x33')+_0x45a3fb+_0x32eb('0x6a'),'headers':{'Authorization':_0x32eb('0x28')+_0x5c4d30},'body':{'data':[_0x15e667]},'json':!![]})[_0x32eb('0x1e')](function(_0x270d89){if(_0x270d89&&_0x270d89[_0x32eb('0x38')][0x0][_0x32eb('0x39')]==='SUCCESS'){logger[_0x32eb('0x24')](_0x32eb('0x6b'));return{'id':_0x270d89[_0x32eb('0x38')][0x0][_0x32eb('0x3a')]['id']};}})[_0x32eb('0x31')](function(_0x3477a7){logger['info'](_0x32eb('0x6c'),_0x3477a7['stack']);console[_0x32eb('0x3c')](_0x32eb('0x6c'),_0x3477a7);});}exports[_0x32eb('0x6d')]=function(_0xeba399,_0x285e54,_0x120780,_0x3dbb7b,_0x55ea6d,_0x5bc4cb){var _0x534579,_0x480282,_0x3bd9d1;_0x5bc4cb['host']=intUtil[_0x32eb('0x6e')](_0x5bc4cb[_0x32eb('0x6f')]);_0x5bc4cb[_0x32eb('0x70')]=intUtil[_0x32eb('0x6e')](_0x5bc4cb[_0x32eb('0x70')]);if(_0x55ea6d&&_0x55ea6d[_0x32eb('0x71')]){logger[_0x32eb('0x24')](_0x32eb('0x72'),_0x32eb('0x73'));_0x285e54[_0x32eb('0x74')]=_0x5bc4cb[_0x32eb('0x70')]+_0x32eb('0x75')+_0x285e54[_0x32eb('0x76')]+_0x32eb('0x77')+md5(_0x285e54[_0x32eb('0x76')]);}else{_0x285e54[_0x32eb('0x74')]='';}var _0x4e8708=_0x5bc4cb[_0x32eb('0x6f')]===_0x32eb('0x78')?'eu':_0x32eb('0x79');return getAccessToken(_0x5bc4cb)[_0x32eb('0x1e')](function(_0x1edd30){_0x3bd9d1=_0x1edd30;return getUser(_0x3bd9d1,_0x4e8708,_0x5bc4cb,_0x3dbb7b['email']);})['then'](function(_0x28d986){_0x534579=_0x28d986;logger[_0x32eb('0x24')](_0x32eb('0x7a'),_0x534579['id']);return getEndUser(_0x3bd9d1,_0x4e8708,_0x5bc4cb,_0x285e54['calleridname'],_0x285e54[_0x32eb('0x7b')],_0x534579,_0x120780);})[_0x32eb('0x1e')](function(_0x2aa68c){_0x480282=_0x2aa68c;return getCall(_0x3bd9d1,_0x4e8708,_0x5bc4cb,_0x534579,_0x480282,_0x120780,_0x285e54,'Inbound');})['then'](function(_0x43050b){if(_0x43050b){logger[_0x32eb('0x24')](_0x32eb('0x7c'),_0x43050b['id']);logger[_0x32eb('0x24')](_0x32eb('0x72'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x32eb('0x26')](_0x32eb('0x7d'),_0x3dbb7b[_0x32eb('0x12')]),_0x32eb('0x7e'),{'uri':'https://crm.'+_0x5bc4cb[_0x32eb('0x6f')]+_0x32eb('0x7f')+_0x43050b['id']});}})[_0x32eb('0x31')](function(_0x19ff97){logger[_0x32eb('0x22')](_0x32eb('0x72'),JSON['stringify'](_0x19ff97));});};exports[_0x32eb('0x80')]=function(_0x5eee5d,_0x48948b,_0x32054b,_0x409ca1,_0x321fec,_0x5b826b,_0x6914a){var _0x1defda,_0x1e976e,_0x246b5f;_0x5b826b[_0x32eb('0x6f')]=intUtil['stripTrailingSlash'](_0x5b826b['host']);_0x5b826b[_0x32eb('0x70')]=intUtil[_0x32eb('0x6e')](_0x5b826b['serverUrl']);if(_0x6914a&&_0x6914a['recordingFormat']&&_0x6914a['recordingFormat']!=='none'){logger[_0x32eb('0x24')]('[OUTBOUND]',_0x32eb('0x73'));_0x48948b[_0x32eb('0x74')]=_0x5b826b[_0x32eb('0x70')]+_0x32eb('0x75')+_0x48948b[_0x32eb('0x76')]+'/downloads?type=uniqueid&token='+md5(_0x48948b['uniqueid']);}var _0x4c9505=_0x5b826b[_0x32eb('0x6f')]===_0x32eb('0x78')?'eu':_0x32eb('0x79');return getAccessToken(_0x5b826b)[_0x32eb('0x1e')](function(_0x34410b){_0x246b5f=_0x34410b;return getUser(_0x246b5f,_0x4c9505,_0x5b826b,_0x409ca1[_0x32eb('0x2c')]);})[_0x32eb('0x1e')](function(_0x3e3a9e){_0x1defda=_0x3e3a9e;logger[_0x32eb('0x24')](_0x32eb('0x7a'),_0x1defda['id']);return getEndUser(_0x246b5f,_0x4c9505,_0x5b826b,_0x48948b['destcalleridname'],_0x48948b[_0x32eb('0x81')],_0x1defda,_0x32054b);})[_0x32eb('0x1e')](function(_0x40b700){_0x1e976e=_0x40b700;return getCall(_0x246b5f,_0x4c9505,_0x5b826b,_0x1defda,_0x1e976e,_0x32054b,_0x48948b,'Outbound');})[_0x32eb('0x1e')](function(_0x335de3){if(_0x335de3){logger['info'](_0x32eb('0x7c'),_0x335de3['id']);logger[_0x32eb('0x24')]('[OUTBOUND]',_0x32eb('0x82'));emit(util['format'](_0x32eb('0x7d'),_0x409ca1[_0x32eb('0x12')]),'trigger:browser:url',{'uri':'https://crm.'+_0x5b826b[_0x32eb('0x6f')]+_0x32eb('0x7f')+_0x335de3['id']});}})[_0x32eb('0x31')](function(_0x416d2d){logger['error']('[OUTBOUND]',JSON[_0x32eb('0x7')](_0x416d2d));});};exports[_0x32eb('0x83')]=function(_0x1c10bd,_0x416436,_0x28d76c,_0x487add,_0x5ddbb4,_0x5ee1cb){var _0x2db350,_0x6f39ed,_0x2054b6;_0x5ee1cb[_0x32eb('0x6f')]=intUtil['stripTrailingSlash'](_0x5ee1cb['host']);_0x5ee1cb[_0x32eb('0x70')]=intUtil[_0x32eb('0x6e')](_0x5ee1cb[_0x32eb('0x70')]);if(_0x5ddbb4&&_0x5ddbb4[_0x32eb('0x71')]){logger[_0x32eb('0x24')]('['+_0x416436[_0x32eb('0x5c')][_0x32eb('0x84')]()+']',_0x32eb('0x73'));_0x416436[_0x32eb('0x74')]=_0x5ee1cb[_0x32eb('0x70')]+'/api/voice/recordings/'+_0x416436[_0x32eb('0x76')]+_0x32eb('0x77')+md5(_0x416436['uniqueid']);}else{_0x416436[_0x32eb('0x74')]='';}var _0x233c2a=_0x5ee1cb[_0x32eb('0x6f')]===_0x32eb('0x78')?'eu':_0x32eb('0x79');return getAccessToken(_0x5ee1cb)[_0x32eb('0x1e')](function(_0x635d3c){_0x2054b6=_0x635d3c;return getUser(_0x2054b6,_0x233c2a,_0x5ee1cb);})['then'](function(_0x549b29){_0x2db350=_0x549b29;logger[_0x32eb('0x24')](_0x32eb('0x7a'),_0x2db350['id']);return getEndUser(_0x2054b6,_0x233c2a,_0x5ee1cb,_0x416436['calleridname'],_0x416436[_0x32eb('0x7b')],_0x2db350,_0x28d76c);})[_0x32eb('0x1e')](function(_0xa15273){_0x6f39ed=_0xa15273;return getCall(_0x2054b6,_0x233c2a,_0x5ee1cb,_0x2db350,_0x6f39ed,_0x28d76c,_0x416436,'Inbound');})[_0x32eb('0x1e')](function(_0x1685d6){if(_0x1685d6){logger[_0x32eb('0x24')](_0x32eb('0x7c'),_0x1685d6['id']);}})[_0x32eb('0x31')](function(_0x500140){logger[_0x32eb('0x22')]('['+_0x416436[_0x32eb('0x5c')]['toUpperCase']()+']',JSON[_0x32eb('0x7')](_0x500140));});}; \ 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 f15b8c6..79aafdf 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 _0x348f=['mustache','trigger','data2','render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs'];(function(_0x37d523,_0x235fd4){var _0x4872b8=function(_0x3d61aa){while(--_0x3d61aa){_0x37d523['push'](_0x37d523['shift']());}};_0x4872b8(++_0x235fd4);}(_0x348f,0xe6));var _0xf348=function(_0x4ec7ba,_0x48561e){_0x4ec7ba=_0x4ec7ba-0x0;var _0x3eedd5=_0x348f[_0x4ec7ba];return _0x3eedd5;};'use strict';var util=require('util');var sh=require(_0xf348('0x0'));var Mustache=require(_0xf348('0x1'));var logger=require('../../../../config/logger')(_0xf348('0x2'));exports['exec']=function(_0xd9d62a,_0xe52eec){var _0x11f6ca=_0xd9d62a[_0xf348('0x3')]?_0xd9d62a[_0xf348('0x3')]:'Script';var _0x10b48a=_0xd9d62a['data3']?Mustache[_0xf348('0x4')](_0xd9d62a[_0xf348('0x5')],_0xe52eec):_0xe52eec;sh['exec'](_0x10b48a,function(_0x59ae7c,_0x51d834,_0x372b1c){if(_0x59ae7c!==0x0){logger[_0xf348('0x6')](util[_0xf348('0x7')](_0xf348('0x8'),_0x11f6ca,_0x10b48a,_0x59ae7c,_0x372b1c));}else{logger[_0xf348('0x9')](util['format'](_0xf348('0xa'),_0x11f6ca,_0x10b48a,_0x51d834));}});}; \ No newline at end of file +var _0xcf05=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','exec','data2','Script','data3','render','format'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xcf05,0x14c));var _0x5cf0=function(_0x1682dd,_0x3c3e74){_0x1682dd=_0x1682dd-0x0;var _0x2c42cb=_0xcf05[_0x1682dd];return _0x2c42cb;};'use strict';var util=require(_0x5cf0('0x0'));var sh=require(_0x5cf0('0x1'));var Mustache=require('mustache');var logger=require(_0x5cf0('0x2'))('trigger');exports[_0x5cf0('0x3')]=function(_0x418959,_0x35906f){var _0xedee3f=_0x418959[_0x5cf0('0x4')]?_0x418959[_0x5cf0('0x4')]:_0x5cf0('0x5');var _0x4534c5=_0x418959[_0x5cf0('0x6')]?Mustache[_0x5cf0('0x7')](_0x418959[_0x5cf0('0x6')],_0x35906f):_0x35906f;sh['exec'](_0x4534c5,function(_0x1232c5,_0x1cd1e7,_0xbf1408){if(_0x1232c5!==0x0){logger['error'](util[_0x5cf0('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0xedee3f,_0x4534c5,_0x1232c5,_0xbf1408));}else{logger[_0x5cf0('0x9')](util['format'](_0x5cf0('0xa'),_0xedee3f,_0x4534c5,_0x1cd1e7));}});}; \ 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 edafdd9..d1ee85c 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 _0x2991=['trigger','exec','data1','data2','data5','number','headers','parse','render','error','DELETE','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger'];(function(_0x1d59eb,_0x93c038){var _0x267df8=function(_0x5a54f9){while(--_0x5a54f9){_0x1d59eb['push'](_0x1d59eb['shift']());}};_0x267df8(++_0x93c038);}(_0x2991,0x7b));var _0x1299=function(_0x3a8dd8,_0x5950de){_0x3a8dd8=_0x3a8dd8-0x0;var _0x17f2f2=_0x2991[_0x3a8dd8];return _0x17f2f2;};'use strict';var rp=require(_0x1299('0x0'));var util=require(_0x1299('0x1'));var _=require(_0x1299('0x2'));var Mustache=require(_0x1299('0x3'));var logger=require(_0x1299('0x4'))(_0x1299('0x5'));exports[_0x1299('0x6')]=function(_0xcce521,_0x4f7cf9){var _0x1d561c,_0x28ff3f;var _0x225b57={'method':_0xcce521[_0x1299('0x7')]['toUpperCase'](),'uri':Mustache['render'](_0xcce521[_0x1299('0x8')],_0x4f7cf9),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xcce521[_0x1299('0x9')])===_0x1299('0xa')&&parseInt(_0xcce521[_0x1299('0x9')])>=0x1&&parseInt(_0xcce521[_0x1299('0x9')])<=0xa?parseInt(_0xcce521[_0x1299('0x9')])*0x3e8:0x5*0x3e8};try{_0x225b57[_0x1299('0xb')]=_0xcce521['data6']?JSON[_0x1299('0xc')](Mustache[_0x1299('0xd')](_0xcce521['data6'],_0x4f7cf9)):{};}catch(_0x33bb25){logger[_0x1299('0xe')](_0x33bb25['stack']);}switch(_0xcce521[_0x1299('0x7')]['toUpperCase']()){case'GET':case _0x1299('0xf'):_0x1d561c=null;_0x225b57['qs']=_0x4f7cf9;break;case'POST':case _0x1299('0x10'):if(_0xcce521[_0x1299('0x11')]){try{_0x1d561c=JSON[_0x1299('0xc')](Mustache['render'](_0xcce521[_0x1299('0x11')],_0x4f7cf9));_0x225b57[_0x1299('0x12')]=_0x1d561c;}catch(_0x5d68a8){logger[_0x1299('0xe')](_0x5d68a8[_0x1299('0x13')]);logger[_0x1299('0xe')](_0x1299('0x14'));}}else{_0x1d561c=_0x4f7cf9;_0x225b57[_0x1299('0x12')]=_0x1d561c;}break;}logger[_0x1299('0x15')](util[_0x1299('0x16')](_0x1299('0x17'),_0xcce521[_0x1299('0x7')],_0xcce521[_0x1299('0x8')],JSON['stringify'](_0x225b57)));rp(_0x225b57)[_0x1299('0x18')](function(_0x1162dc){_0x1d561c=!_[_0x1299('0x19')](_0x1d561c)?_0x1299('0x1a')+_0x1d561c:'';_0x28ff3f=typeof _0x1162dc[_0x1299('0x12')]===_0x1299('0x1b')?JSON[_0x1299('0x1c')](_0x1162dc['body']):_0x1162dc[_0x1299('0x12')];logger[_0x1299('0x15')](util[_0x1299('0x16')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0xcce521[_0x1299('0x7')],_0xcce521['data2'],_0x1162dc[_0x1299('0x1d')],_0x28ff3f));})['catch'](function(_0x1c1362){logger['error'](util[_0x1299('0x16')](_0x1299('0x1e'),_0xcce521[_0x1299('0x7')],_0xcce521[_0x1299('0x8')],_0x1c1362[_0x1299('0x1d')],_0x1c1362['name'],_0x1c1362[_0x1299('0x1f')]));});}; \ No newline at end of file +var _0x9486=['error','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','headers','data6','stack','GET','POST','data7','body'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x9486,0x179));var _0x6948=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9486[_0x5b644e];return _0x49c6bf;};'use strict';var rp=require(_0x6948('0x0'));var util=require(_0x6948('0x1'));var _=require(_0x6948('0x2'));var Mustache=require(_0x6948('0x3'));var logger=require(_0x6948('0x4'))(_0x6948('0x5'));exports[_0x6948('0x6')]=function(_0x5dd3fc,_0x3da790){var _0x2c508a,_0x5cb0cd;var _0x34d240={'method':_0x5dd3fc[_0x6948('0x7')][_0x6948('0x8')](),'uri':Mustache[_0x6948('0x9')](_0x5dd3fc[_0x6948('0xa')],_0x3da790),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5dd3fc['data5'])==='number'&&parseInt(_0x5dd3fc[_0x6948('0xb')])>=0x1&&parseInt(_0x5dd3fc['data5'])<=0xa?parseInt(_0x5dd3fc[_0x6948('0xb')])*0x3e8:0x5*0x3e8};try{_0x34d240[_0x6948('0xc')]=_0x5dd3fc[_0x6948('0xd')]?JSON['parse'](Mustache[_0x6948('0x9')](_0x5dd3fc[_0x6948('0xd')],_0x3da790)):{};}catch(_0x2e39ae){logger['error'](_0x2e39ae[_0x6948('0xe')]);}switch(_0x5dd3fc[_0x6948('0x7')][_0x6948('0x8')]()){case _0x6948('0xf'):case'DELETE':_0x2c508a=null;_0x34d240['qs']=_0x3da790;break;case _0x6948('0x10'):case'PUT':if(_0x5dd3fc[_0x6948('0x11')]){try{_0x2c508a=JSON['parse'](Mustache[_0x6948('0x9')](_0x5dd3fc[_0x6948('0x11')],_0x3da790));_0x34d240[_0x6948('0x12')]=_0x2c508a;}catch(_0x2eba0d){logger[_0x6948('0x13')](_0x2eba0d[_0x6948('0xe')]);logger[_0x6948('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2c508a=_0x3da790;_0x34d240['body']=_0x2c508a;}break;}logger['info'](util[_0x6948('0x14')](_0x6948('0x15'),_0x5dd3fc['data1'],_0x5dd3fc[_0x6948('0xa')],JSON['stringify'](_0x34d240)));rp(_0x34d240)[_0x6948('0x16')](function(_0x4cbbd6){_0x2c508a=!_[_0x6948('0x17')](_0x2c508a)?_0x6948('0x18')+_0x2c508a:'';_0x5cb0cd=typeof _0x4cbbd6[_0x6948('0x12')]===_0x6948('0x19')?JSON[_0x6948('0x1a')](_0x4cbbd6[_0x6948('0x12')]):_0x4cbbd6['body'];logger['info'](util['format'](_0x6948('0x1b'),_0x5dd3fc[_0x6948('0x7')],_0x5dd3fc[_0x6948('0xa')],_0x4cbbd6[_0x6948('0x1c')],_0x5cb0cd));})[_0x6948('0x1d')](function(_0x1ea391){logger['error'](util[_0x6948('0x14')](_0x6948('0x1e'),_0x5dd3fc[_0x6948('0x7')],_0x5dd3fc[_0x6948('0xa')],_0x1ea391[_0x6948('0x1c')],_0x1ea391[_0x6948('0x1f')],_0x1ea391[_0x6948('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b267f68..6d0b863 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 _0x0e50=['then','error','rpc','message','result','catch','jayson/promise','../../config/logger','routing','http'];(function(_0x4bd76e,_0x260c31){var _0x96a285=function(_0x28176d){while(--_0x28176d){_0x4bd76e['push'](_0x4bd76e['shift']());}};_0x96a285(++_0x260c31);}(_0x0e50,0xf6));var _0x00e5=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x0e50[_0x1589dd];return _0x1bddd1;};'use strict';var jayson=require(_0x00e5('0x0'));var BPromise=require('bluebird');var logger=require(_0x00e5('0x1'))(_0x00e5('0x2'));var client=jayson['client'][_0x00e5('0x3')]({'port':0x2329});client['Request']=function(_0x32c8d6,_0x34751a){return new BPromise(function(_0x3f1b67,_0x52e62a){return client['request'](_0x32c8d6,_0x34751a)[_0x00e5('0x4')](function(_0x4270e5){logger['debug']('rpc','routing',_0x32c8d6,_0x34751a,_0x4270e5);if(_0x4270e5[_0x00e5('0x5')]){logger[_0x00e5('0x5')](_0x00e5('0x6'),_0x00e5('0x2'),_0x32c8d6,_0x4270e5[_0x00e5('0x5')]['message'],_0x34751a);return _0x52e62a(_0x4270e5[_0x00e5('0x5')][_0x00e5('0x7')]);}else{return _0x3f1b67(_0x4270e5[_0x00e5('0x8')]);}})[_0x00e5('0x9')](function(_0x28e768){logger[_0x00e5('0x5')](_0x00e5('0x6'),'routing',_0x32c8d6,_0x28e768,_0x34751a);return _0x52e62a(_0x28e768);});});};module['exports']=client; \ No newline at end of file +var _0x8d2f=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug'];(function(_0x4f9cf2,_0x58fd04){var _0x4a008c=function(_0x16c050){while(--_0x16c050){_0x4f9cf2['push'](_0x4f9cf2['shift']());}};_0x4a008c(++_0x58fd04);}(_0x8d2f,0xd6));var _0xf8d2=function(_0xc5720c,_0x5b619c){_0xc5720c=_0xc5720c-0x0;var _0x599ada=_0x8d2f[_0xc5720c];return _0x599ada;};'use strict';var jayson=require(_0xf8d2('0x0'));var BPromise=require(_0xf8d2('0x1'));var logger=require(_0xf8d2('0x2'))(_0xf8d2('0x3'));var client=jayson[_0xf8d2('0x4')][_0xf8d2('0x5')]({'port':0x2329});client[_0xf8d2('0x6')]=function(_0x2cab67,_0x146a80){return new BPromise(function(_0x135124,_0xebbe90){return client[_0xf8d2('0x7')](_0x2cab67,_0x146a80)[_0xf8d2('0x8')](function(_0x52652e){logger[_0xf8d2('0x9')](_0xf8d2('0xa'),_0xf8d2('0x3'),_0x2cab67,_0x146a80,_0x52652e);if(_0x52652e[_0xf8d2('0xb')]){logger[_0xf8d2('0xb')](_0xf8d2('0xa'),'routing',_0x2cab67,_0x52652e['error'][_0xf8d2('0xc')],_0x146a80);return _0xebbe90(_0x52652e[_0xf8d2('0xb')][_0xf8d2('0xc')]);}else{return _0x135124(_0x52652e[_0xf8d2('0xd')]);}})[_0xf8d2('0xe')](function(_0x50b052){logger[_0xf8d2('0xb')](_0xf8d2('0xa'),_0xf8d2('0x3'),_0x2cab67,_0x50b052,_0x146a80);return _0xebbe90(_0x50b052);});});};module[_0xf8d2('0xf')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 402c4fe..fb7b537 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 _0x4d23=['../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','./rpc/setting'];(function(_0x42bd43,_0x59fb77){var _0x421e88=function(_0x485e11){while(--_0x485e11){_0x42bd43['push'](_0x42bd43['shift']());}};_0x421e88(++_0x59fb77);}(_0x4d23,0xa6));var _0x34d2=function(_0x2a2927,_0x302a0a){_0x2a2927=_0x2a2927-0x0;var _0x4ee8c2=_0x4d23[_0x2a2927];return _0x4ee8c2;};'use strict';var server=require(_0x34d2('0x0'));var Realtime=require(_0x34d2('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x34d2('0x2'));var setting=require(_0x34d2('0x3'));var logger=require(_0x34d2('0x4'))(_0x34d2('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x34d2('0x6')]()[_0x34d2('0x7')](mailAccount[_0x34d2('0x8')]())[_0x34d2('0x7')](realtime[_0x34d2('0x9')]())[_0x34d2('0x7')](function(){email[_0x34d2('0xa')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x34d2('0xb')](realtime,email)[_0x34d2('0x7')](function(){return initRealtime();})[_0x34d2('0x7')](function(){return setting[_0x34d2('0xc')]();})['then'](function(_0x5d2585){return setInterval(initRealtime,_0x5d2585[_0x34d2('0xd')]*0x3e8);})[_0x34d2('0xe')](function(_0x757143){logger[_0x34d2('0xf')](_0x34d2('0x10'),_0x757143);});}main(); \ No newline at end of file +var _0x93a3=['catch','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','../../config/logger','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x1d9e78,_0x266cdd){var _0x431185=function(_0x5648d7){while(--_0x5648d7){_0x1d9e78['push'](_0x1d9e78['shift']());}};_0x431185(++_0x266cdd);}(_0x93a3,0x1bc));var _0x393a=function(_0xfe8aec,_0x35ef1d){_0xfe8aec=_0xfe8aec-0x0;var _0xfda47c=_0x93a3[_0xfe8aec];return _0xfda47c;};'use strict';var server=require(_0x393a('0x0'));var Realtime=require(_0x393a('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x393a('0x2'));var setting=require('./rpc/setting');var logger=require(_0x393a('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x393a('0x4')](mailAccount['getMailAccounts']())[_0x393a('0x4')](realtime[_0x393a('0x5')]())[_0x393a('0x4')](function(){email[_0x393a('0x6')](realtime[_0x393a('0x7')]);return realtime;});}function main(){return server[_0x393a('0x8')](realtime,email)[_0x393a('0x4')](function(){return initRealtime();})['then'](function(){return setting[_0x393a('0x9')]();})['then'](function(_0x194826){return setInterval(initRealtime,_0x194826[_0x393a('0xa')]*0x3e8);})[_0x393a('0xb')](function(_0x111f45){logger['error'](_0x393a('0xc'),_0x111f45);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3a2f975..384122a 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 _0x3bcd=['then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','send','Smtp','smtp','verify','exports','lodash','moment','bluebird','md5','../../../config/logger','defaults','localhost','socket.io-emitter','redis','./imap','../rpc/mailAccount','info','start\x20email\x20channel','imapAccounts','prototype','emit','mailAccounts','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','email','box','handleImapBox','handleImapEmail','end','handleImapEnd','error','handleImapError','bind','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x3bcd,0x1c2));var _0xd3bc=function(_0x5b7890,_0x5cf077){_0x5b7890=_0x5b7890-0x0;var _0x17395e=_0x3bcd[_0x5b7890];return _0x17395e;};'use strict';var _=require(_0xd3bc('0x0'));var moment=require(_0xd3bc('0x1'));var BPromise=require(_0xd3bc('0x2'));var md5=require(_0xd3bc('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xd3bc('0x4'))('email');config['redis']=_[_0xd3bc('0x5')](config['redis'],{'host':_0xd3bc('0x6'),'port':0x18eb});var io=require(_0xd3bc('0x7'))(new Redis(config[_0xd3bc('0x8')]));var EmailImap=require(_0xd3bc('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xd3bc('0xa'));var md5Accounts={};function EmailChannel(_0x3f5989){logger[_0xd3bc('0xb')](_0xd3bc('0xc'));this['mailAccounts']=_0x3f5989['mailAccounts'];this[_0xd3bc('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xd3bc('0xe')][_0xd3bc('0xf')]=function(_0x164760){var _0x5563cd=this[_0xd3bc('0x10')][_0x164760];var _0x228d6f={'id':_0x5563cd['id'],'name':_0x5563cd[_0xd3bc('0x11')],'key':_0x5563cd[_0xd3bc('0x12')],'active':_0x5563cd[_0xd3bc('0x13')],'Imap':{'status':_0x5563cd[_0xd3bc('0x14')]['status'],'messageStatus':_0x5563cd[_0xd3bc('0x14')][_0xd3bc('0x15')],'total':_0x5563cd[_0xd3bc('0x14')][_0xd3bc('0x16')]}};if(_[_0xd3bc('0x17')](md5Accounts[_0x164760])){md5Accounts[_0x164760]={};}var _0x3be6b0=md5(JSON[_0xd3bc('0x18')](_0x228d6f));if(md5Accounts[_0x164760]['md5']!==_0x3be6b0){md5Accounts[_0x164760]['md5']=_0x3be6b0;io[_0xd3bc('0xf')](_0xd3bc('0x19'),_0x228d6f);}};EmailChannel[_0xd3bc('0xe')][_0xd3bc('0x1a')]=function(_0xb06137){for(var _0x235b5a in _0xb06137){if(_0xb06137[_0xd3bc('0x1b')](_0x235b5a)){if(_0xb06137[_0x235b5a][_0xd3bc('0x14')]&&_0xb06137[_0x235b5a][_0xd3bc('0x13')]){var _0x21f26e=_0xb06137[_0x235b5a][_0xd3bc('0x14')];if(!_0x21f26e[_0xd3bc('0x1c')]&&_0xb06137[_0x235b5a][_0xd3bc('0x1d')]!=='custom')_0x21f26e[_0xd3bc('0x1c')]=_0xb06137[_0x235b5a][_0xd3bc('0x1d')];if(!this['imapAccounts'][_0xd3bc('0x1b')](_0x21f26e['id'])){this[_0xd3bc('0xd')][_0x21f26e['id']]=new EmailImap(_0x21f26e,_0xb06137[_0x235b5a][_0xd3bc('0x1e')]);this[_0xd3bc('0xd')][_0x21f26e['id']]['on'](_0xd3bc('0x1f'),this[_0xd3bc('0x20')]['bind'](this,_0x235b5a));this[_0xd3bc('0xd')][_0x21f26e['id']]['on'](_0xd3bc('0x1e'),this[_0xd3bc('0x21')]['bind'](this,_0x235b5a));this[_0xd3bc('0xd')][_0x21f26e['id']]['on'](_0xd3bc('0x22'),this[_0xd3bc('0x23')]['bind'](this,_0x235b5a));this[_0xd3bc('0xd')][_0x21f26e['id']]['on'](_0xd3bc('0x24'),this[_0xd3bc('0x25')][_0xd3bc('0x26')](this,_0x235b5a));}}else{if(_[_0xd3bc('0x17')](this[_0xd3bc('0x10')][_0x235b5a][_0xd3bc('0x14')])){this['mailAccounts'][_0x235b5a][_0xd3bc('0x14')]={};}this[_0xd3bc('0x10')][_0x235b5a][_0xd3bc('0x14')][_0xd3bc('0x27')]='disabled';this[_0xd3bc('0x10')][_0x235b5a][_0xd3bc('0x14')][_0xd3bc('0x15')]='';this['emit'](_0x235b5a);}}}};EmailChannel['prototype'][_0xd3bc('0x20')]=function(_0x2bd6f6,_0x3e8638){if(this[_0xd3bc('0x10')][_0x2bd6f6]){this[_0xd3bc('0x10')][_0x2bd6f6][_0xd3bc('0x14')][_0xd3bc('0x27')]=_0xd3bc('0x28');this['mailAccounts'][_0x2bd6f6][_0xd3bc('0x14')]['messageStatus']=_0x3e8638[_0xd3bc('0x11')];if(_0x3e8638[_0xd3bc('0x29')]){this[_0xd3bc('0x10')][_0x2bd6f6][_0xd3bc('0x14')][_0xd3bc('0x16')]=_0x3e8638[_0xd3bc('0x29')]['total'];}return this[_0xd3bc('0xf')](_0x2bd6f6);}};EmailChannel[_0xd3bc('0xe')][_0xd3bc('0x21')]=function(_0x157523,_0x262ab5){logger[_0xd3bc('0xb')](_0xd3bc('0x2a'),_0x262ab5['firstName'],_0x262ab5['lastName'],_0x262ab5[_0xd3bc('0x2b')],_0x157523);if(this[_0xd3bc('0x10')][_0x157523]){return mailAccount[_0xd3bc('0x2c')](_0x157523,_0x262ab5)[_0xd3bc('0x2d')](function(_0x48d1f5){if(_0x48d1f5){logger[_0xd3bc('0xb')](_0xd3bc('0x2e'));}})[_0xd3bc('0x2f')](function(_0x24c332){logger[_0xd3bc('0x24')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xd3bc('0x18')](_0x24c332));});}};EmailChannel[_0xd3bc('0xe')]['handleImapEnd']=function(_0xf8cc91){if(this['mailAccounts'][_0xf8cc91]&&this[_0xd3bc('0x10')][_0xf8cc91]['Imap']){if(this[_0xd3bc('0xd')][this[_0xd3bc('0x10')][_0xf8cc91][_0xd3bc('0x14')]['id']]){delete this['imapAccounts'][this[_0xd3bc('0x10')][_0xf8cc91][_0xd3bc('0x14')]['id']];}this[_0xd3bc('0x10')][_0xf8cc91][_0xd3bc('0x14')][_0xd3bc('0x30')]=moment();this[_0xd3bc('0xf')](_0xf8cc91);}};EmailChannel['prototype'][_0xd3bc('0x25')]=function(_0x9b5d86,_0x5d76ad){if(this[_0xd3bc('0x10')][_0x9b5d86]){this['mailAccounts'][_0x9b5d86]['Imap']['status']=_0xd3bc('0x24');this[_0xd3bc('0x10')][_0x9b5d86][_0xd3bc('0x14')]['messageStatus']=_0x5d76ad;return this[_0xd3bc('0xf')](_0x9b5d86);}};EmailChannel['prototype'][_0xd3bc('0x31')]=function(_0x1580a5,_0x2d8fdf){return this['smtp'][_0xd3bc('0x32')](_0x1580a5,_0x2d8fdf);};EmailChannel[_0xd3bc('0xe')]['verifySmtp']=function(_0x3c977e){var _0x410348=this;if(this[_0xd3bc('0x10')][_0x3c977e['id']]){if(_[_0xd3bc('0x17')](this['mailAccounts'][_0x3c977e['id']]['Smtp'])){this['mailAccounts'][_0x3c977e['id']][_0xd3bc('0x33')]={};}this['mailAccounts'][_0x3c977e['id']][_0xd3bc('0x33')][_0xd3bc('0x30')]=moment();return new BPromise(function(_0x523fdc,_0x4b2727){return _0x410348[_0xd3bc('0x34')][_0xd3bc('0x35')](_0x3c977e)[_0xd3bc('0x2d')](function(_0xdd85e0){_0x410348[_0xd3bc('0x10')][_0x3c977e['id']][_0xd3bc('0x33')]['status']='verified';_0x410348['mailAccounts'][_0x3c977e['id']][_0xd3bc('0x33')][_0xd3bc('0x15')]='';_0x410348['emit'](_0x3c977e['id']);_0x523fdc(_0xdd85e0);})['catch'](function(_0x2387ee){_0x410348['mailAccounts'][_0x3c977e['id']][_0xd3bc('0x33')][_0xd3bc('0x27')]=_0xd3bc('0x24');_0x410348[_0xd3bc('0x10')][_0x3c977e['id']]['Smtp'][_0xd3bc('0x15')]=_0x2387ee;_0x410348[_0xd3bc('0xf')](_0x3c977e['id']);_0x4b2727(_0x2387ee);});});}return this[_0xd3bc('0x34')][_0xd3bc('0x35')](_0x3c977e);};module[_0xd3bc('0x36')]=EmailChannel; \ No newline at end of file +var _0xb26f=['../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','status','total','isNil','stringify','emit','mailAccount:update','hasOwnProperty','Imap','service','custom','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','prototype','connected','messageStatus','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp'];(function(_0x40a909,_0x2d887e){var _0x488189=function(_0x24189c){while(--_0x24189c){_0x40a909['push'](_0x40a909['shift']());}};_0x488189(++_0x2d887e);}(_0xb26f,0x65));var _0xfb26=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0xb26f[_0xcfc44];return _0x307a25;};'use strict';var _=require('lodash');var moment=require(_0xfb26('0x0'));var BPromise=require(_0xfb26('0x1'));var md5=require(_0xfb26('0x2'));var Redis=require(_0xfb26('0x3'));var config=require(_0xfb26('0x4'));var logger=require(_0xfb26('0x5'))(_0xfb26('0x6'));config[_0xfb26('0x7')]=_[_0xfb26('0x8')](config[_0xfb26('0x7')],{'host':_0xfb26('0x9'),'port':0x18eb});var io=require(_0xfb26('0xa'))(new Redis(config[_0xfb26('0x7')]));var EmailImap=require(_0xfb26('0xb'));var EmailSmtp=require(_0xfb26('0xc'));var mailAccount=require(_0xfb26('0xd'));var md5Accounts={};function EmailChannel(_0x82fa5c){logger[_0xfb26('0xe')](_0xfb26('0xf'));this[_0xfb26('0x10')]=_0x82fa5c['mailAccounts'];this[_0xfb26('0x11')]={};this[_0xfb26('0x12')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x2d0e20){var _0x1fad30=this['mailAccounts'][_0x2d0e20];var _0x207ac1={'id':_0x1fad30['id'],'name':_0x1fad30[_0xfb26('0x13')],'key':_0x1fad30['key'],'active':_0x1fad30['active'],'Imap':{'status':_0x1fad30['Imap'][_0xfb26('0x14')],'messageStatus':_0x1fad30['Imap']['messageStatus'],'total':_0x1fad30['Imap'][_0xfb26('0x15')]}};if(_[_0xfb26('0x16')](md5Accounts[_0x2d0e20])){md5Accounts[_0x2d0e20]={};}var _0x6c909a=md5(JSON[_0xfb26('0x17')](_0x207ac1));if(md5Accounts[_0x2d0e20][_0xfb26('0x2')]!==_0x6c909a){md5Accounts[_0x2d0e20]['md5']=_0x6c909a;io[_0xfb26('0x18')](_0xfb26('0x19'),_0x207ac1);}};EmailChannel['prototype']['refresh']=function(_0x118edc){for(var _0x2fb52f in _0x118edc){if(_0x118edc[_0xfb26('0x1a')](_0x2fb52f)){if(_0x118edc[_0x2fb52f]['Imap']&&_0x118edc[_0x2fb52f]['active']){var _0x2f786f=_0x118edc[_0x2fb52f][_0xfb26('0x1b')];if(!_0x2f786f[_0xfb26('0x1c')]&&_0x118edc[_0x2fb52f]['provider']!==_0xfb26('0x1d'))_0x2f786f['service']=_0x118edc[_0x2fb52f]['provider'];if(!this['imapAccounts'][_0xfb26('0x1a')](_0x2f786f['id'])){this[_0xfb26('0x11')][_0x2f786f['id']]=new EmailImap(_0x2f786f,_0x118edc[_0x2fb52f][_0xfb26('0x6')]);this[_0xfb26('0x11')][_0x2f786f['id']]['on'](_0xfb26('0x1e'),this[_0xfb26('0x1f')][_0xfb26('0x20')](this,_0x2fb52f));this['imapAccounts'][_0x2f786f['id']]['on'](_0xfb26('0x6'),this[_0xfb26('0x21')][_0xfb26('0x20')](this,_0x2fb52f));this[_0xfb26('0x11')][_0x2f786f['id']]['on']('end',this[_0xfb26('0x22')][_0xfb26('0x20')](this,_0x2fb52f));this[_0xfb26('0x11')][_0x2f786f['id']]['on'](_0xfb26('0x23'),this[_0xfb26('0x24')][_0xfb26('0x20')](this,_0x2fb52f));}}else{if(_[_0xfb26('0x16')](this[_0xfb26('0x10')][_0x2fb52f]['Imap'])){this[_0xfb26('0x10')][_0x2fb52f][_0xfb26('0x1b')]={};}this[_0xfb26('0x10')][_0x2fb52f]['Imap'][_0xfb26('0x14')]=_0xfb26('0x25');this[_0xfb26('0x10')][_0x2fb52f][_0xfb26('0x1b')]['messageStatus']='';this[_0xfb26('0x18')](_0x2fb52f);}}}};EmailChannel[_0xfb26('0x26')][_0xfb26('0x1f')]=function(_0x2a6ad9,_0x3211f5){if(this['mailAccounts'][_0x2a6ad9]){this[_0xfb26('0x10')][_0x2a6ad9][_0xfb26('0x1b')][_0xfb26('0x14')]=_0xfb26('0x27');this['mailAccounts'][_0x2a6ad9][_0xfb26('0x1b')][_0xfb26('0x28')]=_0x3211f5[_0xfb26('0x13')];if(_0x3211f5[_0xfb26('0x29')]){this[_0xfb26('0x10')][_0x2a6ad9][_0xfb26('0x1b')][_0xfb26('0x15')]=_0x3211f5[_0xfb26('0x29')][_0xfb26('0x15')];}return this[_0xfb26('0x18')](_0x2a6ad9);}};EmailChannel[_0xfb26('0x26')][_0xfb26('0x21')]=function(_0x634d1a,_0x354b58){logger[_0xfb26('0xe')](_0xfb26('0x2a'),_0x354b58['firstName'],_0x354b58[_0xfb26('0x2b')],_0x354b58[_0xfb26('0x2c')],_0x634d1a);if(this['mailAccounts'][_0x634d1a]){return mailAccount[_0xfb26('0x2d')](_0x634d1a,_0x354b58)[_0xfb26('0x2e')](function(_0x4c23ed){if(_0x4c23ed){logger[_0xfb26('0xe')](_0xfb26('0x2f'));}})[_0xfb26('0x30')](function(_0x3b273a){logger[_0xfb26('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xfb26('0x17')](_0x3b273a));});}};EmailChannel[_0xfb26('0x26')][_0xfb26('0x22')]=function(_0x4443eb){if(this[_0xfb26('0x10')][_0x4443eb]&&this[_0xfb26('0x10')][_0x4443eb][_0xfb26('0x1b')]){if(this[_0xfb26('0x11')][this['mailAccounts'][_0x4443eb]['Imap']['id']]){delete this[_0xfb26('0x11')][this[_0xfb26('0x10')][_0x4443eb][_0xfb26('0x1b')]['id']];}this[_0xfb26('0x10')][_0x4443eb]['Imap'][_0xfb26('0x31')]=moment();this[_0xfb26('0x18')](_0x4443eb);}};EmailChannel['prototype'][_0xfb26('0x24')]=function(_0x5f21df,_0xbff7c1){if(this[_0xfb26('0x10')][_0x5f21df]){this[_0xfb26('0x10')][_0x5f21df][_0xfb26('0x1b')][_0xfb26('0x14')]='error';this['mailAccounts'][_0x5f21df][_0xfb26('0x1b')]['messageStatus']=_0xbff7c1;return this['emit'](_0x5f21df);}};EmailChannel[_0xfb26('0x26')][_0xfb26('0x32')]=function(_0x439958,_0x31f1d9){return this[_0xfb26('0x12')][_0xfb26('0x33')](_0x439958,_0x31f1d9);};EmailChannel['prototype'][_0xfb26('0x34')]=function(_0x36a70f){var _0x5ccb60=this;if(this[_0xfb26('0x10')][_0x36a70f['id']]){if(_[_0xfb26('0x16')](this[_0xfb26('0x10')][_0x36a70f['id']][_0xfb26('0x35')])){this[_0xfb26('0x10')][_0x36a70f['id']]['Smtp']={};}this[_0xfb26('0x10')][_0x36a70f['id']][_0xfb26('0x35')]['lastSync']=moment();return new BPromise(function(_0xfe6da9,_0x28a5bc){return _0x5ccb60[_0xfb26('0x12')][_0xfb26('0x36')](_0x36a70f)[_0xfb26('0x2e')](function(_0x215fba){_0x5ccb60['mailAccounts'][_0x36a70f['id']][_0xfb26('0x35')][_0xfb26('0x14')]=_0xfb26('0x37');_0x5ccb60['mailAccounts'][_0x36a70f['id']][_0xfb26('0x35')][_0xfb26('0x28')]='';_0x5ccb60[_0xfb26('0x18')](_0x36a70f['id']);_0xfe6da9(_0x215fba);})[_0xfb26('0x30')](function(_0x3a74b0){_0x5ccb60[_0xfb26('0x10')][_0x36a70f['id']][_0xfb26('0x35')]['status']='error';_0x5ccb60[_0xfb26('0x10')][_0x36a70f['id']]['Smtp'][_0xfb26('0x28')]=_0x3a74b0;_0x5ccb60[_0xfb26('0x18')](_0x36a70f['id']);_0x28a5bc(_0x3a74b0);});});}return this['smtp'][_0xfb26('0x36')](_0x36a70f);};module[_0xfb26('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 3772465..74050fb 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 _0xd86a=['readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','emit','stringify','hasOwnProperty','lodash','util','imap','mailparser','simpleParser','iconv','events','EventEmitter','./utils','email','mailbox','account','getAccount','once','end','handleEnd','bind','error','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','handleError','box'];(function(_0x2569cf,_0x428bb1){var _0x3f234e=function(_0x54487d){while(--_0x54487d){_0x2569cf['push'](_0x2569cf['shift']());}};_0x3f234e(++_0x428bb1);}(_0xd86a,0x1c7));var _0xad86=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xd86a[_0x43f881];return _0x365c14;};'use strict';var _=require(_0xad86('0x0'));var util=require(_0xad86('0x1'));var Imap=require(_0xad86('0x2'));var simpleParser=require(_0xad86('0x3'))[_0xad86('0x4')];var Iconv=require(_0xad86('0x5'))['Iconv'];var EventEmitter=require(_0xad86('0x6'))[_0xad86('0x7')];var utils=require(_0xad86('0x8'));var logger=require('../../../config/logger')(_0xad86('0x9'));function EmailImap(_0xa472f3,_0x24842a){this[_0xad86('0xa')]=_0xa472f3[_0xad86('0xa')];this[_0xad86('0xb')]=this[_0xad86('0xc')](_0xa472f3,_0x24842a);this[_0xad86('0x2')]=new Imap(this[_0xad86('0xb')]);this[_0xad86('0x2')]['once']('ready',this['handleReady']['bind'](this));this[_0xad86('0x2')][_0xad86('0xd')](_0xad86('0xe'),this[_0xad86('0xf')][_0xad86('0x10')](this));this[_0xad86('0x2')]['on'](_0xad86('0x11'),this['handleError'][_0xad86('0x10')](this));this[_0xad86('0x2')][_0xad86('0x12')]();}util[_0xad86('0x13')](EmailImap,EventEmitter);EmailImap[_0xad86('0x14')][_0xad86('0xc')]=function(_0x30e7d7,_0x514d32){var _0x4e0774={'connTimeout':_0x30e7d7['connTimeout']?_0x30e7d7[_0xad86('0x15')]*0x3e8:0x2710,'authTimeout':_0x30e7d7[_0xad86('0x16')]?_0x30e7d7[_0xad86('0x16')]*0x3e8:0x1388};if(_0x30e7d7[_0xad86('0x17')]){_0x4e0774[_0xad86('0x18')]=_0x30e7d7[_0xad86('0x18')];if(_0x30e7d7[_0xad86('0x19')]){_0x4e0774['xoauth2']=utils[_0xad86('0x1a')](_0x30e7d7[_0xad86('0x1b')][_0xad86('0x1c')],_0x30e7d7[_0xad86('0x18')]);}else{_0x4e0774[_0xad86('0x1d')]=_0x30e7d7[_0xad86('0x1d')];}}else{if(_0x30e7d7[_0xad86('0x1e')]){_0x4e0774[_0xad86('0x18')]=_0x30e7d7[_0xad86('0x18')];_0x4e0774[_0xad86('0x1d')]=_0x30e7d7[_0xad86('0x1d')];}}_0x4e0774[_0xad86('0x9')]=_0x514d32||_0x30e7d7[_0xad86('0x18')]||_0xad86('0x1f');_0x4e0774[_0xad86('0x20')]=_0x30e7d7[_0xad86('0x20')];_0x4e0774[_0xad86('0x21')]=_0x30e7d7[_0xad86('0x21')]||0x3e1;if(_0x30e7d7[_0xad86('0x22')]){_0x4e0774['tls']=!![];}else{_0x4e0774[_0xad86('0x22')]=![];_0x4e0774[_0xad86('0x23')]=_0xad86('0x24');}return _0x4e0774;};EmailImap[_0xad86('0x14')]['handleReady']=function(){this[_0xad86('0x2')][_0xad86('0x25')](this[_0xad86('0xa')],![],this[_0xad86('0x26')][_0xad86('0x10')](this));};EmailImap[_0xad86('0x14')][_0xad86('0x26')]=function(_0x368814,_0x4e36ad){if(_0x368814){this[_0xad86('0x27')](_0x368814,!![]);}else{this['emit'](_0xad86('0x28'),_0x4e36ad);this[_0xad86('0x29')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x1bb356){if(_0x1bb356){this['handleError'](_0x1bb356,!![]);}else{this[_0xad86('0x2')][_0xad86('0xe')]();}};EmailImap[_0xad86('0x14')]['readUnseen']=function(){this[_0xad86('0x2')]['search']([_0xad86('0x2a')],this[_0xad86('0x2b')]['bind'](this));};EmailImap[_0xad86('0x14')]['handleReadUnseen']=function(_0x3bc29a,_0x1efed5){if(_0x3bc29a){this[_0xad86('0x27')](_0x3bc29a,!![]);}else{if(_0x1efed5[_0xad86('0x2c')]){try{var _0x18c014=this[_0xad86('0x2')][_0xad86('0x2d')](_0x1efed5['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x18c014['on'](_0xad86('0x2e'),this[_0xad86('0x2f')][_0xad86('0x10')](this));_0x18c014['once']('error',this[_0xad86('0x30')][_0xad86('0x10')](this));_0x18c014[_0xad86('0xd')](_0xad86('0xe'),this[_0xad86('0x31')][_0xad86('0x10')](this));}catch(_0x1a9ee2){logger['error'](_0x1a9ee2);}}else{this[_0xad86('0x2')][_0xad86('0x32')](!![],this[_0xad86('0x33')][_0xad86('0x10')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x3d76d5){_0x3d76d5['on'](_0xad86('0x34'),this[_0xad86('0x35')][_0xad86('0x10')](this));_0x3d76d5[_0xad86('0xd')](_0xad86('0x36'),this['handleMessageAttributes']['bind'](this));_0x3d76d5[_0xad86('0xd')](_0xad86('0xe'),this[_0xad86('0x37')][_0xad86('0x10')](this));};EmailImap[_0xad86('0x14')][_0xad86('0x35')]=function(_0x345252){simpleParser(_0x345252,{'Iconv':Iconv},this[_0xad86('0x38')]['bind'](this));};EmailImap[_0xad86('0x14')][_0xad86('0x39')]=function(){};EmailImap['prototype'][_0xad86('0x37')]=function(){};EmailImap[_0xad86('0x14')][_0xad86('0x38')]=function(_0x34105f,_0x25f762){if(_0x34105f){logger[_0xad86('0x11')](_0x34105f);}else{var _0x1f644d=this;utils[_0xad86('0x3a')](this[_0xad86('0xb')],_0x25f762,function(_0x19c980){_0x1f644d['emit'](_0xad86('0x9'),_0x19c980);});}};EmailImap['prototype'][_0xad86('0x31')]=function(){this[_0xad86('0x2')][_0xad86('0x32')](!![],this[_0xad86('0x33')][_0xad86('0x10')](this));};EmailImap[_0xad86('0x14')][_0xad86('0x30')]=function(_0x43f4ff){this[_0xad86('0x27')](_0x43f4ff);this[_0xad86('0x2')][_0xad86('0x32')](!![],this[_0xad86('0x33')][_0xad86('0x10')](this));};EmailImap[_0xad86('0x14')][_0xad86('0xf')]=function(){this[_0xad86('0x3b')](_0xad86('0xe'));};EmailImap[_0xad86('0x14')][_0xad86('0x27')]=function(_0x4319ba,_0x14d530){logger[_0xad86('0x11')]('handleError',this[_0xad86('0xb')]['email'],JSON[_0xad86('0x3c')](_0x4319ba));var _0x22dcc6='';if(_0x4319ba){if(_0x4319ba['textCode']){_0x22dcc6=_0x4319ba['textCode'];}else{for(var _0x1bbaad in _0x4319ba){if(_0x4319ba[_0xad86('0x3d')](_0x1bbaad)){_0x22dcc6+=_['upperFirst'](_0x1bbaad)+':\x20'+_0x4319ba[_0x1bbaad]+'\x0a';}}}}if(_0x14d530){this[_0xad86('0x2')][_0xad86('0xe')]();}else{this[_0xad86('0x3b')](_0xad86('0x11'),_0x22dcc6);this[_0xad86('0x3b')](_0xad86('0xe'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x2678=['./utils','email','mailbox','account','getAccount','once','handleReady','bind','end','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','password','authentication','host','port','tls','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','emit','handleFetchError','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser','events','EventEmitter'];(function(_0xad6a6,_0x9019dc){var _0x91f920=function(_0x161c27){while(--_0x161c27){_0xad6a6['push'](_0xad6a6['shift']());}};_0x91f920(++_0x9019dc);}(_0x2678,0x1bb));var _0x8267=function(_0x40af92,_0x22abf7){_0x40af92=_0x40af92-0x0;var _0x4b92ee=_0x2678[_0x40af92];return _0x4b92ee;};'use strict';var _=require('lodash');var util=require(_0x8267('0x0'));var Imap=require(_0x8267('0x1'));var simpleParser=require(_0x8267('0x2'))['simpleParser'];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x8267('0x3'))[_0x8267('0x4')];var utils=require(_0x8267('0x5'));var logger=require('../../../config/logger')(_0x8267('0x6'));function EmailImap(_0x26b816,_0xc759e2){this[_0x8267('0x7')]=_0x26b816[_0x8267('0x7')];this[_0x8267('0x8')]=this[_0x8267('0x9')](_0x26b816,_0xc759e2);this[_0x8267('0x1')]=new Imap(this['account']);this[_0x8267('0x1')][_0x8267('0xa')]('ready',this[_0x8267('0xb')][_0x8267('0xc')](this));this[_0x8267('0x1')][_0x8267('0xa')](_0x8267('0xd'),this['handleEnd'][_0x8267('0xc')](this));this[_0x8267('0x1')]['on'](_0x8267('0xe'),this[_0x8267('0xf')][_0x8267('0xc')](this));this[_0x8267('0x1')][_0x8267('0x10')]();}util[_0x8267('0x11')](EmailImap,EventEmitter);EmailImap[_0x8267('0x12')][_0x8267('0x9')]=function(_0x2ed051,_0x4e5f44){var _0x14a8d1={'connTimeout':_0x2ed051['connTimeout']?_0x2ed051[_0x8267('0x13')]*0x3e8:0x2710,'authTimeout':_0x2ed051[_0x8267('0x14')]?_0x2ed051[_0x8267('0x14')]*0x3e8:0x1388};if(_0x2ed051[_0x8267('0x15')]){_0x14a8d1['user']=_0x2ed051[_0x8267('0x16')];if(_0x2ed051['modernAuthentication']){_0x14a8d1[_0x8267('0x17')]=utils[_0x8267('0x18')](_0x2ed051['CloudProvider']['data5'],_0x2ed051[_0x8267('0x16')]);}else{_0x14a8d1[_0x8267('0x19')]=_0x2ed051[_0x8267('0x19')];}}else{if(_0x2ed051[_0x8267('0x1a')]){_0x14a8d1['user']=_0x2ed051[_0x8267('0x16')];_0x14a8d1['password']=_0x2ed051[_0x8267('0x19')];}}_0x14a8d1[_0x8267('0x6')]=_0x4e5f44||_0x2ed051[_0x8267('0x16')]||'anonymous@xcally.com';_0x14a8d1[_0x8267('0x1b')]=_0x2ed051[_0x8267('0x1b')];_0x14a8d1[_0x8267('0x1c')]=_0x2ed051[_0x8267('0x1c')]||0x3e1;if(_0x2ed051[_0x8267('0x1d')]){_0x14a8d1[_0x8267('0x1d')]=!![];}else{_0x14a8d1[_0x8267('0x1d')]=![];_0x14a8d1['autotls']='required';}return _0x14a8d1;};EmailImap[_0x8267('0x12')][_0x8267('0xb')]=function(){this[_0x8267('0x1')][_0x8267('0x1e')](this[_0x8267('0x7')],![],this[_0x8267('0x1f')]['bind'](this));};EmailImap[_0x8267('0x12')][_0x8267('0x1f')]=function(_0x24c03c,_0x2903bb){if(_0x24c03c){this[_0x8267('0xf')](_0x24c03c,!![]);}else{this['emit'](_0x8267('0x20'),_0x2903bb);this[_0x8267('0x21')]();}};EmailImap[_0x8267('0x12')][_0x8267('0x22')]=function(_0x3c3584){if(_0x3c3584){this[_0x8267('0xf')](_0x3c3584,!![]);}else{this[_0x8267('0x1')]['end']();}};EmailImap[_0x8267('0x12')][_0x8267('0x21')]=function(){this[_0x8267('0x1')][_0x8267('0x23')]([_0x8267('0x24')],this[_0x8267('0x25')][_0x8267('0xc')](this));};EmailImap[_0x8267('0x12')][_0x8267('0x25')]=function(_0xdb4adc,_0x18cd66){if(_0xdb4adc){this['handleError'](_0xdb4adc,!![]);}else{if(_0x18cd66[_0x8267('0x26')]){try{var _0x4f7377=this[_0x8267('0x1')]['fetch'](_0x18cd66['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x4f7377['on']('message',this['handleFetchMessage']['bind'](this));_0x4f7377[_0x8267('0xa')](_0x8267('0xe'),this['handleFetchError'][_0x8267('0xc')](this));_0x4f7377[_0x8267('0xa')]('end',this[_0x8267('0x27')][_0x8267('0xc')](this));}catch(_0x19a895){logger[_0x8267('0xe')](_0x19a895);}}else{this['imap'][_0x8267('0x28')](!![],this[_0x8267('0x22')][_0x8267('0xc')](this));}}};EmailImap['prototype'][_0x8267('0x29')]=function(_0x253ff6){_0x253ff6['on'](_0x8267('0x2a'),this[_0x8267('0x2b')][_0x8267('0xc')](this));_0x253ff6[_0x8267('0xa')]('attributes',this[_0x8267('0x2c')][_0x8267('0xc')](this));_0x253ff6[_0x8267('0xa')](_0x8267('0xd'),this['handleMessageEnd'][_0x8267('0xc')](this));};EmailImap[_0x8267('0x12')][_0x8267('0x2b')]=function(_0x39d957){simpleParser(_0x39d957,{'Iconv':Iconv},this[_0x8267('0x2d')][_0x8267('0xc')](this));};EmailImap[_0x8267('0x12')]['handleMessageAttributes']=function(){};EmailImap[_0x8267('0x12')][_0x8267('0x2e')]=function(){};EmailImap[_0x8267('0x12')]['handleSimpleParser']=function(_0x3df5f9,_0x34b4e0){if(_0x3df5f9){logger[_0x8267('0xe')](_0x3df5f9);}else{var _0x4759e7=this;utils[_0x8267('0x2f')](this[_0x8267('0x8')],_0x34b4e0,function(_0x5d28eb){_0x4759e7[_0x8267('0x30')](_0x8267('0x6'),_0x5d28eb);});}};EmailImap[_0x8267('0x12')][_0x8267('0x27')]=function(){this[_0x8267('0x1')]['closeBox'](!![],this[_0x8267('0x22')][_0x8267('0xc')](this));};EmailImap[_0x8267('0x12')][_0x8267('0x31')]=function(_0x2e4e96){this[_0x8267('0xf')](_0x2e4e96);this[_0x8267('0x1')][_0x8267('0x28')](!![],this[_0x8267('0x22')][_0x8267('0xc')](this));};EmailImap['prototype'][_0x8267('0x32')]=function(){this[_0x8267('0x30')](_0x8267('0xd'));};EmailImap['prototype'][_0x8267('0xf')]=function(_0x4153c7,_0x8605bd){logger[_0x8267('0xe')](_0x8267('0xf'),this[_0x8267('0x8')][_0x8267('0x6')],JSON[_0x8267('0x33')](_0x4153c7));var _0x378556='';if(_0x4153c7){if(_0x4153c7[_0x8267('0x34')]){_0x378556=_0x4153c7['textCode'];}else{for(var _0x463024 in _0x4153c7){if(_0x4153c7[_0x8267('0x35')](_0x463024)){_0x378556+=_[_0x8267('0x36')](_0x463024)+':\x20'+_0x4153c7[_0x463024]+'\x0a';}}}}if(_0x8605bd){this[_0x8267('0x1')]['end']();}else{this[_0x8267('0x30')](_0x8267('0xe'),_0x378556);this[_0x8267('0x30')](_0x8267('0xd'));}};module[_0x8267('0x37')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 569b7ce..705f46c 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 _0xf082=['Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','verify','toString'];(function(_0x263757,_0x4f32df){var _0x368183=function(_0x1ff25a){while(--_0x1ff25a){_0x263757['push'](_0x263757['shift']());}};_0x368183(++_0x4f32df);}(_0xf082,0x17e));var _0x2f08=function(_0x40608a,_0x5af846){_0x40608a=_0x40608a-0x0;var _0x57682c=_0xf082[_0x40608a];return _0x57682c;};'use strict';var nodemailer=require(_0x2f08('0x0'));var inlineBase64=require(_0x2f08('0x1'));function EmailSmtp(){}EmailSmtp[_0x2f08('0x2')]['send']=function(_0x51c4c2,_0x2dc842){return new Promise(function(_0x4a4275,_0x3ef7db){var _0x545d8c=nodemailer[_0x2f08('0x3')](_0x51c4c2);_0x545d8c[_0x2f08('0x4')](_0x2f08('0x5'),inlineBase64());_0x545d8c['sendMail'](_0x2dc842,function(_0x488ec7,_0x19acf8){if(_0x488ec7){_0x3ef7db(_0x488ec7['toString']());}else{_0x4a4275(_0x19acf8);}});});};EmailSmtp[_0x2f08('0x2')][_0x2f08('0x6')]=function(_0x349bbe){return new Promise(function(_0xcd58fe,_0x40dca7){var _0x3d357d=nodemailer[_0x2f08('0x3')](_0x349bbe);_0x3d357d['verify'](function(_0x3e77bf,_0x126185){if(_0x3e77bf){_0x40dca7(_0x3e77bf[_0x2f08('0x7')]());}else{if(_0x126185){_0xcd58fe(_0x126185);}else{_0x40dca7(_0x2f08('0x8'));}}});});};module[_0x2f08('0x9')]=EmailSmtp; \ No newline at end of file +var _0xf1ad=['verify','createTransport','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail'];(function(_0x294747,_0x379ea7){var _0x1a4b30=function(_0xac96e8){while(--_0xac96e8){_0x294747['push'](_0x294747['shift']());}};_0x1a4b30(++_0x379ea7);}(_0xf1ad,0x9a));var _0xdf1a=function(_0x141dac,_0x4430a7){_0x141dac=_0x141dac-0x0;var _0x25f8b9=_0xf1ad[_0x141dac];return _0x25f8b9;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xdf1a('0x0'));function EmailSmtp(){}EmailSmtp[_0xdf1a('0x1')][_0xdf1a('0x2')]=function(_0x57abed,_0x2573b9){return new Promise(function(_0x474bac,_0x1174a5){var _0x4dd16e=nodemailer['createTransport'](_0x57abed);_0x4dd16e[_0xdf1a('0x3')](_0xdf1a('0x4'),inlineBase64());_0x4dd16e[_0xdf1a('0x5')](_0x2573b9,function(_0x11fd0e,_0x9df1a2){if(_0x11fd0e){_0x1174a5(_0x11fd0e['toString']());}else{_0x474bac(_0x9df1a2);}});});};EmailSmtp[_0xdf1a('0x1')][_0xdf1a('0x6')]=function(_0x5dd6c4){return new Promise(function(_0x307d7b,_0x47c203){var _0x11f3c8=nodemailer[_0xdf1a('0x7')](_0x5dd6c4);_0x11f3c8['verify'](function(_0x499ab9,_0x891a04){if(_0x499ab9){_0x47c203(_0x499ab9['toString']());}else{if(_0x891a04){_0x307d7b(_0x891a04);}else{_0x47c203(_0xdf1a('0x8'));}}});});};module[_0xdf1a('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index dda30ed..5d7ac76 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 _0xdd5b=['originTo','originCc','attachments','attach','type','attachment','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','parser','from','messageId','inReplyTo','date','format','filter','info','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','utf-8','toString','base64','lodash','moment','randomstring','path','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','generate','html','replace','includes','forEach','push','filename','\x20[Attachment:\x20','\x20]','body','textAsHtml','message'];(function(_0x3646b9,_0x3a06fc){var _0x5c80be=function(_0x328ea3){while(--_0x328ea3){_0x3646b9['push'](_0x3646b9['shift']());}};_0x5c80be(++_0x3a06fc);}(_0xdd5b,0xa8));var _0xbdd5=function(_0x59a7d2,_0x1a8474){_0x59a7d2=_0x59a7d2-0x0;var _0x2bd4a9=_0xdd5b[_0x59a7d2];return _0x2bd4a9;};'use strict';var _=require(_0xbdd5('0x0'));var moment=require(_0xbdd5('0x1'));var random=require(_0xbdd5('0x2'));var fs=require('fs');var path=require(_0xbdd5('0x3'));var util=require('util');var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0xbdd5('0x4'));var config=require(_0xbdd5('0x5'));function getAddress(_0x3cbf2e){var _0x312bb0=_[_0xbdd5('0x6')](_0x3cbf2e[_0xbdd5('0x7')]);return _0x312bb0&&_0x312bb0[_0xbdd5('0x8')]?_0x312bb0[_0xbdd5('0x8')]:_0xbdd5('0x9')+random['generate'](0x6)+_0xbdd5('0xa');}function getFirstName(_0x30d955){var _0x4799ec=_[_0xbdd5('0x6')](_0x30d955['value']);if(_0x4799ec&&_0x4799ec[_0xbdd5('0xb')]){if(_0x4799ec[_0xbdd5('0xb')]==_0x4799ec['address']){return _0x4799ec[_0xbdd5('0xb')][_0xbdd5('0xc')](0x0,_0x4799ec[_0xbdd5('0xb')][_0xbdd5('0xd')]('@'));}var _0x19391c=_0x4799ec[_0xbdd5('0xb')][_0xbdd5('0xe')](/\s+/);return _0x19391c[_0xbdd5('0xf')]>0x1?_0x19391c[_0xbdd5('0x10')](0x0,-0x1)[_0xbdd5('0x11')]('\x20'):_0x4799ec[_0xbdd5('0xb')];}return _0xbdd5('0x12');}function getLastName(_0x43884a){var _0x50f5d9=_[_0xbdd5('0x6')](_0x43884a[_0xbdd5('0x7')]);if(_0x50f5d9&&_0x50f5d9['name']){var _0x5d1c3d=_0x50f5d9[_0xbdd5('0xb')][_0xbdd5('0xe')](/\s+/);return _0x5d1c3d[_0xbdd5('0xf')]>0x1?_0x5d1c3d[_0xbdd5('0x13')]():'';}return'';}function getMails(_0x492f26,_0x323911){var _0x4c9d79='';for(var _0x275925=0x0;_0x275925<_0x323911[_0xbdd5('0x7')][_0xbdd5('0xf')];_0x275925+=0x1){if(_0x323911[_0xbdd5('0x7')][_0x275925]['address']!==_0x492f26){if(!_[_0xbdd5('0x14')](_0x4c9d79)){_0x4c9d79+=',';}_0x4c9d79+=_0x323911[_0xbdd5('0x7')][_0x275925][_0xbdd5('0xb')]||_0x323911[_0xbdd5('0x7')][_0x275925][_0xbdd5('0x8')]||'';_0x4c9d79+='\x20<';_0x4c9d79+=_0x323911[_0xbdd5('0x7')][_0x275925][_0xbdd5('0x8')]?_0x323911[_0xbdd5('0x7')][_0x275925][_0xbdd5('0x8')]:_0xbdd5('0x9')+random[_0xbdd5('0x15')](0x6)+_0xbdd5('0xa');_0x4c9d79+='>';}}return _0x4c9d79;}function parseEmail(_0x944f22,_0x3365d9,_0x2fc366){if(_0x3365d9[_0xbdd5('0x16')]){var _0x36011e=/)<[^<]*)*<\/script>/gi;while(_0x36011e['test'](_0x3365d9[_0xbdd5('0x16')])){_0x3365d9[_0xbdd5('0x16')]=_0x3365d9[_0xbdd5('0x16')][_0xbdd5('0x17')](_0x36011e,'');}if(_0x3365d9[_0xbdd5('0x16')][_0xbdd5('0x18')]('{_0x225062[_0xbdd5('0x1a')](_0x3c6a34[_0xbdd5('0x1b')]);});var _0x477ba6=/]+>/g;var _0x1e0f71=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x44f14f=_0x3365d9['html'][_0xbdd5('0x17')](_0x1e0f71,'_SRC');var _0x2fceb3=_0x44f14f['replace'](_0x477ba6,'_IMG');for(let _0x7f387c=0x0;_0x7f387c<_0x225062[_0xbdd5('0xf')];_0x7f387c++){var _0x280221=_0x2fceb3[_0xbdd5('0x17')]('_IMG',_0xbdd5('0x1c')+_0x225062[_0x7f387c]+_0xbdd5('0x1d'));_0x2fceb3=_0x280221;}_0x3365d9[_0xbdd5('0x16')]=_0x2fceb3;}_0x2fc366['body']=_0x3365d9[_0xbdd5('0x16')];}else{_0x2fc366[_0xbdd5('0x1e')]=_0x3365d9[_0xbdd5('0x1f')];}if(_0x2fc366[_0xbdd5('0x1e')]){_0x2fc366[_0xbdd5('0x1e')]=_0x2fc366[_0xbdd5('0x1e')][_0xbdd5('0x17')](/0x0){var _0x431057=['Auto-Submitted:\x20auto-replied',_0xbdd5('0x2d'),_0xbdd5('0x2e')];for(var _0x291632=0x0;_0x291632<_0x3365d9['headerLines']['length'];_0x291632++){var _0x2c4d41=_[_0xbdd5('0xd')](_0x431057,_0x3365d9['headerLines'][_0x291632]['line']);if(_0x2c4d41>=0x0){_0x2fc366[_0xbdd5('0x2f')]=!![];}}}return _0x2fc366;}exports[_0xbdd5('0x30')]=function(_0x17daa8,_0x3210bc,_0x311536){var _0x33ed71={'from':getAddress(_0x3210bc['from']),'firstName':getFirstName(_0x3210bc[_0xbdd5('0x31')]),'lastName':getLastName(_0x3210bc['from']),'mapKey':_0xbdd5('0x4'),'message':{'from':getMails(_0x17daa8[_0xbdd5('0x4')],_0x3210bc[_0xbdd5('0x31')]),'to':_0x17daa8['email'],'cc':'','subject':_0x3210bc['subject']||'','messageId':_0x3210bc[_0xbdd5('0x32')],'inReplyTo':_0x3210bc[_0xbdd5('0x33')],'sentAt':moment(_0x3210bc[_0xbdd5('0x34')])[_0xbdd5('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3210bc['html']&&!_0x3210bc[_0xbdd5('0x1f')]){var _0x122e4f=_[_0xbdd5('0x36')](_0x3210bc[_0xbdd5('0x23')],{'contentType':'application/ms-tnef'});if(_0x122e4f['length']){logger[_0xbdd5('0x37')](util[_0xbdd5('0x35')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x3210bc[_0xbdd5('0x32')]));tnef[_0xbdd5('0x38')](_[_0xbdd5('0x39')](_0x122e4f)[_0xbdd5('0x2a')],function(_0xdfe7bb,_0xd0e6b4){if(_0xd0e6b4){_0x3210bc[_0xbdd5('0x16')]=_0xd0e6b4[_0xbdd5('0x3a')]||'

Empty\x20message

';if(_0xd0e6b4[_0xbdd5('0x3b')]){for(var _0x3a54bd=0x0;_0x3a54bd<_0xd0e6b4[_0xbdd5('0x3b')][_0xbdd5('0xf')];_0x3a54bd++){var _0x17c6a6=_0xd0e6b4[_0xbdd5('0x3b')][_0x3a54bd];_0x33ed71[_0xbdd5('0x20')][_0xbdd5('0x23')]['push']({'filename':_0x17c6a6[_0xbdd5('0x3c')],'content':Buffer[_0xbdd5('0x31')](_0x17c6a6[_0xbdd5('0x3d')])});}}}_0x311536(parseEmail(_0x17daa8,_0x3210bc,_0x33ed71));});}else{_0x3210bc[_0xbdd5('0x16')]=_0xbdd5('0x3e');_0x311536(parseEmail(_0x17daa8,_0x3210bc,_0x33ed71));}}else{_0x311536(parseEmail(_0x17daa8,_0x3210bc,_0x33ed71));}};exports[_0xbdd5('0x3f')]=function(_0x4b265c,_0x1c6ec3){var _0x10d1ff=['user='+(_0x1c6ec3||''),'auth=Bearer\x20'+_0x4b265c,'',''];return Buffer[_0xbdd5('0x31')](_0x10d1ff[_0xbdd5('0x11')](''),_0xbdd5('0x40'))[_0xbdd5('0x41')](_0xbdd5('0x42'));}; \ No newline at end of file +var _0x0bc7=['X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','messageId','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','name','split','join','Anonymous','pop','length','isEmpty','@xcally.com','html','test','replace','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x2d9422['slice'](0x0,-0x1)[_0x70bc('0xe')]('\x20'):_0x565cf2[_0x70bc('0xc')];}return _0x70bc('0xf');}function getLastName(_0x2c7b20){var _0x230e14=_['head'](_0x2c7b20[_0x70bc('0x8')]);if(_0x230e14&&_0x230e14[_0x70bc('0xc')]){var _0x1e62a4=_0x230e14['name']['split'](/\s+/);return _0x1e62a4['length']>0x1?_0x1e62a4[_0x70bc('0x10')]():'';}return'';}function getMails(_0x5a2622,_0x5bbb4a){var _0x40a1ad='';for(var _0x5b5dec=0x0;_0x5b5dec<_0x5bbb4a[_0x70bc('0x8')][_0x70bc('0x11')];_0x5b5dec+=0x1){if(_0x5bbb4a[_0x70bc('0x8')][_0x5b5dec]['address']!==_0x5a2622){if(!_[_0x70bc('0x12')](_0x40a1ad)){_0x40a1ad+=',';}_0x40a1ad+=_0x5bbb4a[_0x70bc('0x8')][_0x5b5dec][_0x70bc('0xc')]||_0x5bbb4a[_0x70bc('0x8')][_0x5b5dec][_0x70bc('0x9')]||'';_0x40a1ad+='\x20<';_0x40a1ad+=_0x5bbb4a[_0x70bc('0x8')][_0x5b5dec][_0x70bc('0x9')]?_0x5bbb4a[_0x70bc('0x8')][_0x5b5dec][_0x70bc('0x9')]:_0x70bc('0xa')+random[_0x70bc('0xb')](0x6)+_0x70bc('0x13');_0x40a1ad+='>';}}return _0x40a1ad;}function parseEmail(_0x49adba,_0x3816d9,_0x27b492){if(_0x3816d9[_0x70bc('0x14')]){var _0x2e07fd=/)<[^<]*)*<\/script>/gi;while(_0x2e07fd[_0x70bc('0x15')](_0x3816d9[_0x70bc('0x14')])){_0x3816d9[_0x70bc('0x14')]=_0x3816d9[_0x70bc('0x14')][_0x70bc('0x16')](_0x2e07fd,'');}if(_0x3816d9[_0x70bc('0x14')]['includes'](_0x70bc('0x17'))){var _0x20cf8a=[];_0x3816d9[_0x70bc('0x18')][_0x70bc('0x19')](_0x278cbc=>{_0x20cf8a['push'](_0x278cbc['filename']);});var _0x5d6f65=/]+>/g;var _0x3072a9=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4bb66f=_0x3816d9[_0x70bc('0x14')][_0x70bc('0x16')](_0x3072a9,_0x70bc('0x1a'));var _0xee55c7=_0x4bb66f['replace'](_0x5d6f65,_0x70bc('0x1b'));for(let _0x157006=0x0;_0x157006<_0x20cf8a['length'];_0x157006++){var _0x5ccc19=_0xee55c7[_0x70bc('0x16')]('_IMG',_0x70bc('0x1c')+_0x20cf8a[_0x157006]+'\x20]');_0xee55c7=_0x5ccc19;}_0x3816d9['html']=_0xee55c7;}_0x27b492['body']=_0x3816d9[_0x70bc('0x14')];}else{_0x27b492[_0x70bc('0x1d')]=_0x3816d9[_0x70bc('0x1e')];}if(_0x27b492[_0x70bc('0x1d')]){_0x27b492[_0x70bc('0x1d')]=_0x27b492[_0x70bc('0x1d')][_0x70bc('0x16')](/0x0){var _0x199963=[_0x70bc('0x31'),_0x70bc('0x32'),_0x70bc('0x33')];for(var _0xf4efb5=0x0;_0xf4efb5<_0x3816d9[_0x70bc('0x30')][_0x70bc('0x11')];_0xf4efb5++){var _0x44f609=_[_0x70bc('0x34')](_0x199963,_0x3816d9[_0x70bc('0x30')][_0xf4efb5][_0x70bc('0x35')]);if(_0x44f609>=0x0){_0x27b492[_0x70bc('0x36')]=!![];}}}return _0x27b492;}exports[_0x70bc('0x37')]=function(_0x4ff8c8,_0x522b18,_0x5bbcf8){var _0x148a60={'from':getAddress(_0x522b18['from']),'firstName':getFirstName(_0x522b18[_0x70bc('0x38')]),'lastName':getLastName(_0x522b18[_0x70bc('0x38')]),'mapKey':_0x70bc('0x22'),'message':{'from':getMails(_0x4ff8c8[_0x70bc('0x22')],_0x522b18[_0x70bc('0x38')]),'to':_0x4ff8c8['email'],'cc':'','subject':_0x522b18['subject']||'','messageId':_0x522b18[_0x70bc('0x39')],'inReplyTo':_0x522b18['inReplyTo'],'sentAt':moment(_0x522b18[_0x70bc('0x3a')])[_0x70bc('0x2a')](_0x70bc('0x3b')),'attach':![],'attachments':[]}};if(!_0x522b18[_0x70bc('0x14')]&&!_0x522b18['textAsHtml']){var _0x5c3bab=_[_0x70bc('0x3c')](_0x522b18[_0x70bc('0x18')],{'contentType':_0x70bc('0x3d')});if(_0x5c3bab[_0x70bc('0x11')]){logger[_0x70bc('0x3e')](util[_0x70bc('0x2a')](_0x70bc('0x3f'),_0x522b18[_0x70bc('0x39')]));tnef[_0x70bc('0x40')](_['first'](_0x5c3bab)['content'],function(_0x2b746d,_0x4e3e20){if(_0x4e3e20){_0x522b18[_0x70bc('0x14')]=_0x4e3e20[_0x70bc('0x41')]||_0x70bc('0x42');if(_0x4e3e20[_0x70bc('0x43')]){for(var _0x11565f=0x0;_0x11565f<_0x4e3e20[_0x70bc('0x43')]['length'];_0x11565f++){var _0x35b10e=_0x4e3e20[_0x70bc('0x43')][_0x11565f];_0x148a60[_0x70bc('0x20')][_0x70bc('0x18')][_0x70bc('0x2f')]({'filename':_0x35b10e[_0x70bc('0x44')],'content':Buffer[_0x70bc('0x38')](_0x35b10e[_0x70bc('0x45')])});}}}_0x5bbcf8(parseEmail(_0x4ff8c8,_0x522b18,_0x148a60));});}else{_0x522b18[_0x70bc('0x14')]=_0x70bc('0x42');_0x5bbcf8(parseEmail(_0x4ff8c8,_0x522b18,_0x148a60));}}else{_0x5bbcf8(parseEmail(_0x4ff8c8,_0x522b18,_0x148a60));}};exports[_0x70bc('0x46')]=function(_0x254468,_0x390f36){var _0x75b193=[_0x70bc('0x47')+(_0x390f36||''),_0x70bc('0x48')+_0x254468,'',''];return Buffer[_0x70bc('0x38')](_0x75b193[_0x70bc('0xe')](''),_0x70bc('0x49'))[_0x70bc('0x4a')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index ea6e967..723c318 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 _0x30b3=['name','Service','key','active','Imap','Smtp','exports','lodash'];(function(_0x19d16d,_0x544d6){var _0x138325=function(_0x428246){while(--_0x428246){_0x19d16d['push'](_0x19d16d['shift']());}};_0x138325(++_0x544d6);}(_0x30b3,0x157));var _0x330b=function(_0xfc959c,_0x4660c){_0xfc959c=_0xfc959c-0x0;var _0xa12959=_0x30b3[_0xfc959c];return _0xa12959;};'use strict';var _=require(_0x330b('0x0'));function MailAccount(_0xa7e33d){this['id']=_0xa7e33d['id']||0x0;this[_0x330b('0x1')]=_0xa7e33d[_0x330b('0x1')]||_0x330b('0x2');this[_0x330b('0x3')]=_0xa7e33d['key']||'SERV';this[_0x330b('0x4')]=_0xa7e33d['active']||![];this[_0x330b('0x5')]=_0xa7e33d[_0x330b('0x5')]||[];this[_0x330b('0x6')]=_0xa7e33d[_0x330b('0x6')]||[];}module[_0x330b('0x7')]=MailAccount; \ No newline at end of file +var _0xd752=['name','key','active','Imap','Smtp','lodash'];(function(_0x351cd1,_0x2dfafd){var _0x4ce6f2=function(_0xa490ee){while(--_0xa490ee){_0x351cd1['push'](_0x351cd1['shift']());}};_0x4ce6f2(++_0x2dfafd);}(_0xd752,0x10d));var _0x2d75=function(_0x56f604,_0x31e0fc){_0x56f604=_0x56f604-0x0;var _0x5c3f23=_0xd752[_0x56f604];return _0x5c3f23;};'use strict';var _=require(_0x2d75('0x0'));function MailAccount(_0x9d2638){this['id']=_0x9d2638['id']||0x0;this[_0x2d75('0x1')]=_0x9d2638[_0x2d75('0x1')]||'Service';this[_0x2d75('0x2')]=_0x9d2638[_0x2d75('0x2')]||'SERV';this[_0x2d75('0x3')]=_0x9d2638[_0x2d75('0x3')]||![];this[_0x2d75('0x4')]=_0x9d2638[_0x2d75('0x4')]||[];this['Smtp']=_0x9d2638[_0x2d75('0x5')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 9845729..c2a0f52 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 _0xb9d6=['mergeFromDatabase','initMailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0xb9d6,0x14f));var _0x6b9d=function(_0x3d0b38,_0x5b4bda){_0x3d0b38=_0x3d0b38-0x0;var _0x5f19fb=_0xb9d6[_0x3d0b38];return _0x5f19fb;};'use strict';var _=require(_0x6b9d('0x0'));var MailAccount=require(_0x6b9d('0x1'));var Realtime=function(){this[_0x6b9d('0x2')]={};};function freeIsNotKey(_0x2a117e,_0x1bb34e,_0x1a62c8){var _0x9b0263=_[_0x6b9d('0x3')](_0x2a117e,function(_0x25d3f7,_0x44d4a6){return _0x25d3f7[_0x1a62c8];});for(var _0x90ecb2 in _0x1bb34e){if(_0x1bb34e[_0x6b9d('0x4')](_0x90ecb2)){if(!_0x9b0263[_0x90ecb2]){delete _0x1bb34e[_0x90ecb2];}}}}Realtime[_0x6b9d('0x5')][_0x6b9d('0x6')]=function(_0x44edf8,_0x48ce8c){for(var _0xd3c63e in _0x48ce8c){if(_0x44edf8[_0x6b9d('0x4')](_0xd3c63e)){_0x44edf8[_0xd3c63e]=_0x48ce8c[_0xd3c63e];}}};Realtime[_0x6b9d('0x5')][_0x6b9d('0x7')]=function(){var _0x9c6bb7=this;return function(_0x359a4f){if(_0x359a4f){freeIsNotKey(_0x359a4f,_0x9c6bb7['mailAccounts'],'id');for(var _0x4bce80=0x0,_0x81aa16={},_0x295fff={};_0x4bce80<_0x359a4f['length'];_0x4bce80+=0x1){_0x81aa16=_0x359a4f[_0x4bce80];if(_[_0x6b9d('0x8')](_0x9c6bb7[_0x6b9d('0x2')][_0x81aa16['id']])){_0x9c6bb7[_0x6b9d('0x2')][_0x81aa16['id']]=new MailAccount(_0x81aa16);}else{_[_0x6b9d('0x9')](_0x9c6bb7[_0x6b9d('0x2')][_0x81aa16['id']],_0x81aa16);}}}return _0x9c6bb7[_0x6b9d('0x2')];};};module[_0x6b9d('0xa')]=Realtime; \ No newline at end of file +var _0xb6fe=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','merge','exports','../model/mailAccount'];(function(_0x3bbaa4,_0x40f004){var _0x53c1c7=function(_0x2dfc79){while(--_0x2dfc79){_0x3bbaa4['push'](_0x3bbaa4['shift']());}};_0x53c1c7(++_0x40f004);}(_0xb6fe,0x7f));var _0xeb6f=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0xb6fe[_0x308213];return _0x2e1619;};'use strict';var _=require('lodash');var MailAccount=require(_0xeb6f('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1618b9,_0x3547d9,_0x344cbe){var _0x5525ef=_[_0xeb6f('0x1')](_0x1618b9,function(_0xd9e6f9,_0x2dc753){return _0xd9e6f9[_0x344cbe];});for(var _0x997921 in _0x3547d9){if(_0x3547d9[_0xeb6f('0x2')](_0x997921)){if(!_0x5525ef[_0x997921]){delete _0x3547d9[_0x997921];}}}}Realtime[_0xeb6f('0x3')][_0xeb6f('0x4')]=function(_0x65f23e,_0x1a6cfc){for(var _0x253b43 in _0x1a6cfc){if(_0x65f23e[_0xeb6f('0x2')](_0x253b43)){_0x65f23e[_0x253b43]=_0x1a6cfc[_0x253b43];}}};Realtime[_0xeb6f('0x3')]['initMailAccounts']=function(){var _0x22d539=this;return function(_0x32948c){if(_0x32948c){freeIsNotKey(_0x32948c,_0x22d539[_0xeb6f('0x5')],'id');for(var _0x489a47=0x0,_0x328aaa={},_0x1cb766={};_0x489a47<_0x32948c['length'];_0x489a47+=0x1){_0x328aaa=_0x32948c[_0x489a47];if(_['isUndefined'](_0x22d539[_0xeb6f('0x5')][_0x328aaa['id']])){_0x22d539[_0xeb6f('0x5')][_0x328aaa['id']]=new MailAccount(_0x328aaa);}else{_[_0xeb6f('0x6')](_0x22d539[_0xeb6f('0x5')][_0x328aaa['id']],_0x328aaa);}}}return _0x22d539[_0xeb6f('0x5')];};};module[_0xeb6f('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 82cf604..b0ca750 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 _0xc6c0=['email','active','key','ListId','TemplateId','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service'];(function(_0x587b4d,_0x10aded){var _0x1b48e=function(_0x22b564){while(--_0x22b564){_0x587b4d['push'](_0x587b4d['shift']());}};_0x1b48e(++_0x10aded);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0xc6c0[_0x5e709a];return _0x57401a;};'use strict';var client=require(_0x0c6c('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x0c6c('0x1')](_0x0c6c('0x2'),{'options':{'attributes':['id',_0x0c6c('0x3'),_0x0c6c('0x4'),_0x0c6c('0x5'),_0x0c6c('0x6'),_0x0c6c('0x7'),_0x0c6c('0x8'),_0x0c6c('0x9'),_0x0c6c('0xa')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x0c6c('0xb'),'attributes':['id',_0x0c6c('0x3'),_0x0c6c('0x5'),_0x0c6c('0xc'),_0x0c6c('0xd')],'as':_0x0c6c('0xb')}]},{'model':_0x0c6c('0xe'),'as':_0x0c6c('0xf'),'include':[{'model':_0x0c6c('0xb'),'attributes':['id',_0x0c6c('0x3'),_0x0c6c('0x5'),_0x0c6c('0xc'),_0x0c6c('0xd')],'as':_0x0c6c('0xb')}]}]},'log':_0x0c6c('0x10')});};};exports['notify']=function(_0x1556e8,_0x5f4cd7){return client[_0x0c6c('0x1')](_0x0c6c('0x11'),{'account':{'id':_0x1556e8},'body':_0x5f4cd7,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x9147=['name','provider','service','active','key','ListId','TemplateId','MailServerIn','CloudProvider','MailServerOut','Smtp','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount'];(function(_0x342db7,_0x2f2fac){var _0x2742e1=function(_0x43c1b5){while(--_0x43c1b5){_0x342db7['push'](_0x342db7['shift']());}};_0x2742e1(++_0x2f2fac);}(_0x9147,0x81));var _0x7914=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x9147[_0x2a6809];return _0x11c371;};'use strict';var client=require(_0x7914('0x0'));exports[_0x7914('0x1')]=function(){return function(){return client[_0x7914('0x2')](_0x7914('0x3'),{'options':{'attributes':['id',_0x7914('0x4'),_0x7914('0x5'),_0x7914('0x6'),'email',_0x7914('0x7'),_0x7914('0x8'),_0x7914('0x9'),_0x7914('0xa')],'raw':![],'include':[{'model':_0x7914('0xb'),'as':'Imap','include':[{'model':_0x7914('0xc'),'attributes':['id','name',_0x7914('0x6'),'type','data5'],'as':_0x7914('0xc')}]},{'model':_0x7914('0xd'),'as':_0x7914('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x7914('0x4'),_0x7914('0x6'),'type',_0x7914('0xf')],'as':'CloudProvider'}]}]},'log':_0x7914('0x10')});};};exports[_0x7914('0x11')]=function(_0x1bd671,_0x417299){return client['Request']('NotifyMailAccount',{'account':{'id':_0x1bd671},'body':_0x417299,'log':_0x7914('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 9347b99..7fb6e96 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 _0x480e=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x198d5d,_0x4378ae){var _0x46ce61=function(_0x5f4c5e){while(--_0x5f4c5e){_0x198d5d['push'](_0x198d5d['shift']());}};_0x46ce61(++_0x4378ae);}(_0x480e,0xf3));var _0xe480=function(_0x2fefc4,_0x4a10fb){_0x2fefc4=_0x2fefc4-0x0;var _0x53e190=_0x480e[_0x2fefc4];return _0x53e190;};'use strict';var client=require(_0xe480('0x0'));exports[_0xe480('0x1')]=function(){return client[_0xe480('0x2')](_0xe480('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe480('0x4')]},'log':_0xe480('0x5')});}; \ No newline at end of file +var _0x50c5=['../client','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x39261b,_0x4c1f5a){var _0x3eae12=function(_0x19a2ec){while(--_0x19a2ec){_0x39261b['push'](_0x39261b['shift']());}};_0x3eae12(++_0x4c1f5a);}(_0x50c5,0x1c4));var _0x550c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50c5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x550c('0x0'));exports['getSettings']=function(){return client['Request'](_0x550c('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x550c('0x2')]},'log':_0x550c('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 6f9cda9..d7feb64 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 f855aba..b886dd5 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 _0x19e2=['../../config/socketio','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','port','socket.io','redis','defaults','adapter','socket.io-redis','../../config/triggers','default'];(function(_0x1a61db,_0x3ad3af){var _0x5ac3bf=function(_0x2eca5b){while(--_0x2eca5b){_0x1a61db['push'](_0x1a61db['shift']());}};_0x5ac3bf(++_0x3ad3af);}(_0x19e2,0x196));var _0x219e=function(_0x3a7107,_0x608872){_0x3a7107=_0x3a7107-0x0;var _0x3e4aed=_0x19e2[_0x3a7107];return _0x3e4aed;};'use strict';var _=require(_0x219e('0x0'));var http=require(_0x219e('0x1'));var express=require('express');var sticky=require(_0x219e('0x2'));var Redis=require(_0x219e('0x3'));var config=require(_0x219e('0x4'));var app=express();var server=http[_0x219e('0x5')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x219e('0x6')])){var socketio=require(_0x219e('0x7'))(server,{'transports':['websocket','polling']});config[_0x219e('0x8')]=_[_0x219e('0x9')](config[_0x219e('0x8')],{'host':'localhost','port':0x18eb});socketio[_0x219e('0xa')](require(_0x219e('0xb'))({'pubClient':new Redis(config[_0x219e('0x8')]),'subClient':new Redis(config[_0x219e('0x8')])}));require(_0x219e('0xc'))[_0x219e('0xd')]();require(_0x219e('0xe'))[_0x219e('0xd')](socketio);require(_0x219e('0xf'))[_0x219e('0xd')](app);require(_0x219e('0x10'))[_0x219e('0xd')](app);}else{server[_0x219e('0x11')]('listening',function(){console[_0x219e('0x12')](_0x219e('0x13'),config[_0x219e('0x6')]);});}exports=module[_0x219e('0x14')]=app; \ No newline at end of file +var _0xd67d=['Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','express','sticky-session','ioredis','../../config/environment','createServer','port','socket.io','websocket','polling','defaults','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','log'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd67d,0x1e4));var _0xdd67=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xd67d[_0x5416db];return _0x243e35;};'use strict';var _=require(_0xdd67('0x0'));var http=require('http');var express=require(_0xdd67('0x1'));var sticky=require(_0xdd67('0x2'));var Redis=require(_0xdd67('0x3'));var config=require(_0xdd67('0x4'));var app=express();var server=http[_0xdd67('0x5')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0xdd67('0x6')])){var socketio=require(_0xdd67('0x7'))(server,{'transports':[_0xdd67('0x8'),_0xdd67('0x9')]});config['redis']=_[_0xdd67('0xa')](config[_0xdd67('0xb')],{'host':_0xdd67('0xc'),'port':0x18eb});socketio['adapter'](require(_0xdd67('0xd'))({'pubClient':new Redis(config[_0xdd67('0xb')]),'subClient':new Redis(config[_0xdd67('0xb')])}));require(_0xdd67('0xe'))[_0xdd67('0xf')]();require(_0xdd67('0x10'))['default'](socketio);require(_0xdd67('0x11'))[_0xdd67('0xf')](app);require('../../routes')[_0xdd67('0xf')](app);}else{server[_0xdd67('0x12')]('listening',function(){console[_0xdd67('0x13')](_0xdd67('0x14'),config[_0xdd67('0x6')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 3c1c6e5..2ff127a 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 _0x9fff=['../../config/logger','routing','http','Request','request','error','rpc','message','result','catch','exports','bluebird'];(function(_0x31403a,_0x3ea91b){var _0x4b2394=function(_0x4a8a84){while(--_0x4a8a84){_0x31403a['push'](_0x31403a['shift']());}};_0x4b2394(++_0x3ea91b);}(_0x9fff,0xbf));var _0xf9ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fff[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xf9ff('0x0'));var logger=require(_0xf9ff('0x1'))(_0xf9ff('0x2'));var client=jayson['client'][_0xf9ff('0x3')]({'port':0x2329});client[_0xf9ff('0x4')]=function(_0x115e21,_0x57700a){return new BPromise(function(_0x3a1193,_0x5e8e79){return client[_0xf9ff('0x5')](_0x115e21,_0x57700a)['then'](function(_0x126eec){logger['debug']('rpc',_0xf9ff('0x2'),_0x115e21,_0x57700a,_0x126eec);if(_0x126eec[_0xf9ff('0x6')]){logger[_0xf9ff('0x6')](_0xf9ff('0x7'),_0xf9ff('0x2'),_0x115e21,_0x126eec[_0xf9ff('0x6')]['message'],_0x57700a);return _0x5e8e79(_0x126eec['error'][_0xf9ff('0x8')]);}else{return _0x3a1193(_0x126eec[_0xf9ff('0x9')]);}})[_0xf9ff('0xa')](function(_0x53910c){logger[_0xf9ff('0x6')](_0xf9ff('0x7'),_0xf9ff('0x2'),_0x115e21,_0x53910c,_0x57700a);return _0x5e8e79(_0x53910c);});});};module[_0xf9ff('0xb')]=client; \ No newline at end of file +var _0xba88=['exports','jayson/promise','bluebird','../../config/logger','routing','Request','request','then','error','rpc','message','result','catch'];(function(_0x2ea44f,_0x1e5e99){var _0x347f86=function(_0x35c5b1){while(--_0x35c5b1){_0x2ea44f['push'](_0x2ea44f['shift']());}};_0x347f86(++_0x1e5e99);}(_0xba88,0x1ef));var _0x8ba8=function(_0x129154,_0x495bdf){_0x129154=_0x129154-0x0;var _0x3d081f=_0xba88[_0x129154];return _0x3d081f;};'use strict';var jayson=require(_0x8ba8('0x0'));var BPromise=require(_0x8ba8('0x1'));var logger=require(_0x8ba8('0x2'))(_0x8ba8('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x8ba8('0x4')]=function(_0x1b4bd7,_0x4b6222){return new BPromise(function(_0x3efba4,_0x16e064){return client[_0x8ba8('0x5')](_0x1b4bd7,_0x4b6222)[_0x8ba8('0x6')](function(_0x429745){logger['debug']('rpc',_0x8ba8('0x3'),_0x1b4bd7,_0x4b6222,_0x429745);if(_0x429745[_0x8ba8('0x7')]){logger['error'](_0x8ba8('0x8'),_0x8ba8('0x3'),_0x1b4bd7,_0x429745[_0x8ba8('0x7')][_0x8ba8('0x9')],_0x4b6222);return _0x16e064(_0x429745[_0x8ba8('0x7')][_0x8ba8('0x9')]);}else{return _0x3efba4(_0x429745[_0x8ba8('0xa')]);}})[_0x8ba8('0xb')](function(_0x1f52c5){logger[_0x8ba8('0x7')]('rpc','routing',_0x1b4bd7,_0x1f52c5,_0x4b6222);return _0x16e064(_0x1f52c5);});});};module[_0x8ba8('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 54651f8..9bbb65b 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 _0x0b4e=['listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents','initIntervals','getOpenchannelQueues','getChatQueues','getSmsQueues'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0x0b4e,0xad));var _0xe0b4=function(_0x37488f,_0x331f7d){_0x37488f=_0x37488f-0x0;var _0x362ed4=_0x0b4e[_0x37488f];return _0x362ed4;};'use strict';var BPromise=require(_0xe0b4('0x0'));var server=require(_0xe0b4('0x1'));var Realtime=require(_0xe0b4('0x2'));var user=require(_0xe0b4('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xe0b4('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xe0b4('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xe0b4('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xe0b4('0x7')]()[_0xe0b4('0x8')](user[_0xe0b4('0x9')]())['then'](realtime['initAgents']())[_0xe0b4('0x8')](interval['getIntervals']())[_0xe0b4('0x8')](realtime[_0xe0b4('0xa')]())['then'](openchannelQueue[_0xe0b4('0xb')]())[_0xe0b4('0x8')](realtime['initOpenchannelQueues']())[_0xe0b4('0x8')](chatQueue[_0xe0b4('0xc')]())[_0xe0b4('0x8')](realtime['initChatQueues']())['then'](smsQueue[_0xe0b4('0xd')]())[_0xe0b4('0x8')](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())[_0xe0b4('0x8')](realtime['initMailQueues']())[_0xe0b4('0x8')](faxQueue['getFaxQueues']())[_0xe0b4('0x8')](realtime['initFaxQueues']())[_0xe0b4('0x8')](whatsappQueue['getWhatsappQueues']())[_0xe0b4('0x8')](realtime['initWhatsappQueues']())[_0xe0b4('0x8')](function(){return realtime;});}function main(){return server[_0xe0b4('0xe')](realtime)['then'](function(_0xc59739){return initRealtime();})[_0xe0b4('0x8')](function(_0x3d1e20){return setInterval(initRealtime,0x1388);})[_0xe0b4('0xf')](function(_0x60a292){console[_0xe0b4('0x10')](_0x60a292);});}main(); \ No newline at end of file +var _0xab04=['getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents'];(function(_0x537fff,_0x4a9362){var _0x3c9874=function(_0x10b37d){while(--_0x10b37d){_0x537fff['push'](_0x537fff['shift']());}};_0x3c9874(++_0x4a9362);}(_0xab04,0xfd));var _0x4ab0=function(_0x466186,_0x2276fb){_0x466186=_0x466186-0x0;var _0x1ee9af=_0xab04[_0x466186];return _0x1ee9af;};'use strict';var BPromise=require(_0x4ab0('0x0'));var server=require(_0x4ab0('0x1'));var Realtime=require(_0x4ab0('0x2'));var user=require(_0x4ab0('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x4ab0('0x4'));var faxQueue=require(_0x4ab0('0x5'));var whatsappQueue=require(_0x4ab0('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x4ab0('0x7')]()[_0x4ab0('0x8')](user[_0x4ab0('0x9')]())['then'](realtime[_0x4ab0('0xa')]())[_0x4ab0('0x8')](interval['getIntervals']())[_0x4ab0('0x8')](realtime['initIntervals']())['then'](openchannelQueue[_0x4ab0('0xb')]())[_0x4ab0('0x8')](realtime[_0x4ab0('0xc')]())['then'](chatQueue[_0x4ab0('0xd')]())[_0x4ab0('0x8')](realtime['initChatQueues']())[_0x4ab0('0x8')](smsQueue['getSmsQueues']())[_0x4ab0('0x8')](realtime[_0x4ab0('0xe')]())['then'](mailQueue[_0x4ab0('0xf')]())[_0x4ab0('0x8')](realtime[_0x4ab0('0x10')]())[_0x4ab0('0x8')](faxQueue[_0x4ab0('0x11')]())['then'](realtime['initFaxQueues']())[_0x4ab0('0x8')](whatsappQueue['getWhatsappQueues']())[_0x4ab0('0x8')](realtime[_0x4ab0('0x12')]())[_0x4ab0('0x8')](function(){return realtime;});}function main(){return server[_0x4ab0('0x13')](realtime)[_0x4ab0('0x8')](function(_0x2cb5c7){return initRealtime();})[_0x4ab0('0x8')](function(_0x180d18){return setInterval(initRealtime,0x1388);})[_0x4ab0('0x14')](function(_0x509741){console[_0x4ab0('0x15')](_0x509741);});}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 73ecbe7..56b98e4 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(_0x5dfb47,_0x5b158c){var _0x48c85a=function(_0x5d9ccf){while(--_0x5d9ccf){_0x5dfb47['push'](_0x5dfb47['shift']());}};_0x48c85a(++_0x5b158c);}(_0x326f,0xd1));var _0xf326=function(_0x447cbb,_0x76acb9){_0x447cbb=_0x447cbb-0x0;var _0x7c13d1=_0x326f[_0x447cbb];return _0x7c13d1;};'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 _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(_0xc5c9ac,_0x57c492){var _0x3f4606=function(_0x2aa448){while(--_0x2aa448){_0xc5c9ac['push'](_0xc5c9ac['shift']());}};_0x3f4606(++_0x57c492);}(_0x326f,0xd1));var _0xf326=function(_0x4693a3,_0x5bcadb){_0x4693a3=_0x4693a3-0x0;var _0x4411dd=_0x326f[_0x4693a3];return _0x4411dd;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 5b12fb6..7905214 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 _0x62b9=['client','http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird'];(function(_0x4f87b3,_0x122253){var _0x54e077=function(_0x60c47c){while(--_0x60c47c){_0x4f87b3['push'](_0x4f87b3['shift']());}};_0x54e077(++_0x122253);}(_0x62b9,0xbd));var _0x962b=function(_0x2c9af5,_0x13660d){_0x2c9af5=_0x2c9af5-0x0;var _0x1c8bc4=_0x62b9[_0x2c9af5];return _0x1c8bc4;};'use strict';var BPromise=require(_0x962b('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x962b('0x1')][_0x962b('0x2')]({'port':0x232b});function request(_0x144b35,_0x2257d0){return new BPromise(function(_0x1313e3,_0xc7dfab){return client[_0x962b('0x3')](_0x144b35,_0x2257d0)[_0x962b('0x4')](function(_0x3d8cab){if(_0x3d8cab[_0x962b('0x5')]){return _0xc7dfab(_0x3d8cab[_0x962b('0x5')][_0x962b('0x6')]);}else{return _0x1313e3(_0x3d8cab['result']);}})[_0x962b('0x7')](function(_0x29dfed){return _0xc7dfab(_0x29dfed);});});}exports[_0x962b('0x8')]=function(_0xaaefd6,_0x4c07fc){return request(_0x962b('0x9'),{'account':_0xaaefd6,'message':_0x4c07fc});}; \ No newline at end of file +var _0x6339=['bluebird','jayson/promise','client','http','request','error','catch','sendMailMessage','SendMail'];(function(_0x5801af,_0x179e6d){var _0x3b1275=function(_0x55bd5f){while(--_0x55bd5f){_0x5801af['push'](_0x5801af['shift']());}};_0x3b1275(++_0x179e6d);}(_0x6339,0xa2));var _0x9633=function(_0x4a48ab,_0x1a4230){_0x4a48ab=_0x4a48ab-0x0;var _0x27268e=_0x6339[_0x4a48ab];return _0x27268e;};'use strict';var BPromise=require(_0x9633('0x0'));var jayson=require(_0x9633('0x1'));var client=jayson[_0x9633('0x2')][_0x9633('0x3')]({'port':0x232b});function request(_0x574ae9,_0x5bb300){return new BPromise(function(_0x2bef1f,_0x2542ce){return client[_0x9633('0x4')](_0x574ae9,_0x5bb300)['then'](function(_0x2acdfc){if(_0x2acdfc[_0x9633('0x5')]){return _0x2542ce(_0x2acdfc[_0x9633('0x5')]['message']);}else{return _0x2bef1f(_0x2acdfc['result']);}})[_0x9633('0x6')](function(_0x44c3b9){return _0x2542ce(_0x44c3b9);});});}exports[_0x9633('0x7')]=function(_0x292a17,_0x394260){return request(_0x9633('0x8'),{'account':_0x292a17,'message':_0x394260});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 6dbdc77..4614091 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 _0x0424=['whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','whatsapp','length','getChannelStatus','Status','toNumber','format','mailStatus','faxStatusTime','whatsappCurrentCapacity','busy','mailWaitingInteractions','stringify','user:routing:update','omit','exports','moment','ioredis','../../../config/environment','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions'];(function(_0x1a1395,_0x1d0b95){var _0xaf4e3c=function(_0x51d14a){while(--_0x51d14a){_0x1a1395['push'](_0x1a1395['shift']());}};_0xaf4e3c(++_0x1d0b95);}(_0x0424,0x159));var _0x4042=function(_0x5aaf93,_0x5c0001){_0x5aaf93=_0x5aaf93-0x0;var _0x17d307=_0x0424[_0x5aaf93];return _0x17d307;};'use strict';var _=require('lodash');var md5=require('md5');var moment=require(_0x4042('0x0'));var Redis=require(_0x4042('0x1'));var config=require(_0x4042('0x2'));config[_0x4042('0x3')]=_['defaults'](config[_0x4042('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4042('0x3')]));function Agent(_0x24fdfd){this['id']=_0x24fdfd['id']||0x0;this[_0x4042('0x4')]=_0x24fdfd[_0x4042('0x4')]||'';this[_0x4042('0x5')]=_0x24fdfd[_0x4042('0x5')]||!![];this[_0x4042('0x6')]=_0x24fdfd['voicePause']||![];this['chatPause']=_0x24fdfd[_0x4042('0x7')]||![];this[_0x4042('0x8')]=_0x24fdfd[_0x4042('0x8')]||![];this['faxPause']=_0x24fdfd[_0x4042('0x9')]||![];this[_0x4042('0xa')]=_0x24fdfd[_0x4042('0xa')]||![];this[_0x4042('0xb')]=_0x24fdfd[_0x4042('0xb')]||![];this[_0x4042('0xc')]=_0x4042('0xd');this[_0x4042('0xe')]=0x0;this['chatCapacity']=_0x24fdfd[_0x4042('0xf')]||0x0;this[_0x4042('0x10')]=0x0;this['mailStatus']=_0x4042('0xd');this[_0x4042('0x11')]=0x0;this[_0x4042('0x12')]=_0x24fdfd[_0x4042('0x12')]||0x0;this[_0x4042('0x13')]=0x0;this[_0x4042('0x14')]=_0x4042('0xd');this['faxStatusTime']=0x0;this[_0x4042('0x15')]=_0x24fdfd[_0x4042('0x15')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x4042('0x16')]=_0x4042('0xd');this[_0x4042('0x17')]=0x0;this[_0x4042('0x18')]=_0x24fdfd[_0x4042('0x18')]||0x0;this[_0x4042('0x19')]=0x0;this[_0x4042('0x1a')]=_0x4042('0xd');this[_0x4042('0x1b')]=0x0;this['whatsappCapacity']=_0x24fdfd[_0x4042('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x4042('0x1d')]='unknown';this[_0x4042('0x1e')]=0x0;this[_0x4042('0x1f')]=_0x24fdfd[_0x4042('0x1f')]||0x0;this[_0x4042('0x20')]=0x0;this['busy']=![];this[_0x4042('0x21')]=undefined;this[_0x4042('0x22')]='';this[_0x4042('0x23')]={};this[_0x4042('0x24')]={};this['mailWaitingInteractions']={};this[_0x4042('0x25')]={};this[_0x4042('0x26')]={};this[_0x4042('0x27')]={};this[_0x4042('0x28')]();}Agent[_0x4042('0x29')]['getChannelStatus']=function(_0x1f9d4a){if(this[_0x1f9d4a+_0x4042('0x2a')]>0x0){if(this[_0x1f9d4a+'Capacity']>0x0&&this[_0x1f9d4a+_0x4042('0x2a')]>=this[_0x1f9d4a+'Capacity']){return _0x4042('0x2b');}else{return _0x4042('0x2c');}}else{return _0x4042('0x2d');}};Agent['prototype'][_0x4042('0x28')]=function(){var _0x3b9e78=[_0x4042('0x2e'),_0x4042('0x2f'),_0x4042('0x30'),'fax','sms',_0x4042('0x31')];for(var _0x1acdf2=0x0;_0x1acdf2<_0x3b9e78[_0x4042('0x32')];_0x1acdf2+=0x1){var _0x3e5c02=this[_0x4042('0x33')](_0x3b9e78[_0x1acdf2]);if(this[_0x3b9e78[_0x1acdf2]+_0x4042('0x34')]!==_0x3e5c02){this[_0x3b9e78[_0x1acdf2]+'StatusTime']=_[_0x4042('0x35')](moment()[_0x4042('0x36')]('x'));}this[_0x3b9e78[_0x1acdf2]+'Status']=_0x3e5c02;}var _0xae26c2={'id':this['id'],'name':this[_0x4042('0x4')],'online':this[_0x4042('0x5')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x4042('0x8')],'smsPause':this[_0x4042('0xa')],'faxPause':this['faxPause'],'openchannelPause':this[_0x4042('0xb')],'chatStatus':this[_0x4042('0xc')],'chatStatusTime':this[_0x4042('0xe')],'chatCapacity':this[_0x4042('0xf')],'chatCurrentCapacity':this[_0x4042('0x10')],'mailStatus':this[_0x4042('0x37')],'mailStatusTime':this[_0x4042('0x11')],'mailCapacity':this[_0x4042('0x12')],'mailCurrentCapacity':this[_0x4042('0x13')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x4042('0x38')],'faxCapacity':this[_0x4042('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x4042('0x16')],'smsStatusTime':this[_0x4042('0x17')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x4042('0x19')],'whatsappStatus':this[_0x4042('0x1a')],'whatsappStatusTime':this[_0x4042('0x1b')],'whatsappCapacity':this[_0x4042('0x1c')],'whatsappCurrentCapacity':this[_0x4042('0x39')],'openchannelStatus':this[_0x4042('0x1d')],'openchannelStatusTime':this[_0x4042('0x1e')],'openchannelCapacity':this[_0x4042('0x1f')],'openchannelCurrentCapacity':this[_0x4042('0x20')],'busy':this[_0x4042('0x3a')],'busyQueue':this[_0x4042('0x21')],'chatWaitingInteractions':this[_0x4042('0x23')],'faxWaitingInteractions':this[_0x4042('0x24')],'mailWaitingInteractions':this[_0x4042('0x3b')],'openchannelWaitingInteractions':this[_0x4042('0x25')],'smsWaitingInteractions':this[_0x4042('0x26')],'whatsappWaitingInteractions':this[_0x4042('0x27')]};var _0x2a975c=md5(JSON[_0x4042('0x3c')](_0xae26c2));if(this[_0x4042('0x22')]!==_0x2a975c){this[_0x4042('0x22')]=_0x2a975c;io['emit'](_0x4042('0x3d'),_[_0x4042('0x3e')](_0xae26c2,[_0x4042('0x5')]));}};module[_0x4042('0x3f')]=Agent; \ No newline at end of file +var _0x6a55=['Capacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','chatStatusTime','smsStatus','openchannelCurrentCapacity','mailWaitingInteractions','openchannelWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','busy','busyQueue','md5','chatWaitingInteractions','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x6a55,0xdb));var _0x56a5=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0x6a55[_0x5ce8b9];return _0xe34be0;};'use strict';var _=require(_0x56a5('0x0'));var md5=require('md5');var moment=require('moment');var Redis=require('ioredis');var config=require(_0x56a5('0x1'));config['redis']=_['defaults'](config[_0x56a5('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x56a5('0x3'))(new Redis(config['redis']));function Agent(_0x28bb2b){this['id']=_0x28bb2b['id']||0x0;this[_0x56a5('0x4')]=_0x28bb2b[_0x56a5('0x4')]||'';this[_0x56a5('0x5')]=_0x28bb2b[_0x56a5('0x5')]||!![];this[_0x56a5('0x6')]=_0x28bb2b[_0x56a5('0x6')]||![];this[_0x56a5('0x7')]=_0x28bb2b['chatPause']||![];this[_0x56a5('0x8')]=_0x28bb2b[_0x56a5('0x8')]||![];this[_0x56a5('0x9')]=_0x28bb2b[_0x56a5('0x9')]||![];this[_0x56a5('0xa')]=_0x28bb2b[_0x56a5('0xa')]||![];this[_0x56a5('0xb')]=_0x28bb2b[_0x56a5('0xb')]||![];this[_0x56a5('0xc')]='unknown';this['chatStatusTime']=0x0;this[_0x56a5('0xd')]=_0x28bb2b[_0x56a5('0xd')]||0x0;this[_0x56a5('0xe')]=0x0;this[_0x56a5('0xf')]=_0x56a5('0x10');this[_0x56a5('0x11')]=0x0;this['mailCapacity']=_0x28bb2b['mailCapacity']||0x0;this[_0x56a5('0x12')]=0x0;this[_0x56a5('0x13')]=_0x56a5('0x10');this[_0x56a5('0x14')]=0x0;this[_0x56a5('0x15')]=_0x28bb2b[_0x56a5('0x15')]||0x0;this[_0x56a5('0x16')]=0x0;this['smsStatus']=_0x56a5('0x10');this['smsStatusTime']=0x0;this[_0x56a5('0x17')]=_0x28bb2b['smsCapacity']||0x0;this[_0x56a5('0x18')]=0x0;this[_0x56a5('0x19')]=_0x56a5('0x10');this[_0x56a5('0x1a')]=0x0;this[_0x56a5('0x1b')]=_0x28bb2b[_0x56a5('0x1b')]||0x0;this[_0x56a5('0x1c')]=0x0;this['openchannelStatus']=_0x56a5('0x10');this[_0x56a5('0x1d')]=0x0;this[_0x56a5('0x1e')]=_0x28bb2b[_0x56a5('0x1e')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x56a5('0x1f')]=![];this[_0x56a5('0x20')]=undefined;this[_0x56a5('0x21')]='';this[_0x56a5('0x22')]={};this[_0x56a5('0x23')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x56a5('0x24')]={};this[_0x56a5('0x25')]={};this['updateRealtime']();}Agent[_0x56a5('0x26')][_0x56a5('0x27')]=function(_0x615d49){if(this[_0x615d49+_0x56a5('0x28')]>0x0){if(this[_0x615d49+_0x56a5('0x29')]>0x0&&this[_0x615d49+_0x56a5('0x28')]>=this[_0x615d49+_0x56a5('0x29')]){return _0x56a5('0x2a');}else{return _0x56a5('0x2b');}}else{return _0x56a5('0x2c');}};Agent[_0x56a5('0x26')][_0x56a5('0x2d')]=function(){var _0x460bc2=['mail',_0x56a5('0x2e'),_0x56a5('0x2f'),_0x56a5('0x30'),_0x56a5('0x31'),_0x56a5('0x32')];for(var _0x527e84=0x0;_0x527e84<_0x460bc2[_0x56a5('0x33')];_0x527e84+=0x1){var _0x54ec36=this[_0x56a5('0x27')](_0x460bc2[_0x527e84]);if(this[_0x460bc2[_0x527e84]+_0x56a5('0x34')]!==_0x54ec36){this[_0x460bc2[_0x527e84]+_0x56a5('0x35')]=_[_0x56a5('0x36')](moment()['format']('x'));}this[_0x460bc2[_0x527e84]+_0x56a5('0x34')]=_0x54ec36;}var _0x1f7aeb={'id':this['id'],'name':this[_0x56a5('0x4')],'online':this['online'],'voicePause':this[_0x56a5('0x6')],'chatPause':this[_0x56a5('0x7')],'mailPause':this[_0x56a5('0x8')],'smsPause':this[_0x56a5('0xa')],'faxPause':this[_0x56a5('0x9')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x56a5('0xc')],'chatStatusTime':this[_0x56a5('0x37')],'chatCapacity':this[_0x56a5('0xd')],'chatCurrentCapacity':this[_0x56a5('0xe')],'mailStatus':this[_0x56a5('0xf')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x56a5('0x12')],'faxStatus':this[_0x56a5('0x13')],'faxStatusTime':this[_0x56a5('0x14')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x56a5('0x16')],'smsStatus':this[_0x56a5('0x38')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x56a5('0x1a')],'whatsappCapacity':this[_0x56a5('0x1b')],'whatsappCurrentCapacity':this[_0x56a5('0x1c')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x56a5('0x1d')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x56a5('0x39')],'busy':this[_0x56a5('0x1f')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x56a5('0x22')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x56a5('0x3a')],'openchannelWaitingInteractions':this[_0x56a5('0x3b')],'smsWaitingInteractions':this[_0x56a5('0x24')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x20d1cc=md5(JSON[_0x56a5('0x3c')](_0x1f7aeb));if(this[_0x56a5('0x21')]!==_0x20d1cc){this['md5']=_0x20d1cc;io[_0x56a5('0x3d')](_0x56a5('0x3e'),_[_0x56a5('0x3f')](_0x1f7aeb,[_0x56a5('0x5')]));}};module[_0x56a5('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 6a7a48a..2668014 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 _0x382c=['util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','md5','format','chat:queue:%s','emit','chat_queue:save','lodash'];(function(_0x435f0b,_0x493a54){var _0x50b0be=function(_0x55ae13){while(--_0x55ae13){_0x435f0b['push'](_0x435f0b['shift']());}};_0x50b0be(++_0x493a54);}(_0x382c,0x1c1));var _0xc382=function(_0x48564d,_0x2c1c8c){_0x48564d=_0x48564d-0x0;var _0x2ad779=_0x382c[_0x48564d];return _0x2ad779;};'use strict';var _=require(_0xc382('0x0'));var md5=require('md5');var util=require(_0xc382('0x1'));var Redis=require('ioredis');var config=require(_0xc382('0x2'));config[_0xc382('0x3')]=_[_0xc382('0x4')](config[_0xc382('0x3')],{'host':_0xc382('0x5'),'port':0x18eb});var io=require(_0xc382('0x6'))(new Redis(config['redis']));function ChatQueue(_0x3ff1c8){this['id']=_0x3ff1c8['id']||0x0;this[_0xc382('0x7')]=_0x3ff1c8[_0xc382('0x7')]||'';this['timeout']=_0x3ff1c8[_0xc382('0x8')]||0xa;this[_0xc382('0x9')]=_0x3ff1c8[_0xc382('0x9')]||'beepall';this[_0xc382('0xa')]=_0x3ff1c8[_0xc382('0xa')];this[_0xc382('0xb')]={};this[_0xc382('0xc')]=0x0;this['md5']='';this[_0xc382('0xd')]();this[_0xc382('0xe')]();}ChatQueue[_0xc382('0xf')]['updateRouting']=function(){var _0x221305=this[_0xc382('0xb')][_0xc382('0x10')];this[_0xc382('0xb')]=_[_0xc382('0x11')](this[_0xc382('0xa')],'id');this[_0xc382('0xb')][_0xc382('0x10')]=_0x221305;};ChatQueue[_0xc382('0xf')]['updateRealtime']=function(){this[_0xc382('0x12')]=0x0;this[_0xc382('0x13')]=0x0;for(var _0x1b2b5a=0x0;_0x1b2b5a=0x0?this['available']:0x0;var _0x45cbe5={'id':this['id'],'available':this[_0xc382('0x17')],'loggedIn':this[_0xc382('0x12')],'name':this[_0xc382('0x7')],'paused':this[_0xc382('0x13')],'waiting':this[_0xc382('0xc')]};var _0x4a1571=md5(JSON[_0xc382('0x18')](_0x45cbe5));if(this['md5']!==_0x4a1571){this[_0xc382('0x19')]=_0x4a1571;io['to'](util[_0xc382('0x1a')](_0xc382('0x1b'),_0x45cbe5[_0xc382('0x7')]))[_0xc382('0x1c')](_0xc382('0x1d'),_0x45cbe5);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xffcd=['beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','paused','length','online','loggedIn','chatPause','available','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x5c28bd,_0x215b20){var _0x225ea7=function(_0x33698c){while(--_0x33698c){_0x5c28bd['push'](_0x5c28bd['shift']());}};_0x225ea7(++_0x215b20);}(_0xffcd,0x87));var _0xdffc=function(_0x1dd9bb,_0x26cf32){_0x1dd9bb=_0x1dd9bb-0x0;var _0x2d5a1d=_0xffcd[_0x1dd9bb];return _0x2d5a1d;};'use strict';var _=require(_0xdffc('0x0'));var md5=require(_0xdffc('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xdffc('0x2'));config[_0xdffc('0x3')]=_[_0xdffc('0x4')](config[_0xdffc('0x3')],{'host':_0xdffc('0x5'),'port':0x18eb});var io=require(_0xdffc('0x6'))(new Redis(config['redis']));function ChatQueue(_0x121c95){this['id']=_0x121c95['id']||0x0;this[_0xdffc('0x7')]=_0x121c95[_0xdffc('0x7')]||'';this[_0xdffc('0x8')]=_0x121c95['timeout']||0xa;this[_0xdffc('0x9')]=_0x121c95[_0xdffc('0x9')]||_0xdffc('0xa');this['Agents']=_0x121c95[_0xdffc('0xb')];this['mapAgentsId']={};this[_0xdffc('0xc')]=0x0;this[_0xdffc('0x1')]='';this[_0xdffc('0xd')]();this['updateRealtime']();}ChatQueue[_0xdffc('0xe')][_0xdffc('0xd')]=function(){var _0x697c5b=this[_0xdffc('0xf')][_0xdffc('0x10')];this['mapAgentsId']=_[_0xdffc('0x11')](this[_0xdffc('0xb')],'id');this[_0xdffc('0xf')][_0xdffc('0x10')]=_0x697c5b;};ChatQueue[_0xdffc('0xe')][_0xdffc('0x12')]=function(){this['loggedIn']=0x0;this[_0xdffc('0x13')]=0x0;for(var _0x3b7d55=0x0;_0x3b7d55=0x0?this['available']:0x0;var _0x13a80c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xdffc('0x7')],'paused':this[_0xdffc('0x13')],'waiting':this['waiting']};var _0x2aac44=md5(JSON['stringify'](_0x13a80c));if(this['md5']!==_0x2aac44){this[_0xdffc('0x1')]=_0x2aac44;io['to'](util[_0xdffc('0x19')](_0xdffc('0x1a'),_0x13a80c[_0xdffc('0x7')]))[_0xdffc('0x1b')](_0xdffc('0x1c'),_0x13a80c);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 114a9bf..9075097 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 _0x0ed6=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','faxPause','available','format','fax:queue:%s','emit','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ed6,0x170));var _0x60ed=function(_0x25f8f2,_0x98731b){_0x25f8f2=_0x25f8f2-0x0;var _0xf9a07b=_0x0ed6[_0x25f8f2];return _0xf9a07b;};'use strict';var _=require(_0x60ed('0x0'));var md5=require(_0x60ed('0x1'));var util=require(_0x60ed('0x2'));var Redis=require(_0x60ed('0x3'));var config=require('../../../config/environment');config[_0x60ed('0x4')]=_[_0x60ed('0x5')](config[_0x60ed('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x60ed('0x6'))(new Redis(config[_0x60ed('0x4')]));function FaxQueue(_0x1a9687){this['id']=_0x1a9687['id']||0x0;this[_0x60ed('0x7')]=_0x1a9687[_0x60ed('0x7')]||'';this['timeout']=_0x1a9687[_0x60ed('0x8')]||0xa;this['strategy']=_0x1a9687[_0x60ed('0x9')]||'beepall';this[_0x60ed('0xa')]=_0x1a9687[_0x60ed('0xa')];this[_0x60ed('0xb')]={};this[_0x60ed('0xc')]=0x0;this[_0x60ed('0x1')]='';this[_0x60ed('0xd')]();this[_0x60ed('0xe')]();}FaxQueue[_0x60ed('0xf')][_0x60ed('0xd')]=function(){var _0x293224=this['mapAgentsId'][_0x60ed('0x10')];this[_0x60ed('0xb')]=_['map'](this['Agents'],'id');this[_0x60ed('0xb')][_0x60ed('0x10')]=_0x293224;};FaxQueue[_0x60ed('0xf')][_0x60ed('0xe')]=function(){this[_0x60ed('0x11')]=0x0;this[_0x60ed('0x12')]=0x0;for(var _0x4e45ab=0x0;_0x4e45ab=0x0?this['available']:0x0;var _0x1d3f36={'id':this['id'],'available':this[_0x60ed('0x16')],'loggedIn':this[_0x60ed('0x11')],'name':this[_0x60ed('0x7')],'paused':this['paused'],'waiting':this[_0x60ed('0xc')]};var _0x1270b1=md5(JSON['stringify'](_0x1d3f36));if(this[_0x60ed('0x1')]!==_0x1270b1){this[_0x60ed('0x1')]=_0x1270b1;io['to'](util[_0x60ed('0x17')](_0x60ed('0x18'),_0x1d3f36[_0x60ed('0x7')]))[_0x60ed('0x19')]('fax_queue:save',_0x1d3f36);}};module[_0x60ed('0x1a')]=FaxQueue; \ No newline at end of file +var _0x01d6=['socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','available','stringify','format','emit','lodash','md5','util','../../../config/environment','defaults','redis'];(function(_0x382561,_0xff8eed){var _0x361b1f=function(_0x31a241){while(--_0x31a241){_0x382561['push'](_0x382561['shift']());}};_0x361b1f(++_0xff8eed);}(_0x01d6,0x1c6));var _0x601d=function(_0x5be60,_0x5d074e){_0x5be60=_0x5be60-0x0;var _0x549588=_0x01d6[_0x5be60];return _0x549588;};'use strict';var _=require(_0x601d('0x0'));var md5=require(_0x601d('0x1'));var util=require(_0x601d('0x2'));var Redis=require('ioredis');var config=require(_0x601d('0x3'));config['redis']=_[_0x601d('0x4')](config[_0x601d('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x601d('0x6'))(new Redis(config[_0x601d('0x5')]));function FaxQueue(_0x2ed817){this['id']=_0x2ed817['id']||0x0;this[_0x601d('0x7')]=_0x2ed817[_0x601d('0x7')]||'';this[_0x601d('0x8')]=_0x2ed817[_0x601d('0x8')]||0xa;this[_0x601d('0x9')]=_0x2ed817[_0x601d('0x9')]||_0x601d('0xa');this[_0x601d('0xb')]=_0x2ed817['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0x601d('0xc')]();this[_0x601d('0xd')]();}FaxQueue[_0x601d('0xe')][_0x601d('0xc')]=function(){var _0x100e0c=this[_0x601d('0xf')][_0x601d('0x10')];this[_0x601d('0xf')]=_['map'](this[_0x601d('0xb')],'id');this[_0x601d('0xf')][_0x601d('0x10')]=_0x100e0c;};FaxQueue[_0x601d('0xe')]['updateRealtime']=function(){this[_0x601d('0x11')]=0x0;this[_0x601d('0x12')]=0x0;for(var _0x5a7c6d=0x0;_0x5a7c6d=0x0?this[_0x601d('0x13')]:0x0;var _0x367d38={'id':this['id'],'available':this[_0x601d('0x13')],'loggedIn':this[_0x601d('0x11')],'name':this['name'],'paused':this[_0x601d('0x12')],'waiting':this['waiting']};var _0x4b278d=md5(JSON[_0x601d('0x14')](_0x367d38));if(this[_0x601d('0x1')]!==_0x4b278d){this['md5']=_0x4b278d;io['to'](util[_0x601d('0x15')]('fax:queue:%s',_0x367d38['name']))[_0x601d('0x16')]('fax_queue:save',_0x367d38);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b29841f..8d12d4c 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 _0x993c=['Intervals','exports','name'];(function(_0x1dd119,_0x17b9f0){var _0x4887ce=function(_0xf86dd6){while(--_0xf86dd6){_0x1dd119['push'](_0x1dd119['shift']());}};_0x4887ce(++_0x17b9f0);}(_0x993c,0x1d0));var _0xc993=function(_0xe74804,_0x1829d1){_0xe74804=_0xe74804-0x0;var _0x2d486e=_0x993c[_0xe74804];return _0x2d486e;};'use strict';function Interval(_0x52c783){this['id']=_0x52c783['id']||0x0;this[_0xc993('0x0')]=_0x52c783[_0xc993('0x0')]||'';this[_0xc993('0x1')]=_0x52c783[_0xc993('0x1')]||{};}module[_0xc993('0x2')]=Interval; \ No newline at end of file +var _0x2010=['Intervals','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2010,0xe9));var _0x0201=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2010[_0x14add3];return _0x4a174f;};'use strict';function Interval(_0x65cc59){this['id']=_0x65cc59['id']||0x0;this[_0x0201('0x0')]=_0x65cc59[_0x0201('0x0')]||'';this[_0x0201('0x1')]=_0x65cc59['Intervals']||{};}module[_0x0201('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 5af889e..ff9b724 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 _0xfef0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','online','paused','available','name','stringify','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall'];(function(_0x46f976,_0x543461){var _0x2332bb=function(_0x34d009){while(--_0x34d009){_0x46f976['push'](_0x46f976['shift']());}};_0x2332bb(++_0x543461);}(_0xfef0,0xb9));var _0x0fef=function(_0x4378d1,_0x27a200){_0x4378d1=_0x4378d1-0x0;var _0x5cd2e6=_0xfef0[_0x4378d1];return _0x5cd2e6;};'use strict';var _=require(_0x0fef('0x0'));var md5=require(_0x0fef('0x1'));var util=require(_0x0fef('0x2'));var Redis=require(_0x0fef('0x3'));var config=require(_0x0fef('0x4'));config[_0x0fef('0x5')]=_[_0x0fef('0x6')](config[_0x0fef('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0fef('0x7'))(new Redis(config['redis']));function MailQueue(_0x279bcc){this['id']=_0x279bcc['id']||0x0;this['name']=_0x279bcc['name']||'';this[_0x0fef('0x8')]=_0x279bcc[_0x0fef('0x8')]||0xa;this[_0x0fef('0x9')]=_0x279bcc[_0x0fef('0x9')]||_0x0fef('0xa');this[_0x0fef('0xb')]=_0x279bcc[_0x0fef('0xb')];this[_0x0fef('0xc')]={};this[_0x0fef('0xd')]=0x0;this[_0x0fef('0x1')]='';this[_0x0fef('0xe')]();this[_0x0fef('0xf')]();}MailQueue[_0x0fef('0x10')]['updateRouting']=function(){var _0x138bdf=this[_0x0fef('0xc')][_0x0fef('0x11')];this[_0x0fef('0xc')]=_[_0x0fef('0x12')](this[_0x0fef('0xb')],'id');this[_0x0fef('0xc')]['_rr']=_0x138bdf;};MailQueue[_0x0fef('0x10')]['updateRealtime']=function(){this[_0x0fef('0x13')]=0x0;this['paused']=0x0;for(var _0x37c05c=0x0;_0x37c05c=0x0?this[_0x0fef('0x16')]:0x0;var _0x13e823={'id':this['id'],'available':this[_0x0fef('0x16')],'loggedIn':this[_0x0fef('0x13')],'name':this[_0x0fef('0x17')],'paused':this[_0x0fef('0x15')],'waiting':this[_0x0fef('0xd')]};var _0x44bfae=md5(JSON[_0x0fef('0x18')](_0x13e823));if(this['md5']!==_0x44bfae){this[_0x0fef('0x1')]=_0x44bfae;io['to'](util['format'](_0x0fef('0x19'),_0x13e823[_0x0fef('0x17')]))[_0x0fef('0x1a')]('mail_queue:save',_0x13e823);}};module[_0x0fef('0x1b')]=MailQueue; \ No newline at end of file +var _0x4762=['beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','loggedIn','length','paused','available','stringify','format','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x2962b4,_0x4b0786){var _0x411b7d=function(_0x363aad){while(--_0x363aad){_0x2962b4['push'](_0x2962b4['shift']());}};_0x411b7d(++_0x4b0786);}(_0x4762,0x153));var _0x2476=function(_0x16efa0,_0x24c20e){_0x16efa0=_0x16efa0-0x0;var _0x4885b8=_0x4762[_0x16efa0];return _0x4885b8;};'use strict';var _=require(_0x2476('0x0'));var md5=require(_0x2476('0x1'));var util=require(_0x2476('0x2'));var Redis=require(_0x2476('0x3'));var config=require(_0x2476('0x4'));config[_0x2476('0x5')]=_[_0x2476('0x6')](config[_0x2476('0x5')],{'host':_0x2476('0x7'),'port':0x18eb});var io=require(_0x2476('0x8'))(new Redis(config['redis']));function MailQueue(_0x28f6a7){this['id']=_0x28f6a7['id']||0x0;this[_0x2476('0x9')]=_0x28f6a7[_0x2476('0x9')]||'';this[_0x2476('0xa')]=_0x28f6a7[_0x2476('0xa')]||0xa;this[_0x2476('0xb')]=_0x28f6a7[_0x2476('0xb')]||_0x2476('0xc');this['Agents']=_0x28f6a7[_0x2476('0xd')];this['mapAgentsId']={};this[_0x2476('0xe')]=0x0;this[_0x2476('0x1')]='';this[_0x2476('0xf')]();this['updateRealtime']();}MailQueue[_0x2476('0x10')]['updateRouting']=function(){var _0x44e836=this[_0x2476('0x11')][_0x2476('0x12')];this['mapAgentsId']=_['map'](this[_0x2476('0xd')],'id');this['mapAgentsId'][_0x2476('0x12')]=_0x44e836;};MailQueue[_0x2476('0x10')]['updateRealtime']=function(){this[_0x2476('0x13')]=0x0;this['paused']=0x0;for(var _0x5288f3=0x0;_0x5288f3=0x0?this[_0x2476('0x16')]:0x0;var _0x37ce76={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2476('0x13')],'name':this[_0x2476('0x9')],'paused':this['paused'],'waiting':this[_0x2476('0xe')]};var _0x30ce5a=md5(JSON[_0x2476('0x17')](_0x37ce76));if(this[_0x2476('0x1')]!==_0x30ce5a){this[_0x2476('0x1')]=_0x30ce5a;io['to'](util[_0x2476('0x18')]('mail:queue:%s',_0x37ce76[_0x2476('0x9')]))[_0x2476('0x19')]('mail_queue:save',_0x37ce76);}};module[_0x2476('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index efd542c..829e692 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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x1c413e,_0x51788b){var _0x1d8309=function(_0x335195){while(--_0x335195){_0x1c413e['push'](_0x1c413e['shift']());}};_0x1d8309(++_0x51788b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x5fc3[_0x2459fd];return _0x364cd2;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0x2ef3,0xba));var _0x32ef=function(_0x3849c6,_0x1fecc6){_0x3849c6=_0x3849c6-0x0;var _0xaa66c3=_0x2ef3[_0x3849c6];return _0xaa66c3;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b77f94d..2fb1aee 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 _0x8a55=['updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x126122,_0x24457f){var _0x295ed4=function(_0x2d351d){while(--_0x2d351d){_0x126122['push'](_0x126122['shift']());}};_0x295ed4(++_0x24457f);}(_0x8a55,0x185));var _0x58a5=function(_0x1d8fb3,_0x19eaa4){_0x1d8fb3=_0x1d8fb3-0x0;var _0x2a3c07=_0x8a55[_0x1d8fb3];return _0x2a3c07;};'use strict';var _=require(_0x58a5('0x0'));var md5=require(_0x58a5('0x1'));var util=require(_0x58a5('0x2'));var Redis=require(_0x58a5('0x3'));var config=require(_0x58a5('0x4'));config[_0x58a5('0x5')]=_[_0x58a5('0x6')](config[_0x58a5('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x58a5('0x7'))(new Redis(config[_0x58a5('0x5')]));function SmsQueue(_0x4e2752){this['id']=_0x4e2752['id']||0x0;this[_0x58a5('0x8')]=_0x4e2752[_0x58a5('0x8')]||'';this[_0x58a5('0x9')]=_0x4e2752[_0x58a5('0x9')]||0xa;this[_0x58a5('0xa')]=_0x4e2752[_0x58a5('0xa')]||'beepall';this[_0x58a5('0xb')]=_0x4e2752[_0x58a5('0xb')];this[_0x58a5('0xc')]={};this[_0x58a5('0xd')]=0x0;this[_0x58a5('0x1')]='';this[_0x58a5('0xe')]();this[_0x58a5('0xf')]();}SmsQueue[_0x58a5('0x10')][_0x58a5('0xe')]=function(){var _0x2f6bd9=this[_0x58a5('0xc')][_0x58a5('0x11')];this[_0x58a5('0xc')]=_[_0x58a5('0x12')](this['Agents'],'id');this[_0x58a5('0xc')][_0x58a5('0x11')]=_0x2f6bd9;};SmsQueue[_0x58a5('0x10')][_0x58a5('0xf')]=function(){this[_0x58a5('0x13')]=0x0;this['paused']=0x0;for(var _0x504295=0x0;_0x504295=0x0?this[_0x58a5('0x18')]:0x0;var _0x59c170={'id':this['id'],'available':this['available'],'loggedIn':this[_0x58a5('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x12abb2=md5(JSON[_0x58a5('0x19')](_0x59c170));if(this['md5']!==_0x12abb2){this[_0x58a5('0x1')]=_0x12abb2;io['to'](util[_0x58a5('0x1a')](_0x58a5('0x1b'),_0x59c170['name']))[_0x58a5('0x1c')](_0x58a5('0x1d'),_0x59c170);}};module[_0x58a5('0x1e')]=SmsQueue; \ No newline at end of file +var _0xb903=['updateRealtime','online','loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','prototype','updateRouting','mapAgentsId','_rr','map'];(function(_0x94ac,_0xff3945){var _0x3731ca=function(_0x4710f6){while(--_0x4710f6){_0x94ac['push'](_0x94ac['shift']());}};_0x3731ca(++_0xff3945);}(_0xb903,0x185));var _0x3b90=function(_0x3b608e,_0x283174){_0x3b608e=_0x3b608e-0x0;var _0x357d52=_0xb903[_0x3b608e];return _0x357d52;};'use strict';var _=require(_0x3b90('0x0'));var md5=require(_0x3b90('0x1'));var util=require(_0x3b90('0x2'));var Redis=require(_0x3b90('0x3'));var config=require('../../../config/environment');config[_0x3b90('0x4')]=_[_0x3b90('0x5')](config[_0x3b90('0x4')],{'host':_0x3b90('0x6'),'port':0x18eb});var io=require(_0x3b90('0x7'))(new Redis(config[_0x3b90('0x4')]));function SmsQueue(_0x948896){this['id']=_0x948896['id']||0x0;this['name']=_0x948896[_0x3b90('0x8')]||'';this['timeout']=_0x948896['timeout']||0xa;this[_0x3b90('0x9')]=_0x948896[_0x3b90('0x9')]||_0x3b90('0xa');this[_0x3b90('0xb')]=_0x948896['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0x3b90('0xc')][_0x3b90('0xd')]=function(){var _0x574955=this[_0x3b90('0xe')][_0x3b90('0xf')];this['mapAgentsId']=_[_0x3b90('0x10')](this[_0x3b90('0xb')],'id');this[_0x3b90('0xe')]['_rr']=_0x574955;};SmsQueue['prototype'][_0x3b90('0x11')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3a0a55=0x0;_0x3a0a55=0x0?this[_0x3b90('0x16')]:0x0;var _0x3cf281={'id':this['id'],'available':this[_0x3b90('0x16')],'loggedIn':this[_0x3b90('0x13')],'name':this['name'],'paused':this[_0x3b90('0x15')],'waiting':this['waiting']};var _0xd8d873=md5(JSON[_0x3b90('0x17')](_0x3cf281));if(this['md5']!==_0xd8d873){this[_0x3b90('0x1')]=_0xd8d873;io['to'](util[_0x3b90('0x18')](_0x3b90('0x19'),_0x3cf281[_0x3b90('0x8')]))[_0x3b90('0x1a')](_0x3b90('0x1b'),_0x3cf281);}};module[_0x3b90('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 79d6306..34208c4 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 _0x0bcc=['md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','available','waiting','emit','whatsapp_queue:save','exports','lodash'];(function(_0x7174af,_0x37d01e){var _0xe7c5af=function(_0xd7ccf8){while(--_0xd7ccf8){_0x7174af['push'](_0x7174af['shift']());}};_0xe7c5af(++_0x37d01e);}(_0x0bcc,0xfb));var _0xc0bc=function(_0xe61e71,_0x4ee5b5){_0xe61e71=_0xe61e71-0x0;var _0x1b2384=_0x0bcc[_0xe61e71];return _0x1b2384;};'use strict';var _=require(_0xc0bc('0x0'));var md5=require(_0xc0bc('0x1'));var util=require('util');var Redis=require(_0xc0bc('0x2'));var config=require(_0xc0bc('0x3'));config[_0xc0bc('0x4')]=_[_0xc0bc('0x5')](config['redis'],{'host':_0xc0bc('0x6'),'port':0x18eb});var io=require(_0xc0bc('0x7'))(new Redis(config[_0xc0bc('0x4')]));function WhatsappQueue(_0x370d82){this['id']=_0x370d82['id']||0x0;this[_0xc0bc('0x8')]=_0x370d82['name']||'';this[_0xc0bc('0x9')]=_0x370d82[_0xc0bc('0x9')]||0xa;this[_0xc0bc('0xa')]=_0x370d82[_0xc0bc('0xa')]||_0xc0bc('0xb');this[_0xc0bc('0xc')]=_0x370d82[_0xc0bc('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this[_0xc0bc('0xd')]();this[_0xc0bc('0xe')]();}WhatsappQueue[_0xc0bc('0xf')]['updateRouting']=function(){var _0x47e2e4=this[_0xc0bc('0x10')]['_rr'];this[_0xc0bc('0x10')]=_[_0xc0bc('0x11')](this[_0xc0bc('0xc')],'id');this[_0xc0bc('0x10')][_0xc0bc('0x12')]=_0x47e2e4;};WhatsappQueue[_0xc0bc('0xf')][_0xc0bc('0xe')]=function(){this[_0xc0bc('0x13')]=0x0;this[_0xc0bc('0x14')]=0x0;for(var _0x36e509=0x0;_0x36e509=0x0?this[_0xc0bc('0x17')]:0x0;var _0x3b3b9a={'id':this['id'],'available':this[_0xc0bc('0x17')],'loggedIn':this[_0xc0bc('0x13')],'name':this[_0xc0bc('0x8')],'paused':this[_0xc0bc('0x14')],'waiting':this[_0xc0bc('0x18')]};var _0x3940d9=md5(JSON['stringify'](_0x3b3b9a));if(this['md5']!==_0x3940d9){this['md5']=_0x3940d9;io['to'](util['format']('whatsapp:queue:%s',_0x3b3b9a[_0xc0bc('0x8')]))[_0xc0bc('0x19')](_0xc0bc('0x1a'),_0x3b3b9a);}};module[_0xc0bc('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xf3e0=['waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x17d9c8,_0x1155f1){var _0x17e482=function(_0x5f525f){while(--_0x5f525f){_0x17d9c8['push'](_0x17d9c8['shift']());}};_0x17e482(++_0x1155f1);}(_0xf3e0,0x120));var _0x0f3e=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xf3e0[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x0f3e('0x0'));var md5=require('md5');var util=require(_0x0f3e('0x1'));var Redis=require(_0x0f3e('0x2'));var config=require(_0x0f3e('0x3'));config[_0x0f3e('0x4')]=_['defaults'](config[_0x0f3e('0x4')],{'host':_0x0f3e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0f3e('0x4')]));function WhatsappQueue(_0x3edc06){this['id']=_0x3edc06['id']||0x0;this[_0x0f3e('0x6')]=_0x3edc06[_0x0f3e('0x6')]||'';this[_0x0f3e('0x7')]=_0x3edc06[_0x0f3e('0x7')]||0xa;this[_0x0f3e('0x8')]=_0x3edc06[_0x0f3e('0x8')]||_0x0f3e('0x9');this[_0x0f3e('0xa')]=_0x3edc06[_0x0f3e('0xa')];this[_0x0f3e('0xb')]={};this[_0x0f3e('0xc')]=0x0;this[_0x0f3e('0xd')]='';this[_0x0f3e('0xe')]();this[_0x0f3e('0xf')]();}WhatsappQueue[_0x0f3e('0x10')][_0x0f3e('0xe')]=function(){var _0x515274=this[_0x0f3e('0xb')][_0x0f3e('0x11')];this['mapAgentsId']=_[_0x0f3e('0x12')](this[_0x0f3e('0xa')],'id');this[_0x0f3e('0xb')][_0x0f3e('0x11')]=_0x515274;};WhatsappQueue[_0x0f3e('0x10')][_0x0f3e('0xf')]=function(){this[_0x0f3e('0x13')]=0x0;this[_0x0f3e('0x14')]=0x0;for(var _0x48a3cb=0x0;_0x48a3cb=0x0?this[_0x0f3e('0x18')]:0x0;var _0x3f8e5c={'id':this['id'],'available':this[_0x0f3e('0x18')],'loggedIn':this[_0x0f3e('0x13')],'name':this[_0x0f3e('0x6')],'paused':this[_0x0f3e('0x14')],'waiting':this[_0x0f3e('0xc')]};var _0x58ee59=md5(JSON[_0x0f3e('0x19')](_0x3f8e5c));if(this[_0x0f3e('0xd')]!==_0x58ee59){this[_0x0f3e('0xd')]=_0x58ee59;io['to'](util[_0x0f3e('0x1a')](_0x0f3e('0x1b'),_0x3f8e5c[_0x0f3e('0x6')]))[_0x0f3e('0x1c')](_0x0f3e('0x1d'),_0x3f8e5c);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8a34687..a217247 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 _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x7a76e6,_0x105d73){var _0x2e1190=function(_0x559849){while(--_0x559849){_0x7a76e6['push'](_0x7a76e6['shift']());}};_0x2e1190(++_0x105d73);}(_0xb10b,0x12a));var _0xbb10=function(_0x48b724,_0x5a8e26){_0x48b724=_0x48b724-0x0;var _0x4d38b3=_0xb10b[_0x48b724];return _0x4d38b3;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 07b2d82..a7d74f8 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 _0x1ab4=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1ab4,0x10e));var _0x41ab=function(_0x228ef2,_0x31f5ce){_0x228ef2=_0x228ef2-0x0;var _0x5ddce8=_0x1ab4[_0x228ef2];return _0x5ddce8;};'use strict';var client=require(_0x41ab('0x0'));exports['update']=function(_0x293ce3,_0x386ab9){return client[_0x41ab('0x1')](_0x41ab('0x2'),{'body':_0x386ab9,'options':{'where':{'id':_0x293ce3}},'log':_0x41ab('0x3')});};exports[_0x41ab('0x4')]=function(_0x1fea54,_0x3cb482){return client[_0x41ab('0x1')](_0x41ab('0x5'),{'body':_0x3cb482,'options':{'where':{'id':_0x1fea54}},'log':_0x41ab('0x6')});}; \ No newline at end of file +var _0xb7cf=['update','Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x423cdf,_0x29192b){var _0x41fdf8=function(_0x3ad954){while(--_0x3ad954){_0x423cdf['push'](_0x423cdf['shift']());}};_0x41fdf8(++_0x29192b);}(_0xb7cf,0xca));var _0xfb7c=function(_0x4eafcf,_0x458eb5){_0x4eafcf=_0x4eafcf-0x0;var _0x431945=_0xb7cf[_0x4eafcf];return _0x431945;};'use strict';var client=require(_0xfb7c('0x0'));exports[_0xfb7c('0x1')]=function(_0x3baed3,_0x2c52ed){return client[_0xfb7c('0x2')]('UpdateChatInteraction',{'body':_0x2c52ed,'options':{'where':{'id':_0x3baed3}},'log':_0xfb7c('0x3')});};exports[_0xfb7c('0x4')]=function(_0xf6b92f,_0xf47c1d){return client[_0xfb7c('0x2')](_0xfb7c('0x5'),{'body':_0xf47c1d,'options':{'where':{'id':_0xf6b92f}},'log':_0xfb7c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 107aa0c..f264b1e 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 _0x19ab=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x19ab,0xdc));var _0xb19a=function(_0x4a6d30,_0x38e102){_0x4a6d30=_0x4a6d30-0x0;var _0x4b2e99=_0x19ab[_0x4a6d30];return _0x4b2e99;};'use strict';var client=require(_0xb19a('0x0'));exports[_0xb19a('0x1')]=function(_0x1d8e38){return client[_0xb19a('0x2')](_0xb19a('0x3'),{'body':_0x1d8e38,'log':_0xb19a('0x4')});}; \ No newline at end of file +var _0x260a=['create','Request','CreateChatMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x260a,0xa3));var _0xa260=function(_0x4c1ae0,_0x4189e7){_0x4c1ae0=_0x4c1ae0-0x0;var _0x3ddda3=_0x260a[_0x4c1ae0];return _0x3ddda3;};'use strict';var client=require(_0xa260('0x0'));exports[_0xa260('0x1')]=function(_0x138d28){return client[_0xa260('0x2')](_0xa260('0x3'),{'body':_0x138d28,'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 3746eac..f938f67 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 _0x27c9=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','Agents','name','online'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x27c9,0x1af));var _0x927c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x27c9[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x927c('0x0'));exports[_0x927c('0x1')]=function(){return function(){return client[_0x927c('0x2')](_0x927c('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x927c('0x4'),_0x927c('0x5')],'include':[{'model':'User','as':_0x927c('0x6'),'attributes':['id',_0x927c('0x7'),_0x927c('0x8'),_0x927c('0x9')]}]},'log':_0x927c('0x1')});};}; \ No newline at end of file +var _0xd6d2=['../client','getChatQueues','GetChatQueue','name','strategy','Agents','online'];(function(_0x26b1d7,_0x314ed0){var _0x4a81fa=function(_0x56ee8e){while(--_0x56ee8e){_0x26b1d7['push'](_0x26b1d7['shift']());}};_0x4a81fa(++_0x314ed0);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x3a6ce9,_0xb984d9){_0x3a6ce9=_0x3a6ce9-0x0;var _0x56728e=_0xd6d2[_0x3a6ce9];return _0x56728e;};'use strict';var client=require(_0x2d6d('0x0'));exports[_0x2d6d('0x1')]=function(){return function(){return client['Request'](_0x2d6d('0x2'),{'options':{'raw':![],'attributes':['id',_0x2d6d('0x3'),'timeout',_0x2d6d('0x4')],'include':[{'model':'User','as':_0x2d6d('0x5'),'attributes':['id',_0x2d6d('0x3'),_0x2d6d('0x6'),'chatPause']}]},'log':_0x2d6d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index fb9c80f..54c62a5 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 _0x097c=['../client','create','CreateChatQueueReport','update','Request','DESC','UpdateChatQueueReport'];(function(_0x567ea0,_0x1175fc){var _0x58fbc1=function(_0x1b9353){while(--_0x1b9353){_0x567ea0['push'](_0x567ea0['shift']());}};_0x58fbc1(++_0x1175fc);}(_0x097c,0x1d5));var _0xc097=function(_0x43de5d,_0xf8bbc4){_0x43de5d=_0x43de5d-0x0;var _0x1366af=_0x097c[_0x43de5d];return _0x1366af;};'use strict';var client=require(_0xc097('0x0'));exports[_0xc097('0x1')]=function(_0x334a7c){return client['Request'](_0xc097('0x2'),{'body':_0x334a7c,'log':_0xc097('0x2')});};exports[_0xc097('0x3')]=function(_0x1b9efd,_0x5aa3c1){return client[_0xc097('0x4')]('UpdateChatQueueReport',{'body':_0x5aa3c1,'options':{'where':{'uniqueid':_0x1b9efd},'order':[['id',_0xc097('0x5')]],'limit':0x1},'log':_0xc097('0x6')});}; \ No newline at end of file +var _0x1bca=['UpdateChatQueueReport','DESC','create','CreateChatQueueReport','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1bca,0xb6));var _0xa1bc=function(_0x188dca,_0x232fe7){_0x188dca=_0x188dca-0x0;var _0x1fc41f=_0x1bca[_0x188dca];return _0x1fc41f;};'use strict';var client=require('../client');exports[_0xa1bc('0x0')]=function(_0x4a2571){return client['Request'](_0xa1bc('0x1'),{'body':_0x4a2571,'log':'CreateChatQueueReport'});};exports[_0xa1bc('0x2')]=function(_0x1fa3d2,_0x3469ad){return client['Request'](_0xa1bc('0x3'),{'body':_0x3469ad,'options':{'where':{'uniqueid':_0x1fa3d2},'order':[['id',_0xa1bc('0x4')]],'limit':0x1},'log':_0xa1bc('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 22ada1b..0ee9016 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x3f816c,_0x51ed7c){var _0x55f2dd=function(_0x1ff21a){while(--_0x1ff21a){_0x3f816c['push'](_0x3f816c['shift']());}};_0x55f2dd(++_0x51ed7c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x61b3ab,_0x1fc298){var _0x57097f=function(_0x25970b){while(--_0x25970b){_0x61b3ab['push'](_0x61b3ab['shift']());}};_0x57097f(++_0x1fc298);}(_0x7a54,0x106));var _0x47a5=function(_0x15bc22,_0x25f31a){_0x15bc22=_0x15bc22-0x0;var _0x81d44d=_0x7a54[_0x15bc22];return _0x81d44d;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 9c9dac8..2af63ca 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 _0xe272=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x215abb,_0x132c64){var _0x527d0a=function(_0x5bd8cf){while(--_0x5bd8cf){_0x215abb['push'](_0x215abb['shift']());}};_0x527d0a(++_0x132c64);}(_0xe272,0x9f));var _0x2e27=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xe272[_0x2763f2];return _0x3ef471;};'use strict';var client=require('../client');exports['create']=function(_0x27282c){return client[_0x2e27('0x0')](_0x2e27('0x1'),{'body':_0x27282c,'log':_0x2e27('0x2')});}; \ No newline at end of file +var _0x9a12=['CreateFaxMessage','Request'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x9a12,0x87));var _0x29a1=function(_0xe70fa2,_0x3df449){_0xe70fa2=_0xe70fa2-0x0;var _0x44c946=_0x9a12[_0xe70fa2];return _0x44c946;};'use strict';var client=require('../client');exports['create']=function(_0x3a77a6){return client[_0x29a1('0x0')](_0x29a1('0x1'),{'body':_0x3a77a6,'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 5781732..af4b15a 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 _0x9ebf=['strategy','User','Agents','faxPause','Request','GetFaxQueue','name'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x9ebf,0x185));var _0xf9eb=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9ebf[_0x4b055c];return _0x4b62bb;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0xf9eb('0x0')](_0xf9eb('0x1'),{'options':{'raw':![],'attributes':['id',_0xf9eb('0x2'),'timeout',_0xf9eb('0x3')],'include':[{'model':_0xf9eb('0x4'),'as':_0xf9eb('0x5'),'attributes':['id',_0xf9eb('0x2'),'online',_0xf9eb('0x6')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x0f96=['Agents','faxPause','../client','Request','name','strategy'];(function(_0x5564b9,_0x1797a6){var _0x28b7be=function(_0x348e39){while(--_0x348e39){_0x5564b9['push'](_0x5564b9['shift']());}};_0x28b7be(++_0x1797a6);}(_0x0f96,0x1b8));var _0x60f9=function(_0x385ccd,_0x1ff8da){_0x385ccd=_0x385ccd-0x0;var _0x4c7d2f=_0x0f96[_0x385ccd];return _0x4c7d2f;};'use strict';var client=require(_0x60f9('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x60f9('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x60f9('0x2'),'timeout',_0x60f9('0x3')],'include':[{'model':'User','as':_0x60f9('0x4'),'attributes':['id',_0x60f9('0x2'),'online',_0x60f9('0x5')]}]},'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 9c27f86..cf77169 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 _0xa690=['update','UpdateFaxQueueReport','DESC','create','Request','CreateFaxQueueReport'];(function(_0xd80868,_0x3e3f3b){var _0x2aaac0=function(_0x5ebd93){while(--_0x5ebd93){_0xd80868['push'](_0xd80868['shift']());}};_0x2aaac0(++_0x3e3f3b);}(_0xa690,0x8d));var _0x0a69=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0xa690[_0x3f8a03];return _0x147fb2;};'use strict';var client=require('../client');exports[_0x0a69('0x0')]=function(_0x3944f6){return client[_0x0a69('0x1')](_0x0a69('0x2'),{'body':_0x3944f6,'log':_0x0a69('0x2')});};exports[_0x0a69('0x3')]=function(_0x9e8769,_0x5f2460){return client[_0x0a69('0x1')](_0x0a69('0x4'),{'body':_0x5f2460,'options':{'where':{'uniqueid':_0x9e8769},'order':[['id',_0x0a69('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x3c94=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x3c94,0xcd));var _0x43c9=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x3c94[_0x28611e];return _0x530f69;};'use strict';var client=require(_0x43c9('0x0'));exports[_0x43c9('0x1')]=function(_0x3f7e06){return client[_0x43c9('0x2')](_0x43c9('0x3'),{'body':_0x3f7e06,'log':_0x43c9('0x3')});};exports[_0x43c9('0x4')]=function(_0x18159f,_0x170a0d){return client[_0x43c9('0x2')](_0x43c9('0x5'),{'body':_0x170a0d,'options':{'where':{'uniqueid':_0x18159f},'order':[['id',_0x43c9('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b4c9d08..d08b825 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 _0x63a9=['interval','getIntervals','../client','GetInterval','name','Interval','Intervals'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x63a9,0xb1));var _0x963a=function(_0x2a749a,_0x48e08b){_0x2a749a=_0x2a749a-0x0;var _0x5b8493=_0x63a9[_0x2a749a];return _0x5b8493;};'use strict';var client=require(_0x963a('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0x963a('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x963a('0x2')],'include':[{'model':_0x963a('0x3'),'as':_0x963a('0x4'),'attributes':['id',_0x963a('0x2'),_0x963a('0x5')]}]},'log':_0x963a('0x6')});};}; \ No newline at end of file +var _0xa8fa=['Interval','Intervals','name','interval','../client','getIntervals','Request'];(function(_0x5bb368,_0x27ceae){var _0x4e440a=function(_0x40f36c){while(--_0x40f36c){_0x5bb368['push'](_0x5bb368['shift']());}};_0x4e440a(++_0x27ceae);}(_0xa8fa,0xc8));var _0xaa8f=function(_0x589eed,_0x35c2a6){_0x589eed=_0x589eed-0x0;var _0x1f843a=_0xa8fa[_0x589eed];return _0x1f843a;};'use strict';var client=require(_0xaa8f('0x0'));exports[_0xaa8f('0x1')]=function(){return function(){return client[_0xaa8f('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xaa8f('0x3'),'as':_0xaa8f('0x4'),'attributes':['id',_0xaa8f('0x5'),_0xaa8f('0x6')]}]},'log':_0xaa8f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 74a1daa..b4e45c3 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 _0x4325=['update','Request','UpdateMailInteraction','addTagsToChatInteraction','../client'];(function(_0x39d82c,_0x551dc5){var _0x3e75b6=function(_0x1d012f){while(--_0x1d012f){_0x39d82c['push'](_0x39d82c['shift']());}};_0x3e75b6(++_0x551dc5);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5432('0x0'));exports[_0x5432('0x1')]=function(_0x5aa4b8,_0x3f491f){return client[_0x5432('0x2')](_0x5432('0x3'),{'body':_0x3f491f,'options':{'where':{'id':_0x5aa4b8}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x20f704,_0x36ce53){return client[_0x5432('0x2')]('AddTagsToMailInteraction',{'body':_0x36ce53,'options':{'where':{'id':_0x20f704}},'log':_0x5432('0x4')});}; \ No newline at end of file +var _0x0120=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x430e84,_0x50f35c){var _0xac534f=function(_0x8eafe){while(--_0x8eafe){_0x430e84['push'](_0x430e84['shift']());}};_0xac534f(++_0x50f35c);}(_0x0120,0x6f));var _0x0012=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0120[_0x432682];return _0x463d05;};'use strict';var client=require(_0x0012('0x0'));exports[_0x0012('0x1')]=function(_0x3d23e7,_0xb8d57c){return client[_0x0012('0x2')](_0x0012('0x3'),{'body':_0xb8d57c,'options':{'where':{'id':_0x3d23e7}},'log':_0x0012('0x4')});};exports[_0x0012('0x5')]=function(_0x357f77,_0x302029){return client[_0x0012('0x2')](_0x0012('0x6'),{'body':_0x302029,'options':{'where':{'id':_0x357f77}},'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 09121bb..11a06f1 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 _0x6873=['Request'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x6873,0xef));var _0x3687=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x6873[_0x121886];return _0x20ca01;};'use strict';var client=require('../client');exports['create']=function(_0x502636){return client[_0x3687('0x0')]('CreateMailMessage',{'body':_0x502636,'log':'createMailMessage'});}; \ No newline at end of file +var _0xb7ed=['Request','CreateMailMessage','../client','create'];(function(_0x76feef,_0x44a071){var _0x1e42ea=function(_0x52b0e0){while(--_0x52b0e0){_0x76feef['push'](_0x76feef['shift']());}};_0x1e42ea(++_0x44a071);}(_0xb7ed,0x1b6));var _0xdb7e=function(_0x5a69b5,_0x167340){_0x5a69b5=_0x5a69b5-0x0;var _0x33a7fe=_0xb7ed[_0x5a69b5];return _0x33a7fe;};'use strict';var client=require(_0xdb7e('0x0'));exports[_0xdb7e('0x1')]=function(_0xeb590a){return client[_0xdb7e('0x2')](_0xdb7e('0x3'),{'body':_0xeb590a,'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 ff3a4ed..eec8153 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 _0x4f68=['User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x4f68,0x190));var _0x84f6=function(_0x4dab2c,_0x216b1a){_0x4dab2c=_0x4dab2c-0x0;var _0x16b020=_0x4f68[_0x4dab2c];return _0x16b020;};'use strict';var client=require(_0x84f6('0x0'));exports[_0x84f6('0x1')]=function(){return function(){return client[_0x84f6('0x2')](_0x84f6('0x3'),{'options':{'raw':![],'attributes':['id',_0x84f6('0x4'),_0x84f6('0x5'),_0x84f6('0x6')],'include':[{'model':_0x84f6('0x7'),'as':_0x84f6('0x8'),'attributes':['id','name',_0x84f6('0x9'),_0x84f6('0xa')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x214c=['../client','Request','GetMailQueue','timeout','Agents','name','online','mailPause','getMailQueues'];(function(_0x1e5324,_0x49e707){var _0x5ad32a=function(_0x4409e3){while(--_0x4409e3){_0x1e5324['push'](_0x1e5324['shift']());}};_0x5ad32a(++_0x49e707);}(_0x214c,0x1dd));var _0xc214=function(_0x4eefe6,_0x1202ce){_0x4eefe6=_0x4eefe6-0x0;var _0x22b387=_0x214c[_0x4eefe6];return _0x22b387;};'use strict';var client=require(_0xc214('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xc214('0x1')](_0xc214('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xc214('0x3'),'strategy'],'include':[{'model':'User','as':_0xc214('0x4'),'attributes':['id',_0xc214('0x5'),_0xc214('0x6'),_0xc214('0x7')]}]},'log':_0xc214('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index f419643..57948e5 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 _0x9b21=['UpdateMailQueueReport','create','CreateMailQueueReport','update'];(function(_0x4dccbe,_0x5a8cb6){var _0x27d26a=function(_0x4a7a2e){while(--_0x4a7a2e){_0x4dccbe['push'](_0x4dccbe['shift']());}};_0x27d26a(++_0x5a8cb6);}(_0x9b21,0x111));var _0x19b2=function(_0x133d45,_0x51c30b){_0x133d45=_0x133d45-0x0;var _0x52d08d=_0x9b21[_0x133d45];return _0x52d08d;};'use strict';var client=require('../client');exports[_0x19b2('0x0')]=function(_0x12731a){return client['Request'](_0x19b2('0x1'),{'body':_0x12731a,'log':_0x19b2('0x1')});};exports[_0x19b2('0x2')]=function(_0x56c232,_0x3712cd){return client['Request'](_0x19b2('0x3'),{'body':_0x3712cd,'options':{'where':{'uniqueid':_0x56c232},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x0362=['DESC','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x8f10f9,_0x44280b){var _0x32b6c1=function(_0x3d6f6a){while(--_0x3d6f6a){_0x8f10f9['push'](_0x8f10f9['shift']());}};_0x32b6c1(++_0x44280b);}(_0x0362,0x103));var _0x2036=function(_0x36e1a8,_0x1965d3){_0x36e1a8=_0x36e1a8-0x0;var _0x4e4b7f=_0x0362[_0x36e1a8];return _0x4e4b7f;};'use strict';var client=require('../client');exports[_0x2036('0x0')]=function(_0x5cc207){return client[_0x2036('0x1')](_0x2036('0x2'),{'body':_0x5cc207,'log':'CreateMailQueueReport'});};exports[_0x2036('0x3')]=function(_0x45952a,_0x17ef1b){return client[_0x2036('0x1')](_0x2036('0x4'),{'body':_0x17ef1b,'options':{'where':{'uniqueid':_0x45952a},'order':[['id',_0x2036('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7713efc..54b21c9 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 _0x1f51=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x2387c5,_0xfcc74c){var _0x2c414c=function(_0x3d1881){while(--_0x3d1881){_0x2387c5['push'](_0x2387c5['shift']());}};_0x2c414c(++_0xfcc74c);}(_0x1f51,0xc4));var _0x11f5=function(_0x53975b,_0x22d428){_0x53975b=_0x53975b-0x0;var _0x2557d0=_0x1f51[_0x53975b];return _0x2557d0;};'use strict';var client=require(_0x11f5('0x0'));exports[_0x11f5('0x1')]=function(_0xa8a75e,_0x504373){return client[_0x11f5('0x2')](_0x11f5('0x3'),{'body':_0x504373,'options':{'where':{'id':_0xa8a75e}},'log':_0x11f5('0x4')});};exports['addTags']=function(_0x50c109,_0x442a41){return client[_0x11f5('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x442a41,'options':{'where':{'id':_0x50c109}},'log':_0x11f5('0x5')});}; \ No newline at end of file +var _0x867d=['addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction','addTags'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x867d,0x181));var _0xd867=function(_0x16c57c,_0x183697){_0x16c57c=_0x16c57c-0x0;var _0x522881=_0x867d[_0x16c57c];return _0x522881;};'use strict';var client=require(_0xd867('0x0'));exports[_0xd867('0x1')]=function(_0x2ebbb9,_0x15bcc5){return client[_0xd867('0x2')]('UpdateOpenchannelInteraction',{'body':_0x15bcc5,'options':{'where':{'id':_0x2ebbb9}},'log':_0xd867('0x3')});};exports[_0xd867('0x4')]=function(_0x5a6459,_0x4a5c78){return client[_0xd867('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x4a5c78,'options':{'where':{'id':_0x5a6459}},'log':_0xd867('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f953e89..b720435 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 _0xfc56=['create','Request','CreateOpenchannelMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc56,0x147));var _0x6fc5=function(_0x95120,_0x160d8c){_0x95120=_0x95120-0x0;var _0x636cf2=_0xfc56[_0x95120];return _0x636cf2;};'use strict';var client=require(_0x6fc5('0x0'));exports[_0x6fc5('0x1')]=function(_0x3195e9){return client[_0x6fc5('0x2')](_0x6fc5('0x3'),{'body':_0x3195e9,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xf2d6=['create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x565739,_0x497fc4){var _0x3245b9=function(_0x2e227b){while(--_0x2e227b){_0x565739['push'](_0x565739['shift']());}};_0x3245b9(++_0x497fc4);}(_0xf2d6,0x1ef));var _0x6f2d=function(_0xb9e0c2,_0x22d879){_0xb9e0c2=_0xb9e0c2-0x0;var _0x3e3123=_0xf2d6[_0xb9e0c2];return _0x3e3123;};'use strict';var client=require('../client');exports[_0x6f2d('0x0')]=function(_0x2f17b4){return client['Request'](_0x6f2d('0x1'),{'body':_0x2f17b4,'log':_0x6f2d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2a6644f..afc9af8 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 _0x72f8=['GetOpenchannelQueue','name','timeout','strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x72f8,0xa7));var _0x872f=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x72f8[_0x62c958];return _0x57ec61;};'use strict';var client=require(_0x872f('0x0'));exports[_0x872f('0x1')]=function(){return function(){return client[_0x872f('0x2')](_0x872f('0x3'),{'options':{'raw':![],'attributes':['id',_0x872f('0x4'),_0x872f('0x5'),_0x872f('0x6')],'include':[{'model':'User','as':_0x872f('0x7'),'attributes':['id',_0x872f('0x4'),_0x872f('0x8'),_0x872f('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xeea4=['strategy','User','Agents','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x4d2d4c,_0x9d1720){var _0x245610=function(_0x22d874){while(--_0x22d874){_0x4d2d4c['push'](_0x4d2d4c['shift']());}};_0x245610(++_0x9d1720);}(_0xeea4,0x19e));var _0x4eea=function(_0x5058ad,_0x3915f0){_0x5058ad=_0x5058ad-0x0;var _0x9b01ea=_0xeea4[_0x5058ad];return _0x9b01ea;};'use strict';var client=require(_0x4eea('0x0'));exports[_0x4eea('0x1')]=function(){return function(){return client[_0x4eea('0x2')](_0x4eea('0x3'),{'options':{'raw':![],'attributes':['id',_0x4eea('0x4'),_0x4eea('0x5'),_0x4eea('0x6')],'include':[{'model':_0x4eea('0x7'),'as':_0x4eea('0x8'),'attributes':['id','name',_0x4eea('0x9'),'openchannelPause']}]},'log':_0x4eea('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3c56ab7..8f6830c 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 _0xd8cc=['update','Request','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport'];(function(_0x33b518,_0x1935ec){var _0x5c1d18=function(_0x50f19d){while(--_0x50f19d){_0x33b518['push'](_0x33b518['shift']());}};_0x5c1d18(++_0x1935ec);}(_0xd8cc,0xc9));var _0xcd8c=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xd8cc[_0x1203f];return _0x365f0a;};'use strict';var client=require(_0xcd8c('0x0'));exports[_0xcd8c('0x1')]=function(_0x5604da){return client['Request'](_0xcd8c('0x2'),{'body':_0x5604da,'log':_0xcd8c('0x2')});};exports[_0xcd8c('0x3')]=function(_0x3da473,_0x58d2c9){return client[_0xcd8c('0x4')](_0xcd8c('0x5'),{'body':_0x58d2c9,'options':{'where':{'uniqueid':_0x3da473},'order':[['id','DESC']],'limit':0x1},'log':_0xcd8c('0x5')});}; \ No newline at end of file +var _0x34e0=['UpdateOpenchannelQueueReport','create','CreateOpenchannelQueueReport'];(function(_0x8c21c0,_0x2d8b1d){var _0x17bb90=function(_0x203611){while(--_0x203611){_0x8c21c0['push'](_0x8c21c0['shift']());}};_0x17bb90(++_0x2d8b1d);}(_0x34e0,0xa0));var _0x034e=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x34e0[_0x1f9f37];return _0x21c080;};'use strict';var client=require('../client');exports[_0x034e('0x0')]=function(_0x9a6a62){return client['Request'](_0x034e('0x1'),{'body':_0x9a6a62,'log':_0x034e('0x1')});};exports['update']=function(_0x5220f3,_0x597527){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x597527,'options':{'where':{'uniqueid':_0x5220f3},'order':[['id','DESC']],'limit':0x1},'log':_0x034e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index c8b46c7..c74b6da 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 _0x2dd3=['AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x2dd3,0x6e));var _0x32dd=function(_0x38f2c2,_0x4a1c89){_0x38f2c2=_0x38f2c2-0x0;var _0xed6d35=_0x2dd3[_0x38f2c2];return _0xed6d35;};'use strict';var client=require('../client');exports[_0x32dd('0x0')]=function(_0x29bb49,_0x225c50){return client[_0x32dd('0x1')](_0x32dd('0x2'),{'body':_0x225c50,'options':{'where':{'id':_0x29bb49}},'log':_0x32dd('0x3')});};exports['addTags']=function(_0x36e50d,_0x144ee4){return client[_0x32dd('0x1')](_0x32dd('0x4'),{'body':_0x144ee4,'options':{'where':{'id':_0x36e50d}},'log':_0x32dd('0x5')});}; \ No newline at end of file +var _0xeb79=['Request','updateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x14765f,_0x5ef655){var _0xd4ff78=function(_0x2f7f06){while(--_0x2f7f06){_0x14765f['push'](_0x14765f['shift']());}};_0xd4ff78(++_0x5ef655);}(_0xeb79,0x87));var _0x9eb7=function(_0x3e2bb6,_0x58a491){_0x3e2bb6=_0x3e2bb6-0x0;var _0x4c56f7=_0xeb79[_0x3e2bb6];return _0x4c56f7;};'use strict';var client=require('../client');exports['update']=function(_0x21baca,_0x58e9b8){return client[_0x9eb7('0x0')]('UpdateSmsInteraction',{'body':_0x58e9b8,'options':{'where':{'id':_0x21baca}},'log':_0x9eb7('0x1')});};exports['addTags']=function(_0x3ee5c6,_0x2987e1){return client[_0x9eb7('0x0')](_0x9eb7('0x2'),{'body':_0x2987e1,'options':{'where':{'id':_0x3ee5c6}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 0bb1aeb..5d1e8bd 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 _0xa32e=['../client','Request','CreateSmsMessage','createSmsMessage'];(function(_0x58f678,_0x18b3cc){var _0x238aef=function(_0x339e5d){while(--_0x339e5d){_0x58f678['push'](_0x58f678['shift']());}};_0x238aef(++_0x18b3cc);}(_0xa32e,0x78));var _0xea32=function(_0x706091,_0x5e07d9){_0x706091=_0x706091-0x0;var _0x4aee6f=_0xa32e[_0x706091];return _0x4aee6f;};'use strict';var client=require(_0xea32('0x0'));exports['create']=function(_0x4f2180){return client[_0xea32('0x1')](_0xea32('0x2'),{'body':_0x4f2180,'log':_0xea32('0x3')});}; \ No newline at end of file +var _0xe70d=['../client','Request','CreateSmsMessage','createSmsMessage'];(function(_0xffa772,_0x28fc1e){var _0x139a9c=function(_0x17fdeb){while(--_0x17fdeb){_0xffa772['push'](_0xffa772['shift']());}};_0x139a9c(++_0x28fc1e);}(_0xe70d,0x1e8));var _0xde70=function(_0x36b60e,_0x2ce02d){_0x36b60e=_0x36b60e-0x0;var _0x442442=_0xe70d[_0x36b60e];return _0x442442;};'use strict';var client=require(_0xde70('0x0'));exports['create']=function(_0x31c61d){return client[_0xde70('0x1')](_0xde70('0x2'),{'body':_0x31c61d,'log':_0xde70('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 49fc6a7..53dfce3 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x1a19a7,_0x546fb4){var _0x2b7dc6=function(_0x15a62e){while(--_0x15a62e){_0x1a19a7['push'](_0x1a19a7['shift']());}};_0x2b7dc6(++_0x546fb4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x31e249,_0x6e9089){var _0x302a13=function(_0x4aa464){while(--_0x4aa464){_0x31e249['push'](_0x31e249['shift']());}};_0x302a13(++_0x6e9089);}(_0xb7e7,0x121));var _0x7b7e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb7e7[_0x31e29a];return _0x32d892;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'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 99f9d20..31eae0d 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0xae8fe3,_0x476328){var _0x3479d9=function(_0x3cd7ea){while(--_0x3cd7ea){_0xae8fe3['push'](_0xae8fe3['shift']());}};_0x3479d9(++_0x476328);}(_0x34e8,0x12c));var _0x834e=function(_0x9af8da,_0x2cd1ab){_0x9af8da=_0x9af8da-0x0;var _0x289830=_0x34e8[_0x9af8da];return _0x289830;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x34c8ff,_0x674110){var _0x42601c=function(_0x3e2ce5){while(--_0x3e2ce5){_0x34c8ff['push'](_0x34c8ff['shift']());}};_0x42601c(++_0x674110);}(_0x008c,0x188));var _0xc008=function(_0x37843a,_0xdfe28d){_0x37843a=_0x37843a-0x0;var _0x4e7142=_0x008c[_0x37843a];return _0x4e7142;};'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 843ce4a..36cf877 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(_0x44b631,_0x502569){var _0x1fa90d=function(_0x5d00a4){while(--_0x5d00a4){_0x44b631['push'](_0x44b631['shift']());}};_0x1fa90d(++_0x502569);}(_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(_0x3d24be,_0x445950){var _0x24d47d=function(_0x21453d){while(--_0x21453d){_0x3d24be['push'](_0x3d24be['shift']());}};_0x24d47d(++_0x445950);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('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 8c22534..589e248 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 _0x0960=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x510de5,_0x1ac5d6){var _0x48df9e=function(_0x51b4a9){while(--_0x51b4a9){_0x510de5['push'](_0x510de5['shift']());}};_0x48df9e(++_0x1ac5d6);}(_0x0960,0xc2));var _0x0096=function(_0x5e4bfc,_0x44dda5){_0x5e4bfc=_0x5e4bfc-0x0;var _0x4b8677=_0x0960[_0x5e4bfc];return _0x4b8677;};'use strict';var client=require(_0x0096('0x0'));exports[_0x0096('0x1')]=function(_0x49641f,_0x12b515){return client[_0x0096('0x2')](_0x0096('0x3'),{'body':_0x12b515,'options':{'where':{'id':_0x49641f}},'log':_0x0096('0x4')});};exports[_0x0096('0x5')]=function(_0xd0d4c6,_0x3ee9fb){return client[_0x0096('0x2')](_0x0096('0x6'),{'body':_0x3ee9fb,'options':{'where':{'id':_0xd0d4c6}},'log':_0x0096('0x7')});}; \ No newline at end of file +var _0x1751=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x430b22,_0x36200b){var _0x50d4e1=function(_0x59e236){while(--_0x59e236){_0x430b22['push'](_0x430b22['shift']());}};_0x50d4e1(++_0x36200b);}(_0x1751,0x76));var _0x1175=function(_0x2fb2f6,_0x3c582d){_0x2fb2f6=_0x2fb2f6-0x0;var _0x31054f=_0x1751[_0x2fb2f6];return _0x31054f;};'use strict';var client=require(_0x1175('0x0'));exports[_0x1175('0x1')]=function(_0x110a8c,_0x1da1a9){return client['Request'](_0x1175('0x2'),{'body':_0x1da1a9,'options':{'where':{'id':_0x110a8c}},'log':_0x1175('0x3')});};exports[_0x1175('0x4')]=function(_0x3d5dd9,_0x3087ab){return client[_0x1175('0x5')](_0x1175('0x6'),{'body':_0x3087ab,'options':{'where':{'id':_0x3d5dd9}},'log':_0x1175('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5713b35..a25671a 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 _0x1fa5=['create','Request','CreateWhatsappMessage','../client'];(function(_0x538395,_0x17eefa){var _0x2847c7=function(_0x3cf5be){while(--_0x3cf5be){_0x538395['push'](_0x538395['shift']());}};_0x2847c7(++_0x17eefa);}(_0x1fa5,0x83));var _0x51fa=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x1fa5[_0x424a9a];return _0xa7831c;};'use strict';var client=require(_0x51fa('0x0'));exports[_0x51fa('0x1')]=function(_0x1c63ec){return client[_0x51fa('0x2')](_0x51fa('0x3'),{'body':_0x1c63ec,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xc1fb=['createWhatsappMessage','../client','CreateWhatsappMessage'];(function(_0x5ce089,_0x49fdd3){var _0x20c63b=function(_0x523089){while(--_0x523089){_0x5ce089['push'](_0x5ce089['shift']());}};_0x20c63b(++_0x49fdd3);}(_0xc1fb,0xa6));var _0xbc1f=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xc1fb[_0x3df9dd];return _0x4f11e4;};'use strict';var client=require(_0xbc1f('0x0'));exports['create']=function(_0x50e13c){return client['Request'](_0xbc1f('0x1'),{'body':_0x50e13c,'log':_0xbc1f('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 545b26d..f354268 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 _0x3169=['Request','name','timeout','strategy','User','online','../client','getWhatsappQueues'];(function(_0x5ce02b,_0x21e156){var _0x1dd9de=function(_0x35901a){while(--_0x35901a){_0x5ce02b['push'](_0x5ce02b['shift']());}};_0x1dd9de(++_0x21e156);}(_0x3169,0x1d6));var _0x9316=function(_0x337d97,_0x19c381){_0x337d97=_0x337d97-0x0;var _0x53aa89=_0x3169[_0x337d97];return _0x53aa89;};'use strict';var client=require(_0x9316('0x0'));exports[_0x9316('0x1')]=function(){return function(){return client[_0x9316('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x9316('0x3'),_0x9316('0x4'),_0x9316('0x5')],'include':[{'model':_0x9316('0x6'),'as':'Agents','attributes':['id',_0x9316('0x3'),_0x9316('0x7'),'whatsappPause']}]},'log':_0x9316('0x1')});};}; \ No newline at end of file +var _0x601b=['Request','GetWhatsappQueue','strategy','User','name','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x509b34,_0x5ae59a){var _0x3a589e=function(_0xb6ffb6){while(--_0xb6ffb6){_0x509b34['push'](_0x509b34['shift']());}};_0x3a589e(++_0x5ae59a);}(_0x601b,0xdf));var _0xb601=function(_0x1fdf5b,_0x2e98f3){_0x1fdf5b=_0x1fdf5b-0x0;var _0x32889b=_0x601b[_0x1fdf5b];return _0x32889b;};'use strict';var client=require(_0xb601('0x0'));exports[_0xb601('0x1')]=function(){return function(){return client[_0xb601('0x2')](_0xb601('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xb601('0x4')],'include':[{'model':_0xb601('0x5'),'as':'Agents','attributes':['id',_0xb601('0x6'),_0xb601('0x7'),_0xb601('0x8')]}]},'log':_0xb601('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 6982caf..2027f28 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 _0xcdf8=['DESC','../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x304f7e,_0x3d64ef){var _0x56c5c6=function(_0x3fe8f3){while(--_0x3fe8f3){_0x304f7e['push'](_0x304f7e['shift']());}};_0x56c5c6(++_0x3d64ef);}(_0xcdf8,0xe8));var _0x8cdf=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xcdf8[_0x31cb5f];return _0x586042;};'use strict';var client=require(_0x8cdf('0x0'));exports[_0x8cdf('0x1')]=function(_0x5adbeb){return client[_0x8cdf('0x2')](_0x8cdf('0x3'),{'body':_0x5adbeb,'log':'CreateWhatsappQueueReport'});};exports[_0x8cdf('0x4')]=function(_0x20c439,_0x241e30){return client['Request'](_0x8cdf('0x5'),{'body':_0x241e30,'options':{'where':{'uniqueid':_0x20c439},'order':[['id',_0x8cdf('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x7e78=['Request','UpdateWhatsappQueueReport','../client','create','CreateWhatsappQueueReport','update'];(function(_0x47ba2f,_0x3ea976){var _0xc5c358=function(_0x93d82){while(--_0x93d82){_0x47ba2f['push'](_0x47ba2f['shift']());}};_0xc5c358(++_0x3ea976);}(_0x7e78,0xf2));var _0x87e7=function(_0x75d6ae,_0x3bc728){_0x75d6ae=_0x75d6ae-0x0;var _0x18f5b8=_0x7e78[_0x75d6ae];return _0x18f5b8;};'use strict';var client=require(_0x87e7('0x0'));exports[_0x87e7('0x1')]=function(_0x44f489){return client['Request']('CreateWhatsappQueueReport',{'body':_0x44f489,'log':_0x87e7('0x2')});};exports[_0x87e7('0x3')]=function(_0x1bf695,_0x301595){return client[_0x87e7('0x4')](_0x87e7('0x5'),{'body':_0x301595,'options':{'where':{'uniqueid':_0x1bf695},'order':[['id','DESC']],'limit':0x1},'log':_0x87e7('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 1b783a9..5ba259a 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 _0xdc63=['lodash','util','routing','./strategy','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','[%s][AGENT]\x20%s','map','message','join','stop','find','atimeout','channel','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','validate'];(function(_0x52ac48,_0x146d20){var _0x17b0f6=function(_0xfd2b28){while(--_0xfd2b28){_0x52ac48['push'](_0x52ac48['shift']());}};_0x17b0f6(++_0x146d20);}(_0xdc63,0x128));var _0x3dc6=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xdc63[_0x209941];return _0x1e8729;};'use strict';var schema=require(_0x3dc6('0x0'));var _=require(_0x3dc6('0x1'));var util=require(_0x3dc6('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x3dc6('0x3'));var strategy=require(_0x3dc6('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x3dc6('0x5')},'timeout':{'type':_0x3dc6('0x6'),'message':_0x3dc6('0x7')}});function writeLog(_0x27ff53,_0x569cca,_0x46edd5){return logger[_0x3dc6('0x8')](util[_0x3dc6('0x9')](_0x3dc6('0xa'),_0x27ff53,_0x569cca[_0x3dc6('0xb')],_0x46edd5));}function handleFindAgent(_0x54a8a5){return function(_0x1df89d){return _0x1df89d[_0x3dc6('0xb')]['toLowerCase']()===_0x54a8a5[_0x3dc6('0xc')]();};}exports[_0x3dc6('0xd')]=function(_0x48864a,_0xa30520,_0x402f7b,_0x28af4e){return function(_0x15a68a){try{var _0xe5209={'name':_0xa30520[0x0],'timeout':_0xa30520[0x1]};var _0x1a93ab=queue[_0x3dc6('0x0')](_0xe5209,{'typecast':!![]});if(_0x1a93ab[_0x3dc6('0xe')]){logger['error'](_0x3dc6('0xf'),_0x48864a,_[_0x3dc6('0x10')](_0x1a93ab,_0x3dc6('0x11'))[_0x3dc6('0x12')](',\x20'));_0x15a68a[_0x3dc6('0x13')]();}else{var _0x2ed8d3=_[_0x3dc6('0x14')](_0x402f7b['agents'],handleFindAgent(_0xe5209[_0x3dc6('0xb')]));if(_0x2ed8d3){var _0x12ac76=(_0xe5209['timeout']||0xa)*0x3e8;var _0x5cf90e,_0x22a6f2;var _0x5bb768=seqqueue['createQueue'](_0x12ac76);_0x5bb768['id']=_0x48864a;_0x5bb768[_0x3dc6('0x15')]=_0x12ac76;_0x5bb768[_0x3dc6('0x16')]=_0x28af4e[_0x3dc6('0x16')];writeLog(_0x48864a,_0x2ed8d3,util[_0x3dc6('0x9')]('START:%s',_0x12ac76));_0x402f7b[_0x3dc6('0x17')][_0x48864a]['on'](_0x3dc6('0x18'),function(){logger[_0x3dc6('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x48864a);clearTimeout(_0x22a6f2);_0x22a6f2=undefined;_0x5bb768[_0x3dc6('0x19')]();if(_0x402f7b[_0x3dc6('0x17')][_0x48864a]){delete _0x402f7b[_0x3dc6('0x17')][_0x48864a];}_0x15a68a[_0x3dc6('0x13')]();});_0x402f7b['rules'][_0x48864a]['on'](_0x3dc6('0x1a'),function(){if(_0x402f7b['rules'][_0x48864a]){delete _0x402f7b[_0x3dc6('0x17')][_0x48864a];}});_0x22a6f2=setTimeout(function(){logger[_0x3dc6('0x8')](_0x3dc6('0x1b'),_0x48864a);clearTimeout(_0x22a6f2);_0x5bb768[_0x3dc6('0x19')]();_0x15a68a[_0x3dc6('0x1c')]();},_0x12ac76);strategy[_0x3dc6('0x1d')](_0x5bb768,_0x2ed8d3,_0x402f7b,_0x28af4e);}else{logger[_0x3dc6('0x1e')](_0x3dc6('0x1f'),_0x48864a,_0xe5209[_0x3dc6('0xb')]);_0x15a68a[_0x3dc6('0x13')]();}}}catch(_0xc14404){console[_0x3dc6('0x20')](_0xc14404);logger['error']('[%s][QUEUE]\x20%s',_0x48864a,_0xc14404['stack']);_0x15a68a[_0x3dc6('0x13')]();}};}; \ No newline at end of file +var _0xa414=['[%s][AGENT]\x20%s','map','message','stop','find','name','timeout','createQueue','atimeout','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','length','error'];(function(_0x2f1026,_0x3d013d){var _0x2e0112=function(_0x561de9){while(--_0x561de9){_0x2f1026['push'](_0x2f1026['shift']());}};_0x2e0112(++_0x3d013d);}(_0xa414,0x1f0));var _0x4a41=function(_0x22e6f0,_0x33f4ef){_0x22e6f0=_0x22e6f0-0x0;var _0x2f6395=_0xa414[_0x22e6f0];return _0x2f6395;};'use strict';var schema=require(_0x4a41('0x0'));var _=require(_0x4a41('0x1'));var util=require(_0x4a41('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x4a41('0x3'))(_0x4a41('0x4'));var strategy=require(_0x4a41('0x5'));var queue=schema({'name':{'type':_0x4a41('0x6'),'required':!![],'message':_0x4a41('0x7')},'timeout':{'type':_0x4a41('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x40acc7,_0x223d13,_0x4eaa6a){return logger[_0x4a41('0x9')](util[_0x4a41('0xa')](_0x4a41('0xb'),_0x40acc7,_0x223d13['name'],_0x4eaa6a));}function handleFindAgent(_0x194296){return function(_0x3176d1){return _0x3176d1['name']['toLowerCase']()===_0x194296['toLowerCase']();};}exports['consequence']=function(_0x59725e,_0x4e68b3,_0x24c7d7,_0x20e9ac){return function(_0x33d0cb){try{var _0x3485d4={'name':_0x4e68b3[0x0],'timeout':_0x4e68b3[0x1]};var _0x4c3534=queue[_0x4a41('0x0')](_0x3485d4,{'typecast':!![]});if(_0x4c3534[_0x4a41('0xc')]){logger[_0x4a41('0xd')](_0x4a41('0xe'),_0x59725e,_[_0x4a41('0xf')](_0x4c3534,_0x4a41('0x10'))['join'](',\x20'));_0x33d0cb[_0x4a41('0x11')]();}else{var _0xd5b870=_[_0x4a41('0x12')](_0x24c7d7['agents'],handleFindAgent(_0x3485d4[_0x4a41('0x13')]));if(_0xd5b870){var _0x4e3247=(_0x3485d4[_0x4a41('0x14')]||0xa)*0x3e8;var _0x17c6a0,_0x1be7dc;var _0x21acb9=seqqueue[_0x4a41('0x15')](_0x4e3247);_0x21acb9['id']=_0x59725e;_0x21acb9[_0x4a41('0x16')]=_0x4e3247;_0x21acb9[_0x4a41('0x17')]=_0x20e9ac[_0x4a41('0x17')];writeLog(_0x59725e,_0xd5b870,util[_0x4a41('0xa')]('START:%s',_0x4e3247));_0x24c7d7[_0x4a41('0x18')][_0x59725e]['on']('end',function(){logger['info'](_0x4a41('0x19'),_0x59725e);clearTimeout(_0x1be7dc);_0x1be7dc=undefined;_0x21acb9[_0x4a41('0x1a')]();if(_0x24c7d7[_0x4a41('0x18')][_0x59725e]){delete _0x24c7d7[_0x4a41('0x18')][_0x59725e];}_0x33d0cb[_0x4a41('0x11')]();});_0x24c7d7[_0x4a41('0x18')][_0x59725e]['on'](_0x4a41('0x1b'),function(){if(_0x24c7d7[_0x4a41('0x18')][_0x59725e]){delete _0x24c7d7[_0x4a41('0x18')][_0x59725e];}});_0x1be7dc=setTimeout(function(){logger[_0x4a41('0x9')](_0x4a41('0x1c'),_0x59725e);clearTimeout(_0x1be7dc);_0x21acb9[_0x4a41('0x1a')]();_0x33d0cb[_0x4a41('0x1d')]();},_0x4e3247);strategy[_0x4a41('0x1e')](_0x21acb9,_0xd5b870,_0x24c7d7,_0x20e9ac);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x59725e,_0x3485d4[_0x4a41('0x13')]);_0x33d0cb[_0x4a41('0x11')]();}}}catch(_0x34089a){console[_0x4a41('0x1f')](_0x34089a);logger['error'](_0x4a41('0x20'),_0x59725e,_0x34089a[_0x4a41('0x21')]);_0x33d0cb[_0x4a41('0x11')]();}};}; \ 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 11b2345..1f9299e 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 _0xf69d=['channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','Message','create','then','body','catch','error','stringify','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','providerName','amazonlex','providerResponse','dialogState','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out'];(function(_0xa7101a,_0x4c9af7){var _0x4bb64f=function(_0x56e343){while(--_0x56e343){_0xa7101a['push'](_0xa7101a['shift']());}};_0x4bb64f(++_0x4c9af7);}(_0xf69d,0x12f));var _0xdf69=function(_0x281875,_0x2c993e){_0x281875=_0x281875-0x0;var _0x35ac96=_0xf69d[_0x281875];return _0x35ac96;};'use strict';var _=require(_0xdf69('0x0'));var moment=require(_0xdf69('0x1'));var AWS=require(_0xdf69('0x2'));var utils=require('./utils');var logger=require(_0xdf69('0x3'))(_0xdf69('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xdf69('0x5')),'smsMessage':require(_0xdf69('0x6')),'faxMessage':require(_0xdf69('0x7')),'whatsappMessage':require(_0xdf69('0x8'))};exports['consequence']=function(_0x5be1e0,_0x7b2dba){return function(_0x2ff0ea){try{if(!_[_0xdf69('0x9')](this[_0xdf69('0xa')][_0xdf69('0xb')])){logger[_0xdf69('0xc')](_0xdf69('0xd'),_0x5be1e0,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2ff0ea[_0xdf69('0xe')]();}var _0x1c5dbd={'ContactId':this[_0xdf69('0xf')]['id'],'sentAt':moment()[_0xdf69('0x10')](_0xdf69('0x11')),'direction':_0xdf69('0x12')};if(this[_0xdf69('0x13')]===_0xdf69('0x14')||this['channel']===_0xdf69('0x15')){_0x1c5dbd['phone']=this[_0xdf69('0xa')][_0xdf69('0x16')];}var _0x34de07=this[_0xdf69('0x13')];if(_0x34de07===_0xdf69('0x17')){_0x1c5dbd[_0xdf69('0x18')]=this['account']['id'];}else{_0x1c5dbd[_[_0xdf69('0x19')](_0x34de07)+_0xdf69('0x1a')]=this[_0xdf69('0x1b')]['id'];}_0x1c5dbd[_[_0xdf69('0x19')](_0x34de07)+'InteractionId']=this[_0xdf69('0xa')]['id'];if(this[_0xdf69('0xa')][_0xdf69('0x1c')]){var _0x24e2b4=_0x7b2dba[0x4];if(!_[_0xdf69('0x1d')](_0x24e2b4)){_0x1c5dbd['body']=utils['getMustacheRender'](_0x24e2b4,this);return rpc[_0x34de07+_0xdf69('0x1e')][_0xdf69('0x1f')](_0x1c5dbd)[_0xdf69('0x20')](function(_0x19b537){logger[_0xdf69('0xc')](_0xdf69('0xd'),_0x5be1e0,_0x1c5dbd[_0xdf69('0x21')]);})[_0xdf69('0x22')](function(_0x1929e2){logger[_0xdf69('0x23')](_0xdf69('0xd'),_0x5be1e0,JSON[_0xdf69('0x24')](_0x1929e2));})['finally'](function(){logger[_0xdf69('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5be1e0);_0x2ff0ea[_0xdf69('0x25')]();});}else{logger[_0xdf69('0xc')](_0xdf69('0x26'),_0x5be1e0);_0x2ff0ea[_0xdf69('0x25')]();}}else{var _0x1cd431=this;var _0x7855a6=new AWS['LexRuntime']({'accessKeyId':_0x7b2dba[0x0],'secretAccessKey':_0x7b2dba[0x1],'region':_0x7b2dba[0x2]});var _0x3b3923={'botAlias':_0xdf69('0x27'),'botName':_0x7b2dba[0x3],'inputText':this[_0xdf69('0x28')]['body'],'userId':this[_0xdf69('0x13')]+':'+this[_0xdf69('0xa')]['id'][_0xdf69('0x29')]()};_0x7855a6['postText'](_0x3b3923,function(_0x58512a,_0x57aa1f){if(_0x58512a){logger[_0xdf69('0x23')](_0xdf69('0xd'),_0x5be1e0,_0x58512a['message']);_0x2ff0ea[_0xdf69('0xe')]();}else if(_0x57aa1f&&_0x57aa1f[_0xdf69('0x28')]){_0x1cd431['body']['amazonlex']=_0x57aa1f;_0x1c5dbd[_0xdf69('0x21')]=_0x57aa1f[_0xdf69('0x28')];_0x1c5dbd[_0xdf69('0x2a')]=_0xdf69('0x2b');_0x1c5dbd[_0xdf69('0x2c')]=JSON[_0xdf69('0x24')](_0x57aa1f);return rpc[_0x34de07+_0xdf69('0x1e')]['create'](_0x1c5dbd)['then'](function(_0x3161a9){logger[_0xdf69('0xc')](_0xdf69('0xd'),_0x5be1e0,_0x1c5dbd[_0xdf69('0x21')]);if(_0x57aa1f[_0xdf69('0x2d')]=='Failed'){_0x2ff0ea[_0xdf69('0xe')]();}else{_0x2ff0ea[_0xdf69('0x25')]();}})[_0xdf69('0x22')](function(_0x7e4bfd){logger[_0xdf69('0x23')](_0xdf69('0xd'),_0x5be1e0,JSON[_0xdf69('0x24')](_0x7e4bfd));_0x2ff0ea[_0xdf69('0xe')]();});}else{_0x2ff0ea[_0xdf69('0xe')]();}});}}catch(_0x3827bc){logger[_0xdf69('0x23')](_0xdf69('0xd'),_0x5be1e0,JSON[_0xdf69('0x24')](_0x3827bc));_0x2ff0ea[_0xdf69('0x25')]();}};}; \ No newline at end of file +var _0x6c9e=['aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','amazonlex','providerName','providerResponse','stringify','dialogState','lodash','moment'];(function(_0x474dde,_0x4e3094){var _0x2260d7=function(_0x3dc63f){while(--_0x3dc63f){_0x474dde['push'](_0x474dde['shift']());}};_0x2260d7(++_0x4e3094);}(_0x6c9e,0x196));var _0xe6c9=function(_0x4dc9f3,_0x51e995){_0x4dc9f3=_0x4dc9f3-0x0;var _0xb97e22=_0x6c9e[_0x4dc9f3];return _0xb97e22;};'use strict';var _=require(_0xe6c9('0x0'));var moment=require(_0xe6c9('0x1'));var AWS=require(_0xe6c9('0x2'));var utils=require(_0xe6c9('0x3'));var logger=require(_0xe6c9('0x4'))(_0xe6c9('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe6c9('0x6')),'mailMessage':require(_0xe6c9('0x7')),'smsMessage':require(_0xe6c9('0x8')),'faxMessage':require(_0xe6c9('0x9')),'whatsappMessage':require(_0xe6c9('0xa'))};exports[_0xe6c9('0xb')]=function(_0x53d090,_0x234247){return function(_0x1e7f05){try{if(!_['isNil'](this[_0xe6c9('0xc')][_0xe6c9('0xd')])){logger[_0xe6c9('0xe')](_0xe6c9('0xf'),_0x53d090,_0xe6c9('0x10'));return _0x1e7f05[_0xe6c9('0x11')]();}var _0x1589e6={'ContactId':this[_0xe6c9('0x12')]['id'],'sentAt':moment()[_0xe6c9('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe6c9('0x14')};if(this[_0xe6c9('0x15')]==='sms'||this['channel']===_0xe6c9('0x16')){_0x1589e6[_0xe6c9('0x17')]=this[_0xe6c9('0xc')][_0xe6c9('0x17')];}var _0x10bb5d=this['channel'];if(_0x10bb5d===_0xe6c9('0x18')){_0x1589e6[_0xe6c9('0x19')]=this[_0xe6c9('0x1a')]['id'];}else{_0x1589e6[_['upperFirst'](_0x10bb5d)+'AccountId']=this[_0xe6c9('0x1a')]['id'];}_0x1589e6[_[_0xe6c9('0x1b')](_0x10bb5d)+_0xe6c9('0x1c')]=this['interaction']['id'];if(this['interaction'][_0xe6c9('0x1d')]){var _0x5bf397=_0x234247[0x4];if(!_[_0xe6c9('0x1e')](_0x5bf397)){_0x1589e6[_0xe6c9('0x1f')]=utils[_0xe6c9('0x20')](_0x5bf397,this);return rpc[_0x10bb5d+_0xe6c9('0x21')][_0xe6c9('0x22')](_0x1589e6)[_0xe6c9('0x23')](function(_0x30fde4){logger[_0xe6c9('0xe')]('[%s][AMAZONLEX]\x20%s',_0x53d090,_0x1589e6['body']);})[_0xe6c9('0x24')](function(_0x563b8a){logger[_0xe6c9('0x25')](_0xe6c9('0xf'),_0x53d090,JSON['stringify'](_0x563b8a));})[_0xe6c9('0x26')](function(){logger[_0xe6c9('0xe')](_0xe6c9('0x27'),_0x53d090);_0x1e7f05[_0xe6c9('0x28')]();});}else{logger['info'](_0xe6c9('0x29'),_0x53d090);_0x1e7f05[_0xe6c9('0x28')]();}}else{var _0x199dd6=this;var _0x56e8f3=new AWS[(_0xe6c9('0x2a'))]({'accessKeyId':_0x234247[0x0],'secretAccessKey':_0x234247[0x1],'region':_0x234247[0x2]});var _0x5e3e0b={'botAlias':_0xe6c9('0x2b'),'botName':_0x234247[0x3],'inputText':this[_0xe6c9('0x2c')][_0xe6c9('0x1f')],'userId':this[_0xe6c9('0x15')]+':'+this[_0xe6c9('0xc')]['id'][_0xe6c9('0x2d')]()};_0x56e8f3['postText'](_0x5e3e0b,function(_0x553a75,_0x34bb28){if(_0x553a75){logger['error']('[%s][AMAZONLEX]\x20%s',_0x53d090,_0x553a75['message']);_0x1e7f05[_0xe6c9('0x11')]();}else if(_0x34bb28&&_0x34bb28[_0xe6c9('0x2c')]){_0x199dd6[_0xe6c9('0x1f')][_0xe6c9('0x2e')]=_0x34bb28;_0x1589e6['body']=_0x34bb28[_0xe6c9('0x2c')];_0x1589e6[_0xe6c9('0x2f')]='amazonlex';_0x1589e6[_0xe6c9('0x30')]=JSON[_0xe6c9('0x31')](_0x34bb28);return rpc[_0x10bb5d+'Message'][_0xe6c9('0x22')](_0x1589e6)['then'](function(_0x4b098c){logger['info'](_0xe6c9('0xf'),_0x53d090,_0x1589e6[_0xe6c9('0x1f')]);if(_0x34bb28[_0xe6c9('0x32')]=='Failed'){_0x1e7f05[_0xe6c9('0x11')]();}else{_0x1e7f05[_0xe6c9('0x28')]();}})[_0xe6c9('0x24')](function(_0x39e31d){logger[_0xe6c9('0x25')](_0xe6c9('0xf'),_0x53d090,JSON['stringify'](_0x39e31d));_0x1e7f05['next']();});}else{_0x1e7f05[_0xe6c9('0x11')]();}});}}catch(_0x5e0786){logger[_0xe6c9('0x25')]('[%s][AMAZONLEX]\x20%s',_0x53d090,JSON[_0xe6c9('0x31')](_0x5e0786));_0x1e7f05[_0xe6c9('0x28')]();}};}; \ 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 1264802..35154e9 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 _0xda41=['Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','AccountId','upperFirst','InteractionId','Message','messageId','','','headers','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','next','finally','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','channel','body','[%s][AUTOREPLY]\x20%s'];(function(_0x4bd2d7,_0x57364b){var _0x586f08=function(_0x559dde){while(--_0x559dde){_0x4bd2d7['push'](_0x4bd2d7['shift']());}};_0x586f08(++_0x57364b);}(_0xda41,0xb5));var _0x1da4=function(_0x330042,_0x39ae3f){_0x330042=_0x330042-0x0;var _0x35ca84=_0xda41[_0x330042];return _0x35ca84;};'use strict';var _=require('lodash');var moment=require(_0x1da4('0x0'));var utils=require(_0x1da4('0x1'));var logger=require(_0x1da4('0x2'))(_0x1da4('0x3'));var rpc={'chatMessage':require(_0x1da4('0x4')),'openchannelMessage':require(_0x1da4('0x5')),'mailMessage':require(_0x1da4('0x6')),'smsMessage':require(_0x1da4('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x1da4('0x8')),'openchannelInteraction':require(_0x1da4('0x9')),'mailInteraction':require(_0x1da4('0xa')),'smsInteraction':require(_0x1da4('0xb')),'faxInteraction':require(_0x1da4('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0x1da4('0xd')]=function(_0x2c13b8,_0x52cf0b,_0x2c4a06,_0x315b86){return function(_0x39ef95){try{var _0x52391=this[_0x1da4('0xe')];if(_0x52391==='mail'&&_0x315b86[_0x1da4('0xf')]['isAutoreply']){logger['info'](_0x1da4('0x10'),_0x2c13b8,_0x1da4('0x11'));return _0x39ef95['next']();}if(_0x52cf0b[0x0]==='1'&&(_[_0x1da4('0x12')](this[_0x1da4('0x13')][_0x1da4('0x14')])||!this[_0x1da4('0x13')]['created'])){logger[_0x1da4('0x15')](_0x1da4('0x10'),_0x2c13b8,_0x1da4('0x16'));return _0x39ef95['next']();}if(_0x52cf0b[0x0]==='2'&&this[_0x1da4('0x13')][_0x1da4('0x17')]){logger[_0x1da4('0x15')](_0x1da4('0x18'),_0x2c13b8,_0x1da4('0x19'));return _0x39ef95['next']();}var _0x20d18f={'ContactId':this[_0x1da4('0x1a')]['id'],'sentAt':moment()[_0x1da4('0x1b')](_0x1da4('0x1c')),'direction':_0x1da4('0x1d')};if(this[_0x1da4('0xe')]===_0x1da4('0x1e')){_0x20d18f['body']=utils['getMustacheRender'](_0x52cf0b[0x2],this);}else{_0x20d18f[_0x1da4('0xf')]=utils[_0x1da4('0x1f')](_0x52cf0b[0x1],this);}if(this[_0x1da4('0x20')]){_0x20d18f['to']=this[_0x1da4('0x20')]['from']||'';if(this[_0x1da4('0xe')]===_0x1da4('0x1e')&&_0x52cf0b[0x1]==='1'){_0x20d18f['cc']=this[_0x1da4('0x20')]['cc']||'';}_0x20d18f[_0x1da4('0x21')]=this['message']['to']||'';_0x20d18f['phone']=this[_0x1da4('0x20')][_0x1da4('0x22')]||'';_0x20d18f[_0x1da4('0x23')]=!![];if(this['message'][_0x1da4('0x24')]){_0x20d18f[_0x1da4('0x24')]='';_0x20d18f['subject']+=_[_0x1da4('0x25')](this[_0x1da4('0x20')][_0x1da4('0x24')],_0x1da4('0x26'))?'':_0x1da4('0x27');_0x20d18f['subject']+=this[_0x1da4('0x20')][_0x1da4('0x24')];}}if(this['channel']===_0x1da4('0x28')){_0x20d18f['ChatWebsiteId']=this[_0x1da4('0x29')]['id'];}else{_0x20d18f[_['upperFirst'](this['channel'])+_0x1da4('0x2a')]=this['account']['id'];}_0x20d18f[_[_0x1da4('0x2b')](this[_0x1da4('0xe')])+_0x1da4('0x2c')]=this[_0x1da4('0x13')]['id'];var _0x53f449=this['interaction'];if(rpc[this[_0x1da4('0xe')]+_0x1da4('0x2d')]){if(this[_0x1da4('0xe')]===_0x1da4('0x1e')){_0x20d18f['inReplyTo']=this['message'][_0x1da4('0x2e')];_0x20d18f['html']=_0x1da4('0x2f')+_['replace'](_0x20d18f[_0x1da4('0xf')],'','replace','','headers','auto-replied','All'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xb15d,0x98));var _0xdb15=function(_0x4a33e0,_0x2c420d){_0x4a33e0=_0x4a33e0-0x0;var _0x49a915=_0xb15d[_0x4a33e0];return _0x49a915;};'use strict';var _=require(_0xdb15('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xdb15('0x1'))(_0xdb15('0x2'));var rpc={'chatMessage':require(_0xdb15('0x3')),'openchannelMessage':require(_0xdb15('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xdb15('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xdb15('0x6')),'chatInteraction':require(_0xdb15('0x7')),'openchannelInteraction':require(_0xdb15('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xdb15('0x9'));exports[_0xdb15('0xa')]=function(_0xf12c94,_0x63e57f,_0x321646,_0x182941){return function(_0x58ac43){try{var _0x46775e=this[_0xdb15('0xb')];if(_0x46775e==='mail'&&_0x182941[_0xdb15('0xc')][_0xdb15('0xd')]){logger[_0xdb15('0xe')](_0xdb15('0xf'),_0xf12c94,_0xdb15('0x10'));return _0x58ac43[_0xdb15('0x11')]();}if(_0x63e57f[0x0]==='1'&&(_[_0xdb15('0x12')](this[_0xdb15('0x13')][_0xdb15('0x14')])||!this[_0xdb15('0x13')][_0xdb15('0x14')])){logger[_0xdb15('0xe')]('[%s][AUTOREPLY]\x20%s',_0xf12c94,_0xdb15('0x15'));return _0x58ac43[_0xdb15('0x11')]();}if(_0x63e57f[0x0]==='2'&&this['interaction'][_0xdb15('0x16')]){logger[_0xdb15('0xe')](_0xdb15('0x17'),_0xf12c94,_0xdb15('0x18'));return _0x58ac43['next']();}var _0x12f2e8={'ContactId':this[_0xdb15('0x19')]['id'],'sentAt':moment()[_0xdb15('0x1a')](_0xdb15('0x1b')),'direction':'out'};if(this[_0xdb15('0xb')]===_0xdb15('0x1c')){_0x12f2e8['body']=utils[_0xdb15('0x1d')](_0x63e57f[0x2],this);}else{_0x12f2e8[_0xdb15('0xc')]=utils[_0xdb15('0x1d')](_0x63e57f[0x1],this);}if(this['message']){_0x12f2e8['to']=this[_0xdb15('0x1e')][_0xdb15('0x1f')]||'';if(this[_0xdb15('0xb')]===_0xdb15('0x1c')&&_0x63e57f[0x1]==='1'){_0x12f2e8['cc']=this[_0xdb15('0x1e')]['cc']||'';}_0x12f2e8[_0xdb15('0x1f')]=this[_0xdb15('0x1e')]['to']||'';_0x12f2e8[_0xdb15('0x20')]=this[_0xdb15('0x1e')]['phone']||'';_0x12f2e8[_0xdb15('0x21')]=!![];if(this[_0xdb15('0x1e')]['subject']){_0x12f2e8[_0xdb15('0x22')]='';_0x12f2e8[_0xdb15('0x22')]+=_['startsWith'](this[_0xdb15('0x1e')]['subject'],'Re:')?'':_0xdb15('0x23');_0x12f2e8['subject']+=this['message'][_0xdb15('0x22')];}}if(this[_0xdb15('0xb')]===_0xdb15('0x24')){_0x12f2e8[_0xdb15('0x25')]=this[_0xdb15('0x26')]['id'];}else{_0x12f2e8[_[_0xdb15('0x27')](this[_0xdb15('0xb')])+_0xdb15('0x28')]=this['account']['id'];}_0x12f2e8[_[_0xdb15('0x27')](this[_0xdb15('0xb')])+_0xdb15('0x29')]=this[_0xdb15('0x13')]['id'];var _0x414683=this['interaction'];if(rpc[this[_0xdb15('0xb')]+'Message']){if(this['channel']===_0xdb15('0x1c')){_0x12f2e8[_0xdb15('0x2a')]=this[_0xdb15('0x1e')][_0xdb15('0x2b')];_0x12f2e8[_0xdb15('0x2c')]=_0xdb15('0x2d')+_[_0xdb15('0x2e')](_0x12f2e8[_0xdb15('0xc')],_0xdb15('0x2f'),']+(>|$)/g,''),'priorityTrue':_0x748da5[0x1],'priorityFalse':_0x748da5[0x2]};var _0x2ba5bf=gotoif['validate'](_0xbe61f4,{'typecast':!![]});if(_0x2ba5bf[_0xc5bd('0xa')]){logger[_0xc5bd('0xb')]('[%s][GOTOIF]\x20%s',_0x1e7220,_[_0xc5bd('0xc')](_0x2ba5bf,_0xc5bd('0xd'))[_0xc5bd('0xe')](',\x20'));_0x4247ae[_0xc5bd('0xf')]();}else{try{var _0x75c4a=eval('('+_0xbe61f4[_0xc5bd('0x10')]+')');var _0x20fa18=_0x75c4a?_0xbe61f4[_0xc5bd('0x11')]:_0xbe61f4['priorityFalse'];logger[_0xc5bd('0x12')](_0xc5bd('0x13'),_0x1e7220,_0xbe61f4[_0xc5bd('0x10')],_0x75c4a,_0x20fa18||_0xc5bd('0x14'));if(_0x20fa18){var _0x20adf9=_[_0xc5bd('0x15')](_0x4247ae[_0xc5bd('0x16')](),{'p':_0x20fa18});if(_0x20adf9>=0x0){logger[_0xc5bd('0x12')](_0xc5bd('0x17'),_0x1e7220,_0x20fa18||_0xc5bd('0x14'),_0x20adf9);_0x4247ae['next'](_0x20adf9);}else{logger[_0xc5bd('0x12')](_0xc5bd('0x18'),_0x1e7220,_0x20fa18||_0xc5bd('0x14'));_0x4247ae[_0xc5bd('0xf')]();}}else{_0x4247ae['next']();}}catch(_0x4ac727){logger[_0xc5bd('0xb')](_0xc5bd('0x19'),_0x1e7220,_0x4ac727[_0xc5bd('0xd')]);_0x4247ae[_0xc5bd('0xf')]();}}}catch(_0x51d41e){logger[_0xc5bd('0xb')]('[%s][GOTOIF]\x20%s',_0x1e7220,JSON['stringify'](_0x51d41e));_0x4247ae[_0xc5bd('0xf')]();}};}; \ No newline at end of file +var _0x47c9=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','routing'];(function(_0x13b9c8,_0x3429cb){var _0x5ac8cf=function(_0x167320){while(--_0x167320){_0x13b9c8['push'](_0x13b9c8['shift']());}};_0x5ac8cf(++_0x3429cb);}(_0x47c9,0x13a));var _0x947c=function(_0x1ee7a4,_0x3f4c70){_0x1ee7a4=_0x1ee7a4-0x0;var _0x1f9451=_0x47c9[_0x1ee7a4];return _0x1f9451;};'use strict';var schema=require(_0x947c('0x0'));var _=require(_0x947c('0x1'));var htmlToText=require(_0x947c('0x2'));var utils=require(_0x947c('0x3'));var logger=require('../../../../config/logger')(_0x947c('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x947c('0x5')},'priorityTrue':{'type':_0x947c('0x6'),'message':_0x947c('0x7')},'priorityFalse':{'type':'number','message':_0x947c('0x8')}});exports[_0x947c('0x9')]=function(_0x799034,_0x3bd6e7){return function(_0x311a1c){try{var _0x2fc303={'condition':htmlToText[_0x947c('0xa')](utils[_0x947c('0xb')](_0x3bd6e7[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3bd6e7[0x1],'priorityFalse':_0x3bd6e7[0x2]};var _0x129394=gotoif[_0x947c('0x0')](_0x2fc303,{'typecast':!![]});if(_0x129394[_0x947c('0xc')]){logger[_0x947c('0xd')](_0x947c('0xe'),_0x799034,_[_0x947c('0xf')](_0x129394,_0x947c('0x10'))[_0x947c('0x11')](',\x20'));_0x311a1c[_0x947c('0x12')]();}else{try{var _0x1bacdd=eval('('+_0x2fc303[_0x947c('0x13')]+')');var _0x1eb6b6=_0x1bacdd?_0x2fc303['priorityTrue']:_0x2fc303[_0x947c('0x14')];logger[_0x947c('0x15')](_0x947c('0x16'),_0x799034,_0x2fc303[_0x947c('0x13')],_0x1bacdd,_0x1eb6b6||_0x947c('0x17'));if(_0x1eb6b6){var _0x12c650=_[_0x947c('0x18')](_0x311a1c['rules'](),{'p':_0x1eb6b6});if(_0x12c650>=0x0){logger[_0x947c('0x15')](_0x947c('0x19'),_0x799034,_0x1eb6b6||_0x947c('0x17'),_0x12c650);_0x311a1c['next'](_0x12c650);}else{logger[_0x947c('0x15')](_0x947c('0x1a'),_0x799034,_0x1eb6b6||_0x947c('0x17'));_0x311a1c['stop']();}}else{_0x311a1c[_0x947c('0x17')]();}}catch(_0x32ac2a){logger[_0x947c('0xd')](_0x947c('0x1b'),_0x799034,_0x32ac2a[_0x947c('0x10')]);_0x311a1c[_0x947c('0x12')]();}}}catch(_0x36e720){logger[_0x947c('0xd')](_0x947c('0xe'),_0x799034,JSON[_0x947c('0x1c')](_0x36e720));_0x311a1c['stop']();}};}; \ 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 83bc983..840d3ce 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 _0xcb82=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','join','stop','info'];(function(_0x59af63,_0xc1cf57){var _0x3f30e6=function(_0x47bf50){while(--_0x47bf50){_0x59af63['push'](_0x59af63['shift']());}};_0x3f30e6(++_0xc1cf57);}(_0xcb82,0x1ed));var _0x2cb8=function(_0x2913e7,_0x5268a6){_0x2913e7=_0x2913e7-0x0;var _0x52f254=_0xcb82[_0x2913e7];return _0x52f254;};'use strict';var schema=require(_0x2cb8('0x0'));var _=require(_0x2cb8('0x1'));var logger=require(_0x2cb8('0x2'))(_0x2cb8('0x3'));var gotop=schema({'priority':{'type':_0x2cb8('0x4'),'required':!![],'message':_0x2cb8('0x5')}});exports[_0x2cb8('0x6')]=function(_0x244812,_0x8ae731){return function(_0x364c81){try{var _0x112982={'priority':_0x8ae731[0x0]};var _0x1315fa=gotop[_0x2cb8('0x0')](_0x112982,{'typecast':!![]});if(_0x1315fa[_0x2cb8('0x7')]){logger['error'](_0x2cb8('0x8'),_0x244812,_[_0x2cb8('0x9')](_0x1315fa,'message')[_0x2cb8('0xa')](',\x20'));_0x364c81[_0x2cb8('0xb')]();}else{logger[_0x2cb8('0xc')](_0x2cb8('0xd'),_0x244812,_0x112982['priority']);if(_0x112982[_0x2cb8('0xe')]){var _0x5033c8=_[_0x2cb8('0xf')](_0x364c81[_0x2cb8('0x10')](),{'p':_0x112982['priority']});if(_0x5033c8>=0x0){logger['info'](_0x2cb8('0x11'),_0x244812,_0x112982['priority']||_0x2cb8('0x12'),_0x5033c8);_0x364c81['next'](_0x5033c8);}else{logger[_0x2cb8('0xc')](_0x2cb8('0x13'),_0x244812,_0x112982[_0x2cb8('0xe')]||_0x2cb8('0x12'));_0x364c81[_0x2cb8('0xb')]();}}else{_0x364c81[_0x2cb8('0x12')]();}}}catch(_0x1e6ffd){logger[_0x2cb8('0x14')]('[%s][GOTOP]\x20%s',_0x244812,JSON[_0x2cb8('0x15')](_0x1e6ffd));_0x364c81['stop']();}};}; \ No newline at end of file +var _0x74b1=['[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','map','message','stop','info'];(function(_0x54a646,_0x51e965){var _0xc776ee=function(_0x5947c7){while(--_0x5947c7){_0x54a646['push'](_0x54a646['shift']());}};_0xc776ee(++_0x51e965);}(_0x74b1,0x1af));var _0x174b=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x74b1[_0x154192];return _0x3c2792;};'use strict';var schema=require(_0x174b('0x0'));var _=require(_0x174b('0x1'));var logger=require(_0x174b('0x2'))('routing');var gotop=schema({'priority':{'type':_0x174b('0x3'),'required':!![],'message':_0x174b('0x4')}});exports[_0x174b('0x5')]=function(_0x29d1af,_0x312278){return function(_0x234b9a){try{var _0xc3349a={'priority':_0x312278[0x0]};var _0x25eac8=gotop['validate'](_0xc3349a,{'typecast':!![]});if(_0x25eac8['length']){logger[_0x174b('0x6')]('[%s][GOTOP]\x20%s',_0x29d1af,_[_0x174b('0x7')](_0x25eac8,_0x174b('0x8'))['join'](',\x20'));_0x234b9a[_0x174b('0x9')]();}else{logger[_0x174b('0xa')](_0x174b('0xb'),_0x29d1af,_0xc3349a['priority']);if(_0xc3349a[_0x174b('0xc')]){var _0x14744=_['findIndex'](_0x234b9a['rules'](),{'p':_0xc3349a[_0x174b('0xc')]});if(_0x14744>=0x0){logger[_0x174b('0xa')](_0x174b('0xd'),_0x29d1af,_0xc3349a[_0x174b('0xc')]||_0x174b('0xe'),_0x14744);_0x234b9a[_0x174b('0xe')](_0x14744);}else{logger[_0x174b('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x29d1af,_0xc3349a[_0x174b('0xc')]||_0x174b('0xe'));_0x234b9a[_0x174b('0x9')]();}}else{_0x234b9a[_0x174b('0xe')]();}}}catch(_0x4b0d31){logger[_0x174b('0x6')](_0x174b('0xf'),_0x29d1af,JSON[_0x174b('0x10')](_0x4b0d31));_0x234b9a[_0x174b('0x9')]();}};}; \ 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 6da0300..c007997 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 _0x9d5b=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','AccountId','channel','InteractionId','interaction','Message','create','then','info','body','next','error','[%s][MESSAGE]\x20%s','stop','stringify','./utils','../../../../config/logger','routing'];(function(_0x301e9f,_0xc7931b){var _0x5b3e89=function(_0x119234){while(--_0x119234){_0x301e9f['push'](_0x301e9f['shift']());}};_0x5b3e89(++_0xc7931b);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x3cbfe8,_0x1fb279){_0x3cbfe8=_0x3cbfe8-0x0;var _0x4ee118=_0x9d5b[_0x3cbfe8];return _0x4ee118;};'use strict';var _=require('lodash');var utils=require(_0xb9d5('0x0'));var logger=require(_0xb9d5('0x1'))(_0xb9d5('0x2'));var rpc={'chatMessage':require(_0xb9d5('0x3')),'openchannelMessage':require(_0xb9d5('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb9d5('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xb9d5('0x6'))};exports[_0xb9d5('0x7')]=function(_0x71dbea,_0x39d8fe){return function(_0x422a92){try{var _0x5144c7={'body':utils[_0xb9d5('0x8')](_0x39d8fe[0x0],this),'ContactId':this[_0xb9d5('0x9')]['id']};if(this['channel']===_0xb9d5('0xa')){_0x5144c7[_0xb9d5('0xb')]=this[_0xb9d5('0xc')]['id'];}else{_0x5144c7[_[_0xb9d5('0xd')](this['channel'])+_0xb9d5('0xe')]=this[_0xb9d5('0xc')]['id'];}_0x5144c7[_['upperFirst'](this[_0xb9d5('0xf')])+_0xb9d5('0x10')]=this[_0xb9d5('0x11')]['id'];if(rpc[this[_0xb9d5('0xf')]+_0xb9d5('0x12')]){return rpc[this[_0xb9d5('0xf')]+_0xb9d5('0x12')][_0xb9d5('0x13')](_0x5144c7)[_0xb9d5('0x14')](function(_0x3d7910){logger[_0xb9d5('0x15')]('[%s][MESSAGE]\x20%s',_0x71dbea,_0x5144c7[_0xb9d5('0x16')]);_0x422a92[_0xb9d5('0x17')]();})['catch'](function(_0xf7e03c){logger[_0xb9d5('0x18')](_0xb9d5('0x19'),_0x71dbea,JSON['stringify'](_0xf7e03c));_0x422a92[_0xb9d5('0x1a')]();});}}catch(_0x2e96dc){logger[_0xb9d5('0x18')](_0xb9d5('0x19'),_0x71dbea,JSON[_0xb9d5('0x1b')](_0x2e96dc));_0x422a92[_0xb9d5('0x1a')]();}};}; \ No newline at end of file +var _0x99d4=['catch','error','stop','stringify','lodash','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','getMustacheRender','contact','ChatWebsiteId','account','upperFirst','channel','AccountId','interaction','Message','create','[%s][MESSAGE]\x20%s','body','next'];(function(_0x17959d,_0x5cccb1){var _0x288312=function(_0x12f63e){while(--_0x12f63e){_0x17959d['push'](_0x17959d['shift']());}};_0x288312(++_0x5cccb1);}(_0x99d4,0x122));var _0x499d=function(_0x557e9e,_0x1a52d4){_0x557e9e=_0x557e9e-0x0;var _0x55e8b5=_0x99d4[_0x557e9e];return _0x55e8b5;};'use strict';var _=require(_0x499d('0x0'));var utils=require('./utils');var logger=require(_0x499d('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x499d('0x2')),'mailMessage':require(_0x499d('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x499d('0x4')]=function(_0x68c441,_0x4748bc){return function(_0x53264c){try{var _0x1b8134={'body':utils[_0x499d('0x5')](_0x4748bc[0x0],this),'ContactId':this[_0x499d('0x6')]['id']};if(this['channel']==='chat'){_0x1b8134[_0x499d('0x7')]=this[_0x499d('0x8')]['id'];}else{_0x1b8134[_[_0x499d('0x9')](this[_0x499d('0xa')])+_0x499d('0xb')]=this[_0x499d('0x8')]['id'];}_0x1b8134[_[_0x499d('0x9')](this[_0x499d('0xa')])+'InteractionId']=this[_0x499d('0xc')]['id'];if(rpc[this[_0x499d('0xa')]+_0x499d('0xd')]){return rpc[this[_0x499d('0xa')]+_0x499d('0xd')][_0x499d('0xe')](_0x1b8134)['then'](function(_0x14e788){logger['info'](_0x499d('0xf'),_0x68c441,_0x1b8134[_0x499d('0x10')]);_0x53264c[_0x499d('0x11')]();})[_0x499d('0x12')](function(_0x17c108){logger[_0x499d('0x13')](_0x499d('0xf'),_0x68c441,JSON['stringify'](_0x17c108));_0x53264c[_0x499d('0x14')]();});}}catch(_0x1ddb7e){logger[_0x499d('0x13')](_0x499d('0xf'),_0x68c441,JSON[_0x499d('0x15')](_0x1ddb7e));_0x53264c[_0x499d('0x14')]();}};}; \ 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 d0ed2c9..e5aef2e 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 _0x7338=['../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','next','error','stringify','stop','./utils'];(function(_0x14bc1d,_0x1fbd46){var _0x569751=function(_0x1c066b){while(--_0x1c066b){_0x14bc1d['push'](_0x14bc1d['shift']());}};_0x569751(++_0x1fbd46);}(_0x7338,0xaa));var _0x8733=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x7338[_0x87b0ff];return _0x3bc0b2;};'use strict';var utils=require(_0x8733('0x0'));var logger=require(_0x8733('0x1'))(_0x8733('0x2'));exports[_0x8733('0x3')]=function(_0x23d5a8,_0x1dd437){return function(_0x2a137f){try{logger['info'](_0x8733('0x4'),_0x23d5a8,utils['getMustacheRender'](_0x1dd437[0x0],this));_0x2a137f[_0x8733('0x5')]();}catch(_0x50b37e){logger[_0x8733('0x6')]('[%s][NOOP]\x20%s',_0x23d5a8,JSON[_0x8733('0x7')](_0x50b37e));_0x2a137f[_0x8733('0x8')]();}};}; \ No newline at end of file +var _0x2d74=['[%s][NOOP]\x20%s','next','error','stringify','stop','../../../../config/logger','routing','info'];(function(_0x3941df,_0x1492cb){var _0xe2da73=function(_0x1dcdf6){while(--_0x1dcdf6){_0x3941df['push'](_0x3941df['shift']());}};_0xe2da73(++_0x1492cb);}(_0x2d74,0x12d));var _0x42d7=function(_0x1da5ed,_0xcac208){_0x1da5ed=_0x1da5ed-0x0;var _0x34bd75=_0x2d74[_0x1da5ed];return _0x34bd75;};'use strict';var utils=require('./utils');var logger=require(_0x42d7('0x0'))(_0x42d7('0x1'));exports['consequence']=function(_0x1f0680,_0x248aea){return function(_0x539df5){try{logger[_0x42d7('0x2')](_0x42d7('0x3'),_0x1f0680,utils['getMustacheRender'](_0x248aea[0x0],this));_0x539df5[_0x42d7('0x4')]();}catch(_0x280bf2){logger[_0x42d7('0x5')](_0x42d7('0x3'),_0x1f0680,JSON[_0x42d7('0x6')](_0x280bf2));_0x539df5[_0x42d7('0x7')]();}};}; \ 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 0056a69..d2a276a 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 _0x0971=['../../rpc/faxInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','error','update\x20queue\x20report','timeout','toLowerCase','consequence','map','stop','find','Queues','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','emit','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction'];(function(_0x3bc2a8,_0x551769){var _0x45f417=function(_0x14e452){while(--_0x14e452){_0x3bc2a8['push'](_0x3bc2a8['shift']());}};_0x45f417(++_0x551769);}(_0x0971,0x1d1));var _0x1097=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x0971[_0x16337a];return _0x422365;};'use strict';var schema=require(_0x1097('0x0'));var _=require(_0x1097('0x1'));var util=require(_0x1097('0x2'));var seqqueue=require(_0x1097('0x3'));var moment=require(_0x1097('0x4'));var Redis=require('ioredis');var config=require(_0x1097('0x5'));var logger=require(_0x1097('0x6'))(_0x1097('0x7'));var strategy=require(_0x1097('0x8'));config[_0x1097('0x9')]=_['defaults'](config[_0x1097('0x9')],{'host':_0x1097('0xa'),'port':0x18eb});var io=require(_0x1097('0xb'))(new Redis(config['redis']));var attributes=['id',_0x1097('0xc'),_0x1097('0xd'),_0x1097('0xe'),_0x1097('0xf'),'joinAt'];function emit(_0x328046,_0x9e36d1,_0x207d2f){io['to'](_0x328046)[_0x1097('0x10')](_0x9e36d1,_0x207d2f);}function emitChannelQueueInteraction(_0xb1f9dd,_0x2a9de7,_0x261c01,_0x166d79,_0x4a2063,_0x11755d,_0x3ccb56,_0x6577c7){var _0x4a25bb=_[_0x1097('0x11')](_0x261c01);_0x4a25bb[_0x1097('0xc')]=_0x6577c7;_0x4a25bb[_0x1097('0xe')]=_0x2a9de7;_0x4a25bb['account']=_0x166d79;_0x4a25bb['id']=_0x4a2063;if(_0x11755d){attributes[_0x1097('0x12')](_[_0x1097('0x13')](_0xb1f9dd)+_0x1097('0x14'));_0x3ccb56[util[_0x1097('0x15')](_0x1097('0x16'),_0xb1f9dd)][_0x4a2063]=_[_0x1097('0x17')](_0x4a25bb,attributes);}else{delete _0x3ccb56[util[_0x1097('0x15')]('%sQueuesWaitingInteractions',_0xb1f9dd)][_0x4a2063];}emit(util['format'](_0x1097('0x18'),_0xb1f9dd,_0x2a9de7),util['format'](_0x1097('0x19'),_0xb1f9dd,_0x11755d?'save':_0x1097('0x1a')),_[_0x1097('0x17')](_0x4a25bb,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x1097('0x1b')),'chatQueueReport':require(_0x1097('0x1c')),'smsQueueReport':require(_0x1097('0x1d')),'faxQueueReport':require(_0x1097('0x1e')),'whatsappQueueReport':require(_0x1097('0x1f')),'chatInteraction':require(_0x1097('0x20')),'faxInteraction':require(_0x1097('0x21')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1097('0x22')),'whatsappInteraction':require(_0x1097('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x1097('0x24')},'timeout':{'type':_0x1097('0x25'),'message':_0x1097('0x26')}});function startRouting(_0x40fa7c,_0x425be7,_0x2fd4a6,_0x41cb02){if(_0x40fa7c&&_0x425be7&&_0x2fd4a6){_0x425be7[_0x1097('0x27')]+=0x1;var _0x5a8ae8={'uniqueid':_0x40fa7c,'from':_0x2fd4a6['body']?_0x2fd4a6[_0x1097('0x28')][_0x1097('0xf')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2fd4a6[_0x1097('0x29')]?_0x2fd4a6[_0x1097('0x29')]['id']:null,'ListId':_0x2fd4a6['list']?_0x2fd4a6[_0x1097('0x2a')]['id']:null};_0x5a8ae8[_[_0x1097('0x2b')](_0x2fd4a6['channel'])+_0x1097('0x2c')]=_0x425be7['id']||null;_0x5a8ae8[_[_0x1097('0x2b')](_0x2fd4a6[_0x1097('0x2d')])+'InteractionId']=_0x2fd4a6[_0x1097('0x2e')]?_0x2fd4a6[_0x1097('0x2e')]['id']:null;_0x5a8ae8[_[_0x1097('0x2b')](_0x2fd4a6['channel'])+_0x1097('0x2f')]=_0x2fd4a6[_0x1097('0x30')]?_0x2fd4a6['message']['id']:null;_0x5a8ae8[_['upperFirst'](_0x2fd4a6[_0x1097('0x2d')])+(_0x2fd4a6[_0x1097('0x2d')]!==_0x1097('0x31')?_0x1097('0x32'):'WebsiteId')]=_0x2fd4a6[_0x1097('0xd')]?_0x2fd4a6[_0x1097('0xd')]['id']:null;logger[_0x1097('0x33')](util[_0x1097('0x15')](_0x1097('0x34'),_0x40fa7c,_0x425be7['name']));emitChannelQueueInteraction(_0x2fd4a6['channel'],_0x425be7[_0x1097('0x35')],_0x5a8ae8,_0x2fd4a6['account'][_0x1097('0x35')],_0x2fd4a6[_0x1097('0x30')]['id'],!![],_0x41cb02,_0x425be7['id']);if(rpc[_0x2fd4a6[_0x1097('0x2d')]+_0x1097('0x36')]){return rpc[_0x2fd4a6['channel']+_0x1097('0x36')][_0x1097('0x37')](_0x5a8ae8)[_0x1097('0x38')](function(_0x1b53d0){logger['error'](_0x1097('0x39'),_0x1b53d0);});}}}function stopRouting(_0x6e39b,_0x9d70b5,_0x1c975c,_0x172bf7){if(_0x6e39b&&_0x9d70b5){_0x9d70b5['waiting']-=0x1;var _0x2b0094={'leaveAt':moment()[_0x1097('0x15')](_0x1097('0x3a')),'acceptAt':moment()['format'](_0x1097('0x3a')),'reason':'accepted'};logger[_0x1097('0x33')](util[_0x1097('0x15')](_0x1097('0x3b'),_0x6e39b,_0x9d70b5[_0x1097('0x35')]));emitChannelQueueInteraction(_0x1c975c[_0x1097('0x2d')],_0x9d70b5[_0x1097('0x35')],_0x1c975c[_0x1097('0x28')],_0x1c975c[_0x1097('0xd')][_0x1097('0x35')],_0x1c975c[_0x1097('0x30')]['id'],![],_0x172bf7,_0x9d70b5['id']);return rpc[_0x1c975c['channel']+_0x1097('0x3c')][_0x1097('0x3d')](_0x1c975c[_0x1097('0x2e')]['id'],{'queueId':_0x9d70b5['id']})['then'](function(){if(rpc[_0x1c975c[_0x1097('0x2d')]+_0x1097('0x36')]){return rpc[_0x1c975c['channel']+'QueueReport']['update'](_0x6e39b,_0x2b0094)[_0x1097('0x38')](function(_0x41bb71){logger[_0x1097('0x3e')](_0x1097('0x3f'),_0x41bb71);});}});}}function endRouting(_0x3667a5,_0x11f16a,_0x53adb7,_0x1eeaa3){if(_0x3667a5&&_0x11f16a){_0x11f16a['waiting']-=0x1;var _0x1f1fb0={'leaveAt':moment()[_0x1097('0x15')](_0x1097('0x3a')),'exitAt':moment()[_0x1097('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x1097('0x40')};logger[_0x1097('0x33')](util[_0x1097('0x15')]('[%s][END:QUEUE][NAME:%s]',_0x3667a5,_0x11f16a[_0x1097('0x35')]));emitChannelQueueInteraction(_0x53adb7[_0x1097('0x2d')],_0x11f16a['name'],_0x53adb7['body'],_0x53adb7[_0x1097('0xd')][_0x1097('0x35')],_0x53adb7['message']['id'],![],_0x1eeaa3);if(rpc[_0x53adb7[_0x1097('0x2d')]+_0x1097('0x36')]){return rpc[_0x53adb7[_0x1097('0x2d')]+'QueueReport'][_0x1097('0x3d')](_0x3667a5,_0x1f1fb0)[_0x1097('0x38')](function(_0x157077){logger[_0x1097('0x3e')](_0x1097('0x3f'),_0x157077);});}}}function handleFindQueue(_0x188968){return function(_0x389145){return _0x389145['name'][_0x1097('0x41')]()===_0x188968[_0x1097('0x41')]();};}exports[_0x1097('0x42')]=function(_0x41c312,_0x45b3b3,_0x1f36b8,_0x444a67){return function(_0x1c00b1){try{var _0x39253e={'name':_0x45b3b3[0x0],'timeout':_0x45b3b3[0x1]};var _0x57d831=queue[_0x1097('0x0')](_0x39253e,{'typecast':!![]});if(_0x57d831['length']){logger['error']('[%s][QUEUE]\x20%s',_0x41c312,_[_0x1097('0x43')](_0x57d831,_0x1097('0x30'))['join'](',\x20'));_0x1c00b1[_0x1097('0x44')]();}else{var _0x45b9c5=_[_0x1097('0x45')](_0x1f36b8[_0x444a67['channel']+_0x1097('0x46')],handleFindQueue(_0x39253e[_0x1097('0x35')]));if(_0x45b9c5){startRouting(_0x41c312,_0x45b9c5,_0x444a67,_0x1f36b8);var _0x342dea=(_0x45b9c5[_0x1097('0x40')]||0xa)*0x3e8;var _0x2a82cb=(_0x39253e['timeout']||0x14)*0x3e8;var _0x4a0121;if(_0x342dea>_0x2a82cb){_0x2a82cb=_0x342dea;}var _0xa57bbd=seqqueue['createQueue'](_0x342dea);_0xa57bbd['id']=_0x41c312;_0xa57bbd[_0x1097('0x47')]=_0x342dea;_0xa57bbd[_0x1097('0x48')]=_0x2a82cb;_0xa57bbd[_0x1097('0x2d')]=_0x444a67[_0x1097('0x2d')];_0x1f36b8[_0x1097('0x49')][_0x41c312]['on'](_0x1097('0x4a'),function(){logger[_0x1097('0x33')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x41c312);stopRouting(_0x41c312,_0x45b9c5,_0x444a67,_0x1f36b8);clearTimeout(_0x4a0121);_0x4a0121=undefined;_0xa57bbd[_0x1097('0x4b')](!![]);if(_0x1f36b8['rules'][_0x41c312]){delete _0x1f36b8[_0x1097('0x49')][_0x41c312];}_0x1c00b1[_0x1097('0x44')]();});_0x1f36b8['rules'][_0x41c312]['on']('complete',function(){if(_0x1f36b8[_0x1097('0x49')][_0x41c312]){delete _0x1f36b8[_0x1097('0x49')][_0x41c312];}});_0x4a0121=setTimeout(function(){logger[_0x1097('0x33')](_0x1097('0x4c'),_0x41c312);endRouting(_0x41c312,_0x45b9c5,_0x444a67,_0x1f36b8);clearTimeout(_0x4a0121);_0xa57bbd[_0x1097('0x4b')](!![]);_0x1c00b1['next']();},_0x2a82cb);switch(_0x45b9c5[_0x1097('0x4d')]){case'rrmemory':strategy[_0x1097('0x4e')](_0xa57bbd,_0x45b9c5,_0x1f36b8,_0x444a67);break;default:strategy[_0x1097('0x4f')](_0xa57bbd,_0x45b9c5,_0x1f36b8,_0x444a67);}}else{logger[_0x1097('0x3e')](_0x1097('0x50'),_0x41c312,_0x39253e[_0x1097('0x35')]);_0x1c00b1[_0x1097('0x44')]();}}}catch(_0x20898c){logger[_0x1097('0x3e')](_0x1097('0x51'),_0x41c312,_0x20898c[_0x1097('0x52')]);_0x1c00b1['stop']();}};}; \ No newline at end of file +var _0x5dbb=['number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','catch','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','account','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x5dbb,0xdd));var _0xb5db=function(_0x4ac320,_0x1a0f52){_0x4ac320=_0x4ac320-0x0;var _0x479cf7=_0x5dbb[_0x4ac320];return _0x479cf7;};'use strict';var schema=require(_0xb5db('0x0'));var _=require(_0xb5db('0x1'));var util=require(_0xb5db('0x2'));var seqqueue=require(_0xb5db('0x3'));var moment=require('moment');var Redis=require(_0xb5db('0x4'));var config=require(_0xb5db('0x5'));var logger=require(_0xb5db('0x6'))('routing');var strategy=require(_0xb5db('0x7'));config[_0xb5db('0x8')]=_['defaults'](config[_0xb5db('0x8')],{'host':_0xb5db('0x9'),'port':0x18eb});var io=require(_0xb5db('0xa'))(new Redis(config['redis']));var attributes=['id',_0xb5db('0xb'),'account',_0xb5db('0xc'),_0xb5db('0xd'),_0xb5db('0xe')];function emit(_0x409f30,_0xeb0b17,_0x55045d){io['to'](_0x409f30)[_0xb5db('0xf')](_0xeb0b17,_0x55045d);}function emitChannelQueueInteraction(_0x189acb,_0x4a3fe6,_0x521351,_0x397eea,_0x57a731,_0x5b01a3,_0x4c173f,_0x2b3b2e){var _0x26850a=_['clone'](_0x521351);_0x26850a[_0xb5db('0xb')]=_0x2b3b2e;_0x26850a[_0xb5db('0xc')]=_0x4a3fe6;_0x26850a[_0xb5db('0x10')]=_0x397eea;_0x26850a['id']=_0x57a731;if(_0x5b01a3){attributes['push'](_[_0xb5db('0x11')](_0x189acb)+_0xb5db('0x12'));_0x4c173f[util[_0xb5db('0x13')](_0xb5db('0x14'),_0x189acb)][_0x57a731]=_[_0xb5db('0x15')](_0x26850a,attributes);}else{delete _0x4c173f[util[_0xb5db('0x13')](_0xb5db('0x14'),_0x189acb)][_0x57a731];}emit(util[_0xb5db('0x13')]('%s:queue:%s',_0x189acb,_0x4a3fe6),util['format']('%s_queue_waiting_interaction:%s',_0x189acb,_0x5b01a3?_0xb5db('0x16'):_0xb5db('0x17')),_[_0xb5db('0x15')](_0x26850a,attributes));}var rpc={'openchannelQueueReport':require(_0xb5db('0x18')),'mailQueueReport':require(_0xb5db('0x19')),'chatQueueReport':require(_0xb5db('0x1a')),'smsQueueReport':require(_0xb5db('0x1b')),'faxQueueReport':require(_0xb5db('0x1c')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0xb5db('0x1d')),'faxInteraction':require(_0xb5db('0x1e')),'mailInteraction':require(_0xb5db('0x1f')),'openchannelInteraction':require(_0xb5db('0x20')),'smsInteraction':require(_0xb5db('0x21')),'whatsappInteraction':require(_0xb5db('0x22'))};var queue=schema({'name':{'type':_0xb5db('0x23'),'required':!![],'message':_0xb5db('0x24')},'timeout':{'type':_0xb5db('0x25'),'message':_0xb5db('0x26')}});function startRouting(_0x4cbb98,_0xb21cf9,_0x34483a,_0x110a41){if(_0x4cbb98&&_0xb21cf9&&_0x34483a){_0xb21cf9['waiting']+=0x1;var _0x561aec={'uniqueid':_0x4cbb98,'from':_0x34483a[_0xb5db('0x27')]?_0x34483a['body'][_0xb5db('0xd')]:'','joinAt':moment()[_0xb5db('0x13')](_0xb5db('0x28')),'ContactId':_0x34483a['contact']?_0x34483a[_0xb5db('0x29')]['id']:null,'ListId':_0x34483a['list']?_0x34483a[_0xb5db('0x2a')]['id']:null};_0x561aec[_[_0xb5db('0x2b')](_0x34483a[_0xb5db('0x2c')])+_0xb5db('0x2d')]=_0xb21cf9['id']||null;_0x561aec[_[_0xb5db('0x2b')](_0x34483a[_0xb5db('0x2c')])+'InteractionId']=_0x34483a[_0xb5db('0x2e')]?_0x34483a[_0xb5db('0x2e')]['id']:null;_0x561aec[_[_0xb5db('0x2b')](_0x34483a[_0xb5db('0x2c')])+_0xb5db('0x2f')]=_0x34483a[_0xb5db('0x30')]?_0x34483a[_0xb5db('0x30')]['id']:null;_0x561aec[_[_0xb5db('0x2b')](_0x34483a[_0xb5db('0x2c')])+(_0x34483a[_0xb5db('0x2c')]!==_0xb5db('0x31')?_0xb5db('0x32'):_0xb5db('0x33'))]=_0x34483a[_0xb5db('0x10')]?_0x34483a[_0xb5db('0x10')]['id']:null;logger[_0xb5db('0x34')](util[_0xb5db('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x4cbb98,_0xb21cf9[_0xb5db('0x35')]));emitChannelQueueInteraction(_0x34483a[_0xb5db('0x2c')],_0xb21cf9[_0xb5db('0x35')],_0x561aec,_0x34483a['account'][_0xb5db('0x35')],_0x34483a[_0xb5db('0x30')]['id'],!![],_0x110a41,_0xb21cf9['id']);if(rpc[_0x34483a[_0xb5db('0x2c')]+_0xb5db('0x36')]){return rpc[_0x34483a[_0xb5db('0x2c')]+_0xb5db('0x36')][_0xb5db('0x37')](_0x561aec)['catch'](function(_0x554a83){logger[_0xb5db('0x38')]('create\x20queue\x20report',_0x554a83);});}}}function stopRouting(_0x1669ce,_0x4b6e01,_0xa77bb5,_0x55eed6){if(_0x1669ce&&_0x4b6e01){_0x4b6e01['waiting']-=0x1;var _0x293be2={'leaveAt':moment()[_0xb5db('0x13')](_0xb5db('0x28')),'acceptAt':moment()[_0xb5db('0x13')](_0xb5db('0x28')),'reason':_0xb5db('0x39')};logger[_0xb5db('0x34')](util[_0xb5db('0x13')](_0xb5db('0x3a'),_0x1669ce,_0x4b6e01['name']));emitChannelQueueInteraction(_0xa77bb5[_0xb5db('0x2c')],_0x4b6e01[_0xb5db('0x35')],_0xa77bb5[_0xb5db('0x27')],_0xa77bb5[_0xb5db('0x10')]['name'],_0xa77bb5[_0xb5db('0x30')]['id'],![],_0x55eed6,_0x4b6e01['id']);return rpc[_0xa77bb5['channel']+'Interaction'][_0xb5db('0x3b')](_0xa77bb5[_0xb5db('0x2e')]['id'],{'queueId':_0x4b6e01['id']})[_0xb5db('0x3c')](function(){if(rpc[_0xa77bb5[_0xb5db('0x2c')]+'QueueReport']){return rpc[_0xa77bb5['channel']+_0xb5db('0x36')][_0xb5db('0x3b')](_0x1669ce,_0x293be2)[_0xb5db('0x3d')](function(_0xa4b3a2){logger[_0xb5db('0x38')](_0xb5db('0x3e'),_0xa4b3a2);});}});}}function endRouting(_0x5a587a,_0x5a42f7,_0x55a03f,_0x5f22b9){if(_0x5a587a&&_0x5a42f7){_0x5a42f7[_0xb5db('0x3f')]-=0x1;var _0x595817={'leaveAt':moment()['format'](_0xb5db('0x28')),'exitAt':moment()[_0xb5db('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xb5db('0x40')};logger[_0xb5db('0x34')](util[_0xb5db('0x13')](_0xb5db('0x41'),_0x5a587a,_0x5a42f7['name']));emitChannelQueueInteraction(_0x55a03f[_0xb5db('0x2c')],_0x5a42f7['name'],_0x55a03f[_0xb5db('0x27')],_0x55a03f[_0xb5db('0x10')][_0xb5db('0x35')],_0x55a03f['message']['id'],![],_0x5f22b9);if(rpc[_0x55a03f[_0xb5db('0x2c')]+'QueueReport']){return rpc[_0x55a03f[_0xb5db('0x2c')]+_0xb5db('0x36')][_0xb5db('0x3b')](_0x5a587a,_0x595817)[_0xb5db('0x3d')](function(_0x3db9b5){logger[_0xb5db('0x38')](_0xb5db('0x3e'),_0x3db9b5);});}}}function handleFindQueue(_0x30f091){return function(_0x2522a0){return _0x2522a0['name']['toLowerCase']()===_0x30f091[_0xb5db('0x42')]();};}exports[_0xb5db('0x43')]=function(_0x50876a,_0x4439fc,_0xac854d,_0x7c24a){return function(_0x4e67d3){try{var _0x37e064={'name':_0x4439fc[0x0],'timeout':_0x4439fc[0x1]};var _0x508031=queue[_0xb5db('0x0')](_0x37e064,{'typecast':!![]});if(_0x508031[_0xb5db('0x44')]){logger[_0xb5db('0x38')](_0xb5db('0x45'),_0x50876a,_[_0xb5db('0x46')](_0x508031,'message')[_0xb5db('0x47')](',\x20'));_0x4e67d3[_0xb5db('0x48')]();}else{var _0x280e3f=_[_0xb5db('0x49')](_0xac854d[_0x7c24a[_0xb5db('0x2c')]+'Queues'],handleFindQueue(_0x37e064[_0xb5db('0x35')]));if(_0x280e3f){startRouting(_0x50876a,_0x280e3f,_0x7c24a,_0xac854d);var _0x483e24=(_0x280e3f['timeout']||0xa)*0x3e8;var _0x3e7a27=(_0x37e064[_0xb5db('0x40')]||0x14)*0x3e8;var _0x32451f;if(_0x483e24>_0x3e7a27){_0x3e7a27=_0x483e24;}var _0x2a4384=seqqueue[_0xb5db('0x4a')](_0x483e24);_0x2a4384['id']=_0x50876a;_0x2a4384[_0xb5db('0x4b')]=_0x483e24;_0x2a4384[_0xb5db('0x4c')]=_0x3e7a27;_0x2a4384[_0xb5db('0x2c')]=_0x7c24a[_0xb5db('0x2c')];_0xac854d[_0xb5db('0x4d')][_0x50876a]['on'](_0xb5db('0x4e'),function(){logger[_0xb5db('0x34')](_0xb5db('0x4f'),_0x50876a);stopRouting(_0x50876a,_0x280e3f,_0x7c24a,_0xac854d);clearTimeout(_0x32451f);_0x32451f=undefined;_0x2a4384[_0xb5db('0x50')](!![]);if(_0xac854d[_0xb5db('0x4d')][_0x50876a]){delete _0xac854d[_0xb5db('0x4d')][_0x50876a];}_0x4e67d3[_0xb5db('0x48')]();});_0xac854d['rules'][_0x50876a]['on']('complete',function(){if(_0xac854d[_0xb5db('0x4d')][_0x50876a]){delete _0xac854d[_0xb5db('0x4d')][_0x50876a];}});_0x32451f=setTimeout(function(){logger[_0xb5db('0x34')](_0xb5db('0x51'),_0x50876a);endRouting(_0x50876a,_0x280e3f,_0x7c24a,_0xac854d);clearTimeout(_0x32451f);_0x2a4384['close'](!![]);_0x4e67d3['next']();},_0x3e7a27);switch(_0x280e3f[_0xb5db('0x52')]){case _0xb5db('0x53'):strategy[_0xb5db('0x53')](_0x2a4384,_0x280e3f,_0xac854d,_0x7c24a);break;default:strategy[_0xb5db('0x54')](_0x2a4384,_0x280e3f,_0xac854d,_0x7c24a);}}else{logger[_0xb5db('0x38')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x50876a,_0x37e064[_0xb5db('0x35')]);_0x4e67d3[_0xb5db('0x48')]();}}}catch(_0x143c11){logger[_0xb5db('0x38')](_0xb5db('0x45'),_0x50876a,_0x143c11[_0xb5db('0x55')]);_0x4e67d3[_0xb5db('0x48')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index c149b73..68c4ecb 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 _0x5178=['isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','channel','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','agent','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x5178,0x171));var _0x8517=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5178[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var uuid=require(_0x8517('0x0'));var util=require(_0x8517('0x1'));var logger=require(_0x8517('0x2'))(_0x8517('0x3'));var Agent=function(_0x38d5b3,_0x5e0a44,_0x483381,_0x3ed6a5){this[_0x8517('0x4')]=uuid['v4']();this['squeue']=_0x38d5b3;this[_0x8517('0x5')]=_0x5e0a44;this['realtime']=_0x483381;this[_0x8517('0x3')]=_0x3ed6a5;this[_0x8517('0x6')][_0x8517('0x7')](this[_0x8517('0x8')][_0x8517('0x9')](this),this['handleTimeout'][_0x8517('0x9')](this));this['squeue']['on']('timeout',this[_0x8517('0xa')][_0x8517('0x9')](this));this['squeue']['on'](_0x8517('0xb'),this[_0x8517('0xc')][_0x8517('0x9')](this));};Agent[_0x8517('0xd')][_0x8517('0x7')]=function(){this[_0x8517('0x6')][_0x8517('0x7')](this[_0x8517('0x8')]['bind'](this),this[_0x8517('0xa')][_0x8517('0x9')](this));};Agent[_0x8517('0xd')][_0x8517('0xc')]=function(){this[_0x8517('0xa')](!![]);};Agent['prototype'][_0x8517('0x8')]=function(){logger[_0x8517('0xe')](_0x8517('0xf'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);if(_[_0x8517('0x10')](this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']])){logger[_0x8517('0xe')](_0x8517('0x13'),this[_0x8517('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x8517('0x7')][_0x8517('0x9')](this),0x3e8);}else{if(this[_0x8517('0x3')][_0x8517('0x14')]||util[_0x8517('0x15')](this[_0x8517('0x6')]['id'],this[_0x8517('0x11')]['agents'][this[_0x8517('0x5')]['id']],this['squeue']['channel'],![])){this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']][_0x8517('0x16')]=!![];this[_0x8517('0x11')][_0x8517('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0x8517('0x17')](this[_0x8517('0x11')],this[_0x8517('0x3')],this[_0x8517('0x5')],this[_0x8517('0x6')][_0x8517('0x18')]);util['showNotification'](this[_0x8517('0x4')],this[_0x8517('0x6')]['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],null,this[_0x8517('0x3')]);util['writeLog'](this[_0x8517('0x6')]['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],_0x8517('0x19')+(this[_0x8517('0x3')][_0x8517('0x14')]?_0x8517('0x1a'):''));}else{logger['debug'](_0x8517('0x1b'),this['squeue']['id'],this[_0x8517('0x5')]['id']);setTimeout(this[_0x8517('0x7')][_0x8517('0x9')](this),0x3e8);}}};Agent[_0x8517('0xd')][_0x8517('0xa')]=function(_0x1b2423){if(_['isNil'](this[_0x8517('0x11')]['agents'][this[_0x8517('0x5')]['id']])){return logger[_0x8517('0xe')](_0x8517('0x13'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);}else{logger[_0x8517('0xe')](_0x8517('0x1c'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);util['hideNotification'](this[_0x8517('0x4')],this[_0x8517('0x6')]['id'],this[_0x8517('0x11')]['agents'][this['agent']['id']],null,this['routing']);this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']][_0x8517('0x16')]=![];this[_0x8517('0x11')][_0x8517('0x12')][this['agent']['id']][_0x8517('0x1d')]=undefined;util[_0x8517('0x1e')](this[_0x8517('0x11')],this['routing'],this[_0x8517('0x5')],this['squeue'][_0x8517('0x18')]);util[_0x8517('0x1f')](this['squeue']['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],_0x1b2423?_0x8517('0x20'):_0x8517('0x21'));}if(!_0x1b2423){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x2cb889,_0x11a1b3,_0x1835ac,_0x516fb1){return new Agent(_0x2cb889,_0x11a1b3,_0x1835ac,_0x516fb1);}module[_0x8517('0x22')]=agent; \ No newline at end of file +var _0xe14d=['[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','forcedOwnership',':FORCED','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14d,0x1ee));var _0xde14=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe14d[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xde14('0x0'));var uuid=require(_0xde14('0x1'));var util=require(_0xde14('0x2'));var logger=require(_0xde14('0x3'))('routing');var Agent=function(_0x1c5b4,_0x28965b,_0x4b20e2,_0x1c3e94){this[_0xde14('0x4')]=uuid['v4']();this[_0xde14('0x5')]=_0x1c5b4;this[_0xde14('0x6')]=_0x28965b;this[_0xde14('0x7')]=_0x4b20e2;this[_0xde14('0x8')]=_0x1c3e94;this['squeue']['push'](this[_0xde14('0x9')][_0xde14('0xa')](this),this[_0xde14('0xb')][_0xde14('0xa')](this));this[_0xde14('0x5')]['on'](_0xde14('0xc'),this[_0xde14('0xb')][_0xde14('0xa')](this));this['squeue']['on'](_0xde14('0xd'),this[_0xde14('0xe')][_0xde14('0xa')](this));};Agent[_0xde14('0xf')][_0xde14('0x10')]=function(){this[_0xde14('0x5')][_0xde14('0x10')](this[_0xde14('0x9')][_0xde14('0xa')](this),this[_0xde14('0xb')][_0xde14('0xa')](this));};Agent[_0xde14('0xf')][_0xde14('0xe')]=function(){this[_0xde14('0xb')](!![]);};Agent[_0xde14('0xf')]['handleRun']=function(){logger['debug'](_0xde14('0x11'),this[_0xde14('0x5')]['id'],this[_0xde14('0x6')]['id']);if(_['isNil'](this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']])){logger[_0xde14('0x13')](_0xde14('0x14'),this[_0xde14('0x5')]['id'],this[_0xde14('0x6')]['id']);setTimeout(this[_0xde14('0x10')][_0xde14('0xa')](this),0x3e8);}else{if(this[_0xde14('0x8')]['forcedOwnership']||util[_0xde14('0x15')](this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this['agent']['id']],this[_0xde14('0x5')]['channel'],![])){this[_0xde14('0x7')]['agents'][this[_0xde14('0x6')]['id']][_0xde14('0x16')]=!![];this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']][_0xde14('0x17')]=undefined;util[_0xde14('0x18')](this[_0xde14('0x7')],this[_0xde14('0x8')],this[_0xde14('0x6')],this[_0xde14('0x5')][_0xde14('0x19')]);util[_0xde14('0x1a')](this['notificationId'],this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],null,this[_0xde14('0x8')]);util[_0xde14('0x1b')](this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],'RINGING'+(this[_0xde14('0x8')][_0xde14('0x1c')]?_0xde14('0x1d'):''));}else{logger[_0xde14('0x13')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xde14('0x5')]['id'],this[_0xde14('0x6')]['id']);setTimeout(this[_0xde14('0x10')]['bind'](this),0x3e8);}}};Agent[_0xde14('0xf')]['handleTimeout']=function(_0x2760f9){if(_[_0xde14('0x1e')](this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']])){return logger[_0xde14('0x13')](_0xde14('0x14'),this[_0xde14('0x5')]['id'],this['agent']['id']);}else{logger[_0xde14('0x13')](_0xde14('0x1f'),this['squeue']['id'],this[_0xde14('0x6')]['id']);util['hideNotification'](this[_0xde14('0x4')],this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],null,this['routing']);this[_0xde14('0x7')][_0xde14('0x12')][this['agent']['id']][_0xde14('0x16')]=![];this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']][_0xde14('0x17')]=undefined;util[_0xde14('0x20')](this[_0xde14('0x7')],this[_0xde14('0x8')],this[_0xde14('0x6')],this['squeue']['channel']);util[_0xde14('0x1b')](this[_0xde14('0x5')]['id'],this[_0xde14('0x7')][_0xde14('0x12')][this[_0xde14('0x6')]['id']],_0x2760f9?_0xde14('0x21'):_0xde14('0x22'));}if(!_0x2760f9){setTimeout(this[_0xde14('0x10')][_0xde14('0xa')](this),0x3e8);}};function agent(_0x4e33e0,_0x1854d3,_0x48c043,_0x4a363c){return new Agent(_0x4e33e0,_0x1854d3,_0x48c043,_0x4a363c);}module['exports']=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 85458dd..fb3fad1 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 _0xd6ce=['Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','busyQueue','name','channel','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','isNil'];(function(_0x2e3fbe,_0x150d06){var _0x3ec45c=function(_0x16d41e){while(--_0x16d41e){_0x2e3fbe['push'](_0x2e3fbe['shift']());}};_0x3ec45c(++_0x150d06);}(_0xd6ce,0x187));var _0xed6c=function(_0x5b3413,_0x22d14a){_0x5b3413=_0x5b3413-0x0;var _0x111205=_0xd6ce[_0x5b3413];return _0x111205;};'use strict';var _=require(_0xed6c('0x0'));var uuid=require(_0xed6c('0x1'));var util=require(_0xed6c('0x2'));var logger=require(_0xed6c('0x3'))(_0xed6c('0x4'));var Beepall=function(_0x5033dd,_0x363930,_0x1e4fd2,_0x1ec3dc){this[_0xed6c('0x5')]=uuid['v4']();this[_0xed6c('0x6')]=_0x5033dd;this[_0xed6c('0x7')]=_0x363930;this[_0xed6c('0x8')]=_0x1e4fd2;this[_0xed6c('0x4')]=_0x1ec3dc;this[_0xed6c('0x6')][_0xed6c('0x9')](this[_0xed6c('0xa')]['bind'](this),this[_0xed6c('0xb')][_0xed6c('0xc')](this));this[_0xed6c('0x6')]['on']('timeout',this[_0xed6c('0xb')][_0xed6c('0xc')](this));this['squeue']['on'](_0xed6c('0xd'),this[_0xed6c('0xe')][_0xed6c('0xc')](this));};Beepall[_0xed6c('0xf')][_0xed6c('0x9')]=function(){this[_0xed6c('0x6')][_0xed6c('0x9')](this['handleRun'][_0xed6c('0xc')](this),this[_0xed6c('0xb')][_0xed6c('0xc')](this));};Beepall[_0xed6c('0xf')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall[_0xed6c('0xf')][_0xed6c('0xa')]=function(){var _0x466cca=!![];if(!_[_0xed6c('0x10')](this[_0xed6c('0x7')])&&!_['isNil'](this['queue'][_0xed6c('0x11')])&&this[_0xed6c('0x7')][_0xed6c('0x11')][_0xed6c('0x12')]>0x0){for(var _0x8aacb8=0x0,_0x278420;_0x8aacb80x0){for(var _0x48a815=0x0,_0x211968;_0x48a8150x0&&_0x5d6a8f[_0x18deea+_0xfad9('0x25')]>=_0x5d6a8f[_0x18deea+_0xfad9('0x24')]){writeLog(_0x5e73fd,_0x5d6a8f,_0x18deea[_0xfad9('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xfad9('0x27')]=function(_0x4781c2,_0x1e7c44,_0x174ec9,_0x39f094,_0x51ee01){return sendNotification(!![],_0x4781c2,_0x1e7c44,_0x174ec9,_0x39f094,_0x51ee01);};exports[_0xfad9('0x28')]=function(_0x4beffe,_0x4487c6,_0x1d69d6,_0x58afa4,_0x57e717){return sendNotification(![],_0x4beffe,_0x4487c6,_0x1d69d6,_0x58afa4,_0x57e717);};exports[_0xfad9('0x29')]=function(_0xa2449e,_0x584fc1,_0x38c053){var _0x5e61c9=_0x584fc1[_0xfad9('0x2a')]['UserId'];if(!_0x5e61c9&&_0x38c053){_0x5e61c9=_0x38c053['id'];}var _0x1d2995=_['some'](_0xa2449e[_0x584fc1[_0xfad9('0x2b')]+_0xfad9('0x2c')],function(_0x5df822){var _0x1c72cd=_[_0xfad9('0x2d')](_0x584fc1[_0xfad9('0x2b')])+'InteractionId';return _0x5df822[_0x1c72cd]===_0x584fc1[_0xfad9('0x2a')]['id'];});if(!_0x1d2995&&_0x5e61c9&&_0xa2449e[_0xfad9('0x2e')][_0x5e61c9]){_0x1d2995=_[_0xfad9('0x2f')](_0xa2449e[_0xfad9('0x2e')][_0x5e61c9][_0x584fc1[_0xfad9('0x2b')]+'WaitingInteractions'],function(_0x3fbdbd){return _0x3fbdbd['id']===_0x584fc1[_0xfad9('0x2a')]['id'];});}return _0x1d2995;};exports[_0xfad9('0x30')]=function(_0x301f3d,_0x4f59fe,_0x5e45c3,_0x424151){if(_0x5e45c3&&_0x5e45c3['id']&&_0x301f3d['agents']&&_0x301f3d[_0xfad9('0x2e')][_0x5e45c3['id']]){_0x301f3d[_0xfad9('0x2e')][_0x5e45c3['id']][_0x424151+_0xfad9('0x31')][_0x4f59fe[_0xfad9('0x16')]['id']]={'id':_0x4f59fe[_0xfad9('0x2a')]['id']};}};exports[_0xfad9('0x32')]=function(_0x39e631,_0x6e1a9,_0x5779c3,_0x3ead13){if(_0x5779c3&&_0x5779c3['id']&&_0x39e631[_0xfad9('0x2e')]&&_0x39e631[_0xfad9('0x2e')][_0x5779c3['id']]){delete _0x39e631[_0xfad9('0x2e')][_0x5779c3['id']][_0x3ead13+'WaitingInteractions'][_0x6e1a9[_0xfad9('0x16')]['id']];}};exports[_0xfad9('0x33')]=writeLog; \ No newline at end of file +var _0xa8fd=['Capacity','CurrentCapacity','toUpperCase','checkWaitingNotifications','interaction','some','channel','QueuesWaitingInteractions','capitalize','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','socket.io-emitter','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','PAUSE'];(function(_0x22b3be,_0x429b62){var _0x36dbd9=function(_0x594d1a){while(--_0x594d1a){_0x22b3be['push'](_0x22b3be['shift']());}};_0x36dbd9(++_0x429b62);}(_0xa8fd,0x69));var _0xda8f=function(_0x53ebc0,_0x13a560){_0x53ebc0=_0x53ebc0-0x0;var _0x286172=_0xa8fd[_0x53ebc0];return _0x286172;};'use strict';var _=require('lodash');var util=require(_0xda8f('0x0'));var utils=require(_0xda8f('0x1'));var Redis=require(_0xda8f('0x2'));var config=require(_0xda8f('0x3'));var logger=require(_0xda8f('0x4'))(_0xda8f('0x5'));config['redis']=_[_0xda8f('0x6')](config[_0xda8f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xda8f('0x8'))(new Redis(config[_0xda8f('0x7')]));function sendNotification(_0x1b873d,_0x253d38,_0x587390,_0x1cfc19,_0x4fc50b,_0x5e1e10){var _0x3d65a9=_0x5e1e10||{};var _0xfd863b=_0x587390['split']('.');var _0xcb4ff2={'uniqueid':_0x253d38,'channel':_0xfd863b[0x0],'id':_0xfd863b[0x1],'title':_0xfd863b[0x0]+_0xda8f('0x9'),'interactionId':_0xfd863b[0x2],'queue':_0x4fc50b?_0x4fc50b[_0xda8f('0xa')]:null,'sound':_0x3d65a9[_0xda8f('0xb')][_0xda8f('0xc')],'shake':_0x3d65a9['account'][_0xda8f('0xd')]};try{if(!_0x3d65a9[_0xda8f('0xe')]){_0x3d65a9[_0xda8f('0xe')]={};}if(_0x4fc50b){_0x3d65a9[_0xda8f('0xe')][_0xda8f('0xf')]=_0x4fc50b;}else if(_0x3d65a9[_0xda8f('0xe')]['queue']){delete _0x3d65a9[_0xda8f('0xe')][_0xda8f('0xf')];}_0xcb4ff2[_0xda8f('0x10')]=utils['getMustacheRender'](_0x3d65a9[_0xda8f('0xb')][_0xda8f('0x11')],_0x3d65a9);}catch(_0xeb2aad){_0xcb4ff2[_0xda8f('0x10')]=_0xda8f('0x12');logger[_0xda8f('0x13')](util[_0xda8f('0x14')](_0xda8f('0x15'),_0x253d38,_0xeb2aad[_0xda8f('0x16')]));}io['to'](util[_0xda8f('0x14')](_0xda8f('0x17'),_0x1cfc19['name']))['emit'](util['format'](_0xda8f('0x18'),_0x1b873d?'save':_0xda8f('0x19')),_0xcb4ff2);}function writeLog(_0x385d38,_0x121792,_0xa2aea2){return logger[_0xda8f('0x1a')](util[_0xda8f('0x14')](_0xda8f('0x1b'),_0x385d38,_0x121792['name'],_0xa2aea2));}exports[_0xda8f('0x1c')]=function(_0x226861,_0x2b250d,_0x345963,_0x5dff4b){if(_0x2b250d[_0xda8f('0x1d')]){writeLog(_0x226861,_0x2b250d,_0xda8f('0x1e'));return![];}if(!_0x2b250d['online']){writeLog(_0x226861,_0x2b250d,_0xda8f('0x1f'));return![];}if(_0x2b250d[_0x345963+'Pause']){writeLog(_0x226861,_0x2b250d,_0xda8f('0x20'));return![];}if(_0x5dff4b&&_0x2b250d['hasOwnProperty'](_0x345963+_0xda8f('0x21'))&&_0x2b250d['hasOwnProperty'](_0x345963+_0xda8f('0x22'))){if(_0x2b250d[_0x345963+_0xda8f('0x21')]>0x0&&_0x2b250d[_0x345963+_0xda8f('0x22')]>=_0x2b250d[_0x345963+_0xda8f('0x21')]){writeLog(_0x226861,_0x2b250d,_0x345963[_0xda8f('0x23')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x909745,_0x213969,_0x1b4280,_0x18be40,_0x50621b){return sendNotification(!![],_0x909745,_0x213969,_0x1b4280,_0x18be40,_0x50621b);};exports['hideNotification']=function(_0x551cdf,_0x21207b,_0x167f9b,_0x53aed5,_0xc99b82){return sendNotification(![],_0x551cdf,_0x21207b,_0x167f9b,_0x53aed5,_0xc99b82);};exports[_0xda8f('0x24')]=function(_0x483b28,_0x1a462a,_0x3b9cf5){var _0x3c086=_0x1a462a[_0xda8f('0x25')]['UserId'];if(!_0x3c086&&_0x3b9cf5){_0x3c086=_0x3b9cf5['id'];}var _0x3abb51=_[_0xda8f('0x26')](_0x483b28[_0x1a462a[_0xda8f('0x27')]+_0xda8f('0x28')],function(_0x2bd959){var _0x361015=_[_0xda8f('0x29')](_0x1a462a[_0xda8f('0x27')])+'InteractionId';return _0x2bd959[_0x361015]===_0x1a462a['interaction']['id'];});if(!_0x3abb51&&_0x3c086&&_0x483b28[_0xda8f('0x2a')][_0x3c086]){_0x3abb51=_[_0xda8f('0x26')](_0x483b28[_0xda8f('0x2a')][_0x3c086][_0x1a462a[_0xda8f('0x27')]+_0xda8f('0x2b')],function(_0x253181){return _0x253181['id']===_0x1a462a[_0xda8f('0x25')]['id'];});}return _0x3abb51;};exports[_0xda8f('0x2c')]=function(_0x278b1a,_0x287431,_0x5e365a,_0x1d251e){if(_0x5e365a&&_0x5e365a['id']&&_0x278b1a[_0xda8f('0x2a')]&&_0x278b1a['agents'][_0x5e365a['id']]){_0x278b1a[_0xda8f('0x2a')][_0x5e365a['id']][_0x1d251e+_0xda8f('0x2b')][_0x287431[_0xda8f('0x16')]['id']]={'id':_0x287431[_0xda8f('0x25')]['id']};}};exports[_0xda8f('0x2d')]=function(_0x2ceee9,_0x3eab16,_0x48c195,_0x3439e7){if(_0x48c195&&_0x48c195['id']&&_0x2ceee9[_0xda8f('0x2a')]&&_0x2ceee9['agents'][_0x48c195['id']]){delete _0x2ceee9['agents'][_0x48c195['id']][_0x3439e7+_0xda8f('0x2b')][_0x3eab16[_0xda8f('0x16')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 3c92540..cf5d15d 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 _0x0379=['next','validate','shelljs','./utils','../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x543cad,_0x5e404d){var _0x2d88ae=function(_0xf15f2c){while(--_0xf15f2c){_0x543cad['push'](_0x543cad['shift']());}};_0x2d88ae(++_0x5e404d);}(_0x0379,0x114));var _0x9037=function(_0x3eae39,_0x53a1ee){_0x3eae39=_0x3eae39-0x0;var _0x16bde3=_0x0379[_0x3eae39];return _0x16bde3;};'use strict';var schema=require(_0x9037('0x0'));var sh=require(_0x9037('0x1'));var _=require('lodash');var utils=require(_0x9037('0x2'));var logger=require(_0x9037('0x3'))(_0x9037('0x4'));var system=schema({'command':{'type':_0x9037('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9037('0x6')]=function(_0x15c389,_0x4f802e){return function(_0x345a59){try{var _0x410e3e={'command':_0x4f802e[0x0]};var _0x514723=system[_0x9037('0x0')](_0x410e3e,{'typecast':!![]});if(_0x514723[_0x9037('0x7')]){logger[_0x9037('0x8')](_0x9037('0x9'),_0x15c389,_[_0x9037('0xa')](_0x514723,_0x9037('0xb'))[_0x9037('0xc')](',\x20'));logger[_0x9037('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x15c389);_0x345a59['next']();}else{var _0x35948e=this;var _0x5214e5=utils[_0x9037('0xe')](_0x4f802e[0x0],this);logger[_0x9037('0xd')](_0x9037('0xf'),_0x15c389,_0x5214e5);sh[_0x9037('0x10')](_[_0x9037('0x11')](_0x5214e5),function(_0x5c8ee7,_0x242e12){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x15c389,_0x5c8ee7);if(_0x5c8ee7==0x0){var _0x144c50=_0x242e12[_0x9037('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x4f802e[0x1])||_[_0x9037('0x13')](_0x4f802e[0x1])){logger[_0x9037('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x15c389);_0x35948e[_0x9037('0x14')][_0x4f802e[0x1]]=_0x144c50;}else{logger['info'](_0x9037('0x15'),_0x15c389,_0x4f802e[0x1],_0x144c50);_0x35948e[_0x9037('0x14')][_0x4f802e[0x1]]=_0x144c50;}}_0x345a59['next']();});}}catch(_0x3b932e){logger[_0x9037('0x8')](_0x9037('0x9'),_0x15c389,_['isObject'](_0x3b932e)?JSON[_0x9037('0x16')](_0x3b932e):_0x3b932e);logger[_0x9037('0xd')](_0x9037('0x17'),_0x15c389);_0x345a59[_0x9037('0x18')]();}};}; \ No newline at end of file +var _0x1521=['routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger'];(function(_0x3773c6,_0xe73e52){var _0x21acd3=function(_0x2c0682){while(--_0x2c0682){_0x3773c6['push'](_0x3773c6['shift']());}};_0x21acd3(++_0xe73e52);}(_0x1521,0x11c));var _0x1152=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0x1521[_0x17b0d4];return _0x2d02c7;};'use strict';var schema=require('validate');var sh=require(_0x1152('0x0'));var _=require(_0x1152('0x1'));var utils=require(_0x1152('0x2'));var logger=require(_0x1152('0x3'))(_0x1152('0x4'));var system=schema({'command':{'type':_0x1152('0x5'),'required':!![],'message':_0x1152('0x6')}});exports['consequence']=function(_0x410c7b,_0x5c8314){return function(_0x354b22){try{var _0xf59dec={'command':_0x5c8314[0x0]};var _0x10a765=system['validate'](_0xf59dec,{'typecast':!![]});if(_0x10a765[_0x1152('0x7')]){logger[_0x1152('0x8')](_0x1152('0x9'),_0x410c7b,_['map'](_0x10a765,_0x1152('0xa'))[_0x1152('0xb')](',\x20'));logger[_0x1152('0xc')](_0x1152('0xd'),_0x410c7b);_0x354b22[_0x1152('0xe')]();}else{var _0x52dbab=this;var _0xc472c7=utils[_0x1152('0xf')](_0x5c8314[0x0],this);logger[_0x1152('0xc')](_0x1152('0x10'),_0x410c7b,_0xc472c7);sh[_0x1152('0x11')](_[_0x1152('0x12')](_0xc472c7),function(_0x377597,_0xde8c96){logger['info'](_0x1152('0x13'),_0x410c7b,_0x377597);if(_0x377597==0x0){var _0x357087=_0xde8c96['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5c8314[0x1])||_['isEmpty'](_0x5c8314[0x1])){logger[_0x1152('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x410c7b);_0x52dbab[_0x1152('0x14')][_0x5c8314[0x1]]=_0x357087;}else{logger['info'](_0x1152('0x15'),_0x410c7b,_0x5c8314[0x1],_0x357087);_0x52dbab[_0x1152('0x14')][_0x5c8314[0x1]]=_0x357087;}}_0x354b22['next']();});}}catch(_0x397e42){logger[_0x1152('0x8')](_0x1152('0x9'),_0x410c7b,_[_0x1152('0x16')](_0x397e42)?JSON[_0x1152('0x17')](_0x397e42):_0x397e42);logger['info'](_0x1152('0xd'),_0x410c7b);_0x354b22['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 0742aa8..753a561 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 _0x5e2a=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','next','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x5e2a,0x157));var _0xa5e2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e2a[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xa5e2('0x0'));var _=require(_0xa5e2('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xa5e2('0x2')),'smsInteraction':require(_0xa5e2('0x3')),'mailInteraction':require(_0xa5e2('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xa5e2('0x5'))};var logger=require(_0xa5e2('0x6'))(_0xa5e2('0x7'));var tag=schema({'tag':{'type':_0xa5e2('0x8'),'required':!![],'message':_0xa5e2('0x9')}});exports[_0xa5e2('0xa')]=function(_0x3a61b6,_0x4268c3,_0x247e0e,_0xca5bb){return function(_0x1550f8){try{var _0x393837={'tag':_0x4268c3[0x0]};var _0x114738=tag[_0xa5e2('0x0')](_0x393837,{'typecast':!![]});if(_0x114738[_0xa5e2('0xb')]){logger[_0xa5e2('0xc')](_0xa5e2('0xd'),_0x3a61b6,_[_0xa5e2('0xe')](_0x114738,_0xa5e2('0xf'))[_0xa5e2('0x10')](',\x20'));logger[_0xa5e2('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3a61b6);_0x1550f8[_0xa5e2('0x12')]();}else{var _0x27eab1={'ids':[_0x4268c3[0x0]]};if(rpc[_0xca5bb[_0xa5e2('0x13')]+'Interaction']){rpc[_0xca5bb[_0xa5e2('0x13')]+'Interaction']['addTags'](_0xca5bb[_0xa5e2('0x14')]['id'],_0x27eab1)[_0xa5e2('0x15')](function(_0x12e2c6){logger['info'](_0xa5e2('0x16'),_0x3a61b6,_0x4268c3[0x1],_0xca5bb[_0xa5e2('0x13')],_0xca5bb['interaction']['id']);})['catch'](function(_0x1140ef){logger['error'](_0xa5e2('0xd'),_0x3a61b6,JSON[_0xa5e2('0x17')](_0x1140ef));logger['info'](_0xa5e2('0x18'),_0x3a61b6);})[_0xa5e2('0x19')](function(){_0x1550f8[_0xa5e2('0x12')]();});}}}catch(_0x171aa9){logger['error'](_0xa5e2('0xd'),_0x3a61b6,_[_0xa5e2('0x1a')](_0x171aa9)?JSON['stringify'](_0x171aa9):_0x171aa9);logger[_0xa5e2('0x11')](_0xa5e2('0x18'),_0x3a61b6);_0x1550f8[_0xa5e2('0x12')]();}};}; \ No newline at end of file +var _0x6832=['interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags'];(function(_0x3177a3,_0x3673c0){var _0x2a6679=function(_0x3dd73d){while(--_0x3dd73d){_0x3177a3['push'](_0x3177a3['shift']());}};_0x2a6679(++_0x3673c0);}(_0x6832,0x129));var _0x2683=function(_0x81e851,_0x2226ff){_0x81e851=_0x81e851-0x0;var _0x52cc7e=_0x6832[_0x81e851];return _0x52cc7e;};'use strict';var schema=require(_0x2683('0x0'));var _=require(_0x2683('0x1'));var rpc={'chatInteraction':require(_0x2683('0x2')),'openchannelInteraction':require(_0x2683('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x2683('0x4')),'faxInteraction':require(_0x2683('0x5')),'whatsappInteraction':require(_0x2683('0x6'))};var logger=require(_0x2683('0x7'))(_0x2683('0x8'));var tag=schema({'tag':{'type':_0x2683('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x2683('0xa')]=function(_0x51d70d,_0x2d99ca,_0x2f8744,_0x536d4c){return function(_0x32c875){try{var _0x3b1f5f={'tag':_0x2d99ca[0x0]};var _0x354b78=tag[_0x2683('0x0')](_0x3b1f5f,{'typecast':!![]});if(_0x354b78['length']){logger[_0x2683('0xb')](_0x2683('0xc'),_0x51d70d,_[_0x2683('0xd')](_0x354b78,_0x2683('0xe'))[_0x2683('0xf')](',\x20'));logger[_0x2683('0x10')](_0x2683('0x11'),_0x51d70d);_0x32c875[_0x2683('0x12')]();}else{var _0x485d4d={'ids':[_0x2d99ca[0x0]]};if(rpc[_0x536d4c[_0x2683('0x13')]+'Interaction']){rpc[_0x536d4c[_0x2683('0x13')]+_0x2683('0x14')][_0x2683('0x15')](_0x536d4c[_0x2683('0x16')]['id'],_0x485d4d)[_0x2683('0x17')](function(_0x51df0b){logger[_0x2683('0x10')](_0x2683('0x18'),_0x51d70d,_0x2d99ca[0x1],_0x536d4c['channel'],_0x536d4c[_0x2683('0x16')]['id']);})[_0x2683('0x19')](function(_0xd7b269){logger[_0x2683('0xb')]('[%s][TAG]\x20%s',_0x51d70d,JSON[_0x2683('0x1a')](_0xd7b269));logger[_0x2683('0x10')](_0x2683('0x11'),_0x51d70d);})[_0x2683('0x1b')](function(){_0x32c875[_0x2683('0x12')]();});}}}catch(_0x5b67e6){logger[_0x2683('0xb')](_0x2683('0xc'),_0x51d70d,_[_0x2683('0x1c')](_0x5b67e6)?JSON[_0x2683('0x1a')](_0x5b67e6):_0x5b67e6);logger[_0x2683('0x10')](_0x2683('0x11'),_0x51d70d);_0x32c875[_0x2683('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 60e5d02..4b85f15 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 _0x17f0=['consequence','\x20-\x20','replace','includes','push','urlOnRing','?params=','title','jsonrpc','2.0','login','params','stringify','utf8','POST','application/json-rpc','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','info','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash'];(function(_0x415994,_0x69723a){var _0x15d655=function(_0x5a8b59){while(--_0x5a8b59){_0x415994['push'](_0x415994['shift']());}};_0x15d655(++_0x69723a);}(_0x17f0,0x10a));var _0x017f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x17f0[_0x4e676e];return _0x336a3c;};'use strict';var rp=require(_0x017f('0x0'));var logger=require(_0x017f('0x1'))(_0x017f('0x2'));var _=require(_0x017f('0x3'));var arr=[];exports[_0x017f('0x4')]=function(_0x33764f,_0x411d7d){return function(_0x59c85c){var _0x372dab=_0x411d7d[0xa];var _0x59b4c4=_0x411d7d[0xb];var _0x293dad=_0x411d7d[0xc];var _0x4589be=_0x411d7d[0xd];var _0x2a60de=_0x411d7d[0xe];var _0x5f283f=_0x411d7d[0xf]['replace'](/\n/g,_0x017f('0x5'));var _0x5608d6=_0x411d7d[0x10][_0x017f('0x6')](/\n/g,'\x20');if(!arr[_0x017f('0x7')](_0x59b4c4)){arr[_0x017f('0x8')](_0x59b4c4);var _0x2871f3=_0x411d7d[0x3];var _0x547798=_0x411d7d[0x4];var _0x1d8f3e=_0x411d7d[0x1];var _0x376dd4=_0x411d7d[0x0];var _0x4f20d8={};_0x4f20d8['urlOnAnswer']=_0x411d7d[0x8]+'?params='+_0x293dad+'|'+_0x372dab+'|'+_0x4589be+'|'+_0x59b4c4+'|'+_0x2a60de;_0x4f20d8[_0x017f('0x9')]=_0x411d7d[0x7]+_0x017f('0xa')+_0x293dad+'|'+_0x372dab+'|'+_0x4589be+'|'+_0x59b4c4+'|'+_0x2a60de+'|'+_0x5f283f+'|'+_0x5608d6;_0x4f20d8[_0x017f('0xb')]=_0x411d7d[0x9];var _0x3c2e90={};_0x3c2e90[_0x017f('0xc')]=_0x017f('0xd');_0x3c2e90['method']=_0x017f('0xe');var _0x211e8e=[];_0x211e8e[_0x017f('0x8')](_0x411d7d[0x2]);_0x211e8e[_0x017f('0x8')](_0x411d7d[0x5]);_0x211e8e['push'](_0x411d7d[0x6]);_0x3c2e90[_0x017f('0xf')]=_0x211e8e;_0x3c2e90['id']=0x1;var _0x410a66=JSON[_0x017f('0x10')](_0x3c2e90);var _0x97191={'encoding':_0x017f('0x11'),'method':_0x017f('0x12'),'timeout':0x2710,'url':_0x2871f3,'headers':{'Content-Type':_0x017f('0x13')},'body':_0x410a66};return rp(_0x97191)['then'](function(_0x55fac1){const _0x269c0c=JSON['parse'](_0x55fac1);if(!_0x269c0c[_0x017f('0x14')]['logged']){throw new Error(_0x017f('0x15'));}var _0x316eb8=_0x59b4c4;var _0x9b7596=_0x017f('0x16')+_0x1d8f3e+'&serviceId='+_0x376dd4+'&sessionId='+_0x316eb8+'&data='+JSON['stringify'](_0x4f20d8);var _0x4dfb35=_0x547798+'?'+_0x9b7596;return rp(_0x4dfb35);})['then'](function(_0xcc22c7){logger[_0x017f('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x33764f,_0xcc22c7);_0x59c85c[_0x017f('0x18')]();})[_0x017f('0x19')](function(_0x5d9971){logger['error'](_0x017f('0x1a'),_0x33764f,_[_0x017f('0x1b')](_0x5d9971)?JSON[_0x017f('0x10')](_0x5d9971):_0x5d9971);_0x59c85c[_0x017f('0x18')]();});}else{logger[_0x017f('0x17')](_0x017f('0x1c'),_0x33764f);_0x59c85c[_0x017f('0x1d')]();}};}; \ No newline at end of file +var _0xc3d0=['routing','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','login','params','stringify','utf8','POST','application/json-rpc','then','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','error','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger'];(function(_0x7b9863,_0x167a95){var _0xefe17d=function(_0x2de1ae){while(--_0x2de1ae){_0x7b9863['push'](_0x7b9863['shift']());}};_0xefe17d(++_0x167a95);}(_0xc3d0,0xb2));var _0x0c3d=function(_0x9fc9ad,_0x1e84ca){_0x9fc9ad=_0x9fc9ad-0x0;var _0x46f550=_0xc3d0[_0x9fc9ad];return _0x46f550;};'use strict';var rp=require(_0x0c3d('0x0'));var logger=require(_0x0c3d('0x1'))(_0x0c3d('0x2'));var _=require('lodash');var arr=[];exports[_0x0c3d('0x3')]=function(_0x2db6f0,_0x23c504){return function(_0xcde11c){var _0x578a05=_0x23c504[0xa];var _0x451152=_0x23c504[0xb];var _0x593284=_0x23c504[0xc];var _0x53c8c1=_0x23c504[0xd];var _0x3cf052=_0x23c504[0xe];var _0x96fe39=_0x23c504[0xf][_0x0c3d('0x4')](/\n/g,_0x0c3d('0x5'));var _0x41d554=_0x23c504[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x0c3d('0x6')](_0x451152)){arr[_0x0c3d('0x7')](_0x451152);var _0x30dde9=_0x23c504[0x3];var _0xc6f7d1=_0x23c504[0x4];var _0x3a1717=_0x23c504[0x1];var _0x265767=_0x23c504[0x0];var _0x57242a={};_0x57242a[_0x0c3d('0x8')]=_0x23c504[0x8]+_0x0c3d('0x9')+_0x593284+'|'+_0x578a05+'|'+_0x53c8c1+'|'+_0x451152+'|'+_0x3cf052;_0x57242a['urlOnRing']=_0x23c504[0x7]+_0x0c3d('0x9')+_0x593284+'|'+_0x578a05+'|'+_0x53c8c1+'|'+_0x451152+'|'+_0x3cf052+'|'+_0x96fe39+'|'+_0x41d554;_0x57242a[_0x0c3d('0xa')]=_0x23c504[0x9];var _0x57df87={};_0x57df87[_0x0c3d('0xb')]='2.0';_0x57df87['method']=_0x0c3d('0xc');var _0x171881=[];_0x171881['push'](_0x23c504[0x2]);_0x171881['push'](_0x23c504[0x5]);_0x171881[_0x0c3d('0x7')](_0x23c504[0x6]);_0x57df87[_0x0c3d('0xd')]=_0x171881;_0x57df87['id']=0x1;var _0x4844b3=JSON[_0x0c3d('0xe')](_0x57df87);var _0x35fc9a={'encoding':_0x0c3d('0xf'),'method':_0x0c3d('0x10'),'timeout':0x2710,'url':_0x30dde9,'headers':{'Content-Type':_0x0c3d('0x11')},'body':_0x4844b3};return rp(_0x35fc9a)[_0x0c3d('0x12')](function(_0x46cd88){const _0x28a2c0=JSON[_0x0c3d('0x13')](_0x46cd88);if(!_0x28a2c0['result']['logged']){throw new Error(_0x0c3d('0x14'));}var _0x41e381=_0x451152;var _0x38ef26=_0x0c3d('0x15')+_0x3a1717+_0x0c3d('0x16')+_0x265767+'&sessionId='+_0x41e381+_0x0c3d('0x17')+JSON[_0x0c3d('0xe')](_0x57242a);var _0x54d6d3=_0xc6f7d1+'?'+_0x38ef26;return rp(_0x54d6d3);})[_0x0c3d('0x12')](function(_0x2aee2f){logger[_0x0c3d('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x2db6f0,_0x2aee2f);_0xcde11c['stop']();})['catch'](function(_0x34030b){logger[_0x0c3d('0x19')]('[%s][TVOX]\x20%s',_0x2db6f0,_[_0x0c3d('0x1a')](_0x34030b)?JSON[_0x0c3d('0xe')](_0x34030b):_0x34030b);_0xcde11c[_0x0c3d('0x1b')]();});}else{logger['info'](_0x0c3d('0x1c'),_0x2db6f0);_0xcde11c[_0x0c3d('0x1d')]();}};}; \ 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 c4226e2..bc85ec8 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(_0x1a7c4f,_0x462e83){var _0x1679e6=function(_0xe59f0){while(--_0xe59f0){_0x1a7c4f['push'](_0x1a7c4f['shift']());}};_0x1679e6(++_0x462e83);}(_0xe706,0xa3));var _0x6e70=function(_0x151b2a,_0x2b88b8){_0x151b2a=_0x151b2a-0x0;var _0x5c2c04=_0xe706[_0x151b2a];return _0x5c2c04;};'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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x577902,_0x39c428){var _0x23a9d4=function(_0xa385ef){while(--_0xa385ef){_0x577902['push'](_0x577902['shift']());}};_0x23a9d4(++_0x39c428);}(_0xe706,0xa3));var _0x6e70=function(_0xada87a,_0x16223c){_0xada87a=_0xada87a-0x0;var _0x7ad44c=_0xe706[_0xada87a];return _0x7ad44c;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index f5205c8..6c4a8e1 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 _0x043b=['info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','.js','autoreply','mail','push','slice','dialogflow','split','dialogflowv2','appdata','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','app','./interval','condition','intervals','./applications/','consequence','priority'];(function(_0x301dc5,_0x2adeb4){var _0x173c15=function(_0x46f009){while(--_0x46f009){_0x301dc5['push'](_0x301dc5['shift']());}};_0x173c15(++_0x2adeb4);}(_0x043b,0xa0));var _0xb043=function(_0x20b50f,_0xc24bfb){_0x20b50f=_0x20b50f-0x0;var _0x3173ff=_0x043b[_0x20b50f];return _0x3173ff;};'use strict';var _=require(_0xb043('0x0'));var util=require(_0xb043('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xb043('0x2'));var utils=require(_0xb043('0x3'));var sUtils=require(_0xb043('0x4'));var logger=require(_0xb043('0x5'))(_0xb043('0x6'));var rpc={'openchannelQueueReport':require(_0xb043('0x7')),'mailQueueReport':require(_0xb043('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xb043('0x9'))};var RuleEngine=require(_0xb043('0xa'));function getId(_0x4e2a0f,_0x251f5b,_0x1115c0){return util[_0xb043('0xb')](_0xb043('0xc'),_0x4e2a0f,_0x251f5b||0x0,_0x1115c0||0x0);}function getIntervals(_0x5334c5,_0x466849){var _0x52c9b0=[];if(!_[_0xb043('0xd')](_0x466849[_0xb043('0xe')])&&!_['isNil'](_0x5334c5[_0x466849['IntervalId']])&&!_[_0xb043('0xd')](_0x5334c5[_0x466849[_0xb043('0xe')]][_0xb043('0xf')])){_0x52c9b0=_[_0xb043('0x10')](_0x5334c5[_0x466849[_0xb043('0xe')]][_0xb043('0xf')],'interval');}else if(!_[_0xb043('0xd')](_0x466849[_0xb043('0x11')])){_0x52c9b0=[_0x466849['interval']];}return _0x52c9b0;}exports[_0xb043('0x12')]=function(_0x3c7a6e){_0x3c7a6e[_0xb043('0x13')]={};return new BPromise(function(_0x1adc9f,_0x41d9ed){var _0x1ab913={'Start':function(_0x484939){var _0x364248=this;return new Promise(function(_0x3da725,_0x1b0b37){if(_0x484939){try{var _0x4c7c53=[];var _0x397c94=getId(_0x484939[_0xb043('0x14')],_0x484939[_0xb043('0x15')]?_0x484939[_0xb043('0x15')]['id']:0x0,_0x484939[_0xb043('0x16')]?_0x484939[_0xb043('0x16')]['id']:0x0);var _0x13ad02=sUtils[_0xb043('0x17')](_0x3c7a6e,_0x484939);if(_0x484939['transfer']||!_0x13ad02&&_0x484939[_0xb043('0x18')]&&_[_0xb043('0x19')](_0x484939['applications'])&&_0x484939[_0xb043('0x18')][_0xb043('0x1a')]){for(var _0x31d6df=0x0;_0x31d6df<_0x484939[_0xb043('0x18')][_0xb043('0x1a')];_0x31d6df+=0x1){var _0x52ae2d=_0x484939[_0xb043('0x18')][_0x31d6df];if(fs[_0xb043('0x1b')](path[_0xb043('0x1c')](__dirname,'applications',_0x52ae2d['app']+_0xb043('0x1d')))){var _0x52a8c7=[];switch(_0x52ae2d['app']['toLowerCase']()){case _0xb043('0x1e'):var _0xf63fe4=_0x52ae2d['appdata']['split'](',');if(_0x484939[_0xb043('0x14')]===_0xb043('0x1f')){_0x52a8c7[_0xb043('0x20')](_0xf63fe4[0x0]);_0x52a8c7[_0xb043('0x20')](_0xf63fe4[0x1]);_0x52a8c7[_0xb043('0x20')](_0xf63fe4[_0xb043('0x21')](0x2,_0xf63fe4[_0xb043('0x1a')])[_0xb043('0x1c')](','));}else{_0x52a8c7['push'](_0xf63fe4[0x0]);_0x52a8c7['push'](_0xf63fe4[_0xb043('0x21')](0x1,_0xf63fe4['length'])[_0xb043('0x1c')](','));}break;case _0xb043('0x22'):var _0x26501a=_0x52ae2d['appdata'][_0xb043('0x23')](',');_0x52a8c7[_0xb043('0x20')](_0x26501a[0x0]);_0x52a8c7[_0xb043('0x20')](_0x26501a[0x1]);_0x52a8c7[_0xb043('0x20')](_0x26501a[_0xb043('0x21')](0x2,_0x26501a['length'])[_0xb043('0x1c')](','));break;case _0xb043('0x24'):var _0x6c933b=_0x52ae2d[_0xb043('0x25')][_0xb043('0x23')](',');_0x52a8c7[_0xb043('0x20')](_0x6c933b[0x0]);_0x52a8c7['push'](_0x6c933b[0x1]);_0x52a8c7[_0xb043('0x20')](_0x6c933b[0x2]);_0x52a8c7[_0xb043('0x20')](_0x6c933b[0x3]);_0x52a8c7['push'](_0x6c933b[_0xb043('0x21')](0x4,_0x6c933b[_0xb043('0x1a')])[_0xb043('0x1c')](','));break;case _0xb043('0x26'):var _0x1ff2f8=_0x52ae2d['appdata'][_0xb043('0x23')](',');_0x52a8c7['push'](_0x1ff2f8[0x0]);_0x52a8c7[_0xb043('0x20')](_0x1ff2f8[0x1]);_0x52a8c7[_0xb043('0x20')](_0x1ff2f8[0x2]);_0x52a8c7[_0xb043('0x20')](_0x1ff2f8[0x3]);_0x52a8c7[_0xb043('0x20')](_0x1ff2f8[_0xb043('0x21')](0x4,_0x1ff2f8['length'])[_0xb043('0x1c')](','));break;case _0xb043('0x15'):_0x52a8c7[_0xb043('0x20')](_0x52ae2d[_0xb043('0x25')]);break;case _0xb043('0x27'):_0x52a8c7['push'](_0x52ae2d[_0xb043('0x28')]);_0x52a8c7['push'](_0x52ae2d[_0xb043('0x25')]);break;case _0xb043('0x29'):var _0x39b082=utils[_0xb043('0x2a')](_0x484939[_0xb043('0x2b')][_0xb043('0x2c')],_0x484939);var _0x15d7b9=_0x52ae2d[_0xb043('0x25')][_0xb043('0x23')](',');_0x52a8c7['push'](_0x15d7b9[0x0]);_0x52a8c7[_0xb043('0x20')](_0x15d7b9[0x1]);_0x52a8c7[_0xb043('0x20')](_0x15d7b9[0x2]);_0x52a8c7[_0xb043('0x20')](_0x15d7b9[0x3]);_0x52a8c7[_0xb043('0x20')](_0x15d7b9[0x4]);_0x52a8c7[_0xb043('0x20')](_0x15d7b9[0x5]);_0x52a8c7[_0xb043('0x20')](_0x15d7b9[0x6]);_0x52a8c7[_0xb043('0x20')](_0x15d7b9[0x7]);_0x52a8c7[_0xb043('0x20')](_0x15d7b9[0x8]);_0x52a8c7[_0xb043('0x20')](_0x15d7b9[0x9]);_0x52a8c7[_0xb043('0x20')](_0x15d7b9[0xa]);_0x52a8c7['push'](_0x484939[_0xb043('0x16')]['id']);_0x52a8c7[_0xb043('0x20')](_0x484939[_0xb043('0x15')]['id']);_0x52a8c7[_0xb043('0x20')](_0x52ae2d[_0xb043('0x2d')]);_0x52a8c7[_0xb043('0x20')](_0x484939['interaction'][_0xb043('0x2e')]);_0x52a8c7[_0xb043('0x20')](_0x484939[_0xb043('0x2f')][_0xb043('0x2f')]);_0x52a8c7[_0xb043('0x20')](_0x39b082);break;default:_0x52a8c7=_[_0xb043('0xd')](_0x52ae2d[_0xb043('0x25')])?[]:_0x52ae2d[_0xb043('0x25')][_0xb043('0x23')](',');}var _0x37cdfe={'id':util[_0xb043('0xb')](_0xb043('0x30'),_0x397c94,_0x52ae2d['id'],_0x52ae2d[_0xb043('0x31')]),'condition':require(_0xb043('0x32'))[_0xb043('0x33')](_0x397c94,getIntervals(_0x3c7a6e[_0xb043('0x34')],_0x52ae2d),_0x3c7a6e),'consequence':require(_0xb043('0x35')+_0x52ae2d[_0xb043('0x31')])[_0xb043('0x36')](_0x397c94,_0x52a8c7,_0x3c7a6e,_0x484939),'p':_0x52ae2d[_0xb043('0x37')]||0x0};logger[_0xb043('0x38')](_0xb043('0x39'),_0x37cdfe['id'],_0xb043('0x3a'),getIntervals(_0x3c7a6e[_0xb043('0x34')],_0x52ae2d)[_0xb043('0x1c')](_0xb043('0x3b')));_0x4c7c53[_0xb043('0x20')](_0x37cdfe);}else{logger[_0xb043('0x3c')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xb043('0x1c')](__dirname,'applications',_0x52ae2d[_0xb043('0x31')]+'.js'));}}_0x3c7a6e[_0xb043('0x13')][_0x397c94]=new RuleEngine(_0x4c7c53);_0x3c7a6e[_0xb043('0x13')][_0x397c94][_0xb043('0x3d')](_0x484939,function(_0x40232b){logger[_0xb043('0x38')](_0xb043('0x3e'),JSON[_0xb043('0x3f')](_0x40232b[_0xb043('0x40')]));if(_0x3c7a6e[_0xb043('0x13')][_0x397c94]){_0x3c7a6e[_0xb043('0x13')][_0x397c94][_0xb043('0x41')](_0xb043('0x42'));}});return _0x3da725({'code':0xc8,'message':_0x484939});}else{if(_0x13ad02){logger[_0xb043('0x38')](util[_0xb043('0xb')](_0xb043('0x43'),_0x397c94));}else{logger[_0xb043('0x38')](_0xb043('0x44'));}return _0x3da725({'code':0xc8,'message':_0x484939});}}catch(_0x2fe7d0){logger[_0xb043('0x3c')](_0x2fe7d0[_0xb043('0x45')]);return _0x1b0b37(_0x364248['error'](0x1f4,_0x2fe7d0));}}return _0x1b0b37(_0xb043('0x46'));});},'AcceptMessage':function(_0x269c63){var _0x12d75b=this;return new Promise(function(_0x559f64,_0x4f52d7){if(_0x269c63[_0xb043('0x47')]&&_0x269c63[_0xb043('0x47')]['id']){if(_0x3c7a6e[_0xb043('0x48')][_0x269c63[_0xb043('0x47')]['id']]){_0x3c7a6e[_0xb043('0x48')][_0x269c63[_0xb043('0x47')]['id']]['busy']=![];_0x3c7a6e[_0xb043('0x48')][_0x269c63[_0xb043('0x47')]['id']][_0xb043('0x49')]=undefined;}}if(_0x269c63[_0xb043('0x15')]&&_0x269c63[_0xb043('0x15')]['id']){try{var _0x50f056=getId(_0x269c63[_0xb043('0x14')],_0x269c63[_0xb043('0x15')]?_0x269c63[_0xb043('0x15')]['id']:0x0,_0x269c63[_0xb043('0x16')]?_0x269c63[_0xb043('0x16')]['id']:0x0);if(_0x3c7a6e['rules'][_0x50f056]){_0x3c7a6e[_0xb043('0x13')][_0x50f056][_0xb043('0x41')]('end');if(rpc[_0x269c63['channel']+_0xb043('0x4a')]){rpc[_0x269c63['channel']+'QueueReport'][_0xb043('0x4b')](_0x50f056,{'UserId':_0x269c63[_0xb043('0x15')][_0xb043('0x4c')]})['catch'](function(){logger[_0xb043('0x3c')](_0xb043('0x4d'));});}}return _0x559f64({'code':0xc8,'message':_0x269c63});}catch(_0x314e15){logger['error'](_0x314e15[_0xb043('0x45')]);return _0x4f52d7(_0x12d75b['error'](0x1f4,_0x314e15));}}logger[_0xb043('0x3c')](_0xb043('0x4e'));return _0x4f52d7(_0x12d75b[_0xb043('0x3c')](0x1f4,_0xb043('0x4e')));});},'RejectMessage':function(_0x239565){var _0x1eca61=this;return new Promise(function(_0x2bee2e,_0x661505){if(_0x239565[_0xb043('0x47')]&&_0x239565[_0xb043('0x47')]['id']){try{if(_0x3c7a6e[_0xb043('0x48')][_0x239565[_0xb043('0x47')]['id']]){_0x3c7a6e[_0xb043('0x48')][_0x239565['agent']['id']]['busy']=![];_0x3c7a6e[_0xb043('0x48')][_0x239565[_0xb043('0x47')]['id']][_0xb043('0x49')]=undefined;}return _0x2bee2e({'code':0xc8,'message':_0x239565});}catch(_0x5f5d0f){logger[_0xb043('0x3c')](_0x5f5d0f[_0xb043('0x45')]);return _0x661505(_0x1eca61[_0xb043('0x3c')](0x1f4,_0x5f5d0f));}}logger[_0xb043('0x3c')]('message\x20is\x20empty');return _0x661505(_0x1eca61[_0xb043('0x3c')](0x1f4,_0xb043('0x4e')));});},'AbandonInteraction':function(_0x25dc3c){var _0x300178=this;return new Promise(function(_0x4aaf04,_0x18b4b0){if(_0x25dc3c[_0xb043('0x14')]&&_0x25dc3c[_0xb043('0x16')]&&_0x25dc3c[_0xb043('0x16')]['id']){try{var _0x478624=getId(_0x25dc3c[_0xb043('0x14')],_0x25dc3c[_0xb043('0x15')]?_0x25dc3c[_0xb043('0x15')]['id']:0x0,_0x25dc3c['interaction']?_0x25dc3c[_0xb043('0x16')]['id']:0x0);if(_0x3c7a6e['rules'][_0x478624]){_0x3c7a6e[_0xb043('0x13')][_0x478624][_0xb043('0x41')](_0xb043('0x4f'));}return _0x4aaf04({'code':0xc8,'message':_0x25dc3c});}catch(_0x3b41ff){logger[_0xb043('0x3c')](_0x3b41ff[_0xb043('0x45')]);return _0x18b4b0(_0x300178['error'](0x1f4,_0x3b41ff));}}logger['error'](_0xb043('0x4e'));return _0x18b4b0(_0x300178[_0xb043('0x3c')](0x1f4,_0xb043('0x4e')));});},'AgentCapacity':function(_0x14987b){var _0x5f3b12=this;return new Promise(function(_0x41b979,_0x24b835){if(_0x3c7a6e[_0xb043('0x48')][_0xb043('0x50')](_0x14987b['id'])){for(var _0x3123c7 in _0x14987b[_0xb043('0x51')]){if(_0x14987b[_0xb043('0x51')][_0xb043('0x50')](_0x3123c7)){if(_0x3c7a6e[_0xb043('0x48')][_0x14987b['id']]['hasOwnProperty'](_0x3123c7+'CurrentCapacity')){_0x3c7a6e[_0xb043('0x48')][_0x14987b['id']][_0x3123c7+_0xb043('0x52')]=parseInt(_0x14987b[_0xb043('0x51')][_0x3123c7],0xa);}}}_0x3c7a6e['agents'][_0x14987b['id']][_0xb043('0x53')]();return _0x41b979({'code':0xc8,'message':_0x3c7a6e[_0xb043('0x48')][_0x14987b['id']]});}else{return _0x24b835(_0x5f3b12[_0xb043('0x3c')](0x1f4,_0xb043('0x54')));}});},'Agents':function(_0x436b0f){return new Promise(function(_0x5a0d35){var _0x4f5acc=_[_0xb043('0x55')](_0x3c7a6e['agents']);if(_0x436b0f&&_0x436b0f['id']){var _0x2aafea=_['find'](_0x4f5acc,function(_0x4854a9){return _0x4854a9['id']===_0x436b0f['id'];});_0x5a0d35(_0x2aafea);}else{_0x5a0d35({'count':_0x4f5acc['length'],'rows':_0x4f5acc});}});},'ChatQueues':function(){return new Promise(function(_0x54e6b9){var _0x5398c8=[];for(var _0x583186 in _0x3c7a6e['chatQueues']){if(_0x3c7a6e[_0xb043('0x56')]['hasOwnProperty'](_0x583186)){var _0x11d7f1=_0x3c7a6e[_0xb043('0x56')][_0x583186];var _0x192c98={'id':_0x11d7f1['id'],'available':_0x11d7f1[_0xb043('0x57')],'loggedIn':_0x11d7f1[_0xb043('0x58')],'name':_0x11d7f1['name'],'paused':_0x11d7f1[_0xb043('0x59')],'waiting':_0x11d7f1[_0xb043('0x5a')]};_0x5398c8[_0xb043('0x20')](_0x192c98);}}_0x54e6b9({'count':_0x5398c8[_0xb043('0x1a')],'rows':_0x5398c8});});},'MailQueues':function(){return new Promise(function(_0x310c10){var _0x1a908e=[];for(var _0x2d5977 in _0x3c7a6e['mailQueues']){if(_0x3c7a6e[_0xb043('0x5b')][_0xb043('0x50')](_0x2d5977)){var _0x3ea635=_0x3c7a6e[_0xb043('0x5b')][_0x2d5977];var _0x408358={'id':_0x3ea635['id'],'available':_0x3ea635[_0xb043('0x57')],'loggedIn':_0x3ea635['loggedIn'],'name':_0x3ea635['name'],'paused':_0x3ea635[_0xb043('0x59')],'waiting':_0x3ea635[_0xb043('0x5a')]};_0x1a908e[_0xb043('0x20')](_0x408358);}}_0x310c10({'count':_0x1a908e['length'],'rows':_0x1a908e});});},'OpenchannelQueues':function(){return new Promise(function(_0x172d1e){var _0x3e94c0=[];for(var _0x55fd74 in _0x3c7a6e['openchannelQueues']){if(_0x3c7a6e[_0xb043('0x5c')][_0xb043('0x50')](_0x55fd74)){var _0x1a10cc=_0x3c7a6e[_0xb043('0x5c')][_0x55fd74];var _0xf66187={'id':_0x1a10cc['id'],'available':_0x1a10cc[_0xb043('0x57')],'loggedIn':_0x1a10cc['loggedIn'],'name':_0x1a10cc[_0xb043('0x5d')],'paused':_0x1a10cc[_0xb043('0x59')],'waiting':_0x1a10cc[_0xb043('0x5a')]};_0x3e94c0[_0xb043('0x20')](_0xf66187);}}_0x172d1e({'count':_0x3e94c0[_0xb043('0x1a')],'rows':_0x3e94c0});});},'SmsQueues':function(){return new Promise(function(_0x35e1c7){var _0x4ae101=[];for(var _0x179311 in _0x3c7a6e[_0xb043('0x5e')]){if(_0x3c7a6e[_0xb043('0x5e')][_0xb043('0x50')](_0x179311)){var _0x12fee8=_0x3c7a6e[_0xb043('0x5e')][_0x179311];var _0x546cad={'id':_0x12fee8['id'],'available':_0x12fee8[_0xb043('0x57')],'loggedIn':_0x12fee8['loggedIn'],'name':_0x12fee8[_0xb043('0x5d')],'paused':_0x12fee8[_0xb043('0x59')],'waiting':_0x12fee8[_0xb043('0x5a')]};_0x4ae101[_0xb043('0x20')](_0x546cad);}}_0x35e1c7({'count':_0x4ae101[_0xb043('0x1a')],'rows':_0x4ae101});});},'FaxQueues':function(){return new Promise(function(_0xdac857){var _0x1acba7=[];for(var _0x135b6f in _0x3c7a6e[_0xb043('0x5f')]){if(_0x3c7a6e[_0xb043('0x5f')]['hasOwnProperty'](_0x135b6f)){var _0x39f03a=_0x3c7a6e['faxQueues'][_0x135b6f];var _0x32b448={'id':_0x39f03a['id'],'available':_0x39f03a[_0xb043('0x57')],'loggedIn':_0x39f03a[_0xb043('0x58')],'name':_0x39f03a[_0xb043('0x5d')],'paused':_0x39f03a['paused'],'waiting':_0x39f03a[_0xb043('0x5a')]};_0x1acba7[_0xb043('0x20')](_0x32b448);}}_0xdac857({'count':_0x1acba7[_0xb043('0x1a')],'rows':_0x1acba7});});},'WhatsappQueues':function(){return new Promise(function(_0x278e76){var _0x40e897=[];for(var _0x5a06a8 in _0x3c7a6e[_0xb043('0x60')]){if(_0x3c7a6e['whatsappQueues'][_0xb043('0x50')](_0x5a06a8)){var _0x35d8ea=_0x3c7a6e[_0xb043('0x60')][_0x5a06a8];var _0x52339a={'id':_0x35d8ea['id'],'available':_0x35d8ea[_0xb043('0x57')],'loggedIn':_0x35d8ea[_0xb043('0x58')],'name':_0x35d8ea[_0xb043('0x5d')],'paused':_0x35d8ea['paused'],'waiting':_0x35d8ea[_0xb043('0x5a')]};_0x40e897['push'](_0x52339a);}}_0x278e76({'count':_0x40e897['length'],'rows':_0x40e897});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4fe6d8){var _0x533d39=_[_0xb043('0x55')](_0x3c7a6e[_0xb043('0x61')]);_0x4fe6d8({'count':_0x533d39['length'],'rows':_0x533d39});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2dac13){var _0xa985ce=_[_0xb043('0x55')](_0x3c7a6e[_0xb043('0x62')]);_0x2dac13({'count':_0xa985ce[_0xb043('0x1a')],'rows':_0xa985ce});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x46df17){var _0x59bbee=_['values'](_0x3c7a6e[_0xb043('0x63')]);_0x46df17({'count':_0x59bbee['length'],'rows':_0x59bbee});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x170705){var _0x3fce2a=_[_0xb043('0x55')](_0x3c7a6e[_0xb043('0x64')]);_0x170705({'count':_0x3fce2a[_0xb043('0x1a')],'rows':_0x3fce2a});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x365dbb){var _0x4f75ad=_[_0xb043('0x55')](_0x3c7a6e[_0xb043('0x65')]);_0x365dbb({'count':_0x4f75ad[_0xb043('0x1a')],'rows':_0x4f75ad});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2ca471){var _0x96a1fd=_[_0xb043('0x55')](_0x3c7a6e[_0xb043('0x66')]);_0x2ca471({'count':_0x96a1fd[_0xb043('0x1a')],'rows':_0x96a1fd});});}};var _0x4165bc=jayson[_0xb043('0x67')](_0x1ab913)[_0xb043('0x68')]();_0x4165bc['on'](_0xb043('0x3c'),function(_0x1a5d48){logger[_0xb043('0x3c')](JSON[_0xb043('0x3f')](_0x1a5d48));return _0x41d9ed(_0x1a5d48);});_0x4165bc[_0xb043('0x12')](0x232c,'127.0.0.1',function(){console[_0xb043('0x69')](_0xb043('0x6a'),0x232c);return _0x1adc9f(_0xb043('0x6b')+0x232c);});});}; \ No newline at end of file +var _0x63d4=['push','slice','dialogflow','appdata','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','busy','agents','busyQueue','QueueReport','update','error','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','stringify','log','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','transfer','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','split'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63d4,0x117));var _0x463d=function(_0x498621,_0x4b80b4){_0x498621=_0x498621-0x0;var _0xfa9381=_0x63d4[_0x498621];return _0xfa9381;};'use strict';var _=require(_0x463d('0x0'));var util=require(_0x463d('0x1'));var path=require(_0x463d('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x463d('0x3'));var utils=require(_0x463d('0x4'));var sUtils=require(_0x463d('0x5'));var logger=require(_0x463d('0x6'))(_0x463d('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x463d('0x8')),'chatQueueReport':require(_0x463d('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x463d('0xa')),'whatsappQueueReport':require(_0x463d('0xb'))};var RuleEngine=require(_0x463d('0xc'));function getId(_0x41dc01,_0x218286,_0x4d32fb){return util[_0x463d('0xd')]('%s.%s.%s',_0x41dc01,_0x218286||0x0,_0x4d32fb||0x0);}function getIntervals(_0x42b27e,_0x2d714b){var _0x1f5d4a=[];if(!_[_0x463d('0xe')](_0x2d714b['IntervalId'])&&!_['isNil'](_0x42b27e[_0x2d714b[_0x463d('0xf')]])&&!_['isNil'](_0x42b27e[_0x2d714b[_0x463d('0xf')]][_0x463d('0x10')])){_0x1f5d4a=_[_0x463d('0x11')](_0x42b27e[_0x2d714b[_0x463d('0xf')]][_0x463d('0x10')],_0x463d('0x12'));}else if(!_[_0x463d('0xe')](_0x2d714b['interval'])){_0x1f5d4a=[_0x2d714b[_0x463d('0x12')]];}return _0x1f5d4a;}exports[_0x463d('0x13')]=function(_0x436dba){_0x436dba['rules']={};return new BPromise(function(_0x8956d3,_0xea6080){var _0x10f5f7={'Start':function(_0x1932e6){var _0x37b3f6=this;return new Promise(function(_0x46896c,_0x53c8c6){if(_0x1932e6){try{var _0x1372ff=[];var _0x48c1e1=getId(_0x1932e6[_0x463d('0x14')],_0x1932e6[_0x463d('0x15')]?_0x1932e6[_0x463d('0x15')]['id']:0x0,_0x1932e6[_0x463d('0x16')]?_0x1932e6[_0x463d('0x16')]['id']:0x0);var _0x36ea11=sUtils['checkWaitingNotifications'](_0x436dba,_0x1932e6);if(_0x1932e6[_0x463d('0x17')]||!_0x36ea11&&_0x1932e6[_0x463d('0x18')]&&_[_0x463d('0x19')](_0x1932e6[_0x463d('0x18')])&&_0x1932e6[_0x463d('0x18')][_0x463d('0x1a')]){for(var _0x945ea0=0x0;_0x945ea0<_0x1932e6[_0x463d('0x18')][_0x463d('0x1a')];_0x945ea0+=0x1){var _0x622b48=_0x1932e6[_0x463d('0x18')][_0x945ea0];if(fs[_0x463d('0x1b')](path[_0x463d('0x1c')](__dirname,_0x463d('0x18'),_0x622b48[_0x463d('0x1d')]+'.js'))){var _0x19e3eb=[];switch(_0x622b48['app'][_0x463d('0x1e')]()){case _0x463d('0x1f'):var _0x541aa9=_0x622b48['appdata'][_0x463d('0x20')](',');if(_0x1932e6[_0x463d('0x14')]==='mail'){_0x19e3eb[_0x463d('0x21')](_0x541aa9[0x0]);_0x19e3eb['push'](_0x541aa9[0x1]);_0x19e3eb[_0x463d('0x21')](_0x541aa9[_0x463d('0x22')](0x2,_0x541aa9[_0x463d('0x1a')])['join'](','));}else{_0x19e3eb[_0x463d('0x21')](_0x541aa9[0x0]);_0x19e3eb[_0x463d('0x21')](_0x541aa9[_0x463d('0x22')](0x1,_0x541aa9[_0x463d('0x1a')])[_0x463d('0x1c')](','));}break;case _0x463d('0x23'):var _0xbff8e0=_0x622b48['appdata']['split'](',');_0x19e3eb[_0x463d('0x21')](_0xbff8e0[0x0]);_0x19e3eb['push'](_0xbff8e0[0x1]);_0x19e3eb[_0x463d('0x21')](_0xbff8e0[_0x463d('0x22')](0x2,_0xbff8e0[_0x463d('0x1a')])[_0x463d('0x1c')](','));break;case'dialogflowv2':var _0x169f60=_0x622b48[_0x463d('0x24')][_0x463d('0x20')](',');_0x19e3eb[_0x463d('0x21')](_0x169f60[0x0]);_0x19e3eb[_0x463d('0x21')](_0x169f60[0x1]);_0x19e3eb['push'](_0x169f60[0x2]);_0x19e3eb[_0x463d('0x21')](_0x169f60[0x3]);_0x19e3eb[_0x463d('0x21')](_0x169f60['slice'](0x4,_0x169f60[_0x463d('0x1a')])['join'](','));break;case _0x463d('0x25'):var _0x295283=_0x622b48[_0x463d('0x24')][_0x463d('0x20')](',');_0x19e3eb[_0x463d('0x21')](_0x295283[0x0]);_0x19e3eb['push'](_0x295283[0x1]);_0x19e3eb[_0x463d('0x21')](_0x295283[0x2]);_0x19e3eb[_0x463d('0x21')](_0x295283[0x3]);_0x19e3eb[_0x463d('0x21')](_0x295283[_0x463d('0x22')](0x4,_0x295283[_0x463d('0x1a')])[_0x463d('0x1c')](','));break;case _0x463d('0x15'):_0x19e3eb[_0x463d('0x21')](_0x622b48[_0x463d('0x24')]);break;case _0x463d('0x26'):_0x19e3eb[_0x463d('0x21')](_0x622b48[_0x463d('0x27')]);_0x19e3eb[_0x463d('0x21')](_0x622b48[_0x463d('0x24')]);break;case _0x463d('0x28'):var _0x5d2624=utils[_0x463d('0x29')](_0x1932e6[_0x463d('0x2a')][_0x463d('0x2b')],_0x1932e6);var _0x3b1225=_0x622b48[_0x463d('0x24')][_0x463d('0x20')](',');_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x0]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x1]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x2]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x3]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x4]);_0x19e3eb['push'](_0x3b1225[0x5]);_0x19e3eb['push'](_0x3b1225[0x6]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x7]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0x8]);_0x19e3eb['push'](_0x3b1225[0x9]);_0x19e3eb[_0x463d('0x21')](_0x3b1225[0xa]);_0x19e3eb['push'](_0x1932e6['interaction']['id']);_0x19e3eb[_0x463d('0x21')](_0x1932e6['message']['id']);_0x19e3eb[_0x463d('0x21')](_0x622b48[_0x463d('0x2c')]);_0x19e3eb['push'](_0x1932e6[_0x463d('0x16')][_0x463d('0x2d')]);_0x19e3eb[_0x463d('0x21')](_0x1932e6[_0x463d('0x2e')][_0x463d('0x2e')]);_0x19e3eb[_0x463d('0x21')](_0x5d2624);break;default:_0x19e3eb=_[_0x463d('0xe')](_0x622b48['appdata'])?[]:_0x622b48['appdata'][_0x463d('0x20')](',');}var _0x1a262f={'id':util[_0x463d('0xd')]('%s:%s:%s',_0x48c1e1,_0x622b48['id'],_0x622b48['app']),'condition':require(_0x463d('0x2f'))['condition'](_0x48c1e1,getIntervals(_0x436dba[_0x463d('0x30')],_0x622b48),_0x436dba),'consequence':require(_0x463d('0x31')+_0x622b48[_0x463d('0x1d')])[_0x463d('0x32')](_0x48c1e1,_0x19e3eb,_0x436dba,_0x1932e6),'p':_0x622b48[_0x463d('0x33')]||0x0};logger[_0x463d('0x34')]('Push\x20new\x20rule',_0x1a262f['id'],_0x463d('0x35'),getIntervals(_0x436dba['intervals'],_0x622b48)[_0x463d('0x1c')](_0x463d('0x36')));_0x1372ff['push'](_0x1a262f);}else{logger['error'](_0x463d('0x37'),path[_0x463d('0x1c')](__dirname,'applications',_0x622b48['app']+_0x463d('0x38')));}}_0x436dba['rules'][_0x48c1e1]=new RuleEngine(_0x1372ff);_0x436dba[_0x463d('0x39')][_0x48c1e1][_0x463d('0x3a')](_0x1932e6,function(_0xf1113d){logger[_0x463d('0x34')](_0x463d('0x3b'),JSON['stringify'](_0xf1113d[_0x463d('0x3c')]));if(_0x436dba[_0x463d('0x39')][_0x48c1e1]){_0x436dba[_0x463d('0x39')][_0x48c1e1][_0x463d('0x3d')](_0x463d('0x3e'));}});return _0x46896c({'code':0xc8,'message':_0x1932e6});}else{if(_0x36ea11){logger[_0x463d('0x34')](util[_0x463d('0xd')](_0x463d('0x3f'),_0x48c1e1));}else{logger['info'](_0x463d('0x40'));}return _0x46896c({'code':0xc8,'message':_0x1932e6});}}catch(_0x5a7469){logger['error'](_0x5a7469['stack']);return _0x53c8c6(_0x37b3f6['error'](0x1f4,_0x5a7469));}}return _0x53c8c6(_0x463d('0x41'));});},'AcceptMessage':function(_0x1739e8){var _0x3a9208=this;return new Promise(function(_0x2c50df,_0x19e45f){if(_0x1739e8[_0x463d('0x42')]&&_0x1739e8[_0x463d('0x42')]['id']){if(_0x436dba['agents'][_0x1739e8[_0x463d('0x42')]['id']]){_0x436dba['agents'][_0x1739e8[_0x463d('0x42')]['id']][_0x463d('0x43')]=![];_0x436dba[_0x463d('0x44')][_0x1739e8[_0x463d('0x42')]['id']][_0x463d('0x45')]=undefined;}}if(_0x1739e8[_0x463d('0x15')]&&_0x1739e8[_0x463d('0x15')]['id']){try{var _0x212a78=getId(_0x1739e8[_0x463d('0x14')],_0x1739e8['message']?_0x1739e8[_0x463d('0x15')]['id']:0x0,_0x1739e8[_0x463d('0x16')]?_0x1739e8[_0x463d('0x16')]['id']:0x0);if(_0x436dba['rules'][_0x212a78]){_0x436dba['rules'][_0x212a78][_0x463d('0x3d')]('end');if(rpc[_0x1739e8[_0x463d('0x14')]+_0x463d('0x46')]){rpc[_0x1739e8[_0x463d('0x14')]+'QueueReport'][_0x463d('0x47')](_0x212a78,{'UserId':_0x1739e8[_0x463d('0x15')]['UserId']})['catch'](function(){logger[_0x463d('0x48')](_0x463d('0x49'));});}}return _0x2c50df({'code':0xc8,'message':_0x1739e8});}catch(_0x217e9c){logger[_0x463d('0x48')](_0x217e9c[_0x463d('0x4a')]);return _0x19e45f(_0x3a9208[_0x463d('0x48')](0x1f4,_0x217e9c));}}logger[_0x463d('0x48')](_0x463d('0x4b'));return _0x19e45f(_0x3a9208[_0x463d('0x48')](0x1f4,_0x463d('0x4b')));});},'RejectMessage':function(_0x519726){var _0x52dc25=this;return new Promise(function(_0x2c8d1e,_0x5df723){if(_0x519726['agent']&&_0x519726['agent']['id']){try{if(_0x436dba[_0x463d('0x44')][_0x519726[_0x463d('0x42')]['id']]){_0x436dba[_0x463d('0x44')][_0x519726['agent']['id']][_0x463d('0x43')]=![];_0x436dba[_0x463d('0x44')][_0x519726['agent']['id']][_0x463d('0x45')]=undefined;}return _0x2c8d1e({'code':0xc8,'message':_0x519726});}catch(_0x841eed){logger['error'](_0x841eed[_0x463d('0x4a')]);return _0x5df723(_0x52dc25[_0x463d('0x48')](0x1f4,_0x841eed));}}logger[_0x463d('0x48')]('message\x20is\x20empty');return _0x5df723(_0x52dc25['error'](0x1f4,_0x463d('0x4b')));});},'AbandonInteraction':function(_0x12b840){var _0x46aa8a=this;return new Promise(function(_0x3a3b97,_0x1c87c4){if(_0x12b840['channel']&&_0x12b840[_0x463d('0x16')]&&_0x12b840[_0x463d('0x16')]['id']){try{var _0x2acb3a=getId(_0x12b840[_0x463d('0x14')],_0x12b840[_0x463d('0x15')]?_0x12b840[_0x463d('0x15')]['id']:0x0,_0x12b840['interaction']?_0x12b840[_0x463d('0x16')]['id']:0x0);if(_0x436dba['rules'][_0x2acb3a]){_0x436dba[_0x463d('0x39')][_0x2acb3a]['emit'](_0x463d('0x4c'));}return _0x3a3b97({'code':0xc8,'message':_0x12b840});}catch(_0x49796f){logger['error'](_0x49796f[_0x463d('0x4a')]);return _0x1c87c4(_0x46aa8a[_0x463d('0x48')](0x1f4,_0x49796f));}}logger['error'](_0x463d('0x4b'));return _0x1c87c4(_0x46aa8a[_0x463d('0x48')](0x1f4,_0x463d('0x4b')));});},'AgentCapacity':function(_0x4fe704){var _0x41dd68=this;return new Promise(function(_0x522261,_0x12b1a7){if(_0x436dba['agents'][_0x463d('0x4d')](_0x4fe704['id'])){for(var _0x159855 in _0x4fe704[_0x463d('0x4e')]){if(_0x4fe704['capacity']['hasOwnProperty'](_0x159855)){if(_0x436dba['agents'][_0x4fe704['id']]['hasOwnProperty'](_0x159855+'CurrentCapacity')){_0x436dba['agents'][_0x4fe704['id']][_0x159855+_0x463d('0x4f')]=parseInt(_0x4fe704['capacity'][_0x159855],0xa);}}}_0x436dba[_0x463d('0x44')][_0x4fe704['id']][_0x463d('0x50')]();return _0x522261({'code':0xc8,'message':_0x436dba[_0x463d('0x44')][_0x4fe704['id']]});}else{return _0x12b1a7(_0x41dd68['error'](0x1f4,_0x463d('0x51')));}});},'Agents':function(_0x1e22ab){return new Promise(function(_0x2c02b4){var _0x2c6a27=_[_0x463d('0x52')](_0x436dba[_0x463d('0x44')]);if(_0x1e22ab&&_0x1e22ab['id']){var _0xdbee4c=_[_0x463d('0x53')](_0x2c6a27,function(_0x53a0a7){return _0x53a0a7['id']===_0x1e22ab['id'];});_0x2c02b4(_0xdbee4c);}else{_0x2c02b4({'count':_0x2c6a27['length'],'rows':_0x2c6a27});}});},'ChatQueues':function(){return new Promise(function(_0x461962){var _0x24f773=[];for(var _0x104085 in _0x436dba['chatQueues']){if(_0x436dba[_0x463d('0x54')][_0x463d('0x4d')](_0x104085)){var _0x4dfd9a=_0x436dba[_0x463d('0x54')][_0x104085];var _0xb60bc4={'id':_0x4dfd9a['id'],'available':_0x4dfd9a['available'],'loggedIn':_0x4dfd9a[_0x463d('0x55')],'name':_0x4dfd9a[_0x463d('0x56')],'paused':_0x4dfd9a[_0x463d('0x57')],'waiting':_0x4dfd9a[_0x463d('0x58')]};_0x24f773[_0x463d('0x21')](_0xb60bc4);}}_0x461962({'count':_0x24f773[_0x463d('0x1a')],'rows':_0x24f773});});},'MailQueues':function(){return new Promise(function(_0x3bf69d){var _0x1704ad=[];for(var _0x39a157 in _0x436dba[_0x463d('0x59')]){if(_0x436dba[_0x463d('0x59')][_0x463d('0x4d')](_0x39a157)){var _0xd222cc=_0x436dba[_0x463d('0x59')][_0x39a157];var _0x4d52fb={'id':_0xd222cc['id'],'available':_0xd222cc[_0x463d('0x5a')],'loggedIn':_0xd222cc[_0x463d('0x55')],'name':_0xd222cc[_0x463d('0x56')],'paused':_0xd222cc['paused'],'waiting':_0xd222cc[_0x463d('0x58')]};_0x1704ad[_0x463d('0x21')](_0x4d52fb);}}_0x3bf69d({'count':_0x1704ad[_0x463d('0x1a')],'rows':_0x1704ad});});},'OpenchannelQueues':function(){return new Promise(function(_0x55967e){var _0x37c906=[];for(var _0x530f24 in _0x436dba[_0x463d('0x5b')]){if(_0x436dba['openchannelQueues'][_0x463d('0x4d')](_0x530f24)){var _0x1e803=_0x436dba['openchannelQueues'][_0x530f24];var _0x4c0c3b={'id':_0x1e803['id'],'available':_0x1e803['available'],'loggedIn':_0x1e803[_0x463d('0x55')],'name':_0x1e803['name'],'paused':_0x1e803['paused'],'waiting':_0x1e803['waiting']};_0x37c906[_0x463d('0x21')](_0x4c0c3b);}}_0x55967e({'count':_0x37c906[_0x463d('0x1a')],'rows':_0x37c906});});},'SmsQueues':function(){return new Promise(function(_0x569b70){var _0x3a836e=[];for(var _0x1dc89c in _0x436dba['smsQueues']){if(_0x436dba[_0x463d('0x5c')]['hasOwnProperty'](_0x1dc89c)){var _0x56e860=_0x436dba[_0x463d('0x5c')][_0x1dc89c];var _0x1e4dd4={'id':_0x56e860['id'],'available':_0x56e860['available'],'loggedIn':_0x56e860['loggedIn'],'name':_0x56e860['name'],'paused':_0x56e860[_0x463d('0x57')],'waiting':_0x56e860['waiting']};_0x3a836e[_0x463d('0x21')](_0x1e4dd4);}}_0x569b70({'count':_0x3a836e[_0x463d('0x1a')],'rows':_0x3a836e});});},'FaxQueues':function(){return new Promise(function(_0x2718df){var _0x1a6198=[];for(var _0x8ff96c in _0x436dba[_0x463d('0x5d')]){if(_0x436dba['faxQueues'][_0x463d('0x4d')](_0x8ff96c)){var _0x51f792=_0x436dba[_0x463d('0x5d')][_0x8ff96c];var _0x52d478={'id':_0x51f792['id'],'available':_0x51f792[_0x463d('0x5a')],'loggedIn':_0x51f792[_0x463d('0x55')],'name':_0x51f792['name'],'paused':_0x51f792[_0x463d('0x57')],'waiting':_0x51f792[_0x463d('0x58')]};_0x1a6198[_0x463d('0x21')](_0x52d478);}}_0x2718df({'count':_0x1a6198[_0x463d('0x1a')],'rows':_0x1a6198});});},'WhatsappQueues':function(){return new Promise(function(_0x447af1){var _0x4a4fa0=[];for(var _0x1b4bd7 in _0x436dba[_0x463d('0x5e')]){if(_0x436dba[_0x463d('0x5e')][_0x463d('0x4d')](_0x1b4bd7)){var _0x528543=_0x436dba[_0x463d('0x5e')][_0x1b4bd7];var _0x2cd216={'id':_0x528543['id'],'available':_0x528543[_0x463d('0x5a')],'loggedIn':_0x528543['loggedIn'],'name':_0x528543[_0x463d('0x56')],'paused':_0x528543[_0x463d('0x57')],'waiting':_0x528543[_0x463d('0x58')]};_0x4a4fa0[_0x463d('0x21')](_0x2cd216);}}_0x447af1({'count':_0x4a4fa0[_0x463d('0x1a')],'rows':_0x4a4fa0});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x572af3){var _0x4ac764=_[_0x463d('0x52')](_0x436dba[_0x463d('0x5f')]);_0x572af3({'count':_0x4ac764['length'],'rows':_0x4ac764});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x13df4b){var _0x37e2ee=_['values'](_0x436dba[_0x463d('0x60')]);_0x13df4b({'count':_0x37e2ee[_0x463d('0x1a')],'rows':_0x37e2ee});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4b1d27){var _0x3cf9a5=_[_0x463d('0x52')](_0x436dba[_0x463d('0x61')]);_0x4b1d27({'count':_0x3cf9a5[_0x463d('0x1a')],'rows':_0x3cf9a5});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x52bf5e){var _0x481d86=_['values'](_0x436dba[_0x463d('0x62')]);_0x52bf5e({'count':_0x481d86['length'],'rows':_0x481d86});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2e9bef){var _0x45eeff=_[_0x463d('0x52')](_0x436dba[_0x463d('0x63')]);_0x2e9bef({'count':_0x45eeff['length'],'rows':_0x45eeff});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4c825b){var _0x47f519=_['values'](_0x436dba[_0x463d('0x64')]);_0x4c825b({'count':_0x47f519[_0x463d('0x1a')],'rows':_0x47f519});});}};var _0x28afb3=jayson['server'](_0x10f5f7)['http']();_0x28afb3['on'](_0x463d('0x48'),function(_0x139e5c){logger[_0x463d('0x48')](JSON[_0x463d('0x65')](_0x139e5c));return _0xea6080(_0x139e5c);});_0x28afb3[_0x463d('0x13')](0x232c,'127.0.0.1',function(){console[_0x463d('0x66')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x8956d3(_0x463d('0x67')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 624e155..1bb0150 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 _0x179f=['error','message','result','catch','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','jayson/promise','lodash','../../../config/logger','routing','http','request','then'];(function(_0x2d470d,_0x26a51f){var _0x3e2f21=function(_0x493a6c){while(--_0x493a6c){_0x2d470d['push'](_0x2d470d['shift']());}};_0x3e2f21(++_0x26a51f);}(_0x179f,0x1e8));var _0xf179=function(_0x4f6371,_0x56f889){_0x4f6371=_0x4f6371-0x0;var _0x38651f=_0x179f[_0x4f6371];return _0x38651f;};'use strict';var util=require(_0xf179('0x0'));var BPromise=require('bluebird');var jayson=require(_0xf179('0x1'));var _=require(_0xf179('0x2'));var logger=require(_0xf179('0x3'))(_0xf179('0x4'));var client=jayson['client'][_0xf179('0x5')]({'port':0x232a});function request(_0x19e311,_0x2c69f0){return new BPromise(function(_0x3b914c,_0x114240){return client[_0xf179('0x6')](_0x19e311,_0x2c69f0)[_0xf179('0x7')](function(_0x59e3a1){if(_0x59e3a1[_0xf179('0x8')]){return _0x114240(_0x59e3a1[_0xf179('0x8')][_0xf179('0x9')]);}else{return _0x3b914c(_0x59e3a1[_0xf179('0xa')]);}})[_0xf179('0xb')](function(_0x181e5f){return _0x114240(_0x181e5f);});});}exports['condition']=function(_0x16ac40,_0x4d8b75,_0x27b812){return function(_0x56d73f){if(_0x27b812[_0xf179('0xc')]&&!_0x27b812[_0xf179('0xc')][_0x16ac40]){logger['info'](_0xf179('0xd'),_0x16ac40);return _0x56d73f[_0xf179('0xe')]();}var _0x124407=[];for(var _0x1428ef=0x0;_0x1428ef<_0x4d8b75[_0xf179('0xf')];_0x1428ef+=0x1){_0x124407[_0xf179('0x10')](request(_0xf179('0x11'),{'command':util[_0xf179('0x12')](_0xf179('0x13'),_0x4d8b75[_0x1428ef])})[_0xf179('0x7')](function(_0x3c2335){return _0x3c2335&&_0x3c2335[_0xf179('0x9')]&&_0x3c2335[_0xf179('0x9')][_0xf179('0x14')](_0xf179('0x15'))>=0x0?!![]:![];})[_0xf179('0xb')](function(){logger[_0xf179('0x8')](_0xf179('0x16'),_0x16ac40,_0x4d8b75[_0x1428ef]);}));}BPromise[_0xf179('0x17')](_0x124407)[_0xf179('0x7')](function(_0x19b677){var _0x58f9cf=_[_0xf179('0x18')](_0x19b677);logger[_0xf179('0x19')](_0xf179('0x1a'),_0x16ac40,_0x4d8b75[_0xf179('0x1b')](_0xf179('0x1c')),_0x58f9cf);_0x56d73f[_0xf179('0x1d')](_0x58f9cf);})[_0xf179('0xb')](function(_0x4aa8f2){logger['error'](_0xf179('0x1a'),_0x16ac40,_0x4d8b75[_0xf179('0x1b')](_0xf179('0x1c')),_0x4aa8f2[_0xf179('0x1e')]);_0x56d73f['stop']();});};}; \ No newline at end of file +var _0x27a1=['../../../config/logger','routing','http','request','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash'];(function(_0x4e3796,_0x3f470b){var _0x2d1fc6=function(_0x196f5f){while(--_0x196f5f){_0x4e3796['push'](_0x4e3796['shift']());}};_0x2d1fc6(++_0x3f470b);}(_0x27a1,0xce));var _0x127a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x27a1[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x127a('0x0'));var BPromise=require(_0x127a('0x1'));var jayson=require(_0x127a('0x2'));var _=require(_0x127a('0x3'));var logger=require(_0x127a('0x4'))(_0x127a('0x5'));var client=jayson['client'][_0x127a('0x6')]({'port':0x232a});function request(_0x3abb93,_0x564c6){return new BPromise(function(_0x34eb59,_0x3d55b9){return client[_0x127a('0x7')](_0x3abb93,_0x564c6)[_0x127a('0x8')](function(_0x52a2c1){if(_0x52a2c1[_0x127a('0x9')]){return _0x3d55b9(_0x52a2c1[_0x127a('0x9')][_0x127a('0xa')]);}else{return _0x34eb59(_0x52a2c1[_0x127a('0xb')]);}})[_0x127a('0xc')](function(_0x4d06dd){return _0x3d55b9(_0x4d06dd);});});}exports[_0x127a('0xd')]=function(_0x809570,_0x1226bb,_0x19693d){return function(_0x1ae9a1){if(_0x19693d['rules']&&!_0x19693d[_0x127a('0xe')][_0x809570]){logger['info'](_0x127a('0xf'),_0x809570);return _0x1ae9a1[_0x127a('0x10')]();}var _0x18f3ff=[];for(var _0x103afe=0x0;_0x103afe<_0x1226bb[_0x127a('0x11')];_0x103afe+=0x1){_0x18f3ff['push'](request(_0x127a('0x12'),{'command':util['format'](_0x127a('0x13'),_0x1226bb[_0x103afe])})[_0x127a('0x8')](function(_0x58162c){return _0x58162c&&_0x58162c['message']&&_0x58162c[_0x127a('0xa')][_0x127a('0x14')](_0x127a('0x15'))>=0x0?!![]:![];})['catch'](function(){logger[_0x127a('0x9')](_0x127a('0x16'),_0x809570,_0x1226bb[_0x103afe]);}));}BPromise[_0x127a('0x17')](_0x18f3ff)[_0x127a('0x8')](function(_0x4ae2b3){var _0x405e00=_[_0x127a('0x18')](_0x4ae2b3);logger['info'](_0x127a('0x19'),_0x809570,_0x1226bb[_0x127a('0x1a')](_0x127a('0x1b')),_0x405e00);_0x1ae9a1[_0x127a('0x1c')](_0x405e00);})['catch'](function(_0x4ce8d4){logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x809570,_0x1226bb[_0x127a('0x1a')](_0x127a('0x1b')),_0x4ce8d4[_0x127a('0x1d')]);_0x1ae9a1[_0x127a('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 4cbadf0..fb52aeb 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 _0xb9be=['origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','membername','interface','calleridnum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','[%s][agents][agentcalled]','now','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','debug','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transferexten','extension','[%s][agents][attendedtransfer]','origtransfereruniqueid'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xb9be,0xc5));var _0xeb9b=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xb9be[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var utils=require(_0xeb9b('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x21f8a2,_0x292bab){utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x5'),_0x21f8a2[_0xeb9b('0x6')],_0x21f8a2['channel'],_0x21f8a2['queue'],_0x21f8a2[_0xeb9b('0x7')],_0x21f8a2[_0xeb9b('0x8')],_0x21f8a2[_0xeb9b('0x9')],_0x21f8a2['connectedlinenum'],_0x21f8a2[_0xeb9b('0xa')]));if(_0x21f8a2[_0xeb9b('0xb')]){utils[_0xeb9b('0xc')](_0x21f8a2[_0xeb9b('0xb')])[_0xeb9b('0xd')](function(_0x3da395){if(_0x3da395){_0x21f8a2[_0xeb9b('0xe')]=_0x3da395[_0xeb9b('0xe')];_0x21f8a2[_0xeb9b('0xf')]=_0x21f8a2['agentcomplete']?_0x3da395[_0xeb9b('0x10')]:![];_0x21f8a2['acwtime']=_0x21f8a2['agentacw']?_0x3da395[_0xeb9b('0x11')]:0x0;}utils[_0xeb9b('0x12')]('CreateVoiceAgentReport',_0x21f8a2);});}else{utils[_0xeb9b('0x12')](_0xeb9b('0x13'),_0x21f8a2);}if(_0x292bab){delete transfers[_0x21f8a2[_0xeb9b('0x6')]];}else{delete agents[_0x21f8a2[_0xeb9b('0x14')]];}}exports['agentcalled']=function(_0x5e94e3){try{utils['debug'](util[_0xeb9b('0x4')](_0xeb9b('0x15'),_0x5e94e3[_0xeb9b('0x6')]),_0x5e94e3);agents[_0x5e94e3['destuniqueid']]=_0x5e94e3;agents[_0x5e94e3['destuniqueid']]['agentcalledAt']=utils[_0xeb9b('0x16')]();agents[_0x5e94e3[_0xeb9b('0x14')]][_0xeb9b('0xa')]=_0xeb9b('0x17');agents[_0x5e94e3[_0xeb9b('0x14')]][_0xeb9b('0x18')]=null;agents[_0x5e94e3[_0xeb9b('0x14')]]['connectedlinename']=null;utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x19'),_0x5e94e3[_0xeb9b('0x6')],agents[_0x5e94e3[_0xeb9b('0x14')]][_0xeb9b('0x7')],_0x5e94e3[_0xeb9b('0x14')]));}catch(_0x3342c1){utils[_0xeb9b('0x1a')](util[_0xeb9b('0x4')]('[%s][agents][agentcalled]',_0x5e94e3[_0xeb9b('0x6')]),_0x3342c1);}};exports['agentringnoanswer']=function(_0x5d5f54){try{if(!_[_0xeb9b('0x1b')](agents[_0x5d5f54[_0xeb9b('0x14')]])){utils['debug'](util[_0xeb9b('0x4')](_0xeb9b('0x1c'),_0x5d5f54[_0xeb9b('0x6')]),_0x5d5f54);utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x1d'),_0x5d5f54[_0xeb9b('0x6')],agents[_0x5d5f54[_0xeb9b('0x14')]][_0xeb9b('0x7')],_0x5d5f54[_0xeb9b('0x14')]));agents[_0x5d5f54[_0xeb9b('0x14')]][_0xeb9b('0x1e')]=!![];agents[_0x5d5f54[_0xeb9b('0x14')]][_0xeb9b('0x1f')]=utils[_0xeb9b('0x16')]();agents[_0x5d5f54[_0xeb9b('0x14')]]['lastevent']=_0xeb9b('0x20');agents[_0x5d5f54['destuniqueid']][_0xeb9b('0x21')]='timeout';agents[_0x5d5f54[_0xeb9b('0x14')]][_0xeb9b('0x22')]=_0x5d5f54[_0xeb9b('0x23')]?parseInt(_0x5d5f54[_0xeb9b('0x23')])/0x3e8:0x0;agents[_0x5d5f54['destuniqueid']][_0xeb9b('0x24')]=0x0;unanswered[_0xeb9b('0x25')](_0x5d5f54['destuniqueid']);}}catch(_0x35ff07){utils[_0xeb9b('0x1a')](util['format'](_0xeb9b('0x1c'),_0x5d5f54[_0xeb9b('0x6')]),_0x35ff07);}};exports[_0xeb9b('0x26')]=function(_0x48c5f4){try{_[_0xeb9b('0x27')](agents,function(_0x5336f2,_0x6bb66){if(_0x5336f2['uniqueid']==_0x48c5f4[_0xeb9b('0x6')]&&!_['includes'](unanswered,_0x5336f2[_0xeb9b('0x14')])){utils['debug'](util[_0xeb9b('0x4')]('[%s][agents][queuecallerabandon]',_0x48c5f4[_0xeb9b('0x6')]),_0x48c5f4);utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x28'),_0x48c5f4[_0xeb9b('0x6')],_0x5336f2[_0xeb9b('0x7')],_0x5336f2[_0xeb9b('0x14')]));_0x5336f2[_0xeb9b('0x1e')]=!![];_0x5336f2[_0xeb9b('0x1f')]=utils[_0xeb9b('0x16')]();_0x5336f2['lastevent']=_0xeb9b('0x29');_0x5336f2[_0xeb9b('0x21')]=_0xeb9b('0x29');_0x5336f2[_0xeb9b('0x22')]=_0x48c5f4[_0xeb9b('0x22')];_0x5336f2[_0xeb9b('0x24')]=0x0;writeDB(_0x5336f2);}});}catch(_0x179cd9){utils['error'](util[_0xeb9b('0x4')](_0xeb9b('0x2a'),_0x48c5f4[_0xeb9b('0x6')]),_0x179cd9);}};exports['agentconnect']=function(_0x236e69){try{if(agents[_0x236e69[_0xeb9b('0x14')]]){utils[_0xeb9b('0x2b')](util[_0xeb9b('0x4')](_0xeb9b('0x2c'),_0x236e69[_0xeb9b('0x6')]),_0x236e69);utils['info'](util[_0xeb9b('0x4')](_0xeb9b('0x2d'),_0x236e69['uniqueid'],agents[_0x236e69[_0xeb9b('0x14')]][_0xeb9b('0x7')],_0x236e69[_0xeb9b('0x14')]));agents[_0x236e69[_0xeb9b('0x14')]][_0xeb9b('0x2e')]=utils[_0xeb9b('0x16')]();agents[_0x236e69[_0xeb9b('0x14')]]['connectedlinenum']=_0x236e69[_0xeb9b('0x18')];agents[_0x236e69[_0xeb9b('0x14')]][_0xeb9b('0x2f')]=_0x236e69['connectedlinename'];agents[_0x236e69['destuniqueid']]['holdtime']=_0x236e69[_0xeb9b('0x23')];agents[_0x236e69[_0xeb9b('0x14')]][_0xeb9b('0xa')]='connect';_[_0xeb9b('0x27')](agents,function(_0x9b36ae,_0x240d8d){if(_0x9b36ae[_0xeb9b('0x14')]!=_0x236e69[_0xeb9b('0x14')]&&_0x9b36ae[_0xeb9b('0x6')]==_0x236e69[_0xeb9b('0x6')]){_0x9b36ae['talktime']=0x0;_0x9b36ae[_0xeb9b('0x22')]=_0x236e69[_0xeb9b('0x23')];_0x9b36ae[_0xeb9b('0x1e')]=!![];_0x9b36ae['agentringnoanswerAt']=utils['now']();_0x9b36ae[_0xeb9b('0xa')]=_0xeb9b('0x30');_0x9b36ae['reason']=_0xeb9b('0x30');_0x9b36ae['answeredelsewheredestinationuniqueid']=_0x236e69[_0xeb9b('0x14')];_0x9b36ae[_0xeb9b('0x31')]=_0x236e69[_0xeb9b('0x7')];writeDB(_0x9b36ae);}});}}catch(_0x300565){utils[_0xeb9b('0x1a')](util[_0xeb9b('0x4')](_0xeb9b('0x2c'),_0x236e69[_0xeb9b('0x6')]),_0x300565);}};exports[_0xeb9b('0x32')]=function(_0x311e7d){try{if(!_[_0xeb9b('0x1b')](agents[_0x311e7d[_0xeb9b('0x14')]])){utils['debug'](util['format'](_0xeb9b('0x33'),_0x311e7d['uniqueid']),_0x311e7d);utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x34'),_0x311e7d['uniqueid'],agents[_0x311e7d[_0xeb9b('0x14')]][_0xeb9b('0x7')],_0x311e7d['destuniqueid']));agents[_0x311e7d[_0xeb9b('0x14')]][_0xeb9b('0x32')]=!![];agents[_0x311e7d[_0xeb9b('0x14')]][_0xeb9b('0x35')]=utils[_0xeb9b('0x16')]();agents[_0x311e7d[_0xeb9b('0x14')]][_0xeb9b('0x24')]=utils[_0xeb9b('0x36')](agents[_0x311e7d['destuniqueid']]['agentcompleteAt'],agents[_0x311e7d[_0xeb9b('0x14')]]['agentconnectAt']);agents[_0x311e7d['destuniqueid']][_0xeb9b('0x21')]=_0x311e7d[_0xeb9b('0x21')];agents[_0x311e7d[_0xeb9b('0x14')]][_0xeb9b('0xa')]=_0xeb9b('0x37');writeDB(agents[_0x311e7d[_0xeb9b('0x14')]]);}}catch(_0x5a7b4a){utils['error'](util['format'](_0xeb9b('0x33'),_0x311e7d['uniqueid']),_0x5a7b4a);}};exports[_0xeb9b('0x38')]=function(_0x2ee59c){try{if(!_[_0xeb9b('0x1b')](agents[_0x2ee59c[_0xeb9b('0x39')]])){utils[_0xeb9b('0x2b')](util[_0xeb9b('0x4')](_0xeb9b('0x3a'),_0x2ee59c[_0xeb9b('0x6')]),_0x2ee59c);utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2ee59c['uniqueid'],agents[_0x2ee59c[_0xeb9b('0x39')]][_0xeb9b('0x7')],agents[_0x2ee59c['transfereruniqueid']][_0xeb9b('0x6')]));agents[_0x2ee59c['transfereruniqueid']][_0xeb9b('0x3b')]=!![];agents[_0x2ee59c[_0xeb9b('0x39')]]['transfertype']='blind';agents[_0x2ee59c['transfereruniqueid']][_0xeb9b('0x3c')]=_0x2ee59c[_0xeb9b('0x3d')];agents[_0x2ee59c[_0xeb9b('0x39')]]['transferuniqueid']=agents[_0x2ee59c['transfereruniqueid']][_0xeb9b('0x6')];}}catch(_0x1833c2){utils[_0xeb9b('0x1a')](util[_0xeb9b('0x4')](_0xeb9b('0x3a'),_0x2ee59c[_0xeb9b('0x6')]),_0x1833c2);}};exports['attendedtransfer']=function(_0x20dbea){try{utils[_0xeb9b('0x2b')](util['format'](_0xeb9b('0x3e'),_0x20dbea['origtransfereruniqueid']),_0x20dbea);if(_0x20dbea[_0xeb9b('0x3f')]==_0x20dbea[_0xeb9b('0x40')]){if(!_['isNil'](agents[_0x20dbea[_0xeb9b('0x41')]])){utils['info'](util[_0xeb9b('0x4')](_0xeb9b('0x42'),_0x20dbea[_0xeb9b('0x3f')],agents[_0x20dbea[_0xeb9b('0x41')]][_0xeb9b('0x7')]));agents[_0x20dbea['secondtransfereruniqueid']][_0xeb9b('0x3b')]=!![];agents[_0x20dbea[_0xeb9b('0x41')]][_0xeb9b('0x43')]='ATTENDED';agents[_0x20dbea[_0xeb9b('0x41')]][_0xeb9b('0x3c')]=_0x20dbea[_0xeb9b('0x44')];agents[_0x20dbea[_0xeb9b('0x41')]][_0xeb9b('0x45')]=_0x20dbea[_0xeb9b('0x3f')];}if(_0x20dbea[_0xeb9b('0x46')]&&agents[_0x20dbea[_0xeb9b('0x46')]]){agents[_0x20dbea[_0xeb9b('0x46')]][_0xeb9b('0x47')]=0x1;transfers[_0x20dbea[_0xeb9b('0x46')]]=_['clone'](agents[_0x20dbea['transfereeuniqueid']]);transfers[_0x20dbea['transfereeuniqueid']][_0xeb9b('0x9')]=agents[_0x20dbea['secondtransfereruniqueid']][_0xeb9b('0x9')];transfers[_0x20dbea[_0xeb9b('0x46')]][_0xeb9b('0x48')]=agents[_0x20dbea['secondtransfereruniqueid']][_0xeb9b('0x48')];transfers[_0x20dbea[_0xeb9b('0x46')]][_0xeb9b('0x49')]=utils[_0xeb9b('0x16')]();transfers[_0x20dbea[_0xeb9b('0x46')]][_0xeb9b('0x2e')]=utils[_0xeb9b('0x16')]();transfers[_0x20dbea[_0xeb9b('0x46')]]['holdtime']=0x0;transfers[_0x20dbea['transfereeuniqueid']][_0xeb9b('0x47')]=0x2;}}else if(_0x20dbea[_0xeb9b('0x41')]==_0x20dbea[_0xeb9b('0x4a')]){if(!_['isNil'](agents[_0x20dbea[_0xeb9b('0x3f')]])){utils['info'](util[_0xeb9b('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x20dbea[_0xeb9b('0x3f')],agents[_0x20dbea[_0xeb9b('0x3f')]][_0xeb9b('0x7')]));agents[_0x20dbea[_0xeb9b('0x3f')]][_0xeb9b('0x3b')]=!![];agents[_0x20dbea['origtransfereruniqueid']][_0xeb9b('0x43')]=_0xeb9b('0x4b');agents[_0x20dbea['origtransfereruniqueid']]['transferexten']=_0x20dbea[_0xeb9b('0x4c')];agents[_0x20dbea[_0xeb9b('0x3f')]]['transferuniqueid']=_0x20dbea[_0xeb9b('0x41')];}if(_0x20dbea['transfertargetuniqueid']&&agents[_0x20dbea[_0xeb9b('0x4d')]]){agents[_0x20dbea['transfertargetuniqueid']][_0xeb9b('0x47')]=0x1;transfers[_0x20dbea[_0xeb9b('0x4d')]]=_[_0xeb9b('0x4e')](agents[_0x20dbea[_0xeb9b('0x4d')]]);transfers[_0x20dbea[_0xeb9b('0x4d')]][_0xeb9b('0x9')]=agents[_0x20dbea['origtransfereruniqueid']][_0xeb9b('0x9')];transfers[_0x20dbea[_0xeb9b('0x4d')]]['calleridname']=agents[_0x20dbea[_0xeb9b('0x3f')]][_0xeb9b('0x48')];transfers[_0x20dbea[_0xeb9b('0x4d')]][_0xeb9b('0x49')]=utils['now']();transfers[_0x20dbea[_0xeb9b('0x4d')]][_0xeb9b('0x2e')]=utils['now']();transfers[_0x20dbea[_0xeb9b('0x4d')]][_0xeb9b('0x22')]=0x0;transfers[_0x20dbea[_0xeb9b('0x4d')]][_0xeb9b('0x47')]=0x2;}}}catch(_0x1d1081){utils[_0xeb9b('0x1a')](util[_0xeb9b('0x4')]('[%s][agents][attendedtransfer]',_0x20dbea[_0xeb9b('0x3f')]),_0x1d1081);}};exports[_0xeb9b('0x4f')]=function(_0x5614ba){try{utils[_0xeb9b('0x2b')](util[_0xeb9b('0x4')](_0xeb9b('0x50'),_0x5614ba[_0xeb9b('0x6')]),_0x5614ba);if(agents[_0x5614ba['uniqueid']]&&agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x21')]===_0xeb9b('0x20')){if(_0x5614ba[_0xeb9b('0x51')]==='21'){agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x21')]=_0xeb9b('0x52');agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0xa')]=_0xeb9b('0x52');}utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')](_0xeb9b('0x53'),_0x5614ba[_0xeb9b('0x6')],agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x7')],agents[_0x5614ba['uniqueid']][_0xeb9b('0x21')],agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0xa')]));writeDB(agents[_0x5614ba['uniqueid']]);var _0x541729=unanswered[_0xeb9b('0x54')](_0x5614ba['uniqueid']);if(_0x541729>-0x1){unanswered[_0xeb9b('0x55')](_0x541729,0x1);}}if(transfers[_0x5614ba[_0xeb9b('0x6')]]){transfers[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x32')]=!![];transfers[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x35')]=utils[_0xeb9b('0x16')]();transfers[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x24')]=utils[_0xeb9b('0x36')](transfers[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x35')],transfers[_0x5614ba['uniqueid']]['agentconnectAt']);transfers[_0x5614ba[_0xeb9b('0x6')]]['reason']='agent';transfers[_0x5614ba[_0xeb9b('0x6')]]['lastevent']='complete';utils['info'](util[_0xeb9b('0x4')](_0xeb9b('0x53'),_0x5614ba[_0xeb9b('0x6')],transfers[_0x5614ba[_0xeb9b('0x6')]]['membername'],transfers[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x21')],transfers[_0x5614ba[_0xeb9b('0x6')]]['lastevent']));writeDB(transfers[_0x5614ba['uniqueid']],!![]);}if(agents[_0x5614ba[_0xeb9b('0x6')]]&&agents[_0x5614ba['uniqueid']][_0xeb9b('0x2e')]){agents[_0x5614ba['uniqueid']]['agentcomplete']=!![];agents[_0x5614ba[_0xeb9b('0x6')]]['agentcompleteAt']=utils[_0xeb9b('0x16')]();agents[_0x5614ba['uniqueid']]['talktime']=utils[_0xeb9b('0x36')](agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x35')],agents[_0x5614ba[_0xeb9b('0x6')]]['agentconnectAt']);agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x21')]=agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0x3b')]?_0xeb9b('0x3b'):_0xeb9b('0x56');agents[_0x5614ba['uniqueid']][_0xeb9b('0xa')]='complete';utils[_0xeb9b('0x3')](util[_0xeb9b('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5614ba[_0xeb9b('0x6')],agents[_0x5614ba['uniqueid']][_0xeb9b('0x7')],agents[_0x5614ba['uniqueid']][_0xeb9b('0x21')],agents[_0x5614ba[_0xeb9b('0x6')]][_0xeb9b('0xa')]));writeDB(agents[_0x5614ba[_0xeb9b('0x6')]]);}}catch(_0x31b0c5){utils[_0xeb9b('0x1a')](util[_0xeb9b('0x4')]('[%s][agents][hangup]',_0x5614ba[_0xeb9b('0x6')]),_0x31b0c5);}}; \ No newline at end of file +var _0xbc9d=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','lodash','util','./utils','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','debug','format','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout','reason','ringtime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','talktime','answered_elsewhere','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected'];(function(_0x2bcd5e,_0x238418){var _0xe80a42=function(_0x30f54d){while(--_0x30f54d){_0x2bcd5e['push'](_0x2bcd5e['shift']());}};_0xe80a42(++_0x238418);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x5458f4,_0x4d3557){_0x5458f4=_0x5458f4-0x0;var _0x4dcace=_0xbc9d[_0x5458f4];return _0x4dcace;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var utils=require(_0xdbc9('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x434f6e,_0x35f89c){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x434f6e[_0xdbc9('0x3')],_0x434f6e[_0xdbc9('0x4')],_0x434f6e[_0xdbc9('0x5')],_0x434f6e[_0xdbc9('0x6')],_0x434f6e[_0xdbc9('0x7')],_0x434f6e[_0xdbc9('0x8')],_0x434f6e[_0xdbc9('0x9')],_0x434f6e['lastevent']));if(_0x434f6e[_0xdbc9('0x5')]){utils[_0xdbc9('0xa')](_0x434f6e[_0xdbc9('0x5')])['then'](function(_0x2c7ba5){if(_0x2c7ba5){_0x434f6e['type']=_0x2c7ba5['type'];_0x434f6e[_0xdbc9('0xb')]=_0x434f6e[_0xdbc9('0xc')]?_0x2c7ba5[_0xdbc9('0xd')]:![];_0x434f6e[_0xdbc9('0xe')]=_0x434f6e['agentacw']?_0x2c7ba5[_0xdbc9('0xf')]:0x0;}utils[_0xdbc9('0x10')](_0xdbc9('0x11'),_0x434f6e);});}else{utils[_0xdbc9('0x10')](_0xdbc9('0x11'),_0x434f6e);}if(_0x35f89c){delete transfers[_0x434f6e[_0xdbc9('0x3')]];}else{delete agents[_0x434f6e['destuniqueid']];}}exports['agentcalled']=function(_0x3d0fdd){try{utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x14'),_0x3d0fdd[_0xdbc9('0x3')]),_0x3d0fdd);agents[_0x3d0fdd['destuniqueid']]=_0x3d0fdd;agents[_0x3d0fdd[_0xdbc9('0x15')]][_0xdbc9('0x16')]=utils[_0xdbc9('0x17')]();agents[_0x3d0fdd['destuniqueid']][_0xdbc9('0x18')]=_0xdbc9('0x19');agents[_0x3d0fdd['destuniqueid']][_0xdbc9('0x9')]=null;agents[_0x3d0fdd[_0xdbc9('0x15')]][_0xdbc9('0x1a')]=null;utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x1c'),_0x3d0fdd[_0xdbc9('0x3')],agents[_0x3d0fdd[_0xdbc9('0x15')]][_0xdbc9('0x6')],_0x3d0fdd[_0xdbc9('0x15')]));}catch(_0x57a546){utils[_0xdbc9('0x1d')](util['format'](_0xdbc9('0x14'),_0x3d0fdd[_0xdbc9('0x3')]),_0x57a546);}};exports['agentringnoanswer']=function(_0x4408e9){try{if(!_['isNil'](agents[_0x4408e9['destuniqueid']])){utils['debug'](util['format'](_0xdbc9('0x1e'),_0x4408e9[_0xdbc9('0x3')]),_0x4408e9);utils['info'](util[_0xdbc9('0x13')](_0xdbc9('0x1f'),_0x4408e9['uniqueid'],agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x6')],_0x4408e9[_0xdbc9('0x15')]));agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x20')]=!![];agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x21')]=utils[_0xdbc9('0x17')]();agents[_0x4408e9[_0xdbc9('0x15')]]['lastevent']=_0xdbc9('0x22');agents[_0x4408e9[_0xdbc9('0x15')]][_0xdbc9('0x23')]=_0xdbc9('0x22');agents[_0x4408e9[_0xdbc9('0x15')]]['holdtime']=_0x4408e9[_0xdbc9('0x24')]?parseInt(_0x4408e9[_0xdbc9('0x24')])/0x3e8:0x0;agents[_0x4408e9['destuniqueid']]['talktime']=0x0;unanswered[_0xdbc9('0x25')](_0x4408e9[_0xdbc9('0x15')]);}}catch(_0x473430){utils['error'](util[_0xdbc9('0x13')]('[%s][agents][agentringnoanswer]',_0x4408e9['uniqueid']),_0x473430);}};exports[_0xdbc9('0x26')]=function(_0x49da36){try{_['forIn'](agents,function(_0x417b17,_0x20eb4f){if(_0x417b17[_0xdbc9('0x3')]==_0x49da36['uniqueid']&&!_[_0xdbc9('0x27')](unanswered,_0x417b17[_0xdbc9('0x15')])){utils['debug'](util['format'](_0xdbc9('0x28'),_0x49da36[_0xdbc9('0x3')]),_0x49da36);utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x29'),_0x49da36[_0xdbc9('0x3')],_0x417b17[_0xdbc9('0x6')],_0x417b17['destuniqueid']));_0x417b17[_0xdbc9('0x20')]=!![];_0x417b17[_0xdbc9('0x21')]=utils[_0xdbc9('0x17')]();_0x417b17[_0xdbc9('0x18')]=_0xdbc9('0x2a');_0x417b17[_0xdbc9('0x23')]='abandoned';_0x417b17[_0xdbc9('0x2b')]=_0x49da36['holdtime'];_0x417b17['talktime']=0x0;writeDB(_0x417b17);}});}catch(_0x495c0e){utils['error'](util['format'](_0xdbc9('0x28'),_0x49da36[_0xdbc9('0x3')]),_0x495c0e);}};exports[_0xdbc9('0x2c')]=function(_0x5527fc){try{if(agents[_0x5527fc[_0xdbc9('0x15')]]){utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x2d'),_0x5527fc[_0xdbc9('0x3')]),_0x5527fc);utils[_0xdbc9('0x1b')](util['format'](_0xdbc9('0x2e'),_0x5527fc[_0xdbc9('0x3')],agents[_0x5527fc[_0xdbc9('0x15')]]['membername'],_0x5527fc[_0xdbc9('0x15')]));agents[_0x5527fc[_0xdbc9('0x15')]][_0xdbc9('0x2f')]=utils[_0xdbc9('0x17')]();agents[_0x5527fc['destuniqueid']]['connectedlinenum']=_0x5527fc[_0xdbc9('0x9')];agents[_0x5527fc[_0xdbc9('0x15')]][_0xdbc9('0x1a')]=_0x5527fc[_0xdbc9('0x1a')];agents[_0x5527fc['destuniqueid']][_0xdbc9('0x2b')]=_0x5527fc[_0xdbc9('0x24')];agents[_0x5527fc[_0xdbc9('0x15')]]['lastevent']=_0xdbc9('0x30');_[_0xdbc9('0x31')](agents,function(_0x444219,_0x523c79){if(_0x444219[_0xdbc9('0x15')]!=_0x5527fc[_0xdbc9('0x15')]&&_0x444219['uniqueid']==_0x5527fc['uniqueid']){_0x444219[_0xdbc9('0x32')]=0x0;_0x444219[_0xdbc9('0x2b')]=_0x5527fc[_0xdbc9('0x24')];_0x444219[_0xdbc9('0x20')]=!![];_0x444219['agentringnoanswerAt']=utils[_0xdbc9('0x17')]();_0x444219[_0xdbc9('0x18')]='answered_elsewhere';_0x444219[_0xdbc9('0x23')]=_0xdbc9('0x33');_0x444219['answeredelsewheredestinationuniqueid']=_0x5527fc[_0xdbc9('0x15')];_0x444219[_0xdbc9('0x34')]=_0x5527fc[_0xdbc9('0x6')];writeDB(_0x444219);}});}}catch(_0x3415c3){utils[_0xdbc9('0x1d')](util[_0xdbc9('0x13')](_0xdbc9('0x2d'),_0x5527fc['uniqueid']),_0x3415c3);}};exports['agentcomplete']=function(_0x768856){try{if(!_[_0xdbc9('0x35')](agents[_0x768856[_0xdbc9('0x15')]])){utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x36'),_0x768856[_0xdbc9('0x3')]),_0x768856);utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x37'),_0x768856[_0xdbc9('0x3')],agents[_0x768856['destuniqueid']]['membername'],_0x768856[_0xdbc9('0x15')]));agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0xc')]=!![];agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x38')]=utils[_0xdbc9('0x17')]();agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x32')]=utils['diffTime'](agents[_0x768856['destuniqueid']][_0xdbc9('0x38')],agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x2f')]);agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x23')]=_0x768856[_0xdbc9('0x23')];agents[_0x768856[_0xdbc9('0x15')]][_0xdbc9('0x18')]=_0xdbc9('0x39');writeDB(agents[_0x768856['destuniqueid']]);}}catch(_0x2c24a9){utils[_0xdbc9('0x1d')](util['format']('[%s][agents][agentcomplete]',_0x768856[_0xdbc9('0x3')]),_0x2c24a9);}};exports[_0xdbc9('0x3a')]=function(_0x133a13){try{if(!_['isNil'](agents[_0x133a13[_0xdbc9('0x3b')]])){utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x3c'),_0x133a13['uniqueid']),_0x133a13);utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')](_0xdbc9('0x3d'),_0x133a13[_0xdbc9('0x3')],agents[_0x133a13['transfereruniqueid']][_0xdbc9('0x6')],agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x3')]));agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x3e')]=!![];agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x3f')]=_0xdbc9('0x40');agents[_0x133a13['transfereruniqueid']][_0xdbc9('0x41')]=_0x133a13['extension'];agents[_0x133a13[_0xdbc9('0x3b')]][_0xdbc9('0x42')]=agents[_0x133a13['transfereruniqueid']]['uniqueid'];}}catch(_0xc7335d){utils['error'](util[_0xdbc9('0x13')](_0xdbc9('0x3c'),_0x133a13[_0xdbc9('0x3')]),_0xc7335d);}};exports['attendedtransfer']=function(_0x32b38d){try{utils[_0xdbc9('0x12')](util[_0xdbc9('0x13')](_0xdbc9('0x43'),_0x32b38d[_0xdbc9('0x44')]),_0x32b38d);if(_0x32b38d[_0xdbc9('0x44')]==_0x32b38d[_0xdbc9('0x45')]){if(!_[_0xdbc9('0x35')](agents[_0x32b38d['secondtransfereruniqueid']])){utils['info'](util['format'](_0xdbc9('0x46'),_0x32b38d[_0xdbc9('0x44')],agents[_0x32b38d[_0xdbc9('0x47')]]['membername']));agents[_0x32b38d['secondtransfereruniqueid']][_0xdbc9('0x3e')]=!![];agents[_0x32b38d[_0xdbc9('0x47')]]['transfertype']='ATTENDED';agents[_0x32b38d[_0xdbc9('0x47')]][_0xdbc9('0x41')]=_0x32b38d[_0xdbc9('0x48')];agents[_0x32b38d[_0xdbc9('0x47')]][_0xdbc9('0x42')]=_0x32b38d[_0xdbc9('0x44')];}if(_0x32b38d['transfereeuniqueid']&&agents[_0x32b38d[_0xdbc9('0x49')]]){agents[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x4a')]=0x1;transfers[_0x32b38d['transfereeuniqueid']]=_[_0xdbc9('0x4b')](agents[_0x32b38d[_0xdbc9('0x49')]]);transfers[_0x32b38d[_0xdbc9('0x49')]]['calleridnum']=agents[_0x32b38d[_0xdbc9('0x47')]]['calleridnum'];transfers[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x4c')]=agents[_0x32b38d[_0xdbc9('0x47')]][_0xdbc9('0x4c')];transfers[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x16')]=utils['now']();transfers[_0x32b38d[_0xdbc9('0x49')]]['agentconnectAt']=utils[_0xdbc9('0x17')]();transfers[_0x32b38d[_0xdbc9('0x49')]]['holdtime']=0x0;transfers[_0x32b38d[_0xdbc9('0x49')]][_0xdbc9('0x4a')]=0x2;}}else if(_0x32b38d['secondtransfereruniqueid']==_0x32b38d['secondtransfererlinkedid']){if(!_[_0xdbc9('0x35')](agents[_0x32b38d[_0xdbc9('0x44')]])){utils[_0xdbc9('0x1b')](util['format'](_0xdbc9('0x46'),_0x32b38d[_0xdbc9('0x44')],agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x6')]));agents[_0x32b38d[_0xdbc9('0x44')]]['transfer']=!![];agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x3f')]=_0xdbc9('0x4d');agents[_0x32b38d[_0xdbc9('0x44')]][_0xdbc9('0x41')]=_0x32b38d[_0xdbc9('0x4e')];agents[_0x32b38d[_0xdbc9('0x44')]][_0xdbc9('0x42')]=_0x32b38d[_0xdbc9('0x47')];}if(_0x32b38d['transfertargetuniqueid']&&agents[_0x32b38d[_0xdbc9('0x4f')]]){agents[_0x32b38d[_0xdbc9('0x4f')]][_0xdbc9('0x4a')]=0x1;transfers[_0x32b38d[_0xdbc9('0x4f')]]=_[_0xdbc9('0x4b')](agents[_0x32b38d[_0xdbc9('0x4f')]]);transfers[_0x32b38d[_0xdbc9('0x4f')]][_0xdbc9('0x8')]=agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x8')];transfers[_0x32b38d['transfertargetuniqueid']][_0xdbc9('0x4c')]=agents[_0x32b38d['origtransfereruniqueid']][_0xdbc9('0x4c')];transfers[_0x32b38d[_0xdbc9('0x4f')]]['agentcalledAt']=utils['now']();transfers[_0x32b38d['transfertargetuniqueid']][_0xdbc9('0x2f')]=utils[_0xdbc9('0x17')]();transfers[_0x32b38d[_0xdbc9('0x4f')]]['holdtime']=0x0;transfers[_0x32b38d[_0xdbc9('0x4f')]][_0xdbc9('0x4a')]=0x2;}}}catch(_0x53843c){utils[_0xdbc9('0x1d')](util[_0xdbc9('0x13')](_0xdbc9('0x43'),_0x32b38d[_0xdbc9('0x44')]),_0x53843c);}};exports[_0xdbc9('0x50')]=function(_0xfdfb20){try{utils['debug'](util[_0xdbc9('0x13')](_0xdbc9('0x51'),_0xfdfb20['uniqueid']),_0xfdfb20);if(agents[_0xfdfb20['uniqueid']]&&agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')]===_0xdbc9('0x22')){if(_0xfdfb20[_0xdbc9('0x52')]==='21'){agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')]=_0xdbc9('0x53');agents[_0xfdfb20['uniqueid']][_0xdbc9('0x18')]=_0xdbc9('0x53');}utils[_0xdbc9('0x1b')](util['format'](_0xdbc9('0x54'),_0xfdfb20[_0xdbc9('0x3')],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x6')],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]));writeDB(agents[_0xfdfb20[_0xdbc9('0x3')]]);var _0x1afbcd=unanswered[_0xdbc9('0x55')](_0xfdfb20[_0xdbc9('0x3')]);if(_0x1afbcd>-0x1){unanswered['splice'](_0x1afbcd,0x1);}}if(transfers[_0xfdfb20['uniqueid']]){transfers[_0xfdfb20[_0xdbc9('0x3')]]['agentcomplete']=!![];transfers[_0xfdfb20['uniqueid']][_0xdbc9('0x38')]=utils[_0xdbc9('0x17')]();transfers[_0xfdfb20[_0xdbc9('0x3')]]['talktime']=utils[_0xdbc9('0x56')](transfers[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x38')],transfers[_0xfdfb20['uniqueid']][_0xdbc9('0x2f')]);transfers[_0xfdfb20[_0xdbc9('0x3')]]['reason']=_0xdbc9('0x57');transfers[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]=_0xdbc9('0x39');utils[_0xdbc9('0x1b')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xfdfb20[_0xdbc9('0x3')],transfers[_0xfdfb20[_0xdbc9('0x3')]]['membername'],transfers[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x23')],transfers[_0xfdfb20[_0xdbc9('0x3')]]['lastevent']));writeDB(transfers[_0xfdfb20[_0xdbc9('0x3')]],!![]);}if(agents[_0xfdfb20[_0xdbc9('0x3')]]&&agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x2f')]){agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0xc')]=!![];agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x38')]=utils['now']();agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x32')]=utils[_0xdbc9('0x56')](agents[_0xfdfb20[_0xdbc9('0x3')]]['agentcompleteAt'],agents[_0xfdfb20[_0xdbc9('0x3')]]['agentconnectAt']);agents[_0xfdfb20['uniqueid']][_0xdbc9('0x23')]=agents[_0xfdfb20[_0xdbc9('0x3')]]['transfer']?_0xdbc9('0x3e'):_0xdbc9('0x57');agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]=_0xdbc9('0x39');utils[_0xdbc9('0x1b')](util[_0xdbc9('0x13')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xfdfb20['uniqueid'],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x6')],agents[_0xfdfb20[_0xdbc9('0x3')]]['reason'],agents[_0xfdfb20[_0xdbc9('0x3')]][_0xdbc9('0x18')]));writeDB(agents[_0xfdfb20[_0xdbc9('0x3')]]);}}catch(_0x1839e4){utils[_0xdbc9('0x1d')](util[_0xdbc9('0x13')](_0xdbc9('0x51'),_0xfdfb20[_0xdbc9('0x3')]),_0x1839e4);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9c69e63..2647e64 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 _0x1626=['[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','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','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','substring','includes','noop','execif','gotoif','[%s][calls][newexten]','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','uniqueid','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','channelstate','transfer','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1626,0x15d));var _0x6162=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x1626[_0x5b78e8];return _0xf2c321;};'use strict';var _=require('lodash');var util=require(_0x6162('0x0'));var utils=require(_0x6162('0x1'));var dispositions=['NO\x20ANSWER',_0x6162('0x2'),_0x6162('0x2'),_0x6162('0x3'),_0x6162('0x3'),_0x6162('0x3'),_0x6162('0x4'),_0x6162('0x5'),'FAILED',_0x6162('0x2'),_0x6162('0x2')];var channels={};function writeDB(_0x5ba69f){utils[_0x6162('0x6')](util[_0x6162('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x5ba69f[_0x6162('0x8')],_0x5ba69f['channel'],_0x5ba69f['queue'],_0x5ba69f['membername'],_0x5ba69f['interface'],_0x5ba69f[_0x6162('0x9')],_0x5ba69f[_0x6162('0xa')],_0x5ba69f[_0x6162('0xb')]));if(_0x5ba69f['accountcode']){utils['getUserByInternal'](_0x5ba69f[_0x6162('0xc')])[_0x6162('0xd')](function(_0x340597){if(_0x340597){_0x5ba69f[_0x6162('0xe')]=_0x340597['id'];}utils[_0x6162('0xf')](_0x6162('0x10'),_0x5ba69f);});}else{utils[_0x6162('0xf')]('CreateVoiceCallReport',_0x5ba69f);}if(channels[_0x5ba69f[_0x6162('0x8')]]){delete channels[_0x5ba69f[_0x6162('0x8')]];}}exports['newchannel']=function(_0x4854f0){try{utils[_0x6162('0x11')](util[_0x6162('0x7')](_0x6162('0x12'),_0x4854f0[_0x6162('0x8')]),_0x4854f0);if(_0x4854f0[_0x6162('0x8')]==_0x4854f0[_0x6162('0x13')]&&_0x4854f0[_0x6162('0x14')]!=_0x6162('0x15')){utils['info'](util[_0x6162('0x7')](_0x6162('0x16'),_0x4854f0[_0x6162('0x8')],_0x4854f0[_0x6162('0x17')],_0x4854f0[_0x6162('0x18')]));channels[_0x4854f0[_0x6162('0x8')]]={'uniqueid':_0x4854f0[_0x6162('0x8')],'accountcode':_0x4854f0['accountcode'],'source':_0x4854f0[_0x6162('0x9')],'destination':_0x4854f0[_0x6162('0x18')],'destinationcontext':_0x4854f0[_0x6162('0x17')],'channel':_0x4854f0[_0x6162('0x14')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6162('0x3'),'amaflags':_0x6162('0x19')};}}catch(_0x1616dc){utils[_0x6162('0x1a')](util[_0x6162('0x7')]('[%s][calls][newchannel]',_0x4854f0[_0x6162('0x8')]),_0x1616dc);}};exports[_0x6162('0x1b')]=function(_0x578e17){try{utils['debug'](util[_0x6162('0x7')](_0x6162('0x1c'),_0x578e17[_0x6162('0x8')]),_0x578e17);if(!_[_0x6162('0x1d')](channels[_0x578e17[_0x6162('0x8')]])&&_0x578e17['channelstate']==0x6){utils['info'](util[_0x6162('0x7')](_0x6162('0x1e'),_0x578e17[_0x6162('0x8')],_0x578e17[_0x6162('0x17')],_0x578e17[_0x6162('0x14')]));if(_[_0x6162('0x1d')](channels[_0x578e17[_0x6162('0x8')]][_0x6162('0x1f')])){channels[_0x578e17[_0x6162('0x8')]][_0x6162('0x1f')]=utils[_0x6162('0x20')]();}}else if(!_['isNil'](channels[_0x578e17[_0x6162('0x13')]])&&_0x578e17[_0x6162('0x21')]==0x6&&_0x578e17[_0x6162('0x17')]!=_0x6162('0x22')){utils[_0x6162('0x6')](util[_0x6162('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x578e17[_0x6162('0x8')],_0x578e17[_0x6162('0x13')],_0x578e17[_0x6162('0x17')],_0x578e17[_0x6162('0x14')]));channels[_0x578e17['linkedid']]['accountcode']=_0x578e17[_0x6162('0xc')];channels[_0x578e17['linkedid']][_0x6162('0x23')]=_0x578e17[_0x6162('0x14')];if(_[_0x6162('0x1d')](channels[_0x578e17[_0x6162('0x13')]][_0x6162('0x24')])){channels[_0x578e17[_0x6162('0x13')]]['answertime']=utils[_0x6162('0x20')]();}channels[_0x578e17[_0x6162('0x13')]][_0x6162('0x25')]=dispositions[_[_0x6162('0x26')](_0x578e17[_0x6162('0x21')])]||_0x6162('0x4');}}catch(_0x3272f6){utils[_0x6162('0x1a')](util[_0x6162('0x7')](_0x6162('0x1c'),_0x578e17[_0x6162('0x8')]),_0x3272f6);}};exports[_0x6162('0x27')]=function(_0xc05eb7){try{if(!_[_0x6162('0x1d')](channels[_0xc05eb7[_0x6162('0x8')]])){utils[_0x6162('0x11')](util[_0x6162('0x7')](_0x6162('0x28'),_0xc05eb7[_0x6162('0x8')]),_0xc05eb7);if(_[_0x6162('0x1d')](channels[_0xc05eb7[_0x6162('0x8')]][_0x6162('0x29')])){channels[_0xc05eb7[_0x6162('0x8')]][_0x6162('0x29')]=_0xc05eb7['calleridname']+'\x20<'+_0xc05eb7[_0x6162('0x9')]+'>';}utils[_0x6162('0x6')](util[_0x6162('0x7')](_0x6162('0x2a'),_0xc05eb7[_0x6162('0x8')],channels[_0xc05eb7[_0x6162('0x8')]][_0x6162('0x29')],_0xc05eb7['cause-txt']));channels[_0xc05eb7['uniqueid']][_0x6162('0x2b')]=utils['now']();channels[_0xc05eb7[_0x6162('0x8')]]['duration']=utils[_0x6162('0x2c')](channels[_0xc05eb7['uniqueid']]['endtime'],channels[_0xc05eb7[_0x6162('0x8')]]['starttime']);channels[_0xc05eb7[_0x6162('0x8')]][_0x6162('0x2d')]=channels[_0xc05eb7[_0x6162('0x8')]][_0x6162('0x24')]?utils[_0x6162('0x2c')](channels[_0xc05eb7[_0x6162('0x8')]]['endtime'],channels[_0xc05eb7[_0x6162('0x8')]][_0x6162('0x24')]):0x0;writeDB(channels[_0xc05eb7[_0x6162('0x8')]]);}}catch(_0x20a277){utils[_0x6162('0x1a')](util[_0x6162('0x7')]('[%s][calls][hangup]',_0xc05eb7[_0x6162('0x8')]),_0x20a277);}};exports[_0x6162('0x2e')]=function(_0x564bc6){try{if(!_[_0x6162('0x1d')](channels[_0x564bc6[_0x6162('0x2f')]])){utils[_0x6162('0x11')](util[_0x6162('0x7')](_0x6162('0x30'),_0x564bc6[_0x6162('0x31')]),_0x564bc6);if(channels[_0x564bc6[_0x6162('0x2f')]]['channel']==_0x564bc6[_0x6162('0x32')]){utils[_0x6162('0x6')](util[_0x6162('0x7')](_0x6162('0x33'),_0x564bc6['origtransfereruniqueid'],_0x564bc6['localtwolinkedid'],_0x564bc6[_0x6162('0x34')]));channels[_0x564bc6[_0x6162('0x2f')]][_0x6162('0x23')]=_0x564bc6[_0x6162('0x34')];channels[_0x564bc6['localtwolinkedid']]['userfield']=_0x6162('0x35');}else if(channels[_0x564bc6[_0x6162('0x2f')]][_0x6162('0x14')]=_0x564bc6[_0x6162('0x36')]){utils[_0x6162('0x6')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x564bc6[_0x6162('0x31')],_0x564bc6[_0x6162('0x2f')],_0x564bc6['origtransfererchannel']));channels[_0x564bc6[_0x6162('0x2f')]]['destinationchannel']=_0x564bc6[_0x6162('0x37')];channels[_0x564bc6[_0x6162('0x2f')]]['userfield']=_0x6162('0x35');}}}catch(_0x113615){utils['error'](util[_0x6162('0x7')]('[%s][calls][attendedtransfer]',_0x564bc6[_0x6162('0x31')]),_0x113615);}};exports[_0x6162('0x38')]=function(_0x8704f4){try{if(!_[_0x6162('0x1d')](channels[_0x8704f4['uniqueid']])){utils['debug'](util[_0x6162('0x7')](_0x6162('0x39'),_0x8704f4['uniqueid']),_0x8704f4);channels[_0x8704f4['uniqueid']][_0x6162('0x3a')]=utils[_0x6162('0x20')]();utils['info'](util[_0x6162('0x7')](_0x6162('0x3b'),_0x8704f4['uniqueid'],channels[_0x8704f4[_0x6162('0x8')]][_0x6162('0x3a')]));}}catch(_0x28520f){utils[_0x6162('0x1a')](util[_0x6162('0x7')]('[%s][calls][musiconholdstart]',_0x8704f4['uniqueid']),_0x28520f);}};exports[_0x6162('0x3c')]=function(_0x5f3ecf){try{if(!_[_0x6162('0x1d')](channels[_0x5f3ecf[_0x6162('0x8')]])){utils['debug'](util[_0x6162('0x7')](_0x6162('0x3d'),_0x5f3ecf[_0x6162('0x8')]),_0x5f3ecf);if(!_['isNil'](channels[_0x5f3ecf['uniqueid']][_0x6162('0x3a')])){channels[_0x5f3ecf[_0x6162('0x8')]][_0x6162('0x3e')]+=utils[_0x6162('0x2c')](utils[_0x6162('0x20')](),channels[_0x5f3ecf[_0x6162('0x8')]][_0x6162('0x3a')]);utils[_0x6162('0x6')](util[_0x6162('0x7')](_0x6162('0x3f'),_0x5f3ecf[_0x6162('0x8')],channels[_0x5f3ecf['uniqueid']]['mohtime']));delete channels[_0x5f3ecf['uniqueid']][_0x6162('0x3a')];}}}catch(_0x564ae8){utils[_0x6162('0x1a')](util[_0x6162('0x7')]('[%s][calls][musiconholdstop]',_0x5f3ecf[_0x6162('0x8')]),_0x564ae8);}};exports['varset']=function(_0x198fb1){try{if(!_['isNil'](channels[_0x198fb1['uniqueid']])){utils[_0x6162('0x11')](util['format']('[%s][calls][varset]',_0x198fb1[_0x6162('0x8')]),_0x198fb1);if(!_[_0x6162('0x1d')](_0x198fb1[_0x6162('0x40')][_0x6162('0x41')])){utils[_0x6162('0x6')](util['format'](_0x6162('0x42'),_0x198fb1['uniqueid'],_0x198fb1[_0x6162('0x43')]));channels[_0x198fb1[_0x6162('0x8')]]['source']=_0x198fb1[_0x6162('0x43')];}if(!_[_0x6162('0x1d')](_0x198fb1[_0x6162('0x40')][_0x6162('0x44')])){utils[_0x6162('0x6')](util[_0x6162('0x7')](_0x6162('0x45'),_0x198fb1[_0x6162('0x8')],_0x198fb1[_0x6162('0x43')]));channels[_0x198fb1[_0x6162('0x8')]]['destination']=_0x198fb1['value'];channels[_0x198fb1[_0x6162('0x8')]][_0x6162('0x29')]='\x22'+_0x198fb1[_0x6162('0x43')]+_0x6162('0x46')+_0x198fb1[_0x6162('0x43')]+'>';}if(!_[_0x6162('0x1d')](_0x198fb1[_0x6162('0x40')][_0x6162('0x47')])||!_[_0x6162('0x1d')](_0x198fb1[_0x6162('0x40')][_0x6162('0x48')])){utils[_0x6162('0x6')](util[_0x6162('0x7')](_0x6162('0x49'),_0x198fb1[_0x6162('0x8')],!_['isNil'](_0x198fb1[_0x6162('0x40')][_0x6162('0x47')])?_0x6162('0x47'):_0x6162('0x48'),_0x198fb1[_0x6162('0x43')]));channels[_0x198fb1[_0x6162('0x8')]][_0x6162('0x29')]=_0x198fb1[_0x6162('0x43')];}if(!_['isNil'](_0x198fb1[_0x6162('0x40')][_0x6162('0x4a')])||!_['isNil'](_0x198fb1[_0x6162('0x40')][_0x6162('0x4b')])){utils[_0x6162('0x6')](util[_0x6162('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x198fb1[_0x6162('0x8')],!_[_0x6162('0x1d')](_0x198fb1[_0x6162('0x40')][_0x6162('0x4a')])?_0x6162('0x4a'):'xmcs-queue',_0x198fb1[_0x6162('0x43')]));channels[_0x198fb1['uniqueid']][_0x6162('0x4c')]=_0x6162('0x4d');channels[_0x198fb1[_0x6162('0x8')]][_0x6162('0x4e')]=_0x198fb1[_0x6162('0x43')];channels[_0x198fb1[_0x6162('0x8')]][_0x6162('0x4f')]=!![];}if(!_['isNil'](_0x198fb1[_0x6162('0x40')][_0x6162('0x50')])){utils[_0x6162('0x6')](util[_0x6162('0x7')](_0x6162('0x51'),_0x198fb1[_0x6162('0x8')],_0x198fb1[_0x6162('0x43')]));channels[_0x198fb1[_0x6162('0x8')]][_0x6162('0x52')]=_0x198fb1[_0x6162('0x43')];}if(!_[_0x6162('0x1d')](_0x198fb1[_0x6162('0x40')][_0x6162('0x53')])){utils[_0x6162('0x6')](util['format'](_0x6162('0x54'),_0x198fb1[_0x6162('0x8')],_0x198fb1[_0x6162('0x43')]));channels[_0x198fb1[_0x6162('0x8')]]['type']=_0x198fb1[_0x6162('0x43')];}if(!_[_0x6162('0x1d')](_0x198fb1[_0x6162('0x40')][_0x6162('0x55')])){utils[_0x6162('0x6')](util[_0x6162('0x7')](_0x6162('0x56'),_0x198fb1['uniqueid'],_0x198fb1[_0x6162('0x43')]));channels[_0x198fb1['uniqueid']]['routeid']=_0x198fb1['value'];}if(!_[_0x6162('0x1d')](_0x198fb1['variable'][_0x6162('0x57')])){utils[_0x6162('0x6')](util[_0x6162('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x198fb1[_0x6162('0x8')],_0x198fb1[_0x6162('0x43')]));channels[_0x198fb1[_0x6162('0x8')]]['sipcallid']=_0x198fb1[_0x6162('0x43')];}}}catch(_0x41c47d){utils[_0x6162('0x1a')](util['format'](_0x6162('0x58'),_0x198fb1[_0x6162('0x8')]),_0x41c47d);}};exports[_0x6162('0x59')]=function(_0x259e3c){try{if(!_['isNil'](channels[_0x259e3c[_0x6162('0x8')]])){utils[_0x6162('0x11')](util[_0x6162('0x7')]('[%s][calls][newexten]',_0x259e3c[_0x6162('0x8')]),_0x259e3c);utils['info'](util[_0x6162('0x7')](_0x6162('0x5a'),_0x259e3c[_0x6162('0x8')],_0x259e3c[_0x6162('0x5b')],_0x259e3c['appdata']));if(_0x259e3c['application'][_0x6162('0x5c')]()=='set'&&_[_0x6162('0x5d')](_0x259e3c[_0x6162('0x5e')][_0x6162('0x5c')](),_0x6162('0x5f'))){var _0x5d2acf=_0x259e3c['appdata'][_0x6162('0x60')]('=');var _0x358e26=_0x5d2acf[0x0][_0x6162('0x61')](_0x5d2acf[0x0]['lastIndexOf']('(')+0x1,_0x5d2acf[0x0]['lastIndexOf'](')'));var _0x4ccb6f=_0x5d2acf[0x1];channels[_0x259e3c['uniqueid']][_0x358e26]=_0x4ccb6f;}if(!_[_0x6162('0x62')](['hangup',_0x6162('0x63'),_0x6162('0x64'),'set',_0x6162('0x65')],_0x259e3c[_0x6162('0x5b')][_0x6162('0x5c')]())){channels[_0x259e3c['uniqueid']]['lastapplication']=_0x259e3c['application'];channels[_0x259e3c[_0x6162('0x8')]][_0x6162('0x4e')]=_0x259e3c['appdata'];}}}catch(_0x5f9e29){utils[_0x6162('0x1a')](util[_0x6162('0x7')](_0x6162('0x66'),_0x259e3c['uniqueid']),_0x5f9e29);}}; \ No newline at end of file +var _0x37f4=['linkedid','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','destinationchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','[%s][calls][newexten]','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','noop','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','uniqueid','channel','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x37f4,0x122));var _0x437f=function(_0x5692b8,_0x49bbbd){_0x5692b8=_0x5692b8-0x0;var _0x634346=_0x37f4[_0x5692b8];return _0x634346;};'use strict';var _=require(_0x437f('0x0'));var util=require(_0x437f('0x1'));var utils=require(_0x437f('0x2'));var dispositions=[_0x437f('0x3'),_0x437f('0x4'),_0x437f('0x4'),_0x437f('0x3'),'NO\x20ANSWER',_0x437f('0x3'),_0x437f('0x5'),_0x437f('0x6'),_0x437f('0x4'),'FAILED',_0x437f('0x4')];var channels={};function writeDB(_0x12366b){utils[_0x437f('0x7')](util[_0x437f('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x12366b[_0x437f('0x9')],_0x12366b[_0x437f('0xa')],_0x12366b['queue'],_0x12366b['membername'],_0x12366b[_0x437f('0xb')],_0x12366b[_0x437f('0xc')],_0x12366b['connectedlinenum'],_0x12366b[_0x437f('0xd')]));if(_0x12366b[_0x437f('0xe')]){utils[_0x437f('0xf')](_0x12366b[_0x437f('0xe')])[_0x437f('0x10')](function(_0x22e968){if(_0x22e968){_0x12366b['UserId']=_0x22e968['id'];}utils[_0x437f('0x11')](_0x437f('0x12'),_0x12366b);});}else{utils['request'](_0x437f('0x12'),_0x12366b);}if(channels[_0x12366b['uniqueid']]){delete channels[_0x12366b[_0x437f('0x9')]];}}exports[_0x437f('0x13')]=function(_0x3121d8){try{utils[_0x437f('0x14')](util[_0x437f('0x8')](_0x437f('0x15'),_0x3121d8['uniqueid']),_0x3121d8);if(_0x3121d8[_0x437f('0x9')]==_0x3121d8[_0x437f('0x16')]&&_0x3121d8[_0x437f('0xa')]!='OutgoingSpoolFailed'){utils[_0x437f('0x7')](util[_0x437f('0x8')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3121d8[_0x437f('0x9')],_0x3121d8[_0x437f('0x17')],_0x3121d8[_0x437f('0x18')]));channels[_0x3121d8['uniqueid']]={'uniqueid':_0x3121d8[_0x437f('0x9')],'accountcode':_0x3121d8[_0x437f('0xe')],'source':_0x3121d8[_0x437f('0xc')],'destination':_0x3121d8[_0x437f('0x18')],'destinationcontext':_0x3121d8[_0x437f('0x17')],'channel':_0x3121d8[_0x437f('0xa')],'starttime':utils[_0x437f('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x437f('0x3'),'amaflags':_0x437f('0x1a')};}}catch(_0x4fa1a6){utils[_0x437f('0x1b')](util[_0x437f('0x8')](_0x437f('0x15'),_0x3121d8[_0x437f('0x9')]),_0x4fa1a6);}};exports[_0x437f('0x1c')]=function(_0x2dc289){try{utils[_0x437f('0x14')](util[_0x437f('0x8')](_0x437f('0x1d'),_0x2dc289[_0x437f('0x9')]),_0x2dc289);if(!_['isNil'](channels[_0x2dc289['uniqueid']])&&_0x2dc289[_0x437f('0x1e')]==0x6){utils['info'](util['format'](_0x437f('0x1f'),_0x2dc289['uniqueid'],_0x2dc289[_0x437f('0x17')],_0x2dc289[_0x437f('0xa')]));if(_[_0x437f('0x20')](channels[_0x2dc289[_0x437f('0x9')]][_0x437f('0x21')])){channels[_0x2dc289[_0x437f('0x9')]]['systemanswertime']=utils[_0x437f('0x19')]();}}else if(!_[_0x437f('0x20')](channels[_0x2dc289[_0x437f('0x16')]])&&_0x2dc289[_0x437f('0x1e')]==0x6&&_0x2dc289[_0x437f('0x17')]!='transfer'){utils[_0x437f('0x7')](util[_0x437f('0x8')](_0x437f('0x22'),_0x2dc289[_0x437f('0x9')],_0x2dc289[_0x437f('0x16')],_0x2dc289[_0x437f('0x17')],_0x2dc289[_0x437f('0xa')]));channels[_0x2dc289[_0x437f('0x16')]]['accountcode']=_0x2dc289['accountcode'];channels[_0x2dc289[_0x437f('0x16')]]['destinationchannel']=_0x2dc289['channel'];if(_[_0x437f('0x20')](channels[_0x2dc289['linkedid']][_0x437f('0x23')])){channels[_0x2dc289['linkedid']]['answertime']=utils['now']();}channels[_0x2dc289[_0x437f('0x16')]][_0x437f('0x24')]=dispositions[_['toNumber'](_0x2dc289['channelstate'])]||'ANSWERED';}}catch(_0x43430f){utils[_0x437f('0x1b')](util[_0x437f('0x8')](_0x437f('0x1d'),_0x2dc289['uniqueid']),_0x43430f);}};exports['hangup']=function(_0x12349c){try{if(!_[_0x437f('0x20')](channels[_0x12349c[_0x437f('0x9')]])){utils['debug'](util[_0x437f('0x8')](_0x437f('0x25'),_0x12349c['uniqueid']),_0x12349c);if(_[_0x437f('0x20')](channels[_0x12349c[_0x437f('0x9')]]['callerid'])){channels[_0x12349c[_0x437f('0x9')]][_0x437f('0x26')]=_0x12349c[_0x437f('0x27')]+'\x20<'+_0x12349c[_0x437f('0xc')]+'>';}utils[_0x437f('0x7')](util[_0x437f('0x8')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x12349c[_0x437f('0x9')],channels[_0x12349c[_0x437f('0x9')]]['callerid'],_0x12349c[_0x437f('0x28')]));channels[_0x12349c[_0x437f('0x9')]][_0x437f('0x29')]=utils[_0x437f('0x19')]();channels[_0x12349c[_0x437f('0x9')]][_0x437f('0x2a')]=utils[_0x437f('0x2b')](channels[_0x12349c['uniqueid']]['endtime'],channels[_0x12349c[_0x437f('0x9')]][_0x437f('0x2c')]);channels[_0x12349c[_0x437f('0x9')]][_0x437f('0x2d')]=channels[_0x12349c[_0x437f('0x9')]][_0x437f('0x23')]?utils[_0x437f('0x2b')](channels[_0x12349c[_0x437f('0x9')]][_0x437f('0x29')],channels[_0x12349c[_0x437f('0x9')]]['answertime']):0x0;writeDB(channels[_0x12349c[_0x437f('0x9')]]);}}catch(_0x166371){utils[_0x437f('0x1b')](util['format'](_0x437f('0x25'),_0x12349c[_0x437f('0x9')]),_0x166371);}};exports['attendedtransfer']=function(_0x59ce9e){try{if(!_[_0x437f('0x20')](channels[_0x59ce9e['localtwolinkedid']])){utils['debug'](util[_0x437f('0x8')](_0x437f('0x2e'),_0x59ce9e[_0x437f('0x2f')]),_0x59ce9e);if(channels[_0x59ce9e['localtwolinkedid']][_0x437f('0xa')]==_0x59ce9e[_0x437f('0x30')]){utils[_0x437f('0x7')](util['format'](_0x437f('0x31'),_0x59ce9e[_0x437f('0x2f')],_0x59ce9e[_0x437f('0x32')],_0x59ce9e[_0x437f('0x33')]));channels[_0x59ce9e[_0x437f('0x32')]]['destinationchannel']=_0x59ce9e[_0x437f('0x33')];channels[_0x59ce9e[_0x437f('0x32')]]['userfield']=_0x437f('0x34');}else if(channels[_0x59ce9e[_0x437f('0x32')]][_0x437f('0xa')]=_0x59ce9e[_0x437f('0x35')]){utils[_0x437f('0x7')](util[_0x437f('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x59ce9e[_0x437f('0x2f')],_0x59ce9e[_0x437f('0x32')],_0x59ce9e[_0x437f('0x36')]));channels[_0x59ce9e[_0x437f('0x32')]][_0x437f('0x37')]=_0x59ce9e[_0x437f('0x36')];channels[_0x59ce9e['localtwolinkedid']]['userfield']=_0x437f('0x34');}}}catch(_0x36df3c){utils[_0x437f('0x1b')](util[_0x437f('0x8')](_0x437f('0x2e'),_0x59ce9e[_0x437f('0x2f')]),_0x36df3c);}};exports[_0x437f('0x38')]=function(_0x4f0f6a){try{if(!_[_0x437f('0x20')](channels[_0x4f0f6a[_0x437f('0x9')]])){utils[_0x437f('0x14')](util[_0x437f('0x8')](_0x437f('0x39'),_0x4f0f6a[_0x437f('0x9')]),_0x4f0f6a);channels[_0x4f0f6a['uniqueid']][_0x437f('0x3a')]=utils[_0x437f('0x19')]();utils[_0x437f('0x7')](util[_0x437f('0x8')](_0x437f('0x3b'),_0x4f0f6a['uniqueid'],channels[_0x4f0f6a[_0x437f('0x9')]][_0x437f('0x3a')]));}}catch(_0xe2cc6f){utils[_0x437f('0x1b')](util[_0x437f('0x8')]('[%s][calls][musiconholdstart]',_0x4f0f6a[_0x437f('0x9')]),_0xe2cc6f);}};exports[_0x437f('0x3c')]=function(_0x2b3b5f){try{if(!_[_0x437f('0x20')](channels[_0x2b3b5f[_0x437f('0x9')]])){utils['debug'](util[_0x437f('0x8')](_0x437f('0x3d'),_0x2b3b5f[_0x437f('0x9')]),_0x2b3b5f);if(!_[_0x437f('0x20')](channels[_0x2b3b5f[_0x437f('0x9')]][_0x437f('0x3a')])){channels[_0x2b3b5f[_0x437f('0x9')]]['mohtime']+=utils[_0x437f('0x2b')](utils[_0x437f('0x19')](),channels[_0x2b3b5f[_0x437f('0x9')]]['musiconholdstartAt']);utils[_0x437f('0x7')](util[_0x437f('0x8')](_0x437f('0x3e'),_0x2b3b5f[_0x437f('0x9')],channels[_0x2b3b5f[_0x437f('0x9')]]['mohtime']));delete channels[_0x2b3b5f[_0x437f('0x9')]][_0x437f('0x3a')];}}}catch(_0x3d2c92){utils['error'](util[_0x437f('0x8')](_0x437f('0x3d'),_0x2b3b5f['uniqueid']),_0x3d2c92);}};exports[_0x437f('0x3f')]=function(_0x149197){try{if(!_['isNil'](channels[_0x149197['uniqueid']])){utils[_0x437f('0x14')](util[_0x437f('0x8')]('[%s][calls][varset]',_0x149197[_0x437f('0x9')]),_0x149197);if(!_[_0x437f('0x20')](_0x149197[_0x437f('0x40')][_0x437f('0x41')])){utils[_0x437f('0x7')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x149197[_0x437f('0x9')],_0x149197[_0x437f('0x42')]));channels[_0x149197[_0x437f('0x9')]][_0x437f('0x43')]=_0x149197[_0x437f('0x42')];}if(!_[_0x437f('0x20')](_0x149197[_0x437f('0x40')][_0x437f('0x44')])){utils[_0x437f('0x7')](util[_0x437f('0x8')](_0x437f('0x45'),_0x149197[_0x437f('0x9')],_0x149197[_0x437f('0x42')]));channels[_0x149197[_0x437f('0x9')]][_0x437f('0x46')]=_0x149197[_0x437f('0x42')];channels[_0x149197['uniqueid']][_0x437f('0x26')]='\x22'+_0x149197[_0x437f('0x42')]+_0x437f('0x47')+_0x149197[_0x437f('0x42')]+'>';}if(!_[_0x437f('0x20')](_0x149197[_0x437f('0x40')]['xmd-callerid-preview'])||!_[_0x437f('0x20')](_0x149197[_0x437f('0x40')][_0x437f('0x48')])){utils[_0x437f('0x7')](util[_0x437f('0x8')](_0x437f('0x49'),_0x149197['uniqueid'],!_[_0x437f('0x20')](_0x149197[_0x437f('0x40')][_0x437f('0x4a')])?_0x437f('0x4a'):'xmd-callerid',_0x149197['value']));channels[_0x149197[_0x437f('0x9')]][_0x437f('0x26')]=_0x149197[_0x437f('0x42')];}if(!_[_0x437f('0x20')](_0x149197[_0x437f('0x40')]['xmd-queue'])||!_[_0x437f('0x20')](_0x149197[_0x437f('0x40')][_0x437f('0x4b')])){utils[_0x437f('0x7')](util[_0x437f('0x8')](_0x437f('0x49'),_0x149197['uniqueid'],!_[_0x437f('0x20')](_0x149197['variable'][_0x437f('0x4c')])?_0x437f('0x4c'):_0x437f('0x4b'),_0x149197[_0x437f('0x42')]));channels[_0x149197[_0x437f('0x9')]][_0x437f('0x4d')]=_0x437f('0x4e');channels[_0x149197[_0x437f('0x9')]][_0x437f('0x4f')]=_0x149197[_0x437f('0x42')];channels[_0x149197[_0x437f('0x9')]][_0x437f('0x50')]=!![];}if(!_[_0x437f('0x20')](_0x149197['variable']['xmd-contactid'])){utils[_0x437f('0x7')](util['format'](_0x437f('0x51'),_0x149197['uniqueid'],_0x149197[_0x437f('0x42')]));channels[_0x149197[_0x437f('0x9')]]['ContactId']=_0x149197[_0x437f('0x42')];}if(!_[_0x437f('0x20')](_0x149197[_0x437f('0x40')][_0x437f('0x52')])){utils[_0x437f('0x7')](util[_0x437f('0x8')](_0x437f('0x53'),_0x149197[_0x437f('0x9')],_0x149197[_0x437f('0x42')]));channels[_0x149197[_0x437f('0x9')]][_0x437f('0x54')]=_0x149197['value'];}if(!_[_0x437f('0x20')](_0x149197['variable'][_0x437f('0x55')])){utils['info'](util[_0x437f('0x8')](_0x437f('0x56'),_0x149197[_0x437f('0x9')],_0x149197['value']));channels[_0x149197[_0x437f('0x9')]][_0x437f('0x57')]=_0x149197['value'];}if(!_['isNil'](_0x149197[_0x437f('0x40')]['sipcallid'])){utils['info'](util[_0x437f('0x8')](_0x437f('0x58'),_0x149197[_0x437f('0x9')],_0x149197[_0x437f('0x42')]));channels[_0x149197[_0x437f('0x9')]][_0x437f('0x59')]=_0x149197['value'];}}}catch(_0x34965a){utils[_0x437f('0x1b')](util[_0x437f('0x8')](_0x437f('0x5a'),_0x149197['uniqueid']),_0x34965a);}};exports['newexten']=function(_0xd14e36){try{if(!_[_0x437f('0x20')](channels[_0xd14e36[_0x437f('0x9')]])){utils[_0x437f('0x14')](util[_0x437f('0x8')](_0x437f('0x5b'),_0xd14e36[_0x437f('0x9')]),_0xd14e36);utils[_0x437f('0x7')](util[_0x437f('0x8')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0xd14e36[_0x437f('0x9')],_0xd14e36['application'],_0xd14e36[_0x437f('0x5c')]));if(_0xd14e36[_0x437f('0x5d')][_0x437f('0x5e')]()==_0x437f('0x5f')&&_[_0x437f('0x60')](_0xd14e36[_0x437f('0x5c')][_0x437f('0x5e')](),_0x437f('0x61'))){var _0x5a8037=_0xd14e36['appdata'][_0x437f('0x62')]('=');var _0x26598a=_0x5a8037[0x0][_0x437f('0x63')](_0x5a8037[0x0][_0x437f('0x64')]('(')+0x1,_0x5a8037[0x0][_0x437f('0x64')](')'));var _0xe4a0e8=_0x5a8037[0x1];channels[_0xd14e36[_0x437f('0x9')]][_0x26598a]=_0xe4a0e8;}if(!_['includes'](['hangup',_0x437f('0x65'),_0x437f('0x66'),_0x437f('0x5f'),_0x437f('0x67')],_0xd14e36['application'][_0x437f('0x5e')]())){channels[_0xd14e36[_0x437f('0x9')]][_0x437f('0x4d')]=_0xd14e36['application'];channels[_0xd14e36[_0x437f('0x9')]][_0x437f('0x4f')]=_0xd14e36['appdata'];}}}catch(_0x1babe5){utils[_0x437f('0x1b')](util[_0x437f('0x8')]('[%s][calls][newexten]',_0xd14e36[_0x437f('0x9')]),_0x1babe5);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 7686243..b07687c 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 _0xe816=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','./utils','connect','info'];(function(_0x4f919f,_0x22ed22){var _0xab6bb8=function(_0x10f93f){while(--_0x10f93f){_0x4f919f['push'](_0x4f919f['shift']());}};_0xab6bb8(++_0x22ed22);}(_0xe816,0x126));var _0x6e81=function(_0x3402e,_0x367a28){_0x3402e=_0x3402e-0x0;var _0x1bfbef=_0xe816[_0x3402e];return _0x1bfbef;};'use strict';var utils=require(_0x6e81('0x0'));exports[_0x6e81('0x1')]=function(){utils[_0x6e81('0x2')]('[core]\x20connected');};exports[_0x6e81('0x3')]=function(){utils[_0x6e81('0x2')](_0x6e81('0x4'));};exports[_0x6e81('0x5')]=function(){utils[_0x6e81('0x2')](_0x6e81('0x6'));};exports[_0x6e81('0x7')]=function(_0xce039){utils[_0x6e81('0x7')]('[core]\x20error',_0xce039);};exports[_0x6e81('0x8')]=function(){utils[_0x6e81('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x477ef4){}; \ No newline at end of file +var _0x0f9f=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x5c4cba,_0x2c0d39){var _0x64cb58=function(_0x19de62){while(--_0x19de62){_0x5c4cba['push'](_0x5c4cba['shift']());}};_0x64cb58(++_0x2c0d39);}(_0x0f9f,0xae));var _0xf0f9=function(_0x41cb50,_0x6015fb){_0x41cb50=_0x41cb50-0x0;var _0x445c4e=_0x0f9f[_0x41cb50];return _0x445c4e;};'use strict';var utils=require(_0xf0f9('0x0'));exports[_0xf0f9('0x1')]=function(){utils[_0xf0f9('0x2')](_0xf0f9('0x3'));};exports[_0xf0f9('0x4')]=function(){utils[_0xf0f9('0x2')](_0xf0f9('0x5'));};exports[_0xf0f9('0x6')]=function(){utils[_0xf0f9('0x2')](_0xf0f9('0x7'));};exports[_0xf0f9('0x8')]=function(_0x524fbd){utils[_0xf0f9('0x8')](_0xf0f9('0x9'),_0x524fbd);};exports['close']=function(){utils[_0xf0f9('0x2')](_0xf0f9('0xa'));};exports[_0xf0f9('0xb')]=function(_0x59b433){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index fb710ed..2d1e7eb 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 _0x33e1=['info','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','lodash','util'];(function(_0x34b448,_0x6bdfef){var _0x409dc1=function(_0x538ddc){while(--_0x538ddc){_0x34b448['push'](_0x34b448['shift']());}};_0x409dc1(++_0x6bdfef);}(_0x33e1,0x64));var _0x133e=function(_0x43f4ec,_0x28b1de){_0x43f4ec=_0x43f4ec-0x0;var _0x474739=_0x33e1[_0x43f4ec];return _0x474739;};'use strict';var _=require(_0x133e('0x0'));var util=require(_0x133e('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x48fb73){utils[_0x133e('0x2')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x48fb73[_0x133e('0x3')],_0x48fb73[_0x133e('0x4')],_0x48fb73[_0x133e('0x5')],_0x48fb73[_0x133e('0x6')],_0x48fb73[_0x133e('0x7')],_0x48fb73[_0x133e('0x8')]));utils[_0x133e('0x9')](_0x133e('0xa'),_0x48fb73);delete dials[_0x48fb73[_0x133e('0x3')]];}exports['newexten']=function(_0x2a64c9){try{utils[_0x133e('0xb')](util[_0x133e('0xc')](_0x133e('0xd'),_0x2a64c9[_0x133e('0x3')]),_0x2a64c9);utils[_0x133e('0x2')](util[_0x133e('0xc')](_0x133e('0xe'),_0x2a64c9[_0x133e('0x3')],_0x2a64c9[_0x133e('0xf')],_0x2a64c9[_0x133e('0x10')]));if(_0x2a64c9[_0x133e('0xf')][_0x133e('0x11')]()==_0x133e('0x12')&&_['startsWith'](_0x2a64c9[_0x133e('0x10')]['toLowerCase'](),_0x133e('0x13'))){var _0x419627=_0x2a64c9[_0x133e('0x10')][_0x133e('0x14')]('=');dials[_0x2a64c9['uniqueid']]={'routeId':_0x419627[0x1]};}}catch(_0x22a445){utils[_0x133e('0x15')](util[_0x133e('0xc')](_0x133e('0xd'),_0x2a64c9[_0x133e('0x3')]),_0x22a445);}};exports[_0x133e('0x16')]=function(_0x507a51){try{utils[_0x133e('0xb')](util['format']('[%s][dials][varset]',_0x507a51['uniqueid']),_0x507a51);if(!_[_0x133e('0x17')](_0x507a51[_0x133e('0x18')][_0x133e('0x19')])){utils[_0x133e('0x2')](util[_0x133e('0xc')](_0x133e('0x1a'),_0x507a51['uniqueid'],_0x507a51['value']));dials[_0x507a51[_0x133e('0x3')]]={'routeId':_0x507a51[_0x133e('0x1b')]};}}catch(_0xf2436d){utils[_0x133e('0x15')](util[_0x133e('0xc')](_0x133e('0x1c'),_0x507a51[_0x133e('0x3')]),_0xf2436d);}};exports[_0x133e('0x1d')]=function(_0x32a21a){try{if(!_[_0x133e('0x17')](dials[_0x32a21a['uniqueid']])){utils[_0x133e('0xb')](util[_0x133e('0xc')](_0x133e('0x1e'),_0x32a21a[_0x133e('0x3')]),_0x32a21a);dials[_0x32a21a[_0x133e('0x3')]]=_[_0x133e('0x1f')](dials[_0x32a21a[_0x133e('0x3')]],_0x32a21a);dials[_0x32a21a[_0x133e('0x3')]][_0x133e('0x20')]=utils[_0x133e('0x21')]();dials[_0x32a21a['uniqueid']][_0x133e('0x22')]='called';utils[_0x133e('0x2')](util[_0x133e('0xc')](_0x133e('0x23'),_0x32a21a[_0x133e('0x3')],dials[_0x32a21a[_0x133e('0x3')]][_0x133e('0x20')]));}}catch(_0x3bb305){utils[_0x133e('0x15')](util['format'](_0x133e('0x1e'),_0x32a21a['uniqueid']),_0x3bb305);}};exports[_0x133e('0x24')]=function(_0x3cce99){try{if(!_[_0x133e('0x17')](dials[_0x3cce99['uniqueid']])){utils[_0x133e('0xb')](util['format']('[%s][dials][dialend]',_0x3cce99['uniqueid']),_0x3cce99);dials[_0x3cce99[_0x133e('0x3')]][_0x133e('0x8')]=_0x3cce99[_0x133e('0x8')];if(_0x3cce99['dialstatus']==_0x133e('0x25')){dials[_0x3cce99['uniqueid']]=_[_0x133e('0x1f')](dials[_0x3cce99['uniqueid']],_0x3cce99);dials[_0x3cce99['uniqueid']][_0x133e('0x26')]=utils['now']();dials[_0x3cce99[_0x133e('0x3')]][_0x133e('0x22')]=_0x133e('0x27');utils[_0x133e('0x2')](util['format'](_0x133e('0x28'),_0x3cce99[_0x133e('0x3')],_0x3cce99[_0x133e('0x8')],dials[_0x3cce99[_0x133e('0x3')]][_0x133e('0x26')]));}else{utils[_0x133e('0x2')](util[_0x133e('0xc')](_0x133e('0x29'),_0x3cce99[_0x133e('0x3')],_0x3cce99[_0x133e('0x8')]));}}}catch(_0x5a1c61){utils[_0x133e('0x15')](util[_0x133e('0xc')]('[%s][dials][dialend]',_0x3cce99[_0x133e('0x3')]),_0x5a1c61);}};exports[_0x133e('0x2a')]=function(_0x31e5df){try{if(!_['isNil'](dials[_0x31e5df[_0x133e('0x3')]])){utils[_0x133e('0xb')](util[_0x133e('0xc')](_0x133e('0x2b'),_0x31e5df[_0x133e('0x3')]),_0x31e5df);utils[_0x133e('0x2')](util['format'](_0x133e('0x2c'),_0x31e5df[_0x133e('0x3')],_0x31e5df['calleridnum'],_0x31e5df[_0x133e('0x2d')],_0x31e5df[_0x133e('0x2e')]));dials[_0x31e5df[_0x133e('0x3')]]=_[_0x133e('0x1f')](dials[_0x31e5df[_0x133e('0x3')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x31e5df[_0x133e('0x3')]][_0x133e('0x2f')]=utils[_0x133e('0x30')](dials[_0x31e5df[_0x133e('0x3')]][_0x133e('0x31')],dials[_0x31e5df['uniqueid']][_0x133e('0x20')]);dials[_0x31e5df[_0x133e('0x3')]][_0x133e('0x32')]=utils[_0x133e('0x30')](dials[_0x31e5df[_0x133e('0x3')]][_0x133e('0x26')]||dials[_0x31e5df[_0x133e('0x3')]][_0x133e('0x31')],dials[_0x31e5df[_0x133e('0x3')]]['starttime']);dials[_0x31e5df['uniqueid']]['billableseconds']=dials[_0x31e5df[_0x133e('0x3')]]['answertime']?utils[_0x133e('0x30')](dials[_0x31e5df[_0x133e('0x3')]][_0x133e('0x31')],dials[_0x31e5df['uniqueid']][_0x133e('0x26')]):0x0;writeDB(dials[_0x31e5df['uniqueid']]);}}catch(_0x51ffd5){utils['error'](util[_0x133e('0xc')]('[%s][dials][hangup]',_0x31e5df[_0x133e('0x3')]),_0x51ffd5);}}; \ No newline at end of file +var _0x77f5=['isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','now','lastevent','called','starttime','dialend','assign','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','set','toLowerCase','cdr(routeid)','appdata','split','error','varset','[%s][dials][varset]'];(function(_0x37b7ce,_0x456318){var _0x424585=function(_0x4d95e1){while(--_0x4d95e1){_0x37b7ce['push'](_0x37b7ce['shift']());}};_0x424585(++_0x456318);}(_0x77f5,0xb3));var _0x577f=function(_0x129479,_0x256c7e){_0x129479=_0x129479-0x0;var _0x3fa0ce=_0x77f5[_0x129479];return _0x3fa0ce;};'use strict';var _=require(_0x577f('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x3de9fc){utils[_0x577f('0x1')](util[_0x577f('0x2')](_0x577f('0x3'),_0x3de9fc[_0x577f('0x4')],_0x3de9fc[_0x577f('0x5')],_0x3de9fc[_0x577f('0x6')],_0x3de9fc[_0x577f('0x7')],_0x3de9fc[_0x577f('0x8')],_0x3de9fc[_0x577f('0x9')]));utils[_0x577f('0xa')](_0x577f('0xb'),_0x3de9fc);delete dials[_0x3de9fc['uniqueid']];}exports[_0x577f('0xc')]=function(_0x5232d6){try{utils[_0x577f('0xd')](util['format'](_0x577f('0xe'),_0x5232d6[_0x577f('0x4')]),_0x5232d6);utils[_0x577f('0x1')](util[_0x577f('0x2')](_0x577f('0xf'),_0x5232d6['uniqueid'],_0x5232d6[_0x577f('0x10')],_0x5232d6['appdata']));if(_0x5232d6[_0x577f('0x10')]['toLowerCase']()==_0x577f('0x11')&&_['startsWith'](_0x5232d6['appdata'][_0x577f('0x12')](),_0x577f('0x13'))){var _0x870974=_0x5232d6[_0x577f('0x14')][_0x577f('0x15')]('=');dials[_0x5232d6['uniqueid']]={'routeId':_0x870974[0x1]};}}catch(_0x4ed4a1){utils[_0x577f('0x16')](util['format'](_0x577f('0xe'),_0x5232d6[_0x577f('0x4')]),_0x4ed4a1);}};exports[_0x577f('0x17')]=function(_0x10484a){try{utils[_0x577f('0xd')](util['format'](_0x577f('0x18'),_0x10484a['uniqueid']),_0x10484a);if(!_[_0x577f('0x19')](_0x10484a[_0x577f('0x1a')][_0x577f('0x1b')])){utils['info'](util[_0x577f('0x2')](_0x577f('0x1c'),_0x10484a[_0x577f('0x4')],_0x10484a[_0x577f('0x1d')]));dials[_0x10484a[_0x577f('0x4')]]={'routeId':_0x10484a[_0x577f('0x1d')]};}}catch(_0x4f13c2){utils[_0x577f('0x16')](util[_0x577f('0x2')]('[%s][dials][varset]',_0x10484a[_0x577f('0x4')]),_0x4f13c2);}};exports[_0x577f('0x1e')]=function(_0x26f224){try{if(!_[_0x577f('0x19')](dials[_0x26f224[_0x577f('0x4')]])){utils[_0x577f('0xd')](util[_0x577f('0x2')](_0x577f('0x1f'),_0x26f224[_0x577f('0x4')]),_0x26f224);dials[_0x26f224[_0x577f('0x4')]]=_['assign'](dials[_0x26f224[_0x577f('0x4')]],_0x26f224);dials[_0x26f224[_0x577f('0x4')]]['starttime']=utils[_0x577f('0x20')]();dials[_0x26f224[_0x577f('0x4')]][_0x577f('0x21')]=_0x577f('0x22');utils[_0x577f('0x1')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x26f224[_0x577f('0x4')],dials[_0x26f224[_0x577f('0x4')]][_0x577f('0x23')]));}}catch(_0x240c67){utils[_0x577f('0x16')](util[_0x577f('0x2')]('[%s][dials][dialbegin]',_0x26f224['uniqueid']),_0x240c67);}};exports[_0x577f('0x24')]=function(_0x342952){try{if(!_[_0x577f('0x19')](dials[_0x342952['uniqueid']])){utils['debug'](util[_0x577f('0x2')]('[%s][dials][dialend]',_0x342952[_0x577f('0x4')]),_0x342952);dials[_0x342952['uniqueid']][_0x577f('0x9')]=_0x342952[_0x577f('0x9')];if(_0x342952['dialstatus']=='ANSWER'){dials[_0x342952[_0x577f('0x4')]]=_[_0x577f('0x25')](dials[_0x342952[_0x577f('0x4')]],_0x342952);dials[_0x342952[_0x577f('0x4')]]['answertime']=utils[_0x577f('0x20')]();dials[_0x342952['uniqueid']][_0x577f('0x21')]=_0x577f('0x26');utils[_0x577f('0x1')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x342952[_0x577f('0x4')],_0x342952['dialstatus'],dials[_0x342952[_0x577f('0x4')]][_0x577f('0x27')]));}else{utils[_0x577f('0x1')](util['format'](_0x577f('0x28'),_0x342952[_0x577f('0x4')],_0x342952[_0x577f('0x9')]));}}}catch(_0x2b6aba){utils['error'](util['format'](_0x577f('0x29'),_0x342952[_0x577f('0x4')]),_0x2b6aba);}};exports[_0x577f('0x2a')]=function(_0x50942a){try{if(!_[_0x577f('0x19')](dials[_0x50942a[_0x577f('0x4')]])){utils[_0x577f('0xd')](util[_0x577f('0x2')](_0x577f('0x2b'),_0x50942a[_0x577f('0x4')]),_0x50942a);utils[_0x577f('0x1')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x50942a['uniqueid'],_0x50942a[_0x577f('0x7')],_0x50942a[_0x577f('0x2c')],_0x50942a[_0x577f('0x2d')]));dials[_0x50942a['uniqueid']]=_['assign'](dials[_0x50942a[_0x577f('0x4')]],{'endtime':utils[_0x577f('0x20')](),'lastevent':'complete'});dials[_0x50942a[_0x577f('0x4')]][_0x577f('0x2e')]=utils[_0x577f('0x2f')](dials[_0x50942a[_0x577f('0x4')]][_0x577f('0x30')],dials[_0x50942a['uniqueid']][_0x577f('0x23')]);dials[_0x50942a[_0x577f('0x4')]][_0x577f('0x31')]=utils['diffTime'](dials[_0x50942a[_0x577f('0x4')]][_0x577f('0x27')]||dials[_0x50942a[_0x577f('0x4')]][_0x577f('0x30')],dials[_0x50942a[_0x577f('0x4')]]['starttime']);dials[_0x50942a[_0x577f('0x4')]][_0x577f('0x32')]=dials[_0x50942a[_0x577f('0x4')]]['answertime']?utils['diffTime'](dials[_0x50942a[_0x577f('0x4')]][_0x577f('0x30')],dials[_0x50942a[_0x577f('0x4')]]['answertime']):0x0;writeDB(dials[_0x50942a['uniqueid']]);}}catch(_0x581f9a){utils[_0x577f('0x16')](util[_0x577f('0x2')]('[%s][dials][hangup]',_0x50942a[_0x577f('0x4')]),_0x581f9a);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 53b2265..8ecaec3 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 _0x188c=['managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','env','production','local','port','asterisk','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close'];(function(_0x597b8a,_0x1d8eaf){var _0x102dd1=function(_0x476915){while(--_0x476915){_0x597b8a['push'](_0x597b8a['shift']());}};_0x102dd1(++_0x1d8eaf);}(_0x188c,0xc1));var _0xc188=function(_0x49253a,_0x2c347d){_0x49253a=_0x49253a-0x0;var _0x749351=_0x188c[_0x49253a];return _0x749351;};var AsteriskManager=require(_0xc188('0x0'));var config=require(_0xc188('0x1'));var utils=require('./utils');var util=require(_0xc188('0x2'));var isXDREnabled=config['xdr']&&config[_0xc188('0x3')]['disabled']?!config[_0xc188('0x3')]['disabled']:!![];var isProduction=config[_0xc188('0x4')]===_0xc188('0x5')||![];var isLocalAsterisk=config[_0xc188('0x3')]&&config['xdr'][_0xc188('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xc188('0x7')],config[_0xc188('0x8')]['ip'],config[_0xc188('0x8')][_0xc188('0x9')],config[_0xc188('0x8')][_0xc188('0xa')],!![]);ami[_0xc188('0xb')]();if(!isXDREnabled){utils['info'](_0xc188('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xc188('0xd')](_0xc188('0xe'));}else{var agents=require(_0xc188('0xf'));var calls=require(_0xc188('0x10'));var queues=require(_0xc188('0x11'));var recordings=require('./recordings.controller');var members=require(_0xc188('0x12'));var dials=require(_0xc188('0x13'));var transfers=require(_0xc188('0x14'));var core=require('./core.controller');ami['on'](_0xc188('0x15'),core[_0xc188('0x15')]);ami['on'](_0xc188('0x16'),core[_0xc188('0x16')]);ami['on'](_0xc188('0x17'),core[_0xc188('0x17')]);ami['on'](_0xc188('0x18'),core[_0xc188('0x18')]);ami['on'](_0xc188('0x19'),core[_0xc188('0x19')]);ami['on'](_0xc188('0x1a'),core['managerevent']);ami['on'](_0xc188('0x1b'),function(_0x2dfa5d){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')](_0xc188('0x1e'),_0x2dfa5d[_0xc188('0x1f')]),_0x2dfa5d);members[_0xc188('0x1b')](_0x2dfa5d);}catch(_0x4996f5){utils[_0xc188('0x18')](util[_0xc188('0x1d')](_0xc188('0x1e'),_0x2dfa5d[_0xc188('0x1f')]),_0x4996f5);}});ami['on'](_0xc188('0x20'),function(_0x21000a){try{utils[_0xc188('0x1c')](util['format'](_0xc188('0x21'),_0x21000a['uniqueid']),_0x21000a);agents[_0xc188('0x20')](_0x21000a);}catch(_0x168918){utils[_0xc188('0x18')](util['format'](_0xc188('0x21'),_0x21000a[_0xc188('0x22')]),_0x168918);}});ami['on'](_0xc188('0x23'),function(_0x41440e){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')](_0xc188('0x24'),_0x41440e['uniqueid']),_0x41440e);agents[_0xc188('0x23')](_0x41440e);}catch(_0x16fd2c){utils[_0xc188('0x18')](util['format']('[%s][index][agentringnoanswer]',_0x41440e[_0xc188('0x22')]),_0x16fd2c);}});ami['on'](_0xc188('0x25'),function(_0x239d30){try{utils['debug'](util[_0xc188('0x1d')]('[%s][index][agentconnect]',_0x239d30[_0xc188('0x22')]),_0x239d30);agents['agentconnect'](_0x239d30);queues[_0xc188('0x25')](_0x239d30);}catch(_0x10b5a5){utils[_0xc188('0x18')](util[_0xc188('0x1d')](_0xc188('0x26'),_0x239d30[_0xc188('0x22')]),_0x10b5a5);}});ami['on']('agentcomplete',function(_0x235715){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')]('[%s][index][agentcomplete]',_0x235715[_0xc188('0x22')]),_0x235715);agents[_0xc188('0x27')](_0x235715);queues[_0xc188('0x27')](_0x235715);members['agentcomplete'](_0x235715);}catch(_0x2d6e78){utils[_0xc188('0x18')](util[_0xc188('0x1d')](_0xc188('0x28'),_0x235715[_0xc188('0x22')]),_0x2d6e78);}});ami['on'](_0xc188('0x29'),function(_0x568349){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')]('[%s][index][queuecallerabandon]',_0x568349[_0xc188('0x22')]),_0x568349);agents[_0xc188('0x29')](_0x568349);queues[_0xc188('0x29')](_0x568349);}catch(_0x2a9698){utils[_0xc188('0x18')](util[_0xc188('0x1d')](_0xc188('0x2a'),_0x568349[_0xc188('0x22')]),_0x2a9698);}});ami['on'](_0xc188('0x2b'),function(_0x4cf7af){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')]('[%s][index][queuecallerjoin]',_0x4cf7af[_0xc188('0x22')]),_0x4cf7af);queues['queuecallerjoin'](_0x4cf7af);recordings[_0xc188('0x2b')](_0x4cf7af);}catch(_0x4d3d91){utils[_0xc188('0x18')](util[_0xc188('0x1d')](_0xc188('0x2c'),_0x4cf7af[_0xc188('0x22')]),_0x4d3d91);}});ami['on'](_0xc188('0x2d'),function(_0x3ff799){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')](_0xc188('0x2e'),_0x3ff799[_0xc188('0x22')]),_0x3ff799);queues[_0xc188('0x2d')](_0x3ff799);}catch(_0x57572a){utils['error'](util['format']('[%s][index][queuecallerleave]',_0x3ff799[_0xc188('0x22')]),_0x57572a);}});ami['on'](_0xc188('0x2f'),function(_0x3f06a9){try{utils['debug'](util[_0xc188('0x1d')]('[%s][index][musiconholdstart]',_0x3f06a9[_0xc188('0x22')]),_0x3f06a9);queues[_0xc188('0x2f')](_0x3f06a9);calls[_0xc188('0x2f')](_0x3f06a9);}catch(_0x589fef){utils[_0xc188('0x18')](util['format'](_0xc188('0x30'),_0x3f06a9[_0xc188('0x22')]),_0x589fef);}});ami['on'](_0xc188('0x31'),function(_0x1de4d7){try{utils['debug'](util[_0xc188('0x1d')]('[%s][index][musiconholdstop]',_0x1de4d7['uniqueid']),_0x1de4d7);queues[_0xc188('0x31')](_0x1de4d7);calls[_0xc188('0x31')](_0x1de4d7);}catch(_0x2208f0){utils[_0xc188('0x18')](util['format'](_0xc188('0x32'),_0x1de4d7[_0xc188('0x22')]),_0x2208f0);}});ami['on'](_0xc188('0x33'),function(_0x975763){try{utils[_0xc188('0x1c')](util['format'](_0xc188('0x34'),_0x975763[_0xc188('0x22')]),_0x975763);calls[_0xc188('0x33')](_0x975763);recordings[_0xc188('0x33')](_0x975763);}catch(_0x285a4f){utils[_0xc188('0x18')](util[_0xc188('0x1d')](_0xc188('0x34'),_0x975763[_0xc188('0x22')]),_0x285a4f);}});ami['on'](_0xc188('0x35'),function(_0x5cf663){try{utils['debug'](util['format'](_0xc188('0x36'),_0x5cf663['uniqueid']),_0x5cf663);calls['hangup'](_0x5cf663);recordings['hangup'](_0x5cf663);dials[_0xc188('0x35')](_0x5cf663);agents[_0xc188('0x35')](_0x5cf663);queues[_0xc188('0x35')](_0x5cf663);}catch(_0x3f1627){utils[_0xc188('0x18')](util['format'](_0xc188('0x36'),_0x5cf663['uniqueid']),_0x3f1627);}});ami['on'](_0xc188('0x37'),function(_0x44da0b){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')](_0xc188('0x38'),_0x44da0b[_0xc188('0x22')]),_0x44da0b);members[_0xc188('0x37')](_0x44da0b);}catch(_0x40a30c){utils[_0xc188('0x18')](util[_0xc188('0x1d')](_0xc188('0x38'),_0x44da0b[_0xc188('0x22')]),_0x40a30c);}});ami['on'](_0xc188('0x39'),function(_0x25aee0){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')](_0xc188('0x3a'),_0x25aee0['uniqueid']),_0x25aee0);queues['blindtransfer'](_0x25aee0);agents['blindtransfer'](_0x25aee0);transfers[_0xc188('0x39')](_0x25aee0);}catch(_0x22b883){utils[_0xc188('0x18')](util['format'](_0xc188('0x3a'),_0x25aee0[_0xc188('0x22')]),_0x22b883);}});ami['on'](_0xc188('0x3b'),function(_0xe89d66){try{utils['debug'](util[_0xc188('0x1d')]('[%s][index][attendedtransfer]',_0xe89d66[_0xc188('0x3c')]),_0xe89d66);queues[_0xc188('0x3b')](_0xe89d66);transfers[_0xc188('0x3b')](_0xe89d66);agents['attendedtransfer'](_0xe89d66);calls[_0xc188('0x3b')](_0xe89d66);}catch(_0x9d383){utils[_0xc188('0x18')](util['format'](_0xc188('0x3d'),_0xe89d66[_0xc188('0x3c')]),_0x9d383);}});ami['on']('varset',function(_0x53d81b){try{utils['debug'](util[_0xc188('0x1d')](_0xc188('0x3e'),_0x53d81b[_0xc188('0x22')]),_0x53d81b);queues[_0xc188('0x3f')](_0x53d81b);recordings[_0xc188('0x3f')](_0x53d81b);calls['varset'](_0x53d81b);dials[_0xc188('0x3f')](_0x53d81b);}catch(_0x3cbbe2){utils[_0xc188('0x18')](util[_0xc188('0x1d')](_0xc188('0x3e'),_0x53d81b['uniqueid']),_0x3cbbe2);}});ami['on']('newexten',function(_0x43e02c){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')](_0xc188('0x40'),_0x43e02c[_0xc188('0x22')]),_0x43e02c);calls[_0xc188('0x41')](_0x43e02c);recordings[_0xc188('0x41')](_0x43e02c);dials[_0xc188('0x41')](_0x43e02c);}catch(_0x2bdaf6){utils['error'](util[_0xc188('0x1d')](_0xc188('0x40'),_0x43e02c[_0xc188('0x22')]),_0x2bdaf6);}});ami['on'](_0xc188('0x42'),function(_0x27fb43){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')](_0xc188('0x43'),_0x27fb43[_0xc188('0x22')]),_0x27fb43);calls[_0xc188('0x42')](_0x27fb43);recordings[_0xc188('0x42')](_0x27fb43);}catch(_0x3057cb){utils[_0xc188('0x18')](util[_0xc188('0x1d')](_0xc188('0x43'),_0x27fb43[_0xc188('0x22')]),_0x3057cb);}});ami['on'](_0xc188('0x44'),function(_0x468faf){try{utils[_0xc188('0x1c')](util[_0xc188('0x1d')](_0xc188('0x45'),_0x468faf[_0xc188('0x22')]),_0x468faf);dials['dialbegin'](_0x468faf);}catch(_0x121d66){utils[_0xc188('0x18')](util[_0xc188('0x1d')](_0xc188('0x46'),_0x468faf[_0xc188('0x22')]),_0x121d66);}});ami['on']('dialend',function(_0x59bd42){try{utils['debug'](util['format']('[%s][index][dialend]',_0x59bd42[_0xc188('0x22')]),_0x59bd42);dials[_0xc188('0x47')](_0x59bd42);}catch(_0x492a9d){utils[_0xc188('0x18')](util['format'](_0xc188('0x48'),_0x59bd42['uniqueid']),_0x492a9d);}});} \ No newline at end of file +var _0xba1e=['util','xdr','disabled','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s][index][dialend]','dialend','asterisk-manager','./utils'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0xba1e,0x1c5));var _0xeba1=function(_0x333159,_0x68262e){_0x333159=_0x333159-0x0;var _0x2e29ac=_0xba1e[_0x333159];return _0x2e29ac;};var AsteriskManager=require(_0xeba1('0x0'));var config=require('../../config/environment');var utils=require(_0xeba1('0x1'));var util=require(_0xeba1('0x2'));var isXDREnabled=config[_0xeba1('0x3')]&&config[_0xeba1('0x3')][_0xeba1('0x4')]?!config[_0xeba1('0x3')]['disabled']:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0xeba1('0x3')]&&config[_0xeba1('0x3')][_0xeba1('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xeba1('0x6')][_0xeba1('0x7')],config[_0xeba1('0x6')]['ip'],config['asterisk'][_0xeba1('0x8')],config[_0xeba1('0x6')][_0xeba1('0x9')],!![]);ami[_0xeba1('0xa')]();if(!isXDREnabled){utils[_0xeba1('0xb')](_0xeba1('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xeba1('0xd'));var calls=require(_0xeba1('0xe'));var queues=require(_0xeba1('0xf'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0xeba1('0x10'));var transfers=require('./transfers.controller');var core=require(_0xeba1('0x11'));ami['on']('connect',core[_0xeba1('0x12')]);ami['on']('shutdown',core[_0xeba1('0x13')]);ami['on'](_0xeba1('0x14'),core[_0xeba1('0x14')]);ami['on'](_0xeba1('0x15'),core[_0xeba1('0x15')]);ami['on'](_0xeba1('0x16'),core[_0xeba1('0x16')]);ami['on'](_0xeba1('0x17'),core[_0xeba1('0x17')]);ami['on'](_0xeba1('0x18'),function(_0x47ca39){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')]('[%s][index][devicestatechange]',_0x47ca39[_0xeba1('0x1b')]),_0x47ca39);members[_0xeba1('0x18')](_0x47ca39);}catch(_0x1f8810){utils[_0xeba1('0x15')](util['format'](_0xeba1('0x1c'),_0x47ca39[_0xeba1('0x1b')]),_0x1f8810);}});ami['on'](_0xeba1('0x1d'),function(_0x1b41fb){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')](_0xeba1('0x1e'),_0x1b41fb[_0xeba1('0x1f')]),_0x1b41fb);agents[_0xeba1('0x1d')](_0x1b41fb);}catch(_0x31dbfc){utils['error'](util[_0xeba1('0x1a')](_0xeba1('0x1e'),_0x1b41fb[_0xeba1('0x1f')]),_0x31dbfc);}});ami['on'](_0xeba1('0x20'),function(_0x45aea7){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')]('[%s][index][agentringnoanswer]',_0x45aea7[_0xeba1('0x1f')]),_0x45aea7);agents[_0xeba1('0x20')](_0x45aea7);}catch(_0x3b2eb3){utils['error'](util['format'](_0xeba1('0x21'),_0x45aea7[_0xeba1('0x1f')]),_0x3b2eb3);}});ami['on'](_0xeba1('0x22'),function(_0x35dfca){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')]('[%s][index][agentconnect]',_0x35dfca[_0xeba1('0x1f')]),_0x35dfca);agents[_0xeba1('0x22')](_0x35dfca);queues[_0xeba1('0x22')](_0x35dfca);}catch(_0x2a8c59){utils['error'](util[_0xeba1('0x1a')]('[%s][index][agentconnect]',_0x35dfca['uniqueid']),_0x2a8c59);}});ami['on'](_0xeba1('0x23'),function(_0x5bc49c){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')]('[%s][index][agentcomplete]',_0x5bc49c[_0xeba1('0x1f')]),_0x5bc49c);agents[_0xeba1('0x23')](_0x5bc49c);queues[_0xeba1('0x23')](_0x5bc49c);members[_0xeba1('0x23')](_0x5bc49c);}catch(_0x585d0e){utils[_0xeba1('0x15')](util[_0xeba1('0x1a')]('[%s][index][agentcomplete]',_0x5bc49c[_0xeba1('0x1f')]),_0x585d0e);}});ami['on'](_0xeba1('0x24'),function(_0x32fb3a){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')](_0xeba1('0x25'),_0x32fb3a['uniqueid']),_0x32fb3a);agents[_0xeba1('0x24')](_0x32fb3a);queues['queuecallerabandon'](_0x32fb3a);}catch(_0x45f813){utils[_0xeba1('0x15')](util[_0xeba1('0x1a')]('[%s][index][queuecallerabandon]',_0x32fb3a['uniqueid']),_0x45f813);}});ami['on'](_0xeba1('0x26'),function(_0x3f3ae6){try{utils['debug'](util[_0xeba1('0x1a')](_0xeba1('0x27'),_0x3f3ae6[_0xeba1('0x1f')]),_0x3f3ae6);queues['queuecallerjoin'](_0x3f3ae6);recordings[_0xeba1('0x26')](_0x3f3ae6);}catch(_0x262368){utils[_0xeba1('0x15')](util[_0xeba1('0x1a')]('[%s][index][queuecallerjoin]',_0x3f3ae6[_0xeba1('0x1f')]),_0x262368);}});ami['on']('queuecallerleave',function(_0x18fd6f){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')](_0xeba1('0x28'),_0x18fd6f[_0xeba1('0x1f')]),_0x18fd6f);queues['queuecallerleave'](_0x18fd6f);}catch(_0x420d54){utils['error'](util['format'](_0xeba1('0x28'),_0x18fd6f[_0xeba1('0x1f')]),_0x420d54);}});ami['on'](_0xeba1('0x29'),function(_0x4d4c69){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')](_0xeba1('0x2a'),_0x4d4c69['uniqueid']),_0x4d4c69);queues[_0xeba1('0x29')](_0x4d4c69);calls[_0xeba1('0x29')](_0x4d4c69);}catch(_0xb68517){utils['error'](util['format'](_0xeba1('0x2a'),_0x4d4c69['uniqueid']),_0xb68517);}});ami['on']('musiconholdstop',function(_0x4cc237){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')]('[%s][index][musiconholdstop]',_0x4cc237['uniqueid']),_0x4cc237);queues[_0xeba1('0x2b')](_0x4cc237);calls[_0xeba1('0x2b')](_0x4cc237);}catch(_0x292c54){utils[_0xeba1('0x15')](util[_0xeba1('0x1a')](_0xeba1('0x2c'),_0x4cc237[_0xeba1('0x1f')]),_0x292c54);}});ami['on'](_0xeba1('0x2d'),function(_0x483265){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')](_0xeba1('0x2e'),_0x483265[_0xeba1('0x1f')]),_0x483265);calls[_0xeba1('0x2d')](_0x483265);recordings[_0xeba1('0x2d')](_0x483265);}catch(_0x2dea97){utils[_0xeba1('0x15')](util['format']('[%s][index][newstate]',_0x483265[_0xeba1('0x1f')]),_0x2dea97);}});ami['on'](_0xeba1('0x2f'),function(_0x2c8268){try{utils[_0xeba1('0x19')](util['format'](_0xeba1('0x30'),_0x2c8268['uniqueid']),_0x2c8268);calls['hangup'](_0x2c8268);recordings[_0xeba1('0x2f')](_0x2c8268);dials[_0xeba1('0x2f')](_0x2c8268);agents['hangup'](_0x2c8268);queues[_0xeba1('0x2f')](_0x2c8268);}catch(_0x2a7b21){utils[_0xeba1('0x15')](util['format'](_0xeba1('0x30'),_0x2c8268['uniqueid']),_0x2a7b21);}});ami['on']('cdr',function(_0x58800a){try{utils['debug'](util[_0xeba1('0x1a')](_0xeba1('0x31'),_0x58800a['uniqueid']),_0x58800a);members['cdr'](_0x58800a);}catch(_0x276ee0){utils[_0xeba1('0x15')](util[_0xeba1('0x1a')]('[%s][index][cdr]',_0x58800a[_0xeba1('0x1f')]),_0x276ee0);}});ami['on'](_0xeba1('0x32'),function(_0x18cc46){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')](_0xeba1('0x33'),_0x18cc46['uniqueid']),_0x18cc46);queues[_0xeba1('0x32')](_0x18cc46);agents[_0xeba1('0x32')](_0x18cc46);transfers[_0xeba1('0x32')](_0x18cc46);}catch(_0x4d4d86){utils[_0xeba1('0x15')](util[_0xeba1('0x1a')](_0xeba1('0x33'),_0x18cc46[_0xeba1('0x1f')]),_0x4d4d86);}});ami['on'](_0xeba1('0x34'),function(_0x153b38){try{utils['debug'](util[_0xeba1('0x1a')](_0xeba1('0x35'),_0x153b38[_0xeba1('0x36')]),_0x153b38);queues[_0xeba1('0x34')](_0x153b38);transfers[_0xeba1('0x34')](_0x153b38);agents['attendedtransfer'](_0x153b38);calls[_0xeba1('0x34')](_0x153b38);}catch(_0x2ca372){utils['error'](util[_0xeba1('0x1a')](_0xeba1('0x35'),_0x153b38[_0xeba1('0x36')]),_0x2ca372);}});ami['on'](_0xeba1('0x37'),function(_0x106363){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')]('[%s][index][varset]',_0x106363[_0xeba1('0x1f')]),_0x106363);queues[_0xeba1('0x37')](_0x106363);recordings[_0xeba1('0x37')](_0x106363);calls[_0xeba1('0x37')](_0x106363);dials[_0xeba1('0x37')](_0x106363);}catch(_0x25613d){utils['error'](util['format'](_0xeba1('0x38'),_0x106363[_0xeba1('0x1f')]),_0x25613d);}});ami['on'](_0xeba1('0x39'),function(_0x35db38){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')](_0xeba1('0x3a'),_0x35db38['uniqueid']),_0x35db38);calls[_0xeba1('0x39')](_0x35db38);recordings['newexten'](_0x35db38);dials[_0xeba1('0x39')](_0x35db38);}catch(_0x12aae2){utils[_0xeba1('0x15')](util[_0xeba1('0x1a')]('[%s][index][newexten]',_0x35db38['uniqueid']),_0x12aae2);}});ami['on'](_0xeba1('0x3b'),function(_0xbf1551){try{utils[_0xeba1('0x19')](util['format'](_0xeba1('0x3c'),_0xbf1551['uniqueid']),_0xbf1551);calls[_0xeba1('0x3b')](_0xbf1551);recordings[_0xeba1('0x3b')](_0xbf1551);}catch(_0x30d1d2){utils[_0xeba1('0x15')](util[_0xeba1('0x1a')](_0xeba1('0x3c'),_0xbf1551[_0xeba1('0x1f')]),_0x30d1d2);}});ami['on'](_0xeba1('0x3d'),function(_0x4338ac){try{utils[_0xeba1('0x19')](util[_0xeba1('0x1a')](_0xeba1('0x3e'),_0x4338ac[_0xeba1('0x1f')]),_0x4338ac);dials[_0xeba1('0x3d')](_0x4338ac);}catch(_0x351590){utils[_0xeba1('0x15')](util[_0xeba1('0x1a')]('[%s]dialbegin',_0x4338ac[_0xeba1('0x1f')]),_0x351590);}});ami['on']('dialend',function(_0x130048){try{utils['debug'](util['format'](_0xeba1('0x3f'),_0x130048[_0xeba1('0x1f')]),_0x130048);dials[_0xeba1('0x40')](_0x130048);}catch(_0x4e4dba){utils['error'](util[_0xeba1('0x1a')](_0xeba1('0x3f'),_0x130048[_0xeba1('0x1f')]),_0x4e4dba);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 116c6c6..51c3d40 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 _0xf7df=['lodash','./utils','Local/_attended@transfer','Queue:','format','uniqueid','interface','data2','getUserByInterface','then','membername','internal','request','CreateMemberReport','getUserByName','split','name','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','now','diffTime','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','type'];(function(_0x855e25,_0x5cc86d){var _0x4c2b86=function(_0x1ab233){while(--_0x1ab233){_0x855e25['push'](_0x855e25['shift']());}};_0x4c2b86(++_0x5cc86d);}(_0xf7df,0x10e));var _0xff7d=function(_0x222f0a,_0x891666){_0x222f0a=_0x222f0a-0x0;var _0x3a2ac7=_0xf7df[_0x222f0a];return _0x3a2ac7;};'use strict';var _=require(_0xff7d('0x0'));var util=require('util');var utils=require(_0xff7d('0x1'));var members={};var exclude=[_0xff7d('0x2'),_0xff7d('0x3')];function writeDB(_0x232814){utils['info'](util[_0xff7d('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x232814[_0xff7d('0x5')],_0x232814[_0xff7d('0x6')],_0x232814['channel'],_0x232814[_0xff7d('0x7')],_0x232814['membername'],_0x232814['type']));if(_0x232814[_0xff7d('0x6')]){utils[_0xff7d('0x8')](_0x232814[_0xff7d('0x6')])[_0xff7d('0x9')](function(_0x41293f){if(_0x41293f){_0x232814[_0xff7d('0xa')]=_0x41293f['name'];_0x232814[_0xff7d('0xb')]=_0x41293f[_0xff7d('0xb')];utils[_0xff7d('0xc')](_0xff7d('0xd'),_0x232814);}else{utils[_0xff7d('0xe')](_0x232814[_0xff7d('0x6')][_0xff7d('0xf')]('/')[0x1])[_0xff7d('0x9')](function(_0x2ab8c4){if(_0x2ab8c4){_0x232814[_0xff7d('0xa')]=_0x2ab8c4[_0xff7d('0x10')];_0x232814['internal']=_0x2ab8c4[_0xff7d('0xb')];utils[_0xff7d('0xc')]('CreateMemberReport',_0x232814);}});}})[_0xff7d('0x11')](function(_0x19124c){utils[_0xff7d('0x12')](util[_0xff7d('0x4')](_0xff7d('0x13'),_0x232814[_0xff7d('0x5')]),_0x19124c);});}delete members[_0x232814['interface']];}function startsWith(_0x216b3f,_0x10e4ae){return _[_0xff7d('0x14')](_0x216b3f,function(_0x14d6b3){return _[_0xff7d('0x15')](_0x10e4ae,_0x14d6b3);});}exports[_0xff7d('0x16')]=function(_0x33de89){try{utils[_0xff7d('0x17')](util[_0xff7d('0x4')]('[%s][members][devicestatechange]',members[_0x33de89[_0xff7d('0x18')]]?members[_0x33de89[_0xff7d('0x18')]][_0xff7d('0x5')]:_0x33de89['device']),_0x33de89);utils[_0xff7d('0x19')](util[_0xff7d('0x4')](_0xff7d('0x1a'),members[_0x33de89[_0xff7d('0x18')]]?members[_0x33de89[_0xff7d('0x18')]][_0xff7d('0x5')]:_0x33de89[_0xff7d('0x18')],_0x33de89[_0xff7d('0x1b')],_0x33de89[_0xff7d('0x18')]));switch(_0x33de89['state']){case _0xff7d('0x1c'):case _0xff7d('0x1d'):if(!startsWith(exclude,_0x33de89[_0xff7d('0x18')])){members[_0x33de89['device']]={'channel':_0xff7d('0x1e'),'interface':_0x33de89[_0xff7d('0x18')],'type':_0xff7d('0x1f'),'enterAt':utils['now'](),'role':_0xff7d('0x20')};}break;case _0xff7d('0x21'):if(!_[_0xff7d('0x22')](members[_0x33de89[_0xff7d('0x18')]])){members[_0x33de89[_0xff7d('0x18')]][_0xff7d('0x23')]=utils[_0xff7d('0x24')]();members[_0x33de89[_0xff7d('0x18')]]['duration']=utils[_0xff7d('0x25')](members[_0x33de89[_0xff7d('0x18')]][_0xff7d('0x23')],members[_0x33de89['device']]['enterAt']);if(members[_0x33de89['device']][_0xff7d('0x5')]){writeDB(members[_0x33de89['device']]);}}break;default:break;}}catch(_0x566c5f){utils['error'](util[_0xff7d('0x4')](_0xff7d('0x26'),members[_0x33de89[_0xff7d('0x18')]]?members[_0x33de89['device']]['uniqueid']:_0x33de89[_0xff7d('0x18')]),_0x566c5f);}};exports[_0xff7d('0x27')]=function(_0x4a46db){try{if(!_['isNil'](members[_0x4a46db['interface']])){utils[_0xff7d('0x17')](util[_0xff7d('0x4')](_0xff7d('0x28'),_0x4a46db[_0xff7d('0x5')]),_0x4a46db);utils[_0xff7d('0x19')](util[_0xff7d('0x4')](_0xff7d('0x29'),_0x4a46db[_0xff7d('0x5')],_0x4a46db['interface'],_0x4a46db[_0xff7d('0x2a')]));members[_0x4a46db['interface']]=_[_0xff7d('0x2b')](members[_0x4a46db[_0xff7d('0x6')]],{'data4':_0x4a46db[_0xff7d('0x2a')],'uniqueid':_0x4a46db['uniqueid']});}}catch(_0x5092c4){utils[_0xff7d('0x12')](util[_0xff7d('0x4')](_0xff7d('0x28'),_0x4a46db[_0xff7d('0x5')]),_0x5092c4);}};exports[_0xff7d('0x2c')]=function(_0x108f55){try{utils[_0xff7d('0x17')](util[_0xff7d('0x4')](_0xff7d('0x2d'),_0x108f55[_0xff7d('0x5')]),_0x108f55);if(_0x108f55['channel']){var _0x436f53=_0x108f55[_0xff7d('0x2e')][_0xff7d('0xf')]('-')[0x0];if(!_['isNil'](members[_0x436f53])){members[_0x436f53]=_[_0xff7d('0x2b')](members[_0x436f53],{'data1':members[_0x436f53][_0xff7d('0x2f')]||_0x108f55['type'],'data2':members[_0x436f53][_0xff7d('0x7')]||_0x108f55[_0xff7d('0x30')],'data3':members[_0x436f53]['data3']||_0x108f55[_0xff7d('0x31')],'uniqueid':members[_0x436f53][_0xff7d('0x5')]||_0x108f55[_0xff7d('0x5')]});utils['info'](util['format'](_0xff7d('0x32'),_0x108f55[_0xff7d('0x5')],members[_0x436f53][_0xff7d('0x2f')],members[_0x436f53][_0xff7d('0x7')],members[_0x436f53][_0xff7d('0x33')]));if(members[_0x436f53][_0xff7d('0x23')]){writeDB(members[_0x436f53]);}}}if(_0x108f55[_0xff7d('0x34')]){var _0x2adb29=_0x108f55[_0xff7d('0x34')]['split']('-')[0x0];if(!_[_0xff7d('0x22')](members[_0x2adb29])){members[_0x2adb29]=_[_0xff7d('0x2b')](members[_0x2adb29],{'data1':members[_0x2adb29][_0xff7d('0x2f')]||_0x108f55[_0xff7d('0x35')],'data2':members[_0x2adb29]['data2']||_0x108f55[_0xff7d('0x30')],'data3':members[_0x2adb29][_0xff7d('0x33')]||_0x108f55[_0xff7d('0x31')],'uniqueid':members[_0x2adb29][_0xff7d('0x5')]||_0x108f55['uniqueid']});utils[_0xff7d('0x19')](util[_0xff7d('0x4')](_0xff7d('0x32'),_0x108f55[_0xff7d('0x5')],members[_0x2adb29][_0xff7d('0x2f')],members[_0x2adb29]['data2'],members[_0x2adb29][_0xff7d('0x33')]));if(members[_0x2adb29][_0xff7d('0x23')]){writeDB(members[_0x2adb29]);}}}}catch(_0x313def){utils['error'](util[_0xff7d('0x4')](_0xff7d('0x2d'),_0x108f55[_0xff7d('0x5')]),_0x313def);}}; \ No newline at end of file +var _0xc910=['data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','channel','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0xc910,0x109));var _0x0c91=function(_0x2822b6,_0x340977){_0x2822b6=_0x2822b6-0x0;var _0x3a4b81=_0xc910[_0x2822b6];return _0x3a4b81;};'use strict';var _=require(_0x0c91('0x0'));var util=require(_0x0c91('0x1'));var utils=require(_0x0c91('0x2'));var members={};var exclude=[_0x0c91('0x3'),_0x0c91('0x4')];function writeDB(_0xa2ef36){utils[_0x0c91('0x5')](util[_0x0c91('0x6')](_0x0c91('0x7'),_0xa2ef36[_0x0c91('0x8')],_0xa2ef36[_0x0c91('0x9')],_0xa2ef36['channel'],_0xa2ef36[_0x0c91('0xa')],_0xa2ef36[_0x0c91('0xb')],_0xa2ef36[_0x0c91('0xc')]));if(_0xa2ef36[_0x0c91('0x9')]){utils[_0x0c91('0xd')](_0xa2ef36['interface'])[_0x0c91('0xe')](function(_0x441e01){if(_0x441e01){_0xa2ef36[_0x0c91('0xb')]=_0x441e01[_0x0c91('0xf')];_0xa2ef36[_0x0c91('0x10')]=_0x441e01[_0x0c91('0x10')];utils[_0x0c91('0x11')](_0x0c91('0x12'),_0xa2ef36);}else{utils[_0x0c91('0x13')](_0xa2ef36['interface'][_0x0c91('0x14')]('/')[0x1])['then'](function(_0x4a91aa){if(_0x4a91aa){_0xa2ef36['membername']=_0x4a91aa[_0x0c91('0xf')];_0xa2ef36[_0x0c91('0x10')]=_0x4a91aa[_0x0c91('0x10')];utils['request']('CreateMemberReport',_0xa2ef36);}});}})[_0x0c91('0x15')](function(_0x1a56ee){utils[_0x0c91('0x16')](util[_0x0c91('0x6')](_0x0c91('0x17'),_0xa2ef36[_0x0c91('0x8')]),_0x1a56ee);});}delete members[_0xa2ef36[_0x0c91('0x9')]];}function startsWith(_0xcbff7b,_0x491aa6){return _[_0x0c91('0x18')](_0xcbff7b,function(_0x3184fc){return _['startsWith'](_0x491aa6,_0x3184fc);});}exports[_0x0c91('0x19')]=function(_0x4178d3){try{utils[_0x0c91('0x1a')](util[_0x0c91('0x6')](_0x0c91('0x1b'),members[_0x4178d3[_0x0c91('0x1c')]]?members[_0x4178d3['device']]['uniqueid']:_0x4178d3['device']),_0x4178d3);utils[_0x0c91('0x5')](util[_0x0c91('0x6')](_0x0c91('0x1d'),members[_0x4178d3[_0x0c91('0x1c')]]?members[_0x4178d3[_0x0c91('0x1c')]]['uniqueid']:_0x4178d3['device'],_0x4178d3[_0x0c91('0x1e')],_0x4178d3['device']));switch(_0x4178d3[_0x0c91('0x1e')]){case _0x0c91('0x1f'):case _0x0c91('0x20'):if(!startsWith(exclude,_0x4178d3[_0x0c91('0x1c')])){members[_0x4178d3[_0x0c91('0x1c')]]={'channel':_0x0c91('0x21'),'interface':_0x4178d3[_0x0c91('0x1c')],'type':_0x0c91('0x22'),'enterAt':utils[_0x0c91('0x23')](),'role':_0x0c91('0x24')};}break;case _0x0c91('0x25'):if(!_[_0x0c91('0x26')](members[_0x4178d3['device']])){members[_0x4178d3[_0x0c91('0x1c')]][_0x0c91('0x27')]=utils[_0x0c91('0x23')]();members[_0x4178d3[_0x0c91('0x1c')]][_0x0c91('0x28')]=utils[_0x0c91('0x29')](members[_0x4178d3[_0x0c91('0x1c')]][_0x0c91('0x27')],members[_0x4178d3[_0x0c91('0x1c')]][_0x0c91('0x2a')]);if(members[_0x4178d3[_0x0c91('0x1c')]]['uniqueid']){writeDB(members[_0x4178d3['device']]);}}break;default:break;}}catch(_0x48645b){utils[_0x0c91('0x16')](util[_0x0c91('0x6')](_0x0c91('0x1b'),members[_0x4178d3[_0x0c91('0x1c')]]?members[_0x4178d3[_0x0c91('0x1c')]][_0x0c91('0x8')]:_0x4178d3['device']),_0x48645b);}};exports[_0x0c91('0x2b')]=function(_0x11dbba){try{if(!_['isNil'](members[_0x11dbba[_0x0c91('0x9')]])){utils[_0x0c91('0x1a')](util[_0x0c91('0x6')]('[%s][members][agentcomplete]',_0x11dbba['uniqueid']),_0x11dbba);utils[_0x0c91('0x5')](util[_0x0c91('0x6')](_0x0c91('0x2c'),_0x11dbba[_0x0c91('0x8')],_0x11dbba[_0x0c91('0x9')],_0x11dbba[_0x0c91('0x2d')]));members[_0x11dbba[_0x0c91('0x9')]]=_[_0x0c91('0x2e')](members[_0x11dbba[_0x0c91('0x9')]],{'data4':_0x11dbba[_0x0c91('0x2d')],'uniqueid':_0x11dbba['uniqueid']});}}catch(_0x2aaac9){utils[_0x0c91('0x16')](util[_0x0c91('0x6')](_0x0c91('0x2f'),_0x11dbba['uniqueid']),_0x2aaac9);}};exports['cdr']=function(_0x4ae2bd){try{utils[_0x0c91('0x1a')](util[_0x0c91('0x6')]('[%s][members][cdr]',_0x4ae2bd[_0x0c91('0x8')]),_0x4ae2bd);if(_0x4ae2bd[_0x0c91('0x30')]){var _0x156186=_0x4ae2bd['channel'][_0x0c91('0x14')]('-')[0x0];if(!_[_0x0c91('0x26')](members[_0x156186])){members[_0x156186]=_[_0x0c91('0x2e')](members[_0x156186],{'data1':members[_0x156186][_0x0c91('0x31')]||_0x4ae2bd[_0x0c91('0xc')],'data2':members[_0x156186]['data2']||_0x4ae2bd['source'],'data3':members[_0x156186][_0x0c91('0x32')]||_0x4ae2bd[_0x0c91('0x33')],'uniqueid':members[_0x156186][_0x0c91('0x8')]||_0x4ae2bd[_0x0c91('0x8')]});utils['info'](util[_0x0c91('0x6')](_0x0c91('0x34'),_0x4ae2bd[_0x0c91('0x8')],members[_0x156186][_0x0c91('0x31')],members[_0x156186][_0x0c91('0xa')],members[_0x156186][_0x0c91('0x32')]));if(members[_0x156186][_0x0c91('0x27')]){writeDB(members[_0x156186]);}}}if(_0x4ae2bd[_0x0c91('0x35')]){var _0x21fb0f=_0x4ae2bd[_0x0c91('0x35')][_0x0c91('0x14')]('-')[0x0];if(!_[_0x0c91('0x26')](members[_0x21fb0f])){members[_0x21fb0f]=_[_0x0c91('0x2e')](members[_0x21fb0f],{'data1':members[_0x21fb0f]['data1']||_0x4ae2bd[_0x0c91('0xc')],'data2':members[_0x21fb0f]['data2']||_0x4ae2bd[_0x0c91('0x36')],'data3':members[_0x21fb0f]['data3']||_0x4ae2bd[_0x0c91('0x33')],'uniqueid':members[_0x21fb0f][_0x0c91('0x8')]||_0x4ae2bd[_0x0c91('0x8')]});utils['info'](util[_0x0c91('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4ae2bd[_0x0c91('0x8')],members[_0x21fb0f][_0x0c91('0x31')],members[_0x21fb0f][_0x0c91('0xa')],members[_0x21fb0f][_0x0c91('0x32')]));if(members[_0x21fb0f][_0x0c91('0x27')]){writeDB(members[_0x21fb0f]);}}}}catch(_0x460813){utils[_0x0c91('0x16')](util[_0x0c91('0x6')]('[%s][members][cdr]',_0x4ae2bd[_0x0c91('0x8')]),_0x460813);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index bdb3e4d..8b8caf0 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 _0xb18f=['clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','isNil','variable','queuestatus','value','queuecallerabandonAt','queuecallerexitAt','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','connectedlinename','holdtime','diffTime','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','assigned','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','TRANSFER','COMPLETEDBY','transfereeuniqueid','transfer','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid'];(function(_0x419cba,_0x2173ee){var _0x5512ed=function(_0xf41bd){while(--_0xf41bd){_0x419cba['push'](_0x419cba['shift']());}};_0x5512ed(++_0x2173ee);}(_0xb18f,0x1bb));var _0xfb18=function(_0x44a814,_0x58c1e5){_0x44a814=_0x44a814-0x0;var _0x15c15f=_0xb18f[_0x44a814];return _0x15c15f;};'use strict';var _=require(_0xfb18('0x0'));var util=require(_0xfb18('0x1'));var utils=require(_0xfb18('0x2'));var queues={};function writeDB(_0x4cdc36){utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x5'),_0x4cdc36['uniqueid'],_0x4cdc36['channel'],_0x4cdc36[_0xfb18('0x6')],_0x4cdc36[_0xfb18('0x7')],_0x4cdc36[_0xfb18('0x8')],_0x4cdc36[_0xfb18('0x9')],_0x4cdc36[_0xfb18('0xa')]));if(_0x4cdc36[_0xfb18('0x6')]){utils[_0xfb18('0xb')](_0x4cdc36['queue'])[_0xfb18('0xc')](function(_0x343db8){if(_0x343db8){_0x4cdc36[_0xfb18('0xd')]=_0x343db8[_0xfb18('0xd')];}utils['request'](_0xfb18('0xe'),_0x4cdc36);});}else{utils[_0xfb18('0xf')](_0xfb18('0xe'),_0x4cdc36);}if(_0x4cdc36[_0xfb18('0x10')]){delete queues[_0x4cdc36[_0xfb18('0x10')]];}else{delete queues[_0x4cdc36[_0xfb18('0x11')]];}}exports[_0xfb18('0x12')]=function(_0x51aa1f){try{utils[_0xfb18('0x13')](util['format'](_0xfb18('0x14'),_0x51aa1f[_0xfb18('0x11')]),_0x51aa1f);utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x15'),_0x51aa1f[_0xfb18('0x11')],_0x51aa1f[_0xfb18('0x6')],_0x51aa1f[_0xfb18('0x16')]));queues[_0x51aa1f[_0xfb18('0x11')]]=_['assign'](_0x51aa1f,{'originalposition':_0x51aa1f['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0xc89f5){utils[_0xfb18('0x17')](util[_0xfb18('0x4')](_0xfb18('0x14'),_0x51aa1f['uniqueid']),_0xc89f5);}};exports[_0xfb18('0x18')]=function(_0x3aa2c6){try{if(!_['isNil'](queues[_0x3aa2c6['uniqueid']])){utils[_0xfb18('0x13')](util[_0xfb18('0x4')](_0xfb18('0x19'),_0x3aa2c6[_0xfb18('0x11')]),_0x3aa2c6);if(queues[_0x3aa2c6[_0xfb18('0x11')]][_0xfb18('0x1a')]){if(!queues[_0x3aa2c6[_0xfb18('0x11')]][_0xfb18('0x1b')]&&!queues[_0x3aa2c6[_0xfb18('0x11')]][_0xfb18('0x1c')]){queues[_0x3aa2c6[_0xfb18('0x11')]]['queuecallercomplete']=!![];queues[_0x3aa2c6[_0xfb18('0x11')]]['queuecallercompleteAt']=utils[_0xfb18('0x1d')]();queues[_0x3aa2c6[_0xfb18('0x11')]][_0xfb18('0xa')]=_0xfb18('0x1e');}utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x1f'),_0x3aa2c6[_0xfb18('0x11')],queues[_0x3aa2c6[_0xfb18('0x11')]][_0xfb18('0x20')],queues[_0x3aa2c6[_0xfb18('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x3aa2c6[_0xfb18('0x11')]]);}else if(queues[_0x3aa2c6[_0xfb18('0x11')]][_0xfb18('0x10')]){utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x21'),_0x3aa2c6['uniqueid'],queues[_0x3aa2c6[_0xfb18('0x11')]][_0xfb18('0x20')],queues[_0x3aa2c6[_0xfb18('0x11')]][_0xfb18('0x10')]));queues[queues[_0x3aa2c6[_0xfb18('0x11')]][_0xfb18('0x10')]]=queues[_0x3aa2c6[_0xfb18('0x11')]];queues[queues[_0x3aa2c6[_0xfb18('0x11')]][_0xfb18('0x10')]][_0xfb18('0x22')]=0x2;delete queues[_0x3aa2c6['uniqueid']];}}}catch(_0x3f0c9f){utils['error'](util[_0xfb18('0x4')](_0xfb18('0x19'),_0x3aa2c6[_0xfb18('0x11')]),_0x3f0c9f);}};exports[_0xfb18('0x23')]=function(_0x1bb56c){try{utils['debug'](util[_0xfb18('0x4')]('[%s][queues][varset]',_0x1bb56c[_0xfb18('0x11')]),_0x1bb56c);if(!_[_0xfb18('0x24')](_0x1bb56c[_0xfb18('0x25')][_0xfb18('0x26')])&&_0x1bb56c[_0xfb18('0x27')]['toUpperCase']()!=='CONTINUE'){if(!_['isNil'](queues[_0x1bb56c[_0xfb18('0x11')]])){queues[_0x1bb56c[_0xfb18('0x11')]][_0xfb18('0x1b')]=![];queues[_0x1bb56c[_0xfb18('0x11')]][_0xfb18('0x28')]=null;queues[_0x1bb56c[_0xfb18('0x11')]][_0xfb18('0x1c')]=!![];queues[_0x1bb56c['uniqueid']][_0xfb18('0x29')]=utils[_0xfb18('0x1d')]();queues[_0x1bb56c['uniqueid']][_0xfb18('0xa')]=_0x1bb56c[_0xfb18('0x27')][_0xfb18('0x2a')]();utils[_0xfb18('0x3')](util['format'](_0xfb18('0x2b'),_0x1bb56c[_0xfb18('0x11')],queues[_0x1bb56c['uniqueid']][_0xfb18('0x20')],_0x1bb56c[_0xfb18('0x27')],queues[_0x1bb56c[_0xfb18('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x1bb56c['uniqueid']]);}}else if(!_[_0xfb18('0x24')](_0x1bb56c['variable'][_0xfb18('0x2c')])){if(!_['isNil'](queues[_0x1bb56c[_0xfb18('0x11')]])&&!queues[_0x1bb56c[_0xfb18('0x11')]][_0xfb18('0x1b')]){queues[_0x1bb56c[_0xfb18('0x11')]][_0xfb18('0x1b')]=![];queues[_0x1bb56c[_0xfb18('0x11')]]['queuecallerabandonAt']=null;queues[_0x1bb56c[_0xfb18('0x11')]][_0xfb18('0x1c')]=!![];queues[_0x1bb56c[_0xfb18('0x11')]][_0xfb18('0x29')]=utils[_0xfb18('0x1d')]();queues[_0x1bb56c[_0xfb18('0x11')]]['queuecallerexitreason']=_0xfb18('0x2d');utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x2e'),_0x1bb56c[_0xfb18('0x11')],queues[_0x1bb56c[_0xfb18('0x11')]][_0xfb18('0x20')],_0x1bb56c[_0xfb18('0x27')],queues[_0x1bb56c['uniqueid']][_0xfb18('0xa')]));}}}catch(_0x59feb7){utils[_0xfb18('0x17')](util[_0xfb18('0x4')]('[%s][queues][varset]',_0x1bb56c[_0xfb18('0x11')]),_0x59feb7);}};exports[_0xfb18('0x1b')]=function(_0x33e11c){try{if(!_[_0xfb18('0x24')](queues[_0x33e11c[_0xfb18('0x11')]])){utils[_0xfb18('0x13')](util[_0xfb18('0x4')](_0xfb18('0x2f'),_0x33e11c[_0xfb18('0x11')]),_0x33e11c);queues[_0x33e11c[_0xfb18('0x11')]][_0xfb18('0x1c')]=![];queues[_0x33e11c['uniqueid']][_0xfb18('0x29')]=null;queues[_0x33e11c[_0xfb18('0x11')]][_0xfb18('0x1b')]=!![];queues[_0x33e11c[_0xfb18('0x11')]][_0xfb18('0x28')]=utils[_0xfb18('0x1d')]();queues[_0x33e11c[_0xfb18('0x11')]][_0xfb18('0xa')]=_0xfb18('0x30');utils[_0xfb18('0x3')](util['format'](_0xfb18('0x31'),_0x33e11c[_0xfb18('0x11')],queues[_0x33e11c[_0xfb18('0x11')]][_0xfb18('0x20')],queues[_0x33e11c[_0xfb18('0x11')]][_0xfb18('0xa')]));}}catch(_0x4281f9){utils[_0xfb18('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x33e11c[_0xfb18('0x11')]),_0x4281f9);}};exports[_0xfb18('0x32')]=function(_0x3a32d8){try{if(!_[_0xfb18('0x24')](queues[_0x3a32d8['uniqueid']])){utils[_0xfb18('0x13')](util[_0xfb18('0x4')]('[%s][queues][queuecallerleave]',_0x3a32d8[_0xfb18('0x11')]),_0x3a32d8);utils['info'](util[_0xfb18('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3a32d8[_0xfb18('0x11')],queues[_0x3a32d8[_0xfb18('0x11')]]['name'],_0x3a32d8['connectedlinenum'],_0x3a32d8[_0xfb18('0x33')]));queues[_0x3a32d8[_0xfb18('0x11')]]['queuecallerleave']=!![];queues[_0x3a32d8['uniqueid']][_0xfb18('0x1a')]=utils[_0xfb18('0x1d')]();queues[_0x3a32d8[_0xfb18('0x11')]][_0xfb18('0x34')]=utils[_0xfb18('0x35')](queues[_0x3a32d8[_0xfb18('0x11')]][_0xfb18('0x1a')],queues[_0x3a32d8[_0xfb18('0x11')]]['queuecallerjoinAt']);queues[_0x3a32d8[_0xfb18('0x11')]][_0xfb18('0x16')]=_0x3a32d8['position'];queues[_0x3a32d8[_0xfb18('0x11')]][_0xfb18('0x36')]=_0x3a32d8[_0xfb18('0x36')];queues[_0x3a32d8[_0xfb18('0x11')]][_0xfb18('0x37')]=_0x3a32d8['connectedlinenum'];queues[_0x3a32d8[_0xfb18('0x11')]]['connectedlinename']=_0x3a32d8[_0xfb18('0x33')];}}catch(_0x2e223c){utils[_0xfb18('0x17')](util['format']('[%s][queues][queuecallerleave]',_0x3a32d8[_0xfb18('0x11')]),_0x2e223c);}};exports[_0xfb18('0x38')]=function(_0x4a4fe9){try{if(!_[_0xfb18('0x24')](queues[_0x4a4fe9[_0xfb18('0x11')]])){utils[_0xfb18('0x13')](util[_0xfb18('0x4')](_0xfb18('0x39'),_0x4a4fe9[_0xfb18('0x11')]),_0x4a4fe9);utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x3a'),_0x4a4fe9[_0xfb18('0x11')],queues[_0x4a4fe9[_0xfb18('0x11')]][_0xfb18('0x20')],_0x4a4fe9['membername'],_0x4a4fe9['destaccountcode']));queues[_0x4a4fe9[_0xfb18('0x11')]][_0xfb18('0x1b')]=![];queues[_0x4a4fe9[_0xfb18('0x11')]][_0xfb18('0x1b')]=![];queues[_0x4a4fe9['uniqueid']][_0xfb18('0x28')]=null;queues[_0x4a4fe9[_0xfb18('0x11')]]['queuecallerexit']=![];queues[_0x4a4fe9['uniqueid']]['queuecallerexitreason']=null;queues[_0x4a4fe9[_0xfb18('0x11')]][_0xfb18('0x29')]=null;queues[_0x4a4fe9[_0xfb18('0x11')]][_0xfb18('0x3b')]=!![];queues[_0x4a4fe9[_0xfb18('0x11')]]['accountcode']=_0x4a4fe9[_0xfb18('0x3c')];queues[_0x4a4fe9[_0xfb18('0x11')]]['lastAssignedTo']=_0x4a4fe9[_0xfb18('0x3d')];}}catch(_0x308efe){utils['error'](util[_0xfb18('0x4')]('[%s][queues][agentconnect]',_0x4a4fe9[_0xfb18('0x11')]),_0x308efe);}};exports[_0xfb18('0x3e')]=function(_0x47fa7d){try{if(!_[_0xfb18('0x24')](queues[_0x47fa7d['uniqueid']])){if(queues[_0x47fa7d['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0xfb18('0x4')](_0xfb18('0x3f'),_0x47fa7d['uniqueid']),_0x47fa7d);queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0x1b')]=![];queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0x1b')]=![];queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0x28')]=null;queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0x1c')]=![];queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0x29')]=null;queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0x3b')]=!![];queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0x7')]=_0x47fa7d[_0xfb18('0x3d')];queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0x40')]=!![];queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0x41')]=utils[_0xfb18('0x1d')]();if(_0x47fa7d[_0xfb18('0x42')]=='transfer'){if(!queues[_0x47fa7d[_0xfb18('0x11')]]['transfer']){queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0xa')]=_0xfb18('0x43');}}else{queues[_0x47fa7d[_0xfb18('0x11')]]['queuecallerexitreason']=_0xfb18('0x44')+_0x47fa7d[_0xfb18('0x42')][_0xfb18('0x2a')]();}utils[_0xfb18('0x3')](util[_0xfb18('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x47fa7d[_0xfb18('0x11')],queues[_0x47fa7d[_0xfb18('0x11')]]['name'],_0x47fa7d[_0xfb18('0x3d')],queues[_0x47fa7d[_0xfb18('0x11')]][_0xfb18('0xa')]));writeDB(queues[_0x47fa7d[_0xfb18('0x11')]]);}}}catch(_0x1a9871){utils[_0xfb18('0x17')](util[_0xfb18('0x4')](_0xfb18('0x3f'),_0x47fa7d[_0xfb18('0x11')]),_0x1a9871);}};exports['blindtransfer']=function(_0x29a889){try{if(!_[_0xfb18('0x24')](queues[_0x29a889[_0xfb18('0x45')]])){utils[_0xfb18('0x13')](util[_0xfb18('0x4')]('[%s][queues][blindtransfer]',_0x29a889[_0xfb18('0x11')]),_0x29a889);queues[_0x29a889[_0xfb18('0x45')]][_0xfb18('0x46')]=!![];queues[_0x29a889[_0xfb18('0x45')]][_0xfb18('0x47')]=_0xfb18('0x48');queues[_0x29a889[_0xfb18('0x45')]][_0xfb18('0x49')]=_0x29a889['extension'];queues[_0x29a889[_0xfb18('0x45')]][_0xfb18('0x4a')]=_0x29a889[_0xfb18('0x45')];queues[_0x29a889[_0xfb18('0x45')]]['queuecallerexitreason']=_0xfb18('0x4b');utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x4c'),_0x29a889[_0xfb18('0x11')],queues[_0x29a889[_0xfb18('0x45')]][_0xfb18('0x20')],_0x29a889[_0xfb18('0x45')],_0x29a889['extension']));}}catch(_0x3e1566){utils[_0xfb18('0x17')](util[_0xfb18('0x4')](_0xfb18('0x4d'),_0x29a889[_0xfb18('0x11')]),_0x3e1566);}};exports[_0xfb18('0x4e')]=function(_0x22cef3){try{utils['debug'](util[_0xfb18('0x4')]('[%s][queues][attendedtransfer]',_0x22cef3[_0xfb18('0x4f')]),_0x22cef3);if(_0x22cef3['origtransfereruniqueid']==_0x22cef3['origtransfererlinkedid']){if(!_['isNil'](queues[_0x22cef3[_0xfb18('0x50')]])){utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x51'),_0x22cef3['origtransfereruniqueid'],queues[_0x22cef3[_0xfb18('0x50')]][_0xfb18('0x20')],_0x22cef3[_0xfb18('0x52')]));queues[_0x22cef3[_0xfb18('0x50')]][_0xfb18('0x46')]=!![];queues[_0x22cef3[_0xfb18('0x50')]]['transfertype']=_0xfb18('0x53');queues[_0x22cef3[_0xfb18('0x50')]][_0xfb18('0x49')]=_0x22cef3[_0xfb18('0x52')];queues[_0x22cef3[_0xfb18('0x50')]][_0xfb18('0x4a')]=_0x22cef3[_0xfb18('0x4f')];queues[_0x22cef3[_0xfb18('0x50')]][_0xfb18('0xa')]=_0xfb18('0x54');}if(!_['isNil'](queues[_0x22cef3[_0xfb18('0x55')]])){if(_0x22cef3[_0xfb18('0x56')]&&queues[_0x22cef3['transfereelinkedid']]){queues[_0x22cef3['transfereelinkedid']][_0xfb18('0x22')]=0x1;queues[_0x22cef3[_0xfb18('0x45')]]=_[_0xfb18('0x57')](queues[_0x22cef3[_0xfb18('0x56')]]);queues[_0x22cef3[_0xfb18('0x45')]][_0xfb18('0x10')]=_0x22cef3[_0xfb18('0x58')];queues[_0x22cef3[_0xfb18('0x45')]][_0xfb18('0x22')]=0x2;queues[_0x22cef3[_0xfb18('0x45')]][_0xfb18('0x8')]=queues[_0x22cef3[_0xfb18('0x50')]][_0xfb18('0x8')];queues[_0x22cef3['transfereeuniqueid']][_0xfb18('0x59')]=queues[_0x22cef3[_0xfb18('0x50')]][_0xfb18('0x59')];queues[_0x22cef3[_0xfb18('0x45')]][_0xfb18('0x5a')]=utils[_0xfb18('0x1d')]();queues[_0x22cef3[_0xfb18('0x45')]][_0xfb18('0x1a')]=utils[_0xfb18('0x1d')]();queues[_0x22cef3[_0xfb18('0x45')]][_0xfb18('0x34')]=0x0;queues[_0x22cef3[_0xfb18('0x45')]]['mohtime']=0x0;utils['info'](util[_0xfb18('0x4')](_0xfb18('0x5b'),_0x22cef3[_0xfb18('0x4f')],queues[_0x22cef3[_0xfb18('0x45')]][_0xfb18('0x20')],queues[_0x22cef3[_0xfb18('0x45')]]['calleridnum'],queues[_0x22cef3['transfereeuniqueid']][_0xfb18('0x59')]));}else{utils[_0xfb18('0x3')](util['format'](_0xfb18('0x5c'),_0x22cef3['origtransfereruniqueid'],queues[_0x22cef3['origtransfererlinkedid']][_0xfb18('0x20')],_0x22cef3[_0xfb18('0x50')]));queues[_0x22cef3[_0xfb18('0x55')]][_0xfb18('0x10')]=_0x22cef3[_0xfb18('0x50')];}}}else if(_0x22cef3[_0xfb18('0x5d')]==_0x22cef3[_0xfb18('0x50')]){if(!_[_0xfb18('0x24')](queues[_0x22cef3[_0xfb18('0x55')]])){utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x5e'),_0x22cef3['origtransfereruniqueid'],queues[_0x22cef3[_0xfb18('0x55')]][_0xfb18('0x20')],_0x22cef3[_0xfb18('0x5d')],_0x22cef3['secondtransfererexten']));queues[_0x22cef3[_0xfb18('0x55')]][_0xfb18('0x46')]=!![];queues[_0x22cef3[_0xfb18('0x55')]][_0xfb18('0x47')]='ATTENDED';queues[_0x22cef3[_0xfb18('0x55')]][_0xfb18('0x49')]=_0x22cef3[_0xfb18('0x5f')];queues[_0x22cef3[_0xfb18('0x55')]][_0xfb18('0x4a')]=_0x22cef3['secondtransfereruniqueid'];queues[_0x22cef3[_0xfb18('0x55')]][_0xfb18('0xa')]=_0xfb18('0x54');}if(!_[_0xfb18('0x24')](queues[_0x22cef3[_0xfb18('0x50')]])){if(_0x22cef3[_0xfb18('0x60')]&&queues[_0x22cef3[_0xfb18('0x60')]]){queues[_0x22cef3[_0xfb18('0x60')]][_0xfb18('0x22')]=0x1;queues[_0x22cef3[_0xfb18('0x58')]]=_[_0xfb18('0x57')](queues[_0x22cef3[_0xfb18('0x60')]]);queues[_0x22cef3[_0xfb18('0x58')]]['transfereduniqueid']=_0x22cef3[_0xfb18('0x58')];queues[_0x22cef3['transfertargetuniqueid']][_0xfb18('0x22')]=0x2;queues[_0x22cef3[_0xfb18('0x58')]][_0xfb18('0x8')]=queues[_0x22cef3['origtransfererlinkedid']][_0xfb18('0x8')];queues[_0x22cef3[_0xfb18('0x58')]][_0xfb18('0x59')]=queues[_0x22cef3[_0xfb18('0x55')]][_0xfb18('0x59')];queues[_0x22cef3[_0xfb18('0x58')]][_0xfb18('0x5a')]=utils[_0xfb18('0x1d')]();queues[_0x22cef3[_0xfb18('0x58')]][_0xfb18('0x1a')]=utils['now']();queues[_0x22cef3[_0xfb18('0x58')]]['holdtime']=0x0;queues[_0x22cef3[_0xfb18('0x58')]][_0xfb18('0x61')]=0x0;utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x62'),_0x22cef3[_0xfb18('0x4f')],queues[_0x22cef3[_0xfb18('0x58')]][_0xfb18('0x20')],queues[_0x22cef3[_0xfb18('0x58')]][_0xfb18('0x10')],queues[_0x22cef3['transfertargetuniqueid']]['calleridnum'],queues[_0x22cef3['transfertargetuniqueid']][_0xfb18('0x59')]));}else{utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x5c'),_0x22cef3['origtransfereruniqueid'],queues[_0x22cef3['secondtransfererlinkedid']]['name'],_0x22cef3[_0xfb18('0x55')]));queues[_0x22cef3[_0xfb18('0x50')]][_0xfb18('0x10')]=_0x22cef3[_0xfb18('0x55')];}}}}catch(_0x5467b5){utils['error'](util['format'](_0xfb18('0x63'),_0x22cef3[_0xfb18('0x4f')]),_0x5467b5);}};exports[_0xfb18('0x64')]=function(_0x5efc13){try{if(!_[_0xfb18('0x24')](queues[_0x5efc13['uniqueid']])){utils[_0xfb18('0x13')](util['format'](_0xfb18('0x65'),_0x5efc13[_0xfb18('0x11')]),_0x5efc13);queues[_0x5efc13['uniqueid']][_0xfb18('0x66')]=utils[_0xfb18('0x1d')]();utils[_0xfb18('0x3')](util['format'](_0xfb18('0x67'),_0x5efc13[_0xfb18('0x11')],queues[_0x5efc13[_0xfb18('0x11')]]['name'],queues[_0x5efc13[_0xfb18('0x11')]][_0xfb18('0x66')]));}}catch(_0x183730){utils['error'](util['format']('[%s][queues][musiconholdstart]',_0x5efc13[_0xfb18('0x11')]),_0x183730);}};exports['musiconholdstop']=function(_0x4d4823){try{if(!_[_0xfb18('0x24')](queues[_0x4d4823[_0xfb18('0x11')]])){if(!_[_0xfb18('0x24')](queues[_0x4d4823[_0xfb18('0x11')]][_0xfb18('0x66')])){utils[_0xfb18('0x13')](util['format'](_0xfb18('0x68'),_0x4d4823[_0xfb18('0x11')]),_0x4d4823);queues[_0x4d4823[_0xfb18('0x11')]][_0xfb18('0x61')]+=utils['diffTime'](utils['now'](),queues[_0x4d4823[_0xfb18('0x11')]][_0xfb18('0x66')]);utils[_0xfb18('0x3')](util[_0xfb18('0x4')](_0xfb18('0x69'),_0x4d4823[_0xfb18('0x11')],queues[_0x4d4823[_0xfb18('0x11')]][_0xfb18('0x20')],queues[_0x4d4823['uniqueid']][_0xfb18('0x61')]));delete queues[_0x4d4823[_0xfb18('0x11')]][_0xfb18('0x66')];}}}catch(_0x5c0c99){utils[_0xfb18('0x17')](util[_0xfb18('0x4')]('[%s][queues][musiconholdstop]',_0x4d4823[_0xfb18('0x11')]),_0x5c0c99);}}; \ No newline at end of file +var _0xdcaa=['origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','ATTENDED','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','[%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','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','assigned','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdcaa,0x157));var _0xadca=function(_0x234313,_0x2db897){_0x234313=_0x234313-0x0;var _0x5694bb=_0xdcaa[_0x234313];return _0x5694bb;};'use strict';var _=require(_0xadca('0x0'));var util=require(_0xadca('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x465ef1){utils['info'](util['format'](_0xadca('0x2'),_0x465ef1[_0xadca('0x3')],_0x465ef1[_0xadca('0x4')],_0x465ef1['queue'],_0x465ef1['lastAssignedTo'],_0x465ef1[_0xadca('0x5')],_0x465ef1[_0xadca('0x6')],_0x465ef1[_0xadca('0x7')]));if(_0x465ef1[_0xadca('0x8')]){utils[_0xadca('0x9')](_0x465ef1[_0xadca('0x8')])[_0xadca('0xa')](function(_0x2410e7){if(_0x2410e7){_0x465ef1['type']=_0x2410e7[_0xadca('0xb')];}utils[_0xadca('0xc')]('CreateVoiceQueueReport',_0x465ef1);});}else{utils[_0xadca('0xc')](_0xadca('0xd'),_0x465ef1);}if(_0x465ef1[_0xadca('0xe')]){delete queues[_0x465ef1['transfereduniqueid']];}else{delete queues[_0x465ef1['uniqueid']];}}exports[_0xadca('0xf')]=function(_0x23cde0){try{utils[_0xadca('0x10')](util[_0xadca('0x11')](_0xadca('0x12'),_0x23cde0[_0xadca('0x3')]),_0x23cde0);utils[_0xadca('0x13')](util[_0xadca('0x11')](_0xadca('0x14'),_0x23cde0[_0xadca('0x3')],_0x23cde0['queue'],_0x23cde0['position']));queues[_0x23cde0['uniqueid']]=_[_0xadca('0x15')](_0x23cde0,{'originalposition':_0x23cde0[_0xadca('0x16')],'queuecallerjoinAt':utils[_0xadca('0x17')](),'mohtime':0x0});}catch(_0x15b1fa){utils[_0xadca('0x18')](util['format'](_0xadca('0x12'),_0x23cde0['uniqueid']),_0x15b1fa);}};exports[_0xadca('0x19')]=function(_0x31d59a){try{if(!_[_0xadca('0x1a')](queues[_0x31d59a['uniqueid']])){utils[_0xadca('0x10')](util[_0xadca('0x11')](_0xadca('0x1b'),_0x31d59a['uniqueid']),_0x31d59a);if(queues[_0x31d59a[_0xadca('0x3')]]['queuecallerleaveAt']){if(!queues[_0x31d59a['uniqueid']][_0xadca('0x1c')]&&!queues[_0x31d59a[_0xadca('0x3')]][_0xadca('0x1d')]){queues[_0x31d59a[_0xadca('0x3')]][_0xadca('0x1e')]=!![];queues[_0x31d59a['uniqueid']][_0xadca('0x1f')]=utils[_0xadca('0x17')]();queues[_0x31d59a[_0xadca('0x3')]][_0xadca('0x7')]='COMPLETEDBYAGENT';}utils[_0xadca('0x13')](util[_0xadca('0x11')](_0xadca('0x20'),_0x31d59a[_0xadca('0x3')],queues[_0x31d59a[_0xadca('0x3')]][_0xadca('0x21')],queues[_0x31d59a[_0xadca('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x31d59a[_0xadca('0x3')]]);}else if(queues[_0x31d59a[_0xadca('0x3')]][_0xadca('0xe')]){utils[_0xadca('0x13')](util[_0xadca('0x11')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x31d59a[_0xadca('0x3')],queues[_0x31d59a[_0xadca('0x3')]][_0xadca('0x21')],queues[_0x31d59a['uniqueid']]['transfereduniqueid']));queues[queues[_0x31d59a[_0xadca('0x3')]][_0xadca('0xe')]]=queues[_0x31d59a['uniqueid']];queues[queues[_0x31d59a[_0xadca('0x3')]]['transfereduniqueid']][_0xadca('0x22')]=0x2;delete queues[_0x31d59a['uniqueid']];}}}catch(_0xa91434){utils[_0xadca('0x18')](util[_0xadca('0x11')](_0xadca('0x1b'),_0x31d59a[_0xadca('0x3')]),_0xa91434);}};exports[_0xadca('0x23')]=function(_0x50e0a3){try{utils[_0xadca('0x10')](util[_0xadca('0x11')](_0xadca('0x24'),_0x50e0a3[_0xadca('0x3')]),_0x50e0a3);if(!_[_0xadca('0x1a')](_0x50e0a3[_0xadca('0x25')][_0xadca('0x26')])&&_0x50e0a3[_0xadca('0x27')][_0xadca('0x28')]()!==_0xadca('0x29')){if(!_[_0xadca('0x1a')](queues[_0x50e0a3['uniqueid']])){queues[_0x50e0a3['uniqueid']][_0xadca('0x1c')]=![];queues[_0x50e0a3['uniqueid']][_0xadca('0x2a')]=null;queues[_0x50e0a3[_0xadca('0x3')]][_0xadca('0x1d')]=!![];queues[_0x50e0a3[_0xadca('0x3')]][_0xadca('0x2b')]=utils[_0xadca('0x17')]();queues[_0x50e0a3[_0xadca('0x3')]]['queuecallerexitreason']=_0x50e0a3[_0xadca('0x27')][_0xadca('0x28')]();utils[_0xadca('0x13')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x50e0a3['uniqueid'],queues[_0x50e0a3[_0xadca('0x3')]][_0xadca('0x21')],_0x50e0a3[_0xadca('0x27')],queues[_0x50e0a3[_0xadca('0x3')]][_0xadca('0x7')]));writeDB(queues[_0x50e0a3[_0xadca('0x3')]]);}}else if(!_['isNil'](_0x50e0a3[_0xadca('0x25')][_0xadca('0x2c')])){if(!_['isNil'](queues[_0x50e0a3[_0xadca('0x3')]])&&!queues[_0x50e0a3[_0xadca('0x3')]][_0xadca('0x1c')]){queues[_0x50e0a3[_0xadca('0x3')]]['queuecallerabandon']=![];queues[_0x50e0a3[_0xadca('0x3')]][_0xadca('0x2a')]=null;queues[_0x50e0a3['uniqueid']][_0xadca('0x1d')]=!![];queues[_0x50e0a3[_0xadca('0x3')]][_0xadca('0x2b')]=utils[_0xadca('0x17')]();queues[_0x50e0a3['uniqueid']][_0xadca('0x7')]='EXITWITHKEY';utils['info'](util[_0xadca('0x11')](_0xadca('0x2d'),_0x50e0a3[_0xadca('0x3')],queues[_0x50e0a3[_0xadca('0x3')]][_0xadca('0x21')],_0x50e0a3[_0xadca('0x27')],queues[_0x50e0a3[_0xadca('0x3')]][_0xadca('0x7')]));}}}catch(_0x52760e){utils[_0xadca('0x18')](util[_0xadca('0x11')](_0xadca('0x24'),_0x50e0a3[_0xadca('0x3')]),_0x52760e);}};exports[_0xadca('0x1c')]=function(_0x15c2f9){try{if(!_[_0xadca('0x1a')](queues[_0x15c2f9['uniqueid']])){utils[_0xadca('0x10')](util[_0xadca('0x11')](_0xadca('0x2e'),_0x15c2f9[_0xadca('0x3')]),_0x15c2f9);queues[_0x15c2f9['uniqueid']]['queuecallerexit']=![];queues[_0x15c2f9['uniqueid']][_0xadca('0x2b')]=null;queues[_0x15c2f9[_0xadca('0x3')]][_0xadca('0x1c')]=!![];queues[_0x15c2f9[_0xadca('0x3')]][_0xadca('0x2a')]=utils['now']();queues[_0x15c2f9['uniqueid']][_0xadca('0x7')]=_0xadca('0x2f');utils[_0xadca('0x13')](util['format'](_0xadca('0x30'),_0x15c2f9['uniqueid'],queues[_0x15c2f9[_0xadca('0x3')]]['name'],queues[_0x15c2f9[_0xadca('0x3')]][_0xadca('0x7')]));}}catch(_0x40080a){utils[_0xadca('0x18')](util[_0xadca('0x11')](_0xadca('0x2e'),_0x15c2f9[_0xadca('0x3')]),_0x40080a);}};exports[_0xadca('0x31')]=function(_0x46782b){try{if(!_[_0xadca('0x1a')](queues[_0x46782b[_0xadca('0x3')]])){utils['debug'](util[_0xadca('0x11')](_0xadca('0x32'),_0x46782b['uniqueid']),_0x46782b);utils[_0xadca('0x13')](util[_0xadca('0x11')](_0xadca('0x33'),_0x46782b[_0xadca('0x3')],queues[_0x46782b[_0xadca('0x3')]][_0xadca('0x21')],_0x46782b[_0xadca('0x34')],_0x46782b[_0xadca('0x35')]));queues[_0x46782b[_0xadca('0x3')]][_0xadca('0x31')]=!![];queues[_0x46782b[_0xadca('0x3')]][_0xadca('0x36')]=utils[_0xadca('0x17')]();queues[_0x46782b[_0xadca('0x3')]][_0xadca('0x37')]=utils[_0xadca('0x38')](queues[_0x46782b['uniqueid']][_0xadca('0x36')],queues[_0x46782b['uniqueid']][_0xadca('0x39')]);queues[_0x46782b[_0xadca('0x3')]][_0xadca('0x16')]=_0x46782b['position'];queues[_0x46782b['uniqueid']][_0xadca('0x3a')]=_0x46782b[_0xadca('0x3a')];queues[_0x46782b[_0xadca('0x3')]][_0xadca('0x34')]=_0x46782b[_0xadca('0x34')];queues[_0x46782b[_0xadca('0x3')]][_0xadca('0x35')]=_0x46782b[_0xadca('0x35')];}}catch(_0x2a6b75){utils[_0xadca('0x18')](util[_0xadca('0x11')](_0xadca('0x32'),_0x46782b[_0xadca('0x3')]),_0x2a6b75);}};exports[_0xadca('0x3b')]=function(_0x48c3e0){try{if(!_[_0xadca('0x1a')](queues[_0x48c3e0[_0xadca('0x3')]])){utils[_0xadca('0x10')](util[_0xadca('0x11')](_0xadca('0x3c'),_0x48c3e0[_0xadca('0x3')]),_0x48c3e0);utils[_0xadca('0x13')](util[_0xadca('0x11')](_0xadca('0x3d'),_0x48c3e0[_0xadca('0x3')],queues[_0x48c3e0[_0xadca('0x3')]][_0xadca('0x21')],_0x48c3e0[_0xadca('0x3e')],_0x48c3e0[_0xadca('0x3f')]));queues[_0x48c3e0[_0xadca('0x3')]][_0xadca('0x1c')]=![];queues[_0x48c3e0[_0xadca('0x3')]][_0xadca('0x1c')]=![];queues[_0x48c3e0['uniqueid']][_0xadca('0x2a')]=null;queues[_0x48c3e0['uniqueid']][_0xadca('0x1d')]=![];queues[_0x48c3e0[_0xadca('0x3')]][_0xadca('0x7')]=null;queues[_0x48c3e0[_0xadca('0x3')]]['queuecallerexitAt']=null;queues[_0x48c3e0[_0xadca('0x3')]]['assigned']=!![];queues[_0x48c3e0[_0xadca('0x3')]]['accountcode']=_0x48c3e0[_0xadca('0x3f')];queues[_0x48c3e0[_0xadca('0x3')]][_0xadca('0x40')]=_0x48c3e0[_0xadca('0x3e')];}}catch(_0x5968cf){utils[_0xadca('0x18')](util[_0xadca('0x11')]('[%s][queues][agentconnect]',_0x48c3e0[_0xadca('0x3')]),_0x5968cf);}};exports[_0xadca('0x41')]=function(_0x5cefff){try{if(!_[_0xadca('0x1a')](queues[_0x5cefff[_0xadca('0x3')]])){if(queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x36')]){utils[_0xadca('0x10')](util[_0xadca('0x11')]('[%s][queues][agentcomplete]',_0x5cefff['uniqueid']),_0x5cefff);queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x1c')]=![];queues[_0x5cefff['uniqueid']][_0xadca('0x1c')]=![];queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x2a')]=null;queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x1d')]=![];queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x2b')]=null;queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x42')]=!![];queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x40')]=_0x5cefff[_0xadca('0x3e')];queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x1e')]=!![];queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x1f')]=utils['now']();if(_0x5cefff[_0xadca('0x43')]==_0xadca('0x44')){if(!queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x44')]){queues[_0x5cefff[_0xadca('0x3')]]['queuecallerexitreason']=_0xadca('0x45');}}else{queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x7')]='COMPLETEDBY'+_0x5cefff['reason']['toUpperCase']();}utils[_0xadca('0x13')](util['format'](_0xadca('0x46'),_0x5cefff['uniqueid'],queues[_0x5cefff['uniqueid']][_0xadca('0x21')],_0x5cefff[_0xadca('0x3e')],queues[_0x5cefff[_0xadca('0x3')]][_0xadca('0x7')]));writeDB(queues[_0x5cefff[_0xadca('0x3')]]);}}}catch(_0x501737){utils[_0xadca('0x18')](util[_0xadca('0x11')](_0xadca('0x47'),_0x5cefff['uniqueid']),_0x501737);}};exports['blindtransfer']=function(_0x10e358){try{if(!_[_0xadca('0x1a')](queues[_0x10e358['transfereeuniqueid']])){utils['debug'](util['format'](_0xadca('0x48'),_0x10e358[_0xadca('0x3')]),_0x10e358);queues[_0x10e358['transfereeuniqueid']][_0xadca('0x44')]=!![];queues[_0x10e358[_0xadca('0x49')]][_0xadca('0x4a')]=_0xadca('0x4b');queues[_0x10e358[_0xadca('0x49')]][_0xadca('0x4c')]=_0x10e358[_0xadca('0x4d')];queues[_0x10e358[_0xadca('0x49')]]['transferuniqueid']=_0x10e358[_0xadca('0x49')];queues[_0x10e358[_0xadca('0x49')]]['queuecallerexitreason']=_0xadca('0x4e');utils['info'](util[_0xadca('0x11')](_0xadca('0x4f'),_0x10e358[_0xadca('0x3')],queues[_0x10e358['transfereeuniqueid']][_0xadca('0x21')],_0x10e358['transfereeuniqueid'],_0x10e358['extension']));}}catch(_0x5e672e){utils[_0xadca('0x18')](util['format'](_0xadca('0x48'),_0x10e358['uniqueid']),_0x5e672e);}};exports[_0xadca('0x50')]=function(_0x48ca96){try{utils[_0xadca('0x10')](util[_0xadca('0x11')]('[%s][queues][attendedtransfer]',_0x48ca96[_0xadca('0x51')]),_0x48ca96);if(_0x48ca96[_0xadca('0x51')]==_0x48ca96['origtransfererlinkedid']){if(!_['isNil'](queues[_0x48ca96[_0xadca('0x52')]])){utils['info'](util['format'](_0xadca('0x53'),_0x48ca96[_0xadca('0x51')],queues[_0x48ca96['secondtransfererlinkedid']][_0xadca('0x21')],_0x48ca96['origtransfererexten']));queues[_0x48ca96[_0xadca('0x52')]][_0xadca('0x44')]=!![];queues[_0x48ca96[_0xadca('0x52')]][_0xadca('0x4a')]='ATTENDED';queues[_0x48ca96[_0xadca('0x52')]][_0xadca('0x4c')]=_0x48ca96[_0xadca('0x54')];queues[_0x48ca96[_0xadca('0x52')]]['transferuniqueid']=_0x48ca96['origtransfereruniqueid'];queues[_0x48ca96[_0xadca('0x52')]]['queuecallerexitreason']=_0xadca('0x55');}if(!_[_0xadca('0x1a')](queues[_0x48ca96[_0xadca('0x56')]])){if(_0x48ca96['transfereelinkedid']&&queues[_0x48ca96[_0xadca('0x57')]]){queues[_0x48ca96[_0xadca('0x57')]][_0xadca('0x22')]=0x1;queues[_0x48ca96['transfereeuniqueid']]=_[_0xadca('0x58')](queues[_0x48ca96[_0xadca('0x57')]]);queues[_0x48ca96[_0xadca('0x49')]][_0xadca('0xe')]=_0x48ca96['transfertargetuniqueid'];queues[_0x48ca96['transfereeuniqueid']][_0xadca('0x22')]=0x2;queues[_0x48ca96['transfereeuniqueid']][_0xadca('0x5')]=queues[_0x48ca96[_0xadca('0x52')]][_0xadca('0x5')];queues[_0x48ca96[_0xadca('0x49')]][_0xadca('0x59')]=queues[_0x48ca96['secondtransfererlinkedid']][_0xadca('0x59')];queues[_0x48ca96['transfereeuniqueid']]['queuecallerjoinAt']=utils['now']();queues[_0x48ca96[_0xadca('0x49')]][_0xadca('0x36')]=utils['now']();queues[_0x48ca96[_0xadca('0x49')]][_0xadca('0x37')]=0x0;queues[_0x48ca96[_0xadca('0x49')]][_0xadca('0x5a')]=0x0;utils[_0xadca('0x13')](util[_0xadca('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x48ca96[_0xadca('0x51')],queues[_0x48ca96['transfereeuniqueid']]['name'],queues[_0x48ca96[_0xadca('0x49')]][_0xadca('0x5')],queues[_0x48ca96[_0xadca('0x49')]][_0xadca('0x59')]));}else{utils[_0xadca('0x13')](util[_0xadca('0x11')](_0xadca('0x5b'),_0x48ca96['origtransfereruniqueid'],queues[_0x48ca96[_0xadca('0x56')]]['name'],_0x48ca96[_0xadca('0x52')]));queues[_0x48ca96['origtransfererlinkedid']][_0xadca('0xe')]=_0x48ca96[_0xadca('0x52')];}}}else if(_0x48ca96['secondtransfereruniqueid']==_0x48ca96['secondtransfererlinkedid']){if(!_[_0xadca('0x1a')](queues[_0x48ca96[_0xadca('0x56')]])){utils['info'](util[_0xadca('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x48ca96['origtransfereruniqueid'],queues[_0x48ca96[_0xadca('0x56')]][_0xadca('0x21')],_0x48ca96['secondtransfereruniqueid'],_0x48ca96['secondtransfererexten']));queues[_0x48ca96[_0xadca('0x56')]][_0xadca('0x44')]=!![];queues[_0x48ca96[_0xadca('0x56')]]['transfertype']=_0xadca('0x5c');queues[_0x48ca96[_0xadca('0x56')]][_0xadca('0x4c')]=_0x48ca96[_0xadca('0x5d')];queues[_0x48ca96[_0xadca('0x56')]][_0xadca('0x5e')]=_0x48ca96[_0xadca('0x5f')];queues[_0x48ca96[_0xadca('0x56')]][_0xadca('0x7')]=_0xadca('0x55');}if(!_[_0xadca('0x1a')](queues[_0x48ca96[_0xadca('0x52')]])){if(_0x48ca96[_0xadca('0x60')]&&queues[_0x48ca96['transfertargetlinkedid']]){queues[_0x48ca96[_0xadca('0x60')]][_0xadca('0x22')]=0x1;queues[_0x48ca96[_0xadca('0x61')]]=_[_0xadca('0x58')](queues[_0x48ca96[_0xadca('0x60')]]);queues[_0x48ca96[_0xadca('0x61')]][_0xadca('0xe')]=_0x48ca96[_0xadca('0x61')];queues[_0x48ca96[_0xadca('0x61')]][_0xadca('0x22')]=0x2;queues[_0x48ca96['transfertargetuniqueid']][_0xadca('0x5')]=queues[_0x48ca96[_0xadca('0x56')]][_0xadca('0x5')];queues[_0x48ca96[_0xadca('0x61')]]['calleridname']=queues[_0x48ca96['origtransfererlinkedid']][_0xadca('0x59')];queues[_0x48ca96['transfertargetuniqueid']][_0xadca('0x39')]=utils[_0xadca('0x17')]();queues[_0x48ca96[_0xadca('0x61')]][_0xadca('0x36')]=utils[_0xadca('0x17')]();queues[_0x48ca96[_0xadca('0x61')]]['holdtime']=0x0;queues[_0x48ca96[_0xadca('0x61')]][_0xadca('0x5a')]=0x0;utils[_0xadca('0x13')](util[_0xadca('0x11')](_0xadca('0x62'),_0x48ca96[_0xadca('0x51')],queues[_0x48ca96[_0xadca('0x61')]]['name'],queues[_0x48ca96[_0xadca('0x61')]][_0xadca('0xe')],queues[_0x48ca96[_0xadca('0x61')]]['calleridnum'],queues[_0x48ca96[_0xadca('0x61')]][_0xadca('0x59')]));}else{utils['info'](util[_0xadca('0x11')](_0xadca('0x5b'),_0x48ca96[_0xadca('0x51')],queues[_0x48ca96[_0xadca('0x52')]][_0xadca('0x21')],_0x48ca96[_0xadca('0x56')]));queues[_0x48ca96['secondtransfererlinkedid']][_0xadca('0xe')]=_0x48ca96[_0xadca('0x56')];}}}}catch(_0x2d487f){utils[_0xadca('0x18')](util[_0xadca('0x11')](_0xadca('0x63'),_0x48ca96[_0xadca('0x51')]),_0x2d487f);}};exports[_0xadca('0x64')]=function(_0x4b8021){try{if(!_['isNil'](queues[_0x4b8021[_0xadca('0x3')]])){utils[_0xadca('0x10')](util[_0xadca('0x11')](_0xadca('0x65'),_0x4b8021[_0xadca('0x3')]),_0x4b8021);queues[_0x4b8021[_0xadca('0x3')]][_0xadca('0x66')]=utils[_0xadca('0x17')]();utils[_0xadca('0x13')](util[_0xadca('0x11')](_0xadca('0x67'),_0x4b8021[_0xadca('0x3')],queues[_0x4b8021['uniqueid']][_0xadca('0x21')],queues[_0x4b8021[_0xadca('0x3')]][_0xadca('0x66')]));}}catch(_0x45b4f2){utils[_0xadca('0x18')](util[_0xadca('0x11')](_0xadca('0x65'),_0x4b8021[_0xadca('0x3')]),_0x45b4f2);}};exports['musiconholdstop']=function(_0xb34319){try{if(!_['isNil'](queues[_0xb34319['uniqueid']])){if(!_[_0xadca('0x1a')](queues[_0xb34319[_0xadca('0x3')]][_0xadca('0x66')])){utils[_0xadca('0x10')](util[_0xadca('0x11')]('[%s][queues][musiconholdstop]',_0xb34319[_0xadca('0x3')]),_0xb34319);queues[_0xb34319[_0xadca('0x3')]]['mohtime']+=utils[_0xadca('0x38')](utils[_0xadca('0x17')](),queues[_0xb34319['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0xadca('0x11')](_0xadca('0x68'),_0xb34319[_0xadca('0x3')],queues[_0xb34319[_0xadca('0x3')]][_0xadca('0x21')],queues[_0xb34319[_0xadca('0x3')]][_0xadca('0x5a')]));delete queues[_0xb34319[_0xadca('0x3')]][_0xadca('0x66')];}}}catch(_0x15eee6){utils[_0xadca('0x18')](util['format'](_0xadca('0x69'),_0xb34319[_0xadca('0x3')]),_0x15eee6);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 6760879..5d4da20 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 _0x60bb=['startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','membername','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','find','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','monitors','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set'];(function(_0x10d54e,_0x14514a){var _0x3529c5=function(_0x13880b){while(--_0x13880b){_0x10d54e['push'](_0x10d54e['shift']());}};_0x3529c5(++_0x14514a);}(_0x60bb,0x176));var _0xb60b=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0x60bb[_0x4ea413];return _0x51cf25;};'use strict';var _=require('lodash');var util=require(_0xb60b('0x0'));var utils=require(_0xb60b('0x1'));var recordings={};function writeDB(_0x3c7230){utils[_0xb60b('0x2')](util[_0xb60b('0x3')](_0xb60b('0x4'),_0x3c7230[_0xb60b('0x5')]));if(_0x3c7230['accountcode']){utils[_0xb60b('0x6')](_0x3c7230[_0xb60b('0x7')])['then'](function(_0x3b04f5){if(_0x3b04f5){_0x3c7230[_0xb60b('0x8')]=_0x3b04f5['name'];_0x3c7230[_0xb60b('0x9')]=_0x3b04f5['id'];}utils[_0xb60b('0xa')](_0xb60b('0xb'),_0x3c7230);});}else{utils[_0xb60b('0xa')](_0xb60b('0xb'),_0x3c7230);}}exports[_0xb60b('0xc')]=function(_0x223e86){try{utils[_0xb60b('0xd')](util[_0xb60b('0x3')]('[%s][recordings][newchannel]',_0x223e86[_0xb60b('0x5')]),_0x223e86);if(_0x223e86[_0xb60b('0x5')]==_0x223e86[_0xb60b('0xe')]){utils['info'](util[_0xb60b('0x3')](_0xb60b('0xf'),_0x223e86[_0xb60b('0x5')],_0x223e86[_0xb60b('0x10')],_0x223e86[_0xb60b('0x11')]));recordings[_0x223e86['uniqueid']]={'uniqueid':_0x223e86[_0xb60b('0x5')],'accountcode':_0x223e86[_0xb60b('0x7')],'exten':_0x223e86[_0xb60b('0x11')],'context':_0x223e86[_0xb60b('0x10')],'channel':_0x223e86[_0xb60b('0x12')],'monitors':[]};}}catch(_0x37a6bf){utils[_0xb60b('0x13')](util[_0xb60b('0x3')](_0xb60b('0x14'),_0x223e86[_0xb60b('0x5')]),_0x37a6bf);}};exports['newstate']=function(_0x1fce83){try{utils[_0xb60b('0xd')](util['format'](_0xb60b('0x15'),_0x1fce83[_0xb60b('0x5')]),_0x1fce83);if(!_['isNil'](recordings[_0x1fce83['uniqueid']])&&_0x1fce83[_0xb60b('0x16')]==0x6){utils[_0xb60b('0x2')](util['format'](_0xb60b('0x17'),_0x1fce83[_0xb60b('0x5')],_0x1fce83[_0xb60b('0x10')],_0x1fce83[_0xb60b('0x12')]));}else if(!_[_0xb60b('0x18')](recordings[_0x1fce83[_0xb60b('0xe')]])&&_0x1fce83[_0xb60b('0x16')]==0x6&&_0x1fce83[_0xb60b('0x10')]!=_0xb60b('0x19')){utils[_0xb60b('0x2')](util[_0xb60b('0x3')](_0xb60b('0x1a'),_0x1fce83[_0xb60b('0x5')],_0x1fce83[_0xb60b('0xe')],_0x1fce83[_0xb60b('0x10')],_0x1fce83[_0xb60b('0x12')]));recordings[_0x1fce83[_0xb60b('0xe')]][_0xb60b('0x7')]=_0x1fce83[_0xb60b('0x7')];}}catch(_0x46b4c5){utils[_0xb60b('0x13')](util['format'](_0xb60b('0x15'),_0x1fce83[_0xb60b('0x5')]),_0x46b4c5);}};exports[_0xb60b('0x1b')]=function(_0x7f0dfe){try{if(!_[_0xb60b('0x18')](_0x7f0dfe[_0xb60b('0x1c')])&&!_[_0xb60b('0x18')](_0x7f0dfe[_0xb60b('0x1c')][_0xb60b('0x1d')])){utils[_0xb60b('0xd')](util[_0xb60b('0x3')]('[%s][recordings][varset]',_0x7f0dfe[_0xb60b('0x5')]),_0x7f0dfe);utils[_0xb60b('0x2')](util[_0xb60b('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x7f0dfe['uniqueid'],_0x7f0dfe[_0xb60b('0x1c')],_0x7f0dfe['value']));if(_[_0xb60b('0x1e')](_0x7f0dfe[_0xb60b('0x1f')],_0xb60b('0x20'))){_0x7f0dfe[_0xb60b('0x1f')]=_0x7f0dfe[_0xb60b('0x1f')][_0xb60b('0x21')](_0xb60b('0x20'),_0xb60b('0x22'));}if(recordings[_0x7f0dfe[_0xb60b('0xe')]]){var _0x40b8cb=_[_0xb60b('0x23')](recordings[_0x7f0dfe[_0xb60b('0xe')]]['monitors'],{'value':_0x7f0dfe[_0xb60b('0x1f')]});if(_[_0xb60b('0x18')](_0x40b8cb)){recordings[_0x7f0dfe[_0xb60b('0xe')]]['monitors']['push']({'value':_0x7f0dfe[_0xb60b('0x1f')]});}}}}catch(_0x453698){utils[_0xb60b('0x13')](util[_0xb60b('0x3')](_0xb60b('0x24'),_0x7f0dfe[_0xb60b('0x5')]),_0x453698);}};exports[_0xb60b('0x25')]=function(_0x601d3a){try{if(!_[_0xb60b('0x18')](recordings[_0x601d3a[_0xb60b('0x5')]])){utils[_0xb60b('0xd')](util[_0xb60b('0x3')](_0xb60b('0x26'),_0x601d3a['uniqueid']),_0x601d3a);utils[_0xb60b('0x2')](util[_0xb60b('0x3')](_0xb60b('0x27'),_0x601d3a[_0xb60b('0x5')],_0x601d3a['calleridnum'],_0x601d3a[_0xb60b('0x28')],_0x601d3a[_0xb60b('0x29')]));recordings[_0x601d3a['uniqueid']][_0xb60b('0x2a')]=_0x601d3a[_0xb60b('0x2a')];recordings[_0x601d3a[_0xb60b('0x5')]][_0xb60b('0x28')]=_0x601d3a['calleridname'];recordings[_0x601d3a[_0xb60b('0x5')]][_0xb60b('0x2b')]=_0x601d3a[_0xb60b('0x2b')];recordings[_0x601d3a[_0xb60b('0x5')]][_0xb60b('0x2c')]=_0x601d3a[_0xb60b('0x2c')];if(recordings[_0x601d3a['uniqueid']][_0xb60b('0x2d')]=='outbound'&&recordings[_0x601d3a[_0xb60b('0x5')]]['accountcode']){recordings[_0x601d3a[_0xb60b('0x5')]]['connectedlinenum']=recordings[_0x601d3a['uniqueid']][_0xb60b('0x7')];recordings[_0x601d3a[_0xb60b('0x5')]][_0xb60b('0x2c')]='';}recordings[_0x601d3a['uniqueid']][_0xb60b('0x2e')]['forEach'](function(_0x146c2e){var _0x40f8cc=_['clone'](recordings[_0x601d3a[_0xb60b('0x5')]]);_0x40f8cc['value']=_0x146c2e[_0xb60b('0x1f')];writeDB(_0x40f8cc);});delete recordings[_0x601d3a[_0xb60b('0x5')]];}}catch(_0x43e71a){utils[_0xb60b('0x13')](util[_0xb60b('0x3')](_0xb60b('0x26'),_0x601d3a[_0xb60b('0x5')]),_0x43e71a);}};exports[_0xb60b('0x2f')]=function(_0x795486){try{if(!_[_0xb60b('0x18')](recordings[_0x795486['uniqueid']])){utils[_0xb60b('0xd')](util['format'](_0xb60b('0x30'),_0x795486[_0xb60b('0x5')]),_0x795486);utils[_0xb60b('0x2')](util[_0xb60b('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x795486[_0xb60b('0x5')],_0x795486[_0xb60b('0x31')],_0x795486[_0xb60b('0x32')]));if(_0x795486[_0xb60b('0x31')][_0xb60b('0x33')]()==_0xb60b('0x34')&&_[_0xb60b('0x35')](_0x795486[_0xb60b('0x32')][_0xb60b('0x33')](),'cdr')){var _0x155403=_0x795486[_0xb60b('0x32')][_0xb60b('0x36')]('=');var _0x428938=_0x155403[0x0][_0xb60b('0x37')](_0x155403[0x0]['lastIndexOf']('(')+0x1,_0x155403[0x0][_0xb60b('0x38')](')'));var _0x5a705b=_0x155403[0x1];recordings[_0x795486[_0xb60b('0x5')]][_0x428938]=_0x5a705b;}}}catch(_0x1d401d){utils[_0xb60b('0x13')](util[_0xb60b('0x3')]('[%s][recordings][newexten]',_0x795486[_0xb60b('0x5')]),_0x1d401d);}};exports[_0xb60b('0x39')]=function(_0x46fd10){try{if(!_['isNil'](recordings[_0x46fd10['uniqueid']])){utils[_0xb60b('0xd')](util[_0xb60b('0x3')](_0xb60b('0x3a'),_0x46fd10[_0xb60b('0x5')]),_0x46fd10);utils[_0xb60b('0x2')](util[_0xb60b('0x3')](_0xb60b('0x3b'),_0x46fd10[_0xb60b('0x5')],_0x46fd10[_0xb60b('0x3c')]));recordings[_0x46fd10[_0xb60b('0x5')]][_0xb60b('0x3c')]=_0x46fd10[_0xb60b('0x3c')];}}catch(_0x179b7a){utils[_0xb60b('0x13')](util['format'](_0xb60b('0x3a'),_0x46fd10[_0xb60b('0x5')]),_0x179b7a);}}; \ No newline at end of file +var _0x7c39=['appdata','toLowerCase','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','error','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','value','endsWith','replace','.wav49','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]','application'];(function(_0x29092a,_0x427f74){var _0x39280c=function(_0x2b1416){while(--_0x2b1416){_0x29092a['push'](_0x29092a['shift']());}};_0x39280c(++_0x427f74);}(_0x7c39,0xbb));var _0x97c3=function(_0x35b741,_0x4aa36c){_0x35b741=_0x35b741-0x0;var _0x344e70=_0x7c39[_0x35b741];return _0x344e70;};'use strict';var _=require('lodash');var util=require(_0x97c3('0x0'));var utils=require(_0x97c3('0x1'));var recordings={};function writeDB(_0x1ccc63){utils[_0x97c3('0x2')](util['format'](_0x97c3('0x3'),_0x1ccc63[_0x97c3('0x4')]));if(_0x1ccc63[_0x97c3('0x5')]){utils[_0x97c3('0x6')](_0x1ccc63[_0x97c3('0x5')])['then'](function(_0x3e397b){if(_0x3e397b){_0x1ccc63['membername']=_0x3e397b[_0x97c3('0x7')];_0x1ccc63[_0x97c3('0x8')]=_0x3e397b['id'];}utils[_0x97c3('0x9')](_0x97c3('0xa'),_0x1ccc63);});}else{utils[_0x97c3('0x9')](_0x97c3('0xa'),_0x1ccc63);}}exports[_0x97c3('0xb')]=function(_0x2526a8){try{utils[_0x97c3('0xc')](util[_0x97c3('0xd')]('[%s][recordings][newchannel]',_0x2526a8['uniqueid']),_0x2526a8);if(_0x2526a8[_0x97c3('0x4')]==_0x2526a8[_0x97c3('0xe')]){utils[_0x97c3('0x2')](util[_0x97c3('0xd')](_0x97c3('0xf'),_0x2526a8[_0x97c3('0x4')],_0x2526a8['context'],_0x2526a8[_0x97c3('0x10')]));recordings[_0x2526a8[_0x97c3('0x4')]]={'uniqueid':_0x2526a8[_0x97c3('0x4')],'accountcode':_0x2526a8[_0x97c3('0x5')],'exten':_0x2526a8[_0x97c3('0x10')],'context':_0x2526a8[_0x97c3('0x11')],'channel':_0x2526a8['channel'],'monitors':[]};}}catch(_0x2d15d4){utils[_0x97c3('0x12')](util[_0x97c3('0xd')]('[%s][recordings][newchannel]',_0x2526a8['uniqueid']),_0x2d15d4);}};exports['newstate']=function(_0x428f3e){try{utils[_0x97c3('0xc')](util[_0x97c3('0xd')]('[%s][recordings][newstate]',_0x428f3e[_0x97c3('0x4')]),_0x428f3e);if(!_[_0x97c3('0x13')](recordings[_0x428f3e[_0x97c3('0x4')]])&&_0x428f3e[_0x97c3('0x14')]==0x6){utils['info'](util['format'](_0x97c3('0x15'),_0x428f3e[_0x97c3('0x4')],_0x428f3e['context'],_0x428f3e[_0x97c3('0x16')]));}else if(!_[_0x97c3('0x13')](recordings[_0x428f3e[_0x97c3('0xe')]])&&_0x428f3e[_0x97c3('0x14')]==0x6&&_0x428f3e['context']!=_0x97c3('0x17')){utils[_0x97c3('0x2')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x428f3e['uniqueid'],_0x428f3e[_0x97c3('0xe')],_0x428f3e[_0x97c3('0x11')],_0x428f3e[_0x97c3('0x16')]));recordings[_0x428f3e[_0x97c3('0xe')]][_0x97c3('0x5')]=_0x428f3e[_0x97c3('0x5')];}}catch(_0x54dbb4){utils['error'](util['format'](_0x97c3('0x18'),_0x428f3e['uniqueid']),_0x54dbb4);}};exports[_0x97c3('0x19')]=function(_0x4151cd){try{if(!_[_0x97c3('0x13')](_0x4151cd[_0x97c3('0x1a')])&&!_[_0x97c3('0x13')](_0x4151cd[_0x97c3('0x1a')]['mixmonitor_filename'])){utils[_0x97c3('0xc')](util[_0x97c3('0xd')](_0x97c3('0x1b'),_0x4151cd[_0x97c3('0x4')]),_0x4151cd);utils[_0x97c3('0x2')](util[_0x97c3('0xd')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x4151cd['uniqueid'],_0x4151cd[_0x97c3('0x1a')],_0x4151cd[_0x97c3('0x1c')]));if(_[_0x97c3('0x1d')](_0x4151cd[_0x97c3('0x1c')],'.wav49')){_0x4151cd[_0x97c3('0x1c')]=_0x4151cd['value'][_0x97c3('0x1e')](_0x97c3('0x1f'),'.WAV');}if(recordings[_0x4151cd[_0x97c3('0xe')]]){var _0x33664a=_[_0x97c3('0x20')](recordings[_0x4151cd['linkedid']][_0x97c3('0x21')],{'value':_0x4151cd['value']});if(_['isNil'](_0x33664a)){recordings[_0x4151cd[_0x97c3('0xe')]][_0x97c3('0x21')][_0x97c3('0x22')]({'value':_0x4151cd[_0x97c3('0x1c')]});}}}}catch(_0x55dd59){utils['error'](util['format'](_0x97c3('0x1b'),_0x4151cd[_0x97c3('0x4')]),_0x55dd59);}};exports[_0x97c3('0x23')]=function(_0x5f101d){try{if(!_[_0x97c3('0x13')](recordings[_0x5f101d[_0x97c3('0x4')]])){utils[_0x97c3('0xc')](util[_0x97c3('0xd')](_0x97c3('0x24'),_0x5f101d['uniqueid']),_0x5f101d);utils[_0x97c3('0x2')](util[_0x97c3('0xd')](_0x97c3('0x25'),_0x5f101d['uniqueid'],_0x5f101d['calleridnum'],_0x5f101d[_0x97c3('0x26')],_0x5f101d[_0x97c3('0x27')]));recordings[_0x5f101d[_0x97c3('0x4')]][_0x97c3('0x28')]=_0x5f101d[_0x97c3('0x28')];recordings[_0x5f101d[_0x97c3('0x4')]][_0x97c3('0x26')]=_0x5f101d[_0x97c3('0x26')];recordings[_0x5f101d[_0x97c3('0x4')]][_0x97c3('0x29')]=_0x5f101d['connectedlinenum'];recordings[_0x5f101d[_0x97c3('0x4')]][_0x97c3('0x2a')]=_0x5f101d[_0x97c3('0x2a')];if(recordings[_0x5f101d[_0x97c3('0x4')]][_0x97c3('0x2b')]==_0x97c3('0x2c')&&recordings[_0x5f101d[_0x97c3('0x4')]]['accountcode']){recordings[_0x5f101d[_0x97c3('0x4')]][_0x97c3('0x29')]=recordings[_0x5f101d[_0x97c3('0x4')]][_0x97c3('0x5')];recordings[_0x5f101d[_0x97c3('0x4')]][_0x97c3('0x2a')]='';}recordings[_0x5f101d[_0x97c3('0x4')]][_0x97c3('0x21')][_0x97c3('0x2d')](function(_0x2c573e){var _0x727162=_['clone'](recordings[_0x5f101d[_0x97c3('0x4')]]);_0x727162[_0x97c3('0x1c')]=_0x2c573e['value'];writeDB(_0x727162);});delete recordings[_0x5f101d['uniqueid']];}}catch(_0x472c57){utils['error'](util[_0x97c3('0xd')](_0x97c3('0x24'),_0x5f101d[_0x97c3('0x4')]),_0x472c57);}};exports[_0x97c3('0x2e')]=function(_0x4b552b){try{if(!_[_0x97c3('0x13')](recordings[_0x4b552b[_0x97c3('0x4')]])){utils['debug'](util[_0x97c3('0xd')](_0x97c3('0x2f'),_0x4b552b['uniqueid']),_0x4b552b);utils['info'](util[_0x97c3('0xd')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4b552b[_0x97c3('0x4')],_0x4b552b[_0x97c3('0x30')],_0x4b552b[_0x97c3('0x31')]));if(_0x4b552b['application'][_0x97c3('0x32')]()=='set'&&_[_0x97c3('0x33')](_0x4b552b['appdata'][_0x97c3('0x32')](),_0x97c3('0x34'))){var _0x154801=_0x4b552b[_0x97c3('0x31')][_0x97c3('0x35')]('=');var _0x28a7cb=_0x154801[0x0]['substring'](_0x154801[0x0][_0x97c3('0x36')]('(')+0x1,_0x154801[0x0][_0x97c3('0x36')](')'));var _0x57f92c=_0x154801[0x1];recordings[_0x4b552b[_0x97c3('0x4')]][_0x28a7cb]=_0x57f92c;}}}catch(_0x122030){utils[_0x97c3('0x12')](util[_0x97c3('0xd')](_0x97c3('0x2f'),_0x4b552b[_0x97c3('0x4')]),_0x122030);}};exports[_0x97c3('0x37')]=function(_0x5f60ae){try{if(!_['isNil'](recordings[_0x5f60ae[_0x97c3('0x4')]])){utils[_0x97c3('0xc')](util[_0x97c3('0xd')](_0x97c3('0x38'),_0x5f60ae[_0x97c3('0x4')]),_0x5f60ae);utils['info'](util[_0x97c3('0xd')](_0x97c3('0x39'),_0x5f60ae[_0x97c3('0x4')],_0x5f60ae['queue']));recordings[_0x5f60ae[_0x97c3('0x4')]]['queue']=_0x5f60ae[_0x97c3('0x3a')];}}catch(_0x117996){utils[_0x97c3('0x12')](util['format'](_0x97c3('0x38'),_0x5f60ae[_0x97c3('0x4')]),_0x117996);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 3ead2ce..e9984c1 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 _0x445e=['origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','uniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid'];(function(_0x2c32ad,_0x1a12d4){var _0x1d474f=function(_0xa83df7){while(--_0xa83df7){_0x2c32ad['push'](_0x2c32ad['shift']());}};_0x1d474f(++_0x1a12d4);}(_0x445e,0xb8));var _0xe445=function(_0x5b0c3f,_0x463c12){_0x5b0c3f=_0x5b0c3f-0x0;var _0x3b39ee=_0x445e[_0x5b0c3f];return _0x3b39ee;};'use strict';var _=require(_0xe445('0x0'));var util=require(_0xe445('0x1'));var utils=require(_0xe445('0x2'));function writeDB(_0x1674fd){utils['info'](util['format'](_0xe445('0x3'),_0x1674fd[_0xe445('0x4')]===_0xe445('0x5')?_0x1674fd[_0xe445('0x6')]:_0x1674fd['uniqueid'],_0x1674fd[_0xe445('0x4')]));utils[_0xe445('0x7')](_0xe445('0x8'),_0x1674fd);}exports['blindtransfer']=function(_0x302b73){try{utils[_0xe445('0x9')](util['format'](_0xe445('0xa'),_0x302b73['uniqueid']),_0x302b73);utils['info'](util[_0xe445('0xb')](_0xe445('0xc'),_0x302b73['uniqueid'],_0x302b73[_0xe445('0xd')],_0x302b73[_0xe445('0xe')],_0x302b73[_0xe445('0xf')],_0x302b73['transfereecalleridname']));_0x302b73[_0xe445('0x4')]=_0xe445('0x10');writeDB(_0x302b73);}catch(_0x16c84d){utils['error'](util['format'](_0xe445('0xa'),_0x302b73[_0xe445('0x11')]),_0x16c84d);}};exports[_0xe445('0x12')]=function(_0x3b4afd){try{utils[_0xe445('0x9')](util[_0xe445('0xb')](_0xe445('0x13'),_0x3b4afd[_0xe445('0x6')]),_0x3b4afd);utils[_0xe445('0x14')](util[_0xe445('0xb')](_0xe445('0x15'),_0x3b4afd[_0xe445('0x6')],_0x3b4afd[_0xe445('0x16')],_0x3b4afd['origtransferercalleridname'],_0x3b4afd['transfertargetcalleridnum'],_0x3b4afd[_0xe445('0x17')]));_0x3b4afd=_[_0xe445('0x18')](_0x3b4afd,{'transfererchannel':_0x3b4afd[_0xe445('0x19')],'transferercalleridnum':_0x3b4afd[_0xe445('0x16')],'transferercalleridname':_0x3b4afd['origtransferercalleridname'],'transfererconnectedlinenum':_0x3b4afd['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3b4afd[_0xe445('0x1a')],'transfereraccountcode':_0x3b4afd[_0xe445('0x1b')],'transferercontext':_0x3b4afd[_0xe445('0x1c')],'transfererexten':_0x3b4afd[_0xe445('0x1d')],'transfererlinkedid':_0x3b4afd[_0xe445('0x1e')],'context':_0x3b4afd[_0xe445('0x1f')],'extension':_0x3b4afd[_0xe445('0x20')],'type':_0xe445('0x5')});if(_['isNil'](_0x3b4afd[_0xe445('0x21')])){_0x3b4afd=_['assign'](_0x3b4afd,{'transfereechannel':_0x3b4afd[_0xe445('0x22')],'transfereecalleridnum':_0x3b4afd[_0xe445('0x23')],'transfereecalleridname':_0x3b4afd[_0xe445('0x17')],'transfereeconnectedlinenum':_0x3b4afd[_0xe445('0x24')],'transfereeconnectedlinename':_0x3b4afd[_0xe445('0x25')],'transfereeaccountcode':_0x3b4afd[_0xe445('0x26')],'transfereecontext':_0x3b4afd[_0xe445('0x27')],'transfereeexten':_0x3b4afd[_0xe445('0x28')],'transfereelinkedid':_0x3b4afd[_0xe445('0x29')]});}writeDB(_0x3b4afd);}catch(_0x36ca61){utils[_0xe445('0x2a')](util[_0xe445('0xb')](_0xe445('0x13'),_0x3b4afd[_0xe445('0x6')]),_0x36ca61);}}; \ No newline at end of file +var _0x9147=['lodash','util','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','request','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','blind','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error'];(function(_0x2e337a,_0x4d6036){var _0x18a720=function(_0x1c94e4){while(--_0x1c94e4){_0x2e337a['push'](_0x2e337a['shift']());}};_0x18a720(++_0x4d6036);}(_0x9147,0x7b));var _0x7914=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x9147[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var utils=require('./utils');function writeDB(_0x1bf3cd){utils['info'](util[_0x7914('0x2')](_0x7914('0x3'),_0x1bf3cd['type']===_0x7914('0x4')?_0x1bf3cd[_0x7914('0x5')]:_0x1bf3cd[_0x7914('0x6')],_0x1bf3cd['type']));utils[_0x7914('0x7')]('CreateVoiceTransferReport',_0x1bf3cd);}exports[_0x7914('0x8')]=function(_0x535b02){try{utils[_0x7914('0x9')](util[_0x7914('0x2')](_0x7914('0xa'),_0x535b02[_0x7914('0x6')]),_0x535b02);utils[_0x7914('0xb')](util[_0x7914('0x2')](_0x7914('0xc'),_0x535b02[_0x7914('0x6')],_0x535b02[_0x7914('0xd')],_0x535b02[_0x7914('0xe')],_0x535b02[_0x7914('0xf')],_0x535b02[_0x7914('0x10')]));_0x535b02[_0x7914('0x11')]=_0x7914('0x12');writeDB(_0x535b02);}catch(_0x221438){utils['error'](util[_0x7914('0x2')](_0x7914('0xa'),_0x535b02[_0x7914('0x6')]),_0x221438);}};exports[_0x7914('0x13')]=function(_0xe73874){try{utils['debug'](util[_0x7914('0x2')](_0x7914('0x14'),_0xe73874[_0x7914('0x5')]),_0xe73874);utils['info'](util[_0x7914('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xe73874[_0x7914('0x5')],_0xe73874[_0x7914('0x15')],_0xe73874['origtransferercalleridname'],_0xe73874[_0x7914('0x16')],_0xe73874[_0x7914('0x17')]));_0xe73874=_[_0x7914('0x18')](_0xe73874,{'transfererchannel':_0xe73874[_0x7914('0x19')],'transferercalleridnum':_0xe73874[_0x7914('0x15')],'transferercalleridname':_0xe73874['origtransferercalleridname'],'transfererconnectedlinenum':_0xe73874[_0x7914('0x1a')],'transfererconnectedlinename':_0xe73874[_0x7914('0x1b')],'transfereraccountcode':_0xe73874[_0x7914('0x1c')],'transferercontext':_0xe73874[_0x7914('0x1d')],'transfererexten':_0xe73874['secondtransfererexten'],'transfererlinkedid':_0xe73874['origtransfererlinkedid'],'context':_0xe73874[_0x7914('0x1e')],'extension':_0xe73874['origtransfererexten'],'type':_0x7914('0x4')});if(_[_0x7914('0x1f')](_0xe73874[_0x7914('0x20')])){_0xe73874=_[_0x7914('0x18')](_0xe73874,{'transfereechannel':_0xe73874[_0x7914('0x21')],'transfereecalleridnum':_0xe73874['transfertargetcalleridnum'],'transfereecalleridname':_0xe73874[_0x7914('0x17')],'transfereeconnectedlinenum':_0xe73874[_0x7914('0x22')],'transfereeconnectedlinename':_0xe73874[_0x7914('0x23')],'transfereeaccountcode':_0xe73874[_0x7914('0x24')],'transfereecontext':_0xe73874[_0x7914('0x25')],'transfereeexten':_0xe73874[_0x7914('0x26')],'transfereelinkedid':_0xe73874[_0x7914('0x27')]});}writeDB(_0xe73874);}catch(_0x53b297){utils[_0x7914('0x28')](util[_0x7914('0x2')](_0x7914('0x14'),_0xe73874[_0x7914('0x5')]),_0x53b297);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e658018..6fad905 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 _0x4049=['[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','GetVoiceQueue'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x4049,0x177));var _0x9404=function(_0x40a472,_0x3ebb0a){_0x40a472=_0x40a472-0x0;var _0x1d3370=_0x4049[_0x40a472];return _0x1d3370;};'use strict';var BPromise=require(_0x9404('0x0'));var jayson=require(_0x9404('0x1'));var moment=require(_0x9404('0x2'));var util=require('util');var client=jayson['client'][_0x9404('0x3')]({'port':0x2329});var logger=require(_0x9404('0x4'))('xdr');exports['info']=function(_0x2eb0a0,_0x4de300){logger[_0x9404('0x5')](_0x2eb0a0,_0x4de300?util[_0x9404('0x6')](_0x4de300,{'showHidden':![],'depth':null}):'');};exports[_0x9404('0x7')]=function(_0x229e61,_0x29230a){logger[_0x9404('0x7')](_0x229e61,_0x29230a?util[_0x9404('0x6')](_0x29230a,{'showHidden':![],'depth':null}):'');};exports[_0x9404('0x8')]=function(_0x3b93a1,_0x3d5d55){logger[_0x9404('0x8')](_0x3b93a1,_0x3d5d55?util[_0x9404('0x6')](_0x3d5d55,{'showHidden':![],'depth':null}):'');};exports[_0x9404('0x9')]=function(_0x3f89cb,_0x3f1463){return client[_0x9404('0x9')](_0x3f89cb,{'body':_0x3f1463})[_0x9404('0xa')](function(_0x4e58d7){logger['debug'](_0x9404('0xb'),_0x3f89cb,_0x4e58d7?util[_0x9404('0x6')](_0x4e58d7,{'showHidden':![],'depth':null}):'');})[_0x9404('0xc')](function(_0x3398bd){logger[_0x9404('0x8')]('[utils][request]\x20name:%s',_0x3f89cb,_0x3398bd?util['inspect'](_0x3398bd,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1a29f9){return client[_0x9404('0x9')](_0x9404('0xd'),{'options':{'raw':!![],'attributes':['id',_0x9404('0xe'),_0x9404('0xf'),_0x9404('0x10')],'where':_0x1a29f9,'limit':0x1}})['then'](function(_0x75e18f){logger['debug'](_0x9404('0x11'),JSON['stringify'](_0x1a29f9),_0x75e18f?util['inspect'](_0x75e18f,{'showHidden':![],'depth':null}):'');return _0x75e18f[_0x9404('0x12')]['length']?_0x75e18f['result'][0x0]:null;});}exports[_0x9404('0x13')]=function(_0x3b565d){return new BPromise(function(_0x29f018,_0x1ab4b6){if(_0x3b565d){return getUser({'internal':_0x3b565d})[_0x9404('0xa')](function(_0x26c8a0){logger[_0x9404('0x5')](_0x9404('0x14'),_0x3b565d,_0x26c8a0?_0x9404('0x15'):'notfound');return _0x29f018(_0x26c8a0);})[_0x9404('0xc')](function(_0x456619){logger[_0x9404('0x8')](_0x9404('0x16'),_0x456619?util[_0x9404('0x6')](_0x456619,{'showHidden':![],'depth':null}):'');return _0x29f018(null);});}return _0x29f018(null);});};exports[_0x9404('0x17')]=function(_0x46e447){return new BPromise(function(_0x1db956,_0x4faf2f){if(_0x46e447){return getUser({'interface':_0x46e447})[_0x9404('0xa')](function(_0x241182){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x46e447,_0x241182?_0x9404('0x15'):'notfound');return _0x1db956(_0x241182);})['catch'](function(_0x36ab65){logger['error'](_0x9404('0x18'),_0x36ab65?util['inspect'](_0x36ab65,{'showHidden':![],'depth':null}):'');return _0x1db956(null);});}return _0x1db956(null);});};exports[_0x9404('0x19')]=function(_0x16d4fd){return new BPromise(function(_0x4eca2d,_0x3d41c5){if(_0x16d4fd){return getUser({'name':_0x16d4fd})[_0x9404('0xa')](function(_0x322cfc){logger[_0x9404('0x5')](_0x9404('0x1a'),_0x16d4fd,_0x322cfc?_0x9404('0x15'):_0x9404('0x1b'));return _0x4eca2d(_0x322cfc);})['catch'](function(_0x193536){logger[_0x9404('0x8')](_0x9404('0x1c'),_0x193536?util[_0x9404('0x6')](_0x193536,{'showHidden':![],'depth':null}):'');return _0x4eca2d(null);});}return _0x4eca2d(null);});};exports['getVoiceQueueByName']=function(_0xddb0f9){return new BPromise(function(_0x4a600a,_0x4a3af7){if(_0xddb0f9){return client[_0x9404('0x9')](_0x9404('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x9404('0xf'),'type','acw','acwTimeout'],'where':{'name':_0xddb0f9},'limit':0x1}})[_0x9404('0xa')](function(_0x2ed08c){logger[_0x9404('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0xddb0f9,_0x2ed08c?util[_0x9404('0x6')](_0x2ed08c,{'showHidden':![],'depth':null}):'');logger['info'](_0x9404('0x1e'),_0xddb0f9,_0x2ed08c?_0x9404('0x15'):_0x9404('0x1b'));return _0x4a600a(_0x2ed08c[_0x9404('0x12')][_0x9404('0x1f')]?_0x2ed08c['result'][0x0]:null);})[_0x9404('0xc')](function(_0x569c4f){logger[_0x9404('0x8')](_0x9404('0x20'),_0x569c4f?util[_0x9404('0x6')](_0x569c4f,{'showHidden':![],'depth':null}):'');return _0x4a600a(null);});}return _0x4a600a(null);});};exports[_0x9404('0x21')]=function(_0x105d1c,_0x10fdd6){return moment(_0x105d1c)[_0x9404('0x22')](_0x10fdd6,_0x9404('0x23'))[_0x9404('0x24')](_0x9404('0x25'));};exports['subtractTime']=function(_0x1d76f3,_0x3a1a99){return moment(_0x1d76f3)[_0x9404('0x26')](_0x3a1a99,_0x9404('0x23'))['format'](_0x9404('0x25'));};exports[_0x9404('0x27')]=function(_0x58911b,_0x1825a0){return moment(_0x58911b)[_0x9404('0x28')](moment(_0x1825a0),_0x9404('0x23'));};exports[_0x9404('0x29')]=function(_0x3c9dd1,_0x5e282d){return parseInt(_0x3c9dd1,0xa)+parseInt(_0x5e282d,0xa);};exports[_0x9404('0x2a')]=function(){return moment()[_0x9404('0x24')](_0x9404('0x25'));};exports[_0x9404('0x2b')]=function(_0x6aab28,_0x509247){if(_0x509247){return moment(_0x6aab28)[_0x9404('0x2b')](_0x509247);}return!![];};exports[_0x9404('0x2c')]=function(_0x17f0fb,_0x39570f){if(_0x39570f){return moment(_0x17f0fb)[_0x9404('0x2c')](_0x39570f);}else if(_0x17f0fb){return!![];}return![];}; \ No newline at end of file +var _0x529d=['debug','error','request','then','[utils][request]\x20name:%s','catch','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','notfound','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff','sumTime','now','format','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','xdr','info','inspect'];(function(_0x101d59,_0x331222){var _0x31dddd=function(_0x1598e8){while(--_0x1598e8){_0x101d59['push'](_0x101d59['shift']());}};_0x31dddd(++_0x331222);}(_0x529d,0x177));var _0xd529=function(_0x256c1e,_0x2ad331){_0x256c1e=_0x256c1e-0x0;var _0x2871ad=_0x529d[_0x256c1e];return _0x2871ad;};'use strict';var BPromise=require(_0xd529('0x0'));var jayson=require(_0xd529('0x1'));var moment=require('moment');var util=require(_0xd529('0x2'));var client=jayson[_0xd529('0x3')][_0xd529('0x4')]({'port':0x2329});var logger=require(_0xd529('0x5'))(_0xd529('0x6'));exports[_0xd529('0x7')]=function(_0x5b2006,_0x3dd639){logger[_0xd529('0x7')](_0x5b2006,_0x3dd639?util[_0xd529('0x8')](_0x3dd639,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x310e1b,_0xa10a61){logger[_0xd529('0x9')](_0x310e1b,_0xa10a61?util[_0xd529('0x8')](_0xa10a61,{'showHidden':![],'depth':null}):'');};exports[_0xd529('0xa')]=function(_0x3d3171,_0x1b1879){logger[_0xd529('0xa')](_0x3d3171,_0x1b1879?util[_0xd529('0x8')](_0x1b1879,{'showHidden':![],'depth':null}):'');};exports[_0xd529('0xb')]=function(_0x13314b,_0x510151){return client[_0xd529('0xb')](_0x13314b,{'body':_0x510151})[_0xd529('0xc')](function(_0xb89101){logger[_0xd529('0x9')](_0xd529('0xd'),_0x13314b,_0xb89101?util[_0xd529('0x8')](_0xb89101,{'showHidden':![],'depth':null}):'');})[_0xd529('0xe')](function(_0x7d9cc2){logger[_0xd529('0xa')]('[utils][request]\x20name:%s',_0x13314b,_0x7d9cc2?util['inspect'](_0x7d9cc2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x20d90b){return client[_0xd529('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xd529('0xf'),_0xd529('0x10')],'where':_0x20d90b,'limit':0x1}})[_0xd529('0xc')](function(_0x157c76){logger[_0xd529('0x9')](_0xd529('0x11'),JSON[_0xd529('0x12')](_0x20d90b),_0x157c76?util[_0xd529('0x8')](_0x157c76,{'showHidden':![],'depth':null}):'');return _0x157c76[_0xd529('0x13')][_0xd529('0x14')]?_0x157c76['result'][0x0]:null;});}exports[_0xd529('0x15')]=function(_0x280bae){return new BPromise(function(_0x23565d,_0x1fc9aa){if(_0x280bae){return getUser({'internal':_0x280bae})[_0xd529('0xc')](function(_0x2a6ca8){logger[_0xd529('0x7')](_0xd529('0x16'),_0x280bae,_0x2a6ca8?_0xd529('0x17'):'notfound');return _0x23565d(_0x2a6ca8);})[_0xd529('0xe')](function(_0x5719b5){logger[_0xd529('0xa')](_0xd529('0x18'),_0x5719b5?util[_0xd529('0x8')](_0x5719b5,{'showHidden':![],'depth':null}):'');return _0x23565d(null);});}return _0x23565d(null);});};exports['getUserByInterface']=function(_0x1d4c09){return new BPromise(function(_0x3ba832,_0x597837){if(_0x1d4c09){return getUser({'interface':_0x1d4c09})[_0xd529('0xc')](function(_0x47d33f){logger[_0xd529('0x7')](_0xd529('0x19'),_0x1d4c09,_0x47d33f?_0xd529('0x17'):'notfound');return _0x3ba832(_0x47d33f);})['catch'](function(_0x447ba5){logger[_0xd529('0xa')](_0xd529('0x1a'),_0x447ba5?util[_0xd529('0x8')](_0x447ba5,{'showHidden':![],'depth':null}):'');return _0x3ba832(null);});}return _0x3ba832(null);});};exports[_0xd529('0x1b')]=function(_0x408a9c){return new BPromise(function(_0x3f7f7,_0x23e589){if(_0x408a9c){return getUser({'name':_0x408a9c})[_0xd529('0xc')](function(_0x244ee3){logger[_0xd529('0x7')](_0xd529('0x1c'),_0x408a9c,_0x244ee3?_0xd529('0x17'):'notfound');return _0x3f7f7(_0x244ee3);})[_0xd529('0xe')](function(_0x8edd67){logger[_0xd529('0xa')]('[utils][getUserByName]',_0x8edd67?util['inspect'](_0x8edd67,{'showHidden':![],'depth':null}):'');return _0x3f7f7(null);});}return _0x3f7f7(null);});};exports[_0xd529('0x1d')]=function(_0x2ad375){return new BPromise(function(_0x4762ee,_0x8e9f3d){if(_0x2ad375){return client[_0xd529('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xd529('0xf'),_0xd529('0x1e'),_0xd529('0x1f'),'acwTimeout'],'where':{'name':_0x2ad375},'limit':0x1}})['then'](function(_0x23b94d){logger['debug'](_0xd529('0x20'),_0x2ad375,_0x23b94d?util[_0xd529('0x8')](_0x23b94d,{'showHidden':![],'depth':null}):'');logger[_0xd529('0x7')](_0xd529('0x21'),_0x2ad375,_0x23b94d?'found':_0xd529('0x22'));return _0x4762ee(_0x23b94d[_0xd529('0x13')]['length']?_0x23b94d[_0xd529('0x13')][0x0]:null);})['catch'](function(_0x564054){logger[_0xd529('0xa')]('[utils][getVoiceQueueByName]',_0x564054?util[_0xd529('0x8')](_0x564054,{'showHidden':![],'depth':null}):'');return _0x4762ee(null);});}return _0x4762ee(null);});};exports[_0xd529('0x23')]=function(_0x2aa31f,_0x5d81be){return moment(_0x2aa31f)[_0xd529('0x24')](_0x5d81be,'seconds')['format'](_0xd529('0x25'));};exports[_0xd529('0x26')]=function(_0x489c59,_0x388856){return moment(_0x489c59)[_0xd529('0x27')](_0x388856,_0xd529('0x28'))['format'](_0xd529('0x25'));};exports[_0xd529('0x29')]=function(_0x41ce9f,_0x164e2b){return moment(_0x41ce9f)[_0xd529('0x2a')](moment(_0x164e2b),_0xd529('0x28'));};exports[_0xd529('0x2b')]=function(_0x1c4bdb,_0x16fb31){return parseInt(_0x1c4bdb,0xa)+parseInt(_0x16fb31,0xa);};exports[_0xd529('0x2c')]=function(){return moment()[_0xd529('0x2d')](_0xd529('0x25'));};exports[_0xd529('0x2e')]=function(_0x2fb714,_0x2848da){if(_0x2848da){return moment(_0x2fb714)['isAfter'](_0x2848da);}return!![];};exports[_0xd529('0x2f')]=function(_0x5c2f1d,_0x1e597e){if(_0x1e597e){return moment(_0x5c2f1d)['isBefore'](_0x1e597e);}else if(_0x5c2f1d){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 e57e826..756f127 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 _0x19ea=['other','agent_name','test','setupLoggers','fs-extra','lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','xcally','client','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','body','\x20body=%s','method','headers','x-forwarded-for','statusCode','responseTime','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','connection','url','device'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x19ea,0x8e));var _0xa19e=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x19ea[_0x4e93a9];return _0x43013c;};var fs=require(_0xa19e('0x0'));var _=require(_0xa19e('0x1'));var ewinston=require('express-winston');var path=require(_0xa19e('0x2'));var util=require(_0xa19e('0x3'));var fileLogger=require(_0xa19e('0x4'))[_0xa19e('0x5')];var safeTemplate=require(_0xa19e('0x6'))[_0xa19e('0x7')];var maskSensitiveData=require('./mask-sensitive-data')[_0xa19e('0x8')];function ClientSideLogger(){function _0x377854(_0x2e922b){var _0xdb15b=path[_0xa19e('0x9')](_0xa19e('0xa'),_0xa19e('0xb'),_0xa19e('0xc'));var _0x3320c4=path[_0xa19e('0x9')](_0xa19e('0xd'),_0x2e922b['role']+'-'+_0x2e922b[_0xa19e('0xe')]);return fs[_0xa19e('0xf')](path[_0xa19e('0x9')](_0xdb15b,_0x3320c4))[_0xa19e('0x10')](function(){var _0xeb13fd=fileLogger(_0xa19e('0xd'),path['join'](_0xdb15b,_0x3320c4));return _0xeb13fd;})[_0xa19e('0x11')](function(_0x3d4310){throw _0x3d4310;});}this['log']=function(_0x577ab8,_0x357a95,_0x45e653,_0x5a17c1){return _0x377854(_0x577ab8['user'])[_0xa19e('0x10')](function(_0x334e46){var _0x2d367a=_0x334e46[_0x357a95];return _0x2d367a;})['then'](function(_0x3ef4af){var _0xeba11a=_0x577ab8[_0xa19e('0x12')]?_0x577ab8[_0xa19e('0x12')]['id']:_0xa19e('0x13');var _0x52ffe1=_0x5a17c1[_0xa19e('0x14')];var _0x1fe95b=_0x5a17c1[_0xa19e('0x15')];var _0x170b98=new Date(Number(_0x1fe95b));return _0x3ef4af(_0xeba11a,_0x170b98,_0x45e653,_0x52ffe1);})[_0xa19e('0x11')](function(_0x494def){fileLogger('client')[_0xa19e('0x16')](_0x494def);});};}function setupLoggers(_0x24de3e){return new Promise(function(_0x170dc9){var _0x1acfeb=new ClientSideLogger();var _0x4699c9=fileLogger(_0xa19e('0x17'));var _0x30d315=fileLogger(_0xa19e('0x18'));_0x24de3e[_0xa19e('0x19')]('client-side-logger',_0x1acfeb);_0x24de3e[_0xa19e('0x1a')](ewinston['logger']({'winstonInstance':_0x4699c9,'meta':![],'statusLevels':!![],'msg':function(_0x5d1782,_0x2b6ed0){var _0x3a5f81=_0xa19e('0x1b');if(!_['isEmpty'](_0x5d1782[_0xa19e('0x1c')])){_0x3a5f81+=_0xa19e('0x1d');var _0x38df83=_0x5d1782[_0xa19e('0x1c')];maskSensitiveData(_0x38df83);}return safeTemplate(util['format'](_0x3a5f81,_0x5d1782[_0xa19e('0x1e')],_0x5d1782[_0xa19e('0x1f')][_0xa19e('0x20')]?_0x5d1782['headers']['x-forwarded-for']:_0x5d1782['connection']['remoteAddress']||_0x5d1782['ip'],_0x5d1782['url'],_0x2b6ed0[_0xa19e('0x21')],_0x2b6ed0[_0xa19e('0x22')],_0x5d1782[_0xa19e('0x12')]?_0x5d1782[_0xa19e('0x12')]['id']:null,_0x5d1782[_0xa19e('0x12')]?_0x5d1782[_0xa19e('0x12')]['name']:null,_0x5d1782[_0xa19e('0x12')]?_0x5d1782[_0xa19e('0x12')][_0xa19e('0x23')]:null,_0x38df83?util[_0xa19e('0x24')](_0x38df83,![],null):''));}}));_0x24de3e[_0xa19e('0x1a')](ewinston[_0xa19e('0x25')]({'winstonInstance':_0x30d315,'meta':![],'statusLevels':!![],'msg':function(_0x8e8a56,_0xa1225e){var _0x2ecc72=_0xa19e('0x26');if(_0x8e8a56[_0xa19e('0x1c')]&&_0x8e8a56[_0xa19e('0x1c')]['device']&&_0x8e8a56[_0xa19e('0x1c')]['agent_id']){_0x2ecc72='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x2ecc72,_0x8e8a56[_0xa19e('0x1e')],_0x8e8a56['headers'][_0xa19e('0x20')]?_0x8e8a56[_0xa19e('0x1f')][_0xa19e('0x20')]:_0x8e8a56[_0xa19e('0x27')]['remoteAddress']||_0x8e8a56['ip'],_0x8e8a56[_0xa19e('0x28')],_0xa1225e[_0xa19e('0x21')],_0xa1225e[_0xa19e('0x22')],_0x8e8a56[_0xa19e('0x12')]?_0x8e8a56[_0xa19e('0x12')]['id']:null,_0x8e8a56[_0xa19e('0x12')]?_0x8e8a56[_0xa19e('0x12')]['name']:null,_0x8e8a56['user']?_0x8e8a56[_0xa19e('0x12')]['role']:null,_0x8e8a56['body']&&_0x8e8a56[_0xa19e('0x1c')][_0xa19e('0x29')]?_0x8e8a56['body'][_0xa19e('0x29')]:_0xa19e('0x2a'),_0x8e8a56[_0xa19e('0x1c')]&&_0x8e8a56[_0xa19e('0x1c')]['agent_id']?_0x8e8a56['body']['agent_id']:'',_0x8e8a56['body']&&_0x8e8a56[_0xa19e('0x1c')][_0xa19e('0x2b')]?_0x8e8a56[_0xa19e('0x1c')][_0xa19e('0x2b')]:'');},'ignoreRoute':function(_0x2d6dad){var _0x1396fc=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1396fc[_0xa19e('0x2c')](_0x2d6dad['url']);}}));return _0x170dc9();});}exports[_0xa19e('0x2d')]=setupLoggers; \ No newline at end of file +var _0xdccb=['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','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','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','agent_name','test','lodash','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','/var','log','join','client','role','name','ensureDir','then','catch','user','data','timestamp','error','api','auth'];(function(_0xe12b6d,_0x37065b){var _0x4a8d1b=function(_0x27e169){while(--_0x27e169){_0xe12b6d['push'](_0xe12b6d['shift']());}};_0x4a8d1b(++_0x37065b);}(_0xdccb,0x11e));var _0xbdcc=function(_0x43ba49,_0x7fecb1){_0x43ba49=_0x43ba49-0x0;var _0x20e11d=_0xdccb[_0x43ba49];return _0x20e11d;};var fs=require('fs-extra');var _=require(_0xbdcc('0x0'));var ewinston=require('express-winston');var path=require(_0xbdcc('0x1'));var util=require(_0xbdcc('0x2'));var fileLogger=require(_0xbdcc('0x3'))[_0xbdcc('0x4')];var safeTemplate=require('./safe-template')[_0xbdcc('0x5')];var maskSensitiveData=require(_0xbdcc('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x5d5156(_0x49a9fa){var _0x97ef99=path['join'](_0xbdcc('0x7'),_0xbdcc('0x8'),'xcally');var _0x41a0f2=path[_0xbdcc('0x9')](_0xbdcc('0xa'),_0x49a9fa[_0xbdcc('0xb')]+'-'+_0x49a9fa[_0xbdcc('0xc')]);return fs[_0xbdcc('0xd')](path[_0xbdcc('0x9')](_0x97ef99,_0x41a0f2))[_0xbdcc('0xe')](function(){var _0x3c9155=fileLogger(_0xbdcc('0xa'),path[_0xbdcc('0x9')](_0x97ef99,_0x41a0f2));return _0x3c9155;})[_0xbdcc('0xf')](function(_0x3628b9){throw _0x3628b9;});}this[_0xbdcc('0x8')]=function(_0x7805ad,_0x2ff80c,_0x24dd89,_0x442e8b){return _0x5d5156(_0x7805ad[_0xbdcc('0x10')])[_0xbdcc('0xe')](function(_0x40515c){var _0x55b495=_0x40515c[_0x2ff80c];return _0x55b495;})[_0xbdcc('0xe')](function(_0x329716){var _0x22b6c6=_0x7805ad[_0xbdcc('0x10')]?_0x7805ad[_0xbdcc('0x10')]['id']:'no-user';var _0x589fb5=_0x442e8b[_0xbdcc('0x11')];var _0x5f0d45=_0x442e8b[_0xbdcc('0x12')];var _0x3aa022=new Date(Number(_0x5f0d45));return _0x329716(_0x22b6c6,_0x3aa022,_0x24dd89,_0x589fb5);})[_0xbdcc('0xf')](function(_0xc2435){fileLogger(_0xbdcc('0xa'))[_0xbdcc('0x13')](_0xc2435);});};}function setupLoggers(_0x13617f){return new Promise(function(_0x10d4da){var _0x2c1de1=new ClientSideLogger();var _0x388b7a=fileLogger(_0xbdcc('0x14'));var _0x2d0ce2=fileLogger(_0xbdcc('0x15'));_0x13617f['set'](_0xbdcc('0x16'),_0x2c1de1);_0x13617f[_0xbdcc('0x17')](ewinston[_0xbdcc('0x18')]({'winstonInstance':_0x388b7a,'meta':![],'statusLevels':!![],'msg':function(_0x14b904,_0x5ad053){var _0x3b5da5=_0xbdcc('0x19');if(!_[_0xbdcc('0x1a')](_0x14b904[_0xbdcc('0x1b')])){_0x3b5da5+=_0xbdcc('0x1c');var _0x4c156a=_0x14b904[_0xbdcc('0x1b')];maskSensitiveData(_0x4c156a);}return safeTemplate(util[_0xbdcc('0x1d')](_0x3b5da5,_0x14b904['method'],_0x14b904[_0xbdcc('0x1e')][_0xbdcc('0x1f')]?_0x14b904[_0xbdcc('0x1e')][_0xbdcc('0x1f')]:_0x14b904[_0xbdcc('0x20')][_0xbdcc('0x21')]||_0x14b904['ip'],_0x14b904[_0xbdcc('0x22')],_0x5ad053['statusCode'],_0x5ad053[_0xbdcc('0x23')],_0x14b904[_0xbdcc('0x10')]?_0x14b904[_0xbdcc('0x10')]['id']:null,_0x14b904['user']?_0x14b904[_0xbdcc('0x10')]['name']:null,_0x14b904[_0xbdcc('0x10')]?_0x14b904[_0xbdcc('0x10')][_0xbdcc('0xb')]:null,_0x4c156a?util[_0xbdcc('0x24')](_0x4c156a,![],null):''));}}));_0x13617f['use'](ewinston[_0xbdcc('0x18')]({'winstonInstance':_0x2d0ce2,'meta':![],'statusLevels':!![],'msg':function(_0x121570,_0x37bdc8){var _0x1b457c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x121570[_0xbdcc('0x1b')]&&_0x121570[_0xbdcc('0x1b')][_0xbdcc('0x25')]&&_0x121570[_0xbdcc('0x1b')][_0xbdcc('0x26')]){_0x1b457c=_0xbdcc('0x27');}return util[_0xbdcc('0x1d')](_0x1b457c,_0x121570[_0xbdcc('0x28')],_0x121570[_0xbdcc('0x1e')][_0xbdcc('0x1f')]?_0x121570[_0xbdcc('0x1e')]['x-forwarded-for']:_0x121570[_0xbdcc('0x20')]['remoteAddress']||_0x121570['ip'],_0x121570[_0xbdcc('0x22')],_0x37bdc8[_0xbdcc('0x29')],_0x37bdc8['responseTime'],_0x121570[_0xbdcc('0x10')]?_0x121570[_0xbdcc('0x10')]['id']:null,_0x121570[_0xbdcc('0x10')]?_0x121570[_0xbdcc('0x10')][_0xbdcc('0xc')]:null,_0x121570['user']?_0x121570[_0xbdcc('0x10')]['role']:null,_0x121570['body']&&_0x121570[_0xbdcc('0x1b')][_0xbdcc('0x25')]?_0x121570[_0xbdcc('0x1b')][_0xbdcc('0x25')]:'other',_0x121570[_0xbdcc('0x1b')]&&_0x121570['body'][_0xbdcc('0x26')]?_0x121570[_0xbdcc('0x1b')][_0xbdcc('0x26')]:'',_0x121570[_0xbdcc('0x1b')]&&_0x121570['body'][_0xbdcc('0x2a')]?_0x121570[_0xbdcc('0x1b')][_0xbdcc('0x2a')]:'');},'ignoreRoute':function(_0x11ded0){var _0x5262bc=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5262bc[_0xbdcc('0x2b')](_0x11ded0[_0xbdcc('0x22')]);}}));return _0x10d4da();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index c9bac34..a3b68ba 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9ca=['isMoment','split','padStart','length','iftime','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','map','toLowerCase','indexOf','slice','circularDoWInterval','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','date','daysInMonth','min','MMM','includes','guess','test'];(function(_0x5cf8e1,_0xbc189){var _0x6319c6=function(_0x2ec647){while(--_0x2ec647){_0x5cf8e1['push'](_0x5cf8e1['shift']());}};_0x6319c6(++_0xbc189);}(_0xf9ca,0x195));var _0xaf9c=function(_0x459bf3,_0x43be26){_0x459bf3=_0x459bf3-0x0;var _0x2e93c8=_0xf9ca[_0x459bf3];return _0x2e93c8;};var _=require(_0xaf9c('0x0'));var moment=require(_0xaf9c('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]['map'](function(_0x5f30e5){return _0x5f30e5[_0xaf9c('0x2')];})[_0xaf9c('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xaf9c('0x4');var EINVALID_DATE=_0xaf9c('0x5');function throwIfDateNotValid(_0x40203b){if(!_0x40203b[_0xaf9c('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x28eec8){var _0x102a6a=_0x28eec8['split'](':')['map'](function(_0x20a44b){return parseInt(_0x20a44b,0xa);});var _0x373cfe=_0x102a6a[0x0];var _0x15c0bd=_0x102a6a[0x1];if(_0x373cfe<0x0||_0x373cfe>0x17||_0x15c0bd<0x0||_0x15c0bd>0x3b){throw new Error(EINVALID_DATE);}return[_0x373cfe,_0x15c0bd];}function circularDoWInterval(_0x4f0b18,_0x13804c){if(_0x4f0b18===_0x13804c){return[_0x4f0b18];}else{var _0x2193fc=moment[_0xaf9c('0x7')]();moment[_0xaf9c('0x7')]('en');var _0x17d83b=moment[_0xaf9c('0x8')]()[_0xaf9c('0x9')](function(_0x1c1fc8){return _0x1c1fc8[_0xaf9c('0xa')]();});moment[_0xaf9c('0x7')](_0x2193fc);var _0x54d649=_0x17d83b['indexOf'](_0x4f0b18);var _0x15de54=_0x17d83b[_0xaf9c('0xb')](_0x13804c);if(_0x15de54>_0x54d649){return _0x17d83b[_0xaf9c('0xc')](_0x54d649,_0x15de54+0x1);}else{var _0x4cdf12=_0x17d83b[_0xaf9c('0xc')](0x0,_0x15de54+0x1);var _0x5cbfe5=_0x17d83b[_0xaf9c('0xc')](_0x54d649);return _0x5cbfe5['concat'](_0x4cdf12);}}}module['exports'][_0xaf9c('0xd')]=circularDoWInterval;function circularMonthInterval(_0x317787,_0x50b633){if(_0x317787===_0x50b633){return[_0x317787];}else{var _0x12ce23=moment[_0xaf9c('0x7')]();moment[_0xaf9c('0x7')]('en');var _0x1ee4d9=moment['monthsShort']()[_0xaf9c('0x9')](function(_0x23ab75){return _0x23ab75[_0xaf9c('0xa')]();});moment[_0xaf9c('0x7')](_0x12ce23);var _0x3b0621=_0x1ee4d9[_0xaf9c('0xb')](_0x317787);var _0x1afd52=_0x1ee4d9[_0xaf9c('0xb')](_0x50b633);if(_0x1afd52>_0x3b0621){return _0x1ee4d9[_0xaf9c('0xc')](_0x3b0621,_0x1afd52+0x1);}else{var _0x2c9d27=_0x1ee4d9[_0xaf9c('0xc')](0x0,_0x1afd52+0x1);var _0x44fe9c=_0x1ee4d9[_0xaf9c('0xc')](_0x3b0621);return _0x44fe9c['concat'](_0x2c9d27);}}}module[_0xaf9c('0xe')][_0xaf9c('0xf')]=circularMonthInterval;function parseDom(_0xcb1041){var _0x1a7b76=parseInt(_0xcb1041,0xa);if(_0x1a7b76<0x1||_0x1a7b76>0x1f){throw new Error(EINVALID_DATE);}return _0x1a7b76;}function timeCompare(_0x11233a,_0x4c4efc,_0x2cfa1f){var _0x456fee=_0x11233a[_0xaf9c('0x10')]();var _0x82d28f=extractTime(_0x4c4efc);var _0x1fe047=_0x82d28f[0x0];var _0x53573d=_0x82d28f[0x1];var _0x4f7cad=_0x11233a[_0xaf9c('0x10')]()[_0xaf9c('0x11')](_0x1fe047)[_0xaf9c('0x12')](_0x53573d);throwIfDateNotValid(_0x4f7cad);var _0x148766=extractTime(_0x2cfa1f);var _0x4ad54=_0x148766[0x0];var _0x30d937=_0x148766[0x1];var _0x2ca573=_0x11233a[_0xaf9c('0x10')]()[_0xaf9c('0x11')](_0x4ad54)[_0xaf9c('0x12')](_0x30d937);throwIfDateNotValid(_0x2ca573);if(_0x2ca573[_0xaf9c('0x13')](_0x4f7cad)){var _0x4e4e7f=_0x456fee[_0xaf9c('0x10')]()[_0xaf9c('0x14')](_0xaf9c('0x15'));var _0x303bd7=_0x456fee['clone']()[_0xaf9c('0x16')](_0xaf9c('0x15'));return _0x456fee[_0xaf9c('0x17')](_0x4f7cad,_0x303bd7,undefined,'[]')||_0x456fee[_0xaf9c('0x17')](_0x4e4e7f,_0x2ca573,undefined,'[]');}else{return _0x456fee[_0xaf9c('0x17')](_0x4f7cad,_0x2ca573,undefined,'[]');}}module[_0xaf9c('0xe')][_0xaf9c('0x18')]=timeCompare;function dowCompare(_0xbac60d,_0x3171c7,_0x20ed84){var _0x1f23fa=_0xbac60d['locale']('en')[_0xaf9c('0x19')](_0xaf9c('0x1a'))['toLowerCase']();return circularDoWInterval(_0x3171c7,_0x20ed84)['includes'](_0x1f23fa);}module[_0xaf9c('0xe')][_0xaf9c('0x1b')]=dowCompare;function domCompare(_0x178828,_0x2e0962,_0x8fbf87){var _0x459c5e=_0x178828[_0xaf9c('0x1c')]();if(_0x2e0962===_0x8fbf87){return _0x459c5e===_0x2e0962;}else{var _0x598aec=_0x178828[_0xaf9c('0x1d')]();var _0x4d3086=_0x2e0962<_0x8fbf87;let _0x2041b1=![];var _0x406add=0x0;var _0x2406ee=0x0;if(_0x4d3086){_0x406add=Math['max'](0x1,_0x2e0962);_0x2406ee=Math['min'](_0x8fbf87,_0x598aec);_0x2041b1=_0x459c5e>=_0x406add&&_0x459c5e<=_0x2406ee;}else{_0x406add=Math[_0xaf9c('0x1e')](_0x2e0962,_0x598aec);_0x2406ee=Math['max'](0x1,_0x8fbf87);_0x2041b1=_0x459c5e>=_0x406add||_0x459c5e<=_0x2406ee;}return _0x2041b1;}}module[_0xaf9c('0xe')]['domCompare']=domCompare;function monthCompare(_0x3f4504,_0x1c5b68,_0x4edd61){var _0x3292c2=_0x3f4504[_0xaf9c('0x7')]('en')[_0xaf9c('0x19')](_0xaf9c('0x1f'))['toLowerCase']();return circularMonthInterval(_0x1c5b68,_0x4edd61)[_0xaf9c('0x20')](_0x3292c2);}module['exports']['monthCompare']=monthCompare;function iftime(_0x4ffa16,_0x21c2fc=moment['tz'][_0xaf9c('0x21')](),_0x1531e6=moment()){if(!validateRx[_0xaf9c('0x22')](_0x4ffa16)){throw new Error(EINVALID_STRING);}else{var _0x36b4c6=(moment[_0xaf9c('0x23')](_0x1531e6)?_0x1531e6[_0xaf9c('0x10')]():moment(_0x1531e6))['tz'](_0x21c2fc)[_0xaf9c('0x7')]('en');throwIfDateNotValid(_0x36b4c6);var _0x42daa0=_0x4ffa16[_0xaf9c('0x24')](',');var _0x1751ca=_0x42daa0[0x0];var _0x3070da=_0x42daa0[0x1];var _0x127e9b=_0x42daa0[0x2];var _0x3c9496=_0x42daa0[0x3];let _0x32be6b=!![];if(_0x1751ca!=='*'){var _0x5dd4bc=_0x1751ca[_0xaf9c('0x24')]('-');var _0x5afd8f=_[_0xaf9c('0x25')](_0x5dd4bc[0x0],0x5,'0');var _0x209a3c=_0x5dd4bc[_0xaf9c('0x26')]===0x2?_[_0xaf9c('0x25')](_0x5dd4bc[0x1],0x5,'0'):_0x5afd8f;_0x32be6b=timeCompare(_0x36b4c6,_0x5afd8f,_0x209a3c);}let _0x189d83=!![];if(_0x3070da!=='*'){var _0x2e6120=_0x3070da[_0xaf9c('0x24')]('-');var _0x1698ae=_0x2e6120[0x0];var _0x4e5958=_0x2e6120[_0xaf9c('0x26')]===0x2?_0x2e6120[0x1]:_0x1698ae;_0x189d83=dowCompare(_0x36b4c6,_0x1698ae,_0x4e5958);}let _0xb120f6=!![];if(_0x127e9b!=='*'){var _0x4e9919=_0x127e9b[_0xaf9c('0x24')]('-');var _0x292c78=parseDom(_0x4e9919[0x0]);var _0x5550fa=_0x4e9919[_0xaf9c('0x26')]===0x2?parseDom(_0x4e9919[0x1]):_0x292c78;_0xb120f6=domCompare(_0x36b4c6,_0x292c78,_0x5550fa);}let _0x9674e4=!![];if(_0x3c9496!=='*'){var _0x3ee876=_0x3c9496[_0xaf9c('0x24')]('-');var _0x3ce9c5=_0x3ee876[0x0];var _0x39c7b0=_0x3ee876[_0xaf9c('0x26')]===0x2?_0x3ee876[0x1]:_0x3ee876[0x0];_0x9674e4=monthCompare(_0x36b4c6,_0x3ce9c5,_0x39c7b0);}return _0x32be6b&&_0x189d83&&_0xb120f6&&_0x9674e4;}}module[_0xaf9c('0xe')][_0xaf9c('0x27')]=iftime; \ No newline at end of file +var _0xb730=['domCompare','MMM','includes','monthCompare','guess','padStart','split','length','iftime','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','isValid','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','max','min'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb730,0xc7));var _0x0b73=function(_0x1cef2a,_0x57e0a9){_0x1cef2a=_0x1cef2a-0x0;var _0x1638da=_0xb730[_0x1cef2a];return _0x1638da;};var _=require(_0x0b73('0x0'));var moment=require(_0x0b73('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][_0x0b73('0x2')](function(_0x1037e0){return _0x1037e0['source'];})[_0x0b73('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x0b73('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x77afe8){if(!_0x77afe8[_0x0b73('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x489d58){var _0x1c7965=_0x489d58['split'](':')['map'](function(_0x2b3790){return parseInt(_0x2b3790,0xa);});var _0x412af9=_0x1c7965[0x0];var _0x5040be=_0x1c7965[0x1];if(_0x412af9<0x0||_0x412af9>0x17||_0x5040be<0x0||_0x5040be>0x3b){throw new Error(EINVALID_DATE);}return[_0x412af9,_0x5040be];}function circularDoWInterval(_0x175be9,_0x221f38){if(_0x175be9===_0x221f38){return[_0x175be9];}else{var _0x28bf6c=moment[_0x0b73('0x6')]();moment['locale']('en');var _0x27d42c=moment['weekdaysShort']()[_0x0b73('0x2')](function(_0x193df2){return _0x193df2[_0x0b73('0x7')]();});moment[_0x0b73('0x6')](_0x28bf6c);var _0x6f6398=_0x27d42c[_0x0b73('0x8')](_0x175be9);var _0x3ae2ed=_0x27d42c[_0x0b73('0x8')](_0x221f38);if(_0x3ae2ed>_0x6f6398){return _0x27d42c[_0x0b73('0x9')](_0x6f6398,_0x3ae2ed+0x1);}else{var _0x246633=_0x27d42c[_0x0b73('0x9')](0x0,_0x3ae2ed+0x1);var _0x75e43d=_0x27d42c[_0x0b73('0x9')](_0x6f6398);return _0x75e43d[_0x0b73('0xa')](_0x246633);}}}module[_0x0b73('0xb')][_0x0b73('0xc')]=circularDoWInterval;function circularMonthInterval(_0x33765b,_0x3e4a77){if(_0x33765b===_0x3e4a77){return[_0x33765b];}else{var _0x27ce9b=moment[_0x0b73('0x6')]();moment['locale']('en');var _0x1f4ee8=moment[_0x0b73('0xd')]()[_0x0b73('0x2')](function(_0x23d34d){return _0x23d34d[_0x0b73('0x7')]();});moment[_0x0b73('0x6')](_0x27ce9b);var _0xda0ae5=_0x1f4ee8[_0x0b73('0x8')](_0x33765b);var _0x525abf=_0x1f4ee8[_0x0b73('0x8')](_0x3e4a77);if(_0x525abf>_0xda0ae5){return _0x1f4ee8['slice'](_0xda0ae5,_0x525abf+0x1);}else{var _0x5e1beb=_0x1f4ee8['slice'](0x0,_0x525abf+0x1);var _0x1c8504=_0x1f4ee8[_0x0b73('0x9')](_0xda0ae5);return _0x1c8504['concat'](_0x5e1beb);}}}module[_0x0b73('0xb')][_0x0b73('0xe')]=circularMonthInterval;function parseDom(_0x2dd87f){var _0x43e385=parseInt(_0x2dd87f,0xa);if(_0x43e385<0x1||_0x43e385>0x1f){throw new Error(EINVALID_DATE);}return _0x43e385;}function timeCompare(_0x4ab859,_0x56f1a7,_0xf2a42f){var _0x1af763=_0x4ab859[_0x0b73('0xf')]();var _0x57292c=extractTime(_0x56f1a7);var _0x27cae1=_0x57292c[0x0];var _0x418d50=_0x57292c[0x1];var _0x5f1900=_0x4ab859['clone']()[_0x0b73('0x10')](_0x27cae1)[_0x0b73('0x11')](_0x418d50);throwIfDateNotValid(_0x5f1900);var _0x1138d0=extractTime(_0xf2a42f);var _0x2b55aa=_0x1138d0[0x0];var _0x46367d=_0x1138d0[0x1];var _0x2a9aac=_0x4ab859[_0x0b73('0xf')]()[_0x0b73('0x10')](_0x2b55aa)[_0x0b73('0x11')](_0x46367d);throwIfDateNotValid(_0x2a9aac);if(_0x2a9aac[_0x0b73('0x12')](_0x5f1900)){var _0x4d5229=_0x1af763[_0x0b73('0xf')]()[_0x0b73('0x13')](_0x0b73('0x14'));var _0x44d6df=_0x1af763[_0x0b73('0xf')]()[_0x0b73('0x15')](_0x0b73('0x14'));return _0x1af763[_0x0b73('0x16')](_0x5f1900,_0x44d6df,undefined,'[]')||_0x1af763[_0x0b73('0x16')](_0x4d5229,_0x2a9aac,undefined,'[]');}else{return _0x1af763[_0x0b73('0x16')](_0x5f1900,_0x2a9aac,undefined,'[]');}}module[_0x0b73('0xb')][_0x0b73('0x17')]=timeCompare;function dowCompare(_0x1f99c2,_0x17933e,_0x453dc7){var _0x38db27=_0x1f99c2[_0x0b73('0x6')]('en')[_0x0b73('0x18')](_0x0b73('0x19'))[_0x0b73('0x7')]();return circularDoWInterval(_0x17933e,_0x453dc7)['includes'](_0x38db27);}module[_0x0b73('0xb')][_0x0b73('0x1a')]=dowCompare;function domCompare(_0x5716cb,_0xb044fe,_0x24a743){var _0x37237b=_0x5716cb['date']();if(_0xb044fe===_0x24a743){return _0x37237b===_0xb044fe;}else{var _0x2cf225=_0x5716cb['daysInMonth']();var _0x474a54=_0xb044fe<_0x24a743;let _0xcd5c9f=![];var _0x522429=0x0;var _0x2e0846=0x0;if(_0x474a54){_0x522429=Math[_0x0b73('0x1b')](0x1,_0xb044fe);_0x2e0846=Math[_0x0b73('0x1c')](_0x24a743,_0x2cf225);_0xcd5c9f=_0x37237b>=_0x522429&&_0x37237b<=_0x2e0846;}else{_0x522429=Math[_0x0b73('0x1c')](_0xb044fe,_0x2cf225);_0x2e0846=Math['max'](0x1,_0x24a743);_0xcd5c9f=_0x37237b>=_0x522429||_0x37237b<=_0x2e0846;}return _0xcd5c9f;}}module[_0x0b73('0xb')][_0x0b73('0x1d')]=domCompare;function monthCompare(_0x24f38d,_0x1a23bb,_0x2c51f3){var _0x577897=_0x24f38d[_0x0b73('0x6')]('en')[_0x0b73('0x18')](_0x0b73('0x1e'))[_0x0b73('0x7')]();return circularMonthInterval(_0x1a23bb,_0x2c51f3)[_0x0b73('0x1f')](_0x577897);}module[_0x0b73('0xb')][_0x0b73('0x20')]=monthCompare;function iftime(_0x4848c9,_0x7c5a3a=moment['tz'][_0x0b73('0x21')](),_0x4c09e1=moment()){if(!validateRx['test'](_0x4848c9)){throw new Error(EINVALID_STRING);}else{var _0x26b5a0=(moment['isMoment'](_0x4c09e1)?_0x4c09e1[_0x0b73('0xf')]():moment(_0x4c09e1))['tz'](_0x7c5a3a)[_0x0b73('0x6')]('en');throwIfDateNotValid(_0x26b5a0);var _0x114732=_0x4848c9['split'](',');var _0x1fe9ae=_0x114732[0x0];var _0x19428c=_0x114732[0x1];var _0x2fa9a2=_0x114732[0x2];var _0x910377=_0x114732[0x3];let _0x2e9f73=!![];if(_0x1fe9ae!=='*'){var _0x500bf2=_0x1fe9ae['split']('-');var _0x390824=_['padStart'](_0x500bf2[0x0],0x5,'0');var _0x47932d=_0x500bf2['length']===0x2?_[_0x0b73('0x22')](_0x500bf2[0x1],0x5,'0'):_0x390824;_0x2e9f73=timeCompare(_0x26b5a0,_0x390824,_0x47932d);}let _0x2e6217=!![];if(_0x19428c!=='*'){var _0x14d08b=_0x19428c[_0x0b73('0x23')]('-');var _0x17d4ca=_0x14d08b[0x0];var _0x2f899b=_0x14d08b['length']===0x2?_0x14d08b[0x1]:_0x17d4ca;_0x2e6217=dowCompare(_0x26b5a0,_0x17d4ca,_0x2f899b);}let _0xadaeee=!![];if(_0x2fa9a2!=='*'){var _0x479af0=_0x2fa9a2[_0x0b73('0x23')]('-');var _0x20955c=parseDom(_0x479af0[0x0]);var _0x35f361=_0x479af0[_0x0b73('0x24')]===0x2?parseDom(_0x479af0[0x1]):_0x20955c;_0xadaeee=domCompare(_0x26b5a0,_0x20955c,_0x35f361);}let _0xd254f1=!![];if(_0x910377!=='*'){var _0xf385cd=_0x910377['split']('-');var _0x3733cb=_0xf385cd[0x0];var _0x235393=_0xf385cd['length']===0x2?_0xf385cd[0x1]:_0xf385cd[0x0];_0xd254f1=monthCompare(_0x26b5a0,_0x3733cb,_0x235393);}return _0x2e9f73&&_0x2e6217&&_0xadaeee&&_0xd254f1;}}module['exports'][_0x0b73('0x25')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 3024489..f8af875 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5173=['level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','util','moment','winston','../config/environment','debugLevel','info','bold\x20yellow','white','bold\x20green','bold\x20magenta','bold\x20blue','addColors','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x34d993,_0x3c7017){var _0x4728c7=function(_0x12f5ca){while(--_0x12f5ca){_0x34d993['push'](_0x34d993['shift']());}};_0x4728c7(++_0x3c7017);}(_0x5173,0xb9));var _0x3517=function(_0x631629,_0x1898f9){_0x631629=_0x631629-0x0;var _0x19f175=_0x5173[_0x631629];return _0x19f175;};'use strict';var path=require('path');var util=require(_0x3517('0x0'));var moment=require(_0x3517('0x1'));var winston=require(_0x3517('0x2'));var config=require(_0x3517('0x3'));var debugLevel=config[_0x3517('0x4')]?config[_0x3517('0x4')]['toLowerCase']():_0x3517('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':_0x3517('0x6'),'info':_0x3517('0x7'),'print':'bold\x20white','success':_0x3517('0x8'),'http':'gray','verbose':_0x3517('0x9'),'debug':_0x3517('0xa'),'silly':'bold\x20cyan'};winston[_0x3517('0xb')](XC_LOG_COLORS);function getLogFileName(_0x4b9bbc,_0x218a13,_0x1a2385){var _0x539ac1=_0x4b9bbc||'/var/log/xcally';return path['join'](_0x539ac1,util[_0x3517('0xc')](_0x3517('0xd'),_0x218a13,_0x1a2385));}function formatter(_0x5e7344,_0x4b5bb9){_0x4b5bb9[_0x3517('0xe')]=_0x4b5bb9['message']['replace'](/@@{/g,'{{{')[_0x3517('0xf')](/}@@/g,_0x3517('0x10'))['replace'](/@{/g,'{{')[_0x3517('0xf')](/}@/g,'}}');return util[_0x3517('0xc')](_0x3517('0x11'),moment()[_0x3517('0xc')](_0x3517('0x12')),_0x4b5bb9[_0x3517('0x13')][_0x3517('0x14')](),_0x5e7344,_0x4b5bb9['message']);}function fileFormat(_0x1c3547,_0x37184a){_0x37184a['message']=_0x37184a[_0x3517('0xe')][_0x3517('0xf')](/@@{/g,'{{{')[_0x3517('0xf')](/}@@/g,_0x3517('0x10'))[_0x3517('0xf')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x839ba9=_0x37184a[_0x3517('0x15')]&&Object[_0x3517('0x16')](_0x37184a[_0x3517('0x15')])[_0x3517('0x17')]?'\x0a\x09'+JSON[_0x3517('0x18')](_0x37184a[_0x3517('0x15')]):'';return util[_0x3517('0xc')](_0x3517('0x19'),moment()[_0x3517('0xc')](_0x3517('0x12')),_0x37184a[_0x3517('0x13')][_0x3517('0x14')](),_0x1c3547,_0x37184a[_0x3517('0xe')],_0x839ba9);}function consoleLogger(){var _0x185ac7=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3517('0x1a'))][(_0x3517('0x1b'))]({'level':_0x3517('0x1c'),'json':![],'formatter':function(_0x16bcf2){return formatter('',_0x16bcf2);}})]});return _0x185ac7;}function fileLogger(_0x1267b6,_0x532610){var _0x5aed4c=new winston[(_0x3517('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3517('0x1a'))][(_0x3517('0x1e'))]({'name':util[_0x3517('0xc')](_0x3517('0x1f'),_0x1267b6,'error'),'filename':getLogFileName(_0x532610,_0x1267b6,_0x3517('0x20')),'level':_0x3517('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x59e59a){return fileFormat(_0x1267b6,_0x59e59a);}}),new winston['transports']['File']({'name':util[_0x3517('0xc')]('%s-%s',_0x1267b6,debugLevel),'filename':getLogFileName(_0x532610,_0x1267b6,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5e16df){return fileFormat(_0x1267b6,_0x5e16df);}}),new winston[(_0x3517('0x1a'))]['Console']({'level':'warn','json':![],'formatter':function(_0x13dead){return fileFormat(_0x1267b6,_0x13dead);}})]});return _0x5aed4c;}exports[_0x3517('0x21')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xa841=['File','%s-%s','error','Console','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','warn'];(function(_0x38325d,_0x3a6616){var _0x2cd93c=function(_0xf7e06d){while(--_0xf7e06d){_0x38325d['push'](_0x38325d['shift']());}};_0x2cd93c(++_0x3a6616);}(_0xa841,0x16d));var _0x1a84=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa841[_0x4e676e];return _0x336a3c;};'use strict';var path=require(_0x1a84('0x0'));var util=require(_0x1a84('0x1'));var moment=require(_0x1a84('0x2'));var winston=require(_0x1a84('0x3'));var config=require('../config/environment');var debugLevel=config[_0x1a84('0x4')]?config[_0x1a84('0x4')][_0x1a84('0x5')]():_0x1a84('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x1a84('0x7'),'error':'red','warn':_0x1a84('0x8'),'info':'white','print':'bold\x20white','success':_0x1a84('0x9'),'http':_0x1a84('0xa'),'verbose':_0x1a84('0xb'),'debug':'bold\x20blue','silly':_0x1a84('0xc')};winston[_0x1a84('0xd')](XC_LOG_COLORS);function getLogFileName(_0x22a46c,_0x4c5b04,_0xea056b){var _0x5e27c4=_0x22a46c||_0x1a84('0xe');return path['join'](_0x5e27c4,util['format']('%s-%s.log',_0x4c5b04,_0xea056b));}function formatter(_0x20db94,_0x11b1eb){_0x11b1eb[_0x1a84('0xf')]=_0x11b1eb[_0x1a84('0xf')]['replace'](/@@{/g,_0x1a84('0x10'))[_0x1a84('0x11')](/}@@/g,_0x1a84('0x12'))[_0x1a84('0x11')](/@{/g,'{{')[_0x1a84('0x11')](/}@/g,'}}');return util['format'](_0x1a84('0x13'),moment()[_0x1a84('0x14')](_0x1a84('0x15')),_0x11b1eb[_0x1a84('0x16')][_0x1a84('0x17')](),_0x20db94,_0x11b1eb[_0x1a84('0xf')]);}function fileFormat(_0x19d1c4,_0x4c6fbb){_0x4c6fbb[_0x1a84('0xf')]=_0x4c6fbb['message']['replace'](/@@{/g,'{{{')[_0x1a84('0x11')](/}@@/g,_0x1a84('0x12'))[_0x1a84('0x11')](/@{/g,'{{')[_0x1a84('0x11')](/}@/g,'}}');var _0x33f356=_0x4c6fbb['meta']&&Object[_0x1a84('0x18')](_0x4c6fbb[_0x1a84('0x19')])[_0x1a84('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x4c6fbb[_0x1a84('0x19')]):'';return util['format'](_0x1a84('0x1b'),moment()[_0x1a84('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4c6fbb[_0x1a84('0x16')]['toUpperCase'](),_0x19d1c4,_0x4c6fbb[_0x1a84('0xf')],_0x33f356);}function consoleLogger(){var _0x5f0acc=new winston[(_0x1a84('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1a84('0x1d'))]['Console']({'level':_0x1a84('0x1e'),'json':![],'formatter':function(_0x2057a3){return formatter('',_0x2057a3);}})]});return _0x5f0acc;}function fileLogger(_0x3ee9e1,_0x5a604e){var _0x3fad08=new winston[(_0x1a84('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1a84('0x1d'))][(_0x1a84('0x1f'))]({'name':util['format'](_0x1a84('0x20'),_0x3ee9e1,_0x1a84('0x21')),'filename':getLogFileName(_0x5a604e,_0x3ee9e1,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5f13b4){return fileFormat(_0x3ee9e1,_0x5f13b4);}}),new winston[(_0x1a84('0x1d'))][(_0x1a84('0x1f'))]({'name':util[_0x1a84('0x14')](_0x1a84('0x20'),_0x3ee9e1,debugLevel),'filename':getLogFileName(_0x5a604e,_0x3ee9e1,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2b91c1){return fileFormat(_0x3ee9e1,_0x2b91c1);}}),new winston[(_0x1a84('0x1d'))][(_0x1a84('0x22'))]({'level':_0x1a84('0x1e'),'json':![],'formatter':function(_0x368902){return fileFormat(_0x3ee9e1,_0x368902);}})]});return _0x3fad08;}exports['consoleLogger']=consoleLogger;exports[_0x1a84('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 428c189..517d405 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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x1a85,0x178));var _0x51a8=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0x1a85[_0x547add];return _0x2ed1f3;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x57ca,0x108));var _0xa57c=function(_0x6ad3e,_0x59aa50){_0x6ad3e=_0x6ad3e-0x0;var _0x13e78a=_0x57ca[_0x6ad3e];return _0x13e78a;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index aa57d6e..c297a0c 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['exports','\x5c$&'];(function(_0x4abd93,_0xf8b6e9){var _0x5682d5=function(_0x4ad50f){while(--_0x4ad50f){_0x4abd93['push'](_0x4abd93['shift']());}};_0x5682d5(++_0xf8b6e9);}(_0xf494,0x1c6));var _0x4f49=function(_0x43ac5a,_0x53feed){_0x43ac5a=_0x43ac5a-0x0;var _0x419c86=_0xf494[_0x43ac5a];return _0x419c86;};module[_0x4f49('0x0')]={'escapeRegExp'(_0x32e808,_0x3063f3=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x32e808['replace'](_0x3063f3,_0x4f49('0x1'));}}; \ No newline at end of file +var _0x57ca=['\x5c$&'];(function(_0xfb6cef,_0x206adf){var _0x40eb07=function(_0x12cd67){while(--_0x12cd67){_0xfb6cef['push'](_0xfb6cef['shift']());}};_0x40eb07(++_0x206adf);}(_0x57ca,0x108));var _0xa57c=function(_0x2cc001,_0x58b03e){_0x2cc001=_0x2cc001-0x0;var _0x562659=_0x57ca[_0x2cc001];return _0x562659;};module['exports']={'escapeRegExp'(_0x29cc65,_0x4ad696=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x29cc65['replace'](_0x4ad696,_0xa57c('0x0'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 5004576..674151b 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 _0x8603=['{\x20{\x20','\x20}\x20}','string','replace','isArray','keys','reduce','exports'];(function(_0x4380f5,_0x558cb6){var _0xf6bfe0=function(_0x53f252){while(--_0x53f252){_0x4380f5['push'](_0x4380f5['shift']());}};_0xf6bfe0(++_0x558cb6);}(_0x8603,0x190));var _0x3860=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x8603[_0x24a654];return _0x458651;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2f848f){return _0x2f848f==='{{'?_0x3860('0x0'):_0x3860('0x1');}function safeTemplate(_0x51bfda){var _0x4961d6=_0x51bfda;if(typeof _0x51bfda===_0x3860('0x2')){_0x4961d6=_0x51bfda[_0x3860('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3860('0x4')](_0x51bfda)){_0x4961d6=_0x51bfda['map'](function(_0x2fc97a){return safeTemplate(_0x2fc97a);});}else if(_['isPlainObject'](_0x51bfda)){_0x4961d6=Object[_0x3860('0x5')](_0x51bfda)[_0x3860('0x6')](function(_0x1eca44,_0xd3ce26){_0x1eca44[_0xd3ce26]=safeTemplate(_0x51bfda[_0xd3ce26]);return _0x1eca44;},{});}return _0x4961d6;}module[_0x3860('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x4fc2=['reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map','keys'];(function(_0x418cc8,_0x15b0de){var _0x28fd40=function(_0x48c5ff){while(--_0x48c5ff){_0x418cc8['push'](_0x418cc8['shift']());}};_0x28fd40(++_0x15b0de);}(_0x4fc2,0x111));var _0x24fc=function(_0x24ed85,_0x44c519){_0x24ed85=_0x24ed85-0x0;var _0x82bcd5=_0x4fc2[_0x24ed85];return _0x82bcd5;};var _=require(_0x24fc('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b05a5){return _0x2b05a5==='{{'?_0x24fc('0x1'):_0x24fc('0x2');}function safeTemplate(_0x5aaa74){var _0x365c56=_0x5aaa74;if(typeof _0x5aaa74===_0x24fc('0x3')){_0x365c56=_0x5aaa74[_0x24fc('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x5aaa74)){_0x365c56=_0x5aaa74[_0x24fc('0x5')](function(_0x3772eb){return safeTemplate(_0x3772eb);});}else if(_['isPlainObject'](_0x5aaa74)){_0x365c56=Object[_0x24fc('0x6')](_0x5aaa74)[_0x24fc('0x7')](function(_0x4889f4,_0x115851){_0x4889f4[_0x115851]=safeTemplate(_0x5aaa74[_0x115851]);return _0x4889f4;},{});}return _0x365c56;}module[_0x24fc('0x8')][_0x24fc('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 847660d..4d92e45 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 _0xf021=['apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','writeJSON','exports','fs-extra','../config/environment','root','server/app.json','resolve'];(function(_0x48b27b,_0x45a861){var _0x799f1c=function(_0x2b8812){while(--_0x2b8812){_0x48b27b['push'](_0x48b27b['shift']());}};_0x799f1c(++_0x45a861);}(_0xf021,0xfb));var _0x1f02=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0xf021[_0xbbfe59];return _0x28a2a4;};var fs=require(_0x1f02('0x0'));var path=require('path');var config=require(_0x1f02('0x1'));var root=config[_0x1f02('0x2')];var APP_JSON_PATH=path['resolve'](root,_0x1f02('0x3'));var NODEPATH=path[_0x1f02('0x4')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x4b360d){let _0x78dcc=![];if(Array['isArray'](_0x4b360d['apps'])){var _0x201eb9=_0x4b360d[_0x1f02('0x5')][_0x1f02('0x6')](function(_0x2eba4a){return _0x2eba4a[_0x1f02('0x7')]===_0x1f02('0x8');});if(_0x201eb9>-0x1){var _0x4d7228=_0x4b360d[_0x1f02('0x5')][_0x201eb9];if(typeof _0x4d7228[_0x1f02('0x9')][_0x1f02('0xa')]!==_0x1f02('0xb')){_0x4d7228[_0x1f02('0x9')][_0x1f02('0xa')]=NODEPATH;_0x78dcc=!![];}}return{'appConfig':_0x4b360d,'updated':_0x78dcc};}}function updateAppConfig(_0x2aa36a){return fs[_0x1f02('0xc')](APP_JSON_PATH)['then'](function(_0x2cfb35){if(_0x2cfb35){return fs['readJSON'](APP_JSON_PATH)[_0x1f02('0xd')](function(_0x2ce235){var _0x59cf71=setLegacyLibsNodeEnvPath(_0x2ce235);if(_0x59cf71['updated']){_0x2aa36a['info']('Updating\x20app.json');return fs[_0x1f02('0xe')](APP_JSON_PATH,_0x2ce235,{'spaces':0x2});}else{return Promise[_0x1f02('0x4')]();}});}else{return Promise['resolve']();}});}module[_0x1f02('0xf')]=updateAppConfig; \ No newline at end of file +var _0xc4a3=['updated','Updating\x20app.json','writeJSON','exports','fs-extra','path','root','resolve','server/app.json','legacy-libs','apps','findIndex','name','motion2','NODE_PATH','string','env','then'];(function(_0x1de0b9,_0xc6f046){var _0x18edae=function(_0x2d3ad1){while(--_0x2d3ad1){_0x1de0b9['push'](_0x1de0b9['shift']());}};_0x18edae(++_0xc6f046);}(_0xc4a3,0x112));var _0x3c4a=function(_0x4e0cc5,_0x577f6e){_0x4e0cc5=_0x4e0cc5-0x0;var _0x55d4fa=_0xc4a3[_0x4e0cc5];return _0x55d4fa;};var fs=require(_0x3c4a('0x0'));var path=require(_0x3c4a('0x1'));var config=require('../config/environment');var root=config[_0x3c4a('0x2')];var APP_JSON_PATH=path[_0x3c4a('0x3')](root,_0x3c4a('0x4'));var NODEPATH=path[_0x3c4a('0x3')](root,_0x3c4a('0x5'));function setLegacyLibsNodeEnvPath(_0x1c57d6){let _0x2af4e7=![];if(Array['isArray'](_0x1c57d6[_0x3c4a('0x6')])){var _0x5d4d0b=_0x1c57d6[_0x3c4a('0x6')][_0x3c4a('0x7')](function(_0x2e969e){return _0x2e969e[_0x3c4a('0x8')]===_0x3c4a('0x9');});if(_0x5d4d0b>-0x1){var _0x32539d=_0x1c57d6[_0x3c4a('0x6')][_0x5d4d0b];if(typeof _0x32539d['env'][_0x3c4a('0xa')]!==_0x3c4a('0xb')){_0x32539d[_0x3c4a('0xc')][_0x3c4a('0xa')]=NODEPATH;_0x2af4e7=!![];}}return{'appConfig':_0x1c57d6,'updated':_0x2af4e7};}}function updateAppConfig(_0x458c90){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x424122){if(_0x424122){return fs['readJSON'](APP_JSON_PATH)[_0x3c4a('0xd')](function(_0x291a6b){var _0xea5f89=setLegacyLibsNodeEnvPath(_0x291a6b);if(_0xea5f89[_0x3c4a('0xe')]){_0x458c90['info'](_0x3c4a('0xf'));return fs[_0x3c4a('0x10')](APP_JSON_PATH,_0x291a6b,{'spaces':0x2});}else{return Promise[_0x3c4a('0x3')]();}});}else{return Promise['resolve']();}});}module[_0x3c4a('0x11')]=updateAppConfig; \ No newline at end of file